aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-18 23:37:54 +0200
committerWillem Jan Palenstijn2013-05-08 20:46:44 +0200
commit02c5cc75a7cb8885d2a0fa141fbc0e763c5b31a0 (patch)
tree72b64a67ebeca41e9b83593da80850e848a99e2e
parent1539023834a2ad7cf8942711d60983891a10a82a (diff)
parent1e200620d673af4acdd2d128ed6e390df001aacf (diff)
downloadscummvm-rg350-02c5cc75a7cb8885d2a0fa141fbc0e763c5b31a0.tar.gz
scummvm-rg350-02c5cc75a7cb8885d2a0fa141fbc0e763c5b31a0.tar.bz2
scummvm-rg350-02c5cc75a7cb8885d2a0fa141fbc0e763c5b31a0.zip
Merge branch 'master'
Conflicts: configure base/plugins.cpp
-rw-r--r--AUTHORS430
-rw-r--r--Makefile2
-rw-r--r--NEWS57
-rw-r--r--README63
-rw-r--r--audio/audiostream.cpp38
-rw-r--r--audio/audiostream.h10
-rw-r--r--audio/decoders/adpcm.cpp32
-rw-r--r--audio/decoders/adpcm_intern.h22
-rw-r--r--audio/decoders/aiff.h1
-rw-r--r--audio/decoders/qdm2.cpp984
-rw-r--r--audio/decoders/quicktime.cpp475
-rw-r--r--audio/decoders/quicktime.h1
-rw-r--r--audio/decoders/quicktime_intern.h60
-rw-r--r--audio/decoders/voc.cpp14
-rw-r--r--audio/mididrv.cpp2
-rw-r--r--audio/midiparser.cpp210
-rw-r--r--audio/midiparser.h66
-rw-r--r--audio/midiparser_smf.cpp176
-rw-r--r--audio/midiparser_xmidi.cpp99
-rw-r--r--audio/mixer.h2
-rw-r--r--audio/mods/maxtrax.h9
-rw-r--r--audio/mods/protracker.cpp4
-rw-r--r--audio/mods/protracker.h1
-rw-r--r--audio/mods/tfmx.h7
-rw-r--r--audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp2
-rw-r--r--audio/softsynth/mt32/Part.cpp2
-rw-r--r--audio/softsynth/mt32/Partial.h2
-rw-r--r--audio/softsynth/mt32/PartialManager.cpp2
-rw-r--r--audio/softsynth/mt32/Structures.h4
-rw-r--r--audio/softsynth/mt32/Synth.cpp2
-rw-r--r--audio/softsynth/mt32/TVA.cpp2
-rw-r--r--audio/softsynth/mt32/TVF.cpp4
-rw-r--r--audio/softsynth/mt32/freeverb.cpp2
-rw-r--r--audio/softsynth/opl/mame.cpp4
-rw-r--r--backends/events/gph/gph-events.cpp152
-rw-r--r--backends/events/gph/gph-events.h7
-rw-r--r--backends/events/openpandora/op-events.cpp33
-rw-r--r--backends/events/sdl/sdl-events.cpp2
-rw-r--r--backends/events/sdl/sdl-events.h2
-rw-r--r--backends/events/webossdl/webossdl-events.h6
-rw-r--r--backends/fs/symbian/symbian-fs.cpp4
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp6
-rw-r--r--backends/graphics/gph/gph-graphics.cpp10
-rw-r--r--backends/graphics/graphics.h8
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp2
-rw-r--r--backends/graphics/null/null-graphics.h8
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp96
-rw-r--r--backends/graphics/opengl/opengl-graphics.h10
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp4
-rw-r--r--backends/graphics/openpandora/op-graphics.cpp43
-rw-r--r--backends/graphics/openpandora/op-graphics.h23
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp128
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h10
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.cpp19
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.h6
-rw-r--r--backends/keymapper/hardware-input.cpp36
-rw-r--r--backends/keymapper/hardware-input.h53
-rw-r--r--backends/keymapper/keymap.cpp46
-rw-r--r--backends/keymapper/keymap.h12
-rw-r--r--backends/keymapper/keymapper.cpp170
-rw-r--r--backends/keymapper/keymapper.h36
-rw-r--r--backends/keymapper/remap-dialog.cpp58
-rw-r--r--backends/keymapper/remap-dialog.h4
-rw-r--r--backends/midi/coreaudio.cpp31
-rw-r--r--backends/midi/sndio.cpp152
-rw-r--r--backends/midi/stmidi.cpp2
-rw-r--r--backends/midi/timidity.cpp2
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.cpp4
-rw-r--r--backends/mixer/symbiansdl/symbiansdl-mixer.cpp2
-rw-r--r--backends/modular-backend.cpp10
-rw-r--r--backends/modular-backend.h8
-rw-r--r--backends/module.mk1
-rw-r--r--backends/platform/android/android.cpp1
-rw-r--r--backends/platform/android/android.h10
-rw-r--r--backends/platform/android/android.mk13
-rw-r--r--backends/platform/android/gfx.cpp28
-rw-r--r--backends/platform/android/texture.cpp63
-rw-r--r--backends/platform/bada/application.cpp2
-rw-r--r--backends/platform/bada/sscanf.cpp2
-rw-r--r--backends/platform/bada/system.cpp14
-rw-r--r--backends/platform/dc/dc.h8
-rw-r--r--backends/platform/dc/dcmain.cpp1
-rw-r--r--backends/platform/dc/display.cpp25
-rw-r--r--backends/platform/dc/vmsave.cpp5
-rw-r--r--backends/platform/dingux/README.DINGUX19
-rw-r--r--backends/platform/dingux/dingux.mk1
-rw-r--r--backends/platform/dingux/scummvm.pngbin0 -> 2656 bytes
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp2
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.h2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp21
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h8
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/caanoo-bundle.mk0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/gp2xwiz-bundle.mk0
-rw-r--r--backends/platform/gph/gph-backend.cpp49
-rw-r--r--backends/platform/gph/gph-main.cpp4
-rw-r--r--backends/platform/gph/gph.h9
-rw-r--r--backends/platform/iphone/iphone_common.h10
-rw-r--r--backends/platform/iphone/iphone_video.h9
-rw-r--r--backends/platform/iphone/iphone_video.mm157
-rw-r--r--backends/platform/iphone/osys_events.cpp25
-rw-r--r--backends/platform/iphone/osys_main.cpp8
-rw-r--r--backends/platform/iphone/osys_main.h8
-rw-r--r--backends/platform/iphone/osys_video.mm53
-rw-r--r--backends/platform/maemo/debian/changelog16
-rw-r--r--backends/platform/maemo/debian/control2
-rwxr-xr-xbackends/platform/maemo/debian/rules4
-rw-r--r--backends/platform/maemo/maemo.cpp6
-rw-r--r--backends/platform/n64/framfs_save_manager.h4
-rw-r--r--backends/platform/n64/osys_n64.h10
-rw-r--r--backends/platform/n64/osys_n64_base.cpp50
-rw-r--r--backends/platform/n64/pakfs_save_manager.h4
-rw-r--r--[-rwxr-xr-x]backends/platform/openpandora/module.mk0
-rw-r--r--backends/platform/openpandora/op-backend.cpp98
-rw-r--r--[-rwxr-xr-x]backends/platform/openpandora/op-bundle.mk0
-rw-r--r--backends/platform/openpandora/op-options.cpp5
-rw-r--r--backends/platform/openpandora/op-sdl.h2
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp4
-rw-r--r--backends/platform/ps2/Gs2dScreen.h4
-rw-r--r--backends/platform/ps2/icon.h4
-rw-r--r--backends/platform/ps2/ps2time.cpp9
-rw-r--r--backends/platform/ps2/savefilemgr.cpp4
-rw-r--r--backends/platform/ps2/savefilemgr.h2
-rw-r--r--backends/platform/ps2/systemps2.cpp14
-rw-r--r--backends/platform/ps2/systemps2.h8
-rw-r--r--backends/platform/psp/README.PSP2
-rw-r--r--backends/platform/psp/default_display_client.cpp8
-rw-r--r--backends/platform/psp/default_display_client.h8
-rw-r--r--backends/platform/psp/display_manager.cpp2
-rw-r--r--backends/platform/psp/osys_psp.cpp17
-rw-r--r--backends/platform/psp/osys_psp.h8
-rw-r--r--backends/platform/psp/psp_main.cpp2
-rw-r--r--backends/platform/psp/tests.cpp4
-rw-r--r--backends/platform/psp/tests.h2
-rw-r--r--backends/platform/psp/trace.h2
-rw-r--r--[-rwxr-xr-x]backends/platform/sdl/macosx/appmenu_osx.h0
-rw-r--r--[-rwxr-xr-x]backends/platform/sdl/macosx/appmenu_osx.mm0
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp2
-rw-r--r--backends/platform/sdl/macosx/macosx.h2
-rw-r--r--backends/platform/sdl/main.cpp66
-rw-r--r--backends/platform/sdl/module.mk1
-rw-r--r--backends/platform/sdl/sdl.cpp1
-rw-r--r--backends/platform/symbian/src/ScummApp.cpp10
-rw-r--r--backends/platform/symbian/src/ScummApp.h6
-rw-r--r--backends/platform/symbian/src/SymbianActions.cpp4
-rw-r--r--backends/platform/symbian/src/portdefs.h2
-rw-r--r--backends/platform/webos/webos.cpp20
-rw-r--r--backends/platform/webos/webos.h3
-rw-r--r--backends/platform/wii/osystem.cpp3
-rw-r--r--backends/platform/wii/osystem.h14
-rw-r--r--backends/platform/wii/osystem_gfx.cpp78
-rw-r--r--backends/platform/wince/wince-sdl.cpp1
-rw-r--r--backends/saves/default/default-saves.cpp4
-rw-r--r--backends/saves/default/default-saves.h2
-rw-r--r--backends/saves/windows/windows-saves.cpp4
-rw-r--r--backends/taskbar/win32/mingw-compat.h4
-rw-r--r--[-rwxr-xr-x]backends/timer/bada/timer.cpp230
-rw-r--r--[-rwxr-xr-x]backends/timer/bada/timer.h124
-rw-r--r--backends/timer/default/default-timer.cpp3
-rw-r--r--backends/timer/default/default-timer.h1
-rw-r--r--backends/timer/psp/timer.cpp2
-rw-r--r--backends/vkeybd/virtual-keyboard-gui.cpp8
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.cpp14
-rw-r--r--base/commandLine.cpp13
-rw-r--r--base/internal_version.h2
-rw-r--r--base/main.cpp25
-rw-r--r--base/plugins.cpp109
-rw-r--r--base/plugins.h4
-rw-r--r--base/version.cpp4
-rw-r--r--common/EventDispatcher.cpp6
-rw-r--r--common/EventMapper.cpp38
-rw-r--r--common/array.h2
-rw-r--r--common/coroutines.cpp731
-rw-r--r--common/coroutines.h560
-rw-r--r--common/cosinetables.cpp8252
-rw-r--r--common/cosinetables.h30
-rw-r--r--common/dct.cpp5
-rw-r--r--common/dct.h3
-rw-r--r--common/endian.h16
-rw-r--r--common/events.h17
-rw-r--r--common/fft.cpp67
-rw-r--r--common/fft.h12
-rw-r--r--common/gui_options.cpp26
-rw-r--r--common/gui_options.h18
-rw-r--r--common/installshield_cab.cpp (renamed from engines/agos/installshield_cab.cpp)126
-rw-r--r--common/installshield_cab.h (renamed from engines/agos/installshield_cab.h)18
-rw-r--r--common/keyboard.h14
-rw-r--r--common/language.cpp18
-rw-r--r--common/language.h6
-rw-r--r--common/macresman.cpp22
-rw-r--r--common/macresman.h3
-rw-r--r--common/math.h2
-rw-r--r--common/memstream.h11
-rw-r--r--common/module.mk4
-rw-r--r--common/ptr.h4
-rw-r--r--common/quicktime.cpp43
-rw-r--r--common/quicktime.h37
-rw-r--r--common/rational.h3
-rw-r--r--common/rdft.cpp8
-rw-r--r--common/rdft.h8
-rw-r--r--common/rect.h20
-rw-r--r--common/rendermode.cpp41
-rw-r--r--common/rendermode.h6
-rw-r--r--common/savefile.h18
-rw-r--r--common/scummsys.h7
-rw-r--r--common/sinetables.cpp8252
-rw-r--r--common/sinetables.h30
-rw-r--r--common/singleton.h2
-rw-r--r--common/system.h57
-rw-r--r--common/taskbar.h2
-rw-r--r--common/translation.cpp5
-rw-r--r--common/unzip.cpp20
-rw-r--r--common/updates.h2
-rw-r--r--common/util.h2
-rw-r--r--common/winexe_pe.cpp2
-rw-r--r--common/xmlparser.cpp18
-rw-r--r--common/zlib.cpp63
-rw-r--r--common/zlib.h29
-rwxr-xr-xconfigure411
-rw-r--r--devtools/README2
-rw-r--r--devtools/create_drascula/staticdata.h8
-rw-r--r--devtools/create_kyradat/create_kyradat.cpp4
-rw-r--r--devtools/create_kyradat/extract.cpp2
-rw-r--r--devtools/create_kyradat/games.cpp3
-rw-r--r--devtools/create_kyradat/tables.cpp3
-rw-r--r--devtools/create_lure/create_lure_dat.h1
-rw-r--r--devtools/create_project/config.h8
-rw-r--r--devtools/create_project/create_project.cpp74
-rw-r--r--devtools/create_project/create_project.h32
-rw-r--r--devtools/create_project/msbuild.cpp46
-rw-r--r--devtools/create_project/msvc.cpp19
-rw-r--r--devtools/create_project/msvc.h2
-rw-r--r--devtools/create_project/msvc11/create_project.sln20
-rw-r--r--devtools/create_project/msvc11/create_project.vcxproj131
-rw-r--r--devtools/create_project/msvc11/create_project.vcxproj.filters71
-rw-r--r--devtools/create_project/scripts/postbuild.cmd3
-rw-r--r--devtools/create_project/visualstudio.cpp10
-rw-r--r--[-rwxr-xr-x]devtools/create_project/xcode.cpp91
-rw-r--r--devtools/create_teenagent/create_teenagent.cpp2
-rw-r--r--devtools/create_tony/create_tony.cpp183
-rw-r--r--devtools/create_tony/create_tony.h44
-rw-r--r--devtools/create_tony/module.mk10
-rw-r--r--devtools/create_tony/staticdata.h1370
-rw-r--r--devtools/create_translations/cp_parser.cpp4
-rw-r--r--devtools/create_translations/po_parser.cpp47
-rwxr-xr-xdevtools/credits.pl57
-rw-r--r--devtools/module.mk2
-rw-r--r--devtools/scumm-md5.txt25
-rw-r--r--dists/android/AndroidManifest.xml2
-rw-r--r--dists/android/plugin-manifest.xml2
-rw-r--r--dists/bada/Res/scummmobile/THEMERC2
-rw-r--r--dists/bada/Res/scummmobile/scummmobile_layout.stx26
-rw-r--r--dists/engine-data/README12
-rw-r--r--dists/engine-data/drascula.datbin218771 -> 219267 bytes
-rw-r--r--dists/engine-data/kyra.datbin469735 -> 471460 bytes
-rw-r--r--dists/engine-data/teenagent.datbin70047 -> 141090 bytes
-rw-r--r--dists/engine-data/tony.datbin0 -> 24584 bytes
-rw-r--r--dists/gph/README-GPH2
-rw-r--r--dists/gph/scummvm.ini2
-rw-r--r--dists/iphone/Info.plist4
-rw-r--r--[-rwxr-xr-x]dists/iphone/scummvm.xcodeproj/project.pbxproj0
-rw-r--r--dists/irix/scummvm.spec2
-rw-r--r--dists/macosx/Info.plist6
-rw-r--r--[-rwxr-xr-x]dists/macosx/scummvm_osx_appcast.xml0
-rw-r--r--dists/msvc11/create_msvc11.bat95
-rw-r--r--dists/msvc11/readme.txt6
-rw-r--r--dists/openpandora/PXML.xml8
-rw-r--r--dists/openpandora/README-OPENPANDORA2
-rw-r--r--dists/openpandora/README-PND.txt2
-rw-r--r--dists/openpandora/index.html4
-rw-r--r--dists/redhat/scummvm-tools.spec2
-rw-r--r--dists/redhat/scummvm.spec5
-rw-r--r--dists/redhat/scummvm.spec.in3
-rw-r--r--dists/samsungtv/scummvm.dat16
-rw-r--r--dists/scummvm.62
-rw-r--r--dists/scummvm.rc12
-rw-r--r--dists/scummvm.rc.in1
-rwxr-xr-xdists/slackware/scummvm.SlackBuild2
-rw-r--r--dists/wii/meta.xml2
-rw-r--r--dists/win32/ScummVM.iss14
-rw-r--r--dists/win32/scummvm.nsi4
-rw-r--r--doc/cz/PrectiMe55
-rw-r--r--doc/da/HurtigStart151
-rw-r--r--doc/de/Liesmich143
-rw-r--r--doc/de/Neues94
-rw-r--r--doc/se/LasMig160
-rw-r--r--engines/advancedDetector.cpp134
-rw-r--r--engines/advancedDetector.h58
-rw-r--r--engines/agi/agi.cpp78
-rw-r--r--engines/agi/agi.h16
-rw-r--r--engines/agi/detection.cpp38
-rw-r--r--engines/agi/detection_tables.h4
-rw-r--r--engines/agi/keyboard.cpp26
-rw-r--r--engines/agi/loader_v1.cpp16
-rw-r--r--engines/agi/menu.cpp2
-rw-r--r--engines/agi/module.mk1
-rw-r--r--engines/agi/op_cmd.cpp6
-rw-r--r--engines/agi/op_test.cpp2
-rw-r--r--engines/agi/opcodes.cpp2
-rw-r--r--engines/agi/predictive.cpp617
-rw-r--r--engines/agi/saveload.cpp137
-rw-r--r--engines/agi/sound_pcjr.cpp4
-rw-r--r--engines/agi/text.cpp4
-rw-r--r--engines/agi/words.cpp4
-rw-r--r--engines/agos/agos.h3
-rw-r--r--engines/agos/animation.cpp103
-rw-r--r--engines/agos/animation.h6
-rw-r--r--engines/agos/charset-fontdata.cpp90
-rw-r--r--engines/agos/event.cpp6
-rw-r--r--engines/agos/midiparser_s1d.cpp47
-rw-r--r--engines/agos/module.mk1
-rw-r--r--engines/agos/res.cpp8
-rw-r--r--engines/agos/saveload.cpp43
-rw-r--r--engines/agos/script_s1.cpp9
-rw-r--r--engines/agos/sound.cpp2
-rw-r--r--engines/cge/bitmap.cpp9
-rw-r--r--engines/cge/cge.cpp16
-rw-r--r--engines/cge/cge.h5
-rw-r--r--engines/cge/cge_main.cpp68
-rw-r--r--engines/cge/cge_main.h6
-rw-r--r--engines/cge/detection.cpp13
-rw-r--r--engines/cge/events.cpp47
-rw-r--r--engines/cge/events.h3
-rw-r--r--engines/cge/fileio.cpp27
-rw-r--r--engines/cge/sound.cpp12
-rw-r--r--engines/cge/text.cpp2
-rw-r--r--engines/cge/vga13h.cpp11
-rw-r--r--engines/cge/vga13h.h3
-rw-r--r--engines/cge/vmenu.cpp6
-rw-r--r--engines/cge/vmenu.h2
-rw-r--r--engines/cine/anim.cpp73
-rw-r--r--engines/cine/anim.h2
-rw-r--r--engines/cine/bg_list.cpp12
-rw-r--r--engines/cine/cine.cpp13
-rw-r--r--engines/cine/cine.h2
-rw-r--r--engines/cine/console.cpp2
-rw-r--r--engines/cine/detection_tables.h36
-rw-r--r--engines/cine/gfx.cpp202
-rw-r--r--engines/cine/gfx.h13
-rw-r--r--engines/cine/main_loop.cpp46
-rw-r--r--engines/cine/object.cpp2
-rw-r--r--engines/cine/pal.cpp3
-rw-r--r--engines/cine/part.cpp2
-rw-r--r--engines/cine/saveload.cpp16
-rw-r--r--engines/cine/saveload.h2
-rw-r--r--engines/cine/script.h1
-rw-r--r--engines/cine/script_fw.cpp1657
-rw-r--r--engines/cine/sound.cpp164
-rw-r--r--engines/cine/sound.h36
-rw-r--r--engines/cine/texte.cpp2
-rw-r--r--engines/cine/texte.h2
-rw-r--r--engines/cine/various.cpp235
-rw-r--r--engines/cine/various.h2
-rw-r--r--engines/composer/composer.cpp10
-rw-r--r--engines/composer/resource.cpp2
-rw-r--r--engines/configure.engines52
-rw-r--r--engines/cruise/cruise.cpp3
-rw-r--r--engines/cruise/cruise_main.cpp107
-rw-r--r--engines/cruise/detection.cpp17
-rw-r--r--engines/cruise/menu.cpp9
-rw-r--r--engines/cruise/staticres.cpp4
-rw-r--r--engines/cruise/staticres.h1
-rw-r--r--engines/dialogs.cpp32
-rw-r--r--engines/draci/detection.cpp4
-rw-r--r--engines/drascula/detection.cpp57
-rw-r--r--engines/drascula/interface.cpp4
-rw-r--r--engines/dreamweb/detection.cpp30
-rw-r--r--engines/dreamweb/detection_tables.h95
-rw-r--r--engines/dreamweb/dreamweb.cpp109
-rw-r--r--engines/dreamweb/dreamweb.h50
-rw-r--r--engines/dreamweb/keypad.cpp23
-rw-r--r--engines/dreamweb/module.mk1
-rw-r--r--engines/dreamweb/monitor.cpp22
-rw-r--r--engines/dreamweb/mouse.cpp171
-rw-r--r--engines/dreamweb/newplace.cpp5
-rw-r--r--engines/dreamweb/object.cpp6
-rw-r--r--engines/dreamweb/people.cpp32
-rw-r--r--engines/dreamweb/print.cpp26
-rw-r--r--engines/dreamweb/rain.cpp7
-rw-r--r--engines/dreamweb/saveload.cpp37
-rw-r--r--engines/dreamweb/sound.cpp161
-rw-r--r--engines/dreamweb/sound.h91
-rw-r--r--engines/dreamweb/sprite.cpp40
-rw-r--r--engines/dreamweb/stubs.cpp219
-rw-r--r--engines/dreamweb/talk.cpp32
-rw-r--r--engines/dreamweb/titles.cpp68
-rw-r--r--engines/dreamweb/use.cpp33
-rw-r--r--engines/dreamweb/vgafades.cpp5
-rw-r--r--engines/dreamweb/vgagrafx.cpp76
-rw-r--r--engines/engines.mk15
-rw-r--r--engines/gob/anifile.cpp117
-rw-r--r--engines/gob/anifile.h25
-rw-r--r--engines/gob/aniobject.cpp156
-rw-r--r--engines/gob/aniobject.h36
-rw-r--r--engines/gob/backbuffer.cpp100
-rw-r--r--engines/gob/backbuffer.h59
-rw-r--r--engines/gob/cheater.h6
-rw-r--r--engines/gob/cheater_geisha.cpp11
-rw-r--r--engines/gob/cmpfile.cpp258
-rw-r--r--engines/gob/cmpfile.h100
-rw-r--r--engines/gob/decfile.cpp110
-rw-r--r--engines/gob/decfile.h20
-rw-r--r--engines/gob/detection/detection.cpp220
-rw-r--r--engines/gob/detection/tables.h (renamed from engines/gob/detection.cpp)116
-rw-r--r--engines/gob/detection/tables_adi2.h203
-rw-r--r--engines/gob/detection/tables_adi4.h222
-rw-r--r--engines/gob/detection/tables_adibou.h247
-rw-r--r--engines/gob/detection/tables_ajworld.h45
-rw-r--r--engines/gob/detection/tables_bargon.h135
-rw-r--r--engines/gob/detection/tables_dynasty.h146
-rw-r--r--engines/gob/detection/tables_fallback.h564
-rw-r--r--engines/gob/detection/tables_fascin.h267
-rw-r--r--engines/gob/detection/tables_geisha.h132
-rw-r--r--engines/gob/detection/tables_gob1.h716
-rw-r--r--engines/gob/detection/tables_gob2.h641
-rw-r--r--engines/gob/detection/tables_gob3.h564
-rw-r--r--engines/gob/detection/tables_inca2.h249
-rw-r--r--engines/gob/detection/tables_lit.h484
-rw-r--r--engines/gob/detection/tables_littlered.h265
-rw-r--r--engines/gob/detection/tables_onceupon.h518
-rw-r--r--engines/gob/detection/tables_playtoons.h517
-rw-r--r--engines/gob/detection/tables_urban.h151
-rw-r--r--engines/gob/detection/tables_ween.h349
-rw-r--r--engines/gob/detection/tables_woodruff.h402
-rw-r--r--engines/gob/detection_tables.h5262
-rw-r--r--engines/gob/draw.cpp42
-rw-r--r--engines/gob/draw.h16
-rw-r--r--engines/gob/draw_fascin.cpp8
-rw-r--r--engines/gob/draw_playtoons.cpp4
-rw-r--r--engines/gob/draw_v1.cpp2
-rw-r--r--engines/gob/draw_v2.cpp87
-rw-r--r--engines/gob/game.cpp13
-rw-r--r--engines/gob/game.h4
-rw-r--r--engines/gob/global.cpp1
-rw-r--r--engines/gob/global.h1
-rw-r--r--engines/gob/gob.cpp108
-rw-r--r--engines/gob/gob.h34
-rw-r--r--engines/gob/hotspots.cpp181
-rw-r--r--engines/gob/hotspots.h4
-rw-r--r--engines/gob/init.cpp14
-rw-r--r--engines/gob/init.h1
-rw-r--r--engines/gob/init_fascin.cpp6
-rw-r--r--engines/gob/init_geisha.cpp7
-rw-r--r--engines/gob/init_v1.cpp2
-rw-r--r--engines/gob/init_v2.cpp2
-rw-r--r--engines/gob/inter.cpp15
-rw-r--r--engines/gob/inter.h32
-rw-r--r--engines/gob/inter_bargon.cpp4
-rw-r--r--engines/gob/inter_fascin.cpp3
-rw-r--r--engines/gob/inter_geisha.cpp25
-rw-r--r--engines/gob/inter_littlered.cpp118
-rw-r--r--engines/gob/inter_v1.cpp70
-rw-r--r--engines/gob/inter_v2.cpp10
-rw-r--r--engines/gob/inter_v5.cpp10
-rw-r--r--engines/gob/inter_v7.cpp144
-rw-r--r--engines/gob/minigames/geisha/diving.cpp8
-rw-r--r--engines/gob/minigames/geisha/evilfish.cpp2
-rw-r--r--engines/gob/minigames/geisha/evilfish.h2
-rw-r--r--engines/gob/minigames/geisha/meter.cpp26
-rw-r--r--engines/gob/minigames/geisha/meter.h10
-rw-r--r--engines/gob/minigames/geisha/mouth.cpp169
-rw-r--r--engines/gob/minigames/geisha/mouth.h75
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp1412
-rw-r--r--engines/gob/minigames/geisha/penetration.h197
-rw-r--r--engines/gob/minigames/geisha/submarine.cpp256
-rw-r--r--engines/gob/minigames/geisha/submarine.h107
-rw-r--r--engines/gob/module.mk21
-rw-r--r--engines/gob/mult.cpp3
-rw-r--r--engines/gob/mult_v2.cpp2
-rw-r--r--engines/gob/palanim.cpp93
-rw-r--r--engines/gob/pregob/gctfile.cpp306
-rw-r--r--engines/gob/pregob/gctfile.h149
-rw-r--r--engines/gob/pregob/onceupon/abracadabra.cpp137
-rw-r--r--engines/gob/pregob/onceupon/abracadabra.h61
-rw-r--r--engines/gob/pregob/onceupon/babayaga.cpp137
-rw-r--r--engines/gob/pregob/onceupon/babayaga.h61
-rw-r--r--engines/gob/pregob/onceupon/brokenstrings.h60
-rw-r--r--engines/gob/pregob/onceupon/chargenchild.cpp117
-rw-r--r--engines/gob/pregob/onceupon/chargenchild.h60
-rw-r--r--engines/gob/pregob/onceupon/onceupon.cpp1904
-rw-r--r--engines/gob/pregob/onceupon/onceupon.h344
-rw-r--r--engines/gob/pregob/onceupon/palettes.h411
-rw-r--r--engines/gob/pregob/onceupon/parents.cpp217
-rw-r--r--engines/gob/pregob/onceupon/parents.h94
-rw-r--r--engines/gob/pregob/onceupon/stork.cpp234
-rw-r--r--engines/gob/pregob/onceupon/stork.h103
-rw-r--r--engines/gob/pregob/onceupon/title.cpp117
-rw-r--r--engines/gob/pregob/onceupon/title.h55
-rw-r--r--engines/gob/pregob/pregob.cpp351
-rw-r--r--engines/gob/pregob/pregob.h194
-rw-r--r--engines/gob/pregob/seqfile.cpp384
-rw-r--r--engines/gob/pregob/seqfile.h193
-rw-r--r--engines/gob/pregob/txtfile.cpp232
-rw-r--r--engines/gob/pregob/txtfile.h91
-rw-r--r--engines/gob/resources.cpp12
-rw-r--r--engines/gob/resources.h6
-rw-r--r--engines/gob/rxyfile.cpp39
-rw-r--r--engines/gob/rxyfile.h7
-rw-r--r--engines/gob/save/saveload.h27
-rw-r--r--engines/gob/save/saveload_ajworld.cpp94
-rw-r--r--engines/gob/sound/adlib.cpp1044
-rw-r--r--engines/gob/sound/adlib.h312
-rw-r--r--engines/gob/sound/adlplayer.cpp257
-rw-r--r--engines/gob/sound/adlplayer.h85
-rw-r--r--engines/gob/sound/musplayer.cpp391
-rw-r--r--engines/gob/sound/musplayer.h109
-rw-r--r--engines/gob/sound/sound.cpp107
-rw-r--r--engines/gob/sound/sound.h26
-rw-r--r--engines/gob/sound/soundblaster.cpp29
-rw-r--r--engines/gob/sound/soundblaster.h6
-rw-r--r--engines/gob/surface.cpp46
-rw-r--r--engines/gob/surface.h4
-rw-r--r--engines/gob/util.cpp155
-rw-r--r--engines/gob/util.h16
-rw-r--r--engines/gob/video.cpp31
-rw-r--r--engines/gob/video.h5
-rw-r--r--engines/gob/videoplayer.cpp50
-rw-r--r--engines/gob/videoplayer.h7
-rw-r--r--engines/groovie/cursor.cpp2
-rw-r--r--engines/groovie/detection.cpp2
-rw-r--r--engines/groovie/graphics.cpp2
-rw-r--r--engines/groovie/groovie.cpp32
-rw-r--r--engines/groovie/resource.cpp1
-rw-r--r--engines/groovie/roq.cpp41
-rw-r--r--engines/groovie/saveload.cpp2
-rw-r--r--engines/groovie/script.cpp4
-rw-r--r--engines/hugo/console.cpp10
-rw-r--r--engines/hugo/detection.cpp3
-rw-r--r--engines/hugo/dialogs.cpp95
-rw-r--r--engines/hugo/dialogs.h4
-rw-r--r--engines/hugo/display.cpp154
-rw-r--r--engines/hugo/display.h60
-rw-r--r--engines/hugo/file.cpp343
-rw-r--r--engines/hugo/file.h74
-rw-r--r--engines/hugo/file_v1d.cpp10
-rw-r--r--engines/hugo/file_v1w.cpp36
-rw-r--r--engines/hugo/file_v2d.cpp60
-rw-r--r--engines/hugo/file_v3d.cpp78
-rw-r--r--engines/hugo/game.h126
-rw-r--r--engines/hugo/hugo.cpp103
-rw-r--r--engines/hugo/hugo.h100
-rw-r--r--engines/hugo/intro.cpp142
-rw-r--r--engines/hugo/intro.h6
-rw-r--r--engines/hugo/inventory.cpp12
-rw-r--r--engines/hugo/inventory.h10
-rw-r--r--engines/hugo/mouse.cpp100
-rw-r--r--engines/hugo/mouse.h6
-rw-r--r--engines/hugo/object.cpp436
-rw-r--r--engines/hugo/object.h46
-rw-r--r--engines/hugo/object_v1d.cpp284
-rw-r--r--engines/hugo/object_v1w.cpp270
-rw-r--r--engines/hugo/object_v2d.cpp274
-rw-r--r--engines/hugo/object_v3d.cpp174
-rw-r--r--engines/hugo/parser.cpp101
-rw-r--r--engines/hugo/parser.h70
-rw-r--r--engines/hugo/parser_v1d.cpp164
-rw-r--r--engines/hugo/parser_v1w.cpp46
-rw-r--r--engines/hugo/parser_v2d.cpp28
-rw-r--r--engines/hugo/parser_v3d.cpp200
-rw-r--r--engines/hugo/route.cpp150
-rw-r--r--engines/hugo/route.h29
-rw-r--r--engines/hugo/schedule.cpp1252
-rw-r--r--engines/hugo/schedule.h583
-rw-r--r--engines/hugo/sound.cpp32
-rw-r--r--engines/hugo/sound.h2
-rw-r--r--engines/kyra/animator_hof.cpp2
-rw-r--r--engines/kyra/animator_mr.cpp4
-rw-r--r--engines/kyra/detection.cpp87
-rw-r--r--engines/kyra/detection_tables.h130
-rw-r--r--engines/kyra/eobcommon.cpp8
-rw-r--r--engines/kyra/eobcommon.h6
-rw-r--r--engines/kyra/gui_eob.cpp16
-rw-r--r--engines/kyra/gui_hof.cpp35
-rw-r--r--engines/kyra/gui_lok.cpp12
-rw-r--r--engines/kyra/gui_lol.cpp2
-rw-r--r--engines/kyra/gui_mr.cpp25
-rw-r--r--engines/kyra/gui_v1.cpp9
-rw-r--r--engines/kyra/gui_v2.cpp12
-rw-r--r--engines/kyra/items_hof.cpp5
-rw-r--r--engines/kyra/items_lok.cpp16
-rw-r--r--engines/kyra/items_lol.cpp53
-rw-r--r--engines/kyra/items_mr.cpp10
-rw-r--r--engines/kyra/items_v2.cpp7
-rw-r--r--engines/kyra/kyra_hof.cpp10
-rw-r--r--engines/kyra/kyra_lok.cpp8
-rw-r--r--engines/kyra/kyra_mr.cpp2
-rw-r--r--engines/kyra/kyra_v2.cpp3
-rw-r--r--engines/kyra/lol.cpp12
-rw-r--r--engines/kyra/lol.h10
-rw-r--r--engines/kyra/screen.cpp29
-rw-r--r--engines/kyra/screen.h3
-rw-r--r--engines/kyra/screen_eob.cpp2
-rw-r--r--engines/kyra/screen_lok.cpp2
-rw-r--r--engines/kyra/screen_lol.cpp2
-rw-r--r--engines/kyra/screen_lol.h2
-rw-r--r--engines/kyra/screen_v2.cpp2
-rw-r--r--engines/kyra/script_hof.cpp4
-rw-r--r--engines/kyra/script_lok.cpp4
-rw-r--r--engines/kyra/script_lol.cpp5
-rw-r--r--engines/kyra/script_mr.cpp4
-rw-r--r--engines/kyra/sequences_hof.cpp4
-rw-r--r--engines/kyra/sequences_lok.cpp6
-rw-r--r--engines/kyra/sound_intern.h1
-rw-r--r--engines/kyra/sound_midi.cpp4
-rw-r--r--engines/kyra/sound_towns.cpp2
-rw-r--r--engines/kyra/sprites_lol.cpp72
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/kyra/text_hof.cpp9
-rw-r--r--engines/kyra/text_lok.cpp6
-rw-r--r--engines/kyra/text_mr.cpp6
-rw-r--r--engines/kyra/timer_eob.cpp2
-rw-r--r--engines/kyra/vqa.cpp2
-rw-r--r--engines/lastexpress/data/animation.cpp8
-rw-r--r--engines/lastexpress/data/background.cpp1
-rw-r--r--engines/lastexpress/data/cursor.cpp6
-rw-r--r--engines/lastexpress/data/font.cpp6
-rw-r--r--engines/lastexpress/data/scene.cpp13
-rw-r--r--engines/lastexpress/data/sequence.cpp3
-rw-r--r--engines/lastexpress/data/sequence.h6
-rw-r--r--engines/lastexpress/data/snd.cpp14
-rw-r--r--engines/lastexpress/data/subtitle.cpp9
-rw-r--r--engines/lastexpress/debug.cpp100
-rw-r--r--engines/lastexpress/debug.h3
-rw-r--r--engines/lastexpress/detection.cpp3
-rw-r--r--engines/lastexpress/entities/abbot.cpp72
-rw-r--r--engines/lastexpress/entities/abbot.h9
-rw-r--r--engines/lastexpress/entities/alexei.cpp48
-rw-r--r--engines/lastexpress/entities/alexei.h1
-rw-r--r--engines/lastexpress/entities/alouan.cpp50
-rw-r--r--engines/lastexpress/entities/alouan.h1
-rw-r--r--engines/lastexpress/entities/anna.cpp119
-rw-r--r--engines/lastexpress/entities/anna.h1
-rw-r--r--engines/lastexpress/entities/august.cpp115
-rw-r--r--engines/lastexpress/entities/august.h1
-rw-r--r--engines/lastexpress/entities/boutarel.cpp55
-rw-r--r--engines/lastexpress/entities/boutarel.h1
-rw-r--r--engines/lastexpress/entities/chapters.cpp199
-rw-r--r--engines/lastexpress/entities/chapters.h4
-rw-r--r--engines/lastexpress/entities/cooks.cpp29
-rw-r--r--engines/lastexpress/entities/cooks.h1
-rw-r--r--engines/lastexpress/entities/coudert.cpp227
-rw-r--r--engines/lastexpress/entities/coudert.h2
-rw-r--r--engines/lastexpress/entities/entity.cpp557
-rw-r--r--engines/lastexpress/entities/entity.h344
-rw-r--r--engines/lastexpress/entities/entity39.cpp1
-rw-r--r--engines/lastexpress/entities/entity39.h3
-rw-r--r--engines/lastexpress/entities/entity_intern.h496
-rw-r--r--engines/lastexpress/entities/francois.cpp120
-rw-r--r--engines/lastexpress/entities/francois.h5
-rw-r--r--engines/lastexpress/entities/gendarmes.cpp25
-rw-r--r--engines/lastexpress/entities/gendarmes.h1
-rw-r--r--engines/lastexpress/entities/hadija.cpp68
-rw-r--r--engines/lastexpress/entities/hadija.h1
-rw-r--r--engines/lastexpress/entities/ivo.cpp15
-rw-r--r--engines/lastexpress/entities/ivo.h1
-rw-r--r--engines/lastexpress/entities/kahina.cpp77
-rw-r--r--engines/lastexpress/entities/kahina.h1
-rw-r--r--engines/lastexpress/entities/kronos.cpp19
-rw-r--r--engines/lastexpress/entities/kronos.h1
-rw-r--r--engines/lastexpress/entities/mahmud.cpp26
-rw-r--r--engines/lastexpress/entities/mahmud.h1
-rw-r--r--engines/lastexpress/entities/max.cpp23
-rw-r--r--engines/lastexpress/entities/max.h1
-rw-r--r--engines/lastexpress/entities/mertens.cpp282
-rw-r--r--engines/lastexpress/entities/mertens.h4
-rw-r--r--engines/lastexpress/entities/milos.cpp70
-rw-r--r--engines/lastexpress/entities/milos.h1
-rw-r--r--engines/lastexpress/entities/mmeboutarel.cpp41
-rw-r--r--engines/lastexpress/entities/mmeboutarel.h1
-rw-r--r--engines/lastexpress/entities/pascale.cpp51
-rw-r--r--engines/lastexpress/entities/pascale.h1
-rw-r--r--engines/lastexpress/entities/rebecca.cpp63
-rw-r--r--engines/lastexpress/entities/rebecca.h1
-rw-r--r--engines/lastexpress/entities/salko.cpp14
-rw-r--r--engines/lastexpress/entities/salko.h1
-rw-r--r--engines/lastexpress/entities/servers0.cpp37
-rw-r--r--engines/lastexpress/entities/servers0.h1
-rw-r--r--engines/lastexpress/entities/servers1.cpp19
-rw-r--r--engines/lastexpress/entities/servers1.h1
-rw-r--r--engines/lastexpress/entities/sophie.cpp75
-rw-r--r--engines/lastexpress/entities/sophie.h5
-rw-r--r--engines/lastexpress/entities/tables.cpp2
-rw-r--r--engines/lastexpress/entities/tables.h1
-rw-r--r--engines/lastexpress/entities/tatiana.cpp65
-rw-r--r--engines/lastexpress/entities/tatiana.h1
-rw-r--r--engines/lastexpress/entities/train.cpp20
-rw-r--r--engines/lastexpress/entities/train.h1
-rw-r--r--engines/lastexpress/entities/vassili.cpp16
-rw-r--r--engines/lastexpress/entities/vassili.h1
-rw-r--r--engines/lastexpress/entities/verges.cpp240
-rw-r--r--engines/lastexpress/entities/verges.h27
-rw-r--r--engines/lastexpress/entities/vesna.cpp26
-rw-r--r--engines/lastexpress/entities/vesna.h1
-rw-r--r--engines/lastexpress/entities/yasmin.cpp76
-rw-r--r--engines/lastexpress/entities/yasmin.h1
-rw-r--r--engines/lastexpress/fight/fight.cpp7
-rw-r--r--engines/lastexpress/fight/fighter.cpp27
-rw-r--r--engines/lastexpress/fight/fighter.h3
-rw-r--r--engines/lastexpress/game/action.cpp35
-rw-r--r--engines/lastexpress/game/beetle.cpp38
-rw-r--r--engines/lastexpress/game/beetle.h1
-rw-r--r--engines/lastexpress/game/entities.cpp79
-rw-r--r--engines/lastexpress/game/entities.h1
-rw-r--r--engines/lastexpress/game/inventory.cpp92
-rw-r--r--engines/lastexpress/game/inventory.h24
-rw-r--r--engines/lastexpress/game/logic.cpp40
-rw-r--r--engines/lastexpress/game/logic.h3
-rw-r--r--engines/lastexpress/game/object.cpp2
-rw-r--r--engines/lastexpress/game/savegame.cpp454
-rw-r--r--engines/lastexpress/game/savegame.h96
-rw-r--r--engines/lastexpress/game/savepoint.cpp27
-rw-r--r--engines/lastexpress/game/savepoint.h10
-rw-r--r--engines/lastexpress/game/scenes.cpp37
-rw-r--r--engines/lastexpress/game/scenes.h1
-rw-r--r--engines/lastexpress/game/state.cpp12
-rw-r--r--engines/lastexpress/game/state.h2
-rw-r--r--engines/lastexpress/graphics.cpp2
-rw-r--r--engines/lastexpress/helpers.h2
-rw-r--r--engines/lastexpress/lastexpress.cpp13
-rw-r--r--engines/lastexpress/menu/menu.cpp11
-rw-r--r--engines/lastexpress/resource.cpp6
-rw-r--r--engines/lastexpress/resource.h2
-rw-r--r--engines/lastexpress/shared.h59
-rw-r--r--engines/lastexpress/sound/entry.cpp27
-rw-r--r--engines/lastexpress/sound/queue.cpp30
-rw-r--r--engines/lastexpress/sound/queue.h2
-rw-r--r--engines/lastexpress/sound/sound.cpp25
-rw-r--r--engines/lure/debugger.cpp42
-rw-r--r--engines/lure/decode.cpp4
-rw-r--r--engines/lure/game.cpp8
-rw-r--r--engines/lure/hotspots.cpp72
-rw-r--r--engines/lure/hotspots.h108
-rw-r--r--engines/lure/menu.cpp46
-rw-r--r--engines/lure/res.cpp20
-rw-r--r--engines/lure/res_struct.cpp202
-rw-r--r--engines/lure/res_struct.h38
-rw-r--r--engines/lure/room.cpp40
-rw-r--r--engines/lure/sound.cpp55
-rw-r--r--engines/lure/surface.cpp36
-rw-r--r--engines/made/pmvplayer.cpp2
-rw-r--r--engines/made/screen.cpp6
-rw-r--r--engines/made/screen.h2
-rw-r--r--engines/made/screenfx.cpp36
-rw-r--r--engines/made/scriptfuncs.cpp2
-rw-r--r--engines/metaengine.h31
-rw-r--r--engines/mohawk/bitmap.cpp103
-rw-r--r--engines/mohawk/bitmap.h24
-rw-r--r--engines/mohawk/cursors.cpp8
-rw-r--r--engines/mohawk/detection.cpp2
-rw-r--r--engines/mohawk/detection_tables.h20
-rw-r--r--engines/mohawk/graphics.cpp17
-rw-r--r--engines/mohawk/livingbooks.cpp15
-rw-r--r--engines/mohawk/livingbooks.h3
-rw-r--r--engines/mohawk/myst.cpp47
-rw-r--r--engines/mohawk/myst_areas.cpp2
-rw-r--r--engines/mohawk/myst_graphics.cpp143
-rw-r--r--engines/mohawk/myst_graphics.h22
-rw-r--r--engines/mohawk/myst_scripts.cpp4
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp4
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp33
-rw-r--r--engines/mohawk/riven.cpp22
-rw-r--r--engines/mohawk/riven.h4
-rw-r--r--engines/mohawk/riven_external.cpp4
-rw-r--r--engines/mohawk/riven_graphics.cpp8
-rw-r--r--engines/mohawk/riven_saveload.cpp18
-rw-r--r--engines/mohawk/riven_saveload.h4
-rw-r--r--engines/mohawk/riven_vars.cpp1
-rw-r--r--engines/mohawk/video.cpp74
-rw-r--r--engines/mohawk/video.h14
-rw-r--r--engines/neverhood/smackerplayer.cpp6
-rw-r--r--engines/parallaction/adlib.cpp808
-rw-r--r--engines/parallaction/callables_ns.cpp12
-rw-r--r--engines/parallaction/debug.cpp8
-rw-r--r--engines/parallaction/dialogue.cpp8
-rw-r--r--engines/parallaction/disk_br.cpp6
-rw-r--r--engines/parallaction/disk_ns.cpp21
-rw-r--r--engines/parallaction/exec.cpp6
-rw-r--r--engines/parallaction/exec_br.cpp8
-rw-r--r--engines/parallaction/exec_ns.cpp8
-rw-r--r--engines/parallaction/font.cpp4
-rw-r--r--engines/parallaction/gfxbase.cpp13
-rw-r--r--engines/parallaction/graphics.cpp6
-rw-r--r--engines/parallaction/graphics.h6
-rw-r--r--engines/parallaction/gui_ns.cpp2
-rw-r--r--engines/parallaction/input.cpp22
-rw-r--r--engines/parallaction/module.mk1
-rw-r--r--engines/parallaction/objects.cpp4
-rw-r--r--engines/parallaction/objects.h4
-rw-r--r--engines/parallaction/parallaction.cpp32
-rw-r--r--engines/parallaction/parallaction.h24
-rw-r--r--engines/parallaction/parallaction_br.cpp14
-rw-r--r--engines/parallaction/parallaction_ns.cpp20
-rw-r--r--engines/parallaction/parser_br.cpp4
-rw-r--r--engines/parallaction/parser_ns.cpp2
-rw-r--r--engines/parallaction/saveload.cpp17
-rw-r--r--engines/parallaction/sound.h2
-rw-r--r--engines/parallaction/sound_br.cpp34
-rw-r--r--engines/parallaction/sound_ns.cpp8
-rw-r--r--engines/parallaction/staticres.cpp28
-rw-r--r--engines/parallaction/walk.cpp28
-rw-r--r--engines/parallaction/walk.h8
-rw-r--r--engines/pegasus/ai/ai_action.cpp78
-rw-r--r--engines/pegasus/ai/ai_action.h136
-rw-r--r--engines/pegasus/ai/ai_area.cpp613
-rw-r--r--engines/pegasus/ai/ai_area.h172
-rw-r--r--engines/pegasus/ai/ai_condition.cpp290
-rw-r--r--engines/pegasus/ai/ai_condition.h287
-rw-r--r--engines/pegasus/ai/ai_rule.cpp78
-rw-r--r--engines/pegasus/ai/ai_rule.h86
-rw-r--r--engines/pegasus/compass.cpp82
-rw-r--r--engines/pegasus/compass.h58
-rw-r--r--engines/pegasus/console.cpp102
-rw-r--r--engines/pegasus/console.h46
-rw-r--r--engines/pegasus/constants.h729
-rw-r--r--engines/pegasus/cursor.cpp213
-rw-r--r--engines/pegasus/cursor.h84
-rw-r--r--engines/pegasus/detection.cpp157
-rw-r--r--engines/pegasus/elements.cpp568
-rw-r--r--engines/pegasus/elements.h254
-rw-r--r--engines/pegasus/energymonitor.cpp296
-rw-r--r--engines/pegasus/energymonitor.h111
-rw-r--r--engines/pegasus/fader.cpp218
-rw-r--r--engines/pegasus/fader.h130
-rw-r--r--engines/pegasus/gamestate.cpp2359
-rw-r--r--engines/pegasus/gamestate.h886
-rw-r--r--engines/pegasus/graphics.cpp346
-rw-r--r--engines/pegasus/graphics.h95
-rw-r--r--engines/pegasus/hotspot.cpp325
-rw-r--r--engines/pegasus/hotspot.h152
-rw-r--r--engines/pegasus/input.cpp373
-rw-r--r--engines/pegasus/input.h500
-rw-r--r--engines/pegasus/interaction.h110
-rw-r--r--engines/pegasus/interface.cpp667
-rw-r--r--engines/pegasus/interface.h148
-rw-r--r--engines/pegasus/items/autodragger.cpp91
-rw-r--r--engines/pegasus/items/autodragger.h57
-rw-r--r--engines/pegasus/items/biochips/aichip.cpp279
-rw-r--r--engines/pegasus/items/biochips/aichip.h69
-rw-r--r--engines/pegasus/items/biochips/biochipitem.cpp95
-rw-r--r--engines/pegasus/items/biochips/biochipitem.h54
-rw-r--r--engines/pegasus/items/biochips/mapchip.cpp106
-rw-r--r--engines/pegasus/items/biochips/mapchip.h64
-rw-r--r--engines/pegasus/items/biochips/mapimage.cpp443
-rw-r--r--engines/pegasus/items/biochips/mapimage.h84
-rw-r--r--engines/pegasus/items/biochips/opticalchip.cpp190
-rw-r--r--engines/pegasus/items/biochips/opticalchip.h71
-rw-r--r--engines/pegasus/items/biochips/pegasuschip.cpp198
-rw-r--r--engines/pegasus/items/biochips/pegasuschip.h55
-rw-r--r--engines/pegasus/items/biochips/retscanchip.cpp49
-rw-r--r--engines/pegasus/items/biochips/retscanchip.h43
-rw-r--r--engines/pegasus/items/biochips/shieldchip.cpp53
-rw-r--r--engines/pegasus/items/biochips/shieldchip.h46
-rw-r--r--engines/pegasus/items/inventory.cpp175
-rw-r--r--engines/pegasus/items/inventory.h80
-rw-r--r--engines/pegasus/items/inventory/airmask.cpp249
-rw-r--r--engines/pegasus/items/inventory/airmask.h76
-rw-r--r--engines/pegasus/items/inventory/gascanister.cpp46
-rw-r--r--engines/pegasus/items/inventory/gascanister.h44
-rw-r--r--engines/pegasus/items/inventory/inventoryitem.cpp110
-rw-r--r--engines/pegasus/items/inventory/inventoryitem.h67
-rw-r--r--engines/pegasus/items/inventory/keycard.cpp59
-rw-r--r--engines/pegasus/items/inventory/keycard.h48
-rw-r--r--engines/pegasus/items/inventorypicture.cpp370
-rw-r--r--engines/pegasus/items/inventorypicture.h125
-rw-r--r--engines/pegasus/items/item.cpp314
-rw-r--r--engines/pegasus/items/item.h363
-rw-r--r--engines/pegasus/items/itemdragger.cpp193
-rw-r--r--engines/pegasus/items/itemdragger.h96
-rw-r--r--engines/pegasus/items/itemlist.cpp67
-rw-r--r--engines/pegasus/items/itemlist.h59
-rw-r--r--engines/pegasus/menu.cpp1219
-rw-r--r--engines/pegasus/menu.h171
-rw-r--r--engines/pegasus/module.mk100
-rw-r--r--engines/pegasus/movie.cpp280
-rw-r--r--engines/pegasus/movie.h105
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoria.cpp1962
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoria.h523
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp370
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoria4dsystem.h78
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp1442
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriabomb.h156
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp115
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriamessages.h60
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriamirror.cpp135
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriamirror.h54
-rw-r--r--engines/pegasus/neighborhood/door.cpp64
-rw-r--r--engines/pegasus/neighborhood/door.h90
-rw-r--r--engines/pegasus/neighborhood/exit.cpp70
-rw-r--r--engines/pegasus/neighborhood/exit.h93
-rw-r--r--engines/pegasus/neighborhood/extra.cpp58
-rw-r--r--engines/pegasus/neighborhood/extra.h67
-rw-r--r--engines/pegasus/neighborhood/hotspotinfo.cpp65
-rw-r--r--engines/pegasus/neighborhood/hotspotinfo.h77
-rw-r--r--engines/pegasus/neighborhood/mars/constants.h941
-rw-r--r--engines/pegasus/neighborhood/mars/energybeam.cpp70
-rw-r--r--engines/pegasus/neighborhood/mars/energybeam.h43
-rw-r--r--engines/pegasus/neighborhood/mars/gravitoncannon.cpp134
-rw-r--r--engines/pegasus/neighborhood/mars/gravitoncannon.h57
-rw-r--r--engines/pegasus/neighborhood/mars/hermite.cpp76
-rw-r--r--engines/pegasus/neighborhood/mars/hermite.h41
-rw-r--r--engines/pegasus/neighborhood/mars/mars.cpp3735
-rw-r--r--engines/pegasus/neighborhood/mars/mars.h238
-rw-r--r--engines/pegasus/neighborhood/mars/planetmover.cpp104
-rw-r--r--engines/pegasus/neighborhood/mars/planetmover.h57
-rw-r--r--engines/pegasus/neighborhood/mars/reactor.cpp297
-rw-r--r--engines/pegasus/neighborhood/mars/reactor.h108
-rw-r--r--engines/pegasus/neighborhood/mars/robotship.cpp267
-rw-r--r--engines/pegasus/neighborhood/mars/robotship.h84
-rw-r--r--engines/pegasus/neighborhood/mars/shuttleenergymeter.cpp116
-rw-r--r--engines/pegasus/neighborhood/mars/shuttleenergymeter.h73
-rw-r--r--engines/pegasus/neighborhood/mars/shuttlehud.cpp246
-rw-r--r--engines/pegasus/neighborhood/mars/shuttlehud.h60
-rw-r--r--engines/pegasus/neighborhood/mars/shuttleweapon.cpp129
-rw-r--r--engines/pegasus/neighborhood/mars/shuttleweapon.h68
-rw-r--r--engines/pegasus/neighborhood/mars/spacechase3d.cpp106
-rw-r--r--engines/pegasus/neighborhood/mars/spacechase3d.h91
-rw-r--r--engines/pegasus/neighborhood/mars/spacejunk.cpp212
-rw-r--r--engines/pegasus/neighborhood/mars/spacejunk.h78
-rw-r--r--engines/pegasus/neighborhood/mars/tractorbeam.cpp139
-rw-r--r--engines/pegasus/neighborhood/mars/tractorbeam.h43
-rw-r--r--engines/pegasus/neighborhood/neighborhood.cpp1774
-rw-r--r--engines/pegasus/neighborhood/neighborhood.h408
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp219
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h65
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp445
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/fillingstation.h91
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp763
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/noradalpha.h115
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panorama.cpp239
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panorama.h98
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp91
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panoramascroll.h60
-rw-r--r--engines/pegasus/neighborhood/norad/constants.h755
-rw-r--r--engines/pegasus/neighborhood/norad/delta/globegame.cpp1062
-rw-r--r--engines/pegasus/neighborhood/norad/delta/globegame.h169
-rw-r--r--engines/pegasus/neighborhood/norad/delta/noraddelta.cpp869
-rw-r--r--engines/pegasus/neighborhood/norad/delta/noraddelta.h117
-rw-r--r--engines/pegasus/neighborhood/norad/norad.cpp285
-rw-r--r--engines/pegasus/neighborhood/norad/norad.h121
-rw-r--r--engines/pegasus/neighborhood/norad/noradelevator.cpp130
-rw-r--r--engines/pegasus/neighborhood/norad/noradelevator.h67
-rw-r--r--engines/pegasus/neighborhood/norad/pressuredoor.cpp554
-rw-r--r--engines/pegasus/neighborhood/norad/pressuredoor.h93
-rw-r--r--engines/pegasus/neighborhood/norad/pressuretracker.cpp87
-rw-r--r--engines/pegasus/neighborhood/norad/pressuretracker.h69
-rw-r--r--engines/pegasus/neighborhood/norad/subcontrolroom.cpp1178
-rw-r--r--engines/pegasus/neighborhood/norad/subcontrolroom.h133
-rw-r--r--engines/pegasus/neighborhood/norad/subplatform.cpp205
-rw-r--r--engines/pegasus/neighborhood/norad/subplatform.h63
-rw-r--r--engines/pegasus/neighborhood/prehistoric/prehistoric.cpp689
-rw-r--r--engines/pegasus/neighborhood/prehistoric/prehistoric.h158
-rw-r--r--engines/pegasus/neighborhood/spot.cpp70
-rw-r--r--engines/pegasus/neighborhood/spot.h97
-rw-r--r--engines/pegasus/neighborhood/tsa/fulltsa.cpp3023
-rw-r--r--engines/pegasus/neighborhood/tsa/fulltsa.h159
-rw-r--r--engines/pegasus/neighborhood/tsa/tinytsa.cpp453
-rw-r--r--engines/pegasus/neighborhood/tsa/tinytsa.h71
-rw-r--r--engines/pegasus/neighborhood/turn.cpp63
-rw-r--r--engines/pegasus/neighborhood/turn.h69
-rw-r--r--engines/pegasus/neighborhood/view.cpp60
-rw-r--r--engines/pegasus/neighborhood/view.h68
-rw-r--r--engines/pegasus/neighborhood/wsc/moleculebin.cpp127
-rw-r--r--engines/pegasus/neighborhood/wsc/moleculebin.h72
-rw-r--r--engines/pegasus/neighborhood/wsc/wsc.cpp2542
-rw-r--r--engines/pegasus/neighborhood/wsc/wsc.h166
-rw-r--r--engines/pegasus/neighborhood/zoom.cpp74
-rw-r--r--engines/pegasus/neighborhood/zoom.h70
-rw-r--r--engines/pegasus/notification.cpp149
-rw-r--r--engines/pegasus/notification.h123
-rw-r--r--engines/pegasus/pegasus.cpp2346
-rw-r--r--engines/pegasus/pegasus.h327
-rw-r--r--engines/pegasus/scoring.h281
-rw-r--r--engines/pegasus/sound.cpp181
-rw-r--r--engines/pegasus/sound.h108
-rw-r--r--engines/pegasus/surface.cpp392
-rw-r--r--engines/pegasus/surface.h140
-rw-r--r--engines/pegasus/timers.cpp429
-rw-r--r--engines/pegasus/timers.h260
-rw-r--r--engines/pegasus/transition.cpp200
-rw-r--r--engines/pegasus/transition.h108
-rw-r--r--engines/pegasus/types.h161
-rw-r--r--engines/pegasus/util.cpp77
-rw-r--r--engines/pegasus/util.h117
-rw-r--r--engines/plugins_table.h115
-rw-r--r--engines/queen/display.cpp38
-rw-r--r--engines/queen/queen.cpp41
-rw-r--r--engines/queen/queen.h2
-rw-r--r--engines/saga/actor_path.cpp54
-rw-r--r--engines/saga/detection.cpp3
-rw-r--r--engines/saga/introproc_ihnm.cpp6
-rw-r--r--engines/saga/introproc_ite.cpp32
-rw-r--r--engines/saga/introproc_saga2.cpp9
-rw-r--r--engines/saga/script.cpp2
-rw-r--r--engines/saga/shorten.cpp3
-rw-r--r--engines/saga/sndres.cpp3
-rw-r--r--engines/saga/sndres.h1
-rw-r--r--engines/savestate.h2
-rw-r--r--engines/sci/console.cpp223
-rw-r--r--engines/sci/console.h4
-rw-r--r--engines/sci/detection.cpp89
-rw-r--r--engines/sci/detection_tables.h880
-rw-r--r--engines/sci/engine/features.cpp42
-rw-r--r--engines/sci/engine/features.h7
-rw-r--r--engines/sci/engine/file.cpp464
-rw-r--r--engines/sci/engine/file.h140
-rw-r--r--engines/sci/engine/gc.cpp10
-rw-r--r--engines/sci/engine/gc.h2
-rw-r--r--engines/sci/engine/kernel.cpp153
-rw-r--r--engines/sci/engine/kernel.h35
-rw-r--r--engines/sci/engine/kernel_tables.h152
-rw-r--r--engines/sci/engine/kevent.cpp6
-rw-r--r--engines/sci/engine/kfile.cpp1245
-rw-r--r--engines/sci/engine/kgraphics.cpp723
-rw-r--r--engines/sci/engine/kgraphics32.cpp812
-rw-r--r--engines/sci/engine/klists.cpp42
-rw-r--r--engines/sci/engine/kmath.cpp11
-rw-r--r--engines/sci/engine/kmenu.cpp2
-rw-r--r--engines/sci/engine/kmisc.cpp85
-rw-r--r--engines/sci/engine/kparse.cpp2
-rw-r--r--engines/sci/engine/kpathing.cpp644
-rw-r--r--engines/sci/engine/kscripts.cpp21
-rw-r--r--engines/sci/engine/ksound.cpp15
-rw-r--r--engines/sci/engine/kstring.cpp47
-rw-r--r--engines/sci/engine/kvideo.cpp61
-rw-r--r--engines/sci/engine/message.cpp20
-rw-r--r--engines/sci/engine/object.cpp31
-rw-r--r--engines/sci/engine/object.h8
-rw-r--r--engines/sci/engine/savegame.cpp24
-rw-r--r--engines/sci/engine/script.cpp142
-rw-r--r--engines/sci/engine/script.h12
-rw-r--r--engines/sci/engine/script_patches.cpp69
-rw-r--r--engines/sci/engine/scriptdebug.cpp125
-rw-r--r--engines/sci/engine/seg_manager.cpp172
-rw-r--r--engines/sci/engine/seg_manager.h10
-rw-r--r--engines/sci/engine/segment.cpp50
-rw-r--r--engines/sci/engine/segment.h14
-rw-r--r--engines/sci/engine/selector.cpp1
-rw-r--r--engines/sci/engine/selector.h3
-rw-r--r--engines/sci/engine/state.cpp17
-rw-r--r--engines/sci/engine/state.h51
-rw-r--r--engines/sci/engine/vm.cpp118
-rw-r--r--engines/sci/engine/vm.h14
-rw-r--r--engines/sci/engine/vm_types.cpp14
-rw-r--r--engines/sci/engine/vm_types.h90
-rw-r--r--engines/sci/engine/workarounds.cpp18
-rw-r--r--engines/sci/event.cpp4
-rw-r--r--engines/sci/graphics/animate.cpp2
-rw-r--r--engines/sci/graphics/controls16.cpp2
-rw-r--r--engines/sci/graphics/controls32.cpp6
-rw-r--r--engines/sci/graphics/cursor.cpp12
-rw-r--r--engines/sci/graphics/font.cpp2
-rw-r--r--engines/sci/graphics/frameout.cpp364
-rw-r--r--engines/sci/graphics/frameout.h53
-rw-r--r--engines/sci/graphics/maciconbar.cpp22
-rw-r--r--engines/sci/graphics/maciconbar.h2
-rw-r--r--engines/sci/graphics/menu.cpp12
-rw-r--r--engines/sci/graphics/paint16.cpp16
-rw-r--r--engines/sci/graphics/palette.cpp94
-rw-r--r--engines/sci/graphics/palette.h21
-rw-r--r--engines/sci/graphics/ports.cpp41
-rw-r--r--engines/sci/graphics/screen.cpp48
-rw-r--r--engines/sci/graphics/screen.h1
-rw-r--r--engines/sci/graphics/text32.cpp74
-rw-r--r--engines/sci/graphics/text32.h6
-rw-r--r--engines/sci/graphics/view.cpp30
-rw-r--r--engines/sci/module.mk2
-rw-r--r--engines/sci/resource.cpp17
-rw-r--r--engines/sci/resource.h18
-rw-r--r--engines/sci/sci.cpp19
-rw-r--r--engines/sci/sci.h20
-rw-r--r--engines/sci/sound/audio.cpp3
-rw-r--r--engines/sci/sound/drivers/adlib.cpp3
-rw-r--r--engines/sci/sound/drivers/fmtowns.cpp12
-rw-r--r--engines/sci/sound/drivers/midi.cpp2
-rw-r--r--engines/sci/sound/midiparser_sci.cpp80
-rw-r--r--engines/sci/sound/midiparser_sci.h2
-rw-r--r--engines/sci/sound/music.cpp14
-rw-r--r--engines/sci/sound/soundcmd.cpp59
-rw-r--r--engines/sci/video/robot_decoder.cpp360
-rw-r--r--engines/sci/video/robot_decoder.h120
-rw-r--r--engines/sci/video/seq_decoder.cpp61
-rw-r--r--engines/sci/video/seq_decoder.h67
-rw-r--r--engines/scumm/actor.cpp30
-rw-r--r--engines/scumm/actor.h2
-rw-r--r--engines/scumm/charset.cpp8
-rw-r--r--engines/scumm/charset.h4
-rw-r--r--engines/scumm/costume.cpp6
-rw-r--r--engines/scumm/cursor.cpp6
-rw-r--r--engines/scumm/debugger.cpp2
-rw-r--r--engines/scumm/detection.cpp56
-rw-r--r--engines/scumm/detection.h1
-rw-r--r--engines/scumm/detection_tables.h40
-rw-r--r--engines/scumm/dialogs.cpp2
-rw-r--r--engines/scumm/gfx.cpp4
-rw-r--r--engines/scumm/gfx_towns.cpp4
-rw-r--r--engines/scumm/he/animation_he.cpp7
-rw-r--r--engines/scumm/he/intern_he.h8
-rw-r--r--engines/scumm/he/logic/football.cpp174
-rw-r--r--engines/scumm/he/logic/soccer.cpp4
-rw-r--r--engines/scumm/he/logic_he.cpp3
-rw-r--r--engines/scumm/he/logic_he.h1
-rw-r--r--engines/scumm/he/resource_he.cpp2
-rw-r--r--engines/scumm/he/script_v100he.cpp13
-rw-r--r--engines/scumm/he/script_v60he.cpp2
-rw-r--r--engines/scumm/he/script_v90he.cpp14
-rw-r--r--engines/scumm/he/sound_he.cpp2
-rw-r--r--engines/scumm/he/wiz_he.cpp3
-rw-r--r--engines/scumm/imuse/imuse.cpp41
-rw-r--r--engines/scumm/imuse/imuse_internal.h2
-rw-r--r--engines/scumm/imuse/imuse_part.cpp13
-rw-r--r--engines/scumm/imuse/imuse_player.cpp5
-rw-r--r--engines/scumm/imuse/instrument.cpp60
-rw-r--r--engines/scumm/imuse/instrument.h4
-rw-r--r--engines/scumm/imuse/mac_m68k.cpp514
-rw-r--r--engines/scumm/imuse/mac_m68k.h177
-rw-r--r--engines/scumm/imuse/sysex_scumm.cpp2
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.h2
-rw-r--r--engines/scumm/insane/insane_scenes.cpp2
-rw-r--r--engines/scumm/midiparser_ro.cpp16
-rw-r--r--engines/scumm/module.mk1
-rw-r--r--engines/scumm/object.cpp4
-rw-r--r--engines/scumm/player_apple2.cpp68
-rw-r--r--engines/scumm/player_apple2.h10
-rw-r--r--engines/scumm/player_towns.cpp2
-rw-r--r--engines/scumm/player_v2cms.cpp64
-rw-r--r--engines/scumm/proc3ARM.s93
-rw-r--r--engines/scumm/saveload.cpp2
-rw-r--r--engines/scumm/saveload.h2
-rw-r--r--engines/scumm/script.cpp8
-rw-r--r--engines/scumm/script_v0.cpp14
-rw-r--r--engines/scumm/script_v2.cpp6
-rw-r--r--engines/scumm/script_v5.cpp2
-rw-r--r--engines/scumm/scumm-md5.h27
-rw-r--r--engines/scumm/scumm.cpp44
-rw-r--r--engines/scumm/scumm.h15
-rw-r--r--engines/scumm/scumm_v7.h2
-rw-r--r--engines/scumm/sound.cpp9
-rw-r--r--engines/scumm/verbs.cpp4
-rw-r--r--engines/sky/control.cpp26
-rw-r--r--engines/sky/control.h5
-rw-r--r--engines/sky/detection.cpp29
-rw-r--r--engines/sword1/animation.cpp82
-rw-r--r--engines/sword1/animation.h32
-rw-r--r--engines/sword1/control.cpp4
-rw-r--r--engines/sword1/detection.cpp3
-rw-r--r--engines/sword1/logic.cpp2
-rw-r--r--engines/sword1/objectman.cpp251
-rw-r--r--engines/sword1/objectman.h19
-rw-r--r--engines/sword1/sound.cpp2
-rw-r--r--engines/sword1/sword1.cpp4
-rw-r--r--engines/sword1/sword1.h1
-rw-r--r--engines/sword1/text.cpp2
-rw-r--r--engines/sword2/animation.cpp66
-rw-r--r--engines/sword2/animation.h30
-rw-r--r--engines/sword2/function.cpp2
-rw-r--r--engines/sword2/sprite.cpp4
-rw-r--r--engines/sword2/sword2.cpp15
-rw-r--r--engines/sword25/fmv/movieplayer.cpp7
-rw-r--r--engines/sword25/fmv/movieplayer.h4
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp555
-rw-r--r--engines/sword25/fmv/theora_decoder.h141
-rw-r--r--engines/sword25/gfx/graphicengine.cpp2
-rw-r--r--engines/sword25/gfx/image/art.cpp28
-rw-r--r--engines/sword25/gfx/image/art.h2
-rw-r--r--engines/sword25/gfx/image/imgloader.cpp13
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp2
-rw-r--r--engines/sword25/kernel/inputpersistenceblock.cpp2
-rw-r--r--engines/sword25/module.mk5
-rw-r--r--engines/sword25/script/luabindhelper.cpp2
-rw-r--r--engines/sword25/script/luabindhelper.h2
-rw-r--r--engines/sword25/sfx/soundengine.cpp20
-rw-r--r--engines/sword25/util/lua/luaconf.h3
-rw-r--r--engines/sword25/util/pluto/pluto.cpp4
-rw-r--r--engines/teenagent/callbacks.cpp6
-rw-r--r--engines/teenagent/detection.cpp10
-rw-r--r--engines/teenagent/resources.cpp46
-rw-r--r--engines/teenagent/scene.cpp4
-rw-r--r--engines/teenagent/teenagent.cpp5
-rw-r--r--engines/testbed/graphics.cpp6
-rw-r--r--engines/testbed/testsuite.cpp2
-rw-r--r--engines/tinsel/actors.cpp16
-rw-r--r--engines/tinsel/background.h2
-rw-r--r--engines/tinsel/bg.cpp6
-rw-r--r--engines/tinsel/bmv.cpp4
-rw-r--r--engines/tinsel/bmv.h2
-rw-r--r--engines/tinsel/coroutine.cpp82
-rw-r--r--engines/tinsel/coroutine.h282
-rw-r--r--engines/tinsel/detection.cpp8
-rw-r--r--engines/tinsel/detection_tables.h144
-rw-r--r--engines/tinsel/dialogs.cpp69
-rw-r--r--engines/tinsel/dialogs.h2
-rw-r--r--engines/tinsel/drives.cpp8
-rw-r--r--engines/tinsel/drives.h2
-rw-r--r--engines/tinsel/effect.cpp2
-rw-r--r--engines/tinsel/events.cpp18
-rw-r--r--engines/tinsel/events.h4
-rw-r--r--engines/tinsel/faders.cpp4
-rw-r--r--engines/tinsel/handle.cpp14
-rw-r--r--engines/tinsel/module.mk1
-rw-r--r--engines/tinsel/move.cpp4
-rw-r--r--engines/tinsel/music.cpp229
-rw-r--r--engines/tinsel/music.h6
-rw-r--r--engines/tinsel/pcode.cpp63
-rw-r--r--engines/tinsel/pcode.h12
-rw-r--r--engines/tinsel/pdisplay.cpp6
-rw-r--r--engines/tinsel/play.cpp16
-rw-r--r--engines/tinsel/play.h2
-rw-r--r--engines/tinsel/polygons.cpp4
-rw-r--r--engines/tinsel/rince.cpp8
-rw-r--r--engines/tinsel/rince.h3
-rw-r--r--engines/tinsel/saveload.cpp50
-rw-r--r--engines/tinsel/savescn.cpp10
-rw-r--r--engines/tinsel/scene.cpp23
-rw-r--r--engines/tinsel/scene.h6
-rw-r--r--engines/tinsel/sched.cpp487
-rw-r--r--engines/tinsel/sched.h93
-rw-r--r--engines/tinsel/sound.cpp6
-rw-r--r--engines/tinsel/text.h2
-rw-r--r--engines/tinsel/tinlib.cpp37
-rw-r--r--engines/tinsel/tinsel.cpp33
-rw-r--r--engines/tinsel/tinsel.h28
-rw-r--r--engines/tinsel/token.cpp14
-rw-r--r--engines/toltecs/animation.cpp14
-rw-r--r--engines/toltecs/animation.h2
-rw-r--r--engines/toltecs/detection.cpp2
-rw-r--r--engines/toltecs/menu.cpp114
-rw-r--r--engines/toltecs/menu.h21
-rw-r--r--engines/toltecs/microtiles.cpp2
-rw-r--r--engines/toltecs/movie.cpp58
-rw-r--r--engines/toltecs/movie.h8
-rw-r--r--engines/toltecs/music.cpp20
-rw-r--r--engines/toltecs/music.h2
-rw-r--r--engines/toltecs/palette.cpp18
-rw-r--r--engines/toltecs/palette.h2
-rw-r--r--engines/toltecs/render.cpp18
-rw-r--r--engines/toltecs/render.h4
-rw-r--r--engines/toltecs/resource.cpp8
-rw-r--r--engines/toltecs/saveload.cpp17
-rw-r--r--engines/toltecs/screen.cpp51
-rw-r--r--engines/toltecs/screen.h19
-rw-r--r--engines/toltecs/script.cpp41
-rw-r--r--engines/toltecs/script.h6
-rw-r--r--engines/toltecs/segmap.cpp20
-rw-r--r--engines/toltecs/segmap.h8
-rw-r--r--engines/toltecs/sound.cpp107
-rw-r--r--engines/toltecs/sound.h7
-rw-r--r--engines/toltecs/sprite.cpp20
-rw-r--r--engines/toltecs/toltecs.cpp84
-rw-r--r--engines/toltecs/toltecs.h23
-rw-r--r--engines/tony/custom.cpp2530
-rw-r--r--engines/tony/custom.h85
-rw-r--r--engines/tony/debugger.cpp130
-rw-r--r--engines/tony/debugger.h43
-rw-r--r--engines/tony/detection.cpp194
-rw-r--r--engines/tony/detection_tables.h178
-rw-r--r--engines/tony/font.cpp1179
-rw-r--r--engines/tony/font.h379
-rw-r--r--engines/tony/game.cpp1604
-rw-r--r--engines/tony/game.h340
-rw-r--r--engines/tony/gfxcore.cpp2192
-rw-r--r--engines/tony/gfxcore.h516
-rw-r--r--engines/tony/gfxengine.cpp843
-rw-r--r--engines/tony/gfxengine.h139
-rw-r--r--engines/tony/globals.cpp135
-rw-r--r--engines/tony/globals.h286
-rw-r--r--engines/tony/input.cpp157
-rw-r--r--engines/tony/input.h88
-rw-r--r--engines/tony/inventory.cpp938
-rw-r--r--engines/tony/inventory.h241
-rw-r--r--engines/tony/loc.cpp2280
-rw-r--r--engines/tony/loc.h582
-rw-r--r--engines/tony/module.mk33
-rw-r--r--engines/tony/mpal/expr.cpp365
-rw-r--r--engines/tony/mpal/expr.h140
-rw-r--r--engines/tony/mpal/loadmpc.cpp788
-rw-r--r--engines/tony/mpal/loadmpc.h59
-rw-r--r--engines/tony/mpal/lzo.cpp511
-rw-r--r--engines/tony/mpal/lzo.h111
-rw-r--r--engines/tony/mpal/memory.cpp127
-rw-r--r--engines/tony/mpal/memory.h78
-rw-r--r--engines/tony/mpal/mpal.cpp2089
-rw-r--r--engines/tony/mpal/mpal.h518
-rw-r--r--engines/tony/mpal/mpaldll.h251
-rw-r--r--engines/tony/mpal/mpalutils.cpp115
-rw-r--r--engines/tony/mpal/mpalutils.h74
-rw-r--r--engines/tony/resid.h71
-rw-r--r--engines/tony/sound.cpp688
-rw-r--r--engines/tony/sound.h377
-rw-r--r--engines/tony/tony.cpp791
-rw-r--r--engines/tony/tony.h242
-rw-r--r--engines/tony/tonychar.cpp1945
-rw-r--r--engines/tony/tonychar.h482
-rw-r--r--engines/tony/utils.cpp448
-rw-r--r--engines/tony/utils.h176
-rw-r--r--engines/tony/window.cpp336
-rw-r--r--engines/tony/window.h98
-rw-r--r--engines/toon/anim.cpp149
-rw-r--r--engines/toon/anim.h58
-rw-r--r--engines/toon/audio.cpp2
-rw-r--r--engines/toon/character.cpp125
-rw-r--r--engines/toon/character.h33
-rw-r--r--engines/toon/detection.cpp7
-rw-r--r--engines/toon/drew.cpp2
-rw-r--r--engines/toon/drew.h2
-rw-r--r--engines/toon/flux.cpp4
-rw-r--r--engines/toon/flux.h2
-rw-r--r--engines/toon/font.cpp46
-rw-r--r--engines/toon/font.h6
-rw-r--r--engines/toon/hotspot.cpp4
-rw-r--r--engines/toon/hotspot.h4
-rw-r--r--engines/toon/movie.cpp58
-rw-r--r--engines/toon/movie.h12
-rw-r--r--engines/toon/path.cpp267
-rw-r--r--engines/toon/path.h71
-rw-r--r--engines/toon/picture.cpp62
-rw-r--r--engines/toon/picture.h24
-rw-r--r--engines/toon/script_func.cpp4
-rw-r--r--engines/toon/toon.cpp50
-rw-r--r--engines/toon/toon.h5
-rw-r--r--engines/touche/detection.cpp18
-rw-r--r--engines/touche/staticres.cpp5
-rw-r--r--engines/tsage/blue_force/blueforce_dialogs.cpp4
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.cpp8
-rw-r--r--engines/tsage/blue_force/blueforce_scenes7.cpp2
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.cpp73
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.cpp28
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.h6
-rw-r--r--engines/tsage/converse.cpp2
-rw-r--r--engines/tsage/detection.cpp4
-rw-r--r--engines/tsage/detection_tables.h8
-rw-r--r--engines/tsage/dialogs.cpp2
-rw-r--r--engines/tsage/globals.cpp12
-rw-r--r--engines/tsage/globals.h2
-rw-r--r--engines/tsage/graphics.cpp8
-rw-r--r--engines/tsage/graphics.h2
-rw-r--r--engines/tsage/ringworld/ringworld_dialogs.cpp4
-rw-r--r--engines/tsage/ringworld/ringworld_logic.cpp4
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.cpp2
-rw-r--r--engines/tsage/ringworld2/ringworld2_dialogs.cpp2
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp6
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp4
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.cpp2
-rw-r--r--engines/tsage/ringworld2/ringworld2_speakers.h14
-rw-r--r--engines/tsage/scenes.cpp10
-rw-r--r--engines/tsage/scenes.h2
-rw-r--r--engines/tsage/sound.cpp266
-rw-r--r--engines/tsage/sound.h102
-rw-r--r--engines/tsage/tsage.cpp6
-rw-r--r--engines/tsage/user_interface.cpp2
-rw-r--r--engines/tucker/resource.cpp33
-rw-r--r--engines/tucker/sequences.cpp4
-rw-r--r--engines/wintermute/ad/ad_actor.cpp1460
-rw-r--r--engines/wintermute/ad/ad_actor.h108
-rw-r--r--engines/wintermute/ad/ad_entity.cpp1122
-rw-r--r--engines/wintermute/ad/ad_entity.h68
-rw-r--r--engines/wintermute/ad/ad_game.cpp2281
-rw-r--r--engines/wintermute/ad/ad_game.h163
-rw-r--r--engines/wintermute/ad/ad_inventory.cpp136
-rw-r--r--engines/wintermute/ad/ad_inventory.h52
-rw-r--r--engines/wintermute/ad/ad_inventory_box.cpp389
-rw-r--r--engines/wintermute/ad/ad_inventory_box.h65
-rw-r--r--engines/wintermute/ad/ad_item.cpp813
-rw-r--r--engines/wintermute/ad/ad_item.h69
-rw-r--r--engines/wintermute/ad/ad_layer.cpp564
-rw-r--r--engines/wintermute/ad/ad_layer.h58
-rw-r--r--engines/wintermute/ad/ad_node_state.cpp196
-rw-r--r--engines/wintermute/ad/ad_node_state.h60
-rw-r--r--engines/wintermute/ad/ad_object.cpp1300
-rw-r--r--engines/wintermute/ad/ad_object.h124
-rw-r--r--engines/wintermute/ad/ad_path.cpp120
-rw-r--r--engines/wintermute/ad/ad_path.h56
-rw-r--r--engines/wintermute/ad/ad_path_point.cpp75
-rw-r--r--engines/wintermute/ad/ad_path_point.h50
-rw-r--r--engines/wintermute/ad/ad_region.cpp397
-rw-r--r--engines/wintermute/ad/ad_region.h58
-rw-r--r--engines/wintermute/ad/ad_response.cpp146
-rw-r--r--engines/wintermute/ad/ad_response.h61
-rw-r--r--engines/wintermute/ad/ad_response_box.cpp713
-rw-r--r--engines/wintermute/ad/ad_response_box.h87
-rw-r--r--engines/wintermute/ad/ad_response_context.cpp71
-rw-r--r--engines/wintermute/ad/ad_response_context.h50
-rw-r--r--engines/wintermute/ad/ad_rot_level.cpp161
-rw-r--r--engines/wintermute/ad/ad_rot_level.h49
-rw-r--r--engines/wintermute/ad/ad_scale_level.cpp159
-rw-r--r--engines/wintermute/ad/ad_scale_level.h50
-rw-r--r--engines/wintermute/ad/ad_scene.cpp2987
-rw-r--r--engines/wintermute/ad/ad_scene.h181
-rw-r--r--engines/wintermute/ad/ad_scene_node.cpp82
-rw-r--r--engines/wintermute/ad/ad_scene_node.h54
-rw-r--r--engines/wintermute/ad/ad_scene_state.cpp95
-rw-r--r--engines/wintermute/ad/ad_scene_state.h51
-rw-r--r--engines/wintermute/ad/ad_sentence.cpp361
-rw-r--r--engines/wintermute/ad/ad_sentence.h85
-rw-r--r--engines/wintermute/ad/ad_sprite_set.cpp356
-rw-r--r--engines/wintermute/ad/ad_sprite_set.h53
-rw-r--r--engines/wintermute/ad/ad_talk_def.cpp285
-rw-r--r--engines/wintermute/ad/ad_talk_def.h58
-rw-r--r--engines/wintermute/ad/ad_talk_holder.cpp402
-rw-r--r--engines/wintermute/ad/ad_talk_holder.h57
-rw-r--r--engines/wintermute/ad/ad_talk_node.cpp295
-rw-r--r--engines/wintermute/ad/ad_talk_node.h63
-rw-r--r--engines/wintermute/ad/ad_types.h107
-rw-r--r--engines/wintermute/ad/ad_waypoint_group.cpp270
-rw-r--r--engines/wintermute/ad/ad_waypoint_group.h58
-rw-r--r--engines/wintermute/base/base.cpp185
-rw-r--r--engines/wintermute/base/base.h62
-rw-r--r--engines/wintermute/base/base_active_rect.cpp111
-rw-r--r--engines/wintermute/base/base_active_rect.h60
-rw-r--r--engines/wintermute/base/base_dynamic_buffer.cpp204
-rw-r--r--engines/wintermute/base/base_dynamic_buffer.h65
-rw-r--r--engines/wintermute/base/base_engine.cpp93
-rw-r--r--engines/wintermute/base/base_engine.h69
-rw-r--r--engines/wintermute/base/base_fader.cpp195
-rw-r--r--engines/wintermute/base/base_fader.h63
-rw-r--r--engines/wintermute/base/base_file_manager.cpp340
-rw-r--r--engines/wintermute/base/base_file_manager.h76
-rw-r--r--engines/wintermute/base/base_frame.cpp766
-rw-r--r--engines/wintermute/base/base_frame.h75
-rw-r--r--engines/wintermute/base/base_game.cpp4483
-rw-r--r--engines/wintermute/base/base_game.h361
-rw-r--r--engines/wintermute/base/base_keyboard_state.cpp309
-rw-r--r--engines/wintermute/base/base_keyboard_state.h75
-rw-r--r--engines/wintermute/base/base_named_object.cpp71
-rw-r--r--engines/wintermute/base/base_named_object.h51
-rw-r--r--engines/wintermute/base/base_object.cpp1246
-rw-r--r--engines/wintermute/base/base_object.h147
-rw-r--r--engines/wintermute/base/base_parser.cpp467
-rw-r--r--engines/wintermute/base/base_parser.h88
-rw-r--r--engines/wintermute/base/base_persistence_manager.cpp828
-rw-r--r--engines/wintermute/base/base_persistence_manager.h118
-rw-r--r--engines/wintermute/base/base_point.cpp63
-rw-r--r--engines/wintermute/base/base_point.h50
-rw-r--r--engines/wintermute/base/base_quick_msg.cpp57
-rw-r--r--engines/wintermute/base/base_quick_msg.h48
-rw-r--r--engines/wintermute/base/base_region.cpp535
-rw-r--r--engines/wintermute/base/base_region.h70
-rw-r--r--engines/wintermute/base/base_save_thumb_helper.cpp81
-rw-r--r--engines/wintermute/base/base_save_thumb_helper.h51
-rw-r--r--engines/wintermute/base/base_script_holder.cpp502
-rw-r--r--engines/wintermute/base/base_script_holder.h76
-rw-r--r--engines/wintermute/base/base_scriptable.cpp191
-rw-r--r--engines/wintermute/base/base_scriptable.h83
-rw-r--r--engines/wintermute/base/base_sprite.cpp819
-rw-r--r--engines/wintermute/base/base_sprite.h93
-rw-r--r--engines/wintermute/base/base_string_table.cpp255
-rw-r--r--engines/wintermute/base/base_string_table.h55
-rw-r--r--engines/wintermute/base/base_sub_frame.cpp659
-rw-r--r--engines/wintermute/base/base_sub_frame.h93
-rw-r--r--engines/wintermute/base/base_surface_storage.cpp208
-rw-r--r--engines/wintermute/base/base_surface_storage.h57
-rw-r--r--engines/wintermute/base/base_transition_manager.cpp137
-rw-r--r--engines/wintermute/base/base_transition_manager.h54
-rw-r--r--engines/wintermute/base/base_viewport.cpp99
-rw-r--r--engines/wintermute/base/base_viewport.h55
-rw-r--r--engines/wintermute/base/file/base_disk_file.cpp194
-rw-r--r--engines/wintermute/base/file/base_disk_file.h41
-rw-r--r--engines/wintermute/base/file/base_file.cpp68
-rw-r--r--engines/wintermute/base/file/base_file.h67
-rw-r--r--engines/wintermute/base/file/base_file_entry.cpp73
-rw-r--r--engines/wintermute/base/file/base_file_entry.h60
-rw-r--r--engines/wintermute/base/file/base_package.cpp276
-rw-r--r--engines/wintermute/base/file/base_package.h90
-rw-r--r--engines/wintermute/base/file/base_resources.cpp2830
-rw-r--r--engines/wintermute/base/file/base_resources.h45
-rw-r--r--engines/wintermute/base/file/base_save_thumb_file.cpp153
-rw-r--r--engines/wintermute/base/file/base_save_thumb_file.h52
-rw-r--r--engines/wintermute/base/file/dcpackage.h80
-rw-r--r--engines/wintermute/base/font/base_font.cpp140
-rw-r--r--engines/wintermute/base/font/base_font.h61
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.cpp590
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.h71
-rw-r--r--engines/wintermute/base/font/base_font_storage.cpp141
-rw-r--r--engines/wintermute/base/font/base_font_storage.h55
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp602
-rw-r--r--engines/wintermute/base/font/base_font_truetype.h152
-rw-r--r--engines/wintermute/base/gfx/base_image.cpp231
-rw-r--r--engines/wintermute/base/gfx/base_image.h72
-rw-r--r--engines/wintermute/base/gfx/base_renderer.cpp381
-rw-r--r--engines/wintermute/base/gfx/base_renderer.h221
-rw-r--r--engines/wintermute/base/gfx/base_surface.cpp149
-rw-r--r--engines/wintermute/base/gfx/base_surface.h99
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp609
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.h131
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp428
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.h99
-rw-r--r--engines/wintermute/base/particles/part_emitter.cpp1257
-rw-r--r--engines/wintermute/base/particles/part_emitter.h140
-rw-r--r--engines/wintermute/base/particles/part_force.cpp65
-rw-r--r--engines/wintermute/base/particles/part_force.h57
-rw-r--r--engines/wintermute/base/particles/part_particle.cpp269
-rw-r--r--engines/wintermute/base/particles/part_particle.h90
-rw-r--r--engines/wintermute/base/saveload.cpp204
-rw-r--r--engines/wintermute/base/saveload.h57
-rw-r--r--engines/wintermute/base/scriptables/dcscript.h141
-rw-r--r--engines/wintermute/base/scriptables/script.cpp1467
-rw-r--r--engines/wintermute/base/scriptables/script.h174
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp609
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h135
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.cpp252
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.h56
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.cpp293
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.h54
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp828
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.h66
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.cpp295
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.h53
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp529
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.h60
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.cpp67
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.h46
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp436
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.h58
-rw-r--r--engines/wintermute/base/scriptables/script_stack.cpp232
-rw-r--r--engines/wintermute/base/scriptables/script_stack.h66
-rw-r--r--engines/wintermute/base/scriptables/script_value.cpp995
-rw-r--r--engines/wintermute/base/scriptables/script_value.h113
-rw-r--r--engines/wintermute/base/sound/base_sound.cpp292
-rw-r--r--engines/wintermute/base/sound/base_sound.h87
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.cpp295
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.h100
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp283
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.h68
-rw-r--r--engines/wintermute/coll_templ.h86
-rw-r--r--engines/wintermute/dcgf.h51
-rw-r--r--engines/wintermute/dctypes.h225
-rw-r--r--engines/wintermute/detection.cpp174
-rw-r--r--engines/wintermute/detection_tables.h265
-rw-r--r--engines/wintermute/graphics/transparent_surface.cpp440
-rw-r--r--engines/wintermute/graphics/transparent_surface.h131
-rw-r--r--engines/wintermute/math/math_util.cpp52
-rw-r--r--engines/wintermute/math/math_util.h42
-rw-r--r--engines/wintermute/math/matrix4.cpp86
-rw-r--r--engines/wintermute/math/matrix4.h50
-rw-r--r--engines/wintermute/math/rect32.h94
-rw-r--r--engines/wintermute/math/vector2.cpp55
-rw-r--r--engines/wintermute/math/vector2.h75
-rw-r--r--engines/wintermute/module.mk123
-rw-r--r--engines/wintermute/persistent.cpp168
-rw-r--r--engines/wintermute/persistent.h89
-rw-r--r--engines/wintermute/platform_osystem.cpp262
-rw-r--r--engines/wintermute/platform_osystem.h73
-rw-r--r--engines/wintermute/system/sys_class.cpp220
-rw-r--r--engines/wintermute/system/sys_class.h130
-rw-r--r--engines/wintermute/system/sys_class_registry.cpp336
-rw-r--r--engines/wintermute/system/sys_class_registry.h106
-rw-r--r--engines/wintermute/system/sys_instance.cpp49
-rw-r--r--engines/wintermute/system/sys_instance.h68
-rw-r--r--engines/wintermute/ui/ui_button.cpp1209
-rw-r--r--engines/wintermute/ui/ui_button.h80
-rw-r--r--engines/wintermute/ui/ui_edit.cpp952
-rw-r--r--engines/wintermute/ui/ui_edit.h72
-rw-r--r--engines/wintermute/ui/ui_entity.cpp366
-rw-r--r--engines/wintermute/ui/ui_entity.h59
-rw-r--r--engines/wintermute/ui/ui_object.cpp651
-rw-r--r--engines/wintermute/ui/ui_object.h85
-rw-r--r--engines/wintermute/ui/ui_text.cpp522
-rw-r--r--engines/wintermute/ui/ui_text.h60
-rw-r--r--engines/wintermute/ui/ui_tiled_image.cpp394
-rw-r--r--engines/wintermute/ui/ui_tiled_image.h63
-rw-r--r--engines/wintermute/ui/ui_window.cpp1445
-rw-r--r--engines/wintermute/ui/ui_window.h94
-rw-r--r--engines/wintermute/utils/convert_utf.cpp615
-rw-r--r--engines/wintermute/utils/convert_utf.h148
-rw-r--r--engines/wintermute/utils/crc.cpp237
-rw-r--r--engines/wintermute/utils/crc.h85
-rw-r--r--engines/wintermute/utils/path_util.cpp101
-rw-r--r--engines/wintermute/utils/path_util.h49
-rw-r--r--engines/wintermute/utils/string_util.cpp232
-rw-r--r--engines/wintermute/utils/string_util.h56
-rw-r--r--engines/wintermute/utils/utils.cpp261
-rw-r--r--engines/wintermute/utils/utils.h64
-rw-r--r--engines/wintermute/video/video_player.cpp109
-rw-r--r--engines/wintermute/video/video_player.h90
-rw-r--r--engines/wintermute/video/video_theora_player.cpp505
-rw-r--r--engines/wintermute/video/video_theora_player.h148
-rw-r--r--engines/wintermute/wintermute.cpp383
-rw-r--r--engines/wintermute/wintermute.h78
-rw-r--r--engines/wintermute/wintypes.h53
-rw-r--r--graphics/VectorRenderer.cpp2
-rw-r--r--graphics/VectorRenderer.h2
-rw-r--r--graphics/VectorRendererSpec.cpp68
-rw-r--r--graphics/conversion.cpp202
-rw-r--r--graphics/conversion.h19
-rw-r--r--graphics/cursorman.cpp20
-rw-r--r--graphics/cursorman.h14
-rw-r--r--graphics/decoders/bmp.cpp182
-rw-r--r--graphics/decoders/bmp.h (renamed from graphics/imagedec.h)49
-rw-r--r--graphics/decoders/image_decoder.h98
-rw-r--r--graphics/decoders/jpeg.cpp (renamed from graphics/jpeg.cpp)116
-rw-r--r--graphics/decoders/jpeg.h (renamed from graphics/jpeg.h)31
-rw-r--r--graphics/decoders/pcx.cpp213
-rw-r--r--graphics/decoders/pcx.h68
-rw-r--r--graphics/decoders/pict.cpp (renamed from graphics/pict.cpp)449
-rw-r--r--graphics/decoders/pict.h (renamed from graphics/pict.h)42
-rw-r--r--graphics/decoders/png.cpp241
-rw-r--r--graphics/decoders/png.h66
-rw-r--r--graphics/decoders/tga.cpp427
-rw-r--r--graphics/decoders/tga.h98
-rw-r--r--graphics/fontman.cpp36
-rw-r--r--graphics/fontman.h5
-rw-r--r--graphics/fonts/bdf.h2
-rw-r--r--graphics/fonts/consolefont.cpp2
-rw-r--r--graphics/fonts/newfont.cpp2
-rw-r--r--graphics/fonts/newfont_big.cpp2
-rw-r--r--graphics/fonts/ttf.cpp26
-rw-r--r--graphics/fonts/ttf.h4
-rw-r--r--graphics/iff.cpp23
-rw-r--r--graphics/imagedec.cpp176
-rw-r--r--graphics/module.mk12
-rw-r--r--graphics/pixelformat.h2
-rw-r--r--graphics/png.cpp487
-rw-r--r--graphics/png.h168
-rw-r--r--graphics/primitives.cpp62
-rw-r--r--graphics/primitives.h2
-rw-r--r--graphics/scaler.cpp9
-rw-r--r--graphics/scaler/aspect.cpp72
-rw-r--r--graphics/sjis.h2
-rw-r--r--graphics/surface.cpp157
-rw-r--r--graphics/surface.h41
-rw-r--r--graphics/wincursor.cpp40
-rw-r--r--graphics/wincursor.h42
-rw-r--r--graphics/yuv_to_rgb.cpp287
-rw-r--r--graphics/yuv_to_rgb.h88
-rw-r--r--gui/ThemeEngine.cpp34
-rw-r--r--gui/ThemeEngine.h18
-rw-r--r--gui/ThemeParser.cpp11
-rw-r--r--gui/ThemeParser.h3
-rw-r--r--gui/Tooltip.cpp2
-rw-r--r--gui/credits.h36
-rw-r--r--gui/debugger.cpp5
-rw-r--r--gui/dialog.cpp20
-rw-r--r--gui/dialog.h16
-rw-r--r--gui/gui-manager.cpp16
-rw-r--r--gui/launcher.cpp63
-rw-r--r--gui/module.mk2
-rw-r--r--gui/options.cpp63
-rw-r--r--gui/options.h13
-rw-r--r--gui/predictivedialog.cpp998
-rw-r--r--gui/predictivedialog.h143
-rw-r--r--gui/saveload-dialog.cpp946
-rw-r--r--gui/saveload-dialog.h209
-rw-r--r--gui/saveload.cpp391
-rw-r--r--gui/saveload.h70
-rw-r--r--gui/themes/default.inc318
-rw-r--r--gui/themes/scummclassic.zipbin86033 -> 95180 bytes
-rw-r--r--gui/themes/scummclassic/THEMERC2
-rw-r--r--gui/themes/scummclassic/classic_gfx.stx13
-rw-r--r--gui/themes/scummclassic/classic_layout.stx170
-rw-r--r--gui/themes/scummclassic/classic_layout_lowres.stx156
-rw-r--r--gui/themes/scummmodern.zipbin1441312 -> 1453485 bytes
-rw-r--r--gui/themes/scummmodern/THEMERC2
-rw-r--r--gui/themes/scummmodern/delbtn.bmpbin0 -> 822 bytes
-rw-r--r--gui/themes/scummmodern/grid.bmpbin0 -> 822 bytes
-rw-r--r--gui/themes/scummmodern/list.bmpbin0 -> 822 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_gfx.stx40
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx173
-rw-r--r--gui/themes/scummmodern/scummmodern_layout_lowres.stx155
-rw-r--r--gui/themes/translations.datbin289269 -> 370908 bytes
-rw-r--r--gui/widget.cpp133
-rw-r--r--gui/widget.h28
-rw-r--r--gui/widgets/editable.h5
-rw-r--r--gui/widgets/list.h1
-rw-r--r--po/POTFILES11
-rw-r--r--po/ca_ES.po883
-rw-r--r--po/cs_CZ.po825
-rw-r--r--po/da_DA.po1150
-rw-r--r--po/de_DE.po866
-rw-r--r--po/es_ES.po879
-rw-r--r--po/eu.po3116
-rw-r--r--po/fr_FR.po827
-rw-r--r--po/gl_ES.po3092
-rw-r--r--po/hu_HU.po809
-rw-r--r--po/it_IT.po883
-rw-r--r--po/nb_NO.po1074
-rw-r--r--po/nn_NO.po778
-rw-r--r--po/pl_PL.po857
-rw-r--r--po/pt_BR.po781
-rw-r--r--po/ru_RU.po834
-rw-r--r--po/scummvm.pot771
-rw-r--r--po/se_SE.po835
-rw-r--r--po/uk_UA.po822
-rw-r--r--ports.mk23
-rw-r--r--test/common/memorywritestream.h31
-rw-r--r--video/avi_decoder.cpp559
-rw-r--r--video/avi_decoder.h310
-rw-r--r--video/bink_decoder.cpp1044
-rw-r--r--video/bink_decoder.h427
-rw-r--r--video/codecs/mjpeg.cpp25
-rw-r--r--video/codecs/mjpeg.h3
-rw-r--r--video/codecs/qtrle.cpp135
-rw-r--r--video/codecs/qtrle.h3
-rw-r--r--video/codecs/rpza.cpp22
-rw-r--r--video/codecs/rpza.h3
-rw-r--r--video/codecs/svq1.cpp797
-rw-r--r--video/codecs/svq1.h82
-rw-r--r--video/codecs/svq1_cb.h1511
-rw-r--r--video/codecs/svq1_vlc.h341
-rw-r--r--video/coktel_decoder.cpp203
-rw-r--r--video/coktel_decoder.h124
-rw-r--r--video/dxa_decoder.cpp130
-rw-r--r--video/dxa_decoder.h102
-rw-r--r--video/flic_decoder.cpp302
-rw-r--r--video/flic_decoder.h101
-rw-r--r--video/module.mk6
-rw-r--r--video/psx_decoder.cpp254
-rw-r--r--video/psx_decoder.h107
-rw-r--r--video/qt_decoder.cpp680
-rw-r--r--video/qt_decoder.h187
-rw-r--r--video/smk_decoder.cpp394
-rw-r--r--video/smk_decoder.h118
-rw-r--r--video/theora_decoder.cpp487
-rw-r--r--video/theora_decoder.h157
-rw-r--r--video/video_decoder.cpp627
-rw-r--r--video/video_decoder.h710
1713 files changed, 218711 insertions, 52947 deletions
diff --git a/AUTHORS b/AUTHORS
index 86f5c3e023..2ae50159c3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -6,8 +6,9 @@ ScummVM Team
PR Office
---------
- Arnaud Boutonne - Public Relations Officer, Project Administrator
- Eugene Sandulenko - Project Leader
+ Arnaud Boutonne - Public Relations Officer, Project
+ Administrator
+ Eugene Sandulenko - Project Leader
Core Team
---------
@@ -18,29 +19,30 @@ ScummVM Team
Retired Project Leaders
-----------------------
James Brown
- Vincent Hamm - ScummVM co-founder, Original Cruise/CinE author
+ Vincent Hamm - ScummVM co-founder, Original Cruise/CinE
+ author
Max Horn
- Ludvig Strigeus - Original ScummVM and SimonVM author
+ Ludvig Strigeus - Original ScummVM and SimonVM author
Engine Teams
------------
SCUMM:
Torbjorn Andersson
- James Brown - (retired)
- Jonathan Gray - (retired)
- Vincent Hamm - (retired)
- Max Horn - (retired)
+ James Brown - (retired)
+ Jonathan Gray - (retired)
+ Vincent Hamm - (retired)
+ Max Horn - (retired)
Travis Howell
- Pawel Kolodziejski - Codecs, iMUSE, Smush, etc.
- Gregory Montoir - (retired)
- Eugene Sandulenko - FT INSANE, MM NES, MM C64, game detection,
- Herc/CGA
- Ludvig Strigeus - (retired)
+ Pawel Kolodziejski - Codecs, iMUSE, Smush, etc.
+ Gregory Montoir - (retired)
+ Eugene Sandulenko - FT INSANE, MM NES, MM C64, game detection,
+ Herc/CGA
+ Ludvig Strigeus - (retired)
HE:
- Jonathan Gray - (retired)
+ Jonathan Gray - (retired)
Travis Howell
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Eugene Sandulenko
AGI:
@@ -48,26 +50,26 @@ ScummVM Team
Matthew Hoops
Filippos Karapetis
Pawel Kolodziejski
- Walter van Niftrik - (retired)
+ Walter van Niftrik - (retired)
Kari Salminen
Eugene Sandulenko
- David Symonds - (retired)
+ David Symonds - (retired)
AGOS:
Torbjorn Andersson
Paul Gilbert
Travis Howell
- Oliver Kiehl - (retired)
- Ludvig Strigeus - (retired)
+ Oliver Kiehl - (retired)
+ Ludvig Strigeus - (retired)
CGE:
Arnaud Boutonne
Paul Gilbert
Cine:
- Vincent Hamm - (retired)
+ Vincent Hamm - (retired)
Pawel Kolodziejski
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Kari Salminen
Eugene Sandulenko
@@ -76,7 +78,7 @@ ScummVM Team
CruisE:
Paul Gilbert
- Vincent Hamm - (retired)
+ Vincent Hamm - (retired)
Draci:
Denis Kasak
@@ -89,7 +91,9 @@ ScummVM Team
DreamWeb:
Torbjorn Andersson
Bertrand Augereau
- Vladimir Menshakov - (retired)
+ Filippos Karapetis
+ Vladimir Menshakov - (retired)
+ Willem Jan Palenstijn
Gob:
Torbjorn Andersson
@@ -108,10 +112,10 @@ ScummVM Team
Eugene Sandulenko
Kyra:
- Torbjorn Andersson - VQA Player
+ Torbjorn Andersson - VQA Player
Oystein Eftevaag
Florian Kagerer
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Johannes Schickel
Lastexpress:
@@ -137,15 +141,18 @@ ScummVM Team
Parallaction:
peres
+ Pegasus:
+ Matthew Hoops
+
Queen:
- David Eriksson - (retired)
- Gregory Montoir - (retired)
+ David Eriksson - (retired)
+ Gregory Montoir - (retired)
Joost Peters
SAGA:
Torbjorn Andersson
- Daniel Balsom - Original engine reimplementation author
- (retired)
+ Daniel Balsom - Original engine reimplementation author
+ (retired)
Filippos Karapetis
Andrew Kurushin
Eugene Sandulenko
@@ -153,61 +160,69 @@ ScummVM Team
SCI:
Greg Frieger
Paul Gilbert
- Max Horn - (retired)
+ Max Horn - (retired)
Filippos Karapetis
Martin Kiewitz
- Walter van Niftrik - (retired)
+ Walter van Niftrik - (retired)
Willem Jan Palenstijn
Jordi Vilalta Prat
Lars Skovlund
Sky:
- Robert Goeffringmann - (retired)
- Oliver Kiehl - (retired)
+ Robert Goeffringmann - (retired)
+ Oliver Kiehl - (retired)
Joost Peters
Sword1:
- Fabio Battaglia - PSX version support
- Thierry Crozat - Mac version support
- Robert Goeffringmann - (retired)
+ Fabio Battaglia - PSX version support
+ Thierry Crozat - Mac version support
+ Robert Goeffringmann - (retired)
Sword2:
Torbjorn Andersson
- Fabio Battaglia - PSX version support
- Jonathan Gray - (retired)
+ Fabio Battaglia - PSX version support
+ Jonathan Gray - (retired)
Sword25:
Torbjorn Andersson
Paul Gilbert
- Max Horn - (retired)
+ Max Horn - (retired)
Filippos Karapetis
Eugene Sandulenko
TeenAgent:
- Robert Megone - Help with callback rewriting
- Vladimir Menshakov - (retired)
+ Robert Megone - Help with callback rewriting
+ Vladimir Menshakov - (retired)
Tinsel:
Torbjorn Andersson
- Fabio Battaglia - PSX version support
+ Fabio Battaglia - PSX version support
Paul Gilbert
Sven Hesse
- Max Horn - (retired)
+ Max Horn - (retired)
Filippos Karapetis
Joost Peters
+ Tony:
+ Arnaud Boutonne
+ Paul Gilbert
+ Alyssa Milburn
+
Toon:
Sylvain Dupont
Touche:
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
TsAGE:
Arnaud Boutonne
Paul Gilbert
Tucker:
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
+
+ Wintermute:
+ Einar Johan T. Somaaen
Backend Teams
-------------
@@ -231,26 +246,26 @@ ScummVM Team
Lubomyr Lisen
Maemo:
- Frantisek Dufka - (retired)
+ Frantisek Dufka - (retired)
Tarek Soliman
Nintendo 64:
Fabio Battaglia
Nintendo DS:
- Bertrand Augereau - HQ software scaler
+ Bertrand Augereau - HQ software scaler
Neil Millstone
OpenPandora:
John Willis
PocketPC / WinCE:
- Nicolas Bacca - (retired)
+ Nicolas Bacca - (retired)
Ismail Khatib
- Kostas Nakos - (retired)
+ Kostas Nakos - (retired)
PlayStation 2:
- Robert Goeffringmann - (retired)
+ Robert Goeffringmann - (retired)
Max Lingua
PSP (PlayStation Portable):
@@ -258,8 +273,8 @@ ScummVM Team
Joost Peters
SDL (Win/Linux/OS X/etc.):
- Max Horn - (retired)
- Eugene Sandulenko - Asm routines, GFX layers
+ Max Horn - (retired)
+ Eugene Sandulenko - Asm routines, GFX layers
SymbianOS:
Jurgen Braam
@@ -274,8 +289,9 @@ ScummVM Team
Other subsystems
----------------
Infrastructure:
- Max Horn - Backend & Engine APIs, file API, sound mixer,
- audiostreams, data structures, etc. (retired)
+ Max Horn - Backend & Engine APIs, file API, sound
+ mixer, audiostreams, data structures, etc.
+ (retired)
Eugene Sandulenko
Johannes Schickel
@@ -285,30 +301,31 @@ ScummVM Team
Johannes Schickel
Miscellaneous:
- David Corrales-Lopez - Filesystem access improvements (GSoC 2007
- task) (retired)
- Jerome Fisher - MT-32 emulator
- Benjamin Haisch - Heavily improved de-/encoder for DXA videos
- Jochen Hoenicke - Speaker & PCjr sound support, AdLib work
- (retired)
- Chris Page - Return to launcher, savestate improvements,
- leak fixes, ... (GSoC 2008 task) (retired)
- Robin Watts - ARM assembly routines for nice speedups on
- several ports; improvements to the sound mixer
+ David Corrales-Lopez - Filesystem access improvements (GSoC 2007
+ task) (retired)
+ Jerome Fisher - MT-32 emulator
+ Benjamin Haisch - Heavily improved de-/encoder for DXA videos
+ Jochen Hoenicke - Speaker & PCjr sound support, AdLib work
+ (retired)
+ Chris Page - Return to launcher, savestate improvements,
+ leak fixes, ... (GSoC 2008 task) (retired)
+ Robin Watts - ARM assembly routines for nice speedups on
+ several ports; improvements to the sound
+ mixer
Website (code)
--------------
- Fredrik Wendel - (retired)
+ Fredrik Wendel - (retired)
Website (maintenance)
---------------------
- James Brown - IRC Logs maintainer
- Thierry Crozat - Wiki maintainer
- Andre Heider - Buildbot maintainer
- Joost Peters - Doxygen Project Documentation maintainer
- Jordi Vilalta Prat - Wiki maintainer
- Eugene Sandulenko - Forum, IRC channel, Screen Shots and Mailing
- list maintainer
+ James Brown - IRC Logs maintainer
+ Thierry Crozat - Wiki maintainer
+ Andre Heider - Buildbot maintainer
+ Joost Peters - Doxygen Project Documentation maintainer
+ Jordi Vilalta Prat - Wiki maintainer
+ Eugene Sandulenko - Forum, IRC channel, Screen Shots and Mailing
+ list maintainer
John Willis
Website (content)
@@ -317,31 +334,31 @@ ScummVM Team
Documentation
-------------
- Thierry Crozat - Numerous contributions to documentation
- Joachim Eberhard - Numerous contributions to documentation
- (retired)
- Matthew Hoops - Wiki editor
+ Thierry Crozat - Numerous contributions to documentation
+ Joachim Eberhard - Numerous contributions to documentation
+ (retired)
+ Matthew Hoops - Wiki editor
Retired Team Members
--------------------
- Chris Apers - Former PalmOS porter
- Ralph Brorsen - Help with GUI implementation
- Jamieson Christian - iMUSE, MIDI, all things musical
- Felix Jakschitsch - Zak256 reverse engineering
- Mutwin Kraus - Original MacOS porter
- Peter Moraliyski - Port: GP32
- Jeremy Newman - Former webmaster
- Lionel Ulmer - Port: X11
- Won Star - Former GP32 porter
+ Chris Apers - Former PalmOS porter
+ Ralph Brorsen - Help with GUI implementation
+ Jamieson Christian - iMUSE, MIDI, all things musical
+ Felix Jakschitsch - Zak256 reverse engineering
+ Mutwin Kraus - Original MacOS porter
+ Peter Moraliyski - Port: GP32
+ Jeremy Newman - Former webmaster
+ Lionel Ulmer - Port: X11
+ Won Star - Former GP32 porter
Other contributions
*******************
Packages
--------
AmigaOS 4:
- Hans-Joerg Frieden - (retired)
+ Hans-Joerg Frieden - (retired)
Hubert Maier
- Juha Niemimaki - (retired)
+ Juha Niemimaki - (retired)
Atari/FreeMiNT:
Keith Scroggins
@@ -351,22 +368,22 @@ Other contributions
Luc Schrijvers
Debian GNU/Linux:
- Tore Anderson - (retired)
+ Tore Anderson - (retired)
David Weinehall
Fedora / RedHat:
Willem Jan Palenstijn
Mac OS X:
- Max Horn - (retired)
+ Max Horn - (retired)
Oystein Eftevaag
Mandriva:
- Dominik Scherer - (retired)
+ Dominik Scherer - (retired)
MorphOS:
Fabien Coeurjoly
- Ruediger Hanke - (retired)
+ Ruediger Hanke - (retired)
OS/2:
Paul Smedley
@@ -384,12 +401,15 @@ Other contributions
Travis Howell
Win64:
- Chris Gray - (retired)
+ Chris Gray - (retired)
Johannes Schickel
Translations
------------
- Thierry Crozat - Translation Lead
+ Thierry Crozat - Translation Lead
+
+ Basque:
+ Mikel Iturbe Urretxa
Catalan:
Jordi Vilalta Prat
@@ -403,9 +423,12 @@ Other contributions
French:
Thierry Crozat
+ Galician:
+ Santiago G. Sanz
+
German:
Simon Sawatzki
- Lothar Serra Mari
+ Lothar Serra Mari - (retired)
Hungarian:
Alex Bevilacqua
@@ -415,10 +438,10 @@ Other contributions
Matteo Angelino
Norwegian (Bokmaal):
- Einar Johan T. Somaae
+ Einar Johan Somaaen
Norwegian (Nynorsk):
- Einar Johan T. Somaae
+ Einar Johan Somaaen
Polish:
GrajPoPolsku.pl Team
@@ -441,92 +464,95 @@ Other contributions
Websites (design)
-----------------
- Dobo Balazs - Website design
- William Claydon - Skins for doxygen, buildbot and wiki
- Yaroslav Fedevych - HTML/CSS for the website
- Jean Marc Gimenez - ScummVM logo
- David Jensen - SVG logo conversion
- Raina - ScummVM forum buttons
+ Dobo Balazs - Website design
+ William Claydon - Skins for doxygen, buildbot and wiki
+ Yaroslav Fedevych - HTML/CSS for the website
+ Jean Marc Gimenez - ScummVM logo
+ David Jensen - SVG logo conversion
+ Raina - ScummVM forum buttons
Code contributions
------------------
- Ori Avtalion - Subtitle control options in the GUI; BASS GUI
- fixes
- Stuart Caie - Decoders for Amiga and AtariST data files (AGOS
- engine)
- Paolo Costabel - PSP port contributions
- Martin Doucha - CinE engine objectification
- Thomas Fach-Pedersen - ProTracker module player, Smacker video decoder
- Tobias Gunkel - Sound support for C64 version of MM/Zak, Loom
- PCE support
- Janne Huttunen - V3 actor mask support, Dig/FT SMUSH audio
- Kovacs Endre Janos - Several fixes for Simon1
- Jeroen Janssen - Numerous readability and bugfix patches
- Andreas Karlsson - Initial port for SymbianOS
- Claudio Matsuoka - Daily Linux builds
- Thomas Mayer - PSP port contributions
- Sean Murray - ScummVM tools GUI application (GSoC 2007 task)
- n0p - Windows CE port aspect ratio correction scaler
- and right click input method
- Mikesch Nepomuk - MI1 VGA floppy patches
- Nicolas Noble - Config file and ALSA support
- Tim Phillips - Initial MI1 CD music support
- Quietust - Sound support for Amiga SCUMM V2/V3 games, MM
- NES support
- Robert Crossfield - Improved support for Apple II/C64 versions of MM
- Andreas Roever - Broken Sword I & II MPEG2 cutscene support
- Edward Rudd - Fixes for playing MP3 versions of MI1/Loom audio
- Daniel Schepler - Final MI1 CD music support, initial Ogg Vorbis
- support
- Andre Souza - SDL-based OpenGL renderer
- Tom Frost - WebOS port contributions
+ Ori Avtalion - Subtitle control options in the GUI; BASS GUI
+ fixes
+ Stuart Caie - Decoders for Amiga and AtariST data files
+ (AGOS engine)
+ Paolo Costabel - PSP port contributions
+ Martin Doucha - CinE engine objectification
+ Thomas Fach-Pedersen - ProTracker module player, Smacker video
+ decoder
+ Tobias Gunkel - Sound support for C64 version of MM/Zak, Loom
+ PCE support
+ Janne Huttunen - V3 actor mask support, Dig/FT SMUSH audio
+ Kovacs Endre Janos - Several fixes for Simon1
+ Jeroen Janssen - Numerous readability and bugfix patches
+ Andreas Karlsson - Initial port for SymbianOS
+ Claudio Matsuoka - Daily Linux builds
+ Thomas Mayer - PSP port contributions
+ Sean Murray - ScummVM tools GUI application (GSoC 2007 task)
+ n0p - Windows CE port aspect ratio correction scaler
+ and right click input method
+ Mikesch Nepomuk - MI1 VGA floppy patches
+ Nicolas Noble - Config file and ALSA support
+ Tim Phillips - Initial MI1 CD music support
+ Quietust - Sound support for Amiga SCUMM V2/V3 games, MM
+ NES support
+ Robert Crossfield - Improved support for Apple II/C64 versions of
+ MM
+ Andreas Roever - Broken Sword I & II MPEG2 cutscene support
+ Edward Rudd - Fixes for playing MP3 versions of MI1/Loom
+ audio
+ Daniel Schepler - Final MI1 CD music support, initial Ogg Vorbis
+ support
+ Andre Souza - SDL-based OpenGL renderer
+ Tom Frost - WebOS port contributions
FreeSCI Contributors
--------------------
- Francois-R Boyer - MT-32 information and mapping code
- Rainer Canavan - IRIX MIDI driver and bug fixes
+ Francois-R Boyer - MT-32 information and mapping code
+ Rainer Canavan - IRIX MIDI driver and bug fixes
Xiaojun Chen
- Paul David Doherty - Game version information
- Vyacheslav Dikonov - Config script improvements
- Ruediger Hanke - Port to the MorphOS platform
- Matt Hargett - Clean-ups, bugfixes, Hardcore QA, Win32
- Max Horn - SetJump implementation
- Ravi I. - SCI0 sound resource specification
- Emmanuel Jeandel - Bugfixes and bug reports
- Dmitry Jemerov - Port to the Win32 platform, numerous bugfixes
- Chris Kehler - Makefile enhancements
- Christopher T. Lansdo - Original CVS maintainer, Alpha compatibility
- fixes
- Sergey Lapin - Port of Carl's type 2 decompression code
- Rickard Lind - MT-32->GM MIDI mapping magic, sound research
- Hubert Maier - AmigaOS 4 port
- Johannes Manhave - Document format translation
- Claudio Matsuoka - CVS snapshots, daily builds, BeOS and cygwin
- ports
- Dark Minister - SCI research (bytecode and parser)
- Carl Muckenhoupt - Sources to the SCI resource viewer tools that
- started it all
- Anders Baden Nielsen - PPC testing
- Walter van Niftrik - Ports to the Dreamcast and GP32 platforms
- Rune Orsval - Configuration file editor
- Solomon Peachy - SDL ports and much of the sound subsystem
- Robey Pointer - Bug tracking system hosting
- Magnus Reftel - Heap implementation, Python class viewer,
- bugfixes
- Christoph Reichenbach - UN*X code, VM/Graphics/Sound/other
- infrastructure
- George Reid - FreeBSD package management
- Lars Skovlund - Project maintenance, most documentation,
- bugfixes, SCI1 support
- Rink Springer - Port to the DOS platform, several bug fixes
- Rainer De Temple - SCI research
+ Paul David Doherty - Game version information
+ Vyacheslav Dikonov - Config script improvements
+ Ruediger Hanke - Port to the MorphOS platform
+ Matt Hargett - Clean-ups, bugfixes, Hardcore QA, Win32
+ Max Horn - SetJump implementation
+ Ravi I. - SCI0 sound resource specification
+ Emmanuel Jeandel - Bugfixes and bug reports
+ Dmitry Jemerov - Port to the Win32 platform, numerous bugfixes
+ Chris Kehler - Makefile enhancements
+ Christopher T. Lansdown - Original CVS maintainer, Alpha compatibility
+ fixes
+ Sergey Lapin - Port of Carl's type 2 decompression code
+ Rickard Lind - MT-32->GM MIDI mapping magic, sound research
+ Hubert Maier - AmigaOS 4 port
+ Johannes Manhave - Document format translation
+ Claudio Matsuoka - CVS snapshots, daily builds, BeOS and cygwin
+ ports
+ Dark Minister - SCI research (bytecode and parser)
+ Carl Muckenhoupt - Sources to the SCI resource viewer tools that
+ started it all
+ Anders Baden Nielsen - PPC testing
+ Walter van Niftrik - Ports to the Dreamcast and GP32 platforms
+ Rune Orsval - Configuration file editor
+ Solomon Peachy - SDL ports and much of the sound subsystem
+ Robey Pointer - Bug tracking system hosting
+ Magnus Reftel - Heap implementation, Python class viewer,
+ bugfixes
+ Christoph Reichenbach - UN*X code, VM/Graphics/Sound/other
+ infrastructure
+ George Reid - FreeBSD package management
+ Lars Skovlund - Project maintenance, most documentation,
+ bugfixes, SCI1 support
+ Rink Springer - Port to the DOS platform, several bug fixes
+ Rainer De Temple - SCI research
Sean Terrell
- Hugues Valois - Game selection menu
- Jordi Vilalta - Numerous code and website clean-up patches
- Petr Vyhnak - The DCL-INFLATE algorithm, many Win32
- improvements
- Bas Zoetekouw - Man pages, debian package management, CVS
- maintenance
+ Hugues Valois - Game selection menu
+ Jordi Vilalta - Numerous code and website clean-up patches
+ Petr Vyhnak - The DCL-INFLATE algorithm, many Win32
+ improvements
+ Bas Zoetekouw - Man pages, debian package management, CVS
+ maintenance
Special thanks to Prof. Dr. Gary Nutt for allowing the FreeSCI VM
extension as a course project in his Advanced OS course.
@@ -538,28 +564,27 @@ 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
- Curt Coder - For the original TrollVM (preAGI) code
- Patrick Combet - For the original Gobliiins ADL player
- Ivan Dubrov - For contributing the initial version of the Gobliiins
- engine
- Henrik Engqvist - For generously providing hosting for our buildbot, SVN
- repository, planet and doxygen sites as well as tons of
- HD space
- DOSBox Team - For their awesome OPL2 and OPL3 emulator
- Till Kresslein - For design of modern ScummVM GUI
- Jezar - For his freeverb filter implementation
- Jim Leiterman - Various info on his FM-TOWNS/Marty SCUMM ports
- lloyd - For deep tech details about C64 Zak & MM
- Sarien Team - Original AGI engine code
- Jimmi Thogersen - For ScummRev, and much obscure code/documentation
- Tristan - For additional work on the original MT-32 emulator
- James Woodcock - Soundtrack enhancements
-
- Some icons by Yusuke Kamiyamane
+ 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
+ Curt Coder - For the original TrollVM (preAGI) code
+ Patrick Combet - For the original Gobliiins ADL player
+ Ivan Dubrov - For contributing the initial version of the Gobliiins
+ engine
+ Henrik Engqvist - For generously providing hosting for our buildbot, SVN
+ repository, planet and doxygen sites as well as tons
+ of HD space
+ DOSBox Team - For their awesome OPL2 and OPL3 emulator
+ Yusuke Kamiyamane - For contributing some GUI icons
+ Till Kresslein - For design of modern ScummVM GUI
+ Jezar - For his freeverb filter implementation
+ Jim Leiterman - Various info on his FM-TOWNS/Marty SCUMM ports
+ lloyd - For deep tech details about C64 Zak & MM
+ Sarien Team - Original AGI engine code
+ Jimmi Thogersen - For ScummRev, and much obscure code/documentation
+ Tristan - For additional work on the original MT-32 emulator
+ James Woodcock - Soundtrack enhancements
Tony Warriner and everyone at Revolution Software Ltd. for sharing with us
the source of some of their brilliant games, allowing us to release
@@ -594,3 +619,16 @@ Special thanks to
Broken Sword 2.5 team for providing sources of their engine and their
great support.
+ Neil Dodwell and David Dew from Creative Reality for providing the source
+ of Dreamweb and for their tremendous support.
+
+ Janusz Wisniewski and Miroslaw Liminowicz from Laboratorium Komputerowe
+ Avalon for providing full source code for Soltys and letting us
+ redistribute the game.
+
+ Jan Nedoma for providing the sources to the Wintermute-engine, and for his
+ support while porting the engine to ScummVM.
+
+ Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for providing
+ the source code of The Journeyman Project: Pegasus Prime.
+
diff --git a/Makefile b/Makefile
index a40ef62c53..28eaead4b4 100644
--- a/Makefile
+++ b/Makefile
@@ -75,7 +75,7 @@ EXECUTABLE := $(EXEPRE)scummvm$(EXEEXT)
include $(srcdir)/Makefile.common
# check if configure has been run or has been changed since last run
-config.h config.mk: $(srcdir)/configure
+config.h config.mk: $(srcdir)/configure $(srcdir)/engines/configure.engines
ifeq "$(findstring config.mk,$(MAKEFILE_LIST))" "config.mk"
@echo "Running $(srcdir)/configure with the last specified parameters"
@sleep 2
diff --git a/NEWS b/NEWS
index 9eab69b715..923844e32c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,38 @@
For a more comprehensive changelog of the latest experimental code, see:
https://github.com/scummvm/scummvm/commits/
-1.5.0 (????-??-??)
+1.6.0 (????-??-??)
+ General:
+ - Added a new save/load chooser based on a grid of thumbnails. This is only
+ supported for resolutions bigger than 640x400. The old chooser is still
+ available and used for games without thumbnail support. It is possible to
+ select the old one as default too.
+ - Rewrote VideoDecoder subsystem.
+ - Added Galician translation.
+
+ Cine:
+ - Improved audio support for Amiga and AtariST versions of Future Wars.
+ Now music fades out slowly instead of stopping immediately. Sound
+ effects are now properly panned, when requested by the game.
+
+ SCUMM:
+ - Implemented Monkey Island 2 Macintosh's audio driver. Now we properly
+ support its sample based audio output. The same output is also used for
+ the m68k Macintosh version of Indiana Jones and the Fate of Atlantis.
+
+1.5.0 (2012-07-27)
New Games:
+ - Added support for Backyard Baseball 2003.
+ - Added support for Blue Force.
+ - Added support for Darby the Dragon.
+ - Added support for Dreamweb.
+ - Added support for Geisha.
+ - Added support for Gregory and the Hot Air Balloon.
+ - Added support for Magic Tales: Liam Finds a Story.
+ - Added support for Once Upon A Time: Little Red Riding Hood
+ - Added support for Sleeping Cub's Test of Courage.
- Added support for Soltys.
+ - Added support for The Princess and the Crab.
General:
- Updated MT-32 emulation code to latest munt project snapshot. The emulation
@@ -11,13 +40,19 @@ For a more comprehensive changelog of the latest experimental code, see:
- 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).
+ - Added Basque translation.
+ - Added custom game and engine options in the AGI, DREAMWEB, KYRA, QUEEN,
+ SKY and SCI engines. It is now possible to toggle these options via the
+ Engine tab when adding or editing a configuration for a game. In most
+ cases, you will have to run each game once or readd them all in ScummVM's
+ launcher in order to get the custom options tab.
+ - Improved predictive dialog look.
+ - Various GUI improvements.
Broken Sword 1:
- Fixed incorrect sound effects in the DOS/Windows demo.
- Added support for PlayStation videos.
+ - Fixed missing subtitles in the demo.
Broken Sword 2:
- Added support for PlayStation videos.
@@ -25,9 +60,19 @@ For a more comprehensive changelog of the latest experimental code, see:
Cine:
- Implemented Roland MT-32 output driver.
+ Drascula:
+ - Added Spanish subtitles in the Von Braun cutscene (#3069981: no subtitles
+ in scene with "von Braun").
+
+ Gob:
+ - Fixed a crash in Lost in Time
+ - Rewrote the AdLib player. Enabled the now working MDY player in
+ Fascination and Geisha.
+
SCUMM:
- Added support for the Macintosh version of SPY Fox in Hold the Mustard.
- Added a difficulty selection dialog for Loom FM-TOWNS.
+ - Fixed graphical glitches in HE98 version of Pajama Sam's Lost & Found.
iPhone port:
- Changed "F5 (menu)" gesture to open up the global main menu instead.
@@ -36,6 +81,10 @@ For a more comprehensive changelog of the latest experimental code, see:
- Added aspect ratio correction feature.
- Implemented 16 bits per pixel support for games.
+ Maemo port:
+ - Added support for Nokia 770 running OS2008 HE.
+ - Added configurable keymap.
+
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
diff --git a/README b/README
index 82d5df3df6..bbca0ec0cd 100644
--- a/README
+++ b/README
@@ -56,6 +56,8 @@ Table of Contents:
* 7.8 Using compressed audio files (MP3, Ogg Vorbis, Flac)
* 7.9 Output sample rate
8.0) Configuration file
+ * 8.1 Recognized configuration keywords
+ * 8.2 Custom game options that can be toggled via the GUI
9.0) Compiling
@@ -233,13 +235,18 @@ AGOS Games by Adventuresoft/Horrorsoft:
The Feeble Files [feeble]
GOB Games by Coktel Vision:
+ Bambou le sauveur de la jungle [bambou]
Bargon Attack [bargon]
+ Fascination [fascination]
+ Geisha [geisha]
Gobliiins [gob1]
Gobliins 2 [gob2]
Goblins 3 [gob3]
Lost in Time [lostintime]
+ Once Upon A Time: Little Red Riding Hood [littlered]
The Bizarre Adventures of Woodruff
and the Schnibble [woodruff]
+ Urban Runner [urban]
Ween: The Prophecy [ween]
MADE Games by Activision:
@@ -270,6 +277,7 @@ Other Games:
SCUMM Games by Humongous Entertainment:
Backyard Baseball [baseball]
Backyard Baseball 2001 [baseball2001]
+ Backyard Baseball 2003 [baseball2003]
Backyard Football [football]
Big Thinkers First Grade [thinker1]
Big Thinkers Kindergarten [thinkerk]
@@ -340,7 +348,6 @@ these at your own risk, and please do not file bug reports about them.
If you want the latest updates on game compatibility, visit our web site
and view the compatibility chart.
- Backyard Baseball 2003 [baseball2003]
Backyard Football 2002 [football2002]
Backyard Soccer [soccer]
Backyard Soccer MLS [soccermls]
@@ -1994,6 +2001,9 @@ An example config file looks as follows:
path=C:\amiga_mi2\
music_driver=windows
+
+8.1) Recognized configuration keywords
+---- ---------------------------------
The following keywords are recognized:
path string The path to where a game's data files are
@@ -2019,7 +2029,6 @@ The following keywords are recognized:
fullscreen bool Fullscreen mode
aspect_ratio bool Enable aspect ratio correction
- disable_dithering bool Remove dithering artifacts from EGA games
gfx_mode string Graphics mode (normal, 2x, 3x, 2xsai,
super2xsai, supereagle, advmame2x, advmame3x,
hq2x, hq3x, tv2x, dotmatrix)
@@ -2062,6 +2071,22 @@ The following keywords are recognized:
boot_param number Pass this number to the boot script
+Sierra games using the AGI engine add the following non-standard keywords:
+
+ originalsaveload bool If true, the original save/load screens are
+ used instead of the enhanced ScummVM ones
+
+Sierra games using the SCI engine add the following non-standard keywords:
+
+ disable_dithering bool Remove dithering artifacts from EGA games
+ prefer_digitalsfx bool If true, digital sound effects are preferred
+ instead of synthesized ones
+ originalsaveload bool If true, the original save/load screens are
+ used instead of the enhanced ScummVM ones
+ native_fb01 bool If true, the music driver for an IBM Music
+ Feature card or a Yamaha FB-01 FM synth module
+ is used for MIDI output
+
Broken Sword II adds the following non-standard keywords:
gfx_details number Graphics details setting (0-3)
@@ -2075,6 +2100,11 @@ Flight of the Amazon Queen adds the following non-standard keywords:
music_mute bool If true, music is muted
sfx_mute bool If true, sound effects are muted
+Jones in the Fast Lane adds the following non-standard keyword:
+
+ music_mute bool If true, CD audio is used, if available,
+ instead of in-game audio
+
King's Quest VI Windows adds the following non-standard keyword:
windows_cursors bool If true, the original unscaled black and white
@@ -2083,10 +2113,19 @@ King's Quest VI Windows adds the following non-standard keyword:
Windows version, upscaled to match the rest of
the upscaled graphics
+Lands of Lore: The Throne of Chaos adds the following non-standard keywords:
+
+ smooth_scrolling bool If true, scrolling is smoother when changing
+ from one screen to another
+ floating_cursors bool If true, the cursor changes when it floats to
+ the edge of the screen to a directional arrow.
+ The player can then click to walk towards that
+ direction.
+
Space Quest IV CD adds the following non-standard keyword:
silver_cursors bool If true, an alternate set of silver mouse cursors
- is used instead of the original golden ones
+ is used instead of the original golden ones
Simon the Sorcerer 1 and 2 add the following non-standard keywords:
@@ -2097,11 +2136,29 @@ The Legend of Kyrandia adds the following non-standard keyword:
walkspeed int The walk speed (0-4)
+The Legend of Kyrandia: Malcolm's Revenge adds the following non-standard
+keywords:
+
+ studio_audience bool If true, applause and cheering sounds are heard
+ whenever Malcolm makes a joke
+ skip_support bool If true, the player can skip text and cutscenes
+ helium_mode bool If true, people sound like they've inhaled Helium
+
The 7th Guest adds the following non-standard keyword:
t7g_speed string Video playback speed (normal, tweaked, im_an_ios)
+8.2) Custom game options that can be toggled via the GUI
+---- ---------------------------------------------------
+A lot of the custom game options in the previous section can be toggled via the
+GUI. If a custom option is available for a specific game, a new tab called
+"Engine" will appear when adding or editing the configuration of that game.
+If the custom options are not shown, the games in question will need to be run
+once or readded in the ScummVM launcher's game list. This will update the
+configuration of each entry, allowing the custom options to be shown.
+
+
9.0) Compiling:
---- ----------
For an up-to-date overview on how to compile ScummVM for various
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 1c5c435359..2d65d4afef 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -386,4 +386,42 @@ Timestamp convertTimeToStreamPos(const Timestamp &where, int rate, bool isStereo
return Timestamp(result.secs(), result.numberOfFrames(), result.framerate());
}
+/**
+ * An AudioStream wrapper that cuts off the amount of samples read after a
+ * given time length is reached.
+ */
+class LimitingAudioStream : public AudioStream {
+public:
+ LimitingAudioStream(AudioStream *parentStream, const Audio::Timestamp &length, DisposeAfterUse::Flag disposeAfterUse) :
+ _parentStream(parentStream), _samplesRead(0), _disposeAfterUse(disposeAfterUse),
+ _totalSamples(length.convertToFramerate(getRate()).totalNumberOfFrames() * getChannels()) {}
+
+ ~LimitingAudioStream() {
+ if (_disposeAfterUse == DisposeAfterUse::YES)
+ delete _parentStream;
+ }
+
+ int readBuffer(int16 *buffer, const int numSamples) {
+ // Cap us off so we don't read past _totalSamples
+ int samplesRead = _parentStream->readBuffer(buffer, MIN<int>(numSamples, _totalSamples - _samplesRead));
+ _samplesRead += samplesRead;
+ return samplesRead;
+ }
+
+ bool endOfData() const { return _parentStream->endOfData() || _samplesRead >= _totalSamples; }
+ bool isStereo() const { return _parentStream->isStereo(); }
+ int getRate() const { return _parentStream->getRate(); }
+
+private:
+ int getChannels() const { return isStereo() ? 2 : 1; }
+
+ AudioStream *_parentStream;
+ DisposeAfterUse::Flag _disposeAfterUse;
+ uint32 _totalSamples, _samplesRead;
+};
+
+AudioStream *makeLimitingAudioStream(AudioStream *parentStream, const Timestamp &length, DisposeAfterUse::Flag disposeAfterUse) {
+ return new LimitingAudioStream(parentStream, length, disposeAfterUse);
+}
+
} // End of namespace Audio
diff --git a/audio/audiostream.h b/audio/audiostream.h
index 801f13d9d9..d6d4a16280 100644
--- a/audio/audiostream.h
+++ b/audio/audiostream.h
@@ -356,6 +356,16 @@ QueuingAudioStream *makeQueuingAudioStream(int rate, bool stereo);
*/
Timestamp convertTimeToStreamPos(const Timestamp &where, int rate, bool isStereo);
+/**
+ * Factory function for an AudioStream wrapper that cuts off the amount of samples read after a
+ * given time length is reached.
+ *
+ * @param parentStream The stream to limit
+ * @param length The time length to limit the stream to
+ * @param disposeAfterUse Whether the parent stream object should be destroyed on destruction of the returned stream
+ */
+AudioStream *makeLimitingAudioStream(AudioStream *parentStream, const Timestamp &length, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
+
} // End of namespace Audio
#endif
diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp
index 535652a0b3..2fe509e1f3 100644
--- a/audio/decoders/adpcm.cpp
+++ b/audio/decoders/adpcm.cpp
@@ -71,13 +71,19 @@ int Oki_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
int samples;
byte data;
- assert(numSamples % 2 == 0);
+ for (samples = 0; samples < numSamples && !endOfData(); samples++) {
+ if (_decodedSampleCount == 0) {
+ data = _stream->readByte();
+ _decodedSamples[0] = decodeOKI((data >> 4) & 0x0f);
+ _decodedSamples[1] = decodeOKI((data >> 0) & 0x0f);
+ _decodedSampleCount = 2;
+ }
- for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
- data = _stream->readByte();
- buffer[samples] = decodeOKI((data >> 4) & 0x0f);
- buffer[samples + 1] = decodeOKI(data & 0x0f);
+ // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2
+ buffer[samples] = _decodedSamples[1 - (_decodedSampleCount - 1)];
+ _decodedSampleCount--;
}
+
return samples;
}
@@ -117,13 +123,19 @@ int DVI_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
int samples;
byte data;
- assert(numSamples % 2 == 0);
+ for (samples = 0; samples < numSamples && !endOfData(); samples++) {
+ if (_decodedSampleCount == 0) {
+ data = _stream->readByte();
+ _decodedSamples[0] = decodeIMA((data >> 4) & 0x0f, 0);
+ _decodedSamples[1] = decodeIMA((data >> 0) & 0x0f, _channels == 2 ? 1 : 0);
+ _decodedSampleCount = 2;
+ }
- for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
- data = _stream->readByte();
- buffer[samples] = decodeIMA((data >> 4) & 0x0f);
- buffer[samples + 1] = decodeIMA(data & 0x0f, _channels == 2 ? 1 : 0);
+ // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2
+ buffer[samples] = _decodedSamples[1 - (_decodedSampleCount - 1)];
+ _decodedSampleCount--;
}
+
return samples;
}
diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h
index 31747aabaf..3b8d8c74d0 100644
--- a/audio/decoders/adpcm_intern.h
+++ b/audio/decoders/adpcm_intern.h
@@ -37,7 +37,6 @@
#include "common/stream.h"
#include "common/textconsole.h"
-
namespace Audio {
class ADPCMStream : public RewindableAudioStream {
@@ -64,12 +63,11 @@ public:
ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign);
virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos); }
- virtual bool isStereo() const { return _channels == 2; }
- virtual int getRate() const { return _rate; }
+ virtual bool isStereo() const { return _channels == 2; }
+ virtual int getRate() const { return _rate; }
virtual bool rewind();
-
/**
* This table is used by some ADPCM variants (IMA and OKI) to adjust the
* step for use on the next sample.
@@ -83,12 +81,18 @@ public:
class Oki_ADPCMStream : public ADPCMStream {
public:
Oki_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
- : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
+ : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { _decodedSampleCount = 0; }
+
+ virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); }
virtual int readBuffer(int16 *buffer, const int numSamples);
protected:
int16 decodeOKI(byte);
+
+private:
+ uint8 _decodedSampleCount;
+ int16 _decodedSamples[2];
};
class Ima_ADPCMStream : public ADPCMStream {
@@ -108,9 +112,15 @@ public:
class DVI_ADPCMStream : public Ima_ADPCMStream {
public:
DVI_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
- : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
+ : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { _decodedSampleCount = 0; }
+
+ virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); }
virtual int readBuffer(int16 *buffer, const int numSamples);
+
+private:
+ uint8 _decodedSampleCount;
+ int16 _decodedSamples[2];
};
class Apple_ADPCMStream : public Ima_ADPCMStream {
diff --git a/audio/decoders/aiff.h b/audio/decoders/aiff.h
index 59664bb85a..afcdb6ae6c 100644
--- a/audio/decoders/aiff.h
+++ b/audio/decoders/aiff.h
@@ -23,6 +23,7 @@
/**
* @file
* Sound decoder used in engines:
+ * - pegasus
* - saga
* - sci
* - sword1
diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp
index 735fb2b6a0..732de311aa 100644
--- a/audio/decoders/qdm2.cpp
+++ b/audio/decoders/qdm2.cpp
@@ -35,7 +35,10 @@
#include "common/array.h"
#include "common/debug.h"
#include "common/math.h"
+#include "common/rdft.h"
#include "common/stream.h"
+#include "common/memstream.h"
+#include "common/bitstream.h"
#include "common/textconsole.h"
namespace Audio {
@@ -50,14 +53,6 @@ enum {
typedef int8 sb_int8_array[2][30][64];
-/* bit input */
-/* buffer, buffer_end and size_in_bits must be present and used by every reader */
-struct GetBitContext {
- const uint8 *buffer, *bufferEnd;
- int index;
- int sizeInBits;
-};
-
struct QDM2SubPacket {
int type;
unsigned int size;
@@ -106,53 +101,6 @@ struct QDM2FFT {
} PACKED_STRUCT;
#include "common/pack-end.h"
-enum RDFTransformType {
- RDFT,
- IRDFT,
- RIDFT,
- IRIDFT
-};
-
-struct FFTComplex {
- float re, im;
-};
-
-struct FFTContext {
- int nbits;
- int inverse;
- uint16 *revtab;
- FFTComplex *exptab;
- FFTComplex *tmpBuf;
- int mdctSize; // size of MDCT (i.e. number of input data * 2)
- int mdctBits; // n = 2^nbits
- // pre/post rotation tables
- float *tcos;
- float *tsin;
- void (*fftPermute)(struct FFTContext *s, FFTComplex *z);
- void (*fftCalc)(struct FFTContext *s, FFTComplex *z);
- void (*imdctCalc)(struct FFTContext *s, float *output, const float *input);
- void (*imdctHalf)(struct FFTContext *s, float *output, const float *input);
- void (*mdctCalc)(struct FFTContext *s, float *output, const float *input);
- int splitRadix;
- int permutation;
-};
-
-enum {
- FF_MDCT_PERM_NONE = 0,
- FF_MDCT_PERM_INTERLEAVE = 1
-};
-
-struct RDFTContext {
- int nbits;
- int inverse;
- int signConvention;
-
- // pre/post rotation tables
- float *tcos;
- float *tsin;
- FFTContext fft;
-};
-
class QDM2Stream : public Codec {
public:
QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::Flag disposeExtraData);
@@ -196,7 +144,7 @@ private:
int _fftCoefsMinIndex[5];
int _fftCoefsMaxIndex[5];
int _fftLevelExp[6];
- RDFTContext _rdftCtx;
+ Common::RDFT *_rdft;
QDM2FFT _fft;
// I/O data
@@ -265,9 +213,9 @@ private:
void fill_coding_method_array(sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp,
sb_int8_array coding_method, int nb_channels,
int c, int superblocktype_2_3, int cm_table_select);
- void synthfilt_build_sb_samples(GetBitContext *gb, int length, int sb_min, int sb_max);
- void init_quantized_coeffs_elem0(int8 *quantized_coeffs, GetBitContext *gb, int length);
- void init_tone_level_dequantization(GetBitContext *gb, int length);
+ void synthfilt_build_sb_samples(Common::BitStream *gb, int length, int sb_min, int sb_max);
+ void init_quantized_coeffs_elem0(int8 *quantized_coeffs, Common::BitStream *gb, int length);
+ void init_tone_level_dequantization(Common::BitStream *gb, int length);
void process_subpacket_9(QDM2SubPNode *node);
void process_subpacket_10(QDM2SubPNode *node, int length);
void process_subpacket_11(QDM2SubPNode *node, int length);
@@ -276,7 +224,7 @@ private:
void qdm2_decode_super_block(void);
void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration,
int channel, int exp, int phase);
- void qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b);
+ void qdm2_fft_decode_tones(int duration, Common::BitStream *gb, int b);
void qdm2_decode_fft_packets(void);
void qdm2_fft_generate_tone(FFTTone *tone);
void qdm2_fft_tone_synthesizer(uint8 sub_packet);
@@ -308,560 +256,6 @@ typedef signed long long int int64_t;
#define SB_DITHERING_NOISE(sb, noiseIdx) (_noiseTable[(noiseIdx)++] * sb_noise_attenuation[(sb)])
-static inline void initGetBits(GetBitContext *s, const uint8 *buffer, int bitSize) {
- int bufferSize = (bitSize + 7) >> 3;
-
- if (bufferSize < 0 || bitSize < 0) {
- bufferSize = bitSize = 0;
- buffer = NULL;
- }
-
- s->buffer = buffer;
- s->sizeInBits = bitSize;
- s->bufferEnd = buffer + bufferSize;
- s->index = 0;
-}
-
-static inline int getBitsCount(GetBitContext *s) {
- return s->index;
-}
-
-static inline unsigned int getBits1(GetBitContext *s) {
- int index;
- uint8 result;
-
- index = s->index;
- result = s->buffer[index >> 3];
-
- result >>= (index & 0x07);
- result &= 1;
- index++;
- s->index = index;
-
- return result;
-}
-
-static inline unsigned int getBits(GetBitContext *s, int n) {
- int tmp, reCache, reIndex;
-
- reIndex = s->index;
-
- reCache = READ_LE_UINT32((const uint8 *)s->buffer + (reIndex >> 3)) >> (reIndex & 0x07);
-
- tmp = (reCache) & ((uint32)0xffffffff >> (32 - n));
-
- s->index = reIndex + n;
-
- return tmp;
-}
-
-static inline void skipBits(GetBitContext *s, int n) {
- s->index += n;
-}
-
-#define BITS_LEFT(length, gb) ((length) - getBitsCount((gb)))
-
-static int splitRadixPermutation(int i, int n, int inverse) {
- if (n <= 2)
- return i & 1;
-
- int m = n >> 1;
-
- if(!(i & m))
- return splitRadixPermutation(i, m, inverse) * 2;
-
- m >>= 1;
-
- if (inverse == !(i & m))
- return splitRadixPermutation(i, m, inverse) * 4 + 1;
-
- return splitRadixPermutation(i, m, inverse) * 4 - 1;
-}
-
-// sin(2*pi*x/n) for 0<=x<n/4, followed by n/2<=x<3n/4
-float ff_sin_16[8];
-float ff_sin_32[16];
-float ff_sin_64[32];
-float ff_sin_128[64];
-float ff_sin_256[128];
-float ff_sin_512[256];
-float ff_sin_1024[512];
-float ff_sin_2048[1024];
-float ff_sin_4096[2048];
-float ff_sin_8192[4096];
-float ff_sin_16384[8192];
-float ff_sin_32768[16384];
-float ff_sin_65536[32768];
-
-float *ff_sin_tabs[] = {
- NULL, NULL, NULL, NULL,
- ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024,
- ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
-};
-
-// cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse
-float ff_cos_16[8];
-float ff_cos_32[16];
-float ff_cos_64[32];
-float ff_cos_128[64];
-float ff_cos_256[128];
-float ff_cos_512[256];
-float ff_cos_1024[512];
-float ff_cos_2048[1024];
-float ff_cos_4096[2048];
-float ff_cos_8192[4096];
-float ff_cos_16384[8192];
-float ff_cos_32768[16384];
-float ff_cos_65536[32768];
-
-float *ff_cos_tabs[] = {
- NULL, NULL, NULL, NULL,
- ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
- ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
-};
-
-void initCosineTables(int index) {
- int m = 1 << index;
- double freq = 2 * M_PI / m;
- float *tab = ff_cos_tabs[index];
-
- for (int i = 0; i <= m / 4; i++)
- tab[i] = cos(i * freq);
-
- for (int i = 1; i < m / 4; i++)
- tab[m / 2 - i] = tab[i];
-}
-
-void fftPermute(FFTContext *s, FFTComplex *z) {
- const uint16 *revtab = s->revtab;
- int np = 1 << s->nbits;
-
- if (s->tmpBuf) {
- // TODO: handle split-radix permute in a more optimal way, probably in-place
- for (int j = 0; j < np; j++)
- s->tmpBuf[revtab[j]] = z[j];
- memcpy(z, s->tmpBuf, np * sizeof(FFTComplex));
- return;
- }
-
- // reverse
- for (int j = 0; j < np; j++) {
- int k = revtab[j];
- if (k < j) {
- FFTComplex tmp = z[k];
- z[k] = z[j];
- z[j] = tmp;
- }
- }
-}
-
-#define DECL_FFT(n,n2,n4) \
-static void fft##n(FFTComplex *z) { \
- fft##n2(z); \
- fft##n4(z + n4 * 2); \
- fft##n4(z + n4 * 3); \
- pass(z, ff_cos_##n, n4 / 2); \
-}
-
-#ifndef M_SQRT1_2
-#define M_SQRT1_2 7.0710678118654752440E-1
-#endif
-
-#define sqrthalf (float)M_SQRT1_2
-
-#define BF(x,y,a,b) { \
- x = a - b; \
- y = a + b; \
-}
-
-#define BUTTERFLIES(a0, a1, a2, a3) { \
- BF(t3, t5, t5, t1); \
- BF(a2.re, a0.re, a0.re, t5); \
- BF(a3.im, a1.im, a1.im, t3); \
- BF(t4, t6, t2, t6); \
- BF(a3.re, a1.re, a1.re, t4); \
- BF(a2.im, a0.im, a0.im, t6); \
-}
-
-// force loading all the inputs before storing any.
-// this is slightly slower for small data, but avoids store->load aliasing
-// for addresses separated by large powers of 2.
-#define BUTTERFLIES_BIG(a0, a1, a2, a3) { \
- float r0 = a0.re, i0 = a0.im, r1 = a1.re, i1 = a1.im; \
- BF(t3, t5, t5, t1); \
- BF(a2.re, a0.re, r0, t5); \
- BF(a3.im, a1.im, i1, t3); \
- BF(t4, t6, t2, t6); \
- BF(a3.re, a1.re, r1, t4); \
- BF(a2.im, a0.im, i0, t6); \
-}
-
-#define TRANSFORM(a0, a1, a2, a3, wre, wim) { \
- t1 = a2.re * wre + a2.im * wim; \
- t2 = a2.im * wre - a2.re * wim; \
- t5 = a3.re * wre - a3.im * wim; \
- t6 = a3.im * wre + a3.re * wim; \
- BUTTERFLIES(a0, a1, a2, a3) \
-}
-
-#define TRANSFORM_ZERO(a0, a1, a2, a3) { \
- t1 = a2.re; \
- t2 = a2.im; \
- t5 = a3.re; \
- t6 = a3.im; \
- BUTTERFLIES(a0, a1, a2, a3) \
-}
-
-// z[0...8n-1], w[1...2n-1]
-#define PASS(name) \
-static void name(FFTComplex *z, const float *wre, unsigned int n) { \
- float t1, t2, t3, t4, t5, t6; \
- int o1 = 2 * n; \
- int o2 = 4 * n; \
- int o3 = 6 * n; \
- const float *wim = wre + o1; \
- n--; \
- \
- TRANSFORM_ZERO(z[0], z[o1], z[o2], z[o3]); \
- TRANSFORM(z[1], z[o1 + 1], z[o2 + 1], z[o3 + 1], wre[1], wim[-1]); \
- \
- do { \
- z += 2; \
- wre += 2; \
- wim -= 2; \
- TRANSFORM(z[0], z[o1], z[o2], z[o3], wre[0], wim[0]); \
- TRANSFORM(z[1], z[o1 + 1],z[o2 + 1], z[o3 + 1], wre[1], wim[-1]); \
- } while(--n); \
-}
-
-PASS(pass)
-#undef BUTTERFLIES
-#define BUTTERFLIES BUTTERFLIES_BIG
-PASS(pass_big)
-
-static void fft4(FFTComplex *z) {
- float t1, t2, t3, t4, t5, t6, t7, t8;
-
- BF(t3, t1, z[0].re, z[1].re);
- BF(t8, t6, z[3].re, z[2].re);
- BF(z[2].re, z[0].re, t1, t6);
- BF(t4, t2, z[0].im, z[1].im);
- BF(t7, t5, z[2].im, z[3].im);
- BF(z[3].im, z[1].im, t4, t8);
- BF(z[3].re, z[1].re, t3, t7);
- BF(z[2].im, z[0].im, t2, t5);
-}
-
-static void fft8(FFTComplex *z) {
- float t1, t2, t3, t4, t5, t6, t7, t8;
-
- fft4(z);
-
- BF(t1, z[5].re, z[4].re, -z[5].re);
- BF(t2, z[5].im, z[4].im, -z[5].im);
- BF(t3, z[7].re, z[6].re, -z[7].re);
- BF(t4, z[7].im, z[6].im, -z[7].im);
- BF(t8, t1, t3, t1);
- BF(t7, t2, t2, t4);
- BF(z[4].re, z[0].re, z[0].re, t1);
- BF(z[4].im, z[0].im, z[0].im, t2);
- BF(z[6].re, z[2].re, z[2].re, t7);
- BF(z[6].im, z[2].im, z[2].im, t8);
-
- TRANSFORM(z[1], z[3], z[5], z[7], sqrthalf, sqrthalf);
-}
-
-#undef BF
-
-DECL_FFT(16,8,4)
-DECL_FFT(32,16,8)
-DECL_FFT(64,32,16)
-DECL_FFT(128,64,32)
-DECL_FFT(256,128,64)
-DECL_FFT(512,256,128)
-#define pass pass_big
-DECL_FFT(1024,512,256)
-DECL_FFT(2048,1024,512)
-DECL_FFT(4096,2048,1024)
-DECL_FFT(8192,4096,2048)
-DECL_FFT(16384,8192,4096)
-DECL_FFT(32768,16384,8192)
-DECL_FFT(65536,32768,16384)
-
-void fftCalc(FFTContext *s, FFTComplex *z) {
- static void (* const fftDispatch[])(FFTComplex *) = {
- fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
- fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
- };
-
- fftDispatch[s->nbits - 2](z);
-}
-
-// complex multiplication: p = a * b
-#define CMUL(pre, pim, are, aim, bre, bim) \
-{\
- float _are = (are); \
- float _aim = (aim); \
- float _bre = (bre); \
- float _bim = (bim); \
- (pre) = _are * _bre - _aim * _bim; \
- (pim) = _are * _bim + _aim * _bre; \
-}
-
-/**
- * Compute the middle half of the inverse MDCT of size N = 2^nbits,
- * thus excluding the parts that can be derived by symmetry
- * @param output N/2 samples
- * @param input N/2 samples
- */
-void imdctHalfC(FFTContext *s, float *output, const float *input) {
- const uint16 *revtab = s->revtab;
- const float *tcos = s->tcos;
- const float *tsin = s->tsin;
- FFTComplex *z = (FFTComplex *)output;
-
- int n = 1 << s->mdctBits;
- int n2 = n >> 1;
- int n4 = n >> 2;
- int n8 = n >> 3;
-
- // pre rotation
- const float *in1 = input;
- const float *in2 = input + n2 - 1;
- for (int k = 0; k < n4; k++) {
- int j = revtab[k];
- CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]);
- in1 += 2;
- in2 -= 2;
- }
-
- fftCalc(s, z);
-
- // post rotation + reordering
- for (int k = 0; k < n8; k++) {
- float r0, i0, r1, i1;
- CMUL(r0, i1, z[n8 - k - 1].im, z[n8 - k - 1].re, tsin[n8 - k - 1], tcos[n8 - k - 1]);
- CMUL(r1, i0, z[n8 + k].im, z[n8 + k].re, tsin[n8 + k], tcos[n8 + k]);
- z[n8 - k - 1].re = r0;
- z[n8 - k - 1].im = i0;
- z[n8 + k].re = r1;
- z[n8 + k].im = i1;
- }
-}
-
-/**
- * Compute inverse MDCT of size N = 2^nbits
- * @param output N samples
- * @param input N/2 samples
- */
-void imdctCalcC(FFTContext *s, float *output, const float *input) {
- int n = 1 << s->mdctBits;
- int n2 = n >> 1;
- int n4 = n >> 2;
-
- imdctHalfC(s, output + n4, input);
-
- for (int k = 0; k < n4; k++) {
- output[k] = -output[n2 - k - 1];
- output[n - k - 1] = output[n2 + k];
- }
-}
-
-/**
- * Compute MDCT of size N = 2^nbits
- * @param input N samples
- * @param out N/2 samples
- */
-void mdctCalcC(FFTContext *s, float *out, const float *input) {
- const uint16 *revtab = s->revtab;
- const float *tcos = s->tcos;
- const float *tsin = s->tsin;
- FFTComplex *x = (FFTComplex *)out;
-
- int n = 1 << s->mdctBits;
- int n2 = n >> 1;
- int n4 = n >> 2;
- int n8 = n >> 3;
- int n3 = 3 * n4;
-
- // pre rotation
- for (int i = 0; i < n8; i++) {
- float re = -input[2 * i + 3 * n4] - input[n3 - 1 - 2 * i];
- float im = -input[n4 + 2 * i] + input[n4 - 1 - 2 * i];
- int j = revtab[i];
- CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
-
- re = input[2 * i] - input[n2 - 1 - 2 * i];
- im = -(input[n2 + 2 * i] + input[n - 1 - 2 * i]);
- j = revtab[n8 + i];
- CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
- }
-
- fftCalc(s, x);
-
- // post rotation
- for (int i = 0; i < n8; i++) {
- float r0, i0, r1, i1;
- CMUL(i1, r0, x[n8 - i - 1].re, x[n8 - i - 1].im, -tsin[n8 - i - 1], -tcos[n8 - i - 1]);
- CMUL(i0, r1, x[n8 + i].re, x[n8 + i].im, -tsin[n8 + i], -tcos[n8 + i]);
- x[n8 - i - 1].re = r0;
- x[n8 - i - 1].im = i0;
- x[n8 + i].re = r1;
- x[n8 + i].im = i1;
- }
-}
-
-int fftInit(FFTContext *s, int nbits, int inverse) {
- int i, j, m, n;
- float alpha, c1, s1, s2;
-
- if (nbits < 2 || nbits > 16)
- goto fail;
-
- s->nbits = nbits;
- n = 1 << nbits;
- s->tmpBuf = NULL;
-
- s->exptab = (FFTComplex *)malloc((n / 2) * sizeof(FFTComplex));
- if (!s->exptab)
- goto fail;
-
- s->revtab = (uint16 *)malloc(n * sizeof(uint16));
- if (!s->revtab)
- goto fail;
- s->inverse = inverse;
-
- s2 = inverse ? 1.0 : -1.0;
-
- s->fftPermute = fftPermute;
- s->fftCalc = fftCalc;
- s->imdctCalc = imdctCalcC;
- s->imdctHalf = imdctHalfC;
- s->mdctCalc = mdctCalcC;
- s->splitRadix = 1;
-
- if (s->splitRadix) {
- for (j = 4; j <= nbits; j++)
- initCosineTables(j);
-
- for (i = 0; i < n; i++)
- s->revtab[-splitRadixPermutation(i, n, s->inverse) & (n - 1)] = i;
-
- s->tmpBuf = (FFTComplex *)malloc(n * sizeof(FFTComplex));
- } else {
- for (i = 0; i < n / 2; i++) {
- alpha = 2 * M_PI * (float)i / (float)n;
- c1 = cos(alpha);
- s1 = sin(alpha) * s2;
- s->exptab[i].re = c1;
- s->exptab[i].im = s1;
- }
-
- //int np = 1 << nbits;
- //int nblocks = np >> 3;
- //int np2 = np >> 1;
-
- // compute bit reverse table
- for (i = 0; i < n; i++) {
- m = 0;
-
- for (j = 0; j < nbits; j++)
- m |= ((i >> j) & 1) << (nbits - j - 1);
-
- s->revtab[i] = m;
- }
- }
-
- return 0;
-
- fail:
- free(&s->revtab);
- free(&s->exptab);
- free(&s->tmpBuf);
- return -1;
-}
-
-/**
- * Sets up a real FFT.
- * @param nbits log2 of the length of the input array
- * @param trans the type of transform
- */
-int rdftInit(RDFTContext *s, int nbits, RDFTransformType trans) {
- int n = 1 << nbits;
- const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1) * 2 * M_PI / n;
-
- s->nbits = nbits;
- s->inverse = trans == IRDFT || trans == IRIDFT;
- s->signConvention = trans == RIDFT || trans == IRIDFT ? 1 : -1;
-
- if (nbits < 4 || nbits > 16)
- return -1;
-
- if (fftInit(&s->fft, nbits - 1, trans == IRDFT || trans == RIDFT) < 0)
- return -1;
-
- initCosineTables(nbits);
- s->tcos = ff_cos_tabs[nbits];
- s->tsin = ff_sin_tabs[nbits] + (trans == RDFT || trans == IRIDFT) * (n >> 2);
-
- for (int i = 0; i < n >> 2; i++)
- s->tsin[i] = sin(i*theta);
-
- return 0;
-}
-
-/** Map one real FFT into two parallel real even and odd FFTs. Then interleave
- * the two real FFTs into one complex FFT. Unmangle the results.
- * ref: http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM
- */
-void rdftCalc(RDFTContext *s, float *data) {
- FFTComplex ev, od;
-
- const int n = 1 << s->nbits;
- const float k1 = 0.5;
- const float k2 = 0.5 - s->inverse;
- const float *tcos = s->tcos;
- const float *tsin = s->tsin;
-
- if (!s->inverse) {
- fftPermute(&s->fft, (FFTComplex *)data);
- fftCalc(&s->fft, (FFTComplex *)data);
- }
-
- // i=0 is a special case because of packing, the DC term is real, so we
- // are going to throw the N/2 term (also real) in with it.
- ev.re = data[0];
- data[0] = ev.re + data[1];
- data[1] = ev.re - data[1];
-
- int i;
-
- for (i = 1; i < n >> 2; i++) {
- int i1 = i * 2;
- int i2 = n - i1;
-
- // Separate even and odd FFTs
- ev.re = k1 * (data[i1] + data[i2]);
- od.im = -k2 * (data[i1] - data[i2]);
- ev.im = k1 * (data[i1 + 1] - data[i2 + 1]);
- od.re = k2 * (data[i1 + 1] + data[i2 + 1]);
-
- // Apply twiddle factors to the odd FFT and add to the even FFT
- data[i1] = ev.re + od.re * tcos[i] - od.im * tsin[i];
- data[i1 + 1] = ev.im + od.im * tcos[i] + od.re * tsin[i];
- data[i2] = ev.re - od.re * tcos[i] + od.im * tsin[i];
- data[i2 + 1] = -ev.im + od.im * tcos[i] + od.re * tsin[i];
- }
-
- data[i * 2 + 1] = s->signConvention * data[i * 2 + 1];
- if (s->inverse) {
- data[0] *= k1;
- data[1] *= k1;
- fftPermute(&s->fft, (FFTComplex *)data);
- fftCalc(&s->fft, (FFTComplex *)data);
- }
-}
-
// half mpeg encoding window (full precision)
const int32 ff_mpa_enwindow[257] = {
0, -1, -1, -1, -1, -1, -1, -2,
@@ -1283,43 +677,27 @@ void ff_mpa_synth_filter(int16 *synth_buf_ptr, int *synth_buf_offset,
* read the longest vlc code
* = (max_vlc_length + bits - 1) / bits
*/
-static int getVlc2(GetBitContext *s, int16 (*table)[2], int bits, int maxDepth) {
- int reIndex;
- int reCache;
- int index;
- int code;
- int n;
-
- reIndex = s->index;
- reCache = READ_LE_UINT32(s->buffer + (reIndex >> 3)) >> (reIndex & 0x07);
- index = reCache & (0xffffffff >> (32 - bits));
- code = table[index][0];
- n = table[index][1];
-
- if (maxDepth > 1 && n < 0){
- reIndex += bits;
- reCache = READ_LE_UINT32(s->buffer + (reIndex >> 3)) >> (reIndex & 0x07);
+static int getVlc2(Common::BitStream *s, int16 (*table)[2], int bits, int maxDepth) {
+ int index = s->peekBits(bits);
+ int code = table[index][0];
+ int n = table[index][1];
+ if (maxDepth > 1 && n < 0) {
+ s->skip(bits);
int nbBits = -n;
-
- index = (reCache & (0xffffffff >> (32 - nbBits))) + code;
+ index = s->peekBits(-n) + code;
code = table[index][0];
n = table[index][1];
- if(maxDepth > 2 && n < 0) {
- reIndex += nbBits;
- reCache = READ_LE_UINT32(s->buffer + (reIndex >> 3)) >> (reIndex & 0x07);
-
- nbBits = -n;
-
- index = (reCache & (0xffffffff >> (32 - nbBits))) + code;
+ if (maxDepth > 2 && n < 0) {
+ s->skip(nbBits);
+ index = s->getBits(-n) + code;
code = table[index][0];
n = table[index][1];
}
}
- reCache >>= n;
- s->index = reIndex + n;
+ s->skip(n);
return code;
}
@@ -1483,9 +861,9 @@ void initVlcSparse(VLC *vlc, int nb_bits, int nb_codes,
const void *symbols, int symbols_wrap, int symbols_size) {
vlc->bits = nb_bits;
- if(vlc->table_size && vlc->table_size == vlc->table_allocated) {
+ if (vlc->table_size && vlc->table_size == vlc->table_allocated) {
return;
- } else if(vlc->table_size) {
+ } else if (vlc->table_size) {
error("called on a partially initialized table");
}
@@ -1695,7 +1073,6 @@ void QDM2Stream::initVlc(void) {
QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::Flag disposeExtraData) {
uint32 tmp;
- int32 tmp_s;
int tmp_val;
int i;
@@ -1736,91 +1113,44 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::F
_superblocktype_2_3 = 0;
_hasErrors = false;
- // Rewind extraData stream from any previous calls...
+ // The QDM2 "extra data" is really just an amalgam of three QuickTime
+ // atoms needed to correctly set up the decoder.
+
+ // Rewind extraData stream from any previous calls
extraData->seek(0, SEEK_SET);
- tmp_s = extraData->readSint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraSize: %d", tmp_s);
- if ((extraData->size() - extraData->pos()) / 4 + 1 != tmp_s)
- warning("QDM2Stream::QDM2Stream() extraSize mismatch - Expected %d", (extraData->size() - extraData->pos()) / 4 + 1);
- if (tmp_s < 12)
- error("QDM2Stream::QDM2Stream() Insufficient extraData");
-
- tmp = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraTag: %d", tmp);
- if (tmp != MKTAG('f','r','m','a'))
- warning("QDM2Stream::QDM2Stream() extraTag mismatch");
-
- tmp = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraType: %d", tmp);
- if (tmp == MKTAG('Q','D','M','C'))
- warning("QDM2Stream::QDM2Stream() QDMC stream type not supported");
- else if (tmp != MKTAG('Q','D','M','2'))
- error("QDM2Stream::QDM2Stream() Unsupported stream type");
-
- tmp_s = extraData->readSint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraSize2: %d", tmp_s);
- if ((extraData->size() - extraData->pos()) + 4 != tmp_s)
- warning("QDM2Stream::QDM2Stream() extraSize2 mismatch - Expected %d", (extraData->size() - extraData->pos()) + 4);
-
- tmp = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraTag2: %d", tmp);
- if (tmp != MKTAG('Q','D','C','A'))
- warning("QDM2Stream::QDM2Stream() extraTag2 mismatch");
-
- if (extraData->readUint32BE() != 1)
- warning("QDM2Stream::QDM2Stream() u0 field not 1");
+ // First, the frma atom
+ uint32 frmaSize = extraData->readUint32BE();
+ if (frmaSize != 12)
+ error("Invalid QDM2 frma atom");
- _channels = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() channels: %d", _channels);
+ if (extraData->readUint32BE() != MKTAG('f', 'r', 'm', 'a'))
+ error("Failed to find frma atom for QDM2");
- _sampleRate = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() sampleRate: %d", _sampleRate);
+ uint32 version = extraData->readUint32BE();
+ if (version == MKTAG('Q', 'D', 'M', 'C'))
+ error("Unhandled QDMC sound");
+ else if (version != MKTAG('Q', 'D', 'M', '2'))
+ error("Failed to find QDM2 tag in frma atom");
- _bitRate = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() bitRate: %d", _bitRate);
+ // Second, the QDCA atom
+ uint32 qdcaSize = extraData->readUint32BE();
+ if (qdcaSize > (uint32)(extraData->size() - extraData->pos()))
+ error("Invalid QDM2 QDCA atom");
- _blockSize = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() blockSize: %d", _blockSize);
+ if (extraData->readUint32BE() != MKTAG('Q', 'D', 'C', 'A'))
+ error("Failed to find QDCA atom for QDM2");
- _frameSize = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() frameSize: %d", _frameSize);
+ extraData->readUint32BE(); // unknown
+ _channels = extraData->readUint32BE();
+ _sampleRate = extraData->readUint32BE();
+ _bitRate = extraData->readUint32BE();
+ _blockSize = extraData->readUint32BE();
+ _frameSize = extraData->readUint32BE();
_packetSize = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() packetSize: %d", _packetSize);
-
- if (extraData->size() - extraData->pos() != 0) {
- tmp_s = extraData->readSint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraSize3: %d", tmp_s);
- if (extraData->size() + 4 != tmp_s)
- warning("QDM2Stream::QDM2Stream() extraSize3 mismatch - Expected %d", extraData->size() + 4);
- tmp = extraData->readUint32BE();
- debug(1, "QDM2Stream::QDM2Stream() extraTag3: %d", tmp);
- if (tmp != MKTAG('Q','D','C','P'))
- warning("QDM2Stream::QDM2Stream() extraTag3 mismatch");
-
- if ((float)extraData->readUint32BE() != 1.0)
- warning("QDM2Stream::QDM2Stream() uf0 field not 1.0");
-
- if (extraData->readUint32BE() != 0)
- warning("QDM2Stream::QDM2Stream() u1 field not 0");
-
- if ((float)extraData->readUint32BE() != 1.0)
- warning("QDM2Stream::QDM2Stream() uf1 field not 1.0");
-
- if ((float)extraData->readUint32BE() != 1.0)
- warning("QDM2Stream::QDM2Stream() uf2 field not 1.0");
-
- if (extraData->readUint32BE() != 27)
- warning("QDM2Stream::QDM2Stream() u2 field not 27");
-
- if (extraData->readUint32BE() != 8)
- warning("QDM2Stream::QDM2Stream() u3 field not 8");
-
- if (extraData->readUint32BE() != 0)
- warning("QDM2Stream::QDM2Stream() u4 field not 0");
- }
+ // Third, we don't care about the QDCP atom
_fftOrder = Common::intLog2(_frameSize) + 1;
_fftFrameSize = 2 * _frameSize; // complex has two floats
@@ -1878,7 +1208,7 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::F
if (_fftOrder < 7 || _fftOrder > 9)
error("QDM2Stream::QDM2Stream() Unsupported fft_order: %d", _fftOrder);
- rdftInit(&_rdftCtx, _fftOrder, IRDFT);
+ _rdft = new Common::RDFT(_fftOrder, Common::RDFT::IDFT_C2R);
initVlc();
ff_mpa_synth_init(ff_mpa_synth_window);
@@ -1893,29 +1223,30 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::F
}
QDM2Stream::~QDM2Stream() {
+ delete _rdft;
delete[] _compressedData;
}
-static int qdm2_get_vlc(GetBitContext *gb, VLC *vlc, int flag, int depth) {
+static int qdm2_get_vlc(Common::BitStream *gb, VLC *vlc, int flag, int depth) {
int value = getVlc2(gb, vlc->table, vlc->bits, depth);
// stage-2, 3 bits exponent escape sequence
if (value-- == 0)
- value = getBits(gb, getBits (gb, 3) + 1);
+ value = gb->getBits(gb->getBits(3) + 1);
// stage-3, optional
if (flag) {
int tmp = vlc_stage3_values[value];
if ((value & ~3) > 0)
- tmp += getBits(gb, (value >> 2));
+ tmp += gb->getBits(value >> 2);
value = tmp;
}
return value;
}
-static int qdm2_get_se_vlc(VLC *vlc, GetBitContext *gb, int depth)
+static int qdm2_get_se_vlc(VLC *vlc, Common::BitStream *gb, int depth)
{
int value = qdm2_get_vlc(gb, vlc, 0, depth);
@@ -1941,35 +1272,6 @@ static uint16 qdm2_packet_checksum(const uint8 *data, int length, int value) {
}
/**
- * Fills a QDM2SubPacket structure with packet type, size, and data pointer.
- *
- * @param gb bitreader context
- * @param sub_packet packet under analysis
- */
-static void qdm2_decode_sub_packet_header(GetBitContext *gb, QDM2SubPacket *sub_packet)
-{
- sub_packet->type = getBits (gb, 8);
-
- if (sub_packet->type == 0) {
- sub_packet->size = 0;
- sub_packet->data = NULL;
- } else {
- sub_packet->size = getBits (gb, 8);
-
- if (sub_packet->type & 0x80) {
- sub_packet->size <<= 8;
- sub_packet->size |= getBits (gb, 8);
- sub_packet->type &= 0x7f;
- }
-
- if (sub_packet->type == 0x7f)
- sub_packet->type |= (getBits (gb, 8) << 8);
-
- sub_packet->data = &gb->buffer[getBitsCount(gb) / 8]; // FIXME: this depends on bitreader internal data
- }
-}
-
-/**
* Return node pointer to first packet of requested type in list.
*
* @param list list of subpackets to be scanned
@@ -2051,7 +1353,7 @@ void QDM2Stream::fix_coding_method_array(int sb, int channels, sb_int8_array cod
for (ch = 0; ch < channels; ch++) {
for (j = 0; j < 64; ) {
- if((coding_method[ch][sb][j] - 8) > 22) {
+ if ((coding_method[ch][sb][j] - 8) > 22) {
run = 1;
case_val = 8;
} else {
@@ -2304,7 +1606,7 @@ void QDM2Stream::fill_coding_method_array(sb_int8_array tone_level_idx, sb_int8_
* @param sb_min lower subband processed (sb_min included)
* @param sb_max higher subband processed (sb_max excluded)
*/
-void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int sb_min, int sb_max) {
+void QDM2Stream::synthfilt_build_sb_samples(Common::BitStream *gb, int length, int sb_min, int sb_max) {
int sb, j, k, n, ch, run, channels;
int joined_stereo, zero_encoding, chs;
int type34_first;
@@ -2330,12 +1632,12 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
else if (sb >= 24)
joined_stereo = 1;
else
- joined_stereo = (BITS_LEFT(length,gb) >= 1) ? getBits1 (gb) : 0;
+ joined_stereo = ((length - gb->pos()) >= 1) ? gb->getBit() : 0;
if (joined_stereo) {
- if (BITS_LEFT(length,gb) >= 16)
+ if ((length - gb->pos()) >= 16)
for (j = 0; j < 16; j++)
- sign_bits[j] = getBits1(gb);
+ sign_bits[j] = gb->getBit();
for (j = 0; j < 64; j++)
if (_codingMethod[1][sb][j] > _codingMethod[0][sb][j])
@@ -2346,22 +1648,22 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
}
for (ch = 0; ch < channels; ch++) {
- zero_encoding = (BITS_LEFT(length,gb) >= 1) ? getBits1(gb) : 0;
+ zero_encoding = ((length - gb->pos()) >= 1) ? gb->getBit() : 0;
type34_predictor = 0.0;
type34_first = 1;
for (j = 0; j < 128; ) {
switch (_codingMethod[ch][sb][j / 2]) {
case 8:
- if (BITS_LEFT(length,gb) >= 10) {
+ if ((length - gb->pos()) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + 2 * k) >= 128)
break;
- samples[2 * k] = getBits1(gb) ? dequant_1bit[joined_stereo][2 * getBits1(gb)] : 0;
+ samples[2 * k] = gb->getBit() ? dequant_1bit[joined_stereo][2 * gb->getBit()] : 0;
}
} else {
- n = getBits(gb, 8);
+ n = gb->getBits(8);
for (k = 0; k < 5; k++)
samples[2 * k] = dequant_1bit[joined_stereo][_randomDequantIndex[n][k]];
}
@@ -2375,10 +1677,10 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
break;
case 10:
- if (BITS_LEFT(length,gb) >= 1) {
+ if ((length - gb->pos()) >= 1) {
double f = 0.81;
- if (getBits1(gb))
+ if (gb->getBit())
f = -f;
f -= _noiseSamples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0;
samples[0] = f;
@@ -2389,15 +1691,15 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
break;
case 16:
- if (BITS_LEFT(length,gb) >= 10) {
+ if ((length - gb->pos()) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + k) >= 128)
break;
- samples[k] = (getBits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * getBits1(gb)];
+ samples[k] = (gb->getBit() == 0) ? 0 : dequant_1bit[joined_stereo][2 * gb->getBit()];
}
} else {
- n = getBits (gb, 8);
+ n = gb->getBits(8);
for (k = 0; k < 5; k++)
samples[k] = dequant_1bit[joined_stereo][_randomDequantIndex[n][k]];
}
@@ -2409,8 +1711,8 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
break;
case 24:
- if (BITS_LEFT(length,gb) >= 7) {
- n = getBits(gb, 7);
+ if ((length - gb->pos()) >= 7) {
+ n = gb->getBits(7);
for (k = 0; k < 3; k++)
samples[k] = (_randomDequantType24[n][k] - 2.0) * 0.5;
} else {
@@ -2421,7 +1723,7 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
break;
case 30:
- if (BITS_LEFT(length,gb) >= 4)
+ if ((length - gb->pos()) >= 4)
samples[0] = type30_dequant[qdm2_get_vlc(gb, &_vlcTabType30, 0, 1)];
else
samples[0] = SB_DITHERING_NOISE(sb, _noiseIdx);
@@ -2430,10 +1732,10 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
break;
case 34:
- if (BITS_LEFT(length,gb) >= 7) {
+ if ((length - gb->pos()) >= 7) {
if (type34_first) {
- type34_div = (float)(1 << getBits(gb, 2));
- samples[0] = ((float)getBits(gb, 5) - 16.0) / 15.0;
+ type34_div = (float)(1 << gb->getBits(2));
+ samples[0] = ((float)gb->getBits(5) - 16.0) / 15.0;
type34_predictor = samples[0];
type34_first = 0;
} else {
@@ -2484,21 +1786,21 @@ void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int s
* @param gb bitreader context
* @param length packet length in bits
*/
-void QDM2Stream::init_quantized_coeffs_elem0(int8 *quantized_coeffs, GetBitContext *gb, int length) {
+void QDM2Stream::init_quantized_coeffs_elem0(int8 *quantized_coeffs, Common::BitStream *gb, int length) {
int i, k, run, level, diff;
- if (BITS_LEFT(length,gb) < 16)
+ if ((length - gb->pos()) < 16)
return;
level = qdm2_get_vlc(gb, &_vlcTabLevel, 0, 2);
quantized_coeffs[0] = level;
for (i = 0; i < 7; ) {
- if (BITS_LEFT(length,gb) < 16)
+ if ((length - gb->pos()) < 16)
break;
run = qdm2_get_vlc(gb, &_vlcTabRun, 0, 1) + 1;
- if (BITS_LEFT(length,gb) < 16)
+ if ((length - gb->pos()) < 16)
break;
diff = qdm2_get_se_vlc(&_vlcTabDiff, gb, 2);
@@ -2518,13 +1820,13 @@ void QDM2Stream::init_quantized_coeffs_elem0(int8 *quantized_coeffs, GetBitConte
* @param gb bitreader context
* @param length packet length in bits
*/
-void QDM2Stream::init_tone_level_dequantization(GetBitContext *gb, int length) {
+void QDM2Stream::init_tone_level_dequantization(Common::BitStream *gb, int length) {
int sb, j, k, n, ch;
for (ch = 0; ch < _channels; ch++) {
init_quantized_coeffs_elem0(_quantizedCoeffs[ch][0], gb, length);
- if (BITS_LEFT(length,gb) < 16) {
+ if ((length - gb->pos()) < 16) {
memset(_quantizedCoeffs[ch][0], 0, 8);
break;
}
@@ -2535,11 +1837,11 @@ void QDM2Stream::init_tone_level_dequantization(GetBitContext *gb, int length) {
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < _channels; ch++)
for (j = 0; j < 8; j++) {
- if (BITS_LEFT(length,gb) < 1)
+ if ((length - gb->pos()) < 1)
break;
- if (getBits1(gb)) {
+ if (gb->getBit()) {
for (k=0; k < 8; k++) {
- if (BITS_LEFT(length,gb) < 16)
+ if ((length - gb->pos()) < 16)
break;
_toneLevelIdxHi1[ch][sb][j][k] = qdm2_get_vlc(gb, &_vlcTabToneLevelIdxHi1, 0, 2);
}
@@ -2553,7 +1855,7 @@ void QDM2Stream::init_tone_level_dequantization(GetBitContext *gb, int length) {
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < _channels; ch++) {
- if (BITS_LEFT(length,gb) < 16)
+ if ((length - gb->pos()) < 16)
break;
_toneLevelIdxHi2[ch][sb] = qdm2_get_vlc(gb, &_vlcTabToneLevelIdxHi2, 0, 2);
if (sb > 19)
@@ -2568,7 +1870,7 @@ void QDM2Stream::init_tone_level_dequantization(GetBitContext *gb, int length) {
for (sb = 0; sb < n; sb++) {
for (ch = 0; ch < _channels; ch++) {
for (j = 0; j < 8; j++) {
- if (BITS_LEFT(length,gb) < 16)
+ if ((length - gb->pos()) < 16)
break;
_toneLevelIdxMid[ch][sb][j] = qdm2_get_vlc(gb, &_vlcTabToneLevelIdxMid, 0, 2) - 32;
}
@@ -2582,10 +1884,10 @@ void QDM2Stream::init_tone_level_dequantization(GetBitContext *gb, int length) {
* @param node pointer to node with packet
*/
void QDM2Stream::process_subpacket_9(QDM2SubPNode *node) {
- GetBitContext gb;
int i, j, k, n, ch, run, level, diff;
- initGetBits(&gb, node->packet->data, node->packet->size*8);
+ Common::MemoryReadStream d(node->packet->data, node->packet->size*8);
+ Common::BitStream32LELSB gb(&d);
n = coeff_per_sb_for_avg[_coeffPerSbSelect][QDM2_SB_USED(_subSampling) - 1] + 1; // same as averagesomething function
@@ -2618,9 +1920,8 @@ void QDM2Stream::process_subpacket_9(QDM2SubPNode *node) {
* @param length packet length in bits
*/
void QDM2Stream::process_subpacket_10(QDM2SubPNode *node, int length) {
- GetBitContext gb;
-
- initGetBits(&gb, ((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
+ Common::MemoryReadStream d(((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
+ Common::BitStream32LELSB gb(&d);
if (length != 0) {
init_tone_level_dequantization(&gb, length);
@@ -2637,11 +1938,11 @@ void QDM2Stream::process_subpacket_10(QDM2SubPNode *node, int length) {
* @param length packet length in bit
*/
void QDM2Stream::process_subpacket_11(QDM2SubPNode *node, int length) {
- GetBitContext gb;
+ Common::MemoryReadStream d(((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
+ Common::BitStream32LELSB gb(&d);
- initGetBits(&gb, ((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
if (length >= 32) {
- int c = getBits (&gb, 13);
+ int c = gb.getBits(13);
if (c > 3)
fill_coding_method_array(_toneLevelIdx, _toneLevelIdxTemp, _codingMethod,
@@ -2658,9 +1959,9 @@ void QDM2Stream::process_subpacket_11(QDM2SubPNode *node, int length) {
* @param length packet length in bits
*/
void QDM2Stream::process_subpacket_12(QDM2SubPNode *node, int length) {
- GetBitContext gb;
+ Common::MemoryReadStream d(((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
+ Common::BitStream32LELSB gb(&d);
- initGetBits(&gb, ((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
synthfilt_build_sb_samples(&gb, length, 8, QDM2_SB_USED(_subSampling));
}
@@ -2700,7 +2001,6 @@ void QDM2Stream::process_synthesis_subpackets(QDM2SubPNode *list) {
*
*/
void QDM2Stream::qdm2_decode_super_block(void) {
- GetBitContext gb;
struct QDM2SubPacket header, *packet;
int i, packet_bytes, sub_packet_size, subPacketsD;
unsigned int next_index = 0;
@@ -2714,8 +2014,28 @@ void QDM2Stream::qdm2_decode_super_block(void) {
average_quantized_coeffs(); // average elements in quantized_coeffs[max_ch][10][8]
- initGetBits(&gb, _compressedData, _packetSize*8);
- qdm2_decode_sub_packet_header(&gb, &header);
+ Common::MemoryReadStream *d = new Common::MemoryReadStream(_compressedData, _packetSize*8);
+ Common::BitStream *gb = new Common::BitStream32LELSB(d);
+ //qdm2_decode_sub_packet_header
+ header.type = gb->getBits(8);
+
+ if (header.type == 0) {
+ header.size = 0;
+ header.data = NULL;
+ } else {
+ header.size = gb->getBits(8);
+
+ if (header.type & 0x80) {
+ header.size <<= 8;
+ header.size |= gb->getBits(8);
+ header.type &= 0x7f;
+ }
+
+ if (header.type == 0x7f)
+ header.type |= (gb->getBits(8) << 8);
+
+ header.data = &_compressedData[gb->pos() / 8];
+ }
if (header.type < 2 || header.type >= 8) {
_hasErrors = true;
@@ -2724,12 +2044,15 @@ void QDM2Stream::qdm2_decode_super_block(void) {
}
_superblocktype_2_3 = (header.type == 2 || header.type == 3);
- packet_bytes = (_packetSize - getBitsCount(&gb) / 8);
+ packet_bytes = (_packetSize - gb->pos() / 8);
- initGetBits(&gb, header.data, header.size*8);
+ delete gb;
+ delete d;
+ d = new Common::MemoryReadStream(header.data, header.size*8);
+ gb = new Common::BitStream32LELSB(d);
if (header.type == 2 || header.type == 4 || header.type == 5) {
- int csum = 257 * getBits(&gb, 8) + 2 * getBits(&gb, 8);
+ int csum = 257 * gb->getBits(8) + 2 * gb->getBits(8);
csum = qdm2_packet_checksum(_compressedData, _packetSize, csum);
@@ -2756,8 +2079,11 @@ void QDM2Stream::qdm2_decode_super_block(void) {
_subPacketListA[i - 1].next = &_subPacketListA[i];
// seek to next block
- initGetBits(&gb, header.data, header.size*8);
- skipBits(&gb, next_index*8);
+ delete gb;
+ delete d;
+ d = new Common::MemoryReadStream(header.data, header.size*8);
+ gb = new Common::BitStream32LELSB(d);
+ gb->skip(next_index*8);
if (next_index >= header.size)
break;
@@ -2765,8 +2091,28 @@ void QDM2Stream::qdm2_decode_super_block(void) {
// decode subpacket
packet = &_subPackets[i];
- qdm2_decode_sub_packet_header(&gb, packet);
- next_index = packet->size + getBitsCount(&gb) / 8;
+ //qdm2_decode_sub_packet_header
+ packet->type = gb->getBits(8);
+
+ if (packet->type == 0) {
+ packet->size = 0;
+ packet->data = NULL;
+ } else {
+ packet->size = gb->getBits(8);
+
+ if (packet->type & 0x80) {
+ packet->size <<= 8;
+ packet->size |= gb->getBits(8);
+ packet->type &= 0x7f;
+ }
+
+ if (packet->type == 0x7f)
+ packet->type |= (gb->getBits(8) << 8);
+
+ packet->data = &header.data[gb->pos() / 8];
+ }
+
+ next_index = packet->size + gb->pos() / 8;
sub_packet_size = ((packet->size > 0xff) ? 1 : 0) + packet->size + 2;
if (packet->type == 0)
@@ -2786,18 +2132,22 @@ void QDM2Stream::qdm2_decode_super_block(void) {
// add subpacket to related list
if (packet->type == 8) {
error("Unsupported packet type 8");
+ delete gb;
+ delete d;
return;
} else if (packet->type >= 9 && packet->type <= 12) {
// packets for MPEG Audio like Synthesis Filter
QDM2_LIST_ADD(_subPacketListD, subPacketsD, packet);
} else if (packet->type == 13) {
for (j = 0; j < 6; j++)
- _fftLevelExp[j] = getBits(&gb, 6);
+ _fftLevelExp[j] = gb->getBits(6);
} else if (packet->type == 14) {
for (j = 0; j < 6; j++)
- _fftLevelExp[j] = qdm2_get_vlc(&gb, &_fftLevelExpVlc, 0, 2);
+ _fftLevelExp[j] = qdm2_get_vlc(gb, &_fftLevelExpVlc, 0, 2);
} else if (packet->type == 15) {
error("Unsupported packet type 15");
+ delete gb;
+ delete d;
return;
} else if (packet->type >= 16 && packet->type < 48 && !fft_subpackets[packet->type - 16]) {
// packets for FFT
@@ -2815,6 +2165,8 @@ void QDM2Stream::qdm2_decode_super_block(void) {
process_subpacket_12(NULL, 0);
}
// ****************************************************************
+ delete gb;
+ delete d;
}
void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration,
@@ -2830,7 +2182,7 @@ void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int durat
_fftCoefsIndex++;
}
-void QDM2Stream::qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b) {
+void QDM2Stream::qdm2_fft_decode_tones(int duration, Common::BitStream *gb, int b) {
int channel, stereo, phase, exp;
int local_int_4, local_int_8, stereo_phase, local_int_10;
int local_int_14, stereo_exp, local_int_20, local_int_28;
@@ -2871,8 +2223,8 @@ void QDM2Stream::qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b) {
local_int_14 = (offset >> local_int_8);
if (_channels > 1) {
- channel = getBits1(gb);
- stereo = getBits1(gb);
+ channel = gb->getBit();
+ stereo = gb->getBit();
} else {
channel = 0;
stereo = 0;
@@ -2882,7 +2234,7 @@ void QDM2Stream::qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b) {
exp += _fftLevelExp[fft_level_index_table[local_int_14]];
exp = (exp < 0) ? 0 : exp;
- phase = getBits(gb, 3);
+ phase = gb->getBits(3);
stereo_exp = 0;
stereo_phase = 0;
@@ -2907,7 +2259,6 @@ void QDM2Stream::qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b) {
void QDM2Stream::qdm2_decode_fft_packets(void) {
int i, j, min, max, value, type, unknown_flag;
- GetBitContext gb;
if (_subPacketListB[0].packet == NULL)
return;
@@ -2940,7 +2291,8 @@ void QDM2Stream::qdm2_decode_fft_packets(void) {
return;
// decode FFT tones
- initGetBits(&gb, packet->data, packet->size*8);
+ Common::MemoryReadStream d(packet->data, packet->size*8);
+ Common::BitStream32LELSB gb(&d);
if (packet->type >= 32 && packet->type < 48 && !fft_subpackets[packet->type - 16])
unknown_flag = 1;
@@ -2961,7 +2313,7 @@ void QDM2Stream::qdm2_decode_fft_packets(void) {
}
} else if (type == 46) {
for (j=0; j < 6; j++)
- _fftLevelExp[j] = getBits(&gb, 6);
+ _fftLevelExp[j] = gb.getBits(6);
for (j=0; j < 4; j++) {
qdm2_fft_decode_tones(j, &gb, unknown_flag);
}
@@ -3093,15 +2445,13 @@ void QDM2Stream::qdm2_fft_tone_synthesizer(uint8 sub_packet) {
}
void QDM2Stream::qdm2_calculate_fft(int channel) {
- int i;
-
_fft.complex[channel][0].re *= 2.0f;
_fft.complex[channel][0].im = 0.0f;
- rdftCalc(&_rdftCtx, (float *)_fft.complex[channel]);
+ _rdft->calc((float *)_fft.complex[channel]);
// add samples to output buffer
- for (i = 0; i < ((_fftFrameSize + 15) & ~15); i++)
+ for (int i = 0; i < ((_fftFrameSize + 15) & ~15); i++)
_outputBuffer[_channels * i + channel] += ((float *) _fft.complex[channel])[i];
}
diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp
index dcf80ea1c6..0588650ec6 100644
--- a/audio/decoders/quicktime.cpp
+++ b/audio/decoders/quicktime.cpp
@@ -26,7 +26,6 @@
#include "common/stream.h"
#include "common/textconsole.h"
-#include "audio/audiostream.h"
#include "audio/decoders/codec.h"
#include "audio/decoders/quicktime.h"
#include "audio/decoders/quicktime_intern.h"
@@ -39,12 +38,74 @@
namespace Audio {
+/**
+ * An AudioStream that just returns silent samples and runs infinitely.
+ * Used to fill in the "empty edits" in the track queue which are just
+ * supposed to be no sound playing.
+ */
+class SilentAudioStream : public AudioStream {
+public:
+ SilentAudioStream(int rate, bool stereo) : _rate(rate), _isStereo(stereo) {}
+
+ int readBuffer(int16 *buffer, const int numSamples) {
+ memset(buffer, 0, numSamples * 2);
+ return numSamples;
+ }
+
+ bool endOfData() const { return false; } // it never ends!
+ bool isStereo() const { return _isStereo; }
+ int getRate() const { return _rate; }
+
+private:
+ int _rate;
+ bool _isStereo;
+};
+
+/**
+ * An AudioStream wrapper that forces audio to be played in mono.
+ * It currently just ignores the right channel if stereo.
+ */
+class ForcedMonoAudioStream : public AudioStream {
+public:
+ ForcedMonoAudioStream(AudioStream *parentStream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) :
+ _parentStream(parentStream), _disposeAfterUse(disposeAfterUse) {}
+
+ ~ForcedMonoAudioStream() {
+ if (_disposeAfterUse == DisposeAfterUse::YES)
+ delete _parentStream;
+ }
+
+ int readBuffer(int16 *buffer, const int numSamples) {
+ if (!_parentStream->isStereo())
+ return _parentStream->readBuffer(buffer, numSamples);
+
+ int16 temp[2];
+ int samples = 0;
+
+ while (samples < numSamples && !endOfData()) {
+ _parentStream->readBuffer(temp, 2);
+ *buffer++ = temp[0];
+ samples++;
+ }
+
+ return samples;
+ }
+
+ bool endOfData() const { return _parentStream->endOfData(); }
+ bool isStereo() const { return false; }
+ int getRate() const { return _parentStream->getRate(); }
+
+private:
+ AudioStream *_parentStream;
+ DisposeAfterUse::Flag _disposeAfterUse;
+};
+
QuickTimeAudioDecoder::QuickTimeAudioDecoder() : Common::QuickTimeParser() {
- _audStream = 0;
}
QuickTimeAudioDecoder::~QuickTimeAudioDecoder() {
- delete _audStream;
+ for (uint32 i = 0; i < _audioTracks.size(); i++)
+ delete _audioTracks[i];
}
bool QuickTimeAudioDecoder::loadAudioFile(const Common::String &filename) {
@@ -66,32 +127,11 @@ bool QuickTimeAudioDecoder::loadAudioStream(Common::SeekableReadStream *stream,
void QuickTimeAudioDecoder::init() {
Common::QuickTimeParser::init();
- _audioTrackIndex = -1;
-
- // Find an audio stream
+ // Initialize all the audio streams
+ // But ignore any streams we don't support
for (uint32 i = 0; i < _tracks.size(); i++)
- if (_tracks[i]->codecType == CODEC_TYPE_AUDIO && _audioTrackIndex < 0)
- _audioTrackIndex = i;
-
- // Initialize audio, if present
- if (_audioTrackIndex >= 0) {
- AudioSampleDesc *entry = (AudioSampleDesc *)_tracks[_audioTrackIndex]->sampleDescs[0];
-
- if (entry->isAudioCodecSupported()) {
- _audStream = makeQueuingAudioStream(entry->_sampleRate, entry->_channels == 2);
- _curAudioChunk = 0;
-
- // Make sure the bits per sample transfers to the sample size
- if (entry->getCodecTag() == MKTAG('r', 'a', 'w', ' ') || entry->getCodecTag() == MKTAG('t', 'w', 'o', 's'))
- _tracks[_audioTrackIndex]->sampleSize = (entry->_bitsPerSample / 8) * entry->_channels;
-
- // Initialize the codec (if necessary)
- entry->initCodec();
-
- if (_tracks[_audioTrackIndex]->editCount > 1)
- warning("Multiple edit list entries in an audio track. Things may go awry");
- }
- }
+ if (_tracks[i]->codecType == CODEC_TYPE_AUDIO && ((AudioSampleDesc *)_tracks[i]->sampleDescs[0])->isAudioCodecSupported())
+ _audioTracks.push_back(new QuickTimeAudioTrack(this, _tracks[i]));
}
Common::QuickTimeParser::SampleDesc *QuickTimeAudioDecoder::readSampleDesc(Track *track, uint32 format) {
@@ -130,8 +170,7 @@ Common::QuickTimeParser::SampleDesc *QuickTimeAudioDecoder::readSampleDesc(Track
return 0;
}
- // Version 0 videos (such as the Riven ones) don't have this set,
- // but we need it later on. Add it in here.
+ // Version 0 files don't have some variables set, so we'll do that here
if (format == MKTAG('i', 'm', 'a', '4')) {
entry->_samplesPerFrame = 64;
entry->_bytesPerFrame = 34 * entry->_channels;
@@ -146,20 +185,164 @@ Common::QuickTimeParser::SampleDesc *QuickTimeAudioDecoder::readSampleDesc(Track
return 0;
}
-bool QuickTimeAudioDecoder::isOldDemuxing() const {
- assert(_audioTrackIndex >= 0);
- return _tracks[_audioTrackIndex]->timeToSampleCount == 1 && _tracks[_audioTrackIndex]->timeToSample[0].duration == 1;
+QuickTimeAudioDecoder::QuickTimeAudioTrack::QuickTimeAudioTrack(QuickTimeAudioDecoder *decoder, Common::QuickTimeParser::Track *parentTrack) {
+ _decoder = decoder;
+ _parentTrack = parentTrack;
+ _queue = createStream();
+ _samplesQueued = 0;
+
+ AudioSampleDesc *entry = (AudioSampleDesc *)_parentTrack->sampleDescs[0];
+
+ if (entry->getCodecTag() == MKTAG('r', 'a', 'w', ' ') || entry->getCodecTag() == MKTAG('t', 'w', 'o', 's'))
+ _parentTrack->sampleSize = (entry->_bitsPerSample / 8) * entry->_channels;
+
+ // Initialize our edit parser too
+ _curEdit = 0;
+ enterNewEdit(Timestamp());
+
+ // If the edit doesn't start on a nice boundary, set us up to skip some samples
+ Timestamp editStartTime(0, _parentTrack->editList[_curEdit].mediaTime, _parentTrack->timeScale);
+ Timestamp trackPosition = getCurrentTrackTime();
+ if (_parentTrack->editList[_curEdit].mediaTime != -1 && trackPosition != editStartTime)
+ _skipSamples = editStartTime.convertToFramerate(getRate()) - trackPosition;
+}
+
+QuickTimeAudioDecoder::QuickTimeAudioTrack::~QuickTimeAudioTrack() {
+ delete _queue;
+}
+
+void QuickTimeAudioDecoder::QuickTimeAudioTrack::queueAudio(const Timestamp &length) {
+ if (allDataRead() || (length.totalNumberOfFrames() != 0 && Timestamp(0, _samplesQueued, getRate()) >= length))
+ return;
+
+ do {
+ Timestamp nextEditTime(0, _parentTrack->editList[_curEdit].timeOffset + _parentTrack->editList[_curEdit].trackDuration, _decoder->_timeScale);
+
+ if (_parentTrack->editList[_curEdit].mediaTime == -1) {
+ // We've got an empty edit, so fill it with silence
+ Timestamp editLength(0, _parentTrack->editList[_curEdit].trackDuration, _decoder->_timeScale);
+
+ // If we seek into the middle of an empty edit, we need to adjust
+ if (_skipSamples != Timestamp()) {
+ editLength = editLength - _skipSamples;
+ _skipSamples = Timestamp();
+ }
+
+ queueStream(makeLimitingAudioStream(new SilentAudioStream(getRate(), isStereo()), editLength), editLength);
+ _curEdit++;
+ enterNewEdit(nextEditTime);
+ } else {
+ // Normal audio
+ AudioStream *stream = readAudioChunk(_curChunk);
+ Timestamp chunkLength = getChunkLength(_curChunk, _skipAACPrimer);
+ _skipAACPrimer = false;
+ _curChunk++;
+
+ // If we have any samples that we need to skip (ie. we seeked into
+ // the middle of a chunk), skip them here.
+ if (_skipSamples != Timestamp()) {
+ skipSamples(_skipSamples, stream);
+ _curMediaPos = _curMediaPos + _skipSamples;
+ chunkLength = chunkLength - _skipSamples;
+ _skipSamples = Timestamp();
+ }
+
+ // Calculate our overall position within the media
+ Timestamp trackPosition = getCurrentTrackTime() + chunkLength;
+
+ // If we have reached the end of this edit (or have no more media to read),
+ // we move on to the next edit
+ if (trackPosition >= nextEditTime || _curChunk >= _parentTrack->chunkCount) {
+ chunkLength = nextEditTime.convertToFramerate(getRate()) - getCurrentTrackTime();
+ stream = makeLimitingAudioStream(stream, chunkLength);
+ _curEdit++;
+ enterNewEdit(nextEditTime);
+
+ // Next time around, we'll know how much to skip
+ trackPosition = getCurrentTrackTime();
+ if (!allDataRead() && _parentTrack->editList[_curEdit].mediaTime != -1 && nextEditTime != trackPosition)
+ _skipSamples = nextEditTime.convertToFramerate(getRate()) - trackPosition;
+ } else {
+ _curMediaPos = _curMediaPos + chunkLength.convertToFramerate(_curMediaPos.framerate());
+ }
+
+ queueStream(stream, chunkLength);
+ }
+ } while (!allDataRead() && Timestamp(0, _samplesQueued, getRate()) < length);
+}
+
+Timestamp QuickTimeAudioDecoder::QuickTimeAudioTrack::getCurrentTrackTime() const {
+ if (allDataRead())
+ return getLength().convertToFramerate(getRate());
+
+ return Timestamp(0, _parentTrack->editList[_curEdit].timeOffset, _decoder->_timeScale).convertToFramerate(getRate())
+ + _curMediaPos - Timestamp(0, _parentTrack->editList[_curEdit].mediaTime, _parentTrack->timeScale).convertToFramerate(getRate());
+}
+
+void QuickTimeAudioDecoder::QuickTimeAudioTrack::queueRemainingAudio() {
+ queueAudio(getLength());
+}
+
+int QuickTimeAudioDecoder::QuickTimeAudioTrack::readBuffer(int16 *buffer, const int numSamples) {
+ int samplesRead = _queue->readBuffer(buffer, numSamples);
+ _samplesQueued -= samplesRead / (isStereo() ? 2 : 1);
+ return samplesRead;
+}
+
+bool QuickTimeAudioDecoder::QuickTimeAudioTrack::allDataRead() const {
+ return _curEdit == _parentTrack->editCount;
+}
+
+bool QuickTimeAudioDecoder::QuickTimeAudioTrack::endOfData() const {
+ return allDataRead() && _queue->endOfData();
}
-void QuickTimeAudioDecoder::queueNextAudioChunk() {
- AudioSampleDesc *entry = (AudioSampleDesc *)_tracks[_audioTrackIndex]->sampleDescs[0];
+bool QuickTimeAudioDecoder::QuickTimeAudioTrack::seek(const Timestamp &where) {
+ // Recreate the queue
+ delete _queue;
+ _queue = createStream();
+ _samplesQueued = 0;
+
+ if (where >= getLength()) {
+ // We're done
+ _curEdit = _parentTrack->editCount;
+ return true;
+ }
+
+ // Find where we are in the stream
+ findEdit(where);
+
+ // Now queue up some audio and skip whatever we need to skip
+ Timestamp samplesToSkip = where.convertToFramerate(getRate()) - getCurrentTrackTime();
+ queueAudio();
+ if (_parentTrack->editList[_curEdit].mediaTime != -1)
+ skipSamples(samplesToSkip, _queue);
+
+ return true;
+}
+
+Timestamp QuickTimeAudioDecoder::QuickTimeAudioTrack::getLength() const {
+ return Timestamp(0, _parentTrack->duration, _decoder->_timeScale);
+}
+
+QueuingAudioStream *QuickTimeAudioDecoder::QuickTimeAudioTrack::createStream() const {
+ AudioSampleDesc *entry = (AudioSampleDesc *)_parentTrack->sampleDescs[0];
+ return makeQueuingAudioStream(entry->_sampleRate, entry->_channels == 2);
+}
+
+bool QuickTimeAudioDecoder::QuickTimeAudioTrack::isOldDemuxing() const {
+ return _parentTrack->timeToSampleCount == 1 && _parentTrack->timeToSample[0].duration == 1;
+}
+
+AudioStream *QuickTimeAudioDecoder::QuickTimeAudioTrack::readAudioChunk(uint chunk) {
+ AudioSampleDesc *entry = (AudioSampleDesc *)_parentTrack->sampleDescs[0];
Common::MemoryWriteStreamDynamic *wStream = new Common::MemoryWriteStreamDynamic();
- _fd->seek(_tracks[_audioTrackIndex]->chunkOffsets[_curAudioChunk]);
+ _decoder->_fd->seek(_parentTrack->chunkOffsets[chunk]);
// First, we have to get the sample count
- uint32 sampleCount = entry->getAudioChunkSampleCount(_curAudioChunk);
- assert(sampleCount);
+ uint32 sampleCount = getAudioChunkSampleCount(chunk);
+ assert(sampleCount != 0);
if (isOldDemuxing()) {
// Old-style audio demuxing
@@ -176,12 +359,12 @@ void QuickTimeAudioDecoder::queueNextAudioChunk() {
size = (samples / entry->_samplesPerFrame) * entry->_bytesPerFrame;
} else {
samples = MIN<uint32>(1024, sampleCount);
- size = samples * _tracks[_audioTrackIndex]->sampleSize;
+ size = samples * _parentTrack->sampleSize;
}
// Now, we read in the data for this data and output it
byte *data = (byte *)malloc(size);
- _fd->read(data, size);
+ _decoder->_fd->read(data, size);
wStream->write(data, size);
free(data);
sampleCount -= samples;
@@ -191,41 +374,87 @@ void QuickTimeAudioDecoder::queueNextAudioChunk() {
// Find our starting sample
uint32 startSample = 0;
- for (uint32 i = 0; i < _curAudioChunk; i++)
- startSample += entry->getAudioChunkSampleCount(i);
+ for (uint32 i = 0; i < chunk; i++)
+ startSample += getAudioChunkSampleCount(i);
for (uint32 i = 0; i < sampleCount; i++) {
- uint32 size = (_tracks[_audioTrackIndex]->sampleSize != 0) ? _tracks[_audioTrackIndex]->sampleSize : _tracks[_audioTrackIndex]->sampleSizes[i + startSample];
+ uint32 size = (_parentTrack->sampleSize != 0) ? _parentTrack->sampleSize : _parentTrack->sampleSizes[i + startSample];
// Now, we read in the data for this data and output it
byte *data = (byte *)malloc(size);
- _fd->read(data, size);
+ _decoder->_fd->read(data, size);
wStream->write(data, size);
free(data);
}
}
- // Now queue the buffer
- _audStream->queueAudioStream(entry->createAudioStream(new Common::MemoryReadStream(wStream->getData(), wStream->size(), DisposeAfterUse::YES)));
+ AudioStream *audioStream = entry->createAudioStream(new Common::MemoryReadStream(wStream->getData(), wStream->size(), DisposeAfterUse::YES));
delete wStream;
- _curAudioChunk++;
+ return audioStream;
}
-void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
- if (!_audStream)
+void QuickTimeAudioDecoder::QuickTimeAudioTrack::skipSamples(const Timestamp &length, AudioStream *stream) {
+ int32 sampleCount = length.convertToFramerate(getRate()).totalNumberOfFrames();
+
+ if (sampleCount <= 0)
return;
- // Re-create the audio stream
- delete _audStream;
- Audio::QuickTimeAudioDecoder::AudioSampleDesc *entry = (Audio::QuickTimeAudioDecoder::AudioSampleDesc *)_tracks[_audioTrackIndex]->sampleDescs[0];
- _audStream = Audio::makeQueuingAudioStream(entry->_sampleRate, entry->_channels == 2);
+ if (isStereo())
+ sampleCount *= 2;
+
+ int16 *tempBuffer = new int16[sampleCount];
+ uint32 result = stream->readBuffer(tempBuffer, sampleCount);
+ delete[] tempBuffer;
+
+ // If this is the queue, make sure we subtract this number from the
+ // amount queued
+ if (stream == _queue)
+ _samplesQueued -= result / (isStereo() ? 2 : 1);
+}
+
+void QuickTimeAudioDecoder::QuickTimeAudioTrack::findEdit(const Timestamp &position) {
+ for (_curEdit = 0; _curEdit < _parentTrack->editCount - 1 && position > Timestamp(0, _parentTrack->editList[_curEdit].timeOffset, _decoder->_timeScale); _curEdit++)
+ ;
+
+ enterNewEdit(position);
+}
+
+void QuickTimeAudioDecoder::QuickTimeAudioTrack::enterNewEdit(const Timestamp &position) {
+ _skipSamples = Timestamp(); // make sure our skip variable doesn't remain around
+
+ // If we're at the end of the edit list, there's nothing else for us to do here
+ if (allDataRead())
+ return;
+
+ // For an empty edit, we may need to adjust the start time
+ if (_parentTrack->editList[_curEdit].mediaTime == -1) {
+ // Just invalidate the current media position (and make sure the scale
+ // is in terms of our rate so it simplifies things later)
+ _curMediaPos = Timestamp(0, 0, getRate());
+
+ // Also handle shortening of the empty edit if needed
+ if (position != Timestamp())
+ _skipSamples = position.convertToFramerate(_decoder->_timeScale) - Timestamp(0, _parentTrack->editList[_curEdit].timeOffset, _decoder->_timeScale);
+ return;
+ }
+
+ // I really hope I never need to implement this :P
+ // But, I'll throw in this error just to make sure I catch anything with this...
+ if (_parentTrack->editList[_curEdit].mediaRate != 1)
+ error("Unhandled QuickTime audio rate change");
// Reinitialize the codec
- entry->initCodec();
+ ((AudioSampleDesc *)_parentTrack->sampleDescs[0])->initCodec();
+ _skipAACPrimer = true;
// First, we need to track down what audio sample we need
- Audio::Timestamp curAudioTime = where.convertToFramerate(_tracks[_audioTrackIndex]->timeScale);
+ // Convert our variables from the media time (position) and the edit time (based on position)
+ // and the media time
+ Timestamp curAudioTime = Timestamp(0, _parentTrack->editList[_curEdit].mediaTime, _parentTrack->timeScale)
+ + position.convertToFramerate(_parentTrack->timeScale)
+ - Timestamp(0, _parentTrack->editList[_curEdit].timeOffset, _decoder->_timeScale).convertToFramerate(_parentTrack->timeScale);
+
uint32 sample = curAudioTime.totalNumberOfFrames();
uint32 seekSample = sample;
@@ -236,24 +465,24 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
uint32 curSample = 0;
seekSample = 0;
- for (int32 i = 0; i < _tracks[_audioTrackIndex]->timeToSampleCount; i++) {
- uint32 sampleCount = _tracks[_audioTrackIndex]->timeToSample[i].count * _tracks[_audioTrackIndex]->timeToSample[i].duration;
+ for (int32 i = 0; i < _parentTrack->timeToSampleCount; i++) {
+ uint32 sampleCount = _parentTrack->timeToSample[i].count * _parentTrack->timeToSample[i].duration;
if (sample < curSample + sampleCount) {
- seekSample += (sample - curSample) / _tracks[_audioTrackIndex]->timeToSample[i].duration;
+ seekSample += (sample - curSample) / _parentTrack->timeToSample[i].duration;
break;
}
- seekSample += _tracks[_audioTrackIndex]->timeToSample[i].count;
+ seekSample += _parentTrack->timeToSample[i].count;
curSample += sampleCount;
}
}
// Now to track down what chunk it's in
uint32 totalSamples = 0;
- _curAudioChunk = 0;
- for (uint32 i = 0; i < _tracks[_audioTrackIndex]->chunkCount; i++, _curAudioChunk++) {
- uint32 chunkSampleCount = entry->getAudioChunkSampleCount(i);
+ _curChunk = 0;
+ for (uint32 i = 0; i < _parentTrack->chunkCount; i++, _curChunk++) {
+ uint32 chunkSampleCount = getAudioChunkSampleCount(i);
if (seekSample < totalSamples + chunkSampleCount)
break;
@@ -261,17 +490,74 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
totalSamples += chunkSampleCount;
}
- // Reposition the audio stream
- queueNextAudioChunk();
- if (sample != totalSamples) {
- // HACK: Skip a certain amount of samples from the stream
- // (There's got to be a better way to do this!)
- int skipSamples = (sample - totalSamples) * entry->_channels;
+ // Now we get to have fun and convert *back* to an actual time
+ // We don't want the sample count to be modified at this point, though
+ if (!isOldDemuxing())
+ totalSamples = getAACSampleTime(totalSamples);
+
+ _curMediaPos = Timestamp(0, totalSamples, getRate());
+}
+
+void QuickTimeAudioDecoder::QuickTimeAudioTrack::queueStream(AudioStream *stream, const Timestamp &length) {
+ // If the samples are stereo and the container is mono, force the samples
+ // to be mono.
+ if (stream->isStereo() && !isStereo())
+ _queue->queueAudioStream(new ForcedMonoAudioStream(stream, DisposeAfterUse::YES), DisposeAfterUse::YES);
+ else
+ _queue->queueAudioStream(stream, DisposeAfterUse::YES);
- int16 *tempBuffer = new int16[skipSamples];
- _audStream->readBuffer(tempBuffer, skipSamples);
- delete[] tempBuffer;
+ _samplesQueued += length.convertToFramerate(getRate()).totalNumberOfFrames();
+}
+
+uint32 QuickTimeAudioDecoder::QuickTimeAudioTrack::getAudioChunkSampleCount(uint chunk) const {
+ uint32 sampleCount = 0;
+
+ for (uint32 i = 0; i < _parentTrack->sampleToChunkCount; i++)
+ if (chunk >= _parentTrack->sampleToChunk[i].first)
+ sampleCount = _parentTrack->sampleToChunk[i].count;
+
+ return sampleCount;
+}
+
+Timestamp QuickTimeAudioDecoder::QuickTimeAudioTrack::getChunkLength(uint chunk, bool skipAACPrimer) const {
+ uint32 chunkSampleCount = getAudioChunkSampleCount(chunk);
+
+ if (isOldDemuxing())
+ return Timestamp(0, chunkSampleCount, getRate());
+
+ // AAC needs some extra handling, of course
+ return Timestamp(0, getAACSampleTime(chunkSampleCount, skipAACPrimer), getRate());
+}
+
+uint32 QuickTimeAudioDecoder::QuickTimeAudioTrack::getAACSampleTime(uint32 totalSampleCount, bool skipAACPrimer) const{
+ uint32 curSample = 0;
+ uint32 time = 0;
+
+ for (int32 i = 0; i < _parentTrack->timeToSampleCount; i++) {
+ uint32 sampleCount = _parentTrack->timeToSample[i].count;
+
+ if (totalSampleCount < curSample + sampleCount) {
+ time += (totalSampleCount - curSample) * _parentTrack->timeToSample[i].duration;
+ break;
+ }
+
+ time += _parentTrack->timeToSample[i].count * _parentTrack->timeToSample[i].duration;
+ curSample += sampleCount;
}
+
+ // The first chunk of AAC contains "duration" samples that are used as a primer
+ // We need to subtract that number from the duration for the first chunk. See:
+ // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html#//apple_ref/doc/uid/TP40000939-CH2-SW1
+ // The skipping of both the primer and the remainder are handled by the AAC code,
+ // whereas the timing of the remainder are handled by this time-to-sample chunk
+ // code already.
+ // We have to do this after each time we reinitialize the codec
+ if (skipAACPrimer) {
+ assert(_parentTrack->timeToSampleCount > 0);
+ time -= _parentTrack->timeToSample[0].duration;
+ }
+
+ return time;
}
QuickTimeAudioDecoder::AudioSampleDesc::AudioSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag) : Common::QuickTimeParser::SampleDesc(parentTrack, codecTag) {
@@ -312,22 +598,13 @@ bool QuickTimeAudioDecoder::AudioSampleDesc::isAudioCodecSupported() const {
break;
}
warning("No MPEG-4 audio (%s) support", audioType.c_str());
- } else
+ } else {
warning("Audio Codec Not Supported: \'%s\'", tag2str(_codecTag));
+ }
return false;
}
-uint32 QuickTimeAudioDecoder::AudioSampleDesc::getAudioChunkSampleCount(uint chunk) const {
- uint32 sampleCount = 0;
-
- for (uint32 j = 0; j < _parentTrack->sampleToChunkCount; j++)
- if (chunk >= _parentTrack->sampleToChunk[j].first)
- sampleCount = _parentTrack->sampleToChunk[j].count;
-
- return sampleCount;
-}
-
AudioStream *QuickTimeAudioDecoder::AudioSampleDesc::createAudioStream(Common::SeekableReadStream *stream) const {
if (!stream)
return 0;
@@ -381,7 +658,7 @@ void QuickTimeAudioDecoder::AudioSampleDesc::initCodec() {
}
/**
- * A wrapper around QuickTimeAudioDecoder that implements the RewindableAudioStream API
+ * A wrapper around QuickTimeAudioDecoder that implements the SeekableAudioStream API
*/
class QuickTimeAudioStream : public SeekableAudioStream, public QuickTimeAudioDecoder {
public:
@@ -389,11 +666,11 @@ public:
~QuickTimeAudioStream() {}
bool openFromFile(const Common::String &filename) {
- return QuickTimeAudioDecoder::loadAudioFile(filename) && _audioTrackIndex >= 0 && _audStream;
+ return QuickTimeAudioDecoder::loadAudioFile(filename) && !_audioTracks.empty();
}
bool openFromStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle) {
- return QuickTimeAudioDecoder::loadAudioStream(stream, disposeFileHandle) && _audioTrackIndex >= 0 && _audStream;
+ return QuickTimeAudioDecoder::loadAudioStream(stream, disposeFileHandle) && !_audioTracks.empty();
}
// AudioStream API
@@ -401,33 +678,21 @@ public:
int samples = 0;
while (samples < numSamples && !endOfData()) {
- if (_audStream->numQueuedStreams() == 0)
- queueNextAudioChunk();
-
- samples += _audStream->readBuffer(buffer + samples, numSamples - samples);
+ if (!_audioTracks[0]->hasDataInQueue())
+ _audioTracks[0]->queueAudio();
+ samples += _audioTracks[0]->readBuffer(buffer + samples, numSamples - samples);
}
return samples;
}
- bool isStereo() const { return _audStream->isStereo(); }
- int getRate() const { return _audStream->getRate(); }
- bool endOfData() const { return _curAudioChunk >= _tracks[_audioTrackIndex]->chunkCount && _audStream->endOfData(); }
+ bool isStereo() const { return _audioTracks[0]->isStereo(); }
+ int getRate() const { return _audioTracks[0]->getRate(); }
+ bool endOfData() const { return _audioTracks[0]->endOfData(); }
// SeekableAudioStream API
- bool seek(const Timestamp &where) {
- if (where > getLength())
- return false;
-
- setAudioStreamPos(where);
- return true;
- }
-
- Timestamp getLength() const {
- // TODO: Switch to the other one when audio edits are supported
- //return Timestamp(0, _tracks[_audioTrackIndex]->duration, _timeScale);
- return Timestamp(0, _tracks[_audioTrackIndex]->mediaDuration, _tracks[_audioTrackIndex]->timeScale);
- }
+ bool seek(const Timestamp &where) { return _audioTracks[0]->seek(where); }
+ Timestamp getLength() const { return _audioTracks[0]->getLength(); }
};
SeekableAudioStream *makeQuickTimeStream(const Common::String &filename) {
diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h
index 4dd1a57710..4c0b93488e 100644
--- a/audio/decoders/quicktime.h
+++ b/audio/decoders/quicktime.h
@@ -25,6 +25,7 @@
* Sound decoder used in engines:
* - groovie
* - mohawk
+ * - pegasus
* - sci
*/
diff --git a/audio/decoders/quicktime_intern.h b/audio/decoders/quicktime_intern.h
index e31a1d3872..f1ab037d89 100644
--- a/audio/decoders/quicktime_intern.h
+++ b/audio/decoders/quicktime_intern.h
@@ -34,6 +34,8 @@
#include "common/scummsys.h"
#include "common/types.h"
+#include "audio/audiostream.h"
+
namespace Common {
class SeekableReadStream;
class String;
@@ -41,9 +43,7 @@ namespace Common {
namespace Audio {
-class AudioStream;
class Codec;
-class QueuingAudioStream;
class QuickTimeAudioDecoder : public Common::QuickTimeParser {
public:
@@ -63,13 +63,59 @@ public:
bool loadAudioStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle);
protected:
+ class QuickTimeAudioTrack : public SeekableAudioStream {
+ public:
+ QuickTimeAudioTrack(QuickTimeAudioDecoder *decoder, Track *parentTrack);
+ ~QuickTimeAudioTrack();
+
+ // AudioStream API
+ int readBuffer(int16 *buffer, const int numSamples);
+ bool isStereo() const { return _queue->isStereo(); }
+ int getRate() const { return _queue->getRate(); }
+ bool endOfData() const;
+
+ // SeekableAudioStream API
+ bool seek(const Timestamp &where);
+ Timestamp getLength() const;
+
+ // Queue *at least* "length" audio
+ // If length is zero, it queues the next logical block of audio whether
+ // that be a whole edit or just one chunk within an edit
+ void queueAudio(const Timestamp &length = Timestamp());
+ Track *getParent() const { return _parentTrack; }
+ void queueRemainingAudio();
+ bool hasDataInQueue() const { return _samplesQueued != 0; }
+
+ private:
+ QuickTimeAudioDecoder *_decoder;
+ Track *_parentTrack;
+ QueuingAudioStream *_queue;
+ uint _curChunk;
+ Timestamp _curMediaPos, _skipSamples;
+ uint32 _curEdit, _samplesQueued;
+ bool _skipAACPrimer;
+
+ QueuingAudioStream *createStream() const;
+ AudioStream *readAudioChunk(uint chunk);
+ bool isOldDemuxing() const;
+ void skipSamples(const Timestamp &length, AudioStream *stream);
+ void findEdit(const Timestamp &position);
+ bool allDataRead() const;
+ void enterNewEdit(const Timestamp &position);
+ void queueStream(AudioStream *stream, const Timestamp &length);
+ uint32 getAudioChunkSampleCount(uint chunk) const;
+ Timestamp getChunkLength(uint chunk, bool skipAACPrimer = false) const;
+ uint32 getAACSampleTime(uint32 totalSampleCount, bool skipAACPrimer = false) const;
+ Timestamp getCurrentTrackTime() const;
+ };
+
class AudioSampleDesc : public Common::QuickTimeParser::SampleDesc {
public:
AudioSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag);
~AudioSampleDesc();
bool isAudioCodecSupported() const;
- uint32 getAudioChunkSampleCount(uint chunk) const;
+
AudioStream *createAudioStream(Common::SeekableReadStream *stream) const;
void initCodec();
@@ -80,6 +126,7 @@ protected:
uint32 _samplesPerFrame;
uint32 _bytesPerFrame;
+ private:
Codec *_codec;
};
@@ -87,13 +134,8 @@ protected:
virtual Common::QuickTimeParser::SampleDesc *readSampleDesc(Track *track, uint32 format);
void init();
- void setAudioStreamPos(const Timestamp &where);
- bool isOldDemuxing() const;
- void queueNextAudioChunk();
- int _audioTrackIndex;
- uint _curAudioChunk;
- QueuingAudioStream *_audStream;
+ Common::Array<QuickTimeAudioTrack *> _audioTracks;
};
} // End of namespace Audio
diff --git a/audio/decoders/voc.cpp b/audio/decoders/voc.cpp
index f0b5b2777d..fa330c6f2c 100644
--- a/audio/decoders/voc.cpp
+++ b/audio/decoders/voc.cpp
@@ -321,9 +321,14 @@ 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");
+ // We will allow invalid block numbers as terminators. This is needed,
+ // since some games ship broken VOC files. The following occasions are
+ // known:
+ // - 128 is used as terminator in Simon 1 Amiga CD32
+ // - Full Throttle contains a VOC file with an incorrect block length
+ // resulting in a sample (127) to be read as block code.
+ if (block.code > 9) {
+ warning("VocStream::preProcess: Caught %d as terminator", block.code);
break;
}
@@ -482,7 +487,8 @@ void VocStream::preProcess() {
default:
warning("Unhandled code %d in VOC file (len %d)", block.code, block.length);
- return;
+ // Skip the whole block and try to use the next one.
+ skip = block.length;
}
// Premature end of stream => error!
diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp
index 0518915e81..dea07a739b 100644
--- a/audio/mididrv.cpp
+++ b/audio/mididrv.cpp
@@ -240,7 +240,7 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
devStr = ConfMan.hasKey("gm_device") ? ConfMan.get("gm_device") : Common::String("null");
else
devStr = "auto";
-
+
// Default to Null device here, since we also register a default null setting for
// the MT32 or GM device in the config manager.
hdl = getDeviceHandle(devStr.empty() ? Common::String("null") : devStr);
diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp
index 943a6067a4..eec32c05d1 100644
--- a/audio/midiparser.cpp
+++ b/audio/midiparser.cpp
@@ -32,24 +32,24 @@
//////////////////////////////////////////////////
MidiParser::MidiParser() :
-_hanging_notes_count(0),
+_hangingNotesCount(0),
_driver(0),
-_timer_rate(0x4A0000),
+_timerRate(0x4A0000),
_ppqn(96),
_tempo(500000),
-_psec_per_tick(5208), // 500000 / 96
+_psecPerTick(5208), // 500000 / 96
_autoLoop(false),
_smartJump(false),
_centerPitchWheelOnUnload(false),
_sendSustainOffOnNotesOff(false),
-_num_tracks(0),
-_active_track(255),
-_abort_parse(0) {
- memset(_active_notes, 0, sizeof(_active_notes));
- _next_event.start = NULL;
- _next_event.delta = 0;
- _next_event.event = 0;
- _next_event.length = 0;
+_numTracks(0),
+_activeTrack(255),
+_abortParse(0) {
+ memset(_activeNotes, 0, sizeof(_activeNotes));
+ _nextEvent.start = NULL;
+ _nextEvent.delta = 0;
+ _nextEvent.event = 0;
+ _nextEvent.length = 0;
}
void MidiParser::property(int prop, int value) {
@@ -76,7 +76,7 @@ void MidiParser::sendToDriver(uint32 b) {
void MidiParser::setTempo(uint32 tempo) {
_tempo = tempo;
if (_ppqn)
- _psec_per_tick = (tempo + (_ppqn >> 2)) / _ppqn;
+ _psecPerTick = (tempo + (_ppqn >> 2)) / _ppqn;
}
// This is the conventional (i.e. SMF) variable length quantity
@@ -100,44 +100,44 @@ void MidiParser::activeNote(byte channel, byte note, bool active) {
return;
if (active)
- _active_notes[note] |= (1 << channel);
+ _activeNotes[note] |= (1 << channel);
else
- _active_notes[note] &= ~(1 << channel);
+ _activeNotes[note] &= ~(1 << channel);
// See if there are hanging notes that we can cancel
- NoteTimer *ptr = _hanging_notes;
+ NoteTimer *ptr = _hangingNotes;
int i;
- for (i = ARRAYSIZE(_hanging_notes); i; --i, ++ptr) {
- if (ptr->channel == channel && ptr->note == note && ptr->time_left) {
- ptr->time_left = 0;
- --_hanging_notes_count;
+ for (i = ARRAYSIZE(_hangingNotes); i; --i, ++ptr) {
+ if (ptr->channel == channel && ptr->note == note && ptr->timeLeft) {
+ ptr->timeLeft = 0;
+ --_hangingNotesCount;
break;
}
}
}
-void MidiParser::hangingNote(byte channel, byte note, uint32 time_left, bool recycle) {
+void MidiParser::hangingNote(byte channel, byte note, uint32 timeLeft, bool recycle) {
NoteTimer *best = 0;
- NoteTimer *ptr = _hanging_notes;
+ NoteTimer *ptr = _hangingNotes;
int i;
- if (_hanging_notes_count >= ARRAYSIZE(_hanging_notes)) {
+ if (_hangingNotesCount >= ARRAYSIZE(_hangingNotes)) {
warning("MidiParser::hangingNote(): Exceeded polyphony");
return;
}
- for (i = ARRAYSIZE(_hanging_notes); i; --i, ++ptr) {
+ for (i = ARRAYSIZE(_hangingNotes); i; --i, ++ptr) {
if (ptr->channel == channel && ptr->note == note) {
- if (ptr->time_left && ptr->time_left < time_left && recycle)
+ if (ptr->timeLeft && ptr->timeLeft < timeLeft && recycle)
return;
best = ptr;
- if (ptr->time_left) {
+ if (ptr->timeLeft) {
if (recycle)
sendToDriver(0x80 | channel, note, 0);
- --_hanging_notes_count;
+ --_hangingNotesCount;
}
break;
- } else if (!best && ptr->time_left == 0) {
+ } else if (!best && ptr->timeLeft == 0) {
best = ptr;
}
}
@@ -146,14 +146,14 @@ void MidiParser::hangingNote(byte channel, byte note, uint32 time_left, bool rec
// length, if the note should be turned on and off in
// the same iteration. For now just set it to 1 and
// we'll turn it off in the next cycle.
- if (!time_left || time_left & 0x80000000)
- time_left = 1;
+ if (!timeLeft || timeLeft & 0x80000000)
+ timeLeft = 1;
if (best) {
best->channel = channel;
best->note = note;
- best->time_left = time_left;
- ++_hanging_notes_count;
+ best->timeLeft = timeLeft;
+ ++_hangingNotesCount;
} else {
// We checked this up top. We should never get here!
warning("MidiParser::hangingNote(): Internal error");
@@ -161,45 +161,45 @@ void MidiParser::hangingNote(byte channel, byte note, uint32 time_left, bool rec
}
void MidiParser::onTimer() {
- uint32 end_time;
- uint32 event_time;
+ uint32 endTime;
+ uint32 eventTime;
- if (!_position._play_pos || !_driver)
+ if (!_position._playPos || !_driver)
return;
- _abort_parse = false;
- end_time = _position._play_time + _timer_rate;
+ _abortParse = false;
+ endTime = _position._playTime + _timerRate;
// Scan our hanging notes for any
// that should be turned off.
- if (_hanging_notes_count) {
- NoteTimer *ptr = &_hanging_notes[0];
+ if (_hangingNotesCount) {
+ NoteTimer *ptr = &_hangingNotes[0];
int i;
- for (i = ARRAYSIZE(_hanging_notes); i; --i, ++ptr) {
- if (ptr->time_left) {
- if (ptr->time_left <= _timer_rate) {
+ for (i = ARRAYSIZE(_hangingNotes); i; --i, ++ptr) {
+ if (ptr->timeLeft) {
+ if (ptr->timeLeft <= _timerRate) {
sendToDriver(0x80 | ptr->channel, ptr->note, 0);
- ptr->time_left = 0;
- --_hanging_notes_count;
+ ptr->timeLeft = 0;
+ --_hangingNotesCount;
} else {
- ptr->time_left -= _timer_rate;
+ ptr->timeLeft -= _timerRate;
}
}
}
}
- while (!_abort_parse) {
- EventInfo &info = _next_event;
+ while (!_abortParse) {
+ EventInfo &info = _nextEvent;
- event_time = _position._last_event_time + info.delta * _psec_per_tick;
- if (event_time > end_time)
+ eventTime = _position._lastEventTime + info.delta * _psecPerTick;
+ if (eventTime > endTime)
break;
// Process the next info.
- _position._last_event_tick += info.delta;
+ _position._lastEventTick += info.delta;
if (info.event < 0x80) {
warning("Bad command or running status %02X", info.event);
- _position._play_pos = 0;
+ _position._playPos = 0;
return;
}
@@ -217,7 +217,7 @@ void MidiParser::onTimer() {
// as well as sending it to the output device.
if (_autoLoop) {
jumpToTick(0);
- parseNextEvent(_next_event);
+ parseNextEvent(_nextEvent);
} else {
stopPlaying();
_driver->metaEvent(info.ext.type, info.ext.data, (uint16)info.length);
@@ -234,7 +234,7 @@ void MidiParser::onTimer() {
activeNote(info.channel(), info.basic.param1, false);
} else if (info.command() == 0x9) {
if (info.length > 0)
- hangingNote(info.channel(), info.basic.param1, info.length * _psec_per_tick - (end_time - event_time));
+ hangingNote(info.channel(), info.basic.param1, info.length * _psecPerTick - (endTime - eventTime));
else
activeNote(info.channel(), info.basic.param1, true);
}
@@ -242,15 +242,15 @@ void MidiParser::onTimer() {
}
- if (!_abort_parse) {
- _position._last_event_time = event_time;
- parseNextEvent(_next_event);
+ if (!_abortParse) {
+ _position._lastEventTime = eventTime;
+ parseNextEvent(_nextEvent);
}
}
- if (!_abort_parse) {
- _position._play_time = end_time;
- _position._play_tick = (_position._play_time - _position._last_event_time) / _psec_per_tick + _position._last_event_tick;
+ if (!_abortParse) {
+ _position._playTime = endTime;
+ _position._playTick = (_position._playTime - _position._lastEventTime) / _psecPerTick + _position._lastEventTick;
}
}
@@ -263,20 +263,20 @@ void MidiParser::allNotesOff() {
// Turn off all active notes
for (i = 0; i < 128; ++i) {
for (j = 0; j < 16; ++j) {
- if (_active_notes[i] & (1 << j)) {
+ if (_activeNotes[i] & (1 << j)) {
sendToDriver(0x80 | j, i, 0);
}
}
}
// Turn off all hanging notes
- for (i = 0; i < ARRAYSIZE(_hanging_notes); i++) {
- if (_hanging_notes[i].time_left) {
- sendToDriver(0x80 | _hanging_notes[i].channel, _hanging_notes[i].note, 0);
- _hanging_notes[i].time_left = 0;
+ for (i = 0; i < ARRAYSIZE(_hangingNotes); i++) {
+ if (_hangingNotes[i].timeLeft) {
+ sendToDriver(0x80 | _hangingNotes[i].channel, _hangingNotes[i].note, 0);
+ _hangingNotes[i].timeLeft = 0;
}
}
- _hanging_notes_count = 0;
+ _hangingNotesCount = 0;
// To be sure, send an "All Note Off" event (but not all MIDI devices
// support this...).
@@ -287,7 +287,7 @@ void MidiParser::allNotesOff() {
sendToDriver(0xB0 | i, 0x40, 0); // Also send a sustain off event (bug #3116608)
}
- memset(_active_notes, 0, sizeof(_active_notes));
+ memset(_activeNotes, 0, sizeof(_activeNotes));
}
void MidiParser::resetTracking() {
@@ -295,7 +295,7 @@ void MidiParser::resetTracking() {
}
bool MidiParser::setTrack(int track) {
- if (track < 0 || track >= _num_tracks)
+ if (track < 0 || track >= _numTracks)
return false;
// We allow restarting the track via setTrack when
// it isn't playing anymore. This allows us to reuse
@@ -308,7 +308,7 @@ bool MidiParser::setTrack(int track) {
// TODO: Check if any engine has problem with this
// handling, if so we need to find a better way to handle
// track restarts. (KYRA relies on this working)
- else if (track == _active_track && isPlaying())
+ else if (track == _activeTrack && isPlaying())
return true;
if (_smartJump)
@@ -317,10 +317,10 @@ bool MidiParser::setTrack(int track) {
allNotesOff();
resetTracking();
- memset(_active_notes, 0, sizeof(_active_notes));
- _active_track = track;
- _position._play_pos = _tracks[track];
- parseNextEvent(_next_event);
+ memset(_activeNotes, 0, sizeof(_activeNotes));
+ _activeTrack = track;
+ _position._playPos = _tracks[track];
+ parseNextEvent(_nextEvent);
return true;
}
@@ -332,29 +332,29 @@ void MidiParser::stopPlaying() {
void MidiParser::hangAllActiveNotes() {
// Search for note off events until we have
// accounted for every active note.
- uint16 temp_active[128];
- memcpy(temp_active, _active_notes, sizeof (temp_active));
+ uint16 tempActive[128];
+ memcpy(tempActive, _activeNotes, sizeof (tempActive));
- uint32 advance_tick = _position._last_event_tick;
+ uint32 advanceTick = _position._lastEventTick;
while (true) {
int i;
for (i = 0; i < 128; ++i)
- if (temp_active[i] != 0)
+ if (tempActive[i] != 0)
break;
if (i == 128)
break;
- parseNextEvent(_next_event);
- advance_tick += _next_event.delta;
- if (_next_event.command() == 0x8) {
- if (temp_active[_next_event.basic.param1] & (1 << _next_event.channel())) {
- hangingNote(_next_event.channel(), _next_event.basic.param1, (advance_tick - _position._last_event_tick) * _psec_per_tick, false);
- temp_active[_next_event.basic.param1] &= ~(1 << _next_event.channel());
+ parseNextEvent(_nextEvent);
+ advanceTick += _nextEvent.delta;
+ if (_nextEvent.command() == 0x8) {
+ if (tempActive[_nextEvent.basic.param1] & (1 << _nextEvent.channel())) {
+ hangingNote(_nextEvent.channel(), _nextEvent.basic.param1, (advanceTick - _position._lastEventTick) * _psecPerTick, false);
+ tempActive[_nextEvent.basic.param1] &= ~(1 << _nextEvent.channel());
}
- } else if (_next_event.event == 0xFF && _next_event.ext.type == 0x2F) {
+ } else if (_nextEvent.event == 0xFF && _nextEvent.ext.type == 0x2F) {
// warning("MidiParser::hangAllActiveNotes(): Hit End of Track with active notes left");
for (i = 0; i < 128; ++i) {
for (int j = 0; j < 16; ++j) {
- if (temp_active[i] & (1 << j)) {
+ if (tempActive[i] & (1 << j)) {
activeNote(j, i, false);
sendToDriver(0x80 | j, i, 0);
}
@@ -366,33 +366,33 @@ void MidiParser::hangAllActiveNotes() {
}
bool MidiParser::jumpToTick(uint32 tick, bool fireEvents, bool stopNotes, bool dontSendNoteOn) {
- if (_active_track >= _num_tracks)
+ if (_activeTrack >= _numTracks)
return false;
Tracker currentPos(_position);
- EventInfo currentEvent(_next_event);
+ EventInfo currentEvent(_nextEvent);
resetTracking();
- _position._play_pos = _tracks[_active_track];
- parseNextEvent(_next_event);
+ _position._playPos = _tracks[_activeTrack];
+ parseNextEvent(_nextEvent);
if (tick > 0) {
while (true) {
- EventInfo &info = _next_event;
- if (_position._last_event_tick + info.delta >= tick) {
- _position._play_time += (tick - _position._last_event_tick) * _psec_per_tick;
- _position._play_tick = tick;
+ EventInfo &info = _nextEvent;
+ if (_position._lastEventTick + info.delta >= tick) {
+ _position._playTime += (tick - _position._lastEventTick) * _psecPerTick;
+ _position._playTick = tick;
break;
}
- _position._last_event_tick += info.delta;
- _position._last_event_time += info.delta * _psec_per_tick;
- _position._play_tick = _position._last_event_tick;
- _position._play_time = _position._last_event_time;
+ _position._lastEventTick += info.delta;
+ _position._lastEventTime += info.delta * _psecPerTick;
+ _position._playTick = _position._lastEventTick;
+ _position._playTime = _position._lastEventTime;
if (info.event == 0xFF) {
if (info.ext.type == 0x2F) { // End of track
_position = currentPos;
- _next_event = currentEvent;
+ _nextEvent = currentEvent;
return false;
} else {
if (info.ext.type == 0x51 && info.length >= 3) // Tempo
@@ -419,36 +419,36 @@ bool MidiParser::jumpToTick(uint32 tick, bool fireEvents, bool stopNotes, bool d
}
}
- parseNextEvent(_next_event);
+ parseNextEvent(_nextEvent);
}
}
if (stopNotes) {
- if (!_smartJump || !currentPos._play_pos) {
+ if (!_smartJump || !currentPos._playPos) {
allNotesOff();
} else {
- EventInfo targetEvent(_next_event);
+ EventInfo targetEvent(_nextEvent);
Tracker targetPosition(_position);
_position = currentPos;
- _next_event = currentEvent;
+ _nextEvent = currentEvent;
hangAllActiveNotes();
- _next_event = targetEvent;
+ _nextEvent = targetEvent;
_position = targetPosition;
}
}
- _abort_parse = true;
+ _abortParse = true;
return true;
}
void MidiParser::unloadMusic() {
resetTracking();
allNotesOff();
- _num_tracks = 0;
- _active_track = 255;
- _abort_parse = true;
+ _numTracks = 0;
+ _activeTrack = 255;
+ _abortParse = true;
if (_centerPitchWheelOnUnload) {
// Center the pitch wheels in preparation for the next piece of
diff --git a/audio/midiparser.h b/audio/midiparser.h
index c935969e72..a4dbf174e1 100644
--- a/audio/midiparser.h
+++ b/audio/midiparser.h
@@ -49,33 +49,33 @@ class MidiDriver_BASE;
* each Tracker location.
*/
struct Tracker {
- byte * _play_pos; ///< A pointer to the next event to be parsed
- uint32 _play_time; ///< Current time in microseconds; may be in between event times
- uint32 _play_tick; ///< Current MIDI tick; may be in between event ticks
- uint32 _last_event_time; ///< The time, in microseconds, of the last event that was parsed
- uint32 _last_event_tick; ///< The tick at which the last parsed event occurs
- byte _running_status; ///< Cached MIDI command, for MIDI streams that rely on implied event codes
+ byte * _playPos; ///< A pointer to the next event to be parsed
+ uint32 _playTime; ///< Current time in microseconds; may be in between event times
+ uint32 _playTick; ///< Current MIDI tick; may be in between event ticks
+ uint32 _lastEventTime; ///< The time, in microseconds, of the last event that was parsed
+ uint32 _lastEventTick; ///< The tick at which the last parsed event occurs
+ byte _runningStatus; ///< Cached MIDI command, for MIDI streams that rely on implied event codes
Tracker() { clear(); }
/// Copy constructor for each duplication of Tracker information.
Tracker(const Tracker &copy) :
- _play_pos(copy._play_pos),
- _play_time(copy._play_time),
- _play_tick(copy._play_tick),
- _last_event_time(copy._last_event_time),
- _last_event_tick(copy._last_event_tick),
- _running_status(copy._running_status)
+ _playPos(copy._playPos),
+ _playTime(copy._playTime),
+ _playTick(copy._playTick),
+ _lastEventTime(copy._lastEventTime),
+ _lastEventTick(copy._lastEventTick),
+ _runningStatus(copy._runningStatus)
{ }
/// Clears all data; used by the constructor for initialization.
void clear() {
- _play_pos = 0;
- _play_time = 0;
- _play_tick = 0;
- _last_event_time = 0;
- _last_event_tick = 0;
- _running_status = 0;
+ _playPos = 0;
+ _playTime = 0;
+ _playTick = 0;
+ _lastEventTime = 0;
+ _lastEventTick = 0;
+ _runningStatus = 0;
}
};
@@ -119,8 +119,8 @@ struct EventInfo {
struct NoteTimer {
byte channel; ///< The MIDI channel on which the note was played
byte note; ///< The note number for the active note
- uint32 time_left; ///< The time, in microseconds, remaining before the note should be turned off
- NoteTimer() : channel(0), note(0), time_left(0) {}
+ uint32 timeLeft; ///< The time, in microseconds, remaining before the note should be turned off
+ NoteTimer() : channel(0), note(0), timeLeft(0) {}
};
@@ -264,29 +264,29 @@ struct NoteTimer {
*/
class MidiParser {
protected:
- uint16 _active_notes[128]; ///< Each uint16 is a bit mask for channels that have that note on.
- NoteTimer _hanging_notes[32]; ///< Maintains expiration info for up to 32 notes.
+ uint16 _activeNotes[128]; ///< Each uint16 is a bit mask for channels that have that note on.
+ NoteTimer _hangingNotes[32]; ///< Maintains expiration info for up to 32 notes.
///< Used for "Smart Jump" and MIDI formats that do not include explicit Note Off events.
- byte _hanging_notes_count; ///< Count of hanging notes, used to optimize expiration.
+ byte _hangingNotesCount; ///< Count of hanging notes, used to optimize expiration.
MidiDriver_BASE *_driver; ///< The device to which all events will be transmitted.
- uint32 _timer_rate; ///< The time in microseconds between onTimer() calls. Obtained from the MidiDriver.
+ uint32 _timerRate; ///< The time in microseconds between onTimer() calls. Obtained from the MidiDriver.
uint32 _ppqn; ///< Pulses Per Quarter Note. (We refer to "pulses" as "ticks".)
uint32 _tempo; ///< Microseconds per quarter note.
- uint32 _psec_per_tick; ///< Microseconds per tick (_tempo / _ppqn).
+ uint32 _psecPerTick; ///< Microseconds per tick (_tempo / _ppqn).
bool _autoLoop; ///< For lightweight clients that don't provide their own flow control.
bool _smartJump; ///< Support smart expiration of hanging notes when jumping
bool _centerPitchWheelOnUnload; ///< Center the pitch wheels when unloading a song
bool _sendSustainOffOnNotesOff; ///< Send a sustain off on a notes off event, stopping hanging notes
byte *_tracks[120]; ///< Multi-track MIDI formats are supported, up to 120 tracks.
- byte _num_tracks; ///< Count of total tracks for multi-track MIDI formats. 1 for single-track formats.
- byte _active_track; ///< Keeps track of the currently active track, in multi-track formats.
+ byte _numTracks; ///< Count of total tracks for multi-track MIDI formats. 1 for single-track formats.
+ byte _activeTrack; ///< Keeps track of the currently active track, in multi-track formats.
Tracker _position; ///< The current time/position in the active track.
- EventInfo _next_event; ///< The next event to transmit. Events are preparsed
+ EventInfo _nextEvent; ///< The next event to transmit. Events are preparsed
///< so each event is parsed only once; this permits
///< simulated events in certain formats.
- bool _abort_parse; ///< If a jump or other operation interrupts parsing, flag to abort.
+ bool _abortParse; ///< If a jump or other operation interrupts parsing, flag to abort.
protected:
static uint32 readVLQ(byte * &data);
@@ -295,7 +295,7 @@ protected:
virtual void parseNextEvent(EventInfo &info) = 0;
void activeNote(byte channel, byte note, bool active);
- void hangingNote(byte channel, byte note, uint32 ticks_left, bool recycle = true);
+ void hangingNote(byte channel, byte note, uint32 ticksLeft, bool recycle = true);
void hangAllActiveNotes();
virtual void sendToDriver(uint32 b);
@@ -377,18 +377,18 @@ public:
virtual void property(int prop, int value);
void setMidiDriver(MidiDriver_BASE *driver) { _driver = driver; }
- void setTimerRate(uint32 rate) { _timer_rate = rate; }
+ void setTimerRate(uint32 rate) { _timerRate = rate; }
void setTempo(uint32 tempo);
void onTimer();
- bool isPlaying() const { return (_position._play_pos != 0); }
+ bool isPlaying() const { return (_position._playPos != 0); }
void stopPlaying();
bool setTrack(int track);
bool jumpToTick(uint32 tick, bool fireEvents = false, bool stopNotes = true, bool dontSendNoteOn = false);
uint32 getPPQN() { return _ppqn; }
- virtual uint32 getTick() { return _position._play_tick; }
+ virtual uint32 getTick() { return _position._playTick; }
static void defaultXMidiCallback(byte eventData, void *refCon);
diff --git a/audio/midiparser_smf.cpp b/audio/midiparser_smf.cpp
index e883471b54..4b0913cbfe 100644
--- a/audio/midiparser_smf.cpp
+++ b/audio/midiparser_smf.cpp
@@ -45,8 +45,8 @@ public:
};
-static const byte command_lengths[8] = { 3, 3, 3, 3, 2, 2, 3, 0 };
-static const byte special_lengths[16] = { 0, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
+static const byte commandLengths[8] = { 3, 3, 3, 3, 2, 2, 3, 0 };
+static const byte specialLengths[16] = { 0, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
MidiParser_SMF::~MidiParser_SMF() {
free(_buffer);
@@ -62,8 +62,8 @@ void MidiParser_SMF::property(int prop, int value) {
}
void MidiParser_SMF::parseNextEvent(EventInfo &info) {
- info.start = _position._play_pos;
- info.delta = readVLQ(_position._play_pos);
+ info.start = _position._playPos;
+ info.delta = readVLQ(_position._playPos);
// Process the next info. If mpMalformedPitchBends
// was set, we must skip over any pitch bend events
@@ -71,19 +71,19 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) {
// real pitch bend events, they're just two-byte
// prefixes before the real info.
do {
- if ((_position._play_pos[0] & 0xF0) >= 0x80)
- info.event = *(_position._play_pos++);
+ if ((_position._playPos[0] & 0xF0) >= 0x80)
+ info.event = *(_position._playPos++);
else
- info.event = _position._running_status;
- } while (_malformedPitchBends && (info.event & 0xF0) == 0xE0 && _position._play_pos++);
+ info.event = _position._runningStatus;
+ } while (_malformedPitchBends && (info.event & 0xF0) == 0xE0 && _position._playPos++);
if (info.event < 0x80)
return;
- _position._running_status = info.event;
+ _position._runningStatus = info.event;
switch (info.command()) {
case 0x9: // Note On
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
if (info.basic.param2 == 0)
info.event = info.channel() | 0x80;
info.length = 0;
@@ -91,7 +91,7 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) {
case 0xC:
case 0xD:
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
@@ -99,20 +99,20 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) {
case 0xA:
case 0xB:
case 0xE:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
info.length = 0;
break;
case 0xF: // System Common, Meta or SysEx event
switch (info.event & 0x0F) {
case 0x2: // Song Position Pointer
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
break;
case 0x3: // Song Select
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
@@ -126,16 +126,16 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) {
break;
case 0x0: // SysEx
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
break;
case 0xF: // META event
- info.ext.type = *(_position._play_pos++);
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.ext.type = *(_position._playPos++);
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
break;
default:
@@ -146,8 +146,8 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) {
bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
uint32 len;
- byte midi_type;
- uint32 total_size;
+ byte midiType;
+ uint32 totalSize;
bool isGMF;
unloadMusic();
@@ -171,10 +171,10 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
// Verify that this MIDI either is a Type 2
// or has only 1 track. We do not support
// multitrack Type 1 files.
- _num_tracks = pos[2] << 8 | pos[3];
- midi_type = pos[1];
- if (midi_type > 2 /*|| (midi_type < 2 && _num_tracks > 1)*/) {
- warning("No support for a Type %d MIDI with %d tracks", (int)midi_type, (int)_num_tracks);
+ _numTracks = pos[2] << 8 | pos[3];
+ midiType = pos[1];
+ if (midiType > 2 /*|| (midiType < 2 && _numTracks > 1)*/) {
+ warning("No support for a Type %d MIDI with %d tracks", (int)midiType, (int)_numTracks);
return false;
}
_ppqn = pos[4] << 8 | pos[5];
@@ -183,8 +183,8 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
// Older GMD/MUS file with no header info.
// Assume 1 track, 192 PPQN, and no MTrk headers.
isGMF = true;
- midi_type = 0;
- _num_tracks = 1;
+ midiType = 0;
+ _numTracks = 1;
_ppqn = 192;
pos += 7; // 'GMD\x1' + 3 bytes of useless (translate: unknown) information
} else {
@@ -193,14 +193,14 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
}
// Now we identify and store the location for each track.
- if (_num_tracks > ARRAYSIZE(_tracks)) {
- warning("Can only handle %d tracks but was handed %d", (int)ARRAYSIZE(_tracks), (int)_num_tracks);
+ if (_numTracks > ARRAYSIZE(_tracks)) {
+ warning("Can only handle %d tracks but was handed %d", (int)ARRAYSIZE(_tracks), (int)_numTracks);
return false;
}
- total_size = 0;
- int tracks_read = 0;
- while (tracks_read < _num_tracks) {
+ totalSize = 0;
+ int tracksRead = 0;
+ while (tracksRead < _numTracks) {
if (memcmp(pos, "MTrk", 4) && !isGMF) {
warning("Position: %p ('%c')", pos, *pos);
warning("Hit invalid block '%c%c%c%c' while scanning for track locations", pos[0], pos[1], pos[2], pos[3]);
@@ -208,11 +208,11 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
}
// If needed, skip the MTrk and length bytes
- _tracks[tracks_read] = pos + (isGMF ? 0 : 8);
+ _tracks[tracksRead] = pos + (isGMF ? 0 : 8);
if (!isGMF) {
pos += 4;
len = read4high(pos);
- total_size += len;
+ totalSize += len;
pos += len;
} else {
// An SMF End of Track meta event must be placed
@@ -222,7 +222,7 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
data[size++] = 0x00;
data[size++] = 0x00;
}
- ++tracks_read;
+ ++tracksRead;
}
// If this is a Type 1 MIDI, we need to now compress
@@ -230,13 +230,13 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) {
free(_buffer);
_buffer = 0;
- if (midi_type == 1) {
+ if (midiType == 1) {
// FIXME: Doubled the buffer size to prevent crashes with the
// Inherit the Earth MIDIs. Jamieson630 said something about a
// better fix, but this will have to do in the meantime.
_buffer = (byte *)malloc(size * 2);
compressToType0();
- _num_tracks = 1;
+ _numTracks = 1;
_tracks[0] = _buffer;
}
@@ -253,48 +253,48 @@ void MidiParser_SMF::compressToType0() {
// We assume that _buffer has been allocated
// to sufficient size for this operation.
- // using 0xFF since it could write track_pos[0 to _num_tracks] here
+ // using 0xFF since it could write trackPos[0 to _numTracks] here
// this would cause some illegal writes and could lead to segfaults
// (it crashed for some midis for me, they're not used in any game
// scummvm supports though). *Maybe* handle this in another way,
// it's at the moment only to be sure, that nothing goes wrong.
- byte *track_pos[0xFF];
- byte running_status[0xFF];
- uint32 track_timer[0xFF];
+ byte *trackPos[0xFF];
+ byte runningStatus[0xFF];
+ uint32 trackTimer[0xFF];
uint32 delta;
int i;
- for (i = 0; i < _num_tracks; ++i) {
- running_status[i] = 0;
- track_pos[i] = _tracks[i];
- track_timer[i] = readVLQ(track_pos[i]);
- running_status[i] = 0;
+ for (i = 0; i < _numTracks; ++i) {
+ runningStatus[i] = 0;
+ trackPos[i] = _tracks[i];
+ trackTimer[i] = readVLQ(trackPos[i]);
+ runningStatus[i] = 0;
}
- int best_i;
+ int bestTrack;
uint32 length;
byte *output = _buffer;
byte *pos, *pos2;
byte event;
- uint32 copy_bytes;
+ uint32 copyBytes;
bool write;
- byte active_tracks = (byte)_num_tracks;
+ byte activeTracks = (byte)_numTracks;
- while (active_tracks) {
+ while (activeTracks) {
write = true;
- best_i = 255;
- for (i = 0; i < _num_tracks; ++i) {
- if (track_pos[i] && (best_i == 255 || track_timer[i] < track_timer[best_i]))
- best_i = i;
+ bestTrack = 255;
+ for (i = 0; i < _numTracks; ++i) {
+ if (trackPos[i] && (bestTrack == 255 || trackTimer[i] < trackTimer[bestTrack]))
+ bestTrack = i;
}
- if (best_i == 255) {
+ if (bestTrack == 255) {
warning("Premature end of tracks");
break;
}
// Initial VLQ delta computation
delta = 0;
- length = track_timer[best_i];
+ length = trackTimer[bestTrack];
for (i = 0; length; ++i) {
delta = (delta << 8) | (length & 0x7F) | (i ? 0x80 : 0);
length >>= 7;
@@ -302,55 +302,55 @@ void MidiParser_SMF::compressToType0() {
// Process MIDI event.
bool implicitEvent = false;
- copy_bytes = 0;
- pos = track_pos[best_i];
+ copyBytes = 0;
+ pos = trackPos[bestTrack];
do {
event = *(pos++);
if (event < 0x80) {
- event = running_status[best_i];
+ event = runningStatus[bestTrack];
implicitEvent = true;
}
} while (_malformedPitchBends && (event & 0xF0) == 0xE0 && pos++);
- running_status[best_i] = event;
+ runningStatus[bestTrack] = event;
- if (command_lengths[(event >> 4) - 8] > 0) {
- copy_bytes = command_lengths[(event >> 4) - 8];
- } else if (special_lengths[(event & 0x0F)] > 0) {
- copy_bytes = special_lengths[(event & 0x0F)];
+ if (commandLengths[(event >> 4) - 8] > 0) {
+ copyBytes = commandLengths[(event >> 4) - 8];
+ } else if (specialLengths[(event & 0x0F)] > 0) {
+ copyBytes = specialLengths[(event & 0x0F)];
} else if (event == 0xF0) {
// SysEx
pos2 = pos;
length = readVLQ(pos);
- copy_bytes = 1 + (pos - pos2) + length;
+ copyBytes = 1 + (pos - pos2) + length;
} else if (event == 0xFF) {
// META
event = *(pos++);
- if (event == 0x2F && active_tracks > 1) {
- track_pos[best_i] = 0;
+ if (event == 0x2F && activeTracks > 1) {
+ trackPos[bestTrack] = 0;
write = false;
} else {
pos2 = pos;
length = readVLQ(pos);
- copy_bytes = 2 + (pos - pos2) + length;
+ copyBytes = 2 + (pos - pos2) + length;
}
if (event == 0x2F)
- --active_tracks;
+ --activeTracks;
} else {
warning("Bad MIDI command %02X", (int)event);
- track_pos[best_i] = 0;
+ trackPos[bestTrack] = 0;
}
// Update all tracks' deltas
if (write) {
- for (i = 0; i < _num_tracks; ++i) {
- if (track_pos[i] && i != best_i)
- track_timer[i] -= track_timer[best_i];
+ for (i = 0; i < _numTracks; ++i) {
+ if (trackPos[i] && i != bestTrack)
+ trackTimer[i] -= trackTimer[bestTrack];
}
}
- if (track_pos[best_i]) {
+ if (trackPos[bestTrack]) {
if (write) {
- track_timer[best_i] = 0;
+ trackTimer[bestTrack] = 0;
// Write VLQ delta
while (delta & 0x80) {
@@ -361,17 +361,17 @@ void MidiParser_SMF::compressToType0() {
// Write MIDI data
if (!implicitEvent)
- ++track_pos[best_i];
- --copy_bytes;
- *output++ = running_status[best_i];
- memcpy(output, track_pos[best_i], copy_bytes);
- output += copy_bytes;
+ ++trackPos[bestTrack];
+ --copyBytes;
+ *output++ = runningStatus[bestTrack];
+ memcpy(output, trackPos[bestTrack], copyBytes);
+ output += copyBytes;
}
// Fetch new VLQ delta for winning track
- track_pos[best_i] += copy_bytes;
- if (active_tracks)
- track_timer[best_i] += readVLQ(track_pos[best_i]);
+ trackPos[bestTrack] += copyBytes;
+ if (activeTracks)
+ trackTimer[bestTrack] += readVLQ(trackPos[bestTrack]);
}
}
diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp
index 85491faaf8..11690b0214 100644
--- a/audio/midiparser_xmidi.cpp
+++ b/audio/midiparser_xmidi.cpp
@@ -32,9 +32,6 @@
*/
class MidiParser_XMIDI : public MidiParser {
protected:
- NoteTimer _notes_cache[32];
- uint32 _inserted_delta; // Track simulated deltas for note-off events
-
struct Loop {
byte *pos;
byte repeat;
@@ -48,11 +45,10 @@ protected:
protected:
uint32 readVLQ2(byte * &data);
- void resetTracking();
void parseNextEvent(EventInfo &info);
public:
- MidiParser_XMIDI(XMidiCallbackProc proc, void *data) : _inserted_delta(0), _callbackProc(proc), _callbackData(data) {}
+ MidiParser_XMIDI(XMidiCallbackProc proc, void *data) : _callbackProc(proc), _callbackData(data) {}
~MidiParser_XMIDI() { }
bool loadMusic(byte *data, uint32 size);
@@ -69,17 +65,16 @@ uint32 MidiParser_XMIDI::readVLQ2(byte * &pos) {
}
void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
- info.start = _position._play_pos;
- info.delta = readVLQ2(_position._play_pos) - _inserted_delta;
+ info.start = _position._playPos;
+ info.delta = readVLQ2(_position._playPos);
// Process the next event.
- _inserted_delta = 0;
- info.event = *(_position._play_pos++);
+ info.event = *(_position._playPos++);
switch (info.event >> 4) {
case 0x9: // Note On
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
- info.length = readVLQ(_position._play_pos);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
+ info.length = readVLQ(_position._playPos);
if (info.basic.param2 == 0) {
info.event = info.channel() | 0x80;
info.length = 0;
@@ -88,20 +83,20 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
case 0xC:
case 0xD:
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
case 0x8:
case 0xA:
case 0xE:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
break;
case 0xB:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
// This isn't a full XMIDI implementation, but it should
// hopefully be "good enough" for most things.
@@ -109,7 +104,7 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
switch (info.basic.param1) {
// Simplified XMIDI looping.
case 0x74: { // XMIDI_CONTROLLER_FOR_LOOP
- byte *pos = _position._play_pos;
+ byte *pos = _position._playPos;
if (_loopCount < ARRAYSIZE(_loop) - 1)
_loopCount++;
else
@@ -131,9 +126,9 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
if (--_loop[_loopCount].repeat == 0)
_loopCount--;
else
- _position._play_pos = _loop[_loopCount].pos;
+ _position._playPos = _loop[_loopCount].pos;
} else {
- _position._play_pos = _loop[_loopCount].pos;
+ _position._playPos = _loop[_loopCount].pos;
}
}
}
@@ -169,12 +164,12 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
case 0xF: // Meta or SysEx event
switch (info.event & 0x0F) {
case 0x2: // Song Position Pointer
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
break;
case 0x3: // Song Select
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
@@ -188,16 +183,16 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
break;
case 0x0: // SysEx
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
break;
case 0xF: // META event
- info.ext.type = *(_position._play_pos++);
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.ext.type = *(_position._playPos++);
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
if (info.ext.type == 0x51 && info.length == 3) {
// Tempo event. We want to make these constant 500,000.
info.ext.data[0] = 0x07;
@@ -216,7 +211,7 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
uint32 i = 0;
byte *start;
uint32 len;
- uint32 chunk_len;
+ uint32 chunkLen;
char buf[32];
_loopCount = -1;
@@ -235,7 +230,7 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
if (!memcmp(pos, "XMID", 4)) {
warning("XMIDI doesn't have XDIR");
pos += 4;
- _num_tracks = 1;
+ _numTracks = 1;
} else if (memcmp(pos, "XDIR", 4)) {
// Not an XMIDI that we recognize
warning("Expected 'XDIR' but found '%c%c%c%c'", pos[0], pos[1], pos[2], pos[3]);
@@ -243,7 +238,7 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
} else {
// Seems Valid
pos += 4;
- _num_tracks = 0;
+ _numTracks = 0;
for (i = 4; i < len; i++) {
// Read 4 bytes of type
@@ -251,34 +246,34 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
pos += 4;
// Read length of chunk
- chunk_len = read4high(pos);
+ chunkLen = read4high(pos);
// Add eight bytes
i += 8;
if (memcmp(buf, "INFO", 4) == 0) {
// Must be at least 2 bytes long
- if (chunk_len < 2) {
- warning("Invalid chunk length %d for 'INFO' block", (int)chunk_len);
+ if (chunkLen < 2) {
+ warning("Invalid chunk length %d for 'INFO' block", (int)chunkLen);
return false;
}
- _num_tracks = (byte)read2low(pos);
+ _numTracks = (byte)read2low(pos);
- if (chunk_len > 2) {
- warning("Chunk length %d is greater than 2", (int)chunk_len);
- //pos += chunk_len - 2;
+ if (chunkLen > 2) {
+ warning("Chunk length %d is greater than 2", (int)chunkLen);
+ //pos += chunkLen - 2;
}
break;
}
// Must align
- pos += (chunk_len + 1) & ~1;
- i += (chunk_len + 1) & ~1;
+ pos += (chunkLen + 1) & ~1;
+ i += (chunkLen + 1) & ~1;
}
// Didn't get to fill the header
- if (_num_tracks == 0) {
+ if (_numTracks == 0) {
warning("Didn't find a valid track count");
return false;
}
@@ -308,13 +303,13 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
// Ok it's an XMIDI.
// We're going to identify and store the location for each track.
- if (_num_tracks > ARRAYSIZE(_tracks)) {
- warning("Can only handle %d tracks but was handed %d", (int)ARRAYSIZE(_tracks), (int)_num_tracks);
+ if (_numTracks > ARRAYSIZE(_tracks)) {
+ warning("Can only handle %d tracks but was handed %d", (int)ARRAYSIZE(_tracks), (int)_numTracks);
return false;
}
- int tracks_read = 0;
- while (tracks_read < _num_tracks) {
+ int tracksRead = 0;
+ while (tracksRead < _numTracks) {
if (!memcmp(pos, "FORM", 4)) {
// Skip this plus the 4 bytes after it.
pos += 8;
@@ -330,11 +325,11 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
pos += (len + 1) & ~1;
} else if (!memcmp(pos, "EVNT", 4)) {
// Ahh! What we're looking for at last.
- _tracks[tracks_read] = pos + 8; // Skip the EVNT and length bytes
+ _tracks[tracksRead] = pos + 8; // Skip the EVNT and length bytes
pos += 4;
len = read4high(pos);
pos += (len + 1) & ~1;
- ++tracks_read;
+ ++tracksRead;
} else {
warning("Hit invalid block '%c%c%c%c' while scanning for track locations", pos[0], pos[1], pos[2], pos[3]);
return false;
@@ -349,7 +344,6 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
_ppqn = 60;
resetTracking();
setTempo(500000);
- _inserted_delta = 0;
setTrack(0);
return true;
}
@@ -357,11 +351,6 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
return false;
}
-void MidiParser_XMIDI::resetTracking() {
- MidiParser::resetTracking();
- _inserted_delta = 0;
-}
-
void MidiParser::defaultXMidiCallback(byte eventData, void *data) {
warning("MidiParser: defaultXMidiCallback(%d)", eventData);
}
diff --git a/audio/mixer.h b/audio/mixer.h
index e38e052bef..a0060f2e1a 100644
--- a/audio/mixer.h
+++ b/audio/mixer.h
@@ -97,7 +97,7 @@ public:
* @param stream the actual AudioStream to be played
* @param id a unique id assigned to this stream
* @param volume the volume with which to play the sound, ranging from 0 to 255
- * @param balance the balance with which to play the sound, ranging from -128 to 127
+ * @param balance the balance with which to play the sound, ranging from -127 to 127 (full left to full right), 0 is balanced, -128 is invalid
* @param autofreeStream a flag indicating whether the stream should be
* freed after playback finished
* @param permanent a flag indicating whether a plain stopAll call should
diff --git a/audio/mods/maxtrax.h b/audio/mods/maxtrax.h
index c61f4e1b50..ffb176c241 100644
--- a/audio/mods/maxtrax.h
+++ b/audio/mods/maxtrax.h
@@ -20,11 +20,8 @@
*
*/
-// see if all engines using this class are DISABLED
-#if !defined(ENABLE_KYRA)
-
-// normal Header Guard
-#elif !defined AUDIO_MODS_MAXTRAX_H
+// Only compiled if Kyra is built-in or we're building for dynamic modules
+#if !defined(AUDIO_MODS_MAXTRAX_H) && (defined(ENABLE_KYRA) || defined(DYNAMIC_MODULES))
#define AUDIO_MODS_MAXTRAX_H
// #define MAXTRAX_HAS_MODULATION
@@ -219,4 +216,4 @@ private:
};
} // End of namespace Audio
-#endif // !defined AUDIO_MODS_MAXTRAX_H
+#endif // !defined(AUDIO_MODS_MAXTRAX_H)
diff --git a/audio/mods/protracker.cpp b/audio/mods/protracker.cpp
index 084b0edf9a..1e18d5adf8 100644
--- a/audio/mods/protracker.cpp
+++ b/audio/mods/protracker.cpp
@@ -61,6 +61,7 @@ private:
struct {
byte sample;
+ byte lastSample;
uint16 period;
Offset offset;
@@ -184,6 +185,7 @@ void ProtrackerStream::updateRow() {
_track[track].vibratoPos = 0;
}
_track[track].sample = note.sample;
+ _track[track].lastSample = note.sample;
_track[track].finetune = _module.sample[note.sample - 1].finetune;
_track[track].vol = _module.sample[note.sample - 1].vol;
}
@@ -194,7 +196,9 @@ void ProtrackerStream::updateRow() {
_track[track].period = _module.noteToPeriod(note.note, _track[track].finetune);
else
_track[track].period = note.period;
+
_track[track].offset = Offset(0);
+ _track[track].sample = _track[track].lastSample;
}
}
diff --git a/audio/mods/protracker.h b/audio/mods/protracker.h
index d52322f07e..5f47c4453b 100644
--- a/audio/mods/protracker.h
+++ b/audio/mods/protracker.h
@@ -25,6 +25,7 @@
* Sound decoder used in engines:
* - agos
* - parallaction
+ * - gob
*/
#ifndef AUDIO_MODS_PROTRACKER_H
diff --git a/audio/mods/tfmx.h b/audio/mods/tfmx.h
index 4174fbfb27..ebe1172278 100644
--- a/audio/mods/tfmx.h
+++ b/audio/mods/tfmx.h
@@ -20,11 +20,8 @@
*
*/
-// see if all engines using this class are DISABLED
-#if !defined(ENABLE_SCUMM)
-
-// normal Header Guard
-#elif !defined(AUDIO_MODS_TFMX_H)
+// Only compiled if SCUMM is built-in or we're building for dynamic modules
+#if !defined(AUDIO_MODS_TFMX_H) && (defined(ENABLE_SCUMM) || defined(DYNAMIC_MODULES))
#define AUDIO_MODS_TFMX_H
#include "audio/mods/paula.h"
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
index f3835c4524..75e6bc3d10 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
@@ -1175,7 +1175,7 @@ void TownsPC98_AudioDriver::loadMusicData(uint8 *data, bool loadPaused) {
_patches = src_a + 4;
_finishedChannelsFlag = _finishedSSGFlag = _finishedRhythmFlag = 0;
- _musicPlaying = (loadPaused ? false : true);
+ _musicPlaying = !loadPaused;
}
void TownsPC98_AudioDriver::loadSoundEffectData(uint8 *data, uint8 trackNum) {
diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp
index c9bd86b54a..75912f38a8 100644
--- a/audio/softsynth/mt32/Part.cpp
+++ b/audio/softsynth/mt32/Part.cpp
@@ -411,7 +411,7 @@ void RhythmPart::noteOn(unsigned int midiKey, unsigned int velocity) {
// 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);
+ 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);
diff --git a/audio/softsynth/mt32/Partial.h b/audio/softsynth/mt32/Partial.h
index 95218c858c..5e250769ec 100644
--- a/audio/softsynth/mt32/Partial.h
+++ b/audio/softsynth/mt32/Partial.h
@@ -37,7 +37,7 @@ private:
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;
+ unsigned long sampleNum;
int ownerPart; // -1 if unassigned
int mixType;
diff --git a/audio/softsynth/mt32/PartialManager.cpp b/audio/softsynth/mt32/PartialManager.cpp
index 42a3eaa179..0a6be826d6 100644
--- a/audio/softsynth/mt32/PartialManager.cpp
+++ b/audio/softsynth/mt32/PartialManager.cpp
@@ -148,7 +148,7 @@ bool PartialManager::abortFirstPolyPreferHeldWhereReserveExceeded(int minPart) {
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:
+ // 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.
diff --git a/audio/softsynth/mt32/Structures.h b/audio/softsynth/mt32/Structures.h
index e4d98ad1fc..cbce89ae18 100644
--- a/audio/softsynth/mt32/Structures.h
+++ b/audio/softsynth/mt32/Structures.h
@@ -42,7 +42,7 @@ typedef signed char Bit8s;
// 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__)
+#if defined(_MSC_VER) || defined(__MINGW32__)
#pragma pack(push, 1)
#else
#pragma pack(1)
@@ -172,7 +172,7 @@ struct MemParams {
} MT32EMU_ALIGN_PACKED system;
};
-#if defined(_MSC_VER) || defined (__MINGW32__)
+#if defined(_MSC_VER) || defined(__MINGW32__)
#pragma pack(pop)
#else
#pragma pack()
diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp
index 0861053b5c..7a1b5c2275 100644
--- a/audio/softsynth/mt32/Synth.cpp
+++ b/audio/softsynth/mt32/Synth.cpp
@@ -1156,7 +1156,7 @@ void Synth::writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u le
DT(partial[x].tva.envLevel[0]); \
DT(partial[x].tva.envLevel[1]); \
DT(partial[x].tva.envLevel[2]); \
- DT(partial[x].tva.envLevel[3]);
+ DT(partial[x].tva.envLevel[3]);
DTP(0);
DTP(1);
diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp
index c3be6db591..f3e3f7bbc7 100644
--- a/audio/softsynth/mt32/TVA.cpp
+++ b/audio/softsynth/mt32/TVA.cpp
@@ -274,7 +274,7 @@ void TVA::nextPhase() {
}
int newTarget;
- int newIncrement;
+ int newIncrement = 0;
int envPointIndex = phase;
if (!allLevelsZeroFromNowOn) {
diff --git a/audio/softsynth/mt32/TVF.cpp b/audio/softsynth/mt32/TVF.cpp
index 58f72e5a9b..80b592ea67 100644
--- a/audio/softsynth/mt32/TVF.cpp
+++ b/audio/softsynth/mt32/TVF.cpp
@@ -64,11 +64,11 @@ static int calcBaseCutoff(const TimbreParam::PartialParam *partialParam, Bit32u
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
+ 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
+ // baseCutoff range now: -10164 to 10164
}
} else {
// biasPoint range here: 64 to 127
diff --git a/audio/softsynth/mt32/freeverb.cpp b/audio/softsynth/mt32/freeverb.cpp
index de8f2632cb..181b878596 100644
--- a/audio/softsynth/mt32/freeverb.cpp
+++ b/audio/softsynth/mt32/freeverb.cpp
@@ -202,7 +202,7 @@ void revmodel::process(const float *inputL, const float *inputR, float *outputL,
// Calculate output REPLACING anything already there
*outputL = outL*wet1 + outR*wet2;
*outputR = outR*wet1 + outL*wet2;
-
+
inputL++;
inputR++;
outputL++;
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp
index dd3c354045..c54f620a10 100644
--- a/audio/softsynth/opl/mame.cpp
+++ b/audio/softsynth/opl/mame.cpp
@@ -33,7 +33,7 @@
#include "common/textconsole.h"
#include "common/util.h"
-#if defined (_WIN32_WCE) || defined (__SYMBIAN32__) || defined(__GP32__) || defined(GP2X) || defined (__MAEMO__) || defined(__DS__) || defined (__MINT__) || defined(__N64__)
+#if defined(_WIN32_WCE) || defined(__SYMBIAN32__) || defined(__GP32__) || defined(GP2X) || defined(__MAEMO__) || defined(__DS__) || defined(__MINT__) || defined(__N64__)
#include "common/config-manager.h"
#endif
@@ -1226,7 +1226,7 @@ FM_OPL *makeAdLibOPL(int rate) {
// We need to emulate one YM3812 chip
int env_bits = FMOPL_ENV_BITS_HQ;
int eg_ent = FMOPL_EG_ENT_HQ;
-#if defined (_WIN32_WCE) || defined(__SYMBIAN32__) || defined(__GP32__) || defined (GP2X) || defined(__MAEMO__) || defined(__DS__) || defined (__MINT__) || defined(__N64__)
+#if defined(_WIN32_WCE) || defined(__SYMBIAN32__) || defined(__GP32__) || defined(GP2X) || defined(__MAEMO__) || defined(__DS__) || defined(__MINT__) || defined(__N64__)
if (ConfMan.hasKey("FM_high_quality") && ConfMan.getBool("FM_high_quality")) {
env_bits = FMOPL_ENV_BITS_HQ;
eg_ent = FMOPL_EG_ENT_HQ;
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index b4e106b790..91118d36c1 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -161,49 +161,6 @@ GPHEventSource::GPHEventSource()
: _buttonStateL(false) {
}
-void GPHEventSource::moveStick() {
- bool stickBtn[32];
-
- memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
-
- if ((stickBtn[0]) || (stickBtn[2]) || (stickBtn[4]) || (stickBtn[6]))
- stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
-
- if ((stickBtn[1]) || (stickBtn[2]) || (stickBtn[3])) {
- if (_km.x_down_count != 2) {
- _km.x_vel = -1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = -4;
- } else if ((stickBtn[5]) || (stickBtn[6]) || (stickBtn[7])) {
- if (_km.x_down_count != 2) {
- _km.x_vel = 1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = 4;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-
- if ((stickBtn[0]) || (stickBtn[1]) || (stickBtn[7])) {
- if (_km.y_down_count != 2) {
- _km.y_vel = -1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = -4;
- } else if ((stickBtn[3]) || (stickBtn[4]) || (stickBtn[5])) {
- if (_km.y_down_count != 2) {
- _km.y_vel = 1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = 4;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-}
-
/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
@@ -268,19 +225,110 @@ bool GPHEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 1;
event.kbd.flags = 0;
switch (ev.jbutton.button) {
case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
+ if (_km.y_down_count != 2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
+ if (_km.y_down_count != 2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_LEFT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
case BUTTON_RIGHT:
+ if (_km.x_down_count != 3) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_UPLEFT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = -4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
case BUTTON_UPRIGHT:
- moveStick();
+ if (_km.x_down_count != 2) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_DOWNLEFT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = -4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_DOWNRIGHT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 4;
+ }
event.type = Common::EVENT_MOUSEMOVE;
processMouseEvent(event, _km.x, _km.y);
break;
@@ -391,7 +439,6 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 0;
event.kbd.flags = 0;
switch (ev.jbutton.button) {
@@ -403,7 +450,10 @@ bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
case BUTTON_DOWNRIGHT:
case BUTTON_RIGHT:
case BUTTON_UPRIGHT:
- moveStick();
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
event.type = Common::EVENT_MOUSEMOVE;
processMouseEvent(event, _km.x, _km.y);
break;
diff --git a/backends/events/gph/gph-events.h b/backends/events/gph/gph-events.h
index 7672bffed2..3b1e6f090a 100644
--- a/backends/events/gph/gph-events.h
+++ b/backends/events/gph/gph-events.h
@@ -34,18 +34,11 @@ public:
GPHEventSource();
protected:
- bool _stickBtn[32];
-
/**
* Button state for L button modifier
*/
bool _buttonStateL;
- /**
- * Handles the stick movement
- */
- void moveStick();
-
bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp
index c1d6362fcb..fc63cdf74f 100644
--- a/backends/events/openpandora/op-events.cpp
+++ b/backends/events/openpandora/op-events.cpp
@@ -44,7 +44,8 @@ enum {
/* Touchscreen TapMode */
TAPMODE_LEFT = 0,
TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
+ TAPMODE_HOVER = 2,
+ TAPMODE_HOVER_DPAD = 3
};
OPEventSource::OPEventSource()
@@ -63,6 +64,8 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_RBUTTONDOWN;
else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
} else if (ev.button.button == SDL_BUTTON_RIGHT)
@@ -95,6 +98,8 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_RBUTTONUP;
else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
} else if (ev.button.button == SDL_BUTTON_RIGHT)
@@ -117,6 +122,30 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
+ if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ switch (ev.key.keysym.sym) {
+ case SDLK_LEFT:
+ event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP;
+ processMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+ case SDLK_RIGHT:
+ event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP;
+ processMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+#if defined(SDL_BUTTON_MIDDLE)
+ case SDLK_UP:
+ event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_MBUTTONDOWN : Common::EVENT_MBUTTONUP;
+ processMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+
if (ev.type == SDL_KEYDOWN) {
switch (ev.key.keysym.sym) {
case SDLK_HOME:
@@ -141,6 +170,8 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
} else if (OP::tapmodeLevel == TAPMODE_HOVER) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
+ } else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (DPad Clicks)"));
}
break;
case SDLK_RSHIFT:
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index f94171646a..0ca5bbb059 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -191,6 +191,8 @@ void SdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event) {
#endif
if (mod & KMOD_CTRL)
event.kbd.flags |= Common::KBD_CTRL;
+ if (mod & KMOD_META)
+ event.kbd.flags |= Common::KBD_META;
// Sticky flags
if (mod & KMOD_NUM)
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index 2ba88c702b..ca4835126f 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -116,7 +116,7 @@ protected:
//@}
/**
- * Assigns the mouse coords to the mouse event. Furthermore notify the
+ * Assigns the mouse coords to the mouse event. Furthermore notify the
* graphics manager about the position change.
*/
virtual void processMouseEvent(Common::Event &event, int x, int y);
diff --git a/backends/events/webossdl/webossdl-events.h b/backends/events/webossdl/webossdl-events.h
index 99ed3105f8..1ba5c6fcbf 100644
--- a/backends/events/webossdl/webossdl-events.h
+++ b/backends/events/webossdl/webossdl-events.h
@@ -73,10 +73,10 @@ protected:
// The current mouse position on the screen.
int _curX, _curY;
-
+
// The current screen dimensions
int _screenX, _screenY;
-
+
// The drag distance for linear gestures
int _swipeDistX, _swipeDistY;
@@ -107,7 +107,7 @@ protected:
virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
virtual bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
virtual bool pollEvent(Common::Event &event);
-
+
// Utility functions
void calculateDimensions();
};
diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp
index fc78f7580b..7a652fa43c 100644
--- a/backends/fs/symbian/symbian-fs.cpp
+++ b/backends/fs/symbian/symbian-fs.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#if defined (__SYMBIAN32__)
+#if defined(__SYMBIAN32__)
#include "backends/fs/symbian/symbian-fs.h"
#include "backends/fs/symbian/symbianstream.h"
@@ -230,4 +230,4 @@ Common::SeekableReadStream *SymbianFilesystemNode::createReadStream() {
Common::WriteStream *SymbianFilesystemNode::createWriteStream() {
return SymbianStdioStream::makeFromPath(getPath(), true);
}
-#endif //#if defined (__SYMBIAN32__)
+#endif //#if defined(__SYMBIAN32__)
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 17a95688f3..bd87c9fafd 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -218,7 +218,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
ScalerProc *scalerProc;
int scale1;
-#if defined (DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
+#if defined(DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
assert(_hwscreen != NULL);
assert(_hwscreen->map->sw_data != NULL);
#endif
@@ -432,7 +432,7 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() {
// Forcefully disable aspect ratio correction for games
// which starts with a native 240px height resolution.
// This fixes games with weird resolutions, like MM Nes (256x240)
- if(_videoMode.screenHeight == 240) {
+ if (_videoMode.screenHeight == 240) {
_videoMode.aspectRatioCorrection = false;
}
@@ -479,7 +479,7 @@ void DINGUXSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable)
case OSystem::kFeatureCursorPalette:
_cursorPaletteDisabled = !enable;
blitCursor();
- break;
+ break;
default:
break;
}
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index a0c1d9ad2b..92553564bf 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -245,7 +245,7 @@ void GPHGraphicsManager::internUpdateScreen() {
ScalerProc *scalerProc;
int scale1;
-#if defined (DEBUG)
+#if defined(DEBUG)
assert(_hwscreen != NULL);
assert(_hwscreen->map->sw_data != NULL);
#endif
@@ -486,7 +486,13 @@ bool GPHGraphicsManager::loadGFXMode() {
if (_videoMode.aspectRatioCorrection)
_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
}
- return SurfaceSdlGraphicsManager::loadGFXMode();
+ SurfaceSdlGraphicsManager::loadGFXMode();
+
+ // The old GP2X hacked SDL needs this after any call to SDL_SetVideoMode
+ // and it does not hurt other devices.
+ SDL_ShowCursor(SDL_DISABLE);
+
+ return true;
}
bool GPHGraphicsManager::hasFeature(OSystem::Feature f) {
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 3f282df587..24397228e6 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -60,7 +60,7 @@ public:
virtual int16 getWidth() = 0;
virtual void setPalette(const byte *colors, uint start, uint num) = 0;
virtual void grabPalette(byte *colors, uint start, uint num) = 0;
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
virtual Graphics::Surface *lockScreen() = 0;
virtual void unlockScreen() = 0;
virtual void fillScreen(uint32 col) = 0;
@@ -73,14 +73,14 @@ public:
virtual void hideOverlay() = 0;
virtual Graphics::PixelFormat getOverlayFormat() const = 0;
virtual void clearOverlay() = 0;
- virtual void grabOverlay(OverlayColor *buf, int pitch) = 0;
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h)= 0;
+ virtual void grabOverlay(void *buf, int pitch) = 0;
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)= 0;
virtual int16 getOverlayHeight() = 0;
virtual int16 getOverlayWidth() = 0;
virtual bool showMouse(bool visible) = 0;
virtual void warpMouse(int x, int y) = 0;
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0;
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0;
virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0;
virtual void displayMessageOnOSD(const char *msg) {}
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
index de9838a0d7..a005d74919 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
@@ -259,7 +259,7 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() {
ScalerProc *scalerProc;
int scale1;
-#if defined (DEBUG) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
+#if defined(DEBUG) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
assert(_hwscreen != NULL);
assert(_hwscreen->map->sw_data != NULL);
#endif
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 2e6b24d147..276be7d3fa 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -58,7 +58,7 @@ public:
int16 getWidth() { return 0; }
void setPalette(const byte *colors, uint start, uint num) {}
void grabPalette(byte *colors, uint start, uint num) {}
- void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {}
+ void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {}
Graphics::Surface *lockScreen() { return NULL; }
void unlockScreen() {}
void fillScreen(uint32 col) {}
@@ -71,14 +71,14 @@ public:
void hideOverlay() {}
Graphics::PixelFormat getOverlayFormat() const { return Graphics::PixelFormat(); }
void clearOverlay() {}
- void grabOverlay(OverlayColor *buf, int pitch) {}
- void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {}
+ void grabOverlay(void *buf, int pitch) {}
+ void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {}
int16 getOverlayHeight() { return 0; }
int16 getOverlayWidth() { return 0; }
bool showMouse(bool visible) { return !visible; }
void warpMouse(int x, int y) {}
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) {}
+ void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {}
void setCursorPalette(const byte *colors, uint start, uint num) {}
};
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 45804b5d6e..48e2663d44 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -49,7 +49,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
_transactionMode(kTransactionNone),
_cursorNeedsRedraw(false), _cursorPaletteDisabled(true),
_cursorVisible(false), _cursorKeyColor(0),
- _cursorTargetScale(1),
+ _cursorDontScale(false),
_formatBGR(false),
_displayX(0), _displayY(0), _displayWidth(0), _displayHeight(0) {
@@ -70,6 +70,11 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() {
free(_gamePalette);
free(_cursorPalette);
+ _screenData.free();
+ _overlayData.free();
+ _cursorData.free();
+ _osdSurface.free();
+
delete _gameTexture;
delete _overlayTexture;
delete _cursorTexture;
@@ -344,14 +349,14 @@ void OpenGLGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
memcpy(colors, _gamePalette + start * 3, num * 3);
}
-void OpenGLGraphicsManager::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void OpenGLGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
assert(x >= 0 && x < _screenData.w);
assert(y >= 0 && y < _screenData.h);
assert(h > 0 && y + h <= _screenData.h);
assert(w > 0 && x + w <= _screenData.w);
// Copy buffer data to game screen internal buffer
- const byte *src = buf;
+ const byte *src = (const byte *)buf;
byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.format.bytesPerPixel;
for (int i = 0; i < h; i++) {
memcpy(dst, src, w * _screenData.format.bytesPerPixel);
@@ -462,33 +467,35 @@ void OpenGLGraphicsManager::clearOverlay() {
_overlayNeedsRedraw = true;
}
-void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
- assert(_overlayData.format.bytesPerPixel == sizeof(buf[0]));
+void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) {
const byte *src = (byte *)_overlayData.pixels;
+ byte *dst = (byte *)buf;
for (int i = 0; i < _overlayData.h; i++) {
// Copy overlay data to buffer
- memcpy(buf, src, _overlayData.pitch);
- buf += pitch;
+ memcpy(dst, src, _overlayData.pitch);
+ dst += pitch;
src += _overlayData.pitch;
}
}
-void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OpenGLGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
if (_overlayTexture == NULL)
return;
+ const byte *src = (const byte *)buf;
+
// Clip the coordinates
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * 2;
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -502,11 +509,10 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch
return;
// 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]);
+ src += pitch;
dst += _overlayData.pitch;
}
@@ -586,7 +592,7 @@ void OpenGLGraphicsManager::warpMouse(int x, int y) {
setInternalMousePosition(scaledX, scaledY);
}
-void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
#ifdef USE_RGB_COLOR
if (format)
_cursorFormat = *format;
@@ -611,7 +617,7 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int
_cursorState.hotX = hotspotX;
_cursorState.hotY = hotspotY;
_cursorKeyColor = keycolor;
- _cursorTargetScale = cursorTargetScale;
+ _cursorDontScale = dontScale;
_cursorNeedsRedraw = true;
refreshCursorScale();
@@ -824,28 +830,19 @@ void OpenGLGraphicsManager::refreshCursor() {
}
void OpenGLGraphicsManager::refreshCursorScale() {
- // Calculate the scale factors of the screen. We limit ourselves to 3 at
- // most here to avoid really big (and ugly) cursors for big resolutions.
- // It might be noteworthy that 3 is the (current) target scale for the
- // modern theme and thus assures the cursor is *never* scaled.
+ // Calculate the scale factors of the screen.
// We also totally ignore the aspect of the overlay cursor, since aspect
// ratio correction only applies to the game screen.
- uint screenScaleFactorX = MIN(30000, _videoMode.hardwareWidth * 10000 / _videoMode.screenWidth);
- uint screenScaleFactorY = MIN(30000, _videoMode.hardwareHeight * 10000 / _videoMode.screenHeight);
-
- // Apply the target scale factor to the cursor.
- // It might be noteworthy we only apply any scaling to the cursor in case
- // the current scale factor is bigger than the target scale to match
- // SurfaceSdlGraphicsManager's behavior. Otherwise we would downscale the
- // GUI cursor of the modern theme for example.
- if (screenScaleFactorX > uint(_cursorTargetScale * 10000))
- screenScaleFactorX /= _cursorTargetScale;
- else
+ // TODO: It might make sense to always ignore scaling of the mouse cursor
+ // when the overlay is visible.
+ uint screenScaleFactorX = _videoMode.hardwareWidth * 10000 / _videoMode.screenWidth;
+ uint screenScaleFactorY = _videoMode.hardwareHeight * 10000 / _videoMode.screenHeight;
+
+ // Ignore scaling when the cursor should not be scaled.
+ if (_cursorDontScale) {
screenScaleFactorX = 10000;
- if (screenScaleFactorY > uint(_cursorTargetScale * 10000))
- screenScaleFactorY /= _cursorTargetScale;
- else
screenScaleFactorY = 10000;
+ }
// Apply them (without any possible) aspect ratio correction to the
// overlay.
@@ -854,16 +851,19 @@ void OpenGLGraphicsManager::refreshCursorScale() {
_cursorState.rHotX = (int16)(_cursorState.hotX * screenScaleFactorX / 10000);
_cursorState.rHotY = (int16)(_cursorState.hotY * screenScaleFactorY / 10000);
- // Make sure we properly scale the cursor according to the desired aspect.
- // It might be noteworthy that, unlike with the overlay, we do not limit
- // the scale factor here to avoid odd looks if the game uses items as
- // mouse cursor, which would otherwise suddenly be smaller.
- int width, height;
- calculateDisplaySize(width, height);
- screenScaleFactorX = (width * 10000 / _videoMode.screenWidth) / _cursorTargetScale;
- screenScaleFactorY = (height * 10000 / _videoMode.screenHeight) / _cursorTargetScale;
+ // Only apply scaling when it's desired.
+ if (_cursorDontScale) {
+ screenScaleFactorX = 10000;
+ screenScaleFactorY = 10000;
+ } else {
+ // Make sure we properly scale the cursor according to the desired aspect.
+ int width, height;
+ calculateDisplaySize(width, height);
+ screenScaleFactorX = (width * 10000 / _videoMode.screenWidth);
+ screenScaleFactorY = (height * 10000 / _videoMode.screenHeight);
+ }
- // Always scale the cursor for the game.
+ // Apply the scale cursor scaling for the game screen.
_cursorState.vW = (int16)(_cursorState.w * screenScaleFactorX / 10000);
_cursorState.vH = (int16)(_cursorState.h * screenScaleFactorY / 10000);
_cursorState.vHotX = (int16)(_cursorState.hotX * screenScaleFactorX / 10000);
@@ -902,7 +902,7 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
bpp = 4;
intFormat = GL_RGBA;
glFormat = GL_RGBA;
- gltype = GL_UNSIGNED_BYTE;
+ gltype = GL_UNSIGNED_INT_8_8_8_8;
} else if (pixelFormat == Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) { // RGB888
bpp = 3;
intFormat = GL_RGB;
@@ -918,11 +918,6 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
intFormat = GL_RGBA;
glFormat = GL_RGBA;
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
- } else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
- bpp = 2;
- intFormat = GL_RGB;
- glFormat = GL_BGRA;
- gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
} else if (pixelFormat == Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) { // RGBA4444
bpp = 2;
intFormat = GL_RGBA;
@@ -936,6 +931,13 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
glFormat = GL_RGB;
gltype = GL_UNSIGNED_BYTE;
#ifndef USE_GLES
+ } else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
+ // GL_BGRA does not exist in every GLES implementation so should not be configured if
+ // USE_GLES is set.
+ bpp = 2;
+ intFormat = GL_RGB;
+ glFormat = GL_BGRA;
+ gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
} else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24)) { // ARGB8888
bpp = 4;
intFormat = GL_RGBA;
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index ad8765bab1..9d8d418d11 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -84,7 +84,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
virtual void fillScreen(uint32 col);
@@ -97,14 +97,14 @@ public:
virtual void hideOverlay();
virtual Graphics::PixelFormat getOverlayFormat() const;
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual void displayMessageOnOSD(const char *msg);
@@ -283,7 +283,7 @@ protected:
MousePos _cursorState;
bool _cursorVisible;
uint32 _cursorKeyColor;
- int _cursorTargetScale;
+ bool _cursorDontScale;
bool _cursorNeedsRedraw;
/**
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index b37d631c6d..fed02ef22e 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -160,7 +160,7 @@ void OpenGLSdlGraphicsManager::detectSupportedFormats() {
_hwscreen->format->Rshift, _hwscreen->format->Gshift,
_hwscreen->format->Bshift, _hwscreen->format->Ashift);
- // Workaround to MacOSX SDL not providing an accurate Aloss value.
+ // Workaround to SDL not providing an accurate Aloss value on Mac OS X.
if (_hwscreen->format->Amask == 0)
format.aLoss = 8;
@@ -665,7 +665,7 @@ void OpenGLSdlGraphicsManager::notifyResize(const uint width, const uint height)
void OpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) {
adjustMousePosition(point.x, point.y);
}
-
+
void OpenGLSdlGraphicsManager::notifyMousePos(Common::Point mouse) {
setMousePosition(mouse.x, mouse.y);
}
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 5f0301a0c8..f371081fde 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -26,28 +26,59 @@
#include "backends/graphics/openpandora/op-graphics.h"
#include "backends/events/openpandora/op-events.h"
-//#include "backends/platform/openpandora/op-sdl.h"
#include "graphics/scaler/aspect.h"
#include "common/mutex.h"
#include "common/textconsole.h"
+static SDL_Cursor *hiddenCursor;
+
OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource)
: SurfaceSdlGraphicsManager(sdlEventSource) {
}
bool OPGraphicsManager::loadGFXMode() {
- /* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL
- deal with the boarders (it saves cleaning up the overlay when the game screen is
- smaller than the overlay ;)
+
+ uint8_t hiddenCursorData = 0;
+ hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
+ /* On the OpenPandora we need to work around an SDL assumption that
+ returns relative mouse coordinates when you get to the screen
+ edges using the touchscreen. The workaround is to set a blank
+ SDL cursor and not disable it (Hackish I know).
+
+ The root issues likes in the Windows Manager GRAB code in SDL.
+ That is why the issue is not seen on framebuffer devices like the
+ GP2X (there is no X window manager ;)).
*/
- _videoMode.overlayWidth = 640;
- _videoMode.overlayHeight = 480;
+ SDL_ShowCursor(SDL_ENABLE);
+ SDL_SetCursor(hiddenCursor);
+
_videoMode.fullscreen = true;
+ _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+
if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
_videoMode.aspectRatioCorrection = false;
+ if (_videoMode.aspectRatioCorrection)
+ _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+
+ _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.hardwareHeight = effectiveScreenHeight();
+
return SurfaceSdlGraphicsManager::loadGFXMode();
}
+void OPGraphicsManager::unloadGFXMode() {
+
+ uint8_t hiddenCursorData = 0;
+ hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
+ // Free the hidden SDL cursor created in loadGFXMode
+ SDL_FreeCursor(hiddenCursor);
+
+ SurfaceSdlGraphicsManager::unloadGFXMode();
+}
+
#endif
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index 0b3eeae8ec..2e3d63e3ad 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -24,7 +24,6 @@
#define BACKENDS_GRAPHICS_OP_H
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
@@ -35,28 +34,8 @@ class OPGraphicsManager : public SurfaceSdlGraphicsManager {
public:
OPGraphicsManager(SdlEventSource *sdlEventSource);
-// bool hasFeature(OSystem::Feature f);
-// void setFeatureState(OSystem::Feature f, bool enable);
-// bool getFeatureState(OSystem::Feature f);
-// int getDefaultGraphicsMode() const;
-
-// void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
-// const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
-// bool setGraphicsMode(const char *name);
-// bool setGraphicsMode(int mode);
-// void setGraphicsModeIntern();
-// void internUpdateScreen();
-// void showOverlay();
-// void hideOverlay();
bool loadGFXMode();
-// void drawMouse();
-// void undrawMouse();
-// virtual void warpMouse(int x, int y);
-
-// SurfaceSdlGraphicsManager::MousePos *getMouseCurState();
-// SurfaceSdlGraphicsManager::VideoState *getVideoMode();
-
-// virtual void adjustMouseEvent(const Common::Event &event);
+ void unloadGFXMode();
};
#endif /* BACKENDS_GRAPHICS_OP_H */
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index f3a1cad040..fb964d6951 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -63,17 +63,12 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Normal (no scaling)", "lowres")
-// Table of relative scalers magnitudes
-// [definedScale - 1][scaleFactor - 1]
-static ScalerProc *scalersMagn[3][3] = {
+// Table of the cursor scalers [scaleFactor - 1]
+static ScalerProc *scalersMagn[3] = {
#ifdef USE_SCALERS
- { Normal1x, AdvMame2x, AdvMame3x },
- { Normal1x, Normal1x, Normal1o5x },
- { Normal1x, Normal1x, Normal1x }
+ Normal1x, AdvMame2x, AdvMame3x
#else // remove dependencies on other scalers
- { Normal1x, Normal1x, Normal1x },
- { Normal1x, Normal1x, Normal1x },
- { Normal1x, Normal1x, Normal1x }
+ Normal1x, Normal1x, Normal1x
#endif
};
@@ -135,7 +130,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_overlayscreen(0), _tmpscreen2(0),
_scalerProc(0), _screenChangeCount(0),
_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
- _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
+ _mouseOrigSurface(0), _cursorDontScale(false), _cursorPaletteDisabled(true),
_currentShakePos(0), _newShakePos(0),
_paletteDirtyStart(0), _paletteDirtyEnd(0),
_screenIsLocked(false),
@@ -458,7 +453,7 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
_hwscreen->format->Rshift, _hwscreen->format->Gshift,
_hwscreen->format->Bshift, _hwscreen->format->Ashift);
- // Workaround to MacOSX SDL not providing an accurate Aloss value.
+ // Workaround to SDL not providing an accurate Aloss value on Mac OS X.
if (_hwscreen->format->Amask == 0)
format.aLoss = 8;
@@ -965,7 +960,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
int scale1;
// definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
-#if defined (DEBUG) && !defined(WIN32) && !defined(_WIN32_WCE)
+#if defined(DEBUG) && !defined(WIN32) && !defined(_WIN32_WCE)
assert(_hwscreen != NULL);
assert(_hwscreen->map->sw_data != NULL);
#endif
@@ -1232,9 +1227,9 @@ void SurfaceSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
}
}
-void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+void SurfaceSdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
- assert(src);
+ assert(buf);
if (_screen == NULL) {
warning("SurfaceSdlGraphicsManager::copyRectToScreen: _screen == NULL");
@@ -1257,8 +1252,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int
#ifdef USE_RGB_COLOR
byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x * _screenFormat.bytesPerPixel;
if (_videoMode.screenWidth == w && pitch == _screen->pitch) {
- memcpy(dst, src, h*pitch);
+ memcpy(dst, buf, h*pitch);
} else {
+ const byte *src = (const byte *)buf;
do {
memcpy(dst, src, w * _screenFormat.bytesPerPixel);
src += pitch;
@@ -1268,8 +1264,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int
#else
byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x;
if (_screen->pitch == pitch && pitch == w) {
- memcpy(dst, src, h*w);
+ memcpy(dst, buf, h*w);
} else {
+ const byte *src = (const byte *)buf;
do {
memcpy(dst, src, w);
src += pitch;
@@ -1600,7 +1597,7 @@ void SurfaceSdlGraphicsManager::clearOverlay() {
_forceFull = true;
}
-void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
+void SurfaceSdlGraphicsManager::grabOverlay(void *buf, int pitch) {
assert(_transactionMode == kTransactionNone);
if (_overlayscreen == NULL)
@@ -1610,31 +1607,35 @@ void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
error("SDL_LockSurface failed: %s", SDL_GetError());
byte *src = (byte *)_overlayscreen->pixels;
+ byte *dst = (byte *)buf;
int h = _videoMode.overlayHeight;
do {
- memcpy(buf, src, _videoMode.overlayWidth * 2);
+ memcpy(dst, src, _videoMode.overlayWidth * 2);
src += _overlayscreen->pitch;
- buf += pitch;
+ dst += pitch;
} while (--h);
SDL_UnlockSurface(_overlayscreen);
}
-void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
if (_overlayscreen == NULL)
return;
+ const byte *src = (const byte *)buf;
+
// Clip the coordinates
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * 2;
x = 0;
}
if (y < 0) {
- h += y; buf -= y * pitch;
+ h += y;
+ src -= y * pitch;
y = 0;
}
@@ -1657,9 +1658,9 @@ void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int p
byte *dst = (byte *)_overlayscreen->pixels + y * _overlayscreen->pitch + x * 2;
do {
- memcpy(dst, buf, w * 2);
+ memcpy(dst, src, w * 2);
dst += _overlayscreen->pitch;
- buf += pitch;
+ src += pitch;
} while (--h);
SDL_UnlockSurface(_overlayscreen);
@@ -1718,7 +1719,7 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) {
}
}
-void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
#ifdef USE_RGB_COLOR
if (!format)
_cursorFormat = Graphics::PixelFormat::createFormatCLUT8();
@@ -1739,7 +1740,7 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h,
_mouseKeyColor = keycolor;
- _cursorTargetScale = cursorTargetScale;
+ _cursorDontScale = dontScale;
if (_mouseCurState.w != (int)w || _mouseCurState.h != (int)h) {
_mouseCurState.w = w;
@@ -1847,51 +1848,34 @@ void SurfaceSdlGraphicsManager::blitCursor() {
}
int rW, rH;
+ int cursorScale;
- if (_cursorTargetScale >= _videoMode.scaleFactor) {
- // The cursor target scale is greater or equal to the scale at
- // which the rest of the screen is drawn. We do not downscale
- // the cursor image, we draw it at its original size. It will
- // appear too large on screen.
-
- rW = w;
- rH = h;
- _mouseCurState.rHotX = _mouseCurState.hotX;
- _mouseCurState.rHotY = _mouseCurState.hotY;
-
- // The virtual dimensions may be larger than the original.
-
- _mouseCurState.vW = w * _cursorTargetScale / _videoMode.scaleFactor;
- _mouseCurState.vH = h * _cursorTargetScale / _videoMode.scaleFactor;
- _mouseCurState.vHotX = _mouseCurState.hotX * _cursorTargetScale /
- _videoMode.scaleFactor;
- _mouseCurState.vHotY = _mouseCurState.hotY * _cursorTargetScale /
- _videoMode.scaleFactor;
+ if (_cursorDontScale) {
+ // Don't scale the cursor at all if the user requests this behavior.
+ cursorScale = 1;
} else {
- // The cursor target scale is smaller than the scale at which
- // the rest of the screen is drawn. We scale up the cursor
- // image to make it appear correct.
+ // Scale the cursor with the game screen scale factor.
+ cursorScale = _videoMode.scaleFactor;
+ }
- rW = w * _videoMode.scaleFactor / _cursorTargetScale;
- rH = h * _videoMode.scaleFactor / _cursorTargetScale;
- _mouseCurState.rHotX = _mouseCurState.hotX * _videoMode.scaleFactor /
- _cursorTargetScale;
- _mouseCurState.rHotY = _mouseCurState.hotY * _videoMode.scaleFactor /
- _cursorTargetScale;
+ // Adapt the real hotspot according to the scale factor.
+ rW = w * cursorScale;
+ rH = h * cursorScale;
+ _mouseCurState.rHotX = _mouseCurState.hotX * cursorScale;
+ _mouseCurState.rHotY = _mouseCurState.hotY * cursorScale;
- // The virtual dimensions will be the same as the original.
+ // The virtual dimensions will be the same as the original.
- _mouseCurState.vW = w;
- _mouseCurState.vH = h;
- _mouseCurState.vHotX = _mouseCurState.hotX;
- _mouseCurState.vHotY = _mouseCurState.hotY;
- }
+ _mouseCurState.vW = w;
+ _mouseCurState.vH = h;
+ _mouseCurState.vHotX = _mouseCurState.hotX;
+ _mouseCurState.vHotY = _mouseCurState.hotY;
#ifdef USE_SCALERS
int rH1 = rH; // store original to pass to aspect-correction function later
#endif
- if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) {
+ if (!_cursorDontScale && _videoMode.aspectRatioCorrection) {
rH = real2Aspect(rH - 1) + 1;
_mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY);
}
@@ -1922,21 +1906,25 @@ void SurfaceSdlGraphicsManager::blitCursor() {
ScalerProc *scalerProc;
- // If possible, use the same scaler for the cursor as for the rest of
- // the game. This only works well with the non-blurring scalers so we
- // actually only use the 1x, 1.5x, 2x and AdvMame scalers.
-
- if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE))
- scalerProc = _scalerProc;
- else
- scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1];
+ // Only apply scaling, when the user allows it.
+ if (!_cursorDontScale) {
+ // If possible, use the same scaler for the cursor as for the rest of
+ // the game. This only works well with the non-blurring scalers so we
+ // actually only use the 1x, 2x and AdvMame scalers.
+ if (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE)
+ scalerProc = _scalerProc;
+ else
+ scalerProc = scalersMagn[_videoMode.scaleFactor - 1];
+ } else {
+ scalerProc = Normal1x;
+ }
scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2,
_mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch,
_mouseCurState.w, _mouseCurState.h);
#ifdef USE_SCALERS
- if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1)
+ if (!_cursorDontScale && _videoMode.aspectRatioCorrection)
cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
#endif
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index f71096d43e..21444cc25d 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -111,7 +111,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
virtual void fillScreen(uint32 col);
@@ -124,14 +124,14 @@ public:
virtual void hideOverlay();
virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; }
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight() { return _videoMode.overlayHeight; }
virtual int16 getOverlayWidth() { return _videoMode.overlayWidth; }
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
#ifdef USE_OSD
@@ -281,7 +281,7 @@ protected:
#else
byte _mouseKeyColor;
#endif
- int _cursorTargetScale;
+ bool _cursorDontScale;
bool _cursorPaletteDisabled;
SDL_Surface *_mouseOrigSurface;
SDL_Surface *_mouseSurface;
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 58b735ef8b..f075f8cf8a 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -1023,22 +1023,24 @@ bool WINCESdlGraphicsManager::saveScreenshot(const char *filename) {
return true;
}
-void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void WINCESdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
if (_overlayscreen == NULL)
return;
+ const byte *src = (const byte *)buf;
+
// Clip the coordinates
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * 2;
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -1063,23 +1065,24 @@ void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pit
byte *dst = (byte *)_overlayscreen->pixels + y * _overlayscreen->pitch + x * 2;
do {
- memcpy(dst, buf, w * 2);
+ memcpy(dst, src, w * 2);
dst += _overlayscreen->pitch;
- buf += pitch;
+ src += pitch;
} while (--h);
SDL_UnlockSurface(_overlayscreen);
}
-void WINCESdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+void WINCESdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
- assert(src);
+ assert(buf);
if (_screen == NULL)
return;
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
+ const byte *src = (const byte *)buf;
/* Clip the coordinates */
if (x < 0) {
w += x;
@@ -1128,7 +1131,7 @@ void WINCESdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x
SDL_UnlockSurface(_screen);
}
-void WINCESdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+void WINCESdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
undrawMouse();
if (w == 0 || h == 0)
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h
index 2e8c3313b3..2897ca5f40 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -73,9 +73,9 @@ public:
void internDrawMouse();
void undrawMouse();
bool showMouse(bool visible);
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend
- void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
- void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
+ void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // overloaded by CE backend
+ void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
+ void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
Graphics::Surface *lockScreen();
void unlockScreen();
void blitCursor();
diff --git a/backends/keymapper/hardware-input.cpp b/backends/keymapper/hardware-input.cpp
index a09f0b54fc..d1f8822ac0 100644
--- a/backends/keymapper/hardware-input.cpp
+++ b/backends/keymapper/hardware-input.cpp
@@ -209,16 +209,33 @@ const HardwareInput *HardwareInputSet::findHardwareInput(String id) const {
return 0;
}
+const HardwareInput *HardwareInputSet::findHardwareInput(const HardwareInputCode code) const {
+ List<const HardwareInput *>::const_iterator it;
+
+ for (it = _inputs.begin(); it != _inputs.end(); ++it) {
+ const HardwareInput *entry = *it;
+ if (entry->type == kHardwareInputTypeGeneric && entry->inputCode == code)
+ return entry;
+ }
+ return 0;
+}
+
const HardwareInput *HardwareInputSet::findHardwareInput(const KeyState& keystate) const {
List<const HardwareInput *>::const_iterator it;
for (it = _inputs.begin(); it != _inputs.end(); ++it) {
- if ((*it)->key == keystate)
- return (*it);
+ const HardwareInput *entry = *it;
+ if (entry->type == kHardwareInputTypeKeyboard && entry->key == keystate)
+ return entry;
}
return 0;
}
+void HardwareInputSet::addHardwareInputs(const HardwareInputTableEntry inputs[]) {
+ for (const HardwareInputTableEntry *entry = inputs; entry->hwId; ++entry)
+ addHardwareInput(new HardwareInput(entry->hwId, entry->code, entry->desc));
+}
+
void HardwareInputSet::addHardwareInputs(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
const KeyTableEntry *key;
const ModifierTableEntry *mod;
@@ -247,10 +264,6 @@ void HardwareInputSet::addHardwareInputs(const KeyTableEntry keys[], const Modif
}
}
-void HardwareInputSet::addHardwareInputs(const KeyTableEntry keys[]) {
- addHardwareInputs(keys, defaultModifiers);
-}
-
void HardwareInputSet::removeHardwareInput(const HardwareInput *input) {
if (!input)
return;
@@ -259,7 +272,16 @@ void HardwareInputSet::removeHardwareInput(const HardwareInput *input) {
for (it = _inputs.begin(); it != _inputs.end(); ++it) {
const HardwareInput *entry = (*it);
- if (entry->id == input->id || entry->key == input->key) {
+ bool match = false;
+ if (entry->id == input->id)
+ match = true;
+ else if (input->type == entry->type) {
+ if (input->type == kHardwareInputTypeGeneric && input->inputCode == entry->inputCode)
+ match = true;
+ else if (input->type == kHardwareInputTypeKeyboard && input->key == entry->key)
+ match = true;
+ }
+ if (match) {
debug(7, "Removing hardware input [%s] (%s) because it matches [%s] (%s)", entry->id.c_str(), entry->description.c_str(), input->id.c_str(), input->description.c_str());
delete entry;
_inputs.erase(it);
diff --git a/backends/keymapper/hardware-input.h b/backends/keymapper/hardware-input.h
index 9396765bbe..51d4accb5b 100644
--- a/backends/keymapper/hardware-input.h
+++ b/backends/keymapper/hardware-input.h
@@ -34,6 +34,15 @@
namespace Common {
+typedef uint32 HardwareInputCode;
+
+enum HardwareInputType {
+ /** Input that sends single events */
+ kHardwareInputTypeGeneric,
+ /** Input that usually send -up and -down events */
+ kHardwareInputTypeKeyboard
+};
+
/**
* Describes an available hardware input
*/
@@ -44,14 +53,33 @@ struct HardwareInput {
/** Human readable description */
String description;
+ const HardwareInputType type;
+
/**
- * The KeyState that is generated by the back-end
- * when this hardware key is pressed.
- */
+ * A platform specific unique identifier for an input event
+ * generated when this input is triggered.
+ * This is only relevant when type == kHardwareInputTypeGeneric
+ */
+ HardwareInputCode inputCode;
+
+ /**
+ * The KeyState that is generated by the back-end
+ * when this hardware key is pressed.
+ * This is only relevant when type == kHardwareInputTypeKeyboard
+ */
KeyState key;
- HardwareInput(String i, KeyState ky = KeyState(), String desc = "")
- : id(i), key(ky), description(desc) { }
+ HardwareInput(String i, HardwareInputCode ic = 0, String desc = "")
+ : id(i), inputCode(ic), description(desc), type(kHardwareInputTypeGeneric) { }
+
+ HardwareInput(String i, KeyState ky, String desc = "")
+ : id(i), key(ky), description(desc), type(kHardwareInputTypeKeyboard) { }
+};
+
+struct HardwareInputTableEntry {
+ const char *hwId;
+ HardwareInputCode code;
+ const char *desc;
};
/**
@@ -97,6 +125,8 @@ public:
const HardwareInput *findHardwareInput(String id) const;
+ const HardwareInput *findHardwareInput(const HardwareInputCode code) const;
+
const HardwareInput *findHardwareInput(const KeyState& keystate) const;
const List<const HardwareInput *> &getHardwareInputs() const { return _inputs; }
@@ -104,18 +134,17 @@ public:
uint size() const { return _inputs.size(); }
/**
- * Add hardware inputs to the set out of key and modifier tables.
- * @param keys table of available keys
- * @param modifiers table of available modifiers
+ * Add hardware inputs to the set out of a table.
+ * @param inputs table of available inputs
*/
- void addHardwareInputs(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]);
+ void addHardwareInputs(const HardwareInputTableEntry inputs[]);
/**
- * Add hardware inputs to the set out of a key table.
- * The default modifiers are applied to the key entries
+ * Add hardware inputs to the set out of key and modifier tables.
* @param keys table of available keys
+ * @param modifiers table of available modifiers
*/
- void addHardwareInputs(const KeyTableEntry keys[]);
+ void addHardwareInputs(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]);
void removeHardwareInput(const HardwareInput *input);
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 8ea975c927..e95dd6afb5 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -33,14 +33,17 @@
namespace Common {
-Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDomain(0) {
+Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _nonkeymap(), _configDomain(0) {
List<Action *>::iterator it;
for (it = _actions.begin(); it != _actions.end(); ++it) {
const HardwareInput *hwInput = (*it)->getMappedInput();
if (hwInput) {
- _keymap[hwInput->key] = *it;
+ if (hwInput->type == kHardwareInputTypeKeyboard)
+ _keymap[hwInput->key] = *it;
+ else if (hwInput->type == kHardwareInputTypeGeneric)
+ _nonkeymap[hwInput->inputCode] = *it;
}
}
}
@@ -60,23 +63,31 @@ void Keymap::addAction(Action *action) {
}
void Keymap::registerMapping(Action *action, const HardwareInput *hwInput) {
- HashMap<KeyState, Action *>::iterator it;
-
- it = _keymap.find(hwInput->key);
-
- // if key is already mapped to a different action then un-map it
- if (it != _keymap.end() && action != it->_value) {
- it->_value->mapInput(0);
+ if (hwInput->type == kHardwareInputTypeKeyboard) {
+ HashMap<KeyState, Action *>::iterator it = _keymap.find(hwInput->key);
+ // if input is already mapped to a different action then unmap it from there
+ if (it != _keymap.end() && action != it->_value)
+ it->_value->mapInput(0);
+ // now map it
+ _keymap[hwInput->key] = action;
+ } else if (hwInput->type == kHardwareInputTypeGeneric) {
+ HashMap<HardwareInputCode, Action *>::iterator it = _nonkeymap.find(hwInput->inputCode);
+ // if input is already mapped to a different action then unmap it from there
+ if (it != _nonkeymap.end() && action != it->_value)
+ it->_value->mapInput(0);
+ // now map it
+ _nonkeymap[hwInput->inputCode] = action;
}
-
- _keymap[hwInput->key] = action;
}
void Keymap::unregisterMapping(Action *action) {
const HardwareInput *hwInput = action->getMappedInput();
if (hwInput) {
- _keymap.erase(hwInput->key);
+ if (hwInput->type == kHardwareInputTypeKeyboard)
+ _keymap.erase(hwInput->key);
+ else if (hwInput->type == kHardwareInputTypeGeneric)
+ _nonkeymap.erase(hwInput->inputCode);
}
}
@@ -116,6 +127,17 @@ Action *Keymap::getMappedAction(const KeyState& ks) const {
return it->_value;
}
+Action *Keymap::getMappedAction(const HardwareInputCode code) const {
+ HashMap<HardwareInputCode, Action *>::iterator it;
+
+ it = _nonkeymap.find(code);
+
+ if (it == _nonkeymap.end())
+ return 0;
+ else
+ return it->_value;
+}
+
void Keymap::setConfigDomain(ConfigManager::Domain *dom) {
_configDomain = dom;
}
diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h
index 4c3e89700f..6eaec7dcaf 100644
--- a/backends/keymapper/keymap.h
+++ b/backends/keymapper/keymap.h
@@ -33,12 +33,10 @@
#include "common/keyboard.h"
#include "common/list.h"
#include "backends/keymapper/action.h"
+#include "backends/keymapper/hardware-input.h"
namespace Common {
-struct HardwareInput;
-class HardwareInputSet;
-
/**
* Hash function for KeyState
*/
@@ -76,6 +74,13 @@ public:
*/
Action *getMappedAction(const KeyState& ks) const;
+ /**
+ * Find the Action that a generic input is mapped to
+ * @param code the input code that is mapped to the required Action
+ * @return a pointer to the Action or 0 if no
+ */
+ Action *getMappedAction(const HardwareInputCode code) const;
+
void setConfigDomain(ConfigManager::Domain *dom);
/**
@@ -130,6 +135,7 @@ private:
String _name;
List<Action *> _actions;
HashMap<KeyState, Action *> _keymap;
+ HashMap<HardwareInputCode, Action *> _nonkeymap;
ConfigManager::Domain *_configDomain;
};
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index bda4cd47da..dcb021f2d8 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -25,9 +25,14 @@
#ifdef ENABLE_KEYMAPPER
#include "common/config-manager.h"
+#include "common/system.h"
namespace Common {
+// These magic numbers are provided by fuzzie and WebOS
+static const uint32 kDelayKeyboardEventMillis = 250;
+static const uint32 kDelayMouseEventMillis = 50;
+
void Keymapper::Domain::addKeymap(Keymap *map) {
iterator it = find(map->getName());
@@ -54,7 +59,7 @@ Keymap *Keymapper::Domain::getKeymap(const String& name) {
}
Keymapper::Keymapper(EventManager *evtMgr)
- : _eventMan(evtMgr), _enabled(true), _hardwareInputs(0) {
+ : _eventMan(evtMgr), _enabled(true), _remapping(false), _hardwareInputs(0), _actionToRemap(0) {
ConfigManager::Domain *confDom = ConfMan.getDomain(ConfigManager::kKeymapperDomain);
_globalDomain.setConfigDomain(confDom);
@@ -183,13 +188,16 @@ 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)
+ if (_remapping)
+ mappedEvents = remap(ev);
+ else if (ev.type == Common::EVENT_KEYDOWN)
mappedEvents = mapKeyDown(ev.kbd);
else if (ev.type == Common::EVENT_KEYUP)
mappedEvents = mapKeyUp(ev.kbd);
+ else if (ev.type == Common::EVENT_CUSTOM_BACKEND_HARDWARE)
+ mappedEvents = mapNonKey(ev.customType);
if (!mappedEvents.empty())
return mappedEvents;
@@ -197,6 +205,13 @@ List<Event> Keymapper::mapEvent(const Event &ev, EventSource *source) {
return DefaultEventMapper::mapEvent(ev, source);
}
+void Keymapper::startRemappingMode(Action *actionToRemap) {
+ assert(!_remapping);
+
+ _remapping = true;
+ _actionToRemap = actionToRemap;
+}
+
List<Event> Keymapper::mapKeyDown(const KeyState& key) {
return mapKey(key, true);
}
@@ -236,7 +251,30 @@ List<Event> Keymapper::mapKey(const KeyState& key, bool keyDown) {
if (!action)
return List<Event>();
- return executeAction(action, keyDown);
+ return executeAction(action, keyDown ? kIncomingKeyDown : kIncomingKeyUp);
+}
+
+
+List<Event> Keymapper::mapNonKey(const HardwareInputCode code) {
+ if (!_enabled || _activeMaps.empty())
+ return List<Event>();
+
+ Action *action = 0;
+
+ // Search for nonkey in active keymap stack
+ for (int i = _activeMaps.size() - 1; i >= 0; --i) {
+ MapRecord mr = _activeMaps[i];
+ debug(5, "Keymapper::mapKey keymap: %s", mr.keymap->getName().c_str());
+ action = mr.keymap->getMappedAction(code);
+
+ if (action || !mr.transparent)
+ break;
+ }
+
+ if (!action)
+ return List<Event>();
+
+ return executeAction(action);
}
Action *Keymapper::getAction(const KeyState& key) {
@@ -245,56 +283,108 @@ Action *Keymapper::getAction(const KeyState& key) {
return action;
}
-List<Event> Keymapper::executeAction(const Action *action, bool keyDown) {
+List<Event> Keymapper::executeAction(const Action *action, IncomingEventType incomingType) {
List<Event> mappedEvents;
List<Event>::const_iterator it;
-
+ Event evt;
for (it = action->events.begin(); it != action->events.end(); ++it) {
- Event evt = *it;
-
- switch (evt.type) {
- case EVENT_KEYDOWN:
- if (!keyDown) evt.type = EVENT_KEYUP;
- break;
- case EVENT_KEYUP:
- if (keyDown) evt.type = EVENT_KEYDOWN;
- break;
- case EVENT_LBUTTONDOWN:
- if (!keyDown) evt.type = EVENT_LBUTTONUP;
- break;
- case EVENT_LBUTTONUP:
- if (keyDown) evt.type = EVENT_LBUTTONDOWN;
- break;
- case EVENT_RBUTTONDOWN:
- if (!keyDown) evt.type = EVENT_RBUTTONUP;
- break;
- case EVENT_RBUTTONUP:
- if (keyDown) evt.type = EVENT_RBUTTONDOWN;
- break;
- case EVENT_MBUTTONDOWN:
- if (!keyDown) evt.type = EVENT_MBUTTONUP;
- break;
- 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 = Event(*it);
+ EventType convertedType = convertDownToUp(evt.type);
+
+ // hardware keys need to send up instead when they are up
+ if (incomingType == kIncomingKeyUp) {
+ if (convertedType == EVENT_INVALID)
+ continue; // don't send any non-down-converted events on up they were already sent on down
+ evt.type = convertedType;
}
evt.mouse = _eventMan->getMousePos();
- mappedEvents.push_back(evt);
+
+ // Check if the event is coming from a non-key hardware event
+ // that is mapped to a key event
+ if (incomingType == kIncomingNonKey && convertedType != EVENT_INVALID)
+ // WORKAROUND: Delay the down events coming from non-key hardware events
+ // with a zero delay. This is to prevent DOWN1 DOWN2 UP1 UP2.
+ addDelayedEvent(0, evt);
+ else
+ mappedEvents.push_back(evt);
+
+ // non-keys need to send up as well
+ if (incomingType == kIncomingNonKey && convertedType != EVENT_INVALID) {
+ // WORKAROUND: Delay the up events coming from non-key hardware events
+ // This is for engines that run scripts that check on key being down
+ evt.type = convertedType;
+ const uint32 delay = (convertedType == EVENT_KEYUP ? kDelayKeyboardEventMillis : kDelayMouseEventMillis);
+ addDelayedEvent(delay, evt);
+ }
}
return mappedEvents;
}
+EventType Keymapper::convertDownToUp(EventType type) {
+ EventType result = EVENT_INVALID;
+ switch (type) {
+ case EVENT_KEYDOWN:
+ result = EVENT_KEYUP;
+ break;
+ case EVENT_LBUTTONDOWN:
+ result = EVENT_LBUTTONUP;
+ break;
+ case EVENT_RBUTTONDOWN:
+ result = EVENT_RBUTTONUP;
+ break;
+ case EVENT_MBUTTONDOWN:
+ result = EVENT_MBUTTONUP;
+ break;
+ default:
+ break;
+ }
+ return result;
+}
+
const HardwareInput *Keymapper::findHardwareInput(const KeyState& key) {
return (_hardwareInputs) ? _hardwareInputs->findHardwareInput(key) : 0;
}
+const HardwareInput *Keymapper::findHardwareInput(const HardwareInputCode code) {
+ return (_hardwareInputs) ? _hardwareInputs->findHardwareInput(code) : 0;
+}
+
+List<Event> Keymapper::remap(const Event &ev) {
+ assert(_remapping);
+ assert(_actionToRemap);
+
+ List<Event> list;
+
+ const HardwareInput *hwInput = 0;
+ Event mappedEvent;
+
+ switch (ev.type) {
+ case EVENT_KEYDOWN:
+ // eat the event by returning an event invalid
+ mappedEvent.type = EVENT_INVALID;
+ list.push_back(mappedEvent);
+ break;
+ case EVENT_KEYUP:
+ hwInput = findHardwareInput(ev.kbd);
+ break;
+ case EVENT_CUSTOM_BACKEND_HARDWARE:
+ hwInput = findHardwareInput(ev.customType);
+ break;
+ default:
+ break;
+ }
+ if (hwInput) {
+ _actionToRemap->mapInput(hwInput);
+ _actionToRemap->getParent()->saveMappings();
+ _remapping = false;
+ _actionToRemap = 0;
+ mappedEvent.type = EVENT_GUI_REMAP_COMPLETE_ACTION;
+ list.push_back(mappedEvent);
+ }
+ return list;
+}
+
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index daa746f379..1e8d1c08c3 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -149,6 +149,7 @@ public:
* @return mapped events
*/
List<Event> mapKey(const KeyState& key, bool keyDown);
+ List<Event> mapNonKey(const HardwareInputCode code);
/**
* @brief Map a key down event.
@@ -168,16 +169,45 @@ public:
void setEnabled(bool enabled) { _enabled = enabled; }
/**
+ * @brief Activate remapping mode
+ * While this mode is active, any mappable event will be bound to the action
+ * provided.
+ * @param actionToRemap Action that is the target of the remap
+ */
+ void startRemappingMode(Action *actionToRemap);
+
+ /**
+ * @brief Force-stop the remapping mode
+ */
+ void stopRemappingMode() { _remapping = false; }
+
+ /**
+ * Query whether the keymapper is currently in the remapping mode
+ */
+ bool isRemapping() const { return _remapping; }
+
+ /**
* Return a HardwareInput pointer for the given key state
*/
const HardwareInput *findHardwareInput(const KeyState& key);
+ /**
+ * Return a HardwareInput pointer for the given input code
+ */
+ const HardwareInput *findHardwareInput(const HardwareInputCode code);
+
Domain& getGlobalDomain() { return _globalDomain; }
Domain& getGameDomain() { return _gameDomain; }
const Stack<MapRecord>& getActiveStack() const { return _activeMaps; }
private:
+ enum IncomingEventType {
+ kIncomingKeyDown,
+ kIncomingKeyUp,
+ kIncomingNonKey
+ };
+
void initKeymap(Domain &domain, Keymap *keymap);
Domain _globalDomain;
@@ -188,12 +218,16 @@ private:
void pushKeymap(Keymap *newMap, bool transparent, bool global);
Action *getAction(const KeyState& key);
- List<Event> executeAction(const Action *act, bool keyDown);
+ List<Event> executeAction(const Action *act, IncomingEventType incomingType = kIncomingNonKey);
+ EventType convertDownToUp(EventType eventType);
+ List<Event> remap(const Event &ev);
EventManager *_eventMan;
bool _enabled;
+ bool _remapping;
+ Action *_actionToRemap;
Stack<MapRecord> _activeMaps;
HashMap<KeyState, Action *> _keysDown;
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index dab295219a..009c2201a9 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), _topKeymapIsGui(false) {
+ : Dialog("KeyMapper"), _keymapTable(0), _topAction(0), _remapTimeout(0), _topKeymapIsGui(false) {
_keymapper = g_system->getEventManager()->getKeymapper();
assert(_keymapper);
@@ -243,16 +243,14 @@ void RemapDialog::clearMapping(uint i) {
return;
debug(3, "clear the mapping %u", i);
- _activeRemapAction = _currentActions[_topAction + i].action;
- _activeRemapAction->mapInput(0);
- _activeRemapAction->getParent()->saveMappings();
+ Action *activeRemapAction = _currentActions[_topAction + i].action;
+ activeRemapAction->mapInput(0);
+ activeRemapAction->getParent()->saveMappings();
_changes = true;
// force refresh
- _topAction = -1;
+ stopRemapping(true);
refreshKeymap();
-
- _activeRemapAction = 0;
}
void RemapDialog::startRemapping(uint i) {
@@ -260,57 +258,56 @@ void RemapDialog::startRemapping(uint i) {
return;
_remapTimeout = g_system->getMillis() + kRemapTimeoutDelay;
- _activeRemapAction = _currentActions[_topAction + i].action;
+ Action *activeRemapAction = _currentActions[_topAction + i].action;
_keymapWidgets[i].keyButton->setLabel("...");
_keymapWidgets[i].keyButton->draw();
- _keymapper->setEnabled(false);
+ _keymapper->startRemappingMode(activeRemapAction);
}
-void RemapDialog::stopRemapping() {
+void RemapDialog::stopRemapping(bool force) {
_topAction = -1;
refreshKeymap();
- _activeRemapAction = 0;
-
- _keymapper->setEnabled(true);
+ if (force)
+ _keymapper->stopRemappingMode();
}
void RemapDialog::handleKeyDown(Common::KeyState state) {
- if (_activeRemapAction)
+ if (_keymapper->isRemapping())
return;
GUI::Dialog::handleKeyDown(state);
}
void RemapDialog::handleKeyUp(Common::KeyState state) {
- if (_activeRemapAction) {
- const HardwareInput *hwInput = _keymapper->findHardwareInput(state);
+ if (_keymapper->isRemapping())
+ return;
- debug(4, "RemapDialog::handleKeyUp Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
+ GUI::Dialog::handleKeyUp(state);
+}
- if (hwInput) {
- _activeRemapAction->mapInput(hwInput);
- _activeRemapAction->getParent()->saveMappings();
- _changes = true;
- stopRemapping();
- }
+void RemapDialog::handleOtherEvent(Event ev) {
+ if (ev.type == EVENT_GUI_REMAP_COMPLETE_ACTION) {
+ // _keymapper is telling us that something changed
+ _changes = true;
+ stopRemapping();
} else {
- GUI::Dialog::handleKeyUp(state);
+ GUI::Dialog::handleOtherEvent(ev);
}
}
void RemapDialog::handleMouseDown(int x, int y, int button, int clickCount) {
- if (_activeRemapAction)
+ if (_keymapper->isRemapping())
stopRemapping();
else
Dialog::handleMouseDown(x, y, button, clickCount);
}
void RemapDialog::handleTickle() {
- if (_activeRemapAction && g_system->getMillis() > _remapTimeout)
- stopRemapping();
+ if (_keymapper->isRemapping() && g_system->getMillis() > _remapTimeout)
+ stopRemapping(true);
Dialog::handleTickle();
}
@@ -354,9 +351,14 @@ void RemapDialog::loadKeymap() {
Keymapper::MapRecord mr = activeKeymaps[i];
debug(3, "RemapDialog::loadKeymap keymap: %s", mr.keymap->getName().c_str());
List<const HardwareInput *>::iterator inputIt = freeInputs.begin();
+ const HardwareInput *input = *inputIt;
while (inputIt != freeInputs.end()) {
- Action *act = mr.keymap->getMappedAction((*inputIt)->key);
+ Action *act = 0;
+ if (input->type == kHardwareInputTypeKeyboard)
+ act = mr.keymap->getMappedAction(input->key);
+ else if (input->type == kHardwareInputTypeGeneric)
+ act = mr.keymap->getMappedAction(input->inputCode);
if (act) {
ActionInfo info = {act, true, act->description + " (" + mr.keymap->getName() + ")"};
diff --git a/backends/keymapper/remap-dialog.h b/backends/keymapper/remap-dialog.h
index 143deca4cf..82c68405db 100644
--- a/backends/keymapper/remap-dialog.h
+++ b/backends/keymapper/remap-dialog.h
@@ -50,6 +50,7 @@ public:
virtual void handleKeyUp(Common::KeyState state);
virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual void handleTickle();
+ virtual void handleOtherEvent(Common::Event ev);
protected:
struct ActionWidgets {
@@ -67,7 +68,7 @@ protected:
void refreshKeymap();
void clearMapping(uint i);
void startRemapping(uint i);
- void stopRemapping();
+ void stopRemapping(bool force = false);
Keymapper *_keymapper;
Keymap** _keymapTable;
@@ -85,7 +86,6 @@ protected:
uint _rowCount;
Array<ActionWidgets> _keymapWidgets;
- Action *_activeRemapAction;
uint32 _remapTimeout;
static const uint32 kRemapTimeoutDelay = 3000;
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 43c801287d..94262d0d92 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -172,10 +172,15 @@ int MidiDriver_CORE::open() {
// Load custom soundfont, if specified
if (ConfMan.hasKey("soundfont")) {
- FSRef fsref;
- FSSpec fsSpec;
const char *soundfont = ConfMan.get("soundfont").c_str();
+ // TODO: We should really check whether the file contains an
+ // actual soundfont...
+
+#if USE_DEPRECATED_COREAUDIO_API
+ // Before 10.5, we need to use kMusicDeviceProperty_SoundBankFSSpec
+ FSRef fsref;
+ FSSpec fsSpec;
err = FSPathMakeRef ((const byte *)soundfont, &fsref, NULL);
if (err == noErr) {
@@ -183,8 +188,6 @@ int MidiDriver_CORE::open() {
}
if (err == noErr) {
- // TODO: We should really check here whether the file contains an
- // actual soundfont...
err = AudioUnitSetProperty (
_synth,
kMusicDeviceProperty_SoundBankFSSpec, kAudioUnitScope_Global,
@@ -192,9 +195,27 @@ int MidiDriver_CORE::open() {
&fsSpec, sizeof(fsSpec)
);
}
+#else
+ // kMusicDeviceProperty_SoundBankFSSpec is present on 10.6+, but broken
+ // kMusicDeviceProperty_SoundBankURL was added in 10.5 as a replacement
+ CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)soundfont, strlen(soundfont), false);
+
+ if (url) {
+ err = AudioUnitSetProperty (
+ _synth,
+ kMusicDeviceProperty_SoundBankURL, kAudioUnitScope_Global,
+ 0,
+ &url, sizeof(url)
+ );
+
+ CFRelease(url);
+ } else {
+ warning("Failed to allocate CFURLRef from '%s'", soundfont);
+ }
+#endif
if (err != noErr)
- warning("Failed loading custom sound font '%s' (error %ld)\n", soundfont, (long)err);
+ error("Failed loading custom sound font '%s' (error %ld)", soundfont, (long)err);
}
#ifdef COREAUDIO_DISABLE_REVERB
diff --git a/backends/midi/sndio.cpp b/backends/midi/sndio.cpp
new file mode 100644
index 0000000000..a065a658e1
--- /dev/null
+++ b/backends/midi/sndio.cpp
@@ -0,0 +1,152 @@
+/* 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 "common/scummsys.h"
+
+#if defined(USE_SNDIO)
+
+#include "common/error.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "audio/musicplugin.h"
+#include "audio/mpu401.h"
+
+#include <sndio.h>
+
+////////////////////////////////////////
+//
+// sndio MIDI driver
+//
+////////////////////////////////////////
+
+class MidiDriver_Sndio : public MidiDriver_MPU401 {
+public:
+ MidiDriver_Sndio();
+ int open();
+ bool isOpen() const { return hdl != NULL; }
+ void close();
+ void send(uint32 b);
+ void sysEx(const byte *msg, uint16 length);
+
+private:
+ struct mio_hdl *hdl;
+};
+
+MidiDriver_Sndio::MidiDriver_Sndio() {
+ hdl = NULL;
+}
+
+int MidiDriver_Sndio::open() {
+ if (hdl != NULL)
+ return MERR_ALREADY_OPEN;
+
+ hdl = ::mio_open(NULL, MIO_OUT, 0);
+ if (hdl == NULL)
+ warning("Could open MIDI port (no music)");
+ return 0;
+}
+
+void MidiDriver_Sndio::close() {
+ MidiDriver_MPU401::close();
+ if (!hdl)
+ return;
+ mio_close(hdl);
+ hdl = NULL;
+}
+
+void MidiDriver_Sndio::send(uint32 b) {
+ unsigned char buf[4];
+ unsigned int len;
+
+ if (!hdl)
+ return;
+ buf[0] = b & 0xff;
+ buf[1] = (b >> 8) & 0xff;
+ buf[2] = (b >> 16) & 0xff;
+ buf[3] = (b >> 24) & 0xff;
+ switch (buf[0] & 0xf0) {
+ case 0xf0:
+ return;
+ case 0xc0:
+ case 0xd0:
+ len = 2;
+ break;
+ default:
+ len = 3;
+ }
+ mio_write(hdl, buf, len);
+}
+
+void MidiDriver_Sndio::sysEx(const byte *msg, uint16 length) {
+ if (!hdl)
+ return;
+
+ unsigned char buf[266];
+
+ assert(length + 2 <= ARRAYSIZE(buf));
+
+ // Add SysEx frame
+ buf[0] = 0xF0;
+ memcpy(buf + 1, msg, length);
+ buf[length + 1] = 0xF7;
+
+ mio_write(hdl, buf, length + 2);
+}
+
+
+// Plugin interface
+
+class SndioMusicPlugin : public MusicPluginObject {
+public:
+ const char *getName() const {
+ return "Sndio";
+ }
+
+ const char *getId() const {
+ return "sndio";
+ }
+
+ MusicDevices getDevices() const;
+ Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
+};
+
+MusicDevices SndioMusicPlugin::getDevices() const {
+ MusicDevices devices;
+ devices.push_back(MusicDevice(this, "", MT_GM));
+ return devices;
+}
+
+Common::Error SndioMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
+ *mididriver = new MidiDriver_Sndio();
+
+ return Common::kNoError;
+}
+
+//#if PLUGIN_ENABLED_DYNAMIC(Sndio)
+ //REGISTER_PLUGIN_DYNAMIC(SNDIO, PLUGIN_TYPE_MUSIC, SndioMusicPlugin);
+//#else
+ REGISTER_PLUGIN_STATIC(SNDIO, PLUGIN_TYPE_MUSIC, SndioMusicPlugin);
+//#endif
+
+#endif
diff --git a/backends/midi/stmidi.cpp b/backends/midi/stmidi.cpp
index 53302f8a80..5a6326877e 100644
--- a/backends/midi/stmidi.cpp
+++ b/backends/midi/stmidi.cpp
@@ -36,7 +36,7 @@
#include "common/scummsys.h"
-#if defined __MINT__
+#if defined(__MINT__)
#include <osbind.h>
#include "audio/mpu401.h"
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
index 172d31e799..5cefe668cd 100644
--- a/backends/midi/timidity.cpp
+++ b/backends/midi/timidity.cpp
@@ -559,4 +559,4 @@ Common::Error TimidityMusicPlugin::createInstance(MidiDriver **mididriver, MidiD
REGISTER_PLUGIN_STATIC(TIMIDITY, PLUGIN_TYPE_MUSIC, TimidityMusicPlugin);
//#endif
-#endif // defined (USE_TIMIDITY)
+#endif // defined(USE_TIMIDITY)
diff --git a/backends/mixer/sdl13/sdl13-mixer.cpp b/backends/mixer/sdl13/sdl13-mixer.cpp
index 84777c8bab..24d3434fde 100644
--- a/backends/mixer/sdl13/sdl13-mixer.cpp
+++ b/backends/mixer/sdl13/sdl13-mixer.cpp
@@ -69,13 +69,13 @@ void Sdl13MixerManager::init() {
warning("Could not open audio device: %s", SDL_GetError());
_mixer = new Audio::MixerImpl(g_system, desired.freq);
- assert(_mixer);
+ assert(_mixer);
_mixer->setReady(false);
} else {
debug(1, "Output sample rate: %d Hz", _obtained.freq);
_mixer = new Audio::MixerImpl(g_system, _obtained.freq);
- assert(_mixer);
+ assert(_mixer);
_mixer->setReady(true);
startAudio();
diff --git a/backends/mixer/symbiansdl/symbiansdl-mixer.cpp b/backends/mixer/symbiansdl/symbiansdl-mixer.cpp
index d4637fdd88..e978e9207f 100644
--- a/backends/mixer/symbiansdl/symbiansdl-mixer.cpp
+++ b/backends/mixer/symbiansdl/symbiansdl-mixer.cpp
@@ -52,7 +52,7 @@ void SymbianSdlMixerManager::startAudio() {
void SymbianSdlMixerManager::callbackHandler(byte *samples, int len) {
assert(_mixer);
-#if defined (S60) && !defined(S60V3)
+#if defined(S60) && !defined(S60V3)
// If not stereo then we need to downmix
if (_obtained.channels != 2) {
_mixer->mixCallback(_stereoMixBuffer, len * 2);
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index 525170d685..b46f33a2bc 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -124,7 +124,7 @@ PaletteManager *ModularBackend::getPaletteManager() {
return _graphicsManager;
}
-void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void ModularBackend::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
}
@@ -171,11 +171,11 @@ void ModularBackend::clearOverlay() {
_graphicsManager->clearOverlay();
}
-void ModularBackend::grabOverlay(OverlayColor *buf, int pitch) {
+void ModularBackend::grabOverlay(void *buf, int pitch) {
_graphicsManager->grabOverlay(buf, pitch);
}
-void ModularBackend::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void ModularBackend::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
_graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h);
}
@@ -195,8 +195,8 @@ void ModularBackend::warpMouse(int x, int y) {
_graphicsManager->warpMouse(x, y);
}
-void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
- _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format);
+void ModularBackend::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+ _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
}
void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) {
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 072ee805b6..b43769c716 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -80,7 +80,7 @@ public:
virtual int16 getHeight();
virtual int16 getWidth();
virtual PaletteManager *getPaletteManager();
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
virtual void fillScreen(uint32 col);
@@ -93,14 +93,14 @@ public:
virtual void hideOverlay();
virtual Graphics::PixelFormat getOverlayFormat() const;
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
//@}
diff --git a/backends/module.mk b/backends/module.mk
index 95725d9d87..a4f525d21d 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS := \
midi/alsa.o \
midi/dmedia.o \
midi/seq.o \
+ midi/sndio.o \
midi/stmidi.o \
midi/timidity.o \
saves/savefile.o \
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 902599d50f..0b31ee717c 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -554,6 +554,7 @@ void OSystem_Android::getTimeAndDate(TimeDate &td) const {
td.tm_mday = tm.tm_mday;
td.tm_mon = tm.tm_mon;
td.tm_year = tm.tm_year;
+ td.tm_wday = tm.tm_wday;
}
void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 47a6515a2a..4b13ca4b0f 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -244,7 +244,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y,
int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
@@ -257,8 +257,8 @@ public:
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch,
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch,
int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
@@ -267,9 +267,9 @@ public:
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
int hotspotY, uint32 keycolor,
- int cursorTargetScale,
+ bool dontScale,
const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index 2e8fd62152..9292a16595 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -130,7 +130,18 @@ $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png: $(PATH_RESOURCES)/drawable/scum
$(FILE_RESOURCES_MAIN): $(FILE_MANIFEST) $(RESOURCES) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
$(INSTALL) -d $(PATH_BUILD_ASSETS)
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(PATH_BUILD_ASSETS)/
- $(AAPT) package -f -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@
+ work_dir=`pwd`; \
+ for i in $(PATH_BUILD_ASSETS)/*.zip; do \
+ echo "recompress $$i"; \
+ cd $$work_dir; \
+ $(RM) -rf $(PATH_BUILD_ASSETS)/tmp; \
+ $(MKDIR) $(PATH_BUILD_ASSETS)/tmp; \
+ unzip -q $$i -d $(PATH_BUILD_ASSETS)/tmp; \
+ cd $(PATH_BUILD_ASSETS)/tmp; \
+ zip -r ../`basename $$i` *; \
+ done
+ @$(RM) -rf $(PATH_BUILD_ASSETS)/tmp
+ $(AAPT) package -f -0 zip -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@
$(PATH_BUILD)/%/$(FILE_RESOURCES): $(PATH_BUILD)/%/AndroidManifest.xml $(PATH_STAGE_PREFIX).%/res/values/strings.xml $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png plugins/lib%.so $(ANDROID_JAR8)
$(AAPT) package -f -M $< -S $(PATH_STAGE_PREFIX).$*/res -I $(ANDROID_JAR8) -F $@
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 8bc914f567..cd0fd88484 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -421,7 +421,7 @@ void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
pf.colorToRGB(READ_UINT16(p), colors[0], colors[1], colors[2]);
}
-void OSystem_Android::copyRectToScreen(const byte *buf, int pitch,
+void OSystem_Android::copyRectToScreen(const void *buf, int pitch,
int x, int y, int w, int h) {
ENTER("%p, %d, %d, %d, %d, %d", buf, pitch, x, y, w, h);
@@ -636,33 +636,32 @@ void OSystem_Android::clearOverlay() {
_overlay_texture->fillBuffer(0);
}
-void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) {
+void OSystem_Android::grabOverlay(void *buf, int pitch) {
ENTER("%p, %d", buf, pitch);
GLTHREADCHECK;
const Graphics::Surface *surface = _overlay_texture->surface_const();
- assert(surface->format.bytesPerPixel == sizeof(buf[0]));
+ assert(surface->format.bytesPerPixel == sizeof(uint16));
+ byte *dst = (byte *)buf;
const byte *src = (const byte *)surface->pixels;
uint h = surface->h;
do {
- memcpy(buf, src, surface->w * surface->format.bytesPerPixel);
+ memcpy(dst, src, surface->w * surface->format.bytesPerPixel);
src += surface->pitch;
- // This 'pitch' is pixels not bytes
- buf += pitch;
+ dst += pitch;
} while (--h);
}
-void OSystem_Android::copyRectToOverlay(const OverlayColor *buf, int pitch,
+void OSystem_Android::copyRectToOverlay(const void *buf, int pitch,
int x, int y, int w, int h) {
ENTER("%p, %d, %d, %d, %d, %d", buf, pitch, x, y, w, h);
GLTHREADCHECK;
- // This 'pitch' is pixels not bytes
- _overlay_texture->updateBuffer(x, y, w, h, buf, pitch * sizeof(buf[0]));
+ _overlay_texture->updateBuffer(x, y, w, h, buf, pitch);
}
int16 OSystem_Android::getOverlayHeight() {
@@ -685,12 +684,12 @@ bool OSystem_Android::showMouse(bool visible) {
return true;
}
-void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
+void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h,
int hotspotX, int hotspotY,
- uint32 keycolor, int cursorTargetScale,
+ uint32 keycolor, bool dontScale,
const Graphics::PixelFormat *format) {
ENTER("%p, %u, %u, %d, %d, %u, %d, %p", buf, w, h, hotspotX, hotspotY,
- keycolor, cursorTargetScale, format);
+ keycolor, dontScale, format);
GLTHREADCHECK;
@@ -741,7 +740,7 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
byte *tmp = new byte[pitch * h];
// meh, a 16bit cursor without alpha bits... this is so silly
- if (!crossBlit(tmp, buf, pitch, w * 2, w, h,
+ if (!crossBlit(tmp, (const byte *)buf, pitch, w * 2, w, h,
_mouse_texture->getPixelFormat(),
*format)) {
LOGE("crossblit failed");
@@ -766,7 +765,8 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
}
_mouse_hotspot = Common::Point(hotspotX, hotspotY);
- _mouse_targetscale = cursorTargetScale;
+ // TODO: Adapt to the new "do not scale" cursor logic.
+ _mouse_targetscale = 1;
}
void OSystem_Android::setCursorPaletteInternal(const byte *colors,
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 95c96e0d25..b174e93191 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -52,9 +52,6 @@
// Supported GL extensions
static bool npot_supported = false;
-#ifdef GL_OES_draw_texture
-static bool draw_tex_supported = false;
-#endif
static inline GLfixed xdiv(int numerator, int denominator) {
assert(numerator < (1 << 16));
@@ -85,11 +82,6 @@ void GLESBaseTexture::initGLExtensions() {
if (token == "GL_ARB_texture_non_power_of_two")
npot_supported = true;
-
-#ifdef GL_OES_draw_texture
- if (token == "GL_OES_draw_texture")
- draw_tex_supported = true;
-#endif
}
}
@@ -180,45 +172,28 @@ void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) {
void GLESBaseTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));
-#ifdef GL_OES_draw_texture
- // Great extension, but only works under specific conditions.
- // Still a work-in-progress - disabled for now.
- if (false && draw_tex_supported && !hasPalette()) {
- //GLCALL(glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE));
- const GLint crop[4] = { 0, _surface.h, _surface.w, -_surface.h };
+ const GLfixed tex_width = xdiv(_surface.w, _texture_width);
+ const GLfixed tex_height = xdiv(_surface.h, _texture_height);
+ const GLfixed texcoords[] = {
+ 0, 0,
+ tex_width, 0,
+ 0, tex_height,
+ tex_width, tex_height,
+ };
- GLCALL(glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop));
+ GLCALL(glTexCoordPointer(2, GL_FIXED, 0, texcoords));
- // Android GLES bug?
- GLCALL(glColor4ub(0xff, 0xff, 0xff, 0xff));
+ const GLshort vertices[] = {
+ x, y,
+ x + w, y,
+ x, y + h,
+ x + w, y + h,
+ };
- GLCALL(glDrawTexiOES(x, y, 0, w, h));
- } else
-#endif
- {
- const GLfixed tex_width = xdiv(_surface.w, _texture_width);
- const GLfixed tex_height = xdiv(_surface.h, _texture_height);
- const GLfixed texcoords[] = {
- 0, 0,
- tex_width, 0,
- 0, tex_height,
- tex_width, tex_height,
- };
-
- GLCALL(glTexCoordPointer(2, GL_FIXED, 0, texcoords));
-
- const GLshort vertices[] = {
- x, y,
- x + w, y,
- x, y + h,
- x + w, y + h,
- };
-
- GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices));
-
- assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords));
- GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2));
- }
+ GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices));
+
+ assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords));
+ GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2));
clearDirty();
}
diff --git a/backends/platform/bada/application.cpp b/backends/platform/bada/application.cpp
index ba8e544983..e761649245 100644
--- a/backends/platform/bada/application.cpp
+++ b/backends/platform/bada/application.cpp
@@ -103,7 +103,7 @@ void BadaScummVM::pauseGame(bool pause) {
if (pause && g_engine && !g_engine->isPaused()) {
_appForm->pushKey(Common::KEYCODE_SPACE);
}
-
+
if (g_system) {
((BadaSystem *)g_system)->setMute(pause);
}
diff --git a/backends/platform/bada/sscanf.cpp b/backends/platform/bada/sscanf.cpp
index b5e5b88cb5..aa846698f6 100644
--- a/backends/platform/bada/sscanf.cpp
+++ b/backends/platform/bada/sscanf.cpp
@@ -56,7 +56,7 @@ bool scanInt(const char **in, va_list *ap, int max) {
bool err = false;
if (end == *in || (max > 0 && (end - *in) > max)) {
- err = true;
+ err = true;
} else {
*arg = (int)n;
*in = end;
diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp
index d284688068..3f862c2571 100644
--- a/backends/platform/bada/system.cpp
+++ b/backends/platform/bada/system.cpp
@@ -21,6 +21,7 @@
*/
#include <FUiCtrlMessageBox.h>
+#include <FLocales.h>
#include "common/config-manager.h"
#include "common/file.h"
@@ -42,7 +43,9 @@
using namespace Osp::Base;
using namespace Osp::Base::Runtime;
+using namespace Osp::Locales;
using namespace Osp::Ui::Controls;
+using namespace Osp::System;
#define DEFAULT_CONFIG_FILE "/Home/scummvm.ini"
#define RESOURCE_PATH "/Res"
@@ -305,7 +308,7 @@ void BadaSystem::initBackend() {
ConfMan.registerDefault("aspect_ratio", false);
ConfMan.setBool("confirm_exit", false);
- Osp::System::SystemTime::GetTicks(_epoch);
+ SystemTime::GetTicks(_epoch);
if (E_SUCCESS != initModules()) {
AppLog("initModules failed");
@@ -372,7 +375,7 @@ bool BadaSystem::pollEvent(Common::Event &event) {
uint32 BadaSystem::getMillis() {
long long result, ticks = 0;
- Osp::System::SystemTime::GetTicks(ticks);
+ SystemTime::GetTicks(ticks);
result = ticks - _epoch;
return result;
}
@@ -392,13 +395,18 @@ void BadaSystem::updateScreen() {
void BadaSystem::getTimeAndDate(TimeDate &td) const {
DateTime currentTime;
- if (E_SUCCESS == Osp::System::SystemTime::GetCurrentTime(currentTime)) {
+ if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) {
td.tm_sec = currentTime.GetSecond();
td.tm_min = currentTime.GetMinute();
td.tm_hour = currentTime.GetHour();
td.tm_mday = currentTime.GetDay();
td.tm_mon = currentTime.GetMonth();
td.tm_year = currentTime.GetYear();
+
+ Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
+ calendar->SetTime(currentTime);
+ td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1;
+ delete calendar;
}
}
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 8ca48bf19e..d41839d961 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -127,7 +127,7 @@ public:
// Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap
- void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
@@ -142,7 +142,7 @@ public:
void warpMouse(int x, int y);
// Set the bitmap that's used when drawing the cursor.
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
+ void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
// Replace the specified range of cursor the palette with new colors.
void setCursorPalette(const byte *colors, uint start, uint num);
@@ -172,8 +172,8 @@ public:
void showOverlay();
void hideOverlay();
void clearOverlay();
- void grabOverlay(OverlayColor *buf, int pitch);
- void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ void grabOverlay(void *buf, int pitch);
+ void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); }
// Mutex handling
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 3e3279f9c3..bec1fdae3a 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -213,6 +213,7 @@ void OSystem_Dreamcast::getTimeAndDate(TimeDate &td) const {
td.tm_mday = t.tm_mday;
td.tm_mon = t.tm_mon;
td.tm_year = t.tm_year;
+ td.tm_wday = t.tm_wday;
}
Common::SeekableReadStream *OSystem_Dreamcast::createConfigReadStream() {
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index e886b55869..cc5798fc10 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -260,7 +260,7 @@ void OSystem_Dreamcast::initSize(uint w, uint h, const Graphics::PixelFormat *fo
_devpoll = Timer();
}
-void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int y,
+void OSystem_Dreamcast::copyRectToScreen(const void *buf, int pitch, int x, int y,
int w, int h)
{
if (w<1 || h<1)
@@ -269,10 +269,11 @@ void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int
x<<=1; w<<=1;
}
unsigned char *dst = screen + y*SCREEN_W*2 + x;
+ const byte *src = (const byte *)buf;
do {
- memcpy(dst, buf, w);
+ memcpy(dst, src, w);
dst += SCREEN_W*2;
- buf += pitch;
+ src += pitch;
} while (--h);
_screen_dirty = true;
}
@@ -291,9 +292,9 @@ void OSystem_Dreamcast::warpMouse(int x, int y)
_ms_cur_y = y;
}
-void OSystem_Dreamcast::setMouseCursor(const byte *buf, uint w, uint h,
+void OSystem_Dreamcast::setMouseCursor(const void *buf, uint w, uint h,
int hotspot_x, int hotspot_y,
- uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format)
+ uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format)
{
_ms_cur_w = w;
_ms_cur_h = h;
@@ -652,27 +653,29 @@ void OSystem_Dreamcast::clearOverlay()
_overlay_dirty = true;
}
-void OSystem_Dreamcast::grabOverlay(OverlayColor *buf, int pitch)
+void OSystem_Dreamcast::grabOverlay(void *buf, int pitch)
{
int h = OVL_H;
unsigned short *src = overlay;
+ unsigned char *dst = (unsigned char *)buf;
do {
- memcpy(buf, src, OVL_W*sizeof(int16));
+ memcpy(dst, src, OVL_W*sizeof(int16));
src += OVL_W;
- buf += pitch;
+ dst += pitch;
} while (--h);
}
-void OSystem_Dreamcast::copyRectToOverlay(const OverlayColor *buf, int pitch,
+void OSystem_Dreamcast::copyRectToOverlay(const void *buf, int pitch,
int x, int y, int w, int h)
{
if (w<1 || h<1)
return;
unsigned short *dst = overlay + y*OVL_W + x;
+ const unsigned char *src = (const unsigned char *)buf;
do {
- memcpy(dst, buf, w*sizeof(int16));
+ memcpy(dst, src, w*sizeof(int16));
dst += OVL_W;
- buf += pitch;
+ src += pitch;
} while (--h);
_overlay_dirty = true;
}
diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index e06dd7fa43..ba3b787942 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -316,8 +316,9 @@ public:
class VMSaveManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
- return Common::wrapCompressedWriteStream(new OutVMSave(filename.c_str()));
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
+ OutVMSave *s = new OutVMSave(filename.c_str());
+ return compress ? Common::wrapCompressedWriteStream(s) : s;
}
virtual Common::InSaveFile *openForLoading(const Common::String &filename) {
diff --git a/backends/platform/dingux/README.DINGUX b/backends/platform/dingux/README.DINGUX
index 04f0d30844..9e65d4c36d 100644
--- a/backends/platform/dingux/README.DINGUX
+++ b/backends/platform/dingux/README.DINGUX
@@ -29,10 +29,27 @@ file included into the scummvm directory you copied to the SD card, and then lau
Building from binaries
==============================
-* ToDO *
+It's pretty simple if you are running Linux on an x86/amd64 machine:
+1. Download and install the OpenDingux toolchain (http://www.treewalker.org/opendingux/)
+2. Download ScummVM sources and uncompress them
+3. Create a build directory and run configure specifying the correct library path. Eg.
+ mkdir build_dingux
+ LDFLAGS="-L/path-to-toolchain/usr/lib" ../path-to-scummvm-sources/configure --host=dingux --enable-plugins --default-dynamic
+ make
+4. Prepare the distribution directory
+ make dingux-dist
+5. Copy the distribution directory located in dingux-dist/scummvm to your SD card
+6. Enjoy
Kernel and rootfs WARNINGS
==============================
+
+*** A WARNING about the WARNING! ***
+The info below should no longer be valid relating to the new OpenDingux (http://www.treewalker.org/opendingux/)
+toolchain. When using OpenDingux you don't need custom kernels or libraries,
+after some checking I will remove the following warnings and keep OpenDingux
+as the only supported toolchain.
+
All the dingux root images (rootfs) i found floating on the net have
broken tremor libraries, which make scummvm crash in a bad way.
One solution is to replace the libraries in your rootfs by injecting these fixed ones:
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
index 882078fe46..e0aca42856 100644
--- a/backends/platform/dingux/dingux.mk
+++ b/backends/platform/dingux/dingux.mk
@@ -28,3 +28,4 @@ endif
$(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
$(CP) $(srcdir)/backends/platform/dingux/scummvm.gpe $(bundle_name)/
$(CP) $(srcdir)/backends/platform/dingux/README.DINGUX $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/dingux/scummvm.png $(bundle_name)/
diff --git a/backends/platform/dingux/scummvm.png b/backends/platform/dingux/scummvm.png
new file mode 100644
index 0000000000..128e59efc4
--- /dev/null
+++ b/backends/platform/dingux/scummvm.png
Binary files differ
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index 03729c5e6e..3192e2d277 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -45,7 +45,7 @@ static Common::String getSavePath() {
// GBAMP Save File Manager
//////////////////////////
-Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename) {
+Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
Common::String fileSpec = getSavePath();
if (fileSpec.lastChar() != '/')
fileSpec += '/';
diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h
index 492054dc52..0d9d9aca8c 100644
--- a/backends/platform/ds/arm9/source/gbampsave.h
+++ b/backends/platform/ds/arm9/source/gbampsave.h
@@ -27,7 +27,7 @@
class GBAMPSaveFileManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
virtual bool removeSavefile(const Common::String &filename);
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 73340ed18a..a4b9c842fc 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -280,7 +280,7 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
#define MISALIGNED16(ptr) (((u32) (ptr) & 1) != 0)
-void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
if (!_graphicsEnable) return;
if (w <= 1) return;
if (h < 0) return;
@@ -509,13 +509,13 @@ void OSystem_DS::clearOverlay() {
// consolePrintf("clearovl\n");
}
-void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) {
+void OSystem_DS::grabOverlay(void *buf, int pitch) {
// consolePrintf("grabovl\n")
u16 *start = DS::get16BitBackBuffer();
for (int y = 0; y < 200; y++) {
u16 *src = start + (y * 320);
- u16 *dest = ((u16 *) (buf)) + (y * pitch);
+ u16 *dest = (u16 *)((u8 *)buf + (y * pitch));
for (int x = 0; x < 320; x++) {
*dest++ = *src++;
@@ -524,9 +524,9 @@ void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) {
}
-void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_DS::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
u16 *bg = (u16 *) DS::get16BitBackBuffer();
- const u16 *src = (const u16 *) buf;
+ const u8 *source = (const u8 *)buf;
// if (x + w > 256) w = 256 - x;
//if (x + h > 256) h = 256 - y;
@@ -536,7 +536,7 @@ void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, in
for (int dy = y; dy < y + h; dy++) {
-
+ const u16 *src = (const u16 *)source;
// Slow but save copy:
for (int dx = x; dx < x + w; dx++) {
@@ -546,7 +546,7 @@ void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, in
//consolePrintf("%d,", *src);
src++;
}
- src += (pitch - w);
+ source += pitch;
// Fast but broken copy: (why?)
/*
@@ -580,7 +580,7 @@ bool OSystem_DS::showMouse(bool visible) {
void OSystem_DS::warpMouse(int x, int y) {
}
-void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, int targetCursorScale, const Graphics::PixelFormat *format) {
+void OSystem_DS::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
if ((w > 0) && (w < 64) && (h > 0) && (h < 64)) {
memcpy(_cursorImage, buf, w * h);
_cursorW = w;
@@ -588,7 +588,9 @@ void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, i
_cursorHotX = hotspotX;
_cursorHotY = hotspotY;
_cursorKey = keycolor;
- _cursorScale = targetCursorScale;
+ // TODO: The old target scales was saved, but never used. Should the
+ // new "do not scale" logic be implemented?
+ //_cursorScale = targetCursorScale;
refreshCursor();
}
}
@@ -688,6 +690,7 @@ void OSystem_DS::getTimeAndDate(TimeDate &td) const {
td.tm_mday = t.tm_mday;
td.tm_mon = t.tm_mon;
td.tm_year = t.tm_year;
+ td.tm_wday = t.tm_wday;
}
FilesystemFactory *OSystem_DS::getFilesystemFactory() {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 6aa3731916..a6001da764 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -98,15 +98,15 @@ protected:
public:
void restoreHardwarePalette();
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
virtual void setShakePos(int shakeOffset);
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); }
@@ -114,7 +114,7 @@ public:
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, int targetCursorScale, const Graphics::PixelFormat *format);
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
diff --git a/backends/platform/gph/caanoo-bundle.mk b/backends/platform/gph/caanoo-bundle.mk
index 2cf8e62b37..2cf8e62b37 100755..100644
--- a/backends/platform/gph/caanoo-bundle.mk
+++ b/backends/platform/gph/caanoo-bundle.mk
diff --git a/backends/platform/gph/gp2xwiz-bundle.mk b/backends/platform/gph/gp2xwiz-bundle.mk
index 4f49850813..4f49850813 100755..100644
--- a/backends/platform/gph/gp2xwiz-bundle.mk
+++ b/backends/platform/gph/gp2xwiz-bundle.mk
diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp
index 49a1edf411..485780b472 100644
--- a/backends/platform/gph/gph-backend.cpp
+++ b/backends/platform/gph/gph-backend.cpp
@@ -20,6 +20,8 @@
*
*/
+#if defined(GPH_DEVICE)
+
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
@@ -32,8 +34,6 @@
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
-#include "base/main.h"
-
#include "common/archive.h"
#include "common/config-manager.h"
#include "common/debug.h"
@@ -64,23 +64,6 @@ void OSystem_GPH::initBackend() {
assert(!_inited);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new GPHEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0) {
- _graphicsManager = new GPHGraphicsManager(_eventSource);
- }
-
- // Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new DoubleBufferSDLMixerManager();
-
- // Setup and start mixer
- _mixerManager->init();
- }
-
/* Setup default save path to be workingdir/saves */
char savePath[PATH_MAX+1];
@@ -165,16 +148,42 @@ void OSystem_GPH::initBackend() {
/* Make sure that aspect ratio correction is enabled on the 1st run to stop
users asking me what the 'wasted space' at the bottom is ;-). */
ConfMan.registerDefault("aspect_ratio", true);
+ ConfMan.registerDefault("fullscreen", true);
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new GPHEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new GPHGraphicsManager(_eventSource);
+ }
+
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
_inited = true;
}
+void OSystem_GPH::initSDL() {
+ // Check if SDL has not been initialized
+ if (!_initedSDL) {
+
+ uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
+ if (ConfMan.hasKey("disable_sdl_parachute"))
+ sdlFlags |= SDL_INIT_NOPARACHUTE;
+
+ // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
+ if (SDL_Init(sdlFlags) == -1)
+ error("Could not initialize SDL: %s", SDL_GetError());
+
+ _initedSDL = true;
+ }
+}
+
void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
@@ -222,3 +231,5 @@ void OSystem_GPH::quit() {
OSystem_POSIX::quit();
}
+
+#endif
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index 2c43af151f..876de0f358 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -21,7 +21,7 @@
*/
#include "backends/platform/gph/gph.h"
-#include "backends/plugins/posix/posix-provider.h"
+#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
#if defined(GPH_DEVICE)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
((OSystem_GPH *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/gph/gph.h b/backends/platform/gph/gph.h
index 80f43f0bab..90a798154f 100644
--- a/backends/platform/gph/gph.h
+++ b/backends/platform/gph/gph.h
@@ -26,13 +26,11 @@
#if defined(GPH_DEVICE)
#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/sdl/posix/posix.h"
#include "backends/events/gph/gph-events.h"
#include "backends/graphics/gph/gph-graphics.h"
-#define __GP2XWIZ__
-
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
@@ -45,6 +43,11 @@ public:
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
void quit();
+
+protected:
+ bool _inited;
+ bool _initedSDL;
+ virtual void initSDL();
};
#endif
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 19e4f2ce9b..9c45a240cb 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -86,9 +86,17 @@ struct VideoContext {
int shakeOffsetY;
};
+struct InternalEvent {
+ InternalEvent() : type(), value1(), value2() {}
+ InternalEvent(InputEvent t, int v1, int v2) : type(t), value1(v1), value2(v2) {}
+
+ InputEvent type;
+ int value1, value2;
+};
+
// On the ObjC side
void iPhone_updateScreen();
-bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY);
+bool iPhone_fetchEvent(InternalEvent *event);
const char *iPhone_getDocumentsDir();
bool iPhone_isHighResDevice();
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 1405fe35f1..6b8c25ebcf 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -34,10 +34,13 @@
#include "iphone_keyboard.h"
#include "iphone_common.h"
+#include "common/list.h"
+
@interface iPhoneView : UIView {
VideoContext _videoContext;
- NSMutableArray *_events;
+ Common::List<InternalEvent> _events;
+ NSLock *_eventLock;
SoftKeyboard *_keyboardView;
EAGLContext *_context;
@@ -94,14 +97,14 @@
- (void)updateMouseCursorScaling;
- (void)updateMouseCursor;
-- (id)getEvent;
-
- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation;
- (void)applicationSuspend;
- (void)applicationResume;
+- (bool)fetchEvent:(InternalEvent *)event;
+
@end
extern iPhoneView *g_iPhoneViewInstance;
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index 5b78237ff7..2ae1b0e692 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -65,23 +65,8 @@ void iPhone_updateScreen() {
}
}
-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;
+bool iPhone_fetchEvent(InternalEvent *event) {
+ return [g_iPhoneViewInstance fetchEvent:event];
}
uint getSizeNextPOT(uint size) {
@@ -197,6 +182,8 @@ const char *iPhone_getDocumentsDir() {
_firstTouch = NULL;
_secondTouch = NULL;
+ _eventLock = [[NSLock alloc] init];
+
_gameScreenVertCoords[0] = _gameScreenVertCoords[1] =
_gameScreenVertCoords[2] = _gameScreenVertCoords[3] =
_gameScreenVertCoords[4] = _gameScreenVertCoords[5] =
@@ -242,6 +229,7 @@ const char *iPhone_getDocumentsDir() {
_videoContext.overlayTexture.free();
_videoContext.mouseTexture.free();
+ [_eventLock dealloc];
[super dealloc];
}
@@ -280,6 +268,11 @@ const char *iPhone_getDocumentsDir() {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); printOpenGLError();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); printOpenGLError();
+ // We use GL_CLAMP_TO_EDGE here to avoid artifacts when linear filtering
+ // is used. If we would not use this for example the cursor in Loom would
+ // have a line/border artifact on the right side of the covered rect.
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); printOpenGLError();
}
- (void)setGraphicsMode {
@@ -488,7 +481,7 @@ const char *iPhone_getDocumentsDir() {
else if (_videoContext.screenWidth == 640 && _videoContext.screenHeight == 400)
adjustedHeight = 480;
}
-
+
float overlayPortraitRatio;
if (_orientation == UIDeviceOrientationLandscapeLeft || _orientation == UIDeviceOrientationLandscapeRight) {
@@ -575,23 +568,23 @@ const char *iPhone_getDocumentsDir() {
}
}
-- (id)getEvent {
- if (_events == nil || [_events count] == 0) {
- return nil;
- }
-
- id event = [_events objectAtIndex: 0];
-
- [_events removeObjectAtIndex: 0];
-
- return event;
+- (void)addEvent:(InternalEvent)event {
+ [_eventLock lock];
+ _events.push_back(event);
+ [_eventLock unlock];
}
-- (void)addEvent:(NSDictionary *)event {
- if (_events == nil)
- _events = [[NSMutableArray alloc] init];
+- (bool)fetchEvent:(InternalEvent *)event {
+ [_eventLock lock];
+ if (_events.empty()) {
+ [_eventLock unlock];
+ return false;
+ }
- [_events addObject: event];
+ *event = *_events.begin();
+ _events.pop_front();
+ [_eventLock unlock];
+ return true;
}
/**
@@ -664,14 +657,7 @@ const char *iPhone_getDocumentsDir() {
return;
}
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputOrientationChanged], @"type",
- [NSNumber numberWithInt:orientation], @"x",
- [NSNumber numberWithInt:0], @"y",
- nil
- ]
- ];
+ [self addEvent:InternalEvent(kInputOrientationChanged, orientation, 0)];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
@@ -686,14 +672,7 @@ const char *iPhone_getDocumentsDir() {
return;
_firstTouch = touch;
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseDown], @"type",
- [NSNumber numberWithInt:x], @"x",
- [NSNumber numberWithInt:y], @"y",
- nil
- ]
- ];
+ [self addEvent:InternalEvent(kInputMouseDown, x, y)];
break;
}
@@ -704,14 +683,7 @@ const char *iPhone_getDocumentsDir() {
return;
_secondTouch = touch;
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseSecondDown], @"type",
- [NSNumber numberWithInt:x], @"x",
- [NSNumber numberWithInt:y], @"y",
- nil
- ]
- ];
+ [self addEvent:InternalEvent(kInputMouseSecondDown, x, y)];
break;
}
}
@@ -727,27 +699,13 @@ const char *iPhone_getDocumentsDir() {
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
- ]
- ];
+ [self addEvent:InternalEvent(kInputMouseDragged, x, y)];
} 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
- ]
- ];
+ [self addEvent:InternalEvent(kInputMouseSecondDragged, x, y)];
}
}
}
@@ -763,14 +721,7 @@ const char *iPhone_getDocumentsDir() {
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
- ]
- ];
+ [self addEvent:InternalEvent(kInputMouseUp, x, y)];
break;
}
@@ -780,14 +731,7 @@ const char *iPhone_getDocumentsDir() {
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
- ]
- ];
+ [self addEvent:InternalEvent(kInputMouseSecondUp, x, y)];
break;
}
}
@@ -797,14 +741,7 @@ const char *iPhone_getDocumentsDir() {
}
- (void)handleKeyPress:(unichar)c {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputKeyPressed], @"type",
- [NSNumber numberWithInt:c], @"x",
- [NSNumber numberWithInt:0], @"y",
- nil
- ]
- ];
+ [self addEvent:InternalEvent(kInputKeyPressed, c, 0)];
}
- (BOOL)canHandleSwipes {
@@ -814,38 +751,16 @@ const char *iPhone_getDocumentsDir() {
- (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
- ]
- ];
-
+ [self addEvent:InternalEvent(kInputSwipe, num, 0)];
return 0;
}
- (void)applicationSuspend {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputApplicationSuspended], @"type",
- [NSNumber numberWithInt:0], @"x",
- [NSNumber numberWithInt:0], @"y",
- nil
- ]
- ];
+ [self addEvent:InternalEvent(kInputApplicationSuspended, 0, 0)];
}
- (void)applicationResume {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputApplicationResumed], @"type",
- [NSNumber numberWithInt:0], @"x",
- [NSNumber numberWithInt:0], @"y",
- nil
- ]
- ];
+ [self addEvent:InternalEvent(kInputApplicationResumed, 0, 0)];
}
@end
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index 85efbda208..9cfca0836e 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -46,41 +46,40 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
return true;
}
- int eventType;
- int x, y;
+ InternalEvent internalEvent;
- if (iPhone_fetchEvent(&eventType, &x, &y)) {
- switch ((InputEvent)eventType) {
+ if (iPhone_fetchEvent(&internalEvent)) {
+ switch (internalEvent.type) {
case kInputMouseDown:
- if (!handleEvent_mouseDown(event, x, y))
+ if (!handleEvent_mouseDown(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputMouseUp:
- if (!handleEvent_mouseUp(event, x, y))
+ if (!handleEvent_mouseUp(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputMouseDragged:
- if (!handleEvent_mouseDragged(event, x, y))
+ if (!handleEvent_mouseDragged(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputMouseSecondDragged:
- if (!handleEvent_mouseSecondDragged(event, x, y))
+ if (!handleEvent_mouseSecondDragged(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputMouseSecondDown:
_secondaryTapped = true;
- if (!handleEvent_secondMouseDown(event, x, y))
+ if (!handleEvent_secondMouseDown(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputMouseSecondUp:
_secondaryTapped = false;
- if (!handleEvent_secondMouseUp(event, x, y))
+ if (!handleEvent_secondMouseUp(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputOrientationChanged:
- handleEvent_orientationChanged(x);
+ handleEvent_orientationChanged(internalEvent.value1);
return false;
break;
@@ -90,11 +89,11 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
break;
case kInputKeyPressed:
- handleEvent_keyPressed(event, x);
+ handleEvent_keyPressed(event, internalEvent.value1);
break;
case kInputSwipe:
- if (!handleEvent_swipe(event, x))
+ if (!handleEvent_swipe(event, internalEvent.value1))
return false;
break;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 9a33cd8968..f9b2a81ce6 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -145,15 +145,14 @@ bool OSystem_IPHONE::getFeatureState(Feature f) {
void OSystem_IPHONE::suspendLoop() {
bool done = false;
- int eventType;
- int x, y;
uint32 startTime = getMillis();
stopSoundsystem();
+ InternalEvent event;
while (!done) {
- if (iPhone_fetchEvent(&eventType, &x, &y))
- if ((InputEvent)eventType == kInputApplicationResumed)
+ if (iPhone_fetchEvent(&event))
+ if (event.type == kInputApplicationResumed)
done = true;
usleep(100000);
}
@@ -236,6 +235,7 @@ void OSystem_IPHONE::getTimeAndDate(TimeDate &td) const {
td.tm_mday = t.tm_mday;
td.tm_mon = t.tm_mon;
td.tm_year = t.tm_year;
+ td.tm_wday = t.tm_wday;
}
Audio::Mixer *OSystem_IPHONE::getMixer() {
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index b443e22f56..037125490d 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -143,7 +143,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
@@ -152,8 +152,8 @@ public:
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<5551>(); }
@@ -161,7 +161,7 @@ public:
virtual bool showMouse(bool visible);
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 setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual bool pollEvent(Common::Event &event);
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index 6f80a6cba3..ebe435cb25 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -137,6 +137,7 @@ int16 OSystem_IPHONE::getWidth() {
}
void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
+ //printf("setPalette(%p, %u, %u)\n", colors, start, num);
assert(start + num <= 256);
const byte *b = colors;
@@ -150,6 +151,7 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
}
void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) {
+ //printf("grabPalette(%p, %u, %u)\n", colors, start, num);
assert(start + num <= 256);
byte *b = colors;
@@ -159,18 +161,19 @@ void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) {
}
}
-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);
+void OSystem_IPHONE::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
+ //printf("copyRectToScreen(%p, %d, %i, %i, %i, %i)\n", buf, pitch, x, y, w, h);
//Clip the coordinates
+ const byte *src = (const byte *)buf;
if (x < 0) {
w += x;
- buf -= x;
+ src -= x;
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -191,22 +194,22 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y,
byte *dst = (byte *)_framebuffer.getBasePtr(x, y);
if (_framebuffer.pitch == pitch && _framebuffer.w == w) {
- memcpy(dst, buf, h * pitch);
+ memcpy(dst, src, h * pitch);
} else {
do {
- memcpy(dst, buf, w * _framebuffer.format.bytesPerPixel);
- buf += pitch;
+ memcpy(dst, src, w * _framebuffer.format.bytesPerPixel);
+ src += pitch;
dst += _framebuffer.pitch;
} while (--h);
}
}
void OSystem_IPHONE::updateScreen() {
- //printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size());
-
if (_dirtyRects.size() == 0 && _dirtyOverlayRects.size() == 0 && !_mouseDirty)
return;
+ //printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size());
+
internUpdateScreen();
_mouseDirty = false;
_fullScreenIsDirty = false;
@@ -306,31 +309,33 @@ void OSystem_IPHONE::clearOverlay() {
dirtyFullOverlayScreen();
}
-void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
+void OSystem_IPHONE::grabOverlay(void *buf, int pitch) {
//printf("grabOverlay()\n");
int h = _videoContext->overlayHeight;
+ byte *dst = (byte *)buf;
const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0);
do {
- memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor));
+ memcpy(dst, src, _videoContext->overlayWidth * sizeof(uint16));
src += _videoContext->overlayTexture.pitch;
- buf += pitch;
+ dst += 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);
+void OSystem_IPHONE::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
+ //printf("copyRectToOverlay(%p, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", (const void *)buf, pitch, x, y, w, h);
+ const byte *src = (const byte *)buf;
//Clip the coordinates
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * sizeof(uint16);
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -348,9 +353,9 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
}
byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y);
- do {
- memcpy(dst, buf, w * sizeof(OverlayColor));
- buf += pitch;
+ do {
+ memcpy(dst, src, w * sizeof(uint16));
+ src += pitch;
dst += _videoContext->overlayTexture.pitch;
} while (--h);
}
@@ -364,6 +369,7 @@ int16 OSystem_IPHONE::getOverlayWidth() {
}
bool OSystem_IPHONE::showMouse(bool visible) {
+ //printf("showMouse(%d)\n", visible);
bool last = _videoContext->mouseIsVisible;
_videoContext->mouseIsVisible = visible;
_mouseDirty = true;
@@ -372,7 +378,7 @@ bool OSystem_IPHONE::showMouse(bool visible) {
}
void OSystem_IPHONE::warpMouse(int x, int y) {
- //printf("warpMouse()\n");
+ //printf("warpMouse(%d, %d)\n", x, y);
_videoContext->mouseX = x;
_videoContext->mouseY = y;
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(notifyMouseMove) withObject:nil waitUntilDone: YES];
@@ -395,8 +401,8 @@ void OSystem_IPHONE::dirtyFullOverlayScreen() {
}
}
-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);
+void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+ //printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, dontScale, (const void *)format);
const Graphics::PixelFormat pixelFormat = format ? *format : Graphics::PixelFormat::createFormatCLUT8();
#if 0
@@ -424,11 +430,12 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot
}
void OSystem_IPHONE::setCursorPalette(const byte *colors, uint start, uint num) {
+ //printf("setCursorPalette(%p, %u, %u)\n", (const void *)colors, start, 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;
diff --git a/backends/platform/maemo/debian/changelog b/backends/platform/maemo/debian/changelog
index 8a9d8ee3c3..ea44574e96 100644
--- a/backends/platform/maemo/debian/changelog
+++ b/backends/platform/maemo/debian/changelog
@@ -1,8 +1,20 @@
-scummvm (1.5.0~git) unstable; urgency=low
+scummvm (1.6.0~git) unstable; urgency=low
* Development snapshot
- -- Tarek Soliman <tsoliman@scummvm.org> Tue, 15 Nov 2011 14:56:57 -0600
+ -- Tarek Soliman <tsoliman@scummvm.org> Tue, 10 Jul 2012 23:02:00 -0500
+
+scummvm (1.5.0) unstable; urgency=low
+
+ * 1.5.0 release
+
+ -- Tarek Soliman <tsoliman@scummvm.org> Fri, 20 Jul 2012 14:48:44 -0500
+
+scummvm (1.4.1) unstable; urgency=low
+
+ * 1.4.1 release
+
+ -- Tarek Soliman <tsoliman@scummvm.org> Wed, 11 Jan 2012 17:17:26 -0600
scummvm (1.4.0) unstable; urgency=low
diff --git a/backends/platform/maemo/debian/control b/backends/platform/maemo/debian/control
index 6e1dfe2fd4..bdaccd2359 100644
--- a/backends/platform/maemo/debian/control
+++ b/backends/platform/maemo/debian/control
@@ -2,7 +2,7 @@ Source: scummvm
Section: user/games
Priority: optional
Maintainer: Tarek Soliman <tsoliman@scummvm.org>
-Build-Depends: debhelper (>> 4.0.0), libsdl1.2-dev, libmad0-dev, libasound2-dev, libvorbisidec-dev, libmpeg2-4-dev, libflac-dev (>= 1.1.2), libz-dev, quilt
+Build-Depends: debhelper (>> 4.0.0), libsdl1.2-dev, libmad0-dev, libasound2-dev, libvorbisidec-dev, libmpeg2-4-dev, libflac-dev (>= 1.1.2), libfreetype6-dev, libz-dev, quilt
Standards-Version: 3.6.1.1
Package: scummvm
diff --git a/backends/platform/maemo/debian/rules b/backends/platform/maemo/debian/rules
index 64add08de8..c713403876 100755
--- a/backends/platform/maemo/debian/rules
+++ b/backends/platform/maemo/debian/rules
@@ -47,10 +47,10 @@ install: build
install -m0644 gui/themes/scummclassic.zip gui/themes/scummmodern.zip debian/scummvm/opt/scummvm/share
install -m0644 backends/vkeybd/packs/vkeybd_default.zip debian/scummvm/opt/scummvm/share
# for optified version we can also add engine datafiles
- install -m0644 dists/engine-data/drascula.dat dists/engine-data/hugo.dat dists/engine-data/kyra.dat dists/engine-data/lure.dat dists/engine-data/queen.tbl dists/engine-data/sky.cpt dists/engine-data/teenagent.dat dists/engine-data/toon.dat debian/scummvm/opt/scummvm/share
+ install -m0644 dists/engine-data/drascula.dat dists/engine-data/hugo.dat dists/engine-data/kyra.dat dists/engine-data/lure.dat dists/engine-data/queen.tbl dists/engine-data/sky.cpt dists/engine-data/teenagent.dat dists/engine-data/tony.dat dists/engine-data/toon.dat debian/scummvm/opt/scummvm/share
install -m0644 -d debian/scummvm/usr/share/doc/scummvm
- install -m0644 NEWS README COPYRIGHT debian/scummvm/usr/share/doc/scummvm
+ install -m0644 AUTHORS COPYING COPYING.BSD COPYING.FREEFONT COPYING.LGPL COPYRIGHT NEWS README debian/scummvm/usr/share/doc/scummvm
binary: binary-arch
binary-arch: build install
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp
index e296d4787c..6bd229177b 100644
--- a/backends/platform/maemo/maemo.cpp
+++ b/backends/platform/maemo/maemo.cpp
@@ -43,6 +43,7 @@ namespace Maemo {
OSystem_SDL_Maemo::OSystem_SDL_Maemo()
:
+ _eventObserver(0),
OSystem_POSIX() {
}
@@ -84,6 +85,9 @@ static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymap
#endif
void OSystem_SDL_Maemo::initBackend() {
+ ConfMan.registerDefault("fullscreen", true);
+ ConfMan.registerDefault("aspect_ratio", true);
+
// Create the events manager
if (_eventSource == 0)
_eventSource = new MaemoSdlEventSource();
@@ -180,6 +184,7 @@ void OSystem_SDL_Maemo::setupIcon() {
// http://bugzilla.libsdl.org/show_bug.cgi?id=586
}
+#ifdef ENABLE_KEYMAPPER
static const Common::KeyTableEntry maemoKeys[] = {
// Function keys
{"MENU", Common::KEYCODE_F11, 0, "Menu", false},
@@ -191,7 +196,6 @@ static const Common::KeyTableEntry maemoKeys[] = {
{0, Common::KEYCODE_INVALID, 0, 0, false}
};
-#ifdef ENABLE_KEYMAPPER
Common::HardwareInputSet *OSystem_SDL_Maemo::getHardwareInputSet() {
return new Common::HardwareInputSet(true, maemoKeys);
}
diff --git a/backends/platform/n64/framfs_save_manager.h b/backends/platform/n64/framfs_save_manager.h
index da553e423a..0a88c8666b 100644
--- a/backends/platform/n64/framfs_save_manager.h
+++ b/backends/platform/n64/framfs_save_manager.h
@@ -100,10 +100,10 @@ public:
class FRAMSaveManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
OutFRAMSave *s = new OutFRAMSave(filename.c_str());
if (!s->err()) {
- return Common::wrapCompressedWriteStream(s);
+ return compress ? Common::wrapCompressedWriteStream(s) : s;
} else {
delete s;
return 0;
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 4788beb1ca..249f72d8fc 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -81,7 +81,7 @@ protected:
uint16 *_offscreen_hic; // Offscreen converted to 16bit surface
uint8 *_offscreen_pal; // Offscreen with palette indexes
- OverlayColor *_overlayBuffer; // Offscreen for the overlay (16 bit)
+ uint16 *_overlayBuffer; // Offscreen for the overlay (16 bit)
uint16 *_screenPalette; // Array for palette entries (256 colors max)
@@ -162,7 +162,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
@@ -171,8 +171,8 @@ public:
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual Graphics::PixelFormat getOverlayFormat() const {
@@ -182,7 +182,7 @@ public:
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual bool pollEvent(Common::Event &event);
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index c3adb9691c..7d6f8f0b5c 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -95,7 +95,7 @@ OSystem_N64::OSystem_N64() {
// Allocate memory for offscreen buffers
_offscreen_hic = (uint16 *)memalign(8, _screenWidth * _screenHeight * 2);
_offscreen_pal = (uint8 *)memalign(8, _screenWidth * _screenHeight);
- _overlayBuffer = (uint16 *)memalign(8, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
+ _overlayBuffer = (uint16 *)memalign(8, _overlayWidth * _overlayHeight * sizeof(uint16));
_cursor_pal = NULL;
_cursor_hic = NULL;
@@ -108,7 +108,7 @@ OSystem_N64::OSystem_N64() {
// Clean offscreen buffers
memset(_offscreen_hic, 0, _screenWidth * _screenHeight * 2);
memset(_offscreen_pal, 0, _screenWidth * _screenHeight);
- memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
+ memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(uint16));
// Default graphic mode
_graphicMode = OVERS_NTSC_340X240;
@@ -442,17 +442,18 @@ void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) {
_dirtyOffscreen = true;
}
-void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_N64::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
//Clip the coordinates
+ const byte *src = (const byte *)buf;
if (x < 0) {
w += x;
- buf -= x;
+ src -= x;
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -472,14 +473,14 @@ void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
do {
for (int hor = 0; hor < w; hor++) {
- if (dst_pal[hor] != buf[hor]) {
- uint16 color = _screenPalette[buf[hor]];
+ if (dst_pal[hor] != src[hor]) {
+ uint16 color = _screenPalette[src[hor]];
dst_hicol[hor] = color; // Save image converted to 16-bit
- dst_pal[hor] = buf[hor]; // Save palettized display
+ dst_pal[hor] = src[hor]; // Save palettized display
}
}
- buf += pitch;
+ src += pitch;
dst_pal += _screenWidth;
dst_hicol += _screenWidth;
} while (--h);
@@ -666,7 +667,7 @@ void OSystem_N64::hideOverlay() {
}
void OSystem_N64::clearOverlay() {
- memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
+ memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(uint16));
uint8 skip_lines = (_screenHeight - _gameHeight) / 4;
uint8 skip_pixels = (_screenWidth - _gameWidth) / 2; // Center horizontally the image
@@ -682,28 +683,30 @@ void OSystem_N64::clearOverlay() {
_dirtyOffscreen = true;
}
-void OSystem_N64::grabOverlay(OverlayColor *buf, int pitch) {
+void OSystem_N64::grabOverlay(void *buf, int pitch) {
int h = _overlayHeight;
- OverlayColor *src = _overlayBuffer;
+ uint16 *src = _overlayBuffer;
+ byte *dst = (byte *)buf;
do {
- memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
+ memcpy(dst, src, _overlayWidth * sizeof(uint16));
src += _overlayWidth;
- buf += pitch;
+ dst += pitch;
} while (--h);
}
-void OSystem_N64::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_N64::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
+ const byte *src = (const byte *)buf;
//Clip the coordinates
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * sizeof(uint16);
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -719,14 +722,14 @@ void OSystem_N64::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i
return;
- OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x);
+ uint16 *dst = _overlayBuffer + (y * _overlayWidth + x);
- if (_overlayWidth == pitch && pitch == w) {
- memcpy(dst, buf, h * w * sizeof(OverlayColor));
+ if (_overlayWidth == w && pitch == _overlayWidth * sizeof(uint16)) {
+ memcpy(dst, src, h * pitch);
} else {
do {
- memcpy(dst, buf, w * sizeof(OverlayColor));
- buf += pitch;
+ memcpy(dst, src, w * sizeof(uint16));
+ src += pitch;
dst += _overlayWidth;
} while (--h);
}
@@ -773,7 +776,7 @@ void OSystem_N64::warpMouse(int x, int y) {
_dirtyOffscreen = true;
}
-void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+void OSystem_N64::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
if (!w || !h) return;
_mouseHotspotX = hotspotX;
@@ -866,6 +869,7 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
t.tm_mday = 1;
t.tm_mon = 0;
t.tm_year = 110;
+ t.tm_wday = 0;
return;
}
diff --git a/backends/platform/n64/pakfs_save_manager.h b/backends/platform/n64/pakfs_save_manager.h
index e0fcbc1e2d..6e67fb0f5f 100644
--- a/backends/platform/n64/pakfs_save_manager.h
+++ b/backends/platform/n64/pakfs_save_manager.h
@@ -101,10 +101,10 @@ public:
class PAKSaveManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
OutPAKSave *s = new OutPAKSave(filename.c_str());
if (!s->err()) {
- return Common::wrapCompressedWriteStream(s);
+ return compress ? Common::wrapCompressedWriteStream(s) : s;
} else {
delete s;
return NULL;
diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk
index 5bd568e1c4..5bd568e1c4 100755..100644
--- a/backends/platform/openpandora/module.mk
+++ b/backends/platform/openpandora/module.mk
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index dcec387f97..354aa24b24 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -54,53 +54,15 @@
/* Dump console info to files. */
#define DUMP_STDOUT
-static SDL_Cursor *hiddenCursor;
-
OSystem_OP::OSystem_OP()
:
OSystem_POSIX() {
}
-//static Uint32 timer_handler(Uint32 interval, void *param) {
-// ((DefaultTimerManager *)param)->handler();
-// return interval;
-//}
-
void OSystem_OP::initBackend() {
assert(!_inited);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new OPEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0) {
- _graphicsManager = new OPGraphicsManager(_eventSource);
- }
-
-// int joystick_num = ConfMan.getInt("joystick_num");
-// uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
-//
-// if (ConfMan.hasKey("disable_sdl_parachute"))
-// sdlFlags |= SDL_INIT_NOPARACHUTE;
-//
-// if (joystick_num > -1)
-// sdlFlags |= SDL_INIT_JOYSTICK;
-//
-// if (SDL_Init(sdlFlags) == -1) {
-// error("Could not initialize SDL: %s", SDL_GetError());
-// }
-//
-
- // Create the mixer manager
-// if (_mixer == 0) {
-// _mixerManager = new DoubleBufferSDLMixerManager();
-
- // Setup and start mixer
-// _mixerManager->init();
-// }
-
/* Setup default save path to be workingdir/saves */
char savePath[PATH_MAX+1];
@@ -179,7 +141,14 @@ void OSystem_OP::initBackend() {
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
-// _graphicsMutex = createMutex();
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new OPEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new OPGraphicsManager(_eventSource);
+ }
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
@@ -187,24 +156,6 @@ void OSystem_OP::initBackend() {
_inited = true;
}
-// enable joystick
-// if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
-// printf("Using joystick: %s\n", SDL_JoystickName(0));
-// _joystick = SDL_JoystickOpen(joystick_num);
-// }
-//
-// setupMixer();
-
-// Note: We could implement a custom SDLTimerManager by using
-// SDL_AddTimer. That might yield better timer resolution, but it would
-// also change the semantics of a timer: Right now, ScummVM timers
-// *never* run in parallel, due to the way they are implemented. If we
-// switched to SDL_AddTimer, each timer might run in a separate thread.
-// However, not all our code is prepared for that, so we can't just
-// switch. Still, it's a potential future change to keep in mind.
-// _timer = new DefaultTimerManager();
-// _timerID = SDL_AddTimer(10, &timer_handler, _timer);
-
void OSystem_OP::initSDL() {
// Check if SDL has not been initialized
if (!_initedSDL) {
@@ -217,38 +168,7 @@ void OSystem_OP::initSDL() {
if (SDL_Init(sdlFlags) == -1)
error("Could not initialize SDL: %s", SDL_GetError());
- uint8_t hiddenCursorData = 0;
-
- hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
-
- /* On the OpenPandora we need to work around an SDL assumption that
- returns relative mouse coordinates when you get to the screen
- edges using the touchscreen. The workaround is to set a blank
- SDL cursor and not disable it (Hackish I know).
-
- The root issues likes in the Windows Manager GRAB code in SDL.
- That is why the issue is not seen on framebuffer devices like the
- GP2X (there is no X window manager ;)).
- */
- SDL_ShowCursor(SDL_ENABLE);
- SDL_SetCursor(hiddenCursor);
- SDL_EnableUNICODE(1);
-
-// memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
-// memset(&_videoMode, 0, sizeof(_videoMode));
-// memset(&_transactionDetails, 0, sizeof(_transactionDetails));
-
-// _videoMode.mode = GFX_DOUBLESIZE;
-// _videoMode.scaleFactor = 2;
-// _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
-// _scalerProc = Normal2x;
-// _scalerType = 0;
-
-// _videoMode.fullscreen = true;
-
_initedSDL = true;
-
-// OSystem_POSIX::initSDL();
}
}
@@ -275,8 +195,6 @@ void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
void OSystem_OP::quit() {
- SDL_FreeCursor(hiddenCursor);
-
#ifdef DUMP_STDOUT
printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
fclose(stdout);
diff --git a/backends/platform/openpandora/op-bundle.mk b/backends/platform/openpandora/op-bundle.mk
index 284a0497a8..284a0497a8 100755..100644
--- a/backends/platform/openpandora/op-bundle.mk
+++ b/backends/platform/openpandora/op-bundle.mk
diff --git a/backends/platform/openpandora/op-options.cpp b/backends/platform/openpandora/op-options.cpp
index 58f0fb7188..005a76b76c 100644
--- a/backends/platform/openpandora/op-options.cpp
+++ b/backends/platform/openpandora/op-options.cpp
@@ -33,7 +33,8 @@ enum {
/* Touchscreen TapMode */
TAPMODE_LEFT = 0,
TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
+ TAPMODE_HOVER = 2,
+ TAPMODE_HOVER_DPAD = 3
};
int tapmodeLevel = TAPMODE_LEFT;
@@ -44,6 +45,8 @@ void ToggleTapMode() {
} else if (tapmodeLevel == TAPMODE_RIGHT) {
tapmodeLevel = TAPMODE_HOVER;
} else if (tapmodeLevel == TAPMODE_HOVER) {
+ tapmodeLevel = TAPMODE_HOVER_DPAD;
+ } else if (tapmodeLevel == TAPMODE_HOVER_DPAD) {
tapmodeLevel = TAPMODE_LEFT;
} else {
tapmodeLevel = TAPMODE_LEFT;
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 8cccbb5f86..1eddad5c4a 100644
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -31,8 +31,6 @@
#include "backends/events/openpandora/op-events.h"
#include "backends/graphics/openpandora/op-graphics.h"
-//#define MIXER_DOUBLE_BUFFERING 1
-
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 8df6198c38..f93166ef67 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -564,7 +564,7 @@ void Gs2dScreen::clearPrintfOverlay(void) {
free(tmpBuf);
}
-void Gs2dScreen::copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h) {
+void Gs2dScreen::copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h) {
WaitSema(g_DmacSema);
// warning("_overlayBuf [dst] = %x", _overlayBuf);
@@ -601,7 +601,7 @@ void Gs2dScreen::clearOverlay(void) {
SignalSema(g_DmacSema);
}
-void Gs2dScreen::grabOverlay(uint16 *buf, uint16 pitch) {
+void Gs2dScreen::grabOverlay(byte *buf, uint16 pitch) {
uint16 *src = _overlayBuf;
for (uint32 cnt = 0; cnt < _height; cnt++) {
memcpy(buf, src, _width * 2);
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index 4fbb3fdef8..005dabc809 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -62,8 +62,8 @@ public:
void updateScreen(void);
void grabPalette(uint8 *pal, uint8 start, uint16 num);
//- overlay routines
- void copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h);
- void grabOverlay(uint16 *buf, uint16 pitch);
+ void copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h);
+ void grabOverlay(byte *buf, uint16 pitch);
void clearOverlay(void);
void showOverlay(void);
void hideOverlay(void);
diff --git a/backends/platform/ps2/icon.h b/backends/platform/ps2/icon.h
index bc614bf70b..3ad19910d3 100644
--- a/backends/platform/ps2/icon.h
+++ b/backends/platform/ps2/icon.h
@@ -22,10 +22,6 @@
class PS2Icon {
public:
- PS2Icon() {};
-
- ~PS2Icon() {};
-
uint16 decompressData(uint16 **data);
void setup(mcIcon *icon);
};
diff --git a/backends/platform/ps2/ps2time.cpp b/backends/platform/ps2/ps2time.cpp
index 2c3275b2b2..1cddd230a0 100644
--- a/backends/platform/ps2/ps2time.cpp
+++ b/backends/platform/ps2/ps2time.cpp
@@ -105,8 +105,14 @@ void OSystem_PS2::readRtcTime(void) {
g_day, g_month, g_year + 2000);
}
-void OSystem_PS2::getTimeAndDate(TimeDate &t) const {
+// Tomohiko Sakamoto's 1993 algorithm for any Gregorian date
+static int dayOfWeek(int y, int m, int d) {
+ static const int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
+ y -= m < 3;
+ return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7;
+}
+void OSystem_PS2::getTimeAndDate(TimeDate &t) const {
uint32 currentSecs = g_timeSecs + (msecCount - g_lastTimeCheck) / 1000;
if (currentSecs >= SECONDS_PER_DAY) {
buildNewDate(+1);
@@ -120,4 +126,5 @@ void OSystem_PS2::getTimeAndDate(TimeDate &t) const {
t.tm_year = g_year + 100;
t.tm_mday = g_day;
t.tm_mon = g_month - 1;
+ t.tm_wday = dayOfWeek(t.tm_year, t.tm_mon, t.tm_mday);
}
diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp
index 421edc3e2e..46af42e193 100644
--- a/backends/platform/ps2/savefilemgr.cpp
+++ b/backends/platform/ps2/savefilemgr.cpp
@@ -145,7 +145,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil
return Common::wrapCompressedReadStream(sf);
}
-Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename) {
+Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename, bool compress) {
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
Common::WriteStream *sf;
@@ -193,7 +193,7 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &fil
}
_screen->wantAnim(false);
- return Common::wrapCompressedWriteStream(sf);
+ return compress ? Common::wrapCompressedWriteStream(sf) : sf;
}
bool Ps2SaveFileManager::removeSavefile(const Common::String &filename) {
diff --git a/backends/platform/ps2/savefilemgr.h b/backends/platform/ps2/savefilemgr.h
index a25fb063ae..163706eace 100644
--- a/backends/platform/ps2/savefilemgr.h
+++ b/backends/platform/ps2/savefilemgr.h
@@ -35,7 +35,7 @@ public:
virtual ~Ps2SaveFileManager();
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual Common::StringArray listSavefiles(const Common::String &pattern);
virtual bool removeSavefile(const Common::String &filename);
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index d4e993da63..5628658381 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -554,7 +554,7 @@ void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) {
_screen->grabPalette(colors, (uint8)start, (uint16)num);
}
-void OSystem_PS2::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_PS2::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
_screen->copyScreenRect((const uint8*)buf, pitch, x, y, w, h);
}
@@ -618,8 +618,8 @@ void OSystem_PS2::warpMouse(int x, int y) {
_screen->setMouseXy(x, y);
}
-void OSystem_PS2::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
- _screen->setMouseOverlay(buf, w, h, hotspot_x, hotspot_y, keycolor);
+void OSystem_PS2::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+ _screen->setMouseOverlay((const byte *)buf, w, h, hotspot_x, hotspot_y, keycolor);
}
void OSystem_PS2::showOverlay(void) {
@@ -634,12 +634,12 @@ void OSystem_PS2::clearOverlay(void) {
_screen->clearOverlay();
}
-void OSystem_PS2::grabOverlay(OverlayColor *buf, int pitch) {
- _screen->grabOverlay((uint16 *)buf, (uint16)pitch);
+void OSystem_PS2::grabOverlay(void *buf, int pitch) {
+ _screen->grabOverlay((byte *)buf, (uint16)pitch);
}
-void OSystem_PS2::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
- _screen->copyOverlayRect((const uint16*)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h);
+void OSystem_PS2::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
+ _screen->copyOverlayRect((const byte *)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h);
}
Graphics::PixelFormat OSystem_PS2::getOverlayFormat(void) const {
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 3a0e247737..99482d4da4 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -62,7 +62,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual void setShakePos(int shakeOffset);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
@@ -72,15 +72,15 @@ public:
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayWidth(void);
virtual int16 getOverlayHeight(void);
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = 0);
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0);
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP
index bc0bd35a6e..969459dc5b 100644
--- a/backends/platform/psp/README.PSP
+++ b/backends/platform/psp/README.PSP
@@ -1,4 +1,4 @@
-ScummVM-PSP 1.5.0git README
+ScummVM-PSP 1.6.0git README
==============================================================================
Installation
diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp
index 2ee7ff5b74..bc252144fa 100644
--- a/backends/platform/psp/default_display_client.cpp
+++ b/backends/platform/psp/default_display_client.cpp
@@ -123,15 +123,15 @@ void Overlay::setSize(uint32 width, uint32 height) {
_renderer.setDrawWholeBuffer(); // We need to let the renderer know how much to draw
}
-void Overlay::copyToArray(OverlayColor *buf, int pitch) {
+void Overlay::copyToArray(void *buf, int pitch) {
DEBUG_ENTER_FUNC();
- _buffer.copyToArray((byte *)buf, pitch * sizeof(OverlayColor)); // Change to bytes
+ _buffer.copyToArray((byte *)buf, pitch); // Change to bytes
}
-void Overlay::copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void Overlay::copyFromRect(const void *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
- _buffer.copyFromRect((byte *)buf, pitch * sizeof(OverlayColor), x, y, w, h); // Change to bytes
+ _buffer.copyFromRect((byte *)buf, pitch, x, y, w, h); // Change to bytes
// debug
//_buffer.print(0xFF);
setDirty();
diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h
index e1cd8e7e72..95c52e2352 100644
--- a/backends/platform/psp/default_display_client.h
+++ b/backends/platform/psp/default_display_client.h
@@ -65,15 +65,12 @@ protected:
*/
class Overlay : public DefaultDisplayClient {
public:
- Overlay() {}
- ~Overlay() {}
-
void init();
bool allocate();
void setBytesPerPixel(uint32 size);
void setSize(uint32 width, uint32 height);
- void copyToArray(OverlayColor *buf, int pitch);
- void copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ void copyToArray(void *buf, int pitch);
+ void copyFromRect(const void *buf, int pitch, int x, int y, int w, int h);
};
/**
@@ -85,7 +82,6 @@ public:
memset(&_pixelFormat, 0, sizeof(_pixelFormat));
memset(&_frameBuffer, 0, sizeof(_frameBuffer));
}
- ~Screen() {}
void init();
bool allocate();
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 10a732b1e3..c2ff84c7f5 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -302,7 +302,7 @@ void DisplayManager::init() {
// Init overlay since we never change the size
_overlay->deallocate();
- _overlay->setBytesPerPixel(sizeof(OverlayColor));
+ _overlay->setBytesPerPixel(sizeof(uint16));
_overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
_overlay->allocate();
}
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 5fa5110684..fb8c1c60bf 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -204,11 +204,11 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) {
_cursor.clearKeyColor(); // Do we need this?
}
-void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_PSP::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
_pendingUpdate = false;
- _screen.copyFromRect(buf, pitch, x, y, w, h);
+ _screen.copyFromRect((const byte *)buf, pitch, x, y, w, h);
}
Graphics::Surface *OSystem_PSP::lockScreen() {
@@ -260,12 +260,12 @@ void OSystem_PSP::clearOverlay() {
_overlay.clearBuffer();
}
-void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) {
+void OSystem_PSP::grabOverlay(void *buf, int pitch) {
DEBUG_ENTER_FUNC();
_overlay.copyToArray(buf, pitch);
}
-void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_PSP::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
_pendingUpdate = false;
@@ -303,7 +303,7 @@ void OSystem_PSP::warpMouse(int x, int y) {
_cursor.setXY(x, y);
}
-void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+void OSystem_PSP::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
_pendingUpdate = false;
@@ -314,11 +314,13 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
}
_cursor.setKeyColor(keycolor);
- _cursor.setCursorTargetScale(cursorTargetScale);
+ // TODO: The old target scale was saved but never used. Should the new
+ // "do not scale" logic be implemented?
+ //_cursor.setCursorTargetScale(cursorTargetScale);
_cursor.setSizeAndScummvmPixelFormat(w, h, format);
_cursor.setHotspot(hotspotX, hotspotY);
_cursor.clearKeyColor();
- _cursor.copyFromArray(buf);
+ _cursor.copyFromArray((const byte *)buf);
}
bool OSystem_PSP::pollEvent(Common::Event &event) {
@@ -444,6 +446,7 @@ void OSystem_PSP::getTimeAndDate(TimeDate &td) const {
td.tm_mday = t.tm_mday;
td.tm_mon = t.tm_mon;
td.tm_year = t.tm_year;
+ td.tm_wday = t.tm_wday;
}
Common::String OSystem_PSP::getDefaultConfigFileName() {
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index e6b445e232..2afdabd0fc 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -99,7 +99,7 @@ public:
void setCursorPalette(const byte *colors, uint start, uint num);
// Screen related
- void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
Graphics::Surface *lockScreen();
void unlockScreen();
void updateScreen();
@@ -109,8 +109,8 @@ public:
void showOverlay();
void hideOverlay();
void clearOverlay();
- void grabOverlay(OverlayColor *buf, int pitch);
- void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ void grabOverlay(void *buf, int pitch);
+ void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
int16 getOverlayHeight();
int16 getOverlayWidth();
Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); }
@@ -118,7 +118,7 @@ public:
// Mouse related
bool showMouse(bool visible);
void warpMouse(int x, int y);
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
+ void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
// Events and input
bool pollEvent(Common::Event &event);
diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp
index f45000fea4..a83a5bae71 100644
--- a/backends/platform/psp/psp_main.cpp
+++ b/backends/platform/psp/psp_main.cpp
@@ -182,7 +182,7 @@ int main(void) {
#endif
/* unit/speed tests */
-#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
+#if defined(PSP_ENABLE_UNIT_TESTS) || defined(PSP_ENABLE_SPEED_TESTS)
PSP_INFO_PRINT("running tests\n");
psp_tests();
sceKernelSleepThread(); // that's it. That's all we're doing
diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp
index 4d326f30bd..5c5ebb7a80 100644
--- a/backends/platform/psp/tests.cpp
+++ b/backends/platform/psp/tests.cpp
@@ -25,7 +25,7 @@
#include "backends/platform/psp/tests.h"
-#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
+#if defined(PSP_ENABLE_UNIT_TESTS) || defined(PSP_ENABLE_SPEED_TESTS)
#include "common/scummsys.h"
#include <pspiofilemgr_fcntl.h>
@@ -729,4 +729,4 @@ void psp_tests() {
#endif
}
-#endif /* (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) */
+#endif /* (PSP_ENABLE_UNIT_TESTS) || defined(PSP_ENABLE_SPEED_TESTS) */
diff --git a/backends/platform/psp/tests.h b/backends/platform/psp/tests.h
index 9d158812f9..3779cb6bb2 100644
--- a/backends/platform/psp/tests.h
+++ b/backends/platform/psp/tests.h
@@ -26,7 +26,7 @@
//#define PSP_ENABLE_UNIT_TESTS // run unit tests
//#define PSP_ENABLE_SPEED_TESTS // run speed tests
-#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
+#if defined(PSP_ENABLE_UNIT_TESTS) || defined(PSP_ENABLE_SPEED_TESTS)
void psp_tests();
#endif
diff --git a/backends/platform/psp/trace.h b/backends/platform/psp/trace.h
index dda258f2cb..e27d06d8d3 100644
--- a/backends/platform/psp/trace.h
+++ b/backends/platform/psp/trace.h
@@ -32,7 +32,7 @@
/* Choose to print to file/screen/both */
#ifdef __PSP_PRINT_TO_FILE__
#define __PSP_PRINT__(format,...) PspDebugTrace(false, format, ## __VA_ARGS__)
-#elif defined __PSP_PRINT_TO_FILE_AND_SCREEN__
+#elif defined(__PSP_PRINT_TO_FILE_AND_SCREEN__)
#define __PSP_PRINT__(format,...) PspDebugTrace(true, format, ## __VA_ARGS__)
#else /* default - print to screen */
#define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__)
diff --git a/backends/platform/sdl/macosx/appmenu_osx.h b/backends/platform/sdl/macosx/appmenu_osx.h
index 005414b789..005414b789 100755..100644
--- a/backends/platform/sdl/macosx/appmenu_osx.h
+++ b/backends/platform/sdl/macosx/appmenu_osx.h
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
index 97c7edba3e..97c7edba3e 100755..100644
--- a/backends/platform/sdl/macosx/appmenu_osx.mm
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 639bd980f6..fb76c111f2 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -156,7 +156,7 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
}
CFRelease(preferredLocalizations);
}
-
+
}
// Falback to POSIX implementation
return OSystem_POSIX::getSystemLanguage();
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 4837e643b3..d9cb28b973 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -32,7 +32,7 @@ public:
virtual bool hasFeature(Feature f);
virtual bool displayLogFile();
-
+
virtual Common::String getSystemLanguage() const;
virtual void initBackend();
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
deleted file mode 100644
index 040028079d..0000000000
--- a/backends/platform/sdl/main.cpp
+++ /dev/null
@@ -1,66 +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 "common/scummsys.h"
-
-// Several SDL based ports use a custom main, and hence do not want to compile
-// of this file. The following "#if" ensures that.
-#if !defined(POSIX) && \
- !defined(WIN32) && \
- !defined(MAEMO) && \
- !defined(__SYMBIAN32__) && \
- !defined(_WIN32_WCE) && \
- !defined(__amigaos4__) && \
- !defined(DINGUX) && \
- !defined(CAANOO) && \
- !defined(LINUXMOTO) && \
- !defined(SAMSUNGTV) && \
- !defined(PLAYSTATION3) && \
- !defined(OPENPANDORA)
-
-#include "backends/platform/sdl/sdl.h"
-#include "backends/plugins/sdl/sdl-provider.h"
-#include "base/main.h"
-
-int main(int argc, char *argv[]) {
-
- // Create our OSystem instance
- g_system = new OSystem_SDL();
- assert(g_system);
-
- // Pre initialize the backend
- ((OSystem_SDL *)g_system)->init();
-
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
-
- // Free OSystem
- delete (OSystem_SDL *)g_system;
-
- return res;
-}
-
-#endif
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index 98a8265301..a17a326889 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -1,7 +1,6 @@
MODULE := backends/platform/sdl
MODULE_OBJS := \
- main.o \
sdl.o
ifdef POSIX
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 8dff5cec05..d54854352d 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -486,6 +486,7 @@ void OSystem_SDL::getTimeAndDate(TimeDate &td) const {
td.tm_mday = t.tm_mday;
td.tm_mon = t.tm_mon;
td.tm_year = t.tm_year;
+ td.tm_wday = t.tm_wday;
}
Audio::Mixer *OSystem_SDL::getMixer() {
diff --git a/backends/platform/symbian/src/ScummApp.cpp b/backends/platform/symbian/src/ScummApp.cpp
index 405fb5c3c2..b952177f9a 100644
--- a/backends/platform/symbian/src/ScummApp.cpp
+++ b/backends/platform/symbian/src/ScummApp.cpp
@@ -24,7 +24,7 @@
#define _PAGESIZE_ 0x1000
-#if defined (__WINS__) && !defined (S60V3) && !defined (UIQ3)
+#if defined(__WINS__) && !defined(S60V3) && !defined(UIQ3)
extern "C" int _chkstk(int /*a*/) {
_asm {
push ecx
@@ -62,7 +62,7 @@ _asm {
#ifdef EPOC_AS_APP
// this function is called automatically by the SymbianOS to deliver the new CApaApplication object
-#if !defined (UIQ3) && !defined (S60V3)
+#if !defined(UIQ3) && !defined(S60V3)
EXPORT_C
#endif
CApaApplication* NewApplication() {
@@ -70,7 +70,7 @@ CApaApplication* NewApplication() {
return new CScummApp;
}
-#if defined (UIQ3) || defined (S60V3)
+#if defined(UIQ3) || defined(S60V3)
#include <eikstart.h>
// E32Main() contains the program's start up code, the entry point for an EXE.
GLDEF_C TInt E32Main() {
@@ -80,7 +80,7 @@ GLDEF_C TInt E32Main() {
#endif // EPOC_AS_APP
-#if !defined (UIQ3) && !defined (S60V3)
+#if !defined(UIQ3) && !defined(S60V3)
GLDEF_C TInt E32Dll(TDllReason) {
return KErrNone;
}
@@ -92,7 +92,7 @@ CScummApp::CScummApp() {
CScummApp::~CScummApp() {
}
-#if defined (UIQ3)
+#if defined(UIQ3)
#include <scummvm.rsg>
/**
* Returns the resource id to be used to declare the views supported by this UIQ3 app
diff --git a/backends/platform/symbian/src/ScummApp.h b/backends/platform/symbian/src/ScummApp.h
index 0b9ebcdf53..00d03e6d7b 100644
--- a/backends/platform/symbian/src/ScummApp.h
+++ b/backends/platform/symbian/src/ScummApp.h
@@ -26,7 +26,7 @@
#include <e32base.h>
#include <sdlapp.h>
-#if defined (EPOC_AS_APP) && !defined (UIQ3) && !defined (S60V3)
+#if defined(EPOC_AS_APP) && !defined(UIQ3) && !defined(S60V3)
#include "ECompXL.h"
#endif
@@ -34,7 +34,7 @@ class CScummApp : public CSDLApp {
public:
CScummApp();
~CScummApp();
-#if defined (UIQ3)
+#if defined(UIQ3)
/**
* Returns the resource id to be used to declare the views supported by this UIQ3 app
* @return TInt, resource id
@@ -43,7 +43,7 @@ public:
#endif
TUid AppDllUid() const;
void GetDataFolder(TDes& aDataFolder);
-#if defined (EPOC_AS_APP) && !defined (UIQ3) && !defined (S60V3)
+#if defined(EPOC_AS_APP) && !defined(UIQ3) && !defined(S60V3)
TECompXL iECompXL;
#endif
};
diff --git a/backends/platform/symbian/src/SymbianActions.cpp b/backends/platform/symbian/src/SymbianActions.cpp
index 5de386b1da..c47bd93772 100644
--- a/backends/platform/symbian/src/SymbianActions.cpp
+++ b/backends/platform/symbian/src/SymbianActions.cpp
@@ -58,9 +58,9 @@ const Common::String actionNames[] = {
#ifdef UIQ
static const int ACTIONS_DEFAULT[ACTION_LAST] = { SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, SDLK_F1, SDLK_F2, SDLK_F5, SDLK_PAGEDOWN, '9', 0, 0, SDLK_PAGEUP, 0, 0, 0, 0, 0, 0, 0};
-#elif defined (S60)
+#elif defined(S60)
const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0, 0, '*', '#', '9', 0, 0, 0, 0, 0, 0, 0, '0', 0, 0};
-#elif defined (S90)
+#elif defined(S90)
const int ACTIONS_DEFAULT[ACTION_LAST] = { SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, 0, 0, SDLK_MENU, SDLK_ESCAPE, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0 ,0};
#else
const int ACTIONS_DEFAULT[ACTION_LAST] = { SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, SDLK_F1, SDLK_F2, SDLK_MENU, SDLK_ESCAPE, 0, 0, 0, 0, 0, 0, 0, 0, '1', 0 ,0};
diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index dd81080afe..1f9128a54f 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -125,7 +125,7 @@ typedef signed long int int32;
PS2. http://gcc.gnu.org/ml/gcc-bugs/2004-01/msg01596.html might have found out the same problem there
*/
-#elif defined (__WINS__) // WINS
+#elif defined(__WINS__) // WINS
extern "C" int symbian_snprintf(char *text, size_t maxlen, const char *fmt, ...);
extern "C" int symbian_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
#define snprintf(buf,len,args...) symbian_snprintf(buf,len,args)
diff --git a/backends/platform/webos/webos.cpp b/backends/platform/webos/webos.cpp
index 4ec153a7e9..fc18628235 100644
--- a/backends/platform/webos/webos.cpp
+++ b/backends/platform/webos/webos.cpp
@@ -45,24 +45,4 @@ void OSystem_SDL_WebOS::initBackend() {
OSystem_SDL::initBackend();
}
-/**
- * Gets the original SDL hardware key set, adds WebOS specific keys and
- * returns the new key set.
- *
- * @return The hardware key set with added webOS specific keys.
- */
-#ifdef ENABLE_KEYMAPPER
-HardwareInputSet *OSystem_SDL_WebOS::getHardwareInputSet() {
- // Get the original SDL hardware key set
- HardwareInputSet *inputSet = OSystem_SDL::getHardwareInputSet();
-
- // Add WebOS specific keys
- inputSet->addHardwareInput(new HardwareInput("FORWARD",
- KeyState((KeyCode) 229, 229, 0), "Forward"));
-
- // Return the modified hardware key set
- return inputSet;
-}
-#endif
-
#endif
diff --git a/backends/platform/webos/webos.h b/backends/platform/webos/webos.h
index 8dfa43239c..dda56a70da 100644
--- a/backends/platform/webos/webos.h
+++ b/backends/platform/webos/webos.h
@@ -31,9 +31,6 @@ public:
OSystem_SDL_WebOS();
virtual void initBackend();
-#ifdef ENABLE_KEYMAPPER
- virtual Common::HardwareInputSet *getHardwareInputSet();
-#endif
};
#endif
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 258a782cc4..22a6495f8f 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -39,7 +39,7 @@
OSystem_Wii::OSystem_Wii() :
_startup_time(0),
- _cursorScale(1),
+ _cursorDontScale(true),
_cursorPaletteDisabled(true),
_cursorPalette(NULL),
_cursorPaletteDirty(false),
@@ -269,6 +269,7 @@ void OSystem_Wii::getTimeAndDate(TimeDate &td) const {
td.tm_mday = t.tm_mday;
td.tm_mon = t.tm_mon;
td.tm_year = t.tm_year;
+ td.tm_wday = t.tm_wday;
}
void OSystem_Wii::showOptionsDialog() {
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 64197f913a..5d6998d0b6 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -56,7 +56,7 @@ class OSystem_Wii : public EventsBaseBackend, public PaletteManager {
private:
s64 _startup_time;
- int _cursorScale;
+ bool _cursorDontScale;
bool _cursorPaletteDisabled;
u16 *_cursorPalette;
bool _cursorPaletteDirty;
@@ -72,7 +72,7 @@ private:
bool _overlayVisible;
u16 _overlayWidth, _overlayHeight;
u32 _overlaySize;
- OverlayColor *_overlayPixels;
+ uint16 *_overlayPixels;
gfx_screen_coords_t _coordsOverlay;
gfx_tex_t _texOverlay;
bool _overlayDirty;
@@ -167,7 +167,7 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y,
int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
@@ -177,8 +177,8 @@ public:
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch,
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch,
int x, int y, int w, int h);
virtual int16 getOverlayWidth();
virtual int16 getOverlayHeight();
@@ -187,9 +187,9 @@ public:
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
int hotspotY, uint32 keycolor,
- int cursorTargetScale,
+ bool dontScale,
const Graphics::PixelFormat *format);
virtual bool pollEvent(Common::Event &event);
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 83607984cc..fc0802dd4c 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -74,7 +74,7 @@ void OSystem_Wii::initGfx() {
#endif
_overlaySize = _overlayWidth * _overlayHeight * 2;
- _overlayPixels = (OverlayColor *) memalign(32, _overlaySize);
+ _overlayPixels = (uint16 *) memalign(32, _overlaySize);
memset(&_texMouse, 0, sizeof(gfx_tex_t));
memset(&_texOverlay, 0, sizeof(gfx_tex_t));
@@ -395,7 +395,7 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
_cursorPaletteDirty = true;
}
-void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y,
+void OSystem_Wii::copyRectToScreen(const void *buf, int pitch, int x, int y,
int w, int h) {
assert(x >= 0 && x < _gameWidth);
assert(y >= 0 && y < _gameHeight);
@@ -407,7 +407,7 @@ void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y,
if (!Graphics::crossBlit(_gamePixels +
y * _gameWidth * _pfGame.bytesPerPixel +
x * _pfGame.bytesPerPixel,
- buf, _gameWidth * _pfGame.bytesPerPixel,
+ (const byte *)buf, _gameWidth * _pfGame.bytesPerPixel,
pitch, w, h, _pfGameTexture, _pfGame)) {
printf("crossBlit failed\n");
::abort();
@@ -418,9 +418,10 @@ void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y,
if (_gameWidth == pitch && pitch == w) {
memcpy(dst, buf, h * w);
} else {
+ const byte *src = (const byte *)buf;
do {
- memcpy(dst, buf, w);
- buf += pitch;
+ memcpy(dst, src, w);
+ src += pitch;
dst += _gameWidth;
} while (--h);
}
@@ -450,7 +451,7 @@ bool OSystem_Wii::needsScreenUpdate() {
void OSystem_Wii::updateScreen() {
static f32 ar;
static gfx_screen_coords_t cc;
- static int cs;
+ static f32 csx, csy;
u32 now = getMillis();
if (now - _lastScreenUpdate < 1000 / MAX_FPS)
@@ -465,7 +466,6 @@ void OSystem_Wii::updateScreen() {
wii_memstats();
#endif
- cs = _cursorScale;
_lastScreenUpdate = now;
if (_overlayVisible || _consoleVisible)
@@ -487,12 +487,6 @@ void OSystem_Wii::updateScreen() {
if (_gameRunning)
ar = gfx_set_ar(4.0 / 3.0);
- // ugly, but the modern theme sets a factor of 3, only god knows why
- if (cs > 2)
- cs = 1;
- else
- cs *= 2;
-
if (_overlayDirty) {
gfx_tex_convert(&_texOverlay, _overlayPixels);
_overlayDirty = false;
@@ -502,10 +496,18 @@ void OSystem_Wii::updateScreen() {
}
if (_mouseVisible) {
- cc.x = f32(_mouseX - cs * _mouseHotspotX) * _currentXScale;
- cc.y = f32(_mouseY - cs * _mouseHotspotY) * _currentYScale;
- cc.w = f32(_texMouse.width) * _currentXScale * cs;
- cc.h = f32(_texMouse.height) * _currentYScale * cs;
+ if (_cursorDontScale) {
+ csx = 1.0f / _currentXScale;
+ csy = 1.0f / _currentYScale;
+ } else {
+ csx = 1.0f;
+ csy = 1.0f;
+ }
+
+ cc.x = f32(_mouseX - csx * _mouseHotspotX) * _currentXScale;
+ cc.y = f32(_mouseY - csy * _mouseHotspotY) * _currentYScale;
+ cc.w = f32(_texMouse.width) * _currentXScale * csx;
+ cc.h = f32(_texMouse.height) * _currentYScale * csy;
if (_texMouse.palette && _cursorPaletteDirty) {
_texMouse.palette[_mouseKeyColor] = 0;
@@ -570,28 +572,30 @@ void OSystem_Wii::clearOverlay() {
_overlayDirty = true;
}
-void OSystem_Wii::grabOverlay(OverlayColor *buf, int pitch) {
+void OSystem_Wii::grabOverlay(void *buf, int pitch) {
int h = _overlayHeight;
- OverlayColor *src = _overlayPixels;
+ uint16 *src = _overlayPixels;
+ byte *dst = (byte *)buf;
do {
- memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
+ memcpy(dst, src, _overlayWidth * sizeof(uint16));
src += _overlayWidth;
- buf += pitch;
+ dst += pitch;
} while (--h);
}
-void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x,
+void OSystem_Wii::copyRectToOverlay(const void *buf, int pitch, int x,
int y, int w, int h) {
+ const byte *src = (const byte *)buf;
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * sizeof(uint16);
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -604,13 +608,13 @@ void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x,
if (w <= 0 || h <= 0)
return;
- OverlayColor *dst = _overlayPixels + (y * _overlayWidth + x);
- if (_overlayWidth == pitch && pitch == w) {
- memcpy(dst, buf, h * w * sizeof(OverlayColor));
+ uint16 *dst = _overlayPixels + (y * _overlayWidth + x);
+ if (_overlayWidth == w && pitch == _overlayWidth * sizeof(uint16)) {
+ memcpy(dst, src, h * pitch);
} else {
do {
- memcpy(dst, buf, w * sizeof(OverlayColor));
- buf += pitch;
+ memcpy(dst, src, w * sizeof(uint16));
+ src += pitch;
dst += _overlayWidth;
} while (--h);
}
@@ -642,9 +646,9 @@ void OSystem_Wii::warpMouse(int x, int y) {
_mouseY = y;
}
-void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
+void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
int hotspotY, uint32 keycolor,
- int cursorTargetScale,
+ bool dontScale,
const Graphics::PixelFormat *format) {
gfx_tex_format_t tex_format = GFX_TF_PALETTE_RGB5A3;
uint tw, th;
@@ -685,7 +689,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
tmpBuf = true;
if (!tmpBuf) {
- gfx_tex_convert(&_texMouse, buf);
+ gfx_tex_convert(&_texMouse, (const byte *)buf);
} else {
u8 bpp = _texMouse.bpp >> 3;
byte *tmp = (byte *) malloc(tw * th * bpp);
@@ -702,7 +706,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
#ifdef USE_RGB_COLOR
if (bpp > 1) {
- if (!Graphics::crossBlit(tmp, buf,
+ if (!Graphics::crossBlit(tmp, (const byte *)buf,
tw * _pfRGB3444.bytesPerPixel,
w * _pfCursor.bytesPerPixel,
tw, th, _pfRGB3444, _pfCursor)) {
@@ -726,10 +730,10 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
} else {
#endif
byte *dst = tmp;
-
+ const byte *src = (const byte *)buf;
do {
- memcpy(dst, buf, w * bpp);
- buf += w * bpp;
+ memcpy(dst, src, w * bpp);
+ src += w * bpp;
dst += tw * bpp;
} while (--h);
#ifdef USE_RGB_COLOR
@@ -742,7 +746,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
_mouseHotspotX = hotspotX;
_mouseHotspotY = hotspotY;
- _cursorScale = cursorTargetScale;
+ _cursorDontScale = dontScale;
if ((_texMouse.palette) && (oldKeycolor != _mouseKeyColor))
_cursorPaletteDirty = true;
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index a57fcb9628..3897731db4 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -622,6 +622,7 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
t.tm_hour = systime.wHour;
t.tm_min = systime.wMinute;
t.tm_sec = systime.wSecond;
+ t.tm_wday = systime.wDayOfWeek;
}
Common::String OSystem_WINCE3::getSystemLanguage() const {
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 237c50a1ba..64e7e778b6 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -97,7 +97,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String
return Common::wrapCompressedReadStream(sf);
}
-Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename) {
+Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
// Ensure that the savepath is valid. If not, generate an appropriate error.
Common::String savePathName = getSavePath();
checkPath(Common::FSNode(savePathName));
@@ -112,7 +112,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String
// Open the file for saving
Common::WriteStream *sf = file.createWriteStream();
- return Common::wrapCompressedWriteStream(sf);
+ return compress ? Common::wrapCompressedWriteStream(sf) : sf;
}
bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h
index 1ea87efc67..c7fca279bc 100644
--- a/backends/saves/default/default-saves.h
+++ b/backends/saves/default/default-saves.h
@@ -38,7 +38,7 @@ public:
virtual Common::StringArray listSavefiles(const Common::String &pattern);
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual bool removeSavefile(const Common::String &filename);
protected:
diff --git a/backends/saves/windows/windows-saves.cpp b/backends/saves/windows/windows-saves.cpp
index 87348c3416..d520632394 100644
--- a/backends/saves/windows/windows-saves.cpp
+++ b/backends/saves/windows/windows-saves.cpp
@@ -26,8 +26,12 @@
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+#if defined(ARRAYSIZE)
+#undef ARRAYSIZE
+#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
#include "common/config-manager.h"
#include "common/savefile.h"
diff --git a/backends/taskbar/win32/mingw-compat.h b/backends/taskbar/win32/mingw-compat.h
index 55105407c6..f6151936f1 100644
--- a/backends/taskbar/win32/mingw-compat.h
+++ b/backends/taskbar/win32/mingw-compat.h
@@ -70,7 +70,7 @@ DECLARE_INTERFACE_(IPropertyStore, IUnknown) {
STDMETHOD (GetValue) (REFPROPERTYKEY key, PROPVARIANT *pv) PURE;
STDMETHOD (SetValue) (REFPROPERTYKEY key, REFPROPVARIANT propvar) PURE;
STDMETHOD (Commit) (void) PURE;
-
+
private:
~IPropertyStore();
};
@@ -137,7 +137,7 @@ DECLARE_INTERFACE_(ITaskbarList3, IUnknown) {
STDMETHOD (SetOverlayIcon) (THIS_ HWND hwnd, HICON hIcon, LPCWSTR pszDescription) PURE;
STDMETHOD (SetThumbnailTooltip) (THIS_ HWND hwnd, LPCWSTR pszTip) PURE;
STDMETHOD (SetThumbnailClip) (THIS_ HWND hwnd, RECT *prcClip) PURE;
-
+
private:
~ITaskbarList3();
};
diff --git a/backends/timer/bada/timer.cpp b/backends/timer/bada/timer.cpp
index faddacb3c3..e41ecd4864 100755..100644
--- a/backends/timer/bada/timer.cpp
+++ b/backends/timer/bada/timer.cpp
@@ -1,115 +1,115 @@
-/* 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 (BADA)
-
-#include "backends/timer/bada/timer.h"
-
-//
-// TimerSlot
-//
-TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback,
- uint32 interval, void *refCon) :
- _timer(0),
- _callback(callback),
- _interval(interval),
- _refCon(refCon) {
-}
-
-TimerSlot::~TimerSlot() {
-}
-
-bool TimerSlot::OnStart() {
- _timer = new Osp::Base::Runtime::Timer();
- if (!_timer || IsFailed(_timer->Construct(*this))) {
- AppLog("Failed to create timer");
- return false;
- }
-
- if (IsFailed(_timer->Start(_interval))) {
- AppLog("failed to start timer");
- return false;
- }
-
- AppLog("started timer %d", _interval);
- return true;
-}
-
-void TimerSlot::OnStop() {
- AppLog("timer stopped");
- if (_timer) {
- _timer->Cancel();
- delete _timer;
- _timer = NULL;
- }
-}
-
-void TimerSlot::OnTimerExpired(Timer &timer) {
- _callback(_refCon);
- timer.Start(_interval);
-}
-
-//
-// BadaTimerManager
-//
-BadaTimerManager::BadaTimerManager() {
-}
-
-BadaTimerManager::~BadaTimerManager() {
- for (Common::List<TimerSlot>::iterator slot = _timers.begin();
- slot != _timers.end(); ) {
- slot->Stop();
- slot = _timers.erase(slot);
- }
-}
-
-bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon,
- const Common::String &id) {
- TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon);
-
- if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) {
- AppLog("Failed to create timer thread");
- delete slot;
- return false;
- }
-
- if (IsFailed(slot->Start())) {
- delete slot;
- AppLog("Failed to start timer thread");
- return false;
- }
-
- _timers.push_back(*slot);
- return true;
-}
-
-void BadaTimerManager::removeTimerProc(TimerProc proc) {
- for (Common::List<TimerSlot>::iterator slot = _timers.begin();
- slot != _timers.end(); ++slot) {
- if (slot->_callback == proc) {
- slot->Stop();
- slot = _timers.erase(slot);
- }
- }
-}
-
-#endif
+/* 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(BADA)
+
+#include "backends/timer/bada/timer.h"
+
+//
+// TimerSlot
+//
+TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback,
+ uint32 interval, void *refCon) :
+ _timer(0),
+ _callback(callback),
+ _interval(interval),
+ _refCon(refCon) {
+}
+
+TimerSlot::~TimerSlot() {
+}
+
+bool TimerSlot::OnStart() {
+ _timer = new Osp::Base::Runtime::Timer();
+ if (!_timer || IsFailed(_timer->Construct(*this))) {
+ AppLog("Failed to create timer");
+ return false;
+ }
+
+ if (IsFailed(_timer->Start(_interval))) {
+ AppLog("failed to start timer");
+ return false;
+ }
+
+ AppLog("started timer %d", _interval);
+ return true;
+}
+
+void TimerSlot::OnStop() {
+ AppLog("timer stopped");
+ if (_timer) {
+ _timer->Cancel();
+ delete _timer;
+ _timer = NULL;
+ }
+}
+
+void TimerSlot::OnTimerExpired(Timer &timer) {
+ _callback(_refCon);
+ timer.Start(_interval);
+}
+
+//
+// BadaTimerManager
+//
+BadaTimerManager::BadaTimerManager() {
+}
+
+BadaTimerManager::~BadaTimerManager() {
+ for (Common::List<TimerSlot>::iterator slot = _timers.begin();
+ slot != _timers.end(); ) {
+ slot->Stop();
+ slot = _timers.erase(slot);
+ }
+}
+
+bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon,
+ const Common::String &id) {
+ TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon);
+
+ if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) {
+ AppLog("Failed to create timer thread");
+ delete slot;
+ return false;
+ }
+
+ if (IsFailed(slot->Start())) {
+ delete slot;
+ AppLog("Failed to start timer thread");
+ return false;
+ }
+
+ _timers.push_back(*slot);
+ return true;
+}
+
+void BadaTimerManager::removeTimerProc(TimerProc proc) {
+ for (Common::List<TimerSlot>::iterator slot = _timers.begin();
+ slot != _timers.end(); ++slot) {
+ if (slot->_callback == proc) {
+ slot->Stop();
+ slot = _timers.erase(slot);
+ }
+ }
+}
+
+#endif
diff --git a/backends/timer/bada/timer.h b/backends/timer/bada/timer.h
index 04ca771c26..826064d7ff 100755..100644
--- a/backends/timer/bada/timer.h
+++ b/backends/timer/bada/timer.h
@@ -1,62 +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 BADA_TIMER_H
-#define BADA_TIMER_H
-
-#include <FBase.h>
-
-#include "common/timer.h"
-#include "common/list.h"
-
-using namespace Osp::Base::Runtime;
-
-struct TimerSlot: public ITimerEventListener, public Thread {
- TimerSlot(Common::TimerManager::TimerProc callback,
- uint32 interval,
- void *refCon);
- ~TimerSlot();
-
- bool OnStart(void);
- void OnStop(void);
- void OnTimerExpired(Timer &timer);
-
- Timer *_timer;
- Common::TimerManager::TimerProc _callback;
- uint32 _interval; // in microseconds
- void *_refCon;
-};
-
-class BadaTimerManager : public Common::TimerManager {
-public:
- BadaTimerManager();
- ~BadaTimerManager();
-
- bool installTimerProc(TimerProc proc, int32 interval, void *refCon,
- const Common::String &id);
- void removeTimerProc(TimerProc proc);
-
-private:
- Common::List<TimerSlot> _timers;
-};
-
-#endif
+/* 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 BADA_TIMER_H
+#define BADA_TIMER_H
+
+#include <FBase.h>
+
+#include "common/timer.h"
+#include "common/list.h"
+
+using namespace Osp::Base::Runtime;
+
+struct TimerSlot: public ITimerEventListener, public Thread {
+ TimerSlot(Common::TimerManager::TimerProc callback,
+ uint32 interval,
+ void *refCon);
+ ~TimerSlot();
+
+ bool OnStart(void);
+ void OnStop(void);
+ void OnTimerExpired(Timer &timer);
+
+ Timer *_timer;
+ Common::TimerManager::TimerProc _callback;
+ uint32 _interval; // in microseconds
+ void *_refCon;
+};
+
+class BadaTimerManager : public Common::TimerManager {
+public:
+ BadaTimerManager();
+ ~BadaTimerManager();
+
+ bool installTimerProc(TimerProc proc, int32 interval, void *refCon,
+ const Common::String &id);
+ void removeTimerProc(TimerProc proc);
+
+private:
+ Common::List<TimerSlot> _timers;
+};
+
+#endif
diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index 8681102cd0..9f56d58b12 100644
--- a/backends/timer/default/default-timer.cpp
+++ b/backends/timer/default/default-timer.cpp
@@ -59,7 +59,6 @@ void insertPrioQueue(TimerSlot *head, TimerSlot *newSlot) {
DefaultTimerManager::DefaultTimerManager() :
- _timerHandler(0),
_head(0) {
_head = new TimerSlot();
@@ -157,7 +156,7 @@ void DefaultTimerManager::removeTimerProc(TimerProc callback) {
}
// We need to remove all names referencing the timer proc here.
- //
+ //
// Else we run into troubles, when the client code removes and readds timer
// callbacks.
//
diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h
index e5a9dada79..5884979da0 100644
--- a/backends/timer/default/default-timer.h
+++ b/backends/timer/default/default-timer.h
@@ -34,7 +34,6 @@ private:
typedef Common::HashMap<Common::String, TimerProc, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> TimerSlotMap;
Common::Mutex _mutex;
- void *_timerHandler;
TimerSlot *_head;
TimerSlotMap _callbacks;
diff --git a/backends/timer/psp/timer.cpp b/backends/timer/psp/timer.cpp
index ce998436e0..6f8e4b6643 100644
--- a/backends/timer/psp/timer.cpp
+++ b/backends/timer/psp/timer.cpp
@@ -36,7 +36,7 @@
#include "common/scummsys.h"
-#if defined (__PSP__)
+#if defined(__PSP__)
#include <pspthreadman.h>
#include "common/scummsys.h"
diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp
index 42f9707ddc..75de86472f 100644
--- a/backends/vkeybd/virtual-keyboard-gui.cpp
+++ b/backends/vkeybd/virtual-keyboard-gui.cpp
@@ -161,7 +161,7 @@ void VirtualKeyboardGUI::run() {
_system->clearOverlay();
}
_overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat());
- _system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w);
+ _system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch);
setupCursor();
@@ -171,7 +171,7 @@ void VirtualKeyboardGUI::run() {
removeCursor();
- _system->copyRectToOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h);
+ _system->copyRectToOverlay(_overlayBackup.pixels, _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h);
if (!g_gui.isActive()) _system->hideOverlay();
_overlayBackup.free();
@@ -262,7 +262,7 @@ void VirtualKeyboardGUI::screenChanged() {
_screenH = newScreenH;
_overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat());
- _system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w);
+ _system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch);
if (!_kbd->checkModeResolutions()) {
_displaying = false;
@@ -371,7 +371,7 @@ void VirtualKeyboardGUI::redraw() {
blit(&surf, &_dispSurface, _dispX - _dirtyRect.left,
_dispY - _dirtyRect.top, _dispBackColor);
}
- _system->copyRectToOverlay((OverlayColor *)surf.pixels, surf.w,
+ _system->copyRectToOverlay(surf.pixels, surf.pitch,
_dirtyRect.left, _dirtyRect.top, surf.w, surf.h);
surf.free();
diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp
index 1958113578..bb8286d1f5 100644
--- a/backends/vkeybd/virtual-keyboard-parser.cpp
+++ b/backends/vkeybd/virtual-keyboard-parser.cpp
@@ -34,7 +34,7 @@
#include "common/tokenizer.h"
#include "common/stream.h"
-#include "graphics/imagedec.h"
+#include "graphics/decoders/bmp.h"
namespace Common {
@@ -266,11 +266,15 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
const Graphics::PixelFormat format = g_system->getOverlayFormat();
- _mode->image = Graphics::ImageDecoder::loadFile(*file, format);
- delete file;
+ {
+ Graphics::BitmapDecoder bmp;
+ if (!bmp.loadStream(*file))
+ return parserError("Error loading bitmap '" + _mode->bitmapName + "'");
+
+ _mode->image = bmp.getSurface()->convertTo(format);
+ }
- if (!_mode->image)
- return parserError("Error loading bitmap '" + _mode->bitmapName + "'");
+ delete file;
int r, g, b;
if (node->values.contains("transparent_color")) {
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 08838167e9..44007c494a 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -68,7 +68,7 @@ static const char HELP_STRING[] =
" -z, --list-games Display list of supported games and exit\n"
" -t, --list-targets Display list of configured targets and exit\n"
" --list-saves=TARGET Display a list of savegames for the game (TARGET) specified\n"
-#if defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
+#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
" --console Enable the console window (default:enabled)\n"
#endif
"\n"
@@ -155,7 +155,7 @@ static void usage(const char *s, ...) {
vsnprintf(buf, STRINGBUFLEN, s, va);
va_end(va);
-#if !(defined(__GP32__) || defined (__SYMBIAN32__) || defined(__DS__))
+#if !(defined(__GP32__) || defined(__SYMBIAN32__) || defined(__DS__))
printf(USAGE_STRING, s_appName, buf, s_appName, s_appName);
#endif
exit(1);
@@ -169,7 +169,6 @@ void registerDefaults() {
// Graphics
ConfMan.registerDefault("fullscreen", false);
ConfMan.registerDefault("aspect_ratio", false);
- ConfMan.registerDefault("disable_dithering", false);
ConfMan.registerDefault("gfx_mode", "normal");
ConfMan.registerDefault("render_mode", "default");
ConfMan.registerDefault("desired_screen_aspect_ratio", "auto");
@@ -238,6 +237,8 @@ void registerDefaults() {
ConfMan.registerDefault("record_temp_file_name", "record.tmp");
ConfMan.registerDefault("record_time_file_name", "record.time");
+ ConfMan.registerDefault("gui_saveload_chooser", "grid");
+ ConfMan.registerDefault("gui_saveload_last_pos", "0");
}
//
@@ -277,12 +278,12 @@ void registerDefaults() {
// Use this for boolean options; this distinguishes between "-x" and "-X",
// 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)) { \
+ if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-" longCmd)) : (tolower(s[1]) == shortCmd)) { \
bool boolValue = (Common::isLower(s[1]) != 0); \
s += 2; \
if (isLongCmd) { \
boolValue = !strcmp(s, longCmd); \
- s += boolValue ? (sizeof(longCmd) - 1) : (sizeof("no-"longCmd) - 1); \
+ s += boolValue ? (sizeof(longCmd) - 1) : (sizeof("no-" longCmd) - 1); \
} \
if (*s != '\0') goto unknownOption; \
const char *option = boolValue ? "true" : "false"; \
@@ -557,7 +558,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
END_OPTION
#endif
-#if defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
+#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
// Optional console window on Windows (default: enabled)
DO_LONG_OPTION_BOOL("console")
END_OPTION
diff --git a/base/internal_version.h b/base/internal_version.h
index 5392012169..40ed67ceec 100644
--- a/base/internal_version.h
+++ b/base/internal_version.h
@@ -16,4 +16,4 @@
#define SCUMMVM_REVISION
#endif
-#define SCUMMVM_VERSION "1.5.0git" SCUMMVM_REVISION
+#define SCUMMVM_VERSION "1.6.0git" SCUMMVM_REVISION
diff --git a/base/main.cpp b/base/main.cpp
index 391d911ae8..355a65f883 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -55,6 +55,13 @@
#include "audio/mididrv.h"
#include "audio/musicplugin.h" /* for music manager */
+#include "graphics/cursorman.h"
+#include "graphics/fontman.h"
+#include "graphics/yuv_to_rgb.h"
+#ifdef USE_FREETYPE2
+#include "graphics/fonts/ttf.h"
+#endif
+
#include "backends/keymapper/keymapper.h"
#if defined(_WIN32_WCE)
@@ -195,7 +202,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
}
// On creation the engine should have set up all debug levels so we can use
- // the command line arugments here
+ // the command line arguments here
Common::StringTokenizer tokenizer(edebuglevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
@@ -206,6 +213,12 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
// Initialize any game-specific keymaps
engine->initKeymap();
+ // Set default values for all of the custom engine options
+ const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(Common::String());
+ for (uint i = 0; i < engineOptions.size(); i++) {
+ ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState);
+ }
+
// Inform backend that the engine is about to be run
system.engineInit();
@@ -487,10 +500,20 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
PluginManager::destroy();
GUI::GuiManager::destroy();
Common::ConfigManager::destroy();
+ Common::DebugManager::destroy();
+ Common::EventRecorder::destroy();
Common::SearchManager::destroy();
#ifdef USE_TRANSLATION
Common::TranslationManager::destroy();
#endif
+ MusicManager::destroy();
+ Graphics::CursorManager::destroy();
+ Graphics::FontManager::destroy();
+#ifdef USE_FREETYPE2
+ Graphics::shutdownTTF();
+#endif
+ EngineManager::destroy();
+ Graphics::YUVToRGBManager::destroy();
return 0;
}
diff --git a/base/plugins.cpp b/base/plugins.cpp
index f1b08f7893..b8cd097683 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -85,111 +85,7 @@ public:
// Iterate over all registered (static) plugins and load them.
// Engine plugins
- #if PLUGIN_ENABLED_STATIC(SCUMM)
- LINK_PLUGIN(SCUMM)
- #endif
- #if PLUGIN_ENABLED_STATIC(AGI)
- LINK_PLUGIN(AGI)
- #endif
- #if PLUGIN_ENABLED_STATIC(AGOS)
- LINK_PLUGIN(AGOS)
- #endif
- #if PLUGIN_ENABLED_STATIC(CGE)
- LINK_PLUGIN(CGE)
- #endif
- #if PLUGIN_ENABLED_STATIC(CINE)
- LINK_PLUGIN(CINE)
- #endif
- #if PLUGIN_ENABLED_STATIC(COMPOSER)
- LINK_PLUGIN(COMPOSER)
- #endif
- #if PLUGIN_ENABLED_STATIC(CRUISE)
- LINK_PLUGIN(CRUISE)
- #endif
- #if PLUGIN_ENABLED_STATIC(DRACI)
- LINK_PLUGIN(DRACI)
- #endif
- #if PLUGIN_ENABLED_STATIC(DRASCULA)
- LINK_PLUGIN(DRASCULA)
- #endif
- #if PLUGIN_ENABLED_STATIC(DREAMWEB)
- LINK_PLUGIN(DREAMWEB)
- #endif
- #if PLUGIN_ENABLED_STATIC(GOB)
- LINK_PLUGIN(GOB)
- #endif
- #if PLUGIN_ENABLED_STATIC(GROOVIE)
- LINK_PLUGIN(GROOVIE)
- #endif
- #if PLUGIN_ENABLED_STATIC(HUGO)
- LINK_PLUGIN(HUGO)
- #endif
- #if PLUGIN_ENABLED_STATIC(KYRA)
- LINK_PLUGIN(KYRA)
- #endif
- #if PLUGIN_ENABLED_STATIC(LASTEXPRESS)
- LINK_PLUGIN(LASTEXPRESS)
- #endif
- #if PLUGIN_ENABLED_STATIC(LURE)
- LINK_PLUGIN(LURE)
- #endif
- #if PLUGIN_ENABLED_STATIC(MADE)
- LINK_PLUGIN(MADE)
- #endif
- #if PLUGIN_ENABLED_STATIC(MOHAWK)
- LINK_PLUGIN(MOHAWK)
- #endif
- #if PLUGIN_ENABLED_STATIC(NEVERHOOD)
- LINK_PLUGIN(NEVERHOOD)
- #endif
- #if PLUGIN_ENABLED_STATIC(PARALLACTION)
- LINK_PLUGIN(PARALLACTION)
- #endif
- #if PLUGIN_ENABLED_STATIC(QUEEN)
- LINK_PLUGIN(QUEEN)
- #endif
- #if PLUGIN_ENABLED_STATIC(SAGA)
- LINK_PLUGIN(SAGA)
- #endif
- #if PLUGIN_ENABLED_STATIC(SCI)
- LINK_PLUGIN(SCI)
- #endif
- #if PLUGIN_ENABLED_STATIC(SKY)
- LINK_PLUGIN(SKY)
- #endif
- #if PLUGIN_ENABLED_STATIC(SWORD1)
- LINK_PLUGIN(SWORD1)
- #endif
- #if PLUGIN_ENABLED_STATIC(SWORD2)
- LINK_PLUGIN(SWORD2)
- #endif
- #if PLUGIN_ENABLED_STATIC(SWORD25)
- LINK_PLUGIN(SWORD25)
- #endif
- #if PLUGIN_ENABLED_STATIC(TEENAGENT)
- LINK_PLUGIN(TEENAGENT)
- #endif
- #if PLUGIN_ENABLED_STATIC(TESTBED)
- LINK_PLUGIN(TESTBED)
- #endif
- #if PLUGIN_ENABLED_STATIC(TINSEL)
- LINK_PLUGIN(TINSEL)
- #endif
- #if PLUGIN_ENABLED_STATIC(TOLTECS)
- LINK_PLUGIN(TOLTECS)
- #endif
- #if PLUGIN_ENABLED_STATIC(TOON)
- LINK_PLUGIN(TOON)
- #endif
- #if PLUGIN_ENABLED_STATIC(TSAGE)
- LINK_PLUGIN(TSAGE)
- #endif
- #if PLUGIN_ENABLED_STATIC(TOUCHE)
- LINK_PLUGIN(TOUCHE)
- #endif
- #if PLUGIN_ENABLED_STATIC(TUCKER)
- LINK_PLUGIN(TUCKER)
- #endif
+ #include "engines/plugins_table.h"
// Music plugins
// TODO: Use defines to disable or enable each MIDI driver as a
@@ -205,6 +101,9 @@ public:
#if defined(USE_SEQ_MIDI)
LINK_PLUGIN(SEQ)
#endif
+ #if defined(USE_SNDIO)
+ LINK_PLUGIN(SNDIO)
+ #endif
#if defined(__MINT__)
LINK_PLUGIN(STMIDI)
#endif
diff --git a/base/plugins.h b/base/plugins.h
index fffb5fb910..4409c9eaea 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -205,6 +205,10 @@ typedef Common::Array<Plugin *> PluginList;
template<class PO_t>
class PluginSubclass : public Plugin {
public:
+ PO_t &operator*() const {
+ return *(PO_t *)_pluginObject;
+ }
+
PO_t *operator->() const {
return (PO_t *)_pluginObject;
}
diff --git a/base/version.cpp b/base/version.cpp
index 7943552418..89fae90c2e 100644
--- a/base/version.cpp
+++ b/base/version.cpp
@@ -94,6 +94,10 @@ const char *gScummVMFeatures = ""
"SEQ "
#endif
+#ifdef USE_SNDIO
+ "sndio "
+#endif
+
#ifdef USE_TIMIDITY
"TiMidity "
#endif
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index 4c7286bbb5..012a2dfce5 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -60,6 +60,12 @@ void EventDispatcher::dispatch() {
}
}
}
+
+ List<Event> delayedEvents = _mapper->getDelayedEvents();
+ for (List<Event>::iterator k = delayedEvents.begin(); k != delayedEvents.end(); ++k) {
+ const Event delayedEvent = *k;
+ dispatchEvent(delayedEvent);
+ }
}
void EventDispatcher::registerMapper(EventMapper *mapper) {
diff --git a/common/EventMapper.cpp b/common/EventMapper.cpp
index 2808a7b5fd..5f6771a71d 100644
--- a/common/EventMapper.cpp
+++ b/common/EventMapper.cpp
@@ -22,6 +22,9 @@
#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
namespace Common {
List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
@@ -46,9 +49,44 @@ List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
// if it didn't get mapped, just pass it through
if (mappedEvent.type == EVENT_INVALID)
mappedEvent = ev;
+
+#ifdef ENABLE_KEYMAPPER
+ // TODO: this check is not needed post-split
+ if (mappedEvent.type == EVENT_CUSTOM_BACKEND_HARDWARE) {
+ warning("EVENT_CUSTOM_BACKEND_HARDWARE was not mapped");
+ return List<Event>();
+ }
+#endif
+
events.push_back(mappedEvent);
return events;
}
+void DefaultEventMapper::addDelayedEvent(uint32 millis, Event ev) {
+ if (_delayedEvents.empty()) {
+ _delayedEffectiveTime = g_system->getMillis() + millis;
+ millis = 0;
+ }
+ DelayedEventsEntry entry = DelayedEventsEntry(millis, ev);
+ _delayedEvents.push(entry);
+}
+
+List<Event> DefaultEventMapper::getDelayedEvents() {
+ List<Event> events;
+
+ if (_delayedEvents.empty())
+ return events;
+
+ uint32 now = g_system->getMillis();
+
+ while (!_delayedEvents.empty() && now >= _delayedEffectiveTime) {
+ DelayedEventsEntry entry = _delayedEvents.pop();
+ if (!_delayedEvents.empty())
+ _delayedEffectiveTime += _delayedEvents.front().timerOffset;
+ events.push_back(entry.event);
+ }
+ return events;
+}
+
} // namespace Common
diff --git a/common/array.h b/common/array.h
index a2c3023362..ca89523a0b 100644
--- a/common/array.h
+++ b/common/array.h
@@ -332,7 +332,7 @@ protected:
// Copy a part of the new data to the position inside the
// initialized space.
copy(first, first + (_size - idx), pos);
-
+
// Copy a part of the new data to the position inside the
// uninitialized space.
uninitialized_copy(first + (_size - idx), last, _storage + _size);
diff --git a/common/coroutines.cpp b/common/coroutines.cpp
new file mode 100644
index 0000000000..849b881177
--- /dev/null
+++ b/common/coroutines.cpp
@@ -0,0 +1,731 @@
+/* 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/coroutines.h"
+#include "common/algorithm.h"
+#include "common/debug.h"
+#include "common/hashmap.h"
+#include "common/hash-str.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
+namespace Common {
+
+/** Helper null context instance */
+CoroContext nullContext = NULL;
+
+DECLARE_SINGLETON(CoroutineScheduler);
+
+#ifdef COROUTINE_DEBUG
+namespace {
+/** Count of active coroutines */
+static int s_coroCount = 0;
+
+typedef Common::HashMap<Common::String, int> CoroHashMap;
+static CoroHashMap *s_coroFuncs = 0;
+
+/**
+ * Change the current coroutine status
+ */
+static void changeCoroStats(const char *func, int change) {
+ if (!s_coroFuncs)
+ s_coroFuncs = new CoroHashMap();
+
+ (*s_coroFuncs)[func] += change;
+}
+
+/**
+ * Display the details of active coroutines
+ */
+static void displayCoroStats() {
+ debug("%d active coros", s_coroCount);
+
+ // Loop over s_coroFuncs and print info about active coros
+ if (!s_coroFuncs)
+ return;
+ for (CoroHashMap::const_iterator it = s_coroFuncs->begin();
+ it != s_coroFuncs->end(); ++it) {
+ if (it->_value != 0)
+ debug(" %3d x %s", it->_value, it->_key.c_str());
+ }
+}
+
+} // End of anonymous namespace
+#endif
+
+CoroBaseContext::CoroBaseContext(const char *func)
+ : _line(0), _sleep(0), _subctx(0) {
+#ifdef COROUTINE_DEBUG
+ _funcName = func;
+ changeCoroStats(_funcName, +1);
+ s_coroCount++;
+#endif
+}
+
+CoroBaseContext::~CoroBaseContext() {
+#ifdef COROUTINE_DEBUG
+ s_coroCount--;
+ changeCoroStats(_funcName, -1);
+ debug("Deleting coro in %s at %p (subctx %p)",
+ _funcName, (void *)this, (void *)_subctx);
+ displayCoroStats();
+#endif
+ delete _subctx;
+}
+
+//--------------------- Scheduler Class ------------------------
+
+CoroutineScheduler::CoroutineScheduler() {
+ processList = NULL;
+ pFreeProcesses = NULL;
+ pCurrent = NULL;
+
+#ifdef DEBUG
+ // diagnostic process counters
+ numProcs = 0;
+ maxProcs = 0;
+#endif
+
+ pRCfunction = NULL;
+ pidCounter = 0;
+
+ active = new PROCESS;
+ active->pPrevious = NULL;
+ active->pNext = NULL;
+
+ reset();
+}
+
+CoroutineScheduler::~CoroutineScheduler() {
+ // Kill all running processes (i.e. free memory allocated for their state).
+ PROCESS *pProc = active->pNext;
+ while (pProc != NULL) {
+ delete pProc->state;
+ pProc->state = 0;
+ pProc = pProc->pNext;
+ }
+
+ free(processList);
+ processList = NULL;
+
+ delete active;
+ active = 0;
+
+ // Clear the event list
+ Common::List<EVENT *>::iterator i;
+ for (i = _events.begin(); i != _events.end(); ++i)
+ delete *i;
+}
+
+void CoroutineScheduler::reset() {
+#ifdef DEBUG
+ // clear number of process in use
+ numProcs = 0;
+#endif
+
+ if (processList == NULL) {
+ // first time - allocate memory for process list
+ processList = (PROCESS *)calloc(CORO_MAX_PROCESSES, sizeof(PROCESS));
+
+ // make sure memory allocated
+ if (processList == NULL) {
+ error("Cannot allocate memory for process data");
+ }
+
+ // fill with garbage
+ memset(processList, 'S', CORO_MAX_PROCESSES * sizeof(PROCESS));
+ }
+
+ // Kill all running processes (i.e. free memory allocated for their state).
+ PROCESS *pProc = active->pNext;
+ while (pProc != NULL) {
+ delete pProc->state;
+ pProc->state = 0;
+ Common::fill(&pProc->pidWaiting[0], &pProc->pidWaiting[CORO_MAX_PID_WAITING], 0);
+ pProc = pProc->pNext;
+ }
+
+ // no active processes
+ pCurrent = active->pNext = NULL;
+
+ // place first process on free list
+ pFreeProcesses = processList;
+
+ // link all other processes after first
+ for (int i = 1; i <= CORO_NUM_PROCESS; i++) {
+ processList[i - 1].pNext = (i == CORO_NUM_PROCESS) ? NULL : processList + i;
+ processList[i - 1].pPrevious = (i == 1) ? active : processList + (i - 2);
+ }
+}
+
+
+#ifdef DEBUG
+void CoroutineScheduler::printStats() {
+ debug("%i process of %i used", maxProcs, CORO_NUM_PROCESS);
+}
+#endif
+
+#ifdef DEBUG
+void CoroutineScheduler::checkStack() {
+ Common::List<PROCESS *> pList;
+
+ // Check both the active and free process lists
+ for (int i = 0; i < 2; ++i) {
+ PROCESS *p = (i == 0) ? active : pFreeProcesses;
+
+ if (p != NULL) {
+ // Make sure the linkages are correct
+ while (p->pNext != NULL) {
+ assert(p->pNext->pPrevious == p);
+ pList.push_back(p);
+ p = p->pNext;
+ }
+ pList.push_back(p);
+ }
+ }
+
+ // Make sure all processes are accounted for
+ for (int idx = 0; idx < CORO_NUM_PROCESS; idx++) {
+ bool found = false;
+ for (Common::List<PROCESS *>::iterator i = pList.begin(); i != pList.end(); ++i) {
+ PROCESS *pTemp = *i;
+ if (*i == &processList[idx]) {
+ found = true;
+ break;
+ }
+ }
+
+ assert(found);
+ }
+}
+#endif
+
+void CoroutineScheduler::schedule() {
+ // start dispatching active process list
+ PROCESS *pNext;
+ PROCESS *pProc = active->pNext;
+ while (pProc != NULL) {
+ pNext = pProc->pNext;
+
+ if (--pProc->sleepTime <= 0) {
+ // process is ready for dispatch, activate it
+ pCurrent = pProc;
+ pProc->coroAddr(pProc->state, pProc->param);
+
+ if (!pProc->state || pProc->state->_sleep <= 0) {
+ // Coroutine finished
+ pCurrent = pCurrent->pPrevious;
+ killProcess(pProc);
+ } else {
+ pProc->sleepTime = pProc->state->_sleep;
+ }
+
+ // pCurrent may have been changed
+ pNext = pCurrent->pNext;
+ pCurrent = NULL;
+ }
+
+ pProc = pNext;
+ }
+
+ // Disable any events that were pulsed
+ Common::List<EVENT *>::iterator i;
+ for (i = _events.begin(); i != _events.end(); ++i) {
+ EVENT *evt = *i;
+ if (evt->pulsing) {
+ evt->pulsing = evt->signalled = false;
+ }
+ }
+}
+
+void CoroutineScheduler::rescheduleAll() {
+ assert(pCurrent);
+
+ // Unlink current process
+ pCurrent->pPrevious->pNext = pCurrent->pNext;
+ if (pCurrent->pNext)
+ pCurrent->pNext->pPrevious = pCurrent->pPrevious;
+
+ // Add process to the start of the active list
+ pCurrent->pNext = active->pNext;
+ active->pNext->pPrevious = pCurrent;
+ active->pNext = pCurrent;
+ pCurrent->pPrevious = active;
+}
+
+void CoroutineScheduler::reschedule(PPROCESS pReSchedProc) {
+ // If not currently processing the schedule list, then no action is needed
+ if (!pCurrent)
+ return;
+
+ if (!pReSchedProc)
+ pReSchedProc = pCurrent;
+
+ PPROCESS pEnd;
+
+ // Find the last process in the list.
+ // But if the target process is down the list from here, do nothing
+ for (pEnd = pCurrent; pEnd->pNext != NULL; pEnd = pEnd->pNext) {
+ if (pEnd->pNext == pReSchedProc)
+ return;
+ }
+
+ assert(pEnd->pNext == NULL);
+
+ // Could be in the middle of a KillProc()!
+ // Dying process was last and this process was penultimate
+ if (pReSchedProc->pNext == NULL)
+ return;
+
+ // If we're moving the current process, move it back by one, so that the next
+ // schedule() iteration moves to the now next one
+ if (pCurrent == pReSchedProc)
+ pCurrent = pCurrent->pPrevious;
+
+ // Unlink the process, and add it at the end
+ pReSchedProc->pPrevious->pNext = pReSchedProc->pNext;
+ pReSchedProc->pNext->pPrevious = pReSchedProc->pPrevious;
+ pEnd->pNext = pReSchedProc;
+ pReSchedProc->pPrevious = pEnd;
+ pReSchedProc->pNext = NULL;
+}
+
+void CoroutineScheduler::giveWay(PPROCESS pReSchedProc) {
+ // If not currently processing the schedule list, then no action is needed
+ if (!pCurrent)
+ return;
+
+ if (!pReSchedProc)
+ pReSchedProc = pCurrent;
+
+ // If the process is already at the end of the queue, nothing has to be done
+ if (!pReSchedProc->pNext)
+ return;
+
+ PPROCESS pEnd;
+
+ // Find the last process in the list.
+ for (pEnd = pCurrent; pEnd->pNext != NULL; pEnd = pEnd->pNext)
+ ;
+ assert(pEnd->pNext == NULL);
+
+
+ // If we're moving the current process, move it back by one, so that the next
+ // schedule() iteration moves to the now next one
+ if (pCurrent == pReSchedProc)
+ pCurrent = pCurrent->pPrevious;
+
+ // Unlink the process, and add it at the end
+ pReSchedProc->pPrevious->pNext = pReSchedProc->pNext;
+ pReSchedProc->pNext->pPrevious = pReSchedProc->pPrevious;
+ pEnd->pNext = pReSchedProc;
+ pReSchedProc->pPrevious = pEnd;
+ pReSchedProc->pNext = NULL;
+}
+
+void CoroutineScheduler::waitForSingleObject(CORO_PARAM, int pid, uint32 duration, bool *expired) {
+ if (!pCurrent)
+ error("Called CoroutineScheduler::waitForSingleObject from the main process");
+
+ CORO_BEGIN_CONTEXT;
+ uint32 endTime;
+ PROCESS *pProcess;
+ EVENT *pEvent;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Signal the process Id this process is now waiting for
+ pCurrent->pidWaiting[0] = pid;
+
+ _ctx->endTime = (duration == CORO_INFINITE) ? CORO_INFINITE : g_system->getMillis() + duration;
+ if (expired)
+ // Presume it will expire
+ *expired = true;
+
+ // Outer loop for doing checks until expiry
+ while (g_system->getMillis() <= _ctx->endTime) {
+ // Check to see if a process or event with the given Id exists
+ _ctx->pProcess = getProcess(pid);
+ _ctx->pEvent = !_ctx->pProcess ? getEvent(pid) : NULL;
+
+ // If there's no active process or event, presume it's a process that's finished,
+ // so the waiting can immediately exit
+ if ((_ctx->pProcess == NULL) && (_ctx->pEvent == NULL)) {
+ if (expired)
+ *expired = false;
+ break;
+ }
+
+ // If a process was found, don't go into the if statement, and keep waiting.
+ // Likewise if it's an event that's not yet signalled
+ if ((_ctx->pEvent != NULL) && _ctx->pEvent->signalled) {
+ // Unless the event is flagged for manual reset, reset it now
+ if (!_ctx->pEvent->manualReset)
+ _ctx->pEvent->signalled = false;
+
+ if (expired)
+ *expired = false;
+ break;
+ }
+
+ // Sleep until the next cycle
+ CORO_SLEEP(1);
+ }
+
+ // Signal waiting is done
+ Common::fill(&pCurrent->pidWaiting[0], &pCurrent->pidWaiting[CORO_MAX_PID_WAITING], 0);
+
+ CORO_END_CODE;
+}
+
+void CoroutineScheduler::waitForMultipleObjects(CORO_PARAM, int nCount, uint32 *pidList, bool bWaitAll,
+ uint32 duration, bool *expired) {
+ if (!pCurrent)
+ error("Called CoroutineScheduler::waitForMultipleObjects from the main process");
+
+ CORO_BEGIN_CONTEXT;
+ uint32 endTime;
+ bool signalled;
+ bool pidSignalled;
+ int i;
+ PROCESS *pProcess;
+ EVENT *pEvent;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Signal the waiting events
+ assert(nCount < CORO_MAX_PID_WAITING);
+ Common::copy(pidList, pidList + nCount, pCurrent->pidWaiting);
+
+ _ctx->endTime = (duration == CORO_INFINITE) ? CORO_INFINITE : g_system->getMillis() + duration;
+ if (expired)
+ // Presume that delay will expire
+ *expired = true;
+
+ // Outer loop for doing checks until expiry
+ while (g_system->getMillis() <= _ctx->endTime) {
+ _ctx->signalled = bWaitAll;
+
+ for (_ctx->i = 0; _ctx->i < nCount; ++_ctx->i) {
+ _ctx->pProcess = getProcess(pidList[_ctx->i]);
+ _ctx->pEvent = !_ctx->pProcess ? getEvent(pidList[_ctx->i]) : NULL;
+
+ // Determine the signalled state
+ _ctx->pidSignalled = (_ctx->pProcess) || !_ctx->pEvent ? false : _ctx->pEvent->signalled;
+
+ if (bWaitAll && !_ctx->pidSignalled)
+ _ctx->signalled = false;
+ else if (!bWaitAll && _ctx->pidSignalled)
+ _ctx->signalled = true;
+ }
+
+ // At this point, if the signalled variable is set, waiting is finished
+ if (_ctx->signalled) {
+ // Automatically reset any events not flagged for manual reset
+ for (_ctx->i = 0; _ctx->i < nCount; ++_ctx->i) {
+ _ctx->pEvent = getEvent(pidList[_ctx->i]);
+
+ if (!_ctx->pEvent->manualReset)
+ _ctx->pEvent->signalled = false;
+ }
+
+ if (expired)
+ *expired = false;
+ break;
+ }
+
+ // Sleep until the next cycle
+ CORO_SLEEP(1);
+ }
+
+ // Signal waiting is done
+ Common::fill(&pCurrent->pidWaiting[0], &pCurrent->pidWaiting[CORO_MAX_PID_WAITING], 0);
+
+ CORO_END_CODE;
+}
+
+void CoroutineScheduler::sleep(CORO_PARAM, uint32 duration) {
+ if (!pCurrent)
+ error("Called CoroutineScheduler::sleep from the main process");
+
+ CORO_BEGIN_CONTEXT;
+ uint32 endTime;
+ PROCESS *pProcess;
+ EVENT *pEvent;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->endTime = g_system->getMillis() + duration;
+
+ // Outer loop for doing checks until expiry
+ while (g_system->getMillis() < _ctx->endTime) {
+ // Sleep until the next cycle
+ CORO_SLEEP(1);
+ }
+
+ CORO_END_CODE;
+}
+
+PROCESS *CoroutineScheduler::createProcess(uint32 pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam) {
+ PROCESS *pProc;
+
+ // get a free process
+ pProc = pFreeProcesses;
+
+ // trap no free process
+ assert(pProc != NULL); // Out of processes
+
+#ifdef DEBUG
+ // one more process in use
+ if (++numProcs > maxProcs)
+ maxProcs = numProcs;
+#endif
+
+ // get link to next free process
+ pFreeProcesses = pProc->pNext;
+ if (pFreeProcesses)
+ pFreeProcesses->pPrevious = NULL;
+
+ if (pCurrent != NULL) {
+ // place new process before the next active process
+ pProc->pNext = pCurrent->pNext;
+ if (pProc->pNext)
+ pProc->pNext->pPrevious = pProc;
+
+ // make this new process the next active process
+ pCurrent->pNext = pProc;
+ pProc->pPrevious = pCurrent;
+
+ } else { // no active processes, place process at head of list
+ pProc->pNext = active->pNext;
+ pProc->pPrevious = active;
+
+ if (pProc->pNext)
+ pProc->pNext->pPrevious = pProc;
+ active->pNext = pProc;
+
+ }
+
+ // set coroutine entry point
+ pProc->coroAddr = coroAddr;
+
+ // clear coroutine state
+ pProc->state = 0;
+
+ // wake process up as soon as possible
+ pProc->sleepTime = 1;
+
+ // set new process id
+ pProc->pid = pid;
+
+ // set new process specific info
+ if (sizeParam) {
+ assert(sizeParam > 0 && sizeParam <= CORO_PARAM_SIZE);
+
+ // set new process specific info
+ memcpy(pProc->param, pParam, sizeParam);
+ }
+
+ // return created process
+ return pProc;
+}
+
+uint32 CoroutineScheduler::createProcess(CORO_ADDR coroAddr, const void *pParam, int sizeParam) {
+ PROCESS *pProc = createProcess(++pidCounter, coroAddr, pParam, sizeParam);
+ return pProc->pid;
+}
+
+uint32 CoroutineScheduler::createProcess(CORO_ADDR coroAddr, const void *pParam) {
+ return createProcess(coroAddr, &pParam, sizeof(void *));
+}
+
+void CoroutineScheduler::killProcess(PROCESS *pKillProc) {
+ // make sure a valid process pointer
+ assert(pKillProc >= processList && pKillProc <= processList + CORO_NUM_PROCESS - 1);
+
+ // can not kill the current process using killProcess !
+ assert(pCurrent != pKillProc);
+
+#ifdef DEBUG
+ // one less process in use
+ --numProcs;
+ assert(numProcs >= 0);
+#endif
+
+ // Free process' resources
+ if (pRCfunction != NULL)
+ (pRCfunction)(pKillProc);
+
+ delete pKillProc->state;
+ pKillProc->state = 0;
+
+ // Take the process out of the active chain list
+ pKillProc->pPrevious->pNext = pKillProc->pNext;
+ if (pKillProc->pNext)
+ pKillProc->pNext->pPrevious = pKillProc->pPrevious;
+
+ // link first free process after pProc
+ pKillProc->pNext = pFreeProcesses;
+ if (pFreeProcesses)
+ pKillProc->pNext->pPrevious = pKillProc;
+ pKillProc->pPrevious = NULL;
+
+ // make pKillProc the first free process
+ pFreeProcesses = pKillProc;
+}
+
+PROCESS *CoroutineScheduler::getCurrentProcess() {
+ return pCurrent;
+}
+
+int CoroutineScheduler::getCurrentPID() const {
+ PROCESS *pProc = pCurrent;
+
+ // make sure a valid process pointer
+ assert(pProc >= processList && pProc <= processList + CORO_NUM_PROCESS - 1);
+
+ // return processes PID
+ return pProc->pid;
+}
+
+int CoroutineScheduler::killMatchingProcess(uint32 pidKill, int pidMask) {
+ int numKilled = 0;
+ PROCESS *pProc, *pPrev; // process list pointers
+
+ for (pProc = active->pNext, pPrev = active; pProc != NULL; pPrev = pProc, pProc = pProc->pNext) {
+ if ((pProc->pid & (uint32)pidMask) == pidKill) {
+ // found a matching process
+
+ // dont kill the current process
+ if (pProc != pCurrent) {
+ // kill this process
+ numKilled++;
+
+ // Free the process' resources
+ if (pRCfunction != NULL)
+ (pRCfunction)(pProc);
+
+ delete pProc->state;
+ pProc->state = 0;
+
+ // make prev point to next to unlink pProc
+ pPrev->pNext = pProc->pNext;
+ if (pProc->pNext)
+ pPrev->pNext->pPrevious = pPrev;
+
+ // link first free process after pProc
+ pProc->pNext = pFreeProcesses;
+ pProc->pPrevious = NULL;
+ pFreeProcesses->pPrevious = pProc;
+
+ // make pProc the first free process
+ pFreeProcesses = pProc;
+
+ // set to a process on the active list
+ pProc = pPrev;
+ }
+ }
+ }
+
+#ifdef DEBUG
+ // adjust process in use
+ numProcs -= numKilled;
+ assert(numProcs >= 0);
+#endif
+
+ // return number of processes killed
+ return numKilled;
+}
+
+void CoroutineScheduler::setResourceCallback(VFPTRPP pFunc) {
+ pRCfunction = pFunc;
+}
+
+PROCESS *CoroutineScheduler::getProcess(uint32 pid) {
+ PROCESS *pProc = active->pNext;
+ while ((pProc != NULL) && (pProc->pid != pid))
+ pProc = pProc->pNext;
+
+ return pProc;
+}
+
+EVENT *CoroutineScheduler::getEvent(uint32 pid) {
+ Common::List<EVENT *>::iterator i;
+ for (i = _events.begin(); i != _events.end(); ++i) {
+ EVENT *evt = *i;
+ if (evt->pid == pid)
+ return evt;
+ }
+
+ return NULL;
+}
+
+
+uint32 CoroutineScheduler::createEvent(bool bManualReset, bool bInitialState) {
+ EVENT *evt = new EVENT();
+ evt->pid = ++pidCounter;
+ evt->manualReset = bManualReset;
+ evt->signalled = bInitialState;
+ evt->pulsing = false;
+
+ _events.push_back(evt);
+ return evt->pid;
+}
+
+void CoroutineScheduler::closeEvent(uint32 pidEvent) {
+ EVENT *evt = getEvent(pidEvent);
+ if (evt) {
+ _events.remove(evt);
+ delete evt;
+ }
+}
+
+void CoroutineScheduler::setEvent(uint32 pidEvent) {
+ EVENT *evt = getEvent(pidEvent);
+ if (evt)
+ evt->signalled = true;
+}
+
+void CoroutineScheduler::resetEvent(uint32 pidEvent) {
+ EVENT *evt = getEvent(pidEvent);
+ if (evt)
+ evt->signalled = false;
+}
+
+void CoroutineScheduler::pulseEvent(uint32 pidEvent) {
+ EVENT *evt = getEvent(pidEvent);
+ if (!evt)
+ return;
+
+ // Set the event as signalled and pulsing
+ evt->signalled = true;
+ evt->pulsing = true;
+
+ // If there's an active process, and it's not the first in the queue, then reschedule all
+ // the other prcoesses in the queue to run again this frame
+ if (pCurrent && pCurrent != active->pNext)
+ rescheduleAll();
+}
+
+} // end of namespace Common
diff --git a/common/coroutines.h b/common/coroutines.h
new file mode 100644
index 0000000000..834c67f6e4
--- /dev/null
+++ b/common/coroutines.h
@@ -0,0 +1,560 @@
+/* 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 COMMON_COROUTINES_H
+#define COMMON_COROUTINES_H
+
+#include "common/scummsys.h"
+#include "common/util.h" // for SCUMMVM_CURRENT_FUNCTION
+#include "common/list.h"
+#include "common/singleton.h"
+
+namespace Common {
+
+/**
+ * @defgroup Coroutine support for simulating multi-threading.
+ *
+ * The following is loosely based on an article by Simon Tatham:
+ * <http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html>.
+ * However, many improvements and tweaks have been made, in particular
+ * by taking advantage of C++ features not available in C.
+ */
+//@{
+
+#define CoroScheduler (Common::CoroutineScheduler::instance())
+
+
+// Enable this macro to enable some debugging support in the coroutine code.
+//#define COROUTINE_DEBUG
+
+/**
+ * The core of any coroutine context which captures the 'state' of a coroutine.
+ * Private use only.
+ */
+struct CoroBaseContext {
+ int _line;
+ int _sleep;
+ CoroBaseContext *_subctx;
+#ifdef COROUTINE_DEBUG
+ const char *_funcName;
+#endif
+ /**
+ * Creates a coroutine context
+ */
+ CoroBaseContext(const char *func);
+
+ /**
+ * Destructor for coroutine context
+ */
+ virtual ~CoroBaseContext();
+};
+
+typedef CoroBaseContext *CoroContext;
+
+
+/** This is a special constant that can be temporarily used as a parameter to call coroutine-ised
+ * methods from code that haven't yet been converted to being a coroutine, so code at least
+ * compiles correctly. Be aware, though, that an error will occur if a coroutine that was passed
+ * the nullContext tries to sleep or yield control.
+ */
+extern CoroContext nullContext;
+
+/**
+ * Wrapper class which holds a pointer to a pointer to a CoroBaseContext.
+ * The interesting part is the destructor, which kills the context being held,
+ * but ONLY if the _sleep val of that context is zero. This way, a coroutine
+ * can just 'return' w/o having to worry about freeing the allocated context
+ * (in Simon Tatham's original code, one had to use a special macro to
+ * return from a coroutine).
+ */
+class CoroContextHolder {
+ CoroContext &_ctx;
+public:
+ CoroContextHolder(CoroContext &ctx) : _ctx(ctx) {
+ assert(ctx);
+ assert(ctx->_sleep >= 0);
+ ctx->_sleep = 0;
+ }
+ ~CoroContextHolder() {
+ if (_ctx && _ctx->_sleep == 0) {
+ delete _ctx;
+ _ctx = 0;
+ }
+ }
+};
+
+/** Methods that have been converted to being a coroutine should have this as the first parameter */
+#define CORO_PARAM Common::CoroContext &coroParam
+
+
+/**
+ * Begin the declaration of a coroutine context.
+ * This allows declaring variables which are 'persistent' during the
+ * lifetime of the coroutine. An example use would be:
+ *
+ * CORO_BEGIN_CONTEXT;
+ * int var;
+ * char *foo;
+ * CORO_END_CONTEXT(_ctx);
+ *
+ * It is not possible to initialize variables here, due to the way this
+ * macro is implemented. Furthermore, to use the variables declared in
+ * the coroutine context, you have to access them via the context variable
+ * name that was specified as parameter to CORO_END_CONTEXT, e.g.
+ * _ctx->var = 0;
+ *
+ * @see CORO_END_CONTEXT
+ *
+ * @note We declare a variable 'DUMMY' to allow the user to specify an 'empty'
+ * context, and so compilers won't complain about ";" following the macro.
+ */
+#define CORO_BEGIN_CONTEXT \
+ struct CoroContextTag : Common::CoroBaseContext { \
+ CoroContextTag() : CoroBaseContext(SCUMMVM_CURRENT_FUNCTION) {} \
+ int DUMMY
+
+/**
+ * End the declaration of a coroutine context.
+ * @param x name of the coroutine context
+ * @see CORO_BEGIN_CONTEXT
+ */
+#define CORO_END_CONTEXT(x) } *x = (CoroContextTag *)coroParam
+
+/**
+ * Begin the code section of a coroutine.
+ * @param x name of the coroutine context
+ * @see CORO_BEGIN_CODE
+ */
+#define CORO_BEGIN_CODE(x) \
+ if (&coroParam == &Common::nullContext) assert(!Common::nullContext); \
+ if (!x) { coroParam = x = new CoroContextTag(); } \
+ Common::CoroContextHolder tmpHolder(coroParam); \
+ switch (coroParam->_line) { case 0:;
+
+/**
+ * End the code section of a coroutine.
+ * @see CORO_END_CODE
+ */
+#define CORO_END_CODE \
+ if (&coroParam == &Common::nullContext) { \
+ delete Common::nullContext; \
+ Common::nullContext = NULL; \
+ } \
+ }
+
+/**
+ * Sleep for the specified number of scheduler cycles.
+ */
+#define CORO_SLEEP(delay) \
+ do { \
+ coroParam->_line = __LINE__; \
+ coroParam->_sleep = delay; \
+ assert(&coroParam != &Common::nullContext); \
+ return; case __LINE__:; \
+ } while (0)
+
+#define CORO_GIVE_WAY do { CoroScheduler.giveWay(); CORO_SLEEP(1); } while (0)
+#define CORO_RESCHEDULE do { CoroScheduler.reschedule(); CORO_SLEEP(1); } while (0)
+
+/**
+ * Stop the currently running coroutine and all calling coroutines.
+ *
+ * This sets _sleep to -1 rather than 0 so that the context doesn't get
+ * deleted by CoroContextHolder, since we want CORO_INVOKE_ARGS to
+ * propogate the _sleep value and return immediately (the scheduler will
+ * then delete the entire coroutine's state, including all subcontexts).
+ */
+#define CORO_KILL_SELF() \
+ do { if (&coroParam != &Common::nullContext) { coroParam->_sleep = -1; } return; } while (0)
+
+
+/**
+ * This macro is to be used in conjunction with CORO_INVOKE_ARGS and
+ * similar macros for calling coroutines-enabled subroutines.
+ */
+#define CORO_SUBCTX coroParam->_subctx
+
+/**
+ * Invoke another coroutine.
+ *
+ * If the subcontext still exists after the coroutine is invoked, it has
+ * either yielded/slept or killed itself, and so we copy the _sleep value
+ * to our own context and return (execution will continue at the case
+ * statement below, where we loop and call the coroutine again).
+ * If the subcontext is null, the coroutine ended normally, and we can
+ * simply break out of the loop and continue execution.
+ *
+ * @param subCoro name of the coroutine-enabled function to invoke
+ * @param ARGS list of arguments to pass to subCoro
+ *
+ * @note ARGS must be surrounded by parentheses, and the first argument
+ * in this list must always be CORO_SUBCTX. For example, the
+ * regular function call
+ * myFunc(a, b);
+ * becomes the following:
+ * CORO_INVOKE_ARGS(myFunc, (CORO_SUBCTX, a, b));
+ */
+#define CORO_INVOKE_ARGS(subCoro, ARGS) \
+ do { \
+ coroParam->_line = __LINE__; \
+ coroParam->_subctx = 0; \
+ do { \
+ subCoro ARGS; \
+ if (!coroParam->_subctx) break; \
+ coroParam->_sleep = coroParam->_subctx->_sleep; \
+ assert(&coroParam != &Common::nullContext); \
+ return; case __LINE__:; \
+ } while (1); \
+ } while (0)
+
+/**
+ * Invoke another coroutine. Similar to CORO_INVOKE_ARGS,
+ * but allows specifying a return value which is returned
+ * if invoked coroutine yields (thus causing the current
+ * coroutine to yield, too).
+ */
+#define CORO_INVOKE_ARGS_V(subCoro, RESULT, ARGS) \
+ do { \
+ coroParam->_line = __LINE__; \
+ coroParam->_subctx = 0; \
+ do { \
+ subCoro ARGS; \
+ if (!coroParam->_subctx) break; \
+ coroParam->_sleep = coroParam->_subctx->_sleep; \
+ assert(&coroParam != &Common::nullContext); \
+ return RESULT; case __LINE__:; \
+ } while (1); \
+ } while (0)
+
+/**
+ * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
+ * with no parameters.
+ */
+#define CORO_INVOKE_0(subCoroutine) \
+ CORO_INVOKE_ARGS(subCoroutine, (CORO_SUBCTX))
+
+/**
+ * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
+ * with one parameter.
+ */
+#define CORO_INVOKE_1(subCoroutine, a0) \
+ CORO_INVOKE_ARGS(subCoroutine, (CORO_SUBCTX, a0))
+
+/**
+ * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
+ * with two parameters.
+ */
+#define CORO_INVOKE_2(subCoroutine, a0,a1) \
+ CORO_INVOKE_ARGS(subCoroutine, (CORO_SUBCTX, a0, a1))
+
+/**
+ * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
+ * with three parameters.
+ */
+#define CORO_INVOKE_3(subCoroutine, a0,a1,a2) \
+ CORO_INVOKE_ARGS(subCoroutine, (CORO_SUBCTX, a0, a1, a2))
+
+/**
+ * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
+ * with four parameters.
+ */
+#define CORO_INVOKE_4(subCoroutine, a0,a1,a2,a3) \
+ CORO_INVOKE_ARGS(subCoroutine, (CORO_SUBCTX, a0, a1, a2, a3))
+
+
+
+// the size of process specific info
+#define CORO_PARAM_SIZE 32
+
+// the maximum number of processes
+#define CORO_NUM_PROCESS 100
+#define CORO_MAX_PROCESSES 100
+#define CORO_MAX_PID_WAITING 5
+
+#define CORO_INFINITE 0xffffffff
+#define CORO_INVALID_PID_VALUE 0
+
+/** Coroutine parameter for methods converted to coroutines */
+typedef void (*CORO_ADDR)(CoroContext &, const void *);
+
+/** process structure */
+struct PROCESS {
+ PROCESS *pNext; ///< pointer to next process in active or free list
+ PROCESS *pPrevious; ///< pointer to previous process in active or free list
+
+ CoroContext state; ///< the state of the coroutine
+ CORO_ADDR coroAddr; ///< the entry point of the coroutine
+
+ int sleepTime; ///< number of scheduler cycles to sleep
+ uint32 pid; ///< process ID
+ uint32 pidWaiting[CORO_MAX_PID_WAITING]; ///< Process ID(s) process is currently waiting on
+ char param[CORO_PARAM_SIZE]; ///< process specific info
+};
+typedef PROCESS *PPROCESS;
+
+
+/** Event structure */
+struct EVENT {
+ uint32 pid;
+ bool manualReset;
+ bool signalled;
+ bool pulsing;
+};
+
+
+/**
+ * Creates and manages "processes" (really coroutines).
+ */
+class CoroutineScheduler : public Singleton<CoroutineScheduler> {
+public:
+ /** Pointer to a function of the form "void function(PPROCESS)" */
+ typedef void (*VFPTRPP)(PROCESS *);
+
+private:
+ friend class Singleton<CoroutineScheduler>;
+
+ /**
+ * Constructor
+ */
+ CoroutineScheduler();
+
+ /**
+ * Destructor
+ */
+ ~CoroutineScheduler();
+
+
+ /** list of all processes */
+ PROCESS *processList;
+
+ /** active process list - also saves scheduler state */
+ PROCESS *active;
+
+ /** pointer to free process list */
+ PROCESS *pFreeProcesses;
+
+ /** the currently active process */
+ PROCESS *pCurrent;
+
+ /** Auto-incrementing process Id */
+ int pidCounter;
+
+ /** Event list */
+ Common::List<EVENT *> _events;
+
+#ifdef DEBUG
+ // diagnostic process counters
+ int numProcs;
+ int maxProcs;
+
+ /**
+ * Checks both the active and free process list to insure all the links are valid,
+ * and that no processes have been lost
+ */
+ void checkStack();
+#endif
+
+ /**
+ * Called from killProcess() to enable other resources
+ * a process may be allocated to be released.
+ */
+ VFPTRPP pRCfunction;
+
+ PROCESS *getProcess(uint32 pid);
+ EVENT *getEvent(uint32 pid);
+public:
+ /**
+ * Kills all processes and places them on the free list.
+ */
+ void reset();
+
+#ifdef DEBUG
+ /**
+ * Shows the maximum number of process used at once.
+ */
+ void printStats();
+#endif
+
+ /**
+ * Give all active processes a chance to run
+ */
+ void schedule();
+
+ /**
+ * Reschedules all the processes to run again this tick
+ */
+ void rescheduleAll();
+
+ /**
+ * If the specified process has already run on this tick, make it run
+ * again on the current tick.
+ */
+ void reschedule(PPROCESS pReSchedProc = NULL);
+
+ /**
+ * Moves the specified process to the end of the dispatch queue
+ * allowing it to run again within the current game cycle.
+ * @param pGiveProc Which process
+ */
+ void giveWay(PPROCESS pReSchedProc = NULL);
+
+ /**
+ * Continously makes a given process wait for another process to finish or event to signal.
+ *
+ * @param pid Process/Event identifier
+ * @param duration Duration in milliseconds
+ * @param expired If specified, set to true if delay period expired
+ */
+ void waitForSingleObject(CORO_PARAM, int pid, uint32 duration, bool *expired = NULL);
+
+ /**
+ * Continously makes a given process wait for given prcesses to finished or events to be set
+ *
+ * @param nCount Number of Id's being passed
+ * @param evtList List of pids to wait for
+ * @param bWaitAll Specifies whether all or any of the processes/events
+ * @param duration Duration in milliseconds
+ * @param expired Set to true if delay period expired
+ */
+ void waitForMultipleObjects(CORO_PARAM, int nCount, uint32 *pidList, bool bWaitAll,
+ uint32 duration, bool *expired = NULL);
+
+ /**
+ * Make the active process sleep for the given duration in milliseconds
+ *
+ * @param duration Duration in milliseconds
+ * @remarks This duration won't be precise, since it relies on the frequency the
+ * scheduler is called.
+ */
+ void sleep(CORO_PARAM, uint32 duration);
+
+ /**
+ * Creates a new process.
+ *
+ * @param pid process identifier
+ * @param coroAddr Coroutine start address
+ * @param pParam Process specific info
+ * @param sizeParam Size of process specific info
+ */
+ PROCESS *createProcess(uint32 pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam);
+
+ /**
+ * Creates a new process with an auto-incrementing Process Id.
+ *
+ * @param coroAddr Coroutine start address
+ * @param pParam Process specific info
+ * @param sizeParam Size of process specific info
+ */
+ uint32 createProcess(CORO_ADDR coroAddr, const void *pParam, int sizeParam);
+
+ /**
+ * Creates a new process with an auto-incrementing Process Id, and a single pointer parameter.
+ *
+ * @param coroAddr Coroutine start address
+ * @param pParam Process specific info
+ */
+ uint32 createProcess(CORO_ADDR coroAddr, const void *pParam);
+
+ /**
+ * Kills the specified process.
+ *
+ * @param pKillProc Which process to kill
+ */
+ void killProcess(PROCESS *pKillProc);
+
+ /**
+ * Returns a pointer to the currently running process.
+ */
+ PROCESS *getCurrentProcess();
+
+ /**
+ * Returns the process identifier of the currently running process.
+ */
+ int getCurrentPID() const;
+
+ /**
+ * Kills any process matching the specified PID. The current
+ * process cannot be killed.
+ *
+ * @param pidKill Process identifier of process to kill
+ * @param pidMask Mask to apply to process identifiers before comparison
+ * @return The number of processes killed is returned.
+ */
+ int killMatchingProcess(uint32 pidKill, int pidMask = -1);
+
+ /**
+ * Set pointer to a function to be called by killProcess().
+ *
+ * May be called by a resource allocator, the function supplied is
+ * called by killProcess() to allow the resource allocator to free
+ * resources allocated to the dying process.
+ *
+ * @param pFunc Function to be called by killProcess()
+ */
+ void setResourceCallback(VFPTRPP pFunc);
+
+ /* Event methods */
+ /**
+ * Creates a new event (semaphore) object
+ *
+ * @param bManualReset Events needs to be manually reset. Otherwise,
+ * events will be automatically reset after a
+ * process waits on the event finishes
+ * @param bInitialState Specifies whether the event is signalled or not
+ * initially
+ */
+ uint32 createEvent(bool bManualReset, bool bInitialState);
+
+ /**
+ * Destroys the given event
+ * @param pidEvent Event Process Id
+ */
+ void closeEvent(uint32 pidEvent);
+
+ /**
+ * Sets the event
+ * @param pidEvent Event Process Id
+ */
+ void setEvent(uint32 pidEvent);
+
+ /**
+ * Resets the event
+ * @param pidEvent Event Process Id
+ */
+ void resetEvent(uint32 pidEvent);
+
+ /**
+ * Temporarily sets a given event to true, and then runs all waiting
+ * processes,allowing any processes waiting on the event to be fired. It
+ * then immediately resets the event again.
+ *
+ * @param pidEvent Event Process Id
+ *
+ * @remarks Should not be run inside of another process
+ */
+ void pulseEvent(uint32 pidEvent);
+};
+
+//@}
+
+} // end of namespace Common
+
+#endif // COMMON_COROUTINES_H
diff --git a/common/cosinetables.cpp b/common/cosinetables.cpp
index 30f55b55fc..fe8f454e14 100644
--- a/common/cosinetables.cpp
+++ b/common/cosinetables.cpp
@@ -27,8248 +27,26 @@
namespace Common {
-static const float cosTable16[8] = {
- 1.000000f, 0.923880f, 0.707107f, 0.382683f, 0.000000f, 0.382683f, 0.707107f, 0.923880f
-};
+CosineTable::CosineTable(int bitPrecision) {
+ assert((bitPrecision >= 4) && (bitPrecision <= 16));
-static const float cosTable32[16] = {
- 1.000000f, 0.980785f, 0.923880f, 0.831470f, 0.707107f, 0.555570f, 0.382683f, 0.195090f,
- 0.000000f, 0.195090f, 0.382683f, 0.555570f, 0.707107f, 0.831470f, 0.923880f, 0.980785f
-};
+ _bitPrecision = bitPrecision;
-static const float cosTable64[32] = {
- 1.000000f, 0.995185f, 0.980785f, 0.956940f, 0.923880f, 0.881921f, 0.831470f, 0.773010f,
- 0.707107f, 0.634393f, 0.555570f, 0.471397f, 0.382683f, 0.290285f, 0.195090f, 0.098017f,
- 0.000000f, 0.098017f, 0.195090f, 0.290285f, 0.382683f, 0.471397f, 0.555570f, 0.634393f,
- 0.707107f, 0.773010f, 0.831470f, 0.881921f, 0.923880f, 0.956940f, 0.980785f, 0.995185f
-};
+ int m = 1 << _bitPrecision;
+ double freq = 2 * M_PI / m;
+ _table = new float[m];
-static const float cosTable128[64] = {
- 1.000000f, 0.998795f, 0.995185f, 0.989177f, 0.980785f, 0.970031f, 0.956940f, 0.941544f,
- 0.923880f, 0.903989f, 0.881921f, 0.857729f, 0.831470f, 0.803208f, 0.773010f, 0.740951f,
- 0.707107f, 0.671559f, 0.634393f, 0.595699f, 0.555570f, 0.514103f, 0.471397f, 0.427555f,
- 0.382683f, 0.336890f, 0.290285f, 0.242980f, 0.195090f, 0.146730f, 0.098017f, 0.049068f,
- 0.000000f, 0.049068f, 0.098017f, 0.146730f, 0.195090f, 0.242980f, 0.290285f, 0.336890f,
- 0.382683f, 0.427555f, 0.471397f, 0.514103f, 0.555570f, 0.595699f, 0.634393f, 0.671559f,
- 0.707107f, 0.740951f, 0.773010f, 0.803208f, 0.831470f, 0.857729f, 0.881921f, 0.903989f,
- 0.923880f, 0.941544f, 0.956940f, 0.970031f, 0.980785f, 0.989177f, 0.995185f, 0.998795f
-};
+ // Table contains cos(2*pi*x/n) for 0<=x<=n/4,
+ // followed by its reverse
+ for (int i = 0; i <= m / 4; i++)
+ _table[i] = cos(i * freq);
-static const float cosTable256[128] = {
- 1.000000f, 0.999699f, 0.998795f, 0.997290f, 0.995185f, 0.992480f, 0.989177f, 0.985278f,
- 0.980785f, 0.975702f, 0.970031f, 0.963776f, 0.956940f, 0.949528f, 0.941544f, 0.932993f,
- 0.923880f, 0.914210f, 0.903989f, 0.893224f, 0.881921f, 0.870087f, 0.857729f, 0.844854f,
- 0.831470f, 0.817585f, 0.803208f, 0.788346f, 0.773010f, 0.757209f, 0.740951f, 0.724247f,
- 0.707107f, 0.689541f, 0.671559f, 0.653173f, 0.634393f, 0.615232f, 0.595699f, 0.575808f,
- 0.555570f, 0.534998f, 0.514103f, 0.492898f, 0.471397f, 0.449611f, 0.427555f, 0.405241f,
- 0.382683f, 0.359895f, 0.336890f, 0.313682f, 0.290285f, 0.266713f, 0.242980f, 0.219101f,
- 0.195090f, 0.170962f, 0.146730f, 0.122411f, 0.098017f, 0.073565f, 0.049068f, 0.024541f,
- 0.000000f, 0.024541f, 0.049068f, 0.073565f, 0.098017f, 0.122411f, 0.146730f, 0.170962f,
- 0.195090f, 0.219101f, 0.242980f, 0.266713f, 0.290285f, 0.313682f, 0.336890f, 0.359895f,
- 0.382683f, 0.405241f, 0.427555f, 0.449611f, 0.471397f, 0.492898f, 0.514103f, 0.534998f,
- 0.555570f, 0.575808f, 0.595699f, 0.615232f, 0.634393f, 0.653173f, 0.671559f, 0.689541f,
- 0.707107f, 0.724247f, 0.740951f, 0.757209f, 0.773010f, 0.788346f, 0.803208f, 0.817585f,
- 0.831470f, 0.844854f, 0.857729f, 0.870087f, 0.881921f, 0.893224f, 0.903989f, 0.914210f,
- 0.923880f, 0.932993f, 0.941544f, 0.949528f, 0.956940f, 0.963776f, 0.970031f, 0.975702f,
- 0.980785f, 0.985278f, 0.989177f, 0.992480f, 0.995185f, 0.997290f, 0.998795f, 0.999699f
-};
-
-static const float cosTable512[256] = {
- 1.000000f, 0.999925f, 0.999699f, 0.999322f, 0.998795f, 0.998118f, 0.997290f, 0.996313f,
- 0.995185f, 0.993907f, 0.992480f, 0.990903f, 0.989177f, 0.987301f, 0.985278f, 0.983105f,
- 0.980785f, 0.978317f, 0.975702f, 0.972940f, 0.970031f, 0.966976f, 0.963776f, 0.960431f,
- 0.956940f, 0.953306f, 0.949528f, 0.945607f, 0.941544f, 0.937339f, 0.932993f, 0.928506f,
- 0.923880f, 0.919114f, 0.914210f, 0.909168f, 0.903989f, 0.898674f, 0.893224f, 0.887640f,
- 0.881921f, 0.876070f, 0.870087f, 0.863973f, 0.857729f, 0.851355f, 0.844854f, 0.838225f,
- 0.831470f, 0.824589f, 0.817585f, 0.810457f, 0.803208f, 0.795837f, 0.788346f, 0.780737f,
- 0.773010f, 0.765167f, 0.757209f, 0.749136f, 0.740951f, 0.732654f, 0.724247f, 0.715731f,
- 0.707107f, 0.698376f, 0.689541f, 0.680601f, 0.671559f, 0.662416f, 0.653173f, 0.643832f,
- 0.634393f, 0.624860f, 0.615232f, 0.605511f, 0.595699f, 0.585798f, 0.575808f, 0.565732f,
- 0.555570f, 0.545325f, 0.534998f, 0.524590f, 0.514103f, 0.503538f, 0.492898f, 0.482184f,
- 0.471397f, 0.460539f, 0.449611f, 0.438616f, 0.427555f, 0.416430f, 0.405241f, 0.393992f,
- 0.382683f, 0.371317f, 0.359895f, 0.348419f, 0.336890f, 0.325310f, 0.313682f, 0.302006f,
- 0.290285f, 0.278520f, 0.266713f, 0.254866f, 0.242980f, 0.231058f, 0.219101f, 0.207111f,
- 0.195090f, 0.183040f, 0.170962f, 0.158858f, 0.146730f, 0.134581f, 0.122411f, 0.110222f,
- 0.098017f, 0.085797f, 0.073565f, 0.061321f, 0.049068f, 0.036807f, 0.024541f, 0.012272f,
- 0.000000f, 0.012272f, 0.024541f, 0.036807f, 0.049068f, 0.061321f, 0.073565f, 0.085797f,
- 0.098017f, 0.110222f, 0.122411f, 0.134581f, 0.146730f, 0.158858f, 0.170962f, 0.183040f,
- 0.195090f, 0.207111f, 0.219101f, 0.231058f, 0.242980f, 0.254866f, 0.266713f, 0.278520f,
- 0.290285f, 0.302006f, 0.313682f, 0.325310f, 0.336890f, 0.348419f, 0.359895f, 0.371317f,
- 0.382683f, 0.393992f, 0.405241f, 0.416430f, 0.427555f, 0.438616f, 0.449611f, 0.460539f,
- 0.471397f, 0.482184f, 0.492898f, 0.503538f, 0.514103f, 0.524590f, 0.534998f, 0.545325f,
- 0.555570f, 0.565732f, 0.575808f, 0.585798f, 0.595699f, 0.605511f, 0.615232f, 0.624860f,
- 0.634393f, 0.643832f, 0.653173f, 0.662416f, 0.671559f, 0.680601f, 0.689541f, 0.698376f,
- 0.707107f, 0.715731f, 0.724247f, 0.732654f, 0.740951f, 0.749136f, 0.757209f, 0.765167f,
- 0.773010f, 0.780737f, 0.788346f, 0.795837f, 0.803208f, 0.810457f, 0.817585f, 0.824589f,
- 0.831470f, 0.838225f, 0.844854f, 0.851355f, 0.857729f, 0.863973f, 0.870087f, 0.876070f,
- 0.881921f, 0.887640f, 0.893224f, 0.898674f, 0.903989f, 0.909168f, 0.914210f, 0.919114f,
- 0.923880f, 0.928506f, 0.932993f, 0.937339f, 0.941544f, 0.945607f, 0.949528f, 0.953306f,
- 0.956940f, 0.960431f, 0.963776f, 0.966976f, 0.970031f, 0.972940f, 0.975702f, 0.978317f,
- 0.980785f, 0.983105f, 0.985278f, 0.987301f, 0.989177f, 0.990903f, 0.992480f, 0.993907f,
- 0.995185f, 0.996313f, 0.997290f, 0.998118f, 0.998795f, 0.999322f, 0.999699f, 0.999925f
-};
-
-static const float cosTable1024[512] = {
- 1.000000f, 0.999981f, 0.999925f, 0.999831f, 0.999699f, 0.999529f, 0.999322f, 0.999078f,
- 0.998795f, 0.998476f, 0.998118f, 0.997723f, 0.997290f, 0.996820f, 0.996313f, 0.995767f,
- 0.995185f, 0.994565f, 0.993907f, 0.993212f, 0.992480f, 0.991710f, 0.990903f, 0.990058f,
- 0.989177f, 0.988258f, 0.987301f, 0.986308f, 0.985278f, 0.984210f, 0.983105f, 0.981964f,
- 0.980785f, 0.979570f, 0.978317f, 0.977028f, 0.975702f, 0.974339f, 0.972940f, 0.971504f,
- 0.970031f, 0.968522f, 0.966976f, 0.965394f, 0.963776f, 0.962121f, 0.960431f, 0.958703f,
- 0.956940f, 0.955141f, 0.953306f, 0.951435f, 0.949528f, 0.947586f, 0.945607f, 0.943593f,
- 0.941544f, 0.939459f, 0.937339f, 0.935184f, 0.932993f, 0.930767f, 0.928506f, 0.926210f,
- 0.923880f, 0.921514f, 0.919114f, 0.916679f, 0.914210f, 0.911706f, 0.909168f, 0.906596f,
- 0.903989f, 0.901349f, 0.898674f, 0.895966f, 0.893224f, 0.890449f, 0.887640f, 0.884797f,
- 0.881921f, 0.879012f, 0.876070f, 0.873095f, 0.870087f, 0.867046f, 0.863973f, 0.860867f,
- 0.857729f, 0.854558f, 0.851355f, 0.848120f, 0.844854f, 0.841555f, 0.838225f, 0.834863f,
- 0.831470f, 0.828045f, 0.824589f, 0.821102f, 0.817585f, 0.814036f, 0.810457f, 0.806848f,
- 0.803208f, 0.799537f, 0.795837f, 0.792107f, 0.788346f, 0.784557f, 0.780737f, 0.776888f,
- 0.773010f, 0.769103f, 0.765167f, 0.761202f, 0.757209f, 0.753187f, 0.749136f, 0.745058f,
- 0.740951f, 0.736817f, 0.732654f, 0.728464f, 0.724247f, 0.720003f, 0.715731f, 0.711432f,
- 0.707107f, 0.702755f, 0.698376f, 0.693971f, 0.689541f, 0.685084f, 0.680601f, 0.676093f,
- 0.671559f, 0.667000f, 0.662416f, 0.657807f, 0.653173f, 0.648514f, 0.643832f, 0.639124f,
- 0.634393f, 0.629638f, 0.624860f, 0.620057f, 0.615232f, 0.610383f, 0.605511f, 0.600616f,
- 0.595699f, 0.590760f, 0.585798f, 0.580814f, 0.575808f, 0.570781f, 0.565732f, 0.560662f,
- 0.555570f, 0.550458f, 0.545325f, 0.540171f, 0.534998f, 0.529804f, 0.524590f, 0.519356f,
- 0.514103f, 0.508830f, 0.503538f, 0.498228f, 0.492898f, 0.487550f, 0.482184f, 0.476799f,
- 0.471397f, 0.465977f, 0.460539f, 0.455084f, 0.449611f, 0.444122f, 0.438616f, 0.433094f,
- 0.427555f, 0.422000f, 0.416430f, 0.410843f, 0.405241f, 0.399624f, 0.393992f, 0.388345f,
- 0.382683f, 0.377007f, 0.371317f, 0.365613f, 0.359895f, 0.354164f, 0.348419f, 0.342661f,
- 0.336890f, 0.331106f, 0.325310f, 0.319502f, 0.313682f, 0.307850f, 0.302006f, 0.296151f,
- 0.290285f, 0.284408f, 0.278520f, 0.272621f, 0.266713f, 0.260794f, 0.254866f, 0.248928f,
- 0.242980f, 0.237024f, 0.231058f, 0.225084f, 0.219101f, 0.213110f, 0.207111f, 0.201105f,
- 0.195090f, 0.189069f, 0.183040f, 0.177004f, 0.170962f, 0.164913f, 0.158858f, 0.152797f,
- 0.146730f, 0.140658f, 0.134581f, 0.128498f, 0.122411f, 0.116319f, 0.110222f, 0.104122f,
- 0.098017f, 0.091909f, 0.085797f, 0.079682f, 0.073565f, 0.067444f, 0.061321f, 0.055195f,
- 0.049068f, 0.042938f, 0.036807f, 0.030675f, 0.024541f, 0.018407f, 0.012272f, 0.006136f,
- 0.000000f, 0.006136f, 0.012272f, 0.018407f, 0.024541f, 0.030675f, 0.036807f, 0.042938f,
- 0.049068f, 0.055195f, 0.061321f, 0.067444f, 0.073565f, 0.079682f, 0.085797f, 0.091909f,
- 0.098017f, 0.104122f, 0.110222f, 0.116319f, 0.122411f, 0.128498f, 0.134581f, 0.140658f,
- 0.146730f, 0.152797f, 0.158858f, 0.164913f, 0.170962f, 0.177004f, 0.183040f, 0.189069f,
- 0.195090f, 0.201105f, 0.207111f, 0.213110f, 0.219101f, 0.225084f, 0.231058f, 0.237024f,
- 0.242980f, 0.248928f, 0.254866f, 0.260794f, 0.266713f, 0.272621f, 0.278520f, 0.284408f,
- 0.290285f, 0.296151f, 0.302006f, 0.307850f, 0.313682f, 0.319502f, 0.325310f, 0.331106f,
- 0.336890f, 0.342661f, 0.348419f, 0.354164f, 0.359895f, 0.365613f, 0.371317f, 0.377007f,
- 0.382683f, 0.388345f, 0.393992f, 0.399624f, 0.405241f, 0.410843f, 0.416430f, 0.422000f,
- 0.427555f, 0.433094f, 0.438616f, 0.444122f, 0.449611f, 0.455084f, 0.460539f, 0.465977f,
- 0.471397f, 0.476799f, 0.482184f, 0.487550f, 0.492898f, 0.498228f, 0.503538f, 0.508830f,
- 0.514103f, 0.519356f, 0.524590f, 0.529804f, 0.534998f, 0.540171f, 0.545325f, 0.550458f,
- 0.555570f, 0.560662f, 0.565732f, 0.570781f, 0.575808f, 0.580814f, 0.585798f, 0.590760f,
- 0.595699f, 0.600616f, 0.605511f, 0.610383f, 0.615232f, 0.620057f, 0.624860f, 0.629638f,
- 0.634393f, 0.639124f, 0.643832f, 0.648514f, 0.653173f, 0.657807f, 0.662416f, 0.667000f,
- 0.671559f, 0.676093f, 0.680601f, 0.685084f, 0.689541f, 0.693971f, 0.698376f, 0.702755f,
- 0.707107f, 0.711432f, 0.715731f, 0.720003f, 0.724247f, 0.728464f, 0.732654f, 0.736817f,
- 0.740951f, 0.745058f, 0.749136f, 0.753187f, 0.757209f, 0.761202f, 0.765167f, 0.769103f,
- 0.773010f, 0.776888f, 0.780737f, 0.784557f, 0.788346f, 0.792107f, 0.795837f, 0.799537f,
- 0.803208f, 0.806848f, 0.810457f, 0.814036f, 0.817585f, 0.821102f, 0.824589f, 0.828045f,
- 0.831470f, 0.834863f, 0.838225f, 0.841555f, 0.844854f, 0.848120f, 0.851355f, 0.854558f,
- 0.857729f, 0.860867f, 0.863973f, 0.867046f, 0.870087f, 0.873095f, 0.876070f, 0.879012f,
- 0.881921f, 0.884797f, 0.887640f, 0.890449f, 0.893224f, 0.895966f, 0.898674f, 0.901349f,
- 0.903989f, 0.906596f, 0.909168f, 0.911706f, 0.914210f, 0.916679f, 0.919114f, 0.921514f,
- 0.923880f, 0.926210f, 0.928506f, 0.930767f, 0.932993f, 0.935184f, 0.937339f, 0.939459f,
- 0.941544f, 0.943593f, 0.945607f, 0.947586f, 0.949528f, 0.951435f, 0.953306f, 0.955141f,
- 0.956940f, 0.958703f, 0.960431f, 0.962121f, 0.963776f, 0.965394f, 0.966976f, 0.968522f,
- 0.970031f, 0.971504f, 0.972940f, 0.974339f, 0.975702f, 0.977028f, 0.978317f, 0.979570f,
- 0.980785f, 0.981964f, 0.983105f, 0.984210f, 0.985278f, 0.986308f, 0.987301f, 0.988258f,
- 0.989177f, 0.990058f, 0.990903f, 0.991710f, 0.992480f, 0.993212f, 0.993907f, 0.994565f,
- 0.995185f, 0.995767f, 0.996313f, 0.996820f, 0.997290f, 0.997723f, 0.998118f, 0.998476f,
- 0.998795f, 0.999078f, 0.999322f, 0.999529f, 0.999699f, 0.999831f, 0.999925f, 0.999981f
-};
-
-static const float cosTable2048[1024] = {
- 1.000000f, 0.999995f, 0.999981f, 0.999958f, 0.999925f, 0.999882f, 0.999831f, 0.999769f,
- 0.999699f, 0.999619f, 0.999529f, 0.999431f, 0.999322f, 0.999205f, 0.999078f, 0.998941f,
- 0.998795f, 0.998640f, 0.998476f, 0.998302f, 0.998118f, 0.997925f, 0.997723f, 0.997511f,
- 0.997290f, 0.997060f, 0.996820f, 0.996571f, 0.996313f, 0.996045f, 0.995767f, 0.995481f,
- 0.995185f, 0.994879f, 0.994565f, 0.994240f, 0.993907f, 0.993564f, 0.993212f, 0.992850f,
- 0.992480f, 0.992099f, 0.991710f, 0.991311f, 0.990903f, 0.990485f, 0.990058f, 0.989622f,
- 0.989177f, 0.988722f, 0.988258f, 0.987784f, 0.987301f, 0.986809f, 0.986308f, 0.985798f,
- 0.985278f, 0.984748f, 0.984210f, 0.983662f, 0.983105f, 0.982539f, 0.981964f, 0.981379f,
- 0.980785f, 0.980182f, 0.979570f, 0.978948f, 0.978317f, 0.977677f, 0.977028f, 0.976370f,
- 0.975702f, 0.975025f, 0.974339f, 0.973644f, 0.972940f, 0.972227f, 0.971504f, 0.970772f,
- 0.970031f, 0.969281f, 0.968522f, 0.967754f, 0.966976f, 0.966190f, 0.965394f, 0.964590f,
- 0.963776f, 0.962953f, 0.962121f, 0.961280f, 0.960431f, 0.959572f, 0.958703f, 0.957826f,
- 0.956940f, 0.956045f, 0.955141f, 0.954228f, 0.953306f, 0.952375f, 0.951435f, 0.950486f,
- 0.949528f, 0.948561f, 0.947586f, 0.946601f, 0.945607f, 0.944605f, 0.943593f, 0.942573f,
- 0.941544f, 0.940506f, 0.939459f, 0.938404f, 0.937339f, 0.936266f, 0.935184f, 0.934093f,
- 0.932993f, 0.931884f, 0.930767f, 0.929641f, 0.928506f, 0.927363f, 0.926210f, 0.925049f,
- 0.923880f, 0.922701f, 0.921514f, 0.920318f, 0.919114f, 0.917901f, 0.916679f, 0.915449f,
- 0.914210f, 0.912962f, 0.911706f, 0.910441f, 0.909168f, 0.907886f, 0.906596f, 0.905297f,
- 0.903989f, 0.902673f, 0.901349f, 0.900016f, 0.898674f, 0.897325f, 0.895966f, 0.894599f,
- 0.893224f, 0.891841f, 0.890449f, 0.889048f, 0.887640f, 0.886223f, 0.884797f, 0.883363f,
- 0.881921f, 0.880471f, 0.879012f, 0.877545f, 0.876070f, 0.874587f, 0.873095f, 0.871595f,
- 0.870087f, 0.868571f, 0.867046f, 0.865514f, 0.863973f, 0.862424f, 0.860867f, 0.859302f,
- 0.857729f, 0.856147f, 0.854558f, 0.852961f, 0.851355f, 0.849742f, 0.848120f, 0.846491f,
- 0.844854f, 0.843208f, 0.841555f, 0.839894f, 0.838225f, 0.836548f, 0.834863f, 0.833170f,
- 0.831470f, 0.829761f, 0.828045f, 0.826321f, 0.824589f, 0.822850f, 0.821102f, 0.819348f,
- 0.817585f, 0.815814f, 0.814036f, 0.812251f, 0.810457f, 0.808656f, 0.806848f, 0.805031f,
- 0.803208f, 0.801376f, 0.799537f, 0.797691f, 0.795837f, 0.793975f, 0.792107f, 0.790230f,
- 0.788346f, 0.786455f, 0.784557f, 0.782651f, 0.780737f, 0.778817f, 0.776888f, 0.774953f,
- 0.773010f, 0.771061f, 0.769103f, 0.767139f, 0.765167f, 0.763188f, 0.761202f, 0.759209f,
- 0.757209f, 0.755201f, 0.753187f, 0.751165f, 0.749136f, 0.747101f, 0.745058f, 0.743008f,
- 0.740951f, 0.738887f, 0.736817f, 0.734739f, 0.732654f, 0.730563f, 0.728464f, 0.726359f,
- 0.724247f, 0.722128f, 0.720003f, 0.717870f, 0.715731f, 0.713585f, 0.711432f, 0.709273f,
- 0.707107f, 0.704934f, 0.702755f, 0.700569f, 0.698376f, 0.696177f, 0.693971f, 0.691759f,
- 0.689541f, 0.687315f, 0.685084f, 0.682846f, 0.680601f, 0.678350f, 0.676093f, 0.673829f,
- 0.671559f, 0.669283f, 0.667000f, 0.664711f, 0.662416f, 0.660114f, 0.657807f, 0.655493f,
- 0.653173f, 0.650847f, 0.648514f, 0.646176f, 0.643832f, 0.641481f, 0.639124f, 0.636762f,
- 0.634393f, 0.632019f, 0.629638f, 0.627252f, 0.624860f, 0.622461f, 0.620057f, 0.617647f,
- 0.615232f, 0.612810f, 0.610383f, 0.607950f, 0.605511f, 0.603067f, 0.600616f, 0.598161f,
- 0.595699f, 0.593232f, 0.590760f, 0.588282f, 0.585798f, 0.583309f, 0.580814f, 0.578314f,
- 0.575808f, 0.573297f, 0.570781f, 0.568259f, 0.565732f, 0.563199f, 0.560662f, 0.558119f,
- 0.555570f, 0.553017f, 0.550458f, 0.547894f, 0.545325f, 0.542751f, 0.540171f, 0.537587f,
- 0.534998f, 0.532403f, 0.529804f, 0.527199f, 0.524590f, 0.521975f, 0.519356f, 0.516732f,
- 0.514103f, 0.511469f, 0.508830f, 0.506187f, 0.503538f, 0.500885f, 0.498228f, 0.495565f,
- 0.492898f, 0.490226f, 0.487550f, 0.484869f, 0.482184f, 0.479494f, 0.476799f, 0.474100f,
- 0.471397f, 0.468689f, 0.465977f, 0.463260f, 0.460539f, 0.457813f, 0.455084f, 0.452350f,
- 0.449611f, 0.446869f, 0.444122f, 0.441371f, 0.438616f, 0.435857f, 0.433094f, 0.430326f,
- 0.427555f, 0.424780f, 0.422000f, 0.419217f, 0.416430f, 0.413638f, 0.410843f, 0.408044f,
- 0.405241f, 0.402435f, 0.399624f, 0.396810f, 0.393992f, 0.391170f, 0.388345f, 0.385516f,
- 0.382683f, 0.379847f, 0.377007f, 0.374164f, 0.371317f, 0.368467f, 0.365613f, 0.362756f,
- 0.359895f, 0.357031f, 0.354164f, 0.351293f, 0.348419f, 0.345541f, 0.342661f, 0.339777f,
- 0.336890f, 0.334000f, 0.331106f, 0.328210f, 0.325310f, 0.322408f, 0.319502f, 0.316593f,
- 0.313682f, 0.310767f, 0.307850f, 0.304929f, 0.302006f, 0.299080f, 0.296151f, 0.293219f,
- 0.290285f, 0.287347f, 0.284408f, 0.281465f, 0.278520f, 0.275572f, 0.272621f, 0.269668f,
- 0.266713f, 0.263755f, 0.260794f, 0.257831f, 0.254866f, 0.251898f, 0.248928f, 0.245955f,
- 0.242980f, 0.240003f, 0.237024f, 0.234042f, 0.231058f, 0.228072f, 0.225084f, 0.222094f,
- 0.219101f, 0.216107f, 0.213110f, 0.210112f, 0.207111f, 0.204109f, 0.201105f, 0.198098f,
- 0.195090f, 0.192080f, 0.189069f, 0.186055f, 0.183040f, 0.180023f, 0.177004f, 0.173984f,
- 0.170962f, 0.167938f, 0.164913f, 0.161886f, 0.158858f, 0.155828f, 0.152797f, 0.149765f,
- 0.146730f, 0.143695f, 0.140658f, 0.137620f, 0.134581f, 0.131540f, 0.128498f, 0.125455f,
- 0.122411f, 0.119365f, 0.116319f, 0.113271f, 0.110222f, 0.107172f, 0.104122f, 0.101070f,
- 0.098017f, 0.094963f, 0.091909f, 0.088854f, 0.085797f, 0.082740f, 0.079682f, 0.076624f,
- 0.073565f, 0.070505f, 0.067444f, 0.064383f, 0.061321f, 0.058258f, 0.055195f, 0.052132f,
- 0.049068f, 0.046003f, 0.042938f, 0.039873f, 0.036807f, 0.033741f, 0.030675f, 0.027608f,
- 0.024541f, 0.021474f, 0.018407f, 0.015339f, 0.012272f, 0.009204f, 0.006136f, 0.003068f,
- 0.000000f, 0.003068f, 0.006136f, 0.009204f, 0.012272f, 0.015339f, 0.018407f, 0.021474f,
- 0.024541f, 0.027608f, 0.030675f, 0.033741f, 0.036807f, 0.039873f, 0.042938f, 0.046003f,
- 0.049068f, 0.052132f, 0.055195f, 0.058258f, 0.061321f, 0.064383f, 0.067444f, 0.070505f,
- 0.073565f, 0.076624f, 0.079682f, 0.082740f, 0.085797f, 0.088854f, 0.091909f, 0.094963f,
- 0.098017f, 0.101070f, 0.104122f, 0.107172f, 0.110222f, 0.113271f, 0.116319f, 0.119365f,
- 0.122411f, 0.125455f, 0.128498f, 0.131540f, 0.134581f, 0.137620f, 0.140658f, 0.143695f,
- 0.146730f, 0.149765f, 0.152797f, 0.155828f, 0.158858f, 0.161886f, 0.164913f, 0.167938f,
- 0.170962f, 0.173984f, 0.177004f, 0.180023f, 0.183040f, 0.186055f, 0.189069f, 0.192080f,
- 0.195090f, 0.198098f, 0.201105f, 0.204109f, 0.207111f, 0.210112f, 0.213110f, 0.216107f,
- 0.219101f, 0.222094f, 0.225084f, 0.228072f, 0.231058f, 0.234042f, 0.237024f, 0.240003f,
- 0.242980f, 0.245955f, 0.248928f, 0.251898f, 0.254866f, 0.257831f, 0.260794f, 0.263755f,
- 0.266713f, 0.269668f, 0.272621f, 0.275572f, 0.278520f, 0.281465f, 0.284408f, 0.287347f,
- 0.290285f, 0.293219f, 0.296151f, 0.299080f, 0.302006f, 0.304929f, 0.307850f, 0.310767f,
- 0.313682f, 0.316593f, 0.319502f, 0.322408f, 0.325310f, 0.328210f, 0.331106f, 0.334000f,
- 0.336890f, 0.339777f, 0.342661f, 0.345541f, 0.348419f, 0.351293f, 0.354164f, 0.357031f,
- 0.359895f, 0.362756f, 0.365613f, 0.368467f, 0.371317f, 0.374164f, 0.377007f, 0.379847f,
- 0.382683f, 0.385516f, 0.388345f, 0.391170f, 0.393992f, 0.396810f, 0.399624f, 0.402435f,
- 0.405241f, 0.408044f, 0.410843f, 0.413638f, 0.416430f, 0.419217f, 0.422000f, 0.424780f,
- 0.427555f, 0.430326f, 0.433094f, 0.435857f, 0.438616f, 0.441371f, 0.444122f, 0.446869f,
- 0.449611f, 0.452350f, 0.455084f, 0.457813f, 0.460539f, 0.463260f, 0.465977f, 0.468689f,
- 0.471397f, 0.474100f, 0.476799f, 0.479494f, 0.482184f, 0.484869f, 0.487550f, 0.490226f,
- 0.492898f, 0.495565f, 0.498228f, 0.500885f, 0.503538f, 0.506187f, 0.508830f, 0.511469f,
- 0.514103f, 0.516732f, 0.519356f, 0.521975f, 0.524590f, 0.527199f, 0.529804f, 0.532403f,
- 0.534998f, 0.537587f, 0.540171f, 0.542751f, 0.545325f, 0.547894f, 0.550458f, 0.553017f,
- 0.555570f, 0.558119f, 0.560662f, 0.563199f, 0.565732f, 0.568259f, 0.570781f, 0.573297f,
- 0.575808f, 0.578314f, 0.580814f, 0.583309f, 0.585798f, 0.588282f, 0.590760f, 0.593232f,
- 0.595699f, 0.598161f, 0.600616f, 0.603067f, 0.605511f, 0.607950f, 0.610383f, 0.612810f,
- 0.615232f, 0.617647f, 0.620057f, 0.622461f, 0.624860f, 0.627252f, 0.629638f, 0.632019f,
- 0.634393f, 0.636762f, 0.639124f, 0.641481f, 0.643832f, 0.646176f, 0.648514f, 0.650847f,
- 0.653173f, 0.655493f, 0.657807f, 0.660114f, 0.662416f, 0.664711f, 0.667000f, 0.669283f,
- 0.671559f, 0.673829f, 0.676093f, 0.678350f, 0.680601f, 0.682846f, 0.685084f, 0.687315f,
- 0.689541f, 0.691759f, 0.693971f, 0.696177f, 0.698376f, 0.700569f, 0.702755f, 0.704934f,
- 0.707107f, 0.709273f, 0.711432f, 0.713585f, 0.715731f, 0.717870f, 0.720003f, 0.722128f,
- 0.724247f, 0.726359f, 0.728464f, 0.730563f, 0.732654f, 0.734739f, 0.736817f, 0.738887f,
- 0.740951f, 0.743008f, 0.745058f, 0.747101f, 0.749136f, 0.751165f, 0.753187f, 0.755201f,
- 0.757209f, 0.759209f, 0.761202f, 0.763188f, 0.765167f, 0.767139f, 0.769103f, 0.771061f,
- 0.773010f, 0.774953f, 0.776888f, 0.778817f, 0.780737f, 0.782651f, 0.784557f, 0.786455f,
- 0.788346f, 0.790230f, 0.792107f, 0.793975f, 0.795837f, 0.797691f, 0.799537f, 0.801376f,
- 0.803208f, 0.805031f, 0.806848f, 0.808656f, 0.810457f, 0.812251f, 0.814036f, 0.815814f,
- 0.817585f, 0.819348f, 0.821102f, 0.822850f, 0.824589f, 0.826321f, 0.828045f, 0.829761f,
- 0.831470f, 0.833170f, 0.834863f, 0.836548f, 0.838225f, 0.839894f, 0.841555f, 0.843208f,
- 0.844854f, 0.846491f, 0.848120f, 0.849742f, 0.851355f, 0.852961f, 0.854558f, 0.856147f,
- 0.857729f, 0.859302f, 0.860867f, 0.862424f, 0.863973f, 0.865514f, 0.867046f, 0.868571f,
- 0.870087f, 0.871595f, 0.873095f, 0.874587f, 0.876070f, 0.877545f, 0.879012f, 0.880471f,
- 0.881921f, 0.883363f, 0.884797f, 0.886223f, 0.887640f, 0.889048f, 0.890449f, 0.891841f,
- 0.893224f, 0.894599f, 0.895966f, 0.897325f, 0.898674f, 0.900016f, 0.901349f, 0.902673f,
- 0.903989f, 0.905297f, 0.906596f, 0.907886f, 0.909168f, 0.910441f, 0.911706f, 0.912962f,
- 0.914210f, 0.915449f, 0.916679f, 0.917901f, 0.919114f, 0.920318f, 0.921514f, 0.922701f,
- 0.923880f, 0.925049f, 0.926210f, 0.927363f, 0.928506f, 0.929641f, 0.930767f, 0.931884f,
- 0.932993f, 0.934093f, 0.935184f, 0.936266f, 0.937339f, 0.938404f, 0.939459f, 0.940506f,
- 0.941544f, 0.942573f, 0.943593f, 0.944605f, 0.945607f, 0.946601f, 0.947586f, 0.948561f,
- 0.949528f, 0.950486f, 0.951435f, 0.952375f, 0.953306f, 0.954228f, 0.955141f, 0.956045f,
- 0.956940f, 0.957826f, 0.958703f, 0.959572f, 0.960431f, 0.961280f, 0.962121f, 0.962953f,
- 0.963776f, 0.964590f, 0.965394f, 0.966190f, 0.966976f, 0.967754f, 0.968522f, 0.969281f,
- 0.970031f, 0.970772f, 0.971504f, 0.972227f, 0.972940f, 0.973644f, 0.974339f, 0.975025f,
- 0.975702f, 0.976370f, 0.977028f, 0.977677f, 0.978317f, 0.978948f, 0.979570f, 0.980182f,
- 0.980785f, 0.981379f, 0.981964f, 0.982539f, 0.983105f, 0.983662f, 0.984210f, 0.984748f,
- 0.985278f, 0.985798f, 0.986308f, 0.986809f, 0.987301f, 0.987784f, 0.988258f, 0.988722f,
- 0.989177f, 0.989622f, 0.990058f, 0.990485f, 0.990903f, 0.991311f, 0.991710f, 0.992099f,
- 0.992480f, 0.992850f, 0.993212f, 0.993564f, 0.993907f, 0.994240f, 0.994565f, 0.994879f,
- 0.995185f, 0.995481f, 0.995767f, 0.996045f, 0.996313f, 0.996571f, 0.996820f, 0.997060f,
- 0.997290f, 0.997511f, 0.997723f, 0.997925f, 0.998118f, 0.998302f, 0.998476f, 0.998640f,
- 0.998795f, 0.998941f, 0.999078f, 0.999205f, 0.999322f, 0.999431f, 0.999529f, 0.999619f,
- 0.999699f, 0.999769f, 0.999831f, 0.999882f, 0.999925f, 0.999958f, 0.999981f, 0.999995f
-};
-
-static const float cosTable4096[2048] = {
- 1.000000f, 0.999999f, 0.999995f, 0.999989f, 0.999981f, 0.999971f, 0.999958f, 0.999942f,
- 0.999925f, 0.999905f, 0.999882f, 0.999858f, 0.999831f, 0.999801f, 0.999769f, 0.999735f,
- 0.999699f, 0.999660f, 0.999619f, 0.999575f, 0.999529f, 0.999481f, 0.999431f, 0.999378f,
- 0.999322f, 0.999265f, 0.999205f, 0.999142f, 0.999078f, 0.999011f, 0.998941f, 0.998870f,
- 0.998795f, 0.998719f, 0.998640f, 0.998559f, 0.998476f, 0.998390f, 0.998302f, 0.998211f,
- 0.998118f, 0.998023f, 0.997925f, 0.997825f, 0.997723f, 0.997618f, 0.997511f, 0.997402f,
- 0.997290f, 0.997176f, 0.997060f, 0.996941f, 0.996820f, 0.996697f, 0.996571f, 0.996443f,
- 0.996313f, 0.996180f, 0.996045f, 0.995907f, 0.995767f, 0.995625f, 0.995481f, 0.995334f,
- 0.995185f, 0.995033f, 0.994879f, 0.994723f, 0.994565f, 0.994404f, 0.994240f, 0.994075f,
- 0.993907f, 0.993737f, 0.993564f, 0.993389f, 0.993212f, 0.993032f, 0.992850f, 0.992666f,
- 0.992480f, 0.992291f, 0.992099f, 0.991906f, 0.991710f, 0.991511f, 0.991311f, 0.991108f,
- 0.990903f, 0.990695f, 0.990485f, 0.990273f, 0.990058f, 0.989841f, 0.989622f, 0.989400f,
- 0.989177f, 0.988950f, 0.988722f, 0.988491f, 0.988258f, 0.988022f, 0.987784f, 0.987544f,
- 0.987301f, 0.987057f, 0.986809f, 0.986560f, 0.986308f, 0.986054f, 0.985798f, 0.985539f,
- 0.985278f, 0.985014f, 0.984748f, 0.984480f, 0.984210f, 0.983937f, 0.983662f, 0.983385f,
- 0.983105f, 0.982824f, 0.982539f, 0.982253f, 0.981964f, 0.981673f, 0.981379f, 0.981083f,
- 0.980785f, 0.980485f, 0.980182f, 0.979877f, 0.979570f, 0.979260f, 0.978948f, 0.978634f,
- 0.978317f, 0.977998f, 0.977677f, 0.977354f, 0.977028f, 0.976700f, 0.976370f, 0.976037f,
- 0.975702f, 0.975365f, 0.975025f, 0.974684f, 0.974339f, 0.973993f, 0.973644f, 0.973293f,
- 0.972940f, 0.972584f, 0.972227f, 0.971866f, 0.971504f, 0.971139f, 0.970772f, 0.970403f,
- 0.970031f, 0.969657f, 0.969281f, 0.968903f, 0.968522f, 0.968139f, 0.967754f, 0.967366f,
- 0.966976f, 0.966584f, 0.966190f, 0.965793f, 0.965394f, 0.964993f, 0.964590f, 0.964184f,
- 0.963776f, 0.963366f, 0.962953f, 0.962538f, 0.962121f, 0.961702f, 0.961280f, 0.960857f,
- 0.960431f, 0.960002f, 0.959572f, 0.959139f, 0.958703f, 0.958266f, 0.957826f, 0.957385f,
- 0.956940f, 0.956494f, 0.956045f, 0.955594f, 0.955141f, 0.954686f, 0.954228f, 0.953768f,
- 0.953306f, 0.952842f, 0.952375f, 0.951906f, 0.951435f, 0.950962f, 0.950486f, 0.950008f,
- 0.949528f, 0.949046f, 0.948561f, 0.948075f, 0.947586f, 0.947094f, 0.946601f, 0.946105f,
- 0.945607f, 0.945107f, 0.944605f, 0.944100f, 0.943593f, 0.943084f, 0.942573f, 0.942060f,
- 0.941544f, 0.941026f, 0.940506f, 0.939984f, 0.939459f, 0.938932f, 0.938404f, 0.937872f,
- 0.937339f, 0.936803f, 0.936266f, 0.935726f, 0.935184f, 0.934639f, 0.934093f, 0.933544f,
- 0.932993f, 0.932440f, 0.931884f, 0.931327f, 0.930767f, 0.930205f, 0.929641f, 0.929075f,
- 0.928506f, 0.927935f, 0.927363f, 0.926787f, 0.926210f, 0.925631f, 0.925049f, 0.924465f,
- 0.923880f, 0.923291f, 0.922701f, 0.922109f, 0.921514f, 0.920917f, 0.920318f, 0.919717f,
- 0.919114f, 0.918508f, 0.917901f, 0.917291f, 0.916679f, 0.916065f, 0.915449f, 0.914830f,
- 0.914210f, 0.913587f, 0.912962f, 0.912335f, 0.911706f, 0.911075f, 0.910441f, 0.909806f,
- 0.909168f, 0.908528f, 0.907886f, 0.907242f, 0.906596f, 0.905947f, 0.905297f, 0.904644f,
- 0.903989f, 0.903332f, 0.902673f, 0.902012f, 0.901349f, 0.900683f, 0.900016f, 0.899346f,
- 0.898674f, 0.898001f, 0.897325f, 0.896646f, 0.895966f, 0.895284f, 0.894599f, 0.893913f,
- 0.893224f, 0.892534f, 0.891841f, 0.891146f, 0.890449f, 0.889750f, 0.889048f, 0.888345f,
- 0.887640f, 0.886932f, 0.886223f, 0.885511f, 0.884797f, 0.884081f, 0.883363f, 0.882643f,
- 0.881921f, 0.881197f, 0.880471f, 0.879743f, 0.879012f, 0.878280f, 0.877545f, 0.876809f,
- 0.876070f, 0.875329f, 0.874587f, 0.873842f, 0.873095f, 0.872346f, 0.871595f, 0.870842f,
- 0.870087f, 0.869330f, 0.868571f, 0.867809f, 0.867046f, 0.866281f, 0.865514f, 0.864744f,
- 0.863973f, 0.863199f, 0.862424f, 0.861646f, 0.860867f, 0.860085f, 0.859302f, 0.858516f,
- 0.857729f, 0.856939f, 0.856147f, 0.855354f, 0.854558f, 0.853760f, 0.852961f, 0.852159f,
- 0.851355f, 0.850549f, 0.849742f, 0.848932f, 0.848120f, 0.847307f, 0.846491f, 0.845673f,
- 0.844854f, 0.844032f, 0.843208f, 0.842383f, 0.841555f, 0.840725f, 0.839894f, 0.839060f,
- 0.838225f, 0.837387f, 0.836548f, 0.835706f, 0.834863f, 0.834018f, 0.833170f, 0.832321f,
- 0.831470f, 0.830616f, 0.829761f, 0.828904f, 0.828045f, 0.827184f, 0.826321f, 0.825456f,
- 0.824589f, 0.823721f, 0.822850f, 0.821977f, 0.821102f, 0.820226f, 0.819348f, 0.818467f,
- 0.817585f, 0.816701f, 0.815814f, 0.814926f, 0.814036f, 0.813144f, 0.812251f, 0.811355f,
- 0.810457f, 0.809558f, 0.808656f, 0.807753f, 0.806848f, 0.805940f, 0.805031f, 0.804120f,
- 0.803208f, 0.802293f, 0.801376f, 0.800458f, 0.799537f, 0.798615f, 0.797691f, 0.796765f,
- 0.795837f, 0.794907f, 0.793975f, 0.793042f, 0.792107f, 0.791169f, 0.790230f, 0.789289f,
- 0.788346f, 0.787402f, 0.786455f, 0.785507f, 0.784557f, 0.783605f, 0.782651f, 0.781695f,
- 0.780737f, 0.779778f, 0.778817f, 0.777853f, 0.776888f, 0.775922f, 0.774953f, 0.773983f,
- 0.773010f, 0.772036f, 0.771061f, 0.770083f, 0.769103f, 0.768122f, 0.767139f, 0.766154f,
- 0.765167f, 0.764179f, 0.763188f, 0.762196f, 0.761202f, 0.760207f, 0.759209f, 0.758210f,
- 0.757209f, 0.756206f, 0.755201f, 0.754195f, 0.753187f, 0.752177f, 0.751165f, 0.750152f,
- 0.749136f, 0.748119f, 0.747101f, 0.746080f, 0.745058f, 0.744034f, 0.743008f, 0.741980f,
- 0.740951f, 0.739920f, 0.738887f, 0.737853f, 0.736817f, 0.735779f, 0.734739f, 0.733697f,
- 0.732654f, 0.731609f, 0.730563f, 0.729514f, 0.728464f, 0.727413f, 0.726359f, 0.725304f,
- 0.724247f, 0.723188f, 0.722128f, 0.721066f, 0.720003f, 0.718937f, 0.717870f, 0.716801f,
- 0.715731f, 0.714659f, 0.713585f, 0.712509f, 0.711432f, 0.710353f, 0.709273f, 0.708191f,
- 0.707107f, 0.706021f, 0.704934f, 0.703845f, 0.702755f, 0.701663f, 0.700569f, 0.699473f,
- 0.698376f, 0.697277f, 0.696177f, 0.695075f, 0.693971f, 0.692866f, 0.691759f, 0.690651f,
- 0.689541f, 0.688429f, 0.687315f, 0.686200f, 0.685084f, 0.683965f, 0.682846f, 0.681724f,
- 0.680601f, 0.679476f, 0.678350f, 0.677222f, 0.676093f, 0.674962f, 0.673829f, 0.672695f,
- 0.671559f, 0.670422f, 0.669283f, 0.668142f, 0.667000f, 0.665856f, 0.664711f, 0.663564f,
- 0.662416f, 0.661266f, 0.660114f, 0.658961f, 0.657807f, 0.656651f, 0.655493f, 0.654334f,
- 0.653173f, 0.652011f, 0.650847f, 0.649681f, 0.648514f, 0.647346f, 0.646176f, 0.645005f,
- 0.643832f, 0.642657f, 0.641481f, 0.640303f, 0.639124f, 0.637944f, 0.636762f, 0.635578f,
- 0.634393f, 0.633207f, 0.632019f, 0.630829f, 0.629638f, 0.628446f, 0.627252f, 0.626056f,
- 0.624860f, 0.623661f, 0.622461f, 0.621260f, 0.620057f, 0.618853f, 0.617647f, 0.616440f,
- 0.615232f, 0.614022f, 0.612810f, 0.611597f, 0.610383f, 0.609167f, 0.607950f, 0.606731f,
- 0.605511f, 0.604290f, 0.603067f, 0.601842f, 0.600616f, 0.599389f, 0.598161f, 0.596931f,
- 0.595699f, 0.594467f, 0.593232f, 0.591997f, 0.590760f, 0.589521f, 0.588282f, 0.587040f,
- 0.585798f, 0.584554f, 0.583309f, 0.582062f, 0.580814f, 0.579565f, 0.578314f, 0.577062f,
- 0.575808f, 0.574553f, 0.573297f, 0.572040f, 0.570781f, 0.569521f, 0.568259f, 0.566996f,
- 0.565732f, 0.564466f, 0.563199f, 0.561931f, 0.560662f, 0.559391f, 0.558119f, 0.556845f,
- 0.555570f, 0.554294f, 0.553017f, 0.551738f, 0.550458f, 0.549177f, 0.547894f, 0.546610f,
- 0.545325f, 0.544039f, 0.542751f, 0.541462f, 0.540171f, 0.538880f, 0.537587f, 0.536293f,
- 0.534998f, 0.533701f, 0.532403f, 0.531104f, 0.529804f, 0.528502f, 0.527199f, 0.525895f,
- 0.524590f, 0.523283f, 0.521975f, 0.520666f, 0.519356f, 0.518045f, 0.516732f, 0.515418f,
- 0.514103f, 0.512786f, 0.511469f, 0.510150f, 0.508830f, 0.507509f, 0.506187f, 0.504863f,
- 0.503538f, 0.502212f, 0.500885f, 0.499557f, 0.498228f, 0.496897f, 0.495565f, 0.494232f,
- 0.492898f, 0.491563f, 0.490226f, 0.488889f, 0.487550f, 0.486210f, 0.484869f, 0.483527f,
- 0.482184f, 0.480839f, 0.479494f, 0.478147f, 0.476799f, 0.475450f, 0.474100f, 0.472749f,
- 0.471397f, 0.470043f, 0.468689f, 0.467333f, 0.465977f, 0.464619f, 0.463260f, 0.461900f,
- 0.460539f, 0.459177f, 0.457813f, 0.456449f, 0.455084f, 0.453717f, 0.452350f, 0.450981f,
- 0.449611f, 0.448241f, 0.446869f, 0.445496f, 0.444122f, 0.442747f, 0.441371f, 0.439994f,
- 0.438616f, 0.437237f, 0.435857f, 0.434476f, 0.433094f, 0.431711f, 0.430326f, 0.428941f,
- 0.427555f, 0.426168f, 0.424780f, 0.423390f, 0.422000f, 0.420609f, 0.419217f, 0.417824f,
- 0.416430f, 0.415034f, 0.413638f, 0.412241f, 0.410843f, 0.409444f, 0.408044f, 0.406643f,
- 0.405241f, 0.403838f, 0.402435f, 0.401030f, 0.399624f, 0.398218f, 0.396810f, 0.395401f,
- 0.393992f, 0.392582f, 0.391170f, 0.389758f, 0.388345f, 0.386931f, 0.385516f, 0.384100f,
- 0.382683f, 0.381266f, 0.379847f, 0.378428f, 0.377007f, 0.375586f, 0.374164f, 0.372741f,
- 0.371317f, 0.369892f, 0.368467f, 0.367040f, 0.365613f, 0.364185f, 0.362756f, 0.361326f,
- 0.359895f, 0.358463f, 0.357031f, 0.355598f, 0.354164f, 0.352729f, 0.351293f, 0.349856f,
- 0.348419f, 0.346980f, 0.345541f, 0.344101f, 0.342661f, 0.341219f, 0.339777f, 0.338334f,
- 0.336890f, 0.335445f, 0.334000f, 0.332553f, 0.331106f, 0.329658f, 0.328210f, 0.326760f,
- 0.325310f, 0.323859f, 0.322408f, 0.320955f, 0.319502f, 0.318048f, 0.316593f, 0.315138f,
- 0.313682f, 0.312225f, 0.310767f, 0.309309f, 0.307850f, 0.306390f, 0.304929f, 0.303468f,
- 0.302006f, 0.300543f, 0.299080f, 0.297616f, 0.296151f, 0.294685f, 0.293219f, 0.291752f,
- 0.290285f, 0.288816f, 0.287347f, 0.285878f, 0.284408f, 0.282937f, 0.281465f, 0.279993f,
- 0.278520f, 0.277046f, 0.275572f, 0.274097f, 0.272621f, 0.271145f, 0.269668f, 0.268191f,
- 0.266713f, 0.265234f, 0.263755f, 0.262275f, 0.260794f, 0.259313f, 0.257831f, 0.256349f,
- 0.254866f, 0.253382f, 0.251898f, 0.250413f, 0.248928f, 0.247442f, 0.245955f, 0.244468f,
- 0.242980f, 0.241492f, 0.240003f, 0.238514f, 0.237024f, 0.235533f, 0.234042f, 0.232550f,
- 0.231058f, 0.229565f, 0.228072f, 0.226578f, 0.225084f, 0.223589f, 0.222094f, 0.220598f,
- 0.219101f, 0.217604f, 0.216107f, 0.214609f, 0.213110f, 0.211611f, 0.210112f, 0.208612f,
- 0.207111f, 0.205610f, 0.204109f, 0.202607f, 0.201105f, 0.199602f, 0.198098f, 0.196595f,
- 0.195090f, 0.193586f, 0.192080f, 0.190575f, 0.189069f, 0.187562f, 0.186055f, 0.184548f,
- 0.183040f, 0.181532f, 0.180023f, 0.178514f, 0.177004f, 0.175494f, 0.173984f, 0.172473f,
- 0.170962f, 0.169450f, 0.167938f, 0.166426f, 0.164913f, 0.163400f, 0.161886f, 0.160372f,
- 0.158858f, 0.157343f, 0.155828f, 0.154313f, 0.152797f, 0.151281f, 0.149765f, 0.148248f,
- 0.146730f, 0.145213f, 0.143695f, 0.142177f, 0.140658f, 0.139139f, 0.137620f, 0.136101f,
- 0.134581f, 0.133061f, 0.131540f, 0.130019f, 0.128498f, 0.126977f, 0.125455f, 0.123933f,
- 0.122411f, 0.120888f, 0.119365f, 0.117842f, 0.116319f, 0.114795f, 0.113271f, 0.111747f,
- 0.110222f, 0.108697f, 0.107172f, 0.105647f, 0.104122f, 0.102596f, 0.101070f, 0.099544f,
- 0.098017f, 0.096490f, 0.094963f, 0.093436f, 0.091909f, 0.090381f, 0.088854f, 0.087326f,
- 0.085797f, 0.084269f, 0.082740f, 0.081211f, 0.079682f, 0.078153f, 0.076624f, 0.075094f,
- 0.073565f, 0.072035f, 0.070505f, 0.068974f, 0.067444f, 0.065913f, 0.064383f, 0.062852f,
- 0.061321f, 0.059790f, 0.058258f, 0.056727f, 0.055195f, 0.053664f, 0.052132f, 0.050600f,
- 0.049068f, 0.047535f, 0.046003f, 0.044471f, 0.042938f, 0.041406f, 0.039873f, 0.038340f,
- 0.036807f, 0.035274f, 0.033741f, 0.032208f, 0.030675f, 0.029142f, 0.027608f, 0.026075f,
- 0.024541f, 0.023008f, 0.021474f, 0.019940f, 0.018407f, 0.016873f, 0.015339f, 0.013805f,
- 0.012272f, 0.010738f, 0.009204f, 0.007670f, 0.006136f, 0.004602f, 0.003068f, 0.001534f,
- 0.000000f, 0.001534f, 0.003068f, 0.004602f, 0.006136f, 0.007670f, 0.009204f, 0.010738f,
- 0.012272f, 0.013805f, 0.015339f, 0.016873f, 0.018407f, 0.019940f, 0.021474f, 0.023008f,
- 0.024541f, 0.026075f, 0.027608f, 0.029142f, 0.030675f, 0.032208f, 0.033741f, 0.035274f,
- 0.036807f, 0.038340f, 0.039873f, 0.041406f, 0.042938f, 0.044471f, 0.046003f, 0.047535f,
- 0.049068f, 0.050600f, 0.052132f, 0.053664f, 0.055195f, 0.056727f, 0.058258f, 0.059790f,
- 0.061321f, 0.062852f, 0.064383f, 0.065913f, 0.067444f, 0.068974f, 0.070505f, 0.072035f,
- 0.073565f, 0.075094f, 0.076624f, 0.078153f, 0.079682f, 0.081211f, 0.082740f, 0.084269f,
- 0.085797f, 0.087326f, 0.088854f, 0.090381f, 0.091909f, 0.093436f, 0.094963f, 0.096490f,
- 0.098017f, 0.099544f, 0.101070f, 0.102596f, 0.104122f, 0.105647f, 0.107172f, 0.108697f,
- 0.110222f, 0.111747f, 0.113271f, 0.114795f, 0.116319f, 0.117842f, 0.119365f, 0.120888f,
- 0.122411f, 0.123933f, 0.125455f, 0.126977f, 0.128498f, 0.130019f, 0.131540f, 0.133061f,
- 0.134581f, 0.136101f, 0.137620f, 0.139139f, 0.140658f, 0.142177f, 0.143695f, 0.145213f,
- 0.146730f, 0.148248f, 0.149765f, 0.151281f, 0.152797f, 0.154313f, 0.155828f, 0.157343f,
- 0.158858f, 0.160372f, 0.161886f, 0.163400f, 0.164913f, 0.166426f, 0.167938f, 0.169450f,
- 0.170962f, 0.172473f, 0.173984f, 0.175494f, 0.177004f, 0.178514f, 0.180023f, 0.181532f,
- 0.183040f, 0.184548f, 0.186055f, 0.187562f, 0.189069f, 0.190575f, 0.192080f, 0.193586f,
- 0.195090f, 0.196595f, 0.198098f, 0.199602f, 0.201105f, 0.202607f, 0.204109f, 0.205610f,
- 0.207111f, 0.208612f, 0.210112f, 0.211611f, 0.213110f, 0.214609f, 0.216107f, 0.217604f,
- 0.219101f, 0.220598f, 0.222094f, 0.223589f, 0.225084f, 0.226578f, 0.228072f, 0.229565f,
- 0.231058f, 0.232550f, 0.234042f, 0.235533f, 0.237024f, 0.238514f, 0.240003f, 0.241492f,
- 0.242980f, 0.244468f, 0.245955f, 0.247442f, 0.248928f, 0.250413f, 0.251898f, 0.253382f,
- 0.254866f, 0.256349f, 0.257831f, 0.259313f, 0.260794f, 0.262275f, 0.263755f, 0.265234f,
- 0.266713f, 0.268191f, 0.269668f, 0.271145f, 0.272621f, 0.274097f, 0.275572f, 0.277046f,
- 0.278520f, 0.279993f, 0.281465f, 0.282937f, 0.284408f, 0.285878f, 0.287347f, 0.288816f,
- 0.290285f, 0.291752f, 0.293219f, 0.294685f, 0.296151f, 0.297616f, 0.299080f, 0.300543f,
- 0.302006f, 0.303468f, 0.304929f, 0.306390f, 0.307850f, 0.309309f, 0.310767f, 0.312225f,
- 0.313682f, 0.315138f, 0.316593f, 0.318048f, 0.319502f, 0.320955f, 0.322408f, 0.323859f,
- 0.325310f, 0.326760f, 0.328210f, 0.329658f, 0.331106f, 0.332553f, 0.334000f, 0.335445f,
- 0.336890f, 0.338334f, 0.339777f, 0.341219f, 0.342661f, 0.344101f, 0.345541f, 0.346980f,
- 0.348419f, 0.349856f, 0.351293f, 0.352729f, 0.354164f, 0.355598f, 0.357031f, 0.358463f,
- 0.359895f, 0.361326f, 0.362756f, 0.364185f, 0.365613f, 0.367040f, 0.368467f, 0.369892f,
- 0.371317f, 0.372741f, 0.374164f, 0.375586f, 0.377007f, 0.378428f, 0.379847f, 0.381266f,
- 0.382683f, 0.384100f, 0.385516f, 0.386931f, 0.388345f, 0.389758f, 0.391170f, 0.392582f,
- 0.393992f, 0.395401f, 0.396810f, 0.398218f, 0.399624f, 0.401030f, 0.402435f, 0.403838f,
- 0.405241f, 0.406643f, 0.408044f, 0.409444f, 0.410843f, 0.412241f, 0.413638f, 0.415034f,
- 0.416430f, 0.417824f, 0.419217f, 0.420609f, 0.422000f, 0.423390f, 0.424780f, 0.426168f,
- 0.427555f, 0.428941f, 0.430326f, 0.431711f, 0.433094f, 0.434476f, 0.435857f, 0.437237f,
- 0.438616f, 0.439994f, 0.441371f, 0.442747f, 0.444122f, 0.445496f, 0.446869f, 0.448241f,
- 0.449611f, 0.450981f, 0.452350f, 0.453717f, 0.455084f, 0.456449f, 0.457813f, 0.459177f,
- 0.460539f, 0.461900f, 0.463260f, 0.464619f, 0.465977f, 0.467333f, 0.468689f, 0.470043f,
- 0.471397f, 0.472749f, 0.474100f, 0.475450f, 0.476799f, 0.478147f, 0.479494f, 0.480839f,
- 0.482184f, 0.483527f, 0.484869f, 0.486210f, 0.487550f, 0.488889f, 0.490226f, 0.491563f,
- 0.492898f, 0.494232f, 0.495565f, 0.496897f, 0.498228f, 0.499557f, 0.500885f, 0.502212f,
- 0.503538f, 0.504863f, 0.506187f, 0.507509f, 0.508830f, 0.510150f, 0.511469f, 0.512786f,
- 0.514103f, 0.515418f, 0.516732f, 0.518045f, 0.519356f, 0.520666f, 0.521975f, 0.523283f,
- 0.524590f, 0.525895f, 0.527199f, 0.528502f, 0.529804f, 0.531104f, 0.532403f, 0.533701f,
- 0.534998f, 0.536293f, 0.537587f, 0.538880f, 0.540171f, 0.541462f, 0.542751f, 0.544039f,
- 0.545325f, 0.546610f, 0.547894f, 0.549177f, 0.550458f, 0.551738f, 0.553017f, 0.554294f,
- 0.555570f, 0.556845f, 0.558119f, 0.559391f, 0.560662f, 0.561931f, 0.563199f, 0.564466f,
- 0.565732f, 0.566996f, 0.568259f, 0.569521f, 0.570781f, 0.572040f, 0.573297f, 0.574553f,
- 0.575808f, 0.577062f, 0.578314f, 0.579565f, 0.580814f, 0.582062f, 0.583309f, 0.584554f,
- 0.585798f, 0.587040f, 0.588282f, 0.589521f, 0.590760f, 0.591997f, 0.593232f, 0.594467f,
- 0.595699f, 0.596931f, 0.598161f, 0.599389f, 0.600616f, 0.601842f, 0.603067f, 0.604290f,
- 0.605511f, 0.606731f, 0.607950f, 0.609167f, 0.610383f, 0.611597f, 0.612810f, 0.614022f,
- 0.615232f, 0.616440f, 0.617647f, 0.618853f, 0.620057f, 0.621260f, 0.622461f, 0.623661f,
- 0.624860f, 0.626056f, 0.627252f, 0.628446f, 0.629638f, 0.630829f, 0.632019f, 0.633207f,
- 0.634393f, 0.635578f, 0.636762f, 0.637944f, 0.639124f, 0.640303f, 0.641481f, 0.642657f,
- 0.643832f, 0.645005f, 0.646176f, 0.647346f, 0.648514f, 0.649681f, 0.650847f, 0.652011f,
- 0.653173f, 0.654334f, 0.655493f, 0.656651f, 0.657807f, 0.658961f, 0.660114f, 0.661266f,
- 0.662416f, 0.663564f, 0.664711f, 0.665856f, 0.667000f, 0.668142f, 0.669283f, 0.670422f,
- 0.671559f, 0.672695f, 0.673829f, 0.674962f, 0.676093f, 0.677222f, 0.678350f, 0.679476f,
- 0.680601f, 0.681724f, 0.682846f, 0.683965f, 0.685084f, 0.686200f, 0.687315f, 0.688429f,
- 0.689541f, 0.690651f, 0.691759f, 0.692866f, 0.693971f, 0.695075f, 0.696177f, 0.697277f,
- 0.698376f, 0.699473f, 0.700569f, 0.701663f, 0.702755f, 0.703845f, 0.704934f, 0.706021f,
- 0.707107f, 0.708191f, 0.709273f, 0.710353f, 0.711432f, 0.712509f, 0.713585f, 0.714659f,
- 0.715731f, 0.716801f, 0.717870f, 0.718937f, 0.720003f, 0.721066f, 0.722128f, 0.723188f,
- 0.724247f, 0.725304f, 0.726359f, 0.727413f, 0.728464f, 0.729514f, 0.730563f, 0.731609f,
- 0.732654f, 0.733697f, 0.734739f, 0.735779f, 0.736817f, 0.737853f, 0.738887f, 0.739920f,
- 0.740951f, 0.741980f, 0.743008f, 0.744034f, 0.745058f, 0.746080f, 0.747101f, 0.748119f,
- 0.749136f, 0.750152f, 0.751165f, 0.752177f, 0.753187f, 0.754195f, 0.755201f, 0.756206f,
- 0.757209f, 0.758210f, 0.759209f, 0.760207f, 0.761202f, 0.762196f, 0.763188f, 0.764179f,
- 0.765167f, 0.766154f, 0.767139f, 0.768122f, 0.769103f, 0.770083f, 0.771061f, 0.772036f,
- 0.773010f, 0.773983f, 0.774953f, 0.775922f, 0.776888f, 0.777853f, 0.778817f, 0.779778f,
- 0.780737f, 0.781695f, 0.782651f, 0.783605f, 0.784557f, 0.785507f, 0.786455f, 0.787402f,
- 0.788346f, 0.789289f, 0.790230f, 0.791169f, 0.792107f, 0.793042f, 0.793975f, 0.794907f,
- 0.795837f, 0.796765f, 0.797691f, 0.798615f, 0.799537f, 0.800458f, 0.801376f, 0.802293f,
- 0.803208f, 0.804120f, 0.805031f, 0.805940f, 0.806848f, 0.807753f, 0.808656f, 0.809558f,
- 0.810457f, 0.811355f, 0.812251f, 0.813144f, 0.814036f, 0.814926f, 0.815814f, 0.816701f,
- 0.817585f, 0.818467f, 0.819348f, 0.820226f, 0.821102f, 0.821977f, 0.822850f, 0.823721f,
- 0.824589f, 0.825456f, 0.826321f, 0.827184f, 0.828045f, 0.828904f, 0.829761f, 0.830616f,
- 0.831470f, 0.832321f, 0.833170f, 0.834018f, 0.834863f, 0.835706f, 0.836548f, 0.837387f,
- 0.838225f, 0.839060f, 0.839894f, 0.840725f, 0.841555f, 0.842383f, 0.843208f, 0.844032f,
- 0.844854f, 0.845673f, 0.846491f, 0.847307f, 0.848120f, 0.848932f, 0.849742f, 0.850549f,
- 0.851355f, 0.852159f, 0.852961f, 0.853760f, 0.854558f, 0.855354f, 0.856147f, 0.856939f,
- 0.857729f, 0.858516f, 0.859302f, 0.860085f, 0.860867f, 0.861646f, 0.862424f, 0.863199f,
- 0.863973f, 0.864744f, 0.865514f, 0.866281f, 0.867046f, 0.867809f, 0.868571f, 0.869330f,
- 0.870087f, 0.870842f, 0.871595f, 0.872346f, 0.873095f, 0.873842f, 0.874587f, 0.875329f,
- 0.876070f, 0.876809f, 0.877545f, 0.878280f, 0.879012f, 0.879743f, 0.880471f, 0.881197f,
- 0.881921f, 0.882643f, 0.883363f, 0.884081f, 0.884797f, 0.885511f, 0.886223f, 0.886932f,
- 0.887640f, 0.888345f, 0.889048f, 0.889750f, 0.890449f, 0.891146f, 0.891841f, 0.892534f,
- 0.893224f, 0.893913f, 0.894599f, 0.895284f, 0.895966f, 0.896646f, 0.897325f, 0.898001f,
- 0.898674f, 0.899346f, 0.900016f, 0.900683f, 0.901349f, 0.902012f, 0.902673f, 0.903332f,
- 0.903989f, 0.904644f, 0.905297f, 0.905947f, 0.906596f, 0.907242f, 0.907886f, 0.908528f,
- 0.909168f, 0.909806f, 0.910441f, 0.911075f, 0.911706f, 0.912335f, 0.912962f, 0.913587f,
- 0.914210f, 0.914830f, 0.915449f, 0.916065f, 0.916679f, 0.917291f, 0.917901f, 0.918508f,
- 0.919114f, 0.919717f, 0.920318f, 0.920917f, 0.921514f, 0.922109f, 0.922701f, 0.923291f,
- 0.923880f, 0.924465f, 0.925049f, 0.925631f, 0.926210f, 0.926787f, 0.927363f, 0.927935f,
- 0.928506f, 0.929075f, 0.929641f, 0.930205f, 0.930767f, 0.931327f, 0.931884f, 0.932440f,
- 0.932993f, 0.933544f, 0.934093f, 0.934639f, 0.935184f, 0.935726f, 0.936266f, 0.936803f,
- 0.937339f, 0.937872f, 0.938404f, 0.938932f, 0.939459f, 0.939984f, 0.940506f, 0.941026f,
- 0.941544f, 0.942060f, 0.942573f, 0.943084f, 0.943593f, 0.944100f, 0.944605f, 0.945107f,
- 0.945607f, 0.946105f, 0.946601f, 0.947094f, 0.947586f, 0.948075f, 0.948561f, 0.949046f,
- 0.949528f, 0.950008f, 0.950486f, 0.950962f, 0.951435f, 0.951906f, 0.952375f, 0.952842f,
- 0.953306f, 0.953768f, 0.954228f, 0.954686f, 0.955141f, 0.955594f, 0.956045f, 0.956494f,
- 0.956940f, 0.957385f, 0.957826f, 0.958266f, 0.958703f, 0.959139f, 0.959572f, 0.960002f,
- 0.960431f, 0.960857f, 0.961280f, 0.961702f, 0.962121f, 0.962538f, 0.962953f, 0.963366f,
- 0.963776f, 0.964184f, 0.964590f, 0.964993f, 0.965394f, 0.965793f, 0.966190f, 0.966584f,
- 0.966976f, 0.967366f, 0.967754f, 0.968139f, 0.968522f, 0.968903f, 0.969281f, 0.969657f,
- 0.970031f, 0.970403f, 0.970772f, 0.971139f, 0.971504f, 0.971866f, 0.972227f, 0.972584f,
- 0.972940f, 0.973293f, 0.973644f, 0.973993f, 0.974339f, 0.974684f, 0.975025f, 0.975365f,
- 0.975702f, 0.976037f, 0.976370f, 0.976700f, 0.977028f, 0.977354f, 0.977677f, 0.977998f,
- 0.978317f, 0.978634f, 0.978948f, 0.979260f, 0.979570f, 0.979877f, 0.980182f, 0.980485f,
- 0.980785f, 0.981083f, 0.981379f, 0.981673f, 0.981964f, 0.982253f, 0.982539f, 0.982824f,
- 0.983105f, 0.983385f, 0.983662f, 0.983937f, 0.984210f, 0.984480f, 0.984748f, 0.985014f,
- 0.985278f, 0.985539f, 0.985798f, 0.986054f, 0.986308f, 0.986560f, 0.986809f, 0.987057f,
- 0.987301f, 0.987544f, 0.987784f, 0.988022f, 0.988258f, 0.988491f, 0.988722f, 0.988950f,
- 0.989177f, 0.989400f, 0.989622f, 0.989841f, 0.990058f, 0.990273f, 0.990485f, 0.990695f,
- 0.990903f, 0.991108f, 0.991311f, 0.991511f, 0.991710f, 0.991906f, 0.992099f, 0.992291f,
- 0.992480f, 0.992666f, 0.992850f, 0.993032f, 0.993212f, 0.993389f, 0.993564f, 0.993737f,
- 0.993907f, 0.994075f, 0.994240f, 0.994404f, 0.994565f, 0.994723f, 0.994879f, 0.995033f,
- 0.995185f, 0.995334f, 0.995481f, 0.995625f, 0.995767f, 0.995907f, 0.996045f, 0.996180f,
- 0.996313f, 0.996443f, 0.996571f, 0.996697f, 0.996820f, 0.996941f, 0.997060f, 0.997176f,
- 0.997290f, 0.997402f, 0.997511f, 0.997618f, 0.997723f, 0.997825f, 0.997925f, 0.998023f,
- 0.998118f, 0.998211f, 0.998302f, 0.998390f, 0.998476f, 0.998559f, 0.998640f, 0.998719f,
- 0.998795f, 0.998870f, 0.998941f, 0.999011f, 0.999078f, 0.999142f, 0.999205f, 0.999265f,
- 0.999322f, 0.999378f, 0.999431f, 0.999481f, 0.999529f, 0.999575f, 0.999619f, 0.999660f,
- 0.999699f, 0.999735f, 0.999769f, 0.999801f, 0.999831f, 0.999858f, 0.999882f, 0.999905f,
- 0.999925f, 0.999942f, 0.999958f, 0.999971f, 0.999981f, 0.999989f, 0.999995f, 0.999999f
-};
-
-static const float cosTable8192[4096] = {
- 1.000000f, 1.000000f, 0.999999f, 0.999997f, 0.999995f, 0.999993f, 0.999989f, 0.999986f,
- 0.999981f, 0.999976f, 0.999971f, 0.999964f, 0.999958f, 0.999950f, 0.999942f, 0.999934f,
- 0.999925f, 0.999915f, 0.999905f, 0.999894f, 0.999882f, 0.999870f, 0.999858f, 0.999844f,
- 0.999831f, 0.999816f, 0.999801f, 0.999786f, 0.999769f, 0.999753f, 0.999735f, 0.999717f,
- 0.999699f, 0.999680f, 0.999660f, 0.999640f, 0.999619f, 0.999597f, 0.999575f, 0.999553f,
- 0.999529f, 0.999506f, 0.999481f, 0.999456f, 0.999431f, 0.999404f, 0.999378f, 0.999350f,
- 0.999322f, 0.999294f, 0.999265f, 0.999235f, 0.999205f, 0.999174f, 0.999142f, 0.999110f,
- 0.999078f, 0.999044f, 0.999011f, 0.998976f, 0.998941f, 0.998906f, 0.998870f, 0.998833f,
- 0.998795f, 0.998758f, 0.998719f, 0.998680f, 0.998640f, 0.998600f, 0.998559f, 0.998518f,
- 0.998476f, 0.998433f, 0.998390f, 0.998346f, 0.998302f, 0.998257f, 0.998211f, 0.998165f,
- 0.998118f, 0.998071f, 0.998023f, 0.997974f, 0.997925f, 0.997876f, 0.997825f, 0.997774f,
- 0.997723f, 0.997671f, 0.997618f, 0.997565f, 0.997511f, 0.997457f, 0.997402f, 0.997347f,
- 0.997290f, 0.997234f, 0.997176f, 0.997119f, 0.997060f, 0.997001f, 0.996941f, 0.996881f,
- 0.996820f, 0.996759f, 0.996697f, 0.996634f, 0.996571f, 0.996507f, 0.996443f, 0.996378f,
- 0.996313f, 0.996247f, 0.996180f, 0.996113f, 0.996045f, 0.995976f, 0.995907f, 0.995838f,
- 0.995767f, 0.995697f, 0.995625f, 0.995553f, 0.995481f, 0.995408f, 0.995334f, 0.995260f,
- 0.995185f, 0.995109f, 0.995033f, 0.994957f, 0.994879f, 0.994802f, 0.994723f, 0.994644f,
- 0.994565f, 0.994484f, 0.994404f, 0.994322f, 0.994240f, 0.994158f, 0.994075f, 0.993991f,
- 0.993907f, 0.993822f, 0.993737f, 0.993651f, 0.993564f, 0.993477f, 0.993389f, 0.993301f,
- 0.993212f, 0.993122f, 0.993032f, 0.992942f, 0.992850f, 0.992759f, 0.992666f, 0.992573f,
- 0.992480f, 0.992385f, 0.992291f, 0.992195f, 0.992099f, 0.992003f, 0.991906f, 0.991808f,
- 0.991710f, 0.991611f, 0.991511f, 0.991411f, 0.991311f, 0.991210f, 0.991108f, 0.991006f,
- 0.990903f, 0.990799f, 0.990695f, 0.990590f, 0.990485f, 0.990379f, 0.990273f, 0.990166f,
- 0.990058f, 0.989950f, 0.989841f, 0.989732f, 0.989622f, 0.989511f, 0.989400f, 0.989289f,
- 0.989177f, 0.989064f, 0.988950f, 0.988836f, 0.988722f, 0.988607f, 0.988491f, 0.988374f,
- 0.988258f, 0.988140f, 0.988022f, 0.987903f, 0.987784f, 0.987664f, 0.987544f, 0.987423f,
- 0.987301f, 0.987179f, 0.987057f, 0.986933f, 0.986809f, 0.986685f, 0.986560f, 0.986434f,
- 0.986308f, 0.986181f, 0.986054f, 0.985926f, 0.985798f, 0.985668f, 0.985539f, 0.985408f,
- 0.985278f, 0.985146f, 0.985014f, 0.984882f, 0.984748f, 0.984615f, 0.984480f, 0.984346f,
- 0.984210f, 0.984074f, 0.983937f, 0.983800f, 0.983662f, 0.983524f, 0.983385f, 0.983246f,
- 0.983105f, 0.982965f, 0.982824f, 0.982682f, 0.982539f, 0.982396f, 0.982253f, 0.982109f,
- 0.981964f, 0.981819f, 0.981673f, 0.981526f, 0.981379f, 0.981232f, 0.981083f, 0.980935f,
- 0.980785f, 0.980635f, 0.980485f, 0.980334f, 0.980182f, 0.980030f, 0.979877f, 0.979724f,
- 0.979570f, 0.979415f, 0.979260f, 0.979104f, 0.978948f, 0.978791f, 0.978634f, 0.978476f,
- 0.978317f, 0.978158f, 0.977998f, 0.977838f, 0.977677f, 0.977516f, 0.977354f, 0.977191f,
- 0.977028f, 0.976864f, 0.976700f, 0.976535f, 0.976370f, 0.976204f, 0.976037f, 0.975870f,
- 0.975702f, 0.975534f, 0.975365f, 0.975195f, 0.975025f, 0.974855f, 0.974684f, 0.974512f,
- 0.974339f, 0.974166f, 0.973993f, 0.973819f, 0.973644f, 0.973469f, 0.973293f, 0.973117f,
- 0.972940f, 0.972762f, 0.972584f, 0.972406f, 0.972227f, 0.972047f, 0.971866f, 0.971685f,
- 0.971504f, 0.971322f, 0.971139f, 0.970956f, 0.970772f, 0.970588f, 0.970403f, 0.970217f,
- 0.970031f, 0.969845f, 0.969657f, 0.969470f, 0.969281f, 0.969092f, 0.968903f, 0.968713f,
- 0.968522f, 0.968331f, 0.968139f, 0.967947f, 0.967754f, 0.967560f, 0.967366f, 0.967172f,
- 0.966976f, 0.966781f, 0.966584f, 0.966387f, 0.966190f, 0.965992f, 0.965793f, 0.965594f,
- 0.965394f, 0.965194f, 0.964993f, 0.964792f, 0.964590f, 0.964387f, 0.964184f, 0.963980f,
- 0.963776f, 0.963571f, 0.963366f, 0.963160f, 0.962953f, 0.962746f, 0.962538f, 0.962330f,
- 0.962121f, 0.961912f, 0.961702f, 0.961492f, 0.961280f, 0.961069f, 0.960857f, 0.960644f,
- 0.960431f, 0.960217f, 0.960002f, 0.959787f, 0.959572f, 0.959355f, 0.959139f, 0.958921f,
- 0.958703f, 0.958485f, 0.958266f, 0.958046f, 0.957826f, 0.957606f, 0.957385f, 0.957163f,
- 0.956940f, 0.956717f, 0.956494f, 0.956270f, 0.956045f, 0.955820f, 0.955594f, 0.955368f,
- 0.955141f, 0.954914f, 0.954686f, 0.954457f, 0.954228f, 0.953998f, 0.953768f, 0.953537f,
- 0.953306f, 0.953074f, 0.952842f, 0.952609f, 0.952375f, 0.952141f, 0.951906f, 0.951671f,
- 0.951435f, 0.951199f, 0.950962f, 0.950724f, 0.950486f, 0.950247f, 0.950008f, 0.949768f,
- 0.949528f, 0.949287f, 0.949046f, 0.948804f, 0.948561f, 0.948318f, 0.948075f, 0.947830f,
- 0.947586f, 0.947340f, 0.947094f, 0.946848f, 0.946601f, 0.946353f, 0.946105f, 0.945857f,
- 0.945607f, 0.945358f, 0.945107f, 0.944856f, 0.944605f, 0.944353f, 0.944100f, 0.943847f,
- 0.943593f, 0.943339f, 0.943084f, 0.942829f, 0.942573f, 0.942317f, 0.942060f, 0.941802f,
- 0.941544f, 0.941285f, 0.941026f, 0.940766f, 0.940506f, 0.940245f, 0.939984f, 0.939722f,
- 0.939459f, 0.939196f, 0.938932f, 0.938668f, 0.938404f, 0.938138f, 0.937872f, 0.937606f,
- 0.937339f, 0.937072f, 0.936803f, 0.936535f, 0.936266f, 0.935996f, 0.935726f, 0.935455f,
- 0.935184f, 0.934912f, 0.934639f, 0.934366f, 0.934093f, 0.933818f, 0.933544f, 0.933269f,
- 0.932993f, 0.932716f, 0.932440f, 0.932162f, 0.931884f, 0.931606f, 0.931327f, 0.931047f,
- 0.930767f, 0.930486f, 0.930205f, 0.929923f, 0.929641f, 0.929358f, 0.929075f, 0.928791f,
- 0.928506f, 0.928221f, 0.927935f, 0.927649f, 0.927363f, 0.927075f, 0.926787f, 0.926499f,
- 0.926210f, 0.925921f, 0.925631f, 0.925340f, 0.925049f, 0.924758f, 0.924465f, 0.924173f,
- 0.923880f, 0.923586f, 0.923291f, 0.922997f, 0.922701f, 0.922405f, 0.922109f, 0.921812f,
- 0.921514f, 0.921216f, 0.920917f, 0.920618f, 0.920318f, 0.920018f, 0.919717f, 0.919416f,
- 0.919114f, 0.918811f, 0.918508f, 0.918205f, 0.917901f, 0.917596f, 0.917291f, 0.916985f,
- 0.916679f, 0.916372f, 0.916065f, 0.915757f, 0.915449f, 0.915140f, 0.914830f, 0.914520f,
- 0.914210f, 0.913899f, 0.913587f, 0.913275f, 0.912962f, 0.912649f, 0.912335f, 0.912021f,
- 0.911706f, 0.911391f, 0.911075f, 0.910758f, 0.910441f, 0.910124f, 0.909806f, 0.909487f,
- 0.909168f, 0.908848f, 0.908528f, 0.908207f, 0.907886f, 0.907564f, 0.907242f, 0.906919f,
- 0.906596f, 0.906272f, 0.905947f, 0.905622f, 0.905297f, 0.904971f, 0.904644f, 0.904317f,
- 0.903989f, 0.903661f, 0.903332f, 0.903003f, 0.902673f, 0.902343f, 0.902012f, 0.901681f,
- 0.901349f, 0.901016f, 0.900683f, 0.900350f, 0.900016f, 0.899681f, 0.899346f, 0.899011f,
- 0.898674f, 0.898338f, 0.898001f, 0.897663f, 0.897325f, 0.896986f, 0.896646f, 0.896307f,
- 0.895966f, 0.895625f, 0.895284f, 0.894942f, 0.894599f, 0.894256f, 0.893913f, 0.893569f,
- 0.893224f, 0.892879f, 0.892534f, 0.892187f, 0.891841f, 0.891493f, 0.891146f, 0.890797f,
- 0.890449f, 0.890099f, 0.889750f, 0.889399f, 0.889048f, 0.888697f, 0.888345f, 0.887993f,
- 0.887640f, 0.887286f, 0.886932f, 0.886578f, 0.886223f, 0.885867f, 0.885511f, 0.885154f,
- 0.884797f, 0.884439f, 0.884081f, 0.883723f, 0.883363f, 0.883004f, 0.882643f, 0.882283f,
- 0.881921f, 0.881559f, 0.881197f, 0.880834f, 0.880471f, 0.880107f, 0.879743f, 0.879378f,
- 0.879012f, 0.878646f, 0.878280f, 0.877913f, 0.877545f, 0.877177f, 0.876809f, 0.876440f,
- 0.876070f, 0.875700f, 0.875329f, 0.874958f, 0.874587f, 0.874215f, 0.873842f, 0.873469f,
- 0.873095f, 0.872721f, 0.872346f, 0.871971f, 0.871595f, 0.871219f, 0.870842f, 0.870465f,
- 0.870087f, 0.869709f, 0.869330f, 0.868951f, 0.868571f, 0.868190f, 0.867809f, 0.867428f,
- 0.867046f, 0.866664f, 0.866281f, 0.865898f, 0.865514f, 0.865129f, 0.864744f, 0.864359f,
- 0.863973f, 0.863586f, 0.863199f, 0.862812f, 0.862424f, 0.862035f, 0.861646f, 0.861257f,
- 0.860867f, 0.860476f, 0.860085f, 0.859694f, 0.859302f, 0.858909f, 0.858516f, 0.858123f,
- 0.857729f, 0.857334f, 0.856939f, 0.856543f, 0.856147f, 0.855751f, 0.855354f, 0.854956f,
- 0.854558f, 0.854159f, 0.853760f, 0.853361f, 0.852961f, 0.852560f, 0.852159f, 0.851757f,
- 0.851355f, 0.850953f, 0.850549f, 0.850146f, 0.849742f, 0.849337f, 0.848932f, 0.848526f,
- 0.848120f, 0.847714f, 0.847307f, 0.846899f, 0.846491f, 0.846082f, 0.845673f, 0.845264f,
- 0.844854f, 0.844443f, 0.844032f, 0.843620f, 0.843208f, 0.842796f, 0.842383f, 0.841969f,
- 0.841555f, 0.841140f, 0.840725f, 0.840310f, 0.839894f, 0.839477f, 0.839060f, 0.838643f,
- 0.838225f, 0.837806f, 0.837387f, 0.836968f, 0.836548f, 0.836127f, 0.835706f, 0.835285f,
- 0.834863f, 0.834440f, 0.834018f, 0.833594f, 0.833170f, 0.832746f, 0.832321f, 0.831895f,
- 0.831470f, 0.831043f, 0.830616f, 0.830189f, 0.829761f, 0.829333f, 0.828904f, 0.828475f,
- 0.828045f, 0.827615f, 0.827184f, 0.826753f, 0.826321f, 0.825889f, 0.825456f, 0.825023f,
- 0.824589f, 0.824155f, 0.823721f, 0.823285f, 0.822850f, 0.822414f, 0.821977f, 0.821540f,
- 0.821102f, 0.820664f, 0.820226f, 0.819787f, 0.819348f, 0.818908f, 0.818467f, 0.818026f,
- 0.817585f, 0.817143f, 0.816701f, 0.816258f, 0.815814f, 0.815371f, 0.814926f, 0.814482f,
- 0.814036f, 0.813591f, 0.813144f, 0.812698f, 0.812251f, 0.811803f, 0.811355f, 0.810906f,
- 0.810457f, 0.810008f, 0.809558f, 0.809107f, 0.808656f, 0.808205f, 0.807753f, 0.807300f,
- 0.806848f, 0.806394f, 0.805940f, 0.805486f, 0.805031f, 0.804576f, 0.804120f, 0.803664f,
- 0.803208f, 0.802750f, 0.802293f, 0.801835f, 0.801376f, 0.800917f, 0.800458f, 0.799998f,
- 0.799537f, 0.799076f, 0.798615f, 0.798153f, 0.797691f, 0.797228f, 0.796765f, 0.796301f,
- 0.795837f, 0.795372f, 0.794907f, 0.794442f, 0.793975f, 0.793509f, 0.793042f, 0.792575f,
- 0.792107f, 0.791638f, 0.791169f, 0.790700f, 0.790230f, 0.789760f, 0.789289f, 0.788818f,
- 0.788346f, 0.787874f, 0.787402f, 0.786929f, 0.786455f, 0.785981f, 0.785507f, 0.785032f,
- 0.784557f, 0.784081f, 0.783605f, 0.783128f, 0.782651f, 0.782173f, 0.781695f, 0.781216f,
- 0.780737f, 0.780258f, 0.779778f, 0.779297f, 0.778817f, 0.778335f, 0.777853f, 0.777371f,
- 0.776888f, 0.776405f, 0.775922f, 0.775438f, 0.774953f, 0.774468f, 0.773983f, 0.773497f,
- 0.773010f, 0.772524f, 0.772036f, 0.771549f, 0.771061f, 0.770572f, 0.770083f, 0.769593f,
- 0.769103f, 0.768613f, 0.768122f, 0.767631f, 0.767139f, 0.766647f, 0.766154f, 0.765661f,
- 0.765167f, 0.764673f, 0.764179f, 0.763684f, 0.763188f, 0.762693f, 0.762196f, 0.761700f,
- 0.761202f, 0.760705f, 0.760207f, 0.759708f, 0.759209f, 0.758710f, 0.758210f, 0.757710f,
- 0.757209f, 0.756708f, 0.756206f, 0.755704f, 0.755201f, 0.754698f, 0.754195f, 0.753691f,
- 0.753187f, 0.752682f, 0.752177f, 0.751671f, 0.751165f, 0.750659f, 0.750152f, 0.749644f,
- 0.749136f, 0.748628f, 0.748119f, 0.747610f, 0.747101f, 0.746591f, 0.746080f, 0.745569f,
- 0.745058f, 0.744546f, 0.744034f, 0.743521f, 0.743008f, 0.742494f, 0.741980f, 0.741466f,
- 0.740951f, 0.740436f, 0.739920f, 0.739404f, 0.738887f, 0.738370f, 0.737853f, 0.737335f,
- 0.736817f, 0.736298f, 0.735779f, 0.735259f, 0.734739f, 0.734218f, 0.733697f, 0.733176f,
- 0.732654f, 0.732132f, 0.731609f, 0.731086f, 0.730563f, 0.730039f, 0.729514f, 0.728990f,
- 0.728464f, 0.727939f, 0.727413f, 0.726886f, 0.726359f, 0.725832f, 0.725304f, 0.724776f,
- 0.724247f, 0.723718f, 0.723188f, 0.722659f, 0.722128f, 0.721597f, 0.721066f, 0.720535f,
- 0.720003f, 0.719470f, 0.718937f, 0.718404f, 0.717870f, 0.717336f, 0.716801f, 0.716266f,
- 0.715731f, 0.715195f, 0.714659f, 0.714122f, 0.713585f, 0.713047f, 0.712509f, 0.711971f,
- 0.711432f, 0.710893f, 0.710353f, 0.709813f, 0.709273f, 0.708732f, 0.708191f, 0.707649f,
- 0.707107f, 0.706564f, 0.706021f, 0.705478f, 0.704934f, 0.704390f, 0.703845f, 0.703300f,
- 0.702755f, 0.702209f, 0.701663f, 0.701116f, 0.700569f, 0.700021f, 0.699473f, 0.698925f,
- 0.698376f, 0.697827f, 0.697277f, 0.696728f, 0.696177f, 0.695626f, 0.695075f, 0.694524f,
- 0.693971f, 0.693419f, 0.692866f, 0.692313f, 0.691759f, 0.691205f, 0.690651f, 0.690096f,
- 0.689541f, 0.688985f, 0.688429f, 0.687872f, 0.687315f, 0.686758f, 0.686200f, 0.685642f,
- 0.685084f, 0.684525f, 0.683965f, 0.683406f, 0.682846f, 0.682285f, 0.681724f, 0.681163f,
- 0.680601f, 0.680039f, 0.679476f, 0.678913f, 0.678350f, 0.677786f, 0.677222f, 0.676658f,
- 0.676093f, 0.675527f, 0.674962f, 0.674396f, 0.673829f, 0.673262f, 0.672695f, 0.672127f,
- 0.671559f, 0.670990f, 0.670422f, 0.669852f, 0.669283f, 0.668712f, 0.668142f, 0.667571f,
- 0.667000f, 0.666428f, 0.665856f, 0.665284f, 0.664711f, 0.664138f, 0.663564f, 0.662990f,
- 0.662416f, 0.661841f, 0.661266f, 0.660690f, 0.660114f, 0.659538f, 0.658961f, 0.658384f,
- 0.657807f, 0.657229f, 0.656651f, 0.656072f, 0.655493f, 0.654913f, 0.654334f, 0.653753f,
- 0.653173f, 0.652592f, 0.652011f, 0.651429f, 0.650847f, 0.650264f, 0.649681f, 0.649098f,
- 0.648514f, 0.647930f, 0.647346f, 0.646761f, 0.646176f, 0.645590f, 0.645005f, 0.644418f,
- 0.643832f, 0.643245f, 0.642657f, 0.642069f, 0.641481f, 0.640892f, 0.640303f, 0.639714f,
- 0.639124f, 0.638534f, 0.637944f, 0.637353f, 0.636762f, 0.636170f, 0.635578f, 0.634986f,
- 0.634393f, 0.633800f, 0.633207f, 0.632613f, 0.632019f, 0.631424f, 0.630829f, 0.630234f,
- 0.629638f, 0.629042f, 0.628446f, 0.627849f, 0.627252f, 0.626654f, 0.626056f, 0.625458f,
- 0.624860f, 0.624260f, 0.623661f, 0.623061f, 0.622461f, 0.621861f, 0.621260f, 0.620659f,
- 0.620057f, 0.619455f, 0.618853f, 0.618250f, 0.617647f, 0.617044f, 0.616440f, 0.615836f,
- 0.615232f, 0.614627f, 0.614022f, 0.613416f, 0.612810f, 0.612204f, 0.611597f, 0.610990f,
- 0.610383f, 0.609775f, 0.609167f, 0.608559f, 0.607950f, 0.607341f, 0.606731f, 0.606121f,
- 0.605511f, 0.604900f, 0.604290f, 0.603678f, 0.603067f, 0.602455f, 0.601842f, 0.601230f,
- 0.600616f, 0.600003f, 0.599389f, 0.598775f, 0.598161f, 0.597546f, 0.596931f, 0.596315f,
- 0.595699f, 0.595083f, 0.594467f, 0.593850f, 0.593232f, 0.592615f, 0.591997f, 0.591378f,
- 0.590760f, 0.590141f, 0.589521f, 0.588902f, 0.588282f, 0.587661f, 0.587040f, 0.586419f,
- 0.585798f, 0.585176f, 0.584554f, 0.583931f, 0.583309f, 0.582685f, 0.582062f, 0.581438f,
- 0.580814f, 0.580189f, 0.579565f, 0.578939f, 0.578314f, 0.577688f, 0.577062f, 0.576435f,
- 0.575808f, 0.575181f, 0.574553f, 0.573925f, 0.573297f, 0.572669f, 0.572040f, 0.571410f,
- 0.570781f, 0.570151f, 0.569521f, 0.568890f, 0.568259f, 0.567628f, 0.566996f, 0.566364f,
- 0.565732f, 0.565099f, 0.564466f, 0.563833f, 0.563199f, 0.562565f, 0.561931f, 0.561297f,
- 0.560662f, 0.560026f, 0.559391f, 0.558755f, 0.558119f, 0.557482f, 0.556845f, 0.556208f,
- 0.555570f, 0.554932f, 0.554294f, 0.553656f, 0.553017f, 0.552378f, 0.551738f, 0.551098f,
- 0.550458f, 0.549818f, 0.549177f, 0.548536f, 0.547894f, 0.547252f, 0.546610f, 0.545968f,
- 0.545325f, 0.544682f, 0.544039f, 0.543395f, 0.542751f, 0.542106f, 0.541462f, 0.540817f,
- 0.540171f, 0.539526f, 0.538880f, 0.538234f, 0.537587f, 0.536940f, 0.536293f, 0.535645f,
- 0.534998f, 0.534349f, 0.533701f, 0.533052f, 0.532403f, 0.531754f, 0.531104f, 0.530454f,
- 0.529804f, 0.529153f, 0.528502f, 0.527851f, 0.527199f, 0.526547f, 0.525895f, 0.525243f,
- 0.524590f, 0.523937f, 0.523283f, 0.522629f, 0.521975f, 0.521321f, 0.520666f, 0.520011f,
- 0.519356f, 0.518700f, 0.518045f, 0.517388f, 0.516732f, 0.516075f, 0.515418f, 0.514760f,
- 0.514103f, 0.513445f, 0.512786f, 0.512128f, 0.511469f, 0.510810f, 0.510150f, 0.509490f,
- 0.508830f, 0.508170f, 0.507509f, 0.506848f, 0.506187f, 0.505525f, 0.504863f, 0.504201f,
- 0.503538f, 0.502876f, 0.502212f, 0.501549f, 0.500885f, 0.500221f, 0.499557f, 0.498893f,
- 0.498228f, 0.497562f, 0.496897f, 0.496231f, 0.495565f, 0.494899f, 0.494232f, 0.493565f,
- 0.492898f, 0.492231f, 0.491563f, 0.490895f, 0.490226f, 0.489558f, 0.488889f, 0.488220f,
- 0.487550f, 0.486880f, 0.486210f, 0.485540f, 0.484869f, 0.484198f, 0.483527f, 0.482856f,
- 0.482184f, 0.481512f, 0.480839f, 0.480167f, 0.479494f, 0.478821f, 0.478147f, 0.477473f,
- 0.476799f, 0.476125f, 0.475450f, 0.474775f, 0.474100f, 0.473425f, 0.472749f, 0.472073f,
- 0.471397f, 0.470720f, 0.470043f, 0.469366f, 0.468689f, 0.468011f, 0.467333f, 0.466655f,
- 0.465977f, 0.465298f, 0.464619f, 0.463939f, 0.463260f, 0.462580f, 0.461900f, 0.461219f,
- 0.460539f, 0.459858f, 0.459177f, 0.458495f, 0.457813f, 0.457131f, 0.456449f, 0.455766f,
- 0.455084f, 0.454400f, 0.453717f, 0.453033f, 0.452350f, 0.451665f, 0.450981f, 0.450296f,
- 0.449611f, 0.448926f, 0.448241f, 0.447555f, 0.446869f, 0.446183f, 0.445496f, 0.444809f,
- 0.444122f, 0.443435f, 0.442747f, 0.442059f, 0.441371f, 0.440683f, 0.439994f, 0.439305f,
- 0.438616f, 0.437927f, 0.437237f, 0.436547f, 0.435857f, 0.435167f, 0.434476f, 0.433785f,
- 0.433094f, 0.432402f, 0.431711f, 0.431019f, 0.430326f, 0.429634f, 0.428941f, 0.428248f,
- 0.427555f, 0.426862f, 0.426168f, 0.425474f, 0.424780f, 0.424085f, 0.423390f, 0.422695f,
- 0.422000f, 0.421305f, 0.420609f, 0.419913f, 0.419217f, 0.418520f, 0.417824f, 0.417127f,
- 0.416430f, 0.415732f, 0.415034f, 0.414337f, 0.413638f, 0.412940f, 0.412241f, 0.411542f,
- 0.410843f, 0.410144f, 0.409444f, 0.408744f, 0.408044f, 0.407344f, 0.406643f, 0.405942f,
- 0.405241f, 0.404540f, 0.403838f, 0.403137f, 0.402435f, 0.401732f, 0.401030f, 0.400327f,
- 0.399624f, 0.398921f, 0.398218f, 0.397514f, 0.396810f, 0.396106f, 0.395401f, 0.394697f,
- 0.393992f, 0.393287f, 0.392582f, 0.391876f, 0.391170f, 0.390464f, 0.389758f, 0.389052f,
- 0.388345f, 0.387638f, 0.386931f, 0.386224f, 0.385516f, 0.384808f, 0.384100f, 0.383392f,
- 0.382683f, 0.381975f, 0.381266f, 0.380557f, 0.379847f, 0.379138f, 0.378428f, 0.377718f,
- 0.377007f, 0.376297f, 0.375586f, 0.374875f, 0.374164f, 0.373453f, 0.372741f, 0.372029f,
- 0.371317f, 0.370605f, 0.369892f, 0.369180f, 0.368467f, 0.367754f, 0.367040f, 0.366327f,
- 0.365613f, 0.364899f, 0.364185f, 0.363470f, 0.362756f, 0.362041f, 0.361326f, 0.360611f,
- 0.359895f, 0.359179f, 0.358463f, 0.357747f, 0.357031f, 0.356314f, 0.355598f, 0.354881f,
- 0.354164f, 0.353446f, 0.352729f, 0.352011f, 0.351293f, 0.350575f, 0.349856f, 0.349138f,
- 0.348419f, 0.347700f, 0.346980f, 0.346261f, 0.345541f, 0.344821f, 0.344101f, 0.343381f,
- 0.342661f, 0.341940f, 0.341219f, 0.340498f, 0.339777f, 0.339055f, 0.338334f, 0.337612f,
- 0.336890f, 0.336168f, 0.335445f, 0.334722f, 0.334000f, 0.333277f, 0.332553f, 0.331830f,
- 0.331106f, 0.330382f, 0.329658f, 0.328934f, 0.328210f, 0.327485f, 0.326760f, 0.326035f,
- 0.325310f, 0.324585f, 0.323859f, 0.323134f, 0.322408f, 0.321682f, 0.320955f, 0.320229f,
- 0.319502f, 0.318775f, 0.318048f, 0.317321f, 0.316593f, 0.315866f, 0.315138f, 0.314410f,
- 0.313682f, 0.312953f, 0.312225f, 0.311496f, 0.310767f, 0.310038f, 0.309309f, 0.308579f,
- 0.307850f, 0.307120f, 0.306390f, 0.305660f, 0.304929f, 0.304199f, 0.303468f, 0.302737f,
- 0.302006f, 0.301275f, 0.300543f, 0.299812f, 0.299080f, 0.298348f, 0.297616f, 0.296883f,
- 0.296151f, 0.295418f, 0.294685f, 0.293952f, 0.293219f, 0.292486f, 0.291752f, 0.291019f,
- 0.290285f, 0.289551f, 0.288816f, 0.288082f, 0.287347f, 0.286613f, 0.285878f, 0.285143f,
- 0.284408f, 0.283672f, 0.282937f, 0.282201f, 0.281465f, 0.280729f, 0.279993f, 0.279256f,
- 0.278520f, 0.277783f, 0.277046f, 0.276309f, 0.275572f, 0.274834f, 0.274097f, 0.273359f,
- 0.272621f, 0.271883f, 0.271145f, 0.270407f, 0.269668f, 0.268930f, 0.268191f, 0.267452f,
- 0.266713f, 0.265973f, 0.265234f, 0.264494f, 0.263755f, 0.263015f, 0.262275f, 0.261534f,
- 0.260794f, 0.260054f, 0.259313f, 0.258572f, 0.257831f, 0.257090f, 0.256349f, 0.255607f,
- 0.254866f, 0.254124f, 0.253382f, 0.252640f, 0.251898f, 0.251155f, 0.250413f, 0.249670f,
- 0.248928f, 0.248185f, 0.247442f, 0.246698f, 0.245955f, 0.245212f, 0.244468f, 0.243724f,
- 0.242980f, 0.242236f, 0.241492f, 0.240748f, 0.240003f, 0.239258f, 0.238514f, 0.237769f,
- 0.237024f, 0.236278f, 0.235533f, 0.234788f, 0.234042f, 0.233296f, 0.232550f, 0.231804f,
- 0.231058f, 0.230312f, 0.229565f, 0.228819f, 0.228072f, 0.227325f, 0.226578f, 0.225831f,
- 0.225084f, 0.224337f, 0.223589f, 0.222841f, 0.222094f, 0.221346f, 0.220598f, 0.219850f,
- 0.219101f, 0.218353f, 0.217604f, 0.216856f, 0.216107f, 0.215358f, 0.214609f, 0.213860f,
- 0.213110f, 0.212361f, 0.211611f, 0.210862f, 0.210112f, 0.209362f, 0.208612f, 0.207862f,
- 0.207111f, 0.206361f, 0.205610f, 0.204860f, 0.204109f, 0.203358f, 0.202607f, 0.201856f,
- 0.201105f, 0.200353f, 0.199602f, 0.198850f, 0.198098f, 0.197347f, 0.196595f, 0.195843f,
- 0.195090f, 0.194338f, 0.193586f, 0.192833f, 0.192080f, 0.191328f, 0.190575f, 0.189822f,
- 0.189069f, 0.188315f, 0.187562f, 0.186809f, 0.186055f, 0.185301f, 0.184548f, 0.183794f,
- 0.183040f, 0.182286f, 0.181532f, 0.180777f, 0.180023f, 0.179268f, 0.178514f, 0.177759f,
- 0.177004f, 0.176249f, 0.175494f, 0.174739f, 0.173984f, 0.173229f, 0.172473f, 0.171718f,
- 0.170962f, 0.170206f, 0.169450f, 0.168694f, 0.167938f, 0.167182f, 0.166426f, 0.165670f,
- 0.164913f, 0.164157f, 0.163400f, 0.162643f, 0.161886f, 0.161129f, 0.160372f, 0.159615f,
- 0.158858f, 0.158101f, 0.157343f, 0.156586f, 0.155828f, 0.155071f, 0.154313f, 0.153555f,
- 0.152797f, 0.152039f, 0.151281f, 0.150523f, 0.149765f, 0.149006f, 0.148248f, 0.147489f,
- 0.146730f, 0.145972f, 0.145213f, 0.144454f, 0.143695f, 0.142936f, 0.142177f, 0.141418f,
- 0.140658f, 0.139899f, 0.139139f, 0.138380f, 0.137620f, 0.136860f, 0.136101f, 0.135341f,
- 0.134581f, 0.133821f, 0.133061f, 0.132300f, 0.131540f, 0.130780f, 0.130019f, 0.129259f,
- 0.128498f, 0.127737f, 0.126977f, 0.126216f, 0.125455f, 0.124694f, 0.123933f, 0.123172f,
- 0.122411f, 0.121649f, 0.120888f, 0.120127f, 0.119365f, 0.118604f, 0.117842f, 0.117080f,
- 0.116319f, 0.115557f, 0.114795f, 0.114033f, 0.113271f, 0.112509f, 0.111747f, 0.110984f,
- 0.110222f, 0.109460f, 0.108697f, 0.107935f, 0.107172f, 0.106410f, 0.105647f, 0.104884f,
- 0.104122f, 0.103359f, 0.102596f, 0.101833f, 0.101070f, 0.100307f, 0.099544f, 0.098780f,
- 0.098017f, 0.097254f, 0.096490f, 0.095727f, 0.094963f, 0.094200f, 0.093436f, 0.092673f,
- 0.091909f, 0.091145f, 0.090381f, 0.089617f, 0.088854f, 0.088090f, 0.087326f, 0.086561f,
- 0.085797f, 0.085033f, 0.084269f, 0.083505f, 0.082740f, 0.081976f, 0.081211f, 0.080447f,
- 0.079682f, 0.078918f, 0.078153f, 0.077389f, 0.076624f, 0.075859f, 0.075094f, 0.074329f,
- 0.073565f, 0.072800f, 0.072035f, 0.071270f, 0.070505f, 0.069739f, 0.068974f, 0.068209f,
- 0.067444f, 0.066679f, 0.065913f, 0.065148f, 0.064383f, 0.063617f, 0.062852f, 0.062086f,
- 0.061321f, 0.060555f, 0.059790f, 0.059024f, 0.058258f, 0.057493f, 0.056727f, 0.055961f,
- 0.055195f, 0.054429f, 0.053664f, 0.052898f, 0.052132f, 0.051366f, 0.050600f, 0.049834f,
- 0.049068f, 0.048302f, 0.047535f, 0.046769f, 0.046003f, 0.045237f, 0.044471f, 0.043705f,
- 0.042938f, 0.042172f, 0.041406f, 0.040639f, 0.039873f, 0.039107f, 0.038340f, 0.037574f,
- 0.036807f, 0.036041f, 0.035274f, 0.034508f, 0.033741f, 0.032975f, 0.032208f, 0.031441f,
- 0.030675f, 0.029908f, 0.029142f, 0.028375f, 0.027608f, 0.026841f, 0.026075f, 0.025308f,
- 0.024541f, 0.023774f, 0.023008f, 0.022241f, 0.021474f, 0.020707f, 0.019940f, 0.019174f,
- 0.018407f, 0.017640f, 0.016873f, 0.016106f, 0.015339f, 0.014572f, 0.013805f, 0.013038f,
- 0.012272f, 0.011505f, 0.010738f, 0.009971f, 0.009204f, 0.008437f, 0.007670f, 0.006903f,
- 0.006136f, 0.005369f, 0.004602f, 0.003835f, 0.003068f, 0.002301f, 0.001534f, 0.000767f,
- 0.000000f, 0.000767f, 0.001534f, 0.002301f, 0.003068f, 0.003835f, 0.004602f, 0.005369f,
- 0.006136f, 0.006903f, 0.007670f, 0.008437f, 0.009204f, 0.009971f, 0.010738f, 0.011505f,
- 0.012272f, 0.013038f, 0.013805f, 0.014572f, 0.015339f, 0.016106f, 0.016873f, 0.017640f,
- 0.018407f, 0.019174f, 0.019940f, 0.020707f, 0.021474f, 0.022241f, 0.023008f, 0.023774f,
- 0.024541f, 0.025308f, 0.026075f, 0.026841f, 0.027608f, 0.028375f, 0.029142f, 0.029908f,
- 0.030675f, 0.031441f, 0.032208f, 0.032975f, 0.033741f, 0.034508f, 0.035274f, 0.036041f,
- 0.036807f, 0.037574f, 0.038340f, 0.039107f, 0.039873f, 0.040639f, 0.041406f, 0.042172f,
- 0.042938f, 0.043705f, 0.044471f, 0.045237f, 0.046003f, 0.046769f, 0.047535f, 0.048302f,
- 0.049068f, 0.049834f, 0.050600f, 0.051366f, 0.052132f, 0.052898f, 0.053664f, 0.054429f,
- 0.055195f, 0.055961f, 0.056727f, 0.057493f, 0.058258f, 0.059024f, 0.059790f, 0.060555f,
- 0.061321f, 0.062086f, 0.062852f, 0.063617f, 0.064383f, 0.065148f, 0.065913f, 0.066679f,
- 0.067444f, 0.068209f, 0.068974f, 0.069739f, 0.070505f, 0.071270f, 0.072035f, 0.072800f,
- 0.073565f, 0.074329f, 0.075094f, 0.075859f, 0.076624f, 0.077389f, 0.078153f, 0.078918f,
- 0.079682f, 0.080447f, 0.081211f, 0.081976f, 0.082740f, 0.083505f, 0.084269f, 0.085033f,
- 0.085797f, 0.086561f, 0.087326f, 0.088090f, 0.088854f, 0.089617f, 0.090381f, 0.091145f,
- 0.091909f, 0.092673f, 0.093436f, 0.094200f, 0.094963f, 0.095727f, 0.096490f, 0.097254f,
- 0.098017f, 0.098780f, 0.099544f, 0.100307f, 0.101070f, 0.101833f, 0.102596f, 0.103359f,
- 0.104122f, 0.104884f, 0.105647f, 0.106410f, 0.107172f, 0.107935f, 0.108697f, 0.109460f,
- 0.110222f, 0.110984f, 0.111747f, 0.112509f, 0.113271f, 0.114033f, 0.114795f, 0.115557f,
- 0.116319f, 0.117080f, 0.117842f, 0.118604f, 0.119365f, 0.120127f, 0.120888f, 0.121649f,
- 0.122411f, 0.123172f, 0.123933f, 0.124694f, 0.125455f, 0.126216f, 0.126977f, 0.127737f,
- 0.128498f, 0.129259f, 0.130019f, 0.130780f, 0.131540f, 0.132300f, 0.133061f, 0.133821f,
- 0.134581f, 0.135341f, 0.136101f, 0.136860f, 0.137620f, 0.138380f, 0.139139f, 0.139899f,
- 0.140658f, 0.141418f, 0.142177f, 0.142936f, 0.143695f, 0.144454f, 0.145213f, 0.145972f,
- 0.146730f, 0.147489f, 0.148248f, 0.149006f, 0.149765f, 0.150523f, 0.151281f, 0.152039f,
- 0.152797f, 0.153555f, 0.154313f, 0.155071f, 0.155828f, 0.156586f, 0.157343f, 0.158101f,
- 0.158858f, 0.159615f, 0.160372f, 0.161129f, 0.161886f, 0.162643f, 0.163400f, 0.164157f,
- 0.164913f, 0.165670f, 0.166426f, 0.167182f, 0.167938f, 0.168694f, 0.169450f, 0.170206f,
- 0.170962f, 0.171718f, 0.172473f, 0.173229f, 0.173984f, 0.174739f, 0.175494f, 0.176249f,
- 0.177004f, 0.177759f, 0.178514f, 0.179268f, 0.180023f, 0.180777f, 0.181532f, 0.182286f,
- 0.183040f, 0.183794f, 0.184548f, 0.185301f, 0.186055f, 0.186809f, 0.187562f, 0.188315f,
- 0.189069f, 0.189822f, 0.190575f, 0.191328f, 0.192080f, 0.192833f, 0.193586f, 0.194338f,
- 0.195090f, 0.195843f, 0.196595f, 0.197347f, 0.198098f, 0.198850f, 0.199602f, 0.200353f,
- 0.201105f, 0.201856f, 0.202607f, 0.203358f, 0.204109f, 0.204860f, 0.205610f, 0.206361f,
- 0.207111f, 0.207862f, 0.208612f, 0.209362f, 0.210112f, 0.210862f, 0.211611f, 0.212361f,
- 0.213110f, 0.213860f, 0.214609f, 0.215358f, 0.216107f, 0.216856f, 0.217604f, 0.218353f,
- 0.219101f, 0.219850f, 0.220598f, 0.221346f, 0.222094f, 0.222841f, 0.223589f, 0.224337f,
- 0.225084f, 0.225831f, 0.226578f, 0.227325f, 0.228072f, 0.228819f, 0.229565f, 0.230312f,
- 0.231058f, 0.231804f, 0.232550f, 0.233296f, 0.234042f, 0.234788f, 0.235533f, 0.236278f,
- 0.237024f, 0.237769f, 0.238514f, 0.239258f, 0.240003f, 0.240748f, 0.241492f, 0.242236f,
- 0.242980f, 0.243724f, 0.244468f, 0.245212f, 0.245955f, 0.246698f, 0.247442f, 0.248185f,
- 0.248928f, 0.249670f, 0.250413f, 0.251155f, 0.251898f, 0.252640f, 0.253382f, 0.254124f,
- 0.254866f, 0.255607f, 0.256349f, 0.257090f, 0.257831f, 0.258572f, 0.259313f, 0.260054f,
- 0.260794f, 0.261534f, 0.262275f, 0.263015f, 0.263755f, 0.264494f, 0.265234f, 0.265973f,
- 0.266713f, 0.267452f, 0.268191f, 0.268930f, 0.269668f, 0.270407f, 0.271145f, 0.271883f,
- 0.272621f, 0.273359f, 0.274097f, 0.274834f, 0.275572f, 0.276309f, 0.277046f, 0.277783f,
- 0.278520f, 0.279256f, 0.279993f, 0.280729f, 0.281465f, 0.282201f, 0.282937f, 0.283672f,
- 0.284408f, 0.285143f, 0.285878f, 0.286613f, 0.287347f, 0.288082f, 0.288816f, 0.289551f,
- 0.290285f, 0.291019f, 0.291752f, 0.292486f, 0.293219f, 0.293952f, 0.294685f, 0.295418f,
- 0.296151f, 0.296883f, 0.297616f, 0.298348f, 0.299080f, 0.299812f, 0.300543f, 0.301275f,
- 0.302006f, 0.302737f, 0.303468f, 0.304199f, 0.304929f, 0.305660f, 0.306390f, 0.307120f,
- 0.307850f, 0.308579f, 0.309309f, 0.310038f, 0.310767f, 0.311496f, 0.312225f, 0.312953f,
- 0.313682f, 0.314410f, 0.315138f, 0.315866f, 0.316593f, 0.317321f, 0.318048f, 0.318775f,
- 0.319502f, 0.320229f, 0.320955f, 0.321682f, 0.322408f, 0.323134f, 0.323859f, 0.324585f,
- 0.325310f, 0.326035f, 0.326760f, 0.327485f, 0.328210f, 0.328934f, 0.329658f, 0.330382f,
- 0.331106f, 0.331830f, 0.332553f, 0.333277f, 0.334000f, 0.334722f, 0.335445f, 0.336168f,
- 0.336890f, 0.337612f, 0.338334f, 0.339055f, 0.339777f, 0.340498f, 0.341219f, 0.341940f,
- 0.342661f, 0.343381f, 0.344101f, 0.344821f, 0.345541f, 0.346261f, 0.346980f, 0.347700f,
- 0.348419f, 0.349138f, 0.349856f, 0.350575f, 0.351293f, 0.352011f, 0.352729f, 0.353446f,
- 0.354164f, 0.354881f, 0.355598f, 0.356314f, 0.357031f, 0.357747f, 0.358463f, 0.359179f,
- 0.359895f, 0.360611f, 0.361326f, 0.362041f, 0.362756f, 0.363470f, 0.364185f, 0.364899f,
- 0.365613f, 0.366327f, 0.367040f, 0.367754f, 0.368467f, 0.369180f, 0.369892f, 0.370605f,
- 0.371317f, 0.372029f, 0.372741f, 0.373453f, 0.374164f, 0.374875f, 0.375586f, 0.376297f,
- 0.377007f, 0.377718f, 0.378428f, 0.379138f, 0.379847f, 0.380557f, 0.381266f, 0.381975f,
- 0.382683f, 0.383392f, 0.384100f, 0.384808f, 0.385516f, 0.386224f, 0.386931f, 0.387638f,
- 0.388345f, 0.389052f, 0.389758f, 0.390464f, 0.391170f, 0.391876f, 0.392582f, 0.393287f,
- 0.393992f, 0.394697f, 0.395401f, 0.396106f, 0.396810f, 0.397514f, 0.398218f, 0.398921f,
- 0.399624f, 0.400327f, 0.401030f, 0.401732f, 0.402435f, 0.403137f, 0.403838f, 0.404540f,
- 0.405241f, 0.405942f, 0.406643f, 0.407344f, 0.408044f, 0.408744f, 0.409444f, 0.410144f,
- 0.410843f, 0.411542f, 0.412241f, 0.412940f, 0.413638f, 0.414337f, 0.415034f, 0.415732f,
- 0.416430f, 0.417127f, 0.417824f, 0.418520f, 0.419217f, 0.419913f, 0.420609f, 0.421305f,
- 0.422000f, 0.422695f, 0.423390f, 0.424085f, 0.424780f, 0.425474f, 0.426168f, 0.426862f,
- 0.427555f, 0.428248f, 0.428941f, 0.429634f, 0.430326f, 0.431019f, 0.431711f, 0.432402f,
- 0.433094f, 0.433785f, 0.434476f, 0.435167f, 0.435857f, 0.436547f, 0.437237f, 0.437927f,
- 0.438616f, 0.439305f, 0.439994f, 0.440683f, 0.441371f, 0.442059f, 0.442747f, 0.443435f,
- 0.444122f, 0.444809f, 0.445496f, 0.446183f, 0.446869f, 0.447555f, 0.448241f, 0.448926f,
- 0.449611f, 0.450296f, 0.450981f, 0.451665f, 0.452350f, 0.453033f, 0.453717f, 0.454400f,
- 0.455084f, 0.455766f, 0.456449f, 0.457131f, 0.457813f, 0.458495f, 0.459177f, 0.459858f,
- 0.460539f, 0.461219f, 0.461900f, 0.462580f, 0.463260f, 0.463939f, 0.464619f, 0.465298f,
- 0.465977f, 0.466655f, 0.467333f, 0.468011f, 0.468689f, 0.469366f, 0.470043f, 0.470720f,
- 0.471397f, 0.472073f, 0.472749f, 0.473425f, 0.474100f, 0.474775f, 0.475450f, 0.476125f,
- 0.476799f, 0.477473f, 0.478147f, 0.478821f, 0.479494f, 0.480167f, 0.480839f, 0.481512f,
- 0.482184f, 0.482856f, 0.483527f, 0.484198f, 0.484869f, 0.485540f, 0.486210f, 0.486880f,
- 0.487550f, 0.488220f, 0.488889f, 0.489558f, 0.490226f, 0.490895f, 0.491563f, 0.492231f,
- 0.492898f, 0.493565f, 0.494232f, 0.494899f, 0.495565f, 0.496231f, 0.496897f, 0.497562f,
- 0.498228f, 0.498893f, 0.499557f, 0.500221f, 0.500885f, 0.501549f, 0.502212f, 0.502876f,
- 0.503538f, 0.504201f, 0.504863f, 0.505525f, 0.506187f, 0.506848f, 0.507509f, 0.508170f,
- 0.508830f, 0.509490f, 0.510150f, 0.510810f, 0.511469f, 0.512128f, 0.512786f, 0.513445f,
- 0.514103f, 0.514760f, 0.515418f, 0.516075f, 0.516732f, 0.517388f, 0.518045f, 0.518700f,
- 0.519356f, 0.520011f, 0.520666f, 0.521321f, 0.521975f, 0.522629f, 0.523283f, 0.523937f,
- 0.524590f, 0.525243f, 0.525895f, 0.526547f, 0.527199f, 0.527851f, 0.528502f, 0.529153f,
- 0.529804f, 0.530454f, 0.531104f, 0.531754f, 0.532403f, 0.533052f, 0.533701f, 0.534349f,
- 0.534998f, 0.535645f, 0.536293f, 0.536940f, 0.537587f, 0.538234f, 0.538880f, 0.539526f,
- 0.540171f, 0.540817f, 0.541462f, 0.542106f, 0.542751f, 0.543395f, 0.544039f, 0.544682f,
- 0.545325f, 0.545968f, 0.546610f, 0.547252f, 0.547894f, 0.548536f, 0.549177f, 0.549818f,
- 0.550458f, 0.551098f, 0.551738f, 0.552378f, 0.553017f, 0.553656f, 0.554294f, 0.554932f,
- 0.555570f, 0.556208f, 0.556845f, 0.557482f, 0.558119f, 0.558755f, 0.559391f, 0.560026f,
- 0.560662f, 0.561297f, 0.561931f, 0.562565f, 0.563199f, 0.563833f, 0.564466f, 0.565099f,
- 0.565732f, 0.566364f, 0.566996f, 0.567628f, 0.568259f, 0.568890f, 0.569521f, 0.570151f,
- 0.570781f, 0.571410f, 0.572040f, 0.572669f, 0.573297f, 0.573925f, 0.574553f, 0.575181f,
- 0.575808f, 0.576435f, 0.577062f, 0.577688f, 0.578314f, 0.578939f, 0.579565f, 0.580189f,
- 0.580814f, 0.581438f, 0.582062f, 0.582685f, 0.583309f, 0.583931f, 0.584554f, 0.585176f,
- 0.585798f, 0.586419f, 0.587040f, 0.587661f, 0.588282f, 0.588902f, 0.589521f, 0.590141f,
- 0.590760f, 0.591378f, 0.591997f, 0.592615f, 0.593232f, 0.593850f, 0.594467f, 0.595083f,
- 0.595699f, 0.596315f, 0.596931f, 0.597546f, 0.598161f, 0.598775f, 0.599389f, 0.600003f,
- 0.600616f, 0.601230f, 0.601842f, 0.602455f, 0.603067f, 0.603678f, 0.604290f, 0.604900f,
- 0.605511f, 0.606121f, 0.606731f, 0.607341f, 0.607950f, 0.608559f, 0.609167f, 0.609775f,
- 0.610383f, 0.610990f, 0.611597f, 0.612204f, 0.612810f, 0.613416f, 0.614022f, 0.614627f,
- 0.615232f, 0.615836f, 0.616440f, 0.617044f, 0.617647f, 0.618250f, 0.618853f, 0.619455f,
- 0.620057f, 0.620659f, 0.621260f, 0.621861f, 0.622461f, 0.623061f, 0.623661f, 0.624260f,
- 0.624860f, 0.625458f, 0.626056f, 0.626654f, 0.627252f, 0.627849f, 0.628446f, 0.629042f,
- 0.629638f, 0.630234f, 0.630829f, 0.631424f, 0.632019f, 0.632613f, 0.633207f, 0.633800f,
- 0.634393f, 0.634986f, 0.635578f, 0.636170f, 0.636762f, 0.637353f, 0.637944f, 0.638534f,
- 0.639124f, 0.639714f, 0.640303f, 0.640892f, 0.641481f, 0.642069f, 0.642657f, 0.643245f,
- 0.643832f, 0.644418f, 0.645005f, 0.645590f, 0.646176f, 0.646761f, 0.647346f, 0.647930f,
- 0.648514f, 0.649098f, 0.649681f, 0.650264f, 0.650847f, 0.651429f, 0.652011f, 0.652592f,
- 0.653173f, 0.653753f, 0.654334f, 0.654913f, 0.655493f, 0.656072f, 0.656651f, 0.657229f,
- 0.657807f, 0.658384f, 0.658961f, 0.659538f, 0.660114f, 0.660690f, 0.661266f, 0.661841f,
- 0.662416f, 0.662990f, 0.663564f, 0.664138f, 0.664711f, 0.665284f, 0.665856f, 0.666428f,
- 0.667000f, 0.667571f, 0.668142f, 0.668712f, 0.669283f, 0.669852f, 0.670422f, 0.670990f,
- 0.671559f, 0.672127f, 0.672695f, 0.673262f, 0.673829f, 0.674396f, 0.674962f, 0.675527f,
- 0.676093f, 0.676658f, 0.677222f, 0.677786f, 0.678350f, 0.678913f, 0.679476f, 0.680039f,
- 0.680601f, 0.681163f, 0.681724f, 0.682285f, 0.682846f, 0.683406f, 0.683965f, 0.684525f,
- 0.685084f, 0.685642f, 0.686200f, 0.686758f, 0.687315f, 0.687872f, 0.688429f, 0.688985f,
- 0.689541f, 0.690096f, 0.690651f, 0.691205f, 0.691759f, 0.692313f, 0.692866f, 0.693419f,
- 0.693971f, 0.694524f, 0.695075f, 0.695626f, 0.696177f, 0.696728f, 0.697277f, 0.697827f,
- 0.698376f, 0.698925f, 0.699473f, 0.700021f, 0.700569f, 0.701116f, 0.701663f, 0.702209f,
- 0.702755f, 0.703300f, 0.703845f, 0.704390f, 0.704934f, 0.705478f, 0.706021f, 0.706564f,
- 0.707107f, 0.707649f, 0.708191f, 0.708732f, 0.709273f, 0.709813f, 0.710353f, 0.710893f,
- 0.711432f, 0.711971f, 0.712509f, 0.713047f, 0.713585f, 0.714122f, 0.714659f, 0.715195f,
- 0.715731f, 0.716266f, 0.716801f, 0.717336f, 0.717870f, 0.718404f, 0.718937f, 0.719470f,
- 0.720003f, 0.720535f, 0.721066f, 0.721597f, 0.722128f, 0.722659f, 0.723188f, 0.723718f,
- 0.724247f, 0.724776f, 0.725304f, 0.725832f, 0.726359f, 0.726886f, 0.727413f, 0.727939f,
- 0.728464f, 0.728990f, 0.729514f, 0.730039f, 0.730563f, 0.731086f, 0.731609f, 0.732132f,
- 0.732654f, 0.733176f, 0.733697f, 0.734218f, 0.734739f, 0.735259f, 0.735779f, 0.736298f,
- 0.736817f, 0.737335f, 0.737853f, 0.738370f, 0.738887f, 0.739404f, 0.739920f, 0.740436f,
- 0.740951f, 0.741466f, 0.741980f, 0.742494f, 0.743008f, 0.743521f, 0.744034f, 0.744546f,
- 0.745058f, 0.745569f, 0.746080f, 0.746591f, 0.747101f, 0.747610f, 0.748119f, 0.748628f,
- 0.749136f, 0.749644f, 0.750152f, 0.750659f, 0.751165f, 0.751671f, 0.752177f, 0.752682f,
- 0.753187f, 0.753691f, 0.754195f, 0.754698f, 0.755201f, 0.755704f, 0.756206f, 0.756708f,
- 0.757209f, 0.757710f, 0.758210f, 0.758710f, 0.759209f, 0.759708f, 0.760207f, 0.760705f,
- 0.761202f, 0.761700f, 0.762196f, 0.762693f, 0.763188f, 0.763684f, 0.764179f, 0.764673f,
- 0.765167f, 0.765661f, 0.766154f, 0.766647f, 0.767139f, 0.767631f, 0.768122f, 0.768613f,
- 0.769103f, 0.769593f, 0.770083f, 0.770572f, 0.771061f, 0.771549f, 0.772036f, 0.772524f,
- 0.773010f, 0.773497f, 0.773983f, 0.774468f, 0.774953f, 0.775438f, 0.775922f, 0.776405f,
- 0.776888f, 0.777371f, 0.777853f, 0.778335f, 0.778817f, 0.779297f, 0.779778f, 0.780258f,
- 0.780737f, 0.781216f, 0.781695f, 0.782173f, 0.782651f, 0.783128f, 0.783605f, 0.784081f,
- 0.784557f, 0.785032f, 0.785507f, 0.785981f, 0.786455f, 0.786929f, 0.787402f, 0.787874f,
- 0.788346f, 0.788818f, 0.789289f, 0.789760f, 0.790230f, 0.790700f, 0.791169f, 0.791638f,
- 0.792107f, 0.792575f, 0.793042f, 0.793509f, 0.793975f, 0.794442f, 0.794907f, 0.795372f,
- 0.795837f, 0.796301f, 0.796765f, 0.797228f, 0.797691f, 0.798153f, 0.798615f, 0.799076f,
- 0.799537f, 0.799998f, 0.800458f, 0.800917f, 0.801376f, 0.801835f, 0.802293f, 0.802750f,
- 0.803208f, 0.803664f, 0.804120f, 0.804576f, 0.805031f, 0.805486f, 0.805940f, 0.806394f,
- 0.806848f, 0.807300f, 0.807753f, 0.808205f, 0.808656f, 0.809107f, 0.809558f, 0.810008f,
- 0.810457f, 0.810906f, 0.811355f, 0.811803f, 0.812251f, 0.812698f, 0.813144f, 0.813591f,
- 0.814036f, 0.814482f, 0.814926f, 0.815371f, 0.815814f, 0.816258f, 0.816701f, 0.817143f,
- 0.817585f, 0.818026f, 0.818467f, 0.818908f, 0.819348f, 0.819787f, 0.820226f, 0.820664f,
- 0.821102f, 0.821540f, 0.821977f, 0.822414f, 0.822850f, 0.823285f, 0.823721f, 0.824155f,
- 0.824589f, 0.825023f, 0.825456f, 0.825889f, 0.826321f, 0.826753f, 0.827184f, 0.827615f,
- 0.828045f, 0.828475f, 0.828904f, 0.829333f, 0.829761f, 0.830189f, 0.830616f, 0.831043f,
- 0.831470f, 0.831895f, 0.832321f, 0.832746f, 0.833170f, 0.833594f, 0.834018f, 0.834440f,
- 0.834863f, 0.835285f, 0.835706f, 0.836127f, 0.836548f, 0.836968f, 0.837387f, 0.837806f,
- 0.838225f, 0.838643f, 0.839060f, 0.839477f, 0.839894f, 0.840310f, 0.840725f, 0.841140f,
- 0.841555f, 0.841969f, 0.842383f, 0.842796f, 0.843208f, 0.843620f, 0.844032f, 0.844443f,
- 0.844854f, 0.845264f, 0.845673f, 0.846082f, 0.846491f, 0.846899f, 0.847307f, 0.847714f,
- 0.848120f, 0.848526f, 0.848932f, 0.849337f, 0.849742f, 0.850146f, 0.850549f, 0.850953f,
- 0.851355f, 0.851757f, 0.852159f, 0.852560f, 0.852961f, 0.853361f, 0.853760f, 0.854159f,
- 0.854558f, 0.854956f, 0.855354f, 0.855751f, 0.856147f, 0.856543f, 0.856939f, 0.857334f,
- 0.857729f, 0.858123f, 0.858516f, 0.858909f, 0.859302f, 0.859694f, 0.860085f, 0.860476f,
- 0.860867f, 0.861257f, 0.861646f, 0.862035f, 0.862424f, 0.862812f, 0.863199f, 0.863586f,
- 0.863973f, 0.864359f, 0.864744f, 0.865129f, 0.865514f, 0.865898f, 0.866281f, 0.866664f,
- 0.867046f, 0.867428f, 0.867809f, 0.868190f, 0.868571f, 0.868951f, 0.869330f, 0.869709f,
- 0.870087f, 0.870465f, 0.870842f, 0.871219f, 0.871595f, 0.871971f, 0.872346f, 0.872721f,
- 0.873095f, 0.873469f, 0.873842f, 0.874215f, 0.874587f, 0.874958f, 0.875329f, 0.875700f,
- 0.876070f, 0.876440f, 0.876809f, 0.877177f, 0.877545f, 0.877913f, 0.878280f, 0.878646f,
- 0.879012f, 0.879378f, 0.879743f, 0.880107f, 0.880471f, 0.880834f, 0.881197f, 0.881559f,
- 0.881921f, 0.882283f, 0.882643f, 0.883004f, 0.883363f, 0.883723f, 0.884081f, 0.884439f,
- 0.884797f, 0.885154f, 0.885511f, 0.885867f, 0.886223f, 0.886578f, 0.886932f, 0.887286f,
- 0.887640f, 0.887993f, 0.888345f, 0.888697f, 0.889048f, 0.889399f, 0.889750f, 0.890099f,
- 0.890449f, 0.890797f, 0.891146f, 0.891493f, 0.891841f, 0.892187f, 0.892534f, 0.892879f,
- 0.893224f, 0.893569f, 0.893913f, 0.894256f, 0.894599f, 0.894942f, 0.895284f, 0.895625f,
- 0.895966f, 0.896307f, 0.896646f, 0.896986f, 0.897325f, 0.897663f, 0.898001f, 0.898338f,
- 0.898674f, 0.899011f, 0.899346f, 0.899681f, 0.900016f, 0.900350f, 0.900683f, 0.901016f,
- 0.901349f, 0.901681f, 0.902012f, 0.902343f, 0.902673f, 0.903003f, 0.903332f, 0.903661f,
- 0.903989f, 0.904317f, 0.904644f, 0.904971f, 0.905297f, 0.905622f, 0.905947f, 0.906272f,
- 0.906596f, 0.906919f, 0.907242f, 0.907564f, 0.907886f, 0.908207f, 0.908528f, 0.908848f,
- 0.909168f, 0.909487f, 0.909806f, 0.910124f, 0.910441f, 0.910758f, 0.911075f, 0.911391f,
- 0.911706f, 0.912021f, 0.912335f, 0.912649f, 0.912962f, 0.913275f, 0.913587f, 0.913899f,
- 0.914210f, 0.914520f, 0.914830f, 0.915140f, 0.915449f, 0.915757f, 0.916065f, 0.916372f,
- 0.916679f, 0.916985f, 0.917291f, 0.917596f, 0.917901f, 0.918205f, 0.918508f, 0.918811f,
- 0.919114f, 0.919416f, 0.919717f, 0.920018f, 0.920318f, 0.920618f, 0.920917f, 0.921216f,
- 0.921514f, 0.921812f, 0.922109f, 0.922405f, 0.922701f, 0.922997f, 0.923291f, 0.923586f,
- 0.923880f, 0.924173f, 0.924465f, 0.924758f, 0.925049f, 0.925340f, 0.925631f, 0.925921f,
- 0.926210f, 0.926499f, 0.926787f, 0.927075f, 0.927363f, 0.927649f, 0.927935f, 0.928221f,
- 0.928506f, 0.928791f, 0.929075f, 0.929358f, 0.929641f, 0.929923f, 0.930205f, 0.930486f,
- 0.930767f, 0.931047f, 0.931327f, 0.931606f, 0.931884f, 0.932162f, 0.932440f, 0.932716f,
- 0.932993f, 0.933269f, 0.933544f, 0.933818f, 0.934093f, 0.934366f, 0.934639f, 0.934912f,
- 0.935184f, 0.935455f, 0.935726f, 0.935996f, 0.936266f, 0.936535f, 0.936803f, 0.937072f,
- 0.937339f, 0.937606f, 0.937872f, 0.938138f, 0.938404f, 0.938668f, 0.938932f, 0.939196f,
- 0.939459f, 0.939722f, 0.939984f, 0.940245f, 0.940506f, 0.940766f, 0.941026f, 0.941285f,
- 0.941544f, 0.941802f, 0.942060f, 0.942317f, 0.942573f, 0.942829f, 0.943084f, 0.943339f,
- 0.943593f, 0.943847f, 0.944100f, 0.944353f, 0.944605f, 0.944856f, 0.945107f, 0.945358f,
- 0.945607f, 0.945857f, 0.946105f, 0.946353f, 0.946601f, 0.946848f, 0.947094f, 0.947340f,
- 0.947586f, 0.947830f, 0.948075f, 0.948318f, 0.948561f, 0.948804f, 0.949046f, 0.949287f,
- 0.949528f, 0.949768f, 0.950008f, 0.950247f, 0.950486f, 0.950724f, 0.950962f, 0.951199f,
- 0.951435f, 0.951671f, 0.951906f, 0.952141f, 0.952375f, 0.952609f, 0.952842f, 0.953074f,
- 0.953306f, 0.953537f, 0.953768f, 0.953998f, 0.954228f, 0.954457f, 0.954686f, 0.954914f,
- 0.955141f, 0.955368f, 0.955594f, 0.955820f, 0.956045f, 0.956270f, 0.956494f, 0.956717f,
- 0.956940f, 0.957163f, 0.957385f, 0.957606f, 0.957826f, 0.958046f, 0.958266f, 0.958485f,
- 0.958703f, 0.958921f, 0.959139f, 0.959355f, 0.959572f, 0.959787f, 0.960002f, 0.960217f,
- 0.960431f, 0.960644f, 0.960857f, 0.961069f, 0.961280f, 0.961492f, 0.961702f, 0.961912f,
- 0.962121f, 0.962330f, 0.962538f, 0.962746f, 0.962953f, 0.963160f, 0.963366f, 0.963571f,
- 0.963776f, 0.963980f, 0.964184f, 0.964387f, 0.964590f, 0.964792f, 0.964993f, 0.965194f,
- 0.965394f, 0.965594f, 0.965793f, 0.965992f, 0.966190f, 0.966387f, 0.966584f, 0.966781f,
- 0.966976f, 0.967172f, 0.967366f, 0.967560f, 0.967754f, 0.967947f, 0.968139f, 0.968331f,
- 0.968522f, 0.968713f, 0.968903f, 0.969092f, 0.969281f, 0.969470f, 0.969657f, 0.969845f,
- 0.970031f, 0.970217f, 0.970403f, 0.970588f, 0.970772f, 0.970956f, 0.971139f, 0.971322f,
- 0.971504f, 0.971685f, 0.971866f, 0.972047f, 0.972227f, 0.972406f, 0.972584f, 0.972762f,
- 0.972940f, 0.973117f, 0.973293f, 0.973469f, 0.973644f, 0.973819f, 0.973993f, 0.974166f,
- 0.974339f, 0.974512f, 0.974684f, 0.974855f, 0.975025f, 0.975195f, 0.975365f, 0.975534f,
- 0.975702f, 0.975870f, 0.976037f, 0.976204f, 0.976370f, 0.976535f, 0.976700f, 0.976864f,
- 0.977028f, 0.977191f, 0.977354f, 0.977516f, 0.977677f, 0.977838f, 0.977998f, 0.978158f,
- 0.978317f, 0.978476f, 0.978634f, 0.978791f, 0.978948f, 0.979104f, 0.979260f, 0.979415f,
- 0.979570f, 0.979724f, 0.979877f, 0.980030f, 0.980182f, 0.980334f, 0.980485f, 0.980635f,
- 0.980785f, 0.980935f, 0.981083f, 0.981232f, 0.981379f, 0.981526f, 0.981673f, 0.981819f,
- 0.981964f, 0.982109f, 0.982253f, 0.982396f, 0.982539f, 0.982682f, 0.982824f, 0.982965f,
- 0.983105f, 0.983246f, 0.983385f, 0.983524f, 0.983662f, 0.983800f, 0.983937f, 0.984074f,
- 0.984210f, 0.984346f, 0.984480f, 0.984615f, 0.984748f, 0.984882f, 0.985014f, 0.985146f,
- 0.985278f, 0.985408f, 0.985539f, 0.985668f, 0.985798f, 0.985926f, 0.986054f, 0.986181f,
- 0.986308f, 0.986434f, 0.986560f, 0.986685f, 0.986809f, 0.986933f, 0.987057f, 0.987179f,
- 0.987301f, 0.987423f, 0.987544f, 0.987664f, 0.987784f, 0.987903f, 0.988022f, 0.988140f,
- 0.988258f, 0.988374f, 0.988491f, 0.988607f, 0.988722f, 0.988836f, 0.988950f, 0.989064f,
- 0.989177f, 0.989289f, 0.989400f, 0.989511f, 0.989622f, 0.989732f, 0.989841f, 0.989950f,
- 0.990058f, 0.990166f, 0.990273f, 0.990379f, 0.990485f, 0.990590f, 0.990695f, 0.990799f,
- 0.990903f, 0.991006f, 0.991108f, 0.991210f, 0.991311f, 0.991411f, 0.991511f, 0.991611f,
- 0.991710f, 0.991808f, 0.991906f, 0.992003f, 0.992099f, 0.992195f, 0.992291f, 0.992385f,
- 0.992480f, 0.992573f, 0.992666f, 0.992759f, 0.992850f, 0.992942f, 0.993032f, 0.993122f,
- 0.993212f, 0.993301f, 0.993389f, 0.993477f, 0.993564f, 0.993651f, 0.993737f, 0.993822f,
- 0.993907f, 0.993991f, 0.994075f, 0.994158f, 0.994240f, 0.994322f, 0.994404f, 0.994484f,
- 0.994565f, 0.994644f, 0.994723f, 0.994802f, 0.994879f, 0.994957f, 0.995033f, 0.995109f,
- 0.995185f, 0.995260f, 0.995334f, 0.995408f, 0.995481f, 0.995553f, 0.995625f, 0.995697f,
- 0.995767f, 0.995838f, 0.995907f, 0.995976f, 0.996045f, 0.996113f, 0.996180f, 0.996247f,
- 0.996313f, 0.996378f, 0.996443f, 0.996507f, 0.996571f, 0.996634f, 0.996697f, 0.996759f,
- 0.996820f, 0.996881f, 0.996941f, 0.997001f, 0.997060f, 0.997119f, 0.997176f, 0.997234f,
- 0.997290f, 0.997347f, 0.997402f, 0.997457f, 0.997511f, 0.997565f, 0.997618f, 0.997671f,
- 0.997723f, 0.997774f, 0.997825f, 0.997876f, 0.997925f, 0.997974f, 0.998023f, 0.998071f,
- 0.998118f, 0.998165f, 0.998211f, 0.998257f, 0.998302f, 0.998346f, 0.998390f, 0.998433f,
- 0.998476f, 0.998518f, 0.998559f, 0.998600f, 0.998640f, 0.998680f, 0.998719f, 0.998758f,
- 0.998795f, 0.998833f, 0.998870f, 0.998906f, 0.998941f, 0.998976f, 0.999011f, 0.999044f,
- 0.999078f, 0.999110f, 0.999142f, 0.999174f, 0.999205f, 0.999235f, 0.999265f, 0.999294f,
- 0.999322f, 0.999350f, 0.999378f, 0.999404f, 0.999431f, 0.999456f, 0.999481f, 0.999506f,
- 0.999529f, 0.999553f, 0.999575f, 0.999597f, 0.999619f, 0.999640f, 0.999660f, 0.999680f,
- 0.999699f, 0.999717f, 0.999735f, 0.999753f, 0.999769f, 0.999786f, 0.999801f, 0.999816f,
- 0.999831f, 0.999844f, 0.999858f, 0.999870f, 0.999882f, 0.999894f, 0.999905f, 0.999915f,
- 0.999925f, 0.999934f, 0.999942f, 0.999950f, 0.999958f, 0.999964f, 0.999971f, 0.999976f,
- 0.999981f, 0.999986f, 0.999989f, 0.999993f, 0.999995f, 0.999997f, 0.999999f, 1.000000
-};
-
-static const float cosTable16384[8192] = {
- 1.000000f, 1.000000f, 1.000000f, 0.999999f, 0.999999f, 0.999998f, 0.999997f, 0.999996f,
- 0.999995f, 0.999994f, 0.999993f, 0.999991f, 0.999989f, 0.999988f, 0.999986f, 0.999983f,
- 0.999981f, 0.999979f, 0.999976f, 0.999973f, 0.999971f, 0.999968f, 0.999964f, 0.999961f,
- 0.999958f, 0.999954f, 0.999950f, 0.999946f, 0.999942f, 0.999938f, 0.999934f, 0.999929f,
- 0.999925f, 0.999920f, 0.999915f, 0.999910f, 0.999905f, 0.999899f, 0.999894f, 0.999888f,
- 0.999882f, 0.999876f, 0.999870f, 0.999864f, 0.999858f, 0.999851f, 0.999844f, 0.999838f,
- 0.999831f, 0.999823f, 0.999816f, 0.999809f, 0.999801f, 0.999793f, 0.999786f, 0.999778f,
- 0.999769f, 0.999761f, 0.999753f, 0.999744f, 0.999735f, 0.999726f, 0.999717f, 0.999708f,
- 0.999699f, 0.999689f, 0.999680f, 0.999670f, 0.999660f, 0.999650f, 0.999640f, 0.999629f,
- 0.999619f, 0.999608f, 0.999597f, 0.999586f, 0.999575f, 0.999564f, 0.999553f, 0.999541f,
- 0.999529f, 0.999518f, 0.999506f, 0.999493f, 0.999481f, 0.999469f, 0.999456f, 0.999443f,
- 0.999431f, 0.999418f, 0.999404f, 0.999391f, 0.999378f, 0.999364f, 0.999350f, 0.999336f,
- 0.999322f, 0.999308f, 0.999294f, 0.999279f, 0.999265f, 0.999250f, 0.999235f, 0.999220f,
- 0.999205f, 0.999189f, 0.999174f, 0.999158f, 0.999142f, 0.999126f, 0.999110f, 0.999094f,
- 0.999078f, 0.999061f, 0.999044f, 0.999028f, 0.999011f, 0.998994f, 0.998976f, 0.998959f,
- 0.998941f, 0.998924f, 0.998906f, 0.998888f, 0.998870f, 0.998851f, 0.998833f, 0.998814f,
- 0.998795f, 0.998777f, 0.998758f, 0.998738f, 0.998719f, 0.998700f, 0.998680f, 0.998660f,
- 0.998640f, 0.998620f, 0.998600f, 0.998580f, 0.998559f, 0.998538f, 0.998518f, 0.998497f,
- 0.998476f, 0.998454f, 0.998433f, 0.998411f, 0.998390f, 0.998368f, 0.998346f, 0.998324f,
- 0.998302f, 0.998279f, 0.998257f, 0.998234f, 0.998211f, 0.998188f, 0.998165f, 0.998142f,
- 0.998118f, 0.998094f, 0.998071f, 0.998047f, 0.998023f, 0.997999f, 0.997974f, 0.997950f,
- 0.997925f, 0.997901f, 0.997876f, 0.997851f, 0.997825f, 0.997800f, 0.997774f, 0.997749f,
- 0.997723f, 0.997697f, 0.997671f, 0.997645f, 0.997618f, 0.997592f, 0.997565f, 0.997538f,
- 0.997511f, 0.997484f, 0.997457f, 0.997430f, 0.997402f, 0.997374f, 0.997347f, 0.997319f,
- 0.997290f, 0.997262f, 0.997234f, 0.997205f, 0.997176f, 0.997148f, 0.997119f, 0.997089f,
- 0.997060f, 0.997031f, 0.997001f, 0.996971f, 0.996941f, 0.996911f, 0.996881f, 0.996851f,
- 0.996820f, 0.996790f, 0.996759f, 0.996728f, 0.996697f, 0.996666f, 0.996634f, 0.996603f,
- 0.996571f, 0.996539f, 0.996507f, 0.996475f, 0.996443f, 0.996411f, 0.996378f, 0.996345f,
- 0.996313f, 0.996280f, 0.996247f, 0.996213f, 0.996180f, 0.996146f, 0.996113f, 0.996079f,
- 0.996045f, 0.996011f, 0.995976f, 0.995942f, 0.995907f, 0.995872f, 0.995838f, 0.995803f,
- 0.995767f, 0.995732f, 0.995697f, 0.995661f, 0.995625f, 0.995589f, 0.995553f, 0.995517f,
- 0.995481f, 0.995444f, 0.995408f, 0.995371f, 0.995334f, 0.995297f, 0.995260f, 0.995222f,
- 0.995185f, 0.995147f, 0.995109f, 0.995071f, 0.995033f, 0.994995f, 0.994957f, 0.994918f,
- 0.994879f, 0.994841f, 0.994802f, 0.994762f, 0.994723f, 0.994684f, 0.994644f, 0.994604f,
- 0.994565f, 0.994525f, 0.994484f, 0.994444f, 0.994404f, 0.994363f, 0.994322f, 0.994281f,
- 0.994240f, 0.994199f, 0.994158f, 0.994116f, 0.994075f, 0.994033f, 0.993991f, 0.993949f,
- 0.993907f, 0.993865f, 0.993822f, 0.993779f, 0.993737f, 0.993694f, 0.993651f, 0.993608f,
- 0.993564f, 0.993521f, 0.993477f, 0.993433f, 0.993389f, 0.993345f, 0.993301f, 0.993257f,
- 0.993212f, 0.993167f, 0.993122f, 0.993077f, 0.993032f, 0.992987f, 0.992942f, 0.992896f,
- 0.992850f, 0.992805f, 0.992759f, 0.992712f, 0.992666f, 0.992620f, 0.992573f, 0.992526f,
- 0.992480f, 0.992433f, 0.992385f, 0.992338f, 0.992291f, 0.992243f, 0.992195f, 0.992147f,
- 0.992099f, 0.992051f, 0.992003f, 0.991954f, 0.991906f, 0.991857f, 0.991808f, 0.991759f,
- 0.991710f, 0.991660f, 0.991611f, 0.991561f, 0.991511f, 0.991462f, 0.991411f, 0.991361f,
- 0.991311f, 0.991260f, 0.991210f, 0.991159f, 0.991108f, 0.991057f, 0.991006f, 0.990954f,
- 0.990903f, 0.990851f, 0.990799f, 0.990747f, 0.990695f, 0.990643f, 0.990590f, 0.990538f,
- 0.990485f, 0.990432f, 0.990379f, 0.990326f, 0.990273f, 0.990219f, 0.990166f, 0.990112f,
- 0.990058f, 0.990004f, 0.989950f, 0.989896f, 0.989841f, 0.989787f, 0.989732f, 0.989677f,
- 0.989622f, 0.989567f, 0.989511f, 0.989456f, 0.989400f, 0.989345f, 0.989289f, 0.989233f,
- 0.989177f, 0.989120f, 0.989064f, 0.989007f, 0.988950f, 0.988893f, 0.988836f, 0.988779f,
- 0.988722f, 0.988664f, 0.988607f, 0.988549f, 0.988491f, 0.988433f, 0.988374f, 0.988316f,
- 0.988258f, 0.988199f, 0.988140f, 0.988081f, 0.988022f, 0.987963f, 0.987903f, 0.987844f,
- 0.987784f, 0.987724f, 0.987664f, 0.987604f, 0.987544f, 0.987484f, 0.987423f, 0.987362f,
- 0.987301f, 0.987240f, 0.987179f, 0.987118f, 0.987057f, 0.986995f, 0.986933f, 0.986871f,
- 0.986809f, 0.986747f, 0.986685f, 0.986623f, 0.986560f, 0.986497f, 0.986434f, 0.986371f,
- 0.986308f, 0.986245f, 0.986181f, 0.986118f, 0.986054f, 0.985990f, 0.985926f, 0.985862f,
- 0.985798f, 0.985733f, 0.985668f, 0.985604f, 0.985539f, 0.985474f, 0.985408f, 0.985343f,
- 0.985278f, 0.985212f, 0.985146f, 0.985080f, 0.985014f, 0.984948f, 0.984882f, 0.984815f,
- 0.984748f, 0.984682f, 0.984615f, 0.984548f, 0.984480f, 0.984413f, 0.984346f, 0.984278f,
- 0.984210f, 0.984142f, 0.984074f, 0.984006f, 0.983937f, 0.983869f, 0.983800f, 0.983731f,
- 0.983662f, 0.983593f, 0.983524f, 0.983455f, 0.983385f, 0.983315f, 0.983246f, 0.983176f,
- 0.983105f, 0.983035f, 0.982965f, 0.982894f, 0.982824f, 0.982753f, 0.982682f, 0.982611f,
- 0.982539f, 0.982468f, 0.982396f, 0.982325f, 0.982253f, 0.982181f, 0.982109f, 0.982036f,
- 0.981964f, 0.981891f, 0.981819f, 0.981746f, 0.981673f, 0.981600f, 0.981526f, 0.981453f,
- 0.981379f, 0.981305f, 0.981232f, 0.981158f, 0.981083f, 0.981009f, 0.980935f, 0.980860f,
- 0.980785f, 0.980710f, 0.980635f, 0.980560f, 0.980485f, 0.980409f, 0.980334f, 0.980258f,
- 0.980182f, 0.980106f, 0.980030f, 0.979954f, 0.979877f, 0.979800f, 0.979724f, 0.979647f,
- 0.979570f, 0.979493f, 0.979415f, 0.979338f, 0.979260f, 0.979182f, 0.979104f, 0.979026f,
- 0.978948f, 0.978870f, 0.978791f, 0.978713f, 0.978634f, 0.978555f, 0.978476f, 0.978397f,
- 0.978317f, 0.978238f, 0.978158f, 0.978078f, 0.977998f, 0.977918f, 0.977838f, 0.977758f,
- 0.977677f, 0.977597f, 0.977516f, 0.977435f, 0.977354f, 0.977273f, 0.977191f, 0.977110f,
- 0.977028f, 0.976946f, 0.976864f, 0.976782f, 0.976700f, 0.976618f, 0.976535f, 0.976453f,
- 0.976370f, 0.976287f, 0.976204f, 0.976120f, 0.976037f, 0.975954f, 0.975870f, 0.975786f,
- 0.975702f, 0.975618f, 0.975534f, 0.975449f, 0.975365f, 0.975280f, 0.975195f, 0.975110f,
- 0.975025f, 0.974940f, 0.974855f, 0.974769f, 0.974684f, 0.974598f, 0.974512f, 0.974426f,
- 0.974339f, 0.974253f, 0.974166f, 0.974080f, 0.973993f, 0.973906f, 0.973819f, 0.973732f,
- 0.973644f, 0.973557f, 0.973469f, 0.973381f, 0.973293f, 0.973205f, 0.973117f, 0.973028f,
- 0.972940f, 0.972851f, 0.972762f, 0.972673f, 0.972584f, 0.972495f, 0.972406f, 0.972316f,
- 0.972227f, 0.972137f, 0.972047f, 0.971957f, 0.971866f, 0.971776f, 0.971685f, 0.971595f,
- 0.971504f, 0.971413f, 0.971322f, 0.971231f, 0.971139f, 0.971048f, 0.970956f, 0.970864f,
- 0.970772f, 0.970680f, 0.970588f, 0.970495f, 0.970403f, 0.970310f, 0.970217f, 0.970124f,
- 0.970031f, 0.969938f, 0.969845f, 0.969751f, 0.969657f, 0.969564f, 0.969470f, 0.969375f,
- 0.969281f, 0.969187f, 0.969092f, 0.968998f, 0.968903f, 0.968808f, 0.968713f, 0.968617f,
- 0.968522f, 0.968427f, 0.968331f, 0.968235f, 0.968139f, 0.968043f, 0.967947f, 0.967850f,
- 0.967754f, 0.967657f, 0.967560f, 0.967463f, 0.967366f, 0.967269f, 0.967172f, 0.967074f,
- 0.966976f, 0.966879f, 0.966781f, 0.966683f, 0.966584f, 0.966486f, 0.966387f, 0.966289f,
- 0.966190f, 0.966091f, 0.965992f, 0.965893f, 0.965793f, 0.965694f, 0.965594f, 0.965494f,
- 0.965394f, 0.965294f, 0.965194f, 0.965094f, 0.964993f, 0.964893f, 0.964792f, 0.964691f,
- 0.964590f, 0.964489f, 0.964387f, 0.964286f, 0.964184f, 0.964082f, 0.963980f, 0.963878f,
- 0.963776f, 0.963674f, 0.963571f, 0.963469f, 0.963366f, 0.963263f, 0.963160f, 0.963057f,
- 0.962953f, 0.962850f, 0.962746f, 0.962642f, 0.962538f, 0.962434f, 0.962330f, 0.962226f,
- 0.962121f, 0.962017f, 0.961912f, 0.961807f, 0.961702f, 0.961597f, 0.961492f, 0.961386f,
- 0.961280f, 0.961175f, 0.961069f, 0.960963f, 0.960857f, 0.960750f, 0.960644f, 0.960537f,
- 0.960431f, 0.960324f, 0.960217f, 0.960109f, 0.960002f, 0.959895f, 0.959787f, 0.959679f,
- 0.959572f, 0.959463f, 0.959355f, 0.959247f, 0.959139f, 0.959030f, 0.958921f, 0.958812f,
- 0.958703f, 0.958594f, 0.958485f, 0.958376f, 0.958266f, 0.958156f, 0.958046f, 0.957937f,
- 0.957826f, 0.957716f, 0.957606f, 0.957495f, 0.957385f, 0.957274f, 0.957163f, 0.957052f,
- 0.956940f, 0.956829f, 0.956717f, 0.956606f, 0.956494f, 0.956382f, 0.956270f, 0.956158f,
- 0.956045f, 0.955933f, 0.955820f, 0.955707f, 0.955594f, 0.955481f, 0.955368f, 0.955255f,
- 0.955141f, 0.955028f, 0.954914f, 0.954800f, 0.954686f, 0.954572f, 0.954457f, 0.954343f,
- 0.954228f, 0.954113f, 0.953998f, 0.953883f, 0.953768f, 0.953653f, 0.953537f, 0.953422f,
- 0.953306f, 0.953190f, 0.953074f, 0.952958f, 0.952842f, 0.952725f, 0.952609f, 0.952492f,
- 0.952375f, 0.952258f, 0.952141f, 0.952024f, 0.951906f, 0.951789f, 0.951671f, 0.951553f,
- 0.951435f, 0.951317f, 0.951199f, 0.951080f, 0.950962f, 0.950843f, 0.950724f, 0.950605f,
- 0.950486f, 0.950367f, 0.950247f, 0.950128f, 0.950008f, 0.949888f, 0.949768f, 0.949648f,
- 0.949528f, 0.949408f, 0.949287f, 0.949167f, 0.949046f, 0.948925f, 0.948804f, 0.948683f,
- 0.948561f, 0.948440f, 0.948318f, 0.948196f, 0.948075f, 0.947953f, 0.947830f, 0.947708f,
- 0.947586f, 0.947463f, 0.947340f, 0.947217f, 0.947094f, 0.946971f, 0.946848f, 0.946724f,
- 0.946601f, 0.946477f, 0.946353f, 0.946229f, 0.946105f, 0.945981f, 0.945857f, 0.945732f,
- 0.945607f, 0.945482f, 0.945358f, 0.945232f, 0.945107f, 0.944982f, 0.944856f, 0.944731f,
- 0.944605f, 0.944479f, 0.944353f, 0.944227f, 0.944100f, 0.943974f, 0.943847f, 0.943720f,
- 0.943593f, 0.943466f, 0.943339f, 0.943212f, 0.943084f, 0.942957f, 0.942829f, 0.942701f,
- 0.942573f, 0.942445f, 0.942317f, 0.942188f, 0.942060f, 0.941931f, 0.941802f, 0.941673f,
- 0.941544f, 0.941415f, 0.941285f, 0.941156f, 0.941026f, 0.940896f, 0.940766f, 0.940636f,
- 0.940506f, 0.940376f, 0.940245f, 0.940115f, 0.939984f, 0.939853f, 0.939722f, 0.939591f,
- 0.939459f, 0.939328f, 0.939196f, 0.939064f, 0.938932f, 0.938800f, 0.938668f, 0.938536f,
- 0.938404f, 0.938271f, 0.938138f, 0.938005f, 0.937872f, 0.937739f, 0.937606f, 0.937473f,
- 0.937339f, 0.937205f, 0.937072f, 0.936938f, 0.936803f, 0.936669f, 0.936535f, 0.936400f,
- 0.936266f, 0.936131f, 0.935996f, 0.935861f, 0.935726f, 0.935590f, 0.935455f, 0.935319f,
- 0.935184f, 0.935048f, 0.934912f, 0.934775f, 0.934639f, 0.934503f, 0.934366f, 0.934229f,
- 0.934093f, 0.933956f, 0.933818f, 0.933681f, 0.933544f, 0.933406f, 0.933269f, 0.933131f,
- 0.932993f, 0.932855f, 0.932716f, 0.932578f, 0.932440f, 0.932301f, 0.932162f, 0.932023f,
- 0.931884f, 0.931745f, 0.931606f, 0.931466f, 0.931327f, 0.931187f, 0.931047f, 0.930907f,
- 0.930767f, 0.930627f, 0.930486f, 0.930346f, 0.930205f, 0.930064f, 0.929923f, 0.929782f,
- 0.929641f, 0.929500f, 0.929358f, 0.929216f, 0.929075f, 0.928933f, 0.928791f, 0.928648f,
- 0.928506f, 0.928364f, 0.928221f, 0.928078f, 0.927935f, 0.927792f, 0.927649f, 0.927506f,
- 0.927363f, 0.927219f, 0.927075f, 0.926931f, 0.926787f, 0.926643f, 0.926499f, 0.926355f,
- 0.926210f, 0.926066f, 0.925921f, 0.925776f, 0.925631f, 0.925486f, 0.925340f, 0.925195f,
- 0.925049f, 0.924904f, 0.924758f, 0.924612f, 0.924465f, 0.924319f, 0.924173f, 0.924026f,
- 0.923880f, 0.923733f, 0.923586f, 0.923439f, 0.923291f, 0.923144f, 0.922997f, 0.922849f,
- 0.922701f, 0.922553f, 0.922405f, 0.922257f, 0.922109f, 0.921960f, 0.921812f, 0.921663f,
- 0.921514f, 0.921365f, 0.921216f, 0.921067f, 0.920917f, 0.920768f, 0.920618f, 0.920468f,
- 0.920318f, 0.920168f, 0.920018f, 0.919868f, 0.919717f, 0.919567f, 0.919416f, 0.919265f,
- 0.919114f, 0.918963f, 0.918811f, 0.918660f, 0.918508f, 0.918357f, 0.918205f, 0.918053f,
- 0.917901f, 0.917749f, 0.917596f, 0.917444f, 0.917291f, 0.917138f, 0.916985f, 0.916832f,
- 0.916679f, 0.916526f, 0.916372f, 0.916219f, 0.916065f, 0.915911f, 0.915757f, 0.915603f,
- 0.915449f, 0.915294f, 0.915140f, 0.914985f, 0.914830f, 0.914675f, 0.914520f, 0.914365f,
- 0.914210f, 0.914054f, 0.913899f, 0.913743f, 0.913587f, 0.913431f, 0.913275f, 0.913119f,
- 0.912962f, 0.912806f, 0.912649f, 0.912492f, 0.912335f, 0.912178f, 0.912021f, 0.911864f,
- 0.911706f, 0.911548f, 0.911391f, 0.911233f, 0.911075f, 0.910917f, 0.910758f, 0.910600f,
- 0.910441f, 0.910283f, 0.910124f, 0.909965f, 0.909806f, 0.909646f, 0.909487f, 0.909328f,
- 0.909168f, 0.909008f, 0.908848f, 0.908688f, 0.908528f, 0.908368f, 0.908207f, 0.908047f,
- 0.907886f, 0.907725f, 0.907564f, 0.907403f, 0.907242f, 0.907081f, 0.906919f, 0.906757f,
- 0.906596f, 0.906434f, 0.906272f, 0.906110f, 0.905947f, 0.905785f, 0.905622f, 0.905460f,
- 0.905297f, 0.905134f, 0.904971f, 0.904807f, 0.904644f, 0.904481f, 0.904317f, 0.904153f,
- 0.903989f, 0.903825f, 0.903661f, 0.903497f, 0.903332f, 0.903168f, 0.903003f, 0.902838f,
- 0.902673f, 0.902508f, 0.902343f, 0.902178f, 0.902012f, 0.901847f, 0.901681f, 0.901515f,
- 0.901349f, 0.901183f, 0.901016f, 0.900850f, 0.900683f, 0.900517f, 0.900350f, 0.900183f,
- 0.900016f, 0.899849f, 0.899681f, 0.899514f, 0.899346f, 0.899179f, 0.899011f, 0.898843f,
- 0.898674f, 0.898506f, 0.898338f, 0.898169f, 0.898001f, 0.897832f, 0.897663f, 0.897494f,
- 0.897325f, 0.897155f, 0.896986f, 0.896816f, 0.896646f, 0.896477f, 0.896307f, 0.896137f,
- 0.895966f, 0.895796f, 0.895625f, 0.895455f, 0.895284f, 0.895113f, 0.894942f, 0.894771f,
- 0.894599f, 0.894428f, 0.894256f, 0.894085f, 0.893913f, 0.893741f, 0.893569f, 0.893397f,
- 0.893224f, 0.893052f, 0.892879f, 0.892706f, 0.892534f, 0.892361f, 0.892187f, 0.892014f,
- 0.891841f, 0.891667f, 0.891493f, 0.891320f, 0.891146f, 0.890972f, 0.890797f, 0.890623f,
- 0.890449f, 0.890274f, 0.890099f, 0.889925f, 0.889750f, 0.889574f, 0.889399f, 0.889224f,
- 0.889048f, 0.888873f, 0.888697f, 0.888521f, 0.888345f, 0.888169f, 0.887993f, 0.887816f,
- 0.887640f, 0.887463f, 0.887286f, 0.887109f, 0.886932f, 0.886755f, 0.886578f, 0.886400f,
- 0.886223f, 0.886045f, 0.885867f, 0.885689f, 0.885511f, 0.885333f, 0.885154f, 0.884976f,
- 0.884797f, 0.884618f, 0.884439f, 0.884260f, 0.884081f, 0.883902f, 0.883723f, 0.883543f,
- 0.883363f, 0.883184f, 0.883004f, 0.882824f, 0.882643f, 0.882463f, 0.882283f, 0.882102f,
- 0.881921f, 0.881740f, 0.881559f, 0.881378f, 0.881197f, 0.881016f, 0.880834f, 0.880653f,
- 0.880471f, 0.880289f, 0.880107f, 0.879925f, 0.879743f, 0.879560f, 0.879378f, 0.879195f,
- 0.879012f, 0.878829f, 0.878646f, 0.878463f, 0.878280f, 0.878096f, 0.877913f, 0.877729f,
- 0.877545f, 0.877361f, 0.877177f, 0.876993f, 0.876809f, 0.876624f, 0.876440f, 0.876255f,
- 0.876070f, 0.875885f, 0.875700f, 0.875515f, 0.875329f, 0.875144f, 0.874958f, 0.874773f,
- 0.874587f, 0.874401f, 0.874215f, 0.874028f, 0.873842f, 0.873655f, 0.873469f, 0.873282f,
- 0.873095f, 0.872908f, 0.872721f, 0.872534f, 0.872346f, 0.872159f, 0.871971f, 0.871783f,
- 0.871595f, 0.871407f, 0.871219f, 0.871031f, 0.870842f, 0.870654f, 0.870465f, 0.870276f,
- 0.870087f, 0.869898f, 0.869709f, 0.869519f, 0.869330f, 0.869140f, 0.868951f, 0.868761f,
- 0.868571f, 0.868381f, 0.868190f, 0.868000f, 0.867809f, 0.867619f, 0.867428f, 0.867237f,
- 0.867046f, 0.866855f, 0.866664f, 0.866472f, 0.866281f, 0.866089f, 0.865898f, 0.865706f,
- 0.865514f, 0.865321f, 0.865129f, 0.864937f, 0.864744f, 0.864552f, 0.864359f, 0.864166f,
- 0.863973f, 0.863780f, 0.863586f, 0.863393f, 0.863199f, 0.863006f, 0.862812f, 0.862618f,
- 0.862424f, 0.862230f, 0.862035f, 0.861841f, 0.861646f, 0.861452f, 0.861257f, 0.861062f,
- 0.860867f, 0.860672f, 0.860476f, 0.860281f, 0.860085f, 0.859890f, 0.859694f, 0.859498f,
- 0.859302f, 0.859106f, 0.858909f, 0.858713f, 0.858516f, 0.858320f, 0.858123f, 0.857926f,
- 0.857729f, 0.857531f, 0.857334f, 0.857137f, 0.856939f, 0.856741f, 0.856543f, 0.856345f,
- 0.856147f, 0.855949f, 0.855751f, 0.855552f, 0.855354f, 0.855155f, 0.854956f, 0.854757f,
- 0.854558f, 0.854359f, 0.854159f, 0.853960f, 0.853760f, 0.853561f, 0.853361f, 0.853161f,
- 0.852961f, 0.852760f, 0.852560f, 0.852360f, 0.852159f, 0.851958f, 0.851757f, 0.851556f,
- 0.851355f, 0.851154f, 0.850953f, 0.850751f, 0.850549f, 0.850348f, 0.850146f, 0.849944f,
- 0.849742f, 0.849540f, 0.849337f, 0.849135f, 0.848932f, 0.848729f, 0.848526f, 0.848323f,
- 0.848120f, 0.847917f, 0.847714f, 0.847510f, 0.847307f, 0.847103f, 0.846899f, 0.846695f,
- 0.846491f, 0.846287f, 0.846082f, 0.845878f, 0.845673f, 0.845469f, 0.845264f, 0.845059f,
- 0.844854f, 0.844648f, 0.844443f, 0.844238f, 0.844032f, 0.843826f, 0.843620f, 0.843414f,
- 0.843208f, 0.843002f, 0.842796f, 0.842589f, 0.842383f, 0.842176f, 0.841969f, 0.841762f,
- 0.841555f, 0.841348f, 0.841140f, 0.840933f, 0.840725f, 0.840518f, 0.840310f, 0.840102f,
- 0.839894f, 0.839686f, 0.839477f, 0.839269f, 0.839060f, 0.838852f, 0.838643f, 0.838434f,
- 0.838225f, 0.838015f, 0.837806f, 0.837597f, 0.837387f, 0.837178f, 0.836968f, 0.836758f,
- 0.836548f, 0.836338f, 0.836127f, 0.835917f, 0.835706f, 0.835496f, 0.835285f, 0.835074f,
- 0.834863f, 0.834652f, 0.834440f, 0.834229f, 0.834018f, 0.833806f, 0.833594f, 0.833382f,
- 0.833170f, 0.832958f, 0.832746f, 0.832533f, 0.832321f, 0.832108f, 0.831895f, 0.831683f,
- 0.831470f, 0.831257f, 0.831043f, 0.830830f, 0.830616f, 0.830403f, 0.830189f, 0.829975f,
- 0.829761f, 0.829547f, 0.829333f, 0.829119f, 0.828904f, 0.828690f, 0.828475f, 0.828260f,
- 0.828045f, 0.827830f, 0.827615f, 0.827399f, 0.827184f, 0.826968f, 0.826753f, 0.826537f,
- 0.826321f, 0.826105f, 0.825889f, 0.825673f, 0.825456f, 0.825240f, 0.825023f, 0.824806f,
- 0.824589f, 0.824372f, 0.824155f, 0.823938f, 0.823721f, 0.823503f, 0.823285f, 0.823068f,
- 0.822850f, 0.822632f, 0.822414f, 0.822195f, 0.821977f, 0.821759f, 0.821540f, 0.821321f,
- 0.821102f, 0.820884f, 0.820664f, 0.820445f, 0.820226f, 0.820007f, 0.819787f, 0.819567f,
- 0.819348f, 0.819128f, 0.818908f, 0.818687f, 0.818467f, 0.818247f, 0.818026f, 0.817806f,
- 0.817585f, 0.817364f, 0.817143f, 0.816922f, 0.816701f, 0.816479f, 0.816258f, 0.816036f,
- 0.815814f, 0.815593f, 0.815371f, 0.815149f, 0.814926f, 0.814704f, 0.814482f, 0.814259f,
- 0.814036f, 0.813814f, 0.813591f, 0.813368f, 0.813144f, 0.812921f, 0.812698f, 0.812474f,
- 0.812251f, 0.812027f, 0.811803f, 0.811579f, 0.811355f, 0.811131f, 0.810906f, 0.810682f,
- 0.810457f, 0.810232f, 0.810008f, 0.809783f, 0.809558f, 0.809332f, 0.809107f, 0.808882f,
- 0.808656f, 0.808430f, 0.808205f, 0.807979f, 0.807753f, 0.807527f, 0.807300f, 0.807074f,
- 0.806848f, 0.806621f, 0.806394f, 0.806167f, 0.805940f, 0.805713f, 0.805486f, 0.805259f,
- 0.805031f, 0.804804f, 0.804576f, 0.804348f, 0.804120f, 0.803892f, 0.803664f, 0.803436f,
- 0.803208f, 0.802979f, 0.802750f, 0.802522f, 0.802293f, 0.802064f, 0.801835f, 0.801606f,
- 0.801376f, 0.801147f, 0.800917f, 0.800687f, 0.800458f, 0.800228f, 0.799998f, 0.799768f,
- 0.799537f, 0.799307f, 0.799076f, 0.798846f, 0.798615f, 0.798384f, 0.798153f, 0.797922f,
- 0.797691f, 0.797459f, 0.797228f, 0.796996f, 0.796765f, 0.796533f, 0.796301f, 0.796069f,
- 0.795837f, 0.795605f, 0.795372f, 0.795140f, 0.794907f, 0.794674f, 0.794442f, 0.794209f,
- 0.793975f, 0.793742f, 0.793509f, 0.793276f, 0.793042f, 0.792808f, 0.792575f, 0.792341f,
- 0.792107f, 0.791872f, 0.791638f, 0.791404f, 0.791169f, 0.790935f, 0.790700f, 0.790465f,
- 0.790230f, 0.789995f, 0.789760f, 0.789525f, 0.789289f, 0.789054f, 0.788818f, 0.788582f,
- 0.788346f, 0.788110f, 0.787874f, 0.787638f, 0.787402f, 0.787165f, 0.786929f, 0.786692f,
- 0.786455f, 0.786218f, 0.785981f, 0.785744f, 0.785507f, 0.785269f, 0.785032f, 0.784794f,
- 0.784557f, 0.784319f, 0.784081f, 0.783843f, 0.783605f, 0.783366f, 0.783128f, 0.782889f,
- 0.782651f, 0.782412f, 0.782173f, 0.781934f, 0.781695f, 0.781456f, 0.781216f, 0.780977f,
- 0.780737f, 0.780498f, 0.780258f, 0.780018f, 0.779778f, 0.779538f, 0.779297f, 0.779057f,
- 0.778817f, 0.778576f, 0.778335f, 0.778094f, 0.777853f, 0.777612f, 0.777371f, 0.777130f,
- 0.776888f, 0.776647f, 0.776405f, 0.776164f, 0.775922f, 0.775680f, 0.775438f, 0.775195f,
- 0.774953f, 0.774711f, 0.774468f, 0.774225f, 0.773983f, 0.773740f, 0.773497f, 0.773254f,
- 0.773010f, 0.772767f, 0.772524f, 0.772280f, 0.772036f, 0.771793f, 0.771549f, 0.771305f,
- 0.771061f, 0.770816f, 0.770572f, 0.770327f, 0.770083f, 0.769838f, 0.769593f, 0.769348f,
- 0.769103f, 0.768858f, 0.768613f, 0.768368f, 0.768122f, 0.767876f, 0.767631f, 0.767385f,
- 0.767139f, 0.766893f, 0.766647f, 0.766400f, 0.766154f, 0.765907f, 0.765661f, 0.765414f,
- 0.765167f, 0.764920f, 0.764673f, 0.764426f, 0.764179f, 0.763931f, 0.763684f, 0.763436f,
- 0.763188f, 0.762941f, 0.762693f, 0.762444f, 0.762196f, 0.761948f, 0.761700f, 0.761451f,
- 0.761202f, 0.760954f, 0.760705f, 0.760456f, 0.760207f, 0.759957f, 0.759708f, 0.759459f,
- 0.759209f, 0.758960f, 0.758710f, 0.758460f, 0.758210f, 0.757960f, 0.757710f, 0.757459f,
- 0.757209f, 0.756958f, 0.756708f, 0.756457f, 0.756206f, 0.755955f, 0.755704f, 0.755453f,
- 0.755201f, 0.754950f, 0.754698f, 0.754447f, 0.754195f, 0.753943f, 0.753691f, 0.753439f,
- 0.753187f, 0.752934f, 0.752682f, 0.752429f, 0.752177f, 0.751924f, 0.751671f, 0.751418f,
- 0.751165f, 0.750912f, 0.750659f, 0.750405f, 0.750152f, 0.749898f, 0.749644f, 0.749390f,
- 0.749136f, 0.748882f, 0.748628f, 0.748374f, 0.748119f, 0.747865f, 0.747610f, 0.747355f,
- 0.747101f, 0.746846f, 0.746591f, 0.746335f, 0.746080f, 0.745825f, 0.745569f, 0.745314f,
- 0.745058f, 0.744802f, 0.744546f, 0.744290f, 0.744034f, 0.743777f, 0.743521f, 0.743265f,
- 0.743008f, 0.742751f, 0.742494f, 0.742237f, 0.741980f, 0.741723f, 0.741466f, 0.741209f,
- 0.740951f, 0.740694f, 0.740436f, 0.740178f, 0.739920f, 0.739662f, 0.739404f, 0.739146f,
- 0.738887f, 0.738629f, 0.738370f, 0.738112f, 0.737853f, 0.737594f, 0.737335f, 0.737076f,
- 0.736817f, 0.736557f, 0.736298f, 0.736038f, 0.735779f, 0.735519f, 0.735259f, 0.734999f,
- 0.734739f, 0.734479f, 0.734218f, 0.733958f, 0.733697f, 0.733437f, 0.733176f, 0.732915f,
- 0.732654f, 0.732393f, 0.732132f, 0.731871f, 0.731609f, 0.731348f, 0.731086f, 0.730825f,
- 0.730563f, 0.730301f, 0.730039f, 0.729777f, 0.729514f, 0.729252f, 0.728990f, 0.728727f,
- 0.728464f, 0.728202f, 0.727939f, 0.727676f, 0.727413f, 0.727149f, 0.726886f, 0.726623f,
- 0.726359f, 0.726095f, 0.725832f, 0.725568f, 0.725304f, 0.725040f, 0.724776f, 0.724511f,
- 0.724247f, 0.723983f, 0.723718f, 0.723453f, 0.723188f, 0.722924f, 0.722659f, 0.722393f,
- 0.722128f, 0.721863f, 0.721597f, 0.721332f, 0.721066f, 0.720800f, 0.720535f, 0.720269f,
- 0.720003f, 0.719736f, 0.719470f, 0.719204f, 0.718937f, 0.718670f, 0.718404f, 0.718137f,
- 0.717870f, 0.717603f, 0.717336f, 0.717069f, 0.716801f, 0.716534f, 0.716266f, 0.715999f,
- 0.715731f, 0.715463f, 0.715195f, 0.714927f, 0.714659f, 0.714390f, 0.714122f, 0.713853f,
- 0.713585f, 0.713316f, 0.713047f, 0.712778f, 0.712509f, 0.712240f, 0.711971f, 0.711702f,
- 0.711432f, 0.711163f, 0.710893f, 0.710623f, 0.710353f, 0.710083f, 0.709813f, 0.709543f,
- 0.709273f, 0.709002f, 0.708732f, 0.708461f, 0.708191f, 0.707920f, 0.707649f, 0.707378f,
- 0.707107f, 0.706836f, 0.706564f, 0.706293f, 0.706021f, 0.705750f, 0.705478f, 0.705206f,
- 0.704934f, 0.704662f, 0.704390f, 0.704118f, 0.703845f, 0.703573f, 0.703300f, 0.703028f,
- 0.702755f, 0.702482f, 0.702209f, 0.701936f, 0.701663f, 0.701389f, 0.701116f, 0.700842f,
- 0.700569f, 0.700295f, 0.700021f, 0.699747f, 0.699473f, 0.699199f, 0.698925f, 0.698651f,
- 0.698376f, 0.698102f, 0.697827f, 0.697552f, 0.697277f, 0.697003f, 0.696728f, 0.696452f,
- 0.696177f, 0.695902f, 0.695626f, 0.695351f, 0.695075f, 0.694799f, 0.694524f, 0.694248f,
- 0.693971f, 0.693695f, 0.693419f, 0.693143f, 0.692866f, 0.692590f, 0.692313f, 0.692036f,
- 0.691759f, 0.691482f, 0.691205f, 0.690928f, 0.690651f, 0.690373f, 0.690096f, 0.689818f,
- 0.689541f, 0.689263f, 0.688985f, 0.688707f, 0.688429f, 0.688151f, 0.687872f, 0.687594f,
- 0.687315f, 0.687037f, 0.686758f, 0.686479f, 0.686200f, 0.685921f, 0.685642f, 0.685363f,
- 0.685084f, 0.684804f, 0.684525f, 0.684245f, 0.683965f, 0.683686f, 0.683406f, 0.683126f,
- 0.682846f, 0.682565f, 0.682285f, 0.682005f, 0.681724f, 0.681443f, 0.681163f, 0.680882f,
- 0.680601f, 0.680320f, 0.680039f, 0.679758f, 0.679476f, 0.679195f, 0.678913f, 0.678632f,
- 0.678350f, 0.678068f, 0.677786f, 0.677504f, 0.677222f, 0.676940f, 0.676658f, 0.676375f,
- 0.676093f, 0.675810f, 0.675527f, 0.675245f, 0.674962f, 0.674679f, 0.674396f, 0.674112f,
- 0.673829f, 0.673546f, 0.673262f, 0.672978f, 0.672695f, 0.672411f, 0.672127f, 0.671843f,
- 0.671559f, 0.671275f, 0.670990f, 0.670706f, 0.670422f, 0.670137f, 0.669852f, 0.669567f,
- 0.669283f, 0.668998f, 0.668712f, 0.668427f, 0.668142f, 0.667857f, 0.667571f, 0.667286f,
- 0.667000f, 0.666714f, 0.666428f, 0.666142f, 0.665856f, 0.665570f, 0.665284f, 0.664997f,
- 0.664711f, 0.664424f, 0.664138f, 0.663851f, 0.663564f, 0.663277f, 0.662990f, 0.662703f,
- 0.662416f, 0.662128f, 0.661841f, 0.661553f, 0.661266f, 0.660978f, 0.660690f, 0.660402f,
- 0.660114f, 0.659826f, 0.659538f, 0.659250f, 0.658961f, 0.658673f, 0.658384f, 0.658095f,
- 0.657807f, 0.657518f, 0.657229f, 0.656940f, 0.656651f, 0.656361f, 0.656072f, 0.655782f,
- 0.655493f, 0.655203f, 0.654913f, 0.654624f, 0.654334f, 0.654044f, 0.653753f, 0.653463f,
- 0.653173f, 0.652882f, 0.652592f, 0.652301f, 0.652011f, 0.651720f, 0.651429f, 0.651138f,
- 0.650847f, 0.650555f, 0.650264f, 0.649973f, 0.649681f, 0.649390f, 0.649098f, 0.648806f,
- 0.648514f, 0.648222f, 0.647930f, 0.647638f, 0.647346f, 0.647054f, 0.646761f, 0.646469f,
- 0.646176f, 0.645883f, 0.645590f, 0.645298f, 0.645005f, 0.644711f, 0.644418f, 0.644125f,
- 0.643832f, 0.643538f, 0.643245f, 0.642951f, 0.642657f, 0.642363f, 0.642069f, 0.641775f,
- 0.641481f, 0.641187f, 0.640892f, 0.640598f, 0.640303f, 0.640009f, 0.639714f, 0.639419f,
- 0.639124f, 0.638829f, 0.638534f, 0.638239f, 0.637944f, 0.637649f, 0.637353f, 0.637057f,
- 0.636762f, 0.636466f, 0.636170f, 0.635874f, 0.635578f, 0.635282f, 0.634986f, 0.634690f,
- 0.634393f, 0.634097f, 0.633800f, 0.633504f, 0.633207f, 0.632910f, 0.632613f, 0.632316f,
- 0.632019f, 0.631721f, 0.631424f, 0.631127f, 0.630829f, 0.630532f, 0.630234f, 0.629936f,
- 0.629638f, 0.629340f, 0.629042f, 0.628744f, 0.628446f, 0.628147f, 0.627849f, 0.627550f,
- 0.627252f, 0.626953f, 0.626654f, 0.626355f, 0.626056f, 0.625757f, 0.625458f, 0.625159f,
- 0.624860f, 0.624560f, 0.624260f, 0.623961f, 0.623661f, 0.623361f, 0.623061f, 0.622761f,
- 0.622461f, 0.622161f, 0.621861f, 0.621560f, 0.621260f, 0.620959f, 0.620659f, 0.620358f,
- 0.620057f, 0.619756f, 0.619455f, 0.619154f, 0.618853f, 0.618552f, 0.618250f, 0.617949f,
- 0.617647f, 0.617346f, 0.617044f, 0.616742f, 0.616440f, 0.616138f, 0.615836f, 0.615534f,
- 0.615232f, 0.614929f, 0.614627f, 0.614324f, 0.614022f, 0.613719f, 0.613416f, 0.613113f,
- 0.612810f, 0.612507f, 0.612204f, 0.611901f, 0.611597f, 0.611294f, 0.610990f, 0.610687f,
- 0.610383f, 0.610079f, 0.609775f, 0.609471f, 0.609167f, 0.608863f, 0.608559f, 0.608254f,
- 0.607950f, 0.607645f, 0.607341f, 0.607036f, 0.606731f, 0.606426f, 0.606121f, 0.605816f,
- 0.605511f, 0.605206f, 0.604900f, 0.604595f, 0.604290f, 0.603984f, 0.603678f, 0.603372f,
- 0.603067f, 0.602761f, 0.602455f, 0.602148f, 0.601842f, 0.601536f, 0.601230f, 0.600923f,
- 0.600616f, 0.600310f, 0.600003f, 0.599696f, 0.599389f, 0.599082f, 0.598775f, 0.598468f,
- 0.598161f, 0.597853f, 0.597546f, 0.597238f, 0.596931f, 0.596623f, 0.596315f, 0.596007f,
- 0.595699f, 0.595391f, 0.595083f, 0.594775f, 0.594467f, 0.594158f, 0.593850f, 0.593541f,
- 0.593232f, 0.592924f, 0.592615f, 0.592306f, 0.591997f, 0.591688f, 0.591378f, 0.591069f,
- 0.590760f, 0.590450f, 0.590141f, 0.589831f, 0.589521f, 0.589212f, 0.588902f, 0.588592f,
- 0.588282f, 0.587971f, 0.587661f, 0.587351f, 0.587040f, 0.586730f, 0.586419f, 0.586109f,
- 0.585798f, 0.585487f, 0.585176f, 0.584865f, 0.584554f, 0.584243f, 0.583931f, 0.583620f,
- 0.583309f, 0.582997f, 0.582685f, 0.582374f, 0.582062f, 0.581750f, 0.581438f, 0.581126f,
- 0.580814f, 0.580502f, 0.580189f, 0.579877f, 0.579565f, 0.579252f, 0.578939f, 0.578627f,
- 0.578314f, 0.578001f, 0.577688f, 0.577375f, 0.577062f, 0.576748f, 0.576435f, 0.576122f,
- 0.575808f, 0.575495f, 0.575181f, 0.574867f, 0.574553f, 0.574239f, 0.573925f, 0.573611f,
- 0.573297f, 0.572983f, 0.572669f, 0.572354f, 0.572040f, 0.571725f, 0.571410f, 0.571096f,
- 0.570781f, 0.570466f, 0.570151f, 0.569836f, 0.569521f, 0.569205f, 0.568890f, 0.568574f,
- 0.568259f, 0.567943f, 0.567628f, 0.567312f, 0.566996f, 0.566680f, 0.566364f, 0.566048f,
- 0.565732f, 0.565416f, 0.565099f, 0.564783f, 0.564466f, 0.564150f, 0.563833f, 0.563516f,
- 0.563199f, 0.562882f, 0.562565f, 0.562248f, 0.561931f, 0.561614f, 0.561297f, 0.560979f,
- 0.560662f, 0.560344f, 0.560026f, 0.559709f, 0.559391f, 0.559073f, 0.558755f, 0.558437f,
- 0.558119f, 0.557800f, 0.557482f, 0.557164f, 0.556845f, 0.556526f, 0.556208f, 0.555889f,
- 0.555570f, 0.555251f, 0.554932f, 0.554613f, 0.554294f, 0.553975f, 0.553656f, 0.553336f,
- 0.553017f, 0.552697f, 0.552378f, 0.552058f, 0.551738f, 0.551418f, 0.551098f, 0.550778f,
- 0.550458f, 0.550138f, 0.549818f, 0.549497f, 0.549177f, 0.548856f, 0.548536f, 0.548215f,
- 0.547894f, 0.547573f, 0.547252f, 0.546931f, 0.546610f, 0.546289f, 0.545968f, 0.545646f,
- 0.545325f, 0.545003f, 0.544682f, 0.544360f, 0.544039f, 0.543717f, 0.543395f, 0.543073f,
- 0.542751f, 0.542429f, 0.542106f, 0.541784f, 0.541462f, 0.541139f, 0.540817f, 0.540494f,
- 0.540171f, 0.539849f, 0.539526f, 0.539203f, 0.538880f, 0.538557f, 0.538234f, 0.537910f,
- 0.537587f, 0.537264f, 0.536940f, 0.536617f, 0.536293f, 0.535969f, 0.535645f, 0.535322f,
- 0.534998f, 0.534674f, 0.534349f, 0.534025f, 0.533701f, 0.533377f, 0.533052f, 0.532728f,
- 0.532403f, 0.532078f, 0.531754f, 0.531429f, 0.531104f, 0.530779f, 0.530454f, 0.530129f,
- 0.529804f, 0.529478f, 0.529153f, 0.528828f, 0.528502f, 0.528176f, 0.527851f, 0.527525f,
- 0.527199f, 0.526873f, 0.526547f, 0.526221f, 0.525895f, 0.525569f, 0.525243f, 0.524916f,
- 0.524590f, 0.524263f, 0.523937f, 0.523610f, 0.523283f, 0.522956f, 0.522629f, 0.522302f,
- 0.521975f, 0.521648f, 0.521321f, 0.520994f, 0.520666f, 0.520339f, 0.520011f, 0.519684f,
- 0.519356f, 0.519028f, 0.518700f, 0.518372f, 0.518045f, 0.517716f, 0.517388f, 0.517060f,
- 0.516732f, 0.516403f, 0.516075f, 0.515746f, 0.515418f, 0.515089f, 0.514760f, 0.514432f,
- 0.514103f, 0.513774f, 0.513445f, 0.513116f, 0.512786f, 0.512457f, 0.512128f, 0.511798f,
- 0.511469f, 0.511139f, 0.510810f, 0.510480f, 0.510150f, 0.509820f, 0.509490f, 0.509160f,
- 0.508830f, 0.508500f, 0.508170f, 0.507839f, 0.507509f, 0.507179f, 0.506848f, 0.506517f,
- 0.506187f, 0.505856f, 0.505525f, 0.505194f, 0.504863f, 0.504532f, 0.504201f, 0.503870f,
- 0.503538f, 0.503207f, 0.502876f, 0.502544f, 0.502212f, 0.501881f, 0.501549f, 0.501217f,
- 0.500885f, 0.500553f, 0.500221f, 0.499889f, 0.499557f, 0.499225f, 0.498893f, 0.498560f,
- 0.498228f, 0.497895f, 0.497562f, 0.497230f, 0.496897f, 0.496564f, 0.496231f, 0.495898f,
- 0.495565f, 0.495232f, 0.494899f, 0.494566f, 0.494232f, 0.493899f, 0.493565f, 0.493232f,
- 0.492898f, 0.492564f, 0.492231f, 0.491897f, 0.491563f, 0.491229f, 0.490895f, 0.490561f,
- 0.490226f, 0.489892f, 0.489558f, 0.489223f, 0.488889f, 0.488554f, 0.488220f, 0.487885f,
- 0.487550f, 0.487215f, 0.486880f, 0.486545f, 0.486210f, 0.485875f, 0.485540f, 0.485205f,
- 0.484869f, 0.484534f, 0.484198f, 0.483863f, 0.483527f, 0.483191f, 0.482856f, 0.482520f,
- 0.482184f, 0.481848f, 0.481512f, 0.481176f, 0.480839f, 0.480503f, 0.480167f, 0.479830f,
- 0.479494f, 0.479157f, 0.478821f, 0.478484f, 0.478147f, 0.477810f, 0.477473f, 0.477136f,
- 0.476799f, 0.476462f, 0.476125f, 0.475788f, 0.475450f, 0.475113f, 0.474775f, 0.474438f,
- 0.474100f, 0.473763f, 0.473425f, 0.473087f, 0.472749f, 0.472411f, 0.472073f, 0.471735f,
- 0.471397f, 0.471058f, 0.470720f, 0.470382f, 0.470043f, 0.469705f, 0.469366f, 0.469028f,
- 0.468689f, 0.468350f, 0.468011f, 0.467672f, 0.467333f, 0.466994f, 0.466655f, 0.466316f,
- 0.465977f, 0.465637f, 0.465298f, 0.464958f, 0.464619f, 0.464279f, 0.463939f, 0.463600f,
- 0.463260f, 0.462920f, 0.462580f, 0.462240f, 0.461900f, 0.461560f, 0.461219f, 0.460879f,
- 0.460539f, 0.460198f, 0.459858f, 0.459517f, 0.459177f, 0.458836f, 0.458495f, 0.458154f,
- 0.457813f, 0.457472f, 0.457131f, 0.456790f, 0.456449f, 0.456108f, 0.455766f, 0.455425f,
- 0.455084f, 0.454742f, 0.454400f, 0.454059f, 0.453717f, 0.453375f, 0.453033f, 0.452692f,
- 0.452350f, 0.452008f, 0.451665f, 0.451323f, 0.450981f, 0.450639f, 0.450296f, 0.449954f,
- 0.449611f, 0.449269f, 0.448926f, 0.448583f, 0.448241f, 0.447898f, 0.447555f, 0.447212f,
- 0.446869f, 0.446526f, 0.446183f, 0.445839f, 0.445496f, 0.445153f, 0.444809f, 0.444466f,
- 0.444122f, 0.443779f, 0.443435f, 0.443091f, 0.442747f, 0.442403f, 0.442059f, 0.441715f,
- 0.441371f, 0.441027f, 0.440683f, 0.440339f, 0.439994f, 0.439650f, 0.439305f, 0.438961f,
- 0.438616f, 0.438272f, 0.437927f, 0.437582f, 0.437237f, 0.436892f, 0.436547f, 0.436202f,
- 0.435857f, 0.435512f, 0.435167f, 0.434821f, 0.434476f, 0.434131f, 0.433785f, 0.433439f,
- 0.433094f, 0.432748f, 0.432402f, 0.432057f, 0.431711f, 0.431365f, 0.431019f, 0.430673f,
- 0.430326f, 0.429980f, 0.429634f, 0.429288f, 0.428941f, 0.428595f, 0.428248f, 0.427902f,
- 0.427555f, 0.427208f, 0.426862f, 0.426515f, 0.426168f, 0.425821f, 0.425474f, 0.425127f,
- 0.424780f, 0.424432f, 0.424085f, 0.423738f, 0.423390f, 0.423043f, 0.422695f, 0.422348f,
- 0.422000f, 0.421653f, 0.421305f, 0.420957f, 0.420609f, 0.420261f, 0.419913f, 0.419565f,
- 0.419217f, 0.418869f, 0.418520f, 0.418172f, 0.417824f, 0.417475f, 0.417127f, 0.416778f,
- 0.416430f, 0.416081f, 0.415732f, 0.415383f, 0.415034f, 0.414685f, 0.414337f, 0.413987f,
- 0.413638f, 0.413289f, 0.412940f, 0.412591f, 0.412241f, 0.411892f, 0.411542f, 0.411193f,
- 0.410843f, 0.410493f, 0.410144f, 0.409794f, 0.409444f, 0.409094f, 0.408744f, 0.408394f,
- 0.408044f, 0.407694f, 0.407344f, 0.406994f, 0.406643f, 0.406293f, 0.405942f, 0.405592f,
- 0.405241f, 0.404891f, 0.404540f, 0.404189f, 0.403838f, 0.403488f, 0.403137f, 0.402786f,
- 0.402435f, 0.402084f, 0.401732f, 0.401381f, 0.401030f, 0.400679f, 0.400327f, 0.399976f,
- 0.399624f, 0.399273f, 0.398921f, 0.398569f, 0.398218f, 0.397866f, 0.397514f, 0.397162f,
- 0.396810f, 0.396458f, 0.396106f, 0.395754f, 0.395401f, 0.395049f, 0.394697f, 0.394344f,
- 0.393992f, 0.393640f, 0.393287f, 0.392934f, 0.392582f, 0.392229f, 0.391876f, 0.391523f,
- 0.391170f, 0.390817f, 0.390464f, 0.390111f, 0.389758f, 0.389405f, 0.389052f, 0.388698f,
- 0.388345f, 0.387992f, 0.387638f, 0.387285f, 0.386931f, 0.386577f, 0.386224f, 0.385870f,
- 0.385516f, 0.385162f, 0.384808f, 0.384454f, 0.384100f, 0.383746f, 0.383392f, 0.383038f,
- 0.382683f, 0.382329f, 0.381975f, 0.381620f, 0.381266f, 0.380911f, 0.380557f, 0.380202f,
- 0.379847f, 0.379492f, 0.379138f, 0.378783f, 0.378428f, 0.378073f, 0.377718f, 0.377363f,
- 0.377007f, 0.376652f, 0.376297f, 0.375942f, 0.375586f, 0.375231f, 0.374875f, 0.374520f,
- 0.374164f, 0.373808f, 0.373453f, 0.373097f, 0.372741f, 0.372385f, 0.372029f, 0.371673f,
- 0.371317f, 0.370961f, 0.370605f, 0.370249f, 0.369892f, 0.369536f, 0.369180f, 0.368823f,
- 0.368467f, 0.368110f, 0.367754f, 0.367397f, 0.367040f, 0.366684f, 0.366327f, 0.365970f,
- 0.365613f, 0.365256f, 0.364899f, 0.364542f, 0.364185f, 0.363828f, 0.363470f, 0.363113f,
- 0.362756f, 0.362398f, 0.362041f, 0.361683f, 0.361326f, 0.360968f, 0.360611f, 0.360253f,
- 0.359895f, 0.359537f, 0.359179f, 0.358821f, 0.358463f, 0.358105f, 0.357747f, 0.357389f,
- 0.357031f, 0.356673f, 0.356314f, 0.355956f, 0.355598f, 0.355239f, 0.354881f, 0.354522f,
- 0.354164f, 0.353805f, 0.353446f, 0.353087f, 0.352729f, 0.352370f, 0.352011f, 0.351652f,
- 0.351293f, 0.350934f, 0.350575f, 0.350215f, 0.349856f, 0.349497f, 0.349138f, 0.348778f,
- 0.348419f, 0.348059f, 0.347700f, 0.347340f, 0.346980f, 0.346621f, 0.346261f, 0.345901f,
- 0.345541f, 0.345181f, 0.344821f, 0.344461f, 0.344101f, 0.343741f, 0.343381f, 0.343021f,
- 0.342661f, 0.342300f, 0.341940f, 0.341580f, 0.341219f, 0.340859f, 0.340498f, 0.340138f,
- 0.339777f, 0.339416f, 0.339055f, 0.338695f, 0.338334f, 0.337973f, 0.337612f, 0.337251f,
- 0.336890f, 0.336529f, 0.336168f, 0.335806f, 0.335445f, 0.335084f, 0.334722f, 0.334361f,
- 0.334000f, 0.333638f, 0.333277f, 0.332915f, 0.332553f, 0.332192f, 0.331830f, 0.331468f,
- 0.331106f, 0.330744f, 0.330382f, 0.330020f, 0.329658f, 0.329296f, 0.328934f, 0.328572f,
- 0.328210f, 0.327848f, 0.327485f, 0.327123f, 0.326760f, 0.326398f, 0.326035f, 0.325673f,
- 0.325310f, 0.324948f, 0.324585f, 0.324222f, 0.323859f, 0.323497f, 0.323134f, 0.322771f,
- 0.322408f, 0.322045f, 0.321682f, 0.321318f, 0.320955f, 0.320592f, 0.320229f, 0.319865f,
- 0.319502f, 0.319139f, 0.318775f, 0.318412f, 0.318048f, 0.317684f, 0.317321f, 0.316957f,
- 0.316593f, 0.316230f, 0.315866f, 0.315502f, 0.315138f, 0.314774f, 0.314410f, 0.314046f,
- 0.313682f, 0.313318f, 0.312953f, 0.312589f, 0.312225f, 0.311860f, 0.311496f, 0.311132f,
- 0.310767f, 0.310403f, 0.310038f, 0.309673f, 0.309309f, 0.308944f, 0.308579f, 0.308214f,
- 0.307850f, 0.307485f, 0.307120f, 0.306755f, 0.306390f, 0.306025f, 0.305660f, 0.305294f,
- 0.304929f, 0.304564f, 0.304199f, 0.303833f, 0.303468f, 0.303103f, 0.302737f, 0.302372f,
- 0.302006f, 0.301640f, 0.301275f, 0.300909f, 0.300543f, 0.300177f, 0.299812f, 0.299446f,
- 0.299080f, 0.298714f, 0.298348f, 0.297982f, 0.297616f, 0.297250f, 0.296883f, 0.296517f,
- 0.296151f, 0.295785f, 0.295418f, 0.295052f, 0.294685f, 0.294319f, 0.293952f, 0.293586f,
- 0.293219f, 0.292852f, 0.292486f, 0.292119f, 0.291752f, 0.291385f, 0.291019f, 0.290652f,
- 0.290285f, 0.289918f, 0.289551f, 0.289184f, 0.288816f, 0.288449f, 0.288082f, 0.287715f,
- 0.287347f, 0.286980f, 0.286613f, 0.286245f, 0.285878f, 0.285510f, 0.285143f, 0.284775f,
- 0.284408f, 0.284040f, 0.283672f, 0.283304f, 0.282937f, 0.282569f, 0.282201f, 0.281833f,
- 0.281465f, 0.281097f, 0.280729f, 0.280361f, 0.279993f, 0.279624f, 0.279256f, 0.278888f,
- 0.278520f, 0.278151f, 0.277783f, 0.277415f, 0.277046f, 0.276678f, 0.276309f, 0.275940f,
- 0.275572f, 0.275203f, 0.274834f, 0.274466f, 0.274097f, 0.273728f, 0.273359f, 0.272990f,
- 0.272621f, 0.272252f, 0.271883f, 0.271514f, 0.271145f, 0.270776f, 0.270407f, 0.270038f,
- 0.269668f, 0.269299f, 0.268930f, 0.268560f, 0.268191f, 0.267821f, 0.267452f, 0.267082f,
- 0.266713f, 0.266343f, 0.265973f, 0.265604f, 0.265234f, 0.264864f, 0.264494f, 0.264125f,
- 0.263755f, 0.263385f, 0.263015f, 0.262645f, 0.262275f, 0.261905f, 0.261534f, 0.261164f,
- 0.260794f, 0.260424f, 0.260054f, 0.259683f, 0.259313f, 0.258943f, 0.258572f, 0.258202f,
- 0.257831f, 0.257461f, 0.257090f, 0.256719f, 0.256349f, 0.255978f, 0.255607f, 0.255236f,
- 0.254866f, 0.254495f, 0.254124f, 0.253753f, 0.253382f, 0.253011f, 0.252640f, 0.252269f,
- 0.251898f, 0.251527f, 0.251155f, 0.250784f, 0.250413f, 0.250042f, 0.249670f, 0.249299f,
- 0.248928f, 0.248556f, 0.248185f, 0.247813f, 0.247442f, 0.247070f, 0.246698f, 0.246327f,
- 0.245955f, 0.245583f, 0.245212f, 0.244840f, 0.244468f, 0.244096f, 0.243724f, 0.243352f,
- 0.242980f, 0.242608f, 0.242236f, 0.241864f, 0.241492f, 0.241120f, 0.240748f, 0.240375f,
- 0.240003f, 0.239631f, 0.239258f, 0.238886f, 0.238514f, 0.238141f, 0.237769f, 0.237396f,
- 0.237024f, 0.236651f, 0.236278f, 0.235906f, 0.235533f, 0.235160f, 0.234788f, 0.234415f,
- 0.234042f, 0.233669f, 0.233296f, 0.232923f, 0.232550f, 0.232177f, 0.231804f, 0.231431f,
- 0.231058f, 0.230685f, 0.230312f, 0.229939f, 0.229565f, 0.229192f, 0.228819f, 0.228445f,
- 0.228072f, 0.227699f, 0.227325f, 0.226952f, 0.226578f, 0.226205f, 0.225831f, 0.225458f,
- 0.225084f, 0.224710f, 0.224337f, 0.223963f, 0.223589f, 0.223215f, 0.222841f, 0.222468f,
- 0.222094f, 0.221720f, 0.221346f, 0.220972f, 0.220598f, 0.220224f, 0.219850f, 0.219475f,
- 0.219101f, 0.218727f, 0.218353f, 0.217979f, 0.217604f, 0.217230f, 0.216856f, 0.216481f,
- 0.216107f, 0.215732f, 0.215358f, 0.214983f, 0.214609f, 0.214234f, 0.213860f, 0.213485f,
- 0.213110f, 0.212736f, 0.212361f, 0.211986f, 0.211611f, 0.211237f, 0.210862f, 0.210487f,
- 0.210112f, 0.209737f, 0.209362f, 0.208987f, 0.208612f, 0.208237f, 0.207862f, 0.207487f,
- 0.207111f, 0.206736f, 0.206361f, 0.205986f, 0.205610f, 0.205235f, 0.204860f, 0.204484f,
- 0.204109f, 0.203734f, 0.203358f, 0.202983f, 0.202607f, 0.202231f, 0.201856f, 0.201480f,
- 0.201105f, 0.200729f, 0.200353f, 0.199978f, 0.199602f, 0.199226f, 0.198850f, 0.198474f,
- 0.198098f, 0.197722f, 0.197347f, 0.196971f, 0.196595f, 0.196219f, 0.195843f, 0.195466f,
- 0.195090f, 0.194714f, 0.194338f, 0.193962f, 0.193586f, 0.193209f, 0.192833f, 0.192457f,
- 0.192080f, 0.191704f, 0.191328f, 0.190951f, 0.190575f, 0.190198f, 0.189822f, 0.189445f,
- 0.189069f, 0.188692f, 0.188315f, 0.187939f, 0.187562f, 0.187185f, 0.186809f, 0.186432f,
- 0.186055f, 0.185678f, 0.185301f, 0.184925f, 0.184548f, 0.184171f, 0.183794f, 0.183417f,
- 0.183040f, 0.182663f, 0.182286f, 0.181909f, 0.181532f, 0.181154f, 0.180777f, 0.180400f,
- 0.180023f, 0.179646f, 0.179268f, 0.178891f, 0.178514f, 0.178136f, 0.177759f, 0.177382f,
- 0.177004f, 0.176627f, 0.176249f, 0.175872f, 0.175494f, 0.175117f, 0.174739f, 0.174362f,
- 0.173984f, 0.173606f, 0.173229f, 0.172851f, 0.172473f, 0.172095f, 0.171718f, 0.171340f,
- 0.170962f, 0.170584f, 0.170206f, 0.169828f, 0.169450f, 0.169072f, 0.168694f, 0.168316f,
- 0.167938f, 0.167560f, 0.167182f, 0.166804f, 0.166426f, 0.166048f, 0.165670f, 0.165291f,
- 0.164913f, 0.164535f, 0.164157f, 0.163778f, 0.163400f, 0.163022f, 0.162643f, 0.162265f,
- 0.161886f, 0.161508f, 0.161129f, 0.160751f, 0.160372f, 0.159994f, 0.159615f, 0.159237f,
- 0.158858f, 0.158480f, 0.158101f, 0.157722f, 0.157343f, 0.156965f, 0.156586f, 0.156207f,
- 0.155828f, 0.155450f, 0.155071f, 0.154692f, 0.154313f, 0.153934f, 0.153555f, 0.153176f,
- 0.152797f, 0.152418f, 0.152039f, 0.151660f, 0.151281f, 0.150902f, 0.150523f, 0.150144f,
- 0.149765f, 0.149385f, 0.149006f, 0.148627f, 0.148248f, 0.147868f, 0.147489f, 0.147110f,
- 0.146730f, 0.146351f, 0.145972f, 0.145592f, 0.145213f, 0.144833f, 0.144454f, 0.144075f,
- 0.143695f, 0.143316f, 0.142936f, 0.142556f, 0.142177f, 0.141797f, 0.141418f, 0.141038f,
- 0.140658f, 0.140279f, 0.139899f, 0.139519f, 0.139139f, 0.138760f, 0.138380f, 0.138000f,
- 0.137620f, 0.137240f, 0.136860f, 0.136480f, 0.136101f, 0.135721f, 0.135341f, 0.134961f,
- 0.134581f, 0.134201f, 0.133821f, 0.133441f, 0.133061f, 0.132680f, 0.132300f, 0.131920f,
- 0.131540f, 0.131160f, 0.130780f, 0.130399f, 0.130019f, 0.129639f, 0.129259f, 0.128878f,
- 0.128498f, 0.128118f, 0.127737f, 0.127357f, 0.126977f, 0.126596f, 0.126216f, 0.125835f,
- 0.125455f, 0.125075f, 0.124694f, 0.124314f, 0.123933f, 0.123552f, 0.123172f, 0.122791f,
- 0.122411f, 0.122030f, 0.121649f, 0.121269f, 0.120888f, 0.120507f, 0.120127f, 0.119746f,
- 0.119365f, 0.118984f, 0.118604f, 0.118223f, 0.117842f, 0.117461f, 0.117080f, 0.116700f,
- 0.116319f, 0.115938f, 0.115557f, 0.115176f, 0.114795f, 0.114414f, 0.114033f, 0.113652f,
- 0.113271f, 0.112890f, 0.112509f, 0.112128f, 0.111747f, 0.111366f, 0.110984f, 0.110603f,
- 0.110222f, 0.109841f, 0.109460f, 0.109079f, 0.108697f, 0.108316f, 0.107935f, 0.107554f,
- 0.107172f, 0.106791f, 0.106410f, 0.106028f, 0.105647f, 0.105266f, 0.104884f, 0.104503f,
- 0.104122f, 0.103740f, 0.103359f, 0.102977f, 0.102596f, 0.102214f, 0.101833f, 0.101451f,
- 0.101070f, 0.100688f, 0.100307f, 0.099925f, 0.099544f, 0.099162f, 0.098780f, 0.098399f,
- 0.098017f, 0.097635f, 0.097254f, 0.096872f, 0.096490f, 0.096109f, 0.095727f, 0.095345f,
- 0.094963f, 0.094582f, 0.094200f, 0.093818f, 0.093436f, 0.093055f, 0.092673f, 0.092291f,
- 0.091909f, 0.091527f, 0.091145f, 0.090763f, 0.090381f, 0.089999f, 0.089617f, 0.089236f,
- 0.088854f, 0.088472f, 0.088090f, 0.087708f, 0.087326f, 0.086943f, 0.086561f, 0.086179f,
- 0.085797f, 0.085415f, 0.085033f, 0.084651f, 0.084269f, 0.083887f, 0.083505f, 0.083122f,
- 0.082740f, 0.082358f, 0.081976f, 0.081594f, 0.081211f, 0.080829f, 0.080447f, 0.080065f,
- 0.079682f, 0.079300f, 0.078918f, 0.078536f, 0.078153f, 0.077771f, 0.077389f, 0.077006f,
- 0.076624f, 0.076241f, 0.075859f, 0.075477f, 0.075094f, 0.074712f, 0.074329f, 0.073947f,
- 0.073565f, 0.073182f, 0.072800f, 0.072417f, 0.072035f, 0.071652f, 0.071270f, 0.070887f,
- 0.070505f, 0.070122f, 0.069739f, 0.069357f, 0.068974f, 0.068592f, 0.068209f, 0.067827f,
- 0.067444f, 0.067061f, 0.066679f, 0.066296f, 0.065913f, 0.065531f, 0.065148f, 0.064765f,
- 0.064383f, 0.064000f, 0.063617f, 0.063234f, 0.062852f, 0.062469f, 0.062086f, 0.061704f,
- 0.061321f, 0.060938f, 0.060555f, 0.060172f, 0.059790f, 0.059407f, 0.059024f, 0.058641f,
- 0.058258f, 0.057875f, 0.057493f, 0.057110f, 0.056727f, 0.056344f, 0.055961f, 0.055578f,
- 0.055195f, 0.054812f, 0.054429f, 0.054046f, 0.053664f, 0.053281f, 0.052898f, 0.052515f,
- 0.052132f, 0.051749f, 0.051366f, 0.050983f, 0.050600f, 0.050217f, 0.049834f, 0.049451f,
- 0.049068f, 0.048685f, 0.048302f, 0.047919f, 0.047535f, 0.047152f, 0.046769f, 0.046386f,
- 0.046003f, 0.045620f, 0.045237f, 0.044854f, 0.044471f, 0.044088f, 0.043705f, 0.043321f,
- 0.042938f, 0.042555f, 0.042172f, 0.041789f, 0.041406f, 0.041022f, 0.040639f, 0.040256f,
- 0.039873f, 0.039490f, 0.039107f, 0.038723f, 0.038340f, 0.037957f, 0.037574f, 0.037190f,
- 0.036807f, 0.036424f, 0.036041f, 0.035657f, 0.035274f, 0.034891f, 0.034508f, 0.034124f,
- 0.033741f, 0.033358f, 0.032975f, 0.032591f, 0.032208f, 0.031825f, 0.031441f, 0.031058f,
- 0.030675f, 0.030291f, 0.029908f, 0.029525f, 0.029142f, 0.028758f, 0.028375f, 0.027991f,
- 0.027608f, 0.027225f, 0.026841f, 0.026458f, 0.026075f, 0.025691f, 0.025308f, 0.024925f,
- 0.024541f, 0.024158f, 0.023774f, 0.023391f, 0.023008f, 0.022624f, 0.022241f, 0.021857f,
- 0.021474f, 0.021091f, 0.020707f, 0.020324f, 0.019940f, 0.019557f, 0.019174f, 0.018790f,
- 0.018407f, 0.018023f, 0.017640f, 0.017256f, 0.016873f, 0.016490f, 0.016106f, 0.015723f,
- 0.015339f, 0.014956f, 0.014572f, 0.014189f, 0.013805f, 0.013422f, 0.013038f, 0.012655f,
- 0.012272f, 0.011888f, 0.011505f, 0.011121f, 0.010738f, 0.010354f, 0.009971f, 0.009587f,
- 0.009204f, 0.008820f, 0.008437f, 0.008053f, 0.007670f, 0.007286f, 0.006903f, 0.006519f,
- 0.006136f, 0.005752f, 0.005369f, 0.004985f, 0.004602f, 0.004218f, 0.003835f, 0.003451f,
- 0.003068f, 0.002684f, 0.002301f, 0.001917f, 0.001534f, 0.001150f, 0.000767f, 0.000383f,
- 0.000000f, 0.000383f, 0.000767f, 0.001150f, 0.001534f, 0.001917f, 0.002301f, 0.002684f,
- 0.003068f, 0.003451f, 0.003835f, 0.004218f, 0.004602f, 0.004985f, 0.005369f, 0.005752f,
- 0.006136f, 0.006519f, 0.006903f, 0.007286f, 0.007670f, 0.008053f, 0.008437f, 0.008820f,
- 0.009204f, 0.009587f, 0.009971f, 0.010354f, 0.010738f, 0.011121f, 0.011505f, 0.011888f,
- 0.012272f, 0.012655f, 0.013038f, 0.013422f, 0.013805f, 0.014189f, 0.014572f, 0.014956f,
- 0.015339f, 0.015723f, 0.016106f, 0.016490f, 0.016873f, 0.017256f, 0.017640f, 0.018023f,
- 0.018407f, 0.018790f, 0.019174f, 0.019557f, 0.019940f, 0.020324f, 0.020707f, 0.021091f,
- 0.021474f, 0.021857f, 0.022241f, 0.022624f, 0.023008f, 0.023391f, 0.023774f, 0.024158f,
- 0.024541f, 0.024925f, 0.025308f, 0.025691f, 0.026075f, 0.026458f, 0.026841f, 0.027225f,
- 0.027608f, 0.027991f, 0.028375f, 0.028758f, 0.029142f, 0.029525f, 0.029908f, 0.030291f,
- 0.030675f, 0.031058f, 0.031441f, 0.031825f, 0.032208f, 0.032591f, 0.032975f, 0.033358f,
- 0.033741f, 0.034124f, 0.034508f, 0.034891f, 0.035274f, 0.035657f, 0.036041f, 0.036424f,
- 0.036807f, 0.037190f, 0.037574f, 0.037957f, 0.038340f, 0.038723f, 0.039107f, 0.039490f,
- 0.039873f, 0.040256f, 0.040639f, 0.041022f, 0.041406f, 0.041789f, 0.042172f, 0.042555f,
- 0.042938f, 0.043321f, 0.043705f, 0.044088f, 0.044471f, 0.044854f, 0.045237f, 0.045620f,
- 0.046003f, 0.046386f, 0.046769f, 0.047152f, 0.047535f, 0.047919f, 0.048302f, 0.048685f,
- 0.049068f, 0.049451f, 0.049834f, 0.050217f, 0.050600f, 0.050983f, 0.051366f, 0.051749f,
- 0.052132f, 0.052515f, 0.052898f, 0.053281f, 0.053664f, 0.054046f, 0.054429f, 0.054812f,
- 0.055195f, 0.055578f, 0.055961f, 0.056344f, 0.056727f, 0.057110f, 0.057493f, 0.057875f,
- 0.058258f, 0.058641f, 0.059024f, 0.059407f, 0.059790f, 0.060172f, 0.060555f, 0.060938f,
- 0.061321f, 0.061704f, 0.062086f, 0.062469f, 0.062852f, 0.063234f, 0.063617f, 0.064000f,
- 0.064383f, 0.064765f, 0.065148f, 0.065531f, 0.065913f, 0.066296f, 0.066679f, 0.067061f,
- 0.067444f, 0.067827f, 0.068209f, 0.068592f, 0.068974f, 0.069357f, 0.069739f, 0.070122f,
- 0.070505f, 0.070887f, 0.071270f, 0.071652f, 0.072035f, 0.072417f, 0.072800f, 0.073182f,
- 0.073565f, 0.073947f, 0.074329f, 0.074712f, 0.075094f, 0.075477f, 0.075859f, 0.076241f,
- 0.076624f, 0.077006f, 0.077389f, 0.077771f, 0.078153f, 0.078536f, 0.078918f, 0.079300f,
- 0.079682f, 0.080065f, 0.080447f, 0.080829f, 0.081211f, 0.081594f, 0.081976f, 0.082358f,
- 0.082740f, 0.083122f, 0.083505f, 0.083887f, 0.084269f, 0.084651f, 0.085033f, 0.085415f,
- 0.085797f, 0.086179f, 0.086561f, 0.086943f, 0.087326f, 0.087708f, 0.088090f, 0.088472f,
- 0.088854f, 0.089236f, 0.089617f, 0.089999f, 0.090381f, 0.090763f, 0.091145f, 0.091527f,
- 0.091909f, 0.092291f, 0.092673f, 0.093055f, 0.093436f, 0.093818f, 0.094200f, 0.094582f,
- 0.094963f, 0.095345f, 0.095727f, 0.096109f, 0.096490f, 0.096872f, 0.097254f, 0.097635f,
- 0.098017f, 0.098399f, 0.098780f, 0.099162f, 0.099544f, 0.099925f, 0.100307f, 0.100688f,
- 0.101070f, 0.101451f, 0.101833f, 0.102214f, 0.102596f, 0.102977f, 0.103359f, 0.103740f,
- 0.104122f, 0.104503f, 0.104884f, 0.105266f, 0.105647f, 0.106028f, 0.106410f, 0.106791f,
- 0.107172f, 0.107554f, 0.107935f, 0.108316f, 0.108697f, 0.109079f, 0.109460f, 0.109841f,
- 0.110222f, 0.110603f, 0.110984f, 0.111366f, 0.111747f, 0.112128f, 0.112509f, 0.112890f,
- 0.113271f, 0.113652f, 0.114033f, 0.114414f, 0.114795f, 0.115176f, 0.115557f, 0.115938f,
- 0.116319f, 0.116700f, 0.117080f, 0.117461f, 0.117842f, 0.118223f, 0.118604f, 0.118984f,
- 0.119365f, 0.119746f, 0.120127f, 0.120507f, 0.120888f, 0.121269f, 0.121649f, 0.122030f,
- 0.122411f, 0.122791f, 0.123172f, 0.123552f, 0.123933f, 0.124314f, 0.124694f, 0.125075f,
- 0.125455f, 0.125835f, 0.126216f, 0.126596f, 0.126977f, 0.127357f, 0.127737f, 0.128118f,
- 0.128498f, 0.128878f, 0.129259f, 0.129639f, 0.130019f, 0.130399f, 0.130780f, 0.131160f,
- 0.131540f, 0.131920f, 0.132300f, 0.132680f, 0.133061f, 0.133441f, 0.133821f, 0.134201f,
- 0.134581f, 0.134961f, 0.135341f, 0.135721f, 0.136101f, 0.136480f, 0.136860f, 0.137240f,
- 0.137620f, 0.138000f, 0.138380f, 0.138760f, 0.139139f, 0.139519f, 0.139899f, 0.140279f,
- 0.140658f, 0.141038f, 0.141418f, 0.141797f, 0.142177f, 0.142556f, 0.142936f, 0.143316f,
- 0.143695f, 0.144075f, 0.144454f, 0.144833f, 0.145213f, 0.145592f, 0.145972f, 0.146351f,
- 0.146730f, 0.147110f, 0.147489f, 0.147868f, 0.148248f, 0.148627f, 0.149006f, 0.149385f,
- 0.149765f, 0.150144f, 0.150523f, 0.150902f, 0.151281f, 0.151660f, 0.152039f, 0.152418f,
- 0.152797f, 0.153176f, 0.153555f, 0.153934f, 0.154313f, 0.154692f, 0.155071f, 0.155450f,
- 0.155828f, 0.156207f, 0.156586f, 0.156965f, 0.157343f, 0.157722f, 0.158101f, 0.158480f,
- 0.158858f, 0.159237f, 0.159615f, 0.159994f, 0.160372f, 0.160751f, 0.161129f, 0.161508f,
- 0.161886f, 0.162265f, 0.162643f, 0.163022f, 0.163400f, 0.163778f, 0.164157f, 0.164535f,
- 0.164913f, 0.165291f, 0.165670f, 0.166048f, 0.166426f, 0.166804f, 0.167182f, 0.167560f,
- 0.167938f, 0.168316f, 0.168694f, 0.169072f, 0.169450f, 0.169828f, 0.170206f, 0.170584f,
- 0.170962f, 0.171340f, 0.171718f, 0.172095f, 0.172473f, 0.172851f, 0.173229f, 0.173606f,
- 0.173984f, 0.174362f, 0.174739f, 0.175117f, 0.175494f, 0.175872f, 0.176249f, 0.176627f,
- 0.177004f, 0.177382f, 0.177759f, 0.178136f, 0.178514f, 0.178891f, 0.179268f, 0.179646f,
- 0.180023f, 0.180400f, 0.180777f, 0.181154f, 0.181532f, 0.181909f, 0.182286f, 0.182663f,
- 0.183040f, 0.183417f, 0.183794f, 0.184171f, 0.184548f, 0.184925f, 0.185301f, 0.185678f,
- 0.186055f, 0.186432f, 0.186809f, 0.187185f, 0.187562f, 0.187939f, 0.188315f, 0.188692f,
- 0.189069f, 0.189445f, 0.189822f, 0.190198f, 0.190575f, 0.190951f, 0.191328f, 0.191704f,
- 0.192080f, 0.192457f, 0.192833f, 0.193209f, 0.193586f, 0.193962f, 0.194338f, 0.194714f,
- 0.195090f, 0.195466f, 0.195843f, 0.196219f, 0.196595f, 0.196971f, 0.197347f, 0.197722f,
- 0.198098f, 0.198474f, 0.198850f, 0.199226f, 0.199602f, 0.199978f, 0.200353f, 0.200729f,
- 0.201105f, 0.201480f, 0.201856f, 0.202231f, 0.202607f, 0.202983f, 0.203358f, 0.203734f,
- 0.204109f, 0.204484f, 0.204860f, 0.205235f, 0.205610f, 0.205986f, 0.206361f, 0.206736f,
- 0.207111f, 0.207487f, 0.207862f, 0.208237f, 0.208612f, 0.208987f, 0.209362f, 0.209737f,
- 0.210112f, 0.210487f, 0.210862f, 0.211237f, 0.211611f, 0.211986f, 0.212361f, 0.212736f,
- 0.213110f, 0.213485f, 0.213860f, 0.214234f, 0.214609f, 0.214983f, 0.215358f, 0.215732f,
- 0.216107f, 0.216481f, 0.216856f, 0.217230f, 0.217604f, 0.217979f, 0.218353f, 0.218727f,
- 0.219101f, 0.219475f, 0.219850f, 0.220224f, 0.220598f, 0.220972f, 0.221346f, 0.221720f,
- 0.222094f, 0.222468f, 0.222841f, 0.223215f, 0.223589f, 0.223963f, 0.224337f, 0.224710f,
- 0.225084f, 0.225458f, 0.225831f, 0.226205f, 0.226578f, 0.226952f, 0.227325f, 0.227699f,
- 0.228072f, 0.228445f, 0.228819f, 0.229192f, 0.229565f, 0.229939f, 0.230312f, 0.230685f,
- 0.231058f, 0.231431f, 0.231804f, 0.232177f, 0.232550f, 0.232923f, 0.233296f, 0.233669f,
- 0.234042f, 0.234415f, 0.234788f, 0.235160f, 0.235533f, 0.235906f, 0.236278f, 0.236651f,
- 0.237024f, 0.237396f, 0.237769f, 0.238141f, 0.238514f, 0.238886f, 0.239258f, 0.239631f,
- 0.240003f, 0.240375f, 0.240748f, 0.241120f, 0.241492f, 0.241864f, 0.242236f, 0.242608f,
- 0.242980f, 0.243352f, 0.243724f, 0.244096f, 0.244468f, 0.244840f, 0.245212f, 0.245583f,
- 0.245955f, 0.246327f, 0.246698f, 0.247070f, 0.247442f, 0.247813f, 0.248185f, 0.248556f,
- 0.248928f, 0.249299f, 0.249670f, 0.250042f, 0.250413f, 0.250784f, 0.251155f, 0.251527f,
- 0.251898f, 0.252269f, 0.252640f, 0.253011f, 0.253382f, 0.253753f, 0.254124f, 0.254495f,
- 0.254866f, 0.255236f, 0.255607f, 0.255978f, 0.256349f, 0.256719f, 0.257090f, 0.257461f,
- 0.257831f, 0.258202f, 0.258572f, 0.258943f, 0.259313f, 0.259683f, 0.260054f, 0.260424f,
- 0.260794f, 0.261164f, 0.261534f, 0.261905f, 0.262275f, 0.262645f, 0.263015f, 0.263385f,
- 0.263755f, 0.264125f, 0.264494f, 0.264864f, 0.265234f, 0.265604f, 0.265973f, 0.266343f,
- 0.266713f, 0.267082f, 0.267452f, 0.267821f, 0.268191f, 0.268560f, 0.268930f, 0.269299f,
- 0.269668f, 0.270038f, 0.270407f, 0.270776f, 0.271145f, 0.271514f, 0.271883f, 0.272252f,
- 0.272621f, 0.272990f, 0.273359f, 0.273728f, 0.274097f, 0.274466f, 0.274834f, 0.275203f,
- 0.275572f, 0.275940f, 0.276309f, 0.276678f, 0.277046f, 0.277415f, 0.277783f, 0.278151f,
- 0.278520f, 0.278888f, 0.279256f, 0.279624f, 0.279993f, 0.280361f, 0.280729f, 0.281097f,
- 0.281465f, 0.281833f, 0.282201f, 0.282569f, 0.282937f, 0.283304f, 0.283672f, 0.284040f,
- 0.284408f, 0.284775f, 0.285143f, 0.285510f, 0.285878f, 0.286245f, 0.286613f, 0.286980f,
- 0.287347f, 0.287715f, 0.288082f, 0.288449f, 0.288816f, 0.289184f, 0.289551f, 0.289918f,
- 0.290285f, 0.290652f, 0.291019f, 0.291385f, 0.291752f, 0.292119f, 0.292486f, 0.292852f,
- 0.293219f, 0.293586f, 0.293952f, 0.294319f, 0.294685f, 0.295052f, 0.295418f, 0.295785f,
- 0.296151f, 0.296517f, 0.296883f, 0.297250f, 0.297616f, 0.297982f, 0.298348f, 0.298714f,
- 0.299080f, 0.299446f, 0.299812f, 0.300177f, 0.300543f, 0.300909f, 0.301275f, 0.301640f,
- 0.302006f, 0.302372f, 0.302737f, 0.303103f, 0.303468f, 0.303833f, 0.304199f, 0.304564f,
- 0.304929f, 0.305294f, 0.305660f, 0.306025f, 0.306390f, 0.306755f, 0.307120f, 0.307485f,
- 0.307850f, 0.308214f, 0.308579f, 0.308944f, 0.309309f, 0.309673f, 0.310038f, 0.310403f,
- 0.310767f, 0.311132f, 0.311496f, 0.311860f, 0.312225f, 0.312589f, 0.312953f, 0.313318f,
- 0.313682f, 0.314046f, 0.314410f, 0.314774f, 0.315138f, 0.315502f, 0.315866f, 0.316230f,
- 0.316593f, 0.316957f, 0.317321f, 0.317684f, 0.318048f, 0.318412f, 0.318775f, 0.319139f,
- 0.319502f, 0.319865f, 0.320229f, 0.320592f, 0.320955f, 0.321318f, 0.321682f, 0.322045f,
- 0.322408f, 0.322771f, 0.323134f, 0.323497f, 0.323859f, 0.324222f, 0.324585f, 0.324948f,
- 0.325310f, 0.325673f, 0.326035f, 0.326398f, 0.326760f, 0.327123f, 0.327485f, 0.327848f,
- 0.328210f, 0.328572f, 0.328934f, 0.329296f, 0.329658f, 0.330020f, 0.330382f, 0.330744f,
- 0.331106f, 0.331468f, 0.331830f, 0.332192f, 0.332553f, 0.332915f, 0.333277f, 0.333638f,
- 0.334000f, 0.334361f, 0.334722f, 0.335084f, 0.335445f, 0.335806f, 0.336168f, 0.336529f,
- 0.336890f, 0.337251f, 0.337612f, 0.337973f, 0.338334f, 0.338695f, 0.339055f, 0.339416f,
- 0.339777f, 0.340138f, 0.340498f, 0.340859f, 0.341219f, 0.341580f, 0.341940f, 0.342300f,
- 0.342661f, 0.343021f, 0.343381f, 0.343741f, 0.344101f, 0.344461f, 0.344821f, 0.345181f,
- 0.345541f, 0.345901f, 0.346261f, 0.346621f, 0.346980f, 0.347340f, 0.347700f, 0.348059f,
- 0.348419f, 0.348778f, 0.349138f, 0.349497f, 0.349856f, 0.350215f, 0.350575f, 0.350934f,
- 0.351293f, 0.351652f, 0.352011f, 0.352370f, 0.352729f, 0.353087f, 0.353446f, 0.353805f,
- 0.354164f, 0.354522f, 0.354881f, 0.355239f, 0.355598f, 0.355956f, 0.356314f, 0.356673f,
- 0.357031f, 0.357389f, 0.357747f, 0.358105f, 0.358463f, 0.358821f, 0.359179f, 0.359537f,
- 0.359895f, 0.360253f, 0.360611f, 0.360968f, 0.361326f, 0.361683f, 0.362041f, 0.362398f,
- 0.362756f, 0.363113f, 0.363470f, 0.363828f, 0.364185f, 0.364542f, 0.364899f, 0.365256f,
- 0.365613f, 0.365970f, 0.366327f, 0.366684f, 0.367040f, 0.367397f, 0.367754f, 0.368110f,
- 0.368467f, 0.368823f, 0.369180f, 0.369536f, 0.369892f, 0.370249f, 0.370605f, 0.370961f,
- 0.371317f, 0.371673f, 0.372029f, 0.372385f, 0.372741f, 0.373097f, 0.373453f, 0.373808f,
- 0.374164f, 0.374520f, 0.374875f, 0.375231f, 0.375586f, 0.375942f, 0.376297f, 0.376652f,
- 0.377007f, 0.377363f, 0.377718f, 0.378073f, 0.378428f, 0.378783f, 0.379138f, 0.379492f,
- 0.379847f, 0.380202f, 0.380557f, 0.380911f, 0.381266f, 0.381620f, 0.381975f, 0.382329f,
- 0.382683f, 0.383038f, 0.383392f, 0.383746f, 0.384100f, 0.384454f, 0.384808f, 0.385162f,
- 0.385516f, 0.385870f, 0.386224f, 0.386577f, 0.386931f, 0.387285f, 0.387638f, 0.387992f,
- 0.388345f, 0.388698f, 0.389052f, 0.389405f, 0.389758f, 0.390111f, 0.390464f, 0.390817f,
- 0.391170f, 0.391523f, 0.391876f, 0.392229f, 0.392582f, 0.392934f, 0.393287f, 0.393640f,
- 0.393992f, 0.394344f, 0.394697f, 0.395049f, 0.395401f, 0.395754f, 0.396106f, 0.396458f,
- 0.396810f, 0.397162f, 0.397514f, 0.397866f, 0.398218f, 0.398569f, 0.398921f, 0.399273f,
- 0.399624f, 0.399976f, 0.400327f, 0.400679f, 0.401030f, 0.401381f, 0.401732f, 0.402084f,
- 0.402435f, 0.402786f, 0.403137f, 0.403488f, 0.403838f, 0.404189f, 0.404540f, 0.404891f,
- 0.405241f, 0.405592f, 0.405942f, 0.406293f, 0.406643f, 0.406994f, 0.407344f, 0.407694f,
- 0.408044f, 0.408394f, 0.408744f, 0.409094f, 0.409444f, 0.409794f, 0.410144f, 0.410493f,
- 0.410843f, 0.411193f, 0.411542f, 0.411892f, 0.412241f, 0.412591f, 0.412940f, 0.413289f,
- 0.413638f, 0.413987f, 0.414337f, 0.414685f, 0.415034f, 0.415383f, 0.415732f, 0.416081f,
- 0.416430f, 0.416778f, 0.417127f, 0.417475f, 0.417824f, 0.418172f, 0.418520f, 0.418869f,
- 0.419217f, 0.419565f, 0.419913f, 0.420261f, 0.420609f, 0.420957f, 0.421305f, 0.421653f,
- 0.422000f, 0.422348f, 0.422695f, 0.423043f, 0.423390f, 0.423738f, 0.424085f, 0.424432f,
- 0.424780f, 0.425127f, 0.425474f, 0.425821f, 0.426168f, 0.426515f, 0.426862f, 0.427208f,
- 0.427555f, 0.427902f, 0.428248f, 0.428595f, 0.428941f, 0.429288f, 0.429634f, 0.429980f,
- 0.430326f, 0.430673f, 0.431019f, 0.431365f, 0.431711f, 0.432057f, 0.432402f, 0.432748f,
- 0.433094f, 0.433439f, 0.433785f, 0.434131f, 0.434476f, 0.434821f, 0.435167f, 0.435512f,
- 0.435857f, 0.436202f, 0.436547f, 0.436892f, 0.437237f, 0.437582f, 0.437927f, 0.438272f,
- 0.438616f, 0.438961f, 0.439305f, 0.439650f, 0.439994f, 0.440339f, 0.440683f, 0.441027f,
- 0.441371f, 0.441715f, 0.442059f, 0.442403f, 0.442747f, 0.443091f, 0.443435f, 0.443779f,
- 0.444122f, 0.444466f, 0.444809f, 0.445153f, 0.445496f, 0.445839f, 0.446183f, 0.446526f,
- 0.446869f, 0.447212f, 0.447555f, 0.447898f, 0.448241f, 0.448583f, 0.448926f, 0.449269f,
- 0.449611f, 0.449954f, 0.450296f, 0.450639f, 0.450981f, 0.451323f, 0.451665f, 0.452008f,
- 0.452350f, 0.452692f, 0.453033f, 0.453375f, 0.453717f, 0.454059f, 0.454400f, 0.454742f,
- 0.455084f, 0.455425f, 0.455766f, 0.456108f, 0.456449f, 0.456790f, 0.457131f, 0.457472f,
- 0.457813f, 0.458154f, 0.458495f, 0.458836f, 0.459177f, 0.459517f, 0.459858f, 0.460198f,
- 0.460539f, 0.460879f, 0.461219f, 0.461560f, 0.461900f, 0.462240f, 0.462580f, 0.462920f,
- 0.463260f, 0.463600f, 0.463939f, 0.464279f, 0.464619f, 0.464958f, 0.465298f, 0.465637f,
- 0.465977f, 0.466316f, 0.466655f, 0.466994f, 0.467333f, 0.467672f, 0.468011f, 0.468350f,
- 0.468689f, 0.469028f, 0.469366f, 0.469705f, 0.470043f, 0.470382f, 0.470720f, 0.471058f,
- 0.471397f, 0.471735f, 0.472073f, 0.472411f, 0.472749f, 0.473087f, 0.473425f, 0.473763f,
- 0.474100f, 0.474438f, 0.474775f, 0.475113f, 0.475450f, 0.475788f, 0.476125f, 0.476462f,
- 0.476799f, 0.477136f, 0.477473f, 0.477810f, 0.478147f, 0.478484f, 0.478821f, 0.479157f,
- 0.479494f, 0.479830f, 0.480167f, 0.480503f, 0.480839f, 0.481176f, 0.481512f, 0.481848f,
- 0.482184f, 0.482520f, 0.482856f, 0.483191f, 0.483527f, 0.483863f, 0.484198f, 0.484534f,
- 0.484869f, 0.485205f, 0.485540f, 0.485875f, 0.486210f, 0.486545f, 0.486880f, 0.487215f,
- 0.487550f, 0.487885f, 0.488220f, 0.488554f, 0.488889f, 0.489223f, 0.489558f, 0.489892f,
- 0.490226f, 0.490561f, 0.490895f, 0.491229f, 0.491563f, 0.491897f, 0.492231f, 0.492564f,
- 0.492898f, 0.493232f, 0.493565f, 0.493899f, 0.494232f, 0.494566f, 0.494899f, 0.495232f,
- 0.495565f, 0.495898f, 0.496231f, 0.496564f, 0.496897f, 0.497230f, 0.497562f, 0.497895f,
- 0.498228f, 0.498560f, 0.498893f, 0.499225f, 0.499557f, 0.499889f, 0.500221f, 0.500553f,
- 0.500885f, 0.501217f, 0.501549f, 0.501881f, 0.502212f, 0.502544f, 0.502876f, 0.503207f,
- 0.503538f, 0.503870f, 0.504201f, 0.504532f, 0.504863f, 0.505194f, 0.505525f, 0.505856f,
- 0.506187f, 0.506517f, 0.506848f, 0.507179f, 0.507509f, 0.507839f, 0.508170f, 0.508500f,
- 0.508830f, 0.509160f, 0.509490f, 0.509820f, 0.510150f, 0.510480f, 0.510810f, 0.511139f,
- 0.511469f, 0.511798f, 0.512128f, 0.512457f, 0.512786f, 0.513116f, 0.513445f, 0.513774f,
- 0.514103f, 0.514432f, 0.514760f, 0.515089f, 0.515418f, 0.515746f, 0.516075f, 0.516403f,
- 0.516732f, 0.517060f, 0.517388f, 0.517716f, 0.518045f, 0.518372f, 0.518700f, 0.519028f,
- 0.519356f, 0.519684f, 0.520011f, 0.520339f, 0.520666f, 0.520994f, 0.521321f, 0.521648f,
- 0.521975f, 0.522302f, 0.522629f, 0.522956f, 0.523283f, 0.523610f, 0.523937f, 0.524263f,
- 0.524590f, 0.524916f, 0.525243f, 0.525569f, 0.525895f, 0.526221f, 0.526547f, 0.526873f,
- 0.527199f, 0.527525f, 0.527851f, 0.528176f, 0.528502f, 0.528828f, 0.529153f, 0.529478f,
- 0.529804f, 0.530129f, 0.530454f, 0.530779f, 0.531104f, 0.531429f, 0.531754f, 0.532078f,
- 0.532403f, 0.532728f, 0.533052f, 0.533377f, 0.533701f, 0.534025f, 0.534349f, 0.534674f,
- 0.534998f, 0.535322f, 0.535645f, 0.535969f, 0.536293f, 0.536617f, 0.536940f, 0.537264f,
- 0.537587f, 0.537910f, 0.538234f, 0.538557f, 0.538880f, 0.539203f, 0.539526f, 0.539849f,
- 0.540171f, 0.540494f, 0.540817f, 0.541139f, 0.541462f, 0.541784f, 0.542106f, 0.542429f,
- 0.542751f, 0.543073f, 0.543395f, 0.543717f, 0.544039f, 0.544360f, 0.544682f, 0.545003f,
- 0.545325f, 0.545646f, 0.545968f, 0.546289f, 0.546610f, 0.546931f, 0.547252f, 0.547573f,
- 0.547894f, 0.548215f, 0.548536f, 0.548856f, 0.549177f, 0.549497f, 0.549818f, 0.550138f,
- 0.550458f, 0.550778f, 0.551098f, 0.551418f, 0.551738f, 0.552058f, 0.552378f, 0.552697f,
- 0.553017f, 0.553336f, 0.553656f, 0.553975f, 0.554294f, 0.554613f, 0.554932f, 0.555251f,
- 0.555570f, 0.555889f, 0.556208f, 0.556526f, 0.556845f, 0.557164f, 0.557482f, 0.557800f,
- 0.558119f, 0.558437f, 0.558755f, 0.559073f, 0.559391f, 0.559709f, 0.560026f, 0.560344f,
- 0.560662f, 0.560979f, 0.561297f, 0.561614f, 0.561931f, 0.562248f, 0.562565f, 0.562882f,
- 0.563199f, 0.563516f, 0.563833f, 0.564150f, 0.564466f, 0.564783f, 0.565099f, 0.565416f,
- 0.565732f, 0.566048f, 0.566364f, 0.566680f, 0.566996f, 0.567312f, 0.567628f, 0.567943f,
- 0.568259f, 0.568574f, 0.568890f, 0.569205f, 0.569521f, 0.569836f, 0.570151f, 0.570466f,
- 0.570781f, 0.571096f, 0.571410f, 0.571725f, 0.572040f, 0.572354f, 0.572669f, 0.572983f,
- 0.573297f, 0.573611f, 0.573925f, 0.574239f, 0.574553f, 0.574867f, 0.575181f, 0.575495f,
- 0.575808f, 0.576122f, 0.576435f, 0.576748f, 0.577062f, 0.577375f, 0.577688f, 0.578001f,
- 0.578314f, 0.578627f, 0.578939f, 0.579252f, 0.579565f, 0.579877f, 0.580189f, 0.580502f,
- 0.580814f, 0.581126f, 0.581438f, 0.581750f, 0.582062f, 0.582374f, 0.582685f, 0.582997f,
- 0.583309f, 0.583620f, 0.583931f, 0.584243f, 0.584554f, 0.584865f, 0.585176f, 0.585487f,
- 0.585798f, 0.586109f, 0.586419f, 0.586730f, 0.587040f, 0.587351f, 0.587661f, 0.587971f,
- 0.588282f, 0.588592f, 0.588902f, 0.589212f, 0.589521f, 0.589831f, 0.590141f, 0.590450f,
- 0.590760f, 0.591069f, 0.591378f, 0.591688f, 0.591997f, 0.592306f, 0.592615f, 0.592924f,
- 0.593232f, 0.593541f, 0.593850f, 0.594158f, 0.594467f, 0.594775f, 0.595083f, 0.595391f,
- 0.595699f, 0.596007f, 0.596315f, 0.596623f, 0.596931f, 0.597238f, 0.597546f, 0.597853f,
- 0.598161f, 0.598468f, 0.598775f, 0.599082f, 0.599389f, 0.599696f, 0.600003f, 0.600310f,
- 0.600616f, 0.600923f, 0.601230f, 0.601536f, 0.601842f, 0.602148f, 0.602455f, 0.602761f,
- 0.603067f, 0.603372f, 0.603678f, 0.603984f, 0.604290f, 0.604595f, 0.604900f, 0.605206f,
- 0.605511f, 0.605816f, 0.606121f, 0.606426f, 0.606731f, 0.607036f, 0.607341f, 0.607645f,
- 0.607950f, 0.608254f, 0.608559f, 0.608863f, 0.609167f, 0.609471f, 0.609775f, 0.610079f,
- 0.610383f, 0.610687f, 0.610990f, 0.611294f, 0.611597f, 0.611901f, 0.612204f, 0.612507f,
- 0.612810f, 0.613113f, 0.613416f, 0.613719f, 0.614022f, 0.614324f, 0.614627f, 0.614929f,
- 0.615232f, 0.615534f, 0.615836f, 0.616138f, 0.616440f, 0.616742f, 0.617044f, 0.617346f,
- 0.617647f, 0.617949f, 0.618250f, 0.618552f, 0.618853f, 0.619154f, 0.619455f, 0.619756f,
- 0.620057f, 0.620358f, 0.620659f, 0.620959f, 0.621260f, 0.621560f, 0.621861f, 0.622161f,
- 0.622461f, 0.622761f, 0.623061f, 0.623361f, 0.623661f, 0.623961f, 0.624260f, 0.624560f,
- 0.624860f, 0.625159f, 0.625458f, 0.625757f, 0.626056f, 0.626355f, 0.626654f, 0.626953f,
- 0.627252f, 0.627550f, 0.627849f, 0.628147f, 0.628446f, 0.628744f, 0.629042f, 0.629340f,
- 0.629638f, 0.629936f, 0.630234f, 0.630532f, 0.630829f, 0.631127f, 0.631424f, 0.631721f,
- 0.632019f, 0.632316f, 0.632613f, 0.632910f, 0.633207f, 0.633504f, 0.633800f, 0.634097f,
- 0.634393f, 0.634690f, 0.634986f, 0.635282f, 0.635578f, 0.635874f, 0.636170f, 0.636466f,
- 0.636762f, 0.637057f, 0.637353f, 0.637649f, 0.637944f, 0.638239f, 0.638534f, 0.638829f,
- 0.639124f, 0.639419f, 0.639714f, 0.640009f, 0.640303f, 0.640598f, 0.640892f, 0.641187f,
- 0.641481f, 0.641775f, 0.642069f, 0.642363f, 0.642657f, 0.642951f, 0.643245f, 0.643538f,
- 0.643832f, 0.644125f, 0.644418f, 0.644711f, 0.645005f, 0.645298f, 0.645590f, 0.645883f,
- 0.646176f, 0.646469f, 0.646761f, 0.647054f, 0.647346f, 0.647638f, 0.647930f, 0.648222f,
- 0.648514f, 0.648806f, 0.649098f, 0.649390f, 0.649681f, 0.649973f, 0.650264f, 0.650555f,
- 0.650847f, 0.651138f, 0.651429f, 0.651720f, 0.652011f, 0.652301f, 0.652592f, 0.652882f,
- 0.653173f, 0.653463f, 0.653753f, 0.654044f, 0.654334f, 0.654624f, 0.654913f, 0.655203f,
- 0.655493f, 0.655782f, 0.656072f, 0.656361f, 0.656651f, 0.656940f, 0.657229f, 0.657518f,
- 0.657807f, 0.658095f, 0.658384f, 0.658673f, 0.658961f, 0.659250f, 0.659538f, 0.659826f,
- 0.660114f, 0.660402f, 0.660690f, 0.660978f, 0.661266f, 0.661553f, 0.661841f, 0.662128f,
- 0.662416f, 0.662703f, 0.662990f, 0.663277f, 0.663564f, 0.663851f, 0.664138f, 0.664424f,
- 0.664711f, 0.664997f, 0.665284f, 0.665570f, 0.665856f, 0.666142f, 0.666428f, 0.666714f,
- 0.667000f, 0.667286f, 0.667571f, 0.667857f, 0.668142f, 0.668427f, 0.668712f, 0.668998f,
- 0.669283f, 0.669567f, 0.669852f, 0.670137f, 0.670422f, 0.670706f, 0.670990f, 0.671275f,
- 0.671559f, 0.671843f, 0.672127f, 0.672411f, 0.672695f, 0.672978f, 0.673262f, 0.673546f,
- 0.673829f, 0.674112f, 0.674396f, 0.674679f, 0.674962f, 0.675245f, 0.675527f, 0.675810f,
- 0.676093f, 0.676375f, 0.676658f, 0.676940f, 0.677222f, 0.677504f, 0.677786f, 0.678068f,
- 0.678350f, 0.678632f, 0.678913f, 0.679195f, 0.679476f, 0.679758f, 0.680039f, 0.680320f,
- 0.680601f, 0.680882f, 0.681163f, 0.681443f, 0.681724f, 0.682005f, 0.682285f, 0.682565f,
- 0.682846f, 0.683126f, 0.683406f, 0.683686f, 0.683965f, 0.684245f, 0.684525f, 0.684804f,
- 0.685084f, 0.685363f, 0.685642f, 0.685921f, 0.686200f, 0.686479f, 0.686758f, 0.687037f,
- 0.687315f, 0.687594f, 0.687872f, 0.688151f, 0.688429f, 0.688707f, 0.688985f, 0.689263f,
- 0.689541f, 0.689818f, 0.690096f, 0.690373f, 0.690651f, 0.690928f, 0.691205f, 0.691482f,
- 0.691759f, 0.692036f, 0.692313f, 0.692590f, 0.692866f, 0.693143f, 0.693419f, 0.693695f,
- 0.693971f, 0.694248f, 0.694524f, 0.694799f, 0.695075f, 0.695351f, 0.695626f, 0.695902f,
- 0.696177f, 0.696452f, 0.696728f, 0.697003f, 0.697277f, 0.697552f, 0.697827f, 0.698102f,
- 0.698376f, 0.698651f, 0.698925f, 0.699199f, 0.699473f, 0.699747f, 0.700021f, 0.700295f,
- 0.700569f, 0.700842f, 0.701116f, 0.701389f, 0.701663f, 0.701936f, 0.702209f, 0.702482f,
- 0.702755f, 0.703028f, 0.703300f, 0.703573f, 0.703845f, 0.704118f, 0.704390f, 0.704662f,
- 0.704934f, 0.705206f, 0.705478f, 0.705750f, 0.706021f, 0.706293f, 0.706564f, 0.706836f,
- 0.707107f, 0.707378f, 0.707649f, 0.707920f, 0.708191f, 0.708461f, 0.708732f, 0.709002f,
- 0.709273f, 0.709543f, 0.709813f, 0.710083f, 0.710353f, 0.710623f, 0.710893f, 0.711163f,
- 0.711432f, 0.711702f, 0.711971f, 0.712240f, 0.712509f, 0.712778f, 0.713047f, 0.713316f,
- 0.713585f, 0.713853f, 0.714122f, 0.714390f, 0.714659f, 0.714927f, 0.715195f, 0.715463f,
- 0.715731f, 0.715999f, 0.716266f, 0.716534f, 0.716801f, 0.717069f, 0.717336f, 0.717603f,
- 0.717870f, 0.718137f, 0.718404f, 0.718670f, 0.718937f, 0.719204f, 0.719470f, 0.719736f,
- 0.720003f, 0.720269f, 0.720535f, 0.720800f, 0.721066f, 0.721332f, 0.721597f, 0.721863f,
- 0.722128f, 0.722393f, 0.722659f, 0.722924f, 0.723188f, 0.723453f, 0.723718f, 0.723983f,
- 0.724247f, 0.724511f, 0.724776f, 0.725040f, 0.725304f, 0.725568f, 0.725832f, 0.726095f,
- 0.726359f, 0.726623f, 0.726886f, 0.727149f, 0.727413f, 0.727676f, 0.727939f, 0.728202f,
- 0.728464f, 0.728727f, 0.728990f, 0.729252f, 0.729514f, 0.729777f, 0.730039f, 0.730301f,
- 0.730563f, 0.730825f, 0.731086f, 0.731348f, 0.731609f, 0.731871f, 0.732132f, 0.732393f,
- 0.732654f, 0.732915f, 0.733176f, 0.733437f, 0.733697f, 0.733958f, 0.734218f, 0.734479f,
- 0.734739f, 0.734999f, 0.735259f, 0.735519f, 0.735779f, 0.736038f, 0.736298f, 0.736557f,
- 0.736817f, 0.737076f, 0.737335f, 0.737594f, 0.737853f, 0.738112f, 0.738370f, 0.738629f,
- 0.738887f, 0.739146f, 0.739404f, 0.739662f, 0.739920f, 0.740178f, 0.740436f, 0.740694f,
- 0.740951f, 0.741209f, 0.741466f, 0.741723f, 0.741980f, 0.742237f, 0.742494f, 0.742751f,
- 0.743008f, 0.743265f, 0.743521f, 0.743777f, 0.744034f, 0.744290f, 0.744546f, 0.744802f,
- 0.745058f, 0.745314f, 0.745569f, 0.745825f, 0.746080f, 0.746335f, 0.746591f, 0.746846f,
- 0.747101f, 0.747355f, 0.747610f, 0.747865f, 0.748119f, 0.748374f, 0.748628f, 0.748882f,
- 0.749136f, 0.749390f, 0.749644f, 0.749898f, 0.750152f, 0.750405f, 0.750659f, 0.750912f,
- 0.751165f, 0.751418f, 0.751671f, 0.751924f, 0.752177f, 0.752429f, 0.752682f, 0.752934f,
- 0.753187f, 0.753439f, 0.753691f, 0.753943f, 0.754195f, 0.754447f, 0.754698f, 0.754950f,
- 0.755201f, 0.755453f, 0.755704f, 0.755955f, 0.756206f, 0.756457f, 0.756708f, 0.756958f,
- 0.757209f, 0.757459f, 0.757710f, 0.757960f, 0.758210f, 0.758460f, 0.758710f, 0.758960f,
- 0.759209f, 0.759459f, 0.759708f, 0.759957f, 0.760207f, 0.760456f, 0.760705f, 0.760954f,
- 0.761202f, 0.761451f, 0.761700f, 0.761948f, 0.762196f, 0.762444f, 0.762693f, 0.762941f,
- 0.763188f, 0.763436f, 0.763684f, 0.763931f, 0.764179f, 0.764426f, 0.764673f, 0.764920f,
- 0.765167f, 0.765414f, 0.765661f, 0.765907f, 0.766154f, 0.766400f, 0.766647f, 0.766893f,
- 0.767139f, 0.767385f, 0.767631f, 0.767876f, 0.768122f, 0.768368f, 0.768613f, 0.768858f,
- 0.769103f, 0.769348f, 0.769593f, 0.769838f, 0.770083f, 0.770327f, 0.770572f, 0.770816f,
- 0.771061f, 0.771305f, 0.771549f, 0.771793f, 0.772036f, 0.772280f, 0.772524f, 0.772767f,
- 0.773010f, 0.773254f, 0.773497f, 0.773740f, 0.773983f, 0.774225f, 0.774468f, 0.774711f,
- 0.774953f, 0.775195f, 0.775438f, 0.775680f, 0.775922f, 0.776164f, 0.776405f, 0.776647f,
- 0.776888f, 0.777130f, 0.777371f, 0.777612f, 0.777853f, 0.778094f, 0.778335f, 0.778576f,
- 0.778817f, 0.779057f, 0.779297f, 0.779538f, 0.779778f, 0.780018f, 0.780258f, 0.780498f,
- 0.780737f, 0.780977f, 0.781216f, 0.781456f, 0.781695f, 0.781934f, 0.782173f, 0.782412f,
- 0.782651f, 0.782889f, 0.783128f, 0.783366f, 0.783605f, 0.783843f, 0.784081f, 0.784319f,
- 0.784557f, 0.784794f, 0.785032f, 0.785269f, 0.785507f, 0.785744f, 0.785981f, 0.786218f,
- 0.786455f, 0.786692f, 0.786929f, 0.787165f, 0.787402f, 0.787638f, 0.787874f, 0.788110f,
- 0.788346f, 0.788582f, 0.788818f, 0.789054f, 0.789289f, 0.789525f, 0.789760f, 0.789995f,
- 0.790230f, 0.790465f, 0.790700f, 0.790935f, 0.791169f, 0.791404f, 0.791638f, 0.791872f,
- 0.792107f, 0.792341f, 0.792575f, 0.792808f, 0.793042f, 0.793276f, 0.793509f, 0.793742f,
- 0.793975f, 0.794209f, 0.794442f, 0.794674f, 0.794907f, 0.795140f, 0.795372f, 0.795605f,
- 0.795837f, 0.796069f, 0.796301f, 0.796533f, 0.796765f, 0.796996f, 0.797228f, 0.797459f,
- 0.797691f, 0.797922f, 0.798153f, 0.798384f, 0.798615f, 0.798846f, 0.799076f, 0.799307f,
- 0.799537f, 0.799768f, 0.799998f, 0.800228f, 0.800458f, 0.800687f, 0.800917f, 0.801147f,
- 0.801376f, 0.801606f, 0.801835f, 0.802064f, 0.802293f, 0.802522f, 0.802750f, 0.802979f,
- 0.803208f, 0.803436f, 0.803664f, 0.803892f, 0.804120f, 0.804348f, 0.804576f, 0.804804f,
- 0.805031f, 0.805259f, 0.805486f, 0.805713f, 0.805940f, 0.806167f, 0.806394f, 0.806621f,
- 0.806848f, 0.807074f, 0.807300f, 0.807527f, 0.807753f, 0.807979f, 0.808205f, 0.808430f,
- 0.808656f, 0.808882f, 0.809107f, 0.809332f, 0.809558f, 0.809783f, 0.810008f, 0.810232f,
- 0.810457f, 0.810682f, 0.810906f, 0.811131f, 0.811355f, 0.811579f, 0.811803f, 0.812027f,
- 0.812251f, 0.812474f, 0.812698f, 0.812921f, 0.813144f, 0.813368f, 0.813591f, 0.813814f,
- 0.814036f, 0.814259f, 0.814482f, 0.814704f, 0.814926f, 0.815149f, 0.815371f, 0.815593f,
- 0.815814f, 0.816036f, 0.816258f, 0.816479f, 0.816701f, 0.816922f, 0.817143f, 0.817364f,
- 0.817585f, 0.817806f, 0.818026f, 0.818247f, 0.818467f, 0.818687f, 0.818908f, 0.819128f,
- 0.819348f, 0.819567f, 0.819787f, 0.820007f, 0.820226f, 0.820445f, 0.820664f, 0.820884f,
- 0.821102f, 0.821321f, 0.821540f, 0.821759f, 0.821977f, 0.822195f, 0.822414f, 0.822632f,
- 0.822850f, 0.823068f, 0.823285f, 0.823503f, 0.823721f, 0.823938f, 0.824155f, 0.824372f,
- 0.824589f, 0.824806f, 0.825023f, 0.825240f, 0.825456f, 0.825673f, 0.825889f, 0.826105f,
- 0.826321f, 0.826537f, 0.826753f, 0.826968f, 0.827184f, 0.827399f, 0.827615f, 0.827830f,
- 0.828045f, 0.828260f, 0.828475f, 0.828690f, 0.828904f, 0.829119f, 0.829333f, 0.829547f,
- 0.829761f, 0.829975f, 0.830189f, 0.830403f, 0.830616f, 0.830830f, 0.831043f, 0.831257f,
- 0.831470f, 0.831683f, 0.831895f, 0.832108f, 0.832321f, 0.832533f, 0.832746f, 0.832958f,
- 0.833170f, 0.833382f, 0.833594f, 0.833806f, 0.834018f, 0.834229f, 0.834440f, 0.834652f,
- 0.834863f, 0.835074f, 0.835285f, 0.835496f, 0.835706f, 0.835917f, 0.836127f, 0.836338f,
- 0.836548f, 0.836758f, 0.836968f, 0.837178f, 0.837387f, 0.837597f, 0.837806f, 0.838015f,
- 0.838225f, 0.838434f, 0.838643f, 0.838852f, 0.839060f, 0.839269f, 0.839477f, 0.839686f,
- 0.839894f, 0.840102f, 0.840310f, 0.840518f, 0.840725f, 0.840933f, 0.841140f, 0.841348f,
- 0.841555f, 0.841762f, 0.841969f, 0.842176f, 0.842383f, 0.842589f, 0.842796f, 0.843002f,
- 0.843208f, 0.843414f, 0.843620f, 0.843826f, 0.844032f, 0.844238f, 0.844443f, 0.844648f,
- 0.844854f, 0.845059f, 0.845264f, 0.845469f, 0.845673f, 0.845878f, 0.846082f, 0.846287f,
- 0.846491f, 0.846695f, 0.846899f, 0.847103f, 0.847307f, 0.847510f, 0.847714f, 0.847917f,
- 0.848120f, 0.848323f, 0.848526f, 0.848729f, 0.848932f, 0.849135f, 0.849337f, 0.849540f,
- 0.849742f, 0.849944f, 0.850146f, 0.850348f, 0.850549f, 0.850751f, 0.850953f, 0.851154f,
- 0.851355f, 0.851556f, 0.851757f, 0.851958f, 0.852159f, 0.852360f, 0.852560f, 0.852760f,
- 0.852961f, 0.853161f, 0.853361f, 0.853561f, 0.853760f, 0.853960f, 0.854159f, 0.854359f,
- 0.854558f, 0.854757f, 0.854956f, 0.855155f, 0.855354f, 0.855552f, 0.855751f, 0.855949f,
- 0.856147f, 0.856345f, 0.856543f, 0.856741f, 0.856939f, 0.857137f, 0.857334f, 0.857531f,
- 0.857729f, 0.857926f, 0.858123f, 0.858320f, 0.858516f, 0.858713f, 0.858909f, 0.859106f,
- 0.859302f, 0.859498f, 0.859694f, 0.859890f, 0.860085f, 0.860281f, 0.860476f, 0.860672f,
- 0.860867f, 0.861062f, 0.861257f, 0.861452f, 0.861646f, 0.861841f, 0.862035f, 0.862230f,
- 0.862424f, 0.862618f, 0.862812f, 0.863006f, 0.863199f, 0.863393f, 0.863586f, 0.863780f,
- 0.863973f, 0.864166f, 0.864359f, 0.864552f, 0.864744f, 0.864937f, 0.865129f, 0.865321f,
- 0.865514f, 0.865706f, 0.865898f, 0.866089f, 0.866281f, 0.866472f, 0.866664f, 0.866855f,
- 0.867046f, 0.867237f, 0.867428f, 0.867619f, 0.867809f, 0.868000f, 0.868190f, 0.868381f,
- 0.868571f, 0.868761f, 0.868951f, 0.869140f, 0.869330f, 0.869519f, 0.869709f, 0.869898f,
- 0.870087f, 0.870276f, 0.870465f, 0.870654f, 0.870842f, 0.871031f, 0.871219f, 0.871407f,
- 0.871595f, 0.871783f, 0.871971f, 0.872159f, 0.872346f, 0.872534f, 0.872721f, 0.872908f,
- 0.873095f, 0.873282f, 0.873469f, 0.873655f, 0.873842f, 0.874028f, 0.874215f, 0.874401f,
- 0.874587f, 0.874773f, 0.874958f, 0.875144f, 0.875329f, 0.875515f, 0.875700f, 0.875885f,
- 0.876070f, 0.876255f, 0.876440f, 0.876624f, 0.876809f, 0.876993f, 0.877177f, 0.877361f,
- 0.877545f, 0.877729f, 0.877913f, 0.878096f, 0.878280f, 0.878463f, 0.878646f, 0.878829f,
- 0.879012f, 0.879195f, 0.879378f, 0.879560f, 0.879743f, 0.879925f, 0.880107f, 0.880289f,
- 0.880471f, 0.880653f, 0.880834f, 0.881016f, 0.881197f, 0.881378f, 0.881559f, 0.881740f,
- 0.881921f, 0.882102f, 0.882283f, 0.882463f, 0.882643f, 0.882824f, 0.883004f, 0.883184f,
- 0.883363f, 0.883543f, 0.883723f, 0.883902f, 0.884081f, 0.884260f, 0.884439f, 0.884618f,
- 0.884797f, 0.884976f, 0.885154f, 0.885333f, 0.885511f, 0.885689f, 0.885867f, 0.886045f,
- 0.886223f, 0.886400f, 0.886578f, 0.886755f, 0.886932f, 0.887109f, 0.887286f, 0.887463f,
- 0.887640f, 0.887816f, 0.887993f, 0.888169f, 0.888345f, 0.888521f, 0.888697f, 0.888873f,
- 0.889048f, 0.889224f, 0.889399f, 0.889574f, 0.889750f, 0.889925f, 0.890099f, 0.890274f,
- 0.890449f, 0.890623f, 0.890797f, 0.890972f, 0.891146f, 0.891320f, 0.891493f, 0.891667f,
- 0.891841f, 0.892014f, 0.892187f, 0.892361f, 0.892534f, 0.892706f, 0.892879f, 0.893052f,
- 0.893224f, 0.893397f, 0.893569f, 0.893741f, 0.893913f, 0.894085f, 0.894256f, 0.894428f,
- 0.894599f, 0.894771f, 0.894942f, 0.895113f, 0.895284f, 0.895455f, 0.895625f, 0.895796f,
- 0.895966f, 0.896137f, 0.896307f, 0.896477f, 0.896646f, 0.896816f, 0.896986f, 0.897155f,
- 0.897325f, 0.897494f, 0.897663f, 0.897832f, 0.898001f, 0.898169f, 0.898338f, 0.898506f,
- 0.898674f, 0.898843f, 0.899011f, 0.899179f, 0.899346f, 0.899514f, 0.899681f, 0.899849f,
- 0.900016f, 0.900183f, 0.900350f, 0.900517f, 0.900683f, 0.900850f, 0.901016f, 0.901183f,
- 0.901349f, 0.901515f, 0.901681f, 0.901847f, 0.902012f, 0.902178f, 0.902343f, 0.902508f,
- 0.902673f, 0.902838f, 0.903003f, 0.903168f, 0.903332f, 0.903497f, 0.903661f, 0.903825f,
- 0.903989f, 0.904153f, 0.904317f, 0.904481f, 0.904644f, 0.904807f, 0.904971f, 0.905134f,
- 0.905297f, 0.905460f, 0.905622f, 0.905785f, 0.905947f, 0.906110f, 0.906272f, 0.906434f,
- 0.906596f, 0.906757f, 0.906919f, 0.907081f, 0.907242f, 0.907403f, 0.907564f, 0.907725f,
- 0.907886f, 0.908047f, 0.908207f, 0.908368f, 0.908528f, 0.908688f, 0.908848f, 0.909008f,
- 0.909168f, 0.909328f, 0.909487f, 0.909646f, 0.909806f, 0.909965f, 0.910124f, 0.910283f,
- 0.910441f, 0.910600f, 0.910758f, 0.910917f, 0.911075f, 0.911233f, 0.911391f, 0.911548f,
- 0.911706f, 0.911864f, 0.912021f, 0.912178f, 0.912335f, 0.912492f, 0.912649f, 0.912806f,
- 0.912962f, 0.913119f, 0.913275f, 0.913431f, 0.913587f, 0.913743f, 0.913899f, 0.914054f,
- 0.914210f, 0.914365f, 0.914520f, 0.914675f, 0.914830f, 0.914985f, 0.915140f, 0.915294f,
- 0.915449f, 0.915603f, 0.915757f, 0.915911f, 0.916065f, 0.916219f, 0.916372f, 0.916526f,
- 0.916679f, 0.916832f, 0.916985f, 0.917138f, 0.917291f, 0.917444f, 0.917596f, 0.917749f,
- 0.917901f, 0.918053f, 0.918205f, 0.918357f, 0.918508f, 0.918660f, 0.918811f, 0.918963f,
- 0.919114f, 0.919265f, 0.919416f, 0.919567f, 0.919717f, 0.919868f, 0.920018f, 0.920168f,
- 0.920318f, 0.920468f, 0.920618f, 0.920768f, 0.920917f, 0.921067f, 0.921216f, 0.921365f,
- 0.921514f, 0.921663f, 0.921812f, 0.921960f, 0.922109f, 0.922257f, 0.922405f, 0.922553f,
- 0.922701f, 0.922849f, 0.922997f, 0.923144f, 0.923291f, 0.923439f, 0.923586f, 0.923733f,
- 0.923880f, 0.924026f, 0.924173f, 0.924319f, 0.924465f, 0.924612f, 0.924758f, 0.924904f,
- 0.925049f, 0.925195f, 0.925340f, 0.925486f, 0.925631f, 0.925776f, 0.925921f, 0.926066f,
- 0.926210f, 0.926355f, 0.926499f, 0.926643f, 0.926787f, 0.926931f, 0.927075f, 0.927219f,
- 0.927363f, 0.927506f, 0.927649f, 0.927792f, 0.927935f, 0.928078f, 0.928221f, 0.928364f,
- 0.928506f, 0.928648f, 0.928791f, 0.928933f, 0.929075f, 0.929216f, 0.929358f, 0.929500f,
- 0.929641f, 0.929782f, 0.929923f, 0.930064f, 0.930205f, 0.930346f, 0.930486f, 0.930627f,
- 0.930767f, 0.930907f, 0.931047f, 0.931187f, 0.931327f, 0.931466f, 0.931606f, 0.931745f,
- 0.931884f, 0.932023f, 0.932162f, 0.932301f, 0.932440f, 0.932578f, 0.932716f, 0.932855f,
- 0.932993f, 0.933131f, 0.933269f, 0.933406f, 0.933544f, 0.933681f, 0.933818f, 0.933956f,
- 0.934093f, 0.934229f, 0.934366f, 0.934503f, 0.934639f, 0.934775f, 0.934912f, 0.935048f,
- 0.935184f, 0.935319f, 0.935455f, 0.935590f, 0.935726f, 0.935861f, 0.935996f, 0.936131f,
- 0.936266f, 0.936400f, 0.936535f, 0.936669f, 0.936803f, 0.936938f, 0.937072f, 0.937205f,
- 0.937339f, 0.937473f, 0.937606f, 0.937739f, 0.937872f, 0.938005f, 0.938138f, 0.938271f,
- 0.938404f, 0.938536f, 0.938668f, 0.938800f, 0.938932f, 0.939064f, 0.939196f, 0.939328f,
- 0.939459f, 0.939591f, 0.939722f, 0.939853f, 0.939984f, 0.940115f, 0.940245f, 0.940376f,
- 0.940506f, 0.940636f, 0.940766f, 0.940896f, 0.941026f, 0.941156f, 0.941285f, 0.941415f,
- 0.941544f, 0.941673f, 0.941802f, 0.941931f, 0.942060f, 0.942188f, 0.942317f, 0.942445f,
- 0.942573f, 0.942701f, 0.942829f, 0.942957f, 0.943084f, 0.943212f, 0.943339f, 0.943466f,
- 0.943593f, 0.943720f, 0.943847f, 0.943974f, 0.944100f, 0.944227f, 0.944353f, 0.944479f,
- 0.944605f, 0.944731f, 0.944856f, 0.944982f, 0.945107f, 0.945232f, 0.945358f, 0.945482f,
- 0.945607f, 0.945732f, 0.945857f, 0.945981f, 0.946105f, 0.946229f, 0.946353f, 0.946477f,
- 0.946601f, 0.946724f, 0.946848f, 0.946971f, 0.947094f, 0.947217f, 0.947340f, 0.947463f,
- 0.947586f, 0.947708f, 0.947830f, 0.947953f, 0.948075f, 0.948196f, 0.948318f, 0.948440f,
- 0.948561f, 0.948683f, 0.948804f, 0.948925f, 0.949046f, 0.949167f, 0.949287f, 0.949408f,
- 0.949528f, 0.949648f, 0.949768f, 0.949888f, 0.950008f, 0.950128f, 0.950247f, 0.950367f,
- 0.950486f, 0.950605f, 0.950724f, 0.950843f, 0.950962f, 0.951080f, 0.951199f, 0.951317f,
- 0.951435f, 0.951553f, 0.951671f, 0.951789f, 0.951906f, 0.952024f, 0.952141f, 0.952258f,
- 0.952375f, 0.952492f, 0.952609f, 0.952725f, 0.952842f, 0.952958f, 0.953074f, 0.953190f,
- 0.953306f, 0.953422f, 0.953537f, 0.953653f, 0.953768f, 0.953883f, 0.953998f, 0.954113f,
- 0.954228f, 0.954343f, 0.954457f, 0.954572f, 0.954686f, 0.954800f, 0.954914f, 0.955028f,
- 0.955141f, 0.955255f, 0.955368f, 0.955481f, 0.955594f, 0.955707f, 0.955820f, 0.955933f,
- 0.956045f, 0.956158f, 0.956270f, 0.956382f, 0.956494f, 0.956606f, 0.956717f, 0.956829f,
- 0.956940f, 0.957052f, 0.957163f, 0.957274f, 0.957385f, 0.957495f, 0.957606f, 0.957716f,
- 0.957826f, 0.957937f, 0.958046f, 0.958156f, 0.958266f, 0.958376f, 0.958485f, 0.958594f,
- 0.958703f, 0.958812f, 0.958921f, 0.959030f, 0.959139f, 0.959247f, 0.959355f, 0.959463f,
- 0.959572f, 0.959679f, 0.959787f, 0.959895f, 0.960002f, 0.960109f, 0.960217f, 0.960324f,
- 0.960431f, 0.960537f, 0.960644f, 0.960750f, 0.960857f, 0.960963f, 0.961069f, 0.961175f,
- 0.961280f, 0.961386f, 0.961492f, 0.961597f, 0.961702f, 0.961807f, 0.961912f, 0.962017f,
- 0.962121f, 0.962226f, 0.962330f, 0.962434f, 0.962538f, 0.962642f, 0.962746f, 0.962850f,
- 0.962953f, 0.963057f, 0.963160f, 0.963263f, 0.963366f, 0.963469f, 0.963571f, 0.963674f,
- 0.963776f, 0.963878f, 0.963980f, 0.964082f, 0.964184f, 0.964286f, 0.964387f, 0.964489f,
- 0.964590f, 0.964691f, 0.964792f, 0.964893f, 0.964993f, 0.965094f, 0.965194f, 0.965294f,
- 0.965394f, 0.965494f, 0.965594f, 0.965694f, 0.965793f, 0.965893f, 0.965992f, 0.966091f,
- 0.966190f, 0.966289f, 0.966387f, 0.966486f, 0.966584f, 0.966683f, 0.966781f, 0.966879f,
- 0.966976f, 0.967074f, 0.967172f, 0.967269f, 0.967366f, 0.967463f, 0.967560f, 0.967657f,
- 0.967754f, 0.967850f, 0.967947f, 0.968043f, 0.968139f, 0.968235f, 0.968331f, 0.968427f,
- 0.968522f, 0.968617f, 0.968713f, 0.968808f, 0.968903f, 0.968998f, 0.969092f, 0.969187f,
- 0.969281f, 0.969375f, 0.969470f, 0.969564f, 0.969657f, 0.969751f, 0.969845f, 0.969938f,
- 0.970031f, 0.970124f, 0.970217f, 0.970310f, 0.970403f, 0.970495f, 0.970588f, 0.970680f,
- 0.970772f, 0.970864f, 0.970956f, 0.971048f, 0.971139f, 0.971231f, 0.971322f, 0.971413f,
- 0.971504f, 0.971595f, 0.971685f, 0.971776f, 0.971866f, 0.971957f, 0.972047f, 0.972137f,
- 0.972227f, 0.972316f, 0.972406f, 0.972495f, 0.972584f, 0.972673f, 0.972762f, 0.972851f,
- 0.972940f, 0.973028f, 0.973117f, 0.973205f, 0.973293f, 0.973381f, 0.973469f, 0.973557f,
- 0.973644f, 0.973732f, 0.973819f, 0.973906f, 0.973993f, 0.974080f, 0.974166f, 0.974253f,
- 0.974339f, 0.974426f, 0.974512f, 0.974598f, 0.974684f, 0.974769f, 0.974855f, 0.974940f,
- 0.975025f, 0.975110f, 0.975195f, 0.975280f, 0.975365f, 0.975449f, 0.975534f, 0.975618f,
- 0.975702f, 0.975786f, 0.975870f, 0.975954f, 0.976037f, 0.976120f, 0.976204f, 0.976287f,
- 0.976370f, 0.976453f, 0.976535f, 0.976618f, 0.976700f, 0.976782f, 0.976864f, 0.976946f,
- 0.977028f, 0.977110f, 0.977191f, 0.977273f, 0.977354f, 0.977435f, 0.977516f, 0.977597f,
- 0.977677f, 0.977758f, 0.977838f, 0.977918f, 0.977998f, 0.978078f, 0.978158f, 0.978238f,
- 0.978317f, 0.978397f, 0.978476f, 0.978555f, 0.978634f, 0.978713f, 0.978791f, 0.978870f,
- 0.978948f, 0.979026f, 0.979104f, 0.979182f, 0.979260f, 0.979338f, 0.979415f, 0.979493f,
- 0.979570f, 0.979647f, 0.979724f, 0.979800f, 0.979877f, 0.979954f, 0.980030f, 0.980106f,
- 0.980182f, 0.980258f, 0.980334f, 0.980409f, 0.980485f, 0.980560f, 0.980635f, 0.980710f,
- 0.980785f, 0.980860f, 0.980935f, 0.981009f, 0.981083f, 0.981158f, 0.981232f, 0.981305f,
- 0.981379f, 0.981453f, 0.981526f, 0.981600f, 0.981673f, 0.981746f, 0.981819f, 0.981891f,
- 0.981964f, 0.982036f, 0.982109f, 0.982181f, 0.982253f, 0.982325f, 0.982396f, 0.982468f,
- 0.982539f, 0.982611f, 0.982682f, 0.982753f, 0.982824f, 0.982894f, 0.982965f, 0.983035f,
- 0.983105f, 0.983176f, 0.983246f, 0.983315f, 0.983385f, 0.983455f, 0.983524f, 0.983593f,
- 0.983662f, 0.983731f, 0.983800f, 0.983869f, 0.983937f, 0.984006f, 0.984074f, 0.984142f,
- 0.984210f, 0.984278f, 0.984346f, 0.984413f, 0.984480f, 0.984548f, 0.984615f, 0.984682f,
- 0.984748f, 0.984815f, 0.984882f, 0.984948f, 0.985014f, 0.985080f, 0.985146f, 0.985212f,
- 0.985278f, 0.985343f, 0.985408f, 0.985474f, 0.985539f, 0.985604f, 0.985668f, 0.985733f,
- 0.985798f, 0.985862f, 0.985926f, 0.985990f, 0.986054f, 0.986118f, 0.986181f, 0.986245f,
- 0.986308f, 0.986371f, 0.986434f, 0.986497f, 0.986560f, 0.986623f, 0.986685f, 0.986747f,
- 0.986809f, 0.986871f, 0.986933f, 0.986995f, 0.987057f, 0.987118f, 0.987179f, 0.987240f,
- 0.987301f, 0.987362f, 0.987423f, 0.987484f, 0.987544f, 0.987604f, 0.987664f, 0.987724f,
- 0.987784f, 0.987844f, 0.987903f, 0.987963f, 0.988022f, 0.988081f, 0.988140f, 0.988199f,
- 0.988258f, 0.988316f, 0.988374f, 0.988433f, 0.988491f, 0.988549f, 0.988607f, 0.988664f,
- 0.988722f, 0.988779f, 0.988836f, 0.988893f, 0.988950f, 0.989007f, 0.989064f, 0.989120f,
- 0.989177f, 0.989233f, 0.989289f, 0.989345f, 0.989400f, 0.989456f, 0.989511f, 0.989567f,
- 0.989622f, 0.989677f, 0.989732f, 0.989787f, 0.989841f, 0.989896f, 0.989950f, 0.990004f,
- 0.990058f, 0.990112f, 0.990166f, 0.990219f, 0.990273f, 0.990326f, 0.990379f, 0.990432f,
- 0.990485f, 0.990538f, 0.990590f, 0.990643f, 0.990695f, 0.990747f, 0.990799f, 0.990851f,
- 0.990903f, 0.990954f, 0.991006f, 0.991057f, 0.991108f, 0.991159f, 0.991210f, 0.991260f,
- 0.991311f, 0.991361f, 0.991411f, 0.991462f, 0.991511f, 0.991561f, 0.991611f, 0.991660f,
- 0.991710f, 0.991759f, 0.991808f, 0.991857f, 0.991906f, 0.991954f, 0.992003f, 0.992051f,
- 0.992099f, 0.992147f, 0.992195f, 0.992243f, 0.992291f, 0.992338f, 0.992385f, 0.992433f,
- 0.992480f, 0.992526f, 0.992573f, 0.992620f, 0.992666f, 0.992712f, 0.992759f, 0.992805f,
- 0.992850f, 0.992896f, 0.992942f, 0.992987f, 0.993032f, 0.993077f, 0.993122f, 0.993167f,
- 0.993212f, 0.993257f, 0.993301f, 0.993345f, 0.993389f, 0.993433f, 0.993477f, 0.993521f,
- 0.993564f, 0.993608f, 0.993651f, 0.993694f, 0.993737f, 0.993779f, 0.993822f, 0.993865f,
- 0.993907f, 0.993949f, 0.993991f, 0.994033f, 0.994075f, 0.994116f, 0.994158f, 0.994199f,
- 0.994240f, 0.994281f, 0.994322f, 0.994363f, 0.994404f, 0.994444f, 0.994484f, 0.994525f,
- 0.994565f, 0.994604f, 0.994644f, 0.994684f, 0.994723f, 0.994762f, 0.994802f, 0.994841f,
- 0.994879f, 0.994918f, 0.994957f, 0.994995f, 0.995033f, 0.995071f, 0.995109f, 0.995147f,
- 0.995185f, 0.995222f, 0.995260f, 0.995297f, 0.995334f, 0.995371f, 0.995408f, 0.995444f,
- 0.995481f, 0.995517f, 0.995553f, 0.995589f, 0.995625f, 0.995661f, 0.995697f, 0.995732f,
- 0.995767f, 0.995803f, 0.995838f, 0.995872f, 0.995907f, 0.995942f, 0.995976f, 0.996011f,
- 0.996045f, 0.996079f, 0.996113f, 0.996146f, 0.996180f, 0.996213f, 0.996247f, 0.996280f,
- 0.996313f, 0.996345f, 0.996378f, 0.996411f, 0.996443f, 0.996475f, 0.996507f, 0.996539f,
- 0.996571f, 0.996603f, 0.996634f, 0.996666f, 0.996697f, 0.996728f, 0.996759f, 0.996790f,
- 0.996820f, 0.996851f, 0.996881f, 0.996911f, 0.996941f, 0.996971f, 0.997001f, 0.997031f,
- 0.997060f, 0.997089f, 0.997119f, 0.997148f, 0.997176f, 0.997205f, 0.997234f, 0.997262f,
- 0.997290f, 0.997319f, 0.997347f, 0.997374f, 0.997402f, 0.997430f, 0.997457f, 0.997484f,
- 0.997511f, 0.997538f, 0.997565f, 0.997592f, 0.997618f, 0.997645f, 0.997671f, 0.997697f,
- 0.997723f, 0.997749f, 0.997774f, 0.997800f, 0.997825f, 0.997851f, 0.997876f, 0.997901f,
- 0.997925f, 0.997950f, 0.997974f, 0.997999f, 0.998023f, 0.998047f, 0.998071f, 0.998094f,
- 0.998118f, 0.998142f, 0.998165f, 0.998188f, 0.998211f, 0.998234f, 0.998257f, 0.998279f,
- 0.998302f, 0.998324f, 0.998346f, 0.998368f, 0.998390f, 0.998411f, 0.998433f, 0.998454f,
- 0.998476f, 0.998497f, 0.998518f, 0.998538f, 0.998559f, 0.998580f, 0.998600f, 0.998620f,
- 0.998640f, 0.998660f, 0.998680f, 0.998700f, 0.998719f, 0.998738f, 0.998758f, 0.998777f,
- 0.998795f, 0.998814f, 0.998833f, 0.998851f, 0.998870f, 0.998888f, 0.998906f, 0.998924f,
- 0.998941f, 0.998959f, 0.998976f, 0.998994f, 0.999011f, 0.999028f, 0.999044f, 0.999061f,
- 0.999078f, 0.999094f, 0.999110f, 0.999126f, 0.999142f, 0.999158f, 0.999174f, 0.999189f,
- 0.999205f, 0.999220f, 0.999235f, 0.999250f, 0.999265f, 0.999279f, 0.999294f, 0.999308f,
- 0.999322f, 0.999336f, 0.999350f, 0.999364f, 0.999378f, 0.999391f, 0.999404f, 0.999418f,
- 0.999431f, 0.999443f, 0.999456f, 0.999469f, 0.999481f, 0.999493f, 0.999506f, 0.999518f,
- 0.999529f, 0.999541f, 0.999553f, 0.999564f, 0.999575f, 0.999586f, 0.999597f, 0.999608f,
- 0.999619f, 0.999629f, 0.999640f, 0.999650f, 0.999660f, 0.999670f, 0.999680f, 0.999689f,
- 0.999699f, 0.999708f, 0.999717f, 0.999726f, 0.999735f, 0.999744f, 0.999753f, 0.999761f,
- 0.999769f, 0.999778f, 0.999786f, 0.999793f, 0.999801f, 0.999809f, 0.999816f, 0.999823f,
- 0.999831f, 0.999838f, 0.999844f, 0.999851f, 0.999858f, 0.999864f, 0.999870f, 0.999876f,
- 0.999882f, 0.999888f, 0.999894f, 0.999899f, 0.999905f, 0.999910f, 0.999915f, 0.999920f,
- 0.999925f, 0.999929f, 0.999934f, 0.999938f, 0.999942f, 0.999946f, 0.999950f, 0.999954f,
- 0.999958f, 0.999961f, 0.999964f, 0.999968f, 0.999971f, 0.999973f, 0.999976f, 0.999979f,
- 0.999981f, 0.999983f, 0.999986f, 0.999988f, 0.999989f, 0.999991f, 0.999993f, 0.999994f,
- 0.999995f, 0.999996f, 0.999997f, 0.999998f, 0.999999f, 0.999999f, 1.000000f, 1.000000
-};
-
-static const float cosTable32768[16384] = {
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 0.999999f, 0.999999f,
- 0.999999f, 0.999999f, 0.999998f, 0.999998f, 0.999997f, 0.999997f, 0.999996f, 0.999996f,
- 0.999995f, 0.999995f, 0.999994f, 0.999993f, 0.999993f, 0.999992f, 0.999991f, 0.999990f,
- 0.999989f, 0.999988f, 0.999988f, 0.999987f, 0.999986f, 0.999985f, 0.999983f, 0.999982f,
- 0.999981f, 0.999980f, 0.999979f, 0.999977f, 0.999976f, 0.999975f, 0.999973f, 0.999972f,
- 0.999971f, 0.999969f, 0.999968f, 0.999966f, 0.999964f, 0.999963f, 0.999961f, 0.999959f,
- 0.999958f, 0.999956f, 0.999954f, 0.999952f, 0.999950f, 0.999948f, 0.999946f, 0.999944f,
- 0.999942f, 0.999940f, 0.999938f, 0.999936f, 0.999934f, 0.999932f, 0.999929f, 0.999927f,
- 0.999925f, 0.999922f, 0.999920f, 0.999917f, 0.999915f, 0.999913f, 0.999910f, 0.999907f,
- 0.999905f, 0.999902f, 0.999899f, 0.999897f, 0.999894f, 0.999891f, 0.999888f, 0.999885f,
- 0.999882f, 0.999879f, 0.999876f, 0.999873f, 0.999870f, 0.999867f, 0.999864f, 0.999861f,
- 0.999858f, 0.999854f, 0.999851f, 0.999848f, 0.999844f, 0.999841f, 0.999838f, 0.999834f,
- 0.999831f, 0.999827f, 0.999823f, 0.999820f, 0.999816f, 0.999812f, 0.999809f, 0.999805f,
- 0.999801f, 0.999797f, 0.999793f, 0.999790f, 0.999786f, 0.999782f, 0.999778f, 0.999774f,
- 0.999769f, 0.999765f, 0.999761f, 0.999757f, 0.999753f, 0.999748f, 0.999744f, 0.999740f,
- 0.999735f, 0.999731f, 0.999726f, 0.999722f, 0.999717f, 0.999713f, 0.999708f, 0.999704f,
- 0.999699f, 0.999694f, 0.999689f, 0.999685f, 0.999680f, 0.999675f, 0.999670f, 0.999665f,
- 0.999660f, 0.999655f, 0.999650f, 0.999645f, 0.999640f, 0.999635f, 0.999629f, 0.999624f,
- 0.999619f, 0.999614f, 0.999608f, 0.999603f, 0.999597f, 0.999592f, 0.999586f, 0.999581f,
- 0.999575f, 0.999570f, 0.999564f, 0.999558f, 0.999553f, 0.999547f, 0.999541f, 0.999535f,
- 0.999529f, 0.999524f, 0.999518f, 0.999512f, 0.999506f, 0.999500f, 0.999493f, 0.999487f,
- 0.999481f, 0.999475f, 0.999469f, 0.999462f, 0.999456f, 0.999450f, 0.999443f, 0.999437f,
- 0.999431f, 0.999424f, 0.999418f, 0.999411f, 0.999404f, 0.999398f, 0.999391f, 0.999384f,
- 0.999378f, 0.999371f, 0.999364f, 0.999357f, 0.999350f, 0.999343f, 0.999336f, 0.999329f,
- 0.999322f, 0.999315f, 0.999308f, 0.999301f, 0.999294f, 0.999287f, 0.999279f, 0.999272f,
- 0.999265f, 0.999257f, 0.999250f, 0.999243f, 0.999235f, 0.999228f, 0.999220f, 0.999212f,
- 0.999205f, 0.999197f, 0.999189f, 0.999182f, 0.999174f, 0.999166f, 0.999158f, 0.999150f,
- 0.999142f, 0.999134f, 0.999126f, 0.999118f, 0.999110f, 0.999102f, 0.999094f, 0.999086f,
- 0.999078f, 0.999069f, 0.999061f, 0.999053f, 0.999044f, 0.999036f, 0.999028f, 0.999019f,
- 0.999011f, 0.999002f, 0.998994f, 0.998985f, 0.998976f, 0.998968f, 0.998959f, 0.998950f,
- 0.998941f, 0.998932f, 0.998924f, 0.998915f, 0.998906f, 0.998897f, 0.998888f, 0.998879f,
- 0.998870f, 0.998860f, 0.998851f, 0.998842f, 0.998833f, 0.998824f, 0.998814f, 0.998805f,
- 0.998795f, 0.998786f, 0.998777f, 0.998767f, 0.998758f, 0.998748f, 0.998738f, 0.998729f,
- 0.998719f, 0.998709f, 0.998700f, 0.998690f, 0.998680f, 0.998670f, 0.998660f, 0.998650f,
- 0.998640f, 0.998630f, 0.998620f, 0.998610f, 0.998600f, 0.998590f, 0.998580f, 0.998569f,
- 0.998559f, 0.998549f, 0.998538f, 0.998528f, 0.998518f, 0.998507f, 0.998497f, 0.998486f,
- 0.998476f, 0.998465f, 0.998454f, 0.998444f, 0.998433f, 0.998422f, 0.998411f, 0.998401f,
- 0.998390f, 0.998379f, 0.998368f, 0.998357f, 0.998346f, 0.998335f, 0.998324f, 0.998313f,
- 0.998302f, 0.998290f, 0.998279f, 0.998268f, 0.998257f, 0.998245f, 0.998234f, 0.998222f,
- 0.998211f, 0.998200f, 0.998188f, 0.998176f, 0.998165f, 0.998153f, 0.998142f, 0.998130f,
- 0.998118f, 0.998106f, 0.998094f, 0.998083f, 0.998071f, 0.998059f, 0.998047f, 0.998035f,
- 0.998023f, 0.998011f, 0.997999f, 0.997987f, 0.997974f, 0.997962f, 0.997950f, 0.997938f,
- 0.997925f, 0.997913f, 0.997901f, 0.997888f, 0.997876f, 0.997863f, 0.997851f, 0.997838f,
- 0.997825f, 0.997813f, 0.997800f, 0.997787f, 0.997774f, 0.997762f, 0.997749f, 0.997736f,
- 0.997723f, 0.997710f, 0.997697f, 0.997684f, 0.997671f, 0.997658f, 0.997645f, 0.997632f,
- 0.997618f, 0.997605f, 0.997592f, 0.997579f, 0.997565f, 0.997552f, 0.997538f, 0.997525f,
- 0.997511f, 0.997498f, 0.997484f, 0.997471f, 0.997457f, 0.997443f, 0.997430f, 0.997416f,
- 0.997402f, 0.997388f, 0.997374f, 0.997361f, 0.997347f, 0.997333f, 0.997319f, 0.997305f,
- 0.997290f, 0.997276f, 0.997262f, 0.997248f, 0.997234f, 0.997219f, 0.997205f, 0.997191f,
- 0.997176f, 0.997162f, 0.997148f, 0.997133f, 0.997119f, 0.997104f, 0.997089f, 0.997075f,
- 0.997060f, 0.997045f, 0.997031f, 0.997016f, 0.997001f, 0.996986f, 0.996971f, 0.996956f,
- 0.996941f, 0.996926f, 0.996911f, 0.996896f, 0.996881f, 0.996866f, 0.996851f, 0.996836f,
- 0.996820f, 0.996805f, 0.996790f, 0.996774f, 0.996759f, 0.996743f, 0.996728f, 0.996712f,
- 0.996697f, 0.996681f, 0.996666f, 0.996650f, 0.996634f, 0.996619f, 0.996603f, 0.996587f,
- 0.996571f, 0.996555f, 0.996539f, 0.996523f, 0.996507f, 0.996491f, 0.996475f, 0.996459f,
- 0.996443f, 0.996427f, 0.996411f, 0.996394f, 0.996378f, 0.996362f, 0.996345f, 0.996329f,
- 0.996313f, 0.996296f, 0.996280f, 0.996263f, 0.996247f, 0.996230f, 0.996213f, 0.996197f,
- 0.996180f, 0.996163f, 0.996146f, 0.996129f, 0.996113f, 0.996096f, 0.996079f, 0.996062f,
- 0.996045f, 0.996028f, 0.996011f, 0.995993f, 0.995976f, 0.995959f, 0.995942f, 0.995925f,
- 0.995907f, 0.995890f, 0.995872f, 0.995855f, 0.995838f, 0.995820f, 0.995803f, 0.995785f,
- 0.995767f, 0.995750f, 0.995732f, 0.995714f, 0.995697f, 0.995679f, 0.995661f, 0.995643f,
- 0.995625f, 0.995607f, 0.995589f, 0.995571f, 0.995553f, 0.995535f, 0.995517f, 0.995499f,
- 0.995481f, 0.995463f, 0.995444f, 0.995426f, 0.995408f, 0.995389f, 0.995371f, 0.995352f,
- 0.995334f, 0.995315f, 0.995297f, 0.995278f, 0.995260f, 0.995241f, 0.995222f, 0.995203f,
- 0.995185f, 0.995166f, 0.995147f, 0.995128f, 0.995109f, 0.995090f, 0.995071f, 0.995052f,
- 0.995033f, 0.995014f, 0.994995f, 0.994976f, 0.994957f, 0.994937f, 0.994918f, 0.994899f,
- 0.994879f, 0.994860f, 0.994841f, 0.994821f, 0.994802f, 0.994782f, 0.994762f, 0.994743f,
- 0.994723f, 0.994703f, 0.994684f, 0.994664f, 0.994644f, 0.994624f, 0.994604f, 0.994585f,
- 0.994565f, 0.994545f, 0.994525f, 0.994505f, 0.994484f, 0.994464f, 0.994444f, 0.994424f,
- 0.994404f, 0.994383f, 0.994363f, 0.994343f, 0.994322f, 0.994302f, 0.994281f, 0.994261f,
- 0.994240f, 0.994220f, 0.994199f, 0.994179f, 0.994158f, 0.994137f, 0.994116f, 0.994096f,
- 0.994075f, 0.994054f, 0.994033f, 0.994012f, 0.993991f, 0.993970f, 0.993949f, 0.993928f,
- 0.993907f, 0.993886f, 0.993865f, 0.993843f, 0.993822f, 0.993801f, 0.993779f, 0.993758f,
- 0.993737f, 0.993715f, 0.993694f, 0.993672f, 0.993651f, 0.993629f, 0.993608f, 0.993586f,
- 0.993564f, 0.993542f, 0.993521f, 0.993499f, 0.993477f, 0.993455f, 0.993433f, 0.993411f,
- 0.993389f, 0.993367f, 0.993345f, 0.993323f, 0.993301f, 0.993279f, 0.993257f, 0.993234f,
- 0.993212f, 0.993190f, 0.993167f, 0.993145f, 0.993122f, 0.993100f, 0.993077f, 0.993055f,
- 0.993032f, 0.993010f, 0.992987f, 0.992964f, 0.992942f, 0.992919f, 0.992896f, 0.992873f,
- 0.992850f, 0.992828f, 0.992805f, 0.992782f, 0.992759f, 0.992736f, 0.992712f, 0.992689f,
- 0.992666f, 0.992643f, 0.992620f, 0.992596f, 0.992573f, 0.992550f, 0.992526f, 0.992503f,
- 0.992480f, 0.992456f, 0.992433f, 0.992409f, 0.992385f, 0.992362f, 0.992338f, 0.992314f,
- 0.992291f, 0.992267f, 0.992243f, 0.992219f, 0.992195f, 0.992171f, 0.992147f, 0.992123f,
- 0.992099f, 0.992075f, 0.992051f, 0.992027f, 0.992003f, 0.991979f, 0.991954f, 0.991930f,
- 0.991906f, 0.991881f, 0.991857f, 0.991832f, 0.991808f, 0.991783f, 0.991759f, 0.991734f,
- 0.991710f, 0.991685f, 0.991660f, 0.991636f, 0.991611f, 0.991586f, 0.991561f, 0.991536f,
- 0.991511f, 0.991487f, 0.991462f, 0.991437f, 0.991411f, 0.991386f, 0.991361f, 0.991336f,
- 0.991311f, 0.991286f, 0.991260f, 0.991235f, 0.991210f, 0.991184f, 0.991159f, 0.991133f,
- 0.991108f, 0.991082f, 0.991057f, 0.991031f, 0.991006f, 0.990980f, 0.990954f, 0.990928f,
- 0.990903f, 0.990877f, 0.990851f, 0.990825f, 0.990799f, 0.990773f, 0.990747f, 0.990721f,
- 0.990695f, 0.990669f, 0.990643f, 0.990617f, 0.990590f, 0.990564f, 0.990538f, 0.990511f,
- 0.990485f, 0.990459f, 0.990432f, 0.990406f, 0.990379f, 0.990353f, 0.990326f, 0.990299f,
- 0.990273f, 0.990246f, 0.990219f, 0.990193f, 0.990166f, 0.990139f, 0.990112f, 0.990085f,
- 0.990058f, 0.990031f, 0.990004f, 0.989977f, 0.989950f, 0.989923f, 0.989896f, 0.989869f,
- 0.989841f, 0.989814f, 0.989787f, 0.989759f, 0.989732f, 0.989704f, 0.989677f, 0.989650f,
- 0.989622f, 0.989594f, 0.989567f, 0.989539f, 0.989511f, 0.989484f, 0.989456f, 0.989428f,
- 0.989400f, 0.989373f, 0.989345f, 0.989317f, 0.989289f, 0.989261f, 0.989233f, 0.989205f,
- 0.989177f, 0.989148f, 0.989120f, 0.989092f, 0.989064f, 0.989035f, 0.989007f, 0.988979f,
- 0.988950f, 0.988922f, 0.988893f, 0.988865f, 0.988836f, 0.988808f, 0.988779f, 0.988750f,
- 0.988722f, 0.988693f, 0.988664f, 0.988635f, 0.988607f, 0.988578f, 0.988549f, 0.988520f,
- 0.988491f, 0.988462f, 0.988433f, 0.988404f, 0.988374f, 0.988345f, 0.988316f, 0.988287f,
- 0.988258f, 0.988228f, 0.988199f, 0.988169f, 0.988140f, 0.988111f, 0.988081f, 0.988052f,
- 0.988022f, 0.987992f, 0.987963f, 0.987933f, 0.987903f, 0.987874f, 0.987844f, 0.987814f,
- 0.987784f, 0.987754f, 0.987724f, 0.987694f, 0.987664f, 0.987634f, 0.987604f, 0.987574f,
- 0.987544f, 0.987514f, 0.987484f, 0.987453f, 0.987423f, 0.987393f, 0.987362f, 0.987332f,
- 0.987301f, 0.987271f, 0.987240f, 0.987210f, 0.987179f, 0.987149f, 0.987118f, 0.987087f,
- 0.987057f, 0.987026f, 0.986995f, 0.986964f, 0.986933f, 0.986902f, 0.986871f, 0.986840f,
- 0.986809f, 0.986778f, 0.986747f, 0.986716f, 0.986685f, 0.986654f, 0.986623f, 0.986591f,
- 0.986560f, 0.986529f, 0.986497f, 0.986466f, 0.986434f, 0.986403f, 0.986371f, 0.986340f,
- 0.986308f, 0.986276f, 0.986245f, 0.986213f, 0.986181f, 0.986150f, 0.986118f, 0.986086f,
- 0.986054f, 0.986022f, 0.985990f, 0.985958f, 0.985926f, 0.985894f, 0.985862f, 0.985830f,
- 0.985798f, 0.985765f, 0.985733f, 0.985701f, 0.985668f, 0.985636f, 0.985604f, 0.985571f,
- 0.985539f, 0.985506f, 0.985474f, 0.985441f, 0.985408f, 0.985376f, 0.985343f, 0.985310f,
- 0.985278f, 0.985245f, 0.985212f, 0.985179f, 0.985146f, 0.985113f, 0.985080f, 0.985047f,
- 0.985014f, 0.984981f, 0.984948f, 0.984915f, 0.984882f, 0.984848f, 0.984815f, 0.984782f,
- 0.984748f, 0.984715f, 0.984682f, 0.984648f, 0.984615f, 0.984581f, 0.984548f, 0.984514f,
- 0.984480f, 0.984447f, 0.984413f, 0.984379f, 0.984346f, 0.984312f, 0.984278f, 0.984244f,
- 0.984210f, 0.984176f, 0.984142f, 0.984108f, 0.984074f, 0.984040f, 0.984006f, 0.983972f,
- 0.983937f, 0.983903f, 0.983869f, 0.983835f, 0.983800f, 0.983766f, 0.983731f, 0.983697f,
- 0.983662f, 0.983628f, 0.983593f, 0.983559f, 0.983524f, 0.983489f, 0.983455f, 0.983420f,
- 0.983385f, 0.983350f, 0.983315f, 0.983281f, 0.983246f, 0.983211f, 0.983176f, 0.983141f,
- 0.983105f, 0.983070f, 0.983035f, 0.983000f, 0.982965f, 0.982930f, 0.982894f, 0.982859f,
- 0.982824f, 0.982788f, 0.982753f, 0.982717f, 0.982682f, 0.982646f, 0.982611f, 0.982575f,
- 0.982539f, 0.982504f, 0.982468f, 0.982432f, 0.982396f, 0.982360f, 0.982325f, 0.982289f,
- 0.982253f, 0.982217f, 0.982181f, 0.982145f, 0.982109f, 0.982072f, 0.982036f, 0.982000f,
- 0.981964f, 0.981928f, 0.981891f, 0.981855f, 0.981819f, 0.981782f, 0.981746f, 0.981709f,
- 0.981673f, 0.981636f, 0.981600f, 0.981563f, 0.981526f, 0.981490f, 0.981453f, 0.981416f,
- 0.981379f, 0.981342f, 0.981305f, 0.981269f, 0.981232f, 0.981195f, 0.981158f, 0.981120f,
- 0.981083f, 0.981046f, 0.981009f, 0.980972f, 0.980935f, 0.980897f, 0.980860f, 0.980823f,
- 0.980785f, 0.980748f, 0.980710f, 0.980673f, 0.980635f, 0.980598f, 0.980560f, 0.980523f,
- 0.980485f, 0.980447f, 0.980409f, 0.980372f, 0.980334f, 0.980296f, 0.980258f, 0.980220f,
- 0.980182f, 0.980144f, 0.980106f, 0.980068f, 0.980030f, 0.979992f, 0.979954f, 0.979915f,
- 0.979877f, 0.979839f, 0.979800f, 0.979762f, 0.979724f, 0.979685f, 0.979647f, 0.979608f,
- 0.979570f, 0.979531f, 0.979493f, 0.979454f, 0.979415f, 0.979376f, 0.979338f, 0.979299f,
- 0.979260f, 0.979221f, 0.979182f, 0.979143f, 0.979104f, 0.979065f, 0.979026f, 0.978987f,
- 0.978948f, 0.978909f, 0.978870f, 0.978831f, 0.978791f, 0.978752f, 0.978713f, 0.978673f,
- 0.978634f, 0.978594f, 0.978555f, 0.978516f, 0.978476f, 0.978436f, 0.978397f, 0.978357f,
- 0.978317f, 0.978278f, 0.978238f, 0.978198f, 0.978158f, 0.978118f, 0.978078f, 0.978038f,
- 0.977998f, 0.977959f, 0.977918f, 0.977878f, 0.977838f, 0.977798f, 0.977758f, 0.977718f,
- 0.977677f, 0.977637f, 0.977597f, 0.977556f, 0.977516f, 0.977475f, 0.977435f, 0.977394f,
- 0.977354f, 0.977313f, 0.977273f, 0.977232f, 0.977191f, 0.977151f, 0.977110f, 0.977069f,
- 0.977028f, 0.976987f, 0.976946f, 0.976905f, 0.976864f, 0.976823f, 0.976782f, 0.976741f,
- 0.976700f, 0.976659f, 0.976618f, 0.976576f, 0.976535f, 0.976494f, 0.976453f, 0.976411f,
- 0.976370f, 0.976328f, 0.976287f, 0.976245f, 0.976204f, 0.976162f, 0.976120f, 0.976079f,
- 0.976037f, 0.975995f, 0.975954f, 0.975912f, 0.975870f, 0.975828f, 0.975786f, 0.975744f,
- 0.975702f, 0.975660f, 0.975618f, 0.975576f, 0.975534f, 0.975492f, 0.975449f, 0.975407f,
- 0.975365f, 0.975323f, 0.975280f, 0.975238f, 0.975195f, 0.975153f, 0.975110f, 0.975068f,
- 0.975025f, 0.974983f, 0.974940f, 0.974897f, 0.974855f, 0.974812f, 0.974769f, 0.974726f,
- 0.974684f, 0.974641f, 0.974598f, 0.974555f, 0.974512f, 0.974469f, 0.974426f, 0.974383f,
- 0.974339f, 0.974296f, 0.974253f, 0.974210f, 0.974166f, 0.974123f, 0.974080f, 0.974036f,
- 0.973993f, 0.973949f, 0.973906f, 0.973862f, 0.973819f, 0.973775f, 0.973732f, 0.973688f,
- 0.973644f, 0.973601f, 0.973557f, 0.973513f, 0.973469f, 0.973425f, 0.973381f, 0.973337f,
- 0.973293f, 0.973249f, 0.973205f, 0.973161f, 0.973117f, 0.973073f, 0.973028f, 0.972984f,
- 0.972940f, 0.972896f, 0.972851f, 0.972807f, 0.972762f, 0.972718f, 0.972673f, 0.972629f,
- 0.972584f, 0.972540f, 0.972495f, 0.972450f, 0.972406f, 0.972361f, 0.972316f, 0.972271f,
- 0.972227f, 0.972182f, 0.972137f, 0.972092f, 0.972047f, 0.972002f, 0.971957f, 0.971911f,
- 0.971866f, 0.971821f, 0.971776f, 0.971731f, 0.971685f, 0.971640f, 0.971595f, 0.971549f,
- 0.971504f, 0.971458f, 0.971413f, 0.971367f, 0.971322f, 0.971276f, 0.971231f, 0.971185f,
- 0.971139f, 0.971093f, 0.971048f, 0.971002f, 0.970956f, 0.970910f, 0.970864f, 0.970818f,
- 0.970772f, 0.970726f, 0.970680f, 0.970634f, 0.970588f, 0.970542f, 0.970495f, 0.970449f,
- 0.970403f, 0.970357f, 0.970310f, 0.970264f, 0.970217f, 0.970171f, 0.970124f, 0.970078f,
- 0.970031f, 0.969985f, 0.969938f, 0.969891f, 0.969845f, 0.969798f, 0.969751f, 0.969704f,
- 0.969657f, 0.969611f, 0.969564f, 0.969517f, 0.969470f, 0.969423f, 0.969375f, 0.969328f,
- 0.969281f, 0.969234f, 0.969187f, 0.969140f, 0.969092f, 0.969045f, 0.968998f, 0.968950f,
- 0.968903f, 0.968855f, 0.968808f, 0.968760f, 0.968713f, 0.968665f, 0.968617f, 0.968570f,
- 0.968522f, 0.968474f, 0.968427f, 0.968379f, 0.968331f, 0.968283f, 0.968235f, 0.968187f,
- 0.968139f, 0.968091f, 0.968043f, 0.967995f, 0.967947f, 0.967899f, 0.967850f, 0.967802f,
- 0.967754f, 0.967706f, 0.967657f, 0.967609f, 0.967560f, 0.967512f, 0.967463f, 0.967415f,
- 0.967366f, 0.967318f, 0.967269f, 0.967220f, 0.967172f, 0.967123f, 0.967074f, 0.967025f,
- 0.966976f, 0.966928f, 0.966879f, 0.966830f, 0.966781f, 0.966732f, 0.966683f, 0.966633f,
- 0.966584f, 0.966535f, 0.966486f, 0.966437f, 0.966387f, 0.966338f, 0.966289f, 0.966239f,
- 0.966190f, 0.966141f, 0.966091f, 0.966042f, 0.965992f, 0.965942f, 0.965893f, 0.965843f,
- 0.965793f, 0.965744f, 0.965694f, 0.965644f, 0.965594f, 0.965544f, 0.965494f, 0.965444f,
- 0.965394f, 0.965344f, 0.965294f, 0.965244f, 0.965194f, 0.965144f, 0.965094f, 0.965044f,
- 0.964993f, 0.964943f, 0.964893f, 0.964842f, 0.964792f, 0.964741f, 0.964691f, 0.964640f,
- 0.964590f, 0.964539f, 0.964489f, 0.964438f, 0.964387f, 0.964336f, 0.964286f, 0.964235f,
- 0.964184f, 0.964133f, 0.964082f, 0.964031f, 0.963980f, 0.963929f, 0.963878f, 0.963827f,
- 0.963776f, 0.963725f, 0.963674f, 0.963623f, 0.963571f, 0.963520f, 0.963469f, 0.963417f,
- 0.963366f, 0.963314f, 0.963263f, 0.963211f, 0.963160f, 0.963108f, 0.963057f, 0.963005f,
- 0.962953f, 0.962902f, 0.962850f, 0.962798f, 0.962746f, 0.962694f, 0.962642f, 0.962590f,
- 0.962538f, 0.962486f, 0.962434f, 0.962382f, 0.962330f, 0.962278f, 0.962226f, 0.962174f,
- 0.962121f, 0.962069f, 0.962017f, 0.961964f, 0.961912f, 0.961860f, 0.961807f, 0.961755f,
- 0.961702f, 0.961649f, 0.961597f, 0.961544f, 0.961492f, 0.961439f, 0.961386f, 0.961333f,
- 0.961280f, 0.961228f, 0.961175f, 0.961122f, 0.961069f, 0.961016f, 0.960963f, 0.960910f,
- 0.960857f, 0.960804f, 0.960750f, 0.960697f, 0.960644f, 0.960591f, 0.960537f, 0.960484f,
- 0.960431f, 0.960377f, 0.960324f, 0.960270f, 0.960217f, 0.960163f, 0.960109f, 0.960056f,
- 0.960002f, 0.959948f, 0.959895f, 0.959841f, 0.959787f, 0.959733f, 0.959679f, 0.959625f,
- 0.959572f, 0.959518f, 0.959463f, 0.959409f, 0.959355f, 0.959301f, 0.959247f, 0.959193f,
- 0.959139f, 0.959084f, 0.959030f, 0.958976f, 0.958921f, 0.958867f, 0.958812f, 0.958758f,
- 0.958703f, 0.958649f, 0.958594f, 0.958540f, 0.958485f, 0.958430f, 0.958376f, 0.958321f,
- 0.958266f, 0.958211f, 0.958156f, 0.958101f, 0.958046f, 0.957992f, 0.957937f, 0.957882f,
- 0.957826f, 0.957771f, 0.957716f, 0.957661f, 0.957606f, 0.957550f, 0.957495f, 0.957440f,
- 0.957385f, 0.957329f, 0.957274f, 0.957218f, 0.957163f, 0.957107f, 0.957052f, 0.956996f,
- 0.956940f, 0.956885f, 0.956829f, 0.956773f, 0.956717f, 0.956662f, 0.956606f, 0.956550f,
- 0.956494f, 0.956438f, 0.956382f, 0.956326f, 0.956270f, 0.956214f, 0.956158f, 0.956101f,
- 0.956045f, 0.955989f, 0.955933f, 0.955876f, 0.955820f, 0.955764f, 0.955707f, 0.955651f,
- 0.955594f, 0.955538f, 0.955481f, 0.955425f, 0.955368f, 0.955311f, 0.955255f, 0.955198f,
- 0.955141f, 0.955084f, 0.955028f, 0.954971f, 0.954914f, 0.954857f, 0.954800f, 0.954743f,
- 0.954686f, 0.954629f, 0.954572f, 0.954514f, 0.954457f, 0.954400f, 0.954343f, 0.954285f,
- 0.954228f, 0.954171f, 0.954113f, 0.954056f, 0.953998f, 0.953941f, 0.953883f, 0.953826f,
- 0.953768f, 0.953711f, 0.953653f, 0.953595f, 0.953537f, 0.953480f, 0.953422f, 0.953364f,
- 0.953306f, 0.953248f, 0.953190f, 0.953132f, 0.953074f, 0.953016f, 0.952958f, 0.952900f,
- 0.952842f, 0.952783f, 0.952725f, 0.952667f, 0.952609f, 0.952550f, 0.952492f, 0.952433f,
- 0.952375f, 0.952317f, 0.952258f, 0.952199f, 0.952141f, 0.952082f, 0.952024f, 0.951965f,
- 0.951906f, 0.951847f, 0.951789f, 0.951730f, 0.951671f, 0.951612f, 0.951553f, 0.951494f,
- 0.951435f, 0.951376f, 0.951317f, 0.951258f, 0.951199f, 0.951139f, 0.951080f, 0.951021f,
- 0.950962f, 0.950902f, 0.950843f, 0.950784f, 0.950724f, 0.950665f, 0.950605f, 0.950546f,
- 0.950486f, 0.950426f, 0.950367f, 0.950307f, 0.950247f, 0.950188f, 0.950128f, 0.950068f,
- 0.950008f, 0.949948f, 0.949888f, 0.949829f, 0.949768f, 0.949708f, 0.949648f, 0.949588f,
- 0.949528f, 0.949468f, 0.949408f, 0.949348f, 0.949287f, 0.949227f, 0.949167f, 0.949106f,
- 0.949046f, 0.948985f, 0.948925f, 0.948864f, 0.948804f, 0.948743f, 0.948683f, 0.948622f,
- 0.948561f, 0.948501f, 0.948440f, 0.948379f, 0.948318f, 0.948257f, 0.948196f, 0.948136f,
- 0.948075f, 0.948014f, 0.947953f, 0.947891f, 0.947830f, 0.947769f, 0.947708f, 0.947647f,
- 0.947586f, 0.947524f, 0.947463f, 0.947402f, 0.947340f, 0.947279f, 0.947217f, 0.947156f,
- 0.947094f, 0.947033f, 0.946971f, 0.946910f, 0.946848f, 0.946786f, 0.946724f, 0.946663f,
- 0.946601f, 0.946539f, 0.946477f, 0.946415f, 0.946353f, 0.946291f, 0.946229f, 0.946167f,
- 0.946105f, 0.946043f, 0.945981f, 0.945919f, 0.945857f, 0.945794f, 0.945732f, 0.945670f,
- 0.945607f, 0.945545f, 0.945482f, 0.945420f, 0.945358f, 0.945295f, 0.945232f, 0.945170f,
- 0.945107f, 0.945045f, 0.944982f, 0.944919f, 0.944856f, 0.944793f, 0.944731f, 0.944668f,
- 0.944605f, 0.944542f, 0.944479f, 0.944416f, 0.944353f, 0.944290f, 0.944227f, 0.944163f,
- 0.944100f, 0.944037f, 0.943974f, 0.943910f, 0.943847f, 0.943784f, 0.943720f, 0.943657f,
- 0.943593f, 0.943530f, 0.943466f, 0.943403f, 0.943339f, 0.943276f, 0.943212f, 0.943148f,
- 0.943084f, 0.943021f, 0.942957f, 0.942893f, 0.942829f, 0.942765f, 0.942701f, 0.942637f,
- 0.942573f, 0.942509f, 0.942445f, 0.942381f, 0.942317f, 0.942253f, 0.942188f, 0.942124f,
- 0.942060f, 0.941995f, 0.941931f, 0.941867f, 0.941802f, 0.941738f, 0.941673f, 0.941609f,
- 0.941544f, 0.941479f, 0.941415f, 0.941350f, 0.941285f, 0.941221f, 0.941156f, 0.941091f,
- 0.941026f, 0.940961f, 0.940896f, 0.940831f, 0.940766f, 0.940701f, 0.940636f, 0.940571f,
- 0.940506f, 0.940441f, 0.940376f, 0.940310f, 0.940245f, 0.940180f, 0.940115f, 0.940049f,
- 0.939984f, 0.939918f, 0.939853f, 0.939787f, 0.939722f, 0.939656f, 0.939591f, 0.939525f,
- 0.939459f, 0.939394f, 0.939328f, 0.939262f, 0.939196f, 0.939130f, 0.939064f, 0.938998f,
- 0.938932f, 0.938866f, 0.938800f, 0.938734f, 0.938668f, 0.938602f, 0.938536f, 0.938470f,
- 0.938404f, 0.938337f, 0.938271f, 0.938205f, 0.938138f, 0.938072f, 0.938005f, 0.937939f,
- 0.937872f, 0.937806f, 0.937739f, 0.937673f, 0.937606f, 0.937539f, 0.937473f, 0.937406f,
- 0.937339f, 0.937272f, 0.937205f, 0.937138f, 0.937072f, 0.937005f, 0.936938f, 0.936871f,
- 0.936803f, 0.936736f, 0.936669f, 0.936602f, 0.936535f, 0.936468f, 0.936400f, 0.936333f,
- 0.936266f, 0.936198f, 0.936131f, 0.936063f, 0.935996f, 0.935928f, 0.935861f, 0.935793f,
- 0.935726f, 0.935658f, 0.935590f, 0.935523f, 0.935455f, 0.935387f, 0.935319f, 0.935251f,
- 0.935184f, 0.935116f, 0.935048f, 0.934980f, 0.934912f, 0.934844f, 0.934775f, 0.934707f,
- 0.934639f, 0.934571f, 0.934503f, 0.934434f, 0.934366f, 0.934298f, 0.934229f, 0.934161f,
- 0.934093f, 0.934024f, 0.933956f, 0.933887f, 0.933818f, 0.933750f, 0.933681f, 0.933612f,
- 0.933544f, 0.933475f, 0.933406f, 0.933337f, 0.933269f, 0.933200f, 0.933131f, 0.933062f,
- 0.932993f, 0.932924f, 0.932855f, 0.932786f, 0.932716f, 0.932647f, 0.932578f, 0.932509f,
- 0.932440f, 0.932370f, 0.932301f, 0.932232f, 0.932162f, 0.932093f, 0.932023f, 0.931954f,
- 0.931884f, 0.931815f, 0.931745f, 0.931675f, 0.931606f, 0.931536f, 0.931466f, 0.931397f,
- 0.931327f, 0.931257f, 0.931187f, 0.931117f, 0.931047f, 0.930977f, 0.930907f, 0.930837f,
- 0.930767f, 0.930697f, 0.930627f, 0.930556f, 0.930486f, 0.930416f, 0.930346f, 0.930275f,
- 0.930205f, 0.930135f, 0.930064f, 0.929994f, 0.929923f, 0.929853f, 0.929782f, 0.929712f,
- 0.929641f, 0.929570f, 0.929500f, 0.929429f, 0.929358f, 0.929287f, 0.929216f, 0.929146f,
- 0.929075f, 0.929004f, 0.928933f, 0.928862f, 0.928791f, 0.928720f, 0.928648f, 0.928577f,
- 0.928506f, 0.928435f, 0.928364f, 0.928292f, 0.928221f, 0.928150f, 0.928078f, 0.928007f,
- 0.927935f, 0.927864f, 0.927792f, 0.927721f, 0.927649f, 0.927578f, 0.927506f, 0.927434f,
- 0.927363f, 0.927291f, 0.927219f, 0.927147f, 0.927075f, 0.927003f, 0.926931f, 0.926859f,
- 0.926787f, 0.926715f, 0.926643f, 0.926571f, 0.926499f, 0.926427f, 0.926355f, 0.926283f,
- 0.926210f, 0.926138f, 0.926066f, 0.925993f, 0.925921f, 0.925848f, 0.925776f, 0.925703f,
- 0.925631f, 0.925558f, 0.925486f, 0.925413f, 0.925340f, 0.925268f, 0.925195f, 0.925122f,
- 0.925049f, 0.924976f, 0.924904f, 0.924831f, 0.924758f, 0.924685f, 0.924612f, 0.924539f,
- 0.924465f, 0.924392f, 0.924319f, 0.924246f, 0.924173f, 0.924100f, 0.924026f, 0.923953f,
- 0.923880f, 0.923806f, 0.923733f, 0.923659f, 0.923586f, 0.923512f, 0.923439f, 0.923365f,
- 0.923291f, 0.923218f, 0.923144f, 0.923070f, 0.922997f, 0.922923f, 0.922849f, 0.922775f,
- 0.922701f, 0.922627f, 0.922553f, 0.922479f, 0.922405f, 0.922331f, 0.922257f, 0.922183f,
- 0.922109f, 0.922034f, 0.921960f, 0.921886f, 0.921812f, 0.921737f, 0.921663f, 0.921588f,
- 0.921514f, 0.921440f, 0.921365f, 0.921291f, 0.921216f, 0.921141f, 0.921067f, 0.920992f,
- 0.920917f, 0.920842f, 0.920768f, 0.920693f, 0.920618f, 0.920543f, 0.920468f, 0.920393f,
- 0.920318f, 0.920243f, 0.920168f, 0.920093f, 0.920018f, 0.919943f, 0.919868f, 0.919792f,
- 0.919717f, 0.919642f, 0.919567f, 0.919491f, 0.919416f, 0.919340f, 0.919265f, 0.919189f,
- 0.919114f, 0.919038f, 0.918963f, 0.918887f, 0.918811f, 0.918736f, 0.918660f, 0.918584f,
- 0.918508f, 0.918433f, 0.918357f, 0.918281f, 0.918205f, 0.918129f, 0.918053f, 0.917977f,
- 0.917901f, 0.917825f, 0.917749f, 0.917672f, 0.917596f, 0.917520f, 0.917444f, 0.917367f,
- 0.917291f, 0.917215f, 0.917138f, 0.917062f, 0.916985f, 0.916909f, 0.916832f, 0.916756f,
- 0.916679f, 0.916602f, 0.916526f, 0.916449f, 0.916372f, 0.916296f, 0.916219f, 0.916142f,
- 0.916065f, 0.915988f, 0.915911f, 0.915834f, 0.915757f, 0.915680f, 0.915603f, 0.915526f,
- 0.915449f, 0.915372f, 0.915294f, 0.915217f, 0.915140f, 0.915062f, 0.914985f, 0.914908f,
- 0.914830f, 0.914753f, 0.914675f, 0.914598f, 0.914520f, 0.914443f, 0.914365f, 0.914287f,
- 0.914210f, 0.914132f, 0.914054f, 0.913976f, 0.913899f, 0.913821f, 0.913743f, 0.913665f,
- 0.913587f, 0.913509f, 0.913431f, 0.913353f, 0.913275f, 0.913197f, 0.913119f, 0.913040f,
- 0.912962f, 0.912884f, 0.912806f, 0.912727f, 0.912649f, 0.912571f, 0.912492f, 0.912414f,
- 0.912335f, 0.912257f, 0.912178f, 0.912099f, 0.912021f, 0.911942f, 0.911864f, 0.911785f,
- 0.911706f, 0.911627f, 0.911548f, 0.911470f, 0.911391f, 0.911312f, 0.911233f, 0.911154f,
- 0.911075f, 0.910996f, 0.910917f, 0.910837f, 0.910758f, 0.910679f, 0.910600f, 0.910521f,
- 0.910441f, 0.910362f, 0.910283f, 0.910203f, 0.910124f, 0.910044f, 0.909965f, 0.909885f,
- 0.909806f, 0.909726f, 0.909646f, 0.909567f, 0.909487f, 0.909407f, 0.909328f, 0.909248f,
- 0.909168f, 0.909088f, 0.909008f, 0.908928f, 0.908848f, 0.908768f, 0.908688f, 0.908608f,
- 0.908528f, 0.908448f, 0.908368f, 0.908288f, 0.908207f, 0.908127f, 0.908047f, 0.907966f,
- 0.907886f, 0.907806f, 0.907725f, 0.907645f, 0.907564f, 0.907484f, 0.907403f, 0.907323f,
- 0.907242f, 0.907161f, 0.907081f, 0.907000f, 0.906919f, 0.906838f, 0.906757f, 0.906677f,
- 0.906596f, 0.906515f, 0.906434f, 0.906353f, 0.906272f, 0.906191f, 0.906110f, 0.906028f,
- 0.905947f, 0.905866f, 0.905785f, 0.905704f, 0.905622f, 0.905541f, 0.905460f, 0.905378f,
- 0.905297f, 0.905215f, 0.905134f, 0.905052f, 0.904971f, 0.904889f, 0.904807f, 0.904726f,
- 0.904644f, 0.904562f, 0.904481f, 0.904399f, 0.904317f, 0.904235f, 0.904153f, 0.904071f,
- 0.903989f, 0.903907f, 0.903825f, 0.903743f, 0.903661f, 0.903579f, 0.903497f, 0.903415f,
- 0.903332f, 0.903250f, 0.903168f, 0.903085f, 0.903003f, 0.902921f, 0.902838f, 0.902756f,
- 0.902673f, 0.902591f, 0.902508f, 0.902426f, 0.902343f, 0.902260f, 0.902178f, 0.902095f,
- 0.902012f, 0.901929f, 0.901847f, 0.901764f, 0.901681f, 0.901598f, 0.901515f, 0.901432f,
- 0.901349f, 0.901266f, 0.901183f, 0.901100f, 0.901016f, 0.900933f, 0.900850f, 0.900767f,
- 0.900683f, 0.900600f, 0.900517f, 0.900433f, 0.900350f, 0.900266f, 0.900183f, 0.900099f,
- 0.900016f, 0.899932f, 0.899849f, 0.899765f, 0.899681f, 0.899598f, 0.899514f, 0.899430f,
- 0.899346f, 0.899262f, 0.899179f, 0.899095f, 0.899011f, 0.898927f, 0.898843f, 0.898759f,
- 0.898674f, 0.898590f, 0.898506f, 0.898422f, 0.898338f, 0.898254f, 0.898169f, 0.898085f,
- 0.898001f, 0.897916f, 0.897832f, 0.897747f, 0.897663f, 0.897578f, 0.897494f, 0.897409f,
- 0.897325f, 0.897240f, 0.897155f, 0.897071f, 0.896986f, 0.896901f, 0.896816f, 0.896731f,
- 0.896646f, 0.896562f, 0.896477f, 0.896392f, 0.896307f, 0.896222f, 0.896137f, 0.896051f,
- 0.895966f, 0.895881f, 0.895796f, 0.895711f, 0.895625f, 0.895540f, 0.895455f, 0.895369f,
- 0.895284f, 0.895198f, 0.895113f, 0.895028f, 0.894942f, 0.894856f, 0.894771f, 0.894685f,
- 0.894599f, 0.894514f, 0.894428f, 0.894342f, 0.894256f, 0.894171f, 0.894085f, 0.893999f,
- 0.893913f, 0.893827f, 0.893741f, 0.893655f, 0.893569f, 0.893483f, 0.893397f, 0.893310f,
- 0.893224f, 0.893138f, 0.893052f, 0.892965f, 0.892879f, 0.892793f, 0.892706f, 0.892620f,
- 0.892534f, 0.892447f, 0.892361f, 0.892274f, 0.892187f, 0.892101f, 0.892014f, 0.891927f,
- 0.891841f, 0.891754f, 0.891667f, 0.891580f, 0.891493f, 0.891407f, 0.891320f, 0.891233f,
- 0.891146f, 0.891059f, 0.890972f, 0.890885f, 0.890797f, 0.890710f, 0.890623f, 0.890536f,
- 0.890449f, 0.890361f, 0.890274f, 0.890187f, 0.890099f, 0.890012f, 0.889925f, 0.889837f,
- 0.889750f, 0.889662f, 0.889574f, 0.889487f, 0.889399f, 0.889312f, 0.889224f, 0.889136f,
- 0.889048f, 0.888961f, 0.888873f, 0.888785f, 0.888697f, 0.888609f, 0.888521f, 0.888433f,
- 0.888345f, 0.888257f, 0.888169f, 0.888081f, 0.887993f, 0.887904f, 0.887816f, 0.887728f,
- 0.887640f, 0.887551f, 0.887463f, 0.887375f, 0.887286f, 0.887198f, 0.887109f, 0.887021f,
- 0.886932f, 0.886844f, 0.886755f, 0.886666f, 0.886578f, 0.886489f, 0.886400f, 0.886311f,
- 0.886223f, 0.886134f, 0.886045f, 0.885956f, 0.885867f, 0.885778f, 0.885689f, 0.885600f,
- 0.885511f, 0.885422f, 0.885333f, 0.885243f, 0.885154f, 0.885065f, 0.884976f, 0.884886f,
- 0.884797f, 0.884708f, 0.884618f, 0.884529f, 0.884439f, 0.884350f, 0.884260f, 0.884171f,
- 0.884081f, 0.883992f, 0.883902f, 0.883812f, 0.883723f, 0.883633f, 0.883543f, 0.883453f,
- 0.883363f, 0.883273f, 0.883184f, 0.883094f, 0.883004f, 0.882914f, 0.882824f, 0.882733f,
- 0.882643f, 0.882553f, 0.882463f, 0.882373f, 0.882283f, 0.882192f, 0.882102f, 0.882012f,
- 0.881921f, 0.881831f, 0.881740f, 0.881650f, 0.881559f, 0.881469f, 0.881378f, 0.881288f,
- 0.881197f, 0.881106f, 0.881016f, 0.880925f, 0.880834f, 0.880743f, 0.880653f, 0.880562f,
- 0.880471f, 0.880380f, 0.880289f, 0.880198f, 0.880107f, 0.880016f, 0.879925f, 0.879834f,
- 0.879743f, 0.879651f, 0.879560f, 0.879469f, 0.879378f, 0.879286f, 0.879195f, 0.879104f,
- 0.879012f, 0.878921f, 0.878829f, 0.878738f, 0.878646f, 0.878555f, 0.878463f, 0.878371f,
- 0.878280f, 0.878188f, 0.878096f, 0.878005f, 0.877913f, 0.877821f, 0.877729f, 0.877637f,
- 0.877545f, 0.877453f, 0.877361f, 0.877269f, 0.877177f, 0.877085f, 0.876993f, 0.876901f,
- 0.876809f, 0.876716f, 0.876624f, 0.876532f, 0.876440f, 0.876347f, 0.876255f, 0.876163f,
- 0.876070f, 0.875978f, 0.875885f, 0.875793f, 0.875700f, 0.875607f, 0.875515f, 0.875422f,
- 0.875329f, 0.875237f, 0.875144f, 0.875051f, 0.874958f, 0.874865f, 0.874773f, 0.874680f,
- 0.874587f, 0.874494f, 0.874401f, 0.874308f, 0.874215f, 0.874121f, 0.874028f, 0.873935f,
- 0.873842f, 0.873749f, 0.873655f, 0.873562f, 0.873469f, 0.873375f, 0.873282f, 0.873188f,
- 0.873095f, 0.873001f, 0.872908f, 0.872814f, 0.872721f, 0.872627f, 0.872534f, 0.872440f,
- 0.872346f, 0.872252f, 0.872159f, 0.872065f, 0.871971f, 0.871877f, 0.871783f, 0.871689f,
- 0.871595f, 0.871501f, 0.871407f, 0.871313f, 0.871219f, 0.871125f, 0.871031f, 0.870936f,
- 0.870842f, 0.870748f, 0.870654f, 0.870559f, 0.870465f, 0.870370f, 0.870276f, 0.870182f,
- 0.870087f, 0.869992f, 0.869898f, 0.869803f, 0.869709f, 0.869614f, 0.869519f, 0.869425f,
- 0.869330f, 0.869235f, 0.869140f, 0.869045f, 0.868951f, 0.868856f, 0.868761f, 0.868666f,
- 0.868571f, 0.868476f, 0.868381f, 0.868285f, 0.868190f, 0.868095f, 0.868000f, 0.867905f,
- 0.867809f, 0.867714f, 0.867619f, 0.867523f, 0.867428f, 0.867333f, 0.867237f, 0.867142f,
- 0.867046f, 0.866951f, 0.866855f, 0.866759f, 0.866664f, 0.866568f, 0.866472f, 0.866377f,
- 0.866281f, 0.866185f, 0.866089f, 0.865993f, 0.865898f, 0.865802f, 0.865706f, 0.865610f,
- 0.865514f, 0.865418f, 0.865321f, 0.865225f, 0.865129f, 0.865033f, 0.864937f, 0.864841f,
- 0.864744f, 0.864648f, 0.864552f, 0.864455f, 0.864359f, 0.864262f, 0.864166f, 0.864069f,
- 0.863973f, 0.863876f, 0.863780f, 0.863683f, 0.863586f, 0.863490f, 0.863393f, 0.863296f,
- 0.863199f, 0.863103f, 0.863006f, 0.862909f, 0.862812f, 0.862715f, 0.862618f, 0.862521f,
- 0.862424f, 0.862327f, 0.862230f, 0.862133f, 0.862035f, 0.861938f, 0.861841f, 0.861744f,
- 0.861646f, 0.861549f, 0.861452f, 0.861354f, 0.861257f, 0.861160f, 0.861062f, 0.860964f,
- 0.860867f, 0.860769f, 0.860672f, 0.860574f, 0.860476f, 0.860379f, 0.860281f, 0.860183f,
- 0.860085f, 0.859988f, 0.859890f, 0.859792f, 0.859694f, 0.859596f, 0.859498f, 0.859400f,
- 0.859302f, 0.859204f, 0.859106f, 0.859007f, 0.858909f, 0.858811f, 0.858713f, 0.858615f,
- 0.858516f, 0.858418f, 0.858320f, 0.858221f, 0.858123f, 0.858024f, 0.857926f, 0.857827f,
- 0.857729f, 0.857630f, 0.857531f, 0.857433f, 0.857334f, 0.857235f, 0.857137f, 0.857038f,
- 0.856939f, 0.856840f, 0.856741f, 0.856642f, 0.856543f, 0.856444f, 0.856345f, 0.856246f,
- 0.856147f, 0.856048f, 0.855949f, 0.855850f, 0.855751f, 0.855651f, 0.855552f, 0.855453f,
- 0.855354f, 0.855254f, 0.855155f, 0.855056f, 0.854956f, 0.854857f, 0.854757f, 0.854658f,
- 0.854558f, 0.854458f, 0.854359f, 0.854259f, 0.854159f, 0.854060f, 0.853960f, 0.853860f,
- 0.853760f, 0.853660f, 0.853561f, 0.853461f, 0.853361f, 0.853261f, 0.853161f, 0.853061f,
- 0.852961f, 0.852861f, 0.852760f, 0.852660f, 0.852560f, 0.852460f, 0.852360f, 0.852259f,
- 0.852159f, 0.852059f, 0.851958f, 0.851858f, 0.851757f, 0.851657f, 0.851556f, 0.851456f,
- 0.851355f, 0.851255f, 0.851154f, 0.851053f, 0.850953f, 0.850852f, 0.850751f, 0.850650f,
- 0.850549f, 0.850449f, 0.850348f, 0.850247f, 0.850146f, 0.850045f, 0.849944f, 0.849843f,
- 0.849742f, 0.849641f, 0.849540f, 0.849438f, 0.849337f, 0.849236f, 0.849135f, 0.849033f,
- 0.848932f, 0.848831f, 0.848729f, 0.848628f, 0.848526f, 0.848425f, 0.848323f, 0.848222f,
- 0.848120f, 0.848019f, 0.847917f, 0.847815f, 0.847714f, 0.847612f, 0.847510f, 0.847408f,
- 0.847307f, 0.847205f, 0.847103f, 0.847001f, 0.846899f, 0.846797f, 0.846695f, 0.846593f,
- 0.846491f, 0.846389f, 0.846287f, 0.846185f, 0.846082f, 0.845980f, 0.845878f, 0.845776f,
- 0.845673f, 0.845571f, 0.845469f, 0.845366f, 0.845264f, 0.845161f, 0.845059f, 0.844956f,
- 0.844854f, 0.844751f, 0.844648f, 0.844546f, 0.844443f, 0.844340f, 0.844238f, 0.844135f,
- 0.844032f, 0.843929f, 0.843826f, 0.843723f, 0.843620f, 0.843517f, 0.843414f, 0.843311f,
- 0.843208f, 0.843105f, 0.843002f, 0.842899f, 0.842796f, 0.842692f, 0.842589f, 0.842486f,
- 0.842383f, 0.842279f, 0.842176f, 0.842072f, 0.841969f, 0.841866f, 0.841762f, 0.841659f,
- 0.841555f, 0.841451f, 0.841348f, 0.841244f, 0.841140f, 0.841037f, 0.840933f, 0.840829f,
- 0.840725f, 0.840622f, 0.840518f, 0.840414f, 0.840310f, 0.840206f, 0.840102f, 0.839998f,
- 0.839894f, 0.839790f, 0.839686f, 0.839581f, 0.839477f, 0.839373f, 0.839269f, 0.839165f,
- 0.839060f, 0.838956f, 0.838852f, 0.838747f, 0.838643f, 0.838538f, 0.838434f, 0.838329f,
- 0.838225f, 0.838120f, 0.838015f, 0.837911f, 0.837806f, 0.837701f, 0.837597f, 0.837492f,
- 0.837387f, 0.837282f, 0.837178f, 0.837073f, 0.836968f, 0.836863f, 0.836758f, 0.836653f,
- 0.836548f, 0.836443f, 0.836338f, 0.836232f, 0.836127f, 0.836022f, 0.835917f, 0.835812f,
- 0.835706f, 0.835601f, 0.835496f, 0.835390f, 0.835285f, 0.835179f, 0.835074f, 0.834968f,
- 0.834863f, 0.834757f, 0.834652f, 0.834546f, 0.834440f, 0.834335f, 0.834229f, 0.834123f,
- 0.834018f, 0.833912f, 0.833806f, 0.833700f, 0.833594f, 0.833488f, 0.833382f, 0.833276f,
- 0.833170f, 0.833064f, 0.832958f, 0.832852f, 0.832746f, 0.832640f, 0.832533f, 0.832427f,
- 0.832321f, 0.832215f, 0.832108f, 0.832002f, 0.831895f, 0.831789f, 0.831683f, 0.831576f,
- 0.831470f, 0.831363f, 0.831257f, 0.831150f, 0.831043f, 0.830937f, 0.830830f, 0.830723f,
- 0.830616f, 0.830510f, 0.830403f, 0.830296f, 0.830189f, 0.830082f, 0.829975f, 0.829868f,
- 0.829761f, 0.829654f, 0.829547f, 0.829440f, 0.829333f, 0.829226f, 0.829119f, 0.829011f,
- 0.828904f, 0.828797f, 0.828690f, 0.828582f, 0.828475f, 0.828367f, 0.828260f, 0.828153f,
- 0.828045f, 0.827938f, 0.827830f, 0.827722f, 0.827615f, 0.827507f, 0.827399f, 0.827292f,
- 0.827184f, 0.827076f, 0.826968f, 0.826861f, 0.826753f, 0.826645f, 0.826537f, 0.826429f,
- 0.826321f, 0.826213f, 0.826105f, 0.825997f, 0.825889f, 0.825781f, 0.825673f, 0.825564f,
- 0.825456f, 0.825348f, 0.825240f, 0.825131f, 0.825023f, 0.824915f, 0.824806f, 0.824698f,
- 0.824589f, 0.824481f, 0.824372f, 0.824264f, 0.824155f, 0.824047f, 0.823938f, 0.823829f,
- 0.823721f, 0.823612f, 0.823503f, 0.823394f, 0.823285f, 0.823177f, 0.823068f, 0.822959f,
- 0.822850f, 0.822741f, 0.822632f, 0.822523f, 0.822414f, 0.822305f, 0.822195f, 0.822086f,
- 0.821977f, 0.821868f, 0.821759f, 0.821649f, 0.821540f, 0.821431f, 0.821321f, 0.821212f,
- 0.821102f, 0.820993f, 0.820884f, 0.820774f, 0.820664f, 0.820555f, 0.820445f, 0.820336f,
- 0.820226f, 0.820116f, 0.820007f, 0.819897f, 0.819787f, 0.819677f, 0.819567f, 0.819457f,
- 0.819348f, 0.819238f, 0.819128f, 0.819018f, 0.818908f, 0.818798f, 0.818687f, 0.818577f,
- 0.818467f, 0.818357f, 0.818247f, 0.818137f, 0.818026f, 0.817916f, 0.817806f, 0.817695f,
- 0.817585f, 0.817474f, 0.817364f, 0.817253f, 0.817143f, 0.817032f, 0.816922f, 0.816811f,
- 0.816701f, 0.816590f, 0.816479f, 0.816368f, 0.816258f, 0.816147f, 0.816036f, 0.815925f,
- 0.815814f, 0.815704f, 0.815593f, 0.815482f, 0.815371f, 0.815260f, 0.815149f, 0.815037f,
- 0.814926f, 0.814815f, 0.814704f, 0.814593f, 0.814482f, 0.814370f, 0.814259f, 0.814148f,
- 0.814036f, 0.813925f, 0.813814f, 0.813702f, 0.813591f, 0.813479f, 0.813368f, 0.813256f,
- 0.813144f, 0.813033f, 0.812921f, 0.812809f, 0.812698f, 0.812586f, 0.812474f, 0.812362f,
- 0.812251f, 0.812139f, 0.812027f, 0.811915f, 0.811803f, 0.811691f, 0.811579f, 0.811467f,
- 0.811355f, 0.811243f, 0.811131f, 0.811018f, 0.810906f, 0.810794f, 0.810682f, 0.810570f,
- 0.810457f, 0.810345f, 0.810232f, 0.810120f, 0.810008f, 0.809895f, 0.809783f, 0.809670f,
- 0.809558f, 0.809445f, 0.809332f, 0.809220f, 0.809107f, 0.808994f, 0.808882f, 0.808769f,
- 0.808656f, 0.808543f, 0.808430f, 0.808318f, 0.808205f, 0.808092f, 0.807979f, 0.807866f,
- 0.807753f, 0.807640f, 0.807527f, 0.807414f, 0.807300f, 0.807187f, 0.807074f, 0.806961f,
- 0.806848f, 0.806734f, 0.806621f, 0.806508f, 0.806394f, 0.806281f, 0.806167f, 0.806054f,
- 0.805940f, 0.805827f, 0.805713f, 0.805600f, 0.805486f, 0.805372f, 0.805259f, 0.805145f,
- 0.805031f, 0.804918f, 0.804804f, 0.804690f, 0.804576f, 0.804462f, 0.804348f, 0.804234f,
- 0.804120f, 0.804006f, 0.803892f, 0.803778f, 0.803664f, 0.803550f, 0.803436f, 0.803322f,
- 0.803208f, 0.803093f, 0.802979f, 0.802865f, 0.802750f, 0.802636f, 0.802522f, 0.802407f,
- 0.802293f, 0.802178f, 0.802064f, 0.801949f, 0.801835f, 0.801720f, 0.801606f, 0.801491f,
- 0.801376f, 0.801261f, 0.801147f, 0.801032f, 0.800917f, 0.800802f, 0.800687f, 0.800573f,
- 0.800458f, 0.800343f, 0.800228f, 0.800113f, 0.799998f, 0.799883f, 0.799768f, 0.799652f,
- 0.799537f, 0.799422f, 0.799307f, 0.799192f, 0.799076f, 0.798961f, 0.798846f, 0.798730f,
- 0.798615f, 0.798500f, 0.798384f, 0.798269f, 0.798153f, 0.798038f, 0.797922f, 0.797806f,
- 0.797691f, 0.797575f, 0.797459f, 0.797344f, 0.797228f, 0.797112f, 0.796996f, 0.796881f,
- 0.796765f, 0.796649f, 0.796533f, 0.796417f, 0.796301f, 0.796185f, 0.796069f, 0.795953f,
- 0.795837f, 0.795721f, 0.795605f, 0.795488f, 0.795372f, 0.795256f, 0.795140f, 0.795023f,
- 0.794907f, 0.794791f, 0.794674f, 0.794558f, 0.794442f, 0.794325f, 0.794209f, 0.794092f,
- 0.793975f, 0.793859f, 0.793742f, 0.793626f, 0.793509f, 0.793392f, 0.793276f, 0.793159f,
- 0.793042f, 0.792925f, 0.792808f, 0.792691f, 0.792575f, 0.792458f, 0.792341f, 0.792224f,
- 0.792107f, 0.791990f, 0.791872f, 0.791755f, 0.791638f, 0.791521f, 0.791404f, 0.791287f,
- 0.791169f, 0.791052f, 0.790935f, 0.790817f, 0.790700f, 0.790583f, 0.790465f, 0.790348f,
- 0.790230f, 0.790113f, 0.789995f, 0.789878f, 0.789760f, 0.789642f, 0.789525f, 0.789407f,
- 0.789289f, 0.789172f, 0.789054f, 0.788936f, 0.788818f, 0.788700f, 0.788582f, 0.788464f,
- 0.788346f, 0.788228f, 0.788110f, 0.787992f, 0.787874f, 0.787756f, 0.787638f, 0.787520f,
- 0.787402f, 0.787284f, 0.787165f, 0.787047f, 0.786929f, 0.786810f, 0.786692f, 0.786574f,
- 0.786455f, 0.786337f, 0.786218f, 0.786100f, 0.785981f, 0.785863f, 0.785744f, 0.785625f,
- 0.785507f, 0.785388f, 0.785269f, 0.785151f, 0.785032f, 0.784913f, 0.784794f, 0.784675f,
- 0.784557f, 0.784438f, 0.784319f, 0.784200f, 0.784081f, 0.783962f, 0.783843f, 0.783724f,
- 0.783605f, 0.783485f, 0.783366f, 0.783247f, 0.783128f, 0.783009f, 0.782889f, 0.782770f,
- 0.782651f, 0.782531f, 0.782412f, 0.782292f, 0.782173f, 0.782053f, 0.781934f, 0.781814f,
- 0.781695f, 0.781575f, 0.781456f, 0.781336f, 0.781216f, 0.781097f, 0.780977f, 0.780857f,
- 0.780737f, 0.780617f, 0.780498f, 0.780378f, 0.780258f, 0.780138f, 0.780018f, 0.779898f,
- 0.779778f, 0.779658f, 0.779538f, 0.779418f, 0.779297f, 0.779177f, 0.779057f, 0.778937f,
- 0.778817f, 0.778696f, 0.778576f, 0.778456f, 0.778335f, 0.778215f, 0.778094f, 0.777974f,
- 0.777853f, 0.777733f, 0.777612f, 0.777492f, 0.777371f, 0.777251f, 0.777130f, 0.777009f,
- 0.776888f, 0.776768f, 0.776647f, 0.776526f, 0.776405f, 0.776284f, 0.776164f, 0.776043f,
- 0.775922f, 0.775801f, 0.775680f, 0.775559f, 0.775438f, 0.775317f, 0.775195f, 0.775074f,
- 0.774953f, 0.774832f, 0.774711f, 0.774589f, 0.774468f, 0.774347f, 0.774225f, 0.774104f,
- 0.773983f, 0.773861f, 0.773740f, 0.773618f, 0.773497f, 0.773375f, 0.773254f, 0.773132f,
- 0.773010f, 0.772889f, 0.772767f, 0.772645f, 0.772524f, 0.772402f, 0.772280f, 0.772158f,
- 0.772036f, 0.771915f, 0.771793f, 0.771671f, 0.771549f, 0.771427f, 0.771305f, 0.771183f,
- 0.771061f, 0.770938f, 0.770816f, 0.770694f, 0.770572f, 0.770450f, 0.770327f, 0.770205f,
- 0.770083f, 0.769961f, 0.769838f, 0.769716f, 0.769593f, 0.769471f, 0.769348f, 0.769226f,
- 0.769103f, 0.768981f, 0.768858f, 0.768736f, 0.768613f, 0.768490f, 0.768368f, 0.768245f,
- 0.768122f, 0.767999f, 0.767876f, 0.767754f, 0.767631f, 0.767508f, 0.767385f, 0.767262f,
- 0.767139f, 0.767016f, 0.766893f, 0.766770f, 0.766647f, 0.766524f, 0.766400f, 0.766277f,
- 0.766154f, 0.766031f, 0.765907f, 0.765784f, 0.765661f, 0.765538f, 0.765414f, 0.765291f,
- 0.765167f, 0.765044f, 0.764920f, 0.764797f, 0.764673f, 0.764550f, 0.764426f, 0.764302f,
- 0.764179f, 0.764055f, 0.763931f, 0.763808f, 0.763684f, 0.763560f, 0.763436f, 0.763312f,
- 0.763188f, 0.763065f, 0.762941f, 0.762817f, 0.762693f, 0.762569f, 0.762444f, 0.762320f,
- 0.762196f, 0.762072f, 0.761948f, 0.761824f, 0.761700f, 0.761575f, 0.761451f, 0.761327f,
- 0.761202f, 0.761078f, 0.760954f, 0.760829f, 0.760705f, 0.760580f, 0.760456f, 0.760331f,
- 0.760207f, 0.760082f, 0.759957f, 0.759833f, 0.759708f, 0.759583f, 0.759459f, 0.759334f,
- 0.759209f, 0.759084f, 0.758960f, 0.758835f, 0.758710f, 0.758585f, 0.758460f, 0.758335f,
- 0.758210f, 0.758085f, 0.757960f, 0.757835f, 0.757710f, 0.757584f, 0.757459f, 0.757334f,
- 0.757209f, 0.757084f, 0.756958f, 0.756833f, 0.756708f, 0.756582f, 0.756457f, 0.756331f,
- 0.756206f, 0.756081f, 0.755955f, 0.755829f, 0.755704f, 0.755578f, 0.755453f, 0.755327f,
- 0.755201f, 0.755076f, 0.754950f, 0.754824f, 0.754698f, 0.754573f, 0.754447f, 0.754321f,
- 0.754195f, 0.754069f, 0.753943f, 0.753817f, 0.753691f, 0.753565f, 0.753439f, 0.753313f,
- 0.753187f, 0.753061f, 0.752934f, 0.752808f, 0.752682f, 0.752556f, 0.752429f, 0.752303f,
- 0.752177f, 0.752050f, 0.751924f, 0.751798f, 0.751671f, 0.751545f, 0.751418f, 0.751292f,
- 0.751165f, 0.751039f, 0.750912f, 0.750785f, 0.750659f, 0.750532f, 0.750405f, 0.750278f,
- 0.750152f, 0.750025f, 0.749898f, 0.749771f, 0.749644f, 0.749517f, 0.749390f, 0.749263f,
- 0.749136f, 0.749009f, 0.748882f, 0.748755f, 0.748628f, 0.748501f, 0.748374f, 0.748247f,
- 0.748119f, 0.747992f, 0.747865f, 0.747738f, 0.747610f, 0.747483f, 0.747355f, 0.747228f,
- 0.747101f, 0.746973f, 0.746846f, 0.746718f, 0.746591f, 0.746463f, 0.746335f, 0.746208f,
- 0.746080f, 0.745952f, 0.745825f, 0.745697f, 0.745569f, 0.745441f, 0.745314f, 0.745186f,
- 0.745058f, 0.744930f, 0.744802f, 0.744674f, 0.744546f, 0.744418f, 0.744290f, 0.744162f,
- 0.744034f, 0.743906f, 0.743777f, 0.743649f, 0.743521f, 0.743393f, 0.743265f, 0.743136f,
- 0.743008f, 0.742880f, 0.742751f, 0.742623f, 0.742494f, 0.742366f, 0.742237f, 0.742109f,
- 0.741980f, 0.741852f, 0.741723f, 0.741595f, 0.741466f, 0.741337f, 0.741209f, 0.741080f,
- 0.740951f, 0.740822f, 0.740694f, 0.740565f, 0.740436f, 0.740307f, 0.740178f, 0.740049f,
- 0.739920f, 0.739791f, 0.739662f, 0.739533f, 0.739404f, 0.739275f, 0.739146f, 0.739017f,
- 0.738887f, 0.738758f, 0.738629f, 0.738500f, 0.738370f, 0.738241f, 0.738112f, 0.737982f,
- 0.737853f, 0.737723f, 0.737594f, 0.737464f, 0.737335f, 0.737205f, 0.737076f, 0.736946f,
- 0.736817f, 0.736687f, 0.736557f, 0.736428f, 0.736298f, 0.736168f, 0.736038f, 0.735908f,
- 0.735779f, 0.735649f, 0.735519f, 0.735389f, 0.735259f, 0.735129f, 0.734999f, 0.734869f,
- 0.734739f, 0.734609f, 0.734479f, 0.734349f, 0.734218f, 0.734088f, 0.733958f, 0.733828f,
- 0.733697f, 0.733567f, 0.733437f, 0.733306f, 0.733176f, 0.733046f, 0.732915f, 0.732785f,
- 0.732654f, 0.732524f, 0.732393f, 0.732263f, 0.732132f, 0.732001f, 0.731871f, 0.731740f,
- 0.731609f, 0.731479f, 0.731348f, 0.731217f, 0.731086f, 0.730955f, 0.730825f, 0.730694f,
- 0.730563f, 0.730432f, 0.730301f, 0.730170f, 0.730039f, 0.729908f, 0.729777f, 0.729646f,
- 0.729514f, 0.729383f, 0.729252f, 0.729121f, 0.728990f, 0.728858f, 0.728727f, 0.728596f,
- 0.728464f, 0.728333f, 0.728202f, 0.728070f, 0.727939f, 0.727807f, 0.727676f, 0.727544f,
- 0.727413f, 0.727281f, 0.727149f, 0.727018f, 0.726886f, 0.726754f, 0.726623f, 0.726491f,
- 0.726359f, 0.726227f, 0.726095f, 0.725964f, 0.725832f, 0.725700f, 0.725568f, 0.725436f,
- 0.725304f, 0.725172f, 0.725040f, 0.724908f, 0.724776f, 0.724644f, 0.724511f, 0.724379f,
- 0.724247f, 0.724115f, 0.723983f, 0.723850f, 0.723718f, 0.723586f, 0.723453f, 0.723321f,
- 0.723188f, 0.723056f, 0.722924f, 0.722791f, 0.722659f, 0.722526f, 0.722393f, 0.722261f,
- 0.722128f, 0.721996f, 0.721863f, 0.721730f, 0.721597f, 0.721465f, 0.721332f, 0.721199f,
- 0.721066f, 0.720933f, 0.720800f, 0.720668f, 0.720535f, 0.720402f, 0.720269f, 0.720136f,
- 0.720003f, 0.719869f, 0.719736f, 0.719603f, 0.719470f, 0.719337f, 0.719204f, 0.719070f,
- 0.718937f, 0.718804f, 0.718670f, 0.718537f, 0.718404f, 0.718270f, 0.718137f, 0.718004f,
- 0.717870f, 0.717737f, 0.717603f, 0.717469f, 0.717336f, 0.717202f, 0.717069f, 0.716935f,
- 0.716801f, 0.716668f, 0.716534f, 0.716400f, 0.716266f, 0.716132f, 0.715999f, 0.715865f,
- 0.715731f, 0.715597f, 0.715463f, 0.715329f, 0.715195f, 0.715061f, 0.714927f, 0.714793f,
- 0.714659f, 0.714525f, 0.714390f, 0.714256f, 0.714122f, 0.713988f, 0.713853f, 0.713719f,
- 0.713585f, 0.713451f, 0.713316f, 0.713182f, 0.713047f, 0.712913f, 0.712778f, 0.712644f,
- 0.712509f, 0.712375f, 0.712240f, 0.712106f, 0.711971f, 0.711836f, 0.711702f, 0.711567f,
- 0.711432f, 0.711297f, 0.711163f, 0.711028f, 0.710893f, 0.710758f, 0.710623f, 0.710488f,
- 0.710353f, 0.710218f, 0.710083f, 0.709948f, 0.709813f, 0.709678f, 0.709543f, 0.709408f,
- 0.709273f, 0.709138f, 0.709002f, 0.708867f, 0.708732f, 0.708597f, 0.708461f, 0.708326f,
- 0.708191f, 0.708055f, 0.707920f, 0.707784f, 0.707649f, 0.707513f, 0.707378f, 0.707242f,
- 0.707107f, 0.706971f, 0.706836f, 0.706700f, 0.706564f, 0.706429f, 0.706293f, 0.706157f,
- 0.706021f, 0.705885f, 0.705750f, 0.705614f, 0.705478f, 0.705342f, 0.705206f, 0.705070f,
- 0.704934f, 0.704798f, 0.704662f, 0.704526f, 0.704390f, 0.704254f, 0.704118f, 0.703981f,
- 0.703845f, 0.703709f, 0.703573f, 0.703436f, 0.703300f, 0.703164f, 0.703028f, 0.702891f,
- 0.702755f, 0.702618f, 0.702482f, 0.702345f, 0.702209f, 0.702072f, 0.701936f, 0.701799f,
- 0.701663f, 0.701526f, 0.701389f, 0.701253f, 0.701116f, 0.700979f, 0.700842f, 0.700706f,
- 0.700569f, 0.700432f, 0.700295f, 0.700158f, 0.700021f, 0.699884f, 0.699747f, 0.699610f,
- 0.699473f, 0.699336f, 0.699199f, 0.699062f, 0.698925f, 0.698788f, 0.698651f, 0.698513f,
- 0.698376f, 0.698239f, 0.698102f, 0.697964f, 0.697827f, 0.697690f, 0.697552f, 0.697415f,
- 0.697277f, 0.697140f, 0.697003f, 0.696865f, 0.696728f, 0.696590f, 0.696452f, 0.696315f,
- 0.696177f, 0.696039f, 0.695902f, 0.695764f, 0.695626f, 0.695489f, 0.695351f, 0.695213f,
- 0.695075f, 0.694937f, 0.694799f, 0.694661f, 0.694524f, 0.694386f, 0.694248f, 0.694109f,
- 0.693971f, 0.693833f, 0.693695f, 0.693557f, 0.693419f, 0.693281f, 0.693143f, 0.693004f,
- 0.692866f, 0.692728f, 0.692590f, 0.692451f, 0.692313f, 0.692175f, 0.692036f, 0.691898f,
- 0.691759f, 0.691621f, 0.691482f, 0.691344f, 0.691205f, 0.691067f, 0.690928f, 0.690789f,
- 0.690651f, 0.690512f, 0.690373f, 0.690235f, 0.690096f, 0.689957f, 0.689818f, 0.689679f,
- 0.689541f, 0.689402f, 0.689263f, 0.689124f, 0.688985f, 0.688846f, 0.688707f, 0.688568f,
- 0.688429f, 0.688290f, 0.688151f, 0.688011f, 0.687872f, 0.687733f, 0.687594f, 0.687455f,
- 0.687315f, 0.687176f, 0.687037f, 0.686897f, 0.686758f, 0.686619f, 0.686479f, 0.686340f,
- 0.686200f, 0.686061f, 0.685921f, 0.685782f, 0.685642f, 0.685503f, 0.685363f, 0.685223f,
- 0.685084f, 0.684944f, 0.684804f, 0.684664f, 0.684525f, 0.684385f, 0.684245f, 0.684105f,
- 0.683965f, 0.683825f, 0.683686f, 0.683546f, 0.683406f, 0.683266f, 0.683126f, 0.682986f,
- 0.682846f, 0.682705f, 0.682565f, 0.682425f, 0.682285f, 0.682145f, 0.682005f, 0.681864f,
- 0.681724f, 0.681584f, 0.681443f, 0.681303f, 0.681163f, 0.681022f, 0.680882f, 0.680741f,
- 0.680601f, 0.680461f, 0.680320f, 0.680179f, 0.680039f, 0.679898f, 0.679758f, 0.679617f,
- 0.679476f, 0.679336f, 0.679195f, 0.679054f, 0.678913f, 0.678773f, 0.678632f, 0.678491f,
- 0.678350f, 0.678209f, 0.678068f, 0.677927f, 0.677786f, 0.677645f, 0.677504f, 0.677363f,
- 0.677222f, 0.677081f, 0.676940f, 0.676799f, 0.676658f, 0.676516f, 0.676375f, 0.676234f,
- 0.676093f, 0.675951f, 0.675810f, 0.675669f, 0.675527f, 0.675386f, 0.675245f, 0.675103f,
- 0.674962f, 0.674820f, 0.674679f, 0.674537f, 0.674396f, 0.674254f, 0.674112f, 0.673971f,
- 0.673829f, 0.673687f, 0.673546f, 0.673404f, 0.673262f, 0.673120f, 0.672978f, 0.672837f,
- 0.672695f, 0.672553f, 0.672411f, 0.672269f, 0.672127f, 0.671985f, 0.671843f, 0.671701f,
- 0.671559f, 0.671417f, 0.671275f, 0.671133f, 0.670990f, 0.670848f, 0.670706f, 0.670564f,
- 0.670422f, 0.670279f, 0.670137f, 0.669995f, 0.669852f, 0.669710f, 0.669567f, 0.669425f,
- 0.669283f, 0.669140f, 0.668998f, 0.668855f, 0.668712f, 0.668570f, 0.668427f, 0.668285f,
- 0.668142f, 0.667999f, 0.667857f, 0.667714f, 0.667571f, 0.667428f, 0.667286f, 0.667143f,
- 0.667000f, 0.666857f, 0.666714f, 0.666571f, 0.666428f, 0.666285f, 0.666142f, 0.665999f,
- 0.665856f, 0.665713f, 0.665570f, 0.665427f, 0.665284f, 0.665141f, 0.664997f, 0.664854f,
- 0.664711f, 0.664568f, 0.664424f, 0.664281f, 0.664138f, 0.663994f, 0.663851f, 0.663708f,
- 0.663564f, 0.663421f, 0.663277f, 0.663134f, 0.662990f, 0.662847f, 0.662703f, 0.662559f,
- 0.662416f, 0.662272f, 0.662128f, 0.661985f, 0.661841f, 0.661697f, 0.661553f, 0.661410f,
- 0.661266f, 0.661122f, 0.660978f, 0.660834f, 0.660690f, 0.660546f, 0.660402f, 0.660258f,
- 0.660114f, 0.659970f, 0.659826f, 0.659682f, 0.659538f, 0.659394f, 0.659250f, 0.659105f,
- 0.658961f, 0.658817f, 0.658673f, 0.658529f, 0.658384f, 0.658240f, 0.658095f, 0.657951f,
- 0.657807f, 0.657662f, 0.657518f, 0.657373f, 0.657229f, 0.657084f, 0.656940f, 0.656795f,
- 0.656651f, 0.656506f, 0.656361f, 0.656217f, 0.656072f, 0.655927f, 0.655782f, 0.655638f,
- 0.655493f, 0.655348f, 0.655203f, 0.655058f, 0.654913f, 0.654769f, 0.654624f, 0.654479f,
- 0.654334f, 0.654189f, 0.654044f, 0.653899f, 0.653753f, 0.653608f, 0.653463f, 0.653318f,
- 0.653173f, 0.653028f, 0.652882f, 0.652737f, 0.652592f, 0.652447f, 0.652301f, 0.652156f,
- 0.652011f, 0.651865f, 0.651720f, 0.651574f, 0.651429f, 0.651283f, 0.651138f, 0.650992f,
- 0.650847f, 0.650701f, 0.650555f, 0.650410f, 0.650264f, 0.650119f, 0.649973f, 0.649827f,
- 0.649681f, 0.649536f, 0.649390f, 0.649244f, 0.649098f, 0.648952f, 0.648806f, 0.648660f,
- 0.648514f, 0.648368f, 0.648222f, 0.648076f, 0.647930f, 0.647784f, 0.647638f, 0.647492f,
- 0.647346f, 0.647200f, 0.647054f, 0.646907f, 0.646761f, 0.646615f, 0.646469f, 0.646322f,
- 0.646176f, 0.646030f, 0.645883f, 0.645737f, 0.645590f, 0.645444f, 0.645298f, 0.645151f,
- 0.645005f, 0.644858f, 0.644711f, 0.644565f, 0.644418f, 0.644272f, 0.644125f, 0.643978f,
- 0.643832f, 0.643685f, 0.643538f, 0.643391f, 0.643245f, 0.643098f, 0.642951f, 0.642804f,
- 0.642657f, 0.642510f, 0.642363f, 0.642216f, 0.642069f, 0.641922f, 0.641775f, 0.641628f,
- 0.641481f, 0.641334f, 0.641187f, 0.641040f, 0.640892f, 0.640745f, 0.640598f, 0.640451f,
- 0.640303f, 0.640156f, 0.640009f, 0.639862f, 0.639714f, 0.639567f, 0.639419f, 0.639272f,
- 0.639124f, 0.638977f, 0.638829f, 0.638682f, 0.638534f, 0.638387f, 0.638239f, 0.638092f,
- 0.637944f, 0.637796f, 0.637649f, 0.637501f, 0.637353f, 0.637205f, 0.637057f, 0.636910f,
- 0.636762f, 0.636614f, 0.636466f, 0.636318f, 0.636170f, 0.636022f, 0.635874f, 0.635726f,
- 0.635578f, 0.635430f, 0.635282f, 0.635134f, 0.634986f, 0.634838f, 0.634690f, 0.634542f,
- 0.634393f, 0.634245f, 0.634097f, 0.633949f, 0.633800f, 0.633652f, 0.633504f, 0.633355f,
- 0.633207f, 0.633058f, 0.632910f, 0.632761f, 0.632613f, 0.632464f, 0.632316f, 0.632167f,
- 0.632019f, 0.631870f, 0.631721f, 0.631573f, 0.631424f, 0.631275f, 0.631127f, 0.630978f,
- 0.630829f, 0.630680f, 0.630532f, 0.630383f, 0.630234f, 0.630085f, 0.629936f, 0.629787f,
- 0.629638f, 0.629489f, 0.629340f, 0.629191f, 0.629042f, 0.628893f, 0.628744f, 0.628595f,
- 0.628446f, 0.628297f, 0.628147f, 0.627998f, 0.627849f, 0.627700f, 0.627550f, 0.627401f,
- 0.627252f, 0.627102f, 0.626953f, 0.626804f, 0.626654f, 0.626505f, 0.626355f, 0.626206f,
- 0.626056f, 0.625907f, 0.625757f, 0.625608f, 0.625458f, 0.625309f, 0.625159f, 0.625009f,
- 0.624860f, 0.624710f, 0.624560f, 0.624410f, 0.624260f, 0.624111f, 0.623961f, 0.623811f,
- 0.623661f, 0.623511f, 0.623361f, 0.623211f, 0.623061f, 0.622911f, 0.622761f, 0.622611f,
- 0.622461f, 0.622311f, 0.622161f, 0.622011f, 0.621861f, 0.621711f, 0.621560f, 0.621410f,
- 0.621260f, 0.621110f, 0.620959f, 0.620809f, 0.620659f, 0.620508f, 0.620358f, 0.620208f,
- 0.620057f, 0.619907f, 0.619756f, 0.619606f, 0.619455f, 0.619305f, 0.619154f, 0.619004f,
- 0.618853f, 0.618702f, 0.618552f, 0.618401f, 0.618250f, 0.618100f, 0.617949f, 0.617798f,
- 0.617647f, 0.617496f, 0.617346f, 0.617195f, 0.617044f, 0.616893f, 0.616742f, 0.616591f,
- 0.616440f, 0.616289f, 0.616138f, 0.615987f, 0.615836f, 0.615685f, 0.615534f, 0.615383f,
- 0.615232f, 0.615080f, 0.614929f, 0.614778f, 0.614627f, 0.614475f, 0.614324f, 0.614173f,
- 0.614022f, 0.613870f, 0.613719f, 0.613567f, 0.613416f, 0.613265f, 0.613113f, 0.612962f,
- 0.612810f, 0.612659f, 0.612507f, 0.612355f, 0.612204f, 0.612052f, 0.611901f, 0.611749f,
- 0.611597f, 0.611445f, 0.611294f, 0.611142f, 0.610990f, 0.610838f, 0.610687f, 0.610535f,
- 0.610383f, 0.610231f, 0.610079f, 0.609927f, 0.609775f, 0.609623f, 0.609471f, 0.609319f,
- 0.609167f, 0.609015f, 0.608863f, 0.608711f, 0.608559f, 0.608406f, 0.608254f, 0.608102f,
- 0.607950f, 0.607798f, 0.607645f, 0.607493f, 0.607341f, 0.607188f, 0.607036f, 0.606884f,
- 0.606731f, 0.606579f, 0.606426f, 0.606274f, 0.606121f, 0.605969f, 0.605816f, 0.605664f,
- 0.605511f, 0.605358f, 0.605206f, 0.605053f, 0.604900f, 0.604748f, 0.604595f, 0.604442f,
- 0.604290f, 0.604137f, 0.603984f, 0.603831f, 0.603678f, 0.603525f, 0.603372f, 0.603220f,
- 0.603067f, 0.602914f, 0.602761f, 0.602608f, 0.602455f, 0.602302f, 0.602148f, 0.601995f,
- 0.601842f, 0.601689f, 0.601536f, 0.601383f, 0.601230f, 0.601076f, 0.600923f, 0.600770f,
- 0.600616f, 0.600463f, 0.600310f, 0.600156f, 0.600003f, 0.599850f, 0.599696f, 0.599543f,
- 0.599389f, 0.599236f, 0.599082f, 0.598929f, 0.598775f, 0.598622f, 0.598468f, 0.598314f,
- 0.598161f, 0.598007f, 0.597853f, 0.597700f, 0.597546f, 0.597392f, 0.597238f, 0.597085f,
- 0.596931f, 0.596777f, 0.596623f, 0.596469f, 0.596315f, 0.596161f, 0.596007f, 0.595853f,
- 0.595699f, 0.595545f, 0.595391f, 0.595237f, 0.595083f, 0.594929f, 0.594775f, 0.594621f,
- 0.594467f, 0.594312f, 0.594158f, 0.594004f, 0.593850f, 0.593695f, 0.593541f, 0.593387f,
- 0.593232f, 0.593078f, 0.592924f, 0.592769f, 0.592615f, 0.592460f, 0.592306f, 0.592151f,
- 0.591997f, 0.591842f, 0.591688f, 0.591533f, 0.591378f, 0.591224f, 0.591069f, 0.590914f,
- 0.590760f, 0.590605f, 0.590450f, 0.590295f, 0.590141f, 0.589986f, 0.589831f, 0.589676f,
- 0.589521f, 0.589366f, 0.589212f, 0.589057f, 0.588902f, 0.588747f, 0.588592f, 0.588437f,
- 0.588282f, 0.588126f, 0.587971f, 0.587816f, 0.587661f, 0.587506f, 0.587351f, 0.587196f,
- 0.587040f, 0.586885f, 0.586730f, 0.586575f, 0.586419f, 0.586264f, 0.586109f, 0.585953f,
- 0.585798f, 0.585642f, 0.585487f, 0.585332f, 0.585176f, 0.585021f, 0.584865f, 0.584710f,
- 0.584554f, 0.584398f, 0.584243f, 0.584087f, 0.583931f, 0.583776f, 0.583620f, 0.583464f,
- 0.583309f, 0.583153f, 0.582997f, 0.582841f, 0.582685f, 0.582530f, 0.582374f, 0.582218f,
- 0.582062f, 0.581906f, 0.581750f, 0.581594f, 0.581438f, 0.581282f, 0.581126f, 0.580970f,
- 0.580814f, 0.580658f, 0.580502f, 0.580346f, 0.580189f, 0.580033f, 0.579877f, 0.579721f,
- 0.579565f, 0.579408f, 0.579252f, 0.579096f, 0.578939f, 0.578783f, 0.578627f, 0.578470f,
- 0.578314f, 0.578157f, 0.578001f, 0.577844f, 0.577688f, 0.577531f, 0.577375f, 0.577218f,
- 0.577062f, 0.576905f, 0.576748f, 0.576592f, 0.576435f, 0.576278f, 0.576122f, 0.575965f,
- 0.575808f, 0.575651f, 0.575495f, 0.575338f, 0.575181f, 0.575024f, 0.574867f, 0.574710f,
- 0.574553f, 0.574396f, 0.574239f, 0.574082f, 0.573925f, 0.573768f, 0.573611f, 0.573454f,
- 0.573297f, 0.573140f, 0.572983f, 0.572826f, 0.572669f, 0.572511f, 0.572354f, 0.572197f,
- 0.572040f, 0.571882f, 0.571725f, 0.571568f, 0.571410f, 0.571253f, 0.571096f, 0.570938f,
- 0.570781f, 0.570623f, 0.570466f, 0.570308f, 0.570151f, 0.569993f, 0.569836f, 0.569678f,
- 0.569521f, 0.569363f, 0.569205f, 0.569048f, 0.568890f, 0.568732f, 0.568574f, 0.568417f,
- 0.568259f, 0.568101f, 0.567943f, 0.567786f, 0.567628f, 0.567470f, 0.567312f, 0.567154f,
- 0.566996f, 0.566838f, 0.566680f, 0.566522f, 0.566364f, 0.566206f, 0.566048f, 0.565890f,
- 0.565732f, 0.565574f, 0.565416f, 0.565257f, 0.565099f, 0.564941f, 0.564783f, 0.564624f,
- 0.564466f, 0.564308f, 0.564150f, 0.563991f, 0.563833f, 0.563675f, 0.563516f, 0.563358f,
- 0.563199f, 0.563041f, 0.562882f, 0.562724f, 0.562565f, 0.562407f, 0.562248f, 0.562090f,
- 0.561931f, 0.561773f, 0.561614f, 0.561455f, 0.561297f, 0.561138f, 0.560979f, 0.560820f,
- 0.560662f, 0.560503f, 0.560344f, 0.560185f, 0.560026f, 0.559867f, 0.559709f, 0.559550f,
- 0.559391f, 0.559232f, 0.559073f, 0.558914f, 0.558755f, 0.558596f, 0.558437f, 0.558278f,
- 0.558119f, 0.557959f, 0.557800f, 0.557641f, 0.557482f, 0.557323f, 0.557164f, 0.557004f,
- 0.556845f, 0.556686f, 0.556526f, 0.556367f, 0.556208f, 0.556048f, 0.555889f, 0.555730f,
- 0.555570f, 0.555411f, 0.555251f, 0.555092f, 0.554932f, 0.554773f, 0.554613f, 0.554454f,
- 0.554294f, 0.554134f, 0.553975f, 0.553815f, 0.553656f, 0.553496f, 0.553336f, 0.553176f,
- 0.553017f, 0.552857f, 0.552697f, 0.552537f, 0.552378f, 0.552218f, 0.552058f, 0.551898f,
- 0.551738f, 0.551578f, 0.551418f, 0.551258f, 0.551098f, 0.550938f, 0.550778f, 0.550618f,
- 0.550458f, 0.550298f, 0.550138f, 0.549978f, 0.549818f, 0.549657f, 0.549497f, 0.549337f,
- 0.549177f, 0.549016f, 0.548856f, 0.548696f, 0.548536f, 0.548375f, 0.548215f, 0.548054f,
- 0.547894f, 0.547734f, 0.547573f, 0.547413f, 0.547252f, 0.547092f, 0.546931f, 0.546771f,
- 0.546610f, 0.546450f, 0.546289f, 0.546128f, 0.545968f, 0.545807f, 0.545646f, 0.545486f,
- 0.545325f, 0.545164f, 0.545003f, 0.544843f, 0.544682f, 0.544521f, 0.544360f, 0.544199f,
- 0.544039f, 0.543878f, 0.543717f, 0.543556f, 0.543395f, 0.543234f, 0.543073f, 0.542912f,
- 0.542751f, 0.542590f, 0.542429f, 0.542268f, 0.542106f, 0.541945f, 0.541784f, 0.541623f,
- 0.541462f, 0.541301f, 0.541139f, 0.540978f, 0.540817f, 0.540655f, 0.540494f, 0.540333f,
- 0.540171f, 0.540010f, 0.539849f, 0.539687f, 0.539526f, 0.539364f, 0.539203f, 0.539041f,
- 0.538880f, 0.538718f, 0.538557f, 0.538395f, 0.538234f, 0.538072f, 0.537910f, 0.537749f,
- 0.537587f, 0.537425f, 0.537264f, 0.537102f, 0.536940f, 0.536778f, 0.536617f, 0.536455f,
- 0.536293f, 0.536131f, 0.535969f, 0.535807f, 0.535645f, 0.535484f, 0.535322f, 0.535160f,
- 0.534998f, 0.534836f, 0.534674f, 0.534512f, 0.534349f, 0.534187f, 0.534025f, 0.533863f,
- 0.533701f, 0.533539f, 0.533377f, 0.533214f, 0.533052f, 0.532890f, 0.532728f, 0.532565f,
- 0.532403f, 0.532241f, 0.532078f, 0.531916f, 0.531754f, 0.531591f, 0.531429f, 0.531266f,
- 0.531104f, 0.530942f, 0.530779f, 0.530617f, 0.530454f, 0.530291f, 0.530129f, 0.529966f,
- 0.529804f, 0.529641f, 0.529478f, 0.529316f, 0.529153f, 0.528990f, 0.528828f, 0.528665f,
- 0.528502f, 0.528339f, 0.528176f, 0.528014f, 0.527851f, 0.527688f, 0.527525f, 0.527362f,
- 0.527199f, 0.527036f, 0.526873f, 0.526710f, 0.526547f, 0.526384f, 0.526221f, 0.526058f,
- 0.525895f, 0.525732f, 0.525569f, 0.525406f, 0.525243f, 0.525079f, 0.524916f, 0.524753f,
- 0.524590f, 0.524426f, 0.524263f, 0.524100f, 0.523937f, 0.523773f, 0.523610f, 0.523447f,
- 0.523283f, 0.523120f, 0.522956f, 0.522793f, 0.522629f, 0.522466f, 0.522302f, 0.522139f,
- 0.521975f, 0.521812f, 0.521648f, 0.521485f, 0.521321f, 0.521157f, 0.520994f, 0.520830f,
- 0.520666f, 0.520503f, 0.520339f, 0.520175f, 0.520011f, 0.519848f, 0.519684f, 0.519520f,
- 0.519356f, 0.519192f, 0.519028f, 0.518864f, 0.518700f, 0.518536f, 0.518372f, 0.518209f,
- 0.518045f, 0.517880f, 0.517716f, 0.517552f, 0.517388f, 0.517224f, 0.517060f, 0.516896f,
- 0.516732f, 0.516568f, 0.516403f, 0.516239f, 0.516075f, 0.515911f, 0.515746f, 0.515582f,
- 0.515418f, 0.515254f, 0.515089f, 0.514925f, 0.514760f, 0.514596f, 0.514432f, 0.514267f,
- 0.514103f, 0.513938f, 0.513774f, 0.513609f, 0.513445f, 0.513280f, 0.513116f, 0.512951f,
- 0.512786f, 0.512622f, 0.512457f, 0.512292f, 0.512128f, 0.511963f, 0.511798f, 0.511634f,
- 0.511469f, 0.511304f, 0.511139f, 0.510974f, 0.510810f, 0.510645f, 0.510480f, 0.510315f,
- 0.510150f, 0.509985f, 0.509820f, 0.509655f, 0.509490f, 0.509325f, 0.509160f, 0.508995f,
- 0.508830f, 0.508665f, 0.508500f, 0.508335f, 0.508170f, 0.508005f, 0.507839f, 0.507674f,
- 0.507509f, 0.507344f, 0.507179f, 0.507013f, 0.506848f, 0.506683f, 0.506517f, 0.506352f,
- 0.506187f, 0.506021f, 0.505856f, 0.505690f, 0.505525f, 0.505360f, 0.505194f, 0.505029f,
- 0.504863f, 0.504698f, 0.504532f, 0.504366f, 0.504201f, 0.504035f, 0.503870f, 0.503704f,
- 0.503538f, 0.503373f, 0.503207f, 0.503041f, 0.502876f, 0.502710f, 0.502544f, 0.502378f,
- 0.502212f, 0.502047f, 0.501881f, 0.501715f, 0.501549f, 0.501383f, 0.501217f, 0.501051f,
- 0.500885f, 0.500719f, 0.500553f, 0.500387f, 0.500221f, 0.500055f, 0.499889f, 0.499723f,
- 0.499557f, 0.499391f, 0.499225f, 0.499059f, 0.498893f, 0.498726f, 0.498560f, 0.498394f,
- 0.498228f, 0.498061f, 0.497895f, 0.497729f, 0.497562f, 0.497396f, 0.497230f, 0.497063f,
- 0.496897f, 0.496731f, 0.496564f, 0.496398f, 0.496231f, 0.496065f, 0.495898f, 0.495732f,
- 0.495565f, 0.495399f, 0.495232f, 0.495066f, 0.494899f, 0.494732f, 0.494566f, 0.494399f,
- 0.494232f, 0.494066f, 0.493899f, 0.493732f, 0.493565f, 0.493399f, 0.493232f, 0.493065f,
- 0.492898f, 0.492731f, 0.492564f, 0.492398f, 0.492231f, 0.492064f, 0.491897f, 0.491730f,
- 0.491563f, 0.491396f, 0.491229f, 0.491062f, 0.490895f, 0.490728f, 0.490561f, 0.490394f,
- 0.490226f, 0.490059f, 0.489892f, 0.489725f, 0.489558f, 0.489391f, 0.489223f, 0.489056f,
- 0.488889f, 0.488722f, 0.488554f, 0.488387f, 0.488220f, 0.488052f, 0.487885f, 0.487718f,
- 0.487550f, 0.487383f, 0.487215f, 0.487048f, 0.486880f, 0.486713f, 0.486545f, 0.486378f,
- 0.486210f, 0.486043f, 0.485875f, 0.485708f, 0.485540f, 0.485372f, 0.485205f, 0.485037f,
- 0.484869f, 0.484702f, 0.484534f, 0.484366f, 0.484198f, 0.484031f, 0.483863f, 0.483695f,
- 0.483527f, 0.483359f, 0.483191f, 0.483023f, 0.482856f, 0.482688f, 0.482520f, 0.482352f,
- 0.482184f, 0.482016f, 0.481848f, 0.481680f, 0.481512f, 0.481344f, 0.481176f, 0.481007f,
- 0.480839f, 0.480671f, 0.480503f, 0.480335f, 0.480167f, 0.479998f, 0.479830f, 0.479662f,
- 0.479494f, 0.479325f, 0.479157f, 0.478989f, 0.478821f, 0.478652f, 0.478484f, 0.478315f,
- 0.478147f, 0.477979f, 0.477810f, 0.477642f, 0.477473f, 0.477305f, 0.477136f, 0.476968f,
- 0.476799f, 0.476631f, 0.476462f, 0.476294f, 0.476125f, 0.475956f, 0.475788f, 0.475619f,
- 0.475450f, 0.475282f, 0.475113f, 0.474944f, 0.474775f, 0.474607f, 0.474438f, 0.474269f,
- 0.474100f, 0.473931f, 0.473763f, 0.473594f, 0.473425f, 0.473256f, 0.473087f, 0.472918f,
- 0.472749f, 0.472580f, 0.472411f, 0.472242f, 0.472073f, 0.471904f, 0.471735f, 0.471566f,
- 0.471397f, 0.471228f, 0.471058f, 0.470889f, 0.470720f, 0.470551f, 0.470382f, 0.470213f,
- 0.470043f, 0.469874f, 0.469705f, 0.469536f, 0.469366f, 0.469197f, 0.469028f, 0.468858f,
- 0.468689f, 0.468519f, 0.468350f, 0.468181f, 0.468011f, 0.467842f, 0.467672f, 0.467503f,
- 0.467333f, 0.467164f, 0.466994f, 0.466825f, 0.466655f, 0.466485f, 0.466316f, 0.466146f,
- 0.465977f, 0.465807f, 0.465637f, 0.465467f, 0.465298f, 0.465128f, 0.464958f, 0.464788f,
- 0.464619f, 0.464449f, 0.464279f, 0.464109f, 0.463939f, 0.463769f, 0.463600f, 0.463430f,
- 0.463260f, 0.463090f, 0.462920f, 0.462750f, 0.462580f, 0.462410f, 0.462240f, 0.462070f,
- 0.461900f, 0.461730f, 0.461560f, 0.461390f, 0.461219f, 0.461049f, 0.460879f, 0.460709f,
- 0.460539f, 0.460369f, 0.460198f, 0.460028f, 0.459858f, 0.459687f, 0.459517f, 0.459347f,
- 0.459177f, 0.459006f, 0.458836f, 0.458665f, 0.458495f, 0.458325f, 0.458154f, 0.457984f,
- 0.457813f, 0.457643f, 0.457472f, 0.457302f, 0.457131f, 0.456961f, 0.456790f, 0.456620f,
- 0.456449f, 0.456278f, 0.456108f, 0.455937f, 0.455766f, 0.455596f, 0.455425f, 0.455254f,
- 0.455084f, 0.454913f, 0.454742f, 0.454571f, 0.454400f, 0.454230f, 0.454059f, 0.453888f,
- 0.453717f, 0.453546f, 0.453375f, 0.453204f, 0.453033f, 0.452863f, 0.452692f, 0.452521f,
- 0.452350f, 0.452179f, 0.452008f, 0.451836f, 0.451665f, 0.451494f, 0.451323f, 0.451152f,
- 0.450981f, 0.450810f, 0.450639f, 0.450467f, 0.450296f, 0.450125f, 0.449954f, 0.449783f,
- 0.449611f, 0.449440f, 0.449269f, 0.449097f, 0.448926f, 0.448755f, 0.448583f, 0.448412f,
- 0.448241f, 0.448069f, 0.447898f, 0.447726f, 0.447555f, 0.447383f, 0.447212f, 0.447040f,
- 0.446869f, 0.446697f, 0.446526f, 0.446354f, 0.446183f, 0.446011f, 0.445839f, 0.445668f,
- 0.445496f, 0.445324f, 0.445153f, 0.444981f, 0.444809f, 0.444637f, 0.444466f, 0.444294f,
- 0.444122f, 0.443950f, 0.443779f, 0.443607f, 0.443435f, 0.443263f, 0.443091f, 0.442919f,
- 0.442747f, 0.442575f, 0.442403f, 0.442231f, 0.442059f, 0.441887f, 0.441715f, 0.441543f,
- 0.441371f, 0.441199f, 0.441027f, 0.440855f, 0.440683f, 0.440511f, 0.440339f, 0.440166f,
- 0.439994f, 0.439822f, 0.439650f, 0.439478f, 0.439305f, 0.439133f, 0.438961f, 0.438789f,
- 0.438616f, 0.438444f, 0.438272f, 0.438099f, 0.437927f, 0.437754f, 0.437582f, 0.437410f,
- 0.437237f, 0.437065f, 0.436892f, 0.436720f, 0.436547f, 0.436375f, 0.436202f, 0.436030f,
- 0.435857f, 0.435685f, 0.435512f, 0.435339f, 0.435167f, 0.434994f, 0.434821f, 0.434649f,
- 0.434476f, 0.434303f, 0.434131f, 0.433958f, 0.433785f, 0.433612f, 0.433439f, 0.433267f,
- 0.433094f, 0.432921f, 0.432748f, 0.432575f, 0.432402f, 0.432229f, 0.432057f, 0.431884f,
- 0.431711f, 0.431538f, 0.431365f, 0.431192f, 0.431019f, 0.430846f, 0.430673f, 0.430500f,
- 0.430326f, 0.430153f, 0.429980f, 0.429807f, 0.429634f, 0.429461f, 0.429288f, 0.429114f,
- 0.428941f, 0.428768f, 0.428595f, 0.428422f, 0.428248f, 0.428075f, 0.427902f, 0.427728f,
- 0.427555f, 0.427382f, 0.427208f, 0.427035f, 0.426862f, 0.426688f, 0.426515f, 0.426341f,
- 0.426168f, 0.425994f, 0.425821f, 0.425647f, 0.425474f, 0.425300f, 0.425127f, 0.424953f,
- 0.424780f, 0.424606f, 0.424432f, 0.424259f, 0.424085f, 0.423912f, 0.423738f, 0.423564f,
- 0.423390f, 0.423217f, 0.423043f, 0.422869f, 0.422695f, 0.422522f, 0.422348f, 0.422174f,
- 0.422000f, 0.421826f, 0.421653f, 0.421479f, 0.421305f, 0.421131f, 0.420957f, 0.420783f,
- 0.420609f, 0.420435f, 0.420261f, 0.420087f, 0.419913f, 0.419739f, 0.419565f, 0.419391f,
- 0.419217f, 0.419043f, 0.418869f, 0.418695f, 0.418520f, 0.418346f, 0.418172f, 0.417998f,
- 0.417824f, 0.417650f, 0.417475f, 0.417301f, 0.417127f, 0.416952f, 0.416778f, 0.416604f,
- 0.416430f, 0.416255f, 0.416081f, 0.415906f, 0.415732f, 0.415558f, 0.415383f, 0.415209f,
- 0.415034f, 0.414860f, 0.414685f, 0.414511f, 0.414337f, 0.414162f, 0.413987f, 0.413813f,
- 0.413638f, 0.413464f, 0.413289f, 0.413115f, 0.412940f, 0.412765f, 0.412591f, 0.412416f,
- 0.412241f, 0.412067f, 0.411892f, 0.411717f, 0.411542f, 0.411368f, 0.411193f, 0.411018f,
- 0.410843f, 0.410668f, 0.410493f, 0.410319f, 0.410144f, 0.409969f, 0.409794f, 0.409619f,
- 0.409444f, 0.409269f, 0.409094f, 0.408919f, 0.408744f, 0.408569f, 0.408394f, 0.408219f,
- 0.408044f, 0.407869f, 0.407694f, 0.407519f, 0.407344f, 0.407169f, 0.406994f, 0.406818f,
- 0.406643f, 0.406468f, 0.406293f, 0.406118f, 0.405942f, 0.405767f, 0.405592f, 0.405417f,
- 0.405241f, 0.405066f, 0.404891f, 0.404715f, 0.404540f, 0.404365f, 0.404189f, 0.404014f,
- 0.403838f, 0.403663f, 0.403488f, 0.403312f, 0.403137f, 0.402961f, 0.402786f, 0.402610f,
- 0.402435f, 0.402259f, 0.402084f, 0.401908f, 0.401732f, 0.401557f, 0.401381f, 0.401206f,
- 0.401030f, 0.400854f, 0.400679f, 0.400503f, 0.400327f, 0.400151f, 0.399976f, 0.399800f,
- 0.399624f, 0.399448f, 0.399273f, 0.399097f, 0.398921f, 0.398745f, 0.398569f, 0.398393f,
- 0.398218f, 0.398042f, 0.397866f, 0.397690f, 0.397514f, 0.397338f, 0.397162f, 0.396986f,
- 0.396810f, 0.396634f, 0.396458f, 0.396282f, 0.396106f, 0.395930f, 0.395754f, 0.395578f,
- 0.395401f, 0.395225f, 0.395049f, 0.394873f, 0.394697f, 0.394521f, 0.394344f, 0.394168f,
- 0.393992f, 0.393816f, 0.393640f, 0.393463f, 0.393287f, 0.393111f, 0.392934f, 0.392758f,
- 0.392582f, 0.392405f, 0.392229f, 0.392053f, 0.391876f, 0.391700f, 0.391523f, 0.391347f,
- 0.391170f, 0.390994f, 0.390817f, 0.390641f, 0.390464f, 0.390288f, 0.390111f, 0.389935f,
- 0.389758f, 0.389582f, 0.389405f, 0.389228f, 0.389052f, 0.388875f, 0.388698f, 0.388522f,
- 0.388345f, 0.388168f, 0.387992f, 0.387815f, 0.387638f, 0.387461f, 0.387285f, 0.387108f,
- 0.386931f, 0.386754f, 0.386577f, 0.386400f, 0.386224f, 0.386047f, 0.385870f, 0.385693f,
- 0.385516f, 0.385339f, 0.385162f, 0.384985f, 0.384808f, 0.384631f, 0.384454f, 0.384277f,
- 0.384100f, 0.383923f, 0.383746f, 0.383569f, 0.383392f, 0.383215f, 0.383038f, 0.382861f,
- 0.382683f, 0.382506f, 0.382329f, 0.382152f, 0.381975f, 0.381797f, 0.381620f, 0.381443f,
- 0.381266f, 0.381088f, 0.380911f, 0.380734f, 0.380557f, 0.380379f, 0.380202f, 0.380025f,
- 0.379847f, 0.379670f, 0.379492f, 0.379315f, 0.379138f, 0.378960f, 0.378783f, 0.378605f,
- 0.378428f, 0.378250f, 0.378073f, 0.377895f, 0.377718f, 0.377540f, 0.377363f, 0.377185f,
- 0.377007f, 0.376830f, 0.376652f, 0.376475f, 0.376297f, 0.376119f, 0.375942f, 0.375764f,
- 0.375586f, 0.375408f, 0.375231f, 0.375053f, 0.374875f, 0.374697f, 0.374520f, 0.374342f,
- 0.374164f, 0.373986f, 0.373808f, 0.373631f, 0.373453f, 0.373275f, 0.373097f, 0.372919f,
- 0.372741f, 0.372563f, 0.372385f, 0.372207f, 0.372029f, 0.371851f, 0.371673f, 0.371495f,
- 0.371317f, 0.371139f, 0.370961f, 0.370783f, 0.370605f, 0.370427f, 0.370249f, 0.370071f,
- 0.369892f, 0.369714f, 0.369536f, 0.369358f, 0.369180f, 0.369002f, 0.368823f, 0.368645f,
- 0.368467f, 0.368289f, 0.368110f, 0.367932f, 0.367754f, 0.367575f, 0.367397f, 0.367219f,
- 0.367040f, 0.366862f, 0.366684f, 0.366505f, 0.366327f, 0.366148f, 0.365970f, 0.365791f,
- 0.365613f, 0.365435f, 0.365256f, 0.365078f, 0.364899f, 0.364720f, 0.364542f, 0.364363f,
- 0.364185f, 0.364006f, 0.363828f, 0.363649f, 0.363470f, 0.363292f, 0.363113f, 0.362934f,
- 0.362756f, 0.362577f, 0.362398f, 0.362220f, 0.362041f, 0.361862f, 0.361683f, 0.361505f,
- 0.361326f, 0.361147f, 0.360968f, 0.360789f, 0.360611f, 0.360432f, 0.360253f, 0.360074f,
- 0.359895f, 0.359716f, 0.359537f, 0.359358f, 0.359179f, 0.359000f, 0.358821f, 0.358642f,
- 0.358463f, 0.358284f, 0.358105f, 0.357926f, 0.357747f, 0.357568f, 0.357389f, 0.357210f,
- 0.357031f, 0.356852f, 0.356673f, 0.356494f, 0.356314f, 0.356135f, 0.355956f, 0.355777f,
- 0.355598f, 0.355418f, 0.355239f, 0.355060f, 0.354881f, 0.354701f, 0.354522f, 0.354343f,
- 0.354164f, 0.353984f, 0.353805f, 0.353626f, 0.353446f, 0.353267f, 0.353087f, 0.352908f,
- 0.352729f, 0.352549f, 0.352370f, 0.352190f, 0.352011f, 0.351831f, 0.351652f, 0.351472f,
- 0.351293f, 0.351113f, 0.350934f, 0.350754f, 0.350575f, 0.350395f, 0.350215f, 0.350036f,
- 0.349856f, 0.349676f, 0.349497f, 0.349317f, 0.349138f, 0.348958f, 0.348778f, 0.348598f,
- 0.348419f, 0.348239f, 0.348059f, 0.347879f, 0.347700f, 0.347520f, 0.347340f, 0.347160f,
- 0.346980f, 0.346801f, 0.346621f, 0.346441f, 0.346261f, 0.346081f, 0.345901f, 0.345721f,
- 0.345541f, 0.345361f, 0.345181f, 0.345001f, 0.344821f, 0.344641f, 0.344461f, 0.344281f,
- 0.344101f, 0.343921f, 0.343741f, 0.343561f, 0.343381f, 0.343201f, 0.343021f, 0.342841f,
- 0.342661f, 0.342481f, 0.342300f, 0.342120f, 0.341940f, 0.341760f, 0.341580f, 0.341399f,
- 0.341219f, 0.341039f, 0.340859f, 0.340678f, 0.340498f, 0.340318f, 0.340138f, 0.339957f,
- 0.339777f, 0.339597f, 0.339416f, 0.339236f, 0.339055f, 0.338875f, 0.338695f, 0.338514f,
- 0.338334f, 0.338153f, 0.337973f, 0.337792f, 0.337612f, 0.337431f, 0.337251f, 0.337070f,
- 0.336890f, 0.336709f, 0.336529f, 0.336348f, 0.336168f, 0.335987f, 0.335806f, 0.335626f,
- 0.335445f, 0.335265f, 0.335084f, 0.334903f, 0.334722f, 0.334542f, 0.334361f, 0.334180f,
- 0.334000f, 0.333819f, 0.333638f, 0.333457f, 0.333277f, 0.333096f, 0.332915f, 0.332734f,
- 0.332553f, 0.332373f, 0.332192f, 0.332011f, 0.331830f, 0.331649f, 0.331468f, 0.331287f,
- 0.331106f, 0.330925f, 0.330744f, 0.330563f, 0.330382f, 0.330202f, 0.330020f, 0.329839f,
- 0.329658f, 0.329477f, 0.329296f, 0.329115f, 0.328934f, 0.328753f, 0.328572f, 0.328391f,
- 0.328210f, 0.328029f, 0.327848f, 0.327666f, 0.327485f, 0.327304f, 0.327123f, 0.326942f,
- 0.326760f, 0.326579f, 0.326398f, 0.326217f, 0.326035f, 0.325854f, 0.325673f, 0.325492f,
- 0.325310f, 0.325129f, 0.324948f, 0.324766f, 0.324585f, 0.324404f, 0.324222f, 0.324041f,
- 0.323859f, 0.323678f, 0.323497f, 0.323315f, 0.323134f, 0.322952f, 0.322771f, 0.322589f,
- 0.322408f, 0.322226f, 0.322045f, 0.321863f, 0.321682f, 0.321500f, 0.321318f, 0.321137f,
- 0.320955f, 0.320774f, 0.320592f, 0.320410f, 0.320229f, 0.320047f, 0.319865f, 0.319684f,
- 0.319502f, 0.319320f, 0.319139f, 0.318957f, 0.318775f, 0.318593f, 0.318412f, 0.318230f,
- 0.318048f, 0.317866f, 0.317684f, 0.317503f, 0.317321f, 0.317139f, 0.316957f, 0.316775f,
- 0.316593f, 0.316411f, 0.316230f, 0.316048f, 0.315866f, 0.315684f, 0.315502f, 0.315320f,
- 0.315138f, 0.314956f, 0.314774f, 0.314592f, 0.314410f, 0.314228f, 0.314046f, 0.313864f,
- 0.313682f, 0.313500f, 0.313318f, 0.313135f, 0.312953f, 0.312771f, 0.312589f, 0.312407f,
- 0.312225f, 0.312043f, 0.311860f, 0.311678f, 0.311496f, 0.311314f, 0.311132f, 0.310949f,
- 0.310767f, 0.310585f, 0.310403f, 0.310220f, 0.310038f, 0.309856f, 0.309673f, 0.309491f,
- 0.309309f, 0.309126f, 0.308944f, 0.308762f, 0.308579f, 0.308397f, 0.308214f, 0.308032f,
- 0.307850f, 0.307667f, 0.307485f, 0.307302f, 0.307120f, 0.306937f, 0.306755f, 0.306572f,
- 0.306390f, 0.306207f, 0.306025f, 0.305842f, 0.305660f, 0.305477f, 0.305294f, 0.305112f,
- 0.304929f, 0.304747f, 0.304564f, 0.304381f, 0.304199f, 0.304016f, 0.303833f, 0.303651f,
- 0.303468f, 0.303285f, 0.303103f, 0.302920f, 0.302737f, 0.302554f, 0.302372f, 0.302189f,
- 0.302006f, 0.301823f, 0.301640f, 0.301458f, 0.301275f, 0.301092f, 0.300909f, 0.300726f,
- 0.300543f, 0.300360f, 0.300177f, 0.299995f, 0.299812f, 0.299629f, 0.299446f, 0.299263f,
- 0.299080f, 0.298897f, 0.298714f, 0.298531f, 0.298348f, 0.298165f, 0.297982f, 0.297799f,
- 0.297616f, 0.297433f, 0.297250f, 0.297066f, 0.296883f, 0.296700f, 0.296517f, 0.296334f,
- 0.296151f, 0.295968f, 0.295785f, 0.295601f, 0.295418f, 0.295235f, 0.295052f, 0.294869f,
- 0.294685f, 0.294502f, 0.294319f, 0.294136f, 0.293952f, 0.293769f, 0.293586f, 0.293402f,
- 0.293219f, 0.293036f, 0.292852f, 0.292669f, 0.292486f, 0.292302f, 0.292119f, 0.291936f,
- 0.291752f, 0.291569f, 0.291385f, 0.291202f, 0.291019f, 0.290835f, 0.290652f, 0.290468f,
- 0.290285f, 0.290101f, 0.289918f, 0.289734f, 0.289551f, 0.289367f, 0.289184f, 0.289000f,
- 0.288816f, 0.288633f, 0.288449f, 0.288266f, 0.288082f, 0.287898f, 0.287715f, 0.287531f,
- 0.287347f, 0.287164f, 0.286980f, 0.286796f, 0.286613f, 0.286429f, 0.286245f, 0.286062f,
- 0.285878f, 0.285694f, 0.285510f, 0.285327f, 0.285143f, 0.284959f, 0.284775f, 0.284591f,
- 0.284408f, 0.284224f, 0.284040f, 0.283856f, 0.283672f, 0.283488f, 0.283304f, 0.283120f,
- 0.282937f, 0.282753f, 0.282569f, 0.282385f, 0.282201f, 0.282017f, 0.281833f, 0.281649f,
- 0.281465f, 0.281281f, 0.281097f, 0.280913f, 0.280729f, 0.280545f, 0.280361f, 0.280177f,
- 0.279993f, 0.279809f, 0.279624f, 0.279440f, 0.279256f, 0.279072f, 0.278888f, 0.278704f,
- 0.278520f, 0.278336f, 0.278151f, 0.277967f, 0.277783f, 0.277599f, 0.277415f, 0.277230f,
- 0.277046f, 0.276862f, 0.276678f, 0.276493f, 0.276309f, 0.276125f, 0.275940f, 0.275756f,
- 0.275572f, 0.275387f, 0.275203f, 0.275019f, 0.274834f, 0.274650f, 0.274466f, 0.274281f,
- 0.274097f, 0.273912f, 0.273728f, 0.273544f, 0.273359f, 0.273175f, 0.272990f, 0.272806f,
- 0.272621f, 0.272437f, 0.272252f, 0.272068f, 0.271883f, 0.271699f, 0.271514f, 0.271330f,
- 0.271145f, 0.270961f, 0.270776f, 0.270591f, 0.270407f, 0.270222f, 0.270038f, 0.269853f,
- 0.269668f, 0.269484f, 0.269299f, 0.269114f, 0.268930f, 0.268745f, 0.268560f, 0.268376f,
- 0.268191f, 0.268006f, 0.267821f, 0.267637f, 0.267452f, 0.267267f, 0.267082f, 0.266898f,
- 0.266713f, 0.266528f, 0.266343f, 0.266158f, 0.265973f, 0.265789f, 0.265604f, 0.265419f,
- 0.265234f, 0.265049f, 0.264864f, 0.264679f, 0.264494f, 0.264309f, 0.264125f, 0.263940f,
- 0.263755f, 0.263570f, 0.263385f, 0.263200f, 0.263015f, 0.262830f, 0.262645f, 0.262460f,
- 0.262275f, 0.262090f, 0.261905f, 0.261720f, 0.261534f, 0.261349f, 0.261164f, 0.260979f,
- 0.260794f, 0.260609f, 0.260424f, 0.260239f, 0.260054f, 0.259868f, 0.259683f, 0.259498f,
- 0.259313f, 0.259128f, 0.258943f, 0.258757f, 0.258572f, 0.258387f, 0.258202f, 0.258016f,
- 0.257831f, 0.257646f, 0.257461f, 0.257275f, 0.257090f, 0.256905f, 0.256719f, 0.256534f,
- 0.256349f, 0.256163f, 0.255978f, 0.255793f, 0.255607f, 0.255422f, 0.255236f, 0.255051f,
- 0.254866f, 0.254680f, 0.254495f, 0.254309f, 0.254124f, 0.253938f, 0.253753f, 0.253568f,
- 0.253382f, 0.253197f, 0.253011f, 0.252826f, 0.252640f, 0.252454f, 0.252269f, 0.252083f,
- 0.251898f, 0.251712f, 0.251527f, 0.251341f, 0.251155f, 0.250970f, 0.250784f, 0.250599f,
- 0.250413f, 0.250227f, 0.250042f, 0.249856f, 0.249670f, 0.249485f, 0.249299f, 0.249113f,
- 0.248928f, 0.248742f, 0.248556f, 0.248370f, 0.248185f, 0.247999f, 0.247813f, 0.247627f,
- 0.247442f, 0.247256f, 0.247070f, 0.246884f, 0.246698f, 0.246513f, 0.246327f, 0.246141f,
- 0.245955f, 0.245769f, 0.245583f, 0.245397f, 0.245212f, 0.245026f, 0.244840f, 0.244654f,
- 0.244468f, 0.244282f, 0.244096f, 0.243910f, 0.243724f, 0.243538f, 0.243352f, 0.243166f,
- 0.242980f, 0.242794f, 0.242608f, 0.242422f, 0.242236f, 0.242050f, 0.241864f, 0.241678f,
- 0.241492f, 0.241306f, 0.241120f, 0.240934f, 0.240748f, 0.240561f, 0.240375f, 0.240189f,
- 0.240003f, 0.239817f, 0.239631f, 0.239445f, 0.239258f, 0.239072f, 0.238886f, 0.238700f,
- 0.238514f, 0.238327f, 0.238141f, 0.237955f, 0.237769f, 0.237582f, 0.237396f, 0.237210f,
- 0.237024f, 0.236837f, 0.236651f, 0.236465f, 0.236278f, 0.236092f, 0.235906f, 0.235719f,
- 0.235533f, 0.235347f, 0.235160f, 0.234974f, 0.234788f, 0.234601f, 0.234415f, 0.234228f,
- 0.234042f, 0.233856f, 0.233669f, 0.233483f, 0.233296f, 0.233110f, 0.232923f, 0.232737f,
- 0.232550f, 0.232364f, 0.232177f, 0.231991f, 0.231804f, 0.231618f, 0.231431f, 0.231245f,
- 0.231058f, 0.230872f, 0.230685f, 0.230498f, 0.230312f, 0.230125f, 0.229939f, 0.229752f,
- 0.229565f, 0.229379f, 0.229192f, 0.229005f, 0.228819f, 0.228632f, 0.228445f, 0.228259f,
- 0.228072f, 0.227885f, 0.227699f, 0.227512f, 0.227325f, 0.227139f, 0.226952f, 0.226765f,
- 0.226578f, 0.226391f, 0.226205f, 0.226018f, 0.225831f, 0.225644f, 0.225458f, 0.225271f,
- 0.225084f, 0.224897f, 0.224710f, 0.224523f, 0.224337f, 0.224150f, 0.223963f, 0.223776f,
- 0.223589f, 0.223402f, 0.223215f, 0.223028f, 0.222841f, 0.222654f, 0.222468f, 0.222281f,
- 0.222094f, 0.221907f, 0.221720f, 0.221533f, 0.221346f, 0.221159f, 0.220972f, 0.220785f,
- 0.220598f, 0.220411f, 0.220224f, 0.220037f, 0.219850f, 0.219662f, 0.219475f, 0.219288f,
- 0.219101f, 0.218914f, 0.218727f, 0.218540f, 0.218353f, 0.218166f, 0.217979f, 0.217791f,
- 0.217604f, 0.217417f, 0.217230f, 0.217043f, 0.216856f, 0.216668f, 0.216481f, 0.216294f,
- 0.216107f, 0.215920f, 0.215732f, 0.215545f, 0.215358f, 0.215171f, 0.214983f, 0.214796f,
- 0.214609f, 0.214422f, 0.214234f, 0.214047f, 0.213860f, 0.213672f, 0.213485f, 0.213298f,
- 0.213110f, 0.212923f, 0.212736f, 0.212548f, 0.212361f, 0.212174f, 0.211986f, 0.211799f,
- 0.211611f, 0.211424f, 0.211237f, 0.211049f, 0.210862f, 0.210674f, 0.210487f, 0.210299f,
- 0.210112f, 0.209924f, 0.209737f, 0.209549f, 0.209362f, 0.209174f, 0.208987f, 0.208799f,
- 0.208612f, 0.208424f, 0.208237f, 0.208049f, 0.207862f, 0.207674f, 0.207487f, 0.207299f,
- 0.207111f, 0.206924f, 0.206736f, 0.206549f, 0.206361f, 0.206173f, 0.205986f, 0.205798f,
- 0.205610f, 0.205423f, 0.205235f, 0.205047f, 0.204860f, 0.204672f, 0.204484f, 0.204297f,
- 0.204109f, 0.203921f, 0.203734f, 0.203546f, 0.203358f, 0.203170f, 0.202983f, 0.202795f,
- 0.202607f, 0.202419f, 0.202231f, 0.202044f, 0.201856f, 0.201668f, 0.201480f, 0.201292f,
- 0.201105f, 0.200917f, 0.200729f, 0.200541f, 0.200353f, 0.200165f, 0.199978f, 0.199790f,
- 0.199602f, 0.199414f, 0.199226f, 0.199038f, 0.198850f, 0.198662f, 0.198474f, 0.198286f,
- 0.198098f, 0.197910f, 0.197722f, 0.197535f, 0.197347f, 0.197159f, 0.196971f, 0.196783f,
- 0.196595f, 0.196407f, 0.196219f, 0.196031f, 0.195843f, 0.195654f, 0.195466f, 0.195278f,
- 0.195090f, 0.194902f, 0.194714f, 0.194526f, 0.194338f, 0.194150f, 0.193962f, 0.193774f,
- 0.193586f, 0.193397f, 0.193209f, 0.193021f, 0.192833f, 0.192645f, 0.192457f, 0.192269f,
- 0.192080f, 0.191892f, 0.191704f, 0.191516f, 0.191328f, 0.191139f, 0.190951f, 0.190763f,
- 0.190575f, 0.190387f, 0.190198f, 0.190010f, 0.189822f, 0.189634f, 0.189445f, 0.189257f,
- 0.189069f, 0.188880f, 0.188692f, 0.188504f, 0.188315f, 0.188127f, 0.187939f, 0.187750f,
- 0.187562f, 0.187374f, 0.187185f, 0.186997f, 0.186809f, 0.186620f, 0.186432f, 0.186244f,
- 0.186055f, 0.185867f, 0.185678f, 0.185490f, 0.185301f, 0.185113f, 0.184925f, 0.184736f,
- 0.184548f, 0.184359f, 0.184171f, 0.183982f, 0.183794f, 0.183605f, 0.183417f, 0.183228f,
- 0.183040f, 0.182851f, 0.182663f, 0.182474f, 0.182286f, 0.182097f, 0.181909f, 0.181720f,
- 0.181532f, 0.181343f, 0.181154f, 0.180966f, 0.180777f, 0.180589f, 0.180400f, 0.180212f,
- 0.180023f, 0.179834f, 0.179646f, 0.179457f, 0.179268f, 0.179080f, 0.178891f, 0.178702f,
- 0.178514f, 0.178325f, 0.178136f, 0.177948f, 0.177759f, 0.177570f, 0.177382f, 0.177193f,
- 0.177004f, 0.176815f, 0.176627f, 0.176438f, 0.176249f, 0.176061f, 0.175872f, 0.175683f,
- 0.175494f, 0.175305f, 0.175117f, 0.174928f, 0.174739f, 0.174550f, 0.174362f, 0.174173f,
- 0.173984f, 0.173795f, 0.173606f, 0.173417f, 0.173229f, 0.173040f, 0.172851f, 0.172662f,
- 0.172473f, 0.172284f, 0.172095f, 0.171906f, 0.171718f, 0.171529f, 0.171340f, 0.171151f,
- 0.170962f, 0.170773f, 0.170584f, 0.170395f, 0.170206f, 0.170017f, 0.169828f, 0.169639f,
- 0.169450f, 0.169261f, 0.169072f, 0.168883f, 0.168694f, 0.168505f, 0.168316f, 0.168127f,
- 0.167938f, 0.167749f, 0.167560f, 0.167371f, 0.167182f, 0.166993f, 0.166804f, 0.166615f,
- 0.166426f, 0.166237f, 0.166048f, 0.165859f, 0.165670f, 0.165480f, 0.165291f, 0.165102f,
- 0.164913f, 0.164724f, 0.164535f, 0.164346f, 0.164157f, 0.163967f, 0.163778f, 0.163589f,
- 0.163400f, 0.163211f, 0.163022f, 0.162832f, 0.162643f, 0.162454f, 0.162265f, 0.162076f,
- 0.161886f, 0.161697f, 0.161508f, 0.161319f, 0.161129f, 0.160940f, 0.160751f, 0.160562f,
- 0.160372f, 0.160183f, 0.159994f, 0.159805f, 0.159615f, 0.159426f, 0.159237f, 0.159047f,
- 0.158858f, 0.158669f, 0.158480f, 0.158290f, 0.158101f, 0.157912f, 0.157722f, 0.157533f,
- 0.157343f, 0.157154f, 0.156965f, 0.156775f, 0.156586f, 0.156397f, 0.156207f, 0.156018f,
- 0.155828f, 0.155639f, 0.155450f, 0.155260f, 0.155071f, 0.154881f, 0.154692f, 0.154502f,
- 0.154313f, 0.154124f, 0.153934f, 0.153745f, 0.153555f, 0.153366f, 0.153176f, 0.152987f,
- 0.152797f, 0.152608f, 0.152418f, 0.152229f, 0.152039f, 0.151850f, 0.151660f, 0.151471f,
- 0.151281f, 0.151092f, 0.150902f, 0.150712f, 0.150523f, 0.150333f, 0.150144f, 0.149954f,
- 0.149765f, 0.149575f, 0.149385f, 0.149196f, 0.149006f, 0.148817f, 0.148627f, 0.148437f,
- 0.148248f, 0.148058f, 0.147868f, 0.147679f, 0.147489f, 0.147299f, 0.147110f, 0.146920f,
- 0.146730f, 0.146541f, 0.146351f, 0.146161f, 0.145972f, 0.145782f, 0.145592f, 0.145403f,
- 0.145213f, 0.145023f, 0.144833f, 0.144644f, 0.144454f, 0.144264f, 0.144075f, 0.143885f,
- 0.143695f, 0.143505f, 0.143316f, 0.143126f, 0.142936f, 0.142746f, 0.142556f, 0.142367f,
- 0.142177f, 0.141987f, 0.141797f, 0.141607f, 0.141418f, 0.141228f, 0.141038f, 0.140848f,
- 0.140658f, 0.140468f, 0.140279f, 0.140089f, 0.139899f, 0.139709f, 0.139519f, 0.139329f,
- 0.139139f, 0.138949f, 0.138760f, 0.138570f, 0.138380f, 0.138190f, 0.138000f, 0.137810f,
- 0.137620f, 0.137430f, 0.137240f, 0.137050f, 0.136860f, 0.136670f, 0.136480f, 0.136291f,
- 0.136101f, 0.135911f, 0.135721f, 0.135531f, 0.135341f, 0.135151f, 0.134961f, 0.134771f,
- 0.134581f, 0.134391f, 0.134201f, 0.134011f, 0.133821f, 0.133631f, 0.133441f, 0.133251f,
- 0.133061f, 0.132870f, 0.132680f, 0.132490f, 0.132300f, 0.132110f, 0.131920f, 0.131730f,
- 0.131540f, 0.131350f, 0.131160f, 0.130970f, 0.130780f, 0.130590f, 0.130399f, 0.130209f,
- 0.130019f, 0.129829f, 0.129639f, 0.129449f, 0.129259f, 0.129069f, 0.128878f, 0.128688f,
- 0.128498f, 0.128308f, 0.128118f, 0.127928f, 0.127737f, 0.127547f, 0.127357f, 0.127167f,
- 0.126977f, 0.126787f, 0.126596f, 0.126406f, 0.126216f, 0.126026f, 0.125835f, 0.125645f,
- 0.125455f, 0.125265f, 0.125075f, 0.124884f, 0.124694f, 0.124504f, 0.124314f, 0.124123f,
- 0.123933f, 0.123743f, 0.123552f, 0.123362f, 0.123172f, 0.122982f, 0.122791f, 0.122601f,
- 0.122411f, 0.122220f, 0.122030f, 0.121840f, 0.121649f, 0.121459f, 0.121269f, 0.121078f,
- 0.120888f, 0.120698f, 0.120507f, 0.120317f, 0.120127f, 0.119936f, 0.119746f, 0.119556f,
- 0.119365f, 0.119175f, 0.118984f, 0.118794f, 0.118604f, 0.118413f, 0.118223f, 0.118032f,
- 0.117842f, 0.117652f, 0.117461f, 0.117271f, 0.117080f, 0.116890f, 0.116700f, 0.116509f,
- 0.116319f, 0.116128f, 0.115938f, 0.115747f, 0.115557f, 0.115366f, 0.115176f, 0.114985f,
- 0.114795f, 0.114604f, 0.114414f, 0.114223f, 0.114033f, 0.113842f, 0.113652f, 0.113461f,
- 0.113271f, 0.113080f, 0.112890f, 0.112699f, 0.112509f, 0.112318f, 0.112128f, 0.111937f,
- 0.111747f, 0.111556f, 0.111366f, 0.111175f, 0.110984f, 0.110794f, 0.110603f, 0.110413f,
- 0.110222f, 0.110032f, 0.109841f, 0.109650f, 0.109460f, 0.109269f, 0.109079f, 0.108888f,
- 0.108697f, 0.108507f, 0.108316f, 0.108126f, 0.107935f, 0.107744f, 0.107554f, 0.107363f,
- 0.107172f, 0.106982f, 0.106791f, 0.106600f, 0.106410f, 0.106219f, 0.106028f, 0.105838f,
- 0.105647f, 0.105456f, 0.105266f, 0.105075f, 0.104884f, 0.104694f, 0.104503f, 0.104312f,
- 0.104122f, 0.103931f, 0.103740f, 0.103550f, 0.103359f, 0.103168f, 0.102977f, 0.102787f,
- 0.102596f, 0.102405f, 0.102214f, 0.102024f, 0.101833f, 0.101642f, 0.101451f, 0.101261f,
- 0.101070f, 0.100879f, 0.100688f, 0.100498f, 0.100307f, 0.100116f, 0.099925f, 0.099734f,
- 0.099544f, 0.099353f, 0.099162f, 0.098971f, 0.098780f, 0.098590f, 0.098399f, 0.098208f,
- 0.098017f, 0.097826f, 0.097635f, 0.097445f, 0.097254f, 0.097063f, 0.096872f, 0.096681f,
- 0.096490f, 0.096300f, 0.096109f, 0.095918f, 0.095727f, 0.095536f, 0.095345f, 0.095154f,
- 0.094963f, 0.094773f, 0.094582f, 0.094391f, 0.094200f, 0.094009f, 0.093818f, 0.093627f,
- 0.093436f, 0.093245f, 0.093055f, 0.092864f, 0.092673f, 0.092482f, 0.092291f, 0.092100f,
- 0.091909f, 0.091718f, 0.091527f, 0.091336f, 0.091145f, 0.090954f, 0.090763f, 0.090572f,
- 0.090381f, 0.090190f, 0.089999f, 0.089808f, 0.089617f, 0.089427f, 0.089236f, 0.089045f,
- 0.088854f, 0.088663f, 0.088472f, 0.088281f, 0.088090f, 0.087899f, 0.087708f, 0.087517f,
- 0.087326f, 0.087135f, 0.086943f, 0.086752f, 0.086561f, 0.086370f, 0.086179f, 0.085988f,
- 0.085797f, 0.085606f, 0.085415f, 0.085224f, 0.085033f, 0.084842f, 0.084651f, 0.084460f,
- 0.084269f, 0.084078f, 0.083887f, 0.083696f, 0.083505f, 0.083314f, 0.083122f, 0.082931f,
- 0.082740f, 0.082549f, 0.082358f, 0.082167f, 0.081976f, 0.081785f, 0.081594f, 0.081403f,
- 0.081211f, 0.081020f, 0.080829f, 0.080638f, 0.080447f, 0.080256f, 0.080065f, 0.079874f,
- 0.079682f, 0.079491f, 0.079300f, 0.079109f, 0.078918f, 0.078727f, 0.078536f, 0.078344f,
- 0.078153f, 0.077962f, 0.077771f, 0.077580f, 0.077389f, 0.077197f, 0.077006f, 0.076815f,
- 0.076624f, 0.076433f, 0.076241f, 0.076050f, 0.075859f, 0.075668f, 0.075477f, 0.075286f,
- 0.075094f, 0.074903f, 0.074712f, 0.074521f, 0.074329f, 0.074138f, 0.073947f, 0.073756f,
- 0.073565f, 0.073373f, 0.073182f, 0.072991f, 0.072800f, 0.072608f, 0.072417f, 0.072226f,
- 0.072035f, 0.071843f, 0.071652f, 0.071461f, 0.071270f, 0.071078f, 0.070887f, 0.070696f,
- 0.070505f, 0.070313f, 0.070122f, 0.069931f, 0.069739f, 0.069548f, 0.069357f, 0.069166f,
- 0.068974f, 0.068783f, 0.068592f, 0.068400f, 0.068209f, 0.068018f, 0.067827f, 0.067635f,
- 0.067444f, 0.067253f, 0.067061f, 0.066870f, 0.066679f, 0.066487f, 0.066296f, 0.066105f,
- 0.065913f, 0.065722f, 0.065531f, 0.065339f, 0.065148f, 0.064957f, 0.064765f, 0.064574f,
- 0.064383f, 0.064191f, 0.064000f, 0.063809f, 0.063617f, 0.063426f, 0.063234f, 0.063043f,
- 0.062852f, 0.062660f, 0.062469f, 0.062278f, 0.062086f, 0.061895f, 0.061704f, 0.061512f,
- 0.061321f, 0.061129f, 0.060938f, 0.060747f, 0.060555f, 0.060364f, 0.060172f, 0.059981f,
- 0.059790f, 0.059598f, 0.059407f, 0.059215f, 0.059024f, 0.058833f, 0.058641f, 0.058450f,
- 0.058258f, 0.058067f, 0.057875f, 0.057684f, 0.057493f, 0.057301f, 0.057110f, 0.056918f,
- 0.056727f, 0.056535f, 0.056344f, 0.056152f, 0.055961f, 0.055770f, 0.055578f, 0.055387f,
- 0.055195f, 0.055004f, 0.054812f, 0.054621f, 0.054429f, 0.054238f, 0.054046f, 0.053855f,
- 0.053664f, 0.053472f, 0.053281f, 0.053089f, 0.052898f, 0.052706f, 0.052515f, 0.052323f,
- 0.052132f, 0.051940f, 0.051749f, 0.051557f, 0.051366f, 0.051174f, 0.050983f, 0.050791f,
- 0.050600f, 0.050408f, 0.050217f, 0.050025f, 0.049834f, 0.049642f, 0.049451f, 0.049259f,
- 0.049068f, 0.048876f, 0.048685f, 0.048493f, 0.048302f, 0.048110f, 0.047919f, 0.047727f,
- 0.047535f, 0.047344f, 0.047152f, 0.046961f, 0.046769f, 0.046578f, 0.046386f, 0.046195f,
- 0.046003f, 0.045812f, 0.045620f, 0.045429f, 0.045237f, 0.045045f, 0.044854f, 0.044662f,
- 0.044471f, 0.044279f, 0.044088f, 0.043896f, 0.043705f, 0.043513f, 0.043321f, 0.043130f,
- 0.042938f, 0.042747f, 0.042555f, 0.042364f, 0.042172f, 0.041980f, 0.041789f, 0.041597f,
- 0.041406f, 0.041214f, 0.041022f, 0.040831f, 0.040639f, 0.040448f, 0.040256f, 0.040065f,
- 0.039873f, 0.039681f, 0.039490f, 0.039298f, 0.039107f, 0.038915f, 0.038723f, 0.038532f,
- 0.038340f, 0.038149f, 0.037957f, 0.037765f, 0.037574f, 0.037382f, 0.037190f, 0.036999f,
- 0.036807f, 0.036616f, 0.036424f, 0.036232f, 0.036041f, 0.035849f, 0.035657f, 0.035466f,
- 0.035274f, 0.035083f, 0.034891f, 0.034699f, 0.034508f, 0.034316f, 0.034124f, 0.033933f,
- 0.033741f, 0.033550f, 0.033358f, 0.033166f, 0.032975f, 0.032783f, 0.032591f, 0.032400f,
- 0.032208f, 0.032016f, 0.031825f, 0.031633f, 0.031441f, 0.031250f, 0.031058f, 0.030866f,
- 0.030675f, 0.030483f, 0.030291f, 0.030100f, 0.029908f, 0.029717f, 0.029525f, 0.029333f,
- 0.029142f, 0.028950f, 0.028758f, 0.028567f, 0.028375f, 0.028183f, 0.027991f, 0.027800f,
- 0.027608f, 0.027416f, 0.027225f, 0.027033f, 0.026841f, 0.026650f, 0.026458f, 0.026266f,
- 0.026075f, 0.025883f, 0.025691f, 0.025500f, 0.025308f, 0.025116f, 0.024925f, 0.024733f,
- 0.024541f, 0.024350f, 0.024158f, 0.023966f, 0.023774f, 0.023583f, 0.023391f, 0.023199f,
- 0.023008f, 0.022816f, 0.022624f, 0.022433f, 0.022241f, 0.022049f, 0.021857f, 0.021666f,
- 0.021474f, 0.021282f, 0.021091f, 0.020899f, 0.020707f, 0.020516f, 0.020324f, 0.020132f,
- 0.019940f, 0.019749f, 0.019557f, 0.019365f, 0.019174f, 0.018982f, 0.018790f, 0.018598f,
- 0.018407f, 0.018215f, 0.018023f, 0.017832f, 0.017640f, 0.017448f, 0.017256f, 0.017065f,
- 0.016873f, 0.016681f, 0.016490f, 0.016298f, 0.016106f, 0.015914f, 0.015723f, 0.015531f,
- 0.015339f, 0.015147f, 0.014956f, 0.014764f, 0.014572f, 0.014381f, 0.014189f, 0.013997f,
- 0.013805f, 0.013614f, 0.013422f, 0.013230f, 0.013038f, 0.012847f, 0.012655f, 0.012463f,
- 0.012272f, 0.012080f, 0.011888f, 0.011696f, 0.011505f, 0.011313f, 0.011121f, 0.010929f,
- 0.010738f, 0.010546f, 0.010354f, 0.010162f, 0.009971f, 0.009779f, 0.009587f, 0.009395f,
- 0.009204f, 0.009012f, 0.008820f, 0.008629f, 0.008437f, 0.008245f, 0.008053f, 0.007862f,
- 0.007670f, 0.007478f, 0.007286f, 0.007095f, 0.006903f, 0.006711f, 0.006519f, 0.006328f,
- 0.006136f, 0.005944f, 0.005752f, 0.005561f, 0.005369f, 0.005177f, 0.004985f, 0.004794f,
- 0.004602f, 0.004410f, 0.004218f, 0.004027f, 0.003835f, 0.003643f, 0.003451f, 0.003260f,
- 0.003068f, 0.002876f, 0.002684f, 0.002493f, 0.002301f, 0.002109f, 0.001917f, 0.001726f,
- 0.001534f, 0.001342f, 0.001150f, 0.000959f, 0.000767f, 0.000575f, 0.000383f, 0.000192f,
- 0.000000f, 0.000192f, 0.000383f, 0.000575f, 0.000767f, 0.000959f, 0.001150f, 0.001342f,
- 0.001534f, 0.001726f, 0.001917f, 0.002109f, 0.002301f, 0.002493f, 0.002684f, 0.002876f,
- 0.003068f, 0.003260f, 0.003451f, 0.003643f, 0.003835f, 0.004027f, 0.004218f, 0.004410f,
- 0.004602f, 0.004794f, 0.004985f, 0.005177f, 0.005369f, 0.005561f, 0.005752f, 0.005944f,
- 0.006136f, 0.006328f, 0.006519f, 0.006711f, 0.006903f, 0.007095f, 0.007286f, 0.007478f,
- 0.007670f, 0.007862f, 0.008053f, 0.008245f, 0.008437f, 0.008629f, 0.008820f, 0.009012f,
- 0.009204f, 0.009395f, 0.009587f, 0.009779f, 0.009971f, 0.010162f, 0.010354f, 0.010546f,
- 0.010738f, 0.010929f, 0.011121f, 0.011313f, 0.011505f, 0.011696f, 0.011888f, 0.012080f,
- 0.012272f, 0.012463f, 0.012655f, 0.012847f, 0.013038f, 0.013230f, 0.013422f, 0.013614f,
- 0.013805f, 0.013997f, 0.014189f, 0.014381f, 0.014572f, 0.014764f, 0.014956f, 0.015147f,
- 0.015339f, 0.015531f, 0.015723f, 0.015914f, 0.016106f, 0.016298f, 0.016490f, 0.016681f,
- 0.016873f, 0.017065f, 0.017256f, 0.017448f, 0.017640f, 0.017832f, 0.018023f, 0.018215f,
- 0.018407f, 0.018598f, 0.018790f, 0.018982f, 0.019174f, 0.019365f, 0.019557f, 0.019749f,
- 0.019940f, 0.020132f, 0.020324f, 0.020516f, 0.020707f, 0.020899f, 0.021091f, 0.021282f,
- 0.021474f, 0.021666f, 0.021857f, 0.022049f, 0.022241f, 0.022433f, 0.022624f, 0.022816f,
- 0.023008f, 0.023199f, 0.023391f, 0.023583f, 0.023774f, 0.023966f, 0.024158f, 0.024350f,
- 0.024541f, 0.024733f, 0.024925f, 0.025116f, 0.025308f, 0.025500f, 0.025691f, 0.025883f,
- 0.026075f, 0.026266f, 0.026458f, 0.026650f, 0.026841f, 0.027033f, 0.027225f, 0.027416f,
- 0.027608f, 0.027800f, 0.027991f, 0.028183f, 0.028375f, 0.028567f, 0.028758f, 0.028950f,
- 0.029142f, 0.029333f, 0.029525f, 0.029717f, 0.029908f, 0.030100f, 0.030291f, 0.030483f,
- 0.030675f, 0.030866f, 0.031058f, 0.031250f, 0.031441f, 0.031633f, 0.031825f, 0.032016f,
- 0.032208f, 0.032400f, 0.032591f, 0.032783f, 0.032975f, 0.033166f, 0.033358f, 0.033550f,
- 0.033741f, 0.033933f, 0.034124f, 0.034316f, 0.034508f, 0.034699f, 0.034891f, 0.035083f,
- 0.035274f, 0.035466f, 0.035657f, 0.035849f, 0.036041f, 0.036232f, 0.036424f, 0.036616f,
- 0.036807f, 0.036999f, 0.037190f, 0.037382f, 0.037574f, 0.037765f, 0.037957f, 0.038149f,
- 0.038340f, 0.038532f, 0.038723f, 0.038915f, 0.039107f, 0.039298f, 0.039490f, 0.039681f,
- 0.039873f, 0.040065f, 0.040256f, 0.040448f, 0.040639f, 0.040831f, 0.041022f, 0.041214f,
- 0.041406f, 0.041597f, 0.041789f, 0.041980f, 0.042172f, 0.042364f, 0.042555f, 0.042747f,
- 0.042938f, 0.043130f, 0.043321f, 0.043513f, 0.043705f, 0.043896f, 0.044088f, 0.044279f,
- 0.044471f, 0.044662f, 0.044854f, 0.045045f, 0.045237f, 0.045429f, 0.045620f, 0.045812f,
- 0.046003f, 0.046195f, 0.046386f, 0.046578f, 0.046769f, 0.046961f, 0.047152f, 0.047344f,
- 0.047535f, 0.047727f, 0.047919f, 0.048110f, 0.048302f, 0.048493f, 0.048685f, 0.048876f,
- 0.049068f, 0.049259f, 0.049451f, 0.049642f, 0.049834f, 0.050025f, 0.050217f, 0.050408f,
- 0.050600f, 0.050791f, 0.050983f, 0.051174f, 0.051366f, 0.051557f, 0.051749f, 0.051940f,
- 0.052132f, 0.052323f, 0.052515f, 0.052706f, 0.052898f, 0.053089f, 0.053281f, 0.053472f,
- 0.053664f, 0.053855f, 0.054046f, 0.054238f, 0.054429f, 0.054621f, 0.054812f, 0.055004f,
- 0.055195f, 0.055387f, 0.055578f, 0.055770f, 0.055961f, 0.056152f, 0.056344f, 0.056535f,
- 0.056727f, 0.056918f, 0.057110f, 0.057301f, 0.057493f, 0.057684f, 0.057875f, 0.058067f,
- 0.058258f, 0.058450f, 0.058641f, 0.058833f, 0.059024f, 0.059215f, 0.059407f, 0.059598f,
- 0.059790f, 0.059981f, 0.060172f, 0.060364f, 0.060555f, 0.060747f, 0.060938f, 0.061129f,
- 0.061321f, 0.061512f, 0.061704f, 0.061895f, 0.062086f, 0.062278f, 0.062469f, 0.062660f,
- 0.062852f, 0.063043f, 0.063234f, 0.063426f, 0.063617f, 0.063809f, 0.064000f, 0.064191f,
- 0.064383f, 0.064574f, 0.064765f, 0.064957f, 0.065148f, 0.065339f, 0.065531f, 0.065722f,
- 0.065913f, 0.066105f, 0.066296f, 0.066487f, 0.066679f, 0.066870f, 0.067061f, 0.067253f,
- 0.067444f, 0.067635f, 0.067827f, 0.068018f, 0.068209f, 0.068400f, 0.068592f, 0.068783f,
- 0.068974f, 0.069166f, 0.069357f, 0.069548f, 0.069739f, 0.069931f, 0.070122f, 0.070313f,
- 0.070505f, 0.070696f, 0.070887f, 0.071078f, 0.071270f, 0.071461f, 0.071652f, 0.071843f,
- 0.072035f, 0.072226f, 0.072417f, 0.072608f, 0.072800f, 0.072991f, 0.073182f, 0.073373f,
- 0.073565f, 0.073756f, 0.073947f, 0.074138f, 0.074329f, 0.074521f, 0.074712f, 0.074903f,
- 0.075094f, 0.075286f, 0.075477f, 0.075668f, 0.075859f, 0.076050f, 0.076241f, 0.076433f,
- 0.076624f, 0.076815f, 0.077006f, 0.077197f, 0.077389f, 0.077580f, 0.077771f, 0.077962f,
- 0.078153f, 0.078344f, 0.078536f, 0.078727f, 0.078918f, 0.079109f, 0.079300f, 0.079491f,
- 0.079682f, 0.079874f, 0.080065f, 0.080256f, 0.080447f, 0.080638f, 0.080829f, 0.081020f,
- 0.081211f, 0.081403f, 0.081594f, 0.081785f, 0.081976f, 0.082167f, 0.082358f, 0.082549f,
- 0.082740f, 0.082931f, 0.083122f, 0.083314f, 0.083505f, 0.083696f, 0.083887f, 0.084078f,
- 0.084269f, 0.084460f, 0.084651f, 0.084842f, 0.085033f, 0.085224f, 0.085415f, 0.085606f,
- 0.085797f, 0.085988f, 0.086179f, 0.086370f, 0.086561f, 0.086752f, 0.086943f, 0.087135f,
- 0.087326f, 0.087517f, 0.087708f, 0.087899f, 0.088090f, 0.088281f, 0.088472f, 0.088663f,
- 0.088854f, 0.089045f, 0.089236f, 0.089427f, 0.089617f, 0.089808f, 0.089999f, 0.090190f,
- 0.090381f, 0.090572f, 0.090763f, 0.090954f, 0.091145f, 0.091336f, 0.091527f, 0.091718f,
- 0.091909f, 0.092100f, 0.092291f, 0.092482f, 0.092673f, 0.092864f, 0.093055f, 0.093245f,
- 0.093436f, 0.093627f, 0.093818f, 0.094009f, 0.094200f, 0.094391f, 0.094582f, 0.094773f,
- 0.094963f, 0.095154f, 0.095345f, 0.095536f, 0.095727f, 0.095918f, 0.096109f, 0.096300f,
- 0.096490f, 0.096681f, 0.096872f, 0.097063f, 0.097254f, 0.097445f, 0.097635f, 0.097826f,
- 0.098017f, 0.098208f, 0.098399f, 0.098590f, 0.098780f, 0.098971f, 0.099162f, 0.099353f,
- 0.099544f, 0.099734f, 0.099925f, 0.100116f, 0.100307f, 0.100498f, 0.100688f, 0.100879f,
- 0.101070f, 0.101261f, 0.101451f, 0.101642f, 0.101833f, 0.102024f, 0.102214f, 0.102405f,
- 0.102596f, 0.102787f, 0.102977f, 0.103168f, 0.103359f, 0.103550f, 0.103740f, 0.103931f,
- 0.104122f, 0.104312f, 0.104503f, 0.104694f, 0.104884f, 0.105075f, 0.105266f, 0.105456f,
- 0.105647f, 0.105838f, 0.106028f, 0.106219f, 0.106410f, 0.106600f, 0.106791f, 0.106982f,
- 0.107172f, 0.107363f, 0.107554f, 0.107744f, 0.107935f, 0.108126f, 0.108316f, 0.108507f,
- 0.108697f, 0.108888f, 0.109079f, 0.109269f, 0.109460f, 0.109650f, 0.109841f, 0.110032f,
- 0.110222f, 0.110413f, 0.110603f, 0.110794f, 0.110984f, 0.111175f, 0.111366f, 0.111556f,
- 0.111747f, 0.111937f, 0.112128f, 0.112318f, 0.112509f, 0.112699f, 0.112890f, 0.113080f,
- 0.113271f, 0.113461f, 0.113652f, 0.113842f, 0.114033f, 0.114223f, 0.114414f, 0.114604f,
- 0.114795f, 0.114985f, 0.115176f, 0.115366f, 0.115557f, 0.115747f, 0.115938f, 0.116128f,
- 0.116319f, 0.116509f, 0.116700f, 0.116890f, 0.117080f, 0.117271f, 0.117461f, 0.117652f,
- 0.117842f, 0.118032f, 0.118223f, 0.118413f, 0.118604f, 0.118794f, 0.118984f, 0.119175f,
- 0.119365f, 0.119556f, 0.119746f, 0.119936f, 0.120127f, 0.120317f, 0.120507f, 0.120698f,
- 0.120888f, 0.121078f, 0.121269f, 0.121459f, 0.121649f, 0.121840f, 0.122030f, 0.122220f,
- 0.122411f, 0.122601f, 0.122791f, 0.122982f, 0.123172f, 0.123362f, 0.123552f, 0.123743f,
- 0.123933f, 0.124123f, 0.124314f, 0.124504f, 0.124694f, 0.124884f, 0.125075f, 0.125265f,
- 0.125455f, 0.125645f, 0.125835f, 0.126026f, 0.126216f, 0.126406f, 0.126596f, 0.126787f,
- 0.126977f, 0.127167f, 0.127357f, 0.127547f, 0.127737f, 0.127928f, 0.128118f, 0.128308f,
- 0.128498f, 0.128688f, 0.128878f, 0.129069f, 0.129259f, 0.129449f, 0.129639f, 0.129829f,
- 0.130019f, 0.130209f, 0.130399f, 0.130590f, 0.130780f, 0.130970f, 0.131160f, 0.131350f,
- 0.131540f, 0.131730f, 0.131920f, 0.132110f, 0.132300f, 0.132490f, 0.132680f, 0.132870f,
- 0.133061f, 0.133251f, 0.133441f, 0.133631f, 0.133821f, 0.134011f, 0.134201f, 0.134391f,
- 0.134581f, 0.134771f, 0.134961f, 0.135151f, 0.135341f, 0.135531f, 0.135721f, 0.135911f,
- 0.136101f, 0.136291f, 0.136480f, 0.136670f, 0.136860f, 0.137050f, 0.137240f, 0.137430f,
- 0.137620f, 0.137810f, 0.138000f, 0.138190f, 0.138380f, 0.138570f, 0.138760f, 0.138949f,
- 0.139139f, 0.139329f, 0.139519f, 0.139709f, 0.139899f, 0.140089f, 0.140279f, 0.140468f,
- 0.140658f, 0.140848f, 0.141038f, 0.141228f, 0.141418f, 0.141607f, 0.141797f, 0.141987f,
- 0.142177f, 0.142367f, 0.142556f, 0.142746f, 0.142936f, 0.143126f, 0.143316f, 0.143505f,
- 0.143695f, 0.143885f, 0.144075f, 0.144264f, 0.144454f, 0.144644f, 0.144833f, 0.145023f,
- 0.145213f, 0.145403f, 0.145592f, 0.145782f, 0.145972f, 0.146161f, 0.146351f, 0.146541f,
- 0.146730f, 0.146920f, 0.147110f, 0.147299f, 0.147489f, 0.147679f, 0.147868f, 0.148058f,
- 0.148248f, 0.148437f, 0.148627f, 0.148817f, 0.149006f, 0.149196f, 0.149385f, 0.149575f,
- 0.149765f, 0.149954f, 0.150144f, 0.150333f, 0.150523f, 0.150712f, 0.150902f, 0.151092f,
- 0.151281f, 0.151471f, 0.151660f, 0.151850f, 0.152039f, 0.152229f, 0.152418f, 0.152608f,
- 0.152797f, 0.152987f, 0.153176f, 0.153366f, 0.153555f, 0.153745f, 0.153934f, 0.154124f,
- 0.154313f, 0.154502f, 0.154692f, 0.154881f, 0.155071f, 0.155260f, 0.155450f, 0.155639f,
- 0.155828f, 0.156018f, 0.156207f, 0.156397f, 0.156586f, 0.156775f, 0.156965f, 0.157154f,
- 0.157343f, 0.157533f, 0.157722f, 0.157912f, 0.158101f, 0.158290f, 0.158480f, 0.158669f,
- 0.158858f, 0.159047f, 0.159237f, 0.159426f, 0.159615f, 0.159805f, 0.159994f, 0.160183f,
- 0.160372f, 0.160562f, 0.160751f, 0.160940f, 0.161129f, 0.161319f, 0.161508f, 0.161697f,
- 0.161886f, 0.162076f, 0.162265f, 0.162454f, 0.162643f, 0.162832f, 0.163022f, 0.163211f,
- 0.163400f, 0.163589f, 0.163778f, 0.163967f, 0.164157f, 0.164346f, 0.164535f, 0.164724f,
- 0.164913f, 0.165102f, 0.165291f, 0.165480f, 0.165670f, 0.165859f, 0.166048f, 0.166237f,
- 0.166426f, 0.166615f, 0.166804f, 0.166993f, 0.167182f, 0.167371f, 0.167560f, 0.167749f,
- 0.167938f, 0.168127f, 0.168316f, 0.168505f, 0.168694f, 0.168883f, 0.169072f, 0.169261f,
- 0.169450f, 0.169639f, 0.169828f, 0.170017f, 0.170206f, 0.170395f, 0.170584f, 0.170773f,
- 0.170962f, 0.171151f, 0.171340f, 0.171529f, 0.171718f, 0.171906f, 0.172095f, 0.172284f,
- 0.172473f, 0.172662f, 0.172851f, 0.173040f, 0.173229f, 0.173417f, 0.173606f, 0.173795f,
- 0.173984f, 0.174173f, 0.174362f, 0.174550f, 0.174739f, 0.174928f, 0.175117f, 0.175305f,
- 0.175494f, 0.175683f, 0.175872f, 0.176061f, 0.176249f, 0.176438f, 0.176627f, 0.176815f,
- 0.177004f, 0.177193f, 0.177382f, 0.177570f, 0.177759f, 0.177948f, 0.178136f, 0.178325f,
- 0.178514f, 0.178702f, 0.178891f, 0.179080f, 0.179268f, 0.179457f, 0.179646f, 0.179834f,
- 0.180023f, 0.180212f, 0.180400f, 0.180589f, 0.180777f, 0.180966f, 0.181154f, 0.181343f,
- 0.181532f, 0.181720f, 0.181909f, 0.182097f, 0.182286f, 0.182474f, 0.182663f, 0.182851f,
- 0.183040f, 0.183228f, 0.183417f, 0.183605f, 0.183794f, 0.183982f, 0.184171f, 0.184359f,
- 0.184548f, 0.184736f, 0.184925f, 0.185113f, 0.185301f, 0.185490f, 0.185678f, 0.185867f,
- 0.186055f, 0.186244f, 0.186432f, 0.186620f, 0.186809f, 0.186997f, 0.187185f, 0.187374f,
- 0.187562f, 0.187750f, 0.187939f, 0.188127f, 0.188315f, 0.188504f, 0.188692f, 0.188880f,
- 0.189069f, 0.189257f, 0.189445f, 0.189634f, 0.189822f, 0.190010f, 0.190198f, 0.190387f,
- 0.190575f, 0.190763f, 0.190951f, 0.191139f, 0.191328f, 0.191516f, 0.191704f, 0.191892f,
- 0.192080f, 0.192269f, 0.192457f, 0.192645f, 0.192833f, 0.193021f, 0.193209f, 0.193397f,
- 0.193586f, 0.193774f, 0.193962f, 0.194150f, 0.194338f, 0.194526f, 0.194714f, 0.194902f,
- 0.195090f, 0.195278f, 0.195466f, 0.195654f, 0.195843f, 0.196031f, 0.196219f, 0.196407f,
- 0.196595f, 0.196783f, 0.196971f, 0.197159f, 0.197347f, 0.197535f, 0.197722f, 0.197910f,
- 0.198098f, 0.198286f, 0.198474f, 0.198662f, 0.198850f, 0.199038f, 0.199226f, 0.199414f,
- 0.199602f, 0.199790f, 0.199978f, 0.200165f, 0.200353f, 0.200541f, 0.200729f, 0.200917f,
- 0.201105f, 0.201292f, 0.201480f, 0.201668f, 0.201856f, 0.202044f, 0.202231f, 0.202419f,
- 0.202607f, 0.202795f, 0.202983f, 0.203170f, 0.203358f, 0.203546f, 0.203734f, 0.203921f,
- 0.204109f, 0.204297f, 0.204484f, 0.204672f, 0.204860f, 0.205047f, 0.205235f, 0.205423f,
- 0.205610f, 0.205798f, 0.205986f, 0.206173f, 0.206361f, 0.206549f, 0.206736f, 0.206924f,
- 0.207111f, 0.207299f, 0.207487f, 0.207674f, 0.207862f, 0.208049f, 0.208237f, 0.208424f,
- 0.208612f, 0.208799f, 0.208987f, 0.209174f, 0.209362f, 0.209549f, 0.209737f, 0.209924f,
- 0.210112f, 0.210299f, 0.210487f, 0.210674f, 0.210862f, 0.211049f, 0.211237f, 0.211424f,
- 0.211611f, 0.211799f, 0.211986f, 0.212174f, 0.212361f, 0.212548f, 0.212736f, 0.212923f,
- 0.213110f, 0.213298f, 0.213485f, 0.213672f, 0.213860f, 0.214047f, 0.214234f, 0.214422f,
- 0.214609f, 0.214796f, 0.214983f, 0.215171f, 0.215358f, 0.215545f, 0.215732f, 0.215920f,
- 0.216107f, 0.216294f, 0.216481f, 0.216668f, 0.216856f, 0.217043f, 0.217230f, 0.217417f,
- 0.217604f, 0.217791f, 0.217979f, 0.218166f, 0.218353f, 0.218540f, 0.218727f, 0.218914f,
- 0.219101f, 0.219288f, 0.219475f, 0.219662f, 0.219850f, 0.220037f, 0.220224f, 0.220411f,
- 0.220598f, 0.220785f, 0.220972f, 0.221159f, 0.221346f, 0.221533f, 0.221720f, 0.221907f,
- 0.222094f, 0.222281f, 0.222468f, 0.222654f, 0.222841f, 0.223028f, 0.223215f, 0.223402f,
- 0.223589f, 0.223776f, 0.223963f, 0.224150f, 0.224337f, 0.224523f, 0.224710f, 0.224897f,
- 0.225084f, 0.225271f, 0.225458f, 0.225644f, 0.225831f, 0.226018f, 0.226205f, 0.226391f,
- 0.226578f, 0.226765f, 0.226952f, 0.227139f, 0.227325f, 0.227512f, 0.227699f, 0.227885f,
- 0.228072f, 0.228259f, 0.228445f, 0.228632f, 0.228819f, 0.229005f, 0.229192f, 0.229379f,
- 0.229565f, 0.229752f, 0.229939f, 0.230125f, 0.230312f, 0.230498f, 0.230685f, 0.230872f,
- 0.231058f, 0.231245f, 0.231431f, 0.231618f, 0.231804f, 0.231991f, 0.232177f, 0.232364f,
- 0.232550f, 0.232737f, 0.232923f, 0.233110f, 0.233296f, 0.233483f, 0.233669f, 0.233856f,
- 0.234042f, 0.234228f, 0.234415f, 0.234601f, 0.234788f, 0.234974f, 0.235160f, 0.235347f,
- 0.235533f, 0.235719f, 0.235906f, 0.236092f, 0.236278f, 0.236465f, 0.236651f, 0.236837f,
- 0.237024f, 0.237210f, 0.237396f, 0.237582f, 0.237769f, 0.237955f, 0.238141f, 0.238327f,
- 0.238514f, 0.238700f, 0.238886f, 0.239072f, 0.239258f, 0.239445f, 0.239631f, 0.239817f,
- 0.240003f, 0.240189f, 0.240375f, 0.240561f, 0.240748f, 0.240934f, 0.241120f, 0.241306f,
- 0.241492f, 0.241678f, 0.241864f, 0.242050f, 0.242236f, 0.242422f, 0.242608f, 0.242794f,
- 0.242980f, 0.243166f, 0.243352f, 0.243538f, 0.243724f, 0.243910f, 0.244096f, 0.244282f,
- 0.244468f, 0.244654f, 0.244840f, 0.245026f, 0.245212f, 0.245397f, 0.245583f, 0.245769f,
- 0.245955f, 0.246141f, 0.246327f, 0.246513f, 0.246698f, 0.246884f, 0.247070f, 0.247256f,
- 0.247442f, 0.247627f, 0.247813f, 0.247999f, 0.248185f, 0.248370f, 0.248556f, 0.248742f,
- 0.248928f, 0.249113f, 0.249299f, 0.249485f, 0.249670f, 0.249856f, 0.250042f, 0.250227f,
- 0.250413f, 0.250599f, 0.250784f, 0.250970f, 0.251155f, 0.251341f, 0.251527f, 0.251712f,
- 0.251898f, 0.252083f, 0.252269f, 0.252454f, 0.252640f, 0.252826f, 0.253011f, 0.253197f,
- 0.253382f, 0.253568f, 0.253753f, 0.253938f, 0.254124f, 0.254309f, 0.254495f, 0.254680f,
- 0.254866f, 0.255051f, 0.255236f, 0.255422f, 0.255607f, 0.255793f, 0.255978f, 0.256163f,
- 0.256349f, 0.256534f, 0.256719f, 0.256905f, 0.257090f, 0.257275f, 0.257461f, 0.257646f,
- 0.257831f, 0.258016f, 0.258202f, 0.258387f, 0.258572f, 0.258757f, 0.258943f, 0.259128f,
- 0.259313f, 0.259498f, 0.259683f, 0.259868f, 0.260054f, 0.260239f, 0.260424f, 0.260609f,
- 0.260794f, 0.260979f, 0.261164f, 0.261349f, 0.261534f, 0.261720f, 0.261905f, 0.262090f,
- 0.262275f, 0.262460f, 0.262645f, 0.262830f, 0.263015f, 0.263200f, 0.263385f, 0.263570f,
- 0.263755f, 0.263940f, 0.264125f, 0.264309f, 0.264494f, 0.264679f, 0.264864f, 0.265049f,
- 0.265234f, 0.265419f, 0.265604f, 0.265789f, 0.265973f, 0.266158f, 0.266343f, 0.266528f,
- 0.266713f, 0.266898f, 0.267082f, 0.267267f, 0.267452f, 0.267637f, 0.267821f, 0.268006f,
- 0.268191f, 0.268376f, 0.268560f, 0.268745f, 0.268930f, 0.269114f, 0.269299f, 0.269484f,
- 0.269668f, 0.269853f, 0.270038f, 0.270222f, 0.270407f, 0.270591f, 0.270776f, 0.270961f,
- 0.271145f, 0.271330f, 0.271514f, 0.271699f, 0.271883f, 0.272068f, 0.272252f, 0.272437f,
- 0.272621f, 0.272806f, 0.272990f, 0.273175f, 0.273359f, 0.273544f, 0.273728f, 0.273912f,
- 0.274097f, 0.274281f, 0.274466f, 0.274650f, 0.274834f, 0.275019f, 0.275203f, 0.275387f,
- 0.275572f, 0.275756f, 0.275940f, 0.276125f, 0.276309f, 0.276493f, 0.276678f, 0.276862f,
- 0.277046f, 0.277230f, 0.277415f, 0.277599f, 0.277783f, 0.277967f, 0.278151f, 0.278336f,
- 0.278520f, 0.278704f, 0.278888f, 0.279072f, 0.279256f, 0.279440f, 0.279624f, 0.279809f,
- 0.279993f, 0.280177f, 0.280361f, 0.280545f, 0.280729f, 0.280913f, 0.281097f, 0.281281f,
- 0.281465f, 0.281649f, 0.281833f, 0.282017f, 0.282201f, 0.282385f, 0.282569f, 0.282753f,
- 0.282937f, 0.283120f, 0.283304f, 0.283488f, 0.283672f, 0.283856f, 0.284040f, 0.284224f,
- 0.284408f, 0.284591f, 0.284775f, 0.284959f, 0.285143f, 0.285327f, 0.285510f, 0.285694f,
- 0.285878f, 0.286062f, 0.286245f, 0.286429f, 0.286613f, 0.286796f, 0.286980f, 0.287164f,
- 0.287347f, 0.287531f, 0.287715f, 0.287898f, 0.288082f, 0.288266f, 0.288449f, 0.288633f,
- 0.288816f, 0.289000f, 0.289184f, 0.289367f, 0.289551f, 0.289734f, 0.289918f, 0.290101f,
- 0.290285f, 0.290468f, 0.290652f, 0.290835f, 0.291019f, 0.291202f, 0.291385f, 0.291569f,
- 0.291752f, 0.291936f, 0.292119f, 0.292302f, 0.292486f, 0.292669f, 0.292852f, 0.293036f,
- 0.293219f, 0.293402f, 0.293586f, 0.293769f, 0.293952f, 0.294136f, 0.294319f, 0.294502f,
- 0.294685f, 0.294869f, 0.295052f, 0.295235f, 0.295418f, 0.295601f, 0.295785f, 0.295968f,
- 0.296151f, 0.296334f, 0.296517f, 0.296700f, 0.296883f, 0.297066f, 0.297250f, 0.297433f,
- 0.297616f, 0.297799f, 0.297982f, 0.298165f, 0.298348f, 0.298531f, 0.298714f, 0.298897f,
- 0.299080f, 0.299263f, 0.299446f, 0.299629f, 0.299812f, 0.299995f, 0.300177f, 0.300360f,
- 0.300543f, 0.300726f, 0.300909f, 0.301092f, 0.301275f, 0.301458f, 0.301640f, 0.301823f,
- 0.302006f, 0.302189f, 0.302372f, 0.302554f, 0.302737f, 0.302920f, 0.303103f, 0.303285f,
- 0.303468f, 0.303651f, 0.303833f, 0.304016f, 0.304199f, 0.304381f, 0.304564f, 0.304747f,
- 0.304929f, 0.305112f, 0.305294f, 0.305477f, 0.305660f, 0.305842f, 0.306025f, 0.306207f,
- 0.306390f, 0.306572f, 0.306755f, 0.306937f, 0.307120f, 0.307302f, 0.307485f, 0.307667f,
- 0.307850f, 0.308032f, 0.308214f, 0.308397f, 0.308579f, 0.308762f, 0.308944f, 0.309126f,
- 0.309309f, 0.309491f, 0.309673f, 0.309856f, 0.310038f, 0.310220f, 0.310403f, 0.310585f,
- 0.310767f, 0.310949f, 0.311132f, 0.311314f, 0.311496f, 0.311678f, 0.311860f, 0.312043f,
- 0.312225f, 0.312407f, 0.312589f, 0.312771f, 0.312953f, 0.313135f, 0.313318f, 0.313500f,
- 0.313682f, 0.313864f, 0.314046f, 0.314228f, 0.314410f, 0.314592f, 0.314774f, 0.314956f,
- 0.315138f, 0.315320f, 0.315502f, 0.315684f, 0.315866f, 0.316048f, 0.316230f, 0.316411f,
- 0.316593f, 0.316775f, 0.316957f, 0.317139f, 0.317321f, 0.317503f, 0.317684f, 0.317866f,
- 0.318048f, 0.318230f, 0.318412f, 0.318593f, 0.318775f, 0.318957f, 0.319139f, 0.319320f,
- 0.319502f, 0.319684f, 0.319865f, 0.320047f, 0.320229f, 0.320410f, 0.320592f, 0.320774f,
- 0.320955f, 0.321137f, 0.321318f, 0.321500f, 0.321682f, 0.321863f, 0.322045f, 0.322226f,
- 0.322408f, 0.322589f, 0.322771f, 0.322952f, 0.323134f, 0.323315f, 0.323497f, 0.323678f,
- 0.323859f, 0.324041f, 0.324222f, 0.324404f, 0.324585f, 0.324766f, 0.324948f, 0.325129f,
- 0.325310f, 0.325492f, 0.325673f, 0.325854f, 0.326035f, 0.326217f, 0.326398f, 0.326579f,
- 0.326760f, 0.326942f, 0.327123f, 0.327304f, 0.327485f, 0.327666f, 0.327848f, 0.328029f,
- 0.328210f, 0.328391f, 0.328572f, 0.328753f, 0.328934f, 0.329115f, 0.329296f, 0.329477f,
- 0.329658f, 0.329839f, 0.330020f, 0.330202f, 0.330382f, 0.330563f, 0.330744f, 0.330925f,
- 0.331106f, 0.331287f, 0.331468f, 0.331649f, 0.331830f, 0.332011f, 0.332192f, 0.332373f,
- 0.332553f, 0.332734f, 0.332915f, 0.333096f, 0.333277f, 0.333457f, 0.333638f, 0.333819f,
- 0.334000f, 0.334180f, 0.334361f, 0.334542f, 0.334722f, 0.334903f, 0.335084f, 0.335265f,
- 0.335445f, 0.335626f, 0.335806f, 0.335987f, 0.336168f, 0.336348f, 0.336529f, 0.336709f,
- 0.336890f, 0.337070f, 0.337251f, 0.337431f, 0.337612f, 0.337792f, 0.337973f, 0.338153f,
- 0.338334f, 0.338514f, 0.338695f, 0.338875f, 0.339055f, 0.339236f, 0.339416f, 0.339597f,
- 0.339777f, 0.339957f, 0.340138f, 0.340318f, 0.340498f, 0.340678f, 0.340859f, 0.341039f,
- 0.341219f, 0.341399f, 0.341580f, 0.341760f, 0.341940f, 0.342120f, 0.342300f, 0.342481f,
- 0.342661f, 0.342841f, 0.343021f, 0.343201f, 0.343381f, 0.343561f, 0.343741f, 0.343921f,
- 0.344101f, 0.344281f, 0.344461f, 0.344641f, 0.344821f, 0.345001f, 0.345181f, 0.345361f,
- 0.345541f, 0.345721f, 0.345901f, 0.346081f, 0.346261f, 0.346441f, 0.346621f, 0.346801f,
- 0.346980f, 0.347160f, 0.347340f, 0.347520f, 0.347700f, 0.347879f, 0.348059f, 0.348239f,
- 0.348419f, 0.348598f, 0.348778f, 0.348958f, 0.349138f, 0.349317f, 0.349497f, 0.349676f,
- 0.349856f, 0.350036f, 0.350215f, 0.350395f, 0.350575f, 0.350754f, 0.350934f, 0.351113f,
- 0.351293f, 0.351472f, 0.351652f, 0.351831f, 0.352011f, 0.352190f, 0.352370f, 0.352549f,
- 0.352729f, 0.352908f, 0.353087f, 0.353267f, 0.353446f, 0.353626f, 0.353805f, 0.353984f,
- 0.354164f, 0.354343f, 0.354522f, 0.354701f, 0.354881f, 0.355060f, 0.355239f, 0.355418f,
- 0.355598f, 0.355777f, 0.355956f, 0.356135f, 0.356314f, 0.356494f, 0.356673f, 0.356852f,
- 0.357031f, 0.357210f, 0.357389f, 0.357568f, 0.357747f, 0.357926f, 0.358105f, 0.358284f,
- 0.358463f, 0.358642f, 0.358821f, 0.359000f, 0.359179f, 0.359358f, 0.359537f, 0.359716f,
- 0.359895f, 0.360074f, 0.360253f, 0.360432f, 0.360611f, 0.360789f, 0.360968f, 0.361147f,
- 0.361326f, 0.361505f, 0.361683f, 0.361862f, 0.362041f, 0.362220f, 0.362398f, 0.362577f,
- 0.362756f, 0.362934f, 0.363113f, 0.363292f, 0.363470f, 0.363649f, 0.363828f, 0.364006f,
- 0.364185f, 0.364363f, 0.364542f, 0.364720f, 0.364899f, 0.365078f, 0.365256f, 0.365435f,
- 0.365613f, 0.365791f, 0.365970f, 0.366148f, 0.366327f, 0.366505f, 0.366684f, 0.366862f,
- 0.367040f, 0.367219f, 0.367397f, 0.367575f, 0.367754f, 0.367932f, 0.368110f, 0.368289f,
- 0.368467f, 0.368645f, 0.368823f, 0.369002f, 0.369180f, 0.369358f, 0.369536f, 0.369714f,
- 0.369892f, 0.370071f, 0.370249f, 0.370427f, 0.370605f, 0.370783f, 0.370961f, 0.371139f,
- 0.371317f, 0.371495f, 0.371673f, 0.371851f, 0.372029f, 0.372207f, 0.372385f, 0.372563f,
- 0.372741f, 0.372919f, 0.373097f, 0.373275f, 0.373453f, 0.373631f, 0.373808f, 0.373986f,
- 0.374164f, 0.374342f, 0.374520f, 0.374697f, 0.374875f, 0.375053f, 0.375231f, 0.375408f,
- 0.375586f, 0.375764f, 0.375942f, 0.376119f, 0.376297f, 0.376475f, 0.376652f, 0.376830f,
- 0.377007f, 0.377185f, 0.377363f, 0.377540f, 0.377718f, 0.377895f, 0.378073f, 0.378250f,
- 0.378428f, 0.378605f, 0.378783f, 0.378960f, 0.379138f, 0.379315f, 0.379492f, 0.379670f,
- 0.379847f, 0.380025f, 0.380202f, 0.380379f, 0.380557f, 0.380734f, 0.380911f, 0.381088f,
- 0.381266f, 0.381443f, 0.381620f, 0.381797f, 0.381975f, 0.382152f, 0.382329f, 0.382506f,
- 0.382683f, 0.382861f, 0.383038f, 0.383215f, 0.383392f, 0.383569f, 0.383746f, 0.383923f,
- 0.384100f, 0.384277f, 0.384454f, 0.384631f, 0.384808f, 0.384985f, 0.385162f, 0.385339f,
- 0.385516f, 0.385693f, 0.385870f, 0.386047f, 0.386224f, 0.386400f, 0.386577f, 0.386754f,
- 0.386931f, 0.387108f, 0.387285f, 0.387461f, 0.387638f, 0.387815f, 0.387992f, 0.388168f,
- 0.388345f, 0.388522f, 0.388698f, 0.388875f, 0.389052f, 0.389228f, 0.389405f, 0.389582f,
- 0.389758f, 0.389935f, 0.390111f, 0.390288f, 0.390464f, 0.390641f, 0.390817f, 0.390994f,
- 0.391170f, 0.391347f, 0.391523f, 0.391700f, 0.391876f, 0.392053f, 0.392229f, 0.392405f,
- 0.392582f, 0.392758f, 0.392934f, 0.393111f, 0.393287f, 0.393463f, 0.393640f, 0.393816f,
- 0.393992f, 0.394168f, 0.394344f, 0.394521f, 0.394697f, 0.394873f, 0.395049f, 0.395225f,
- 0.395401f, 0.395578f, 0.395754f, 0.395930f, 0.396106f, 0.396282f, 0.396458f, 0.396634f,
- 0.396810f, 0.396986f, 0.397162f, 0.397338f, 0.397514f, 0.397690f, 0.397866f, 0.398042f,
- 0.398218f, 0.398393f, 0.398569f, 0.398745f, 0.398921f, 0.399097f, 0.399273f, 0.399448f,
- 0.399624f, 0.399800f, 0.399976f, 0.400151f, 0.400327f, 0.400503f, 0.400679f, 0.400854f,
- 0.401030f, 0.401206f, 0.401381f, 0.401557f, 0.401732f, 0.401908f, 0.402084f, 0.402259f,
- 0.402435f, 0.402610f, 0.402786f, 0.402961f, 0.403137f, 0.403312f, 0.403488f, 0.403663f,
- 0.403838f, 0.404014f, 0.404189f, 0.404365f, 0.404540f, 0.404715f, 0.404891f, 0.405066f,
- 0.405241f, 0.405417f, 0.405592f, 0.405767f, 0.405942f, 0.406118f, 0.406293f, 0.406468f,
- 0.406643f, 0.406818f, 0.406994f, 0.407169f, 0.407344f, 0.407519f, 0.407694f, 0.407869f,
- 0.408044f, 0.408219f, 0.408394f, 0.408569f, 0.408744f, 0.408919f, 0.409094f, 0.409269f,
- 0.409444f, 0.409619f, 0.409794f, 0.409969f, 0.410144f, 0.410319f, 0.410493f, 0.410668f,
- 0.410843f, 0.411018f, 0.411193f, 0.411368f, 0.411542f, 0.411717f, 0.411892f, 0.412067f,
- 0.412241f, 0.412416f, 0.412591f, 0.412765f, 0.412940f, 0.413115f, 0.413289f, 0.413464f,
- 0.413638f, 0.413813f, 0.413987f, 0.414162f, 0.414337f, 0.414511f, 0.414685f, 0.414860f,
- 0.415034f, 0.415209f, 0.415383f, 0.415558f, 0.415732f, 0.415906f, 0.416081f, 0.416255f,
- 0.416430f, 0.416604f, 0.416778f, 0.416952f, 0.417127f, 0.417301f, 0.417475f, 0.417650f,
- 0.417824f, 0.417998f, 0.418172f, 0.418346f, 0.418520f, 0.418695f, 0.418869f, 0.419043f,
- 0.419217f, 0.419391f, 0.419565f, 0.419739f, 0.419913f, 0.420087f, 0.420261f, 0.420435f,
- 0.420609f, 0.420783f, 0.420957f, 0.421131f, 0.421305f, 0.421479f, 0.421653f, 0.421826f,
- 0.422000f, 0.422174f, 0.422348f, 0.422522f, 0.422695f, 0.422869f, 0.423043f, 0.423217f,
- 0.423390f, 0.423564f, 0.423738f, 0.423912f, 0.424085f, 0.424259f, 0.424432f, 0.424606f,
- 0.424780f, 0.424953f, 0.425127f, 0.425300f, 0.425474f, 0.425647f, 0.425821f, 0.425994f,
- 0.426168f, 0.426341f, 0.426515f, 0.426688f, 0.426862f, 0.427035f, 0.427208f, 0.427382f,
- 0.427555f, 0.427728f, 0.427902f, 0.428075f, 0.428248f, 0.428422f, 0.428595f, 0.428768f,
- 0.428941f, 0.429114f, 0.429288f, 0.429461f, 0.429634f, 0.429807f, 0.429980f, 0.430153f,
- 0.430326f, 0.430500f, 0.430673f, 0.430846f, 0.431019f, 0.431192f, 0.431365f, 0.431538f,
- 0.431711f, 0.431884f, 0.432057f, 0.432229f, 0.432402f, 0.432575f, 0.432748f, 0.432921f,
- 0.433094f, 0.433267f, 0.433439f, 0.433612f, 0.433785f, 0.433958f, 0.434131f, 0.434303f,
- 0.434476f, 0.434649f, 0.434821f, 0.434994f, 0.435167f, 0.435339f, 0.435512f, 0.435685f,
- 0.435857f, 0.436030f, 0.436202f, 0.436375f, 0.436547f, 0.436720f, 0.436892f, 0.437065f,
- 0.437237f, 0.437410f, 0.437582f, 0.437754f, 0.437927f, 0.438099f, 0.438272f, 0.438444f,
- 0.438616f, 0.438789f, 0.438961f, 0.439133f, 0.439305f, 0.439478f, 0.439650f, 0.439822f,
- 0.439994f, 0.440166f, 0.440339f, 0.440511f, 0.440683f, 0.440855f, 0.441027f, 0.441199f,
- 0.441371f, 0.441543f, 0.441715f, 0.441887f, 0.442059f, 0.442231f, 0.442403f, 0.442575f,
- 0.442747f, 0.442919f, 0.443091f, 0.443263f, 0.443435f, 0.443607f, 0.443779f, 0.443950f,
- 0.444122f, 0.444294f, 0.444466f, 0.444637f, 0.444809f, 0.444981f, 0.445153f, 0.445324f,
- 0.445496f, 0.445668f, 0.445839f, 0.446011f, 0.446183f, 0.446354f, 0.446526f, 0.446697f,
- 0.446869f, 0.447040f, 0.447212f, 0.447383f, 0.447555f, 0.447726f, 0.447898f, 0.448069f,
- 0.448241f, 0.448412f, 0.448583f, 0.448755f, 0.448926f, 0.449097f, 0.449269f, 0.449440f,
- 0.449611f, 0.449783f, 0.449954f, 0.450125f, 0.450296f, 0.450467f, 0.450639f, 0.450810f,
- 0.450981f, 0.451152f, 0.451323f, 0.451494f, 0.451665f, 0.451836f, 0.452008f, 0.452179f,
- 0.452350f, 0.452521f, 0.452692f, 0.452863f, 0.453033f, 0.453204f, 0.453375f, 0.453546f,
- 0.453717f, 0.453888f, 0.454059f, 0.454230f, 0.454400f, 0.454571f, 0.454742f, 0.454913f,
- 0.455084f, 0.455254f, 0.455425f, 0.455596f, 0.455766f, 0.455937f, 0.456108f, 0.456278f,
- 0.456449f, 0.456620f, 0.456790f, 0.456961f, 0.457131f, 0.457302f, 0.457472f, 0.457643f,
- 0.457813f, 0.457984f, 0.458154f, 0.458325f, 0.458495f, 0.458665f, 0.458836f, 0.459006f,
- 0.459177f, 0.459347f, 0.459517f, 0.459687f, 0.459858f, 0.460028f, 0.460198f, 0.460369f,
- 0.460539f, 0.460709f, 0.460879f, 0.461049f, 0.461219f, 0.461390f, 0.461560f, 0.461730f,
- 0.461900f, 0.462070f, 0.462240f, 0.462410f, 0.462580f, 0.462750f, 0.462920f, 0.463090f,
- 0.463260f, 0.463430f, 0.463600f, 0.463769f, 0.463939f, 0.464109f, 0.464279f, 0.464449f,
- 0.464619f, 0.464788f, 0.464958f, 0.465128f, 0.465298f, 0.465467f, 0.465637f, 0.465807f,
- 0.465977f, 0.466146f, 0.466316f, 0.466485f, 0.466655f, 0.466825f, 0.466994f, 0.467164f,
- 0.467333f, 0.467503f, 0.467672f, 0.467842f, 0.468011f, 0.468181f, 0.468350f, 0.468519f,
- 0.468689f, 0.468858f, 0.469028f, 0.469197f, 0.469366f, 0.469536f, 0.469705f, 0.469874f,
- 0.470043f, 0.470213f, 0.470382f, 0.470551f, 0.470720f, 0.470889f, 0.471058f, 0.471228f,
- 0.471397f, 0.471566f, 0.471735f, 0.471904f, 0.472073f, 0.472242f, 0.472411f, 0.472580f,
- 0.472749f, 0.472918f, 0.473087f, 0.473256f, 0.473425f, 0.473594f, 0.473763f, 0.473931f,
- 0.474100f, 0.474269f, 0.474438f, 0.474607f, 0.474775f, 0.474944f, 0.475113f, 0.475282f,
- 0.475450f, 0.475619f, 0.475788f, 0.475956f, 0.476125f, 0.476294f, 0.476462f, 0.476631f,
- 0.476799f, 0.476968f, 0.477136f, 0.477305f, 0.477473f, 0.477642f, 0.477810f, 0.477979f,
- 0.478147f, 0.478315f, 0.478484f, 0.478652f, 0.478821f, 0.478989f, 0.479157f, 0.479325f,
- 0.479494f, 0.479662f, 0.479830f, 0.479998f, 0.480167f, 0.480335f, 0.480503f, 0.480671f,
- 0.480839f, 0.481007f, 0.481176f, 0.481344f, 0.481512f, 0.481680f, 0.481848f, 0.482016f,
- 0.482184f, 0.482352f, 0.482520f, 0.482688f, 0.482856f, 0.483023f, 0.483191f, 0.483359f,
- 0.483527f, 0.483695f, 0.483863f, 0.484031f, 0.484198f, 0.484366f, 0.484534f, 0.484702f,
- 0.484869f, 0.485037f, 0.485205f, 0.485372f, 0.485540f, 0.485708f, 0.485875f, 0.486043f,
- 0.486210f, 0.486378f, 0.486545f, 0.486713f, 0.486880f, 0.487048f, 0.487215f, 0.487383f,
- 0.487550f, 0.487718f, 0.487885f, 0.488052f, 0.488220f, 0.488387f, 0.488554f, 0.488722f,
- 0.488889f, 0.489056f, 0.489223f, 0.489391f, 0.489558f, 0.489725f, 0.489892f, 0.490059f,
- 0.490226f, 0.490394f, 0.490561f, 0.490728f, 0.490895f, 0.491062f, 0.491229f, 0.491396f,
- 0.491563f, 0.491730f, 0.491897f, 0.492064f, 0.492231f, 0.492398f, 0.492564f, 0.492731f,
- 0.492898f, 0.493065f, 0.493232f, 0.493399f, 0.493565f, 0.493732f, 0.493899f, 0.494066f,
- 0.494232f, 0.494399f, 0.494566f, 0.494732f, 0.494899f, 0.495066f, 0.495232f, 0.495399f,
- 0.495565f, 0.495732f, 0.495898f, 0.496065f, 0.496231f, 0.496398f, 0.496564f, 0.496731f,
- 0.496897f, 0.497063f, 0.497230f, 0.497396f, 0.497562f, 0.497729f, 0.497895f, 0.498061f,
- 0.498228f, 0.498394f, 0.498560f, 0.498726f, 0.498893f, 0.499059f, 0.499225f, 0.499391f,
- 0.499557f, 0.499723f, 0.499889f, 0.500055f, 0.500221f, 0.500387f, 0.500553f, 0.500719f,
- 0.500885f, 0.501051f, 0.501217f, 0.501383f, 0.501549f, 0.501715f, 0.501881f, 0.502047f,
- 0.502212f, 0.502378f, 0.502544f, 0.502710f, 0.502876f, 0.503041f, 0.503207f, 0.503373f,
- 0.503538f, 0.503704f, 0.503870f, 0.504035f, 0.504201f, 0.504366f, 0.504532f, 0.504698f,
- 0.504863f, 0.505029f, 0.505194f, 0.505360f, 0.505525f, 0.505690f, 0.505856f, 0.506021f,
- 0.506187f, 0.506352f, 0.506517f, 0.506683f, 0.506848f, 0.507013f, 0.507179f, 0.507344f,
- 0.507509f, 0.507674f, 0.507839f, 0.508005f, 0.508170f, 0.508335f, 0.508500f, 0.508665f,
- 0.508830f, 0.508995f, 0.509160f, 0.509325f, 0.509490f, 0.509655f, 0.509820f, 0.509985f,
- 0.510150f, 0.510315f, 0.510480f, 0.510645f, 0.510810f, 0.510974f, 0.511139f, 0.511304f,
- 0.511469f, 0.511634f, 0.511798f, 0.511963f, 0.512128f, 0.512292f, 0.512457f, 0.512622f,
- 0.512786f, 0.512951f, 0.513116f, 0.513280f, 0.513445f, 0.513609f, 0.513774f, 0.513938f,
- 0.514103f, 0.514267f, 0.514432f, 0.514596f, 0.514760f, 0.514925f, 0.515089f, 0.515254f,
- 0.515418f, 0.515582f, 0.515746f, 0.515911f, 0.516075f, 0.516239f, 0.516403f, 0.516568f,
- 0.516732f, 0.516896f, 0.517060f, 0.517224f, 0.517388f, 0.517552f, 0.517716f, 0.517880f,
- 0.518045f, 0.518209f, 0.518372f, 0.518536f, 0.518700f, 0.518864f, 0.519028f, 0.519192f,
- 0.519356f, 0.519520f, 0.519684f, 0.519848f, 0.520011f, 0.520175f, 0.520339f, 0.520503f,
- 0.520666f, 0.520830f, 0.520994f, 0.521157f, 0.521321f, 0.521485f, 0.521648f, 0.521812f,
- 0.521975f, 0.522139f, 0.522302f, 0.522466f, 0.522629f, 0.522793f, 0.522956f, 0.523120f,
- 0.523283f, 0.523447f, 0.523610f, 0.523773f, 0.523937f, 0.524100f, 0.524263f, 0.524426f,
- 0.524590f, 0.524753f, 0.524916f, 0.525079f, 0.525243f, 0.525406f, 0.525569f, 0.525732f,
- 0.525895f, 0.526058f, 0.526221f, 0.526384f, 0.526547f, 0.526710f, 0.526873f, 0.527036f,
- 0.527199f, 0.527362f, 0.527525f, 0.527688f, 0.527851f, 0.528014f, 0.528176f, 0.528339f,
- 0.528502f, 0.528665f, 0.528828f, 0.528990f, 0.529153f, 0.529316f, 0.529478f, 0.529641f,
- 0.529804f, 0.529966f, 0.530129f, 0.530291f, 0.530454f, 0.530617f, 0.530779f, 0.530942f,
- 0.531104f, 0.531266f, 0.531429f, 0.531591f, 0.531754f, 0.531916f, 0.532078f, 0.532241f,
- 0.532403f, 0.532565f, 0.532728f, 0.532890f, 0.533052f, 0.533214f, 0.533377f, 0.533539f,
- 0.533701f, 0.533863f, 0.534025f, 0.534187f, 0.534349f, 0.534512f, 0.534674f, 0.534836f,
- 0.534998f, 0.535160f, 0.535322f, 0.535484f, 0.535645f, 0.535807f, 0.535969f, 0.536131f,
- 0.536293f, 0.536455f, 0.536617f, 0.536778f, 0.536940f, 0.537102f, 0.537264f, 0.537425f,
- 0.537587f, 0.537749f, 0.537910f, 0.538072f, 0.538234f, 0.538395f, 0.538557f, 0.538718f,
- 0.538880f, 0.539041f, 0.539203f, 0.539364f, 0.539526f, 0.539687f, 0.539849f, 0.540010f,
- 0.540171f, 0.540333f, 0.540494f, 0.540655f, 0.540817f, 0.540978f, 0.541139f, 0.541301f,
- 0.541462f, 0.541623f, 0.541784f, 0.541945f, 0.542106f, 0.542268f, 0.542429f, 0.542590f,
- 0.542751f, 0.542912f, 0.543073f, 0.543234f, 0.543395f, 0.543556f, 0.543717f, 0.543878f,
- 0.544039f, 0.544199f, 0.544360f, 0.544521f, 0.544682f, 0.544843f, 0.545003f, 0.545164f,
- 0.545325f, 0.545486f, 0.545646f, 0.545807f, 0.545968f, 0.546128f, 0.546289f, 0.546450f,
- 0.546610f, 0.546771f, 0.546931f, 0.547092f, 0.547252f, 0.547413f, 0.547573f, 0.547734f,
- 0.547894f, 0.548054f, 0.548215f, 0.548375f, 0.548536f, 0.548696f, 0.548856f, 0.549016f,
- 0.549177f, 0.549337f, 0.549497f, 0.549657f, 0.549818f, 0.549978f, 0.550138f, 0.550298f,
- 0.550458f, 0.550618f, 0.550778f, 0.550938f, 0.551098f, 0.551258f, 0.551418f, 0.551578f,
- 0.551738f, 0.551898f, 0.552058f, 0.552218f, 0.552378f, 0.552537f, 0.552697f, 0.552857f,
- 0.553017f, 0.553176f, 0.553336f, 0.553496f, 0.553656f, 0.553815f, 0.553975f, 0.554134f,
- 0.554294f, 0.554454f, 0.554613f, 0.554773f, 0.554932f, 0.555092f, 0.555251f, 0.555411f,
- 0.555570f, 0.555730f, 0.555889f, 0.556048f, 0.556208f, 0.556367f, 0.556526f, 0.556686f,
- 0.556845f, 0.557004f, 0.557164f, 0.557323f, 0.557482f, 0.557641f, 0.557800f, 0.557959f,
- 0.558119f, 0.558278f, 0.558437f, 0.558596f, 0.558755f, 0.558914f, 0.559073f, 0.559232f,
- 0.559391f, 0.559550f, 0.559709f, 0.559867f, 0.560026f, 0.560185f, 0.560344f, 0.560503f,
- 0.560662f, 0.560820f, 0.560979f, 0.561138f, 0.561297f, 0.561455f, 0.561614f, 0.561773f,
- 0.561931f, 0.562090f, 0.562248f, 0.562407f, 0.562565f, 0.562724f, 0.562882f, 0.563041f,
- 0.563199f, 0.563358f, 0.563516f, 0.563675f, 0.563833f, 0.563991f, 0.564150f, 0.564308f,
- 0.564466f, 0.564624f, 0.564783f, 0.564941f, 0.565099f, 0.565257f, 0.565416f, 0.565574f,
- 0.565732f, 0.565890f, 0.566048f, 0.566206f, 0.566364f, 0.566522f, 0.566680f, 0.566838f,
- 0.566996f, 0.567154f, 0.567312f, 0.567470f, 0.567628f, 0.567786f, 0.567943f, 0.568101f,
- 0.568259f, 0.568417f, 0.568574f, 0.568732f, 0.568890f, 0.569048f, 0.569205f, 0.569363f,
- 0.569521f, 0.569678f, 0.569836f, 0.569993f, 0.570151f, 0.570308f, 0.570466f, 0.570623f,
- 0.570781f, 0.570938f, 0.571096f, 0.571253f, 0.571410f, 0.571568f, 0.571725f, 0.571882f,
- 0.572040f, 0.572197f, 0.572354f, 0.572511f, 0.572669f, 0.572826f, 0.572983f, 0.573140f,
- 0.573297f, 0.573454f, 0.573611f, 0.573768f, 0.573925f, 0.574082f, 0.574239f, 0.574396f,
- 0.574553f, 0.574710f, 0.574867f, 0.575024f, 0.575181f, 0.575338f, 0.575495f, 0.575651f,
- 0.575808f, 0.575965f, 0.576122f, 0.576278f, 0.576435f, 0.576592f, 0.576748f, 0.576905f,
- 0.577062f, 0.577218f, 0.577375f, 0.577531f, 0.577688f, 0.577844f, 0.578001f, 0.578157f,
- 0.578314f, 0.578470f, 0.578627f, 0.578783f, 0.578939f, 0.579096f, 0.579252f, 0.579408f,
- 0.579565f, 0.579721f, 0.579877f, 0.580033f, 0.580189f, 0.580346f, 0.580502f, 0.580658f,
- 0.580814f, 0.580970f, 0.581126f, 0.581282f, 0.581438f, 0.581594f, 0.581750f, 0.581906f,
- 0.582062f, 0.582218f, 0.582374f, 0.582530f, 0.582685f, 0.582841f, 0.582997f, 0.583153f,
- 0.583309f, 0.583464f, 0.583620f, 0.583776f, 0.583931f, 0.584087f, 0.584243f, 0.584398f,
- 0.584554f, 0.584710f, 0.584865f, 0.585021f, 0.585176f, 0.585332f, 0.585487f, 0.585642f,
- 0.585798f, 0.585953f, 0.586109f, 0.586264f, 0.586419f, 0.586575f, 0.586730f, 0.586885f,
- 0.587040f, 0.587196f, 0.587351f, 0.587506f, 0.587661f, 0.587816f, 0.587971f, 0.588126f,
- 0.588282f, 0.588437f, 0.588592f, 0.588747f, 0.588902f, 0.589057f, 0.589212f, 0.589366f,
- 0.589521f, 0.589676f, 0.589831f, 0.589986f, 0.590141f, 0.590295f, 0.590450f, 0.590605f,
- 0.590760f, 0.590914f, 0.591069f, 0.591224f, 0.591378f, 0.591533f, 0.591688f, 0.591842f,
- 0.591997f, 0.592151f, 0.592306f, 0.592460f, 0.592615f, 0.592769f, 0.592924f, 0.593078f,
- 0.593232f, 0.593387f, 0.593541f, 0.593695f, 0.593850f, 0.594004f, 0.594158f, 0.594312f,
- 0.594467f, 0.594621f, 0.594775f, 0.594929f, 0.595083f, 0.595237f, 0.595391f, 0.595545f,
- 0.595699f, 0.595853f, 0.596007f, 0.596161f, 0.596315f, 0.596469f, 0.596623f, 0.596777f,
- 0.596931f, 0.597085f, 0.597238f, 0.597392f, 0.597546f, 0.597700f, 0.597853f, 0.598007f,
- 0.598161f, 0.598314f, 0.598468f, 0.598622f, 0.598775f, 0.598929f, 0.599082f, 0.599236f,
- 0.599389f, 0.599543f, 0.599696f, 0.599850f, 0.600003f, 0.600156f, 0.600310f, 0.600463f,
- 0.600616f, 0.600770f, 0.600923f, 0.601076f, 0.601230f, 0.601383f, 0.601536f, 0.601689f,
- 0.601842f, 0.601995f, 0.602148f, 0.602302f, 0.602455f, 0.602608f, 0.602761f, 0.602914f,
- 0.603067f, 0.603220f, 0.603372f, 0.603525f, 0.603678f, 0.603831f, 0.603984f, 0.604137f,
- 0.604290f, 0.604442f, 0.604595f, 0.604748f, 0.604900f, 0.605053f, 0.605206f, 0.605358f,
- 0.605511f, 0.605664f, 0.605816f, 0.605969f, 0.606121f, 0.606274f, 0.606426f, 0.606579f,
- 0.606731f, 0.606884f, 0.607036f, 0.607188f, 0.607341f, 0.607493f, 0.607645f, 0.607798f,
- 0.607950f, 0.608102f, 0.608254f, 0.608406f, 0.608559f, 0.608711f, 0.608863f, 0.609015f,
- 0.609167f, 0.609319f, 0.609471f, 0.609623f, 0.609775f, 0.609927f, 0.610079f, 0.610231f,
- 0.610383f, 0.610535f, 0.610687f, 0.610838f, 0.610990f, 0.611142f, 0.611294f, 0.611445f,
- 0.611597f, 0.611749f, 0.611901f, 0.612052f, 0.612204f, 0.612355f, 0.612507f, 0.612659f,
- 0.612810f, 0.612962f, 0.613113f, 0.613265f, 0.613416f, 0.613567f, 0.613719f, 0.613870f,
- 0.614022f, 0.614173f, 0.614324f, 0.614475f, 0.614627f, 0.614778f, 0.614929f, 0.615080f,
- 0.615232f, 0.615383f, 0.615534f, 0.615685f, 0.615836f, 0.615987f, 0.616138f, 0.616289f,
- 0.616440f, 0.616591f, 0.616742f, 0.616893f, 0.617044f, 0.617195f, 0.617346f, 0.617496f,
- 0.617647f, 0.617798f, 0.617949f, 0.618100f, 0.618250f, 0.618401f, 0.618552f, 0.618702f,
- 0.618853f, 0.619004f, 0.619154f, 0.619305f, 0.619455f, 0.619606f, 0.619756f, 0.619907f,
- 0.620057f, 0.620208f, 0.620358f, 0.620508f, 0.620659f, 0.620809f, 0.620959f, 0.621110f,
- 0.621260f, 0.621410f, 0.621560f, 0.621711f, 0.621861f, 0.622011f, 0.622161f, 0.622311f,
- 0.622461f, 0.622611f, 0.622761f, 0.622911f, 0.623061f, 0.623211f, 0.623361f, 0.623511f,
- 0.623661f, 0.623811f, 0.623961f, 0.624111f, 0.624260f, 0.624410f, 0.624560f, 0.624710f,
- 0.624860f, 0.625009f, 0.625159f, 0.625309f, 0.625458f, 0.625608f, 0.625757f, 0.625907f,
- 0.626056f, 0.626206f, 0.626355f, 0.626505f, 0.626654f, 0.626804f, 0.626953f, 0.627102f,
- 0.627252f, 0.627401f, 0.627550f, 0.627700f, 0.627849f, 0.627998f, 0.628147f, 0.628297f,
- 0.628446f, 0.628595f, 0.628744f, 0.628893f, 0.629042f, 0.629191f, 0.629340f, 0.629489f,
- 0.629638f, 0.629787f, 0.629936f, 0.630085f, 0.630234f, 0.630383f, 0.630532f, 0.630680f,
- 0.630829f, 0.630978f, 0.631127f, 0.631275f, 0.631424f, 0.631573f, 0.631721f, 0.631870f,
- 0.632019f, 0.632167f, 0.632316f, 0.632464f, 0.632613f, 0.632761f, 0.632910f, 0.633058f,
- 0.633207f, 0.633355f, 0.633504f, 0.633652f, 0.633800f, 0.633949f, 0.634097f, 0.634245f,
- 0.634393f, 0.634542f, 0.634690f, 0.634838f, 0.634986f, 0.635134f, 0.635282f, 0.635430f,
- 0.635578f, 0.635726f, 0.635874f, 0.636022f, 0.636170f, 0.636318f, 0.636466f, 0.636614f,
- 0.636762f, 0.636910f, 0.637057f, 0.637205f, 0.637353f, 0.637501f, 0.637649f, 0.637796f,
- 0.637944f, 0.638092f, 0.638239f, 0.638387f, 0.638534f, 0.638682f, 0.638829f, 0.638977f,
- 0.639124f, 0.639272f, 0.639419f, 0.639567f, 0.639714f, 0.639862f, 0.640009f, 0.640156f,
- 0.640303f, 0.640451f, 0.640598f, 0.640745f, 0.640892f, 0.641040f, 0.641187f, 0.641334f,
- 0.641481f, 0.641628f, 0.641775f, 0.641922f, 0.642069f, 0.642216f, 0.642363f, 0.642510f,
- 0.642657f, 0.642804f, 0.642951f, 0.643098f, 0.643245f, 0.643391f, 0.643538f, 0.643685f,
- 0.643832f, 0.643978f, 0.644125f, 0.644272f, 0.644418f, 0.644565f, 0.644711f, 0.644858f,
- 0.645005f, 0.645151f, 0.645298f, 0.645444f, 0.645590f, 0.645737f, 0.645883f, 0.646030f,
- 0.646176f, 0.646322f, 0.646469f, 0.646615f, 0.646761f, 0.646907f, 0.647054f, 0.647200f,
- 0.647346f, 0.647492f, 0.647638f, 0.647784f, 0.647930f, 0.648076f, 0.648222f, 0.648368f,
- 0.648514f, 0.648660f, 0.648806f, 0.648952f, 0.649098f, 0.649244f, 0.649390f, 0.649536f,
- 0.649681f, 0.649827f, 0.649973f, 0.650119f, 0.650264f, 0.650410f, 0.650555f, 0.650701f,
- 0.650847f, 0.650992f, 0.651138f, 0.651283f, 0.651429f, 0.651574f, 0.651720f, 0.651865f,
- 0.652011f, 0.652156f, 0.652301f, 0.652447f, 0.652592f, 0.652737f, 0.652882f, 0.653028f,
- 0.653173f, 0.653318f, 0.653463f, 0.653608f, 0.653753f, 0.653899f, 0.654044f, 0.654189f,
- 0.654334f, 0.654479f, 0.654624f, 0.654769f, 0.654913f, 0.655058f, 0.655203f, 0.655348f,
- 0.655493f, 0.655638f, 0.655782f, 0.655927f, 0.656072f, 0.656217f, 0.656361f, 0.656506f,
- 0.656651f, 0.656795f, 0.656940f, 0.657084f, 0.657229f, 0.657373f, 0.657518f, 0.657662f,
- 0.657807f, 0.657951f, 0.658095f, 0.658240f, 0.658384f, 0.658529f, 0.658673f, 0.658817f,
- 0.658961f, 0.659105f, 0.659250f, 0.659394f, 0.659538f, 0.659682f, 0.659826f, 0.659970f,
- 0.660114f, 0.660258f, 0.660402f, 0.660546f, 0.660690f, 0.660834f, 0.660978f, 0.661122f,
- 0.661266f, 0.661410f, 0.661553f, 0.661697f, 0.661841f, 0.661985f, 0.662128f, 0.662272f,
- 0.662416f, 0.662559f, 0.662703f, 0.662847f, 0.662990f, 0.663134f, 0.663277f, 0.663421f,
- 0.663564f, 0.663708f, 0.663851f, 0.663994f, 0.664138f, 0.664281f, 0.664424f, 0.664568f,
- 0.664711f, 0.664854f, 0.664997f, 0.665141f, 0.665284f, 0.665427f, 0.665570f, 0.665713f,
- 0.665856f, 0.665999f, 0.666142f, 0.666285f, 0.666428f, 0.666571f, 0.666714f, 0.666857f,
- 0.667000f, 0.667143f, 0.667286f, 0.667428f, 0.667571f, 0.667714f, 0.667857f, 0.667999f,
- 0.668142f, 0.668285f, 0.668427f, 0.668570f, 0.668712f, 0.668855f, 0.668998f, 0.669140f,
- 0.669283f, 0.669425f, 0.669567f, 0.669710f, 0.669852f, 0.669995f, 0.670137f, 0.670279f,
- 0.670422f, 0.670564f, 0.670706f, 0.670848f, 0.670990f, 0.671133f, 0.671275f, 0.671417f,
- 0.671559f, 0.671701f, 0.671843f, 0.671985f, 0.672127f, 0.672269f, 0.672411f, 0.672553f,
- 0.672695f, 0.672837f, 0.672978f, 0.673120f, 0.673262f, 0.673404f, 0.673546f, 0.673687f,
- 0.673829f, 0.673971f, 0.674112f, 0.674254f, 0.674396f, 0.674537f, 0.674679f, 0.674820f,
- 0.674962f, 0.675103f, 0.675245f, 0.675386f, 0.675527f, 0.675669f, 0.675810f, 0.675951f,
- 0.676093f, 0.676234f, 0.676375f, 0.676516f, 0.676658f, 0.676799f, 0.676940f, 0.677081f,
- 0.677222f, 0.677363f, 0.677504f, 0.677645f, 0.677786f, 0.677927f, 0.678068f, 0.678209f,
- 0.678350f, 0.678491f, 0.678632f, 0.678773f, 0.678913f, 0.679054f, 0.679195f, 0.679336f,
- 0.679476f, 0.679617f, 0.679758f, 0.679898f, 0.680039f, 0.680179f, 0.680320f, 0.680461f,
- 0.680601f, 0.680741f, 0.680882f, 0.681022f, 0.681163f, 0.681303f, 0.681443f, 0.681584f,
- 0.681724f, 0.681864f, 0.682005f, 0.682145f, 0.682285f, 0.682425f, 0.682565f, 0.682705f,
- 0.682846f, 0.682986f, 0.683126f, 0.683266f, 0.683406f, 0.683546f, 0.683686f, 0.683825f,
- 0.683965f, 0.684105f, 0.684245f, 0.684385f, 0.684525f, 0.684664f, 0.684804f, 0.684944f,
- 0.685084f, 0.685223f, 0.685363f, 0.685503f, 0.685642f, 0.685782f, 0.685921f, 0.686061f,
- 0.686200f, 0.686340f, 0.686479f, 0.686619f, 0.686758f, 0.686897f, 0.687037f, 0.687176f,
- 0.687315f, 0.687455f, 0.687594f, 0.687733f, 0.687872f, 0.688011f, 0.688151f, 0.688290f,
- 0.688429f, 0.688568f, 0.688707f, 0.688846f, 0.688985f, 0.689124f, 0.689263f, 0.689402f,
- 0.689541f, 0.689679f, 0.689818f, 0.689957f, 0.690096f, 0.690235f, 0.690373f, 0.690512f,
- 0.690651f, 0.690789f, 0.690928f, 0.691067f, 0.691205f, 0.691344f, 0.691482f, 0.691621f,
- 0.691759f, 0.691898f, 0.692036f, 0.692175f, 0.692313f, 0.692451f, 0.692590f, 0.692728f,
- 0.692866f, 0.693004f, 0.693143f, 0.693281f, 0.693419f, 0.693557f, 0.693695f, 0.693833f,
- 0.693971f, 0.694109f, 0.694248f, 0.694386f, 0.694524f, 0.694661f, 0.694799f, 0.694937f,
- 0.695075f, 0.695213f, 0.695351f, 0.695489f, 0.695626f, 0.695764f, 0.695902f, 0.696039f,
- 0.696177f, 0.696315f, 0.696452f, 0.696590f, 0.696728f, 0.696865f, 0.697003f, 0.697140f,
- 0.697277f, 0.697415f, 0.697552f, 0.697690f, 0.697827f, 0.697964f, 0.698102f, 0.698239f,
- 0.698376f, 0.698513f, 0.698651f, 0.698788f, 0.698925f, 0.699062f, 0.699199f, 0.699336f,
- 0.699473f, 0.699610f, 0.699747f, 0.699884f, 0.700021f, 0.700158f, 0.700295f, 0.700432f,
- 0.700569f, 0.700706f, 0.700842f, 0.700979f, 0.701116f, 0.701253f, 0.701389f, 0.701526f,
- 0.701663f, 0.701799f, 0.701936f, 0.702072f, 0.702209f, 0.702345f, 0.702482f, 0.702618f,
- 0.702755f, 0.702891f, 0.703028f, 0.703164f, 0.703300f, 0.703436f, 0.703573f, 0.703709f,
- 0.703845f, 0.703981f, 0.704118f, 0.704254f, 0.704390f, 0.704526f, 0.704662f, 0.704798f,
- 0.704934f, 0.705070f, 0.705206f, 0.705342f, 0.705478f, 0.705614f, 0.705750f, 0.705885f,
- 0.706021f, 0.706157f, 0.706293f, 0.706429f, 0.706564f, 0.706700f, 0.706836f, 0.706971f,
- 0.707107f, 0.707242f, 0.707378f, 0.707513f, 0.707649f, 0.707784f, 0.707920f, 0.708055f,
- 0.708191f, 0.708326f, 0.708461f, 0.708597f, 0.708732f, 0.708867f, 0.709002f, 0.709138f,
- 0.709273f, 0.709408f, 0.709543f, 0.709678f, 0.709813f, 0.709948f, 0.710083f, 0.710218f,
- 0.710353f, 0.710488f, 0.710623f, 0.710758f, 0.710893f, 0.711028f, 0.711163f, 0.711297f,
- 0.711432f, 0.711567f, 0.711702f, 0.711836f, 0.711971f, 0.712106f, 0.712240f, 0.712375f,
- 0.712509f, 0.712644f, 0.712778f, 0.712913f, 0.713047f, 0.713182f, 0.713316f, 0.713451f,
- 0.713585f, 0.713719f, 0.713853f, 0.713988f, 0.714122f, 0.714256f, 0.714390f, 0.714525f,
- 0.714659f, 0.714793f, 0.714927f, 0.715061f, 0.715195f, 0.715329f, 0.715463f, 0.715597f,
- 0.715731f, 0.715865f, 0.715999f, 0.716132f, 0.716266f, 0.716400f, 0.716534f, 0.716668f,
- 0.716801f, 0.716935f, 0.717069f, 0.717202f, 0.717336f, 0.717469f, 0.717603f, 0.717737f,
- 0.717870f, 0.718004f, 0.718137f, 0.718270f, 0.718404f, 0.718537f, 0.718670f, 0.718804f,
- 0.718937f, 0.719070f, 0.719204f, 0.719337f, 0.719470f, 0.719603f, 0.719736f, 0.719869f,
- 0.720003f, 0.720136f, 0.720269f, 0.720402f, 0.720535f, 0.720668f, 0.720800f, 0.720933f,
- 0.721066f, 0.721199f, 0.721332f, 0.721465f, 0.721597f, 0.721730f, 0.721863f, 0.721996f,
- 0.722128f, 0.722261f, 0.722393f, 0.722526f, 0.722659f, 0.722791f, 0.722924f, 0.723056f,
- 0.723188f, 0.723321f, 0.723453f, 0.723586f, 0.723718f, 0.723850f, 0.723983f, 0.724115f,
- 0.724247f, 0.724379f, 0.724511f, 0.724644f, 0.724776f, 0.724908f, 0.725040f, 0.725172f,
- 0.725304f, 0.725436f, 0.725568f, 0.725700f, 0.725832f, 0.725964f, 0.726095f, 0.726227f,
- 0.726359f, 0.726491f, 0.726623f, 0.726754f, 0.726886f, 0.727018f, 0.727149f, 0.727281f,
- 0.727413f, 0.727544f, 0.727676f, 0.727807f, 0.727939f, 0.728070f, 0.728202f, 0.728333f,
- 0.728464f, 0.728596f, 0.728727f, 0.728858f, 0.728990f, 0.729121f, 0.729252f, 0.729383f,
- 0.729514f, 0.729646f, 0.729777f, 0.729908f, 0.730039f, 0.730170f, 0.730301f, 0.730432f,
- 0.730563f, 0.730694f, 0.730825f, 0.730955f, 0.731086f, 0.731217f, 0.731348f, 0.731479f,
- 0.731609f, 0.731740f, 0.731871f, 0.732001f, 0.732132f, 0.732263f, 0.732393f, 0.732524f,
- 0.732654f, 0.732785f, 0.732915f, 0.733046f, 0.733176f, 0.733306f, 0.733437f, 0.733567f,
- 0.733697f, 0.733828f, 0.733958f, 0.734088f, 0.734218f, 0.734349f, 0.734479f, 0.734609f,
- 0.734739f, 0.734869f, 0.734999f, 0.735129f, 0.735259f, 0.735389f, 0.735519f, 0.735649f,
- 0.735779f, 0.735908f, 0.736038f, 0.736168f, 0.736298f, 0.736428f, 0.736557f, 0.736687f,
- 0.736817f, 0.736946f, 0.737076f, 0.737205f, 0.737335f, 0.737464f, 0.737594f, 0.737723f,
- 0.737853f, 0.737982f, 0.738112f, 0.738241f, 0.738370f, 0.738500f, 0.738629f, 0.738758f,
- 0.738887f, 0.739017f, 0.739146f, 0.739275f, 0.739404f, 0.739533f, 0.739662f, 0.739791f,
- 0.739920f, 0.740049f, 0.740178f, 0.740307f, 0.740436f, 0.740565f, 0.740694f, 0.740822f,
- 0.740951f, 0.741080f, 0.741209f, 0.741337f, 0.741466f, 0.741595f, 0.741723f, 0.741852f,
- 0.741980f, 0.742109f, 0.742237f, 0.742366f, 0.742494f, 0.742623f, 0.742751f, 0.742880f,
- 0.743008f, 0.743136f, 0.743265f, 0.743393f, 0.743521f, 0.743649f, 0.743777f, 0.743906f,
- 0.744034f, 0.744162f, 0.744290f, 0.744418f, 0.744546f, 0.744674f, 0.744802f, 0.744930f,
- 0.745058f, 0.745186f, 0.745314f, 0.745441f, 0.745569f, 0.745697f, 0.745825f, 0.745952f,
- 0.746080f, 0.746208f, 0.746335f, 0.746463f, 0.746591f, 0.746718f, 0.746846f, 0.746973f,
- 0.747101f, 0.747228f, 0.747355f, 0.747483f, 0.747610f, 0.747738f, 0.747865f, 0.747992f,
- 0.748119f, 0.748247f, 0.748374f, 0.748501f, 0.748628f, 0.748755f, 0.748882f, 0.749009f,
- 0.749136f, 0.749263f, 0.749390f, 0.749517f, 0.749644f, 0.749771f, 0.749898f, 0.750025f,
- 0.750152f, 0.750278f, 0.750405f, 0.750532f, 0.750659f, 0.750785f, 0.750912f, 0.751039f,
- 0.751165f, 0.751292f, 0.751418f, 0.751545f, 0.751671f, 0.751798f, 0.751924f, 0.752050f,
- 0.752177f, 0.752303f, 0.752429f, 0.752556f, 0.752682f, 0.752808f, 0.752934f, 0.753061f,
- 0.753187f, 0.753313f, 0.753439f, 0.753565f, 0.753691f, 0.753817f, 0.753943f, 0.754069f,
- 0.754195f, 0.754321f, 0.754447f, 0.754573f, 0.754698f, 0.754824f, 0.754950f, 0.755076f,
- 0.755201f, 0.755327f, 0.755453f, 0.755578f, 0.755704f, 0.755829f, 0.755955f, 0.756081f,
- 0.756206f, 0.756331f, 0.756457f, 0.756582f, 0.756708f, 0.756833f, 0.756958f, 0.757084f,
- 0.757209f, 0.757334f, 0.757459f, 0.757584f, 0.757710f, 0.757835f, 0.757960f, 0.758085f,
- 0.758210f, 0.758335f, 0.758460f, 0.758585f, 0.758710f, 0.758835f, 0.758960f, 0.759084f,
- 0.759209f, 0.759334f, 0.759459f, 0.759583f, 0.759708f, 0.759833f, 0.759957f, 0.760082f,
- 0.760207f, 0.760331f, 0.760456f, 0.760580f, 0.760705f, 0.760829f, 0.760954f, 0.761078f,
- 0.761202f, 0.761327f, 0.761451f, 0.761575f, 0.761700f, 0.761824f, 0.761948f, 0.762072f,
- 0.762196f, 0.762320f, 0.762444f, 0.762569f, 0.762693f, 0.762817f, 0.762941f, 0.763065f,
- 0.763188f, 0.763312f, 0.763436f, 0.763560f, 0.763684f, 0.763808f, 0.763931f, 0.764055f,
- 0.764179f, 0.764302f, 0.764426f, 0.764550f, 0.764673f, 0.764797f, 0.764920f, 0.765044f,
- 0.765167f, 0.765291f, 0.765414f, 0.765538f, 0.765661f, 0.765784f, 0.765907f, 0.766031f,
- 0.766154f, 0.766277f, 0.766400f, 0.766524f, 0.766647f, 0.766770f, 0.766893f, 0.767016f,
- 0.767139f, 0.767262f, 0.767385f, 0.767508f, 0.767631f, 0.767754f, 0.767876f, 0.767999f,
- 0.768122f, 0.768245f, 0.768368f, 0.768490f, 0.768613f, 0.768736f, 0.768858f, 0.768981f,
- 0.769103f, 0.769226f, 0.769348f, 0.769471f, 0.769593f, 0.769716f, 0.769838f, 0.769961f,
- 0.770083f, 0.770205f, 0.770327f, 0.770450f, 0.770572f, 0.770694f, 0.770816f, 0.770938f,
- 0.771061f, 0.771183f, 0.771305f, 0.771427f, 0.771549f, 0.771671f, 0.771793f, 0.771915f,
- 0.772036f, 0.772158f, 0.772280f, 0.772402f, 0.772524f, 0.772645f, 0.772767f, 0.772889f,
- 0.773010f, 0.773132f, 0.773254f, 0.773375f, 0.773497f, 0.773618f, 0.773740f, 0.773861f,
- 0.773983f, 0.774104f, 0.774225f, 0.774347f, 0.774468f, 0.774589f, 0.774711f, 0.774832f,
- 0.774953f, 0.775074f, 0.775195f, 0.775317f, 0.775438f, 0.775559f, 0.775680f, 0.775801f,
- 0.775922f, 0.776043f, 0.776164f, 0.776284f, 0.776405f, 0.776526f, 0.776647f, 0.776768f,
- 0.776888f, 0.777009f, 0.777130f, 0.777251f, 0.777371f, 0.777492f, 0.777612f, 0.777733f,
- 0.777853f, 0.777974f, 0.778094f, 0.778215f, 0.778335f, 0.778456f, 0.778576f, 0.778696f,
- 0.778817f, 0.778937f, 0.779057f, 0.779177f, 0.779297f, 0.779418f, 0.779538f, 0.779658f,
- 0.779778f, 0.779898f, 0.780018f, 0.780138f, 0.780258f, 0.780378f, 0.780498f, 0.780617f,
- 0.780737f, 0.780857f, 0.780977f, 0.781097f, 0.781216f, 0.781336f, 0.781456f, 0.781575f,
- 0.781695f, 0.781814f, 0.781934f, 0.782053f, 0.782173f, 0.782292f, 0.782412f, 0.782531f,
- 0.782651f, 0.782770f, 0.782889f, 0.783009f, 0.783128f, 0.783247f, 0.783366f, 0.783485f,
- 0.783605f, 0.783724f, 0.783843f, 0.783962f, 0.784081f, 0.784200f, 0.784319f, 0.784438f,
- 0.784557f, 0.784675f, 0.784794f, 0.784913f, 0.785032f, 0.785151f, 0.785269f, 0.785388f,
- 0.785507f, 0.785625f, 0.785744f, 0.785863f, 0.785981f, 0.786100f, 0.786218f, 0.786337f,
- 0.786455f, 0.786574f, 0.786692f, 0.786810f, 0.786929f, 0.787047f, 0.787165f, 0.787284f,
- 0.787402f, 0.787520f, 0.787638f, 0.787756f, 0.787874f, 0.787992f, 0.788110f, 0.788228f,
- 0.788346f, 0.788464f, 0.788582f, 0.788700f, 0.788818f, 0.788936f, 0.789054f, 0.789172f,
- 0.789289f, 0.789407f, 0.789525f, 0.789642f, 0.789760f, 0.789878f, 0.789995f, 0.790113f,
- 0.790230f, 0.790348f, 0.790465f, 0.790583f, 0.790700f, 0.790817f, 0.790935f, 0.791052f,
- 0.791169f, 0.791287f, 0.791404f, 0.791521f, 0.791638f, 0.791755f, 0.791872f, 0.791990f,
- 0.792107f, 0.792224f, 0.792341f, 0.792458f, 0.792575f, 0.792691f, 0.792808f, 0.792925f,
- 0.793042f, 0.793159f, 0.793276f, 0.793392f, 0.793509f, 0.793626f, 0.793742f, 0.793859f,
- 0.793975f, 0.794092f, 0.794209f, 0.794325f, 0.794442f, 0.794558f, 0.794674f, 0.794791f,
- 0.794907f, 0.795023f, 0.795140f, 0.795256f, 0.795372f, 0.795488f, 0.795605f, 0.795721f,
- 0.795837f, 0.795953f, 0.796069f, 0.796185f, 0.796301f, 0.796417f, 0.796533f, 0.796649f,
- 0.796765f, 0.796881f, 0.796996f, 0.797112f, 0.797228f, 0.797344f, 0.797459f, 0.797575f,
- 0.797691f, 0.797806f, 0.797922f, 0.798038f, 0.798153f, 0.798269f, 0.798384f, 0.798500f,
- 0.798615f, 0.798730f, 0.798846f, 0.798961f, 0.799076f, 0.799192f, 0.799307f, 0.799422f,
- 0.799537f, 0.799652f, 0.799768f, 0.799883f, 0.799998f, 0.800113f, 0.800228f, 0.800343f,
- 0.800458f, 0.800573f, 0.800687f, 0.800802f, 0.800917f, 0.801032f, 0.801147f, 0.801261f,
- 0.801376f, 0.801491f, 0.801606f, 0.801720f, 0.801835f, 0.801949f, 0.802064f, 0.802178f,
- 0.802293f, 0.802407f, 0.802522f, 0.802636f, 0.802750f, 0.802865f, 0.802979f, 0.803093f,
- 0.803208f, 0.803322f, 0.803436f, 0.803550f, 0.803664f, 0.803778f, 0.803892f, 0.804006f,
- 0.804120f, 0.804234f, 0.804348f, 0.804462f, 0.804576f, 0.804690f, 0.804804f, 0.804918f,
- 0.805031f, 0.805145f, 0.805259f, 0.805372f, 0.805486f, 0.805600f, 0.805713f, 0.805827f,
- 0.805940f, 0.806054f, 0.806167f, 0.806281f, 0.806394f, 0.806508f, 0.806621f, 0.806734f,
- 0.806848f, 0.806961f, 0.807074f, 0.807187f, 0.807300f, 0.807414f, 0.807527f, 0.807640f,
- 0.807753f, 0.807866f, 0.807979f, 0.808092f, 0.808205f, 0.808318f, 0.808430f, 0.808543f,
- 0.808656f, 0.808769f, 0.808882f, 0.808994f, 0.809107f, 0.809220f, 0.809332f, 0.809445f,
- 0.809558f, 0.809670f, 0.809783f, 0.809895f, 0.810008f, 0.810120f, 0.810232f, 0.810345f,
- 0.810457f, 0.810570f, 0.810682f, 0.810794f, 0.810906f, 0.811018f, 0.811131f, 0.811243f,
- 0.811355f, 0.811467f, 0.811579f, 0.811691f, 0.811803f, 0.811915f, 0.812027f, 0.812139f,
- 0.812251f, 0.812362f, 0.812474f, 0.812586f, 0.812698f, 0.812809f, 0.812921f, 0.813033f,
- 0.813144f, 0.813256f, 0.813368f, 0.813479f, 0.813591f, 0.813702f, 0.813814f, 0.813925f,
- 0.814036f, 0.814148f, 0.814259f, 0.814370f, 0.814482f, 0.814593f, 0.814704f, 0.814815f,
- 0.814926f, 0.815037f, 0.815149f, 0.815260f, 0.815371f, 0.815482f, 0.815593f, 0.815704f,
- 0.815814f, 0.815925f, 0.816036f, 0.816147f, 0.816258f, 0.816368f, 0.816479f, 0.816590f,
- 0.816701f, 0.816811f, 0.816922f, 0.817032f, 0.817143f, 0.817253f, 0.817364f, 0.817474f,
- 0.817585f, 0.817695f, 0.817806f, 0.817916f, 0.818026f, 0.818137f, 0.818247f, 0.818357f,
- 0.818467f, 0.818577f, 0.818687f, 0.818798f, 0.818908f, 0.819018f, 0.819128f, 0.819238f,
- 0.819348f, 0.819457f, 0.819567f, 0.819677f, 0.819787f, 0.819897f, 0.820007f, 0.820116f,
- 0.820226f, 0.820336f, 0.820445f, 0.820555f, 0.820664f, 0.820774f, 0.820884f, 0.820993f,
- 0.821102f, 0.821212f, 0.821321f, 0.821431f, 0.821540f, 0.821649f, 0.821759f, 0.821868f,
- 0.821977f, 0.822086f, 0.822195f, 0.822305f, 0.822414f, 0.822523f, 0.822632f, 0.822741f,
- 0.822850f, 0.822959f, 0.823068f, 0.823177f, 0.823285f, 0.823394f, 0.823503f, 0.823612f,
- 0.823721f, 0.823829f, 0.823938f, 0.824047f, 0.824155f, 0.824264f, 0.824372f, 0.824481f,
- 0.824589f, 0.824698f, 0.824806f, 0.824915f, 0.825023f, 0.825131f, 0.825240f, 0.825348f,
- 0.825456f, 0.825564f, 0.825673f, 0.825781f, 0.825889f, 0.825997f, 0.826105f, 0.826213f,
- 0.826321f, 0.826429f, 0.826537f, 0.826645f, 0.826753f, 0.826861f, 0.826968f, 0.827076f,
- 0.827184f, 0.827292f, 0.827399f, 0.827507f, 0.827615f, 0.827722f, 0.827830f, 0.827938f,
- 0.828045f, 0.828153f, 0.828260f, 0.828367f, 0.828475f, 0.828582f, 0.828690f, 0.828797f,
- 0.828904f, 0.829011f, 0.829119f, 0.829226f, 0.829333f, 0.829440f, 0.829547f, 0.829654f,
- 0.829761f, 0.829868f, 0.829975f, 0.830082f, 0.830189f, 0.830296f, 0.830403f, 0.830510f,
- 0.830616f, 0.830723f, 0.830830f, 0.830937f, 0.831043f, 0.831150f, 0.831257f, 0.831363f,
- 0.831470f, 0.831576f, 0.831683f, 0.831789f, 0.831895f, 0.832002f, 0.832108f, 0.832215f,
- 0.832321f, 0.832427f, 0.832533f, 0.832640f, 0.832746f, 0.832852f, 0.832958f, 0.833064f,
- 0.833170f, 0.833276f, 0.833382f, 0.833488f, 0.833594f, 0.833700f, 0.833806f, 0.833912f,
- 0.834018f, 0.834123f, 0.834229f, 0.834335f, 0.834440f, 0.834546f, 0.834652f, 0.834757f,
- 0.834863f, 0.834968f, 0.835074f, 0.835179f, 0.835285f, 0.835390f, 0.835496f, 0.835601f,
- 0.835706f, 0.835812f, 0.835917f, 0.836022f, 0.836127f, 0.836232f, 0.836338f, 0.836443f,
- 0.836548f, 0.836653f, 0.836758f, 0.836863f, 0.836968f, 0.837073f, 0.837178f, 0.837282f,
- 0.837387f, 0.837492f, 0.837597f, 0.837701f, 0.837806f, 0.837911f, 0.838015f, 0.838120f,
- 0.838225f, 0.838329f, 0.838434f, 0.838538f, 0.838643f, 0.838747f, 0.838852f, 0.838956f,
- 0.839060f, 0.839165f, 0.839269f, 0.839373f, 0.839477f, 0.839581f, 0.839686f, 0.839790f,
- 0.839894f, 0.839998f, 0.840102f, 0.840206f, 0.840310f, 0.840414f, 0.840518f, 0.840622f,
- 0.840725f, 0.840829f, 0.840933f, 0.841037f, 0.841140f, 0.841244f, 0.841348f, 0.841451f,
- 0.841555f, 0.841659f, 0.841762f, 0.841866f, 0.841969f, 0.842072f, 0.842176f, 0.842279f,
- 0.842383f, 0.842486f, 0.842589f, 0.842692f, 0.842796f, 0.842899f, 0.843002f, 0.843105f,
- 0.843208f, 0.843311f, 0.843414f, 0.843517f, 0.843620f, 0.843723f, 0.843826f, 0.843929f,
- 0.844032f, 0.844135f, 0.844238f, 0.844340f, 0.844443f, 0.844546f, 0.844648f, 0.844751f,
- 0.844854f, 0.844956f, 0.845059f, 0.845161f, 0.845264f, 0.845366f, 0.845469f, 0.845571f,
- 0.845673f, 0.845776f, 0.845878f, 0.845980f, 0.846082f, 0.846185f, 0.846287f, 0.846389f,
- 0.846491f, 0.846593f, 0.846695f, 0.846797f, 0.846899f, 0.847001f, 0.847103f, 0.847205f,
- 0.847307f, 0.847408f, 0.847510f, 0.847612f, 0.847714f, 0.847815f, 0.847917f, 0.848019f,
- 0.848120f, 0.848222f, 0.848323f, 0.848425f, 0.848526f, 0.848628f, 0.848729f, 0.848831f,
- 0.848932f, 0.849033f, 0.849135f, 0.849236f, 0.849337f, 0.849438f, 0.849540f, 0.849641f,
- 0.849742f, 0.849843f, 0.849944f, 0.850045f, 0.850146f, 0.850247f, 0.850348f, 0.850449f,
- 0.850549f, 0.850650f, 0.850751f, 0.850852f, 0.850953f, 0.851053f, 0.851154f, 0.851255f,
- 0.851355f, 0.851456f, 0.851556f, 0.851657f, 0.851757f, 0.851858f, 0.851958f, 0.852059f,
- 0.852159f, 0.852259f, 0.852360f, 0.852460f, 0.852560f, 0.852660f, 0.852760f, 0.852861f,
- 0.852961f, 0.853061f, 0.853161f, 0.853261f, 0.853361f, 0.853461f, 0.853561f, 0.853660f,
- 0.853760f, 0.853860f, 0.853960f, 0.854060f, 0.854159f, 0.854259f, 0.854359f, 0.854458f,
- 0.854558f, 0.854658f, 0.854757f, 0.854857f, 0.854956f, 0.855056f, 0.855155f, 0.855254f,
- 0.855354f, 0.855453f, 0.855552f, 0.855651f, 0.855751f, 0.855850f, 0.855949f, 0.856048f,
- 0.856147f, 0.856246f, 0.856345f, 0.856444f, 0.856543f, 0.856642f, 0.856741f, 0.856840f,
- 0.856939f, 0.857038f, 0.857137f, 0.857235f, 0.857334f, 0.857433f, 0.857531f, 0.857630f,
- 0.857729f, 0.857827f, 0.857926f, 0.858024f, 0.858123f, 0.858221f, 0.858320f, 0.858418f,
- 0.858516f, 0.858615f, 0.858713f, 0.858811f, 0.858909f, 0.859007f, 0.859106f, 0.859204f,
- 0.859302f, 0.859400f, 0.859498f, 0.859596f, 0.859694f, 0.859792f, 0.859890f, 0.859988f,
- 0.860085f, 0.860183f, 0.860281f, 0.860379f, 0.860476f, 0.860574f, 0.860672f, 0.860769f,
- 0.860867f, 0.860964f, 0.861062f, 0.861160f, 0.861257f, 0.861354f, 0.861452f, 0.861549f,
- 0.861646f, 0.861744f, 0.861841f, 0.861938f, 0.862035f, 0.862133f, 0.862230f, 0.862327f,
- 0.862424f, 0.862521f, 0.862618f, 0.862715f, 0.862812f, 0.862909f, 0.863006f, 0.863103f,
- 0.863199f, 0.863296f, 0.863393f, 0.863490f, 0.863586f, 0.863683f, 0.863780f, 0.863876f,
- 0.863973f, 0.864069f, 0.864166f, 0.864262f, 0.864359f, 0.864455f, 0.864552f, 0.864648f,
- 0.864744f, 0.864841f, 0.864937f, 0.865033f, 0.865129f, 0.865225f, 0.865321f, 0.865418f,
- 0.865514f, 0.865610f, 0.865706f, 0.865802f, 0.865898f, 0.865993f, 0.866089f, 0.866185f,
- 0.866281f, 0.866377f, 0.866472f, 0.866568f, 0.866664f, 0.866759f, 0.866855f, 0.866951f,
- 0.867046f, 0.867142f, 0.867237f, 0.867333f, 0.867428f, 0.867523f, 0.867619f, 0.867714f,
- 0.867809f, 0.867905f, 0.868000f, 0.868095f, 0.868190f, 0.868285f, 0.868381f, 0.868476f,
- 0.868571f, 0.868666f, 0.868761f, 0.868856f, 0.868951f, 0.869045f, 0.869140f, 0.869235f,
- 0.869330f, 0.869425f, 0.869519f, 0.869614f, 0.869709f, 0.869803f, 0.869898f, 0.869992f,
- 0.870087f, 0.870182f, 0.870276f, 0.870370f, 0.870465f, 0.870559f, 0.870654f, 0.870748f,
- 0.870842f, 0.870936f, 0.871031f, 0.871125f, 0.871219f, 0.871313f, 0.871407f, 0.871501f,
- 0.871595f, 0.871689f, 0.871783f, 0.871877f, 0.871971f, 0.872065f, 0.872159f, 0.872252f,
- 0.872346f, 0.872440f, 0.872534f, 0.872627f, 0.872721f, 0.872814f, 0.872908f, 0.873001f,
- 0.873095f, 0.873188f, 0.873282f, 0.873375f, 0.873469f, 0.873562f, 0.873655f, 0.873749f,
- 0.873842f, 0.873935f, 0.874028f, 0.874121f, 0.874215f, 0.874308f, 0.874401f, 0.874494f,
- 0.874587f, 0.874680f, 0.874773f, 0.874865f, 0.874958f, 0.875051f, 0.875144f, 0.875237f,
- 0.875329f, 0.875422f, 0.875515f, 0.875607f, 0.875700f, 0.875793f, 0.875885f, 0.875978f,
- 0.876070f, 0.876163f, 0.876255f, 0.876347f, 0.876440f, 0.876532f, 0.876624f, 0.876716f,
- 0.876809f, 0.876901f, 0.876993f, 0.877085f, 0.877177f, 0.877269f, 0.877361f, 0.877453f,
- 0.877545f, 0.877637f, 0.877729f, 0.877821f, 0.877913f, 0.878005f, 0.878096f, 0.878188f,
- 0.878280f, 0.878371f, 0.878463f, 0.878555f, 0.878646f, 0.878738f, 0.878829f, 0.878921f,
- 0.879012f, 0.879104f, 0.879195f, 0.879286f, 0.879378f, 0.879469f, 0.879560f, 0.879651f,
- 0.879743f, 0.879834f, 0.879925f, 0.880016f, 0.880107f, 0.880198f, 0.880289f, 0.880380f,
- 0.880471f, 0.880562f, 0.880653f, 0.880743f, 0.880834f, 0.880925f, 0.881016f, 0.881106f,
- 0.881197f, 0.881288f, 0.881378f, 0.881469f, 0.881559f, 0.881650f, 0.881740f, 0.881831f,
- 0.881921f, 0.882012f, 0.882102f, 0.882192f, 0.882283f, 0.882373f, 0.882463f, 0.882553f,
- 0.882643f, 0.882733f, 0.882824f, 0.882914f, 0.883004f, 0.883094f, 0.883184f, 0.883273f,
- 0.883363f, 0.883453f, 0.883543f, 0.883633f, 0.883723f, 0.883812f, 0.883902f, 0.883992f,
- 0.884081f, 0.884171f, 0.884260f, 0.884350f, 0.884439f, 0.884529f, 0.884618f, 0.884708f,
- 0.884797f, 0.884886f, 0.884976f, 0.885065f, 0.885154f, 0.885243f, 0.885333f, 0.885422f,
- 0.885511f, 0.885600f, 0.885689f, 0.885778f, 0.885867f, 0.885956f, 0.886045f, 0.886134f,
- 0.886223f, 0.886311f, 0.886400f, 0.886489f, 0.886578f, 0.886666f, 0.886755f, 0.886844f,
- 0.886932f, 0.887021f, 0.887109f, 0.887198f, 0.887286f, 0.887375f, 0.887463f, 0.887551f,
- 0.887640f, 0.887728f, 0.887816f, 0.887904f, 0.887993f, 0.888081f, 0.888169f, 0.888257f,
- 0.888345f, 0.888433f, 0.888521f, 0.888609f, 0.888697f, 0.888785f, 0.888873f, 0.888961f,
- 0.889048f, 0.889136f, 0.889224f, 0.889312f, 0.889399f, 0.889487f, 0.889574f, 0.889662f,
- 0.889750f, 0.889837f, 0.889925f, 0.890012f, 0.890099f, 0.890187f, 0.890274f, 0.890361f,
- 0.890449f, 0.890536f, 0.890623f, 0.890710f, 0.890797f, 0.890885f, 0.890972f, 0.891059f,
- 0.891146f, 0.891233f, 0.891320f, 0.891407f, 0.891493f, 0.891580f, 0.891667f, 0.891754f,
- 0.891841f, 0.891927f, 0.892014f, 0.892101f, 0.892187f, 0.892274f, 0.892361f, 0.892447f,
- 0.892534f, 0.892620f, 0.892706f, 0.892793f, 0.892879f, 0.892965f, 0.893052f, 0.893138f,
- 0.893224f, 0.893310f, 0.893397f, 0.893483f, 0.893569f, 0.893655f, 0.893741f, 0.893827f,
- 0.893913f, 0.893999f, 0.894085f, 0.894171f, 0.894256f, 0.894342f, 0.894428f, 0.894514f,
- 0.894599f, 0.894685f, 0.894771f, 0.894856f, 0.894942f, 0.895028f, 0.895113f, 0.895198f,
- 0.895284f, 0.895369f, 0.895455f, 0.895540f, 0.895625f, 0.895711f, 0.895796f, 0.895881f,
- 0.895966f, 0.896051f, 0.896137f, 0.896222f, 0.896307f, 0.896392f, 0.896477f, 0.896562f,
- 0.896646f, 0.896731f, 0.896816f, 0.896901f, 0.896986f, 0.897071f, 0.897155f, 0.897240f,
- 0.897325f, 0.897409f, 0.897494f, 0.897578f, 0.897663f, 0.897747f, 0.897832f, 0.897916f,
- 0.898001f, 0.898085f, 0.898169f, 0.898254f, 0.898338f, 0.898422f, 0.898506f, 0.898590f,
- 0.898674f, 0.898759f, 0.898843f, 0.898927f, 0.899011f, 0.899095f, 0.899179f, 0.899262f,
- 0.899346f, 0.899430f, 0.899514f, 0.899598f, 0.899681f, 0.899765f, 0.899849f, 0.899932f,
- 0.900016f, 0.900099f, 0.900183f, 0.900266f, 0.900350f, 0.900433f, 0.900517f, 0.900600f,
- 0.900683f, 0.900767f, 0.900850f, 0.900933f, 0.901016f, 0.901100f, 0.901183f, 0.901266f,
- 0.901349f, 0.901432f, 0.901515f, 0.901598f, 0.901681f, 0.901764f, 0.901847f, 0.901929f,
- 0.902012f, 0.902095f, 0.902178f, 0.902260f, 0.902343f, 0.902426f, 0.902508f, 0.902591f,
- 0.902673f, 0.902756f, 0.902838f, 0.902921f, 0.903003f, 0.903085f, 0.903168f, 0.903250f,
- 0.903332f, 0.903415f, 0.903497f, 0.903579f, 0.903661f, 0.903743f, 0.903825f, 0.903907f,
- 0.903989f, 0.904071f, 0.904153f, 0.904235f, 0.904317f, 0.904399f, 0.904481f, 0.904562f,
- 0.904644f, 0.904726f, 0.904807f, 0.904889f, 0.904971f, 0.905052f, 0.905134f, 0.905215f,
- 0.905297f, 0.905378f, 0.905460f, 0.905541f, 0.905622f, 0.905704f, 0.905785f, 0.905866f,
- 0.905947f, 0.906028f, 0.906110f, 0.906191f, 0.906272f, 0.906353f, 0.906434f, 0.906515f,
- 0.906596f, 0.906677f, 0.906757f, 0.906838f, 0.906919f, 0.907000f, 0.907081f, 0.907161f,
- 0.907242f, 0.907323f, 0.907403f, 0.907484f, 0.907564f, 0.907645f, 0.907725f, 0.907806f,
- 0.907886f, 0.907966f, 0.908047f, 0.908127f, 0.908207f, 0.908288f, 0.908368f, 0.908448f,
- 0.908528f, 0.908608f, 0.908688f, 0.908768f, 0.908848f, 0.908928f, 0.909008f, 0.909088f,
- 0.909168f, 0.909248f, 0.909328f, 0.909407f, 0.909487f, 0.909567f, 0.909646f, 0.909726f,
- 0.909806f, 0.909885f, 0.909965f, 0.910044f, 0.910124f, 0.910203f, 0.910283f, 0.910362f,
- 0.910441f, 0.910521f, 0.910600f, 0.910679f, 0.910758f, 0.910837f, 0.910917f, 0.910996f,
- 0.911075f, 0.911154f, 0.911233f, 0.911312f, 0.911391f, 0.911470f, 0.911548f, 0.911627f,
- 0.911706f, 0.911785f, 0.911864f, 0.911942f, 0.912021f, 0.912099f, 0.912178f, 0.912257f,
- 0.912335f, 0.912414f, 0.912492f, 0.912571f, 0.912649f, 0.912727f, 0.912806f, 0.912884f,
- 0.912962f, 0.913040f, 0.913119f, 0.913197f, 0.913275f, 0.913353f, 0.913431f, 0.913509f,
- 0.913587f, 0.913665f, 0.913743f, 0.913821f, 0.913899f, 0.913976f, 0.914054f, 0.914132f,
- 0.914210f, 0.914287f, 0.914365f, 0.914443f, 0.914520f, 0.914598f, 0.914675f, 0.914753f,
- 0.914830f, 0.914908f, 0.914985f, 0.915062f, 0.915140f, 0.915217f, 0.915294f, 0.915372f,
- 0.915449f, 0.915526f, 0.915603f, 0.915680f, 0.915757f, 0.915834f, 0.915911f, 0.915988f,
- 0.916065f, 0.916142f, 0.916219f, 0.916296f, 0.916372f, 0.916449f, 0.916526f, 0.916602f,
- 0.916679f, 0.916756f, 0.916832f, 0.916909f, 0.916985f, 0.917062f, 0.917138f, 0.917215f,
- 0.917291f, 0.917367f, 0.917444f, 0.917520f, 0.917596f, 0.917672f, 0.917749f, 0.917825f,
- 0.917901f, 0.917977f, 0.918053f, 0.918129f, 0.918205f, 0.918281f, 0.918357f, 0.918433f,
- 0.918508f, 0.918584f, 0.918660f, 0.918736f, 0.918811f, 0.918887f, 0.918963f, 0.919038f,
- 0.919114f, 0.919189f, 0.919265f, 0.919340f, 0.919416f, 0.919491f, 0.919567f, 0.919642f,
- 0.919717f, 0.919792f, 0.919868f, 0.919943f, 0.920018f, 0.920093f, 0.920168f, 0.920243f,
- 0.920318f, 0.920393f, 0.920468f, 0.920543f, 0.920618f, 0.920693f, 0.920768f, 0.920842f,
- 0.920917f, 0.920992f, 0.921067f, 0.921141f, 0.921216f, 0.921291f, 0.921365f, 0.921440f,
- 0.921514f, 0.921588f, 0.921663f, 0.921737f, 0.921812f, 0.921886f, 0.921960f, 0.922034f,
- 0.922109f, 0.922183f, 0.922257f, 0.922331f, 0.922405f, 0.922479f, 0.922553f, 0.922627f,
- 0.922701f, 0.922775f, 0.922849f, 0.922923f, 0.922997f, 0.923070f, 0.923144f, 0.923218f,
- 0.923291f, 0.923365f, 0.923439f, 0.923512f, 0.923586f, 0.923659f, 0.923733f, 0.923806f,
- 0.923880f, 0.923953f, 0.924026f, 0.924100f, 0.924173f, 0.924246f, 0.924319f, 0.924392f,
- 0.924465f, 0.924539f, 0.924612f, 0.924685f, 0.924758f, 0.924831f, 0.924904f, 0.924976f,
- 0.925049f, 0.925122f, 0.925195f, 0.925268f, 0.925340f, 0.925413f, 0.925486f, 0.925558f,
- 0.925631f, 0.925703f, 0.925776f, 0.925848f, 0.925921f, 0.925993f, 0.926066f, 0.926138f,
- 0.926210f, 0.926283f, 0.926355f, 0.926427f, 0.926499f, 0.926571f, 0.926643f, 0.926715f,
- 0.926787f, 0.926859f, 0.926931f, 0.927003f, 0.927075f, 0.927147f, 0.927219f, 0.927291f,
- 0.927363f, 0.927434f, 0.927506f, 0.927578f, 0.927649f, 0.927721f, 0.927792f, 0.927864f,
- 0.927935f, 0.928007f, 0.928078f, 0.928150f, 0.928221f, 0.928292f, 0.928364f, 0.928435f,
- 0.928506f, 0.928577f, 0.928648f, 0.928720f, 0.928791f, 0.928862f, 0.928933f, 0.929004f,
- 0.929075f, 0.929146f, 0.929216f, 0.929287f, 0.929358f, 0.929429f, 0.929500f, 0.929570f,
- 0.929641f, 0.929712f, 0.929782f, 0.929853f, 0.929923f, 0.929994f, 0.930064f, 0.930135f,
- 0.930205f, 0.930275f, 0.930346f, 0.930416f, 0.930486f, 0.930556f, 0.930627f, 0.930697f,
- 0.930767f, 0.930837f, 0.930907f, 0.930977f, 0.931047f, 0.931117f, 0.931187f, 0.931257f,
- 0.931327f, 0.931397f, 0.931466f, 0.931536f, 0.931606f, 0.931675f, 0.931745f, 0.931815f,
- 0.931884f, 0.931954f, 0.932023f, 0.932093f, 0.932162f, 0.932232f, 0.932301f, 0.932370f,
- 0.932440f, 0.932509f, 0.932578f, 0.932647f, 0.932716f, 0.932786f, 0.932855f, 0.932924f,
- 0.932993f, 0.933062f, 0.933131f, 0.933200f, 0.933269f, 0.933337f, 0.933406f, 0.933475f,
- 0.933544f, 0.933612f, 0.933681f, 0.933750f, 0.933818f, 0.933887f, 0.933956f, 0.934024f,
- 0.934093f, 0.934161f, 0.934229f, 0.934298f, 0.934366f, 0.934434f, 0.934503f, 0.934571f,
- 0.934639f, 0.934707f, 0.934775f, 0.934844f, 0.934912f, 0.934980f, 0.935048f, 0.935116f,
- 0.935184f, 0.935251f, 0.935319f, 0.935387f, 0.935455f, 0.935523f, 0.935590f, 0.935658f,
- 0.935726f, 0.935793f, 0.935861f, 0.935928f, 0.935996f, 0.936063f, 0.936131f, 0.936198f,
- 0.936266f, 0.936333f, 0.936400f, 0.936468f, 0.936535f, 0.936602f, 0.936669f, 0.936736f,
- 0.936803f, 0.936871f, 0.936938f, 0.937005f, 0.937072f, 0.937138f, 0.937205f, 0.937272f,
- 0.937339f, 0.937406f, 0.937473f, 0.937539f, 0.937606f, 0.937673f, 0.937739f, 0.937806f,
- 0.937872f, 0.937939f, 0.938005f, 0.938072f, 0.938138f, 0.938205f, 0.938271f, 0.938337f,
- 0.938404f, 0.938470f, 0.938536f, 0.938602f, 0.938668f, 0.938734f, 0.938800f, 0.938866f,
- 0.938932f, 0.938998f, 0.939064f, 0.939130f, 0.939196f, 0.939262f, 0.939328f, 0.939394f,
- 0.939459f, 0.939525f, 0.939591f, 0.939656f, 0.939722f, 0.939787f, 0.939853f, 0.939918f,
- 0.939984f, 0.940049f, 0.940115f, 0.940180f, 0.940245f, 0.940310f, 0.940376f, 0.940441f,
- 0.940506f, 0.940571f, 0.940636f, 0.940701f, 0.940766f, 0.940831f, 0.940896f, 0.940961f,
- 0.941026f, 0.941091f, 0.941156f, 0.941221f, 0.941285f, 0.941350f, 0.941415f, 0.941479f,
- 0.941544f, 0.941609f, 0.941673f, 0.941738f, 0.941802f, 0.941867f, 0.941931f, 0.941995f,
- 0.942060f, 0.942124f, 0.942188f, 0.942253f, 0.942317f, 0.942381f, 0.942445f, 0.942509f,
- 0.942573f, 0.942637f, 0.942701f, 0.942765f, 0.942829f, 0.942893f, 0.942957f, 0.943021f,
- 0.943084f, 0.943148f, 0.943212f, 0.943276f, 0.943339f, 0.943403f, 0.943466f, 0.943530f,
- 0.943593f, 0.943657f, 0.943720f, 0.943784f, 0.943847f, 0.943910f, 0.943974f, 0.944037f,
- 0.944100f, 0.944163f, 0.944227f, 0.944290f, 0.944353f, 0.944416f, 0.944479f, 0.944542f,
- 0.944605f, 0.944668f, 0.944731f, 0.944793f, 0.944856f, 0.944919f, 0.944982f, 0.945045f,
- 0.945107f, 0.945170f, 0.945232f, 0.945295f, 0.945358f, 0.945420f, 0.945482f, 0.945545f,
- 0.945607f, 0.945670f, 0.945732f, 0.945794f, 0.945857f, 0.945919f, 0.945981f, 0.946043f,
- 0.946105f, 0.946167f, 0.946229f, 0.946291f, 0.946353f, 0.946415f, 0.946477f, 0.946539f,
- 0.946601f, 0.946663f, 0.946724f, 0.946786f, 0.946848f, 0.946910f, 0.946971f, 0.947033f,
- 0.947094f, 0.947156f, 0.947217f, 0.947279f, 0.947340f, 0.947402f, 0.947463f, 0.947524f,
- 0.947586f, 0.947647f, 0.947708f, 0.947769f, 0.947830f, 0.947891f, 0.947953f, 0.948014f,
- 0.948075f, 0.948136f, 0.948196f, 0.948257f, 0.948318f, 0.948379f, 0.948440f, 0.948501f,
- 0.948561f, 0.948622f, 0.948683f, 0.948743f, 0.948804f, 0.948864f, 0.948925f, 0.948985f,
- 0.949046f, 0.949106f, 0.949167f, 0.949227f, 0.949287f, 0.949348f, 0.949408f, 0.949468f,
- 0.949528f, 0.949588f, 0.949648f, 0.949708f, 0.949768f, 0.949829f, 0.949888f, 0.949948f,
- 0.950008f, 0.950068f, 0.950128f, 0.950188f, 0.950247f, 0.950307f, 0.950367f, 0.950426f,
- 0.950486f, 0.950546f, 0.950605f, 0.950665f, 0.950724f, 0.950784f, 0.950843f, 0.950902f,
- 0.950962f, 0.951021f, 0.951080f, 0.951139f, 0.951199f, 0.951258f, 0.951317f, 0.951376f,
- 0.951435f, 0.951494f, 0.951553f, 0.951612f, 0.951671f, 0.951730f, 0.951789f, 0.951847f,
- 0.951906f, 0.951965f, 0.952024f, 0.952082f, 0.952141f, 0.952199f, 0.952258f, 0.952317f,
- 0.952375f, 0.952433f, 0.952492f, 0.952550f, 0.952609f, 0.952667f, 0.952725f, 0.952783f,
- 0.952842f, 0.952900f, 0.952958f, 0.953016f, 0.953074f, 0.953132f, 0.953190f, 0.953248f,
- 0.953306f, 0.953364f, 0.953422f, 0.953480f, 0.953537f, 0.953595f, 0.953653f, 0.953711f,
- 0.953768f, 0.953826f, 0.953883f, 0.953941f, 0.953998f, 0.954056f, 0.954113f, 0.954171f,
- 0.954228f, 0.954285f, 0.954343f, 0.954400f, 0.954457f, 0.954514f, 0.954572f, 0.954629f,
- 0.954686f, 0.954743f, 0.954800f, 0.954857f, 0.954914f, 0.954971f, 0.955028f, 0.955084f,
- 0.955141f, 0.955198f, 0.955255f, 0.955311f, 0.955368f, 0.955425f, 0.955481f, 0.955538f,
- 0.955594f, 0.955651f, 0.955707f, 0.955764f, 0.955820f, 0.955876f, 0.955933f, 0.955989f,
- 0.956045f, 0.956101f, 0.956158f, 0.956214f, 0.956270f, 0.956326f, 0.956382f, 0.956438f,
- 0.956494f, 0.956550f, 0.956606f, 0.956662f, 0.956717f, 0.956773f, 0.956829f, 0.956885f,
- 0.956940f, 0.956996f, 0.957052f, 0.957107f, 0.957163f, 0.957218f, 0.957274f, 0.957329f,
- 0.957385f, 0.957440f, 0.957495f, 0.957550f, 0.957606f, 0.957661f, 0.957716f, 0.957771f,
- 0.957826f, 0.957882f, 0.957937f, 0.957992f, 0.958046f, 0.958101f, 0.958156f, 0.958211f,
- 0.958266f, 0.958321f, 0.958376f, 0.958430f, 0.958485f, 0.958540f, 0.958594f, 0.958649f,
- 0.958703f, 0.958758f, 0.958812f, 0.958867f, 0.958921f, 0.958976f, 0.959030f, 0.959084f,
- 0.959139f, 0.959193f, 0.959247f, 0.959301f, 0.959355f, 0.959409f, 0.959463f, 0.959518f,
- 0.959572f, 0.959625f, 0.959679f, 0.959733f, 0.959787f, 0.959841f, 0.959895f, 0.959948f,
- 0.960002f, 0.960056f, 0.960109f, 0.960163f, 0.960217f, 0.960270f, 0.960324f, 0.960377f,
- 0.960431f, 0.960484f, 0.960537f, 0.960591f, 0.960644f, 0.960697f, 0.960750f, 0.960804f,
- 0.960857f, 0.960910f, 0.960963f, 0.961016f, 0.961069f, 0.961122f, 0.961175f, 0.961228f,
- 0.961280f, 0.961333f, 0.961386f, 0.961439f, 0.961492f, 0.961544f, 0.961597f, 0.961649f,
- 0.961702f, 0.961755f, 0.961807f, 0.961860f, 0.961912f, 0.961964f, 0.962017f, 0.962069f,
- 0.962121f, 0.962174f, 0.962226f, 0.962278f, 0.962330f, 0.962382f, 0.962434f, 0.962486f,
- 0.962538f, 0.962590f, 0.962642f, 0.962694f, 0.962746f, 0.962798f, 0.962850f, 0.962902f,
- 0.962953f, 0.963005f, 0.963057f, 0.963108f, 0.963160f, 0.963211f, 0.963263f, 0.963314f,
- 0.963366f, 0.963417f, 0.963469f, 0.963520f, 0.963571f, 0.963623f, 0.963674f, 0.963725f,
- 0.963776f, 0.963827f, 0.963878f, 0.963929f, 0.963980f, 0.964031f, 0.964082f, 0.964133f,
- 0.964184f, 0.964235f, 0.964286f, 0.964336f, 0.964387f, 0.964438f, 0.964489f, 0.964539f,
- 0.964590f, 0.964640f, 0.964691f, 0.964741f, 0.964792f, 0.964842f, 0.964893f, 0.964943f,
- 0.964993f, 0.965044f, 0.965094f, 0.965144f, 0.965194f, 0.965244f, 0.965294f, 0.965344f,
- 0.965394f, 0.965444f, 0.965494f, 0.965544f, 0.965594f, 0.965644f, 0.965694f, 0.965744f,
- 0.965793f, 0.965843f, 0.965893f, 0.965942f, 0.965992f, 0.966042f, 0.966091f, 0.966141f,
- 0.966190f, 0.966239f, 0.966289f, 0.966338f, 0.966387f, 0.966437f, 0.966486f, 0.966535f,
- 0.966584f, 0.966633f, 0.966683f, 0.966732f, 0.966781f, 0.966830f, 0.966879f, 0.966928f,
- 0.966976f, 0.967025f, 0.967074f, 0.967123f, 0.967172f, 0.967220f, 0.967269f, 0.967318f,
- 0.967366f, 0.967415f, 0.967463f, 0.967512f, 0.967560f, 0.967609f, 0.967657f, 0.967706f,
- 0.967754f, 0.967802f, 0.967850f, 0.967899f, 0.967947f, 0.967995f, 0.968043f, 0.968091f,
- 0.968139f, 0.968187f, 0.968235f, 0.968283f, 0.968331f, 0.968379f, 0.968427f, 0.968474f,
- 0.968522f, 0.968570f, 0.968617f, 0.968665f, 0.968713f, 0.968760f, 0.968808f, 0.968855f,
- 0.968903f, 0.968950f, 0.968998f, 0.969045f, 0.969092f, 0.969140f, 0.969187f, 0.969234f,
- 0.969281f, 0.969328f, 0.969375f, 0.969423f, 0.969470f, 0.969517f, 0.969564f, 0.969611f,
- 0.969657f, 0.969704f, 0.969751f, 0.969798f, 0.969845f, 0.969891f, 0.969938f, 0.969985f,
- 0.970031f, 0.970078f, 0.970124f, 0.970171f, 0.970217f, 0.970264f, 0.970310f, 0.970357f,
- 0.970403f, 0.970449f, 0.970495f, 0.970542f, 0.970588f, 0.970634f, 0.970680f, 0.970726f,
- 0.970772f, 0.970818f, 0.970864f, 0.970910f, 0.970956f, 0.971002f, 0.971048f, 0.971093f,
- 0.971139f, 0.971185f, 0.971231f, 0.971276f, 0.971322f, 0.971367f, 0.971413f, 0.971458f,
- 0.971504f, 0.971549f, 0.971595f, 0.971640f, 0.971685f, 0.971731f, 0.971776f, 0.971821f,
- 0.971866f, 0.971911f, 0.971957f, 0.972002f, 0.972047f, 0.972092f, 0.972137f, 0.972182f,
- 0.972227f, 0.972271f, 0.972316f, 0.972361f, 0.972406f, 0.972450f, 0.972495f, 0.972540f,
- 0.972584f, 0.972629f, 0.972673f, 0.972718f, 0.972762f, 0.972807f, 0.972851f, 0.972896f,
- 0.972940f, 0.972984f, 0.973028f, 0.973073f, 0.973117f, 0.973161f, 0.973205f, 0.973249f,
- 0.973293f, 0.973337f, 0.973381f, 0.973425f, 0.973469f, 0.973513f, 0.973557f, 0.973601f,
- 0.973644f, 0.973688f, 0.973732f, 0.973775f, 0.973819f, 0.973862f, 0.973906f, 0.973949f,
- 0.973993f, 0.974036f, 0.974080f, 0.974123f, 0.974166f, 0.974210f, 0.974253f, 0.974296f,
- 0.974339f, 0.974383f, 0.974426f, 0.974469f, 0.974512f, 0.974555f, 0.974598f, 0.974641f,
- 0.974684f, 0.974726f, 0.974769f, 0.974812f, 0.974855f, 0.974897f, 0.974940f, 0.974983f,
- 0.975025f, 0.975068f, 0.975110f, 0.975153f, 0.975195f, 0.975238f, 0.975280f, 0.975323f,
- 0.975365f, 0.975407f, 0.975449f, 0.975492f, 0.975534f, 0.975576f, 0.975618f, 0.975660f,
- 0.975702f, 0.975744f, 0.975786f, 0.975828f, 0.975870f, 0.975912f, 0.975954f, 0.975995f,
- 0.976037f, 0.976079f, 0.976120f, 0.976162f, 0.976204f, 0.976245f, 0.976287f, 0.976328f,
- 0.976370f, 0.976411f, 0.976453f, 0.976494f, 0.976535f, 0.976576f, 0.976618f, 0.976659f,
- 0.976700f, 0.976741f, 0.976782f, 0.976823f, 0.976864f, 0.976905f, 0.976946f, 0.976987f,
- 0.977028f, 0.977069f, 0.977110f, 0.977151f, 0.977191f, 0.977232f, 0.977273f, 0.977313f,
- 0.977354f, 0.977394f, 0.977435f, 0.977475f, 0.977516f, 0.977556f, 0.977597f, 0.977637f,
- 0.977677f, 0.977718f, 0.977758f, 0.977798f, 0.977838f, 0.977878f, 0.977918f, 0.977959f,
- 0.977998f, 0.978038f, 0.978078f, 0.978118f, 0.978158f, 0.978198f, 0.978238f, 0.978278f,
- 0.978317f, 0.978357f, 0.978397f, 0.978436f, 0.978476f, 0.978516f, 0.978555f, 0.978594f,
- 0.978634f, 0.978673f, 0.978713f, 0.978752f, 0.978791f, 0.978831f, 0.978870f, 0.978909f,
- 0.978948f, 0.978987f, 0.979026f, 0.979065f, 0.979104f, 0.979143f, 0.979182f, 0.979221f,
- 0.979260f, 0.979299f, 0.979338f, 0.979376f, 0.979415f, 0.979454f, 0.979493f, 0.979531f,
- 0.979570f, 0.979608f, 0.979647f, 0.979685f, 0.979724f, 0.979762f, 0.979800f, 0.979839f,
- 0.979877f, 0.979915f, 0.979954f, 0.979992f, 0.980030f, 0.980068f, 0.980106f, 0.980144f,
- 0.980182f, 0.980220f, 0.980258f, 0.980296f, 0.980334f, 0.980372f, 0.980409f, 0.980447f,
- 0.980485f, 0.980523f, 0.980560f, 0.980598f, 0.980635f, 0.980673f, 0.980710f, 0.980748f,
- 0.980785f, 0.980823f, 0.980860f, 0.980897f, 0.980935f, 0.980972f, 0.981009f, 0.981046f,
- 0.981083f, 0.981120f, 0.981158f, 0.981195f, 0.981232f, 0.981269f, 0.981305f, 0.981342f,
- 0.981379f, 0.981416f, 0.981453f, 0.981490f, 0.981526f, 0.981563f, 0.981600f, 0.981636f,
- 0.981673f, 0.981709f, 0.981746f, 0.981782f, 0.981819f, 0.981855f, 0.981891f, 0.981928f,
- 0.981964f, 0.982000f, 0.982036f, 0.982072f, 0.982109f, 0.982145f, 0.982181f, 0.982217f,
- 0.982253f, 0.982289f, 0.982325f, 0.982360f, 0.982396f, 0.982432f, 0.982468f, 0.982504f,
- 0.982539f, 0.982575f, 0.982611f, 0.982646f, 0.982682f, 0.982717f, 0.982753f, 0.982788f,
- 0.982824f, 0.982859f, 0.982894f, 0.982930f, 0.982965f, 0.983000f, 0.983035f, 0.983070f,
- 0.983105f, 0.983141f, 0.983176f, 0.983211f, 0.983246f, 0.983281f, 0.983315f, 0.983350f,
- 0.983385f, 0.983420f, 0.983455f, 0.983489f, 0.983524f, 0.983559f, 0.983593f, 0.983628f,
- 0.983662f, 0.983697f, 0.983731f, 0.983766f, 0.983800f, 0.983835f, 0.983869f, 0.983903f,
- 0.983937f, 0.983972f, 0.984006f, 0.984040f, 0.984074f, 0.984108f, 0.984142f, 0.984176f,
- 0.984210f, 0.984244f, 0.984278f, 0.984312f, 0.984346f, 0.984379f, 0.984413f, 0.984447f,
- 0.984480f, 0.984514f, 0.984548f, 0.984581f, 0.984615f, 0.984648f, 0.984682f, 0.984715f,
- 0.984748f, 0.984782f, 0.984815f, 0.984848f, 0.984882f, 0.984915f, 0.984948f, 0.984981f,
- 0.985014f, 0.985047f, 0.985080f, 0.985113f, 0.985146f, 0.985179f, 0.985212f, 0.985245f,
- 0.985278f, 0.985310f, 0.985343f, 0.985376f, 0.985408f, 0.985441f, 0.985474f, 0.985506f,
- 0.985539f, 0.985571f, 0.985604f, 0.985636f, 0.985668f, 0.985701f, 0.985733f, 0.985765f,
- 0.985798f, 0.985830f, 0.985862f, 0.985894f, 0.985926f, 0.985958f, 0.985990f, 0.986022f,
- 0.986054f, 0.986086f, 0.986118f, 0.986150f, 0.986181f, 0.986213f, 0.986245f, 0.986276f,
- 0.986308f, 0.986340f, 0.986371f, 0.986403f, 0.986434f, 0.986466f, 0.986497f, 0.986529f,
- 0.986560f, 0.986591f, 0.986623f, 0.986654f, 0.986685f, 0.986716f, 0.986747f, 0.986778f,
- 0.986809f, 0.986840f, 0.986871f, 0.986902f, 0.986933f, 0.986964f, 0.986995f, 0.987026f,
- 0.987057f, 0.987087f, 0.987118f, 0.987149f, 0.987179f, 0.987210f, 0.987240f, 0.987271f,
- 0.987301f, 0.987332f, 0.987362f, 0.987393f, 0.987423f, 0.987453f, 0.987484f, 0.987514f,
- 0.987544f, 0.987574f, 0.987604f, 0.987634f, 0.987664f, 0.987694f, 0.987724f, 0.987754f,
- 0.987784f, 0.987814f, 0.987844f, 0.987874f, 0.987903f, 0.987933f, 0.987963f, 0.987992f,
- 0.988022f, 0.988052f, 0.988081f, 0.988111f, 0.988140f, 0.988169f, 0.988199f, 0.988228f,
- 0.988258f, 0.988287f, 0.988316f, 0.988345f, 0.988374f, 0.988404f, 0.988433f, 0.988462f,
- 0.988491f, 0.988520f, 0.988549f, 0.988578f, 0.988607f, 0.988635f, 0.988664f, 0.988693f,
- 0.988722f, 0.988750f, 0.988779f, 0.988808f, 0.988836f, 0.988865f, 0.988893f, 0.988922f,
- 0.988950f, 0.988979f, 0.989007f, 0.989035f, 0.989064f, 0.989092f, 0.989120f, 0.989148f,
- 0.989177f, 0.989205f, 0.989233f, 0.989261f, 0.989289f, 0.989317f, 0.989345f, 0.989373f,
- 0.989400f, 0.989428f, 0.989456f, 0.989484f, 0.989511f, 0.989539f, 0.989567f, 0.989594f,
- 0.989622f, 0.989650f, 0.989677f, 0.989704f, 0.989732f, 0.989759f, 0.989787f, 0.989814f,
- 0.989841f, 0.989869f, 0.989896f, 0.989923f, 0.989950f, 0.989977f, 0.990004f, 0.990031f,
- 0.990058f, 0.990085f, 0.990112f, 0.990139f, 0.990166f, 0.990193f, 0.990219f, 0.990246f,
- 0.990273f, 0.990299f, 0.990326f, 0.990353f, 0.990379f, 0.990406f, 0.990432f, 0.990459f,
- 0.990485f, 0.990511f, 0.990538f, 0.990564f, 0.990590f, 0.990617f, 0.990643f, 0.990669f,
- 0.990695f, 0.990721f, 0.990747f, 0.990773f, 0.990799f, 0.990825f, 0.990851f, 0.990877f,
- 0.990903f, 0.990928f, 0.990954f, 0.990980f, 0.991006f, 0.991031f, 0.991057f, 0.991082f,
- 0.991108f, 0.991133f, 0.991159f, 0.991184f, 0.991210f, 0.991235f, 0.991260f, 0.991286f,
- 0.991311f, 0.991336f, 0.991361f, 0.991386f, 0.991411f, 0.991437f, 0.991462f, 0.991487f,
- 0.991511f, 0.991536f, 0.991561f, 0.991586f, 0.991611f, 0.991636f, 0.991660f, 0.991685f,
- 0.991710f, 0.991734f, 0.991759f, 0.991783f, 0.991808f, 0.991832f, 0.991857f, 0.991881f,
- 0.991906f, 0.991930f, 0.991954f, 0.991979f, 0.992003f, 0.992027f, 0.992051f, 0.992075f,
- 0.992099f, 0.992123f, 0.992147f, 0.992171f, 0.992195f, 0.992219f, 0.992243f, 0.992267f,
- 0.992291f, 0.992314f, 0.992338f, 0.992362f, 0.992385f, 0.992409f, 0.992433f, 0.992456f,
- 0.992480f, 0.992503f, 0.992526f, 0.992550f, 0.992573f, 0.992596f, 0.992620f, 0.992643f,
- 0.992666f, 0.992689f, 0.992712f, 0.992736f, 0.992759f, 0.992782f, 0.992805f, 0.992828f,
- 0.992850f, 0.992873f, 0.992896f, 0.992919f, 0.992942f, 0.992964f, 0.992987f, 0.993010f,
- 0.993032f, 0.993055f, 0.993077f, 0.993100f, 0.993122f, 0.993145f, 0.993167f, 0.993190f,
- 0.993212f, 0.993234f, 0.993257f, 0.993279f, 0.993301f, 0.993323f, 0.993345f, 0.993367f,
- 0.993389f, 0.993411f, 0.993433f, 0.993455f, 0.993477f, 0.993499f, 0.993521f, 0.993542f,
- 0.993564f, 0.993586f, 0.993608f, 0.993629f, 0.993651f, 0.993672f, 0.993694f, 0.993715f,
- 0.993737f, 0.993758f, 0.993779f, 0.993801f, 0.993822f, 0.993843f, 0.993865f, 0.993886f,
- 0.993907f, 0.993928f, 0.993949f, 0.993970f, 0.993991f, 0.994012f, 0.994033f, 0.994054f,
- 0.994075f, 0.994096f, 0.994116f, 0.994137f, 0.994158f, 0.994179f, 0.994199f, 0.994220f,
- 0.994240f, 0.994261f, 0.994281f, 0.994302f, 0.994322f, 0.994343f, 0.994363f, 0.994383f,
- 0.994404f, 0.994424f, 0.994444f, 0.994464f, 0.994484f, 0.994505f, 0.994525f, 0.994545f,
- 0.994565f, 0.994585f, 0.994604f, 0.994624f, 0.994644f, 0.994664f, 0.994684f, 0.994703f,
- 0.994723f, 0.994743f, 0.994762f, 0.994782f, 0.994802f, 0.994821f, 0.994841f, 0.994860f,
- 0.994879f, 0.994899f, 0.994918f, 0.994937f, 0.994957f, 0.994976f, 0.994995f, 0.995014f,
- 0.995033f, 0.995052f, 0.995071f, 0.995090f, 0.995109f, 0.995128f, 0.995147f, 0.995166f,
- 0.995185f, 0.995203f, 0.995222f, 0.995241f, 0.995260f, 0.995278f, 0.995297f, 0.995315f,
- 0.995334f, 0.995352f, 0.995371f, 0.995389f, 0.995408f, 0.995426f, 0.995444f, 0.995463f,
- 0.995481f, 0.995499f, 0.995517f, 0.995535f, 0.995553f, 0.995571f, 0.995589f, 0.995607f,
- 0.995625f, 0.995643f, 0.995661f, 0.995679f, 0.995697f, 0.995714f, 0.995732f, 0.995750f,
- 0.995767f, 0.995785f, 0.995803f, 0.995820f, 0.995838f, 0.995855f, 0.995872f, 0.995890f,
- 0.995907f, 0.995925f, 0.995942f, 0.995959f, 0.995976f, 0.995993f, 0.996011f, 0.996028f,
- 0.996045f, 0.996062f, 0.996079f, 0.996096f, 0.996113f, 0.996129f, 0.996146f, 0.996163f,
- 0.996180f, 0.996197f, 0.996213f, 0.996230f, 0.996247f, 0.996263f, 0.996280f, 0.996296f,
- 0.996313f, 0.996329f, 0.996345f, 0.996362f, 0.996378f, 0.996394f, 0.996411f, 0.996427f,
- 0.996443f, 0.996459f, 0.996475f, 0.996491f, 0.996507f, 0.996523f, 0.996539f, 0.996555f,
- 0.996571f, 0.996587f, 0.996603f, 0.996619f, 0.996634f, 0.996650f, 0.996666f, 0.996681f,
- 0.996697f, 0.996712f, 0.996728f, 0.996743f, 0.996759f, 0.996774f, 0.996790f, 0.996805f,
- 0.996820f, 0.996836f, 0.996851f, 0.996866f, 0.996881f, 0.996896f, 0.996911f, 0.996926f,
- 0.996941f, 0.996956f, 0.996971f, 0.996986f, 0.997001f, 0.997016f, 0.997031f, 0.997045f,
- 0.997060f, 0.997075f, 0.997089f, 0.997104f, 0.997119f, 0.997133f, 0.997148f, 0.997162f,
- 0.997176f, 0.997191f, 0.997205f, 0.997219f, 0.997234f, 0.997248f, 0.997262f, 0.997276f,
- 0.997290f, 0.997305f, 0.997319f, 0.997333f, 0.997347f, 0.997361f, 0.997374f, 0.997388f,
- 0.997402f, 0.997416f, 0.997430f, 0.997443f, 0.997457f, 0.997471f, 0.997484f, 0.997498f,
- 0.997511f, 0.997525f, 0.997538f, 0.997552f, 0.997565f, 0.997579f, 0.997592f, 0.997605f,
- 0.997618f, 0.997632f, 0.997645f, 0.997658f, 0.997671f, 0.997684f, 0.997697f, 0.997710f,
- 0.997723f, 0.997736f, 0.997749f, 0.997762f, 0.997774f, 0.997787f, 0.997800f, 0.997813f,
- 0.997825f, 0.997838f, 0.997851f, 0.997863f, 0.997876f, 0.997888f, 0.997901f, 0.997913f,
- 0.997925f, 0.997938f, 0.997950f, 0.997962f, 0.997974f, 0.997987f, 0.997999f, 0.998011f,
- 0.998023f, 0.998035f, 0.998047f, 0.998059f, 0.998071f, 0.998083f, 0.998094f, 0.998106f,
- 0.998118f, 0.998130f, 0.998142f, 0.998153f, 0.998165f, 0.998176f, 0.998188f, 0.998200f,
- 0.998211f, 0.998222f, 0.998234f, 0.998245f, 0.998257f, 0.998268f, 0.998279f, 0.998290f,
- 0.998302f, 0.998313f, 0.998324f, 0.998335f, 0.998346f, 0.998357f, 0.998368f, 0.998379f,
- 0.998390f, 0.998401f, 0.998411f, 0.998422f, 0.998433f, 0.998444f, 0.998454f, 0.998465f,
- 0.998476f, 0.998486f, 0.998497f, 0.998507f, 0.998518f, 0.998528f, 0.998538f, 0.998549f,
- 0.998559f, 0.998569f, 0.998580f, 0.998590f, 0.998600f, 0.998610f, 0.998620f, 0.998630f,
- 0.998640f, 0.998650f, 0.998660f, 0.998670f, 0.998680f, 0.998690f, 0.998700f, 0.998709f,
- 0.998719f, 0.998729f, 0.998738f, 0.998748f, 0.998758f, 0.998767f, 0.998777f, 0.998786f,
- 0.998795f, 0.998805f, 0.998814f, 0.998824f, 0.998833f, 0.998842f, 0.998851f, 0.998860f,
- 0.998870f, 0.998879f, 0.998888f, 0.998897f, 0.998906f, 0.998915f, 0.998924f, 0.998932f,
- 0.998941f, 0.998950f, 0.998959f, 0.998968f, 0.998976f, 0.998985f, 0.998994f, 0.999002f,
- 0.999011f, 0.999019f, 0.999028f, 0.999036f, 0.999044f, 0.999053f, 0.999061f, 0.999069f,
- 0.999078f, 0.999086f, 0.999094f, 0.999102f, 0.999110f, 0.999118f, 0.999126f, 0.999134f,
- 0.999142f, 0.999150f, 0.999158f, 0.999166f, 0.999174f, 0.999182f, 0.999189f, 0.999197f,
- 0.999205f, 0.999212f, 0.999220f, 0.999228f, 0.999235f, 0.999243f, 0.999250f, 0.999257f,
- 0.999265f, 0.999272f, 0.999279f, 0.999287f, 0.999294f, 0.999301f, 0.999308f, 0.999315f,
- 0.999322f, 0.999329f, 0.999336f, 0.999343f, 0.999350f, 0.999357f, 0.999364f, 0.999371f,
- 0.999378f, 0.999384f, 0.999391f, 0.999398f, 0.999404f, 0.999411f, 0.999418f, 0.999424f,
- 0.999431f, 0.999437f, 0.999443f, 0.999450f, 0.999456f, 0.999462f, 0.999469f, 0.999475f,
- 0.999481f, 0.999487f, 0.999493f, 0.999500f, 0.999506f, 0.999512f, 0.999518f, 0.999524f,
- 0.999529f, 0.999535f, 0.999541f, 0.999547f, 0.999553f, 0.999558f, 0.999564f, 0.999570f,
- 0.999575f, 0.999581f, 0.999586f, 0.999592f, 0.999597f, 0.999603f, 0.999608f, 0.999614f,
- 0.999619f, 0.999624f, 0.999629f, 0.999635f, 0.999640f, 0.999645f, 0.999650f, 0.999655f,
- 0.999660f, 0.999665f, 0.999670f, 0.999675f, 0.999680f, 0.999685f, 0.999689f, 0.999694f,
- 0.999699f, 0.999704f, 0.999708f, 0.999713f, 0.999717f, 0.999722f, 0.999726f, 0.999731f,
- 0.999735f, 0.999740f, 0.999744f, 0.999748f, 0.999753f, 0.999757f, 0.999761f, 0.999765f,
- 0.999769f, 0.999774f, 0.999778f, 0.999782f, 0.999786f, 0.999790f, 0.999793f, 0.999797f,
- 0.999801f, 0.999805f, 0.999809f, 0.999812f, 0.999816f, 0.999820f, 0.999823f, 0.999827f,
- 0.999831f, 0.999834f, 0.999838f, 0.999841f, 0.999844f, 0.999848f, 0.999851f, 0.999854f,
- 0.999858f, 0.999861f, 0.999864f, 0.999867f, 0.999870f, 0.999873f, 0.999876f, 0.999879f,
- 0.999882f, 0.999885f, 0.999888f, 0.999891f, 0.999894f, 0.999897f, 0.999899f, 0.999902f,
- 0.999905f, 0.999907f, 0.999910f, 0.999913f, 0.999915f, 0.999917f, 0.999920f, 0.999922f,
- 0.999925f, 0.999927f, 0.999929f, 0.999932f, 0.999934f, 0.999936f, 0.999938f, 0.999940f,
- 0.999942f, 0.999944f, 0.999946f, 0.999948f, 0.999950f, 0.999952f, 0.999954f, 0.999956f,
- 0.999958f, 0.999959f, 0.999961f, 0.999963f, 0.999964f, 0.999966f, 0.999968f, 0.999969f,
- 0.999971f, 0.999972f, 0.999973f, 0.999975f, 0.999976f, 0.999977f, 0.999979f, 0.999980f,
- 0.999981f, 0.999982f, 0.999983f, 0.999985f, 0.999986f, 0.999987f, 0.999988f, 0.999988f,
- 0.999989f, 0.999990f, 0.999991f, 0.999992f, 0.999993f, 0.999993f, 0.999994f, 0.999995f,
- 0.999995f, 0.999996f, 0.999996f, 0.999997f, 0.999997f, 0.999998f, 0.999998f, 0.999999f,
- 0.999999f, 0.999999f, 0.999999f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f
-};
-
-static const float cosTable65536[32768] = {
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f,
- 0.999999f, 0.999999f, 0.999999f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, 0.999998f,
- 0.999997f, 0.999997f, 0.999997f, 0.999997f, 0.999996f, 0.999996f, 0.999996f, 0.999996f,
- 0.999995f, 0.999995f, 0.999995f, 0.999994f, 0.999994f, 0.999994f, 0.999993f, 0.999993f,
- 0.999993f, 0.999992f, 0.999992f, 0.999991f, 0.999991f, 0.999991f, 0.999990f, 0.999990f,
- 0.999989f, 0.999989f, 0.999988f, 0.999988f, 0.999988f, 0.999987f, 0.999987f, 0.999986f,
- 0.999986f, 0.999985f, 0.999985f, 0.999984f, 0.999983f, 0.999983f, 0.999982f, 0.999982f,
- 0.999981f, 0.999981f, 0.999980f, 0.999979f, 0.999979f, 0.999978f, 0.999977f, 0.999977f,
- 0.999976f, 0.999976f, 0.999975f, 0.999974f, 0.999973f, 0.999973f, 0.999972f, 0.999971f,
- 0.999971f, 0.999970f, 0.999969f, 0.999968f, 0.999968f, 0.999967f, 0.999966f, 0.999965f,
- 0.999964f, 0.999964f, 0.999963f, 0.999962f, 0.999961f, 0.999960f, 0.999959f, 0.999959f,
- 0.999958f, 0.999957f, 0.999956f, 0.999955f, 0.999954f, 0.999953f, 0.999952f, 0.999951f,
- 0.999950f, 0.999949f, 0.999948f, 0.999947f, 0.999946f, 0.999945f, 0.999944f, 0.999943f,
- 0.999942f, 0.999941f, 0.999940f, 0.999939f, 0.999938f, 0.999937f, 0.999936f, 0.999935f,
- 0.999934f, 0.999933f, 0.999932f, 0.999930f, 0.999929f, 0.999928f, 0.999927f, 0.999926f,
- 0.999925f, 0.999924f, 0.999922f, 0.999921f, 0.999920f, 0.999919f, 0.999917f, 0.999916f,
- 0.999915f, 0.999914f, 0.999913f, 0.999911f, 0.999910f, 0.999909f, 0.999907f, 0.999906f,
- 0.999905f, 0.999903f, 0.999902f, 0.999901f, 0.999899f, 0.999898f, 0.999897f, 0.999895f,
- 0.999894f, 0.999892f, 0.999891f, 0.999890f, 0.999888f, 0.999887f, 0.999885f, 0.999884f,
- 0.999882f, 0.999881f, 0.999879f, 0.999878f, 0.999876f, 0.999875f, 0.999873f, 0.999872f,
- 0.999870f, 0.999869f, 0.999867f, 0.999866f, 0.999864f, 0.999862f, 0.999861f, 0.999859f,
- 0.999858f, 0.999856f, 0.999854f, 0.999853f, 0.999851f, 0.999849f, 0.999848f, 0.999846f,
- 0.999844f, 0.999843f, 0.999841f, 0.999839f, 0.999838f, 0.999836f, 0.999834f, 0.999832f,
- 0.999831f, 0.999829f, 0.999827f, 0.999825f, 0.999823f, 0.999822f, 0.999820f, 0.999818f,
- 0.999816f, 0.999814f, 0.999812f, 0.999811f, 0.999809f, 0.999807f, 0.999805f, 0.999803f,
- 0.999801f, 0.999799f, 0.999797f, 0.999795f, 0.999793f, 0.999792f, 0.999790f, 0.999788f,
- 0.999786f, 0.999784f, 0.999782f, 0.999780f, 0.999778f, 0.999776f, 0.999774f, 0.999771f,
- 0.999769f, 0.999767f, 0.999765f, 0.999763f, 0.999761f, 0.999759f, 0.999757f, 0.999755f,
- 0.999753f, 0.999750f, 0.999748f, 0.999746f, 0.999744f, 0.999742f, 0.999740f, 0.999738f,
- 0.999735f, 0.999733f, 0.999731f, 0.999729f, 0.999726f, 0.999724f, 0.999722f, 0.999720f,
- 0.999717f, 0.999715f, 0.999713f, 0.999710f, 0.999708f, 0.999706f, 0.999704f, 0.999701f,
- 0.999699f, 0.999696f, 0.999694f, 0.999692f, 0.999689f, 0.999687f, 0.999685f, 0.999682f,
- 0.999680f, 0.999677f, 0.999675f, 0.999672f, 0.999670f, 0.999667f, 0.999665f, 0.999663f,
- 0.999660f, 0.999658f, 0.999655f, 0.999652f, 0.999650f, 0.999647f, 0.999645f, 0.999642f,
- 0.999640f, 0.999637f, 0.999635f, 0.999632f, 0.999629f, 0.999627f, 0.999624f, 0.999621f,
- 0.999619f, 0.999616f, 0.999614f, 0.999611f, 0.999608f, 0.999605f, 0.999603f, 0.999600f,
- 0.999597f, 0.999595f, 0.999592f, 0.999589f, 0.999586f, 0.999584f, 0.999581f, 0.999578f,
- 0.999575f, 0.999573f, 0.999570f, 0.999567f, 0.999564f, 0.999561f, 0.999558f, 0.999556f,
- 0.999553f, 0.999550f, 0.999547f, 0.999544f, 0.999541f, 0.999538f, 0.999535f, 0.999532f,
- 0.999529f, 0.999527f, 0.999524f, 0.999521f, 0.999518f, 0.999515f, 0.999512f, 0.999509f,
- 0.999506f, 0.999503f, 0.999500f, 0.999497f, 0.999493f, 0.999490f, 0.999487f, 0.999484f,
- 0.999481f, 0.999478f, 0.999475f, 0.999472f, 0.999469f, 0.999466f, 0.999462f, 0.999459f,
- 0.999456f, 0.999453f, 0.999450f, 0.999447f, 0.999443f, 0.999440f, 0.999437f, 0.999434f,
- 0.999431f, 0.999427f, 0.999424f, 0.999421f, 0.999418f, 0.999414f, 0.999411f, 0.999408f,
- 0.999404f, 0.999401f, 0.999398f, 0.999394f, 0.999391f, 0.999388f, 0.999384f, 0.999381f,
- 0.999378f, 0.999374f, 0.999371f, 0.999367f, 0.999364f, 0.999361f, 0.999357f, 0.999354f,
- 0.999350f, 0.999347f, 0.999343f, 0.999340f, 0.999336f, 0.999333f, 0.999329f, 0.999326f,
- 0.999322f, 0.999319f, 0.999315f, 0.999312f, 0.999308f, 0.999305f, 0.999301f, 0.999297f,
- 0.999294f, 0.999290f, 0.999287f, 0.999283f, 0.999279f, 0.999276f, 0.999272f, 0.999268f,
- 0.999265f, 0.999261f, 0.999257f, 0.999254f, 0.999250f, 0.999246f, 0.999243f, 0.999239f,
- 0.999235f, 0.999231f, 0.999228f, 0.999224f, 0.999220f, 0.999216f, 0.999212f, 0.999209f,
- 0.999205f, 0.999201f, 0.999197f, 0.999193f, 0.999189f, 0.999186f, 0.999182f, 0.999178f,
- 0.999174f, 0.999170f, 0.999166f, 0.999162f, 0.999158f, 0.999154f, 0.999150f, 0.999146f,
- 0.999142f, 0.999138f, 0.999134f, 0.999130f, 0.999126f, 0.999122f, 0.999118f, 0.999114f,
- 0.999110f, 0.999106f, 0.999102f, 0.999098f, 0.999094f, 0.999090f, 0.999086f, 0.999082f,
- 0.999078f, 0.999074f, 0.999069f, 0.999065f, 0.999061f, 0.999057f, 0.999053f, 0.999049f,
- 0.999044f, 0.999040f, 0.999036f, 0.999032f, 0.999028f, 0.999023f, 0.999019f, 0.999015f,
- 0.999011f, 0.999006f, 0.999002f, 0.998998f, 0.998994f, 0.998989f, 0.998985f, 0.998981f,
- 0.998976f, 0.998972f, 0.998968f, 0.998963f, 0.998959f, 0.998954f, 0.998950f, 0.998946f,
- 0.998941f, 0.998937f, 0.998932f, 0.998928f, 0.998924f, 0.998919f, 0.998915f, 0.998910f,
- 0.998906f, 0.998901f, 0.998897f, 0.998892f, 0.998888f, 0.998883f, 0.998879f, 0.998874f,
- 0.998870f, 0.998865f, 0.998860f, 0.998856f, 0.998851f, 0.998847f, 0.998842f, 0.998837f,
- 0.998833f, 0.998828f, 0.998824f, 0.998819f, 0.998814f, 0.998810f, 0.998805f, 0.998800f,
- 0.998795f, 0.998791f, 0.998786f, 0.998781f, 0.998777f, 0.998772f, 0.998767f, 0.998762f,
- 0.998758f, 0.998753f, 0.998748f, 0.998743f, 0.998738f, 0.998734f, 0.998729f, 0.998724f,
- 0.998719f, 0.998714f, 0.998709f, 0.998704f, 0.998700f, 0.998695f, 0.998690f, 0.998685f,
- 0.998680f, 0.998675f, 0.998670f, 0.998665f, 0.998660f, 0.998655f, 0.998650f, 0.998645f,
- 0.998640f, 0.998635f, 0.998630f, 0.998625f, 0.998620f, 0.998615f, 0.998610f, 0.998605f,
- 0.998600f, 0.998595f, 0.998590f, 0.998585f, 0.998580f, 0.998574f, 0.998569f, 0.998564f,
- 0.998559f, 0.998554f, 0.998549f, 0.998544f, 0.998538f, 0.998533f, 0.998528f, 0.998523f,
- 0.998518f, 0.998512f, 0.998507f, 0.998502f, 0.998497f, 0.998491f, 0.998486f, 0.998481f,
- 0.998476f, 0.998470f, 0.998465f, 0.998460f, 0.998454f, 0.998449f, 0.998444f, 0.998438f,
- 0.998433f, 0.998428f, 0.998422f, 0.998417f, 0.998411f, 0.998406f, 0.998401f, 0.998395f,
- 0.998390f, 0.998384f, 0.998379f, 0.998373f, 0.998368f, 0.998362f, 0.998357f, 0.998351f,
- 0.998346f, 0.998340f, 0.998335f, 0.998329f, 0.998324f, 0.998318f, 0.998313f, 0.998307f,
- 0.998302f, 0.998296f, 0.998290f, 0.998285f, 0.998279f, 0.998273f, 0.998268f, 0.998262f,
- 0.998257f, 0.998251f, 0.998245f, 0.998240f, 0.998234f, 0.998228f, 0.998222f, 0.998217f,
- 0.998211f, 0.998205f, 0.998200f, 0.998194f, 0.998188f, 0.998182f, 0.998176f, 0.998171f,
- 0.998165f, 0.998159f, 0.998153f, 0.998147f, 0.998142f, 0.998136f, 0.998130f, 0.998124f,
- 0.998118f, 0.998112f, 0.998106f, 0.998100f, 0.998094f, 0.998089f, 0.998083f, 0.998077f,
- 0.998071f, 0.998065f, 0.998059f, 0.998053f, 0.998047f, 0.998041f, 0.998035f, 0.998029f,
- 0.998023f, 0.998017f, 0.998011f, 0.998005f, 0.997999f, 0.997993f, 0.997987f, 0.997980f,
- 0.997974f, 0.997968f, 0.997962f, 0.997956f, 0.997950f, 0.997944f, 0.997938f, 0.997931f,
- 0.997925f, 0.997919f, 0.997913f, 0.997907f, 0.997901f, 0.997894f, 0.997888f, 0.997882f,
- 0.997876f, 0.997869f, 0.997863f, 0.997857f, 0.997851f, 0.997844f, 0.997838f, 0.997832f,
- 0.997825f, 0.997819f, 0.997813f, 0.997806f, 0.997800f, 0.997794f, 0.997787f, 0.997781f,
- 0.997774f, 0.997768f, 0.997762f, 0.997755f, 0.997749f, 0.997742f, 0.997736f, 0.997730f,
- 0.997723f, 0.997717f, 0.997710f, 0.997704f, 0.997697f, 0.997691f, 0.997684f, 0.997678f,
- 0.997671f, 0.997665f, 0.997658f, 0.997651f, 0.997645f, 0.997638f, 0.997632f, 0.997625f,
- 0.997618f, 0.997612f, 0.997605f, 0.997599f, 0.997592f, 0.997585f, 0.997579f, 0.997572f,
- 0.997565f, 0.997559f, 0.997552f, 0.997545f, 0.997538f, 0.997532f, 0.997525f, 0.997518f,
- 0.997511f, 0.997505f, 0.997498f, 0.997491f, 0.997484f, 0.997478f, 0.997471f, 0.997464f,
- 0.997457f, 0.997450f, 0.997443f, 0.997437f, 0.997430f, 0.997423f, 0.997416f, 0.997409f,
- 0.997402f, 0.997395f, 0.997388f, 0.997381f, 0.997374f, 0.997368f, 0.997361f, 0.997354f,
- 0.997347f, 0.997340f, 0.997333f, 0.997326f, 0.997319f, 0.997312f, 0.997305f, 0.997298f,
- 0.997290f, 0.997283f, 0.997276f, 0.997269f, 0.997262f, 0.997255f, 0.997248f, 0.997241f,
- 0.997234f, 0.997227f, 0.997219f, 0.997212f, 0.997205f, 0.997198f, 0.997191f, 0.997184f,
- 0.997176f, 0.997169f, 0.997162f, 0.997155f, 0.997148f, 0.997140f, 0.997133f, 0.997126f,
- 0.997119f, 0.997111f, 0.997104f, 0.997097f, 0.997089f, 0.997082f, 0.997075f, 0.997067f,
- 0.997060f, 0.997053f, 0.997045f, 0.997038f, 0.997031f, 0.997023f, 0.997016f, 0.997008f,
- 0.997001f, 0.996994f, 0.996986f, 0.996979f, 0.996971f, 0.996964f, 0.996956f, 0.996949f,
- 0.996941f, 0.996934f, 0.996926f, 0.996919f, 0.996911f, 0.996904f, 0.996896f, 0.996889f,
- 0.996881f, 0.996874f, 0.996866f, 0.996858f, 0.996851f, 0.996843f, 0.996836f, 0.996828f,
- 0.996820f, 0.996813f, 0.996805f, 0.996797f, 0.996790f, 0.996782f, 0.996774f, 0.996767f,
- 0.996759f, 0.996751f, 0.996743f, 0.996736f, 0.996728f, 0.996720f, 0.996712f, 0.996705f,
- 0.996697f, 0.996689f, 0.996681f, 0.996674f, 0.996666f, 0.996658f, 0.996650f, 0.996642f,
- 0.996634f, 0.996626f, 0.996619f, 0.996611f, 0.996603f, 0.996595f, 0.996587f, 0.996579f,
- 0.996571f, 0.996563f, 0.996555f, 0.996547f, 0.996539f, 0.996531f, 0.996523f, 0.996515f,
- 0.996507f, 0.996499f, 0.996491f, 0.996483f, 0.996475f, 0.996467f, 0.996459f, 0.996451f,
- 0.996443f, 0.996435f, 0.996427f, 0.996419f, 0.996411f, 0.996403f, 0.996394f, 0.996386f,
- 0.996378f, 0.996370f, 0.996362f, 0.996354f, 0.996345f, 0.996337f, 0.996329f, 0.996321f,
- 0.996313f, 0.996304f, 0.996296f, 0.996288f, 0.996280f, 0.996271f, 0.996263f, 0.996255f,
- 0.996247f, 0.996238f, 0.996230f, 0.996222f, 0.996213f, 0.996205f, 0.996197f, 0.996188f,
- 0.996180f, 0.996171f, 0.996163f, 0.996155f, 0.996146f, 0.996138f, 0.996129f, 0.996121f,
- 0.996113f, 0.996104f, 0.996096f, 0.996087f, 0.996079f, 0.996070f, 0.996062f, 0.996053f,
- 0.996045f, 0.996036f, 0.996028f, 0.996019f, 0.996011f, 0.996002f, 0.995993f, 0.995985f,
- 0.995976f, 0.995968f, 0.995959f, 0.995950f, 0.995942f, 0.995933f, 0.995925f, 0.995916f,
- 0.995907f, 0.995899f, 0.995890f, 0.995881f, 0.995872f, 0.995864f, 0.995855f, 0.995846f,
- 0.995838f, 0.995829f, 0.995820f, 0.995811f, 0.995803f, 0.995794f, 0.995785f, 0.995776f,
- 0.995767f, 0.995759f, 0.995750f, 0.995741f, 0.995732f, 0.995723f, 0.995714f, 0.995705f,
- 0.995697f, 0.995688f, 0.995679f, 0.995670f, 0.995661f, 0.995652f, 0.995643f, 0.995634f,
- 0.995625f, 0.995616f, 0.995607f, 0.995598f, 0.995589f, 0.995580f, 0.995571f, 0.995562f,
- 0.995553f, 0.995544f, 0.995535f, 0.995526f, 0.995517f, 0.995508f, 0.995499f, 0.995490f,
- 0.995481f, 0.995472f, 0.995463f, 0.995453f, 0.995444f, 0.995435f, 0.995426f, 0.995417f,
- 0.995408f, 0.995398f, 0.995389f, 0.995380f, 0.995371f, 0.995362f, 0.995352f, 0.995343f,
- 0.995334f, 0.995325f, 0.995315f, 0.995306f, 0.995297f, 0.995288f, 0.995278f, 0.995269f,
- 0.995260f, 0.995250f, 0.995241f, 0.995232f, 0.995222f, 0.995213f, 0.995203f, 0.995194f,
- 0.995185f, 0.995175f, 0.995166f, 0.995156f, 0.995147f, 0.995138f, 0.995128f, 0.995119f,
- 0.995109f, 0.995100f, 0.995090f, 0.995081f, 0.995071f, 0.995062f, 0.995052f, 0.995043f,
- 0.995033f, 0.995024f, 0.995014f, 0.995005f, 0.994995f, 0.994985f, 0.994976f, 0.994966f,
- 0.994957f, 0.994947f, 0.994937f, 0.994928f, 0.994918f, 0.994908f, 0.994899f, 0.994889f,
- 0.994879f, 0.994870f, 0.994860f, 0.994850f, 0.994841f, 0.994831f, 0.994821f, 0.994811f,
- 0.994802f, 0.994792f, 0.994782f, 0.994772f, 0.994762f, 0.994753f, 0.994743f, 0.994733f,
- 0.994723f, 0.994713f, 0.994703f, 0.994694f, 0.994684f, 0.994674f, 0.994664f, 0.994654f,
- 0.994644f, 0.994634f, 0.994624f, 0.994614f, 0.994604f, 0.994594f, 0.994585f, 0.994575f,
- 0.994565f, 0.994555f, 0.994545f, 0.994535f, 0.994525f, 0.994515f, 0.994505f, 0.994494f,
- 0.994484f, 0.994474f, 0.994464f, 0.994454f, 0.994444f, 0.994434f, 0.994424f, 0.994414f,
- 0.994404f, 0.994394f, 0.994383f, 0.994373f, 0.994363f, 0.994353f, 0.994343f, 0.994333f,
- 0.994322f, 0.994312f, 0.994302f, 0.994292f, 0.994281f, 0.994271f, 0.994261f, 0.994251f,
- 0.994240f, 0.994230f, 0.994220f, 0.994210f, 0.994199f, 0.994189f, 0.994179f, 0.994168f,
- 0.994158f, 0.994148f, 0.994137f, 0.994127f, 0.994116f, 0.994106f, 0.994096f, 0.994085f,
- 0.994075f, 0.994064f, 0.994054f, 0.994044f, 0.994033f, 0.994023f, 0.994012f, 0.994002f,
- 0.993991f, 0.993981f, 0.993970f, 0.993960f, 0.993949f, 0.993939f, 0.993928f, 0.993918f,
- 0.993907f, 0.993896f, 0.993886f, 0.993875f, 0.993865f, 0.993854f, 0.993843f, 0.993833f,
- 0.993822f, 0.993811f, 0.993801f, 0.993790f, 0.993779f, 0.993769f, 0.993758f, 0.993747f,
- 0.993737f, 0.993726f, 0.993715f, 0.993705f, 0.993694f, 0.993683f, 0.993672f, 0.993662f,
- 0.993651f, 0.993640f, 0.993629f, 0.993618f, 0.993608f, 0.993597f, 0.993586f, 0.993575f,
- 0.993564f, 0.993553f, 0.993542f, 0.993532f, 0.993521f, 0.993510f, 0.993499f, 0.993488f,
- 0.993477f, 0.993466f, 0.993455f, 0.993444f, 0.993433f, 0.993422f, 0.993411f, 0.993400f,
- 0.993389f, 0.993378f, 0.993367f, 0.993356f, 0.993345f, 0.993334f, 0.993323f, 0.993312f,
- 0.993301f, 0.993290f, 0.993279f, 0.993268f, 0.993257f, 0.993245f, 0.993234f, 0.993223f,
- 0.993212f, 0.993201f, 0.993190f, 0.993178f, 0.993167f, 0.993156f, 0.993145f, 0.993134f,
- 0.993122f, 0.993111f, 0.993100f, 0.993089f, 0.993077f, 0.993066f, 0.993055f, 0.993044f,
- 0.993032f, 0.993021f, 0.993010f, 0.992998f, 0.992987f, 0.992976f, 0.992964f, 0.992953f,
- 0.992942f, 0.992930f, 0.992919f, 0.992908f, 0.992896f, 0.992885f, 0.992873f, 0.992862f,
- 0.992850f, 0.992839f, 0.992828f, 0.992816f, 0.992805f, 0.992793f, 0.992782f, 0.992770f,
- 0.992759f, 0.992747f, 0.992736f, 0.992724f, 0.992712f, 0.992701f, 0.992689f, 0.992678f,
- 0.992666f, 0.992655f, 0.992643f, 0.992631f, 0.992620f, 0.992608f, 0.992596f, 0.992585f,
- 0.992573f, 0.992561f, 0.992550f, 0.992538f, 0.992526f, 0.992515f, 0.992503f, 0.992491f,
- 0.992480f, 0.992468f, 0.992456f, 0.992444f, 0.992433f, 0.992421f, 0.992409f, 0.992397f,
- 0.992385f, 0.992374f, 0.992362f, 0.992350f, 0.992338f, 0.992326f, 0.992314f, 0.992302f,
- 0.992291f, 0.992279f, 0.992267f, 0.992255f, 0.992243f, 0.992231f, 0.992219f, 0.992207f,
- 0.992195f, 0.992183f, 0.992171f, 0.992159f, 0.992147f, 0.992135f, 0.992123f, 0.992111f,
- 0.992099f, 0.992087f, 0.992075f, 0.992063f, 0.992051f, 0.992039f, 0.992027f, 0.992015f,
- 0.992003f, 0.991991f, 0.991979f, 0.991966f, 0.991954f, 0.991942f, 0.991930f, 0.991918f,
- 0.991906f, 0.991894f, 0.991881f, 0.991869f, 0.991857f, 0.991845f, 0.991832f, 0.991820f,
- 0.991808f, 0.991796f, 0.991783f, 0.991771f, 0.991759f, 0.991747f, 0.991734f, 0.991722f,
- 0.991710f, 0.991697f, 0.991685f, 0.991673f, 0.991660f, 0.991648f, 0.991636f, 0.991623f,
- 0.991611f, 0.991598f, 0.991586f, 0.991574f, 0.991561f, 0.991549f, 0.991536f, 0.991524f,
- 0.991511f, 0.991499f, 0.991487f, 0.991474f, 0.991462f, 0.991449f, 0.991437f, 0.991424f,
- 0.991411f, 0.991399f, 0.991386f, 0.991374f, 0.991361f, 0.991349f, 0.991336f, 0.991323f,
- 0.991311f, 0.991298f, 0.991286f, 0.991273f, 0.991260f, 0.991248f, 0.991235f, 0.991222f,
- 0.991210f, 0.991197f, 0.991184f, 0.991172f, 0.991159f, 0.991146f, 0.991133f, 0.991121f,
- 0.991108f, 0.991095f, 0.991082f, 0.991070f, 0.991057f, 0.991044f, 0.991031f, 0.991018f,
- 0.991006f, 0.990993f, 0.990980f, 0.990967f, 0.990954f, 0.990941f, 0.990928f, 0.990916f,
- 0.990903f, 0.990890f, 0.990877f, 0.990864f, 0.990851f, 0.990838f, 0.990825f, 0.990812f,
- 0.990799f, 0.990786f, 0.990773f, 0.990760f, 0.990747f, 0.990734f, 0.990721f, 0.990708f,
- 0.990695f, 0.990682f, 0.990669f, 0.990656f, 0.990643f, 0.990630f, 0.990617f, 0.990603f,
- 0.990590f, 0.990577f, 0.990564f, 0.990551f, 0.990538f, 0.990525f, 0.990511f, 0.990498f,
- 0.990485f, 0.990472f, 0.990459f, 0.990445f, 0.990432f, 0.990419f, 0.990406f, 0.990393f,
- 0.990379f, 0.990366f, 0.990353f, 0.990339f, 0.990326f, 0.990313f, 0.990299f, 0.990286f,
- 0.990273f, 0.990259f, 0.990246f, 0.990233f, 0.990219f, 0.990206f, 0.990193f, 0.990179f,
- 0.990166f, 0.990152f, 0.990139f, 0.990126f, 0.990112f, 0.990099f, 0.990085f, 0.990072f,
- 0.990058f, 0.990045f, 0.990031f, 0.990018f, 0.990004f, 0.989991f, 0.989977f, 0.989964f,
- 0.989950f, 0.989936f, 0.989923f, 0.989909f, 0.989896f, 0.989882f, 0.989869f, 0.989855f,
- 0.989841f, 0.989828f, 0.989814f, 0.989800f, 0.989787f, 0.989773f, 0.989759f, 0.989746f,
- 0.989732f, 0.989718f, 0.989704f, 0.989691f, 0.989677f, 0.989663f, 0.989650f, 0.989636f,
- 0.989622f, 0.989608f, 0.989594f, 0.989581f, 0.989567f, 0.989553f, 0.989539f, 0.989525f,
- 0.989511f, 0.989498f, 0.989484f, 0.989470f, 0.989456f, 0.989442f, 0.989428f, 0.989414f,
- 0.989400f, 0.989386f, 0.989373f, 0.989359f, 0.989345f, 0.989331f, 0.989317f, 0.989303f,
- 0.989289f, 0.989275f, 0.989261f, 0.989247f, 0.989233f, 0.989219f, 0.989205f, 0.989191f,
- 0.989177f, 0.989162f, 0.989148f, 0.989134f, 0.989120f, 0.989106f, 0.989092f, 0.989078f,
- 0.989064f, 0.989050f, 0.989035f, 0.989021f, 0.989007f, 0.988993f, 0.988979f, 0.988964f,
- 0.988950f, 0.988936f, 0.988922f, 0.988908f, 0.988893f, 0.988879f, 0.988865f, 0.988851f,
- 0.988836f, 0.988822f, 0.988808f, 0.988793f, 0.988779f, 0.988765f, 0.988750f, 0.988736f,
- 0.988722f, 0.988707f, 0.988693f, 0.988679f, 0.988664f, 0.988650f, 0.988635f, 0.988621f,
- 0.988607f, 0.988592f, 0.988578f, 0.988563f, 0.988549f, 0.988534f, 0.988520f, 0.988505f,
- 0.988491f, 0.988476f, 0.988462f, 0.988447f, 0.988433f, 0.988418f, 0.988404f, 0.988389f,
- 0.988374f, 0.988360f, 0.988345f, 0.988331f, 0.988316f, 0.988301f, 0.988287f, 0.988272f,
- 0.988258f, 0.988243f, 0.988228f, 0.988214f, 0.988199f, 0.988184f, 0.988169f, 0.988155f,
- 0.988140f, 0.988125f, 0.988111f, 0.988096f, 0.988081f, 0.988066f, 0.988052f, 0.988037f,
- 0.988022f, 0.988007f, 0.987992f, 0.987978f, 0.987963f, 0.987948f, 0.987933f, 0.987918f,
- 0.987903f, 0.987889f, 0.987874f, 0.987859f, 0.987844f, 0.987829f, 0.987814f, 0.987799f,
- 0.987784f, 0.987769f, 0.987754f, 0.987739f, 0.987724f, 0.987709f, 0.987694f, 0.987679f,
- 0.987664f, 0.987649f, 0.987634f, 0.987619f, 0.987604f, 0.987589f, 0.987574f, 0.987559f,
- 0.987544f, 0.987529f, 0.987514f, 0.987499f, 0.987484f, 0.987468f, 0.987453f, 0.987438f,
- 0.987423f, 0.987408f, 0.987393f, 0.987377f, 0.987362f, 0.987347f, 0.987332f, 0.987317f,
- 0.987301f, 0.987286f, 0.987271f, 0.987256f, 0.987240f, 0.987225f, 0.987210f, 0.987195f,
- 0.987179f, 0.987164f, 0.987149f, 0.987133f, 0.987118f, 0.987103f, 0.987087f, 0.987072f,
- 0.987057f, 0.987041f, 0.987026f, 0.987010f, 0.986995f, 0.986980f, 0.986964f, 0.986949f,
- 0.986933f, 0.986918f, 0.986902f, 0.986887f, 0.986871f, 0.986856f, 0.986840f, 0.986825f,
- 0.986809f, 0.986794f, 0.986778f, 0.986763f, 0.986747f, 0.986732f, 0.986716f, 0.986701f,
- 0.986685f, 0.986669f, 0.986654f, 0.986638f, 0.986623f, 0.986607f, 0.986591f, 0.986576f,
- 0.986560f, 0.986544f, 0.986529f, 0.986513f, 0.986497f, 0.986481f, 0.986466f, 0.986450f,
- 0.986434f, 0.986419f, 0.986403f, 0.986387f, 0.986371f, 0.986355f, 0.986340f, 0.986324f,
- 0.986308f, 0.986292f, 0.986276f, 0.986261f, 0.986245f, 0.986229f, 0.986213f, 0.986197f,
- 0.986181f, 0.986165f, 0.986150f, 0.986134f, 0.986118f, 0.986102f, 0.986086f, 0.986070f,
- 0.986054f, 0.986038f, 0.986022f, 0.986006f, 0.985990f, 0.985974f, 0.985958f, 0.985942f,
- 0.985926f, 0.985910f, 0.985894f, 0.985878f, 0.985862f, 0.985846f, 0.985830f, 0.985814f,
- 0.985798f, 0.985781f, 0.985765f, 0.985749f, 0.985733f, 0.985717f, 0.985701f, 0.985685f,
- 0.985668f, 0.985652f, 0.985636f, 0.985620f, 0.985604f, 0.985587f, 0.985571f, 0.985555f,
- 0.985539f, 0.985523f, 0.985506f, 0.985490f, 0.985474f, 0.985457f, 0.985441f, 0.985425f,
- 0.985408f, 0.985392f, 0.985376f, 0.985359f, 0.985343f, 0.985327f, 0.985310f, 0.985294f,
- 0.985278f, 0.985261f, 0.985245f, 0.985228f, 0.985212f, 0.985196f, 0.985179f, 0.985163f,
- 0.985146f, 0.985130f, 0.985113f, 0.985097f, 0.985080f, 0.985064f, 0.985047f, 0.985031f,
- 0.985014f, 0.984998f, 0.984981f, 0.984965f, 0.984948f, 0.984931f, 0.984915f, 0.984898f,
- 0.984882f, 0.984865f, 0.984848f, 0.984832f, 0.984815f, 0.984798f, 0.984782f, 0.984765f,
- 0.984748f, 0.984732f, 0.984715f, 0.984698f, 0.984682f, 0.984665f, 0.984648f, 0.984632f,
- 0.984615f, 0.984598f, 0.984581f, 0.984564f, 0.984548f, 0.984531f, 0.984514f, 0.984497f,
- 0.984480f, 0.984464f, 0.984447f, 0.984430f, 0.984413f, 0.984396f, 0.984379f, 0.984362f,
- 0.984346f, 0.984329f, 0.984312f, 0.984295f, 0.984278f, 0.984261f, 0.984244f, 0.984227f,
- 0.984210f, 0.984193f, 0.984176f, 0.984159f, 0.984142f, 0.984125f, 0.984108f, 0.984091f,
- 0.984074f, 0.984057f, 0.984040f, 0.984023f, 0.984006f, 0.983989f, 0.983972f, 0.983955f,
- 0.983937f, 0.983920f, 0.983903f, 0.983886f, 0.983869f, 0.983852f, 0.983835f, 0.983817f,
- 0.983800f, 0.983783f, 0.983766f, 0.983749f, 0.983731f, 0.983714f, 0.983697f, 0.983680f,
- 0.983662f, 0.983645f, 0.983628f, 0.983611f, 0.983593f, 0.983576f, 0.983559f, 0.983541f,
- 0.983524f, 0.983507f, 0.983489f, 0.983472f, 0.983455f, 0.983437f, 0.983420f, 0.983402f,
- 0.983385f, 0.983368f, 0.983350f, 0.983333f, 0.983315f, 0.983298f, 0.983281f, 0.983263f,
- 0.983246f, 0.983228f, 0.983211f, 0.983193f, 0.983176f, 0.983158f, 0.983141f, 0.983123f,
- 0.983105f, 0.983088f, 0.983070f, 0.983053f, 0.983035f, 0.983018f, 0.983000f, 0.982982f,
- 0.982965f, 0.982947f, 0.982930f, 0.982912f, 0.982894f, 0.982877f, 0.982859f, 0.982841f,
- 0.982824f, 0.982806f, 0.982788f, 0.982770f, 0.982753f, 0.982735f, 0.982717f, 0.982699f,
- 0.982682f, 0.982664f, 0.982646f, 0.982628f, 0.982611f, 0.982593f, 0.982575f, 0.982557f,
- 0.982539f, 0.982521f, 0.982504f, 0.982486f, 0.982468f, 0.982450f, 0.982432f, 0.982414f,
- 0.982396f, 0.982378f, 0.982360f, 0.982343f, 0.982325f, 0.982307f, 0.982289f, 0.982271f,
- 0.982253f, 0.982235f, 0.982217f, 0.982199f, 0.982181f, 0.982163f, 0.982145f, 0.982127f,
- 0.982109f, 0.982091f, 0.982072f, 0.982054f, 0.982036f, 0.982018f, 0.982000f, 0.981982f,
- 0.981964f, 0.981946f, 0.981928f, 0.981909f, 0.981891f, 0.981873f, 0.981855f, 0.981837f,
- 0.981819f, 0.981800f, 0.981782f, 0.981764f, 0.981746f, 0.981727f, 0.981709f, 0.981691f,
- 0.981673f, 0.981654f, 0.981636f, 0.981618f, 0.981600f, 0.981581f, 0.981563f, 0.981545f,
- 0.981526f, 0.981508f, 0.981490f, 0.981471f, 0.981453f, 0.981434f, 0.981416f, 0.981398f,
- 0.981379f, 0.981361f, 0.981342f, 0.981324f, 0.981305f, 0.981287f, 0.981269f, 0.981250f,
- 0.981232f, 0.981213f, 0.981195f, 0.981176f, 0.981158f, 0.981139f, 0.981120f, 0.981102f,
- 0.981083f, 0.981065f, 0.981046f, 0.981028f, 0.981009f, 0.980990f, 0.980972f, 0.980953f,
- 0.980935f, 0.980916f, 0.980897f, 0.980879f, 0.980860f, 0.980841f, 0.980823f, 0.980804f,
- 0.980785f, 0.980767f, 0.980748f, 0.980729f, 0.980710f, 0.980692f, 0.980673f, 0.980654f,
- 0.980635f, 0.980617f, 0.980598f, 0.980579f, 0.980560f, 0.980541f, 0.980523f, 0.980504f,
- 0.980485f, 0.980466f, 0.980447f, 0.980428f, 0.980409f, 0.980390f, 0.980372f, 0.980353f,
- 0.980334f, 0.980315f, 0.980296f, 0.980277f, 0.980258f, 0.980239f, 0.980220f, 0.980201f,
- 0.980182f, 0.980163f, 0.980144f, 0.980125f, 0.980106f, 0.980087f, 0.980068f, 0.980049f,
- 0.980030f, 0.980011f, 0.979992f, 0.979973f, 0.979954f, 0.979934f, 0.979915f, 0.979896f,
- 0.979877f, 0.979858f, 0.979839f, 0.979820f, 0.979800f, 0.979781f, 0.979762f, 0.979743f,
- 0.979724f, 0.979704f, 0.979685f, 0.979666f, 0.979647f, 0.979628f, 0.979608f, 0.979589f,
- 0.979570f, 0.979550f, 0.979531f, 0.979512f, 0.979493f, 0.979473f, 0.979454f, 0.979435f,
- 0.979415f, 0.979396f, 0.979376f, 0.979357f, 0.979338f, 0.979318f, 0.979299f, 0.979280f,
- 0.979260f, 0.979241f, 0.979221f, 0.979202f, 0.979182f, 0.979163f, 0.979143f, 0.979124f,
- 0.979104f, 0.979085f, 0.979065f, 0.979046f, 0.979026f, 0.979007f, 0.978987f, 0.978968f,
- 0.978948f, 0.978929f, 0.978909f, 0.978889f, 0.978870f, 0.978850f, 0.978831f, 0.978811f,
- 0.978791f, 0.978772f, 0.978752f, 0.978732f, 0.978713f, 0.978693f, 0.978673f, 0.978654f,
- 0.978634f, 0.978614f, 0.978594f, 0.978575f, 0.978555f, 0.978535f, 0.978516f, 0.978496f,
- 0.978476f, 0.978456f, 0.978436f, 0.978417f, 0.978397f, 0.978377f, 0.978357f, 0.978337f,
- 0.978317f, 0.978298f, 0.978278f, 0.978258f, 0.978238f, 0.978218f, 0.978198f, 0.978178f,
- 0.978158f, 0.978138f, 0.978118f, 0.978098f, 0.978078f, 0.978058f, 0.978038f, 0.978019f,
- 0.977998f, 0.977979f, 0.977959f, 0.977938f, 0.977918f, 0.977898f, 0.977878f, 0.977858f,
- 0.977838f, 0.977818f, 0.977798f, 0.977778f, 0.977758f, 0.977738f, 0.977718f, 0.977697f,
- 0.977677f, 0.977657f, 0.977637f, 0.977617f, 0.977597f, 0.977577f, 0.977556f, 0.977536f,
- 0.977516f, 0.977496f, 0.977475f, 0.977455f, 0.977435f, 0.977415f, 0.977394f, 0.977374f,
- 0.977354f, 0.977334f, 0.977313f, 0.977293f, 0.977273f, 0.977252f, 0.977232f, 0.977212f,
- 0.977191f, 0.977171f, 0.977151f, 0.977130f, 0.977110f, 0.977089f, 0.977069f, 0.977049f,
- 0.977028f, 0.977008f, 0.976987f, 0.976967f, 0.976946f, 0.976926f, 0.976905f, 0.976885f,
- 0.976864f, 0.976844f, 0.976823f, 0.976803f, 0.976782f, 0.976762f, 0.976741f, 0.976721f,
- 0.976700f, 0.976680f, 0.976659f, 0.976638f, 0.976618f, 0.976597f, 0.976576f, 0.976556f,
- 0.976535f, 0.976515f, 0.976494f, 0.976473f, 0.976453f, 0.976432f, 0.976411f, 0.976390f,
- 0.976370f, 0.976349f, 0.976328f, 0.976308f, 0.976287f, 0.976266f, 0.976245f, 0.976224f,
- 0.976204f, 0.976183f, 0.976162f, 0.976141f, 0.976120f, 0.976100f, 0.976079f, 0.976058f,
- 0.976037f, 0.976016f, 0.975995f, 0.975974f, 0.975954f, 0.975933f, 0.975912f, 0.975891f,
- 0.975870f, 0.975849f, 0.975828f, 0.975807f, 0.975786f, 0.975765f, 0.975744f, 0.975723f,
- 0.975702f, 0.975681f, 0.975660f, 0.975639f, 0.975618f, 0.975597f, 0.975576f, 0.975555f,
- 0.975534f, 0.975513f, 0.975492f, 0.975471f, 0.975449f, 0.975428f, 0.975407f, 0.975386f,
- 0.975365f, 0.975344f, 0.975323f, 0.975301f, 0.975280f, 0.975259f, 0.975238f, 0.975217f,
- 0.975195f, 0.975174f, 0.975153f, 0.975132f, 0.975110f, 0.975089f, 0.975068f, 0.975047f,
- 0.975025f, 0.975004f, 0.974983f, 0.974961f, 0.974940f, 0.974919f, 0.974897f, 0.974876f,
- 0.974855f, 0.974833f, 0.974812f, 0.974791f, 0.974769f, 0.974748f, 0.974726f, 0.974705f,
- 0.974684f, 0.974662f, 0.974641f, 0.974619f, 0.974598f, 0.974576f, 0.974555f, 0.974533f,
- 0.974512f, 0.974490f, 0.974469f, 0.974447f, 0.974426f, 0.974404f, 0.974383f, 0.974361f,
- 0.974339f, 0.974318f, 0.974296f, 0.974275f, 0.974253f, 0.974231f, 0.974210f, 0.974188f,
- 0.974166f, 0.974145f, 0.974123f, 0.974101f, 0.974080f, 0.974058f, 0.974036f, 0.974015f,
- 0.973993f, 0.973971f, 0.973949f, 0.973928f, 0.973906f, 0.973884f, 0.973862f, 0.973841f,
- 0.973819f, 0.973797f, 0.973775f, 0.973753f, 0.973732f, 0.973710f, 0.973688f, 0.973666f,
- 0.973644f, 0.973622f, 0.973601f, 0.973579f, 0.973557f, 0.973535f, 0.973513f, 0.973491f,
- 0.973469f, 0.973447f, 0.973425f, 0.973403f, 0.973381f, 0.973359f, 0.973337f, 0.973315f,
- 0.973293f, 0.973271f, 0.973249f, 0.973227f, 0.973205f, 0.973183f, 0.973161f, 0.973139f,
- 0.973117f, 0.973095f, 0.973073f, 0.973051f, 0.973028f, 0.973006f, 0.972984f, 0.972962f,
- 0.972940f, 0.972918f, 0.972896f, 0.972873f, 0.972851f, 0.972829f, 0.972807f, 0.972785f,
- 0.972762f, 0.972740f, 0.972718f, 0.972696f, 0.972673f, 0.972651f, 0.972629f, 0.972607f,
- 0.972584f, 0.972562f, 0.972540f, 0.972517f, 0.972495f, 0.972473f, 0.972450f, 0.972428f,
- 0.972406f, 0.972383f, 0.972361f, 0.972339f, 0.972316f, 0.972294f, 0.972271f, 0.972249f,
- 0.972227f, 0.972204f, 0.972182f, 0.972159f, 0.972137f, 0.972114f, 0.972092f, 0.972069f,
- 0.972047f, 0.972024f, 0.972002f, 0.971979f, 0.971957f, 0.971934f, 0.971911f, 0.971889f,
- 0.971866f, 0.971844f, 0.971821f, 0.971799f, 0.971776f, 0.971753f, 0.971731f, 0.971708f,
- 0.971685f, 0.971663f, 0.971640f, 0.971617f, 0.971595f, 0.971572f, 0.971549f, 0.971527f,
- 0.971504f, 0.971481f, 0.971458f, 0.971436f, 0.971413f, 0.971390f, 0.971367f, 0.971345f,
- 0.971322f, 0.971299f, 0.971276f, 0.971253f, 0.971231f, 0.971208f, 0.971185f, 0.971162f,
- 0.971139f, 0.971116f, 0.971093f, 0.971071f, 0.971048f, 0.971025f, 0.971002f, 0.970979f,
- 0.970956f, 0.970933f, 0.970910f, 0.970887f, 0.970864f, 0.970841f, 0.970818f, 0.970795f,
- 0.970772f, 0.970749f, 0.970726f, 0.970703f, 0.970680f, 0.970657f, 0.970634f, 0.970611f,
- 0.970588f, 0.970565f, 0.970542f, 0.970518f, 0.970495f, 0.970472f, 0.970449f, 0.970426f,
- 0.970403f, 0.970380f, 0.970357f, 0.970333f, 0.970310f, 0.970287f, 0.970264f, 0.970241f,
- 0.970217f, 0.970194f, 0.970171f, 0.970148f, 0.970124f, 0.970101f, 0.970078f, 0.970055f,
- 0.970031f, 0.970008f, 0.969985f, 0.969961f, 0.969938f, 0.969915f, 0.969891f, 0.969868f,
- 0.969845f, 0.969821f, 0.969798f, 0.969774f, 0.969751f, 0.969728f, 0.969704f, 0.969681f,
- 0.969657f, 0.969634f, 0.969611f, 0.969587f, 0.969564f, 0.969540f, 0.969517f, 0.969493f,
- 0.969470f, 0.969446f, 0.969423f, 0.969399f, 0.969375f, 0.969352f, 0.969328f, 0.969305f,
- 0.969281f, 0.969258f, 0.969234f, 0.969210f, 0.969187f, 0.969163f, 0.969140f, 0.969116f,
- 0.969092f, 0.969069f, 0.969045f, 0.969021f, 0.968998f, 0.968974f, 0.968950f, 0.968927f,
- 0.968903f, 0.968879f, 0.968855f, 0.968832f, 0.968808f, 0.968784f, 0.968760f, 0.968737f,
- 0.968713f, 0.968689f, 0.968665f, 0.968641f, 0.968617f, 0.968594f, 0.968570f, 0.968546f,
- 0.968522f, 0.968498f, 0.968474f, 0.968450f, 0.968427f, 0.968403f, 0.968379f, 0.968355f,
- 0.968331f, 0.968307f, 0.968283f, 0.968259f, 0.968235f, 0.968211f, 0.968187f, 0.968163f,
- 0.968139f, 0.968115f, 0.968091f, 0.968067f, 0.968043f, 0.968019f, 0.967995f, 0.967971f,
- 0.967947f, 0.967923f, 0.967899f, 0.967874f, 0.967850f, 0.967826f, 0.967802f, 0.967778f,
- 0.967754f, 0.967730f, 0.967706f, 0.967681f, 0.967657f, 0.967633f, 0.967609f, 0.967585f,
- 0.967560f, 0.967536f, 0.967512f, 0.967488f, 0.967463f, 0.967439f, 0.967415f, 0.967391f,
- 0.967366f, 0.967342f, 0.967318f, 0.967293f, 0.967269f, 0.967245f, 0.967220f, 0.967196f,
- 0.967172f, 0.967147f, 0.967123f, 0.967099f, 0.967074f, 0.967050f, 0.967025f, 0.967001f,
- 0.966976f, 0.966952f, 0.966928f, 0.966903f, 0.966879f, 0.966854f, 0.966830f, 0.966805f,
- 0.966781f, 0.966756f, 0.966732f, 0.966707f, 0.966683f, 0.966658f, 0.966633f, 0.966609f,
- 0.966584f, 0.966560f, 0.966535f, 0.966511f, 0.966486f, 0.966461f, 0.966437f, 0.966412f,
- 0.966387f, 0.966363f, 0.966338f, 0.966313f, 0.966289f, 0.966264f, 0.966239f, 0.966215f,
- 0.966190f, 0.966165f, 0.966141f, 0.966116f, 0.966091f, 0.966066f, 0.966042f, 0.966017f,
- 0.965992f, 0.965967f, 0.965942f, 0.965918f, 0.965893f, 0.965868f, 0.965843f, 0.965818f,
- 0.965793f, 0.965769f, 0.965744f, 0.965719f, 0.965694f, 0.965669f, 0.965644f, 0.965619f,
- 0.965594f, 0.965569f, 0.965544f, 0.965519f, 0.965494f, 0.965469f, 0.965444f, 0.965419f,
- 0.965394f, 0.965369f, 0.965344f, 0.965319f, 0.965294f, 0.965269f, 0.965244f, 0.965219f,
- 0.965194f, 0.965169f, 0.965144f, 0.965119f, 0.965094f, 0.965069f, 0.965044f, 0.965018f,
- 0.964993f, 0.964968f, 0.964943f, 0.964918f, 0.964893f, 0.964867f, 0.964842f, 0.964817f,
- 0.964792f, 0.964767f, 0.964741f, 0.964716f, 0.964691f, 0.964666f, 0.964640f, 0.964615f,
- 0.964590f, 0.964565f, 0.964539f, 0.964514f, 0.964489f, 0.964463f, 0.964438f, 0.964413f,
- 0.964387f, 0.964362f, 0.964336f, 0.964311f, 0.964286f, 0.964260f, 0.964235f, 0.964209f,
- 0.964184f, 0.964159f, 0.964133f, 0.964108f, 0.964082f, 0.964057f, 0.964031f, 0.964006f,
- 0.963980f, 0.963955f, 0.963929f, 0.963904f, 0.963878f, 0.963853f, 0.963827f, 0.963802f,
- 0.963776f, 0.963750f, 0.963725f, 0.963699f, 0.963674f, 0.963648f, 0.963623f, 0.963597f,
- 0.963571f, 0.963546f, 0.963520f, 0.963494f, 0.963469f, 0.963443f, 0.963417f, 0.963391f,
- 0.963366f, 0.963340f, 0.963314f, 0.963289f, 0.963263f, 0.963237f, 0.963211f, 0.963186f,
- 0.963160f, 0.963134f, 0.963108f, 0.963082f, 0.963057f, 0.963031f, 0.963005f, 0.962979f,
- 0.962953f, 0.962927f, 0.962902f, 0.962876f, 0.962850f, 0.962824f, 0.962798f, 0.962772f,
- 0.962746f, 0.962720f, 0.962694f, 0.962668f, 0.962642f, 0.962616f, 0.962590f, 0.962564f,
- 0.962538f, 0.962512f, 0.962486f, 0.962460f, 0.962434f, 0.962408f, 0.962382f, 0.962356f,
- 0.962330f, 0.962304f, 0.962278f, 0.962252f, 0.962226f, 0.962200f, 0.962174f, 0.962148f,
- 0.962121f, 0.962095f, 0.962069f, 0.962043f, 0.962017f, 0.961991f, 0.961964f, 0.961938f,
- 0.961912f, 0.961886f, 0.961860f, 0.961833f, 0.961807f, 0.961781f, 0.961755f, 0.961728f,
- 0.961702f, 0.961676f, 0.961649f, 0.961623f, 0.961597f, 0.961571f, 0.961544f, 0.961518f,
- 0.961492f, 0.961465f, 0.961439f, 0.961412f, 0.961386f, 0.961360f, 0.961333f, 0.961307f,
- 0.961280f, 0.961254f, 0.961228f, 0.961201f, 0.961175f, 0.961148f, 0.961122f, 0.961095f,
- 0.961069f, 0.961042f, 0.961016f, 0.960989f, 0.960963f, 0.960936f, 0.960910f, 0.960883f,
- 0.960857f, 0.960830f, 0.960804f, 0.960777f, 0.960750f, 0.960724f, 0.960697f, 0.960670f,
- 0.960644f, 0.960617f, 0.960591f, 0.960564f, 0.960537f, 0.960511f, 0.960484f, 0.960457f,
- 0.960431f, 0.960404f, 0.960377f, 0.960350f, 0.960324f, 0.960297f, 0.960270f, 0.960243f,
- 0.960217f, 0.960190f, 0.960163f, 0.960136f, 0.960109f, 0.960083f, 0.960056f, 0.960029f,
- 0.960002f, 0.959975f, 0.959948f, 0.959922f, 0.959895f, 0.959868f, 0.959841f, 0.959814f,
- 0.959787f, 0.959760f, 0.959733f, 0.959706f, 0.959679f, 0.959652f, 0.959625f, 0.959598f,
- 0.959572f, 0.959545f, 0.959518f, 0.959491f, 0.959463f, 0.959436f, 0.959409f, 0.959382f,
- 0.959355f, 0.959328f, 0.959301f, 0.959274f, 0.959247f, 0.959220f, 0.959193f, 0.959166f,
- 0.959139f, 0.959112f, 0.959084f, 0.959057f, 0.959030f, 0.959003f, 0.958976f, 0.958949f,
- 0.958921f, 0.958894f, 0.958867f, 0.958840f, 0.958812f, 0.958785f, 0.958758f, 0.958731f,
- 0.958703f, 0.958676f, 0.958649f, 0.958622f, 0.958594f, 0.958567f, 0.958540f, 0.958512f,
- 0.958485f, 0.958458f, 0.958430f, 0.958403f, 0.958376f, 0.958348f, 0.958321f, 0.958293f,
- 0.958266f, 0.958239f, 0.958211f, 0.958184f, 0.958156f, 0.958129f, 0.958101f, 0.958074f,
- 0.958046f, 0.958019f, 0.957992f, 0.957964f, 0.957937f, 0.957909f, 0.957882f, 0.957854f,
- 0.957826f, 0.957799f, 0.957771f, 0.957744f, 0.957716f, 0.957689f, 0.957661f, 0.957633f,
- 0.957606f, 0.957578f, 0.957550f, 0.957523f, 0.957495f, 0.957468f, 0.957440f, 0.957412f,
- 0.957385f, 0.957357f, 0.957329f, 0.957301f, 0.957274f, 0.957246f, 0.957218f, 0.957190f,
- 0.957163f, 0.957135f, 0.957107f, 0.957079f, 0.957052f, 0.957024f, 0.956996f, 0.956968f,
- 0.956940f, 0.956913f, 0.956885f, 0.956857f, 0.956829f, 0.956801f, 0.956773f, 0.956745f,
- 0.956717f, 0.956689f, 0.956662f, 0.956634f, 0.956606f, 0.956578f, 0.956550f, 0.956522f,
- 0.956494f, 0.956466f, 0.956438f, 0.956410f, 0.956382f, 0.956354f, 0.956326f, 0.956298f,
- 0.956270f, 0.956242f, 0.956214f, 0.956186f, 0.956158f, 0.956130f, 0.956101f, 0.956073f,
- 0.956045f, 0.956017f, 0.955989f, 0.955961f, 0.955933f, 0.955905f, 0.955876f, 0.955848f,
- 0.955820f, 0.955792f, 0.955764f, 0.955736f, 0.955707f, 0.955679f, 0.955651f, 0.955623f,
- 0.955594f, 0.955566f, 0.955538f, 0.955510f, 0.955481f, 0.955453f, 0.955425f, 0.955396f,
- 0.955368f, 0.955340f, 0.955311f, 0.955283f, 0.955255f, 0.955226f, 0.955198f, 0.955170f,
- 0.955141f, 0.955113f, 0.955084f, 0.955056f, 0.955028f, 0.954999f, 0.954971f, 0.954942f,
- 0.954914f, 0.954885f, 0.954857f, 0.954828f, 0.954800f, 0.954771f, 0.954743f, 0.954714f,
- 0.954686f, 0.954657f, 0.954629f, 0.954600f, 0.954572f, 0.954543f, 0.954514f, 0.954486f,
- 0.954457f, 0.954429f, 0.954400f, 0.954371f, 0.954343f, 0.954314f, 0.954285f, 0.954257f,
- 0.954228f, 0.954199f, 0.954171f, 0.954142f, 0.954113f, 0.954085f, 0.954056f, 0.954027f,
- 0.953998f, 0.953970f, 0.953941f, 0.953912f, 0.953883f, 0.953855f, 0.953826f, 0.953797f,
- 0.953768f, 0.953739f, 0.953711f, 0.953682f, 0.953653f, 0.953624f, 0.953595f, 0.953566f,
- 0.953537f, 0.953508f, 0.953480f, 0.953451f, 0.953422f, 0.953393f, 0.953364f, 0.953335f,
- 0.953306f, 0.953277f, 0.953248f, 0.953219f, 0.953190f, 0.953161f, 0.953132f, 0.953103f,
- 0.953074f, 0.953045f, 0.953016f, 0.952987f, 0.952958f, 0.952929f, 0.952900f, 0.952871f,
- 0.952842f, 0.952813f, 0.952783f, 0.952754f, 0.952725f, 0.952696f, 0.952667f, 0.952638f,
- 0.952609f, 0.952579f, 0.952550f, 0.952521f, 0.952492f, 0.952463f, 0.952433f, 0.952404f,
- 0.952375f, 0.952346f, 0.952317f, 0.952287f, 0.952258f, 0.952229f, 0.952199f, 0.952170f,
- 0.952141f, 0.952112f, 0.952082f, 0.952053f, 0.952024f, 0.951994f, 0.951965f, 0.951936f,
- 0.951906f, 0.951877f, 0.951847f, 0.951818f, 0.951789f, 0.951759f, 0.951730f, 0.951700f,
- 0.951671f, 0.951641f, 0.951612f, 0.951582f, 0.951553f, 0.951524f, 0.951494f, 0.951465f,
- 0.951435f, 0.951406f, 0.951376f, 0.951346f, 0.951317f, 0.951287f, 0.951258f, 0.951228f,
- 0.951199f, 0.951169f, 0.951139f, 0.951110f, 0.951080f, 0.951051f, 0.951021f, 0.950991f,
- 0.950962f, 0.950932f, 0.950902f, 0.950873f, 0.950843f, 0.950813f, 0.950784f, 0.950754f,
- 0.950724f, 0.950694f, 0.950665f, 0.950635f, 0.950605f, 0.950575f, 0.950546f, 0.950516f,
- 0.950486f, 0.950456f, 0.950426f, 0.950397f, 0.950367f, 0.950337f, 0.950307f, 0.950277f,
- 0.950247f, 0.950218f, 0.950188f, 0.950158f, 0.950128f, 0.950098f, 0.950068f, 0.950038f,
- 0.950008f, 0.949978f, 0.949948f, 0.949918f, 0.949888f, 0.949858f, 0.949829f, 0.949798f,
- 0.949768f, 0.949739f, 0.949708f, 0.949678f, 0.949648f, 0.949618f, 0.949588f, 0.949558f,
- 0.949528f, 0.949498f, 0.949468f, 0.949438f, 0.949408f, 0.949378f, 0.949348f, 0.949317f,
- 0.949287f, 0.949257f, 0.949227f, 0.949197f, 0.949167f, 0.949136f, 0.949106f, 0.949076f,
- 0.949046f, 0.949016f, 0.948985f, 0.948955f, 0.948925f, 0.948895f, 0.948864f, 0.948834f,
- 0.948804f, 0.948774f, 0.948743f, 0.948713f, 0.948683f, 0.948652f, 0.948622f, 0.948592f,
- 0.948561f, 0.948531f, 0.948501f, 0.948470f, 0.948440f, 0.948409f, 0.948379f, 0.948349f,
- 0.948318f, 0.948288f, 0.948257f, 0.948227f, 0.948196f, 0.948166f, 0.948136f, 0.948105f,
- 0.948075f, 0.948044f, 0.948014f, 0.947983f, 0.947953f, 0.947922f, 0.947891f, 0.947861f,
- 0.947830f, 0.947800f, 0.947769f, 0.947739f, 0.947708f, 0.947677f, 0.947647f, 0.947616f,
- 0.947586f, 0.947555f, 0.947524f, 0.947494f, 0.947463f, 0.947432f, 0.947402f, 0.947371f,
- 0.947340f, 0.947310f, 0.947279f, 0.947248f, 0.947217f, 0.947187f, 0.947156f, 0.947125f,
- 0.947094f, 0.947064f, 0.947033f, 0.947002f, 0.946971f, 0.946940f, 0.946910f, 0.946879f,
- 0.946848f, 0.946817f, 0.946786f, 0.946755f, 0.946724f, 0.946694f, 0.946663f, 0.946632f,
- 0.946601f, 0.946570f, 0.946539f, 0.946508f, 0.946477f, 0.946446f, 0.946415f, 0.946384f,
- 0.946353f, 0.946322f, 0.946291f, 0.946260f, 0.946229f, 0.946198f, 0.946167f, 0.946136f,
- 0.946105f, 0.946074f, 0.946043f, 0.946012f, 0.945981f, 0.945950f, 0.945919f, 0.945888f,
- 0.945857f, 0.945825f, 0.945794f, 0.945763f, 0.945732f, 0.945701f, 0.945670f, 0.945639f,
- 0.945607f, 0.945576f, 0.945545f, 0.945514f, 0.945482f, 0.945451f, 0.945420f, 0.945389f,
- 0.945358f, 0.945326f, 0.945295f, 0.945264f, 0.945232f, 0.945201f, 0.945170f, 0.945139f,
- 0.945107f, 0.945076f, 0.945045f, 0.945013f, 0.944982f, 0.944950f, 0.944919f, 0.944888f,
- 0.944856f, 0.944825f, 0.944793f, 0.944762f, 0.944731f, 0.944699f, 0.944668f, 0.944636f,
- 0.944605f, 0.944573f, 0.944542f, 0.944510f, 0.944479f, 0.944447f, 0.944416f, 0.944384f,
- 0.944353f, 0.944321f, 0.944290f, 0.944258f, 0.944227f, 0.944195f, 0.944163f, 0.944132f,
- 0.944100f, 0.944069f, 0.944037f, 0.944005f, 0.943974f, 0.943942f, 0.943910f, 0.943879f,
- 0.943847f, 0.943815f, 0.943784f, 0.943752f, 0.943720f, 0.943689f, 0.943657f, 0.943625f,
- 0.943593f, 0.943562f, 0.943530f, 0.943498f, 0.943466f, 0.943435f, 0.943403f, 0.943371f,
- 0.943339f, 0.943307f, 0.943276f, 0.943244f, 0.943212f, 0.943180f, 0.943148f, 0.943116f,
- 0.943084f, 0.943053f, 0.943021f, 0.942989f, 0.942957f, 0.942925f, 0.942893f, 0.942861f,
- 0.942829f, 0.942797f, 0.942765f, 0.942733f, 0.942701f, 0.942669f, 0.942637f, 0.942605f,
- 0.942573f, 0.942541f, 0.942509f, 0.942477f, 0.942445f, 0.942413f, 0.942381f, 0.942349f,
- 0.942317f, 0.942285f, 0.942253f, 0.942220f, 0.942188f, 0.942156f, 0.942124f, 0.942092f,
- 0.942060f, 0.942028f, 0.941995f, 0.941963f, 0.941931f, 0.941899f, 0.941867f, 0.941834f,
- 0.941802f, 0.941770f, 0.941738f, 0.941705f, 0.941673f, 0.941641f, 0.941609f, 0.941576f,
- 0.941544f, 0.941512f, 0.941479f, 0.941447f, 0.941415f, 0.941382f, 0.941350f, 0.941318f,
- 0.941285f, 0.941253f, 0.941221f, 0.941188f, 0.941156f, 0.941123f, 0.941091f, 0.941059f,
- 0.941026f, 0.940994f, 0.940961f, 0.940929f, 0.940896f, 0.940864f, 0.940831f, 0.940799f,
- 0.940766f, 0.940734f, 0.940701f, 0.940669f, 0.940636f, 0.940604f, 0.940571f, 0.940539f,
- 0.940506f, 0.940473f, 0.940441f, 0.940408f, 0.940376f, 0.940343f, 0.940310f, 0.940278f,
- 0.940245f, 0.940213f, 0.940180f, 0.940147f, 0.940115f, 0.940082f, 0.940049f, 0.940016f,
- 0.939984f, 0.939951f, 0.939918f, 0.939886f, 0.939853f, 0.939820f, 0.939787f, 0.939755f,
- 0.939722f, 0.939689f, 0.939656f, 0.939623f, 0.939591f, 0.939558f, 0.939525f, 0.939492f,
- 0.939459f, 0.939426f, 0.939394f, 0.939361f, 0.939328f, 0.939295f, 0.939262f, 0.939229f,
- 0.939196f, 0.939163f, 0.939130f, 0.939097f, 0.939064f, 0.939031f, 0.938998f, 0.938965f,
- 0.938932f, 0.938900f, 0.938866f, 0.938833f, 0.938800f, 0.938767f, 0.938734f, 0.938701f,
- 0.938668f, 0.938635f, 0.938602f, 0.938569f, 0.938536f, 0.938503f, 0.938470f, 0.938437f,
- 0.938404f, 0.938370f, 0.938337f, 0.938304f, 0.938271f, 0.938238f, 0.938205f, 0.938171f,
- 0.938138f, 0.938105f, 0.938072f, 0.938039f, 0.938005f, 0.937972f, 0.937939f, 0.937906f,
- 0.937872f, 0.937839f, 0.937806f, 0.937773f, 0.937739f, 0.937706f, 0.937673f, 0.937639f,
- 0.937606f, 0.937573f, 0.937539f, 0.937506f, 0.937473f, 0.937439f, 0.937406f, 0.937372f,
- 0.937339f, 0.937306f, 0.937272f, 0.937239f, 0.937205f, 0.937172f, 0.937138f, 0.937105f,
- 0.937072f, 0.937038f, 0.937005f, 0.936971f, 0.936938f, 0.936904f, 0.936871f, 0.936837f,
- 0.936803f, 0.936770f, 0.936736f, 0.936703f, 0.936669f, 0.936636f, 0.936602f, 0.936568f,
- 0.936535f, 0.936501f, 0.936468f, 0.936434f, 0.936400f, 0.936367f, 0.936333f, 0.936299f,
- 0.936266f, 0.936232f, 0.936198f, 0.936165f, 0.936131f, 0.936097f, 0.936063f, 0.936030f,
- 0.935996f, 0.935962f, 0.935928f, 0.935895f, 0.935861f, 0.935827f, 0.935793f, 0.935759f,
- 0.935726f, 0.935692f, 0.935658f, 0.935624f, 0.935590f, 0.935556f, 0.935523f, 0.935489f,
- 0.935455f, 0.935421f, 0.935387f, 0.935353f, 0.935319f, 0.935285f, 0.935251f, 0.935217f,
- 0.935184f, 0.935150f, 0.935116f, 0.935082f, 0.935048f, 0.935014f, 0.934980f, 0.934946f,
- 0.934912f, 0.934878f, 0.934844f, 0.934810f, 0.934775f, 0.934741f, 0.934707f, 0.934673f,
- 0.934639f, 0.934605f, 0.934571f, 0.934537f, 0.934503f, 0.934469f, 0.934434f, 0.934400f,
- 0.934366f, 0.934332f, 0.934298f, 0.934264f, 0.934229f, 0.934195f, 0.934161f, 0.934127f,
- 0.934093f, 0.934058f, 0.934024f, 0.933990f, 0.933956f, 0.933921f, 0.933887f, 0.933853f,
- 0.933818f, 0.933784f, 0.933750f, 0.933716f, 0.933681f, 0.933647f, 0.933612f, 0.933578f,
- 0.933544f, 0.933509f, 0.933475f, 0.933441f, 0.933406f, 0.933372f, 0.933337f, 0.933303f,
- 0.933269f, 0.933234f, 0.933200f, 0.933165f, 0.933131f, 0.933096f, 0.933062f, 0.933027f,
- 0.932993f, 0.932958f, 0.932924f, 0.932889f, 0.932855f, 0.932820f, 0.932786f, 0.932751f,
- 0.932716f, 0.932682f, 0.932647f, 0.932613f, 0.932578f, 0.932544f, 0.932509f, 0.932474f,
- 0.932440f, 0.932405f, 0.932370f, 0.932336f, 0.932301f, 0.932266f, 0.932232f, 0.932197f,
- 0.932162f, 0.932128f, 0.932093f, 0.932058f, 0.932023f, 0.931989f, 0.931954f, 0.931919f,
- 0.931884f, 0.931849f, 0.931815f, 0.931780f, 0.931745f, 0.931710f, 0.931675f, 0.931641f,
- 0.931606f, 0.931571f, 0.931536f, 0.931501f, 0.931466f, 0.931431f, 0.931397f, 0.931362f,
- 0.931327f, 0.931292f, 0.931257f, 0.931222f, 0.931187f, 0.931152f, 0.931117f, 0.931082f,
- 0.931047f, 0.931012f, 0.930977f, 0.930942f, 0.930907f, 0.930872f, 0.930837f, 0.930802f,
- 0.930767f, 0.930732f, 0.930697f, 0.930662f, 0.930627f, 0.930592f, 0.930556f, 0.930521f,
- 0.930486f, 0.930451f, 0.930416f, 0.930381f, 0.930346f, 0.930311f, 0.930275f, 0.930240f,
- 0.930205f, 0.930170f, 0.930135f, 0.930099f, 0.930064f, 0.930029f, 0.929994f, 0.929958f,
- 0.929923f, 0.929888f, 0.929853f, 0.929817f, 0.929782f, 0.929747f, 0.929712f, 0.929676f,
- 0.929641f, 0.929606f, 0.929570f, 0.929535f, 0.929500f, 0.929464f, 0.929429f, 0.929393f,
- 0.929358f, 0.929323f, 0.929287f, 0.929252f, 0.929216f, 0.929181f, 0.929146f, 0.929110f,
- 0.929075f, 0.929039f, 0.929004f, 0.928968f, 0.928933f, 0.928897f, 0.928862f, 0.928826f,
- 0.928791f, 0.928755f, 0.928720f, 0.928684f, 0.928648f, 0.928613f, 0.928577f, 0.928542f,
- 0.928506f, 0.928470f, 0.928435f, 0.928399f, 0.928364f, 0.928328f, 0.928292f, 0.928257f,
- 0.928221f, 0.928185f, 0.928150f, 0.928114f, 0.928078f, 0.928043f, 0.928007f, 0.927971f,
- 0.927935f, 0.927900f, 0.927864f, 0.927828f, 0.927792f, 0.927757f, 0.927721f, 0.927685f,
- 0.927649f, 0.927613f, 0.927578f, 0.927542f, 0.927506f, 0.927470f, 0.927434f, 0.927398f,
- 0.927363f, 0.927327f, 0.927291f, 0.927255f, 0.927219f, 0.927183f, 0.927147f, 0.927111f,
- 0.927075f, 0.927039f, 0.927003f, 0.926967f, 0.926931f, 0.926895f, 0.926859f, 0.926823f,
- 0.926787f, 0.926751f, 0.926715f, 0.926679f, 0.926643f, 0.926607f, 0.926571f, 0.926535f,
- 0.926499f, 0.926463f, 0.926427f, 0.926391f, 0.926355f, 0.926319f, 0.926283f, 0.926246f,
- 0.926210f, 0.926174f, 0.926138f, 0.926102f, 0.926066f, 0.926029f, 0.925993f, 0.925957f,
- 0.925921f, 0.925885f, 0.925848f, 0.925812f, 0.925776f, 0.925740f, 0.925703f, 0.925667f,
- 0.925631f, 0.925595f, 0.925558f, 0.925522f, 0.925486f, 0.925449f, 0.925413f, 0.925377f,
- 0.925340f, 0.925304f, 0.925268f, 0.925231f, 0.925195f, 0.925158f, 0.925122f, 0.925086f,
- 0.925049f, 0.925013f, 0.924976f, 0.924940f, 0.924904f, 0.924867f, 0.924831f, 0.924794f,
- 0.924758f, 0.924721f, 0.924685f, 0.924648f, 0.924612f, 0.924575f, 0.924539f, 0.924502f,
- 0.924465f, 0.924429f, 0.924392f, 0.924356f, 0.924319f, 0.924283f, 0.924246f, 0.924209f,
- 0.924173f, 0.924136f, 0.924100f, 0.924063f, 0.924026f, 0.923990f, 0.923953f, 0.923916f,
- 0.923880f, 0.923843f, 0.923806f, 0.923769f, 0.923733f, 0.923696f, 0.923659f, 0.923622f,
- 0.923586f, 0.923549f, 0.923512f, 0.923475f, 0.923439f, 0.923402f, 0.923365f, 0.923328f,
- 0.923291f, 0.923255f, 0.923218f, 0.923181f, 0.923144f, 0.923107f, 0.923070f, 0.923033f,
- 0.922997f, 0.922960f, 0.922923f, 0.922886f, 0.922849f, 0.922812f, 0.922775f, 0.922738f,
- 0.922701f, 0.922664f, 0.922627f, 0.922590f, 0.922553f, 0.922516f, 0.922479f, 0.922442f,
- 0.922405f, 0.922368f, 0.922331f, 0.922294f, 0.922257f, 0.922220f, 0.922183f, 0.922146f,
- 0.922109f, 0.922072f, 0.922034f, 0.921997f, 0.921960f, 0.921923f, 0.921886f, 0.921849f,
- 0.921812f, 0.921774f, 0.921737f, 0.921700f, 0.921663f, 0.921626f, 0.921588f, 0.921551f,
- 0.921514f, 0.921477f, 0.921440f, 0.921402f, 0.921365f, 0.921328f, 0.921291f, 0.921253f,
- 0.921216f, 0.921179f, 0.921141f, 0.921104f, 0.921067f, 0.921029f, 0.920992f, 0.920955f,
- 0.920917f, 0.920880f, 0.920842f, 0.920805f, 0.920768f, 0.920730f, 0.920693f, 0.920655f,
- 0.920618f, 0.920581f, 0.920543f, 0.920506f, 0.920468f, 0.920431f, 0.920393f, 0.920356f,
- 0.920318f, 0.920281f, 0.920243f, 0.920206f, 0.920168f, 0.920131f, 0.920093f, 0.920056f,
- 0.920018f, 0.919980f, 0.919943f, 0.919905f, 0.919868f, 0.919830f, 0.919792f, 0.919755f,
- 0.919717f, 0.919680f, 0.919642f, 0.919604f, 0.919567f, 0.919529f, 0.919491f, 0.919453f,
- 0.919416f, 0.919378f, 0.919340f, 0.919303f, 0.919265f, 0.919227f, 0.919189f, 0.919152f,
- 0.919114f, 0.919076f, 0.919038f, 0.919001f, 0.918963f, 0.918925f, 0.918887f, 0.918849f,
- 0.918811f, 0.918774f, 0.918736f, 0.918698f, 0.918660f, 0.918622f, 0.918584f, 0.918546f,
- 0.918508f, 0.918471f, 0.918433f, 0.918395f, 0.918357f, 0.918319f, 0.918281f, 0.918243f,
- 0.918205f, 0.918167f, 0.918129f, 0.918091f, 0.918053f, 0.918015f, 0.917977f, 0.917939f,
- 0.917901f, 0.917863f, 0.917825f, 0.917787f, 0.917749f, 0.917710f, 0.917672f, 0.917634f,
- 0.917596f, 0.917558f, 0.917520f, 0.917482f, 0.917444f, 0.917405f, 0.917367f, 0.917329f,
- 0.917291f, 0.917253f, 0.917215f, 0.917176f, 0.917138f, 0.917100f, 0.917062f, 0.917024f,
- 0.916985f, 0.916947f, 0.916909f, 0.916871f, 0.916832f, 0.916794f, 0.916756f, 0.916717f,
- 0.916679f, 0.916641f, 0.916602f, 0.916564f, 0.916526f, 0.916487f, 0.916449f, 0.916411f,
- 0.916372f, 0.916334f, 0.916296f, 0.916257f, 0.916219f, 0.916180f, 0.916142f, 0.916103f,
- 0.916065f, 0.916027f, 0.915988f, 0.915950f, 0.915911f, 0.915873f, 0.915834f, 0.915796f,
- 0.915757f, 0.915719f, 0.915680f, 0.915642f, 0.915603f, 0.915564f, 0.915526f, 0.915487f,
- 0.915449f, 0.915410f, 0.915372f, 0.915333f, 0.915294f, 0.915256f, 0.915217f, 0.915178f,
- 0.915140f, 0.915101f, 0.915062f, 0.915024f, 0.914985f, 0.914946f, 0.914908f, 0.914869f,
- 0.914830f, 0.914792f, 0.914753f, 0.914714f, 0.914675f, 0.914637f, 0.914598f, 0.914559f,
- 0.914520f, 0.914482f, 0.914443f, 0.914404f, 0.914365f, 0.914326f, 0.914287f, 0.914249f,
- 0.914210f, 0.914171f, 0.914132f, 0.914093f, 0.914054f, 0.914015f, 0.913976f, 0.913938f,
- 0.913899f, 0.913860f, 0.913821f, 0.913782f, 0.913743f, 0.913704f, 0.913665f, 0.913626f,
- 0.913587f, 0.913548f, 0.913509f, 0.913470f, 0.913431f, 0.913392f, 0.913353f, 0.913314f,
- 0.913275f, 0.913236f, 0.913197f, 0.913158f, 0.913119f, 0.913080f, 0.913040f, 0.913001f,
- 0.912962f, 0.912923f, 0.912884f, 0.912845f, 0.912806f, 0.912766f, 0.912727f, 0.912688f,
- 0.912649f, 0.912610f, 0.912571f, 0.912531f, 0.912492f, 0.912453f, 0.912414f, 0.912374f,
- 0.912335f, 0.912296f, 0.912257f, 0.912217f, 0.912178f, 0.912139f, 0.912099f, 0.912060f,
- 0.912021f, 0.911982f, 0.911942f, 0.911903f, 0.911864f, 0.911824f, 0.911785f, 0.911745f,
- 0.911706f, 0.911667f, 0.911627f, 0.911588f, 0.911548f, 0.911509f, 0.911470f, 0.911430f,
- 0.911391f, 0.911351f, 0.911312f, 0.911272f, 0.911233f, 0.911193f, 0.911154f, 0.911114f,
- 0.911075f, 0.911035f, 0.910996f, 0.910956f, 0.910917f, 0.910877f, 0.910837f, 0.910798f,
- 0.910758f, 0.910719f, 0.910679f, 0.910639f, 0.910600f, 0.910560f, 0.910521f, 0.910481f,
- 0.910441f, 0.910402f, 0.910362f, 0.910322f, 0.910283f, 0.910243f, 0.910203f, 0.910163f,
- 0.910124f, 0.910084f, 0.910044f, 0.910005f, 0.909965f, 0.909925f, 0.909885f, 0.909845f,
- 0.909806f, 0.909766f, 0.909726f, 0.909686f, 0.909646f, 0.909607f, 0.909567f, 0.909527f,
- 0.909487f, 0.909447f, 0.909407f, 0.909368f, 0.909328f, 0.909288f, 0.909248f, 0.909208f,
- 0.909168f, 0.909128f, 0.909088f, 0.909048f, 0.909008f, 0.908968f, 0.908928f, 0.908888f,
- 0.908848f, 0.908808f, 0.908768f, 0.908728f, 0.908688f, 0.908648f, 0.908608f, 0.908568f,
- 0.908528f, 0.908488f, 0.908448f, 0.908408f, 0.908368f, 0.908328f, 0.908288f, 0.908248f,
- 0.908207f, 0.908167f, 0.908127f, 0.908087f, 0.908047f, 0.908007f, 0.907966f, 0.907926f,
- 0.907886f, 0.907846f, 0.907806f, 0.907766f, 0.907725f, 0.907685f, 0.907645f, 0.907605f,
- 0.907564f, 0.907524f, 0.907484f, 0.907444f, 0.907403f, 0.907363f, 0.907323f, 0.907282f,
- 0.907242f, 0.907202f, 0.907161f, 0.907121f, 0.907081f, 0.907040f, 0.907000f, 0.906959f,
- 0.906919f, 0.906879f, 0.906838f, 0.906798f, 0.906757f, 0.906717f, 0.906677f, 0.906636f,
- 0.906596f, 0.906555f, 0.906515f, 0.906474f, 0.906434f, 0.906393f, 0.906353f, 0.906312f,
- 0.906272f, 0.906231f, 0.906191f, 0.906150f, 0.906110f, 0.906069f, 0.906028f, 0.905988f,
- 0.905947f, 0.905907f, 0.905866f, 0.905825f, 0.905785f, 0.905744f, 0.905704f, 0.905663f,
- 0.905622f, 0.905582f, 0.905541f, 0.905500f, 0.905460f, 0.905419f, 0.905378f, 0.905337f,
- 0.905297f, 0.905256f, 0.905215f, 0.905175f, 0.905134f, 0.905093f, 0.905052f, 0.905011f,
- 0.904971f, 0.904930f, 0.904889f, 0.904848f, 0.904807f, 0.904767f, 0.904726f, 0.904685f,
- 0.904644f, 0.904603f, 0.904562f, 0.904521f, 0.904481f, 0.904440f, 0.904399f, 0.904358f,
- 0.904317f, 0.904276f, 0.904235f, 0.904194f, 0.904153f, 0.904112f, 0.904071f, 0.904030f,
- 0.903989f, 0.903948f, 0.903907f, 0.903866f, 0.903825f, 0.903784f, 0.903743f, 0.903702f,
- 0.903661f, 0.903620f, 0.903579f, 0.903538f, 0.903497f, 0.903456f, 0.903415f, 0.903373f,
- 0.903332f, 0.903291f, 0.903250f, 0.903209f, 0.903168f, 0.903127f, 0.903085f, 0.903044f,
- 0.903003f, 0.902962f, 0.902921f, 0.902879f, 0.902838f, 0.902797f, 0.902756f, 0.902715f,
- 0.902673f, 0.902632f, 0.902591f, 0.902550f, 0.902508f, 0.902467f, 0.902426f, 0.902384f,
- 0.902343f, 0.902302f, 0.902260f, 0.902219f, 0.902178f, 0.902136f, 0.902095f, 0.902054f,
- 0.902012f, 0.901971f, 0.901929f, 0.901888f, 0.901847f, 0.901805f, 0.901764f, 0.901722f,
- 0.901681f, 0.901639f, 0.901598f, 0.901556f, 0.901515f, 0.901473f, 0.901432f, 0.901390f,
- 0.901349f, 0.901307f, 0.901266f, 0.901224f, 0.901183f, 0.901141f, 0.901100f, 0.901058f,
- 0.901016f, 0.900975f, 0.900933f, 0.900892f, 0.900850f, 0.900808f, 0.900767f, 0.900725f,
- 0.900683f, 0.900642f, 0.900600f, 0.900558f, 0.900517f, 0.900475f, 0.900433f, 0.900392f,
- 0.900350f, 0.900308f, 0.900266f, 0.900225f, 0.900183f, 0.900141f, 0.900099f, 0.900058f,
- 0.900016f, 0.899974f, 0.899932f, 0.899890f, 0.899849f, 0.899807f, 0.899765f, 0.899723f,
- 0.899681f, 0.899639f, 0.899598f, 0.899556f, 0.899514f, 0.899472f, 0.899430f, 0.899388f,
- 0.899346f, 0.899304f, 0.899262f, 0.899220f, 0.899179f, 0.899137f, 0.899095f, 0.899053f,
- 0.899011f, 0.898969f, 0.898927f, 0.898885f, 0.898843f, 0.898801f, 0.898759f, 0.898717f,
- 0.898674f, 0.898632f, 0.898590f, 0.898548f, 0.898506f, 0.898464f, 0.898422f, 0.898380f,
- 0.898338f, 0.898296f, 0.898254f, 0.898211f, 0.898169f, 0.898127f, 0.898085f, 0.898043f,
- 0.898001f, 0.897958f, 0.897916f, 0.897874f, 0.897832f, 0.897790f, 0.897747f, 0.897705f,
- 0.897663f, 0.897621f, 0.897578f, 0.897536f, 0.897494f, 0.897452f, 0.897409f, 0.897367f,
- 0.897325f, 0.897282f, 0.897240f, 0.897198f, 0.897155f, 0.897113f, 0.897071f, 0.897028f,
- 0.896986f, 0.896943f, 0.896901f, 0.896859f, 0.896816f, 0.896774f, 0.896731f, 0.896689f,
- 0.896646f, 0.896604f, 0.896562f, 0.896519f, 0.896477f, 0.896434f, 0.896392f, 0.896349f,
- 0.896307f, 0.896264f, 0.896222f, 0.896179f, 0.896137f, 0.896094f, 0.896051f, 0.896009f,
- 0.895966f, 0.895924f, 0.895881f, 0.895838f, 0.895796f, 0.895753f, 0.895711f, 0.895668f,
- 0.895625f, 0.895583f, 0.895540f, 0.895497f, 0.895455f, 0.895412f, 0.895369f, 0.895327f,
- 0.895284f, 0.895241f, 0.895198f, 0.895156f, 0.895113f, 0.895070f, 0.895028f, 0.894985f,
- 0.894942f, 0.894899f, 0.894856f, 0.894814f, 0.894771f, 0.894728f, 0.894685f, 0.894642f,
- 0.894599f, 0.894557f, 0.894514f, 0.894471f, 0.894428f, 0.894385f, 0.894342f, 0.894299f,
- 0.894256f, 0.894214f, 0.894171f, 0.894128f, 0.894085f, 0.894042f, 0.893999f, 0.893956f,
- 0.893913f, 0.893870f, 0.893827f, 0.893784f, 0.893741f, 0.893698f, 0.893655f, 0.893612f,
- 0.893569f, 0.893526f, 0.893483f, 0.893440f, 0.893397f, 0.893354f, 0.893310f, 0.893267f,
- 0.893224f, 0.893181f, 0.893138f, 0.893095f, 0.893052f, 0.893009f, 0.892965f, 0.892922f,
- 0.892879f, 0.892836f, 0.892793f, 0.892750f, 0.892706f, 0.892663f, 0.892620f, 0.892577f,
- 0.892534f, 0.892490f, 0.892447f, 0.892404f, 0.892361f, 0.892317f, 0.892274f, 0.892231f,
- 0.892187f, 0.892144f, 0.892101f, 0.892057f, 0.892014f, 0.891971f, 0.891927f, 0.891884f,
- 0.891841f, 0.891797f, 0.891754f, 0.891711f, 0.891667f, 0.891624f, 0.891580f, 0.891537f,
- 0.891493f, 0.891450f, 0.891407f, 0.891363f, 0.891320f, 0.891276f, 0.891233f, 0.891189f,
- 0.891146f, 0.891102f, 0.891059f, 0.891015f, 0.890972f, 0.890928f, 0.890885f, 0.890841f,
- 0.890797f, 0.890754f, 0.890710f, 0.890667f, 0.890623f, 0.890580f, 0.890536f, 0.890492f,
- 0.890449f, 0.890405f, 0.890361f, 0.890318f, 0.890274f, 0.890230f, 0.890187f, 0.890143f,
- 0.890099f, 0.890056f, 0.890012f, 0.889968f, 0.889925f, 0.889881f, 0.889837f, 0.889793f,
- 0.889750f, 0.889706f, 0.889662f, 0.889618f, 0.889574f, 0.889531f, 0.889487f, 0.889443f,
- 0.889399f, 0.889355f, 0.889312f, 0.889268f, 0.889224f, 0.889180f, 0.889136f, 0.889092f,
- 0.889048f, 0.889004f, 0.888961f, 0.888917f, 0.888873f, 0.888829f, 0.888785f, 0.888741f,
- 0.888697f, 0.888653f, 0.888609f, 0.888565f, 0.888521f, 0.888477f, 0.888433f, 0.888389f,
- 0.888345f, 0.888301f, 0.888257f, 0.888213f, 0.888169f, 0.888125f, 0.888081f, 0.888037f,
- 0.887993f, 0.887949f, 0.887904f, 0.887860f, 0.887816f, 0.887772f, 0.887728f, 0.887684f,
- 0.887640f, 0.887595f, 0.887551f, 0.887507f, 0.887463f, 0.887419f, 0.887375f, 0.887330f,
- 0.887286f, 0.887242f, 0.887198f, 0.887153f, 0.887109f, 0.887065f, 0.887021f, 0.886976f,
- 0.886932f, 0.886888f, 0.886844f, 0.886799f, 0.886755f, 0.886711f, 0.886666f, 0.886622f,
- 0.886578f, 0.886533f, 0.886489f, 0.886445f, 0.886400f, 0.886356f, 0.886311f, 0.886267f,
- 0.886223f, 0.886178f, 0.886134f, 0.886089f, 0.886045f, 0.886000f, 0.885956f, 0.885911f,
- 0.885867f, 0.885822f, 0.885778f, 0.885733f, 0.885689f, 0.885644f, 0.885600f, 0.885555f,
- 0.885511f, 0.885466f, 0.885422f, 0.885377f, 0.885333f, 0.885288f, 0.885243f, 0.885199f,
- 0.885154f, 0.885110f, 0.885065f, 0.885020f, 0.884976f, 0.884931f, 0.884886f, 0.884842f,
- 0.884797f, 0.884752f, 0.884708f, 0.884663f, 0.884618f, 0.884574f, 0.884529f, 0.884484f,
- 0.884439f, 0.884395f, 0.884350f, 0.884305f, 0.884260f, 0.884216f, 0.884171f, 0.884126f,
- 0.884081f, 0.884036f, 0.883992f, 0.883947f, 0.883902f, 0.883857f, 0.883812f, 0.883767f,
- 0.883723f, 0.883678f, 0.883633f, 0.883588f, 0.883543f, 0.883498f, 0.883453f, 0.883408f,
- 0.883363f, 0.883318f, 0.883273f, 0.883228f, 0.883184f, 0.883139f, 0.883094f, 0.883049f,
- 0.883004f, 0.882959f, 0.882914f, 0.882869f, 0.882824f, 0.882779f, 0.882733f, 0.882688f,
- 0.882643f, 0.882598f, 0.882553f, 0.882508f, 0.882463f, 0.882418f, 0.882373f, 0.882328f,
- 0.882283f, 0.882237f, 0.882192f, 0.882147f, 0.882102f, 0.882057f, 0.882012f, 0.881966f,
- 0.881921f, 0.881876f, 0.881831f, 0.881786f, 0.881740f, 0.881695f, 0.881650f, 0.881605f,
- 0.881559f, 0.881514f, 0.881469f, 0.881424f, 0.881378f, 0.881333f, 0.881288f, 0.881242f,
- 0.881197f, 0.881152f, 0.881106f, 0.881061f, 0.881016f, 0.880970f, 0.880925f, 0.880880f,
- 0.880834f, 0.880789f, 0.880743f, 0.880698f, 0.880653f, 0.880607f, 0.880562f, 0.880516f,
- 0.880471f, 0.880425f, 0.880380f, 0.880334f, 0.880289f, 0.880244f, 0.880198f, 0.880153f,
- 0.880107f, 0.880061f, 0.880016f, 0.879970f, 0.879925f, 0.879879f, 0.879834f, 0.879788f,
- 0.879743f, 0.879697f, 0.879651f, 0.879606f, 0.879560f, 0.879515f, 0.879469f, 0.879423f,
- 0.879378f, 0.879332f, 0.879286f, 0.879241f, 0.879195f, 0.879149f, 0.879104f, 0.879058f,
- 0.879012f, 0.878967f, 0.878921f, 0.878875f, 0.878829f, 0.878784f, 0.878738f, 0.878692f,
- 0.878646f, 0.878600f, 0.878555f, 0.878509f, 0.878463f, 0.878417f, 0.878371f, 0.878326f,
- 0.878280f, 0.878234f, 0.878188f, 0.878142f, 0.878096f, 0.878051f, 0.878005f, 0.877959f,
- 0.877913f, 0.877867f, 0.877821f, 0.877775f, 0.877729f, 0.877683f, 0.877637f, 0.877591f,
- 0.877545f, 0.877499f, 0.877453f, 0.877407f, 0.877361f, 0.877315f, 0.877269f, 0.877223f,
- 0.877177f, 0.877131f, 0.877085f, 0.877039f, 0.876993f, 0.876947f, 0.876901f, 0.876855f,
- 0.876809f, 0.876763f, 0.876716f, 0.876670f, 0.876624f, 0.876578f, 0.876532f, 0.876486f,
- 0.876440f, 0.876393f, 0.876347f, 0.876301f, 0.876255f, 0.876209f, 0.876163f, 0.876116f,
- 0.876070f, 0.876024f, 0.875978f, 0.875931f, 0.875885f, 0.875839f, 0.875793f, 0.875746f,
- 0.875700f, 0.875654f, 0.875607f, 0.875561f, 0.875515f, 0.875468f, 0.875422f, 0.875376f,
- 0.875329f, 0.875283f, 0.875237f, 0.875190f, 0.875144f, 0.875098f, 0.875051f, 0.875005f,
- 0.874958f, 0.874912f, 0.874865f, 0.874819f, 0.874773f, 0.874726f, 0.874680f, 0.874633f,
- 0.874587f, 0.874540f, 0.874494f, 0.874447f, 0.874401f, 0.874354f, 0.874308f, 0.874261f,
- 0.874215f, 0.874168f, 0.874121f, 0.874075f, 0.874028f, 0.873982f, 0.873935f, 0.873888f,
- 0.873842f, 0.873795f, 0.873749f, 0.873702f, 0.873655f, 0.873609f, 0.873562f, 0.873515f,
- 0.873469f, 0.873422f, 0.873375f, 0.873329f, 0.873282f, 0.873235f, 0.873188f, 0.873142f,
- 0.873095f, 0.873048f, 0.873001f, 0.872955f, 0.872908f, 0.872861f, 0.872814f, 0.872768f,
- 0.872721f, 0.872674f, 0.872627f, 0.872580f, 0.872534f, 0.872487f, 0.872440f, 0.872393f,
- 0.872346f, 0.872299f, 0.872252f, 0.872205f, 0.872159f, 0.872112f, 0.872065f, 0.872018f,
- 0.871971f, 0.871924f, 0.871877f, 0.871830f, 0.871783f, 0.871736f, 0.871689f, 0.871642f,
- 0.871595f, 0.871548f, 0.871501f, 0.871454f, 0.871407f, 0.871360f, 0.871313f, 0.871266f,
- 0.871219f, 0.871172f, 0.871125f, 0.871078f, 0.871031f, 0.870983f, 0.870936f, 0.870889f,
- 0.870842f, 0.870795f, 0.870748f, 0.870701f, 0.870654f, 0.870606f, 0.870559f, 0.870512f,
- 0.870465f, 0.870418f, 0.870370f, 0.870323f, 0.870276f, 0.870229f, 0.870182f, 0.870134f,
- 0.870087f, 0.870040f, 0.869992f, 0.869945f, 0.869898f, 0.869851f, 0.869803f, 0.869756f,
- 0.869709f, 0.869661f, 0.869614f, 0.869567f, 0.869519f, 0.869472f, 0.869425f, 0.869377f,
- 0.869330f, 0.869282f, 0.869235f, 0.869188f, 0.869140f, 0.869093f, 0.869045f, 0.868998f,
- 0.868951f, 0.868903f, 0.868856f, 0.868808f, 0.868761f, 0.868713f, 0.868666f, 0.868618f,
- 0.868571f, 0.868523f, 0.868476f, 0.868428f, 0.868381f, 0.868333f, 0.868285f, 0.868238f,
- 0.868190f, 0.868143f, 0.868095f, 0.868048f, 0.868000f, 0.867952f, 0.867905f, 0.867857f,
- 0.867809f, 0.867762f, 0.867714f, 0.867667f, 0.867619f, 0.867571f, 0.867523f, 0.867476f,
- 0.867428f, 0.867380f, 0.867333f, 0.867285f, 0.867237f, 0.867190f, 0.867142f, 0.867094f,
- 0.867046f, 0.866998f, 0.866951f, 0.866903f, 0.866855f, 0.866807f, 0.866759f, 0.866712f,
- 0.866664f, 0.866616f, 0.866568f, 0.866520f, 0.866472f, 0.866425f, 0.866377f, 0.866329f,
- 0.866281f, 0.866233f, 0.866185f, 0.866137f, 0.866089f, 0.866041f, 0.865993f, 0.865946f,
- 0.865898f, 0.865850f, 0.865802f, 0.865754f, 0.865706f, 0.865658f, 0.865610f, 0.865562f,
- 0.865514f, 0.865466f, 0.865418f, 0.865369f, 0.865321f, 0.865273f, 0.865225f, 0.865177f,
- 0.865129f, 0.865081f, 0.865033f, 0.864985f, 0.864937f, 0.864889f, 0.864841f, 0.864792f,
- 0.864744f, 0.864696f, 0.864648f, 0.864600f, 0.864552f, 0.864503f, 0.864455f, 0.864407f,
- 0.864359f, 0.864311f, 0.864262f, 0.864214f, 0.864166f, 0.864118f, 0.864069f, 0.864021f,
- 0.863973f, 0.863925f, 0.863876f, 0.863828f, 0.863780f, 0.863731f, 0.863683f, 0.863635f,
- 0.863586f, 0.863538f, 0.863490f, 0.863441f, 0.863393f, 0.863345f, 0.863296f, 0.863248f,
- 0.863199f, 0.863151f, 0.863103f, 0.863054f, 0.863006f, 0.862957f, 0.862909f, 0.862860f,
- 0.862812f, 0.862763f, 0.862715f, 0.862666f, 0.862618f, 0.862570f, 0.862521f, 0.862472f,
- 0.862424f, 0.862375f, 0.862327f, 0.862278f, 0.862230f, 0.862181f, 0.862133f, 0.862084f,
- 0.862035f, 0.861987f, 0.861938f, 0.861890f, 0.861841f, 0.861792f, 0.861744f, 0.861695f,
- 0.861646f, 0.861598f, 0.861549f, 0.861500f, 0.861452f, 0.861403f, 0.861354f, 0.861306f,
- 0.861257f, 0.861208f, 0.861160f, 0.861111f, 0.861062f, 0.861013f, 0.860964f, 0.860916f,
- 0.860867f, 0.860818f, 0.860769f, 0.860721f, 0.860672f, 0.860623f, 0.860574f, 0.860525f,
- 0.860476f, 0.860428f, 0.860379f, 0.860330f, 0.860281f, 0.860232f, 0.860183f, 0.860134f,
- 0.860085f, 0.860036f, 0.859988f, 0.859939f, 0.859890f, 0.859841f, 0.859792f, 0.859743f,
- 0.859694f, 0.859645f, 0.859596f, 0.859547f, 0.859498f, 0.859449f, 0.859400f, 0.859351f,
- 0.859302f, 0.859253f, 0.859204f, 0.859155f, 0.859106f, 0.859057f, 0.859007f, 0.858958f,
- 0.858909f, 0.858860f, 0.858811f, 0.858762f, 0.858713f, 0.858664f, 0.858615f, 0.858565f,
- 0.858516f, 0.858467f, 0.858418f, 0.858369f, 0.858320f, 0.858270f, 0.858221f, 0.858172f,
- 0.858123f, 0.858073f, 0.858024f, 0.857975f, 0.857926f, 0.857876f, 0.857827f, 0.857778f,
- 0.857729f, 0.857679f, 0.857630f, 0.857581f, 0.857531f, 0.857482f, 0.857433f, 0.857383f,
- 0.857334f, 0.857285f, 0.857235f, 0.857186f, 0.857137f, 0.857087f, 0.857038f, 0.856988f,
- 0.856939f, 0.856890f, 0.856840f, 0.856791f, 0.856741f, 0.856692f, 0.856642f, 0.856593f,
- 0.856543f, 0.856494f, 0.856444f, 0.856395f, 0.856345f, 0.856296f, 0.856246f, 0.856197f,
- 0.856147f, 0.856098f, 0.856048f, 0.855999f, 0.855949f, 0.855900f, 0.855850f, 0.855800f,
- 0.855751f, 0.855701f, 0.855651f, 0.855602f, 0.855552f, 0.855503f, 0.855453f, 0.855403f,
- 0.855354f, 0.855304f, 0.855254f, 0.855205f, 0.855155f, 0.855105f, 0.855056f, 0.855006f,
- 0.854956f, 0.854906f, 0.854857f, 0.854807f, 0.854757f, 0.854707f, 0.854658f, 0.854608f,
- 0.854558f, 0.854508f, 0.854458f, 0.854409f, 0.854359f, 0.854309f, 0.854259f, 0.854209f,
- 0.854159f, 0.854110f, 0.854060f, 0.854010f, 0.853960f, 0.853910f, 0.853860f, 0.853810f,
- 0.853760f, 0.853710f, 0.853660f, 0.853611f, 0.853561f, 0.853511f, 0.853461f, 0.853411f,
- 0.853361f, 0.853311f, 0.853261f, 0.853211f, 0.853161f, 0.853111f, 0.853061f, 0.853011f,
- 0.852961f, 0.852911f, 0.852861f, 0.852810f, 0.852760f, 0.852710f, 0.852660f, 0.852610f,
- 0.852560f, 0.852510f, 0.852460f, 0.852410f, 0.852360f, 0.852309f, 0.852259f, 0.852209f,
- 0.852159f, 0.852109f, 0.852059f, 0.852008f, 0.851958f, 0.851908f, 0.851858f, 0.851808f,
- 0.851757f, 0.851707f, 0.851657f, 0.851607f, 0.851556f, 0.851506f, 0.851456f, 0.851406f,
- 0.851355f, 0.851305f, 0.851255f, 0.851204f, 0.851154f, 0.851104f, 0.851053f, 0.851003f,
- 0.850953f, 0.850902f, 0.850852f, 0.850801f, 0.850751f, 0.850701f, 0.850650f, 0.850600f,
- 0.850549f, 0.850499f, 0.850449f, 0.850398f, 0.850348f, 0.850297f, 0.850247f, 0.850196f,
- 0.850146f, 0.850095f, 0.850045f, 0.849994f, 0.849944f, 0.849893f, 0.849843f, 0.849792f,
- 0.849742f, 0.849691f, 0.849641f, 0.849590f, 0.849540f, 0.849489f, 0.849438f, 0.849388f,
- 0.849337f, 0.849287f, 0.849236f, 0.849185f, 0.849135f, 0.849084f, 0.849033f, 0.848983f,
- 0.848932f, 0.848881f, 0.848831f, 0.848780f, 0.848729f, 0.848679f, 0.848628f, 0.848577f,
- 0.848526f, 0.848476f, 0.848425f, 0.848374f, 0.848323f, 0.848273f, 0.848222f, 0.848171f,
- 0.848120f, 0.848070f, 0.848019f, 0.847968f, 0.847917f, 0.847866f, 0.847815f, 0.847765f,
- 0.847714f, 0.847663f, 0.847612f, 0.847561f, 0.847510f, 0.847459f, 0.847408f, 0.847358f,
- 0.847307f, 0.847256f, 0.847205f, 0.847154f, 0.847103f, 0.847052f, 0.847001f, 0.846950f,
- 0.846899f, 0.846848f, 0.846797f, 0.846746f, 0.846695f, 0.846644f, 0.846593f, 0.846542f,
- 0.846491f, 0.846440f, 0.846389f, 0.846338f, 0.846287f, 0.846236f, 0.846185f, 0.846133f,
- 0.846082f, 0.846031f, 0.845980f, 0.845929f, 0.845878f, 0.845827f, 0.845776f, 0.845724f,
- 0.845673f, 0.845622f, 0.845571f, 0.845520f, 0.845469f, 0.845417f, 0.845366f, 0.845315f,
- 0.845264f, 0.845212f, 0.845161f, 0.845110f, 0.845059f, 0.845007f, 0.844956f, 0.844905f,
- 0.844854f, 0.844802f, 0.844751f, 0.844700f, 0.844648f, 0.844597f, 0.844546f, 0.844494f,
- 0.844443f, 0.844392f, 0.844340f, 0.844289f, 0.844238f, 0.844186f, 0.844135f, 0.844083f,
- 0.844032f, 0.843980f, 0.843929f, 0.843878f, 0.843826f, 0.843775f, 0.843723f, 0.843672f,
- 0.843620f, 0.843569f, 0.843517f, 0.843466f, 0.843414f, 0.843363f, 0.843311f, 0.843260f,
- 0.843208f, 0.843157f, 0.843105f, 0.843054f, 0.843002f, 0.842950f, 0.842899f, 0.842847f,
- 0.842796f, 0.842744f, 0.842692f, 0.842641f, 0.842589f, 0.842538f, 0.842486f, 0.842434f,
- 0.842383f, 0.842331f, 0.842279f, 0.842228f, 0.842176f, 0.842124f, 0.842072f, 0.842021f,
- 0.841969f, 0.841917f, 0.841866f, 0.841814f, 0.841762f, 0.841710f, 0.841659f, 0.841607f,
- 0.841555f, 0.841503f, 0.841451f, 0.841400f, 0.841348f, 0.841296f, 0.841244f, 0.841192f,
- 0.841140f, 0.841089f, 0.841037f, 0.840985f, 0.840933f, 0.840881f, 0.840829f, 0.840777f,
- 0.840725f, 0.840673f, 0.840622f, 0.840570f, 0.840518f, 0.840466f, 0.840414f, 0.840362f,
- 0.840310f, 0.840258f, 0.840206f, 0.840154f, 0.840102f, 0.840050f, 0.839998f, 0.839946f,
- 0.839894f, 0.839842f, 0.839790f, 0.839738f, 0.839686f, 0.839634f, 0.839581f, 0.839529f,
- 0.839477f, 0.839425f, 0.839373f, 0.839321f, 0.839269f, 0.839217f, 0.839165f, 0.839112f,
- 0.839060f, 0.839008f, 0.838956f, 0.838904f, 0.838852f, 0.838799f, 0.838747f, 0.838695f,
- 0.838643f, 0.838591f, 0.838538f, 0.838486f, 0.838434f, 0.838382f, 0.838329f, 0.838277f,
- 0.838225f, 0.838172f, 0.838120f, 0.838068f, 0.838015f, 0.837963f, 0.837911f, 0.837859f,
- 0.837806f, 0.837754f, 0.837701f, 0.837649f, 0.837597f, 0.837544f, 0.837492f, 0.837440f,
- 0.837387f, 0.837335f, 0.837282f, 0.837230f, 0.837178f, 0.837125f, 0.837073f, 0.837020f,
- 0.836968f, 0.836915f, 0.836863f, 0.836810f, 0.836758f, 0.836705f, 0.836653f, 0.836600f,
- 0.836548f, 0.836495f, 0.836443f, 0.836390f, 0.836338f, 0.836285f, 0.836232f, 0.836180f,
- 0.836127f, 0.836075f, 0.836022f, 0.835969f, 0.835917f, 0.835864f, 0.835812f, 0.835759f,
- 0.835706f, 0.835654f, 0.835601f, 0.835548f, 0.835496f, 0.835443f, 0.835390f, 0.835338f,
- 0.835285f, 0.835232f, 0.835179f, 0.835127f, 0.835074f, 0.835021f, 0.834968f, 0.834916f,
- 0.834863f, 0.834810f, 0.834757f, 0.834705f, 0.834652f, 0.834599f, 0.834546f, 0.834493f,
- 0.834440f, 0.834388f, 0.834335f, 0.834282f, 0.834229f, 0.834176f, 0.834123f, 0.834070f,
- 0.834018f, 0.833965f, 0.833912f, 0.833859f, 0.833806f, 0.833753f, 0.833700f, 0.833647f,
- 0.833594f, 0.833541f, 0.833488f, 0.833435f, 0.833382f, 0.833329f, 0.833276f, 0.833223f,
- 0.833170f, 0.833117f, 0.833064f, 0.833011f, 0.832958f, 0.832905f, 0.832852f, 0.832799f,
- 0.832746f, 0.832693f, 0.832640f, 0.832586f, 0.832533f, 0.832480f, 0.832427f, 0.832374f,
- 0.832321f, 0.832268f, 0.832215f, 0.832161f, 0.832108f, 0.832055f, 0.832002f, 0.831949f,
- 0.831895f, 0.831842f, 0.831789f, 0.831736f, 0.831683f, 0.831629f, 0.831576f, 0.831523f,
- 0.831470f, 0.831416f, 0.831363f, 0.831310f, 0.831257f, 0.831203f, 0.831150f, 0.831097f,
- 0.831043f, 0.830990f, 0.830937f, 0.830883f, 0.830830f, 0.830777f, 0.830723f, 0.830670f,
- 0.830616f, 0.830563f, 0.830510f, 0.830456f, 0.830403f, 0.830349f, 0.830296f, 0.830243f,
- 0.830189f, 0.830136f, 0.830082f, 0.830029f, 0.829975f, 0.829922f, 0.829868f, 0.829815f,
- 0.829761f, 0.829708f, 0.829654f, 0.829601f, 0.829547f, 0.829494f, 0.829440f, 0.829386f,
- 0.829333f, 0.829279f, 0.829226f, 0.829172f, 0.829119f, 0.829065f, 0.829011f, 0.828958f,
- 0.828904f, 0.828851f, 0.828797f, 0.828743f, 0.828690f, 0.828636f, 0.828582f, 0.828529f,
- 0.828475f, 0.828421f, 0.828367f, 0.828314f, 0.828260f, 0.828206f, 0.828153f, 0.828099f,
- 0.828045f, 0.827991f, 0.827938f, 0.827884f, 0.827830f, 0.827776f, 0.827722f, 0.827669f,
- 0.827615f, 0.827561f, 0.827507f, 0.827453f, 0.827399f, 0.827346f, 0.827292f, 0.827238f,
- 0.827184f, 0.827130f, 0.827076f, 0.827022f, 0.826968f, 0.826915f, 0.826861f, 0.826807f,
- 0.826753f, 0.826699f, 0.826645f, 0.826591f, 0.826537f, 0.826483f, 0.826429f, 0.826375f,
- 0.826321f, 0.826267f, 0.826213f, 0.826159f, 0.826105f, 0.826051f, 0.825997f, 0.825943f,
- 0.825889f, 0.825835f, 0.825781f, 0.825727f, 0.825673f, 0.825618f, 0.825564f, 0.825510f,
- 0.825456f, 0.825402f, 0.825348f, 0.825294f, 0.825240f, 0.825185f, 0.825131f, 0.825077f,
- 0.825023f, 0.824969f, 0.824915f, 0.824860f, 0.824806f, 0.824752f, 0.824698f, 0.824644f,
- 0.824589f, 0.824535f, 0.824481f, 0.824427f, 0.824372f, 0.824318f, 0.824264f, 0.824209f,
- 0.824155f, 0.824101f, 0.824047f, 0.823992f, 0.823938f, 0.823884f, 0.823829f, 0.823775f,
- 0.823721f, 0.823666f, 0.823612f, 0.823557f, 0.823503f, 0.823449f, 0.823394f, 0.823340f,
- 0.823285f, 0.823231f, 0.823177f, 0.823122f, 0.823068f, 0.823013f, 0.822959f, 0.822904f,
- 0.822850f, 0.822795f, 0.822741f, 0.822686f, 0.822632f, 0.822577f, 0.822523f, 0.822468f,
- 0.822414f, 0.822359f, 0.822305f, 0.822250f, 0.822195f, 0.822141f, 0.822086f, 0.822032f,
- 0.821977f, 0.821922f, 0.821868f, 0.821813f, 0.821759f, 0.821704f, 0.821649f, 0.821595f,
- 0.821540f, 0.821485f, 0.821431f, 0.821376f, 0.821321f, 0.821267f, 0.821212f, 0.821157f,
- 0.821102f, 0.821048f, 0.820993f, 0.820938f, 0.820884f, 0.820829f, 0.820774f, 0.820719f,
- 0.820664f, 0.820610f, 0.820555f, 0.820500f, 0.820445f, 0.820390f, 0.820336f, 0.820281f,
- 0.820226f, 0.820171f, 0.820116f, 0.820061f, 0.820007f, 0.819952f, 0.819897f, 0.819842f,
- 0.819787f, 0.819732f, 0.819677f, 0.819622f, 0.819567f, 0.819512f, 0.819457f, 0.819402f,
- 0.819348f, 0.819293f, 0.819238f, 0.819183f, 0.819128f, 0.819073f, 0.819018f, 0.818963f,
- 0.818908f, 0.818853f, 0.818798f, 0.818742f, 0.818687f, 0.818632f, 0.818577f, 0.818522f,
- 0.818467f, 0.818412f, 0.818357f, 0.818302f, 0.818247f, 0.818192f, 0.818137f, 0.818081f,
- 0.818026f, 0.817971f, 0.817916f, 0.817861f, 0.817806f, 0.817750f, 0.817695f, 0.817640f,
- 0.817585f, 0.817530f, 0.817474f, 0.817419f, 0.817364f, 0.817309f, 0.817253f, 0.817198f,
- 0.817143f, 0.817088f, 0.817032f, 0.816977f, 0.816922f, 0.816867f, 0.816811f, 0.816756f,
- 0.816701f, 0.816645f, 0.816590f, 0.816535f, 0.816479f, 0.816424f, 0.816368f, 0.816313f,
- 0.816258f, 0.816202f, 0.816147f, 0.816092f, 0.816036f, 0.815981f, 0.815925f, 0.815870f,
- 0.815814f, 0.815759f, 0.815704f, 0.815648f, 0.815593f, 0.815537f, 0.815482f, 0.815426f,
- 0.815371f, 0.815315f, 0.815260f, 0.815204f, 0.815149f, 0.815093f, 0.815037f, 0.814982f,
- 0.814926f, 0.814871f, 0.814815f, 0.814760f, 0.814704f, 0.814648f, 0.814593f, 0.814537f,
- 0.814482f, 0.814426f, 0.814370f, 0.814315f, 0.814259f, 0.814203f, 0.814148f, 0.814092f,
- 0.814036f, 0.813981f, 0.813925f, 0.813869f, 0.813814f, 0.813758f, 0.813702f, 0.813646f,
- 0.813591f, 0.813535f, 0.813479f, 0.813423f, 0.813368f, 0.813312f, 0.813256f, 0.813200f,
- 0.813144f, 0.813089f, 0.813033f, 0.812977f, 0.812921f, 0.812865f, 0.812809f, 0.812754f,
- 0.812698f, 0.812642f, 0.812586f, 0.812530f, 0.812474f, 0.812418f, 0.812362f, 0.812307f,
- 0.812251f, 0.812195f, 0.812139f, 0.812083f, 0.812027f, 0.811971f, 0.811915f, 0.811859f,
- 0.811803f, 0.811747f, 0.811691f, 0.811635f, 0.811579f, 0.811523f, 0.811467f, 0.811411f,
- 0.811355f, 0.811299f, 0.811243f, 0.811187f, 0.811131f, 0.811075f, 0.811018f, 0.810962f,
- 0.810906f, 0.810850f, 0.810794f, 0.810738f, 0.810682f, 0.810626f, 0.810570f, 0.810513f,
- 0.810457f, 0.810401f, 0.810345f, 0.810289f, 0.810232f, 0.810176f, 0.810120f, 0.810064f,
- 0.810008f, 0.809951f, 0.809895f, 0.809839f, 0.809783f, 0.809726f, 0.809670f, 0.809614f,
- 0.809558f, 0.809501f, 0.809445f, 0.809389f, 0.809332f, 0.809276f, 0.809220f, 0.809164f,
- 0.809107f, 0.809051f, 0.808994f, 0.808938f, 0.808882f, 0.808825f, 0.808769f, 0.808713f,
- 0.808656f, 0.808600f, 0.808543f, 0.808487f, 0.808430f, 0.808374f, 0.808318f, 0.808261f,
- 0.808205f, 0.808148f, 0.808092f, 0.808035f, 0.807979f, 0.807922f, 0.807866f, 0.807809f,
- 0.807753f, 0.807696f, 0.807640f, 0.807583f, 0.807527f, 0.807470f, 0.807414f, 0.807357f,
- 0.807300f, 0.807244f, 0.807187f, 0.807131f, 0.807074f, 0.807017f, 0.806961f, 0.806904f,
- 0.806848f, 0.806791f, 0.806734f, 0.806678f, 0.806621f, 0.806564f, 0.806508f, 0.806451f,
- 0.806394f, 0.806338f, 0.806281f, 0.806224f, 0.806167f, 0.806111f, 0.806054f, 0.805997f,
- 0.805940f, 0.805884f, 0.805827f, 0.805770f, 0.805713f, 0.805656f, 0.805600f, 0.805543f,
- 0.805486f, 0.805429f, 0.805372f, 0.805316f, 0.805259f, 0.805202f, 0.805145f, 0.805088f,
- 0.805031f, 0.804974f, 0.804918f, 0.804861f, 0.804804f, 0.804747f, 0.804690f, 0.804633f,
- 0.804576f, 0.804519f, 0.804462f, 0.804405f, 0.804348f, 0.804291f, 0.804234f, 0.804177f,
- 0.804120f, 0.804063f, 0.804006f, 0.803949f, 0.803892f, 0.803835f, 0.803778f, 0.803721f,
- 0.803664f, 0.803607f, 0.803550f, 0.803493f, 0.803436f, 0.803379f, 0.803322f, 0.803265f,
- 0.803208f, 0.803150f, 0.803093f, 0.803036f, 0.802979f, 0.802922f, 0.802865f, 0.802808f,
- 0.802750f, 0.802693f, 0.802636f, 0.802579f, 0.802522f, 0.802464f, 0.802407f, 0.802350f,
- 0.802293f, 0.802236f, 0.802178f, 0.802121f, 0.802064f, 0.802007f, 0.801949f, 0.801892f,
- 0.801835f, 0.801777f, 0.801720f, 0.801663f, 0.801606f, 0.801548f, 0.801491f, 0.801434f,
- 0.801376f, 0.801319f, 0.801261f, 0.801204f, 0.801147f, 0.801089f, 0.801032f, 0.800975f,
- 0.800917f, 0.800860f, 0.800802f, 0.800745f, 0.800687f, 0.800630f, 0.800573f, 0.800515f,
- 0.800458f, 0.800400f, 0.800343f, 0.800285f, 0.800228f, 0.800170f, 0.800113f, 0.800055f,
- 0.799998f, 0.799940f, 0.799883f, 0.799825f, 0.799768f, 0.799710f, 0.799652f, 0.799595f,
- 0.799537f, 0.799480f, 0.799422f, 0.799365f, 0.799307f, 0.799249f, 0.799192f, 0.799134f,
- 0.799076f, 0.799019f, 0.798961f, 0.798903f, 0.798846f, 0.798788f, 0.798730f, 0.798673f,
- 0.798615f, 0.798557f, 0.798500f, 0.798442f, 0.798384f, 0.798326f, 0.798269f, 0.798211f,
- 0.798153f, 0.798095f, 0.798038f, 0.797980f, 0.797922f, 0.797864f, 0.797806f, 0.797749f,
- 0.797691f, 0.797633f, 0.797575f, 0.797517f, 0.797459f, 0.797402f, 0.797344f, 0.797286f,
- 0.797228f, 0.797170f, 0.797112f, 0.797054f, 0.796996f, 0.796939f, 0.796881f, 0.796823f,
- 0.796765f, 0.796707f, 0.796649f, 0.796591f, 0.796533f, 0.796475f, 0.796417f, 0.796359f,
- 0.796301f, 0.796243f, 0.796185f, 0.796127f, 0.796069f, 0.796011f, 0.795953f, 0.795895f,
- 0.795837f, 0.795779f, 0.795721f, 0.795663f, 0.795605f, 0.795547f, 0.795488f, 0.795430f,
- 0.795372f, 0.795314f, 0.795256f, 0.795198f, 0.795140f, 0.795082f, 0.795023f, 0.794965f,
- 0.794907f, 0.794849f, 0.794791f, 0.794733f, 0.794674f, 0.794616f, 0.794558f, 0.794500f,
- 0.794442f, 0.794383f, 0.794325f, 0.794267f, 0.794209f, 0.794150f, 0.794092f, 0.794034f,
- 0.793975f, 0.793917f, 0.793859f, 0.793801f, 0.793742f, 0.793684f, 0.793626f, 0.793567f,
- 0.793509f, 0.793451f, 0.793392f, 0.793334f, 0.793276f, 0.793217f, 0.793159f, 0.793100f,
- 0.793042f, 0.792984f, 0.792925f, 0.792867f, 0.792808f, 0.792750f, 0.792691f, 0.792633f,
- 0.792575f, 0.792516f, 0.792458f, 0.792399f, 0.792341f, 0.792282f, 0.792224f, 0.792165f,
- 0.792107f, 0.792048f, 0.791990f, 0.791931f, 0.791872f, 0.791814f, 0.791755f, 0.791697f,
- 0.791638f, 0.791580f, 0.791521f, 0.791462f, 0.791404f, 0.791345f, 0.791287f, 0.791228f,
- 0.791169f, 0.791111f, 0.791052f, 0.790993f, 0.790935f, 0.790876f, 0.790817f, 0.790759f,
- 0.790700f, 0.790641f, 0.790583f, 0.790524f, 0.790465f, 0.790406f, 0.790348f, 0.790289f,
- 0.790230f, 0.790171f, 0.790113f, 0.790054f, 0.789995f, 0.789936f, 0.789878f, 0.789819f,
- 0.789760f, 0.789701f, 0.789642f, 0.789584f, 0.789525f, 0.789466f, 0.789407f, 0.789348f,
- 0.789289f, 0.789230f, 0.789172f, 0.789113f, 0.789054f, 0.788995f, 0.788936f, 0.788877f,
- 0.788818f, 0.788759f, 0.788700f, 0.788641f, 0.788582f, 0.788523f, 0.788464f, 0.788405f,
- 0.788346f, 0.788287f, 0.788228f, 0.788169f, 0.788110f, 0.788051f, 0.787992f, 0.787933f,
- 0.787874f, 0.787815f, 0.787756f, 0.787697f, 0.787638f, 0.787579f, 0.787520f, 0.787461f,
- 0.787402f, 0.787343f, 0.787284f, 0.787224f, 0.787165f, 0.787106f, 0.787047f, 0.786988f,
- 0.786929f, 0.786870f, 0.786810f, 0.786751f, 0.786692f, 0.786633f, 0.786574f, 0.786514f,
- 0.786455f, 0.786396f, 0.786337f, 0.786278f, 0.786218f, 0.786159f, 0.786100f, 0.786041f,
- 0.785981f, 0.785922f, 0.785863f, 0.785803f, 0.785744f, 0.785685f, 0.785625f, 0.785566f,
- 0.785507f, 0.785447f, 0.785388f, 0.785329f, 0.785269f, 0.785210f, 0.785151f, 0.785091f,
- 0.785032f, 0.784973f, 0.784913f, 0.784854f, 0.784794f, 0.784735f, 0.784675f, 0.784616f,
- 0.784557f, 0.784497f, 0.784438f, 0.784378f, 0.784319f, 0.784259f, 0.784200f, 0.784140f,
- 0.784081f, 0.784021f, 0.783962f, 0.783902f, 0.783843f, 0.783783f, 0.783724f, 0.783664f,
- 0.783605f, 0.783545f, 0.783485f, 0.783426f, 0.783366f, 0.783307f, 0.783247f, 0.783187f,
- 0.783128f, 0.783068f, 0.783009f, 0.782949f, 0.782889f, 0.782830f, 0.782770f, 0.782710f,
- 0.782651f, 0.782591f, 0.782531f, 0.782472f, 0.782412f, 0.782352f, 0.782292f, 0.782233f,
- 0.782173f, 0.782113f, 0.782053f, 0.781994f, 0.781934f, 0.781874f, 0.781814f, 0.781755f,
- 0.781695f, 0.781635f, 0.781575f, 0.781515f, 0.781456f, 0.781396f, 0.781336f, 0.781276f,
- 0.781216f, 0.781156f, 0.781097f, 0.781037f, 0.780977f, 0.780917f, 0.780857f, 0.780797f,
- 0.780737f, 0.780677f, 0.780617f, 0.780557f, 0.780498f, 0.780438f, 0.780378f, 0.780318f,
- 0.780258f, 0.780198f, 0.780138f, 0.780078f, 0.780018f, 0.779958f, 0.779898f, 0.779838f,
- 0.779778f, 0.779718f, 0.779658f, 0.779598f, 0.779538f, 0.779478f, 0.779418f, 0.779357f,
- 0.779297f, 0.779237f, 0.779177f, 0.779117f, 0.779057f, 0.778997f, 0.778937f, 0.778877f,
- 0.778817f, 0.778756f, 0.778696f, 0.778636f, 0.778576f, 0.778516f, 0.778456f, 0.778395f,
- 0.778335f, 0.778275f, 0.778215f, 0.778155f, 0.778094f, 0.778034f, 0.777974f, 0.777914f,
- 0.777853f, 0.777793f, 0.777733f, 0.777673f, 0.777612f, 0.777552f, 0.777492f, 0.777431f,
- 0.777371f, 0.777311f, 0.777251f, 0.777190f, 0.777130f, 0.777070f, 0.777009f, 0.776949f,
- 0.776888f, 0.776828f, 0.776768f, 0.776707f, 0.776647f, 0.776587f, 0.776526f, 0.776466f,
- 0.776405f, 0.776345f, 0.776284f, 0.776224f, 0.776164f, 0.776103f, 0.776043f, 0.775982f,
- 0.775922f, 0.775861f, 0.775801f, 0.775740f, 0.775680f, 0.775619f, 0.775559f, 0.775498f,
- 0.775438f, 0.775377f, 0.775317f, 0.775256f, 0.775195f, 0.775135f, 0.775074f, 0.775014f,
- 0.774953f, 0.774893f, 0.774832f, 0.774771f, 0.774711f, 0.774650f, 0.774589f, 0.774529f,
- 0.774468f, 0.774407f, 0.774347f, 0.774286f, 0.774225f, 0.774165f, 0.774104f, 0.774043f,
- 0.773983f, 0.773922f, 0.773861f, 0.773801f, 0.773740f, 0.773679f, 0.773618f, 0.773558f,
- 0.773497f, 0.773436f, 0.773375f, 0.773314f, 0.773254f, 0.773193f, 0.773132f, 0.773071f,
- 0.773010f, 0.772950f, 0.772889f, 0.772828f, 0.772767f, 0.772706f, 0.772645f, 0.772584f,
- 0.772524f, 0.772463f, 0.772402f, 0.772341f, 0.772280f, 0.772219f, 0.772158f, 0.772097f,
- 0.772036f, 0.771975f, 0.771915f, 0.771854f, 0.771793f, 0.771732f, 0.771671f, 0.771610f,
- 0.771549f, 0.771488f, 0.771427f, 0.771366f, 0.771305f, 0.771244f, 0.771183f, 0.771122f,
- 0.771061f, 0.770999f, 0.770938f, 0.770877f, 0.770816f, 0.770755f, 0.770694f, 0.770633f,
- 0.770572f, 0.770511f, 0.770450f, 0.770389f, 0.770327f, 0.770266f, 0.770205f, 0.770144f,
- 0.770083f, 0.770022f, 0.769961f, 0.769899f, 0.769838f, 0.769777f, 0.769716f, 0.769655f,
- 0.769593f, 0.769532f, 0.769471f, 0.769410f, 0.769348f, 0.769287f, 0.769226f, 0.769165f,
- 0.769103f, 0.769042f, 0.768981f, 0.768919f, 0.768858f, 0.768797f, 0.768736f, 0.768674f,
- 0.768613f, 0.768552f, 0.768490f, 0.768429f, 0.768368f, 0.768306f, 0.768245f, 0.768183f,
- 0.768122f, 0.768061f, 0.767999f, 0.767938f, 0.767876f, 0.767815f, 0.767754f, 0.767692f,
- 0.767631f, 0.767569f, 0.767508f, 0.767446f, 0.767385f, 0.767323f, 0.767262f, 0.767200f,
- 0.767139f, 0.767077f, 0.767016f, 0.766954f, 0.766893f, 0.766831f, 0.766770f, 0.766708f,
- 0.766647f, 0.766585f, 0.766524f, 0.766462f, 0.766400f, 0.766339f, 0.766277f, 0.766216f,
- 0.766154f, 0.766092f, 0.766031f, 0.765969f, 0.765907f, 0.765846f, 0.765784f, 0.765723f,
- 0.765661f, 0.765599f, 0.765538f, 0.765476f, 0.765414f, 0.765352f, 0.765291f, 0.765229f,
- 0.765167f, 0.765106f, 0.765044f, 0.764982f, 0.764920f, 0.764859f, 0.764797f, 0.764735f,
- 0.764673f, 0.764611f, 0.764550f, 0.764488f, 0.764426f, 0.764364f, 0.764302f, 0.764241f,
- 0.764179f, 0.764117f, 0.764055f, 0.763993f, 0.763931f, 0.763869f, 0.763808f, 0.763746f,
- 0.763684f, 0.763622f, 0.763560f, 0.763498f, 0.763436f, 0.763374f, 0.763312f, 0.763250f,
- 0.763188f, 0.763126f, 0.763065f, 0.763003f, 0.762941f, 0.762879f, 0.762817f, 0.762755f,
- 0.762693f, 0.762631f, 0.762569f, 0.762507f, 0.762444f, 0.762382f, 0.762320f, 0.762258f,
- 0.762196f, 0.762134f, 0.762072f, 0.762010f, 0.761948f, 0.761886f, 0.761824f, 0.761762f,
- 0.761700f, 0.761637f, 0.761575f, 0.761513f, 0.761451f, 0.761389f, 0.761327f, 0.761265f,
- 0.761202f, 0.761140f, 0.761078f, 0.761016f, 0.760954f, 0.760891f, 0.760829f, 0.760767f,
- 0.760705f, 0.760643f, 0.760580f, 0.760518f, 0.760456f, 0.760394f, 0.760331f, 0.760269f,
- 0.760207f, 0.760144f, 0.760082f, 0.760020f, 0.759957f, 0.759895f, 0.759833f, 0.759771f,
- 0.759708f, 0.759646f, 0.759583f, 0.759521f, 0.759459f, 0.759396f, 0.759334f, 0.759272f,
- 0.759209f, 0.759147f, 0.759084f, 0.759022f, 0.758960f, 0.758897f, 0.758835f, 0.758772f,
- 0.758710f, 0.758647f, 0.758585f, 0.758522f, 0.758460f, 0.758397f, 0.758335f, 0.758272f,
- 0.758210f, 0.758147f, 0.758085f, 0.758022f, 0.757960f, 0.757897f, 0.757835f, 0.757772f,
- 0.757710f, 0.757647f, 0.757584f, 0.757522f, 0.757459f, 0.757397f, 0.757334f, 0.757271f,
- 0.757209f, 0.757146f, 0.757084f, 0.757021f, 0.756958f, 0.756896f, 0.756833f, 0.756770f,
- 0.756708f, 0.756645f, 0.756582f, 0.756520f, 0.756457f, 0.756394f, 0.756331f, 0.756269f,
- 0.756206f, 0.756143f, 0.756081f, 0.756018f, 0.755955f, 0.755892f, 0.755829f, 0.755767f,
- 0.755704f, 0.755641f, 0.755578f, 0.755516f, 0.755453f, 0.755390f, 0.755327f, 0.755264f,
- 0.755201f, 0.755139f, 0.755076f, 0.755013f, 0.754950f, 0.754887f, 0.754824f, 0.754761f,
- 0.754698f, 0.754636f, 0.754573f, 0.754510f, 0.754447f, 0.754384f, 0.754321f, 0.754258f,
- 0.754195f, 0.754132f, 0.754069f, 0.754006f, 0.753943f, 0.753880f, 0.753817f, 0.753754f,
- 0.753691f, 0.753628f, 0.753565f, 0.753502f, 0.753439f, 0.753376f, 0.753313f, 0.753250f,
- 0.753187f, 0.753124f, 0.753061f, 0.752998f, 0.752934f, 0.752871f, 0.752808f, 0.752745f,
- 0.752682f, 0.752619f, 0.752556f, 0.752493f, 0.752429f, 0.752366f, 0.752303f, 0.752240f,
- 0.752177f, 0.752114f, 0.752050f, 0.751987f, 0.751924f, 0.751861f, 0.751798f, 0.751734f,
- 0.751671f, 0.751608f, 0.751545f, 0.751481f, 0.751418f, 0.751355f, 0.751292f, 0.751228f,
- 0.751165f, 0.751102f, 0.751039f, 0.750975f, 0.750912f, 0.750849f, 0.750785f, 0.750722f,
- 0.750659f, 0.750595f, 0.750532f, 0.750469f, 0.750405f, 0.750342f, 0.750278f, 0.750215f,
- 0.750152f, 0.750088f, 0.750025f, 0.749961f, 0.749898f, 0.749835f, 0.749771f, 0.749708f,
- 0.749644f, 0.749581f, 0.749517f, 0.749454f, 0.749390f, 0.749327f, 0.749263f, 0.749200f,
- 0.749136f, 0.749073f, 0.749009f, 0.748946f, 0.748882f, 0.748819f, 0.748755f, 0.748692f,
- 0.748628f, 0.748565f, 0.748501f, 0.748437f, 0.748374f, 0.748310f, 0.748247f, 0.748183f,
- 0.748119f, 0.748056f, 0.747992f, 0.747929f, 0.747865f, 0.747801f, 0.747738f, 0.747674f,
- 0.747610f, 0.747547f, 0.747483f, 0.747419f, 0.747355f, 0.747292f, 0.747228f, 0.747164f,
- 0.747101f, 0.747037f, 0.746973f, 0.746909f, 0.746846f, 0.746782f, 0.746718f, 0.746654f,
- 0.746591f, 0.746527f, 0.746463f, 0.746399f, 0.746335f, 0.746272f, 0.746208f, 0.746144f,
- 0.746080f, 0.746016f, 0.745952f, 0.745889f, 0.745825f, 0.745761f, 0.745697f, 0.745633f,
- 0.745569f, 0.745505f, 0.745441f, 0.745377f, 0.745314f, 0.745250f, 0.745186f, 0.745122f,
- 0.745058f, 0.744994f, 0.744930f, 0.744866f, 0.744802f, 0.744738f, 0.744674f, 0.744610f,
- 0.744546f, 0.744482f, 0.744418f, 0.744354f, 0.744290f, 0.744226f, 0.744162f, 0.744098f,
- 0.744034f, 0.743970f, 0.743906f, 0.743842f, 0.743777f, 0.743713f, 0.743649f, 0.743585f,
- 0.743521f, 0.743457f, 0.743393f, 0.743329f, 0.743265f, 0.743200f, 0.743136f, 0.743072f,
- 0.743008f, 0.742944f, 0.742880f, 0.742815f, 0.742751f, 0.742687f, 0.742623f, 0.742559f,
- 0.742494f, 0.742430f, 0.742366f, 0.742302f, 0.742237f, 0.742173f, 0.742109f, 0.742045f,
- 0.741980f, 0.741916f, 0.741852f, 0.741788f, 0.741723f, 0.741659f, 0.741595f, 0.741530f,
- 0.741466f, 0.741402f, 0.741337f, 0.741273f, 0.741209f, 0.741144f, 0.741080f, 0.741015f,
- 0.740951f, 0.740887f, 0.740822f, 0.740758f, 0.740694f, 0.740629f, 0.740565f, 0.740500f,
- 0.740436f, 0.740371f, 0.740307f, 0.740242f, 0.740178f, 0.740114f, 0.740049f, 0.739985f,
- 0.739920f, 0.739856f, 0.739791f, 0.739727f, 0.739662f, 0.739598f, 0.739533f, 0.739468f,
- 0.739404f, 0.739339f, 0.739275f, 0.739210f, 0.739146f, 0.739081f, 0.739017f, 0.738952f,
- 0.738887f, 0.738823f, 0.738758f, 0.738693f, 0.738629f, 0.738564f, 0.738500f, 0.738435f,
- 0.738370f, 0.738306f, 0.738241f, 0.738176f, 0.738112f, 0.738047f, 0.737982f, 0.737918f,
- 0.737853f, 0.737788f, 0.737723f, 0.737659f, 0.737594f, 0.737529f, 0.737464f, 0.737400f,
- 0.737335f, 0.737270f, 0.737205f, 0.737141f, 0.737076f, 0.737011f, 0.736946f, 0.736881f,
- 0.736817f, 0.736752f, 0.736687f, 0.736622f, 0.736557f, 0.736492f, 0.736428f, 0.736363f,
- 0.736298f, 0.736233f, 0.736168f, 0.736103f, 0.736038f, 0.735973f, 0.735908f, 0.735844f,
- 0.735779f, 0.735714f, 0.735649f, 0.735584f, 0.735519f, 0.735454f, 0.735389f, 0.735324f,
- 0.735259f, 0.735194f, 0.735129f, 0.735064f, 0.734999f, 0.734934f, 0.734869f, 0.734804f,
- 0.734739f, 0.734674f, 0.734609f, 0.734544f, 0.734479f, 0.734414f, 0.734349f, 0.734283f,
- 0.734218f, 0.734153f, 0.734088f, 0.734023f, 0.733958f, 0.733893f, 0.733828f, 0.733763f,
- 0.733697f, 0.733632f, 0.733567f, 0.733502f, 0.733437f, 0.733372f, 0.733306f, 0.733241f,
- 0.733176f, 0.733111f, 0.733046f, 0.732980f, 0.732915f, 0.732850f, 0.732785f, 0.732720f,
- 0.732654f, 0.732589f, 0.732524f, 0.732458f, 0.732393f, 0.732328f, 0.732263f, 0.732197f,
- 0.732132f, 0.732067f, 0.732001f, 0.731936f, 0.731871f, 0.731805f, 0.731740f, 0.731675f,
- 0.731609f, 0.731544f, 0.731479f, 0.731413f, 0.731348f, 0.731282f, 0.731217f, 0.731152f,
- 0.731086f, 0.731021f, 0.730955f, 0.730890f, 0.730825f, 0.730759f, 0.730694f, 0.730628f,
- 0.730563f, 0.730497f, 0.730432f, 0.730366f, 0.730301f, 0.730235f, 0.730170f, 0.730104f,
- 0.730039f, 0.729973f, 0.729908f, 0.729842f, 0.729777f, 0.729711f, 0.729646f, 0.729580f,
- 0.729514f, 0.729449f, 0.729383f, 0.729318f, 0.729252f, 0.729186f, 0.729121f, 0.729055f,
- 0.728990f, 0.728924f, 0.728858f, 0.728793f, 0.728727f, 0.728661f, 0.728596f, 0.728530f,
- 0.728464f, 0.728399f, 0.728333f, 0.728267f, 0.728202f, 0.728136f, 0.728070f, 0.728004f,
- 0.727939f, 0.727873f, 0.727807f, 0.727741f, 0.727676f, 0.727610f, 0.727544f, 0.727478f,
- 0.727413f, 0.727347f, 0.727281f, 0.727215f, 0.727149f, 0.727084f, 0.727018f, 0.726952f,
- 0.726886f, 0.726820f, 0.726754f, 0.726689f, 0.726623f, 0.726557f, 0.726491f, 0.726425f,
- 0.726359f, 0.726293f, 0.726227f, 0.726161f, 0.726095f, 0.726030f, 0.725964f, 0.725898f,
- 0.725832f, 0.725766f, 0.725700f, 0.725634f, 0.725568f, 0.725502f, 0.725436f, 0.725370f,
- 0.725304f, 0.725238f, 0.725172f, 0.725106f, 0.725040f, 0.724974f, 0.724908f, 0.724842f,
- 0.724776f, 0.724710f, 0.724644f, 0.724578f, 0.724511f, 0.724445f, 0.724379f, 0.724313f,
- 0.724247f, 0.724181f, 0.724115f, 0.724049f, 0.723983f, 0.723916f, 0.723850f, 0.723784f,
- 0.723718f, 0.723652f, 0.723586f, 0.723520f, 0.723453f, 0.723387f, 0.723321f, 0.723255f,
- 0.723188f, 0.723122f, 0.723056f, 0.722990f, 0.722924f, 0.722857f, 0.722791f, 0.722725f,
- 0.722659f, 0.722592f, 0.722526f, 0.722460f, 0.722393f, 0.722327f, 0.722261f, 0.722194f,
- 0.722128f, 0.722062f, 0.721996f, 0.721929f, 0.721863f, 0.721797f, 0.721730f, 0.721664f,
- 0.721597f, 0.721531f, 0.721465f, 0.721398f, 0.721332f, 0.721265f, 0.721199f, 0.721133f,
- 0.721066f, 0.721000f, 0.720933f, 0.720867f, 0.720800f, 0.720734f, 0.720668f, 0.720601f,
- 0.720535f, 0.720468f, 0.720402f, 0.720335f, 0.720269f, 0.720202f, 0.720136f, 0.720069f,
- 0.720003f, 0.719936f, 0.719869f, 0.719803f, 0.719736f, 0.719670f, 0.719603f, 0.719537f,
- 0.719470f, 0.719403f, 0.719337f, 0.719270f, 0.719204f, 0.719137f, 0.719070f, 0.719004f,
- 0.718937f, 0.718870f, 0.718804f, 0.718737f, 0.718670f, 0.718604f, 0.718537f, 0.718471f,
- 0.718404f, 0.718337f, 0.718270f, 0.718204f, 0.718137f, 0.718070f, 0.718004f, 0.717937f,
- 0.717870f, 0.717803f, 0.717737f, 0.717670f, 0.717603f, 0.717536f, 0.717469f, 0.717403f,
- 0.717336f, 0.717269f, 0.717202f, 0.717135f, 0.717069f, 0.717002f, 0.716935f, 0.716868f,
- 0.716801f, 0.716734f, 0.716668f, 0.716601f, 0.716534f, 0.716467f, 0.716400f, 0.716333f,
- 0.716266f, 0.716199f, 0.716132f, 0.716066f, 0.715999f, 0.715932f, 0.715865f, 0.715798f,
- 0.715731f, 0.715664f, 0.715597f, 0.715530f, 0.715463f, 0.715396f, 0.715329f, 0.715262f,
- 0.715195f, 0.715128f, 0.715061f, 0.714994f, 0.714927f, 0.714860f, 0.714793f, 0.714726f,
- 0.714659f, 0.714592f, 0.714525f, 0.714457f, 0.714390f, 0.714323f, 0.714256f, 0.714189f,
- 0.714122f, 0.714055f, 0.713988f, 0.713921f, 0.713853f, 0.713786f, 0.713719f, 0.713652f,
- 0.713585f, 0.713518f, 0.713451f, 0.713383f, 0.713316f, 0.713249f, 0.713182f, 0.713115f,
- 0.713047f, 0.712980f, 0.712913f, 0.712846f, 0.712778f, 0.712711f, 0.712644f, 0.712577f,
- 0.712509f, 0.712442f, 0.712375f, 0.712308f, 0.712240f, 0.712173f, 0.712106f, 0.712038f,
- 0.711971f, 0.711904f, 0.711836f, 0.711769f, 0.711702f, 0.711634f, 0.711567f, 0.711500f,
- 0.711432f, 0.711365f, 0.711297f, 0.711230f, 0.711163f, 0.711095f, 0.711028f, 0.710960f,
- 0.710893f, 0.710826f, 0.710758f, 0.710691f, 0.710623f, 0.710556f, 0.710488f, 0.710421f,
- 0.710353f, 0.710286f, 0.710218f, 0.710151f, 0.710083f, 0.710016f, 0.709948f, 0.709881f,
- 0.709813f, 0.709746f, 0.709678f, 0.709611f, 0.709543f, 0.709476f, 0.709408f, 0.709340f,
- 0.709273f, 0.709205f, 0.709138f, 0.709070f, 0.709002f, 0.708935f, 0.708867f, 0.708800f,
- 0.708732f, 0.708664f, 0.708597f, 0.708529f, 0.708461f, 0.708394f, 0.708326f, 0.708258f,
- 0.708191f, 0.708123f, 0.708055f, 0.707988f, 0.707920f, 0.707852f, 0.707784f, 0.707717f,
- 0.707649f, 0.707581f, 0.707513f, 0.707446f, 0.707378f, 0.707310f, 0.707242f, 0.707175f,
- 0.707107f, 0.707039f, 0.706971f, 0.706903f, 0.706836f, 0.706768f, 0.706700f, 0.706632f,
- 0.706564f, 0.706496f, 0.706429f, 0.706361f, 0.706293f, 0.706225f, 0.706157f, 0.706089f,
- 0.706021f, 0.705953f, 0.705885f, 0.705818f, 0.705750f, 0.705682f, 0.705614f, 0.705546f,
- 0.705478f, 0.705410f, 0.705342f, 0.705274f, 0.705206f, 0.705138f, 0.705070f, 0.705002f,
- 0.704934f, 0.704866f, 0.704798f, 0.704730f, 0.704662f, 0.704594f, 0.704526f, 0.704458f,
- 0.704390f, 0.704322f, 0.704254f, 0.704186f, 0.704118f, 0.704050f, 0.703981f, 0.703913f,
- 0.703845f, 0.703777f, 0.703709f, 0.703641f, 0.703573f, 0.703505f, 0.703436f, 0.703368f,
- 0.703300f, 0.703232f, 0.703164f, 0.703096f, 0.703028f, 0.702959f, 0.702891f, 0.702823f,
- 0.702755f, 0.702687f, 0.702618f, 0.702550f, 0.702482f, 0.702414f, 0.702345f, 0.702277f,
- 0.702209f, 0.702141f, 0.702072f, 0.702004f, 0.701936f, 0.701868f, 0.701799f, 0.701731f,
- 0.701663f, 0.701594f, 0.701526f, 0.701458f, 0.701389f, 0.701321f, 0.701253f, 0.701184f,
- 0.701116f, 0.701048f, 0.700979f, 0.700911f, 0.700842f, 0.700774f, 0.700706f, 0.700637f,
- 0.700569f, 0.700500f, 0.700432f, 0.700364f, 0.700295f, 0.700227f, 0.700158f, 0.700090f,
- 0.700021f, 0.699953f, 0.699884f, 0.699816f, 0.699747f, 0.699679f, 0.699610f, 0.699542f,
- 0.699473f, 0.699405f, 0.699336f, 0.699268f, 0.699199f, 0.699131f, 0.699062f, 0.698994f,
- 0.698925f, 0.698856f, 0.698788f, 0.698719f, 0.698651f, 0.698582f, 0.698513f, 0.698445f,
- 0.698376f, 0.698308f, 0.698239f, 0.698170f, 0.698102f, 0.698033f, 0.697964f, 0.697896f,
- 0.697827f, 0.697758f, 0.697690f, 0.697621f, 0.697552f, 0.697484f, 0.697415f, 0.697346f,
- 0.697277f, 0.697209f, 0.697140f, 0.697071f, 0.697003f, 0.696934f, 0.696865f, 0.696796f,
- 0.696728f, 0.696659f, 0.696590f, 0.696521f, 0.696452f, 0.696384f, 0.696315f, 0.696246f,
- 0.696177f, 0.696108f, 0.696039f, 0.695971f, 0.695902f, 0.695833f, 0.695764f, 0.695695f,
- 0.695626f, 0.695557f, 0.695489f, 0.695420f, 0.695351f, 0.695282f, 0.695213f, 0.695144f,
- 0.695075f, 0.695006f, 0.694937f, 0.694868f, 0.694799f, 0.694730f, 0.694661f, 0.694592f,
- 0.694524f, 0.694454f, 0.694386f, 0.694317f, 0.694248f, 0.694179f, 0.694109f, 0.694040f,
- 0.693971f, 0.693902f, 0.693833f, 0.693764f, 0.693695f, 0.693626f, 0.693557f, 0.693488f,
- 0.693419f, 0.693350f, 0.693281f, 0.693212f, 0.693143f, 0.693074f, 0.693004f, 0.692935f,
- 0.692866f, 0.692797f, 0.692728f, 0.692659f, 0.692590f, 0.692520f, 0.692451f, 0.692382f,
- 0.692313f, 0.692244f, 0.692175f, 0.692105f, 0.692036f, 0.691967f, 0.691898f, 0.691828f,
- 0.691759f, 0.691690f, 0.691621f, 0.691552f, 0.691482f, 0.691413f, 0.691344f, 0.691274f,
- 0.691205f, 0.691136f, 0.691067f, 0.690997f, 0.690928f, 0.690859f, 0.690789f, 0.690720f,
- 0.690651f, 0.690581f, 0.690512f, 0.690443f, 0.690373f, 0.690304f, 0.690235f, 0.690165f,
- 0.690096f, 0.690026f, 0.689957f, 0.689888f, 0.689818f, 0.689749f, 0.689679f, 0.689610f,
- 0.689541f, 0.689471f, 0.689402f, 0.689332f, 0.689263f, 0.689193f, 0.689124f, 0.689054f,
- 0.688985f, 0.688915f, 0.688846f, 0.688776f, 0.688707f, 0.688637f, 0.688568f, 0.688498f,
- 0.688429f, 0.688359f, 0.688290f, 0.688220f, 0.688151f, 0.688081f, 0.688011f, 0.687942f,
- 0.687872f, 0.687803f, 0.687733f, 0.687663f, 0.687594f, 0.687524f, 0.687455f, 0.687385f,
- 0.687315f, 0.687246f, 0.687176f, 0.687106f, 0.687037f, 0.686967f, 0.686897f, 0.686828f,
- 0.686758f, 0.686688f, 0.686619f, 0.686549f, 0.686479f, 0.686409f, 0.686340f, 0.686270f,
- 0.686200f, 0.686131f, 0.686061f, 0.685991f, 0.685921f, 0.685852f, 0.685782f, 0.685712f,
- 0.685642f, 0.685572f, 0.685503f, 0.685433f, 0.685363f, 0.685293f, 0.685223f, 0.685153f,
- 0.685084f, 0.685014f, 0.684944f, 0.684874f, 0.684804f, 0.684734f, 0.684664f, 0.684595f,
- 0.684525f, 0.684455f, 0.684385f, 0.684315f, 0.684245f, 0.684175f, 0.684105f, 0.684035f,
- 0.683965f, 0.683895f, 0.683825f, 0.683756f, 0.683686f, 0.683616f, 0.683546f, 0.683476f,
- 0.683406f, 0.683336f, 0.683266f, 0.683196f, 0.683126f, 0.683056f, 0.682986f, 0.682916f,
- 0.682846f, 0.682775f, 0.682705f, 0.682635f, 0.682565f, 0.682495f, 0.682425f, 0.682355f,
- 0.682285f, 0.682215f, 0.682145f, 0.682075f, 0.682005f, 0.681934f, 0.681864f, 0.681794f,
- 0.681724f, 0.681654f, 0.681584f, 0.681514f, 0.681443f, 0.681373f, 0.681303f, 0.681233f,
- 0.681163f, 0.681093f, 0.681022f, 0.680952f, 0.680882f, 0.680812f, 0.680741f, 0.680671f,
- 0.680601f, 0.680531f, 0.680461f, 0.680390f, 0.680320f, 0.680250f, 0.680179f, 0.680109f,
- 0.680039f, 0.679969f, 0.679898f, 0.679828f, 0.679758f, 0.679687f, 0.679617f, 0.679547f,
- 0.679476f, 0.679406f, 0.679336f, 0.679265f, 0.679195f, 0.679125f, 0.679054f, 0.678984f,
- 0.678913f, 0.678843f, 0.678773f, 0.678702f, 0.678632f, 0.678561f, 0.678491f, 0.678420f,
- 0.678350f, 0.678280f, 0.678209f, 0.678139f, 0.678068f, 0.677998f, 0.677927f, 0.677857f,
- 0.677786f, 0.677716f, 0.677645f, 0.677575f, 0.677504f, 0.677434f, 0.677363f, 0.677293f,
- 0.677222f, 0.677152f, 0.677081f, 0.677011f, 0.676940f, 0.676869f, 0.676799f, 0.676728f,
- 0.676658f, 0.676587f, 0.676516f, 0.676446f, 0.676375f, 0.676305f, 0.676234f, 0.676163f,
- 0.676093f, 0.676022f, 0.675951f, 0.675881f, 0.675810f, 0.675739f, 0.675669f, 0.675598f,
- 0.675527f, 0.675457f, 0.675386f, 0.675315f, 0.675245f, 0.675174f, 0.675103f, 0.675032f,
- 0.674962f, 0.674891f, 0.674820f, 0.674749f, 0.674679f, 0.674608f, 0.674537f, 0.674466f,
- 0.674396f, 0.674325f, 0.674254f, 0.674183f, 0.674112f, 0.674042f, 0.673971f, 0.673900f,
- 0.673829f, 0.673758f, 0.673687f, 0.673616f, 0.673546f, 0.673475f, 0.673404f, 0.673333f,
- 0.673262f, 0.673191f, 0.673120f, 0.673049f, 0.672978f, 0.672908f, 0.672837f, 0.672766f,
- 0.672695f, 0.672624f, 0.672553f, 0.672482f, 0.672411f, 0.672340f, 0.672269f, 0.672198f,
- 0.672127f, 0.672056f, 0.671985f, 0.671914f, 0.671843f, 0.671772f, 0.671701f, 0.671630f,
- 0.671559f, 0.671488f, 0.671417f, 0.671346f, 0.671275f, 0.671204f, 0.671133f, 0.671062f,
- 0.670990f, 0.670919f, 0.670848f, 0.670777f, 0.670706f, 0.670635f, 0.670564f, 0.670493f,
- 0.670422f, 0.670350f, 0.670279f, 0.670208f, 0.670137f, 0.670066f, 0.669995f, 0.669923f,
- 0.669852f, 0.669781f, 0.669710f, 0.669639f, 0.669567f, 0.669496f, 0.669425f, 0.669354f,
- 0.669283f, 0.669211f, 0.669140f, 0.669069f, 0.668998f, 0.668926f, 0.668855f, 0.668784f,
- 0.668712f, 0.668641f, 0.668570f, 0.668499f, 0.668427f, 0.668356f, 0.668285f, 0.668213f,
- 0.668142f, 0.668071f, 0.667999f, 0.667928f, 0.667857f, 0.667785f, 0.667714f, 0.667643f,
- 0.667571f, 0.667500f, 0.667428f, 0.667357f, 0.667286f, 0.667214f, 0.667143f, 0.667071f,
- 0.667000f, 0.666928f, 0.666857f, 0.666786f, 0.666714f, 0.666643f, 0.666571f, 0.666500f,
- 0.666428f, 0.666357f, 0.666285f, 0.666214f, 0.666142f, 0.666071f, 0.665999f, 0.665928f,
- 0.665856f, 0.665785f, 0.665713f, 0.665642f, 0.665570f, 0.665498f, 0.665427f, 0.665355f,
- 0.665284f, 0.665212f, 0.665141f, 0.665069f, 0.664997f, 0.664926f, 0.664854f, 0.664783f,
- 0.664711f, 0.664639f, 0.664568f, 0.664496f, 0.664424f, 0.664353f, 0.664281f, 0.664209f,
- 0.664138f, 0.664066f, 0.663994f, 0.663923f, 0.663851f, 0.663779f, 0.663708f, 0.663636f,
- 0.663564f, 0.663492f, 0.663421f, 0.663349f, 0.663277f, 0.663205f, 0.663134f, 0.663062f,
- 0.662990f, 0.662918f, 0.662847f, 0.662775f, 0.662703f, 0.662631f, 0.662559f, 0.662488f,
- 0.662416f, 0.662344f, 0.662272f, 0.662200f, 0.662128f, 0.662057f, 0.661985f, 0.661913f,
- 0.661841f, 0.661769f, 0.661697f, 0.661625f, 0.661553f, 0.661482f, 0.661410f, 0.661338f,
- 0.661266f, 0.661194f, 0.661122f, 0.661050f, 0.660978f, 0.660906f, 0.660834f, 0.660762f,
- 0.660690f, 0.660618f, 0.660546f, 0.660474f, 0.660402f, 0.660330f, 0.660258f, 0.660186f,
- 0.660114f, 0.660042f, 0.659970f, 0.659898f, 0.659826f, 0.659754f, 0.659682f, 0.659610f,
- 0.659538f, 0.659466f, 0.659394f, 0.659322f, 0.659250f, 0.659178f, 0.659105f, 0.659033f,
- 0.658961f, 0.658889f, 0.658817f, 0.658745f, 0.658673f, 0.658601f, 0.658529f, 0.658456f,
- 0.658384f, 0.658312f, 0.658240f, 0.658168f, 0.658095f, 0.658023f, 0.657951f, 0.657879f,
- 0.657807f, 0.657734f, 0.657662f, 0.657590f, 0.657518f, 0.657446f, 0.657373f, 0.657301f,
- 0.657229f, 0.657157f, 0.657084f, 0.657012f, 0.656940f, 0.656867f, 0.656795f, 0.656723f,
- 0.656651f, 0.656578f, 0.656506f, 0.656434f, 0.656361f, 0.656289f, 0.656217f, 0.656144f,
- 0.656072f, 0.656000f, 0.655927f, 0.655855f, 0.655782f, 0.655710f, 0.655638f, 0.655565f,
- 0.655493f, 0.655420f, 0.655348f, 0.655276f, 0.655203f, 0.655131f, 0.655058f, 0.654986f,
- 0.654913f, 0.654841f, 0.654769f, 0.654696f, 0.654624f, 0.654551f, 0.654479f, 0.654406f,
- 0.654334f, 0.654261f, 0.654189f, 0.654116f, 0.654044f, 0.653971f, 0.653899f, 0.653826f,
- 0.653753f, 0.653681f, 0.653608f, 0.653536f, 0.653463f, 0.653391f, 0.653318f, 0.653245f,
- 0.653173f, 0.653100f, 0.653028f, 0.652955f, 0.652882f, 0.652810f, 0.652737f, 0.652665f,
- 0.652592f, 0.652519f, 0.652447f, 0.652374f, 0.652301f, 0.652229f, 0.652156f, 0.652083f,
- 0.652011f, 0.651938f, 0.651865f, 0.651792f, 0.651720f, 0.651647f, 0.651574f, 0.651502f,
- 0.651429f, 0.651356f, 0.651283f, 0.651211f, 0.651138f, 0.651065f, 0.650992f, 0.650919f,
- 0.650847f, 0.650774f, 0.650701f, 0.650628f, 0.650555f, 0.650483f, 0.650410f, 0.650337f,
- 0.650264f, 0.650191f, 0.650119f, 0.650046f, 0.649973f, 0.649900f, 0.649827f, 0.649754f,
- 0.649681f, 0.649608f, 0.649536f, 0.649463f, 0.649390f, 0.649317f, 0.649244f, 0.649171f,
- 0.649098f, 0.649025f, 0.648952f, 0.648879f, 0.648806f, 0.648733f, 0.648660f, 0.648587f,
- 0.648514f, 0.648441f, 0.648368f, 0.648295f, 0.648222f, 0.648149f, 0.648076f, 0.648003f,
- 0.647930f, 0.647857f, 0.647784f, 0.647711f, 0.647638f, 0.647565f, 0.647492f, 0.647419f,
- 0.647346f, 0.647273f, 0.647200f, 0.647127f, 0.647054f, 0.646981f, 0.646907f, 0.646834f,
- 0.646761f, 0.646688f, 0.646615f, 0.646542f, 0.646469f, 0.646396f, 0.646322f, 0.646249f,
- 0.646176f, 0.646103f, 0.646030f, 0.645956f, 0.645883f, 0.645810f, 0.645737f, 0.645664f,
- 0.645590f, 0.645517f, 0.645444f, 0.645371f, 0.645298f, 0.645224f, 0.645151f, 0.645078f,
- 0.645005f, 0.644931f, 0.644858f, 0.644785f, 0.644711f, 0.644638f, 0.644565f, 0.644492f,
- 0.644418f, 0.644345f, 0.644272f, 0.644198f, 0.644125f, 0.644052f, 0.643978f, 0.643905f,
- 0.643832f, 0.643758f, 0.643685f, 0.643611f, 0.643538f, 0.643465f, 0.643391f, 0.643318f,
- 0.643245f, 0.643171f, 0.643098f, 0.643024f, 0.642951f, 0.642877f, 0.642804f, 0.642730f,
- 0.642657f, 0.642584f, 0.642510f, 0.642437f, 0.642363f, 0.642290f, 0.642216f, 0.642143f,
- 0.642069f, 0.641996f, 0.641922f, 0.641849f, 0.641775f, 0.641702f, 0.641628f, 0.641555f,
- 0.641481f, 0.641407f, 0.641334f, 0.641260f, 0.641187f, 0.641113f, 0.641040f, 0.640966f,
- 0.640892f, 0.640819f, 0.640745f, 0.640672f, 0.640598f, 0.640524f, 0.640451f, 0.640377f,
- 0.640303f, 0.640230f, 0.640156f, 0.640083f, 0.640009f, 0.639935f, 0.639862f, 0.639788f,
- 0.639714f, 0.639640f, 0.639567f, 0.639493f, 0.639419f, 0.639346f, 0.639272f, 0.639198f,
- 0.639124f, 0.639051f, 0.638977f, 0.638903f, 0.638829f, 0.638756f, 0.638682f, 0.638608f,
- 0.638534f, 0.638461f, 0.638387f, 0.638313f, 0.638239f, 0.638165f, 0.638092f, 0.638018f,
- 0.637944f, 0.637870f, 0.637796f, 0.637722f, 0.637649f, 0.637575f, 0.637501f, 0.637427f,
- 0.637353f, 0.637279f, 0.637205f, 0.637131f, 0.637057f, 0.636984f, 0.636910f, 0.636836f,
- 0.636762f, 0.636688f, 0.636614f, 0.636540f, 0.636466f, 0.636392f, 0.636318f, 0.636244f,
- 0.636170f, 0.636096f, 0.636022f, 0.635948f, 0.635874f, 0.635800f, 0.635726f, 0.635652f,
- 0.635578f, 0.635504f, 0.635430f, 0.635356f, 0.635282f, 0.635208f, 0.635134f, 0.635060f,
- 0.634986f, 0.634912f, 0.634838f, 0.634764f, 0.634690f, 0.634616f, 0.634542f, 0.634467f,
- 0.634393f, 0.634319f, 0.634245f, 0.634171f, 0.634097f, 0.634023f, 0.633949f, 0.633874f,
- 0.633800f, 0.633726f, 0.633652f, 0.633578f, 0.633504f, 0.633429f, 0.633355f, 0.633281f,
- 0.633207f, 0.633133f, 0.633058f, 0.632984f, 0.632910f, 0.632836f, 0.632761f, 0.632687f,
- 0.632613f, 0.632539f, 0.632464f, 0.632390f, 0.632316f, 0.632242f, 0.632167f, 0.632093f,
- 0.632019f, 0.631944f, 0.631870f, 0.631796f, 0.631721f, 0.631647f, 0.631573f, 0.631499f,
- 0.631424f, 0.631350f, 0.631275f, 0.631201f, 0.631127f, 0.631052f, 0.630978f, 0.630904f,
- 0.630829f, 0.630755f, 0.630680f, 0.630606f, 0.630532f, 0.630457f, 0.630383f, 0.630308f,
- 0.630234f, 0.630159f, 0.630085f, 0.630011f, 0.629936f, 0.629862f, 0.629787f, 0.629713f,
- 0.629638f, 0.629564f, 0.629489f, 0.629415f, 0.629340f, 0.629266f, 0.629191f, 0.629117f,
- 0.629042f, 0.628968f, 0.628893f, 0.628819f, 0.628744f, 0.628669f, 0.628595f, 0.628520f,
- 0.628446f, 0.628371f, 0.628297f, 0.628222f, 0.628147f, 0.628073f, 0.627998f, 0.627924f,
- 0.627849f, 0.627774f, 0.627700f, 0.627625f, 0.627550f, 0.627476f, 0.627401f, 0.627326f,
- 0.627252f, 0.627177f, 0.627102f, 0.627028f, 0.626953f, 0.626878f, 0.626804f, 0.626729f,
- 0.626654f, 0.626580f, 0.626505f, 0.626430f, 0.626355f, 0.626281f, 0.626206f, 0.626131f,
- 0.626056f, 0.625982f, 0.625907f, 0.625832f, 0.625757f, 0.625683f, 0.625608f, 0.625533f,
- 0.625458f, 0.625383f, 0.625309f, 0.625234f, 0.625159f, 0.625084f, 0.625009f, 0.624934f,
- 0.624860f, 0.624785f, 0.624710f, 0.624635f, 0.624560f, 0.624485f, 0.624410f, 0.624335f,
- 0.624260f, 0.624186f, 0.624111f, 0.624036f, 0.623961f, 0.623886f, 0.623811f, 0.623736f,
- 0.623661f, 0.623586f, 0.623511f, 0.623436f, 0.623361f, 0.623286f, 0.623211f, 0.623136f,
- 0.623061f, 0.622986f, 0.622911f, 0.622836f, 0.622761f, 0.622686f, 0.622611f, 0.622536f,
- 0.622461f, 0.622386f, 0.622311f, 0.622236f, 0.622161f, 0.622086f, 0.622011f, 0.621936f,
- 0.621861f, 0.621786f, 0.621711f, 0.621636f, 0.621560f, 0.621485f, 0.621410f, 0.621335f,
- 0.621260f, 0.621185f, 0.621110f, 0.621035f, 0.620959f, 0.620884f, 0.620809f, 0.620734f,
- 0.620659f, 0.620584f, 0.620508f, 0.620433f, 0.620358f, 0.620283f, 0.620208f, 0.620132f,
- 0.620057f, 0.619982f, 0.619907f, 0.619832f, 0.619756f, 0.619681f, 0.619606f, 0.619531f,
- 0.619455f, 0.619380f, 0.619305f, 0.619229f, 0.619154f, 0.619079f, 0.619004f, 0.618928f,
- 0.618853f, 0.618778f, 0.618702f, 0.618627f, 0.618552f, 0.618476f, 0.618401f, 0.618326f,
- 0.618250f, 0.618175f, 0.618100f, 0.618024f, 0.617949f, 0.617873f, 0.617798f, 0.617723f,
- 0.617647f, 0.617572f, 0.617496f, 0.617421f, 0.617346f, 0.617270f, 0.617195f, 0.617119f,
- 0.617044f, 0.616968f, 0.616893f, 0.616818f, 0.616742f, 0.616667f, 0.616591f, 0.616516f,
- 0.616440f, 0.616365f, 0.616289f, 0.616214f, 0.616138f, 0.616063f, 0.615987f, 0.615912f,
- 0.615836f, 0.615761f, 0.615685f, 0.615609f, 0.615534f, 0.615458f, 0.615383f, 0.615307f,
- 0.615232f, 0.615156f, 0.615080f, 0.615005f, 0.614929f, 0.614854f, 0.614778f, 0.614702f,
- 0.614627f, 0.614551f, 0.614475f, 0.614400f, 0.614324f, 0.614249f, 0.614173f, 0.614097f,
- 0.614022f, 0.613946f, 0.613870f, 0.613795f, 0.613719f, 0.613643f, 0.613567f, 0.613492f,
- 0.613416f, 0.613340f, 0.613265f, 0.613189f, 0.613113f, 0.613037f, 0.612962f, 0.612886f,
- 0.612810f, 0.612734f, 0.612659f, 0.612583f, 0.612507f, 0.612431f, 0.612355f, 0.612280f,
- 0.612204f, 0.612128f, 0.612052f, 0.611976f, 0.611901f, 0.611825f, 0.611749f, 0.611673f,
- 0.611597f, 0.611521f, 0.611445f, 0.611370f, 0.611294f, 0.611218f, 0.611142f, 0.611066f,
- 0.610990f, 0.610914f, 0.610838f, 0.610762f, 0.610687f, 0.610611f, 0.610535f, 0.610459f,
- 0.610383f, 0.610307f, 0.610231f, 0.610155f, 0.610079f, 0.610003f, 0.609927f, 0.609851f,
- 0.609775f, 0.609699f, 0.609623f, 0.609547f, 0.609471f, 0.609395f, 0.609319f, 0.609243f,
- 0.609167f, 0.609091f, 0.609015f, 0.608939f, 0.608863f, 0.608787f, 0.608711f, 0.608635f,
- 0.608559f, 0.608482f, 0.608406f, 0.608330f, 0.608254f, 0.608178f, 0.608102f, 0.608026f,
- 0.607950f, 0.607874f, 0.607798f, 0.607721f, 0.607645f, 0.607569f, 0.607493f, 0.607417f,
- 0.607341f, 0.607264f, 0.607188f, 0.607112f, 0.607036f, 0.606960f, 0.606884f, 0.606807f,
- 0.606731f, 0.606655f, 0.606579f, 0.606502f, 0.606426f, 0.606350f, 0.606274f, 0.606198f,
- 0.606121f, 0.606045f, 0.605969f, 0.605892f, 0.605816f, 0.605740f, 0.605664f, 0.605587f,
- 0.605511f, 0.605435f, 0.605358f, 0.605282f, 0.605206f, 0.605129f, 0.605053f, 0.604977f,
- 0.604900f, 0.604824f, 0.604748f, 0.604671f, 0.604595f, 0.604519f, 0.604442f, 0.604366f,
- 0.604290f, 0.604213f, 0.604137f, 0.604060f, 0.603984f, 0.603908f, 0.603831f, 0.603755f,
- 0.603678f, 0.603602f, 0.603525f, 0.603449f, 0.603372f, 0.603296f, 0.603220f, 0.603143f,
- 0.603067f, 0.602990f, 0.602914f, 0.602837f, 0.602761f, 0.602684f, 0.602608f, 0.602531f,
- 0.602455f, 0.602378f, 0.602302f, 0.602225f, 0.602148f, 0.602072f, 0.601995f, 0.601919f,
- 0.601842f, 0.601766f, 0.601689f, 0.601613f, 0.601536f, 0.601459f, 0.601383f, 0.601306f,
- 0.601230f, 0.601153f, 0.601076f, 0.601000f, 0.600923f, 0.600846f, 0.600770f, 0.600693f,
- 0.600616f, 0.600540f, 0.600463f, 0.600387f, 0.600310f, 0.600233f, 0.600156f, 0.600080f,
- 0.600003f, 0.599926f, 0.599850f, 0.599773f, 0.599696f, 0.599620f, 0.599543f, 0.599466f,
- 0.599389f, 0.599313f, 0.599236f, 0.599159f, 0.599082f, 0.599006f, 0.598929f, 0.598852f,
- 0.598775f, 0.598698f, 0.598622f, 0.598545f, 0.598468f, 0.598391f, 0.598314f, 0.598238f,
- 0.598161f, 0.598084f, 0.598007f, 0.597930f, 0.597853f, 0.597776f, 0.597700f, 0.597623f,
- 0.597546f, 0.597469f, 0.597392f, 0.597315f, 0.597238f, 0.597161f, 0.597085f, 0.597008f,
- 0.596931f, 0.596854f, 0.596777f, 0.596700f, 0.596623f, 0.596546f, 0.596469f, 0.596392f,
- 0.596315f, 0.596238f, 0.596161f, 0.596084f, 0.596007f, 0.595930f, 0.595853f, 0.595776f,
- 0.595699f, 0.595622f, 0.595545f, 0.595468f, 0.595391f, 0.595314f, 0.595237f, 0.595160f,
- 0.595083f, 0.595006f, 0.594929f, 0.594852f, 0.594775f, 0.594698f, 0.594621f, 0.594544f,
- 0.594467f, 0.594389f, 0.594312f, 0.594235f, 0.594158f, 0.594081f, 0.594004f, 0.593927f,
- 0.593850f, 0.593772f, 0.593695f, 0.593618f, 0.593541f, 0.593464f, 0.593387f, 0.593309f,
- 0.593232f, 0.593155f, 0.593078f, 0.593001f, 0.592924f, 0.592846f, 0.592769f, 0.592692f,
- 0.592615f, 0.592537f, 0.592460f, 0.592383f, 0.592306f, 0.592228f, 0.592151f, 0.592074f,
- 0.591997f, 0.591919f, 0.591842f, 0.591765f, 0.591688f, 0.591610f, 0.591533f, 0.591456f,
- 0.591378f, 0.591301f, 0.591224f, 0.591146f, 0.591069f, 0.590992f, 0.590914f, 0.590837f,
- 0.590760f, 0.590682f, 0.590605f, 0.590528f, 0.590450f, 0.590373f, 0.590295f, 0.590218f,
- 0.590141f, 0.590063f, 0.589986f, 0.589908f, 0.589831f, 0.589754f, 0.589676f, 0.589599f,
- 0.589521f, 0.589444f, 0.589366f, 0.589289f, 0.589212f, 0.589134f, 0.589057f, 0.588979f,
- 0.588902f, 0.588824f, 0.588747f, 0.588669f, 0.588592f, 0.588514f, 0.588437f, 0.588359f,
- 0.588282f, 0.588204f, 0.588126f, 0.588049f, 0.587971f, 0.587894f, 0.587816f, 0.587739f,
- 0.587661f, 0.587584f, 0.587506f, 0.587428f, 0.587351f, 0.587273f, 0.587196f, 0.587118f,
- 0.587040f, 0.586963f, 0.586885f, 0.586808f, 0.586730f, 0.586652f, 0.586575f, 0.586497f,
- 0.586419f, 0.586342f, 0.586264f, 0.586186f, 0.586109f, 0.586031f, 0.585953f, 0.585876f,
- 0.585798f, 0.585720f, 0.585642f, 0.585565f, 0.585487f, 0.585409f, 0.585332f, 0.585254f,
- 0.585176f, 0.585098f, 0.585021f, 0.584943f, 0.584865f, 0.584787f, 0.584710f, 0.584632f,
- 0.584554f, 0.584476f, 0.584398f, 0.584321f, 0.584243f, 0.584165f, 0.584087f, 0.584009f,
- 0.583931f, 0.583854f, 0.583776f, 0.583698f, 0.583620f, 0.583542f, 0.583464f, 0.583387f,
- 0.583309f, 0.583231f, 0.583153f, 0.583075f, 0.582997f, 0.582919f, 0.582841f, 0.582763f,
- 0.582685f, 0.582608f, 0.582530f, 0.582452f, 0.582374f, 0.582296f, 0.582218f, 0.582140f,
- 0.582062f, 0.581984f, 0.581906f, 0.581828f, 0.581750f, 0.581672f, 0.581594f, 0.581516f,
- 0.581438f, 0.581360f, 0.581282f, 0.581204f, 0.581126f, 0.581048f, 0.580970f, 0.580892f,
- 0.580814f, 0.580736f, 0.580658f, 0.580580f, 0.580502f, 0.580424f, 0.580346f, 0.580267f,
- 0.580189f, 0.580111f, 0.580033f, 0.579955f, 0.579877f, 0.579799f, 0.579721f, 0.579643f,
- 0.579565f, 0.579486f, 0.579408f, 0.579330f, 0.579252f, 0.579174f, 0.579096f, 0.579018f,
- 0.578939f, 0.578861f, 0.578783f, 0.578705f, 0.578627f, 0.578548f, 0.578470f, 0.578392f,
- 0.578314f, 0.578236f, 0.578157f, 0.578079f, 0.578001f, 0.577923f, 0.577844f, 0.577766f,
- 0.577688f, 0.577610f, 0.577531f, 0.577453f, 0.577375f, 0.577297f, 0.577218f, 0.577140f,
- 0.577062f, 0.576983f, 0.576905f, 0.576827f, 0.576748f, 0.576670f, 0.576592f, 0.576513f,
- 0.576435f, 0.576357f, 0.576278f, 0.576200f, 0.576122f, 0.576043f, 0.575965f, 0.575887f,
- 0.575808f, 0.575730f, 0.575651f, 0.575573f, 0.575495f, 0.575416f, 0.575338f, 0.575259f,
- 0.575181f, 0.575103f, 0.575024f, 0.574946f, 0.574867f, 0.574789f, 0.574710f, 0.574632f,
- 0.574553f, 0.574475f, 0.574396f, 0.574318f, 0.574239f, 0.574161f, 0.574082f, 0.574004f,
- 0.573925f, 0.573847f, 0.573768f, 0.573690f, 0.573611f, 0.573533f, 0.573454f, 0.573376f,
- 0.573297f, 0.573219f, 0.573140f, 0.573061f, 0.572983f, 0.572904f, 0.572826f, 0.572747f,
- 0.572669f, 0.572590f, 0.572511f, 0.572433f, 0.572354f, 0.572276f, 0.572197f, 0.572118f,
- 0.572040f, 0.571961f, 0.571882f, 0.571804f, 0.571725f, 0.571646f, 0.571568f, 0.571489f,
- 0.571410f, 0.571332f, 0.571253f, 0.571174f, 0.571096f, 0.571017f, 0.570938f, 0.570859f,
- 0.570781f, 0.570702f, 0.570623f, 0.570545f, 0.570466f, 0.570387f, 0.570308f, 0.570230f,
- 0.570151f, 0.570072f, 0.569993f, 0.569914f, 0.569836f, 0.569757f, 0.569678f, 0.569599f,
- 0.569521f, 0.569442f, 0.569363f, 0.569284f, 0.569205f, 0.569126f, 0.569048f, 0.568969f,
- 0.568890f, 0.568811f, 0.568732f, 0.568653f, 0.568574f, 0.568496f, 0.568417f, 0.568338f,
- 0.568259f, 0.568180f, 0.568101f, 0.568022f, 0.567943f, 0.567864f, 0.567786f, 0.567707f,
- 0.567628f, 0.567549f, 0.567470f, 0.567391f, 0.567312f, 0.567233f, 0.567154f, 0.567075f,
- 0.566996f, 0.566917f, 0.566838f, 0.566759f, 0.566680f, 0.566601f, 0.566522f, 0.566443f,
- 0.566364f, 0.566285f, 0.566206f, 0.566127f, 0.566048f, 0.565969f, 0.565890f, 0.565811f,
- 0.565732f, 0.565653f, 0.565574f, 0.565495f, 0.565416f, 0.565336f, 0.565257f, 0.565178f,
- 0.565099f, 0.565020f, 0.564941f, 0.564862f, 0.564783f, 0.564704f, 0.564624f, 0.564545f,
- 0.564466f, 0.564387f, 0.564308f, 0.564229f, 0.564150f, 0.564070f, 0.563991f, 0.563912f,
- 0.563833f, 0.563754f, 0.563675f, 0.563595f, 0.563516f, 0.563437f, 0.563358f, 0.563279f,
- 0.563199f, 0.563120f, 0.563041f, 0.562962f, 0.562882f, 0.562803f, 0.562724f, 0.562645f,
- 0.562565f, 0.562486f, 0.562407f, 0.562328f, 0.562248f, 0.562169f, 0.562090f, 0.562010f,
- 0.561931f, 0.561852f, 0.561773f, 0.561693f, 0.561614f, 0.561535f, 0.561455f, 0.561376f,
- 0.561297f, 0.561217f, 0.561138f, 0.561058f, 0.560979f, 0.560900f, 0.560820f, 0.560741f,
- 0.560662f, 0.560582f, 0.560503f, 0.560423f, 0.560344f, 0.560265f, 0.560185f, 0.560106f,
- 0.560026f, 0.559947f, 0.559867f, 0.559788f, 0.559709f, 0.559629f, 0.559550f, 0.559470f,
- 0.559391f, 0.559311f, 0.559232f, 0.559152f, 0.559073f, 0.558993f, 0.558914f, 0.558834f,
- 0.558755f, 0.558675f, 0.558596f, 0.558516f, 0.558437f, 0.558357f, 0.558278f, 0.558198f,
- 0.558119f, 0.558039f, 0.557959f, 0.557880f, 0.557800f, 0.557721f, 0.557641f, 0.557562f,
- 0.557482f, 0.557402f, 0.557323f, 0.557243f, 0.557164f, 0.557084f, 0.557004f, 0.556925f,
- 0.556845f, 0.556765f, 0.556686f, 0.556606f, 0.556526f, 0.556447f, 0.556367f, 0.556287f,
- 0.556208f, 0.556128f, 0.556048f, 0.555969f, 0.555889f, 0.555809f, 0.555730f, 0.555650f,
- 0.555570f, 0.555490f, 0.555411f, 0.555331f, 0.555251f, 0.555172f, 0.555092f, 0.555012f,
- 0.554932f, 0.554853f, 0.554773f, 0.554693f, 0.554613f, 0.554533f, 0.554454f, 0.554374f,
- 0.554294f, 0.554214f, 0.554134f, 0.554055f, 0.553975f, 0.553895f, 0.553815f, 0.553735f,
- 0.553656f, 0.553576f, 0.553496f, 0.553416f, 0.553336f, 0.553256f, 0.553176f, 0.553097f,
- 0.553017f, 0.552937f, 0.552857f, 0.552777f, 0.552697f, 0.552617f, 0.552537f, 0.552457f,
- 0.552378f, 0.552298f, 0.552218f, 0.552138f, 0.552058f, 0.551978f, 0.551898f, 0.551818f,
- 0.551738f, 0.551658f, 0.551578f, 0.551498f, 0.551418f, 0.551338f, 0.551258f, 0.551178f,
- 0.551098f, 0.551018f, 0.550938f, 0.550858f, 0.550778f, 0.550698f, 0.550618f, 0.550538f,
- 0.550458f, 0.550378f, 0.550298f, 0.550218f, 0.550138f, 0.550058f, 0.549978f, 0.549898f,
- 0.549818f, 0.549737f, 0.549657f, 0.549577f, 0.549497f, 0.549417f, 0.549337f, 0.549257f,
- 0.549177f, 0.549097f, 0.549016f, 0.548936f, 0.548856f, 0.548776f, 0.548696f, 0.548616f,
- 0.548536f, 0.548455f, 0.548375f, 0.548295f, 0.548215f, 0.548135f, 0.548054f, 0.547974f,
- 0.547894f, 0.547814f, 0.547734f, 0.547653f, 0.547573f, 0.547493f, 0.547413f, 0.547333f,
- 0.547252f, 0.547172f, 0.547092f, 0.547011f, 0.546931f, 0.546851f, 0.546771f, 0.546690f,
- 0.546610f, 0.546530f, 0.546450f, 0.546369f, 0.546289f, 0.546209f, 0.546128f, 0.546048f,
- 0.545968f, 0.545887f, 0.545807f, 0.545727f, 0.545646f, 0.545566f, 0.545486f, 0.545405f,
- 0.545325f, 0.545245f, 0.545164f, 0.545084f, 0.545003f, 0.544923f, 0.544843f, 0.544762f,
- 0.544682f, 0.544602f, 0.544521f, 0.544441f, 0.544360f, 0.544280f, 0.544199f, 0.544119f,
- 0.544039f, 0.543958f, 0.543878f, 0.543797f, 0.543717f, 0.543636f, 0.543556f, 0.543475f,
- 0.543395f, 0.543314f, 0.543234f, 0.543153f, 0.543073f, 0.542992f, 0.542912f, 0.542831f,
- 0.542751f, 0.542670f, 0.542590f, 0.542509f, 0.542429f, 0.542348f, 0.542268f, 0.542187f,
- 0.542106f, 0.542026f, 0.541945f, 0.541865f, 0.541784f, 0.541704f, 0.541623f, 0.541542f,
- 0.541462f, 0.541381f, 0.541301f, 0.541220f, 0.541139f, 0.541059f, 0.540978f, 0.540897f,
- 0.540817f, 0.540736f, 0.540655f, 0.540575f, 0.540494f, 0.540413f, 0.540333f, 0.540252f,
- 0.540171f, 0.540091f, 0.540010f, 0.539929f, 0.539849f, 0.539768f, 0.539687f, 0.539607f,
- 0.539526f, 0.539445f, 0.539364f, 0.539284f, 0.539203f, 0.539122f, 0.539041f, 0.538961f,
- 0.538880f, 0.538799f, 0.538718f, 0.538638f, 0.538557f, 0.538476f, 0.538395f, 0.538314f,
- 0.538234f, 0.538153f, 0.538072f, 0.537991f, 0.537910f, 0.537830f, 0.537749f, 0.537668f,
- 0.537587f, 0.537506f, 0.537425f, 0.537345f, 0.537264f, 0.537183f, 0.537102f, 0.537021f,
- 0.536940f, 0.536859f, 0.536778f, 0.536698f, 0.536617f, 0.536536f, 0.536455f, 0.536374f,
- 0.536293f, 0.536212f, 0.536131f, 0.536050f, 0.535969f, 0.535888f, 0.535807f, 0.535726f,
- 0.535645f, 0.535564f, 0.535484f, 0.535403f, 0.535322f, 0.535241f, 0.535160f, 0.535079f,
- 0.534998f, 0.534917f, 0.534836f, 0.534755f, 0.534674f, 0.534593f, 0.534512f, 0.534431f,
- 0.534349f, 0.534268f, 0.534187f, 0.534106f, 0.534025f, 0.533944f, 0.533863f, 0.533782f,
- 0.533701f, 0.533620f, 0.533539f, 0.533458f, 0.533377f, 0.533296f, 0.533214f, 0.533133f,
- 0.533052f, 0.532971f, 0.532890f, 0.532809f, 0.532728f, 0.532647f, 0.532565f, 0.532484f,
- 0.532403f, 0.532322f, 0.532241f, 0.532160f, 0.532078f, 0.531997f, 0.531916f, 0.531835f,
- 0.531754f, 0.531673f, 0.531591f, 0.531510f, 0.531429f, 0.531348f, 0.531266f, 0.531185f,
- 0.531104f, 0.531023f, 0.530942f, 0.530860f, 0.530779f, 0.530698f, 0.530617f, 0.530535f,
- 0.530454f, 0.530373f, 0.530291f, 0.530210f, 0.530129f, 0.530048f, 0.529966f, 0.529885f,
- 0.529804f, 0.529722f, 0.529641f, 0.529560f, 0.529478f, 0.529397f, 0.529316f, 0.529234f,
- 0.529153f, 0.529072f, 0.528990f, 0.528909f, 0.528828f, 0.528746f, 0.528665f, 0.528583f,
- 0.528502f, 0.528421f, 0.528339f, 0.528258f, 0.528176f, 0.528095f, 0.528014f, 0.527932f,
- 0.527851f, 0.527769f, 0.527688f, 0.527606f, 0.527525f, 0.527444f, 0.527362f, 0.527281f,
- 0.527199f, 0.527118f, 0.527036f, 0.526955f, 0.526873f, 0.526792f, 0.526710f, 0.526629f,
- 0.526547f, 0.526466f, 0.526384f, 0.526303f, 0.526221f, 0.526140f, 0.526058f, 0.525977f,
- 0.525895f, 0.525813f, 0.525732f, 0.525650f, 0.525569f, 0.525487f, 0.525406f, 0.525324f,
- 0.525243f, 0.525161f, 0.525079f, 0.524998f, 0.524916f, 0.524835f, 0.524753f, 0.524671f,
- 0.524590f, 0.524508f, 0.524426f, 0.524345f, 0.524263f, 0.524181f, 0.524100f, 0.524018f,
- 0.523937f, 0.523855f, 0.523773f, 0.523692f, 0.523610f, 0.523528f, 0.523447f, 0.523365f,
- 0.523283f, 0.523201f, 0.523120f, 0.523038f, 0.522956f, 0.522875f, 0.522793f, 0.522711f,
- 0.522629f, 0.522548f, 0.522466f, 0.522384f, 0.522302f, 0.522221f, 0.522139f, 0.522057f,
- 0.521975f, 0.521894f, 0.521812f, 0.521730f, 0.521648f, 0.521566f, 0.521485f, 0.521403f,
- 0.521321f, 0.521239f, 0.521157f, 0.521075f, 0.520994f, 0.520912f, 0.520830f, 0.520748f,
- 0.520666f, 0.520584f, 0.520503f, 0.520421f, 0.520339f, 0.520257f, 0.520175f, 0.520093f,
- 0.520011f, 0.519929f, 0.519848f, 0.519766f, 0.519684f, 0.519602f, 0.519520f, 0.519438f,
- 0.519356f, 0.519274f, 0.519192f, 0.519110f, 0.519028f, 0.518946f, 0.518864f, 0.518782f,
- 0.518700f, 0.518618f, 0.518536f, 0.518454f, 0.518372f, 0.518291f, 0.518209f, 0.518126f,
- 0.518045f, 0.517963f, 0.517880f, 0.517798f, 0.517716f, 0.517634f, 0.517552f, 0.517470f,
- 0.517388f, 0.517306f, 0.517224f, 0.517142f, 0.517060f, 0.516978f, 0.516896f, 0.516814f,
- 0.516732f, 0.516650f, 0.516568f, 0.516486f, 0.516403f, 0.516321f, 0.516239f, 0.516157f,
- 0.516075f, 0.515993f, 0.515911f, 0.515829f, 0.515746f, 0.515664f, 0.515582f, 0.515500f,
- 0.515418f, 0.515336f, 0.515254f, 0.515171f, 0.515089f, 0.515007f, 0.514925f, 0.514843f,
- 0.514760f, 0.514678f, 0.514596f, 0.514514f, 0.514432f, 0.514349f, 0.514267f, 0.514185f,
- 0.514103f, 0.514021f, 0.513938f, 0.513856f, 0.513774f, 0.513692f, 0.513609f, 0.513527f,
- 0.513445f, 0.513362f, 0.513280f, 0.513198f, 0.513116f, 0.513033f, 0.512951f, 0.512869f,
- 0.512786f, 0.512704f, 0.512622f, 0.512539f, 0.512457f, 0.512375f, 0.512292f, 0.512210f,
- 0.512128f, 0.512045f, 0.511963f, 0.511881f, 0.511798f, 0.511716f, 0.511634f, 0.511551f,
- 0.511469f, 0.511386f, 0.511304f, 0.511222f, 0.511139f, 0.511057f, 0.510974f, 0.510892f,
- 0.510810f, 0.510727f, 0.510645f, 0.510562f, 0.510480f, 0.510397f, 0.510315f, 0.510233f,
- 0.510150f, 0.510068f, 0.509985f, 0.509903f, 0.509820f, 0.509738f, 0.509655f, 0.509573f,
- 0.509490f, 0.509408f, 0.509325f, 0.509243f, 0.509160f, 0.509078f, 0.508995f, 0.508913f,
- 0.508830f, 0.508748f, 0.508665f, 0.508583f, 0.508500f, 0.508417f, 0.508335f, 0.508252f,
- 0.508170f, 0.508087f, 0.508005f, 0.507922f, 0.507839f, 0.507757f, 0.507674f, 0.507592f,
- 0.507509f, 0.507426f, 0.507344f, 0.507261f, 0.507179f, 0.507096f, 0.507013f, 0.506931f,
- 0.506848f, 0.506765f, 0.506683f, 0.506600f, 0.506517f, 0.506435f, 0.506352f, 0.506269f,
- 0.506187f, 0.506104f, 0.506021f, 0.505939f, 0.505856f, 0.505773f, 0.505690f, 0.505608f,
- 0.505525f, 0.505442f, 0.505360f, 0.505277f, 0.505194f, 0.505111f, 0.505029f, 0.504946f,
- 0.504863f, 0.504780f, 0.504698f, 0.504615f, 0.504532f, 0.504449f, 0.504366f, 0.504284f,
- 0.504201f, 0.504118f, 0.504035f, 0.503953f, 0.503870f, 0.503787f, 0.503704f, 0.503621f,
- 0.503538f, 0.503456f, 0.503373f, 0.503290f, 0.503207f, 0.503124f, 0.503041f, 0.502958f,
- 0.502876f, 0.502793f, 0.502710f, 0.502627f, 0.502544f, 0.502461f, 0.502378f, 0.502295f,
- 0.502212f, 0.502130f, 0.502047f, 0.501964f, 0.501881f, 0.501798f, 0.501715f, 0.501632f,
- 0.501549f, 0.501466f, 0.501383f, 0.501300f, 0.501217f, 0.501134f, 0.501051f, 0.500968f,
- 0.500885f, 0.500802f, 0.500719f, 0.500636f, 0.500553f, 0.500470f, 0.500387f, 0.500304f,
- 0.500221f, 0.500138f, 0.500055f, 0.499972f, 0.499889f, 0.499806f, 0.499723f, 0.499640f,
- 0.499557f, 0.499474f, 0.499391f, 0.499308f, 0.499225f, 0.499142f, 0.499059f, 0.498976f,
- 0.498893f, 0.498809f, 0.498726f, 0.498643f, 0.498560f, 0.498477f, 0.498394f, 0.498311f,
- 0.498228f, 0.498145f, 0.498061f, 0.497978f, 0.497895f, 0.497812f, 0.497729f, 0.497646f,
- 0.497562f, 0.497479f, 0.497396f, 0.497313f, 0.497230f, 0.497147f, 0.497063f, 0.496980f,
- 0.496897f, 0.496814f, 0.496731f, 0.496647f, 0.496564f, 0.496481f, 0.496398f, 0.496315f,
- 0.496231f, 0.496148f, 0.496065f, 0.495982f, 0.495898f, 0.495815f, 0.495732f, 0.495649f,
- 0.495565f, 0.495482f, 0.495399f, 0.495315f, 0.495232f, 0.495149f, 0.495066f, 0.494982f,
- 0.494899f, 0.494816f, 0.494732f, 0.494649f, 0.494566f, 0.494482f, 0.494399f, 0.494316f,
- 0.494232f, 0.494149f, 0.494066f, 0.493982f, 0.493899f, 0.493816f, 0.493732f, 0.493649f,
- 0.493565f, 0.493482f, 0.493399f, 0.493315f, 0.493232f, 0.493148f, 0.493065f, 0.492982f,
- 0.492898f, 0.492815f, 0.492731f, 0.492648f, 0.492564f, 0.492481f, 0.492398f, 0.492314f,
- 0.492231f, 0.492147f, 0.492064f, 0.491980f, 0.491897f, 0.491813f, 0.491730f, 0.491646f,
- 0.491563f, 0.491479f, 0.491396f, 0.491312f, 0.491229f, 0.491145f, 0.491062f, 0.490978f,
- 0.490895f, 0.490811f, 0.490728f, 0.490644f, 0.490561f, 0.490477f, 0.490394f, 0.490310f,
- 0.490226f, 0.490143f, 0.490059f, 0.489976f, 0.489892f, 0.489809f, 0.489725f, 0.489641f,
- 0.489558f, 0.489474f, 0.489391f, 0.489307f, 0.489223f, 0.489140f, 0.489056f, 0.488973f,
- 0.488889f, 0.488805f, 0.488722f, 0.488638f, 0.488554f, 0.488471f, 0.488387f, 0.488303f,
- 0.488220f, 0.488136f, 0.488052f, 0.487969f, 0.487885f, 0.487801f, 0.487718f, 0.487634f,
- 0.487550f, 0.487466f, 0.487383f, 0.487299f, 0.487215f, 0.487132f, 0.487048f, 0.486964f,
- 0.486880f, 0.486797f, 0.486713f, 0.486629f, 0.486545f, 0.486462f, 0.486378f, 0.486294f,
- 0.486210f, 0.486126f, 0.486043f, 0.485959f, 0.485875f, 0.485791f, 0.485708f, 0.485624f,
- 0.485540f, 0.485456f, 0.485372f, 0.485288f, 0.485205f, 0.485121f, 0.485037f, 0.484953f,
- 0.484869f, 0.484785f, 0.484702f, 0.484618f, 0.484534f, 0.484450f, 0.484366f, 0.484282f,
- 0.484198f, 0.484114f, 0.484031f, 0.483947f, 0.483863f, 0.483779f, 0.483695f, 0.483611f,
- 0.483527f, 0.483443f, 0.483359f, 0.483275f, 0.483191f, 0.483107f, 0.483023f, 0.482940f,
- 0.482856f, 0.482772f, 0.482688f, 0.482604f, 0.482520f, 0.482436f, 0.482352f, 0.482268f,
- 0.482184f, 0.482100f, 0.482016f, 0.481932f, 0.481848f, 0.481764f, 0.481680f, 0.481596f,
- 0.481512f, 0.481428f, 0.481344f, 0.481260f, 0.481176f, 0.481091f, 0.481007f, 0.480923f,
- 0.480839f, 0.480755f, 0.480671f, 0.480587f, 0.480503f, 0.480419f, 0.480335f, 0.480251f,
- 0.480167f, 0.480083f, 0.479998f, 0.479914f, 0.479830f, 0.479746f, 0.479662f, 0.479578f,
- 0.479494f, 0.479410f, 0.479325f, 0.479241f, 0.479157f, 0.479073f, 0.478989f, 0.478905f,
- 0.478821f, 0.478736f, 0.478652f, 0.478568f, 0.478484f, 0.478400f, 0.478315f, 0.478231f,
- 0.478147f, 0.478063f, 0.477979f, 0.477894f, 0.477810f, 0.477726f, 0.477642f, 0.477558f,
- 0.477473f, 0.477389f, 0.477305f, 0.477221f, 0.477136f, 0.477052f, 0.476968f, 0.476884f,
- 0.476799f, 0.476715f, 0.476631f, 0.476546f, 0.476462f, 0.476378f, 0.476294f, 0.476209f,
- 0.476125f, 0.476041f, 0.475956f, 0.475872f, 0.475788f, 0.475703f, 0.475619f, 0.475535f,
- 0.475450f, 0.475366f, 0.475282f, 0.475197f, 0.475113f, 0.475029f, 0.474944f, 0.474860f,
- 0.474775f, 0.474691f, 0.474607f, 0.474522f, 0.474438f, 0.474353f, 0.474269f, 0.474185f,
- 0.474100f, 0.474016f, 0.473931f, 0.473847f, 0.473763f, 0.473678f, 0.473594f, 0.473509f,
- 0.473425f, 0.473340f, 0.473256f, 0.473171f, 0.473087f, 0.473002f, 0.472918f, 0.472834f,
- 0.472749f, 0.472665f, 0.472580f, 0.472496f, 0.472411f, 0.472327f, 0.472242f, 0.472158f,
- 0.472073f, 0.471988f, 0.471904f, 0.471819f, 0.471735f, 0.471650f, 0.471566f, 0.471481f,
- 0.471397f, 0.471312f, 0.471228f, 0.471143f, 0.471058f, 0.470974f, 0.470889f, 0.470805f,
- 0.470720f, 0.470636f, 0.470551f, 0.470466f, 0.470382f, 0.470297f, 0.470213f, 0.470128f,
- 0.470043f, 0.469959f, 0.469874f, 0.469789f, 0.469705f, 0.469620f, 0.469536f, 0.469451f,
- 0.469366f, 0.469282f, 0.469197f, 0.469112f, 0.469028f, 0.468943f, 0.468858f, 0.468774f,
- 0.468689f, 0.468604f, 0.468519f, 0.468435f, 0.468350f, 0.468265f, 0.468181f, 0.468096f,
- 0.468011f, 0.467926f, 0.467842f, 0.467757f, 0.467672f, 0.467587f, 0.467503f, 0.467418f,
- 0.467333f, 0.467248f, 0.467164f, 0.467079f, 0.466994f, 0.466909f, 0.466825f, 0.466740f,
- 0.466655f, 0.466570f, 0.466485f, 0.466401f, 0.466316f, 0.466231f, 0.466146f, 0.466061f,
- 0.465977f, 0.465892f, 0.465807f, 0.465722f, 0.465637f, 0.465552f, 0.465467f, 0.465383f,
- 0.465298f, 0.465213f, 0.465128f, 0.465043f, 0.464958f, 0.464873f, 0.464788f, 0.464704f,
- 0.464619f, 0.464534f, 0.464449f, 0.464364f, 0.464279f, 0.464194f, 0.464109f, 0.464024f,
- 0.463939f, 0.463854f, 0.463769f, 0.463685f, 0.463600f, 0.463515f, 0.463430f, 0.463345f,
- 0.463260f, 0.463175f, 0.463090f, 0.463005f, 0.462920f, 0.462835f, 0.462750f, 0.462665f,
- 0.462580f, 0.462495f, 0.462410f, 0.462325f, 0.462240f, 0.462155f, 0.462070f, 0.461985f,
- 0.461900f, 0.461815f, 0.461730f, 0.461645f, 0.461560f, 0.461475f, 0.461390f, 0.461304f,
- 0.461219f, 0.461134f, 0.461049f, 0.460964f, 0.460879f, 0.460794f, 0.460709f, 0.460624f,
- 0.460539f, 0.460454f, 0.460369f, 0.460283f, 0.460198f, 0.460113f, 0.460028f, 0.459943f,
- 0.459858f, 0.459773f, 0.459687f, 0.459602f, 0.459517f, 0.459432f, 0.459347f, 0.459262f,
- 0.459177f, 0.459091f, 0.459006f, 0.458921f, 0.458836f, 0.458751f, 0.458665f, 0.458580f,
- 0.458495f, 0.458410f, 0.458325f, 0.458239f, 0.458154f, 0.458069f, 0.457984f, 0.457899f,
- 0.457813f, 0.457728f, 0.457643f, 0.457558f, 0.457472f, 0.457387f, 0.457302f, 0.457217f,
- 0.457131f, 0.457046f, 0.456961f, 0.456875f, 0.456790f, 0.456705f, 0.456620f, 0.456534f,
- 0.456449f, 0.456364f, 0.456278f, 0.456193f, 0.456108f, 0.456022f, 0.455937f, 0.455852f,
- 0.455766f, 0.455681f, 0.455596f, 0.455510f, 0.455425f, 0.455340f, 0.455254f, 0.455169f,
- 0.455084f, 0.454998f, 0.454913f, 0.454827f, 0.454742f, 0.454657f, 0.454571f, 0.454486f,
- 0.454400f, 0.454315f, 0.454230f, 0.454144f, 0.454059f, 0.453973f, 0.453888f, 0.453803f,
- 0.453717f, 0.453632f, 0.453546f, 0.453461f, 0.453375f, 0.453290f, 0.453204f, 0.453119f,
- 0.453033f, 0.452948f, 0.452863f, 0.452777f, 0.452692f, 0.452606f, 0.452521f, 0.452435f,
- 0.452350f, 0.452264f, 0.452179f, 0.452093f, 0.452008f, 0.451922f, 0.451836f, 0.451751f,
- 0.451665f, 0.451580f, 0.451494f, 0.451409f, 0.451323f, 0.451238f, 0.451152f, 0.451067f,
- 0.450981f, 0.450895f, 0.450810f, 0.450724f, 0.450639f, 0.450553f, 0.450467f, 0.450382f,
- 0.450296f, 0.450211f, 0.450125f, 0.450039f, 0.449954f, 0.449868f, 0.449783f, 0.449697f,
- 0.449611f, 0.449526f, 0.449440f, 0.449354f, 0.449269f, 0.449183f, 0.449097f, 0.449012f,
- 0.448926f, 0.448840f, 0.448755f, 0.448669f, 0.448583f, 0.448498f, 0.448412f, 0.448326f,
- 0.448241f, 0.448155f, 0.448069f, 0.447983f, 0.447898f, 0.447812f, 0.447726f, 0.447641f,
- 0.447555f, 0.447469f, 0.447383f, 0.447298f, 0.447212f, 0.447126f, 0.447040f, 0.446955f,
- 0.446869f, 0.446783f, 0.446697f, 0.446612f, 0.446526f, 0.446440f, 0.446354f, 0.446268f,
- 0.446183f, 0.446097f, 0.446011f, 0.445925f, 0.445839f, 0.445754f, 0.445668f, 0.445582f,
- 0.445496f, 0.445410f, 0.445324f, 0.445239f, 0.445153f, 0.445067f, 0.444981f, 0.444895f,
- 0.444809f, 0.444723f, 0.444637f, 0.444552f, 0.444466f, 0.444380f, 0.444294f, 0.444208f,
- 0.444122f, 0.444036f, 0.443950f, 0.443864f, 0.443779f, 0.443693f, 0.443607f, 0.443521f,
- 0.443435f, 0.443349f, 0.443263f, 0.443177f, 0.443091f, 0.443005f, 0.442919f, 0.442833f,
- 0.442747f, 0.442661f, 0.442575f, 0.442489f, 0.442403f, 0.442317f, 0.442231f, 0.442145f,
- 0.442059f, 0.441973f, 0.441887f, 0.441801f, 0.441715f, 0.441629f, 0.441543f, 0.441457f,
- 0.441371f, 0.441285f, 0.441199f, 0.441113f, 0.441027f, 0.440941f, 0.440855f, 0.440769f,
- 0.440683f, 0.440597f, 0.440511f, 0.440425f, 0.440339f, 0.440253f, 0.440166f, 0.440080f,
- 0.439994f, 0.439908f, 0.439822f, 0.439736f, 0.439650f, 0.439564f, 0.439478f, 0.439392f,
- 0.439305f, 0.439219f, 0.439133f, 0.439047f, 0.438961f, 0.438875f, 0.438789f, 0.438702f,
- 0.438616f, 0.438530f, 0.438444f, 0.438358f, 0.438272f, 0.438185f, 0.438099f, 0.438013f,
- 0.437927f, 0.437841f, 0.437754f, 0.437668f, 0.437582f, 0.437496f, 0.437410f, 0.437323f,
- 0.437237f, 0.437151f, 0.437065f, 0.436978f, 0.436892f, 0.436806f, 0.436720f, 0.436633f,
- 0.436547f, 0.436461f, 0.436375f, 0.436288f, 0.436202f, 0.436116f, 0.436030f, 0.435943f,
- 0.435857f, 0.435771f, 0.435685f, 0.435598f, 0.435512f, 0.435426f, 0.435339f, 0.435253f,
- 0.435167f, 0.435080f, 0.434994f, 0.434908f, 0.434821f, 0.434735f, 0.434649f, 0.434562f,
- 0.434476f, 0.434390f, 0.434303f, 0.434217f, 0.434131f, 0.434044f, 0.433958f, 0.433871f,
- 0.433785f, 0.433699f, 0.433612f, 0.433526f, 0.433439f, 0.433353f, 0.433267f, 0.433180f,
- 0.433094f, 0.433007f, 0.432921f, 0.432835f, 0.432748f, 0.432662f, 0.432575f, 0.432489f,
- 0.432402f, 0.432316f, 0.432229f, 0.432143f, 0.432057f, 0.431970f, 0.431884f, 0.431797f,
- 0.431711f, 0.431624f, 0.431538f, 0.431451f, 0.431365f, 0.431278f, 0.431192f, 0.431105f,
- 0.431019f, 0.430932f, 0.430846f, 0.430759f, 0.430673f, 0.430586f, 0.430500f, 0.430413f,
- 0.430326f, 0.430240f, 0.430153f, 0.430067f, 0.429980f, 0.429894f, 0.429807f, 0.429721f,
- 0.429634f, 0.429547f, 0.429461f, 0.429374f, 0.429288f, 0.429201f, 0.429114f, 0.429028f,
- 0.428941f, 0.428855f, 0.428768f, 0.428681f, 0.428595f, 0.428508f, 0.428422f, 0.428335f,
- 0.428248f, 0.428162f, 0.428075f, 0.427988f, 0.427902f, 0.427815f, 0.427728f, 0.427642f,
- 0.427555f, 0.427468f, 0.427382f, 0.427295f, 0.427208f, 0.427122f, 0.427035f, 0.426948f,
- 0.426862f, 0.426775f, 0.426688f, 0.426601f, 0.426515f, 0.426428f, 0.426341f, 0.426255f,
- 0.426168f, 0.426081f, 0.425994f, 0.425908f, 0.425821f, 0.425734f, 0.425647f, 0.425561f,
- 0.425474f, 0.425387f, 0.425300f, 0.425214f, 0.425127f, 0.425040f, 0.424953f, 0.424866f,
- 0.424780f, 0.424693f, 0.424606f, 0.424519f, 0.424432f, 0.424346f, 0.424259f, 0.424172f,
- 0.424085f, 0.423998f, 0.423912f, 0.423825f, 0.423738f, 0.423651f, 0.423564f, 0.423477f,
- 0.423390f, 0.423304f, 0.423217f, 0.423130f, 0.423043f, 0.422956f, 0.422869f, 0.422782f,
- 0.422695f, 0.422609f, 0.422522f, 0.422435f, 0.422348f, 0.422261f, 0.422174f, 0.422087f,
- 0.422000f, 0.421913f, 0.421826f, 0.421739f, 0.421653f, 0.421566f, 0.421479f, 0.421392f,
- 0.421305f, 0.421218f, 0.421131f, 0.421044f, 0.420957f, 0.420870f, 0.420783f, 0.420696f,
- 0.420609f, 0.420522f, 0.420435f, 0.420348f, 0.420261f, 0.420174f, 0.420087f, 0.420000f,
- 0.419913f, 0.419826f, 0.419739f, 0.419652f, 0.419565f, 0.419478f, 0.419391f, 0.419304f,
- 0.419217f, 0.419130f, 0.419043f, 0.418956f, 0.418869f, 0.418782f, 0.418695f, 0.418608f,
- 0.418520f, 0.418433f, 0.418346f, 0.418259f, 0.418172f, 0.418085f, 0.417998f, 0.417911f,
- 0.417824f, 0.417737f, 0.417650f, 0.417562f, 0.417475f, 0.417388f, 0.417301f, 0.417214f,
- 0.417127f, 0.417040f, 0.416952f, 0.416865f, 0.416778f, 0.416691f, 0.416604f, 0.416517f,
- 0.416430f, 0.416342f, 0.416255f, 0.416168f, 0.416081f, 0.415994f, 0.415906f, 0.415819f,
- 0.415732f, 0.415645f, 0.415558f, 0.415471f, 0.415383f, 0.415296f, 0.415209f, 0.415122f,
- 0.415034f, 0.414947f, 0.414860f, 0.414773f, 0.414685f, 0.414598f, 0.414511f, 0.414424f,
- 0.414337f, 0.414249f, 0.414162f, 0.414075f, 0.413987f, 0.413900f, 0.413813f, 0.413726f,
- 0.413638f, 0.413551f, 0.413464f, 0.413376f, 0.413289f, 0.413202f, 0.413115f, 0.413027f,
- 0.412940f, 0.412853f, 0.412765f, 0.412678f, 0.412591f, 0.412503f, 0.412416f, 0.412329f,
- 0.412241f, 0.412154f, 0.412067f, 0.411979f, 0.411892f, 0.411804f, 0.411717f, 0.411630f,
- 0.411542f, 0.411455f, 0.411368f, 0.411280f, 0.411193f, 0.411105f, 0.411018f, 0.410931f,
- 0.410843f, 0.410756f, 0.410668f, 0.410581f, 0.410493f, 0.410406f, 0.410319f, 0.410231f,
- 0.410144f, 0.410056f, 0.409969f, 0.409881f, 0.409794f, 0.409707f, 0.409619f, 0.409532f,
- 0.409444f, 0.409357f, 0.409269f, 0.409182f, 0.409094f, 0.409007f, 0.408919f, 0.408832f,
- 0.408744f, 0.408657f, 0.408569f, 0.408482f, 0.408394f, 0.408307f, 0.408219f, 0.408132f,
- 0.408044f, 0.407957f, 0.407869f, 0.407782f, 0.407694f, 0.407606f, 0.407519f, 0.407431f,
- 0.407344f, 0.407256f, 0.407169f, 0.407081f, 0.406994f, 0.406906f, 0.406818f, 0.406731f,
- 0.406643f, 0.406556f, 0.406468f, 0.406380f, 0.406293f, 0.406205f, 0.406118f, 0.406030f,
- 0.405942f, 0.405855f, 0.405767f, 0.405680f, 0.405592f, 0.405504f, 0.405417f, 0.405329f,
- 0.405241f, 0.405154f, 0.405066f, 0.404978f, 0.404891f, 0.404803f, 0.404715f, 0.404628f,
- 0.404540f, 0.404452f, 0.404365f, 0.404277f, 0.404189f, 0.404102f, 0.404014f, 0.403926f,
- 0.403838f, 0.403751f, 0.403663f, 0.403575f, 0.403488f, 0.403400f, 0.403312f, 0.403224f,
- 0.403137f, 0.403049f, 0.402961f, 0.402873f, 0.402786f, 0.402698f, 0.402610f, 0.402522f,
- 0.402435f, 0.402347f, 0.402259f, 0.402171f, 0.402084f, 0.401996f, 0.401908f, 0.401820f,
- 0.401732f, 0.401645f, 0.401557f, 0.401469f, 0.401381f, 0.401293f, 0.401206f, 0.401118f,
- 0.401030f, 0.400942f, 0.400854f, 0.400766f, 0.400679f, 0.400591f, 0.400503f, 0.400415f,
- 0.400327f, 0.400239f, 0.400151f, 0.400064f, 0.399976f, 0.399888f, 0.399800f, 0.399712f,
- 0.399624f, 0.399536f, 0.399448f, 0.399361f, 0.399273f, 0.399185f, 0.399097f, 0.399009f,
- 0.398921f, 0.398833f, 0.398745f, 0.398657f, 0.398569f, 0.398481f, 0.398393f, 0.398306f,
- 0.398218f, 0.398130f, 0.398042f, 0.397954f, 0.397866f, 0.397778f, 0.397690f, 0.397602f,
- 0.397514f, 0.397426f, 0.397338f, 0.397250f, 0.397162f, 0.397074f, 0.396986f, 0.396898f,
- 0.396810f, 0.396722f, 0.396634f, 0.396546f, 0.396458f, 0.396370f, 0.396282f, 0.396194f,
- 0.396106f, 0.396018f, 0.395930f, 0.395842f, 0.395754f, 0.395666f, 0.395578f, 0.395490f,
- 0.395401f, 0.395313f, 0.395225f, 0.395137f, 0.395049f, 0.394961f, 0.394873f, 0.394785f,
- 0.394697f, 0.394609f, 0.394521f, 0.394433f, 0.394344f, 0.394256f, 0.394168f, 0.394080f,
- 0.393992f, 0.393904f, 0.393816f, 0.393728f, 0.393640f, 0.393551f, 0.393463f, 0.393375f,
- 0.393287f, 0.393199f, 0.393111f, 0.393023f, 0.392934f, 0.392846f, 0.392758f, 0.392670f,
- 0.392582f, 0.392493f, 0.392405f, 0.392317f, 0.392229f, 0.392141f, 0.392053f, 0.391964f,
- 0.391876f, 0.391788f, 0.391700f, 0.391612f, 0.391523f, 0.391435f, 0.391347f, 0.391259f,
- 0.391170f, 0.391082f, 0.390994f, 0.390906f, 0.390817f, 0.390729f, 0.390641f, 0.390553f,
- 0.390464f, 0.390376f, 0.390288f, 0.390200f, 0.390111f, 0.390023f, 0.389935f, 0.389846f,
- 0.389758f, 0.389670f, 0.389582f, 0.389493f, 0.389405f, 0.389317f, 0.389228f, 0.389140f,
- 0.389052f, 0.388963f, 0.388875f, 0.388787f, 0.388698f, 0.388610f, 0.388522f, 0.388433f,
- 0.388345f, 0.388257f, 0.388168f, 0.388080f, 0.387992f, 0.387903f, 0.387815f, 0.387727f,
- 0.387638f, 0.387550f, 0.387461f, 0.387373f, 0.387285f, 0.387196f, 0.387108f, 0.387019f,
- 0.386931f, 0.386843f, 0.386754f, 0.386666f, 0.386577f, 0.386489f, 0.386400f, 0.386312f,
- 0.386224f, 0.386135f, 0.386047f, 0.385958f, 0.385870f, 0.385781f, 0.385693f, 0.385605f,
- 0.385516f, 0.385428f, 0.385339f, 0.385251f, 0.385162f, 0.385074f, 0.384985f, 0.384897f,
- 0.384808f, 0.384720f, 0.384631f, 0.384543f, 0.384454f, 0.384366f, 0.384277f, 0.384189f,
- 0.384100f, 0.384012f, 0.383923f, 0.383835f, 0.383746f, 0.383658f, 0.383569f, 0.383480f,
- 0.383392f, 0.383303f, 0.383215f, 0.383126f, 0.383038f, 0.382949f, 0.382861f, 0.382772f,
- 0.382683f, 0.382595f, 0.382506f, 0.382418f, 0.382329f, 0.382241f, 0.382152f, 0.382063f,
- 0.381975f, 0.381886f, 0.381797f, 0.381709f, 0.381620f, 0.381532f, 0.381443f, 0.381354f,
- 0.381266f, 0.381177f, 0.381088f, 0.381000f, 0.380911f, 0.380823f, 0.380734f, 0.380645f,
- 0.380557f, 0.380468f, 0.380379f, 0.380291f, 0.380202f, 0.380113f, 0.380025f, 0.379936f,
- 0.379847f, 0.379759f, 0.379670f, 0.379581f, 0.379492f, 0.379404f, 0.379315f, 0.379226f,
- 0.379138f, 0.379049f, 0.378960f, 0.378871f, 0.378783f, 0.378694f, 0.378605f, 0.378516f,
- 0.378428f, 0.378339f, 0.378250f, 0.378162f, 0.378073f, 0.377984f, 0.377895f, 0.377806f,
- 0.377718f, 0.377629f, 0.377540f, 0.377451f, 0.377363f, 0.377274f, 0.377185f, 0.377096f,
- 0.377007f, 0.376919f, 0.376830f, 0.376741f, 0.376652f, 0.376563f, 0.376475f, 0.376386f,
- 0.376297f, 0.376208f, 0.376119f, 0.376030f, 0.375942f, 0.375853f, 0.375764f, 0.375675f,
- 0.375586f, 0.375497f, 0.375408f, 0.375320f, 0.375231f, 0.375142f, 0.375053f, 0.374964f,
- 0.374875f, 0.374786f, 0.374697f, 0.374609f, 0.374520f, 0.374431f, 0.374342f, 0.374253f,
- 0.374164f, 0.374075f, 0.373986f, 0.373897f, 0.373808f, 0.373719f, 0.373631f, 0.373542f,
- 0.373453f, 0.373364f, 0.373275f, 0.373186f, 0.373097f, 0.373008f, 0.372919f, 0.372830f,
- 0.372741f, 0.372652f, 0.372563f, 0.372474f, 0.372385f, 0.372296f, 0.372207f, 0.372118f,
- 0.372029f, 0.371940f, 0.371851f, 0.371762f, 0.371673f, 0.371584f, 0.371495f, 0.371406f,
- 0.371317f, 0.371228f, 0.371139f, 0.371050f, 0.370961f, 0.370872f, 0.370783f, 0.370694f,
- 0.370605f, 0.370516f, 0.370427f, 0.370338f, 0.370249f, 0.370160f, 0.370071f, 0.369982f,
- 0.369892f, 0.369803f, 0.369714f, 0.369625f, 0.369536f, 0.369447f, 0.369358f, 0.369269f,
- 0.369180f, 0.369091f, 0.369002f, 0.368912f, 0.368823f, 0.368734f, 0.368645f, 0.368556f,
- 0.368467f, 0.368378f, 0.368289f, 0.368199f, 0.368110f, 0.368021f, 0.367932f, 0.367843f,
- 0.367754f, 0.367665f, 0.367575f, 0.367486f, 0.367397f, 0.367308f, 0.367219f, 0.367130f,
- 0.367040f, 0.366951f, 0.366862f, 0.366773f, 0.366684f, 0.366594f, 0.366505f, 0.366416f,
- 0.366327f, 0.366238f, 0.366148f, 0.366059f, 0.365970f, 0.365881f, 0.365791f, 0.365702f,
- 0.365613f, 0.365524f, 0.365435f, 0.365345f, 0.365256f, 0.365167f, 0.365078f, 0.364988f,
- 0.364899f, 0.364810f, 0.364720f, 0.364631f, 0.364542f, 0.364453f, 0.364363f, 0.364274f,
- 0.364185f, 0.364096f, 0.364006f, 0.363917f, 0.363828f, 0.363738f, 0.363649f, 0.363560f,
- 0.363470f, 0.363381f, 0.363292f, 0.363202f, 0.363113f, 0.363024f, 0.362934f, 0.362845f,
- 0.362756f, 0.362666f, 0.362577f, 0.362488f, 0.362398f, 0.362309f, 0.362220f, 0.362130f,
- 0.362041f, 0.361952f, 0.361862f, 0.361773f, 0.361683f, 0.361594f, 0.361505f, 0.361415f,
- 0.361326f, 0.361236f, 0.361147f, 0.361058f, 0.360968f, 0.360879f, 0.360789f, 0.360700f,
- 0.360611f, 0.360521f, 0.360432f, 0.360342f, 0.360253f, 0.360163f, 0.360074f, 0.359984f,
- 0.359895f, 0.359806f, 0.359716f, 0.359627f, 0.359537f, 0.359448f, 0.359358f, 0.359269f,
- 0.359179f, 0.359090f, 0.359000f, 0.358911f, 0.358821f, 0.358732f, 0.358642f, 0.358553f,
- 0.358463f, 0.358374f, 0.358284f, 0.358195f, 0.358105f, 0.358016f, 0.357926f, 0.357837f,
- 0.357747f, 0.357658f, 0.357568f, 0.357479f, 0.357389f, 0.357300f, 0.357210f, 0.357121f,
- 0.357031f, 0.356941f, 0.356852f, 0.356762f, 0.356673f, 0.356583f, 0.356494f, 0.356404f,
- 0.356314f, 0.356225f, 0.356135f, 0.356046f, 0.355956f, 0.355866f, 0.355777f, 0.355687f,
- 0.355598f, 0.355508f, 0.355418f, 0.355329f, 0.355239f, 0.355150f, 0.355060f, 0.354970f,
- 0.354881f, 0.354791f, 0.354701f, 0.354612f, 0.354522f, 0.354432f, 0.354343f, 0.354253f,
- 0.354164f, 0.354074f, 0.353984f, 0.353895f, 0.353805f, 0.353715f, 0.353626f, 0.353536f,
- 0.353446f, 0.353356f, 0.353267f, 0.353177f, 0.353087f, 0.352998f, 0.352908f, 0.352818f,
- 0.352729f, 0.352639f, 0.352549f, 0.352459f, 0.352370f, 0.352280f, 0.352190f, 0.352100f,
- 0.352011f, 0.351921f, 0.351831f, 0.351742f, 0.351652f, 0.351562f, 0.351472f, 0.351383f,
- 0.351293f, 0.351203f, 0.351113f, 0.351023f, 0.350934f, 0.350844f, 0.350754f, 0.350664f,
- 0.350575f, 0.350485f, 0.350395f, 0.350305f, 0.350215f, 0.350126f, 0.350036f, 0.349946f,
- 0.349856f, 0.349766f, 0.349676f, 0.349587f, 0.349497f, 0.349407f, 0.349317f, 0.349227f,
- 0.349138f, 0.349048f, 0.348958f, 0.348868f, 0.348778f, 0.348688f, 0.348598f, 0.348509f,
- 0.348419f, 0.348329f, 0.348239f, 0.348149f, 0.348059f, 0.347969f, 0.347879f, 0.347790f,
- 0.347700f, 0.347610f, 0.347520f, 0.347430f, 0.347340f, 0.347250f, 0.347160f, 0.347070f,
- 0.346980f, 0.346890f, 0.346801f, 0.346711f, 0.346621f, 0.346531f, 0.346441f, 0.346351f,
- 0.346261f, 0.346171f, 0.346081f, 0.345991f, 0.345901f, 0.345811f, 0.345721f, 0.345631f,
- 0.345541f, 0.345451f, 0.345361f, 0.345271f, 0.345181f, 0.345091f, 0.345001f, 0.344911f,
- 0.344821f, 0.344731f, 0.344641f, 0.344551f, 0.344461f, 0.344371f, 0.344281f, 0.344191f,
- 0.344101f, 0.344011f, 0.343921f, 0.343831f, 0.343741f, 0.343651f, 0.343561f, 0.343471f,
- 0.343381f, 0.343291f, 0.343201f, 0.343111f, 0.343021f, 0.342931f, 0.342841f, 0.342751f,
- 0.342661f, 0.342571f, 0.342481f, 0.342391f, 0.342300f, 0.342210f, 0.342120f, 0.342030f,
- 0.341940f, 0.341850f, 0.341760f, 0.341670f, 0.341580f, 0.341490f, 0.341399f, 0.341309f,
- 0.341219f, 0.341129f, 0.341039f, 0.340949f, 0.340859f, 0.340769f, 0.340678f, 0.340588f,
- 0.340498f, 0.340408f, 0.340318f, 0.340228f, 0.340138f, 0.340047f, 0.339957f, 0.339867f,
- 0.339777f, 0.339687f, 0.339597f, 0.339506f, 0.339416f, 0.339326f, 0.339236f, 0.339146f,
- 0.339055f, 0.338965f, 0.338875f, 0.338785f, 0.338695f, 0.338604f, 0.338514f, 0.338424f,
- 0.338334f, 0.338244f, 0.338153f, 0.338063f, 0.337973f, 0.337883f, 0.337792f, 0.337702f,
- 0.337612f, 0.337522f, 0.337431f, 0.337341f, 0.337251f, 0.337161f, 0.337070f, 0.336980f,
- 0.336890f, 0.336800f, 0.336709f, 0.336619f, 0.336529f, 0.336438f, 0.336348f, 0.336258f,
- 0.336168f, 0.336077f, 0.335987f, 0.335897f, 0.335806f, 0.335716f, 0.335626f, 0.335535f,
- 0.335445f, 0.335355f, 0.335265f, 0.335174f, 0.335084f, 0.334994f, 0.334903f, 0.334813f,
- 0.334722f, 0.334632f, 0.334542f, 0.334451f, 0.334361f, 0.334271f, 0.334180f, 0.334090f,
- 0.334000f, 0.333909f, 0.333819f, 0.333729f, 0.333638f, 0.333548f, 0.333457f, 0.333367f,
- 0.333277f, 0.333186f, 0.333096f, 0.333005f, 0.332915f, 0.332825f, 0.332734f, 0.332644f,
- 0.332553f, 0.332463f, 0.332373f, 0.332282f, 0.332192f, 0.332101f, 0.332011f, 0.331920f,
- 0.331830f, 0.331739f, 0.331649f, 0.331559f, 0.331468f, 0.331378f, 0.331287f, 0.331197f,
- 0.331106f, 0.331016f, 0.330925f, 0.330835f, 0.330744f, 0.330654f, 0.330563f, 0.330473f,
- 0.330382f, 0.330292f, 0.330202f, 0.330111f, 0.330020f, 0.329930f, 0.329839f, 0.329749f,
- 0.329658f, 0.329568f, 0.329477f, 0.329387f, 0.329296f, 0.329206f, 0.329115f, 0.329025f,
- 0.328934f, 0.328844f, 0.328753f, 0.328663f, 0.328572f, 0.328482f, 0.328391f, 0.328300f,
- 0.328210f, 0.328119f, 0.328029f, 0.327938f, 0.327848f, 0.327757f, 0.327666f, 0.327576f,
- 0.327485f, 0.327395f, 0.327304f, 0.327213f, 0.327123f, 0.327032f, 0.326942f, 0.326851f,
- 0.326760f, 0.326670f, 0.326579f, 0.326489f, 0.326398f, 0.326307f, 0.326217f, 0.326126f,
- 0.326035f, 0.325945f, 0.325854f, 0.325764f, 0.325673f, 0.325582f, 0.325492f, 0.325401f,
- 0.325310f, 0.325220f, 0.325129f, 0.325038f, 0.324948f, 0.324857f, 0.324766f, 0.324676f,
- 0.324585f, 0.324494f, 0.324404f, 0.324313f, 0.324222f, 0.324131f, 0.324041f, 0.323950f,
- 0.323859f, 0.323769f, 0.323678f, 0.323587f, 0.323497f, 0.323406f, 0.323315f, 0.323224f,
- 0.323134f, 0.323043f, 0.322952f, 0.322861f, 0.322771f, 0.322680f, 0.322589f, 0.322498f,
- 0.322408f, 0.322317f, 0.322226f, 0.322135f, 0.322045f, 0.321954f, 0.321863f, 0.321772f,
- 0.321682f, 0.321591f, 0.321500f, 0.321409f, 0.321318f, 0.321228f, 0.321137f, 0.321046f,
- 0.320955f, 0.320864f, 0.320774f, 0.320683f, 0.320592f, 0.320501f, 0.320410f, 0.320320f,
- 0.320229f, 0.320138f, 0.320047f, 0.319956f, 0.319865f, 0.319775f, 0.319684f, 0.319593f,
- 0.319502f, 0.319411f, 0.319320f, 0.319229f, 0.319139f, 0.319048f, 0.318957f, 0.318866f,
- 0.318775f, 0.318684f, 0.318593f, 0.318503f, 0.318412f, 0.318321f, 0.318230f, 0.318139f,
- 0.318048f, 0.317957f, 0.317866f, 0.317775f, 0.317684f, 0.317594f, 0.317503f, 0.317412f,
- 0.317321f, 0.317230f, 0.317139f, 0.317048f, 0.316957f, 0.316866f, 0.316775f, 0.316684f,
- 0.316593f, 0.316502f, 0.316411f, 0.316321f, 0.316230f, 0.316139f, 0.316048f, 0.315957f,
- 0.315866f, 0.315775f, 0.315684f, 0.315593f, 0.315502f, 0.315411f, 0.315320f, 0.315229f,
- 0.315138f, 0.315047f, 0.314956f, 0.314865f, 0.314774f, 0.314683f, 0.314592f, 0.314501f,
- 0.314410f, 0.314319f, 0.314228f, 0.314137f, 0.314046f, 0.313955f, 0.313864f, 0.313773f,
- 0.313682f, 0.313591f, 0.313500f, 0.313409f, 0.313318f, 0.313227f, 0.313135f, 0.313044f,
- 0.312953f, 0.312862f, 0.312771f, 0.312680f, 0.312589f, 0.312498f, 0.312407f, 0.312316f,
- 0.312225f, 0.312134f, 0.312043f, 0.311952f, 0.311860f, 0.311769f, 0.311678f, 0.311587f,
- 0.311496f, 0.311405f, 0.311314f, 0.311223f, 0.311132f, 0.311041f, 0.310949f, 0.310858f,
- 0.310767f, 0.310676f, 0.310585f, 0.310494f, 0.310403f, 0.310311f, 0.310220f, 0.310129f,
- 0.310038f, 0.309947f, 0.309856f, 0.309765f, 0.309673f, 0.309582f, 0.309491f, 0.309400f,
- 0.309309f, 0.309218f, 0.309126f, 0.309035f, 0.308944f, 0.308853f, 0.308762f, 0.308670f,
- 0.308579f, 0.308488f, 0.308397f, 0.308306f, 0.308214f, 0.308123f, 0.308032f, 0.307941f,
- 0.307850f, 0.307758f, 0.307667f, 0.307576f, 0.307485f, 0.307394f, 0.307302f, 0.307211f,
- 0.307120f, 0.307029f, 0.306937f, 0.306846f, 0.306755f, 0.306664f, 0.306572f, 0.306481f,
- 0.306390f, 0.306299f, 0.306207f, 0.306116f, 0.306025f, 0.305933f, 0.305842f, 0.305751f,
- 0.305660f, 0.305568f, 0.305477f, 0.305386f, 0.305294f, 0.305203f, 0.305112f, 0.305021f,
- 0.304929f, 0.304838f, 0.304747f, 0.304655f, 0.304564f, 0.304473f, 0.304381f, 0.304290f,
- 0.304199f, 0.304107f, 0.304016f, 0.303925f, 0.303833f, 0.303742f, 0.303651f, 0.303559f,
- 0.303468f, 0.303377f, 0.303285f, 0.303194f, 0.303103f, 0.303011f, 0.302920f, 0.302828f,
- 0.302737f, 0.302646f, 0.302554f, 0.302463f, 0.302372f, 0.302280f, 0.302189f, 0.302097f,
- 0.302006f, 0.301915f, 0.301823f, 0.301732f, 0.301640f, 0.301549f, 0.301458f, 0.301366f,
- 0.301275f, 0.301183f, 0.301092f, 0.301000f, 0.300909f, 0.300818f, 0.300726f, 0.300635f,
- 0.300543f, 0.300452f, 0.300360f, 0.300269f, 0.300177f, 0.300086f, 0.299995f, 0.299903f,
- 0.299812f, 0.299720f, 0.299629f, 0.299537f, 0.299446f, 0.299354f, 0.299263f, 0.299171f,
- 0.299080f, 0.298988f, 0.298897f, 0.298805f, 0.298714f, 0.298622f, 0.298531f, 0.298439f,
- 0.298348f, 0.298256f, 0.298165f, 0.298073f, 0.297982f, 0.297890f, 0.297799f, 0.297707f,
- 0.297616f, 0.297524f, 0.297433f, 0.297341f, 0.297250f, 0.297158f, 0.297066f, 0.296975f,
- 0.296883f, 0.296792f, 0.296700f, 0.296609f, 0.296517f, 0.296426f, 0.296334f, 0.296242f,
- 0.296151f, 0.296059f, 0.295968f, 0.295876f, 0.295785f, 0.295693f, 0.295601f, 0.295510f,
- 0.295418f, 0.295327f, 0.295235f, 0.295143f, 0.295052f, 0.294960f, 0.294869f, 0.294777f,
- 0.294685f, 0.294594f, 0.294502f, 0.294410f, 0.294319f, 0.294227f, 0.294136f, 0.294044f,
- 0.293952f, 0.293861f, 0.293769f, 0.293677f, 0.293586f, 0.293494f, 0.293402f, 0.293311f,
- 0.293219f, 0.293128f, 0.293036f, 0.292944f, 0.292852f, 0.292761f, 0.292669f, 0.292577f,
- 0.292486f, 0.292394f, 0.292302f, 0.292211f, 0.292119f, 0.292027f, 0.291936f, 0.291844f,
- 0.291752f, 0.291661f, 0.291569f, 0.291477f, 0.291385f, 0.291294f, 0.291202f, 0.291110f,
- 0.291019f, 0.290927f, 0.290835f, 0.290743f, 0.290652f, 0.290560f, 0.290468f, 0.290376f,
- 0.290285f, 0.290193f, 0.290101f, 0.290009f, 0.289918f, 0.289826f, 0.289734f, 0.289642f,
- 0.289551f, 0.289459f, 0.289367f, 0.289275f, 0.289184f, 0.289092f, 0.289000f, 0.288908f,
- 0.288816f, 0.288725f, 0.288633f, 0.288541f, 0.288449f, 0.288357f, 0.288266f, 0.288174f,
- 0.288082f, 0.287990f, 0.287898f, 0.287807f, 0.287715f, 0.287623f, 0.287531f, 0.287439f,
- 0.287347f, 0.287256f, 0.287164f, 0.287072f, 0.286980f, 0.286888f, 0.286796f, 0.286705f,
- 0.286613f, 0.286521f, 0.286429f, 0.286337f, 0.286245f, 0.286153f, 0.286062f, 0.285970f,
- 0.285878f, 0.285786f, 0.285694f, 0.285602f, 0.285510f, 0.285418f, 0.285327f, 0.285235f,
- 0.285143f, 0.285051f, 0.284959f, 0.284867f, 0.284775f, 0.284683f, 0.284591f, 0.284499f,
- 0.284408f, 0.284316f, 0.284224f, 0.284132f, 0.284040f, 0.283948f, 0.283856f, 0.283764f,
- 0.283672f, 0.283580f, 0.283488f, 0.283396f, 0.283304f, 0.283212f, 0.283120f, 0.283029f,
- 0.282937f, 0.282845f, 0.282753f, 0.282661f, 0.282569f, 0.282477f, 0.282385f, 0.282293f,
- 0.282201f, 0.282109f, 0.282017f, 0.281925f, 0.281833f, 0.281741f, 0.281649f, 0.281557f,
- 0.281465f, 0.281373f, 0.281281f, 0.281189f, 0.281097f, 0.281005f, 0.280913f, 0.280821f,
- 0.280729f, 0.280637f, 0.280545f, 0.280453f, 0.280361f, 0.280269f, 0.280177f, 0.280085f,
- 0.279993f, 0.279901f, 0.279809f, 0.279717f, 0.279624f, 0.279532f, 0.279440f, 0.279348f,
- 0.279256f, 0.279164f, 0.279072f, 0.278980f, 0.278888f, 0.278796f, 0.278704f, 0.278612f,
- 0.278520f, 0.278428f, 0.278336f, 0.278243f, 0.278151f, 0.278059f, 0.277967f, 0.277875f,
- 0.277783f, 0.277691f, 0.277599f, 0.277507f, 0.277415f, 0.277322f, 0.277230f, 0.277138f,
- 0.277046f, 0.276954f, 0.276862f, 0.276770f, 0.276678f, 0.276585f, 0.276493f, 0.276401f,
- 0.276309f, 0.276217f, 0.276125f, 0.276033f, 0.275940f, 0.275848f, 0.275756f, 0.275664f,
- 0.275572f, 0.275480f, 0.275387f, 0.275295f, 0.275203f, 0.275111f, 0.275019f, 0.274927f,
- 0.274834f, 0.274742f, 0.274650f, 0.274558f, 0.274466f, 0.274374f, 0.274281f, 0.274189f,
- 0.274097f, 0.274005f, 0.273912f, 0.273820f, 0.273728f, 0.273636f, 0.273544f, 0.273451f,
- 0.273359f, 0.273267f, 0.273175f, 0.273083f, 0.272990f, 0.272898f, 0.272806f, 0.272714f,
- 0.272621f, 0.272529f, 0.272437f, 0.272345f, 0.272252f, 0.272160f, 0.272068f, 0.271976f,
- 0.271883f, 0.271791f, 0.271699f, 0.271607f, 0.271514f, 0.271422f, 0.271330f, 0.271237f,
- 0.271145f, 0.271053f, 0.270961f, 0.270868f, 0.270776f, 0.270684f, 0.270591f, 0.270499f,
- 0.270407f, 0.270315f, 0.270222f, 0.270130f, 0.270038f, 0.269945f, 0.269853f, 0.269761f,
- 0.269668f, 0.269576f, 0.269484f, 0.269391f, 0.269299f, 0.269207f, 0.269114f, 0.269022f,
- 0.268930f, 0.268837f, 0.268745f, 0.268653f, 0.268560f, 0.268468f, 0.268376f, 0.268283f,
- 0.268191f, 0.268099f, 0.268006f, 0.267914f, 0.267821f, 0.267729f, 0.267637f, 0.267544f,
- 0.267452f, 0.267359f, 0.267267f, 0.267175f, 0.267082f, 0.266990f, 0.266898f, 0.266805f,
- 0.266713f, 0.266620f, 0.266528f, 0.266436f, 0.266343f, 0.266251f, 0.266158f, 0.266066f,
- 0.265973f, 0.265881f, 0.265789f, 0.265696f, 0.265604f, 0.265511f, 0.265419f, 0.265326f,
- 0.265234f, 0.265142f, 0.265049f, 0.264957f, 0.264864f, 0.264772f, 0.264679f, 0.264587f,
- 0.264494f, 0.264402f, 0.264309f, 0.264217f, 0.264125f, 0.264032f, 0.263940f, 0.263847f,
- 0.263755f, 0.263662f, 0.263570f, 0.263477f, 0.263385f, 0.263292f, 0.263200f, 0.263107f,
- 0.263015f, 0.262922f, 0.262830f, 0.262737f, 0.262645f, 0.262552f, 0.262460f, 0.262367f,
- 0.262275f, 0.262182f, 0.262090f, 0.261997f, 0.261905f, 0.261812f, 0.261720f, 0.261627f,
- 0.261534f, 0.261442f, 0.261349f, 0.261257f, 0.261164f, 0.261072f, 0.260979f, 0.260887f,
- 0.260794f, 0.260702f, 0.260609f, 0.260516f, 0.260424f, 0.260331f, 0.260239f, 0.260146f,
- 0.260054f, 0.259961f, 0.259868f, 0.259776f, 0.259683f, 0.259591f, 0.259498f, 0.259405f,
- 0.259313f, 0.259220f, 0.259128f, 0.259035f, 0.258943f, 0.258850f, 0.258757f, 0.258665f,
- 0.258572f, 0.258479f, 0.258387f, 0.258294f, 0.258202f, 0.258109f, 0.258016f, 0.257924f,
- 0.257831f, 0.257738f, 0.257646f, 0.257553f, 0.257461f, 0.257368f, 0.257275f, 0.257183f,
- 0.257090f, 0.256997f, 0.256905f, 0.256812f, 0.256719f, 0.256627f, 0.256534f, 0.256441f,
- 0.256349f, 0.256256f, 0.256163f, 0.256071f, 0.255978f, 0.255885f, 0.255793f, 0.255700f,
- 0.255607f, 0.255515f, 0.255422f, 0.255329f, 0.255236f, 0.255144f, 0.255051f, 0.254958f,
- 0.254866f, 0.254773f, 0.254680f, 0.254588f, 0.254495f, 0.254402f, 0.254309f, 0.254217f,
- 0.254124f, 0.254031f, 0.253938f, 0.253846f, 0.253753f, 0.253660f, 0.253568f, 0.253475f,
- 0.253382f, 0.253289f, 0.253197f, 0.253104f, 0.253011f, 0.252918f, 0.252826f, 0.252733f,
- 0.252640f, 0.252547f, 0.252454f, 0.252362f, 0.252269f, 0.252176f, 0.252083f, 0.251991f,
- 0.251898f, 0.251805f, 0.251712f, 0.251619f, 0.251527f, 0.251434f, 0.251341f, 0.251248f,
- 0.251155f, 0.251063f, 0.250970f, 0.250877f, 0.250784f, 0.250691f, 0.250599f, 0.250506f,
- 0.250413f, 0.250320f, 0.250227f, 0.250135f, 0.250042f, 0.249949f, 0.249856f, 0.249763f,
- 0.249670f, 0.249578f, 0.249485f, 0.249392f, 0.249299f, 0.249206f, 0.249113f, 0.249020f,
- 0.248928f, 0.248835f, 0.248742f, 0.248649f, 0.248556f, 0.248463f, 0.248370f, 0.248278f,
- 0.248185f, 0.248092f, 0.247999f, 0.247906f, 0.247813f, 0.247720f, 0.247627f, 0.247535f,
- 0.247442f, 0.247349f, 0.247256f, 0.247163f, 0.247070f, 0.246977f, 0.246884f, 0.246791f,
- 0.246698f, 0.246606f, 0.246513f, 0.246420f, 0.246327f, 0.246234f, 0.246141f, 0.246048f,
- 0.245955f, 0.245862f, 0.245769f, 0.245676f, 0.245583f, 0.245490f, 0.245397f, 0.245304f,
- 0.245212f, 0.245119f, 0.245026f, 0.244933f, 0.244840f, 0.244747f, 0.244654f, 0.244561f,
- 0.244468f, 0.244375f, 0.244282f, 0.244189f, 0.244096f, 0.244003f, 0.243910f, 0.243817f,
- 0.243724f, 0.243631f, 0.243538f, 0.243445f, 0.243352f, 0.243259f, 0.243166f, 0.243073f,
- 0.242980f, 0.242887f, 0.242794f, 0.242701f, 0.242608f, 0.242515f, 0.242422f, 0.242329f,
- 0.242236f, 0.242143f, 0.242050f, 0.241957f, 0.241864f, 0.241771f, 0.241678f, 0.241585f,
- 0.241492f, 0.241399f, 0.241306f, 0.241213f, 0.241120f, 0.241027f, 0.240934f, 0.240841f,
- 0.240748f, 0.240654f, 0.240561f, 0.240468f, 0.240375f, 0.240282f, 0.240189f, 0.240096f,
- 0.240003f, 0.239910f, 0.239817f, 0.239724f, 0.239631f, 0.239538f, 0.239445f, 0.239351f,
- 0.239258f, 0.239165f, 0.239072f, 0.238979f, 0.238886f, 0.238793f, 0.238700f, 0.238607f,
- 0.238514f, 0.238420f, 0.238327f, 0.238234f, 0.238141f, 0.238048f, 0.237955f, 0.237862f,
- 0.237769f, 0.237676f, 0.237582f, 0.237489f, 0.237396f, 0.237303f, 0.237210f, 0.237117f,
- 0.237024f, 0.236930f, 0.236837f, 0.236744f, 0.236651f, 0.236558f, 0.236465f, 0.236372f,
- 0.236278f, 0.236185f, 0.236092f, 0.235999f, 0.235906f, 0.235813f, 0.235719f, 0.235626f,
- 0.235533f, 0.235440f, 0.235347f, 0.235254f, 0.235160f, 0.235067f, 0.234974f, 0.234881f,
- 0.234788f, 0.234694f, 0.234601f, 0.234508f, 0.234415f, 0.234322f, 0.234228f, 0.234135f,
- 0.234042f, 0.233949f, 0.233856f, 0.233762f, 0.233669f, 0.233576f, 0.233483f, 0.233389f,
- 0.233296f, 0.233203f, 0.233110f, 0.233017f, 0.232923f, 0.232830f, 0.232737f, 0.232644f,
- 0.232550f, 0.232457f, 0.232364f, 0.232271f, 0.232177f, 0.232084f, 0.231991f, 0.231898f,
- 0.231804f, 0.231711f, 0.231618f, 0.231524f, 0.231431f, 0.231338f, 0.231245f, 0.231151f,
- 0.231058f, 0.230965f, 0.230872f, 0.230778f, 0.230685f, 0.230592f, 0.230498f, 0.230405f,
- 0.230312f, 0.230218f, 0.230125f, 0.230032f, 0.229939f, 0.229845f, 0.229752f, 0.229659f,
- 0.229565f, 0.229472f, 0.229379f, 0.229285f, 0.229192f, 0.229099f, 0.229005f, 0.228912f,
- 0.228819f, 0.228725f, 0.228632f, 0.228539f, 0.228445f, 0.228352f, 0.228259f, 0.228165f,
- 0.228072f, 0.227979f, 0.227885f, 0.227792f, 0.227699f, 0.227605f, 0.227512f, 0.227419f,
- 0.227325f, 0.227232f, 0.227139f, 0.227045f, 0.226952f, 0.226858f, 0.226765f, 0.226672f,
- 0.226578f, 0.226485f, 0.226391f, 0.226298f, 0.226205f, 0.226111f, 0.226018f, 0.225925f,
- 0.225831f, 0.225738f, 0.225644f, 0.225551f, 0.225458f, 0.225364f, 0.225271f, 0.225177f,
- 0.225084f, 0.224991f, 0.224897f, 0.224804f, 0.224710f, 0.224617f, 0.224523f, 0.224430f,
- 0.224337f, 0.224243f, 0.224150f, 0.224056f, 0.223963f, 0.223869f, 0.223776f, 0.223682f,
- 0.223589f, 0.223496f, 0.223402f, 0.223309f, 0.223215f, 0.223122f, 0.223028f, 0.222935f,
- 0.222841f, 0.222748f, 0.222654f, 0.222561f, 0.222468f, 0.222374f, 0.222281f, 0.222187f,
- 0.222094f, 0.222000f, 0.221907f, 0.221813f, 0.221720f, 0.221626f, 0.221533f, 0.221439f,
- 0.221346f, 0.221252f, 0.221159f, 0.221065f, 0.220972f, 0.220878f, 0.220785f, 0.220691f,
- 0.220598f, 0.220504f, 0.220411f, 0.220317f, 0.220224f, 0.220130f, 0.220037f, 0.219943f,
- 0.219850f, 0.219756f, 0.219662f, 0.219569f, 0.219475f, 0.219382f, 0.219288f, 0.219195f,
- 0.219101f, 0.219008f, 0.218914f, 0.218821f, 0.218727f, 0.218633f, 0.218540f, 0.218446f,
- 0.218353f, 0.218259f, 0.218166f, 0.218072f, 0.217979f, 0.217885f, 0.217791f, 0.217698f,
- 0.217604f, 0.217511f, 0.217417f, 0.217324f, 0.217230f, 0.217136f, 0.217043f, 0.216949f,
- 0.216856f, 0.216762f, 0.216668f, 0.216575f, 0.216481f, 0.216388f, 0.216294f, 0.216200f,
- 0.216107f, 0.216013f, 0.215920f, 0.215826f, 0.215732f, 0.215639f, 0.215545f, 0.215451f,
- 0.215358f, 0.215264f, 0.215171f, 0.215077f, 0.214983f, 0.214890f, 0.214796f, 0.214702f,
- 0.214609f, 0.214515f, 0.214422f, 0.214328f, 0.214234f, 0.214141f, 0.214047f, 0.213953f,
- 0.213860f, 0.213766f, 0.213672f, 0.213579f, 0.213485f, 0.213391f, 0.213298f, 0.213204f,
- 0.213110f, 0.213017f, 0.212923f, 0.212829f, 0.212736f, 0.212642f, 0.212548f, 0.212455f,
- 0.212361f, 0.212267f, 0.212174f, 0.212080f, 0.211986f, 0.211892f, 0.211799f, 0.211705f,
- 0.211611f, 0.211518f, 0.211424f, 0.211330f, 0.211237f, 0.211143f, 0.211049f, 0.210955f,
- 0.210862f, 0.210768f, 0.210674f, 0.210580f, 0.210487f, 0.210393f, 0.210299f, 0.210206f,
- 0.210112f, 0.210018f, 0.209924f, 0.209831f, 0.209737f, 0.209643f, 0.209549f, 0.209456f,
- 0.209362f, 0.209268f, 0.209174f, 0.209081f, 0.208987f, 0.208893f, 0.208799f, 0.208706f,
- 0.208612f, 0.208518f, 0.208424f, 0.208331f, 0.208237f, 0.208143f, 0.208049f, 0.207955f,
- 0.207862f, 0.207768f, 0.207674f, 0.207580f, 0.207487f, 0.207393f, 0.207299f, 0.207205f,
- 0.207111f, 0.207018f, 0.206924f, 0.206830f, 0.206736f, 0.206642f, 0.206549f, 0.206455f,
- 0.206361f, 0.206267f, 0.206173f, 0.206080f, 0.205986f, 0.205892f, 0.205798f, 0.205704f,
- 0.205610f, 0.205517f, 0.205423f, 0.205329f, 0.205235f, 0.205141f, 0.205047f, 0.204954f,
- 0.204860f, 0.204766f, 0.204672f, 0.204578f, 0.204484f, 0.204391f, 0.204297f, 0.204203f,
- 0.204109f, 0.204015f, 0.203921f, 0.203827f, 0.203734f, 0.203640f, 0.203546f, 0.203452f,
- 0.203358f, 0.203264f, 0.203170f, 0.203076f, 0.202983f, 0.202889f, 0.202795f, 0.202701f,
- 0.202607f, 0.202513f, 0.202419f, 0.202325f, 0.202231f, 0.202138f, 0.202044f, 0.201950f,
- 0.201856f, 0.201762f, 0.201668f, 0.201574f, 0.201480f, 0.201386f, 0.201292f, 0.201199f,
- 0.201105f, 0.201011f, 0.200917f, 0.200823f, 0.200729f, 0.200635f, 0.200541f, 0.200447f,
- 0.200353f, 0.200259f, 0.200165f, 0.200071f, 0.199978f, 0.199884f, 0.199790f, 0.199696f,
- 0.199602f, 0.199508f, 0.199414f, 0.199320f, 0.199226f, 0.199132f, 0.199038f, 0.198944f,
- 0.198850f, 0.198756f, 0.198662f, 0.198568f, 0.198474f, 0.198380f, 0.198286f, 0.198192f,
- 0.198098f, 0.198004f, 0.197910f, 0.197816f, 0.197722f, 0.197629f, 0.197535f, 0.197441f,
- 0.197347f, 0.197253f, 0.197159f, 0.197065f, 0.196971f, 0.196877f, 0.196783f, 0.196689f,
- 0.196595f, 0.196501f, 0.196407f, 0.196313f, 0.196219f, 0.196125f, 0.196031f, 0.195937f,
- 0.195843f, 0.195748f, 0.195654f, 0.195560f, 0.195466f, 0.195372f, 0.195278f, 0.195184f,
- 0.195090f, 0.194996f, 0.194902f, 0.194808f, 0.194714f, 0.194620f, 0.194526f, 0.194432f,
- 0.194338f, 0.194244f, 0.194150f, 0.194056f, 0.193962f, 0.193868f, 0.193774f, 0.193680f,
- 0.193586f, 0.193492f, 0.193397f, 0.193303f, 0.193209f, 0.193115f, 0.193021f, 0.192927f,
- 0.192833f, 0.192739f, 0.192645f, 0.192551f, 0.192457f, 0.192363f, 0.192269f, 0.192174f,
- 0.192080f, 0.191986f, 0.191892f, 0.191798f, 0.191704f, 0.191610f, 0.191516f, 0.191422f,
- 0.191328f, 0.191234f, 0.191139f, 0.191045f, 0.190951f, 0.190857f, 0.190763f, 0.190669f,
- 0.190575f, 0.190481f, 0.190387f, 0.190292f, 0.190198f, 0.190104f, 0.190010f, 0.189916f,
- 0.189822f, 0.189728f, 0.189634f, 0.189539f, 0.189445f, 0.189351f, 0.189257f, 0.189163f,
- 0.189069f, 0.188975f, 0.188880f, 0.188786f, 0.188692f, 0.188598f, 0.188504f, 0.188410f,
- 0.188315f, 0.188221f, 0.188127f, 0.188033f, 0.187939f, 0.187845f, 0.187750f, 0.187656f,
- 0.187562f, 0.187468f, 0.187374f, 0.187280f, 0.187185f, 0.187091f, 0.186997f, 0.186903f,
- 0.186809f, 0.186715f, 0.186620f, 0.186526f, 0.186432f, 0.186338f, 0.186244f, 0.186149f,
- 0.186055f, 0.185961f, 0.185867f, 0.185773f, 0.185678f, 0.185584f, 0.185490f, 0.185396f,
- 0.185301f, 0.185207f, 0.185113f, 0.185019f, 0.184925f, 0.184830f, 0.184736f, 0.184642f,
- 0.184548f, 0.184454f, 0.184359f, 0.184265f, 0.184171f, 0.184077f, 0.183982f, 0.183888f,
- 0.183794f, 0.183700f, 0.183605f, 0.183511f, 0.183417f, 0.183323f, 0.183228f, 0.183134f,
- 0.183040f, 0.182946f, 0.182851f, 0.182757f, 0.182663f, 0.182569f, 0.182474f, 0.182380f,
- 0.182286f, 0.182192f, 0.182097f, 0.182003f, 0.181909f, 0.181814f, 0.181720f, 0.181626f,
- 0.181532f, 0.181437f, 0.181343f, 0.181249f, 0.181154f, 0.181060f, 0.180966f, 0.180872f,
- 0.180777f, 0.180683f, 0.180589f, 0.180494f, 0.180400f, 0.180306f, 0.180212f, 0.180117f,
- 0.180023f, 0.179929f, 0.179834f, 0.179740f, 0.179646f, 0.179551f, 0.179457f, 0.179363f,
- 0.179268f, 0.179174f, 0.179080f, 0.178985f, 0.178891f, 0.178797f, 0.178702f, 0.178608f,
- 0.178514f, 0.178419f, 0.178325f, 0.178231f, 0.178136f, 0.178042f, 0.177948f, 0.177853f,
- 0.177759f, 0.177665f, 0.177570f, 0.177476f, 0.177382f, 0.177287f, 0.177193f, 0.177099f,
- 0.177004f, 0.176910f, 0.176815f, 0.176721f, 0.176627f, 0.176532f, 0.176438f, 0.176344f,
- 0.176249f, 0.176155f, 0.176061f, 0.175966f, 0.175872f, 0.175777f, 0.175683f, 0.175589f,
- 0.175494f, 0.175400f, 0.175305f, 0.175211f, 0.175117f, 0.175022f, 0.174928f, 0.174834f,
- 0.174739f, 0.174645f, 0.174550f, 0.174456f, 0.174362f, 0.174267f, 0.174173f, 0.174078f,
- 0.173984f, 0.173889f, 0.173795f, 0.173701f, 0.173606f, 0.173512f, 0.173417f, 0.173323f,
- 0.173229f, 0.173134f, 0.173040f, 0.172945f, 0.172851f, 0.172756f, 0.172662f, 0.172568f,
- 0.172473f, 0.172379f, 0.172284f, 0.172190f, 0.172095f, 0.172001f, 0.171906f, 0.171812f,
- 0.171718f, 0.171623f, 0.171529f, 0.171434f, 0.171340f, 0.171245f, 0.171151f, 0.171056f,
- 0.170962f, 0.170867f, 0.170773f, 0.170678f, 0.170584f, 0.170490f, 0.170395f, 0.170301f,
- 0.170206f, 0.170112f, 0.170017f, 0.169923f, 0.169828f, 0.169734f, 0.169639f, 0.169545f,
- 0.169450f, 0.169356f, 0.169261f, 0.169167f, 0.169072f, 0.168978f, 0.168883f, 0.168789f,
- 0.168694f, 0.168600f, 0.168505f, 0.168411f, 0.168316f, 0.168222f, 0.168127f, 0.168033f,
- 0.167938f, 0.167844f, 0.167749f, 0.167655f, 0.167560f, 0.167466f, 0.167371f, 0.167277f,
- 0.167182f, 0.167088f, 0.166993f, 0.166899f, 0.166804f, 0.166710f, 0.166615f, 0.166520f,
- 0.166426f, 0.166331f, 0.166237f, 0.166142f, 0.166048f, 0.165953f, 0.165859f, 0.165764f,
- 0.165670f, 0.165575f, 0.165480f, 0.165386f, 0.165291f, 0.165197f, 0.165102f, 0.165008f,
- 0.164913f, 0.164819f, 0.164724f, 0.164629f, 0.164535f, 0.164440f, 0.164346f, 0.164251f,
- 0.164157f, 0.164062f, 0.163967f, 0.163873f, 0.163778f, 0.163684f, 0.163589f, 0.163495f,
- 0.163400f, 0.163305f, 0.163211f, 0.163116f, 0.163022f, 0.162927f, 0.162832f, 0.162738f,
- 0.162643f, 0.162549f, 0.162454f, 0.162359f, 0.162265f, 0.162170f, 0.162076f, 0.161981f,
- 0.161886f, 0.161792f, 0.161697f, 0.161603f, 0.161508f, 0.161413f, 0.161319f, 0.161224f,
- 0.161129f, 0.161035f, 0.160940f, 0.160846f, 0.160751f, 0.160656f, 0.160562f, 0.160467f,
- 0.160372f, 0.160278f, 0.160183f, 0.160089f, 0.159994f, 0.159899f, 0.159805f, 0.159710f,
- 0.159615f, 0.159521f, 0.159426f, 0.159331f, 0.159237f, 0.159142f, 0.159047f, 0.158953f,
- 0.158858f, 0.158763f, 0.158669f, 0.158574f, 0.158480f, 0.158385f, 0.158290f, 0.158196f,
- 0.158101f, 0.158006f, 0.157912f, 0.157817f, 0.157722f, 0.157627f, 0.157533f, 0.157438f,
- 0.157343f, 0.157249f, 0.157154f, 0.157059f, 0.156965f, 0.156870f, 0.156775f, 0.156681f,
- 0.156586f, 0.156491f, 0.156397f, 0.156302f, 0.156207f, 0.156112f, 0.156018f, 0.155923f,
- 0.155828f, 0.155734f, 0.155639f, 0.155544f, 0.155450f, 0.155355f, 0.155260f, 0.155165f,
- 0.155071f, 0.154976f, 0.154881f, 0.154787f, 0.154692f, 0.154597f, 0.154502f, 0.154408f,
- 0.154313f, 0.154218f, 0.154124f, 0.154029f, 0.153934f, 0.153839f, 0.153745f, 0.153650f,
- 0.153555f, 0.153460f, 0.153366f, 0.153271f, 0.153176f, 0.153081f, 0.152987f, 0.152892f,
- 0.152797f, 0.152702f, 0.152608f, 0.152513f, 0.152418f, 0.152323f, 0.152229f, 0.152134f,
- 0.152039f, 0.151944f, 0.151850f, 0.151755f, 0.151660f, 0.151565f, 0.151471f, 0.151376f,
- 0.151281f, 0.151186f, 0.151092f, 0.150997f, 0.150902f, 0.150807f, 0.150712f, 0.150618f,
- 0.150523f, 0.150428f, 0.150333f, 0.150238f, 0.150144f, 0.150049f, 0.149954f, 0.149859f,
- 0.149765f, 0.149670f, 0.149575f, 0.149480f, 0.149385f, 0.149291f, 0.149196f, 0.149101f,
- 0.149006f, 0.148911f, 0.148817f, 0.148722f, 0.148627f, 0.148532f, 0.148437f, 0.148342f,
- 0.148248f, 0.148153f, 0.148058f, 0.147963f, 0.147868f, 0.147774f, 0.147679f, 0.147584f,
- 0.147489f, 0.147394f, 0.147299f, 0.147205f, 0.147110f, 0.147015f, 0.146920f, 0.146825f,
- 0.146730f, 0.146636f, 0.146541f, 0.146446f, 0.146351f, 0.146256f, 0.146161f, 0.146067f,
- 0.145972f, 0.145877f, 0.145782f, 0.145687f, 0.145592f, 0.145497f, 0.145403f, 0.145308f,
- 0.145213f, 0.145118f, 0.145023f, 0.144928f, 0.144833f, 0.144739f, 0.144644f, 0.144549f,
- 0.144454f, 0.144359f, 0.144264f, 0.144169f, 0.144075f, 0.143980f, 0.143885f, 0.143790f,
- 0.143695f, 0.143600f, 0.143505f, 0.143410f, 0.143316f, 0.143221f, 0.143126f, 0.143031f,
- 0.142936f, 0.142841f, 0.142746f, 0.142651f, 0.142556f, 0.142461f, 0.142367f, 0.142272f,
- 0.142177f, 0.142082f, 0.141987f, 0.141892f, 0.141797f, 0.141702f, 0.141607f, 0.141512f,
- 0.141418f, 0.141323f, 0.141228f, 0.141133f, 0.141038f, 0.140943f, 0.140848f, 0.140753f,
- 0.140658f, 0.140563f, 0.140468f, 0.140373f, 0.140279f, 0.140184f, 0.140089f, 0.139994f,
- 0.139899f, 0.139804f, 0.139709f, 0.139614f, 0.139519f, 0.139424f, 0.139329f, 0.139234f,
- 0.139139f, 0.139044f, 0.138949f, 0.138855f, 0.138760f, 0.138665f, 0.138570f, 0.138475f,
- 0.138380f, 0.138285f, 0.138190f, 0.138095f, 0.138000f, 0.137905f, 0.137810f, 0.137715f,
- 0.137620f, 0.137525f, 0.137430f, 0.137335f, 0.137240f, 0.137145f, 0.137050f, 0.136955f,
- 0.136860f, 0.136765f, 0.136670f, 0.136575f, 0.136480f, 0.136386f, 0.136291f, 0.136196f,
- 0.136101f, 0.136006f, 0.135911f, 0.135816f, 0.135721f, 0.135626f, 0.135531f, 0.135436f,
- 0.135341f, 0.135246f, 0.135151f, 0.135056f, 0.134961f, 0.134866f, 0.134771f, 0.134676f,
- 0.134581f, 0.134486f, 0.134391f, 0.134296f, 0.134201f, 0.134106f, 0.134011f, 0.133916f,
- 0.133821f, 0.133726f, 0.133631f, 0.133536f, 0.133441f, 0.133346f, 0.133251f, 0.133156f,
- 0.133061f, 0.132966f, 0.132870f, 0.132775f, 0.132680f, 0.132585f, 0.132490f, 0.132395f,
- 0.132300f, 0.132205f, 0.132110f, 0.132015f, 0.131920f, 0.131825f, 0.131730f, 0.131635f,
- 0.131540f, 0.131445f, 0.131350f, 0.131255f, 0.131160f, 0.131065f, 0.130970f, 0.130875f,
- 0.130780f, 0.130685f, 0.130590f, 0.130495f, 0.130399f, 0.130304f, 0.130209f, 0.130114f,
- 0.130019f, 0.129924f, 0.129829f, 0.129734f, 0.129639f, 0.129544f, 0.129449f, 0.129354f,
- 0.129259f, 0.129164f, 0.129069f, 0.128973f, 0.128878f, 0.128783f, 0.128688f, 0.128593f,
- 0.128498f, 0.128403f, 0.128308f, 0.128213f, 0.128118f, 0.128023f, 0.127928f, 0.127833f,
- 0.127737f, 0.127642f, 0.127547f, 0.127452f, 0.127357f, 0.127262f, 0.127167f, 0.127072f,
- 0.126977f, 0.126882f, 0.126787f, 0.126691f, 0.126596f, 0.126501f, 0.126406f, 0.126311f,
- 0.126216f, 0.126121f, 0.126026f, 0.125931f, 0.125835f, 0.125740f, 0.125645f, 0.125550f,
- 0.125455f, 0.125360f, 0.125265f, 0.125170f, 0.125075f, 0.124979f, 0.124884f, 0.124789f,
- 0.124694f, 0.124599f, 0.124504f, 0.124409f, 0.124314f, 0.124218f, 0.124123f, 0.124028f,
- 0.123933f, 0.123838f, 0.123743f, 0.123648f, 0.123552f, 0.123457f, 0.123362f, 0.123267f,
- 0.123172f, 0.123077f, 0.122982f, 0.122886f, 0.122791f, 0.122696f, 0.122601f, 0.122506f,
- 0.122411f, 0.122316f, 0.122220f, 0.122125f, 0.122030f, 0.121935f, 0.121840f, 0.121745f,
- 0.121649f, 0.121554f, 0.121459f, 0.121364f, 0.121269f, 0.121174f, 0.121078f, 0.120983f,
- 0.120888f, 0.120793f, 0.120698f, 0.120603f, 0.120507f, 0.120412f, 0.120317f, 0.120222f,
- 0.120127f, 0.120032f, 0.119936f, 0.119841f, 0.119746f, 0.119651f, 0.119556f, 0.119460f,
- 0.119365f, 0.119270f, 0.119175f, 0.119080f, 0.118984f, 0.118889f, 0.118794f, 0.118699f,
- 0.118604f, 0.118508f, 0.118413f, 0.118318f, 0.118223f, 0.118128f, 0.118032f, 0.117937f,
- 0.117842f, 0.117747f, 0.117652f, 0.117556f, 0.117461f, 0.117366f, 0.117271f, 0.117176f,
- 0.117080f, 0.116985f, 0.116890f, 0.116795f, 0.116700f, 0.116604f, 0.116509f, 0.116414f,
- 0.116319f, 0.116223f, 0.116128f, 0.116033f, 0.115938f, 0.115842f, 0.115747f, 0.115652f,
- 0.115557f, 0.115462f, 0.115366f, 0.115271f, 0.115176f, 0.115081f, 0.114985f, 0.114890f,
- 0.114795f, 0.114700f, 0.114604f, 0.114509f, 0.114414f, 0.114319f, 0.114223f, 0.114128f,
- 0.114033f, 0.113938f, 0.113842f, 0.113747f, 0.113652f, 0.113557f, 0.113461f, 0.113366f,
- 0.113271f, 0.113176f, 0.113080f, 0.112985f, 0.112890f, 0.112795f, 0.112699f, 0.112604f,
- 0.112509f, 0.112414f, 0.112318f, 0.112223f, 0.112128f, 0.112033f, 0.111937f, 0.111842f,
- 0.111747f, 0.111651f, 0.111556f, 0.111461f, 0.111366f, 0.111270f, 0.111175f, 0.111080f,
- 0.110984f, 0.110889f, 0.110794f, 0.110699f, 0.110603f, 0.110508f, 0.110413f, 0.110317f,
- 0.110222f, 0.110127f, 0.110032f, 0.109936f, 0.109841f, 0.109746f, 0.109650f, 0.109555f,
- 0.109460f, 0.109365f, 0.109269f, 0.109174f, 0.109079f, 0.108983f, 0.108888f, 0.108793f,
- 0.108697f, 0.108602f, 0.108507f, 0.108412f, 0.108316f, 0.108221f, 0.108126f, 0.108030f,
- 0.107935f, 0.107840f, 0.107744f, 0.107649f, 0.107554f, 0.107458f, 0.107363f, 0.107268f,
- 0.107172f, 0.107077f, 0.106982f, 0.106886f, 0.106791f, 0.106696f, 0.106600f, 0.106505f,
- 0.106410f, 0.106314f, 0.106219f, 0.106124f, 0.106028f, 0.105933f, 0.105838f, 0.105742f,
- 0.105647f, 0.105552f, 0.105456f, 0.105361f, 0.105266f, 0.105170f, 0.105075f, 0.104980f,
- 0.104884f, 0.104789f, 0.104694f, 0.104598f, 0.104503f, 0.104408f, 0.104312f, 0.104217f,
- 0.104122f, 0.104026f, 0.103931f, 0.103836f, 0.103740f, 0.103645f, 0.103550f, 0.103454f,
- 0.103359f, 0.103263f, 0.103168f, 0.103073f, 0.102977f, 0.102882f, 0.102787f, 0.102691f,
- 0.102596f, 0.102500f, 0.102405f, 0.102310f, 0.102214f, 0.102119f, 0.102024f, 0.101928f,
- 0.101833f, 0.101738f, 0.101642f, 0.101547f, 0.101451f, 0.101356f, 0.101261f, 0.101165f,
- 0.101070f, 0.100974f, 0.100879f, 0.100784f, 0.100688f, 0.100593f, 0.100498f, 0.100402f,
- 0.100307f, 0.100211f, 0.100116f, 0.100021f, 0.099925f, 0.099830f, 0.099734f, 0.099639f,
- 0.099544f, 0.099448f, 0.099353f, 0.099257f, 0.099162f, 0.099067f, 0.098971f, 0.098876f,
- 0.098780f, 0.098685f, 0.098590f, 0.098494f, 0.098399f, 0.098303f, 0.098208f, 0.098113f,
- 0.098017f, 0.097922f, 0.097826f, 0.097731f, 0.097635f, 0.097540f, 0.097445f, 0.097349f,
- 0.097254f, 0.097158f, 0.097063f, 0.096968f, 0.096872f, 0.096777f, 0.096681f, 0.096586f,
- 0.096490f, 0.096395f, 0.096300f, 0.096204f, 0.096109f, 0.096013f, 0.095918f, 0.095822f,
- 0.095727f, 0.095632f, 0.095536f, 0.095441f, 0.095345f, 0.095250f, 0.095154f, 0.095059f,
- 0.094963f, 0.094868f, 0.094773f, 0.094677f, 0.094582f, 0.094486f, 0.094391f, 0.094295f,
- 0.094200f, 0.094104f, 0.094009f, 0.093914f, 0.093818f, 0.093723f, 0.093627f, 0.093532f,
- 0.093436f, 0.093341f, 0.093245f, 0.093150f, 0.093055f, 0.092959f, 0.092864f, 0.092768f,
- 0.092673f, 0.092577f, 0.092482f, 0.092386f, 0.092291f, 0.092195f, 0.092100f, 0.092004f,
- 0.091909f, 0.091813f, 0.091718f, 0.091623f, 0.091527f, 0.091432f, 0.091336f, 0.091241f,
- 0.091145f, 0.091050f, 0.090954f, 0.090859f, 0.090763f, 0.090668f, 0.090572f, 0.090477f,
- 0.090381f, 0.090286f, 0.090190f, 0.090095f, 0.089999f, 0.089904f, 0.089808f, 0.089713f,
- 0.089617f, 0.089522f, 0.089427f, 0.089331f, 0.089236f, 0.089140f, 0.089045f, 0.088949f,
- 0.088854f, 0.088758f, 0.088663f, 0.088567f, 0.088472f, 0.088376f, 0.088281f, 0.088185f,
- 0.088090f, 0.087994f, 0.087899f, 0.087803f, 0.087708f, 0.087612f, 0.087517f, 0.087421f,
- 0.087326f, 0.087230f, 0.087135f, 0.087039f, 0.086943f, 0.086848f, 0.086752f, 0.086657f,
- 0.086561f, 0.086466f, 0.086370f, 0.086275f, 0.086179f, 0.086084f, 0.085988f, 0.085893f,
- 0.085797f, 0.085702f, 0.085606f, 0.085511f, 0.085415f, 0.085320f, 0.085224f, 0.085129f,
- 0.085033f, 0.084938f, 0.084842f, 0.084747f, 0.084651f, 0.084555f, 0.084460f, 0.084364f,
- 0.084269f, 0.084173f, 0.084078f, 0.083982f, 0.083887f, 0.083791f, 0.083696f, 0.083600f,
- 0.083505f, 0.083409f, 0.083314f, 0.083218f, 0.083122f, 0.083027f, 0.082931f, 0.082836f,
- 0.082740f, 0.082645f, 0.082549f, 0.082454f, 0.082358f, 0.082263f, 0.082167f, 0.082071f,
- 0.081976f, 0.081880f, 0.081785f, 0.081689f, 0.081594f, 0.081498f, 0.081403f, 0.081307f,
- 0.081211f, 0.081116f, 0.081020f, 0.080925f, 0.080829f, 0.080734f, 0.080638f, 0.080543f,
- 0.080447f, 0.080351f, 0.080256f, 0.080160f, 0.080065f, 0.079969f, 0.079874f, 0.079778f,
- 0.079682f, 0.079587f, 0.079491f, 0.079396f, 0.079300f, 0.079205f, 0.079109f, 0.079013f,
- 0.078918f, 0.078822f, 0.078727f, 0.078631f, 0.078536f, 0.078440f, 0.078344f, 0.078249f,
- 0.078153f, 0.078058f, 0.077962f, 0.077866f, 0.077771f, 0.077675f, 0.077580f, 0.077484f,
- 0.077389f, 0.077293f, 0.077197f, 0.077102f, 0.077006f, 0.076911f, 0.076815f, 0.076719f,
- 0.076624f, 0.076528f, 0.076433f, 0.076337f, 0.076241f, 0.076146f, 0.076050f, 0.075955f,
- 0.075859f, 0.075764f, 0.075668f, 0.075572f, 0.075477f, 0.075381f, 0.075286f, 0.075190f,
- 0.075094f, 0.074999f, 0.074903f, 0.074807f, 0.074712f, 0.074616f, 0.074521f, 0.074425f,
- 0.074329f, 0.074234f, 0.074138f, 0.074043f, 0.073947f, 0.073851f, 0.073756f, 0.073660f,
- 0.073565f, 0.073469f, 0.073373f, 0.073278f, 0.073182f, 0.073086f, 0.072991f, 0.072895f,
- 0.072800f, 0.072704f, 0.072608f, 0.072513f, 0.072417f, 0.072322f, 0.072226f, 0.072130f,
- 0.072035f, 0.071939f, 0.071843f, 0.071748f, 0.071652f, 0.071557f, 0.071461f, 0.071365f,
- 0.071270f, 0.071174f, 0.071078f, 0.070983f, 0.070887f, 0.070791f, 0.070696f, 0.070600f,
- 0.070505f, 0.070409f, 0.070313f, 0.070218f, 0.070122f, 0.070026f, 0.069931f, 0.069835f,
- 0.069739f, 0.069644f, 0.069548f, 0.069453f, 0.069357f, 0.069261f, 0.069166f, 0.069070f,
- 0.068974f, 0.068879f, 0.068783f, 0.068687f, 0.068592f, 0.068496f, 0.068400f, 0.068305f,
- 0.068209f, 0.068113f, 0.068018f, 0.067922f, 0.067827f, 0.067731f, 0.067635f, 0.067540f,
- 0.067444f, 0.067348f, 0.067253f, 0.067157f, 0.067061f, 0.066966f, 0.066870f, 0.066774f,
- 0.066679f, 0.066583f, 0.066487f, 0.066392f, 0.066296f, 0.066200f, 0.066105f, 0.066009f,
- 0.065913f, 0.065818f, 0.065722f, 0.065626f, 0.065531f, 0.065435f, 0.065339f, 0.065244f,
- 0.065148f, 0.065052f, 0.064957f, 0.064861f, 0.064765f, 0.064670f, 0.064574f, 0.064478f,
- 0.064383f, 0.064287f, 0.064191f, 0.064096f, 0.064000f, 0.063904f, 0.063809f, 0.063713f,
- 0.063617f, 0.063522f, 0.063426f, 0.063330f, 0.063234f, 0.063139f, 0.063043f, 0.062947f,
- 0.062852f, 0.062756f, 0.062660f, 0.062565f, 0.062469f, 0.062373f, 0.062278f, 0.062182f,
- 0.062086f, 0.061991f, 0.061895f, 0.061799f, 0.061704f, 0.061608f, 0.061512f, 0.061416f,
- 0.061321f, 0.061225f, 0.061129f, 0.061034f, 0.060938f, 0.060842f, 0.060747f, 0.060651f,
- 0.060555f, 0.060459f, 0.060364f, 0.060268f, 0.060172f, 0.060077f, 0.059981f, 0.059885f,
- 0.059790f, 0.059694f, 0.059598f, 0.059502f, 0.059407f, 0.059311f, 0.059215f, 0.059120f,
- 0.059024f, 0.058928f, 0.058833f, 0.058737f, 0.058641f, 0.058545f, 0.058450f, 0.058354f,
- 0.058258f, 0.058163f, 0.058067f, 0.057971f, 0.057875f, 0.057780f, 0.057684f, 0.057588f,
- 0.057493f, 0.057397f, 0.057301f, 0.057205f, 0.057110f, 0.057014f, 0.056918f, 0.056823f,
- 0.056727f, 0.056631f, 0.056535f, 0.056440f, 0.056344f, 0.056248f, 0.056152f, 0.056057f,
- 0.055961f, 0.055865f, 0.055770f, 0.055674f, 0.055578f, 0.055482f, 0.055387f, 0.055291f,
- 0.055195f, 0.055100f, 0.055004f, 0.054908f, 0.054812f, 0.054717f, 0.054621f, 0.054525f,
- 0.054429f, 0.054334f, 0.054238f, 0.054142f, 0.054046f, 0.053951f, 0.053855f, 0.053759f,
- 0.053664f, 0.053568f, 0.053472f, 0.053376f, 0.053281f, 0.053185f, 0.053089f, 0.052993f,
- 0.052898f, 0.052802f, 0.052706f, 0.052610f, 0.052515f, 0.052419f, 0.052323f, 0.052227f,
- 0.052132f, 0.052036f, 0.051940f, 0.051844f, 0.051749f, 0.051653f, 0.051557f, 0.051461f,
- 0.051366f, 0.051270f, 0.051174f, 0.051078f, 0.050983f, 0.050887f, 0.050791f, 0.050696f,
- 0.050600f, 0.050504f, 0.050408f, 0.050312f, 0.050217f, 0.050121f, 0.050025f, 0.049929f,
- 0.049834f, 0.049738f, 0.049642f, 0.049546f, 0.049451f, 0.049355f, 0.049259f, 0.049163f,
- 0.049068f, 0.048972f, 0.048876f, 0.048780f, 0.048685f, 0.048589f, 0.048493f, 0.048397f,
- 0.048302f, 0.048206f, 0.048110f, 0.048014f, 0.047919f, 0.047823f, 0.047727f, 0.047631f,
- 0.047535f, 0.047440f, 0.047344f, 0.047248f, 0.047152f, 0.047057f, 0.046961f, 0.046865f,
- 0.046769f, 0.046674f, 0.046578f, 0.046482f, 0.046386f, 0.046290f, 0.046195f, 0.046099f,
- 0.046003f, 0.045907f, 0.045812f, 0.045716f, 0.045620f, 0.045524f, 0.045429f, 0.045333f,
- 0.045237f, 0.045141f, 0.045045f, 0.044950f, 0.044854f, 0.044758f, 0.044662f, 0.044567f,
- 0.044471f, 0.044375f, 0.044279f, 0.044183f, 0.044088f, 0.043992f, 0.043896f, 0.043800f,
- 0.043705f, 0.043609f, 0.043513f, 0.043417f, 0.043321f, 0.043226f, 0.043130f, 0.043034f,
- 0.042938f, 0.042842f, 0.042747f, 0.042651f, 0.042555f, 0.042459f, 0.042364f, 0.042268f,
- 0.042172f, 0.042076f, 0.041980f, 0.041885f, 0.041789f, 0.041693f, 0.041597f, 0.041501f,
- 0.041406f, 0.041310f, 0.041214f, 0.041118f, 0.041022f, 0.040927f, 0.040831f, 0.040735f,
- 0.040639f, 0.040544f, 0.040448f, 0.040352f, 0.040256f, 0.040160f, 0.040065f, 0.039969f,
- 0.039873f, 0.039777f, 0.039681f, 0.039586f, 0.039490f, 0.039394f, 0.039298f, 0.039202f,
- 0.039107f, 0.039011f, 0.038915f, 0.038819f, 0.038723f, 0.038628f, 0.038532f, 0.038436f,
- 0.038340f, 0.038244f, 0.038149f, 0.038053f, 0.037957f, 0.037861f, 0.037765f, 0.037669f,
- 0.037574f, 0.037478f, 0.037382f, 0.037286f, 0.037190f, 0.037095f, 0.036999f, 0.036903f,
- 0.036807f, 0.036711f, 0.036616f, 0.036520f, 0.036424f, 0.036328f, 0.036232f, 0.036137f,
- 0.036041f, 0.035945f, 0.035849f, 0.035753f, 0.035657f, 0.035562f, 0.035466f, 0.035370f,
- 0.035274f, 0.035178f, 0.035083f, 0.034987f, 0.034891f, 0.034795f, 0.034699f, 0.034604f,
- 0.034508f, 0.034412f, 0.034316f, 0.034220f, 0.034124f, 0.034029f, 0.033933f, 0.033837f,
- 0.033741f, 0.033645f, 0.033550f, 0.033454f, 0.033358f, 0.033262f, 0.033166f, 0.033070f,
- 0.032975f, 0.032879f, 0.032783f, 0.032687f, 0.032591f, 0.032495f, 0.032400f, 0.032304f,
- 0.032208f, 0.032112f, 0.032016f, 0.031921f, 0.031825f, 0.031729f, 0.031633f, 0.031537f,
- 0.031441f, 0.031346f, 0.031250f, 0.031154f, 0.031058f, 0.030962f, 0.030866f, 0.030771f,
- 0.030675f, 0.030579f, 0.030483f, 0.030387f, 0.030291f, 0.030196f, 0.030100f, 0.030004f,
- 0.029908f, 0.029812f, 0.029717f, 0.029621f, 0.029525f, 0.029429f, 0.029333f, 0.029237f,
- 0.029142f, 0.029046f, 0.028950f, 0.028854f, 0.028758f, 0.028662f, 0.028567f, 0.028471f,
- 0.028375f, 0.028279f, 0.028183f, 0.028087f, 0.027991f, 0.027896f, 0.027800f, 0.027704f,
- 0.027608f, 0.027512f, 0.027416f, 0.027321f, 0.027225f, 0.027129f, 0.027033f, 0.026937f,
- 0.026841f, 0.026746f, 0.026650f, 0.026554f, 0.026458f, 0.026362f, 0.026266f, 0.026171f,
- 0.026075f, 0.025979f, 0.025883f, 0.025787f, 0.025691f, 0.025596f, 0.025500f, 0.025404f,
- 0.025308f, 0.025212f, 0.025116f, 0.025020f, 0.024925f, 0.024829f, 0.024733f, 0.024637f,
- 0.024541f, 0.024445f, 0.024350f, 0.024254f, 0.024158f, 0.024062f, 0.023966f, 0.023870f,
- 0.023774f, 0.023679f, 0.023583f, 0.023487f, 0.023391f, 0.023295f, 0.023199f, 0.023104f,
- 0.023008f, 0.022912f, 0.022816f, 0.022720f, 0.022624f, 0.022528f, 0.022433f, 0.022337f,
- 0.022241f, 0.022145f, 0.022049f, 0.021953f, 0.021857f, 0.021762f, 0.021666f, 0.021570f,
- 0.021474f, 0.021378f, 0.021282f, 0.021187f, 0.021091f, 0.020995f, 0.020899f, 0.020803f,
- 0.020707f, 0.020611f, 0.020516f, 0.020420f, 0.020324f, 0.020228f, 0.020132f, 0.020036f,
- 0.019940f, 0.019845f, 0.019749f, 0.019653f, 0.019557f, 0.019461f, 0.019365f, 0.019269f,
- 0.019174f, 0.019078f, 0.018982f, 0.018886f, 0.018790f, 0.018694f, 0.018598f, 0.018503f,
- 0.018407f, 0.018311f, 0.018215f, 0.018119f, 0.018023f, 0.017927f, 0.017832f, 0.017736f,
- 0.017640f, 0.017544f, 0.017448f, 0.017352f, 0.017256f, 0.017161f, 0.017065f, 0.016969f,
- 0.016873f, 0.016777f, 0.016681f, 0.016585f, 0.016490f, 0.016394f, 0.016298f, 0.016202f,
- 0.016106f, 0.016010f, 0.015914f, 0.015819f, 0.015723f, 0.015627f, 0.015531f, 0.015435f,
- 0.015339f, 0.015243f, 0.015147f, 0.015052f, 0.014956f, 0.014860f, 0.014764f, 0.014668f,
- 0.014572f, 0.014476f, 0.014381f, 0.014285f, 0.014189f, 0.014093f, 0.013997f, 0.013901f,
- 0.013805f, 0.013710f, 0.013614f, 0.013518f, 0.013422f, 0.013326f, 0.013230f, 0.013134f,
- 0.013038f, 0.012943f, 0.012847f, 0.012751f, 0.012655f, 0.012559f, 0.012463f, 0.012367f,
- 0.012272f, 0.012176f, 0.012080f, 0.011984f, 0.011888f, 0.011792f, 0.011696f, 0.011600f,
- 0.011505f, 0.011409f, 0.011313f, 0.011217f, 0.011121f, 0.011025f, 0.010929f, 0.010834f,
- 0.010738f, 0.010642f, 0.010546f, 0.010450f, 0.010354f, 0.010258f, 0.010162f, 0.010067f,
- 0.009971f, 0.009875f, 0.009779f, 0.009683f, 0.009587f, 0.009491f, 0.009395f, 0.009300f,
- 0.009204f, 0.009108f, 0.009012f, 0.008916f, 0.008820f, 0.008724f, 0.008629f, 0.008533f,
- 0.008437f, 0.008341f, 0.008245f, 0.008149f, 0.008053f, 0.007957f, 0.007862f, 0.007766f,
- 0.007670f, 0.007574f, 0.007478f, 0.007382f, 0.007286f, 0.007190f, 0.007095f, 0.006999f,
- 0.006903f, 0.006807f, 0.006711f, 0.006615f, 0.006519f, 0.006424f, 0.006328f, 0.006232f,
- 0.006136f, 0.006040f, 0.005944f, 0.005848f, 0.005752f, 0.005657f, 0.005561f, 0.005465f,
- 0.005369f, 0.005273f, 0.005177f, 0.005081f, 0.004985f, 0.004890f, 0.004794f, 0.004698f,
- 0.004602f, 0.004506f, 0.004410f, 0.004314f, 0.004218f, 0.004123f, 0.004027f, 0.003931f,
- 0.003835f, 0.003739f, 0.003643f, 0.003547f, 0.003451f, 0.003356f, 0.003260f, 0.003164f,
- 0.003068f, 0.002972f, 0.002876f, 0.002780f, 0.002684f, 0.002589f, 0.002493f, 0.002397f,
- 0.002301f, 0.002205f, 0.002109f, 0.002013f, 0.001917f, 0.001822f, 0.001726f, 0.001630f,
- 0.001534f, 0.001438f, 0.001342f, 0.001246f, 0.001150f, 0.001055f, 0.000959f, 0.000863f,
- 0.000767f, 0.000671f, 0.000575f, 0.000479f, 0.000383f, 0.000288f, 0.000192f, 0.000096f,
- 0.000000f, 0.000096f, 0.000192f, 0.000288f, 0.000383f, 0.000479f, 0.000575f, 0.000671f,
- 0.000767f, 0.000863f, 0.000959f, 0.001055f, 0.001150f, 0.001246f, 0.001342f, 0.001438f,
- 0.001534f, 0.001630f, 0.001726f, 0.001822f, 0.001917f, 0.002013f, 0.002109f, 0.002205f,
- 0.002301f, 0.002397f, 0.002493f, 0.002589f, 0.002684f, 0.002780f, 0.002876f, 0.002972f,
- 0.003068f, 0.003164f, 0.003260f, 0.003356f, 0.003451f, 0.003547f, 0.003643f, 0.003739f,
- 0.003835f, 0.003931f, 0.004027f, 0.004123f, 0.004218f, 0.004314f, 0.004410f, 0.004506f,
- 0.004602f, 0.004698f, 0.004794f, 0.004890f, 0.004985f, 0.005081f, 0.005177f, 0.005273f,
- 0.005369f, 0.005465f, 0.005561f, 0.005657f, 0.005752f, 0.005848f, 0.005944f, 0.006040f,
- 0.006136f, 0.006232f, 0.006328f, 0.006424f, 0.006519f, 0.006615f, 0.006711f, 0.006807f,
- 0.006903f, 0.006999f, 0.007095f, 0.007190f, 0.007286f, 0.007382f, 0.007478f, 0.007574f,
- 0.007670f, 0.007766f, 0.007862f, 0.007957f, 0.008053f, 0.008149f, 0.008245f, 0.008341f,
- 0.008437f, 0.008533f, 0.008629f, 0.008724f, 0.008820f, 0.008916f, 0.009012f, 0.009108f,
- 0.009204f, 0.009300f, 0.009395f, 0.009491f, 0.009587f, 0.009683f, 0.009779f, 0.009875f,
- 0.009971f, 0.010067f, 0.010162f, 0.010258f, 0.010354f, 0.010450f, 0.010546f, 0.010642f,
- 0.010738f, 0.010834f, 0.010929f, 0.011025f, 0.011121f, 0.011217f, 0.011313f, 0.011409f,
- 0.011505f, 0.011600f, 0.011696f, 0.011792f, 0.011888f, 0.011984f, 0.012080f, 0.012176f,
- 0.012272f, 0.012367f, 0.012463f, 0.012559f, 0.012655f, 0.012751f, 0.012847f, 0.012943f,
- 0.013038f, 0.013134f, 0.013230f, 0.013326f, 0.013422f, 0.013518f, 0.013614f, 0.013710f,
- 0.013805f, 0.013901f, 0.013997f, 0.014093f, 0.014189f, 0.014285f, 0.014381f, 0.014476f,
- 0.014572f, 0.014668f, 0.014764f, 0.014860f, 0.014956f, 0.015052f, 0.015147f, 0.015243f,
- 0.015339f, 0.015435f, 0.015531f, 0.015627f, 0.015723f, 0.015819f, 0.015914f, 0.016010f,
- 0.016106f, 0.016202f, 0.016298f, 0.016394f, 0.016490f, 0.016585f, 0.016681f, 0.016777f,
- 0.016873f, 0.016969f, 0.017065f, 0.017161f, 0.017256f, 0.017352f, 0.017448f, 0.017544f,
- 0.017640f, 0.017736f, 0.017832f, 0.017927f, 0.018023f, 0.018119f, 0.018215f, 0.018311f,
- 0.018407f, 0.018503f, 0.018598f, 0.018694f, 0.018790f, 0.018886f, 0.018982f, 0.019078f,
- 0.019174f, 0.019269f, 0.019365f, 0.019461f, 0.019557f, 0.019653f, 0.019749f, 0.019845f,
- 0.019940f, 0.020036f, 0.020132f, 0.020228f, 0.020324f, 0.020420f, 0.020516f, 0.020611f,
- 0.020707f, 0.020803f, 0.020899f, 0.020995f, 0.021091f, 0.021187f, 0.021282f, 0.021378f,
- 0.021474f, 0.021570f, 0.021666f, 0.021762f, 0.021857f, 0.021953f, 0.022049f, 0.022145f,
- 0.022241f, 0.022337f, 0.022433f, 0.022528f, 0.022624f, 0.022720f, 0.022816f, 0.022912f,
- 0.023008f, 0.023104f, 0.023199f, 0.023295f, 0.023391f, 0.023487f, 0.023583f, 0.023679f,
- 0.023774f, 0.023870f, 0.023966f, 0.024062f, 0.024158f, 0.024254f, 0.024350f, 0.024445f,
- 0.024541f, 0.024637f, 0.024733f, 0.024829f, 0.024925f, 0.025020f, 0.025116f, 0.025212f,
- 0.025308f, 0.025404f, 0.025500f, 0.025596f, 0.025691f, 0.025787f, 0.025883f, 0.025979f,
- 0.026075f, 0.026171f, 0.026266f, 0.026362f, 0.026458f, 0.026554f, 0.026650f, 0.026746f,
- 0.026841f, 0.026937f, 0.027033f, 0.027129f, 0.027225f, 0.027321f, 0.027416f, 0.027512f,
- 0.027608f, 0.027704f, 0.027800f, 0.027896f, 0.027991f, 0.028087f, 0.028183f, 0.028279f,
- 0.028375f, 0.028471f, 0.028567f, 0.028662f, 0.028758f, 0.028854f, 0.028950f, 0.029046f,
- 0.029142f, 0.029237f, 0.029333f, 0.029429f, 0.029525f, 0.029621f, 0.029717f, 0.029812f,
- 0.029908f, 0.030004f, 0.030100f, 0.030196f, 0.030291f, 0.030387f, 0.030483f, 0.030579f,
- 0.030675f, 0.030771f, 0.030866f, 0.030962f, 0.031058f, 0.031154f, 0.031250f, 0.031346f,
- 0.031441f, 0.031537f, 0.031633f, 0.031729f, 0.031825f, 0.031921f, 0.032016f, 0.032112f,
- 0.032208f, 0.032304f, 0.032400f, 0.032495f, 0.032591f, 0.032687f, 0.032783f, 0.032879f,
- 0.032975f, 0.033070f, 0.033166f, 0.033262f, 0.033358f, 0.033454f, 0.033550f, 0.033645f,
- 0.033741f, 0.033837f, 0.033933f, 0.034029f, 0.034124f, 0.034220f, 0.034316f, 0.034412f,
- 0.034508f, 0.034604f, 0.034699f, 0.034795f, 0.034891f, 0.034987f, 0.035083f, 0.035178f,
- 0.035274f, 0.035370f, 0.035466f, 0.035562f, 0.035657f, 0.035753f, 0.035849f, 0.035945f,
- 0.036041f, 0.036137f, 0.036232f, 0.036328f, 0.036424f, 0.036520f, 0.036616f, 0.036711f,
- 0.036807f, 0.036903f, 0.036999f, 0.037095f, 0.037190f, 0.037286f, 0.037382f, 0.037478f,
- 0.037574f, 0.037669f, 0.037765f, 0.037861f, 0.037957f, 0.038053f, 0.038149f, 0.038244f,
- 0.038340f, 0.038436f, 0.038532f, 0.038628f, 0.038723f, 0.038819f, 0.038915f, 0.039011f,
- 0.039107f, 0.039202f, 0.039298f, 0.039394f, 0.039490f, 0.039586f, 0.039681f, 0.039777f,
- 0.039873f, 0.039969f, 0.040065f, 0.040160f, 0.040256f, 0.040352f, 0.040448f, 0.040544f,
- 0.040639f, 0.040735f, 0.040831f, 0.040927f, 0.041022f, 0.041118f, 0.041214f, 0.041310f,
- 0.041406f, 0.041501f, 0.041597f, 0.041693f, 0.041789f, 0.041885f, 0.041980f, 0.042076f,
- 0.042172f, 0.042268f, 0.042364f, 0.042459f, 0.042555f, 0.042651f, 0.042747f, 0.042842f,
- 0.042938f, 0.043034f, 0.043130f, 0.043226f, 0.043321f, 0.043417f, 0.043513f, 0.043609f,
- 0.043705f, 0.043800f, 0.043896f, 0.043992f, 0.044088f, 0.044183f, 0.044279f, 0.044375f,
- 0.044471f, 0.044567f, 0.044662f, 0.044758f, 0.044854f, 0.044950f, 0.045045f, 0.045141f,
- 0.045237f, 0.045333f, 0.045429f, 0.045524f, 0.045620f, 0.045716f, 0.045812f, 0.045907f,
- 0.046003f, 0.046099f, 0.046195f, 0.046290f, 0.046386f, 0.046482f, 0.046578f, 0.046674f,
- 0.046769f, 0.046865f, 0.046961f, 0.047057f, 0.047152f, 0.047248f, 0.047344f, 0.047440f,
- 0.047535f, 0.047631f, 0.047727f, 0.047823f, 0.047919f, 0.048014f, 0.048110f, 0.048206f,
- 0.048302f, 0.048397f, 0.048493f, 0.048589f, 0.048685f, 0.048780f, 0.048876f, 0.048972f,
- 0.049068f, 0.049163f, 0.049259f, 0.049355f, 0.049451f, 0.049546f, 0.049642f, 0.049738f,
- 0.049834f, 0.049929f, 0.050025f, 0.050121f, 0.050217f, 0.050312f, 0.050408f, 0.050504f,
- 0.050600f, 0.050696f, 0.050791f, 0.050887f, 0.050983f, 0.051078f, 0.051174f, 0.051270f,
- 0.051366f, 0.051461f, 0.051557f, 0.051653f, 0.051749f, 0.051844f, 0.051940f, 0.052036f,
- 0.052132f, 0.052227f, 0.052323f, 0.052419f, 0.052515f, 0.052610f, 0.052706f, 0.052802f,
- 0.052898f, 0.052993f, 0.053089f, 0.053185f, 0.053281f, 0.053376f, 0.053472f, 0.053568f,
- 0.053664f, 0.053759f, 0.053855f, 0.053951f, 0.054046f, 0.054142f, 0.054238f, 0.054334f,
- 0.054429f, 0.054525f, 0.054621f, 0.054717f, 0.054812f, 0.054908f, 0.055004f, 0.055100f,
- 0.055195f, 0.055291f, 0.055387f, 0.055482f, 0.055578f, 0.055674f, 0.055770f, 0.055865f,
- 0.055961f, 0.056057f, 0.056152f, 0.056248f, 0.056344f, 0.056440f, 0.056535f, 0.056631f,
- 0.056727f, 0.056823f, 0.056918f, 0.057014f, 0.057110f, 0.057205f, 0.057301f, 0.057397f,
- 0.057493f, 0.057588f, 0.057684f, 0.057780f, 0.057875f, 0.057971f, 0.058067f, 0.058163f,
- 0.058258f, 0.058354f, 0.058450f, 0.058545f, 0.058641f, 0.058737f, 0.058833f, 0.058928f,
- 0.059024f, 0.059120f, 0.059215f, 0.059311f, 0.059407f, 0.059502f, 0.059598f, 0.059694f,
- 0.059790f, 0.059885f, 0.059981f, 0.060077f, 0.060172f, 0.060268f, 0.060364f, 0.060459f,
- 0.060555f, 0.060651f, 0.060747f, 0.060842f, 0.060938f, 0.061034f, 0.061129f, 0.061225f,
- 0.061321f, 0.061416f, 0.061512f, 0.061608f, 0.061704f, 0.061799f, 0.061895f, 0.061991f,
- 0.062086f, 0.062182f, 0.062278f, 0.062373f, 0.062469f, 0.062565f, 0.062660f, 0.062756f,
- 0.062852f, 0.062947f, 0.063043f, 0.063139f, 0.063234f, 0.063330f, 0.063426f, 0.063522f,
- 0.063617f, 0.063713f, 0.063809f, 0.063904f, 0.064000f, 0.064096f, 0.064191f, 0.064287f,
- 0.064383f, 0.064478f, 0.064574f, 0.064670f, 0.064765f, 0.064861f, 0.064957f, 0.065052f,
- 0.065148f, 0.065244f, 0.065339f, 0.065435f, 0.065531f, 0.065626f, 0.065722f, 0.065818f,
- 0.065913f, 0.066009f, 0.066105f, 0.066200f, 0.066296f, 0.066392f, 0.066487f, 0.066583f,
- 0.066679f, 0.066774f, 0.066870f, 0.066966f, 0.067061f, 0.067157f, 0.067253f, 0.067348f,
- 0.067444f, 0.067540f, 0.067635f, 0.067731f, 0.067827f, 0.067922f, 0.068018f, 0.068113f,
- 0.068209f, 0.068305f, 0.068400f, 0.068496f, 0.068592f, 0.068687f, 0.068783f, 0.068879f,
- 0.068974f, 0.069070f, 0.069166f, 0.069261f, 0.069357f, 0.069453f, 0.069548f, 0.069644f,
- 0.069739f, 0.069835f, 0.069931f, 0.070026f, 0.070122f, 0.070218f, 0.070313f, 0.070409f,
- 0.070505f, 0.070600f, 0.070696f, 0.070791f, 0.070887f, 0.070983f, 0.071078f, 0.071174f,
- 0.071270f, 0.071365f, 0.071461f, 0.071557f, 0.071652f, 0.071748f, 0.071843f, 0.071939f,
- 0.072035f, 0.072130f, 0.072226f, 0.072322f, 0.072417f, 0.072513f, 0.072608f, 0.072704f,
- 0.072800f, 0.072895f, 0.072991f, 0.073086f, 0.073182f, 0.073278f, 0.073373f, 0.073469f,
- 0.073565f, 0.073660f, 0.073756f, 0.073851f, 0.073947f, 0.074043f, 0.074138f, 0.074234f,
- 0.074329f, 0.074425f, 0.074521f, 0.074616f, 0.074712f, 0.074807f, 0.074903f, 0.074999f,
- 0.075094f, 0.075190f, 0.075286f, 0.075381f, 0.075477f, 0.075572f, 0.075668f, 0.075764f,
- 0.075859f, 0.075955f, 0.076050f, 0.076146f, 0.076241f, 0.076337f, 0.076433f, 0.076528f,
- 0.076624f, 0.076719f, 0.076815f, 0.076911f, 0.077006f, 0.077102f, 0.077197f, 0.077293f,
- 0.077389f, 0.077484f, 0.077580f, 0.077675f, 0.077771f, 0.077866f, 0.077962f, 0.078058f,
- 0.078153f, 0.078249f, 0.078344f, 0.078440f, 0.078536f, 0.078631f, 0.078727f, 0.078822f,
- 0.078918f, 0.079013f, 0.079109f, 0.079205f, 0.079300f, 0.079396f, 0.079491f, 0.079587f,
- 0.079682f, 0.079778f, 0.079874f, 0.079969f, 0.080065f, 0.080160f, 0.080256f, 0.080351f,
- 0.080447f, 0.080543f, 0.080638f, 0.080734f, 0.080829f, 0.080925f, 0.081020f, 0.081116f,
- 0.081211f, 0.081307f, 0.081403f, 0.081498f, 0.081594f, 0.081689f, 0.081785f, 0.081880f,
- 0.081976f, 0.082071f, 0.082167f, 0.082263f, 0.082358f, 0.082454f, 0.082549f, 0.082645f,
- 0.082740f, 0.082836f, 0.082931f, 0.083027f, 0.083122f, 0.083218f, 0.083314f, 0.083409f,
- 0.083505f, 0.083600f, 0.083696f, 0.083791f, 0.083887f, 0.083982f, 0.084078f, 0.084173f,
- 0.084269f, 0.084364f, 0.084460f, 0.084555f, 0.084651f, 0.084747f, 0.084842f, 0.084938f,
- 0.085033f, 0.085129f, 0.085224f, 0.085320f, 0.085415f, 0.085511f, 0.085606f, 0.085702f,
- 0.085797f, 0.085893f, 0.085988f, 0.086084f, 0.086179f, 0.086275f, 0.086370f, 0.086466f,
- 0.086561f, 0.086657f, 0.086752f, 0.086848f, 0.086943f, 0.087039f, 0.087135f, 0.087230f,
- 0.087326f, 0.087421f, 0.087517f, 0.087612f, 0.087708f, 0.087803f, 0.087899f, 0.087994f,
- 0.088090f, 0.088185f, 0.088281f, 0.088376f, 0.088472f, 0.088567f, 0.088663f, 0.088758f,
- 0.088854f, 0.088949f, 0.089045f, 0.089140f, 0.089236f, 0.089331f, 0.089427f, 0.089522f,
- 0.089617f, 0.089713f, 0.089808f, 0.089904f, 0.089999f, 0.090095f, 0.090190f, 0.090286f,
- 0.090381f, 0.090477f, 0.090572f, 0.090668f, 0.090763f, 0.090859f, 0.090954f, 0.091050f,
- 0.091145f, 0.091241f, 0.091336f, 0.091432f, 0.091527f, 0.091623f, 0.091718f, 0.091813f,
- 0.091909f, 0.092004f, 0.092100f, 0.092195f, 0.092291f, 0.092386f, 0.092482f, 0.092577f,
- 0.092673f, 0.092768f, 0.092864f, 0.092959f, 0.093055f, 0.093150f, 0.093245f, 0.093341f,
- 0.093436f, 0.093532f, 0.093627f, 0.093723f, 0.093818f, 0.093914f, 0.094009f, 0.094104f,
- 0.094200f, 0.094295f, 0.094391f, 0.094486f, 0.094582f, 0.094677f, 0.094773f, 0.094868f,
- 0.094963f, 0.095059f, 0.095154f, 0.095250f, 0.095345f, 0.095441f, 0.095536f, 0.095632f,
- 0.095727f, 0.095822f, 0.095918f, 0.096013f, 0.096109f, 0.096204f, 0.096300f, 0.096395f,
- 0.096490f, 0.096586f, 0.096681f, 0.096777f, 0.096872f, 0.096968f, 0.097063f, 0.097158f,
- 0.097254f, 0.097349f, 0.097445f, 0.097540f, 0.097635f, 0.097731f, 0.097826f, 0.097922f,
- 0.098017f, 0.098113f, 0.098208f, 0.098303f, 0.098399f, 0.098494f, 0.098590f, 0.098685f,
- 0.098780f, 0.098876f, 0.098971f, 0.099067f, 0.099162f, 0.099257f, 0.099353f, 0.099448f,
- 0.099544f, 0.099639f, 0.099734f, 0.099830f, 0.099925f, 0.100021f, 0.100116f, 0.100211f,
- 0.100307f, 0.100402f, 0.100498f, 0.100593f, 0.100688f, 0.100784f, 0.100879f, 0.100974f,
- 0.101070f, 0.101165f, 0.101261f, 0.101356f, 0.101451f, 0.101547f, 0.101642f, 0.101738f,
- 0.101833f, 0.101928f, 0.102024f, 0.102119f, 0.102214f, 0.102310f, 0.102405f, 0.102500f,
- 0.102596f, 0.102691f, 0.102787f, 0.102882f, 0.102977f, 0.103073f, 0.103168f, 0.103263f,
- 0.103359f, 0.103454f, 0.103550f, 0.103645f, 0.103740f, 0.103836f, 0.103931f, 0.104026f,
- 0.104122f, 0.104217f, 0.104312f, 0.104408f, 0.104503f, 0.104598f, 0.104694f, 0.104789f,
- 0.104884f, 0.104980f, 0.105075f, 0.105170f, 0.105266f, 0.105361f, 0.105456f, 0.105552f,
- 0.105647f, 0.105742f, 0.105838f, 0.105933f, 0.106028f, 0.106124f, 0.106219f, 0.106314f,
- 0.106410f, 0.106505f, 0.106600f, 0.106696f, 0.106791f, 0.106886f, 0.106982f, 0.107077f,
- 0.107172f, 0.107268f, 0.107363f, 0.107458f, 0.107554f, 0.107649f, 0.107744f, 0.107840f,
- 0.107935f, 0.108030f, 0.108126f, 0.108221f, 0.108316f, 0.108412f, 0.108507f, 0.108602f,
- 0.108697f, 0.108793f, 0.108888f, 0.108983f, 0.109079f, 0.109174f, 0.109269f, 0.109365f,
- 0.109460f, 0.109555f, 0.109650f, 0.109746f, 0.109841f, 0.109936f, 0.110032f, 0.110127f,
- 0.110222f, 0.110317f, 0.110413f, 0.110508f, 0.110603f, 0.110699f, 0.110794f, 0.110889f,
- 0.110984f, 0.111080f, 0.111175f, 0.111270f, 0.111366f, 0.111461f, 0.111556f, 0.111651f,
- 0.111747f, 0.111842f, 0.111937f, 0.112033f, 0.112128f, 0.112223f, 0.112318f, 0.112414f,
- 0.112509f, 0.112604f, 0.112699f, 0.112795f, 0.112890f, 0.112985f, 0.113080f, 0.113176f,
- 0.113271f, 0.113366f, 0.113461f, 0.113557f, 0.113652f, 0.113747f, 0.113842f, 0.113938f,
- 0.114033f, 0.114128f, 0.114223f, 0.114319f, 0.114414f, 0.114509f, 0.114604f, 0.114700f,
- 0.114795f, 0.114890f, 0.114985f, 0.115081f, 0.115176f, 0.115271f, 0.115366f, 0.115462f,
- 0.115557f, 0.115652f, 0.115747f, 0.115842f, 0.115938f, 0.116033f, 0.116128f, 0.116223f,
- 0.116319f, 0.116414f, 0.116509f, 0.116604f, 0.116700f, 0.116795f, 0.116890f, 0.116985f,
- 0.117080f, 0.117176f, 0.117271f, 0.117366f, 0.117461f, 0.117556f, 0.117652f, 0.117747f,
- 0.117842f, 0.117937f, 0.118032f, 0.118128f, 0.118223f, 0.118318f, 0.118413f, 0.118508f,
- 0.118604f, 0.118699f, 0.118794f, 0.118889f, 0.118984f, 0.119080f, 0.119175f, 0.119270f,
- 0.119365f, 0.119460f, 0.119556f, 0.119651f, 0.119746f, 0.119841f, 0.119936f, 0.120032f,
- 0.120127f, 0.120222f, 0.120317f, 0.120412f, 0.120507f, 0.120603f, 0.120698f, 0.120793f,
- 0.120888f, 0.120983f, 0.121078f, 0.121174f, 0.121269f, 0.121364f, 0.121459f, 0.121554f,
- 0.121649f, 0.121745f, 0.121840f, 0.121935f, 0.122030f, 0.122125f, 0.122220f, 0.122316f,
- 0.122411f, 0.122506f, 0.122601f, 0.122696f, 0.122791f, 0.122886f, 0.122982f, 0.123077f,
- 0.123172f, 0.123267f, 0.123362f, 0.123457f, 0.123552f, 0.123648f, 0.123743f, 0.123838f,
- 0.123933f, 0.124028f, 0.124123f, 0.124218f, 0.124314f, 0.124409f, 0.124504f, 0.124599f,
- 0.124694f, 0.124789f, 0.124884f, 0.124979f, 0.125075f, 0.125170f, 0.125265f, 0.125360f,
- 0.125455f, 0.125550f, 0.125645f, 0.125740f, 0.125835f, 0.125931f, 0.126026f, 0.126121f,
- 0.126216f, 0.126311f, 0.126406f, 0.126501f, 0.126596f, 0.126691f, 0.126787f, 0.126882f,
- 0.126977f, 0.127072f, 0.127167f, 0.127262f, 0.127357f, 0.127452f, 0.127547f, 0.127642f,
- 0.127737f, 0.127833f, 0.127928f, 0.128023f, 0.128118f, 0.128213f, 0.128308f, 0.128403f,
- 0.128498f, 0.128593f, 0.128688f, 0.128783f, 0.128878f, 0.128973f, 0.129069f, 0.129164f,
- 0.129259f, 0.129354f, 0.129449f, 0.129544f, 0.129639f, 0.129734f, 0.129829f, 0.129924f,
- 0.130019f, 0.130114f, 0.130209f, 0.130304f, 0.130399f, 0.130495f, 0.130590f, 0.130685f,
- 0.130780f, 0.130875f, 0.130970f, 0.131065f, 0.131160f, 0.131255f, 0.131350f, 0.131445f,
- 0.131540f, 0.131635f, 0.131730f, 0.131825f, 0.131920f, 0.132015f, 0.132110f, 0.132205f,
- 0.132300f, 0.132395f, 0.132490f, 0.132585f, 0.132680f, 0.132775f, 0.132870f, 0.132966f,
- 0.133061f, 0.133156f, 0.133251f, 0.133346f, 0.133441f, 0.133536f, 0.133631f, 0.133726f,
- 0.133821f, 0.133916f, 0.134011f, 0.134106f, 0.134201f, 0.134296f, 0.134391f, 0.134486f,
- 0.134581f, 0.134676f, 0.134771f, 0.134866f, 0.134961f, 0.135056f, 0.135151f, 0.135246f,
- 0.135341f, 0.135436f, 0.135531f, 0.135626f, 0.135721f, 0.135816f, 0.135911f, 0.136006f,
- 0.136101f, 0.136196f, 0.136291f, 0.136386f, 0.136480f, 0.136575f, 0.136670f, 0.136765f,
- 0.136860f, 0.136955f, 0.137050f, 0.137145f, 0.137240f, 0.137335f, 0.137430f, 0.137525f,
- 0.137620f, 0.137715f, 0.137810f, 0.137905f, 0.138000f, 0.138095f, 0.138190f, 0.138285f,
- 0.138380f, 0.138475f, 0.138570f, 0.138665f, 0.138760f, 0.138855f, 0.138949f, 0.139044f,
- 0.139139f, 0.139234f, 0.139329f, 0.139424f, 0.139519f, 0.139614f, 0.139709f, 0.139804f,
- 0.139899f, 0.139994f, 0.140089f, 0.140184f, 0.140279f, 0.140373f, 0.140468f, 0.140563f,
- 0.140658f, 0.140753f, 0.140848f, 0.140943f, 0.141038f, 0.141133f, 0.141228f, 0.141323f,
- 0.141418f, 0.141512f, 0.141607f, 0.141702f, 0.141797f, 0.141892f, 0.141987f, 0.142082f,
- 0.142177f, 0.142272f, 0.142367f, 0.142461f, 0.142556f, 0.142651f, 0.142746f, 0.142841f,
- 0.142936f, 0.143031f, 0.143126f, 0.143221f, 0.143316f, 0.143410f, 0.143505f, 0.143600f,
- 0.143695f, 0.143790f, 0.143885f, 0.143980f, 0.144075f, 0.144169f, 0.144264f, 0.144359f,
- 0.144454f, 0.144549f, 0.144644f, 0.144739f, 0.144833f, 0.144928f, 0.145023f, 0.145118f,
- 0.145213f, 0.145308f, 0.145403f, 0.145497f, 0.145592f, 0.145687f, 0.145782f, 0.145877f,
- 0.145972f, 0.146067f, 0.146161f, 0.146256f, 0.146351f, 0.146446f, 0.146541f, 0.146636f,
- 0.146730f, 0.146825f, 0.146920f, 0.147015f, 0.147110f, 0.147205f, 0.147299f, 0.147394f,
- 0.147489f, 0.147584f, 0.147679f, 0.147774f, 0.147868f, 0.147963f, 0.148058f, 0.148153f,
- 0.148248f, 0.148342f, 0.148437f, 0.148532f, 0.148627f, 0.148722f, 0.148817f, 0.148911f,
- 0.149006f, 0.149101f, 0.149196f, 0.149291f, 0.149385f, 0.149480f, 0.149575f, 0.149670f,
- 0.149765f, 0.149859f, 0.149954f, 0.150049f, 0.150144f, 0.150238f, 0.150333f, 0.150428f,
- 0.150523f, 0.150618f, 0.150712f, 0.150807f, 0.150902f, 0.150997f, 0.151092f, 0.151186f,
- 0.151281f, 0.151376f, 0.151471f, 0.151565f, 0.151660f, 0.151755f, 0.151850f, 0.151944f,
- 0.152039f, 0.152134f, 0.152229f, 0.152323f, 0.152418f, 0.152513f, 0.152608f, 0.152702f,
- 0.152797f, 0.152892f, 0.152987f, 0.153081f, 0.153176f, 0.153271f, 0.153366f, 0.153460f,
- 0.153555f, 0.153650f, 0.153745f, 0.153839f, 0.153934f, 0.154029f, 0.154124f, 0.154218f,
- 0.154313f, 0.154408f, 0.154502f, 0.154597f, 0.154692f, 0.154787f, 0.154881f, 0.154976f,
- 0.155071f, 0.155165f, 0.155260f, 0.155355f, 0.155450f, 0.155544f, 0.155639f, 0.155734f,
- 0.155828f, 0.155923f, 0.156018f, 0.156112f, 0.156207f, 0.156302f, 0.156397f, 0.156491f,
- 0.156586f, 0.156681f, 0.156775f, 0.156870f, 0.156965f, 0.157059f, 0.157154f, 0.157249f,
- 0.157343f, 0.157438f, 0.157533f, 0.157627f, 0.157722f, 0.157817f, 0.157912f, 0.158006f,
- 0.158101f, 0.158196f, 0.158290f, 0.158385f, 0.158480f, 0.158574f, 0.158669f, 0.158763f,
- 0.158858f, 0.158953f, 0.159047f, 0.159142f, 0.159237f, 0.159331f, 0.159426f, 0.159521f,
- 0.159615f, 0.159710f, 0.159805f, 0.159899f, 0.159994f, 0.160089f, 0.160183f, 0.160278f,
- 0.160372f, 0.160467f, 0.160562f, 0.160656f, 0.160751f, 0.160846f, 0.160940f, 0.161035f,
- 0.161129f, 0.161224f, 0.161319f, 0.161413f, 0.161508f, 0.161603f, 0.161697f, 0.161792f,
- 0.161886f, 0.161981f, 0.162076f, 0.162170f, 0.162265f, 0.162359f, 0.162454f, 0.162549f,
- 0.162643f, 0.162738f, 0.162832f, 0.162927f, 0.163022f, 0.163116f, 0.163211f, 0.163305f,
- 0.163400f, 0.163495f, 0.163589f, 0.163684f, 0.163778f, 0.163873f, 0.163967f, 0.164062f,
- 0.164157f, 0.164251f, 0.164346f, 0.164440f, 0.164535f, 0.164629f, 0.164724f, 0.164819f,
- 0.164913f, 0.165008f, 0.165102f, 0.165197f, 0.165291f, 0.165386f, 0.165480f, 0.165575f,
- 0.165670f, 0.165764f, 0.165859f, 0.165953f, 0.166048f, 0.166142f, 0.166237f, 0.166331f,
- 0.166426f, 0.166520f, 0.166615f, 0.166710f, 0.166804f, 0.166899f, 0.166993f, 0.167088f,
- 0.167182f, 0.167277f, 0.167371f, 0.167466f, 0.167560f, 0.167655f, 0.167749f, 0.167844f,
- 0.167938f, 0.168033f, 0.168127f, 0.168222f, 0.168316f, 0.168411f, 0.168505f, 0.168600f,
- 0.168694f, 0.168789f, 0.168883f, 0.168978f, 0.169072f, 0.169167f, 0.169261f, 0.169356f,
- 0.169450f, 0.169545f, 0.169639f, 0.169734f, 0.169828f, 0.169923f, 0.170017f, 0.170112f,
- 0.170206f, 0.170301f, 0.170395f, 0.170490f, 0.170584f, 0.170678f, 0.170773f, 0.170867f,
- 0.170962f, 0.171056f, 0.171151f, 0.171245f, 0.171340f, 0.171434f, 0.171529f, 0.171623f,
- 0.171718f, 0.171812f, 0.171906f, 0.172001f, 0.172095f, 0.172190f, 0.172284f, 0.172379f,
- 0.172473f, 0.172568f, 0.172662f, 0.172756f, 0.172851f, 0.172945f, 0.173040f, 0.173134f,
- 0.173229f, 0.173323f, 0.173417f, 0.173512f, 0.173606f, 0.173701f, 0.173795f, 0.173889f,
- 0.173984f, 0.174078f, 0.174173f, 0.174267f, 0.174362f, 0.174456f, 0.174550f, 0.174645f,
- 0.174739f, 0.174834f, 0.174928f, 0.175022f, 0.175117f, 0.175211f, 0.175305f, 0.175400f,
- 0.175494f, 0.175589f, 0.175683f, 0.175777f, 0.175872f, 0.175966f, 0.176061f, 0.176155f,
- 0.176249f, 0.176344f, 0.176438f, 0.176532f, 0.176627f, 0.176721f, 0.176815f, 0.176910f,
- 0.177004f, 0.177099f, 0.177193f, 0.177287f, 0.177382f, 0.177476f, 0.177570f, 0.177665f,
- 0.177759f, 0.177853f, 0.177948f, 0.178042f, 0.178136f, 0.178231f, 0.178325f, 0.178419f,
- 0.178514f, 0.178608f, 0.178702f, 0.178797f, 0.178891f, 0.178985f, 0.179080f, 0.179174f,
- 0.179268f, 0.179363f, 0.179457f, 0.179551f, 0.179646f, 0.179740f, 0.179834f, 0.179929f,
- 0.180023f, 0.180117f, 0.180212f, 0.180306f, 0.180400f, 0.180494f, 0.180589f, 0.180683f,
- 0.180777f, 0.180872f, 0.180966f, 0.181060f, 0.181154f, 0.181249f, 0.181343f, 0.181437f,
- 0.181532f, 0.181626f, 0.181720f, 0.181814f, 0.181909f, 0.182003f, 0.182097f, 0.182192f,
- 0.182286f, 0.182380f, 0.182474f, 0.182569f, 0.182663f, 0.182757f, 0.182851f, 0.182946f,
- 0.183040f, 0.183134f, 0.183228f, 0.183323f, 0.183417f, 0.183511f, 0.183605f, 0.183700f,
- 0.183794f, 0.183888f, 0.183982f, 0.184077f, 0.184171f, 0.184265f, 0.184359f, 0.184454f,
- 0.184548f, 0.184642f, 0.184736f, 0.184830f, 0.184925f, 0.185019f, 0.185113f, 0.185207f,
- 0.185301f, 0.185396f, 0.185490f, 0.185584f, 0.185678f, 0.185773f, 0.185867f, 0.185961f,
- 0.186055f, 0.186149f, 0.186244f, 0.186338f, 0.186432f, 0.186526f, 0.186620f, 0.186715f,
- 0.186809f, 0.186903f, 0.186997f, 0.187091f, 0.187185f, 0.187280f, 0.187374f, 0.187468f,
- 0.187562f, 0.187656f, 0.187750f, 0.187845f, 0.187939f, 0.188033f, 0.188127f, 0.188221f,
- 0.188315f, 0.188410f, 0.188504f, 0.188598f, 0.188692f, 0.188786f, 0.188880f, 0.188975f,
- 0.189069f, 0.189163f, 0.189257f, 0.189351f, 0.189445f, 0.189539f, 0.189634f, 0.189728f,
- 0.189822f, 0.189916f, 0.190010f, 0.190104f, 0.190198f, 0.190292f, 0.190387f, 0.190481f,
- 0.190575f, 0.190669f, 0.190763f, 0.190857f, 0.190951f, 0.191045f, 0.191139f, 0.191234f,
- 0.191328f, 0.191422f, 0.191516f, 0.191610f, 0.191704f, 0.191798f, 0.191892f, 0.191986f,
- 0.192080f, 0.192174f, 0.192269f, 0.192363f, 0.192457f, 0.192551f, 0.192645f, 0.192739f,
- 0.192833f, 0.192927f, 0.193021f, 0.193115f, 0.193209f, 0.193303f, 0.193397f, 0.193492f,
- 0.193586f, 0.193680f, 0.193774f, 0.193868f, 0.193962f, 0.194056f, 0.194150f, 0.194244f,
- 0.194338f, 0.194432f, 0.194526f, 0.194620f, 0.194714f, 0.194808f, 0.194902f, 0.194996f,
- 0.195090f, 0.195184f, 0.195278f, 0.195372f, 0.195466f, 0.195560f, 0.195654f, 0.195748f,
- 0.195843f, 0.195937f, 0.196031f, 0.196125f, 0.196219f, 0.196313f, 0.196407f, 0.196501f,
- 0.196595f, 0.196689f, 0.196783f, 0.196877f, 0.196971f, 0.197065f, 0.197159f, 0.197253f,
- 0.197347f, 0.197441f, 0.197535f, 0.197629f, 0.197722f, 0.197816f, 0.197910f, 0.198004f,
- 0.198098f, 0.198192f, 0.198286f, 0.198380f, 0.198474f, 0.198568f, 0.198662f, 0.198756f,
- 0.198850f, 0.198944f, 0.199038f, 0.199132f, 0.199226f, 0.199320f, 0.199414f, 0.199508f,
- 0.199602f, 0.199696f, 0.199790f, 0.199884f, 0.199978f, 0.200071f, 0.200165f, 0.200259f,
- 0.200353f, 0.200447f, 0.200541f, 0.200635f, 0.200729f, 0.200823f, 0.200917f, 0.201011f,
- 0.201105f, 0.201199f, 0.201292f, 0.201386f, 0.201480f, 0.201574f, 0.201668f, 0.201762f,
- 0.201856f, 0.201950f, 0.202044f, 0.202138f, 0.202231f, 0.202325f, 0.202419f, 0.202513f,
- 0.202607f, 0.202701f, 0.202795f, 0.202889f, 0.202983f, 0.203076f, 0.203170f, 0.203264f,
- 0.203358f, 0.203452f, 0.203546f, 0.203640f, 0.203734f, 0.203827f, 0.203921f, 0.204015f,
- 0.204109f, 0.204203f, 0.204297f, 0.204391f, 0.204484f, 0.204578f, 0.204672f, 0.204766f,
- 0.204860f, 0.204954f, 0.205047f, 0.205141f, 0.205235f, 0.205329f, 0.205423f, 0.205517f,
- 0.205610f, 0.205704f, 0.205798f, 0.205892f, 0.205986f, 0.206080f, 0.206173f, 0.206267f,
- 0.206361f, 0.206455f, 0.206549f, 0.206642f, 0.206736f, 0.206830f, 0.206924f, 0.207018f,
- 0.207111f, 0.207205f, 0.207299f, 0.207393f, 0.207487f, 0.207580f, 0.207674f, 0.207768f,
- 0.207862f, 0.207955f, 0.208049f, 0.208143f, 0.208237f, 0.208331f, 0.208424f, 0.208518f,
- 0.208612f, 0.208706f, 0.208799f, 0.208893f, 0.208987f, 0.209081f, 0.209174f, 0.209268f,
- 0.209362f, 0.209456f, 0.209549f, 0.209643f, 0.209737f, 0.209831f, 0.209924f, 0.210018f,
- 0.210112f, 0.210206f, 0.210299f, 0.210393f, 0.210487f, 0.210580f, 0.210674f, 0.210768f,
- 0.210862f, 0.210955f, 0.211049f, 0.211143f, 0.211237f, 0.211330f, 0.211424f, 0.211518f,
- 0.211611f, 0.211705f, 0.211799f, 0.211892f, 0.211986f, 0.212080f, 0.212174f, 0.212267f,
- 0.212361f, 0.212455f, 0.212548f, 0.212642f, 0.212736f, 0.212829f, 0.212923f, 0.213017f,
- 0.213110f, 0.213204f, 0.213298f, 0.213391f, 0.213485f, 0.213579f, 0.213672f, 0.213766f,
- 0.213860f, 0.213953f, 0.214047f, 0.214141f, 0.214234f, 0.214328f, 0.214422f, 0.214515f,
- 0.214609f, 0.214702f, 0.214796f, 0.214890f, 0.214983f, 0.215077f, 0.215171f, 0.215264f,
- 0.215358f, 0.215451f, 0.215545f, 0.215639f, 0.215732f, 0.215826f, 0.215920f, 0.216013f,
- 0.216107f, 0.216200f, 0.216294f, 0.216388f, 0.216481f, 0.216575f, 0.216668f, 0.216762f,
- 0.216856f, 0.216949f, 0.217043f, 0.217136f, 0.217230f, 0.217324f, 0.217417f, 0.217511f,
- 0.217604f, 0.217698f, 0.217791f, 0.217885f, 0.217979f, 0.218072f, 0.218166f, 0.218259f,
- 0.218353f, 0.218446f, 0.218540f, 0.218633f, 0.218727f, 0.218821f, 0.218914f, 0.219008f,
- 0.219101f, 0.219195f, 0.219288f, 0.219382f, 0.219475f, 0.219569f, 0.219662f, 0.219756f,
- 0.219850f, 0.219943f, 0.220037f, 0.220130f, 0.220224f, 0.220317f, 0.220411f, 0.220504f,
- 0.220598f, 0.220691f, 0.220785f, 0.220878f, 0.220972f, 0.221065f, 0.221159f, 0.221252f,
- 0.221346f, 0.221439f, 0.221533f, 0.221626f, 0.221720f, 0.221813f, 0.221907f, 0.222000f,
- 0.222094f, 0.222187f, 0.222281f, 0.222374f, 0.222468f, 0.222561f, 0.222654f, 0.222748f,
- 0.222841f, 0.222935f, 0.223028f, 0.223122f, 0.223215f, 0.223309f, 0.223402f, 0.223496f,
- 0.223589f, 0.223682f, 0.223776f, 0.223869f, 0.223963f, 0.224056f, 0.224150f, 0.224243f,
- 0.224337f, 0.224430f, 0.224523f, 0.224617f, 0.224710f, 0.224804f, 0.224897f, 0.224991f,
- 0.225084f, 0.225177f, 0.225271f, 0.225364f, 0.225458f, 0.225551f, 0.225644f, 0.225738f,
- 0.225831f, 0.225925f, 0.226018f, 0.226111f, 0.226205f, 0.226298f, 0.226391f, 0.226485f,
- 0.226578f, 0.226672f, 0.226765f, 0.226858f, 0.226952f, 0.227045f, 0.227139f, 0.227232f,
- 0.227325f, 0.227419f, 0.227512f, 0.227605f, 0.227699f, 0.227792f, 0.227885f, 0.227979f,
- 0.228072f, 0.228165f, 0.228259f, 0.228352f, 0.228445f, 0.228539f, 0.228632f, 0.228725f,
- 0.228819f, 0.228912f, 0.229005f, 0.229099f, 0.229192f, 0.229285f, 0.229379f, 0.229472f,
- 0.229565f, 0.229659f, 0.229752f, 0.229845f, 0.229939f, 0.230032f, 0.230125f, 0.230218f,
- 0.230312f, 0.230405f, 0.230498f, 0.230592f, 0.230685f, 0.230778f, 0.230872f, 0.230965f,
- 0.231058f, 0.231151f, 0.231245f, 0.231338f, 0.231431f, 0.231524f, 0.231618f, 0.231711f,
- 0.231804f, 0.231898f, 0.231991f, 0.232084f, 0.232177f, 0.232271f, 0.232364f, 0.232457f,
- 0.232550f, 0.232644f, 0.232737f, 0.232830f, 0.232923f, 0.233017f, 0.233110f, 0.233203f,
- 0.233296f, 0.233389f, 0.233483f, 0.233576f, 0.233669f, 0.233762f, 0.233856f, 0.233949f,
- 0.234042f, 0.234135f, 0.234228f, 0.234322f, 0.234415f, 0.234508f, 0.234601f, 0.234694f,
- 0.234788f, 0.234881f, 0.234974f, 0.235067f, 0.235160f, 0.235254f, 0.235347f, 0.235440f,
- 0.235533f, 0.235626f, 0.235719f, 0.235813f, 0.235906f, 0.235999f, 0.236092f, 0.236185f,
- 0.236278f, 0.236372f, 0.236465f, 0.236558f, 0.236651f, 0.236744f, 0.236837f, 0.236930f,
- 0.237024f, 0.237117f, 0.237210f, 0.237303f, 0.237396f, 0.237489f, 0.237582f, 0.237676f,
- 0.237769f, 0.237862f, 0.237955f, 0.238048f, 0.238141f, 0.238234f, 0.238327f, 0.238420f,
- 0.238514f, 0.238607f, 0.238700f, 0.238793f, 0.238886f, 0.238979f, 0.239072f, 0.239165f,
- 0.239258f, 0.239351f, 0.239445f, 0.239538f, 0.239631f, 0.239724f, 0.239817f, 0.239910f,
- 0.240003f, 0.240096f, 0.240189f, 0.240282f, 0.240375f, 0.240468f, 0.240561f, 0.240654f,
- 0.240748f, 0.240841f, 0.240934f, 0.241027f, 0.241120f, 0.241213f, 0.241306f, 0.241399f,
- 0.241492f, 0.241585f, 0.241678f, 0.241771f, 0.241864f, 0.241957f, 0.242050f, 0.242143f,
- 0.242236f, 0.242329f, 0.242422f, 0.242515f, 0.242608f, 0.242701f, 0.242794f, 0.242887f,
- 0.242980f, 0.243073f, 0.243166f, 0.243259f, 0.243352f, 0.243445f, 0.243538f, 0.243631f,
- 0.243724f, 0.243817f, 0.243910f, 0.244003f, 0.244096f, 0.244189f, 0.244282f, 0.244375f,
- 0.244468f, 0.244561f, 0.244654f, 0.244747f, 0.244840f, 0.244933f, 0.245026f, 0.245119f,
- 0.245212f, 0.245304f, 0.245397f, 0.245490f, 0.245583f, 0.245676f, 0.245769f, 0.245862f,
- 0.245955f, 0.246048f, 0.246141f, 0.246234f, 0.246327f, 0.246420f, 0.246513f, 0.246606f,
- 0.246698f, 0.246791f, 0.246884f, 0.246977f, 0.247070f, 0.247163f, 0.247256f, 0.247349f,
- 0.247442f, 0.247535f, 0.247627f, 0.247720f, 0.247813f, 0.247906f, 0.247999f, 0.248092f,
- 0.248185f, 0.248278f, 0.248370f, 0.248463f, 0.248556f, 0.248649f, 0.248742f, 0.248835f,
- 0.248928f, 0.249020f, 0.249113f, 0.249206f, 0.249299f, 0.249392f, 0.249485f, 0.249578f,
- 0.249670f, 0.249763f, 0.249856f, 0.249949f, 0.250042f, 0.250135f, 0.250227f, 0.250320f,
- 0.250413f, 0.250506f, 0.250599f, 0.250691f, 0.250784f, 0.250877f, 0.250970f, 0.251063f,
- 0.251155f, 0.251248f, 0.251341f, 0.251434f, 0.251527f, 0.251619f, 0.251712f, 0.251805f,
- 0.251898f, 0.251991f, 0.252083f, 0.252176f, 0.252269f, 0.252362f, 0.252454f, 0.252547f,
- 0.252640f, 0.252733f, 0.252826f, 0.252918f, 0.253011f, 0.253104f, 0.253197f, 0.253289f,
- 0.253382f, 0.253475f, 0.253568f, 0.253660f, 0.253753f, 0.253846f, 0.253938f, 0.254031f,
- 0.254124f, 0.254217f, 0.254309f, 0.254402f, 0.254495f, 0.254588f, 0.254680f, 0.254773f,
- 0.254866f, 0.254958f, 0.255051f, 0.255144f, 0.255236f, 0.255329f, 0.255422f, 0.255515f,
- 0.255607f, 0.255700f, 0.255793f, 0.255885f, 0.255978f, 0.256071f, 0.256163f, 0.256256f,
- 0.256349f, 0.256441f, 0.256534f, 0.256627f, 0.256719f, 0.256812f, 0.256905f, 0.256997f,
- 0.257090f, 0.257183f, 0.257275f, 0.257368f, 0.257461f, 0.257553f, 0.257646f, 0.257738f,
- 0.257831f, 0.257924f, 0.258016f, 0.258109f, 0.258202f, 0.258294f, 0.258387f, 0.258479f,
- 0.258572f, 0.258665f, 0.258757f, 0.258850f, 0.258943f, 0.259035f, 0.259128f, 0.259220f,
- 0.259313f, 0.259405f, 0.259498f, 0.259591f, 0.259683f, 0.259776f, 0.259868f, 0.259961f,
- 0.260054f, 0.260146f, 0.260239f, 0.260331f, 0.260424f, 0.260516f, 0.260609f, 0.260702f,
- 0.260794f, 0.260887f, 0.260979f, 0.261072f, 0.261164f, 0.261257f, 0.261349f, 0.261442f,
- 0.261534f, 0.261627f, 0.261720f, 0.261812f, 0.261905f, 0.261997f, 0.262090f, 0.262182f,
- 0.262275f, 0.262367f, 0.262460f, 0.262552f, 0.262645f, 0.262737f, 0.262830f, 0.262922f,
- 0.263015f, 0.263107f, 0.263200f, 0.263292f, 0.263385f, 0.263477f, 0.263570f, 0.263662f,
- 0.263755f, 0.263847f, 0.263940f, 0.264032f, 0.264125f, 0.264217f, 0.264309f, 0.264402f,
- 0.264494f, 0.264587f, 0.264679f, 0.264772f, 0.264864f, 0.264957f, 0.265049f, 0.265142f,
- 0.265234f, 0.265326f, 0.265419f, 0.265511f, 0.265604f, 0.265696f, 0.265789f, 0.265881f,
- 0.265973f, 0.266066f, 0.266158f, 0.266251f, 0.266343f, 0.266436f, 0.266528f, 0.266620f,
- 0.266713f, 0.266805f, 0.266898f, 0.266990f, 0.267082f, 0.267175f, 0.267267f, 0.267359f,
- 0.267452f, 0.267544f, 0.267637f, 0.267729f, 0.267821f, 0.267914f, 0.268006f, 0.268099f,
- 0.268191f, 0.268283f, 0.268376f, 0.268468f, 0.268560f, 0.268653f, 0.268745f, 0.268837f,
- 0.268930f, 0.269022f, 0.269114f, 0.269207f, 0.269299f, 0.269391f, 0.269484f, 0.269576f,
- 0.269668f, 0.269761f, 0.269853f, 0.269945f, 0.270038f, 0.270130f, 0.270222f, 0.270315f,
- 0.270407f, 0.270499f, 0.270591f, 0.270684f, 0.270776f, 0.270868f, 0.270961f, 0.271053f,
- 0.271145f, 0.271237f, 0.271330f, 0.271422f, 0.271514f, 0.271607f, 0.271699f, 0.271791f,
- 0.271883f, 0.271976f, 0.272068f, 0.272160f, 0.272252f, 0.272345f, 0.272437f, 0.272529f,
- 0.272621f, 0.272714f, 0.272806f, 0.272898f, 0.272990f, 0.273083f, 0.273175f, 0.273267f,
- 0.273359f, 0.273451f, 0.273544f, 0.273636f, 0.273728f, 0.273820f, 0.273912f, 0.274005f,
- 0.274097f, 0.274189f, 0.274281f, 0.274374f, 0.274466f, 0.274558f, 0.274650f, 0.274742f,
- 0.274834f, 0.274927f, 0.275019f, 0.275111f, 0.275203f, 0.275295f, 0.275387f, 0.275480f,
- 0.275572f, 0.275664f, 0.275756f, 0.275848f, 0.275940f, 0.276033f, 0.276125f, 0.276217f,
- 0.276309f, 0.276401f, 0.276493f, 0.276585f, 0.276678f, 0.276770f, 0.276862f, 0.276954f,
- 0.277046f, 0.277138f, 0.277230f, 0.277322f, 0.277415f, 0.277507f, 0.277599f, 0.277691f,
- 0.277783f, 0.277875f, 0.277967f, 0.278059f, 0.278151f, 0.278243f, 0.278336f, 0.278428f,
- 0.278520f, 0.278612f, 0.278704f, 0.278796f, 0.278888f, 0.278980f, 0.279072f, 0.279164f,
- 0.279256f, 0.279348f, 0.279440f, 0.279532f, 0.279624f, 0.279717f, 0.279809f, 0.279901f,
- 0.279993f, 0.280085f, 0.280177f, 0.280269f, 0.280361f, 0.280453f, 0.280545f, 0.280637f,
- 0.280729f, 0.280821f, 0.280913f, 0.281005f, 0.281097f, 0.281189f, 0.281281f, 0.281373f,
- 0.281465f, 0.281557f, 0.281649f, 0.281741f, 0.281833f, 0.281925f, 0.282017f, 0.282109f,
- 0.282201f, 0.282293f, 0.282385f, 0.282477f, 0.282569f, 0.282661f, 0.282753f, 0.282845f,
- 0.282937f, 0.283029f, 0.283120f, 0.283212f, 0.283304f, 0.283396f, 0.283488f, 0.283580f,
- 0.283672f, 0.283764f, 0.283856f, 0.283948f, 0.284040f, 0.284132f, 0.284224f, 0.284316f,
- 0.284408f, 0.284499f, 0.284591f, 0.284683f, 0.284775f, 0.284867f, 0.284959f, 0.285051f,
- 0.285143f, 0.285235f, 0.285327f, 0.285418f, 0.285510f, 0.285602f, 0.285694f, 0.285786f,
- 0.285878f, 0.285970f, 0.286062f, 0.286153f, 0.286245f, 0.286337f, 0.286429f, 0.286521f,
- 0.286613f, 0.286705f, 0.286796f, 0.286888f, 0.286980f, 0.287072f, 0.287164f, 0.287256f,
- 0.287347f, 0.287439f, 0.287531f, 0.287623f, 0.287715f, 0.287807f, 0.287898f, 0.287990f,
- 0.288082f, 0.288174f, 0.288266f, 0.288357f, 0.288449f, 0.288541f, 0.288633f, 0.288725f,
- 0.288816f, 0.288908f, 0.289000f, 0.289092f, 0.289184f, 0.289275f, 0.289367f, 0.289459f,
- 0.289551f, 0.289642f, 0.289734f, 0.289826f, 0.289918f, 0.290009f, 0.290101f, 0.290193f,
- 0.290285f, 0.290376f, 0.290468f, 0.290560f, 0.290652f, 0.290743f, 0.290835f, 0.290927f,
- 0.291019f, 0.291110f, 0.291202f, 0.291294f, 0.291385f, 0.291477f, 0.291569f, 0.291661f,
- 0.291752f, 0.291844f, 0.291936f, 0.292027f, 0.292119f, 0.292211f, 0.292302f, 0.292394f,
- 0.292486f, 0.292577f, 0.292669f, 0.292761f, 0.292852f, 0.292944f, 0.293036f, 0.293128f,
- 0.293219f, 0.293311f, 0.293402f, 0.293494f, 0.293586f, 0.293677f, 0.293769f, 0.293861f,
- 0.293952f, 0.294044f, 0.294136f, 0.294227f, 0.294319f, 0.294410f, 0.294502f, 0.294594f,
- 0.294685f, 0.294777f, 0.294869f, 0.294960f, 0.295052f, 0.295143f, 0.295235f, 0.295327f,
- 0.295418f, 0.295510f, 0.295601f, 0.295693f, 0.295785f, 0.295876f, 0.295968f, 0.296059f,
- 0.296151f, 0.296242f, 0.296334f, 0.296426f, 0.296517f, 0.296609f, 0.296700f, 0.296792f,
- 0.296883f, 0.296975f, 0.297066f, 0.297158f, 0.297250f, 0.297341f, 0.297433f, 0.297524f,
- 0.297616f, 0.297707f, 0.297799f, 0.297890f, 0.297982f, 0.298073f, 0.298165f, 0.298256f,
- 0.298348f, 0.298439f, 0.298531f, 0.298622f, 0.298714f, 0.298805f, 0.298897f, 0.298988f,
- 0.299080f, 0.299171f, 0.299263f, 0.299354f, 0.299446f, 0.299537f, 0.299629f, 0.299720f,
- 0.299812f, 0.299903f, 0.299995f, 0.300086f, 0.300177f, 0.300269f, 0.300360f, 0.300452f,
- 0.300543f, 0.300635f, 0.300726f, 0.300818f, 0.300909f, 0.301000f, 0.301092f, 0.301183f,
- 0.301275f, 0.301366f, 0.301458f, 0.301549f, 0.301640f, 0.301732f, 0.301823f, 0.301915f,
- 0.302006f, 0.302097f, 0.302189f, 0.302280f, 0.302372f, 0.302463f, 0.302554f, 0.302646f,
- 0.302737f, 0.302828f, 0.302920f, 0.303011f, 0.303103f, 0.303194f, 0.303285f, 0.303377f,
- 0.303468f, 0.303559f, 0.303651f, 0.303742f, 0.303833f, 0.303925f, 0.304016f, 0.304107f,
- 0.304199f, 0.304290f, 0.304381f, 0.304473f, 0.304564f, 0.304655f, 0.304747f, 0.304838f,
- 0.304929f, 0.305021f, 0.305112f, 0.305203f, 0.305294f, 0.305386f, 0.305477f, 0.305568f,
- 0.305660f, 0.305751f, 0.305842f, 0.305933f, 0.306025f, 0.306116f, 0.306207f, 0.306299f,
- 0.306390f, 0.306481f, 0.306572f, 0.306664f, 0.306755f, 0.306846f, 0.306937f, 0.307029f,
- 0.307120f, 0.307211f, 0.307302f, 0.307394f, 0.307485f, 0.307576f, 0.307667f, 0.307758f,
- 0.307850f, 0.307941f, 0.308032f, 0.308123f, 0.308214f, 0.308306f, 0.308397f, 0.308488f,
- 0.308579f, 0.308670f, 0.308762f, 0.308853f, 0.308944f, 0.309035f, 0.309126f, 0.309218f,
- 0.309309f, 0.309400f, 0.309491f, 0.309582f, 0.309673f, 0.309765f, 0.309856f, 0.309947f,
- 0.310038f, 0.310129f, 0.310220f, 0.310311f, 0.310403f, 0.310494f, 0.310585f, 0.310676f,
- 0.310767f, 0.310858f, 0.310949f, 0.311041f, 0.311132f, 0.311223f, 0.311314f, 0.311405f,
- 0.311496f, 0.311587f, 0.311678f, 0.311769f, 0.311860f, 0.311952f, 0.312043f, 0.312134f,
- 0.312225f, 0.312316f, 0.312407f, 0.312498f, 0.312589f, 0.312680f, 0.312771f, 0.312862f,
- 0.312953f, 0.313044f, 0.313135f, 0.313227f, 0.313318f, 0.313409f, 0.313500f, 0.313591f,
- 0.313682f, 0.313773f, 0.313864f, 0.313955f, 0.314046f, 0.314137f, 0.314228f, 0.314319f,
- 0.314410f, 0.314501f, 0.314592f, 0.314683f, 0.314774f, 0.314865f, 0.314956f, 0.315047f,
- 0.315138f, 0.315229f, 0.315320f, 0.315411f, 0.315502f, 0.315593f, 0.315684f, 0.315775f,
- 0.315866f, 0.315957f, 0.316048f, 0.316139f, 0.316230f, 0.316321f, 0.316411f, 0.316502f,
- 0.316593f, 0.316684f, 0.316775f, 0.316866f, 0.316957f, 0.317048f, 0.317139f, 0.317230f,
- 0.317321f, 0.317412f, 0.317503f, 0.317594f, 0.317684f, 0.317775f, 0.317866f, 0.317957f,
- 0.318048f, 0.318139f, 0.318230f, 0.318321f, 0.318412f, 0.318503f, 0.318593f, 0.318684f,
- 0.318775f, 0.318866f, 0.318957f, 0.319048f, 0.319139f, 0.319229f, 0.319320f, 0.319411f,
- 0.319502f, 0.319593f, 0.319684f, 0.319775f, 0.319865f, 0.319956f, 0.320047f, 0.320138f,
- 0.320229f, 0.320320f, 0.320410f, 0.320501f, 0.320592f, 0.320683f, 0.320774f, 0.320864f,
- 0.320955f, 0.321046f, 0.321137f, 0.321228f, 0.321318f, 0.321409f, 0.321500f, 0.321591f,
- 0.321682f, 0.321772f, 0.321863f, 0.321954f, 0.322045f, 0.322135f, 0.322226f, 0.322317f,
- 0.322408f, 0.322498f, 0.322589f, 0.322680f, 0.322771f, 0.322861f, 0.322952f, 0.323043f,
- 0.323134f, 0.323224f, 0.323315f, 0.323406f, 0.323497f, 0.323587f, 0.323678f, 0.323769f,
- 0.323859f, 0.323950f, 0.324041f, 0.324131f, 0.324222f, 0.324313f, 0.324404f, 0.324494f,
- 0.324585f, 0.324676f, 0.324766f, 0.324857f, 0.324948f, 0.325038f, 0.325129f, 0.325220f,
- 0.325310f, 0.325401f, 0.325492f, 0.325582f, 0.325673f, 0.325764f, 0.325854f, 0.325945f,
- 0.326035f, 0.326126f, 0.326217f, 0.326307f, 0.326398f, 0.326489f, 0.326579f, 0.326670f,
- 0.326760f, 0.326851f, 0.326942f, 0.327032f, 0.327123f, 0.327213f, 0.327304f, 0.327395f,
- 0.327485f, 0.327576f, 0.327666f, 0.327757f, 0.327848f, 0.327938f, 0.328029f, 0.328119f,
- 0.328210f, 0.328300f, 0.328391f, 0.328482f, 0.328572f, 0.328663f, 0.328753f, 0.328844f,
- 0.328934f, 0.329025f, 0.329115f, 0.329206f, 0.329296f, 0.329387f, 0.329477f, 0.329568f,
- 0.329658f, 0.329749f, 0.329839f, 0.329930f, 0.330020f, 0.330111f, 0.330202f, 0.330292f,
- 0.330382f, 0.330473f, 0.330563f, 0.330654f, 0.330744f, 0.330835f, 0.330925f, 0.331016f,
- 0.331106f, 0.331197f, 0.331287f, 0.331378f, 0.331468f, 0.331559f, 0.331649f, 0.331739f,
- 0.331830f, 0.331920f, 0.332011f, 0.332101f, 0.332192f, 0.332282f, 0.332373f, 0.332463f,
- 0.332553f, 0.332644f, 0.332734f, 0.332825f, 0.332915f, 0.333005f, 0.333096f, 0.333186f,
- 0.333277f, 0.333367f, 0.333457f, 0.333548f, 0.333638f, 0.333729f, 0.333819f, 0.333909f,
- 0.334000f, 0.334090f, 0.334180f, 0.334271f, 0.334361f, 0.334451f, 0.334542f, 0.334632f,
- 0.334722f, 0.334813f, 0.334903f, 0.334994f, 0.335084f, 0.335174f, 0.335265f, 0.335355f,
- 0.335445f, 0.335535f, 0.335626f, 0.335716f, 0.335806f, 0.335897f, 0.335987f, 0.336077f,
- 0.336168f, 0.336258f, 0.336348f, 0.336438f, 0.336529f, 0.336619f, 0.336709f, 0.336800f,
- 0.336890f, 0.336980f, 0.337070f, 0.337161f, 0.337251f, 0.337341f, 0.337431f, 0.337522f,
- 0.337612f, 0.337702f, 0.337792f, 0.337883f, 0.337973f, 0.338063f, 0.338153f, 0.338244f,
- 0.338334f, 0.338424f, 0.338514f, 0.338604f, 0.338695f, 0.338785f, 0.338875f, 0.338965f,
- 0.339055f, 0.339146f, 0.339236f, 0.339326f, 0.339416f, 0.339506f, 0.339597f, 0.339687f,
- 0.339777f, 0.339867f, 0.339957f, 0.340047f, 0.340138f, 0.340228f, 0.340318f, 0.340408f,
- 0.340498f, 0.340588f, 0.340678f, 0.340769f, 0.340859f, 0.340949f, 0.341039f, 0.341129f,
- 0.341219f, 0.341309f, 0.341399f, 0.341490f, 0.341580f, 0.341670f, 0.341760f, 0.341850f,
- 0.341940f, 0.342030f, 0.342120f, 0.342210f, 0.342300f, 0.342391f, 0.342481f, 0.342571f,
- 0.342661f, 0.342751f, 0.342841f, 0.342931f, 0.343021f, 0.343111f, 0.343201f, 0.343291f,
- 0.343381f, 0.343471f, 0.343561f, 0.343651f, 0.343741f, 0.343831f, 0.343921f, 0.344011f,
- 0.344101f, 0.344191f, 0.344281f, 0.344371f, 0.344461f, 0.344551f, 0.344641f, 0.344731f,
- 0.344821f, 0.344911f, 0.345001f, 0.345091f, 0.345181f, 0.345271f, 0.345361f, 0.345451f,
- 0.345541f, 0.345631f, 0.345721f, 0.345811f, 0.345901f, 0.345991f, 0.346081f, 0.346171f,
- 0.346261f, 0.346351f, 0.346441f, 0.346531f, 0.346621f, 0.346711f, 0.346801f, 0.346890f,
- 0.346980f, 0.347070f, 0.347160f, 0.347250f, 0.347340f, 0.347430f, 0.347520f, 0.347610f,
- 0.347700f, 0.347790f, 0.347879f, 0.347969f, 0.348059f, 0.348149f, 0.348239f, 0.348329f,
- 0.348419f, 0.348509f, 0.348598f, 0.348688f, 0.348778f, 0.348868f, 0.348958f, 0.349048f,
- 0.349138f, 0.349227f, 0.349317f, 0.349407f, 0.349497f, 0.349587f, 0.349676f, 0.349766f,
- 0.349856f, 0.349946f, 0.350036f, 0.350126f, 0.350215f, 0.350305f, 0.350395f, 0.350485f,
- 0.350575f, 0.350664f, 0.350754f, 0.350844f, 0.350934f, 0.351023f, 0.351113f, 0.351203f,
- 0.351293f, 0.351383f, 0.351472f, 0.351562f, 0.351652f, 0.351742f, 0.351831f, 0.351921f,
- 0.352011f, 0.352100f, 0.352190f, 0.352280f, 0.352370f, 0.352459f, 0.352549f, 0.352639f,
- 0.352729f, 0.352818f, 0.352908f, 0.352998f, 0.353087f, 0.353177f, 0.353267f, 0.353356f,
- 0.353446f, 0.353536f, 0.353626f, 0.353715f, 0.353805f, 0.353895f, 0.353984f, 0.354074f,
- 0.354164f, 0.354253f, 0.354343f, 0.354432f, 0.354522f, 0.354612f, 0.354701f, 0.354791f,
- 0.354881f, 0.354970f, 0.355060f, 0.355150f, 0.355239f, 0.355329f, 0.355418f, 0.355508f,
- 0.355598f, 0.355687f, 0.355777f, 0.355866f, 0.355956f, 0.356046f, 0.356135f, 0.356225f,
- 0.356314f, 0.356404f, 0.356494f, 0.356583f, 0.356673f, 0.356762f, 0.356852f, 0.356941f,
- 0.357031f, 0.357121f, 0.357210f, 0.357300f, 0.357389f, 0.357479f, 0.357568f, 0.357658f,
- 0.357747f, 0.357837f, 0.357926f, 0.358016f, 0.358105f, 0.358195f, 0.358284f, 0.358374f,
- 0.358463f, 0.358553f, 0.358642f, 0.358732f, 0.358821f, 0.358911f, 0.359000f, 0.359090f,
- 0.359179f, 0.359269f, 0.359358f, 0.359448f, 0.359537f, 0.359627f, 0.359716f, 0.359806f,
- 0.359895f, 0.359984f, 0.360074f, 0.360163f, 0.360253f, 0.360342f, 0.360432f, 0.360521f,
- 0.360611f, 0.360700f, 0.360789f, 0.360879f, 0.360968f, 0.361058f, 0.361147f, 0.361236f,
- 0.361326f, 0.361415f, 0.361505f, 0.361594f, 0.361683f, 0.361773f, 0.361862f, 0.361952f,
- 0.362041f, 0.362130f, 0.362220f, 0.362309f, 0.362398f, 0.362488f, 0.362577f, 0.362666f,
- 0.362756f, 0.362845f, 0.362934f, 0.363024f, 0.363113f, 0.363202f, 0.363292f, 0.363381f,
- 0.363470f, 0.363560f, 0.363649f, 0.363738f, 0.363828f, 0.363917f, 0.364006f, 0.364096f,
- 0.364185f, 0.364274f, 0.364363f, 0.364453f, 0.364542f, 0.364631f, 0.364720f, 0.364810f,
- 0.364899f, 0.364988f, 0.365078f, 0.365167f, 0.365256f, 0.365345f, 0.365435f, 0.365524f,
- 0.365613f, 0.365702f, 0.365791f, 0.365881f, 0.365970f, 0.366059f, 0.366148f, 0.366238f,
- 0.366327f, 0.366416f, 0.366505f, 0.366594f, 0.366684f, 0.366773f, 0.366862f, 0.366951f,
- 0.367040f, 0.367130f, 0.367219f, 0.367308f, 0.367397f, 0.367486f, 0.367575f, 0.367665f,
- 0.367754f, 0.367843f, 0.367932f, 0.368021f, 0.368110f, 0.368199f, 0.368289f, 0.368378f,
- 0.368467f, 0.368556f, 0.368645f, 0.368734f, 0.368823f, 0.368912f, 0.369002f, 0.369091f,
- 0.369180f, 0.369269f, 0.369358f, 0.369447f, 0.369536f, 0.369625f, 0.369714f, 0.369803f,
- 0.369892f, 0.369982f, 0.370071f, 0.370160f, 0.370249f, 0.370338f, 0.370427f, 0.370516f,
- 0.370605f, 0.370694f, 0.370783f, 0.370872f, 0.370961f, 0.371050f, 0.371139f, 0.371228f,
- 0.371317f, 0.371406f, 0.371495f, 0.371584f, 0.371673f, 0.371762f, 0.371851f, 0.371940f,
- 0.372029f, 0.372118f, 0.372207f, 0.372296f, 0.372385f, 0.372474f, 0.372563f, 0.372652f,
- 0.372741f, 0.372830f, 0.372919f, 0.373008f, 0.373097f, 0.373186f, 0.373275f, 0.373364f,
- 0.373453f, 0.373542f, 0.373631f, 0.373719f, 0.373808f, 0.373897f, 0.373986f, 0.374075f,
- 0.374164f, 0.374253f, 0.374342f, 0.374431f, 0.374520f, 0.374609f, 0.374697f, 0.374786f,
- 0.374875f, 0.374964f, 0.375053f, 0.375142f, 0.375231f, 0.375320f, 0.375408f, 0.375497f,
- 0.375586f, 0.375675f, 0.375764f, 0.375853f, 0.375942f, 0.376030f, 0.376119f, 0.376208f,
- 0.376297f, 0.376386f, 0.376475f, 0.376563f, 0.376652f, 0.376741f, 0.376830f, 0.376919f,
- 0.377007f, 0.377096f, 0.377185f, 0.377274f, 0.377363f, 0.377451f, 0.377540f, 0.377629f,
- 0.377718f, 0.377806f, 0.377895f, 0.377984f, 0.378073f, 0.378162f, 0.378250f, 0.378339f,
- 0.378428f, 0.378516f, 0.378605f, 0.378694f, 0.378783f, 0.378871f, 0.378960f, 0.379049f,
- 0.379138f, 0.379226f, 0.379315f, 0.379404f, 0.379492f, 0.379581f, 0.379670f, 0.379759f,
- 0.379847f, 0.379936f, 0.380025f, 0.380113f, 0.380202f, 0.380291f, 0.380379f, 0.380468f,
- 0.380557f, 0.380645f, 0.380734f, 0.380823f, 0.380911f, 0.381000f, 0.381088f, 0.381177f,
- 0.381266f, 0.381354f, 0.381443f, 0.381532f, 0.381620f, 0.381709f, 0.381797f, 0.381886f,
- 0.381975f, 0.382063f, 0.382152f, 0.382241f, 0.382329f, 0.382418f, 0.382506f, 0.382595f,
- 0.382683f, 0.382772f, 0.382861f, 0.382949f, 0.383038f, 0.383126f, 0.383215f, 0.383303f,
- 0.383392f, 0.383480f, 0.383569f, 0.383658f, 0.383746f, 0.383835f, 0.383923f, 0.384012f,
- 0.384100f, 0.384189f, 0.384277f, 0.384366f, 0.384454f, 0.384543f, 0.384631f, 0.384720f,
- 0.384808f, 0.384897f, 0.384985f, 0.385074f, 0.385162f, 0.385251f, 0.385339f, 0.385428f,
- 0.385516f, 0.385605f, 0.385693f, 0.385781f, 0.385870f, 0.385958f, 0.386047f, 0.386135f,
- 0.386224f, 0.386312f, 0.386400f, 0.386489f, 0.386577f, 0.386666f, 0.386754f, 0.386843f,
- 0.386931f, 0.387019f, 0.387108f, 0.387196f, 0.387285f, 0.387373f, 0.387461f, 0.387550f,
- 0.387638f, 0.387727f, 0.387815f, 0.387903f, 0.387992f, 0.388080f, 0.388168f, 0.388257f,
- 0.388345f, 0.388433f, 0.388522f, 0.388610f, 0.388698f, 0.388787f, 0.388875f, 0.388963f,
- 0.389052f, 0.389140f, 0.389228f, 0.389317f, 0.389405f, 0.389493f, 0.389582f, 0.389670f,
- 0.389758f, 0.389846f, 0.389935f, 0.390023f, 0.390111f, 0.390200f, 0.390288f, 0.390376f,
- 0.390464f, 0.390553f, 0.390641f, 0.390729f, 0.390817f, 0.390906f, 0.390994f, 0.391082f,
- 0.391170f, 0.391259f, 0.391347f, 0.391435f, 0.391523f, 0.391612f, 0.391700f, 0.391788f,
- 0.391876f, 0.391964f, 0.392053f, 0.392141f, 0.392229f, 0.392317f, 0.392405f, 0.392493f,
- 0.392582f, 0.392670f, 0.392758f, 0.392846f, 0.392934f, 0.393023f, 0.393111f, 0.393199f,
- 0.393287f, 0.393375f, 0.393463f, 0.393551f, 0.393640f, 0.393728f, 0.393816f, 0.393904f,
- 0.393992f, 0.394080f, 0.394168f, 0.394256f, 0.394344f, 0.394433f, 0.394521f, 0.394609f,
- 0.394697f, 0.394785f, 0.394873f, 0.394961f, 0.395049f, 0.395137f, 0.395225f, 0.395313f,
- 0.395401f, 0.395490f, 0.395578f, 0.395666f, 0.395754f, 0.395842f, 0.395930f, 0.396018f,
- 0.396106f, 0.396194f, 0.396282f, 0.396370f, 0.396458f, 0.396546f, 0.396634f, 0.396722f,
- 0.396810f, 0.396898f, 0.396986f, 0.397074f, 0.397162f, 0.397250f, 0.397338f, 0.397426f,
- 0.397514f, 0.397602f, 0.397690f, 0.397778f, 0.397866f, 0.397954f, 0.398042f, 0.398130f,
- 0.398218f, 0.398306f, 0.398393f, 0.398481f, 0.398569f, 0.398657f, 0.398745f, 0.398833f,
- 0.398921f, 0.399009f, 0.399097f, 0.399185f, 0.399273f, 0.399361f, 0.399448f, 0.399536f,
- 0.399624f, 0.399712f, 0.399800f, 0.399888f, 0.399976f, 0.400064f, 0.400151f, 0.400239f,
- 0.400327f, 0.400415f, 0.400503f, 0.400591f, 0.400679f, 0.400766f, 0.400854f, 0.400942f,
- 0.401030f, 0.401118f, 0.401206f, 0.401293f, 0.401381f, 0.401469f, 0.401557f, 0.401645f,
- 0.401732f, 0.401820f, 0.401908f, 0.401996f, 0.402084f, 0.402171f, 0.402259f, 0.402347f,
- 0.402435f, 0.402522f, 0.402610f, 0.402698f, 0.402786f, 0.402873f, 0.402961f, 0.403049f,
- 0.403137f, 0.403224f, 0.403312f, 0.403400f, 0.403488f, 0.403575f, 0.403663f, 0.403751f,
- 0.403838f, 0.403926f, 0.404014f, 0.404102f, 0.404189f, 0.404277f, 0.404365f, 0.404452f,
- 0.404540f, 0.404628f, 0.404715f, 0.404803f, 0.404891f, 0.404978f, 0.405066f, 0.405154f,
- 0.405241f, 0.405329f, 0.405417f, 0.405504f, 0.405592f, 0.405680f, 0.405767f, 0.405855f,
- 0.405942f, 0.406030f, 0.406118f, 0.406205f, 0.406293f, 0.406380f, 0.406468f, 0.406556f,
- 0.406643f, 0.406731f, 0.406818f, 0.406906f, 0.406994f, 0.407081f, 0.407169f, 0.407256f,
- 0.407344f, 0.407431f, 0.407519f, 0.407606f, 0.407694f, 0.407782f, 0.407869f, 0.407957f,
- 0.408044f, 0.408132f, 0.408219f, 0.408307f, 0.408394f, 0.408482f, 0.408569f, 0.408657f,
- 0.408744f, 0.408832f, 0.408919f, 0.409007f, 0.409094f, 0.409182f, 0.409269f, 0.409357f,
- 0.409444f, 0.409532f, 0.409619f, 0.409707f, 0.409794f, 0.409881f, 0.409969f, 0.410056f,
- 0.410144f, 0.410231f, 0.410319f, 0.410406f, 0.410493f, 0.410581f, 0.410668f, 0.410756f,
- 0.410843f, 0.410931f, 0.411018f, 0.411105f, 0.411193f, 0.411280f, 0.411368f, 0.411455f,
- 0.411542f, 0.411630f, 0.411717f, 0.411804f, 0.411892f, 0.411979f, 0.412067f, 0.412154f,
- 0.412241f, 0.412329f, 0.412416f, 0.412503f, 0.412591f, 0.412678f, 0.412765f, 0.412853f,
- 0.412940f, 0.413027f, 0.413115f, 0.413202f, 0.413289f, 0.413376f, 0.413464f, 0.413551f,
- 0.413638f, 0.413726f, 0.413813f, 0.413900f, 0.413987f, 0.414075f, 0.414162f, 0.414249f,
- 0.414337f, 0.414424f, 0.414511f, 0.414598f, 0.414685f, 0.414773f, 0.414860f, 0.414947f,
- 0.415034f, 0.415122f, 0.415209f, 0.415296f, 0.415383f, 0.415471f, 0.415558f, 0.415645f,
- 0.415732f, 0.415819f, 0.415906f, 0.415994f, 0.416081f, 0.416168f, 0.416255f, 0.416342f,
- 0.416430f, 0.416517f, 0.416604f, 0.416691f, 0.416778f, 0.416865f, 0.416952f, 0.417040f,
- 0.417127f, 0.417214f, 0.417301f, 0.417388f, 0.417475f, 0.417562f, 0.417650f, 0.417737f,
- 0.417824f, 0.417911f, 0.417998f, 0.418085f, 0.418172f, 0.418259f, 0.418346f, 0.418433f,
- 0.418520f, 0.418608f, 0.418695f, 0.418782f, 0.418869f, 0.418956f, 0.419043f, 0.419130f,
- 0.419217f, 0.419304f, 0.419391f, 0.419478f, 0.419565f, 0.419652f, 0.419739f, 0.419826f,
- 0.419913f, 0.420000f, 0.420087f, 0.420174f, 0.420261f, 0.420348f, 0.420435f, 0.420522f,
- 0.420609f, 0.420696f, 0.420783f, 0.420870f, 0.420957f, 0.421044f, 0.421131f, 0.421218f,
- 0.421305f, 0.421392f, 0.421479f, 0.421566f, 0.421653f, 0.421739f, 0.421826f, 0.421913f,
- 0.422000f, 0.422087f, 0.422174f, 0.422261f, 0.422348f, 0.422435f, 0.422522f, 0.422609f,
- 0.422695f, 0.422782f, 0.422869f, 0.422956f, 0.423043f, 0.423130f, 0.423217f, 0.423304f,
- 0.423390f, 0.423477f, 0.423564f, 0.423651f, 0.423738f, 0.423825f, 0.423912f, 0.423998f,
- 0.424085f, 0.424172f, 0.424259f, 0.424346f, 0.424432f, 0.424519f, 0.424606f, 0.424693f,
- 0.424780f, 0.424866f, 0.424953f, 0.425040f, 0.425127f, 0.425214f, 0.425300f, 0.425387f,
- 0.425474f, 0.425561f, 0.425647f, 0.425734f, 0.425821f, 0.425908f, 0.425994f, 0.426081f,
- 0.426168f, 0.426255f, 0.426341f, 0.426428f, 0.426515f, 0.426601f, 0.426688f, 0.426775f,
- 0.426862f, 0.426948f, 0.427035f, 0.427122f, 0.427208f, 0.427295f, 0.427382f, 0.427468f,
- 0.427555f, 0.427642f, 0.427728f, 0.427815f, 0.427902f, 0.427988f, 0.428075f, 0.428162f,
- 0.428248f, 0.428335f, 0.428422f, 0.428508f, 0.428595f, 0.428681f, 0.428768f, 0.428855f,
- 0.428941f, 0.429028f, 0.429114f, 0.429201f, 0.429288f, 0.429374f, 0.429461f, 0.429547f,
- 0.429634f, 0.429721f, 0.429807f, 0.429894f, 0.429980f, 0.430067f, 0.430153f, 0.430240f,
- 0.430326f, 0.430413f, 0.430500f, 0.430586f, 0.430673f, 0.430759f, 0.430846f, 0.430932f,
- 0.431019f, 0.431105f, 0.431192f, 0.431278f, 0.431365f, 0.431451f, 0.431538f, 0.431624f,
- 0.431711f, 0.431797f, 0.431884f, 0.431970f, 0.432057f, 0.432143f, 0.432229f, 0.432316f,
- 0.432402f, 0.432489f, 0.432575f, 0.432662f, 0.432748f, 0.432835f, 0.432921f, 0.433007f,
- 0.433094f, 0.433180f, 0.433267f, 0.433353f, 0.433439f, 0.433526f, 0.433612f, 0.433699f,
- 0.433785f, 0.433871f, 0.433958f, 0.434044f, 0.434131f, 0.434217f, 0.434303f, 0.434390f,
- 0.434476f, 0.434562f, 0.434649f, 0.434735f, 0.434821f, 0.434908f, 0.434994f, 0.435080f,
- 0.435167f, 0.435253f, 0.435339f, 0.435426f, 0.435512f, 0.435598f, 0.435685f, 0.435771f,
- 0.435857f, 0.435943f, 0.436030f, 0.436116f, 0.436202f, 0.436288f, 0.436375f, 0.436461f,
- 0.436547f, 0.436633f, 0.436720f, 0.436806f, 0.436892f, 0.436978f, 0.437065f, 0.437151f,
- 0.437237f, 0.437323f, 0.437410f, 0.437496f, 0.437582f, 0.437668f, 0.437754f, 0.437841f,
- 0.437927f, 0.438013f, 0.438099f, 0.438185f, 0.438272f, 0.438358f, 0.438444f, 0.438530f,
- 0.438616f, 0.438702f, 0.438789f, 0.438875f, 0.438961f, 0.439047f, 0.439133f, 0.439219f,
- 0.439305f, 0.439392f, 0.439478f, 0.439564f, 0.439650f, 0.439736f, 0.439822f, 0.439908f,
- 0.439994f, 0.440080f, 0.440166f, 0.440253f, 0.440339f, 0.440425f, 0.440511f, 0.440597f,
- 0.440683f, 0.440769f, 0.440855f, 0.440941f, 0.441027f, 0.441113f, 0.441199f, 0.441285f,
- 0.441371f, 0.441457f, 0.441543f, 0.441629f, 0.441715f, 0.441801f, 0.441887f, 0.441973f,
- 0.442059f, 0.442145f, 0.442231f, 0.442317f, 0.442403f, 0.442489f, 0.442575f, 0.442661f,
- 0.442747f, 0.442833f, 0.442919f, 0.443005f, 0.443091f, 0.443177f, 0.443263f, 0.443349f,
- 0.443435f, 0.443521f, 0.443607f, 0.443693f, 0.443779f, 0.443864f, 0.443950f, 0.444036f,
- 0.444122f, 0.444208f, 0.444294f, 0.444380f, 0.444466f, 0.444552f, 0.444637f, 0.444723f,
- 0.444809f, 0.444895f, 0.444981f, 0.445067f, 0.445153f, 0.445239f, 0.445324f, 0.445410f,
- 0.445496f, 0.445582f, 0.445668f, 0.445754f, 0.445839f, 0.445925f, 0.446011f, 0.446097f,
- 0.446183f, 0.446268f, 0.446354f, 0.446440f, 0.446526f, 0.446612f, 0.446697f, 0.446783f,
- 0.446869f, 0.446955f, 0.447040f, 0.447126f, 0.447212f, 0.447298f, 0.447383f, 0.447469f,
- 0.447555f, 0.447641f, 0.447726f, 0.447812f, 0.447898f, 0.447983f, 0.448069f, 0.448155f,
- 0.448241f, 0.448326f, 0.448412f, 0.448498f, 0.448583f, 0.448669f, 0.448755f, 0.448840f,
- 0.448926f, 0.449012f, 0.449097f, 0.449183f, 0.449269f, 0.449354f, 0.449440f, 0.449526f,
- 0.449611f, 0.449697f, 0.449783f, 0.449868f, 0.449954f, 0.450039f, 0.450125f, 0.450211f,
- 0.450296f, 0.450382f, 0.450467f, 0.450553f, 0.450639f, 0.450724f, 0.450810f, 0.450895f,
- 0.450981f, 0.451067f, 0.451152f, 0.451238f, 0.451323f, 0.451409f, 0.451494f, 0.451580f,
- 0.451665f, 0.451751f, 0.451836f, 0.451922f, 0.452008f, 0.452093f, 0.452179f, 0.452264f,
- 0.452350f, 0.452435f, 0.452521f, 0.452606f, 0.452692f, 0.452777f, 0.452863f, 0.452948f,
- 0.453033f, 0.453119f, 0.453204f, 0.453290f, 0.453375f, 0.453461f, 0.453546f, 0.453632f,
- 0.453717f, 0.453803f, 0.453888f, 0.453973f, 0.454059f, 0.454144f, 0.454230f, 0.454315f,
- 0.454400f, 0.454486f, 0.454571f, 0.454657f, 0.454742f, 0.454827f, 0.454913f, 0.454998f,
- 0.455084f, 0.455169f, 0.455254f, 0.455340f, 0.455425f, 0.455510f, 0.455596f, 0.455681f,
- 0.455766f, 0.455852f, 0.455937f, 0.456022f, 0.456108f, 0.456193f, 0.456278f, 0.456364f,
- 0.456449f, 0.456534f, 0.456620f, 0.456705f, 0.456790f, 0.456875f, 0.456961f, 0.457046f,
- 0.457131f, 0.457217f, 0.457302f, 0.457387f, 0.457472f, 0.457558f, 0.457643f, 0.457728f,
- 0.457813f, 0.457899f, 0.457984f, 0.458069f, 0.458154f, 0.458239f, 0.458325f, 0.458410f,
- 0.458495f, 0.458580f, 0.458665f, 0.458751f, 0.458836f, 0.458921f, 0.459006f, 0.459091f,
- 0.459177f, 0.459262f, 0.459347f, 0.459432f, 0.459517f, 0.459602f, 0.459687f, 0.459773f,
- 0.459858f, 0.459943f, 0.460028f, 0.460113f, 0.460198f, 0.460283f, 0.460369f, 0.460454f,
- 0.460539f, 0.460624f, 0.460709f, 0.460794f, 0.460879f, 0.460964f, 0.461049f, 0.461134f,
- 0.461219f, 0.461304f, 0.461390f, 0.461475f, 0.461560f, 0.461645f, 0.461730f, 0.461815f,
- 0.461900f, 0.461985f, 0.462070f, 0.462155f, 0.462240f, 0.462325f, 0.462410f, 0.462495f,
- 0.462580f, 0.462665f, 0.462750f, 0.462835f, 0.462920f, 0.463005f, 0.463090f, 0.463175f,
- 0.463260f, 0.463345f, 0.463430f, 0.463515f, 0.463600f, 0.463685f, 0.463769f, 0.463854f,
- 0.463939f, 0.464024f, 0.464109f, 0.464194f, 0.464279f, 0.464364f, 0.464449f, 0.464534f,
- 0.464619f, 0.464704f, 0.464788f, 0.464873f, 0.464958f, 0.465043f, 0.465128f, 0.465213f,
- 0.465298f, 0.465383f, 0.465467f, 0.465552f, 0.465637f, 0.465722f, 0.465807f, 0.465892f,
- 0.465977f, 0.466061f, 0.466146f, 0.466231f, 0.466316f, 0.466401f, 0.466485f, 0.466570f,
- 0.466655f, 0.466740f, 0.466825f, 0.466909f, 0.466994f, 0.467079f, 0.467164f, 0.467248f,
- 0.467333f, 0.467418f, 0.467503f, 0.467587f, 0.467672f, 0.467757f, 0.467842f, 0.467926f,
- 0.468011f, 0.468096f, 0.468181f, 0.468265f, 0.468350f, 0.468435f, 0.468519f, 0.468604f,
- 0.468689f, 0.468774f, 0.468858f, 0.468943f, 0.469028f, 0.469112f, 0.469197f, 0.469282f,
- 0.469366f, 0.469451f, 0.469536f, 0.469620f, 0.469705f, 0.469789f, 0.469874f, 0.469959f,
- 0.470043f, 0.470128f, 0.470213f, 0.470297f, 0.470382f, 0.470466f, 0.470551f, 0.470636f,
- 0.470720f, 0.470805f, 0.470889f, 0.470974f, 0.471058f, 0.471143f, 0.471228f, 0.471312f,
- 0.471397f, 0.471481f, 0.471566f, 0.471650f, 0.471735f, 0.471819f, 0.471904f, 0.471988f,
- 0.472073f, 0.472158f, 0.472242f, 0.472327f, 0.472411f, 0.472496f, 0.472580f, 0.472665f,
- 0.472749f, 0.472834f, 0.472918f, 0.473002f, 0.473087f, 0.473171f, 0.473256f, 0.473340f,
- 0.473425f, 0.473509f, 0.473594f, 0.473678f, 0.473763f, 0.473847f, 0.473931f, 0.474016f,
- 0.474100f, 0.474185f, 0.474269f, 0.474353f, 0.474438f, 0.474522f, 0.474607f, 0.474691f,
- 0.474775f, 0.474860f, 0.474944f, 0.475029f, 0.475113f, 0.475197f, 0.475282f, 0.475366f,
- 0.475450f, 0.475535f, 0.475619f, 0.475703f, 0.475788f, 0.475872f, 0.475956f, 0.476041f,
- 0.476125f, 0.476209f, 0.476294f, 0.476378f, 0.476462f, 0.476546f, 0.476631f, 0.476715f,
- 0.476799f, 0.476884f, 0.476968f, 0.477052f, 0.477136f, 0.477221f, 0.477305f, 0.477389f,
- 0.477473f, 0.477558f, 0.477642f, 0.477726f, 0.477810f, 0.477894f, 0.477979f, 0.478063f,
- 0.478147f, 0.478231f, 0.478315f, 0.478400f, 0.478484f, 0.478568f, 0.478652f, 0.478736f,
- 0.478821f, 0.478905f, 0.478989f, 0.479073f, 0.479157f, 0.479241f, 0.479325f, 0.479410f,
- 0.479494f, 0.479578f, 0.479662f, 0.479746f, 0.479830f, 0.479914f, 0.479998f, 0.480083f,
- 0.480167f, 0.480251f, 0.480335f, 0.480419f, 0.480503f, 0.480587f, 0.480671f, 0.480755f,
- 0.480839f, 0.480923f, 0.481007f, 0.481091f, 0.481176f, 0.481260f, 0.481344f, 0.481428f,
- 0.481512f, 0.481596f, 0.481680f, 0.481764f, 0.481848f, 0.481932f, 0.482016f, 0.482100f,
- 0.482184f, 0.482268f, 0.482352f, 0.482436f, 0.482520f, 0.482604f, 0.482688f, 0.482772f,
- 0.482856f, 0.482940f, 0.483023f, 0.483107f, 0.483191f, 0.483275f, 0.483359f, 0.483443f,
- 0.483527f, 0.483611f, 0.483695f, 0.483779f, 0.483863f, 0.483947f, 0.484031f, 0.484114f,
- 0.484198f, 0.484282f, 0.484366f, 0.484450f, 0.484534f, 0.484618f, 0.484702f, 0.484785f,
- 0.484869f, 0.484953f, 0.485037f, 0.485121f, 0.485205f, 0.485288f, 0.485372f, 0.485456f,
- 0.485540f, 0.485624f, 0.485708f, 0.485791f, 0.485875f, 0.485959f, 0.486043f, 0.486126f,
- 0.486210f, 0.486294f, 0.486378f, 0.486462f, 0.486545f, 0.486629f, 0.486713f, 0.486797f,
- 0.486880f, 0.486964f, 0.487048f, 0.487132f, 0.487215f, 0.487299f, 0.487383f, 0.487466f,
- 0.487550f, 0.487634f, 0.487718f, 0.487801f, 0.487885f, 0.487969f, 0.488052f, 0.488136f,
- 0.488220f, 0.488303f, 0.488387f, 0.488471f, 0.488554f, 0.488638f, 0.488722f, 0.488805f,
- 0.488889f, 0.488973f, 0.489056f, 0.489140f, 0.489223f, 0.489307f, 0.489391f, 0.489474f,
- 0.489558f, 0.489641f, 0.489725f, 0.489809f, 0.489892f, 0.489976f, 0.490059f, 0.490143f,
- 0.490226f, 0.490310f, 0.490394f, 0.490477f, 0.490561f, 0.490644f, 0.490728f, 0.490811f,
- 0.490895f, 0.490978f, 0.491062f, 0.491145f, 0.491229f, 0.491312f, 0.491396f, 0.491479f,
- 0.491563f, 0.491646f, 0.491730f, 0.491813f, 0.491897f, 0.491980f, 0.492064f, 0.492147f,
- 0.492231f, 0.492314f, 0.492398f, 0.492481f, 0.492564f, 0.492648f, 0.492731f, 0.492815f,
- 0.492898f, 0.492982f, 0.493065f, 0.493148f, 0.493232f, 0.493315f, 0.493399f, 0.493482f,
- 0.493565f, 0.493649f, 0.493732f, 0.493816f, 0.493899f, 0.493982f, 0.494066f, 0.494149f,
- 0.494232f, 0.494316f, 0.494399f, 0.494482f, 0.494566f, 0.494649f, 0.494732f, 0.494816f,
- 0.494899f, 0.494982f, 0.495066f, 0.495149f, 0.495232f, 0.495315f, 0.495399f, 0.495482f,
- 0.495565f, 0.495649f, 0.495732f, 0.495815f, 0.495898f, 0.495982f, 0.496065f, 0.496148f,
- 0.496231f, 0.496315f, 0.496398f, 0.496481f, 0.496564f, 0.496647f, 0.496731f, 0.496814f,
- 0.496897f, 0.496980f, 0.497063f, 0.497147f, 0.497230f, 0.497313f, 0.497396f, 0.497479f,
- 0.497562f, 0.497646f, 0.497729f, 0.497812f, 0.497895f, 0.497978f, 0.498061f, 0.498145f,
- 0.498228f, 0.498311f, 0.498394f, 0.498477f, 0.498560f, 0.498643f, 0.498726f, 0.498809f,
- 0.498893f, 0.498976f, 0.499059f, 0.499142f, 0.499225f, 0.499308f, 0.499391f, 0.499474f,
- 0.499557f, 0.499640f, 0.499723f, 0.499806f, 0.499889f, 0.499972f, 0.500055f, 0.500138f,
- 0.500221f, 0.500304f, 0.500387f, 0.500470f, 0.500553f, 0.500636f, 0.500719f, 0.500802f,
- 0.500885f, 0.500968f, 0.501051f, 0.501134f, 0.501217f, 0.501300f, 0.501383f, 0.501466f,
- 0.501549f, 0.501632f, 0.501715f, 0.501798f, 0.501881f, 0.501964f, 0.502047f, 0.502130f,
- 0.502212f, 0.502295f, 0.502378f, 0.502461f, 0.502544f, 0.502627f, 0.502710f, 0.502793f,
- 0.502876f, 0.502958f, 0.503041f, 0.503124f, 0.503207f, 0.503290f, 0.503373f, 0.503456f,
- 0.503538f, 0.503621f, 0.503704f, 0.503787f, 0.503870f, 0.503953f, 0.504035f, 0.504118f,
- 0.504201f, 0.504284f, 0.504366f, 0.504449f, 0.504532f, 0.504615f, 0.504698f, 0.504780f,
- 0.504863f, 0.504946f, 0.505029f, 0.505111f, 0.505194f, 0.505277f, 0.505360f, 0.505442f,
- 0.505525f, 0.505608f, 0.505690f, 0.505773f, 0.505856f, 0.505939f, 0.506021f, 0.506104f,
- 0.506187f, 0.506269f, 0.506352f, 0.506435f, 0.506517f, 0.506600f, 0.506683f, 0.506765f,
- 0.506848f, 0.506931f, 0.507013f, 0.507096f, 0.507179f, 0.507261f, 0.507344f, 0.507426f,
- 0.507509f, 0.507592f, 0.507674f, 0.507757f, 0.507839f, 0.507922f, 0.508005f, 0.508087f,
- 0.508170f, 0.508252f, 0.508335f, 0.508417f, 0.508500f, 0.508583f, 0.508665f, 0.508748f,
- 0.508830f, 0.508913f, 0.508995f, 0.509078f, 0.509160f, 0.509243f, 0.509325f, 0.509408f,
- 0.509490f, 0.509573f, 0.509655f, 0.509738f, 0.509820f, 0.509903f, 0.509985f, 0.510068f,
- 0.510150f, 0.510233f, 0.510315f, 0.510397f, 0.510480f, 0.510562f, 0.510645f, 0.510727f,
- 0.510810f, 0.510892f, 0.510974f, 0.511057f, 0.511139f, 0.511222f, 0.511304f, 0.511386f,
- 0.511469f, 0.511551f, 0.511634f, 0.511716f, 0.511798f, 0.511881f, 0.511963f, 0.512045f,
- 0.512128f, 0.512210f, 0.512292f, 0.512375f, 0.512457f, 0.512539f, 0.512622f, 0.512704f,
- 0.512786f, 0.512869f, 0.512951f, 0.513033f, 0.513116f, 0.513198f, 0.513280f, 0.513362f,
- 0.513445f, 0.513527f, 0.513609f, 0.513692f, 0.513774f, 0.513856f, 0.513938f, 0.514021f,
- 0.514103f, 0.514185f, 0.514267f, 0.514349f, 0.514432f, 0.514514f, 0.514596f, 0.514678f,
- 0.514760f, 0.514843f, 0.514925f, 0.515007f, 0.515089f, 0.515171f, 0.515254f, 0.515336f,
- 0.515418f, 0.515500f, 0.515582f, 0.515664f, 0.515746f, 0.515829f, 0.515911f, 0.515993f,
- 0.516075f, 0.516157f, 0.516239f, 0.516321f, 0.516403f, 0.516486f, 0.516568f, 0.516650f,
- 0.516732f, 0.516814f, 0.516896f, 0.516978f, 0.517060f, 0.517142f, 0.517224f, 0.517306f,
- 0.517388f, 0.517470f, 0.517552f, 0.517634f, 0.517716f, 0.517798f, 0.517880f, 0.517963f,
- 0.518045f, 0.518126f, 0.518209f, 0.518291f, 0.518372f, 0.518454f, 0.518536f, 0.518618f,
- 0.518700f, 0.518782f, 0.518864f, 0.518946f, 0.519028f, 0.519110f, 0.519192f, 0.519274f,
- 0.519356f, 0.519438f, 0.519520f, 0.519602f, 0.519684f, 0.519766f, 0.519848f, 0.519929f,
- 0.520011f, 0.520093f, 0.520175f, 0.520257f, 0.520339f, 0.520421f, 0.520503f, 0.520584f,
- 0.520666f, 0.520748f, 0.520830f, 0.520912f, 0.520994f, 0.521075f, 0.521157f, 0.521239f,
- 0.521321f, 0.521403f, 0.521485f, 0.521566f, 0.521648f, 0.521730f, 0.521812f, 0.521894f,
- 0.521975f, 0.522057f, 0.522139f, 0.522221f, 0.522302f, 0.522384f, 0.522466f, 0.522548f,
- 0.522629f, 0.522711f, 0.522793f, 0.522875f, 0.522956f, 0.523038f, 0.523120f, 0.523201f,
- 0.523283f, 0.523365f, 0.523447f, 0.523528f, 0.523610f, 0.523692f, 0.523773f, 0.523855f,
- 0.523937f, 0.524018f, 0.524100f, 0.524181f, 0.524263f, 0.524345f, 0.524426f, 0.524508f,
- 0.524590f, 0.524671f, 0.524753f, 0.524835f, 0.524916f, 0.524998f, 0.525079f, 0.525161f,
- 0.525243f, 0.525324f, 0.525406f, 0.525487f, 0.525569f, 0.525650f, 0.525732f, 0.525813f,
- 0.525895f, 0.525977f, 0.526058f, 0.526140f, 0.526221f, 0.526303f, 0.526384f, 0.526466f,
- 0.526547f, 0.526629f, 0.526710f, 0.526792f, 0.526873f, 0.526955f, 0.527036f, 0.527118f,
- 0.527199f, 0.527281f, 0.527362f, 0.527444f, 0.527525f, 0.527606f, 0.527688f, 0.527769f,
- 0.527851f, 0.527932f, 0.528014f, 0.528095f, 0.528176f, 0.528258f, 0.528339f, 0.528421f,
- 0.528502f, 0.528583f, 0.528665f, 0.528746f, 0.528828f, 0.528909f, 0.528990f, 0.529072f,
- 0.529153f, 0.529234f, 0.529316f, 0.529397f, 0.529478f, 0.529560f, 0.529641f, 0.529722f,
- 0.529804f, 0.529885f, 0.529966f, 0.530048f, 0.530129f, 0.530210f, 0.530291f, 0.530373f,
- 0.530454f, 0.530535f, 0.530617f, 0.530698f, 0.530779f, 0.530860f, 0.530942f, 0.531023f,
- 0.531104f, 0.531185f, 0.531266f, 0.531348f, 0.531429f, 0.531510f, 0.531591f, 0.531673f,
- 0.531754f, 0.531835f, 0.531916f, 0.531997f, 0.532078f, 0.532160f, 0.532241f, 0.532322f,
- 0.532403f, 0.532484f, 0.532565f, 0.532647f, 0.532728f, 0.532809f, 0.532890f, 0.532971f,
- 0.533052f, 0.533133f, 0.533214f, 0.533296f, 0.533377f, 0.533458f, 0.533539f, 0.533620f,
- 0.533701f, 0.533782f, 0.533863f, 0.533944f, 0.534025f, 0.534106f, 0.534187f, 0.534268f,
- 0.534349f, 0.534431f, 0.534512f, 0.534593f, 0.534674f, 0.534755f, 0.534836f, 0.534917f,
- 0.534998f, 0.535079f, 0.535160f, 0.535241f, 0.535322f, 0.535403f, 0.535484f, 0.535564f,
- 0.535645f, 0.535726f, 0.535807f, 0.535888f, 0.535969f, 0.536050f, 0.536131f, 0.536212f,
- 0.536293f, 0.536374f, 0.536455f, 0.536536f, 0.536617f, 0.536698f, 0.536778f, 0.536859f,
- 0.536940f, 0.537021f, 0.537102f, 0.537183f, 0.537264f, 0.537345f, 0.537425f, 0.537506f,
- 0.537587f, 0.537668f, 0.537749f, 0.537830f, 0.537910f, 0.537991f, 0.538072f, 0.538153f,
- 0.538234f, 0.538314f, 0.538395f, 0.538476f, 0.538557f, 0.538638f, 0.538718f, 0.538799f,
- 0.538880f, 0.538961f, 0.539041f, 0.539122f, 0.539203f, 0.539284f, 0.539364f, 0.539445f,
- 0.539526f, 0.539607f, 0.539687f, 0.539768f, 0.539849f, 0.539929f, 0.540010f, 0.540091f,
- 0.540171f, 0.540252f, 0.540333f, 0.540413f, 0.540494f, 0.540575f, 0.540655f, 0.540736f,
- 0.540817f, 0.540897f, 0.540978f, 0.541059f, 0.541139f, 0.541220f, 0.541301f, 0.541381f,
- 0.541462f, 0.541542f, 0.541623f, 0.541704f, 0.541784f, 0.541865f, 0.541945f, 0.542026f,
- 0.542106f, 0.542187f, 0.542268f, 0.542348f, 0.542429f, 0.542509f, 0.542590f, 0.542670f,
- 0.542751f, 0.542831f, 0.542912f, 0.542992f, 0.543073f, 0.543153f, 0.543234f, 0.543314f,
- 0.543395f, 0.543475f, 0.543556f, 0.543636f, 0.543717f, 0.543797f, 0.543878f, 0.543958f,
- 0.544039f, 0.544119f, 0.544199f, 0.544280f, 0.544360f, 0.544441f, 0.544521f, 0.544602f,
- 0.544682f, 0.544762f, 0.544843f, 0.544923f, 0.545003f, 0.545084f, 0.545164f, 0.545245f,
- 0.545325f, 0.545405f, 0.545486f, 0.545566f, 0.545646f, 0.545727f, 0.545807f, 0.545887f,
- 0.545968f, 0.546048f, 0.546128f, 0.546209f, 0.546289f, 0.546369f, 0.546450f, 0.546530f,
- 0.546610f, 0.546690f, 0.546771f, 0.546851f, 0.546931f, 0.547011f, 0.547092f, 0.547172f,
- 0.547252f, 0.547333f, 0.547413f, 0.547493f, 0.547573f, 0.547653f, 0.547734f, 0.547814f,
- 0.547894f, 0.547974f, 0.548054f, 0.548135f, 0.548215f, 0.548295f, 0.548375f, 0.548455f,
- 0.548536f, 0.548616f, 0.548696f, 0.548776f, 0.548856f, 0.548936f, 0.549016f, 0.549097f,
- 0.549177f, 0.549257f, 0.549337f, 0.549417f, 0.549497f, 0.549577f, 0.549657f, 0.549737f,
- 0.549818f, 0.549898f, 0.549978f, 0.550058f, 0.550138f, 0.550218f, 0.550298f, 0.550378f,
- 0.550458f, 0.550538f, 0.550618f, 0.550698f, 0.550778f, 0.550858f, 0.550938f, 0.551018f,
- 0.551098f, 0.551178f, 0.551258f, 0.551338f, 0.551418f, 0.551498f, 0.551578f, 0.551658f,
- 0.551738f, 0.551818f, 0.551898f, 0.551978f, 0.552058f, 0.552138f, 0.552218f, 0.552298f,
- 0.552378f, 0.552457f, 0.552537f, 0.552617f, 0.552697f, 0.552777f, 0.552857f, 0.552937f,
- 0.553017f, 0.553097f, 0.553176f, 0.553256f, 0.553336f, 0.553416f, 0.553496f, 0.553576f,
- 0.553656f, 0.553735f, 0.553815f, 0.553895f, 0.553975f, 0.554055f, 0.554134f, 0.554214f,
- 0.554294f, 0.554374f, 0.554454f, 0.554533f, 0.554613f, 0.554693f, 0.554773f, 0.554853f,
- 0.554932f, 0.555012f, 0.555092f, 0.555172f, 0.555251f, 0.555331f, 0.555411f, 0.555490f,
- 0.555570f, 0.555650f, 0.555730f, 0.555809f, 0.555889f, 0.555969f, 0.556048f, 0.556128f,
- 0.556208f, 0.556287f, 0.556367f, 0.556447f, 0.556526f, 0.556606f, 0.556686f, 0.556765f,
- 0.556845f, 0.556925f, 0.557004f, 0.557084f, 0.557164f, 0.557243f, 0.557323f, 0.557402f,
- 0.557482f, 0.557562f, 0.557641f, 0.557721f, 0.557800f, 0.557880f, 0.557959f, 0.558039f,
- 0.558119f, 0.558198f, 0.558278f, 0.558357f, 0.558437f, 0.558516f, 0.558596f, 0.558675f,
- 0.558755f, 0.558834f, 0.558914f, 0.558993f, 0.559073f, 0.559152f, 0.559232f, 0.559311f,
- 0.559391f, 0.559470f, 0.559550f, 0.559629f, 0.559709f, 0.559788f, 0.559867f, 0.559947f,
- 0.560026f, 0.560106f, 0.560185f, 0.560265f, 0.560344f, 0.560423f, 0.560503f, 0.560582f,
- 0.560662f, 0.560741f, 0.560820f, 0.560900f, 0.560979f, 0.561058f, 0.561138f, 0.561217f,
- 0.561297f, 0.561376f, 0.561455f, 0.561535f, 0.561614f, 0.561693f, 0.561773f, 0.561852f,
- 0.561931f, 0.562010f, 0.562090f, 0.562169f, 0.562248f, 0.562328f, 0.562407f, 0.562486f,
- 0.562565f, 0.562645f, 0.562724f, 0.562803f, 0.562882f, 0.562962f, 0.563041f, 0.563120f,
- 0.563199f, 0.563279f, 0.563358f, 0.563437f, 0.563516f, 0.563595f, 0.563675f, 0.563754f,
- 0.563833f, 0.563912f, 0.563991f, 0.564070f, 0.564150f, 0.564229f, 0.564308f, 0.564387f,
- 0.564466f, 0.564545f, 0.564624f, 0.564704f, 0.564783f, 0.564862f, 0.564941f, 0.565020f,
- 0.565099f, 0.565178f, 0.565257f, 0.565336f, 0.565416f, 0.565495f, 0.565574f, 0.565653f,
- 0.565732f, 0.565811f, 0.565890f, 0.565969f, 0.566048f, 0.566127f, 0.566206f, 0.566285f,
- 0.566364f, 0.566443f, 0.566522f, 0.566601f, 0.566680f, 0.566759f, 0.566838f, 0.566917f,
- 0.566996f, 0.567075f, 0.567154f, 0.567233f, 0.567312f, 0.567391f, 0.567470f, 0.567549f,
- 0.567628f, 0.567707f, 0.567786f, 0.567864f, 0.567943f, 0.568022f, 0.568101f, 0.568180f,
- 0.568259f, 0.568338f, 0.568417f, 0.568496f, 0.568574f, 0.568653f, 0.568732f, 0.568811f,
- 0.568890f, 0.568969f, 0.569048f, 0.569126f, 0.569205f, 0.569284f, 0.569363f, 0.569442f,
- 0.569521f, 0.569599f, 0.569678f, 0.569757f, 0.569836f, 0.569914f, 0.569993f, 0.570072f,
- 0.570151f, 0.570230f, 0.570308f, 0.570387f, 0.570466f, 0.570545f, 0.570623f, 0.570702f,
- 0.570781f, 0.570859f, 0.570938f, 0.571017f, 0.571096f, 0.571174f, 0.571253f, 0.571332f,
- 0.571410f, 0.571489f, 0.571568f, 0.571646f, 0.571725f, 0.571804f, 0.571882f, 0.571961f,
- 0.572040f, 0.572118f, 0.572197f, 0.572276f, 0.572354f, 0.572433f, 0.572511f, 0.572590f,
- 0.572669f, 0.572747f, 0.572826f, 0.572904f, 0.572983f, 0.573061f, 0.573140f, 0.573219f,
- 0.573297f, 0.573376f, 0.573454f, 0.573533f, 0.573611f, 0.573690f, 0.573768f, 0.573847f,
- 0.573925f, 0.574004f, 0.574082f, 0.574161f, 0.574239f, 0.574318f, 0.574396f, 0.574475f,
- 0.574553f, 0.574632f, 0.574710f, 0.574789f, 0.574867f, 0.574946f, 0.575024f, 0.575103f,
- 0.575181f, 0.575259f, 0.575338f, 0.575416f, 0.575495f, 0.575573f, 0.575651f, 0.575730f,
- 0.575808f, 0.575887f, 0.575965f, 0.576043f, 0.576122f, 0.576200f, 0.576278f, 0.576357f,
- 0.576435f, 0.576513f, 0.576592f, 0.576670f, 0.576748f, 0.576827f, 0.576905f, 0.576983f,
- 0.577062f, 0.577140f, 0.577218f, 0.577297f, 0.577375f, 0.577453f, 0.577531f, 0.577610f,
- 0.577688f, 0.577766f, 0.577844f, 0.577923f, 0.578001f, 0.578079f, 0.578157f, 0.578236f,
- 0.578314f, 0.578392f, 0.578470f, 0.578548f, 0.578627f, 0.578705f, 0.578783f, 0.578861f,
- 0.578939f, 0.579018f, 0.579096f, 0.579174f, 0.579252f, 0.579330f, 0.579408f, 0.579486f,
- 0.579565f, 0.579643f, 0.579721f, 0.579799f, 0.579877f, 0.579955f, 0.580033f, 0.580111f,
- 0.580189f, 0.580267f, 0.580346f, 0.580424f, 0.580502f, 0.580580f, 0.580658f, 0.580736f,
- 0.580814f, 0.580892f, 0.580970f, 0.581048f, 0.581126f, 0.581204f, 0.581282f, 0.581360f,
- 0.581438f, 0.581516f, 0.581594f, 0.581672f, 0.581750f, 0.581828f, 0.581906f, 0.581984f,
- 0.582062f, 0.582140f, 0.582218f, 0.582296f, 0.582374f, 0.582452f, 0.582530f, 0.582608f,
- 0.582685f, 0.582763f, 0.582841f, 0.582919f, 0.582997f, 0.583075f, 0.583153f, 0.583231f,
- 0.583309f, 0.583387f, 0.583464f, 0.583542f, 0.583620f, 0.583698f, 0.583776f, 0.583854f,
- 0.583931f, 0.584009f, 0.584087f, 0.584165f, 0.584243f, 0.584321f, 0.584398f, 0.584476f,
- 0.584554f, 0.584632f, 0.584710f, 0.584787f, 0.584865f, 0.584943f, 0.585021f, 0.585098f,
- 0.585176f, 0.585254f, 0.585332f, 0.585409f, 0.585487f, 0.585565f, 0.585642f, 0.585720f,
- 0.585798f, 0.585876f, 0.585953f, 0.586031f, 0.586109f, 0.586186f, 0.586264f, 0.586342f,
- 0.586419f, 0.586497f, 0.586575f, 0.586652f, 0.586730f, 0.586808f, 0.586885f, 0.586963f,
- 0.587040f, 0.587118f, 0.587196f, 0.587273f, 0.587351f, 0.587428f, 0.587506f, 0.587584f,
- 0.587661f, 0.587739f, 0.587816f, 0.587894f, 0.587971f, 0.588049f, 0.588126f, 0.588204f,
- 0.588282f, 0.588359f, 0.588437f, 0.588514f, 0.588592f, 0.588669f, 0.588747f, 0.588824f,
- 0.588902f, 0.588979f, 0.589057f, 0.589134f, 0.589212f, 0.589289f, 0.589366f, 0.589444f,
- 0.589521f, 0.589599f, 0.589676f, 0.589754f, 0.589831f, 0.589908f, 0.589986f, 0.590063f,
- 0.590141f, 0.590218f, 0.590295f, 0.590373f, 0.590450f, 0.590528f, 0.590605f, 0.590682f,
- 0.590760f, 0.590837f, 0.590914f, 0.590992f, 0.591069f, 0.591146f, 0.591224f, 0.591301f,
- 0.591378f, 0.591456f, 0.591533f, 0.591610f, 0.591688f, 0.591765f, 0.591842f, 0.591919f,
- 0.591997f, 0.592074f, 0.592151f, 0.592228f, 0.592306f, 0.592383f, 0.592460f, 0.592537f,
- 0.592615f, 0.592692f, 0.592769f, 0.592846f, 0.592924f, 0.593001f, 0.593078f, 0.593155f,
- 0.593232f, 0.593309f, 0.593387f, 0.593464f, 0.593541f, 0.593618f, 0.593695f, 0.593772f,
- 0.593850f, 0.593927f, 0.594004f, 0.594081f, 0.594158f, 0.594235f, 0.594312f, 0.594389f,
- 0.594467f, 0.594544f, 0.594621f, 0.594698f, 0.594775f, 0.594852f, 0.594929f, 0.595006f,
- 0.595083f, 0.595160f, 0.595237f, 0.595314f, 0.595391f, 0.595468f, 0.595545f, 0.595622f,
- 0.595699f, 0.595776f, 0.595853f, 0.595930f, 0.596007f, 0.596084f, 0.596161f, 0.596238f,
- 0.596315f, 0.596392f, 0.596469f, 0.596546f, 0.596623f, 0.596700f, 0.596777f, 0.596854f,
- 0.596931f, 0.597008f, 0.597085f, 0.597161f, 0.597238f, 0.597315f, 0.597392f, 0.597469f,
- 0.597546f, 0.597623f, 0.597700f, 0.597776f, 0.597853f, 0.597930f, 0.598007f, 0.598084f,
- 0.598161f, 0.598238f, 0.598314f, 0.598391f, 0.598468f, 0.598545f, 0.598622f, 0.598698f,
- 0.598775f, 0.598852f, 0.598929f, 0.599006f, 0.599082f, 0.599159f, 0.599236f, 0.599313f,
- 0.599389f, 0.599466f, 0.599543f, 0.599620f, 0.599696f, 0.599773f, 0.599850f, 0.599926f,
- 0.600003f, 0.600080f, 0.600156f, 0.600233f, 0.600310f, 0.600387f, 0.600463f, 0.600540f,
- 0.600616f, 0.600693f, 0.600770f, 0.600846f, 0.600923f, 0.601000f, 0.601076f, 0.601153f,
- 0.601230f, 0.601306f, 0.601383f, 0.601459f, 0.601536f, 0.601613f, 0.601689f, 0.601766f,
- 0.601842f, 0.601919f, 0.601995f, 0.602072f, 0.602148f, 0.602225f, 0.602302f, 0.602378f,
- 0.602455f, 0.602531f, 0.602608f, 0.602684f, 0.602761f, 0.602837f, 0.602914f, 0.602990f,
- 0.603067f, 0.603143f, 0.603220f, 0.603296f, 0.603372f, 0.603449f, 0.603525f, 0.603602f,
- 0.603678f, 0.603755f, 0.603831f, 0.603908f, 0.603984f, 0.604060f, 0.604137f, 0.604213f,
- 0.604290f, 0.604366f, 0.604442f, 0.604519f, 0.604595f, 0.604671f, 0.604748f, 0.604824f,
- 0.604900f, 0.604977f, 0.605053f, 0.605129f, 0.605206f, 0.605282f, 0.605358f, 0.605435f,
- 0.605511f, 0.605587f, 0.605664f, 0.605740f, 0.605816f, 0.605892f, 0.605969f, 0.606045f,
- 0.606121f, 0.606198f, 0.606274f, 0.606350f, 0.606426f, 0.606502f, 0.606579f, 0.606655f,
- 0.606731f, 0.606807f, 0.606884f, 0.606960f, 0.607036f, 0.607112f, 0.607188f, 0.607264f,
- 0.607341f, 0.607417f, 0.607493f, 0.607569f, 0.607645f, 0.607721f, 0.607798f, 0.607874f,
- 0.607950f, 0.608026f, 0.608102f, 0.608178f, 0.608254f, 0.608330f, 0.608406f, 0.608482f,
- 0.608559f, 0.608635f, 0.608711f, 0.608787f, 0.608863f, 0.608939f, 0.609015f, 0.609091f,
- 0.609167f, 0.609243f, 0.609319f, 0.609395f, 0.609471f, 0.609547f, 0.609623f, 0.609699f,
- 0.609775f, 0.609851f, 0.609927f, 0.610003f, 0.610079f, 0.610155f, 0.610231f, 0.610307f,
- 0.610383f, 0.610459f, 0.610535f, 0.610611f, 0.610687f, 0.610762f, 0.610838f, 0.610914f,
- 0.610990f, 0.611066f, 0.611142f, 0.611218f, 0.611294f, 0.611370f, 0.611445f, 0.611521f,
- 0.611597f, 0.611673f, 0.611749f, 0.611825f, 0.611901f, 0.611976f, 0.612052f, 0.612128f,
- 0.612204f, 0.612280f, 0.612355f, 0.612431f, 0.612507f, 0.612583f, 0.612659f, 0.612734f,
- 0.612810f, 0.612886f, 0.612962f, 0.613037f, 0.613113f, 0.613189f, 0.613265f, 0.613340f,
- 0.613416f, 0.613492f, 0.613567f, 0.613643f, 0.613719f, 0.613795f, 0.613870f, 0.613946f,
- 0.614022f, 0.614097f, 0.614173f, 0.614249f, 0.614324f, 0.614400f, 0.614475f, 0.614551f,
- 0.614627f, 0.614702f, 0.614778f, 0.614854f, 0.614929f, 0.615005f, 0.615080f, 0.615156f,
- 0.615232f, 0.615307f, 0.615383f, 0.615458f, 0.615534f, 0.615609f, 0.615685f, 0.615761f,
- 0.615836f, 0.615912f, 0.615987f, 0.616063f, 0.616138f, 0.616214f, 0.616289f, 0.616365f,
- 0.616440f, 0.616516f, 0.616591f, 0.616667f, 0.616742f, 0.616818f, 0.616893f, 0.616968f,
- 0.617044f, 0.617119f, 0.617195f, 0.617270f, 0.617346f, 0.617421f, 0.617496f, 0.617572f,
- 0.617647f, 0.617723f, 0.617798f, 0.617873f, 0.617949f, 0.618024f, 0.618100f, 0.618175f,
- 0.618250f, 0.618326f, 0.618401f, 0.618476f, 0.618552f, 0.618627f, 0.618702f, 0.618778f,
- 0.618853f, 0.618928f, 0.619004f, 0.619079f, 0.619154f, 0.619229f, 0.619305f, 0.619380f,
- 0.619455f, 0.619531f, 0.619606f, 0.619681f, 0.619756f, 0.619832f, 0.619907f, 0.619982f,
- 0.620057f, 0.620132f, 0.620208f, 0.620283f, 0.620358f, 0.620433f, 0.620508f, 0.620584f,
- 0.620659f, 0.620734f, 0.620809f, 0.620884f, 0.620959f, 0.621035f, 0.621110f, 0.621185f,
- 0.621260f, 0.621335f, 0.621410f, 0.621485f, 0.621560f, 0.621636f, 0.621711f, 0.621786f,
- 0.621861f, 0.621936f, 0.622011f, 0.622086f, 0.622161f, 0.622236f, 0.622311f, 0.622386f,
- 0.622461f, 0.622536f, 0.622611f, 0.622686f, 0.622761f, 0.622836f, 0.622911f, 0.622986f,
- 0.623061f, 0.623136f, 0.623211f, 0.623286f, 0.623361f, 0.623436f, 0.623511f, 0.623586f,
- 0.623661f, 0.623736f, 0.623811f, 0.623886f, 0.623961f, 0.624036f, 0.624111f, 0.624186f,
- 0.624260f, 0.624335f, 0.624410f, 0.624485f, 0.624560f, 0.624635f, 0.624710f, 0.624785f,
- 0.624860f, 0.624934f, 0.625009f, 0.625084f, 0.625159f, 0.625234f, 0.625309f, 0.625383f,
- 0.625458f, 0.625533f, 0.625608f, 0.625683f, 0.625757f, 0.625832f, 0.625907f, 0.625982f,
- 0.626056f, 0.626131f, 0.626206f, 0.626281f, 0.626355f, 0.626430f, 0.626505f, 0.626580f,
- 0.626654f, 0.626729f, 0.626804f, 0.626878f, 0.626953f, 0.627028f, 0.627102f, 0.627177f,
- 0.627252f, 0.627326f, 0.627401f, 0.627476f, 0.627550f, 0.627625f, 0.627700f, 0.627774f,
- 0.627849f, 0.627924f, 0.627998f, 0.628073f, 0.628147f, 0.628222f, 0.628297f, 0.628371f,
- 0.628446f, 0.628520f, 0.628595f, 0.628669f, 0.628744f, 0.628819f, 0.628893f, 0.628968f,
- 0.629042f, 0.629117f, 0.629191f, 0.629266f, 0.629340f, 0.629415f, 0.629489f, 0.629564f,
- 0.629638f, 0.629713f, 0.629787f, 0.629862f, 0.629936f, 0.630011f, 0.630085f, 0.630159f,
- 0.630234f, 0.630308f, 0.630383f, 0.630457f, 0.630532f, 0.630606f, 0.630680f, 0.630755f,
- 0.630829f, 0.630904f, 0.630978f, 0.631052f, 0.631127f, 0.631201f, 0.631275f, 0.631350f,
- 0.631424f, 0.631499f, 0.631573f, 0.631647f, 0.631721f, 0.631796f, 0.631870f, 0.631944f,
- 0.632019f, 0.632093f, 0.632167f, 0.632242f, 0.632316f, 0.632390f, 0.632464f, 0.632539f,
- 0.632613f, 0.632687f, 0.632761f, 0.632836f, 0.632910f, 0.632984f, 0.633058f, 0.633133f,
- 0.633207f, 0.633281f, 0.633355f, 0.633429f, 0.633504f, 0.633578f, 0.633652f, 0.633726f,
- 0.633800f, 0.633874f, 0.633949f, 0.634023f, 0.634097f, 0.634171f, 0.634245f, 0.634319f,
- 0.634393f, 0.634467f, 0.634542f, 0.634616f, 0.634690f, 0.634764f, 0.634838f, 0.634912f,
- 0.634986f, 0.635060f, 0.635134f, 0.635208f, 0.635282f, 0.635356f, 0.635430f, 0.635504f,
- 0.635578f, 0.635652f, 0.635726f, 0.635800f, 0.635874f, 0.635948f, 0.636022f, 0.636096f,
- 0.636170f, 0.636244f, 0.636318f, 0.636392f, 0.636466f, 0.636540f, 0.636614f, 0.636688f,
- 0.636762f, 0.636836f, 0.636910f, 0.636984f, 0.637057f, 0.637131f, 0.637205f, 0.637279f,
- 0.637353f, 0.637427f, 0.637501f, 0.637575f, 0.637649f, 0.637722f, 0.637796f, 0.637870f,
- 0.637944f, 0.638018f, 0.638092f, 0.638165f, 0.638239f, 0.638313f, 0.638387f, 0.638461f,
- 0.638534f, 0.638608f, 0.638682f, 0.638756f, 0.638829f, 0.638903f, 0.638977f, 0.639051f,
- 0.639124f, 0.639198f, 0.639272f, 0.639346f, 0.639419f, 0.639493f, 0.639567f, 0.639640f,
- 0.639714f, 0.639788f, 0.639862f, 0.639935f, 0.640009f, 0.640083f, 0.640156f, 0.640230f,
- 0.640303f, 0.640377f, 0.640451f, 0.640524f, 0.640598f, 0.640672f, 0.640745f, 0.640819f,
- 0.640892f, 0.640966f, 0.641040f, 0.641113f, 0.641187f, 0.641260f, 0.641334f, 0.641407f,
- 0.641481f, 0.641555f, 0.641628f, 0.641702f, 0.641775f, 0.641849f, 0.641922f, 0.641996f,
- 0.642069f, 0.642143f, 0.642216f, 0.642290f, 0.642363f, 0.642437f, 0.642510f, 0.642584f,
- 0.642657f, 0.642730f, 0.642804f, 0.642877f, 0.642951f, 0.643024f, 0.643098f, 0.643171f,
- 0.643245f, 0.643318f, 0.643391f, 0.643465f, 0.643538f, 0.643611f, 0.643685f, 0.643758f,
- 0.643832f, 0.643905f, 0.643978f, 0.644052f, 0.644125f, 0.644198f, 0.644272f, 0.644345f,
- 0.644418f, 0.644492f, 0.644565f, 0.644638f, 0.644711f, 0.644785f, 0.644858f, 0.644931f,
- 0.645005f, 0.645078f, 0.645151f, 0.645224f, 0.645298f, 0.645371f, 0.645444f, 0.645517f,
- 0.645590f, 0.645664f, 0.645737f, 0.645810f, 0.645883f, 0.645956f, 0.646030f, 0.646103f,
- 0.646176f, 0.646249f, 0.646322f, 0.646396f, 0.646469f, 0.646542f, 0.646615f, 0.646688f,
- 0.646761f, 0.646834f, 0.646907f, 0.646981f, 0.647054f, 0.647127f, 0.647200f, 0.647273f,
- 0.647346f, 0.647419f, 0.647492f, 0.647565f, 0.647638f, 0.647711f, 0.647784f, 0.647857f,
- 0.647930f, 0.648003f, 0.648076f, 0.648149f, 0.648222f, 0.648295f, 0.648368f, 0.648441f,
- 0.648514f, 0.648587f, 0.648660f, 0.648733f, 0.648806f, 0.648879f, 0.648952f, 0.649025f,
- 0.649098f, 0.649171f, 0.649244f, 0.649317f, 0.649390f, 0.649463f, 0.649536f, 0.649608f,
- 0.649681f, 0.649754f, 0.649827f, 0.649900f, 0.649973f, 0.650046f, 0.650119f, 0.650191f,
- 0.650264f, 0.650337f, 0.650410f, 0.650483f, 0.650555f, 0.650628f, 0.650701f, 0.650774f,
- 0.650847f, 0.650919f, 0.650992f, 0.651065f, 0.651138f, 0.651211f, 0.651283f, 0.651356f,
- 0.651429f, 0.651502f, 0.651574f, 0.651647f, 0.651720f, 0.651792f, 0.651865f, 0.651938f,
- 0.652011f, 0.652083f, 0.652156f, 0.652229f, 0.652301f, 0.652374f, 0.652447f, 0.652519f,
- 0.652592f, 0.652665f, 0.652737f, 0.652810f, 0.652882f, 0.652955f, 0.653028f, 0.653100f,
- 0.653173f, 0.653245f, 0.653318f, 0.653391f, 0.653463f, 0.653536f, 0.653608f, 0.653681f,
- 0.653753f, 0.653826f, 0.653899f, 0.653971f, 0.654044f, 0.654116f, 0.654189f, 0.654261f,
- 0.654334f, 0.654406f, 0.654479f, 0.654551f, 0.654624f, 0.654696f, 0.654769f, 0.654841f,
- 0.654913f, 0.654986f, 0.655058f, 0.655131f, 0.655203f, 0.655276f, 0.655348f, 0.655420f,
- 0.655493f, 0.655565f, 0.655638f, 0.655710f, 0.655782f, 0.655855f, 0.655927f, 0.656000f,
- 0.656072f, 0.656144f, 0.656217f, 0.656289f, 0.656361f, 0.656434f, 0.656506f, 0.656578f,
- 0.656651f, 0.656723f, 0.656795f, 0.656867f, 0.656940f, 0.657012f, 0.657084f, 0.657157f,
- 0.657229f, 0.657301f, 0.657373f, 0.657446f, 0.657518f, 0.657590f, 0.657662f, 0.657734f,
- 0.657807f, 0.657879f, 0.657951f, 0.658023f, 0.658095f, 0.658168f, 0.658240f, 0.658312f,
- 0.658384f, 0.658456f, 0.658529f, 0.658601f, 0.658673f, 0.658745f, 0.658817f, 0.658889f,
- 0.658961f, 0.659033f, 0.659105f, 0.659178f, 0.659250f, 0.659322f, 0.659394f, 0.659466f,
- 0.659538f, 0.659610f, 0.659682f, 0.659754f, 0.659826f, 0.659898f, 0.659970f, 0.660042f,
- 0.660114f, 0.660186f, 0.660258f, 0.660330f, 0.660402f, 0.660474f, 0.660546f, 0.660618f,
- 0.660690f, 0.660762f, 0.660834f, 0.660906f, 0.660978f, 0.661050f, 0.661122f, 0.661194f,
- 0.661266f, 0.661338f, 0.661410f, 0.661482f, 0.661553f, 0.661625f, 0.661697f, 0.661769f,
- 0.661841f, 0.661913f, 0.661985f, 0.662057f, 0.662128f, 0.662200f, 0.662272f, 0.662344f,
- 0.662416f, 0.662488f, 0.662559f, 0.662631f, 0.662703f, 0.662775f, 0.662847f, 0.662918f,
- 0.662990f, 0.663062f, 0.663134f, 0.663205f, 0.663277f, 0.663349f, 0.663421f, 0.663492f,
- 0.663564f, 0.663636f, 0.663708f, 0.663779f, 0.663851f, 0.663923f, 0.663994f, 0.664066f,
- 0.664138f, 0.664209f, 0.664281f, 0.664353f, 0.664424f, 0.664496f, 0.664568f, 0.664639f,
- 0.664711f, 0.664783f, 0.664854f, 0.664926f, 0.664997f, 0.665069f, 0.665141f, 0.665212f,
- 0.665284f, 0.665355f, 0.665427f, 0.665498f, 0.665570f, 0.665642f, 0.665713f, 0.665785f,
- 0.665856f, 0.665928f, 0.665999f, 0.666071f, 0.666142f, 0.666214f, 0.666285f, 0.666357f,
- 0.666428f, 0.666500f, 0.666571f, 0.666643f, 0.666714f, 0.666786f, 0.666857f, 0.666928f,
- 0.667000f, 0.667071f, 0.667143f, 0.667214f, 0.667286f, 0.667357f, 0.667428f, 0.667500f,
- 0.667571f, 0.667643f, 0.667714f, 0.667785f, 0.667857f, 0.667928f, 0.667999f, 0.668071f,
- 0.668142f, 0.668213f, 0.668285f, 0.668356f, 0.668427f, 0.668499f, 0.668570f, 0.668641f,
- 0.668712f, 0.668784f, 0.668855f, 0.668926f, 0.668998f, 0.669069f, 0.669140f, 0.669211f,
- 0.669283f, 0.669354f, 0.669425f, 0.669496f, 0.669567f, 0.669639f, 0.669710f, 0.669781f,
- 0.669852f, 0.669923f, 0.669995f, 0.670066f, 0.670137f, 0.670208f, 0.670279f, 0.670350f,
- 0.670422f, 0.670493f, 0.670564f, 0.670635f, 0.670706f, 0.670777f, 0.670848f, 0.670919f,
- 0.670990f, 0.671062f, 0.671133f, 0.671204f, 0.671275f, 0.671346f, 0.671417f, 0.671488f,
- 0.671559f, 0.671630f, 0.671701f, 0.671772f, 0.671843f, 0.671914f, 0.671985f, 0.672056f,
- 0.672127f, 0.672198f, 0.672269f, 0.672340f, 0.672411f, 0.672482f, 0.672553f, 0.672624f,
- 0.672695f, 0.672766f, 0.672837f, 0.672908f, 0.672978f, 0.673049f, 0.673120f, 0.673191f,
- 0.673262f, 0.673333f, 0.673404f, 0.673475f, 0.673546f, 0.673616f, 0.673687f, 0.673758f,
- 0.673829f, 0.673900f, 0.673971f, 0.674042f, 0.674112f, 0.674183f, 0.674254f, 0.674325f,
- 0.674396f, 0.674466f, 0.674537f, 0.674608f, 0.674679f, 0.674749f, 0.674820f, 0.674891f,
- 0.674962f, 0.675032f, 0.675103f, 0.675174f, 0.675245f, 0.675315f, 0.675386f, 0.675457f,
- 0.675527f, 0.675598f, 0.675669f, 0.675739f, 0.675810f, 0.675881f, 0.675951f, 0.676022f,
- 0.676093f, 0.676163f, 0.676234f, 0.676305f, 0.676375f, 0.676446f, 0.676516f, 0.676587f,
- 0.676658f, 0.676728f, 0.676799f, 0.676869f, 0.676940f, 0.677011f, 0.677081f, 0.677152f,
- 0.677222f, 0.677293f, 0.677363f, 0.677434f, 0.677504f, 0.677575f, 0.677645f, 0.677716f,
- 0.677786f, 0.677857f, 0.677927f, 0.677998f, 0.678068f, 0.678139f, 0.678209f, 0.678280f,
- 0.678350f, 0.678420f, 0.678491f, 0.678561f, 0.678632f, 0.678702f, 0.678773f, 0.678843f,
- 0.678913f, 0.678984f, 0.679054f, 0.679125f, 0.679195f, 0.679265f, 0.679336f, 0.679406f,
- 0.679476f, 0.679547f, 0.679617f, 0.679687f, 0.679758f, 0.679828f, 0.679898f, 0.679969f,
- 0.680039f, 0.680109f, 0.680179f, 0.680250f, 0.680320f, 0.680390f, 0.680461f, 0.680531f,
- 0.680601f, 0.680671f, 0.680741f, 0.680812f, 0.680882f, 0.680952f, 0.681022f, 0.681093f,
- 0.681163f, 0.681233f, 0.681303f, 0.681373f, 0.681443f, 0.681514f, 0.681584f, 0.681654f,
- 0.681724f, 0.681794f, 0.681864f, 0.681934f, 0.682005f, 0.682075f, 0.682145f, 0.682215f,
- 0.682285f, 0.682355f, 0.682425f, 0.682495f, 0.682565f, 0.682635f, 0.682705f, 0.682775f,
- 0.682846f, 0.682916f, 0.682986f, 0.683056f, 0.683126f, 0.683196f, 0.683266f, 0.683336f,
- 0.683406f, 0.683476f, 0.683546f, 0.683616f, 0.683686f, 0.683756f, 0.683825f, 0.683895f,
- 0.683965f, 0.684035f, 0.684105f, 0.684175f, 0.684245f, 0.684315f, 0.684385f, 0.684455f,
- 0.684525f, 0.684595f, 0.684664f, 0.684734f, 0.684804f, 0.684874f, 0.684944f, 0.685014f,
- 0.685084f, 0.685153f, 0.685223f, 0.685293f, 0.685363f, 0.685433f, 0.685503f, 0.685572f,
- 0.685642f, 0.685712f, 0.685782f, 0.685852f, 0.685921f, 0.685991f, 0.686061f, 0.686131f,
- 0.686200f, 0.686270f, 0.686340f, 0.686409f, 0.686479f, 0.686549f, 0.686619f, 0.686688f,
- 0.686758f, 0.686828f, 0.686897f, 0.686967f, 0.687037f, 0.687106f, 0.687176f, 0.687246f,
- 0.687315f, 0.687385f, 0.687455f, 0.687524f, 0.687594f, 0.687663f, 0.687733f, 0.687803f,
- 0.687872f, 0.687942f, 0.688011f, 0.688081f, 0.688151f, 0.688220f, 0.688290f, 0.688359f,
- 0.688429f, 0.688498f, 0.688568f, 0.688637f, 0.688707f, 0.688776f, 0.688846f, 0.688915f,
- 0.688985f, 0.689054f, 0.689124f, 0.689193f, 0.689263f, 0.689332f, 0.689402f, 0.689471f,
- 0.689541f, 0.689610f, 0.689679f, 0.689749f, 0.689818f, 0.689888f, 0.689957f, 0.690026f,
- 0.690096f, 0.690165f, 0.690235f, 0.690304f, 0.690373f, 0.690443f, 0.690512f, 0.690581f,
- 0.690651f, 0.690720f, 0.690789f, 0.690859f, 0.690928f, 0.690997f, 0.691067f, 0.691136f,
- 0.691205f, 0.691274f, 0.691344f, 0.691413f, 0.691482f, 0.691552f, 0.691621f, 0.691690f,
- 0.691759f, 0.691828f, 0.691898f, 0.691967f, 0.692036f, 0.692105f, 0.692175f, 0.692244f,
- 0.692313f, 0.692382f, 0.692451f, 0.692520f, 0.692590f, 0.692659f, 0.692728f, 0.692797f,
- 0.692866f, 0.692935f, 0.693004f, 0.693074f, 0.693143f, 0.693212f, 0.693281f, 0.693350f,
- 0.693419f, 0.693488f, 0.693557f, 0.693626f, 0.693695f, 0.693764f, 0.693833f, 0.693902f,
- 0.693971f, 0.694040f, 0.694109f, 0.694179f, 0.694248f, 0.694317f, 0.694386f, 0.694454f,
- 0.694524f, 0.694592f, 0.694661f, 0.694730f, 0.694799f, 0.694868f, 0.694937f, 0.695006f,
- 0.695075f, 0.695144f, 0.695213f, 0.695282f, 0.695351f, 0.695420f, 0.695489f, 0.695557f,
- 0.695626f, 0.695695f, 0.695764f, 0.695833f, 0.695902f, 0.695971f, 0.696039f, 0.696108f,
- 0.696177f, 0.696246f, 0.696315f, 0.696384f, 0.696452f, 0.696521f, 0.696590f, 0.696659f,
- 0.696728f, 0.696796f, 0.696865f, 0.696934f, 0.697003f, 0.697071f, 0.697140f, 0.697209f,
- 0.697277f, 0.697346f, 0.697415f, 0.697484f, 0.697552f, 0.697621f, 0.697690f, 0.697758f,
- 0.697827f, 0.697896f, 0.697964f, 0.698033f, 0.698102f, 0.698170f, 0.698239f, 0.698308f,
- 0.698376f, 0.698445f, 0.698513f, 0.698582f, 0.698651f, 0.698719f, 0.698788f, 0.698856f,
- 0.698925f, 0.698994f, 0.699062f, 0.699131f, 0.699199f, 0.699268f, 0.699336f, 0.699405f,
- 0.699473f, 0.699542f, 0.699610f, 0.699679f, 0.699747f, 0.699816f, 0.699884f, 0.699953f,
- 0.700021f, 0.700090f, 0.700158f, 0.700227f, 0.700295f, 0.700364f, 0.700432f, 0.700500f,
- 0.700569f, 0.700637f, 0.700706f, 0.700774f, 0.700842f, 0.700911f, 0.700979f, 0.701048f,
- 0.701116f, 0.701184f, 0.701253f, 0.701321f, 0.701389f, 0.701458f, 0.701526f, 0.701594f,
- 0.701663f, 0.701731f, 0.701799f, 0.701868f, 0.701936f, 0.702004f, 0.702072f, 0.702141f,
- 0.702209f, 0.702277f, 0.702345f, 0.702414f, 0.702482f, 0.702550f, 0.702618f, 0.702687f,
- 0.702755f, 0.702823f, 0.702891f, 0.702959f, 0.703028f, 0.703096f, 0.703164f, 0.703232f,
- 0.703300f, 0.703368f, 0.703436f, 0.703505f, 0.703573f, 0.703641f, 0.703709f, 0.703777f,
- 0.703845f, 0.703913f, 0.703981f, 0.704050f, 0.704118f, 0.704186f, 0.704254f, 0.704322f,
- 0.704390f, 0.704458f, 0.704526f, 0.704594f, 0.704662f, 0.704730f, 0.704798f, 0.704866f,
- 0.704934f, 0.705002f, 0.705070f, 0.705138f, 0.705206f, 0.705274f, 0.705342f, 0.705410f,
- 0.705478f, 0.705546f, 0.705614f, 0.705682f, 0.705750f, 0.705818f, 0.705885f, 0.705953f,
- 0.706021f, 0.706089f, 0.706157f, 0.706225f, 0.706293f, 0.706361f, 0.706429f, 0.706496f,
- 0.706564f, 0.706632f, 0.706700f, 0.706768f, 0.706836f, 0.706903f, 0.706971f, 0.707039f,
- 0.707107f, 0.707175f, 0.707242f, 0.707310f, 0.707378f, 0.707446f, 0.707513f, 0.707581f,
- 0.707649f, 0.707717f, 0.707784f, 0.707852f, 0.707920f, 0.707988f, 0.708055f, 0.708123f,
- 0.708191f, 0.708258f, 0.708326f, 0.708394f, 0.708461f, 0.708529f, 0.708597f, 0.708664f,
- 0.708732f, 0.708800f, 0.708867f, 0.708935f, 0.709002f, 0.709070f, 0.709138f, 0.709205f,
- 0.709273f, 0.709340f, 0.709408f, 0.709476f, 0.709543f, 0.709611f, 0.709678f, 0.709746f,
- 0.709813f, 0.709881f, 0.709948f, 0.710016f, 0.710083f, 0.710151f, 0.710218f, 0.710286f,
- 0.710353f, 0.710421f, 0.710488f, 0.710556f, 0.710623f, 0.710691f, 0.710758f, 0.710826f,
- 0.710893f, 0.710960f, 0.711028f, 0.711095f, 0.711163f, 0.711230f, 0.711297f, 0.711365f,
- 0.711432f, 0.711500f, 0.711567f, 0.711634f, 0.711702f, 0.711769f, 0.711836f, 0.711904f,
- 0.711971f, 0.712038f, 0.712106f, 0.712173f, 0.712240f, 0.712308f, 0.712375f, 0.712442f,
- 0.712509f, 0.712577f, 0.712644f, 0.712711f, 0.712778f, 0.712846f, 0.712913f, 0.712980f,
- 0.713047f, 0.713115f, 0.713182f, 0.713249f, 0.713316f, 0.713383f, 0.713451f, 0.713518f,
- 0.713585f, 0.713652f, 0.713719f, 0.713786f, 0.713853f, 0.713921f, 0.713988f, 0.714055f,
- 0.714122f, 0.714189f, 0.714256f, 0.714323f, 0.714390f, 0.714457f, 0.714525f, 0.714592f,
- 0.714659f, 0.714726f, 0.714793f, 0.714860f, 0.714927f, 0.714994f, 0.715061f, 0.715128f,
- 0.715195f, 0.715262f, 0.715329f, 0.715396f, 0.715463f, 0.715530f, 0.715597f, 0.715664f,
- 0.715731f, 0.715798f, 0.715865f, 0.715932f, 0.715999f, 0.716066f, 0.716132f, 0.716199f,
- 0.716266f, 0.716333f, 0.716400f, 0.716467f, 0.716534f, 0.716601f, 0.716668f, 0.716734f,
- 0.716801f, 0.716868f, 0.716935f, 0.717002f, 0.717069f, 0.717135f, 0.717202f, 0.717269f,
- 0.717336f, 0.717403f, 0.717469f, 0.717536f, 0.717603f, 0.717670f, 0.717737f, 0.717803f,
- 0.717870f, 0.717937f, 0.718004f, 0.718070f, 0.718137f, 0.718204f, 0.718270f, 0.718337f,
- 0.718404f, 0.718471f, 0.718537f, 0.718604f, 0.718670f, 0.718737f, 0.718804f, 0.718870f,
- 0.718937f, 0.719004f, 0.719070f, 0.719137f, 0.719204f, 0.719270f, 0.719337f, 0.719403f,
- 0.719470f, 0.719537f, 0.719603f, 0.719670f, 0.719736f, 0.719803f, 0.719869f, 0.719936f,
- 0.720003f, 0.720069f, 0.720136f, 0.720202f, 0.720269f, 0.720335f, 0.720402f, 0.720468f,
- 0.720535f, 0.720601f, 0.720668f, 0.720734f, 0.720800f, 0.720867f, 0.720933f, 0.721000f,
- 0.721066f, 0.721133f, 0.721199f, 0.721265f, 0.721332f, 0.721398f, 0.721465f, 0.721531f,
- 0.721597f, 0.721664f, 0.721730f, 0.721797f, 0.721863f, 0.721929f, 0.721996f, 0.722062f,
- 0.722128f, 0.722194f, 0.722261f, 0.722327f, 0.722393f, 0.722460f, 0.722526f, 0.722592f,
- 0.722659f, 0.722725f, 0.722791f, 0.722857f, 0.722924f, 0.722990f, 0.723056f, 0.723122f,
- 0.723188f, 0.723255f, 0.723321f, 0.723387f, 0.723453f, 0.723520f, 0.723586f, 0.723652f,
- 0.723718f, 0.723784f, 0.723850f, 0.723916f, 0.723983f, 0.724049f, 0.724115f, 0.724181f,
- 0.724247f, 0.724313f, 0.724379f, 0.724445f, 0.724511f, 0.724578f, 0.724644f, 0.724710f,
- 0.724776f, 0.724842f, 0.724908f, 0.724974f, 0.725040f, 0.725106f, 0.725172f, 0.725238f,
- 0.725304f, 0.725370f, 0.725436f, 0.725502f, 0.725568f, 0.725634f, 0.725700f, 0.725766f,
- 0.725832f, 0.725898f, 0.725964f, 0.726030f, 0.726095f, 0.726161f, 0.726227f, 0.726293f,
- 0.726359f, 0.726425f, 0.726491f, 0.726557f, 0.726623f, 0.726689f, 0.726754f, 0.726820f,
- 0.726886f, 0.726952f, 0.727018f, 0.727084f, 0.727149f, 0.727215f, 0.727281f, 0.727347f,
- 0.727413f, 0.727478f, 0.727544f, 0.727610f, 0.727676f, 0.727741f, 0.727807f, 0.727873f,
- 0.727939f, 0.728004f, 0.728070f, 0.728136f, 0.728202f, 0.728267f, 0.728333f, 0.728399f,
- 0.728464f, 0.728530f, 0.728596f, 0.728661f, 0.728727f, 0.728793f, 0.728858f, 0.728924f,
- 0.728990f, 0.729055f, 0.729121f, 0.729186f, 0.729252f, 0.729318f, 0.729383f, 0.729449f,
- 0.729514f, 0.729580f, 0.729646f, 0.729711f, 0.729777f, 0.729842f, 0.729908f, 0.729973f,
- 0.730039f, 0.730104f, 0.730170f, 0.730235f, 0.730301f, 0.730366f, 0.730432f, 0.730497f,
- 0.730563f, 0.730628f, 0.730694f, 0.730759f, 0.730825f, 0.730890f, 0.730955f, 0.731021f,
- 0.731086f, 0.731152f, 0.731217f, 0.731282f, 0.731348f, 0.731413f, 0.731479f, 0.731544f,
- 0.731609f, 0.731675f, 0.731740f, 0.731805f, 0.731871f, 0.731936f, 0.732001f, 0.732067f,
- 0.732132f, 0.732197f, 0.732263f, 0.732328f, 0.732393f, 0.732458f, 0.732524f, 0.732589f,
- 0.732654f, 0.732720f, 0.732785f, 0.732850f, 0.732915f, 0.732980f, 0.733046f, 0.733111f,
- 0.733176f, 0.733241f, 0.733306f, 0.733372f, 0.733437f, 0.733502f, 0.733567f, 0.733632f,
- 0.733697f, 0.733763f, 0.733828f, 0.733893f, 0.733958f, 0.734023f, 0.734088f, 0.734153f,
- 0.734218f, 0.734283f, 0.734349f, 0.734414f, 0.734479f, 0.734544f, 0.734609f, 0.734674f,
- 0.734739f, 0.734804f, 0.734869f, 0.734934f, 0.734999f, 0.735064f, 0.735129f, 0.735194f,
- 0.735259f, 0.735324f, 0.735389f, 0.735454f, 0.735519f, 0.735584f, 0.735649f, 0.735714f,
- 0.735779f, 0.735844f, 0.735908f, 0.735973f, 0.736038f, 0.736103f, 0.736168f, 0.736233f,
- 0.736298f, 0.736363f, 0.736428f, 0.736492f, 0.736557f, 0.736622f, 0.736687f, 0.736752f,
- 0.736817f, 0.736881f, 0.736946f, 0.737011f, 0.737076f, 0.737141f, 0.737205f, 0.737270f,
- 0.737335f, 0.737400f, 0.737464f, 0.737529f, 0.737594f, 0.737659f, 0.737723f, 0.737788f,
- 0.737853f, 0.737918f, 0.737982f, 0.738047f, 0.738112f, 0.738176f, 0.738241f, 0.738306f,
- 0.738370f, 0.738435f, 0.738500f, 0.738564f, 0.738629f, 0.738693f, 0.738758f, 0.738823f,
- 0.738887f, 0.738952f, 0.739017f, 0.739081f, 0.739146f, 0.739210f, 0.739275f, 0.739339f,
- 0.739404f, 0.739468f, 0.739533f, 0.739598f, 0.739662f, 0.739727f, 0.739791f, 0.739856f,
- 0.739920f, 0.739985f, 0.740049f, 0.740114f, 0.740178f, 0.740242f, 0.740307f, 0.740371f,
- 0.740436f, 0.740500f, 0.740565f, 0.740629f, 0.740694f, 0.740758f, 0.740822f, 0.740887f,
- 0.740951f, 0.741015f, 0.741080f, 0.741144f, 0.741209f, 0.741273f, 0.741337f, 0.741402f,
- 0.741466f, 0.741530f, 0.741595f, 0.741659f, 0.741723f, 0.741788f, 0.741852f, 0.741916f,
- 0.741980f, 0.742045f, 0.742109f, 0.742173f, 0.742237f, 0.742302f, 0.742366f, 0.742430f,
- 0.742494f, 0.742559f, 0.742623f, 0.742687f, 0.742751f, 0.742815f, 0.742880f, 0.742944f,
- 0.743008f, 0.743072f, 0.743136f, 0.743200f, 0.743265f, 0.743329f, 0.743393f, 0.743457f,
- 0.743521f, 0.743585f, 0.743649f, 0.743713f, 0.743777f, 0.743842f, 0.743906f, 0.743970f,
- 0.744034f, 0.744098f, 0.744162f, 0.744226f, 0.744290f, 0.744354f, 0.744418f, 0.744482f,
- 0.744546f, 0.744610f, 0.744674f, 0.744738f, 0.744802f, 0.744866f, 0.744930f, 0.744994f,
- 0.745058f, 0.745122f, 0.745186f, 0.745250f, 0.745314f, 0.745377f, 0.745441f, 0.745505f,
- 0.745569f, 0.745633f, 0.745697f, 0.745761f, 0.745825f, 0.745889f, 0.745952f, 0.746016f,
- 0.746080f, 0.746144f, 0.746208f, 0.746272f, 0.746335f, 0.746399f, 0.746463f, 0.746527f,
- 0.746591f, 0.746654f, 0.746718f, 0.746782f, 0.746846f, 0.746909f, 0.746973f, 0.747037f,
- 0.747101f, 0.747164f, 0.747228f, 0.747292f, 0.747355f, 0.747419f, 0.747483f, 0.747547f,
- 0.747610f, 0.747674f, 0.747738f, 0.747801f, 0.747865f, 0.747929f, 0.747992f, 0.748056f,
- 0.748119f, 0.748183f, 0.748247f, 0.748310f, 0.748374f, 0.748437f, 0.748501f, 0.748565f,
- 0.748628f, 0.748692f, 0.748755f, 0.748819f, 0.748882f, 0.748946f, 0.749009f, 0.749073f,
- 0.749136f, 0.749200f, 0.749263f, 0.749327f, 0.749390f, 0.749454f, 0.749517f, 0.749581f,
- 0.749644f, 0.749708f, 0.749771f, 0.749835f, 0.749898f, 0.749961f, 0.750025f, 0.750088f,
- 0.750152f, 0.750215f, 0.750278f, 0.750342f, 0.750405f, 0.750469f, 0.750532f, 0.750595f,
- 0.750659f, 0.750722f, 0.750785f, 0.750849f, 0.750912f, 0.750975f, 0.751039f, 0.751102f,
- 0.751165f, 0.751228f, 0.751292f, 0.751355f, 0.751418f, 0.751481f, 0.751545f, 0.751608f,
- 0.751671f, 0.751734f, 0.751798f, 0.751861f, 0.751924f, 0.751987f, 0.752050f, 0.752114f,
- 0.752177f, 0.752240f, 0.752303f, 0.752366f, 0.752429f, 0.752493f, 0.752556f, 0.752619f,
- 0.752682f, 0.752745f, 0.752808f, 0.752871f, 0.752934f, 0.752998f, 0.753061f, 0.753124f,
- 0.753187f, 0.753250f, 0.753313f, 0.753376f, 0.753439f, 0.753502f, 0.753565f, 0.753628f,
- 0.753691f, 0.753754f, 0.753817f, 0.753880f, 0.753943f, 0.754006f, 0.754069f, 0.754132f,
- 0.754195f, 0.754258f, 0.754321f, 0.754384f, 0.754447f, 0.754510f, 0.754573f, 0.754636f,
- 0.754698f, 0.754761f, 0.754824f, 0.754887f, 0.754950f, 0.755013f, 0.755076f, 0.755139f,
- 0.755201f, 0.755264f, 0.755327f, 0.755390f, 0.755453f, 0.755516f, 0.755578f, 0.755641f,
- 0.755704f, 0.755767f, 0.755829f, 0.755892f, 0.755955f, 0.756018f, 0.756081f, 0.756143f,
- 0.756206f, 0.756269f, 0.756331f, 0.756394f, 0.756457f, 0.756520f, 0.756582f, 0.756645f,
- 0.756708f, 0.756770f, 0.756833f, 0.756896f, 0.756958f, 0.757021f, 0.757084f, 0.757146f,
- 0.757209f, 0.757271f, 0.757334f, 0.757397f, 0.757459f, 0.757522f, 0.757584f, 0.757647f,
- 0.757710f, 0.757772f, 0.757835f, 0.757897f, 0.757960f, 0.758022f, 0.758085f, 0.758147f,
- 0.758210f, 0.758272f, 0.758335f, 0.758397f, 0.758460f, 0.758522f, 0.758585f, 0.758647f,
- 0.758710f, 0.758772f, 0.758835f, 0.758897f, 0.758960f, 0.759022f, 0.759084f, 0.759147f,
- 0.759209f, 0.759272f, 0.759334f, 0.759396f, 0.759459f, 0.759521f, 0.759583f, 0.759646f,
- 0.759708f, 0.759771f, 0.759833f, 0.759895f, 0.759957f, 0.760020f, 0.760082f, 0.760144f,
- 0.760207f, 0.760269f, 0.760331f, 0.760394f, 0.760456f, 0.760518f, 0.760580f, 0.760643f,
- 0.760705f, 0.760767f, 0.760829f, 0.760891f, 0.760954f, 0.761016f, 0.761078f, 0.761140f,
- 0.761202f, 0.761265f, 0.761327f, 0.761389f, 0.761451f, 0.761513f, 0.761575f, 0.761637f,
- 0.761700f, 0.761762f, 0.761824f, 0.761886f, 0.761948f, 0.762010f, 0.762072f, 0.762134f,
- 0.762196f, 0.762258f, 0.762320f, 0.762382f, 0.762444f, 0.762507f, 0.762569f, 0.762631f,
- 0.762693f, 0.762755f, 0.762817f, 0.762879f, 0.762941f, 0.763003f, 0.763065f, 0.763126f,
- 0.763188f, 0.763250f, 0.763312f, 0.763374f, 0.763436f, 0.763498f, 0.763560f, 0.763622f,
- 0.763684f, 0.763746f, 0.763808f, 0.763869f, 0.763931f, 0.763993f, 0.764055f, 0.764117f,
- 0.764179f, 0.764241f, 0.764302f, 0.764364f, 0.764426f, 0.764488f, 0.764550f, 0.764611f,
- 0.764673f, 0.764735f, 0.764797f, 0.764859f, 0.764920f, 0.764982f, 0.765044f, 0.765106f,
- 0.765167f, 0.765229f, 0.765291f, 0.765352f, 0.765414f, 0.765476f, 0.765538f, 0.765599f,
- 0.765661f, 0.765723f, 0.765784f, 0.765846f, 0.765907f, 0.765969f, 0.766031f, 0.766092f,
- 0.766154f, 0.766216f, 0.766277f, 0.766339f, 0.766400f, 0.766462f, 0.766524f, 0.766585f,
- 0.766647f, 0.766708f, 0.766770f, 0.766831f, 0.766893f, 0.766954f, 0.767016f, 0.767077f,
- 0.767139f, 0.767200f, 0.767262f, 0.767323f, 0.767385f, 0.767446f, 0.767508f, 0.767569f,
- 0.767631f, 0.767692f, 0.767754f, 0.767815f, 0.767876f, 0.767938f, 0.767999f, 0.768061f,
- 0.768122f, 0.768183f, 0.768245f, 0.768306f, 0.768368f, 0.768429f, 0.768490f, 0.768552f,
- 0.768613f, 0.768674f, 0.768736f, 0.768797f, 0.768858f, 0.768919f, 0.768981f, 0.769042f,
- 0.769103f, 0.769165f, 0.769226f, 0.769287f, 0.769348f, 0.769410f, 0.769471f, 0.769532f,
- 0.769593f, 0.769655f, 0.769716f, 0.769777f, 0.769838f, 0.769899f, 0.769961f, 0.770022f,
- 0.770083f, 0.770144f, 0.770205f, 0.770266f, 0.770327f, 0.770389f, 0.770450f, 0.770511f,
- 0.770572f, 0.770633f, 0.770694f, 0.770755f, 0.770816f, 0.770877f, 0.770938f, 0.770999f,
- 0.771061f, 0.771122f, 0.771183f, 0.771244f, 0.771305f, 0.771366f, 0.771427f, 0.771488f,
- 0.771549f, 0.771610f, 0.771671f, 0.771732f, 0.771793f, 0.771854f, 0.771915f, 0.771975f,
- 0.772036f, 0.772097f, 0.772158f, 0.772219f, 0.772280f, 0.772341f, 0.772402f, 0.772463f,
- 0.772524f, 0.772584f, 0.772645f, 0.772706f, 0.772767f, 0.772828f, 0.772889f, 0.772950f,
- 0.773010f, 0.773071f, 0.773132f, 0.773193f, 0.773254f, 0.773314f, 0.773375f, 0.773436f,
- 0.773497f, 0.773558f, 0.773618f, 0.773679f, 0.773740f, 0.773801f, 0.773861f, 0.773922f,
- 0.773983f, 0.774043f, 0.774104f, 0.774165f, 0.774225f, 0.774286f, 0.774347f, 0.774407f,
- 0.774468f, 0.774529f, 0.774589f, 0.774650f, 0.774711f, 0.774771f, 0.774832f, 0.774893f,
- 0.774953f, 0.775014f, 0.775074f, 0.775135f, 0.775195f, 0.775256f, 0.775317f, 0.775377f,
- 0.775438f, 0.775498f, 0.775559f, 0.775619f, 0.775680f, 0.775740f, 0.775801f, 0.775861f,
- 0.775922f, 0.775982f, 0.776043f, 0.776103f, 0.776164f, 0.776224f, 0.776284f, 0.776345f,
- 0.776405f, 0.776466f, 0.776526f, 0.776587f, 0.776647f, 0.776707f, 0.776768f, 0.776828f,
- 0.776888f, 0.776949f, 0.777009f, 0.777070f, 0.777130f, 0.777190f, 0.777251f, 0.777311f,
- 0.777371f, 0.777431f, 0.777492f, 0.777552f, 0.777612f, 0.777673f, 0.777733f, 0.777793f,
- 0.777853f, 0.777914f, 0.777974f, 0.778034f, 0.778094f, 0.778155f, 0.778215f, 0.778275f,
- 0.778335f, 0.778395f, 0.778456f, 0.778516f, 0.778576f, 0.778636f, 0.778696f, 0.778756f,
- 0.778817f, 0.778877f, 0.778937f, 0.778997f, 0.779057f, 0.779117f, 0.779177f, 0.779237f,
- 0.779297f, 0.779357f, 0.779418f, 0.779478f, 0.779538f, 0.779598f, 0.779658f, 0.779718f,
- 0.779778f, 0.779838f, 0.779898f, 0.779958f, 0.780018f, 0.780078f, 0.780138f, 0.780198f,
- 0.780258f, 0.780318f, 0.780378f, 0.780438f, 0.780498f, 0.780557f, 0.780617f, 0.780677f,
- 0.780737f, 0.780797f, 0.780857f, 0.780917f, 0.780977f, 0.781037f, 0.781097f, 0.781156f,
- 0.781216f, 0.781276f, 0.781336f, 0.781396f, 0.781456f, 0.781515f, 0.781575f, 0.781635f,
- 0.781695f, 0.781755f, 0.781814f, 0.781874f, 0.781934f, 0.781994f, 0.782053f, 0.782113f,
- 0.782173f, 0.782233f, 0.782292f, 0.782352f, 0.782412f, 0.782472f, 0.782531f, 0.782591f,
- 0.782651f, 0.782710f, 0.782770f, 0.782830f, 0.782889f, 0.782949f, 0.783009f, 0.783068f,
- 0.783128f, 0.783187f, 0.783247f, 0.783307f, 0.783366f, 0.783426f, 0.783485f, 0.783545f,
- 0.783605f, 0.783664f, 0.783724f, 0.783783f, 0.783843f, 0.783902f, 0.783962f, 0.784021f,
- 0.784081f, 0.784140f, 0.784200f, 0.784259f, 0.784319f, 0.784378f, 0.784438f, 0.784497f,
- 0.784557f, 0.784616f, 0.784675f, 0.784735f, 0.784794f, 0.784854f, 0.784913f, 0.784973f,
- 0.785032f, 0.785091f, 0.785151f, 0.785210f, 0.785269f, 0.785329f, 0.785388f, 0.785447f,
- 0.785507f, 0.785566f, 0.785625f, 0.785685f, 0.785744f, 0.785803f, 0.785863f, 0.785922f,
- 0.785981f, 0.786041f, 0.786100f, 0.786159f, 0.786218f, 0.786278f, 0.786337f, 0.786396f,
- 0.786455f, 0.786514f, 0.786574f, 0.786633f, 0.786692f, 0.786751f, 0.786810f, 0.786870f,
- 0.786929f, 0.786988f, 0.787047f, 0.787106f, 0.787165f, 0.787224f, 0.787284f, 0.787343f,
- 0.787402f, 0.787461f, 0.787520f, 0.787579f, 0.787638f, 0.787697f, 0.787756f, 0.787815f,
- 0.787874f, 0.787933f, 0.787992f, 0.788051f, 0.788110f, 0.788169f, 0.788228f, 0.788287f,
- 0.788346f, 0.788405f, 0.788464f, 0.788523f, 0.788582f, 0.788641f, 0.788700f, 0.788759f,
- 0.788818f, 0.788877f, 0.788936f, 0.788995f, 0.789054f, 0.789113f, 0.789172f, 0.789230f,
- 0.789289f, 0.789348f, 0.789407f, 0.789466f, 0.789525f, 0.789584f, 0.789642f, 0.789701f,
- 0.789760f, 0.789819f, 0.789878f, 0.789936f, 0.789995f, 0.790054f, 0.790113f, 0.790171f,
- 0.790230f, 0.790289f, 0.790348f, 0.790406f, 0.790465f, 0.790524f, 0.790583f, 0.790641f,
- 0.790700f, 0.790759f, 0.790817f, 0.790876f, 0.790935f, 0.790993f, 0.791052f, 0.791111f,
- 0.791169f, 0.791228f, 0.791287f, 0.791345f, 0.791404f, 0.791462f, 0.791521f, 0.791580f,
- 0.791638f, 0.791697f, 0.791755f, 0.791814f, 0.791872f, 0.791931f, 0.791990f, 0.792048f,
- 0.792107f, 0.792165f, 0.792224f, 0.792282f, 0.792341f, 0.792399f, 0.792458f, 0.792516f,
- 0.792575f, 0.792633f, 0.792691f, 0.792750f, 0.792808f, 0.792867f, 0.792925f, 0.792984f,
- 0.793042f, 0.793100f, 0.793159f, 0.793217f, 0.793276f, 0.793334f, 0.793392f, 0.793451f,
- 0.793509f, 0.793567f, 0.793626f, 0.793684f, 0.793742f, 0.793801f, 0.793859f, 0.793917f,
- 0.793975f, 0.794034f, 0.794092f, 0.794150f, 0.794209f, 0.794267f, 0.794325f, 0.794383f,
- 0.794442f, 0.794500f, 0.794558f, 0.794616f, 0.794674f, 0.794733f, 0.794791f, 0.794849f,
- 0.794907f, 0.794965f, 0.795023f, 0.795082f, 0.795140f, 0.795198f, 0.795256f, 0.795314f,
- 0.795372f, 0.795430f, 0.795488f, 0.795547f, 0.795605f, 0.795663f, 0.795721f, 0.795779f,
- 0.795837f, 0.795895f, 0.795953f, 0.796011f, 0.796069f, 0.796127f, 0.796185f, 0.796243f,
- 0.796301f, 0.796359f, 0.796417f, 0.796475f, 0.796533f, 0.796591f, 0.796649f, 0.796707f,
- 0.796765f, 0.796823f, 0.796881f, 0.796939f, 0.796996f, 0.797054f, 0.797112f, 0.797170f,
- 0.797228f, 0.797286f, 0.797344f, 0.797402f, 0.797459f, 0.797517f, 0.797575f, 0.797633f,
- 0.797691f, 0.797749f, 0.797806f, 0.797864f, 0.797922f, 0.797980f, 0.798038f, 0.798095f,
- 0.798153f, 0.798211f, 0.798269f, 0.798326f, 0.798384f, 0.798442f, 0.798500f, 0.798557f,
- 0.798615f, 0.798673f, 0.798730f, 0.798788f, 0.798846f, 0.798903f, 0.798961f, 0.799019f,
- 0.799076f, 0.799134f, 0.799192f, 0.799249f, 0.799307f, 0.799365f, 0.799422f, 0.799480f,
- 0.799537f, 0.799595f, 0.799652f, 0.799710f, 0.799768f, 0.799825f, 0.799883f, 0.799940f,
- 0.799998f, 0.800055f, 0.800113f, 0.800170f, 0.800228f, 0.800285f, 0.800343f, 0.800400f,
- 0.800458f, 0.800515f, 0.800573f, 0.800630f, 0.800687f, 0.800745f, 0.800802f, 0.800860f,
- 0.800917f, 0.800975f, 0.801032f, 0.801089f, 0.801147f, 0.801204f, 0.801261f, 0.801319f,
- 0.801376f, 0.801434f, 0.801491f, 0.801548f, 0.801606f, 0.801663f, 0.801720f, 0.801777f,
- 0.801835f, 0.801892f, 0.801949f, 0.802007f, 0.802064f, 0.802121f, 0.802178f, 0.802236f,
- 0.802293f, 0.802350f, 0.802407f, 0.802464f, 0.802522f, 0.802579f, 0.802636f, 0.802693f,
- 0.802750f, 0.802808f, 0.802865f, 0.802922f, 0.802979f, 0.803036f, 0.803093f, 0.803150f,
- 0.803208f, 0.803265f, 0.803322f, 0.803379f, 0.803436f, 0.803493f, 0.803550f, 0.803607f,
- 0.803664f, 0.803721f, 0.803778f, 0.803835f, 0.803892f, 0.803949f, 0.804006f, 0.804063f,
- 0.804120f, 0.804177f, 0.804234f, 0.804291f, 0.804348f, 0.804405f, 0.804462f, 0.804519f,
- 0.804576f, 0.804633f, 0.804690f, 0.804747f, 0.804804f, 0.804861f, 0.804918f, 0.804974f,
- 0.805031f, 0.805088f, 0.805145f, 0.805202f, 0.805259f, 0.805316f, 0.805372f, 0.805429f,
- 0.805486f, 0.805543f, 0.805600f, 0.805656f, 0.805713f, 0.805770f, 0.805827f, 0.805884f,
- 0.805940f, 0.805997f, 0.806054f, 0.806111f, 0.806167f, 0.806224f, 0.806281f, 0.806338f,
- 0.806394f, 0.806451f, 0.806508f, 0.806564f, 0.806621f, 0.806678f, 0.806734f, 0.806791f,
- 0.806848f, 0.806904f, 0.806961f, 0.807017f, 0.807074f, 0.807131f, 0.807187f, 0.807244f,
- 0.807300f, 0.807357f, 0.807414f, 0.807470f, 0.807527f, 0.807583f, 0.807640f, 0.807696f,
- 0.807753f, 0.807809f, 0.807866f, 0.807922f, 0.807979f, 0.808035f, 0.808092f, 0.808148f,
- 0.808205f, 0.808261f, 0.808318f, 0.808374f, 0.808430f, 0.808487f, 0.808543f, 0.808600f,
- 0.808656f, 0.808713f, 0.808769f, 0.808825f, 0.808882f, 0.808938f, 0.808994f, 0.809051f,
- 0.809107f, 0.809164f, 0.809220f, 0.809276f, 0.809332f, 0.809389f, 0.809445f, 0.809501f,
- 0.809558f, 0.809614f, 0.809670f, 0.809726f, 0.809783f, 0.809839f, 0.809895f, 0.809951f,
- 0.810008f, 0.810064f, 0.810120f, 0.810176f, 0.810232f, 0.810289f, 0.810345f, 0.810401f,
- 0.810457f, 0.810513f, 0.810570f, 0.810626f, 0.810682f, 0.810738f, 0.810794f, 0.810850f,
- 0.810906f, 0.810962f, 0.811018f, 0.811075f, 0.811131f, 0.811187f, 0.811243f, 0.811299f,
- 0.811355f, 0.811411f, 0.811467f, 0.811523f, 0.811579f, 0.811635f, 0.811691f, 0.811747f,
- 0.811803f, 0.811859f, 0.811915f, 0.811971f, 0.812027f, 0.812083f, 0.812139f, 0.812195f,
- 0.812251f, 0.812307f, 0.812362f, 0.812418f, 0.812474f, 0.812530f, 0.812586f, 0.812642f,
- 0.812698f, 0.812754f, 0.812809f, 0.812865f, 0.812921f, 0.812977f, 0.813033f, 0.813089f,
- 0.813144f, 0.813200f, 0.813256f, 0.813312f, 0.813368f, 0.813423f, 0.813479f, 0.813535f,
- 0.813591f, 0.813646f, 0.813702f, 0.813758f, 0.813814f, 0.813869f, 0.813925f, 0.813981f,
- 0.814036f, 0.814092f, 0.814148f, 0.814203f, 0.814259f, 0.814315f, 0.814370f, 0.814426f,
- 0.814482f, 0.814537f, 0.814593f, 0.814648f, 0.814704f, 0.814760f, 0.814815f, 0.814871f,
- 0.814926f, 0.814982f, 0.815037f, 0.815093f, 0.815149f, 0.815204f, 0.815260f, 0.815315f,
- 0.815371f, 0.815426f, 0.815482f, 0.815537f, 0.815593f, 0.815648f, 0.815704f, 0.815759f,
- 0.815814f, 0.815870f, 0.815925f, 0.815981f, 0.816036f, 0.816092f, 0.816147f, 0.816202f,
- 0.816258f, 0.816313f, 0.816368f, 0.816424f, 0.816479f, 0.816535f, 0.816590f, 0.816645f,
- 0.816701f, 0.816756f, 0.816811f, 0.816867f, 0.816922f, 0.816977f, 0.817032f, 0.817088f,
- 0.817143f, 0.817198f, 0.817253f, 0.817309f, 0.817364f, 0.817419f, 0.817474f, 0.817530f,
- 0.817585f, 0.817640f, 0.817695f, 0.817750f, 0.817806f, 0.817861f, 0.817916f, 0.817971f,
- 0.818026f, 0.818081f, 0.818137f, 0.818192f, 0.818247f, 0.818302f, 0.818357f, 0.818412f,
- 0.818467f, 0.818522f, 0.818577f, 0.818632f, 0.818687f, 0.818742f, 0.818798f, 0.818853f,
- 0.818908f, 0.818963f, 0.819018f, 0.819073f, 0.819128f, 0.819183f, 0.819238f, 0.819293f,
- 0.819348f, 0.819402f, 0.819457f, 0.819512f, 0.819567f, 0.819622f, 0.819677f, 0.819732f,
- 0.819787f, 0.819842f, 0.819897f, 0.819952f, 0.820007f, 0.820061f, 0.820116f, 0.820171f,
- 0.820226f, 0.820281f, 0.820336f, 0.820390f, 0.820445f, 0.820500f, 0.820555f, 0.820610f,
- 0.820664f, 0.820719f, 0.820774f, 0.820829f, 0.820884f, 0.820938f, 0.820993f, 0.821048f,
- 0.821102f, 0.821157f, 0.821212f, 0.821267f, 0.821321f, 0.821376f, 0.821431f, 0.821485f,
- 0.821540f, 0.821595f, 0.821649f, 0.821704f, 0.821759f, 0.821813f, 0.821868f, 0.821922f,
- 0.821977f, 0.822032f, 0.822086f, 0.822141f, 0.822195f, 0.822250f, 0.822305f, 0.822359f,
- 0.822414f, 0.822468f, 0.822523f, 0.822577f, 0.822632f, 0.822686f, 0.822741f, 0.822795f,
- 0.822850f, 0.822904f, 0.822959f, 0.823013f, 0.823068f, 0.823122f, 0.823177f, 0.823231f,
- 0.823285f, 0.823340f, 0.823394f, 0.823449f, 0.823503f, 0.823557f, 0.823612f, 0.823666f,
- 0.823721f, 0.823775f, 0.823829f, 0.823884f, 0.823938f, 0.823992f, 0.824047f, 0.824101f,
- 0.824155f, 0.824209f, 0.824264f, 0.824318f, 0.824372f, 0.824427f, 0.824481f, 0.824535f,
- 0.824589f, 0.824644f, 0.824698f, 0.824752f, 0.824806f, 0.824860f, 0.824915f, 0.824969f,
- 0.825023f, 0.825077f, 0.825131f, 0.825185f, 0.825240f, 0.825294f, 0.825348f, 0.825402f,
- 0.825456f, 0.825510f, 0.825564f, 0.825618f, 0.825673f, 0.825727f, 0.825781f, 0.825835f,
- 0.825889f, 0.825943f, 0.825997f, 0.826051f, 0.826105f, 0.826159f, 0.826213f, 0.826267f,
- 0.826321f, 0.826375f, 0.826429f, 0.826483f, 0.826537f, 0.826591f, 0.826645f, 0.826699f,
- 0.826753f, 0.826807f, 0.826861f, 0.826915f, 0.826968f, 0.827022f, 0.827076f, 0.827130f,
- 0.827184f, 0.827238f, 0.827292f, 0.827346f, 0.827399f, 0.827453f, 0.827507f, 0.827561f,
- 0.827615f, 0.827669f, 0.827722f, 0.827776f, 0.827830f, 0.827884f, 0.827938f, 0.827991f,
- 0.828045f, 0.828099f, 0.828153f, 0.828206f, 0.828260f, 0.828314f, 0.828367f, 0.828421f,
- 0.828475f, 0.828529f, 0.828582f, 0.828636f, 0.828690f, 0.828743f, 0.828797f, 0.828851f,
- 0.828904f, 0.828958f, 0.829011f, 0.829065f, 0.829119f, 0.829172f, 0.829226f, 0.829279f,
- 0.829333f, 0.829386f, 0.829440f, 0.829494f, 0.829547f, 0.829601f, 0.829654f, 0.829708f,
- 0.829761f, 0.829815f, 0.829868f, 0.829922f, 0.829975f, 0.830029f, 0.830082f, 0.830136f,
- 0.830189f, 0.830243f, 0.830296f, 0.830349f, 0.830403f, 0.830456f, 0.830510f, 0.830563f,
- 0.830616f, 0.830670f, 0.830723f, 0.830777f, 0.830830f, 0.830883f, 0.830937f, 0.830990f,
- 0.831043f, 0.831097f, 0.831150f, 0.831203f, 0.831257f, 0.831310f, 0.831363f, 0.831416f,
- 0.831470f, 0.831523f, 0.831576f, 0.831629f, 0.831683f, 0.831736f, 0.831789f, 0.831842f,
- 0.831895f, 0.831949f, 0.832002f, 0.832055f, 0.832108f, 0.832161f, 0.832215f, 0.832268f,
- 0.832321f, 0.832374f, 0.832427f, 0.832480f, 0.832533f, 0.832586f, 0.832640f, 0.832693f,
- 0.832746f, 0.832799f, 0.832852f, 0.832905f, 0.832958f, 0.833011f, 0.833064f, 0.833117f,
- 0.833170f, 0.833223f, 0.833276f, 0.833329f, 0.833382f, 0.833435f, 0.833488f, 0.833541f,
- 0.833594f, 0.833647f, 0.833700f, 0.833753f, 0.833806f, 0.833859f, 0.833912f, 0.833965f,
- 0.834018f, 0.834070f, 0.834123f, 0.834176f, 0.834229f, 0.834282f, 0.834335f, 0.834388f,
- 0.834440f, 0.834493f, 0.834546f, 0.834599f, 0.834652f, 0.834705f, 0.834757f, 0.834810f,
- 0.834863f, 0.834916f, 0.834968f, 0.835021f, 0.835074f, 0.835127f, 0.835179f, 0.835232f,
- 0.835285f, 0.835338f, 0.835390f, 0.835443f, 0.835496f, 0.835548f, 0.835601f, 0.835654f,
- 0.835706f, 0.835759f, 0.835812f, 0.835864f, 0.835917f, 0.835969f, 0.836022f, 0.836075f,
- 0.836127f, 0.836180f, 0.836232f, 0.836285f, 0.836338f, 0.836390f, 0.836443f, 0.836495f,
- 0.836548f, 0.836600f, 0.836653f, 0.836705f, 0.836758f, 0.836810f, 0.836863f, 0.836915f,
- 0.836968f, 0.837020f, 0.837073f, 0.837125f, 0.837178f, 0.837230f, 0.837282f, 0.837335f,
- 0.837387f, 0.837440f, 0.837492f, 0.837544f, 0.837597f, 0.837649f, 0.837701f, 0.837754f,
- 0.837806f, 0.837859f, 0.837911f, 0.837963f, 0.838015f, 0.838068f, 0.838120f, 0.838172f,
- 0.838225f, 0.838277f, 0.838329f, 0.838382f, 0.838434f, 0.838486f, 0.838538f, 0.838591f,
- 0.838643f, 0.838695f, 0.838747f, 0.838799f, 0.838852f, 0.838904f, 0.838956f, 0.839008f,
- 0.839060f, 0.839112f, 0.839165f, 0.839217f, 0.839269f, 0.839321f, 0.839373f, 0.839425f,
- 0.839477f, 0.839529f, 0.839581f, 0.839634f, 0.839686f, 0.839738f, 0.839790f, 0.839842f,
- 0.839894f, 0.839946f, 0.839998f, 0.840050f, 0.840102f, 0.840154f, 0.840206f, 0.840258f,
- 0.840310f, 0.840362f, 0.840414f, 0.840466f, 0.840518f, 0.840570f, 0.840622f, 0.840673f,
- 0.840725f, 0.840777f, 0.840829f, 0.840881f, 0.840933f, 0.840985f, 0.841037f, 0.841089f,
- 0.841140f, 0.841192f, 0.841244f, 0.841296f, 0.841348f, 0.841400f, 0.841451f, 0.841503f,
- 0.841555f, 0.841607f, 0.841659f, 0.841710f, 0.841762f, 0.841814f, 0.841866f, 0.841917f,
- 0.841969f, 0.842021f, 0.842072f, 0.842124f, 0.842176f, 0.842228f, 0.842279f, 0.842331f,
- 0.842383f, 0.842434f, 0.842486f, 0.842538f, 0.842589f, 0.842641f, 0.842692f, 0.842744f,
- 0.842796f, 0.842847f, 0.842899f, 0.842950f, 0.843002f, 0.843054f, 0.843105f, 0.843157f,
- 0.843208f, 0.843260f, 0.843311f, 0.843363f, 0.843414f, 0.843466f, 0.843517f, 0.843569f,
- 0.843620f, 0.843672f, 0.843723f, 0.843775f, 0.843826f, 0.843878f, 0.843929f, 0.843980f,
- 0.844032f, 0.844083f, 0.844135f, 0.844186f, 0.844238f, 0.844289f, 0.844340f, 0.844392f,
- 0.844443f, 0.844494f, 0.844546f, 0.844597f, 0.844648f, 0.844700f, 0.844751f, 0.844802f,
- 0.844854f, 0.844905f, 0.844956f, 0.845007f, 0.845059f, 0.845110f, 0.845161f, 0.845212f,
- 0.845264f, 0.845315f, 0.845366f, 0.845417f, 0.845469f, 0.845520f, 0.845571f, 0.845622f,
- 0.845673f, 0.845724f, 0.845776f, 0.845827f, 0.845878f, 0.845929f, 0.845980f, 0.846031f,
- 0.846082f, 0.846133f, 0.846185f, 0.846236f, 0.846287f, 0.846338f, 0.846389f, 0.846440f,
- 0.846491f, 0.846542f, 0.846593f, 0.846644f, 0.846695f, 0.846746f, 0.846797f, 0.846848f,
- 0.846899f, 0.846950f, 0.847001f, 0.847052f, 0.847103f, 0.847154f, 0.847205f, 0.847256f,
- 0.847307f, 0.847358f, 0.847408f, 0.847459f, 0.847510f, 0.847561f, 0.847612f, 0.847663f,
- 0.847714f, 0.847765f, 0.847815f, 0.847866f, 0.847917f, 0.847968f, 0.848019f, 0.848070f,
- 0.848120f, 0.848171f, 0.848222f, 0.848273f, 0.848323f, 0.848374f, 0.848425f, 0.848476f,
- 0.848526f, 0.848577f, 0.848628f, 0.848679f, 0.848729f, 0.848780f, 0.848831f, 0.848881f,
- 0.848932f, 0.848983f, 0.849033f, 0.849084f, 0.849135f, 0.849185f, 0.849236f, 0.849287f,
- 0.849337f, 0.849388f, 0.849438f, 0.849489f, 0.849540f, 0.849590f, 0.849641f, 0.849691f,
- 0.849742f, 0.849792f, 0.849843f, 0.849893f, 0.849944f, 0.849994f, 0.850045f, 0.850095f,
- 0.850146f, 0.850196f, 0.850247f, 0.850297f, 0.850348f, 0.850398f, 0.850449f, 0.850499f,
- 0.850549f, 0.850600f, 0.850650f, 0.850701f, 0.850751f, 0.850801f, 0.850852f, 0.850902f,
- 0.850953f, 0.851003f, 0.851053f, 0.851104f, 0.851154f, 0.851204f, 0.851255f, 0.851305f,
- 0.851355f, 0.851406f, 0.851456f, 0.851506f, 0.851556f, 0.851607f, 0.851657f, 0.851707f,
- 0.851757f, 0.851808f, 0.851858f, 0.851908f, 0.851958f, 0.852008f, 0.852059f, 0.852109f,
- 0.852159f, 0.852209f, 0.852259f, 0.852309f, 0.852360f, 0.852410f, 0.852460f, 0.852510f,
- 0.852560f, 0.852610f, 0.852660f, 0.852710f, 0.852760f, 0.852810f, 0.852861f, 0.852911f,
- 0.852961f, 0.853011f, 0.853061f, 0.853111f, 0.853161f, 0.853211f, 0.853261f, 0.853311f,
- 0.853361f, 0.853411f, 0.853461f, 0.853511f, 0.853561f, 0.853611f, 0.853660f, 0.853710f,
- 0.853760f, 0.853810f, 0.853860f, 0.853910f, 0.853960f, 0.854010f, 0.854060f, 0.854110f,
- 0.854159f, 0.854209f, 0.854259f, 0.854309f, 0.854359f, 0.854409f, 0.854458f, 0.854508f,
- 0.854558f, 0.854608f, 0.854658f, 0.854707f, 0.854757f, 0.854807f, 0.854857f, 0.854906f,
- 0.854956f, 0.855006f, 0.855056f, 0.855105f, 0.855155f, 0.855205f, 0.855254f, 0.855304f,
- 0.855354f, 0.855403f, 0.855453f, 0.855503f, 0.855552f, 0.855602f, 0.855651f, 0.855701f,
- 0.855751f, 0.855800f, 0.855850f, 0.855900f, 0.855949f, 0.855999f, 0.856048f, 0.856098f,
- 0.856147f, 0.856197f, 0.856246f, 0.856296f, 0.856345f, 0.856395f, 0.856444f, 0.856494f,
- 0.856543f, 0.856593f, 0.856642f, 0.856692f, 0.856741f, 0.856791f, 0.856840f, 0.856890f,
- 0.856939f, 0.856988f, 0.857038f, 0.857087f, 0.857137f, 0.857186f, 0.857235f, 0.857285f,
- 0.857334f, 0.857383f, 0.857433f, 0.857482f, 0.857531f, 0.857581f, 0.857630f, 0.857679f,
- 0.857729f, 0.857778f, 0.857827f, 0.857876f, 0.857926f, 0.857975f, 0.858024f, 0.858073f,
- 0.858123f, 0.858172f, 0.858221f, 0.858270f, 0.858320f, 0.858369f, 0.858418f, 0.858467f,
- 0.858516f, 0.858565f, 0.858615f, 0.858664f, 0.858713f, 0.858762f, 0.858811f, 0.858860f,
- 0.858909f, 0.858958f, 0.859007f, 0.859057f, 0.859106f, 0.859155f, 0.859204f, 0.859253f,
- 0.859302f, 0.859351f, 0.859400f, 0.859449f, 0.859498f, 0.859547f, 0.859596f, 0.859645f,
- 0.859694f, 0.859743f, 0.859792f, 0.859841f, 0.859890f, 0.859939f, 0.859988f, 0.860036f,
- 0.860085f, 0.860134f, 0.860183f, 0.860232f, 0.860281f, 0.860330f, 0.860379f, 0.860428f,
- 0.860476f, 0.860525f, 0.860574f, 0.860623f, 0.860672f, 0.860721f, 0.860769f, 0.860818f,
- 0.860867f, 0.860916f, 0.860964f, 0.861013f, 0.861062f, 0.861111f, 0.861160f, 0.861208f,
- 0.861257f, 0.861306f, 0.861354f, 0.861403f, 0.861452f, 0.861500f, 0.861549f, 0.861598f,
- 0.861646f, 0.861695f, 0.861744f, 0.861792f, 0.861841f, 0.861890f, 0.861938f, 0.861987f,
- 0.862035f, 0.862084f, 0.862133f, 0.862181f, 0.862230f, 0.862278f, 0.862327f, 0.862375f,
- 0.862424f, 0.862472f, 0.862521f, 0.862570f, 0.862618f, 0.862666f, 0.862715f, 0.862763f,
- 0.862812f, 0.862860f, 0.862909f, 0.862957f, 0.863006f, 0.863054f, 0.863103f, 0.863151f,
- 0.863199f, 0.863248f, 0.863296f, 0.863345f, 0.863393f, 0.863441f, 0.863490f, 0.863538f,
- 0.863586f, 0.863635f, 0.863683f, 0.863731f, 0.863780f, 0.863828f, 0.863876f, 0.863925f,
- 0.863973f, 0.864021f, 0.864069f, 0.864118f, 0.864166f, 0.864214f, 0.864262f, 0.864311f,
- 0.864359f, 0.864407f, 0.864455f, 0.864503f, 0.864552f, 0.864600f, 0.864648f, 0.864696f,
- 0.864744f, 0.864792f, 0.864841f, 0.864889f, 0.864937f, 0.864985f, 0.865033f, 0.865081f,
- 0.865129f, 0.865177f, 0.865225f, 0.865273f, 0.865321f, 0.865369f, 0.865418f, 0.865466f,
- 0.865514f, 0.865562f, 0.865610f, 0.865658f, 0.865706f, 0.865754f, 0.865802f, 0.865850f,
- 0.865898f, 0.865946f, 0.865993f, 0.866041f, 0.866089f, 0.866137f, 0.866185f, 0.866233f,
- 0.866281f, 0.866329f, 0.866377f, 0.866425f, 0.866472f, 0.866520f, 0.866568f, 0.866616f,
- 0.866664f, 0.866712f, 0.866759f, 0.866807f, 0.866855f, 0.866903f, 0.866951f, 0.866998f,
- 0.867046f, 0.867094f, 0.867142f, 0.867190f, 0.867237f, 0.867285f, 0.867333f, 0.867380f,
- 0.867428f, 0.867476f, 0.867523f, 0.867571f, 0.867619f, 0.867667f, 0.867714f, 0.867762f,
- 0.867809f, 0.867857f, 0.867905f, 0.867952f, 0.868000f, 0.868048f, 0.868095f, 0.868143f,
- 0.868190f, 0.868238f, 0.868285f, 0.868333f, 0.868381f, 0.868428f, 0.868476f, 0.868523f,
- 0.868571f, 0.868618f, 0.868666f, 0.868713f, 0.868761f, 0.868808f, 0.868856f, 0.868903f,
- 0.868951f, 0.868998f, 0.869045f, 0.869093f, 0.869140f, 0.869188f, 0.869235f, 0.869282f,
- 0.869330f, 0.869377f, 0.869425f, 0.869472f, 0.869519f, 0.869567f, 0.869614f, 0.869661f,
- 0.869709f, 0.869756f, 0.869803f, 0.869851f, 0.869898f, 0.869945f, 0.869992f, 0.870040f,
- 0.870087f, 0.870134f, 0.870182f, 0.870229f, 0.870276f, 0.870323f, 0.870370f, 0.870418f,
- 0.870465f, 0.870512f, 0.870559f, 0.870606f, 0.870654f, 0.870701f, 0.870748f, 0.870795f,
- 0.870842f, 0.870889f, 0.870936f, 0.870983f, 0.871031f, 0.871078f, 0.871125f, 0.871172f,
- 0.871219f, 0.871266f, 0.871313f, 0.871360f, 0.871407f, 0.871454f, 0.871501f, 0.871548f,
- 0.871595f, 0.871642f, 0.871689f, 0.871736f, 0.871783f, 0.871830f, 0.871877f, 0.871924f,
- 0.871971f, 0.872018f, 0.872065f, 0.872112f, 0.872159f, 0.872205f, 0.872252f, 0.872299f,
- 0.872346f, 0.872393f, 0.872440f, 0.872487f, 0.872534f, 0.872580f, 0.872627f, 0.872674f,
- 0.872721f, 0.872768f, 0.872814f, 0.872861f, 0.872908f, 0.872955f, 0.873001f, 0.873048f,
- 0.873095f, 0.873142f, 0.873188f, 0.873235f, 0.873282f, 0.873329f, 0.873375f, 0.873422f,
- 0.873469f, 0.873515f, 0.873562f, 0.873609f, 0.873655f, 0.873702f, 0.873749f, 0.873795f,
- 0.873842f, 0.873888f, 0.873935f, 0.873982f, 0.874028f, 0.874075f, 0.874121f, 0.874168f,
- 0.874215f, 0.874261f, 0.874308f, 0.874354f, 0.874401f, 0.874447f, 0.874494f, 0.874540f,
- 0.874587f, 0.874633f, 0.874680f, 0.874726f, 0.874773f, 0.874819f, 0.874865f, 0.874912f,
- 0.874958f, 0.875005f, 0.875051f, 0.875098f, 0.875144f, 0.875190f, 0.875237f, 0.875283f,
- 0.875329f, 0.875376f, 0.875422f, 0.875468f, 0.875515f, 0.875561f, 0.875607f, 0.875654f,
- 0.875700f, 0.875746f, 0.875793f, 0.875839f, 0.875885f, 0.875931f, 0.875978f, 0.876024f,
- 0.876070f, 0.876116f, 0.876163f, 0.876209f, 0.876255f, 0.876301f, 0.876347f, 0.876393f,
- 0.876440f, 0.876486f, 0.876532f, 0.876578f, 0.876624f, 0.876670f, 0.876716f, 0.876763f,
- 0.876809f, 0.876855f, 0.876901f, 0.876947f, 0.876993f, 0.877039f, 0.877085f, 0.877131f,
- 0.877177f, 0.877223f, 0.877269f, 0.877315f, 0.877361f, 0.877407f, 0.877453f, 0.877499f,
- 0.877545f, 0.877591f, 0.877637f, 0.877683f, 0.877729f, 0.877775f, 0.877821f, 0.877867f,
- 0.877913f, 0.877959f, 0.878005f, 0.878051f, 0.878096f, 0.878142f, 0.878188f, 0.878234f,
- 0.878280f, 0.878326f, 0.878371f, 0.878417f, 0.878463f, 0.878509f, 0.878555f, 0.878600f,
- 0.878646f, 0.878692f, 0.878738f, 0.878784f, 0.878829f, 0.878875f, 0.878921f, 0.878967f,
- 0.879012f, 0.879058f, 0.879104f, 0.879149f, 0.879195f, 0.879241f, 0.879286f, 0.879332f,
- 0.879378f, 0.879423f, 0.879469f, 0.879515f, 0.879560f, 0.879606f, 0.879651f, 0.879697f,
- 0.879743f, 0.879788f, 0.879834f, 0.879879f, 0.879925f, 0.879970f, 0.880016f, 0.880061f,
- 0.880107f, 0.880153f, 0.880198f, 0.880244f, 0.880289f, 0.880334f, 0.880380f, 0.880425f,
- 0.880471f, 0.880516f, 0.880562f, 0.880607f, 0.880653f, 0.880698f, 0.880743f, 0.880789f,
- 0.880834f, 0.880880f, 0.880925f, 0.880970f, 0.881016f, 0.881061f, 0.881106f, 0.881152f,
- 0.881197f, 0.881242f, 0.881288f, 0.881333f, 0.881378f, 0.881424f, 0.881469f, 0.881514f,
- 0.881559f, 0.881605f, 0.881650f, 0.881695f, 0.881740f, 0.881786f, 0.881831f, 0.881876f,
- 0.881921f, 0.881966f, 0.882012f, 0.882057f, 0.882102f, 0.882147f, 0.882192f, 0.882237f,
- 0.882283f, 0.882328f, 0.882373f, 0.882418f, 0.882463f, 0.882508f, 0.882553f, 0.882598f,
- 0.882643f, 0.882688f, 0.882733f, 0.882779f, 0.882824f, 0.882869f, 0.882914f, 0.882959f,
- 0.883004f, 0.883049f, 0.883094f, 0.883139f, 0.883184f, 0.883228f, 0.883273f, 0.883318f,
- 0.883363f, 0.883408f, 0.883453f, 0.883498f, 0.883543f, 0.883588f, 0.883633f, 0.883678f,
- 0.883723f, 0.883767f, 0.883812f, 0.883857f, 0.883902f, 0.883947f, 0.883992f, 0.884036f,
- 0.884081f, 0.884126f, 0.884171f, 0.884216f, 0.884260f, 0.884305f, 0.884350f, 0.884395f,
- 0.884439f, 0.884484f, 0.884529f, 0.884574f, 0.884618f, 0.884663f, 0.884708f, 0.884752f,
- 0.884797f, 0.884842f, 0.884886f, 0.884931f, 0.884976f, 0.885020f, 0.885065f, 0.885110f,
- 0.885154f, 0.885199f, 0.885243f, 0.885288f, 0.885333f, 0.885377f, 0.885422f, 0.885466f,
- 0.885511f, 0.885555f, 0.885600f, 0.885644f, 0.885689f, 0.885733f, 0.885778f, 0.885822f,
- 0.885867f, 0.885911f, 0.885956f, 0.886000f, 0.886045f, 0.886089f, 0.886134f, 0.886178f,
- 0.886223f, 0.886267f, 0.886311f, 0.886356f, 0.886400f, 0.886445f, 0.886489f, 0.886533f,
- 0.886578f, 0.886622f, 0.886666f, 0.886711f, 0.886755f, 0.886799f, 0.886844f, 0.886888f,
- 0.886932f, 0.886976f, 0.887021f, 0.887065f, 0.887109f, 0.887153f, 0.887198f, 0.887242f,
- 0.887286f, 0.887330f, 0.887375f, 0.887419f, 0.887463f, 0.887507f, 0.887551f, 0.887595f,
- 0.887640f, 0.887684f, 0.887728f, 0.887772f, 0.887816f, 0.887860f, 0.887904f, 0.887949f,
- 0.887993f, 0.888037f, 0.888081f, 0.888125f, 0.888169f, 0.888213f, 0.888257f, 0.888301f,
- 0.888345f, 0.888389f, 0.888433f, 0.888477f, 0.888521f, 0.888565f, 0.888609f, 0.888653f,
- 0.888697f, 0.888741f, 0.888785f, 0.888829f, 0.888873f, 0.888917f, 0.888961f, 0.889004f,
- 0.889048f, 0.889092f, 0.889136f, 0.889180f, 0.889224f, 0.889268f, 0.889312f, 0.889355f,
- 0.889399f, 0.889443f, 0.889487f, 0.889531f, 0.889574f, 0.889618f, 0.889662f, 0.889706f,
- 0.889750f, 0.889793f, 0.889837f, 0.889881f, 0.889925f, 0.889968f, 0.890012f, 0.890056f,
- 0.890099f, 0.890143f, 0.890187f, 0.890230f, 0.890274f, 0.890318f, 0.890361f, 0.890405f,
- 0.890449f, 0.890492f, 0.890536f, 0.890580f, 0.890623f, 0.890667f, 0.890710f, 0.890754f,
- 0.890797f, 0.890841f, 0.890885f, 0.890928f, 0.890972f, 0.891015f, 0.891059f, 0.891102f,
- 0.891146f, 0.891189f, 0.891233f, 0.891276f, 0.891320f, 0.891363f, 0.891407f, 0.891450f,
- 0.891493f, 0.891537f, 0.891580f, 0.891624f, 0.891667f, 0.891711f, 0.891754f, 0.891797f,
- 0.891841f, 0.891884f, 0.891927f, 0.891971f, 0.892014f, 0.892057f, 0.892101f, 0.892144f,
- 0.892187f, 0.892231f, 0.892274f, 0.892317f, 0.892361f, 0.892404f, 0.892447f, 0.892490f,
- 0.892534f, 0.892577f, 0.892620f, 0.892663f, 0.892706f, 0.892750f, 0.892793f, 0.892836f,
- 0.892879f, 0.892922f, 0.892965f, 0.893009f, 0.893052f, 0.893095f, 0.893138f, 0.893181f,
- 0.893224f, 0.893267f, 0.893310f, 0.893354f, 0.893397f, 0.893440f, 0.893483f, 0.893526f,
- 0.893569f, 0.893612f, 0.893655f, 0.893698f, 0.893741f, 0.893784f, 0.893827f, 0.893870f,
- 0.893913f, 0.893956f, 0.893999f, 0.894042f, 0.894085f, 0.894128f, 0.894171f, 0.894214f,
- 0.894256f, 0.894299f, 0.894342f, 0.894385f, 0.894428f, 0.894471f, 0.894514f, 0.894557f,
- 0.894599f, 0.894642f, 0.894685f, 0.894728f, 0.894771f, 0.894814f, 0.894856f, 0.894899f,
- 0.894942f, 0.894985f, 0.895028f, 0.895070f, 0.895113f, 0.895156f, 0.895198f, 0.895241f,
- 0.895284f, 0.895327f, 0.895369f, 0.895412f, 0.895455f, 0.895497f, 0.895540f, 0.895583f,
- 0.895625f, 0.895668f, 0.895711f, 0.895753f, 0.895796f, 0.895838f, 0.895881f, 0.895924f,
- 0.895966f, 0.896009f, 0.896051f, 0.896094f, 0.896137f, 0.896179f, 0.896222f, 0.896264f,
- 0.896307f, 0.896349f, 0.896392f, 0.896434f, 0.896477f, 0.896519f, 0.896562f, 0.896604f,
- 0.896646f, 0.896689f, 0.896731f, 0.896774f, 0.896816f, 0.896859f, 0.896901f, 0.896943f,
- 0.896986f, 0.897028f, 0.897071f, 0.897113f, 0.897155f, 0.897198f, 0.897240f, 0.897282f,
- 0.897325f, 0.897367f, 0.897409f, 0.897452f, 0.897494f, 0.897536f, 0.897578f, 0.897621f,
- 0.897663f, 0.897705f, 0.897747f, 0.897790f, 0.897832f, 0.897874f, 0.897916f, 0.897958f,
- 0.898001f, 0.898043f, 0.898085f, 0.898127f, 0.898169f, 0.898211f, 0.898254f, 0.898296f,
- 0.898338f, 0.898380f, 0.898422f, 0.898464f, 0.898506f, 0.898548f, 0.898590f, 0.898632f,
- 0.898674f, 0.898717f, 0.898759f, 0.898801f, 0.898843f, 0.898885f, 0.898927f, 0.898969f,
- 0.899011f, 0.899053f, 0.899095f, 0.899137f, 0.899179f, 0.899220f, 0.899262f, 0.899304f,
- 0.899346f, 0.899388f, 0.899430f, 0.899472f, 0.899514f, 0.899556f, 0.899598f, 0.899639f,
- 0.899681f, 0.899723f, 0.899765f, 0.899807f, 0.899849f, 0.899890f, 0.899932f, 0.899974f,
- 0.900016f, 0.900058f, 0.900099f, 0.900141f, 0.900183f, 0.900225f, 0.900266f, 0.900308f,
- 0.900350f, 0.900392f, 0.900433f, 0.900475f, 0.900517f, 0.900558f, 0.900600f, 0.900642f,
- 0.900683f, 0.900725f, 0.900767f, 0.900808f, 0.900850f, 0.900892f, 0.900933f, 0.900975f,
- 0.901016f, 0.901058f, 0.901100f, 0.901141f, 0.901183f, 0.901224f, 0.901266f, 0.901307f,
- 0.901349f, 0.901390f, 0.901432f, 0.901473f, 0.901515f, 0.901556f, 0.901598f, 0.901639f,
- 0.901681f, 0.901722f, 0.901764f, 0.901805f, 0.901847f, 0.901888f, 0.901929f, 0.901971f,
- 0.902012f, 0.902054f, 0.902095f, 0.902136f, 0.902178f, 0.902219f, 0.902260f, 0.902302f,
- 0.902343f, 0.902384f, 0.902426f, 0.902467f, 0.902508f, 0.902550f, 0.902591f, 0.902632f,
- 0.902673f, 0.902715f, 0.902756f, 0.902797f, 0.902838f, 0.902879f, 0.902921f, 0.902962f,
- 0.903003f, 0.903044f, 0.903085f, 0.903127f, 0.903168f, 0.903209f, 0.903250f, 0.903291f,
- 0.903332f, 0.903373f, 0.903415f, 0.903456f, 0.903497f, 0.903538f, 0.903579f, 0.903620f,
- 0.903661f, 0.903702f, 0.903743f, 0.903784f, 0.903825f, 0.903866f, 0.903907f, 0.903948f,
- 0.903989f, 0.904030f, 0.904071f, 0.904112f, 0.904153f, 0.904194f, 0.904235f, 0.904276f,
- 0.904317f, 0.904358f, 0.904399f, 0.904440f, 0.904481f, 0.904521f, 0.904562f, 0.904603f,
- 0.904644f, 0.904685f, 0.904726f, 0.904767f, 0.904807f, 0.904848f, 0.904889f, 0.904930f,
- 0.904971f, 0.905011f, 0.905052f, 0.905093f, 0.905134f, 0.905175f, 0.905215f, 0.905256f,
- 0.905297f, 0.905337f, 0.905378f, 0.905419f, 0.905460f, 0.905500f, 0.905541f, 0.905582f,
- 0.905622f, 0.905663f, 0.905704f, 0.905744f, 0.905785f, 0.905825f, 0.905866f, 0.905907f,
- 0.905947f, 0.905988f, 0.906028f, 0.906069f, 0.906110f, 0.906150f, 0.906191f, 0.906231f,
- 0.906272f, 0.906312f, 0.906353f, 0.906393f, 0.906434f, 0.906474f, 0.906515f, 0.906555f,
- 0.906596f, 0.906636f, 0.906677f, 0.906717f, 0.906757f, 0.906798f, 0.906838f, 0.906879f,
- 0.906919f, 0.906959f, 0.907000f, 0.907040f, 0.907081f, 0.907121f, 0.907161f, 0.907202f,
- 0.907242f, 0.907282f, 0.907323f, 0.907363f, 0.907403f, 0.907444f, 0.907484f, 0.907524f,
- 0.907564f, 0.907605f, 0.907645f, 0.907685f, 0.907725f, 0.907766f, 0.907806f, 0.907846f,
- 0.907886f, 0.907926f, 0.907966f, 0.908007f, 0.908047f, 0.908087f, 0.908127f, 0.908167f,
- 0.908207f, 0.908248f, 0.908288f, 0.908328f, 0.908368f, 0.908408f, 0.908448f, 0.908488f,
- 0.908528f, 0.908568f, 0.908608f, 0.908648f, 0.908688f, 0.908728f, 0.908768f, 0.908808f,
- 0.908848f, 0.908888f, 0.908928f, 0.908968f, 0.909008f, 0.909048f, 0.909088f, 0.909128f,
- 0.909168f, 0.909208f, 0.909248f, 0.909288f, 0.909328f, 0.909368f, 0.909407f, 0.909447f,
- 0.909487f, 0.909527f, 0.909567f, 0.909607f, 0.909646f, 0.909686f, 0.909726f, 0.909766f,
- 0.909806f, 0.909845f, 0.909885f, 0.909925f, 0.909965f, 0.910005f, 0.910044f, 0.910084f,
- 0.910124f, 0.910163f, 0.910203f, 0.910243f, 0.910283f, 0.910322f, 0.910362f, 0.910402f,
- 0.910441f, 0.910481f, 0.910521f, 0.910560f, 0.910600f, 0.910639f, 0.910679f, 0.910719f,
- 0.910758f, 0.910798f, 0.910837f, 0.910877f, 0.910917f, 0.910956f, 0.910996f, 0.911035f,
- 0.911075f, 0.911114f, 0.911154f, 0.911193f, 0.911233f, 0.911272f, 0.911312f, 0.911351f,
- 0.911391f, 0.911430f, 0.911470f, 0.911509f, 0.911548f, 0.911588f, 0.911627f, 0.911667f,
- 0.911706f, 0.911745f, 0.911785f, 0.911824f, 0.911864f, 0.911903f, 0.911942f, 0.911982f,
- 0.912021f, 0.912060f, 0.912099f, 0.912139f, 0.912178f, 0.912217f, 0.912257f, 0.912296f,
- 0.912335f, 0.912374f, 0.912414f, 0.912453f, 0.912492f, 0.912531f, 0.912571f, 0.912610f,
- 0.912649f, 0.912688f, 0.912727f, 0.912766f, 0.912806f, 0.912845f, 0.912884f, 0.912923f,
- 0.912962f, 0.913001f, 0.913040f, 0.913080f, 0.913119f, 0.913158f, 0.913197f, 0.913236f,
- 0.913275f, 0.913314f, 0.913353f, 0.913392f, 0.913431f, 0.913470f, 0.913509f, 0.913548f,
- 0.913587f, 0.913626f, 0.913665f, 0.913704f, 0.913743f, 0.913782f, 0.913821f, 0.913860f,
- 0.913899f, 0.913938f, 0.913976f, 0.914015f, 0.914054f, 0.914093f, 0.914132f, 0.914171f,
- 0.914210f, 0.914249f, 0.914287f, 0.914326f, 0.914365f, 0.914404f, 0.914443f, 0.914482f,
- 0.914520f, 0.914559f, 0.914598f, 0.914637f, 0.914675f, 0.914714f, 0.914753f, 0.914792f,
- 0.914830f, 0.914869f, 0.914908f, 0.914946f, 0.914985f, 0.915024f, 0.915062f, 0.915101f,
- 0.915140f, 0.915178f, 0.915217f, 0.915256f, 0.915294f, 0.915333f, 0.915372f, 0.915410f,
- 0.915449f, 0.915487f, 0.915526f, 0.915564f, 0.915603f, 0.915642f, 0.915680f, 0.915719f,
- 0.915757f, 0.915796f, 0.915834f, 0.915873f, 0.915911f, 0.915950f, 0.915988f, 0.916027f,
- 0.916065f, 0.916103f, 0.916142f, 0.916180f, 0.916219f, 0.916257f, 0.916296f, 0.916334f,
- 0.916372f, 0.916411f, 0.916449f, 0.916487f, 0.916526f, 0.916564f, 0.916602f, 0.916641f,
- 0.916679f, 0.916717f, 0.916756f, 0.916794f, 0.916832f, 0.916871f, 0.916909f, 0.916947f,
- 0.916985f, 0.917024f, 0.917062f, 0.917100f, 0.917138f, 0.917176f, 0.917215f, 0.917253f,
- 0.917291f, 0.917329f, 0.917367f, 0.917405f, 0.917444f, 0.917482f, 0.917520f, 0.917558f,
- 0.917596f, 0.917634f, 0.917672f, 0.917710f, 0.917749f, 0.917787f, 0.917825f, 0.917863f,
- 0.917901f, 0.917939f, 0.917977f, 0.918015f, 0.918053f, 0.918091f, 0.918129f, 0.918167f,
- 0.918205f, 0.918243f, 0.918281f, 0.918319f, 0.918357f, 0.918395f, 0.918433f, 0.918471f,
- 0.918508f, 0.918546f, 0.918584f, 0.918622f, 0.918660f, 0.918698f, 0.918736f, 0.918774f,
- 0.918811f, 0.918849f, 0.918887f, 0.918925f, 0.918963f, 0.919001f, 0.919038f, 0.919076f,
- 0.919114f, 0.919152f, 0.919189f, 0.919227f, 0.919265f, 0.919303f, 0.919340f, 0.919378f,
- 0.919416f, 0.919453f, 0.919491f, 0.919529f, 0.919567f, 0.919604f, 0.919642f, 0.919680f,
- 0.919717f, 0.919755f, 0.919792f, 0.919830f, 0.919868f, 0.919905f, 0.919943f, 0.919980f,
- 0.920018f, 0.920056f, 0.920093f, 0.920131f, 0.920168f, 0.920206f, 0.920243f, 0.920281f,
- 0.920318f, 0.920356f, 0.920393f, 0.920431f, 0.920468f, 0.920506f, 0.920543f, 0.920581f,
- 0.920618f, 0.920655f, 0.920693f, 0.920730f, 0.920768f, 0.920805f, 0.920842f, 0.920880f,
- 0.920917f, 0.920955f, 0.920992f, 0.921029f, 0.921067f, 0.921104f, 0.921141f, 0.921179f,
- 0.921216f, 0.921253f, 0.921291f, 0.921328f, 0.921365f, 0.921402f, 0.921440f, 0.921477f,
- 0.921514f, 0.921551f, 0.921588f, 0.921626f, 0.921663f, 0.921700f, 0.921737f, 0.921774f,
- 0.921812f, 0.921849f, 0.921886f, 0.921923f, 0.921960f, 0.921997f, 0.922034f, 0.922072f,
- 0.922109f, 0.922146f, 0.922183f, 0.922220f, 0.922257f, 0.922294f, 0.922331f, 0.922368f,
- 0.922405f, 0.922442f, 0.922479f, 0.922516f, 0.922553f, 0.922590f, 0.922627f, 0.922664f,
- 0.922701f, 0.922738f, 0.922775f, 0.922812f, 0.922849f, 0.922886f, 0.922923f, 0.922960f,
- 0.922997f, 0.923033f, 0.923070f, 0.923107f, 0.923144f, 0.923181f, 0.923218f, 0.923255f,
- 0.923291f, 0.923328f, 0.923365f, 0.923402f, 0.923439f, 0.923475f, 0.923512f, 0.923549f,
- 0.923586f, 0.923622f, 0.923659f, 0.923696f, 0.923733f, 0.923769f, 0.923806f, 0.923843f,
- 0.923880f, 0.923916f, 0.923953f, 0.923990f, 0.924026f, 0.924063f, 0.924100f, 0.924136f,
- 0.924173f, 0.924209f, 0.924246f, 0.924283f, 0.924319f, 0.924356f, 0.924392f, 0.924429f,
- 0.924465f, 0.924502f, 0.924539f, 0.924575f, 0.924612f, 0.924648f, 0.924685f, 0.924721f,
- 0.924758f, 0.924794f, 0.924831f, 0.924867f, 0.924904f, 0.924940f, 0.924976f, 0.925013f,
- 0.925049f, 0.925086f, 0.925122f, 0.925158f, 0.925195f, 0.925231f, 0.925268f, 0.925304f,
- 0.925340f, 0.925377f, 0.925413f, 0.925449f, 0.925486f, 0.925522f, 0.925558f, 0.925595f,
- 0.925631f, 0.925667f, 0.925703f, 0.925740f, 0.925776f, 0.925812f, 0.925848f, 0.925885f,
- 0.925921f, 0.925957f, 0.925993f, 0.926029f, 0.926066f, 0.926102f, 0.926138f, 0.926174f,
- 0.926210f, 0.926246f, 0.926283f, 0.926319f, 0.926355f, 0.926391f, 0.926427f, 0.926463f,
- 0.926499f, 0.926535f, 0.926571f, 0.926607f, 0.926643f, 0.926679f, 0.926715f, 0.926751f,
- 0.926787f, 0.926823f, 0.926859f, 0.926895f, 0.926931f, 0.926967f, 0.927003f, 0.927039f,
- 0.927075f, 0.927111f, 0.927147f, 0.927183f, 0.927219f, 0.927255f, 0.927291f, 0.927327f,
- 0.927363f, 0.927398f, 0.927434f, 0.927470f, 0.927506f, 0.927542f, 0.927578f, 0.927613f,
- 0.927649f, 0.927685f, 0.927721f, 0.927757f, 0.927792f, 0.927828f, 0.927864f, 0.927900f,
- 0.927935f, 0.927971f, 0.928007f, 0.928043f, 0.928078f, 0.928114f, 0.928150f, 0.928185f,
- 0.928221f, 0.928257f, 0.928292f, 0.928328f, 0.928364f, 0.928399f, 0.928435f, 0.928470f,
- 0.928506f, 0.928542f, 0.928577f, 0.928613f, 0.928648f, 0.928684f, 0.928720f, 0.928755f,
- 0.928791f, 0.928826f, 0.928862f, 0.928897f, 0.928933f, 0.928968f, 0.929004f, 0.929039f,
- 0.929075f, 0.929110f, 0.929146f, 0.929181f, 0.929216f, 0.929252f, 0.929287f, 0.929323f,
- 0.929358f, 0.929393f, 0.929429f, 0.929464f, 0.929500f, 0.929535f, 0.929570f, 0.929606f,
- 0.929641f, 0.929676f, 0.929712f, 0.929747f, 0.929782f, 0.929817f, 0.929853f, 0.929888f,
- 0.929923f, 0.929958f, 0.929994f, 0.930029f, 0.930064f, 0.930099f, 0.930135f, 0.930170f,
- 0.930205f, 0.930240f, 0.930275f, 0.930311f, 0.930346f, 0.930381f, 0.930416f, 0.930451f,
- 0.930486f, 0.930521f, 0.930556f, 0.930592f, 0.930627f, 0.930662f, 0.930697f, 0.930732f,
- 0.930767f, 0.930802f, 0.930837f, 0.930872f, 0.930907f, 0.930942f, 0.930977f, 0.931012f,
- 0.931047f, 0.931082f, 0.931117f, 0.931152f, 0.931187f, 0.931222f, 0.931257f, 0.931292f,
- 0.931327f, 0.931362f, 0.931397f, 0.931431f, 0.931466f, 0.931501f, 0.931536f, 0.931571f,
- 0.931606f, 0.931641f, 0.931675f, 0.931710f, 0.931745f, 0.931780f, 0.931815f, 0.931849f,
- 0.931884f, 0.931919f, 0.931954f, 0.931989f, 0.932023f, 0.932058f, 0.932093f, 0.932128f,
- 0.932162f, 0.932197f, 0.932232f, 0.932266f, 0.932301f, 0.932336f, 0.932370f, 0.932405f,
- 0.932440f, 0.932474f, 0.932509f, 0.932544f, 0.932578f, 0.932613f, 0.932647f, 0.932682f,
- 0.932716f, 0.932751f, 0.932786f, 0.932820f, 0.932855f, 0.932889f, 0.932924f, 0.932958f,
- 0.932993f, 0.933027f, 0.933062f, 0.933096f, 0.933131f, 0.933165f, 0.933200f, 0.933234f,
- 0.933269f, 0.933303f, 0.933337f, 0.933372f, 0.933406f, 0.933441f, 0.933475f, 0.933509f,
- 0.933544f, 0.933578f, 0.933612f, 0.933647f, 0.933681f, 0.933716f, 0.933750f, 0.933784f,
- 0.933818f, 0.933853f, 0.933887f, 0.933921f, 0.933956f, 0.933990f, 0.934024f, 0.934058f,
- 0.934093f, 0.934127f, 0.934161f, 0.934195f, 0.934229f, 0.934264f, 0.934298f, 0.934332f,
- 0.934366f, 0.934400f, 0.934434f, 0.934469f, 0.934503f, 0.934537f, 0.934571f, 0.934605f,
- 0.934639f, 0.934673f, 0.934707f, 0.934741f, 0.934775f, 0.934810f, 0.934844f, 0.934878f,
- 0.934912f, 0.934946f, 0.934980f, 0.935014f, 0.935048f, 0.935082f, 0.935116f, 0.935150f,
- 0.935184f, 0.935217f, 0.935251f, 0.935285f, 0.935319f, 0.935353f, 0.935387f, 0.935421f,
- 0.935455f, 0.935489f, 0.935523f, 0.935556f, 0.935590f, 0.935624f, 0.935658f, 0.935692f,
- 0.935726f, 0.935759f, 0.935793f, 0.935827f, 0.935861f, 0.935895f, 0.935928f, 0.935962f,
- 0.935996f, 0.936030f, 0.936063f, 0.936097f, 0.936131f, 0.936165f, 0.936198f, 0.936232f,
- 0.936266f, 0.936299f, 0.936333f, 0.936367f, 0.936400f, 0.936434f, 0.936468f, 0.936501f,
- 0.936535f, 0.936568f, 0.936602f, 0.936636f, 0.936669f, 0.936703f, 0.936736f, 0.936770f,
- 0.936803f, 0.936837f, 0.936871f, 0.936904f, 0.936938f, 0.936971f, 0.937005f, 0.937038f,
- 0.937072f, 0.937105f, 0.937138f, 0.937172f, 0.937205f, 0.937239f, 0.937272f, 0.937306f,
- 0.937339f, 0.937372f, 0.937406f, 0.937439f, 0.937473f, 0.937506f, 0.937539f, 0.937573f,
- 0.937606f, 0.937639f, 0.937673f, 0.937706f, 0.937739f, 0.937773f, 0.937806f, 0.937839f,
- 0.937872f, 0.937906f, 0.937939f, 0.937972f, 0.938005f, 0.938039f, 0.938072f, 0.938105f,
- 0.938138f, 0.938171f, 0.938205f, 0.938238f, 0.938271f, 0.938304f, 0.938337f, 0.938370f,
- 0.938404f, 0.938437f, 0.938470f, 0.938503f, 0.938536f, 0.938569f, 0.938602f, 0.938635f,
- 0.938668f, 0.938701f, 0.938734f, 0.938767f, 0.938800f, 0.938833f, 0.938866f, 0.938900f,
- 0.938932f, 0.938965f, 0.938998f, 0.939031f, 0.939064f, 0.939097f, 0.939130f, 0.939163f,
- 0.939196f, 0.939229f, 0.939262f, 0.939295f, 0.939328f, 0.939361f, 0.939394f, 0.939426f,
- 0.939459f, 0.939492f, 0.939525f, 0.939558f, 0.939591f, 0.939623f, 0.939656f, 0.939689f,
- 0.939722f, 0.939755f, 0.939787f, 0.939820f, 0.939853f, 0.939886f, 0.939918f, 0.939951f,
- 0.939984f, 0.940016f, 0.940049f, 0.940082f, 0.940115f, 0.940147f, 0.940180f, 0.940213f,
- 0.940245f, 0.940278f, 0.940310f, 0.940343f, 0.940376f, 0.940408f, 0.940441f, 0.940473f,
- 0.940506f, 0.940539f, 0.940571f, 0.940604f, 0.940636f, 0.940669f, 0.940701f, 0.940734f,
- 0.940766f, 0.940799f, 0.940831f, 0.940864f, 0.940896f, 0.940929f, 0.940961f, 0.940994f,
- 0.941026f, 0.941059f, 0.941091f, 0.941123f, 0.941156f, 0.941188f, 0.941221f, 0.941253f,
- 0.941285f, 0.941318f, 0.941350f, 0.941382f, 0.941415f, 0.941447f, 0.941479f, 0.941512f,
- 0.941544f, 0.941576f, 0.941609f, 0.941641f, 0.941673f, 0.941705f, 0.941738f, 0.941770f,
- 0.941802f, 0.941834f, 0.941867f, 0.941899f, 0.941931f, 0.941963f, 0.941995f, 0.942028f,
- 0.942060f, 0.942092f, 0.942124f, 0.942156f, 0.942188f, 0.942220f, 0.942253f, 0.942285f,
- 0.942317f, 0.942349f, 0.942381f, 0.942413f, 0.942445f, 0.942477f, 0.942509f, 0.942541f,
- 0.942573f, 0.942605f, 0.942637f, 0.942669f, 0.942701f, 0.942733f, 0.942765f, 0.942797f,
- 0.942829f, 0.942861f, 0.942893f, 0.942925f, 0.942957f, 0.942989f, 0.943021f, 0.943053f,
- 0.943084f, 0.943116f, 0.943148f, 0.943180f, 0.943212f, 0.943244f, 0.943276f, 0.943307f,
- 0.943339f, 0.943371f, 0.943403f, 0.943435f, 0.943466f, 0.943498f, 0.943530f, 0.943562f,
- 0.943593f, 0.943625f, 0.943657f, 0.943689f, 0.943720f, 0.943752f, 0.943784f, 0.943815f,
- 0.943847f, 0.943879f, 0.943910f, 0.943942f, 0.943974f, 0.944005f, 0.944037f, 0.944069f,
- 0.944100f, 0.944132f, 0.944163f, 0.944195f, 0.944227f, 0.944258f, 0.944290f, 0.944321f,
- 0.944353f, 0.944384f, 0.944416f, 0.944447f, 0.944479f, 0.944510f, 0.944542f, 0.944573f,
- 0.944605f, 0.944636f, 0.944668f, 0.944699f, 0.944731f, 0.944762f, 0.944793f, 0.944825f,
- 0.944856f, 0.944888f, 0.944919f, 0.944950f, 0.944982f, 0.945013f, 0.945045f, 0.945076f,
- 0.945107f, 0.945139f, 0.945170f, 0.945201f, 0.945232f, 0.945264f, 0.945295f, 0.945326f,
- 0.945358f, 0.945389f, 0.945420f, 0.945451f, 0.945482f, 0.945514f, 0.945545f, 0.945576f,
- 0.945607f, 0.945639f, 0.945670f, 0.945701f, 0.945732f, 0.945763f, 0.945794f, 0.945825f,
- 0.945857f, 0.945888f, 0.945919f, 0.945950f, 0.945981f, 0.946012f, 0.946043f, 0.946074f,
- 0.946105f, 0.946136f, 0.946167f, 0.946198f, 0.946229f, 0.946260f, 0.946291f, 0.946322f,
- 0.946353f, 0.946384f, 0.946415f, 0.946446f, 0.946477f, 0.946508f, 0.946539f, 0.946570f,
- 0.946601f, 0.946632f, 0.946663f, 0.946694f, 0.946724f, 0.946755f, 0.946786f, 0.946817f,
- 0.946848f, 0.946879f, 0.946910f, 0.946940f, 0.946971f, 0.947002f, 0.947033f, 0.947064f,
- 0.947094f, 0.947125f, 0.947156f, 0.947187f, 0.947217f, 0.947248f, 0.947279f, 0.947310f,
- 0.947340f, 0.947371f, 0.947402f, 0.947432f, 0.947463f, 0.947494f, 0.947524f, 0.947555f,
- 0.947586f, 0.947616f, 0.947647f, 0.947677f, 0.947708f, 0.947739f, 0.947769f, 0.947800f,
- 0.947830f, 0.947861f, 0.947891f, 0.947922f, 0.947953f, 0.947983f, 0.948014f, 0.948044f,
- 0.948075f, 0.948105f, 0.948136f, 0.948166f, 0.948196f, 0.948227f, 0.948257f, 0.948288f,
- 0.948318f, 0.948349f, 0.948379f, 0.948409f, 0.948440f, 0.948470f, 0.948501f, 0.948531f,
- 0.948561f, 0.948592f, 0.948622f, 0.948652f, 0.948683f, 0.948713f, 0.948743f, 0.948774f,
- 0.948804f, 0.948834f, 0.948864f, 0.948895f, 0.948925f, 0.948955f, 0.948985f, 0.949016f,
- 0.949046f, 0.949076f, 0.949106f, 0.949136f, 0.949167f, 0.949197f, 0.949227f, 0.949257f,
- 0.949287f, 0.949317f, 0.949348f, 0.949378f, 0.949408f, 0.949438f, 0.949468f, 0.949498f,
- 0.949528f, 0.949558f, 0.949588f, 0.949618f, 0.949648f, 0.949678f, 0.949708f, 0.949739f,
- 0.949768f, 0.949798f, 0.949829f, 0.949858f, 0.949888f, 0.949918f, 0.949948f, 0.949978f,
- 0.950008f, 0.950038f, 0.950068f, 0.950098f, 0.950128f, 0.950158f, 0.950188f, 0.950218f,
- 0.950247f, 0.950277f, 0.950307f, 0.950337f, 0.950367f, 0.950397f, 0.950426f, 0.950456f,
- 0.950486f, 0.950516f, 0.950546f, 0.950575f, 0.950605f, 0.950635f, 0.950665f, 0.950694f,
- 0.950724f, 0.950754f, 0.950784f, 0.950813f, 0.950843f, 0.950873f, 0.950902f, 0.950932f,
- 0.950962f, 0.950991f, 0.951021f, 0.951051f, 0.951080f, 0.951110f, 0.951139f, 0.951169f,
- 0.951199f, 0.951228f, 0.951258f, 0.951287f, 0.951317f, 0.951346f, 0.951376f, 0.951406f,
- 0.951435f, 0.951465f, 0.951494f, 0.951524f, 0.951553f, 0.951582f, 0.951612f, 0.951641f,
- 0.951671f, 0.951700f, 0.951730f, 0.951759f, 0.951789f, 0.951818f, 0.951847f, 0.951877f,
- 0.951906f, 0.951936f, 0.951965f, 0.951994f, 0.952024f, 0.952053f, 0.952082f, 0.952112f,
- 0.952141f, 0.952170f, 0.952199f, 0.952229f, 0.952258f, 0.952287f, 0.952317f, 0.952346f,
- 0.952375f, 0.952404f, 0.952433f, 0.952463f, 0.952492f, 0.952521f, 0.952550f, 0.952579f,
- 0.952609f, 0.952638f, 0.952667f, 0.952696f, 0.952725f, 0.952754f, 0.952783f, 0.952813f,
- 0.952842f, 0.952871f, 0.952900f, 0.952929f, 0.952958f, 0.952987f, 0.953016f, 0.953045f,
- 0.953074f, 0.953103f, 0.953132f, 0.953161f, 0.953190f, 0.953219f, 0.953248f, 0.953277f,
- 0.953306f, 0.953335f, 0.953364f, 0.953393f, 0.953422f, 0.953451f, 0.953480f, 0.953508f,
- 0.953537f, 0.953566f, 0.953595f, 0.953624f, 0.953653f, 0.953682f, 0.953711f, 0.953739f,
- 0.953768f, 0.953797f, 0.953826f, 0.953855f, 0.953883f, 0.953912f, 0.953941f, 0.953970f,
- 0.953998f, 0.954027f, 0.954056f, 0.954085f, 0.954113f, 0.954142f, 0.954171f, 0.954199f,
- 0.954228f, 0.954257f, 0.954285f, 0.954314f, 0.954343f, 0.954371f, 0.954400f, 0.954429f,
- 0.954457f, 0.954486f, 0.954514f, 0.954543f, 0.954572f, 0.954600f, 0.954629f, 0.954657f,
- 0.954686f, 0.954714f, 0.954743f, 0.954771f, 0.954800f, 0.954828f, 0.954857f, 0.954885f,
- 0.954914f, 0.954942f, 0.954971f, 0.954999f, 0.955028f, 0.955056f, 0.955084f, 0.955113f,
- 0.955141f, 0.955170f, 0.955198f, 0.955226f, 0.955255f, 0.955283f, 0.955311f, 0.955340f,
- 0.955368f, 0.955396f, 0.955425f, 0.955453f, 0.955481f, 0.955510f, 0.955538f, 0.955566f,
- 0.955594f, 0.955623f, 0.955651f, 0.955679f, 0.955707f, 0.955736f, 0.955764f, 0.955792f,
- 0.955820f, 0.955848f, 0.955876f, 0.955905f, 0.955933f, 0.955961f, 0.955989f, 0.956017f,
- 0.956045f, 0.956073f, 0.956101f, 0.956130f, 0.956158f, 0.956186f, 0.956214f, 0.956242f,
- 0.956270f, 0.956298f, 0.956326f, 0.956354f, 0.956382f, 0.956410f, 0.956438f, 0.956466f,
- 0.956494f, 0.956522f, 0.956550f, 0.956578f, 0.956606f, 0.956634f, 0.956662f, 0.956689f,
- 0.956717f, 0.956745f, 0.956773f, 0.956801f, 0.956829f, 0.956857f, 0.956885f, 0.956913f,
- 0.956940f, 0.956968f, 0.956996f, 0.957024f, 0.957052f, 0.957079f, 0.957107f, 0.957135f,
- 0.957163f, 0.957190f, 0.957218f, 0.957246f, 0.957274f, 0.957301f, 0.957329f, 0.957357f,
- 0.957385f, 0.957412f, 0.957440f, 0.957468f, 0.957495f, 0.957523f, 0.957550f, 0.957578f,
- 0.957606f, 0.957633f, 0.957661f, 0.957689f, 0.957716f, 0.957744f, 0.957771f, 0.957799f,
- 0.957826f, 0.957854f, 0.957882f, 0.957909f, 0.957937f, 0.957964f, 0.957992f, 0.958019f,
- 0.958046f, 0.958074f, 0.958101f, 0.958129f, 0.958156f, 0.958184f, 0.958211f, 0.958239f,
- 0.958266f, 0.958293f, 0.958321f, 0.958348f, 0.958376f, 0.958403f, 0.958430f, 0.958458f,
- 0.958485f, 0.958512f, 0.958540f, 0.958567f, 0.958594f, 0.958622f, 0.958649f, 0.958676f,
- 0.958703f, 0.958731f, 0.958758f, 0.958785f, 0.958812f, 0.958840f, 0.958867f, 0.958894f,
- 0.958921f, 0.958949f, 0.958976f, 0.959003f, 0.959030f, 0.959057f, 0.959084f, 0.959112f,
- 0.959139f, 0.959166f, 0.959193f, 0.959220f, 0.959247f, 0.959274f, 0.959301f, 0.959328f,
- 0.959355f, 0.959382f, 0.959409f, 0.959436f, 0.959463f, 0.959491f, 0.959518f, 0.959545f,
- 0.959572f, 0.959598f, 0.959625f, 0.959652f, 0.959679f, 0.959706f, 0.959733f, 0.959760f,
- 0.959787f, 0.959814f, 0.959841f, 0.959868f, 0.959895f, 0.959922f, 0.959948f, 0.959975f,
- 0.960002f, 0.960029f, 0.960056f, 0.960083f, 0.960109f, 0.960136f, 0.960163f, 0.960190f,
- 0.960217f, 0.960243f, 0.960270f, 0.960297f, 0.960324f, 0.960350f, 0.960377f, 0.960404f,
- 0.960431f, 0.960457f, 0.960484f, 0.960511f, 0.960537f, 0.960564f, 0.960591f, 0.960617f,
- 0.960644f, 0.960670f, 0.960697f, 0.960724f, 0.960750f, 0.960777f, 0.960804f, 0.960830f,
- 0.960857f, 0.960883f, 0.960910f, 0.960936f, 0.960963f, 0.960989f, 0.961016f, 0.961042f,
- 0.961069f, 0.961095f, 0.961122f, 0.961148f, 0.961175f, 0.961201f, 0.961228f, 0.961254f,
- 0.961280f, 0.961307f, 0.961333f, 0.961360f, 0.961386f, 0.961412f, 0.961439f, 0.961465f,
- 0.961492f, 0.961518f, 0.961544f, 0.961571f, 0.961597f, 0.961623f, 0.961649f, 0.961676f,
- 0.961702f, 0.961728f, 0.961755f, 0.961781f, 0.961807f, 0.961833f, 0.961860f, 0.961886f,
- 0.961912f, 0.961938f, 0.961964f, 0.961991f, 0.962017f, 0.962043f, 0.962069f, 0.962095f,
- 0.962121f, 0.962148f, 0.962174f, 0.962200f, 0.962226f, 0.962252f, 0.962278f, 0.962304f,
- 0.962330f, 0.962356f, 0.962382f, 0.962408f, 0.962434f, 0.962460f, 0.962486f, 0.962512f,
- 0.962538f, 0.962564f, 0.962590f, 0.962616f, 0.962642f, 0.962668f, 0.962694f, 0.962720f,
- 0.962746f, 0.962772f, 0.962798f, 0.962824f, 0.962850f, 0.962876f, 0.962902f, 0.962927f,
- 0.962953f, 0.962979f, 0.963005f, 0.963031f, 0.963057f, 0.963082f, 0.963108f, 0.963134f,
- 0.963160f, 0.963186f, 0.963211f, 0.963237f, 0.963263f, 0.963289f, 0.963314f, 0.963340f,
- 0.963366f, 0.963391f, 0.963417f, 0.963443f, 0.963469f, 0.963494f, 0.963520f, 0.963546f,
- 0.963571f, 0.963597f, 0.963623f, 0.963648f, 0.963674f, 0.963699f, 0.963725f, 0.963750f,
- 0.963776f, 0.963802f, 0.963827f, 0.963853f, 0.963878f, 0.963904f, 0.963929f, 0.963955f,
- 0.963980f, 0.964006f, 0.964031f, 0.964057f, 0.964082f, 0.964108f, 0.964133f, 0.964159f,
- 0.964184f, 0.964209f, 0.964235f, 0.964260f, 0.964286f, 0.964311f, 0.964336f, 0.964362f,
- 0.964387f, 0.964413f, 0.964438f, 0.964463f, 0.964489f, 0.964514f, 0.964539f, 0.964565f,
- 0.964590f, 0.964615f, 0.964640f, 0.964666f, 0.964691f, 0.964716f, 0.964741f, 0.964767f,
- 0.964792f, 0.964817f, 0.964842f, 0.964867f, 0.964893f, 0.964918f, 0.964943f, 0.964968f,
- 0.964993f, 0.965018f, 0.965044f, 0.965069f, 0.965094f, 0.965119f, 0.965144f, 0.965169f,
- 0.965194f, 0.965219f, 0.965244f, 0.965269f, 0.965294f, 0.965319f, 0.965344f, 0.965369f,
- 0.965394f, 0.965419f, 0.965444f, 0.965469f, 0.965494f, 0.965519f, 0.965544f, 0.965569f,
- 0.965594f, 0.965619f, 0.965644f, 0.965669f, 0.965694f, 0.965719f, 0.965744f, 0.965769f,
- 0.965793f, 0.965818f, 0.965843f, 0.965868f, 0.965893f, 0.965918f, 0.965942f, 0.965967f,
- 0.965992f, 0.966017f, 0.966042f, 0.966066f, 0.966091f, 0.966116f, 0.966141f, 0.966165f,
- 0.966190f, 0.966215f, 0.966239f, 0.966264f, 0.966289f, 0.966313f, 0.966338f, 0.966363f,
- 0.966387f, 0.966412f, 0.966437f, 0.966461f, 0.966486f, 0.966511f, 0.966535f, 0.966560f,
- 0.966584f, 0.966609f, 0.966633f, 0.966658f, 0.966683f, 0.966707f, 0.966732f, 0.966756f,
- 0.966781f, 0.966805f, 0.966830f, 0.966854f, 0.966879f, 0.966903f, 0.966928f, 0.966952f,
- 0.966976f, 0.967001f, 0.967025f, 0.967050f, 0.967074f, 0.967099f, 0.967123f, 0.967147f,
- 0.967172f, 0.967196f, 0.967220f, 0.967245f, 0.967269f, 0.967293f, 0.967318f, 0.967342f,
- 0.967366f, 0.967391f, 0.967415f, 0.967439f, 0.967463f, 0.967488f, 0.967512f, 0.967536f,
- 0.967560f, 0.967585f, 0.967609f, 0.967633f, 0.967657f, 0.967681f, 0.967706f, 0.967730f,
- 0.967754f, 0.967778f, 0.967802f, 0.967826f, 0.967850f, 0.967874f, 0.967899f, 0.967923f,
- 0.967947f, 0.967971f, 0.967995f, 0.968019f, 0.968043f, 0.968067f, 0.968091f, 0.968115f,
- 0.968139f, 0.968163f, 0.968187f, 0.968211f, 0.968235f, 0.968259f, 0.968283f, 0.968307f,
- 0.968331f, 0.968355f, 0.968379f, 0.968403f, 0.968427f, 0.968450f, 0.968474f, 0.968498f,
- 0.968522f, 0.968546f, 0.968570f, 0.968594f, 0.968617f, 0.968641f, 0.968665f, 0.968689f,
- 0.968713f, 0.968737f, 0.968760f, 0.968784f, 0.968808f, 0.968832f, 0.968855f, 0.968879f,
- 0.968903f, 0.968927f, 0.968950f, 0.968974f, 0.968998f, 0.969021f, 0.969045f, 0.969069f,
- 0.969092f, 0.969116f, 0.969140f, 0.969163f, 0.969187f, 0.969210f, 0.969234f, 0.969258f,
- 0.969281f, 0.969305f, 0.969328f, 0.969352f, 0.969375f, 0.969399f, 0.969423f, 0.969446f,
- 0.969470f, 0.969493f, 0.969517f, 0.969540f, 0.969564f, 0.969587f, 0.969611f, 0.969634f,
- 0.969657f, 0.969681f, 0.969704f, 0.969728f, 0.969751f, 0.969774f, 0.969798f, 0.969821f,
- 0.969845f, 0.969868f, 0.969891f, 0.969915f, 0.969938f, 0.969961f, 0.969985f, 0.970008f,
- 0.970031f, 0.970055f, 0.970078f, 0.970101f, 0.970124f, 0.970148f, 0.970171f, 0.970194f,
- 0.970217f, 0.970241f, 0.970264f, 0.970287f, 0.970310f, 0.970333f, 0.970357f, 0.970380f,
- 0.970403f, 0.970426f, 0.970449f, 0.970472f, 0.970495f, 0.970518f, 0.970542f, 0.970565f,
- 0.970588f, 0.970611f, 0.970634f, 0.970657f, 0.970680f, 0.970703f, 0.970726f, 0.970749f,
- 0.970772f, 0.970795f, 0.970818f, 0.970841f, 0.970864f, 0.970887f, 0.970910f, 0.970933f,
- 0.970956f, 0.970979f, 0.971002f, 0.971025f, 0.971048f, 0.971071f, 0.971093f, 0.971116f,
- 0.971139f, 0.971162f, 0.971185f, 0.971208f, 0.971231f, 0.971253f, 0.971276f, 0.971299f,
- 0.971322f, 0.971345f, 0.971367f, 0.971390f, 0.971413f, 0.971436f, 0.971458f, 0.971481f,
- 0.971504f, 0.971527f, 0.971549f, 0.971572f, 0.971595f, 0.971617f, 0.971640f, 0.971663f,
- 0.971685f, 0.971708f, 0.971731f, 0.971753f, 0.971776f, 0.971799f, 0.971821f, 0.971844f,
- 0.971866f, 0.971889f, 0.971911f, 0.971934f, 0.971957f, 0.971979f, 0.972002f, 0.972024f,
- 0.972047f, 0.972069f, 0.972092f, 0.972114f, 0.972137f, 0.972159f, 0.972182f, 0.972204f,
- 0.972227f, 0.972249f, 0.972271f, 0.972294f, 0.972316f, 0.972339f, 0.972361f, 0.972383f,
- 0.972406f, 0.972428f, 0.972450f, 0.972473f, 0.972495f, 0.972517f, 0.972540f, 0.972562f,
- 0.972584f, 0.972607f, 0.972629f, 0.972651f, 0.972673f, 0.972696f, 0.972718f, 0.972740f,
- 0.972762f, 0.972785f, 0.972807f, 0.972829f, 0.972851f, 0.972873f, 0.972896f, 0.972918f,
- 0.972940f, 0.972962f, 0.972984f, 0.973006f, 0.973028f, 0.973051f, 0.973073f, 0.973095f,
- 0.973117f, 0.973139f, 0.973161f, 0.973183f, 0.973205f, 0.973227f, 0.973249f, 0.973271f,
- 0.973293f, 0.973315f, 0.973337f, 0.973359f, 0.973381f, 0.973403f, 0.973425f, 0.973447f,
- 0.973469f, 0.973491f, 0.973513f, 0.973535f, 0.973557f, 0.973579f, 0.973601f, 0.973622f,
- 0.973644f, 0.973666f, 0.973688f, 0.973710f, 0.973732f, 0.973753f, 0.973775f, 0.973797f,
- 0.973819f, 0.973841f, 0.973862f, 0.973884f, 0.973906f, 0.973928f, 0.973949f, 0.973971f,
- 0.973993f, 0.974015f, 0.974036f, 0.974058f, 0.974080f, 0.974101f, 0.974123f, 0.974145f,
- 0.974166f, 0.974188f, 0.974210f, 0.974231f, 0.974253f, 0.974275f, 0.974296f, 0.974318f,
- 0.974339f, 0.974361f, 0.974383f, 0.974404f, 0.974426f, 0.974447f, 0.974469f, 0.974490f,
- 0.974512f, 0.974533f, 0.974555f, 0.974576f, 0.974598f, 0.974619f, 0.974641f, 0.974662f,
- 0.974684f, 0.974705f, 0.974726f, 0.974748f, 0.974769f, 0.974791f, 0.974812f, 0.974833f,
- 0.974855f, 0.974876f, 0.974897f, 0.974919f, 0.974940f, 0.974961f, 0.974983f, 0.975004f,
- 0.975025f, 0.975047f, 0.975068f, 0.975089f, 0.975110f, 0.975132f, 0.975153f, 0.975174f,
- 0.975195f, 0.975217f, 0.975238f, 0.975259f, 0.975280f, 0.975301f, 0.975323f, 0.975344f,
- 0.975365f, 0.975386f, 0.975407f, 0.975428f, 0.975449f, 0.975471f, 0.975492f, 0.975513f,
- 0.975534f, 0.975555f, 0.975576f, 0.975597f, 0.975618f, 0.975639f, 0.975660f, 0.975681f,
- 0.975702f, 0.975723f, 0.975744f, 0.975765f, 0.975786f, 0.975807f, 0.975828f, 0.975849f,
- 0.975870f, 0.975891f, 0.975912f, 0.975933f, 0.975954f, 0.975974f, 0.975995f, 0.976016f,
- 0.976037f, 0.976058f, 0.976079f, 0.976100f, 0.976120f, 0.976141f, 0.976162f, 0.976183f,
- 0.976204f, 0.976224f, 0.976245f, 0.976266f, 0.976287f, 0.976308f, 0.976328f, 0.976349f,
- 0.976370f, 0.976390f, 0.976411f, 0.976432f, 0.976453f, 0.976473f, 0.976494f, 0.976515f,
- 0.976535f, 0.976556f, 0.976576f, 0.976597f, 0.976618f, 0.976638f, 0.976659f, 0.976680f,
- 0.976700f, 0.976721f, 0.976741f, 0.976762f, 0.976782f, 0.976803f, 0.976823f, 0.976844f,
- 0.976864f, 0.976885f, 0.976905f, 0.976926f, 0.976946f, 0.976967f, 0.976987f, 0.977008f,
- 0.977028f, 0.977049f, 0.977069f, 0.977089f, 0.977110f, 0.977130f, 0.977151f, 0.977171f,
- 0.977191f, 0.977212f, 0.977232f, 0.977252f, 0.977273f, 0.977293f, 0.977313f, 0.977334f,
- 0.977354f, 0.977374f, 0.977394f, 0.977415f, 0.977435f, 0.977455f, 0.977475f, 0.977496f,
- 0.977516f, 0.977536f, 0.977556f, 0.977577f, 0.977597f, 0.977617f, 0.977637f, 0.977657f,
- 0.977677f, 0.977697f, 0.977718f, 0.977738f, 0.977758f, 0.977778f, 0.977798f, 0.977818f,
- 0.977838f, 0.977858f, 0.977878f, 0.977898f, 0.977918f, 0.977938f, 0.977959f, 0.977979f,
- 0.977998f, 0.978019f, 0.978038f, 0.978058f, 0.978078f, 0.978098f, 0.978118f, 0.978138f,
- 0.978158f, 0.978178f, 0.978198f, 0.978218f, 0.978238f, 0.978258f, 0.978278f, 0.978298f,
- 0.978317f, 0.978337f, 0.978357f, 0.978377f, 0.978397f, 0.978417f, 0.978436f, 0.978456f,
- 0.978476f, 0.978496f, 0.978516f, 0.978535f, 0.978555f, 0.978575f, 0.978594f, 0.978614f,
- 0.978634f, 0.978654f, 0.978673f, 0.978693f, 0.978713f, 0.978732f, 0.978752f, 0.978772f,
- 0.978791f, 0.978811f, 0.978831f, 0.978850f, 0.978870f, 0.978889f, 0.978909f, 0.978929f,
- 0.978948f, 0.978968f, 0.978987f, 0.979007f, 0.979026f, 0.979046f, 0.979065f, 0.979085f,
- 0.979104f, 0.979124f, 0.979143f, 0.979163f, 0.979182f, 0.979202f, 0.979221f, 0.979241f,
- 0.979260f, 0.979280f, 0.979299f, 0.979318f, 0.979338f, 0.979357f, 0.979376f, 0.979396f,
- 0.979415f, 0.979435f, 0.979454f, 0.979473f, 0.979493f, 0.979512f, 0.979531f, 0.979550f,
- 0.979570f, 0.979589f, 0.979608f, 0.979628f, 0.979647f, 0.979666f, 0.979685f, 0.979704f,
- 0.979724f, 0.979743f, 0.979762f, 0.979781f, 0.979800f, 0.979820f, 0.979839f, 0.979858f,
- 0.979877f, 0.979896f, 0.979915f, 0.979934f, 0.979954f, 0.979973f, 0.979992f, 0.980011f,
- 0.980030f, 0.980049f, 0.980068f, 0.980087f, 0.980106f, 0.980125f, 0.980144f, 0.980163f,
- 0.980182f, 0.980201f, 0.980220f, 0.980239f, 0.980258f, 0.980277f, 0.980296f, 0.980315f,
- 0.980334f, 0.980353f, 0.980372f, 0.980390f, 0.980409f, 0.980428f, 0.980447f, 0.980466f,
- 0.980485f, 0.980504f, 0.980523f, 0.980541f, 0.980560f, 0.980579f, 0.980598f, 0.980617f,
- 0.980635f, 0.980654f, 0.980673f, 0.980692f, 0.980710f, 0.980729f, 0.980748f, 0.980767f,
- 0.980785f, 0.980804f, 0.980823f, 0.980841f, 0.980860f, 0.980879f, 0.980897f, 0.980916f,
- 0.980935f, 0.980953f, 0.980972f, 0.980990f, 0.981009f, 0.981028f, 0.981046f, 0.981065f,
- 0.981083f, 0.981102f, 0.981120f, 0.981139f, 0.981158f, 0.981176f, 0.981195f, 0.981213f,
- 0.981232f, 0.981250f, 0.981269f, 0.981287f, 0.981305f, 0.981324f, 0.981342f, 0.981361f,
- 0.981379f, 0.981398f, 0.981416f, 0.981434f, 0.981453f, 0.981471f, 0.981490f, 0.981508f,
- 0.981526f, 0.981545f, 0.981563f, 0.981581f, 0.981600f, 0.981618f, 0.981636f, 0.981654f,
- 0.981673f, 0.981691f, 0.981709f, 0.981727f, 0.981746f, 0.981764f, 0.981782f, 0.981800f,
- 0.981819f, 0.981837f, 0.981855f, 0.981873f, 0.981891f, 0.981909f, 0.981928f, 0.981946f,
- 0.981964f, 0.981982f, 0.982000f, 0.982018f, 0.982036f, 0.982054f, 0.982072f, 0.982091f,
- 0.982109f, 0.982127f, 0.982145f, 0.982163f, 0.982181f, 0.982199f, 0.982217f, 0.982235f,
- 0.982253f, 0.982271f, 0.982289f, 0.982307f, 0.982325f, 0.982343f, 0.982360f, 0.982378f,
- 0.982396f, 0.982414f, 0.982432f, 0.982450f, 0.982468f, 0.982486f, 0.982504f, 0.982521f,
- 0.982539f, 0.982557f, 0.982575f, 0.982593f, 0.982611f, 0.982628f, 0.982646f, 0.982664f,
- 0.982682f, 0.982699f, 0.982717f, 0.982735f, 0.982753f, 0.982770f, 0.982788f, 0.982806f,
- 0.982824f, 0.982841f, 0.982859f, 0.982877f, 0.982894f, 0.982912f, 0.982930f, 0.982947f,
- 0.982965f, 0.982982f, 0.983000f, 0.983018f, 0.983035f, 0.983053f, 0.983070f, 0.983088f,
- 0.983105f, 0.983123f, 0.983141f, 0.983158f, 0.983176f, 0.983193f, 0.983211f, 0.983228f,
- 0.983246f, 0.983263f, 0.983281f, 0.983298f, 0.983315f, 0.983333f, 0.983350f, 0.983368f,
- 0.983385f, 0.983402f, 0.983420f, 0.983437f, 0.983455f, 0.983472f, 0.983489f, 0.983507f,
- 0.983524f, 0.983541f, 0.983559f, 0.983576f, 0.983593f, 0.983611f, 0.983628f, 0.983645f,
- 0.983662f, 0.983680f, 0.983697f, 0.983714f, 0.983731f, 0.983749f, 0.983766f, 0.983783f,
- 0.983800f, 0.983817f, 0.983835f, 0.983852f, 0.983869f, 0.983886f, 0.983903f, 0.983920f,
- 0.983937f, 0.983955f, 0.983972f, 0.983989f, 0.984006f, 0.984023f, 0.984040f, 0.984057f,
- 0.984074f, 0.984091f, 0.984108f, 0.984125f, 0.984142f, 0.984159f, 0.984176f, 0.984193f,
- 0.984210f, 0.984227f, 0.984244f, 0.984261f, 0.984278f, 0.984295f, 0.984312f, 0.984329f,
- 0.984346f, 0.984362f, 0.984379f, 0.984396f, 0.984413f, 0.984430f, 0.984447f, 0.984464f,
- 0.984480f, 0.984497f, 0.984514f, 0.984531f, 0.984548f, 0.984564f, 0.984581f, 0.984598f,
- 0.984615f, 0.984632f, 0.984648f, 0.984665f, 0.984682f, 0.984698f, 0.984715f, 0.984732f,
- 0.984748f, 0.984765f, 0.984782f, 0.984798f, 0.984815f, 0.984832f, 0.984848f, 0.984865f,
- 0.984882f, 0.984898f, 0.984915f, 0.984931f, 0.984948f, 0.984965f, 0.984981f, 0.984998f,
- 0.985014f, 0.985031f, 0.985047f, 0.985064f, 0.985080f, 0.985097f, 0.985113f, 0.985130f,
- 0.985146f, 0.985163f, 0.985179f, 0.985196f, 0.985212f, 0.985228f, 0.985245f, 0.985261f,
- 0.985278f, 0.985294f, 0.985310f, 0.985327f, 0.985343f, 0.985359f, 0.985376f, 0.985392f,
- 0.985408f, 0.985425f, 0.985441f, 0.985457f, 0.985474f, 0.985490f, 0.985506f, 0.985523f,
- 0.985539f, 0.985555f, 0.985571f, 0.985587f, 0.985604f, 0.985620f, 0.985636f, 0.985652f,
- 0.985668f, 0.985685f, 0.985701f, 0.985717f, 0.985733f, 0.985749f, 0.985765f, 0.985781f,
- 0.985798f, 0.985814f, 0.985830f, 0.985846f, 0.985862f, 0.985878f, 0.985894f, 0.985910f,
- 0.985926f, 0.985942f, 0.985958f, 0.985974f, 0.985990f, 0.986006f, 0.986022f, 0.986038f,
- 0.986054f, 0.986070f, 0.986086f, 0.986102f, 0.986118f, 0.986134f, 0.986150f, 0.986165f,
- 0.986181f, 0.986197f, 0.986213f, 0.986229f, 0.986245f, 0.986261f, 0.986276f, 0.986292f,
- 0.986308f, 0.986324f, 0.986340f, 0.986355f, 0.986371f, 0.986387f, 0.986403f, 0.986419f,
- 0.986434f, 0.986450f, 0.986466f, 0.986481f, 0.986497f, 0.986513f, 0.986529f, 0.986544f,
- 0.986560f, 0.986576f, 0.986591f, 0.986607f, 0.986623f, 0.986638f, 0.986654f, 0.986669f,
- 0.986685f, 0.986701f, 0.986716f, 0.986732f, 0.986747f, 0.986763f, 0.986778f, 0.986794f,
- 0.986809f, 0.986825f, 0.986840f, 0.986856f, 0.986871f, 0.986887f, 0.986902f, 0.986918f,
- 0.986933f, 0.986949f, 0.986964f, 0.986980f, 0.986995f, 0.987010f, 0.987026f, 0.987041f,
- 0.987057f, 0.987072f, 0.987087f, 0.987103f, 0.987118f, 0.987133f, 0.987149f, 0.987164f,
- 0.987179f, 0.987195f, 0.987210f, 0.987225f, 0.987240f, 0.987256f, 0.987271f, 0.987286f,
- 0.987301f, 0.987317f, 0.987332f, 0.987347f, 0.987362f, 0.987377f, 0.987393f, 0.987408f,
- 0.987423f, 0.987438f, 0.987453f, 0.987468f, 0.987484f, 0.987499f, 0.987514f, 0.987529f,
- 0.987544f, 0.987559f, 0.987574f, 0.987589f, 0.987604f, 0.987619f, 0.987634f, 0.987649f,
- 0.987664f, 0.987679f, 0.987694f, 0.987709f, 0.987724f, 0.987739f, 0.987754f, 0.987769f,
- 0.987784f, 0.987799f, 0.987814f, 0.987829f, 0.987844f, 0.987859f, 0.987874f, 0.987889f,
- 0.987903f, 0.987918f, 0.987933f, 0.987948f, 0.987963f, 0.987978f, 0.987992f, 0.988007f,
- 0.988022f, 0.988037f, 0.988052f, 0.988066f, 0.988081f, 0.988096f, 0.988111f, 0.988125f,
- 0.988140f, 0.988155f, 0.988169f, 0.988184f, 0.988199f, 0.988214f, 0.988228f, 0.988243f,
- 0.988258f, 0.988272f, 0.988287f, 0.988301f, 0.988316f, 0.988331f, 0.988345f, 0.988360f,
- 0.988374f, 0.988389f, 0.988404f, 0.988418f, 0.988433f, 0.988447f, 0.988462f, 0.988476f,
- 0.988491f, 0.988505f, 0.988520f, 0.988534f, 0.988549f, 0.988563f, 0.988578f, 0.988592f,
- 0.988607f, 0.988621f, 0.988635f, 0.988650f, 0.988664f, 0.988679f, 0.988693f, 0.988707f,
- 0.988722f, 0.988736f, 0.988750f, 0.988765f, 0.988779f, 0.988793f, 0.988808f, 0.988822f,
- 0.988836f, 0.988851f, 0.988865f, 0.988879f, 0.988893f, 0.988908f, 0.988922f, 0.988936f,
- 0.988950f, 0.988964f, 0.988979f, 0.988993f, 0.989007f, 0.989021f, 0.989035f, 0.989050f,
- 0.989064f, 0.989078f, 0.989092f, 0.989106f, 0.989120f, 0.989134f, 0.989148f, 0.989162f,
- 0.989177f, 0.989191f, 0.989205f, 0.989219f, 0.989233f, 0.989247f, 0.989261f, 0.989275f,
- 0.989289f, 0.989303f, 0.989317f, 0.989331f, 0.989345f, 0.989359f, 0.989373f, 0.989386f,
- 0.989400f, 0.989414f, 0.989428f, 0.989442f, 0.989456f, 0.989470f, 0.989484f, 0.989498f,
- 0.989511f, 0.989525f, 0.989539f, 0.989553f, 0.989567f, 0.989581f, 0.989594f, 0.989608f,
- 0.989622f, 0.989636f, 0.989650f, 0.989663f, 0.989677f, 0.989691f, 0.989704f, 0.989718f,
- 0.989732f, 0.989746f, 0.989759f, 0.989773f, 0.989787f, 0.989800f, 0.989814f, 0.989828f,
- 0.989841f, 0.989855f, 0.989869f, 0.989882f, 0.989896f, 0.989909f, 0.989923f, 0.989936f,
- 0.989950f, 0.989964f, 0.989977f, 0.989991f, 0.990004f, 0.990018f, 0.990031f, 0.990045f,
- 0.990058f, 0.990072f, 0.990085f, 0.990099f, 0.990112f, 0.990126f, 0.990139f, 0.990152f,
- 0.990166f, 0.990179f, 0.990193f, 0.990206f, 0.990219f, 0.990233f, 0.990246f, 0.990259f,
- 0.990273f, 0.990286f, 0.990299f, 0.990313f, 0.990326f, 0.990339f, 0.990353f, 0.990366f,
- 0.990379f, 0.990393f, 0.990406f, 0.990419f, 0.990432f, 0.990445f, 0.990459f, 0.990472f,
- 0.990485f, 0.990498f, 0.990511f, 0.990525f, 0.990538f, 0.990551f, 0.990564f, 0.990577f,
- 0.990590f, 0.990603f, 0.990617f, 0.990630f, 0.990643f, 0.990656f, 0.990669f, 0.990682f,
- 0.990695f, 0.990708f, 0.990721f, 0.990734f, 0.990747f, 0.990760f, 0.990773f, 0.990786f,
- 0.990799f, 0.990812f, 0.990825f, 0.990838f, 0.990851f, 0.990864f, 0.990877f, 0.990890f,
- 0.990903f, 0.990916f, 0.990928f, 0.990941f, 0.990954f, 0.990967f, 0.990980f, 0.990993f,
- 0.991006f, 0.991018f, 0.991031f, 0.991044f, 0.991057f, 0.991070f, 0.991082f, 0.991095f,
- 0.991108f, 0.991121f, 0.991133f, 0.991146f, 0.991159f, 0.991172f, 0.991184f, 0.991197f,
- 0.991210f, 0.991222f, 0.991235f, 0.991248f, 0.991260f, 0.991273f, 0.991286f, 0.991298f,
- 0.991311f, 0.991323f, 0.991336f, 0.991349f, 0.991361f, 0.991374f, 0.991386f, 0.991399f,
- 0.991411f, 0.991424f, 0.991437f, 0.991449f, 0.991462f, 0.991474f, 0.991487f, 0.991499f,
- 0.991511f, 0.991524f, 0.991536f, 0.991549f, 0.991561f, 0.991574f, 0.991586f, 0.991598f,
- 0.991611f, 0.991623f, 0.991636f, 0.991648f, 0.991660f, 0.991673f, 0.991685f, 0.991697f,
- 0.991710f, 0.991722f, 0.991734f, 0.991747f, 0.991759f, 0.991771f, 0.991783f, 0.991796f,
- 0.991808f, 0.991820f, 0.991832f, 0.991845f, 0.991857f, 0.991869f, 0.991881f, 0.991894f,
- 0.991906f, 0.991918f, 0.991930f, 0.991942f, 0.991954f, 0.991966f, 0.991979f, 0.991991f,
- 0.992003f, 0.992015f, 0.992027f, 0.992039f, 0.992051f, 0.992063f, 0.992075f, 0.992087f,
- 0.992099f, 0.992111f, 0.992123f, 0.992135f, 0.992147f, 0.992159f, 0.992171f, 0.992183f,
- 0.992195f, 0.992207f, 0.992219f, 0.992231f, 0.992243f, 0.992255f, 0.992267f, 0.992279f,
- 0.992291f, 0.992302f, 0.992314f, 0.992326f, 0.992338f, 0.992350f, 0.992362f, 0.992374f,
- 0.992385f, 0.992397f, 0.992409f, 0.992421f, 0.992433f, 0.992444f, 0.992456f, 0.992468f,
- 0.992480f, 0.992491f, 0.992503f, 0.992515f, 0.992526f, 0.992538f, 0.992550f, 0.992561f,
- 0.992573f, 0.992585f, 0.992596f, 0.992608f, 0.992620f, 0.992631f, 0.992643f, 0.992655f,
- 0.992666f, 0.992678f, 0.992689f, 0.992701f, 0.992712f, 0.992724f, 0.992736f, 0.992747f,
- 0.992759f, 0.992770f, 0.992782f, 0.992793f, 0.992805f, 0.992816f, 0.992828f, 0.992839f,
- 0.992850f, 0.992862f, 0.992873f, 0.992885f, 0.992896f, 0.992908f, 0.992919f, 0.992930f,
- 0.992942f, 0.992953f, 0.992964f, 0.992976f, 0.992987f, 0.992998f, 0.993010f, 0.993021f,
- 0.993032f, 0.993044f, 0.993055f, 0.993066f, 0.993077f, 0.993089f, 0.993100f, 0.993111f,
- 0.993122f, 0.993134f, 0.993145f, 0.993156f, 0.993167f, 0.993178f, 0.993190f, 0.993201f,
- 0.993212f, 0.993223f, 0.993234f, 0.993245f, 0.993257f, 0.993268f, 0.993279f, 0.993290f,
- 0.993301f, 0.993312f, 0.993323f, 0.993334f, 0.993345f, 0.993356f, 0.993367f, 0.993378f,
- 0.993389f, 0.993400f, 0.993411f, 0.993422f, 0.993433f, 0.993444f, 0.993455f, 0.993466f,
- 0.993477f, 0.993488f, 0.993499f, 0.993510f, 0.993521f, 0.993532f, 0.993542f, 0.993553f,
- 0.993564f, 0.993575f, 0.993586f, 0.993597f, 0.993608f, 0.993618f, 0.993629f, 0.993640f,
- 0.993651f, 0.993662f, 0.993672f, 0.993683f, 0.993694f, 0.993705f, 0.993715f, 0.993726f,
- 0.993737f, 0.993747f, 0.993758f, 0.993769f, 0.993779f, 0.993790f, 0.993801f, 0.993811f,
- 0.993822f, 0.993833f, 0.993843f, 0.993854f, 0.993865f, 0.993875f, 0.993886f, 0.993896f,
- 0.993907f, 0.993918f, 0.993928f, 0.993939f, 0.993949f, 0.993960f, 0.993970f, 0.993981f,
- 0.993991f, 0.994002f, 0.994012f, 0.994023f, 0.994033f, 0.994044f, 0.994054f, 0.994064f,
- 0.994075f, 0.994085f, 0.994096f, 0.994106f, 0.994116f, 0.994127f, 0.994137f, 0.994148f,
- 0.994158f, 0.994168f, 0.994179f, 0.994189f, 0.994199f, 0.994210f, 0.994220f, 0.994230f,
- 0.994240f, 0.994251f, 0.994261f, 0.994271f, 0.994281f, 0.994292f, 0.994302f, 0.994312f,
- 0.994322f, 0.994333f, 0.994343f, 0.994353f, 0.994363f, 0.994373f, 0.994383f, 0.994394f,
- 0.994404f, 0.994414f, 0.994424f, 0.994434f, 0.994444f, 0.994454f, 0.994464f, 0.994474f,
- 0.994484f, 0.994494f, 0.994505f, 0.994515f, 0.994525f, 0.994535f, 0.994545f, 0.994555f,
- 0.994565f, 0.994575f, 0.994585f, 0.994594f, 0.994604f, 0.994614f, 0.994624f, 0.994634f,
- 0.994644f, 0.994654f, 0.994664f, 0.994674f, 0.994684f, 0.994694f, 0.994703f, 0.994713f,
- 0.994723f, 0.994733f, 0.994743f, 0.994753f, 0.994762f, 0.994772f, 0.994782f, 0.994792f,
- 0.994802f, 0.994811f, 0.994821f, 0.994831f, 0.994841f, 0.994850f, 0.994860f, 0.994870f,
- 0.994879f, 0.994889f, 0.994899f, 0.994908f, 0.994918f, 0.994928f, 0.994937f, 0.994947f,
- 0.994957f, 0.994966f, 0.994976f, 0.994985f, 0.994995f, 0.995005f, 0.995014f, 0.995024f,
- 0.995033f, 0.995043f, 0.995052f, 0.995062f, 0.995071f, 0.995081f, 0.995090f, 0.995100f,
- 0.995109f, 0.995119f, 0.995128f, 0.995138f, 0.995147f, 0.995156f, 0.995166f, 0.995175f,
- 0.995185f, 0.995194f, 0.995203f, 0.995213f, 0.995222f, 0.995232f, 0.995241f, 0.995250f,
- 0.995260f, 0.995269f, 0.995278f, 0.995288f, 0.995297f, 0.995306f, 0.995315f, 0.995325f,
- 0.995334f, 0.995343f, 0.995352f, 0.995362f, 0.995371f, 0.995380f, 0.995389f, 0.995398f,
- 0.995408f, 0.995417f, 0.995426f, 0.995435f, 0.995444f, 0.995453f, 0.995463f, 0.995472f,
- 0.995481f, 0.995490f, 0.995499f, 0.995508f, 0.995517f, 0.995526f, 0.995535f, 0.995544f,
- 0.995553f, 0.995562f, 0.995571f, 0.995580f, 0.995589f, 0.995598f, 0.995607f, 0.995616f,
- 0.995625f, 0.995634f, 0.995643f, 0.995652f, 0.995661f, 0.995670f, 0.995679f, 0.995688f,
- 0.995697f, 0.995705f, 0.995714f, 0.995723f, 0.995732f, 0.995741f, 0.995750f, 0.995759f,
- 0.995767f, 0.995776f, 0.995785f, 0.995794f, 0.995803f, 0.995811f, 0.995820f, 0.995829f,
- 0.995838f, 0.995846f, 0.995855f, 0.995864f, 0.995872f, 0.995881f, 0.995890f, 0.995899f,
- 0.995907f, 0.995916f, 0.995925f, 0.995933f, 0.995942f, 0.995950f, 0.995959f, 0.995968f,
- 0.995976f, 0.995985f, 0.995993f, 0.996002f, 0.996011f, 0.996019f, 0.996028f, 0.996036f,
- 0.996045f, 0.996053f, 0.996062f, 0.996070f, 0.996079f, 0.996087f, 0.996096f, 0.996104f,
- 0.996113f, 0.996121f, 0.996129f, 0.996138f, 0.996146f, 0.996155f, 0.996163f, 0.996171f,
- 0.996180f, 0.996188f, 0.996197f, 0.996205f, 0.996213f, 0.996222f, 0.996230f, 0.996238f,
- 0.996247f, 0.996255f, 0.996263f, 0.996271f, 0.996280f, 0.996288f, 0.996296f, 0.996304f,
- 0.996313f, 0.996321f, 0.996329f, 0.996337f, 0.996345f, 0.996354f, 0.996362f, 0.996370f,
- 0.996378f, 0.996386f, 0.996394f, 0.996403f, 0.996411f, 0.996419f, 0.996427f, 0.996435f,
- 0.996443f, 0.996451f, 0.996459f, 0.996467f, 0.996475f, 0.996483f, 0.996491f, 0.996499f,
- 0.996507f, 0.996515f, 0.996523f, 0.996531f, 0.996539f, 0.996547f, 0.996555f, 0.996563f,
- 0.996571f, 0.996579f, 0.996587f, 0.996595f, 0.996603f, 0.996611f, 0.996619f, 0.996626f,
- 0.996634f, 0.996642f, 0.996650f, 0.996658f, 0.996666f, 0.996674f, 0.996681f, 0.996689f,
- 0.996697f, 0.996705f, 0.996712f, 0.996720f, 0.996728f, 0.996736f, 0.996743f, 0.996751f,
- 0.996759f, 0.996767f, 0.996774f, 0.996782f, 0.996790f, 0.996797f, 0.996805f, 0.996813f,
- 0.996820f, 0.996828f, 0.996836f, 0.996843f, 0.996851f, 0.996858f, 0.996866f, 0.996874f,
- 0.996881f, 0.996889f, 0.996896f, 0.996904f, 0.996911f, 0.996919f, 0.996926f, 0.996934f,
- 0.996941f, 0.996949f, 0.996956f, 0.996964f, 0.996971f, 0.996979f, 0.996986f, 0.996994f,
- 0.997001f, 0.997008f, 0.997016f, 0.997023f, 0.997031f, 0.997038f, 0.997045f, 0.997053f,
- 0.997060f, 0.997067f, 0.997075f, 0.997082f, 0.997089f, 0.997097f, 0.997104f, 0.997111f,
- 0.997119f, 0.997126f, 0.997133f, 0.997140f, 0.997148f, 0.997155f, 0.997162f, 0.997169f,
- 0.997176f, 0.997184f, 0.997191f, 0.997198f, 0.997205f, 0.997212f, 0.997219f, 0.997227f,
- 0.997234f, 0.997241f, 0.997248f, 0.997255f, 0.997262f, 0.997269f, 0.997276f, 0.997283f,
- 0.997290f, 0.997298f, 0.997305f, 0.997312f, 0.997319f, 0.997326f, 0.997333f, 0.997340f,
- 0.997347f, 0.997354f, 0.997361f, 0.997368f, 0.997374f, 0.997381f, 0.997388f, 0.997395f,
- 0.997402f, 0.997409f, 0.997416f, 0.997423f, 0.997430f, 0.997437f, 0.997443f, 0.997450f,
- 0.997457f, 0.997464f, 0.997471f, 0.997478f, 0.997484f, 0.997491f, 0.997498f, 0.997505f,
- 0.997511f, 0.997518f, 0.997525f, 0.997532f, 0.997538f, 0.997545f, 0.997552f, 0.997559f,
- 0.997565f, 0.997572f, 0.997579f, 0.997585f, 0.997592f, 0.997599f, 0.997605f, 0.997612f,
- 0.997618f, 0.997625f, 0.997632f, 0.997638f, 0.997645f, 0.997651f, 0.997658f, 0.997665f,
- 0.997671f, 0.997678f, 0.997684f, 0.997691f, 0.997697f, 0.997704f, 0.997710f, 0.997717f,
- 0.997723f, 0.997730f, 0.997736f, 0.997742f, 0.997749f, 0.997755f, 0.997762f, 0.997768f,
- 0.997774f, 0.997781f, 0.997787f, 0.997794f, 0.997800f, 0.997806f, 0.997813f, 0.997819f,
- 0.997825f, 0.997832f, 0.997838f, 0.997844f, 0.997851f, 0.997857f, 0.997863f, 0.997869f,
- 0.997876f, 0.997882f, 0.997888f, 0.997894f, 0.997901f, 0.997907f, 0.997913f, 0.997919f,
- 0.997925f, 0.997931f, 0.997938f, 0.997944f, 0.997950f, 0.997956f, 0.997962f, 0.997968f,
- 0.997974f, 0.997980f, 0.997987f, 0.997993f, 0.997999f, 0.998005f, 0.998011f, 0.998017f,
- 0.998023f, 0.998029f, 0.998035f, 0.998041f, 0.998047f, 0.998053f, 0.998059f, 0.998065f,
- 0.998071f, 0.998077f, 0.998083f, 0.998089f, 0.998094f, 0.998100f, 0.998106f, 0.998112f,
- 0.998118f, 0.998124f, 0.998130f, 0.998136f, 0.998142f, 0.998147f, 0.998153f, 0.998159f,
- 0.998165f, 0.998171f, 0.998176f, 0.998182f, 0.998188f, 0.998194f, 0.998200f, 0.998205f,
- 0.998211f, 0.998217f, 0.998222f, 0.998228f, 0.998234f, 0.998240f, 0.998245f, 0.998251f,
- 0.998257f, 0.998262f, 0.998268f, 0.998273f, 0.998279f, 0.998285f, 0.998290f, 0.998296f,
- 0.998302f, 0.998307f, 0.998313f, 0.998318f, 0.998324f, 0.998329f, 0.998335f, 0.998340f,
- 0.998346f, 0.998351f, 0.998357f, 0.998362f, 0.998368f, 0.998373f, 0.998379f, 0.998384f,
- 0.998390f, 0.998395f, 0.998401f, 0.998406f, 0.998411f, 0.998417f, 0.998422f, 0.998428f,
- 0.998433f, 0.998438f, 0.998444f, 0.998449f, 0.998454f, 0.998460f, 0.998465f, 0.998470f,
- 0.998476f, 0.998481f, 0.998486f, 0.998491f, 0.998497f, 0.998502f, 0.998507f, 0.998512f,
- 0.998518f, 0.998523f, 0.998528f, 0.998533f, 0.998538f, 0.998544f, 0.998549f, 0.998554f,
- 0.998559f, 0.998564f, 0.998569f, 0.998574f, 0.998580f, 0.998585f, 0.998590f, 0.998595f,
- 0.998600f, 0.998605f, 0.998610f, 0.998615f, 0.998620f, 0.998625f, 0.998630f, 0.998635f,
- 0.998640f, 0.998645f, 0.998650f, 0.998655f, 0.998660f, 0.998665f, 0.998670f, 0.998675f,
- 0.998680f, 0.998685f, 0.998690f, 0.998695f, 0.998700f, 0.998704f, 0.998709f, 0.998714f,
- 0.998719f, 0.998724f, 0.998729f, 0.998734f, 0.998738f, 0.998743f, 0.998748f, 0.998753f,
- 0.998758f, 0.998762f, 0.998767f, 0.998772f, 0.998777f, 0.998781f, 0.998786f, 0.998791f,
- 0.998795f, 0.998800f, 0.998805f, 0.998810f, 0.998814f, 0.998819f, 0.998824f, 0.998828f,
- 0.998833f, 0.998837f, 0.998842f, 0.998847f, 0.998851f, 0.998856f, 0.998860f, 0.998865f,
- 0.998870f, 0.998874f, 0.998879f, 0.998883f, 0.998888f, 0.998892f, 0.998897f, 0.998901f,
- 0.998906f, 0.998910f, 0.998915f, 0.998919f, 0.998924f, 0.998928f, 0.998932f, 0.998937f,
- 0.998941f, 0.998946f, 0.998950f, 0.998954f, 0.998959f, 0.998963f, 0.998968f, 0.998972f,
- 0.998976f, 0.998981f, 0.998985f, 0.998989f, 0.998994f, 0.998998f, 0.999002f, 0.999006f,
- 0.999011f, 0.999015f, 0.999019f, 0.999023f, 0.999028f, 0.999032f, 0.999036f, 0.999040f,
- 0.999044f, 0.999049f, 0.999053f, 0.999057f, 0.999061f, 0.999065f, 0.999069f, 0.999074f,
- 0.999078f, 0.999082f, 0.999086f, 0.999090f, 0.999094f, 0.999098f, 0.999102f, 0.999106f,
- 0.999110f, 0.999114f, 0.999118f, 0.999122f, 0.999126f, 0.999130f, 0.999134f, 0.999138f,
- 0.999142f, 0.999146f, 0.999150f, 0.999154f, 0.999158f, 0.999162f, 0.999166f, 0.999170f,
- 0.999174f, 0.999178f, 0.999182f, 0.999186f, 0.999189f, 0.999193f, 0.999197f, 0.999201f,
- 0.999205f, 0.999209f, 0.999212f, 0.999216f, 0.999220f, 0.999224f, 0.999228f, 0.999231f,
- 0.999235f, 0.999239f, 0.999243f, 0.999246f, 0.999250f, 0.999254f, 0.999257f, 0.999261f,
- 0.999265f, 0.999268f, 0.999272f, 0.999276f, 0.999279f, 0.999283f, 0.999287f, 0.999290f,
- 0.999294f, 0.999297f, 0.999301f, 0.999305f, 0.999308f, 0.999312f, 0.999315f, 0.999319f,
- 0.999322f, 0.999326f, 0.999329f, 0.999333f, 0.999336f, 0.999340f, 0.999343f, 0.999347f,
- 0.999350f, 0.999354f, 0.999357f, 0.999361f, 0.999364f, 0.999367f, 0.999371f, 0.999374f,
- 0.999378f, 0.999381f, 0.999384f, 0.999388f, 0.999391f, 0.999394f, 0.999398f, 0.999401f,
- 0.999404f, 0.999408f, 0.999411f, 0.999414f, 0.999418f, 0.999421f, 0.999424f, 0.999427f,
- 0.999431f, 0.999434f, 0.999437f, 0.999440f, 0.999443f, 0.999447f, 0.999450f, 0.999453f,
- 0.999456f, 0.999459f, 0.999462f, 0.999466f, 0.999469f, 0.999472f, 0.999475f, 0.999478f,
- 0.999481f, 0.999484f, 0.999487f, 0.999490f, 0.999493f, 0.999497f, 0.999500f, 0.999503f,
- 0.999506f, 0.999509f, 0.999512f, 0.999515f, 0.999518f, 0.999521f, 0.999524f, 0.999527f,
- 0.999529f, 0.999532f, 0.999535f, 0.999538f, 0.999541f, 0.999544f, 0.999547f, 0.999550f,
- 0.999553f, 0.999556f, 0.999558f, 0.999561f, 0.999564f, 0.999567f, 0.999570f, 0.999573f,
- 0.999575f, 0.999578f, 0.999581f, 0.999584f, 0.999586f, 0.999589f, 0.999592f, 0.999595f,
- 0.999597f, 0.999600f, 0.999603f, 0.999605f, 0.999608f, 0.999611f, 0.999614f, 0.999616f,
- 0.999619f, 0.999621f, 0.999624f, 0.999627f, 0.999629f, 0.999632f, 0.999635f, 0.999637f,
- 0.999640f, 0.999642f, 0.999645f, 0.999647f, 0.999650f, 0.999652f, 0.999655f, 0.999658f,
- 0.999660f, 0.999663f, 0.999665f, 0.999667f, 0.999670f, 0.999672f, 0.999675f, 0.999677f,
- 0.999680f, 0.999682f, 0.999685f, 0.999687f, 0.999689f, 0.999692f, 0.999694f, 0.999696f,
- 0.999699f, 0.999701f, 0.999704f, 0.999706f, 0.999708f, 0.999710f, 0.999713f, 0.999715f,
- 0.999717f, 0.999720f, 0.999722f, 0.999724f, 0.999726f, 0.999729f, 0.999731f, 0.999733f,
- 0.999735f, 0.999738f, 0.999740f, 0.999742f, 0.999744f, 0.999746f, 0.999748f, 0.999750f,
- 0.999753f, 0.999755f, 0.999757f, 0.999759f, 0.999761f, 0.999763f, 0.999765f, 0.999767f,
- 0.999769f, 0.999771f, 0.999774f, 0.999776f, 0.999778f, 0.999780f, 0.999782f, 0.999784f,
- 0.999786f, 0.999788f, 0.999790f, 0.999792f, 0.999793f, 0.999795f, 0.999797f, 0.999799f,
- 0.999801f, 0.999803f, 0.999805f, 0.999807f, 0.999809f, 0.999811f, 0.999812f, 0.999814f,
- 0.999816f, 0.999818f, 0.999820f, 0.999822f, 0.999823f, 0.999825f, 0.999827f, 0.999829f,
- 0.999831f, 0.999832f, 0.999834f, 0.999836f, 0.999838f, 0.999839f, 0.999841f, 0.999843f,
- 0.999844f, 0.999846f, 0.999848f, 0.999849f, 0.999851f, 0.999853f, 0.999854f, 0.999856f,
- 0.999858f, 0.999859f, 0.999861f, 0.999862f, 0.999864f, 0.999866f, 0.999867f, 0.999869f,
- 0.999870f, 0.999872f, 0.999873f, 0.999875f, 0.999876f, 0.999878f, 0.999879f, 0.999881f,
- 0.999882f, 0.999884f, 0.999885f, 0.999887f, 0.999888f, 0.999890f, 0.999891f, 0.999892f,
- 0.999894f, 0.999895f, 0.999897f, 0.999898f, 0.999899f, 0.999901f, 0.999902f, 0.999903f,
- 0.999905f, 0.999906f, 0.999907f, 0.999909f, 0.999910f, 0.999911f, 0.999913f, 0.999914f,
- 0.999915f, 0.999916f, 0.999917f, 0.999919f, 0.999920f, 0.999921f, 0.999922f, 0.999924f,
- 0.999925f, 0.999926f, 0.999927f, 0.999928f, 0.999929f, 0.999930f, 0.999932f, 0.999933f,
- 0.999934f, 0.999935f, 0.999936f, 0.999937f, 0.999938f, 0.999939f, 0.999940f, 0.999941f,
- 0.999942f, 0.999943f, 0.999944f, 0.999945f, 0.999946f, 0.999947f, 0.999948f, 0.999949f,
- 0.999950f, 0.999951f, 0.999952f, 0.999953f, 0.999954f, 0.999955f, 0.999956f, 0.999957f,
- 0.999958f, 0.999959f, 0.999959f, 0.999960f, 0.999961f, 0.999962f, 0.999963f, 0.999964f,
- 0.999964f, 0.999965f, 0.999966f, 0.999967f, 0.999968f, 0.999968f, 0.999969f, 0.999970f,
- 0.999971f, 0.999971f, 0.999972f, 0.999973f, 0.999973f, 0.999974f, 0.999975f, 0.999976f,
- 0.999976f, 0.999977f, 0.999977f, 0.999978f, 0.999979f, 0.999979f, 0.999980f, 0.999981f,
- 0.999981f, 0.999982f, 0.999982f, 0.999983f, 0.999983f, 0.999984f, 0.999985f, 0.999985f,
- 0.999986f, 0.999986f, 0.999987f, 0.999987f, 0.999988f, 0.999988f, 0.999988f, 0.999989f,
- 0.999989f, 0.999990f, 0.999990f, 0.999991f, 0.999991f, 0.999991f, 0.999992f, 0.999992f,
- 0.999993f, 0.999993f, 0.999993f, 0.999994f, 0.999994f, 0.999994f, 0.999995f, 0.999995f,
- 0.999995f, 0.999996f, 0.999996f, 0.999996f, 0.999996f, 0.999997f, 0.999997f, 0.999997f,
- 0.999997f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, 0.999999f, 0.999999f,
- 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f
-};
-
-static const float *cosTables[17] = {
- 0 , 0 , 0 , 0 ,
- cosTable16 , cosTable32 , cosTable64 , cosTable128 ,
- cosTable256 , cosTable512 , cosTable1024 , cosTable2048 ,
- cosTable4096, cosTable8192, cosTable16384, cosTable32768,
- cosTable65536
-};
-
-const float *getCosineTable(int bits) {
- assert((bits >= 4) && (bits <= 16));
+ for (int i = 1; i < m / 4; i++)
+ _table[m / 2 - i] = _table[i];
+}
- return cosTables[bits];
+CosineTable::~CosineTable() {
+ delete[] _table;
}
} // End of namespace Common
diff --git a/common/cosinetables.h b/common/cosinetables.h
index 5744d21569..f9fb6fd59a 100644
--- a/common/cosinetables.h
+++ b/common/cosinetables.h
@@ -25,12 +25,30 @@
namespace Common {
-/**
- * Get a cosine table with the specified bit precision
- *
- * @param bits Precision of the table, which must be in range [4, 16]
- */
-const float *getCosineTable(int bits);
+class CosineTable {
+public:
+ /**
+ * Construct a cosine table with the specified bit precision
+ *
+ * @param bitPrecision Precision of the table, which must be in range [4, 16]
+ */
+ CosineTable(int bitPrecision);
+ ~CosineTable();
+
+ /**
+ * Get pointer to table
+ */
+ const float *getTable() { return _table; }
+
+ /**
+ * Get pointer to table
+ */
+ int getPrecision() { return _bitPrecision; }
+
+private:
+ float *_table;
+ int _bitPrecision;
+};
} // End of namespace Common
diff --git a/common/dct.cpp b/common/dct.cpp
index 6525c727ae..38b4fbcff2 100644
--- a/common/dct.cpp
+++ b/common/dct.cpp
@@ -26,15 +26,14 @@
// Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
// Copyright (c) 2010 Vitor Sessak
-#include "common/cosinetables.h"
#include "common/dct.h"
namespace Common {
-DCT::DCT(int bits, TransformType trans) : _bits(bits), _trans(trans), _rdft(0) {
+DCT::DCT(int bits, TransformType trans) : _bits(bits), _cos(_bits + 2), _trans(trans), _rdft(0) {
int n = 1 << _bits;
- _tCos = getCosineTable(_bits + 2);
+ _tCos = _cos.getTable();
_csc2 = new float[n / 2];
diff --git a/common/dct.h b/common/dct.h
index 2c8c5129b8..085423ddff 100644
--- a/common/dct.h
+++ b/common/dct.h
@@ -33,6 +33,8 @@
#include "common/math.h"
#include "common/rdft.h"
+#include "common/cosinetables.h"
+
namespace Common {
/**
@@ -59,6 +61,7 @@ private:
int _bits;
TransformType _trans;
+ CosineTable _cos;
const float *_tCos;
float *_csc2;
diff --git a/common/endian.h b/common/endian.h
index 9cb703858a..759513efef 100644
--- a/common/endian.h
+++ b/common/endian.h
@@ -86,7 +86,7 @@
}
// Test for GCC >= 4.3.0 as this version added the bswap builtin
-#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#elif GCC_ATLEAST(4, 3)
FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) {
return __builtin_bswap32(a);
@@ -146,6 +146,12 @@
*/
#define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24)))
+/**
+ * A wrapper macro used around two character constants, like 'wb', to
+ * ensure portability. Typical usage: MKTAG16('w','b').
+ */
+#define MKTAG16(a0,a1) ((uint16)((a1) | ((a0) << 8)))
+
// Functions for reading/writing native integers.
// They also transparently handle the need for alignment.
@@ -156,7 +162,7 @@
//
// Moreover, we activate this code for GCC >= 3.3 but *only* if unaligned access
// is allowed.
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3 && !defined(SCUMM_NEED_ALIGNMENT)))
+#if GCC_ATLEAST(4, 0) || (GCC_ATLEAST(3, 3) && !defined(SCUMM_NEED_ALIGNMENT))
FORCEINLINE uint16 READ_UINT16(const void *ptr) {
struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
@@ -396,4 +402,10 @@ inline uint32 READ_BE_UINT24(const void *ptr) {
return (b[0] << 16) | (b[1] << 8) | (b[2]);
}
+#ifdef SCUMM_LITTLE_ENDIAN
+#define READ_UINT24(a) READ_LE_UINT24(a)
+#else
+#define READ_UINT24(a) READ_BE_UINT24(a)
+#endif
+
#endif
diff --git a/common/events.h b/common/events.h
index 4efdd67b91..7366c51d36 100644
--- a/common/events.h
+++ b/common/events.h
@@ -79,6 +79,8 @@ enum EventType {
// 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_ACTION = 18,
+ EVENT_CUSTOM_BACKEND_HARDWARE = 21,
+ EVENT_GUI_REMAP_COMPLETE_ACTION = 22,
EVENT_KEYMAPPER_REMAP = 19
#endif
#ifdef ENABLE_VKEYBD
@@ -230,12 +232,27 @@ public:
* Map an incoming event to one or more action events
*/
virtual List<Event> mapEvent(const Event &ev, EventSource *source) = 0;
+
+ virtual List<Event> getDelayedEvents() = 0;
};
class DefaultEventMapper : public EventMapper {
public:
+ DefaultEventMapper() : _delayedEvents(), _delayedEffectiveTime(0) {}
// EventMapper interface
virtual List<Event> mapEvent(const Event &ev, EventSource *source);
+ virtual List<Event> getDelayedEvents();
+protected:
+ virtual void addDelayedEvent(uint32 millis, Event ev);
+
+ struct DelayedEventsEntry {
+ const uint32 timerOffset;
+ const Event event;
+ DelayedEventsEntry(const uint32 offset, const Event ev) : timerOffset(offset), event(ev) { }
+ };
+
+ Queue<DelayedEventsEntry> _delayedEvents;
+ uint32 _delayedEffectiveTime;
};
/**
diff --git a/common/fft.cpp b/common/fft.cpp
index 034570964f..a9c58ead9b 100644
--- a/common/fft.cpp
+++ b/common/fft.cpp
@@ -29,6 +29,7 @@
#include "common/cosinetables.h"
#include "common/fft.h"
#include "common/util.h"
+#include "common/textconsole.h"
namespace Common {
@@ -45,6 +46,13 @@ FFT::FFT(int bits, int inverse) : _bits(bits), _inverse(inverse) {
for (int i = 0; i < n; i++)
_revTab[-splitRadixPermutation(i, n, _inverse) & (n - 1)] = i;
+
+ for (int i = 0; i < ARRAYSIZE(_cosTables); i++) {
+ if (i+4 <= _bits)
+ _cosTables[i] = new Common::CosineTable(i+4);
+ else
+ _cosTables[i] = 0;
+ }
}
FFT::~FFT() {
@@ -162,15 +170,7 @@ PASS(pass)
#define BUTTERFLIES BUTTERFLIES_BIG
PASS(pass_big)
-#define DECL_FFT(t, n, n2, n4) \
-static void fft##n(Complex *z) { \
- fft##n2(z); \
- fft##n4(z + n4 * 2); \
- fft##n4(z + n4 * 3); \
- pass(z, getCosineTable(t), n4 / 2);\
-}
-
-static void fft4(Complex *z) {
+void FFT::fft4(Complex *z) {
float t1, t2, t3, t4, t5, t6, t7, t8;
BF(t3, t1, z[0].re, z[1].re);
@@ -183,7 +183,7 @@ static void fft4(Complex *z) {
BF(z[2].im, z[0].im, t2, t5);
}
-static void fft8(Complex *z) {
+void FFT::fft8(Complex *z) {
float t1, t2, t3, t4, t5, t6, t7, t8;
fft4(z);
@@ -202,14 +202,15 @@ static void fft8(Complex *z) {
TRANSFORM(z[1], z[3], z[5], z[7], sqrthalf, sqrthalf);
}
-static void fft16(Complex *z) {
+void FFT::fft16(Complex *z) {
float t1, t2, t3, t4, t5, t6;
fft8(z);
fft4(z + 8);
fft4(z + 12);
- const float * const cosTable = getCosineTable(4);
+ assert(_cosTables[0]);
+ const float * const cosTable = _cosTables[0]->getTable();
TRANSFORM_ZERO(z[0], z[4], z[8], z[12]);
TRANSFORM(z[2], z[6], z[10], z[14], sqrthalf, sqrthalf);
@@ -217,27 +218,31 @@ static void fft16(Complex *z) {
TRANSFORM(z[3], z[7], z[11], z[15], cosTable[3], cosTable[1]);
}
-DECL_FFT(5, 32, 16, 8)
-DECL_FFT(6, 64, 32, 16)
-DECL_FFT(7, 128, 64, 32)
-DECL_FFT(8, 256, 128, 64)
-DECL_FFT(9, 512, 256, 128)
-#define pass pass_big
-DECL_FFT(10, 1024, 512, 256)
-DECL_FFT(11, 2048, 1024, 512)
-DECL_FFT(12, 4096, 2048, 1024)
-DECL_FFT(13, 8192, 4096, 2048)
-DECL_FFT(14, 16384, 8192, 4096)
-DECL_FFT(15, 32768, 16384, 8192)
-DECL_FFT(16, 65536, 32768, 16384)
-
-static void (* const fft_dispatch[])(Complex *) = {
- fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
- fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
-};
+void FFT::fft(int n, int logn, Complex *z) {
+ switch (logn) {
+ case 2:
+ fft4(z);
+ break;
+ case 3:
+ fft8(z);
+ break;
+ case 4:
+ fft16(z);
+ break;
+ default:
+ fft((n / 2), logn - 1, z);
+ fft((n / 4), logn - 2, z + (n / 4) * 2);
+ fft((n / 4), logn - 2, z + (n / 4) * 3);
+ assert(_cosTables[logn - 4]);
+ if (n > 1024)
+ pass_big(z, _cosTables[logn - 4]->getTable(), (n / 4) / 2);
+ else
+ pass(z, _cosTables[logn - 4]->getTable(), (n / 4) / 2);
+ }
+}
void FFT::calc(Complex *z) {
- fft_dispatch[_bits - 2](z);
+ fft(1 << _bits, _bits, z);
}
} // End of namespace Common
diff --git a/common/fft.h b/common/fft.h
index e77c53c2a7..bc58f1dded 100644
--- a/common/fft.h
+++ b/common/fft.h
@@ -34,6 +34,8 @@
namespace Common {
+class CosineTable;
+
/**
* (Inverse) Fast Fourier Transform.
*
@@ -64,13 +66,17 @@ private:
Complex *_expTab;
Complex *_tmpBuf;
- const float *_tSin;
- const float *_tCos;
-
int _splitRadix;
int _permutation;
static int splitRadixPermutation(int i, int n, int inverse);
+
+ CosineTable *_cosTables[13];
+
+ void fft4(Complex *z);
+ void fft8(Complex *z);
+ void fft16(Complex *z);
+ void fft(int n, int logn, Complex *z);
};
} // End of namespace Common
diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index 5b7d939dc4..e463232276 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -52,7 +52,6 @@ const struct GameOpt {
{ GUIO_MIDIGM, "midiGM" },
{ GUIO_NOASPECT, "noAspect" },
- { GUIO_EGAUNDITHER, "egaUndither" },
{ GUIO_RENDERHERCGREEN, "hercGreen" },
{ GUIO_RENDERHERCAMBER, "hercAmber" },
@@ -64,6 +63,14 @@ const struct GameOpt {
{ GUIO_RENDERPC9821, "pc9821" },
{ GUIO_RENDERPC9801, "pc9801" },
+ { GUIO_GAMEOPTIONS1, "gameOption1" },
+ { GUIO_GAMEOPTIONS2, "gameOption2" },
+ { GUIO_GAMEOPTIONS3, "gameOption3" },
+ { GUIO_GAMEOPTIONS4, "gameOption4" },
+ { GUIO_GAMEOPTIONS5, "gameOption5" },
+ { GUIO_GAMEOPTIONS6, "gameOption6" },
+ { GUIO_GAMEOPTIONS7, "gameOption7" },
+
{ GUIO_NONE, 0 }
};
@@ -79,23 +86,6 @@ bool checkGameGUIOption(const String &option, const String &str) {
return false;
}
-bool checkGameGUIOptionLanguage(Language lang, const String &str) {
- if (!str.contains("lang_")) // If no languages are specified
- return true;
-
- if (str.contains(getGameGUIOptionsDescriptionLanguage(lang)))
- return true;
-
- return false;
-}
-
-const String getGameGUIOptionsDescriptionLanguage(Language lang) {
- if (lang == UNK_LANG)
- return "";
-
- return String("lang_") + getLanguageDescription(lang);
-}
-
String parseGameGUIOptions(const String &str) {
String res;
diff --git a/common/gui_options.h b/common/gui_options.h
index 5649f1103d..447fff43ed 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -23,8 +23,6 @@
#ifndef COMMON_GUI_OPTIONS_H
#define COMMON_GUI_OPTIONS_H
-#include "common/language.h"
-
#define GUIO_NONE "\000"
#define GUIO_NOSUBTITLES "\001"
#define GUIO_NOMUSIC "\002"
@@ -46,7 +44,6 @@
#define GUIO_MIDIGM "\021"
#define GUIO_NOASPECT "\022"
-#define GUIO_EGAUNDITHER "\023"
#define GUIO_RENDERHERCGREEN "\030"
#define GUIO_RENDERHERCAMBER "\031"
@@ -58,6 +55,16 @@
#define GUIO_RENDERPC9821 "\037"
#define GUIO_RENDERPC9801 "\040"
+// Special GUIO flags for the AdvancedDetector's caching of game specific
+// options.
+#define GUIO_GAMEOPTIONS1 "\041"
+#define GUIO_GAMEOPTIONS2 "\042"
+#define GUIO_GAMEOPTIONS3 "\043"
+#define GUIO_GAMEOPTIONS4 "\044"
+#define GUIO_GAMEOPTIONS5 "\045"
+#define GUIO_GAMEOPTIONS6 "\046"
+#define GUIO_GAMEOPTIONS7 "\047"
+
#define GUIO0() (GUIO_NONE)
#define GUIO1(a) (a)
#define GUIO2(a,b) (a b)
@@ -65,15 +72,16 @@
#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)
+#define GUIO7(a,b,c,d,e,f,g) (a b c d e f g)
+#define GUIO8(a,b,c,d,e,f,g,h) (a b c d e f g h)
namespace Common {
+class String;
bool checkGameGUIOption(const String &option, const String &str);
-bool checkGameGUIOptionLanguage(Common::Language lang, const String &str);
String parseGameGUIOptions(const String &str);
const String getGameGUIOptionsDescription(const String &options);
-const String getGameGUIOptionsDescriptionLanguage(Common::Language lang);
/**
* Updates the GUI options of the current config manager
diff --git a/engines/agos/installshield_cab.cpp b/common/installshield_cab.cpp
index d4e636f7b3..e25d14741a 100644
--- a/engines/agos/installshield_cab.cpp
+++ b/common/installshield_cab.cpp
@@ -43,27 +43,25 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-#include "agos/installshield_cab.h"
-
+#include "common/archive.h"
#include "common/debug.h"
-#include "common/file.h"
+#include "common/hash-str.h"
+#include "common/installshield_cab.h"
#include "common/memstream.h"
#include "common/zlib.h"
-namespace AGOS {
-
-class InstallShieldCabinet : public Common::Archive {
- Common::String _installShieldFilename;
+namespace Common {
+class InstallShieldCabinet : public Archive {
public:
- InstallShieldCabinet(const Common::String &filename);
+ InstallShieldCabinet(SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
~InstallShieldCabinet();
- // Common::Archive API implementation
- bool hasFile(const Common::String &name) const;
- int listMembers(Common::ArchiveMemberList &list) const;
- const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
- Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
+ // Archive API implementation
+ bool hasFile(const String &name) const;
+ int listMembers(ArchiveMemberList &list) const;
+ const ArchiveMemberPtr getMember(const String &name) const;
+ SeekableReadStream *createReadStreamForMember(const String &name) const;
private:
struct FileEntry {
@@ -73,53 +71,51 @@ private:
uint16 flags;
};
- typedef Common::HashMap<Common::String, FileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
+ typedef HashMap<String, FileEntry, IgnoreCase_Hash, IgnoreCase_EqualTo> FileMap;
FileMap _map;
+ Common::SeekableReadStream *_stream;
+ DisposeAfterUse::Flag _disposeAfterUse;
};
InstallShieldCabinet::~InstallShieldCabinet() {
_map.clear();
-}
-
-InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _installShieldFilename(filename) {
- Common::File installShieldFile;
- if (!installShieldFile.open(_installShieldFilename)) {
- warning("InstallShieldCabinet::InstallShieldCabinet(): Could not find the archive file %s", _installShieldFilename.c_str());
- return;
- }
+ if (_disposeAfterUse == DisposeAfterUse::YES)
+ delete _stream;
+}
+InstallShieldCabinet::InstallShieldCabinet(SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) : _stream(stream), _disposeAfterUse(disposeAfterUse) {
// Note that we only support a limited subset of cabinet files
// Only single cabinet files and ones without data shared between
// cabinets.
// Check for the magic uint32
- if (installShieldFile.readUint32LE() != 0x28635349) {
+ if (_stream->readUint32LE() != 0x28635349) {
warning("InstallShieldCabinet::InstallShieldCabinet(): Magic ID doesn't match");
return;
}
- uint32 version = installShieldFile.readUint32LE();
+ uint32 version = _stream->readUint32LE();
if (version != 0x01000004) {
warning("Unsupported CAB version %08x", version);
return;
}
- /* uint32 volumeInfo = */ installShieldFile.readUint32LE();
- uint32 cabDescriptorOffset = installShieldFile.readUint32LE();
- /* uint32 cabDescriptorSize = */ installShieldFile.readUint32LE();
+ /* uint32 volumeInfo = */ _stream->readUint32LE();
+ uint32 cabDescriptorOffset = _stream->readUint32LE();
+ /* uint32 cabDescriptorSize = */ _stream->readUint32LE();
- installShieldFile.seek(cabDescriptorOffset);
+ _stream->seek(cabDescriptorOffset);
- installShieldFile.skip(12);
- uint32 fileTableOffset = installShieldFile.readUint32LE();
- installShieldFile.skip(4);
- uint32 fileTableSize = installShieldFile.readUint32LE();
- uint32 fileTableSize2 = installShieldFile.readUint32LE();
- uint32 directoryCount = installShieldFile.readUint32LE();
- installShieldFile.skip(8);
- uint32 fileCount = installShieldFile.readUint32LE();
+ _stream->skip(12);
+ uint32 fileTableOffset = _stream->readUint32LE();
+ _stream->skip(4);
+ uint32 fileTableSize = _stream->readUint32LE();
+ uint32 fileTableSize2 = _stream->readUint32LE();
+ uint32 directoryCount = _stream->readUint32LE();
+ _stream->skip(8);
+ uint32 fileCount = _stream->readUint32LE();
if (fileTableSize != fileTableSize2)
warning("file table sizes do not match");
@@ -127,33 +123,33 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in
// We're ignoring file groups and components since we
// should not need them. Moving on to the files...
- installShieldFile.seek(cabDescriptorOffset + fileTableOffset);
+ _stream->seek(cabDescriptorOffset + fileTableOffset);
uint32 fileTableCount = directoryCount + fileCount;
uint32 *fileTableOffsets = new uint32[fileTableCount];
for (uint32 i = 0; i < fileTableCount; i++)
- fileTableOffsets[i] = installShieldFile.readUint32LE();
+ fileTableOffsets[i] = _stream->readUint32LE();
for (uint32 i = directoryCount; i < fileCount + directoryCount; i++) {
- installShieldFile.seek(cabDescriptorOffset + fileTableOffset + fileTableOffsets[i]);
- uint32 nameOffset = installShieldFile.readUint32LE();
- /* uint32 directoryIndex = */ installShieldFile.readUint32LE();
+ _stream->seek(cabDescriptorOffset + fileTableOffset + fileTableOffsets[i]);
+ uint32 nameOffset = _stream->readUint32LE();
+ /* uint32 directoryIndex = */ _stream->readUint32LE();
// First read in data needed by us to get at the file data
FileEntry entry;
- entry.flags = installShieldFile.readUint16LE();
- entry.uncompressedSize = installShieldFile.readUint32LE();
- entry.compressedSize = installShieldFile.readUint32LE();
- installShieldFile.skip(20);
- entry.offset = installShieldFile.readUint32LE();
+ entry.flags = _stream->readUint16LE();
+ entry.uncompressedSize = _stream->readUint32LE();
+ entry.compressedSize = _stream->readUint32LE();
+ _stream->skip(20);
+ entry.offset = _stream->readUint32LE();
// Then let's get the string
- installShieldFile.seek(cabDescriptorOffset + fileTableOffset + nameOffset);
- Common::String fileName;
+ _stream->seek(cabDescriptorOffset + fileTableOffset + nameOffset);
+ String fileName;
- char c = installShieldFile.readByte();
+ char c = _stream->readByte();
while (c) {
fileName += c;
- c = installShieldFile.readByte();
+ c = _stream->readByte();
}
_map[fileName] = entry;
}
@@ -161,43 +157,39 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in
delete[] fileTableOffsets;
}
-bool InstallShieldCabinet::hasFile(const Common::String &name) const {
+bool InstallShieldCabinet::hasFile(const String &name) const {
return _map.contains(name);
}
-int InstallShieldCabinet::listMembers(Common::ArchiveMemberList &list) const {
+int InstallShieldCabinet::listMembers(ArchiveMemberList &list) const {
for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
list.push_back(getMember(it->_key));
return _map.size();
}
-const Common::ArchiveMemberPtr InstallShieldCabinet::getMember(const Common::String &name) const {
- return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
+const ArchiveMemberPtr InstallShieldCabinet::getMember(const String &name) const {
+ return ArchiveMemberPtr(new GenericArchiveMember(name, this));
}
-Common::SeekableReadStream *InstallShieldCabinet::createReadStreamForMember(const Common::String &name) const {
+SeekableReadStream *InstallShieldCabinet::createReadStreamForMember(const String &name) const {
if (!_map.contains(name))
return 0;
const FileEntry &entry = _map[name];
- Common::File archiveFile;
- archiveFile.open(_installShieldFilename);
- archiveFile.seek(entry.offset);
+ _stream->seek(entry.offset);
- if (!(entry.flags & 0x04)) {
- // Not compressed
- return archiveFile.readStream(entry.uncompressedSize);
- }
+ if (!(entry.flags & 0x04)) // Not compressed
+ return _stream->readStream(entry.uncompressedSize);
#ifdef USE_ZLIB
byte *src = (byte *)malloc(entry.compressedSize);
byte *dst = (byte *)malloc(entry.uncompressedSize);
- archiveFile.read(src, entry.compressedSize);
+ _stream->read(src, entry.compressedSize);
- bool result = Common::inflateZlibHeaderless(dst, entry.uncompressedSize, src, entry.compressedSize);
+ bool result = inflateZlibInstallShield(dst, entry.uncompressedSize, src, entry.compressedSize);
free(src);
if (!result) {
@@ -206,15 +198,15 @@ Common::SeekableReadStream *InstallShieldCabinet::createReadStreamForMember(cons
return 0;
}
- return new Common::MemoryReadStream(dst, entry.uncompressedSize, DisposeAfterUse::YES);
+ return new MemoryReadStream(dst, entry.uncompressedSize, DisposeAfterUse::YES);
#else
warning("zlib required to extract compressed CAB file '%s'", name.c_str());
return 0;
#endif
}
-Common::Archive *makeInstallShieldArchive(const Common::String &name) {
- return new InstallShieldCabinet(name);
+Archive *makeInstallShieldArchive(SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
+ return new InstallShieldCabinet(stream, disposeAfterUse);
}
} // End of namespace AGOS
diff --git a/engines/agos/installshield_cab.h b/common/installshield_cab.h
index f7e8bed277..7c4f294578 100644
--- a/engines/agos/installshield_cab.h
+++ b/common/installshield_cab.h
@@ -20,22 +20,24 @@
*
*/
-#include "common/archive.h"
-#include "common/str.h"
+#ifndef COMMON_INSTALLSHIELD_CAB_H
+#define COMMON_INSTALLSHIELD_CAB_H
-#ifndef AGOS_INSTALLSHIELD_CAB_H
-#define AGOS_INSTALLSHIELD_CAB_H
+#include "common/types.h"
-namespace AGOS {
+namespace Common {
+
+class Archive;
+class SeekableReadStream;
/**
* This factory method creates an Archive instance corresponding to the content
- * of the InstallShield compressed file with the given name.
+ * of the InstallShield compressed stream.
*
* May return 0 in case of a failure.
*/
-Common::Archive *makeInstallShieldArchive(const Common::String &name);
+Archive *makeInstallShieldArchive(SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
-} // End of namespace AGOS
+} // End of namespace Common
#endif
diff --git a/common/keyboard.h b/common/keyboard.h
index e6db086598..3262a15c3f 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -224,12 +224,13 @@ enum {
KBD_CTRL = 1 << 0,
KBD_ALT = 1 << 1,
KBD_SHIFT = 1 << 2,
- KBD_NON_STICKY = (KBD_CTRL|KBD_ALT|KBD_SHIFT),
+ KBD_META = 1 << 3,
+ KBD_NON_STICKY = (KBD_CTRL|KBD_ALT|KBD_SHIFT|KBD_META),
// Sticky modifier flags
- KBD_NUM = 1 << 3,
- KBD_CAPS = 1 << 4,
- KBD_SCRL = 1 << 5,
+ KBD_NUM = 1 << 4,
+ KBD_CAPS = 1 << 5,
+ KBD_SCRL = 1 << 6,
KBD_STICKY = (KBD_NUM|KBD_CAPS|KBD_SCRL)
};
@@ -248,7 +249,10 @@ struct KeyState {
* ASCII-value of the pressed key (if any).
* This depends on modifiers, i.e. pressing the 'A' key results in
* different values here depending on the status of shift, alt and
- * caps lock.
+ * caps lock. This should be used rather than keycode for text input
+ * to avoid keyboard layout issues. For example you cannot assume that
+ * KEYCODE_0 without a modifier will be '0' (on AZERTY keyboards it is
+ * not).
*/
uint16 ascii;
diff --git a/common/language.cpp b/common/language.cpp
index 1de01b0207..898adf8d0e 100644
--- a/common/language.cpp
+++ b/common/language.cpp
@@ -20,6 +20,7 @@
*/
#include "common/language.h"
+#include "common/gui_options.h"
#include "common/str.h"
namespace Common {
@@ -104,4 +105,21 @@ const char *getLanguageDescription(Language id) {
return 0;
}
+bool checkGameGUIOptionLanguage(Language lang, const String &str) {
+ if (!str.contains("lang_")) // If no languages are specified
+ return true;
+
+ if (str.contains(getGameGUIOptionsDescriptionLanguage(lang)))
+ return true;
+
+ return false;
+}
+
+const String getGameGUIOptionsDescriptionLanguage(Language lang) {
+ if (lang == UNK_LANG)
+ return "";
+
+ return String("lang_") + getLanguageDescription(lang);
+}
+
} // End of namespace Common
diff --git a/common/language.h b/common/language.h
index b83f0d34fd..db552fc9c4 100644
--- a/common/language.h
+++ b/common/language.h
@@ -75,6 +75,12 @@ extern const char *getLanguageCode(Language id);
extern const char *getLanguageLocale(Language id);
extern const char *getLanguageDescription(Language id);
+// TODO: Document this GUIO related function
+const String getGameGUIOptionsDescriptionLanguage(Common::Language lang);
+
+// TODO: Document this GUIO related function
+bool checkGameGUIOptionLanguage(Common::Language lang, const String &str);
+
} // End of namespace Common
#endif
diff --git a/common/macresman.cpp b/common/macresman.cpp
index 14bdfa7080..f2f020c6de 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -124,7 +124,7 @@ bool MacResManager::open(String filename) {
File *file = new File();
// First, let's try to see if the Mac converted name exists
- if (file->open("._" + filename) && loadFromAppleDouble(*file)) {
+ if (file->open(constructAppleDoubleName(filename)) && loadFromAppleDouble(*file)) {
_baseFileName = filename;
return true;
}
@@ -185,7 +185,7 @@ bool MacResManager::open(FSNode path, String filename) {
#endif
// First, let's try to see if the Mac converted name exists
- FSNode fsNode = path.getChild("._" + filename);
+ FSNode fsNode = path.getChild(constructAppleDoubleName(filename));
if (fsNode.exists() && !fsNode.isDirectory()) {
SeekableReadStream *stream = fsNode.createReadStream();
if (loadFromAppleDouble(*stream)) {
@@ -253,7 +253,7 @@ bool MacResManager::exists(const String &filename) {
return true;
// Check if we have an AppleDouble file
- if (tempFile.open("._" + filename) && tempFile.readUint32BE() == 0x00051607)
+ if (tempFile.open(constructAppleDoubleName(filename)) && tempFile.readUint32BE() == 0x00051607)
return true;
return false;
@@ -574,4 +574,20 @@ void MacResManager::readMap() {
}
}
+Common::String MacResManager::constructAppleDoubleName(Common::String name) {
+ // Insert "._" before the last portion of a path name
+ for (int i = name.size() - 1; i >= 0; i--) {
+ if (i == 0) {
+ name.insertChar('_', 0);
+ name.insertChar('.', 0);
+ } else if (name[i] == '/') {
+ name.insertChar('_', i + 1);
+ name.insertChar('.', i + 1);
+ break;
+ }
+ }
+
+ return name;
+}
+
} // End of namespace Common
diff --git a/common/macresman.h b/common/macresman.h
index 6820106925..ed74da9cc6 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -25,6 +25,7 @@
* Macintosh resource fork manager used in engines:
* - groovie
* - mohawk
+ * - pegasus
* - sci
* - scumm
*/
@@ -175,6 +176,8 @@ private:
bool loadFromMacBinary(SeekableReadStream &stream);
bool loadFromAppleDouble(SeekableReadStream &stream);
+ static Common::String constructAppleDoubleName(Common::String name);
+
enum {
kResForkNone = 0,
kResForkRaw,
diff --git a/common/math.h b/common/math.h
index f787b84fa6..b85ec0d22a 100644
--- a/common/math.h
+++ b/common/math.h
@@ -75,7 +75,7 @@ struct Complex {
float re, im;
};
-#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#if GCC_ATLEAST(3, 4)
inline int intLog2(uint32 v) {
// This is a slightly optimized implementation of log2 for natural numbers
// targeting gcc. It also saves some binary size over our fallback
diff --git a/common/memstream.h b/common/memstream.h
index 69fe6ec18e..497a178ab9 100644
--- a/common/memstream.h
+++ b/common/memstream.h
@@ -92,13 +92,17 @@ private:
byte *_ptr;
const uint32 _bufSize;
uint32 _pos;
+ bool _err;
public:
- MemoryWriteStream(byte *buf, uint32 len) : _ptr(buf), _bufSize(len), _pos(0) {}
+ MemoryWriteStream(byte *buf, uint32 len) : _ptr(buf), _bufSize(len), _pos(0), _err(false) {}
uint32 write(const void *dataPtr, uint32 dataSize) {
// Write at most as many bytes as are still available...
- if (dataSize > _bufSize - _pos)
+ if (dataSize > _bufSize - _pos) {
dataSize = _bufSize - _pos;
+ // We couldn't write all the data => set error indicator
+ _err = true;
+ }
memcpy(_ptr, dataPtr, dataSize);
_ptr += dataSize;
_pos += dataSize;
@@ -107,6 +111,9 @@ public:
uint32 pos() const { return _pos; }
uint32 size() const { return _bufSize; }
+
+ virtual bool err() const { return _err; }
+ virtual void clearErr() { _err = false; }
};
/**
diff --git a/common/module.mk b/common/module.mk
index b4928fabda..d96b11ee40 100644
--- a/common/module.mk
+++ b/common/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
archive.o \
config-file.o \
config-manager.o \
+ coroutines.o \
dcl.o \
debug.o \
error.o \
@@ -15,6 +16,7 @@ MODULE_OBJS := \
gui_options.o \
hashmap.o \
iff_container.o \
+ installshield_cab.o \
language.o \
localization.o \
macresman.o \
@@ -41,7 +43,6 @@ MODULE_OBJS := \
xmlparser.o \
zlib.o
-ifdef USE_BINK
MODULE_OBJS += \
cosinetables.o \
dct.o \
@@ -49,7 +50,6 @@ MODULE_OBJS += \
huffman.o \
rdft.o \
sinetables.o
-endif
# Include common rules
include $(srcdir)/rules.mk
diff --git a/common/ptr.h b/common/ptr.h
index 2b0670caae..f734ec133f 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -103,7 +103,7 @@ private:
*/
template<class T>
class SharedPtr {
-#if !((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95))
+#if !defined(__GNUC__) || GCC_ATLEAST(3, 0)
template<class T2> friend class SharedPtr;
#endif
public:
@@ -200,7 +200,7 @@ public:
* This should just be used for debugging purposes.
*/
RefValue refCount() const { return _refCount ? *_refCount : 0; }
-#if !((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95))
+#if !defined(__GNUC__) || GCC_ATLEAST(3, 0)
private:
#endif
void decRef() {
diff --git a/common/quicktime.cpp b/common/quicktime.cpp
index 248d8b2b3a..173d3c6a97 100644
--- a/common/quicktime.cpp
+++ b/common/quicktime.cpp
@@ -111,19 +111,29 @@ bool QuickTimeParser::parseStream(SeekableReadStream *stream, DisposeAfterUse::F
}
void QuickTimeParser::init() {
- // Remove unknown/unhandled tracks
for (uint32 i = 0; i < _tracks.size(); i++) {
+ // Remove unknown/unhandled tracks
if (_tracks[i]->codecType == CODEC_TYPE_MOV_OTHER) {
delete _tracks[i];
_tracks.remove_at(i);
i--;
+ } else {
+ // If this track doesn't have a declared scale, use the movie scale
+ if (_tracks[i]->timeScale == 0)
+ _tracks[i]->timeScale = _timeScale;
+
+ // If this track doesn't have an edit list (like in MPEG-4 files),
+ // fake an entry of one edit that takes up the entire sample
+ if (_tracks[i]->editCount == 0) {
+ _tracks[i]->editCount = 1;
+ _tracks[i]->editList = new EditListEntry[1];
+ _tracks[i]->editList[0].trackDuration = _tracks[i]->duration;
+ _tracks[i]->editList[0].timeOffset = 0;
+ _tracks[i]->editList[0].mediaTime = 0;
+ _tracks[i]->editList[0].mediaRate = 1;
+ }
}
}
-
- // Adjust time scale
- for (uint32 i = 0; i < _tracks.size(); i++)
- if (!_tracks[i]->timeScale)
- _tracks[i]->timeScale = _timeScale;
}
void QuickTimeParser::initParseTable() {
@@ -154,6 +164,7 @@ void QuickTimeParser::initParseTable() {
{ &QuickTimeParser::readCMOV, MKTAG('c', 'm', 'o', 'v') },
{ &QuickTimeParser::readWAVE, MKTAG('w', 'a', 'v', 'e') },
{ &QuickTimeParser::readESDS, MKTAG('e', 's', 'd', 's') },
+ { &QuickTimeParser::readSMI, MKTAG('S', 'M', 'I', ' ') },
{ 0, 0 }
};
@@ -206,7 +217,11 @@ int QuickTimeParser::readDefault(Atom atom) {
a.size -= 8;
- if (_parseTable[i].type == 0) { // skip leaf atoms data
+ if (a.size + (uint32)_fd->pos() > (uint32)_fd->size()) {
+ _fd->seek(_fd->size());
+ debug(0, "Skipping junk found at the end of the QuickTime file");
+ return 0;
+ } else if (_parseTable[i].type == 0) { // skip leaf atom data
debug(0, ">>> Skipped [%s]", tag2str(a.type));
_fd->seek(a.size, SEEK_CUR);
@@ -677,7 +692,7 @@ int QuickTimeParser::readWAVE(Atom atom) {
return -1;
if (track->sampleDescs[0]->getCodecTag() == MKTAG('Q', 'D', 'M', '2')) // Read extra data for QDM2
- track->extraData = _fd->readStream(atom.size - 8);
+ track->extraData = _fd->readStream(atom.size);
else if (atom.size > 8)
return readDefault(atom);
else
@@ -751,6 +766,18 @@ int QuickTimeParser::readESDS(Atom atom) {
return 0;
}
+int QuickTimeParser::readSMI(Atom atom) {
+ if (_tracks.empty())
+ return 0;
+
+ Track *track = _tracks.back();
+
+ // This atom just contains SVQ3 extra data
+ track->extraData = _fd->readStream(atom.size);
+
+ return 0;
+}
+
void QuickTimeParser::close() {
for (uint32 i = 0; i < _tracks.size(); i++)
delete _tracks[i];
diff --git a/common/quicktime.h b/common/quicktime.h
index efd2adbd21..641718e13a 100644
--- a/common/quicktime.h
+++ b/common/quicktime.h
@@ -35,6 +35,7 @@
#include "common/scummsys.h"
#include "common/stream.h"
#include "common/rational.h"
+#include "common/types.h"
namespace Common {
class MacResManager;
@@ -77,25 +78,13 @@ public:
*/
void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; }
+ /** Find out if this parser has an open file handle */
bool isOpen() const { return _fd != 0; }
protected:
// This is the file handle from which data is read from. It can be the actual file handle or a decompressed stream.
SeekableReadStream *_fd;
- DisposeAfterUse::Flag _disposeFileHandle;
-
- struct Atom {
- uint32 type;
- uint32 offset;
- uint32 size;
- };
-
- struct ParseTable {
- int (QuickTimeParser::*func)(Atom atom);
- uint32 type;
- };
-
struct TimeToSampleEntry {
int count;
int duration;
@@ -174,18 +163,33 @@ protected:
virtual SampleDesc *readSampleDesc(Track *track, uint32 format) = 0;
- const ParseTable *_parseTable;
- bool _foundMOOV;
uint32 _timeScale;
uint32 _duration;
Rational _scaleFactorX;
Rational _scaleFactorY;
Array<Track *> _tracks;
+
+ void init();
+
+private:
+ struct Atom {
+ uint32 type;
+ uint32 offset;
+ uint32 size;
+ };
+
+ struct ParseTable {
+ int (QuickTimeParser::*func)(Atom atom);
+ uint32 type;
+ };
+
+ DisposeAfterUse::Flag _disposeFileHandle;
+ const ParseTable *_parseTable;
uint32 _beginOffset;
MacResManager *_resFork;
+ bool _foundMOOV;
void initParseTable();
- void init();
int readDefault(Atom atom);
int readLeaf(Atom atom);
@@ -205,6 +209,7 @@ protected:
int readCMOV(Atom atom);
int readWAVE(Atom atom);
int readESDS(Atom atom);
+ int readSMI(Atom atom);
};
} // End of namespace Common
diff --git a/common/rational.h b/common/rational.h
index 45aa6a7a20..8270d2194e 100644
--- a/common/rational.h
+++ b/common/rational.h
@@ -80,6 +80,9 @@ public:
double toDouble() const;
frac_t toFrac() const;
+ int getNumerator() const { return _num; }
+ int getDenominator() const { return _denom; }
+
void debugPrint(int debuglevel = 0, const char *caption = "Rational:") const;
private:
diff --git a/common/rdft.cpp b/common/rdft.cpp
index 3f52a89cba..bfd6818fbd 100644
--- a/common/rdft.cpp
+++ b/common/rdft.cpp
@@ -25,12 +25,10 @@
// Copyright (c) 2009 Alex Converse <alex dot converse at gmail dot com>
#include "common/rdft.h"
-#include "common/cosinetables.h"
-#include "common/sinetables.h"
namespace Common {
-RDFT::RDFT(int bits, TransformType trans) : _bits(bits), _fft(0) {
+RDFT::RDFT(int bits, TransformType trans) : _bits(bits), _sin(bits), _cos(bits), _fft(0) {
assert ((_bits >= 4) && (_bits <= 16));
_inverse = trans == IDFT_C2R || trans == DFT_C2R;
@@ -40,8 +38,8 @@ RDFT::RDFT(int bits, TransformType trans) : _bits(bits), _fft(0) {
int n = 1 << bits;
- _tSin = getSineTable(bits) + (trans == DFT_R2C || trans == DFT_C2R) * (n >> 2);
- _tCos = getCosineTable(bits);
+ _tSin = _sin.getTable() + (trans == DFT_R2C || trans == DFT_C2R) * (n >> 2);
+ _tCos = _cos.getTable();
}
RDFT::~RDFT() {
diff --git a/common/rdft.h b/common/rdft.h
index 68be0f4dac..3386940404 100644
--- a/common/rdft.h
+++ b/common/rdft.h
@@ -31,11 +31,17 @@
#include "common/math.h"
#include "common/fft.h"
+#include "common/cosinetables.h"
+#include "common/sinetables.h"
+
namespace Common {
/**
* (Inverse) Real Discrete Fourier Transform.
*
+ * Used in audio:
+ * - QDM2
+ *
* Used in engines:
* - scumm
*/
@@ -59,6 +65,8 @@ private:
int _inverse;
int _signConvention;
+ SineTable _sin;
+ CosineTable _cos;
const float *_tSin;
const float *_tCos;
diff --git a/common/rect.h b/common/rect.h
index 768d1ebbb9..8d1243f7e4 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -170,6 +170,20 @@ struct Rect {
}
/**
+ * Find the intersecting rectangle between this rectangle and the given rectangle
+ *
+ * @param r the intersecting rectangle
+ *
+ * @return the intersection of the rectangles or an empty rectangle if not intersecting
+ */
+ Rect findIntersectingRect(const Rect &r) const {
+ if (!intersects(r))
+ return Rect();
+
+ return Rect(MAX(r.left, left), MAX(r.top, top), MIN(r.right, right), MIN(r.bottom, bottom));
+ }
+
+ /**
* Extend this rectangle so that it contains r
*
* @param r the rectangle to extend by
@@ -244,11 +258,11 @@ struct Rect {
/**
* Create a rectangle around the given center.
+ * @note the center point is rounded up and left when given an odd width and height
*/
static Rect center(int16 cx, int16 cy, int16 w, int16 h) {
- w /= 2;
- h /= 2;
- return Rect(cx - w, cy - h, cx + w, cy + h);
+ int x = cx - w / 2, y = cy - h / 2;
+ return Rect(x, y, x + w, y + h);
}
};
diff --git a/common/rendermode.cpp b/common/rendermode.cpp
index 62b67faee5..e8f3146630 100644
--- a/common/rendermode.cpp
+++ b/common/rendermode.cpp
@@ -22,6 +22,7 @@
#include "common/rendermode.h"
+#include "common/gui_options.h"
#include "common/str.h"
#include "common/translation.h"
@@ -43,6 +44,26 @@ const RenderModeDescription g_renderModes[] = {
{0, 0, kRenderDefault}
};
+struct RenderGUIOMapping {
+ RenderMode id;
+ const char *guio;
+};
+
+// TODO: Merge s_renderGUIOMapping into g_renderModes? the kRenderDefault
+// could be used to indicate "any" mode when passed to renderMode2GUIO (if
+// we wanted to merge allRenderModesGUIOs back into)
+static const RenderGUIOMapping s_renderGUIOMapping[] = {
+ { kRenderHercG, GUIO_RENDERHERCGREEN },
+ { kRenderHercA, GUIO_RENDERHERCAMBER },
+ { kRenderCGA, GUIO_RENDERCGA },
+ { kRenderEGA, GUIO_RENDEREGA },
+ { kRenderVGA, GUIO_RENDERVGA },
+ { kRenderAmiga, GUIO_RENDERAMIGA },
+ { kRenderFMTowns, GUIO_RENDERFMTOWNS },
+ { kRenderPC9821, GUIO_RENDERPC9821 },
+ { kRenderPC9801, GUIO_RENDERPC9801 }
+};
+
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Green", "lowres")
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Amber", "lowres")
@@ -77,5 +98,25 @@ const char *getRenderModeDescription(RenderMode id) {
return 0;
}
+String renderMode2GUIO(RenderMode id) {
+ String res;
+
+ for (int i = 0; i < ARRAYSIZE(s_renderGUIOMapping); i++) {
+ if (id == s_renderGUIOMapping[i].id)
+ res += s_renderGUIOMapping[i].guio;
+ }
+
+ return res;
+}
+
+String allRenderModesGUIOs() {
+ String res;
+
+ for (int i = 0; i < ARRAYSIZE(s_renderGUIOMapping); i++) {
+ res += s_renderGUIOMapping[i].guio;
+ }
+
+ return res;
+}
} // End of namespace Common
diff --git a/common/rendermode.h b/common/rendermode.h
index c2fece77ee..945c4e7d9d 100644
--- a/common/rendermode.h
+++ b/common/rendermode.h
@@ -61,6 +61,12 @@ extern RenderMode parseRenderMode(const String &str);
extern const char *getRenderModeCode(RenderMode id);
extern const char *getRenderModeDescription(RenderMode id);
+// TODO: Rename the following to something better; also, document it
+extern String renderMode2GUIO(RenderMode id);
+
+// TODO: Rename the following to something better; also, document it
+extern String allRenderModesGUIOs();
+
} // End of namespace Common
diff --git a/common/savefile.h b/common/savefile.h
index 03a7b52add..19536da54f 100644
--- a/common/savefile.h
+++ b/common/savefile.h
@@ -104,11 +104,23 @@ public:
virtual String popErrorDesc();
/**
- * Open the savefile with the specified name in the given directory for saving.
- * @param name the name of the savefile
+ * Open the savefile with the specified name in the given directory for
+ * saving.
+ *
+ * Saved games are compressed by default, and engines are expected to
+ * always write compressed saves.
+ *
+ * A notable exception is if uncompressed files are needed for
+ * compatibility with games not supported by ScummVM, such as character
+ * exports from the Quest for Glory series. QfG5 is a 3D game and won't be
+ * supported by ScummVM.
+ *
+ * @param name the name of the savefile
+ * @param compress toggles whether to compress the resulting save file
+ * (default) or not.
* @return pointer to an OutSaveFile, or NULL if an error occurred.
*/
- virtual OutSaveFile *openForSaving(const String &name) = 0;
+ virtual OutSaveFile *openForSaving(const String &name, bool compress = true) = 0;
/**
* Open the file with the specified name in the given directory for loading.
diff --git a/common/scummsys.h b/common/scummsys.h
index 6baab7c16f..2f4efe702f 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -23,6 +23,9 @@
#ifndef COMMON_SCUMMSYS_H
#define COMMON_SCUMMSYS_H
+// This is a convenience macro to test whether the compiler used is a GCC
+// version, which is at least major.minor.
+#define GCC_ATLEAST(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
#define NONSTANDARD_PORT
@@ -268,7 +271,7 @@
#ifndef FORCEINLINE
#if defined(_MSC_VER)
#define FORCEINLINE __forceinline
- #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+ #elif GCC_ATLEAST(3, 1)
#define FORCEINLINE inline __attribute__((__always_inline__))
#else
#define FORCEINLINE inline
@@ -316,7 +319,7 @@
#define scumm_va_copy va_copy
#elif defined(__va_copy)
#define scumm_va_copy __va_copy
- #elif defined(_MSC_VER) || defined (__SYMBIAN32__)
+ #elif defined(_MSC_VER) || defined(__SYMBIAN32__)
#define scumm_va_copy(dst, src) ((dst) = (src))
#else
#error scumm_va_copy undefined for this port
diff --git a/common/sinetables.cpp b/common/sinetables.cpp
index 79721ec401..a6ec99469d 100644
--- a/common/sinetables.cpp
+++ b/common/sinetables.cpp
@@ -27,8248 +27,26 @@
namespace Common {
-static const float sinTable16[8] = {
- 0.000000f, 0.382683f, 0.707107f, 0.923880f, 0.000000f, -0.382683f, -0.707107f, -0.923880f
-};
+SineTable::SineTable(int bitPrecision) {
+ assert((bitPrecision >= 4) && (bitPrecision <= 16));
-static const float sinTable32[16] = {
- 0.000000f, 0.195090f, 0.382683f, 0.555570f, 0.707107f, 0.831470f, 0.923880f, 0.980785f,
- 0.000000f, -0.195090f, -0.382683f, -0.555570f, -0.707107f, -0.831470f, -0.923880f, -0.980785f
-};
+ _bitPrecision = bitPrecision;
-static const float sinTable64[32] = {
- 0.000000f, 0.098017f, 0.195090f, 0.290285f, 0.382683f, 0.471397f, 0.555570f, 0.634393f,
- 0.707107f, 0.773010f, 0.831470f, 0.881921f, 0.923880f, 0.956940f, 0.980785f, 0.995185f,
- 0.000000f, -0.098017f, -0.195090f, -0.290285f, -0.382683f, -0.471397f, -0.555570f, -0.634393f,
- -0.707107f, -0.773010f, -0.831470f, -0.881921f, -0.923880f, -0.956940f, -0.980785f, -0.995185f
-};
+ int m = 1 << _bitPrecision;
+ double freq = 2 * M_PI / m;
+ _table = new float[m];
-static const float sinTable128[64] = {
- 0.000000f, 0.049068f, 0.098017f, 0.146730f, 0.195090f, 0.242980f, 0.290285f, 0.336890f,
- 0.382683f, 0.427555f, 0.471397f, 0.514103f, 0.555570f, 0.595699f, 0.634393f, 0.671559f,
- 0.707107f, 0.740951f, 0.773010f, 0.803208f, 0.831470f, 0.857729f, 0.881921f, 0.903989f,
- 0.923880f, 0.941544f, 0.956940f, 0.970031f, 0.980785f, 0.989177f, 0.995185f, 0.998795f,
- 0.000000f, -0.049068f, -0.098017f, -0.146730f, -0.195090f, -0.242980f, -0.290285f, -0.336890f,
- -0.382683f, -0.427555f, -0.471397f, -0.514103f, -0.555570f, -0.595699f, -0.634393f, -0.671559f,
- -0.707107f, -0.740951f, -0.773010f, -0.803208f, -0.831470f, -0.857729f, -0.881921f, -0.903989f,
- -0.923880f, -0.941544f, -0.956940f, -0.970031f, -0.980785f, -0.989177f, -0.995185f, -0.998795f
-};
+ // Table contains sin(2*pi*x/n) for 0<=x<=n/4,
+ // followed by its reverse
+ for (int i = 0; i <= m / 4; i++)
+ _table[i] = sin(i * freq);
-static const float sinTable256[128] = {
- 0.000000f, 0.024541f, 0.049068f, 0.073565f, 0.098017f, 0.122411f, 0.146730f, 0.170962f,
- 0.195090f, 0.219101f, 0.242980f, 0.266713f, 0.290285f, 0.313682f, 0.336890f, 0.359895f,
- 0.382683f, 0.405241f, 0.427555f, 0.449611f, 0.471397f, 0.492898f, 0.514103f, 0.534998f,
- 0.555570f, 0.575808f, 0.595699f, 0.615232f, 0.634393f, 0.653173f, 0.671559f, 0.689541f,
- 0.707107f, 0.724247f, 0.740951f, 0.757209f, 0.773010f, 0.788346f, 0.803208f, 0.817585f,
- 0.831470f, 0.844854f, 0.857729f, 0.870087f, 0.881921f, 0.893224f, 0.903989f, 0.914210f,
- 0.923880f, 0.932993f, 0.941544f, 0.949528f, 0.956940f, 0.963776f, 0.970031f, 0.975702f,
- 0.980785f, 0.985278f, 0.989177f, 0.992480f, 0.995185f, 0.997290f, 0.998795f, 0.999699f,
- 0.000000f, -0.024541f, -0.049068f, -0.073565f, -0.098017f, -0.122411f, -0.146730f, -0.170962f,
- -0.195090f, -0.219101f, -0.242980f, -0.266713f, -0.290285f, -0.313682f, -0.336890f, -0.359895f,
- -0.382683f, -0.405241f, -0.427555f, -0.449611f, -0.471397f, -0.492898f, -0.514103f, -0.534998f,
- -0.555570f, -0.575808f, -0.595699f, -0.615232f, -0.634393f, -0.653173f, -0.671559f, -0.689541f,
- -0.707107f, -0.724247f, -0.740951f, -0.757209f, -0.773010f, -0.788346f, -0.803208f, -0.817585f,
- -0.831470f, -0.844854f, -0.857729f, -0.870087f, -0.881921f, -0.893224f, -0.903989f, -0.914210f,
- -0.923880f, -0.932993f, -0.941544f, -0.949528f, -0.956940f, -0.963776f, -0.970031f, -0.975702f,
- -0.980785f, -0.985278f, -0.989177f, -0.992480f, -0.995185f, -0.997290f, -0.998795f, -0.999699f
-};
-
-static const float sinTable512[256] = {
- 0.000000f, 0.012272f, 0.024541f, 0.036807f, 0.049068f, 0.061321f, 0.073565f, 0.085797f,
- 0.098017f, 0.110222f, 0.122411f, 0.134581f, 0.146730f, 0.158858f, 0.170962f, 0.183040f,
- 0.195090f, 0.207111f, 0.219101f, 0.231058f, 0.242980f, 0.254866f, 0.266713f, 0.278520f,
- 0.290285f, 0.302006f, 0.313682f, 0.325310f, 0.336890f, 0.348419f, 0.359895f, 0.371317f,
- 0.382683f, 0.393992f, 0.405241f, 0.416430f, 0.427555f, 0.438616f, 0.449611f, 0.460539f,
- 0.471397f, 0.482184f, 0.492898f, 0.503538f, 0.514103f, 0.524590f, 0.534998f, 0.545325f,
- 0.555570f, 0.565732f, 0.575808f, 0.585798f, 0.595699f, 0.605511f, 0.615232f, 0.624860f,
- 0.634393f, 0.643832f, 0.653173f, 0.662416f, 0.671559f, 0.680601f, 0.689541f, 0.698376f,
- 0.707107f, 0.715731f, 0.724247f, 0.732654f, 0.740951f, 0.749136f, 0.757209f, 0.765167f,
- 0.773010f, 0.780737f, 0.788346f, 0.795837f, 0.803208f, 0.810457f, 0.817585f, 0.824589f,
- 0.831470f, 0.838225f, 0.844854f, 0.851355f, 0.857729f, 0.863973f, 0.870087f, 0.876070f,
- 0.881921f, 0.887640f, 0.893224f, 0.898674f, 0.903989f, 0.909168f, 0.914210f, 0.919114f,
- 0.923880f, 0.928506f, 0.932993f, 0.937339f, 0.941544f, 0.945607f, 0.949528f, 0.953306f,
- 0.956940f, 0.960431f, 0.963776f, 0.966976f, 0.970031f, 0.972940f, 0.975702f, 0.978317f,
- 0.980785f, 0.983105f, 0.985278f, 0.987301f, 0.989177f, 0.990903f, 0.992480f, 0.993907f,
- 0.995185f, 0.996313f, 0.997290f, 0.998118f, 0.998795f, 0.999322f, 0.999699f, 0.999925f,
- 0.000000f, -0.012272f, -0.024541f, -0.036807f, -0.049068f, -0.061321f, -0.073565f, -0.085797f,
- -0.098017f, -0.110222f, -0.122411f, -0.134581f, -0.146730f, -0.158858f, -0.170962f, -0.183040f,
- -0.195090f, -0.207111f, -0.219101f, -0.231058f, -0.242980f, -0.254866f, -0.266713f, -0.278520f,
- -0.290285f, -0.302006f, -0.313682f, -0.325310f, -0.336890f, -0.348419f, -0.359895f, -0.371317f,
- -0.382683f, -0.393992f, -0.405241f, -0.416430f, -0.427555f, -0.438616f, -0.449611f, -0.460539f,
- -0.471397f, -0.482184f, -0.492898f, -0.503538f, -0.514103f, -0.524590f, -0.534998f, -0.545325f,
- -0.555570f, -0.565732f, -0.575808f, -0.585798f, -0.595699f, -0.605511f, -0.615232f, -0.624860f,
- -0.634393f, -0.643832f, -0.653173f, -0.662416f, -0.671559f, -0.680601f, -0.689541f, -0.698376f,
- -0.707107f, -0.715731f, -0.724247f, -0.732654f, -0.740951f, -0.749136f, -0.757209f, -0.765167f,
- -0.773010f, -0.780737f, -0.788346f, -0.795837f, -0.803208f, -0.810457f, -0.817585f, -0.824589f,
- -0.831470f, -0.838225f, -0.844854f, -0.851355f, -0.857729f, -0.863973f, -0.870087f, -0.876070f,
- -0.881921f, -0.887640f, -0.893224f, -0.898674f, -0.903989f, -0.909168f, -0.914210f, -0.919114f,
- -0.923880f, -0.928506f, -0.932993f, -0.937339f, -0.941544f, -0.945607f, -0.949528f, -0.953306f,
- -0.956940f, -0.960431f, -0.963776f, -0.966976f, -0.970031f, -0.972940f, -0.975702f, -0.978317f,
- -0.980785f, -0.983105f, -0.985278f, -0.987301f, -0.989177f, -0.990903f, -0.992480f, -0.993907f,
- -0.995185f, -0.996313f, -0.997290f, -0.998118f, -0.998795f, -0.999322f, -0.999699f, -0.999925f
-};
-
-static const float sinTable1024[512] = {
- 0.000000f, 0.006136f, 0.012272f, 0.018407f, 0.024541f, 0.030675f, 0.036807f, 0.042938f,
- 0.049068f, 0.055195f, 0.061321f, 0.067444f, 0.073565f, 0.079682f, 0.085797f, 0.091909f,
- 0.098017f, 0.104122f, 0.110222f, 0.116319f, 0.122411f, 0.128498f, 0.134581f, 0.140658f,
- 0.146730f, 0.152797f, 0.158858f, 0.164913f, 0.170962f, 0.177004f, 0.183040f, 0.189069f,
- 0.195090f, 0.201105f, 0.207111f, 0.213110f, 0.219101f, 0.225084f, 0.231058f, 0.237024f,
- 0.242980f, 0.248928f, 0.254866f, 0.260794f, 0.266713f, 0.272621f, 0.278520f, 0.284408f,
- 0.290285f, 0.296151f, 0.302006f, 0.307850f, 0.313682f, 0.319502f, 0.325310f, 0.331106f,
- 0.336890f, 0.342661f, 0.348419f, 0.354164f, 0.359895f, 0.365613f, 0.371317f, 0.377007f,
- 0.382683f, 0.388345f, 0.393992f, 0.399624f, 0.405241f, 0.410843f, 0.416430f, 0.422000f,
- 0.427555f, 0.433094f, 0.438616f, 0.444122f, 0.449611f, 0.455084f, 0.460539f, 0.465977f,
- 0.471397f, 0.476799f, 0.482184f, 0.487550f, 0.492898f, 0.498228f, 0.503538f, 0.508830f,
- 0.514103f, 0.519356f, 0.524590f, 0.529804f, 0.534998f, 0.540171f, 0.545325f, 0.550458f,
- 0.555570f, 0.560662f, 0.565732f, 0.570781f, 0.575808f, 0.580814f, 0.585798f, 0.590760f,
- 0.595699f, 0.600616f, 0.605511f, 0.610383f, 0.615232f, 0.620057f, 0.624860f, 0.629638f,
- 0.634393f, 0.639124f, 0.643832f, 0.648514f, 0.653173f, 0.657807f, 0.662416f, 0.667000f,
- 0.671559f, 0.676093f, 0.680601f, 0.685084f, 0.689541f, 0.693971f, 0.698376f, 0.702755f,
- 0.707107f, 0.711432f, 0.715731f, 0.720003f, 0.724247f, 0.728464f, 0.732654f, 0.736817f,
- 0.740951f, 0.745058f, 0.749136f, 0.753187f, 0.757209f, 0.761202f, 0.765167f, 0.769103f,
- 0.773010f, 0.776888f, 0.780737f, 0.784557f, 0.788346f, 0.792107f, 0.795837f, 0.799537f,
- 0.803208f, 0.806848f, 0.810457f, 0.814036f, 0.817585f, 0.821102f, 0.824589f, 0.828045f,
- 0.831470f, 0.834863f, 0.838225f, 0.841555f, 0.844854f, 0.848120f, 0.851355f, 0.854558f,
- 0.857729f, 0.860867f, 0.863973f, 0.867046f, 0.870087f, 0.873095f, 0.876070f, 0.879012f,
- 0.881921f, 0.884797f, 0.887640f, 0.890449f, 0.893224f, 0.895966f, 0.898674f, 0.901349f,
- 0.903989f, 0.906596f, 0.909168f, 0.911706f, 0.914210f, 0.916679f, 0.919114f, 0.921514f,
- 0.923880f, 0.926210f, 0.928506f, 0.930767f, 0.932993f, 0.935184f, 0.937339f, 0.939459f,
- 0.941544f, 0.943593f, 0.945607f, 0.947586f, 0.949528f, 0.951435f, 0.953306f, 0.955141f,
- 0.956940f, 0.958703f, 0.960431f, 0.962121f, 0.963776f, 0.965394f, 0.966976f, 0.968522f,
- 0.970031f, 0.971504f, 0.972940f, 0.974339f, 0.975702f, 0.977028f, 0.978317f, 0.979570f,
- 0.980785f, 0.981964f, 0.983105f, 0.984210f, 0.985278f, 0.986308f, 0.987301f, 0.988258f,
- 0.989177f, 0.990058f, 0.990903f, 0.991710f, 0.992480f, 0.993212f, 0.993907f, 0.994565f,
- 0.995185f, 0.995767f, 0.996313f, 0.996820f, 0.997290f, 0.997723f, 0.998118f, 0.998476f,
- 0.998795f, 0.999078f, 0.999322f, 0.999529f, 0.999699f, 0.999831f, 0.999925f, 0.999981f,
- 0.000000f, -0.006136f, -0.012272f, -0.018407f, -0.024541f, -0.030675f, -0.036807f, -0.042938f,
- -0.049068f, -0.055195f, -0.061321f, -0.067444f, -0.073565f, -0.079682f, -0.085797f, -0.091909f,
- -0.098017f, -0.104122f, -0.110222f, -0.116319f, -0.122411f, -0.128498f, -0.134581f, -0.140658f,
- -0.146730f, -0.152797f, -0.158858f, -0.164913f, -0.170962f, -0.177004f, -0.183040f, -0.189069f,
- -0.195090f, -0.201105f, -0.207111f, -0.213110f, -0.219101f, -0.225084f, -0.231058f, -0.237024f,
- -0.242980f, -0.248928f, -0.254866f, -0.260794f, -0.266713f, -0.272621f, -0.278520f, -0.284408f,
- -0.290285f, -0.296151f, -0.302006f, -0.307850f, -0.313682f, -0.319502f, -0.325310f, -0.331106f,
- -0.336890f, -0.342661f, -0.348419f, -0.354164f, -0.359895f, -0.365613f, -0.371317f, -0.377007f,
- -0.382683f, -0.388345f, -0.393992f, -0.399624f, -0.405241f, -0.410843f, -0.416430f, -0.422000f,
- -0.427555f, -0.433094f, -0.438616f, -0.444122f, -0.449611f, -0.455084f, -0.460539f, -0.465977f,
- -0.471397f, -0.476799f, -0.482184f, -0.487550f, -0.492898f, -0.498228f, -0.503538f, -0.508830f,
- -0.514103f, -0.519356f, -0.524590f, -0.529804f, -0.534998f, -0.540171f, -0.545325f, -0.550458f,
- -0.555570f, -0.560662f, -0.565732f, -0.570781f, -0.575808f, -0.580814f, -0.585798f, -0.590760f,
- -0.595699f, -0.600616f, -0.605511f, -0.610383f, -0.615232f, -0.620057f, -0.624860f, -0.629638f,
- -0.634393f, -0.639124f, -0.643832f, -0.648514f, -0.653173f, -0.657807f, -0.662416f, -0.667000f,
- -0.671559f, -0.676093f, -0.680601f, -0.685084f, -0.689541f, -0.693971f, -0.698376f, -0.702755f,
- -0.707107f, -0.711432f, -0.715731f, -0.720003f, -0.724247f, -0.728464f, -0.732654f, -0.736817f,
- -0.740951f, -0.745058f, -0.749136f, -0.753187f, -0.757209f, -0.761202f, -0.765167f, -0.769103f,
- -0.773010f, -0.776888f, -0.780737f, -0.784557f, -0.788346f, -0.792107f, -0.795837f, -0.799537f,
- -0.803208f, -0.806848f, -0.810457f, -0.814036f, -0.817585f, -0.821102f, -0.824589f, -0.828045f,
- -0.831470f, -0.834863f, -0.838225f, -0.841555f, -0.844854f, -0.848120f, -0.851355f, -0.854558f,
- -0.857729f, -0.860867f, -0.863973f, -0.867046f, -0.870087f, -0.873095f, -0.876070f, -0.879012f,
- -0.881921f, -0.884797f, -0.887640f, -0.890449f, -0.893224f, -0.895966f, -0.898674f, -0.901349f,
- -0.903989f, -0.906596f, -0.909168f, -0.911706f, -0.914210f, -0.916679f, -0.919114f, -0.921514f,
- -0.923880f, -0.926210f, -0.928506f, -0.930767f, -0.932993f, -0.935184f, -0.937339f, -0.939459f,
- -0.941544f, -0.943593f, -0.945607f, -0.947586f, -0.949528f, -0.951435f, -0.953306f, -0.955141f,
- -0.956940f, -0.958703f, -0.960431f, -0.962121f, -0.963776f, -0.965394f, -0.966976f, -0.968522f,
- -0.970031f, -0.971504f, -0.972940f, -0.974339f, -0.975702f, -0.977028f, -0.978317f, -0.979570f,
- -0.980785f, -0.981964f, -0.983105f, -0.984210f, -0.985278f, -0.986308f, -0.987301f, -0.988258f,
- -0.989177f, -0.990058f, -0.990903f, -0.991710f, -0.992480f, -0.993212f, -0.993907f, -0.994565f,
- -0.995185f, -0.995767f, -0.996313f, -0.996820f, -0.997290f, -0.997723f, -0.998118f, -0.998476f,
- -0.998795f, -0.999078f, -0.999322f, -0.999529f, -0.999699f, -0.999831f, -0.999925f, -0.999981f
-};
-
-static const float sinTable2048[1024] = {
- 0.000000f, 0.003068f, 0.006136f, 0.009204f, 0.012272f, 0.015339f, 0.018407f, 0.021474f,
- 0.024541f, 0.027608f, 0.030675f, 0.033741f, 0.036807f, 0.039873f, 0.042938f, 0.046003f,
- 0.049068f, 0.052132f, 0.055195f, 0.058258f, 0.061321f, 0.064383f, 0.067444f, 0.070505f,
- 0.073565f, 0.076624f, 0.079682f, 0.082740f, 0.085797f, 0.088854f, 0.091909f, 0.094963f,
- 0.098017f, 0.101070f, 0.104122f, 0.107172f, 0.110222f, 0.113271f, 0.116319f, 0.119365f,
- 0.122411f, 0.125455f, 0.128498f, 0.131540f, 0.134581f, 0.137620f, 0.140658f, 0.143695f,
- 0.146730f, 0.149765f, 0.152797f, 0.155828f, 0.158858f, 0.161886f, 0.164913f, 0.167938f,
- 0.170962f, 0.173984f, 0.177004f, 0.180023f, 0.183040f, 0.186055f, 0.189069f, 0.192080f,
- 0.195090f, 0.198098f, 0.201105f, 0.204109f, 0.207111f, 0.210112f, 0.213110f, 0.216107f,
- 0.219101f, 0.222094f, 0.225084f, 0.228072f, 0.231058f, 0.234042f, 0.237024f, 0.240003f,
- 0.242980f, 0.245955f, 0.248928f, 0.251898f, 0.254866f, 0.257831f, 0.260794f, 0.263755f,
- 0.266713f, 0.269668f, 0.272621f, 0.275572f, 0.278520f, 0.281465f, 0.284408f, 0.287347f,
- 0.290285f, 0.293219f, 0.296151f, 0.299080f, 0.302006f, 0.304929f, 0.307850f, 0.310767f,
- 0.313682f, 0.316593f, 0.319502f, 0.322408f, 0.325310f, 0.328210f, 0.331106f, 0.334000f,
- 0.336890f, 0.339777f, 0.342661f, 0.345541f, 0.348419f, 0.351293f, 0.354164f, 0.357031f,
- 0.359895f, 0.362756f, 0.365613f, 0.368467f, 0.371317f, 0.374164f, 0.377007f, 0.379847f,
- 0.382683f, 0.385516f, 0.388345f, 0.391170f, 0.393992f, 0.396810f, 0.399624f, 0.402435f,
- 0.405241f, 0.408044f, 0.410843f, 0.413638f, 0.416430f, 0.419217f, 0.422000f, 0.424780f,
- 0.427555f, 0.430326f, 0.433094f, 0.435857f, 0.438616f, 0.441371f, 0.444122f, 0.446869f,
- 0.449611f, 0.452350f, 0.455084f, 0.457813f, 0.460539f, 0.463260f, 0.465977f, 0.468689f,
- 0.471397f, 0.474100f, 0.476799f, 0.479494f, 0.482184f, 0.484869f, 0.487550f, 0.490226f,
- 0.492898f, 0.495565f, 0.498228f, 0.500885f, 0.503538f, 0.506187f, 0.508830f, 0.511469f,
- 0.514103f, 0.516732f, 0.519356f, 0.521975f, 0.524590f, 0.527199f, 0.529804f, 0.532403f,
- 0.534998f, 0.537587f, 0.540171f, 0.542751f, 0.545325f, 0.547894f, 0.550458f, 0.553017f,
- 0.555570f, 0.558119f, 0.560662f, 0.563199f, 0.565732f, 0.568259f, 0.570781f, 0.573297f,
- 0.575808f, 0.578314f, 0.580814f, 0.583309f, 0.585798f, 0.588282f, 0.590760f, 0.593232f,
- 0.595699f, 0.598161f, 0.600616f, 0.603067f, 0.605511f, 0.607950f, 0.610383f, 0.612810f,
- 0.615232f, 0.617647f, 0.620057f, 0.622461f, 0.624860f, 0.627252f, 0.629638f, 0.632019f,
- 0.634393f, 0.636762f, 0.639124f, 0.641481f, 0.643832f, 0.646176f, 0.648514f, 0.650847f,
- 0.653173f, 0.655493f, 0.657807f, 0.660114f, 0.662416f, 0.664711f, 0.667000f, 0.669283f,
- 0.671559f, 0.673829f, 0.676093f, 0.678350f, 0.680601f, 0.682846f, 0.685084f, 0.687315f,
- 0.689541f, 0.691759f, 0.693971f, 0.696177f, 0.698376f, 0.700569f, 0.702755f, 0.704934f,
- 0.707107f, 0.709273f, 0.711432f, 0.713585f, 0.715731f, 0.717870f, 0.720003f, 0.722128f,
- 0.724247f, 0.726359f, 0.728464f, 0.730563f, 0.732654f, 0.734739f, 0.736817f, 0.738887f,
- 0.740951f, 0.743008f, 0.745058f, 0.747101f, 0.749136f, 0.751165f, 0.753187f, 0.755201f,
- 0.757209f, 0.759209f, 0.761202f, 0.763188f, 0.765167f, 0.767139f, 0.769103f, 0.771061f,
- 0.773010f, 0.774953f, 0.776888f, 0.778817f, 0.780737f, 0.782651f, 0.784557f, 0.786455f,
- 0.788346f, 0.790230f, 0.792107f, 0.793975f, 0.795837f, 0.797691f, 0.799537f, 0.801376f,
- 0.803208f, 0.805031f, 0.806848f, 0.808656f, 0.810457f, 0.812251f, 0.814036f, 0.815814f,
- 0.817585f, 0.819348f, 0.821102f, 0.822850f, 0.824589f, 0.826321f, 0.828045f, 0.829761f,
- 0.831470f, 0.833170f, 0.834863f, 0.836548f, 0.838225f, 0.839894f, 0.841555f, 0.843208f,
- 0.844854f, 0.846491f, 0.848120f, 0.849742f, 0.851355f, 0.852961f, 0.854558f, 0.856147f,
- 0.857729f, 0.859302f, 0.860867f, 0.862424f, 0.863973f, 0.865514f, 0.867046f, 0.868571f,
- 0.870087f, 0.871595f, 0.873095f, 0.874587f, 0.876070f, 0.877545f, 0.879012f, 0.880471f,
- 0.881921f, 0.883363f, 0.884797f, 0.886223f, 0.887640f, 0.889048f, 0.890449f, 0.891841f,
- 0.893224f, 0.894599f, 0.895966f, 0.897325f, 0.898674f, 0.900016f, 0.901349f, 0.902673f,
- 0.903989f, 0.905297f, 0.906596f, 0.907886f, 0.909168f, 0.910441f, 0.911706f, 0.912962f,
- 0.914210f, 0.915449f, 0.916679f, 0.917901f, 0.919114f, 0.920318f, 0.921514f, 0.922701f,
- 0.923880f, 0.925049f, 0.926210f, 0.927363f, 0.928506f, 0.929641f, 0.930767f, 0.931884f,
- 0.932993f, 0.934093f, 0.935184f, 0.936266f, 0.937339f, 0.938404f, 0.939459f, 0.940506f,
- 0.941544f, 0.942573f, 0.943593f, 0.944605f, 0.945607f, 0.946601f, 0.947586f, 0.948561f,
- 0.949528f, 0.950486f, 0.951435f, 0.952375f, 0.953306f, 0.954228f, 0.955141f, 0.956045f,
- 0.956940f, 0.957826f, 0.958703f, 0.959572f, 0.960431f, 0.961280f, 0.962121f, 0.962953f,
- 0.963776f, 0.964590f, 0.965394f, 0.966190f, 0.966976f, 0.967754f, 0.968522f, 0.969281f,
- 0.970031f, 0.970772f, 0.971504f, 0.972227f, 0.972940f, 0.973644f, 0.974339f, 0.975025f,
- 0.975702f, 0.976370f, 0.977028f, 0.977677f, 0.978317f, 0.978948f, 0.979570f, 0.980182f,
- 0.980785f, 0.981379f, 0.981964f, 0.982539f, 0.983105f, 0.983662f, 0.984210f, 0.984748f,
- 0.985278f, 0.985798f, 0.986308f, 0.986809f, 0.987301f, 0.987784f, 0.988258f, 0.988722f,
- 0.989177f, 0.989622f, 0.990058f, 0.990485f, 0.990903f, 0.991311f, 0.991710f, 0.992099f,
- 0.992480f, 0.992850f, 0.993212f, 0.993564f, 0.993907f, 0.994240f, 0.994565f, 0.994879f,
- 0.995185f, 0.995481f, 0.995767f, 0.996045f, 0.996313f, 0.996571f, 0.996820f, 0.997060f,
- 0.997290f, 0.997511f, 0.997723f, 0.997925f, 0.998118f, 0.998302f, 0.998476f, 0.998640f,
- 0.998795f, 0.998941f, 0.999078f, 0.999205f, 0.999322f, 0.999431f, 0.999529f, 0.999619f,
- 0.999699f, 0.999769f, 0.999831f, 0.999882f, 0.999925f, 0.999958f, 0.999981f, 0.999995f,
- 0.000000f, -0.003068f, -0.006136f, -0.009204f, -0.012272f, -0.015339f, -0.018407f, -0.021474f,
- -0.024541f, -0.027608f, -0.030675f, -0.033741f, -0.036807f, -0.039873f, -0.042938f, -0.046003f,
- -0.049068f, -0.052132f, -0.055195f, -0.058258f, -0.061321f, -0.064383f, -0.067444f, -0.070505f,
- -0.073565f, -0.076624f, -0.079682f, -0.082740f, -0.085797f, -0.088854f, -0.091909f, -0.094963f,
- -0.098017f, -0.101070f, -0.104122f, -0.107172f, -0.110222f, -0.113271f, -0.116319f, -0.119365f,
- -0.122411f, -0.125455f, -0.128498f, -0.131540f, -0.134581f, -0.137620f, -0.140658f, -0.143695f,
- -0.146730f, -0.149765f, -0.152797f, -0.155828f, -0.158858f, -0.161886f, -0.164913f, -0.167938f,
- -0.170962f, -0.173984f, -0.177004f, -0.180023f, -0.183040f, -0.186055f, -0.189069f, -0.192080f,
- -0.195090f, -0.198098f, -0.201105f, -0.204109f, -0.207111f, -0.210112f, -0.213110f, -0.216107f,
- -0.219101f, -0.222094f, -0.225084f, -0.228072f, -0.231058f, -0.234042f, -0.237024f, -0.240003f,
- -0.242980f, -0.245955f, -0.248928f, -0.251898f, -0.254866f, -0.257831f, -0.260794f, -0.263755f,
- -0.266713f, -0.269668f, -0.272621f, -0.275572f, -0.278520f, -0.281465f, -0.284408f, -0.287347f,
- -0.290285f, -0.293219f, -0.296151f, -0.299080f, -0.302006f, -0.304929f, -0.307850f, -0.310767f,
- -0.313682f, -0.316593f, -0.319502f, -0.322408f, -0.325310f, -0.328210f, -0.331106f, -0.334000f,
- -0.336890f, -0.339777f, -0.342661f, -0.345541f, -0.348419f, -0.351293f, -0.354164f, -0.357031f,
- -0.359895f, -0.362756f, -0.365613f, -0.368467f, -0.371317f, -0.374164f, -0.377007f, -0.379847f,
- -0.382683f, -0.385516f, -0.388345f, -0.391170f, -0.393992f, -0.396810f, -0.399624f, -0.402435f,
- -0.405241f, -0.408044f, -0.410843f, -0.413638f, -0.416430f, -0.419217f, -0.422000f, -0.424780f,
- -0.427555f, -0.430326f, -0.433094f, -0.435857f, -0.438616f, -0.441371f, -0.444122f, -0.446869f,
- -0.449611f, -0.452350f, -0.455084f, -0.457813f, -0.460539f, -0.463260f, -0.465977f, -0.468689f,
- -0.471397f, -0.474100f, -0.476799f, -0.479494f, -0.482184f, -0.484869f, -0.487550f, -0.490226f,
- -0.492898f, -0.495565f, -0.498228f, -0.500885f, -0.503538f, -0.506187f, -0.508830f, -0.511469f,
- -0.514103f, -0.516732f, -0.519356f, -0.521975f, -0.524590f, -0.527199f, -0.529804f, -0.532403f,
- -0.534998f, -0.537587f, -0.540171f, -0.542751f, -0.545325f, -0.547894f, -0.550458f, -0.553017f,
- -0.555570f, -0.558119f, -0.560662f, -0.563199f, -0.565732f, -0.568259f, -0.570781f, -0.573297f,
- -0.575808f, -0.578314f, -0.580814f, -0.583309f, -0.585798f, -0.588282f, -0.590760f, -0.593232f,
- -0.595699f, -0.598161f, -0.600616f, -0.603067f, -0.605511f, -0.607950f, -0.610383f, -0.612810f,
- -0.615232f, -0.617647f, -0.620057f, -0.622461f, -0.624860f, -0.627252f, -0.629638f, -0.632019f,
- -0.634393f, -0.636762f, -0.639124f, -0.641481f, -0.643832f, -0.646176f, -0.648514f, -0.650847f,
- -0.653173f, -0.655493f, -0.657807f, -0.660114f, -0.662416f, -0.664711f, -0.667000f, -0.669283f,
- -0.671559f, -0.673829f, -0.676093f, -0.678350f, -0.680601f, -0.682846f, -0.685084f, -0.687315f,
- -0.689541f, -0.691759f, -0.693971f, -0.696177f, -0.698376f, -0.700569f, -0.702755f, -0.704934f,
- -0.707107f, -0.709273f, -0.711432f, -0.713585f, -0.715731f, -0.717870f, -0.720003f, -0.722128f,
- -0.724247f, -0.726359f, -0.728464f, -0.730563f, -0.732654f, -0.734739f, -0.736817f, -0.738887f,
- -0.740951f, -0.743008f, -0.745058f, -0.747101f, -0.749136f, -0.751165f, -0.753187f, -0.755201f,
- -0.757209f, -0.759209f, -0.761202f, -0.763188f, -0.765167f, -0.767139f, -0.769103f, -0.771061f,
- -0.773010f, -0.774953f, -0.776888f, -0.778817f, -0.780737f, -0.782651f, -0.784557f, -0.786455f,
- -0.788346f, -0.790230f, -0.792107f, -0.793975f, -0.795837f, -0.797691f, -0.799537f, -0.801376f,
- -0.803208f, -0.805031f, -0.806848f, -0.808656f, -0.810457f, -0.812251f, -0.814036f, -0.815814f,
- -0.817585f, -0.819348f, -0.821102f, -0.822850f, -0.824589f, -0.826321f, -0.828045f, -0.829761f,
- -0.831470f, -0.833170f, -0.834863f, -0.836548f, -0.838225f, -0.839894f, -0.841555f, -0.843208f,
- -0.844854f, -0.846491f, -0.848120f, -0.849742f, -0.851355f, -0.852961f, -0.854558f, -0.856147f,
- -0.857729f, -0.859302f, -0.860867f, -0.862424f, -0.863973f, -0.865514f, -0.867046f, -0.868571f,
- -0.870087f, -0.871595f, -0.873095f, -0.874587f, -0.876070f, -0.877545f, -0.879012f, -0.880471f,
- -0.881921f, -0.883363f, -0.884797f, -0.886223f, -0.887640f, -0.889048f, -0.890449f, -0.891841f,
- -0.893224f, -0.894599f, -0.895966f, -0.897325f, -0.898674f, -0.900016f, -0.901349f, -0.902673f,
- -0.903989f, -0.905297f, -0.906596f, -0.907886f, -0.909168f, -0.910441f, -0.911706f, -0.912962f,
- -0.914210f, -0.915449f, -0.916679f, -0.917901f, -0.919114f, -0.920318f, -0.921514f, -0.922701f,
- -0.923880f, -0.925049f, -0.926210f, -0.927363f, -0.928506f, -0.929641f, -0.930767f, -0.931884f,
- -0.932993f, -0.934093f, -0.935184f, -0.936266f, -0.937339f, -0.938404f, -0.939459f, -0.940506f,
- -0.941544f, -0.942573f, -0.943593f, -0.944605f, -0.945607f, -0.946601f, -0.947586f, -0.948561f,
- -0.949528f, -0.950486f, -0.951435f, -0.952375f, -0.953306f, -0.954228f, -0.955141f, -0.956045f,
- -0.956940f, -0.957826f, -0.958703f, -0.959572f, -0.960431f, -0.961280f, -0.962121f, -0.962953f,
- -0.963776f, -0.964590f, -0.965394f, -0.966190f, -0.966976f, -0.967754f, -0.968522f, -0.969281f,
- -0.970031f, -0.970772f, -0.971504f, -0.972227f, -0.972940f, -0.973644f, -0.974339f, -0.975025f,
- -0.975702f, -0.976370f, -0.977028f, -0.977677f, -0.978317f, -0.978948f, -0.979570f, -0.980182f,
- -0.980785f, -0.981379f, -0.981964f, -0.982539f, -0.983105f, -0.983662f, -0.984210f, -0.984748f,
- -0.985278f, -0.985798f, -0.986308f, -0.986809f, -0.987301f, -0.987784f, -0.988258f, -0.988722f,
- -0.989177f, -0.989622f, -0.990058f, -0.990485f, -0.990903f, -0.991311f, -0.991710f, -0.992099f,
- -0.992480f, -0.992850f, -0.993212f, -0.993564f, -0.993907f, -0.994240f, -0.994565f, -0.994879f,
- -0.995185f, -0.995481f, -0.995767f, -0.996045f, -0.996313f, -0.996571f, -0.996820f, -0.997060f,
- -0.997290f, -0.997511f, -0.997723f, -0.997925f, -0.998118f, -0.998302f, -0.998476f, -0.998640f,
- -0.998795f, -0.998941f, -0.999078f, -0.999205f, -0.999322f, -0.999431f, -0.999529f, -0.999619f,
- -0.999699f, -0.999769f, -0.999831f, -0.999882f, -0.999925f, -0.999958f, -0.999981f, -0.999995f
-};
-
-static const float sinTable4096[2048] = {
- 0.000000f, 0.001534f, 0.003068f, 0.004602f, 0.006136f, 0.007670f, 0.009204f, 0.010738f,
- 0.012272f, 0.013805f, 0.015339f, 0.016873f, 0.018407f, 0.019940f, 0.021474f, 0.023008f,
- 0.024541f, 0.026075f, 0.027608f, 0.029142f, 0.030675f, 0.032208f, 0.033741f, 0.035274f,
- 0.036807f, 0.038340f, 0.039873f, 0.041406f, 0.042938f, 0.044471f, 0.046003f, 0.047535f,
- 0.049068f, 0.050600f, 0.052132f, 0.053664f, 0.055195f, 0.056727f, 0.058258f, 0.059790f,
- 0.061321f, 0.062852f, 0.064383f, 0.065913f, 0.067444f, 0.068974f, 0.070505f, 0.072035f,
- 0.073565f, 0.075094f, 0.076624f, 0.078153f, 0.079682f, 0.081211f, 0.082740f, 0.084269f,
- 0.085797f, 0.087326f, 0.088854f, 0.090381f, 0.091909f, 0.093436f, 0.094963f, 0.096490f,
- 0.098017f, 0.099544f, 0.101070f, 0.102596f, 0.104122f, 0.105647f, 0.107172f, 0.108697f,
- 0.110222f, 0.111747f, 0.113271f, 0.114795f, 0.116319f, 0.117842f, 0.119365f, 0.120888f,
- 0.122411f, 0.123933f, 0.125455f, 0.126977f, 0.128498f, 0.130019f, 0.131540f, 0.133061f,
- 0.134581f, 0.136101f, 0.137620f, 0.139139f, 0.140658f, 0.142177f, 0.143695f, 0.145213f,
- 0.146730f, 0.148248f, 0.149765f, 0.151281f, 0.152797f, 0.154313f, 0.155828f, 0.157343f,
- 0.158858f, 0.160372f, 0.161886f, 0.163400f, 0.164913f, 0.166426f, 0.167938f, 0.169450f,
- 0.170962f, 0.172473f, 0.173984f, 0.175494f, 0.177004f, 0.178514f, 0.180023f, 0.181532f,
- 0.183040f, 0.184548f, 0.186055f, 0.187562f, 0.189069f, 0.190575f, 0.192080f, 0.193586f,
- 0.195090f, 0.196595f, 0.198098f, 0.199602f, 0.201105f, 0.202607f, 0.204109f, 0.205610f,
- 0.207111f, 0.208612f, 0.210112f, 0.211611f, 0.213110f, 0.214609f, 0.216107f, 0.217604f,
- 0.219101f, 0.220598f, 0.222094f, 0.223589f, 0.225084f, 0.226578f, 0.228072f, 0.229565f,
- 0.231058f, 0.232550f, 0.234042f, 0.235533f, 0.237024f, 0.238514f, 0.240003f, 0.241492f,
- 0.242980f, 0.244468f, 0.245955f, 0.247442f, 0.248928f, 0.250413f, 0.251898f, 0.253382f,
- 0.254866f, 0.256349f, 0.257831f, 0.259313f, 0.260794f, 0.262275f, 0.263755f, 0.265234f,
- 0.266713f, 0.268191f, 0.269668f, 0.271145f, 0.272621f, 0.274097f, 0.275572f, 0.277046f,
- 0.278520f, 0.279993f, 0.281465f, 0.282937f, 0.284408f, 0.285878f, 0.287347f, 0.288816f,
- 0.290285f, 0.291752f, 0.293219f, 0.294685f, 0.296151f, 0.297616f, 0.299080f, 0.300543f,
- 0.302006f, 0.303468f, 0.304929f, 0.306390f, 0.307850f, 0.309309f, 0.310767f, 0.312225f,
- 0.313682f, 0.315138f, 0.316593f, 0.318048f, 0.319502f, 0.320955f, 0.322408f, 0.323859f,
- 0.325310f, 0.326760f, 0.328210f, 0.329658f, 0.331106f, 0.332553f, 0.334000f, 0.335445f,
- 0.336890f, 0.338334f, 0.339777f, 0.341219f, 0.342661f, 0.344101f, 0.345541f, 0.346980f,
- 0.348419f, 0.349856f, 0.351293f, 0.352729f, 0.354164f, 0.355598f, 0.357031f, 0.358463f,
- 0.359895f, 0.361326f, 0.362756f, 0.364185f, 0.365613f, 0.367040f, 0.368467f, 0.369892f,
- 0.371317f, 0.372741f, 0.374164f, 0.375586f, 0.377007f, 0.378428f, 0.379847f, 0.381266f,
- 0.382683f, 0.384100f, 0.385516f, 0.386931f, 0.388345f, 0.389758f, 0.391170f, 0.392582f,
- 0.393992f, 0.395401f, 0.396810f, 0.398218f, 0.399624f, 0.401030f, 0.402435f, 0.403838f,
- 0.405241f, 0.406643f, 0.408044f, 0.409444f, 0.410843f, 0.412241f, 0.413638f, 0.415034f,
- 0.416430f, 0.417824f, 0.419217f, 0.420609f, 0.422000f, 0.423390f, 0.424780f, 0.426168f,
- 0.427555f, 0.428941f, 0.430326f, 0.431711f, 0.433094f, 0.434476f, 0.435857f, 0.437237f,
- 0.438616f, 0.439994f, 0.441371f, 0.442747f, 0.444122f, 0.445496f, 0.446869f, 0.448241f,
- 0.449611f, 0.450981f, 0.452350f, 0.453717f, 0.455084f, 0.456449f, 0.457813f, 0.459177f,
- 0.460539f, 0.461900f, 0.463260f, 0.464619f, 0.465977f, 0.467333f, 0.468689f, 0.470043f,
- 0.471397f, 0.472749f, 0.474100f, 0.475450f, 0.476799f, 0.478147f, 0.479494f, 0.480839f,
- 0.482184f, 0.483527f, 0.484869f, 0.486210f, 0.487550f, 0.488889f, 0.490226f, 0.491563f,
- 0.492898f, 0.494232f, 0.495565f, 0.496897f, 0.498228f, 0.499557f, 0.500885f, 0.502212f,
- 0.503538f, 0.504863f, 0.506187f, 0.507509f, 0.508830f, 0.510150f, 0.511469f, 0.512786f,
- 0.514103f, 0.515418f, 0.516732f, 0.518045f, 0.519356f, 0.520666f, 0.521975f, 0.523283f,
- 0.524590f, 0.525895f, 0.527199f, 0.528502f, 0.529804f, 0.531104f, 0.532403f, 0.533701f,
- 0.534998f, 0.536293f, 0.537587f, 0.538880f, 0.540171f, 0.541462f, 0.542751f, 0.544039f,
- 0.545325f, 0.546610f, 0.547894f, 0.549177f, 0.550458f, 0.551738f, 0.553017f, 0.554294f,
- 0.555570f, 0.556845f, 0.558119f, 0.559391f, 0.560662f, 0.561931f, 0.563199f, 0.564466f,
- 0.565732f, 0.566996f, 0.568259f, 0.569521f, 0.570781f, 0.572040f, 0.573297f, 0.574553f,
- 0.575808f, 0.577062f, 0.578314f, 0.579565f, 0.580814f, 0.582062f, 0.583309f, 0.584554f,
- 0.585798f, 0.587040f, 0.588282f, 0.589521f, 0.590760f, 0.591997f, 0.593232f, 0.594467f,
- 0.595699f, 0.596931f, 0.598161f, 0.599389f, 0.600616f, 0.601842f, 0.603067f, 0.604290f,
- 0.605511f, 0.606731f, 0.607950f, 0.609167f, 0.610383f, 0.611597f, 0.612810f, 0.614022f,
- 0.615232f, 0.616440f, 0.617647f, 0.618853f, 0.620057f, 0.621260f, 0.622461f, 0.623661f,
- 0.624860f, 0.626056f, 0.627252f, 0.628446f, 0.629638f, 0.630829f, 0.632019f, 0.633207f,
- 0.634393f, 0.635578f, 0.636762f, 0.637944f, 0.639124f, 0.640303f, 0.641481f, 0.642657f,
- 0.643832f, 0.645005f, 0.646176f, 0.647346f, 0.648514f, 0.649681f, 0.650847f, 0.652011f,
- 0.653173f, 0.654334f, 0.655493f, 0.656651f, 0.657807f, 0.658961f, 0.660114f, 0.661266f,
- 0.662416f, 0.663564f, 0.664711f, 0.665856f, 0.667000f, 0.668142f, 0.669283f, 0.670422f,
- 0.671559f, 0.672695f, 0.673829f, 0.674962f, 0.676093f, 0.677222f, 0.678350f, 0.679476f,
- 0.680601f, 0.681724f, 0.682846f, 0.683965f, 0.685084f, 0.686200f, 0.687315f, 0.688429f,
- 0.689541f, 0.690651f, 0.691759f, 0.692866f, 0.693971f, 0.695075f, 0.696177f, 0.697277f,
- 0.698376f, 0.699473f, 0.700569f, 0.701663f, 0.702755f, 0.703845f, 0.704934f, 0.706021f,
- 0.707107f, 0.708191f, 0.709273f, 0.710353f, 0.711432f, 0.712509f, 0.713585f, 0.714659f,
- 0.715731f, 0.716801f, 0.717870f, 0.718937f, 0.720003f, 0.721066f, 0.722128f, 0.723188f,
- 0.724247f, 0.725304f, 0.726359f, 0.727413f, 0.728464f, 0.729514f, 0.730563f, 0.731609f,
- 0.732654f, 0.733697f, 0.734739f, 0.735779f, 0.736817f, 0.737853f, 0.738887f, 0.739920f,
- 0.740951f, 0.741980f, 0.743008f, 0.744034f, 0.745058f, 0.746080f, 0.747101f, 0.748119f,
- 0.749136f, 0.750152f, 0.751165f, 0.752177f, 0.753187f, 0.754195f, 0.755201f, 0.756206f,
- 0.757209f, 0.758210f, 0.759209f, 0.760207f, 0.761202f, 0.762196f, 0.763188f, 0.764179f,
- 0.765167f, 0.766154f, 0.767139f, 0.768122f, 0.769103f, 0.770083f, 0.771061f, 0.772036f,
- 0.773010f, 0.773983f, 0.774953f, 0.775922f, 0.776888f, 0.777853f, 0.778817f, 0.779778f,
- 0.780737f, 0.781695f, 0.782651f, 0.783605f, 0.784557f, 0.785507f, 0.786455f, 0.787402f,
- 0.788346f, 0.789289f, 0.790230f, 0.791169f, 0.792107f, 0.793042f, 0.793975f, 0.794907f,
- 0.795837f, 0.796765f, 0.797691f, 0.798615f, 0.799537f, 0.800458f, 0.801376f, 0.802293f,
- 0.803208f, 0.804120f, 0.805031f, 0.805940f, 0.806848f, 0.807753f, 0.808656f, 0.809558f,
- 0.810457f, 0.811355f, 0.812251f, 0.813144f, 0.814036f, 0.814926f, 0.815814f, 0.816701f,
- 0.817585f, 0.818467f, 0.819348f, 0.820226f, 0.821102f, 0.821977f, 0.822850f, 0.823721f,
- 0.824589f, 0.825456f, 0.826321f, 0.827184f, 0.828045f, 0.828904f, 0.829761f, 0.830616f,
- 0.831470f, 0.832321f, 0.833170f, 0.834018f, 0.834863f, 0.835706f, 0.836548f, 0.837387f,
- 0.838225f, 0.839060f, 0.839894f, 0.840725f, 0.841555f, 0.842383f, 0.843208f, 0.844032f,
- 0.844854f, 0.845673f, 0.846491f, 0.847307f, 0.848120f, 0.848932f, 0.849742f, 0.850549f,
- 0.851355f, 0.852159f, 0.852961f, 0.853760f, 0.854558f, 0.855354f, 0.856147f, 0.856939f,
- 0.857729f, 0.858516f, 0.859302f, 0.860085f, 0.860867f, 0.861646f, 0.862424f, 0.863199f,
- 0.863973f, 0.864744f, 0.865514f, 0.866281f, 0.867046f, 0.867809f, 0.868571f, 0.869330f,
- 0.870087f, 0.870842f, 0.871595f, 0.872346f, 0.873095f, 0.873842f, 0.874587f, 0.875329f,
- 0.876070f, 0.876809f, 0.877545f, 0.878280f, 0.879012f, 0.879743f, 0.880471f, 0.881197f,
- 0.881921f, 0.882643f, 0.883363f, 0.884081f, 0.884797f, 0.885511f, 0.886223f, 0.886932f,
- 0.887640f, 0.888345f, 0.889048f, 0.889750f, 0.890449f, 0.891146f, 0.891841f, 0.892534f,
- 0.893224f, 0.893913f, 0.894599f, 0.895284f, 0.895966f, 0.896646f, 0.897325f, 0.898001f,
- 0.898674f, 0.899346f, 0.900016f, 0.900683f, 0.901349f, 0.902012f, 0.902673f, 0.903332f,
- 0.903989f, 0.904644f, 0.905297f, 0.905947f, 0.906596f, 0.907242f, 0.907886f, 0.908528f,
- 0.909168f, 0.909806f, 0.910441f, 0.911075f, 0.911706f, 0.912335f, 0.912962f, 0.913587f,
- 0.914210f, 0.914830f, 0.915449f, 0.916065f, 0.916679f, 0.917291f, 0.917901f, 0.918508f,
- 0.919114f, 0.919717f, 0.920318f, 0.920917f, 0.921514f, 0.922109f, 0.922701f, 0.923291f,
- 0.923880f, 0.924465f, 0.925049f, 0.925631f, 0.926210f, 0.926787f, 0.927363f, 0.927935f,
- 0.928506f, 0.929075f, 0.929641f, 0.930205f, 0.930767f, 0.931327f, 0.931884f, 0.932440f,
- 0.932993f, 0.933544f, 0.934093f, 0.934639f, 0.935184f, 0.935726f, 0.936266f, 0.936803f,
- 0.937339f, 0.937872f, 0.938404f, 0.938932f, 0.939459f, 0.939984f, 0.940506f, 0.941026f,
- 0.941544f, 0.942060f, 0.942573f, 0.943084f, 0.943593f, 0.944100f, 0.944605f, 0.945107f,
- 0.945607f, 0.946105f, 0.946601f, 0.947094f, 0.947586f, 0.948075f, 0.948561f, 0.949046f,
- 0.949528f, 0.950008f, 0.950486f, 0.950962f, 0.951435f, 0.951906f, 0.952375f, 0.952842f,
- 0.953306f, 0.953768f, 0.954228f, 0.954686f, 0.955141f, 0.955594f, 0.956045f, 0.956494f,
- 0.956940f, 0.957385f, 0.957826f, 0.958266f, 0.958703f, 0.959139f, 0.959572f, 0.960002f,
- 0.960431f, 0.960857f, 0.961280f, 0.961702f, 0.962121f, 0.962538f, 0.962953f, 0.963366f,
- 0.963776f, 0.964184f, 0.964590f, 0.964993f, 0.965394f, 0.965793f, 0.966190f, 0.966584f,
- 0.966976f, 0.967366f, 0.967754f, 0.968139f, 0.968522f, 0.968903f, 0.969281f, 0.969657f,
- 0.970031f, 0.970403f, 0.970772f, 0.971139f, 0.971504f, 0.971866f, 0.972227f, 0.972584f,
- 0.972940f, 0.973293f, 0.973644f, 0.973993f, 0.974339f, 0.974684f, 0.975025f, 0.975365f,
- 0.975702f, 0.976037f, 0.976370f, 0.976700f, 0.977028f, 0.977354f, 0.977677f, 0.977998f,
- 0.978317f, 0.978634f, 0.978948f, 0.979260f, 0.979570f, 0.979877f, 0.980182f, 0.980485f,
- 0.980785f, 0.981083f, 0.981379f, 0.981673f, 0.981964f, 0.982253f, 0.982539f, 0.982824f,
- 0.983105f, 0.983385f, 0.983662f, 0.983937f, 0.984210f, 0.984480f, 0.984748f, 0.985014f,
- 0.985278f, 0.985539f, 0.985798f, 0.986054f, 0.986308f, 0.986560f, 0.986809f, 0.987057f,
- 0.987301f, 0.987544f, 0.987784f, 0.988022f, 0.988258f, 0.988491f, 0.988722f, 0.988950f,
- 0.989177f, 0.989400f, 0.989622f, 0.989841f, 0.990058f, 0.990273f, 0.990485f, 0.990695f,
- 0.990903f, 0.991108f, 0.991311f, 0.991511f, 0.991710f, 0.991906f, 0.992099f, 0.992291f,
- 0.992480f, 0.992666f, 0.992850f, 0.993032f, 0.993212f, 0.993389f, 0.993564f, 0.993737f,
- 0.993907f, 0.994075f, 0.994240f, 0.994404f, 0.994565f, 0.994723f, 0.994879f, 0.995033f,
- 0.995185f, 0.995334f, 0.995481f, 0.995625f, 0.995767f, 0.995907f, 0.996045f, 0.996180f,
- 0.996313f, 0.996443f, 0.996571f, 0.996697f, 0.996820f, 0.996941f, 0.997060f, 0.997176f,
- 0.997290f, 0.997402f, 0.997511f, 0.997618f, 0.997723f, 0.997825f, 0.997925f, 0.998023f,
- 0.998118f, 0.998211f, 0.998302f, 0.998390f, 0.998476f, 0.998559f, 0.998640f, 0.998719f,
- 0.998795f, 0.998870f, 0.998941f, 0.999011f, 0.999078f, 0.999142f, 0.999205f, 0.999265f,
- 0.999322f, 0.999378f, 0.999431f, 0.999481f, 0.999529f, 0.999575f, 0.999619f, 0.999660f,
- 0.999699f, 0.999735f, 0.999769f, 0.999801f, 0.999831f, 0.999858f, 0.999882f, 0.999905f,
- 0.999925f, 0.999942f, 0.999958f, 0.999971f, 0.999981f, 0.999989f, 0.999995f, 0.999999f,
- 0.000000f, -0.001534f, -0.003068f, -0.004602f, -0.006136f, -0.007670f, -0.009204f, -0.010738f,
- -0.012272f, -0.013805f, -0.015339f, -0.016873f, -0.018407f, -0.019940f, -0.021474f, -0.023008f,
- -0.024541f, -0.026075f, -0.027608f, -0.029142f, -0.030675f, -0.032208f, -0.033741f, -0.035274f,
- -0.036807f, -0.038340f, -0.039873f, -0.041406f, -0.042938f, -0.044471f, -0.046003f, -0.047535f,
- -0.049068f, -0.050600f, -0.052132f, -0.053664f, -0.055195f, -0.056727f, -0.058258f, -0.059790f,
- -0.061321f, -0.062852f, -0.064383f, -0.065913f, -0.067444f, -0.068974f, -0.070505f, -0.072035f,
- -0.073565f, -0.075094f, -0.076624f, -0.078153f, -0.079682f, -0.081211f, -0.082740f, -0.084269f,
- -0.085797f, -0.087326f, -0.088854f, -0.090381f, -0.091909f, -0.093436f, -0.094963f, -0.096490f,
- -0.098017f, -0.099544f, -0.101070f, -0.102596f, -0.104122f, -0.105647f, -0.107172f, -0.108697f,
- -0.110222f, -0.111747f, -0.113271f, -0.114795f, -0.116319f, -0.117842f, -0.119365f, -0.120888f,
- -0.122411f, -0.123933f, -0.125455f, -0.126977f, -0.128498f, -0.130019f, -0.131540f, -0.133061f,
- -0.134581f, -0.136101f, -0.137620f, -0.139139f, -0.140658f, -0.142177f, -0.143695f, -0.145213f,
- -0.146730f, -0.148248f, -0.149765f, -0.151281f, -0.152797f, -0.154313f, -0.155828f, -0.157343f,
- -0.158858f, -0.160372f, -0.161886f, -0.163400f, -0.164913f, -0.166426f, -0.167938f, -0.169450f,
- -0.170962f, -0.172473f, -0.173984f, -0.175494f, -0.177004f, -0.178514f, -0.180023f, -0.181532f,
- -0.183040f, -0.184548f, -0.186055f, -0.187562f, -0.189069f, -0.190575f, -0.192080f, -0.193586f,
- -0.195090f, -0.196595f, -0.198098f, -0.199602f, -0.201105f, -0.202607f, -0.204109f, -0.205610f,
- -0.207111f, -0.208612f, -0.210112f, -0.211611f, -0.213110f, -0.214609f, -0.216107f, -0.217604f,
- -0.219101f, -0.220598f, -0.222094f, -0.223589f, -0.225084f, -0.226578f, -0.228072f, -0.229565f,
- -0.231058f, -0.232550f, -0.234042f, -0.235533f, -0.237024f, -0.238514f, -0.240003f, -0.241492f,
- -0.242980f, -0.244468f, -0.245955f, -0.247442f, -0.248928f, -0.250413f, -0.251898f, -0.253382f,
- -0.254866f, -0.256349f, -0.257831f, -0.259313f, -0.260794f, -0.262275f, -0.263755f, -0.265234f,
- -0.266713f, -0.268191f, -0.269668f, -0.271145f, -0.272621f, -0.274097f, -0.275572f, -0.277046f,
- -0.278520f, -0.279993f, -0.281465f, -0.282937f, -0.284408f, -0.285878f, -0.287347f, -0.288816f,
- -0.290285f, -0.291752f, -0.293219f, -0.294685f, -0.296151f, -0.297616f, -0.299080f, -0.300543f,
- -0.302006f, -0.303468f, -0.304929f, -0.306390f, -0.307850f, -0.309309f, -0.310767f, -0.312225f,
- -0.313682f, -0.315138f, -0.316593f, -0.318048f, -0.319502f, -0.320955f, -0.322408f, -0.323859f,
- -0.325310f, -0.326760f, -0.328210f, -0.329658f, -0.331106f, -0.332553f, -0.334000f, -0.335445f,
- -0.336890f, -0.338334f, -0.339777f, -0.341219f, -0.342661f, -0.344101f, -0.345541f, -0.346980f,
- -0.348419f, -0.349856f, -0.351293f, -0.352729f, -0.354164f, -0.355598f, -0.357031f, -0.358463f,
- -0.359895f, -0.361326f, -0.362756f, -0.364185f, -0.365613f, -0.367040f, -0.368467f, -0.369892f,
- -0.371317f, -0.372741f, -0.374164f, -0.375586f, -0.377007f, -0.378428f, -0.379847f, -0.381266f,
- -0.382683f, -0.384100f, -0.385516f, -0.386931f, -0.388345f, -0.389758f, -0.391170f, -0.392582f,
- -0.393992f, -0.395401f, -0.396810f, -0.398218f, -0.399624f, -0.401030f, -0.402435f, -0.403838f,
- -0.405241f, -0.406643f, -0.408044f, -0.409444f, -0.410843f, -0.412241f, -0.413638f, -0.415034f,
- -0.416430f, -0.417824f, -0.419217f, -0.420609f, -0.422000f, -0.423390f, -0.424780f, -0.426168f,
- -0.427555f, -0.428941f, -0.430326f, -0.431711f, -0.433094f, -0.434476f, -0.435857f, -0.437237f,
- -0.438616f, -0.439994f, -0.441371f, -0.442747f, -0.444122f, -0.445496f, -0.446869f, -0.448241f,
- -0.449611f, -0.450981f, -0.452350f, -0.453717f, -0.455084f, -0.456449f, -0.457813f, -0.459177f,
- -0.460539f, -0.461900f, -0.463260f, -0.464619f, -0.465977f, -0.467333f, -0.468689f, -0.470043f,
- -0.471397f, -0.472749f, -0.474100f, -0.475450f, -0.476799f, -0.478147f, -0.479494f, -0.480839f,
- -0.482184f, -0.483527f, -0.484869f, -0.486210f, -0.487550f, -0.488889f, -0.490226f, -0.491563f,
- -0.492898f, -0.494232f, -0.495565f, -0.496897f, -0.498228f, -0.499557f, -0.500885f, -0.502212f,
- -0.503538f, -0.504863f, -0.506187f, -0.507509f, -0.508830f, -0.510150f, -0.511469f, -0.512786f,
- -0.514103f, -0.515418f, -0.516732f, -0.518045f, -0.519356f, -0.520666f, -0.521975f, -0.523283f,
- -0.524590f, -0.525895f, -0.527199f, -0.528502f, -0.529804f, -0.531104f, -0.532403f, -0.533701f,
- -0.534998f, -0.536293f, -0.537587f, -0.538880f, -0.540171f, -0.541462f, -0.542751f, -0.544039f,
- -0.545325f, -0.546610f, -0.547894f, -0.549177f, -0.550458f, -0.551738f, -0.553017f, -0.554294f,
- -0.555570f, -0.556845f, -0.558119f, -0.559391f, -0.560662f, -0.561931f, -0.563199f, -0.564466f,
- -0.565732f, -0.566996f, -0.568259f, -0.569521f, -0.570781f, -0.572040f, -0.573297f, -0.574553f,
- -0.575808f, -0.577062f, -0.578314f, -0.579565f, -0.580814f, -0.582062f, -0.583309f, -0.584554f,
- -0.585798f, -0.587040f, -0.588282f, -0.589521f, -0.590760f, -0.591997f, -0.593232f, -0.594467f,
- -0.595699f, -0.596931f, -0.598161f, -0.599389f, -0.600616f, -0.601842f, -0.603067f, -0.604290f,
- -0.605511f, -0.606731f, -0.607950f, -0.609167f, -0.610383f, -0.611597f, -0.612810f, -0.614022f,
- -0.615232f, -0.616440f, -0.617647f, -0.618853f, -0.620057f, -0.621260f, -0.622461f, -0.623661f,
- -0.624860f, -0.626056f, -0.627252f, -0.628446f, -0.629638f, -0.630829f, -0.632019f, -0.633207f,
- -0.634393f, -0.635578f, -0.636762f, -0.637944f, -0.639124f, -0.640303f, -0.641481f, -0.642657f,
- -0.643832f, -0.645005f, -0.646176f, -0.647346f, -0.648514f, -0.649681f, -0.650847f, -0.652011f,
- -0.653173f, -0.654334f, -0.655493f, -0.656651f, -0.657807f, -0.658961f, -0.660114f, -0.661266f,
- -0.662416f, -0.663564f, -0.664711f, -0.665856f, -0.667000f, -0.668142f, -0.669283f, -0.670422f,
- -0.671559f, -0.672695f, -0.673829f, -0.674962f, -0.676093f, -0.677222f, -0.678350f, -0.679476f,
- -0.680601f, -0.681724f, -0.682846f, -0.683965f, -0.685084f, -0.686200f, -0.687315f, -0.688429f,
- -0.689541f, -0.690651f, -0.691759f, -0.692866f, -0.693971f, -0.695075f, -0.696177f, -0.697277f,
- -0.698376f, -0.699473f, -0.700569f, -0.701663f, -0.702755f, -0.703845f, -0.704934f, -0.706021f,
- -0.707107f, -0.708191f, -0.709273f, -0.710353f, -0.711432f, -0.712509f, -0.713585f, -0.714659f,
- -0.715731f, -0.716801f, -0.717870f, -0.718937f, -0.720003f, -0.721066f, -0.722128f, -0.723188f,
- -0.724247f, -0.725304f, -0.726359f, -0.727413f, -0.728464f, -0.729514f, -0.730563f, -0.731609f,
- -0.732654f, -0.733697f, -0.734739f, -0.735779f, -0.736817f, -0.737853f, -0.738887f, -0.739920f,
- -0.740951f, -0.741980f, -0.743008f, -0.744034f, -0.745058f, -0.746080f, -0.747101f, -0.748119f,
- -0.749136f, -0.750152f, -0.751165f, -0.752177f, -0.753187f, -0.754195f, -0.755201f, -0.756206f,
- -0.757209f, -0.758210f, -0.759209f, -0.760207f, -0.761202f, -0.762196f, -0.763188f, -0.764179f,
- -0.765167f, -0.766154f, -0.767139f, -0.768122f, -0.769103f, -0.770083f, -0.771061f, -0.772036f,
- -0.773010f, -0.773983f, -0.774953f, -0.775922f, -0.776888f, -0.777853f, -0.778817f, -0.779778f,
- -0.780737f, -0.781695f, -0.782651f, -0.783605f, -0.784557f, -0.785507f, -0.786455f, -0.787402f,
- -0.788346f, -0.789289f, -0.790230f, -0.791169f, -0.792107f, -0.793042f, -0.793975f, -0.794907f,
- -0.795837f, -0.796765f, -0.797691f, -0.798615f, -0.799537f, -0.800458f, -0.801376f, -0.802293f,
- -0.803208f, -0.804120f, -0.805031f, -0.805940f, -0.806848f, -0.807753f, -0.808656f, -0.809558f,
- -0.810457f, -0.811355f, -0.812251f, -0.813144f, -0.814036f, -0.814926f, -0.815814f, -0.816701f,
- -0.817585f, -0.818467f, -0.819348f, -0.820226f, -0.821102f, -0.821977f, -0.822850f, -0.823721f,
- -0.824589f, -0.825456f, -0.826321f, -0.827184f, -0.828045f, -0.828904f, -0.829761f, -0.830616f,
- -0.831470f, -0.832321f, -0.833170f, -0.834018f, -0.834863f, -0.835706f, -0.836548f, -0.837387f,
- -0.838225f, -0.839060f, -0.839894f, -0.840725f, -0.841555f, -0.842383f, -0.843208f, -0.844032f,
- -0.844854f, -0.845673f, -0.846491f, -0.847307f, -0.848120f, -0.848932f, -0.849742f, -0.850549f,
- -0.851355f, -0.852159f, -0.852961f, -0.853760f, -0.854558f, -0.855354f, -0.856147f, -0.856939f,
- -0.857729f, -0.858516f, -0.859302f, -0.860085f, -0.860867f, -0.861646f, -0.862424f, -0.863199f,
- -0.863973f, -0.864744f, -0.865514f, -0.866281f, -0.867046f, -0.867809f, -0.868571f, -0.869330f,
- -0.870087f, -0.870842f, -0.871595f, -0.872346f, -0.873095f, -0.873842f, -0.874587f, -0.875329f,
- -0.876070f, -0.876809f, -0.877545f, -0.878280f, -0.879012f, -0.879743f, -0.880471f, -0.881197f,
- -0.881921f, -0.882643f, -0.883363f, -0.884081f, -0.884797f, -0.885511f, -0.886223f, -0.886932f,
- -0.887640f, -0.888345f, -0.889048f, -0.889750f, -0.890449f, -0.891146f, -0.891841f, -0.892534f,
- -0.893224f, -0.893913f, -0.894599f, -0.895284f, -0.895966f, -0.896646f, -0.897325f, -0.898001f,
- -0.898674f, -0.899346f, -0.900016f, -0.900683f, -0.901349f, -0.902012f, -0.902673f, -0.903332f,
- -0.903989f, -0.904644f, -0.905297f, -0.905947f, -0.906596f, -0.907242f, -0.907886f, -0.908528f,
- -0.909168f, -0.909806f, -0.910441f, -0.911075f, -0.911706f, -0.912335f, -0.912962f, -0.913587f,
- -0.914210f, -0.914830f, -0.915449f, -0.916065f, -0.916679f, -0.917291f, -0.917901f, -0.918508f,
- -0.919114f, -0.919717f, -0.920318f, -0.920917f, -0.921514f, -0.922109f, -0.922701f, -0.923291f,
- -0.923880f, -0.924465f, -0.925049f, -0.925631f, -0.926210f, -0.926787f, -0.927363f, -0.927935f,
- -0.928506f, -0.929075f, -0.929641f, -0.930205f, -0.930767f, -0.931327f, -0.931884f, -0.932440f,
- -0.932993f, -0.933544f, -0.934093f, -0.934639f, -0.935184f, -0.935726f, -0.936266f, -0.936803f,
- -0.937339f, -0.937872f, -0.938404f, -0.938932f, -0.939459f, -0.939984f, -0.940506f, -0.941026f,
- -0.941544f, -0.942060f, -0.942573f, -0.943084f, -0.943593f, -0.944100f, -0.944605f, -0.945107f,
- -0.945607f, -0.946105f, -0.946601f, -0.947094f, -0.947586f, -0.948075f, -0.948561f, -0.949046f,
- -0.949528f, -0.950008f, -0.950486f, -0.950962f, -0.951435f, -0.951906f, -0.952375f, -0.952842f,
- -0.953306f, -0.953768f, -0.954228f, -0.954686f, -0.955141f, -0.955594f, -0.956045f, -0.956494f,
- -0.956940f, -0.957385f, -0.957826f, -0.958266f, -0.958703f, -0.959139f, -0.959572f, -0.960002f,
- -0.960431f, -0.960857f, -0.961280f, -0.961702f, -0.962121f, -0.962538f, -0.962953f, -0.963366f,
- -0.963776f, -0.964184f, -0.964590f, -0.964993f, -0.965394f, -0.965793f, -0.966190f, -0.966584f,
- -0.966976f, -0.967366f, -0.967754f, -0.968139f, -0.968522f, -0.968903f, -0.969281f, -0.969657f,
- -0.970031f, -0.970403f, -0.970772f, -0.971139f, -0.971504f, -0.971866f, -0.972227f, -0.972584f,
- -0.972940f, -0.973293f, -0.973644f, -0.973993f, -0.974339f, -0.974684f, -0.975025f, -0.975365f,
- -0.975702f, -0.976037f, -0.976370f, -0.976700f, -0.977028f, -0.977354f, -0.977677f, -0.977998f,
- -0.978317f, -0.978634f, -0.978948f, -0.979260f, -0.979570f, -0.979877f, -0.980182f, -0.980485f,
- -0.980785f, -0.981083f, -0.981379f, -0.981673f, -0.981964f, -0.982253f, -0.982539f, -0.982824f,
- -0.983105f, -0.983385f, -0.983662f, -0.983937f, -0.984210f, -0.984480f, -0.984748f, -0.985014f,
- -0.985278f, -0.985539f, -0.985798f, -0.986054f, -0.986308f, -0.986560f, -0.986809f, -0.987057f,
- -0.987301f, -0.987544f, -0.987784f, -0.988022f, -0.988258f, -0.988491f, -0.988722f, -0.988950f,
- -0.989177f, -0.989400f, -0.989622f, -0.989841f, -0.990058f, -0.990273f, -0.990485f, -0.990695f,
- -0.990903f, -0.991108f, -0.991311f, -0.991511f, -0.991710f, -0.991906f, -0.992099f, -0.992291f,
- -0.992480f, -0.992666f, -0.992850f, -0.993032f, -0.993212f, -0.993389f, -0.993564f, -0.993737f,
- -0.993907f, -0.994075f, -0.994240f, -0.994404f, -0.994565f, -0.994723f, -0.994879f, -0.995033f,
- -0.995185f, -0.995334f, -0.995481f, -0.995625f, -0.995767f, -0.995907f, -0.996045f, -0.996180f,
- -0.996313f, -0.996443f, -0.996571f, -0.996697f, -0.996820f, -0.996941f, -0.997060f, -0.997176f,
- -0.997290f, -0.997402f, -0.997511f, -0.997618f, -0.997723f, -0.997825f, -0.997925f, -0.998023f,
- -0.998118f, -0.998211f, -0.998302f, -0.998390f, -0.998476f, -0.998559f, -0.998640f, -0.998719f,
- -0.998795f, -0.998870f, -0.998941f, -0.999011f, -0.999078f, -0.999142f, -0.999205f, -0.999265f,
- -0.999322f, -0.999378f, -0.999431f, -0.999481f, -0.999529f, -0.999575f, -0.999619f, -0.999660f,
- -0.999699f, -0.999735f, -0.999769f, -0.999801f, -0.999831f, -0.999858f, -0.999882f, -0.999905f,
- -0.999925f, -0.999942f, -0.999958f, -0.999971f, -0.999981f, -0.999989f, -0.999995f, -0.999999f
-};
-
-static const float sinTable8192[4096] = {
- 0.000000f, 0.000767f, 0.001534f, 0.002301f, 0.003068f, 0.003835f, 0.004602f, 0.005369f,
- 0.006136f, 0.006903f, 0.007670f, 0.008437f, 0.009204f, 0.009971f, 0.010738f, 0.011505f,
- 0.012272f, 0.013038f, 0.013805f, 0.014572f, 0.015339f, 0.016106f, 0.016873f, 0.017640f,
- 0.018407f, 0.019174f, 0.019940f, 0.020707f, 0.021474f, 0.022241f, 0.023008f, 0.023774f,
- 0.024541f, 0.025308f, 0.026075f, 0.026841f, 0.027608f, 0.028375f, 0.029142f, 0.029908f,
- 0.030675f, 0.031441f, 0.032208f, 0.032975f, 0.033741f, 0.034508f, 0.035274f, 0.036041f,
- 0.036807f, 0.037574f, 0.038340f, 0.039107f, 0.039873f, 0.040639f, 0.041406f, 0.042172f,
- 0.042938f, 0.043705f, 0.044471f, 0.045237f, 0.046003f, 0.046769f, 0.047535f, 0.048302f,
- 0.049068f, 0.049834f, 0.050600f, 0.051366f, 0.052132f, 0.052898f, 0.053664f, 0.054429f,
- 0.055195f, 0.055961f, 0.056727f, 0.057493f, 0.058258f, 0.059024f, 0.059790f, 0.060555f,
- 0.061321f, 0.062086f, 0.062852f, 0.063617f, 0.064383f, 0.065148f, 0.065913f, 0.066679f,
- 0.067444f, 0.068209f, 0.068974f, 0.069739f, 0.070505f, 0.071270f, 0.072035f, 0.072800f,
- 0.073565f, 0.074329f, 0.075094f, 0.075859f, 0.076624f, 0.077389f, 0.078153f, 0.078918f,
- 0.079682f, 0.080447f, 0.081211f, 0.081976f, 0.082740f, 0.083505f, 0.084269f, 0.085033f,
- 0.085797f, 0.086561f, 0.087326f, 0.088090f, 0.088854f, 0.089617f, 0.090381f, 0.091145f,
- 0.091909f, 0.092673f, 0.093436f, 0.094200f, 0.094963f, 0.095727f, 0.096490f, 0.097254f,
- 0.098017f, 0.098780f, 0.099544f, 0.100307f, 0.101070f, 0.101833f, 0.102596f, 0.103359f,
- 0.104122f, 0.104884f, 0.105647f, 0.106410f, 0.107172f, 0.107935f, 0.108697f, 0.109460f,
- 0.110222f, 0.110984f, 0.111747f, 0.112509f, 0.113271f, 0.114033f, 0.114795f, 0.115557f,
- 0.116319f, 0.117080f, 0.117842f, 0.118604f, 0.119365f, 0.120127f, 0.120888f, 0.121649f,
- 0.122411f, 0.123172f, 0.123933f, 0.124694f, 0.125455f, 0.126216f, 0.126977f, 0.127737f,
- 0.128498f, 0.129259f, 0.130019f, 0.130780f, 0.131540f, 0.132300f, 0.133061f, 0.133821f,
- 0.134581f, 0.135341f, 0.136101f, 0.136860f, 0.137620f, 0.138380f, 0.139139f, 0.139899f,
- 0.140658f, 0.141418f, 0.142177f, 0.142936f, 0.143695f, 0.144454f, 0.145213f, 0.145972f,
- 0.146730f, 0.147489f, 0.148248f, 0.149006f, 0.149765f, 0.150523f, 0.151281f, 0.152039f,
- 0.152797f, 0.153555f, 0.154313f, 0.155071f, 0.155828f, 0.156586f, 0.157343f, 0.158101f,
- 0.158858f, 0.159615f, 0.160372f, 0.161129f, 0.161886f, 0.162643f, 0.163400f, 0.164157f,
- 0.164913f, 0.165670f, 0.166426f, 0.167182f, 0.167938f, 0.168694f, 0.169450f, 0.170206f,
- 0.170962f, 0.171718f, 0.172473f, 0.173229f, 0.173984f, 0.174739f, 0.175494f, 0.176249f,
- 0.177004f, 0.177759f, 0.178514f, 0.179268f, 0.180023f, 0.180777f, 0.181532f, 0.182286f,
- 0.183040f, 0.183794f, 0.184548f, 0.185301f, 0.186055f, 0.186809f, 0.187562f, 0.188315f,
- 0.189069f, 0.189822f, 0.190575f, 0.191328f, 0.192080f, 0.192833f, 0.193586f, 0.194338f,
- 0.195090f, 0.195843f, 0.196595f, 0.197347f, 0.198098f, 0.198850f, 0.199602f, 0.200353f,
- 0.201105f, 0.201856f, 0.202607f, 0.203358f, 0.204109f, 0.204860f, 0.205610f, 0.206361f,
- 0.207111f, 0.207862f, 0.208612f, 0.209362f, 0.210112f, 0.210862f, 0.211611f, 0.212361f,
- 0.213110f, 0.213860f, 0.214609f, 0.215358f, 0.216107f, 0.216856f, 0.217604f, 0.218353f,
- 0.219101f, 0.219850f, 0.220598f, 0.221346f, 0.222094f, 0.222841f, 0.223589f, 0.224337f,
- 0.225084f, 0.225831f, 0.226578f, 0.227325f, 0.228072f, 0.228819f, 0.229565f, 0.230312f,
- 0.231058f, 0.231804f, 0.232550f, 0.233296f, 0.234042f, 0.234788f, 0.235533f, 0.236278f,
- 0.237024f, 0.237769f, 0.238514f, 0.239258f, 0.240003f, 0.240748f, 0.241492f, 0.242236f,
- 0.242980f, 0.243724f, 0.244468f, 0.245212f, 0.245955f, 0.246698f, 0.247442f, 0.248185f,
- 0.248928f, 0.249670f, 0.250413f, 0.251155f, 0.251898f, 0.252640f, 0.253382f, 0.254124f,
- 0.254866f, 0.255607f, 0.256349f, 0.257090f, 0.257831f, 0.258572f, 0.259313f, 0.260054f,
- 0.260794f, 0.261534f, 0.262275f, 0.263015f, 0.263755f, 0.264494f, 0.265234f, 0.265973f,
- 0.266713f, 0.267452f, 0.268191f, 0.268930f, 0.269668f, 0.270407f, 0.271145f, 0.271883f,
- 0.272621f, 0.273359f, 0.274097f, 0.274834f, 0.275572f, 0.276309f, 0.277046f, 0.277783f,
- 0.278520f, 0.279256f, 0.279993f, 0.280729f, 0.281465f, 0.282201f, 0.282937f, 0.283672f,
- 0.284408f, 0.285143f, 0.285878f, 0.286613f, 0.287347f, 0.288082f, 0.288816f, 0.289551f,
- 0.290285f, 0.291019f, 0.291752f, 0.292486f, 0.293219f, 0.293952f, 0.294685f, 0.295418f,
- 0.296151f, 0.296883f, 0.297616f, 0.298348f, 0.299080f, 0.299812f, 0.300543f, 0.301275f,
- 0.302006f, 0.302737f, 0.303468f, 0.304199f, 0.304929f, 0.305660f, 0.306390f, 0.307120f,
- 0.307850f, 0.308579f, 0.309309f, 0.310038f, 0.310767f, 0.311496f, 0.312225f, 0.312953f,
- 0.313682f, 0.314410f, 0.315138f, 0.315866f, 0.316593f, 0.317321f, 0.318048f, 0.318775f,
- 0.319502f, 0.320229f, 0.320955f, 0.321682f, 0.322408f, 0.323134f, 0.323859f, 0.324585f,
- 0.325310f, 0.326035f, 0.326760f, 0.327485f, 0.328210f, 0.328934f, 0.329658f, 0.330382f,
- 0.331106f, 0.331830f, 0.332553f, 0.333277f, 0.334000f, 0.334722f, 0.335445f, 0.336168f,
- 0.336890f, 0.337612f, 0.338334f, 0.339055f, 0.339777f, 0.340498f, 0.341219f, 0.341940f,
- 0.342661f, 0.343381f, 0.344101f, 0.344821f, 0.345541f, 0.346261f, 0.346980f, 0.347700f,
- 0.348419f, 0.349138f, 0.349856f, 0.350575f, 0.351293f, 0.352011f, 0.352729f, 0.353446f,
- 0.354164f, 0.354881f, 0.355598f, 0.356314f, 0.357031f, 0.357747f, 0.358463f, 0.359179f,
- 0.359895f, 0.360611f, 0.361326f, 0.362041f, 0.362756f, 0.363470f, 0.364185f, 0.364899f,
- 0.365613f, 0.366327f, 0.367040f, 0.367754f, 0.368467f, 0.369180f, 0.369892f, 0.370605f,
- 0.371317f, 0.372029f, 0.372741f, 0.373453f, 0.374164f, 0.374875f, 0.375586f, 0.376297f,
- 0.377007f, 0.377718f, 0.378428f, 0.379138f, 0.379847f, 0.380557f, 0.381266f, 0.381975f,
- 0.382683f, 0.383392f, 0.384100f, 0.384808f, 0.385516f, 0.386224f, 0.386931f, 0.387638f,
- 0.388345f, 0.389052f, 0.389758f, 0.390464f, 0.391170f, 0.391876f, 0.392582f, 0.393287f,
- 0.393992f, 0.394697f, 0.395401f, 0.396106f, 0.396810f, 0.397514f, 0.398218f, 0.398921f,
- 0.399624f, 0.400327f, 0.401030f, 0.401732f, 0.402435f, 0.403137f, 0.403838f, 0.404540f,
- 0.405241f, 0.405942f, 0.406643f, 0.407344f, 0.408044f, 0.408744f, 0.409444f, 0.410144f,
- 0.410843f, 0.411542f, 0.412241f, 0.412940f, 0.413638f, 0.414337f, 0.415034f, 0.415732f,
- 0.416430f, 0.417127f, 0.417824f, 0.418520f, 0.419217f, 0.419913f, 0.420609f, 0.421305f,
- 0.422000f, 0.422695f, 0.423390f, 0.424085f, 0.424780f, 0.425474f, 0.426168f, 0.426862f,
- 0.427555f, 0.428248f, 0.428941f, 0.429634f, 0.430326f, 0.431019f, 0.431711f, 0.432402f,
- 0.433094f, 0.433785f, 0.434476f, 0.435167f, 0.435857f, 0.436547f, 0.437237f, 0.437927f,
- 0.438616f, 0.439305f, 0.439994f, 0.440683f, 0.441371f, 0.442059f, 0.442747f, 0.443435f,
- 0.444122f, 0.444809f, 0.445496f, 0.446183f, 0.446869f, 0.447555f, 0.448241f, 0.448926f,
- 0.449611f, 0.450296f, 0.450981f, 0.451665f, 0.452350f, 0.453033f, 0.453717f, 0.454400f,
- 0.455084f, 0.455766f, 0.456449f, 0.457131f, 0.457813f, 0.458495f, 0.459177f, 0.459858f,
- 0.460539f, 0.461219f, 0.461900f, 0.462580f, 0.463260f, 0.463939f, 0.464619f, 0.465298f,
- 0.465977f, 0.466655f, 0.467333f, 0.468011f, 0.468689f, 0.469366f, 0.470043f, 0.470720f,
- 0.471397f, 0.472073f, 0.472749f, 0.473425f, 0.474100f, 0.474775f, 0.475450f, 0.476125f,
- 0.476799f, 0.477473f, 0.478147f, 0.478821f, 0.479494f, 0.480167f, 0.480839f, 0.481512f,
- 0.482184f, 0.482856f, 0.483527f, 0.484198f, 0.484869f, 0.485540f, 0.486210f, 0.486880f,
- 0.487550f, 0.488220f, 0.488889f, 0.489558f, 0.490226f, 0.490895f, 0.491563f, 0.492231f,
- 0.492898f, 0.493565f, 0.494232f, 0.494899f, 0.495565f, 0.496231f, 0.496897f, 0.497562f,
- 0.498228f, 0.498893f, 0.499557f, 0.500221f, 0.500885f, 0.501549f, 0.502212f, 0.502876f,
- 0.503538f, 0.504201f, 0.504863f, 0.505525f, 0.506187f, 0.506848f, 0.507509f, 0.508170f,
- 0.508830f, 0.509490f, 0.510150f, 0.510810f, 0.511469f, 0.512128f, 0.512786f, 0.513445f,
- 0.514103f, 0.514760f, 0.515418f, 0.516075f, 0.516732f, 0.517388f, 0.518045f, 0.518700f,
- 0.519356f, 0.520011f, 0.520666f, 0.521321f, 0.521975f, 0.522629f, 0.523283f, 0.523937f,
- 0.524590f, 0.525243f, 0.525895f, 0.526547f, 0.527199f, 0.527851f, 0.528502f, 0.529153f,
- 0.529804f, 0.530454f, 0.531104f, 0.531754f, 0.532403f, 0.533052f, 0.533701f, 0.534349f,
- 0.534998f, 0.535645f, 0.536293f, 0.536940f, 0.537587f, 0.538234f, 0.538880f, 0.539526f,
- 0.540171f, 0.540817f, 0.541462f, 0.542106f, 0.542751f, 0.543395f, 0.544039f, 0.544682f,
- 0.545325f, 0.545968f, 0.546610f, 0.547252f, 0.547894f, 0.548536f, 0.549177f, 0.549818f,
- 0.550458f, 0.551098f, 0.551738f, 0.552378f, 0.553017f, 0.553656f, 0.554294f, 0.554932f,
- 0.555570f, 0.556208f, 0.556845f, 0.557482f, 0.558119f, 0.558755f, 0.559391f, 0.560026f,
- 0.560662f, 0.561297f, 0.561931f, 0.562565f, 0.563199f, 0.563833f, 0.564466f, 0.565099f,
- 0.565732f, 0.566364f, 0.566996f, 0.567628f, 0.568259f, 0.568890f, 0.569521f, 0.570151f,
- 0.570781f, 0.571410f, 0.572040f, 0.572669f, 0.573297f, 0.573925f, 0.574553f, 0.575181f,
- 0.575808f, 0.576435f, 0.577062f, 0.577688f, 0.578314f, 0.578939f, 0.579565f, 0.580189f,
- 0.580814f, 0.581438f, 0.582062f, 0.582685f, 0.583309f, 0.583931f, 0.584554f, 0.585176f,
- 0.585798f, 0.586419f, 0.587040f, 0.587661f, 0.588282f, 0.588902f, 0.589521f, 0.590141f,
- 0.590760f, 0.591378f, 0.591997f, 0.592615f, 0.593232f, 0.593850f, 0.594467f, 0.595083f,
- 0.595699f, 0.596315f, 0.596931f, 0.597546f, 0.598161f, 0.598775f, 0.599389f, 0.600003f,
- 0.600616f, 0.601230f, 0.601842f, 0.602455f, 0.603067f, 0.603678f, 0.604290f, 0.604900f,
- 0.605511f, 0.606121f, 0.606731f, 0.607341f, 0.607950f, 0.608559f, 0.609167f, 0.609775f,
- 0.610383f, 0.610990f, 0.611597f, 0.612204f, 0.612810f, 0.613416f, 0.614022f, 0.614627f,
- 0.615232f, 0.615836f, 0.616440f, 0.617044f, 0.617647f, 0.618250f, 0.618853f, 0.619455f,
- 0.620057f, 0.620659f, 0.621260f, 0.621861f, 0.622461f, 0.623061f, 0.623661f, 0.624260f,
- 0.624860f, 0.625458f, 0.626056f, 0.626654f, 0.627252f, 0.627849f, 0.628446f, 0.629042f,
- 0.629638f, 0.630234f, 0.630829f, 0.631424f, 0.632019f, 0.632613f, 0.633207f, 0.633800f,
- 0.634393f, 0.634986f, 0.635578f, 0.636170f, 0.636762f, 0.637353f, 0.637944f, 0.638534f,
- 0.639124f, 0.639714f, 0.640303f, 0.640892f, 0.641481f, 0.642069f, 0.642657f, 0.643245f,
- 0.643832f, 0.644418f, 0.645005f, 0.645590f, 0.646176f, 0.646761f, 0.647346f, 0.647930f,
- 0.648514f, 0.649098f, 0.649681f, 0.650264f, 0.650847f, 0.651429f, 0.652011f, 0.652592f,
- 0.653173f, 0.653753f, 0.654334f, 0.654913f, 0.655493f, 0.656072f, 0.656651f, 0.657229f,
- 0.657807f, 0.658384f, 0.658961f, 0.659538f, 0.660114f, 0.660690f, 0.661266f, 0.661841f,
- 0.662416f, 0.662990f, 0.663564f, 0.664138f, 0.664711f, 0.665284f, 0.665856f, 0.666428f,
- 0.667000f, 0.667571f, 0.668142f, 0.668712f, 0.669283f, 0.669852f, 0.670422f, 0.670990f,
- 0.671559f, 0.672127f, 0.672695f, 0.673262f, 0.673829f, 0.674396f, 0.674962f, 0.675527f,
- 0.676093f, 0.676658f, 0.677222f, 0.677786f, 0.678350f, 0.678913f, 0.679476f, 0.680039f,
- 0.680601f, 0.681163f, 0.681724f, 0.682285f, 0.682846f, 0.683406f, 0.683965f, 0.684525f,
- 0.685084f, 0.685642f, 0.686200f, 0.686758f, 0.687315f, 0.687872f, 0.688429f, 0.688985f,
- 0.689541f, 0.690096f, 0.690651f, 0.691205f, 0.691759f, 0.692313f, 0.692866f, 0.693419f,
- 0.693971f, 0.694524f, 0.695075f, 0.695626f, 0.696177f, 0.696728f, 0.697277f, 0.697827f,
- 0.698376f, 0.698925f, 0.699473f, 0.700021f, 0.700569f, 0.701116f, 0.701663f, 0.702209f,
- 0.702755f, 0.703300f, 0.703845f, 0.704390f, 0.704934f, 0.705478f, 0.706021f, 0.706564f,
- 0.707107f, 0.707649f, 0.708191f, 0.708732f, 0.709273f, 0.709813f, 0.710353f, 0.710893f,
- 0.711432f, 0.711971f, 0.712509f, 0.713047f, 0.713585f, 0.714122f, 0.714659f, 0.715195f,
- 0.715731f, 0.716266f, 0.716801f, 0.717336f, 0.717870f, 0.718404f, 0.718937f, 0.719470f,
- 0.720003f, 0.720535f, 0.721066f, 0.721597f, 0.722128f, 0.722659f, 0.723188f, 0.723718f,
- 0.724247f, 0.724776f, 0.725304f, 0.725832f, 0.726359f, 0.726886f, 0.727413f, 0.727939f,
- 0.728464f, 0.728990f, 0.729514f, 0.730039f, 0.730563f, 0.731086f, 0.731609f, 0.732132f,
- 0.732654f, 0.733176f, 0.733697f, 0.734218f, 0.734739f, 0.735259f, 0.735779f, 0.736298f,
- 0.736817f, 0.737335f, 0.737853f, 0.738370f, 0.738887f, 0.739404f, 0.739920f, 0.740436f,
- 0.740951f, 0.741466f, 0.741980f, 0.742494f, 0.743008f, 0.743521f, 0.744034f, 0.744546f,
- 0.745058f, 0.745569f, 0.746080f, 0.746591f, 0.747101f, 0.747610f, 0.748119f, 0.748628f,
- 0.749136f, 0.749644f, 0.750152f, 0.750659f, 0.751165f, 0.751671f, 0.752177f, 0.752682f,
- 0.753187f, 0.753691f, 0.754195f, 0.754698f, 0.755201f, 0.755704f, 0.756206f, 0.756708f,
- 0.757209f, 0.757710f, 0.758210f, 0.758710f, 0.759209f, 0.759708f, 0.760207f, 0.760705f,
- 0.761202f, 0.761700f, 0.762196f, 0.762693f, 0.763188f, 0.763684f, 0.764179f, 0.764673f,
- 0.765167f, 0.765661f, 0.766154f, 0.766647f, 0.767139f, 0.767631f, 0.768122f, 0.768613f,
- 0.769103f, 0.769593f, 0.770083f, 0.770572f, 0.771061f, 0.771549f, 0.772036f, 0.772524f,
- 0.773010f, 0.773497f, 0.773983f, 0.774468f, 0.774953f, 0.775438f, 0.775922f, 0.776405f,
- 0.776888f, 0.777371f, 0.777853f, 0.778335f, 0.778817f, 0.779297f, 0.779778f, 0.780258f,
- 0.780737f, 0.781216f, 0.781695f, 0.782173f, 0.782651f, 0.783128f, 0.783605f, 0.784081f,
- 0.784557f, 0.785032f, 0.785507f, 0.785981f, 0.786455f, 0.786929f, 0.787402f, 0.787874f,
- 0.788346f, 0.788818f, 0.789289f, 0.789760f, 0.790230f, 0.790700f, 0.791169f, 0.791638f,
- 0.792107f, 0.792575f, 0.793042f, 0.793509f, 0.793975f, 0.794442f, 0.794907f, 0.795372f,
- 0.795837f, 0.796301f, 0.796765f, 0.797228f, 0.797691f, 0.798153f, 0.798615f, 0.799076f,
- 0.799537f, 0.799998f, 0.800458f, 0.800917f, 0.801376f, 0.801835f, 0.802293f, 0.802750f,
- 0.803208f, 0.803664f, 0.804120f, 0.804576f, 0.805031f, 0.805486f, 0.805940f, 0.806394f,
- 0.806848f, 0.807300f, 0.807753f, 0.808205f, 0.808656f, 0.809107f, 0.809558f, 0.810008f,
- 0.810457f, 0.810906f, 0.811355f, 0.811803f, 0.812251f, 0.812698f, 0.813144f, 0.813591f,
- 0.814036f, 0.814482f, 0.814926f, 0.815371f, 0.815814f, 0.816258f, 0.816701f, 0.817143f,
- 0.817585f, 0.818026f, 0.818467f, 0.818908f, 0.819348f, 0.819787f, 0.820226f, 0.820664f,
- 0.821102f, 0.821540f, 0.821977f, 0.822414f, 0.822850f, 0.823285f, 0.823721f, 0.824155f,
- 0.824589f, 0.825023f, 0.825456f, 0.825889f, 0.826321f, 0.826753f, 0.827184f, 0.827615f,
- 0.828045f, 0.828475f, 0.828904f, 0.829333f, 0.829761f, 0.830189f, 0.830616f, 0.831043f,
- 0.831470f, 0.831895f, 0.832321f, 0.832746f, 0.833170f, 0.833594f, 0.834018f, 0.834440f,
- 0.834863f, 0.835285f, 0.835706f, 0.836127f, 0.836548f, 0.836968f, 0.837387f, 0.837806f,
- 0.838225f, 0.838643f, 0.839060f, 0.839477f, 0.839894f, 0.840310f, 0.840725f, 0.841140f,
- 0.841555f, 0.841969f, 0.842383f, 0.842796f, 0.843208f, 0.843620f, 0.844032f, 0.844443f,
- 0.844854f, 0.845264f, 0.845673f, 0.846082f, 0.846491f, 0.846899f, 0.847307f, 0.847714f,
- 0.848120f, 0.848526f, 0.848932f, 0.849337f, 0.849742f, 0.850146f, 0.850549f, 0.850953f,
- 0.851355f, 0.851757f, 0.852159f, 0.852560f, 0.852961f, 0.853361f, 0.853760f, 0.854159f,
- 0.854558f, 0.854956f, 0.855354f, 0.855751f, 0.856147f, 0.856543f, 0.856939f, 0.857334f,
- 0.857729f, 0.858123f, 0.858516f, 0.858909f, 0.859302f, 0.859694f, 0.860085f, 0.860476f,
- 0.860867f, 0.861257f, 0.861646f, 0.862035f, 0.862424f, 0.862812f, 0.863199f, 0.863586f,
- 0.863973f, 0.864359f, 0.864744f, 0.865129f, 0.865514f, 0.865898f, 0.866281f, 0.866664f,
- 0.867046f, 0.867428f, 0.867809f, 0.868190f, 0.868571f, 0.868951f, 0.869330f, 0.869709f,
- 0.870087f, 0.870465f, 0.870842f, 0.871219f, 0.871595f, 0.871971f, 0.872346f, 0.872721f,
- 0.873095f, 0.873469f, 0.873842f, 0.874215f, 0.874587f, 0.874958f, 0.875329f, 0.875700f,
- 0.876070f, 0.876440f, 0.876809f, 0.877177f, 0.877545f, 0.877913f, 0.878280f, 0.878646f,
- 0.879012f, 0.879378f, 0.879743f, 0.880107f, 0.880471f, 0.880834f, 0.881197f, 0.881559f,
- 0.881921f, 0.882283f, 0.882643f, 0.883004f, 0.883363f, 0.883723f, 0.884081f, 0.884439f,
- 0.884797f, 0.885154f, 0.885511f, 0.885867f, 0.886223f, 0.886578f, 0.886932f, 0.887286f,
- 0.887640f, 0.887993f, 0.888345f, 0.888697f, 0.889048f, 0.889399f, 0.889750f, 0.890099f,
- 0.890449f, 0.890797f, 0.891146f, 0.891493f, 0.891841f, 0.892187f, 0.892534f, 0.892879f,
- 0.893224f, 0.893569f, 0.893913f, 0.894256f, 0.894599f, 0.894942f, 0.895284f, 0.895625f,
- 0.895966f, 0.896307f, 0.896646f, 0.896986f, 0.897325f, 0.897663f, 0.898001f, 0.898338f,
- 0.898674f, 0.899011f, 0.899346f, 0.899681f, 0.900016f, 0.900350f, 0.900683f, 0.901016f,
- 0.901349f, 0.901681f, 0.902012f, 0.902343f, 0.902673f, 0.903003f, 0.903332f, 0.903661f,
- 0.903989f, 0.904317f, 0.904644f, 0.904971f, 0.905297f, 0.905622f, 0.905947f, 0.906272f,
- 0.906596f, 0.906919f, 0.907242f, 0.907564f, 0.907886f, 0.908207f, 0.908528f, 0.908848f,
- 0.909168f, 0.909487f, 0.909806f, 0.910124f, 0.910441f, 0.910758f, 0.911075f, 0.911391f,
- 0.911706f, 0.912021f, 0.912335f, 0.912649f, 0.912962f, 0.913275f, 0.913587f, 0.913899f,
- 0.914210f, 0.914520f, 0.914830f, 0.915140f, 0.915449f, 0.915757f, 0.916065f, 0.916372f,
- 0.916679f, 0.916985f, 0.917291f, 0.917596f, 0.917901f, 0.918205f, 0.918508f, 0.918811f,
- 0.919114f, 0.919416f, 0.919717f, 0.920018f, 0.920318f, 0.920618f, 0.920917f, 0.921216f,
- 0.921514f, 0.921812f, 0.922109f, 0.922405f, 0.922701f, 0.922997f, 0.923291f, 0.923586f,
- 0.923880f, 0.924173f, 0.924465f, 0.924758f, 0.925049f, 0.925340f, 0.925631f, 0.925921f,
- 0.926210f, 0.926499f, 0.926787f, 0.927075f, 0.927363f, 0.927649f, 0.927935f, 0.928221f,
- 0.928506f, 0.928791f, 0.929075f, 0.929358f, 0.929641f, 0.929923f, 0.930205f, 0.930486f,
- 0.930767f, 0.931047f, 0.931327f, 0.931606f, 0.931884f, 0.932162f, 0.932440f, 0.932716f,
- 0.932993f, 0.933269f, 0.933544f, 0.933818f, 0.934093f, 0.934366f, 0.934639f, 0.934912f,
- 0.935184f, 0.935455f, 0.935726f, 0.935996f, 0.936266f, 0.936535f, 0.936803f, 0.937072f,
- 0.937339f, 0.937606f, 0.937872f, 0.938138f, 0.938404f, 0.938668f, 0.938932f, 0.939196f,
- 0.939459f, 0.939722f, 0.939984f, 0.940245f, 0.940506f, 0.940766f, 0.941026f, 0.941285f,
- 0.941544f, 0.941802f, 0.942060f, 0.942317f, 0.942573f, 0.942829f, 0.943084f, 0.943339f,
- 0.943593f, 0.943847f, 0.944100f, 0.944353f, 0.944605f, 0.944856f, 0.945107f, 0.945358f,
- 0.945607f, 0.945857f, 0.946105f, 0.946353f, 0.946601f, 0.946848f, 0.947094f, 0.947340f,
- 0.947586f, 0.947830f, 0.948075f, 0.948318f, 0.948561f, 0.948804f, 0.949046f, 0.949287f,
- 0.949528f, 0.949768f, 0.950008f, 0.950247f, 0.950486f, 0.950724f, 0.950962f, 0.951199f,
- 0.951435f, 0.951671f, 0.951906f, 0.952141f, 0.952375f, 0.952609f, 0.952842f, 0.953074f,
- 0.953306f, 0.953537f, 0.953768f, 0.953998f, 0.954228f, 0.954457f, 0.954686f, 0.954914f,
- 0.955141f, 0.955368f, 0.955594f, 0.955820f, 0.956045f, 0.956270f, 0.956494f, 0.956717f,
- 0.956940f, 0.957163f, 0.957385f, 0.957606f, 0.957826f, 0.958046f, 0.958266f, 0.958485f,
- 0.958703f, 0.958921f, 0.959139f, 0.959355f, 0.959572f, 0.959787f, 0.960002f, 0.960217f,
- 0.960431f, 0.960644f, 0.960857f, 0.961069f, 0.961280f, 0.961492f, 0.961702f, 0.961912f,
- 0.962121f, 0.962330f, 0.962538f, 0.962746f, 0.962953f, 0.963160f, 0.963366f, 0.963571f,
- 0.963776f, 0.963980f, 0.964184f, 0.964387f, 0.964590f, 0.964792f, 0.964993f, 0.965194f,
- 0.965394f, 0.965594f, 0.965793f, 0.965992f, 0.966190f, 0.966387f, 0.966584f, 0.966781f,
- 0.966976f, 0.967172f, 0.967366f, 0.967560f, 0.967754f, 0.967947f, 0.968139f, 0.968331f,
- 0.968522f, 0.968713f, 0.968903f, 0.969092f, 0.969281f, 0.969470f, 0.969657f, 0.969845f,
- 0.970031f, 0.970217f, 0.970403f, 0.970588f, 0.970772f, 0.970956f, 0.971139f, 0.971322f,
- 0.971504f, 0.971685f, 0.971866f, 0.972047f, 0.972227f, 0.972406f, 0.972584f, 0.972762f,
- 0.972940f, 0.973117f, 0.973293f, 0.973469f, 0.973644f, 0.973819f, 0.973993f, 0.974166f,
- 0.974339f, 0.974512f, 0.974684f, 0.974855f, 0.975025f, 0.975195f, 0.975365f, 0.975534f,
- 0.975702f, 0.975870f, 0.976037f, 0.976204f, 0.976370f, 0.976535f, 0.976700f, 0.976864f,
- 0.977028f, 0.977191f, 0.977354f, 0.977516f, 0.977677f, 0.977838f, 0.977998f, 0.978158f,
- 0.978317f, 0.978476f, 0.978634f, 0.978791f, 0.978948f, 0.979104f, 0.979260f, 0.979415f,
- 0.979570f, 0.979724f, 0.979877f, 0.980030f, 0.980182f, 0.980334f, 0.980485f, 0.980635f,
- 0.980785f, 0.980935f, 0.981083f, 0.981232f, 0.981379f, 0.981526f, 0.981673f, 0.981819f,
- 0.981964f, 0.982109f, 0.982253f, 0.982396f, 0.982539f, 0.982682f, 0.982824f, 0.982965f,
- 0.983105f, 0.983246f, 0.983385f, 0.983524f, 0.983662f, 0.983800f, 0.983937f, 0.984074f,
- 0.984210f, 0.984346f, 0.984480f, 0.984615f, 0.984748f, 0.984882f, 0.985014f, 0.985146f,
- 0.985278f, 0.985408f, 0.985539f, 0.985668f, 0.985798f, 0.985926f, 0.986054f, 0.986181f,
- 0.986308f, 0.986434f, 0.986560f, 0.986685f, 0.986809f, 0.986933f, 0.987057f, 0.987179f,
- 0.987301f, 0.987423f, 0.987544f, 0.987664f, 0.987784f, 0.987903f, 0.988022f, 0.988140f,
- 0.988258f, 0.988374f, 0.988491f, 0.988607f, 0.988722f, 0.988836f, 0.988950f, 0.989064f,
- 0.989177f, 0.989289f, 0.989400f, 0.989511f, 0.989622f, 0.989732f, 0.989841f, 0.989950f,
- 0.990058f, 0.990166f, 0.990273f, 0.990379f, 0.990485f, 0.990590f, 0.990695f, 0.990799f,
- 0.990903f, 0.991006f, 0.991108f, 0.991210f, 0.991311f, 0.991411f, 0.991511f, 0.991611f,
- 0.991710f, 0.991808f, 0.991906f, 0.992003f, 0.992099f, 0.992195f, 0.992291f, 0.992385f,
- 0.992480f, 0.992573f, 0.992666f, 0.992759f, 0.992850f, 0.992942f, 0.993032f, 0.993122f,
- 0.993212f, 0.993301f, 0.993389f, 0.993477f, 0.993564f, 0.993651f, 0.993737f, 0.993822f,
- 0.993907f, 0.993991f, 0.994075f, 0.994158f, 0.994240f, 0.994322f, 0.994404f, 0.994484f,
- 0.994565f, 0.994644f, 0.994723f, 0.994802f, 0.994879f, 0.994957f, 0.995033f, 0.995109f,
- 0.995185f, 0.995260f, 0.995334f, 0.995408f, 0.995481f, 0.995553f, 0.995625f, 0.995697f,
- 0.995767f, 0.995838f, 0.995907f, 0.995976f, 0.996045f, 0.996113f, 0.996180f, 0.996247f,
- 0.996313f, 0.996378f, 0.996443f, 0.996507f, 0.996571f, 0.996634f, 0.996697f, 0.996759f,
- 0.996820f, 0.996881f, 0.996941f, 0.997001f, 0.997060f, 0.997119f, 0.997176f, 0.997234f,
- 0.997290f, 0.997347f, 0.997402f, 0.997457f, 0.997511f, 0.997565f, 0.997618f, 0.997671f,
- 0.997723f, 0.997774f, 0.997825f, 0.997876f, 0.997925f, 0.997974f, 0.998023f, 0.998071f,
- 0.998118f, 0.998165f, 0.998211f, 0.998257f, 0.998302f, 0.998346f, 0.998390f, 0.998433f,
- 0.998476f, 0.998518f, 0.998559f, 0.998600f, 0.998640f, 0.998680f, 0.998719f, 0.998758f,
- 0.998795f, 0.998833f, 0.998870f, 0.998906f, 0.998941f, 0.998976f, 0.999011f, 0.999044f,
- 0.999078f, 0.999110f, 0.999142f, 0.999174f, 0.999205f, 0.999235f, 0.999265f, 0.999294f,
- 0.999322f, 0.999350f, 0.999378f, 0.999404f, 0.999431f, 0.999456f, 0.999481f, 0.999506f,
- 0.999529f, 0.999553f, 0.999575f, 0.999597f, 0.999619f, 0.999640f, 0.999660f, 0.999680f,
- 0.999699f, 0.999717f, 0.999735f, 0.999753f, 0.999769f, 0.999786f, 0.999801f, 0.999816f,
- 0.999831f, 0.999844f, 0.999858f, 0.999870f, 0.999882f, 0.999894f, 0.999905f, 0.999915f,
- 0.999925f, 0.999934f, 0.999942f, 0.999950f, 0.999958f, 0.999964f, 0.999971f, 0.999976f,
- 0.999981f, 0.999986f, 0.999989f, 0.999993f, 0.999995f, 0.999997f, 0.999999f, 1.000000f,
- 0.000000f, -0.000767f, -0.001534f, -0.002301f, -0.003068f, -0.003835f, -0.004602f, -0.005369f,
- -0.006136f, -0.006903f, -0.007670f, -0.008437f, -0.009204f, -0.009971f, -0.010738f, -0.011505f,
- -0.012272f, -0.013038f, -0.013805f, -0.014572f, -0.015339f, -0.016106f, -0.016873f, -0.017640f,
- -0.018407f, -0.019174f, -0.019940f, -0.020707f, -0.021474f, -0.022241f, -0.023008f, -0.023774f,
- -0.024541f, -0.025308f, -0.026075f, -0.026841f, -0.027608f, -0.028375f, -0.029142f, -0.029908f,
- -0.030675f, -0.031441f, -0.032208f, -0.032975f, -0.033741f, -0.034508f, -0.035274f, -0.036041f,
- -0.036807f, -0.037574f, -0.038340f, -0.039107f, -0.039873f, -0.040639f, -0.041406f, -0.042172f,
- -0.042938f, -0.043705f, -0.044471f, -0.045237f, -0.046003f, -0.046769f, -0.047535f, -0.048302f,
- -0.049068f, -0.049834f, -0.050600f, -0.051366f, -0.052132f, -0.052898f, -0.053664f, -0.054429f,
- -0.055195f, -0.055961f, -0.056727f, -0.057493f, -0.058258f, -0.059024f, -0.059790f, -0.060555f,
- -0.061321f, -0.062086f, -0.062852f, -0.063617f, -0.064383f, -0.065148f, -0.065913f, -0.066679f,
- -0.067444f, -0.068209f, -0.068974f, -0.069739f, -0.070505f, -0.071270f, -0.072035f, -0.072800f,
- -0.073565f, -0.074329f, -0.075094f, -0.075859f, -0.076624f, -0.077389f, -0.078153f, -0.078918f,
- -0.079682f, -0.080447f, -0.081211f, -0.081976f, -0.082740f, -0.083505f, -0.084269f, -0.085033f,
- -0.085797f, -0.086561f, -0.087326f, -0.088090f, -0.088854f, -0.089617f, -0.090381f, -0.091145f,
- -0.091909f, -0.092673f, -0.093436f, -0.094200f, -0.094963f, -0.095727f, -0.096490f, -0.097254f,
- -0.098017f, -0.098780f, -0.099544f, -0.100307f, -0.101070f, -0.101833f, -0.102596f, -0.103359f,
- -0.104122f, -0.104884f, -0.105647f, -0.106410f, -0.107172f, -0.107935f, -0.108697f, -0.109460f,
- -0.110222f, -0.110984f, -0.111747f, -0.112509f, -0.113271f, -0.114033f, -0.114795f, -0.115557f,
- -0.116319f, -0.117080f, -0.117842f, -0.118604f, -0.119365f, -0.120127f, -0.120888f, -0.121649f,
- -0.122411f, -0.123172f, -0.123933f, -0.124694f, -0.125455f, -0.126216f, -0.126977f, -0.127737f,
- -0.128498f, -0.129259f, -0.130019f, -0.130780f, -0.131540f, -0.132300f, -0.133061f, -0.133821f,
- -0.134581f, -0.135341f, -0.136101f, -0.136860f, -0.137620f, -0.138380f, -0.139139f, -0.139899f,
- -0.140658f, -0.141418f, -0.142177f, -0.142936f, -0.143695f, -0.144454f, -0.145213f, -0.145972f,
- -0.146730f, -0.147489f, -0.148248f, -0.149006f, -0.149765f, -0.150523f, -0.151281f, -0.152039f,
- -0.152797f, -0.153555f, -0.154313f, -0.155071f, -0.155828f, -0.156586f, -0.157343f, -0.158101f,
- -0.158858f, -0.159615f, -0.160372f, -0.161129f, -0.161886f, -0.162643f, -0.163400f, -0.164157f,
- -0.164913f, -0.165670f, -0.166426f, -0.167182f, -0.167938f, -0.168694f, -0.169450f, -0.170206f,
- -0.170962f, -0.171718f, -0.172473f, -0.173229f, -0.173984f, -0.174739f, -0.175494f, -0.176249f,
- -0.177004f, -0.177759f, -0.178514f, -0.179268f, -0.180023f, -0.180777f, -0.181532f, -0.182286f,
- -0.183040f, -0.183794f, -0.184548f, -0.185301f, -0.186055f, -0.186809f, -0.187562f, -0.188315f,
- -0.189069f, -0.189822f, -0.190575f, -0.191328f, -0.192080f, -0.192833f, -0.193586f, -0.194338f,
- -0.195090f, -0.195843f, -0.196595f, -0.197347f, -0.198098f, -0.198850f, -0.199602f, -0.200353f,
- -0.201105f, -0.201856f, -0.202607f, -0.203358f, -0.204109f, -0.204860f, -0.205610f, -0.206361f,
- -0.207111f, -0.207862f, -0.208612f, -0.209362f, -0.210112f, -0.210862f, -0.211611f, -0.212361f,
- -0.213110f, -0.213860f, -0.214609f, -0.215358f, -0.216107f, -0.216856f, -0.217604f, -0.218353f,
- -0.219101f, -0.219850f, -0.220598f, -0.221346f, -0.222094f, -0.222841f, -0.223589f, -0.224337f,
- -0.225084f, -0.225831f, -0.226578f, -0.227325f, -0.228072f, -0.228819f, -0.229565f, -0.230312f,
- -0.231058f, -0.231804f, -0.232550f, -0.233296f, -0.234042f, -0.234788f, -0.235533f, -0.236278f,
- -0.237024f, -0.237769f, -0.238514f, -0.239258f, -0.240003f, -0.240748f, -0.241492f, -0.242236f,
- -0.242980f, -0.243724f, -0.244468f, -0.245212f, -0.245955f, -0.246698f, -0.247442f, -0.248185f,
- -0.248928f, -0.249670f, -0.250413f, -0.251155f, -0.251898f, -0.252640f, -0.253382f, -0.254124f,
- -0.254866f, -0.255607f, -0.256349f, -0.257090f, -0.257831f, -0.258572f, -0.259313f, -0.260054f,
- -0.260794f, -0.261534f, -0.262275f, -0.263015f, -0.263755f, -0.264494f, -0.265234f, -0.265973f,
- -0.266713f, -0.267452f, -0.268191f, -0.268930f, -0.269668f, -0.270407f, -0.271145f, -0.271883f,
- -0.272621f, -0.273359f, -0.274097f, -0.274834f, -0.275572f, -0.276309f, -0.277046f, -0.277783f,
- -0.278520f, -0.279256f, -0.279993f, -0.280729f, -0.281465f, -0.282201f, -0.282937f, -0.283672f,
- -0.284408f, -0.285143f, -0.285878f, -0.286613f, -0.287347f, -0.288082f, -0.288816f, -0.289551f,
- -0.290285f, -0.291019f, -0.291752f, -0.292486f, -0.293219f, -0.293952f, -0.294685f, -0.295418f,
- -0.296151f, -0.296883f, -0.297616f, -0.298348f, -0.299080f, -0.299812f, -0.300543f, -0.301275f,
- -0.302006f, -0.302737f, -0.303468f, -0.304199f, -0.304929f, -0.305660f, -0.306390f, -0.307120f,
- -0.307850f, -0.308579f, -0.309309f, -0.310038f, -0.310767f, -0.311496f, -0.312225f, -0.312953f,
- -0.313682f, -0.314410f, -0.315138f, -0.315866f, -0.316593f, -0.317321f, -0.318048f, -0.318775f,
- -0.319502f, -0.320229f, -0.320955f, -0.321682f, -0.322408f, -0.323134f, -0.323859f, -0.324585f,
- -0.325310f, -0.326035f, -0.326760f, -0.327485f, -0.328210f, -0.328934f, -0.329658f, -0.330382f,
- -0.331106f, -0.331830f, -0.332553f, -0.333277f, -0.334000f, -0.334722f, -0.335445f, -0.336168f,
- -0.336890f, -0.337612f, -0.338334f, -0.339055f, -0.339777f, -0.340498f, -0.341219f, -0.341940f,
- -0.342661f, -0.343381f, -0.344101f, -0.344821f, -0.345541f, -0.346261f, -0.346980f, -0.347700f,
- -0.348419f, -0.349138f, -0.349856f, -0.350575f, -0.351293f, -0.352011f, -0.352729f, -0.353446f,
- -0.354164f, -0.354881f, -0.355598f, -0.356314f, -0.357031f, -0.357747f, -0.358463f, -0.359179f,
- -0.359895f, -0.360611f, -0.361326f, -0.362041f, -0.362756f, -0.363470f, -0.364185f, -0.364899f,
- -0.365613f, -0.366327f, -0.367040f, -0.367754f, -0.368467f, -0.369180f, -0.369892f, -0.370605f,
- -0.371317f, -0.372029f, -0.372741f, -0.373453f, -0.374164f, -0.374875f, -0.375586f, -0.376297f,
- -0.377007f, -0.377718f, -0.378428f, -0.379138f, -0.379847f, -0.380557f, -0.381266f, -0.381975f,
- -0.382683f, -0.383392f, -0.384100f, -0.384808f, -0.385516f, -0.386224f, -0.386931f, -0.387638f,
- -0.388345f, -0.389052f, -0.389758f, -0.390464f, -0.391170f, -0.391876f, -0.392582f, -0.393287f,
- -0.393992f, -0.394697f, -0.395401f, -0.396106f, -0.396810f, -0.397514f, -0.398218f, -0.398921f,
- -0.399624f, -0.400327f, -0.401030f, -0.401732f, -0.402435f, -0.403137f, -0.403838f, -0.404540f,
- -0.405241f, -0.405942f, -0.406643f, -0.407344f, -0.408044f, -0.408744f, -0.409444f, -0.410144f,
- -0.410843f, -0.411542f, -0.412241f, -0.412940f, -0.413638f, -0.414337f, -0.415034f, -0.415732f,
- -0.416430f, -0.417127f, -0.417824f, -0.418520f, -0.419217f, -0.419913f, -0.420609f, -0.421305f,
- -0.422000f, -0.422695f, -0.423390f, -0.424085f, -0.424780f, -0.425474f, -0.426168f, -0.426862f,
- -0.427555f, -0.428248f, -0.428941f, -0.429634f, -0.430326f, -0.431019f, -0.431711f, -0.432402f,
- -0.433094f, -0.433785f, -0.434476f, -0.435167f, -0.435857f, -0.436547f, -0.437237f, -0.437927f,
- -0.438616f, -0.439305f, -0.439994f, -0.440683f, -0.441371f, -0.442059f, -0.442747f, -0.443435f,
- -0.444122f, -0.444809f, -0.445496f, -0.446183f, -0.446869f, -0.447555f, -0.448241f, -0.448926f,
- -0.449611f, -0.450296f, -0.450981f, -0.451665f, -0.452350f, -0.453033f, -0.453717f, -0.454400f,
- -0.455084f, -0.455766f, -0.456449f, -0.457131f, -0.457813f, -0.458495f, -0.459177f, -0.459858f,
- -0.460539f, -0.461219f, -0.461900f, -0.462580f, -0.463260f, -0.463939f, -0.464619f, -0.465298f,
- -0.465977f, -0.466655f, -0.467333f, -0.468011f, -0.468689f, -0.469366f, -0.470043f, -0.470720f,
- -0.471397f, -0.472073f, -0.472749f, -0.473425f, -0.474100f, -0.474775f, -0.475450f, -0.476125f,
- -0.476799f, -0.477473f, -0.478147f, -0.478821f, -0.479494f, -0.480167f, -0.480839f, -0.481512f,
- -0.482184f, -0.482856f, -0.483527f, -0.484198f, -0.484869f, -0.485540f, -0.486210f, -0.486880f,
- -0.487550f, -0.488220f, -0.488889f, -0.489558f, -0.490226f, -0.490895f, -0.491563f, -0.492231f,
- -0.492898f, -0.493565f, -0.494232f, -0.494899f, -0.495565f, -0.496231f, -0.496897f, -0.497562f,
- -0.498228f, -0.498893f, -0.499557f, -0.500221f, -0.500885f, -0.501549f, -0.502212f, -0.502876f,
- -0.503538f, -0.504201f, -0.504863f, -0.505525f, -0.506187f, -0.506848f, -0.507509f, -0.508170f,
- -0.508830f, -0.509490f, -0.510150f, -0.510810f, -0.511469f, -0.512128f, -0.512786f, -0.513445f,
- -0.514103f, -0.514760f, -0.515418f, -0.516075f, -0.516732f, -0.517388f, -0.518045f, -0.518700f,
- -0.519356f, -0.520011f, -0.520666f, -0.521321f, -0.521975f, -0.522629f, -0.523283f, -0.523937f,
- -0.524590f, -0.525243f, -0.525895f, -0.526547f, -0.527199f, -0.527851f, -0.528502f, -0.529153f,
- -0.529804f, -0.530454f, -0.531104f, -0.531754f, -0.532403f, -0.533052f, -0.533701f, -0.534349f,
- -0.534998f, -0.535645f, -0.536293f, -0.536940f, -0.537587f, -0.538234f, -0.538880f, -0.539526f,
- -0.540171f, -0.540817f, -0.541462f, -0.542106f, -0.542751f, -0.543395f, -0.544039f, -0.544682f,
- -0.545325f, -0.545968f, -0.546610f, -0.547252f, -0.547894f, -0.548536f, -0.549177f, -0.549818f,
- -0.550458f, -0.551098f, -0.551738f, -0.552378f, -0.553017f, -0.553656f, -0.554294f, -0.554932f,
- -0.555570f, -0.556208f, -0.556845f, -0.557482f, -0.558119f, -0.558755f, -0.559391f, -0.560026f,
- -0.560662f, -0.561297f, -0.561931f, -0.562565f, -0.563199f, -0.563833f, -0.564466f, -0.565099f,
- -0.565732f, -0.566364f, -0.566996f, -0.567628f, -0.568259f, -0.568890f, -0.569521f, -0.570151f,
- -0.570781f, -0.571410f, -0.572040f, -0.572669f, -0.573297f, -0.573925f, -0.574553f, -0.575181f,
- -0.575808f, -0.576435f, -0.577062f, -0.577688f, -0.578314f, -0.578939f, -0.579565f, -0.580189f,
- -0.580814f, -0.581438f, -0.582062f, -0.582685f, -0.583309f, -0.583931f, -0.584554f, -0.585176f,
- -0.585798f, -0.586419f, -0.587040f, -0.587661f, -0.588282f, -0.588902f, -0.589521f, -0.590141f,
- -0.590760f, -0.591378f, -0.591997f, -0.592615f, -0.593232f, -0.593850f, -0.594467f, -0.595083f,
- -0.595699f, -0.596315f, -0.596931f, -0.597546f, -0.598161f, -0.598775f, -0.599389f, -0.600003f,
- -0.600616f, -0.601230f, -0.601842f, -0.602455f, -0.603067f, -0.603678f, -0.604290f, -0.604900f,
- -0.605511f, -0.606121f, -0.606731f, -0.607341f, -0.607950f, -0.608559f, -0.609167f, -0.609775f,
- -0.610383f, -0.610990f, -0.611597f, -0.612204f, -0.612810f, -0.613416f, -0.614022f, -0.614627f,
- -0.615232f, -0.615836f, -0.616440f, -0.617044f, -0.617647f, -0.618250f, -0.618853f, -0.619455f,
- -0.620057f, -0.620659f, -0.621260f, -0.621861f, -0.622461f, -0.623061f, -0.623661f, -0.624260f,
- -0.624860f, -0.625458f, -0.626056f, -0.626654f, -0.627252f, -0.627849f, -0.628446f, -0.629042f,
- -0.629638f, -0.630234f, -0.630829f, -0.631424f, -0.632019f, -0.632613f, -0.633207f, -0.633800f,
- -0.634393f, -0.634986f, -0.635578f, -0.636170f, -0.636762f, -0.637353f, -0.637944f, -0.638534f,
- -0.639124f, -0.639714f, -0.640303f, -0.640892f, -0.641481f, -0.642069f, -0.642657f, -0.643245f,
- -0.643832f, -0.644418f, -0.645005f, -0.645590f, -0.646176f, -0.646761f, -0.647346f, -0.647930f,
- -0.648514f, -0.649098f, -0.649681f, -0.650264f, -0.650847f, -0.651429f, -0.652011f, -0.652592f,
- -0.653173f, -0.653753f, -0.654334f, -0.654913f, -0.655493f, -0.656072f, -0.656651f, -0.657229f,
- -0.657807f, -0.658384f, -0.658961f, -0.659538f, -0.660114f, -0.660690f, -0.661266f, -0.661841f,
- -0.662416f, -0.662990f, -0.663564f, -0.664138f, -0.664711f, -0.665284f, -0.665856f, -0.666428f,
- -0.667000f, -0.667571f, -0.668142f, -0.668712f, -0.669283f, -0.669852f, -0.670422f, -0.670990f,
- -0.671559f, -0.672127f, -0.672695f, -0.673262f, -0.673829f, -0.674396f, -0.674962f, -0.675527f,
- -0.676093f, -0.676658f, -0.677222f, -0.677786f, -0.678350f, -0.678913f, -0.679476f, -0.680039f,
- -0.680601f, -0.681163f, -0.681724f, -0.682285f, -0.682846f, -0.683406f, -0.683965f, -0.684525f,
- -0.685084f, -0.685642f, -0.686200f, -0.686758f, -0.687315f, -0.687872f, -0.688429f, -0.688985f,
- -0.689541f, -0.690096f, -0.690651f, -0.691205f, -0.691759f, -0.692313f, -0.692866f, -0.693419f,
- -0.693971f, -0.694524f, -0.695075f, -0.695626f, -0.696177f, -0.696728f, -0.697277f, -0.697827f,
- -0.698376f, -0.698925f, -0.699473f, -0.700021f, -0.700569f, -0.701116f, -0.701663f, -0.702209f,
- -0.702755f, -0.703300f, -0.703845f, -0.704390f, -0.704934f, -0.705478f, -0.706021f, -0.706564f,
- -0.707107f, -0.707649f, -0.708191f, -0.708732f, -0.709273f, -0.709813f, -0.710353f, -0.710893f,
- -0.711432f, -0.711971f, -0.712509f, -0.713047f, -0.713585f, -0.714122f, -0.714659f, -0.715195f,
- -0.715731f, -0.716266f, -0.716801f, -0.717336f, -0.717870f, -0.718404f, -0.718937f, -0.719470f,
- -0.720003f, -0.720535f, -0.721066f, -0.721597f, -0.722128f, -0.722659f, -0.723188f, -0.723718f,
- -0.724247f, -0.724776f, -0.725304f, -0.725832f, -0.726359f, -0.726886f, -0.727413f, -0.727939f,
- -0.728464f, -0.728990f, -0.729514f, -0.730039f, -0.730563f, -0.731086f, -0.731609f, -0.732132f,
- -0.732654f, -0.733176f, -0.733697f, -0.734218f, -0.734739f, -0.735259f, -0.735779f, -0.736298f,
- -0.736817f, -0.737335f, -0.737853f, -0.738370f, -0.738887f, -0.739404f, -0.739920f, -0.740436f,
- -0.740951f, -0.741466f, -0.741980f, -0.742494f, -0.743008f, -0.743521f, -0.744034f, -0.744546f,
- -0.745058f, -0.745569f, -0.746080f, -0.746591f, -0.747101f, -0.747610f, -0.748119f, -0.748628f,
- -0.749136f, -0.749644f, -0.750152f, -0.750659f, -0.751165f, -0.751671f, -0.752177f, -0.752682f,
- -0.753187f, -0.753691f, -0.754195f, -0.754698f, -0.755201f, -0.755704f, -0.756206f, -0.756708f,
- -0.757209f, -0.757710f, -0.758210f, -0.758710f, -0.759209f, -0.759708f, -0.760207f, -0.760705f,
- -0.761202f, -0.761700f, -0.762196f, -0.762693f, -0.763188f, -0.763684f, -0.764179f, -0.764673f,
- -0.765167f, -0.765661f, -0.766154f, -0.766647f, -0.767139f, -0.767631f, -0.768122f, -0.768613f,
- -0.769103f, -0.769593f, -0.770083f, -0.770572f, -0.771061f, -0.771549f, -0.772036f, -0.772524f,
- -0.773010f, -0.773497f, -0.773983f, -0.774468f, -0.774953f, -0.775438f, -0.775922f, -0.776405f,
- -0.776888f, -0.777371f, -0.777853f, -0.778335f, -0.778817f, -0.779297f, -0.779778f, -0.780258f,
- -0.780737f, -0.781216f, -0.781695f, -0.782173f, -0.782651f, -0.783128f, -0.783605f, -0.784081f,
- -0.784557f, -0.785032f, -0.785507f, -0.785981f, -0.786455f, -0.786929f, -0.787402f, -0.787874f,
- -0.788346f, -0.788818f, -0.789289f, -0.789760f, -0.790230f, -0.790700f, -0.791169f, -0.791638f,
- -0.792107f, -0.792575f, -0.793042f, -0.793509f, -0.793975f, -0.794442f, -0.794907f, -0.795372f,
- -0.795837f, -0.796301f, -0.796765f, -0.797228f, -0.797691f, -0.798153f, -0.798615f, -0.799076f,
- -0.799537f, -0.799998f, -0.800458f, -0.800917f, -0.801376f, -0.801835f, -0.802293f, -0.802750f,
- -0.803208f, -0.803664f, -0.804120f, -0.804576f, -0.805031f, -0.805486f, -0.805940f, -0.806394f,
- -0.806848f, -0.807300f, -0.807753f, -0.808205f, -0.808656f, -0.809107f, -0.809558f, -0.810008f,
- -0.810457f, -0.810906f, -0.811355f, -0.811803f, -0.812251f, -0.812698f, -0.813144f, -0.813591f,
- -0.814036f, -0.814482f, -0.814926f, -0.815371f, -0.815814f, -0.816258f, -0.816701f, -0.817143f,
- -0.817585f, -0.818026f, -0.818467f, -0.818908f, -0.819348f, -0.819787f, -0.820226f, -0.820664f,
- -0.821102f, -0.821540f, -0.821977f, -0.822414f, -0.822850f, -0.823285f, -0.823721f, -0.824155f,
- -0.824589f, -0.825023f, -0.825456f, -0.825889f, -0.826321f, -0.826753f, -0.827184f, -0.827615f,
- -0.828045f, -0.828475f, -0.828904f, -0.829333f, -0.829761f, -0.830189f, -0.830616f, -0.831043f,
- -0.831470f, -0.831895f, -0.832321f, -0.832746f, -0.833170f, -0.833594f, -0.834018f, -0.834440f,
- -0.834863f, -0.835285f, -0.835706f, -0.836127f, -0.836548f, -0.836968f, -0.837387f, -0.837806f,
- -0.838225f, -0.838643f, -0.839060f, -0.839477f, -0.839894f, -0.840310f, -0.840725f, -0.841140f,
- -0.841555f, -0.841969f, -0.842383f, -0.842796f, -0.843208f, -0.843620f, -0.844032f, -0.844443f,
- -0.844854f, -0.845264f, -0.845673f, -0.846082f, -0.846491f, -0.846899f, -0.847307f, -0.847714f,
- -0.848120f, -0.848526f, -0.848932f, -0.849337f, -0.849742f, -0.850146f, -0.850549f, -0.850953f,
- -0.851355f, -0.851757f, -0.852159f, -0.852560f, -0.852961f, -0.853361f, -0.853760f, -0.854159f,
- -0.854558f, -0.854956f, -0.855354f, -0.855751f, -0.856147f, -0.856543f, -0.856939f, -0.857334f,
- -0.857729f, -0.858123f, -0.858516f, -0.858909f, -0.859302f, -0.859694f, -0.860085f, -0.860476f,
- -0.860867f, -0.861257f, -0.861646f, -0.862035f, -0.862424f, -0.862812f, -0.863199f, -0.863586f,
- -0.863973f, -0.864359f, -0.864744f, -0.865129f, -0.865514f, -0.865898f, -0.866281f, -0.866664f,
- -0.867046f, -0.867428f, -0.867809f, -0.868190f, -0.868571f, -0.868951f, -0.869330f, -0.869709f,
- -0.870087f, -0.870465f, -0.870842f, -0.871219f, -0.871595f, -0.871971f, -0.872346f, -0.872721f,
- -0.873095f, -0.873469f, -0.873842f, -0.874215f, -0.874587f, -0.874958f, -0.875329f, -0.875700f,
- -0.876070f, -0.876440f, -0.876809f, -0.877177f, -0.877545f, -0.877913f, -0.878280f, -0.878646f,
- -0.879012f, -0.879378f, -0.879743f, -0.880107f, -0.880471f, -0.880834f, -0.881197f, -0.881559f,
- -0.881921f, -0.882283f, -0.882643f, -0.883004f, -0.883363f, -0.883723f, -0.884081f, -0.884439f,
- -0.884797f, -0.885154f, -0.885511f, -0.885867f, -0.886223f, -0.886578f, -0.886932f, -0.887286f,
- -0.887640f, -0.887993f, -0.888345f, -0.888697f, -0.889048f, -0.889399f, -0.889750f, -0.890099f,
- -0.890449f, -0.890797f, -0.891146f, -0.891493f, -0.891841f, -0.892187f, -0.892534f, -0.892879f,
- -0.893224f, -0.893569f, -0.893913f, -0.894256f, -0.894599f, -0.894942f, -0.895284f, -0.895625f,
- -0.895966f, -0.896307f, -0.896646f, -0.896986f, -0.897325f, -0.897663f, -0.898001f, -0.898338f,
- -0.898674f, -0.899011f, -0.899346f, -0.899681f, -0.900016f, -0.900350f, -0.900683f, -0.901016f,
- -0.901349f, -0.901681f, -0.902012f, -0.902343f, -0.902673f, -0.903003f, -0.903332f, -0.903661f,
- -0.903989f, -0.904317f, -0.904644f, -0.904971f, -0.905297f, -0.905622f, -0.905947f, -0.906272f,
- -0.906596f, -0.906919f, -0.907242f, -0.907564f, -0.907886f, -0.908207f, -0.908528f, -0.908848f,
- -0.909168f, -0.909487f, -0.909806f, -0.910124f, -0.910441f, -0.910758f, -0.911075f, -0.911391f,
- -0.911706f, -0.912021f, -0.912335f, -0.912649f, -0.912962f, -0.913275f, -0.913587f, -0.913899f,
- -0.914210f, -0.914520f, -0.914830f, -0.915140f, -0.915449f, -0.915757f, -0.916065f, -0.916372f,
- -0.916679f, -0.916985f, -0.917291f, -0.917596f, -0.917901f, -0.918205f, -0.918508f, -0.918811f,
- -0.919114f, -0.919416f, -0.919717f, -0.920018f, -0.920318f, -0.920618f, -0.920917f, -0.921216f,
- -0.921514f, -0.921812f, -0.922109f, -0.922405f, -0.922701f, -0.922997f, -0.923291f, -0.923586f,
- -0.923880f, -0.924173f, -0.924465f, -0.924758f, -0.925049f, -0.925340f, -0.925631f, -0.925921f,
- -0.926210f, -0.926499f, -0.926787f, -0.927075f, -0.927363f, -0.927649f, -0.927935f, -0.928221f,
- -0.928506f, -0.928791f, -0.929075f, -0.929358f, -0.929641f, -0.929923f, -0.930205f, -0.930486f,
- -0.930767f, -0.931047f, -0.931327f, -0.931606f, -0.931884f, -0.932162f, -0.932440f, -0.932716f,
- -0.932993f, -0.933269f, -0.933544f, -0.933818f, -0.934093f, -0.934366f, -0.934639f, -0.934912f,
- -0.935184f, -0.935455f, -0.935726f, -0.935996f, -0.936266f, -0.936535f, -0.936803f, -0.937072f,
- -0.937339f, -0.937606f, -0.937872f, -0.938138f, -0.938404f, -0.938668f, -0.938932f, -0.939196f,
- -0.939459f, -0.939722f, -0.939984f, -0.940245f, -0.940506f, -0.940766f, -0.941026f, -0.941285f,
- -0.941544f, -0.941802f, -0.942060f, -0.942317f, -0.942573f, -0.942829f, -0.943084f, -0.943339f,
- -0.943593f, -0.943847f, -0.944100f, -0.944353f, -0.944605f, -0.944856f, -0.945107f, -0.945358f,
- -0.945607f, -0.945857f, -0.946105f, -0.946353f, -0.946601f, -0.946848f, -0.947094f, -0.947340f,
- -0.947586f, -0.947830f, -0.948075f, -0.948318f, -0.948561f, -0.948804f, -0.949046f, -0.949287f,
- -0.949528f, -0.949768f, -0.950008f, -0.950247f, -0.950486f, -0.950724f, -0.950962f, -0.951199f,
- -0.951435f, -0.951671f, -0.951906f, -0.952141f, -0.952375f, -0.952609f, -0.952842f, -0.953074f,
- -0.953306f, -0.953537f, -0.953768f, -0.953998f, -0.954228f, -0.954457f, -0.954686f, -0.954914f,
- -0.955141f, -0.955368f, -0.955594f, -0.955820f, -0.956045f, -0.956270f, -0.956494f, -0.956717f,
- -0.956940f, -0.957163f, -0.957385f, -0.957606f, -0.957826f, -0.958046f, -0.958266f, -0.958485f,
- -0.958703f, -0.958921f, -0.959139f, -0.959355f, -0.959572f, -0.959787f, -0.960002f, -0.960217f,
- -0.960431f, -0.960644f, -0.960857f, -0.961069f, -0.961280f, -0.961492f, -0.961702f, -0.961912f,
- -0.962121f, -0.962330f, -0.962538f, -0.962746f, -0.962953f, -0.963160f, -0.963366f, -0.963571f,
- -0.963776f, -0.963980f, -0.964184f, -0.964387f, -0.964590f, -0.964792f, -0.964993f, -0.965194f,
- -0.965394f, -0.965594f, -0.965793f, -0.965992f, -0.966190f, -0.966387f, -0.966584f, -0.966781f,
- -0.966976f, -0.967172f, -0.967366f, -0.967560f, -0.967754f, -0.967947f, -0.968139f, -0.968331f,
- -0.968522f, -0.968713f, -0.968903f, -0.969092f, -0.969281f, -0.969470f, -0.969657f, -0.969845f,
- -0.970031f, -0.970217f, -0.970403f, -0.970588f, -0.970772f, -0.970956f, -0.971139f, -0.971322f,
- -0.971504f, -0.971685f, -0.971866f, -0.972047f, -0.972227f, -0.972406f, -0.972584f, -0.972762f,
- -0.972940f, -0.973117f, -0.973293f, -0.973469f, -0.973644f, -0.973819f, -0.973993f, -0.974166f,
- -0.974339f, -0.974512f, -0.974684f, -0.974855f, -0.975025f, -0.975195f, -0.975365f, -0.975534f,
- -0.975702f, -0.975870f, -0.976037f, -0.976204f, -0.976370f, -0.976535f, -0.976700f, -0.976864f,
- -0.977028f, -0.977191f, -0.977354f, -0.977516f, -0.977677f, -0.977838f, -0.977998f, -0.978158f,
- -0.978317f, -0.978476f, -0.978634f, -0.978791f, -0.978948f, -0.979104f, -0.979260f, -0.979415f,
- -0.979570f, -0.979724f, -0.979877f, -0.980030f, -0.980182f, -0.980334f, -0.980485f, -0.980635f,
- -0.980785f, -0.980935f, -0.981083f, -0.981232f, -0.981379f, -0.981526f, -0.981673f, -0.981819f,
- -0.981964f, -0.982109f, -0.982253f, -0.982396f, -0.982539f, -0.982682f, -0.982824f, -0.982965f,
- -0.983105f, -0.983246f, -0.983385f, -0.983524f, -0.983662f, -0.983800f, -0.983937f, -0.984074f,
- -0.984210f, -0.984346f, -0.984480f, -0.984615f, -0.984748f, -0.984882f, -0.985014f, -0.985146f,
- -0.985278f, -0.985408f, -0.985539f, -0.985668f, -0.985798f, -0.985926f, -0.986054f, -0.986181f,
- -0.986308f, -0.986434f, -0.986560f, -0.986685f, -0.986809f, -0.986933f, -0.987057f, -0.987179f,
- -0.987301f, -0.987423f, -0.987544f, -0.987664f, -0.987784f, -0.987903f, -0.988022f, -0.988140f,
- -0.988258f, -0.988374f, -0.988491f, -0.988607f, -0.988722f, -0.988836f, -0.988950f, -0.989064f,
- -0.989177f, -0.989289f, -0.989400f, -0.989511f, -0.989622f, -0.989732f, -0.989841f, -0.989950f,
- -0.990058f, -0.990166f, -0.990273f, -0.990379f, -0.990485f, -0.990590f, -0.990695f, -0.990799f,
- -0.990903f, -0.991006f, -0.991108f, -0.991210f, -0.991311f, -0.991411f, -0.991511f, -0.991611f,
- -0.991710f, -0.991808f, -0.991906f, -0.992003f, -0.992099f, -0.992195f, -0.992291f, -0.992385f,
- -0.992480f, -0.992573f, -0.992666f, -0.992759f, -0.992850f, -0.992942f, -0.993032f, -0.993122f,
- -0.993212f, -0.993301f, -0.993389f, -0.993477f, -0.993564f, -0.993651f, -0.993737f, -0.993822f,
- -0.993907f, -0.993991f, -0.994075f, -0.994158f, -0.994240f, -0.994322f, -0.994404f, -0.994484f,
- -0.994565f, -0.994644f, -0.994723f, -0.994802f, -0.994879f, -0.994957f, -0.995033f, -0.995109f,
- -0.995185f, -0.995260f, -0.995334f, -0.995408f, -0.995481f, -0.995553f, -0.995625f, -0.995697f,
- -0.995767f, -0.995838f, -0.995907f, -0.995976f, -0.996045f, -0.996113f, -0.996180f, -0.996247f,
- -0.996313f, -0.996378f, -0.996443f, -0.996507f, -0.996571f, -0.996634f, -0.996697f, -0.996759f,
- -0.996820f, -0.996881f, -0.996941f, -0.997001f, -0.997060f, -0.997119f, -0.997176f, -0.997234f,
- -0.997290f, -0.997347f, -0.997402f, -0.997457f, -0.997511f, -0.997565f, -0.997618f, -0.997671f,
- -0.997723f, -0.997774f, -0.997825f, -0.997876f, -0.997925f, -0.997974f, -0.998023f, -0.998071f,
- -0.998118f, -0.998165f, -0.998211f, -0.998257f, -0.998302f, -0.998346f, -0.998390f, -0.998433f,
- -0.998476f, -0.998518f, -0.998559f, -0.998600f, -0.998640f, -0.998680f, -0.998719f, -0.998758f,
- -0.998795f, -0.998833f, -0.998870f, -0.998906f, -0.998941f, -0.998976f, -0.999011f, -0.999044f,
- -0.999078f, -0.999110f, -0.999142f, -0.999174f, -0.999205f, -0.999235f, -0.999265f, -0.999294f,
- -0.999322f, -0.999350f, -0.999378f, -0.999404f, -0.999431f, -0.999456f, -0.999481f, -0.999506f,
- -0.999529f, -0.999553f, -0.999575f, -0.999597f, -0.999619f, -0.999640f, -0.999660f, -0.999680f,
- -0.999699f, -0.999717f, -0.999735f, -0.999753f, -0.999769f, -0.999786f, -0.999801f, -0.999816f,
- -0.999831f, -0.999844f, -0.999858f, -0.999870f, -0.999882f, -0.999894f, -0.999905f, -0.999915f,
- -0.999925f, -0.999934f, -0.999942f, -0.999950f, -0.999958f, -0.999964f, -0.999971f, -0.999976f,
- -0.999981f, -0.999986f, -0.999989f, -0.999993f, -0.999995f, -0.999997f, -0.999999f, -1.000000
-};
-
-static const float sinTable16384[8192] = {
- 0.000000f, 0.000383f, 0.000767f, 0.001150f, 0.001534f, 0.001917f, 0.002301f, 0.002684f,
- 0.003068f, 0.003451f, 0.003835f, 0.004218f, 0.004602f, 0.004985f, 0.005369f, 0.005752f,
- 0.006136f, 0.006519f, 0.006903f, 0.007286f, 0.007670f, 0.008053f, 0.008437f, 0.008820f,
- 0.009204f, 0.009587f, 0.009971f, 0.010354f, 0.010738f, 0.011121f, 0.011505f, 0.011888f,
- 0.012272f, 0.012655f, 0.013038f, 0.013422f, 0.013805f, 0.014189f, 0.014572f, 0.014956f,
- 0.015339f, 0.015723f, 0.016106f, 0.016490f, 0.016873f, 0.017256f, 0.017640f, 0.018023f,
- 0.018407f, 0.018790f, 0.019174f, 0.019557f, 0.019940f, 0.020324f, 0.020707f, 0.021091f,
- 0.021474f, 0.021857f, 0.022241f, 0.022624f, 0.023008f, 0.023391f, 0.023774f, 0.024158f,
- 0.024541f, 0.024925f, 0.025308f, 0.025691f, 0.026075f, 0.026458f, 0.026841f, 0.027225f,
- 0.027608f, 0.027991f, 0.028375f, 0.028758f, 0.029142f, 0.029525f, 0.029908f, 0.030291f,
- 0.030675f, 0.031058f, 0.031441f, 0.031825f, 0.032208f, 0.032591f, 0.032975f, 0.033358f,
- 0.033741f, 0.034124f, 0.034508f, 0.034891f, 0.035274f, 0.035657f, 0.036041f, 0.036424f,
- 0.036807f, 0.037190f, 0.037574f, 0.037957f, 0.038340f, 0.038723f, 0.039107f, 0.039490f,
- 0.039873f, 0.040256f, 0.040639f, 0.041022f, 0.041406f, 0.041789f, 0.042172f, 0.042555f,
- 0.042938f, 0.043321f, 0.043705f, 0.044088f, 0.044471f, 0.044854f, 0.045237f, 0.045620f,
- 0.046003f, 0.046386f, 0.046769f, 0.047152f, 0.047535f, 0.047919f, 0.048302f, 0.048685f,
- 0.049068f, 0.049451f, 0.049834f, 0.050217f, 0.050600f, 0.050983f, 0.051366f, 0.051749f,
- 0.052132f, 0.052515f, 0.052898f, 0.053281f, 0.053664f, 0.054046f, 0.054429f, 0.054812f,
- 0.055195f, 0.055578f, 0.055961f, 0.056344f, 0.056727f, 0.057110f, 0.057493f, 0.057875f,
- 0.058258f, 0.058641f, 0.059024f, 0.059407f, 0.059790f, 0.060172f, 0.060555f, 0.060938f,
- 0.061321f, 0.061704f, 0.062086f, 0.062469f, 0.062852f, 0.063234f, 0.063617f, 0.064000f,
- 0.064383f, 0.064765f, 0.065148f, 0.065531f, 0.065913f, 0.066296f, 0.066679f, 0.067061f,
- 0.067444f, 0.067827f, 0.068209f, 0.068592f, 0.068974f, 0.069357f, 0.069739f, 0.070122f,
- 0.070505f, 0.070887f, 0.071270f, 0.071652f, 0.072035f, 0.072417f, 0.072800f, 0.073182f,
- 0.073565f, 0.073947f, 0.074329f, 0.074712f, 0.075094f, 0.075477f, 0.075859f, 0.076241f,
- 0.076624f, 0.077006f, 0.077389f, 0.077771f, 0.078153f, 0.078536f, 0.078918f, 0.079300f,
- 0.079682f, 0.080065f, 0.080447f, 0.080829f, 0.081211f, 0.081594f, 0.081976f, 0.082358f,
- 0.082740f, 0.083122f, 0.083505f, 0.083887f, 0.084269f, 0.084651f, 0.085033f, 0.085415f,
- 0.085797f, 0.086179f, 0.086561f, 0.086943f, 0.087326f, 0.087708f, 0.088090f, 0.088472f,
- 0.088854f, 0.089236f, 0.089617f, 0.089999f, 0.090381f, 0.090763f, 0.091145f, 0.091527f,
- 0.091909f, 0.092291f, 0.092673f, 0.093055f, 0.093436f, 0.093818f, 0.094200f, 0.094582f,
- 0.094963f, 0.095345f, 0.095727f, 0.096109f, 0.096490f, 0.096872f, 0.097254f, 0.097635f,
- 0.098017f, 0.098399f, 0.098780f, 0.099162f, 0.099544f, 0.099925f, 0.100307f, 0.100688f,
- 0.101070f, 0.101451f, 0.101833f, 0.102214f, 0.102596f, 0.102977f, 0.103359f, 0.103740f,
- 0.104122f, 0.104503f, 0.104884f, 0.105266f, 0.105647f, 0.106028f, 0.106410f, 0.106791f,
- 0.107172f, 0.107554f, 0.107935f, 0.108316f, 0.108697f, 0.109079f, 0.109460f, 0.109841f,
- 0.110222f, 0.110603f, 0.110984f, 0.111366f, 0.111747f, 0.112128f, 0.112509f, 0.112890f,
- 0.113271f, 0.113652f, 0.114033f, 0.114414f, 0.114795f, 0.115176f, 0.115557f, 0.115938f,
- 0.116319f, 0.116700f, 0.117080f, 0.117461f, 0.117842f, 0.118223f, 0.118604f, 0.118984f,
- 0.119365f, 0.119746f, 0.120127f, 0.120507f, 0.120888f, 0.121269f, 0.121649f, 0.122030f,
- 0.122411f, 0.122791f, 0.123172f, 0.123552f, 0.123933f, 0.124314f, 0.124694f, 0.125075f,
- 0.125455f, 0.125835f, 0.126216f, 0.126596f, 0.126977f, 0.127357f, 0.127737f, 0.128118f,
- 0.128498f, 0.128878f, 0.129259f, 0.129639f, 0.130019f, 0.130399f, 0.130780f, 0.131160f,
- 0.131540f, 0.131920f, 0.132300f, 0.132680f, 0.133061f, 0.133441f, 0.133821f, 0.134201f,
- 0.134581f, 0.134961f, 0.135341f, 0.135721f, 0.136101f, 0.136480f, 0.136860f, 0.137240f,
- 0.137620f, 0.138000f, 0.138380f, 0.138760f, 0.139139f, 0.139519f, 0.139899f, 0.140279f,
- 0.140658f, 0.141038f, 0.141418f, 0.141797f, 0.142177f, 0.142556f, 0.142936f, 0.143316f,
- 0.143695f, 0.144075f, 0.144454f, 0.144833f, 0.145213f, 0.145592f, 0.145972f, 0.146351f,
- 0.146730f, 0.147110f, 0.147489f, 0.147868f, 0.148248f, 0.148627f, 0.149006f, 0.149385f,
- 0.149765f, 0.150144f, 0.150523f, 0.150902f, 0.151281f, 0.151660f, 0.152039f, 0.152418f,
- 0.152797f, 0.153176f, 0.153555f, 0.153934f, 0.154313f, 0.154692f, 0.155071f, 0.155450f,
- 0.155828f, 0.156207f, 0.156586f, 0.156965f, 0.157343f, 0.157722f, 0.158101f, 0.158480f,
- 0.158858f, 0.159237f, 0.159615f, 0.159994f, 0.160372f, 0.160751f, 0.161129f, 0.161508f,
- 0.161886f, 0.162265f, 0.162643f, 0.163022f, 0.163400f, 0.163778f, 0.164157f, 0.164535f,
- 0.164913f, 0.165291f, 0.165670f, 0.166048f, 0.166426f, 0.166804f, 0.167182f, 0.167560f,
- 0.167938f, 0.168316f, 0.168694f, 0.169072f, 0.169450f, 0.169828f, 0.170206f, 0.170584f,
- 0.170962f, 0.171340f, 0.171718f, 0.172095f, 0.172473f, 0.172851f, 0.173229f, 0.173606f,
- 0.173984f, 0.174362f, 0.174739f, 0.175117f, 0.175494f, 0.175872f, 0.176249f, 0.176627f,
- 0.177004f, 0.177382f, 0.177759f, 0.178136f, 0.178514f, 0.178891f, 0.179268f, 0.179646f,
- 0.180023f, 0.180400f, 0.180777f, 0.181154f, 0.181532f, 0.181909f, 0.182286f, 0.182663f,
- 0.183040f, 0.183417f, 0.183794f, 0.184171f, 0.184548f, 0.184925f, 0.185301f, 0.185678f,
- 0.186055f, 0.186432f, 0.186809f, 0.187185f, 0.187562f, 0.187939f, 0.188315f, 0.188692f,
- 0.189069f, 0.189445f, 0.189822f, 0.190198f, 0.190575f, 0.190951f, 0.191328f, 0.191704f,
- 0.192080f, 0.192457f, 0.192833f, 0.193209f, 0.193586f, 0.193962f, 0.194338f, 0.194714f,
- 0.195090f, 0.195466f, 0.195843f, 0.196219f, 0.196595f, 0.196971f, 0.197347f, 0.197722f,
- 0.198098f, 0.198474f, 0.198850f, 0.199226f, 0.199602f, 0.199978f, 0.200353f, 0.200729f,
- 0.201105f, 0.201480f, 0.201856f, 0.202231f, 0.202607f, 0.202983f, 0.203358f, 0.203734f,
- 0.204109f, 0.204484f, 0.204860f, 0.205235f, 0.205610f, 0.205986f, 0.206361f, 0.206736f,
- 0.207111f, 0.207487f, 0.207862f, 0.208237f, 0.208612f, 0.208987f, 0.209362f, 0.209737f,
- 0.210112f, 0.210487f, 0.210862f, 0.211237f, 0.211611f, 0.211986f, 0.212361f, 0.212736f,
- 0.213110f, 0.213485f, 0.213860f, 0.214234f, 0.214609f, 0.214983f, 0.215358f, 0.215732f,
- 0.216107f, 0.216481f, 0.216856f, 0.217230f, 0.217604f, 0.217979f, 0.218353f, 0.218727f,
- 0.219101f, 0.219475f, 0.219850f, 0.220224f, 0.220598f, 0.220972f, 0.221346f, 0.221720f,
- 0.222094f, 0.222468f, 0.222841f, 0.223215f, 0.223589f, 0.223963f, 0.224337f, 0.224710f,
- 0.225084f, 0.225458f, 0.225831f, 0.226205f, 0.226578f, 0.226952f, 0.227325f, 0.227699f,
- 0.228072f, 0.228445f, 0.228819f, 0.229192f, 0.229565f, 0.229939f, 0.230312f, 0.230685f,
- 0.231058f, 0.231431f, 0.231804f, 0.232177f, 0.232550f, 0.232923f, 0.233296f, 0.233669f,
- 0.234042f, 0.234415f, 0.234788f, 0.235160f, 0.235533f, 0.235906f, 0.236278f, 0.236651f,
- 0.237024f, 0.237396f, 0.237769f, 0.238141f, 0.238514f, 0.238886f, 0.239258f, 0.239631f,
- 0.240003f, 0.240375f, 0.240748f, 0.241120f, 0.241492f, 0.241864f, 0.242236f, 0.242608f,
- 0.242980f, 0.243352f, 0.243724f, 0.244096f, 0.244468f, 0.244840f, 0.245212f, 0.245583f,
- 0.245955f, 0.246327f, 0.246698f, 0.247070f, 0.247442f, 0.247813f, 0.248185f, 0.248556f,
- 0.248928f, 0.249299f, 0.249670f, 0.250042f, 0.250413f, 0.250784f, 0.251155f, 0.251527f,
- 0.251898f, 0.252269f, 0.252640f, 0.253011f, 0.253382f, 0.253753f, 0.254124f, 0.254495f,
- 0.254866f, 0.255236f, 0.255607f, 0.255978f, 0.256349f, 0.256719f, 0.257090f, 0.257461f,
- 0.257831f, 0.258202f, 0.258572f, 0.258943f, 0.259313f, 0.259683f, 0.260054f, 0.260424f,
- 0.260794f, 0.261164f, 0.261534f, 0.261905f, 0.262275f, 0.262645f, 0.263015f, 0.263385f,
- 0.263755f, 0.264125f, 0.264494f, 0.264864f, 0.265234f, 0.265604f, 0.265973f, 0.266343f,
- 0.266713f, 0.267082f, 0.267452f, 0.267821f, 0.268191f, 0.268560f, 0.268930f, 0.269299f,
- 0.269668f, 0.270038f, 0.270407f, 0.270776f, 0.271145f, 0.271514f, 0.271883f, 0.272252f,
- 0.272621f, 0.272990f, 0.273359f, 0.273728f, 0.274097f, 0.274466f, 0.274834f, 0.275203f,
- 0.275572f, 0.275940f, 0.276309f, 0.276678f, 0.277046f, 0.277415f, 0.277783f, 0.278151f,
- 0.278520f, 0.278888f, 0.279256f, 0.279624f, 0.279993f, 0.280361f, 0.280729f, 0.281097f,
- 0.281465f, 0.281833f, 0.282201f, 0.282569f, 0.282937f, 0.283304f, 0.283672f, 0.284040f,
- 0.284408f, 0.284775f, 0.285143f, 0.285510f, 0.285878f, 0.286245f, 0.286613f, 0.286980f,
- 0.287347f, 0.287715f, 0.288082f, 0.288449f, 0.288816f, 0.289184f, 0.289551f, 0.289918f,
- 0.290285f, 0.290652f, 0.291019f, 0.291385f, 0.291752f, 0.292119f, 0.292486f, 0.292852f,
- 0.293219f, 0.293586f, 0.293952f, 0.294319f, 0.294685f, 0.295052f, 0.295418f, 0.295785f,
- 0.296151f, 0.296517f, 0.296883f, 0.297250f, 0.297616f, 0.297982f, 0.298348f, 0.298714f,
- 0.299080f, 0.299446f, 0.299812f, 0.300177f, 0.300543f, 0.300909f, 0.301275f, 0.301640f,
- 0.302006f, 0.302372f, 0.302737f, 0.303103f, 0.303468f, 0.303833f, 0.304199f, 0.304564f,
- 0.304929f, 0.305294f, 0.305660f, 0.306025f, 0.306390f, 0.306755f, 0.307120f, 0.307485f,
- 0.307850f, 0.308214f, 0.308579f, 0.308944f, 0.309309f, 0.309673f, 0.310038f, 0.310403f,
- 0.310767f, 0.311132f, 0.311496f, 0.311860f, 0.312225f, 0.312589f, 0.312953f, 0.313318f,
- 0.313682f, 0.314046f, 0.314410f, 0.314774f, 0.315138f, 0.315502f, 0.315866f, 0.316230f,
- 0.316593f, 0.316957f, 0.317321f, 0.317684f, 0.318048f, 0.318412f, 0.318775f, 0.319139f,
- 0.319502f, 0.319865f, 0.320229f, 0.320592f, 0.320955f, 0.321318f, 0.321682f, 0.322045f,
- 0.322408f, 0.322771f, 0.323134f, 0.323497f, 0.323859f, 0.324222f, 0.324585f, 0.324948f,
- 0.325310f, 0.325673f, 0.326035f, 0.326398f, 0.326760f, 0.327123f, 0.327485f, 0.327848f,
- 0.328210f, 0.328572f, 0.328934f, 0.329296f, 0.329658f, 0.330020f, 0.330382f, 0.330744f,
- 0.331106f, 0.331468f, 0.331830f, 0.332192f, 0.332553f, 0.332915f, 0.333277f, 0.333638f,
- 0.334000f, 0.334361f, 0.334722f, 0.335084f, 0.335445f, 0.335806f, 0.336168f, 0.336529f,
- 0.336890f, 0.337251f, 0.337612f, 0.337973f, 0.338334f, 0.338695f, 0.339055f, 0.339416f,
- 0.339777f, 0.340138f, 0.340498f, 0.340859f, 0.341219f, 0.341580f, 0.341940f, 0.342300f,
- 0.342661f, 0.343021f, 0.343381f, 0.343741f, 0.344101f, 0.344461f, 0.344821f, 0.345181f,
- 0.345541f, 0.345901f, 0.346261f, 0.346621f, 0.346980f, 0.347340f, 0.347700f, 0.348059f,
- 0.348419f, 0.348778f, 0.349138f, 0.349497f, 0.349856f, 0.350215f, 0.350575f, 0.350934f,
- 0.351293f, 0.351652f, 0.352011f, 0.352370f, 0.352729f, 0.353087f, 0.353446f, 0.353805f,
- 0.354164f, 0.354522f, 0.354881f, 0.355239f, 0.355598f, 0.355956f, 0.356314f, 0.356673f,
- 0.357031f, 0.357389f, 0.357747f, 0.358105f, 0.358463f, 0.358821f, 0.359179f, 0.359537f,
- 0.359895f, 0.360253f, 0.360611f, 0.360968f, 0.361326f, 0.361683f, 0.362041f, 0.362398f,
- 0.362756f, 0.363113f, 0.363470f, 0.363828f, 0.364185f, 0.364542f, 0.364899f, 0.365256f,
- 0.365613f, 0.365970f, 0.366327f, 0.366684f, 0.367040f, 0.367397f, 0.367754f, 0.368110f,
- 0.368467f, 0.368823f, 0.369180f, 0.369536f, 0.369892f, 0.370249f, 0.370605f, 0.370961f,
- 0.371317f, 0.371673f, 0.372029f, 0.372385f, 0.372741f, 0.373097f, 0.373453f, 0.373808f,
- 0.374164f, 0.374520f, 0.374875f, 0.375231f, 0.375586f, 0.375942f, 0.376297f, 0.376652f,
- 0.377007f, 0.377363f, 0.377718f, 0.378073f, 0.378428f, 0.378783f, 0.379138f, 0.379492f,
- 0.379847f, 0.380202f, 0.380557f, 0.380911f, 0.381266f, 0.381620f, 0.381975f, 0.382329f,
- 0.382683f, 0.383038f, 0.383392f, 0.383746f, 0.384100f, 0.384454f, 0.384808f, 0.385162f,
- 0.385516f, 0.385870f, 0.386224f, 0.386577f, 0.386931f, 0.387285f, 0.387638f, 0.387992f,
- 0.388345f, 0.388698f, 0.389052f, 0.389405f, 0.389758f, 0.390111f, 0.390464f, 0.390817f,
- 0.391170f, 0.391523f, 0.391876f, 0.392229f, 0.392582f, 0.392934f, 0.393287f, 0.393640f,
- 0.393992f, 0.394344f, 0.394697f, 0.395049f, 0.395401f, 0.395754f, 0.396106f, 0.396458f,
- 0.396810f, 0.397162f, 0.397514f, 0.397866f, 0.398218f, 0.398569f, 0.398921f, 0.399273f,
- 0.399624f, 0.399976f, 0.400327f, 0.400679f, 0.401030f, 0.401381f, 0.401732f, 0.402084f,
- 0.402435f, 0.402786f, 0.403137f, 0.403488f, 0.403838f, 0.404189f, 0.404540f, 0.404891f,
- 0.405241f, 0.405592f, 0.405942f, 0.406293f, 0.406643f, 0.406994f, 0.407344f, 0.407694f,
- 0.408044f, 0.408394f, 0.408744f, 0.409094f, 0.409444f, 0.409794f, 0.410144f, 0.410493f,
- 0.410843f, 0.411193f, 0.411542f, 0.411892f, 0.412241f, 0.412591f, 0.412940f, 0.413289f,
- 0.413638f, 0.413987f, 0.414337f, 0.414685f, 0.415034f, 0.415383f, 0.415732f, 0.416081f,
- 0.416430f, 0.416778f, 0.417127f, 0.417475f, 0.417824f, 0.418172f, 0.418520f, 0.418869f,
- 0.419217f, 0.419565f, 0.419913f, 0.420261f, 0.420609f, 0.420957f, 0.421305f, 0.421653f,
- 0.422000f, 0.422348f, 0.422695f, 0.423043f, 0.423390f, 0.423738f, 0.424085f, 0.424432f,
- 0.424780f, 0.425127f, 0.425474f, 0.425821f, 0.426168f, 0.426515f, 0.426862f, 0.427208f,
- 0.427555f, 0.427902f, 0.428248f, 0.428595f, 0.428941f, 0.429288f, 0.429634f, 0.429980f,
- 0.430326f, 0.430673f, 0.431019f, 0.431365f, 0.431711f, 0.432057f, 0.432402f, 0.432748f,
- 0.433094f, 0.433439f, 0.433785f, 0.434131f, 0.434476f, 0.434821f, 0.435167f, 0.435512f,
- 0.435857f, 0.436202f, 0.436547f, 0.436892f, 0.437237f, 0.437582f, 0.437927f, 0.438272f,
- 0.438616f, 0.438961f, 0.439305f, 0.439650f, 0.439994f, 0.440339f, 0.440683f, 0.441027f,
- 0.441371f, 0.441715f, 0.442059f, 0.442403f, 0.442747f, 0.443091f, 0.443435f, 0.443779f,
- 0.444122f, 0.444466f, 0.444809f, 0.445153f, 0.445496f, 0.445839f, 0.446183f, 0.446526f,
- 0.446869f, 0.447212f, 0.447555f, 0.447898f, 0.448241f, 0.448583f, 0.448926f, 0.449269f,
- 0.449611f, 0.449954f, 0.450296f, 0.450639f, 0.450981f, 0.451323f, 0.451665f, 0.452008f,
- 0.452350f, 0.452692f, 0.453033f, 0.453375f, 0.453717f, 0.454059f, 0.454400f, 0.454742f,
- 0.455084f, 0.455425f, 0.455766f, 0.456108f, 0.456449f, 0.456790f, 0.457131f, 0.457472f,
- 0.457813f, 0.458154f, 0.458495f, 0.458836f, 0.459177f, 0.459517f, 0.459858f, 0.460198f,
- 0.460539f, 0.460879f, 0.461219f, 0.461560f, 0.461900f, 0.462240f, 0.462580f, 0.462920f,
- 0.463260f, 0.463600f, 0.463939f, 0.464279f, 0.464619f, 0.464958f, 0.465298f, 0.465637f,
- 0.465977f, 0.466316f, 0.466655f, 0.466994f, 0.467333f, 0.467672f, 0.468011f, 0.468350f,
- 0.468689f, 0.469028f, 0.469366f, 0.469705f, 0.470043f, 0.470382f, 0.470720f, 0.471058f,
- 0.471397f, 0.471735f, 0.472073f, 0.472411f, 0.472749f, 0.473087f, 0.473425f, 0.473763f,
- 0.474100f, 0.474438f, 0.474775f, 0.475113f, 0.475450f, 0.475788f, 0.476125f, 0.476462f,
- 0.476799f, 0.477136f, 0.477473f, 0.477810f, 0.478147f, 0.478484f, 0.478821f, 0.479157f,
- 0.479494f, 0.479830f, 0.480167f, 0.480503f, 0.480839f, 0.481176f, 0.481512f, 0.481848f,
- 0.482184f, 0.482520f, 0.482856f, 0.483191f, 0.483527f, 0.483863f, 0.484198f, 0.484534f,
- 0.484869f, 0.485205f, 0.485540f, 0.485875f, 0.486210f, 0.486545f, 0.486880f, 0.487215f,
- 0.487550f, 0.487885f, 0.488220f, 0.488554f, 0.488889f, 0.489223f, 0.489558f, 0.489892f,
- 0.490226f, 0.490561f, 0.490895f, 0.491229f, 0.491563f, 0.491897f, 0.492231f, 0.492564f,
- 0.492898f, 0.493232f, 0.493565f, 0.493899f, 0.494232f, 0.494566f, 0.494899f, 0.495232f,
- 0.495565f, 0.495898f, 0.496231f, 0.496564f, 0.496897f, 0.497230f, 0.497562f, 0.497895f,
- 0.498228f, 0.498560f, 0.498893f, 0.499225f, 0.499557f, 0.499889f, 0.500221f, 0.500553f,
- 0.500885f, 0.501217f, 0.501549f, 0.501881f, 0.502212f, 0.502544f, 0.502876f, 0.503207f,
- 0.503538f, 0.503870f, 0.504201f, 0.504532f, 0.504863f, 0.505194f, 0.505525f, 0.505856f,
- 0.506187f, 0.506517f, 0.506848f, 0.507179f, 0.507509f, 0.507839f, 0.508170f, 0.508500f,
- 0.508830f, 0.509160f, 0.509490f, 0.509820f, 0.510150f, 0.510480f, 0.510810f, 0.511139f,
- 0.511469f, 0.511798f, 0.512128f, 0.512457f, 0.512786f, 0.513116f, 0.513445f, 0.513774f,
- 0.514103f, 0.514432f, 0.514760f, 0.515089f, 0.515418f, 0.515746f, 0.516075f, 0.516403f,
- 0.516732f, 0.517060f, 0.517388f, 0.517716f, 0.518045f, 0.518372f, 0.518700f, 0.519028f,
- 0.519356f, 0.519684f, 0.520011f, 0.520339f, 0.520666f, 0.520994f, 0.521321f, 0.521648f,
- 0.521975f, 0.522302f, 0.522629f, 0.522956f, 0.523283f, 0.523610f, 0.523937f, 0.524263f,
- 0.524590f, 0.524916f, 0.525243f, 0.525569f, 0.525895f, 0.526221f, 0.526547f, 0.526873f,
- 0.527199f, 0.527525f, 0.527851f, 0.528176f, 0.528502f, 0.528828f, 0.529153f, 0.529478f,
- 0.529804f, 0.530129f, 0.530454f, 0.530779f, 0.531104f, 0.531429f, 0.531754f, 0.532078f,
- 0.532403f, 0.532728f, 0.533052f, 0.533377f, 0.533701f, 0.534025f, 0.534349f, 0.534674f,
- 0.534998f, 0.535322f, 0.535645f, 0.535969f, 0.536293f, 0.536617f, 0.536940f, 0.537264f,
- 0.537587f, 0.537910f, 0.538234f, 0.538557f, 0.538880f, 0.539203f, 0.539526f, 0.539849f,
- 0.540171f, 0.540494f, 0.540817f, 0.541139f, 0.541462f, 0.541784f, 0.542106f, 0.542429f,
- 0.542751f, 0.543073f, 0.543395f, 0.543717f, 0.544039f, 0.544360f, 0.544682f, 0.545003f,
- 0.545325f, 0.545646f, 0.545968f, 0.546289f, 0.546610f, 0.546931f, 0.547252f, 0.547573f,
- 0.547894f, 0.548215f, 0.548536f, 0.548856f, 0.549177f, 0.549497f, 0.549818f, 0.550138f,
- 0.550458f, 0.550778f, 0.551098f, 0.551418f, 0.551738f, 0.552058f, 0.552378f, 0.552697f,
- 0.553017f, 0.553336f, 0.553656f, 0.553975f, 0.554294f, 0.554613f, 0.554932f, 0.555251f,
- 0.555570f, 0.555889f, 0.556208f, 0.556526f, 0.556845f, 0.557164f, 0.557482f, 0.557800f,
- 0.558119f, 0.558437f, 0.558755f, 0.559073f, 0.559391f, 0.559709f, 0.560026f, 0.560344f,
- 0.560662f, 0.560979f, 0.561297f, 0.561614f, 0.561931f, 0.562248f, 0.562565f, 0.562882f,
- 0.563199f, 0.563516f, 0.563833f, 0.564150f, 0.564466f, 0.564783f, 0.565099f, 0.565416f,
- 0.565732f, 0.566048f, 0.566364f, 0.566680f, 0.566996f, 0.567312f, 0.567628f, 0.567943f,
- 0.568259f, 0.568574f, 0.568890f, 0.569205f, 0.569521f, 0.569836f, 0.570151f, 0.570466f,
- 0.570781f, 0.571096f, 0.571410f, 0.571725f, 0.572040f, 0.572354f, 0.572669f, 0.572983f,
- 0.573297f, 0.573611f, 0.573925f, 0.574239f, 0.574553f, 0.574867f, 0.575181f, 0.575495f,
- 0.575808f, 0.576122f, 0.576435f, 0.576748f, 0.577062f, 0.577375f, 0.577688f, 0.578001f,
- 0.578314f, 0.578627f, 0.578939f, 0.579252f, 0.579565f, 0.579877f, 0.580189f, 0.580502f,
- 0.580814f, 0.581126f, 0.581438f, 0.581750f, 0.582062f, 0.582374f, 0.582685f, 0.582997f,
- 0.583309f, 0.583620f, 0.583931f, 0.584243f, 0.584554f, 0.584865f, 0.585176f, 0.585487f,
- 0.585798f, 0.586109f, 0.586419f, 0.586730f, 0.587040f, 0.587351f, 0.587661f, 0.587971f,
- 0.588282f, 0.588592f, 0.588902f, 0.589212f, 0.589521f, 0.589831f, 0.590141f, 0.590450f,
- 0.590760f, 0.591069f, 0.591378f, 0.591688f, 0.591997f, 0.592306f, 0.592615f, 0.592924f,
- 0.593232f, 0.593541f, 0.593850f, 0.594158f, 0.594467f, 0.594775f, 0.595083f, 0.595391f,
- 0.595699f, 0.596007f, 0.596315f, 0.596623f, 0.596931f, 0.597238f, 0.597546f, 0.597853f,
- 0.598161f, 0.598468f, 0.598775f, 0.599082f, 0.599389f, 0.599696f, 0.600003f, 0.600310f,
- 0.600616f, 0.600923f, 0.601230f, 0.601536f, 0.601842f, 0.602148f, 0.602455f, 0.602761f,
- 0.603067f, 0.603372f, 0.603678f, 0.603984f, 0.604290f, 0.604595f, 0.604900f, 0.605206f,
- 0.605511f, 0.605816f, 0.606121f, 0.606426f, 0.606731f, 0.607036f, 0.607341f, 0.607645f,
- 0.607950f, 0.608254f, 0.608559f, 0.608863f, 0.609167f, 0.609471f, 0.609775f, 0.610079f,
- 0.610383f, 0.610687f, 0.610990f, 0.611294f, 0.611597f, 0.611901f, 0.612204f, 0.612507f,
- 0.612810f, 0.613113f, 0.613416f, 0.613719f, 0.614022f, 0.614324f, 0.614627f, 0.614929f,
- 0.615232f, 0.615534f, 0.615836f, 0.616138f, 0.616440f, 0.616742f, 0.617044f, 0.617346f,
- 0.617647f, 0.617949f, 0.618250f, 0.618552f, 0.618853f, 0.619154f, 0.619455f, 0.619756f,
- 0.620057f, 0.620358f, 0.620659f, 0.620959f, 0.621260f, 0.621560f, 0.621861f, 0.622161f,
- 0.622461f, 0.622761f, 0.623061f, 0.623361f, 0.623661f, 0.623961f, 0.624260f, 0.624560f,
- 0.624860f, 0.625159f, 0.625458f, 0.625757f, 0.626056f, 0.626355f, 0.626654f, 0.626953f,
- 0.627252f, 0.627550f, 0.627849f, 0.628147f, 0.628446f, 0.628744f, 0.629042f, 0.629340f,
- 0.629638f, 0.629936f, 0.630234f, 0.630532f, 0.630829f, 0.631127f, 0.631424f, 0.631721f,
- 0.632019f, 0.632316f, 0.632613f, 0.632910f, 0.633207f, 0.633504f, 0.633800f, 0.634097f,
- 0.634393f, 0.634690f, 0.634986f, 0.635282f, 0.635578f, 0.635874f, 0.636170f, 0.636466f,
- 0.636762f, 0.637057f, 0.637353f, 0.637649f, 0.637944f, 0.638239f, 0.638534f, 0.638829f,
- 0.639124f, 0.639419f, 0.639714f, 0.640009f, 0.640303f, 0.640598f, 0.640892f, 0.641187f,
- 0.641481f, 0.641775f, 0.642069f, 0.642363f, 0.642657f, 0.642951f, 0.643245f, 0.643538f,
- 0.643832f, 0.644125f, 0.644418f, 0.644711f, 0.645005f, 0.645298f, 0.645590f, 0.645883f,
- 0.646176f, 0.646469f, 0.646761f, 0.647054f, 0.647346f, 0.647638f, 0.647930f, 0.648222f,
- 0.648514f, 0.648806f, 0.649098f, 0.649390f, 0.649681f, 0.649973f, 0.650264f, 0.650555f,
- 0.650847f, 0.651138f, 0.651429f, 0.651720f, 0.652011f, 0.652301f, 0.652592f, 0.652882f,
- 0.653173f, 0.653463f, 0.653753f, 0.654044f, 0.654334f, 0.654624f, 0.654913f, 0.655203f,
- 0.655493f, 0.655782f, 0.656072f, 0.656361f, 0.656651f, 0.656940f, 0.657229f, 0.657518f,
- 0.657807f, 0.658095f, 0.658384f, 0.658673f, 0.658961f, 0.659250f, 0.659538f, 0.659826f,
- 0.660114f, 0.660402f, 0.660690f, 0.660978f, 0.661266f, 0.661553f, 0.661841f, 0.662128f,
- 0.662416f, 0.662703f, 0.662990f, 0.663277f, 0.663564f, 0.663851f, 0.664138f, 0.664424f,
- 0.664711f, 0.664997f, 0.665284f, 0.665570f, 0.665856f, 0.666142f, 0.666428f, 0.666714f,
- 0.667000f, 0.667286f, 0.667571f, 0.667857f, 0.668142f, 0.668427f, 0.668712f, 0.668998f,
- 0.669283f, 0.669567f, 0.669852f, 0.670137f, 0.670422f, 0.670706f, 0.670990f, 0.671275f,
- 0.671559f, 0.671843f, 0.672127f, 0.672411f, 0.672695f, 0.672978f, 0.673262f, 0.673546f,
- 0.673829f, 0.674112f, 0.674396f, 0.674679f, 0.674962f, 0.675245f, 0.675527f, 0.675810f,
- 0.676093f, 0.676375f, 0.676658f, 0.676940f, 0.677222f, 0.677504f, 0.677786f, 0.678068f,
- 0.678350f, 0.678632f, 0.678913f, 0.679195f, 0.679476f, 0.679758f, 0.680039f, 0.680320f,
- 0.680601f, 0.680882f, 0.681163f, 0.681443f, 0.681724f, 0.682005f, 0.682285f, 0.682565f,
- 0.682846f, 0.683126f, 0.683406f, 0.683686f, 0.683965f, 0.684245f, 0.684525f, 0.684804f,
- 0.685084f, 0.685363f, 0.685642f, 0.685921f, 0.686200f, 0.686479f, 0.686758f, 0.687037f,
- 0.687315f, 0.687594f, 0.687872f, 0.688151f, 0.688429f, 0.688707f, 0.688985f, 0.689263f,
- 0.689541f, 0.689818f, 0.690096f, 0.690373f, 0.690651f, 0.690928f, 0.691205f, 0.691482f,
- 0.691759f, 0.692036f, 0.692313f, 0.692590f, 0.692866f, 0.693143f, 0.693419f, 0.693695f,
- 0.693971f, 0.694248f, 0.694524f, 0.694799f, 0.695075f, 0.695351f, 0.695626f, 0.695902f,
- 0.696177f, 0.696452f, 0.696728f, 0.697003f, 0.697277f, 0.697552f, 0.697827f, 0.698102f,
- 0.698376f, 0.698651f, 0.698925f, 0.699199f, 0.699473f, 0.699747f, 0.700021f, 0.700295f,
- 0.700569f, 0.700842f, 0.701116f, 0.701389f, 0.701663f, 0.701936f, 0.702209f, 0.702482f,
- 0.702755f, 0.703028f, 0.703300f, 0.703573f, 0.703845f, 0.704118f, 0.704390f, 0.704662f,
- 0.704934f, 0.705206f, 0.705478f, 0.705750f, 0.706021f, 0.706293f, 0.706564f, 0.706836f,
- 0.707107f, 0.707378f, 0.707649f, 0.707920f, 0.708191f, 0.708461f, 0.708732f, 0.709002f,
- 0.709273f, 0.709543f, 0.709813f, 0.710083f, 0.710353f, 0.710623f, 0.710893f, 0.711163f,
- 0.711432f, 0.711702f, 0.711971f, 0.712240f, 0.712509f, 0.712778f, 0.713047f, 0.713316f,
- 0.713585f, 0.713853f, 0.714122f, 0.714390f, 0.714659f, 0.714927f, 0.715195f, 0.715463f,
- 0.715731f, 0.715999f, 0.716266f, 0.716534f, 0.716801f, 0.717069f, 0.717336f, 0.717603f,
- 0.717870f, 0.718137f, 0.718404f, 0.718670f, 0.718937f, 0.719204f, 0.719470f, 0.719736f,
- 0.720003f, 0.720269f, 0.720535f, 0.720800f, 0.721066f, 0.721332f, 0.721597f, 0.721863f,
- 0.722128f, 0.722393f, 0.722659f, 0.722924f, 0.723188f, 0.723453f, 0.723718f, 0.723983f,
- 0.724247f, 0.724511f, 0.724776f, 0.725040f, 0.725304f, 0.725568f, 0.725832f, 0.726095f,
- 0.726359f, 0.726623f, 0.726886f, 0.727149f, 0.727413f, 0.727676f, 0.727939f, 0.728202f,
- 0.728464f, 0.728727f, 0.728990f, 0.729252f, 0.729514f, 0.729777f, 0.730039f, 0.730301f,
- 0.730563f, 0.730825f, 0.731086f, 0.731348f, 0.731609f, 0.731871f, 0.732132f, 0.732393f,
- 0.732654f, 0.732915f, 0.733176f, 0.733437f, 0.733697f, 0.733958f, 0.734218f, 0.734479f,
- 0.734739f, 0.734999f, 0.735259f, 0.735519f, 0.735779f, 0.736038f, 0.736298f, 0.736557f,
- 0.736817f, 0.737076f, 0.737335f, 0.737594f, 0.737853f, 0.738112f, 0.738370f, 0.738629f,
- 0.738887f, 0.739146f, 0.739404f, 0.739662f, 0.739920f, 0.740178f, 0.740436f, 0.740694f,
- 0.740951f, 0.741209f, 0.741466f, 0.741723f, 0.741980f, 0.742237f, 0.742494f, 0.742751f,
- 0.743008f, 0.743265f, 0.743521f, 0.743777f, 0.744034f, 0.744290f, 0.744546f, 0.744802f,
- 0.745058f, 0.745314f, 0.745569f, 0.745825f, 0.746080f, 0.746335f, 0.746591f, 0.746846f,
- 0.747101f, 0.747355f, 0.747610f, 0.747865f, 0.748119f, 0.748374f, 0.748628f, 0.748882f,
- 0.749136f, 0.749390f, 0.749644f, 0.749898f, 0.750152f, 0.750405f, 0.750659f, 0.750912f,
- 0.751165f, 0.751418f, 0.751671f, 0.751924f, 0.752177f, 0.752429f, 0.752682f, 0.752934f,
- 0.753187f, 0.753439f, 0.753691f, 0.753943f, 0.754195f, 0.754447f, 0.754698f, 0.754950f,
- 0.755201f, 0.755453f, 0.755704f, 0.755955f, 0.756206f, 0.756457f, 0.756708f, 0.756958f,
- 0.757209f, 0.757459f, 0.757710f, 0.757960f, 0.758210f, 0.758460f, 0.758710f, 0.758960f,
- 0.759209f, 0.759459f, 0.759708f, 0.759957f, 0.760207f, 0.760456f, 0.760705f, 0.760954f,
- 0.761202f, 0.761451f, 0.761700f, 0.761948f, 0.762196f, 0.762444f, 0.762693f, 0.762941f,
- 0.763188f, 0.763436f, 0.763684f, 0.763931f, 0.764179f, 0.764426f, 0.764673f, 0.764920f,
- 0.765167f, 0.765414f, 0.765661f, 0.765907f, 0.766154f, 0.766400f, 0.766647f, 0.766893f,
- 0.767139f, 0.767385f, 0.767631f, 0.767876f, 0.768122f, 0.768368f, 0.768613f, 0.768858f,
- 0.769103f, 0.769348f, 0.769593f, 0.769838f, 0.770083f, 0.770327f, 0.770572f, 0.770816f,
- 0.771061f, 0.771305f, 0.771549f, 0.771793f, 0.772036f, 0.772280f, 0.772524f, 0.772767f,
- 0.773010f, 0.773254f, 0.773497f, 0.773740f, 0.773983f, 0.774225f, 0.774468f, 0.774711f,
- 0.774953f, 0.775195f, 0.775438f, 0.775680f, 0.775922f, 0.776164f, 0.776405f, 0.776647f,
- 0.776888f, 0.777130f, 0.777371f, 0.777612f, 0.777853f, 0.778094f, 0.778335f, 0.778576f,
- 0.778817f, 0.779057f, 0.779297f, 0.779538f, 0.779778f, 0.780018f, 0.780258f, 0.780498f,
- 0.780737f, 0.780977f, 0.781216f, 0.781456f, 0.781695f, 0.781934f, 0.782173f, 0.782412f,
- 0.782651f, 0.782889f, 0.783128f, 0.783366f, 0.783605f, 0.783843f, 0.784081f, 0.784319f,
- 0.784557f, 0.784794f, 0.785032f, 0.785269f, 0.785507f, 0.785744f, 0.785981f, 0.786218f,
- 0.786455f, 0.786692f, 0.786929f, 0.787165f, 0.787402f, 0.787638f, 0.787874f, 0.788110f,
- 0.788346f, 0.788582f, 0.788818f, 0.789054f, 0.789289f, 0.789525f, 0.789760f, 0.789995f,
- 0.790230f, 0.790465f, 0.790700f, 0.790935f, 0.791169f, 0.791404f, 0.791638f, 0.791872f,
- 0.792107f, 0.792341f, 0.792575f, 0.792808f, 0.793042f, 0.793276f, 0.793509f, 0.793742f,
- 0.793975f, 0.794209f, 0.794442f, 0.794674f, 0.794907f, 0.795140f, 0.795372f, 0.795605f,
- 0.795837f, 0.796069f, 0.796301f, 0.796533f, 0.796765f, 0.796996f, 0.797228f, 0.797459f,
- 0.797691f, 0.797922f, 0.798153f, 0.798384f, 0.798615f, 0.798846f, 0.799076f, 0.799307f,
- 0.799537f, 0.799768f, 0.799998f, 0.800228f, 0.800458f, 0.800687f, 0.800917f, 0.801147f,
- 0.801376f, 0.801606f, 0.801835f, 0.802064f, 0.802293f, 0.802522f, 0.802750f, 0.802979f,
- 0.803208f, 0.803436f, 0.803664f, 0.803892f, 0.804120f, 0.804348f, 0.804576f, 0.804804f,
- 0.805031f, 0.805259f, 0.805486f, 0.805713f, 0.805940f, 0.806167f, 0.806394f, 0.806621f,
- 0.806848f, 0.807074f, 0.807300f, 0.807527f, 0.807753f, 0.807979f, 0.808205f, 0.808430f,
- 0.808656f, 0.808882f, 0.809107f, 0.809332f, 0.809558f, 0.809783f, 0.810008f, 0.810232f,
- 0.810457f, 0.810682f, 0.810906f, 0.811131f, 0.811355f, 0.811579f, 0.811803f, 0.812027f,
- 0.812251f, 0.812474f, 0.812698f, 0.812921f, 0.813144f, 0.813368f, 0.813591f, 0.813814f,
- 0.814036f, 0.814259f, 0.814482f, 0.814704f, 0.814926f, 0.815149f, 0.815371f, 0.815593f,
- 0.815814f, 0.816036f, 0.816258f, 0.816479f, 0.816701f, 0.816922f, 0.817143f, 0.817364f,
- 0.817585f, 0.817806f, 0.818026f, 0.818247f, 0.818467f, 0.818687f, 0.818908f, 0.819128f,
- 0.819348f, 0.819567f, 0.819787f, 0.820007f, 0.820226f, 0.820445f, 0.820664f, 0.820884f,
- 0.821102f, 0.821321f, 0.821540f, 0.821759f, 0.821977f, 0.822195f, 0.822414f, 0.822632f,
- 0.822850f, 0.823068f, 0.823285f, 0.823503f, 0.823721f, 0.823938f, 0.824155f, 0.824372f,
- 0.824589f, 0.824806f, 0.825023f, 0.825240f, 0.825456f, 0.825673f, 0.825889f, 0.826105f,
- 0.826321f, 0.826537f, 0.826753f, 0.826968f, 0.827184f, 0.827399f, 0.827615f, 0.827830f,
- 0.828045f, 0.828260f, 0.828475f, 0.828690f, 0.828904f, 0.829119f, 0.829333f, 0.829547f,
- 0.829761f, 0.829975f, 0.830189f, 0.830403f, 0.830616f, 0.830830f, 0.831043f, 0.831257f,
- 0.831470f, 0.831683f, 0.831895f, 0.832108f, 0.832321f, 0.832533f, 0.832746f, 0.832958f,
- 0.833170f, 0.833382f, 0.833594f, 0.833806f, 0.834018f, 0.834229f, 0.834440f, 0.834652f,
- 0.834863f, 0.835074f, 0.835285f, 0.835496f, 0.835706f, 0.835917f, 0.836127f, 0.836338f,
- 0.836548f, 0.836758f, 0.836968f, 0.837178f, 0.837387f, 0.837597f, 0.837806f, 0.838015f,
- 0.838225f, 0.838434f, 0.838643f, 0.838852f, 0.839060f, 0.839269f, 0.839477f, 0.839686f,
- 0.839894f, 0.840102f, 0.840310f, 0.840518f, 0.840725f, 0.840933f, 0.841140f, 0.841348f,
- 0.841555f, 0.841762f, 0.841969f, 0.842176f, 0.842383f, 0.842589f, 0.842796f, 0.843002f,
- 0.843208f, 0.843414f, 0.843620f, 0.843826f, 0.844032f, 0.844238f, 0.844443f, 0.844648f,
- 0.844854f, 0.845059f, 0.845264f, 0.845469f, 0.845673f, 0.845878f, 0.846082f, 0.846287f,
- 0.846491f, 0.846695f, 0.846899f, 0.847103f, 0.847307f, 0.847510f, 0.847714f, 0.847917f,
- 0.848120f, 0.848323f, 0.848526f, 0.848729f, 0.848932f, 0.849135f, 0.849337f, 0.849540f,
- 0.849742f, 0.849944f, 0.850146f, 0.850348f, 0.850549f, 0.850751f, 0.850953f, 0.851154f,
- 0.851355f, 0.851556f, 0.851757f, 0.851958f, 0.852159f, 0.852360f, 0.852560f, 0.852760f,
- 0.852961f, 0.853161f, 0.853361f, 0.853561f, 0.853760f, 0.853960f, 0.854159f, 0.854359f,
- 0.854558f, 0.854757f, 0.854956f, 0.855155f, 0.855354f, 0.855552f, 0.855751f, 0.855949f,
- 0.856147f, 0.856345f, 0.856543f, 0.856741f, 0.856939f, 0.857137f, 0.857334f, 0.857531f,
- 0.857729f, 0.857926f, 0.858123f, 0.858320f, 0.858516f, 0.858713f, 0.858909f, 0.859106f,
- 0.859302f, 0.859498f, 0.859694f, 0.859890f, 0.860085f, 0.860281f, 0.860476f, 0.860672f,
- 0.860867f, 0.861062f, 0.861257f, 0.861452f, 0.861646f, 0.861841f, 0.862035f, 0.862230f,
- 0.862424f, 0.862618f, 0.862812f, 0.863006f, 0.863199f, 0.863393f, 0.863586f, 0.863780f,
- 0.863973f, 0.864166f, 0.864359f, 0.864552f, 0.864744f, 0.864937f, 0.865129f, 0.865321f,
- 0.865514f, 0.865706f, 0.865898f, 0.866089f, 0.866281f, 0.866472f, 0.866664f, 0.866855f,
- 0.867046f, 0.867237f, 0.867428f, 0.867619f, 0.867809f, 0.868000f, 0.868190f, 0.868381f,
- 0.868571f, 0.868761f, 0.868951f, 0.869140f, 0.869330f, 0.869519f, 0.869709f, 0.869898f,
- 0.870087f, 0.870276f, 0.870465f, 0.870654f, 0.870842f, 0.871031f, 0.871219f, 0.871407f,
- 0.871595f, 0.871783f, 0.871971f, 0.872159f, 0.872346f, 0.872534f, 0.872721f, 0.872908f,
- 0.873095f, 0.873282f, 0.873469f, 0.873655f, 0.873842f, 0.874028f, 0.874215f, 0.874401f,
- 0.874587f, 0.874773f, 0.874958f, 0.875144f, 0.875329f, 0.875515f, 0.875700f, 0.875885f,
- 0.876070f, 0.876255f, 0.876440f, 0.876624f, 0.876809f, 0.876993f, 0.877177f, 0.877361f,
- 0.877545f, 0.877729f, 0.877913f, 0.878096f, 0.878280f, 0.878463f, 0.878646f, 0.878829f,
- 0.879012f, 0.879195f, 0.879378f, 0.879560f, 0.879743f, 0.879925f, 0.880107f, 0.880289f,
- 0.880471f, 0.880653f, 0.880834f, 0.881016f, 0.881197f, 0.881378f, 0.881559f, 0.881740f,
- 0.881921f, 0.882102f, 0.882283f, 0.882463f, 0.882643f, 0.882824f, 0.883004f, 0.883184f,
- 0.883363f, 0.883543f, 0.883723f, 0.883902f, 0.884081f, 0.884260f, 0.884439f, 0.884618f,
- 0.884797f, 0.884976f, 0.885154f, 0.885333f, 0.885511f, 0.885689f, 0.885867f, 0.886045f,
- 0.886223f, 0.886400f, 0.886578f, 0.886755f, 0.886932f, 0.887109f, 0.887286f, 0.887463f,
- 0.887640f, 0.887816f, 0.887993f, 0.888169f, 0.888345f, 0.888521f, 0.888697f, 0.888873f,
- 0.889048f, 0.889224f, 0.889399f, 0.889574f, 0.889750f, 0.889925f, 0.890099f, 0.890274f,
- 0.890449f, 0.890623f, 0.890797f, 0.890972f, 0.891146f, 0.891320f, 0.891493f, 0.891667f,
- 0.891841f, 0.892014f, 0.892187f, 0.892361f, 0.892534f, 0.892706f, 0.892879f, 0.893052f,
- 0.893224f, 0.893397f, 0.893569f, 0.893741f, 0.893913f, 0.894085f, 0.894256f, 0.894428f,
- 0.894599f, 0.894771f, 0.894942f, 0.895113f, 0.895284f, 0.895455f, 0.895625f, 0.895796f,
- 0.895966f, 0.896137f, 0.896307f, 0.896477f, 0.896646f, 0.896816f, 0.896986f, 0.897155f,
- 0.897325f, 0.897494f, 0.897663f, 0.897832f, 0.898001f, 0.898169f, 0.898338f, 0.898506f,
- 0.898674f, 0.898843f, 0.899011f, 0.899179f, 0.899346f, 0.899514f, 0.899681f, 0.899849f,
- 0.900016f, 0.900183f, 0.900350f, 0.900517f, 0.900683f, 0.900850f, 0.901016f, 0.901183f,
- 0.901349f, 0.901515f, 0.901681f, 0.901847f, 0.902012f, 0.902178f, 0.902343f, 0.902508f,
- 0.902673f, 0.902838f, 0.903003f, 0.903168f, 0.903332f, 0.903497f, 0.903661f, 0.903825f,
- 0.903989f, 0.904153f, 0.904317f, 0.904481f, 0.904644f, 0.904807f, 0.904971f, 0.905134f,
- 0.905297f, 0.905460f, 0.905622f, 0.905785f, 0.905947f, 0.906110f, 0.906272f, 0.906434f,
- 0.906596f, 0.906757f, 0.906919f, 0.907081f, 0.907242f, 0.907403f, 0.907564f, 0.907725f,
- 0.907886f, 0.908047f, 0.908207f, 0.908368f, 0.908528f, 0.908688f, 0.908848f, 0.909008f,
- 0.909168f, 0.909328f, 0.909487f, 0.909646f, 0.909806f, 0.909965f, 0.910124f, 0.910283f,
- 0.910441f, 0.910600f, 0.910758f, 0.910917f, 0.911075f, 0.911233f, 0.911391f, 0.911548f,
- 0.911706f, 0.911864f, 0.912021f, 0.912178f, 0.912335f, 0.912492f, 0.912649f, 0.912806f,
- 0.912962f, 0.913119f, 0.913275f, 0.913431f, 0.913587f, 0.913743f, 0.913899f, 0.914054f,
- 0.914210f, 0.914365f, 0.914520f, 0.914675f, 0.914830f, 0.914985f, 0.915140f, 0.915294f,
- 0.915449f, 0.915603f, 0.915757f, 0.915911f, 0.916065f, 0.916219f, 0.916372f, 0.916526f,
- 0.916679f, 0.916832f, 0.916985f, 0.917138f, 0.917291f, 0.917444f, 0.917596f, 0.917749f,
- 0.917901f, 0.918053f, 0.918205f, 0.918357f, 0.918508f, 0.918660f, 0.918811f, 0.918963f,
- 0.919114f, 0.919265f, 0.919416f, 0.919567f, 0.919717f, 0.919868f, 0.920018f, 0.920168f,
- 0.920318f, 0.920468f, 0.920618f, 0.920768f, 0.920917f, 0.921067f, 0.921216f, 0.921365f,
- 0.921514f, 0.921663f, 0.921812f, 0.921960f, 0.922109f, 0.922257f, 0.922405f, 0.922553f,
- 0.922701f, 0.922849f, 0.922997f, 0.923144f, 0.923291f, 0.923439f, 0.923586f, 0.923733f,
- 0.923880f, 0.924026f, 0.924173f, 0.924319f, 0.924465f, 0.924612f, 0.924758f, 0.924904f,
- 0.925049f, 0.925195f, 0.925340f, 0.925486f, 0.925631f, 0.925776f, 0.925921f, 0.926066f,
- 0.926210f, 0.926355f, 0.926499f, 0.926643f, 0.926787f, 0.926931f, 0.927075f, 0.927219f,
- 0.927363f, 0.927506f, 0.927649f, 0.927792f, 0.927935f, 0.928078f, 0.928221f, 0.928364f,
- 0.928506f, 0.928648f, 0.928791f, 0.928933f, 0.929075f, 0.929216f, 0.929358f, 0.929500f,
- 0.929641f, 0.929782f, 0.929923f, 0.930064f, 0.930205f, 0.930346f, 0.930486f, 0.930627f,
- 0.930767f, 0.930907f, 0.931047f, 0.931187f, 0.931327f, 0.931466f, 0.931606f, 0.931745f,
- 0.931884f, 0.932023f, 0.932162f, 0.932301f, 0.932440f, 0.932578f, 0.932716f, 0.932855f,
- 0.932993f, 0.933131f, 0.933269f, 0.933406f, 0.933544f, 0.933681f, 0.933818f, 0.933956f,
- 0.934093f, 0.934229f, 0.934366f, 0.934503f, 0.934639f, 0.934775f, 0.934912f, 0.935048f,
- 0.935184f, 0.935319f, 0.935455f, 0.935590f, 0.935726f, 0.935861f, 0.935996f, 0.936131f,
- 0.936266f, 0.936400f, 0.936535f, 0.936669f, 0.936803f, 0.936938f, 0.937072f, 0.937205f,
- 0.937339f, 0.937473f, 0.937606f, 0.937739f, 0.937872f, 0.938005f, 0.938138f, 0.938271f,
- 0.938404f, 0.938536f, 0.938668f, 0.938800f, 0.938932f, 0.939064f, 0.939196f, 0.939328f,
- 0.939459f, 0.939591f, 0.939722f, 0.939853f, 0.939984f, 0.940115f, 0.940245f, 0.940376f,
- 0.940506f, 0.940636f, 0.940766f, 0.940896f, 0.941026f, 0.941156f, 0.941285f, 0.941415f,
- 0.941544f, 0.941673f, 0.941802f, 0.941931f, 0.942060f, 0.942188f, 0.942317f, 0.942445f,
- 0.942573f, 0.942701f, 0.942829f, 0.942957f, 0.943084f, 0.943212f, 0.943339f, 0.943466f,
- 0.943593f, 0.943720f, 0.943847f, 0.943974f, 0.944100f, 0.944227f, 0.944353f, 0.944479f,
- 0.944605f, 0.944731f, 0.944856f, 0.944982f, 0.945107f, 0.945232f, 0.945358f, 0.945482f,
- 0.945607f, 0.945732f, 0.945857f, 0.945981f, 0.946105f, 0.946229f, 0.946353f, 0.946477f,
- 0.946601f, 0.946724f, 0.946848f, 0.946971f, 0.947094f, 0.947217f, 0.947340f, 0.947463f,
- 0.947586f, 0.947708f, 0.947830f, 0.947953f, 0.948075f, 0.948196f, 0.948318f, 0.948440f,
- 0.948561f, 0.948683f, 0.948804f, 0.948925f, 0.949046f, 0.949167f, 0.949287f, 0.949408f,
- 0.949528f, 0.949648f, 0.949768f, 0.949888f, 0.950008f, 0.950128f, 0.950247f, 0.950367f,
- 0.950486f, 0.950605f, 0.950724f, 0.950843f, 0.950962f, 0.951080f, 0.951199f, 0.951317f,
- 0.951435f, 0.951553f, 0.951671f, 0.951789f, 0.951906f, 0.952024f, 0.952141f, 0.952258f,
- 0.952375f, 0.952492f, 0.952609f, 0.952725f, 0.952842f, 0.952958f, 0.953074f, 0.953190f,
- 0.953306f, 0.953422f, 0.953537f, 0.953653f, 0.953768f, 0.953883f, 0.953998f, 0.954113f,
- 0.954228f, 0.954343f, 0.954457f, 0.954572f, 0.954686f, 0.954800f, 0.954914f, 0.955028f,
- 0.955141f, 0.955255f, 0.955368f, 0.955481f, 0.955594f, 0.955707f, 0.955820f, 0.955933f,
- 0.956045f, 0.956158f, 0.956270f, 0.956382f, 0.956494f, 0.956606f, 0.956717f, 0.956829f,
- 0.956940f, 0.957052f, 0.957163f, 0.957274f, 0.957385f, 0.957495f, 0.957606f, 0.957716f,
- 0.957826f, 0.957937f, 0.958046f, 0.958156f, 0.958266f, 0.958376f, 0.958485f, 0.958594f,
- 0.958703f, 0.958812f, 0.958921f, 0.959030f, 0.959139f, 0.959247f, 0.959355f, 0.959463f,
- 0.959572f, 0.959679f, 0.959787f, 0.959895f, 0.960002f, 0.960109f, 0.960217f, 0.960324f,
- 0.960431f, 0.960537f, 0.960644f, 0.960750f, 0.960857f, 0.960963f, 0.961069f, 0.961175f,
- 0.961280f, 0.961386f, 0.961492f, 0.961597f, 0.961702f, 0.961807f, 0.961912f, 0.962017f,
- 0.962121f, 0.962226f, 0.962330f, 0.962434f, 0.962538f, 0.962642f, 0.962746f, 0.962850f,
- 0.962953f, 0.963057f, 0.963160f, 0.963263f, 0.963366f, 0.963469f, 0.963571f, 0.963674f,
- 0.963776f, 0.963878f, 0.963980f, 0.964082f, 0.964184f, 0.964286f, 0.964387f, 0.964489f,
- 0.964590f, 0.964691f, 0.964792f, 0.964893f, 0.964993f, 0.965094f, 0.965194f, 0.965294f,
- 0.965394f, 0.965494f, 0.965594f, 0.965694f, 0.965793f, 0.965893f, 0.965992f, 0.966091f,
- 0.966190f, 0.966289f, 0.966387f, 0.966486f, 0.966584f, 0.966683f, 0.966781f, 0.966879f,
- 0.966976f, 0.967074f, 0.967172f, 0.967269f, 0.967366f, 0.967463f, 0.967560f, 0.967657f,
- 0.967754f, 0.967850f, 0.967947f, 0.968043f, 0.968139f, 0.968235f, 0.968331f, 0.968427f,
- 0.968522f, 0.968617f, 0.968713f, 0.968808f, 0.968903f, 0.968998f, 0.969092f, 0.969187f,
- 0.969281f, 0.969375f, 0.969470f, 0.969564f, 0.969657f, 0.969751f, 0.969845f, 0.969938f,
- 0.970031f, 0.970124f, 0.970217f, 0.970310f, 0.970403f, 0.970495f, 0.970588f, 0.970680f,
- 0.970772f, 0.970864f, 0.970956f, 0.971048f, 0.971139f, 0.971231f, 0.971322f, 0.971413f,
- 0.971504f, 0.971595f, 0.971685f, 0.971776f, 0.971866f, 0.971957f, 0.972047f, 0.972137f,
- 0.972227f, 0.972316f, 0.972406f, 0.972495f, 0.972584f, 0.972673f, 0.972762f, 0.972851f,
- 0.972940f, 0.973028f, 0.973117f, 0.973205f, 0.973293f, 0.973381f, 0.973469f, 0.973557f,
- 0.973644f, 0.973732f, 0.973819f, 0.973906f, 0.973993f, 0.974080f, 0.974166f, 0.974253f,
- 0.974339f, 0.974426f, 0.974512f, 0.974598f, 0.974684f, 0.974769f, 0.974855f, 0.974940f,
- 0.975025f, 0.975110f, 0.975195f, 0.975280f, 0.975365f, 0.975449f, 0.975534f, 0.975618f,
- 0.975702f, 0.975786f, 0.975870f, 0.975954f, 0.976037f, 0.976120f, 0.976204f, 0.976287f,
- 0.976370f, 0.976453f, 0.976535f, 0.976618f, 0.976700f, 0.976782f, 0.976864f, 0.976946f,
- 0.977028f, 0.977110f, 0.977191f, 0.977273f, 0.977354f, 0.977435f, 0.977516f, 0.977597f,
- 0.977677f, 0.977758f, 0.977838f, 0.977918f, 0.977998f, 0.978078f, 0.978158f, 0.978238f,
- 0.978317f, 0.978397f, 0.978476f, 0.978555f, 0.978634f, 0.978713f, 0.978791f, 0.978870f,
- 0.978948f, 0.979026f, 0.979104f, 0.979182f, 0.979260f, 0.979338f, 0.979415f, 0.979493f,
- 0.979570f, 0.979647f, 0.979724f, 0.979800f, 0.979877f, 0.979954f, 0.980030f, 0.980106f,
- 0.980182f, 0.980258f, 0.980334f, 0.980409f, 0.980485f, 0.980560f, 0.980635f, 0.980710f,
- 0.980785f, 0.980860f, 0.980935f, 0.981009f, 0.981083f, 0.981158f, 0.981232f, 0.981305f,
- 0.981379f, 0.981453f, 0.981526f, 0.981600f, 0.981673f, 0.981746f, 0.981819f, 0.981891f,
- 0.981964f, 0.982036f, 0.982109f, 0.982181f, 0.982253f, 0.982325f, 0.982396f, 0.982468f,
- 0.982539f, 0.982611f, 0.982682f, 0.982753f, 0.982824f, 0.982894f, 0.982965f, 0.983035f,
- 0.983105f, 0.983176f, 0.983246f, 0.983315f, 0.983385f, 0.983455f, 0.983524f, 0.983593f,
- 0.983662f, 0.983731f, 0.983800f, 0.983869f, 0.983937f, 0.984006f, 0.984074f, 0.984142f,
- 0.984210f, 0.984278f, 0.984346f, 0.984413f, 0.984480f, 0.984548f, 0.984615f, 0.984682f,
- 0.984748f, 0.984815f, 0.984882f, 0.984948f, 0.985014f, 0.985080f, 0.985146f, 0.985212f,
- 0.985278f, 0.985343f, 0.985408f, 0.985474f, 0.985539f, 0.985604f, 0.985668f, 0.985733f,
- 0.985798f, 0.985862f, 0.985926f, 0.985990f, 0.986054f, 0.986118f, 0.986181f, 0.986245f,
- 0.986308f, 0.986371f, 0.986434f, 0.986497f, 0.986560f, 0.986623f, 0.986685f, 0.986747f,
- 0.986809f, 0.986871f, 0.986933f, 0.986995f, 0.987057f, 0.987118f, 0.987179f, 0.987240f,
- 0.987301f, 0.987362f, 0.987423f, 0.987484f, 0.987544f, 0.987604f, 0.987664f, 0.987724f,
- 0.987784f, 0.987844f, 0.987903f, 0.987963f, 0.988022f, 0.988081f, 0.988140f, 0.988199f,
- 0.988258f, 0.988316f, 0.988374f, 0.988433f, 0.988491f, 0.988549f, 0.988607f, 0.988664f,
- 0.988722f, 0.988779f, 0.988836f, 0.988893f, 0.988950f, 0.989007f, 0.989064f, 0.989120f,
- 0.989177f, 0.989233f, 0.989289f, 0.989345f, 0.989400f, 0.989456f, 0.989511f, 0.989567f,
- 0.989622f, 0.989677f, 0.989732f, 0.989787f, 0.989841f, 0.989896f, 0.989950f, 0.990004f,
- 0.990058f, 0.990112f, 0.990166f, 0.990219f, 0.990273f, 0.990326f, 0.990379f, 0.990432f,
- 0.990485f, 0.990538f, 0.990590f, 0.990643f, 0.990695f, 0.990747f, 0.990799f, 0.990851f,
- 0.990903f, 0.990954f, 0.991006f, 0.991057f, 0.991108f, 0.991159f, 0.991210f, 0.991260f,
- 0.991311f, 0.991361f, 0.991411f, 0.991462f, 0.991511f, 0.991561f, 0.991611f, 0.991660f,
- 0.991710f, 0.991759f, 0.991808f, 0.991857f, 0.991906f, 0.991954f, 0.992003f, 0.992051f,
- 0.992099f, 0.992147f, 0.992195f, 0.992243f, 0.992291f, 0.992338f, 0.992385f, 0.992433f,
- 0.992480f, 0.992526f, 0.992573f, 0.992620f, 0.992666f, 0.992712f, 0.992759f, 0.992805f,
- 0.992850f, 0.992896f, 0.992942f, 0.992987f, 0.993032f, 0.993077f, 0.993122f, 0.993167f,
- 0.993212f, 0.993257f, 0.993301f, 0.993345f, 0.993389f, 0.993433f, 0.993477f, 0.993521f,
- 0.993564f, 0.993608f, 0.993651f, 0.993694f, 0.993737f, 0.993779f, 0.993822f, 0.993865f,
- 0.993907f, 0.993949f, 0.993991f, 0.994033f, 0.994075f, 0.994116f, 0.994158f, 0.994199f,
- 0.994240f, 0.994281f, 0.994322f, 0.994363f, 0.994404f, 0.994444f, 0.994484f, 0.994525f,
- 0.994565f, 0.994604f, 0.994644f, 0.994684f, 0.994723f, 0.994762f, 0.994802f, 0.994841f,
- 0.994879f, 0.994918f, 0.994957f, 0.994995f, 0.995033f, 0.995071f, 0.995109f, 0.995147f,
- 0.995185f, 0.995222f, 0.995260f, 0.995297f, 0.995334f, 0.995371f, 0.995408f, 0.995444f,
- 0.995481f, 0.995517f, 0.995553f, 0.995589f, 0.995625f, 0.995661f, 0.995697f, 0.995732f,
- 0.995767f, 0.995803f, 0.995838f, 0.995872f, 0.995907f, 0.995942f, 0.995976f, 0.996011f,
- 0.996045f, 0.996079f, 0.996113f, 0.996146f, 0.996180f, 0.996213f, 0.996247f, 0.996280f,
- 0.996313f, 0.996345f, 0.996378f, 0.996411f, 0.996443f, 0.996475f, 0.996507f, 0.996539f,
- 0.996571f, 0.996603f, 0.996634f, 0.996666f, 0.996697f, 0.996728f, 0.996759f, 0.996790f,
- 0.996820f, 0.996851f, 0.996881f, 0.996911f, 0.996941f, 0.996971f, 0.997001f, 0.997031f,
- 0.997060f, 0.997089f, 0.997119f, 0.997148f, 0.997176f, 0.997205f, 0.997234f, 0.997262f,
- 0.997290f, 0.997319f, 0.997347f, 0.997374f, 0.997402f, 0.997430f, 0.997457f, 0.997484f,
- 0.997511f, 0.997538f, 0.997565f, 0.997592f, 0.997618f, 0.997645f, 0.997671f, 0.997697f,
- 0.997723f, 0.997749f, 0.997774f, 0.997800f, 0.997825f, 0.997851f, 0.997876f, 0.997901f,
- 0.997925f, 0.997950f, 0.997974f, 0.997999f, 0.998023f, 0.998047f, 0.998071f, 0.998094f,
- 0.998118f, 0.998142f, 0.998165f, 0.998188f, 0.998211f, 0.998234f, 0.998257f, 0.998279f,
- 0.998302f, 0.998324f, 0.998346f, 0.998368f, 0.998390f, 0.998411f, 0.998433f, 0.998454f,
- 0.998476f, 0.998497f, 0.998518f, 0.998538f, 0.998559f, 0.998580f, 0.998600f, 0.998620f,
- 0.998640f, 0.998660f, 0.998680f, 0.998700f, 0.998719f, 0.998738f, 0.998758f, 0.998777f,
- 0.998795f, 0.998814f, 0.998833f, 0.998851f, 0.998870f, 0.998888f, 0.998906f, 0.998924f,
- 0.998941f, 0.998959f, 0.998976f, 0.998994f, 0.999011f, 0.999028f, 0.999044f, 0.999061f,
- 0.999078f, 0.999094f, 0.999110f, 0.999126f, 0.999142f, 0.999158f, 0.999174f, 0.999189f,
- 0.999205f, 0.999220f, 0.999235f, 0.999250f, 0.999265f, 0.999279f, 0.999294f, 0.999308f,
- 0.999322f, 0.999336f, 0.999350f, 0.999364f, 0.999378f, 0.999391f, 0.999404f, 0.999418f,
- 0.999431f, 0.999443f, 0.999456f, 0.999469f, 0.999481f, 0.999493f, 0.999506f, 0.999518f,
- 0.999529f, 0.999541f, 0.999553f, 0.999564f, 0.999575f, 0.999586f, 0.999597f, 0.999608f,
- 0.999619f, 0.999629f, 0.999640f, 0.999650f, 0.999660f, 0.999670f, 0.999680f, 0.999689f,
- 0.999699f, 0.999708f, 0.999717f, 0.999726f, 0.999735f, 0.999744f, 0.999753f, 0.999761f,
- 0.999769f, 0.999778f, 0.999786f, 0.999793f, 0.999801f, 0.999809f, 0.999816f, 0.999823f,
- 0.999831f, 0.999838f, 0.999844f, 0.999851f, 0.999858f, 0.999864f, 0.999870f, 0.999876f,
- 0.999882f, 0.999888f, 0.999894f, 0.999899f, 0.999905f, 0.999910f, 0.999915f, 0.999920f,
- 0.999925f, 0.999929f, 0.999934f, 0.999938f, 0.999942f, 0.999946f, 0.999950f, 0.999954f,
- 0.999958f, 0.999961f, 0.999964f, 0.999968f, 0.999971f, 0.999973f, 0.999976f, 0.999979f,
- 0.999981f, 0.999983f, 0.999986f, 0.999988f, 0.999989f, 0.999991f, 0.999993f, 0.999994f,
- 0.999995f, 0.999996f, 0.999997f, 0.999998f, 0.999999f, 0.999999f, 1.000000f, 1.000000f,
- 0.000000f, -0.000383f, -0.000767f, -0.001150f, -0.001534f, -0.001917f, -0.002301f, -0.002684f,
- -0.003068f, -0.003451f, -0.003835f, -0.004218f, -0.004602f, -0.004985f, -0.005369f, -0.005752f,
- -0.006136f, -0.006519f, -0.006903f, -0.007286f, -0.007670f, -0.008053f, -0.008437f, -0.008820f,
- -0.009204f, -0.009587f, -0.009971f, -0.010354f, -0.010738f, -0.011121f, -0.011505f, -0.011888f,
- -0.012272f, -0.012655f, -0.013038f, -0.013422f, -0.013805f, -0.014189f, -0.014572f, -0.014956f,
- -0.015339f, -0.015723f, -0.016106f, -0.016490f, -0.016873f, -0.017256f, -0.017640f, -0.018023f,
- -0.018407f, -0.018790f, -0.019174f, -0.019557f, -0.019940f, -0.020324f, -0.020707f, -0.021091f,
- -0.021474f, -0.021857f, -0.022241f, -0.022624f, -0.023008f, -0.023391f, -0.023774f, -0.024158f,
- -0.024541f, -0.024925f, -0.025308f, -0.025691f, -0.026075f, -0.026458f, -0.026841f, -0.027225f,
- -0.027608f, -0.027991f, -0.028375f, -0.028758f, -0.029142f, -0.029525f, -0.029908f, -0.030291f,
- -0.030675f, -0.031058f, -0.031441f, -0.031825f, -0.032208f, -0.032591f, -0.032975f, -0.033358f,
- -0.033741f, -0.034124f, -0.034508f, -0.034891f, -0.035274f, -0.035657f, -0.036041f, -0.036424f,
- -0.036807f, -0.037190f, -0.037574f, -0.037957f, -0.038340f, -0.038723f, -0.039107f, -0.039490f,
- -0.039873f, -0.040256f, -0.040639f, -0.041022f, -0.041406f, -0.041789f, -0.042172f, -0.042555f,
- -0.042938f, -0.043321f, -0.043705f, -0.044088f, -0.044471f, -0.044854f, -0.045237f, -0.045620f,
- -0.046003f, -0.046386f, -0.046769f, -0.047152f, -0.047535f, -0.047919f, -0.048302f, -0.048685f,
- -0.049068f, -0.049451f, -0.049834f, -0.050217f, -0.050600f, -0.050983f, -0.051366f, -0.051749f,
- -0.052132f, -0.052515f, -0.052898f, -0.053281f, -0.053664f, -0.054046f, -0.054429f, -0.054812f,
- -0.055195f, -0.055578f, -0.055961f, -0.056344f, -0.056727f, -0.057110f, -0.057493f, -0.057875f,
- -0.058258f, -0.058641f, -0.059024f, -0.059407f, -0.059790f, -0.060172f, -0.060555f, -0.060938f,
- -0.061321f, -0.061704f, -0.062086f, -0.062469f, -0.062852f, -0.063234f, -0.063617f, -0.064000f,
- -0.064383f, -0.064765f, -0.065148f, -0.065531f, -0.065913f, -0.066296f, -0.066679f, -0.067061f,
- -0.067444f, -0.067827f, -0.068209f, -0.068592f, -0.068974f, -0.069357f, -0.069739f, -0.070122f,
- -0.070505f, -0.070887f, -0.071270f, -0.071652f, -0.072035f, -0.072417f, -0.072800f, -0.073182f,
- -0.073565f, -0.073947f, -0.074329f, -0.074712f, -0.075094f, -0.075477f, -0.075859f, -0.076241f,
- -0.076624f, -0.077006f, -0.077389f, -0.077771f, -0.078153f, -0.078536f, -0.078918f, -0.079300f,
- -0.079682f, -0.080065f, -0.080447f, -0.080829f, -0.081211f, -0.081594f, -0.081976f, -0.082358f,
- -0.082740f, -0.083122f, -0.083505f, -0.083887f, -0.084269f, -0.084651f, -0.085033f, -0.085415f,
- -0.085797f, -0.086179f, -0.086561f, -0.086943f, -0.087326f, -0.087708f, -0.088090f, -0.088472f,
- -0.088854f, -0.089236f, -0.089617f, -0.089999f, -0.090381f, -0.090763f, -0.091145f, -0.091527f,
- -0.091909f, -0.092291f, -0.092673f, -0.093055f, -0.093436f, -0.093818f, -0.094200f, -0.094582f,
- -0.094963f, -0.095345f, -0.095727f, -0.096109f, -0.096490f, -0.096872f, -0.097254f, -0.097635f,
- -0.098017f, -0.098399f, -0.098780f, -0.099162f, -0.099544f, -0.099925f, -0.100307f, -0.100688f,
- -0.101070f, -0.101451f, -0.101833f, -0.102214f, -0.102596f, -0.102977f, -0.103359f, -0.103740f,
- -0.104122f, -0.104503f, -0.104884f, -0.105266f, -0.105647f, -0.106028f, -0.106410f, -0.106791f,
- -0.107172f, -0.107554f, -0.107935f, -0.108316f, -0.108697f, -0.109079f, -0.109460f, -0.109841f,
- -0.110222f, -0.110603f, -0.110984f, -0.111366f, -0.111747f, -0.112128f, -0.112509f, -0.112890f,
- -0.113271f, -0.113652f, -0.114033f, -0.114414f, -0.114795f, -0.115176f, -0.115557f, -0.115938f,
- -0.116319f, -0.116700f, -0.117080f, -0.117461f, -0.117842f, -0.118223f, -0.118604f, -0.118984f,
- -0.119365f, -0.119746f, -0.120127f, -0.120507f, -0.120888f, -0.121269f, -0.121649f, -0.122030f,
- -0.122411f, -0.122791f, -0.123172f, -0.123552f, -0.123933f, -0.124314f, -0.124694f, -0.125075f,
- -0.125455f, -0.125835f, -0.126216f, -0.126596f, -0.126977f, -0.127357f, -0.127737f, -0.128118f,
- -0.128498f, -0.128878f, -0.129259f, -0.129639f, -0.130019f, -0.130399f, -0.130780f, -0.131160f,
- -0.131540f, -0.131920f, -0.132300f, -0.132680f, -0.133061f, -0.133441f, -0.133821f, -0.134201f,
- -0.134581f, -0.134961f, -0.135341f, -0.135721f, -0.136101f, -0.136480f, -0.136860f, -0.137240f,
- -0.137620f, -0.138000f, -0.138380f, -0.138760f, -0.139139f, -0.139519f, -0.139899f, -0.140279f,
- -0.140658f, -0.141038f, -0.141418f, -0.141797f, -0.142177f, -0.142556f, -0.142936f, -0.143316f,
- -0.143695f, -0.144075f, -0.144454f, -0.144833f, -0.145213f, -0.145592f, -0.145972f, -0.146351f,
- -0.146730f, -0.147110f, -0.147489f, -0.147868f, -0.148248f, -0.148627f, -0.149006f, -0.149385f,
- -0.149765f, -0.150144f, -0.150523f, -0.150902f, -0.151281f, -0.151660f, -0.152039f, -0.152418f,
- -0.152797f, -0.153176f, -0.153555f, -0.153934f, -0.154313f, -0.154692f, -0.155071f, -0.155450f,
- -0.155828f, -0.156207f, -0.156586f, -0.156965f, -0.157343f, -0.157722f, -0.158101f, -0.158480f,
- -0.158858f, -0.159237f, -0.159615f, -0.159994f, -0.160372f, -0.160751f, -0.161129f, -0.161508f,
- -0.161886f, -0.162265f, -0.162643f, -0.163022f, -0.163400f, -0.163778f, -0.164157f, -0.164535f,
- -0.164913f, -0.165291f, -0.165670f, -0.166048f, -0.166426f, -0.166804f, -0.167182f, -0.167560f,
- -0.167938f, -0.168316f, -0.168694f, -0.169072f, -0.169450f, -0.169828f, -0.170206f, -0.170584f,
- -0.170962f, -0.171340f, -0.171718f, -0.172095f, -0.172473f, -0.172851f, -0.173229f, -0.173606f,
- -0.173984f, -0.174362f, -0.174739f, -0.175117f, -0.175494f, -0.175872f, -0.176249f, -0.176627f,
- -0.177004f, -0.177382f, -0.177759f, -0.178136f, -0.178514f, -0.178891f, -0.179268f, -0.179646f,
- -0.180023f, -0.180400f, -0.180777f, -0.181154f, -0.181532f, -0.181909f, -0.182286f, -0.182663f,
- -0.183040f, -0.183417f, -0.183794f, -0.184171f, -0.184548f, -0.184925f, -0.185301f, -0.185678f,
- -0.186055f, -0.186432f, -0.186809f, -0.187185f, -0.187562f, -0.187939f, -0.188315f, -0.188692f,
- -0.189069f, -0.189445f, -0.189822f, -0.190198f, -0.190575f, -0.190951f, -0.191328f, -0.191704f,
- -0.192080f, -0.192457f, -0.192833f, -0.193209f, -0.193586f, -0.193962f, -0.194338f, -0.194714f,
- -0.195090f, -0.195466f, -0.195843f, -0.196219f, -0.196595f, -0.196971f, -0.197347f, -0.197722f,
- -0.198098f, -0.198474f, -0.198850f, -0.199226f, -0.199602f, -0.199978f, -0.200353f, -0.200729f,
- -0.201105f, -0.201480f, -0.201856f, -0.202231f, -0.202607f, -0.202983f, -0.203358f, -0.203734f,
- -0.204109f, -0.204484f, -0.204860f, -0.205235f, -0.205610f, -0.205986f, -0.206361f, -0.206736f,
- -0.207111f, -0.207487f, -0.207862f, -0.208237f, -0.208612f, -0.208987f, -0.209362f, -0.209737f,
- -0.210112f, -0.210487f, -0.210862f, -0.211237f, -0.211611f, -0.211986f, -0.212361f, -0.212736f,
- -0.213110f, -0.213485f, -0.213860f, -0.214234f, -0.214609f, -0.214983f, -0.215358f, -0.215732f,
- -0.216107f, -0.216481f, -0.216856f, -0.217230f, -0.217604f, -0.217979f, -0.218353f, -0.218727f,
- -0.219101f, -0.219475f, -0.219850f, -0.220224f, -0.220598f, -0.220972f, -0.221346f, -0.221720f,
- -0.222094f, -0.222468f, -0.222841f, -0.223215f, -0.223589f, -0.223963f, -0.224337f, -0.224710f,
- -0.225084f, -0.225458f, -0.225831f, -0.226205f, -0.226578f, -0.226952f, -0.227325f, -0.227699f,
- -0.228072f, -0.228445f, -0.228819f, -0.229192f, -0.229565f, -0.229939f, -0.230312f, -0.230685f,
- -0.231058f, -0.231431f, -0.231804f, -0.232177f, -0.232550f, -0.232923f, -0.233296f, -0.233669f,
- -0.234042f, -0.234415f, -0.234788f, -0.235160f, -0.235533f, -0.235906f, -0.236278f, -0.236651f,
- -0.237024f, -0.237396f, -0.237769f, -0.238141f, -0.238514f, -0.238886f, -0.239258f, -0.239631f,
- -0.240003f, -0.240375f, -0.240748f, -0.241120f, -0.241492f, -0.241864f, -0.242236f, -0.242608f,
- -0.242980f, -0.243352f, -0.243724f, -0.244096f, -0.244468f, -0.244840f, -0.245212f, -0.245583f,
- -0.245955f, -0.246327f, -0.246698f, -0.247070f, -0.247442f, -0.247813f, -0.248185f, -0.248556f,
- -0.248928f, -0.249299f, -0.249670f, -0.250042f, -0.250413f, -0.250784f, -0.251155f, -0.251527f,
- -0.251898f, -0.252269f, -0.252640f, -0.253011f, -0.253382f, -0.253753f, -0.254124f, -0.254495f,
- -0.254866f, -0.255236f, -0.255607f, -0.255978f, -0.256349f, -0.256719f, -0.257090f, -0.257461f,
- -0.257831f, -0.258202f, -0.258572f, -0.258943f, -0.259313f, -0.259683f, -0.260054f, -0.260424f,
- -0.260794f, -0.261164f, -0.261534f, -0.261905f, -0.262275f, -0.262645f, -0.263015f, -0.263385f,
- -0.263755f, -0.264125f, -0.264494f, -0.264864f, -0.265234f, -0.265604f, -0.265973f, -0.266343f,
- -0.266713f, -0.267082f, -0.267452f, -0.267821f, -0.268191f, -0.268560f, -0.268930f, -0.269299f,
- -0.269668f, -0.270038f, -0.270407f, -0.270776f, -0.271145f, -0.271514f, -0.271883f, -0.272252f,
- -0.272621f, -0.272990f, -0.273359f, -0.273728f, -0.274097f, -0.274466f, -0.274834f, -0.275203f,
- -0.275572f, -0.275940f, -0.276309f, -0.276678f, -0.277046f, -0.277415f, -0.277783f, -0.278151f,
- -0.278520f, -0.278888f, -0.279256f, -0.279624f, -0.279993f, -0.280361f, -0.280729f, -0.281097f,
- -0.281465f, -0.281833f, -0.282201f, -0.282569f, -0.282937f, -0.283304f, -0.283672f, -0.284040f,
- -0.284408f, -0.284775f, -0.285143f, -0.285510f, -0.285878f, -0.286245f, -0.286613f, -0.286980f,
- -0.287347f, -0.287715f, -0.288082f, -0.288449f, -0.288816f, -0.289184f, -0.289551f, -0.289918f,
- -0.290285f, -0.290652f, -0.291019f, -0.291385f, -0.291752f, -0.292119f, -0.292486f, -0.292852f,
- -0.293219f, -0.293586f, -0.293952f, -0.294319f, -0.294685f, -0.295052f, -0.295418f, -0.295785f,
- -0.296151f, -0.296517f, -0.296883f, -0.297250f, -0.297616f, -0.297982f, -0.298348f, -0.298714f,
- -0.299080f, -0.299446f, -0.299812f, -0.300177f, -0.300543f, -0.300909f, -0.301275f, -0.301640f,
- -0.302006f, -0.302372f, -0.302737f, -0.303103f, -0.303468f, -0.303833f, -0.304199f, -0.304564f,
- -0.304929f, -0.305294f, -0.305660f, -0.306025f, -0.306390f, -0.306755f, -0.307120f, -0.307485f,
- -0.307850f, -0.308214f, -0.308579f, -0.308944f, -0.309309f, -0.309673f, -0.310038f, -0.310403f,
- -0.310767f, -0.311132f, -0.311496f, -0.311860f, -0.312225f, -0.312589f, -0.312953f, -0.313318f,
- -0.313682f, -0.314046f, -0.314410f, -0.314774f, -0.315138f, -0.315502f, -0.315866f, -0.316230f,
- -0.316593f, -0.316957f, -0.317321f, -0.317684f, -0.318048f, -0.318412f, -0.318775f, -0.319139f,
- -0.319502f, -0.319865f, -0.320229f, -0.320592f, -0.320955f, -0.321318f, -0.321682f, -0.322045f,
- -0.322408f, -0.322771f, -0.323134f, -0.323497f, -0.323859f, -0.324222f, -0.324585f, -0.324948f,
- -0.325310f, -0.325673f, -0.326035f, -0.326398f, -0.326760f, -0.327123f, -0.327485f, -0.327848f,
- -0.328210f, -0.328572f, -0.328934f, -0.329296f, -0.329658f, -0.330020f, -0.330382f, -0.330744f,
- -0.331106f, -0.331468f, -0.331830f, -0.332192f, -0.332553f, -0.332915f, -0.333277f, -0.333638f,
- -0.334000f, -0.334361f, -0.334722f, -0.335084f, -0.335445f, -0.335806f, -0.336168f, -0.336529f,
- -0.336890f, -0.337251f, -0.337612f, -0.337973f, -0.338334f, -0.338695f, -0.339055f, -0.339416f,
- -0.339777f, -0.340138f, -0.340498f, -0.340859f, -0.341219f, -0.341580f, -0.341940f, -0.342300f,
- -0.342661f, -0.343021f, -0.343381f, -0.343741f, -0.344101f, -0.344461f, -0.344821f, -0.345181f,
- -0.345541f, -0.345901f, -0.346261f, -0.346621f, -0.346980f, -0.347340f, -0.347700f, -0.348059f,
- -0.348419f, -0.348778f, -0.349138f, -0.349497f, -0.349856f, -0.350215f, -0.350575f, -0.350934f,
- -0.351293f, -0.351652f, -0.352011f, -0.352370f, -0.352729f, -0.353087f, -0.353446f, -0.353805f,
- -0.354164f, -0.354522f, -0.354881f, -0.355239f, -0.355598f, -0.355956f, -0.356314f, -0.356673f,
- -0.357031f, -0.357389f, -0.357747f, -0.358105f, -0.358463f, -0.358821f, -0.359179f, -0.359537f,
- -0.359895f, -0.360253f, -0.360611f, -0.360968f, -0.361326f, -0.361683f, -0.362041f, -0.362398f,
- -0.362756f, -0.363113f, -0.363470f, -0.363828f, -0.364185f, -0.364542f, -0.364899f, -0.365256f,
- -0.365613f, -0.365970f, -0.366327f, -0.366684f, -0.367040f, -0.367397f, -0.367754f, -0.368110f,
- -0.368467f, -0.368823f, -0.369180f, -0.369536f, -0.369892f, -0.370249f, -0.370605f, -0.370961f,
- -0.371317f, -0.371673f, -0.372029f, -0.372385f, -0.372741f, -0.373097f, -0.373453f, -0.373808f,
- -0.374164f, -0.374520f, -0.374875f, -0.375231f, -0.375586f, -0.375942f, -0.376297f, -0.376652f,
- -0.377007f, -0.377363f, -0.377718f, -0.378073f, -0.378428f, -0.378783f, -0.379138f, -0.379492f,
- -0.379847f, -0.380202f, -0.380557f, -0.380911f, -0.381266f, -0.381620f, -0.381975f, -0.382329f,
- -0.382683f, -0.383038f, -0.383392f, -0.383746f, -0.384100f, -0.384454f, -0.384808f, -0.385162f,
- -0.385516f, -0.385870f, -0.386224f, -0.386577f, -0.386931f, -0.387285f, -0.387638f, -0.387992f,
- -0.388345f, -0.388698f, -0.389052f, -0.389405f, -0.389758f, -0.390111f, -0.390464f, -0.390817f,
- -0.391170f, -0.391523f, -0.391876f, -0.392229f, -0.392582f, -0.392934f, -0.393287f, -0.393640f,
- -0.393992f, -0.394344f, -0.394697f, -0.395049f, -0.395401f, -0.395754f, -0.396106f, -0.396458f,
- -0.396810f, -0.397162f, -0.397514f, -0.397866f, -0.398218f, -0.398569f, -0.398921f, -0.399273f,
- -0.399624f, -0.399976f, -0.400327f, -0.400679f, -0.401030f, -0.401381f, -0.401732f, -0.402084f,
- -0.402435f, -0.402786f, -0.403137f, -0.403488f, -0.403838f, -0.404189f, -0.404540f, -0.404891f,
- -0.405241f, -0.405592f, -0.405942f, -0.406293f, -0.406643f, -0.406994f, -0.407344f, -0.407694f,
- -0.408044f, -0.408394f, -0.408744f, -0.409094f, -0.409444f, -0.409794f, -0.410144f, -0.410493f,
- -0.410843f, -0.411193f, -0.411542f, -0.411892f, -0.412241f, -0.412591f, -0.412940f, -0.413289f,
- -0.413638f, -0.413987f, -0.414337f, -0.414685f, -0.415034f, -0.415383f, -0.415732f, -0.416081f,
- -0.416430f, -0.416778f, -0.417127f, -0.417475f, -0.417824f, -0.418172f, -0.418520f, -0.418869f,
- -0.419217f, -0.419565f, -0.419913f, -0.420261f, -0.420609f, -0.420957f, -0.421305f, -0.421653f,
- -0.422000f, -0.422348f, -0.422695f, -0.423043f, -0.423390f, -0.423738f, -0.424085f, -0.424432f,
- -0.424780f, -0.425127f, -0.425474f, -0.425821f, -0.426168f, -0.426515f, -0.426862f, -0.427208f,
- -0.427555f, -0.427902f, -0.428248f, -0.428595f, -0.428941f, -0.429288f, -0.429634f, -0.429980f,
- -0.430326f, -0.430673f, -0.431019f, -0.431365f, -0.431711f, -0.432057f, -0.432402f, -0.432748f,
- -0.433094f, -0.433439f, -0.433785f, -0.434131f, -0.434476f, -0.434821f, -0.435167f, -0.435512f,
- -0.435857f, -0.436202f, -0.436547f, -0.436892f, -0.437237f, -0.437582f, -0.437927f, -0.438272f,
- -0.438616f, -0.438961f, -0.439305f, -0.439650f, -0.439994f, -0.440339f, -0.440683f, -0.441027f,
- -0.441371f, -0.441715f, -0.442059f, -0.442403f, -0.442747f, -0.443091f, -0.443435f, -0.443779f,
- -0.444122f, -0.444466f, -0.444809f, -0.445153f, -0.445496f, -0.445839f, -0.446183f, -0.446526f,
- -0.446869f, -0.447212f, -0.447555f, -0.447898f, -0.448241f, -0.448583f, -0.448926f, -0.449269f,
- -0.449611f, -0.449954f, -0.450296f, -0.450639f, -0.450981f, -0.451323f, -0.451665f, -0.452008f,
- -0.452350f, -0.452692f, -0.453033f, -0.453375f, -0.453717f, -0.454059f, -0.454400f, -0.454742f,
- -0.455084f, -0.455425f, -0.455766f, -0.456108f, -0.456449f, -0.456790f, -0.457131f, -0.457472f,
- -0.457813f, -0.458154f, -0.458495f, -0.458836f, -0.459177f, -0.459517f, -0.459858f, -0.460198f,
- -0.460539f, -0.460879f, -0.461219f, -0.461560f, -0.461900f, -0.462240f, -0.462580f, -0.462920f,
- -0.463260f, -0.463600f, -0.463939f, -0.464279f, -0.464619f, -0.464958f, -0.465298f, -0.465637f,
- -0.465977f, -0.466316f, -0.466655f, -0.466994f, -0.467333f, -0.467672f, -0.468011f, -0.468350f,
- -0.468689f, -0.469028f, -0.469366f, -0.469705f, -0.470043f, -0.470382f, -0.470720f, -0.471058f,
- -0.471397f, -0.471735f, -0.472073f, -0.472411f, -0.472749f, -0.473087f, -0.473425f, -0.473763f,
- -0.474100f, -0.474438f, -0.474775f, -0.475113f, -0.475450f, -0.475788f, -0.476125f, -0.476462f,
- -0.476799f, -0.477136f, -0.477473f, -0.477810f, -0.478147f, -0.478484f, -0.478821f, -0.479157f,
- -0.479494f, -0.479830f, -0.480167f, -0.480503f, -0.480839f, -0.481176f, -0.481512f, -0.481848f,
- -0.482184f, -0.482520f, -0.482856f, -0.483191f, -0.483527f, -0.483863f, -0.484198f, -0.484534f,
- -0.484869f, -0.485205f, -0.485540f, -0.485875f, -0.486210f, -0.486545f, -0.486880f, -0.487215f,
- -0.487550f, -0.487885f, -0.488220f, -0.488554f, -0.488889f, -0.489223f, -0.489558f, -0.489892f,
- -0.490226f, -0.490561f, -0.490895f, -0.491229f, -0.491563f, -0.491897f, -0.492231f, -0.492564f,
- -0.492898f, -0.493232f, -0.493565f, -0.493899f, -0.494232f, -0.494566f, -0.494899f, -0.495232f,
- -0.495565f, -0.495898f, -0.496231f, -0.496564f, -0.496897f, -0.497230f, -0.497562f, -0.497895f,
- -0.498228f, -0.498560f, -0.498893f, -0.499225f, -0.499557f, -0.499889f, -0.500221f, -0.500553f,
- -0.500885f, -0.501217f, -0.501549f, -0.501881f, -0.502212f, -0.502544f, -0.502876f, -0.503207f,
- -0.503538f, -0.503870f, -0.504201f, -0.504532f, -0.504863f, -0.505194f, -0.505525f, -0.505856f,
- -0.506187f, -0.506517f, -0.506848f, -0.507179f, -0.507509f, -0.507839f, -0.508170f, -0.508500f,
- -0.508830f, -0.509160f, -0.509490f, -0.509820f, -0.510150f, -0.510480f, -0.510810f, -0.511139f,
- -0.511469f, -0.511798f, -0.512128f, -0.512457f, -0.512786f, -0.513116f, -0.513445f, -0.513774f,
- -0.514103f, -0.514432f, -0.514760f, -0.515089f, -0.515418f, -0.515746f, -0.516075f, -0.516403f,
- -0.516732f, -0.517060f, -0.517388f, -0.517716f, -0.518045f, -0.518372f, -0.518700f, -0.519028f,
- -0.519356f, -0.519684f, -0.520011f, -0.520339f, -0.520666f, -0.520994f, -0.521321f, -0.521648f,
- -0.521975f, -0.522302f, -0.522629f, -0.522956f, -0.523283f, -0.523610f, -0.523937f, -0.524263f,
- -0.524590f, -0.524916f, -0.525243f, -0.525569f, -0.525895f, -0.526221f, -0.526547f, -0.526873f,
- -0.527199f, -0.527525f, -0.527851f, -0.528176f, -0.528502f, -0.528828f, -0.529153f, -0.529478f,
- -0.529804f, -0.530129f, -0.530454f, -0.530779f, -0.531104f, -0.531429f, -0.531754f, -0.532078f,
- -0.532403f, -0.532728f, -0.533052f, -0.533377f, -0.533701f, -0.534025f, -0.534349f, -0.534674f,
- -0.534998f, -0.535322f, -0.535645f, -0.535969f, -0.536293f, -0.536617f, -0.536940f, -0.537264f,
- -0.537587f, -0.537910f, -0.538234f, -0.538557f, -0.538880f, -0.539203f, -0.539526f, -0.539849f,
- -0.540171f, -0.540494f, -0.540817f, -0.541139f, -0.541462f, -0.541784f, -0.542106f, -0.542429f,
- -0.542751f, -0.543073f, -0.543395f, -0.543717f, -0.544039f, -0.544360f, -0.544682f, -0.545003f,
- -0.545325f, -0.545646f, -0.545968f, -0.546289f, -0.546610f, -0.546931f, -0.547252f, -0.547573f,
- -0.547894f, -0.548215f, -0.548536f, -0.548856f, -0.549177f, -0.549497f, -0.549818f, -0.550138f,
- -0.550458f, -0.550778f, -0.551098f, -0.551418f, -0.551738f, -0.552058f, -0.552378f, -0.552697f,
- -0.553017f, -0.553336f, -0.553656f, -0.553975f, -0.554294f, -0.554613f, -0.554932f, -0.555251f,
- -0.555570f, -0.555889f, -0.556208f, -0.556526f, -0.556845f, -0.557164f, -0.557482f, -0.557800f,
- -0.558119f, -0.558437f, -0.558755f, -0.559073f, -0.559391f, -0.559709f, -0.560026f, -0.560344f,
- -0.560662f, -0.560979f, -0.561297f, -0.561614f, -0.561931f, -0.562248f, -0.562565f, -0.562882f,
- -0.563199f, -0.563516f, -0.563833f, -0.564150f, -0.564466f, -0.564783f, -0.565099f, -0.565416f,
- -0.565732f, -0.566048f, -0.566364f, -0.566680f, -0.566996f, -0.567312f, -0.567628f, -0.567943f,
- -0.568259f, -0.568574f, -0.568890f, -0.569205f, -0.569521f, -0.569836f, -0.570151f, -0.570466f,
- -0.570781f, -0.571096f, -0.571410f, -0.571725f, -0.572040f, -0.572354f, -0.572669f, -0.572983f,
- -0.573297f, -0.573611f, -0.573925f, -0.574239f, -0.574553f, -0.574867f, -0.575181f, -0.575495f,
- -0.575808f, -0.576122f, -0.576435f, -0.576748f, -0.577062f, -0.577375f, -0.577688f, -0.578001f,
- -0.578314f, -0.578627f, -0.578939f, -0.579252f, -0.579565f, -0.579877f, -0.580189f, -0.580502f,
- -0.580814f, -0.581126f, -0.581438f, -0.581750f, -0.582062f, -0.582374f, -0.582685f, -0.582997f,
- -0.583309f, -0.583620f, -0.583931f, -0.584243f, -0.584554f, -0.584865f, -0.585176f, -0.585487f,
- -0.585798f, -0.586109f, -0.586419f, -0.586730f, -0.587040f, -0.587351f, -0.587661f, -0.587971f,
- -0.588282f, -0.588592f, -0.588902f, -0.589212f, -0.589521f, -0.589831f, -0.590141f, -0.590450f,
- -0.590760f, -0.591069f, -0.591378f, -0.591688f, -0.591997f, -0.592306f, -0.592615f, -0.592924f,
- -0.593232f, -0.593541f, -0.593850f, -0.594158f, -0.594467f, -0.594775f, -0.595083f, -0.595391f,
- -0.595699f, -0.596007f, -0.596315f, -0.596623f, -0.596931f, -0.597238f, -0.597546f, -0.597853f,
- -0.598161f, -0.598468f, -0.598775f, -0.599082f, -0.599389f, -0.599696f, -0.600003f, -0.600310f,
- -0.600616f, -0.600923f, -0.601230f, -0.601536f, -0.601842f, -0.602148f, -0.602455f, -0.602761f,
- -0.603067f, -0.603372f, -0.603678f, -0.603984f, -0.604290f, -0.604595f, -0.604900f, -0.605206f,
- -0.605511f, -0.605816f, -0.606121f, -0.606426f, -0.606731f, -0.607036f, -0.607341f, -0.607645f,
- -0.607950f, -0.608254f, -0.608559f, -0.608863f, -0.609167f, -0.609471f, -0.609775f, -0.610079f,
- -0.610383f, -0.610687f, -0.610990f, -0.611294f, -0.611597f, -0.611901f, -0.612204f, -0.612507f,
- -0.612810f, -0.613113f, -0.613416f, -0.613719f, -0.614022f, -0.614324f, -0.614627f, -0.614929f,
- -0.615232f, -0.615534f, -0.615836f, -0.616138f, -0.616440f, -0.616742f, -0.617044f, -0.617346f,
- -0.617647f, -0.617949f, -0.618250f, -0.618552f, -0.618853f, -0.619154f, -0.619455f, -0.619756f,
- -0.620057f, -0.620358f, -0.620659f, -0.620959f, -0.621260f, -0.621560f, -0.621861f, -0.622161f,
- -0.622461f, -0.622761f, -0.623061f, -0.623361f, -0.623661f, -0.623961f, -0.624260f, -0.624560f,
- -0.624860f, -0.625159f, -0.625458f, -0.625757f, -0.626056f, -0.626355f, -0.626654f, -0.626953f,
- -0.627252f, -0.627550f, -0.627849f, -0.628147f, -0.628446f, -0.628744f, -0.629042f, -0.629340f,
- -0.629638f, -0.629936f, -0.630234f, -0.630532f, -0.630829f, -0.631127f, -0.631424f, -0.631721f,
- -0.632019f, -0.632316f, -0.632613f, -0.632910f, -0.633207f, -0.633504f, -0.633800f, -0.634097f,
- -0.634393f, -0.634690f, -0.634986f, -0.635282f, -0.635578f, -0.635874f, -0.636170f, -0.636466f,
- -0.636762f, -0.637057f, -0.637353f, -0.637649f, -0.637944f, -0.638239f, -0.638534f, -0.638829f,
- -0.639124f, -0.639419f, -0.639714f, -0.640009f, -0.640303f, -0.640598f, -0.640892f, -0.641187f,
- -0.641481f, -0.641775f, -0.642069f, -0.642363f, -0.642657f, -0.642951f, -0.643245f, -0.643538f,
- -0.643832f, -0.644125f, -0.644418f, -0.644711f, -0.645005f, -0.645298f, -0.645590f, -0.645883f,
- -0.646176f, -0.646469f, -0.646761f, -0.647054f, -0.647346f, -0.647638f, -0.647930f, -0.648222f,
- -0.648514f, -0.648806f, -0.649098f, -0.649390f, -0.649681f, -0.649973f, -0.650264f, -0.650555f,
- -0.650847f, -0.651138f, -0.651429f, -0.651720f, -0.652011f, -0.652301f, -0.652592f, -0.652882f,
- -0.653173f, -0.653463f, -0.653753f, -0.654044f, -0.654334f, -0.654624f, -0.654913f, -0.655203f,
- -0.655493f, -0.655782f, -0.656072f, -0.656361f, -0.656651f, -0.656940f, -0.657229f, -0.657518f,
- -0.657807f, -0.658095f, -0.658384f, -0.658673f, -0.658961f, -0.659250f, -0.659538f, -0.659826f,
- -0.660114f, -0.660402f, -0.660690f, -0.660978f, -0.661266f, -0.661553f, -0.661841f, -0.662128f,
- -0.662416f, -0.662703f, -0.662990f, -0.663277f, -0.663564f, -0.663851f, -0.664138f, -0.664424f,
- -0.664711f, -0.664997f, -0.665284f, -0.665570f, -0.665856f, -0.666142f, -0.666428f, -0.666714f,
- -0.667000f, -0.667286f, -0.667571f, -0.667857f, -0.668142f, -0.668427f, -0.668712f, -0.668998f,
- -0.669283f, -0.669567f, -0.669852f, -0.670137f, -0.670422f, -0.670706f, -0.670990f, -0.671275f,
- -0.671559f, -0.671843f, -0.672127f, -0.672411f, -0.672695f, -0.672978f, -0.673262f, -0.673546f,
- -0.673829f, -0.674112f, -0.674396f, -0.674679f, -0.674962f, -0.675245f, -0.675527f, -0.675810f,
- -0.676093f, -0.676375f, -0.676658f, -0.676940f, -0.677222f, -0.677504f, -0.677786f, -0.678068f,
- -0.678350f, -0.678632f, -0.678913f, -0.679195f, -0.679476f, -0.679758f, -0.680039f, -0.680320f,
- -0.680601f, -0.680882f, -0.681163f, -0.681443f, -0.681724f, -0.682005f, -0.682285f, -0.682565f,
- -0.682846f, -0.683126f, -0.683406f, -0.683686f, -0.683965f, -0.684245f, -0.684525f, -0.684804f,
- -0.685084f, -0.685363f, -0.685642f, -0.685921f, -0.686200f, -0.686479f, -0.686758f, -0.687037f,
- -0.687315f, -0.687594f, -0.687872f, -0.688151f, -0.688429f, -0.688707f, -0.688985f, -0.689263f,
- -0.689541f, -0.689818f, -0.690096f, -0.690373f, -0.690651f, -0.690928f, -0.691205f, -0.691482f,
- -0.691759f, -0.692036f, -0.692313f, -0.692590f, -0.692866f, -0.693143f, -0.693419f, -0.693695f,
- -0.693971f, -0.694248f, -0.694524f, -0.694799f, -0.695075f, -0.695351f, -0.695626f, -0.695902f,
- -0.696177f, -0.696452f, -0.696728f, -0.697003f, -0.697277f, -0.697552f, -0.697827f, -0.698102f,
- -0.698376f, -0.698651f, -0.698925f, -0.699199f, -0.699473f, -0.699747f, -0.700021f, -0.700295f,
- -0.700569f, -0.700842f, -0.701116f, -0.701389f, -0.701663f, -0.701936f, -0.702209f, -0.702482f,
- -0.702755f, -0.703028f, -0.703300f, -0.703573f, -0.703845f, -0.704118f, -0.704390f, -0.704662f,
- -0.704934f, -0.705206f, -0.705478f, -0.705750f, -0.706021f, -0.706293f, -0.706564f, -0.706836f,
- -0.707107f, -0.707378f, -0.707649f, -0.707920f, -0.708191f, -0.708461f, -0.708732f, -0.709002f,
- -0.709273f, -0.709543f, -0.709813f, -0.710083f, -0.710353f, -0.710623f, -0.710893f, -0.711163f,
- -0.711432f, -0.711702f, -0.711971f, -0.712240f, -0.712509f, -0.712778f, -0.713047f, -0.713316f,
- -0.713585f, -0.713853f, -0.714122f, -0.714390f, -0.714659f, -0.714927f, -0.715195f, -0.715463f,
- -0.715731f, -0.715999f, -0.716266f, -0.716534f, -0.716801f, -0.717069f, -0.717336f, -0.717603f,
- -0.717870f, -0.718137f, -0.718404f, -0.718670f, -0.718937f, -0.719204f, -0.719470f, -0.719736f,
- -0.720003f, -0.720269f, -0.720535f, -0.720800f, -0.721066f, -0.721332f, -0.721597f, -0.721863f,
- -0.722128f, -0.722393f, -0.722659f, -0.722924f, -0.723188f, -0.723453f, -0.723718f, -0.723983f,
- -0.724247f, -0.724511f, -0.724776f, -0.725040f, -0.725304f, -0.725568f, -0.725832f, -0.726095f,
- -0.726359f, -0.726623f, -0.726886f, -0.727149f, -0.727413f, -0.727676f, -0.727939f, -0.728202f,
- -0.728464f, -0.728727f, -0.728990f, -0.729252f, -0.729514f, -0.729777f, -0.730039f, -0.730301f,
- -0.730563f, -0.730825f, -0.731086f, -0.731348f, -0.731609f, -0.731871f, -0.732132f, -0.732393f,
- -0.732654f, -0.732915f, -0.733176f, -0.733437f, -0.733697f, -0.733958f, -0.734218f, -0.734479f,
- -0.734739f, -0.734999f, -0.735259f, -0.735519f, -0.735779f, -0.736038f, -0.736298f, -0.736557f,
- -0.736817f, -0.737076f, -0.737335f, -0.737594f, -0.737853f, -0.738112f, -0.738370f, -0.738629f,
- -0.738887f, -0.739146f, -0.739404f, -0.739662f, -0.739920f, -0.740178f, -0.740436f, -0.740694f,
- -0.740951f, -0.741209f, -0.741466f, -0.741723f, -0.741980f, -0.742237f, -0.742494f, -0.742751f,
- -0.743008f, -0.743265f, -0.743521f, -0.743777f, -0.744034f, -0.744290f, -0.744546f, -0.744802f,
- -0.745058f, -0.745314f, -0.745569f, -0.745825f, -0.746080f, -0.746335f, -0.746591f, -0.746846f,
- -0.747101f, -0.747355f, -0.747610f, -0.747865f, -0.748119f, -0.748374f, -0.748628f, -0.748882f,
- -0.749136f, -0.749390f, -0.749644f, -0.749898f, -0.750152f, -0.750405f, -0.750659f, -0.750912f,
- -0.751165f, -0.751418f, -0.751671f, -0.751924f, -0.752177f, -0.752429f, -0.752682f, -0.752934f,
- -0.753187f, -0.753439f, -0.753691f, -0.753943f, -0.754195f, -0.754447f, -0.754698f, -0.754950f,
- -0.755201f, -0.755453f, -0.755704f, -0.755955f, -0.756206f, -0.756457f, -0.756708f, -0.756958f,
- -0.757209f, -0.757459f, -0.757710f, -0.757960f, -0.758210f, -0.758460f, -0.758710f, -0.758960f,
- -0.759209f, -0.759459f, -0.759708f, -0.759957f, -0.760207f, -0.760456f, -0.760705f, -0.760954f,
- -0.761202f, -0.761451f, -0.761700f, -0.761948f, -0.762196f, -0.762444f, -0.762693f, -0.762941f,
- -0.763188f, -0.763436f, -0.763684f, -0.763931f, -0.764179f, -0.764426f, -0.764673f, -0.764920f,
- -0.765167f, -0.765414f, -0.765661f, -0.765907f, -0.766154f, -0.766400f, -0.766647f, -0.766893f,
- -0.767139f, -0.767385f, -0.767631f, -0.767876f, -0.768122f, -0.768368f, -0.768613f, -0.768858f,
- -0.769103f, -0.769348f, -0.769593f, -0.769838f, -0.770083f, -0.770327f, -0.770572f, -0.770816f,
- -0.771061f, -0.771305f, -0.771549f, -0.771793f, -0.772036f, -0.772280f, -0.772524f, -0.772767f,
- -0.773010f, -0.773254f, -0.773497f, -0.773740f, -0.773983f, -0.774225f, -0.774468f, -0.774711f,
- -0.774953f, -0.775195f, -0.775438f, -0.775680f, -0.775922f, -0.776164f, -0.776405f, -0.776647f,
- -0.776888f, -0.777130f, -0.777371f, -0.777612f, -0.777853f, -0.778094f, -0.778335f, -0.778576f,
- -0.778817f, -0.779057f, -0.779297f, -0.779538f, -0.779778f, -0.780018f, -0.780258f, -0.780498f,
- -0.780737f, -0.780977f, -0.781216f, -0.781456f, -0.781695f, -0.781934f, -0.782173f, -0.782412f,
- -0.782651f, -0.782889f, -0.783128f, -0.783366f, -0.783605f, -0.783843f, -0.784081f, -0.784319f,
- -0.784557f, -0.784794f, -0.785032f, -0.785269f, -0.785507f, -0.785744f, -0.785981f, -0.786218f,
- -0.786455f, -0.786692f, -0.786929f, -0.787165f, -0.787402f, -0.787638f, -0.787874f, -0.788110f,
- -0.788346f, -0.788582f, -0.788818f, -0.789054f, -0.789289f, -0.789525f, -0.789760f, -0.789995f,
- -0.790230f, -0.790465f, -0.790700f, -0.790935f, -0.791169f, -0.791404f, -0.791638f, -0.791872f,
- -0.792107f, -0.792341f, -0.792575f, -0.792808f, -0.793042f, -0.793276f, -0.793509f, -0.793742f,
- -0.793975f, -0.794209f, -0.794442f, -0.794674f, -0.794907f, -0.795140f, -0.795372f, -0.795605f,
- -0.795837f, -0.796069f, -0.796301f, -0.796533f, -0.796765f, -0.796996f, -0.797228f, -0.797459f,
- -0.797691f, -0.797922f, -0.798153f, -0.798384f, -0.798615f, -0.798846f, -0.799076f, -0.799307f,
- -0.799537f, -0.799768f, -0.799998f, -0.800228f, -0.800458f, -0.800687f, -0.800917f, -0.801147f,
- -0.801376f, -0.801606f, -0.801835f, -0.802064f, -0.802293f, -0.802522f, -0.802750f, -0.802979f,
- -0.803208f, -0.803436f, -0.803664f, -0.803892f, -0.804120f, -0.804348f, -0.804576f, -0.804804f,
- -0.805031f, -0.805259f, -0.805486f, -0.805713f, -0.805940f, -0.806167f, -0.806394f, -0.806621f,
- -0.806848f, -0.807074f, -0.807300f, -0.807527f, -0.807753f, -0.807979f, -0.808205f, -0.808430f,
- -0.808656f, -0.808882f, -0.809107f, -0.809332f, -0.809558f, -0.809783f, -0.810008f, -0.810232f,
- -0.810457f, -0.810682f, -0.810906f, -0.811131f, -0.811355f, -0.811579f, -0.811803f, -0.812027f,
- -0.812251f, -0.812474f, -0.812698f, -0.812921f, -0.813144f, -0.813368f, -0.813591f, -0.813814f,
- -0.814036f, -0.814259f, -0.814482f, -0.814704f, -0.814926f, -0.815149f, -0.815371f, -0.815593f,
- -0.815814f, -0.816036f, -0.816258f, -0.816479f, -0.816701f, -0.816922f, -0.817143f, -0.817364f,
- -0.817585f, -0.817806f, -0.818026f, -0.818247f, -0.818467f, -0.818687f, -0.818908f, -0.819128f,
- -0.819348f, -0.819567f, -0.819787f, -0.820007f, -0.820226f, -0.820445f, -0.820664f, -0.820884f,
- -0.821102f, -0.821321f, -0.821540f, -0.821759f, -0.821977f, -0.822195f, -0.822414f, -0.822632f,
- -0.822850f, -0.823068f, -0.823285f, -0.823503f, -0.823721f, -0.823938f, -0.824155f, -0.824372f,
- -0.824589f, -0.824806f, -0.825023f, -0.825240f, -0.825456f, -0.825673f, -0.825889f, -0.826105f,
- -0.826321f, -0.826537f, -0.826753f, -0.826968f, -0.827184f, -0.827399f, -0.827615f, -0.827830f,
- -0.828045f, -0.828260f, -0.828475f, -0.828690f, -0.828904f, -0.829119f, -0.829333f, -0.829547f,
- -0.829761f, -0.829975f, -0.830189f, -0.830403f, -0.830616f, -0.830830f, -0.831043f, -0.831257f,
- -0.831470f, -0.831683f, -0.831895f, -0.832108f, -0.832321f, -0.832533f, -0.832746f, -0.832958f,
- -0.833170f, -0.833382f, -0.833594f, -0.833806f, -0.834018f, -0.834229f, -0.834440f, -0.834652f,
- -0.834863f, -0.835074f, -0.835285f, -0.835496f, -0.835706f, -0.835917f, -0.836127f, -0.836338f,
- -0.836548f, -0.836758f, -0.836968f, -0.837178f, -0.837387f, -0.837597f, -0.837806f, -0.838015f,
- -0.838225f, -0.838434f, -0.838643f, -0.838852f, -0.839060f, -0.839269f, -0.839477f, -0.839686f,
- -0.839894f, -0.840102f, -0.840310f, -0.840518f, -0.840725f, -0.840933f, -0.841140f, -0.841348f,
- -0.841555f, -0.841762f, -0.841969f, -0.842176f, -0.842383f, -0.842589f, -0.842796f, -0.843002f,
- -0.843208f, -0.843414f, -0.843620f, -0.843826f, -0.844032f, -0.844238f, -0.844443f, -0.844648f,
- -0.844854f, -0.845059f, -0.845264f, -0.845469f, -0.845673f, -0.845878f, -0.846082f, -0.846287f,
- -0.846491f, -0.846695f, -0.846899f, -0.847103f, -0.847307f, -0.847510f, -0.847714f, -0.847917f,
- -0.848120f, -0.848323f, -0.848526f, -0.848729f, -0.848932f, -0.849135f, -0.849337f, -0.849540f,
- -0.849742f, -0.849944f, -0.850146f, -0.850348f, -0.850549f, -0.850751f, -0.850953f, -0.851154f,
- -0.851355f, -0.851556f, -0.851757f, -0.851958f, -0.852159f, -0.852360f, -0.852560f, -0.852760f,
- -0.852961f, -0.853161f, -0.853361f, -0.853561f, -0.853760f, -0.853960f, -0.854159f, -0.854359f,
- -0.854558f, -0.854757f, -0.854956f, -0.855155f, -0.855354f, -0.855552f, -0.855751f, -0.855949f,
- -0.856147f, -0.856345f, -0.856543f, -0.856741f, -0.856939f, -0.857137f, -0.857334f, -0.857531f,
- -0.857729f, -0.857926f, -0.858123f, -0.858320f, -0.858516f, -0.858713f, -0.858909f, -0.859106f,
- -0.859302f, -0.859498f, -0.859694f, -0.859890f, -0.860085f, -0.860281f, -0.860476f, -0.860672f,
- -0.860867f, -0.861062f, -0.861257f, -0.861452f, -0.861646f, -0.861841f, -0.862035f, -0.862230f,
- -0.862424f, -0.862618f, -0.862812f, -0.863006f, -0.863199f, -0.863393f, -0.863586f, -0.863780f,
- -0.863973f, -0.864166f, -0.864359f, -0.864552f, -0.864744f, -0.864937f, -0.865129f, -0.865321f,
- -0.865514f, -0.865706f, -0.865898f, -0.866089f, -0.866281f, -0.866472f, -0.866664f, -0.866855f,
- -0.867046f, -0.867237f, -0.867428f, -0.867619f, -0.867809f, -0.868000f, -0.868190f, -0.868381f,
- -0.868571f, -0.868761f, -0.868951f, -0.869140f, -0.869330f, -0.869519f, -0.869709f, -0.869898f,
- -0.870087f, -0.870276f, -0.870465f, -0.870654f, -0.870842f, -0.871031f, -0.871219f, -0.871407f,
- -0.871595f, -0.871783f, -0.871971f, -0.872159f, -0.872346f, -0.872534f, -0.872721f, -0.872908f,
- -0.873095f, -0.873282f, -0.873469f, -0.873655f, -0.873842f, -0.874028f, -0.874215f, -0.874401f,
- -0.874587f, -0.874773f, -0.874958f, -0.875144f, -0.875329f, -0.875515f, -0.875700f, -0.875885f,
- -0.876070f, -0.876255f, -0.876440f, -0.876624f, -0.876809f, -0.876993f, -0.877177f, -0.877361f,
- -0.877545f, -0.877729f, -0.877913f, -0.878096f, -0.878280f, -0.878463f, -0.878646f, -0.878829f,
- -0.879012f, -0.879195f, -0.879378f, -0.879560f, -0.879743f, -0.879925f, -0.880107f, -0.880289f,
- -0.880471f, -0.880653f, -0.880834f, -0.881016f, -0.881197f, -0.881378f, -0.881559f, -0.881740f,
- -0.881921f, -0.882102f, -0.882283f, -0.882463f, -0.882643f, -0.882824f, -0.883004f, -0.883184f,
- -0.883363f, -0.883543f, -0.883723f, -0.883902f, -0.884081f, -0.884260f, -0.884439f, -0.884618f,
- -0.884797f, -0.884976f, -0.885154f, -0.885333f, -0.885511f, -0.885689f, -0.885867f, -0.886045f,
- -0.886223f, -0.886400f, -0.886578f, -0.886755f, -0.886932f, -0.887109f, -0.887286f, -0.887463f,
- -0.887640f, -0.887816f, -0.887993f, -0.888169f, -0.888345f, -0.888521f, -0.888697f, -0.888873f,
- -0.889048f, -0.889224f, -0.889399f, -0.889574f, -0.889750f, -0.889925f, -0.890099f, -0.890274f,
- -0.890449f, -0.890623f, -0.890797f, -0.890972f, -0.891146f, -0.891320f, -0.891493f, -0.891667f,
- -0.891841f, -0.892014f, -0.892187f, -0.892361f, -0.892534f, -0.892706f, -0.892879f, -0.893052f,
- -0.893224f, -0.893397f, -0.893569f, -0.893741f, -0.893913f, -0.894085f, -0.894256f, -0.894428f,
- -0.894599f, -0.894771f, -0.894942f, -0.895113f, -0.895284f, -0.895455f, -0.895625f, -0.895796f,
- -0.895966f, -0.896137f, -0.896307f, -0.896477f, -0.896646f, -0.896816f, -0.896986f, -0.897155f,
- -0.897325f, -0.897494f, -0.897663f, -0.897832f, -0.898001f, -0.898169f, -0.898338f, -0.898506f,
- -0.898674f, -0.898843f, -0.899011f, -0.899179f, -0.899346f, -0.899514f, -0.899681f, -0.899849f,
- -0.900016f, -0.900183f, -0.900350f, -0.900517f, -0.900683f, -0.900850f, -0.901016f, -0.901183f,
- -0.901349f, -0.901515f, -0.901681f, -0.901847f, -0.902012f, -0.902178f, -0.902343f, -0.902508f,
- -0.902673f, -0.902838f, -0.903003f, -0.903168f, -0.903332f, -0.903497f, -0.903661f, -0.903825f,
- -0.903989f, -0.904153f, -0.904317f, -0.904481f, -0.904644f, -0.904807f, -0.904971f, -0.905134f,
- -0.905297f, -0.905460f, -0.905622f, -0.905785f, -0.905947f, -0.906110f, -0.906272f, -0.906434f,
- -0.906596f, -0.906757f, -0.906919f, -0.907081f, -0.907242f, -0.907403f, -0.907564f, -0.907725f,
- -0.907886f, -0.908047f, -0.908207f, -0.908368f, -0.908528f, -0.908688f, -0.908848f, -0.909008f,
- -0.909168f, -0.909328f, -0.909487f, -0.909646f, -0.909806f, -0.909965f, -0.910124f, -0.910283f,
- -0.910441f, -0.910600f, -0.910758f, -0.910917f, -0.911075f, -0.911233f, -0.911391f, -0.911548f,
- -0.911706f, -0.911864f, -0.912021f, -0.912178f, -0.912335f, -0.912492f, -0.912649f, -0.912806f,
- -0.912962f, -0.913119f, -0.913275f, -0.913431f, -0.913587f, -0.913743f, -0.913899f, -0.914054f,
- -0.914210f, -0.914365f, -0.914520f, -0.914675f, -0.914830f, -0.914985f, -0.915140f, -0.915294f,
- -0.915449f, -0.915603f, -0.915757f, -0.915911f, -0.916065f, -0.916219f, -0.916372f, -0.916526f,
- -0.916679f, -0.916832f, -0.916985f, -0.917138f, -0.917291f, -0.917444f, -0.917596f, -0.917749f,
- -0.917901f, -0.918053f, -0.918205f, -0.918357f, -0.918508f, -0.918660f, -0.918811f, -0.918963f,
- -0.919114f, -0.919265f, -0.919416f, -0.919567f, -0.919717f, -0.919868f, -0.920018f, -0.920168f,
- -0.920318f, -0.920468f, -0.920618f, -0.920768f, -0.920917f, -0.921067f, -0.921216f, -0.921365f,
- -0.921514f, -0.921663f, -0.921812f, -0.921960f, -0.922109f, -0.922257f, -0.922405f, -0.922553f,
- -0.922701f, -0.922849f, -0.922997f, -0.923144f, -0.923291f, -0.923439f, -0.923586f, -0.923733f,
- -0.923880f, -0.924026f, -0.924173f, -0.924319f, -0.924465f, -0.924612f, -0.924758f, -0.924904f,
- -0.925049f, -0.925195f, -0.925340f, -0.925486f, -0.925631f, -0.925776f, -0.925921f, -0.926066f,
- -0.926210f, -0.926355f, -0.926499f, -0.926643f, -0.926787f, -0.926931f, -0.927075f, -0.927219f,
- -0.927363f, -0.927506f, -0.927649f, -0.927792f, -0.927935f, -0.928078f, -0.928221f, -0.928364f,
- -0.928506f, -0.928648f, -0.928791f, -0.928933f, -0.929075f, -0.929216f, -0.929358f, -0.929500f,
- -0.929641f, -0.929782f, -0.929923f, -0.930064f, -0.930205f, -0.930346f, -0.930486f, -0.930627f,
- -0.930767f, -0.930907f, -0.931047f, -0.931187f, -0.931327f, -0.931466f, -0.931606f, -0.931745f,
- -0.931884f, -0.932023f, -0.932162f, -0.932301f, -0.932440f, -0.932578f, -0.932716f, -0.932855f,
- -0.932993f, -0.933131f, -0.933269f, -0.933406f, -0.933544f, -0.933681f, -0.933818f, -0.933956f,
- -0.934093f, -0.934229f, -0.934366f, -0.934503f, -0.934639f, -0.934775f, -0.934912f, -0.935048f,
- -0.935184f, -0.935319f, -0.935455f, -0.935590f, -0.935726f, -0.935861f, -0.935996f, -0.936131f,
- -0.936266f, -0.936400f, -0.936535f, -0.936669f, -0.936803f, -0.936938f, -0.937072f, -0.937205f,
- -0.937339f, -0.937473f, -0.937606f, -0.937739f, -0.937872f, -0.938005f, -0.938138f, -0.938271f,
- -0.938404f, -0.938536f, -0.938668f, -0.938800f, -0.938932f, -0.939064f, -0.939196f, -0.939328f,
- -0.939459f, -0.939591f, -0.939722f, -0.939853f, -0.939984f, -0.940115f, -0.940245f, -0.940376f,
- -0.940506f, -0.940636f, -0.940766f, -0.940896f, -0.941026f, -0.941156f, -0.941285f, -0.941415f,
- -0.941544f, -0.941673f, -0.941802f, -0.941931f, -0.942060f, -0.942188f, -0.942317f, -0.942445f,
- -0.942573f, -0.942701f, -0.942829f, -0.942957f, -0.943084f, -0.943212f, -0.943339f, -0.943466f,
- -0.943593f, -0.943720f, -0.943847f, -0.943974f, -0.944100f, -0.944227f, -0.944353f, -0.944479f,
- -0.944605f, -0.944731f, -0.944856f, -0.944982f, -0.945107f, -0.945232f, -0.945358f, -0.945482f,
- -0.945607f, -0.945732f, -0.945857f, -0.945981f, -0.946105f, -0.946229f, -0.946353f, -0.946477f,
- -0.946601f, -0.946724f, -0.946848f, -0.946971f, -0.947094f, -0.947217f, -0.947340f, -0.947463f,
- -0.947586f, -0.947708f, -0.947830f, -0.947953f, -0.948075f, -0.948196f, -0.948318f, -0.948440f,
- -0.948561f, -0.948683f, -0.948804f, -0.948925f, -0.949046f, -0.949167f, -0.949287f, -0.949408f,
- -0.949528f, -0.949648f, -0.949768f, -0.949888f, -0.950008f, -0.950128f, -0.950247f, -0.950367f,
- -0.950486f, -0.950605f, -0.950724f, -0.950843f, -0.950962f, -0.951080f, -0.951199f, -0.951317f,
- -0.951435f, -0.951553f, -0.951671f, -0.951789f, -0.951906f, -0.952024f, -0.952141f, -0.952258f,
- -0.952375f, -0.952492f, -0.952609f, -0.952725f, -0.952842f, -0.952958f, -0.953074f, -0.953190f,
- -0.953306f, -0.953422f, -0.953537f, -0.953653f, -0.953768f, -0.953883f, -0.953998f, -0.954113f,
- -0.954228f, -0.954343f, -0.954457f, -0.954572f, -0.954686f, -0.954800f, -0.954914f, -0.955028f,
- -0.955141f, -0.955255f, -0.955368f, -0.955481f, -0.955594f, -0.955707f, -0.955820f, -0.955933f,
- -0.956045f, -0.956158f, -0.956270f, -0.956382f, -0.956494f, -0.956606f, -0.956717f, -0.956829f,
- -0.956940f, -0.957052f, -0.957163f, -0.957274f, -0.957385f, -0.957495f, -0.957606f, -0.957716f,
- -0.957826f, -0.957937f, -0.958046f, -0.958156f, -0.958266f, -0.958376f, -0.958485f, -0.958594f,
- -0.958703f, -0.958812f, -0.958921f, -0.959030f, -0.959139f, -0.959247f, -0.959355f, -0.959463f,
- -0.959572f, -0.959679f, -0.959787f, -0.959895f, -0.960002f, -0.960109f, -0.960217f, -0.960324f,
- -0.960431f, -0.960537f, -0.960644f, -0.960750f, -0.960857f, -0.960963f, -0.961069f, -0.961175f,
- -0.961280f, -0.961386f, -0.961492f, -0.961597f, -0.961702f, -0.961807f, -0.961912f, -0.962017f,
- -0.962121f, -0.962226f, -0.962330f, -0.962434f, -0.962538f, -0.962642f, -0.962746f, -0.962850f,
- -0.962953f, -0.963057f, -0.963160f, -0.963263f, -0.963366f, -0.963469f, -0.963571f, -0.963674f,
- -0.963776f, -0.963878f, -0.963980f, -0.964082f, -0.964184f, -0.964286f, -0.964387f, -0.964489f,
- -0.964590f, -0.964691f, -0.964792f, -0.964893f, -0.964993f, -0.965094f, -0.965194f, -0.965294f,
- -0.965394f, -0.965494f, -0.965594f, -0.965694f, -0.965793f, -0.965893f, -0.965992f, -0.966091f,
- -0.966190f, -0.966289f, -0.966387f, -0.966486f, -0.966584f, -0.966683f, -0.966781f, -0.966879f,
- -0.966976f, -0.967074f, -0.967172f, -0.967269f, -0.967366f, -0.967463f, -0.967560f, -0.967657f,
- -0.967754f, -0.967850f, -0.967947f, -0.968043f, -0.968139f, -0.968235f, -0.968331f, -0.968427f,
- -0.968522f, -0.968617f, -0.968713f, -0.968808f, -0.968903f, -0.968998f, -0.969092f, -0.969187f,
- -0.969281f, -0.969375f, -0.969470f, -0.969564f, -0.969657f, -0.969751f, -0.969845f, -0.969938f,
- -0.970031f, -0.970124f, -0.970217f, -0.970310f, -0.970403f, -0.970495f, -0.970588f, -0.970680f,
- -0.970772f, -0.970864f, -0.970956f, -0.971048f, -0.971139f, -0.971231f, -0.971322f, -0.971413f,
- -0.971504f, -0.971595f, -0.971685f, -0.971776f, -0.971866f, -0.971957f, -0.972047f, -0.972137f,
- -0.972227f, -0.972316f, -0.972406f, -0.972495f, -0.972584f, -0.972673f, -0.972762f, -0.972851f,
- -0.972940f, -0.973028f, -0.973117f, -0.973205f, -0.973293f, -0.973381f, -0.973469f, -0.973557f,
- -0.973644f, -0.973732f, -0.973819f, -0.973906f, -0.973993f, -0.974080f, -0.974166f, -0.974253f,
- -0.974339f, -0.974426f, -0.974512f, -0.974598f, -0.974684f, -0.974769f, -0.974855f, -0.974940f,
- -0.975025f, -0.975110f, -0.975195f, -0.975280f, -0.975365f, -0.975449f, -0.975534f, -0.975618f,
- -0.975702f, -0.975786f, -0.975870f, -0.975954f, -0.976037f, -0.976120f, -0.976204f, -0.976287f,
- -0.976370f, -0.976453f, -0.976535f, -0.976618f, -0.976700f, -0.976782f, -0.976864f, -0.976946f,
- -0.977028f, -0.977110f, -0.977191f, -0.977273f, -0.977354f, -0.977435f, -0.977516f, -0.977597f,
- -0.977677f, -0.977758f, -0.977838f, -0.977918f, -0.977998f, -0.978078f, -0.978158f, -0.978238f,
- -0.978317f, -0.978397f, -0.978476f, -0.978555f, -0.978634f, -0.978713f, -0.978791f, -0.978870f,
- -0.978948f, -0.979026f, -0.979104f, -0.979182f, -0.979260f, -0.979338f, -0.979415f, -0.979493f,
- -0.979570f, -0.979647f, -0.979724f, -0.979800f, -0.979877f, -0.979954f, -0.980030f, -0.980106f,
- -0.980182f, -0.980258f, -0.980334f, -0.980409f, -0.980485f, -0.980560f, -0.980635f, -0.980710f,
- -0.980785f, -0.980860f, -0.980935f, -0.981009f, -0.981083f, -0.981158f, -0.981232f, -0.981305f,
- -0.981379f, -0.981453f, -0.981526f, -0.981600f, -0.981673f, -0.981746f, -0.981819f, -0.981891f,
- -0.981964f, -0.982036f, -0.982109f, -0.982181f, -0.982253f, -0.982325f, -0.982396f, -0.982468f,
- -0.982539f, -0.982611f, -0.982682f, -0.982753f, -0.982824f, -0.982894f, -0.982965f, -0.983035f,
- -0.983105f, -0.983176f, -0.983246f, -0.983315f, -0.983385f, -0.983455f, -0.983524f, -0.983593f,
- -0.983662f, -0.983731f, -0.983800f, -0.983869f, -0.983937f, -0.984006f, -0.984074f, -0.984142f,
- -0.984210f, -0.984278f, -0.984346f, -0.984413f, -0.984480f, -0.984548f, -0.984615f, -0.984682f,
- -0.984748f, -0.984815f, -0.984882f, -0.984948f, -0.985014f, -0.985080f, -0.985146f, -0.985212f,
- -0.985278f, -0.985343f, -0.985408f, -0.985474f, -0.985539f, -0.985604f, -0.985668f, -0.985733f,
- -0.985798f, -0.985862f, -0.985926f, -0.985990f, -0.986054f, -0.986118f, -0.986181f, -0.986245f,
- -0.986308f, -0.986371f, -0.986434f, -0.986497f, -0.986560f, -0.986623f, -0.986685f, -0.986747f,
- -0.986809f, -0.986871f, -0.986933f, -0.986995f, -0.987057f, -0.987118f, -0.987179f, -0.987240f,
- -0.987301f, -0.987362f, -0.987423f, -0.987484f, -0.987544f, -0.987604f, -0.987664f, -0.987724f,
- -0.987784f, -0.987844f, -0.987903f, -0.987963f, -0.988022f, -0.988081f, -0.988140f, -0.988199f,
- -0.988258f, -0.988316f, -0.988374f, -0.988433f, -0.988491f, -0.988549f, -0.988607f, -0.988664f,
- -0.988722f, -0.988779f, -0.988836f, -0.988893f, -0.988950f, -0.989007f, -0.989064f, -0.989120f,
- -0.989177f, -0.989233f, -0.989289f, -0.989345f, -0.989400f, -0.989456f, -0.989511f, -0.989567f,
- -0.989622f, -0.989677f, -0.989732f, -0.989787f, -0.989841f, -0.989896f, -0.989950f, -0.990004f,
- -0.990058f, -0.990112f, -0.990166f, -0.990219f, -0.990273f, -0.990326f, -0.990379f, -0.990432f,
- -0.990485f, -0.990538f, -0.990590f, -0.990643f, -0.990695f, -0.990747f, -0.990799f, -0.990851f,
- -0.990903f, -0.990954f, -0.991006f, -0.991057f, -0.991108f, -0.991159f, -0.991210f, -0.991260f,
- -0.991311f, -0.991361f, -0.991411f, -0.991462f, -0.991511f, -0.991561f, -0.991611f, -0.991660f,
- -0.991710f, -0.991759f, -0.991808f, -0.991857f, -0.991906f, -0.991954f, -0.992003f, -0.992051f,
- -0.992099f, -0.992147f, -0.992195f, -0.992243f, -0.992291f, -0.992338f, -0.992385f, -0.992433f,
- -0.992480f, -0.992526f, -0.992573f, -0.992620f, -0.992666f, -0.992712f, -0.992759f, -0.992805f,
- -0.992850f, -0.992896f, -0.992942f, -0.992987f, -0.993032f, -0.993077f, -0.993122f, -0.993167f,
- -0.993212f, -0.993257f, -0.993301f, -0.993345f, -0.993389f, -0.993433f, -0.993477f, -0.993521f,
- -0.993564f, -0.993608f, -0.993651f, -0.993694f, -0.993737f, -0.993779f, -0.993822f, -0.993865f,
- -0.993907f, -0.993949f, -0.993991f, -0.994033f, -0.994075f, -0.994116f, -0.994158f, -0.994199f,
- -0.994240f, -0.994281f, -0.994322f, -0.994363f, -0.994404f, -0.994444f, -0.994484f, -0.994525f,
- -0.994565f, -0.994604f, -0.994644f, -0.994684f, -0.994723f, -0.994762f, -0.994802f, -0.994841f,
- -0.994879f, -0.994918f, -0.994957f, -0.994995f, -0.995033f, -0.995071f, -0.995109f, -0.995147f,
- -0.995185f, -0.995222f, -0.995260f, -0.995297f, -0.995334f, -0.995371f, -0.995408f, -0.995444f,
- -0.995481f, -0.995517f, -0.995553f, -0.995589f, -0.995625f, -0.995661f, -0.995697f, -0.995732f,
- -0.995767f, -0.995803f, -0.995838f, -0.995872f, -0.995907f, -0.995942f, -0.995976f, -0.996011f,
- -0.996045f, -0.996079f, -0.996113f, -0.996146f, -0.996180f, -0.996213f, -0.996247f, -0.996280f,
- -0.996313f, -0.996345f, -0.996378f, -0.996411f, -0.996443f, -0.996475f, -0.996507f, -0.996539f,
- -0.996571f, -0.996603f, -0.996634f, -0.996666f, -0.996697f, -0.996728f, -0.996759f, -0.996790f,
- -0.996820f, -0.996851f, -0.996881f, -0.996911f, -0.996941f, -0.996971f, -0.997001f, -0.997031f,
- -0.997060f, -0.997089f, -0.997119f, -0.997148f, -0.997176f, -0.997205f, -0.997234f, -0.997262f,
- -0.997290f, -0.997319f, -0.997347f, -0.997374f, -0.997402f, -0.997430f, -0.997457f, -0.997484f,
- -0.997511f, -0.997538f, -0.997565f, -0.997592f, -0.997618f, -0.997645f, -0.997671f, -0.997697f,
- -0.997723f, -0.997749f, -0.997774f, -0.997800f, -0.997825f, -0.997851f, -0.997876f, -0.997901f,
- -0.997925f, -0.997950f, -0.997974f, -0.997999f, -0.998023f, -0.998047f, -0.998071f, -0.998094f,
- -0.998118f, -0.998142f, -0.998165f, -0.998188f, -0.998211f, -0.998234f, -0.998257f, -0.998279f,
- -0.998302f, -0.998324f, -0.998346f, -0.998368f, -0.998390f, -0.998411f, -0.998433f, -0.998454f,
- -0.998476f, -0.998497f, -0.998518f, -0.998538f, -0.998559f, -0.998580f, -0.998600f, -0.998620f,
- -0.998640f, -0.998660f, -0.998680f, -0.998700f, -0.998719f, -0.998738f, -0.998758f, -0.998777f,
- -0.998795f, -0.998814f, -0.998833f, -0.998851f, -0.998870f, -0.998888f, -0.998906f, -0.998924f,
- -0.998941f, -0.998959f, -0.998976f, -0.998994f, -0.999011f, -0.999028f, -0.999044f, -0.999061f,
- -0.999078f, -0.999094f, -0.999110f, -0.999126f, -0.999142f, -0.999158f, -0.999174f, -0.999189f,
- -0.999205f, -0.999220f, -0.999235f, -0.999250f, -0.999265f, -0.999279f, -0.999294f, -0.999308f,
- -0.999322f, -0.999336f, -0.999350f, -0.999364f, -0.999378f, -0.999391f, -0.999404f, -0.999418f,
- -0.999431f, -0.999443f, -0.999456f, -0.999469f, -0.999481f, -0.999493f, -0.999506f, -0.999518f,
- -0.999529f, -0.999541f, -0.999553f, -0.999564f, -0.999575f, -0.999586f, -0.999597f, -0.999608f,
- -0.999619f, -0.999629f, -0.999640f, -0.999650f, -0.999660f, -0.999670f, -0.999680f, -0.999689f,
- -0.999699f, -0.999708f, -0.999717f, -0.999726f, -0.999735f, -0.999744f, -0.999753f, -0.999761f,
- -0.999769f, -0.999778f, -0.999786f, -0.999793f, -0.999801f, -0.999809f, -0.999816f, -0.999823f,
- -0.999831f, -0.999838f, -0.999844f, -0.999851f, -0.999858f, -0.999864f, -0.999870f, -0.999876f,
- -0.999882f, -0.999888f, -0.999894f, -0.999899f, -0.999905f, -0.999910f, -0.999915f, -0.999920f,
- -0.999925f, -0.999929f, -0.999934f, -0.999938f, -0.999942f, -0.999946f, -0.999950f, -0.999954f,
- -0.999958f, -0.999961f, -0.999964f, -0.999968f, -0.999971f, -0.999973f, -0.999976f, -0.999979f,
- -0.999981f, -0.999983f, -0.999986f, -0.999988f, -0.999989f, -0.999991f, -0.999993f, -0.999994f,
- -0.999995f, -0.999996f, -0.999997f, -0.999998f, -0.999999f, -0.999999f, -1.000000f, -1.000000
-};
-
-static const float sinTable32768[16384] = {
- 0.000000f, 0.000192f, 0.000383f, 0.000575f, 0.000767f, 0.000959f, 0.001150f, 0.001342f,
- 0.001534f, 0.001726f, 0.001917f, 0.002109f, 0.002301f, 0.002493f, 0.002684f, 0.002876f,
- 0.003068f, 0.003260f, 0.003451f, 0.003643f, 0.003835f, 0.004027f, 0.004218f, 0.004410f,
- 0.004602f, 0.004794f, 0.004985f, 0.005177f, 0.005369f, 0.005561f, 0.005752f, 0.005944f,
- 0.006136f, 0.006328f, 0.006519f, 0.006711f, 0.006903f, 0.007095f, 0.007286f, 0.007478f,
- 0.007670f, 0.007862f, 0.008053f, 0.008245f, 0.008437f, 0.008629f, 0.008820f, 0.009012f,
- 0.009204f, 0.009395f, 0.009587f, 0.009779f, 0.009971f, 0.010162f, 0.010354f, 0.010546f,
- 0.010738f, 0.010929f, 0.011121f, 0.011313f, 0.011505f, 0.011696f, 0.011888f, 0.012080f,
- 0.012272f, 0.012463f, 0.012655f, 0.012847f, 0.013038f, 0.013230f, 0.013422f, 0.013614f,
- 0.013805f, 0.013997f, 0.014189f, 0.014381f, 0.014572f, 0.014764f, 0.014956f, 0.015147f,
- 0.015339f, 0.015531f, 0.015723f, 0.015914f, 0.016106f, 0.016298f, 0.016490f, 0.016681f,
- 0.016873f, 0.017065f, 0.017256f, 0.017448f, 0.017640f, 0.017832f, 0.018023f, 0.018215f,
- 0.018407f, 0.018598f, 0.018790f, 0.018982f, 0.019174f, 0.019365f, 0.019557f, 0.019749f,
- 0.019940f, 0.020132f, 0.020324f, 0.020516f, 0.020707f, 0.020899f, 0.021091f, 0.021282f,
- 0.021474f, 0.021666f, 0.021857f, 0.022049f, 0.022241f, 0.022433f, 0.022624f, 0.022816f,
- 0.023008f, 0.023199f, 0.023391f, 0.023583f, 0.023774f, 0.023966f, 0.024158f, 0.024350f,
- 0.024541f, 0.024733f, 0.024925f, 0.025116f, 0.025308f, 0.025500f, 0.025691f, 0.025883f,
- 0.026075f, 0.026266f, 0.026458f, 0.026650f, 0.026841f, 0.027033f, 0.027225f, 0.027416f,
- 0.027608f, 0.027800f, 0.027991f, 0.028183f, 0.028375f, 0.028567f, 0.028758f, 0.028950f,
- 0.029142f, 0.029333f, 0.029525f, 0.029717f, 0.029908f, 0.030100f, 0.030291f, 0.030483f,
- 0.030675f, 0.030866f, 0.031058f, 0.031250f, 0.031441f, 0.031633f, 0.031825f, 0.032016f,
- 0.032208f, 0.032400f, 0.032591f, 0.032783f, 0.032975f, 0.033166f, 0.033358f, 0.033550f,
- 0.033741f, 0.033933f, 0.034124f, 0.034316f, 0.034508f, 0.034699f, 0.034891f, 0.035083f,
- 0.035274f, 0.035466f, 0.035657f, 0.035849f, 0.036041f, 0.036232f, 0.036424f, 0.036616f,
- 0.036807f, 0.036999f, 0.037190f, 0.037382f, 0.037574f, 0.037765f, 0.037957f, 0.038149f,
- 0.038340f, 0.038532f, 0.038723f, 0.038915f, 0.039107f, 0.039298f, 0.039490f, 0.039681f,
- 0.039873f, 0.040065f, 0.040256f, 0.040448f, 0.040639f, 0.040831f, 0.041022f, 0.041214f,
- 0.041406f, 0.041597f, 0.041789f, 0.041980f, 0.042172f, 0.042364f, 0.042555f, 0.042747f,
- 0.042938f, 0.043130f, 0.043321f, 0.043513f, 0.043705f, 0.043896f, 0.044088f, 0.044279f,
- 0.044471f, 0.044662f, 0.044854f, 0.045045f, 0.045237f, 0.045429f, 0.045620f, 0.045812f,
- 0.046003f, 0.046195f, 0.046386f, 0.046578f, 0.046769f, 0.046961f, 0.047152f, 0.047344f,
- 0.047535f, 0.047727f, 0.047919f, 0.048110f, 0.048302f, 0.048493f, 0.048685f, 0.048876f,
- 0.049068f, 0.049259f, 0.049451f, 0.049642f, 0.049834f, 0.050025f, 0.050217f, 0.050408f,
- 0.050600f, 0.050791f, 0.050983f, 0.051174f, 0.051366f, 0.051557f, 0.051749f, 0.051940f,
- 0.052132f, 0.052323f, 0.052515f, 0.052706f, 0.052898f, 0.053089f, 0.053281f, 0.053472f,
- 0.053664f, 0.053855f, 0.054046f, 0.054238f, 0.054429f, 0.054621f, 0.054812f, 0.055004f,
- 0.055195f, 0.055387f, 0.055578f, 0.055770f, 0.055961f, 0.056152f, 0.056344f, 0.056535f,
- 0.056727f, 0.056918f, 0.057110f, 0.057301f, 0.057493f, 0.057684f, 0.057875f, 0.058067f,
- 0.058258f, 0.058450f, 0.058641f, 0.058833f, 0.059024f, 0.059215f, 0.059407f, 0.059598f,
- 0.059790f, 0.059981f, 0.060172f, 0.060364f, 0.060555f, 0.060747f, 0.060938f, 0.061129f,
- 0.061321f, 0.061512f, 0.061704f, 0.061895f, 0.062086f, 0.062278f, 0.062469f, 0.062660f,
- 0.062852f, 0.063043f, 0.063234f, 0.063426f, 0.063617f, 0.063809f, 0.064000f, 0.064191f,
- 0.064383f, 0.064574f, 0.064765f, 0.064957f, 0.065148f, 0.065339f, 0.065531f, 0.065722f,
- 0.065913f, 0.066105f, 0.066296f, 0.066487f, 0.066679f, 0.066870f, 0.067061f, 0.067253f,
- 0.067444f, 0.067635f, 0.067827f, 0.068018f, 0.068209f, 0.068400f, 0.068592f, 0.068783f,
- 0.068974f, 0.069166f, 0.069357f, 0.069548f, 0.069739f, 0.069931f, 0.070122f, 0.070313f,
- 0.070505f, 0.070696f, 0.070887f, 0.071078f, 0.071270f, 0.071461f, 0.071652f, 0.071843f,
- 0.072035f, 0.072226f, 0.072417f, 0.072608f, 0.072800f, 0.072991f, 0.073182f, 0.073373f,
- 0.073565f, 0.073756f, 0.073947f, 0.074138f, 0.074329f, 0.074521f, 0.074712f, 0.074903f,
- 0.075094f, 0.075286f, 0.075477f, 0.075668f, 0.075859f, 0.076050f, 0.076241f, 0.076433f,
- 0.076624f, 0.076815f, 0.077006f, 0.077197f, 0.077389f, 0.077580f, 0.077771f, 0.077962f,
- 0.078153f, 0.078344f, 0.078536f, 0.078727f, 0.078918f, 0.079109f, 0.079300f, 0.079491f,
- 0.079682f, 0.079874f, 0.080065f, 0.080256f, 0.080447f, 0.080638f, 0.080829f, 0.081020f,
- 0.081211f, 0.081403f, 0.081594f, 0.081785f, 0.081976f, 0.082167f, 0.082358f, 0.082549f,
- 0.082740f, 0.082931f, 0.083122f, 0.083314f, 0.083505f, 0.083696f, 0.083887f, 0.084078f,
- 0.084269f, 0.084460f, 0.084651f, 0.084842f, 0.085033f, 0.085224f, 0.085415f, 0.085606f,
- 0.085797f, 0.085988f, 0.086179f, 0.086370f, 0.086561f, 0.086752f, 0.086943f, 0.087135f,
- 0.087326f, 0.087517f, 0.087708f, 0.087899f, 0.088090f, 0.088281f, 0.088472f, 0.088663f,
- 0.088854f, 0.089045f, 0.089236f, 0.089427f, 0.089617f, 0.089808f, 0.089999f, 0.090190f,
- 0.090381f, 0.090572f, 0.090763f, 0.090954f, 0.091145f, 0.091336f, 0.091527f, 0.091718f,
- 0.091909f, 0.092100f, 0.092291f, 0.092482f, 0.092673f, 0.092864f, 0.093055f, 0.093245f,
- 0.093436f, 0.093627f, 0.093818f, 0.094009f, 0.094200f, 0.094391f, 0.094582f, 0.094773f,
- 0.094963f, 0.095154f, 0.095345f, 0.095536f, 0.095727f, 0.095918f, 0.096109f, 0.096300f,
- 0.096490f, 0.096681f, 0.096872f, 0.097063f, 0.097254f, 0.097445f, 0.097635f, 0.097826f,
- 0.098017f, 0.098208f, 0.098399f, 0.098590f, 0.098780f, 0.098971f, 0.099162f, 0.099353f,
- 0.099544f, 0.099734f, 0.099925f, 0.100116f, 0.100307f, 0.100498f, 0.100688f, 0.100879f,
- 0.101070f, 0.101261f, 0.101451f, 0.101642f, 0.101833f, 0.102024f, 0.102214f, 0.102405f,
- 0.102596f, 0.102787f, 0.102977f, 0.103168f, 0.103359f, 0.103550f, 0.103740f, 0.103931f,
- 0.104122f, 0.104312f, 0.104503f, 0.104694f, 0.104884f, 0.105075f, 0.105266f, 0.105456f,
- 0.105647f, 0.105838f, 0.106028f, 0.106219f, 0.106410f, 0.106600f, 0.106791f, 0.106982f,
- 0.107172f, 0.107363f, 0.107554f, 0.107744f, 0.107935f, 0.108126f, 0.108316f, 0.108507f,
- 0.108697f, 0.108888f, 0.109079f, 0.109269f, 0.109460f, 0.109650f, 0.109841f, 0.110032f,
- 0.110222f, 0.110413f, 0.110603f, 0.110794f, 0.110984f, 0.111175f, 0.111366f, 0.111556f,
- 0.111747f, 0.111937f, 0.112128f, 0.112318f, 0.112509f, 0.112699f, 0.112890f, 0.113080f,
- 0.113271f, 0.113461f, 0.113652f, 0.113842f, 0.114033f, 0.114223f, 0.114414f, 0.114604f,
- 0.114795f, 0.114985f, 0.115176f, 0.115366f, 0.115557f, 0.115747f, 0.115938f, 0.116128f,
- 0.116319f, 0.116509f, 0.116700f, 0.116890f, 0.117080f, 0.117271f, 0.117461f, 0.117652f,
- 0.117842f, 0.118032f, 0.118223f, 0.118413f, 0.118604f, 0.118794f, 0.118984f, 0.119175f,
- 0.119365f, 0.119556f, 0.119746f, 0.119936f, 0.120127f, 0.120317f, 0.120507f, 0.120698f,
- 0.120888f, 0.121078f, 0.121269f, 0.121459f, 0.121649f, 0.121840f, 0.122030f, 0.122220f,
- 0.122411f, 0.122601f, 0.122791f, 0.122982f, 0.123172f, 0.123362f, 0.123552f, 0.123743f,
- 0.123933f, 0.124123f, 0.124314f, 0.124504f, 0.124694f, 0.124884f, 0.125075f, 0.125265f,
- 0.125455f, 0.125645f, 0.125835f, 0.126026f, 0.126216f, 0.126406f, 0.126596f, 0.126787f,
- 0.126977f, 0.127167f, 0.127357f, 0.127547f, 0.127737f, 0.127928f, 0.128118f, 0.128308f,
- 0.128498f, 0.128688f, 0.128878f, 0.129069f, 0.129259f, 0.129449f, 0.129639f, 0.129829f,
- 0.130019f, 0.130209f, 0.130399f, 0.130590f, 0.130780f, 0.130970f, 0.131160f, 0.131350f,
- 0.131540f, 0.131730f, 0.131920f, 0.132110f, 0.132300f, 0.132490f, 0.132680f, 0.132870f,
- 0.133061f, 0.133251f, 0.133441f, 0.133631f, 0.133821f, 0.134011f, 0.134201f, 0.134391f,
- 0.134581f, 0.134771f, 0.134961f, 0.135151f, 0.135341f, 0.135531f, 0.135721f, 0.135911f,
- 0.136101f, 0.136291f, 0.136480f, 0.136670f, 0.136860f, 0.137050f, 0.137240f, 0.137430f,
- 0.137620f, 0.137810f, 0.138000f, 0.138190f, 0.138380f, 0.138570f, 0.138760f, 0.138949f,
- 0.139139f, 0.139329f, 0.139519f, 0.139709f, 0.139899f, 0.140089f, 0.140279f, 0.140468f,
- 0.140658f, 0.140848f, 0.141038f, 0.141228f, 0.141418f, 0.141607f, 0.141797f, 0.141987f,
- 0.142177f, 0.142367f, 0.142556f, 0.142746f, 0.142936f, 0.143126f, 0.143316f, 0.143505f,
- 0.143695f, 0.143885f, 0.144075f, 0.144264f, 0.144454f, 0.144644f, 0.144833f, 0.145023f,
- 0.145213f, 0.145403f, 0.145592f, 0.145782f, 0.145972f, 0.146161f, 0.146351f, 0.146541f,
- 0.146730f, 0.146920f, 0.147110f, 0.147299f, 0.147489f, 0.147679f, 0.147868f, 0.148058f,
- 0.148248f, 0.148437f, 0.148627f, 0.148817f, 0.149006f, 0.149196f, 0.149385f, 0.149575f,
- 0.149765f, 0.149954f, 0.150144f, 0.150333f, 0.150523f, 0.150712f, 0.150902f, 0.151092f,
- 0.151281f, 0.151471f, 0.151660f, 0.151850f, 0.152039f, 0.152229f, 0.152418f, 0.152608f,
- 0.152797f, 0.152987f, 0.153176f, 0.153366f, 0.153555f, 0.153745f, 0.153934f, 0.154124f,
- 0.154313f, 0.154502f, 0.154692f, 0.154881f, 0.155071f, 0.155260f, 0.155450f, 0.155639f,
- 0.155828f, 0.156018f, 0.156207f, 0.156397f, 0.156586f, 0.156775f, 0.156965f, 0.157154f,
- 0.157343f, 0.157533f, 0.157722f, 0.157912f, 0.158101f, 0.158290f, 0.158480f, 0.158669f,
- 0.158858f, 0.159047f, 0.159237f, 0.159426f, 0.159615f, 0.159805f, 0.159994f, 0.160183f,
- 0.160372f, 0.160562f, 0.160751f, 0.160940f, 0.161129f, 0.161319f, 0.161508f, 0.161697f,
- 0.161886f, 0.162076f, 0.162265f, 0.162454f, 0.162643f, 0.162832f, 0.163022f, 0.163211f,
- 0.163400f, 0.163589f, 0.163778f, 0.163967f, 0.164157f, 0.164346f, 0.164535f, 0.164724f,
- 0.164913f, 0.165102f, 0.165291f, 0.165480f, 0.165670f, 0.165859f, 0.166048f, 0.166237f,
- 0.166426f, 0.166615f, 0.166804f, 0.166993f, 0.167182f, 0.167371f, 0.167560f, 0.167749f,
- 0.167938f, 0.168127f, 0.168316f, 0.168505f, 0.168694f, 0.168883f, 0.169072f, 0.169261f,
- 0.169450f, 0.169639f, 0.169828f, 0.170017f, 0.170206f, 0.170395f, 0.170584f, 0.170773f,
- 0.170962f, 0.171151f, 0.171340f, 0.171529f, 0.171718f, 0.171906f, 0.172095f, 0.172284f,
- 0.172473f, 0.172662f, 0.172851f, 0.173040f, 0.173229f, 0.173417f, 0.173606f, 0.173795f,
- 0.173984f, 0.174173f, 0.174362f, 0.174550f, 0.174739f, 0.174928f, 0.175117f, 0.175305f,
- 0.175494f, 0.175683f, 0.175872f, 0.176061f, 0.176249f, 0.176438f, 0.176627f, 0.176815f,
- 0.177004f, 0.177193f, 0.177382f, 0.177570f, 0.177759f, 0.177948f, 0.178136f, 0.178325f,
- 0.178514f, 0.178702f, 0.178891f, 0.179080f, 0.179268f, 0.179457f, 0.179646f, 0.179834f,
- 0.180023f, 0.180212f, 0.180400f, 0.180589f, 0.180777f, 0.180966f, 0.181154f, 0.181343f,
- 0.181532f, 0.181720f, 0.181909f, 0.182097f, 0.182286f, 0.182474f, 0.182663f, 0.182851f,
- 0.183040f, 0.183228f, 0.183417f, 0.183605f, 0.183794f, 0.183982f, 0.184171f, 0.184359f,
- 0.184548f, 0.184736f, 0.184925f, 0.185113f, 0.185301f, 0.185490f, 0.185678f, 0.185867f,
- 0.186055f, 0.186244f, 0.186432f, 0.186620f, 0.186809f, 0.186997f, 0.187185f, 0.187374f,
- 0.187562f, 0.187750f, 0.187939f, 0.188127f, 0.188315f, 0.188504f, 0.188692f, 0.188880f,
- 0.189069f, 0.189257f, 0.189445f, 0.189634f, 0.189822f, 0.190010f, 0.190198f, 0.190387f,
- 0.190575f, 0.190763f, 0.190951f, 0.191139f, 0.191328f, 0.191516f, 0.191704f, 0.191892f,
- 0.192080f, 0.192269f, 0.192457f, 0.192645f, 0.192833f, 0.193021f, 0.193209f, 0.193397f,
- 0.193586f, 0.193774f, 0.193962f, 0.194150f, 0.194338f, 0.194526f, 0.194714f, 0.194902f,
- 0.195090f, 0.195278f, 0.195466f, 0.195654f, 0.195843f, 0.196031f, 0.196219f, 0.196407f,
- 0.196595f, 0.196783f, 0.196971f, 0.197159f, 0.197347f, 0.197535f, 0.197722f, 0.197910f,
- 0.198098f, 0.198286f, 0.198474f, 0.198662f, 0.198850f, 0.199038f, 0.199226f, 0.199414f,
- 0.199602f, 0.199790f, 0.199978f, 0.200165f, 0.200353f, 0.200541f, 0.200729f, 0.200917f,
- 0.201105f, 0.201292f, 0.201480f, 0.201668f, 0.201856f, 0.202044f, 0.202231f, 0.202419f,
- 0.202607f, 0.202795f, 0.202983f, 0.203170f, 0.203358f, 0.203546f, 0.203734f, 0.203921f,
- 0.204109f, 0.204297f, 0.204484f, 0.204672f, 0.204860f, 0.205047f, 0.205235f, 0.205423f,
- 0.205610f, 0.205798f, 0.205986f, 0.206173f, 0.206361f, 0.206549f, 0.206736f, 0.206924f,
- 0.207111f, 0.207299f, 0.207487f, 0.207674f, 0.207862f, 0.208049f, 0.208237f, 0.208424f,
- 0.208612f, 0.208799f, 0.208987f, 0.209174f, 0.209362f, 0.209549f, 0.209737f, 0.209924f,
- 0.210112f, 0.210299f, 0.210487f, 0.210674f, 0.210862f, 0.211049f, 0.211237f, 0.211424f,
- 0.211611f, 0.211799f, 0.211986f, 0.212174f, 0.212361f, 0.212548f, 0.212736f, 0.212923f,
- 0.213110f, 0.213298f, 0.213485f, 0.213672f, 0.213860f, 0.214047f, 0.214234f, 0.214422f,
- 0.214609f, 0.214796f, 0.214983f, 0.215171f, 0.215358f, 0.215545f, 0.215732f, 0.215920f,
- 0.216107f, 0.216294f, 0.216481f, 0.216668f, 0.216856f, 0.217043f, 0.217230f, 0.217417f,
- 0.217604f, 0.217791f, 0.217979f, 0.218166f, 0.218353f, 0.218540f, 0.218727f, 0.218914f,
- 0.219101f, 0.219288f, 0.219475f, 0.219662f, 0.219850f, 0.220037f, 0.220224f, 0.220411f,
- 0.220598f, 0.220785f, 0.220972f, 0.221159f, 0.221346f, 0.221533f, 0.221720f, 0.221907f,
- 0.222094f, 0.222281f, 0.222468f, 0.222654f, 0.222841f, 0.223028f, 0.223215f, 0.223402f,
- 0.223589f, 0.223776f, 0.223963f, 0.224150f, 0.224337f, 0.224523f, 0.224710f, 0.224897f,
- 0.225084f, 0.225271f, 0.225458f, 0.225644f, 0.225831f, 0.226018f, 0.226205f, 0.226391f,
- 0.226578f, 0.226765f, 0.226952f, 0.227139f, 0.227325f, 0.227512f, 0.227699f, 0.227885f,
- 0.228072f, 0.228259f, 0.228445f, 0.228632f, 0.228819f, 0.229005f, 0.229192f, 0.229379f,
- 0.229565f, 0.229752f, 0.229939f, 0.230125f, 0.230312f, 0.230498f, 0.230685f, 0.230872f,
- 0.231058f, 0.231245f, 0.231431f, 0.231618f, 0.231804f, 0.231991f, 0.232177f, 0.232364f,
- 0.232550f, 0.232737f, 0.232923f, 0.233110f, 0.233296f, 0.233483f, 0.233669f, 0.233856f,
- 0.234042f, 0.234228f, 0.234415f, 0.234601f, 0.234788f, 0.234974f, 0.235160f, 0.235347f,
- 0.235533f, 0.235719f, 0.235906f, 0.236092f, 0.236278f, 0.236465f, 0.236651f, 0.236837f,
- 0.237024f, 0.237210f, 0.237396f, 0.237582f, 0.237769f, 0.237955f, 0.238141f, 0.238327f,
- 0.238514f, 0.238700f, 0.238886f, 0.239072f, 0.239258f, 0.239445f, 0.239631f, 0.239817f,
- 0.240003f, 0.240189f, 0.240375f, 0.240561f, 0.240748f, 0.240934f, 0.241120f, 0.241306f,
- 0.241492f, 0.241678f, 0.241864f, 0.242050f, 0.242236f, 0.242422f, 0.242608f, 0.242794f,
- 0.242980f, 0.243166f, 0.243352f, 0.243538f, 0.243724f, 0.243910f, 0.244096f, 0.244282f,
- 0.244468f, 0.244654f, 0.244840f, 0.245026f, 0.245212f, 0.245397f, 0.245583f, 0.245769f,
- 0.245955f, 0.246141f, 0.246327f, 0.246513f, 0.246698f, 0.246884f, 0.247070f, 0.247256f,
- 0.247442f, 0.247627f, 0.247813f, 0.247999f, 0.248185f, 0.248370f, 0.248556f, 0.248742f,
- 0.248928f, 0.249113f, 0.249299f, 0.249485f, 0.249670f, 0.249856f, 0.250042f, 0.250227f,
- 0.250413f, 0.250599f, 0.250784f, 0.250970f, 0.251155f, 0.251341f, 0.251527f, 0.251712f,
- 0.251898f, 0.252083f, 0.252269f, 0.252454f, 0.252640f, 0.252826f, 0.253011f, 0.253197f,
- 0.253382f, 0.253568f, 0.253753f, 0.253938f, 0.254124f, 0.254309f, 0.254495f, 0.254680f,
- 0.254866f, 0.255051f, 0.255236f, 0.255422f, 0.255607f, 0.255793f, 0.255978f, 0.256163f,
- 0.256349f, 0.256534f, 0.256719f, 0.256905f, 0.257090f, 0.257275f, 0.257461f, 0.257646f,
- 0.257831f, 0.258016f, 0.258202f, 0.258387f, 0.258572f, 0.258757f, 0.258943f, 0.259128f,
- 0.259313f, 0.259498f, 0.259683f, 0.259868f, 0.260054f, 0.260239f, 0.260424f, 0.260609f,
- 0.260794f, 0.260979f, 0.261164f, 0.261349f, 0.261534f, 0.261720f, 0.261905f, 0.262090f,
- 0.262275f, 0.262460f, 0.262645f, 0.262830f, 0.263015f, 0.263200f, 0.263385f, 0.263570f,
- 0.263755f, 0.263940f, 0.264125f, 0.264309f, 0.264494f, 0.264679f, 0.264864f, 0.265049f,
- 0.265234f, 0.265419f, 0.265604f, 0.265789f, 0.265973f, 0.266158f, 0.266343f, 0.266528f,
- 0.266713f, 0.266898f, 0.267082f, 0.267267f, 0.267452f, 0.267637f, 0.267821f, 0.268006f,
- 0.268191f, 0.268376f, 0.268560f, 0.268745f, 0.268930f, 0.269114f, 0.269299f, 0.269484f,
- 0.269668f, 0.269853f, 0.270038f, 0.270222f, 0.270407f, 0.270591f, 0.270776f, 0.270961f,
- 0.271145f, 0.271330f, 0.271514f, 0.271699f, 0.271883f, 0.272068f, 0.272252f, 0.272437f,
- 0.272621f, 0.272806f, 0.272990f, 0.273175f, 0.273359f, 0.273544f, 0.273728f, 0.273912f,
- 0.274097f, 0.274281f, 0.274466f, 0.274650f, 0.274834f, 0.275019f, 0.275203f, 0.275387f,
- 0.275572f, 0.275756f, 0.275940f, 0.276125f, 0.276309f, 0.276493f, 0.276678f, 0.276862f,
- 0.277046f, 0.277230f, 0.277415f, 0.277599f, 0.277783f, 0.277967f, 0.278151f, 0.278336f,
- 0.278520f, 0.278704f, 0.278888f, 0.279072f, 0.279256f, 0.279440f, 0.279624f, 0.279809f,
- 0.279993f, 0.280177f, 0.280361f, 0.280545f, 0.280729f, 0.280913f, 0.281097f, 0.281281f,
- 0.281465f, 0.281649f, 0.281833f, 0.282017f, 0.282201f, 0.282385f, 0.282569f, 0.282753f,
- 0.282937f, 0.283120f, 0.283304f, 0.283488f, 0.283672f, 0.283856f, 0.284040f, 0.284224f,
- 0.284408f, 0.284591f, 0.284775f, 0.284959f, 0.285143f, 0.285327f, 0.285510f, 0.285694f,
- 0.285878f, 0.286062f, 0.286245f, 0.286429f, 0.286613f, 0.286796f, 0.286980f, 0.287164f,
- 0.287347f, 0.287531f, 0.287715f, 0.287898f, 0.288082f, 0.288266f, 0.288449f, 0.288633f,
- 0.288816f, 0.289000f, 0.289184f, 0.289367f, 0.289551f, 0.289734f, 0.289918f, 0.290101f,
- 0.290285f, 0.290468f, 0.290652f, 0.290835f, 0.291019f, 0.291202f, 0.291385f, 0.291569f,
- 0.291752f, 0.291936f, 0.292119f, 0.292302f, 0.292486f, 0.292669f, 0.292852f, 0.293036f,
- 0.293219f, 0.293402f, 0.293586f, 0.293769f, 0.293952f, 0.294136f, 0.294319f, 0.294502f,
- 0.294685f, 0.294869f, 0.295052f, 0.295235f, 0.295418f, 0.295601f, 0.295785f, 0.295968f,
- 0.296151f, 0.296334f, 0.296517f, 0.296700f, 0.296883f, 0.297066f, 0.297250f, 0.297433f,
- 0.297616f, 0.297799f, 0.297982f, 0.298165f, 0.298348f, 0.298531f, 0.298714f, 0.298897f,
- 0.299080f, 0.299263f, 0.299446f, 0.299629f, 0.299812f, 0.299995f, 0.300177f, 0.300360f,
- 0.300543f, 0.300726f, 0.300909f, 0.301092f, 0.301275f, 0.301458f, 0.301640f, 0.301823f,
- 0.302006f, 0.302189f, 0.302372f, 0.302554f, 0.302737f, 0.302920f, 0.303103f, 0.303285f,
- 0.303468f, 0.303651f, 0.303833f, 0.304016f, 0.304199f, 0.304381f, 0.304564f, 0.304747f,
- 0.304929f, 0.305112f, 0.305294f, 0.305477f, 0.305660f, 0.305842f, 0.306025f, 0.306207f,
- 0.306390f, 0.306572f, 0.306755f, 0.306937f, 0.307120f, 0.307302f, 0.307485f, 0.307667f,
- 0.307850f, 0.308032f, 0.308214f, 0.308397f, 0.308579f, 0.308762f, 0.308944f, 0.309126f,
- 0.309309f, 0.309491f, 0.309673f, 0.309856f, 0.310038f, 0.310220f, 0.310403f, 0.310585f,
- 0.310767f, 0.310949f, 0.311132f, 0.311314f, 0.311496f, 0.311678f, 0.311860f, 0.312043f,
- 0.312225f, 0.312407f, 0.312589f, 0.312771f, 0.312953f, 0.313135f, 0.313318f, 0.313500f,
- 0.313682f, 0.313864f, 0.314046f, 0.314228f, 0.314410f, 0.314592f, 0.314774f, 0.314956f,
- 0.315138f, 0.315320f, 0.315502f, 0.315684f, 0.315866f, 0.316048f, 0.316230f, 0.316411f,
- 0.316593f, 0.316775f, 0.316957f, 0.317139f, 0.317321f, 0.317503f, 0.317684f, 0.317866f,
- 0.318048f, 0.318230f, 0.318412f, 0.318593f, 0.318775f, 0.318957f, 0.319139f, 0.319320f,
- 0.319502f, 0.319684f, 0.319865f, 0.320047f, 0.320229f, 0.320410f, 0.320592f, 0.320774f,
- 0.320955f, 0.321137f, 0.321318f, 0.321500f, 0.321682f, 0.321863f, 0.322045f, 0.322226f,
- 0.322408f, 0.322589f, 0.322771f, 0.322952f, 0.323134f, 0.323315f, 0.323497f, 0.323678f,
- 0.323859f, 0.324041f, 0.324222f, 0.324404f, 0.324585f, 0.324766f, 0.324948f, 0.325129f,
- 0.325310f, 0.325492f, 0.325673f, 0.325854f, 0.326035f, 0.326217f, 0.326398f, 0.326579f,
- 0.326760f, 0.326942f, 0.327123f, 0.327304f, 0.327485f, 0.327666f, 0.327848f, 0.328029f,
- 0.328210f, 0.328391f, 0.328572f, 0.328753f, 0.328934f, 0.329115f, 0.329296f, 0.329477f,
- 0.329658f, 0.329839f, 0.330020f, 0.330202f, 0.330382f, 0.330563f, 0.330744f, 0.330925f,
- 0.331106f, 0.331287f, 0.331468f, 0.331649f, 0.331830f, 0.332011f, 0.332192f, 0.332373f,
- 0.332553f, 0.332734f, 0.332915f, 0.333096f, 0.333277f, 0.333457f, 0.333638f, 0.333819f,
- 0.334000f, 0.334180f, 0.334361f, 0.334542f, 0.334722f, 0.334903f, 0.335084f, 0.335265f,
- 0.335445f, 0.335626f, 0.335806f, 0.335987f, 0.336168f, 0.336348f, 0.336529f, 0.336709f,
- 0.336890f, 0.337070f, 0.337251f, 0.337431f, 0.337612f, 0.337792f, 0.337973f, 0.338153f,
- 0.338334f, 0.338514f, 0.338695f, 0.338875f, 0.339055f, 0.339236f, 0.339416f, 0.339597f,
- 0.339777f, 0.339957f, 0.340138f, 0.340318f, 0.340498f, 0.340678f, 0.340859f, 0.341039f,
- 0.341219f, 0.341399f, 0.341580f, 0.341760f, 0.341940f, 0.342120f, 0.342300f, 0.342481f,
- 0.342661f, 0.342841f, 0.343021f, 0.343201f, 0.343381f, 0.343561f, 0.343741f, 0.343921f,
- 0.344101f, 0.344281f, 0.344461f, 0.344641f, 0.344821f, 0.345001f, 0.345181f, 0.345361f,
- 0.345541f, 0.345721f, 0.345901f, 0.346081f, 0.346261f, 0.346441f, 0.346621f, 0.346801f,
- 0.346980f, 0.347160f, 0.347340f, 0.347520f, 0.347700f, 0.347879f, 0.348059f, 0.348239f,
- 0.348419f, 0.348598f, 0.348778f, 0.348958f, 0.349138f, 0.349317f, 0.349497f, 0.349676f,
- 0.349856f, 0.350036f, 0.350215f, 0.350395f, 0.350575f, 0.350754f, 0.350934f, 0.351113f,
- 0.351293f, 0.351472f, 0.351652f, 0.351831f, 0.352011f, 0.352190f, 0.352370f, 0.352549f,
- 0.352729f, 0.352908f, 0.353087f, 0.353267f, 0.353446f, 0.353626f, 0.353805f, 0.353984f,
- 0.354164f, 0.354343f, 0.354522f, 0.354701f, 0.354881f, 0.355060f, 0.355239f, 0.355418f,
- 0.355598f, 0.355777f, 0.355956f, 0.356135f, 0.356314f, 0.356494f, 0.356673f, 0.356852f,
- 0.357031f, 0.357210f, 0.357389f, 0.357568f, 0.357747f, 0.357926f, 0.358105f, 0.358284f,
- 0.358463f, 0.358642f, 0.358821f, 0.359000f, 0.359179f, 0.359358f, 0.359537f, 0.359716f,
- 0.359895f, 0.360074f, 0.360253f, 0.360432f, 0.360611f, 0.360789f, 0.360968f, 0.361147f,
- 0.361326f, 0.361505f, 0.361683f, 0.361862f, 0.362041f, 0.362220f, 0.362398f, 0.362577f,
- 0.362756f, 0.362934f, 0.363113f, 0.363292f, 0.363470f, 0.363649f, 0.363828f, 0.364006f,
- 0.364185f, 0.364363f, 0.364542f, 0.364720f, 0.364899f, 0.365078f, 0.365256f, 0.365435f,
- 0.365613f, 0.365791f, 0.365970f, 0.366148f, 0.366327f, 0.366505f, 0.366684f, 0.366862f,
- 0.367040f, 0.367219f, 0.367397f, 0.367575f, 0.367754f, 0.367932f, 0.368110f, 0.368289f,
- 0.368467f, 0.368645f, 0.368823f, 0.369002f, 0.369180f, 0.369358f, 0.369536f, 0.369714f,
- 0.369892f, 0.370071f, 0.370249f, 0.370427f, 0.370605f, 0.370783f, 0.370961f, 0.371139f,
- 0.371317f, 0.371495f, 0.371673f, 0.371851f, 0.372029f, 0.372207f, 0.372385f, 0.372563f,
- 0.372741f, 0.372919f, 0.373097f, 0.373275f, 0.373453f, 0.373631f, 0.373808f, 0.373986f,
- 0.374164f, 0.374342f, 0.374520f, 0.374697f, 0.374875f, 0.375053f, 0.375231f, 0.375408f,
- 0.375586f, 0.375764f, 0.375942f, 0.376119f, 0.376297f, 0.376475f, 0.376652f, 0.376830f,
- 0.377007f, 0.377185f, 0.377363f, 0.377540f, 0.377718f, 0.377895f, 0.378073f, 0.378250f,
- 0.378428f, 0.378605f, 0.378783f, 0.378960f, 0.379138f, 0.379315f, 0.379492f, 0.379670f,
- 0.379847f, 0.380025f, 0.380202f, 0.380379f, 0.380557f, 0.380734f, 0.380911f, 0.381088f,
- 0.381266f, 0.381443f, 0.381620f, 0.381797f, 0.381975f, 0.382152f, 0.382329f, 0.382506f,
- 0.382683f, 0.382861f, 0.383038f, 0.383215f, 0.383392f, 0.383569f, 0.383746f, 0.383923f,
- 0.384100f, 0.384277f, 0.384454f, 0.384631f, 0.384808f, 0.384985f, 0.385162f, 0.385339f,
- 0.385516f, 0.385693f, 0.385870f, 0.386047f, 0.386224f, 0.386400f, 0.386577f, 0.386754f,
- 0.386931f, 0.387108f, 0.387285f, 0.387461f, 0.387638f, 0.387815f, 0.387992f, 0.388168f,
- 0.388345f, 0.388522f, 0.388698f, 0.388875f, 0.389052f, 0.389228f, 0.389405f, 0.389582f,
- 0.389758f, 0.389935f, 0.390111f, 0.390288f, 0.390464f, 0.390641f, 0.390817f, 0.390994f,
- 0.391170f, 0.391347f, 0.391523f, 0.391700f, 0.391876f, 0.392053f, 0.392229f, 0.392405f,
- 0.392582f, 0.392758f, 0.392934f, 0.393111f, 0.393287f, 0.393463f, 0.393640f, 0.393816f,
- 0.393992f, 0.394168f, 0.394344f, 0.394521f, 0.394697f, 0.394873f, 0.395049f, 0.395225f,
- 0.395401f, 0.395578f, 0.395754f, 0.395930f, 0.396106f, 0.396282f, 0.396458f, 0.396634f,
- 0.396810f, 0.396986f, 0.397162f, 0.397338f, 0.397514f, 0.397690f, 0.397866f, 0.398042f,
- 0.398218f, 0.398393f, 0.398569f, 0.398745f, 0.398921f, 0.399097f, 0.399273f, 0.399448f,
- 0.399624f, 0.399800f, 0.399976f, 0.400151f, 0.400327f, 0.400503f, 0.400679f, 0.400854f,
- 0.401030f, 0.401206f, 0.401381f, 0.401557f, 0.401732f, 0.401908f, 0.402084f, 0.402259f,
- 0.402435f, 0.402610f, 0.402786f, 0.402961f, 0.403137f, 0.403312f, 0.403488f, 0.403663f,
- 0.403838f, 0.404014f, 0.404189f, 0.404365f, 0.404540f, 0.404715f, 0.404891f, 0.405066f,
- 0.405241f, 0.405417f, 0.405592f, 0.405767f, 0.405942f, 0.406118f, 0.406293f, 0.406468f,
- 0.406643f, 0.406818f, 0.406994f, 0.407169f, 0.407344f, 0.407519f, 0.407694f, 0.407869f,
- 0.408044f, 0.408219f, 0.408394f, 0.408569f, 0.408744f, 0.408919f, 0.409094f, 0.409269f,
- 0.409444f, 0.409619f, 0.409794f, 0.409969f, 0.410144f, 0.410319f, 0.410493f, 0.410668f,
- 0.410843f, 0.411018f, 0.411193f, 0.411368f, 0.411542f, 0.411717f, 0.411892f, 0.412067f,
- 0.412241f, 0.412416f, 0.412591f, 0.412765f, 0.412940f, 0.413115f, 0.413289f, 0.413464f,
- 0.413638f, 0.413813f, 0.413987f, 0.414162f, 0.414337f, 0.414511f, 0.414685f, 0.414860f,
- 0.415034f, 0.415209f, 0.415383f, 0.415558f, 0.415732f, 0.415906f, 0.416081f, 0.416255f,
- 0.416430f, 0.416604f, 0.416778f, 0.416952f, 0.417127f, 0.417301f, 0.417475f, 0.417650f,
- 0.417824f, 0.417998f, 0.418172f, 0.418346f, 0.418520f, 0.418695f, 0.418869f, 0.419043f,
- 0.419217f, 0.419391f, 0.419565f, 0.419739f, 0.419913f, 0.420087f, 0.420261f, 0.420435f,
- 0.420609f, 0.420783f, 0.420957f, 0.421131f, 0.421305f, 0.421479f, 0.421653f, 0.421826f,
- 0.422000f, 0.422174f, 0.422348f, 0.422522f, 0.422695f, 0.422869f, 0.423043f, 0.423217f,
- 0.423390f, 0.423564f, 0.423738f, 0.423912f, 0.424085f, 0.424259f, 0.424432f, 0.424606f,
- 0.424780f, 0.424953f, 0.425127f, 0.425300f, 0.425474f, 0.425647f, 0.425821f, 0.425994f,
- 0.426168f, 0.426341f, 0.426515f, 0.426688f, 0.426862f, 0.427035f, 0.427208f, 0.427382f,
- 0.427555f, 0.427728f, 0.427902f, 0.428075f, 0.428248f, 0.428422f, 0.428595f, 0.428768f,
- 0.428941f, 0.429114f, 0.429288f, 0.429461f, 0.429634f, 0.429807f, 0.429980f, 0.430153f,
- 0.430326f, 0.430500f, 0.430673f, 0.430846f, 0.431019f, 0.431192f, 0.431365f, 0.431538f,
- 0.431711f, 0.431884f, 0.432057f, 0.432229f, 0.432402f, 0.432575f, 0.432748f, 0.432921f,
- 0.433094f, 0.433267f, 0.433439f, 0.433612f, 0.433785f, 0.433958f, 0.434131f, 0.434303f,
- 0.434476f, 0.434649f, 0.434821f, 0.434994f, 0.435167f, 0.435339f, 0.435512f, 0.435685f,
- 0.435857f, 0.436030f, 0.436202f, 0.436375f, 0.436547f, 0.436720f, 0.436892f, 0.437065f,
- 0.437237f, 0.437410f, 0.437582f, 0.437754f, 0.437927f, 0.438099f, 0.438272f, 0.438444f,
- 0.438616f, 0.438789f, 0.438961f, 0.439133f, 0.439305f, 0.439478f, 0.439650f, 0.439822f,
- 0.439994f, 0.440166f, 0.440339f, 0.440511f, 0.440683f, 0.440855f, 0.441027f, 0.441199f,
- 0.441371f, 0.441543f, 0.441715f, 0.441887f, 0.442059f, 0.442231f, 0.442403f, 0.442575f,
- 0.442747f, 0.442919f, 0.443091f, 0.443263f, 0.443435f, 0.443607f, 0.443779f, 0.443950f,
- 0.444122f, 0.444294f, 0.444466f, 0.444637f, 0.444809f, 0.444981f, 0.445153f, 0.445324f,
- 0.445496f, 0.445668f, 0.445839f, 0.446011f, 0.446183f, 0.446354f, 0.446526f, 0.446697f,
- 0.446869f, 0.447040f, 0.447212f, 0.447383f, 0.447555f, 0.447726f, 0.447898f, 0.448069f,
- 0.448241f, 0.448412f, 0.448583f, 0.448755f, 0.448926f, 0.449097f, 0.449269f, 0.449440f,
- 0.449611f, 0.449783f, 0.449954f, 0.450125f, 0.450296f, 0.450467f, 0.450639f, 0.450810f,
- 0.450981f, 0.451152f, 0.451323f, 0.451494f, 0.451665f, 0.451836f, 0.452008f, 0.452179f,
- 0.452350f, 0.452521f, 0.452692f, 0.452863f, 0.453033f, 0.453204f, 0.453375f, 0.453546f,
- 0.453717f, 0.453888f, 0.454059f, 0.454230f, 0.454400f, 0.454571f, 0.454742f, 0.454913f,
- 0.455084f, 0.455254f, 0.455425f, 0.455596f, 0.455766f, 0.455937f, 0.456108f, 0.456278f,
- 0.456449f, 0.456620f, 0.456790f, 0.456961f, 0.457131f, 0.457302f, 0.457472f, 0.457643f,
- 0.457813f, 0.457984f, 0.458154f, 0.458325f, 0.458495f, 0.458665f, 0.458836f, 0.459006f,
- 0.459177f, 0.459347f, 0.459517f, 0.459687f, 0.459858f, 0.460028f, 0.460198f, 0.460369f,
- 0.460539f, 0.460709f, 0.460879f, 0.461049f, 0.461219f, 0.461390f, 0.461560f, 0.461730f,
- 0.461900f, 0.462070f, 0.462240f, 0.462410f, 0.462580f, 0.462750f, 0.462920f, 0.463090f,
- 0.463260f, 0.463430f, 0.463600f, 0.463769f, 0.463939f, 0.464109f, 0.464279f, 0.464449f,
- 0.464619f, 0.464788f, 0.464958f, 0.465128f, 0.465298f, 0.465467f, 0.465637f, 0.465807f,
- 0.465977f, 0.466146f, 0.466316f, 0.466485f, 0.466655f, 0.466825f, 0.466994f, 0.467164f,
- 0.467333f, 0.467503f, 0.467672f, 0.467842f, 0.468011f, 0.468181f, 0.468350f, 0.468519f,
- 0.468689f, 0.468858f, 0.469028f, 0.469197f, 0.469366f, 0.469536f, 0.469705f, 0.469874f,
- 0.470043f, 0.470213f, 0.470382f, 0.470551f, 0.470720f, 0.470889f, 0.471058f, 0.471228f,
- 0.471397f, 0.471566f, 0.471735f, 0.471904f, 0.472073f, 0.472242f, 0.472411f, 0.472580f,
- 0.472749f, 0.472918f, 0.473087f, 0.473256f, 0.473425f, 0.473594f, 0.473763f, 0.473931f,
- 0.474100f, 0.474269f, 0.474438f, 0.474607f, 0.474775f, 0.474944f, 0.475113f, 0.475282f,
- 0.475450f, 0.475619f, 0.475788f, 0.475956f, 0.476125f, 0.476294f, 0.476462f, 0.476631f,
- 0.476799f, 0.476968f, 0.477136f, 0.477305f, 0.477473f, 0.477642f, 0.477810f, 0.477979f,
- 0.478147f, 0.478315f, 0.478484f, 0.478652f, 0.478821f, 0.478989f, 0.479157f, 0.479325f,
- 0.479494f, 0.479662f, 0.479830f, 0.479998f, 0.480167f, 0.480335f, 0.480503f, 0.480671f,
- 0.480839f, 0.481007f, 0.481176f, 0.481344f, 0.481512f, 0.481680f, 0.481848f, 0.482016f,
- 0.482184f, 0.482352f, 0.482520f, 0.482688f, 0.482856f, 0.483023f, 0.483191f, 0.483359f,
- 0.483527f, 0.483695f, 0.483863f, 0.484031f, 0.484198f, 0.484366f, 0.484534f, 0.484702f,
- 0.484869f, 0.485037f, 0.485205f, 0.485372f, 0.485540f, 0.485708f, 0.485875f, 0.486043f,
- 0.486210f, 0.486378f, 0.486545f, 0.486713f, 0.486880f, 0.487048f, 0.487215f, 0.487383f,
- 0.487550f, 0.487718f, 0.487885f, 0.488052f, 0.488220f, 0.488387f, 0.488554f, 0.488722f,
- 0.488889f, 0.489056f, 0.489223f, 0.489391f, 0.489558f, 0.489725f, 0.489892f, 0.490059f,
- 0.490226f, 0.490394f, 0.490561f, 0.490728f, 0.490895f, 0.491062f, 0.491229f, 0.491396f,
- 0.491563f, 0.491730f, 0.491897f, 0.492064f, 0.492231f, 0.492398f, 0.492564f, 0.492731f,
- 0.492898f, 0.493065f, 0.493232f, 0.493399f, 0.493565f, 0.493732f, 0.493899f, 0.494066f,
- 0.494232f, 0.494399f, 0.494566f, 0.494732f, 0.494899f, 0.495066f, 0.495232f, 0.495399f,
- 0.495565f, 0.495732f, 0.495898f, 0.496065f, 0.496231f, 0.496398f, 0.496564f, 0.496731f,
- 0.496897f, 0.497063f, 0.497230f, 0.497396f, 0.497562f, 0.497729f, 0.497895f, 0.498061f,
- 0.498228f, 0.498394f, 0.498560f, 0.498726f, 0.498893f, 0.499059f, 0.499225f, 0.499391f,
- 0.499557f, 0.499723f, 0.499889f, 0.500055f, 0.500221f, 0.500387f, 0.500553f, 0.500719f,
- 0.500885f, 0.501051f, 0.501217f, 0.501383f, 0.501549f, 0.501715f, 0.501881f, 0.502047f,
- 0.502212f, 0.502378f, 0.502544f, 0.502710f, 0.502876f, 0.503041f, 0.503207f, 0.503373f,
- 0.503538f, 0.503704f, 0.503870f, 0.504035f, 0.504201f, 0.504366f, 0.504532f, 0.504698f,
- 0.504863f, 0.505029f, 0.505194f, 0.505360f, 0.505525f, 0.505690f, 0.505856f, 0.506021f,
- 0.506187f, 0.506352f, 0.506517f, 0.506683f, 0.506848f, 0.507013f, 0.507179f, 0.507344f,
- 0.507509f, 0.507674f, 0.507839f, 0.508005f, 0.508170f, 0.508335f, 0.508500f, 0.508665f,
- 0.508830f, 0.508995f, 0.509160f, 0.509325f, 0.509490f, 0.509655f, 0.509820f, 0.509985f,
- 0.510150f, 0.510315f, 0.510480f, 0.510645f, 0.510810f, 0.510974f, 0.511139f, 0.511304f,
- 0.511469f, 0.511634f, 0.511798f, 0.511963f, 0.512128f, 0.512292f, 0.512457f, 0.512622f,
- 0.512786f, 0.512951f, 0.513116f, 0.513280f, 0.513445f, 0.513609f, 0.513774f, 0.513938f,
- 0.514103f, 0.514267f, 0.514432f, 0.514596f, 0.514760f, 0.514925f, 0.515089f, 0.515254f,
- 0.515418f, 0.515582f, 0.515746f, 0.515911f, 0.516075f, 0.516239f, 0.516403f, 0.516568f,
- 0.516732f, 0.516896f, 0.517060f, 0.517224f, 0.517388f, 0.517552f, 0.517716f, 0.517880f,
- 0.518045f, 0.518209f, 0.518372f, 0.518536f, 0.518700f, 0.518864f, 0.519028f, 0.519192f,
- 0.519356f, 0.519520f, 0.519684f, 0.519848f, 0.520011f, 0.520175f, 0.520339f, 0.520503f,
- 0.520666f, 0.520830f, 0.520994f, 0.521157f, 0.521321f, 0.521485f, 0.521648f, 0.521812f,
- 0.521975f, 0.522139f, 0.522302f, 0.522466f, 0.522629f, 0.522793f, 0.522956f, 0.523120f,
- 0.523283f, 0.523447f, 0.523610f, 0.523773f, 0.523937f, 0.524100f, 0.524263f, 0.524426f,
- 0.524590f, 0.524753f, 0.524916f, 0.525079f, 0.525243f, 0.525406f, 0.525569f, 0.525732f,
- 0.525895f, 0.526058f, 0.526221f, 0.526384f, 0.526547f, 0.526710f, 0.526873f, 0.527036f,
- 0.527199f, 0.527362f, 0.527525f, 0.527688f, 0.527851f, 0.528014f, 0.528176f, 0.528339f,
- 0.528502f, 0.528665f, 0.528828f, 0.528990f, 0.529153f, 0.529316f, 0.529478f, 0.529641f,
- 0.529804f, 0.529966f, 0.530129f, 0.530291f, 0.530454f, 0.530617f, 0.530779f, 0.530942f,
- 0.531104f, 0.531266f, 0.531429f, 0.531591f, 0.531754f, 0.531916f, 0.532078f, 0.532241f,
- 0.532403f, 0.532565f, 0.532728f, 0.532890f, 0.533052f, 0.533214f, 0.533377f, 0.533539f,
- 0.533701f, 0.533863f, 0.534025f, 0.534187f, 0.534349f, 0.534512f, 0.534674f, 0.534836f,
- 0.534998f, 0.535160f, 0.535322f, 0.535484f, 0.535645f, 0.535807f, 0.535969f, 0.536131f,
- 0.536293f, 0.536455f, 0.536617f, 0.536778f, 0.536940f, 0.537102f, 0.537264f, 0.537425f,
- 0.537587f, 0.537749f, 0.537910f, 0.538072f, 0.538234f, 0.538395f, 0.538557f, 0.538718f,
- 0.538880f, 0.539041f, 0.539203f, 0.539364f, 0.539526f, 0.539687f, 0.539849f, 0.540010f,
- 0.540171f, 0.540333f, 0.540494f, 0.540655f, 0.540817f, 0.540978f, 0.541139f, 0.541301f,
- 0.541462f, 0.541623f, 0.541784f, 0.541945f, 0.542106f, 0.542268f, 0.542429f, 0.542590f,
- 0.542751f, 0.542912f, 0.543073f, 0.543234f, 0.543395f, 0.543556f, 0.543717f, 0.543878f,
- 0.544039f, 0.544199f, 0.544360f, 0.544521f, 0.544682f, 0.544843f, 0.545003f, 0.545164f,
- 0.545325f, 0.545486f, 0.545646f, 0.545807f, 0.545968f, 0.546128f, 0.546289f, 0.546450f,
- 0.546610f, 0.546771f, 0.546931f, 0.547092f, 0.547252f, 0.547413f, 0.547573f, 0.547734f,
- 0.547894f, 0.548054f, 0.548215f, 0.548375f, 0.548536f, 0.548696f, 0.548856f, 0.549016f,
- 0.549177f, 0.549337f, 0.549497f, 0.549657f, 0.549818f, 0.549978f, 0.550138f, 0.550298f,
- 0.550458f, 0.550618f, 0.550778f, 0.550938f, 0.551098f, 0.551258f, 0.551418f, 0.551578f,
- 0.551738f, 0.551898f, 0.552058f, 0.552218f, 0.552378f, 0.552537f, 0.552697f, 0.552857f,
- 0.553017f, 0.553176f, 0.553336f, 0.553496f, 0.553656f, 0.553815f, 0.553975f, 0.554134f,
- 0.554294f, 0.554454f, 0.554613f, 0.554773f, 0.554932f, 0.555092f, 0.555251f, 0.555411f,
- 0.555570f, 0.555730f, 0.555889f, 0.556048f, 0.556208f, 0.556367f, 0.556526f, 0.556686f,
- 0.556845f, 0.557004f, 0.557164f, 0.557323f, 0.557482f, 0.557641f, 0.557800f, 0.557959f,
- 0.558119f, 0.558278f, 0.558437f, 0.558596f, 0.558755f, 0.558914f, 0.559073f, 0.559232f,
- 0.559391f, 0.559550f, 0.559709f, 0.559867f, 0.560026f, 0.560185f, 0.560344f, 0.560503f,
- 0.560662f, 0.560820f, 0.560979f, 0.561138f, 0.561297f, 0.561455f, 0.561614f, 0.561773f,
- 0.561931f, 0.562090f, 0.562248f, 0.562407f, 0.562565f, 0.562724f, 0.562882f, 0.563041f,
- 0.563199f, 0.563358f, 0.563516f, 0.563675f, 0.563833f, 0.563991f, 0.564150f, 0.564308f,
- 0.564466f, 0.564624f, 0.564783f, 0.564941f, 0.565099f, 0.565257f, 0.565416f, 0.565574f,
- 0.565732f, 0.565890f, 0.566048f, 0.566206f, 0.566364f, 0.566522f, 0.566680f, 0.566838f,
- 0.566996f, 0.567154f, 0.567312f, 0.567470f, 0.567628f, 0.567786f, 0.567943f, 0.568101f,
- 0.568259f, 0.568417f, 0.568574f, 0.568732f, 0.568890f, 0.569048f, 0.569205f, 0.569363f,
- 0.569521f, 0.569678f, 0.569836f, 0.569993f, 0.570151f, 0.570308f, 0.570466f, 0.570623f,
- 0.570781f, 0.570938f, 0.571096f, 0.571253f, 0.571410f, 0.571568f, 0.571725f, 0.571882f,
- 0.572040f, 0.572197f, 0.572354f, 0.572511f, 0.572669f, 0.572826f, 0.572983f, 0.573140f,
- 0.573297f, 0.573454f, 0.573611f, 0.573768f, 0.573925f, 0.574082f, 0.574239f, 0.574396f,
- 0.574553f, 0.574710f, 0.574867f, 0.575024f, 0.575181f, 0.575338f, 0.575495f, 0.575651f,
- 0.575808f, 0.575965f, 0.576122f, 0.576278f, 0.576435f, 0.576592f, 0.576748f, 0.576905f,
- 0.577062f, 0.577218f, 0.577375f, 0.577531f, 0.577688f, 0.577844f, 0.578001f, 0.578157f,
- 0.578314f, 0.578470f, 0.578627f, 0.578783f, 0.578939f, 0.579096f, 0.579252f, 0.579408f,
- 0.579565f, 0.579721f, 0.579877f, 0.580033f, 0.580189f, 0.580346f, 0.580502f, 0.580658f,
- 0.580814f, 0.580970f, 0.581126f, 0.581282f, 0.581438f, 0.581594f, 0.581750f, 0.581906f,
- 0.582062f, 0.582218f, 0.582374f, 0.582530f, 0.582685f, 0.582841f, 0.582997f, 0.583153f,
- 0.583309f, 0.583464f, 0.583620f, 0.583776f, 0.583931f, 0.584087f, 0.584243f, 0.584398f,
- 0.584554f, 0.584710f, 0.584865f, 0.585021f, 0.585176f, 0.585332f, 0.585487f, 0.585642f,
- 0.585798f, 0.585953f, 0.586109f, 0.586264f, 0.586419f, 0.586575f, 0.586730f, 0.586885f,
- 0.587040f, 0.587196f, 0.587351f, 0.587506f, 0.587661f, 0.587816f, 0.587971f, 0.588126f,
- 0.588282f, 0.588437f, 0.588592f, 0.588747f, 0.588902f, 0.589057f, 0.589212f, 0.589366f,
- 0.589521f, 0.589676f, 0.589831f, 0.589986f, 0.590141f, 0.590295f, 0.590450f, 0.590605f,
- 0.590760f, 0.590914f, 0.591069f, 0.591224f, 0.591378f, 0.591533f, 0.591688f, 0.591842f,
- 0.591997f, 0.592151f, 0.592306f, 0.592460f, 0.592615f, 0.592769f, 0.592924f, 0.593078f,
- 0.593232f, 0.593387f, 0.593541f, 0.593695f, 0.593850f, 0.594004f, 0.594158f, 0.594312f,
- 0.594467f, 0.594621f, 0.594775f, 0.594929f, 0.595083f, 0.595237f, 0.595391f, 0.595545f,
- 0.595699f, 0.595853f, 0.596007f, 0.596161f, 0.596315f, 0.596469f, 0.596623f, 0.596777f,
- 0.596931f, 0.597085f, 0.597238f, 0.597392f, 0.597546f, 0.597700f, 0.597853f, 0.598007f,
- 0.598161f, 0.598314f, 0.598468f, 0.598622f, 0.598775f, 0.598929f, 0.599082f, 0.599236f,
- 0.599389f, 0.599543f, 0.599696f, 0.599850f, 0.600003f, 0.600156f, 0.600310f, 0.600463f,
- 0.600616f, 0.600770f, 0.600923f, 0.601076f, 0.601230f, 0.601383f, 0.601536f, 0.601689f,
- 0.601842f, 0.601995f, 0.602148f, 0.602302f, 0.602455f, 0.602608f, 0.602761f, 0.602914f,
- 0.603067f, 0.603220f, 0.603372f, 0.603525f, 0.603678f, 0.603831f, 0.603984f, 0.604137f,
- 0.604290f, 0.604442f, 0.604595f, 0.604748f, 0.604900f, 0.605053f, 0.605206f, 0.605358f,
- 0.605511f, 0.605664f, 0.605816f, 0.605969f, 0.606121f, 0.606274f, 0.606426f, 0.606579f,
- 0.606731f, 0.606884f, 0.607036f, 0.607188f, 0.607341f, 0.607493f, 0.607645f, 0.607798f,
- 0.607950f, 0.608102f, 0.608254f, 0.608406f, 0.608559f, 0.608711f, 0.608863f, 0.609015f,
- 0.609167f, 0.609319f, 0.609471f, 0.609623f, 0.609775f, 0.609927f, 0.610079f, 0.610231f,
- 0.610383f, 0.610535f, 0.610687f, 0.610838f, 0.610990f, 0.611142f, 0.611294f, 0.611445f,
- 0.611597f, 0.611749f, 0.611901f, 0.612052f, 0.612204f, 0.612355f, 0.612507f, 0.612659f,
- 0.612810f, 0.612962f, 0.613113f, 0.613265f, 0.613416f, 0.613567f, 0.613719f, 0.613870f,
- 0.614022f, 0.614173f, 0.614324f, 0.614475f, 0.614627f, 0.614778f, 0.614929f, 0.615080f,
- 0.615232f, 0.615383f, 0.615534f, 0.615685f, 0.615836f, 0.615987f, 0.616138f, 0.616289f,
- 0.616440f, 0.616591f, 0.616742f, 0.616893f, 0.617044f, 0.617195f, 0.617346f, 0.617496f,
- 0.617647f, 0.617798f, 0.617949f, 0.618100f, 0.618250f, 0.618401f, 0.618552f, 0.618702f,
- 0.618853f, 0.619004f, 0.619154f, 0.619305f, 0.619455f, 0.619606f, 0.619756f, 0.619907f,
- 0.620057f, 0.620208f, 0.620358f, 0.620508f, 0.620659f, 0.620809f, 0.620959f, 0.621110f,
- 0.621260f, 0.621410f, 0.621560f, 0.621711f, 0.621861f, 0.622011f, 0.622161f, 0.622311f,
- 0.622461f, 0.622611f, 0.622761f, 0.622911f, 0.623061f, 0.623211f, 0.623361f, 0.623511f,
- 0.623661f, 0.623811f, 0.623961f, 0.624111f, 0.624260f, 0.624410f, 0.624560f, 0.624710f,
- 0.624860f, 0.625009f, 0.625159f, 0.625309f, 0.625458f, 0.625608f, 0.625757f, 0.625907f,
- 0.626056f, 0.626206f, 0.626355f, 0.626505f, 0.626654f, 0.626804f, 0.626953f, 0.627102f,
- 0.627252f, 0.627401f, 0.627550f, 0.627700f, 0.627849f, 0.627998f, 0.628147f, 0.628297f,
- 0.628446f, 0.628595f, 0.628744f, 0.628893f, 0.629042f, 0.629191f, 0.629340f, 0.629489f,
- 0.629638f, 0.629787f, 0.629936f, 0.630085f, 0.630234f, 0.630383f, 0.630532f, 0.630680f,
- 0.630829f, 0.630978f, 0.631127f, 0.631275f, 0.631424f, 0.631573f, 0.631721f, 0.631870f,
- 0.632019f, 0.632167f, 0.632316f, 0.632464f, 0.632613f, 0.632761f, 0.632910f, 0.633058f,
- 0.633207f, 0.633355f, 0.633504f, 0.633652f, 0.633800f, 0.633949f, 0.634097f, 0.634245f,
- 0.634393f, 0.634542f, 0.634690f, 0.634838f, 0.634986f, 0.635134f, 0.635282f, 0.635430f,
- 0.635578f, 0.635726f, 0.635874f, 0.636022f, 0.636170f, 0.636318f, 0.636466f, 0.636614f,
- 0.636762f, 0.636910f, 0.637057f, 0.637205f, 0.637353f, 0.637501f, 0.637649f, 0.637796f,
- 0.637944f, 0.638092f, 0.638239f, 0.638387f, 0.638534f, 0.638682f, 0.638829f, 0.638977f,
- 0.639124f, 0.639272f, 0.639419f, 0.639567f, 0.639714f, 0.639862f, 0.640009f, 0.640156f,
- 0.640303f, 0.640451f, 0.640598f, 0.640745f, 0.640892f, 0.641040f, 0.641187f, 0.641334f,
- 0.641481f, 0.641628f, 0.641775f, 0.641922f, 0.642069f, 0.642216f, 0.642363f, 0.642510f,
- 0.642657f, 0.642804f, 0.642951f, 0.643098f, 0.643245f, 0.643391f, 0.643538f, 0.643685f,
- 0.643832f, 0.643978f, 0.644125f, 0.644272f, 0.644418f, 0.644565f, 0.644711f, 0.644858f,
- 0.645005f, 0.645151f, 0.645298f, 0.645444f, 0.645590f, 0.645737f, 0.645883f, 0.646030f,
- 0.646176f, 0.646322f, 0.646469f, 0.646615f, 0.646761f, 0.646907f, 0.647054f, 0.647200f,
- 0.647346f, 0.647492f, 0.647638f, 0.647784f, 0.647930f, 0.648076f, 0.648222f, 0.648368f,
- 0.648514f, 0.648660f, 0.648806f, 0.648952f, 0.649098f, 0.649244f, 0.649390f, 0.649536f,
- 0.649681f, 0.649827f, 0.649973f, 0.650119f, 0.650264f, 0.650410f, 0.650555f, 0.650701f,
- 0.650847f, 0.650992f, 0.651138f, 0.651283f, 0.651429f, 0.651574f, 0.651720f, 0.651865f,
- 0.652011f, 0.652156f, 0.652301f, 0.652447f, 0.652592f, 0.652737f, 0.652882f, 0.653028f,
- 0.653173f, 0.653318f, 0.653463f, 0.653608f, 0.653753f, 0.653899f, 0.654044f, 0.654189f,
- 0.654334f, 0.654479f, 0.654624f, 0.654769f, 0.654913f, 0.655058f, 0.655203f, 0.655348f,
- 0.655493f, 0.655638f, 0.655782f, 0.655927f, 0.656072f, 0.656217f, 0.656361f, 0.656506f,
- 0.656651f, 0.656795f, 0.656940f, 0.657084f, 0.657229f, 0.657373f, 0.657518f, 0.657662f,
- 0.657807f, 0.657951f, 0.658095f, 0.658240f, 0.658384f, 0.658529f, 0.658673f, 0.658817f,
- 0.658961f, 0.659105f, 0.659250f, 0.659394f, 0.659538f, 0.659682f, 0.659826f, 0.659970f,
- 0.660114f, 0.660258f, 0.660402f, 0.660546f, 0.660690f, 0.660834f, 0.660978f, 0.661122f,
- 0.661266f, 0.661410f, 0.661553f, 0.661697f, 0.661841f, 0.661985f, 0.662128f, 0.662272f,
- 0.662416f, 0.662559f, 0.662703f, 0.662847f, 0.662990f, 0.663134f, 0.663277f, 0.663421f,
- 0.663564f, 0.663708f, 0.663851f, 0.663994f, 0.664138f, 0.664281f, 0.664424f, 0.664568f,
- 0.664711f, 0.664854f, 0.664997f, 0.665141f, 0.665284f, 0.665427f, 0.665570f, 0.665713f,
- 0.665856f, 0.665999f, 0.666142f, 0.666285f, 0.666428f, 0.666571f, 0.666714f, 0.666857f,
- 0.667000f, 0.667143f, 0.667286f, 0.667428f, 0.667571f, 0.667714f, 0.667857f, 0.667999f,
- 0.668142f, 0.668285f, 0.668427f, 0.668570f, 0.668712f, 0.668855f, 0.668998f, 0.669140f,
- 0.669283f, 0.669425f, 0.669567f, 0.669710f, 0.669852f, 0.669995f, 0.670137f, 0.670279f,
- 0.670422f, 0.670564f, 0.670706f, 0.670848f, 0.670990f, 0.671133f, 0.671275f, 0.671417f,
- 0.671559f, 0.671701f, 0.671843f, 0.671985f, 0.672127f, 0.672269f, 0.672411f, 0.672553f,
- 0.672695f, 0.672837f, 0.672978f, 0.673120f, 0.673262f, 0.673404f, 0.673546f, 0.673687f,
- 0.673829f, 0.673971f, 0.674112f, 0.674254f, 0.674396f, 0.674537f, 0.674679f, 0.674820f,
- 0.674962f, 0.675103f, 0.675245f, 0.675386f, 0.675527f, 0.675669f, 0.675810f, 0.675951f,
- 0.676093f, 0.676234f, 0.676375f, 0.676516f, 0.676658f, 0.676799f, 0.676940f, 0.677081f,
- 0.677222f, 0.677363f, 0.677504f, 0.677645f, 0.677786f, 0.677927f, 0.678068f, 0.678209f,
- 0.678350f, 0.678491f, 0.678632f, 0.678773f, 0.678913f, 0.679054f, 0.679195f, 0.679336f,
- 0.679476f, 0.679617f, 0.679758f, 0.679898f, 0.680039f, 0.680179f, 0.680320f, 0.680461f,
- 0.680601f, 0.680741f, 0.680882f, 0.681022f, 0.681163f, 0.681303f, 0.681443f, 0.681584f,
- 0.681724f, 0.681864f, 0.682005f, 0.682145f, 0.682285f, 0.682425f, 0.682565f, 0.682705f,
- 0.682846f, 0.682986f, 0.683126f, 0.683266f, 0.683406f, 0.683546f, 0.683686f, 0.683825f,
- 0.683965f, 0.684105f, 0.684245f, 0.684385f, 0.684525f, 0.684664f, 0.684804f, 0.684944f,
- 0.685084f, 0.685223f, 0.685363f, 0.685503f, 0.685642f, 0.685782f, 0.685921f, 0.686061f,
- 0.686200f, 0.686340f, 0.686479f, 0.686619f, 0.686758f, 0.686897f, 0.687037f, 0.687176f,
- 0.687315f, 0.687455f, 0.687594f, 0.687733f, 0.687872f, 0.688011f, 0.688151f, 0.688290f,
- 0.688429f, 0.688568f, 0.688707f, 0.688846f, 0.688985f, 0.689124f, 0.689263f, 0.689402f,
- 0.689541f, 0.689679f, 0.689818f, 0.689957f, 0.690096f, 0.690235f, 0.690373f, 0.690512f,
- 0.690651f, 0.690789f, 0.690928f, 0.691067f, 0.691205f, 0.691344f, 0.691482f, 0.691621f,
- 0.691759f, 0.691898f, 0.692036f, 0.692175f, 0.692313f, 0.692451f, 0.692590f, 0.692728f,
- 0.692866f, 0.693004f, 0.693143f, 0.693281f, 0.693419f, 0.693557f, 0.693695f, 0.693833f,
- 0.693971f, 0.694109f, 0.694248f, 0.694386f, 0.694524f, 0.694661f, 0.694799f, 0.694937f,
- 0.695075f, 0.695213f, 0.695351f, 0.695489f, 0.695626f, 0.695764f, 0.695902f, 0.696039f,
- 0.696177f, 0.696315f, 0.696452f, 0.696590f, 0.696728f, 0.696865f, 0.697003f, 0.697140f,
- 0.697277f, 0.697415f, 0.697552f, 0.697690f, 0.697827f, 0.697964f, 0.698102f, 0.698239f,
- 0.698376f, 0.698513f, 0.698651f, 0.698788f, 0.698925f, 0.699062f, 0.699199f, 0.699336f,
- 0.699473f, 0.699610f, 0.699747f, 0.699884f, 0.700021f, 0.700158f, 0.700295f, 0.700432f,
- 0.700569f, 0.700706f, 0.700842f, 0.700979f, 0.701116f, 0.701253f, 0.701389f, 0.701526f,
- 0.701663f, 0.701799f, 0.701936f, 0.702072f, 0.702209f, 0.702345f, 0.702482f, 0.702618f,
- 0.702755f, 0.702891f, 0.703028f, 0.703164f, 0.703300f, 0.703436f, 0.703573f, 0.703709f,
- 0.703845f, 0.703981f, 0.704118f, 0.704254f, 0.704390f, 0.704526f, 0.704662f, 0.704798f,
- 0.704934f, 0.705070f, 0.705206f, 0.705342f, 0.705478f, 0.705614f, 0.705750f, 0.705885f,
- 0.706021f, 0.706157f, 0.706293f, 0.706429f, 0.706564f, 0.706700f, 0.706836f, 0.706971f,
- 0.707107f, 0.707242f, 0.707378f, 0.707513f, 0.707649f, 0.707784f, 0.707920f, 0.708055f,
- 0.708191f, 0.708326f, 0.708461f, 0.708597f, 0.708732f, 0.708867f, 0.709002f, 0.709138f,
- 0.709273f, 0.709408f, 0.709543f, 0.709678f, 0.709813f, 0.709948f, 0.710083f, 0.710218f,
- 0.710353f, 0.710488f, 0.710623f, 0.710758f, 0.710893f, 0.711028f, 0.711163f, 0.711297f,
- 0.711432f, 0.711567f, 0.711702f, 0.711836f, 0.711971f, 0.712106f, 0.712240f, 0.712375f,
- 0.712509f, 0.712644f, 0.712778f, 0.712913f, 0.713047f, 0.713182f, 0.713316f, 0.713451f,
- 0.713585f, 0.713719f, 0.713853f, 0.713988f, 0.714122f, 0.714256f, 0.714390f, 0.714525f,
- 0.714659f, 0.714793f, 0.714927f, 0.715061f, 0.715195f, 0.715329f, 0.715463f, 0.715597f,
- 0.715731f, 0.715865f, 0.715999f, 0.716132f, 0.716266f, 0.716400f, 0.716534f, 0.716668f,
- 0.716801f, 0.716935f, 0.717069f, 0.717202f, 0.717336f, 0.717469f, 0.717603f, 0.717737f,
- 0.717870f, 0.718004f, 0.718137f, 0.718270f, 0.718404f, 0.718537f, 0.718670f, 0.718804f,
- 0.718937f, 0.719070f, 0.719204f, 0.719337f, 0.719470f, 0.719603f, 0.719736f, 0.719869f,
- 0.720003f, 0.720136f, 0.720269f, 0.720402f, 0.720535f, 0.720668f, 0.720800f, 0.720933f,
- 0.721066f, 0.721199f, 0.721332f, 0.721465f, 0.721597f, 0.721730f, 0.721863f, 0.721996f,
- 0.722128f, 0.722261f, 0.722393f, 0.722526f, 0.722659f, 0.722791f, 0.722924f, 0.723056f,
- 0.723188f, 0.723321f, 0.723453f, 0.723586f, 0.723718f, 0.723850f, 0.723983f, 0.724115f,
- 0.724247f, 0.724379f, 0.724511f, 0.724644f, 0.724776f, 0.724908f, 0.725040f, 0.725172f,
- 0.725304f, 0.725436f, 0.725568f, 0.725700f, 0.725832f, 0.725964f, 0.726095f, 0.726227f,
- 0.726359f, 0.726491f, 0.726623f, 0.726754f, 0.726886f, 0.727018f, 0.727149f, 0.727281f,
- 0.727413f, 0.727544f, 0.727676f, 0.727807f, 0.727939f, 0.728070f, 0.728202f, 0.728333f,
- 0.728464f, 0.728596f, 0.728727f, 0.728858f, 0.728990f, 0.729121f, 0.729252f, 0.729383f,
- 0.729514f, 0.729646f, 0.729777f, 0.729908f, 0.730039f, 0.730170f, 0.730301f, 0.730432f,
- 0.730563f, 0.730694f, 0.730825f, 0.730955f, 0.731086f, 0.731217f, 0.731348f, 0.731479f,
- 0.731609f, 0.731740f, 0.731871f, 0.732001f, 0.732132f, 0.732263f, 0.732393f, 0.732524f,
- 0.732654f, 0.732785f, 0.732915f, 0.733046f, 0.733176f, 0.733306f, 0.733437f, 0.733567f,
- 0.733697f, 0.733828f, 0.733958f, 0.734088f, 0.734218f, 0.734349f, 0.734479f, 0.734609f,
- 0.734739f, 0.734869f, 0.734999f, 0.735129f, 0.735259f, 0.735389f, 0.735519f, 0.735649f,
- 0.735779f, 0.735908f, 0.736038f, 0.736168f, 0.736298f, 0.736428f, 0.736557f, 0.736687f,
- 0.736817f, 0.736946f, 0.737076f, 0.737205f, 0.737335f, 0.737464f, 0.737594f, 0.737723f,
- 0.737853f, 0.737982f, 0.738112f, 0.738241f, 0.738370f, 0.738500f, 0.738629f, 0.738758f,
- 0.738887f, 0.739017f, 0.739146f, 0.739275f, 0.739404f, 0.739533f, 0.739662f, 0.739791f,
- 0.739920f, 0.740049f, 0.740178f, 0.740307f, 0.740436f, 0.740565f, 0.740694f, 0.740822f,
- 0.740951f, 0.741080f, 0.741209f, 0.741337f, 0.741466f, 0.741595f, 0.741723f, 0.741852f,
- 0.741980f, 0.742109f, 0.742237f, 0.742366f, 0.742494f, 0.742623f, 0.742751f, 0.742880f,
- 0.743008f, 0.743136f, 0.743265f, 0.743393f, 0.743521f, 0.743649f, 0.743777f, 0.743906f,
- 0.744034f, 0.744162f, 0.744290f, 0.744418f, 0.744546f, 0.744674f, 0.744802f, 0.744930f,
- 0.745058f, 0.745186f, 0.745314f, 0.745441f, 0.745569f, 0.745697f, 0.745825f, 0.745952f,
- 0.746080f, 0.746208f, 0.746335f, 0.746463f, 0.746591f, 0.746718f, 0.746846f, 0.746973f,
- 0.747101f, 0.747228f, 0.747355f, 0.747483f, 0.747610f, 0.747738f, 0.747865f, 0.747992f,
- 0.748119f, 0.748247f, 0.748374f, 0.748501f, 0.748628f, 0.748755f, 0.748882f, 0.749009f,
- 0.749136f, 0.749263f, 0.749390f, 0.749517f, 0.749644f, 0.749771f, 0.749898f, 0.750025f,
- 0.750152f, 0.750278f, 0.750405f, 0.750532f, 0.750659f, 0.750785f, 0.750912f, 0.751039f,
- 0.751165f, 0.751292f, 0.751418f, 0.751545f, 0.751671f, 0.751798f, 0.751924f, 0.752050f,
- 0.752177f, 0.752303f, 0.752429f, 0.752556f, 0.752682f, 0.752808f, 0.752934f, 0.753061f,
- 0.753187f, 0.753313f, 0.753439f, 0.753565f, 0.753691f, 0.753817f, 0.753943f, 0.754069f,
- 0.754195f, 0.754321f, 0.754447f, 0.754573f, 0.754698f, 0.754824f, 0.754950f, 0.755076f,
- 0.755201f, 0.755327f, 0.755453f, 0.755578f, 0.755704f, 0.755829f, 0.755955f, 0.756081f,
- 0.756206f, 0.756331f, 0.756457f, 0.756582f, 0.756708f, 0.756833f, 0.756958f, 0.757084f,
- 0.757209f, 0.757334f, 0.757459f, 0.757584f, 0.757710f, 0.757835f, 0.757960f, 0.758085f,
- 0.758210f, 0.758335f, 0.758460f, 0.758585f, 0.758710f, 0.758835f, 0.758960f, 0.759084f,
- 0.759209f, 0.759334f, 0.759459f, 0.759583f, 0.759708f, 0.759833f, 0.759957f, 0.760082f,
- 0.760207f, 0.760331f, 0.760456f, 0.760580f, 0.760705f, 0.760829f, 0.760954f, 0.761078f,
- 0.761202f, 0.761327f, 0.761451f, 0.761575f, 0.761700f, 0.761824f, 0.761948f, 0.762072f,
- 0.762196f, 0.762320f, 0.762444f, 0.762569f, 0.762693f, 0.762817f, 0.762941f, 0.763065f,
- 0.763188f, 0.763312f, 0.763436f, 0.763560f, 0.763684f, 0.763808f, 0.763931f, 0.764055f,
- 0.764179f, 0.764302f, 0.764426f, 0.764550f, 0.764673f, 0.764797f, 0.764920f, 0.765044f,
- 0.765167f, 0.765291f, 0.765414f, 0.765538f, 0.765661f, 0.765784f, 0.765907f, 0.766031f,
- 0.766154f, 0.766277f, 0.766400f, 0.766524f, 0.766647f, 0.766770f, 0.766893f, 0.767016f,
- 0.767139f, 0.767262f, 0.767385f, 0.767508f, 0.767631f, 0.767754f, 0.767876f, 0.767999f,
- 0.768122f, 0.768245f, 0.768368f, 0.768490f, 0.768613f, 0.768736f, 0.768858f, 0.768981f,
- 0.769103f, 0.769226f, 0.769348f, 0.769471f, 0.769593f, 0.769716f, 0.769838f, 0.769961f,
- 0.770083f, 0.770205f, 0.770327f, 0.770450f, 0.770572f, 0.770694f, 0.770816f, 0.770938f,
- 0.771061f, 0.771183f, 0.771305f, 0.771427f, 0.771549f, 0.771671f, 0.771793f, 0.771915f,
- 0.772036f, 0.772158f, 0.772280f, 0.772402f, 0.772524f, 0.772645f, 0.772767f, 0.772889f,
- 0.773010f, 0.773132f, 0.773254f, 0.773375f, 0.773497f, 0.773618f, 0.773740f, 0.773861f,
- 0.773983f, 0.774104f, 0.774225f, 0.774347f, 0.774468f, 0.774589f, 0.774711f, 0.774832f,
- 0.774953f, 0.775074f, 0.775195f, 0.775317f, 0.775438f, 0.775559f, 0.775680f, 0.775801f,
- 0.775922f, 0.776043f, 0.776164f, 0.776284f, 0.776405f, 0.776526f, 0.776647f, 0.776768f,
- 0.776888f, 0.777009f, 0.777130f, 0.777251f, 0.777371f, 0.777492f, 0.777612f, 0.777733f,
- 0.777853f, 0.777974f, 0.778094f, 0.778215f, 0.778335f, 0.778456f, 0.778576f, 0.778696f,
- 0.778817f, 0.778937f, 0.779057f, 0.779177f, 0.779297f, 0.779418f, 0.779538f, 0.779658f,
- 0.779778f, 0.779898f, 0.780018f, 0.780138f, 0.780258f, 0.780378f, 0.780498f, 0.780617f,
- 0.780737f, 0.780857f, 0.780977f, 0.781097f, 0.781216f, 0.781336f, 0.781456f, 0.781575f,
- 0.781695f, 0.781814f, 0.781934f, 0.782053f, 0.782173f, 0.782292f, 0.782412f, 0.782531f,
- 0.782651f, 0.782770f, 0.782889f, 0.783009f, 0.783128f, 0.783247f, 0.783366f, 0.783485f,
- 0.783605f, 0.783724f, 0.783843f, 0.783962f, 0.784081f, 0.784200f, 0.784319f, 0.784438f,
- 0.784557f, 0.784675f, 0.784794f, 0.784913f, 0.785032f, 0.785151f, 0.785269f, 0.785388f,
- 0.785507f, 0.785625f, 0.785744f, 0.785863f, 0.785981f, 0.786100f, 0.786218f, 0.786337f,
- 0.786455f, 0.786574f, 0.786692f, 0.786810f, 0.786929f, 0.787047f, 0.787165f, 0.787284f,
- 0.787402f, 0.787520f, 0.787638f, 0.787756f, 0.787874f, 0.787992f, 0.788110f, 0.788228f,
- 0.788346f, 0.788464f, 0.788582f, 0.788700f, 0.788818f, 0.788936f, 0.789054f, 0.789172f,
- 0.789289f, 0.789407f, 0.789525f, 0.789642f, 0.789760f, 0.789878f, 0.789995f, 0.790113f,
- 0.790230f, 0.790348f, 0.790465f, 0.790583f, 0.790700f, 0.790817f, 0.790935f, 0.791052f,
- 0.791169f, 0.791287f, 0.791404f, 0.791521f, 0.791638f, 0.791755f, 0.791872f, 0.791990f,
- 0.792107f, 0.792224f, 0.792341f, 0.792458f, 0.792575f, 0.792691f, 0.792808f, 0.792925f,
- 0.793042f, 0.793159f, 0.793276f, 0.793392f, 0.793509f, 0.793626f, 0.793742f, 0.793859f,
- 0.793975f, 0.794092f, 0.794209f, 0.794325f, 0.794442f, 0.794558f, 0.794674f, 0.794791f,
- 0.794907f, 0.795023f, 0.795140f, 0.795256f, 0.795372f, 0.795488f, 0.795605f, 0.795721f,
- 0.795837f, 0.795953f, 0.796069f, 0.796185f, 0.796301f, 0.796417f, 0.796533f, 0.796649f,
- 0.796765f, 0.796881f, 0.796996f, 0.797112f, 0.797228f, 0.797344f, 0.797459f, 0.797575f,
- 0.797691f, 0.797806f, 0.797922f, 0.798038f, 0.798153f, 0.798269f, 0.798384f, 0.798500f,
- 0.798615f, 0.798730f, 0.798846f, 0.798961f, 0.799076f, 0.799192f, 0.799307f, 0.799422f,
- 0.799537f, 0.799652f, 0.799768f, 0.799883f, 0.799998f, 0.800113f, 0.800228f, 0.800343f,
- 0.800458f, 0.800573f, 0.800687f, 0.800802f, 0.800917f, 0.801032f, 0.801147f, 0.801261f,
- 0.801376f, 0.801491f, 0.801606f, 0.801720f, 0.801835f, 0.801949f, 0.802064f, 0.802178f,
- 0.802293f, 0.802407f, 0.802522f, 0.802636f, 0.802750f, 0.802865f, 0.802979f, 0.803093f,
- 0.803208f, 0.803322f, 0.803436f, 0.803550f, 0.803664f, 0.803778f, 0.803892f, 0.804006f,
- 0.804120f, 0.804234f, 0.804348f, 0.804462f, 0.804576f, 0.804690f, 0.804804f, 0.804918f,
- 0.805031f, 0.805145f, 0.805259f, 0.805372f, 0.805486f, 0.805600f, 0.805713f, 0.805827f,
- 0.805940f, 0.806054f, 0.806167f, 0.806281f, 0.806394f, 0.806508f, 0.806621f, 0.806734f,
- 0.806848f, 0.806961f, 0.807074f, 0.807187f, 0.807300f, 0.807414f, 0.807527f, 0.807640f,
- 0.807753f, 0.807866f, 0.807979f, 0.808092f, 0.808205f, 0.808318f, 0.808430f, 0.808543f,
- 0.808656f, 0.808769f, 0.808882f, 0.808994f, 0.809107f, 0.809220f, 0.809332f, 0.809445f,
- 0.809558f, 0.809670f, 0.809783f, 0.809895f, 0.810008f, 0.810120f, 0.810232f, 0.810345f,
- 0.810457f, 0.810570f, 0.810682f, 0.810794f, 0.810906f, 0.811018f, 0.811131f, 0.811243f,
- 0.811355f, 0.811467f, 0.811579f, 0.811691f, 0.811803f, 0.811915f, 0.812027f, 0.812139f,
- 0.812251f, 0.812362f, 0.812474f, 0.812586f, 0.812698f, 0.812809f, 0.812921f, 0.813033f,
- 0.813144f, 0.813256f, 0.813368f, 0.813479f, 0.813591f, 0.813702f, 0.813814f, 0.813925f,
- 0.814036f, 0.814148f, 0.814259f, 0.814370f, 0.814482f, 0.814593f, 0.814704f, 0.814815f,
- 0.814926f, 0.815037f, 0.815149f, 0.815260f, 0.815371f, 0.815482f, 0.815593f, 0.815704f,
- 0.815814f, 0.815925f, 0.816036f, 0.816147f, 0.816258f, 0.816368f, 0.816479f, 0.816590f,
- 0.816701f, 0.816811f, 0.816922f, 0.817032f, 0.817143f, 0.817253f, 0.817364f, 0.817474f,
- 0.817585f, 0.817695f, 0.817806f, 0.817916f, 0.818026f, 0.818137f, 0.818247f, 0.818357f,
- 0.818467f, 0.818577f, 0.818687f, 0.818798f, 0.818908f, 0.819018f, 0.819128f, 0.819238f,
- 0.819348f, 0.819457f, 0.819567f, 0.819677f, 0.819787f, 0.819897f, 0.820007f, 0.820116f,
- 0.820226f, 0.820336f, 0.820445f, 0.820555f, 0.820664f, 0.820774f, 0.820884f, 0.820993f,
- 0.821102f, 0.821212f, 0.821321f, 0.821431f, 0.821540f, 0.821649f, 0.821759f, 0.821868f,
- 0.821977f, 0.822086f, 0.822195f, 0.822305f, 0.822414f, 0.822523f, 0.822632f, 0.822741f,
- 0.822850f, 0.822959f, 0.823068f, 0.823177f, 0.823285f, 0.823394f, 0.823503f, 0.823612f,
- 0.823721f, 0.823829f, 0.823938f, 0.824047f, 0.824155f, 0.824264f, 0.824372f, 0.824481f,
- 0.824589f, 0.824698f, 0.824806f, 0.824915f, 0.825023f, 0.825131f, 0.825240f, 0.825348f,
- 0.825456f, 0.825564f, 0.825673f, 0.825781f, 0.825889f, 0.825997f, 0.826105f, 0.826213f,
- 0.826321f, 0.826429f, 0.826537f, 0.826645f, 0.826753f, 0.826861f, 0.826968f, 0.827076f,
- 0.827184f, 0.827292f, 0.827399f, 0.827507f, 0.827615f, 0.827722f, 0.827830f, 0.827938f,
- 0.828045f, 0.828153f, 0.828260f, 0.828367f, 0.828475f, 0.828582f, 0.828690f, 0.828797f,
- 0.828904f, 0.829011f, 0.829119f, 0.829226f, 0.829333f, 0.829440f, 0.829547f, 0.829654f,
- 0.829761f, 0.829868f, 0.829975f, 0.830082f, 0.830189f, 0.830296f, 0.830403f, 0.830510f,
- 0.830616f, 0.830723f, 0.830830f, 0.830937f, 0.831043f, 0.831150f, 0.831257f, 0.831363f,
- 0.831470f, 0.831576f, 0.831683f, 0.831789f, 0.831895f, 0.832002f, 0.832108f, 0.832215f,
- 0.832321f, 0.832427f, 0.832533f, 0.832640f, 0.832746f, 0.832852f, 0.832958f, 0.833064f,
- 0.833170f, 0.833276f, 0.833382f, 0.833488f, 0.833594f, 0.833700f, 0.833806f, 0.833912f,
- 0.834018f, 0.834123f, 0.834229f, 0.834335f, 0.834440f, 0.834546f, 0.834652f, 0.834757f,
- 0.834863f, 0.834968f, 0.835074f, 0.835179f, 0.835285f, 0.835390f, 0.835496f, 0.835601f,
- 0.835706f, 0.835812f, 0.835917f, 0.836022f, 0.836127f, 0.836232f, 0.836338f, 0.836443f,
- 0.836548f, 0.836653f, 0.836758f, 0.836863f, 0.836968f, 0.837073f, 0.837178f, 0.837282f,
- 0.837387f, 0.837492f, 0.837597f, 0.837701f, 0.837806f, 0.837911f, 0.838015f, 0.838120f,
- 0.838225f, 0.838329f, 0.838434f, 0.838538f, 0.838643f, 0.838747f, 0.838852f, 0.838956f,
- 0.839060f, 0.839165f, 0.839269f, 0.839373f, 0.839477f, 0.839581f, 0.839686f, 0.839790f,
- 0.839894f, 0.839998f, 0.840102f, 0.840206f, 0.840310f, 0.840414f, 0.840518f, 0.840622f,
- 0.840725f, 0.840829f, 0.840933f, 0.841037f, 0.841140f, 0.841244f, 0.841348f, 0.841451f,
- 0.841555f, 0.841659f, 0.841762f, 0.841866f, 0.841969f, 0.842072f, 0.842176f, 0.842279f,
- 0.842383f, 0.842486f, 0.842589f, 0.842692f, 0.842796f, 0.842899f, 0.843002f, 0.843105f,
- 0.843208f, 0.843311f, 0.843414f, 0.843517f, 0.843620f, 0.843723f, 0.843826f, 0.843929f,
- 0.844032f, 0.844135f, 0.844238f, 0.844340f, 0.844443f, 0.844546f, 0.844648f, 0.844751f,
- 0.844854f, 0.844956f, 0.845059f, 0.845161f, 0.845264f, 0.845366f, 0.845469f, 0.845571f,
- 0.845673f, 0.845776f, 0.845878f, 0.845980f, 0.846082f, 0.846185f, 0.846287f, 0.846389f,
- 0.846491f, 0.846593f, 0.846695f, 0.846797f, 0.846899f, 0.847001f, 0.847103f, 0.847205f,
- 0.847307f, 0.847408f, 0.847510f, 0.847612f, 0.847714f, 0.847815f, 0.847917f, 0.848019f,
- 0.848120f, 0.848222f, 0.848323f, 0.848425f, 0.848526f, 0.848628f, 0.848729f, 0.848831f,
- 0.848932f, 0.849033f, 0.849135f, 0.849236f, 0.849337f, 0.849438f, 0.849540f, 0.849641f,
- 0.849742f, 0.849843f, 0.849944f, 0.850045f, 0.850146f, 0.850247f, 0.850348f, 0.850449f,
- 0.850549f, 0.850650f, 0.850751f, 0.850852f, 0.850953f, 0.851053f, 0.851154f, 0.851255f,
- 0.851355f, 0.851456f, 0.851556f, 0.851657f, 0.851757f, 0.851858f, 0.851958f, 0.852059f,
- 0.852159f, 0.852259f, 0.852360f, 0.852460f, 0.852560f, 0.852660f, 0.852760f, 0.852861f,
- 0.852961f, 0.853061f, 0.853161f, 0.853261f, 0.853361f, 0.853461f, 0.853561f, 0.853660f,
- 0.853760f, 0.853860f, 0.853960f, 0.854060f, 0.854159f, 0.854259f, 0.854359f, 0.854458f,
- 0.854558f, 0.854658f, 0.854757f, 0.854857f, 0.854956f, 0.855056f, 0.855155f, 0.855254f,
- 0.855354f, 0.855453f, 0.855552f, 0.855651f, 0.855751f, 0.855850f, 0.855949f, 0.856048f,
- 0.856147f, 0.856246f, 0.856345f, 0.856444f, 0.856543f, 0.856642f, 0.856741f, 0.856840f,
- 0.856939f, 0.857038f, 0.857137f, 0.857235f, 0.857334f, 0.857433f, 0.857531f, 0.857630f,
- 0.857729f, 0.857827f, 0.857926f, 0.858024f, 0.858123f, 0.858221f, 0.858320f, 0.858418f,
- 0.858516f, 0.858615f, 0.858713f, 0.858811f, 0.858909f, 0.859007f, 0.859106f, 0.859204f,
- 0.859302f, 0.859400f, 0.859498f, 0.859596f, 0.859694f, 0.859792f, 0.859890f, 0.859988f,
- 0.860085f, 0.860183f, 0.860281f, 0.860379f, 0.860476f, 0.860574f, 0.860672f, 0.860769f,
- 0.860867f, 0.860964f, 0.861062f, 0.861160f, 0.861257f, 0.861354f, 0.861452f, 0.861549f,
- 0.861646f, 0.861744f, 0.861841f, 0.861938f, 0.862035f, 0.862133f, 0.862230f, 0.862327f,
- 0.862424f, 0.862521f, 0.862618f, 0.862715f, 0.862812f, 0.862909f, 0.863006f, 0.863103f,
- 0.863199f, 0.863296f, 0.863393f, 0.863490f, 0.863586f, 0.863683f, 0.863780f, 0.863876f,
- 0.863973f, 0.864069f, 0.864166f, 0.864262f, 0.864359f, 0.864455f, 0.864552f, 0.864648f,
- 0.864744f, 0.864841f, 0.864937f, 0.865033f, 0.865129f, 0.865225f, 0.865321f, 0.865418f,
- 0.865514f, 0.865610f, 0.865706f, 0.865802f, 0.865898f, 0.865993f, 0.866089f, 0.866185f,
- 0.866281f, 0.866377f, 0.866472f, 0.866568f, 0.866664f, 0.866759f, 0.866855f, 0.866951f,
- 0.867046f, 0.867142f, 0.867237f, 0.867333f, 0.867428f, 0.867523f, 0.867619f, 0.867714f,
- 0.867809f, 0.867905f, 0.868000f, 0.868095f, 0.868190f, 0.868285f, 0.868381f, 0.868476f,
- 0.868571f, 0.868666f, 0.868761f, 0.868856f, 0.868951f, 0.869045f, 0.869140f, 0.869235f,
- 0.869330f, 0.869425f, 0.869519f, 0.869614f, 0.869709f, 0.869803f, 0.869898f, 0.869992f,
- 0.870087f, 0.870182f, 0.870276f, 0.870370f, 0.870465f, 0.870559f, 0.870654f, 0.870748f,
- 0.870842f, 0.870936f, 0.871031f, 0.871125f, 0.871219f, 0.871313f, 0.871407f, 0.871501f,
- 0.871595f, 0.871689f, 0.871783f, 0.871877f, 0.871971f, 0.872065f, 0.872159f, 0.872252f,
- 0.872346f, 0.872440f, 0.872534f, 0.872627f, 0.872721f, 0.872814f, 0.872908f, 0.873001f,
- 0.873095f, 0.873188f, 0.873282f, 0.873375f, 0.873469f, 0.873562f, 0.873655f, 0.873749f,
- 0.873842f, 0.873935f, 0.874028f, 0.874121f, 0.874215f, 0.874308f, 0.874401f, 0.874494f,
- 0.874587f, 0.874680f, 0.874773f, 0.874865f, 0.874958f, 0.875051f, 0.875144f, 0.875237f,
- 0.875329f, 0.875422f, 0.875515f, 0.875607f, 0.875700f, 0.875793f, 0.875885f, 0.875978f,
- 0.876070f, 0.876163f, 0.876255f, 0.876347f, 0.876440f, 0.876532f, 0.876624f, 0.876716f,
- 0.876809f, 0.876901f, 0.876993f, 0.877085f, 0.877177f, 0.877269f, 0.877361f, 0.877453f,
- 0.877545f, 0.877637f, 0.877729f, 0.877821f, 0.877913f, 0.878005f, 0.878096f, 0.878188f,
- 0.878280f, 0.878371f, 0.878463f, 0.878555f, 0.878646f, 0.878738f, 0.878829f, 0.878921f,
- 0.879012f, 0.879104f, 0.879195f, 0.879286f, 0.879378f, 0.879469f, 0.879560f, 0.879651f,
- 0.879743f, 0.879834f, 0.879925f, 0.880016f, 0.880107f, 0.880198f, 0.880289f, 0.880380f,
- 0.880471f, 0.880562f, 0.880653f, 0.880743f, 0.880834f, 0.880925f, 0.881016f, 0.881106f,
- 0.881197f, 0.881288f, 0.881378f, 0.881469f, 0.881559f, 0.881650f, 0.881740f, 0.881831f,
- 0.881921f, 0.882012f, 0.882102f, 0.882192f, 0.882283f, 0.882373f, 0.882463f, 0.882553f,
- 0.882643f, 0.882733f, 0.882824f, 0.882914f, 0.883004f, 0.883094f, 0.883184f, 0.883273f,
- 0.883363f, 0.883453f, 0.883543f, 0.883633f, 0.883723f, 0.883812f, 0.883902f, 0.883992f,
- 0.884081f, 0.884171f, 0.884260f, 0.884350f, 0.884439f, 0.884529f, 0.884618f, 0.884708f,
- 0.884797f, 0.884886f, 0.884976f, 0.885065f, 0.885154f, 0.885243f, 0.885333f, 0.885422f,
- 0.885511f, 0.885600f, 0.885689f, 0.885778f, 0.885867f, 0.885956f, 0.886045f, 0.886134f,
- 0.886223f, 0.886311f, 0.886400f, 0.886489f, 0.886578f, 0.886666f, 0.886755f, 0.886844f,
- 0.886932f, 0.887021f, 0.887109f, 0.887198f, 0.887286f, 0.887375f, 0.887463f, 0.887551f,
- 0.887640f, 0.887728f, 0.887816f, 0.887904f, 0.887993f, 0.888081f, 0.888169f, 0.888257f,
- 0.888345f, 0.888433f, 0.888521f, 0.888609f, 0.888697f, 0.888785f, 0.888873f, 0.888961f,
- 0.889048f, 0.889136f, 0.889224f, 0.889312f, 0.889399f, 0.889487f, 0.889574f, 0.889662f,
- 0.889750f, 0.889837f, 0.889925f, 0.890012f, 0.890099f, 0.890187f, 0.890274f, 0.890361f,
- 0.890449f, 0.890536f, 0.890623f, 0.890710f, 0.890797f, 0.890885f, 0.890972f, 0.891059f,
- 0.891146f, 0.891233f, 0.891320f, 0.891407f, 0.891493f, 0.891580f, 0.891667f, 0.891754f,
- 0.891841f, 0.891927f, 0.892014f, 0.892101f, 0.892187f, 0.892274f, 0.892361f, 0.892447f,
- 0.892534f, 0.892620f, 0.892706f, 0.892793f, 0.892879f, 0.892965f, 0.893052f, 0.893138f,
- 0.893224f, 0.893310f, 0.893397f, 0.893483f, 0.893569f, 0.893655f, 0.893741f, 0.893827f,
- 0.893913f, 0.893999f, 0.894085f, 0.894171f, 0.894256f, 0.894342f, 0.894428f, 0.894514f,
- 0.894599f, 0.894685f, 0.894771f, 0.894856f, 0.894942f, 0.895028f, 0.895113f, 0.895198f,
- 0.895284f, 0.895369f, 0.895455f, 0.895540f, 0.895625f, 0.895711f, 0.895796f, 0.895881f,
- 0.895966f, 0.896051f, 0.896137f, 0.896222f, 0.896307f, 0.896392f, 0.896477f, 0.896562f,
- 0.896646f, 0.896731f, 0.896816f, 0.896901f, 0.896986f, 0.897071f, 0.897155f, 0.897240f,
- 0.897325f, 0.897409f, 0.897494f, 0.897578f, 0.897663f, 0.897747f, 0.897832f, 0.897916f,
- 0.898001f, 0.898085f, 0.898169f, 0.898254f, 0.898338f, 0.898422f, 0.898506f, 0.898590f,
- 0.898674f, 0.898759f, 0.898843f, 0.898927f, 0.899011f, 0.899095f, 0.899179f, 0.899262f,
- 0.899346f, 0.899430f, 0.899514f, 0.899598f, 0.899681f, 0.899765f, 0.899849f, 0.899932f,
- 0.900016f, 0.900099f, 0.900183f, 0.900266f, 0.900350f, 0.900433f, 0.900517f, 0.900600f,
- 0.900683f, 0.900767f, 0.900850f, 0.900933f, 0.901016f, 0.901100f, 0.901183f, 0.901266f,
- 0.901349f, 0.901432f, 0.901515f, 0.901598f, 0.901681f, 0.901764f, 0.901847f, 0.901929f,
- 0.902012f, 0.902095f, 0.902178f, 0.902260f, 0.902343f, 0.902426f, 0.902508f, 0.902591f,
- 0.902673f, 0.902756f, 0.902838f, 0.902921f, 0.903003f, 0.903085f, 0.903168f, 0.903250f,
- 0.903332f, 0.903415f, 0.903497f, 0.903579f, 0.903661f, 0.903743f, 0.903825f, 0.903907f,
- 0.903989f, 0.904071f, 0.904153f, 0.904235f, 0.904317f, 0.904399f, 0.904481f, 0.904562f,
- 0.904644f, 0.904726f, 0.904807f, 0.904889f, 0.904971f, 0.905052f, 0.905134f, 0.905215f,
- 0.905297f, 0.905378f, 0.905460f, 0.905541f, 0.905622f, 0.905704f, 0.905785f, 0.905866f,
- 0.905947f, 0.906028f, 0.906110f, 0.906191f, 0.906272f, 0.906353f, 0.906434f, 0.906515f,
- 0.906596f, 0.906677f, 0.906757f, 0.906838f, 0.906919f, 0.907000f, 0.907081f, 0.907161f,
- 0.907242f, 0.907323f, 0.907403f, 0.907484f, 0.907564f, 0.907645f, 0.907725f, 0.907806f,
- 0.907886f, 0.907966f, 0.908047f, 0.908127f, 0.908207f, 0.908288f, 0.908368f, 0.908448f,
- 0.908528f, 0.908608f, 0.908688f, 0.908768f, 0.908848f, 0.908928f, 0.909008f, 0.909088f,
- 0.909168f, 0.909248f, 0.909328f, 0.909407f, 0.909487f, 0.909567f, 0.909646f, 0.909726f,
- 0.909806f, 0.909885f, 0.909965f, 0.910044f, 0.910124f, 0.910203f, 0.910283f, 0.910362f,
- 0.910441f, 0.910521f, 0.910600f, 0.910679f, 0.910758f, 0.910837f, 0.910917f, 0.910996f,
- 0.911075f, 0.911154f, 0.911233f, 0.911312f, 0.911391f, 0.911470f, 0.911548f, 0.911627f,
- 0.911706f, 0.911785f, 0.911864f, 0.911942f, 0.912021f, 0.912099f, 0.912178f, 0.912257f,
- 0.912335f, 0.912414f, 0.912492f, 0.912571f, 0.912649f, 0.912727f, 0.912806f, 0.912884f,
- 0.912962f, 0.913040f, 0.913119f, 0.913197f, 0.913275f, 0.913353f, 0.913431f, 0.913509f,
- 0.913587f, 0.913665f, 0.913743f, 0.913821f, 0.913899f, 0.913976f, 0.914054f, 0.914132f,
- 0.914210f, 0.914287f, 0.914365f, 0.914443f, 0.914520f, 0.914598f, 0.914675f, 0.914753f,
- 0.914830f, 0.914908f, 0.914985f, 0.915062f, 0.915140f, 0.915217f, 0.915294f, 0.915372f,
- 0.915449f, 0.915526f, 0.915603f, 0.915680f, 0.915757f, 0.915834f, 0.915911f, 0.915988f,
- 0.916065f, 0.916142f, 0.916219f, 0.916296f, 0.916372f, 0.916449f, 0.916526f, 0.916602f,
- 0.916679f, 0.916756f, 0.916832f, 0.916909f, 0.916985f, 0.917062f, 0.917138f, 0.917215f,
- 0.917291f, 0.917367f, 0.917444f, 0.917520f, 0.917596f, 0.917672f, 0.917749f, 0.917825f,
- 0.917901f, 0.917977f, 0.918053f, 0.918129f, 0.918205f, 0.918281f, 0.918357f, 0.918433f,
- 0.918508f, 0.918584f, 0.918660f, 0.918736f, 0.918811f, 0.918887f, 0.918963f, 0.919038f,
- 0.919114f, 0.919189f, 0.919265f, 0.919340f, 0.919416f, 0.919491f, 0.919567f, 0.919642f,
- 0.919717f, 0.919792f, 0.919868f, 0.919943f, 0.920018f, 0.920093f, 0.920168f, 0.920243f,
- 0.920318f, 0.920393f, 0.920468f, 0.920543f, 0.920618f, 0.920693f, 0.920768f, 0.920842f,
- 0.920917f, 0.920992f, 0.921067f, 0.921141f, 0.921216f, 0.921291f, 0.921365f, 0.921440f,
- 0.921514f, 0.921588f, 0.921663f, 0.921737f, 0.921812f, 0.921886f, 0.921960f, 0.922034f,
- 0.922109f, 0.922183f, 0.922257f, 0.922331f, 0.922405f, 0.922479f, 0.922553f, 0.922627f,
- 0.922701f, 0.922775f, 0.922849f, 0.922923f, 0.922997f, 0.923070f, 0.923144f, 0.923218f,
- 0.923291f, 0.923365f, 0.923439f, 0.923512f, 0.923586f, 0.923659f, 0.923733f, 0.923806f,
- 0.923880f, 0.923953f, 0.924026f, 0.924100f, 0.924173f, 0.924246f, 0.924319f, 0.924392f,
- 0.924465f, 0.924539f, 0.924612f, 0.924685f, 0.924758f, 0.924831f, 0.924904f, 0.924976f,
- 0.925049f, 0.925122f, 0.925195f, 0.925268f, 0.925340f, 0.925413f, 0.925486f, 0.925558f,
- 0.925631f, 0.925703f, 0.925776f, 0.925848f, 0.925921f, 0.925993f, 0.926066f, 0.926138f,
- 0.926210f, 0.926283f, 0.926355f, 0.926427f, 0.926499f, 0.926571f, 0.926643f, 0.926715f,
- 0.926787f, 0.926859f, 0.926931f, 0.927003f, 0.927075f, 0.927147f, 0.927219f, 0.927291f,
- 0.927363f, 0.927434f, 0.927506f, 0.927578f, 0.927649f, 0.927721f, 0.927792f, 0.927864f,
- 0.927935f, 0.928007f, 0.928078f, 0.928150f, 0.928221f, 0.928292f, 0.928364f, 0.928435f,
- 0.928506f, 0.928577f, 0.928648f, 0.928720f, 0.928791f, 0.928862f, 0.928933f, 0.929004f,
- 0.929075f, 0.929146f, 0.929216f, 0.929287f, 0.929358f, 0.929429f, 0.929500f, 0.929570f,
- 0.929641f, 0.929712f, 0.929782f, 0.929853f, 0.929923f, 0.929994f, 0.930064f, 0.930135f,
- 0.930205f, 0.930275f, 0.930346f, 0.930416f, 0.930486f, 0.930556f, 0.930627f, 0.930697f,
- 0.930767f, 0.930837f, 0.930907f, 0.930977f, 0.931047f, 0.931117f, 0.931187f, 0.931257f,
- 0.931327f, 0.931397f, 0.931466f, 0.931536f, 0.931606f, 0.931675f, 0.931745f, 0.931815f,
- 0.931884f, 0.931954f, 0.932023f, 0.932093f, 0.932162f, 0.932232f, 0.932301f, 0.932370f,
- 0.932440f, 0.932509f, 0.932578f, 0.932647f, 0.932716f, 0.932786f, 0.932855f, 0.932924f,
- 0.932993f, 0.933062f, 0.933131f, 0.933200f, 0.933269f, 0.933337f, 0.933406f, 0.933475f,
- 0.933544f, 0.933612f, 0.933681f, 0.933750f, 0.933818f, 0.933887f, 0.933956f, 0.934024f,
- 0.934093f, 0.934161f, 0.934229f, 0.934298f, 0.934366f, 0.934434f, 0.934503f, 0.934571f,
- 0.934639f, 0.934707f, 0.934775f, 0.934844f, 0.934912f, 0.934980f, 0.935048f, 0.935116f,
- 0.935184f, 0.935251f, 0.935319f, 0.935387f, 0.935455f, 0.935523f, 0.935590f, 0.935658f,
- 0.935726f, 0.935793f, 0.935861f, 0.935928f, 0.935996f, 0.936063f, 0.936131f, 0.936198f,
- 0.936266f, 0.936333f, 0.936400f, 0.936468f, 0.936535f, 0.936602f, 0.936669f, 0.936736f,
- 0.936803f, 0.936871f, 0.936938f, 0.937005f, 0.937072f, 0.937138f, 0.937205f, 0.937272f,
- 0.937339f, 0.937406f, 0.937473f, 0.937539f, 0.937606f, 0.937673f, 0.937739f, 0.937806f,
- 0.937872f, 0.937939f, 0.938005f, 0.938072f, 0.938138f, 0.938205f, 0.938271f, 0.938337f,
- 0.938404f, 0.938470f, 0.938536f, 0.938602f, 0.938668f, 0.938734f, 0.938800f, 0.938866f,
- 0.938932f, 0.938998f, 0.939064f, 0.939130f, 0.939196f, 0.939262f, 0.939328f, 0.939394f,
- 0.939459f, 0.939525f, 0.939591f, 0.939656f, 0.939722f, 0.939787f, 0.939853f, 0.939918f,
- 0.939984f, 0.940049f, 0.940115f, 0.940180f, 0.940245f, 0.940310f, 0.940376f, 0.940441f,
- 0.940506f, 0.940571f, 0.940636f, 0.940701f, 0.940766f, 0.940831f, 0.940896f, 0.940961f,
- 0.941026f, 0.941091f, 0.941156f, 0.941221f, 0.941285f, 0.941350f, 0.941415f, 0.941479f,
- 0.941544f, 0.941609f, 0.941673f, 0.941738f, 0.941802f, 0.941867f, 0.941931f, 0.941995f,
- 0.942060f, 0.942124f, 0.942188f, 0.942253f, 0.942317f, 0.942381f, 0.942445f, 0.942509f,
- 0.942573f, 0.942637f, 0.942701f, 0.942765f, 0.942829f, 0.942893f, 0.942957f, 0.943021f,
- 0.943084f, 0.943148f, 0.943212f, 0.943276f, 0.943339f, 0.943403f, 0.943466f, 0.943530f,
- 0.943593f, 0.943657f, 0.943720f, 0.943784f, 0.943847f, 0.943910f, 0.943974f, 0.944037f,
- 0.944100f, 0.944163f, 0.944227f, 0.944290f, 0.944353f, 0.944416f, 0.944479f, 0.944542f,
- 0.944605f, 0.944668f, 0.944731f, 0.944793f, 0.944856f, 0.944919f, 0.944982f, 0.945045f,
- 0.945107f, 0.945170f, 0.945232f, 0.945295f, 0.945358f, 0.945420f, 0.945482f, 0.945545f,
- 0.945607f, 0.945670f, 0.945732f, 0.945794f, 0.945857f, 0.945919f, 0.945981f, 0.946043f,
- 0.946105f, 0.946167f, 0.946229f, 0.946291f, 0.946353f, 0.946415f, 0.946477f, 0.946539f,
- 0.946601f, 0.946663f, 0.946724f, 0.946786f, 0.946848f, 0.946910f, 0.946971f, 0.947033f,
- 0.947094f, 0.947156f, 0.947217f, 0.947279f, 0.947340f, 0.947402f, 0.947463f, 0.947524f,
- 0.947586f, 0.947647f, 0.947708f, 0.947769f, 0.947830f, 0.947891f, 0.947953f, 0.948014f,
- 0.948075f, 0.948136f, 0.948196f, 0.948257f, 0.948318f, 0.948379f, 0.948440f, 0.948501f,
- 0.948561f, 0.948622f, 0.948683f, 0.948743f, 0.948804f, 0.948864f, 0.948925f, 0.948985f,
- 0.949046f, 0.949106f, 0.949167f, 0.949227f, 0.949287f, 0.949348f, 0.949408f, 0.949468f,
- 0.949528f, 0.949588f, 0.949648f, 0.949708f, 0.949768f, 0.949829f, 0.949888f, 0.949948f,
- 0.950008f, 0.950068f, 0.950128f, 0.950188f, 0.950247f, 0.950307f, 0.950367f, 0.950426f,
- 0.950486f, 0.950546f, 0.950605f, 0.950665f, 0.950724f, 0.950784f, 0.950843f, 0.950902f,
- 0.950962f, 0.951021f, 0.951080f, 0.951139f, 0.951199f, 0.951258f, 0.951317f, 0.951376f,
- 0.951435f, 0.951494f, 0.951553f, 0.951612f, 0.951671f, 0.951730f, 0.951789f, 0.951847f,
- 0.951906f, 0.951965f, 0.952024f, 0.952082f, 0.952141f, 0.952199f, 0.952258f, 0.952317f,
- 0.952375f, 0.952433f, 0.952492f, 0.952550f, 0.952609f, 0.952667f, 0.952725f, 0.952783f,
- 0.952842f, 0.952900f, 0.952958f, 0.953016f, 0.953074f, 0.953132f, 0.953190f, 0.953248f,
- 0.953306f, 0.953364f, 0.953422f, 0.953480f, 0.953537f, 0.953595f, 0.953653f, 0.953711f,
- 0.953768f, 0.953826f, 0.953883f, 0.953941f, 0.953998f, 0.954056f, 0.954113f, 0.954171f,
- 0.954228f, 0.954285f, 0.954343f, 0.954400f, 0.954457f, 0.954514f, 0.954572f, 0.954629f,
- 0.954686f, 0.954743f, 0.954800f, 0.954857f, 0.954914f, 0.954971f, 0.955028f, 0.955084f,
- 0.955141f, 0.955198f, 0.955255f, 0.955311f, 0.955368f, 0.955425f, 0.955481f, 0.955538f,
- 0.955594f, 0.955651f, 0.955707f, 0.955764f, 0.955820f, 0.955876f, 0.955933f, 0.955989f,
- 0.956045f, 0.956101f, 0.956158f, 0.956214f, 0.956270f, 0.956326f, 0.956382f, 0.956438f,
- 0.956494f, 0.956550f, 0.956606f, 0.956662f, 0.956717f, 0.956773f, 0.956829f, 0.956885f,
- 0.956940f, 0.956996f, 0.957052f, 0.957107f, 0.957163f, 0.957218f, 0.957274f, 0.957329f,
- 0.957385f, 0.957440f, 0.957495f, 0.957550f, 0.957606f, 0.957661f, 0.957716f, 0.957771f,
- 0.957826f, 0.957882f, 0.957937f, 0.957992f, 0.958046f, 0.958101f, 0.958156f, 0.958211f,
- 0.958266f, 0.958321f, 0.958376f, 0.958430f, 0.958485f, 0.958540f, 0.958594f, 0.958649f,
- 0.958703f, 0.958758f, 0.958812f, 0.958867f, 0.958921f, 0.958976f, 0.959030f, 0.959084f,
- 0.959139f, 0.959193f, 0.959247f, 0.959301f, 0.959355f, 0.959409f, 0.959463f, 0.959518f,
- 0.959572f, 0.959625f, 0.959679f, 0.959733f, 0.959787f, 0.959841f, 0.959895f, 0.959948f,
- 0.960002f, 0.960056f, 0.960109f, 0.960163f, 0.960217f, 0.960270f, 0.960324f, 0.960377f,
- 0.960431f, 0.960484f, 0.960537f, 0.960591f, 0.960644f, 0.960697f, 0.960750f, 0.960804f,
- 0.960857f, 0.960910f, 0.960963f, 0.961016f, 0.961069f, 0.961122f, 0.961175f, 0.961228f,
- 0.961280f, 0.961333f, 0.961386f, 0.961439f, 0.961492f, 0.961544f, 0.961597f, 0.961649f,
- 0.961702f, 0.961755f, 0.961807f, 0.961860f, 0.961912f, 0.961964f, 0.962017f, 0.962069f,
- 0.962121f, 0.962174f, 0.962226f, 0.962278f, 0.962330f, 0.962382f, 0.962434f, 0.962486f,
- 0.962538f, 0.962590f, 0.962642f, 0.962694f, 0.962746f, 0.962798f, 0.962850f, 0.962902f,
- 0.962953f, 0.963005f, 0.963057f, 0.963108f, 0.963160f, 0.963211f, 0.963263f, 0.963314f,
- 0.963366f, 0.963417f, 0.963469f, 0.963520f, 0.963571f, 0.963623f, 0.963674f, 0.963725f,
- 0.963776f, 0.963827f, 0.963878f, 0.963929f, 0.963980f, 0.964031f, 0.964082f, 0.964133f,
- 0.964184f, 0.964235f, 0.964286f, 0.964336f, 0.964387f, 0.964438f, 0.964489f, 0.964539f,
- 0.964590f, 0.964640f, 0.964691f, 0.964741f, 0.964792f, 0.964842f, 0.964893f, 0.964943f,
- 0.964993f, 0.965044f, 0.965094f, 0.965144f, 0.965194f, 0.965244f, 0.965294f, 0.965344f,
- 0.965394f, 0.965444f, 0.965494f, 0.965544f, 0.965594f, 0.965644f, 0.965694f, 0.965744f,
- 0.965793f, 0.965843f, 0.965893f, 0.965942f, 0.965992f, 0.966042f, 0.966091f, 0.966141f,
- 0.966190f, 0.966239f, 0.966289f, 0.966338f, 0.966387f, 0.966437f, 0.966486f, 0.966535f,
- 0.966584f, 0.966633f, 0.966683f, 0.966732f, 0.966781f, 0.966830f, 0.966879f, 0.966928f,
- 0.966976f, 0.967025f, 0.967074f, 0.967123f, 0.967172f, 0.967220f, 0.967269f, 0.967318f,
- 0.967366f, 0.967415f, 0.967463f, 0.967512f, 0.967560f, 0.967609f, 0.967657f, 0.967706f,
- 0.967754f, 0.967802f, 0.967850f, 0.967899f, 0.967947f, 0.967995f, 0.968043f, 0.968091f,
- 0.968139f, 0.968187f, 0.968235f, 0.968283f, 0.968331f, 0.968379f, 0.968427f, 0.968474f,
- 0.968522f, 0.968570f, 0.968617f, 0.968665f, 0.968713f, 0.968760f, 0.968808f, 0.968855f,
- 0.968903f, 0.968950f, 0.968998f, 0.969045f, 0.969092f, 0.969140f, 0.969187f, 0.969234f,
- 0.969281f, 0.969328f, 0.969375f, 0.969423f, 0.969470f, 0.969517f, 0.969564f, 0.969611f,
- 0.969657f, 0.969704f, 0.969751f, 0.969798f, 0.969845f, 0.969891f, 0.969938f, 0.969985f,
- 0.970031f, 0.970078f, 0.970124f, 0.970171f, 0.970217f, 0.970264f, 0.970310f, 0.970357f,
- 0.970403f, 0.970449f, 0.970495f, 0.970542f, 0.970588f, 0.970634f, 0.970680f, 0.970726f,
- 0.970772f, 0.970818f, 0.970864f, 0.970910f, 0.970956f, 0.971002f, 0.971048f, 0.971093f,
- 0.971139f, 0.971185f, 0.971231f, 0.971276f, 0.971322f, 0.971367f, 0.971413f, 0.971458f,
- 0.971504f, 0.971549f, 0.971595f, 0.971640f, 0.971685f, 0.971731f, 0.971776f, 0.971821f,
- 0.971866f, 0.971911f, 0.971957f, 0.972002f, 0.972047f, 0.972092f, 0.972137f, 0.972182f,
- 0.972227f, 0.972271f, 0.972316f, 0.972361f, 0.972406f, 0.972450f, 0.972495f, 0.972540f,
- 0.972584f, 0.972629f, 0.972673f, 0.972718f, 0.972762f, 0.972807f, 0.972851f, 0.972896f,
- 0.972940f, 0.972984f, 0.973028f, 0.973073f, 0.973117f, 0.973161f, 0.973205f, 0.973249f,
- 0.973293f, 0.973337f, 0.973381f, 0.973425f, 0.973469f, 0.973513f, 0.973557f, 0.973601f,
- 0.973644f, 0.973688f, 0.973732f, 0.973775f, 0.973819f, 0.973862f, 0.973906f, 0.973949f,
- 0.973993f, 0.974036f, 0.974080f, 0.974123f, 0.974166f, 0.974210f, 0.974253f, 0.974296f,
- 0.974339f, 0.974383f, 0.974426f, 0.974469f, 0.974512f, 0.974555f, 0.974598f, 0.974641f,
- 0.974684f, 0.974726f, 0.974769f, 0.974812f, 0.974855f, 0.974897f, 0.974940f, 0.974983f,
- 0.975025f, 0.975068f, 0.975110f, 0.975153f, 0.975195f, 0.975238f, 0.975280f, 0.975323f,
- 0.975365f, 0.975407f, 0.975449f, 0.975492f, 0.975534f, 0.975576f, 0.975618f, 0.975660f,
- 0.975702f, 0.975744f, 0.975786f, 0.975828f, 0.975870f, 0.975912f, 0.975954f, 0.975995f,
- 0.976037f, 0.976079f, 0.976120f, 0.976162f, 0.976204f, 0.976245f, 0.976287f, 0.976328f,
- 0.976370f, 0.976411f, 0.976453f, 0.976494f, 0.976535f, 0.976576f, 0.976618f, 0.976659f,
- 0.976700f, 0.976741f, 0.976782f, 0.976823f, 0.976864f, 0.976905f, 0.976946f, 0.976987f,
- 0.977028f, 0.977069f, 0.977110f, 0.977151f, 0.977191f, 0.977232f, 0.977273f, 0.977313f,
- 0.977354f, 0.977394f, 0.977435f, 0.977475f, 0.977516f, 0.977556f, 0.977597f, 0.977637f,
- 0.977677f, 0.977718f, 0.977758f, 0.977798f, 0.977838f, 0.977878f, 0.977918f, 0.977959f,
- 0.977998f, 0.978038f, 0.978078f, 0.978118f, 0.978158f, 0.978198f, 0.978238f, 0.978278f,
- 0.978317f, 0.978357f, 0.978397f, 0.978436f, 0.978476f, 0.978516f, 0.978555f, 0.978594f,
- 0.978634f, 0.978673f, 0.978713f, 0.978752f, 0.978791f, 0.978831f, 0.978870f, 0.978909f,
- 0.978948f, 0.978987f, 0.979026f, 0.979065f, 0.979104f, 0.979143f, 0.979182f, 0.979221f,
- 0.979260f, 0.979299f, 0.979338f, 0.979376f, 0.979415f, 0.979454f, 0.979493f, 0.979531f,
- 0.979570f, 0.979608f, 0.979647f, 0.979685f, 0.979724f, 0.979762f, 0.979800f, 0.979839f,
- 0.979877f, 0.979915f, 0.979954f, 0.979992f, 0.980030f, 0.980068f, 0.980106f, 0.980144f,
- 0.980182f, 0.980220f, 0.980258f, 0.980296f, 0.980334f, 0.980372f, 0.980409f, 0.980447f,
- 0.980485f, 0.980523f, 0.980560f, 0.980598f, 0.980635f, 0.980673f, 0.980710f, 0.980748f,
- 0.980785f, 0.980823f, 0.980860f, 0.980897f, 0.980935f, 0.980972f, 0.981009f, 0.981046f,
- 0.981083f, 0.981120f, 0.981158f, 0.981195f, 0.981232f, 0.981269f, 0.981305f, 0.981342f,
- 0.981379f, 0.981416f, 0.981453f, 0.981490f, 0.981526f, 0.981563f, 0.981600f, 0.981636f,
- 0.981673f, 0.981709f, 0.981746f, 0.981782f, 0.981819f, 0.981855f, 0.981891f, 0.981928f,
- 0.981964f, 0.982000f, 0.982036f, 0.982072f, 0.982109f, 0.982145f, 0.982181f, 0.982217f,
- 0.982253f, 0.982289f, 0.982325f, 0.982360f, 0.982396f, 0.982432f, 0.982468f, 0.982504f,
- 0.982539f, 0.982575f, 0.982611f, 0.982646f, 0.982682f, 0.982717f, 0.982753f, 0.982788f,
- 0.982824f, 0.982859f, 0.982894f, 0.982930f, 0.982965f, 0.983000f, 0.983035f, 0.983070f,
- 0.983105f, 0.983141f, 0.983176f, 0.983211f, 0.983246f, 0.983281f, 0.983315f, 0.983350f,
- 0.983385f, 0.983420f, 0.983455f, 0.983489f, 0.983524f, 0.983559f, 0.983593f, 0.983628f,
- 0.983662f, 0.983697f, 0.983731f, 0.983766f, 0.983800f, 0.983835f, 0.983869f, 0.983903f,
- 0.983937f, 0.983972f, 0.984006f, 0.984040f, 0.984074f, 0.984108f, 0.984142f, 0.984176f,
- 0.984210f, 0.984244f, 0.984278f, 0.984312f, 0.984346f, 0.984379f, 0.984413f, 0.984447f,
- 0.984480f, 0.984514f, 0.984548f, 0.984581f, 0.984615f, 0.984648f, 0.984682f, 0.984715f,
- 0.984748f, 0.984782f, 0.984815f, 0.984848f, 0.984882f, 0.984915f, 0.984948f, 0.984981f,
- 0.985014f, 0.985047f, 0.985080f, 0.985113f, 0.985146f, 0.985179f, 0.985212f, 0.985245f,
- 0.985278f, 0.985310f, 0.985343f, 0.985376f, 0.985408f, 0.985441f, 0.985474f, 0.985506f,
- 0.985539f, 0.985571f, 0.985604f, 0.985636f, 0.985668f, 0.985701f, 0.985733f, 0.985765f,
- 0.985798f, 0.985830f, 0.985862f, 0.985894f, 0.985926f, 0.985958f, 0.985990f, 0.986022f,
- 0.986054f, 0.986086f, 0.986118f, 0.986150f, 0.986181f, 0.986213f, 0.986245f, 0.986276f,
- 0.986308f, 0.986340f, 0.986371f, 0.986403f, 0.986434f, 0.986466f, 0.986497f, 0.986529f,
- 0.986560f, 0.986591f, 0.986623f, 0.986654f, 0.986685f, 0.986716f, 0.986747f, 0.986778f,
- 0.986809f, 0.986840f, 0.986871f, 0.986902f, 0.986933f, 0.986964f, 0.986995f, 0.987026f,
- 0.987057f, 0.987087f, 0.987118f, 0.987149f, 0.987179f, 0.987210f, 0.987240f, 0.987271f,
- 0.987301f, 0.987332f, 0.987362f, 0.987393f, 0.987423f, 0.987453f, 0.987484f, 0.987514f,
- 0.987544f, 0.987574f, 0.987604f, 0.987634f, 0.987664f, 0.987694f, 0.987724f, 0.987754f,
- 0.987784f, 0.987814f, 0.987844f, 0.987874f, 0.987903f, 0.987933f, 0.987963f, 0.987992f,
- 0.988022f, 0.988052f, 0.988081f, 0.988111f, 0.988140f, 0.988169f, 0.988199f, 0.988228f,
- 0.988258f, 0.988287f, 0.988316f, 0.988345f, 0.988374f, 0.988404f, 0.988433f, 0.988462f,
- 0.988491f, 0.988520f, 0.988549f, 0.988578f, 0.988607f, 0.988635f, 0.988664f, 0.988693f,
- 0.988722f, 0.988750f, 0.988779f, 0.988808f, 0.988836f, 0.988865f, 0.988893f, 0.988922f,
- 0.988950f, 0.988979f, 0.989007f, 0.989035f, 0.989064f, 0.989092f, 0.989120f, 0.989148f,
- 0.989177f, 0.989205f, 0.989233f, 0.989261f, 0.989289f, 0.989317f, 0.989345f, 0.989373f,
- 0.989400f, 0.989428f, 0.989456f, 0.989484f, 0.989511f, 0.989539f, 0.989567f, 0.989594f,
- 0.989622f, 0.989650f, 0.989677f, 0.989704f, 0.989732f, 0.989759f, 0.989787f, 0.989814f,
- 0.989841f, 0.989869f, 0.989896f, 0.989923f, 0.989950f, 0.989977f, 0.990004f, 0.990031f,
- 0.990058f, 0.990085f, 0.990112f, 0.990139f, 0.990166f, 0.990193f, 0.990219f, 0.990246f,
- 0.990273f, 0.990299f, 0.990326f, 0.990353f, 0.990379f, 0.990406f, 0.990432f, 0.990459f,
- 0.990485f, 0.990511f, 0.990538f, 0.990564f, 0.990590f, 0.990617f, 0.990643f, 0.990669f,
- 0.990695f, 0.990721f, 0.990747f, 0.990773f, 0.990799f, 0.990825f, 0.990851f, 0.990877f,
- 0.990903f, 0.990928f, 0.990954f, 0.990980f, 0.991006f, 0.991031f, 0.991057f, 0.991082f,
- 0.991108f, 0.991133f, 0.991159f, 0.991184f, 0.991210f, 0.991235f, 0.991260f, 0.991286f,
- 0.991311f, 0.991336f, 0.991361f, 0.991386f, 0.991411f, 0.991437f, 0.991462f, 0.991487f,
- 0.991511f, 0.991536f, 0.991561f, 0.991586f, 0.991611f, 0.991636f, 0.991660f, 0.991685f,
- 0.991710f, 0.991734f, 0.991759f, 0.991783f, 0.991808f, 0.991832f, 0.991857f, 0.991881f,
- 0.991906f, 0.991930f, 0.991954f, 0.991979f, 0.992003f, 0.992027f, 0.992051f, 0.992075f,
- 0.992099f, 0.992123f, 0.992147f, 0.992171f, 0.992195f, 0.992219f, 0.992243f, 0.992267f,
- 0.992291f, 0.992314f, 0.992338f, 0.992362f, 0.992385f, 0.992409f, 0.992433f, 0.992456f,
- 0.992480f, 0.992503f, 0.992526f, 0.992550f, 0.992573f, 0.992596f, 0.992620f, 0.992643f,
- 0.992666f, 0.992689f, 0.992712f, 0.992736f, 0.992759f, 0.992782f, 0.992805f, 0.992828f,
- 0.992850f, 0.992873f, 0.992896f, 0.992919f, 0.992942f, 0.992964f, 0.992987f, 0.993010f,
- 0.993032f, 0.993055f, 0.993077f, 0.993100f, 0.993122f, 0.993145f, 0.993167f, 0.993190f,
- 0.993212f, 0.993234f, 0.993257f, 0.993279f, 0.993301f, 0.993323f, 0.993345f, 0.993367f,
- 0.993389f, 0.993411f, 0.993433f, 0.993455f, 0.993477f, 0.993499f, 0.993521f, 0.993542f,
- 0.993564f, 0.993586f, 0.993608f, 0.993629f, 0.993651f, 0.993672f, 0.993694f, 0.993715f,
- 0.993737f, 0.993758f, 0.993779f, 0.993801f, 0.993822f, 0.993843f, 0.993865f, 0.993886f,
- 0.993907f, 0.993928f, 0.993949f, 0.993970f, 0.993991f, 0.994012f, 0.994033f, 0.994054f,
- 0.994075f, 0.994096f, 0.994116f, 0.994137f, 0.994158f, 0.994179f, 0.994199f, 0.994220f,
- 0.994240f, 0.994261f, 0.994281f, 0.994302f, 0.994322f, 0.994343f, 0.994363f, 0.994383f,
- 0.994404f, 0.994424f, 0.994444f, 0.994464f, 0.994484f, 0.994505f, 0.994525f, 0.994545f,
- 0.994565f, 0.994585f, 0.994604f, 0.994624f, 0.994644f, 0.994664f, 0.994684f, 0.994703f,
- 0.994723f, 0.994743f, 0.994762f, 0.994782f, 0.994802f, 0.994821f, 0.994841f, 0.994860f,
- 0.994879f, 0.994899f, 0.994918f, 0.994937f, 0.994957f, 0.994976f, 0.994995f, 0.995014f,
- 0.995033f, 0.995052f, 0.995071f, 0.995090f, 0.995109f, 0.995128f, 0.995147f, 0.995166f,
- 0.995185f, 0.995203f, 0.995222f, 0.995241f, 0.995260f, 0.995278f, 0.995297f, 0.995315f,
- 0.995334f, 0.995352f, 0.995371f, 0.995389f, 0.995408f, 0.995426f, 0.995444f, 0.995463f,
- 0.995481f, 0.995499f, 0.995517f, 0.995535f, 0.995553f, 0.995571f, 0.995589f, 0.995607f,
- 0.995625f, 0.995643f, 0.995661f, 0.995679f, 0.995697f, 0.995714f, 0.995732f, 0.995750f,
- 0.995767f, 0.995785f, 0.995803f, 0.995820f, 0.995838f, 0.995855f, 0.995872f, 0.995890f,
- 0.995907f, 0.995925f, 0.995942f, 0.995959f, 0.995976f, 0.995993f, 0.996011f, 0.996028f,
- 0.996045f, 0.996062f, 0.996079f, 0.996096f, 0.996113f, 0.996129f, 0.996146f, 0.996163f,
- 0.996180f, 0.996197f, 0.996213f, 0.996230f, 0.996247f, 0.996263f, 0.996280f, 0.996296f,
- 0.996313f, 0.996329f, 0.996345f, 0.996362f, 0.996378f, 0.996394f, 0.996411f, 0.996427f,
- 0.996443f, 0.996459f, 0.996475f, 0.996491f, 0.996507f, 0.996523f, 0.996539f, 0.996555f,
- 0.996571f, 0.996587f, 0.996603f, 0.996619f, 0.996634f, 0.996650f, 0.996666f, 0.996681f,
- 0.996697f, 0.996712f, 0.996728f, 0.996743f, 0.996759f, 0.996774f, 0.996790f, 0.996805f,
- 0.996820f, 0.996836f, 0.996851f, 0.996866f, 0.996881f, 0.996896f, 0.996911f, 0.996926f,
- 0.996941f, 0.996956f, 0.996971f, 0.996986f, 0.997001f, 0.997016f, 0.997031f, 0.997045f,
- 0.997060f, 0.997075f, 0.997089f, 0.997104f, 0.997119f, 0.997133f, 0.997148f, 0.997162f,
- 0.997176f, 0.997191f, 0.997205f, 0.997219f, 0.997234f, 0.997248f, 0.997262f, 0.997276f,
- 0.997290f, 0.997305f, 0.997319f, 0.997333f, 0.997347f, 0.997361f, 0.997374f, 0.997388f,
- 0.997402f, 0.997416f, 0.997430f, 0.997443f, 0.997457f, 0.997471f, 0.997484f, 0.997498f,
- 0.997511f, 0.997525f, 0.997538f, 0.997552f, 0.997565f, 0.997579f, 0.997592f, 0.997605f,
- 0.997618f, 0.997632f, 0.997645f, 0.997658f, 0.997671f, 0.997684f, 0.997697f, 0.997710f,
- 0.997723f, 0.997736f, 0.997749f, 0.997762f, 0.997774f, 0.997787f, 0.997800f, 0.997813f,
- 0.997825f, 0.997838f, 0.997851f, 0.997863f, 0.997876f, 0.997888f, 0.997901f, 0.997913f,
- 0.997925f, 0.997938f, 0.997950f, 0.997962f, 0.997974f, 0.997987f, 0.997999f, 0.998011f,
- 0.998023f, 0.998035f, 0.998047f, 0.998059f, 0.998071f, 0.998083f, 0.998094f, 0.998106f,
- 0.998118f, 0.998130f, 0.998142f, 0.998153f, 0.998165f, 0.998176f, 0.998188f, 0.998200f,
- 0.998211f, 0.998222f, 0.998234f, 0.998245f, 0.998257f, 0.998268f, 0.998279f, 0.998290f,
- 0.998302f, 0.998313f, 0.998324f, 0.998335f, 0.998346f, 0.998357f, 0.998368f, 0.998379f,
- 0.998390f, 0.998401f, 0.998411f, 0.998422f, 0.998433f, 0.998444f, 0.998454f, 0.998465f,
- 0.998476f, 0.998486f, 0.998497f, 0.998507f, 0.998518f, 0.998528f, 0.998538f, 0.998549f,
- 0.998559f, 0.998569f, 0.998580f, 0.998590f, 0.998600f, 0.998610f, 0.998620f, 0.998630f,
- 0.998640f, 0.998650f, 0.998660f, 0.998670f, 0.998680f, 0.998690f, 0.998700f, 0.998709f,
- 0.998719f, 0.998729f, 0.998738f, 0.998748f, 0.998758f, 0.998767f, 0.998777f, 0.998786f,
- 0.998795f, 0.998805f, 0.998814f, 0.998824f, 0.998833f, 0.998842f, 0.998851f, 0.998860f,
- 0.998870f, 0.998879f, 0.998888f, 0.998897f, 0.998906f, 0.998915f, 0.998924f, 0.998932f,
- 0.998941f, 0.998950f, 0.998959f, 0.998968f, 0.998976f, 0.998985f, 0.998994f, 0.999002f,
- 0.999011f, 0.999019f, 0.999028f, 0.999036f, 0.999044f, 0.999053f, 0.999061f, 0.999069f,
- 0.999078f, 0.999086f, 0.999094f, 0.999102f, 0.999110f, 0.999118f, 0.999126f, 0.999134f,
- 0.999142f, 0.999150f, 0.999158f, 0.999166f, 0.999174f, 0.999182f, 0.999189f, 0.999197f,
- 0.999205f, 0.999212f, 0.999220f, 0.999228f, 0.999235f, 0.999243f, 0.999250f, 0.999257f,
- 0.999265f, 0.999272f, 0.999279f, 0.999287f, 0.999294f, 0.999301f, 0.999308f, 0.999315f,
- 0.999322f, 0.999329f, 0.999336f, 0.999343f, 0.999350f, 0.999357f, 0.999364f, 0.999371f,
- 0.999378f, 0.999384f, 0.999391f, 0.999398f, 0.999404f, 0.999411f, 0.999418f, 0.999424f,
- 0.999431f, 0.999437f, 0.999443f, 0.999450f, 0.999456f, 0.999462f, 0.999469f, 0.999475f,
- 0.999481f, 0.999487f, 0.999493f, 0.999500f, 0.999506f, 0.999512f, 0.999518f, 0.999524f,
- 0.999529f, 0.999535f, 0.999541f, 0.999547f, 0.999553f, 0.999558f, 0.999564f, 0.999570f,
- 0.999575f, 0.999581f, 0.999586f, 0.999592f, 0.999597f, 0.999603f, 0.999608f, 0.999614f,
- 0.999619f, 0.999624f, 0.999629f, 0.999635f, 0.999640f, 0.999645f, 0.999650f, 0.999655f,
- 0.999660f, 0.999665f, 0.999670f, 0.999675f, 0.999680f, 0.999685f, 0.999689f, 0.999694f,
- 0.999699f, 0.999704f, 0.999708f, 0.999713f, 0.999717f, 0.999722f, 0.999726f, 0.999731f,
- 0.999735f, 0.999740f, 0.999744f, 0.999748f, 0.999753f, 0.999757f, 0.999761f, 0.999765f,
- 0.999769f, 0.999774f, 0.999778f, 0.999782f, 0.999786f, 0.999790f, 0.999793f, 0.999797f,
- 0.999801f, 0.999805f, 0.999809f, 0.999812f, 0.999816f, 0.999820f, 0.999823f, 0.999827f,
- 0.999831f, 0.999834f, 0.999838f, 0.999841f, 0.999844f, 0.999848f, 0.999851f, 0.999854f,
- 0.999858f, 0.999861f, 0.999864f, 0.999867f, 0.999870f, 0.999873f, 0.999876f, 0.999879f,
- 0.999882f, 0.999885f, 0.999888f, 0.999891f, 0.999894f, 0.999897f, 0.999899f, 0.999902f,
- 0.999905f, 0.999907f, 0.999910f, 0.999913f, 0.999915f, 0.999917f, 0.999920f, 0.999922f,
- 0.999925f, 0.999927f, 0.999929f, 0.999932f, 0.999934f, 0.999936f, 0.999938f, 0.999940f,
- 0.999942f, 0.999944f, 0.999946f, 0.999948f, 0.999950f, 0.999952f, 0.999954f, 0.999956f,
- 0.999958f, 0.999959f, 0.999961f, 0.999963f, 0.999964f, 0.999966f, 0.999968f, 0.999969f,
- 0.999971f, 0.999972f, 0.999973f, 0.999975f, 0.999976f, 0.999977f, 0.999979f, 0.999980f,
- 0.999981f, 0.999982f, 0.999983f, 0.999985f, 0.999986f, 0.999987f, 0.999988f, 0.999988f,
- 0.999989f, 0.999990f, 0.999991f, 0.999992f, 0.999993f, 0.999993f, 0.999994f, 0.999995f,
- 0.999995f, 0.999996f, 0.999996f, 0.999997f, 0.999997f, 0.999998f, 0.999998f, 0.999999f,
- 0.999999f, 0.999999f, 0.999999f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 0.000000f, -0.000192f, -0.000383f, -0.000575f, -0.000767f, -0.000959f, -0.001150f, -0.001342f,
- -0.001534f, -0.001726f, -0.001917f, -0.002109f, -0.002301f, -0.002493f, -0.002684f, -0.002876f,
- -0.003068f, -0.003260f, -0.003451f, -0.003643f, -0.003835f, -0.004027f, -0.004218f, -0.004410f,
- -0.004602f, -0.004794f, -0.004985f, -0.005177f, -0.005369f, -0.005561f, -0.005752f, -0.005944f,
- -0.006136f, -0.006328f, -0.006519f, -0.006711f, -0.006903f, -0.007095f, -0.007286f, -0.007478f,
- -0.007670f, -0.007862f, -0.008053f, -0.008245f, -0.008437f, -0.008629f, -0.008820f, -0.009012f,
- -0.009204f, -0.009395f, -0.009587f, -0.009779f, -0.009971f, -0.010162f, -0.010354f, -0.010546f,
- -0.010738f, -0.010929f, -0.011121f, -0.011313f, -0.011505f, -0.011696f, -0.011888f, -0.012080f,
- -0.012272f, -0.012463f, -0.012655f, -0.012847f, -0.013038f, -0.013230f, -0.013422f, -0.013614f,
- -0.013805f, -0.013997f, -0.014189f, -0.014381f, -0.014572f, -0.014764f, -0.014956f, -0.015147f,
- -0.015339f, -0.015531f, -0.015723f, -0.015914f, -0.016106f, -0.016298f, -0.016490f, -0.016681f,
- -0.016873f, -0.017065f, -0.017256f, -0.017448f, -0.017640f, -0.017832f, -0.018023f, -0.018215f,
- -0.018407f, -0.018598f, -0.018790f, -0.018982f, -0.019174f, -0.019365f, -0.019557f, -0.019749f,
- -0.019940f, -0.020132f, -0.020324f, -0.020516f, -0.020707f, -0.020899f, -0.021091f, -0.021282f,
- -0.021474f, -0.021666f, -0.021857f, -0.022049f, -0.022241f, -0.022433f, -0.022624f, -0.022816f,
- -0.023008f, -0.023199f, -0.023391f, -0.023583f, -0.023774f, -0.023966f, -0.024158f, -0.024350f,
- -0.024541f, -0.024733f, -0.024925f, -0.025116f, -0.025308f, -0.025500f, -0.025691f, -0.025883f,
- -0.026075f, -0.026266f, -0.026458f, -0.026650f, -0.026841f, -0.027033f, -0.027225f, -0.027416f,
- -0.027608f, -0.027800f, -0.027991f, -0.028183f, -0.028375f, -0.028567f, -0.028758f, -0.028950f,
- -0.029142f, -0.029333f, -0.029525f, -0.029717f, -0.029908f, -0.030100f, -0.030291f, -0.030483f,
- -0.030675f, -0.030866f, -0.031058f, -0.031250f, -0.031441f, -0.031633f, -0.031825f, -0.032016f,
- -0.032208f, -0.032400f, -0.032591f, -0.032783f, -0.032975f, -0.033166f, -0.033358f, -0.033550f,
- -0.033741f, -0.033933f, -0.034124f, -0.034316f, -0.034508f, -0.034699f, -0.034891f, -0.035083f,
- -0.035274f, -0.035466f, -0.035657f, -0.035849f, -0.036041f, -0.036232f, -0.036424f, -0.036616f,
- -0.036807f, -0.036999f, -0.037190f, -0.037382f, -0.037574f, -0.037765f, -0.037957f, -0.038149f,
- -0.038340f, -0.038532f, -0.038723f, -0.038915f, -0.039107f, -0.039298f, -0.039490f, -0.039681f,
- -0.039873f, -0.040065f, -0.040256f, -0.040448f, -0.040639f, -0.040831f, -0.041022f, -0.041214f,
- -0.041406f, -0.041597f, -0.041789f, -0.041980f, -0.042172f, -0.042364f, -0.042555f, -0.042747f,
- -0.042938f, -0.043130f, -0.043321f, -0.043513f, -0.043705f, -0.043896f, -0.044088f, -0.044279f,
- -0.044471f, -0.044662f, -0.044854f, -0.045045f, -0.045237f, -0.045429f, -0.045620f, -0.045812f,
- -0.046003f, -0.046195f, -0.046386f, -0.046578f, -0.046769f, -0.046961f, -0.047152f, -0.047344f,
- -0.047535f, -0.047727f, -0.047919f, -0.048110f, -0.048302f, -0.048493f, -0.048685f, -0.048876f,
- -0.049068f, -0.049259f, -0.049451f, -0.049642f, -0.049834f, -0.050025f, -0.050217f, -0.050408f,
- -0.050600f, -0.050791f, -0.050983f, -0.051174f, -0.051366f, -0.051557f, -0.051749f, -0.051940f,
- -0.052132f, -0.052323f, -0.052515f, -0.052706f, -0.052898f, -0.053089f, -0.053281f, -0.053472f,
- -0.053664f, -0.053855f, -0.054046f, -0.054238f, -0.054429f, -0.054621f, -0.054812f, -0.055004f,
- -0.055195f, -0.055387f, -0.055578f, -0.055770f, -0.055961f, -0.056152f, -0.056344f, -0.056535f,
- -0.056727f, -0.056918f, -0.057110f, -0.057301f, -0.057493f, -0.057684f, -0.057875f, -0.058067f,
- -0.058258f, -0.058450f, -0.058641f, -0.058833f, -0.059024f, -0.059215f, -0.059407f, -0.059598f,
- -0.059790f, -0.059981f, -0.060172f, -0.060364f, -0.060555f, -0.060747f, -0.060938f, -0.061129f,
- -0.061321f, -0.061512f, -0.061704f, -0.061895f, -0.062086f, -0.062278f, -0.062469f, -0.062660f,
- -0.062852f, -0.063043f, -0.063234f, -0.063426f, -0.063617f, -0.063809f, -0.064000f, -0.064191f,
- -0.064383f, -0.064574f, -0.064765f, -0.064957f, -0.065148f, -0.065339f, -0.065531f, -0.065722f,
- -0.065913f, -0.066105f, -0.066296f, -0.066487f, -0.066679f, -0.066870f, -0.067061f, -0.067253f,
- -0.067444f, -0.067635f, -0.067827f, -0.068018f, -0.068209f, -0.068400f, -0.068592f, -0.068783f,
- -0.068974f, -0.069166f, -0.069357f, -0.069548f, -0.069739f, -0.069931f, -0.070122f, -0.070313f,
- -0.070505f, -0.070696f, -0.070887f, -0.071078f, -0.071270f, -0.071461f, -0.071652f, -0.071843f,
- -0.072035f, -0.072226f, -0.072417f, -0.072608f, -0.072800f, -0.072991f, -0.073182f, -0.073373f,
- -0.073565f, -0.073756f, -0.073947f, -0.074138f, -0.074329f, -0.074521f, -0.074712f, -0.074903f,
- -0.075094f, -0.075286f, -0.075477f, -0.075668f, -0.075859f, -0.076050f, -0.076241f, -0.076433f,
- -0.076624f, -0.076815f, -0.077006f, -0.077197f, -0.077389f, -0.077580f, -0.077771f, -0.077962f,
- -0.078153f, -0.078344f, -0.078536f, -0.078727f, -0.078918f, -0.079109f, -0.079300f, -0.079491f,
- -0.079682f, -0.079874f, -0.080065f, -0.080256f, -0.080447f, -0.080638f, -0.080829f, -0.081020f,
- -0.081211f, -0.081403f, -0.081594f, -0.081785f, -0.081976f, -0.082167f, -0.082358f, -0.082549f,
- -0.082740f, -0.082931f, -0.083122f, -0.083314f, -0.083505f, -0.083696f, -0.083887f, -0.084078f,
- -0.084269f, -0.084460f, -0.084651f, -0.084842f, -0.085033f, -0.085224f, -0.085415f, -0.085606f,
- -0.085797f, -0.085988f, -0.086179f, -0.086370f, -0.086561f, -0.086752f, -0.086943f, -0.087135f,
- -0.087326f, -0.087517f, -0.087708f, -0.087899f, -0.088090f, -0.088281f, -0.088472f, -0.088663f,
- -0.088854f, -0.089045f, -0.089236f, -0.089427f, -0.089617f, -0.089808f, -0.089999f, -0.090190f,
- -0.090381f, -0.090572f, -0.090763f, -0.090954f, -0.091145f, -0.091336f, -0.091527f, -0.091718f,
- -0.091909f, -0.092100f, -0.092291f, -0.092482f, -0.092673f, -0.092864f, -0.093055f, -0.093245f,
- -0.093436f, -0.093627f, -0.093818f, -0.094009f, -0.094200f, -0.094391f, -0.094582f, -0.094773f,
- -0.094963f, -0.095154f, -0.095345f, -0.095536f, -0.095727f, -0.095918f, -0.096109f, -0.096300f,
- -0.096490f, -0.096681f, -0.096872f, -0.097063f, -0.097254f, -0.097445f, -0.097635f, -0.097826f,
- -0.098017f, -0.098208f, -0.098399f, -0.098590f, -0.098780f, -0.098971f, -0.099162f, -0.099353f,
- -0.099544f, -0.099734f, -0.099925f, -0.100116f, -0.100307f, -0.100498f, -0.100688f, -0.100879f,
- -0.101070f, -0.101261f, -0.101451f, -0.101642f, -0.101833f, -0.102024f, -0.102214f, -0.102405f,
- -0.102596f, -0.102787f, -0.102977f, -0.103168f, -0.103359f, -0.103550f, -0.103740f, -0.103931f,
- -0.104122f, -0.104312f, -0.104503f, -0.104694f, -0.104884f, -0.105075f, -0.105266f, -0.105456f,
- -0.105647f, -0.105838f, -0.106028f, -0.106219f, -0.106410f, -0.106600f, -0.106791f, -0.106982f,
- -0.107172f, -0.107363f, -0.107554f, -0.107744f, -0.107935f, -0.108126f, -0.108316f, -0.108507f,
- -0.108697f, -0.108888f, -0.109079f, -0.109269f, -0.109460f, -0.109650f, -0.109841f, -0.110032f,
- -0.110222f, -0.110413f, -0.110603f, -0.110794f, -0.110984f, -0.111175f, -0.111366f, -0.111556f,
- -0.111747f, -0.111937f, -0.112128f, -0.112318f, -0.112509f, -0.112699f, -0.112890f, -0.113080f,
- -0.113271f, -0.113461f, -0.113652f, -0.113842f, -0.114033f, -0.114223f, -0.114414f, -0.114604f,
- -0.114795f, -0.114985f, -0.115176f, -0.115366f, -0.115557f, -0.115747f, -0.115938f, -0.116128f,
- -0.116319f, -0.116509f, -0.116700f, -0.116890f, -0.117080f, -0.117271f, -0.117461f, -0.117652f,
- -0.117842f, -0.118032f, -0.118223f, -0.118413f, -0.118604f, -0.118794f, -0.118984f, -0.119175f,
- -0.119365f, -0.119556f, -0.119746f, -0.119936f, -0.120127f, -0.120317f, -0.120507f, -0.120698f,
- -0.120888f, -0.121078f, -0.121269f, -0.121459f, -0.121649f, -0.121840f, -0.122030f, -0.122220f,
- -0.122411f, -0.122601f, -0.122791f, -0.122982f, -0.123172f, -0.123362f, -0.123552f, -0.123743f,
- -0.123933f, -0.124123f, -0.124314f, -0.124504f, -0.124694f, -0.124884f, -0.125075f, -0.125265f,
- -0.125455f, -0.125645f, -0.125835f, -0.126026f, -0.126216f, -0.126406f, -0.126596f, -0.126787f,
- -0.126977f, -0.127167f, -0.127357f, -0.127547f, -0.127737f, -0.127928f, -0.128118f, -0.128308f,
- -0.128498f, -0.128688f, -0.128878f, -0.129069f, -0.129259f, -0.129449f, -0.129639f, -0.129829f,
- -0.130019f, -0.130209f, -0.130399f, -0.130590f, -0.130780f, -0.130970f, -0.131160f, -0.131350f,
- -0.131540f, -0.131730f, -0.131920f, -0.132110f, -0.132300f, -0.132490f, -0.132680f, -0.132870f,
- -0.133061f, -0.133251f, -0.133441f, -0.133631f, -0.133821f, -0.134011f, -0.134201f, -0.134391f,
- -0.134581f, -0.134771f, -0.134961f, -0.135151f, -0.135341f, -0.135531f, -0.135721f, -0.135911f,
- -0.136101f, -0.136291f, -0.136480f, -0.136670f, -0.136860f, -0.137050f, -0.137240f, -0.137430f,
- -0.137620f, -0.137810f, -0.138000f, -0.138190f, -0.138380f, -0.138570f, -0.138760f, -0.138949f,
- -0.139139f, -0.139329f, -0.139519f, -0.139709f, -0.139899f, -0.140089f, -0.140279f, -0.140468f,
- -0.140658f, -0.140848f, -0.141038f, -0.141228f, -0.141418f, -0.141607f, -0.141797f, -0.141987f,
- -0.142177f, -0.142367f, -0.142556f, -0.142746f, -0.142936f, -0.143126f, -0.143316f, -0.143505f,
- -0.143695f, -0.143885f, -0.144075f, -0.144264f, -0.144454f, -0.144644f, -0.144833f, -0.145023f,
- -0.145213f, -0.145403f, -0.145592f, -0.145782f, -0.145972f, -0.146161f, -0.146351f, -0.146541f,
- -0.146730f, -0.146920f, -0.147110f, -0.147299f, -0.147489f, -0.147679f, -0.147868f, -0.148058f,
- -0.148248f, -0.148437f, -0.148627f, -0.148817f, -0.149006f, -0.149196f, -0.149385f, -0.149575f,
- -0.149765f, -0.149954f, -0.150144f, -0.150333f, -0.150523f, -0.150712f, -0.150902f, -0.151092f,
- -0.151281f, -0.151471f, -0.151660f, -0.151850f, -0.152039f, -0.152229f, -0.152418f, -0.152608f,
- -0.152797f, -0.152987f, -0.153176f, -0.153366f, -0.153555f, -0.153745f, -0.153934f, -0.154124f,
- -0.154313f, -0.154502f, -0.154692f, -0.154881f, -0.155071f, -0.155260f, -0.155450f, -0.155639f,
- -0.155828f, -0.156018f, -0.156207f, -0.156397f, -0.156586f, -0.156775f, -0.156965f, -0.157154f,
- -0.157343f, -0.157533f, -0.157722f, -0.157912f, -0.158101f, -0.158290f, -0.158480f, -0.158669f,
- -0.158858f, -0.159047f, -0.159237f, -0.159426f, -0.159615f, -0.159805f, -0.159994f, -0.160183f,
- -0.160372f, -0.160562f, -0.160751f, -0.160940f, -0.161129f, -0.161319f, -0.161508f, -0.161697f,
- -0.161886f, -0.162076f, -0.162265f, -0.162454f, -0.162643f, -0.162832f, -0.163022f, -0.163211f,
- -0.163400f, -0.163589f, -0.163778f, -0.163967f, -0.164157f, -0.164346f, -0.164535f, -0.164724f,
- -0.164913f, -0.165102f, -0.165291f, -0.165480f, -0.165670f, -0.165859f, -0.166048f, -0.166237f,
- -0.166426f, -0.166615f, -0.166804f, -0.166993f, -0.167182f, -0.167371f, -0.167560f, -0.167749f,
- -0.167938f, -0.168127f, -0.168316f, -0.168505f, -0.168694f, -0.168883f, -0.169072f, -0.169261f,
- -0.169450f, -0.169639f, -0.169828f, -0.170017f, -0.170206f, -0.170395f, -0.170584f, -0.170773f,
- -0.170962f, -0.171151f, -0.171340f, -0.171529f, -0.171718f, -0.171906f, -0.172095f, -0.172284f,
- -0.172473f, -0.172662f, -0.172851f, -0.173040f, -0.173229f, -0.173417f, -0.173606f, -0.173795f,
- -0.173984f, -0.174173f, -0.174362f, -0.174550f, -0.174739f, -0.174928f, -0.175117f, -0.175305f,
- -0.175494f, -0.175683f, -0.175872f, -0.176061f, -0.176249f, -0.176438f, -0.176627f, -0.176815f,
- -0.177004f, -0.177193f, -0.177382f, -0.177570f, -0.177759f, -0.177948f, -0.178136f, -0.178325f,
- -0.178514f, -0.178702f, -0.178891f, -0.179080f, -0.179268f, -0.179457f, -0.179646f, -0.179834f,
- -0.180023f, -0.180212f, -0.180400f, -0.180589f, -0.180777f, -0.180966f, -0.181154f, -0.181343f,
- -0.181532f, -0.181720f, -0.181909f, -0.182097f, -0.182286f, -0.182474f, -0.182663f, -0.182851f,
- -0.183040f, -0.183228f, -0.183417f, -0.183605f, -0.183794f, -0.183982f, -0.184171f, -0.184359f,
- -0.184548f, -0.184736f, -0.184925f, -0.185113f, -0.185301f, -0.185490f, -0.185678f, -0.185867f,
- -0.186055f, -0.186244f, -0.186432f, -0.186620f, -0.186809f, -0.186997f, -0.187185f, -0.187374f,
- -0.187562f, -0.187750f, -0.187939f, -0.188127f, -0.188315f, -0.188504f, -0.188692f, -0.188880f,
- -0.189069f, -0.189257f, -0.189445f, -0.189634f, -0.189822f, -0.190010f, -0.190198f, -0.190387f,
- -0.190575f, -0.190763f, -0.190951f, -0.191139f, -0.191328f, -0.191516f, -0.191704f, -0.191892f,
- -0.192080f, -0.192269f, -0.192457f, -0.192645f, -0.192833f, -0.193021f, -0.193209f, -0.193397f,
- -0.193586f, -0.193774f, -0.193962f, -0.194150f, -0.194338f, -0.194526f, -0.194714f, -0.194902f,
- -0.195090f, -0.195278f, -0.195466f, -0.195654f, -0.195843f, -0.196031f, -0.196219f, -0.196407f,
- -0.196595f, -0.196783f, -0.196971f, -0.197159f, -0.197347f, -0.197535f, -0.197722f, -0.197910f,
- -0.198098f, -0.198286f, -0.198474f, -0.198662f, -0.198850f, -0.199038f, -0.199226f, -0.199414f,
- -0.199602f, -0.199790f, -0.199978f, -0.200165f, -0.200353f, -0.200541f, -0.200729f, -0.200917f,
- -0.201105f, -0.201292f, -0.201480f, -0.201668f, -0.201856f, -0.202044f, -0.202231f, -0.202419f,
- -0.202607f, -0.202795f, -0.202983f, -0.203170f, -0.203358f, -0.203546f, -0.203734f, -0.203921f,
- -0.204109f, -0.204297f, -0.204484f, -0.204672f, -0.204860f, -0.205047f, -0.205235f, -0.205423f,
- -0.205610f, -0.205798f, -0.205986f, -0.206173f, -0.206361f, -0.206549f, -0.206736f, -0.206924f,
- -0.207111f, -0.207299f, -0.207487f, -0.207674f, -0.207862f, -0.208049f, -0.208237f, -0.208424f,
- -0.208612f, -0.208799f, -0.208987f, -0.209174f, -0.209362f, -0.209549f, -0.209737f, -0.209924f,
- -0.210112f, -0.210299f, -0.210487f, -0.210674f, -0.210862f, -0.211049f, -0.211237f, -0.211424f,
- -0.211611f, -0.211799f, -0.211986f, -0.212174f, -0.212361f, -0.212548f, -0.212736f, -0.212923f,
- -0.213110f, -0.213298f, -0.213485f, -0.213672f, -0.213860f, -0.214047f, -0.214234f, -0.214422f,
- -0.214609f, -0.214796f, -0.214983f, -0.215171f, -0.215358f, -0.215545f, -0.215732f, -0.215920f,
- -0.216107f, -0.216294f, -0.216481f, -0.216668f, -0.216856f, -0.217043f, -0.217230f, -0.217417f,
- -0.217604f, -0.217791f, -0.217979f, -0.218166f, -0.218353f, -0.218540f, -0.218727f, -0.218914f,
- -0.219101f, -0.219288f, -0.219475f, -0.219662f, -0.219850f, -0.220037f, -0.220224f, -0.220411f,
- -0.220598f, -0.220785f, -0.220972f, -0.221159f, -0.221346f, -0.221533f, -0.221720f, -0.221907f,
- -0.222094f, -0.222281f, -0.222468f, -0.222654f, -0.222841f, -0.223028f, -0.223215f, -0.223402f,
- -0.223589f, -0.223776f, -0.223963f, -0.224150f, -0.224337f, -0.224523f, -0.224710f, -0.224897f,
- -0.225084f, -0.225271f, -0.225458f, -0.225644f, -0.225831f, -0.226018f, -0.226205f, -0.226391f,
- -0.226578f, -0.226765f, -0.226952f, -0.227139f, -0.227325f, -0.227512f, -0.227699f, -0.227885f,
- -0.228072f, -0.228259f, -0.228445f, -0.228632f, -0.228819f, -0.229005f, -0.229192f, -0.229379f,
- -0.229565f, -0.229752f, -0.229939f, -0.230125f, -0.230312f, -0.230498f, -0.230685f, -0.230872f,
- -0.231058f, -0.231245f, -0.231431f, -0.231618f, -0.231804f, -0.231991f, -0.232177f, -0.232364f,
- -0.232550f, -0.232737f, -0.232923f, -0.233110f, -0.233296f, -0.233483f, -0.233669f, -0.233856f,
- -0.234042f, -0.234228f, -0.234415f, -0.234601f, -0.234788f, -0.234974f, -0.235160f, -0.235347f,
- -0.235533f, -0.235719f, -0.235906f, -0.236092f, -0.236278f, -0.236465f, -0.236651f, -0.236837f,
- -0.237024f, -0.237210f, -0.237396f, -0.237582f, -0.237769f, -0.237955f, -0.238141f, -0.238327f,
- -0.238514f, -0.238700f, -0.238886f, -0.239072f, -0.239258f, -0.239445f, -0.239631f, -0.239817f,
- -0.240003f, -0.240189f, -0.240375f, -0.240561f, -0.240748f, -0.240934f, -0.241120f, -0.241306f,
- -0.241492f, -0.241678f, -0.241864f, -0.242050f, -0.242236f, -0.242422f, -0.242608f, -0.242794f,
- -0.242980f, -0.243166f, -0.243352f, -0.243538f, -0.243724f, -0.243910f, -0.244096f, -0.244282f,
- -0.244468f, -0.244654f, -0.244840f, -0.245026f, -0.245212f, -0.245397f, -0.245583f, -0.245769f,
- -0.245955f, -0.246141f, -0.246327f, -0.246513f, -0.246698f, -0.246884f, -0.247070f, -0.247256f,
- -0.247442f, -0.247627f, -0.247813f, -0.247999f, -0.248185f, -0.248370f, -0.248556f, -0.248742f,
- -0.248928f, -0.249113f, -0.249299f, -0.249485f, -0.249670f, -0.249856f, -0.250042f, -0.250227f,
- -0.250413f, -0.250599f, -0.250784f, -0.250970f, -0.251155f, -0.251341f, -0.251527f, -0.251712f,
- -0.251898f, -0.252083f, -0.252269f, -0.252454f, -0.252640f, -0.252826f, -0.253011f, -0.253197f,
- -0.253382f, -0.253568f, -0.253753f, -0.253938f, -0.254124f, -0.254309f, -0.254495f, -0.254680f,
- -0.254866f, -0.255051f, -0.255236f, -0.255422f, -0.255607f, -0.255793f, -0.255978f, -0.256163f,
- -0.256349f, -0.256534f, -0.256719f, -0.256905f, -0.257090f, -0.257275f, -0.257461f, -0.257646f,
- -0.257831f, -0.258016f, -0.258202f, -0.258387f, -0.258572f, -0.258757f, -0.258943f, -0.259128f,
- -0.259313f, -0.259498f, -0.259683f, -0.259868f, -0.260054f, -0.260239f, -0.260424f, -0.260609f,
- -0.260794f, -0.260979f, -0.261164f, -0.261349f, -0.261534f, -0.261720f, -0.261905f, -0.262090f,
- -0.262275f, -0.262460f, -0.262645f, -0.262830f, -0.263015f, -0.263200f, -0.263385f, -0.263570f,
- -0.263755f, -0.263940f, -0.264125f, -0.264309f, -0.264494f, -0.264679f, -0.264864f, -0.265049f,
- -0.265234f, -0.265419f, -0.265604f, -0.265789f, -0.265973f, -0.266158f, -0.266343f, -0.266528f,
- -0.266713f, -0.266898f, -0.267082f, -0.267267f, -0.267452f, -0.267637f, -0.267821f, -0.268006f,
- -0.268191f, -0.268376f, -0.268560f, -0.268745f, -0.268930f, -0.269114f, -0.269299f, -0.269484f,
- -0.269668f, -0.269853f, -0.270038f, -0.270222f, -0.270407f, -0.270591f, -0.270776f, -0.270961f,
- -0.271145f, -0.271330f, -0.271514f, -0.271699f, -0.271883f, -0.272068f, -0.272252f, -0.272437f,
- -0.272621f, -0.272806f, -0.272990f, -0.273175f, -0.273359f, -0.273544f, -0.273728f, -0.273912f,
- -0.274097f, -0.274281f, -0.274466f, -0.274650f, -0.274834f, -0.275019f, -0.275203f, -0.275387f,
- -0.275572f, -0.275756f, -0.275940f, -0.276125f, -0.276309f, -0.276493f, -0.276678f, -0.276862f,
- -0.277046f, -0.277230f, -0.277415f, -0.277599f, -0.277783f, -0.277967f, -0.278151f, -0.278336f,
- -0.278520f, -0.278704f, -0.278888f, -0.279072f, -0.279256f, -0.279440f, -0.279624f, -0.279809f,
- -0.279993f, -0.280177f, -0.280361f, -0.280545f, -0.280729f, -0.280913f, -0.281097f, -0.281281f,
- -0.281465f, -0.281649f, -0.281833f, -0.282017f, -0.282201f, -0.282385f, -0.282569f, -0.282753f,
- -0.282937f, -0.283120f, -0.283304f, -0.283488f, -0.283672f, -0.283856f, -0.284040f, -0.284224f,
- -0.284408f, -0.284591f, -0.284775f, -0.284959f, -0.285143f, -0.285327f, -0.285510f, -0.285694f,
- -0.285878f, -0.286062f, -0.286245f, -0.286429f, -0.286613f, -0.286796f, -0.286980f, -0.287164f,
- -0.287347f, -0.287531f, -0.287715f, -0.287898f, -0.288082f, -0.288266f, -0.288449f, -0.288633f,
- -0.288816f, -0.289000f, -0.289184f, -0.289367f, -0.289551f, -0.289734f, -0.289918f, -0.290101f,
- -0.290285f, -0.290468f, -0.290652f, -0.290835f, -0.291019f, -0.291202f, -0.291385f, -0.291569f,
- -0.291752f, -0.291936f, -0.292119f, -0.292302f, -0.292486f, -0.292669f, -0.292852f, -0.293036f,
- -0.293219f, -0.293402f, -0.293586f, -0.293769f, -0.293952f, -0.294136f, -0.294319f, -0.294502f,
- -0.294685f, -0.294869f, -0.295052f, -0.295235f, -0.295418f, -0.295601f, -0.295785f, -0.295968f,
- -0.296151f, -0.296334f, -0.296517f, -0.296700f, -0.296883f, -0.297066f, -0.297250f, -0.297433f,
- -0.297616f, -0.297799f, -0.297982f, -0.298165f, -0.298348f, -0.298531f, -0.298714f, -0.298897f,
- -0.299080f, -0.299263f, -0.299446f, -0.299629f, -0.299812f, -0.299995f, -0.300177f, -0.300360f,
- -0.300543f, -0.300726f, -0.300909f, -0.301092f, -0.301275f, -0.301458f, -0.301640f, -0.301823f,
- -0.302006f, -0.302189f, -0.302372f, -0.302554f, -0.302737f, -0.302920f, -0.303103f, -0.303285f,
- -0.303468f, -0.303651f, -0.303833f, -0.304016f, -0.304199f, -0.304381f, -0.304564f, -0.304747f,
- -0.304929f, -0.305112f, -0.305294f, -0.305477f, -0.305660f, -0.305842f, -0.306025f, -0.306207f,
- -0.306390f, -0.306572f, -0.306755f, -0.306937f, -0.307120f, -0.307302f, -0.307485f, -0.307667f,
- -0.307850f, -0.308032f, -0.308214f, -0.308397f, -0.308579f, -0.308762f, -0.308944f, -0.309126f,
- -0.309309f, -0.309491f, -0.309673f, -0.309856f, -0.310038f, -0.310220f, -0.310403f, -0.310585f,
- -0.310767f, -0.310949f, -0.311132f, -0.311314f, -0.311496f, -0.311678f, -0.311860f, -0.312043f,
- -0.312225f, -0.312407f, -0.312589f, -0.312771f, -0.312953f, -0.313135f, -0.313318f, -0.313500f,
- -0.313682f, -0.313864f, -0.314046f, -0.314228f, -0.314410f, -0.314592f, -0.314774f, -0.314956f,
- -0.315138f, -0.315320f, -0.315502f, -0.315684f, -0.315866f, -0.316048f, -0.316230f, -0.316411f,
- -0.316593f, -0.316775f, -0.316957f, -0.317139f, -0.317321f, -0.317503f, -0.317684f, -0.317866f,
- -0.318048f, -0.318230f, -0.318412f, -0.318593f, -0.318775f, -0.318957f, -0.319139f, -0.319320f,
- -0.319502f, -0.319684f, -0.319865f, -0.320047f, -0.320229f, -0.320410f, -0.320592f, -0.320774f,
- -0.320955f, -0.321137f, -0.321318f, -0.321500f, -0.321682f, -0.321863f, -0.322045f, -0.322226f,
- -0.322408f, -0.322589f, -0.322771f, -0.322952f, -0.323134f, -0.323315f, -0.323497f, -0.323678f,
- -0.323859f, -0.324041f, -0.324222f, -0.324404f, -0.324585f, -0.324766f, -0.324948f, -0.325129f,
- -0.325310f, -0.325492f, -0.325673f, -0.325854f, -0.326035f, -0.326217f, -0.326398f, -0.326579f,
- -0.326760f, -0.326942f, -0.327123f, -0.327304f, -0.327485f, -0.327666f, -0.327848f, -0.328029f,
- -0.328210f, -0.328391f, -0.328572f, -0.328753f, -0.328934f, -0.329115f, -0.329296f, -0.329477f,
- -0.329658f, -0.329839f, -0.330020f, -0.330202f, -0.330382f, -0.330563f, -0.330744f, -0.330925f,
- -0.331106f, -0.331287f, -0.331468f, -0.331649f, -0.331830f, -0.332011f, -0.332192f, -0.332373f,
- -0.332553f, -0.332734f, -0.332915f, -0.333096f, -0.333277f, -0.333457f, -0.333638f, -0.333819f,
- -0.334000f, -0.334180f, -0.334361f, -0.334542f, -0.334722f, -0.334903f, -0.335084f, -0.335265f,
- -0.335445f, -0.335626f, -0.335806f, -0.335987f, -0.336168f, -0.336348f, -0.336529f, -0.336709f,
- -0.336890f, -0.337070f, -0.337251f, -0.337431f, -0.337612f, -0.337792f, -0.337973f, -0.338153f,
- -0.338334f, -0.338514f, -0.338695f, -0.338875f, -0.339055f, -0.339236f, -0.339416f, -0.339597f,
- -0.339777f, -0.339957f, -0.340138f, -0.340318f, -0.340498f, -0.340678f, -0.340859f, -0.341039f,
- -0.341219f, -0.341399f, -0.341580f, -0.341760f, -0.341940f, -0.342120f, -0.342300f, -0.342481f,
- -0.342661f, -0.342841f, -0.343021f, -0.343201f, -0.343381f, -0.343561f, -0.343741f, -0.343921f,
- -0.344101f, -0.344281f, -0.344461f, -0.344641f, -0.344821f, -0.345001f, -0.345181f, -0.345361f,
- -0.345541f, -0.345721f, -0.345901f, -0.346081f, -0.346261f, -0.346441f, -0.346621f, -0.346801f,
- -0.346980f, -0.347160f, -0.347340f, -0.347520f, -0.347700f, -0.347879f, -0.348059f, -0.348239f,
- -0.348419f, -0.348598f, -0.348778f, -0.348958f, -0.349138f, -0.349317f, -0.349497f, -0.349676f,
- -0.349856f, -0.350036f, -0.350215f, -0.350395f, -0.350575f, -0.350754f, -0.350934f, -0.351113f,
- -0.351293f, -0.351472f, -0.351652f, -0.351831f, -0.352011f, -0.352190f, -0.352370f, -0.352549f,
- -0.352729f, -0.352908f, -0.353087f, -0.353267f, -0.353446f, -0.353626f, -0.353805f, -0.353984f,
- -0.354164f, -0.354343f, -0.354522f, -0.354701f, -0.354881f, -0.355060f, -0.355239f, -0.355418f,
- -0.355598f, -0.355777f, -0.355956f, -0.356135f, -0.356314f, -0.356494f, -0.356673f, -0.356852f,
- -0.357031f, -0.357210f, -0.357389f, -0.357568f, -0.357747f, -0.357926f, -0.358105f, -0.358284f,
- -0.358463f, -0.358642f, -0.358821f, -0.359000f, -0.359179f, -0.359358f, -0.359537f, -0.359716f,
- -0.359895f, -0.360074f, -0.360253f, -0.360432f, -0.360611f, -0.360789f, -0.360968f, -0.361147f,
- -0.361326f, -0.361505f, -0.361683f, -0.361862f, -0.362041f, -0.362220f, -0.362398f, -0.362577f,
- -0.362756f, -0.362934f, -0.363113f, -0.363292f, -0.363470f, -0.363649f, -0.363828f, -0.364006f,
- -0.364185f, -0.364363f, -0.364542f, -0.364720f, -0.364899f, -0.365078f, -0.365256f, -0.365435f,
- -0.365613f, -0.365791f, -0.365970f, -0.366148f, -0.366327f, -0.366505f, -0.366684f, -0.366862f,
- -0.367040f, -0.367219f, -0.367397f, -0.367575f, -0.367754f, -0.367932f, -0.368110f, -0.368289f,
- -0.368467f, -0.368645f, -0.368823f, -0.369002f, -0.369180f, -0.369358f, -0.369536f, -0.369714f,
- -0.369892f, -0.370071f, -0.370249f, -0.370427f, -0.370605f, -0.370783f, -0.370961f, -0.371139f,
- -0.371317f, -0.371495f, -0.371673f, -0.371851f, -0.372029f, -0.372207f, -0.372385f, -0.372563f,
- -0.372741f, -0.372919f, -0.373097f, -0.373275f, -0.373453f, -0.373631f, -0.373808f, -0.373986f,
- -0.374164f, -0.374342f, -0.374520f, -0.374697f, -0.374875f, -0.375053f, -0.375231f, -0.375408f,
- -0.375586f, -0.375764f, -0.375942f, -0.376119f, -0.376297f, -0.376475f, -0.376652f, -0.376830f,
- -0.377007f, -0.377185f, -0.377363f, -0.377540f, -0.377718f, -0.377895f, -0.378073f, -0.378250f,
- -0.378428f, -0.378605f, -0.378783f, -0.378960f, -0.379138f, -0.379315f, -0.379492f, -0.379670f,
- -0.379847f, -0.380025f, -0.380202f, -0.380379f, -0.380557f, -0.380734f, -0.380911f, -0.381088f,
- -0.381266f, -0.381443f, -0.381620f, -0.381797f, -0.381975f, -0.382152f, -0.382329f, -0.382506f,
- -0.382683f, -0.382861f, -0.383038f, -0.383215f, -0.383392f, -0.383569f, -0.383746f, -0.383923f,
- -0.384100f, -0.384277f, -0.384454f, -0.384631f, -0.384808f, -0.384985f, -0.385162f, -0.385339f,
- -0.385516f, -0.385693f, -0.385870f, -0.386047f, -0.386224f, -0.386400f, -0.386577f, -0.386754f,
- -0.386931f, -0.387108f, -0.387285f, -0.387461f, -0.387638f, -0.387815f, -0.387992f, -0.388168f,
- -0.388345f, -0.388522f, -0.388698f, -0.388875f, -0.389052f, -0.389228f, -0.389405f, -0.389582f,
- -0.389758f, -0.389935f, -0.390111f, -0.390288f, -0.390464f, -0.390641f, -0.390817f, -0.390994f,
- -0.391170f, -0.391347f, -0.391523f, -0.391700f, -0.391876f, -0.392053f, -0.392229f, -0.392405f,
- -0.392582f, -0.392758f, -0.392934f, -0.393111f, -0.393287f, -0.393463f, -0.393640f, -0.393816f,
- -0.393992f, -0.394168f, -0.394344f, -0.394521f, -0.394697f, -0.394873f, -0.395049f, -0.395225f,
- -0.395401f, -0.395578f, -0.395754f, -0.395930f, -0.396106f, -0.396282f, -0.396458f, -0.396634f,
- -0.396810f, -0.396986f, -0.397162f, -0.397338f, -0.397514f, -0.397690f, -0.397866f, -0.398042f,
- -0.398218f, -0.398393f, -0.398569f, -0.398745f, -0.398921f, -0.399097f, -0.399273f, -0.399448f,
- -0.399624f, -0.399800f, -0.399976f, -0.400151f, -0.400327f, -0.400503f, -0.400679f, -0.400854f,
- -0.401030f, -0.401206f, -0.401381f, -0.401557f, -0.401732f, -0.401908f, -0.402084f, -0.402259f,
- -0.402435f, -0.402610f, -0.402786f, -0.402961f, -0.403137f, -0.403312f, -0.403488f, -0.403663f,
- -0.403838f, -0.404014f, -0.404189f, -0.404365f, -0.404540f, -0.404715f, -0.404891f, -0.405066f,
- -0.405241f, -0.405417f, -0.405592f, -0.405767f, -0.405942f, -0.406118f, -0.406293f, -0.406468f,
- -0.406643f, -0.406818f, -0.406994f, -0.407169f, -0.407344f, -0.407519f, -0.407694f, -0.407869f,
- -0.408044f, -0.408219f, -0.408394f, -0.408569f, -0.408744f, -0.408919f, -0.409094f, -0.409269f,
- -0.409444f, -0.409619f, -0.409794f, -0.409969f, -0.410144f, -0.410319f, -0.410493f, -0.410668f,
- -0.410843f, -0.411018f, -0.411193f, -0.411368f, -0.411542f, -0.411717f, -0.411892f, -0.412067f,
- -0.412241f, -0.412416f, -0.412591f, -0.412765f, -0.412940f, -0.413115f, -0.413289f, -0.413464f,
- -0.413638f, -0.413813f, -0.413987f, -0.414162f, -0.414337f, -0.414511f, -0.414685f, -0.414860f,
- -0.415034f, -0.415209f, -0.415383f, -0.415558f, -0.415732f, -0.415906f, -0.416081f, -0.416255f,
- -0.416430f, -0.416604f, -0.416778f, -0.416952f, -0.417127f, -0.417301f, -0.417475f, -0.417650f,
- -0.417824f, -0.417998f, -0.418172f, -0.418346f, -0.418520f, -0.418695f, -0.418869f, -0.419043f,
- -0.419217f, -0.419391f, -0.419565f, -0.419739f, -0.419913f, -0.420087f, -0.420261f, -0.420435f,
- -0.420609f, -0.420783f, -0.420957f, -0.421131f, -0.421305f, -0.421479f, -0.421653f, -0.421826f,
- -0.422000f, -0.422174f, -0.422348f, -0.422522f, -0.422695f, -0.422869f, -0.423043f, -0.423217f,
- -0.423390f, -0.423564f, -0.423738f, -0.423912f, -0.424085f, -0.424259f, -0.424432f, -0.424606f,
- -0.424780f, -0.424953f, -0.425127f, -0.425300f, -0.425474f, -0.425647f, -0.425821f, -0.425994f,
- -0.426168f, -0.426341f, -0.426515f, -0.426688f, -0.426862f, -0.427035f, -0.427208f, -0.427382f,
- -0.427555f, -0.427728f, -0.427902f, -0.428075f, -0.428248f, -0.428422f, -0.428595f, -0.428768f,
- -0.428941f, -0.429114f, -0.429288f, -0.429461f, -0.429634f, -0.429807f, -0.429980f, -0.430153f,
- -0.430326f, -0.430500f, -0.430673f, -0.430846f, -0.431019f, -0.431192f, -0.431365f, -0.431538f,
- -0.431711f, -0.431884f, -0.432057f, -0.432229f, -0.432402f, -0.432575f, -0.432748f, -0.432921f,
- -0.433094f, -0.433267f, -0.433439f, -0.433612f, -0.433785f, -0.433958f, -0.434131f, -0.434303f,
- -0.434476f, -0.434649f, -0.434821f, -0.434994f, -0.435167f, -0.435339f, -0.435512f, -0.435685f,
- -0.435857f, -0.436030f, -0.436202f, -0.436375f, -0.436547f, -0.436720f, -0.436892f, -0.437065f,
- -0.437237f, -0.437410f, -0.437582f, -0.437754f, -0.437927f, -0.438099f, -0.438272f, -0.438444f,
- -0.438616f, -0.438789f, -0.438961f, -0.439133f, -0.439305f, -0.439478f, -0.439650f, -0.439822f,
- -0.439994f, -0.440166f, -0.440339f, -0.440511f, -0.440683f, -0.440855f, -0.441027f, -0.441199f,
- -0.441371f, -0.441543f, -0.441715f, -0.441887f, -0.442059f, -0.442231f, -0.442403f, -0.442575f,
- -0.442747f, -0.442919f, -0.443091f, -0.443263f, -0.443435f, -0.443607f, -0.443779f, -0.443950f,
- -0.444122f, -0.444294f, -0.444466f, -0.444637f, -0.444809f, -0.444981f, -0.445153f, -0.445324f,
- -0.445496f, -0.445668f, -0.445839f, -0.446011f, -0.446183f, -0.446354f, -0.446526f, -0.446697f,
- -0.446869f, -0.447040f, -0.447212f, -0.447383f, -0.447555f, -0.447726f, -0.447898f, -0.448069f,
- -0.448241f, -0.448412f, -0.448583f, -0.448755f, -0.448926f, -0.449097f, -0.449269f, -0.449440f,
- -0.449611f, -0.449783f, -0.449954f, -0.450125f, -0.450296f, -0.450467f, -0.450639f, -0.450810f,
- -0.450981f, -0.451152f, -0.451323f, -0.451494f, -0.451665f, -0.451836f, -0.452008f, -0.452179f,
- -0.452350f, -0.452521f, -0.452692f, -0.452863f, -0.453033f, -0.453204f, -0.453375f, -0.453546f,
- -0.453717f, -0.453888f, -0.454059f, -0.454230f, -0.454400f, -0.454571f, -0.454742f, -0.454913f,
- -0.455084f, -0.455254f, -0.455425f, -0.455596f, -0.455766f, -0.455937f, -0.456108f, -0.456278f,
- -0.456449f, -0.456620f, -0.456790f, -0.456961f, -0.457131f, -0.457302f, -0.457472f, -0.457643f,
- -0.457813f, -0.457984f, -0.458154f, -0.458325f, -0.458495f, -0.458665f, -0.458836f, -0.459006f,
- -0.459177f, -0.459347f, -0.459517f, -0.459687f, -0.459858f, -0.460028f, -0.460198f, -0.460369f,
- -0.460539f, -0.460709f, -0.460879f, -0.461049f, -0.461219f, -0.461390f, -0.461560f, -0.461730f,
- -0.461900f, -0.462070f, -0.462240f, -0.462410f, -0.462580f, -0.462750f, -0.462920f, -0.463090f,
- -0.463260f, -0.463430f, -0.463600f, -0.463769f, -0.463939f, -0.464109f, -0.464279f, -0.464449f,
- -0.464619f, -0.464788f, -0.464958f, -0.465128f, -0.465298f, -0.465467f, -0.465637f, -0.465807f,
- -0.465977f, -0.466146f, -0.466316f, -0.466485f, -0.466655f, -0.466825f, -0.466994f, -0.467164f,
- -0.467333f, -0.467503f, -0.467672f, -0.467842f, -0.468011f, -0.468181f, -0.468350f, -0.468519f,
- -0.468689f, -0.468858f, -0.469028f, -0.469197f, -0.469366f, -0.469536f, -0.469705f, -0.469874f,
- -0.470043f, -0.470213f, -0.470382f, -0.470551f, -0.470720f, -0.470889f, -0.471058f, -0.471228f,
- -0.471397f, -0.471566f, -0.471735f, -0.471904f, -0.472073f, -0.472242f, -0.472411f, -0.472580f,
- -0.472749f, -0.472918f, -0.473087f, -0.473256f, -0.473425f, -0.473594f, -0.473763f, -0.473931f,
- -0.474100f, -0.474269f, -0.474438f, -0.474607f, -0.474775f, -0.474944f, -0.475113f, -0.475282f,
- -0.475450f, -0.475619f, -0.475788f, -0.475956f, -0.476125f, -0.476294f, -0.476462f, -0.476631f,
- -0.476799f, -0.476968f, -0.477136f, -0.477305f, -0.477473f, -0.477642f, -0.477810f, -0.477979f,
- -0.478147f, -0.478315f, -0.478484f, -0.478652f, -0.478821f, -0.478989f, -0.479157f, -0.479325f,
- -0.479494f, -0.479662f, -0.479830f, -0.479998f, -0.480167f, -0.480335f, -0.480503f, -0.480671f,
- -0.480839f, -0.481007f, -0.481176f, -0.481344f, -0.481512f, -0.481680f, -0.481848f, -0.482016f,
- -0.482184f, -0.482352f, -0.482520f, -0.482688f, -0.482856f, -0.483023f, -0.483191f, -0.483359f,
- -0.483527f, -0.483695f, -0.483863f, -0.484031f, -0.484198f, -0.484366f, -0.484534f, -0.484702f,
- -0.484869f, -0.485037f, -0.485205f, -0.485372f, -0.485540f, -0.485708f, -0.485875f, -0.486043f,
- -0.486210f, -0.486378f, -0.486545f, -0.486713f, -0.486880f, -0.487048f, -0.487215f, -0.487383f,
- -0.487550f, -0.487718f, -0.487885f, -0.488052f, -0.488220f, -0.488387f, -0.488554f, -0.488722f,
- -0.488889f, -0.489056f, -0.489223f, -0.489391f, -0.489558f, -0.489725f, -0.489892f, -0.490059f,
- -0.490226f, -0.490394f, -0.490561f, -0.490728f, -0.490895f, -0.491062f, -0.491229f, -0.491396f,
- -0.491563f, -0.491730f, -0.491897f, -0.492064f, -0.492231f, -0.492398f, -0.492564f, -0.492731f,
- -0.492898f, -0.493065f, -0.493232f, -0.493399f, -0.493565f, -0.493732f, -0.493899f, -0.494066f,
- -0.494232f, -0.494399f, -0.494566f, -0.494732f, -0.494899f, -0.495066f, -0.495232f, -0.495399f,
- -0.495565f, -0.495732f, -0.495898f, -0.496065f, -0.496231f, -0.496398f, -0.496564f, -0.496731f,
- -0.496897f, -0.497063f, -0.497230f, -0.497396f, -0.497562f, -0.497729f, -0.497895f, -0.498061f,
- -0.498228f, -0.498394f, -0.498560f, -0.498726f, -0.498893f, -0.499059f, -0.499225f, -0.499391f,
- -0.499557f, -0.499723f, -0.499889f, -0.500055f, -0.500221f, -0.500387f, -0.500553f, -0.500719f,
- -0.500885f, -0.501051f, -0.501217f, -0.501383f, -0.501549f, -0.501715f, -0.501881f, -0.502047f,
- -0.502212f, -0.502378f, -0.502544f, -0.502710f, -0.502876f, -0.503041f, -0.503207f, -0.503373f,
- -0.503538f, -0.503704f, -0.503870f, -0.504035f, -0.504201f, -0.504366f, -0.504532f, -0.504698f,
- -0.504863f, -0.505029f, -0.505194f, -0.505360f, -0.505525f, -0.505690f, -0.505856f, -0.506021f,
- -0.506187f, -0.506352f, -0.506517f, -0.506683f, -0.506848f, -0.507013f, -0.507179f, -0.507344f,
- -0.507509f, -0.507674f, -0.507839f, -0.508005f, -0.508170f, -0.508335f, -0.508500f, -0.508665f,
- -0.508830f, -0.508995f, -0.509160f, -0.509325f, -0.509490f, -0.509655f, -0.509820f, -0.509985f,
- -0.510150f, -0.510315f, -0.510480f, -0.510645f, -0.510810f, -0.510974f, -0.511139f, -0.511304f,
- -0.511469f, -0.511634f, -0.511798f, -0.511963f, -0.512128f, -0.512292f, -0.512457f, -0.512622f,
- -0.512786f, -0.512951f, -0.513116f, -0.513280f, -0.513445f, -0.513609f, -0.513774f, -0.513938f,
- -0.514103f, -0.514267f, -0.514432f, -0.514596f, -0.514760f, -0.514925f, -0.515089f, -0.515254f,
- -0.515418f, -0.515582f, -0.515746f, -0.515911f, -0.516075f, -0.516239f, -0.516403f, -0.516568f,
- -0.516732f, -0.516896f, -0.517060f, -0.517224f, -0.517388f, -0.517552f, -0.517716f, -0.517880f,
- -0.518045f, -0.518209f, -0.518372f, -0.518536f, -0.518700f, -0.518864f, -0.519028f, -0.519192f,
- -0.519356f, -0.519520f, -0.519684f, -0.519848f, -0.520011f, -0.520175f, -0.520339f, -0.520503f,
- -0.520666f, -0.520830f, -0.520994f, -0.521157f, -0.521321f, -0.521485f, -0.521648f, -0.521812f,
- -0.521975f, -0.522139f, -0.522302f, -0.522466f, -0.522629f, -0.522793f, -0.522956f, -0.523120f,
- -0.523283f, -0.523447f, -0.523610f, -0.523773f, -0.523937f, -0.524100f, -0.524263f, -0.524426f,
- -0.524590f, -0.524753f, -0.524916f, -0.525079f, -0.525243f, -0.525406f, -0.525569f, -0.525732f,
- -0.525895f, -0.526058f, -0.526221f, -0.526384f, -0.526547f, -0.526710f, -0.526873f, -0.527036f,
- -0.527199f, -0.527362f, -0.527525f, -0.527688f, -0.527851f, -0.528014f, -0.528176f, -0.528339f,
- -0.528502f, -0.528665f, -0.528828f, -0.528990f, -0.529153f, -0.529316f, -0.529478f, -0.529641f,
- -0.529804f, -0.529966f, -0.530129f, -0.530291f, -0.530454f, -0.530617f, -0.530779f, -0.530942f,
- -0.531104f, -0.531266f, -0.531429f, -0.531591f, -0.531754f, -0.531916f, -0.532078f, -0.532241f,
- -0.532403f, -0.532565f, -0.532728f, -0.532890f, -0.533052f, -0.533214f, -0.533377f, -0.533539f,
- -0.533701f, -0.533863f, -0.534025f, -0.534187f, -0.534349f, -0.534512f, -0.534674f, -0.534836f,
- -0.534998f, -0.535160f, -0.535322f, -0.535484f, -0.535645f, -0.535807f, -0.535969f, -0.536131f,
- -0.536293f, -0.536455f, -0.536617f, -0.536778f, -0.536940f, -0.537102f, -0.537264f, -0.537425f,
- -0.537587f, -0.537749f, -0.537910f, -0.538072f, -0.538234f, -0.538395f, -0.538557f, -0.538718f,
- -0.538880f, -0.539041f, -0.539203f, -0.539364f, -0.539526f, -0.539687f, -0.539849f, -0.540010f,
- -0.540171f, -0.540333f, -0.540494f, -0.540655f, -0.540817f, -0.540978f, -0.541139f, -0.541301f,
- -0.541462f, -0.541623f, -0.541784f, -0.541945f, -0.542106f, -0.542268f, -0.542429f, -0.542590f,
- -0.542751f, -0.542912f, -0.543073f, -0.543234f, -0.543395f, -0.543556f, -0.543717f, -0.543878f,
- -0.544039f, -0.544199f, -0.544360f, -0.544521f, -0.544682f, -0.544843f, -0.545003f, -0.545164f,
- -0.545325f, -0.545486f, -0.545646f, -0.545807f, -0.545968f, -0.546128f, -0.546289f, -0.546450f,
- -0.546610f, -0.546771f, -0.546931f, -0.547092f, -0.547252f, -0.547413f, -0.547573f, -0.547734f,
- -0.547894f, -0.548054f, -0.548215f, -0.548375f, -0.548536f, -0.548696f, -0.548856f, -0.549016f,
- -0.549177f, -0.549337f, -0.549497f, -0.549657f, -0.549818f, -0.549978f, -0.550138f, -0.550298f,
- -0.550458f, -0.550618f, -0.550778f, -0.550938f, -0.551098f, -0.551258f, -0.551418f, -0.551578f,
- -0.551738f, -0.551898f, -0.552058f, -0.552218f, -0.552378f, -0.552537f, -0.552697f, -0.552857f,
- -0.553017f, -0.553176f, -0.553336f, -0.553496f, -0.553656f, -0.553815f, -0.553975f, -0.554134f,
- -0.554294f, -0.554454f, -0.554613f, -0.554773f, -0.554932f, -0.555092f, -0.555251f, -0.555411f,
- -0.555570f, -0.555730f, -0.555889f, -0.556048f, -0.556208f, -0.556367f, -0.556526f, -0.556686f,
- -0.556845f, -0.557004f, -0.557164f, -0.557323f, -0.557482f, -0.557641f, -0.557800f, -0.557959f,
- -0.558119f, -0.558278f, -0.558437f, -0.558596f, -0.558755f, -0.558914f, -0.559073f, -0.559232f,
- -0.559391f, -0.559550f, -0.559709f, -0.559867f, -0.560026f, -0.560185f, -0.560344f, -0.560503f,
- -0.560662f, -0.560820f, -0.560979f, -0.561138f, -0.561297f, -0.561455f, -0.561614f, -0.561773f,
- -0.561931f, -0.562090f, -0.562248f, -0.562407f, -0.562565f, -0.562724f, -0.562882f, -0.563041f,
- -0.563199f, -0.563358f, -0.563516f, -0.563675f, -0.563833f, -0.563991f, -0.564150f, -0.564308f,
- -0.564466f, -0.564624f, -0.564783f, -0.564941f, -0.565099f, -0.565257f, -0.565416f, -0.565574f,
- -0.565732f, -0.565890f, -0.566048f, -0.566206f, -0.566364f, -0.566522f, -0.566680f, -0.566838f,
- -0.566996f, -0.567154f, -0.567312f, -0.567470f, -0.567628f, -0.567786f, -0.567943f, -0.568101f,
- -0.568259f, -0.568417f, -0.568574f, -0.568732f, -0.568890f, -0.569048f, -0.569205f, -0.569363f,
- -0.569521f, -0.569678f, -0.569836f, -0.569993f, -0.570151f, -0.570308f, -0.570466f, -0.570623f,
- -0.570781f, -0.570938f, -0.571096f, -0.571253f, -0.571410f, -0.571568f, -0.571725f, -0.571882f,
- -0.572040f, -0.572197f, -0.572354f, -0.572511f, -0.572669f, -0.572826f, -0.572983f, -0.573140f,
- -0.573297f, -0.573454f, -0.573611f, -0.573768f, -0.573925f, -0.574082f, -0.574239f, -0.574396f,
- -0.574553f, -0.574710f, -0.574867f, -0.575024f, -0.575181f, -0.575338f, -0.575495f, -0.575651f,
- -0.575808f, -0.575965f, -0.576122f, -0.576278f, -0.576435f, -0.576592f, -0.576748f, -0.576905f,
- -0.577062f, -0.577218f, -0.577375f, -0.577531f, -0.577688f, -0.577844f, -0.578001f, -0.578157f,
- -0.578314f, -0.578470f, -0.578627f, -0.578783f, -0.578939f, -0.579096f, -0.579252f, -0.579408f,
- -0.579565f, -0.579721f, -0.579877f, -0.580033f, -0.580189f, -0.580346f, -0.580502f, -0.580658f,
- -0.580814f, -0.580970f, -0.581126f, -0.581282f, -0.581438f, -0.581594f, -0.581750f, -0.581906f,
- -0.582062f, -0.582218f, -0.582374f, -0.582530f, -0.582685f, -0.582841f, -0.582997f, -0.583153f,
- -0.583309f, -0.583464f, -0.583620f, -0.583776f, -0.583931f, -0.584087f, -0.584243f, -0.584398f,
- -0.584554f, -0.584710f, -0.584865f, -0.585021f, -0.585176f, -0.585332f, -0.585487f, -0.585642f,
- -0.585798f, -0.585953f, -0.586109f, -0.586264f, -0.586419f, -0.586575f, -0.586730f, -0.586885f,
- -0.587040f, -0.587196f, -0.587351f, -0.587506f, -0.587661f, -0.587816f, -0.587971f, -0.588126f,
- -0.588282f, -0.588437f, -0.588592f, -0.588747f, -0.588902f, -0.589057f, -0.589212f, -0.589366f,
- -0.589521f, -0.589676f, -0.589831f, -0.589986f, -0.590141f, -0.590295f, -0.590450f, -0.590605f,
- -0.590760f, -0.590914f, -0.591069f, -0.591224f, -0.591378f, -0.591533f, -0.591688f, -0.591842f,
- -0.591997f, -0.592151f, -0.592306f, -0.592460f, -0.592615f, -0.592769f, -0.592924f, -0.593078f,
- -0.593232f, -0.593387f, -0.593541f, -0.593695f, -0.593850f, -0.594004f, -0.594158f, -0.594312f,
- -0.594467f, -0.594621f, -0.594775f, -0.594929f, -0.595083f, -0.595237f, -0.595391f, -0.595545f,
- -0.595699f, -0.595853f, -0.596007f, -0.596161f, -0.596315f, -0.596469f, -0.596623f, -0.596777f,
- -0.596931f, -0.597085f, -0.597238f, -0.597392f, -0.597546f, -0.597700f, -0.597853f, -0.598007f,
- -0.598161f, -0.598314f, -0.598468f, -0.598622f, -0.598775f, -0.598929f, -0.599082f, -0.599236f,
- -0.599389f, -0.599543f, -0.599696f, -0.599850f, -0.600003f, -0.600156f, -0.600310f, -0.600463f,
- -0.600616f, -0.600770f, -0.600923f, -0.601076f, -0.601230f, -0.601383f, -0.601536f, -0.601689f,
- -0.601842f, -0.601995f, -0.602148f, -0.602302f, -0.602455f, -0.602608f, -0.602761f, -0.602914f,
- -0.603067f, -0.603220f, -0.603372f, -0.603525f, -0.603678f, -0.603831f, -0.603984f, -0.604137f,
- -0.604290f, -0.604442f, -0.604595f, -0.604748f, -0.604900f, -0.605053f, -0.605206f, -0.605358f,
- -0.605511f, -0.605664f, -0.605816f, -0.605969f, -0.606121f, -0.606274f, -0.606426f, -0.606579f,
- -0.606731f, -0.606884f, -0.607036f, -0.607188f, -0.607341f, -0.607493f, -0.607645f, -0.607798f,
- -0.607950f, -0.608102f, -0.608254f, -0.608406f, -0.608559f, -0.608711f, -0.608863f, -0.609015f,
- -0.609167f, -0.609319f, -0.609471f, -0.609623f, -0.609775f, -0.609927f, -0.610079f, -0.610231f,
- -0.610383f, -0.610535f, -0.610687f, -0.610838f, -0.610990f, -0.611142f, -0.611294f, -0.611445f,
- -0.611597f, -0.611749f, -0.611901f, -0.612052f, -0.612204f, -0.612355f, -0.612507f, -0.612659f,
- -0.612810f, -0.612962f, -0.613113f, -0.613265f, -0.613416f, -0.613567f, -0.613719f, -0.613870f,
- -0.614022f, -0.614173f, -0.614324f, -0.614475f, -0.614627f, -0.614778f, -0.614929f, -0.615080f,
- -0.615232f, -0.615383f, -0.615534f, -0.615685f, -0.615836f, -0.615987f, -0.616138f, -0.616289f,
- -0.616440f, -0.616591f, -0.616742f, -0.616893f, -0.617044f, -0.617195f, -0.617346f, -0.617496f,
- -0.617647f, -0.617798f, -0.617949f, -0.618100f, -0.618250f, -0.618401f, -0.618552f, -0.618702f,
- -0.618853f, -0.619004f, -0.619154f, -0.619305f, -0.619455f, -0.619606f, -0.619756f, -0.619907f,
- -0.620057f, -0.620208f, -0.620358f, -0.620508f, -0.620659f, -0.620809f, -0.620959f, -0.621110f,
- -0.621260f, -0.621410f, -0.621560f, -0.621711f, -0.621861f, -0.622011f, -0.622161f, -0.622311f,
- -0.622461f, -0.622611f, -0.622761f, -0.622911f, -0.623061f, -0.623211f, -0.623361f, -0.623511f,
- -0.623661f, -0.623811f, -0.623961f, -0.624111f, -0.624260f, -0.624410f, -0.624560f, -0.624710f,
- -0.624860f, -0.625009f, -0.625159f, -0.625309f, -0.625458f, -0.625608f, -0.625757f, -0.625907f,
- -0.626056f, -0.626206f, -0.626355f, -0.626505f, -0.626654f, -0.626804f, -0.626953f, -0.627102f,
- -0.627252f, -0.627401f, -0.627550f, -0.627700f, -0.627849f, -0.627998f, -0.628147f, -0.628297f,
- -0.628446f, -0.628595f, -0.628744f, -0.628893f, -0.629042f, -0.629191f, -0.629340f, -0.629489f,
- -0.629638f, -0.629787f, -0.629936f, -0.630085f, -0.630234f, -0.630383f, -0.630532f, -0.630680f,
- -0.630829f, -0.630978f, -0.631127f, -0.631275f, -0.631424f, -0.631573f, -0.631721f, -0.631870f,
- -0.632019f, -0.632167f, -0.632316f, -0.632464f, -0.632613f, -0.632761f, -0.632910f, -0.633058f,
- -0.633207f, -0.633355f, -0.633504f, -0.633652f, -0.633800f, -0.633949f, -0.634097f, -0.634245f,
- -0.634393f, -0.634542f, -0.634690f, -0.634838f, -0.634986f, -0.635134f, -0.635282f, -0.635430f,
- -0.635578f, -0.635726f, -0.635874f, -0.636022f, -0.636170f, -0.636318f, -0.636466f, -0.636614f,
- -0.636762f, -0.636910f, -0.637057f, -0.637205f, -0.637353f, -0.637501f, -0.637649f, -0.637796f,
- -0.637944f, -0.638092f, -0.638239f, -0.638387f, -0.638534f, -0.638682f, -0.638829f, -0.638977f,
- -0.639124f, -0.639272f, -0.639419f, -0.639567f, -0.639714f, -0.639862f, -0.640009f, -0.640156f,
- -0.640303f, -0.640451f, -0.640598f, -0.640745f, -0.640892f, -0.641040f, -0.641187f, -0.641334f,
- -0.641481f, -0.641628f, -0.641775f, -0.641922f, -0.642069f, -0.642216f, -0.642363f, -0.642510f,
- -0.642657f, -0.642804f, -0.642951f, -0.643098f, -0.643245f, -0.643391f, -0.643538f, -0.643685f,
- -0.643832f, -0.643978f, -0.644125f, -0.644272f, -0.644418f, -0.644565f, -0.644711f, -0.644858f,
- -0.645005f, -0.645151f, -0.645298f, -0.645444f, -0.645590f, -0.645737f, -0.645883f, -0.646030f,
- -0.646176f, -0.646322f, -0.646469f, -0.646615f, -0.646761f, -0.646907f, -0.647054f, -0.647200f,
- -0.647346f, -0.647492f, -0.647638f, -0.647784f, -0.647930f, -0.648076f, -0.648222f, -0.648368f,
- -0.648514f, -0.648660f, -0.648806f, -0.648952f, -0.649098f, -0.649244f, -0.649390f, -0.649536f,
- -0.649681f, -0.649827f, -0.649973f, -0.650119f, -0.650264f, -0.650410f, -0.650555f, -0.650701f,
- -0.650847f, -0.650992f, -0.651138f, -0.651283f, -0.651429f, -0.651574f, -0.651720f, -0.651865f,
- -0.652011f, -0.652156f, -0.652301f, -0.652447f, -0.652592f, -0.652737f, -0.652882f, -0.653028f,
- -0.653173f, -0.653318f, -0.653463f, -0.653608f, -0.653753f, -0.653899f, -0.654044f, -0.654189f,
- -0.654334f, -0.654479f, -0.654624f, -0.654769f, -0.654913f, -0.655058f, -0.655203f, -0.655348f,
- -0.655493f, -0.655638f, -0.655782f, -0.655927f, -0.656072f, -0.656217f, -0.656361f, -0.656506f,
- -0.656651f, -0.656795f, -0.656940f, -0.657084f, -0.657229f, -0.657373f, -0.657518f, -0.657662f,
- -0.657807f, -0.657951f, -0.658095f, -0.658240f, -0.658384f, -0.658529f, -0.658673f, -0.658817f,
- -0.658961f, -0.659105f, -0.659250f, -0.659394f, -0.659538f, -0.659682f, -0.659826f, -0.659970f,
- -0.660114f, -0.660258f, -0.660402f, -0.660546f, -0.660690f, -0.660834f, -0.660978f, -0.661122f,
- -0.661266f, -0.661410f, -0.661553f, -0.661697f, -0.661841f, -0.661985f, -0.662128f, -0.662272f,
- -0.662416f, -0.662559f, -0.662703f, -0.662847f, -0.662990f, -0.663134f, -0.663277f, -0.663421f,
- -0.663564f, -0.663708f, -0.663851f, -0.663994f, -0.664138f, -0.664281f, -0.664424f, -0.664568f,
- -0.664711f, -0.664854f, -0.664997f, -0.665141f, -0.665284f, -0.665427f, -0.665570f, -0.665713f,
- -0.665856f, -0.665999f, -0.666142f, -0.666285f, -0.666428f, -0.666571f, -0.666714f, -0.666857f,
- -0.667000f, -0.667143f, -0.667286f, -0.667428f, -0.667571f, -0.667714f, -0.667857f, -0.667999f,
- -0.668142f, -0.668285f, -0.668427f, -0.668570f, -0.668712f, -0.668855f, -0.668998f, -0.669140f,
- -0.669283f, -0.669425f, -0.669567f, -0.669710f, -0.669852f, -0.669995f, -0.670137f, -0.670279f,
- -0.670422f, -0.670564f, -0.670706f, -0.670848f, -0.670990f, -0.671133f, -0.671275f, -0.671417f,
- -0.671559f, -0.671701f, -0.671843f, -0.671985f, -0.672127f, -0.672269f, -0.672411f, -0.672553f,
- -0.672695f, -0.672837f, -0.672978f, -0.673120f, -0.673262f, -0.673404f, -0.673546f, -0.673687f,
- -0.673829f, -0.673971f, -0.674112f, -0.674254f, -0.674396f, -0.674537f, -0.674679f, -0.674820f,
- -0.674962f, -0.675103f, -0.675245f, -0.675386f, -0.675527f, -0.675669f, -0.675810f, -0.675951f,
- -0.676093f, -0.676234f, -0.676375f, -0.676516f, -0.676658f, -0.676799f, -0.676940f, -0.677081f,
- -0.677222f, -0.677363f, -0.677504f, -0.677645f, -0.677786f, -0.677927f, -0.678068f, -0.678209f,
- -0.678350f, -0.678491f, -0.678632f, -0.678773f, -0.678913f, -0.679054f, -0.679195f, -0.679336f,
- -0.679476f, -0.679617f, -0.679758f, -0.679898f, -0.680039f, -0.680179f, -0.680320f, -0.680461f,
- -0.680601f, -0.680741f, -0.680882f, -0.681022f, -0.681163f, -0.681303f, -0.681443f, -0.681584f,
- -0.681724f, -0.681864f, -0.682005f, -0.682145f, -0.682285f, -0.682425f, -0.682565f, -0.682705f,
- -0.682846f, -0.682986f, -0.683126f, -0.683266f, -0.683406f, -0.683546f, -0.683686f, -0.683825f,
- -0.683965f, -0.684105f, -0.684245f, -0.684385f, -0.684525f, -0.684664f, -0.684804f, -0.684944f,
- -0.685084f, -0.685223f, -0.685363f, -0.685503f, -0.685642f, -0.685782f, -0.685921f, -0.686061f,
- -0.686200f, -0.686340f, -0.686479f, -0.686619f, -0.686758f, -0.686897f, -0.687037f, -0.687176f,
- -0.687315f, -0.687455f, -0.687594f, -0.687733f, -0.687872f, -0.688011f, -0.688151f, -0.688290f,
- -0.688429f, -0.688568f, -0.688707f, -0.688846f, -0.688985f, -0.689124f, -0.689263f, -0.689402f,
- -0.689541f, -0.689679f, -0.689818f, -0.689957f, -0.690096f, -0.690235f, -0.690373f, -0.690512f,
- -0.690651f, -0.690789f, -0.690928f, -0.691067f, -0.691205f, -0.691344f, -0.691482f, -0.691621f,
- -0.691759f, -0.691898f, -0.692036f, -0.692175f, -0.692313f, -0.692451f, -0.692590f, -0.692728f,
- -0.692866f, -0.693004f, -0.693143f, -0.693281f, -0.693419f, -0.693557f, -0.693695f, -0.693833f,
- -0.693971f, -0.694109f, -0.694248f, -0.694386f, -0.694524f, -0.694661f, -0.694799f, -0.694937f,
- -0.695075f, -0.695213f, -0.695351f, -0.695489f, -0.695626f, -0.695764f, -0.695902f, -0.696039f,
- -0.696177f, -0.696315f, -0.696452f, -0.696590f, -0.696728f, -0.696865f, -0.697003f, -0.697140f,
- -0.697277f, -0.697415f, -0.697552f, -0.697690f, -0.697827f, -0.697964f, -0.698102f, -0.698239f,
- -0.698376f, -0.698513f, -0.698651f, -0.698788f, -0.698925f, -0.699062f, -0.699199f, -0.699336f,
- -0.699473f, -0.699610f, -0.699747f, -0.699884f, -0.700021f, -0.700158f, -0.700295f, -0.700432f,
- -0.700569f, -0.700706f, -0.700842f, -0.700979f, -0.701116f, -0.701253f, -0.701389f, -0.701526f,
- -0.701663f, -0.701799f, -0.701936f, -0.702072f, -0.702209f, -0.702345f, -0.702482f, -0.702618f,
- -0.702755f, -0.702891f, -0.703028f, -0.703164f, -0.703300f, -0.703436f, -0.703573f, -0.703709f,
- -0.703845f, -0.703981f, -0.704118f, -0.704254f, -0.704390f, -0.704526f, -0.704662f, -0.704798f,
- -0.704934f, -0.705070f, -0.705206f, -0.705342f, -0.705478f, -0.705614f, -0.705750f, -0.705885f,
- -0.706021f, -0.706157f, -0.706293f, -0.706429f, -0.706564f, -0.706700f, -0.706836f, -0.706971f,
- -0.707107f, -0.707242f, -0.707378f, -0.707513f, -0.707649f, -0.707784f, -0.707920f, -0.708055f,
- -0.708191f, -0.708326f, -0.708461f, -0.708597f, -0.708732f, -0.708867f, -0.709002f, -0.709138f,
- -0.709273f, -0.709408f, -0.709543f, -0.709678f, -0.709813f, -0.709948f, -0.710083f, -0.710218f,
- -0.710353f, -0.710488f, -0.710623f, -0.710758f, -0.710893f, -0.711028f, -0.711163f, -0.711297f,
- -0.711432f, -0.711567f, -0.711702f, -0.711836f, -0.711971f, -0.712106f, -0.712240f, -0.712375f,
- -0.712509f, -0.712644f, -0.712778f, -0.712913f, -0.713047f, -0.713182f, -0.713316f, -0.713451f,
- -0.713585f, -0.713719f, -0.713853f, -0.713988f, -0.714122f, -0.714256f, -0.714390f, -0.714525f,
- -0.714659f, -0.714793f, -0.714927f, -0.715061f, -0.715195f, -0.715329f, -0.715463f, -0.715597f,
- -0.715731f, -0.715865f, -0.715999f, -0.716132f, -0.716266f, -0.716400f, -0.716534f, -0.716668f,
- -0.716801f, -0.716935f, -0.717069f, -0.717202f, -0.717336f, -0.717469f, -0.717603f, -0.717737f,
- -0.717870f, -0.718004f, -0.718137f, -0.718270f, -0.718404f, -0.718537f, -0.718670f, -0.718804f,
- -0.718937f, -0.719070f, -0.719204f, -0.719337f, -0.719470f, -0.719603f, -0.719736f, -0.719869f,
- -0.720003f, -0.720136f, -0.720269f, -0.720402f, -0.720535f, -0.720668f, -0.720800f, -0.720933f,
- -0.721066f, -0.721199f, -0.721332f, -0.721465f, -0.721597f, -0.721730f, -0.721863f, -0.721996f,
- -0.722128f, -0.722261f, -0.722393f, -0.722526f, -0.722659f, -0.722791f, -0.722924f, -0.723056f,
- -0.723188f, -0.723321f, -0.723453f, -0.723586f, -0.723718f, -0.723850f, -0.723983f, -0.724115f,
- -0.724247f, -0.724379f, -0.724511f, -0.724644f, -0.724776f, -0.724908f, -0.725040f, -0.725172f,
- -0.725304f, -0.725436f, -0.725568f, -0.725700f, -0.725832f, -0.725964f, -0.726095f, -0.726227f,
- -0.726359f, -0.726491f, -0.726623f, -0.726754f, -0.726886f, -0.727018f, -0.727149f, -0.727281f,
- -0.727413f, -0.727544f, -0.727676f, -0.727807f, -0.727939f, -0.728070f, -0.728202f, -0.728333f,
- -0.728464f, -0.728596f, -0.728727f, -0.728858f, -0.728990f, -0.729121f, -0.729252f, -0.729383f,
- -0.729514f, -0.729646f, -0.729777f, -0.729908f, -0.730039f, -0.730170f, -0.730301f, -0.730432f,
- -0.730563f, -0.730694f, -0.730825f, -0.730955f, -0.731086f, -0.731217f, -0.731348f, -0.731479f,
- -0.731609f, -0.731740f, -0.731871f, -0.732001f, -0.732132f, -0.732263f, -0.732393f, -0.732524f,
- -0.732654f, -0.732785f, -0.732915f, -0.733046f, -0.733176f, -0.733306f, -0.733437f, -0.733567f,
- -0.733697f, -0.733828f, -0.733958f, -0.734088f, -0.734218f, -0.734349f, -0.734479f, -0.734609f,
- -0.734739f, -0.734869f, -0.734999f, -0.735129f, -0.735259f, -0.735389f, -0.735519f, -0.735649f,
- -0.735779f, -0.735908f, -0.736038f, -0.736168f, -0.736298f, -0.736428f, -0.736557f, -0.736687f,
- -0.736817f, -0.736946f, -0.737076f, -0.737205f, -0.737335f, -0.737464f, -0.737594f, -0.737723f,
- -0.737853f, -0.737982f, -0.738112f, -0.738241f, -0.738370f, -0.738500f, -0.738629f, -0.738758f,
- -0.738887f, -0.739017f, -0.739146f, -0.739275f, -0.739404f, -0.739533f, -0.739662f, -0.739791f,
- -0.739920f, -0.740049f, -0.740178f, -0.740307f, -0.740436f, -0.740565f, -0.740694f, -0.740822f,
- -0.740951f, -0.741080f, -0.741209f, -0.741337f, -0.741466f, -0.741595f, -0.741723f, -0.741852f,
- -0.741980f, -0.742109f, -0.742237f, -0.742366f, -0.742494f, -0.742623f, -0.742751f, -0.742880f,
- -0.743008f, -0.743136f, -0.743265f, -0.743393f, -0.743521f, -0.743649f, -0.743777f, -0.743906f,
- -0.744034f, -0.744162f, -0.744290f, -0.744418f, -0.744546f, -0.744674f, -0.744802f, -0.744930f,
- -0.745058f, -0.745186f, -0.745314f, -0.745441f, -0.745569f, -0.745697f, -0.745825f, -0.745952f,
- -0.746080f, -0.746208f, -0.746335f, -0.746463f, -0.746591f, -0.746718f, -0.746846f, -0.746973f,
- -0.747101f, -0.747228f, -0.747355f, -0.747483f, -0.747610f, -0.747738f, -0.747865f, -0.747992f,
- -0.748119f, -0.748247f, -0.748374f, -0.748501f, -0.748628f, -0.748755f, -0.748882f, -0.749009f,
- -0.749136f, -0.749263f, -0.749390f, -0.749517f, -0.749644f, -0.749771f, -0.749898f, -0.750025f,
- -0.750152f, -0.750278f, -0.750405f, -0.750532f, -0.750659f, -0.750785f, -0.750912f, -0.751039f,
- -0.751165f, -0.751292f, -0.751418f, -0.751545f, -0.751671f, -0.751798f, -0.751924f, -0.752050f,
- -0.752177f, -0.752303f, -0.752429f, -0.752556f, -0.752682f, -0.752808f, -0.752934f, -0.753061f,
- -0.753187f, -0.753313f, -0.753439f, -0.753565f, -0.753691f, -0.753817f, -0.753943f, -0.754069f,
- -0.754195f, -0.754321f, -0.754447f, -0.754573f, -0.754698f, -0.754824f, -0.754950f, -0.755076f,
- -0.755201f, -0.755327f, -0.755453f, -0.755578f, -0.755704f, -0.755829f, -0.755955f, -0.756081f,
- -0.756206f, -0.756331f, -0.756457f, -0.756582f, -0.756708f, -0.756833f, -0.756958f, -0.757084f,
- -0.757209f, -0.757334f, -0.757459f, -0.757584f, -0.757710f, -0.757835f, -0.757960f, -0.758085f,
- -0.758210f, -0.758335f, -0.758460f, -0.758585f, -0.758710f, -0.758835f, -0.758960f, -0.759084f,
- -0.759209f, -0.759334f, -0.759459f, -0.759583f, -0.759708f, -0.759833f, -0.759957f, -0.760082f,
- -0.760207f, -0.760331f, -0.760456f, -0.760580f, -0.760705f, -0.760829f, -0.760954f, -0.761078f,
- -0.761202f, -0.761327f, -0.761451f, -0.761575f, -0.761700f, -0.761824f, -0.761948f, -0.762072f,
- -0.762196f, -0.762320f, -0.762444f, -0.762569f, -0.762693f, -0.762817f, -0.762941f, -0.763065f,
- -0.763188f, -0.763312f, -0.763436f, -0.763560f, -0.763684f, -0.763808f, -0.763931f, -0.764055f,
- -0.764179f, -0.764302f, -0.764426f, -0.764550f, -0.764673f, -0.764797f, -0.764920f, -0.765044f,
- -0.765167f, -0.765291f, -0.765414f, -0.765538f, -0.765661f, -0.765784f, -0.765907f, -0.766031f,
- -0.766154f, -0.766277f, -0.766400f, -0.766524f, -0.766647f, -0.766770f, -0.766893f, -0.767016f,
- -0.767139f, -0.767262f, -0.767385f, -0.767508f, -0.767631f, -0.767754f, -0.767876f, -0.767999f,
- -0.768122f, -0.768245f, -0.768368f, -0.768490f, -0.768613f, -0.768736f, -0.768858f, -0.768981f,
- -0.769103f, -0.769226f, -0.769348f, -0.769471f, -0.769593f, -0.769716f, -0.769838f, -0.769961f,
- -0.770083f, -0.770205f, -0.770327f, -0.770450f, -0.770572f, -0.770694f, -0.770816f, -0.770938f,
- -0.771061f, -0.771183f, -0.771305f, -0.771427f, -0.771549f, -0.771671f, -0.771793f, -0.771915f,
- -0.772036f, -0.772158f, -0.772280f, -0.772402f, -0.772524f, -0.772645f, -0.772767f, -0.772889f,
- -0.773010f, -0.773132f, -0.773254f, -0.773375f, -0.773497f, -0.773618f, -0.773740f, -0.773861f,
- -0.773983f, -0.774104f, -0.774225f, -0.774347f, -0.774468f, -0.774589f, -0.774711f, -0.774832f,
- -0.774953f, -0.775074f, -0.775195f, -0.775317f, -0.775438f, -0.775559f, -0.775680f, -0.775801f,
- -0.775922f, -0.776043f, -0.776164f, -0.776284f, -0.776405f, -0.776526f, -0.776647f, -0.776768f,
- -0.776888f, -0.777009f, -0.777130f, -0.777251f, -0.777371f, -0.777492f, -0.777612f, -0.777733f,
- -0.777853f, -0.777974f, -0.778094f, -0.778215f, -0.778335f, -0.778456f, -0.778576f, -0.778696f,
- -0.778817f, -0.778937f, -0.779057f, -0.779177f, -0.779297f, -0.779418f, -0.779538f, -0.779658f,
- -0.779778f, -0.779898f, -0.780018f, -0.780138f, -0.780258f, -0.780378f, -0.780498f, -0.780617f,
- -0.780737f, -0.780857f, -0.780977f, -0.781097f, -0.781216f, -0.781336f, -0.781456f, -0.781575f,
- -0.781695f, -0.781814f, -0.781934f, -0.782053f, -0.782173f, -0.782292f, -0.782412f, -0.782531f,
- -0.782651f, -0.782770f, -0.782889f, -0.783009f, -0.783128f, -0.783247f, -0.783366f, -0.783485f,
- -0.783605f, -0.783724f, -0.783843f, -0.783962f, -0.784081f, -0.784200f, -0.784319f, -0.784438f,
- -0.784557f, -0.784675f, -0.784794f, -0.784913f, -0.785032f, -0.785151f, -0.785269f, -0.785388f,
- -0.785507f, -0.785625f, -0.785744f, -0.785863f, -0.785981f, -0.786100f, -0.786218f, -0.786337f,
- -0.786455f, -0.786574f, -0.786692f, -0.786810f, -0.786929f, -0.787047f, -0.787165f, -0.787284f,
- -0.787402f, -0.787520f, -0.787638f, -0.787756f, -0.787874f, -0.787992f, -0.788110f, -0.788228f,
- -0.788346f, -0.788464f, -0.788582f, -0.788700f, -0.788818f, -0.788936f, -0.789054f, -0.789172f,
- -0.789289f, -0.789407f, -0.789525f, -0.789642f, -0.789760f, -0.789878f, -0.789995f, -0.790113f,
- -0.790230f, -0.790348f, -0.790465f, -0.790583f, -0.790700f, -0.790817f, -0.790935f, -0.791052f,
- -0.791169f, -0.791287f, -0.791404f, -0.791521f, -0.791638f, -0.791755f, -0.791872f, -0.791990f,
- -0.792107f, -0.792224f, -0.792341f, -0.792458f, -0.792575f, -0.792691f, -0.792808f, -0.792925f,
- -0.793042f, -0.793159f, -0.793276f, -0.793392f, -0.793509f, -0.793626f, -0.793742f, -0.793859f,
- -0.793975f, -0.794092f, -0.794209f, -0.794325f, -0.794442f, -0.794558f, -0.794674f, -0.794791f,
- -0.794907f, -0.795023f, -0.795140f, -0.795256f, -0.795372f, -0.795488f, -0.795605f, -0.795721f,
- -0.795837f, -0.795953f, -0.796069f, -0.796185f, -0.796301f, -0.796417f, -0.796533f, -0.796649f,
- -0.796765f, -0.796881f, -0.796996f, -0.797112f, -0.797228f, -0.797344f, -0.797459f, -0.797575f,
- -0.797691f, -0.797806f, -0.797922f, -0.798038f, -0.798153f, -0.798269f, -0.798384f, -0.798500f,
- -0.798615f, -0.798730f, -0.798846f, -0.798961f, -0.799076f, -0.799192f, -0.799307f, -0.799422f,
- -0.799537f, -0.799652f, -0.799768f, -0.799883f, -0.799998f, -0.800113f, -0.800228f, -0.800343f,
- -0.800458f, -0.800573f, -0.800687f, -0.800802f, -0.800917f, -0.801032f, -0.801147f, -0.801261f,
- -0.801376f, -0.801491f, -0.801606f, -0.801720f, -0.801835f, -0.801949f, -0.802064f, -0.802178f,
- -0.802293f, -0.802407f, -0.802522f, -0.802636f, -0.802750f, -0.802865f, -0.802979f, -0.803093f,
- -0.803208f, -0.803322f, -0.803436f, -0.803550f, -0.803664f, -0.803778f, -0.803892f, -0.804006f,
- -0.804120f, -0.804234f, -0.804348f, -0.804462f, -0.804576f, -0.804690f, -0.804804f, -0.804918f,
- -0.805031f, -0.805145f, -0.805259f, -0.805372f, -0.805486f, -0.805600f, -0.805713f, -0.805827f,
- -0.805940f, -0.806054f, -0.806167f, -0.806281f, -0.806394f, -0.806508f, -0.806621f, -0.806734f,
- -0.806848f, -0.806961f, -0.807074f, -0.807187f, -0.807300f, -0.807414f, -0.807527f, -0.807640f,
- -0.807753f, -0.807866f, -0.807979f, -0.808092f, -0.808205f, -0.808318f, -0.808430f, -0.808543f,
- -0.808656f, -0.808769f, -0.808882f, -0.808994f, -0.809107f, -0.809220f, -0.809332f, -0.809445f,
- -0.809558f, -0.809670f, -0.809783f, -0.809895f, -0.810008f, -0.810120f, -0.810232f, -0.810345f,
- -0.810457f, -0.810570f, -0.810682f, -0.810794f, -0.810906f, -0.811018f, -0.811131f, -0.811243f,
- -0.811355f, -0.811467f, -0.811579f, -0.811691f, -0.811803f, -0.811915f, -0.812027f, -0.812139f,
- -0.812251f, -0.812362f, -0.812474f, -0.812586f, -0.812698f, -0.812809f, -0.812921f, -0.813033f,
- -0.813144f, -0.813256f, -0.813368f, -0.813479f, -0.813591f, -0.813702f, -0.813814f, -0.813925f,
- -0.814036f, -0.814148f, -0.814259f, -0.814370f, -0.814482f, -0.814593f, -0.814704f, -0.814815f,
- -0.814926f, -0.815037f, -0.815149f, -0.815260f, -0.815371f, -0.815482f, -0.815593f, -0.815704f,
- -0.815814f, -0.815925f, -0.816036f, -0.816147f, -0.816258f, -0.816368f, -0.816479f, -0.816590f,
- -0.816701f, -0.816811f, -0.816922f, -0.817032f, -0.817143f, -0.817253f, -0.817364f, -0.817474f,
- -0.817585f, -0.817695f, -0.817806f, -0.817916f, -0.818026f, -0.818137f, -0.818247f, -0.818357f,
- -0.818467f, -0.818577f, -0.818687f, -0.818798f, -0.818908f, -0.819018f, -0.819128f, -0.819238f,
- -0.819348f, -0.819457f, -0.819567f, -0.819677f, -0.819787f, -0.819897f, -0.820007f, -0.820116f,
- -0.820226f, -0.820336f, -0.820445f, -0.820555f, -0.820664f, -0.820774f, -0.820884f, -0.820993f,
- -0.821102f, -0.821212f, -0.821321f, -0.821431f, -0.821540f, -0.821649f, -0.821759f, -0.821868f,
- -0.821977f, -0.822086f, -0.822195f, -0.822305f, -0.822414f, -0.822523f, -0.822632f, -0.822741f,
- -0.822850f, -0.822959f, -0.823068f, -0.823177f, -0.823285f, -0.823394f, -0.823503f, -0.823612f,
- -0.823721f, -0.823829f, -0.823938f, -0.824047f, -0.824155f, -0.824264f, -0.824372f, -0.824481f,
- -0.824589f, -0.824698f, -0.824806f, -0.824915f, -0.825023f, -0.825131f, -0.825240f, -0.825348f,
- -0.825456f, -0.825564f, -0.825673f, -0.825781f, -0.825889f, -0.825997f, -0.826105f, -0.826213f,
- -0.826321f, -0.826429f, -0.826537f, -0.826645f, -0.826753f, -0.826861f, -0.826968f, -0.827076f,
- -0.827184f, -0.827292f, -0.827399f, -0.827507f, -0.827615f, -0.827722f, -0.827830f, -0.827938f,
- -0.828045f, -0.828153f, -0.828260f, -0.828367f, -0.828475f, -0.828582f, -0.828690f, -0.828797f,
- -0.828904f, -0.829011f, -0.829119f, -0.829226f, -0.829333f, -0.829440f, -0.829547f, -0.829654f,
- -0.829761f, -0.829868f, -0.829975f, -0.830082f, -0.830189f, -0.830296f, -0.830403f, -0.830510f,
- -0.830616f, -0.830723f, -0.830830f, -0.830937f, -0.831043f, -0.831150f, -0.831257f, -0.831363f,
- -0.831470f, -0.831576f, -0.831683f, -0.831789f, -0.831895f, -0.832002f, -0.832108f, -0.832215f,
- -0.832321f, -0.832427f, -0.832533f, -0.832640f, -0.832746f, -0.832852f, -0.832958f, -0.833064f,
- -0.833170f, -0.833276f, -0.833382f, -0.833488f, -0.833594f, -0.833700f, -0.833806f, -0.833912f,
- -0.834018f, -0.834123f, -0.834229f, -0.834335f, -0.834440f, -0.834546f, -0.834652f, -0.834757f,
- -0.834863f, -0.834968f, -0.835074f, -0.835179f, -0.835285f, -0.835390f, -0.835496f, -0.835601f,
- -0.835706f, -0.835812f, -0.835917f, -0.836022f, -0.836127f, -0.836232f, -0.836338f, -0.836443f,
- -0.836548f, -0.836653f, -0.836758f, -0.836863f, -0.836968f, -0.837073f, -0.837178f, -0.837282f,
- -0.837387f, -0.837492f, -0.837597f, -0.837701f, -0.837806f, -0.837911f, -0.838015f, -0.838120f,
- -0.838225f, -0.838329f, -0.838434f, -0.838538f, -0.838643f, -0.838747f, -0.838852f, -0.838956f,
- -0.839060f, -0.839165f, -0.839269f, -0.839373f, -0.839477f, -0.839581f, -0.839686f, -0.839790f,
- -0.839894f, -0.839998f, -0.840102f, -0.840206f, -0.840310f, -0.840414f, -0.840518f, -0.840622f,
- -0.840725f, -0.840829f, -0.840933f, -0.841037f, -0.841140f, -0.841244f, -0.841348f, -0.841451f,
- -0.841555f, -0.841659f, -0.841762f, -0.841866f, -0.841969f, -0.842072f, -0.842176f, -0.842279f,
- -0.842383f, -0.842486f, -0.842589f, -0.842692f, -0.842796f, -0.842899f, -0.843002f, -0.843105f,
- -0.843208f, -0.843311f, -0.843414f, -0.843517f, -0.843620f, -0.843723f, -0.843826f, -0.843929f,
- -0.844032f, -0.844135f, -0.844238f, -0.844340f, -0.844443f, -0.844546f, -0.844648f, -0.844751f,
- -0.844854f, -0.844956f, -0.845059f, -0.845161f, -0.845264f, -0.845366f, -0.845469f, -0.845571f,
- -0.845673f, -0.845776f, -0.845878f, -0.845980f, -0.846082f, -0.846185f, -0.846287f, -0.846389f,
- -0.846491f, -0.846593f, -0.846695f, -0.846797f, -0.846899f, -0.847001f, -0.847103f, -0.847205f,
- -0.847307f, -0.847408f, -0.847510f, -0.847612f, -0.847714f, -0.847815f, -0.847917f, -0.848019f,
- -0.848120f, -0.848222f, -0.848323f, -0.848425f, -0.848526f, -0.848628f, -0.848729f, -0.848831f,
- -0.848932f, -0.849033f, -0.849135f, -0.849236f, -0.849337f, -0.849438f, -0.849540f, -0.849641f,
- -0.849742f, -0.849843f, -0.849944f, -0.850045f, -0.850146f, -0.850247f, -0.850348f, -0.850449f,
- -0.850549f, -0.850650f, -0.850751f, -0.850852f, -0.850953f, -0.851053f, -0.851154f, -0.851255f,
- -0.851355f, -0.851456f, -0.851556f, -0.851657f, -0.851757f, -0.851858f, -0.851958f, -0.852059f,
- -0.852159f, -0.852259f, -0.852360f, -0.852460f, -0.852560f, -0.852660f, -0.852760f, -0.852861f,
- -0.852961f, -0.853061f, -0.853161f, -0.853261f, -0.853361f, -0.853461f, -0.853561f, -0.853660f,
- -0.853760f, -0.853860f, -0.853960f, -0.854060f, -0.854159f, -0.854259f, -0.854359f, -0.854458f,
- -0.854558f, -0.854658f, -0.854757f, -0.854857f, -0.854956f, -0.855056f, -0.855155f, -0.855254f,
- -0.855354f, -0.855453f, -0.855552f, -0.855651f, -0.855751f, -0.855850f, -0.855949f, -0.856048f,
- -0.856147f, -0.856246f, -0.856345f, -0.856444f, -0.856543f, -0.856642f, -0.856741f, -0.856840f,
- -0.856939f, -0.857038f, -0.857137f, -0.857235f, -0.857334f, -0.857433f, -0.857531f, -0.857630f,
- -0.857729f, -0.857827f, -0.857926f, -0.858024f, -0.858123f, -0.858221f, -0.858320f, -0.858418f,
- -0.858516f, -0.858615f, -0.858713f, -0.858811f, -0.858909f, -0.859007f, -0.859106f, -0.859204f,
- -0.859302f, -0.859400f, -0.859498f, -0.859596f, -0.859694f, -0.859792f, -0.859890f, -0.859988f,
- -0.860085f, -0.860183f, -0.860281f, -0.860379f, -0.860476f, -0.860574f, -0.860672f, -0.860769f,
- -0.860867f, -0.860964f, -0.861062f, -0.861160f, -0.861257f, -0.861354f, -0.861452f, -0.861549f,
- -0.861646f, -0.861744f, -0.861841f, -0.861938f, -0.862035f, -0.862133f, -0.862230f, -0.862327f,
- -0.862424f, -0.862521f, -0.862618f, -0.862715f, -0.862812f, -0.862909f, -0.863006f, -0.863103f,
- -0.863199f, -0.863296f, -0.863393f, -0.863490f, -0.863586f, -0.863683f, -0.863780f, -0.863876f,
- -0.863973f, -0.864069f, -0.864166f, -0.864262f, -0.864359f, -0.864455f, -0.864552f, -0.864648f,
- -0.864744f, -0.864841f, -0.864937f, -0.865033f, -0.865129f, -0.865225f, -0.865321f, -0.865418f,
- -0.865514f, -0.865610f, -0.865706f, -0.865802f, -0.865898f, -0.865993f, -0.866089f, -0.866185f,
- -0.866281f, -0.866377f, -0.866472f, -0.866568f, -0.866664f, -0.866759f, -0.866855f, -0.866951f,
- -0.867046f, -0.867142f, -0.867237f, -0.867333f, -0.867428f, -0.867523f, -0.867619f, -0.867714f,
- -0.867809f, -0.867905f, -0.868000f, -0.868095f, -0.868190f, -0.868285f, -0.868381f, -0.868476f,
- -0.868571f, -0.868666f, -0.868761f, -0.868856f, -0.868951f, -0.869045f, -0.869140f, -0.869235f,
- -0.869330f, -0.869425f, -0.869519f, -0.869614f, -0.869709f, -0.869803f, -0.869898f, -0.869992f,
- -0.870087f, -0.870182f, -0.870276f, -0.870370f, -0.870465f, -0.870559f, -0.870654f, -0.870748f,
- -0.870842f, -0.870936f, -0.871031f, -0.871125f, -0.871219f, -0.871313f, -0.871407f, -0.871501f,
- -0.871595f, -0.871689f, -0.871783f, -0.871877f, -0.871971f, -0.872065f, -0.872159f, -0.872252f,
- -0.872346f, -0.872440f, -0.872534f, -0.872627f, -0.872721f, -0.872814f, -0.872908f, -0.873001f,
- -0.873095f, -0.873188f, -0.873282f, -0.873375f, -0.873469f, -0.873562f, -0.873655f, -0.873749f,
- -0.873842f, -0.873935f, -0.874028f, -0.874121f, -0.874215f, -0.874308f, -0.874401f, -0.874494f,
- -0.874587f, -0.874680f, -0.874773f, -0.874865f, -0.874958f, -0.875051f, -0.875144f, -0.875237f,
- -0.875329f, -0.875422f, -0.875515f, -0.875607f, -0.875700f, -0.875793f, -0.875885f, -0.875978f,
- -0.876070f, -0.876163f, -0.876255f, -0.876347f, -0.876440f, -0.876532f, -0.876624f, -0.876716f,
- -0.876809f, -0.876901f, -0.876993f, -0.877085f, -0.877177f, -0.877269f, -0.877361f, -0.877453f,
- -0.877545f, -0.877637f, -0.877729f, -0.877821f, -0.877913f, -0.878005f, -0.878096f, -0.878188f,
- -0.878280f, -0.878371f, -0.878463f, -0.878555f, -0.878646f, -0.878738f, -0.878829f, -0.878921f,
- -0.879012f, -0.879104f, -0.879195f, -0.879286f, -0.879378f, -0.879469f, -0.879560f, -0.879651f,
- -0.879743f, -0.879834f, -0.879925f, -0.880016f, -0.880107f, -0.880198f, -0.880289f, -0.880380f,
- -0.880471f, -0.880562f, -0.880653f, -0.880743f, -0.880834f, -0.880925f, -0.881016f, -0.881106f,
- -0.881197f, -0.881288f, -0.881378f, -0.881469f, -0.881559f, -0.881650f, -0.881740f, -0.881831f,
- -0.881921f, -0.882012f, -0.882102f, -0.882192f, -0.882283f, -0.882373f, -0.882463f, -0.882553f,
- -0.882643f, -0.882733f, -0.882824f, -0.882914f, -0.883004f, -0.883094f, -0.883184f, -0.883273f,
- -0.883363f, -0.883453f, -0.883543f, -0.883633f, -0.883723f, -0.883812f, -0.883902f, -0.883992f,
- -0.884081f, -0.884171f, -0.884260f, -0.884350f, -0.884439f, -0.884529f, -0.884618f, -0.884708f,
- -0.884797f, -0.884886f, -0.884976f, -0.885065f, -0.885154f, -0.885243f, -0.885333f, -0.885422f,
- -0.885511f, -0.885600f, -0.885689f, -0.885778f, -0.885867f, -0.885956f, -0.886045f, -0.886134f,
- -0.886223f, -0.886311f, -0.886400f, -0.886489f, -0.886578f, -0.886666f, -0.886755f, -0.886844f,
- -0.886932f, -0.887021f, -0.887109f, -0.887198f, -0.887286f, -0.887375f, -0.887463f, -0.887551f,
- -0.887640f, -0.887728f, -0.887816f, -0.887904f, -0.887993f, -0.888081f, -0.888169f, -0.888257f,
- -0.888345f, -0.888433f, -0.888521f, -0.888609f, -0.888697f, -0.888785f, -0.888873f, -0.888961f,
- -0.889048f, -0.889136f, -0.889224f, -0.889312f, -0.889399f, -0.889487f, -0.889574f, -0.889662f,
- -0.889750f, -0.889837f, -0.889925f, -0.890012f, -0.890099f, -0.890187f, -0.890274f, -0.890361f,
- -0.890449f, -0.890536f, -0.890623f, -0.890710f, -0.890797f, -0.890885f, -0.890972f, -0.891059f,
- -0.891146f, -0.891233f, -0.891320f, -0.891407f, -0.891493f, -0.891580f, -0.891667f, -0.891754f,
- -0.891841f, -0.891927f, -0.892014f, -0.892101f, -0.892187f, -0.892274f, -0.892361f, -0.892447f,
- -0.892534f, -0.892620f, -0.892706f, -0.892793f, -0.892879f, -0.892965f, -0.893052f, -0.893138f,
- -0.893224f, -0.893310f, -0.893397f, -0.893483f, -0.893569f, -0.893655f, -0.893741f, -0.893827f,
- -0.893913f, -0.893999f, -0.894085f, -0.894171f, -0.894256f, -0.894342f, -0.894428f, -0.894514f,
- -0.894599f, -0.894685f, -0.894771f, -0.894856f, -0.894942f, -0.895028f, -0.895113f, -0.895198f,
- -0.895284f, -0.895369f, -0.895455f, -0.895540f, -0.895625f, -0.895711f, -0.895796f, -0.895881f,
- -0.895966f, -0.896051f, -0.896137f, -0.896222f, -0.896307f, -0.896392f, -0.896477f, -0.896562f,
- -0.896646f, -0.896731f, -0.896816f, -0.896901f, -0.896986f, -0.897071f, -0.897155f, -0.897240f,
- -0.897325f, -0.897409f, -0.897494f, -0.897578f, -0.897663f, -0.897747f, -0.897832f, -0.897916f,
- -0.898001f, -0.898085f, -0.898169f, -0.898254f, -0.898338f, -0.898422f, -0.898506f, -0.898590f,
- -0.898674f, -0.898759f, -0.898843f, -0.898927f, -0.899011f, -0.899095f, -0.899179f, -0.899262f,
- -0.899346f, -0.899430f, -0.899514f, -0.899598f, -0.899681f, -0.899765f, -0.899849f, -0.899932f,
- -0.900016f, -0.900099f, -0.900183f, -0.900266f, -0.900350f, -0.900433f, -0.900517f, -0.900600f,
- -0.900683f, -0.900767f, -0.900850f, -0.900933f, -0.901016f, -0.901100f, -0.901183f, -0.901266f,
- -0.901349f, -0.901432f, -0.901515f, -0.901598f, -0.901681f, -0.901764f, -0.901847f, -0.901929f,
- -0.902012f, -0.902095f, -0.902178f, -0.902260f, -0.902343f, -0.902426f, -0.902508f, -0.902591f,
- -0.902673f, -0.902756f, -0.902838f, -0.902921f, -0.903003f, -0.903085f, -0.903168f, -0.903250f,
- -0.903332f, -0.903415f, -0.903497f, -0.903579f, -0.903661f, -0.903743f, -0.903825f, -0.903907f,
- -0.903989f, -0.904071f, -0.904153f, -0.904235f, -0.904317f, -0.904399f, -0.904481f, -0.904562f,
- -0.904644f, -0.904726f, -0.904807f, -0.904889f, -0.904971f, -0.905052f, -0.905134f, -0.905215f,
- -0.905297f, -0.905378f, -0.905460f, -0.905541f, -0.905622f, -0.905704f, -0.905785f, -0.905866f,
- -0.905947f, -0.906028f, -0.906110f, -0.906191f, -0.906272f, -0.906353f, -0.906434f, -0.906515f,
- -0.906596f, -0.906677f, -0.906757f, -0.906838f, -0.906919f, -0.907000f, -0.907081f, -0.907161f,
- -0.907242f, -0.907323f, -0.907403f, -0.907484f, -0.907564f, -0.907645f, -0.907725f, -0.907806f,
- -0.907886f, -0.907966f, -0.908047f, -0.908127f, -0.908207f, -0.908288f, -0.908368f, -0.908448f,
- -0.908528f, -0.908608f, -0.908688f, -0.908768f, -0.908848f, -0.908928f, -0.909008f, -0.909088f,
- -0.909168f, -0.909248f, -0.909328f, -0.909407f, -0.909487f, -0.909567f, -0.909646f, -0.909726f,
- -0.909806f, -0.909885f, -0.909965f, -0.910044f, -0.910124f, -0.910203f, -0.910283f, -0.910362f,
- -0.910441f, -0.910521f, -0.910600f, -0.910679f, -0.910758f, -0.910837f, -0.910917f, -0.910996f,
- -0.911075f, -0.911154f, -0.911233f, -0.911312f, -0.911391f, -0.911470f, -0.911548f, -0.911627f,
- -0.911706f, -0.911785f, -0.911864f, -0.911942f, -0.912021f, -0.912099f, -0.912178f, -0.912257f,
- -0.912335f, -0.912414f, -0.912492f, -0.912571f, -0.912649f, -0.912727f, -0.912806f, -0.912884f,
- -0.912962f, -0.913040f, -0.913119f, -0.913197f, -0.913275f, -0.913353f, -0.913431f, -0.913509f,
- -0.913587f, -0.913665f, -0.913743f, -0.913821f, -0.913899f, -0.913976f, -0.914054f, -0.914132f,
- -0.914210f, -0.914287f, -0.914365f, -0.914443f, -0.914520f, -0.914598f, -0.914675f, -0.914753f,
- -0.914830f, -0.914908f, -0.914985f, -0.915062f, -0.915140f, -0.915217f, -0.915294f, -0.915372f,
- -0.915449f, -0.915526f, -0.915603f, -0.915680f, -0.915757f, -0.915834f, -0.915911f, -0.915988f,
- -0.916065f, -0.916142f, -0.916219f, -0.916296f, -0.916372f, -0.916449f, -0.916526f, -0.916602f,
- -0.916679f, -0.916756f, -0.916832f, -0.916909f, -0.916985f, -0.917062f, -0.917138f, -0.917215f,
- -0.917291f, -0.917367f, -0.917444f, -0.917520f, -0.917596f, -0.917672f, -0.917749f, -0.917825f,
- -0.917901f, -0.917977f, -0.918053f, -0.918129f, -0.918205f, -0.918281f, -0.918357f, -0.918433f,
- -0.918508f, -0.918584f, -0.918660f, -0.918736f, -0.918811f, -0.918887f, -0.918963f, -0.919038f,
- -0.919114f, -0.919189f, -0.919265f, -0.919340f, -0.919416f, -0.919491f, -0.919567f, -0.919642f,
- -0.919717f, -0.919792f, -0.919868f, -0.919943f, -0.920018f, -0.920093f, -0.920168f, -0.920243f,
- -0.920318f, -0.920393f, -0.920468f, -0.920543f, -0.920618f, -0.920693f, -0.920768f, -0.920842f,
- -0.920917f, -0.920992f, -0.921067f, -0.921141f, -0.921216f, -0.921291f, -0.921365f, -0.921440f,
- -0.921514f, -0.921588f, -0.921663f, -0.921737f, -0.921812f, -0.921886f, -0.921960f, -0.922034f,
- -0.922109f, -0.922183f, -0.922257f, -0.922331f, -0.922405f, -0.922479f, -0.922553f, -0.922627f,
- -0.922701f, -0.922775f, -0.922849f, -0.922923f, -0.922997f, -0.923070f, -0.923144f, -0.923218f,
- -0.923291f, -0.923365f, -0.923439f, -0.923512f, -0.923586f, -0.923659f, -0.923733f, -0.923806f,
- -0.923880f, -0.923953f, -0.924026f, -0.924100f, -0.924173f, -0.924246f, -0.924319f, -0.924392f,
- -0.924465f, -0.924539f, -0.924612f, -0.924685f, -0.924758f, -0.924831f, -0.924904f, -0.924976f,
- -0.925049f, -0.925122f, -0.925195f, -0.925268f, -0.925340f, -0.925413f, -0.925486f, -0.925558f,
- -0.925631f, -0.925703f, -0.925776f, -0.925848f, -0.925921f, -0.925993f, -0.926066f, -0.926138f,
- -0.926210f, -0.926283f, -0.926355f, -0.926427f, -0.926499f, -0.926571f, -0.926643f, -0.926715f,
- -0.926787f, -0.926859f, -0.926931f, -0.927003f, -0.927075f, -0.927147f, -0.927219f, -0.927291f,
- -0.927363f, -0.927434f, -0.927506f, -0.927578f, -0.927649f, -0.927721f, -0.927792f, -0.927864f,
- -0.927935f, -0.928007f, -0.928078f, -0.928150f, -0.928221f, -0.928292f, -0.928364f, -0.928435f,
- -0.928506f, -0.928577f, -0.928648f, -0.928720f, -0.928791f, -0.928862f, -0.928933f, -0.929004f,
- -0.929075f, -0.929146f, -0.929216f, -0.929287f, -0.929358f, -0.929429f, -0.929500f, -0.929570f,
- -0.929641f, -0.929712f, -0.929782f, -0.929853f, -0.929923f, -0.929994f, -0.930064f, -0.930135f,
- -0.930205f, -0.930275f, -0.930346f, -0.930416f, -0.930486f, -0.930556f, -0.930627f, -0.930697f,
- -0.930767f, -0.930837f, -0.930907f, -0.930977f, -0.931047f, -0.931117f, -0.931187f, -0.931257f,
- -0.931327f, -0.931397f, -0.931466f, -0.931536f, -0.931606f, -0.931675f, -0.931745f, -0.931815f,
- -0.931884f, -0.931954f, -0.932023f, -0.932093f, -0.932162f, -0.932232f, -0.932301f, -0.932370f,
- -0.932440f, -0.932509f, -0.932578f, -0.932647f, -0.932716f, -0.932786f, -0.932855f, -0.932924f,
- -0.932993f, -0.933062f, -0.933131f, -0.933200f, -0.933269f, -0.933337f, -0.933406f, -0.933475f,
- -0.933544f, -0.933612f, -0.933681f, -0.933750f, -0.933818f, -0.933887f, -0.933956f, -0.934024f,
- -0.934093f, -0.934161f, -0.934229f, -0.934298f, -0.934366f, -0.934434f, -0.934503f, -0.934571f,
- -0.934639f, -0.934707f, -0.934775f, -0.934844f, -0.934912f, -0.934980f, -0.935048f, -0.935116f,
- -0.935184f, -0.935251f, -0.935319f, -0.935387f, -0.935455f, -0.935523f, -0.935590f, -0.935658f,
- -0.935726f, -0.935793f, -0.935861f, -0.935928f, -0.935996f, -0.936063f, -0.936131f, -0.936198f,
- -0.936266f, -0.936333f, -0.936400f, -0.936468f, -0.936535f, -0.936602f, -0.936669f, -0.936736f,
- -0.936803f, -0.936871f, -0.936938f, -0.937005f, -0.937072f, -0.937138f, -0.937205f, -0.937272f,
- -0.937339f, -0.937406f, -0.937473f, -0.937539f, -0.937606f, -0.937673f, -0.937739f, -0.937806f,
- -0.937872f, -0.937939f, -0.938005f, -0.938072f, -0.938138f, -0.938205f, -0.938271f, -0.938337f,
- -0.938404f, -0.938470f, -0.938536f, -0.938602f, -0.938668f, -0.938734f, -0.938800f, -0.938866f,
- -0.938932f, -0.938998f, -0.939064f, -0.939130f, -0.939196f, -0.939262f, -0.939328f, -0.939394f,
- -0.939459f, -0.939525f, -0.939591f, -0.939656f, -0.939722f, -0.939787f, -0.939853f, -0.939918f,
- -0.939984f, -0.940049f, -0.940115f, -0.940180f, -0.940245f, -0.940310f, -0.940376f, -0.940441f,
- -0.940506f, -0.940571f, -0.940636f, -0.940701f, -0.940766f, -0.940831f, -0.940896f, -0.940961f,
- -0.941026f, -0.941091f, -0.941156f, -0.941221f, -0.941285f, -0.941350f, -0.941415f, -0.941479f,
- -0.941544f, -0.941609f, -0.941673f, -0.941738f, -0.941802f, -0.941867f, -0.941931f, -0.941995f,
- -0.942060f, -0.942124f, -0.942188f, -0.942253f, -0.942317f, -0.942381f, -0.942445f, -0.942509f,
- -0.942573f, -0.942637f, -0.942701f, -0.942765f, -0.942829f, -0.942893f, -0.942957f, -0.943021f,
- -0.943084f, -0.943148f, -0.943212f, -0.943276f, -0.943339f, -0.943403f, -0.943466f, -0.943530f,
- -0.943593f, -0.943657f, -0.943720f, -0.943784f, -0.943847f, -0.943910f, -0.943974f, -0.944037f,
- -0.944100f, -0.944163f, -0.944227f, -0.944290f, -0.944353f, -0.944416f, -0.944479f, -0.944542f,
- -0.944605f, -0.944668f, -0.944731f, -0.944793f, -0.944856f, -0.944919f, -0.944982f, -0.945045f,
- -0.945107f, -0.945170f, -0.945232f, -0.945295f, -0.945358f, -0.945420f, -0.945482f, -0.945545f,
- -0.945607f, -0.945670f, -0.945732f, -0.945794f, -0.945857f, -0.945919f, -0.945981f, -0.946043f,
- -0.946105f, -0.946167f, -0.946229f, -0.946291f, -0.946353f, -0.946415f, -0.946477f, -0.946539f,
- -0.946601f, -0.946663f, -0.946724f, -0.946786f, -0.946848f, -0.946910f, -0.946971f, -0.947033f,
- -0.947094f, -0.947156f, -0.947217f, -0.947279f, -0.947340f, -0.947402f, -0.947463f, -0.947524f,
- -0.947586f, -0.947647f, -0.947708f, -0.947769f, -0.947830f, -0.947891f, -0.947953f, -0.948014f,
- -0.948075f, -0.948136f, -0.948196f, -0.948257f, -0.948318f, -0.948379f, -0.948440f, -0.948501f,
- -0.948561f, -0.948622f, -0.948683f, -0.948743f, -0.948804f, -0.948864f, -0.948925f, -0.948985f,
- -0.949046f, -0.949106f, -0.949167f, -0.949227f, -0.949287f, -0.949348f, -0.949408f, -0.949468f,
- -0.949528f, -0.949588f, -0.949648f, -0.949708f, -0.949768f, -0.949829f, -0.949888f, -0.949948f,
- -0.950008f, -0.950068f, -0.950128f, -0.950188f, -0.950247f, -0.950307f, -0.950367f, -0.950426f,
- -0.950486f, -0.950546f, -0.950605f, -0.950665f, -0.950724f, -0.950784f, -0.950843f, -0.950902f,
- -0.950962f, -0.951021f, -0.951080f, -0.951139f, -0.951199f, -0.951258f, -0.951317f, -0.951376f,
- -0.951435f, -0.951494f, -0.951553f, -0.951612f, -0.951671f, -0.951730f, -0.951789f, -0.951847f,
- -0.951906f, -0.951965f, -0.952024f, -0.952082f, -0.952141f, -0.952199f, -0.952258f, -0.952317f,
- -0.952375f, -0.952433f, -0.952492f, -0.952550f, -0.952609f, -0.952667f, -0.952725f, -0.952783f,
- -0.952842f, -0.952900f, -0.952958f, -0.953016f, -0.953074f, -0.953132f, -0.953190f, -0.953248f,
- -0.953306f, -0.953364f, -0.953422f, -0.953480f, -0.953537f, -0.953595f, -0.953653f, -0.953711f,
- -0.953768f, -0.953826f, -0.953883f, -0.953941f, -0.953998f, -0.954056f, -0.954113f, -0.954171f,
- -0.954228f, -0.954285f, -0.954343f, -0.954400f, -0.954457f, -0.954514f, -0.954572f, -0.954629f,
- -0.954686f, -0.954743f, -0.954800f, -0.954857f, -0.954914f, -0.954971f, -0.955028f, -0.955084f,
- -0.955141f, -0.955198f, -0.955255f, -0.955311f, -0.955368f, -0.955425f, -0.955481f, -0.955538f,
- -0.955594f, -0.955651f, -0.955707f, -0.955764f, -0.955820f, -0.955876f, -0.955933f, -0.955989f,
- -0.956045f, -0.956101f, -0.956158f, -0.956214f, -0.956270f, -0.956326f, -0.956382f, -0.956438f,
- -0.956494f, -0.956550f, -0.956606f, -0.956662f, -0.956717f, -0.956773f, -0.956829f, -0.956885f,
- -0.956940f, -0.956996f, -0.957052f, -0.957107f, -0.957163f, -0.957218f, -0.957274f, -0.957329f,
- -0.957385f, -0.957440f, -0.957495f, -0.957550f, -0.957606f, -0.957661f, -0.957716f, -0.957771f,
- -0.957826f, -0.957882f, -0.957937f, -0.957992f, -0.958046f, -0.958101f, -0.958156f, -0.958211f,
- -0.958266f, -0.958321f, -0.958376f, -0.958430f, -0.958485f, -0.958540f, -0.958594f, -0.958649f,
- -0.958703f, -0.958758f, -0.958812f, -0.958867f, -0.958921f, -0.958976f, -0.959030f, -0.959084f,
- -0.959139f, -0.959193f, -0.959247f, -0.959301f, -0.959355f, -0.959409f, -0.959463f, -0.959518f,
- -0.959572f, -0.959625f, -0.959679f, -0.959733f, -0.959787f, -0.959841f, -0.959895f, -0.959948f,
- -0.960002f, -0.960056f, -0.960109f, -0.960163f, -0.960217f, -0.960270f, -0.960324f, -0.960377f,
- -0.960431f, -0.960484f, -0.960537f, -0.960591f, -0.960644f, -0.960697f, -0.960750f, -0.960804f,
- -0.960857f, -0.960910f, -0.960963f, -0.961016f, -0.961069f, -0.961122f, -0.961175f, -0.961228f,
- -0.961280f, -0.961333f, -0.961386f, -0.961439f, -0.961492f, -0.961544f, -0.961597f, -0.961649f,
- -0.961702f, -0.961755f, -0.961807f, -0.961860f, -0.961912f, -0.961964f, -0.962017f, -0.962069f,
- -0.962121f, -0.962174f, -0.962226f, -0.962278f, -0.962330f, -0.962382f, -0.962434f, -0.962486f,
- -0.962538f, -0.962590f, -0.962642f, -0.962694f, -0.962746f, -0.962798f, -0.962850f, -0.962902f,
- -0.962953f, -0.963005f, -0.963057f, -0.963108f, -0.963160f, -0.963211f, -0.963263f, -0.963314f,
- -0.963366f, -0.963417f, -0.963469f, -0.963520f, -0.963571f, -0.963623f, -0.963674f, -0.963725f,
- -0.963776f, -0.963827f, -0.963878f, -0.963929f, -0.963980f, -0.964031f, -0.964082f, -0.964133f,
- -0.964184f, -0.964235f, -0.964286f, -0.964336f, -0.964387f, -0.964438f, -0.964489f, -0.964539f,
- -0.964590f, -0.964640f, -0.964691f, -0.964741f, -0.964792f, -0.964842f, -0.964893f, -0.964943f,
- -0.964993f, -0.965044f, -0.965094f, -0.965144f, -0.965194f, -0.965244f, -0.965294f, -0.965344f,
- -0.965394f, -0.965444f, -0.965494f, -0.965544f, -0.965594f, -0.965644f, -0.965694f, -0.965744f,
- -0.965793f, -0.965843f, -0.965893f, -0.965942f, -0.965992f, -0.966042f, -0.966091f, -0.966141f,
- -0.966190f, -0.966239f, -0.966289f, -0.966338f, -0.966387f, -0.966437f, -0.966486f, -0.966535f,
- -0.966584f, -0.966633f, -0.966683f, -0.966732f, -0.966781f, -0.966830f, -0.966879f, -0.966928f,
- -0.966976f, -0.967025f, -0.967074f, -0.967123f, -0.967172f, -0.967220f, -0.967269f, -0.967318f,
- -0.967366f, -0.967415f, -0.967463f, -0.967512f, -0.967560f, -0.967609f, -0.967657f, -0.967706f,
- -0.967754f, -0.967802f, -0.967850f, -0.967899f, -0.967947f, -0.967995f, -0.968043f, -0.968091f,
- -0.968139f, -0.968187f, -0.968235f, -0.968283f, -0.968331f, -0.968379f, -0.968427f, -0.968474f,
- -0.968522f, -0.968570f, -0.968617f, -0.968665f, -0.968713f, -0.968760f, -0.968808f, -0.968855f,
- -0.968903f, -0.968950f, -0.968998f, -0.969045f, -0.969092f, -0.969140f, -0.969187f, -0.969234f,
- -0.969281f, -0.969328f, -0.969375f, -0.969423f, -0.969470f, -0.969517f, -0.969564f, -0.969611f,
- -0.969657f, -0.969704f, -0.969751f, -0.969798f, -0.969845f, -0.969891f, -0.969938f, -0.969985f,
- -0.970031f, -0.970078f, -0.970124f, -0.970171f, -0.970217f, -0.970264f, -0.970310f, -0.970357f,
- -0.970403f, -0.970449f, -0.970495f, -0.970542f, -0.970588f, -0.970634f, -0.970680f, -0.970726f,
- -0.970772f, -0.970818f, -0.970864f, -0.970910f, -0.970956f, -0.971002f, -0.971048f, -0.971093f,
- -0.971139f, -0.971185f, -0.971231f, -0.971276f, -0.971322f, -0.971367f, -0.971413f, -0.971458f,
- -0.971504f, -0.971549f, -0.971595f, -0.971640f, -0.971685f, -0.971731f, -0.971776f, -0.971821f,
- -0.971866f, -0.971911f, -0.971957f, -0.972002f, -0.972047f, -0.972092f, -0.972137f, -0.972182f,
- -0.972227f, -0.972271f, -0.972316f, -0.972361f, -0.972406f, -0.972450f, -0.972495f, -0.972540f,
- -0.972584f, -0.972629f, -0.972673f, -0.972718f, -0.972762f, -0.972807f, -0.972851f, -0.972896f,
- -0.972940f, -0.972984f, -0.973028f, -0.973073f, -0.973117f, -0.973161f, -0.973205f, -0.973249f,
- -0.973293f, -0.973337f, -0.973381f, -0.973425f, -0.973469f, -0.973513f, -0.973557f, -0.973601f,
- -0.973644f, -0.973688f, -0.973732f, -0.973775f, -0.973819f, -0.973862f, -0.973906f, -0.973949f,
- -0.973993f, -0.974036f, -0.974080f, -0.974123f, -0.974166f, -0.974210f, -0.974253f, -0.974296f,
- -0.974339f, -0.974383f, -0.974426f, -0.974469f, -0.974512f, -0.974555f, -0.974598f, -0.974641f,
- -0.974684f, -0.974726f, -0.974769f, -0.974812f, -0.974855f, -0.974897f, -0.974940f, -0.974983f,
- -0.975025f, -0.975068f, -0.975110f, -0.975153f, -0.975195f, -0.975238f, -0.975280f, -0.975323f,
- -0.975365f, -0.975407f, -0.975449f, -0.975492f, -0.975534f, -0.975576f, -0.975618f, -0.975660f,
- -0.975702f, -0.975744f, -0.975786f, -0.975828f, -0.975870f, -0.975912f, -0.975954f, -0.975995f,
- -0.976037f, -0.976079f, -0.976120f, -0.976162f, -0.976204f, -0.976245f, -0.976287f, -0.976328f,
- -0.976370f, -0.976411f, -0.976453f, -0.976494f, -0.976535f, -0.976576f, -0.976618f, -0.976659f,
- -0.976700f, -0.976741f, -0.976782f, -0.976823f, -0.976864f, -0.976905f, -0.976946f, -0.976987f,
- -0.977028f, -0.977069f, -0.977110f, -0.977151f, -0.977191f, -0.977232f, -0.977273f, -0.977313f,
- -0.977354f, -0.977394f, -0.977435f, -0.977475f, -0.977516f, -0.977556f, -0.977597f, -0.977637f,
- -0.977677f, -0.977718f, -0.977758f, -0.977798f, -0.977838f, -0.977878f, -0.977918f, -0.977959f,
- -0.977998f, -0.978038f, -0.978078f, -0.978118f, -0.978158f, -0.978198f, -0.978238f, -0.978278f,
- -0.978317f, -0.978357f, -0.978397f, -0.978436f, -0.978476f, -0.978516f, -0.978555f, -0.978594f,
- -0.978634f, -0.978673f, -0.978713f, -0.978752f, -0.978791f, -0.978831f, -0.978870f, -0.978909f,
- -0.978948f, -0.978987f, -0.979026f, -0.979065f, -0.979104f, -0.979143f, -0.979182f, -0.979221f,
- -0.979260f, -0.979299f, -0.979338f, -0.979376f, -0.979415f, -0.979454f, -0.979493f, -0.979531f,
- -0.979570f, -0.979608f, -0.979647f, -0.979685f, -0.979724f, -0.979762f, -0.979800f, -0.979839f,
- -0.979877f, -0.979915f, -0.979954f, -0.979992f, -0.980030f, -0.980068f, -0.980106f, -0.980144f,
- -0.980182f, -0.980220f, -0.980258f, -0.980296f, -0.980334f, -0.980372f, -0.980409f, -0.980447f,
- -0.980485f, -0.980523f, -0.980560f, -0.980598f, -0.980635f, -0.980673f, -0.980710f, -0.980748f,
- -0.980785f, -0.980823f, -0.980860f, -0.980897f, -0.980935f, -0.980972f, -0.981009f, -0.981046f,
- -0.981083f, -0.981120f, -0.981158f, -0.981195f, -0.981232f, -0.981269f, -0.981305f, -0.981342f,
- -0.981379f, -0.981416f, -0.981453f, -0.981490f, -0.981526f, -0.981563f, -0.981600f, -0.981636f,
- -0.981673f, -0.981709f, -0.981746f, -0.981782f, -0.981819f, -0.981855f, -0.981891f, -0.981928f,
- -0.981964f, -0.982000f, -0.982036f, -0.982072f, -0.982109f, -0.982145f, -0.982181f, -0.982217f,
- -0.982253f, -0.982289f, -0.982325f, -0.982360f, -0.982396f, -0.982432f, -0.982468f, -0.982504f,
- -0.982539f, -0.982575f, -0.982611f, -0.982646f, -0.982682f, -0.982717f, -0.982753f, -0.982788f,
- -0.982824f, -0.982859f, -0.982894f, -0.982930f, -0.982965f, -0.983000f, -0.983035f, -0.983070f,
- -0.983105f, -0.983141f, -0.983176f, -0.983211f, -0.983246f, -0.983281f, -0.983315f, -0.983350f,
- -0.983385f, -0.983420f, -0.983455f, -0.983489f, -0.983524f, -0.983559f, -0.983593f, -0.983628f,
- -0.983662f, -0.983697f, -0.983731f, -0.983766f, -0.983800f, -0.983835f, -0.983869f, -0.983903f,
- -0.983937f, -0.983972f, -0.984006f, -0.984040f, -0.984074f, -0.984108f, -0.984142f, -0.984176f,
- -0.984210f, -0.984244f, -0.984278f, -0.984312f, -0.984346f, -0.984379f, -0.984413f, -0.984447f,
- -0.984480f, -0.984514f, -0.984548f, -0.984581f, -0.984615f, -0.984648f, -0.984682f, -0.984715f,
- -0.984748f, -0.984782f, -0.984815f, -0.984848f, -0.984882f, -0.984915f, -0.984948f, -0.984981f,
- -0.985014f, -0.985047f, -0.985080f, -0.985113f, -0.985146f, -0.985179f, -0.985212f, -0.985245f,
- -0.985278f, -0.985310f, -0.985343f, -0.985376f, -0.985408f, -0.985441f, -0.985474f, -0.985506f,
- -0.985539f, -0.985571f, -0.985604f, -0.985636f, -0.985668f, -0.985701f, -0.985733f, -0.985765f,
- -0.985798f, -0.985830f, -0.985862f, -0.985894f, -0.985926f, -0.985958f, -0.985990f, -0.986022f,
- -0.986054f, -0.986086f, -0.986118f, -0.986150f, -0.986181f, -0.986213f, -0.986245f, -0.986276f,
- -0.986308f, -0.986340f, -0.986371f, -0.986403f, -0.986434f, -0.986466f, -0.986497f, -0.986529f,
- -0.986560f, -0.986591f, -0.986623f, -0.986654f, -0.986685f, -0.986716f, -0.986747f, -0.986778f,
- -0.986809f, -0.986840f, -0.986871f, -0.986902f, -0.986933f, -0.986964f, -0.986995f, -0.987026f,
- -0.987057f, -0.987087f, -0.987118f, -0.987149f, -0.987179f, -0.987210f, -0.987240f, -0.987271f,
- -0.987301f, -0.987332f, -0.987362f, -0.987393f, -0.987423f, -0.987453f, -0.987484f, -0.987514f,
- -0.987544f, -0.987574f, -0.987604f, -0.987634f, -0.987664f, -0.987694f, -0.987724f, -0.987754f,
- -0.987784f, -0.987814f, -0.987844f, -0.987874f, -0.987903f, -0.987933f, -0.987963f, -0.987992f,
- -0.988022f, -0.988052f, -0.988081f, -0.988111f, -0.988140f, -0.988169f, -0.988199f, -0.988228f,
- -0.988258f, -0.988287f, -0.988316f, -0.988345f, -0.988374f, -0.988404f, -0.988433f, -0.988462f,
- -0.988491f, -0.988520f, -0.988549f, -0.988578f, -0.988607f, -0.988635f, -0.988664f, -0.988693f,
- -0.988722f, -0.988750f, -0.988779f, -0.988808f, -0.988836f, -0.988865f, -0.988893f, -0.988922f,
- -0.988950f, -0.988979f, -0.989007f, -0.989035f, -0.989064f, -0.989092f, -0.989120f, -0.989148f,
- -0.989177f, -0.989205f, -0.989233f, -0.989261f, -0.989289f, -0.989317f, -0.989345f, -0.989373f,
- -0.989400f, -0.989428f, -0.989456f, -0.989484f, -0.989511f, -0.989539f, -0.989567f, -0.989594f,
- -0.989622f, -0.989650f, -0.989677f, -0.989704f, -0.989732f, -0.989759f, -0.989787f, -0.989814f,
- -0.989841f, -0.989869f, -0.989896f, -0.989923f, -0.989950f, -0.989977f, -0.990004f, -0.990031f,
- -0.990058f, -0.990085f, -0.990112f, -0.990139f, -0.990166f, -0.990193f, -0.990219f, -0.990246f,
- -0.990273f, -0.990299f, -0.990326f, -0.990353f, -0.990379f, -0.990406f, -0.990432f, -0.990459f,
- -0.990485f, -0.990511f, -0.990538f, -0.990564f, -0.990590f, -0.990617f, -0.990643f, -0.990669f,
- -0.990695f, -0.990721f, -0.990747f, -0.990773f, -0.990799f, -0.990825f, -0.990851f, -0.990877f,
- -0.990903f, -0.990928f, -0.990954f, -0.990980f, -0.991006f, -0.991031f, -0.991057f, -0.991082f,
- -0.991108f, -0.991133f, -0.991159f, -0.991184f, -0.991210f, -0.991235f, -0.991260f, -0.991286f,
- -0.991311f, -0.991336f, -0.991361f, -0.991386f, -0.991411f, -0.991437f, -0.991462f, -0.991487f,
- -0.991511f, -0.991536f, -0.991561f, -0.991586f, -0.991611f, -0.991636f, -0.991660f, -0.991685f,
- -0.991710f, -0.991734f, -0.991759f, -0.991783f, -0.991808f, -0.991832f, -0.991857f, -0.991881f,
- -0.991906f, -0.991930f, -0.991954f, -0.991979f, -0.992003f, -0.992027f, -0.992051f, -0.992075f,
- -0.992099f, -0.992123f, -0.992147f, -0.992171f, -0.992195f, -0.992219f, -0.992243f, -0.992267f,
- -0.992291f, -0.992314f, -0.992338f, -0.992362f, -0.992385f, -0.992409f, -0.992433f, -0.992456f,
- -0.992480f, -0.992503f, -0.992526f, -0.992550f, -0.992573f, -0.992596f, -0.992620f, -0.992643f,
- -0.992666f, -0.992689f, -0.992712f, -0.992736f, -0.992759f, -0.992782f, -0.992805f, -0.992828f,
- -0.992850f, -0.992873f, -0.992896f, -0.992919f, -0.992942f, -0.992964f, -0.992987f, -0.993010f,
- -0.993032f, -0.993055f, -0.993077f, -0.993100f, -0.993122f, -0.993145f, -0.993167f, -0.993190f,
- -0.993212f, -0.993234f, -0.993257f, -0.993279f, -0.993301f, -0.993323f, -0.993345f, -0.993367f,
- -0.993389f, -0.993411f, -0.993433f, -0.993455f, -0.993477f, -0.993499f, -0.993521f, -0.993542f,
- -0.993564f, -0.993586f, -0.993608f, -0.993629f, -0.993651f, -0.993672f, -0.993694f, -0.993715f,
- -0.993737f, -0.993758f, -0.993779f, -0.993801f, -0.993822f, -0.993843f, -0.993865f, -0.993886f,
- -0.993907f, -0.993928f, -0.993949f, -0.993970f, -0.993991f, -0.994012f, -0.994033f, -0.994054f,
- -0.994075f, -0.994096f, -0.994116f, -0.994137f, -0.994158f, -0.994179f, -0.994199f, -0.994220f,
- -0.994240f, -0.994261f, -0.994281f, -0.994302f, -0.994322f, -0.994343f, -0.994363f, -0.994383f,
- -0.994404f, -0.994424f, -0.994444f, -0.994464f, -0.994484f, -0.994505f, -0.994525f, -0.994545f,
- -0.994565f, -0.994585f, -0.994604f, -0.994624f, -0.994644f, -0.994664f, -0.994684f, -0.994703f,
- -0.994723f, -0.994743f, -0.994762f, -0.994782f, -0.994802f, -0.994821f, -0.994841f, -0.994860f,
- -0.994879f, -0.994899f, -0.994918f, -0.994937f, -0.994957f, -0.994976f, -0.994995f, -0.995014f,
- -0.995033f, -0.995052f, -0.995071f, -0.995090f, -0.995109f, -0.995128f, -0.995147f, -0.995166f,
- -0.995185f, -0.995203f, -0.995222f, -0.995241f, -0.995260f, -0.995278f, -0.995297f, -0.995315f,
- -0.995334f, -0.995352f, -0.995371f, -0.995389f, -0.995408f, -0.995426f, -0.995444f, -0.995463f,
- -0.995481f, -0.995499f, -0.995517f, -0.995535f, -0.995553f, -0.995571f, -0.995589f, -0.995607f,
- -0.995625f, -0.995643f, -0.995661f, -0.995679f, -0.995697f, -0.995714f, -0.995732f, -0.995750f,
- -0.995767f, -0.995785f, -0.995803f, -0.995820f, -0.995838f, -0.995855f, -0.995872f, -0.995890f,
- -0.995907f, -0.995925f, -0.995942f, -0.995959f, -0.995976f, -0.995993f, -0.996011f, -0.996028f,
- -0.996045f, -0.996062f, -0.996079f, -0.996096f, -0.996113f, -0.996129f, -0.996146f, -0.996163f,
- -0.996180f, -0.996197f, -0.996213f, -0.996230f, -0.996247f, -0.996263f, -0.996280f, -0.996296f,
- -0.996313f, -0.996329f, -0.996345f, -0.996362f, -0.996378f, -0.996394f, -0.996411f, -0.996427f,
- -0.996443f, -0.996459f, -0.996475f, -0.996491f, -0.996507f, -0.996523f, -0.996539f, -0.996555f,
- -0.996571f, -0.996587f, -0.996603f, -0.996619f, -0.996634f, -0.996650f, -0.996666f, -0.996681f,
- -0.996697f, -0.996712f, -0.996728f, -0.996743f, -0.996759f, -0.996774f, -0.996790f, -0.996805f,
- -0.996820f, -0.996836f, -0.996851f, -0.996866f, -0.996881f, -0.996896f, -0.996911f, -0.996926f,
- -0.996941f, -0.996956f, -0.996971f, -0.996986f, -0.997001f, -0.997016f, -0.997031f, -0.997045f,
- -0.997060f, -0.997075f, -0.997089f, -0.997104f, -0.997119f, -0.997133f, -0.997148f, -0.997162f,
- -0.997176f, -0.997191f, -0.997205f, -0.997219f, -0.997234f, -0.997248f, -0.997262f, -0.997276f,
- -0.997290f, -0.997305f, -0.997319f, -0.997333f, -0.997347f, -0.997361f, -0.997374f, -0.997388f,
- -0.997402f, -0.997416f, -0.997430f, -0.997443f, -0.997457f, -0.997471f, -0.997484f, -0.997498f,
- -0.997511f, -0.997525f, -0.997538f, -0.997552f, -0.997565f, -0.997579f, -0.997592f, -0.997605f,
- -0.997618f, -0.997632f, -0.997645f, -0.997658f, -0.997671f, -0.997684f, -0.997697f, -0.997710f,
- -0.997723f, -0.997736f, -0.997749f, -0.997762f, -0.997774f, -0.997787f, -0.997800f, -0.997813f,
- -0.997825f, -0.997838f, -0.997851f, -0.997863f, -0.997876f, -0.997888f, -0.997901f, -0.997913f,
- -0.997925f, -0.997938f, -0.997950f, -0.997962f, -0.997974f, -0.997987f, -0.997999f, -0.998011f,
- -0.998023f, -0.998035f, -0.998047f, -0.998059f, -0.998071f, -0.998083f, -0.998094f, -0.998106f,
- -0.998118f, -0.998130f, -0.998142f, -0.998153f, -0.998165f, -0.998176f, -0.998188f, -0.998200f,
- -0.998211f, -0.998222f, -0.998234f, -0.998245f, -0.998257f, -0.998268f, -0.998279f, -0.998290f,
- -0.998302f, -0.998313f, -0.998324f, -0.998335f, -0.998346f, -0.998357f, -0.998368f, -0.998379f,
- -0.998390f, -0.998401f, -0.998411f, -0.998422f, -0.998433f, -0.998444f, -0.998454f, -0.998465f,
- -0.998476f, -0.998486f, -0.998497f, -0.998507f, -0.998518f, -0.998528f, -0.998538f, -0.998549f,
- -0.998559f, -0.998569f, -0.998580f, -0.998590f, -0.998600f, -0.998610f, -0.998620f, -0.998630f,
- -0.998640f, -0.998650f, -0.998660f, -0.998670f, -0.998680f, -0.998690f, -0.998700f, -0.998709f,
- -0.998719f, -0.998729f, -0.998738f, -0.998748f, -0.998758f, -0.998767f, -0.998777f, -0.998786f,
- -0.998795f, -0.998805f, -0.998814f, -0.998824f, -0.998833f, -0.998842f, -0.998851f, -0.998860f,
- -0.998870f, -0.998879f, -0.998888f, -0.998897f, -0.998906f, -0.998915f, -0.998924f, -0.998932f,
- -0.998941f, -0.998950f, -0.998959f, -0.998968f, -0.998976f, -0.998985f, -0.998994f, -0.999002f,
- -0.999011f, -0.999019f, -0.999028f, -0.999036f, -0.999044f, -0.999053f, -0.999061f, -0.999069f,
- -0.999078f, -0.999086f, -0.999094f, -0.999102f, -0.999110f, -0.999118f, -0.999126f, -0.999134f,
- -0.999142f, -0.999150f, -0.999158f, -0.999166f, -0.999174f, -0.999182f, -0.999189f, -0.999197f,
- -0.999205f, -0.999212f, -0.999220f, -0.999228f, -0.999235f, -0.999243f, -0.999250f, -0.999257f,
- -0.999265f, -0.999272f, -0.999279f, -0.999287f, -0.999294f, -0.999301f, -0.999308f, -0.999315f,
- -0.999322f, -0.999329f, -0.999336f, -0.999343f, -0.999350f, -0.999357f, -0.999364f, -0.999371f,
- -0.999378f, -0.999384f, -0.999391f, -0.999398f, -0.999404f, -0.999411f, -0.999418f, -0.999424f,
- -0.999431f, -0.999437f, -0.999443f, -0.999450f, -0.999456f, -0.999462f, -0.999469f, -0.999475f,
- -0.999481f, -0.999487f, -0.999493f, -0.999500f, -0.999506f, -0.999512f, -0.999518f, -0.999524f,
- -0.999529f, -0.999535f, -0.999541f, -0.999547f, -0.999553f, -0.999558f, -0.999564f, -0.999570f,
- -0.999575f, -0.999581f, -0.999586f, -0.999592f, -0.999597f, -0.999603f, -0.999608f, -0.999614f,
- -0.999619f, -0.999624f, -0.999629f, -0.999635f, -0.999640f, -0.999645f, -0.999650f, -0.999655f,
- -0.999660f, -0.999665f, -0.999670f, -0.999675f, -0.999680f, -0.999685f, -0.999689f, -0.999694f,
- -0.999699f, -0.999704f, -0.999708f, -0.999713f, -0.999717f, -0.999722f, -0.999726f, -0.999731f,
- -0.999735f, -0.999740f, -0.999744f, -0.999748f, -0.999753f, -0.999757f, -0.999761f, -0.999765f,
- -0.999769f, -0.999774f, -0.999778f, -0.999782f, -0.999786f, -0.999790f, -0.999793f, -0.999797f,
- -0.999801f, -0.999805f, -0.999809f, -0.999812f, -0.999816f, -0.999820f, -0.999823f, -0.999827f,
- -0.999831f, -0.999834f, -0.999838f, -0.999841f, -0.999844f, -0.999848f, -0.999851f, -0.999854f,
- -0.999858f, -0.999861f, -0.999864f, -0.999867f, -0.999870f, -0.999873f, -0.999876f, -0.999879f,
- -0.999882f, -0.999885f, -0.999888f, -0.999891f, -0.999894f, -0.999897f, -0.999899f, -0.999902f,
- -0.999905f, -0.999907f, -0.999910f, -0.999913f, -0.999915f, -0.999917f, -0.999920f, -0.999922f,
- -0.999925f, -0.999927f, -0.999929f, -0.999932f, -0.999934f, -0.999936f, -0.999938f, -0.999940f,
- -0.999942f, -0.999944f, -0.999946f, -0.999948f, -0.999950f, -0.999952f, -0.999954f, -0.999956f,
- -0.999958f, -0.999959f, -0.999961f, -0.999963f, -0.999964f, -0.999966f, -0.999968f, -0.999969f,
- -0.999971f, -0.999972f, -0.999973f, -0.999975f, -0.999976f, -0.999977f, -0.999979f, -0.999980f,
- -0.999981f, -0.999982f, -0.999983f, -0.999985f, -0.999986f, -0.999987f, -0.999988f, -0.999988f,
- -0.999989f, -0.999990f, -0.999991f, -0.999992f, -0.999993f, -0.999993f, -0.999994f, -0.999995f,
- -0.999995f, -0.999996f, -0.999996f, -0.999997f, -0.999997f, -0.999998f, -0.999998f, -0.999999f,
- -0.999999f, -0.999999f, -0.999999f, -1.000000f, -1.000000f, -1.000000f, -1.000000f, -1.000000
-};
-
-static const float sinTable65536[32768] = {
- 0.000000f, 0.000096f, 0.000192f, 0.000288f, 0.000383f, 0.000479f, 0.000575f, 0.000671f,
- 0.000767f, 0.000863f, 0.000959f, 0.001055f, 0.001150f, 0.001246f, 0.001342f, 0.001438f,
- 0.001534f, 0.001630f, 0.001726f, 0.001822f, 0.001917f, 0.002013f, 0.002109f, 0.002205f,
- 0.002301f, 0.002397f, 0.002493f, 0.002589f, 0.002684f, 0.002780f, 0.002876f, 0.002972f,
- 0.003068f, 0.003164f, 0.003260f, 0.003356f, 0.003451f, 0.003547f, 0.003643f, 0.003739f,
- 0.003835f, 0.003931f, 0.004027f, 0.004123f, 0.004218f, 0.004314f, 0.004410f, 0.004506f,
- 0.004602f, 0.004698f, 0.004794f, 0.004890f, 0.004985f, 0.005081f, 0.005177f, 0.005273f,
- 0.005369f, 0.005465f, 0.005561f, 0.005657f, 0.005752f, 0.005848f, 0.005944f, 0.006040f,
- 0.006136f, 0.006232f, 0.006328f, 0.006424f, 0.006519f, 0.006615f, 0.006711f, 0.006807f,
- 0.006903f, 0.006999f, 0.007095f, 0.007190f, 0.007286f, 0.007382f, 0.007478f, 0.007574f,
- 0.007670f, 0.007766f, 0.007862f, 0.007957f, 0.008053f, 0.008149f, 0.008245f, 0.008341f,
- 0.008437f, 0.008533f, 0.008629f, 0.008724f, 0.008820f, 0.008916f, 0.009012f, 0.009108f,
- 0.009204f, 0.009300f, 0.009395f, 0.009491f, 0.009587f, 0.009683f, 0.009779f, 0.009875f,
- 0.009971f, 0.010067f, 0.010162f, 0.010258f, 0.010354f, 0.010450f, 0.010546f, 0.010642f,
- 0.010738f, 0.010834f, 0.010929f, 0.011025f, 0.011121f, 0.011217f, 0.011313f, 0.011409f,
- 0.011505f, 0.011600f, 0.011696f, 0.011792f, 0.011888f, 0.011984f, 0.012080f, 0.012176f,
- 0.012272f, 0.012367f, 0.012463f, 0.012559f, 0.012655f, 0.012751f, 0.012847f, 0.012943f,
- 0.013038f, 0.013134f, 0.013230f, 0.013326f, 0.013422f, 0.013518f, 0.013614f, 0.013710f,
- 0.013805f, 0.013901f, 0.013997f, 0.014093f, 0.014189f, 0.014285f, 0.014381f, 0.014476f,
- 0.014572f, 0.014668f, 0.014764f, 0.014860f, 0.014956f, 0.015052f, 0.015147f, 0.015243f,
- 0.015339f, 0.015435f, 0.015531f, 0.015627f, 0.015723f, 0.015819f, 0.015914f, 0.016010f,
- 0.016106f, 0.016202f, 0.016298f, 0.016394f, 0.016490f, 0.016585f, 0.016681f, 0.016777f,
- 0.016873f, 0.016969f, 0.017065f, 0.017161f, 0.017256f, 0.017352f, 0.017448f, 0.017544f,
- 0.017640f, 0.017736f, 0.017832f, 0.017927f, 0.018023f, 0.018119f, 0.018215f, 0.018311f,
- 0.018407f, 0.018503f, 0.018598f, 0.018694f, 0.018790f, 0.018886f, 0.018982f, 0.019078f,
- 0.019174f, 0.019269f, 0.019365f, 0.019461f, 0.019557f, 0.019653f, 0.019749f, 0.019845f,
- 0.019940f, 0.020036f, 0.020132f, 0.020228f, 0.020324f, 0.020420f, 0.020516f, 0.020611f,
- 0.020707f, 0.020803f, 0.020899f, 0.020995f, 0.021091f, 0.021187f, 0.021282f, 0.021378f,
- 0.021474f, 0.021570f, 0.021666f, 0.021762f, 0.021857f, 0.021953f, 0.022049f, 0.022145f,
- 0.022241f, 0.022337f, 0.022433f, 0.022528f, 0.022624f, 0.022720f, 0.022816f, 0.022912f,
- 0.023008f, 0.023104f, 0.023199f, 0.023295f, 0.023391f, 0.023487f, 0.023583f, 0.023679f,
- 0.023774f, 0.023870f, 0.023966f, 0.024062f, 0.024158f, 0.024254f, 0.024350f, 0.024445f,
- 0.024541f, 0.024637f, 0.024733f, 0.024829f, 0.024925f, 0.025020f, 0.025116f, 0.025212f,
- 0.025308f, 0.025404f, 0.025500f, 0.025596f, 0.025691f, 0.025787f, 0.025883f, 0.025979f,
- 0.026075f, 0.026171f, 0.026266f, 0.026362f, 0.026458f, 0.026554f, 0.026650f, 0.026746f,
- 0.026841f, 0.026937f, 0.027033f, 0.027129f, 0.027225f, 0.027321f, 0.027416f, 0.027512f,
- 0.027608f, 0.027704f, 0.027800f, 0.027896f, 0.027991f, 0.028087f, 0.028183f, 0.028279f,
- 0.028375f, 0.028471f, 0.028567f, 0.028662f, 0.028758f, 0.028854f, 0.028950f, 0.029046f,
- 0.029142f, 0.029237f, 0.029333f, 0.029429f, 0.029525f, 0.029621f, 0.029717f, 0.029812f,
- 0.029908f, 0.030004f, 0.030100f, 0.030196f, 0.030291f, 0.030387f, 0.030483f, 0.030579f,
- 0.030675f, 0.030771f, 0.030866f, 0.030962f, 0.031058f, 0.031154f, 0.031250f, 0.031346f,
- 0.031441f, 0.031537f, 0.031633f, 0.031729f, 0.031825f, 0.031921f, 0.032016f, 0.032112f,
- 0.032208f, 0.032304f, 0.032400f, 0.032495f, 0.032591f, 0.032687f, 0.032783f, 0.032879f,
- 0.032975f, 0.033070f, 0.033166f, 0.033262f, 0.033358f, 0.033454f, 0.033550f, 0.033645f,
- 0.033741f, 0.033837f, 0.033933f, 0.034029f, 0.034124f, 0.034220f, 0.034316f, 0.034412f,
- 0.034508f, 0.034604f, 0.034699f, 0.034795f, 0.034891f, 0.034987f, 0.035083f, 0.035178f,
- 0.035274f, 0.035370f, 0.035466f, 0.035562f, 0.035657f, 0.035753f, 0.035849f, 0.035945f,
- 0.036041f, 0.036137f, 0.036232f, 0.036328f, 0.036424f, 0.036520f, 0.036616f, 0.036711f,
- 0.036807f, 0.036903f, 0.036999f, 0.037095f, 0.037190f, 0.037286f, 0.037382f, 0.037478f,
- 0.037574f, 0.037669f, 0.037765f, 0.037861f, 0.037957f, 0.038053f, 0.038149f, 0.038244f,
- 0.038340f, 0.038436f, 0.038532f, 0.038628f, 0.038723f, 0.038819f, 0.038915f, 0.039011f,
- 0.039107f, 0.039202f, 0.039298f, 0.039394f, 0.039490f, 0.039586f, 0.039681f, 0.039777f,
- 0.039873f, 0.039969f, 0.040065f, 0.040160f, 0.040256f, 0.040352f, 0.040448f, 0.040544f,
- 0.040639f, 0.040735f, 0.040831f, 0.040927f, 0.041022f, 0.041118f, 0.041214f, 0.041310f,
- 0.041406f, 0.041501f, 0.041597f, 0.041693f, 0.041789f, 0.041885f, 0.041980f, 0.042076f,
- 0.042172f, 0.042268f, 0.042364f, 0.042459f, 0.042555f, 0.042651f, 0.042747f, 0.042842f,
- 0.042938f, 0.043034f, 0.043130f, 0.043226f, 0.043321f, 0.043417f, 0.043513f, 0.043609f,
- 0.043705f, 0.043800f, 0.043896f, 0.043992f, 0.044088f, 0.044183f, 0.044279f, 0.044375f,
- 0.044471f, 0.044567f, 0.044662f, 0.044758f, 0.044854f, 0.044950f, 0.045045f, 0.045141f,
- 0.045237f, 0.045333f, 0.045429f, 0.045524f, 0.045620f, 0.045716f, 0.045812f, 0.045907f,
- 0.046003f, 0.046099f, 0.046195f, 0.046290f, 0.046386f, 0.046482f, 0.046578f, 0.046674f,
- 0.046769f, 0.046865f, 0.046961f, 0.047057f, 0.047152f, 0.047248f, 0.047344f, 0.047440f,
- 0.047535f, 0.047631f, 0.047727f, 0.047823f, 0.047919f, 0.048014f, 0.048110f, 0.048206f,
- 0.048302f, 0.048397f, 0.048493f, 0.048589f, 0.048685f, 0.048780f, 0.048876f, 0.048972f,
- 0.049068f, 0.049163f, 0.049259f, 0.049355f, 0.049451f, 0.049546f, 0.049642f, 0.049738f,
- 0.049834f, 0.049929f, 0.050025f, 0.050121f, 0.050217f, 0.050312f, 0.050408f, 0.050504f,
- 0.050600f, 0.050696f, 0.050791f, 0.050887f, 0.050983f, 0.051078f, 0.051174f, 0.051270f,
- 0.051366f, 0.051461f, 0.051557f, 0.051653f, 0.051749f, 0.051844f, 0.051940f, 0.052036f,
- 0.052132f, 0.052227f, 0.052323f, 0.052419f, 0.052515f, 0.052610f, 0.052706f, 0.052802f,
- 0.052898f, 0.052993f, 0.053089f, 0.053185f, 0.053281f, 0.053376f, 0.053472f, 0.053568f,
- 0.053664f, 0.053759f, 0.053855f, 0.053951f, 0.054046f, 0.054142f, 0.054238f, 0.054334f,
- 0.054429f, 0.054525f, 0.054621f, 0.054717f, 0.054812f, 0.054908f, 0.055004f, 0.055100f,
- 0.055195f, 0.055291f, 0.055387f, 0.055482f, 0.055578f, 0.055674f, 0.055770f, 0.055865f,
- 0.055961f, 0.056057f, 0.056152f, 0.056248f, 0.056344f, 0.056440f, 0.056535f, 0.056631f,
- 0.056727f, 0.056823f, 0.056918f, 0.057014f, 0.057110f, 0.057205f, 0.057301f, 0.057397f,
- 0.057493f, 0.057588f, 0.057684f, 0.057780f, 0.057875f, 0.057971f, 0.058067f, 0.058163f,
- 0.058258f, 0.058354f, 0.058450f, 0.058545f, 0.058641f, 0.058737f, 0.058833f, 0.058928f,
- 0.059024f, 0.059120f, 0.059215f, 0.059311f, 0.059407f, 0.059502f, 0.059598f, 0.059694f,
- 0.059790f, 0.059885f, 0.059981f, 0.060077f, 0.060172f, 0.060268f, 0.060364f, 0.060459f,
- 0.060555f, 0.060651f, 0.060747f, 0.060842f, 0.060938f, 0.061034f, 0.061129f, 0.061225f,
- 0.061321f, 0.061416f, 0.061512f, 0.061608f, 0.061704f, 0.061799f, 0.061895f, 0.061991f,
- 0.062086f, 0.062182f, 0.062278f, 0.062373f, 0.062469f, 0.062565f, 0.062660f, 0.062756f,
- 0.062852f, 0.062947f, 0.063043f, 0.063139f, 0.063234f, 0.063330f, 0.063426f, 0.063522f,
- 0.063617f, 0.063713f, 0.063809f, 0.063904f, 0.064000f, 0.064096f, 0.064191f, 0.064287f,
- 0.064383f, 0.064478f, 0.064574f, 0.064670f, 0.064765f, 0.064861f, 0.064957f, 0.065052f,
- 0.065148f, 0.065244f, 0.065339f, 0.065435f, 0.065531f, 0.065626f, 0.065722f, 0.065818f,
- 0.065913f, 0.066009f, 0.066105f, 0.066200f, 0.066296f, 0.066392f, 0.066487f, 0.066583f,
- 0.066679f, 0.066774f, 0.066870f, 0.066966f, 0.067061f, 0.067157f, 0.067253f, 0.067348f,
- 0.067444f, 0.067540f, 0.067635f, 0.067731f, 0.067827f, 0.067922f, 0.068018f, 0.068113f,
- 0.068209f, 0.068305f, 0.068400f, 0.068496f, 0.068592f, 0.068687f, 0.068783f, 0.068879f,
- 0.068974f, 0.069070f, 0.069166f, 0.069261f, 0.069357f, 0.069453f, 0.069548f, 0.069644f,
- 0.069739f, 0.069835f, 0.069931f, 0.070026f, 0.070122f, 0.070218f, 0.070313f, 0.070409f,
- 0.070505f, 0.070600f, 0.070696f, 0.070791f, 0.070887f, 0.070983f, 0.071078f, 0.071174f,
- 0.071270f, 0.071365f, 0.071461f, 0.071557f, 0.071652f, 0.071748f, 0.071843f, 0.071939f,
- 0.072035f, 0.072130f, 0.072226f, 0.072322f, 0.072417f, 0.072513f, 0.072608f, 0.072704f,
- 0.072800f, 0.072895f, 0.072991f, 0.073086f, 0.073182f, 0.073278f, 0.073373f, 0.073469f,
- 0.073565f, 0.073660f, 0.073756f, 0.073851f, 0.073947f, 0.074043f, 0.074138f, 0.074234f,
- 0.074329f, 0.074425f, 0.074521f, 0.074616f, 0.074712f, 0.074807f, 0.074903f, 0.074999f,
- 0.075094f, 0.075190f, 0.075286f, 0.075381f, 0.075477f, 0.075572f, 0.075668f, 0.075764f,
- 0.075859f, 0.075955f, 0.076050f, 0.076146f, 0.076241f, 0.076337f, 0.076433f, 0.076528f,
- 0.076624f, 0.076719f, 0.076815f, 0.076911f, 0.077006f, 0.077102f, 0.077197f, 0.077293f,
- 0.077389f, 0.077484f, 0.077580f, 0.077675f, 0.077771f, 0.077866f, 0.077962f, 0.078058f,
- 0.078153f, 0.078249f, 0.078344f, 0.078440f, 0.078536f, 0.078631f, 0.078727f, 0.078822f,
- 0.078918f, 0.079013f, 0.079109f, 0.079205f, 0.079300f, 0.079396f, 0.079491f, 0.079587f,
- 0.079682f, 0.079778f, 0.079874f, 0.079969f, 0.080065f, 0.080160f, 0.080256f, 0.080351f,
- 0.080447f, 0.080543f, 0.080638f, 0.080734f, 0.080829f, 0.080925f, 0.081020f, 0.081116f,
- 0.081211f, 0.081307f, 0.081403f, 0.081498f, 0.081594f, 0.081689f, 0.081785f, 0.081880f,
- 0.081976f, 0.082071f, 0.082167f, 0.082263f, 0.082358f, 0.082454f, 0.082549f, 0.082645f,
- 0.082740f, 0.082836f, 0.082931f, 0.083027f, 0.083122f, 0.083218f, 0.083314f, 0.083409f,
- 0.083505f, 0.083600f, 0.083696f, 0.083791f, 0.083887f, 0.083982f, 0.084078f, 0.084173f,
- 0.084269f, 0.084364f, 0.084460f, 0.084555f, 0.084651f, 0.084747f, 0.084842f, 0.084938f,
- 0.085033f, 0.085129f, 0.085224f, 0.085320f, 0.085415f, 0.085511f, 0.085606f, 0.085702f,
- 0.085797f, 0.085893f, 0.085988f, 0.086084f, 0.086179f, 0.086275f, 0.086370f, 0.086466f,
- 0.086561f, 0.086657f, 0.086752f, 0.086848f, 0.086943f, 0.087039f, 0.087135f, 0.087230f,
- 0.087326f, 0.087421f, 0.087517f, 0.087612f, 0.087708f, 0.087803f, 0.087899f, 0.087994f,
- 0.088090f, 0.088185f, 0.088281f, 0.088376f, 0.088472f, 0.088567f, 0.088663f, 0.088758f,
- 0.088854f, 0.088949f, 0.089045f, 0.089140f, 0.089236f, 0.089331f, 0.089427f, 0.089522f,
- 0.089617f, 0.089713f, 0.089808f, 0.089904f, 0.089999f, 0.090095f, 0.090190f, 0.090286f,
- 0.090381f, 0.090477f, 0.090572f, 0.090668f, 0.090763f, 0.090859f, 0.090954f, 0.091050f,
- 0.091145f, 0.091241f, 0.091336f, 0.091432f, 0.091527f, 0.091623f, 0.091718f, 0.091813f,
- 0.091909f, 0.092004f, 0.092100f, 0.092195f, 0.092291f, 0.092386f, 0.092482f, 0.092577f,
- 0.092673f, 0.092768f, 0.092864f, 0.092959f, 0.093055f, 0.093150f, 0.093245f, 0.093341f,
- 0.093436f, 0.093532f, 0.093627f, 0.093723f, 0.093818f, 0.093914f, 0.094009f, 0.094104f,
- 0.094200f, 0.094295f, 0.094391f, 0.094486f, 0.094582f, 0.094677f, 0.094773f, 0.094868f,
- 0.094963f, 0.095059f, 0.095154f, 0.095250f, 0.095345f, 0.095441f, 0.095536f, 0.095632f,
- 0.095727f, 0.095822f, 0.095918f, 0.096013f, 0.096109f, 0.096204f, 0.096300f, 0.096395f,
- 0.096490f, 0.096586f, 0.096681f, 0.096777f, 0.096872f, 0.096968f, 0.097063f, 0.097158f,
- 0.097254f, 0.097349f, 0.097445f, 0.097540f, 0.097635f, 0.097731f, 0.097826f, 0.097922f,
- 0.098017f, 0.098113f, 0.098208f, 0.098303f, 0.098399f, 0.098494f, 0.098590f, 0.098685f,
- 0.098780f, 0.098876f, 0.098971f, 0.099067f, 0.099162f, 0.099257f, 0.099353f, 0.099448f,
- 0.099544f, 0.099639f, 0.099734f, 0.099830f, 0.099925f, 0.100021f, 0.100116f, 0.100211f,
- 0.100307f, 0.100402f, 0.100498f, 0.100593f, 0.100688f, 0.100784f, 0.100879f, 0.100974f,
- 0.101070f, 0.101165f, 0.101261f, 0.101356f, 0.101451f, 0.101547f, 0.101642f, 0.101738f,
- 0.101833f, 0.101928f, 0.102024f, 0.102119f, 0.102214f, 0.102310f, 0.102405f, 0.102500f,
- 0.102596f, 0.102691f, 0.102787f, 0.102882f, 0.102977f, 0.103073f, 0.103168f, 0.103263f,
- 0.103359f, 0.103454f, 0.103550f, 0.103645f, 0.103740f, 0.103836f, 0.103931f, 0.104026f,
- 0.104122f, 0.104217f, 0.104312f, 0.104408f, 0.104503f, 0.104598f, 0.104694f, 0.104789f,
- 0.104884f, 0.104980f, 0.105075f, 0.105170f, 0.105266f, 0.105361f, 0.105456f, 0.105552f,
- 0.105647f, 0.105742f, 0.105838f, 0.105933f, 0.106028f, 0.106124f, 0.106219f, 0.106314f,
- 0.106410f, 0.106505f, 0.106600f, 0.106696f, 0.106791f, 0.106886f, 0.106982f, 0.107077f,
- 0.107172f, 0.107268f, 0.107363f, 0.107458f, 0.107554f, 0.107649f, 0.107744f, 0.107840f,
- 0.107935f, 0.108030f, 0.108126f, 0.108221f, 0.108316f, 0.108412f, 0.108507f, 0.108602f,
- 0.108697f, 0.108793f, 0.108888f, 0.108983f, 0.109079f, 0.109174f, 0.109269f, 0.109365f,
- 0.109460f, 0.109555f, 0.109650f, 0.109746f, 0.109841f, 0.109936f, 0.110032f, 0.110127f,
- 0.110222f, 0.110317f, 0.110413f, 0.110508f, 0.110603f, 0.110699f, 0.110794f, 0.110889f,
- 0.110984f, 0.111080f, 0.111175f, 0.111270f, 0.111366f, 0.111461f, 0.111556f, 0.111651f,
- 0.111747f, 0.111842f, 0.111937f, 0.112033f, 0.112128f, 0.112223f, 0.112318f, 0.112414f,
- 0.112509f, 0.112604f, 0.112699f, 0.112795f, 0.112890f, 0.112985f, 0.113080f, 0.113176f,
- 0.113271f, 0.113366f, 0.113461f, 0.113557f, 0.113652f, 0.113747f, 0.113842f, 0.113938f,
- 0.114033f, 0.114128f, 0.114223f, 0.114319f, 0.114414f, 0.114509f, 0.114604f, 0.114700f,
- 0.114795f, 0.114890f, 0.114985f, 0.115081f, 0.115176f, 0.115271f, 0.115366f, 0.115462f,
- 0.115557f, 0.115652f, 0.115747f, 0.115842f, 0.115938f, 0.116033f, 0.116128f, 0.116223f,
- 0.116319f, 0.116414f, 0.116509f, 0.116604f, 0.116700f, 0.116795f, 0.116890f, 0.116985f,
- 0.117080f, 0.117176f, 0.117271f, 0.117366f, 0.117461f, 0.117556f, 0.117652f, 0.117747f,
- 0.117842f, 0.117937f, 0.118032f, 0.118128f, 0.118223f, 0.118318f, 0.118413f, 0.118508f,
- 0.118604f, 0.118699f, 0.118794f, 0.118889f, 0.118984f, 0.119080f, 0.119175f, 0.119270f,
- 0.119365f, 0.119460f, 0.119556f, 0.119651f, 0.119746f, 0.119841f, 0.119936f, 0.120032f,
- 0.120127f, 0.120222f, 0.120317f, 0.120412f, 0.120507f, 0.120603f, 0.120698f, 0.120793f,
- 0.120888f, 0.120983f, 0.121078f, 0.121174f, 0.121269f, 0.121364f, 0.121459f, 0.121554f,
- 0.121649f, 0.121745f, 0.121840f, 0.121935f, 0.122030f, 0.122125f, 0.122220f, 0.122316f,
- 0.122411f, 0.122506f, 0.122601f, 0.122696f, 0.122791f, 0.122886f, 0.122982f, 0.123077f,
- 0.123172f, 0.123267f, 0.123362f, 0.123457f, 0.123552f, 0.123648f, 0.123743f, 0.123838f,
- 0.123933f, 0.124028f, 0.124123f, 0.124218f, 0.124314f, 0.124409f, 0.124504f, 0.124599f,
- 0.124694f, 0.124789f, 0.124884f, 0.124979f, 0.125075f, 0.125170f, 0.125265f, 0.125360f,
- 0.125455f, 0.125550f, 0.125645f, 0.125740f, 0.125835f, 0.125931f, 0.126026f, 0.126121f,
- 0.126216f, 0.126311f, 0.126406f, 0.126501f, 0.126596f, 0.126691f, 0.126787f, 0.126882f,
- 0.126977f, 0.127072f, 0.127167f, 0.127262f, 0.127357f, 0.127452f, 0.127547f, 0.127642f,
- 0.127737f, 0.127833f, 0.127928f, 0.128023f, 0.128118f, 0.128213f, 0.128308f, 0.128403f,
- 0.128498f, 0.128593f, 0.128688f, 0.128783f, 0.128878f, 0.128973f, 0.129069f, 0.129164f,
- 0.129259f, 0.129354f, 0.129449f, 0.129544f, 0.129639f, 0.129734f, 0.129829f, 0.129924f,
- 0.130019f, 0.130114f, 0.130209f, 0.130304f, 0.130399f, 0.130495f, 0.130590f, 0.130685f,
- 0.130780f, 0.130875f, 0.130970f, 0.131065f, 0.131160f, 0.131255f, 0.131350f, 0.131445f,
- 0.131540f, 0.131635f, 0.131730f, 0.131825f, 0.131920f, 0.132015f, 0.132110f, 0.132205f,
- 0.132300f, 0.132395f, 0.132490f, 0.132585f, 0.132680f, 0.132775f, 0.132870f, 0.132966f,
- 0.133061f, 0.133156f, 0.133251f, 0.133346f, 0.133441f, 0.133536f, 0.133631f, 0.133726f,
- 0.133821f, 0.133916f, 0.134011f, 0.134106f, 0.134201f, 0.134296f, 0.134391f, 0.134486f,
- 0.134581f, 0.134676f, 0.134771f, 0.134866f, 0.134961f, 0.135056f, 0.135151f, 0.135246f,
- 0.135341f, 0.135436f, 0.135531f, 0.135626f, 0.135721f, 0.135816f, 0.135911f, 0.136006f,
- 0.136101f, 0.136196f, 0.136291f, 0.136386f, 0.136480f, 0.136575f, 0.136670f, 0.136765f,
- 0.136860f, 0.136955f, 0.137050f, 0.137145f, 0.137240f, 0.137335f, 0.137430f, 0.137525f,
- 0.137620f, 0.137715f, 0.137810f, 0.137905f, 0.138000f, 0.138095f, 0.138190f, 0.138285f,
- 0.138380f, 0.138475f, 0.138570f, 0.138665f, 0.138760f, 0.138855f, 0.138949f, 0.139044f,
- 0.139139f, 0.139234f, 0.139329f, 0.139424f, 0.139519f, 0.139614f, 0.139709f, 0.139804f,
- 0.139899f, 0.139994f, 0.140089f, 0.140184f, 0.140279f, 0.140373f, 0.140468f, 0.140563f,
- 0.140658f, 0.140753f, 0.140848f, 0.140943f, 0.141038f, 0.141133f, 0.141228f, 0.141323f,
- 0.141418f, 0.141512f, 0.141607f, 0.141702f, 0.141797f, 0.141892f, 0.141987f, 0.142082f,
- 0.142177f, 0.142272f, 0.142367f, 0.142461f, 0.142556f, 0.142651f, 0.142746f, 0.142841f,
- 0.142936f, 0.143031f, 0.143126f, 0.143221f, 0.143316f, 0.143410f, 0.143505f, 0.143600f,
- 0.143695f, 0.143790f, 0.143885f, 0.143980f, 0.144075f, 0.144169f, 0.144264f, 0.144359f,
- 0.144454f, 0.144549f, 0.144644f, 0.144739f, 0.144833f, 0.144928f, 0.145023f, 0.145118f,
- 0.145213f, 0.145308f, 0.145403f, 0.145497f, 0.145592f, 0.145687f, 0.145782f, 0.145877f,
- 0.145972f, 0.146067f, 0.146161f, 0.146256f, 0.146351f, 0.146446f, 0.146541f, 0.146636f,
- 0.146730f, 0.146825f, 0.146920f, 0.147015f, 0.147110f, 0.147205f, 0.147299f, 0.147394f,
- 0.147489f, 0.147584f, 0.147679f, 0.147774f, 0.147868f, 0.147963f, 0.148058f, 0.148153f,
- 0.148248f, 0.148342f, 0.148437f, 0.148532f, 0.148627f, 0.148722f, 0.148817f, 0.148911f,
- 0.149006f, 0.149101f, 0.149196f, 0.149291f, 0.149385f, 0.149480f, 0.149575f, 0.149670f,
- 0.149765f, 0.149859f, 0.149954f, 0.150049f, 0.150144f, 0.150238f, 0.150333f, 0.150428f,
- 0.150523f, 0.150618f, 0.150712f, 0.150807f, 0.150902f, 0.150997f, 0.151092f, 0.151186f,
- 0.151281f, 0.151376f, 0.151471f, 0.151565f, 0.151660f, 0.151755f, 0.151850f, 0.151944f,
- 0.152039f, 0.152134f, 0.152229f, 0.152323f, 0.152418f, 0.152513f, 0.152608f, 0.152702f,
- 0.152797f, 0.152892f, 0.152987f, 0.153081f, 0.153176f, 0.153271f, 0.153366f, 0.153460f,
- 0.153555f, 0.153650f, 0.153745f, 0.153839f, 0.153934f, 0.154029f, 0.154124f, 0.154218f,
- 0.154313f, 0.154408f, 0.154502f, 0.154597f, 0.154692f, 0.154787f, 0.154881f, 0.154976f,
- 0.155071f, 0.155165f, 0.155260f, 0.155355f, 0.155450f, 0.155544f, 0.155639f, 0.155734f,
- 0.155828f, 0.155923f, 0.156018f, 0.156112f, 0.156207f, 0.156302f, 0.156397f, 0.156491f,
- 0.156586f, 0.156681f, 0.156775f, 0.156870f, 0.156965f, 0.157059f, 0.157154f, 0.157249f,
- 0.157343f, 0.157438f, 0.157533f, 0.157627f, 0.157722f, 0.157817f, 0.157912f, 0.158006f,
- 0.158101f, 0.158196f, 0.158290f, 0.158385f, 0.158480f, 0.158574f, 0.158669f, 0.158763f,
- 0.158858f, 0.158953f, 0.159047f, 0.159142f, 0.159237f, 0.159331f, 0.159426f, 0.159521f,
- 0.159615f, 0.159710f, 0.159805f, 0.159899f, 0.159994f, 0.160089f, 0.160183f, 0.160278f,
- 0.160372f, 0.160467f, 0.160562f, 0.160656f, 0.160751f, 0.160846f, 0.160940f, 0.161035f,
- 0.161129f, 0.161224f, 0.161319f, 0.161413f, 0.161508f, 0.161603f, 0.161697f, 0.161792f,
- 0.161886f, 0.161981f, 0.162076f, 0.162170f, 0.162265f, 0.162359f, 0.162454f, 0.162549f,
- 0.162643f, 0.162738f, 0.162832f, 0.162927f, 0.163022f, 0.163116f, 0.163211f, 0.163305f,
- 0.163400f, 0.163495f, 0.163589f, 0.163684f, 0.163778f, 0.163873f, 0.163967f, 0.164062f,
- 0.164157f, 0.164251f, 0.164346f, 0.164440f, 0.164535f, 0.164629f, 0.164724f, 0.164819f,
- 0.164913f, 0.165008f, 0.165102f, 0.165197f, 0.165291f, 0.165386f, 0.165480f, 0.165575f,
- 0.165670f, 0.165764f, 0.165859f, 0.165953f, 0.166048f, 0.166142f, 0.166237f, 0.166331f,
- 0.166426f, 0.166520f, 0.166615f, 0.166710f, 0.166804f, 0.166899f, 0.166993f, 0.167088f,
- 0.167182f, 0.167277f, 0.167371f, 0.167466f, 0.167560f, 0.167655f, 0.167749f, 0.167844f,
- 0.167938f, 0.168033f, 0.168127f, 0.168222f, 0.168316f, 0.168411f, 0.168505f, 0.168600f,
- 0.168694f, 0.168789f, 0.168883f, 0.168978f, 0.169072f, 0.169167f, 0.169261f, 0.169356f,
- 0.169450f, 0.169545f, 0.169639f, 0.169734f, 0.169828f, 0.169923f, 0.170017f, 0.170112f,
- 0.170206f, 0.170301f, 0.170395f, 0.170490f, 0.170584f, 0.170678f, 0.170773f, 0.170867f,
- 0.170962f, 0.171056f, 0.171151f, 0.171245f, 0.171340f, 0.171434f, 0.171529f, 0.171623f,
- 0.171718f, 0.171812f, 0.171906f, 0.172001f, 0.172095f, 0.172190f, 0.172284f, 0.172379f,
- 0.172473f, 0.172568f, 0.172662f, 0.172756f, 0.172851f, 0.172945f, 0.173040f, 0.173134f,
- 0.173229f, 0.173323f, 0.173417f, 0.173512f, 0.173606f, 0.173701f, 0.173795f, 0.173889f,
- 0.173984f, 0.174078f, 0.174173f, 0.174267f, 0.174362f, 0.174456f, 0.174550f, 0.174645f,
- 0.174739f, 0.174834f, 0.174928f, 0.175022f, 0.175117f, 0.175211f, 0.175305f, 0.175400f,
- 0.175494f, 0.175589f, 0.175683f, 0.175777f, 0.175872f, 0.175966f, 0.176061f, 0.176155f,
- 0.176249f, 0.176344f, 0.176438f, 0.176532f, 0.176627f, 0.176721f, 0.176815f, 0.176910f,
- 0.177004f, 0.177099f, 0.177193f, 0.177287f, 0.177382f, 0.177476f, 0.177570f, 0.177665f,
- 0.177759f, 0.177853f, 0.177948f, 0.178042f, 0.178136f, 0.178231f, 0.178325f, 0.178419f,
- 0.178514f, 0.178608f, 0.178702f, 0.178797f, 0.178891f, 0.178985f, 0.179080f, 0.179174f,
- 0.179268f, 0.179363f, 0.179457f, 0.179551f, 0.179646f, 0.179740f, 0.179834f, 0.179929f,
- 0.180023f, 0.180117f, 0.180212f, 0.180306f, 0.180400f, 0.180494f, 0.180589f, 0.180683f,
- 0.180777f, 0.180872f, 0.180966f, 0.181060f, 0.181154f, 0.181249f, 0.181343f, 0.181437f,
- 0.181532f, 0.181626f, 0.181720f, 0.181814f, 0.181909f, 0.182003f, 0.182097f, 0.182192f,
- 0.182286f, 0.182380f, 0.182474f, 0.182569f, 0.182663f, 0.182757f, 0.182851f, 0.182946f,
- 0.183040f, 0.183134f, 0.183228f, 0.183323f, 0.183417f, 0.183511f, 0.183605f, 0.183700f,
- 0.183794f, 0.183888f, 0.183982f, 0.184077f, 0.184171f, 0.184265f, 0.184359f, 0.184454f,
- 0.184548f, 0.184642f, 0.184736f, 0.184830f, 0.184925f, 0.185019f, 0.185113f, 0.185207f,
- 0.185301f, 0.185396f, 0.185490f, 0.185584f, 0.185678f, 0.185773f, 0.185867f, 0.185961f,
- 0.186055f, 0.186149f, 0.186244f, 0.186338f, 0.186432f, 0.186526f, 0.186620f, 0.186715f,
- 0.186809f, 0.186903f, 0.186997f, 0.187091f, 0.187185f, 0.187280f, 0.187374f, 0.187468f,
- 0.187562f, 0.187656f, 0.187750f, 0.187845f, 0.187939f, 0.188033f, 0.188127f, 0.188221f,
- 0.188315f, 0.188410f, 0.188504f, 0.188598f, 0.188692f, 0.188786f, 0.188880f, 0.188975f,
- 0.189069f, 0.189163f, 0.189257f, 0.189351f, 0.189445f, 0.189539f, 0.189634f, 0.189728f,
- 0.189822f, 0.189916f, 0.190010f, 0.190104f, 0.190198f, 0.190292f, 0.190387f, 0.190481f,
- 0.190575f, 0.190669f, 0.190763f, 0.190857f, 0.190951f, 0.191045f, 0.191139f, 0.191234f,
- 0.191328f, 0.191422f, 0.191516f, 0.191610f, 0.191704f, 0.191798f, 0.191892f, 0.191986f,
- 0.192080f, 0.192174f, 0.192269f, 0.192363f, 0.192457f, 0.192551f, 0.192645f, 0.192739f,
- 0.192833f, 0.192927f, 0.193021f, 0.193115f, 0.193209f, 0.193303f, 0.193397f, 0.193492f,
- 0.193586f, 0.193680f, 0.193774f, 0.193868f, 0.193962f, 0.194056f, 0.194150f, 0.194244f,
- 0.194338f, 0.194432f, 0.194526f, 0.194620f, 0.194714f, 0.194808f, 0.194902f, 0.194996f,
- 0.195090f, 0.195184f, 0.195278f, 0.195372f, 0.195466f, 0.195560f, 0.195654f, 0.195748f,
- 0.195843f, 0.195937f, 0.196031f, 0.196125f, 0.196219f, 0.196313f, 0.196407f, 0.196501f,
- 0.196595f, 0.196689f, 0.196783f, 0.196877f, 0.196971f, 0.197065f, 0.197159f, 0.197253f,
- 0.197347f, 0.197441f, 0.197535f, 0.197629f, 0.197722f, 0.197816f, 0.197910f, 0.198004f,
- 0.198098f, 0.198192f, 0.198286f, 0.198380f, 0.198474f, 0.198568f, 0.198662f, 0.198756f,
- 0.198850f, 0.198944f, 0.199038f, 0.199132f, 0.199226f, 0.199320f, 0.199414f, 0.199508f,
- 0.199602f, 0.199696f, 0.199790f, 0.199884f, 0.199978f, 0.200071f, 0.200165f, 0.200259f,
- 0.200353f, 0.200447f, 0.200541f, 0.200635f, 0.200729f, 0.200823f, 0.200917f, 0.201011f,
- 0.201105f, 0.201199f, 0.201292f, 0.201386f, 0.201480f, 0.201574f, 0.201668f, 0.201762f,
- 0.201856f, 0.201950f, 0.202044f, 0.202138f, 0.202231f, 0.202325f, 0.202419f, 0.202513f,
- 0.202607f, 0.202701f, 0.202795f, 0.202889f, 0.202983f, 0.203076f, 0.203170f, 0.203264f,
- 0.203358f, 0.203452f, 0.203546f, 0.203640f, 0.203734f, 0.203827f, 0.203921f, 0.204015f,
- 0.204109f, 0.204203f, 0.204297f, 0.204391f, 0.204484f, 0.204578f, 0.204672f, 0.204766f,
- 0.204860f, 0.204954f, 0.205047f, 0.205141f, 0.205235f, 0.205329f, 0.205423f, 0.205517f,
- 0.205610f, 0.205704f, 0.205798f, 0.205892f, 0.205986f, 0.206080f, 0.206173f, 0.206267f,
- 0.206361f, 0.206455f, 0.206549f, 0.206642f, 0.206736f, 0.206830f, 0.206924f, 0.207018f,
- 0.207111f, 0.207205f, 0.207299f, 0.207393f, 0.207487f, 0.207580f, 0.207674f, 0.207768f,
- 0.207862f, 0.207955f, 0.208049f, 0.208143f, 0.208237f, 0.208331f, 0.208424f, 0.208518f,
- 0.208612f, 0.208706f, 0.208799f, 0.208893f, 0.208987f, 0.209081f, 0.209174f, 0.209268f,
- 0.209362f, 0.209456f, 0.209549f, 0.209643f, 0.209737f, 0.209831f, 0.209924f, 0.210018f,
- 0.210112f, 0.210206f, 0.210299f, 0.210393f, 0.210487f, 0.210580f, 0.210674f, 0.210768f,
- 0.210862f, 0.210955f, 0.211049f, 0.211143f, 0.211237f, 0.211330f, 0.211424f, 0.211518f,
- 0.211611f, 0.211705f, 0.211799f, 0.211892f, 0.211986f, 0.212080f, 0.212174f, 0.212267f,
- 0.212361f, 0.212455f, 0.212548f, 0.212642f, 0.212736f, 0.212829f, 0.212923f, 0.213017f,
- 0.213110f, 0.213204f, 0.213298f, 0.213391f, 0.213485f, 0.213579f, 0.213672f, 0.213766f,
- 0.213860f, 0.213953f, 0.214047f, 0.214141f, 0.214234f, 0.214328f, 0.214422f, 0.214515f,
- 0.214609f, 0.214702f, 0.214796f, 0.214890f, 0.214983f, 0.215077f, 0.215171f, 0.215264f,
- 0.215358f, 0.215451f, 0.215545f, 0.215639f, 0.215732f, 0.215826f, 0.215920f, 0.216013f,
- 0.216107f, 0.216200f, 0.216294f, 0.216388f, 0.216481f, 0.216575f, 0.216668f, 0.216762f,
- 0.216856f, 0.216949f, 0.217043f, 0.217136f, 0.217230f, 0.217324f, 0.217417f, 0.217511f,
- 0.217604f, 0.217698f, 0.217791f, 0.217885f, 0.217979f, 0.218072f, 0.218166f, 0.218259f,
- 0.218353f, 0.218446f, 0.218540f, 0.218633f, 0.218727f, 0.218821f, 0.218914f, 0.219008f,
- 0.219101f, 0.219195f, 0.219288f, 0.219382f, 0.219475f, 0.219569f, 0.219662f, 0.219756f,
- 0.219850f, 0.219943f, 0.220037f, 0.220130f, 0.220224f, 0.220317f, 0.220411f, 0.220504f,
- 0.220598f, 0.220691f, 0.220785f, 0.220878f, 0.220972f, 0.221065f, 0.221159f, 0.221252f,
- 0.221346f, 0.221439f, 0.221533f, 0.221626f, 0.221720f, 0.221813f, 0.221907f, 0.222000f,
- 0.222094f, 0.222187f, 0.222281f, 0.222374f, 0.222468f, 0.222561f, 0.222654f, 0.222748f,
- 0.222841f, 0.222935f, 0.223028f, 0.223122f, 0.223215f, 0.223309f, 0.223402f, 0.223496f,
- 0.223589f, 0.223682f, 0.223776f, 0.223869f, 0.223963f, 0.224056f, 0.224150f, 0.224243f,
- 0.224337f, 0.224430f, 0.224523f, 0.224617f, 0.224710f, 0.224804f, 0.224897f, 0.224991f,
- 0.225084f, 0.225177f, 0.225271f, 0.225364f, 0.225458f, 0.225551f, 0.225644f, 0.225738f,
- 0.225831f, 0.225925f, 0.226018f, 0.226111f, 0.226205f, 0.226298f, 0.226391f, 0.226485f,
- 0.226578f, 0.226672f, 0.226765f, 0.226858f, 0.226952f, 0.227045f, 0.227139f, 0.227232f,
- 0.227325f, 0.227419f, 0.227512f, 0.227605f, 0.227699f, 0.227792f, 0.227885f, 0.227979f,
- 0.228072f, 0.228165f, 0.228259f, 0.228352f, 0.228445f, 0.228539f, 0.228632f, 0.228725f,
- 0.228819f, 0.228912f, 0.229005f, 0.229099f, 0.229192f, 0.229285f, 0.229379f, 0.229472f,
- 0.229565f, 0.229659f, 0.229752f, 0.229845f, 0.229939f, 0.230032f, 0.230125f, 0.230218f,
- 0.230312f, 0.230405f, 0.230498f, 0.230592f, 0.230685f, 0.230778f, 0.230872f, 0.230965f,
- 0.231058f, 0.231151f, 0.231245f, 0.231338f, 0.231431f, 0.231524f, 0.231618f, 0.231711f,
- 0.231804f, 0.231898f, 0.231991f, 0.232084f, 0.232177f, 0.232271f, 0.232364f, 0.232457f,
- 0.232550f, 0.232644f, 0.232737f, 0.232830f, 0.232923f, 0.233017f, 0.233110f, 0.233203f,
- 0.233296f, 0.233389f, 0.233483f, 0.233576f, 0.233669f, 0.233762f, 0.233856f, 0.233949f,
- 0.234042f, 0.234135f, 0.234228f, 0.234322f, 0.234415f, 0.234508f, 0.234601f, 0.234694f,
- 0.234788f, 0.234881f, 0.234974f, 0.235067f, 0.235160f, 0.235254f, 0.235347f, 0.235440f,
- 0.235533f, 0.235626f, 0.235719f, 0.235813f, 0.235906f, 0.235999f, 0.236092f, 0.236185f,
- 0.236278f, 0.236372f, 0.236465f, 0.236558f, 0.236651f, 0.236744f, 0.236837f, 0.236930f,
- 0.237024f, 0.237117f, 0.237210f, 0.237303f, 0.237396f, 0.237489f, 0.237582f, 0.237676f,
- 0.237769f, 0.237862f, 0.237955f, 0.238048f, 0.238141f, 0.238234f, 0.238327f, 0.238420f,
- 0.238514f, 0.238607f, 0.238700f, 0.238793f, 0.238886f, 0.238979f, 0.239072f, 0.239165f,
- 0.239258f, 0.239351f, 0.239445f, 0.239538f, 0.239631f, 0.239724f, 0.239817f, 0.239910f,
- 0.240003f, 0.240096f, 0.240189f, 0.240282f, 0.240375f, 0.240468f, 0.240561f, 0.240654f,
- 0.240748f, 0.240841f, 0.240934f, 0.241027f, 0.241120f, 0.241213f, 0.241306f, 0.241399f,
- 0.241492f, 0.241585f, 0.241678f, 0.241771f, 0.241864f, 0.241957f, 0.242050f, 0.242143f,
- 0.242236f, 0.242329f, 0.242422f, 0.242515f, 0.242608f, 0.242701f, 0.242794f, 0.242887f,
- 0.242980f, 0.243073f, 0.243166f, 0.243259f, 0.243352f, 0.243445f, 0.243538f, 0.243631f,
- 0.243724f, 0.243817f, 0.243910f, 0.244003f, 0.244096f, 0.244189f, 0.244282f, 0.244375f,
- 0.244468f, 0.244561f, 0.244654f, 0.244747f, 0.244840f, 0.244933f, 0.245026f, 0.245119f,
- 0.245212f, 0.245304f, 0.245397f, 0.245490f, 0.245583f, 0.245676f, 0.245769f, 0.245862f,
- 0.245955f, 0.246048f, 0.246141f, 0.246234f, 0.246327f, 0.246420f, 0.246513f, 0.246606f,
- 0.246698f, 0.246791f, 0.246884f, 0.246977f, 0.247070f, 0.247163f, 0.247256f, 0.247349f,
- 0.247442f, 0.247535f, 0.247627f, 0.247720f, 0.247813f, 0.247906f, 0.247999f, 0.248092f,
- 0.248185f, 0.248278f, 0.248370f, 0.248463f, 0.248556f, 0.248649f, 0.248742f, 0.248835f,
- 0.248928f, 0.249020f, 0.249113f, 0.249206f, 0.249299f, 0.249392f, 0.249485f, 0.249578f,
- 0.249670f, 0.249763f, 0.249856f, 0.249949f, 0.250042f, 0.250135f, 0.250227f, 0.250320f,
- 0.250413f, 0.250506f, 0.250599f, 0.250691f, 0.250784f, 0.250877f, 0.250970f, 0.251063f,
- 0.251155f, 0.251248f, 0.251341f, 0.251434f, 0.251527f, 0.251619f, 0.251712f, 0.251805f,
- 0.251898f, 0.251991f, 0.252083f, 0.252176f, 0.252269f, 0.252362f, 0.252454f, 0.252547f,
- 0.252640f, 0.252733f, 0.252826f, 0.252918f, 0.253011f, 0.253104f, 0.253197f, 0.253289f,
- 0.253382f, 0.253475f, 0.253568f, 0.253660f, 0.253753f, 0.253846f, 0.253938f, 0.254031f,
- 0.254124f, 0.254217f, 0.254309f, 0.254402f, 0.254495f, 0.254588f, 0.254680f, 0.254773f,
- 0.254866f, 0.254958f, 0.255051f, 0.255144f, 0.255236f, 0.255329f, 0.255422f, 0.255515f,
- 0.255607f, 0.255700f, 0.255793f, 0.255885f, 0.255978f, 0.256071f, 0.256163f, 0.256256f,
- 0.256349f, 0.256441f, 0.256534f, 0.256627f, 0.256719f, 0.256812f, 0.256905f, 0.256997f,
- 0.257090f, 0.257183f, 0.257275f, 0.257368f, 0.257461f, 0.257553f, 0.257646f, 0.257738f,
- 0.257831f, 0.257924f, 0.258016f, 0.258109f, 0.258202f, 0.258294f, 0.258387f, 0.258479f,
- 0.258572f, 0.258665f, 0.258757f, 0.258850f, 0.258943f, 0.259035f, 0.259128f, 0.259220f,
- 0.259313f, 0.259405f, 0.259498f, 0.259591f, 0.259683f, 0.259776f, 0.259868f, 0.259961f,
- 0.260054f, 0.260146f, 0.260239f, 0.260331f, 0.260424f, 0.260516f, 0.260609f, 0.260702f,
- 0.260794f, 0.260887f, 0.260979f, 0.261072f, 0.261164f, 0.261257f, 0.261349f, 0.261442f,
- 0.261534f, 0.261627f, 0.261720f, 0.261812f, 0.261905f, 0.261997f, 0.262090f, 0.262182f,
- 0.262275f, 0.262367f, 0.262460f, 0.262552f, 0.262645f, 0.262737f, 0.262830f, 0.262922f,
- 0.263015f, 0.263107f, 0.263200f, 0.263292f, 0.263385f, 0.263477f, 0.263570f, 0.263662f,
- 0.263755f, 0.263847f, 0.263940f, 0.264032f, 0.264125f, 0.264217f, 0.264309f, 0.264402f,
- 0.264494f, 0.264587f, 0.264679f, 0.264772f, 0.264864f, 0.264957f, 0.265049f, 0.265142f,
- 0.265234f, 0.265326f, 0.265419f, 0.265511f, 0.265604f, 0.265696f, 0.265789f, 0.265881f,
- 0.265973f, 0.266066f, 0.266158f, 0.266251f, 0.266343f, 0.266436f, 0.266528f, 0.266620f,
- 0.266713f, 0.266805f, 0.266898f, 0.266990f, 0.267082f, 0.267175f, 0.267267f, 0.267359f,
- 0.267452f, 0.267544f, 0.267637f, 0.267729f, 0.267821f, 0.267914f, 0.268006f, 0.268099f,
- 0.268191f, 0.268283f, 0.268376f, 0.268468f, 0.268560f, 0.268653f, 0.268745f, 0.268837f,
- 0.268930f, 0.269022f, 0.269114f, 0.269207f, 0.269299f, 0.269391f, 0.269484f, 0.269576f,
- 0.269668f, 0.269761f, 0.269853f, 0.269945f, 0.270038f, 0.270130f, 0.270222f, 0.270315f,
- 0.270407f, 0.270499f, 0.270591f, 0.270684f, 0.270776f, 0.270868f, 0.270961f, 0.271053f,
- 0.271145f, 0.271237f, 0.271330f, 0.271422f, 0.271514f, 0.271607f, 0.271699f, 0.271791f,
- 0.271883f, 0.271976f, 0.272068f, 0.272160f, 0.272252f, 0.272345f, 0.272437f, 0.272529f,
- 0.272621f, 0.272714f, 0.272806f, 0.272898f, 0.272990f, 0.273083f, 0.273175f, 0.273267f,
- 0.273359f, 0.273451f, 0.273544f, 0.273636f, 0.273728f, 0.273820f, 0.273912f, 0.274005f,
- 0.274097f, 0.274189f, 0.274281f, 0.274374f, 0.274466f, 0.274558f, 0.274650f, 0.274742f,
- 0.274834f, 0.274927f, 0.275019f, 0.275111f, 0.275203f, 0.275295f, 0.275387f, 0.275480f,
- 0.275572f, 0.275664f, 0.275756f, 0.275848f, 0.275940f, 0.276033f, 0.276125f, 0.276217f,
- 0.276309f, 0.276401f, 0.276493f, 0.276585f, 0.276678f, 0.276770f, 0.276862f, 0.276954f,
- 0.277046f, 0.277138f, 0.277230f, 0.277322f, 0.277415f, 0.277507f, 0.277599f, 0.277691f,
- 0.277783f, 0.277875f, 0.277967f, 0.278059f, 0.278151f, 0.278243f, 0.278336f, 0.278428f,
- 0.278520f, 0.278612f, 0.278704f, 0.278796f, 0.278888f, 0.278980f, 0.279072f, 0.279164f,
- 0.279256f, 0.279348f, 0.279440f, 0.279532f, 0.279624f, 0.279717f, 0.279809f, 0.279901f,
- 0.279993f, 0.280085f, 0.280177f, 0.280269f, 0.280361f, 0.280453f, 0.280545f, 0.280637f,
- 0.280729f, 0.280821f, 0.280913f, 0.281005f, 0.281097f, 0.281189f, 0.281281f, 0.281373f,
- 0.281465f, 0.281557f, 0.281649f, 0.281741f, 0.281833f, 0.281925f, 0.282017f, 0.282109f,
- 0.282201f, 0.282293f, 0.282385f, 0.282477f, 0.282569f, 0.282661f, 0.282753f, 0.282845f,
- 0.282937f, 0.283029f, 0.283120f, 0.283212f, 0.283304f, 0.283396f, 0.283488f, 0.283580f,
- 0.283672f, 0.283764f, 0.283856f, 0.283948f, 0.284040f, 0.284132f, 0.284224f, 0.284316f,
- 0.284408f, 0.284499f, 0.284591f, 0.284683f, 0.284775f, 0.284867f, 0.284959f, 0.285051f,
- 0.285143f, 0.285235f, 0.285327f, 0.285418f, 0.285510f, 0.285602f, 0.285694f, 0.285786f,
- 0.285878f, 0.285970f, 0.286062f, 0.286153f, 0.286245f, 0.286337f, 0.286429f, 0.286521f,
- 0.286613f, 0.286705f, 0.286796f, 0.286888f, 0.286980f, 0.287072f, 0.287164f, 0.287256f,
- 0.287347f, 0.287439f, 0.287531f, 0.287623f, 0.287715f, 0.287807f, 0.287898f, 0.287990f,
- 0.288082f, 0.288174f, 0.288266f, 0.288357f, 0.288449f, 0.288541f, 0.288633f, 0.288725f,
- 0.288816f, 0.288908f, 0.289000f, 0.289092f, 0.289184f, 0.289275f, 0.289367f, 0.289459f,
- 0.289551f, 0.289642f, 0.289734f, 0.289826f, 0.289918f, 0.290009f, 0.290101f, 0.290193f,
- 0.290285f, 0.290376f, 0.290468f, 0.290560f, 0.290652f, 0.290743f, 0.290835f, 0.290927f,
- 0.291019f, 0.291110f, 0.291202f, 0.291294f, 0.291385f, 0.291477f, 0.291569f, 0.291661f,
- 0.291752f, 0.291844f, 0.291936f, 0.292027f, 0.292119f, 0.292211f, 0.292302f, 0.292394f,
- 0.292486f, 0.292577f, 0.292669f, 0.292761f, 0.292852f, 0.292944f, 0.293036f, 0.293128f,
- 0.293219f, 0.293311f, 0.293402f, 0.293494f, 0.293586f, 0.293677f, 0.293769f, 0.293861f,
- 0.293952f, 0.294044f, 0.294136f, 0.294227f, 0.294319f, 0.294410f, 0.294502f, 0.294594f,
- 0.294685f, 0.294777f, 0.294869f, 0.294960f, 0.295052f, 0.295143f, 0.295235f, 0.295327f,
- 0.295418f, 0.295510f, 0.295601f, 0.295693f, 0.295785f, 0.295876f, 0.295968f, 0.296059f,
- 0.296151f, 0.296242f, 0.296334f, 0.296426f, 0.296517f, 0.296609f, 0.296700f, 0.296792f,
- 0.296883f, 0.296975f, 0.297066f, 0.297158f, 0.297250f, 0.297341f, 0.297433f, 0.297524f,
- 0.297616f, 0.297707f, 0.297799f, 0.297890f, 0.297982f, 0.298073f, 0.298165f, 0.298256f,
- 0.298348f, 0.298439f, 0.298531f, 0.298622f, 0.298714f, 0.298805f, 0.298897f, 0.298988f,
- 0.299080f, 0.299171f, 0.299263f, 0.299354f, 0.299446f, 0.299537f, 0.299629f, 0.299720f,
- 0.299812f, 0.299903f, 0.299995f, 0.300086f, 0.300177f, 0.300269f, 0.300360f, 0.300452f,
- 0.300543f, 0.300635f, 0.300726f, 0.300818f, 0.300909f, 0.301000f, 0.301092f, 0.301183f,
- 0.301275f, 0.301366f, 0.301458f, 0.301549f, 0.301640f, 0.301732f, 0.301823f, 0.301915f,
- 0.302006f, 0.302097f, 0.302189f, 0.302280f, 0.302372f, 0.302463f, 0.302554f, 0.302646f,
- 0.302737f, 0.302828f, 0.302920f, 0.303011f, 0.303103f, 0.303194f, 0.303285f, 0.303377f,
- 0.303468f, 0.303559f, 0.303651f, 0.303742f, 0.303833f, 0.303925f, 0.304016f, 0.304107f,
- 0.304199f, 0.304290f, 0.304381f, 0.304473f, 0.304564f, 0.304655f, 0.304747f, 0.304838f,
- 0.304929f, 0.305021f, 0.305112f, 0.305203f, 0.305294f, 0.305386f, 0.305477f, 0.305568f,
- 0.305660f, 0.305751f, 0.305842f, 0.305933f, 0.306025f, 0.306116f, 0.306207f, 0.306299f,
- 0.306390f, 0.306481f, 0.306572f, 0.306664f, 0.306755f, 0.306846f, 0.306937f, 0.307029f,
- 0.307120f, 0.307211f, 0.307302f, 0.307394f, 0.307485f, 0.307576f, 0.307667f, 0.307758f,
- 0.307850f, 0.307941f, 0.308032f, 0.308123f, 0.308214f, 0.308306f, 0.308397f, 0.308488f,
- 0.308579f, 0.308670f, 0.308762f, 0.308853f, 0.308944f, 0.309035f, 0.309126f, 0.309218f,
- 0.309309f, 0.309400f, 0.309491f, 0.309582f, 0.309673f, 0.309765f, 0.309856f, 0.309947f,
- 0.310038f, 0.310129f, 0.310220f, 0.310311f, 0.310403f, 0.310494f, 0.310585f, 0.310676f,
- 0.310767f, 0.310858f, 0.310949f, 0.311041f, 0.311132f, 0.311223f, 0.311314f, 0.311405f,
- 0.311496f, 0.311587f, 0.311678f, 0.311769f, 0.311860f, 0.311952f, 0.312043f, 0.312134f,
- 0.312225f, 0.312316f, 0.312407f, 0.312498f, 0.312589f, 0.312680f, 0.312771f, 0.312862f,
- 0.312953f, 0.313044f, 0.313135f, 0.313227f, 0.313318f, 0.313409f, 0.313500f, 0.313591f,
- 0.313682f, 0.313773f, 0.313864f, 0.313955f, 0.314046f, 0.314137f, 0.314228f, 0.314319f,
- 0.314410f, 0.314501f, 0.314592f, 0.314683f, 0.314774f, 0.314865f, 0.314956f, 0.315047f,
- 0.315138f, 0.315229f, 0.315320f, 0.315411f, 0.315502f, 0.315593f, 0.315684f, 0.315775f,
- 0.315866f, 0.315957f, 0.316048f, 0.316139f, 0.316230f, 0.316321f, 0.316411f, 0.316502f,
- 0.316593f, 0.316684f, 0.316775f, 0.316866f, 0.316957f, 0.317048f, 0.317139f, 0.317230f,
- 0.317321f, 0.317412f, 0.317503f, 0.317594f, 0.317684f, 0.317775f, 0.317866f, 0.317957f,
- 0.318048f, 0.318139f, 0.318230f, 0.318321f, 0.318412f, 0.318503f, 0.318593f, 0.318684f,
- 0.318775f, 0.318866f, 0.318957f, 0.319048f, 0.319139f, 0.319229f, 0.319320f, 0.319411f,
- 0.319502f, 0.319593f, 0.319684f, 0.319775f, 0.319865f, 0.319956f, 0.320047f, 0.320138f,
- 0.320229f, 0.320320f, 0.320410f, 0.320501f, 0.320592f, 0.320683f, 0.320774f, 0.320864f,
- 0.320955f, 0.321046f, 0.321137f, 0.321228f, 0.321318f, 0.321409f, 0.321500f, 0.321591f,
- 0.321682f, 0.321772f, 0.321863f, 0.321954f, 0.322045f, 0.322135f, 0.322226f, 0.322317f,
- 0.322408f, 0.322498f, 0.322589f, 0.322680f, 0.322771f, 0.322861f, 0.322952f, 0.323043f,
- 0.323134f, 0.323224f, 0.323315f, 0.323406f, 0.323497f, 0.323587f, 0.323678f, 0.323769f,
- 0.323859f, 0.323950f, 0.324041f, 0.324131f, 0.324222f, 0.324313f, 0.324404f, 0.324494f,
- 0.324585f, 0.324676f, 0.324766f, 0.324857f, 0.324948f, 0.325038f, 0.325129f, 0.325220f,
- 0.325310f, 0.325401f, 0.325492f, 0.325582f, 0.325673f, 0.325764f, 0.325854f, 0.325945f,
- 0.326035f, 0.326126f, 0.326217f, 0.326307f, 0.326398f, 0.326489f, 0.326579f, 0.326670f,
- 0.326760f, 0.326851f, 0.326942f, 0.327032f, 0.327123f, 0.327213f, 0.327304f, 0.327395f,
- 0.327485f, 0.327576f, 0.327666f, 0.327757f, 0.327848f, 0.327938f, 0.328029f, 0.328119f,
- 0.328210f, 0.328300f, 0.328391f, 0.328482f, 0.328572f, 0.328663f, 0.328753f, 0.328844f,
- 0.328934f, 0.329025f, 0.329115f, 0.329206f, 0.329296f, 0.329387f, 0.329477f, 0.329568f,
- 0.329658f, 0.329749f, 0.329839f, 0.329930f, 0.330020f, 0.330111f, 0.330202f, 0.330292f,
- 0.330382f, 0.330473f, 0.330563f, 0.330654f, 0.330744f, 0.330835f, 0.330925f, 0.331016f,
- 0.331106f, 0.331197f, 0.331287f, 0.331378f, 0.331468f, 0.331559f, 0.331649f, 0.331739f,
- 0.331830f, 0.331920f, 0.332011f, 0.332101f, 0.332192f, 0.332282f, 0.332373f, 0.332463f,
- 0.332553f, 0.332644f, 0.332734f, 0.332825f, 0.332915f, 0.333005f, 0.333096f, 0.333186f,
- 0.333277f, 0.333367f, 0.333457f, 0.333548f, 0.333638f, 0.333729f, 0.333819f, 0.333909f,
- 0.334000f, 0.334090f, 0.334180f, 0.334271f, 0.334361f, 0.334451f, 0.334542f, 0.334632f,
- 0.334722f, 0.334813f, 0.334903f, 0.334994f, 0.335084f, 0.335174f, 0.335265f, 0.335355f,
- 0.335445f, 0.335535f, 0.335626f, 0.335716f, 0.335806f, 0.335897f, 0.335987f, 0.336077f,
- 0.336168f, 0.336258f, 0.336348f, 0.336438f, 0.336529f, 0.336619f, 0.336709f, 0.336800f,
- 0.336890f, 0.336980f, 0.337070f, 0.337161f, 0.337251f, 0.337341f, 0.337431f, 0.337522f,
- 0.337612f, 0.337702f, 0.337792f, 0.337883f, 0.337973f, 0.338063f, 0.338153f, 0.338244f,
- 0.338334f, 0.338424f, 0.338514f, 0.338604f, 0.338695f, 0.338785f, 0.338875f, 0.338965f,
- 0.339055f, 0.339146f, 0.339236f, 0.339326f, 0.339416f, 0.339506f, 0.339597f, 0.339687f,
- 0.339777f, 0.339867f, 0.339957f, 0.340047f, 0.340138f, 0.340228f, 0.340318f, 0.340408f,
- 0.340498f, 0.340588f, 0.340678f, 0.340769f, 0.340859f, 0.340949f, 0.341039f, 0.341129f,
- 0.341219f, 0.341309f, 0.341399f, 0.341490f, 0.341580f, 0.341670f, 0.341760f, 0.341850f,
- 0.341940f, 0.342030f, 0.342120f, 0.342210f, 0.342300f, 0.342391f, 0.342481f, 0.342571f,
- 0.342661f, 0.342751f, 0.342841f, 0.342931f, 0.343021f, 0.343111f, 0.343201f, 0.343291f,
- 0.343381f, 0.343471f, 0.343561f, 0.343651f, 0.343741f, 0.343831f, 0.343921f, 0.344011f,
- 0.344101f, 0.344191f, 0.344281f, 0.344371f, 0.344461f, 0.344551f, 0.344641f, 0.344731f,
- 0.344821f, 0.344911f, 0.345001f, 0.345091f, 0.345181f, 0.345271f, 0.345361f, 0.345451f,
- 0.345541f, 0.345631f, 0.345721f, 0.345811f, 0.345901f, 0.345991f, 0.346081f, 0.346171f,
- 0.346261f, 0.346351f, 0.346441f, 0.346531f, 0.346621f, 0.346711f, 0.346801f, 0.346890f,
- 0.346980f, 0.347070f, 0.347160f, 0.347250f, 0.347340f, 0.347430f, 0.347520f, 0.347610f,
- 0.347700f, 0.347790f, 0.347879f, 0.347969f, 0.348059f, 0.348149f, 0.348239f, 0.348329f,
- 0.348419f, 0.348509f, 0.348598f, 0.348688f, 0.348778f, 0.348868f, 0.348958f, 0.349048f,
- 0.349138f, 0.349227f, 0.349317f, 0.349407f, 0.349497f, 0.349587f, 0.349676f, 0.349766f,
- 0.349856f, 0.349946f, 0.350036f, 0.350126f, 0.350215f, 0.350305f, 0.350395f, 0.350485f,
- 0.350575f, 0.350664f, 0.350754f, 0.350844f, 0.350934f, 0.351023f, 0.351113f, 0.351203f,
- 0.351293f, 0.351383f, 0.351472f, 0.351562f, 0.351652f, 0.351742f, 0.351831f, 0.351921f,
- 0.352011f, 0.352100f, 0.352190f, 0.352280f, 0.352370f, 0.352459f, 0.352549f, 0.352639f,
- 0.352729f, 0.352818f, 0.352908f, 0.352998f, 0.353087f, 0.353177f, 0.353267f, 0.353356f,
- 0.353446f, 0.353536f, 0.353626f, 0.353715f, 0.353805f, 0.353895f, 0.353984f, 0.354074f,
- 0.354164f, 0.354253f, 0.354343f, 0.354432f, 0.354522f, 0.354612f, 0.354701f, 0.354791f,
- 0.354881f, 0.354970f, 0.355060f, 0.355150f, 0.355239f, 0.355329f, 0.355418f, 0.355508f,
- 0.355598f, 0.355687f, 0.355777f, 0.355866f, 0.355956f, 0.356046f, 0.356135f, 0.356225f,
- 0.356314f, 0.356404f, 0.356494f, 0.356583f, 0.356673f, 0.356762f, 0.356852f, 0.356941f,
- 0.357031f, 0.357121f, 0.357210f, 0.357300f, 0.357389f, 0.357479f, 0.357568f, 0.357658f,
- 0.357747f, 0.357837f, 0.357926f, 0.358016f, 0.358105f, 0.358195f, 0.358284f, 0.358374f,
- 0.358463f, 0.358553f, 0.358642f, 0.358732f, 0.358821f, 0.358911f, 0.359000f, 0.359090f,
- 0.359179f, 0.359269f, 0.359358f, 0.359448f, 0.359537f, 0.359627f, 0.359716f, 0.359806f,
- 0.359895f, 0.359984f, 0.360074f, 0.360163f, 0.360253f, 0.360342f, 0.360432f, 0.360521f,
- 0.360611f, 0.360700f, 0.360789f, 0.360879f, 0.360968f, 0.361058f, 0.361147f, 0.361236f,
- 0.361326f, 0.361415f, 0.361505f, 0.361594f, 0.361683f, 0.361773f, 0.361862f, 0.361952f,
- 0.362041f, 0.362130f, 0.362220f, 0.362309f, 0.362398f, 0.362488f, 0.362577f, 0.362666f,
- 0.362756f, 0.362845f, 0.362934f, 0.363024f, 0.363113f, 0.363202f, 0.363292f, 0.363381f,
- 0.363470f, 0.363560f, 0.363649f, 0.363738f, 0.363828f, 0.363917f, 0.364006f, 0.364096f,
- 0.364185f, 0.364274f, 0.364363f, 0.364453f, 0.364542f, 0.364631f, 0.364720f, 0.364810f,
- 0.364899f, 0.364988f, 0.365078f, 0.365167f, 0.365256f, 0.365345f, 0.365435f, 0.365524f,
- 0.365613f, 0.365702f, 0.365791f, 0.365881f, 0.365970f, 0.366059f, 0.366148f, 0.366238f,
- 0.366327f, 0.366416f, 0.366505f, 0.366594f, 0.366684f, 0.366773f, 0.366862f, 0.366951f,
- 0.367040f, 0.367130f, 0.367219f, 0.367308f, 0.367397f, 0.367486f, 0.367575f, 0.367665f,
- 0.367754f, 0.367843f, 0.367932f, 0.368021f, 0.368110f, 0.368199f, 0.368289f, 0.368378f,
- 0.368467f, 0.368556f, 0.368645f, 0.368734f, 0.368823f, 0.368912f, 0.369002f, 0.369091f,
- 0.369180f, 0.369269f, 0.369358f, 0.369447f, 0.369536f, 0.369625f, 0.369714f, 0.369803f,
- 0.369892f, 0.369982f, 0.370071f, 0.370160f, 0.370249f, 0.370338f, 0.370427f, 0.370516f,
- 0.370605f, 0.370694f, 0.370783f, 0.370872f, 0.370961f, 0.371050f, 0.371139f, 0.371228f,
- 0.371317f, 0.371406f, 0.371495f, 0.371584f, 0.371673f, 0.371762f, 0.371851f, 0.371940f,
- 0.372029f, 0.372118f, 0.372207f, 0.372296f, 0.372385f, 0.372474f, 0.372563f, 0.372652f,
- 0.372741f, 0.372830f, 0.372919f, 0.373008f, 0.373097f, 0.373186f, 0.373275f, 0.373364f,
- 0.373453f, 0.373542f, 0.373631f, 0.373719f, 0.373808f, 0.373897f, 0.373986f, 0.374075f,
- 0.374164f, 0.374253f, 0.374342f, 0.374431f, 0.374520f, 0.374609f, 0.374697f, 0.374786f,
- 0.374875f, 0.374964f, 0.375053f, 0.375142f, 0.375231f, 0.375320f, 0.375408f, 0.375497f,
- 0.375586f, 0.375675f, 0.375764f, 0.375853f, 0.375942f, 0.376030f, 0.376119f, 0.376208f,
- 0.376297f, 0.376386f, 0.376475f, 0.376563f, 0.376652f, 0.376741f, 0.376830f, 0.376919f,
- 0.377007f, 0.377096f, 0.377185f, 0.377274f, 0.377363f, 0.377451f, 0.377540f, 0.377629f,
- 0.377718f, 0.377806f, 0.377895f, 0.377984f, 0.378073f, 0.378162f, 0.378250f, 0.378339f,
- 0.378428f, 0.378516f, 0.378605f, 0.378694f, 0.378783f, 0.378871f, 0.378960f, 0.379049f,
- 0.379138f, 0.379226f, 0.379315f, 0.379404f, 0.379492f, 0.379581f, 0.379670f, 0.379759f,
- 0.379847f, 0.379936f, 0.380025f, 0.380113f, 0.380202f, 0.380291f, 0.380379f, 0.380468f,
- 0.380557f, 0.380645f, 0.380734f, 0.380823f, 0.380911f, 0.381000f, 0.381088f, 0.381177f,
- 0.381266f, 0.381354f, 0.381443f, 0.381532f, 0.381620f, 0.381709f, 0.381797f, 0.381886f,
- 0.381975f, 0.382063f, 0.382152f, 0.382241f, 0.382329f, 0.382418f, 0.382506f, 0.382595f,
- 0.382683f, 0.382772f, 0.382861f, 0.382949f, 0.383038f, 0.383126f, 0.383215f, 0.383303f,
- 0.383392f, 0.383480f, 0.383569f, 0.383658f, 0.383746f, 0.383835f, 0.383923f, 0.384012f,
- 0.384100f, 0.384189f, 0.384277f, 0.384366f, 0.384454f, 0.384543f, 0.384631f, 0.384720f,
- 0.384808f, 0.384897f, 0.384985f, 0.385074f, 0.385162f, 0.385251f, 0.385339f, 0.385428f,
- 0.385516f, 0.385605f, 0.385693f, 0.385781f, 0.385870f, 0.385958f, 0.386047f, 0.386135f,
- 0.386224f, 0.386312f, 0.386400f, 0.386489f, 0.386577f, 0.386666f, 0.386754f, 0.386843f,
- 0.386931f, 0.387019f, 0.387108f, 0.387196f, 0.387285f, 0.387373f, 0.387461f, 0.387550f,
- 0.387638f, 0.387727f, 0.387815f, 0.387903f, 0.387992f, 0.388080f, 0.388168f, 0.388257f,
- 0.388345f, 0.388433f, 0.388522f, 0.388610f, 0.388698f, 0.388787f, 0.388875f, 0.388963f,
- 0.389052f, 0.389140f, 0.389228f, 0.389317f, 0.389405f, 0.389493f, 0.389582f, 0.389670f,
- 0.389758f, 0.389846f, 0.389935f, 0.390023f, 0.390111f, 0.390200f, 0.390288f, 0.390376f,
- 0.390464f, 0.390553f, 0.390641f, 0.390729f, 0.390817f, 0.390906f, 0.390994f, 0.391082f,
- 0.391170f, 0.391259f, 0.391347f, 0.391435f, 0.391523f, 0.391612f, 0.391700f, 0.391788f,
- 0.391876f, 0.391964f, 0.392053f, 0.392141f, 0.392229f, 0.392317f, 0.392405f, 0.392493f,
- 0.392582f, 0.392670f, 0.392758f, 0.392846f, 0.392934f, 0.393023f, 0.393111f, 0.393199f,
- 0.393287f, 0.393375f, 0.393463f, 0.393551f, 0.393640f, 0.393728f, 0.393816f, 0.393904f,
- 0.393992f, 0.394080f, 0.394168f, 0.394256f, 0.394344f, 0.394433f, 0.394521f, 0.394609f,
- 0.394697f, 0.394785f, 0.394873f, 0.394961f, 0.395049f, 0.395137f, 0.395225f, 0.395313f,
- 0.395401f, 0.395490f, 0.395578f, 0.395666f, 0.395754f, 0.395842f, 0.395930f, 0.396018f,
- 0.396106f, 0.396194f, 0.396282f, 0.396370f, 0.396458f, 0.396546f, 0.396634f, 0.396722f,
- 0.396810f, 0.396898f, 0.396986f, 0.397074f, 0.397162f, 0.397250f, 0.397338f, 0.397426f,
- 0.397514f, 0.397602f, 0.397690f, 0.397778f, 0.397866f, 0.397954f, 0.398042f, 0.398130f,
- 0.398218f, 0.398306f, 0.398393f, 0.398481f, 0.398569f, 0.398657f, 0.398745f, 0.398833f,
- 0.398921f, 0.399009f, 0.399097f, 0.399185f, 0.399273f, 0.399361f, 0.399448f, 0.399536f,
- 0.399624f, 0.399712f, 0.399800f, 0.399888f, 0.399976f, 0.400064f, 0.400151f, 0.400239f,
- 0.400327f, 0.400415f, 0.400503f, 0.400591f, 0.400679f, 0.400766f, 0.400854f, 0.400942f,
- 0.401030f, 0.401118f, 0.401206f, 0.401293f, 0.401381f, 0.401469f, 0.401557f, 0.401645f,
- 0.401732f, 0.401820f, 0.401908f, 0.401996f, 0.402084f, 0.402171f, 0.402259f, 0.402347f,
- 0.402435f, 0.402522f, 0.402610f, 0.402698f, 0.402786f, 0.402873f, 0.402961f, 0.403049f,
- 0.403137f, 0.403224f, 0.403312f, 0.403400f, 0.403488f, 0.403575f, 0.403663f, 0.403751f,
- 0.403838f, 0.403926f, 0.404014f, 0.404102f, 0.404189f, 0.404277f, 0.404365f, 0.404452f,
- 0.404540f, 0.404628f, 0.404715f, 0.404803f, 0.404891f, 0.404978f, 0.405066f, 0.405154f,
- 0.405241f, 0.405329f, 0.405417f, 0.405504f, 0.405592f, 0.405680f, 0.405767f, 0.405855f,
- 0.405942f, 0.406030f, 0.406118f, 0.406205f, 0.406293f, 0.406380f, 0.406468f, 0.406556f,
- 0.406643f, 0.406731f, 0.406818f, 0.406906f, 0.406994f, 0.407081f, 0.407169f, 0.407256f,
- 0.407344f, 0.407431f, 0.407519f, 0.407606f, 0.407694f, 0.407782f, 0.407869f, 0.407957f,
- 0.408044f, 0.408132f, 0.408219f, 0.408307f, 0.408394f, 0.408482f, 0.408569f, 0.408657f,
- 0.408744f, 0.408832f, 0.408919f, 0.409007f, 0.409094f, 0.409182f, 0.409269f, 0.409357f,
- 0.409444f, 0.409532f, 0.409619f, 0.409707f, 0.409794f, 0.409881f, 0.409969f, 0.410056f,
- 0.410144f, 0.410231f, 0.410319f, 0.410406f, 0.410493f, 0.410581f, 0.410668f, 0.410756f,
- 0.410843f, 0.410931f, 0.411018f, 0.411105f, 0.411193f, 0.411280f, 0.411368f, 0.411455f,
- 0.411542f, 0.411630f, 0.411717f, 0.411804f, 0.411892f, 0.411979f, 0.412067f, 0.412154f,
- 0.412241f, 0.412329f, 0.412416f, 0.412503f, 0.412591f, 0.412678f, 0.412765f, 0.412853f,
- 0.412940f, 0.413027f, 0.413115f, 0.413202f, 0.413289f, 0.413376f, 0.413464f, 0.413551f,
- 0.413638f, 0.413726f, 0.413813f, 0.413900f, 0.413987f, 0.414075f, 0.414162f, 0.414249f,
- 0.414337f, 0.414424f, 0.414511f, 0.414598f, 0.414685f, 0.414773f, 0.414860f, 0.414947f,
- 0.415034f, 0.415122f, 0.415209f, 0.415296f, 0.415383f, 0.415471f, 0.415558f, 0.415645f,
- 0.415732f, 0.415819f, 0.415906f, 0.415994f, 0.416081f, 0.416168f, 0.416255f, 0.416342f,
- 0.416430f, 0.416517f, 0.416604f, 0.416691f, 0.416778f, 0.416865f, 0.416952f, 0.417040f,
- 0.417127f, 0.417214f, 0.417301f, 0.417388f, 0.417475f, 0.417562f, 0.417650f, 0.417737f,
- 0.417824f, 0.417911f, 0.417998f, 0.418085f, 0.418172f, 0.418259f, 0.418346f, 0.418433f,
- 0.418520f, 0.418608f, 0.418695f, 0.418782f, 0.418869f, 0.418956f, 0.419043f, 0.419130f,
- 0.419217f, 0.419304f, 0.419391f, 0.419478f, 0.419565f, 0.419652f, 0.419739f, 0.419826f,
- 0.419913f, 0.420000f, 0.420087f, 0.420174f, 0.420261f, 0.420348f, 0.420435f, 0.420522f,
- 0.420609f, 0.420696f, 0.420783f, 0.420870f, 0.420957f, 0.421044f, 0.421131f, 0.421218f,
- 0.421305f, 0.421392f, 0.421479f, 0.421566f, 0.421653f, 0.421739f, 0.421826f, 0.421913f,
- 0.422000f, 0.422087f, 0.422174f, 0.422261f, 0.422348f, 0.422435f, 0.422522f, 0.422609f,
- 0.422695f, 0.422782f, 0.422869f, 0.422956f, 0.423043f, 0.423130f, 0.423217f, 0.423304f,
- 0.423390f, 0.423477f, 0.423564f, 0.423651f, 0.423738f, 0.423825f, 0.423912f, 0.423998f,
- 0.424085f, 0.424172f, 0.424259f, 0.424346f, 0.424432f, 0.424519f, 0.424606f, 0.424693f,
- 0.424780f, 0.424866f, 0.424953f, 0.425040f, 0.425127f, 0.425214f, 0.425300f, 0.425387f,
- 0.425474f, 0.425561f, 0.425647f, 0.425734f, 0.425821f, 0.425908f, 0.425994f, 0.426081f,
- 0.426168f, 0.426255f, 0.426341f, 0.426428f, 0.426515f, 0.426601f, 0.426688f, 0.426775f,
- 0.426862f, 0.426948f, 0.427035f, 0.427122f, 0.427208f, 0.427295f, 0.427382f, 0.427468f,
- 0.427555f, 0.427642f, 0.427728f, 0.427815f, 0.427902f, 0.427988f, 0.428075f, 0.428162f,
- 0.428248f, 0.428335f, 0.428422f, 0.428508f, 0.428595f, 0.428681f, 0.428768f, 0.428855f,
- 0.428941f, 0.429028f, 0.429114f, 0.429201f, 0.429288f, 0.429374f, 0.429461f, 0.429547f,
- 0.429634f, 0.429721f, 0.429807f, 0.429894f, 0.429980f, 0.430067f, 0.430153f, 0.430240f,
- 0.430326f, 0.430413f, 0.430500f, 0.430586f, 0.430673f, 0.430759f, 0.430846f, 0.430932f,
- 0.431019f, 0.431105f, 0.431192f, 0.431278f, 0.431365f, 0.431451f, 0.431538f, 0.431624f,
- 0.431711f, 0.431797f, 0.431884f, 0.431970f, 0.432057f, 0.432143f, 0.432229f, 0.432316f,
- 0.432402f, 0.432489f, 0.432575f, 0.432662f, 0.432748f, 0.432835f, 0.432921f, 0.433007f,
- 0.433094f, 0.433180f, 0.433267f, 0.433353f, 0.433439f, 0.433526f, 0.433612f, 0.433699f,
- 0.433785f, 0.433871f, 0.433958f, 0.434044f, 0.434131f, 0.434217f, 0.434303f, 0.434390f,
- 0.434476f, 0.434562f, 0.434649f, 0.434735f, 0.434821f, 0.434908f, 0.434994f, 0.435080f,
- 0.435167f, 0.435253f, 0.435339f, 0.435426f, 0.435512f, 0.435598f, 0.435685f, 0.435771f,
- 0.435857f, 0.435943f, 0.436030f, 0.436116f, 0.436202f, 0.436288f, 0.436375f, 0.436461f,
- 0.436547f, 0.436633f, 0.436720f, 0.436806f, 0.436892f, 0.436978f, 0.437065f, 0.437151f,
- 0.437237f, 0.437323f, 0.437410f, 0.437496f, 0.437582f, 0.437668f, 0.437754f, 0.437841f,
- 0.437927f, 0.438013f, 0.438099f, 0.438185f, 0.438272f, 0.438358f, 0.438444f, 0.438530f,
- 0.438616f, 0.438702f, 0.438789f, 0.438875f, 0.438961f, 0.439047f, 0.439133f, 0.439219f,
- 0.439305f, 0.439392f, 0.439478f, 0.439564f, 0.439650f, 0.439736f, 0.439822f, 0.439908f,
- 0.439994f, 0.440080f, 0.440166f, 0.440253f, 0.440339f, 0.440425f, 0.440511f, 0.440597f,
- 0.440683f, 0.440769f, 0.440855f, 0.440941f, 0.441027f, 0.441113f, 0.441199f, 0.441285f,
- 0.441371f, 0.441457f, 0.441543f, 0.441629f, 0.441715f, 0.441801f, 0.441887f, 0.441973f,
- 0.442059f, 0.442145f, 0.442231f, 0.442317f, 0.442403f, 0.442489f, 0.442575f, 0.442661f,
- 0.442747f, 0.442833f, 0.442919f, 0.443005f, 0.443091f, 0.443177f, 0.443263f, 0.443349f,
- 0.443435f, 0.443521f, 0.443607f, 0.443693f, 0.443779f, 0.443864f, 0.443950f, 0.444036f,
- 0.444122f, 0.444208f, 0.444294f, 0.444380f, 0.444466f, 0.444552f, 0.444637f, 0.444723f,
- 0.444809f, 0.444895f, 0.444981f, 0.445067f, 0.445153f, 0.445239f, 0.445324f, 0.445410f,
- 0.445496f, 0.445582f, 0.445668f, 0.445754f, 0.445839f, 0.445925f, 0.446011f, 0.446097f,
- 0.446183f, 0.446268f, 0.446354f, 0.446440f, 0.446526f, 0.446612f, 0.446697f, 0.446783f,
- 0.446869f, 0.446955f, 0.447040f, 0.447126f, 0.447212f, 0.447298f, 0.447383f, 0.447469f,
- 0.447555f, 0.447641f, 0.447726f, 0.447812f, 0.447898f, 0.447983f, 0.448069f, 0.448155f,
- 0.448241f, 0.448326f, 0.448412f, 0.448498f, 0.448583f, 0.448669f, 0.448755f, 0.448840f,
- 0.448926f, 0.449012f, 0.449097f, 0.449183f, 0.449269f, 0.449354f, 0.449440f, 0.449526f,
- 0.449611f, 0.449697f, 0.449783f, 0.449868f, 0.449954f, 0.450039f, 0.450125f, 0.450211f,
- 0.450296f, 0.450382f, 0.450467f, 0.450553f, 0.450639f, 0.450724f, 0.450810f, 0.450895f,
- 0.450981f, 0.451067f, 0.451152f, 0.451238f, 0.451323f, 0.451409f, 0.451494f, 0.451580f,
- 0.451665f, 0.451751f, 0.451836f, 0.451922f, 0.452008f, 0.452093f, 0.452179f, 0.452264f,
- 0.452350f, 0.452435f, 0.452521f, 0.452606f, 0.452692f, 0.452777f, 0.452863f, 0.452948f,
- 0.453033f, 0.453119f, 0.453204f, 0.453290f, 0.453375f, 0.453461f, 0.453546f, 0.453632f,
- 0.453717f, 0.453803f, 0.453888f, 0.453973f, 0.454059f, 0.454144f, 0.454230f, 0.454315f,
- 0.454400f, 0.454486f, 0.454571f, 0.454657f, 0.454742f, 0.454827f, 0.454913f, 0.454998f,
- 0.455084f, 0.455169f, 0.455254f, 0.455340f, 0.455425f, 0.455510f, 0.455596f, 0.455681f,
- 0.455766f, 0.455852f, 0.455937f, 0.456022f, 0.456108f, 0.456193f, 0.456278f, 0.456364f,
- 0.456449f, 0.456534f, 0.456620f, 0.456705f, 0.456790f, 0.456875f, 0.456961f, 0.457046f,
- 0.457131f, 0.457217f, 0.457302f, 0.457387f, 0.457472f, 0.457558f, 0.457643f, 0.457728f,
- 0.457813f, 0.457899f, 0.457984f, 0.458069f, 0.458154f, 0.458239f, 0.458325f, 0.458410f,
- 0.458495f, 0.458580f, 0.458665f, 0.458751f, 0.458836f, 0.458921f, 0.459006f, 0.459091f,
- 0.459177f, 0.459262f, 0.459347f, 0.459432f, 0.459517f, 0.459602f, 0.459687f, 0.459773f,
- 0.459858f, 0.459943f, 0.460028f, 0.460113f, 0.460198f, 0.460283f, 0.460369f, 0.460454f,
- 0.460539f, 0.460624f, 0.460709f, 0.460794f, 0.460879f, 0.460964f, 0.461049f, 0.461134f,
- 0.461219f, 0.461304f, 0.461390f, 0.461475f, 0.461560f, 0.461645f, 0.461730f, 0.461815f,
- 0.461900f, 0.461985f, 0.462070f, 0.462155f, 0.462240f, 0.462325f, 0.462410f, 0.462495f,
- 0.462580f, 0.462665f, 0.462750f, 0.462835f, 0.462920f, 0.463005f, 0.463090f, 0.463175f,
- 0.463260f, 0.463345f, 0.463430f, 0.463515f, 0.463600f, 0.463685f, 0.463769f, 0.463854f,
- 0.463939f, 0.464024f, 0.464109f, 0.464194f, 0.464279f, 0.464364f, 0.464449f, 0.464534f,
- 0.464619f, 0.464704f, 0.464788f, 0.464873f, 0.464958f, 0.465043f, 0.465128f, 0.465213f,
- 0.465298f, 0.465383f, 0.465467f, 0.465552f, 0.465637f, 0.465722f, 0.465807f, 0.465892f,
- 0.465977f, 0.466061f, 0.466146f, 0.466231f, 0.466316f, 0.466401f, 0.466485f, 0.466570f,
- 0.466655f, 0.466740f, 0.466825f, 0.466909f, 0.466994f, 0.467079f, 0.467164f, 0.467248f,
- 0.467333f, 0.467418f, 0.467503f, 0.467587f, 0.467672f, 0.467757f, 0.467842f, 0.467926f,
- 0.468011f, 0.468096f, 0.468181f, 0.468265f, 0.468350f, 0.468435f, 0.468519f, 0.468604f,
- 0.468689f, 0.468774f, 0.468858f, 0.468943f, 0.469028f, 0.469112f, 0.469197f, 0.469282f,
- 0.469366f, 0.469451f, 0.469536f, 0.469620f, 0.469705f, 0.469789f, 0.469874f, 0.469959f,
- 0.470043f, 0.470128f, 0.470213f, 0.470297f, 0.470382f, 0.470466f, 0.470551f, 0.470636f,
- 0.470720f, 0.470805f, 0.470889f, 0.470974f, 0.471058f, 0.471143f, 0.471228f, 0.471312f,
- 0.471397f, 0.471481f, 0.471566f, 0.471650f, 0.471735f, 0.471819f, 0.471904f, 0.471988f,
- 0.472073f, 0.472158f, 0.472242f, 0.472327f, 0.472411f, 0.472496f, 0.472580f, 0.472665f,
- 0.472749f, 0.472834f, 0.472918f, 0.473002f, 0.473087f, 0.473171f, 0.473256f, 0.473340f,
- 0.473425f, 0.473509f, 0.473594f, 0.473678f, 0.473763f, 0.473847f, 0.473931f, 0.474016f,
- 0.474100f, 0.474185f, 0.474269f, 0.474353f, 0.474438f, 0.474522f, 0.474607f, 0.474691f,
- 0.474775f, 0.474860f, 0.474944f, 0.475029f, 0.475113f, 0.475197f, 0.475282f, 0.475366f,
- 0.475450f, 0.475535f, 0.475619f, 0.475703f, 0.475788f, 0.475872f, 0.475956f, 0.476041f,
- 0.476125f, 0.476209f, 0.476294f, 0.476378f, 0.476462f, 0.476546f, 0.476631f, 0.476715f,
- 0.476799f, 0.476884f, 0.476968f, 0.477052f, 0.477136f, 0.477221f, 0.477305f, 0.477389f,
- 0.477473f, 0.477558f, 0.477642f, 0.477726f, 0.477810f, 0.477894f, 0.477979f, 0.478063f,
- 0.478147f, 0.478231f, 0.478315f, 0.478400f, 0.478484f, 0.478568f, 0.478652f, 0.478736f,
- 0.478821f, 0.478905f, 0.478989f, 0.479073f, 0.479157f, 0.479241f, 0.479325f, 0.479410f,
- 0.479494f, 0.479578f, 0.479662f, 0.479746f, 0.479830f, 0.479914f, 0.479998f, 0.480083f,
- 0.480167f, 0.480251f, 0.480335f, 0.480419f, 0.480503f, 0.480587f, 0.480671f, 0.480755f,
- 0.480839f, 0.480923f, 0.481007f, 0.481091f, 0.481176f, 0.481260f, 0.481344f, 0.481428f,
- 0.481512f, 0.481596f, 0.481680f, 0.481764f, 0.481848f, 0.481932f, 0.482016f, 0.482100f,
- 0.482184f, 0.482268f, 0.482352f, 0.482436f, 0.482520f, 0.482604f, 0.482688f, 0.482772f,
- 0.482856f, 0.482940f, 0.483023f, 0.483107f, 0.483191f, 0.483275f, 0.483359f, 0.483443f,
- 0.483527f, 0.483611f, 0.483695f, 0.483779f, 0.483863f, 0.483947f, 0.484031f, 0.484114f,
- 0.484198f, 0.484282f, 0.484366f, 0.484450f, 0.484534f, 0.484618f, 0.484702f, 0.484785f,
- 0.484869f, 0.484953f, 0.485037f, 0.485121f, 0.485205f, 0.485288f, 0.485372f, 0.485456f,
- 0.485540f, 0.485624f, 0.485708f, 0.485791f, 0.485875f, 0.485959f, 0.486043f, 0.486126f,
- 0.486210f, 0.486294f, 0.486378f, 0.486462f, 0.486545f, 0.486629f, 0.486713f, 0.486797f,
- 0.486880f, 0.486964f, 0.487048f, 0.487132f, 0.487215f, 0.487299f, 0.487383f, 0.487466f,
- 0.487550f, 0.487634f, 0.487718f, 0.487801f, 0.487885f, 0.487969f, 0.488052f, 0.488136f,
- 0.488220f, 0.488303f, 0.488387f, 0.488471f, 0.488554f, 0.488638f, 0.488722f, 0.488805f,
- 0.488889f, 0.488973f, 0.489056f, 0.489140f, 0.489223f, 0.489307f, 0.489391f, 0.489474f,
- 0.489558f, 0.489641f, 0.489725f, 0.489809f, 0.489892f, 0.489976f, 0.490059f, 0.490143f,
- 0.490226f, 0.490310f, 0.490394f, 0.490477f, 0.490561f, 0.490644f, 0.490728f, 0.490811f,
- 0.490895f, 0.490978f, 0.491062f, 0.491145f, 0.491229f, 0.491312f, 0.491396f, 0.491479f,
- 0.491563f, 0.491646f, 0.491730f, 0.491813f, 0.491897f, 0.491980f, 0.492064f, 0.492147f,
- 0.492231f, 0.492314f, 0.492398f, 0.492481f, 0.492564f, 0.492648f, 0.492731f, 0.492815f,
- 0.492898f, 0.492982f, 0.493065f, 0.493148f, 0.493232f, 0.493315f, 0.493399f, 0.493482f,
- 0.493565f, 0.493649f, 0.493732f, 0.493816f, 0.493899f, 0.493982f, 0.494066f, 0.494149f,
- 0.494232f, 0.494316f, 0.494399f, 0.494482f, 0.494566f, 0.494649f, 0.494732f, 0.494816f,
- 0.494899f, 0.494982f, 0.495066f, 0.495149f, 0.495232f, 0.495315f, 0.495399f, 0.495482f,
- 0.495565f, 0.495649f, 0.495732f, 0.495815f, 0.495898f, 0.495982f, 0.496065f, 0.496148f,
- 0.496231f, 0.496315f, 0.496398f, 0.496481f, 0.496564f, 0.496647f, 0.496731f, 0.496814f,
- 0.496897f, 0.496980f, 0.497063f, 0.497147f, 0.497230f, 0.497313f, 0.497396f, 0.497479f,
- 0.497562f, 0.497646f, 0.497729f, 0.497812f, 0.497895f, 0.497978f, 0.498061f, 0.498145f,
- 0.498228f, 0.498311f, 0.498394f, 0.498477f, 0.498560f, 0.498643f, 0.498726f, 0.498809f,
- 0.498893f, 0.498976f, 0.499059f, 0.499142f, 0.499225f, 0.499308f, 0.499391f, 0.499474f,
- 0.499557f, 0.499640f, 0.499723f, 0.499806f, 0.499889f, 0.499972f, 0.500055f, 0.500138f,
- 0.500221f, 0.500304f, 0.500387f, 0.500470f, 0.500553f, 0.500636f, 0.500719f, 0.500802f,
- 0.500885f, 0.500968f, 0.501051f, 0.501134f, 0.501217f, 0.501300f, 0.501383f, 0.501466f,
- 0.501549f, 0.501632f, 0.501715f, 0.501798f, 0.501881f, 0.501964f, 0.502047f, 0.502130f,
- 0.502212f, 0.502295f, 0.502378f, 0.502461f, 0.502544f, 0.502627f, 0.502710f, 0.502793f,
- 0.502876f, 0.502958f, 0.503041f, 0.503124f, 0.503207f, 0.503290f, 0.503373f, 0.503456f,
- 0.503538f, 0.503621f, 0.503704f, 0.503787f, 0.503870f, 0.503953f, 0.504035f, 0.504118f,
- 0.504201f, 0.504284f, 0.504366f, 0.504449f, 0.504532f, 0.504615f, 0.504698f, 0.504780f,
- 0.504863f, 0.504946f, 0.505029f, 0.505111f, 0.505194f, 0.505277f, 0.505360f, 0.505442f,
- 0.505525f, 0.505608f, 0.505690f, 0.505773f, 0.505856f, 0.505939f, 0.506021f, 0.506104f,
- 0.506187f, 0.506269f, 0.506352f, 0.506435f, 0.506517f, 0.506600f, 0.506683f, 0.506765f,
- 0.506848f, 0.506931f, 0.507013f, 0.507096f, 0.507179f, 0.507261f, 0.507344f, 0.507426f,
- 0.507509f, 0.507592f, 0.507674f, 0.507757f, 0.507839f, 0.507922f, 0.508005f, 0.508087f,
- 0.508170f, 0.508252f, 0.508335f, 0.508417f, 0.508500f, 0.508583f, 0.508665f, 0.508748f,
- 0.508830f, 0.508913f, 0.508995f, 0.509078f, 0.509160f, 0.509243f, 0.509325f, 0.509408f,
- 0.509490f, 0.509573f, 0.509655f, 0.509738f, 0.509820f, 0.509903f, 0.509985f, 0.510068f,
- 0.510150f, 0.510233f, 0.510315f, 0.510397f, 0.510480f, 0.510562f, 0.510645f, 0.510727f,
- 0.510810f, 0.510892f, 0.510974f, 0.511057f, 0.511139f, 0.511222f, 0.511304f, 0.511386f,
- 0.511469f, 0.511551f, 0.511634f, 0.511716f, 0.511798f, 0.511881f, 0.511963f, 0.512045f,
- 0.512128f, 0.512210f, 0.512292f, 0.512375f, 0.512457f, 0.512539f, 0.512622f, 0.512704f,
- 0.512786f, 0.512869f, 0.512951f, 0.513033f, 0.513116f, 0.513198f, 0.513280f, 0.513362f,
- 0.513445f, 0.513527f, 0.513609f, 0.513692f, 0.513774f, 0.513856f, 0.513938f, 0.514021f,
- 0.514103f, 0.514185f, 0.514267f, 0.514349f, 0.514432f, 0.514514f, 0.514596f, 0.514678f,
- 0.514760f, 0.514843f, 0.514925f, 0.515007f, 0.515089f, 0.515171f, 0.515254f, 0.515336f,
- 0.515418f, 0.515500f, 0.515582f, 0.515664f, 0.515746f, 0.515829f, 0.515911f, 0.515993f,
- 0.516075f, 0.516157f, 0.516239f, 0.516321f, 0.516403f, 0.516486f, 0.516568f, 0.516650f,
- 0.516732f, 0.516814f, 0.516896f, 0.516978f, 0.517060f, 0.517142f, 0.517224f, 0.517306f,
- 0.517388f, 0.517470f, 0.517552f, 0.517634f, 0.517716f, 0.517798f, 0.517880f, 0.517963f,
- 0.518045f, 0.518126f, 0.518209f, 0.518291f, 0.518372f, 0.518454f, 0.518536f, 0.518618f,
- 0.518700f, 0.518782f, 0.518864f, 0.518946f, 0.519028f, 0.519110f, 0.519192f, 0.519274f,
- 0.519356f, 0.519438f, 0.519520f, 0.519602f, 0.519684f, 0.519766f, 0.519848f, 0.519929f,
- 0.520011f, 0.520093f, 0.520175f, 0.520257f, 0.520339f, 0.520421f, 0.520503f, 0.520584f,
- 0.520666f, 0.520748f, 0.520830f, 0.520912f, 0.520994f, 0.521075f, 0.521157f, 0.521239f,
- 0.521321f, 0.521403f, 0.521485f, 0.521566f, 0.521648f, 0.521730f, 0.521812f, 0.521894f,
- 0.521975f, 0.522057f, 0.522139f, 0.522221f, 0.522302f, 0.522384f, 0.522466f, 0.522548f,
- 0.522629f, 0.522711f, 0.522793f, 0.522875f, 0.522956f, 0.523038f, 0.523120f, 0.523201f,
- 0.523283f, 0.523365f, 0.523447f, 0.523528f, 0.523610f, 0.523692f, 0.523773f, 0.523855f,
- 0.523937f, 0.524018f, 0.524100f, 0.524181f, 0.524263f, 0.524345f, 0.524426f, 0.524508f,
- 0.524590f, 0.524671f, 0.524753f, 0.524835f, 0.524916f, 0.524998f, 0.525079f, 0.525161f,
- 0.525243f, 0.525324f, 0.525406f, 0.525487f, 0.525569f, 0.525650f, 0.525732f, 0.525813f,
- 0.525895f, 0.525977f, 0.526058f, 0.526140f, 0.526221f, 0.526303f, 0.526384f, 0.526466f,
- 0.526547f, 0.526629f, 0.526710f, 0.526792f, 0.526873f, 0.526955f, 0.527036f, 0.527118f,
- 0.527199f, 0.527281f, 0.527362f, 0.527444f, 0.527525f, 0.527606f, 0.527688f, 0.527769f,
- 0.527851f, 0.527932f, 0.528014f, 0.528095f, 0.528176f, 0.528258f, 0.528339f, 0.528421f,
- 0.528502f, 0.528583f, 0.528665f, 0.528746f, 0.528828f, 0.528909f, 0.528990f, 0.529072f,
- 0.529153f, 0.529234f, 0.529316f, 0.529397f, 0.529478f, 0.529560f, 0.529641f, 0.529722f,
- 0.529804f, 0.529885f, 0.529966f, 0.530048f, 0.530129f, 0.530210f, 0.530291f, 0.530373f,
- 0.530454f, 0.530535f, 0.530617f, 0.530698f, 0.530779f, 0.530860f, 0.530942f, 0.531023f,
- 0.531104f, 0.531185f, 0.531266f, 0.531348f, 0.531429f, 0.531510f, 0.531591f, 0.531673f,
- 0.531754f, 0.531835f, 0.531916f, 0.531997f, 0.532078f, 0.532160f, 0.532241f, 0.532322f,
- 0.532403f, 0.532484f, 0.532565f, 0.532647f, 0.532728f, 0.532809f, 0.532890f, 0.532971f,
- 0.533052f, 0.533133f, 0.533214f, 0.533296f, 0.533377f, 0.533458f, 0.533539f, 0.533620f,
- 0.533701f, 0.533782f, 0.533863f, 0.533944f, 0.534025f, 0.534106f, 0.534187f, 0.534268f,
- 0.534349f, 0.534431f, 0.534512f, 0.534593f, 0.534674f, 0.534755f, 0.534836f, 0.534917f,
- 0.534998f, 0.535079f, 0.535160f, 0.535241f, 0.535322f, 0.535403f, 0.535484f, 0.535564f,
- 0.535645f, 0.535726f, 0.535807f, 0.535888f, 0.535969f, 0.536050f, 0.536131f, 0.536212f,
- 0.536293f, 0.536374f, 0.536455f, 0.536536f, 0.536617f, 0.536698f, 0.536778f, 0.536859f,
- 0.536940f, 0.537021f, 0.537102f, 0.537183f, 0.537264f, 0.537345f, 0.537425f, 0.537506f,
- 0.537587f, 0.537668f, 0.537749f, 0.537830f, 0.537910f, 0.537991f, 0.538072f, 0.538153f,
- 0.538234f, 0.538314f, 0.538395f, 0.538476f, 0.538557f, 0.538638f, 0.538718f, 0.538799f,
- 0.538880f, 0.538961f, 0.539041f, 0.539122f, 0.539203f, 0.539284f, 0.539364f, 0.539445f,
- 0.539526f, 0.539607f, 0.539687f, 0.539768f, 0.539849f, 0.539929f, 0.540010f, 0.540091f,
- 0.540171f, 0.540252f, 0.540333f, 0.540413f, 0.540494f, 0.540575f, 0.540655f, 0.540736f,
- 0.540817f, 0.540897f, 0.540978f, 0.541059f, 0.541139f, 0.541220f, 0.541301f, 0.541381f,
- 0.541462f, 0.541542f, 0.541623f, 0.541704f, 0.541784f, 0.541865f, 0.541945f, 0.542026f,
- 0.542106f, 0.542187f, 0.542268f, 0.542348f, 0.542429f, 0.542509f, 0.542590f, 0.542670f,
- 0.542751f, 0.542831f, 0.542912f, 0.542992f, 0.543073f, 0.543153f, 0.543234f, 0.543314f,
- 0.543395f, 0.543475f, 0.543556f, 0.543636f, 0.543717f, 0.543797f, 0.543878f, 0.543958f,
- 0.544039f, 0.544119f, 0.544199f, 0.544280f, 0.544360f, 0.544441f, 0.544521f, 0.544602f,
- 0.544682f, 0.544762f, 0.544843f, 0.544923f, 0.545003f, 0.545084f, 0.545164f, 0.545245f,
- 0.545325f, 0.545405f, 0.545486f, 0.545566f, 0.545646f, 0.545727f, 0.545807f, 0.545887f,
- 0.545968f, 0.546048f, 0.546128f, 0.546209f, 0.546289f, 0.546369f, 0.546450f, 0.546530f,
- 0.546610f, 0.546690f, 0.546771f, 0.546851f, 0.546931f, 0.547011f, 0.547092f, 0.547172f,
- 0.547252f, 0.547333f, 0.547413f, 0.547493f, 0.547573f, 0.547653f, 0.547734f, 0.547814f,
- 0.547894f, 0.547974f, 0.548054f, 0.548135f, 0.548215f, 0.548295f, 0.548375f, 0.548455f,
- 0.548536f, 0.548616f, 0.548696f, 0.548776f, 0.548856f, 0.548936f, 0.549016f, 0.549097f,
- 0.549177f, 0.549257f, 0.549337f, 0.549417f, 0.549497f, 0.549577f, 0.549657f, 0.549737f,
- 0.549818f, 0.549898f, 0.549978f, 0.550058f, 0.550138f, 0.550218f, 0.550298f, 0.550378f,
- 0.550458f, 0.550538f, 0.550618f, 0.550698f, 0.550778f, 0.550858f, 0.550938f, 0.551018f,
- 0.551098f, 0.551178f, 0.551258f, 0.551338f, 0.551418f, 0.551498f, 0.551578f, 0.551658f,
- 0.551738f, 0.551818f, 0.551898f, 0.551978f, 0.552058f, 0.552138f, 0.552218f, 0.552298f,
- 0.552378f, 0.552457f, 0.552537f, 0.552617f, 0.552697f, 0.552777f, 0.552857f, 0.552937f,
- 0.553017f, 0.553097f, 0.553176f, 0.553256f, 0.553336f, 0.553416f, 0.553496f, 0.553576f,
- 0.553656f, 0.553735f, 0.553815f, 0.553895f, 0.553975f, 0.554055f, 0.554134f, 0.554214f,
- 0.554294f, 0.554374f, 0.554454f, 0.554533f, 0.554613f, 0.554693f, 0.554773f, 0.554853f,
- 0.554932f, 0.555012f, 0.555092f, 0.555172f, 0.555251f, 0.555331f, 0.555411f, 0.555490f,
- 0.555570f, 0.555650f, 0.555730f, 0.555809f, 0.555889f, 0.555969f, 0.556048f, 0.556128f,
- 0.556208f, 0.556287f, 0.556367f, 0.556447f, 0.556526f, 0.556606f, 0.556686f, 0.556765f,
- 0.556845f, 0.556925f, 0.557004f, 0.557084f, 0.557164f, 0.557243f, 0.557323f, 0.557402f,
- 0.557482f, 0.557562f, 0.557641f, 0.557721f, 0.557800f, 0.557880f, 0.557959f, 0.558039f,
- 0.558119f, 0.558198f, 0.558278f, 0.558357f, 0.558437f, 0.558516f, 0.558596f, 0.558675f,
- 0.558755f, 0.558834f, 0.558914f, 0.558993f, 0.559073f, 0.559152f, 0.559232f, 0.559311f,
- 0.559391f, 0.559470f, 0.559550f, 0.559629f, 0.559709f, 0.559788f, 0.559867f, 0.559947f,
- 0.560026f, 0.560106f, 0.560185f, 0.560265f, 0.560344f, 0.560423f, 0.560503f, 0.560582f,
- 0.560662f, 0.560741f, 0.560820f, 0.560900f, 0.560979f, 0.561058f, 0.561138f, 0.561217f,
- 0.561297f, 0.561376f, 0.561455f, 0.561535f, 0.561614f, 0.561693f, 0.561773f, 0.561852f,
- 0.561931f, 0.562010f, 0.562090f, 0.562169f, 0.562248f, 0.562328f, 0.562407f, 0.562486f,
- 0.562565f, 0.562645f, 0.562724f, 0.562803f, 0.562882f, 0.562962f, 0.563041f, 0.563120f,
- 0.563199f, 0.563279f, 0.563358f, 0.563437f, 0.563516f, 0.563595f, 0.563675f, 0.563754f,
- 0.563833f, 0.563912f, 0.563991f, 0.564070f, 0.564150f, 0.564229f, 0.564308f, 0.564387f,
- 0.564466f, 0.564545f, 0.564624f, 0.564704f, 0.564783f, 0.564862f, 0.564941f, 0.565020f,
- 0.565099f, 0.565178f, 0.565257f, 0.565336f, 0.565416f, 0.565495f, 0.565574f, 0.565653f,
- 0.565732f, 0.565811f, 0.565890f, 0.565969f, 0.566048f, 0.566127f, 0.566206f, 0.566285f,
- 0.566364f, 0.566443f, 0.566522f, 0.566601f, 0.566680f, 0.566759f, 0.566838f, 0.566917f,
- 0.566996f, 0.567075f, 0.567154f, 0.567233f, 0.567312f, 0.567391f, 0.567470f, 0.567549f,
- 0.567628f, 0.567707f, 0.567786f, 0.567864f, 0.567943f, 0.568022f, 0.568101f, 0.568180f,
- 0.568259f, 0.568338f, 0.568417f, 0.568496f, 0.568574f, 0.568653f, 0.568732f, 0.568811f,
- 0.568890f, 0.568969f, 0.569048f, 0.569126f, 0.569205f, 0.569284f, 0.569363f, 0.569442f,
- 0.569521f, 0.569599f, 0.569678f, 0.569757f, 0.569836f, 0.569914f, 0.569993f, 0.570072f,
- 0.570151f, 0.570230f, 0.570308f, 0.570387f, 0.570466f, 0.570545f, 0.570623f, 0.570702f,
- 0.570781f, 0.570859f, 0.570938f, 0.571017f, 0.571096f, 0.571174f, 0.571253f, 0.571332f,
- 0.571410f, 0.571489f, 0.571568f, 0.571646f, 0.571725f, 0.571804f, 0.571882f, 0.571961f,
- 0.572040f, 0.572118f, 0.572197f, 0.572276f, 0.572354f, 0.572433f, 0.572511f, 0.572590f,
- 0.572669f, 0.572747f, 0.572826f, 0.572904f, 0.572983f, 0.573061f, 0.573140f, 0.573219f,
- 0.573297f, 0.573376f, 0.573454f, 0.573533f, 0.573611f, 0.573690f, 0.573768f, 0.573847f,
- 0.573925f, 0.574004f, 0.574082f, 0.574161f, 0.574239f, 0.574318f, 0.574396f, 0.574475f,
- 0.574553f, 0.574632f, 0.574710f, 0.574789f, 0.574867f, 0.574946f, 0.575024f, 0.575103f,
- 0.575181f, 0.575259f, 0.575338f, 0.575416f, 0.575495f, 0.575573f, 0.575651f, 0.575730f,
- 0.575808f, 0.575887f, 0.575965f, 0.576043f, 0.576122f, 0.576200f, 0.576278f, 0.576357f,
- 0.576435f, 0.576513f, 0.576592f, 0.576670f, 0.576748f, 0.576827f, 0.576905f, 0.576983f,
- 0.577062f, 0.577140f, 0.577218f, 0.577297f, 0.577375f, 0.577453f, 0.577531f, 0.577610f,
- 0.577688f, 0.577766f, 0.577844f, 0.577923f, 0.578001f, 0.578079f, 0.578157f, 0.578236f,
- 0.578314f, 0.578392f, 0.578470f, 0.578548f, 0.578627f, 0.578705f, 0.578783f, 0.578861f,
- 0.578939f, 0.579018f, 0.579096f, 0.579174f, 0.579252f, 0.579330f, 0.579408f, 0.579486f,
- 0.579565f, 0.579643f, 0.579721f, 0.579799f, 0.579877f, 0.579955f, 0.580033f, 0.580111f,
- 0.580189f, 0.580267f, 0.580346f, 0.580424f, 0.580502f, 0.580580f, 0.580658f, 0.580736f,
- 0.580814f, 0.580892f, 0.580970f, 0.581048f, 0.581126f, 0.581204f, 0.581282f, 0.581360f,
- 0.581438f, 0.581516f, 0.581594f, 0.581672f, 0.581750f, 0.581828f, 0.581906f, 0.581984f,
- 0.582062f, 0.582140f, 0.582218f, 0.582296f, 0.582374f, 0.582452f, 0.582530f, 0.582608f,
- 0.582685f, 0.582763f, 0.582841f, 0.582919f, 0.582997f, 0.583075f, 0.583153f, 0.583231f,
- 0.583309f, 0.583387f, 0.583464f, 0.583542f, 0.583620f, 0.583698f, 0.583776f, 0.583854f,
- 0.583931f, 0.584009f, 0.584087f, 0.584165f, 0.584243f, 0.584321f, 0.584398f, 0.584476f,
- 0.584554f, 0.584632f, 0.584710f, 0.584787f, 0.584865f, 0.584943f, 0.585021f, 0.585098f,
- 0.585176f, 0.585254f, 0.585332f, 0.585409f, 0.585487f, 0.585565f, 0.585642f, 0.585720f,
- 0.585798f, 0.585876f, 0.585953f, 0.586031f, 0.586109f, 0.586186f, 0.586264f, 0.586342f,
- 0.586419f, 0.586497f, 0.586575f, 0.586652f, 0.586730f, 0.586808f, 0.586885f, 0.586963f,
- 0.587040f, 0.587118f, 0.587196f, 0.587273f, 0.587351f, 0.587428f, 0.587506f, 0.587584f,
- 0.587661f, 0.587739f, 0.587816f, 0.587894f, 0.587971f, 0.588049f, 0.588126f, 0.588204f,
- 0.588282f, 0.588359f, 0.588437f, 0.588514f, 0.588592f, 0.588669f, 0.588747f, 0.588824f,
- 0.588902f, 0.588979f, 0.589057f, 0.589134f, 0.589212f, 0.589289f, 0.589366f, 0.589444f,
- 0.589521f, 0.589599f, 0.589676f, 0.589754f, 0.589831f, 0.589908f, 0.589986f, 0.590063f,
- 0.590141f, 0.590218f, 0.590295f, 0.590373f, 0.590450f, 0.590528f, 0.590605f, 0.590682f,
- 0.590760f, 0.590837f, 0.590914f, 0.590992f, 0.591069f, 0.591146f, 0.591224f, 0.591301f,
- 0.591378f, 0.591456f, 0.591533f, 0.591610f, 0.591688f, 0.591765f, 0.591842f, 0.591919f,
- 0.591997f, 0.592074f, 0.592151f, 0.592228f, 0.592306f, 0.592383f, 0.592460f, 0.592537f,
- 0.592615f, 0.592692f, 0.592769f, 0.592846f, 0.592924f, 0.593001f, 0.593078f, 0.593155f,
- 0.593232f, 0.593309f, 0.593387f, 0.593464f, 0.593541f, 0.593618f, 0.593695f, 0.593772f,
- 0.593850f, 0.593927f, 0.594004f, 0.594081f, 0.594158f, 0.594235f, 0.594312f, 0.594389f,
- 0.594467f, 0.594544f, 0.594621f, 0.594698f, 0.594775f, 0.594852f, 0.594929f, 0.595006f,
- 0.595083f, 0.595160f, 0.595237f, 0.595314f, 0.595391f, 0.595468f, 0.595545f, 0.595622f,
- 0.595699f, 0.595776f, 0.595853f, 0.595930f, 0.596007f, 0.596084f, 0.596161f, 0.596238f,
- 0.596315f, 0.596392f, 0.596469f, 0.596546f, 0.596623f, 0.596700f, 0.596777f, 0.596854f,
- 0.596931f, 0.597008f, 0.597085f, 0.597161f, 0.597238f, 0.597315f, 0.597392f, 0.597469f,
- 0.597546f, 0.597623f, 0.597700f, 0.597776f, 0.597853f, 0.597930f, 0.598007f, 0.598084f,
- 0.598161f, 0.598238f, 0.598314f, 0.598391f, 0.598468f, 0.598545f, 0.598622f, 0.598698f,
- 0.598775f, 0.598852f, 0.598929f, 0.599006f, 0.599082f, 0.599159f, 0.599236f, 0.599313f,
- 0.599389f, 0.599466f, 0.599543f, 0.599620f, 0.599696f, 0.599773f, 0.599850f, 0.599926f,
- 0.600003f, 0.600080f, 0.600156f, 0.600233f, 0.600310f, 0.600387f, 0.600463f, 0.600540f,
- 0.600616f, 0.600693f, 0.600770f, 0.600846f, 0.600923f, 0.601000f, 0.601076f, 0.601153f,
- 0.601230f, 0.601306f, 0.601383f, 0.601459f, 0.601536f, 0.601613f, 0.601689f, 0.601766f,
- 0.601842f, 0.601919f, 0.601995f, 0.602072f, 0.602148f, 0.602225f, 0.602302f, 0.602378f,
- 0.602455f, 0.602531f, 0.602608f, 0.602684f, 0.602761f, 0.602837f, 0.602914f, 0.602990f,
- 0.603067f, 0.603143f, 0.603220f, 0.603296f, 0.603372f, 0.603449f, 0.603525f, 0.603602f,
- 0.603678f, 0.603755f, 0.603831f, 0.603908f, 0.603984f, 0.604060f, 0.604137f, 0.604213f,
- 0.604290f, 0.604366f, 0.604442f, 0.604519f, 0.604595f, 0.604671f, 0.604748f, 0.604824f,
- 0.604900f, 0.604977f, 0.605053f, 0.605129f, 0.605206f, 0.605282f, 0.605358f, 0.605435f,
- 0.605511f, 0.605587f, 0.605664f, 0.605740f, 0.605816f, 0.605892f, 0.605969f, 0.606045f,
- 0.606121f, 0.606198f, 0.606274f, 0.606350f, 0.606426f, 0.606502f, 0.606579f, 0.606655f,
- 0.606731f, 0.606807f, 0.606884f, 0.606960f, 0.607036f, 0.607112f, 0.607188f, 0.607264f,
- 0.607341f, 0.607417f, 0.607493f, 0.607569f, 0.607645f, 0.607721f, 0.607798f, 0.607874f,
- 0.607950f, 0.608026f, 0.608102f, 0.608178f, 0.608254f, 0.608330f, 0.608406f, 0.608482f,
- 0.608559f, 0.608635f, 0.608711f, 0.608787f, 0.608863f, 0.608939f, 0.609015f, 0.609091f,
- 0.609167f, 0.609243f, 0.609319f, 0.609395f, 0.609471f, 0.609547f, 0.609623f, 0.609699f,
- 0.609775f, 0.609851f, 0.609927f, 0.610003f, 0.610079f, 0.610155f, 0.610231f, 0.610307f,
- 0.610383f, 0.610459f, 0.610535f, 0.610611f, 0.610687f, 0.610762f, 0.610838f, 0.610914f,
- 0.610990f, 0.611066f, 0.611142f, 0.611218f, 0.611294f, 0.611370f, 0.611445f, 0.611521f,
- 0.611597f, 0.611673f, 0.611749f, 0.611825f, 0.611901f, 0.611976f, 0.612052f, 0.612128f,
- 0.612204f, 0.612280f, 0.612355f, 0.612431f, 0.612507f, 0.612583f, 0.612659f, 0.612734f,
- 0.612810f, 0.612886f, 0.612962f, 0.613037f, 0.613113f, 0.613189f, 0.613265f, 0.613340f,
- 0.613416f, 0.613492f, 0.613567f, 0.613643f, 0.613719f, 0.613795f, 0.613870f, 0.613946f,
- 0.614022f, 0.614097f, 0.614173f, 0.614249f, 0.614324f, 0.614400f, 0.614475f, 0.614551f,
- 0.614627f, 0.614702f, 0.614778f, 0.614854f, 0.614929f, 0.615005f, 0.615080f, 0.615156f,
- 0.615232f, 0.615307f, 0.615383f, 0.615458f, 0.615534f, 0.615609f, 0.615685f, 0.615761f,
- 0.615836f, 0.615912f, 0.615987f, 0.616063f, 0.616138f, 0.616214f, 0.616289f, 0.616365f,
- 0.616440f, 0.616516f, 0.616591f, 0.616667f, 0.616742f, 0.616818f, 0.616893f, 0.616968f,
- 0.617044f, 0.617119f, 0.617195f, 0.617270f, 0.617346f, 0.617421f, 0.617496f, 0.617572f,
- 0.617647f, 0.617723f, 0.617798f, 0.617873f, 0.617949f, 0.618024f, 0.618100f, 0.618175f,
- 0.618250f, 0.618326f, 0.618401f, 0.618476f, 0.618552f, 0.618627f, 0.618702f, 0.618778f,
- 0.618853f, 0.618928f, 0.619004f, 0.619079f, 0.619154f, 0.619229f, 0.619305f, 0.619380f,
- 0.619455f, 0.619531f, 0.619606f, 0.619681f, 0.619756f, 0.619832f, 0.619907f, 0.619982f,
- 0.620057f, 0.620132f, 0.620208f, 0.620283f, 0.620358f, 0.620433f, 0.620508f, 0.620584f,
- 0.620659f, 0.620734f, 0.620809f, 0.620884f, 0.620959f, 0.621035f, 0.621110f, 0.621185f,
- 0.621260f, 0.621335f, 0.621410f, 0.621485f, 0.621560f, 0.621636f, 0.621711f, 0.621786f,
- 0.621861f, 0.621936f, 0.622011f, 0.622086f, 0.622161f, 0.622236f, 0.622311f, 0.622386f,
- 0.622461f, 0.622536f, 0.622611f, 0.622686f, 0.622761f, 0.622836f, 0.622911f, 0.622986f,
- 0.623061f, 0.623136f, 0.623211f, 0.623286f, 0.623361f, 0.623436f, 0.623511f, 0.623586f,
- 0.623661f, 0.623736f, 0.623811f, 0.623886f, 0.623961f, 0.624036f, 0.624111f, 0.624186f,
- 0.624260f, 0.624335f, 0.624410f, 0.624485f, 0.624560f, 0.624635f, 0.624710f, 0.624785f,
- 0.624860f, 0.624934f, 0.625009f, 0.625084f, 0.625159f, 0.625234f, 0.625309f, 0.625383f,
- 0.625458f, 0.625533f, 0.625608f, 0.625683f, 0.625757f, 0.625832f, 0.625907f, 0.625982f,
- 0.626056f, 0.626131f, 0.626206f, 0.626281f, 0.626355f, 0.626430f, 0.626505f, 0.626580f,
- 0.626654f, 0.626729f, 0.626804f, 0.626878f, 0.626953f, 0.627028f, 0.627102f, 0.627177f,
- 0.627252f, 0.627326f, 0.627401f, 0.627476f, 0.627550f, 0.627625f, 0.627700f, 0.627774f,
- 0.627849f, 0.627924f, 0.627998f, 0.628073f, 0.628147f, 0.628222f, 0.628297f, 0.628371f,
- 0.628446f, 0.628520f, 0.628595f, 0.628669f, 0.628744f, 0.628819f, 0.628893f, 0.628968f,
- 0.629042f, 0.629117f, 0.629191f, 0.629266f, 0.629340f, 0.629415f, 0.629489f, 0.629564f,
- 0.629638f, 0.629713f, 0.629787f, 0.629862f, 0.629936f, 0.630011f, 0.630085f, 0.630159f,
- 0.630234f, 0.630308f, 0.630383f, 0.630457f, 0.630532f, 0.630606f, 0.630680f, 0.630755f,
- 0.630829f, 0.630904f, 0.630978f, 0.631052f, 0.631127f, 0.631201f, 0.631275f, 0.631350f,
- 0.631424f, 0.631499f, 0.631573f, 0.631647f, 0.631721f, 0.631796f, 0.631870f, 0.631944f,
- 0.632019f, 0.632093f, 0.632167f, 0.632242f, 0.632316f, 0.632390f, 0.632464f, 0.632539f,
- 0.632613f, 0.632687f, 0.632761f, 0.632836f, 0.632910f, 0.632984f, 0.633058f, 0.633133f,
- 0.633207f, 0.633281f, 0.633355f, 0.633429f, 0.633504f, 0.633578f, 0.633652f, 0.633726f,
- 0.633800f, 0.633874f, 0.633949f, 0.634023f, 0.634097f, 0.634171f, 0.634245f, 0.634319f,
- 0.634393f, 0.634467f, 0.634542f, 0.634616f, 0.634690f, 0.634764f, 0.634838f, 0.634912f,
- 0.634986f, 0.635060f, 0.635134f, 0.635208f, 0.635282f, 0.635356f, 0.635430f, 0.635504f,
- 0.635578f, 0.635652f, 0.635726f, 0.635800f, 0.635874f, 0.635948f, 0.636022f, 0.636096f,
- 0.636170f, 0.636244f, 0.636318f, 0.636392f, 0.636466f, 0.636540f, 0.636614f, 0.636688f,
- 0.636762f, 0.636836f, 0.636910f, 0.636984f, 0.637057f, 0.637131f, 0.637205f, 0.637279f,
- 0.637353f, 0.637427f, 0.637501f, 0.637575f, 0.637649f, 0.637722f, 0.637796f, 0.637870f,
- 0.637944f, 0.638018f, 0.638092f, 0.638165f, 0.638239f, 0.638313f, 0.638387f, 0.638461f,
- 0.638534f, 0.638608f, 0.638682f, 0.638756f, 0.638829f, 0.638903f, 0.638977f, 0.639051f,
- 0.639124f, 0.639198f, 0.639272f, 0.639346f, 0.639419f, 0.639493f, 0.639567f, 0.639640f,
- 0.639714f, 0.639788f, 0.639862f, 0.639935f, 0.640009f, 0.640083f, 0.640156f, 0.640230f,
- 0.640303f, 0.640377f, 0.640451f, 0.640524f, 0.640598f, 0.640672f, 0.640745f, 0.640819f,
- 0.640892f, 0.640966f, 0.641040f, 0.641113f, 0.641187f, 0.641260f, 0.641334f, 0.641407f,
- 0.641481f, 0.641555f, 0.641628f, 0.641702f, 0.641775f, 0.641849f, 0.641922f, 0.641996f,
- 0.642069f, 0.642143f, 0.642216f, 0.642290f, 0.642363f, 0.642437f, 0.642510f, 0.642584f,
- 0.642657f, 0.642730f, 0.642804f, 0.642877f, 0.642951f, 0.643024f, 0.643098f, 0.643171f,
- 0.643245f, 0.643318f, 0.643391f, 0.643465f, 0.643538f, 0.643611f, 0.643685f, 0.643758f,
- 0.643832f, 0.643905f, 0.643978f, 0.644052f, 0.644125f, 0.644198f, 0.644272f, 0.644345f,
- 0.644418f, 0.644492f, 0.644565f, 0.644638f, 0.644711f, 0.644785f, 0.644858f, 0.644931f,
- 0.645005f, 0.645078f, 0.645151f, 0.645224f, 0.645298f, 0.645371f, 0.645444f, 0.645517f,
- 0.645590f, 0.645664f, 0.645737f, 0.645810f, 0.645883f, 0.645956f, 0.646030f, 0.646103f,
- 0.646176f, 0.646249f, 0.646322f, 0.646396f, 0.646469f, 0.646542f, 0.646615f, 0.646688f,
- 0.646761f, 0.646834f, 0.646907f, 0.646981f, 0.647054f, 0.647127f, 0.647200f, 0.647273f,
- 0.647346f, 0.647419f, 0.647492f, 0.647565f, 0.647638f, 0.647711f, 0.647784f, 0.647857f,
- 0.647930f, 0.648003f, 0.648076f, 0.648149f, 0.648222f, 0.648295f, 0.648368f, 0.648441f,
- 0.648514f, 0.648587f, 0.648660f, 0.648733f, 0.648806f, 0.648879f, 0.648952f, 0.649025f,
- 0.649098f, 0.649171f, 0.649244f, 0.649317f, 0.649390f, 0.649463f, 0.649536f, 0.649608f,
- 0.649681f, 0.649754f, 0.649827f, 0.649900f, 0.649973f, 0.650046f, 0.650119f, 0.650191f,
- 0.650264f, 0.650337f, 0.650410f, 0.650483f, 0.650555f, 0.650628f, 0.650701f, 0.650774f,
- 0.650847f, 0.650919f, 0.650992f, 0.651065f, 0.651138f, 0.651211f, 0.651283f, 0.651356f,
- 0.651429f, 0.651502f, 0.651574f, 0.651647f, 0.651720f, 0.651792f, 0.651865f, 0.651938f,
- 0.652011f, 0.652083f, 0.652156f, 0.652229f, 0.652301f, 0.652374f, 0.652447f, 0.652519f,
- 0.652592f, 0.652665f, 0.652737f, 0.652810f, 0.652882f, 0.652955f, 0.653028f, 0.653100f,
- 0.653173f, 0.653245f, 0.653318f, 0.653391f, 0.653463f, 0.653536f, 0.653608f, 0.653681f,
- 0.653753f, 0.653826f, 0.653899f, 0.653971f, 0.654044f, 0.654116f, 0.654189f, 0.654261f,
- 0.654334f, 0.654406f, 0.654479f, 0.654551f, 0.654624f, 0.654696f, 0.654769f, 0.654841f,
- 0.654913f, 0.654986f, 0.655058f, 0.655131f, 0.655203f, 0.655276f, 0.655348f, 0.655420f,
- 0.655493f, 0.655565f, 0.655638f, 0.655710f, 0.655782f, 0.655855f, 0.655927f, 0.656000f,
- 0.656072f, 0.656144f, 0.656217f, 0.656289f, 0.656361f, 0.656434f, 0.656506f, 0.656578f,
- 0.656651f, 0.656723f, 0.656795f, 0.656867f, 0.656940f, 0.657012f, 0.657084f, 0.657157f,
- 0.657229f, 0.657301f, 0.657373f, 0.657446f, 0.657518f, 0.657590f, 0.657662f, 0.657734f,
- 0.657807f, 0.657879f, 0.657951f, 0.658023f, 0.658095f, 0.658168f, 0.658240f, 0.658312f,
- 0.658384f, 0.658456f, 0.658529f, 0.658601f, 0.658673f, 0.658745f, 0.658817f, 0.658889f,
- 0.658961f, 0.659033f, 0.659105f, 0.659178f, 0.659250f, 0.659322f, 0.659394f, 0.659466f,
- 0.659538f, 0.659610f, 0.659682f, 0.659754f, 0.659826f, 0.659898f, 0.659970f, 0.660042f,
- 0.660114f, 0.660186f, 0.660258f, 0.660330f, 0.660402f, 0.660474f, 0.660546f, 0.660618f,
- 0.660690f, 0.660762f, 0.660834f, 0.660906f, 0.660978f, 0.661050f, 0.661122f, 0.661194f,
- 0.661266f, 0.661338f, 0.661410f, 0.661482f, 0.661553f, 0.661625f, 0.661697f, 0.661769f,
- 0.661841f, 0.661913f, 0.661985f, 0.662057f, 0.662128f, 0.662200f, 0.662272f, 0.662344f,
- 0.662416f, 0.662488f, 0.662559f, 0.662631f, 0.662703f, 0.662775f, 0.662847f, 0.662918f,
- 0.662990f, 0.663062f, 0.663134f, 0.663205f, 0.663277f, 0.663349f, 0.663421f, 0.663492f,
- 0.663564f, 0.663636f, 0.663708f, 0.663779f, 0.663851f, 0.663923f, 0.663994f, 0.664066f,
- 0.664138f, 0.664209f, 0.664281f, 0.664353f, 0.664424f, 0.664496f, 0.664568f, 0.664639f,
- 0.664711f, 0.664783f, 0.664854f, 0.664926f, 0.664997f, 0.665069f, 0.665141f, 0.665212f,
- 0.665284f, 0.665355f, 0.665427f, 0.665498f, 0.665570f, 0.665642f, 0.665713f, 0.665785f,
- 0.665856f, 0.665928f, 0.665999f, 0.666071f, 0.666142f, 0.666214f, 0.666285f, 0.666357f,
- 0.666428f, 0.666500f, 0.666571f, 0.666643f, 0.666714f, 0.666786f, 0.666857f, 0.666928f,
- 0.667000f, 0.667071f, 0.667143f, 0.667214f, 0.667286f, 0.667357f, 0.667428f, 0.667500f,
- 0.667571f, 0.667643f, 0.667714f, 0.667785f, 0.667857f, 0.667928f, 0.667999f, 0.668071f,
- 0.668142f, 0.668213f, 0.668285f, 0.668356f, 0.668427f, 0.668499f, 0.668570f, 0.668641f,
- 0.668712f, 0.668784f, 0.668855f, 0.668926f, 0.668998f, 0.669069f, 0.669140f, 0.669211f,
- 0.669283f, 0.669354f, 0.669425f, 0.669496f, 0.669567f, 0.669639f, 0.669710f, 0.669781f,
- 0.669852f, 0.669923f, 0.669995f, 0.670066f, 0.670137f, 0.670208f, 0.670279f, 0.670350f,
- 0.670422f, 0.670493f, 0.670564f, 0.670635f, 0.670706f, 0.670777f, 0.670848f, 0.670919f,
- 0.670990f, 0.671062f, 0.671133f, 0.671204f, 0.671275f, 0.671346f, 0.671417f, 0.671488f,
- 0.671559f, 0.671630f, 0.671701f, 0.671772f, 0.671843f, 0.671914f, 0.671985f, 0.672056f,
- 0.672127f, 0.672198f, 0.672269f, 0.672340f, 0.672411f, 0.672482f, 0.672553f, 0.672624f,
- 0.672695f, 0.672766f, 0.672837f, 0.672908f, 0.672978f, 0.673049f, 0.673120f, 0.673191f,
- 0.673262f, 0.673333f, 0.673404f, 0.673475f, 0.673546f, 0.673616f, 0.673687f, 0.673758f,
- 0.673829f, 0.673900f, 0.673971f, 0.674042f, 0.674112f, 0.674183f, 0.674254f, 0.674325f,
- 0.674396f, 0.674466f, 0.674537f, 0.674608f, 0.674679f, 0.674749f, 0.674820f, 0.674891f,
- 0.674962f, 0.675032f, 0.675103f, 0.675174f, 0.675245f, 0.675315f, 0.675386f, 0.675457f,
- 0.675527f, 0.675598f, 0.675669f, 0.675739f, 0.675810f, 0.675881f, 0.675951f, 0.676022f,
- 0.676093f, 0.676163f, 0.676234f, 0.676305f, 0.676375f, 0.676446f, 0.676516f, 0.676587f,
- 0.676658f, 0.676728f, 0.676799f, 0.676869f, 0.676940f, 0.677011f, 0.677081f, 0.677152f,
- 0.677222f, 0.677293f, 0.677363f, 0.677434f, 0.677504f, 0.677575f, 0.677645f, 0.677716f,
- 0.677786f, 0.677857f, 0.677927f, 0.677998f, 0.678068f, 0.678139f, 0.678209f, 0.678280f,
- 0.678350f, 0.678420f, 0.678491f, 0.678561f, 0.678632f, 0.678702f, 0.678773f, 0.678843f,
- 0.678913f, 0.678984f, 0.679054f, 0.679125f, 0.679195f, 0.679265f, 0.679336f, 0.679406f,
- 0.679476f, 0.679547f, 0.679617f, 0.679687f, 0.679758f, 0.679828f, 0.679898f, 0.679969f,
- 0.680039f, 0.680109f, 0.680179f, 0.680250f, 0.680320f, 0.680390f, 0.680461f, 0.680531f,
- 0.680601f, 0.680671f, 0.680741f, 0.680812f, 0.680882f, 0.680952f, 0.681022f, 0.681093f,
- 0.681163f, 0.681233f, 0.681303f, 0.681373f, 0.681443f, 0.681514f, 0.681584f, 0.681654f,
- 0.681724f, 0.681794f, 0.681864f, 0.681934f, 0.682005f, 0.682075f, 0.682145f, 0.682215f,
- 0.682285f, 0.682355f, 0.682425f, 0.682495f, 0.682565f, 0.682635f, 0.682705f, 0.682775f,
- 0.682846f, 0.682916f, 0.682986f, 0.683056f, 0.683126f, 0.683196f, 0.683266f, 0.683336f,
- 0.683406f, 0.683476f, 0.683546f, 0.683616f, 0.683686f, 0.683756f, 0.683825f, 0.683895f,
- 0.683965f, 0.684035f, 0.684105f, 0.684175f, 0.684245f, 0.684315f, 0.684385f, 0.684455f,
- 0.684525f, 0.684595f, 0.684664f, 0.684734f, 0.684804f, 0.684874f, 0.684944f, 0.685014f,
- 0.685084f, 0.685153f, 0.685223f, 0.685293f, 0.685363f, 0.685433f, 0.685503f, 0.685572f,
- 0.685642f, 0.685712f, 0.685782f, 0.685852f, 0.685921f, 0.685991f, 0.686061f, 0.686131f,
- 0.686200f, 0.686270f, 0.686340f, 0.686409f, 0.686479f, 0.686549f, 0.686619f, 0.686688f,
- 0.686758f, 0.686828f, 0.686897f, 0.686967f, 0.687037f, 0.687106f, 0.687176f, 0.687246f,
- 0.687315f, 0.687385f, 0.687455f, 0.687524f, 0.687594f, 0.687663f, 0.687733f, 0.687803f,
- 0.687872f, 0.687942f, 0.688011f, 0.688081f, 0.688151f, 0.688220f, 0.688290f, 0.688359f,
- 0.688429f, 0.688498f, 0.688568f, 0.688637f, 0.688707f, 0.688776f, 0.688846f, 0.688915f,
- 0.688985f, 0.689054f, 0.689124f, 0.689193f, 0.689263f, 0.689332f, 0.689402f, 0.689471f,
- 0.689541f, 0.689610f, 0.689679f, 0.689749f, 0.689818f, 0.689888f, 0.689957f, 0.690026f,
- 0.690096f, 0.690165f, 0.690235f, 0.690304f, 0.690373f, 0.690443f, 0.690512f, 0.690581f,
- 0.690651f, 0.690720f, 0.690789f, 0.690859f, 0.690928f, 0.690997f, 0.691067f, 0.691136f,
- 0.691205f, 0.691274f, 0.691344f, 0.691413f, 0.691482f, 0.691552f, 0.691621f, 0.691690f,
- 0.691759f, 0.691828f, 0.691898f, 0.691967f, 0.692036f, 0.692105f, 0.692175f, 0.692244f,
- 0.692313f, 0.692382f, 0.692451f, 0.692520f, 0.692590f, 0.692659f, 0.692728f, 0.692797f,
- 0.692866f, 0.692935f, 0.693004f, 0.693074f, 0.693143f, 0.693212f, 0.693281f, 0.693350f,
- 0.693419f, 0.693488f, 0.693557f, 0.693626f, 0.693695f, 0.693764f, 0.693833f, 0.693902f,
- 0.693971f, 0.694040f, 0.694109f, 0.694179f, 0.694248f, 0.694317f, 0.694386f, 0.694454f,
- 0.694524f, 0.694592f, 0.694661f, 0.694730f, 0.694799f, 0.694868f, 0.694937f, 0.695006f,
- 0.695075f, 0.695144f, 0.695213f, 0.695282f, 0.695351f, 0.695420f, 0.695489f, 0.695557f,
- 0.695626f, 0.695695f, 0.695764f, 0.695833f, 0.695902f, 0.695971f, 0.696039f, 0.696108f,
- 0.696177f, 0.696246f, 0.696315f, 0.696384f, 0.696452f, 0.696521f, 0.696590f, 0.696659f,
- 0.696728f, 0.696796f, 0.696865f, 0.696934f, 0.697003f, 0.697071f, 0.697140f, 0.697209f,
- 0.697277f, 0.697346f, 0.697415f, 0.697484f, 0.697552f, 0.697621f, 0.697690f, 0.697758f,
- 0.697827f, 0.697896f, 0.697964f, 0.698033f, 0.698102f, 0.698170f, 0.698239f, 0.698308f,
- 0.698376f, 0.698445f, 0.698513f, 0.698582f, 0.698651f, 0.698719f, 0.698788f, 0.698856f,
- 0.698925f, 0.698994f, 0.699062f, 0.699131f, 0.699199f, 0.699268f, 0.699336f, 0.699405f,
- 0.699473f, 0.699542f, 0.699610f, 0.699679f, 0.699747f, 0.699816f, 0.699884f, 0.699953f,
- 0.700021f, 0.700090f, 0.700158f, 0.700227f, 0.700295f, 0.700364f, 0.700432f, 0.700500f,
- 0.700569f, 0.700637f, 0.700706f, 0.700774f, 0.700842f, 0.700911f, 0.700979f, 0.701048f,
- 0.701116f, 0.701184f, 0.701253f, 0.701321f, 0.701389f, 0.701458f, 0.701526f, 0.701594f,
- 0.701663f, 0.701731f, 0.701799f, 0.701868f, 0.701936f, 0.702004f, 0.702072f, 0.702141f,
- 0.702209f, 0.702277f, 0.702345f, 0.702414f, 0.702482f, 0.702550f, 0.702618f, 0.702687f,
- 0.702755f, 0.702823f, 0.702891f, 0.702959f, 0.703028f, 0.703096f, 0.703164f, 0.703232f,
- 0.703300f, 0.703368f, 0.703436f, 0.703505f, 0.703573f, 0.703641f, 0.703709f, 0.703777f,
- 0.703845f, 0.703913f, 0.703981f, 0.704050f, 0.704118f, 0.704186f, 0.704254f, 0.704322f,
- 0.704390f, 0.704458f, 0.704526f, 0.704594f, 0.704662f, 0.704730f, 0.704798f, 0.704866f,
- 0.704934f, 0.705002f, 0.705070f, 0.705138f, 0.705206f, 0.705274f, 0.705342f, 0.705410f,
- 0.705478f, 0.705546f, 0.705614f, 0.705682f, 0.705750f, 0.705818f, 0.705885f, 0.705953f,
- 0.706021f, 0.706089f, 0.706157f, 0.706225f, 0.706293f, 0.706361f, 0.706429f, 0.706496f,
- 0.706564f, 0.706632f, 0.706700f, 0.706768f, 0.706836f, 0.706903f, 0.706971f, 0.707039f,
- 0.707107f, 0.707175f, 0.707242f, 0.707310f, 0.707378f, 0.707446f, 0.707513f, 0.707581f,
- 0.707649f, 0.707717f, 0.707784f, 0.707852f, 0.707920f, 0.707988f, 0.708055f, 0.708123f,
- 0.708191f, 0.708258f, 0.708326f, 0.708394f, 0.708461f, 0.708529f, 0.708597f, 0.708664f,
- 0.708732f, 0.708800f, 0.708867f, 0.708935f, 0.709002f, 0.709070f, 0.709138f, 0.709205f,
- 0.709273f, 0.709340f, 0.709408f, 0.709476f, 0.709543f, 0.709611f, 0.709678f, 0.709746f,
- 0.709813f, 0.709881f, 0.709948f, 0.710016f, 0.710083f, 0.710151f, 0.710218f, 0.710286f,
- 0.710353f, 0.710421f, 0.710488f, 0.710556f, 0.710623f, 0.710691f, 0.710758f, 0.710826f,
- 0.710893f, 0.710960f, 0.711028f, 0.711095f, 0.711163f, 0.711230f, 0.711297f, 0.711365f,
- 0.711432f, 0.711500f, 0.711567f, 0.711634f, 0.711702f, 0.711769f, 0.711836f, 0.711904f,
- 0.711971f, 0.712038f, 0.712106f, 0.712173f, 0.712240f, 0.712308f, 0.712375f, 0.712442f,
- 0.712509f, 0.712577f, 0.712644f, 0.712711f, 0.712778f, 0.712846f, 0.712913f, 0.712980f,
- 0.713047f, 0.713115f, 0.713182f, 0.713249f, 0.713316f, 0.713383f, 0.713451f, 0.713518f,
- 0.713585f, 0.713652f, 0.713719f, 0.713786f, 0.713853f, 0.713921f, 0.713988f, 0.714055f,
- 0.714122f, 0.714189f, 0.714256f, 0.714323f, 0.714390f, 0.714457f, 0.714525f, 0.714592f,
- 0.714659f, 0.714726f, 0.714793f, 0.714860f, 0.714927f, 0.714994f, 0.715061f, 0.715128f,
- 0.715195f, 0.715262f, 0.715329f, 0.715396f, 0.715463f, 0.715530f, 0.715597f, 0.715664f,
- 0.715731f, 0.715798f, 0.715865f, 0.715932f, 0.715999f, 0.716066f, 0.716132f, 0.716199f,
- 0.716266f, 0.716333f, 0.716400f, 0.716467f, 0.716534f, 0.716601f, 0.716668f, 0.716734f,
- 0.716801f, 0.716868f, 0.716935f, 0.717002f, 0.717069f, 0.717135f, 0.717202f, 0.717269f,
- 0.717336f, 0.717403f, 0.717469f, 0.717536f, 0.717603f, 0.717670f, 0.717737f, 0.717803f,
- 0.717870f, 0.717937f, 0.718004f, 0.718070f, 0.718137f, 0.718204f, 0.718270f, 0.718337f,
- 0.718404f, 0.718471f, 0.718537f, 0.718604f, 0.718670f, 0.718737f, 0.718804f, 0.718870f,
- 0.718937f, 0.719004f, 0.719070f, 0.719137f, 0.719204f, 0.719270f, 0.719337f, 0.719403f,
- 0.719470f, 0.719537f, 0.719603f, 0.719670f, 0.719736f, 0.719803f, 0.719869f, 0.719936f,
- 0.720003f, 0.720069f, 0.720136f, 0.720202f, 0.720269f, 0.720335f, 0.720402f, 0.720468f,
- 0.720535f, 0.720601f, 0.720668f, 0.720734f, 0.720800f, 0.720867f, 0.720933f, 0.721000f,
- 0.721066f, 0.721133f, 0.721199f, 0.721265f, 0.721332f, 0.721398f, 0.721465f, 0.721531f,
- 0.721597f, 0.721664f, 0.721730f, 0.721797f, 0.721863f, 0.721929f, 0.721996f, 0.722062f,
- 0.722128f, 0.722194f, 0.722261f, 0.722327f, 0.722393f, 0.722460f, 0.722526f, 0.722592f,
- 0.722659f, 0.722725f, 0.722791f, 0.722857f, 0.722924f, 0.722990f, 0.723056f, 0.723122f,
- 0.723188f, 0.723255f, 0.723321f, 0.723387f, 0.723453f, 0.723520f, 0.723586f, 0.723652f,
- 0.723718f, 0.723784f, 0.723850f, 0.723916f, 0.723983f, 0.724049f, 0.724115f, 0.724181f,
- 0.724247f, 0.724313f, 0.724379f, 0.724445f, 0.724511f, 0.724578f, 0.724644f, 0.724710f,
- 0.724776f, 0.724842f, 0.724908f, 0.724974f, 0.725040f, 0.725106f, 0.725172f, 0.725238f,
- 0.725304f, 0.725370f, 0.725436f, 0.725502f, 0.725568f, 0.725634f, 0.725700f, 0.725766f,
- 0.725832f, 0.725898f, 0.725964f, 0.726030f, 0.726095f, 0.726161f, 0.726227f, 0.726293f,
- 0.726359f, 0.726425f, 0.726491f, 0.726557f, 0.726623f, 0.726689f, 0.726754f, 0.726820f,
- 0.726886f, 0.726952f, 0.727018f, 0.727084f, 0.727149f, 0.727215f, 0.727281f, 0.727347f,
- 0.727413f, 0.727478f, 0.727544f, 0.727610f, 0.727676f, 0.727741f, 0.727807f, 0.727873f,
- 0.727939f, 0.728004f, 0.728070f, 0.728136f, 0.728202f, 0.728267f, 0.728333f, 0.728399f,
- 0.728464f, 0.728530f, 0.728596f, 0.728661f, 0.728727f, 0.728793f, 0.728858f, 0.728924f,
- 0.728990f, 0.729055f, 0.729121f, 0.729186f, 0.729252f, 0.729318f, 0.729383f, 0.729449f,
- 0.729514f, 0.729580f, 0.729646f, 0.729711f, 0.729777f, 0.729842f, 0.729908f, 0.729973f,
- 0.730039f, 0.730104f, 0.730170f, 0.730235f, 0.730301f, 0.730366f, 0.730432f, 0.730497f,
- 0.730563f, 0.730628f, 0.730694f, 0.730759f, 0.730825f, 0.730890f, 0.730955f, 0.731021f,
- 0.731086f, 0.731152f, 0.731217f, 0.731282f, 0.731348f, 0.731413f, 0.731479f, 0.731544f,
- 0.731609f, 0.731675f, 0.731740f, 0.731805f, 0.731871f, 0.731936f, 0.732001f, 0.732067f,
- 0.732132f, 0.732197f, 0.732263f, 0.732328f, 0.732393f, 0.732458f, 0.732524f, 0.732589f,
- 0.732654f, 0.732720f, 0.732785f, 0.732850f, 0.732915f, 0.732980f, 0.733046f, 0.733111f,
- 0.733176f, 0.733241f, 0.733306f, 0.733372f, 0.733437f, 0.733502f, 0.733567f, 0.733632f,
- 0.733697f, 0.733763f, 0.733828f, 0.733893f, 0.733958f, 0.734023f, 0.734088f, 0.734153f,
- 0.734218f, 0.734283f, 0.734349f, 0.734414f, 0.734479f, 0.734544f, 0.734609f, 0.734674f,
- 0.734739f, 0.734804f, 0.734869f, 0.734934f, 0.734999f, 0.735064f, 0.735129f, 0.735194f,
- 0.735259f, 0.735324f, 0.735389f, 0.735454f, 0.735519f, 0.735584f, 0.735649f, 0.735714f,
- 0.735779f, 0.735844f, 0.735908f, 0.735973f, 0.736038f, 0.736103f, 0.736168f, 0.736233f,
- 0.736298f, 0.736363f, 0.736428f, 0.736492f, 0.736557f, 0.736622f, 0.736687f, 0.736752f,
- 0.736817f, 0.736881f, 0.736946f, 0.737011f, 0.737076f, 0.737141f, 0.737205f, 0.737270f,
- 0.737335f, 0.737400f, 0.737464f, 0.737529f, 0.737594f, 0.737659f, 0.737723f, 0.737788f,
- 0.737853f, 0.737918f, 0.737982f, 0.738047f, 0.738112f, 0.738176f, 0.738241f, 0.738306f,
- 0.738370f, 0.738435f, 0.738500f, 0.738564f, 0.738629f, 0.738693f, 0.738758f, 0.738823f,
- 0.738887f, 0.738952f, 0.739017f, 0.739081f, 0.739146f, 0.739210f, 0.739275f, 0.739339f,
- 0.739404f, 0.739468f, 0.739533f, 0.739598f, 0.739662f, 0.739727f, 0.739791f, 0.739856f,
- 0.739920f, 0.739985f, 0.740049f, 0.740114f, 0.740178f, 0.740242f, 0.740307f, 0.740371f,
- 0.740436f, 0.740500f, 0.740565f, 0.740629f, 0.740694f, 0.740758f, 0.740822f, 0.740887f,
- 0.740951f, 0.741015f, 0.741080f, 0.741144f, 0.741209f, 0.741273f, 0.741337f, 0.741402f,
- 0.741466f, 0.741530f, 0.741595f, 0.741659f, 0.741723f, 0.741788f, 0.741852f, 0.741916f,
- 0.741980f, 0.742045f, 0.742109f, 0.742173f, 0.742237f, 0.742302f, 0.742366f, 0.742430f,
- 0.742494f, 0.742559f, 0.742623f, 0.742687f, 0.742751f, 0.742815f, 0.742880f, 0.742944f,
- 0.743008f, 0.743072f, 0.743136f, 0.743200f, 0.743265f, 0.743329f, 0.743393f, 0.743457f,
- 0.743521f, 0.743585f, 0.743649f, 0.743713f, 0.743777f, 0.743842f, 0.743906f, 0.743970f,
- 0.744034f, 0.744098f, 0.744162f, 0.744226f, 0.744290f, 0.744354f, 0.744418f, 0.744482f,
- 0.744546f, 0.744610f, 0.744674f, 0.744738f, 0.744802f, 0.744866f, 0.744930f, 0.744994f,
- 0.745058f, 0.745122f, 0.745186f, 0.745250f, 0.745314f, 0.745377f, 0.745441f, 0.745505f,
- 0.745569f, 0.745633f, 0.745697f, 0.745761f, 0.745825f, 0.745889f, 0.745952f, 0.746016f,
- 0.746080f, 0.746144f, 0.746208f, 0.746272f, 0.746335f, 0.746399f, 0.746463f, 0.746527f,
- 0.746591f, 0.746654f, 0.746718f, 0.746782f, 0.746846f, 0.746909f, 0.746973f, 0.747037f,
- 0.747101f, 0.747164f, 0.747228f, 0.747292f, 0.747355f, 0.747419f, 0.747483f, 0.747547f,
- 0.747610f, 0.747674f, 0.747738f, 0.747801f, 0.747865f, 0.747929f, 0.747992f, 0.748056f,
- 0.748119f, 0.748183f, 0.748247f, 0.748310f, 0.748374f, 0.748437f, 0.748501f, 0.748565f,
- 0.748628f, 0.748692f, 0.748755f, 0.748819f, 0.748882f, 0.748946f, 0.749009f, 0.749073f,
- 0.749136f, 0.749200f, 0.749263f, 0.749327f, 0.749390f, 0.749454f, 0.749517f, 0.749581f,
- 0.749644f, 0.749708f, 0.749771f, 0.749835f, 0.749898f, 0.749961f, 0.750025f, 0.750088f,
- 0.750152f, 0.750215f, 0.750278f, 0.750342f, 0.750405f, 0.750469f, 0.750532f, 0.750595f,
- 0.750659f, 0.750722f, 0.750785f, 0.750849f, 0.750912f, 0.750975f, 0.751039f, 0.751102f,
- 0.751165f, 0.751228f, 0.751292f, 0.751355f, 0.751418f, 0.751481f, 0.751545f, 0.751608f,
- 0.751671f, 0.751734f, 0.751798f, 0.751861f, 0.751924f, 0.751987f, 0.752050f, 0.752114f,
- 0.752177f, 0.752240f, 0.752303f, 0.752366f, 0.752429f, 0.752493f, 0.752556f, 0.752619f,
- 0.752682f, 0.752745f, 0.752808f, 0.752871f, 0.752934f, 0.752998f, 0.753061f, 0.753124f,
- 0.753187f, 0.753250f, 0.753313f, 0.753376f, 0.753439f, 0.753502f, 0.753565f, 0.753628f,
- 0.753691f, 0.753754f, 0.753817f, 0.753880f, 0.753943f, 0.754006f, 0.754069f, 0.754132f,
- 0.754195f, 0.754258f, 0.754321f, 0.754384f, 0.754447f, 0.754510f, 0.754573f, 0.754636f,
- 0.754698f, 0.754761f, 0.754824f, 0.754887f, 0.754950f, 0.755013f, 0.755076f, 0.755139f,
- 0.755201f, 0.755264f, 0.755327f, 0.755390f, 0.755453f, 0.755516f, 0.755578f, 0.755641f,
- 0.755704f, 0.755767f, 0.755829f, 0.755892f, 0.755955f, 0.756018f, 0.756081f, 0.756143f,
- 0.756206f, 0.756269f, 0.756331f, 0.756394f, 0.756457f, 0.756520f, 0.756582f, 0.756645f,
- 0.756708f, 0.756770f, 0.756833f, 0.756896f, 0.756958f, 0.757021f, 0.757084f, 0.757146f,
- 0.757209f, 0.757271f, 0.757334f, 0.757397f, 0.757459f, 0.757522f, 0.757584f, 0.757647f,
- 0.757710f, 0.757772f, 0.757835f, 0.757897f, 0.757960f, 0.758022f, 0.758085f, 0.758147f,
- 0.758210f, 0.758272f, 0.758335f, 0.758397f, 0.758460f, 0.758522f, 0.758585f, 0.758647f,
- 0.758710f, 0.758772f, 0.758835f, 0.758897f, 0.758960f, 0.759022f, 0.759084f, 0.759147f,
- 0.759209f, 0.759272f, 0.759334f, 0.759396f, 0.759459f, 0.759521f, 0.759583f, 0.759646f,
- 0.759708f, 0.759771f, 0.759833f, 0.759895f, 0.759957f, 0.760020f, 0.760082f, 0.760144f,
- 0.760207f, 0.760269f, 0.760331f, 0.760394f, 0.760456f, 0.760518f, 0.760580f, 0.760643f,
- 0.760705f, 0.760767f, 0.760829f, 0.760891f, 0.760954f, 0.761016f, 0.761078f, 0.761140f,
- 0.761202f, 0.761265f, 0.761327f, 0.761389f, 0.761451f, 0.761513f, 0.761575f, 0.761637f,
- 0.761700f, 0.761762f, 0.761824f, 0.761886f, 0.761948f, 0.762010f, 0.762072f, 0.762134f,
- 0.762196f, 0.762258f, 0.762320f, 0.762382f, 0.762444f, 0.762507f, 0.762569f, 0.762631f,
- 0.762693f, 0.762755f, 0.762817f, 0.762879f, 0.762941f, 0.763003f, 0.763065f, 0.763126f,
- 0.763188f, 0.763250f, 0.763312f, 0.763374f, 0.763436f, 0.763498f, 0.763560f, 0.763622f,
- 0.763684f, 0.763746f, 0.763808f, 0.763869f, 0.763931f, 0.763993f, 0.764055f, 0.764117f,
- 0.764179f, 0.764241f, 0.764302f, 0.764364f, 0.764426f, 0.764488f, 0.764550f, 0.764611f,
- 0.764673f, 0.764735f, 0.764797f, 0.764859f, 0.764920f, 0.764982f, 0.765044f, 0.765106f,
- 0.765167f, 0.765229f, 0.765291f, 0.765352f, 0.765414f, 0.765476f, 0.765538f, 0.765599f,
- 0.765661f, 0.765723f, 0.765784f, 0.765846f, 0.765907f, 0.765969f, 0.766031f, 0.766092f,
- 0.766154f, 0.766216f, 0.766277f, 0.766339f, 0.766400f, 0.766462f, 0.766524f, 0.766585f,
- 0.766647f, 0.766708f, 0.766770f, 0.766831f, 0.766893f, 0.766954f, 0.767016f, 0.767077f,
- 0.767139f, 0.767200f, 0.767262f, 0.767323f, 0.767385f, 0.767446f, 0.767508f, 0.767569f,
- 0.767631f, 0.767692f, 0.767754f, 0.767815f, 0.767876f, 0.767938f, 0.767999f, 0.768061f,
- 0.768122f, 0.768183f, 0.768245f, 0.768306f, 0.768368f, 0.768429f, 0.768490f, 0.768552f,
- 0.768613f, 0.768674f, 0.768736f, 0.768797f, 0.768858f, 0.768919f, 0.768981f, 0.769042f,
- 0.769103f, 0.769165f, 0.769226f, 0.769287f, 0.769348f, 0.769410f, 0.769471f, 0.769532f,
- 0.769593f, 0.769655f, 0.769716f, 0.769777f, 0.769838f, 0.769899f, 0.769961f, 0.770022f,
- 0.770083f, 0.770144f, 0.770205f, 0.770266f, 0.770327f, 0.770389f, 0.770450f, 0.770511f,
- 0.770572f, 0.770633f, 0.770694f, 0.770755f, 0.770816f, 0.770877f, 0.770938f, 0.770999f,
- 0.771061f, 0.771122f, 0.771183f, 0.771244f, 0.771305f, 0.771366f, 0.771427f, 0.771488f,
- 0.771549f, 0.771610f, 0.771671f, 0.771732f, 0.771793f, 0.771854f, 0.771915f, 0.771975f,
- 0.772036f, 0.772097f, 0.772158f, 0.772219f, 0.772280f, 0.772341f, 0.772402f, 0.772463f,
- 0.772524f, 0.772584f, 0.772645f, 0.772706f, 0.772767f, 0.772828f, 0.772889f, 0.772950f,
- 0.773010f, 0.773071f, 0.773132f, 0.773193f, 0.773254f, 0.773314f, 0.773375f, 0.773436f,
- 0.773497f, 0.773558f, 0.773618f, 0.773679f, 0.773740f, 0.773801f, 0.773861f, 0.773922f,
- 0.773983f, 0.774043f, 0.774104f, 0.774165f, 0.774225f, 0.774286f, 0.774347f, 0.774407f,
- 0.774468f, 0.774529f, 0.774589f, 0.774650f, 0.774711f, 0.774771f, 0.774832f, 0.774893f,
- 0.774953f, 0.775014f, 0.775074f, 0.775135f, 0.775195f, 0.775256f, 0.775317f, 0.775377f,
- 0.775438f, 0.775498f, 0.775559f, 0.775619f, 0.775680f, 0.775740f, 0.775801f, 0.775861f,
- 0.775922f, 0.775982f, 0.776043f, 0.776103f, 0.776164f, 0.776224f, 0.776284f, 0.776345f,
- 0.776405f, 0.776466f, 0.776526f, 0.776587f, 0.776647f, 0.776707f, 0.776768f, 0.776828f,
- 0.776888f, 0.776949f, 0.777009f, 0.777070f, 0.777130f, 0.777190f, 0.777251f, 0.777311f,
- 0.777371f, 0.777431f, 0.777492f, 0.777552f, 0.777612f, 0.777673f, 0.777733f, 0.777793f,
- 0.777853f, 0.777914f, 0.777974f, 0.778034f, 0.778094f, 0.778155f, 0.778215f, 0.778275f,
- 0.778335f, 0.778395f, 0.778456f, 0.778516f, 0.778576f, 0.778636f, 0.778696f, 0.778756f,
- 0.778817f, 0.778877f, 0.778937f, 0.778997f, 0.779057f, 0.779117f, 0.779177f, 0.779237f,
- 0.779297f, 0.779357f, 0.779418f, 0.779478f, 0.779538f, 0.779598f, 0.779658f, 0.779718f,
- 0.779778f, 0.779838f, 0.779898f, 0.779958f, 0.780018f, 0.780078f, 0.780138f, 0.780198f,
- 0.780258f, 0.780318f, 0.780378f, 0.780438f, 0.780498f, 0.780557f, 0.780617f, 0.780677f,
- 0.780737f, 0.780797f, 0.780857f, 0.780917f, 0.780977f, 0.781037f, 0.781097f, 0.781156f,
- 0.781216f, 0.781276f, 0.781336f, 0.781396f, 0.781456f, 0.781515f, 0.781575f, 0.781635f,
- 0.781695f, 0.781755f, 0.781814f, 0.781874f, 0.781934f, 0.781994f, 0.782053f, 0.782113f,
- 0.782173f, 0.782233f, 0.782292f, 0.782352f, 0.782412f, 0.782472f, 0.782531f, 0.782591f,
- 0.782651f, 0.782710f, 0.782770f, 0.782830f, 0.782889f, 0.782949f, 0.783009f, 0.783068f,
- 0.783128f, 0.783187f, 0.783247f, 0.783307f, 0.783366f, 0.783426f, 0.783485f, 0.783545f,
- 0.783605f, 0.783664f, 0.783724f, 0.783783f, 0.783843f, 0.783902f, 0.783962f, 0.784021f,
- 0.784081f, 0.784140f, 0.784200f, 0.784259f, 0.784319f, 0.784378f, 0.784438f, 0.784497f,
- 0.784557f, 0.784616f, 0.784675f, 0.784735f, 0.784794f, 0.784854f, 0.784913f, 0.784973f,
- 0.785032f, 0.785091f, 0.785151f, 0.785210f, 0.785269f, 0.785329f, 0.785388f, 0.785447f,
- 0.785507f, 0.785566f, 0.785625f, 0.785685f, 0.785744f, 0.785803f, 0.785863f, 0.785922f,
- 0.785981f, 0.786041f, 0.786100f, 0.786159f, 0.786218f, 0.786278f, 0.786337f, 0.786396f,
- 0.786455f, 0.786514f, 0.786574f, 0.786633f, 0.786692f, 0.786751f, 0.786810f, 0.786870f,
- 0.786929f, 0.786988f, 0.787047f, 0.787106f, 0.787165f, 0.787224f, 0.787284f, 0.787343f,
- 0.787402f, 0.787461f, 0.787520f, 0.787579f, 0.787638f, 0.787697f, 0.787756f, 0.787815f,
- 0.787874f, 0.787933f, 0.787992f, 0.788051f, 0.788110f, 0.788169f, 0.788228f, 0.788287f,
- 0.788346f, 0.788405f, 0.788464f, 0.788523f, 0.788582f, 0.788641f, 0.788700f, 0.788759f,
- 0.788818f, 0.788877f, 0.788936f, 0.788995f, 0.789054f, 0.789113f, 0.789172f, 0.789230f,
- 0.789289f, 0.789348f, 0.789407f, 0.789466f, 0.789525f, 0.789584f, 0.789642f, 0.789701f,
- 0.789760f, 0.789819f, 0.789878f, 0.789936f, 0.789995f, 0.790054f, 0.790113f, 0.790171f,
- 0.790230f, 0.790289f, 0.790348f, 0.790406f, 0.790465f, 0.790524f, 0.790583f, 0.790641f,
- 0.790700f, 0.790759f, 0.790817f, 0.790876f, 0.790935f, 0.790993f, 0.791052f, 0.791111f,
- 0.791169f, 0.791228f, 0.791287f, 0.791345f, 0.791404f, 0.791462f, 0.791521f, 0.791580f,
- 0.791638f, 0.791697f, 0.791755f, 0.791814f, 0.791872f, 0.791931f, 0.791990f, 0.792048f,
- 0.792107f, 0.792165f, 0.792224f, 0.792282f, 0.792341f, 0.792399f, 0.792458f, 0.792516f,
- 0.792575f, 0.792633f, 0.792691f, 0.792750f, 0.792808f, 0.792867f, 0.792925f, 0.792984f,
- 0.793042f, 0.793100f, 0.793159f, 0.793217f, 0.793276f, 0.793334f, 0.793392f, 0.793451f,
- 0.793509f, 0.793567f, 0.793626f, 0.793684f, 0.793742f, 0.793801f, 0.793859f, 0.793917f,
- 0.793975f, 0.794034f, 0.794092f, 0.794150f, 0.794209f, 0.794267f, 0.794325f, 0.794383f,
- 0.794442f, 0.794500f, 0.794558f, 0.794616f, 0.794674f, 0.794733f, 0.794791f, 0.794849f,
- 0.794907f, 0.794965f, 0.795023f, 0.795082f, 0.795140f, 0.795198f, 0.795256f, 0.795314f,
- 0.795372f, 0.795430f, 0.795488f, 0.795547f, 0.795605f, 0.795663f, 0.795721f, 0.795779f,
- 0.795837f, 0.795895f, 0.795953f, 0.796011f, 0.796069f, 0.796127f, 0.796185f, 0.796243f,
- 0.796301f, 0.796359f, 0.796417f, 0.796475f, 0.796533f, 0.796591f, 0.796649f, 0.796707f,
- 0.796765f, 0.796823f, 0.796881f, 0.796939f, 0.796996f, 0.797054f, 0.797112f, 0.797170f,
- 0.797228f, 0.797286f, 0.797344f, 0.797402f, 0.797459f, 0.797517f, 0.797575f, 0.797633f,
- 0.797691f, 0.797749f, 0.797806f, 0.797864f, 0.797922f, 0.797980f, 0.798038f, 0.798095f,
- 0.798153f, 0.798211f, 0.798269f, 0.798326f, 0.798384f, 0.798442f, 0.798500f, 0.798557f,
- 0.798615f, 0.798673f, 0.798730f, 0.798788f, 0.798846f, 0.798903f, 0.798961f, 0.799019f,
- 0.799076f, 0.799134f, 0.799192f, 0.799249f, 0.799307f, 0.799365f, 0.799422f, 0.799480f,
- 0.799537f, 0.799595f, 0.799652f, 0.799710f, 0.799768f, 0.799825f, 0.799883f, 0.799940f,
- 0.799998f, 0.800055f, 0.800113f, 0.800170f, 0.800228f, 0.800285f, 0.800343f, 0.800400f,
- 0.800458f, 0.800515f, 0.800573f, 0.800630f, 0.800687f, 0.800745f, 0.800802f, 0.800860f,
- 0.800917f, 0.800975f, 0.801032f, 0.801089f, 0.801147f, 0.801204f, 0.801261f, 0.801319f,
- 0.801376f, 0.801434f, 0.801491f, 0.801548f, 0.801606f, 0.801663f, 0.801720f, 0.801777f,
- 0.801835f, 0.801892f, 0.801949f, 0.802007f, 0.802064f, 0.802121f, 0.802178f, 0.802236f,
- 0.802293f, 0.802350f, 0.802407f, 0.802464f, 0.802522f, 0.802579f, 0.802636f, 0.802693f,
- 0.802750f, 0.802808f, 0.802865f, 0.802922f, 0.802979f, 0.803036f, 0.803093f, 0.803150f,
- 0.803208f, 0.803265f, 0.803322f, 0.803379f, 0.803436f, 0.803493f, 0.803550f, 0.803607f,
- 0.803664f, 0.803721f, 0.803778f, 0.803835f, 0.803892f, 0.803949f, 0.804006f, 0.804063f,
- 0.804120f, 0.804177f, 0.804234f, 0.804291f, 0.804348f, 0.804405f, 0.804462f, 0.804519f,
- 0.804576f, 0.804633f, 0.804690f, 0.804747f, 0.804804f, 0.804861f, 0.804918f, 0.804974f,
- 0.805031f, 0.805088f, 0.805145f, 0.805202f, 0.805259f, 0.805316f, 0.805372f, 0.805429f,
- 0.805486f, 0.805543f, 0.805600f, 0.805656f, 0.805713f, 0.805770f, 0.805827f, 0.805884f,
- 0.805940f, 0.805997f, 0.806054f, 0.806111f, 0.806167f, 0.806224f, 0.806281f, 0.806338f,
- 0.806394f, 0.806451f, 0.806508f, 0.806564f, 0.806621f, 0.806678f, 0.806734f, 0.806791f,
- 0.806848f, 0.806904f, 0.806961f, 0.807017f, 0.807074f, 0.807131f, 0.807187f, 0.807244f,
- 0.807300f, 0.807357f, 0.807414f, 0.807470f, 0.807527f, 0.807583f, 0.807640f, 0.807696f,
- 0.807753f, 0.807809f, 0.807866f, 0.807922f, 0.807979f, 0.808035f, 0.808092f, 0.808148f,
- 0.808205f, 0.808261f, 0.808318f, 0.808374f, 0.808430f, 0.808487f, 0.808543f, 0.808600f,
- 0.808656f, 0.808713f, 0.808769f, 0.808825f, 0.808882f, 0.808938f, 0.808994f, 0.809051f,
- 0.809107f, 0.809164f, 0.809220f, 0.809276f, 0.809332f, 0.809389f, 0.809445f, 0.809501f,
- 0.809558f, 0.809614f, 0.809670f, 0.809726f, 0.809783f, 0.809839f, 0.809895f, 0.809951f,
- 0.810008f, 0.810064f, 0.810120f, 0.810176f, 0.810232f, 0.810289f, 0.810345f, 0.810401f,
- 0.810457f, 0.810513f, 0.810570f, 0.810626f, 0.810682f, 0.810738f, 0.810794f, 0.810850f,
- 0.810906f, 0.810962f, 0.811018f, 0.811075f, 0.811131f, 0.811187f, 0.811243f, 0.811299f,
- 0.811355f, 0.811411f, 0.811467f, 0.811523f, 0.811579f, 0.811635f, 0.811691f, 0.811747f,
- 0.811803f, 0.811859f, 0.811915f, 0.811971f, 0.812027f, 0.812083f, 0.812139f, 0.812195f,
- 0.812251f, 0.812307f, 0.812362f, 0.812418f, 0.812474f, 0.812530f, 0.812586f, 0.812642f,
- 0.812698f, 0.812754f, 0.812809f, 0.812865f, 0.812921f, 0.812977f, 0.813033f, 0.813089f,
- 0.813144f, 0.813200f, 0.813256f, 0.813312f, 0.813368f, 0.813423f, 0.813479f, 0.813535f,
- 0.813591f, 0.813646f, 0.813702f, 0.813758f, 0.813814f, 0.813869f, 0.813925f, 0.813981f,
- 0.814036f, 0.814092f, 0.814148f, 0.814203f, 0.814259f, 0.814315f, 0.814370f, 0.814426f,
- 0.814482f, 0.814537f, 0.814593f, 0.814648f, 0.814704f, 0.814760f, 0.814815f, 0.814871f,
- 0.814926f, 0.814982f, 0.815037f, 0.815093f, 0.815149f, 0.815204f, 0.815260f, 0.815315f,
- 0.815371f, 0.815426f, 0.815482f, 0.815537f, 0.815593f, 0.815648f, 0.815704f, 0.815759f,
- 0.815814f, 0.815870f, 0.815925f, 0.815981f, 0.816036f, 0.816092f, 0.816147f, 0.816202f,
- 0.816258f, 0.816313f, 0.816368f, 0.816424f, 0.816479f, 0.816535f, 0.816590f, 0.816645f,
- 0.816701f, 0.816756f, 0.816811f, 0.816867f, 0.816922f, 0.816977f, 0.817032f, 0.817088f,
- 0.817143f, 0.817198f, 0.817253f, 0.817309f, 0.817364f, 0.817419f, 0.817474f, 0.817530f,
- 0.817585f, 0.817640f, 0.817695f, 0.817750f, 0.817806f, 0.817861f, 0.817916f, 0.817971f,
- 0.818026f, 0.818081f, 0.818137f, 0.818192f, 0.818247f, 0.818302f, 0.818357f, 0.818412f,
- 0.818467f, 0.818522f, 0.818577f, 0.818632f, 0.818687f, 0.818742f, 0.818798f, 0.818853f,
- 0.818908f, 0.818963f, 0.819018f, 0.819073f, 0.819128f, 0.819183f, 0.819238f, 0.819293f,
- 0.819348f, 0.819402f, 0.819457f, 0.819512f, 0.819567f, 0.819622f, 0.819677f, 0.819732f,
- 0.819787f, 0.819842f, 0.819897f, 0.819952f, 0.820007f, 0.820061f, 0.820116f, 0.820171f,
- 0.820226f, 0.820281f, 0.820336f, 0.820390f, 0.820445f, 0.820500f, 0.820555f, 0.820610f,
- 0.820664f, 0.820719f, 0.820774f, 0.820829f, 0.820884f, 0.820938f, 0.820993f, 0.821048f,
- 0.821102f, 0.821157f, 0.821212f, 0.821267f, 0.821321f, 0.821376f, 0.821431f, 0.821485f,
- 0.821540f, 0.821595f, 0.821649f, 0.821704f, 0.821759f, 0.821813f, 0.821868f, 0.821922f,
- 0.821977f, 0.822032f, 0.822086f, 0.822141f, 0.822195f, 0.822250f, 0.822305f, 0.822359f,
- 0.822414f, 0.822468f, 0.822523f, 0.822577f, 0.822632f, 0.822686f, 0.822741f, 0.822795f,
- 0.822850f, 0.822904f, 0.822959f, 0.823013f, 0.823068f, 0.823122f, 0.823177f, 0.823231f,
- 0.823285f, 0.823340f, 0.823394f, 0.823449f, 0.823503f, 0.823557f, 0.823612f, 0.823666f,
- 0.823721f, 0.823775f, 0.823829f, 0.823884f, 0.823938f, 0.823992f, 0.824047f, 0.824101f,
- 0.824155f, 0.824209f, 0.824264f, 0.824318f, 0.824372f, 0.824427f, 0.824481f, 0.824535f,
- 0.824589f, 0.824644f, 0.824698f, 0.824752f, 0.824806f, 0.824860f, 0.824915f, 0.824969f,
- 0.825023f, 0.825077f, 0.825131f, 0.825185f, 0.825240f, 0.825294f, 0.825348f, 0.825402f,
- 0.825456f, 0.825510f, 0.825564f, 0.825618f, 0.825673f, 0.825727f, 0.825781f, 0.825835f,
- 0.825889f, 0.825943f, 0.825997f, 0.826051f, 0.826105f, 0.826159f, 0.826213f, 0.826267f,
- 0.826321f, 0.826375f, 0.826429f, 0.826483f, 0.826537f, 0.826591f, 0.826645f, 0.826699f,
- 0.826753f, 0.826807f, 0.826861f, 0.826915f, 0.826968f, 0.827022f, 0.827076f, 0.827130f,
- 0.827184f, 0.827238f, 0.827292f, 0.827346f, 0.827399f, 0.827453f, 0.827507f, 0.827561f,
- 0.827615f, 0.827669f, 0.827722f, 0.827776f, 0.827830f, 0.827884f, 0.827938f, 0.827991f,
- 0.828045f, 0.828099f, 0.828153f, 0.828206f, 0.828260f, 0.828314f, 0.828367f, 0.828421f,
- 0.828475f, 0.828529f, 0.828582f, 0.828636f, 0.828690f, 0.828743f, 0.828797f, 0.828851f,
- 0.828904f, 0.828958f, 0.829011f, 0.829065f, 0.829119f, 0.829172f, 0.829226f, 0.829279f,
- 0.829333f, 0.829386f, 0.829440f, 0.829494f, 0.829547f, 0.829601f, 0.829654f, 0.829708f,
- 0.829761f, 0.829815f, 0.829868f, 0.829922f, 0.829975f, 0.830029f, 0.830082f, 0.830136f,
- 0.830189f, 0.830243f, 0.830296f, 0.830349f, 0.830403f, 0.830456f, 0.830510f, 0.830563f,
- 0.830616f, 0.830670f, 0.830723f, 0.830777f, 0.830830f, 0.830883f, 0.830937f, 0.830990f,
- 0.831043f, 0.831097f, 0.831150f, 0.831203f, 0.831257f, 0.831310f, 0.831363f, 0.831416f,
- 0.831470f, 0.831523f, 0.831576f, 0.831629f, 0.831683f, 0.831736f, 0.831789f, 0.831842f,
- 0.831895f, 0.831949f, 0.832002f, 0.832055f, 0.832108f, 0.832161f, 0.832215f, 0.832268f,
- 0.832321f, 0.832374f, 0.832427f, 0.832480f, 0.832533f, 0.832586f, 0.832640f, 0.832693f,
- 0.832746f, 0.832799f, 0.832852f, 0.832905f, 0.832958f, 0.833011f, 0.833064f, 0.833117f,
- 0.833170f, 0.833223f, 0.833276f, 0.833329f, 0.833382f, 0.833435f, 0.833488f, 0.833541f,
- 0.833594f, 0.833647f, 0.833700f, 0.833753f, 0.833806f, 0.833859f, 0.833912f, 0.833965f,
- 0.834018f, 0.834070f, 0.834123f, 0.834176f, 0.834229f, 0.834282f, 0.834335f, 0.834388f,
- 0.834440f, 0.834493f, 0.834546f, 0.834599f, 0.834652f, 0.834705f, 0.834757f, 0.834810f,
- 0.834863f, 0.834916f, 0.834968f, 0.835021f, 0.835074f, 0.835127f, 0.835179f, 0.835232f,
- 0.835285f, 0.835338f, 0.835390f, 0.835443f, 0.835496f, 0.835548f, 0.835601f, 0.835654f,
- 0.835706f, 0.835759f, 0.835812f, 0.835864f, 0.835917f, 0.835969f, 0.836022f, 0.836075f,
- 0.836127f, 0.836180f, 0.836232f, 0.836285f, 0.836338f, 0.836390f, 0.836443f, 0.836495f,
- 0.836548f, 0.836600f, 0.836653f, 0.836705f, 0.836758f, 0.836810f, 0.836863f, 0.836915f,
- 0.836968f, 0.837020f, 0.837073f, 0.837125f, 0.837178f, 0.837230f, 0.837282f, 0.837335f,
- 0.837387f, 0.837440f, 0.837492f, 0.837544f, 0.837597f, 0.837649f, 0.837701f, 0.837754f,
- 0.837806f, 0.837859f, 0.837911f, 0.837963f, 0.838015f, 0.838068f, 0.838120f, 0.838172f,
- 0.838225f, 0.838277f, 0.838329f, 0.838382f, 0.838434f, 0.838486f, 0.838538f, 0.838591f,
- 0.838643f, 0.838695f, 0.838747f, 0.838799f, 0.838852f, 0.838904f, 0.838956f, 0.839008f,
- 0.839060f, 0.839112f, 0.839165f, 0.839217f, 0.839269f, 0.839321f, 0.839373f, 0.839425f,
- 0.839477f, 0.839529f, 0.839581f, 0.839634f, 0.839686f, 0.839738f, 0.839790f, 0.839842f,
- 0.839894f, 0.839946f, 0.839998f, 0.840050f, 0.840102f, 0.840154f, 0.840206f, 0.840258f,
- 0.840310f, 0.840362f, 0.840414f, 0.840466f, 0.840518f, 0.840570f, 0.840622f, 0.840673f,
- 0.840725f, 0.840777f, 0.840829f, 0.840881f, 0.840933f, 0.840985f, 0.841037f, 0.841089f,
- 0.841140f, 0.841192f, 0.841244f, 0.841296f, 0.841348f, 0.841400f, 0.841451f, 0.841503f,
- 0.841555f, 0.841607f, 0.841659f, 0.841710f, 0.841762f, 0.841814f, 0.841866f, 0.841917f,
- 0.841969f, 0.842021f, 0.842072f, 0.842124f, 0.842176f, 0.842228f, 0.842279f, 0.842331f,
- 0.842383f, 0.842434f, 0.842486f, 0.842538f, 0.842589f, 0.842641f, 0.842692f, 0.842744f,
- 0.842796f, 0.842847f, 0.842899f, 0.842950f, 0.843002f, 0.843054f, 0.843105f, 0.843157f,
- 0.843208f, 0.843260f, 0.843311f, 0.843363f, 0.843414f, 0.843466f, 0.843517f, 0.843569f,
- 0.843620f, 0.843672f, 0.843723f, 0.843775f, 0.843826f, 0.843878f, 0.843929f, 0.843980f,
- 0.844032f, 0.844083f, 0.844135f, 0.844186f, 0.844238f, 0.844289f, 0.844340f, 0.844392f,
- 0.844443f, 0.844494f, 0.844546f, 0.844597f, 0.844648f, 0.844700f, 0.844751f, 0.844802f,
- 0.844854f, 0.844905f, 0.844956f, 0.845007f, 0.845059f, 0.845110f, 0.845161f, 0.845212f,
- 0.845264f, 0.845315f, 0.845366f, 0.845417f, 0.845469f, 0.845520f, 0.845571f, 0.845622f,
- 0.845673f, 0.845724f, 0.845776f, 0.845827f, 0.845878f, 0.845929f, 0.845980f, 0.846031f,
- 0.846082f, 0.846133f, 0.846185f, 0.846236f, 0.846287f, 0.846338f, 0.846389f, 0.846440f,
- 0.846491f, 0.846542f, 0.846593f, 0.846644f, 0.846695f, 0.846746f, 0.846797f, 0.846848f,
- 0.846899f, 0.846950f, 0.847001f, 0.847052f, 0.847103f, 0.847154f, 0.847205f, 0.847256f,
- 0.847307f, 0.847358f, 0.847408f, 0.847459f, 0.847510f, 0.847561f, 0.847612f, 0.847663f,
- 0.847714f, 0.847765f, 0.847815f, 0.847866f, 0.847917f, 0.847968f, 0.848019f, 0.848070f,
- 0.848120f, 0.848171f, 0.848222f, 0.848273f, 0.848323f, 0.848374f, 0.848425f, 0.848476f,
- 0.848526f, 0.848577f, 0.848628f, 0.848679f, 0.848729f, 0.848780f, 0.848831f, 0.848881f,
- 0.848932f, 0.848983f, 0.849033f, 0.849084f, 0.849135f, 0.849185f, 0.849236f, 0.849287f,
- 0.849337f, 0.849388f, 0.849438f, 0.849489f, 0.849540f, 0.849590f, 0.849641f, 0.849691f,
- 0.849742f, 0.849792f, 0.849843f, 0.849893f, 0.849944f, 0.849994f, 0.850045f, 0.850095f,
- 0.850146f, 0.850196f, 0.850247f, 0.850297f, 0.850348f, 0.850398f, 0.850449f, 0.850499f,
- 0.850549f, 0.850600f, 0.850650f, 0.850701f, 0.850751f, 0.850801f, 0.850852f, 0.850902f,
- 0.850953f, 0.851003f, 0.851053f, 0.851104f, 0.851154f, 0.851204f, 0.851255f, 0.851305f,
- 0.851355f, 0.851406f, 0.851456f, 0.851506f, 0.851556f, 0.851607f, 0.851657f, 0.851707f,
- 0.851757f, 0.851808f, 0.851858f, 0.851908f, 0.851958f, 0.852008f, 0.852059f, 0.852109f,
- 0.852159f, 0.852209f, 0.852259f, 0.852309f, 0.852360f, 0.852410f, 0.852460f, 0.852510f,
- 0.852560f, 0.852610f, 0.852660f, 0.852710f, 0.852760f, 0.852810f, 0.852861f, 0.852911f,
- 0.852961f, 0.853011f, 0.853061f, 0.853111f, 0.853161f, 0.853211f, 0.853261f, 0.853311f,
- 0.853361f, 0.853411f, 0.853461f, 0.853511f, 0.853561f, 0.853611f, 0.853660f, 0.853710f,
- 0.853760f, 0.853810f, 0.853860f, 0.853910f, 0.853960f, 0.854010f, 0.854060f, 0.854110f,
- 0.854159f, 0.854209f, 0.854259f, 0.854309f, 0.854359f, 0.854409f, 0.854458f, 0.854508f,
- 0.854558f, 0.854608f, 0.854658f, 0.854707f, 0.854757f, 0.854807f, 0.854857f, 0.854906f,
- 0.854956f, 0.855006f, 0.855056f, 0.855105f, 0.855155f, 0.855205f, 0.855254f, 0.855304f,
- 0.855354f, 0.855403f, 0.855453f, 0.855503f, 0.855552f, 0.855602f, 0.855651f, 0.855701f,
- 0.855751f, 0.855800f, 0.855850f, 0.855900f, 0.855949f, 0.855999f, 0.856048f, 0.856098f,
- 0.856147f, 0.856197f, 0.856246f, 0.856296f, 0.856345f, 0.856395f, 0.856444f, 0.856494f,
- 0.856543f, 0.856593f, 0.856642f, 0.856692f, 0.856741f, 0.856791f, 0.856840f, 0.856890f,
- 0.856939f, 0.856988f, 0.857038f, 0.857087f, 0.857137f, 0.857186f, 0.857235f, 0.857285f,
- 0.857334f, 0.857383f, 0.857433f, 0.857482f, 0.857531f, 0.857581f, 0.857630f, 0.857679f,
- 0.857729f, 0.857778f, 0.857827f, 0.857876f, 0.857926f, 0.857975f, 0.858024f, 0.858073f,
- 0.858123f, 0.858172f, 0.858221f, 0.858270f, 0.858320f, 0.858369f, 0.858418f, 0.858467f,
- 0.858516f, 0.858565f, 0.858615f, 0.858664f, 0.858713f, 0.858762f, 0.858811f, 0.858860f,
- 0.858909f, 0.858958f, 0.859007f, 0.859057f, 0.859106f, 0.859155f, 0.859204f, 0.859253f,
- 0.859302f, 0.859351f, 0.859400f, 0.859449f, 0.859498f, 0.859547f, 0.859596f, 0.859645f,
- 0.859694f, 0.859743f, 0.859792f, 0.859841f, 0.859890f, 0.859939f, 0.859988f, 0.860036f,
- 0.860085f, 0.860134f, 0.860183f, 0.860232f, 0.860281f, 0.860330f, 0.860379f, 0.860428f,
- 0.860476f, 0.860525f, 0.860574f, 0.860623f, 0.860672f, 0.860721f, 0.860769f, 0.860818f,
- 0.860867f, 0.860916f, 0.860964f, 0.861013f, 0.861062f, 0.861111f, 0.861160f, 0.861208f,
- 0.861257f, 0.861306f, 0.861354f, 0.861403f, 0.861452f, 0.861500f, 0.861549f, 0.861598f,
- 0.861646f, 0.861695f, 0.861744f, 0.861792f, 0.861841f, 0.861890f, 0.861938f, 0.861987f,
- 0.862035f, 0.862084f, 0.862133f, 0.862181f, 0.862230f, 0.862278f, 0.862327f, 0.862375f,
- 0.862424f, 0.862472f, 0.862521f, 0.862570f, 0.862618f, 0.862666f, 0.862715f, 0.862763f,
- 0.862812f, 0.862860f, 0.862909f, 0.862957f, 0.863006f, 0.863054f, 0.863103f, 0.863151f,
- 0.863199f, 0.863248f, 0.863296f, 0.863345f, 0.863393f, 0.863441f, 0.863490f, 0.863538f,
- 0.863586f, 0.863635f, 0.863683f, 0.863731f, 0.863780f, 0.863828f, 0.863876f, 0.863925f,
- 0.863973f, 0.864021f, 0.864069f, 0.864118f, 0.864166f, 0.864214f, 0.864262f, 0.864311f,
- 0.864359f, 0.864407f, 0.864455f, 0.864503f, 0.864552f, 0.864600f, 0.864648f, 0.864696f,
- 0.864744f, 0.864792f, 0.864841f, 0.864889f, 0.864937f, 0.864985f, 0.865033f, 0.865081f,
- 0.865129f, 0.865177f, 0.865225f, 0.865273f, 0.865321f, 0.865369f, 0.865418f, 0.865466f,
- 0.865514f, 0.865562f, 0.865610f, 0.865658f, 0.865706f, 0.865754f, 0.865802f, 0.865850f,
- 0.865898f, 0.865946f, 0.865993f, 0.866041f, 0.866089f, 0.866137f, 0.866185f, 0.866233f,
- 0.866281f, 0.866329f, 0.866377f, 0.866425f, 0.866472f, 0.866520f, 0.866568f, 0.866616f,
- 0.866664f, 0.866712f, 0.866759f, 0.866807f, 0.866855f, 0.866903f, 0.866951f, 0.866998f,
- 0.867046f, 0.867094f, 0.867142f, 0.867190f, 0.867237f, 0.867285f, 0.867333f, 0.867380f,
- 0.867428f, 0.867476f, 0.867523f, 0.867571f, 0.867619f, 0.867667f, 0.867714f, 0.867762f,
- 0.867809f, 0.867857f, 0.867905f, 0.867952f, 0.868000f, 0.868048f, 0.868095f, 0.868143f,
- 0.868190f, 0.868238f, 0.868285f, 0.868333f, 0.868381f, 0.868428f, 0.868476f, 0.868523f,
- 0.868571f, 0.868618f, 0.868666f, 0.868713f, 0.868761f, 0.868808f, 0.868856f, 0.868903f,
- 0.868951f, 0.868998f, 0.869045f, 0.869093f, 0.869140f, 0.869188f, 0.869235f, 0.869282f,
- 0.869330f, 0.869377f, 0.869425f, 0.869472f, 0.869519f, 0.869567f, 0.869614f, 0.869661f,
- 0.869709f, 0.869756f, 0.869803f, 0.869851f, 0.869898f, 0.869945f, 0.869992f, 0.870040f,
- 0.870087f, 0.870134f, 0.870182f, 0.870229f, 0.870276f, 0.870323f, 0.870370f, 0.870418f,
- 0.870465f, 0.870512f, 0.870559f, 0.870606f, 0.870654f, 0.870701f, 0.870748f, 0.870795f,
- 0.870842f, 0.870889f, 0.870936f, 0.870983f, 0.871031f, 0.871078f, 0.871125f, 0.871172f,
- 0.871219f, 0.871266f, 0.871313f, 0.871360f, 0.871407f, 0.871454f, 0.871501f, 0.871548f,
- 0.871595f, 0.871642f, 0.871689f, 0.871736f, 0.871783f, 0.871830f, 0.871877f, 0.871924f,
- 0.871971f, 0.872018f, 0.872065f, 0.872112f, 0.872159f, 0.872205f, 0.872252f, 0.872299f,
- 0.872346f, 0.872393f, 0.872440f, 0.872487f, 0.872534f, 0.872580f, 0.872627f, 0.872674f,
- 0.872721f, 0.872768f, 0.872814f, 0.872861f, 0.872908f, 0.872955f, 0.873001f, 0.873048f,
- 0.873095f, 0.873142f, 0.873188f, 0.873235f, 0.873282f, 0.873329f, 0.873375f, 0.873422f,
- 0.873469f, 0.873515f, 0.873562f, 0.873609f, 0.873655f, 0.873702f, 0.873749f, 0.873795f,
- 0.873842f, 0.873888f, 0.873935f, 0.873982f, 0.874028f, 0.874075f, 0.874121f, 0.874168f,
- 0.874215f, 0.874261f, 0.874308f, 0.874354f, 0.874401f, 0.874447f, 0.874494f, 0.874540f,
- 0.874587f, 0.874633f, 0.874680f, 0.874726f, 0.874773f, 0.874819f, 0.874865f, 0.874912f,
- 0.874958f, 0.875005f, 0.875051f, 0.875098f, 0.875144f, 0.875190f, 0.875237f, 0.875283f,
- 0.875329f, 0.875376f, 0.875422f, 0.875468f, 0.875515f, 0.875561f, 0.875607f, 0.875654f,
- 0.875700f, 0.875746f, 0.875793f, 0.875839f, 0.875885f, 0.875931f, 0.875978f, 0.876024f,
- 0.876070f, 0.876116f, 0.876163f, 0.876209f, 0.876255f, 0.876301f, 0.876347f, 0.876393f,
- 0.876440f, 0.876486f, 0.876532f, 0.876578f, 0.876624f, 0.876670f, 0.876716f, 0.876763f,
- 0.876809f, 0.876855f, 0.876901f, 0.876947f, 0.876993f, 0.877039f, 0.877085f, 0.877131f,
- 0.877177f, 0.877223f, 0.877269f, 0.877315f, 0.877361f, 0.877407f, 0.877453f, 0.877499f,
- 0.877545f, 0.877591f, 0.877637f, 0.877683f, 0.877729f, 0.877775f, 0.877821f, 0.877867f,
- 0.877913f, 0.877959f, 0.878005f, 0.878051f, 0.878096f, 0.878142f, 0.878188f, 0.878234f,
- 0.878280f, 0.878326f, 0.878371f, 0.878417f, 0.878463f, 0.878509f, 0.878555f, 0.878600f,
- 0.878646f, 0.878692f, 0.878738f, 0.878784f, 0.878829f, 0.878875f, 0.878921f, 0.878967f,
- 0.879012f, 0.879058f, 0.879104f, 0.879149f, 0.879195f, 0.879241f, 0.879286f, 0.879332f,
- 0.879378f, 0.879423f, 0.879469f, 0.879515f, 0.879560f, 0.879606f, 0.879651f, 0.879697f,
- 0.879743f, 0.879788f, 0.879834f, 0.879879f, 0.879925f, 0.879970f, 0.880016f, 0.880061f,
- 0.880107f, 0.880153f, 0.880198f, 0.880244f, 0.880289f, 0.880334f, 0.880380f, 0.880425f,
- 0.880471f, 0.880516f, 0.880562f, 0.880607f, 0.880653f, 0.880698f, 0.880743f, 0.880789f,
- 0.880834f, 0.880880f, 0.880925f, 0.880970f, 0.881016f, 0.881061f, 0.881106f, 0.881152f,
- 0.881197f, 0.881242f, 0.881288f, 0.881333f, 0.881378f, 0.881424f, 0.881469f, 0.881514f,
- 0.881559f, 0.881605f, 0.881650f, 0.881695f, 0.881740f, 0.881786f, 0.881831f, 0.881876f,
- 0.881921f, 0.881966f, 0.882012f, 0.882057f, 0.882102f, 0.882147f, 0.882192f, 0.882237f,
- 0.882283f, 0.882328f, 0.882373f, 0.882418f, 0.882463f, 0.882508f, 0.882553f, 0.882598f,
- 0.882643f, 0.882688f, 0.882733f, 0.882779f, 0.882824f, 0.882869f, 0.882914f, 0.882959f,
- 0.883004f, 0.883049f, 0.883094f, 0.883139f, 0.883184f, 0.883228f, 0.883273f, 0.883318f,
- 0.883363f, 0.883408f, 0.883453f, 0.883498f, 0.883543f, 0.883588f, 0.883633f, 0.883678f,
- 0.883723f, 0.883767f, 0.883812f, 0.883857f, 0.883902f, 0.883947f, 0.883992f, 0.884036f,
- 0.884081f, 0.884126f, 0.884171f, 0.884216f, 0.884260f, 0.884305f, 0.884350f, 0.884395f,
- 0.884439f, 0.884484f, 0.884529f, 0.884574f, 0.884618f, 0.884663f, 0.884708f, 0.884752f,
- 0.884797f, 0.884842f, 0.884886f, 0.884931f, 0.884976f, 0.885020f, 0.885065f, 0.885110f,
- 0.885154f, 0.885199f, 0.885243f, 0.885288f, 0.885333f, 0.885377f, 0.885422f, 0.885466f,
- 0.885511f, 0.885555f, 0.885600f, 0.885644f, 0.885689f, 0.885733f, 0.885778f, 0.885822f,
- 0.885867f, 0.885911f, 0.885956f, 0.886000f, 0.886045f, 0.886089f, 0.886134f, 0.886178f,
- 0.886223f, 0.886267f, 0.886311f, 0.886356f, 0.886400f, 0.886445f, 0.886489f, 0.886533f,
- 0.886578f, 0.886622f, 0.886666f, 0.886711f, 0.886755f, 0.886799f, 0.886844f, 0.886888f,
- 0.886932f, 0.886976f, 0.887021f, 0.887065f, 0.887109f, 0.887153f, 0.887198f, 0.887242f,
- 0.887286f, 0.887330f, 0.887375f, 0.887419f, 0.887463f, 0.887507f, 0.887551f, 0.887595f,
- 0.887640f, 0.887684f, 0.887728f, 0.887772f, 0.887816f, 0.887860f, 0.887904f, 0.887949f,
- 0.887993f, 0.888037f, 0.888081f, 0.888125f, 0.888169f, 0.888213f, 0.888257f, 0.888301f,
- 0.888345f, 0.888389f, 0.888433f, 0.888477f, 0.888521f, 0.888565f, 0.888609f, 0.888653f,
- 0.888697f, 0.888741f, 0.888785f, 0.888829f, 0.888873f, 0.888917f, 0.888961f, 0.889004f,
- 0.889048f, 0.889092f, 0.889136f, 0.889180f, 0.889224f, 0.889268f, 0.889312f, 0.889355f,
- 0.889399f, 0.889443f, 0.889487f, 0.889531f, 0.889574f, 0.889618f, 0.889662f, 0.889706f,
- 0.889750f, 0.889793f, 0.889837f, 0.889881f, 0.889925f, 0.889968f, 0.890012f, 0.890056f,
- 0.890099f, 0.890143f, 0.890187f, 0.890230f, 0.890274f, 0.890318f, 0.890361f, 0.890405f,
- 0.890449f, 0.890492f, 0.890536f, 0.890580f, 0.890623f, 0.890667f, 0.890710f, 0.890754f,
- 0.890797f, 0.890841f, 0.890885f, 0.890928f, 0.890972f, 0.891015f, 0.891059f, 0.891102f,
- 0.891146f, 0.891189f, 0.891233f, 0.891276f, 0.891320f, 0.891363f, 0.891407f, 0.891450f,
- 0.891493f, 0.891537f, 0.891580f, 0.891624f, 0.891667f, 0.891711f, 0.891754f, 0.891797f,
- 0.891841f, 0.891884f, 0.891927f, 0.891971f, 0.892014f, 0.892057f, 0.892101f, 0.892144f,
- 0.892187f, 0.892231f, 0.892274f, 0.892317f, 0.892361f, 0.892404f, 0.892447f, 0.892490f,
- 0.892534f, 0.892577f, 0.892620f, 0.892663f, 0.892706f, 0.892750f, 0.892793f, 0.892836f,
- 0.892879f, 0.892922f, 0.892965f, 0.893009f, 0.893052f, 0.893095f, 0.893138f, 0.893181f,
- 0.893224f, 0.893267f, 0.893310f, 0.893354f, 0.893397f, 0.893440f, 0.893483f, 0.893526f,
- 0.893569f, 0.893612f, 0.893655f, 0.893698f, 0.893741f, 0.893784f, 0.893827f, 0.893870f,
- 0.893913f, 0.893956f, 0.893999f, 0.894042f, 0.894085f, 0.894128f, 0.894171f, 0.894214f,
- 0.894256f, 0.894299f, 0.894342f, 0.894385f, 0.894428f, 0.894471f, 0.894514f, 0.894557f,
- 0.894599f, 0.894642f, 0.894685f, 0.894728f, 0.894771f, 0.894814f, 0.894856f, 0.894899f,
- 0.894942f, 0.894985f, 0.895028f, 0.895070f, 0.895113f, 0.895156f, 0.895198f, 0.895241f,
- 0.895284f, 0.895327f, 0.895369f, 0.895412f, 0.895455f, 0.895497f, 0.895540f, 0.895583f,
- 0.895625f, 0.895668f, 0.895711f, 0.895753f, 0.895796f, 0.895838f, 0.895881f, 0.895924f,
- 0.895966f, 0.896009f, 0.896051f, 0.896094f, 0.896137f, 0.896179f, 0.896222f, 0.896264f,
- 0.896307f, 0.896349f, 0.896392f, 0.896434f, 0.896477f, 0.896519f, 0.896562f, 0.896604f,
- 0.896646f, 0.896689f, 0.896731f, 0.896774f, 0.896816f, 0.896859f, 0.896901f, 0.896943f,
- 0.896986f, 0.897028f, 0.897071f, 0.897113f, 0.897155f, 0.897198f, 0.897240f, 0.897282f,
- 0.897325f, 0.897367f, 0.897409f, 0.897452f, 0.897494f, 0.897536f, 0.897578f, 0.897621f,
- 0.897663f, 0.897705f, 0.897747f, 0.897790f, 0.897832f, 0.897874f, 0.897916f, 0.897958f,
- 0.898001f, 0.898043f, 0.898085f, 0.898127f, 0.898169f, 0.898211f, 0.898254f, 0.898296f,
- 0.898338f, 0.898380f, 0.898422f, 0.898464f, 0.898506f, 0.898548f, 0.898590f, 0.898632f,
- 0.898674f, 0.898717f, 0.898759f, 0.898801f, 0.898843f, 0.898885f, 0.898927f, 0.898969f,
- 0.899011f, 0.899053f, 0.899095f, 0.899137f, 0.899179f, 0.899220f, 0.899262f, 0.899304f,
- 0.899346f, 0.899388f, 0.899430f, 0.899472f, 0.899514f, 0.899556f, 0.899598f, 0.899639f,
- 0.899681f, 0.899723f, 0.899765f, 0.899807f, 0.899849f, 0.899890f, 0.899932f, 0.899974f,
- 0.900016f, 0.900058f, 0.900099f, 0.900141f, 0.900183f, 0.900225f, 0.900266f, 0.900308f,
- 0.900350f, 0.900392f, 0.900433f, 0.900475f, 0.900517f, 0.900558f, 0.900600f, 0.900642f,
- 0.900683f, 0.900725f, 0.900767f, 0.900808f, 0.900850f, 0.900892f, 0.900933f, 0.900975f,
- 0.901016f, 0.901058f, 0.901100f, 0.901141f, 0.901183f, 0.901224f, 0.901266f, 0.901307f,
- 0.901349f, 0.901390f, 0.901432f, 0.901473f, 0.901515f, 0.901556f, 0.901598f, 0.901639f,
- 0.901681f, 0.901722f, 0.901764f, 0.901805f, 0.901847f, 0.901888f, 0.901929f, 0.901971f,
- 0.902012f, 0.902054f, 0.902095f, 0.902136f, 0.902178f, 0.902219f, 0.902260f, 0.902302f,
- 0.902343f, 0.902384f, 0.902426f, 0.902467f, 0.902508f, 0.902550f, 0.902591f, 0.902632f,
- 0.902673f, 0.902715f, 0.902756f, 0.902797f, 0.902838f, 0.902879f, 0.902921f, 0.902962f,
- 0.903003f, 0.903044f, 0.903085f, 0.903127f, 0.903168f, 0.903209f, 0.903250f, 0.903291f,
- 0.903332f, 0.903373f, 0.903415f, 0.903456f, 0.903497f, 0.903538f, 0.903579f, 0.903620f,
- 0.903661f, 0.903702f, 0.903743f, 0.903784f, 0.903825f, 0.903866f, 0.903907f, 0.903948f,
- 0.903989f, 0.904030f, 0.904071f, 0.904112f, 0.904153f, 0.904194f, 0.904235f, 0.904276f,
- 0.904317f, 0.904358f, 0.904399f, 0.904440f, 0.904481f, 0.904521f, 0.904562f, 0.904603f,
- 0.904644f, 0.904685f, 0.904726f, 0.904767f, 0.904807f, 0.904848f, 0.904889f, 0.904930f,
- 0.904971f, 0.905011f, 0.905052f, 0.905093f, 0.905134f, 0.905175f, 0.905215f, 0.905256f,
- 0.905297f, 0.905337f, 0.905378f, 0.905419f, 0.905460f, 0.905500f, 0.905541f, 0.905582f,
- 0.905622f, 0.905663f, 0.905704f, 0.905744f, 0.905785f, 0.905825f, 0.905866f, 0.905907f,
- 0.905947f, 0.905988f, 0.906028f, 0.906069f, 0.906110f, 0.906150f, 0.906191f, 0.906231f,
- 0.906272f, 0.906312f, 0.906353f, 0.906393f, 0.906434f, 0.906474f, 0.906515f, 0.906555f,
- 0.906596f, 0.906636f, 0.906677f, 0.906717f, 0.906757f, 0.906798f, 0.906838f, 0.906879f,
- 0.906919f, 0.906959f, 0.907000f, 0.907040f, 0.907081f, 0.907121f, 0.907161f, 0.907202f,
- 0.907242f, 0.907282f, 0.907323f, 0.907363f, 0.907403f, 0.907444f, 0.907484f, 0.907524f,
- 0.907564f, 0.907605f, 0.907645f, 0.907685f, 0.907725f, 0.907766f, 0.907806f, 0.907846f,
- 0.907886f, 0.907926f, 0.907966f, 0.908007f, 0.908047f, 0.908087f, 0.908127f, 0.908167f,
- 0.908207f, 0.908248f, 0.908288f, 0.908328f, 0.908368f, 0.908408f, 0.908448f, 0.908488f,
- 0.908528f, 0.908568f, 0.908608f, 0.908648f, 0.908688f, 0.908728f, 0.908768f, 0.908808f,
- 0.908848f, 0.908888f, 0.908928f, 0.908968f, 0.909008f, 0.909048f, 0.909088f, 0.909128f,
- 0.909168f, 0.909208f, 0.909248f, 0.909288f, 0.909328f, 0.909368f, 0.909407f, 0.909447f,
- 0.909487f, 0.909527f, 0.909567f, 0.909607f, 0.909646f, 0.909686f, 0.909726f, 0.909766f,
- 0.909806f, 0.909845f, 0.909885f, 0.909925f, 0.909965f, 0.910005f, 0.910044f, 0.910084f,
- 0.910124f, 0.910163f, 0.910203f, 0.910243f, 0.910283f, 0.910322f, 0.910362f, 0.910402f,
- 0.910441f, 0.910481f, 0.910521f, 0.910560f, 0.910600f, 0.910639f, 0.910679f, 0.910719f,
- 0.910758f, 0.910798f, 0.910837f, 0.910877f, 0.910917f, 0.910956f, 0.910996f, 0.911035f,
- 0.911075f, 0.911114f, 0.911154f, 0.911193f, 0.911233f, 0.911272f, 0.911312f, 0.911351f,
- 0.911391f, 0.911430f, 0.911470f, 0.911509f, 0.911548f, 0.911588f, 0.911627f, 0.911667f,
- 0.911706f, 0.911745f, 0.911785f, 0.911824f, 0.911864f, 0.911903f, 0.911942f, 0.911982f,
- 0.912021f, 0.912060f, 0.912099f, 0.912139f, 0.912178f, 0.912217f, 0.912257f, 0.912296f,
- 0.912335f, 0.912374f, 0.912414f, 0.912453f, 0.912492f, 0.912531f, 0.912571f, 0.912610f,
- 0.912649f, 0.912688f, 0.912727f, 0.912766f, 0.912806f, 0.912845f, 0.912884f, 0.912923f,
- 0.912962f, 0.913001f, 0.913040f, 0.913080f, 0.913119f, 0.913158f, 0.913197f, 0.913236f,
- 0.913275f, 0.913314f, 0.913353f, 0.913392f, 0.913431f, 0.913470f, 0.913509f, 0.913548f,
- 0.913587f, 0.913626f, 0.913665f, 0.913704f, 0.913743f, 0.913782f, 0.913821f, 0.913860f,
- 0.913899f, 0.913938f, 0.913976f, 0.914015f, 0.914054f, 0.914093f, 0.914132f, 0.914171f,
- 0.914210f, 0.914249f, 0.914287f, 0.914326f, 0.914365f, 0.914404f, 0.914443f, 0.914482f,
- 0.914520f, 0.914559f, 0.914598f, 0.914637f, 0.914675f, 0.914714f, 0.914753f, 0.914792f,
- 0.914830f, 0.914869f, 0.914908f, 0.914946f, 0.914985f, 0.915024f, 0.915062f, 0.915101f,
- 0.915140f, 0.915178f, 0.915217f, 0.915256f, 0.915294f, 0.915333f, 0.915372f, 0.915410f,
- 0.915449f, 0.915487f, 0.915526f, 0.915564f, 0.915603f, 0.915642f, 0.915680f, 0.915719f,
- 0.915757f, 0.915796f, 0.915834f, 0.915873f, 0.915911f, 0.915950f, 0.915988f, 0.916027f,
- 0.916065f, 0.916103f, 0.916142f, 0.916180f, 0.916219f, 0.916257f, 0.916296f, 0.916334f,
- 0.916372f, 0.916411f, 0.916449f, 0.916487f, 0.916526f, 0.916564f, 0.916602f, 0.916641f,
- 0.916679f, 0.916717f, 0.916756f, 0.916794f, 0.916832f, 0.916871f, 0.916909f, 0.916947f,
- 0.916985f, 0.917024f, 0.917062f, 0.917100f, 0.917138f, 0.917176f, 0.917215f, 0.917253f,
- 0.917291f, 0.917329f, 0.917367f, 0.917405f, 0.917444f, 0.917482f, 0.917520f, 0.917558f,
- 0.917596f, 0.917634f, 0.917672f, 0.917710f, 0.917749f, 0.917787f, 0.917825f, 0.917863f,
- 0.917901f, 0.917939f, 0.917977f, 0.918015f, 0.918053f, 0.918091f, 0.918129f, 0.918167f,
- 0.918205f, 0.918243f, 0.918281f, 0.918319f, 0.918357f, 0.918395f, 0.918433f, 0.918471f,
- 0.918508f, 0.918546f, 0.918584f, 0.918622f, 0.918660f, 0.918698f, 0.918736f, 0.918774f,
- 0.918811f, 0.918849f, 0.918887f, 0.918925f, 0.918963f, 0.919001f, 0.919038f, 0.919076f,
- 0.919114f, 0.919152f, 0.919189f, 0.919227f, 0.919265f, 0.919303f, 0.919340f, 0.919378f,
- 0.919416f, 0.919453f, 0.919491f, 0.919529f, 0.919567f, 0.919604f, 0.919642f, 0.919680f,
- 0.919717f, 0.919755f, 0.919792f, 0.919830f, 0.919868f, 0.919905f, 0.919943f, 0.919980f,
- 0.920018f, 0.920056f, 0.920093f, 0.920131f, 0.920168f, 0.920206f, 0.920243f, 0.920281f,
- 0.920318f, 0.920356f, 0.920393f, 0.920431f, 0.920468f, 0.920506f, 0.920543f, 0.920581f,
- 0.920618f, 0.920655f, 0.920693f, 0.920730f, 0.920768f, 0.920805f, 0.920842f, 0.920880f,
- 0.920917f, 0.920955f, 0.920992f, 0.921029f, 0.921067f, 0.921104f, 0.921141f, 0.921179f,
- 0.921216f, 0.921253f, 0.921291f, 0.921328f, 0.921365f, 0.921402f, 0.921440f, 0.921477f,
- 0.921514f, 0.921551f, 0.921588f, 0.921626f, 0.921663f, 0.921700f, 0.921737f, 0.921774f,
- 0.921812f, 0.921849f, 0.921886f, 0.921923f, 0.921960f, 0.921997f, 0.922034f, 0.922072f,
- 0.922109f, 0.922146f, 0.922183f, 0.922220f, 0.922257f, 0.922294f, 0.922331f, 0.922368f,
- 0.922405f, 0.922442f, 0.922479f, 0.922516f, 0.922553f, 0.922590f, 0.922627f, 0.922664f,
- 0.922701f, 0.922738f, 0.922775f, 0.922812f, 0.922849f, 0.922886f, 0.922923f, 0.922960f,
- 0.922997f, 0.923033f, 0.923070f, 0.923107f, 0.923144f, 0.923181f, 0.923218f, 0.923255f,
- 0.923291f, 0.923328f, 0.923365f, 0.923402f, 0.923439f, 0.923475f, 0.923512f, 0.923549f,
- 0.923586f, 0.923622f, 0.923659f, 0.923696f, 0.923733f, 0.923769f, 0.923806f, 0.923843f,
- 0.923880f, 0.923916f, 0.923953f, 0.923990f, 0.924026f, 0.924063f, 0.924100f, 0.924136f,
- 0.924173f, 0.924209f, 0.924246f, 0.924283f, 0.924319f, 0.924356f, 0.924392f, 0.924429f,
- 0.924465f, 0.924502f, 0.924539f, 0.924575f, 0.924612f, 0.924648f, 0.924685f, 0.924721f,
- 0.924758f, 0.924794f, 0.924831f, 0.924867f, 0.924904f, 0.924940f, 0.924976f, 0.925013f,
- 0.925049f, 0.925086f, 0.925122f, 0.925158f, 0.925195f, 0.925231f, 0.925268f, 0.925304f,
- 0.925340f, 0.925377f, 0.925413f, 0.925449f, 0.925486f, 0.925522f, 0.925558f, 0.925595f,
- 0.925631f, 0.925667f, 0.925703f, 0.925740f, 0.925776f, 0.925812f, 0.925848f, 0.925885f,
- 0.925921f, 0.925957f, 0.925993f, 0.926029f, 0.926066f, 0.926102f, 0.926138f, 0.926174f,
- 0.926210f, 0.926246f, 0.926283f, 0.926319f, 0.926355f, 0.926391f, 0.926427f, 0.926463f,
- 0.926499f, 0.926535f, 0.926571f, 0.926607f, 0.926643f, 0.926679f, 0.926715f, 0.926751f,
- 0.926787f, 0.926823f, 0.926859f, 0.926895f, 0.926931f, 0.926967f, 0.927003f, 0.927039f,
- 0.927075f, 0.927111f, 0.927147f, 0.927183f, 0.927219f, 0.927255f, 0.927291f, 0.927327f,
- 0.927363f, 0.927398f, 0.927434f, 0.927470f, 0.927506f, 0.927542f, 0.927578f, 0.927613f,
- 0.927649f, 0.927685f, 0.927721f, 0.927757f, 0.927792f, 0.927828f, 0.927864f, 0.927900f,
- 0.927935f, 0.927971f, 0.928007f, 0.928043f, 0.928078f, 0.928114f, 0.928150f, 0.928185f,
- 0.928221f, 0.928257f, 0.928292f, 0.928328f, 0.928364f, 0.928399f, 0.928435f, 0.928470f,
- 0.928506f, 0.928542f, 0.928577f, 0.928613f, 0.928648f, 0.928684f, 0.928720f, 0.928755f,
- 0.928791f, 0.928826f, 0.928862f, 0.928897f, 0.928933f, 0.928968f, 0.929004f, 0.929039f,
- 0.929075f, 0.929110f, 0.929146f, 0.929181f, 0.929216f, 0.929252f, 0.929287f, 0.929323f,
- 0.929358f, 0.929393f, 0.929429f, 0.929464f, 0.929500f, 0.929535f, 0.929570f, 0.929606f,
- 0.929641f, 0.929676f, 0.929712f, 0.929747f, 0.929782f, 0.929817f, 0.929853f, 0.929888f,
- 0.929923f, 0.929958f, 0.929994f, 0.930029f, 0.930064f, 0.930099f, 0.930135f, 0.930170f,
- 0.930205f, 0.930240f, 0.930275f, 0.930311f, 0.930346f, 0.930381f, 0.930416f, 0.930451f,
- 0.930486f, 0.930521f, 0.930556f, 0.930592f, 0.930627f, 0.930662f, 0.930697f, 0.930732f,
- 0.930767f, 0.930802f, 0.930837f, 0.930872f, 0.930907f, 0.930942f, 0.930977f, 0.931012f,
- 0.931047f, 0.931082f, 0.931117f, 0.931152f, 0.931187f, 0.931222f, 0.931257f, 0.931292f,
- 0.931327f, 0.931362f, 0.931397f, 0.931431f, 0.931466f, 0.931501f, 0.931536f, 0.931571f,
- 0.931606f, 0.931641f, 0.931675f, 0.931710f, 0.931745f, 0.931780f, 0.931815f, 0.931849f,
- 0.931884f, 0.931919f, 0.931954f, 0.931989f, 0.932023f, 0.932058f, 0.932093f, 0.932128f,
- 0.932162f, 0.932197f, 0.932232f, 0.932266f, 0.932301f, 0.932336f, 0.932370f, 0.932405f,
- 0.932440f, 0.932474f, 0.932509f, 0.932544f, 0.932578f, 0.932613f, 0.932647f, 0.932682f,
- 0.932716f, 0.932751f, 0.932786f, 0.932820f, 0.932855f, 0.932889f, 0.932924f, 0.932958f,
- 0.932993f, 0.933027f, 0.933062f, 0.933096f, 0.933131f, 0.933165f, 0.933200f, 0.933234f,
- 0.933269f, 0.933303f, 0.933337f, 0.933372f, 0.933406f, 0.933441f, 0.933475f, 0.933509f,
- 0.933544f, 0.933578f, 0.933612f, 0.933647f, 0.933681f, 0.933716f, 0.933750f, 0.933784f,
- 0.933818f, 0.933853f, 0.933887f, 0.933921f, 0.933956f, 0.933990f, 0.934024f, 0.934058f,
- 0.934093f, 0.934127f, 0.934161f, 0.934195f, 0.934229f, 0.934264f, 0.934298f, 0.934332f,
- 0.934366f, 0.934400f, 0.934434f, 0.934469f, 0.934503f, 0.934537f, 0.934571f, 0.934605f,
- 0.934639f, 0.934673f, 0.934707f, 0.934741f, 0.934775f, 0.934810f, 0.934844f, 0.934878f,
- 0.934912f, 0.934946f, 0.934980f, 0.935014f, 0.935048f, 0.935082f, 0.935116f, 0.935150f,
- 0.935184f, 0.935217f, 0.935251f, 0.935285f, 0.935319f, 0.935353f, 0.935387f, 0.935421f,
- 0.935455f, 0.935489f, 0.935523f, 0.935556f, 0.935590f, 0.935624f, 0.935658f, 0.935692f,
- 0.935726f, 0.935759f, 0.935793f, 0.935827f, 0.935861f, 0.935895f, 0.935928f, 0.935962f,
- 0.935996f, 0.936030f, 0.936063f, 0.936097f, 0.936131f, 0.936165f, 0.936198f, 0.936232f,
- 0.936266f, 0.936299f, 0.936333f, 0.936367f, 0.936400f, 0.936434f, 0.936468f, 0.936501f,
- 0.936535f, 0.936568f, 0.936602f, 0.936636f, 0.936669f, 0.936703f, 0.936736f, 0.936770f,
- 0.936803f, 0.936837f, 0.936871f, 0.936904f, 0.936938f, 0.936971f, 0.937005f, 0.937038f,
- 0.937072f, 0.937105f, 0.937138f, 0.937172f, 0.937205f, 0.937239f, 0.937272f, 0.937306f,
- 0.937339f, 0.937372f, 0.937406f, 0.937439f, 0.937473f, 0.937506f, 0.937539f, 0.937573f,
- 0.937606f, 0.937639f, 0.937673f, 0.937706f, 0.937739f, 0.937773f, 0.937806f, 0.937839f,
- 0.937872f, 0.937906f, 0.937939f, 0.937972f, 0.938005f, 0.938039f, 0.938072f, 0.938105f,
- 0.938138f, 0.938171f, 0.938205f, 0.938238f, 0.938271f, 0.938304f, 0.938337f, 0.938370f,
- 0.938404f, 0.938437f, 0.938470f, 0.938503f, 0.938536f, 0.938569f, 0.938602f, 0.938635f,
- 0.938668f, 0.938701f, 0.938734f, 0.938767f, 0.938800f, 0.938833f, 0.938866f, 0.938900f,
- 0.938932f, 0.938965f, 0.938998f, 0.939031f, 0.939064f, 0.939097f, 0.939130f, 0.939163f,
- 0.939196f, 0.939229f, 0.939262f, 0.939295f, 0.939328f, 0.939361f, 0.939394f, 0.939426f,
- 0.939459f, 0.939492f, 0.939525f, 0.939558f, 0.939591f, 0.939623f, 0.939656f, 0.939689f,
- 0.939722f, 0.939755f, 0.939787f, 0.939820f, 0.939853f, 0.939886f, 0.939918f, 0.939951f,
- 0.939984f, 0.940016f, 0.940049f, 0.940082f, 0.940115f, 0.940147f, 0.940180f, 0.940213f,
- 0.940245f, 0.940278f, 0.940310f, 0.940343f, 0.940376f, 0.940408f, 0.940441f, 0.940473f,
- 0.940506f, 0.940539f, 0.940571f, 0.940604f, 0.940636f, 0.940669f, 0.940701f, 0.940734f,
- 0.940766f, 0.940799f, 0.940831f, 0.940864f, 0.940896f, 0.940929f, 0.940961f, 0.940994f,
- 0.941026f, 0.941059f, 0.941091f, 0.941123f, 0.941156f, 0.941188f, 0.941221f, 0.941253f,
- 0.941285f, 0.941318f, 0.941350f, 0.941382f, 0.941415f, 0.941447f, 0.941479f, 0.941512f,
- 0.941544f, 0.941576f, 0.941609f, 0.941641f, 0.941673f, 0.941705f, 0.941738f, 0.941770f,
- 0.941802f, 0.941834f, 0.941867f, 0.941899f, 0.941931f, 0.941963f, 0.941995f, 0.942028f,
- 0.942060f, 0.942092f, 0.942124f, 0.942156f, 0.942188f, 0.942220f, 0.942253f, 0.942285f,
- 0.942317f, 0.942349f, 0.942381f, 0.942413f, 0.942445f, 0.942477f, 0.942509f, 0.942541f,
- 0.942573f, 0.942605f, 0.942637f, 0.942669f, 0.942701f, 0.942733f, 0.942765f, 0.942797f,
- 0.942829f, 0.942861f, 0.942893f, 0.942925f, 0.942957f, 0.942989f, 0.943021f, 0.943053f,
- 0.943084f, 0.943116f, 0.943148f, 0.943180f, 0.943212f, 0.943244f, 0.943276f, 0.943307f,
- 0.943339f, 0.943371f, 0.943403f, 0.943435f, 0.943466f, 0.943498f, 0.943530f, 0.943562f,
- 0.943593f, 0.943625f, 0.943657f, 0.943689f, 0.943720f, 0.943752f, 0.943784f, 0.943815f,
- 0.943847f, 0.943879f, 0.943910f, 0.943942f, 0.943974f, 0.944005f, 0.944037f, 0.944069f,
- 0.944100f, 0.944132f, 0.944163f, 0.944195f, 0.944227f, 0.944258f, 0.944290f, 0.944321f,
- 0.944353f, 0.944384f, 0.944416f, 0.944447f, 0.944479f, 0.944510f, 0.944542f, 0.944573f,
- 0.944605f, 0.944636f, 0.944668f, 0.944699f, 0.944731f, 0.944762f, 0.944793f, 0.944825f,
- 0.944856f, 0.944888f, 0.944919f, 0.944950f, 0.944982f, 0.945013f, 0.945045f, 0.945076f,
- 0.945107f, 0.945139f, 0.945170f, 0.945201f, 0.945232f, 0.945264f, 0.945295f, 0.945326f,
- 0.945358f, 0.945389f, 0.945420f, 0.945451f, 0.945482f, 0.945514f, 0.945545f, 0.945576f,
- 0.945607f, 0.945639f, 0.945670f, 0.945701f, 0.945732f, 0.945763f, 0.945794f, 0.945825f,
- 0.945857f, 0.945888f, 0.945919f, 0.945950f, 0.945981f, 0.946012f, 0.946043f, 0.946074f,
- 0.946105f, 0.946136f, 0.946167f, 0.946198f, 0.946229f, 0.946260f, 0.946291f, 0.946322f,
- 0.946353f, 0.946384f, 0.946415f, 0.946446f, 0.946477f, 0.946508f, 0.946539f, 0.946570f,
- 0.946601f, 0.946632f, 0.946663f, 0.946694f, 0.946724f, 0.946755f, 0.946786f, 0.946817f,
- 0.946848f, 0.946879f, 0.946910f, 0.946940f, 0.946971f, 0.947002f, 0.947033f, 0.947064f,
- 0.947094f, 0.947125f, 0.947156f, 0.947187f, 0.947217f, 0.947248f, 0.947279f, 0.947310f,
- 0.947340f, 0.947371f, 0.947402f, 0.947432f, 0.947463f, 0.947494f, 0.947524f, 0.947555f,
- 0.947586f, 0.947616f, 0.947647f, 0.947677f, 0.947708f, 0.947739f, 0.947769f, 0.947800f,
- 0.947830f, 0.947861f, 0.947891f, 0.947922f, 0.947953f, 0.947983f, 0.948014f, 0.948044f,
- 0.948075f, 0.948105f, 0.948136f, 0.948166f, 0.948196f, 0.948227f, 0.948257f, 0.948288f,
- 0.948318f, 0.948349f, 0.948379f, 0.948409f, 0.948440f, 0.948470f, 0.948501f, 0.948531f,
- 0.948561f, 0.948592f, 0.948622f, 0.948652f, 0.948683f, 0.948713f, 0.948743f, 0.948774f,
- 0.948804f, 0.948834f, 0.948864f, 0.948895f, 0.948925f, 0.948955f, 0.948985f, 0.949016f,
- 0.949046f, 0.949076f, 0.949106f, 0.949136f, 0.949167f, 0.949197f, 0.949227f, 0.949257f,
- 0.949287f, 0.949317f, 0.949348f, 0.949378f, 0.949408f, 0.949438f, 0.949468f, 0.949498f,
- 0.949528f, 0.949558f, 0.949588f, 0.949618f, 0.949648f, 0.949678f, 0.949708f, 0.949739f,
- 0.949768f, 0.949798f, 0.949829f, 0.949858f, 0.949888f, 0.949918f, 0.949948f, 0.949978f,
- 0.950008f, 0.950038f, 0.950068f, 0.950098f, 0.950128f, 0.950158f, 0.950188f, 0.950218f,
- 0.950247f, 0.950277f, 0.950307f, 0.950337f, 0.950367f, 0.950397f, 0.950426f, 0.950456f,
- 0.950486f, 0.950516f, 0.950546f, 0.950575f, 0.950605f, 0.950635f, 0.950665f, 0.950694f,
- 0.950724f, 0.950754f, 0.950784f, 0.950813f, 0.950843f, 0.950873f, 0.950902f, 0.950932f,
- 0.950962f, 0.950991f, 0.951021f, 0.951051f, 0.951080f, 0.951110f, 0.951139f, 0.951169f,
- 0.951199f, 0.951228f, 0.951258f, 0.951287f, 0.951317f, 0.951346f, 0.951376f, 0.951406f,
- 0.951435f, 0.951465f, 0.951494f, 0.951524f, 0.951553f, 0.951582f, 0.951612f, 0.951641f,
- 0.951671f, 0.951700f, 0.951730f, 0.951759f, 0.951789f, 0.951818f, 0.951847f, 0.951877f,
- 0.951906f, 0.951936f, 0.951965f, 0.951994f, 0.952024f, 0.952053f, 0.952082f, 0.952112f,
- 0.952141f, 0.952170f, 0.952199f, 0.952229f, 0.952258f, 0.952287f, 0.952317f, 0.952346f,
- 0.952375f, 0.952404f, 0.952433f, 0.952463f, 0.952492f, 0.952521f, 0.952550f, 0.952579f,
- 0.952609f, 0.952638f, 0.952667f, 0.952696f, 0.952725f, 0.952754f, 0.952783f, 0.952813f,
- 0.952842f, 0.952871f, 0.952900f, 0.952929f, 0.952958f, 0.952987f, 0.953016f, 0.953045f,
- 0.953074f, 0.953103f, 0.953132f, 0.953161f, 0.953190f, 0.953219f, 0.953248f, 0.953277f,
- 0.953306f, 0.953335f, 0.953364f, 0.953393f, 0.953422f, 0.953451f, 0.953480f, 0.953508f,
- 0.953537f, 0.953566f, 0.953595f, 0.953624f, 0.953653f, 0.953682f, 0.953711f, 0.953739f,
- 0.953768f, 0.953797f, 0.953826f, 0.953855f, 0.953883f, 0.953912f, 0.953941f, 0.953970f,
- 0.953998f, 0.954027f, 0.954056f, 0.954085f, 0.954113f, 0.954142f, 0.954171f, 0.954199f,
- 0.954228f, 0.954257f, 0.954285f, 0.954314f, 0.954343f, 0.954371f, 0.954400f, 0.954429f,
- 0.954457f, 0.954486f, 0.954514f, 0.954543f, 0.954572f, 0.954600f, 0.954629f, 0.954657f,
- 0.954686f, 0.954714f, 0.954743f, 0.954771f, 0.954800f, 0.954828f, 0.954857f, 0.954885f,
- 0.954914f, 0.954942f, 0.954971f, 0.954999f, 0.955028f, 0.955056f, 0.955084f, 0.955113f,
- 0.955141f, 0.955170f, 0.955198f, 0.955226f, 0.955255f, 0.955283f, 0.955311f, 0.955340f,
- 0.955368f, 0.955396f, 0.955425f, 0.955453f, 0.955481f, 0.955510f, 0.955538f, 0.955566f,
- 0.955594f, 0.955623f, 0.955651f, 0.955679f, 0.955707f, 0.955736f, 0.955764f, 0.955792f,
- 0.955820f, 0.955848f, 0.955876f, 0.955905f, 0.955933f, 0.955961f, 0.955989f, 0.956017f,
- 0.956045f, 0.956073f, 0.956101f, 0.956130f, 0.956158f, 0.956186f, 0.956214f, 0.956242f,
- 0.956270f, 0.956298f, 0.956326f, 0.956354f, 0.956382f, 0.956410f, 0.956438f, 0.956466f,
- 0.956494f, 0.956522f, 0.956550f, 0.956578f, 0.956606f, 0.956634f, 0.956662f, 0.956689f,
- 0.956717f, 0.956745f, 0.956773f, 0.956801f, 0.956829f, 0.956857f, 0.956885f, 0.956913f,
- 0.956940f, 0.956968f, 0.956996f, 0.957024f, 0.957052f, 0.957079f, 0.957107f, 0.957135f,
- 0.957163f, 0.957190f, 0.957218f, 0.957246f, 0.957274f, 0.957301f, 0.957329f, 0.957357f,
- 0.957385f, 0.957412f, 0.957440f, 0.957468f, 0.957495f, 0.957523f, 0.957550f, 0.957578f,
- 0.957606f, 0.957633f, 0.957661f, 0.957689f, 0.957716f, 0.957744f, 0.957771f, 0.957799f,
- 0.957826f, 0.957854f, 0.957882f, 0.957909f, 0.957937f, 0.957964f, 0.957992f, 0.958019f,
- 0.958046f, 0.958074f, 0.958101f, 0.958129f, 0.958156f, 0.958184f, 0.958211f, 0.958239f,
- 0.958266f, 0.958293f, 0.958321f, 0.958348f, 0.958376f, 0.958403f, 0.958430f, 0.958458f,
- 0.958485f, 0.958512f, 0.958540f, 0.958567f, 0.958594f, 0.958622f, 0.958649f, 0.958676f,
- 0.958703f, 0.958731f, 0.958758f, 0.958785f, 0.958812f, 0.958840f, 0.958867f, 0.958894f,
- 0.958921f, 0.958949f, 0.958976f, 0.959003f, 0.959030f, 0.959057f, 0.959084f, 0.959112f,
- 0.959139f, 0.959166f, 0.959193f, 0.959220f, 0.959247f, 0.959274f, 0.959301f, 0.959328f,
- 0.959355f, 0.959382f, 0.959409f, 0.959436f, 0.959463f, 0.959491f, 0.959518f, 0.959545f,
- 0.959572f, 0.959598f, 0.959625f, 0.959652f, 0.959679f, 0.959706f, 0.959733f, 0.959760f,
- 0.959787f, 0.959814f, 0.959841f, 0.959868f, 0.959895f, 0.959922f, 0.959948f, 0.959975f,
- 0.960002f, 0.960029f, 0.960056f, 0.960083f, 0.960109f, 0.960136f, 0.960163f, 0.960190f,
- 0.960217f, 0.960243f, 0.960270f, 0.960297f, 0.960324f, 0.960350f, 0.960377f, 0.960404f,
- 0.960431f, 0.960457f, 0.960484f, 0.960511f, 0.960537f, 0.960564f, 0.960591f, 0.960617f,
- 0.960644f, 0.960670f, 0.960697f, 0.960724f, 0.960750f, 0.960777f, 0.960804f, 0.960830f,
- 0.960857f, 0.960883f, 0.960910f, 0.960936f, 0.960963f, 0.960989f, 0.961016f, 0.961042f,
- 0.961069f, 0.961095f, 0.961122f, 0.961148f, 0.961175f, 0.961201f, 0.961228f, 0.961254f,
- 0.961280f, 0.961307f, 0.961333f, 0.961360f, 0.961386f, 0.961412f, 0.961439f, 0.961465f,
- 0.961492f, 0.961518f, 0.961544f, 0.961571f, 0.961597f, 0.961623f, 0.961649f, 0.961676f,
- 0.961702f, 0.961728f, 0.961755f, 0.961781f, 0.961807f, 0.961833f, 0.961860f, 0.961886f,
- 0.961912f, 0.961938f, 0.961964f, 0.961991f, 0.962017f, 0.962043f, 0.962069f, 0.962095f,
- 0.962121f, 0.962148f, 0.962174f, 0.962200f, 0.962226f, 0.962252f, 0.962278f, 0.962304f,
- 0.962330f, 0.962356f, 0.962382f, 0.962408f, 0.962434f, 0.962460f, 0.962486f, 0.962512f,
- 0.962538f, 0.962564f, 0.962590f, 0.962616f, 0.962642f, 0.962668f, 0.962694f, 0.962720f,
- 0.962746f, 0.962772f, 0.962798f, 0.962824f, 0.962850f, 0.962876f, 0.962902f, 0.962927f,
- 0.962953f, 0.962979f, 0.963005f, 0.963031f, 0.963057f, 0.963082f, 0.963108f, 0.963134f,
- 0.963160f, 0.963186f, 0.963211f, 0.963237f, 0.963263f, 0.963289f, 0.963314f, 0.963340f,
- 0.963366f, 0.963391f, 0.963417f, 0.963443f, 0.963469f, 0.963494f, 0.963520f, 0.963546f,
- 0.963571f, 0.963597f, 0.963623f, 0.963648f, 0.963674f, 0.963699f, 0.963725f, 0.963750f,
- 0.963776f, 0.963802f, 0.963827f, 0.963853f, 0.963878f, 0.963904f, 0.963929f, 0.963955f,
- 0.963980f, 0.964006f, 0.964031f, 0.964057f, 0.964082f, 0.964108f, 0.964133f, 0.964159f,
- 0.964184f, 0.964209f, 0.964235f, 0.964260f, 0.964286f, 0.964311f, 0.964336f, 0.964362f,
- 0.964387f, 0.964413f, 0.964438f, 0.964463f, 0.964489f, 0.964514f, 0.964539f, 0.964565f,
- 0.964590f, 0.964615f, 0.964640f, 0.964666f, 0.964691f, 0.964716f, 0.964741f, 0.964767f,
- 0.964792f, 0.964817f, 0.964842f, 0.964867f, 0.964893f, 0.964918f, 0.964943f, 0.964968f,
- 0.964993f, 0.965018f, 0.965044f, 0.965069f, 0.965094f, 0.965119f, 0.965144f, 0.965169f,
- 0.965194f, 0.965219f, 0.965244f, 0.965269f, 0.965294f, 0.965319f, 0.965344f, 0.965369f,
- 0.965394f, 0.965419f, 0.965444f, 0.965469f, 0.965494f, 0.965519f, 0.965544f, 0.965569f,
- 0.965594f, 0.965619f, 0.965644f, 0.965669f, 0.965694f, 0.965719f, 0.965744f, 0.965769f,
- 0.965793f, 0.965818f, 0.965843f, 0.965868f, 0.965893f, 0.965918f, 0.965942f, 0.965967f,
- 0.965992f, 0.966017f, 0.966042f, 0.966066f, 0.966091f, 0.966116f, 0.966141f, 0.966165f,
- 0.966190f, 0.966215f, 0.966239f, 0.966264f, 0.966289f, 0.966313f, 0.966338f, 0.966363f,
- 0.966387f, 0.966412f, 0.966437f, 0.966461f, 0.966486f, 0.966511f, 0.966535f, 0.966560f,
- 0.966584f, 0.966609f, 0.966633f, 0.966658f, 0.966683f, 0.966707f, 0.966732f, 0.966756f,
- 0.966781f, 0.966805f, 0.966830f, 0.966854f, 0.966879f, 0.966903f, 0.966928f, 0.966952f,
- 0.966976f, 0.967001f, 0.967025f, 0.967050f, 0.967074f, 0.967099f, 0.967123f, 0.967147f,
- 0.967172f, 0.967196f, 0.967220f, 0.967245f, 0.967269f, 0.967293f, 0.967318f, 0.967342f,
- 0.967366f, 0.967391f, 0.967415f, 0.967439f, 0.967463f, 0.967488f, 0.967512f, 0.967536f,
- 0.967560f, 0.967585f, 0.967609f, 0.967633f, 0.967657f, 0.967681f, 0.967706f, 0.967730f,
- 0.967754f, 0.967778f, 0.967802f, 0.967826f, 0.967850f, 0.967874f, 0.967899f, 0.967923f,
- 0.967947f, 0.967971f, 0.967995f, 0.968019f, 0.968043f, 0.968067f, 0.968091f, 0.968115f,
- 0.968139f, 0.968163f, 0.968187f, 0.968211f, 0.968235f, 0.968259f, 0.968283f, 0.968307f,
- 0.968331f, 0.968355f, 0.968379f, 0.968403f, 0.968427f, 0.968450f, 0.968474f, 0.968498f,
- 0.968522f, 0.968546f, 0.968570f, 0.968594f, 0.968617f, 0.968641f, 0.968665f, 0.968689f,
- 0.968713f, 0.968737f, 0.968760f, 0.968784f, 0.968808f, 0.968832f, 0.968855f, 0.968879f,
- 0.968903f, 0.968927f, 0.968950f, 0.968974f, 0.968998f, 0.969021f, 0.969045f, 0.969069f,
- 0.969092f, 0.969116f, 0.969140f, 0.969163f, 0.969187f, 0.969210f, 0.969234f, 0.969258f,
- 0.969281f, 0.969305f, 0.969328f, 0.969352f, 0.969375f, 0.969399f, 0.969423f, 0.969446f,
- 0.969470f, 0.969493f, 0.969517f, 0.969540f, 0.969564f, 0.969587f, 0.969611f, 0.969634f,
- 0.969657f, 0.969681f, 0.969704f, 0.969728f, 0.969751f, 0.969774f, 0.969798f, 0.969821f,
- 0.969845f, 0.969868f, 0.969891f, 0.969915f, 0.969938f, 0.969961f, 0.969985f, 0.970008f,
- 0.970031f, 0.970055f, 0.970078f, 0.970101f, 0.970124f, 0.970148f, 0.970171f, 0.970194f,
- 0.970217f, 0.970241f, 0.970264f, 0.970287f, 0.970310f, 0.970333f, 0.970357f, 0.970380f,
- 0.970403f, 0.970426f, 0.970449f, 0.970472f, 0.970495f, 0.970518f, 0.970542f, 0.970565f,
- 0.970588f, 0.970611f, 0.970634f, 0.970657f, 0.970680f, 0.970703f, 0.970726f, 0.970749f,
- 0.970772f, 0.970795f, 0.970818f, 0.970841f, 0.970864f, 0.970887f, 0.970910f, 0.970933f,
- 0.970956f, 0.970979f, 0.971002f, 0.971025f, 0.971048f, 0.971071f, 0.971093f, 0.971116f,
- 0.971139f, 0.971162f, 0.971185f, 0.971208f, 0.971231f, 0.971253f, 0.971276f, 0.971299f,
- 0.971322f, 0.971345f, 0.971367f, 0.971390f, 0.971413f, 0.971436f, 0.971458f, 0.971481f,
- 0.971504f, 0.971527f, 0.971549f, 0.971572f, 0.971595f, 0.971617f, 0.971640f, 0.971663f,
- 0.971685f, 0.971708f, 0.971731f, 0.971753f, 0.971776f, 0.971799f, 0.971821f, 0.971844f,
- 0.971866f, 0.971889f, 0.971911f, 0.971934f, 0.971957f, 0.971979f, 0.972002f, 0.972024f,
- 0.972047f, 0.972069f, 0.972092f, 0.972114f, 0.972137f, 0.972159f, 0.972182f, 0.972204f,
- 0.972227f, 0.972249f, 0.972271f, 0.972294f, 0.972316f, 0.972339f, 0.972361f, 0.972383f,
- 0.972406f, 0.972428f, 0.972450f, 0.972473f, 0.972495f, 0.972517f, 0.972540f, 0.972562f,
- 0.972584f, 0.972607f, 0.972629f, 0.972651f, 0.972673f, 0.972696f, 0.972718f, 0.972740f,
- 0.972762f, 0.972785f, 0.972807f, 0.972829f, 0.972851f, 0.972873f, 0.972896f, 0.972918f,
- 0.972940f, 0.972962f, 0.972984f, 0.973006f, 0.973028f, 0.973051f, 0.973073f, 0.973095f,
- 0.973117f, 0.973139f, 0.973161f, 0.973183f, 0.973205f, 0.973227f, 0.973249f, 0.973271f,
- 0.973293f, 0.973315f, 0.973337f, 0.973359f, 0.973381f, 0.973403f, 0.973425f, 0.973447f,
- 0.973469f, 0.973491f, 0.973513f, 0.973535f, 0.973557f, 0.973579f, 0.973601f, 0.973622f,
- 0.973644f, 0.973666f, 0.973688f, 0.973710f, 0.973732f, 0.973753f, 0.973775f, 0.973797f,
- 0.973819f, 0.973841f, 0.973862f, 0.973884f, 0.973906f, 0.973928f, 0.973949f, 0.973971f,
- 0.973993f, 0.974015f, 0.974036f, 0.974058f, 0.974080f, 0.974101f, 0.974123f, 0.974145f,
- 0.974166f, 0.974188f, 0.974210f, 0.974231f, 0.974253f, 0.974275f, 0.974296f, 0.974318f,
- 0.974339f, 0.974361f, 0.974383f, 0.974404f, 0.974426f, 0.974447f, 0.974469f, 0.974490f,
- 0.974512f, 0.974533f, 0.974555f, 0.974576f, 0.974598f, 0.974619f, 0.974641f, 0.974662f,
- 0.974684f, 0.974705f, 0.974726f, 0.974748f, 0.974769f, 0.974791f, 0.974812f, 0.974833f,
- 0.974855f, 0.974876f, 0.974897f, 0.974919f, 0.974940f, 0.974961f, 0.974983f, 0.975004f,
- 0.975025f, 0.975047f, 0.975068f, 0.975089f, 0.975110f, 0.975132f, 0.975153f, 0.975174f,
- 0.975195f, 0.975217f, 0.975238f, 0.975259f, 0.975280f, 0.975301f, 0.975323f, 0.975344f,
- 0.975365f, 0.975386f, 0.975407f, 0.975428f, 0.975449f, 0.975471f, 0.975492f, 0.975513f,
- 0.975534f, 0.975555f, 0.975576f, 0.975597f, 0.975618f, 0.975639f, 0.975660f, 0.975681f,
- 0.975702f, 0.975723f, 0.975744f, 0.975765f, 0.975786f, 0.975807f, 0.975828f, 0.975849f,
- 0.975870f, 0.975891f, 0.975912f, 0.975933f, 0.975954f, 0.975974f, 0.975995f, 0.976016f,
- 0.976037f, 0.976058f, 0.976079f, 0.976100f, 0.976120f, 0.976141f, 0.976162f, 0.976183f,
- 0.976204f, 0.976224f, 0.976245f, 0.976266f, 0.976287f, 0.976308f, 0.976328f, 0.976349f,
- 0.976370f, 0.976390f, 0.976411f, 0.976432f, 0.976453f, 0.976473f, 0.976494f, 0.976515f,
- 0.976535f, 0.976556f, 0.976576f, 0.976597f, 0.976618f, 0.976638f, 0.976659f, 0.976680f,
- 0.976700f, 0.976721f, 0.976741f, 0.976762f, 0.976782f, 0.976803f, 0.976823f, 0.976844f,
- 0.976864f, 0.976885f, 0.976905f, 0.976926f, 0.976946f, 0.976967f, 0.976987f, 0.977008f,
- 0.977028f, 0.977049f, 0.977069f, 0.977089f, 0.977110f, 0.977130f, 0.977151f, 0.977171f,
- 0.977191f, 0.977212f, 0.977232f, 0.977252f, 0.977273f, 0.977293f, 0.977313f, 0.977334f,
- 0.977354f, 0.977374f, 0.977394f, 0.977415f, 0.977435f, 0.977455f, 0.977475f, 0.977496f,
- 0.977516f, 0.977536f, 0.977556f, 0.977577f, 0.977597f, 0.977617f, 0.977637f, 0.977657f,
- 0.977677f, 0.977697f, 0.977718f, 0.977738f, 0.977758f, 0.977778f, 0.977798f, 0.977818f,
- 0.977838f, 0.977858f, 0.977878f, 0.977898f, 0.977918f, 0.977938f, 0.977959f, 0.977979f,
- 0.977998f, 0.978019f, 0.978038f, 0.978058f, 0.978078f, 0.978098f, 0.978118f, 0.978138f,
- 0.978158f, 0.978178f, 0.978198f, 0.978218f, 0.978238f, 0.978258f, 0.978278f, 0.978298f,
- 0.978317f, 0.978337f, 0.978357f, 0.978377f, 0.978397f, 0.978417f, 0.978436f, 0.978456f,
- 0.978476f, 0.978496f, 0.978516f, 0.978535f, 0.978555f, 0.978575f, 0.978594f, 0.978614f,
- 0.978634f, 0.978654f, 0.978673f, 0.978693f, 0.978713f, 0.978732f, 0.978752f, 0.978772f,
- 0.978791f, 0.978811f, 0.978831f, 0.978850f, 0.978870f, 0.978889f, 0.978909f, 0.978929f,
- 0.978948f, 0.978968f, 0.978987f, 0.979007f, 0.979026f, 0.979046f, 0.979065f, 0.979085f,
- 0.979104f, 0.979124f, 0.979143f, 0.979163f, 0.979182f, 0.979202f, 0.979221f, 0.979241f,
- 0.979260f, 0.979280f, 0.979299f, 0.979318f, 0.979338f, 0.979357f, 0.979376f, 0.979396f,
- 0.979415f, 0.979435f, 0.979454f, 0.979473f, 0.979493f, 0.979512f, 0.979531f, 0.979550f,
- 0.979570f, 0.979589f, 0.979608f, 0.979628f, 0.979647f, 0.979666f, 0.979685f, 0.979704f,
- 0.979724f, 0.979743f, 0.979762f, 0.979781f, 0.979800f, 0.979820f, 0.979839f, 0.979858f,
- 0.979877f, 0.979896f, 0.979915f, 0.979934f, 0.979954f, 0.979973f, 0.979992f, 0.980011f,
- 0.980030f, 0.980049f, 0.980068f, 0.980087f, 0.980106f, 0.980125f, 0.980144f, 0.980163f,
- 0.980182f, 0.980201f, 0.980220f, 0.980239f, 0.980258f, 0.980277f, 0.980296f, 0.980315f,
- 0.980334f, 0.980353f, 0.980372f, 0.980390f, 0.980409f, 0.980428f, 0.980447f, 0.980466f,
- 0.980485f, 0.980504f, 0.980523f, 0.980541f, 0.980560f, 0.980579f, 0.980598f, 0.980617f,
- 0.980635f, 0.980654f, 0.980673f, 0.980692f, 0.980710f, 0.980729f, 0.980748f, 0.980767f,
- 0.980785f, 0.980804f, 0.980823f, 0.980841f, 0.980860f, 0.980879f, 0.980897f, 0.980916f,
- 0.980935f, 0.980953f, 0.980972f, 0.980990f, 0.981009f, 0.981028f, 0.981046f, 0.981065f,
- 0.981083f, 0.981102f, 0.981120f, 0.981139f, 0.981158f, 0.981176f, 0.981195f, 0.981213f,
- 0.981232f, 0.981250f, 0.981269f, 0.981287f, 0.981305f, 0.981324f, 0.981342f, 0.981361f,
- 0.981379f, 0.981398f, 0.981416f, 0.981434f, 0.981453f, 0.981471f, 0.981490f, 0.981508f,
- 0.981526f, 0.981545f, 0.981563f, 0.981581f, 0.981600f, 0.981618f, 0.981636f, 0.981654f,
- 0.981673f, 0.981691f, 0.981709f, 0.981727f, 0.981746f, 0.981764f, 0.981782f, 0.981800f,
- 0.981819f, 0.981837f, 0.981855f, 0.981873f, 0.981891f, 0.981909f, 0.981928f, 0.981946f,
- 0.981964f, 0.981982f, 0.982000f, 0.982018f, 0.982036f, 0.982054f, 0.982072f, 0.982091f,
- 0.982109f, 0.982127f, 0.982145f, 0.982163f, 0.982181f, 0.982199f, 0.982217f, 0.982235f,
- 0.982253f, 0.982271f, 0.982289f, 0.982307f, 0.982325f, 0.982343f, 0.982360f, 0.982378f,
- 0.982396f, 0.982414f, 0.982432f, 0.982450f, 0.982468f, 0.982486f, 0.982504f, 0.982521f,
- 0.982539f, 0.982557f, 0.982575f, 0.982593f, 0.982611f, 0.982628f, 0.982646f, 0.982664f,
- 0.982682f, 0.982699f, 0.982717f, 0.982735f, 0.982753f, 0.982770f, 0.982788f, 0.982806f,
- 0.982824f, 0.982841f, 0.982859f, 0.982877f, 0.982894f, 0.982912f, 0.982930f, 0.982947f,
- 0.982965f, 0.982982f, 0.983000f, 0.983018f, 0.983035f, 0.983053f, 0.983070f, 0.983088f,
- 0.983105f, 0.983123f, 0.983141f, 0.983158f, 0.983176f, 0.983193f, 0.983211f, 0.983228f,
- 0.983246f, 0.983263f, 0.983281f, 0.983298f, 0.983315f, 0.983333f, 0.983350f, 0.983368f,
- 0.983385f, 0.983402f, 0.983420f, 0.983437f, 0.983455f, 0.983472f, 0.983489f, 0.983507f,
- 0.983524f, 0.983541f, 0.983559f, 0.983576f, 0.983593f, 0.983611f, 0.983628f, 0.983645f,
- 0.983662f, 0.983680f, 0.983697f, 0.983714f, 0.983731f, 0.983749f, 0.983766f, 0.983783f,
- 0.983800f, 0.983817f, 0.983835f, 0.983852f, 0.983869f, 0.983886f, 0.983903f, 0.983920f,
- 0.983937f, 0.983955f, 0.983972f, 0.983989f, 0.984006f, 0.984023f, 0.984040f, 0.984057f,
- 0.984074f, 0.984091f, 0.984108f, 0.984125f, 0.984142f, 0.984159f, 0.984176f, 0.984193f,
- 0.984210f, 0.984227f, 0.984244f, 0.984261f, 0.984278f, 0.984295f, 0.984312f, 0.984329f,
- 0.984346f, 0.984362f, 0.984379f, 0.984396f, 0.984413f, 0.984430f, 0.984447f, 0.984464f,
- 0.984480f, 0.984497f, 0.984514f, 0.984531f, 0.984548f, 0.984564f, 0.984581f, 0.984598f,
- 0.984615f, 0.984632f, 0.984648f, 0.984665f, 0.984682f, 0.984698f, 0.984715f, 0.984732f,
- 0.984748f, 0.984765f, 0.984782f, 0.984798f, 0.984815f, 0.984832f, 0.984848f, 0.984865f,
- 0.984882f, 0.984898f, 0.984915f, 0.984931f, 0.984948f, 0.984965f, 0.984981f, 0.984998f,
- 0.985014f, 0.985031f, 0.985047f, 0.985064f, 0.985080f, 0.985097f, 0.985113f, 0.985130f,
- 0.985146f, 0.985163f, 0.985179f, 0.985196f, 0.985212f, 0.985228f, 0.985245f, 0.985261f,
- 0.985278f, 0.985294f, 0.985310f, 0.985327f, 0.985343f, 0.985359f, 0.985376f, 0.985392f,
- 0.985408f, 0.985425f, 0.985441f, 0.985457f, 0.985474f, 0.985490f, 0.985506f, 0.985523f,
- 0.985539f, 0.985555f, 0.985571f, 0.985587f, 0.985604f, 0.985620f, 0.985636f, 0.985652f,
- 0.985668f, 0.985685f, 0.985701f, 0.985717f, 0.985733f, 0.985749f, 0.985765f, 0.985781f,
- 0.985798f, 0.985814f, 0.985830f, 0.985846f, 0.985862f, 0.985878f, 0.985894f, 0.985910f,
- 0.985926f, 0.985942f, 0.985958f, 0.985974f, 0.985990f, 0.986006f, 0.986022f, 0.986038f,
- 0.986054f, 0.986070f, 0.986086f, 0.986102f, 0.986118f, 0.986134f, 0.986150f, 0.986165f,
- 0.986181f, 0.986197f, 0.986213f, 0.986229f, 0.986245f, 0.986261f, 0.986276f, 0.986292f,
- 0.986308f, 0.986324f, 0.986340f, 0.986355f, 0.986371f, 0.986387f, 0.986403f, 0.986419f,
- 0.986434f, 0.986450f, 0.986466f, 0.986481f, 0.986497f, 0.986513f, 0.986529f, 0.986544f,
- 0.986560f, 0.986576f, 0.986591f, 0.986607f, 0.986623f, 0.986638f, 0.986654f, 0.986669f,
- 0.986685f, 0.986701f, 0.986716f, 0.986732f, 0.986747f, 0.986763f, 0.986778f, 0.986794f,
- 0.986809f, 0.986825f, 0.986840f, 0.986856f, 0.986871f, 0.986887f, 0.986902f, 0.986918f,
- 0.986933f, 0.986949f, 0.986964f, 0.986980f, 0.986995f, 0.987010f, 0.987026f, 0.987041f,
- 0.987057f, 0.987072f, 0.987087f, 0.987103f, 0.987118f, 0.987133f, 0.987149f, 0.987164f,
- 0.987179f, 0.987195f, 0.987210f, 0.987225f, 0.987240f, 0.987256f, 0.987271f, 0.987286f,
- 0.987301f, 0.987317f, 0.987332f, 0.987347f, 0.987362f, 0.987377f, 0.987393f, 0.987408f,
- 0.987423f, 0.987438f, 0.987453f, 0.987468f, 0.987484f, 0.987499f, 0.987514f, 0.987529f,
- 0.987544f, 0.987559f, 0.987574f, 0.987589f, 0.987604f, 0.987619f, 0.987634f, 0.987649f,
- 0.987664f, 0.987679f, 0.987694f, 0.987709f, 0.987724f, 0.987739f, 0.987754f, 0.987769f,
- 0.987784f, 0.987799f, 0.987814f, 0.987829f, 0.987844f, 0.987859f, 0.987874f, 0.987889f,
- 0.987903f, 0.987918f, 0.987933f, 0.987948f, 0.987963f, 0.987978f, 0.987992f, 0.988007f,
- 0.988022f, 0.988037f, 0.988052f, 0.988066f, 0.988081f, 0.988096f, 0.988111f, 0.988125f,
- 0.988140f, 0.988155f, 0.988169f, 0.988184f, 0.988199f, 0.988214f, 0.988228f, 0.988243f,
- 0.988258f, 0.988272f, 0.988287f, 0.988301f, 0.988316f, 0.988331f, 0.988345f, 0.988360f,
- 0.988374f, 0.988389f, 0.988404f, 0.988418f, 0.988433f, 0.988447f, 0.988462f, 0.988476f,
- 0.988491f, 0.988505f, 0.988520f, 0.988534f, 0.988549f, 0.988563f, 0.988578f, 0.988592f,
- 0.988607f, 0.988621f, 0.988635f, 0.988650f, 0.988664f, 0.988679f, 0.988693f, 0.988707f,
- 0.988722f, 0.988736f, 0.988750f, 0.988765f, 0.988779f, 0.988793f, 0.988808f, 0.988822f,
- 0.988836f, 0.988851f, 0.988865f, 0.988879f, 0.988893f, 0.988908f, 0.988922f, 0.988936f,
- 0.988950f, 0.988964f, 0.988979f, 0.988993f, 0.989007f, 0.989021f, 0.989035f, 0.989050f,
- 0.989064f, 0.989078f, 0.989092f, 0.989106f, 0.989120f, 0.989134f, 0.989148f, 0.989162f,
- 0.989177f, 0.989191f, 0.989205f, 0.989219f, 0.989233f, 0.989247f, 0.989261f, 0.989275f,
- 0.989289f, 0.989303f, 0.989317f, 0.989331f, 0.989345f, 0.989359f, 0.989373f, 0.989386f,
- 0.989400f, 0.989414f, 0.989428f, 0.989442f, 0.989456f, 0.989470f, 0.989484f, 0.989498f,
- 0.989511f, 0.989525f, 0.989539f, 0.989553f, 0.989567f, 0.989581f, 0.989594f, 0.989608f,
- 0.989622f, 0.989636f, 0.989650f, 0.989663f, 0.989677f, 0.989691f, 0.989704f, 0.989718f,
- 0.989732f, 0.989746f, 0.989759f, 0.989773f, 0.989787f, 0.989800f, 0.989814f, 0.989828f,
- 0.989841f, 0.989855f, 0.989869f, 0.989882f, 0.989896f, 0.989909f, 0.989923f, 0.989936f,
- 0.989950f, 0.989964f, 0.989977f, 0.989991f, 0.990004f, 0.990018f, 0.990031f, 0.990045f,
- 0.990058f, 0.990072f, 0.990085f, 0.990099f, 0.990112f, 0.990126f, 0.990139f, 0.990152f,
- 0.990166f, 0.990179f, 0.990193f, 0.990206f, 0.990219f, 0.990233f, 0.990246f, 0.990259f,
- 0.990273f, 0.990286f, 0.990299f, 0.990313f, 0.990326f, 0.990339f, 0.990353f, 0.990366f,
- 0.990379f, 0.990393f, 0.990406f, 0.990419f, 0.990432f, 0.990445f, 0.990459f, 0.990472f,
- 0.990485f, 0.990498f, 0.990511f, 0.990525f, 0.990538f, 0.990551f, 0.990564f, 0.990577f,
- 0.990590f, 0.990603f, 0.990617f, 0.990630f, 0.990643f, 0.990656f, 0.990669f, 0.990682f,
- 0.990695f, 0.990708f, 0.990721f, 0.990734f, 0.990747f, 0.990760f, 0.990773f, 0.990786f,
- 0.990799f, 0.990812f, 0.990825f, 0.990838f, 0.990851f, 0.990864f, 0.990877f, 0.990890f,
- 0.990903f, 0.990916f, 0.990928f, 0.990941f, 0.990954f, 0.990967f, 0.990980f, 0.990993f,
- 0.991006f, 0.991018f, 0.991031f, 0.991044f, 0.991057f, 0.991070f, 0.991082f, 0.991095f,
- 0.991108f, 0.991121f, 0.991133f, 0.991146f, 0.991159f, 0.991172f, 0.991184f, 0.991197f,
- 0.991210f, 0.991222f, 0.991235f, 0.991248f, 0.991260f, 0.991273f, 0.991286f, 0.991298f,
- 0.991311f, 0.991323f, 0.991336f, 0.991349f, 0.991361f, 0.991374f, 0.991386f, 0.991399f,
- 0.991411f, 0.991424f, 0.991437f, 0.991449f, 0.991462f, 0.991474f, 0.991487f, 0.991499f,
- 0.991511f, 0.991524f, 0.991536f, 0.991549f, 0.991561f, 0.991574f, 0.991586f, 0.991598f,
- 0.991611f, 0.991623f, 0.991636f, 0.991648f, 0.991660f, 0.991673f, 0.991685f, 0.991697f,
- 0.991710f, 0.991722f, 0.991734f, 0.991747f, 0.991759f, 0.991771f, 0.991783f, 0.991796f,
- 0.991808f, 0.991820f, 0.991832f, 0.991845f, 0.991857f, 0.991869f, 0.991881f, 0.991894f,
- 0.991906f, 0.991918f, 0.991930f, 0.991942f, 0.991954f, 0.991966f, 0.991979f, 0.991991f,
- 0.992003f, 0.992015f, 0.992027f, 0.992039f, 0.992051f, 0.992063f, 0.992075f, 0.992087f,
- 0.992099f, 0.992111f, 0.992123f, 0.992135f, 0.992147f, 0.992159f, 0.992171f, 0.992183f,
- 0.992195f, 0.992207f, 0.992219f, 0.992231f, 0.992243f, 0.992255f, 0.992267f, 0.992279f,
- 0.992291f, 0.992302f, 0.992314f, 0.992326f, 0.992338f, 0.992350f, 0.992362f, 0.992374f,
- 0.992385f, 0.992397f, 0.992409f, 0.992421f, 0.992433f, 0.992444f, 0.992456f, 0.992468f,
- 0.992480f, 0.992491f, 0.992503f, 0.992515f, 0.992526f, 0.992538f, 0.992550f, 0.992561f,
- 0.992573f, 0.992585f, 0.992596f, 0.992608f, 0.992620f, 0.992631f, 0.992643f, 0.992655f,
- 0.992666f, 0.992678f, 0.992689f, 0.992701f, 0.992712f, 0.992724f, 0.992736f, 0.992747f,
- 0.992759f, 0.992770f, 0.992782f, 0.992793f, 0.992805f, 0.992816f, 0.992828f, 0.992839f,
- 0.992850f, 0.992862f, 0.992873f, 0.992885f, 0.992896f, 0.992908f, 0.992919f, 0.992930f,
- 0.992942f, 0.992953f, 0.992964f, 0.992976f, 0.992987f, 0.992998f, 0.993010f, 0.993021f,
- 0.993032f, 0.993044f, 0.993055f, 0.993066f, 0.993077f, 0.993089f, 0.993100f, 0.993111f,
- 0.993122f, 0.993134f, 0.993145f, 0.993156f, 0.993167f, 0.993178f, 0.993190f, 0.993201f,
- 0.993212f, 0.993223f, 0.993234f, 0.993245f, 0.993257f, 0.993268f, 0.993279f, 0.993290f,
- 0.993301f, 0.993312f, 0.993323f, 0.993334f, 0.993345f, 0.993356f, 0.993367f, 0.993378f,
- 0.993389f, 0.993400f, 0.993411f, 0.993422f, 0.993433f, 0.993444f, 0.993455f, 0.993466f,
- 0.993477f, 0.993488f, 0.993499f, 0.993510f, 0.993521f, 0.993532f, 0.993542f, 0.993553f,
- 0.993564f, 0.993575f, 0.993586f, 0.993597f, 0.993608f, 0.993618f, 0.993629f, 0.993640f,
- 0.993651f, 0.993662f, 0.993672f, 0.993683f, 0.993694f, 0.993705f, 0.993715f, 0.993726f,
- 0.993737f, 0.993747f, 0.993758f, 0.993769f, 0.993779f, 0.993790f, 0.993801f, 0.993811f,
- 0.993822f, 0.993833f, 0.993843f, 0.993854f, 0.993865f, 0.993875f, 0.993886f, 0.993896f,
- 0.993907f, 0.993918f, 0.993928f, 0.993939f, 0.993949f, 0.993960f, 0.993970f, 0.993981f,
- 0.993991f, 0.994002f, 0.994012f, 0.994023f, 0.994033f, 0.994044f, 0.994054f, 0.994064f,
- 0.994075f, 0.994085f, 0.994096f, 0.994106f, 0.994116f, 0.994127f, 0.994137f, 0.994148f,
- 0.994158f, 0.994168f, 0.994179f, 0.994189f, 0.994199f, 0.994210f, 0.994220f, 0.994230f,
- 0.994240f, 0.994251f, 0.994261f, 0.994271f, 0.994281f, 0.994292f, 0.994302f, 0.994312f,
- 0.994322f, 0.994333f, 0.994343f, 0.994353f, 0.994363f, 0.994373f, 0.994383f, 0.994394f,
- 0.994404f, 0.994414f, 0.994424f, 0.994434f, 0.994444f, 0.994454f, 0.994464f, 0.994474f,
- 0.994484f, 0.994494f, 0.994505f, 0.994515f, 0.994525f, 0.994535f, 0.994545f, 0.994555f,
- 0.994565f, 0.994575f, 0.994585f, 0.994594f, 0.994604f, 0.994614f, 0.994624f, 0.994634f,
- 0.994644f, 0.994654f, 0.994664f, 0.994674f, 0.994684f, 0.994694f, 0.994703f, 0.994713f,
- 0.994723f, 0.994733f, 0.994743f, 0.994753f, 0.994762f, 0.994772f, 0.994782f, 0.994792f,
- 0.994802f, 0.994811f, 0.994821f, 0.994831f, 0.994841f, 0.994850f, 0.994860f, 0.994870f,
- 0.994879f, 0.994889f, 0.994899f, 0.994908f, 0.994918f, 0.994928f, 0.994937f, 0.994947f,
- 0.994957f, 0.994966f, 0.994976f, 0.994985f, 0.994995f, 0.995005f, 0.995014f, 0.995024f,
- 0.995033f, 0.995043f, 0.995052f, 0.995062f, 0.995071f, 0.995081f, 0.995090f, 0.995100f,
- 0.995109f, 0.995119f, 0.995128f, 0.995138f, 0.995147f, 0.995156f, 0.995166f, 0.995175f,
- 0.995185f, 0.995194f, 0.995203f, 0.995213f, 0.995222f, 0.995232f, 0.995241f, 0.995250f,
- 0.995260f, 0.995269f, 0.995278f, 0.995288f, 0.995297f, 0.995306f, 0.995315f, 0.995325f,
- 0.995334f, 0.995343f, 0.995352f, 0.995362f, 0.995371f, 0.995380f, 0.995389f, 0.995398f,
- 0.995408f, 0.995417f, 0.995426f, 0.995435f, 0.995444f, 0.995453f, 0.995463f, 0.995472f,
- 0.995481f, 0.995490f, 0.995499f, 0.995508f, 0.995517f, 0.995526f, 0.995535f, 0.995544f,
- 0.995553f, 0.995562f, 0.995571f, 0.995580f, 0.995589f, 0.995598f, 0.995607f, 0.995616f,
- 0.995625f, 0.995634f, 0.995643f, 0.995652f, 0.995661f, 0.995670f, 0.995679f, 0.995688f,
- 0.995697f, 0.995705f, 0.995714f, 0.995723f, 0.995732f, 0.995741f, 0.995750f, 0.995759f,
- 0.995767f, 0.995776f, 0.995785f, 0.995794f, 0.995803f, 0.995811f, 0.995820f, 0.995829f,
- 0.995838f, 0.995846f, 0.995855f, 0.995864f, 0.995872f, 0.995881f, 0.995890f, 0.995899f,
- 0.995907f, 0.995916f, 0.995925f, 0.995933f, 0.995942f, 0.995950f, 0.995959f, 0.995968f,
- 0.995976f, 0.995985f, 0.995993f, 0.996002f, 0.996011f, 0.996019f, 0.996028f, 0.996036f,
- 0.996045f, 0.996053f, 0.996062f, 0.996070f, 0.996079f, 0.996087f, 0.996096f, 0.996104f,
- 0.996113f, 0.996121f, 0.996129f, 0.996138f, 0.996146f, 0.996155f, 0.996163f, 0.996171f,
- 0.996180f, 0.996188f, 0.996197f, 0.996205f, 0.996213f, 0.996222f, 0.996230f, 0.996238f,
- 0.996247f, 0.996255f, 0.996263f, 0.996271f, 0.996280f, 0.996288f, 0.996296f, 0.996304f,
- 0.996313f, 0.996321f, 0.996329f, 0.996337f, 0.996345f, 0.996354f, 0.996362f, 0.996370f,
- 0.996378f, 0.996386f, 0.996394f, 0.996403f, 0.996411f, 0.996419f, 0.996427f, 0.996435f,
- 0.996443f, 0.996451f, 0.996459f, 0.996467f, 0.996475f, 0.996483f, 0.996491f, 0.996499f,
- 0.996507f, 0.996515f, 0.996523f, 0.996531f, 0.996539f, 0.996547f, 0.996555f, 0.996563f,
- 0.996571f, 0.996579f, 0.996587f, 0.996595f, 0.996603f, 0.996611f, 0.996619f, 0.996626f,
- 0.996634f, 0.996642f, 0.996650f, 0.996658f, 0.996666f, 0.996674f, 0.996681f, 0.996689f,
- 0.996697f, 0.996705f, 0.996712f, 0.996720f, 0.996728f, 0.996736f, 0.996743f, 0.996751f,
- 0.996759f, 0.996767f, 0.996774f, 0.996782f, 0.996790f, 0.996797f, 0.996805f, 0.996813f,
- 0.996820f, 0.996828f, 0.996836f, 0.996843f, 0.996851f, 0.996858f, 0.996866f, 0.996874f,
- 0.996881f, 0.996889f, 0.996896f, 0.996904f, 0.996911f, 0.996919f, 0.996926f, 0.996934f,
- 0.996941f, 0.996949f, 0.996956f, 0.996964f, 0.996971f, 0.996979f, 0.996986f, 0.996994f,
- 0.997001f, 0.997008f, 0.997016f, 0.997023f, 0.997031f, 0.997038f, 0.997045f, 0.997053f,
- 0.997060f, 0.997067f, 0.997075f, 0.997082f, 0.997089f, 0.997097f, 0.997104f, 0.997111f,
- 0.997119f, 0.997126f, 0.997133f, 0.997140f, 0.997148f, 0.997155f, 0.997162f, 0.997169f,
- 0.997176f, 0.997184f, 0.997191f, 0.997198f, 0.997205f, 0.997212f, 0.997219f, 0.997227f,
- 0.997234f, 0.997241f, 0.997248f, 0.997255f, 0.997262f, 0.997269f, 0.997276f, 0.997283f,
- 0.997290f, 0.997298f, 0.997305f, 0.997312f, 0.997319f, 0.997326f, 0.997333f, 0.997340f,
- 0.997347f, 0.997354f, 0.997361f, 0.997368f, 0.997374f, 0.997381f, 0.997388f, 0.997395f,
- 0.997402f, 0.997409f, 0.997416f, 0.997423f, 0.997430f, 0.997437f, 0.997443f, 0.997450f,
- 0.997457f, 0.997464f, 0.997471f, 0.997478f, 0.997484f, 0.997491f, 0.997498f, 0.997505f,
- 0.997511f, 0.997518f, 0.997525f, 0.997532f, 0.997538f, 0.997545f, 0.997552f, 0.997559f,
- 0.997565f, 0.997572f, 0.997579f, 0.997585f, 0.997592f, 0.997599f, 0.997605f, 0.997612f,
- 0.997618f, 0.997625f, 0.997632f, 0.997638f, 0.997645f, 0.997651f, 0.997658f, 0.997665f,
- 0.997671f, 0.997678f, 0.997684f, 0.997691f, 0.997697f, 0.997704f, 0.997710f, 0.997717f,
- 0.997723f, 0.997730f, 0.997736f, 0.997742f, 0.997749f, 0.997755f, 0.997762f, 0.997768f,
- 0.997774f, 0.997781f, 0.997787f, 0.997794f, 0.997800f, 0.997806f, 0.997813f, 0.997819f,
- 0.997825f, 0.997832f, 0.997838f, 0.997844f, 0.997851f, 0.997857f, 0.997863f, 0.997869f,
- 0.997876f, 0.997882f, 0.997888f, 0.997894f, 0.997901f, 0.997907f, 0.997913f, 0.997919f,
- 0.997925f, 0.997931f, 0.997938f, 0.997944f, 0.997950f, 0.997956f, 0.997962f, 0.997968f,
- 0.997974f, 0.997980f, 0.997987f, 0.997993f, 0.997999f, 0.998005f, 0.998011f, 0.998017f,
- 0.998023f, 0.998029f, 0.998035f, 0.998041f, 0.998047f, 0.998053f, 0.998059f, 0.998065f,
- 0.998071f, 0.998077f, 0.998083f, 0.998089f, 0.998094f, 0.998100f, 0.998106f, 0.998112f,
- 0.998118f, 0.998124f, 0.998130f, 0.998136f, 0.998142f, 0.998147f, 0.998153f, 0.998159f,
- 0.998165f, 0.998171f, 0.998176f, 0.998182f, 0.998188f, 0.998194f, 0.998200f, 0.998205f,
- 0.998211f, 0.998217f, 0.998222f, 0.998228f, 0.998234f, 0.998240f, 0.998245f, 0.998251f,
- 0.998257f, 0.998262f, 0.998268f, 0.998273f, 0.998279f, 0.998285f, 0.998290f, 0.998296f,
- 0.998302f, 0.998307f, 0.998313f, 0.998318f, 0.998324f, 0.998329f, 0.998335f, 0.998340f,
- 0.998346f, 0.998351f, 0.998357f, 0.998362f, 0.998368f, 0.998373f, 0.998379f, 0.998384f,
- 0.998390f, 0.998395f, 0.998401f, 0.998406f, 0.998411f, 0.998417f, 0.998422f, 0.998428f,
- 0.998433f, 0.998438f, 0.998444f, 0.998449f, 0.998454f, 0.998460f, 0.998465f, 0.998470f,
- 0.998476f, 0.998481f, 0.998486f, 0.998491f, 0.998497f, 0.998502f, 0.998507f, 0.998512f,
- 0.998518f, 0.998523f, 0.998528f, 0.998533f, 0.998538f, 0.998544f, 0.998549f, 0.998554f,
- 0.998559f, 0.998564f, 0.998569f, 0.998574f, 0.998580f, 0.998585f, 0.998590f, 0.998595f,
- 0.998600f, 0.998605f, 0.998610f, 0.998615f, 0.998620f, 0.998625f, 0.998630f, 0.998635f,
- 0.998640f, 0.998645f, 0.998650f, 0.998655f, 0.998660f, 0.998665f, 0.998670f, 0.998675f,
- 0.998680f, 0.998685f, 0.998690f, 0.998695f, 0.998700f, 0.998704f, 0.998709f, 0.998714f,
- 0.998719f, 0.998724f, 0.998729f, 0.998734f, 0.998738f, 0.998743f, 0.998748f, 0.998753f,
- 0.998758f, 0.998762f, 0.998767f, 0.998772f, 0.998777f, 0.998781f, 0.998786f, 0.998791f,
- 0.998795f, 0.998800f, 0.998805f, 0.998810f, 0.998814f, 0.998819f, 0.998824f, 0.998828f,
- 0.998833f, 0.998837f, 0.998842f, 0.998847f, 0.998851f, 0.998856f, 0.998860f, 0.998865f,
- 0.998870f, 0.998874f, 0.998879f, 0.998883f, 0.998888f, 0.998892f, 0.998897f, 0.998901f,
- 0.998906f, 0.998910f, 0.998915f, 0.998919f, 0.998924f, 0.998928f, 0.998932f, 0.998937f,
- 0.998941f, 0.998946f, 0.998950f, 0.998954f, 0.998959f, 0.998963f, 0.998968f, 0.998972f,
- 0.998976f, 0.998981f, 0.998985f, 0.998989f, 0.998994f, 0.998998f, 0.999002f, 0.999006f,
- 0.999011f, 0.999015f, 0.999019f, 0.999023f, 0.999028f, 0.999032f, 0.999036f, 0.999040f,
- 0.999044f, 0.999049f, 0.999053f, 0.999057f, 0.999061f, 0.999065f, 0.999069f, 0.999074f,
- 0.999078f, 0.999082f, 0.999086f, 0.999090f, 0.999094f, 0.999098f, 0.999102f, 0.999106f,
- 0.999110f, 0.999114f, 0.999118f, 0.999122f, 0.999126f, 0.999130f, 0.999134f, 0.999138f,
- 0.999142f, 0.999146f, 0.999150f, 0.999154f, 0.999158f, 0.999162f, 0.999166f, 0.999170f,
- 0.999174f, 0.999178f, 0.999182f, 0.999186f, 0.999189f, 0.999193f, 0.999197f, 0.999201f,
- 0.999205f, 0.999209f, 0.999212f, 0.999216f, 0.999220f, 0.999224f, 0.999228f, 0.999231f,
- 0.999235f, 0.999239f, 0.999243f, 0.999246f, 0.999250f, 0.999254f, 0.999257f, 0.999261f,
- 0.999265f, 0.999268f, 0.999272f, 0.999276f, 0.999279f, 0.999283f, 0.999287f, 0.999290f,
- 0.999294f, 0.999297f, 0.999301f, 0.999305f, 0.999308f, 0.999312f, 0.999315f, 0.999319f,
- 0.999322f, 0.999326f, 0.999329f, 0.999333f, 0.999336f, 0.999340f, 0.999343f, 0.999347f,
- 0.999350f, 0.999354f, 0.999357f, 0.999361f, 0.999364f, 0.999367f, 0.999371f, 0.999374f,
- 0.999378f, 0.999381f, 0.999384f, 0.999388f, 0.999391f, 0.999394f, 0.999398f, 0.999401f,
- 0.999404f, 0.999408f, 0.999411f, 0.999414f, 0.999418f, 0.999421f, 0.999424f, 0.999427f,
- 0.999431f, 0.999434f, 0.999437f, 0.999440f, 0.999443f, 0.999447f, 0.999450f, 0.999453f,
- 0.999456f, 0.999459f, 0.999462f, 0.999466f, 0.999469f, 0.999472f, 0.999475f, 0.999478f,
- 0.999481f, 0.999484f, 0.999487f, 0.999490f, 0.999493f, 0.999497f, 0.999500f, 0.999503f,
- 0.999506f, 0.999509f, 0.999512f, 0.999515f, 0.999518f, 0.999521f, 0.999524f, 0.999527f,
- 0.999529f, 0.999532f, 0.999535f, 0.999538f, 0.999541f, 0.999544f, 0.999547f, 0.999550f,
- 0.999553f, 0.999556f, 0.999558f, 0.999561f, 0.999564f, 0.999567f, 0.999570f, 0.999573f,
- 0.999575f, 0.999578f, 0.999581f, 0.999584f, 0.999586f, 0.999589f, 0.999592f, 0.999595f,
- 0.999597f, 0.999600f, 0.999603f, 0.999605f, 0.999608f, 0.999611f, 0.999614f, 0.999616f,
- 0.999619f, 0.999621f, 0.999624f, 0.999627f, 0.999629f, 0.999632f, 0.999635f, 0.999637f,
- 0.999640f, 0.999642f, 0.999645f, 0.999647f, 0.999650f, 0.999652f, 0.999655f, 0.999658f,
- 0.999660f, 0.999663f, 0.999665f, 0.999667f, 0.999670f, 0.999672f, 0.999675f, 0.999677f,
- 0.999680f, 0.999682f, 0.999685f, 0.999687f, 0.999689f, 0.999692f, 0.999694f, 0.999696f,
- 0.999699f, 0.999701f, 0.999704f, 0.999706f, 0.999708f, 0.999710f, 0.999713f, 0.999715f,
- 0.999717f, 0.999720f, 0.999722f, 0.999724f, 0.999726f, 0.999729f, 0.999731f, 0.999733f,
- 0.999735f, 0.999738f, 0.999740f, 0.999742f, 0.999744f, 0.999746f, 0.999748f, 0.999750f,
- 0.999753f, 0.999755f, 0.999757f, 0.999759f, 0.999761f, 0.999763f, 0.999765f, 0.999767f,
- 0.999769f, 0.999771f, 0.999774f, 0.999776f, 0.999778f, 0.999780f, 0.999782f, 0.999784f,
- 0.999786f, 0.999788f, 0.999790f, 0.999792f, 0.999793f, 0.999795f, 0.999797f, 0.999799f,
- 0.999801f, 0.999803f, 0.999805f, 0.999807f, 0.999809f, 0.999811f, 0.999812f, 0.999814f,
- 0.999816f, 0.999818f, 0.999820f, 0.999822f, 0.999823f, 0.999825f, 0.999827f, 0.999829f,
- 0.999831f, 0.999832f, 0.999834f, 0.999836f, 0.999838f, 0.999839f, 0.999841f, 0.999843f,
- 0.999844f, 0.999846f, 0.999848f, 0.999849f, 0.999851f, 0.999853f, 0.999854f, 0.999856f,
- 0.999858f, 0.999859f, 0.999861f, 0.999862f, 0.999864f, 0.999866f, 0.999867f, 0.999869f,
- 0.999870f, 0.999872f, 0.999873f, 0.999875f, 0.999876f, 0.999878f, 0.999879f, 0.999881f,
- 0.999882f, 0.999884f, 0.999885f, 0.999887f, 0.999888f, 0.999890f, 0.999891f, 0.999892f,
- 0.999894f, 0.999895f, 0.999897f, 0.999898f, 0.999899f, 0.999901f, 0.999902f, 0.999903f,
- 0.999905f, 0.999906f, 0.999907f, 0.999909f, 0.999910f, 0.999911f, 0.999913f, 0.999914f,
- 0.999915f, 0.999916f, 0.999917f, 0.999919f, 0.999920f, 0.999921f, 0.999922f, 0.999924f,
- 0.999925f, 0.999926f, 0.999927f, 0.999928f, 0.999929f, 0.999930f, 0.999932f, 0.999933f,
- 0.999934f, 0.999935f, 0.999936f, 0.999937f, 0.999938f, 0.999939f, 0.999940f, 0.999941f,
- 0.999942f, 0.999943f, 0.999944f, 0.999945f, 0.999946f, 0.999947f, 0.999948f, 0.999949f,
- 0.999950f, 0.999951f, 0.999952f, 0.999953f, 0.999954f, 0.999955f, 0.999956f, 0.999957f,
- 0.999958f, 0.999959f, 0.999959f, 0.999960f, 0.999961f, 0.999962f, 0.999963f, 0.999964f,
- 0.999964f, 0.999965f, 0.999966f, 0.999967f, 0.999968f, 0.999968f, 0.999969f, 0.999970f,
- 0.999971f, 0.999971f, 0.999972f, 0.999973f, 0.999973f, 0.999974f, 0.999975f, 0.999976f,
- 0.999976f, 0.999977f, 0.999977f, 0.999978f, 0.999979f, 0.999979f, 0.999980f, 0.999981f,
- 0.999981f, 0.999982f, 0.999982f, 0.999983f, 0.999983f, 0.999984f, 0.999985f, 0.999985f,
- 0.999986f, 0.999986f, 0.999987f, 0.999987f, 0.999988f, 0.999988f, 0.999988f, 0.999989f,
- 0.999989f, 0.999990f, 0.999990f, 0.999991f, 0.999991f, 0.999991f, 0.999992f, 0.999992f,
- 0.999993f, 0.999993f, 0.999993f, 0.999994f, 0.999994f, 0.999994f, 0.999995f, 0.999995f,
- 0.999995f, 0.999996f, 0.999996f, 0.999996f, 0.999996f, 0.999997f, 0.999997f, 0.999997f,
- 0.999997f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, 0.999999f, 0.999999f,
- 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 0.000000f, -0.000096f, -0.000192f, -0.000288f, -0.000383f, -0.000479f, -0.000575f, -0.000671f,
- -0.000767f, -0.000863f, -0.000959f, -0.001055f, -0.001150f, -0.001246f, -0.001342f, -0.001438f,
- -0.001534f, -0.001630f, -0.001726f, -0.001822f, -0.001917f, -0.002013f, -0.002109f, -0.002205f,
- -0.002301f, -0.002397f, -0.002493f, -0.002589f, -0.002684f, -0.002780f, -0.002876f, -0.002972f,
- -0.003068f, -0.003164f, -0.003260f, -0.003356f, -0.003451f, -0.003547f, -0.003643f, -0.003739f,
- -0.003835f, -0.003931f, -0.004027f, -0.004123f, -0.004218f, -0.004314f, -0.004410f, -0.004506f,
- -0.004602f, -0.004698f, -0.004794f, -0.004890f, -0.004985f, -0.005081f, -0.005177f, -0.005273f,
- -0.005369f, -0.005465f, -0.005561f, -0.005657f, -0.005752f, -0.005848f, -0.005944f, -0.006040f,
- -0.006136f, -0.006232f, -0.006328f, -0.006424f, -0.006519f, -0.006615f, -0.006711f, -0.006807f,
- -0.006903f, -0.006999f, -0.007095f, -0.007190f, -0.007286f, -0.007382f, -0.007478f, -0.007574f,
- -0.007670f, -0.007766f, -0.007862f, -0.007957f, -0.008053f, -0.008149f, -0.008245f, -0.008341f,
- -0.008437f, -0.008533f, -0.008629f, -0.008724f, -0.008820f, -0.008916f, -0.009012f, -0.009108f,
- -0.009204f, -0.009300f, -0.009395f, -0.009491f, -0.009587f, -0.009683f, -0.009779f, -0.009875f,
- -0.009971f, -0.010067f, -0.010162f, -0.010258f, -0.010354f, -0.010450f, -0.010546f, -0.010642f,
- -0.010738f, -0.010834f, -0.010929f, -0.011025f, -0.011121f, -0.011217f, -0.011313f, -0.011409f,
- -0.011505f, -0.011600f, -0.011696f, -0.011792f, -0.011888f, -0.011984f, -0.012080f, -0.012176f,
- -0.012272f, -0.012367f, -0.012463f, -0.012559f, -0.012655f, -0.012751f, -0.012847f, -0.012943f,
- -0.013038f, -0.013134f, -0.013230f, -0.013326f, -0.013422f, -0.013518f, -0.013614f, -0.013710f,
- -0.013805f, -0.013901f, -0.013997f, -0.014093f, -0.014189f, -0.014285f, -0.014381f, -0.014476f,
- -0.014572f, -0.014668f, -0.014764f, -0.014860f, -0.014956f, -0.015052f, -0.015147f, -0.015243f,
- -0.015339f, -0.015435f, -0.015531f, -0.015627f, -0.015723f, -0.015819f, -0.015914f, -0.016010f,
- -0.016106f, -0.016202f, -0.016298f, -0.016394f, -0.016490f, -0.016585f, -0.016681f, -0.016777f,
- -0.016873f, -0.016969f, -0.017065f, -0.017161f, -0.017256f, -0.017352f, -0.017448f, -0.017544f,
- -0.017640f, -0.017736f, -0.017832f, -0.017927f, -0.018023f, -0.018119f, -0.018215f, -0.018311f,
- -0.018407f, -0.018503f, -0.018598f, -0.018694f, -0.018790f, -0.018886f, -0.018982f, -0.019078f,
- -0.019174f, -0.019269f, -0.019365f, -0.019461f, -0.019557f, -0.019653f, -0.019749f, -0.019845f,
- -0.019940f, -0.020036f, -0.020132f, -0.020228f, -0.020324f, -0.020420f, -0.020516f, -0.020611f,
- -0.020707f, -0.020803f, -0.020899f, -0.020995f, -0.021091f, -0.021187f, -0.021282f, -0.021378f,
- -0.021474f, -0.021570f, -0.021666f, -0.021762f, -0.021857f, -0.021953f, -0.022049f, -0.022145f,
- -0.022241f, -0.022337f, -0.022433f, -0.022528f, -0.022624f, -0.022720f, -0.022816f, -0.022912f,
- -0.023008f, -0.023104f, -0.023199f, -0.023295f, -0.023391f, -0.023487f, -0.023583f, -0.023679f,
- -0.023774f, -0.023870f, -0.023966f, -0.024062f, -0.024158f, -0.024254f, -0.024350f, -0.024445f,
- -0.024541f, -0.024637f, -0.024733f, -0.024829f, -0.024925f, -0.025020f, -0.025116f, -0.025212f,
- -0.025308f, -0.025404f, -0.025500f, -0.025596f, -0.025691f, -0.025787f, -0.025883f, -0.025979f,
- -0.026075f, -0.026171f, -0.026266f, -0.026362f, -0.026458f, -0.026554f, -0.026650f, -0.026746f,
- -0.026841f, -0.026937f, -0.027033f, -0.027129f, -0.027225f, -0.027321f, -0.027416f, -0.027512f,
- -0.027608f, -0.027704f, -0.027800f, -0.027896f, -0.027991f, -0.028087f, -0.028183f, -0.028279f,
- -0.028375f, -0.028471f, -0.028567f, -0.028662f, -0.028758f, -0.028854f, -0.028950f, -0.029046f,
- -0.029142f, -0.029237f, -0.029333f, -0.029429f, -0.029525f, -0.029621f, -0.029717f, -0.029812f,
- -0.029908f, -0.030004f, -0.030100f, -0.030196f, -0.030291f, -0.030387f, -0.030483f, -0.030579f,
- -0.030675f, -0.030771f, -0.030866f, -0.030962f, -0.031058f, -0.031154f, -0.031250f, -0.031346f,
- -0.031441f, -0.031537f, -0.031633f, -0.031729f, -0.031825f, -0.031921f, -0.032016f, -0.032112f,
- -0.032208f, -0.032304f, -0.032400f, -0.032495f, -0.032591f, -0.032687f, -0.032783f, -0.032879f,
- -0.032975f, -0.033070f, -0.033166f, -0.033262f, -0.033358f, -0.033454f, -0.033550f, -0.033645f,
- -0.033741f, -0.033837f, -0.033933f, -0.034029f, -0.034124f, -0.034220f, -0.034316f, -0.034412f,
- -0.034508f, -0.034604f, -0.034699f, -0.034795f, -0.034891f, -0.034987f, -0.035083f, -0.035178f,
- -0.035274f, -0.035370f, -0.035466f, -0.035562f, -0.035657f, -0.035753f, -0.035849f, -0.035945f,
- -0.036041f, -0.036137f, -0.036232f, -0.036328f, -0.036424f, -0.036520f, -0.036616f, -0.036711f,
- -0.036807f, -0.036903f, -0.036999f, -0.037095f, -0.037190f, -0.037286f, -0.037382f, -0.037478f,
- -0.037574f, -0.037669f, -0.037765f, -0.037861f, -0.037957f, -0.038053f, -0.038149f, -0.038244f,
- -0.038340f, -0.038436f, -0.038532f, -0.038628f, -0.038723f, -0.038819f, -0.038915f, -0.039011f,
- -0.039107f, -0.039202f, -0.039298f, -0.039394f, -0.039490f, -0.039586f, -0.039681f, -0.039777f,
- -0.039873f, -0.039969f, -0.040065f, -0.040160f, -0.040256f, -0.040352f, -0.040448f, -0.040544f,
- -0.040639f, -0.040735f, -0.040831f, -0.040927f, -0.041022f, -0.041118f, -0.041214f, -0.041310f,
- -0.041406f, -0.041501f, -0.041597f, -0.041693f, -0.041789f, -0.041885f, -0.041980f, -0.042076f,
- -0.042172f, -0.042268f, -0.042364f, -0.042459f, -0.042555f, -0.042651f, -0.042747f, -0.042842f,
- -0.042938f, -0.043034f, -0.043130f, -0.043226f, -0.043321f, -0.043417f, -0.043513f, -0.043609f,
- -0.043705f, -0.043800f, -0.043896f, -0.043992f, -0.044088f, -0.044183f, -0.044279f, -0.044375f,
- -0.044471f, -0.044567f, -0.044662f, -0.044758f, -0.044854f, -0.044950f, -0.045045f, -0.045141f,
- -0.045237f, -0.045333f, -0.045429f, -0.045524f, -0.045620f, -0.045716f, -0.045812f, -0.045907f,
- -0.046003f, -0.046099f, -0.046195f, -0.046290f, -0.046386f, -0.046482f, -0.046578f, -0.046674f,
- -0.046769f, -0.046865f, -0.046961f, -0.047057f, -0.047152f, -0.047248f, -0.047344f, -0.047440f,
- -0.047535f, -0.047631f, -0.047727f, -0.047823f, -0.047919f, -0.048014f, -0.048110f, -0.048206f,
- -0.048302f, -0.048397f, -0.048493f, -0.048589f, -0.048685f, -0.048780f, -0.048876f, -0.048972f,
- -0.049068f, -0.049163f, -0.049259f, -0.049355f, -0.049451f, -0.049546f, -0.049642f, -0.049738f,
- -0.049834f, -0.049929f, -0.050025f, -0.050121f, -0.050217f, -0.050312f, -0.050408f, -0.050504f,
- -0.050600f, -0.050696f, -0.050791f, -0.050887f, -0.050983f, -0.051078f, -0.051174f, -0.051270f,
- -0.051366f, -0.051461f, -0.051557f, -0.051653f, -0.051749f, -0.051844f, -0.051940f, -0.052036f,
- -0.052132f, -0.052227f, -0.052323f, -0.052419f, -0.052515f, -0.052610f, -0.052706f, -0.052802f,
- -0.052898f, -0.052993f, -0.053089f, -0.053185f, -0.053281f, -0.053376f, -0.053472f, -0.053568f,
- -0.053664f, -0.053759f, -0.053855f, -0.053951f, -0.054046f, -0.054142f, -0.054238f, -0.054334f,
- -0.054429f, -0.054525f, -0.054621f, -0.054717f, -0.054812f, -0.054908f, -0.055004f, -0.055100f,
- -0.055195f, -0.055291f, -0.055387f, -0.055482f, -0.055578f, -0.055674f, -0.055770f, -0.055865f,
- -0.055961f, -0.056057f, -0.056152f, -0.056248f, -0.056344f, -0.056440f, -0.056535f, -0.056631f,
- -0.056727f, -0.056823f, -0.056918f, -0.057014f, -0.057110f, -0.057205f, -0.057301f, -0.057397f,
- -0.057493f, -0.057588f, -0.057684f, -0.057780f, -0.057875f, -0.057971f, -0.058067f, -0.058163f,
- -0.058258f, -0.058354f, -0.058450f, -0.058545f, -0.058641f, -0.058737f, -0.058833f, -0.058928f,
- -0.059024f, -0.059120f, -0.059215f, -0.059311f, -0.059407f, -0.059502f, -0.059598f, -0.059694f,
- -0.059790f, -0.059885f, -0.059981f, -0.060077f, -0.060172f, -0.060268f, -0.060364f, -0.060459f,
- -0.060555f, -0.060651f, -0.060747f, -0.060842f, -0.060938f, -0.061034f, -0.061129f, -0.061225f,
- -0.061321f, -0.061416f, -0.061512f, -0.061608f, -0.061704f, -0.061799f, -0.061895f, -0.061991f,
- -0.062086f, -0.062182f, -0.062278f, -0.062373f, -0.062469f, -0.062565f, -0.062660f, -0.062756f,
- -0.062852f, -0.062947f, -0.063043f, -0.063139f, -0.063234f, -0.063330f, -0.063426f, -0.063522f,
- -0.063617f, -0.063713f, -0.063809f, -0.063904f, -0.064000f, -0.064096f, -0.064191f, -0.064287f,
- -0.064383f, -0.064478f, -0.064574f, -0.064670f, -0.064765f, -0.064861f, -0.064957f, -0.065052f,
- -0.065148f, -0.065244f, -0.065339f, -0.065435f, -0.065531f, -0.065626f, -0.065722f, -0.065818f,
- -0.065913f, -0.066009f, -0.066105f, -0.066200f, -0.066296f, -0.066392f, -0.066487f, -0.066583f,
- -0.066679f, -0.066774f, -0.066870f, -0.066966f, -0.067061f, -0.067157f, -0.067253f, -0.067348f,
- -0.067444f, -0.067540f, -0.067635f, -0.067731f, -0.067827f, -0.067922f, -0.068018f, -0.068113f,
- -0.068209f, -0.068305f, -0.068400f, -0.068496f, -0.068592f, -0.068687f, -0.068783f, -0.068879f,
- -0.068974f, -0.069070f, -0.069166f, -0.069261f, -0.069357f, -0.069453f, -0.069548f, -0.069644f,
- -0.069739f, -0.069835f, -0.069931f, -0.070026f, -0.070122f, -0.070218f, -0.070313f, -0.070409f,
- -0.070505f, -0.070600f, -0.070696f, -0.070791f, -0.070887f, -0.070983f, -0.071078f, -0.071174f,
- -0.071270f, -0.071365f, -0.071461f, -0.071557f, -0.071652f, -0.071748f, -0.071843f, -0.071939f,
- -0.072035f, -0.072130f, -0.072226f, -0.072322f, -0.072417f, -0.072513f, -0.072608f, -0.072704f,
- -0.072800f, -0.072895f, -0.072991f, -0.073086f, -0.073182f, -0.073278f, -0.073373f, -0.073469f,
- -0.073565f, -0.073660f, -0.073756f, -0.073851f, -0.073947f, -0.074043f, -0.074138f, -0.074234f,
- -0.074329f, -0.074425f, -0.074521f, -0.074616f, -0.074712f, -0.074807f, -0.074903f, -0.074999f,
- -0.075094f, -0.075190f, -0.075286f, -0.075381f, -0.075477f, -0.075572f, -0.075668f, -0.075764f,
- -0.075859f, -0.075955f, -0.076050f, -0.076146f, -0.076241f, -0.076337f, -0.076433f, -0.076528f,
- -0.076624f, -0.076719f, -0.076815f, -0.076911f, -0.077006f, -0.077102f, -0.077197f, -0.077293f,
- -0.077389f, -0.077484f, -0.077580f, -0.077675f, -0.077771f, -0.077866f, -0.077962f, -0.078058f,
- -0.078153f, -0.078249f, -0.078344f, -0.078440f, -0.078536f, -0.078631f, -0.078727f, -0.078822f,
- -0.078918f, -0.079013f, -0.079109f, -0.079205f, -0.079300f, -0.079396f, -0.079491f, -0.079587f,
- -0.079682f, -0.079778f, -0.079874f, -0.079969f, -0.080065f, -0.080160f, -0.080256f, -0.080351f,
- -0.080447f, -0.080543f, -0.080638f, -0.080734f, -0.080829f, -0.080925f, -0.081020f, -0.081116f,
- -0.081211f, -0.081307f, -0.081403f, -0.081498f, -0.081594f, -0.081689f, -0.081785f, -0.081880f,
- -0.081976f, -0.082071f, -0.082167f, -0.082263f, -0.082358f, -0.082454f, -0.082549f, -0.082645f,
- -0.082740f, -0.082836f, -0.082931f, -0.083027f, -0.083122f, -0.083218f, -0.083314f, -0.083409f,
- -0.083505f, -0.083600f, -0.083696f, -0.083791f, -0.083887f, -0.083982f, -0.084078f, -0.084173f,
- -0.084269f, -0.084364f, -0.084460f, -0.084555f, -0.084651f, -0.084747f, -0.084842f, -0.084938f,
- -0.085033f, -0.085129f, -0.085224f, -0.085320f, -0.085415f, -0.085511f, -0.085606f, -0.085702f,
- -0.085797f, -0.085893f, -0.085988f, -0.086084f, -0.086179f, -0.086275f, -0.086370f, -0.086466f,
- -0.086561f, -0.086657f, -0.086752f, -0.086848f, -0.086943f, -0.087039f, -0.087135f, -0.087230f,
- -0.087326f, -0.087421f, -0.087517f, -0.087612f, -0.087708f, -0.087803f, -0.087899f, -0.087994f,
- -0.088090f, -0.088185f, -0.088281f, -0.088376f, -0.088472f, -0.088567f, -0.088663f, -0.088758f,
- -0.088854f, -0.088949f, -0.089045f, -0.089140f, -0.089236f, -0.089331f, -0.089427f, -0.089522f,
- -0.089617f, -0.089713f, -0.089808f, -0.089904f, -0.089999f, -0.090095f, -0.090190f, -0.090286f,
- -0.090381f, -0.090477f, -0.090572f, -0.090668f, -0.090763f, -0.090859f, -0.090954f, -0.091050f,
- -0.091145f, -0.091241f, -0.091336f, -0.091432f, -0.091527f, -0.091623f, -0.091718f, -0.091813f,
- -0.091909f, -0.092004f, -0.092100f, -0.092195f, -0.092291f, -0.092386f, -0.092482f, -0.092577f,
- -0.092673f, -0.092768f, -0.092864f, -0.092959f, -0.093055f, -0.093150f, -0.093245f, -0.093341f,
- -0.093436f, -0.093532f, -0.093627f, -0.093723f, -0.093818f, -0.093914f, -0.094009f, -0.094104f,
- -0.094200f, -0.094295f, -0.094391f, -0.094486f, -0.094582f, -0.094677f, -0.094773f, -0.094868f,
- -0.094963f, -0.095059f, -0.095154f, -0.095250f, -0.095345f, -0.095441f, -0.095536f, -0.095632f,
- -0.095727f, -0.095822f, -0.095918f, -0.096013f, -0.096109f, -0.096204f, -0.096300f, -0.096395f,
- -0.096490f, -0.096586f, -0.096681f, -0.096777f, -0.096872f, -0.096968f, -0.097063f, -0.097158f,
- -0.097254f, -0.097349f, -0.097445f, -0.097540f, -0.097635f, -0.097731f, -0.097826f, -0.097922f,
- -0.098017f, -0.098113f, -0.098208f, -0.098303f, -0.098399f, -0.098494f, -0.098590f, -0.098685f,
- -0.098780f, -0.098876f, -0.098971f, -0.099067f, -0.099162f, -0.099257f, -0.099353f, -0.099448f,
- -0.099544f, -0.099639f, -0.099734f, -0.099830f, -0.099925f, -0.100021f, -0.100116f, -0.100211f,
- -0.100307f, -0.100402f, -0.100498f, -0.100593f, -0.100688f, -0.100784f, -0.100879f, -0.100974f,
- -0.101070f, -0.101165f, -0.101261f, -0.101356f, -0.101451f, -0.101547f, -0.101642f, -0.101738f,
- -0.101833f, -0.101928f, -0.102024f, -0.102119f, -0.102214f, -0.102310f, -0.102405f, -0.102500f,
- -0.102596f, -0.102691f, -0.102787f, -0.102882f, -0.102977f, -0.103073f, -0.103168f, -0.103263f,
- -0.103359f, -0.103454f, -0.103550f, -0.103645f, -0.103740f, -0.103836f, -0.103931f, -0.104026f,
- -0.104122f, -0.104217f, -0.104312f, -0.104408f, -0.104503f, -0.104598f, -0.104694f, -0.104789f,
- -0.104884f, -0.104980f, -0.105075f, -0.105170f, -0.105266f, -0.105361f, -0.105456f, -0.105552f,
- -0.105647f, -0.105742f, -0.105838f, -0.105933f, -0.106028f, -0.106124f, -0.106219f, -0.106314f,
- -0.106410f, -0.106505f, -0.106600f, -0.106696f, -0.106791f, -0.106886f, -0.106982f, -0.107077f,
- -0.107172f, -0.107268f, -0.107363f, -0.107458f, -0.107554f, -0.107649f, -0.107744f, -0.107840f,
- -0.107935f, -0.108030f, -0.108126f, -0.108221f, -0.108316f, -0.108412f, -0.108507f, -0.108602f,
- -0.108697f, -0.108793f, -0.108888f, -0.108983f, -0.109079f, -0.109174f, -0.109269f, -0.109365f,
- -0.109460f, -0.109555f, -0.109650f, -0.109746f, -0.109841f, -0.109936f, -0.110032f, -0.110127f,
- -0.110222f, -0.110317f, -0.110413f, -0.110508f, -0.110603f, -0.110699f, -0.110794f, -0.110889f,
- -0.110984f, -0.111080f, -0.111175f, -0.111270f, -0.111366f, -0.111461f, -0.111556f, -0.111651f,
- -0.111747f, -0.111842f, -0.111937f, -0.112033f, -0.112128f, -0.112223f, -0.112318f, -0.112414f,
- -0.112509f, -0.112604f, -0.112699f, -0.112795f, -0.112890f, -0.112985f, -0.113080f, -0.113176f,
- -0.113271f, -0.113366f, -0.113461f, -0.113557f, -0.113652f, -0.113747f, -0.113842f, -0.113938f,
- -0.114033f, -0.114128f, -0.114223f, -0.114319f, -0.114414f, -0.114509f, -0.114604f, -0.114700f,
- -0.114795f, -0.114890f, -0.114985f, -0.115081f, -0.115176f, -0.115271f, -0.115366f, -0.115462f,
- -0.115557f, -0.115652f, -0.115747f, -0.115842f, -0.115938f, -0.116033f, -0.116128f, -0.116223f,
- -0.116319f, -0.116414f, -0.116509f, -0.116604f, -0.116700f, -0.116795f, -0.116890f, -0.116985f,
- -0.117080f, -0.117176f, -0.117271f, -0.117366f, -0.117461f, -0.117556f, -0.117652f, -0.117747f,
- -0.117842f, -0.117937f, -0.118032f, -0.118128f, -0.118223f, -0.118318f, -0.118413f, -0.118508f,
- -0.118604f, -0.118699f, -0.118794f, -0.118889f, -0.118984f, -0.119080f, -0.119175f, -0.119270f,
- -0.119365f, -0.119460f, -0.119556f, -0.119651f, -0.119746f, -0.119841f, -0.119936f, -0.120032f,
- -0.120127f, -0.120222f, -0.120317f, -0.120412f, -0.120507f, -0.120603f, -0.120698f, -0.120793f,
- -0.120888f, -0.120983f, -0.121078f, -0.121174f, -0.121269f, -0.121364f, -0.121459f, -0.121554f,
- -0.121649f, -0.121745f, -0.121840f, -0.121935f, -0.122030f, -0.122125f, -0.122220f, -0.122316f,
- -0.122411f, -0.122506f, -0.122601f, -0.122696f, -0.122791f, -0.122886f, -0.122982f, -0.123077f,
- -0.123172f, -0.123267f, -0.123362f, -0.123457f, -0.123552f, -0.123648f, -0.123743f, -0.123838f,
- -0.123933f, -0.124028f, -0.124123f, -0.124218f, -0.124314f, -0.124409f, -0.124504f, -0.124599f,
- -0.124694f, -0.124789f, -0.124884f, -0.124979f, -0.125075f, -0.125170f, -0.125265f, -0.125360f,
- -0.125455f, -0.125550f, -0.125645f, -0.125740f, -0.125835f, -0.125931f, -0.126026f, -0.126121f,
- -0.126216f, -0.126311f, -0.126406f, -0.126501f, -0.126596f, -0.126691f, -0.126787f, -0.126882f,
- -0.126977f, -0.127072f, -0.127167f, -0.127262f, -0.127357f, -0.127452f, -0.127547f, -0.127642f,
- -0.127737f, -0.127833f, -0.127928f, -0.128023f, -0.128118f, -0.128213f, -0.128308f, -0.128403f,
- -0.128498f, -0.128593f, -0.128688f, -0.128783f, -0.128878f, -0.128973f, -0.129069f, -0.129164f,
- -0.129259f, -0.129354f, -0.129449f, -0.129544f, -0.129639f, -0.129734f, -0.129829f, -0.129924f,
- -0.130019f, -0.130114f, -0.130209f, -0.130304f, -0.130399f, -0.130495f, -0.130590f, -0.130685f,
- -0.130780f, -0.130875f, -0.130970f, -0.131065f, -0.131160f, -0.131255f, -0.131350f, -0.131445f,
- -0.131540f, -0.131635f, -0.131730f, -0.131825f, -0.131920f, -0.132015f, -0.132110f, -0.132205f,
- -0.132300f, -0.132395f, -0.132490f, -0.132585f, -0.132680f, -0.132775f, -0.132870f, -0.132966f,
- -0.133061f, -0.133156f, -0.133251f, -0.133346f, -0.133441f, -0.133536f, -0.133631f, -0.133726f,
- -0.133821f, -0.133916f, -0.134011f, -0.134106f, -0.134201f, -0.134296f, -0.134391f, -0.134486f,
- -0.134581f, -0.134676f, -0.134771f, -0.134866f, -0.134961f, -0.135056f, -0.135151f, -0.135246f,
- -0.135341f, -0.135436f, -0.135531f, -0.135626f, -0.135721f, -0.135816f, -0.135911f, -0.136006f,
- -0.136101f, -0.136196f, -0.136291f, -0.136386f, -0.136480f, -0.136575f, -0.136670f, -0.136765f,
- -0.136860f, -0.136955f, -0.137050f, -0.137145f, -0.137240f, -0.137335f, -0.137430f, -0.137525f,
- -0.137620f, -0.137715f, -0.137810f, -0.137905f, -0.138000f, -0.138095f, -0.138190f, -0.138285f,
- -0.138380f, -0.138475f, -0.138570f, -0.138665f, -0.138760f, -0.138855f, -0.138949f, -0.139044f,
- -0.139139f, -0.139234f, -0.139329f, -0.139424f, -0.139519f, -0.139614f, -0.139709f, -0.139804f,
- -0.139899f, -0.139994f, -0.140089f, -0.140184f, -0.140279f, -0.140373f, -0.140468f, -0.140563f,
- -0.140658f, -0.140753f, -0.140848f, -0.140943f, -0.141038f, -0.141133f, -0.141228f, -0.141323f,
- -0.141418f, -0.141512f, -0.141607f, -0.141702f, -0.141797f, -0.141892f, -0.141987f, -0.142082f,
- -0.142177f, -0.142272f, -0.142367f, -0.142461f, -0.142556f, -0.142651f, -0.142746f, -0.142841f,
- -0.142936f, -0.143031f, -0.143126f, -0.143221f, -0.143316f, -0.143410f, -0.143505f, -0.143600f,
- -0.143695f, -0.143790f, -0.143885f, -0.143980f, -0.144075f, -0.144169f, -0.144264f, -0.144359f,
- -0.144454f, -0.144549f, -0.144644f, -0.144739f, -0.144833f, -0.144928f, -0.145023f, -0.145118f,
- -0.145213f, -0.145308f, -0.145403f, -0.145497f, -0.145592f, -0.145687f, -0.145782f, -0.145877f,
- -0.145972f, -0.146067f, -0.146161f, -0.146256f, -0.146351f, -0.146446f, -0.146541f, -0.146636f,
- -0.146730f, -0.146825f, -0.146920f, -0.147015f, -0.147110f, -0.147205f, -0.147299f, -0.147394f,
- -0.147489f, -0.147584f, -0.147679f, -0.147774f, -0.147868f, -0.147963f, -0.148058f, -0.148153f,
- -0.148248f, -0.148342f, -0.148437f, -0.148532f, -0.148627f, -0.148722f, -0.148817f, -0.148911f,
- -0.149006f, -0.149101f, -0.149196f, -0.149291f, -0.149385f, -0.149480f, -0.149575f, -0.149670f,
- -0.149765f, -0.149859f, -0.149954f, -0.150049f, -0.150144f, -0.150238f, -0.150333f, -0.150428f,
- -0.150523f, -0.150618f, -0.150712f, -0.150807f, -0.150902f, -0.150997f, -0.151092f, -0.151186f,
- -0.151281f, -0.151376f, -0.151471f, -0.151565f, -0.151660f, -0.151755f, -0.151850f, -0.151944f,
- -0.152039f, -0.152134f, -0.152229f, -0.152323f, -0.152418f, -0.152513f, -0.152608f, -0.152702f,
- -0.152797f, -0.152892f, -0.152987f, -0.153081f, -0.153176f, -0.153271f, -0.153366f, -0.153460f,
- -0.153555f, -0.153650f, -0.153745f, -0.153839f, -0.153934f, -0.154029f, -0.154124f, -0.154218f,
- -0.154313f, -0.154408f, -0.154502f, -0.154597f, -0.154692f, -0.154787f, -0.154881f, -0.154976f,
- -0.155071f, -0.155165f, -0.155260f, -0.155355f, -0.155450f, -0.155544f, -0.155639f, -0.155734f,
- -0.155828f, -0.155923f, -0.156018f, -0.156112f, -0.156207f, -0.156302f, -0.156397f, -0.156491f,
- -0.156586f, -0.156681f, -0.156775f, -0.156870f, -0.156965f, -0.157059f, -0.157154f, -0.157249f,
- -0.157343f, -0.157438f, -0.157533f, -0.157627f, -0.157722f, -0.157817f, -0.157912f, -0.158006f,
- -0.158101f, -0.158196f, -0.158290f, -0.158385f, -0.158480f, -0.158574f, -0.158669f, -0.158763f,
- -0.158858f, -0.158953f, -0.159047f, -0.159142f, -0.159237f, -0.159331f, -0.159426f, -0.159521f,
- -0.159615f, -0.159710f, -0.159805f, -0.159899f, -0.159994f, -0.160089f, -0.160183f, -0.160278f,
- -0.160372f, -0.160467f, -0.160562f, -0.160656f, -0.160751f, -0.160846f, -0.160940f, -0.161035f,
- -0.161129f, -0.161224f, -0.161319f, -0.161413f, -0.161508f, -0.161603f, -0.161697f, -0.161792f,
- -0.161886f, -0.161981f, -0.162076f, -0.162170f, -0.162265f, -0.162359f, -0.162454f, -0.162549f,
- -0.162643f, -0.162738f, -0.162832f, -0.162927f, -0.163022f, -0.163116f, -0.163211f, -0.163305f,
- -0.163400f, -0.163495f, -0.163589f, -0.163684f, -0.163778f, -0.163873f, -0.163967f, -0.164062f,
- -0.164157f, -0.164251f, -0.164346f, -0.164440f, -0.164535f, -0.164629f, -0.164724f, -0.164819f,
- -0.164913f, -0.165008f, -0.165102f, -0.165197f, -0.165291f, -0.165386f, -0.165480f, -0.165575f,
- -0.165670f, -0.165764f, -0.165859f, -0.165953f, -0.166048f, -0.166142f, -0.166237f, -0.166331f,
- -0.166426f, -0.166520f, -0.166615f, -0.166710f, -0.166804f, -0.166899f, -0.166993f, -0.167088f,
- -0.167182f, -0.167277f, -0.167371f, -0.167466f, -0.167560f, -0.167655f, -0.167749f, -0.167844f,
- -0.167938f, -0.168033f, -0.168127f, -0.168222f, -0.168316f, -0.168411f, -0.168505f, -0.168600f,
- -0.168694f, -0.168789f, -0.168883f, -0.168978f, -0.169072f, -0.169167f, -0.169261f, -0.169356f,
- -0.169450f, -0.169545f, -0.169639f, -0.169734f, -0.169828f, -0.169923f, -0.170017f, -0.170112f,
- -0.170206f, -0.170301f, -0.170395f, -0.170490f, -0.170584f, -0.170678f, -0.170773f, -0.170867f,
- -0.170962f, -0.171056f, -0.171151f, -0.171245f, -0.171340f, -0.171434f, -0.171529f, -0.171623f,
- -0.171718f, -0.171812f, -0.171906f, -0.172001f, -0.172095f, -0.172190f, -0.172284f, -0.172379f,
- -0.172473f, -0.172568f, -0.172662f, -0.172756f, -0.172851f, -0.172945f, -0.173040f, -0.173134f,
- -0.173229f, -0.173323f, -0.173417f, -0.173512f, -0.173606f, -0.173701f, -0.173795f, -0.173889f,
- -0.173984f, -0.174078f, -0.174173f, -0.174267f, -0.174362f, -0.174456f, -0.174550f, -0.174645f,
- -0.174739f, -0.174834f, -0.174928f, -0.175022f, -0.175117f, -0.175211f, -0.175305f, -0.175400f,
- -0.175494f, -0.175589f, -0.175683f, -0.175777f, -0.175872f, -0.175966f, -0.176061f, -0.176155f,
- -0.176249f, -0.176344f, -0.176438f, -0.176532f, -0.176627f, -0.176721f, -0.176815f, -0.176910f,
- -0.177004f, -0.177099f, -0.177193f, -0.177287f, -0.177382f, -0.177476f, -0.177570f, -0.177665f,
- -0.177759f, -0.177853f, -0.177948f, -0.178042f, -0.178136f, -0.178231f, -0.178325f, -0.178419f,
- -0.178514f, -0.178608f, -0.178702f, -0.178797f, -0.178891f, -0.178985f, -0.179080f, -0.179174f,
- -0.179268f, -0.179363f, -0.179457f, -0.179551f, -0.179646f, -0.179740f, -0.179834f, -0.179929f,
- -0.180023f, -0.180117f, -0.180212f, -0.180306f, -0.180400f, -0.180494f, -0.180589f, -0.180683f,
- -0.180777f, -0.180872f, -0.180966f, -0.181060f, -0.181154f, -0.181249f, -0.181343f, -0.181437f,
- -0.181532f, -0.181626f, -0.181720f, -0.181814f, -0.181909f, -0.182003f, -0.182097f, -0.182192f,
- -0.182286f, -0.182380f, -0.182474f, -0.182569f, -0.182663f, -0.182757f, -0.182851f, -0.182946f,
- -0.183040f, -0.183134f, -0.183228f, -0.183323f, -0.183417f, -0.183511f, -0.183605f, -0.183700f,
- -0.183794f, -0.183888f, -0.183982f, -0.184077f, -0.184171f, -0.184265f, -0.184359f, -0.184454f,
- -0.184548f, -0.184642f, -0.184736f, -0.184830f, -0.184925f, -0.185019f, -0.185113f, -0.185207f,
- -0.185301f, -0.185396f, -0.185490f, -0.185584f, -0.185678f, -0.185773f, -0.185867f, -0.185961f,
- -0.186055f, -0.186149f, -0.186244f, -0.186338f, -0.186432f, -0.186526f, -0.186620f, -0.186715f,
- -0.186809f, -0.186903f, -0.186997f, -0.187091f, -0.187185f, -0.187280f, -0.187374f, -0.187468f,
- -0.187562f, -0.187656f, -0.187750f, -0.187845f, -0.187939f, -0.188033f, -0.188127f, -0.188221f,
- -0.188315f, -0.188410f, -0.188504f, -0.188598f, -0.188692f, -0.188786f, -0.188880f, -0.188975f,
- -0.189069f, -0.189163f, -0.189257f, -0.189351f, -0.189445f, -0.189539f, -0.189634f, -0.189728f,
- -0.189822f, -0.189916f, -0.190010f, -0.190104f, -0.190198f, -0.190292f, -0.190387f, -0.190481f,
- -0.190575f, -0.190669f, -0.190763f, -0.190857f, -0.190951f, -0.191045f, -0.191139f, -0.191234f,
- -0.191328f, -0.191422f, -0.191516f, -0.191610f, -0.191704f, -0.191798f, -0.191892f, -0.191986f,
- -0.192080f, -0.192174f, -0.192269f, -0.192363f, -0.192457f, -0.192551f, -0.192645f, -0.192739f,
- -0.192833f, -0.192927f, -0.193021f, -0.193115f, -0.193209f, -0.193303f, -0.193397f, -0.193492f,
- -0.193586f, -0.193680f, -0.193774f, -0.193868f, -0.193962f, -0.194056f, -0.194150f, -0.194244f,
- -0.194338f, -0.194432f, -0.194526f, -0.194620f, -0.194714f, -0.194808f, -0.194902f, -0.194996f,
- -0.195090f, -0.195184f, -0.195278f, -0.195372f, -0.195466f, -0.195560f, -0.195654f, -0.195748f,
- -0.195843f, -0.195937f, -0.196031f, -0.196125f, -0.196219f, -0.196313f, -0.196407f, -0.196501f,
- -0.196595f, -0.196689f, -0.196783f, -0.196877f, -0.196971f, -0.197065f, -0.197159f, -0.197253f,
- -0.197347f, -0.197441f, -0.197535f, -0.197629f, -0.197722f, -0.197816f, -0.197910f, -0.198004f,
- -0.198098f, -0.198192f, -0.198286f, -0.198380f, -0.198474f, -0.198568f, -0.198662f, -0.198756f,
- -0.198850f, -0.198944f, -0.199038f, -0.199132f, -0.199226f, -0.199320f, -0.199414f, -0.199508f,
- -0.199602f, -0.199696f, -0.199790f, -0.199884f, -0.199978f, -0.200071f, -0.200165f, -0.200259f,
- -0.200353f, -0.200447f, -0.200541f, -0.200635f, -0.200729f, -0.200823f, -0.200917f, -0.201011f,
- -0.201105f, -0.201199f, -0.201292f, -0.201386f, -0.201480f, -0.201574f, -0.201668f, -0.201762f,
- -0.201856f, -0.201950f, -0.202044f, -0.202138f, -0.202231f, -0.202325f, -0.202419f, -0.202513f,
- -0.202607f, -0.202701f, -0.202795f, -0.202889f, -0.202983f, -0.203076f, -0.203170f, -0.203264f,
- -0.203358f, -0.203452f, -0.203546f, -0.203640f, -0.203734f, -0.203827f, -0.203921f, -0.204015f,
- -0.204109f, -0.204203f, -0.204297f, -0.204391f, -0.204484f, -0.204578f, -0.204672f, -0.204766f,
- -0.204860f, -0.204954f, -0.205047f, -0.205141f, -0.205235f, -0.205329f, -0.205423f, -0.205517f,
- -0.205610f, -0.205704f, -0.205798f, -0.205892f, -0.205986f, -0.206080f, -0.206173f, -0.206267f,
- -0.206361f, -0.206455f, -0.206549f, -0.206642f, -0.206736f, -0.206830f, -0.206924f, -0.207018f,
- -0.207111f, -0.207205f, -0.207299f, -0.207393f, -0.207487f, -0.207580f, -0.207674f, -0.207768f,
- -0.207862f, -0.207955f, -0.208049f, -0.208143f, -0.208237f, -0.208331f, -0.208424f, -0.208518f,
- -0.208612f, -0.208706f, -0.208799f, -0.208893f, -0.208987f, -0.209081f, -0.209174f, -0.209268f,
- -0.209362f, -0.209456f, -0.209549f, -0.209643f, -0.209737f, -0.209831f, -0.209924f, -0.210018f,
- -0.210112f, -0.210206f, -0.210299f, -0.210393f, -0.210487f, -0.210580f, -0.210674f, -0.210768f,
- -0.210862f, -0.210955f, -0.211049f, -0.211143f, -0.211237f, -0.211330f, -0.211424f, -0.211518f,
- -0.211611f, -0.211705f, -0.211799f, -0.211892f, -0.211986f, -0.212080f, -0.212174f, -0.212267f,
- -0.212361f, -0.212455f, -0.212548f, -0.212642f, -0.212736f, -0.212829f, -0.212923f, -0.213017f,
- -0.213110f, -0.213204f, -0.213298f, -0.213391f, -0.213485f, -0.213579f, -0.213672f, -0.213766f,
- -0.213860f, -0.213953f, -0.214047f, -0.214141f, -0.214234f, -0.214328f, -0.214422f, -0.214515f,
- -0.214609f, -0.214702f, -0.214796f, -0.214890f, -0.214983f, -0.215077f, -0.215171f, -0.215264f,
- -0.215358f, -0.215451f, -0.215545f, -0.215639f, -0.215732f, -0.215826f, -0.215920f, -0.216013f,
- -0.216107f, -0.216200f, -0.216294f, -0.216388f, -0.216481f, -0.216575f, -0.216668f, -0.216762f,
- -0.216856f, -0.216949f, -0.217043f, -0.217136f, -0.217230f, -0.217324f, -0.217417f, -0.217511f,
- -0.217604f, -0.217698f, -0.217791f, -0.217885f, -0.217979f, -0.218072f, -0.218166f, -0.218259f,
- -0.218353f, -0.218446f, -0.218540f, -0.218633f, -0.218727f, -0.218821f, -0.218914f, -0.219008f,
- -0.219101f, -0.219195f, -0.219288f, -0.219382f, -0.219475f, -0.219569f, -0.219662f, -0.219756f,
- -0.219850f, -0.219943f, -0.220037f, -0.220130f, -0.220224f, -0.220317f, -0.220411f, -0.220504f,
- -0.220598f, -0.220691f, -0.220785f, -0.220878f, -0.220972f, -0.221065f, -0.221159f, -0.221252f,
- -0.221346f, -0.221439f, -0.221533f, -0.221626f, -0.221720f, -0.221813f, -0.221907f, -0.222000f,
- -0.222094f, -0.222187f, -0.222281f, -0.222374f, -0.222468f, -0.222561f, -0.222654f, -0.222748f,
- -0.222841f, -0.222935f, -0.223028f, -0.223122f, -0.223215f, -0.223309f, -0.223402f, -0.223496f,
- -0.223589f, -0.223682f, -0.223776f, -0.223869f, -0.223963f, -0.224056f, -0.224150f, -0.224243f,
- -0.224337f, -0.224430f, -0.224523f, -0.224617f, -0.224710f, -0.224804f, -0.224897f, -0.224991f,
- -0.225084f, -0.225177f, -0.225271f, -0.225364f, -0.225458f, -0.225551f, -0.225644f, -0.225738f,
- -0.225831f, -0.225925f, -0.226018f, -0.226111f, -0.226205f, -0.226298f, -0.226391f, -0.226485f,
- -0.226578f, -0.226672f, -0.226765f, -0.226858f, -0.226952f, -0.227045f, -0.227139f, -0.227232f,
- -0.227325f, -0.227419f, -0.227512f, -0.227605f, -0.227699f, -0.227792f, -0.227885f, -0.227979f,
- -0.228072f, -0.228165f, -0.228259f, -0.228352f, -0.228445f, -0.228539f, -0.228632f, -0.228725f,
- -0.228819f, -0.228912f, -0.229005f, -0.229099f, -0.229192f, -0.229285f, -0.229379f, -0.229472f,
- -0.229565f, -0.229659f, -0.229752f, -0.229845f, -0.229939f, -0.230032f, -0.230125f, -0.230218f,
- -0.230312f, -0.230405f, -0.230498f, -0.230592f, -0.230685f, -0.230778f, -0.230872f, -0.230965f,
- -0.231058f, -0.231151f, -0.231245f, -0.231338f, -0.231431f, -0.231524f, -0.231618f, -0.231711f,
- -0.231804f, -0.231898f, -0.231991f, -0.232084f, -0.232177f, -0.232271f, -0.232364f, -0.232457f,
- -0.232550f, -0.232644f, -0.232737f, -0.232830f, -0.232923f, -0.233017f, -0.233110f, -0.233203f,
- -0.233296f, -0.233389f, -0.233483f, -0.233576f, -0.233669f, -0.233762f, -0.233856f, -0.233949f,
- -0.234042f, -0.234135f, -0.234228f, -0.234322f, -0.234415f, -0.234508f, -0.234601f, -0.234694f,
- -0.234788f, -0.234881f, -0.234974f, -0.235067f, -0.235160f, -0.235254f, -0.235347f, -0.235440f,
- -0.235533f, -0.235626f, -0.235719f, -0.235813f, -0.235906f, -0.235999f, -0.236092f, -0.236185f,
- -0.236278f, -0.236372f, -0.236465f, -0.236558f, -0.236651f, -0.236744f, -0.236837f, -0.236930f,
- -0.237024f, -0.237117f, -0.237210f, -0.237303f, -0.237396f, -0.237489f, -0.237582f, -0.237676f,
- -0.237769f, -0.237862f, -0.237955f, -0.238048f, -0.238141f, -0.238234f, -0.238327f, -0.238420f,
- -0.238514f, -0.238607f, -0.238700f, -0.238793f, -0.238886f, -0.238979f, -0.239072f, -0.239165f,
- -0.239258f, -0.239351f, -0.239445f, -0.239538f, -0.239631f, -0.239724f, -0.239817f, -0.239910f,
- -0.240003f, -0.240096f, -0.240189f, -0.240282f, -0.240375f, -0.240468f, -0.240561f, -0.240654f,
- -0.240748f, -0.240841f, -0.240934f, -0.241027f, -0.241120f, -0.241213f, -0.241306f, -0.241399f,
- -0.241492f, -0.241585f, -0.241678f, -0.241771f, -0.241864f, -0.241957f, -0.242050f, -0.242143f,
- -0.242236f, -0.242329f, -0.242422f, -0.242515f, -0.242608f, -0.242701f, -0.242794f, -0.242887f,
- -0.242980f, -0.243073f, -0.243166f, -0.243259f, -0.243352f, -0.243445f, -0.243538f, -0.243631f,
- -0.243724f, -0.243817f, -0.243910f, -0.244003f, -0.244096f, -0.244189f, -0.244282f, -0.244375f,
- -0.244468f, -0.244561f, -0.244654f, -0.244747f, -0.244840f, -0.244933f, -0.245026f, -0.245119f,
- -0.245212f, -0.245304f, -0.245397f, -0.245490f, -0.245583f, -0.245676f, -0.245769f, -0.245862f,
- -0.245955f, -0.246048f, -0.246141f, -0.246234f, -0.246327f, -0.246420f, -0.246513f, -0.246606f,
- -0.246698f, -0.246791f, -0.246884f, -0.246977f, -0.247070f, -0.247163f, -0.247256f, -0.247349f,
- -0.247442f, -0.247535f, -0.247627f, -0.247720f, -0.247813f, -0.247906f, -0.247999f, -0.248092f,
- -0.248185f, -0.248278f, -0.248370f, -0.248463f, -0.248556f, -0.248649f, -0.248742f, -0.248835f,
- -0.248928f, -0.249020f, -0.249113f, -0.249206f, -0.249299f, -0.249392f, -0.249485f, -0.249578f,
- -0.249670f, -0.249763f, -0.249856f, -0.249949f, -0.250042f, -0.250135f, -0.250227f, -0.250320f,
- -0.250413f, -0.250506f, -0.250599f, -0.250691f, -0.250784f, -0.250877f, -0.250970f, -0.251063f,
- -0.251155f, -0.251248f, -0.251341f, -0.251434f, -0.251527f, -0.251619f, -0.251712f, -0.251805f,
- -0.251898f, -0.251991f, -0.252083f, -0.252176f, -0.252269f, -0.252362f, -0.252454f, -0.252547f,
- -0.252640f, -0.252733f, -0.252826f, -0.252918f, -0.253011f, -0.253104f, -0.253197f, -0.253289f,
- -0.253382f, -0.253475f, -0.253568f, -0.253660f, -0.253753f, -0.253846f, -0.253938f, -0.254031f,
- -0.254124f, -0.254217f, -0.254309f, -0.254402f, -0.254495f, -0.254588f, -0.254680f, -0.254773f,
- -0.254866f, -0.254958f, -0.255051f, -0.255144f, -0.255236f, -0.255329f, -0.255422f, -0.255515f,
- -0.255607f, -0.255700f, -0.255793f, -0.255885f, -0.255978f, -0.256071f, -0.256163f, -0.256256f,
- -0.256349f, -0.256441f, -0.256534f, -0.256627f, -0.256719f, -0.256812f, -0.256905f, -0.256997f,
- -0.257090f, -0.257183f, -0.257275f, -0.257368f, -0.257461f, -0.257553f, -0.257646f, -0.257738f,
- -0.257831f, -0.257924f, -0.258016f, -0.258109f, -0.258202f, -0.258294f, -0.258387f, -0.258479f,
- -0.258572f, -0.258665f, -0.258757f, -0.258850f, -0.258943f, -0.259035f, -0.259128f, -0.259220f,
- -0.259313f, -0.259405f, -0.259498f, -0.259591f, -0.259683f, -0.259776f, -0.259868f, -0.259961f,
- -0.260054f, -0.260146f, -0.260239f, -0.260331f, -0.260424f, -0.260516f, -0.260609f, -0.260702f,
- -0.260794f, -0.260887f, -0.260979f, -0.261072f, -0.261164f, -0.261257f, -0.261349f, -0.261442f,
- -0.261534f, -0.261627f, -0.261720f, -0.261812f, -0.261905f, -0.261997f, -0.262090f, -0.262182f,
- -0.262275f, -0.262367f, -0.262460f, -0.262552f, -0.262645f, -0.262737f, -0.262830f, -0.262922f,
- -0.263015f, -0.263107f, -0.263200f, -0.263292f, -0.263385f, -0.263477f, -0.263570f, -0.263662f,
- -0.263755f, -0.263847f, -0.263940f, -0.264032f, -0.264125f, -0.264217f, -0.264309f, -0.264402f,
- -0.264494f, -0.264587f, -0.264679f, -0.264772f, -0.264864f, -0.264957f, -0.265049f, -0.265142f,
- -0.265234f, -0.265326f, -0.265419f, -0.265511f, -0.265604f, -0.265696f, -0.265789f, -0.265881f,
- -0.265973f, -0.266066f, -0.266158f, -0.266251f, -0.266343f, -0.266436f, -0.266528f, -0.266620f,
- -0.266713f, -0.266805f, -0.266898f, -0.266990f, -0.267082f, -0.267175f, -0.267267f, -0.267359f,
- -0.267452f, -0.267544f, -0.267637f, -0.267729f, -0.267821f, -0.267914f, -0.268006f, -0.268099f,
- -0.268191f, -0.268283f, -0.268376f, -0.268468f, -0.268560f, -0.268653f, -0.268745f, -0.268837f,
- -0.268930f, -0.269022f, -0.269114f, -0.269207f, -0.269299f, -0.269391f, -0.269484f, -0.269576f,
- -0.269668f, -0.269761f, -0.269853f, -0.269945f, -0.270038f, -0.270130f, -0.270222f, -0.270315f,
- -0.270407f, -0.270499f, -0.270591f, -0.270684f, -0.270776f, -0.270868f, -0.270961f, -0.271053f,
- -0.271145f, -0.271237f, -0.271330f, -0.271422f, -0.271514f, -0.271607f, -0.271699f, -0.271791f,
- -0.271883f, -0.271976f, -0.272068f, -0.272160f, -0.272252f, -0.272345f, -0.272437f, -0.272529f,
- -0.272621f, -0.272714f, -0.272806f, -0.272898f, -0.272990f, -0.273083f, -0.273175f, -0.273267f,
- -0.273359f, -0.273451f, -0.273544f, -0.273636f, -0.273728f, -0.273820f, -0.273912f, -0.274005f,
- -0.274097f, -0.274189f, -0.274281f, -0.274374f, -0.274466f, -0.274558f, -0.274650f, -0.274742f,
- -0.274834f, -0.274927f, -0.275019f, -0.275111f, -0.275203f, -0.275295f, -0.275387f, -0.275480f,
- -0.275572f, -0.275664f, -0.275756f, -0.275848f, -0.275940f, -0.276033f, -0.276125f, -0.276217f,
- -0.276309f, -0.276401f, -0.276493f, -0.276585f, -0.276678f, -0.276770f, -0.276862f, -0.276954f,
- -0.277046f, -0.277138f, -0.277230f, -0.277322f, -0.277415f, -0.277507f, -0.277599f, -0.277691f,
- -0.277783f, -0.277875f, -0.277967f, -0.278059f, -0.278151f, -0.278243f, -0.278336f, -0.278428f,
- -0.278520f, -0.278612f, -0.278704f, -0.278796f, -0.278888f, -0.278980f, -0.279072f, -0.279164f,
- -0.279256f, -0.279348f, -0.279440f, -0.279532f, -0.279624f, -0.279717f, -0.279809f, -0.279901f,
- -0.279993f, -0.280085f, -0.280177f, -0.280269f, -0.280361f, -0.280453f, -0.280545f, -0.280637f,
- -0.280729f, -0.280821f, -0.280913f, -0.281005f, -0.281097f, -0.281189f, -0.281281f, -0.281373f,
- -0.281465f, -0.281557f, -0.281649f, -0.281741f, -0.281833f, -0.281925f, -0.282017f, -0.282109f,
- -0.282201f, -0.282293f, -0.282385f, -0.282477f, -0.282569f, -0.282661f, -0.282753f, -0.282845f,
- -0.282937f, -0.283029f, -0.283120f, -0.283212f, -0.283304f, -0.283396f, -0.283488f, -0.283580f,
- -0.283672f, -0.283764f, -0.283856f, -0.283948f, -0.284040f, -0.284132f, -0.284224f, -0.284316f,
- -0.284408f, -0.284499f, -0.284591f, -0.284683f, -0.284775f, -0.284867f, -0.284959f, -0.285051f,
- -0.285143f, -0.285235f, -0.285327f, -0.285418f, -0.285510f, -0.285602f, -0.285694f, -0.285786f,
- -0.285878f, -0.285970f, -0.286062f, -0.286153f, -0.286245f, -0.286337f, -0.286429f, -0.286521f,
- -0.286613f, -0.286705f, -0.286796f, -0.286888f, -0.286980f, -0.287072f, -0.287164f, -0.287256f,
- -0.287347f, -0.287439f, -0.287531f, -0.287623f, -0.287715f, -0.287807f, -0.287898f, -0.287990f,
- -0.288082f, -0.288174f, -0.288266f, -0.288357f, -0.288449f, -0.288541f, -0.288633f, -0.288725f,
- -0.288816f, -0.288908f, -0.289000f, -0.289092f, -0.289184f, -0.289275f, -0.289367f, -0.289459f,
- -0.289551f, -0.289642f, -0.289734f, -0.289826f, -0.289918f, -0.290009f, -0.290101f, -0.290193f,
- -0.290285f, -0.290376f, -0.290468f, -0.290560f, -0.290652f, -0.290743f, -0.290835f, -0.290927f,
- -0.291019f, -0.291110f, -0.291202f, -0.291294f, -0.291385f, -0.291477f, -0.291569f, -0.291661f,
- -0.291752f, -0.291844f, -0.291936f, -0.292027f, -0.292119f, -0.292211f, -0.292302f, -0.292394f,
- -0.292486f, -0.292577f, -0.292669f, -0.292761f, -0.292852f, -0.292944f, -0.293036f, -0.293128f,
- -0.293219f, -0.293311f, -0.293402f, -0.293494f, -0.293586f, -0.293677f, -0.293769f, -0.293861f,
- -0.293952f, -0.294044f, -0.294136f, -0.294227f, -0.294319f, -0.294410f, -0.294502f, -0.294594f,
- -0.294685f, -0.294777f, -0.294869f, -0.294960f, -0.295052f, -0.295143f, -0.295235f, -0.295327f,
- -0.295418f, -0.295510f, -0.295601f, -0.295693f, -0.295785f, -0.295876f, -0.295968f, -0.296059f,
- -0.296151f, -0.296242f, -0.296334f, -0.296426f, -0.296517f, -0.296609f, -0.296700f, -0.296792f,
- -0.296883f, -0.296975f, -0.297066f, -0.297158f, -0.297250f, -0.297341f, -0.297433f, -0.297524f,
- -0.297616f, -0.297707f, -0.297799f, -0.297890f, -0.297982f, -0.298073f, -0.298165f, -0.298256f,
- -0.298348f, -0.298439f, -0.298531f, -0.298622f, -0.298714f, -0.298805f, -0.298897f, -0.298988f,
- -0.299080f, -0.299171f, -0.299263f, -0.299354f, -0.299446f, -0.299537f, -0.299629f, -0.299720f,
- -0.299812f, -0.299903f, -0.299995f, -0.300086f, -0.300177f, -0.300269f, -0.300360f, -0.300452f,
- -0.300543f, -0.300635f, -0.300726f, -0.300818f, -0.300909f, -0.301000f, -0.301092f, -0.301183f,
- -0.301275f, -0.301366f, -0.301458f, -0.301549f, -0.301640f, -0.301732f, -0.301823f, -0.301915f,
- -0.302006f, -0.302097f, -0.302189f, -0.302280f, -0.302372f, -0.302463f, -0.302554f, -0.302646f,
- -0.302737f, -0.302828f, -0.302920f, -0.303011f, -0.303103f, -0.303194f, -0.303285f, -0.303377f,
- -0.303468f, -0.303559f, -0.303651f, -0.303742f, -0.303833f, -0.303925f, -0.304016f, -0.304107f,
- -0.304199f, -0.304290f, -0.304381f, -0.304473f, -0.304564f, -0.304655f, -0.304747f, -0.304838f,
- -0.304929f, -0.305021f, -0.305112f, -0.305203f, -0.305294f, -0.305386f, -0.305477f, -0.305568f,
- -0.305660f, -0.305751f, -0.305842f, -0.305933f, -0.306025f, -0.306116f, -0.306207f, -0.306299f,
- -0.306390f, -0.306481f, -0.306572f, -0.306664f, -0.306755f, -0.306846f, -0.306937f, -0.307029f,
- -0.307120f, -0.307211f, -0.307302f, -0.307394f, -0.307485f, -0.307576f, -0.307667f, -0.307758f,
- -0.307850f, -0.307941f, -0.308032f, -0.308123f, -0.308214f, -0.308306f, -0.308397f, -0.308488f,
- -0.308579f, -0.308670f, -0.308762f, -0.308853f, -0.308944f, -0.309035f, -0.309126f, -0.309218f,
- -0.309309f, -0.309400f, -0.309491f, -0.309582f, -0.309673f, -0.309765f, -0.309856f, -0.309947f,
- -0.310038f, -0.310129f, -0.310220f, -0.310311f, -0.310403f, -0.310494f, -0.310585f, -0.310676f,
- -0.310767f, -0.310858f, -0.310949f, -0.311041f, -0.311132f, -0.311223f, -0.311314f, -0.311405f,
- -0.311496f, -0.311587f, -0.311678f, -0.311769f, -0.311860f, -0.311952f, -0.312043f, -0.312134f,
- -0.312225f, -0.312316f, -0.312407f, -0.312498f, -0.312589f, -0.312680f, -0.312771f, -0.312862f,
- -0.312953f, -0.313044f, -0.313135f, -0.313227f, -0.313318f, -0.313409f, -0.313500f, -0.313591f,
- -0.313682f, -0.313773f, -0.313864f, -0.313955f, -0.314046f, -0.314137f, -0.314228f, -0.314319f,
- -0.314410f, -0.314501f, -0.314592f, -0.314683f, -0.314774f, -0.314865f, -0.314956f, -0.315047f,
- -0.315138f, -0.315229f, -0.315320f, -0.315411f, -0.315502f, -0.315593f, -0.315684f, -0.315775f,
- -0.315866f, -0.315957f, -0.316048f, -0.316139f, -0.316230f, -0.316321f, -0.316411f, -0.316502f,
- -0.316593f, -0.316684f, -0.316775f, -0.316866f, -0.316957f, -0.317048f, -0.317139f, -0.317230f,
- -0.317321f, -0.317412f, -0.317503f, -0.317594f, -0.317684f, -0.317775f, -0.317866f, -0.317957f,
- -0.318048f, -0.318139f, -0.318230f, -0.318321f, -0.318412f, -0.318503f, -0.318593f, -0.318684f,
- -0.318775f, -0.318866f, -0.318957f, -0.319048f, -0.319139f, -0.319229f, -0.319320f, -0.319411f,
- -0.319502f, -0.319593f, -0.319684f, -0.319775f, -0.319865f, -0.319956f, -0.320047f, -0.320138f,
- -0.320229f, -0.320320f, -0.320410f, -0.320501f, -0.320592f, -0.320683f, -0.320774f, -0.320864f,
- -0.320955f, -0.321046f, -0.321137f, -0.321228f, -0.321318f, -0.321409f, -0.321500f, -0.321591f,
- -0.321682f, -0.321772f, -0.321863f, -0.321954f, -0.322045f, -0.322135f, -0.322226f, -0.322317f,
- -0.322408f, -0.322498f, -0.322589f, -0.322680f, -0.322771f, -0.322861f, -0.322952f, -0.323043f,
- -0.323134f, -0.323224f, -0.323315f, -0.323406f, -0.323497f, -0.323587f, -0.323678f, -0.323769f,
- -0.323859f, -0.323950f, -0.324041f, -0.324131f, -0.324222f, -0.324313f, -0.324404f, -0.324494f,
- -0.324585f, -0.324676f, -0.324766f, -0.324857f, -0.324948f, -0.325038f, -0.325129f, -0.325220f,
- -0.325310f, -0.325401f, -0.325492f, -0.325582f, -0.325673f, -0.325764f, -0.325854f, -0.325945f,
- -0.326035f, -0.326126f, -0.326217f, -0.326307f, -0.326398f, -0.326489f, -0.326579f, -0.326670f,
- -0.326760f, -0.326851f, -0.326942f, -0.327032f, -0.327123f, -0.327213f, -0.327304f, -0.327395f,
- -0.327485f, -0.327576f, -0.327666f, -0.327757f, -0.327848f, -0.327938f, -0.328029f, -0.328119f,
- -0.328210f, -0.328300f, -0.328391f, -0.328482f, -0.328572f, -0.328663f, -0.328753f, -0.328844f,
- -0.328934f, -0.329025f, -0.329115f, -0.329206f, -0.329296f, -0.329387f, -0.329477f, -0.329568f,
- -0.329658f, -0.329749f, -0.329839f, -0.329930f, -0.330020f, -0.330111f, -0.330202f, -0.330292f,
- -0.330382f, -0.330473f, -0.330563f, -0.330654f, -0.330744f, -0.330835f, -0.330925f, -0.331016f,
- -0.331106f, -0.331197f, -0.331287f, -0.331378f, -0.331468f, -0.331559f, -0.331649f, -0.331739f,
- -0.331830f, -0.331920f, -0.332011f, -0.332101f, -0.332192f, -0.332282f, -0.332373f, -0.332463f,
- -0.332553f, -0.332644f, -0.332734f, -0.332825f, -0.332915f, -0.333005f, -0.333096f, -0.333186f,
- -0.333277f, -0.333367f, -0.333457f, -0.333548f, -0.333638f, -0.333729f, -0.333819f, -0.333909f,
- -0.334000f, -0.334090f, -0.334180f, -0.334271f, -0.334361f, -0.334451f, -0.334542f, -0.334632f,
- -0.334722f, -0.334813f, -0.334903f, -0.334994f, -0.335084f, -0.335174f, -0.335265f, -0.335355f,
- -0.335445f, -0.335535f, -0.335626f, -0.335716f, -0.335806f, -0.335897f, -0.335987f, -0.336077f,
- -0.336168f, -0.336258f, -0.336348f, -0.336438f, -0.336529f, -0.336619f, -0.336709f, -0.336800f,
- -0.336890f, -0.336980f, -0.337070f, -0.337161f, -0.337251f, -0.337341f, -0.337431f, -0.337522f,
- -0.337612f, -0.337702f, -0.337792f, -0.337883f, -0.337973f, -0.338063f, -0.338153f, -0.338244f,
- -0.338334f, -0.338424f, -0.338514f, -0.338604f, -0.338695f, -0.338785f, -0.338875f, -0.338965f,
- -0.339055f, -0.339146f, -0.339236f, -0.339326f, -0.339416f, -0.339506f, -0.339597f, -0.339687f,
- -0.339777f, -0.339867f, -0.339957f, -0.340047f, -0.340138f, -0.340228f, -0.340318f, -0.340408f,
- -0.340498f, -0.340588f, -0.340678f, -0.340769f, -0.340859f, -0.340949f, -0.341039f, -0.341129f,
- -0.341219f, -0.341309f, -0.341399f, -0.341490f, -0.341580f, -0.341670f, -0.341760f, -0.341850f,
- -0.341940f, -0.342030f, -0.342120f, -0.342210f, -0.342300f, -0.342391f, -0.342481f, -0.342571f,
- -0.342661f, -0.342751f, -0.342841f, -0.342931f, -0.343021f, -0.343111f, -0.343201f, -0.343291f,
- -0.343381f, -0.343471f, -0.343561f, -0.343651f, -0.343741f, -0.343831f, -0.343921f, -0.344011f,
- -0.344101f, -0.344191f, -0.344281f, -0.344371f, -0.344461f, -0.344551f, -0.344641f, -0.344731f,
- -0.344821f, -0.344911f, -0.345001f, -0.345091f, -0.345181f, -0.345271f, -0.345361f, -0.345451f,
- -0.345541f, -0.345631f, -0.345721f, -0.345811f, -0.345901f, -0.345991f, -0.346081f, -0.346171f,
- -0.346261f, -0.346351f, -0.346441f, -0.346531f, -0.346621f, -0.346711f, -0.346801f, -0.346890f,
- -0.346980f, -0.347070f, -0.347160f, -0.347250f, -0.347340f, -0.347430f, -0.347520f, -0.347610f,
- -0.347700f, -0.347790f, -0.347879f, -0.347969f, -0.348059f, -0.348149f, -0.348239f, -0.348329f,
- -0.348419f, -0.348509f, -0.348598f, -0.348688f, -0.348778f, -0.348868f, -0.348958f, -0.349048f,
- -0.349138f, -0.349227f, -0.349317f, -0.349407f, -0.349497f, -0.349587f, -0.349676f, -0.349766f,
- -0.349856f, -0.349946f, -0.350036f, -0.350126f, -0.350215f, -0.350305f, -0.350395f, -0.350485f,
- -0.350575f, -0.350664f, -0.350754f, -0.350844f, -0.350934f, -0.351023f, -0.351113f, -0.351203f,
- -0.351293f, -0.351383f, -0.351472f, -0.351562f, -0.351652f, -0.351742f, -0.351831f, -0.351921f,
- -0.352011f, -0.352100f, -0.352190f, -0.352280f, -0.352370f, -0.352459f, -0.352549f, -0.352639f,
- -0.352729f, -0.352818f, -0.352908f, -0.352998f, -0.353087f, -0.353177f, -0.353267f, -0.353356f,
- -0.353446f, -0.353536f, -0.353626f, -0.353715f, -0.353805f, -0.353895f, -0.353984f, -0.354074f,
- -0.354164f, -0.354253f, -0.354343f, -0.354432f, -0.354522f, -0.354612f, -0.354701f, -0.354791f,
- -0.354881f, -0.354970f, -0.355060f, -0.355150f, -0.355239f, -0.355329f, -0.355418f, -0.355508f,
- -0.355598f, -0.355687f, -0.355777f, -0.355866f, -0.355956f, -0.356046f, -0.356135f, -0.356225f,
- -0.356314f, -0.356404f, -0.356494f, -0.356583f, -0.356673f, -0.356762f, -0.356852f, -0.356941f,
- -0.357031f, -0.357121f, -0.357210f, -0.357300f, -0.357389f, -0.357479f, -0.357568f, -0.357658f,
- -0.357747f, -0.357837f, -0.357926f, -0.358016f, -0.358105f, -0.358195f, -0.358284f, -0.358374f,
- -0.358463f, -0.358553f, -0.358642f, -0.358732f, -0.358821f, -0.358911f, -0.359000f, -0.359090f,
- -0.359179f, -0.359269f, -0.359358f, -0.359448f, -0.359537f, -0.359627f, -0.359716f, -0.359806f,
- -0.359895f, -0.359984f, -0.360074f, -0.360163f, -0.360253f, -0.360342f, -0.360432f, -0.360521f,
- -0.360611f, -0.360700f, -0.360789f, -0.360879f, -0.360968f, -0.361058f, -0.361147f, -0.361236f,
- -0.361326f, -0.361415f, -0.361505f, -0.361594f, -0.361683f, -0.361773f, -0.361862f, -0.361952f,
- -0.362041f, -0.362130f, -0.362220f, -0.362309f, -0.362398f, -0.362488f, -0.362577f, -0.362666f,
- -0.362756f, -0.362845f, -0.362934f, -0.363024f, -0.363113f, -0.363202f, -0.363292f, -0.363381f,
- -0.363470f, -0.363560f, -0.363649f, -0.363738f, -0.363828f, -0.363917f, -0.364006f, -0.364096f,
- -0.364185f, -0.364274f, -0.364363f, -0.364453f, -0.364542f, -0.364631f, -0.364720f, -0.364810f,
- -0.364899f, -0.364988f, -0.365078f, -0.365167f, -0.365256f, -0.365345f, -0.365435f, -0.365524f,
- -0.365613f, -0.365702f, -0.365791f, -0.365881f, -0.365970f, -0.366059f, -0.366148f, -0.366238f,
- -0.366327f, -0.366416f, -0.366505f, -0.366594f, -0.366684f, -0.366773f, -0.366862f, -0.366951f,
- -0.367040f, -0.367130f, -0.367219f, -0.367308f, -0.367397f, -0.367486f, -0.367575f, -0.367665f,
- -0.367754f, -0.367843f, -0.367932f, -0.368021f, -0.368110f, -0.368199f, -0.368289f, -0.368378f,
- -0.368467f, -0.368556f, -0.368645f, -0.368734f, -0.368823f, -0.368912f, -0.369002f, -0.369091f,
- -0.369180f, -0.369269f, -0.369358f, -0.369447f, -0.369536f, -0.369625f, -0.369714f, -0.369803f,
- -0.369892f, -0.369982f, -0.370071f, -0.370160f, -0.370249f, -0.370338f, -0.370427f, -0.370516f,
- -0.370605f, -0.370694f, -0.370783f, -0.370872f, -0.370961f, -0.371050f, -0.371139f, -0.371228f,
- -0.371317f, -0.371406f, -0.371495f, -0.371584f, -0.371673f, -0.371762f, -0.371851f, -0.371940f,
- -0.372029f, -0.372118f, -0.372207f, -0.372296f, -0.372385f, -0.372474f, -0.372563f, -0.372652f,
- -0.372741f, -0.372830f, -0.372919f, -0.373008f, -0.373097f, -0.373186f, -0.373275f, -0.373364f,
- -0.373453f, -0.373542f, -0.373631f, -0.373719f, -0.373808f, -0.373897f, -0.373986f, -0.374075f,
- -0.374164f, -0.374253f, -0.374342f, -0.374431f, -0.374520f, -0.374609f, -0.374697f, -0.374786f,
- -0.374875f, -0.374964f, -0.375053f, -0.375142f, -0.375231f, -0.375320f, -0.375408f, -0.375497f,
- -0.375586f, -0.375675f, -0.375764f, -0.375853f, -0.375942f, -0.376030f, -0.376119f, -0.376208f,
- -0.376297f, -0.376386f, -0.376475f, -0.376563f, -0.376652f, -0.376741f, -0.376830f, -0.376919f,
- -0.377007f, -0.377096f, -0.377185f, -0.377274f, -0.377363f, -0.377451f, -0.377540f, -0.377629f,
- -0.377718f, -0.377806f, -0.377895f, -0.377984f, -0.378073f, -0.378162f, -0.378250f, -0.378339f,
- -0.378428f, -0.378516f, -0.378605f, -0.378694f, -0.378783f, -0.378871f, -0.378960f, -0.379049f,
- -0.379138f, -0.379226f, -0.379315f, -0.379404f, -0.379492f, -0.379581f, -0.379670f, -0.379759f,
- -0.379847f, -0.379936f, -0.380025f, -0.380113f, -0.380202f, -0.380291f, -0.380379f, -0.380468f,
- -0.380557f, -0.380645f, -0.380734f, -0.380823f, -0.380911f, -0.381000f, -0.381088f, -0.381177f,
- -0.381266f, -0.381354f, -0.381443f, -0.381532f, -0.381620f, -0.381709f, -0.381797f, -0.381886f,
- -0.381975f, -0.382063f, -0.382152f, -0.382241f, -0.382329f, -0.382418f, -0.382506f, -0.382595f,
- -0.382683f, -0.382772f, -0.382861f, -0.382949f, -0.383038f, -0.383126f, -0.383215f, -0.383303f,
- -0.383392f, -0.383480f, -0.383569f, -0.383658f, -0.383746f, -0.383835f, -0.383923f, -0.384012f,
- -0.384100f, -0.384189f, -0.384277f, -0.384366f, -0.384454f, -0.384543f, -0.384631f, -0.384720f,
- -0.384808f, -0.384897f, -0.384985f, -0.385074f, -0.385162f, -0.385251f, -0.385339f, -0.385428f,
- -0.385516f, -0.385605f, -0.385693f, -0.385781f, -0.385870f, -0.385958f, -0.386047f, -0.386135f,
- -0.386224f, -0.386312f, -0.386400f, -0.386489f, -0.386577f, -0.386666f, -0.386754f, -0.386843f,
- -0.386931f, -0.387019f, -0.387108f, -0.387196f, -0.387285f, -0.387373f, -0.387461f, -0.387550f,
- -0.387638f, -0.387727f, -0.387815f, -0.387903f, -0.387992f, -0.388080f, -0.388168f, -0.388257f,
- -0.388345f, -0.388433f, -0.388522f, -0.388610f, -0.388698f, -0.388787f, -0.388875f, -0.388963f,
- -0.389052f, -0.389140f, -0.389228f, -0.389317f, -0.389405f, -0.389493f, -0.389582f, -0.389670f,
- -0.389758f, -0.389846f, -0.389935f, -0.390023f, -0.390111f, -0.390200f, -0.390288f, -0.390376f,
- -0.390464f, -0.390553f, -0.390641f, -0.390729f, -0.390817f, -0.390906f, -0.390994f, -0.391082f,
- -0.391170f, -0.391259f, -0.391347f, -0.391435f, -0.391523f, -0.391612f, -0.391700f, -0.391788f,
- -0.391876f, -0.391964f, -0.392053f, -0.392141f, -0.392229f, -0.392317f, -0.392405f, -0.392493f,
- -0.392582f, -0.392670f, -0.392758f, -0.392846f, -0.392934f, -0.393023f, -0.393111f, -0.393199f,
- -0.393287f, -0.393375f, -0.393463f, -0.393551f, -0.393640f, -0.393728f, -0.393816f, -0.393904f,
- -0.393992f, -0.394080f, -0.394168f, -0.394256f, -0.394344f, -0.394433f, -0.394521f, -0.394609f,
- -0.394697f, -0.394785f, -0.394873f, -0.394961f, -0.395049f, -0.395137f, -0.395225f, -0.395313f,
- -0.395401f, -0.395490f, -0.395578f, -0.395666f, -0.395754f, -0.395842f, -0.395930f, -0.396018f,
- -0.396106f, -0.396194f, -0.396282f, -0.396370f, -0.396458f, -0.396546f, -0.396634f, -0.396722f,
- -0.396810f, -0.396898f, -0.396986f, -0.397074f, -0.397162f, -0.397250f, -0.397338f, -0.397426f,
- -0.397514f, -0.397602f, -0.397690f, -0.397778f, -0.397866f, -0.397954f, -0.398042f, -0.398130f,
- -0.398218f, -0.398306f, -0.398393f, -0.398481f, -0.398569f, -0.398657f, -0.398745f, -0.398833f,
- -0.398921f, -0.399009f, -0.399097f, -0.399185f, -0.399273f, -0.399361f, -0.399448f, -0.399536f,
- -0.399624f, -0.399712f, -0.399800f, -0.399888f, -0.399976f, -0.400064f, -0.400151f, -0.400239f,
- -0.400327f, -0.400415f, -0.400503f, -0.400591f, -0.400679f, -0.400766f, -0.400854f, -0.400942f,
- -0.401030f, -0.401118f, -0.401206f, -0.401293f, -0.401381f, -0.401469f, -0.401557f, -0.401645f,
- -0.401732f, -0.401820f, -0.401908f, -0.401996f, -0.402084f, -0.402171f, -0.402259f, -0.402347f,
- -0.402435f, -0.402522f, -0.402610f, -0.402698f, -0.402786f, -0.402873f, -0.402961f, -0.403049f,
- -0.403137f, -0.403224f, -0.403312f, -0.403400f, -0.403488f, -0.403575f, -0.403663f, -0.403751f,
- -0.403838f, -0.403926f, -0.404014f, -0.404102f, -0.404189f, -0.404277f, -0.404365f, -0.404452f,
- -0.404540f, -0.404628f, -0.404715f, -0.404803f, -0.404891f, -0.404978f, -0.405066f, -0.405154f,
- -0.405241f, -0.405329f, -0.405417f, -0.405504f, -0.405592f, -0.405680f, -0.405767f, -0.405855f,
- -0.405942f, -0.406030f, -0.406118f, -0.406205f, -0.406293f, -0.406380f, -0.406468f, -0.406556f,
- -0.406643f, -0.406731f, -0.406818f, -0.406906f, -0.406994f, -0.407081f, -0.407169f, -0.407256f,
- -0.407344f, -0.407431f, -0.407519f, -0.407606f, -0.407694f, -0.407782f, -0.407869f, -0.407957f,
- -0.408044f, -0.408132f, -0.408219f, -0.408307f, -0.408394f, -0.408482f, -0.408569f, -0.408657f,
- -0.408744f, -0.408832f, -0.408919f, -0.409007f, -0.409094f, -0.409182f, -0.409269f, -0.409357f,
- -0.409444f, -0.409532f, -0.409619f, -0.409707f, -0.409794f, -0.409881f, -0.409969f, -0.410056f,
- -0.410144f, -0.410231f, -0.410319f, -0.410406f, -0.410493f, -0.410581f, -0.410668f, -0.410756f,
- -0.410843f, -0.410931f, -0.411018f, -0.411105f, -0.411193f, -0.411280f, -0.411368f, -0.411455f,
- -0.411542f, -0.411630f, -0.411717f, -0.411804f, -0.411892f, -0.411979f, -0.412067f, -0.412154f,
- -0.412241f, -0.412329f, -0.412416f, -0.412503f, -0.412591f, -0.412678f, -0.412765f, -0.412853f,
- -0.412940f, -0.413027f, -0.413115f, -0.413202f, -0.413289f, -0.413376f, -0.413464f, -0.413551f,
- -0.413638f, -0.413726f, -0.413813f, -0.413900f, -0.413987f, -0.414075f, -0.414162f, -0.414249f,
- -0.414337f, -0.414424f, -0.414511f, -0.414598f, -0.414685f, -0.414773f, -0.414860f, -0.414947f,
- -0.415034f, -0.415122f, -0.415209f, -0.415296f, -0.415383f, -0.415471f, -0.415558f, -0.415645f,
- -0.415732f, -0.415819f, -0.415906f, -0.415994f, -0.416081f, -0.416168f, -0.416255f, -0.416342f,
- -0.416430f, -0.416517f, -0.416604f, -0.416691f, -0.416778f, -0.416865f, -0.416952f, -0.417040f,
- -0.417127f, -0.417214f, -0.417301f, -0.417388f, -0.417475f, -0.417562f, -0.417650f, -0.417737f,
- -0.417824f, -0.417911f, -0.417998f, -0.418085f, -0.418172f, -0.418259f, -0.418346f, -0.418433f,
- -0.418520f, -0.418608f, -0.418695f, -0.418782f, -0.418869f, -0.418956f, -0.419043f, -0.419130f,
- -0.419217f, -0.419304f, -0.419391f, -0.419478f, -0.419565f, -0.419652f, -0.419739f, -0.419826f,
- -0.419913f, -0.420000f, -0.420087f, -0.420174f, -0.420261f, -0.420348f, -0.420435f, -0.420522f,
- -0.420609f, -0.420696f, -0.420783f, -0.420870f, -0.420957f, -0.421044f, -0.421131f, -0.421218f,
- -0.421305f, -0.421392f, -0.421479f, -0.421566f, -0.421653f, -0.421739f, -0.421826f, -0.421913f,
- -0.422000f, -0.422087f, -0.422174f, -0.422261f, -0.422348f, -0.422435f, -0.422522f, -0.422609f,
- -0.422695f, -0.422782f, -0.422869f, -0.422956f, -0.423043f, -0.423130f, -0.423217f, -0.423304f,
- -0.423390f, -0.423477f, -0.423564f, -0.423651f, -0.423738f, -0.423825f, -0.423912f, -0.423998f,
- -0.424085f, -0.424172f, -0.424259f, -0.424346f, -0.424432f, -0.424519f, -0.424606f, -0.424693f,
- -0.424780f, -0.424866f, -0.424953f, -0.425040f, -0.425127f, -0.425214f, -0.425300f, -0.425387f,
- -0.425474f, -0.425561f, -0.425647f, -0.425734f, -0.425821f, -0.425908f, -0.425994f, -0.426081f,
- -0.426168f, -0.426255f, -0.426341f, -0.426428f, -0.426515f, -0.426601f, -0.426688f, -0.426775f,
- -0.426862f, -0.426948f, -0.427035f, -0.427122f, -0.427208f, -0.427295f, -0.427382f, -0.427468f,
- -0.427555f, -0.427642f, -0.427728f, -0.427815f, -0.427902f, -0.427988f, -0.428075f, -0.428162f,
- -0.428248f, -0.428335f, -0.428422f, -0.428508f, -0.428595f, -0.428681f, -0.428768f, -0.428855f,
- -0.428941f, -0.429028f, -0.429114f, -0.429201f, -0.429288f, -0.429374f, -0.429461f, -0.429547f,
- -0.429634f, -0.429721f, -0.429807f, -0.429894f, -0.429980f, -0.430067f, -0.430153f, -0.430240f,
- -0.430326f, -0.430413f, -0.430500f, -0.430586f, -0.430673f, -0.430759f, -0.430846f, -0.430932f,
- -0.431019f, -0.431105f, -0.431192f, -0.431278f, -0.431365f, -0.431451f, -0.431538f, -0.431624f,
- -0.431711f, -0.431797f, -0.431884f, -0.431970f, -0.432057f, -0.432143f, -0.432229f, -0.432316f,
- -0.432402f, -0.432489f, -0.432575f, -0.432662f, -0.432748f, -0.432835f, -0.432921f, -0.433007f,
- -0.433094f, -0.433180f, -0.433267f, -0.433353f, -0.433439f, -0.433526f, -0.433612f, -0.433699f,
- -0.433785f, -0.433871f, -0.433958f, -0.434044f, -0.434131f, -0.434217f, -0.434303f, -0.434390f,
- -0.434476f, -0.434562f, -0.434649f, -0.434735f, -0.434821f, -0.434908f, -0.434994f, -0.435080f,
- -0.435167f, -0.435253f, -0.435339f, -0.435426f, -0.435512f, -0.435598f, -0.435685f, -0.435771f,
- -0.435857f, -0.435943f, -0.436030f, -0.436116f, -0.436202f, -0.436288f, -0.436375f, -0.436461f,
- -0.436547f, -0.436633f, -0.436720f, -0.436806f, -0.436892f, -0.436978f, -0.437065f, -0.437151f,
- -0.437237f, -0.437323f, -0.437410f, -0.437496f, -0.437582f, -0.437668f, -0.437754f, -0.437841f,
- -0.437927f, -0.438013f, -0.438099f, -0.438185f, -0.438272f, -0.438358f, -0.438444f, -0.438530f,
- -0.438616f, -0.438702f, -0.438789f, -0.438875f, -0.438961f, -0.439047f, -0.439133f, -0.439219f,
- -0.439305f, -0.439392f, -0.439478f, -0.439564f, -0.439650f, -0.439736f, -0.439822f, -0.439908f,
- -0.439994f, -0.440080f, -0.440166f, -0.440253f, -0.440339f, -0.440425f, -0.440511f, -0.440597f,
- -0.440683f, -0.440769f, -0.440855f, -0.440941f, -0.441027f, -0.441113f, -0.441199f, -0.441285f,
- -0.441371f, -0.441457f, -0.441543f, -0.441629f, -0.441715f, -0.441801f, -0.441887f, -0.441973f,
- -0.442059f, -0.442145f, -0.442231f, -0.442317f, -0.442403f, -0.442489f, -0.442575f, -0.442661f,
- -0.442747f, -0.442833f, -0.442919f, -0.443005f, -0.443091f, -0.443177f, -0.443263f, -0.443349f,
- -0.443435f, -0.443521f, -0.443607f, -0.443693f, -0.443779f, -0.443864f, -0.443950f, -0.444036f,
- -0.444122f, -0.444208f, -0.444294f, -0.444380f, -0.444466f, -0.444552f, -0.444637f, -0.444723f,
- -0.444809f, -0.444895f, -0.444981f, -0.445067f, -0.445153f, -0.445239f, -0.445324f, -0.445410f,
- -0.445496f, -0.445582f, -0.445668f, -0.445754f, -0.445839f, -0.445925f, -0.446011f, -0.446097f,
- -0.446183f, -0.446268f, -0.446354f, -0.446440f, -0.446526f, -0.446612f, -0.446697f, -0.446783f,
- -0.446869f, -0.446955f, -0.447040f, -0.447126f, -0.447212f, -0.447298f, -0.447383f, -0.447469f,
- -0.447555f, -0.447641f, -0.447726f, -0.447812f, -0.447898f, -0.447983f, -0.448069f, -0.448155f,
- -0.448241f, -0.448326f, -0.448412f, -0.448498f, -0.448583f, -0.448669f, -0.448755f, -0.448840f,
- -0.448926f, -0.449012f, -0.449097f, -0.449183f, -0.449269f, -0.449354f, -0.449440f, -0.449526f,
- -0.449611f, -0.449697f, -0.449783f, -0.449868f, -0.449954f, -0.450039f, -0.450125f, -0.450211f,
- -0.450296f, -0.450382f, -0.450467f, -0.450553f, -0.450639f, -0.450724f, -0.450810f, -0.450895f,
- -0.450981f, -0.451067f, -0.451152f, -0.451238f, -0.451323f, -0.451409f, -0.451494f, -0.451580f,
- -0.451665f, -0.451751f, -0.451836f, -0.451922f, -0.452008f, -0.452093f, -0.452179f, -0.452264f,
- -0.452350f, -0.452435f, -0.452521f, -0.452606f, -0.452692f, -0.452777f, -0.452863f, -0.452948f,
- -0.453033f, -0.453119f, -0.453204f, -0.453290f, -0.453375f, -0.453461f, -0.453546f, -0.453632f,
- -0.453717f, -0.453803f, -0.453888f, -0.453973f, -0.454059f, -0.454144f, -0.454230f, -0.454315f,
- -0.454400f, -0.454486f, -0.454571f, -0.454657f, -0.454742f, -0.454827f, -0.454913f, -0.454998f,
- -0.455084f, -0.455169f, -0.455254f, -0.455340f, -0.455425f, -0.455510f, -0.455596f, -0.455681f,
- -0.455766f, -0.455852f, -0.455937f, -0.456022f, -0.456108f, -0.456193f, -0.456278f, -0.456364f,
- -0.456449f, -0.456534f, -0.456620f, -0.456705f, -0.456790f, -0.456875f, -0.456961f, -0.457046f,
- -0.457131f, -0.457217f, -0.457302f, -0.457387f, -0.457472f, -0.457558f, -0.457643f, -0.457728f,
- -0.457813f, -0.457899f, -0.457984f, -0.458069f, -0.458154f, -0.458239f, -0.458325f, -0.458410f,
- -0.458495f, -0.458580f, -0.458665f, -0.458751f, -0.458836f, -0.458921f, -0.459006f, -0.459091f,
- -0.459177f, -0.459262f, -0.459347f, -0.459432f, -0.459517f, -0.459602f, -0.459687f, -0.459773f,
- -0.459858f, -0.459943f, -0.460028f, -0.460113f, -0.460198f, -0.460283f, -0.460369f, -0.460454f,
- -0.460539f, -0.460624f, -0.460709f, -0.460794f, -0.460879f, -0.460964f, -0.461049f, -0.461134f,
- -0.461219f, -0.461304f, -0.461390f, -0.461475f, -0.461560f, -0.461645f, -0.461730f, -0.461815f,
- -0.461900f, -0.461985f, -0.462070f, -0.462155f, -0.462240f, -0.462325f, -0.462410f, -0.462495f,
- -0.462580f, -0.462665f, -0.462750f, -0.462835f, -0.462920f, -0.463005f, -0.463090f, -0.463175f,
- -0.463260f, -0.463345f, -0.463430f, -0.463515f, -0.463600f, -0.463685f, -0.463769f, -0.463854f,
- -0.463939f, -0.464024f, -0.464109f, -0.464194f, -0.464279f, -0.464364f, -0.464449f, -0.464534f,
- -0.464619f, -0.464704f, -0.464788f, -0.464873f, -0.464958f, -0.465043f, -0.465128f, -0.465213f,
- -0.465298f, -0.465383f, -0.465467f, -0.465552f, -0.465637f, -0.465722f, -0.465807f, -0.465892f,
- -0.465977f, -0.466061f, -0.466146f, -0.466231f, -0.466316f, -0.466401f, -0.466485f, -0.466570f,
- -0.466655f, -0.466740f, -0.466825f, -0.466909f, -0.466994f, -0.467079f, -0.467164f, -0.467248f,
- -0.467333f, -0.467418f, -0.467503f, -0.467587f, -0.467672f, -0.467757f, -0.467842f, -0.467926f,
- -0.468011f, -0.468096f, -0.468181f, -0.468265f, -0.468350f, -0.468435f, -0.468519f, -0.468604f,
- -0.468689f, -0.468774f, -0.468858f, -0.468943f, -0.469028f, -0.469112f, -0.469197f, -0.469282f,
- -0.469366f, -0.469451f, -0.469536f, -0.469620f, -0.469705f, -0.469789f, -0.469874f, -0.469959f,
- -0.470043f, -0.470128f, -0.470213f, -0.470297f, -0.470382f, -0.470466f, -0.470551f, -0.470636f,
- -0.470720f, -0.470805f, -0.470889f, -0.470974f, -0.471058f, -0.471143f, -0.471228f, -0.471312f,
- -0.471397f, -0.471481f, -0.471566f, -0.471650f, -0.471735f, -0.471819f, -0.471904f, -0.471988f,
- -0.472073f, -0.472158f, -0.472242f, -0.472327f, -0.472411f, -0.472496f, -0.472580f, -0.472665f,
- -0.472749f, -0.472834f, -0.472918f, -0.473002f, -0.473087f, -0.473171f, -0.473256f, -0.473340f,
- -0.473425f, -0.473509f, -0.473594f, -0.473678f, -0.473763f, -0.473847f, -0.473931f, -0.474016f,
- -0.474100f, -0.474185f, -0.474269f, -0.474353f, -0.474438f, -0.474522f, -0.474607f, -0.474691f,
- -0.474775f, -0.474860f, -0.474944f, -0.475029f, -0.475113f, -0.475197f, -0.475282f, -0.475366f,
- -0.475450f, -0.475535f, -0.475619f, -0.475703f, -0.475788f, -0.475872f, -0.475956f, -0.476041f,
- -0.476125f, -0.476209f, -0.476294f, -0.476378f, -0.476462f, -0.476546f, -0.476631f, -0.476715f,
- -0.476799f, -0.476884f, -0.476968f, -0.477052f, -0.477136f, -0.477221f, -0.477305f, -0.477389f,
- -0.477473f, -0.477558f, -0.477642f, -0.477726f, -0.477810f, -0.477894f, -0.477979f, -0.478063f,
- -0.478147f, -0.478231f, -0.478315f, -0.478400f, -0.478484f, -0.478568f, -0.478652f, -0.478736f,
- -0.478821f, -0.478905f, -0.478989f, -0.479073f, -0.479157f, -0.479241f, -0.479325f, -0.479410f,
- -0.479494f, -0.479578f, -0.479662f, -0.479746f, -0.479830f, -0.479914f, -0.479998f, -0.480083f,
- -0.480167f, -0.480251f, -0.480335f, -0.480419f, -0.480503f, -0.480587f, -0.480671f, -0.480755f,
- -0.480839f, -0.480923f, -0.481007f, -0.481091f, -0.481176f, -0.481260f, -0.481344f, -0.481428f,
- -0.481512f, -0.481596f, -0.481680f, -0.481764f, -0.481848f, -0.481932f, -0.482016f, -0.482100f,
- -0.482184f, -0.482268f, -0.482352f, -0.482436f, -0.482520f, -0.482604f, -0.482688f, -0.482772f,
- -0.482856f, -0.482940f, -0.483023f, -0.483107f, -0.483191f, -0.483275f, -0.483359f, -0.483443f,
- -0.483527f, -0.483611f, -0.483695f, -0.483779f, -0.483863f, -0.483947f, -0.484031f, -0.484114f,
- -0.484198f, -0.484282f, -0.484366f, -0.484450f, -0.484534f, -0.484618f, -0.484702f, -0.484785f,
- -0.484869f, -0.484953f, -0.485037f, -0.485121f, -0.485205f, -0.485288f, -0.485372f, -0.485456f,
- -0.485540f, -0.485624f, -0.485708f, -0.485791f, -0.485875f, -0.485959f, -0.486043f, -0.486126f,
- -0.486210f, -0.486294f, -0.486378f, -0.486462f, -0.486545f, -0.486629f, -0.486713f, -0.486797f,
- -0.486880f, -0.486964f, -0.487048f, -0.487132f, -0.487215f, -0.487299f, -0.487383f, -0.487466f,
- -0.487550f, -0.487634f, -0.487718f, -0.487801f, -0.487885f, -0.487969f, -0.488052f, -0.488136f,
- -0.488220f, -0.488303f, -0.488387f, -0.488471f, -0.488554f, -0.488638f, -0.488722f, -0.488805f,
- -0.488889f, -0.488973f, -0.489056f, -0.489140f, -0.489223f, -0.489307f, -0.489391f, -0.489474f,
- -0.489558f, -0.489641f, -0.489725f, -0.489809f, -0.489892f, -0.489976f, -0.490059f, -0.490143f,
- -0.490226f, -0.490310f, -0.490394f, -0.490477f, -0.490561f, -0.490644f, -0.490728f, -0.490811f,
- -0.490895f, -0.490978f, -0.491062f, -0.491145f, -0.491229f, -0.491312f, -0.491396f, -0.491479f,
- -0.491563f, -0.491646f, -0.491730f, -0.491813f, -0.491897f, -0.491980f, -0.492064f, -0.492147f,
- -0.492231f, -0.492314f, -0.492398f, -0.492481f, -0.492564f, -0.492648f, -0.492731f, -0.492815f,
- -0.492898f, -0.492982f, -0.493065f, -0.493148f, -0.493232f, -0.493315f, -0.493399f, -0.493482f,
- -0.493565f, -0.493649f, -0.493732f, -0.493816f, -0.493899f, -0.493982f, -0.494066f, -0.494149f,
- -0.494232f, -0.494316f, -0.494399f, -0.494482f, -0.494566f, -0.494649f, -0.494732f, -0.494816f,
- -0.494899f, -0.494982f, -0.495066f, -0.495149f, -0.495232f, -0.495315f, -0.495399f, -0.495482f,
- -0.495565f, -0.495649f, -0.495732f, -0.495815f, -0.495898f, -0.495982f, -0.496065f, -0.496148f,
- -0.496231f, -0.496315f, -0.496398f, -0.496481f, -0.496564f, -0.496647f, -0.496731f, -0.496814f,
- -0.496897f, -0.496980f, -0.497063f, -0.497147f, -0.497230f, -0.497313f, -0.497396f, -0.497479f,
- -0.497562f, -0.497646f, -0.497729f, -0.497812f, -0.497895f, -0.497978f, -0.498061f, -0.498145f,
- -0.498228f, -0.498311f, -0.498394f, -0.498477f, -0.498560f, -0.498643f, -0.498726f, -0.498809f,
- -0.498893f, -0.498976f, -0.499059f, -0.499142f, -0.499225f, -0.499308f, -0.499391f, -0.499474f,
- -0.499557f, -0.499640f, -0.499723f, -0.499806f, -0.499889f, -0.499972f, -0.500055f, -0.500138f,
- -0.500221f, -0.500304f, -0.500387f, -0.500470f, -0.500553f, -0.500636f, -0.500719f, -0.500802f,
- -0.500885f, -0.500968f, -0.501051f, -0.501134f, -0.501217f, -0.501300f, -0.501383f, -0.501466f,
- -0.501549f, -0.501632f, -0.501715f, -0.501798f, -0.501881f, -0.501964f, -0.502047f, -0.502130f,
- -0.502212f, -0.502295f, -0.502378f, -0.502461f, -0.502544f, -0.502627f, -0.502710f, -0.502793f,
- -0.502876f, -0.502958f, -0.503041f, -0.503124f, -0.503207f, -0.503290f, -0.503373f, -0.503456f,
- -0.503538f, -0.503621f, -0.503704f, -0.503787f, -0.503870f, -0.503953f, -0.504035f, -0.504118f,
- -0.504201f, -0.504284f, -0.504366f, -0.504449f, -0.504532f, -0.504615f, -0.504698f, -0.504780f,
- -0.504863f, -0.504946f, -0.505029f, -0.505111f, -0.505194f, -0.505277f, -0.505360f, -0.505442f,
- -0.505525f, -0.505608f, -0.505690f, -0.505773f, -0.505856f, -0.505939f, -0.506021f, -0.506104f,
- -0.506187f, -0.506269f, -0.506352f, -0.506435f, -0.506517f, -0.506600f, -0.506683f, -0.506765f,
- -0.506848f, -0.506931f, -0.507013f, -0.507096f, -0.507179f, -0.507261f, -0.507344f, -0.507426f,
- -0.507509f, -0.507592f, -0.507674f, -0.507757f, -0.507839f, -0.507922f, -0.508005f, -0.508087f,
- -0.508170f, -0.508252f, -0.508335f, -0.508417f, -0.508500f, -0.508583f, -0.508665f, -0.508748f,
- -0.508830f, -0.508913f, -0.508995f, -0.509078f, -0.509160f, -0.509243f, -0.509325f, -0.509408f,
- -0.509490f, -0.509573f, -0.509655f, -0.509738f, -0.509820f, -0.509903f, -0.509985f, -0.510068f,
- -0.510150f, -0.510233f, -0.510315f, -0.510397f, -0.510480f, -0.510562f, -0.510645f, -0.510727f,
- -0.510810f, -0.510892f, -0.510974f, -0.511057f, -0.511139f, -0.511222f, -0.511304f, -0.511386f,
- -0.511469f, -0.511551f, -0.511634f, -0.511716f, -0.511798f, -0.511881f, -0.511963f, -0.512045f,
- -0.512128f, -0.512210f, -0.512292f, -0.512375f, -0.512457f, -0.512539f, -0.512622f, -0.512704f,
- -0.512786f, -0.512869f, -0.512951f, -0.513033f, -0.513116f, -0.513198f, -0.513280f, -0.513362f,
- -0.513445f, -0.513527f, -0.513609f, -0.513692f, -0.513774f, -0.513856f, -0.513938f, -0.514021f,
- -0.514103f, -0.514185f, -0.514267f, -0.514349f, -0.514432f, -0.514514f, -0.514596f, -0.514678f,
- -0.514760f, -0.514843f, -0.514925f, -0.515007f, -0.515089f, -0.515171f, -0.515254f, -0.515336f,
- -0.515418f, -0.515500f, -0.515582f, -0.515664f, -0.515746f, -0.515829f, -0.515911f, -0.515993f,
- -0.516075f, -0.516157f, -0.516239f, -0.516321f, -0.516403f, -0.516486f, -0.516568f, -0.516650f,
- -0.516732f, -0.516814f, -0.516896f, -0.516978f, -0.517060f, -0.517142f, -0.517224f, -0.517306f,
- -0.517388f, -0.517470f, -0.517552f, -0.517634f, -0.517716f, -0.517798f, -0.517880f, -0.517963f,
- -0.518045f, -0.518126f, -0.518209f, -0.518291f, -0.518372f, -0.518454f, -0.518536f, -0.518618f,
- -0.518700f, -0.518782f, -0.518864f, -0.518946f, -0.519028f, -0.519110f, -0.519192f, -0.519274f,
- -0.519356f, -0.519438f, -0.519520f, -0.519602f, -0.519684f, -0.519766f, -0.519848f, -0.519929f,
- -0.520011f, -0.520093f, -0.520175f, -0.520257f, -0.520339f, -0.520421f, -0.520503f, -0.520584f,
- -0.520666f, -0.520748f, -0.520830f, -0.520912f, -0.520994f, -0.521075f, -0.521157f, -0.521239f,
- -0.521321f, -0.521403f, -0.521485f, -0.521566f, -0.521648f, -0.521730f, -0.521812f, -0.521894f,
- -0.521975f, -0.522057f, -0.522139f, -0.522221f, -0.522302f, -0.522384f, -0.522466f, -0.522548f,
- -0.522629f, -0.522711f, -0.522793f, -0.522875f, -0.522956f, -0.523038f, -0.523120f, -0.523201f,
- -0.523283f, -0.523365f, -0.523447f, -0.523528f, -0.523610f, -0.523692f, -0.523773f, -0.523855f,
- -0.523937f, -0.524018f, -0.524100f, -0.524181f, -0.524263f, -0.524345f, -0.524426f, -0.524508f,
- -0.524590f, -0.524671f, -0.524753f, -0.524835f, -0.524916f, -0.524998f, -0.525079f, -0.525161f,
- -0.525243f, -0.525324f, -0.525406f, -0.525487f, -0.525569f, -0.525650f, -0.525732f, -0.525813f,
- -0.525895f, -0.525977f, -0.526058f, -0.526140f, -0.526221f, -0.526303f, -0.526384f, -0.526466f,
- -0.526547f, -0.526629f, -0.526710f, -0.526792f, -0.526873f, -0.526955f, -0.527036f, -0.527118f,
- -0.527199f, -0.527281f, -0.527362f, -0.527444f, -0.527525f, -0.527606f, -0.527688f, -0.527769f,
- -0.527851f, -0.527932f, -0.528014f, -0.528095f, -0.528176f, -0.528258f, -0.528339f, -0.528421f,
- -0.528502f, -0.528583f, -0.528665f, -0.528746f, -0.528828f, -0.528909f, -0.528990f, -0.529072f,
- -0.529153f, -0.529234f, -0.529316f, -0.529397f, -0.529478f, -0.529560f, -0.529641f, -0.529722f,
- -0.529804f, -0.529885f, -0.529966f, -0.530048f, -0.530129f, -0.530210f, -0.530291f, -0.530373f,
- -0.530454f, -0.530535f, -0.530617f, -0.530698f, -0.530779f, -0.530860f, -0.530942f, -0.531023f,
- -0.531104f, -0.531185f, -0.531266f, -0.531348f, -0.531429f, -0.531510f, -0.531591f, -0.531673f,
- -0.531754f, -0.531835f, -0.531916f, -0.531997f, -0.532078f, -0.532160f, -0.532241f, -0.532322f,
- -0.532403f, -0.532484f, -0.532565f, -0.532647f, -0.532728f, -0.532809f, -0.532890f, -0.532971f,
- -0.533052f, -0.533133f, -0.533214f, -0.533296f, -0.533377f, -0.533458f, -0.533539f, -0.533620f,
- -0.533701f, -0.533782f, -0.533863f, -0.533944f, -0.534025f, -0.534106f, -0.534187f, -0.534268f,
- -0.534349f, -0.534431f, -0.534512f, -0.534593f, -0.534674f, -0.534755f, -0.534836f, -0.534917f,
- -0.534998f, -0.535079f, -0.535160f, -0.535241f, -0.535322f, -0.535403f, -0.535484f, -0.535564f,
- -0.535645f, -0.535726f, -0.535807f, -0.535888f, -0.535969f, -0.536050f, -0.536131f, -0.536212f,
- -0.536293f, -0.536374f, -0.536455f, -0.536536f, -0.536617f, -0.536698f, -0.536778f, -0.536859f,
- -0.536940f, -0.537021f, -0.537102f, -0.537183f, -0.537264f, -0.537345f, -0.537425f, -0.537506f,
- -0.537587f, -0.537668f, -0.537749f, -0.537830f, -0.537910f, -0.537991f, -0.538072f, -0.538153f,
- -0.538234f, -0.538314f, -0.538395f, -0.538476f, -0.538557f, -0.538638f, -0.538718f, -0.538799f,
- -0.538880f, -0.538961f, -0.539041f, -0.539122f, -0.539203f, -0.539284f, -0.539364f, -0.539445f,
- -0.539526f, -0.539607f, -0.539687f, -0.539768f, -0.539849f, -0.539929f, -0.540010f, -0.540091f,
- -0.540171f, -0.540252f, -0.540333f, -0.540413f, -0.540494f, -0.540575f, -0.540655f, -0.540736f,
- -0.540817f, -0.540897f, -0.540978f, -0.541059f, -0.541139f, -0.541220f, -0.541301f, -0.541381f,
- -0.541462f, -0.541542f, -0.541623f, -0.541704f, -0.541784f, -0.541865f, -0.541945f, -0.542026f,
- -0.542106f, -0.542187f, -0.542268f, -0.542348f, -0.542429f, -0.542509f, -0.542590f, -0.542670f,
- -0.542751f, -0.542831f, -0.542912f, -0.542992f, -0.543073f, -0.543153f, -0.543234f, -0.543314f,
- -0.543395f, -0.543475f, -0.543556f, -0.543636f, -0.543717f, -0.543797f, -0.543878f, -0.543958f,
- -0.544039f, -0.544119f, -0.544199f, -0.544280f, -0.544360f, -0.544441f, -0.544521f, -0.544602f,
- -0.544682f, -0.544762f, -0.544843f, -0.544923f, -0.545003f, -0.545084f, -0.545164f, -0.545245f,
- -0.545325f, -0.545405f, -0.545486f, -0.545566f, -0.545646f, -0.545727f, -0.545807f, -0.545887f,
- -0.545968f, -0.546048f, -0.546128f, -0.546209f, -0.546289f, -0.546369f, -0.546450f, -0.546530f,
- -0.546610f, -0.546690f, -0.546771f, -0.546851f, -0.546931f, -0.547011f, -0.547092f, -0.547172f,
- -0.547252f, -0.547333f, -0.547413f, -0.547493f, -0.547573f, -0.547653f, -0.547734f, -0.547814f,
- -0.547894f, -0.547974f, -0.548054f, -0.548135f, -0.548215f, -0.548295f, -0.548375f, -0.548455f,
- -0.548536f, -0.548616f, -0.548696f, -0.548776f, -0.548856f, -0.548936f, -0.549016f, -0.549097f,
- -0.549177f, -0.549257f, -0.549337f, -0.549417f, -0.549497f, -0.549577f, -0.549657f, -0.549737f,
- -0.549818f, -0.549898f, -0.549978f, -0.550058f, -0.550138f, -0.550218f, -0.550298f, -0.550378f,
- -0.550458f, -0.550538f, -0.550618f, -0.550698f, -0.550778f, -0.550858f, -0.550938f, -0.551018f,
- -0.551098f, -0.551178f, -0.551258f, -0.551338f, -0.551418f, -0.551498f, -0.551578f, -0.551658f,
- -0.551738f, -0.551818f, -0.551898f, -0.551978f, -0.552058f, -0.552138f, -0.552218f, -0.552298f,
- -0.552378f, -0.552457f, -0.552537f, -0.552617f, -0.552697f, -0.552777f, -0.552857f, -0.552937f,
- -0.553017f, -0.553097f, -0.553176f, -0.553256f, -0.553336f, -0.553416f, -0.553496f, -0.553576f,
- -0.553656f, -0.553735f, -0.553815f, -0.553895f, -0.553975f, -0.554055f, -0.554134f, -0.554214f,
- -0.554294f, -0.554374f, -0.554454f, -0.554533f, -0.554613f, -0.554693f, -0.554773f, -0.554853f,
- -0.554932f, -0.555012f, -0.555092f, -0.555172f, -0.555251f, -0.555331f, -0.555411f, -0.555490f,
- -0.555570f, -0.555650f, -0.555730f, -0.555809f, -0.555889f, -0.555969f, -0.556048f, -0.556128f,
- -0.556208f, -0.556287f, -0.556367f, -0.556447f, -0.556526f, -0.556606f, -0.556686f, -0.556765f,
- -0.556845f, -0.556925f, -0.557004f, -0.557084f, -0.557164f, -0.557243f, -0.557323f, -0.557402f,
- -0.557482f, -0.557562f, -0.557641f, -0.557721f, -0.557800f, -0.557880f, -0.557959f, -0.558039f,
- -0.558119f, -0.558198f, -0.558278f, -0.558357f, -0.558437f, -0.558516f, -0.558596f, -0.558675f,
- -0.558755f, -0.558834f, -0.558914f, -0.558993f, -0.559073f, -0.559152f, -0.559232f, -0.559311f,
- -0.559391f, -0.559470f, -0.559550f, -0.559629f, -0.559709f, -0.559788f, -0.559867f, -0.559947f,
- -0.560026f, -0.560106f, -0.560185f, -0.560265f, -0.560344f, -0.560423f, -0.560503f, -0.560582f,
- -0.560662f, -0.560741f, -0.560820f, -0.560900f, -0.560979f, -0.561058f, -0.561138f, -0.561217f,
- -0.561297f, -0.561376f, -0.561455f, -0.561535f, -0.561614f, -0.561693f, -0.561773f, -0.561852f,
- -0.561931f, -0.562010f, -0.562090f, -0.562169f, -0.562248f, -0.562328f, -0.562407f, -0.562486f,
- -0.562565f, -0.562645f, -0.562724f, -0.562803f, -0.562882f, -0.562962f, -0.563041f, -0.563120f,
- -0.563199f, -0.563279f, -0.563358f, -0.563437f, -0.563516f, -0.563595f, -0.563675f, -0.563754f,
- -0.563833f, -0.563912f, -0.563991f, -0.564070f, -0.564150f, -0.564229f, -0.564308f, -0.564387f,
- -0.564466f, -0.564545f, -0.564624f, -0.564704f, -0.564783f, -0.564862f, -0.564941f, -0.565020f,
- -0.565099f, -0.565178f, -0.565257f, -0.565336f, -0.565416f, -0.565495f, -0.565574f, -0.565653f,
- -0.565732f, -0.565811f, -0.565890f, -0.565969f, -0.566048f, -0.566127f, -0.566206f, -0.566285f,
- -0.566364f, -0.566443f, -0.566522f, -0.566601f, -0.566680f, -0.566759f, -0.566838f, -0.566917f,
- -0.566996f, -0.567075f, -0.567154f, -0.567233f, -0.567312f, -0.567391f, -0.567470f, -0.567549f,
- -0.567628f, -0.567707f, -0.567786f, -0.567864f, -0.567943f, -0.568022f, -0.568101f, -0.568180f,
- -0.568259f, -0.568338f, -0.568417f, -0.568496f, -0.568574f, -0.568653f, -0.568732f, -0.568811f,
- -0.568890f, -0.568969f, -0.569048f, -0.569126f, -0.569205f, -0.569284f, -0.569363f, -0.569442f,
- -0.569521f, -0.569599f, -0.569678f, -0.569757f, -0.569836f, -0.569914f, -0.569993f, -0.570072f,
- -0.570151f, -0.570230f, -0.570308f, -0.570387f, -0.570466f, -0.570545f, -0.570623f, -0.570702f,
- -0.570781f, -0.570859f, -0.570938f, -0.571017f, -0.571096f, -0.571174f, -0.571253f, -0.571332f,
- -0.571410f, -0.571489f, -0.571568f, -0.571646f, -0.571725f, -0.571804f, -0.571882f, -0.571961f,
- -0.572040f, -0.572118f, -0.572197f, -0.572276f, -0.572354f, -0.572433f, -0.572511f, -0.572590f,
- -0.572669f, -0.572747f, -0.572826f, -0.572904f, -0.572983f, -0.573061f, -0.573140f, -0.573219f,
- -0.573297f, -0.573376f, -0.573454f, -0.573533f, -0.573611f, -0.573690f, -0.573768f, -0.573847f,
- -0.573925f, -0.574004f, -0.574082f, -0.574161f, -0.574239f, -0.574318f, -0.574396f, -0.574475f,
- -0.574553f, -0.574632f, -0.574710f, -0.574789f, -0.574867f, -0.574946f, -0.575024f, -0.575103f,
- -0.575181f, -0.575259f, -0.575338f, -0.575416f, -0.575495f, -0.575573f, -0.575651f, -0.575730f,
- -0.575808f, -0.575887f, -0.575965f, -0.576043f, -0.576122f, -0.576200f, -0.576278f, -0.576357f,
- -0.576435f, -0.576513f, -0.576592f, -0.576670f, -0.576748f, -0.576827f, -0.576905f, -0.576983f,
- -0.577062f, -0.577140f, -0.577218f, -0.577297f, -0.577375f, -0.577453f, -0.577531f, -0.577610f,
- -0.577688f, -0.577766f, -0.577844f, -0.577923f, -0.578001f, -0.578079f, -0.578157f, -0.578236f,
- -0.578314f, -0.578392f, -0.578470f, -0.578548f, -0.578627f, -0.578705f, -0.578783f, -0.578861f,
- -0.578939f, -0.579018f, -0.579096f, -0.579174f, -0.579252f, -0.579330f, -0.579408f, -0.579486f,
- -0.579565f, -0.579643f, -0.579721f, -0.579799f, -0.579877f, -0.579955f, -0.580033f, -0.580111f,
- -0.580189f, -0.580267f, -0.580346f, -0.580424f, -0.580502f, -0.580580f, -0.580658f, -0.580736f,
- -0.580814f, -0.580892f, -0.580970f, -0.581048f, -0.581126f, -0.581204f, -0.581282f, -0.581360f,
- -0.581438f, -0.581516f, -0.581594f, -0.581672f, -0.581750f, -0.581828f, -0.581906f, -0.581984f,
- -0.582062f, -0.582140f, -0.582218f, -0.582296f, -0.582374f, -0.582452f, -0.582530f, -0.582608f,
- -0.582685f, -0.582763f, -0.582841f, -0.582919f, -0.582997f, -0.583075f, -0.583153f, -0.583231f,
- -0.583309f, -0.583387f, -0.583464f, -0.583542f, -0.583620f, -0.583698f, -0.583776f, -0.583854f,
- -0.583931f, -0.584009f, -0.584087f, -0.584165f, -0.584243f, -0.584321f, -0.584398f, -0.584476f,
- -0.584554f, -0.584632f, -0.584710f, -0.584787f, -0.584865f, -0.584943f, -0.585021f, -0.585098f,
- -0.585176f, -0.585254f, -0.585332f, -0.585409f, -0.585487f, -0.585565f, -0.585642f, -0.585720f,
- -0.585798f, -0.585876f, -0.585953f, -0.586031f, -0.586109f, -0.586186f, -0.586264f, -0.586342f,
- -0.586419f, -0.586497f, -0.586575f, -0.586652f, -0.586730f, -0.586808f, -0.586885f, -0.586963f,
- -0.587040f, -0.587118f, -0.587196f, -0.587273f, -0.587351f, -0.587428f, -0.587506f, -0.587584f,
- -0.587661f, -0.587739f, -0.587816f, -0.587894f, -0.587971f, -0.588049f, -0.588126f, -0.588204f,
- -0.588282f, -0.588359f, -0.588437f, -0.588514f, -0.588592f, -0.588669f, -0.588747f, -0.588824f,
- -0.588902f, -0.588979f, -0.589057f, -0.589134f, -0.589212f, -0.589289f, -0.589366f, -0.589444f,
- -0.589521f, -0.589599f, -0.589676f, -0.589754f, -0.589831f, -0.589908f, -0.589986f, -0.590063f,
- -0.590141f, -0.590218f, -0.590295f, -0.590373f, -0.590450f, -0.590528f, -0.590605f, -0.590682f,
- -0.590760f, -0.590837f, -0.590914f, -0.590992f, -0.591069f, -0.591146f, -0.591224f, -0.591301f,
- -0.591378f, -0.591456f, -0.591533f, -0.591610f, -0.591688f, -0.591765f, -0.591842f, -0.591919f,
- -0.591997f, -0.592074f, -0.592151f, -0.592228f, -0.592306f, -0.592383f, -0.592460f, -0.592537f,
- -0.592615f, -0.592692f, -0.592769f, -0.592846f, -0.592924f, -0.593001f, -0.593078f, -0.593155f,
- -0.593232f, -0.593309f, -0.593387f, -0.593464f, -0.593541f, -0.593618f, -0.593695f, -0.593772f,
- -0.593850f, -0.593927f, -0.594004f, -0.594081f, -0.594158f, -0.594235f, -0.594312f, -0.594389f,
- -0.594467f, -0.594544f, -0.594621f, -0.594698f, -0.594775f, -0.594852f, -0.594929f, -0.595006f,
- -0.595083f, -0.595160f, -0.595237f, -0.595314f, -0.595391f, -0.595468f, -0.595545f, -0.595622f,
- -0.595699f, -0.595776f, -0.595853f, -0.595930f, -0.596007f, -0.596084f, -0.596161f, -0.596238f,
- -0.596315f, -0.596392f, -0.596469f, -0.596546f, -0.596623f, -0.596700f, -0.596777f, -0.596854f,
- -0.596931f, -0.597008f, -0.597085f, -0.597161f, -0.597238f, -0.597315f, -0.597392f, -0.597469f,
- -0.597546f, -0.597623f, -0.597700f, -0.597776f, -0.597853f, -0.597930f, -0.598007f, -0.598084f,
- -0.598161f, -0.598238f, -0.598314f, -0.598391f, -0.598468f, -0.598545f, -0.598622f, -0.598698f,
- -0.598775f, -0.598852f, -0.598929f, -0.599006f, -0.599082f, -0.599159f, -0.599236f, -0.599313f,
- -0.599389f, -0.599466f, -0.599543f, -0.599620f, -0.599696f, -0.599773f, -0.599850f, -0.599926f,
- -0.600003f, -0.600080f, -0.600156f, -0.600233f, -0.600310f, -0.600387f, -0.600463f, -0.600540f,
- -0.600616f, -0.600693f, -0.600770f, -0.600846f, -0.600923f, -0.601000f, -0.601076f, -0.601153f,
- -0.601230f, -0.601306f, -0.601383f, -0.601459f, -0.601536f, -0.601613f, -0.601689f, -0.601766f,
- -0.601842f, -0.601919f, -0.601995f, -0.602072f, -0.602148f, -0.602225f, -0.602302f, -0.602378f,
- -0.602455f, -0.602531f, -0.602608f, -0.602684f, -0.602761f, -0.602837f, -0.602914f, -0.602990f,
- -0.603067f, -0.603143f, -0.603220f, -0.603296f, -0.603372f, -0.603449f, -0.603525f, -0.603602f,
- -0.603678f, -0.603755f, -0.603831f, -0.603908f, -0.603984f, -0.604060f, -0.604137f, -0.604213f,
- -0.604290f, -0.604366f, -0.604442f, -0.604519f, -0.604595f, -0.604671f, -0.604748f, -0.604824f,
- -0.604900f, -0.604977f, -0.605053f, -0.605129f, -0.605206f, -0.605282f, -0.605358f, -0.605435f,
- -0.605511f, -0.605587f, -0.605664f, -0.605740f, -0.605816f, -0.605892f, -0.605969f, -0.606045f,
- -0.606121f, -0.606198f, -0.606274f, -0.606350f, -0.606426f, -0.606502f, -0.606579f, -0.606655f,
- -0.606731f, -0.606807f, -0.606884f, -0.606960f, -0.607036f, -0.607112f, -0.607188f, -0.607264f,
- -0.607341f, -0.607417f, -0.607493f, -0.607569f, -0.607645f, -0.607721f, -0.607798f, -0.607874f,
- -0.607950f, -0.608026f, -0.608102f, -0.608178f, -0.608254f, -0.608330f, -0.608406f, -0.608482f,
- -0.608559f, -0.608635f, -0.608711f, -0.608787f, -0.608863f, -0.608939f, -0.609015f, -0.609091f,
- -0.609167f, -0.609243f, -0.609319f, -0.609395f, -0.609471f, -0.609547f, -0.609623f, -0.609699f,
- -0.609775f, -0.609851f, -0.609927f, -0.610003f, -0.610079f, -0.610155f, -0.610231f, -0.610307f,
- -0.610383f, -0.610459f, -0.610535f, -0.610611f, -0.610687f, -0.610762f, -0.610838f, -0.610914f,
- -0.610990f, -0.611066f, -0.611142f, -0.611218f, -0.611294f, -0.611370f, -0.611445f, -0.611521f,
- -0.611597f, -0.611673f, -0.611749f, -0.611825f, -0.611901f, -0.611976f, -0.612052f, -0.612128f,
- -0.612204f, -0.612280f, -0.612355f, -0.612431f, -0.612507f, -0.612583f, -0.612659f, -0.612734f,
- -0.612810f, -0.612886f, -0.612962f, -0.613037f, -0.613113f, -0.613189f, -0.613265f, -0.613340f,
- -0.613416f, -0.613492f, -0.613567f, -0.613643f, -0.613719f, -0.613795f, -0.613870f, -0.613946f,
- -0.614022f, -0.614097f, -0.614173f, -0.614249f, -0.614324f, -0.614400f, -0.614475f, -0.614551f,
- -0.614627f, -0.614702f, -0.614778f, -0.614854f, -0.614929f, -0.615005f, -0.615080f, -0.615156f,
- -0.615232f, -0.615307f, -0.615383f, -0.615458f, -0.615534f, -0.615609f, -0.615685f, -0.615761f,
- -0.615836f, -0.615912f, -0.615987f, -0.616063f, -0.616138f, -0.616214f, -0.616289f, -0.616365f,
- -0.616440f, -0.616516f, -0.616591f, -0.616667f, -0.616742f, -0.616818f, -0.616893f, -0.616968f,
- -0.617044f, -0.617119f, -0.617195f, -0.617270f, -0.617346f, -0.617421f, -0.617496f, -0.617572f,
- -0.617647f, -0.617723f, -0.617798f, -0.617873f, -0.617949f, -0.618024f, -0.618100f, -0.618175f,
- -0.618250f, -0.618326f, -0.618401f, -0.618476f, -0.618552f, -0.618627f, -0.618702f, -0.618778f,
- -0.618853f, -0.618928f, -0.619004f, -0.619079f, -0.619154f, -0.619229f, -0.619305f, -0.619380f,
- -0.619455f, -0.619531f, -0.619606f, -0.619681f, -0.619756f, -0.619832f, -0.619907f, -0.619982f,
- -0.620057f, -0.620132f, -0.620208f, -0.620283f, -0.620358f, -0.620433f, -0.620508f, -0.620584f,
- -0.620659f, -0.620734f, -0.620809f, -0.620884f, -0.620959f, -0.621035f, -0.621110f, -0.621185f,
- -0.621260f, -0.621335f, -0.621410f, -0.621485f, -0.621560f, -0.621636f, -0.621711f, -0.621786f,
- -0.621861f, -0.621936f, -0.622011f, -0.622086f, -0.622161f, -0.622236f, -0.622311f, -0.622386f,
- -0.622461f, -0.622536f, -0.622611f, -0.622686f, -0.622761f, -0.622836f, -0.622911f, -0.622986f,
- -0.623061f, -0.623136f, -0.623211f, -0.623286f, -0.623361f, -0.623436f, -0.623511f, -0.623586f,
- -0.623661f, -0.623736f, -0.623811f, -0.623886f, -0.623961f, -0.624036f, -0.624111f, -0.624186f,
- -0.624260f, -0.624335f, -0.624410f, -0.624485f, -0.624560f, -0.624635f, -0.624710f, -0.624785f,
- -0.624860f, -0.624934f, -0.625009f, -0.625084f, -0.625159f, -0.625234f, -0.625309f, -0.625383f,
- -0.625458f, -0.625533f, -0.625608f, -0.625683f, -0.625757f, -0.625832f, -0.625907f, -0.625982f,
- -0.626056f, -0.626131f, -0.626206f, -0.626281f, -0.626355f, -0.626430f, -0.626505f, -0.626580f,
- -0.626654f, -0.626729f, -0.626804f, -0.626878f, -0.626953f, -0.627028f, -0.627102f, -0.627177f,
- -0.627252f, -0.627326f, -0.627401f, -0.627476f, -0.627550f, -0.627625f, -0.627700f, -0.627774f,
- -0.627849f, -0.627924f, -0.627998f, -0.628073f, -0.628147f, -0.628222f, -0.628297f, -0.628371f,
- -0.628446f, -0.628520f, -0.628595f, -0.628669f, -0.628744f, -0.628819f, -0.628893f, -0.628968f,
- -0.629042f, -0.629117f, -0.629191f, -0.629266f, -0.629340f, -0.629415f, -0.629489f, -0.629564f,
- -0.629638f, -0.629713f, -0.629787f, -0.629862f, -0.629936f, -0.630011f, -0.630085f, -0.630159f,
- -0.630234f, -0.630308f, -0.630383f, -0.630457f, -0.630532f, -0.630606f, -0.630680f, -0.630755f,
- -0.630829f, -0.630904f, -0.630978f, -0.631052f, -0.631127f, -0.631201f, -0.631275f, -0.631350f,
- -0.631424f, -0.631499f, -0.631573f, -0.631647f, -0.631721f, -0.631796f, -0.631870f, -0.631944f,
- -0.632019f, -0.632093f, -0.632167f, -0.632242f, -0.632316f, -0.632390f, -0.632464f, -0.632539f,
- -0.632613f, -0.632687f, -0.632761f, -0.632836f, -0.632910f, -0.632984f, -0.633058f, -0.633133f,
- -0.633207f, -0.633281f, -0.633355f, -0.633429f, -0.633504f, -0.633578f, -0.633652f, -0.633726f,
- -0.633800f, -0.633874f, -0.633949f, -0.634023f, -0.634097f, -0.634171f, -0.634245f, -0.634319f,
- -0.634393f, -0.634467f, -0.634542f, -0.634616f, -0.634690f, -0.634764f, -0.634838f, -0.634912f,
- -0.634986f, -0.635060f, -0.635134f, -0.635208f, -0.635282f, -0.635356f, -0.635430f, -0.635504f,
- -0.635578f, -0.635652f, -0.635726f, -0.635800f, -0.635874f, -0.635948f, -0.636022f, -0.636096f,
- -0.636170f, -0.636244f, -0.636318f, -0.636392f, -0.636466f, -0.636540f, -0.636614f, -0.636688f,
- -0.636762f, -0.636836f, -0.636910f, -0.636984f, -0.637057f, -0.637131f, -0.637205f, -0.637279f,
- -0.637353f, -0.637427f, -0.637501f, -0.637575f, -0.637649f, -0.637722f, -0.637796f, -0.637870f,
- -0.637944f, -0.638018f, -0.638092f, -0.638165f, -0.638239f, -0.638313f, -0.638387f, -0.638461f,
- -0.638534f, -0.638608f, -0.638682f, -0.638756f, -0.638829f, -0.638903f, -0.638977f, -0.639051f,
- -0.639124f, -0.639198f, -0.639272f, -0.639346f, -0.639419f, -0.639493f, -0.639567f, -0.639640f,
- -0.639714f, -0.639788f, -0.639862f, -0.639935f, -0.640009f, -0.640083f, -0.640156f, -0.640230f,
- -0.640303f, -0.640377f, -0.640451f, -0.640524f, -0.640598f, -0.640672f, -0.640745f, -0.640819f,
- -0.640892f, -0.640966f, -0.641040f, -0.641113f, -0.641187f, -0.641260f, -0.641334f, -0.641407f,
- -0.641481f, -0.641555f, -0.641628f, -0.641702f, -0.641775f, -0.641849f, -0.641922f, -0.641996f,
- -0.642069f, -0.642143f, -0.642216f, -0.642290f, -0.642363f, -0.642437f, -0.642510f, -0.642584f,
- -0.642657f, -0.642730f, -0.642804f, -0.642877f, -0.642951f, -0.643024f, -0.643098f, -0.643171f,
- -0.643245f, -0.643318f, -0.643391f, -0.643465f, -0.643538f, -0.643611f, -0.643685f, -0.643758f,
- -0.643832f, -0.643905f, -0.643978f, -0.644052f, -0.644125f, -0.644198f, -0.644272f, -0.644345f,
- -0.644418f, -0.644492f, -0.644565f, -0.644638f, -0.644711f, -0.644785f, -0.644858f, -0.644931f,
- -0.645005f, -0.645078f, -0.645151f, -0.645224f, -0.645298f, -0.645371f, -0.645444f, -0.645517f,
- -0.645590f, -0.645664f, -0.645737f, -0.645810f, -0.645883f, -0.645956f, -0.646030f, -0.646103f,
- -0.646176f, -0.646249f, -0.646322f, -0.646396f, -0.646469f, -0.646542f, -0.646615f, -0.646688f,
- -0.646761f, -0.646834f, -0.646907f, -0.646981f, -0.647054f, -0.647127f, -0.647200f, -0.647273f,
- -0.647346f, -0.647419f, -0.647492f, -0.647565f, -0.647638f, -0.647711f, -0.647784f, -0.647857f,
- -0.647930f, -0.648003f, -0.648076f, -0.648149f, -0.648222f, -0.648295f, -0.648368f, -0.648441f,
- -0.648514f, -0.648587f, -0.648660f, -0.648733f, -0.648806f, -0.648879f, -0.648952f, -0.649025f,
- -0.649098f, -0.649171f, -0.649244f, -0.649317f, -0.649390f, -0.649463f, -0.649536f, -0.649608f,
- -0.649681f, -0.649754f, -0.649827f, -0.649900f, -0.649973f, -0.650046f, -0.650119f, -0.650191f,
- -0.650264f, -0.650337f, -0.650410f, -0.650483f, -0.650555f, -0.650628f, -0.650701f, -0.650774f,
- -0.650847f, -0.650919f, -0.650992f, -0.651065f, -0.651138f, -0.651211f, -0.651283f, -0.651356f,
- -0.651429f, -0.651502f, -0.651574f, -0.651647f, -0.651720f, -0.651792f, -0.651865f, -0.651938f,
- -0.652011f, -0.652083f, -0.652156f, -0.652229f, -0.652301f, -0.652374f, -0.652447f, -0.652519f,
- -0.652592f, -0.652665f, -0.652737f, -0.652810f, -0.652882f, -0.652955f, -0.653028f, -0.653100f,
- -0.653173f, -0.653245f, -0.653318f, -0.653391f, -0.653463f, -0.653536f, -0.653608f, -0.653681f,
- -0.653753f, -0.653826f, -0.653899f, -0.653971f, -0.654044f, -0.654116f, -0.654189f, -0.654261f,
- -0.654334f, -0.654406f, -0.654479f, -0.654551f, -0.654624f, -0.654696f, -0.654769f, -0.654841f,
- -0.654913f, -0.654986f, -0.655058f, -0.655131f, -0.655203f, -0.655276f, -0.655348f, -0.655420f,
- -0.655493f, -0.655565f, -0.655638f, -0.655710f, -0.655782f, -0.655855f, -0.655927f, -0.656000f,
- -0.656072f, -0.656144f, -0.656217f, -0.656289f, -0.656361f, -0.656434f, -0.656506f, -0.656578f,
- -0.656651f, -0.656723f, -0.656795f, -0.656867f, -0.656940f, -0.657012f, -0.657084f, -0.657157f,
- -0.657229f, -0.657301f, -0.657373f, -0.657446f, -0.657518f, -0.657590f, -0.657662f, -0.657734f,
- -0.657807f, -0.657879f, -0.657951f, -0.658023f, -0.658095f, -0.658168f, -0.658240f, -0.658312f,
- -0.658384f, -0.658456f, -0.658529f, -0.658601f, -0.658673f, -0.658745f, -0.658817f, -0.658889f,
- -0.658961f, -0.659033f, -0.659105f, -0.659178f, -0.659250f, -0.659322f, -0.659394f, -0.659466f,
- -0.659538f, -0.659610f, -0.659682f, -0.659754f, -0.659826f, -0.659898f, -0.659970f, -0.660042f,
- -0.660114f, -0.660186f, -0.660258f, -0.660330f, -0.660402f, -0.660474f, -0.660546f, -0.660618f,
- -0.660690f, -0.660762f, -0.660834f, -0.660906f, -0.660978f, -0.661050f, -0.661122f, -0.661194f,
- -0.661266f, -0.661338f, -0.661410f, -0.661482f, -0.661553f, -0.661625f, -0.661697f, -0.661769f,
- -0.661841f, -0.661913f, -0.661985f, -0.662057f, -0.662128f, -0.662200f, -0.662272f, -0.662344f,
- -0.662416f, -0.662488f, -0.662559f, -0.662631f, -0.662703f, -0.662775f, -0.662847f, -0.662918f,
- -0.662990f, -0.663062f, -0.663134f, -0.663205f, -0.663277f, -0.663349f, -0.663421f, -0.663492f,
- -0.663564f, -0.663636f, -0.663708f, -0.663779f, -0.663851f, -0.663923f, -0.663994f, -0.664066f,
- -0.664138f, -0.664209f, -0.664281f, -0.664353f, -0.664424f, -0.664496f, -0.664568f, -0.664639f,
- -0.664711f, -0.664783f, -0.664854f, -0.664926f, -0.664997f, -0.665069f, -0.665141f, -0.665212f,
- -0.665284f, -0.665355f, -0.665427f, -0.665498f, -0.665570f, -0.665642f, -0.665713f, -0.665785f,
- -0.665856f, -0.665928f, -0.665999f, -0.666071f, -0.666142f, -0.666214f, -0.666285f, -0.666357f,
- -0.666428f, -0.666500f, -0.666571f, -0.666643f, -0.666714f, -0.666786f, -0.666857f, -0.666928f,
- -0.667000f, -0.667071f, -0.667143f, -0.667214f, -0.667286f, -0.667357f, -0.667428f, -0.667500f,
- -0.667571f, -0.667643f, -0.667714f, -0.667785f, -0.667857f, -0.667928f, -0.667999f, -0.668071f,
- -0.668142f, -0.668213f, -0.668285f, -0.668356f, -0.668427f, -0.668499f, -0.668570f, -0.668641f,
- -0.668712f, -0.668784f, -0.668855f, -0.668926f, -0.668998f, -0.669069f, -0.669140f, -0.669211f,
- -0.669283f, -0.669354f, -0.669425f, -0.669496f, -0.669567f, -0.669639f, -0.669710f, -0.669781f,
- -0.669852f, -0.669923f, -0.669995f, -0.670066f, -0.670137f, -0.670208f, -0.670279f, -0.670350f,
- -0.670422f, -0.670493f, -0.670564f, -0.670635f, -0.670706f, -0.670777f, -0.670848f, -0.670919f,
- -0.670990f, -0.671062f, -0.671133f, -0.671204f, -0.671275f, -0.671346f, -0.671417f, -0.671488f,
- -0.671559f, -0.671630f, -0.671701f, -0.671772f, -0.671843f, -0.671914f, -0.671985f, -0.672056f,
- -0.672127f, -0.672198f, -0.672269f, -0.672340f, -0.672411f, -0.672482f, -0.672553f, -0.672624f,
- -0.672695f, -0.672766f, -0.672837f, -0.672908f, -0.672978f, -0.673049f, -0.673120f, -0.673191f,
- -0.673262f, -0.673333f, -0.673404f, -0.673475f, -0.673546f, -0.673616f, -0.673687f, -0.673758f,
- -0.673829f, -0.673900f, -0.673971f, -0.674042f, -0.674112f, -0.674183f, -0.674254f, -0.674325f,
- -0.674396f, -0.674466f, -0.674537f, -0.674608f, -0.674679f, -0.674749f, -0.674820f, -0.674891f,
- -0.674962f, -0.675032f, -0.675103f, -0.675174f, -0.675245f, -0.675315f, -0.675386f, -0.675457f,
- -0.675527f, -0.675598f, -0.675669f, -0.675739f, -0.675810f, -0.675881f, -0.675951f, -0.676022f,
- -0.676093f, -0.676163f, -0.676234f, -0.676305f, -0.676375f, -0.676446f, -0.676516f, -0.676587f,
- -0.676658f, -0.676728f, -0.676799f, -0.676869f, -0.676940f, -0.677011f, -0.677081f, -0.677152f,
- -0.677222f, -0.677293f, -0.677363f, -0.677434f, -0.677504f, -0.677575f, -0.677645f, -0.677716f,
- -0.677786f, -0.677857f, -0.677927f, -0.677998f, -0.678068f, -0.678139f, -0.678209f, -0.678280f,
- -0.678350f, -0.678420f, -0.678491f, -0.678561f, -0.678632f, -0.678702f, -0.678773f, -0.678843f,
- -0.678913f, -0.678984f, -0.679054f, -0.679125f, -0.679195f, -0.679265f, -0.679336f, -0.679406f,
- -0.679476f, -0.679547f, -0.679617f, -0.679687f, -0.679758f, -0.679828f, -0.679898f, -0.679969f,
- -0.680039f, -0.680109f, -0.680179f, -0.680250f, -0.680320f, -0.680390f, -0.680461f, -0.680531f,
- -0.680601f, -0.680671f, -0.680741f, -0.680812f, -0.680882f, -0.680952f, -0.681022f, -0.681093f,
- -0.681163f, -0.681233f, -0.681303f, -0.681373f, -0.681443f, -0.681514f, -0.681584f, -0.681654f,
- -0.681724f, -0.681794f, -0.681864f, -0.681934f, -0.682005f, -0.682075f, -0.682145f, -0.682215f,
- -0.682285f, -0.682355f, -0.682425f, -0.682495f, -0.682565f, -0.682635f, -0.682705f, -0.682775f,
- -0.682846f, -0.682916f, -0.682986f, -0.683056f, -0.683126f, -0.683196f, -0.683266f, -0.683336f,
- -0.683406f, -0.683476f, -0.683546f, -0.683616f, -0.683686f, -0.683756f, -0.683825f, -0.683895f,
- -0.683965f, -0.684035f, -0.684105f, -0.684175f, -0.684245f, -0.684315f, -0.684385f, -0.684455f,
- -0.684525f, -0.684595f, -0.684664f, -0.684734f, -0.684804f, -0.684874f, -0.684944f, -0.685014f,
- -0.685084f, -0.685153f, -0.685223f, -0.685293f, -0.685363f, -0.685433f, -0.685503f, -0.685572f,
- -0.685642f, -0.685712f, -0.685782f, -0.685852f, -0.685921f, -0.685991f, -0.686061f, -0.686131f,
- -0.686200f, -0.686270f, -0.686340f, -0.686409f, -0.686479f, -0.686549f, -0.686619f, -0.686688f,
- -0.686758f, -0.686828f, -0.686897f, -0.686967f, -0.687037f, -0.687106f, -0.687176f, -0.687246f,
- -0.687315f, -0.687385f, -0.687455f, -0.687524f, -0.687594f, -0.687663f, -0.687733f, -0.687803f,
- -0.687872f, -0.687942f, -0.688011f, -0.688081f, -0.688151f, -0.688220f, -0.688290f, -0.688359f,
- -0.688429f, -0.688498f, -0.688568f, -0.688637f, -0.688707f, -0.688776f, -0.688846f, -0.688915f,
- -0.688985f, -0.689054f, -0.689124f, -0.689193f, -0.689263f, -0.689332f, -0.689402f, -0.689471f,
- -0.689541f, -0.689610f, -0.689679f, -0.689749f, -0.689818f, -0.689888f, -0.689957f, -0.690026f,
- -0.690096f, -0.690165f, -0.690235f, -0.690304f, -0.690373f, -0.690443f, -0.690512f, -0.690581f,
- -0.690651f, -0.690720f, -0.690789f, -0.690859f, -0.690928f, -0.690997f, -0.691067f, -0.691136f,
- -0.691205f, -0.691274f, -0.691344f, -0.691413f, -0.691482f, -0.691552f, -0.691621f, -0.691690f,
- -0.691759f, -0.691828f, -0.691898f, -0.691967f, -0.692036f, -0.692105f, -0.692175f, -0.692244f,
- -0.692313f, -0.692382f, -0.692451f, -0.692520f, -0.692590f, -0.692659f, -0.692728f, -0.692797f,
- -0.692866f, -0.692935f, -0.693004f, -0.693074f, -0.693143f, -0.693212f, -0.693281f, -0.693350f,
- -0.693419f, -0.693488f, -0.693557f, -0.693626f, -0.693695f, -0.693764f, -0.693833f, -0.693902f,
- -0.693971f, -0.694040f, -0.694109f, -0.694179f, -0.694248f, -0.694317f, -0.694386f, -0.694454f,
- -0.694524f, -0.694592f, -0.694661f, -0.694730f, -0.694799f, -0.694868f, -0.694937f, -0.695006f,
- -0.695075f, -0.695144f, -0.695213f, -0.695282f, -0.695351f, -0.695420f, -0.695489f, -0.695557f,
- -0.695626f, -0.695695f, -0.695764f, -0.695833f, -0.695902f, -0.695971f, -0.696039f, -0.696108f,
- -0.696177f, -0.696246f, -0.696315f, -0.696384f, -0.696452f, -0.696521f, -0.696590f, -0.696659f,
- -0.696728f, -0.696796f, -0.696865f, -0.696934f, -0.697003f, -0.697071f, -0.697140f, -0.697209f,
- -0.697277f, -0.697346f, -0.697415f, -0.697484f, -0.697552f, -0.697621f, -0.697690f, -0.697758f,
- -0.697827f, -0.697896f, -0.697964f, -0.698033f, -0.698102f, -0.698170f, -0.698239f, -0.698308f,
- -0.698376f, -0.698445f, -0.698513f, -0.698582f, -0.698651f, -0.698719f, -0.698788f, -0.698856f,
- -0.698925f, -0.698994f, -0.699062f, -0.699131f, -0.699199f, -0.699268f, -0.699336f, -0.699405f,
- -0.699473f, -0.699542f, -0.699610f, -0.699679f, -0.699747f, -0.699816f, -0.699884f, -0.699953f,
- -0.700021f, -0.700090f, -0.700158f, -0.700227f, -0.700295f, -0.700364f, -0.700432f, -0.700500f,
- -0.700569f, -0.700637f, -0.700706f, -0.700774f, -0.700842f, -0.700911f, -0.700979f, -0.701048f,
- -0.701116f, -0.701184f, -0.701253f, -0.701321f, -0.701389f, -0.701458f, -0.701526f, -0.701594f,
- -0.701663f, -0.701731f, -0.701799f, -0.701868f, -0.701936f, -0.702004f, -0.702072f, -0.702141f,
- -0.702209f, -0.702277f, -0.702345f, -0.702414f, -0.702482f, -0.702550f, -0.702618f, -0.702687f,
- -0.702755f, -0.702823f, -0.702891f, -0.702959f, -0.703028f, -0.703096f, -0.703164f, -0.703232f,
- -0.703300f, -0.703368f, -0.703436f, -0.703505f, -0.703573f, -0.703641f, -0.703709f, -0.703777f,
- -0.703845f, -0.703913f, -0.703981f, -0.704050f, -0.704118f, -0.704186f, -0.704254f, -0.704322f,
- -0.704390f, -0.704458f, -0.704526f, -0.704594f, -0.704662f, -0.704730f, -0.704798f, -0.704866f,
- -0.704934f, -0.705002f, -0.705070f, -0.705138f, -0.705206f, -0.705274f, -0.705342f, -0.705410f,
- -0.705478f, -0.705546f, -0.705614f, -0.705682f, -0.705750f, -0.705818f, -0.705885f, -0.705953f,
- -0.706021f, -0.706089f, -0.706157f, -0.706225f, -0.706293f, -0.706361f, -0.706429f, -0.706496f,
- -0.706564f, -0.706632f, -0.706700f, -0.706768f, -0.706836f, -0.706903f, -0.706971f, -0.707039f,
- -0.707107f, -0.707175f, -0.707242f, -0.707310f, -0.707378f, -0.707446f, -0.707513f, -0.707581f,
- -0.707649f, -0.707717f, -0.707784f, -0.707852f, -0.707920f, -0.707988f, -0.708055f, -0.708123f,
- -0.708191f, -0.708258f, -0.708326f, -0.708394f, -0.708461f, -0.708529f, -0.708597f, -0.708664f,
- -0.708732f, -0.708800f, -0.708867f, -0.708935f, -0.709002f, -0.709070f, -0.709138f, -0.709205f,
- -0.709273f, -0.709340f, -0.709408f, -0.709476f, -0.709543f, -0.709611f, -0.709678f, -0.709746f,
- -0.709813f, -0.709881f, -0.709948f, -0.710016f, -0.710083f, -0.710151f, -0.710218f, -0.710286f,
- -0.710353f, -0.710421f, -0.710488f, -0.710556f, -0.710623f, -0.710691f, -0.710758f, -0.710826f,
- -0.710893f, -0.710960f, -0.711028f, -0.711095f, -0.711163f, -0.711230f, -0.711297f, -0.711365f,
- -0.711432f, -0.711500f, -0.711567f, -0.711634f, -0.711702f, -0.711769f, -0.711836f, -0.711904f,
- -0.711971f, -0.712038f, -0.712106f, -0.712173f, -0.712240f, -0.712308f, -0.712375f, -0.712442f,
- -0.712509f, -0.712577f, -0.712644f, -0.712711f, -0.712778f, -0.712846f, -0.712913f, -0.712980f,
- -0.713047f, -0.713115f, -0.713182f, -0.713249f, -0.713316f, -0.713383f, -0.713451f, -0.713518f,
- -0.713585f, -0.713652f, -0.713719f, -0.713786f, -0.713853f, -0.713921f, -0.713988f, -0.714055f,
- -0.714122f, -0.714189f, -0.714256f, -0.714323f, -0.714390f, -0.714457f, -0.714525f, -0.714592f,
- -0.714659f, -0.714726f, -0.714793f, -0.714860f, -0.714927f, -0.714994f, -0.715061f, -0.715128f,
- -0.715195f, -0.715262f, -0.715329f, -0.715396f, -0.715463f, -0.715530f, -0.715597f, -0.715664f,
- -0.715731f, -0.715798f, -0.715865f, -0.715932f, -0.715999f, -0.716066f, -0.716132f, -0.716199f,
- -0.716266f, -0.716333f, -0.716400f, -0.716467f, -0.716534f, -0.716601f, -0.716668f, -0.716734f,
- -0.716801f, -0.716868f, -0.716935f, -0.717002f, -0.717069f, -0.717135f, -0.717202f, -0.717269f,
- -0.717336f, -0.717403f, -0.717469f, -0.717536f, -0.717603f, -0.717670f, -0.717737f, -0.717803f,
- -0.717870f, -0.717937f, -0.718004f, -0.718070f, -0.718137f, -0.718204f, -0.718270f, -0.718337f,
- -0.718404f, -0.718471f, -0.718537f, -0.718604f, -0.718670f, -0.718737f, -0.718804f, -0.718870f,
- -0.718937f, -0.719004f, -0.719070f, -0.719137f, -0.719204f, -0.719270f, -0.719337f, -0.719403f,
- -0.719470f, -0.719537f, -0.719603f, -0.719670f, -0.719736f, -0.719803f, -0.719869f, -0.719936f,
- -0.720003f, -0.720069f, -0.720136f, -0.720202f, -0.720269f, -0.720335f, -0.720402f, -0.720468f,
- -0.720535f, -0.720601f, -0.720668f, -0.720734f, -0.720800f, -0.720867f, -0.720933f, -0.721000f,
- -0.721066f, -0.721133f, -0.721199f, -0.721265f, -0.721332f, -0.721398f, -0.721465f, -0.721531f,
- -0.721597f, -0.721664f, -0.721730f, -0.721797f, -0.721863f, -0.721929f, -0.721996f, -0.722062f,
- -0.722128f, -0.722194f, -0.722261f, -0.722327f, -0.722393f, -0.722460f, -0.722526f, -0.722592f,
- -0.722659f, -0.722725f, -0.722791f, -0.722857f, -0.722924f, -0.722990f, -0.723056f, -0.723122f,
- -0.723188f, -0.723255f, -0.723321f, -0.723387f, -0.723453f, -0.723520f, -0.723586f, -0.723652f,
- -0.723718f, -0.723784f, -0.723850f, -0.723916f, -0.723983f, -0.724049f, -0.724115f, -0.724181f,
- -0.724247f, -0.724313f, -0.724379f, -0.724445f, -0.724511f, -0.724578f, -0.724644f, -0.724710f,
- -0.724776f, -0.724842f, -0.724908f, -0.724974f, -0.725040f, -0.725106f, -0.725172f, -0.725238f,
- -0.725304f, -0.725370f, -0.725436f, -0.725502f, -0.725568f, -0.725634f, -0.725700f, -0.725766f,
- -0.725832f, -0.725898f, -0.725964f, -0.726030f, -0.726095f, -0.726161f, -0.726227f, -0.726293f,
- -0.726359f, -0.726425f, -0.726491f, -0.726557f, -0.726623f, -0.726689f, -0.726754f, -0.726820f,
- -0.726886f, -0.726952f, -0.727018f, -0.727084f, -0.727149f, -0.727215f, -0.727281f, -0.727347f,
- -0.727413f, -0.727478f, -0.727544f, -0.727610f, -0.727676f, -0.727741f, -0.727807f, -0.727873f,
- -0.727939f, -0.728004f, -0.728070f, -0.728136f, -0.728202f, -0.728267f, -0.728333f, -0.728399f,
- -0.728464f, -0.728530f, -0.728596f, -0.728661f, -0.728727f, -0.728793f, -0.728858f, -0.728924f,
- -0.728990f, -0.729055f, -0.729121f, -0.729186f, -0.729252f, -0.729318f, -0.729383f, -0.729449f,
- -0.729514f, -0.729580f, -0.729646f, -0.729711f, -0.729777f, -0.729842f, -0.729908f, -0.729973f,
- -0.730039f, -0.730104f, -0.730170f, -0.730235f, -0.730301f, -0.730366f, -0.730432f, -0.730497f,
- -0.730563f, -0.730628f, -0.730694f, -0.730759f, -0.730825f, -0.730890f, -0.730955f, -0.731021f,
- -0.731086f, -0.731152f, -0.731217f, -0.731282f, -0.731348f, -0.731413f, -0.731479f, -0.731544f,
- -0.731609f, -0.731675f, -0.731740f, -0.731805f, -0.731871f, -0.731936f, -0.732001f, -0.732067f,
- -0.732132f, -0.732197f, -0.732263f, -0.732328f, -0.732393f, -0.732458f, -0.732524f, -0.732589f,
- -0.732654f, -0.732720f, -0.732785f, -0.732850f, -0.732915f, -0.732980f, -0.733046f, -0.733111f,
- -0.733176f, -0.733241f, -0.733306f, -0.733372f, -0.733437f, -0.733502f, -0.733567f, -0.733632f,
- -0.733697f, -0.733763f, -0.733828f, -0.733893f, -0.733958f, -0.734023f, -0.734088f, -0.734153f,
- -0.734218f, -0.734283f, -0.734349f, -0.734414f, -0.734479f, -0.734544f, -0.734609f, -0.734674f,
- -0.734739f, -0.734804f, -0.734869f, -0.734934f, -0.734999f, -0.735064f, -0.735129f, -0.735194f,
- -0.735259f, -0.735324f, -0.735389f, -0.735454f, -0.735519f, -0.735584f, -0.735649f, -0.735714f,
- -0.735779f, -0.735844f, -0.735908f, -0.735973f, -0.736038f, -0.736103f, -0.736168f, -0.736233f,
- -0.736298f, -0.736363f, -0.736428f, -0.736492f, -0.736557f, -0.736622f, -0.736687f, -0.736752f,
- -0.736817f, -0.736881f, -0.736946f, -0.737011f, -0.737076f, -0.737141f, -0.737205f, -0.737270f,
- -0.737335f, -0.737400f, -0.737464f, -0.737529f, -0.737594f, -0.737659f, -0.737723f, -0.737788f,
- -0.737853f, -0.737918f, -0.737982f, -0.738047f, -0.738112f, -0.738176f, -0.738241f, -0.738306f,
- -0.738370f, -0.738435f, -0.738500f, -0.738564f, -0.738629f, -0.738693f, -0.738758f, -0.738823f,
- -0.738887f, -0.738952f, -0.739017f, -0.739081f, -0.739146f, -0.739210f, -0.739275f, -0.739339f,
- -0.739404f, -0.739468f, -0.739533f, -0.739598f, -0.739662f, -0.739727f, -0.739791f, -0.739856f,
- -0.739920f, -0.739985f, -0.740049f, -0.740114f, -0.740178f, -0.740242f, -0.740307f, -0.740371f,
- -0.740436f, -0.740500f, -0.740565f, -0.740629f, -0.740694f, -0.740758f, -0.740822f, -0.740887f,
- -0.740951f, -0.741015f, -0.741080f, -0.741144f, -0.741209f, -0.741273f, -0.741337f, -0.741402f,
- -0.741466f, -0.741530f, -0.741595f, -0.741659f, -0.741723f, -0.741788f, -0.741852f, -0.741916f,
- -0.741980f, -0.742045f, -0.742109f, -0.742173f, -0.742237f, -0.742302f, -0.742366f, -0.742430f,
- -0.742494f, -0.742559f, -0.742623f, -0.742687f, -0.742751f, -0.742815f, -0.742880f, -0.742944f,
- -0.743008f, -0.743072f, -0.743136f, -0.743200f, -0.743265f, -0.743329f, -0.743393f, -0.743457f,
- -0.743521f, -0.743585f, -0.743649f, -0.743713f, -0.743777f, -0.743842f, -0.743906f, -0.743970f,
- -0.744034f, -0.744098f, -0.744162f, -0.744226f, -0.744290f, -0.744354f, -0.744418f, -0.744482f,
- -0.744546f, -0.744610f, -0.744674f, -0.744738f, -0.744802f, -0.744866f, -0.744930f, -0.744994f,
- -0.745058f, -0.745122f, -0.745186f, -0.745250f, -0.745314f, -0.745377f, -0.745441f, -0.745505f,
- -0.745569f, -0.745633f, -0.745697f, -0.745761f, -0.745825f, -0.745889f, -0.745952f, -0.746016f,
- -0.746080f, -0.746144f, -0.746208f, -0.746272f, -0.746335f, -0.746399f, -0.746463f, -0.746527f,
- -0.746591f, -0.746654f, -0.746718f, -0.746782f, -0.746846f, -0.746909f, -0.746973f, -0.747037f,
- -0.747101f, -0.747164f, -0.747228f, -0.747292f, -0.747355f, -0.747419f, -0.747483f, -0.747547f,
- -0.747610f, -0.747674f, -0.747738f, -0.747801f, -0.747865f, -0.747929f, -0.747992f, -0.748056f,
- -0.748119f, -0.748183f, -0.748247f, -0.748310f, -0.748374f, -0.748437f, -0.748501f, -0.748565f,
- -0.748628f, -0.748692f, -0.748755f, -0.748819f, -0.748882f, -0.748946f, -0.749009f, -0.749073f,
- -0.749136f, -0.749200f, -0.749263f, -0.749327f, -0.749390f, -0.749454f, -0.749517f, -0.749581f,
- -0.749644f, -0.749708f, -0.749771f, -0.749835f, -0.749898f, -0.749961f, -0.750025f, -0.750088f,
- -0.750152f, -0.750215f, -0.750278f, -0.750342f, -0.750405f, -0.750469f, -0.750532f, -0.750595f,
- -0.750659f, -0.750722f, -0.750785f, -0.750849f, -0.750912f, -0.750975f, -0.751039f, -0.751102f,
- -0.751165f, -0.751228f, -0.751292f, -0.751355f, -0.751418f, -0.751481f, -0.751545f, -0.751608f,
- -0.751671f, -0.751734f, -0.751798f, -0.751861f, -0.751924f, -0.751987f, -0.752050f, -0.752114f,
- -0.752177f, -0.752240f, -0.752303f, -0.752366f, -0.752429f, -0.752493f, -0.752556f, -0.752619f,
- -0.752682f, -0.752745f, -0.752808f, -0.752871f, -0.752934f, -0.752998f, -0.753061f, -0.753124f,
- -0.753187f, -0.753250f, -0.753313f, -0.753376f, -0.753439f, -0.753502f, -0.753565f, -0.753628f,
- -0.753691f, -0.753754f, -0.753817f, -0.753880f, -0.753943f, -0.754006f, -0.754069f, -0.754132f,
- -0.754195f, -0.754258f, -0.754321f, -0.754384f, -0.754447f, -0.754510f, -0.754573f, -0.754636f,
- -0.754698f, -0.754761f, -0.754824f, -0.754887f, -0.754950f, -0.755013f, -0.755076f, -0.755139f,
- -0.755201f, -0.755264f, -0.755327f, -0.755390f, -0.755453f, -0.755516f, -0.755578f, -0.755641f,
- -0.755704f, -0.755767f, -0.755829f, -0.755892f, -0.755955f, -0.756018f, -0.756081f, -0.756143f,
- -0.756206f, -0.756269f, -0.756331f, -0.756394f, -0.756457f, -0.756520f, -0.756582f, -0.756645f,
- -0.756708f, -0.756770f, -0.756833f, -0.756896f, -0.756958f, -0.757021f, -0.757084f, -0.757146f,
- -0.757209f, -0.757271f, -0.757334f, -0.757397f, -0.757459f, -0.757522f, -0.757584f, -0.757647f,
- -0.757710f, -0.757772f, -0.757835f, -0.757897f, -0.757960f, -0.758022f, -0.758085f, -0.758147f,
- -0.758210f, -0.758272f, -0.758335f, -0.758397f, -0.758460f, -0.758522f, -0.758585f, -0.758647f,
- -0.758710f, -0.758772f, -0.758835f, -0.758897f, -0.758960f, -0.759022f, -0.759084f, -0.759147f,
- -0.759209f, -0.759272f, -0.759334f, -0.759396f, -0.759459f, -0.759521f, -0.759583f, -0.759646f,
- -0.759708f, -0.759771f, -0.759833f, -0.759895f, -0.759957f, -0.760020f, -0.760082f, -0.760144f,
- -0.760207f, -0.760269f, -0.760331f, -0.760394f, -0.760456f, -0.760518f, -0.760580f, -0.760643f,
- -0.760705f, -0.760767f, -0.760829f, -0.760891f, -0.760954f, -0.761016f, -0.761078f, -0.761140f,
- -0.761202f, -0.761265f, -0.761327f, -0.761389f, -0.761451f, -0.761513f, -0.761575f, -0.761637f,
- -0.761700f, -0.761762f, -0.761824f, -0.761886f, -0.761948f, -0.762010f, -0.762072f, -0.762134f,
- -0.762196f, -0.762258f, -0.762320f, -0.762382f, -0.762444f, -0.762507f, -0.762569f, -0.762631f,
- -0.762693f, -0.762755f, -0.762817f, -0.762879f, -0.762941f, -0.763003f, -0.763065f, -0.763126f,
- -0.763188f, -0.763250f, -0.763312f, -0.763374f, -0.763436f, -0.763498f, -0.763560f, -0.763622f,
- -0.763684f, -0.763746f, -0.763808f, -0.763869f, -0.763931f, -0.763993f, -0.764055f, -0.764117f,
- -0.764179f, -0.764241f, -0.764302f, -0.764364f, -0.764426f, -0.764488f, -0.764550f, -0.764611f,
- -0.764673f, -0.764735f, -0.764797f, -0.764859f, -0.764920f, -0.764982f, -0.765044f, -0.765106f,
- -0.765167f, -0.765229f, -0.765291f, -0.765352f, -0.765414f, -0.765476f, -0.765538f, -0.765599f,
- -0.765661f, -0.765723f, -0.765784f, -0.765846f, -0.765907f, -0.765969f, -0.766031f, -0.766092f,
- -0.766154f, -0.766216f, -0.766277f, -0.766339f, -0.766400f, -0.766462f, -0.766524f, -0.766585f,
- -0.766647f, -0.766708f, -0.766770f, -0.766831f, -0.766893f, -0.766954f, -0.767016f, -0.767077f,
- -0.767139f, -0.767200f, -0.767262f, -0.767323f, -0.767385f, -0.767446f, -0.767508f, -0.767569f,
- -0.767631f, -0.767692f, -0.767754f, -0.767815f, -0.767876f, -0.767938f, -0.767999f, -0.768061f,
- -0.768122f, -0.768183f, -0.768245f, -0.768306f, -0.768368f, -0.768429f, -0.768490f, -0.768552f,
- -0.768613f, -0.768674f, -0.768736f, -0.768797f, -0.768858f, -0.768919f, -0.768981f, -0.769042f,
- -0.769103f, -0.769165f, -0.769226f, -0.769287f, -0.769348f, -0.769410f, -0.769471f, -0.769532f,
- -0.769593f, -0.769655f, -0.769716f, -0.769777f, -0.769838f, -0.769899f, -0.769961f, -0.770022f,
- -0.770083f, -0.770144f, -0.770205f, -0.770266f, -0.770327f, -0.770389f, -0.770450f, -0.770511f,
- -0.770572f, -0.770633f, -0.770694f, -0.770755f, -0.770816f, -0.770877f, -0.770938f, -0.770999f,
- -0.771061f, -0.771122f, -0.771183f, -0.771244f, -0.771305f, -0.771366f, -0.771427f, -0.771488f,
- -0.771549f, -0.771610f, -0.771671f, -0.771732f, -0.771793f, -0.771854f, -0.771915f, -0.771975f,
- -0.772036f, -0.772097f, -0.772158f, -0.772219f, -0.772280f, -0.772341f, -0.772402f, -0.772463f,
- -0.772524f, -0.772584f, -0.772645f, -0.772706f, -0.772767f, -0.772828f, -0.772889f, -0.772950f,
- -0.773010f, -0.773071f, -0.773132f, -0.773193f, -0.773254f, -0.773314f, -0.773375f, -0.773436f,
- -0.773497f, -0.773558f, -0.773618f, -0.773679f, -0.773740f, -0.773801f, -0.773861f, -0.773922f,
- -0.773983f, -0.774043f, -0.774104f, -0.774165f, -0.774225f, -0.774286f, -0.774347f, -0.774407f,
- -0.774468f, -0.774529f, -0.774589f, -0.774650f, -0.774711f, -0.774771f, -0.774832f, -0.774893f,
- -0.774953f, -0.775014f, -0.775074f, -0.775135f, -0.775195f, -0.775256f, -0.775317f, -0.775377f,
- -0.775438f, -0.775498f, -0.775559f, -0.775619f, -0.775680f, -0.775740f, -0.775801f, -0.775861f,
- -0.775922f, -0.775982f, -0.776043f, -0.776103f, -0.776164f, -0.776224f, -0.776284f, -0.776345f,
- -0.776405f, -0.776466f, -0.776526f, -0.776587f, -0.776647f, -0.776707f, -0.776768f, -0.776828f,
- -0.776888f, -0.776949f, -0.777009f, -0.777070f, -0.777130f, -0.777190f, -0.777251f, -0.777311f,
- -0.777371f, -0.777431f, -0.777492f, -0.777552f, -0.777612f, -0.777673f, -0.777733f, -0.777793f,
- -0.777853f, -0.777914f, -0.777974f, -0.778034f, -0.778094f, -0.778155f, -0.778215f, -0.778275f,
- -0.778335f, -0.778395f, -0.778456f, -0.778516f, -0.778576f, -0.778636f, -0.778696f, -0.778756f,
- -0.778817f, -0.778877f, -0.778937f, -0.778997f, -0.779057f, -0.779117f, -0.779177f, -0.779237f,
- -0.779297f, -0.779357f, -0.779418f, -0.779478f, -0.779538f, -0.779598f, -0.779658f, -0.779718f,
- -0.779778f, -0.779838f, -0.779898f, -0.779958f, -0.780018f, -0.780078f, -0.780138f, -0.780198f,
- -0.780258f, -0.780318f, -0.780378f, -0.780438f, -0.780498f, -0.780557f, -0.780617f, -0.780677f,
- -0.780737f, -0.780797f, -0.780857f, -0.780917f, -0.780977f, -0.781037f, -0.781097f, -0.781156f,
- -0.781216f, -0.781276f, -0.781336f, -0.781396f, -0.781456f, -0.781515f, -0.781575f, -0.781635f,
- -0.781695f, -0.781755f, -0.781814f, -0.781874f, -0.781934f, -0.781994f, -0.782053f, -0.782113f,
- -0.782173f, -0.782233f, -0.782292f, -0.782352f, -0.782412f, -0.782472f, -0.782531f, -0.782591f,
- -0.782651f, -0.782710f, -0.782770f, -0.782830f, -0.782889f, -0.782949f, -0.783009f, -0.783068f,
- -0.783128f, -0.783187f, -0.783247f, -0.783307f, -0.783366f, -0.783426f, -0.783485f, -0.783545f,
- -0.783605f, -0.783664f, -0.783724f, -0.783783f, -0.783843f, -0.783902f, -0.783962f, -0.784021f,
- -0.784081f, -0.784140f, -0.784200f, -0.784259f, -0.784319f, -0.784378f, -0.784438f, -0.784497f,
- -0.784557f, -0.784616f, -0.784675f, -0.784735f, -0.784794f, -0.784854f, -0.784913f, -0.784973f,
- -0.785032f, -0.785091f, -0.785151f, -0.785210f, -0.785269f, -0.785329f, -0.785388f, -0.785447f,
- -0.785507f, -0.785566f, -0.785625f, -0.785685f, -0.785744f, -0.785803f, -0.785863f, -0.785922f,
- -0.785981f, -0.786041f, -0.786100f, -0.786159f, -0.786218f, -0.786278f, -0.786337f, -0.786396f,
- -0.786455f, -0.786514f, -0.786574f, -0.786633f, -0.786692f, -0.786751f, -0.786810f, -0.786870f,
- -0.786929f, -0.786988f, -0.787047f, -0.787106f, -0.787165f, -0.787224f, -0.787284f, -0.787343f,
- -0.787402f, -0.787461f, -0.787520f, -0.787579f, -0.787638f, -0.787697f, -0.787756f, -0.787815f,
- -0.787874f, -0.787933f, -0.787992f, -0.788051f, -0.788110f, -0.788169f, -0.788228f, -0.788287f,
- -0.788346f, -0.788405f, -0.788464f, -0.788523f, -0.788582f, -0.788641f, -0.788700f, -0.788759f,
- -0.788818f, -0.788877f, -0.788936f, -0.788995f, -0.789054f, -0.789113f, -0.789172f, -0.789230f,
- -0.789289f, -0.789348f, -0.789407f, -0.789466f, -0.789525f, -0.789584f, -0.789642f, -0.789701f,
- -0.789760f, -0.789819f, -0.789878f, -0.789936f, -0.789995f, -0.790054f, -0.790113f, -0.790171f,
- -0.790230f, -0.790289f, -0.790348f, -0.790406f, -0.790465f, -0.790524f, -0.790583f, -0.790641f,
- -0.790700f, -0.790759f, -0.790817f, -0.790876f, -0.790935f, -0.790993f, -0.791052f, -0.791111f,
- -0.791169f, -0.791228f, -0.791287f, -0.791345f, -0.791404f, -0.791462f, -0.791521f, -0.791580f,
- -0.791638f, -0.791697f, -0.791755f, -0.791814f, -0.791872f, -0.791931f, -0.791990f, -0.792048f,
- -0.792107f, -0.792165f, -0.792224f, -0.792282f, -0.792341f, -0.792399f, -0.792458f, -0.792516f,
- -0.792575f, -0.792633f, -0.792691f, -0.792750f, -0.792808f, -0.792867f, -0.792925f, -0.792984f,
- -0.793042f, -0.793100f, -0.793159f, -0.793217f, -0.793276f, -0.793334f, -0.793392f, -0.793451f,
- -0.793509f, -0.793567f, -0.793626f, -0.793684f, -0.793742f, -0.793801f, -0.793859f, -0.793917f,
- -0.793975f, -0.794034f, -0.794092f, -0.794150f, -0.794209f, -0.794267f, -0.794325f, -0.794383f,
- -0.794442f, -0.794500f, -0.794558f, -0.794616f, -0.794674f, -0.794733f, -0.794791f, -0.794849f,
- -0.794907f, -0.794965f, -0.795023f, -0.795082f, -0.795140f, -0.795198f, -0.795256f, -0.795314f,
- -0.795372f, -0.795430f, -0.795488f, -0.795547f, -0.795605f, -0.795663f, -0.795721f, -0.795779f,
- -0.795837f, -0.795895f, -0.795953f, -0.796011f, -0.796069f, -0.796127f, -0.796185f, -0.796243f,
- -0.796301f, -0.796359f, -0.796417f, -0.796475f, -0.796533f, -0.796591f, -0.796649f, -0.796707f,
- -0.796765f, -0.796823f, -0.796881f, -0.796939f, -0.796996f, -0.797054f, -0.797112f, -0.797170f,
- -0.797228f, -0.797286f, -0.797344f, -0.797402f, -0.797459f, -0.797517f, -0.797575f, -0.797633f,
- -0.797691f, -0.797749f, -0.797806f, -0.797864f, -0.797922f, -0.797980f, -0.798038f, -0.798095f,
- -0.798153f, -0.798211f, -0.798269f, -0.798326f, -0.798384f, -0.798442f, -0.798500f, -0.798557f,
- -0.798615f, -0.798673f, -0.798730f, -0.798788f, -0.798846f, -0.798903f, -0.798961f, -0.799019f,
- -0.799076f, -0.799134f, -0.799192f, -0.799249f, -0.799307f, -0.799365f, -0.799422f, -0.799480f,
- -0.799537f, -0.799595f, -0.799652f, -0.799710f, -0.799768f, -0.799825f, -0.799883f, -0.799940f,
- -0.799998f, -0.800055f, -0.800113f, -0.800170f, -0.800228f, -0.800285f, -0.800343f, -0.800400f,
- -0.800458f, -0.800515f, -0.800573f, -0.800630f, -0.800687f, -0.800745f, -0.800802f, -0.800860f,
- -0.800917f, -0.800975f, -0.801032f, -0.801089f, -0.801147f, -0.801204f, -0.801261f, -0.801319f,
- -0.801376f, -0.801434f, -0.801491f, -0.801548f, -0.801606f, -0.801663f, -0.801720f, -0.801777f,
- -0.801835f, -0.801892f, -0.801949f, -0.802007f, -0.802064f, -0.802121f, -0.802178f, -0.802236f,
- -0.802293f, -0.802350f, -0.802407f, -0.802464f, -0.802522f, -0.802579f, -0.802636f, -0.802693f,
- -0.802750f, -0.802808f, -0.802865f, -0.802922f, -0.802979f, -0.803036f, -0.803093f, -0.803150f,
- -0.803208f, -0.803265f, -0.803322f, -0.803379f, -0.803436f, -0.803493f, -0.803550f, -0.803607f,
- -0.803664f, -0.803721f, -0.803778f, -0.803835f, -0.803892f, -0.803949f, -0.804006f, -0.804063f,
- -0.804120f, -0.804177f, -0.804234f, -0.804291f, -0.804348f, -0.804405f, -0.804462f, -0.804519f,
- -0.804576f, -0.804633f, -0.804690f, -0.804747f, -0.804804f, -0.804861f, -0.804918f, -0.804974f,
- -0.805031f, -0.805088f, -0.805145f, -0.805202f, -0.805259f, -0.805316f, -0.805372f, -0.805429f,
- -0.805486f, -0.805543f, -0.805600f, -0.805656f, -0.805713f, -0.805770f, -0.805827f, -0.805884f,
- -0.805940f, -0.805997f, -0.806054f, -0.806111f, -0.806167f, -0.806224f, -0.806281f, -0.806338f,
- -0.806394f, -0.806451f, -0.806508f, -0.806564f, -0.806621f, -0.806678f, -0.806734f, -0.806791f,
- -0.806848f, -0.806904f, -0.806961f, -0.807017f, -0.807074f, -0.807131f, -0.807187f, -0.807244f,
- -0.807300f, -0.807357f, -0.807414f, -0.807470f, -0.807527f, -0.807583f, -0.807640f, -0.807696f,
- -0.807753f, -0.807809f, -0.807866f, -0.807922f, -0.807979f, -0.808035f, -0.808092f, -0.808148f,
- -0.808205f, -0.808261f, -0.808318f, -0.808374f, -0.808430f, -0.808487f, -0.808543f, -0.808600f,
- -0.808656f, -0.808713f, -0.808769f, -0.808825f, -0.808882f, -0.808938f, -0.808994f, -0.809051f,
- -0.809107f, -0.809164f, -0.809220f, -0.809276f, -0.809332f, -0.809389f, -0.809445f, -0.809501f,
- -0.809558f, -0.809614f, -0.809670f, -0.809726f, -0.809783f, -0.809839f, -0.809895f, -0.809951f,
- -0.810008f, -0.810064f, -0.810120f, -0.810176f, -0.810232f, -0.810289f, -0.810345f, -0.810401f,
- -0.810457f, -0.810513f, -0.810570f, -0.810626f, -0.810682f, -0.810738f, -0.810794f, -0.810850f,
- -0.810906f, -0.810962f, -0.811018f, -0.811075f, -0.811131f, -0.811187f, -0.811243f, -0.811299f,
- -0.811355f, -0.811411f, -0.811467f, -0.811523f, -0.811579f, -0.811635f, -0.811691f, -0.811747f,
- -0.811803f, -0.811859f, -0.811915f, -0.811971f, -0.812027f, -0.812083f, -0.812139f, -0.812195f,
- -0.812251f, -0.812307f, -0.812362f, -0.812418f, -0.812474f, -0.812530f, -0.812586f, -0.812642f,
- -0.812698f, -0.812754f, -0.812809f, -0.812865f, -0.812921f, -0.812977f, -0.813033f, -0.813089f,
- -0.813144f, -0.813200f, -0.813256f, -0.813312f, -0.813368f, -0.813423f, -0.813479f, -0.813535f,
- -0.813591f, -0.813646f, -0.813702f, -0.813758f, -0.813814f, -0.813869f, -0.813925f, -0.813981f,
- -0.814036f, -0.814092f, -0.814148f, -0.814203f, -0.814259f, -0.814315f, -0.814370f, -0.814426f,
- -0.814482f, -0.814537f, -0.814593f, -0.814648f, -0.814704f, -0.814760f, -0.814815f, -0.814871f,
- -0.814926f, -0.814982f, -0.815037f, -0.815093f, -0.815149f, -0.815204f, -0.815260f, -0.815315f,
- -0.815371f, -0.815426f, -0.815482f, -0.815537f, -0.815593f, -0.815648f, -0.815704f, -0.815759f,
- -0.815814f, -0.815870f, -0.815925f, -0.815981f, -0.816036f, -0.816092f, -0.816147f, -0.816202f,
- -0.816258f, -0.816313f, -0.816368f, -0.816424f, -0.816479f, -0.816535f, -0.816590f, -0.816645f,
- -0.816701f, -0.816756f, -0.816811f, -0.816867f, -0.816922f, -0.816977f, -0.817032f, -0.817088f,
- -0.817143f, -0.817198f, -0.817253f, -0.817309f, -0.817364f, -0.817419f, -0.817474f, -0.817530f,
- -0.817585f, -0.817640f, -0.817695f, -0.817750f, -0.817806f, -0.817861f, -0.817916f, -0.817971f,
- -0.818026f, -0.818081f, -0.818137f, -0.818192f, -0.818247f, -0.818302f, -0.818357f, -0.818412f,
- -0.818467f, -0.818522f, -0.818577f, -0.818632f, -0.818687f, -0.818742f, -0.818798f, -0.818853f,
- -0.818908f, -0.818963f, -0.819018f, -0.819073f, -0.819128f, -0.819183f, -0.819238f, -0.819293f,
- -0.819348f, -0.819402f, -0.819457f, -0.819512f, -0.819567f, -0.819622f, -0.819677f, -0.819732f,
- -0.819787f, -0.819842f, -0.819897f, -0.819952f, -0.820007f, -0.820061f, -0.820116f, -0.820171f,
- -0.820226f, -0.820281f, -0.820336f, -0.820390f, -0.820445f, -0.820500f, -0.820555f, -0.820610f,
- -0.820664f, -0.820719f, -0.820774f, -0.820829f, -0.820884f, -0.820938f, -0.820993f, -0.821048f,
- -0.821102f, -0.821157f, -0.821212f, -0.821267f, -0.821321f, -0.821376f, -0.821431f, -0.821485f,
- -0.821540f, -0.821595f, -0.821649f, -0.821704f, -0.821759f, -0.821813f, -0.821868f, -0.821922f,
- -0.821977f, -0.822032f, -0.822086f, -0.822141f, -0.822195f, -0.822250f, -0.822305f, -0.822359f,
- -0.822414f, -0.822468f, -0.822523f, -0.822577f, -0.822632f, -0.822686f, -0.822741f, -0.822795f,
- -0.822850f, -0.822904f, -0.822959f, -0.823013f, -0.823068f, -0.823122f, -0.823177f, -0.823231f,
- -0.823285f, -0.823340f, -0.823394f, -0.823449f, -0.823503f, -0.823557f, -0.823612f, -0.823666f,
- -0.823721f, -0.823775f, -0.823829f, -0.823884f, -0.823938f, -0.823992f, -0.824047f, -0.824101f,
- -0.824155f, -0.824209f, -0.824264f, -0.824318f, -0.824372f, -0.824427f, -0.824481f, -0.824535f,
- -0.824589f, -0.824644f, -0.824698f, -0.824752f, -0.824806f, -0.824860f, -0.824915f, -0.824969f,
- -0.825023f, -0.825077f, -0.825131f, -0.825185f, -0.825240f, -0.825294f, -0.825348f, -0.825402f,
- -0.825456f, -0.825510f, -0.825564f, -0.825618f, -0.825673f, -0.825727f, -0.825781f, -0.825835f,
- -0.825889f, -0.825943f, -0.825997f, -0.826051f, -0.826105f, -0.826159f, -0.826213f, -0.826267f,
- -0.826321f, -0.826375f, -0.826429f, -0.826483f, -0.826537f, -0.826591f, -0.826645f, -0.826699f,
- -0.826753f, -0.826807f, -0.826861f, -0.826915f, -0.826968f, -0.827022f, -0.827076f, -0.827130f,
- -0.827184f, -0.827238f, -0.827292f, -0.827346f, -0.827399f, -0.827453f, -0.827507f, -0.827561f,
- -0.827615f, -0.827669f, -0.827722f, -0.827776f, -0.827830f, -0.827884f, -0.827938f, -0.827991f,
- -0.828045f, -0.828099f, -0.828153f, -0.828206f, -0.828260f, -0.828314f, -0.828367f, -0.828421f,
- -0.828475f, -0.828529f, -0.828582f, -0.828636f, -0.828690f, -0.828743f, -0.828797f, -0.828851f,
- -0.828904f, -0.828958f, -0.829011f, -0.829065f, -0.829119f, -0.829172f, -0.829226f, -0.829279f,
- -0.829333f, -0.829386f, -0.829440f, -0.829494f, -0.829547f, -0.829601f, -0.829654f, -0.829708f,
- -0.829761f, -0.829815f, -0.829868f, -0.829922f, -0.829975f, -0.830029f, -0.830082f, -0.830136f,
- -0.830189f, -0.830243f, -0.830296f, -0.830349f, -0.830403f, -0.830456f, -0.830510f, -0.830563f,
- -0.830616f, -0.830670f, -0.830723f, -0.830777f, -0.830830f, -0.830883f, -0.830937f, -0.830990f,
- -0.831043f, -0.831097f, -0.831150f, -0.831203f, -0.831257f, -0.831310f, -0.831363f, -0.831416f,
- -0.831470f, -0.831523f, -0.831576f, -0.831629f, -0.831683f, -0.831736f, -0.831789f, -0.831842f,
- -0.831895f, -0.831949f, -0.832002f, -0.832055f, -0.832108f, -0.832161f, -0.832215f, -0.832268f,
- -0.832321f, -0.832374f, -0.832427f, -0.832480f, -0.832533f, -0.832586f, -0.832640f, -0.832693f,
- -0.832746f, -0.832799f, -0.832852f, -0.832905f, -0.832958f, -0.833011f, -0.833064f, -0.833117f,
- -0.833170f, -0.833223f, -0.833276f, -0.833329f, -0.833382f, -0.833435f, -0.833488f, -0.833541f,
- -0.833594f, -0.833647f, -0.833700f, -0.833753f, -0.833806f, -0.833859f, -0.833912f, -0.833965f,
- -0.834018f, -0.834070f, -0.834123f, -0.834176f, -0.834229f, -0.834282f, -0.834335f, -0.834388f,
- -0.834440f, -0.834493f, -0.834546f, -0.834599f, -0.834652f, -0.834705f, -0.834757f, -0.834810f,
- -0.834863f, -0.834916f, -0.834968f, -0.835021f, -0.835074f, -0.835127f, -0.835179f, -0.835232f,
- -0.835285f, -0.835338f, -0.835390f, -0.835443f, -0.835496f, -0.835548f, -0.835601f, -0.835654f,
- -0.835706f, -0.835759f, -0.835812f, -0.835864f, -0.835917f, -0.835969f, -0.836022f, -0.836075f,
- -0.836127f, -0.836180f, -0.836232f, -0.836285f, -0.836338f, -0.836390f, -0.836443f, -0.836495f,
- -0.836548f, -0.836600f, -0.836653f, -0.836705f, -0.836758f, -0.836810f, -0.836863f, -0.836915f,
- -0.836968f, -0.837020f, -0.837073f, -0.837125f, -0.837178f, -0.837230f, -0.837282f, -0.837335f,
- -0.837387f, -0.837440f, -0.837492f, -0.837544f, -0.837597f, -0.837649f, -0.837701f, -0.837754f,
- -0.837806f, -0.837859f, -0.837911f, -0.837963f, -0.838015f, -0.838068f, -0.838120f, -0.838172f,
- -0.838225f, -0.838277f, -0.838329f, -0.838382f, -0.838434f, -0.838486f, -0.838538f, -0.838591f,
- -0.838643f, -0.838695f, -0.838747f, -0.838799f, -0.838852f, -0.838904f, -0.838956f, -0.839008f,
- -0.839060f, -0.839112f, -0.839165f, -0.839217f, -0.839269f, -0.839321f, -0.839373f, -0.839425f,
- -0.839477f, -0.839529f, -0.839581f, -0.839634f, -0.839686f, -0.839738f, -0.839790f, -0.839842f,
- -0.839894f, -0.839946f, -0.839998f, -0.840050f, -0.840102f, -0.840154f, -0.840206f, -0.840258f,
- -0.840310f, -0.840362f, -0.840414f, -0.840466f, -0.840518f, -0.840570f, -0.840622f, -0.840673f,
- -0.840725f, -0.840777f, -0.840829f, -0.840881f, -0.840933f, -0.840985f, -0.841037f, -0.841089f,
- -0.841140f, -0.841192f, -0.841244f, -0.841296f, -0.841348f, -0.841400f, -0.841451f, -0.841503f,
- -0.841555f, -0.841607f, -0.841659f, -0.841710f, -0.841762f, -0.841814f, -0.841866f, -0.841917f,
- -0.841969f, -0.842021f, -0.842072f, -0.842124f, -0.842176f, -0.842228f, -0.842279f, -0.842331f,
- -0.842383f, -0.842434f, -0.842486f, -0.842538f, -0.842589f, -0.842641f, -0.842692f, -0.842744f,
- -0.842796f, -0.842847f, -0.842899f, -0.842950f, -0.843002f, -0.843054f, -0.843105f, -0.843157f,
- -0.843208f, -0.843260f, -0.843311f, -0.843363f, -0.843414f, -0.843466f, -0.843517f, -0.843569f,
- -0.843620f, -0.843672f, -0.843723f, -0.843775f, -0.843826f, -0.843878f, -0.843929f, -0.843980f,
- -0.844032f, -0.844083f, -0.844135f, -0.844186f, -0.844238f, -0.844289f, -0.844340f, -0.844392f,
- -0.844443f, -0.844494f, -0.844546f, -0.844597f, -0.844648f, -0.844700f, -0.844751f, -0.844802f,
- -0.844854f, -0.844905f, -0.844956f, -0.845007f, -0.845059f, -0.845110f, -0.845161f, -0.845212f,
- -0.845264f, -0.845315f, -0.845366f, -0.845417f, -0.845469f, -0.845520f, -0.845571f, -0.845622f,
- -0.845673f, -0.845724f, -0.845776f, -0.845827f, -0.845878f, -0.845929f, -0.845980f, -0.846031f,
- -0.846082f, -0.846133f, -0.846185f, -0.846236f, -0.846287f, -0.846338f, -0.846389f, -0.846440f,
- -0.846491f, -0.846542f, -0.846593f, -0.846644f, -0.846695f, -0.846746f, -0.846797f, -0.846848f,
- -0.846899f, -0.846950f, -0.847001f, -0.847052f, -0.847103f, -0.847154f, -0.847205f, -0.847256f,
- -0.847307f, -0.847358f, -0.847408f, -0.847459f, -0.847510f, -0.847561f, -0.847612f, -0.847663f,
- -0.847714f, -0.847765f, -0.847815f, -0.847866f, -0.847917f, -0.847968f, -0.848019f, -0.848070f,
- -0.848120f, -0.848171f, -0.848222f, -0.848273f, -0.848323f, -0.848374f, -0.848425f, -0.848476f,
- -0.848526f, -0.848577f, -0.848628f, -0.848679f, -0.848729f, -0.848780f, -0.848831f, -0.848881f,
- -0.848932f, -0.848983f, -0.849033f, -0.849084f, -0.849135f, -0.849185f, -0.849236f, -0.849287f,
- -0.849337f, -0.849388f, -0.849438f, -0.849489f, -0.849540f, -0.849590f, -0.849641f, -0.849691f,
- -0.849742f, -0.849792f, -0.849843f, -0.849893f, -0.849944f, -0.849994f, -0.850045f, -0.850095f,
- -0.850146f, -0.850196f, -0.850247f, -0.850297f, -0.850348f, -0.850398f, -0.850449f, -0.850499f,
- -0.850549f, -0.850600f, -0.850650f, -0.850701f, -0.850751f, -0.850801f, -0.850852f, -0.850902f,
- -0.850953f, -0.851003f, -0.851053f, -0.851104f, -0.851154f, -0.851204f, -0.851255f, -0.851305f,
- -0.851355f, -0.851406f, -0.851456f, -0.851506f, -0.851556f, -0.851607f, -0.851657f, -0.851707f,
- -0.851757f, -0.851808f, -0.851858f, -0.851908f, -0.851958f, -0.852008f, -0.852059f, -0.852109f,
- -0.852159f, -0.852209f, -0.852259f, -0.852309f, -0.852360f, -0.852410f, -0.852460f, -0.852510f,
- -0.852560f, -0.852610f, -0.852660f, -0.852710f, -0.852760f, -0.852810f, -0.852861f, -0.852911f,
- -0.852961f, -0.853011f, -0.853061f, -0.853111f, -0.853161f, -0.853211f, -0.853261f, -0.853311f,
- -0.853361f, -0.853411f, -0.853461f, -0.853511f, -0.853561f, -0.853611f, -0.853660f, -0.853710f,
- -0.853760f, -0.853810f, -0.853860f, -0.853910f, -0.853960f, -0.854010f, -0.854060f, -0.854110f,
- -0.854159f, -0.854209f, -0.854259f, -0.854309f, -0.854359f, -0.854409f, -0.854458f, -0.854508f,
- -0.854558f, -0.854608f, -0.854658f, -0.854707f, -0.854757f, -0.854807f, -0.854857f, -0.854906f,
- -0.854956f, -0.855006f, -0.855056f, -0.855105f, -0.855155f, -0.855205f, -0.855254f, -0.855304f,
- -0.855354f, -0.855403f, -0.855453f, -0.855503f, -0.855552f, -0.855602f, -0.855651f, -0.855701f,
- -0.855751f, -0.855800f, -0.855850f, -0.855900f, -0.855949f, -0.855999f, -0.856048f, -0.856098f,
- -0.856147f, -0.856197f, -0.856246f, -0.856296f, -0.856345f, -0.856395f, -0.856444f, -0.856494f,
- -0.856543f, -0.856593f, -0.856642f, -0.856692f, -0.856741f, -0.856791f, -0.856840f, -0.856890f,
- -0.856939f, -0.856988f, -0.857038f, -0.857087f, -0.857137f, -0.857186f, -0.857235f, -0.857285f,
- -0.857334f, -0.857383f, -0.857433f, -0.857482f, -0.857531f, -0.857581f, -0.857630f, -0.857679f,
- -0.857729f, -0.857778f, -0.857827f, -0.857876f, -0.857926f, -0.857975f, -0.858024f, -0.858073f,
- -0.858123f, -0.858172f, -0.858221f, -0.858270f, -0.858320f, -0.858369f, -0.858418f, -0.858467f,
- -0.858516f, -0.858565f, -0.858615f, -0.858664f, -0.858713f, -0.858762f, -0.858811f, -0.858860f,
- -0.858909f, -0.858958f, -0.859007f, -0.859057f, -0.859106f, -0.859155f, -0.859204f, -0.859253f,
- -0.859302f, -0.859351f, -0.859400f, -0.859449f, -0.859498f, -0.859547f, -0.859596f, -0.859645f,
- -0.859694f, -0.859743f, -0.859792f, -0.859841f, -0.859890f, -0.859939f, -0.859988f, -0.860036f,
- -0.860085f, -0.860134f, -0.860183f, -0.860232f, -0.860281f, -0.860330f, -0.860379f, -0.860428f,
- -0.860476f, -0.860525f, -0.860574f, -0.860623f, -0.860672f, -0.860721f, -0.860769f, -0.860818f,
- -0.860867f, -0.860916f, -0.860964f, -0.861013f, -0.861062f, -0.861111f, -0.861160f, -0.861208f,
- -0.861257f, -0.861306f, -0.861354f, -0.861403f, -0.861452f, -0.861500f, -0.861549f, -0.861598f,
- -0.861646f, -0.861695f, -0.861744f, -0.861792f, -0.861841f, -0.861890f, -0.861938f, -0.861987f,
- -0.862035f, -0.862084f, -0.862133f, -0.862181f, -0.862230f, -0.862278f, -0.862327f, -0.862375f,
- -0.862424f, -0.862472f, -0.862521f, -0.862570f, -0.862618f, -0.862666f, -0.862715f, -0.862763f,
- -0.862812f, -0.862860f, -0.862909f, -0.862957f, -0.863006f, -0.863054f, -0.863103f, -0.863151f,
- -0.863199f, -0.863248f, -0.863296f, -0.863345f, -0.863393f, -0.863441f, -0.863490f, -0.863538f,
- -0.863586f, -0.863635f, -0.863683f, -0.863731f, -0.863780f, -0.863828f, -0.863876f, -0.863925f,
- -0.863973f, -0.864021f, -0.864069f, -0.864118f, -0.864166f, -0.864214f, -0.864262f, -0.864311f,
- -0.864359f, -0.864407f, -0.864455f, -0.864503f, -0.864552f, -0.864600f, -0.864648f, -0.864696f,
- -0.864744f, -0.864792f, -0.864841f, -0.864889f, -0.864937f, -0.864985f, -0.865033f, -0.865081f,
- -0.865129f, -0.865177f, -0.865225f, -0.865273f, -0.865321f, -0.865369f, -0.865418f, -0.865466f,
- -0.865514f, -0.865562f, -0.865610f, -0.865658f, -0.865706f, -0.865754f, -0.865802f, -0.865850f,
- -0.865898f, -0.865946f, -0.865993f, -0.866041f, -0.866089f, -0.866137f, -0.866185f, -0.866233f,
- -0.866281f, -0.866329f, -0.866377f, -0.866425f, -0.866472f, -0.866520f, -0.866568f, -0.866616f,
- -0.866664f, -0.866712f, -0.866759f, -0.866807f, -0.866855f, -0.866903f, -0.866951f, -0.866998f,
- -0.867046f, -0.867094f, -0.867142f, -0.867190f, -0.867237f, -0.867285f, -0.867333f, -0.867380f,
- -0.867428f, -0.867476f, -0.867523f, -0.867571f, -0.867619f, -0.867667f, -0.867714f, -0.867762f,
- -0.867809f, -0.867857f, -0.867905f, -0.867952f, -0.868000f, -0.868048f, -0.868095f, -0.868143f,
- -0.868190f, -0.868238f, -0.868285f, -0.868333f, -0.868381f, -0.868428f, -0.868476f, -0.868523f,
- -0.868571f, -0.868618f, -0.868666f, -0.868713f, -0.868761f, -0.868808f, -0.868856f, -0.868903f,
- -0.868951f, -0.868998f, -0.869045f, -0.869093f, -0.869140f, -0.869188f, -0.869235f, -0.869282f,
- -0.869330f, -0.869377f, -0.869425f, -0.869472f, -0.869519f, -0.869567f, -0.869614f, -0.869661f,
- -0.869709f, -0.869756f, -0.869803f, -0.869851f, -0.869898f, -0.869945f, -0.869992f, -0.870040f,
- -0.870087f, -0.870134f, -0.870182f, -0.870229f, -0.870276f, -0.870323f, -0.870370f, -0.870418f,
- -0.870465f, -0.870512f, -0.870559f, -0.870606f, -0.870654f, -0.870701f, -0.870748f, -0.870795f,
- -0.870842f, -0.870889f, -0.870936f, -0.870983f, -0.871031f, -0.871078f, -0.871125f, -0.871172f,
- -0.871219f, -0.871266f, -0.871313f, -0.871360f, -0.871407f, -0.871454f, -0.871501f, -0.871548f,
- -0.871595f, -0.871642f, -0.871689f, -0.871736f, -0.871783f, -0.871830f, -0.871877f, -0.871924f,
- -0.871971f, -0.872018f, -0.872065f, -0.872112f, -0.872159f, -0.872205f, -0.872252f, -0.872299f,
- -0.872346f, -0.872393f, -0.872440f, -0.872487f, -0.872534f, -0.872580f, -0.872627f, -0.872674f,
- -0.872721f, -0.872768f, -0.872814f, -0.872861f, -0.872908f, -0.872955f, -0.873001f, -0.873048f,
- -0.873095f, -0.873142f, -0.873188f, -0.873235f, -0.873282f, -0.873329f, -0.873375f, -0.873422f,
- -0.873469f, -0.873515f, -0.873562f, -0.873609f, -0.873655f, -0.873702f, -0.873749f, -0.873795f,
- -0.873842f, -0.873888f, -0.873935f, -0.873982f, -0.874028f, -0.874075f, -0.874121f, -0.874168f,
- -0.874215f, -0.874261f, -0.874308f, -0.874354f, -0.874401f, -0.874447f, -0.874494f, -0.874540f,
- -0.874587f, -0.874633f, -0.874680f, -0.874726f, -0.874773f, -0.874819f, -0.874865f, -0.874912f,
- -0.874958f, -0.875005f, -0.875051f, -0.875098f, -0.875144f, -0.875190f, -0.875237f, -0.875283f,
- -0.875329f, -0.875376f, -0.875422f, -0.875468f, -0.875515f, -0.875561f, -0.875607f, -0.875654f,
- -0.875700f, -0.875746f, -0.875793f, -0.875839f, -0.875885f, -0.875931f, -0.875978f, -0.876024f,
- -0.876070f, -0.876116f, -0.876163f, -0.876209f, -0.876255f, -0.876301f, -0.876347f, -0.876393f,
- -0.876440f, -0.876486f, -0.876532f, -0.876578f, -0.876624f, -0.876670f, -0.876716f, -0.876763f,
- -0.876809f, -0.876855f, -0.876901f, -0.876947f, -0.876993f, -0.877039f, -0.877085f, -0.877131f,
- -0.877177f, -0.877223f, -0.877269f, -0.877315f, -0.877361f, -0.877407f, -0.877453f, -0.877499f,
- -0.877545f, -0.877591f, -0.877637f, -0.877683f, -0.877729f, -0.877775f, -0.877821f, -0.877867f,
- -0.877913f, -0.877959f, -0.878005f, -0.878051f, -0.878096f, -0.878142f, -0.878188f, -0.878234f,
- -0.878280f, -0.878326f, -0.878371f, -0.878417f, -0.878463f, -0.878509f, -0.878555f, -0.878600f,
- -0.878646f, -0.878692f, -0.878738f, -0.878784f, -0.878829f, -0.878875f, -0.878921f, -0.878967f,
- -0.879012f, -0.879058f, -0.879104f, -0.879149f, -0.879195f, -0.879241f, -0.879286f, -0.879332f,
- -0.879378f, -0.879423f, -0.879469f, -0.879515f, -0.879560f, -0.879606f, -0.879651f, -0.879697f,
- -0.879743f, -0.879788f, -0.879834f, -0.879879f, -0.879925f, -0.879970f, -0.880016f, -0.880061f,
- -0.880107f, -0.880153f, -0.880198f, -0.880244f, -0.880289f, -0.880334f, -0.880380f, -0.880425f,
- -0.880471f, -0.880516f, -0.880562f, -0.880607f, -0.880653f, -0.880698f, -0.880743f, -0.880789f,
- -0.880834f, -0.880880f, -0.880925f, -0.880970f, -0.881016f, -0.881061f, -0.881106f, -0.881152f,
- -0.881197f, -0.881242f, -0.881288f, -0.881333f, -0.881378f, -0.881424f, -0.881469f, -0.881514f,
- -0.881559f, -0.881605f, -0.881650f, -0.881695f, -0.881740f, -0.881786f, -0.881831f, -0.881876f,
- -0.881921f, -0.881966f, -0.882012f, -0.882057f, -0.882102f, -0.882147f, -0.882192f, -0.882237f,
- -0.882283f, -0.882328f, -0.882373f, -0.882418f, -0.882463f, -0.882508f, -0.882553f, -0.882598f,
- -0.882643f, -0.882688f, -0.882733f, -0.882779f, -0.882824f, -0.882869f, -0.882914f, -0.882959f,
- -0.883004f, -0.883049f, -0.883094f, -0.883139f, -0.883184f, -0.883228f, -0.883273f, -0.883318f,
- -0.883363f, -0.883408f, -0.883453f, -0.883498f, -0.883543f, -0.883588f, -0.883633f, -0.883678f,
- -0.883723f, -0.883767f, -0.883812f, -0.883857f, -0.883902f, -0.883947f, -0.883992f, -0.884036f,
- -0.884081f, -0.884126f, -0.884171f, -0.884216f, -0.884260f, -0.884305f, -0.884350f, -0.884395f,
- -0.884439f, -0.884484f, -0.884529f, -0.884574f, -0.884618f, -0.884663f, -0.884708f, -0.884752f,
- -0.884797f, -0.884842f, -0.884886f, -0.884931f, -0.884976f, -0.885020f, -0.885065f, -0.885110f,
- -0.885154f, -0.885199f, -0.885243f, -0.885288f, -0.885333f, -0.885377f, -0.885422f, -0.885466f,
- -0.885511f, -0.885555f, -0.885600f, -0.885644f, -0.885689f, -0.885733f, -0.885778f, -0.885822f,
- -0.885867f, -0.885911f, -0.885956f, -0.886000f, -0.886045f, -0.886089f, -0.886134f, -0.886178f,
- -0.886223f, -0.886267f, -0.886311f, -0.886356f, -0.886400f, -0.886445f, -0.886489f, -0.886533f,
- -0.886578f, -0.886622f, -0.886666f, -0.886711f, -0.886755f, -0.886799f, -0.886844f, -0.886888f,
- -0.886932f, -0.886976f, -0.887021f, -0.887065f, -0.887109f, -0.887153f, -0.887198f, -0.887242f,
- -0.887286f, -0.887330f, -0.887375f, -0.887419f, -0.887463f, -0.887507f, -0.887551f, -0.887595f,
- -0.887640f, -0.887684f, -0.887728f, -0.887772f, -0.887816f, -0.887860f, -0.887904f, -0.887949f,
- -0.887993f, -0.888037f, -0.888081f, -0.888125f, -0.888169f, -0.888213f, -0.888257f, -0.888301f,
- -0.888345f, -0.888389f, -0.888433f, -0.888477f, -0.888521f, -0.888565f, -0.888609f, -0.888653f,
- -0.888697f, -0.888741f, -0.888785f, -0.888829f, -0.888873f, -0.888917f, -0.888961f, -0.889004f,
- -0.889048f, -0.889092f, -0.889136f, -0.889180f, -0.889224f, -0.889268f, -0.889312f, -0.889355f,
- -0.889399f, -0.889443f, -0.889487f, -0.889531f, -0.889574f, -0.889618f, -0.889662f, -0.889706f,
- -0.889750f, -0.889793f, -0.889837f, -0.889881f, -0.889925f, -0.889968f, -0.890012f, -0.890056f,
- -0.890099f, -0.890143f, -0.890187f, -0.890230f, -0.890274f, -0.890318f, -0.890361f, -0.890405f,
- -0.890449f, -0.890492f, -0.890536f, -0.890580f, -0.890623f, -0.890667f, -0.890710f, -0.890754f,
- -0.890797f, -0.890841f, -0.890885f, -0.890928f, -0.890972f, -0.891015f, -0.891059f, -0.891102f,
- -0.891146f, -0.891189f, -0.891233f, -0.891276f, -0.891320f, -0.891363f, -0.891407f, -0.891450f,
- -0.891493f, -0.891537f, -0.891580f, -0.891624f, -0.891667f, -0.891711f, -0.891754f, -0.891797f,
- -0.891841f, -0.891884f, -0.891927f, -0.891971f, -0.892014f, -0.892057f, -0.892101f, -0.892144f,
- -0.892187f, -0.892231f, -0.892274f, -0.892317f, -0.892361f, -0.892404f, -0.892447f, -0.892490f,
- -0.892534f, -0.892577f, -0.892620f, -0.892663f, -0.892706f, -0.892750f, -0.892793f, -0.892836f,
- -0.892879f, -0.892922f, -0.892965f, -0.893009f, -0.893052f, -0.893095f, -0.893138f, -0.893181f,
- -0.893224f, -0.893267f, -0.893310f, -0.893354f, -0.893397f, -0.893440f, -0.893483f, -0.893526f,
- -0.893569f, -0.893612f, -0.893655f, -0.893698f, -0.893741f, -0.893784f, -0.893827f, -0.893870f,
- -0.893913f, -0.893956f, -0.893999f, -0.894042f, -0.894085f, -0.894128f, -0.894171f, -0.894214f,
- -0.894256f, -0.894299f, -0.894342f, -0.894385f, -0.894428f, -0.894471f, -0.894514f, -0.894557f,
- -0.894599f, -0.894642f, -0.894685f, -0.894728f, -0.894771f, -0.894814f, -0.894856f, -0.894899f,
- -0.894942f, -0.894985f, -0.895028f, -0.895070f, -0.895113f, -0.895156f, -0.895198f, -0.895241f,
- -0.895284f, -0.895327f, -0.895369f, -0.895412f, -0.895455f, -0.895497f, -0.895540f, -0.895583f,
- -0.895625f, -0.895668f, -0.895711f, -0.895753f, -0.895796f, -0.895838f, -0.895881f, -0.895924f,
- -0.895966f, -0.896009f, -0.896051f, -0.896094f, -0.896137f, -0.896179f, -0.896222f, -0.896264f,
- -0.896307f, -0.896349f, -0.896392f, -0.896434f, -0.896477f, -0.896519f, -0.896562f, -0.896604f,
- -0.896646f, -0.896689f, -0.896731f, -0.896774f, -0.896816f, -0.896859f, -0.896901f, -0.896943f,
- -0.896986f, -0.897028f, -0.897071f, -0.897113f, -0.897155f, -0.897198f, -0.897240f, -0.897282f,
- -0.897325f, -0.897367f, -0.897409f, -0.897452f, -0.897494f, -0.897536f, -0.897578f, -0.897621f,
- -0.897663f, -0.897705f, -0.897747f, -0.897790f, -0.897832f, -0.897874f, -0.897916f, -0.897958f,
- -0.898001f, -0.898043f, -0.898085f, -0.898127f, -0.898169f, -0.898211f, -0.898254f, -0.898296f,
- -0.898338f, -0.898380f, -0.898422f, -0.898464f, -0.898506f, -0.898548f, -0.898590f, -0.898632f,
- -0.898674f, -0.898717f, -0.898759f, -0.898801f, -0.898843f, -0.898885f, -0.898927f, -0.898969f,
- -0.899011f, -0.899053f, -0.899095f, -0.899137f, -0.899179f, -0.899220f, -0.899262f, -0.899304f,
- -0.899346f, -0.899388f, -0.899430f, -0.899472f, -0.899514f, -0.899556f, -0.899598f, -0.899639f,
- -0.899681f, -0.899723f, -0.899765f, -0.899807f, -0.899849f, -0.899890f, -0.899932f, -0.899974f,
- -0.900016f, -0.900058f, -0.900099f, -0.900141f, -0.900183f, -0.900225f, -0.900266f, -0.900308f,
- -0.900350f, -0.900392f, -0.900433f, -0.900475f, -0.900517f, -0.900558f, -0.900600f, -0.900642f,
- -0.900683f, -0.900725f, -0.900767f, -0.900808f, -0.900850f, -0.900892f, -0.900933f, -0.900975f,
- -0.901016f, -0.901058f, -0.901100f, -0.901141f, -0.901183f, -0.901224f, -0.901266f, -0.901307f,
- -0.901349f, -0.901390f, -0.901432f, -0.901473f, -0.901515f, -0.901556f, -0.901598f, -0.901639f,
- -0.901681f, -0.901722f, -0.901764f, -0.901805f, -0.901847f, -0.901888f, -0.901929f, -0.901971f,
- -0.902012f, -0.902054f, -0.902095f, -0.902136f, -0.902178f, -0.902219f, -0.902260f, -0.902302f,
- -0.902343f, -0.902384f, -0.902426f, -0.902467f, -0.902508f, -0.902550f, -0.902591f, -0.902632f,
- -0.902673f, -0.902715f, -0.902756f, -0.902797f, -0.902838f, -0.902879f, -0.902921f, -0.902962f,
- -0.903003f, -0.903044f, -0.903085f, -0.903127f, -0.903168f, -0.903209f, -0.903250f, -0.903291f,
- -0.903332f, -0.903373f, -0.903415f, -0.903456f, -0.903497f, -0.903538f, -0.903579f, -0.903620f,
- -0.903661f, -0.903702f, -0.903743f, -0.903784f, -0.903825f, -0.903866f, -0.903907f, -0.903948f,
- -0.903989f, -0.904030f, -0.904071f, -0.904112f, -0.904153f, -0.904194f, -0.904235f, -0.904276f,
- -0.904317f, -0.904358f, -0.904399f, -0.904440f, -0.904481f, -0.904521f, -0.904562f, -0.904603f,
- -0.904644f, -0.904685f, -0.904726f, -0.904767f, -0.904807f, -0.904848f, -0.904889f, -0.904930f,
- -0.904971f, -0.905011f, -0.905052f, -0.905093f, -0.905134f, -0.905175f, -0.905215f, -0.905256f,
- -0.905297f, -0.905337f, -0.905378f, -0.905419f, -0.905460f, -0.905500f, -0.905541f, -0.905582f,
- -0.905622f, -0.905663f, -0.905704f, -0.905744f, -0.905785f, -0.905825f, -0.905866f, -0.905907f,
- -0.905947f, -0.905988f, -0.906028f, -0.906069f, -0.906110f, -0.906150f, -0.906191f, -0.906231f,
- -0.906272f, -0.906312f, -0.906353f, -0.906393f, -0.906434f, -0.906474f, -0.906515f, -0.906555f,
- -0.906596f, -0.906636f, -0.906677f, -0.906717f, -0.906757f, -0.906798f, -0.906838f, -0.906879f,
- -0.906919f, -0.906959f, -0.907000f, -0.907040f, -0.907081f, -0.907121f, -0.907161f, -0.907202f,
- -0.907242f, -0.907282f, -0.907323f, -0.907363f, -0.907403f, -0.907444f, -0.907484f, -0.907524f,
- -0.907564f, -0.907605f, -0.907645f, -0.907685f, -0.907725f, -0.907766f, -0.907806f, -0.907846f,
- -0.907886f, -0.907926f, -0.907966f, -0.908007f, -0.908047f, -0.908087f, -0.908127f, -0.908167f,
- -0.908207f, -0.908248f, -0.908288f, -0.908328f, -0.908368f, -0.908408f, -0.908448f, -0.908488f,
- -0.908528f, -0.908568f, -0.908608f, -0.908648f, -0.908688f, -0.908728f, -0.908768f, -0.908808f,
- -0.908848f, -0.908888f, -0.908928f, -0.908968f, -0.909008f, -0.909048f, -0.909088f, -0.909128f,
- -0.909168f, -0.909208f, -0.909248f, -0.909288f, -0.909328f, -0.909368f, -0.909407f, -0.909447f,
- -0.909487f, -0.909527f, -0.909567f, -0.909607f, -0.909646f, -0.909686f, -0.909726f, -0.909766f,
- -0.909806f, -0.909845f, -0.909885f, -0.909925f, -0.909965f, -0.910005f, -0.910044f, -0.910084f,
- -0.910124f, -0.910163f, -0.910203f, -0.910243f, -0.910283f, -0.910322f, -0.910362f, -0.910402f,
- -0.910441f, -0.910481f, -0.910521f, -0.910560f, -0.910600f, -0.910639f, -0.910679f, -0.910719f,
- -0.910758f, -0.910798f, -0.910837f, -0.910877f, -0.910917f, -0.910956f, -0.910996f, -0.911035f,
- -0.911075f, -0.911114f, -0.911154f, -0.911193f, -0.911233f, -0.911272f, -0.911312f, -0.911351f,
- -0.911391f, -0.911430f, -0.911470f, -0.911509f, -0.911548f, -0.911588f, -0.911627f, -0.911667f,
- -0.911706f, -0.911745f, -0.911785f, -0.911824f, -0.911864f, -0.911903f, -0.911942f, -0.911982f,
- -0.912021f, -0.912060f, -0.912099f, -0.912139f, -0.912178f, -0.912217f, -0.912257f, -0.912296f,
- -0.912335f, -0.912374f, -0.912414f, -0.912453f, -0.912492f, -0.912531f, -0.912571f, -0.912610f,
- -0.912649f, -0.912688f, -0.912727f, -0.912766f, -0.912806f, -0.912845f, -0.912884f, -0.912923f,
- -0.912962f, -0.913001f, -0.913040f, -0.913080f, -0.913119f, -0.913158f, -0.913197f, -0.913236f,
- -0.913275f, -0.913314f, -0.913353f, -0.913392f, -0.913431f, -0.913470f, -0.913509f, -0.913548f,
- -0.913587f, -0.913626f, -0.913665f, -0.913704f, -0.913743f, -0.913782f, -0.913821f, -0.913860f,
- -0.913899f, -0.913938f, -0.913976f, -0.914015f, -0.914054f, -0.914093f, -0.914132f, -0.914171f,
- -0.914210f, -0.914249f, -0.914287f, -0.914326f, -0.914365f, -0.914404f, -0.914443f, -0.914482f,
- -0.914520f, -0.914559f, -0.914598f, -0.914637f, -0.914675f, -0.914714f, -0.914753f, -0.914792f,
- -0.914830f, -0.914869f, -0.914908f, -0.914946f, -0.914985f, -0.915024f, -0.915062f, -0.915101f,
- -0.915140f, -0.915178f, -0.915217f, -0.915256f, -0.915294f, -0.915333f, -0.915372f, -0.915410f,
- -0.915449f, -0.915487f, -0.915526f, -0.915564f, -0.915603f, -0.915642f, -0.915680f, -0.915719f,
- -0.915757f, -0.915796f, -0.915834f, -0.915873f, -0.915911f, -0.915950f, -0.915988f, -0.916027f,
- -0.916065f, -0.916103f, -0.916142f, -0.916180f, -0.916219f, -0.916257f, -0.916296f, -0.916334f,
- -0.916372f, -0.916411f, -0.916449f, -0.916487f, -0.916526f, -0.916564f, -0.916602f, -0.916641f,
- -0.916679f, -0.916717f, -0.916756f, -0.916794f, -0.916832f, -0.916871f, -0.916909f, -0.916947f,
- -0.916985f, -0.917024f, -0.917062f, -0.917100f, -0.917138f, -0.917176f, -0.917215f, -0.917253f,
- -0.917291f, -0.917329f, -0.917367f, -0.917405f, -0.917444f, -0.917482f, -0.917520f, -0.917558f,
- -0.917596f, -0.917634f, -0.917672f, -0.917710f, -0.917749f, -0.917787f, -0.917825f, -0.917863f,
- -0.917901f, -0.917939f, -0.917977f, -0.918015f, -0.918053f, -0.918091f, -0.918129f, -0.918167f,
- -0.918205f, -0.918243f, -0.918281f, -0.918319f, -0.918357f, -0.918395f, -0.918433f, -0.918471f,
- -0.918508f, -0.918546f, -0.918584f, -0.918622f, -0.918660f, -0.918698f, -0.918736f, -0.918774f,
- -0.918811f, -0.918849f, -0.918887f, -0.918925f, -0.918963f, -0.919001f, -0.919038f, -0.919076f,
- -0.919114f, -0.919152f, -0.919189f, -0.919227f, -0.919265f, -0.919303f, -0.919340f, -0.919378f,
- -0.919416f, -0.919453f, -0.919491f, -0.919529f, -0.919567f, -0.919604f, -0.919642f, -0.919680f,
- -0.919717f, -0.919755f, -0.919792f, -0.919830f, -0.919868f, -0.919905f, -0.919943f, -0.919980f,
- -0.920018f, -0.920056f, -0.920093f, -0.920131f, -0.920168f, -0.920206f, -0.920243f, -0.920281f,
- -0.920318f, -0.920356f, -0.920393f, -0.920431f, -0.920468f, -0.920506f, -0.920543f, -0.920581f,
- -0.920618f, -0.920655f, -0.920693f, -0.920730f, -0.920768f, -0.920805f, -0.920842f, -0.920880f,
- -0.920917f, -0.920955f, -0.920992f, -0.921029f, -0.921067f, -0.921104f, -0.921141f, -0.921179f,
- -0.921216f, -0.921253f, -0.921291f, -0.921328f, -0.921365f, -0.921402f, -0.921440f, -0.921477f,
- -0.921514f, -0.921551f, -0.921588f, -0.921626f, -0.921663f, -0.921700f, -0.921737f, -0.921774f,
- -0.921812f, -0.921849f, -0.921886f, -0.921923f, -0.921960f, -0.921997f, -0.922034f, -0.922072f,
- -0.922109f, -0.922146f, -0.922183f, -0.922220f, -0.922257f, -0.922294f, -0.922331f, -0.922368f,
- -0.922405f, -0.922442f, -0.922479f, -0.922516f, -0.922553f, -0.922590f, -0.922627f, -0.922664f,
- -0.922701f, -0.922738f, -0.922775f, -0.922812f, -0.922849f, -0.922886f, -0.922923f, -0.922960f,
- -0.922997f, -0.923033f, -0.923070f, -0.923107f, -0.923144f, -0.923181f, -0.923218f, -0.923255f,
- -0.923291f, -0.923328f, -0.923365f, -0.923402f, -0.923439f, -0.923475f, -0.923512f, -0.923549f,
- -0.923586f, -0.923622f, -0.923659f, -0.923696f, -0.923733f, -0.923769f, -0.923806f, -0.923843f,
- -0.923880f, -0.923916f, -0.923953f, -0.923990f, -0.924026f, -0.924063f, -0.924100f, -0.924136f,
- -0.924173f, -0.924209f, -0.924246f, -0.924283f, -0.924319f, -0.924356f, -0.924392f, -0.924429f,
- -0.924465f, -0.924502f, -0.924539f, -0.924575f, -0.924612f, -0.924648f, -0.924685f, -0.924721f,
- -0.924758f, -0.924794f, -0.924831f, -0.924867f, -0.924904f, -0.924940f, -0.924976f, -0.925013f,
- -0.925049f, -0.925086f, -0.925122f, -0.925158f, -0.925195f, -0.925231f, -0.925268f, -0.925304f,
- -0.925340f, -0.925377f, -0.925413f, -0.925449f, -0.925486f, -0.925522f, -0.925558f, -0.925595f,
- -0.925631f, -0.925667f, -0.925703f, -0.925740f, -0.925776f, -0.925812f, -0.925848f, -0.925885f,
- -0.925921f, -0.925957f, -0.925993f, -0.926029f, -0.926066f, -0.926102f, -0.926138f, -0.926174f,
- -0.926210f, -0.926246f, -0.926283f, -0.926319f, -0.926355f, -0.926391f, -0.926427f, -0.926463f,
- -0.926499f, -0.926535f, -0.926571f, -0.926607f, -0.926643f, -0.926679f, -0.926715f, -0.926751f,
- -0.926787f, -0.926823f, -0.926859f, -0.926895f, -0.926931f, -0.926967f, -0.927003f, -0.927039f,
- -0.927075f, -0.927111f, -0.927147f, -0.927183f, -0.927219f, -0.927255f, -0.927291f, -0.927327f,
- -0.927363f, -0.927398f, -0.927434f, -0.927470f, -0.927506f, -0.927542f, -0.927578f, -0.927613f,
- -0.927649f, -0.927685f, -0.927721f, -0.927757f, -0.927792f, -0.927828f, -0.927864f, -0.927900f,
- -0.927935f, -0.927971f, -0.928007f, -0.928043f, -0.928078f, -0.928114f, -0.928150f, -0.928185f,
- -0.928221f, -0.928257f, -0.928292f, -0.928328f, -0.928364f, -0.928399f, -0.928435f, -0.928470f,
- -0.928506f, -0.928542f, -0.928577f, -0.928613f, -0.928648f, -0.928684f, -0.928720f, -0.928755f,
- -0.928791f, -0.928826f, -0.928862f, -0.928897f, -0.928933f, -0.928968f, -0.929004f, -0.929039f,
- -0.929075f, -0.929110f, -0.929146f, -0.929181f, -0.929216f, -0.929252f, -0.929287f, -0.929323f,
- -0.929358f, -0.929393f, -0.929429f, -0.929464f, -0.929500f, -0.929535f, -0.929570f, -0.929606f,
- -0.929641f, -0.929676f, -0.929712f, -0.929747f, -0.929782f, -0.929817f, -0.929853f, -0.929888f,
- -0.929923f, -0.929958f, -0.929994f, -0.930029f, -0.930064f, -0.930099f, -0.930135f, -0.930170f,
- -0.930205f, -0.930240f, -0.930275f, -0.930311f, -0.930346f, -0.930381f, -0.930416f, -0.930451f,
- -0.930486f, -0.930521f, -0.930556f, -0.930592f, -0.930627f, -0.930662f, -0.930697f, -0.930732f,
- -0.930767f, -0.930802f, -0.930837f, -0.930872f, -0.930907f, -0.930942f, -0.930977f, -0.931012f,
- -0.931047f, -0.931082f, -0.931117f, -0.931152f, -0.931187f, -0.931222f, -0.931257f, -0.931292f,
- -0.931327f, -0.931362f, -0.931397f, -0.931431f, -0.931466f, -0.931501f, -0.931536f, -0.931571f,
- -0.931606f, -0.931641f, -0.931675f, -0.931710f, -0.931745f, -0.931780f, -0.931815f, -0.931849f,
- -0.931884f, -0.931919f, -0.931954f, -0.931989f, -0.932023f, -0.932058f, -0.932093f, -0.932128f,
- -0.932162f, -0.932197f, -0.932232f, -0.932266f, -0.932301f, -0.932336f, -0.932370f, -0.932405f,
- -0.932440f, -0.932474f, -0.932509f, -0.932544f, -0.932578f, -0.932613f, -0.932647f, -0.932682f,
- -0.932716f, -0.932751f, -0.932786f, -0.932820f, -0.932855f, -0.932889f, -0.932924f, -0.932958f,
- -0.932993f, -0.933027f, -0.933062f, -0.933096f, -0.933131f, -0.933165f, -0.933200f, -0.933234f,
- -0.933269f, -0.933303f, -0.933337f, -0.933372f, -0.933406f, -0.933441f, -0.933475f, -0.933509f,
- -0.933544f, -0.933578f, -0.933612f, -0.933647f, -0.933681f, -0.933716f, -0.933750f, -0.933784f,
- -0.933818f, -0.933853f, -0.933887f, -0.933921f, -0.933956f, -0.933990f, -0.934024f, -0.934058f,
- -0.934093f, -0.934127f, -0.934161f, -0.934195f, -0.934229f, -0.934264f, -0.934298f, -0.934332f,
- -0.934366f, -0.934400f, -0.934434f, -0.934469f, -0.934503f, -0.934537f, -0.934571f, -0.934605f,
- -0.934639f, -0.934673f, -0.934707f, -0.934741f, -0.934775f, -0.934810f, -0.934844f, -0.934878f,
- -0.934912f, -0.934946f, -0.934980f, -0.935014f, -0.935048f, -0.935082f, -0.935116f, -0.935150f,
- -0.935184f, -0.935217f, -0.935251f, -0.935285f, -0.935319f, -0.935353f, -0.935387f, -0.935421f,
- -0.935455f, -0.935489f, -0.935523f, -0.935556f, -0.935590f, -0.935624f, -0.935658f, -0.935692f,
- -0.935726f, -0.935759f, -0.935793f, -0.935827f, -0.935861f, -0.935895f, -0.935928f, -0.935962f,
- -0.935996f, -0.936030f, -0.936063f, -0.936097f, -0.936131f, -0.936165f, -0.936198f, -0.936232f,
- -0.936266f, -0.936299f, -0.936333f, -0.936367f, -0.936400f, -0.936434f, -0.936468f, -0.936501f,
- -0.936535f, -0.936568f, -0.936602f, -0.936636f, -0.936669f, -0.936703f, -0.936736f, -0.936770f,
- -0.936803f, -0.936837f, -0.936871f, -0.936904f, -0.936938f, -0.936971f, -0.937005f, -0.937038f,
- -0.937072f, -0.937105f, -0.937138f, -0.937172f, -0.937205f, -0.937239f, -0.937272f, -0.937306f,
- -0.937339f, -0.937372f, -0.937406f, -0.937439f, -0.937473f, -0.937506f, -0.937539f, -0.937573f,
- -0.937606f, -0.937639f, -0.937673f, -0.937706f, -0.937739f, -0.937773f, -0.937806f, -0.937839f,
- -0.937872f, -0.937906f, -0.937939f, -0.937972f, -0.938005f, -0.938039f, -0.938072f, -0.938105f,
- -0.938138f, -0.938171f, -0.938205f, -0.938238f, -0.938271f, -0.938304f, -0.938337f, -0.938370f,
- -0.938404f, -0.938437f, -0.938470f, -0.938503f, -0.938536f, -0.938569f, -0.938602f, -0.938635f,
- -0.938668f, -0.938701f, -0.938734f, -0.938767f, -0.938800f, -0.938833f, -0.938866f, -0.938900f,
- -0.938932f, -0.938965f, -0.938998f, -0.939031f, -0.939064f, -0.939097f, -0.939130f, -0.939163f,
- -0.939196f, -0.939229f, -0.939262f, -0.939295f, -0.939328f, -0.939361f, -0.939394f, -0.939426f,
- -0.939459f, -0.939492f, -0.939525f, -0.939558f, -0.939591f, -0.939623f, -0.939656f, -0.939689f,
- -0.939722f, -0.939755f, -0.939787f, -0.939820f, -0.939853f, -0.939886f, -0.939918f, -0.939951f,
- -0.939984f, -0.940016f, -0.940049f, -0.940082f, -0.940115f, -0.940147f, -0.940180f, -0.940213f,
- -0.940245f, -0.940278f, -0.940310f, -0.940343f, -0.940376f, -0.940408f, -0.940441f, -0.940473f,
- -0.940506f, -0.940539f, -0.940571f, -0.940604f, -0.940636f, -0.940669f, -0.940701f, -0.940734f,
- -0.940766f, -0.940799f, -0.940831f, -0.940864f, -0.940896f, -0.940929f, -0.940961f, -0.940994f,
- -0.941026f, -0.941059f, -0.941091f, -0.941123f, -0.941156f, -0.941188f, -0.941221f, -0.941253f,
- -0.941285f, -0.941318f, -0.941350f, -0.941382f, -0.941415f, -0.941447f, -0.941479f, -0.941512f,
- -0.941544f, -0.941576f, -0.941609f, -0.941641f, -0.941673f, -0.941705f, -0.941738f, -0.941770f,
- -0.941802f, -0.941834f, -0.941867f, -0.941899f, -0.941931f, -0.941963f, -0.941995f, -0.942028f,
- -0.942060f, -0.942092f, -0.942124f, -0.942156f, -0.942188f, -0.942220f, -0.942253f, -0.942285f,
- -0.942317f, -0.942349f, -0.942381f, -0.942413f, -0.942445f, -0.942477f, -0.942509f, -0.942541f,
- -0.942573f, -0.942605f, -0.942637f, -0.942669f, -0.942701f, -0.942733f, -0.942765f, -0.942797f,
- -0.942829f, -0.942861f, -0.942893f, -0.942925f, -0.942957f, -0.942989f, -0.943021f, -0.943053f,
- -0.943084f, -0.943116f, -0.943148f, -0.943180f, -0.943212f, -0.943244f, -0.943276f, -0.943307f,
- -0.943339f, -0.943371f, -0.943403f, -0.943435f, -0.943466f, -0.943498f, -0.943530f, -0.943562f,
- -0.943593f, -0.943625f, -0.943657f, -0.943689f, -0.943720f, -0.943752f, -0.943784f, -0.943815f,
- -0.943847f, -0.943879f, -0.943910f, -0.943942f, -0.943974f, -0.944005f, -0.944037f, -0.944069f,
- -0.944100f, -0.944132f, -0.944163f, -0.944195f, -0.944227f, -0.944258f, -0.944290f, -0.944321f,
- -0.944353f, -0.944384f, -0.944416f, -0.944447f, -0.944479f, -0.944510f, -0.944542f, -0.944573f,
- -0.944605f, -0.944636f, -0.944668f, -0.944699f, -0.944731f, -0.944762f, -0.944793f, -0.944825f,
- -0.944856f, -0.944888f, -0.944919f, -0.944950f, -0.944982f, -0.945013f, -0.945045f, -0.945076f,
- -0.945107f, -0.945139f, -0.945170f, -0.945201f, -0.945232f, -0.945264f, -0.945295f, -0.945326f,
- -0.945358f, -0.945389f, -0.945420f, -0.945451f, -0.945482f, -0.945514f, -0.945545f, -0.945576f,
- -0.945607f, -0.945639f, -0.945670f, -0.945701f, -0.945732f, -0.945763f, -0.945794f, -0.945825f,
- -0.945857f, -0.945888f, -0.945919f, -0.945950f, -0.945981f, -0.946012f, -0.946043f, -0.946074f,
- -0.946105f, -0.946136f, -0.946167f, -0.946198f, -0.946229f, -0.946260f, -0.946291f, -0.946322f,
- -0.946353f, -0.946384f, -0.946415f, -0.946446f, -0.946477f, -0.946508f, -0.946539f, -0.946570f,
- -0.946601f, -0.946632f, -0.946663f, -0.946694f, -0.946724f, -0.946755f, -0.946786f, -0.946817f,
- -0.946848f, -0.946879f, -0.946910f, -0.946940f, -0.946971f, -0.947002f, -0.947033f, -0.947064f,
- -0.947094f, -0.947125f, -0.947156f, -0.947187f, -0.947217f, -0.947248f, -0.947279f, -0.947310f,
- -0.947340f, -0.947371f, -0.947402f, -0.947432f, -0.947463f, -0.947494f, -0.947524f, -0.947555f,
- -0.947586f, -0.947616f, -0.947647f, -0.947677f, -0.947708f, -0.947739f, -0.947769f, -0.947800f,
- -0.947830f, -0.947861f, -0.947891f, -0.947922f, -0.947953f, -0.947983f, -0.948014f, -0.948044f,
- -0.948075f, -0.948105f, -0.948136f, -0.948166f, -0.948196f, -0.948227f, -0.948257f, -0.948288f,
- -0.948318f, -0.948349f, -0.948379f, -0.948409f, -0.948440f, -0.948470f, -0.948501f, -0.948531f,
- -0.948561f, -0.948592f, -0.948622f, -0.948652f, -0.948683f, -0.948713f, -0.948743f, -0.948774f,
- -0.948804f, -0.948834f, -0.948864f, -0.948895f, -0.948925f, -0.948955f, -0.948985f, -0.949016f,
- -0.949046f, -0.949076f, -0.949106f, -0.949136f, -0.949167f, -0.949197f, -0.949227f, -0.949257f,
- -0.949287f, -0.949317f, -0.949348f, -0.949378f, -0.949408f, -0.949438f, -0.949468f, -0.949498f,
- -0.949528f, -0.949558f, -0.949588f, -0.949618f, -0.949648f, -0.949678f, -0.949708f, -0.949739f,
- -0.949768f, -0.949798f, -0.949829f, -0.949858f, -0.949888f, -0.949918f, -0.949948f, -0.949978f,
- -0.950008f, -0.950038f, -0.950068f, -0.950098f, -0.950128f, -0.950158f, -0.950188f, -0.950218f,
- -0.950247f, -0.950277f, -0.950307f, -0.950337f, -0.950367f, -0.950397f, -0.950426f, -0.950456f,
- -0.950486f, -0.950516f, -0.950546f, -0.950575f, -0.950605f, -0.950635f, -0.950665f, -0.950694f,
- -0.950724f, -0.950754f, -0.950784f, -0.950813f, -0.950843f, -0.950873f, -0.950902f, -0.950932f,
- -0.950962f, -0.950991f, -0.951021f, -0.951051f, -0.951080f, -0.951110f, -0.951139f, -0.951169f,
- -0.951199f, -0.951228f, -0.951258f, -0.951287f, -0.951317f, -0.951346f, -0.951376f, -0.951406f,
- -0.951435f, -0.951465f, -0.951494f, -0.951524f, -0.951553f, -0.951582f, -0.951612f, -0.951641f,
- -0.951671f, -0.951700f, -0.951730f, -0.951759f, -0.951789f, -0.951818f, -0.951847f, -0.951877f,
- -0.951906f, -0.951936f, -0.951965f, -0.951994f, -0.952024f, -0.952053f, -0.952082f, -0.952112f,
- -0.952141f, -0.952170f, -0.952199f, -0.952229f, -0.952258f, -0.952287f, -0.952317f, -0.952346f,
- -0.952375f, -0.952404f, -0.952433f, -0.952463f, -0.952492f, -0.952521f, -0.952550f, -0.952579f,
- -0.952609f, -0.952638f, -0.952667f, -0.952696f, -0.952725f, -0.952754f, -0.952783f, -0.952813f,
- -0.952842f, -0.952871f, -0.952900f, -0.952929f, -0.952958f, -0.952987f, -0.953016f, -0.953045f,
- -0.953074f, -0.953103f, -0.953132f, -0.953161f, -0.953190f, -0.953219f, -0.953248f, -0.953277f,
- -0.953306f, -0.953335f, -0.953364f, -0.953393f, -0.953422f, -0.953451f, -0.953480f, -0.953508f,
- -0.953537f, -0.953566f, -0.953595f, -0.953624f, -0.953653f, -0.953682f, -0.953711f, -0.953739f,
- -0.953768f, -0.953797f, -0.953826f, -0.953855f, -0.953883f, -0.953912f, -0.953941f, -0.953970f,
- -0.953998f, -0.954027f, -0.954056f, -0.954085f, -0.954113f, -0.954142f, -0.954171f, -0.954199f,
- -0.954228f, -0.954257f, -0.954285f, -0.954314f, -0.954343f, -0.954371f, -0.954400f, -0.954429f,
- -0.954457f, -0.954486f, -0.954514f, -0.954543f, -0.954572f, -0.954600f, -0.954629f, -0.954657f,
- -0.954686f, -0.954714f, -0.954743f, -0.954771f, -0.954800f, -0.954828f, -0.954857f, -0.954885f,
- -0.954914f, -0.954942f, -0.954971f, -0.954999f, -0.955028f, -0.955056f, -0.955084f, -0.955113f,
- -0.955141f, -0.955170f, -0.955198f, -0.955226f, -0.955255f, -0.955283f, -0.955311f, -0.955340f,
- -0.955368f, -0.955396f, -0.955425f, -0.955453f, -0.955481f, -0.955510f, -0.955538f, -0.955566f,
- -0.955594f, -0.955623f, -0.955651f, -0.955679f, -0.955707f, -0.955736f, -0.955764f, -0.955792f,
- -0.955820f, -0.955848f, -0.955876f, -0.955905f, -0.955933f, -0.955961f, -0.955989f, -0.956017f,
- -0.956045f, -0.956073f, -0.956101f, -0.956130f, -0.956158f, -0.956186f, -0.956214f, -0.956242f,
- -0.956270f, -0.956298f, -0.956326f, -0.956354f, -0.956382f, -0.956410f, -0.956438f, -0.956466f,
- -0.956494f, -0.956522f, -0.956550f, -0.956578f, -0.956606f, -0.956634f, -0.956662f, -0.956689f,
- -0.956717f, -0.956745f, -0.956773f, -0.956801f, -0.956829f, -0.956857f, -0.956885f, -0.956913f,
- -0.956940f, -0.956968f, -0.956996f, -0.957024f, -0.957052f, -0.957079f, -0.957107f, -0.957135f,
- -0.957163f, -0.957190f, -0.957218f, -0.957246f, -0.957274f, -0.957301f, -0.957329f, -0.957357f,
- -0.957385f, -0.957412f, -0.957440f, -0.957468f, -0.957495f, -0.957523f, -0.957550f, -0.957578f,
- -0.957606f, -0.957633f, -0.957661f, -0.957689f, -0.957716f, -0.957744f, -0.957771f, -0.957799f,
- -0.957826f, -0.957854f, -0.957882f, -0.957909f, -0.957937f, -0.957964f, -0.957992f, -0.958019f,
- -0.958046f, -0.958074f, -0.958101f, -0.958129f, -0.958156f, -0.958184f, -0.958211f, -0.958239f,
- -0.958266f, -0.958293f, -0.958321f, -0.958348f, -0.958376f, -0.958403f, -0.958430f, -0.958458f,
- -0.958485f, -0.958512f, -0.958540f, -0.958567f, -0.958594f, -0.958622f, -0.958649f, -0.958676f,
- -0.958703f, -0.958731f, -0.958758f, -0.958785f, -0.958812f, -0.958840f, -0.958867f, -0.958894f,
- -0.958921f, -0.958949f, -0.958976f, -0.959003f, -0.959030f, -0.959057f, -0.959084f, -0.959112f,
- -0.959139f, -0.959166f, -0.959193f, -0.959220f, -0.959247f, -0.959274f, -0.959301f, -0.959328f,
- -0.959355f, -0.959382f, -0.959409f, -0.959436f, -0.959463f, -0.959491f, -0.959518f, -0.959545f,
- -0.959572f, -0.959598f, -0.959625f, -0.959652f, -0.959679f, -0.959706f, -0.959733f, -0.959760f,
- -0.959787f, -0.959814f, -0.959841f, -0.959868f, -0.959895f, -0.959922f, -0.959948f, -0.959975f,
- -0.960002f, -0.960029f, -0.960056f, -0.960083f, -0.960109f, -0.960136f, -0.960163f, -0.960190f,
- -0.960217f, -0.960243f, -0.960270f, -0.960297f, -0.960324f, -0.960350f, -0.960377f, -0.960404f,
- -0.960431f, -0.960457f, -0.960484f, -0.960511f, -0.960537f, -0.960564f, -0.960591f, -0.960617f,
- -0.960644f, -0.960670f, -0.960697f, -0.960724f, -0.960750f, -0.960777f, -0.960804f, -0.960830f,
- -0.960857f, -0.960883f, -0.960910f, -0.960936f, -0.960963f, -0.960989f, -0.961016f, -0.961042f,
- -0.961069f, -0.961095f, -0.961122f, -0.961148f, -0.961175f, -0.961201f, -0.961228f, -0.961254f,
- -0.961280f, -0.961307f, -0.961333f, -0.961360f, -0.961386f, -0.961412f, -0.961439f, -0.961465f,
- -0.961492f, -0.961518f, -0.961544f, -0.961571f, -0.961597f, -0.961623f, -0.961649f, -0.961676f,
- -0.961702f, -0.961728f, -0.961755f, -0.961781f, -0.961807f, -0.961833f, -0.961860f, -0.961886f,
- -0.961912f, -0.961938f, -0.961964f, -0.961991f, -0.962017f, -0.962043f, -0.962069f, -0.962095f,
- -0.962121f, -0.962148f, -0.962174f, -0.962200f, -0.962226f, -0.962252f, -0.962278f, -0.962304f,
- -0.962330f, -0.962356f, -0.962382f, -0.962408f, -0.962434f, -0.962460f, -0.962486f, -0.962512f,
- -0.962538f, -0.962564f, -0.962590f, -0.962616f, -0.962642f, -0.962668f, -0.962694f, -0.962720f,
- -0.962746f, -0.962772f, -0.962798f, -0.962824f, -0.962850f, -0.962876f, -0.962902f, -0.962927f,
- -0.962953f, -0.962979f, -0.963005f, -0.963031f, -0.963057f, -0.963082f, -0.963108f, -0.963134f,
- -0.963160f, -0.963186f, -0.963211f, -0.963237f, -0.963263f, -0.963289f, -0.963314f, -0.963340f,
- -0.963366f, -0.963391f, -0.963417f, -0.963443f, -0.963469f, -0.963494f, -0.963520f, -0.963546f,
- -0.963571f, -0.963597f, -0.963623f, -0.963648f, -0.963674f, -0.963699f, -0.963725f, -0.963750f,
- -0.963776f, -0.963802f, -0.963827f, -0.963853f, -0.963878f, -0.963904f, -0.963929f, -0.963955f,
- -0.963980f, -0.964006f, -0.964031f, -0.964057f, -0.964082f, -0.964108f, -0.964133f, -0.964159f,
- -0.964184f, -0.964209f, -0.964235f, -0.964260f, -0.964286f, -0.964311f, -0.964336f, -0.964362f,
- -0.964387f, -0.964413f, -0.964438f, -0.964463f, -0.964489f, -0.964514f, -0.964539f, -0.964565f,
- -0.964590f, -0.964615f, -0.964640f, -0.964666f, -0.964691f, -0.964716f, -0.964741f, -0.964767f,
- -0.964792f, -0.964817f, -0.964842f, -0.964867f, -0.964893f, -0.964918f, -0.964943f, -0.964968f,
- -0.964993f, -0.965018f, -0.965044f, -0.965069f, -0.965094f, -0.965119f, -0.965144f, -0.965169f,
- -0.965194f, -0.965219f, -0.965244f, -0.965269f, -0.965294f, -0.965319f, -0.965344f, -0.965369f,
- -0.965394f, -0.965419f, -0.965444f, -0.965469f, -0.965494f, -0.965519f, -0.965544f, -0.965569f,
- -0.965594f, -0.965619f, -0.965644f, -0.965669f, -0.965694f, -0.965719f, -0.965744f, -0.965769f,
- -0.965793f, -0.965818f, -0.965843f, -0.965868f, -0.965893f, -0.965918f, -0.965942f, -0.965967f,
- -0.965992f, -0.966017f, -0.966042f, -0.966066f, -0.966091f, -0.966116f, -0.966141f, -0.966165f,
- -0.966190f, -0.966215f, -0.966239f, -0.966264f, -0.966289f, -0.966313f, -0.966338f, -0.966363f,
- -0.966387f, -0.966412f, -0.966437f, -0.966461f, -0.966486f, -0.966511f, -0.966535f, -0.966560f,
- -0.966584f, -0.966609f, -0.966633f, -0.966658f, -0.966683f, -0.966707f, -0.966732f, -0.966756f,
- -0.966781f, -0.966805f, -0.966830f, -0.966854f, -0.966879f, -0.966903f, -0.966928f, -0.966952f,
- -0.966976f, -0.967001f, -0.967025f, -0.967050f, -0.967074f, -0.967099f, -0.967123f, -0.967147f,
- -0.967172f, -0.967196f, -0.967220f, -0.967245f, -0.967269f, -0.967293f, -0.967318f, -0.967342f,
- -0.967366f, -0.967391f, -0.967415f, -0.967439f, -0.967463f, -0.967488f, -0.967512f, -0.967536f,
- -0.967560f, -0.967585f, -0.967609f, -0.967633f, -0.967657f, -0.967681f, -0.967706f, -0.967730f,
- -0.967754f, -0.967778f, -0.967802f, -0.967826f, -0.967850f, -0.967874f, -0.967899f, -0.967923f,
- -0.967947f, -0.967971f, -0.967995f, -0.968019f, -0.968043f, -0.968067f, -0.968091f, -0.968115f,
- -0.968139f, -0.968163f, -0.968187f, -0.968211f, -0.968235f, -0.968259f, -0.968283f, -0.968307f,
- -0.968331f, -0.968355f, -0.968379f, -0.968403f, -0.968427f, -0.968450f, -0.968474f, -0.968498f,
- -0.968522f, -0.968546f, -0.968570f, -0.968594f, -0.968617f, -0.968641f, -0.968665f, -0.968689f,
- -0.968713f, -0.968737f, -0.968760f, -0.968784f, -0.968808f, -0.968832f, -0.968855f, -0.968879f,
- -0.968903f, -0.968927f, -0.968950f, -0.968974f, -0.968998f, -0.969021f, -0.969045f, -0.969069f,
- -0.969092f, -0.969116f, -0.969140f, -0.969163f, -0.969187f, -0.969210f, -0.969234f, -0.969258f,
- -0.969281f, -0.969305f, -0.969328f, -0.969352f, -0.969375f, -0.969399f, -0.969423f, -0.969446f,
- -0.969470f, -0.969493f, -0.969517f, -0.969540f, -0.969564f, -0.969587f, -0.969611f, -0.969634f,
- -0.969657f, -0.969681f, -0.969704f, -0.969728f, -0.969751f, -0.969774f, -0.969798f, -0.969821f,
- -0.969845f, -0.969868f, -0.969891f, -0.969915f, -0.969938f, -0.969961f, -0.969985f, -0.970008f,
- -0.970031f, -0.970055f, -0.970078f, -0.970101f, -0.970124f, -0.970148f, -0.970171f, -0.970194f,
- -0.970217f, -0.970241f, -0.970264f, -0.970287f, -0.970310f, -0.970333f, -0.970357f, -0.970380f,
- -0.970403f, -0.970426f, -0.970449f, -0.970472f, -0.970495f, -0.970518f, -0.970542f, -0.970565f,
- -0.970588f, -0.970611f, -0.970634f, -0.970657f, -0.970680f, -0.970703f, -0.970726f, -0.970749f,
- -0.970772f, -0.970795f, -0.970818f, -0.970841f, -0.970864f, -0.970887f, -0.970910f, -0.970933f,
- -0.970956f, -0.970979f, -0.971002f, -0.971025f, -0.971048f, -0.971071f, -0.971093f, -0.971116f,
- -0.971139f, -0.971162f, -0.971185f, -0.971208f, -0.971231f, -0.971253f, -0.971276f, -0.971299f,
- -0.971322f, -0.971345f, -0.971367f, -0.971390f, -0.971413f, -0.971436f, -0.971458f, -0.971481f,
- -0.971504f, -0.971527f, -0.971549f, -0.971572f, -0.971595f, -0.971617f, -0.971640f, -0.971663f,
- -0.971685f, -0.971708f, -0.971731f, -0.971753f, -0.971776f, -0.971799f, -0.971821f, -0.971844f,
- -0.971866f, -0.971889f, -0.971911f, -0.971934f, -0.971957f, -0.971979f, -0.972002f, -0.972024f,
- -0.972047f, -0.972069f, -0.972092f, -0.972114f, -0.972137f, -0.972159f, -0.972182f, -0.972204f,
- -0.972227f, -0.972249f, -0.972271f, -0.972294f, -0.972316f, -0.972339f, -0.972361f, -0.972383f,
- -0.972406f, -0.972428f, -0.972450f, -0.972473f, -0.972495f, -0.972517f, -0.972540f, -0.972562f,
- -0.972584f, -0.972607f, -0.972629f, -0.972651f, -0.972673f, -0.972696f, -0.972718f, -0.972740f,
- -0.972762f, -0.972785f, -0.972807f, -0.972829f, -0.972851f, -0.972873f, -0.972896f, -0.972918f,
- -0.972940f, -0.972962f, -0.972984f, -0.973006f, -0.973028f, -0.973051f, -0.973073f, -0.973095f,
- -0.973117f, -0.973139f, -0.973161f, -0.973183f, -0.973205f, -0.973227f, -0.973249f, -0.973271f,
- -0.973293f, -0.973315f, -0.973337f, -0.973359f, -0.973381f, -0.973403f, -0.973425f, -0.973447f,
- -0.973469f, -0.973491f, -0.973513f, -0.973535f, -0.973557f, -0.973579f, -0.973601f, -0.973622f,
- -0.973644f, -0.973666f, -0.973688f, -0.973710f, -0.973732f, -0.973753f, -0.973775f, -0.973797f,
- -0.973819f, -0.973841f, -0.973862f, -0.973884f, -0.973906f, -0.973928f, -0.973949f, -0.973971f,
- -0.973993f, -0.974015f, -0.974036f, -0.974058f, -0.974080f, -0.974101f, -0.974123f, -0.974145f,
- -0.974166f, -0.974188f, -0.974210f, -0.974231f, -0.974253f, -0.974275f, -0.974296f, -0.974318f,
- -0.974339f, -0.974361f, -0.974383f, -0.974404f, -0.974426f, -0.974447f, -0.974469f, -0.974490f,
- -0.974512f, -0.974533f, -0.974555f, -0.974576f, -0.974598f, -0.974619f, -0.974641f, -0.974662f,
- -0.974684f, -0.974705f, -0.974726f, -0.974748f, -0.974769f, -0.974791f, -0.974812f, -0.974833f,
- -0.974855f, -0.974876f, -0.974897f, -0.974919f, -0.974940f, -0.974961f, -0.974983f, -0.975004f,
- -0.975025f, -0.975047f, -0.975068f, -0.975089f, -0.975110f, -0.975132f, -0.975153f, -0.975174f,
- -0.975195f, -0.975217f, -0.975238f, -0.975259f, -0.975280f, -0.975301f, -0.975323f, -0.975344f,
- -0.975365f, -0.975386f, -0.975407f, -0.975428f, -0.975449f, -0.975471f, -0.975492f, -0.975513f,
- -0.975534f, -0.975555f, -0.975576f, -0.975597f, -0.975618f, -0.975639f, -0.975660f, -0.975681f,
- -0.975702f, -0.975723f, -0.975744f, -0.975765f, -0.975786f, -0.975807f, -0.975828f, -0.975849f,
- -0.975870f, -0.975891f, -0.975912f, -0.975933f, -0.975954f, -0.975974f, -0.975995f, -0.976016f,
- -0.976037f, -0.976058f, -0.976079f, -0.976100f, -0.976120f, -0.976141f, -0.976162f, -0.976183f,
- -0.976204f, -0.976224f, -0.976245f, -0.976266f, -0.976287f, -0.976308f, -0.976328f, -0.976349f,
- -0.976370f, -0.976390f, -0.976411f, -0.976432f, -0.976453f, -0.976473f, -0.976494f, -0.976515f,
- -0.976535f, -0.976556f, -0.976576f, -0.976597f, -0.976618f, -0.976638f, -0.976659f, -0.976680f,
- -0.976700f, -0.976721f, -0.976741f, -0.976762f, -0.976782f, -0.976803f, -0.976823f, -0.976844f,
- -0.976864f, -0.976885f, -0.976905f, -0.976926f, -0.976946f, -0.976967f, -0.976987f, -0.977008f,
- -0.977028f, -0.977049f, -0.977069f, -0.977089f, -0.977110f, -0.977130f, -0.977151f, -0.977171f,
- -0.977191f, -0.977212f, -0.977232f, -0.977252f, -0.977273f, -0.977293f, -0.977313f, -0.977334f,
- -0.977354f, -0.977374f, -0.977394f, -0.977415f, -0.977435f, -0.977455f, -0.977475f, -0.977496f,
- -0.977516f, -0.977536f, -0.977556f, -0.977577f, -0.977597f, -0.977617f, -0.977637f, -0.977657f,
- -0.977677f, -0.977697f, -0.977718f, -0.977738f, -0.977758f, -0.977778f, -0.977798f, -0.977818f,
- -0.977838f, -0.977858f, -0.977878f, -0.977898f, -0.977918f, -0.977938f, -0.977959f, -0.977979f,
- -0.977998f, -0.978019f, -0.978038f, -0.978058f, -0.978078f, -0.978098f, -0.978118f, -0.978138f,
- -0.978158f, -0.978178f, -0.978198f, -0.978218f, -0.978238f, -0.978258f, -0.978278f, -0.978298f,
- -0.978317f, -0.978337f, -0.978357f, -0.978377f, -0.978397f, -0.978417f, -0.978436f, -0.978456f,
- -0.978476f, -0.978496f, -0.978516f, -0.978535f, -0.978555f, -0.978575f, -0.978594f, -0.978614f,
- -0.978634f, -0.978654f, -0.978673f, -0.978693f, -0.978713f, -0.978732f, -0.978752f, -0.978772f,
- -0.978791f, -0.978811f, -0.978831f, -0.978850f, -0.978870f, -0.978889f, -0.978909f, -0.978929f,
- -0.978948f, -0.978968f, -0.978987f, -0.979007f, -0.979026f, -0.979046f, -0.979065f, -0.979085f,
- -0.979104f, -0.979124f, -0.979143f, -0.979163f, -0.979182f, -0.979202f, -0.979221f, -0.979241f,
- -0.979260f, -0.979280f, -0.979299f, -0.979318f, -0.979338f, -0.979357f, -0.979376f, -0.979396f,
- -0.979415f, -0.979435f, -0.979454f, -0.979473f, -0.979493f, -0.979512f, -0.979531f, -0.979550f,
- -0.979570f, -0.979589f, -0.979608f, -0.979628f, -0.979647f, -0.979666f, -0.979685f, -0.979704f,
- -0.979724f, -0.979743f, -0.979762f, -0.979781f, -0.979800f, -0.979820f, -0.979839f, -0.979858f,
- -0.979877f, -0.979896f, -0.979915f, -0.979934f, -0.979954f, -0.979973f, -0.979992f, -0.980011f,
- -0.980030f, -0.980049f, -0.980068f, -0.980087f, -0.980106f, -0.980125f, -0.980144f, -0.980163f,
- -0.980182f, -0.980201f, -0.980220f, -0.980239f, -0.980258f, -0.980277f, -0.980296f, -0.980315f,
- -0.980334f, -0.980353f, -0.980372f, -0.980390f, -0.980409f, -0.980428f, -0.980447f, -0.980466f,
- -0.980485f, -0.980504f, -0.980523f, -0.980541f, -0.980560f, -0.980579f, -0.980598f, -0.980617f,
- -0.980635f, -0.980654f, -0.980673f, -0.980692f, -0.980710f, -0.980729f, -0.980748f, -0.980767f,
- -0.980785f, -0.980804f, -0.980823f, -0.980841f, -0.980860f, -0.980879f, -0.980897f, -0.980916f,
- -0.980935f, -0.980953f, -0.980972f, -0.980990f, -0.981009f, -0.981028f, -0.981046f, -0.981065f,
- -0.981083f, -0.981102f, -0.981120f, -0.981139f, -0.981158f, -0.981176f, -0.981195f, -0.981213f,
- -0.981232f, -0.981250f, -0.981269f, -0.981287f, -0.981305f, -0.981324f, -0.981342f, -0.981361f,
- -0.981379f, -0.981398f, -0.981416f, -0.981434f, -0.981453f, -0.981471f, -0.981490f, -0.981508f,
- -0.981526f, -0.981545f, -0.981563f, -0.981581f, -0.981600f, -0.981618f, -0.981636f, -0.981654f,
- -0.981673f, -0.981691f, -0.981709f, -0.981727f, -0.981746f, -0.981764f, -0.981782f, -0.981800f,
- -0.981819f, -0.981837f, -0.981855f, -0.981873f, -0.981891f, -0.981909f, -0.981928f, -0.981946f,
- -0.981964f, -0.981982f, -0.982000f, -0.982018f, -0.982036f, -0.982054f, -0.982072f, -0.982091f,
- -0.982109f, -0.982127f, -0.982145f, -0.982163f, -0.982181f, -0.982199f, -0.982217f, -0.982235f,
- -0.982253f, -0.982271f, -0.982289f, -0.982307f, -0.982325f, -0.982343f, -0.982360f, -0.982378f,
- -0.982396f, -0.982414f, -0.982432f, -0.982450f, -0.982468f, -0.982486f, -0.982504f, -0.982521f,
- -0.982539f, -0.982557f, -0.982575f, -0.982593f, -0.982611f, -0.982628f, -0.982646f, -0.982664f,
- -0.982682f, -0.982699f, -0.982717f, -0.982735f, -0.982753f, -0.982770f, -0.982788f, -0.982806f,
- -0.982824f, -0.982841f, -0.982859f, -0.982877f, -0.982894f, -0.982912f, -0.982930f, -0.982947f,
- -0.982965f, -0.982982f, -0.983000f, -0.983018f, -0.983035f, -0.983053f, -0.983070f, -0.983088f,
- -0.983105f, -0.983123f, -0.983141f, -0.983158f, -0.983176f, -0.983193f, -0.983211f, -0.983228f,
- -0.983246f, -0.983263f, -0.983281f, -0.983298f, -0.983315f, -0.983333f, -0.983350f, -0.983368f,
- -0.983385f, -0.983402f, -0.983420f, -0.983437f, -0.983455f, -0.983472f, -0.983489f, -0.983507f,
- -0.983524f, -0.983541f, -0.983559f, -0.983576f, -0.983593f, -0.983611f, -0.983628f, -0.983645f,
- -0.983662f, -0.983680f, -0.983697f, -0.983714f, -0.983731f, -0.983749f, -0.983766f, -0.983783f,
- -0.983800f, -0.983817f, -0.983835f, -0.983852f, -0.983869f, -0.983886f, -0.983903f, -0.983920f,
- -0.983937f, -0.983955f, -0.983972f, -0.983989f, -0.984006f, -0.984023f, -0.984040f, -0.984057f,
- -0.984074f, -0.984091f, -0.984108f, -0.984125f, -0.984142f, -0.984159f, -0.984176f, -0.984193f,
- -0.984210f, -0.984227f, -0.984244f, -0.984261f, -0.984278f, -0.984295f, -0.984312f, -0.984329f,
- -0.984346f, -0.984362f, -0.984379f, -0.984396f, -0.984413f, -0.984430f, -0.984447f, -0.984464f,
- -0.984480f, -0.984497f, -0.984514f, -0.984531f, -0.984548f, -0.984564f, -0.984581f, -0.984598f,
- -0.984615f, -0.984632f, -0.984648f, -0.984665f, -0.984682f, -0.984698f, -0.984715f, -0.984732f,
- -0.984748f, -0.984765f, -0.984782f, -0.984798f, -0.984815f, -0.984832f, -0.984848f, -0.984865f,
- -0.984882f, -0.984898f, -0.984915f, -0.984931f, -0.984948f, -0.984965f, -0.984981f, -0.984998f,
- -0.985014f, -0.985031f, -0.985047f, -0.985064f, -0.985080f, -0.985097f, -0.985113f, -0.985130f,
- -0.985146f, -0.985163f, -0.985179f, -0.985196f, -0.985212f, -0.985228f, -0.985245f, -0.985261f,
- -0.985278f, -0.985294f, -0.985310f, -0.985327f, -0.985343f, -0.985359f, -0.985376f, -0.985392f,
- -0.985408f, -0.985425f, -0.985441f, -0.985457f, -0.985474f, -0.985490f, -0.985506f, -0.985523f,
- -0.985539f, -0.985555f, -0.985571f, -0.985587f, -0.985604f, -0.985620f, -0.985636f, -0.985652f,
- -0.985668f, -0.985685f, -0.985701f, -0.985717f, -0.985733f, -0.985749f, -0.985765f, -0.985781f,
- -0.985798f, -0.985814f, -0.985830f, -0.985846f, -0.985862f, -0.985878f, -0.985894f, -0.985910f,
- -0.985926f, -0.985942f, -0.985958f, -0.985974f, -0.985990f, -0.986006f, -0.986022f, -0.986038f,
- -0.986054f, -0.986070f, -0.986086f, -0.986102f, -0.986118f, -0.986134f, -0.986150f, -0.986165f,
- -0.986181f, -0.986197f, -0.986213f, -0.986229f, -0.986245f, -0.986261f, -0.986276f, -0.986292f,
- -0.986308f, -0.986324f, -0.986340f, -0.986355f, -0.986371f, -0.986387f, -0.986403f, -0.986419f,
- -0.986434f, -0.986450f, -0.986466f, -0.986481f, -0.986497f, -0.986513f, -0.986529f, -0.986544f,
- -0.986560f, -0.986576f, -0.986591f, -0.986607f, -0.986623f, -0.986638f, -0.986654f, -0.986669f,
- -0.986685f, -0.986701f, -0.986716f, -0.986732f, -0.986747f, -0.986763f, -0.986778f, -0.986794f,
- -0.986809f, -0.986825f, -0.986840f, -0.986856f, -0.986871f, -0.986887f, -0.986902f, -0.986918f,
- -0.986933f, -0.986949f, -0.986964f, -0.986980f, -0.986995f, -0.987010f, -0.987026f, -0.987041f,
- -0.987057f, -0.987072f, -0.987087f, -0.987103f, -0.987118f, -0.987133f, -0.987149f, -0.987164f,
- -0.987179f, -0.987195f, -0.987210f, -0.987225f, -0.987240f, -0.987256f, -0.987271f, -0.987286f,
- -0.987301f, -0.987317f, -0.987332f, -0.987347f, -0.987362f, -0.987377f, -0.987393f, -0.987408f,
- -0.987423f, -0.987438f, -0.987453f, -0.987468f, -0.987484f, -0.987499f, -0.987514f, -0.987529f,
- -0.987544f, -0.987559f, -0.987574f, -0.987589f, -0.987604f, -0.987619f, -0.987634f, -0.987649f,
- -0.987664f, -0.987679f, -0.987694f, -0.987709f, -0.987724f, -0.987739f, -0.987754f, -0.987769f,
- -0.987784f, -0.987799f, -0.987814f, -0.987829f, -0.987844f, -0.987859f, -0.987874f, -0.987889f,
- -0.987903f, -0.987918f, -0.987933f, -0.987948f, -0.987963f, -0.987978f, -0.987992f, -0.988007f,
- -0.988022f, -0.988037f, -0.988052f, -0.988066f, -0.988081f, -0.988096f, -0.988111f, -0.988125f,
- -0.988140f, -0.988155f, -0.988169f, -0.988184f, -0.988199f, -0.988214f, -0.988228f, -0.988243f,
- -0.988258f, -0.988272f, -0.988287f, -0.988301f, -0.988316f, -0.988331f, -0.988345f, -0.988360f,
- -0.988374f, -0.988389f, -0.988404f, -0.988418f, -0.988433f, -0.988447f, -0.988462f, -0.988476f,
- -0.988491f, -0.988505f, -0.988520f, -0.988534f, -0.988549f, -0.988563f, -0.988578f, -0.988592f,
- -0.988607f, -0.988621f, -0.988635f, -0.988650f, -0.988664f, -0.988679f, -0.988693f, -0.988707f,
- -0.988722f, -0.988736f, -0.988750f, -0.988765f, -0.988779f, -0.988793f, -0.988808f, -0.988822f,
- -0.988836f, -0.988851f, -0.988865f, -0.988879f, -0.988893f, -0.988908f, -0.988922f, -0.988936f,
- -0.988950f, -0.988964f, -0.988979f, -0.988993f, -0.989007f, -0.989021f, -0.989035f, -0.989050f,
- -0.989064f, -0.989078f, -0.989092f, -0.989106f, -0.989120f, -0.989134f, -0.989148f, -0.989162f,
- -0.989177f, -0.989191f, -0.989205f, -0.989219f, -0.989233f, -0.989247f, -0.989261f, -0.989275f,
- -0.989289f, -0.989303f, -0.989317f, -0.989331f, -0.989345f, -0.989359f, -0.989373f, -0.989386f,
- -0.989400f, -0.989414f, -0.989428f, -0.989442f, -0.989456f, -0.989470f, -0.989484f, -0.989498f,
- -0.989511f, -0.989525f, -0.989539f, -0.989553f, -0.989567f, -0.989581f, -0.989594f, -0.989608f,
- -0.989622f, -0.989636f, -0.989650f, -0.989663f, -0.989677f, -0.989691f, -0.989704f, -0.989718f,
- -0.989732f, -0.989746f, -0.989759f, -0.989773f, -0.989787f, -0.989800f, -0.989814f, -0.989828f,
- -0.989841f, -0.989855f, -0.989869f, -0.989882f, -0.989896f, -0.989909f, -0.989923f, -0.989936f,
- -0.989950f, -0.989964f, -0.989977f, -0.989991f, -0.990004f, -0.990018f, -0.990031f, -0.990045f,
- -0.990058f, -0.990072f, -0.990085f, -0.990099f, -0.990112f, -0.990126f, -0.990139f, -0.990152f,
- -0.990166f, -0.990179f, -0.990193f, -0.990206f, -0.990219f, -0.990233f, -0.990246f, -0.990259f,
- -0.990273f, -0.990286f, -0.990299f, -0.990313f, -0.990326f, -0.990339f, -0.990353f, -0.990366f,
- -0.990379f, -0.990393f, -0.990406f, -0.990419f, -0.990432f, -0.990445f, -0.990459f, -0.990472f,
- -0.990485f, -0.990498f, -0.990511f, -0.990525f, -0.990538f, -0.990551f, -0.990564f, -0.990577f,
- -0.990590f, -0.990603f, -0.990617f, -0.990630f, -0.990643f, -0.990656f, -0.990669f, -0.990682f,
- -0.990695f, -0.990708f, -0.990721f, -0.990734f, -0.990747f, -0.990760f, -0.990773f, -0.990786f,
- -0.990799f, -0.990812f, -0.990825f, -0.990838f, -0.990851f, -0.990864f, -0.990877f, -0.990890f,
- -0.990903f, -0.990916f, -0.990928f, -0.990941f, -0.990954f, -0.990967f, -0.990980f, -0.990993f,
- -0.991006f, -0.991018f, -0.991031f, -0.991044f, -0.991057f, -0.991070f, -0.991082f, -0.991095f,
- -0.991108f, -0.991121f, -0.991133f, -0.991146f, -0.991159f, -0.991172f, -0.991184f, -0.991197f,
- -0.991210f, -0.991222f, -0.991235f, -0.991248f, -0.991260f, -0.991273f, -0.991286f, -0.991298f,
- -0.991311f, -0.991323f, -0.991336f, -0.991349f, -0.991361f, -0.991374f, -0.991386f, -0.991399f,
- -0.991411f, -0.991424f, -0.991437f, -0.991449f, -0.991462f, -0.991474f, -0.991487f, -0.991499f,
- -0.991511f, -0.991524f, -0.991536f, -0.991549f, -0.991561f, -0.991574f, -0.991586f, -0.991598f,
- -0.991611f, -0.991623f, -0.991636f, -0.991648f, -0.991660f, -0.991673f, -0.991685f, -0.991697f,
- -0.991710f, -0.991722f, -0.991734f, -0.991747f, -0.991759f, -0.991771f, -0.991783f, -0.991796f,
- -0.991808f, -0.991820f, -0.991832f, -0.991845f, -0.991857f, -0.991869f, -0.991881f, -0.991894f,
- -0.991906f, -0.991918f, -0.991930f, -0.991942f, -0.991954f, -0.991966f, -0.991979f, -0.991991f,
- -0.992003f, -0.992015f, -0.992027f, -0.992039f, -0.992051f, -0.992063f, -0.992075f, -0.992087f,
- -0.992099f, -0.992111f, -0.992123f, -0.992135f, -0.992147f, -0.992159f, -0.992171f, -0.992183f,
- -0.992195f, -0.992207f, -0.992219f, -0.992231f, -0.992243f, -0.992255f, -0.992267f, -0.992279f,
- -0.992291f, -0.992302f, -0.992314f, -0.992326f, -0.992338f, -0.992350f, -0.992362f, -0.992374f,
- -0.992385f, -0.992397f, -0.992409f, -0.992421f, -0.992433f, -0.992444f, -0.992456f, -0.992468f,
- -0.992480f, -0.992491f, -0.992503f, -0.992515f, -0.992526f, -0.992538f, -0.992550f, -0.992561f,
- -0.992573f, -0.992585f, -0.992596f, -0.992608f, -0.992620f, -0.992631f, -0.992643f, -0.992655f,
- -0.992666f, -0.992678f, -0.992689f, -0.992701f, -0.992712f, -0.992724f, -0.992736f, -0.992747f,
- -0.992759f, -0.992770f, -0.992782f, -0.992793f, -0.992805f, -0.992816f, -0.992828f, -0.992839f,
- -0.992850f, -0.992862f, -0.992873f, -0.992885f, -0.992896f, -0.992908f, -0.992919f, -0.992930f,
- -0.992942f, -0.992953f, -0.992964f, -0.992976f, -0.992987f, -0.992998f, -0.993010f, -0.993021f,
- -0.993032f, -0.993044f, -0.993055f, -0.993066f, -0.993077f, -0.993089f, -0.993100f, -0.993111f,
- -0.993122f, -0.993134f, -0.993145f, -0.993156f, -0.993167f, -0.993178f, -0.993190f, -0.993201f,
- -0.993212f, -0.993223f, -0.993234f, -0.993245f, -0.993257f, -0.993268f, -0.993279f, -0.993290f,
- -0.993301f, -0.993312f, -0.993323f, -0.993334f, -0.993345f, -0.993356f, -0.993367f, -0.993378f,
- -0.993389f, -0.993400f, -0.993411f, -0.993422f, -0.993433f, -0.993444f, -0.993455f, -0.993466f,
- -0.993477f, -0.993488f, -0.993499f, -0.993510f, -0.993521f, -0.993532f, -0.993542f, -0.993553f,
- -0.993564f, -0.993575f, -0.993586f, -0.993597f, -0.993608f, -0.993618f, -0.993629f, -0.993640f,
- -0.993651f, -0.993662f, -0.993672f, -0.993683f, -0.993694f, -0.993705f, -0.993715f, -0.993726f,
- -0.993737f, -0.993747f, -0.993758f, -0.993769f, -0.993779f, -0.993790f, -0.993801f, -0.993811f,
- -0.993822f, -0.993833f, -0.993843f, -0.993854f, -0.993865f, -0.993875f, -0.993886f, -0.993896f,
- -0.993907f, -0.993918f, -0.993928f, -0.993939f, -0.993949f, -0.993960f, -0.993970f, -0.993981f,
- -0.993991f, -0.994002f, -0.994012f, -0.994023f, -0.994033f, -0.994044f, -0.994054f, -0.994064f,
- -0.994075f, -0.994085f, -0.994096f, -0.994106f, -0.994116f, -0.994127f, -0.994137f, -0.994148f,
- -0.994158f, -0.994168f, -0.994179f, -0.994189f, -0.994199f, -0.994210f, -0.994220f, -0.994230f,
- -0.994240f, -0.994251f, -0.994261f, -0.994271f, -0.994281f, -0.994292f, -0.994302f, -0.994312f,
- -0.994322f, -0.994333f, -0.994343f, -0.994353f, -0.994363f, -0.994373f, -0.994383f, -0.994394f,
- -0.994404f, -0.994414f, -0.994424f, -0.994434f, -0.994444f, -0.994454f, -0.994464f, -0.994474f,
- -0.994484f, -0.994494f, -0.994505f, -0.994515f, -0.994525f, -0.994535f, -0.994545f, -0.994555f,
- -0.994565f, -0.994575f, -0.994585f, -0.994594f, -0.994604f, -0.994614f, -0.994624f, -0.994634f,
- -0.994644f, -0.994654f, -0.994664f, -0.994674f, -0.994684f, -0.994694f, -0.994703f, -0.994713f,
- -0.994723f, -0.994733f, -0.994743f, -0.994753f, -0.994762f, -0.994772f, -0.994782f, -0.994792f,
- -0.994802f, -0.994811f, -0.994821f, -0.994831f, -0.994841f, -0.994850f, -0.994860f, -0.994870f,
- -0.994879f, -0.994889f, -0.994899f, -0.994908f, -0.994918f, -0.994928f, -0.994937f, -0.994947f,
- -0.994957f, -0.994966f, -0.994976f, -0.994985f, -0.994995f, -0.995005f, -0.995014f, -0.995024f,
- -0.995033f, -0.995043f, -0.995052f, -0.995062f, -0.995071f, -0.995081f, -0.995090f, -0.995100f,
- -0.995109f, -0.995119f, -0.995128f, -0.995138f, -0.995147f, -0.995156f, -0.995166f, -0.995175f,
- -0.995185f, -0.995194f, -0.995203f, -0.995213f, -0.995222f, -0.995232f, -0.995241f, -0.995250f,
- -0.995260f, -0.995269f, -0.995278f, -0.995288f, -0.995297f, -0.995306f, -0.995315f, -0.995325f,
- -0.995334f, -0.995343f, -0.995352f, -0.995362f, -0.995371f, -0.995380f, -0.995389f, -0.995398f,
- -0.995408f, -0.995417f, -0.995426f, -0.995435f, -0.995444f, -0.995453f, -0.995463f, -0.995472f,
- -0.995481f, -0.995490f, -0.995499f, -0.995508f, -0.995517f, -0.995526f, -0.995535f, -0.995544f,
- -0.995553f, -0.995562f, -0.995571f, -0.995580f, -0.995589f, -0.995598f, -0.995607f, -0.995616f,
- -0.995625f, -0.995634f, -0.995643f, -0.995652f, -0.995661f, -0.995670f, -0.995679f, -0.995688f,
- -0.995697f, -0.995705f, -0.995714f, -0.995723f, -0.995732f, -0.995741f, -0.995750f, -0.995759f,
- -0.995767f, -0.995776f, -0.995785f, -0.995794f, -0.995803f, -0.995811f, -0.995820f, -0.995829f,
- -0.995838f, -0.995846f, -0.995855f, -0.995864f, -0.995872f, -0.995881f, -0.995890f, -0.995899f,
- -0.995907f, -0.995916f, -0.995925f, -0.995933f, -0.995942f, -0.995950f, -0.995959f, -0.995968f,
- -0.995976f, -0.995985f, -0.995993f, -0.996002f, -0.996011f, -0.996019f, -0.996028f, -0.996036f,
- -0.996045f, -0.996053f, -0.996062f, -0.996070f, -0.996079f, -0.996087f, -0.996096f, -0.996104f,
- -0.996113f, -0.996121f, -0.996129f, -0.996138f, -0.996146f, -0.996155f, -0.996163f, -0.996171f,
- -0.996180f, -0.996188f, -0.996197f, -0.996205f, -0.996213f, -0.996222f, -0.996230f, -0.996238f,
- -0.996247f, -0.996255f, -0.996263f, -0.996271f, -0.996280f, -0.996288f, -0.996296f, -0.996304f,
- -0.996313f, -0.996321f, -0.996329f, -0.996337f, -0.996345f, -0.996354f, -0.996362f, -0.996370f,
- -0.996378f, -0.996386f, -0.996394f, -0.996403f, -0.996411f, -0.996419f, -0.996427f, -0.996435f,
- -0.996443f, -0.996451f, -0.996459f, -0.996467f, -0.996475f, -0.996483f, -0.996491f, -0.996499f,
- -0.996507f, -0.996515f, -0.996523f, -0.996531f, -0.996539f, -0.996547f, -0.996555f, -0.996563f,
- -0.996571f, -0.996579f, -0.996587f, -0.996595f, -0.996603f, -0.996611f, -0.996619f, -0.996626f,
- -0.996634f, -0.996642f, -0.996650f, -0.996658f, -0.996666f, -0.996674f, -0.996681f, -0.996689f,
- -0.996697f, -0.996705f, -0.996712f, -0.996720f, -0.996728f, -0.996736f, -0.996743f, -0.996751f,
- -0.996759f, -0.996767f, -0.996774f, -0.996782f, -0.996790f, -0.996797f, -0.996805f, -0.996813f,
- -0.996820f, -0.996828f, -0.996836f, -0.996843f, -0.996851f, -0.996858f, -0.996866f, -0.996874f,
- -0.996881f, -0.996889f, -0.996896f, -0.996904f, -0.996911f, -0.996919f, -0.996926f, -0.996934f,
- -0.996941f, -0.996949f, -0.996956f, -0.996964f, -0.996971f, -0.996979f, -0.996986f, -0.996994f,
- -0.997001f, -0.997008f, -0.997016f, -0.997023f, -0.997031f, -0.997038f, -0.997045f, -0.997053f,
- -0.997060f, -0.997067f, -0.997075f, -0.997082f, -0.997089f, -0.997097f, -0.997104f, -0.997111f,
- -0.997119f, -0.997126f, -0.997133f, -0.997140f, -0.997148f, -0.997155f, -0.997162f, -0.997169f,
- -0.997176f, -0.997184f, -0.997191f, -0.997198f, -0.997205f, -0.997212f, -0.997219f, -0.997227f,
- -0.997234f, -0.997241f, -0.997248f, -0.997255f, -0.997262f, -0.997269f, -0.997276f, -0.997283f,
- -0.997290f, -0.997298f, -0.997305f, -0.997312f, -0.997319f, -0.997326f, -0.997333f, -0.997340f,
- -0.997347f, -0.997354f, -0.997361f, -0.997368f, -0.997374f, -0.997381f, -0.997388f, -0.997395f,
- -0.997402f, -0.997409f, -0.997416f, -0.997423f, -0.997430f, -0.997437f, -0.997443f, -0.997450f,
- -0.997457f, -0.997464f, -0.997471f, -0.997478f, -0.997484f, -0.997491f, -0.997498f, -0.997505f,
- -0.997511f, -0.997518f, -0.997525f, -0.997532f, -0.997538f, -0.997545f, -0.997552f, -0.997559f,
- -0.997565f, -0.997572f, -0.997579f, -0.997585f, -0.997592f, -0.997599f, -0.997605f, -0.997612f,
- -0.997618f, -0.997625f, -0.997632f, -0.997638f, -0.997645f, -0.997651f, -0.997658f, -0.997665f,
- -0.997671f, -0.997678f, -0.997684f, -0.997691f, -0.997697f, -0.997704f, -0.997710f, -0.997717f,
- -0.997723f, -0.997730f, -0.997736f, -0.997742f, -0.997749f, -0.997755f, -0.997762f, -0.997768f,
- -0.997774f, -0.997781f, -0.997787f, -0.997794f, -0.997800f, -0.997806f, -0.997813f, -0.997819f,
- -0.997825f, -0.997832f, -0.997838f, -0.997844f, -0.997851f, -0.997857f, -0.997863f, -0.997869f,
- -0.997876f, -0.997882f, -0.997888f, -0.997894f, -0.997901f, -0.997907f, -0.997913f, -0.997919f,
- -0.997925f, -0.997931f, -0.997938f, -0.997944f, -0.997950f, -0.997956f, -0.997962f, -0.997968f,
- -0.997974f, -0.997980f, -0.997987f, -0.997993f, -0.997999f, -0.998005f, -0.998011f, -0.998017f,
- -0.998023f, -0.998029f, -0.998035f, -0.998041f, -0.998047f, -0.998053f, -0.998059f, -0.998065f,
- -0.998071f, -0.998077f, -0.998083f, -0.998089f, -0.998094f, -0.998100f, -0.998106f, -0.998112f,
- -0.998118f, -0.998124f, -0.998130f, -0.998136f, -0.998142f, -0.998147f, -0.998153f, -0.998159f,
- -0.998165f, -0.998171f, -0.998176f, -0.998182f, -0.998188f, -0.998194f, -0.998200f, -0.998205f,
- -0.998211f, -0.998217f, -0.998222f, -0.998228f, -0.998234f, -0.998240f, -0.998245f, -0.998251f,
- -0.998257f, -0.998262f, -0.998268f, -0.998273f, -0.998279f, -0.998285f, -0.998290f, -0.998296f,
- -0.998302f, -0.998307f, -0.998313f, -0.998318f, -0.998324f, -0.998329f, -0.998335f, -0.998340f,
- -0.998346f, -0.998351f, -0.998357f, -0.998362f, -0.998368f, -0.998373f, -0.998379f, -0.998384f,
- -0.998390f, -0.998395f, -0.998401f, -0.998406f, -0.998411f, -0.998417f, -0.998422f, -0.998428f,
- -0.998433f, -0.998438f, -0.998444f, -0.998449f, -0.998454f, -0.998460f, -0.998465f, -0.998470f,
- -0.998476f, -0.998481f, -0.998486f, -0.998491f, -0.998497f, -0.998502f, -0.998507f, -0.998512f,
- -0.998518f, -0.998523f, -0.998528f, -0.998533f, -0.998538f, -0.998544f, -0.998549f, -0.998554f,
- -0.998559f, -0.998564f, -0.998569f, -0.998574f, -0.998580f, -0.998585f, -0.998590f, -0.998595f,
- -0.998600f, -0.998605f, -0.998610f, -0.998615f, -0.998620f, -0.998625f, -0.998630f, -0.998635f,
- -0.998640f, -0.998645f, -0.998650f, -0.998655f, -0.998660f, -0.998665f, -0.998670f, -0.998675f,
- -0.998680f, -0.998685f, -0.998690f, -0.998695f, -0.998700f, -0.998704f, -0.998709f, -0.998714f,
- -0.998719f, -0.998724f, -0.998729f, -0.998734f, -0.998738f, -0.998743f, -0.998748f, -0.998753f,
- -0.998758f, -0.998762f, -0.998767f, -0.998772f, -0.998777f, -0.998781f, -0.998786f, -0.998791f,
- -0.998795f, -0.998800f, -0.998805f, -0.998810f, -0.998814f, -0.998819f, -0.998824f, -0.998828f,
- -0.998833f, -0.998837f, -0.998842f, -0.998847f, -0.998851f, -0.998856f, -0.998860f, -0.998865f,
- -0.998870f, -0.998874f, -0.998879f, -0.998883f, -0.998888f, -0.998892f, -0.998897f, -0.998901f,
- -0.998906f, -0.998910f, -0.998915f, -0.998919f, -0.998924f, -0.998928f, -0.998932f, -0.998937f,
- -0.998941f, -0.998946f, -0.998950f, -0.998954f, -0.998959f, -0.998963f, -0.998968f, -0.998972f,
- -0.998976f, -0.998981f, -0.998985f, -0.998989f, -0.998994f, -0.998998f, -0.999002f, -0.999006f,
- -0.999011f, -0.999015f, -0.999019f, -0.999023f, -0.999028f, -0.999032f, -0.999036f, -0.999040f,
- -0.999044f, -0.999049f, -0.999053f, -0.999057f, -0.999061f, -0.999065f, -0.999069f, -0.999074f,
- -0.999078f, -0.999082f, -0.999086f, -0.999090f, -0.999094f, -0.999098f, -0.999102f, -0.999106f,
- -0.999110f, -0.999114f, -0.999118f, -0.999122f, -0.999126f, -0.999130f, -0.999134f, -0.999138f,
- -0.999142f, -0.999146f, -0.999150f, -0.999154f, -0.999158f, -0.999162f, -0.999166f, -0.999170f,
- -0.999174f, -0.999178f, -0.999182f, -0.999186f, -0.999189f, -0.999193f, -0.999197f, -0.999201f,
- -0.999205f, -0.999209f, -0.999212f, -0.999216f, -0.999220f, -0.999224f, -0.999228f, -0.999231f,
- -0.999235f, -0.999239f, -0.999243f, -0.999246f, -0.999250f, -0.999254f, -0.999257f, -0.999261f,
- -0.999265f, -0.999268f, -0.999272f, -0.999276f, -0.999279f, -0.999283f, -0.999287f, -0.999290f,
- -0.999294f, -0.999297f, -0.999301f, -0.999305f, -0.999308f, -0.999312f, -0.999315f, -0.999319f,
- -0.999322f, -0.999326f, -0.999329f, -0.999333f, -0.999336f, -0.999340f, -0.999343f, -0.999347f,
- -0.999350f, -0.999354f, -0.999357f, -0.999361f, -0.999364f, -0.999367f, -0.999371f, -0.999374f,
- -0.999378f, -0.999381f, -0.999384f, -0.999388f, -0.999391f, -0.999394f, -0.999398f, -0.999401f,
- -0.999404f, -0.999408f, -0.999411f, -0.999414f, -0.999418f, -0.999421f, -0.999424f, -0.999427f,
- -0.999431f, -0.999434f, -0.999437f, -0.999440f, -0.999443f, -0.999447f, -0.999450f, -0.999453f,
- -0.999456f, -0.999459f, -0.999462f, -0.999466f, -0.999469f, -0.999472f, -0.999475f, -0.999478f,
- -0.999481f, -0.999484f, -0.999487f, -0.999490f, -0.999493f, -0.999497f, -0.999500f, -0.999503f,
- -0.999506f, -0.999509f, -0.999512f, -0.999515f, -0.999518f, -0.999521f, -0.999524f, -0.999527f,
- -0.999529f, -0.999532f, -0.999535f, -0.999538f, -0.999541f, -0.999544f, -0.999547f, -0.999550f,
- -0.999553f, -0.999556f, -0.999558f, -0.999561f, -0.999564f, -0.999567f, -0.999570f, -0.999573f,
- -0.999575f, -0.999578f, -0.999581f, -0.999584f, -0.999586f, -0.999589f, -0.999592f, -0.999595f,
- -0.999597f, -0.999600f, -0.999603f, -0.999605f, -0.999608f, -0.999611f, -0.999614f, -0.999616f,
- -0.999619f, -0.999621f, -0.999624f, -0.999627f, -0.999629f, -0.999632f, -0.999635f, -0.999637f,
- -0.999640f, -0.999642f, -0.999645f, -0.999647f, -0.999650f, -0.999652f, -0.999655f, -0.999658f,
- -0.999660f, -0.999663f, -0.999665f, -0.999667f, -0.999670f, -0.999672f, -0.999675f, -0.999677f,
- -0.999680f, -0.999682f, -0.999685f, -0.999687f, -0.999689f, -0.999692f, -0.999694f, -0.999696f,
- -0.999699f, -0.999701f, -0.999704f, -0.999706f, -0.999708f, -0.999710f, -0.999713f, -0.999715f,
- -0.999717f, -0.999720f, -0.999722f, -0.999724f, -0.999726f, -0.999729f, -0.999731f, -0.999733f,
- -0.999735f, -0.999738f, -0.999740f, -0.999742f, -0.999744f, -0.999746f, -0.999748f, -0.999750f,
- -0.999753f, -0.999755f, -0.999757f, -0.999759f, -0.999761f, -0.999763f, -0.999765f, -0.999767f,
- -0.999769f, -0.999771f, -0.999774f, -0.999776f, -0.999778f, -0.999780f, -0.999782f, -0.999784f,
- -0.999786f, -0.999788f, -0.999790f, -0.999792f, -0.999793f, -0.999795f, -0.999797f, -0.999799f,
- -0.999801f, -0.999803f, -0.999805f, -0.999807f, -0.999809f, -0.999811f, -0.999812f, -0.999814f,
- -0.999816f, -0.999818f, -0.999820f, -0.999822f, -0.999823f, -0.999825f, -0.999827f, -0.999829f,
- -0.999831f, -0.999832f, -0.999834f, -0.999836f, -0.999838f, -0.999839f, -0.999841f, -0.999843f,
- -0.999844f, -0.999846f, -0.999848f, -0.999849f, -0.999851f, -0.999853f, -0.999854f, -0.999856f,
- -0.999858f, -0.999859f, -0.999861f, -0.999862f, -0.999864f, -0.999866f, -0.999867f, -0.999869f,
- -0.999870f, -0.999872f, -0.999873f, -0.999875f, -0.999876f, -0.999878f, -0.999879f, -0.999881f,
- -0.999882f, -0.999884f, -0.999885f, -0.999887f, -0.999888f, -0.999890f, -0.999891f, -0.999892f,
- -0.999894f, -0.999895f, -0.999897f, -0.999898f, -0.999899f, -0.999901f, -0.999902f, -0.999903f,
- -0.999905f, -0.999906f, -0.999907f, -0.999909f, -0.999910f, -0.999911f, -0.999913f, -0.999914f,
- -0.999915f, -0.999916f, -0.999917f, -0.999919f, -0.999920f, -0.999921f, -0.999922f, -0.999924f,
- -0.999925f, -0.999926f, -0.999927f, -0.999928f, -0.999929f, -0.999930f, -0.999932f, -0.999933f,
- -0.999934f, -0.999935f, -0.999936f, -0.999937f, -0.999938f, -0.999939f, -0.999940f, -0.999941f,
- -0.999942f, -0.999943f, -0.999944f, -0.999945f, -0.999946f, -0.999947f, -0.999948f, -0.999949f,
- -0.999950f, -0.999951f, -0.999952f, -0.999953f, -0.999954f, -0.999955f, -0.999956f, -0.999957f,
- -0.999958f, -0.999959f, -0.999959f, -0.999960f, -0.999961f, -0.999962f, -0.999963f, -0.999964f,
- -0.999964f, -0.999965f, -0.999966f, -0.999967f, -0.999968f, -0.999968f, -0.999969f, -0.999970f,
- -0.999971f, -0.999971f, -0.999972f, -0.999973f, -0.999973f, -0.999974f, -0.999975f, -0.999976f,
- -0.999976f, -0.999977f, -0.999977f, -0.999978f, -0.999979f, -0.999979f, -0.999980f, -0.999981f,
- -0.999981f, -0.999982f, -0.999982f, -0.999983f, -0.999983f, -0.999984f, -0.999985f, -0.999985f,
- -0.999986f, -0.999986f, -0.999987f, -0.999987f, -0.999988f, -0.999988f, -0.999988f, -0.999989f,
- -0.999989f, -0.999990f, -0.999990f, -0.999991f, -0.999991f, -0.999991f, -0.999992f, -0.999992f,
- -0.999993f, -0.999993f, -0.999993f, -0.999994f, -0.999994f, -0.999994f, -0.999995f, -0.999995f,
- -0.999995f, -0.999996f, -0.999996f, -0.999996f, -0.999996f, -0.999997f, -0.999997f, -0.999997f,
- -0.999997f, -0.999998f, -0.999998f, -0.999998f, -0.999998f, -0.999998f, -0.999999f, -0.999999f,
- -0.999999f, -0.999999f, -0.999999f, -0.999999f, -0.999999f, -0.999999f, -1.000000f, -1.000000f,
- -1.000000f, -1.000000f, -1.000000f, -1.000000f, -1.000000f, -1.000000f, -1.000000f, -1.000000f
-};
-
-static const float *sinTables[17] = {
- 0 , 0 , 0 , 0 ,
- sinTable16 , sinTable32 , sinTable64 , sinTable128 ,
- sinTable256 , sinTable512 , sinTable1024 , sinTable2048 ,
- sinTable4096, sinTable8192, sinTable16384, sinTable32768,
- sinTable65536
-};
-
-const float *getSineTable(int bits) {
- assert((bits >= 4) && (bits <= 16));
+ for (int i = 1; i < m / 4; i++)
+ _table[m / 2 - i] = _table[i];
+}
- return sinTables[bits];
+SineTable::~SineTable() {
+ delete[] _table;
}
} // End of namespace Common
diff --git a/common/sinetables.h b/common/sinetables.h
index 28918838f4..16e203f26d 100644
--- a/common/sinetables.h
+++ b/common/sinetables.h
@@ -25,12 +25,30 @@
namespace Common {
-/**
- * Get a sine table with the specified bit precision
- *
- * @param bits Precision of the table, which must be in range [4, 16]
- */
-const float *getSineTable(int bits);
+class SineTable {
+public:
+ /**
+ * Construct a sine table with the specified bit precision
+ *
+ * @param bitPrecision Precision of the table, which must be in range [4, 16]
+ */
+ SineTable(int bitPrecision);
+ ~SineTable();
+
+ /**
+ * Get pointer to table
+ */
+ const float *getTable() { return _table; }
+
+ /**
+ * Get pointer to table
+ */
+ int getPrecision() { return _bitPrecision; }
+
+private:
+ float *_table;
+ int _bitPrecision;
+};
} // End of namespace Common
diff --git a/common/singleton.h b/common/singleton.h
index a4f106c9d3..d7078360f3 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -44,7 +44,7 @@ private:
* and you specialise makeInstance to return an instance of a subclass.
*/
//template<class T>
-#if defined (_WIN32_WCE) || defined (_MSC_VER) || defined (__WINS__)
+#if defined(_WIN32_WCE) || defined(_MSC_VER) || defined(__WINS__)
//FIXME evc4 and msvc7 doesn't like it as private member
public:
#endif
diff --git a/common/system.h b/common/system.h
index dc74533861..99b947d7f3 100644
--- a/common/system.h
+++ b/common/system.h
@@ -78,6 +78,7 @@ struct TimeDate {
int tm_mday; ///< day of month (1 - 31)
int tm_mon; ///< month of year (0 - 11)
int tm_year; ///< year - 1900
+ int tm_wday; ///< days since Sunday (0 - 6)
};
namespace LogMessageType {
@@ -380,33 +381,22 @@ public:
*
*
* The next layer is the overlay. It is composed over the game
- * graphics. By default, it has exactly the same size and
- * resolution as the game graphics. However, client code can
- * specify an overlay scale (as an additional parameter to
- * initSize()). This is meant to increase the resolution of the
- * overlay while keeping its size the same as that of the game
- * graphics. For example, if the overlay scale is 2, and the game
- * graphics have a resolution of 320x200; then the overlay shall
- * have a resolution of 640x400, but it still has the same
- * physical size as the game graphics.
- * The overlay usually uses 16bpp, but on some ports, only 8bpp
- * are availble, so that is supported, too, via a compile time
- * switch (see also the OverlayColor typedef in scummsys.h).
- *
+ * graphics. Historically the overlay size had always been a
+ * multiple of the game resolution, for example when the game
+ * resolution was 320x200 and the user selected a 2x scaler and did
+ * not enable aspect ratio correction it had a size of 640x400.
+ * An exception was the aspect ratio correction, which did allow
+ * for non multiples of the vertical resolution of the game screen.
+ * Nowadays the overlay size does not need to have any relation to
+ * the game resolution though, for example the overlay resolution
+ * might be the same as the physical screen resolution.
+ * The overlay is forced to a 16bpp mode right now.
*
* Finally, there is the mouse layer. This layer doesn't have to
* actually exist within the backend -- it all depends on how a
* backend chooses to implement mouse cursors, but in the default
* SDL backend, it really is a separate layer. The mouse can
* have a palette of its own, if the backend supports it.
- * The scale of the mouse cursor is called 'cursorTargetScale'.
- * This is meant as a hint to the backend. For example, let us
- * assume the overlay is not visible, and the game graphics are
- * displayed using a 2x scaler. If a mouse cursor with a
- * cursorTargetScale of 1 is set, then it should be scaled by
- * factor 2x, too, just like the game graphics. But if it has a
- * cursorTargetScale of 2, then it shouldn't be scaled again by
- * the game graphics scaler.
*
* On a note for OSystem users here. We do not require our graphics
* to be thread safe and in fact most/all backends using OpenGL are
@@ -668,7 +658,7 @@ public:
* @see updateScreen
* @see getScreenFormat
*/
- virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
/**
* Lock the active screen framebuffer and return a Graphics::Surface
@@ -758,13 +748,11 @@ public:
* In order to be able to display dialogs atop the game graphics, backends
* must provide an overlay mode.
*
- * The overlay can be 8 or 16 bpp. Depending on which it is, OverlayColor
- * is 8 or 16 bit.
+ * The overlay is currently forced at 16 bpp.
*
* For 'coolness' we usually want to have an overlay which is blended over
* the game graphics. On backends which support alpha blending, this is
- * no issue; but on other systems (in particular those which only support
- * 8bpp), this needs some trickery.
+ * no issue; but on other systems this needs some trickery.
*
* Essentially, we fake (alpha) blending on these systems by copying the
* current game graphics into the overlay buffer when activating the overlay,
@@ -803,20 +791,14 @@ public:
* Copy the content of the overlay into a buffer provided by the caller.
* This is only used to implement fake alpha blending.
*/
- virtual void grabOverlay(OverlayColor *buf, int pitch) = 0;
+ virtual void grabOverlay(void *buf, int pitch) = 0;
/**
* Blit a graphics buffer to the overlay.
* In a sense, this is the reverse of grabOverlay.
*
- * @note The pitch parameter actually contains the 'pixel pitch', i.e.,
- * the number of pixels per scanline, and not as usual the number of bytes
- * per scanline.
- *
- * @todo Change 'pitch' to be byte and not pixel based
- *
* @param buf the buffer containing the graphics data source
- * @param pitch the pixel pitch of the buffer (number of pixels in a scanline)
+ * @param pitch the pitch of the buffer (number of bytes in a scanline)
* @param x the x coordinate of the destination rectangle
* @param y the y coordinate of the destination rectangle
* @param w the width of the destination rectangle
@@ -825,7 +807,7 @@ public:
* @see copyRectToScreen
* @see grabOverlay
*/
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0;
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
/**
* Return the height of the overlay.
@@ -883,10 +865,11 @@ public:
* @param keycolor transparency color value. This should not exceed the maximum color value of the specified format.
* In case it does the behavior is undefined. The backend might just error out or simply ignore the
* value. (The SDL backend will just assert to prevent abuse of this).
- * @param cursorTargetScale scale factor which cursor is designed for
+ * @param dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor
+ * would be too small to notice otherwise, these are allowed to scale the cursor anyway.
* @param format pointer to the pixel format which cursor graphic uses (0 means CLUT8)
*/
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0;
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0;
/**
* Replace the specified range of cursor the palette with new colors.
diff --git a/common/taskbar.h b/common/taskbar.h
index ba99d4e487..6f28028e74 100644
--- a/common/taskbar.h
+++ b/common/taskbar.h
@@ -34,7 +34,7 @@ namespace Common {
* The TaskbarManager allows interaction with the ScummVM application icon:
* - in the taskbar on Windows 7 and later
* - in the launcher for Unity
- * - in the dock on MacOSX
+ * - in the dock on Mac OS X
* - ...
*
* This allows GUI code and engines to display a progress bar, an overlay icon and/or count
diff --git a/common/translation.cpp b/common/translation.cpp
index 219fce8794..2bc31c617b 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -232,8 +232,9 @@ bool TranslationManager::openTranslationsFile(File &inFile) {
ArchiveMemberList fileList;
SearchMan.listMatchingMembers(fileList, "translations.dat");
for (ArchiveMemberList::iterator it = fileList.begin(); it != fileList.end(); ++it) {
- SeekableReadStream *stream = it->get()->createReadStream();
- if (stream && inFile.open(stream, it->get()->getName())) {
+ ArchiveMember const &m = **it;
+ SeekableReadStream *const stream = m.createReadStream();
+ if (stream && inFile.open(stream, m.getName())) {
if (checkHeader(inFile))
return true;
inFile.close();
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 8cfcd605fa..ab659343a2 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -1463,22 +1463,16 @@ bool ZipArchive::hasFile(const String &name) const {
}
int ZipArchive::listMembers(ArchiveMemberList &list) const {
- int matches = 0;
- int err = unzGoToFirstFile(_zipFile);
+ int members = 0;
- while (err == UNZ_OK) {
- char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
- if (unzGetCurrentFileInfo(_zipFile, NULL,
- szCurrentFileName, sizeof(szCurrentFileName)-1,
- NULL, 0, NULL, 0) == UNZ_OK) {
- list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(szCurrentFileName, this)));
- matches++;
- }
-
- err = unzGoToNextFile(_zipFile);
+ const unz_s *const archive = (const unz_s *)_zipFile;
+ for (ZipHash::const_iterator i = archive->_hash.begin(), end = archive->_hash.end();
+ i != end; ++i) {
+ list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(i->_key, this)));
+ ++members;
}
- return matches;
+ return members;
}
const ArchiveMemberPtr ZipArchive::getMember(const String &name) const {
diff --git a/common/updates.h b/common/updates.h
index 1e0babdf6d..4d58a216fb 100644
--- a/common/updates.h
+++ b/common/updates.h
@@ -30,7 +30,7 @@ namespace Common {
/**
* The UpdateManager allows configuring of the automatic update checking
* for systems that support it:
- * - using Sparkle on MacOSX
+ * - using Sparkle on Mac OS X
* - using WinSparkle on Windows
*
* Most of the update checking is completely automated and this class only
diff --git a/common/util.h b/common/util.h
index b90be0675b..78340980d5 100644
--- a/common/util.h
+++ b/common/util.h
@@ -83,7 +83,7 @@ namespace Common {
* Print a hexdump of the data passed in. The number of bytes per line is
* customizable.
* @param data the data to be dumped
- * @param len the lenght of that data
+ * @param len the length of that data
* @param bytesPerLine number of bytes to print per line (default: 16)
* @param startOffset shift the shown offsets by the starting offset (default: 0)
*/
diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp
index 6c0f9c9962..b3c45ffe73 100644
--- a/common/winexe_pe.cpp
+++ b/common/winexe_pe.cpp
@@ -64,7 +64,7 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream) {
if (!stream)
return false;
- if (stream->readUint16BE() != 'MZ')
+ if (stream->readUint16BE() != MKTAG16('M', 'Z'))
return false;
stream->skip(58);
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp
index ea3d44cf87..f0b7f1cc81 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -20,15 +20,11 @@
*
*/
-// FIXME: Avoid using fprintf
-#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
-#define FORBIDDEN_SYMBOL_EXCEPTION_stderr
-
-
#include "common/xmlparser.h"
#include "common/archive.h"
#include "common/fs.h"
#include "common/memstream.h"
+#include "common/system.h"
namespace Common {
@@ -123,17 +119,19 @@ bool XMLParser::parserError(const String &errStr) {
keyClosing = currentPosition;
}
- fprintf(stderr, "\n File <%s>, line %d:\n", _fileName.c_str(), lineCount);
+ Common::String errorMessage = Common::String::format("\n File <%s>, line %d:\n", _fileName.c_str(), lineCount);
currentPosition = (keyClosing - keyOpening);
_stream->seek(keyOpening, SEEK_SET);
while (currentPosition--)
- fprintf(stderr, "%c", _stream->readByte());
+ errorMessage += (char)_stream->readByte();
+
+ errorMessage += "\n\nParser error: ";
+ errorMessage += errStr;
+ errorMessage += "\n\n";
- fprintf(stderr, "\n\nParser error: ");
- fprintf(stderr, "%s", errStr.c_str());
- fprintf(stderr, "\n\n");
+ g_system->logMessage(LogMessageType::kError, errorMessage.c_str());
return false;
}
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 7d765fc539..fc8f351054 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -85,6 +85,60 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen,
return true;
}
+enum {
+ kTempBufSize = 65536
+};
+
+bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcLen) {
+ if (!dst || !dstLen || !src || !srcLen)
+ return false;
+
+ // See if we have sync bytes. If so, just use our function for that.
+ if (srcLen >= 4 && READ_BE_UINT32(src + srcLen - 4) == 0xFFFF)
+ return inflateZlibHeaderless(dst, dstLen, src, srcLen);
+
+ // Otherwise, we have some custom code we get to use here.
+
+ byte *temp = (byte *)malloc(kTempBufSize);
+
+ uint32 bytesRead = 0, bytesProcessed = 0;
+ while (bytesRead < srcLen) {
+ uint16 chunkSize = READ_LE_UINT16(src + bytesRead);
+ bytesRead += 2;
+
+ // Initialize zlib
+ z_stream stream;
+ stream.next_in = const_cast<byte *>(src + bytesRead);
+ stream.avail_in = chunkSize;
+ stream.next_out = temp;
+ stream.avail_out = kTempBufSize;
+ stream.zalloc = Z_NULL;
+ stream.zfree = Z_NULL;
+ stream.opaque = Z_NULL;
+
+ // Negative MAX_WBITS tells zlib there's no zlib header
+ int err = inflateInit2(&stream, -MAX_WBITS);
+ if (err != Z_OK)
+ return false;
+
+ err = inflate(&stream, Z_FINISH);
+ if (err != Z_OK && err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ free(temp);
+ return false;
+ }
+
+ memcpy(dst + bytesProcessed, temp, stream.total_out);
+ bytesProcessed += stream.total_out;
+
+ inflateEnd(&stream);
+ bytesRead += chunkSize;
+ }
+
+ free(temp);
+ return true;
+}
+
/**
* A simple wrapper class which can be used to wrap around an arbitrary
* other SeekableReadStream and will then provide on-the-fly decompression support.
@@ -107,7 +161,7 @@ protected:
public:
- GZipReadStream(SeekableReadStream *w) : _wrapped(w), _stream() {
+ GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() {
assert(w != 0);
// Verify file header is correct
@@ -122,7 +176,8 @@ public:
_origSize = w->readUint32LE();
} else {
// Original size not available in zlib format
- _origSize = 0;
+ // use an otherwise known size if supplied.
+ _origSize = knownSize;
}
_pos = 0;
w->seek(0, SEEK_SET);
@@ -336,7 +391,7 @@ public:
#endif // USE_ZLIB
-SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped) {
+SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize) {
#if defined(USE_ZLIB)
if (toBeWrapped) {
uint16 header = toBeWrapped->readUint16BE();
@@ -345,7 +400,7 @@ SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped) {
header % 31 == 0));
toBeWrapped->seek(-2, SEEK_CUR);
if (isCompressed)
- return new GZipReadStream(toBeWrapped);
+ return new GZipReadStream(toBeWrapped, knownSize);
}
#endif
return toBeWrapped;
diff --git a/common/zlib.h b/common/zlib.h
index 61322c286a..6a840f5fdc 100644
--- a/common/zlib.h
+++ b/common/zlib.h
@@ -77,6 +77,25 @@ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long
*/
bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, const byte *dict = 0, uint dictLen = 0);
+/**
+ * Wrapper around zlib's inflate functions. This function will call the
+ * necessary inflate functions to uncompress data compressed for InstallShield
+ * cabinet files.
+ *
+ * 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.
+ *
+ * @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.
+ *
+ * @return true on success (Z_OK or Z_STREAM_END), false otherwise.
+ */
+bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcLen);
+
#endif
/**
@@ -86,10 +105,18 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen,
* format. In the former case, the original stream is returned unmodified
* (and in particular, not wrapped).
*
+ * Certain GZip-formats don't supply an easily readable length, if you
+ * still need the length carried along with the stream, and you know
+ * the decompressed length at wrap-time, then it can be supplied as knownSize
+ * here. knownSize will be ignored if the GZip-stream DOES include a length.
+ *
* It is safe to call this with a NULL parameter (in this case, NULL is
* returned).
+ *
+ * @param toBeWrapped the stream to be wrapped (if it is in gzip-format)
+ * @param knownSize a supplied length of the compressed data (if not available directly)
*/
-SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped);
+SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize = 0);
/**
* Take an arbitrary WriteStream and wrap it in a custom stream which provides
diff --git a/configure b/configure
index fcdfedb09a..a0119bb1b1 100755
--- a/configure
+++ b/configure
@@ -62,7 +62,7 @@ get_var() {
eval echo \$${1}
}
-# Add an engine: id name build subengines
+# Add an engine: id name build subengines base-games dependencies
add_engine() {
_engines="${_engines} ${1}"
if test "${3}" = "no" ; then
@@ -72,63 +72,31 @@ add_engine() {
set_var _engine_${1}_build "${3}"
set_var _engine_${1}_build_default "${3}"
set_var _engine_${1}_subengines "${4}"
+ set_var _engine_${1}_base "${5}"
+ set_var _engine_${1}_deps "${6}"
for sub in ${4}; do
set_var _engine_${sub}_sub "yes"
+ set_var _engine_${sub}_parent "${1}"
done
}
-add_engine scumm "SCUMM" yes "scumm_7_8 he"
-add_engine scumm_7_8 "v7 & v8 games" yes
-add_engine he "HE71+ games" yes
-add_engine agi "AGI" yes
-add_engine agos "AGOS" yes "agos2"
-add_engine agos2 "AGOS 2 games" yes
-add_engine cge "CGE" yes
-add_engine cine "Cinematique evo 1" yes
-add_engine composer "Magic Composer" no
-add_engine cruise "Cinematique evo 2" yes
-add_engine draci "Dragon History" yes
-add_engine drascula "Drascula: The Vampire Strikes Back" yes
-add_engine dreamweb "Dreamweb" no
-add_engine gob "Gobli*ns" yes
-add_engine groovie "Groovie" yes "groovie2"
-add_engine groovie2 "Groovie 2 games" no
-add_engine hugo "Hugo Trilogy" yes
-add_engine kyra "Legend of Kyrandia" yes "lol eob"
-add_engine lol "Lands of Lore" yes
-add_engine eob "Eye of the Beholder" no
-add_engine lastexpress "The Last Express" no
-add_engine lure "Lure of the Temptress" yes
-add_engine made "MADE" yes
-add_engine mohawk "Mohawk" yes "cstime myst riven"
-add_engine cstime "Where in Time is Carmen Sandiego?" no
-add_engine riven "Riven: The Sequel to Myst" no
-add_engine myst "Myst" no
-add_engine neverhood "Neverhood" no
-add_engine parallaction "Parallaction" yes
-add_engine queen "Flight of the Amazon Queen" yes
-add_engine saga "SAGA" yes "ihnm saga2"
-add_engine ihnm "IHNM" yes
-add_engine saga2 "SAGA 2 games" no
-add_engine sci "SCI" yes "sci32"
-add_engine sci32 "SCI32 games" no
-add_engine sky "Beneath a Steel Sky" yes
-add_engine sword1 "Broken Sword" yes
-add_engine sword2 "Broken Sword II" yes
-add_engine sword25 "Broken Sword 2.5" no
-add_engine teenagent "Teen Agent" yes
-add_engine testbed "TestBed: the Testing framework" no
-add_engine tinsel "Tinsel" yes
-add_engine toltecs "3 Skulls of the Toltecs" no
-add_engine toon "Toonstruck" yes
-add_engine touche "Touche: The Adventures of the Fifth Musketeer" yes
-add_engine tsage "TsAGE" yes
-add_engine tucker "Bud Tucker in Double Trouble" yes
+# Add a feature: id name settings-list
+add_feature() {
+ set_var _feature_${1}_name "${2}"
+ # This is a list of settings, where one must be "yes" for the feature to
+ # be enabled
+ set_var _feature_${1}_settings "${3}"
+}
+
+_srcdir=`dirname $0`
+
+# Read list of engines
+. $_srcdir/engines/configure.engines
#
# Default settings
#
-# Default lib behaviour yes/no/auto
+# Default lib behavior yes/no/auto
_vorbis=auto
_tremor=auto
_tremolo=no
@@ -136,10 +104,11 @@ _flac=auto
_mad=auto
_alsa=auto
_seq_midi=auto
+_sndio=auto
_timidity=auto
_zlib=auto
_sparkle=auto
-_png=no
+_png=auto
_theoradec=auto
_faad=auto
_fluidsynth=auto
@@ -150,7 +119,7 @@ _freetype2=auto
_taskbar=yes
_updates=no
_libunity=auto
-# Default option behaviour yes/no
+# Default option behavior yes/no
_debug_build=auto
_release_build=auto
_optimizations=auto
@@ -204,6 +173,17 @@ _endian=unknown
_need_memalign=yes
_have_x86=no
+# Add (virtual) features
+add_feature 16bit "16bit color" "_16bit"
+add_feature faad "libfaad" "_faad"
+add_feature flac "FLAC" "_flac"
+add_feature freetype2 "FreeType2" "_freetype2"
+add_feature mad "MAD" "_mad"
+add_feature png "PNG" "_png"
+add_feature theoradec "libtheoradec" "_theoradec"
+add_feature vorbis "Vorbis file support" "_vorbis _tremor"
+add_feature zlib "zlib" "_zlib"
+
# Directories for installing ScummVM.
@@ -230,7 +210,6 @@ _host_vendor=""
_host_os=""
_host_alias=""
-_srcdir=`dirname $0`
_port_mk="ports.mk"
# Use temp files in the build directory
@@ -482,6 +461,26 @@ Try \`$0 --help' for more information." >&2
}
+#
+# Feature handling functions
+#
+
+# Get the name of the feature
+get_feature_name() {
+ get_var _feature_$1_name
+}
+
+# Check whether the feature is enabled
+get_feature_state() {
+ for i in `get_var _feature_$1_settings`; do
+ if test `get_var $i` = "yes"; then
+ echo "yes"
+ return
+ fi
+ done
+ echo "no"
+}
+
#
# Engine handling functions
@@ -507,6 +506,16 @@ get_engine_subengines() {
get_var _engine_$1_subengines
}
+# Get the dependencies
+get_engine_dependencies() {
+ get_var _engine_$1_deps
+}
+
+# Get the base engine game support description
+get_engine_base() {
+ get_var _engine_$1_base
+}
+
# Ask if this is a subengine
get_engine_sub() {
sub=`get_var _engine_$1_sub`
@@ -516,6 +525,11 @@ get_engine_sub() {
echo $sub
}
+# Get a subengine's parent (undefined for non-subengines)
+get_subengine_parent() {
+ get_var _engine_$1_parent
+}
+
# Enable *all* engines
engine_enable_all() {
for engine in $_engines; do
@@ -543,9 +557,15 @@ engine_enable() {
engine=`echo $eng | sed 's/-/_/g'`
# Filter the parameter for the subengines
- if test "`get_engine_sub ${engine}`" != "no" -a "$opt" != "yes" ; then
- subengine_option_error ${engine}
- return
+ if test "`get_engine_sub ${engine}`" != "no" ; then
+ if test "$opt" != "yes" ; then
+ subengine_option_error ${engine}
+ return
+ fi
+ parent=`get_subengine_parent ${engine}`
+ if test `get_engine_build ${parent}` = "no" ; then
+ set_var _engine_${parent}_build "yes"
+ fi
fi
if test "$opt" = "static" -o "$opt" = "dynamic" -o "$opt" = "yes" ; then
@@ -575,6 +595,29 @@ engine_disable() {
fi
}
+# Check whether the engine's dependencies are met
+# If that is not the case disable the engine
+check_engine_deps() {
+ unmet_deps=""
+
+ # Check whether the engine is enabled
+ if test `get_engine_build $1` != "no" ; then
+ # Collect unmet dependencies
+ for dep in `get_engine_dependencies $1`; do
+ if test `get_feature_state $dep` = "no"; then
+ feature_name=`get_feature_name $dep`
+ unmet_deps="${unmet_deps}${feature_name} "
+ fi
+ done
+
+ # Check whether there is any unmet dependency
+ if test -n "$unmet_deps"; then
+ echo "WARNING: Disabling engine "`get_engine_name $1`" because the following dependencies are unmet: "$unmet_deps
+ engine_disable $1
+ fi
+ fi
+}
+
# Show the configure help line for a given engine
show_engine_help() {
name=`get_engine_name $1`
@@ -617,27 +660,37 @@ prepare_engine_build_strings() {
# Get the string about building an engine
get_engine_build_string() {
+ engine=$1
+ request_status=$2
engine_string=""
engine_build=`get_engine_build $1`
- engine_build_default=`get_engine_build_default $1`
+ engine_build_default=`get_engine_build_default $engine`
show=no
+ # Convert static/dynamic to yes to ease the check of subengines
+ if test $engine_build = no; then
+ subengine_filter=no
+ else
+ subengine_filter=yes
+ fi
+
# Check if the current engine should be shown for the current status
- if test $engine_build = $2 ; then
+ if test $engine_build = $request_status ; then
show=yes
else
# Test for disabled sub-engines
- if test $2 = no ; then
- for subeng in `get_engine_subengines $1` ; do
+ if test $request_status = no ; then
+ for subeng in `get_engine_subengines $engine` ; do
if test `get_engine_build $subeng` = no ; then
- engine_build=no
+ # In this case we to display _disabled_ subengines
+ subengine_filter=no
show=yes
fi
done
fi
# Test for enabled wip sub-engines
- if test $2 = wip ; then
- for subeng in `get_engine_subengines $1` ; do
+ if test $request_status = wip ; then
+ for subeng in `get_engine_subengines $engine` ; do
if test `get_engine_build $subeng` != no -a `get_engine_build_default $subeng` = no ; then
show=yes
fi
@@ -645,85 +698,82 @@ get_engine_build_string() {
fi
fi
- # Convert static/dynamic to yes to ease the check of subengines
- if test $engine_build != no ; then
- engine_build=yes
- fi
# Check if it is a wip engine
- if test "$2" = "wip" -a "$engine_build" != "no" -a "$engine_build_default" = no; then
+ if test "$request_status" = "wip" -a "$engine_build" != "no" -a "$engine_build_default" = no; then
show=yes
fi
# The engine should be shown, build the string
if test $show = yes ; then
- build_string_func=get_${1}_build_string
- if ( type $build_string_func | grep function ) 2> /dev/null > /dev/null ; then
- engine_string=`$build_string_func $1 $engine_build $2`
- else
- engine_string=`get_subengines_build_string $1 $engine_build "" $2`
- fi
-
- engine_string="`get_engine_name $1` $engine_string"
+ engine_string=`get_subengines_build_string $engine $subengine_filter $request_status`
+ engine_string="`get_engine_name $engine` $engine_string"
fi
- echo $engine_string
+ echo "$engine_string"
}
# Get the string about building subengines
get_subengines_build_string() {
- all=yes
parent_engine=$1
- subengine_string=$3
- parent_status=$4
+ subengine_filter=$2
+ request_status=$3
parent_engine_build_default=`get_engine_build_default $parent_engine`
+ subengine_string=""
- for subeng in `get_engine_subengines $parent_engine` ; do
- subengine_build=`get_engine_build $subeng`
- subengine_build_default=`get_engine_build_default $subeng`
- if test \( $subengine_build = $2 -a "$parent_status" != wip \) -o \( "$parent_status" = wip -a $subengine_build != no -a "$subengine_build_default" = no \) ; then
- subengine_string="$subengine_string [`get_engine_name $subeng`]"
- else
- all=no
- fi
+ # If the base engine isn't built at all, no need to list subengines
+ # in any of the possible categories.
+ if test `get_engine_build $parent_engine` = no; then
+ return
+ fi
- # handle engines that are on by default and have a single subengine that is off by default
- if test "$parent_status" = wip ; then
- if test $parent_engine_build_default = yes -a subengine ; then
- all=no
- fi
+ all=yes
+ # If there are no subengines, never display "[all games]" (for brevity).
+ if test -z "`get_engine_subengines $parent_engine`"; then
+ all=no
+ fi
+ # If the base engine does not fit the category we're displaying here
+ # (WIP or Skipped), we should never show "[all games]"
+ if test "$request_status" = wip; then
+ if test $parent_engine_build_default = yes; then
+ all=no
fi
+ fi
+ if test "$request_status" = no; then
+ # If we're here, the parent engine is built, so no need to check that.
+ all=no
+ fi
- done
- if test $2 != no ; then
- if test -n "$subengine_string" ; then
- if test $all = yes ; then
- subengine_string="[all games]"
- fi
- fi
+ # In the static/dynamic categories, also display the engine's base games.
+ if test -n "`get_engine_subengines $parent_engine`" -a $request_status != no -a $request_status != wip; then
+ subengine_string="[`get_engine_base $parent_engine`]"
fi
- echo $subengine_string
-}
+ for subeng in `get_engine_subengines $parent_engine` ; do
+ subengine_build=`get_engine_build $subeng`
+ subengine_build_default=`get_engine_build_default $subeng`
-# Engine specific build strings
-get_scumm_build_string() {
- if test `get_engine_build $1` != no ; then
- if test $2 != no -a "$3" != wip ; then
- base="[v0-v6 games]"
+ # Display this subengine if it matches the filter, unless it is
+ # a stable subengine in the WIP request.
+ if test $subengine_build = $subengine_filter -a \! \( "$request_status" = wip -a "$subengine_build_default" = yes \) ; then
+ s="[`get_engine_name $subeng`]"
+ if test -n "$subengine_string"; then
+ subengine_string="$subengine_string $s"
+ else
+ subengine_string="$s"
+ fi
+ else
+ all=no
fi
- get_subengines_build_string $1 $2 "$base" $3
- fi
-}
+ done
-get_saga_build_string() {
- if test `get_engine_build $1` != no ; then
- if test $2 != no -a "$3" != wip; then
- base="[ITE]"
- fi
- get_subengines_build_string $1 $2 "$base" $3
+ # Summarize the full list, where applicable
+ if test $all = yes ; then
+ subengine_string="[all games]"
fi
+
+ echo "$subengine_string"
}
#
@@ -755,7 +805,7 @@ Usage: $0 [OPTIONS]...
Configuration:
-h, --help display this help and exit
- --backend=BACKEND backend to build (android, bada, dc, dingux, ds, gp2x, gph,
+ --backend=BACKEND backend to build (android, bada, dc, dingux, ds, gph,
iphone, linuxmoto, maemo, n64, null, openpandora, ps2,
psp, samsungtv, sdl, webos, wii, wince) [sdl]
@@ -878,13 +928,13 @@ Optional Libraries:
installed (optional)
--disable-fluidsynth disable fluidsynth MIDI driver [autodetect]
- --with-sparkle-prefix=DIR Prefix where sparkle is installed (MacOSX only - optional)
- --disable-sparkle disable sparkle automatic update support [MacOSX only - autodetect]
+ --with-sparkle-prefix=DIR Prefix where sparkle is installed (Mac OS X only - optional)
+ --disable-sparkle disable sparkle automatic update support [Mac OS X only - autodetect]
--with-sdl-prefix=DIR Prefix where the sdl-config script is
installed (optional)
- --with-freetype-prefix=DIR Prefix where the freetype-config script is
+ --with-freetype2-prefix=DIR Prefix where the freetype-config script is
installed (optional)
--with-nasm-prefix=DIR Prefix where nasm executable is installed (optional)
@@ -896,6 +946,9 @@ Optional Libraries:
--with-libunity-prefix=DIR Prefix where libunity is installed (optional)
--disable-libunity disable Unity launcher integration [autodetect]
+ --with-sndio-prefix=DIR Prefix where sndio is installed (optional)
+ --disable-sndio disable sndio MIDI driver [autodetect]
+
Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
@@ -921,6 +974,8 @@ for ac_option in $@; do
--disable-alsa) _alsa=no ;;
--enable-seq-midi) _seq_midi=yes ;;
--disable-seq-midi) _seq_midi=no ;;
+ --enable-sndio) _sndio=yes ;;
+ --disable-sndio) _sndio=no ;;
--enable-timidity) _timidity=yes ;;
--disable-timidity) _timidity=no ;;
--enable-vorbis) _vorbis=yes ;;
@@ -981,6 +1036,11 @@ for ac_option in $@; do
ALSA_CFLAGS="-I$arg/include"
ALSA_LIBS="-L$arg/lib"
;;
+ --with-sndio-prefix=*)
+ arg=`echo $ac_option | cut -d '=' -f 2`
+ SNDIO_CFLAGS="-I$arg/include"
+ SNDIO_LIBS="-L$arg/lib"
+ ;;
--with-ogg-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
OGG_CFLAGS="-I$arg/include"
@@ -1447,6 +1507,10 @@ ps3)
echo "Please set PS3DEV in your environment. export PS3DEV=<path to ps3 toolchain>"
exit 1
fi
+ if test -z "$PSL1GHT"; then
+ echo "Please set PSL1GHT in your environment. export PSL1GHT=<path to psl1ght>"
+ exit 1
+ fi
;;
psp)
if test -z "$PSPDEV"; then
@@ -1868,7 +1932,9 @@ case $_host_cpu in
define_in_config_if_yes yes 'USE_ARM_SOUND_ASM'
define_in_config_if_yes yes 'USE_ARM_SMUSH_ASM'
define_in_config_if_yes yes 'USE_ARM_GFX_ASM'
- define_in_config_if_yes yes 'USE_ARM_COSTUME_ASM'
+ # FIXME: The following feature exhibits a bug during the intro scene of Indy 4
+ # (on Pandora and iPhone at least)
+ #define_in_config_if_yes yes 'USE_ARM_COSTUME_ASM'
DEFINES="$DEFINES -DARM_TARGET"
;;
@@ -2108,12 +2174,13 @@ case $_host_os in
DEFINES="$DEFINES -D__PLAYSTATION2__"
;;
ps3)
- # Force use of SDL from the ps3 toolchain
+ # Force use of SDL and freetype from the ps3 toolchain
_sdlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin"
+ _freetypepath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin"
DEFINES="$DEFINES -DPLAYSTATION3"
- CXXFLAGS="$CXXFLAGS -mcpu=cell -mminimal-toc -I$PS3DEV/psl1ght/ppu/include -I$PS3DEV/portlibs/ppu/include"
- LDFLAGS="$LDFLAGS -L$PS3DEV/psl1ght/ppu/lib -L$PS3DEV/portlibs/ppu/lib"
+ CXXFLAGS="$CXXFLAGS -mcpu=cell -mminimal-toc -I$PSL1GHT/ppu/include -I$PS3DEV/portlibs/ppu/include"
+ LDFLAGS="$LDFLAGS -L$PSL1GHT/ppu/lib -L$PS3DEV/portlibs/ppu/lib"
add_line_to_config_mk 'PLAYSTATION3 = 1'
add_line_to_config_h "#define PREFIX \"${prefix}\""
;;
@@ -2231,13 +2298,8 @@ if test -n "$_host"; then
bfin*)
;;
caanoo)
- # This uses the GPH backend.
- DEFINES="$DEFINES -DGPH_DEVICE"
DEFINES="$DEFINES -DCAANOO"
- DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE"
- if test "$_debug_build" = yes; then
- DEFINES="$DEFINES -DGPH_DEBUG"
- else
+ if test "$_debug_build" = no; then
# Use -O3 on the Caanoo for non-debug builds.
_optimization_level=-O3
fi
@@ -2266,6 +2328,9 @@ if test -n "$_host"; then
CXXFLAGS="$CXXFLAGS -mips32"
_backend="dingux"
_mt32emu=no
+ _optimization_level=-O3
+ # Disable alsa midi to get the port build on OpenDingux toolchain
+ _alsa=no
_vkeybd=yes
_build_hq_scalers=no
_keymapper=no
@@ -2325,13 +2390,7 @@ if test -n "$_host"; then
add_line_to_config_h "#define USE_WII_DI"
;;
gp2x)
- # This uses the GPH backend.
- DEFINES="$DEFINES -DGPH_DEVICE"
DEFINES="$DEFINES -DGP2X"
- DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE"
- if test "$_debug_build" = yes; then
- DEFINES="$DEFINES -DGPH_DEBUG"
- fi
CXXFLAGS="$CXXFLAGS -march=armv4t"
ASFLAGS="$ASFLAGS -mfloat-abi=soft"
LDFLAGS="$LDFLAGS -static"
@@ -2345,13 +2404,7 @@ if test -n "$_host"; then
_port_mk="backends/platform/gph/gp2x-bundle.mk"
;;
gp2xwiz)
- # This uses the GPH backend.
- DEFINES="$DEFINES -DGPH_DEVICE"
DEFINES="$DEFINES -DGP2XWIZ"
- DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE"
- if test "$_debug_build" = yes; then
- DEFINES="$DEFINES -DGPH_DEBUG"
- fi
CXXFLAGS="$CXXFLAGS -mcpu=arm926ej-s"
CXXFLAGS="$CXXFLAGS -mtune=arm926ej-s"
ASFLAGS="$ASFLAGS -mfloat-abi=soft"
@@ -2637,9 +2690,14 @@ case $_backend in
INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/ds/commoninclude'
INCLUDES="$INCLUDES "'-Ibackends/platform/ds/arm9/data'
;;
- gp2x)
- ;;
gph)
+ # On the GPH devices we want fancy themes but do not want the load/save thumbnail grid.
+ DEFINES="$DEFINES -DDISABLE_SAVELOADCHOOSER_GRID"
+ DEFINES="$DEFINES -DGPH_DEVICE"
+ DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE"
+ if test "$_debug_build" = yes; then
+ DEFINES="$DEFINES -DGPH_DEBUG"
+ fi
;;
iphone)
LIBS="$LIBS -lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES"
@@ -2735,7 +2793,7 @@ MODULES="$MODULES backends/platform/$_backend"
# Setup SDL specifics for SDL based backends
#
case $_backend in
- dingux | gp2x | gph | linuxmoto | maemo | openpandora | samsungtv | sdl)
+ dingux | gph | linuxmoto | maemo | openpandora | samsungtv | sdl)
find_sdlconfig
INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
@@ -3298,6 +3356,25 @@ define_in_config_h_if_yes "$_seq_midi" 'USE_SEQ_MIDI'
echo "$_seq_midi"
#
+# Check for sndio
+#
+echocheck "sndio"
+if test "$_sndio" = auto ; then
+ _sndio=no
+ cat > $TMPC << EOF
+#include <sndio.h>
+int main(void) { struct sio_par par; sio_initpar(&par); return 0; }
+EOF
+ cc_check $SNDIO_CFLAGS $SNDIO_LIBS -lsndio && _sndio=yes
+fi
+if test "$_sndio" = yes ; then
+ LIBS="$LIBS $SNDIO_LIBS -lsndio"
+ INCLUDES="$INCLUDES $SNDIO_CFLAGS"
+fi
+define_in_config_h_if_yes "$_sndio" 'USE_SNDIO'
+echo "$_sndio"
+
+#
# Check for TiMidity(++)
#
echocheck "TiMidity"
@@ -3330,11 +3407,6 @@ fi
define_in_config_if_yes "$_zlib" 'USE_ZLIB'
echo "$_zlib"
-if test `get_engine_build sword25` = yes && test ! "$_zlib" = yes ; then
- echo "...disabling Broken Sword 2.5 engine. ZLib is required"
- engine_disable sword25
-fi
-
#
# Check for Sparkle if updates support is enabled
#
@@ -3382,7 +3454,7 @@ if test "$_fluidsynth" = yes ; then
esac
INCLUDES="$INCLUDES $FLUIDSYNTH_CFLAGS"
fi
-define_in_config_h_if_yes "$_fluidsynth" 'USE_FLUIDSYNTH'
+define_in_config_if_yes "$_fluidsynth" 'USE_FLUIDSYNTH'
echo "$_fluidsynth"
#
@@ -3502,12 +3574,27 @@ fi
echocheck "FreeType2"
echo "$_freetype2"
-define_in_config_h_if_yes "$_freetype2" "USE_FREETYPE2"
+define_in_config_if_yes "$_freetype2" "USE_FREETYPE2"
#
# Check for OpenGL (ES)
#
echocheck "OpenGL"
+
+case $_backend in
+ openpandora)
+ # Only enable OpenGL ES on the OpanPandora if --enable-opengl is passed in explicitly.
+ if test "$_opengl" = yes ; then
+ _opengl=yes
+ _opengles=yes
+ OPENGL_LIBS="-lGLES_CM -lEGL -lX11"
+ OPENGL_CFLAGS="$OPENGL_LIBS"
+ LIBS="$LIBS $OPENGL_LIBS"
+ INCLUDES="$INCLUDES $OPENGL_CFLAGS"
+ fi
+ ;;
+esac
+
if test "$_opengl" = auto ; then
_opengl=no
if test "$_backend" = "sdl" ; then
@@ -3866,6 +3953,9 @@ sh -c "
fi" 2>/dev/null &
for engine in $_engines; do
+ # Check whether all dependencies are available
+ check_engine_deps $engine
+
if test "`get_engine_sub $engine`" = "no" ; then
# It's a main engine
if test `get_engine_build $engine` = no ; then
@@ -3891,9 +3981,6 @@ for engine in $_engines; do
isbuilt=STATIC_PLUGIN
fi
fi
-
- # Prepare the information to be shown
- prepare_engine_build_strings $engine
else
# It's a subengine, just say yes or no
if test "`get_engine_build $engine`" = "no" ; then
@@ -3912,6 +3999,14 @@ for engine in $_engines; do
fi
done
+# Prepare the information to be shown
+for engine in $_engines; do
+ if test "`get_engine_sub $engine`" = "no" ; then
+ # It's a main engine
+ prepare_engine_build_strings $engine
+ fi
+done
+
#
# Detection of WIP/unstable engines
#
@@ -3939,28 +4034,28 @@ fi
echo
if test -n "$_engines_built_static" ; then
echo "Engines (builtin):"
- echo $_engines_built_static | sed 's/@/\
+ echo "$_engines_built_static" | sed 's/@/\
/g
s/#/ /g'
fi
if test -n "$_engines_built_dynamic" ; then
echo "Engines (plugins):"
- echo $_engines_built_dynamic | sed 's/@/\
+ echo "$_engines_built_dynamic" | sed 's/@/\
/g
s/#/ /g'
fi
if test -n "$_engines_skipped" ; then
echo "Engines Skipped:"
- echo $_engines_skipped | sed 's/@/\
+ echo "$_engines_skipped" | sed 's/@/\
/g
s/#/ /g'
fi
if test -n "$_engines_built_wip" ; then
echo "WARNING: This ScummVM build contains the following UNSTABLE engines:"
- echo $_engines_built_wip | sed 's/@/\
+ echo "$_engines_built_wip" | sed 's/@/\
/g
s/#/ /g'
fi
diff --git a/devtools/README b/devtools/README
index 7db5259e7c..c7f08d6dfa 100644
--- a/devtools/README
+++ b/devtools/README
@@ -65,7 +65,7 @@ create_lure (dreammaster)
create_project (LordHoto, Littleboy)
--------------
- Creates project files for Visual Studio 2005, 2008, 2010, Xcode and
+ Creates project files for Visual Studio 2005, 2008, 2010, 2012, Xcode and
Code::Blocks out of the configure / Makefile based build system.
It also offers a way to enable or disable certain engines and the use
of external libraries similar to configure. Run the tool without
diff --git a/devtools/create_drascula/staticdata.h b/devtools/create_drascula/staticdata.h
index 21b9a82622..e0e4f9da10 100644
--- a/devtools/create_drascula/staticdata.h
+++ b/devtools/create_drascula/staticdata.h
@@ -6031,10 +6031,10 @@ const char *_texthis[NUM_LANGS][NUM_TEXTHIS] = {
},
{
"",
- "",
- "",
- "",
- ""
+ "Hace mucho tiempo, parece ser que Drascula mato a la mujer de Von Braun, asi que, con la intencion de enfrentarse al conde, Von Braun empezo a investigar todo lo que pudo sobre vampiros.",
+ "Cuando creyo estar preparado, subio al castillo y tuvo un enfrentamiento muy violento con Drascula.",
+ "Nadie sabe que paso exactamente. Aunque Von Braun perdio, Drascula no pudo matarlo.",
+ "Von Braun se sintio humillado por su derrota, huyo del castillo y no ha tenido valor para enfrentarse de nuevo a Drascula."
},
{
"",
diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index 489be3e04d..3b90ad0d85 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -38,6 +38,8 @@
#include "extract.h"
#include "md5.h"
+#include "common/language.h"
+#include "common/platform.h"
#include <string>
#include <map>
@@ -45,7 +47,7 @@
#include <map>
enum {
- kKyraDatVersion = 82
+ kKyraDatVersion = 83
};
const ExtractFilename extractFilenames[] = {
diff --git a/devtools/create_kyradat/extract.cpp b/devtools/create_kyradat/extract.cpp
index 34308f1b5b..86244fce42 100644
--- a/devtools/create_kyradat/extract.cpp
+++ b/devtools/create_kyradat/extract.cpp
@@ -24,6 +24,8 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "extract.h"
+#include "common/language.h"
+#include "common/platform.h"
#include <algorithm>
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index 258d2dd50d..89229eb4f2 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -24,6 +24,8 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "create_kyradat.h"
+#include "common/language.h"
+#include "common/platform.h"
// Game tables
@@ -117,6 +119,7 @@ const Game lolGames[] = {
{ kLoL, { EN_ANY, -1, -1 }, kPlatformPC, kNoSpecial, { "0cc764a204f7ba8cefe1a5f14c479619", 0 } },
{ kLoL, { RU_RUS, -1, -1 }, kPlatformPC, kNoSpecial, { "80a9f9bf243bc6ed36d98584fc6988c4", 0 } },
{ kLoL, { DE_DEU, -1, -1 }, kPlatformPC, kNoSpecial, { "6b843869772c1b779e1386be868c15dd", 0 } },
+ { kLoL, { FR_FRA, -1, -1 }, kPlatformPC, kNoSpecial, { "6b843869772c1b779e1386be868c15dd", 0 } },
// PC98 (no language specifc strings)
{ kLoL, { JA_JPN, -1, -1 }, kPlatformPC98, kNoSpecial, { "6d5bd4a2f5ce433365734ca6b7a8d984", "1b0a457c48ae6908da301b656fe0aab4" } },
diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp
index 1b9ca45259..19b69d9410 100644
--- a/devtools/create_kyradat/tables.cpp
+++ b/devtools/create_kyradat/tables.cpp
@@ -25,6 +25,8 @@
#include "tables.h"
#include "create_kyradat.h"
+#include "common/language.h"
+#include "common/platform.h"
#define EXTRACT_END_ENTRY { UNK_LANG, kPlatformUnknown, { 0, 0, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } }
@@ -3347,6 +3349,7 @@ const ExtractEntrySearchData kLoLCharacterDefsProvider[] = {
{ RU_RUS, kPlatformPC, { 0x00000492, 0x000052BA, { { 0x52, 0x29, 0x0D, 0x49, 0xFD, 0x17, 0xD7, 0x70, 0x6D, 0xCA, 0xEB, 0xB6, 0x7E, 0xFA, 0xBE, 0x08 } } } }, // floppy
{ EN_ANY, kPlatformPC, { 0x00000492, 0x000046B0, { { 0x7A, 0x94, 0x8B, 0xC6, 0xF7, 0xF1, 0x2F, 0xF3, 0xBC, 0x1B, 0x0B, 0x4E, 0x00, 0xC9, 0x44, 0x58 } } } }, // floppy
{ DE_DEU, kPlatformPC, { 0x00000492, 0x000047FD, { { 0x8C, 0x0B, 0x8B, 0xCE, 0xE0, 0xB0, 0x8F, 0xA9, 0x06, 0xC3, 0x98, 0xE6, 0x2E, 0x09, 0xB6, 0x93 } } } }, // floppy
+ { FR_FRA, kPlatformPC, { 0x00000492, 0x000047FD, { { 0x8C, 0x0B, 0x8B, 0xCE, 0xE0, 0xB0, 0x8F, 0xA9, 0x06, 0xC3, 0x98, 0xE6, 0x2E, 0x09, 0xB6, 0x93 } } } }, // floppy
{ EN_ANY, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD
{ DE_DEU, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD
{ FR_FRA, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD
diff --git a/devtools/create_lure/create_lure_dat.h b/devtools/create_lure/create_lure_dat.h
index 9259a8dcc8..ad49878d43 100644
--- a/devtools/create_lure/create_lure_dat.h
+++ b/devtools/create_lure/create_lure_dat.h
@@ -24,6 +24,7 @@
#define CREATE_LURE_DAT_H
#include "common/endian.h"
+#include "common/language.h"
#include "common/util.h"
#define VERSION_MAJOR 1
diff --git a/devtools/create_project/config.h b/devtools/create_project/config.h
index fecd95691e..de4703a47d 100644
--- a/devtools/create_project/config.h
+++ b/devtools/create_project/config.h
@@ -28,8 +28,10 @@
#define LIBS_DEFINE "SCUMMVM_LIBS" // Name of the include environment variable
#define REVISION_DEFINE "SCUMMVM_INTERNAL_REVISION"
-#define HAS_VIDEO_FOLDER 1
-//#define ADDITIONAL_LIBRARY ""
-#define NEEDS_RTTI 0
+#define ENABLE_LANGUAGE_EXTENSIONS "" // Comma separated list of projects that need language extensions
+#define DISABLE_EDIT_AND_CONTINUE "tinsel,tony" // Comma separated list of projects that need Edit&Continue to be disabled for co-routine support (the main project is automatically added)
+
+//#define ADDITIONAL_LIBRARY "" // Add a single library to the list of externally linked libraries
+#define NEEDS_RTTI 0 // Enable RTTI globally
#endif // TOOLS_CREATE_PROJECT_CONFIG_H
diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index 15830bd467..a8e09ff5eb 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -76,14 +76,6 @@ namespace {
std::string unifyPath(const std::string &path);
/**
- * Returns the last path component.
- *
- * @param path Path string.
- * @return Last path component.
- */
-std::string getLastPathComponent(const std::string &path);
-
-/**
* Display the help text for the program.
*
* @param exe Name of the executable.
@@ -105,30 +97,6 @@ struct FSNode {
};
typedef std::list<FSNode> FileList;
-
-typedef StringList TokenList;
-
-/**
- * Takes a given input line and creates a list of tokens out of it.
- *
- * A token in this context is separated by whitespaces. A special case
- * are quotation marks though. A string inside quotation marks is treated
- * as single token, even when it contains whitespaces.
- *
- * Thus for example the input:
- * foo bar "1 2 3 4" ScummVM
- * will create a list with the following entries:
- * "foo", "bar", "1 2 3 4", "ScummVM"
- * As you can see the quotation marks will get *removed* too.
- *
- * You can also use this with non-whitespace by passing another separator
- * character (e.g. ',').
- *
- * @param input The text to be tokenized.
- * @param separator The token separator.
- * @return A list of tokens.
- */
-TokenList tokenize(const std::string &input, char separator = ' ');
} // End of anonymous namespace
enum ProjectType {
@@ -221,7 +189,7 @@ int main(int argc, char *argv[]) {
msvcVersion = atoi(argv[++i]);
- if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10) {
+ if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11) {
std::cerr << "ERROR: Unsupported version: \"" << msvcVersion << "\" passed to \"--msvc-version\"!\n";
return -1;
}
@@ -534,7 +502,7 @@ int main(int argc, char *argv[]) {
projectWarnings["agos"].push_back("4511");
projectWarnings["dreamweb"].push_back("4355");
-
+
projectWarnings["lure"].push_back("4189");
projectWarnings["lure"].push_back("4355");
@@ -575,7 +543,9 @@ int main(int argc, char *argv[]) {
globalWarnings.push_back("-Wwrite-strings");
// The following are not warnings at all... We should consider adding them to
// a different list of parameters.
+#if !NEEDS_RTTI
globalWarnings.push_back("-fno-rtti");
+#endif
globalWarnings.push_back("-fno-exceptions");
globalWarnings.push_back("-fcheck-new");
@@ -604,14 +574,6 @@ std::string unifyPath(const std::string &path) {
return result;
}
-std::string getLastPathComponent(const std::string &path) {
- std::string::size_type pos = path.find_last_of('/');
- if (pos == std::string::npos)
- return path;
- else
- return path.substr(pos + 1);
-}
-
void displayHelp(const char *exe) {
using std::cout;
@@ -641,6 +603,7 @@ void displayHelp(const char *exe) {
" 8 stands for \"Visual Studio 2005\"\n"
" 9 stands for \"Visual Studio 2008\"\n"
" 10 stands for \"Visual Studio 2010\"\n"
+ " 11 stands for \"Visual Studio 2012\"\n"
" The default is \"9\", thus \"Visual Studio 2008\"\n"
" --build-events Run custom build events as part of the build\n"
" (default: false)\n"
@@ -652,14 +615,14 @@ void displayHelp(const char *exe) {
"\n"
"Engines settings:\n"
" --list-engines list all available engines and their default state\n"
- " --enable-engine enable building of the engine with the name \"engine\"\n"
- " --disable-engine disable building of the engine with the name \"engine\"\n"
+ " --enable-engine=<name> enable building of the engine with the name \"name\"\n"
+ " --disable-engine=<name> disable building of the engine with the name \"name\"\n"
" --enable-all-engines enable building of all engines\n"
" --disable-all-engines disable building of all engines\n"
"\n"
"Optional features settings:\n"
- " --enable-name enable inclusion of the feature \"name\"\n"
- " --disable-name disable inclusion of the feature \"name\"\n"
+ " --enable-<name> enable inclusion of the feature \"name\"\n"
+ " --disable-<name> disable inclusion of the feature \"name\"\n"
"\n"
" There are the following features available:\n"
"\n";
@@ -691,7 +654,7 @@ bool parseEngine(const std::string &line, EngineDesc &engine);
} // End of anonymous namespace
EngineDescList parseConfigure(const std::string &srcDir) {
- std::string configureFile = srcDir + "/configure";
+ std::string configureFile = srcDir + "/engines/configure.engines";
std::ifstream configure(configureFile.c_str());
if (!configure)
@@ -800,6 +763,7 @@ bool parseEngine(const std::string &line, EngineDesc &engine) {
return true;
}
+} // End of anonymous namespace
TokenList tokenize(const std::string &input, char separator) {
TokenList result;
@@ -832,7 +796,6 @@ TokenList tokenize(const std::string &input, char separator) {
return result;
}
-} // End of anonymous namespace
namespace {
const Feature s_features[] = {
@@ -843,6 +806,7 @@ const Feature s_features[] = {
{ "flac", "USE_FLAC", "libFLAC_static", true, "FLAC support" },
{ "png", "USE_PNG", "libpng", true, "libpng support" },
{ "theora", "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" },
+ {"freetype", "USE_FREETYPE2", "freetype", true, "FreeType support" },
// Feature flags
{ "bink", "USE_BINK", "", true, "Bink video support" },
@@ -997,7 +961,7 @@ bool isInList(const std::string &dir, const std::string &fileName, const StringL
continue;
}
- const std::string lastPathComponent = getLastPathComponent(*i);
+ const std::string lastPathComponent = ProjectProvider::getLastPathComponent(*i);
if (extensionName == "o") {
return false;
} else if (!producesObjectFile(fileName) && extensionName != "h") {
@@ -1212,9 +1176,7 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
createModuleList(setup.srcDir + "/gui", setup.defines, in, ex);
createModuleList(setup.srcDir + "/audio", setup.defines, in, ex);
createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, in, ex);
-#if HAS_VIDEO_FOLDER
createModuleList(setup.srcDir + "/video", setup.defines, in, ex);
-#endif
// Resource files
in.push_back(setup.srcDir + "/icons/" + setup.projectName + ".ico");
@@ -1224,6 +1186,8 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
in.push_back(setup.srcDir + "/AUTHORS");
in.push_back(setup.srcDir + "/COPYING");
in.push_back(setup.srcDir + "/COPYING.LGPL");
+ in.push_back(setup.srcDir + "/COPYING.BSD");
+ in.push_back(setup.srcDir + "/COPYING.FREEFONT");
in.push_back(setup.srcDir + "/COPYRIGHT");
in.push_back(setup.srcDir + "/NEWS");
in.push_back(setup.srcDir + "/README");
@@ -1300,6 +1264,14 @@ std::string ProjectProvider::createUUID() const {
#endif
}
+std::string ProjectProvider::getLastPathComponent(const std::string &path) {
+ std::string::size_type pos = path.find_last_of('/');
+ if (pos == std::string::npos)
+ return path;
+ else
+ return path.substr(pos + 1);
+}
+
void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &projectFile,
const StringList &includeList, const StringList &excludeList,
const std::string &filePrefix) {
diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h
index 8719143f4a..de77793ee7 100644
--- a/devtools/create_project/create_project.h
+++ b/devtools/create_project/create_project.h
@@ -31,6 +31,30 @@
typedef std::list<std::string> StringList;
+typedef StringList TokenList;
+
+/**
+ * Takes a given input line and creates a list of tokens out of it.
+ *
+ * A token in this context is separated by whitespaces. A special case
+ * are quotation marks though. A string inside quotation marks is treated
+ * as single token, even when it contains whitespaces.
+ *
+ * Thus for example the input:
+ * foo bar "1 2 3 4" ScummVM
+ * will create a list with the following entries:
+ * "foo", "bar", "1 2 3 4", "ScummVM"
+ * As you can see the quotation marks will get *removed* too.
+ *
+ * You can also use this with non-whitespace by passing another separator
+ * character (e.g. ',').
+ *
+ * @param input The text to be tokenized.
+ * @param separator The token separator.
+ * @return A list of tokens.
+ */
+TokenList tokenize(const std::string &input, char separator = ' ');
+
/**
* Structure to describe a game engine to be built into ScummVM.
*
@@ -317,6 +341,14 @@ public:
*/
void createProject(const BuildSetup &setup);
+ /**
+ * Returns the last path component.
+ *
+ * @param path Path string.
+ * @return Last path component.
+ */
+ static std::string getLastPathComponent(const std::string &path);
+
protected:
const int _version; ///< Target project version
StringList &_globalWarnings; ///< Global warnings
diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp
index f8768ecc73..0f77d91852 100644
--- a/devtools/create_project/msbuild.cpp
+++ b/devtools/create_project/msbuild.cpp
@@ -46,7 +46,13 @@ const char *MSBuildProvider::getPropertiesExtension() {
}
int MSBuildProvider::getVisualStudioVersion() {
- return 2010;
+ if (_version == 10)
+ return 2010;
+
+ if (_version == 11)
+ return 2012;
+
+ error("Unsupported version passed to getVisualStudioVersion");
}
namespace {
@@ -58,9 +64,10 @@ inline void outputConfiguration(std::ostream &project, const std::string &config
"\t\t</ProjectConfiguration>\n";
}
-inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config) {
+inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, int version) {
project << "\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"Configuration\">\n"
"\t\t<ConfigurationType>" << ((name == setup.projectName || setup.devTools) ? "Application" : "StaticLibrary") << "</ConfigurationType>\n"
+ "\t\t<PlatformToolset>v" << version << "0</PlatformToolset>\n"
"\t</PropertyGroup>\n";
}
@@ -98,17 +105,18 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
"\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n"
"\t\t<RootNamespace>" << name << "</RootNamespace>\n"
"\t\t<Keyword>Win32Proj</Keyword>\n"
+ "\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath11)</VCTargetsPath>\n"
"\t</PropertyGroup>\n";
// Shared configuration
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
- outputConfigurationType(setup, project, name, "Release|Win32");
- outputConfigurationType(setup, project, name, "Analysis|Win32");
- outputConfigurationType(setup, project, name, "Debug|Win32");
- outputConfigurationType(setup, project, name, "Release|x64");
- outputConfigurationType(setup, project, name, "Analysis|x64");
- outputConfigurationType(setup, project, name, "Debug|x64");
+ outputConfigurationType(setup, project, name, "Release|Win32", _version);
+ outputConfigurationType(setup, project, name, "Analysis|Win32", _version);
+ outputConfigurationType(setup, project, name, "Debug|Win32", _version);
+ outputConfigurationType(setup, project, name, "Release|x64", _version);
+ outputConfigurationType(setup, project, name, "Analysis|x64", _version);
+ outputConfigurationType(setup, project, name, "Debug|x64", _version);
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
@@ -233,9 +241,11 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
// Check for project-specific warnings:
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
+ bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
+ bool disableEditAndContinue = find(_disableEditAndContinue.begin(), _disableEditAndContinue.end(), name) != _disableEditAndContinue.end();
// Nothing to add here, move along!
- if (!setup.devTools && name != setup.projectName && name != "sword25" && name != "tinsel" && name != "grim" && warningsIterator == _projectWarnings.end())
+ if (!setup.devTools && name != setup.projectName && !enableLanguageExtensions && !disableEditAndContinue && warningsIterator == _projectWarnings.end())
return;
std::string warnings = "";
@@ -246,16 +256,17 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << (isWin32 ? "Win32" : "x64") << "'\">\n"
"\t\t<ClCompile>\n";
- // Compile configuration
- if (setup.devTools || name == setup.projectName || name == "sword25" || name == "grim") {
+ // Language Extensions
+ if (setup.devTools || name == setup.projectName || enableLanguageExtensions)
project << "\t\t\t<DisableLanguageExtensions>false</DisableLanguageExtensions>\n";
- } else {
- if (name == "tinsel" && !isRelease)
- project << "\t\t\t<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n";
- if (warningsIterator != _projectWarnings.end())
- project << "\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n";
- }
+ // Edit and Continue
+ if ((name == setup.projectName || disableEditAndContinue) && !isRelease)
+ project << "\t\t\t<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n";
+
+ // Warnings
+ if (warningsIterator != _projectWarnings.end())
+ project << "\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n";
project << "\t\t</ClCompile>\n";
@@ -395,6 +406,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
"\t\t</ClCompile>\n"
"\t\t<Link>\n"
"\t\t\t<GenerateDebugInformation>true</GenerateDebugInformation>\n"
+ "\t\t\t<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n"
"\t\t\t<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n";
}
diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp
index 96eaf643d1..b8d2401af9 100644
--- a/devtools/create_project/msvc.cpp
+++ b/devtools/create_project/msvc.cpp
@@ -33,6 +33,9 @@ namespace CreateProjectTool {
//////////////////////////////////////////////////////////////////////////
MSVCProvider::MSVCProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version)
: ProjectProvider(global_warnings, project_warnings, version) {
+
+ _enableLanguageExtensions = tokenize(ENABLE_LANGUAGE_EXTENSIONS, ',');
+ _disableEditAndContinue = tokenize(DISABLE_EDIT_AND_CONTINUE, ',');
}
void MSVCProvider::createWorkspace(const BuildSetup &setup) {
@@ -75,10 +78,10 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
solution << "Global\n"
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"
"\t\tDebug|Win32 = Debug|Win32\n"
- "\t\tAnalysis|Win32 = Analysis|Win32\n"
+ "\t\tAnalysis|Win32 = Analysis|Win32\n"
"\t\tRelease|Win32 = Release|Win32\n"
"\t\tDebug|x64 = Debug|x64\n"
- "\t\tAnalysis|x64 = Analysis|x64\n"
+ "\t\tAnalysis|x64 = Analysis|x64\n"
"\t\tRelease|x64 = Release|x64\n"
"\tEndGlobalSection\n"
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
@@ -86,14 +89,14 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
solution << "\t\t{" << i->second << "}.Debug|Win32.ActiveCfg = Debug|Win32\n"
"\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n"
- "\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n"
- "\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n"
+ "\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n"
+ "\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n"
"\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n"
"\t\t{" << i->second << "}.Release|Win32.Build.0 = Release|Win32\n"
"\t\t{" << i->second << "}.Debug|x64.ActiveCfg = Debug|x64\n"
"\t\t{" << i->second << "}.Debug|x64.Build.0 = Debug|x64\n"
- "\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n"
- "\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n"
+ "\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n"
+ "\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n"
"\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|x64\n"
"\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n";
}
@@ -139,7 +142,7 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
StringList x64EngineDefines = getEngineDefines(setup.engines);
x64Defines.splice(x64Defines.end(), x64EngineDefines);
- // HACK: This definitly should not be here, but otherwise we would not define SDL_BACKEND for x64.
+ // HACK: This definitely should not be here, but otherwise we would not define SDL_BACKEND for x64.
x64Defines.push_back("WIN32");
x64Defines.push_back("SDL_BACKEND");
@@ -168,7 +171,7 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32, bool createInstaller)
cmdLine += (isWin32) ? "x86" : "x64";
- cmdLine += " %SCUMMVM_LIBS% ";
+ cmdLine += " %" LIBS_DEFINE "% ";
// Specify if installer needs to be built or not
cmdLine += (createInstaller ? "1" : "0");
diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h
index 0a994667fa..5a854b596a 100644
--- a/devtools/create_project/msvc.h
+++ b/devtools/create_project/msvc.h
@@ -32,6 +32,8 @@ public:
MSVCProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version);
protected:
+ StringList _enableLanguageExtensions;
+ StringList _disableEditAndContinue;
void createWorkspace(const BuildSetup &setup);
diff --git a/devtools/create_project/msvc11/create_project.sln b/devtools/create_project/msvc11/create_project.sln
new file mode 100644
index 0000000000..1552c9f502
--- /dev/null
+++ b/devtools/create_project/msvc11/create_project.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_project", "create_project.vcxproj", "{CF177559-077D-4A08-AABE-BE0FD35F6C63}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.Build.0 = Debug|Win32
+ {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.ActiveCfg = Release|Win32
+ {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/devtools/create_project/msvc11/create_project.vcxproj b/devtools/create_project/msvc11/create_project.vcxproj
new file mode 100644
index 0000000000..c87461c049
--- /dev/null
+++ b/devtools/create_project/msvc11/create_project.vcxproj
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{CF177559-077D-4A08-AABE-BE0FD35F6C63}</ProjectGuid>
+ <RootNamespace>create_project</RootNamespace>
+ <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableLanguageExtensions>false</DisableLanguageExtensions>
+ <DisableSpecificWarnings>4003;4512;4127</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
+ </Link>
+ <PostBuildEvent>
+ <Command>@echo off
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4003;4512;4127</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <PostBuildEvent>
+ <Command>@echo off
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
+xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
+ </PostBuildEvent>
+ <PreBuildEvent>
+ <Command>
+ </Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\codeblocks.cpp" />
+ <ClCompile Include="..\create_project.cpp" />
+ <ClCompile Include="..\msbuild.cpp" />
+ <ClCompile Include="..\msvc.cpp" />
+ <ClCompile Include="..\visualstudio.cpp" />
+ <ClCompile Include="..\xcode.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\codeblocks.h" />
+ <ClInclude Include="..\config.h" />
+ <ClInclude Include="..\create_project.h" />
+ <ClInclude Include="..\msbuild.h" />
+ <ClInclude Include="..\msvc.h" />
+ <ClInclude Include="..\visualstudio.h" />
+ <ClInclude Include="..\xcode.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\scripts\installer.vbs" />
+ <None Include="..\scripts\postbuild.cmd" />
+ <None Include="..\scripts\prebuild.cmd" />
+ <None Include="..\scripts\revision.vbs" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/devtools/create_project/msvc11/create_project.vcxproj.filters b/devtools/create_project/msvc11/create_project.vcxproj.filters
new file mode 100644
index 0000000000..b4f0b18774
--- /dev/null
+++ b/devtools/create_project/msvc11/create_project.vcxproj.filters
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{2e3580c8-ec3a-4c81-8351-b668c668db2a}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{31aaf58c-d3cb-4ed6-8eca-163b4a9b31a6}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="scripts">
+ <UniqueIdentifier>{f980f6fb-41b6-4161-b035-58b200c85cad}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\codeblocks.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\create_project.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\msvc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\msbuild.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\visualstudio.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\xcode.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\config.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\codeblocks.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\create_project.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\msvc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\msbuild.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\visualstudio.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\xcode.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\scripts\prebuild.cmd">
+ <Filter>scripts</Filter>
+ </None>
+ <None Include="..\scripts\revision.vbs">
+ <Filter>scripts</Filter>
+ </None>
+ <None Include="..\scripts\postbuild.cmd">
+ <Filter>scripts</Filter>
+ </None>
+ <None Include="..\scripts\installer.vbs">
+ <Filter>scripts</Filter>
+ </None>
+ </ItemGroup>
+</Project>
diff --git a/devtools/create_project/scripts/postbuild.cmd b/devtools/create_project/scripts/postbuild.cmd
index dd52c0217c..8b70ec3dd8 100644
--- a/devtools/create_project/scripts/postbuild.cmd
+++ b/devtools/create_project/scripts/postbuild.cmd
@@ -24,7 +24,10 @@ echo Copying data files
echo.
xcopy /F /Y "%~4/lib/%~3/SDL.dll" "%~2" 1>NUL 2>&1
+xcopy /F /Y "%~4/lib/%~3/freetype6.dll" "%~2" 1>NUL 2>&1
xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_default.zip" "%~2" 1>NUL 2>&1
+xcopy /F /Y "%~1/gui/themes/translations.dat" "%~2" 1>NUL 2>&1
+
if "%~5"=="0" goto done
diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp
index a0fd239db4..de2df96d78 100644
--- a/devtools/create_project/visualstudio.cpp
+++ b/devtools/create_project/visualstudio.cpp
@@ -103,6 +103,9 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
outputConfiguration(project, setup, libraries, "Release", "x64", "64", false);
} else {
+ bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
+ bool disableEditAndContinue = find(_disableEditAndContinue.begin(), _disableEditAndContinue.end(), name) != _disableEditAndContinue.end();
+
std::string warnings = "";
if (warningsIterator != _projectWarnings.end())
for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
@@ -110,9 +113,8 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
std::string toolConfig;
toolConfig = (!warnings.empty() ? "DisableSpecificWarnings=\"" + warnings + "\"" : "");
- toolConfig += (name == "tinsel" ? "DebugInformationFormat=\"3\" " : "");
- toolConfig += (name == "sword25" ? "DisableLanguageExtensions=\"false\" " : "");
- toolConfig += (name == "grim" ? "DisableLanguageExtensions=\"false\" " : "");
+ toolConfig += (disableEditAndContinue ? "DebugInformationFormat=\"3\" " : "");
+ toolConfig += (enableLanguageExtensions ? "DisableLanguageExtensions=\"false\" " : "");
// Win32
outputConfiguration(setup, project, toolConfig, "Debug", "Win32", "");
@@ -144,7 +146,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32) {
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << props << ".vsprops\">\n"
- "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
+ "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" DebugInformationFormat=\"3\" />\n"
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n"
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
"\t\t\t/>\n";
diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp
index eb51ab3da1..a9b8e7a752 100755..100644
--- a/devtools/create_project/xcode.cpp
+++ b/devtools/create_project/xcode.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "config.h"
#include "xcode.h"
#include <fstream>
@@ -86,34 +87,34 @@ XCodeProvider::XCodeProvider(StringList &global_warnings, std::map<std::string,
void XCodeProvider::createWorkspace(const BuildSetup &setup) {
// Create project folder
- std::string workspace = setup.outputDir + '/' + "scummvm.xcodeproj";
+ std::string workspace = setup.outputDir + '/' + PROJECT_NAME ".xcodeproj";
#if defined(_WIN32) || defined(WIN32)
if (!CreateDirectory(workspace.c_str(), NULL))
if (GetLastError() != ERROR_ALREADY_EXISTS)
- error("Could not create folder \"" + setup.outputDir + '/' + "scummvm.xcodeproj\"");
+ error("Could not create folder \"" + setup.outputDir + '/' + PROJECT_NAME ".xcodeproj\"");
#else
if (mkdir(workspace.c_str(), 0777) == -1) {
if (errno == EEXIST) {
// Try to open as a folder (might be a file / symbolic link)
DIR *dirp = opendir(workspace.c_str());
if (dirp == NULL) {
- error("Could not create folder \"" + setup.outputDir + '/' + "scummvm.xcodeproj\"");
+ error("Could not create folder \"" + setup.outputDir + '/' + PROJECT_NAME ".xcodeproj\"");
} else {
// The folder exists, just close the stream and return
closedir(dirp);
}
} else {
- error("Could not create folder \"" + setup.outputDir + '/' + "scummvm.xcodeproj\"");
+ error("Could not create folder \"" + setup.outputDir + '/' + PROJECT_NAME ".xcodeproj\"");
}
}
#endif
// Setup global objects
setupDefines(setup);
- _targets.push_back("ScummVM-iPhone");
- _targets.push_back("ScummVM-OS X");
- _targets.push_back("ScummVM-Simulator");
+ _targets.push_back(PROJECT_DESCRIPTION "-iPhone");
+ _targets.push_back(PROJECT_DESCRIPTION "-OS X");
+ _targets.push_back(PROJECT_DESCRIPTION "-Simulator");
setupCopyFilesBuildPhase();
setupFrameworksBuildPhase();
@@ -153,9 +154,9 @@ void XCodeProvider::createProjectFile(const std::string &, const std::string &,
// Main Project file
//////////////////////////////////////////////////////////////////////////
void XCodeProvider::ouputMainProjectFile(const BuildSetup &setup) {
- std::ofstream project((setup.outputDir + '/' + "scummvm.xcodeproj" + '/' + "project.pbxproj").c_str());
+ std::ofstream project((setup.outputDir + '/' + PROJECT_NAME ".xcodeproj" + '/' + "project.pbxproj").c_str());
if (!project)
- error("Could not open \"" + setup.outputDir + '/' + "scummvm.xcodeproj" + '/' + "project.pbxproj\" for writing");
+ error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME ".xcodeproj" + '/' + "project.pbxproj\" for writing");
//////////////////////////////////////////////////////////////////////////
// Header
@@ -201,18 +202,38 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p
// Init root group
_groups.comment = "PBXGroup";
- Object *group = new Object(this, "PBXGroup", "PBXGroup", "PBXGroup", "", "");
- //Property children;
- //children.flags = SettingsAsList;
- //group->properties["children"] = children;
- group->addProperty("children", "", "", SettingsNoValue|SettingsAsList);
+ // Create group
+ std::string name = getLastPathComponent(dir.name);
+ Object *group = new Object(this, "PBXGroup_" + name , "PBXGroup", "PBXGroup", "", name);
+ // List of children
+ Property children;
+ children.hasOrder = true;
+ children.flags = SettingsAsList;
+
+ group->addProperty("name", name, "", SettingsNoValue|SettingsQuoteVariable);
group->addProperty("sourceTree", "<group>", "", SettingsNoValue|SettingsQuoteVariable);
- _groups.add(group);
+ int order = 0;
+ for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) {
+ const FileNode *node = *i;
+
+ std::string id = "FileReference_" + node->name;
+ FileProperty property = FileProperty(node->name, node->name, node->name, "<group>");
+
+ ADD_SETTING_ORDER_NOVALUE(children, getHash(id), node->name, order++);
+ ADD_BUILD_FILE(id, node->name, node->name + " in Sources");
+ ADD_FILE_REFERENCE(node->name, property);
- // TODO Add files
+ // Process child nodes
+ if (!node->children.empty())
+ writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/');
+ }
+
+ group->properties["children"] = children;
+
+ _groups.add(group);
}
//////////////////////////////////////////////////////////////////////////
@@ -392,8 +413,8 @@ void XCodeProvider::setupNativeTarget() {
target->addProperty("dependencies", "", "", SettingsNoValue|SettingsAsList);
target->addProperty("name", _targets[i], "", SettingsNoValue|SettingsQuoteVariable);
- target->addProperty("productName", "scummvm", "", SettingsNoValue);
- target->addProperty("productReference", getHash("PBXFileReference_ScummVM.app_" + _targets[i]), "ScummVM.app", SettingsNoValue);
+ target->addProperty("productName", PROJECT_NAME, "", SettingsNoValue);
+ target->addProperty("productReference", getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i]), PROJECT_DESCRIPTION ".app", SettingsNoValue);
target->addProperty("productType", "com.apple.product-type.application", "", SettingsNoValue|SettingsQuoteVariable);
_nativeTarget.add(target);
@@ -405,7 +426,7 @@ void XCodeProvider::setupProject() {
Object *project = new Object(this, "PBXProject", "PBXProject", "PBXProject", "", "Project object");
- project->addProperty("buildConfigurationList", getHash("XCConfigurationList_scummvm"), "Build configuration list for PBXProject \"scummvm\"", SettingsNoValue);
+ project->addProperty("buildConfigurationList", getHash("XCConfigurationList_scummvm"), "Build configuration list for PBXProject \"" PROJECT_NAME "\"", SettingsNoValue);
project->addProperty("compatibilityVersion", "Xcode 3.2", "", SettingsNoValue|SettingsQuoteVariable);
project->addProperty("developmentRegion", "English", "", SettingsNoValue);
project->addProperty("hasScannedForEncodings", "1", "", SettingsNoValue);
@@ -495,8 +516,8 @@ void XCodeProvider::setupResourcesBuildPhase() {
}
// Add custom files depending on the target
- if (_targets[i] == "ScummVM-OS X") {
- files.settings[getHash("PBXResources_scummvm.icns")] = Setting("", "scummvm.icns in Resources", SettingsNoValue, 0, 6);
+ if (_targets[i] == PROJECT_DESCRIPTION "-OS X") {
+ files.settings[getHash("PBXResources_" PROJECT_NAME ".icns")] = Setting("", PROJECT_NAME ".icns in Resources", SettingsNoValue, 0, 6);
// Remove 2 iphone icon files
files.settings.erase(getHash("PBXResources_Default.png"));
@@ -526,7 +547,7 @@ void XCodeProvider::setupBuildConfiguration() {
// ****************************************/
// Debug
- Object *iPhone_Debug_Object = new Object(this, "XCBuildConfiguration_ScummVM-iPhone_Debug", _targets[0] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Debug");
+ Object *iPhone_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Debug", _targets[0] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Debug");
Property iPhone_Debug;
ADD_SETTING_QUOTE(iPhone_Debug, "ARCHS", "$(ARCHS_UNIVERSAL_IPHONE_OS)");
ADD_SETTING_QUOTE(iPhone_Debug, "CODE_SIGN_IDENTITY", "iPhone Developer");
@@ -558,7 +579,7 @@ void XCodeProvider::setupBuildConfiguration() {
ADD_SETTING_LIST(iPhone_Debug, "LIBRARY_SEARCH_PATHS", iPhone_LibPaths, SettingsAsList, 5);
ADD_SETTING(iPhone_Debug, "ONLY_ACTIVE_ARCH", "YES");
ADD_SETTING(iPhone_Debug, "PREBINDING", "NO");
- ADD_SETTING(iPhone_Debug, "PRODUCT_NAME", "ScummVM");
+ ADD_SETTING(iPhone_Debug, "PRODUCT_NAME", PROJECT_DESCRIPTION);
ADD_SETTING_QUOTE(iPhone_Debug, "PROVISIONING_PROFILE", "EF590570-5FAC-4346-9071-D609DE2B28D8");
ADD_SETTING_QUOTE_VAR(iPhone_Debug, "PROVISIONING_PROFILE[sdk=iphoneos*]", "");
ADD_SETTING(iPhone_Debug, "SDKROOT", "iphoneos4.0");
@@ -568,7 +589,7 @@ void XCodeProvider::setupBuildConfiguration() {
iPhone_Debug_Object->properties["buildSettings"] = iPhone_Debug;
// Release
- Object *iPhone_Release_Object = new Object(this, "XCBuildConfiguration_ScummVM-iPhone_Release", _targets[0] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
+ Object *iPhone_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Release", _targets[0] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
Property iPhone_Release(iPhone_Debug);
ADD_SETTING(iPhone_Release, "GCC_OPTIMIZATION_LEVEL", "3");
ADD_SETTING(iPhone_Release, "COPY_PHASE_STRIP", "YES");
@@ -586,7 +607,7 @@ void XCodeProvider::setupBuildConfiguration() {
****************************************/
// Debug
- Object *scummvm_Debug_Object = new Object(this, "XCBuildConfiguration_scummvm_Debug", "scummvm", "XCBuildConfiguration", "PBXProject", "Debug");
+ Object *scummvm_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_NAME "_Debug", PROJECT_NAME, "XCBuildConfiguration", "PBXProject", "Debug");
Property scummvm_Debug;
ADD_SETTING(scummvm_Debug, "ALWAYS_SEARCH_USER_PATHS", "NO");
ADD_SETTING_QUOTE(scummvm_Debug, "ARCHS", "$(ARCHS_STANDARD_32_BIT)");
@@ -623,7 +644,7 @@ void XCodeProvider::setupBuildConfiguration() {
scummvm_Debug_Object->properties["buildSettings"] = scummvm_Debug;
// Release
- Object *scummvm_Release_Object = new Object(this, "XCBuildConfiguration_scummvm_Release", "scummvm", "XCBuildConfiguration", "PBXProject", "Release");
+ Object *scummvm_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_NAME "_Release", PROJECT_NAME, "XCBuildConfiguration", "PBXProject", "Release");
Property scummvm_Release(scummvm_Debug);
REMOVE_SETTING(scummvm_Release, "GCC_C_LANGUAGE_STANDARD"); // Not sure why we remove that, or any of the other warnings
REMOVE_SETTING(scummvm_Release, "GCC_WARN_ABOUT_RETURN_TYPE");
@@ -641,7 +662,7 @@ void XCodeProvider::setupBuildConfiguration() {
****************************************/
// Debug
- Object *scummvmOSX_Debug_Object = new Object(this, "XCBuildConfiguration_ScummVM-OSX_Debug", _targets[1] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Debug");
+ Object *scummvmOSX_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Debug", _targets[1] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Debug");
Property scummvmOSX_Debug;
ADD_SETTING_QUOTE(scummvmOSX_Debug, "ARCHS", "$(NATIVE_ARCH)");
ADD_SETTING(scummvmOSX_Debug, "COMPRESS_PNG_FILES", "NO");
@@ -687,13 +708,13 @@ void XCodeProvider::setupBuildConfiguration() {
scummvmOSX_LdFlags.push_back("-lz");
ADD_SETTING_LIST(scummvmOSX_Debug, "OTHER_LDFLAGS", scummvmOSX_LdFlags, SettingsAsList, 5);
ADD_SETTING(scummvmOSX_Debug, "PREBINDING", "NO");
- ADD_SETTING(scummvmOSX_Debug, "PRODUCT_NAME", "ScummVM");
+ ADD_SETTING(scummvmOSX_Debug, "PRODUCT_NAME", PROJECT_DESCRIPTION);
scummvmOSX_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue);
scummvmOSX_Debug_Object->properties["buildSettings"] = scummvmOSX_Debug;
// Release
- Object *scummvmOSX_Release_Object = new Object(this, "XCBuildConfiguration_ScummVMOSX_Release", _targets[1] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
+ Object *scummvmOSX_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Release", _targets[1] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
Property scummvmOSX_Release(scummvmOSX_Debug);
ADD_SETTING(scummvmOSX_Release, "COPY_PHASE_STRIP", "YES");
REMOVE_SETTING(scummvmOSX_Release, "GCC_DYNAMIC_NO_PIC");
@@ -711,20 +732,22 @@ void XCodeProvider::setupBuildConfiguration() {
****************************************/
// Debug
- Object *scummvmSimulator_Debug_Object = new Object(this, "XCBuildConfiguration_ScummVM-Simulator_Debug", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Debug");
+ Object *scummvmSimulator_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Debug", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Debug");
Property scummvmSimulator_Debug(iPhone_Debug);
ADD_SETTING_QUOTE(scummvmSimulator_Debug, "FRAMEWORK_SEARCH_PATHS", "$(inherited)");
ADD_SETTING_LIST(scummvmSimulator_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvm_defines, SettingsNoQuote|SettingsAsList, 5);
ADD_SETTING(scummvmSimulator_Debug, "SDKROOT", "iphonesimulator3.2");
+ ADD_SETTING_QUOTE(scummvmSimulator_Debug, "VALID_ARCHS", "i386 x86_64");
REMOVE_SETTING(scummvmSimulator_Debug, "TARGETED_DEVICE_FAMILY");
scummvmSimulator_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue);
scummvmSimulator_Debug_Object->properties["buildSettings"] = scummvmSimulator_Debug;
// Release
- Object *scummvmSimulator_Release_Object = new Object(this, "XCBuildConfiguration_ScummVM-Simulator_Release", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
+ Object *scummvmSimulator_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Release", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
Property scummvmSimulator_Release(scummvmSimulator_Debug);
ADD_SETTING(scummvmSimulator_Release, "COPY_PHASE_STRIP", "YES");
+ ADD_SETTING(scummvmSimulator_Release, "GCC_OPTIMIZATION_LEVEL", "3");
REMOVE_SETTING(scummvmSimulator_Release, "GCC_DYNAMIC_NO_PIC");
ADD_SETTING(scummvmSimulator_Release, "WRAPPER_EXTENSION", "app");
@@ -870,7 +893,9 @@ std::string XCodeProvider::writeProperty(const std::string &variable, Property &
std::string XCodeProvider::writeSetting(const std::string &variable, std::string value, std::string comment, int flags, int indent) const {
return writeSetting(variable, Setting(value, comment, flags, indent));
}
-// Heavily modified (not in a good way) function, imported from QMake XCode project generator (licensed under the QT license)
+
+// Heavily modified (not in a good way) function, imported from the QMake
+// XCode project generator pbuilder_pbx.cpp, writeSettings() (under LGPL 2.1)
std::string XCodeProvider::writeSetting(const std::string &variable, const Setting &setting) const {
std::string output;
const std::string quote = (setting.flags & SettingsNoQuote) ? "" : "\"";
@@ -892,7 +917,7 @@ std::string XCodeProvider::writeSetting(const std::string &variable, const Setti
for (unsigned int i = 0, count = 0; i < setting.entries.size(); ++i) {
std::string value = setting.entries.at(i).value;
- if(!value.empty()) {
+ if (!value.empty()) {
if (count++ > 0)
output += "," + newline;
diff --git a/devtools/create_teenagent/create_teenagent.cpp b/devtools/create_teenagent/create_teenagent.cpp
index 9551acbaea..fc2ba4da0e 100644
--- a/devtools/create_teenagent/create_teenagent.cpp
+++ b/devtools/create_teenagent/create_teenagent.cpp
@@ -106,7 +106,5 @@ int main(int argc, char *argv[]) {
fclose(fin);
fclose(fout);
- fprintf(stderr, "please run \"gzip -n %s\"\n", dat_name);
-
return 0;
}
diff --git a/devtools/create_tony/create_tony.cpp b/devtools/create_tony/create_tony.cpp
new file mode 100644
index 0000000000..f2d086c083
--- /dev/null
+++ b/devtools/create_tony/create_tony.cpp
@@ -0,0 +1,183 @@
+/* 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 storing all the hardcoded data of Tony Tough in a separate
+ * data file, used by the game engine
+ */
+
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/scummsys.h"
+#include "common/events.h"
+
+#include "create_tony.h"
+#include "staticdata.h"
+
+static void writeByte(FILE *fp, uint8 b) {
+ fwrite(&b, 1, 1, fp);
+}
+
+static void writeUint16BE(FILE *fp, uint16 value) {
+ writeByte(fp, (uint8)(value >> 8));
+ writeByte(fp, (uint8)(value & 0xFF));
+}
+
+void writeSint16BE(FILE *fp, int16 value) {
+ writeUint16BE(fp, (uint16)value);
+}
+
+static void writeUint32BE(FILE *fp, uint32 value) {
+ writeByte(fp, (uint8)(value >> 24));
+ writeByte(fp, (uint8)((value >> 16) & 0xFF));
+ writeByte(fp, (uint8)((value >> 8) & 0xFF));
+ writeByte(fp, (uint8)(value & 0xFF));
+}
+
+void writeSint32BE(FILE *fp, int32 value) {
+ writeUint32BE(fp, (uint16)value);
+}
+
+int main(int argc, char *argv[]) {
+ FILE *outFile;
+
+ outFile = fopen("tony.dat", "wb");
+
+ // Write header
+ fwrite("TONY", 4, 1, outFile);
+
+ writeByte(outFile, TONY_DAT_VER_MAJ);
+ writeByte(outFile, TONY_DAT_VER_MIN);
+
+ // game versions/variants
+ writeUint16BE(outFile, NUM_VARIANTS);
+
+ // Italian
+ for (int i = 0; i < 256; i++) {
+ writeSint16BE(outFile, _cTableDialogIta[i]);
+ writeSint16BE(outFile, _lTableDialogIta[i]);
+ writeSint16BE(outFile, _cTableMaccIta[i]);
+ writeSint16BE(outFile, _lTableMaccIta[i]);
+ writeSint16BE(outFile, _cTableCredIta[i]);
+ writeSint16BE(outFile, _lTableCredIta[i]);
+ writeSint16BE(outFile, _cTableObjIta[i]);
+ writeSint16BE(outFile, _lTableObjIta[i]);
+ }
+
+ // Polish
+ for (int i = 0; i < 256; i++) {
+ writeSint16BE(outFile, _cTableDialogPol[i]);
+ writeSint16BE(outFile, _lTableDialogPol[i]);
+ writeSint16BE(outFile, _cTableMaccPol[i]);
+ writeSint16BE(outFile, _lTableMaccPol[i]);
+ writeSint16BE(outFile, _cTableCredPol[i]);
+ writeSint16BE(outFile, _lTableCredPol[i]);
+ writeSint16BE(outFile, _cTableObjPol[i]);
+ writeSint16BE(outFile, _lTableObjPol[i]);
+ }
+
+ //Russian
+ for (int i = 0; i < 256; i++) {
+ writeSint16BE(outFile, _cTableDialogRus[i]);
+ writeSint16BE(outFile, _lTableDialogRus[i]);
+ writeSint16BE(outFile, _cTableMaccRus[i]);
+ writeSint16BE(outFile, _lTableMaccRus[i]);
+ writeSint16BE(outFile, _cTableCredRus[i]);
+ writeSint16BE(outFile, _lTableCredRus[i]);
+ writeSint16BE(outFile, _cTableObjRus[i]);
+ writeSint16BE(outFile, _lTableObjRus[i]);
+ }
+
+ // Czech
+ for (int i = 0; i < 256; i++) {
+ writeSint16BE(outFile, _cTableDialogCze[i]);
+ writeSint16BE(outFile, _lTableDialogCze[i]);
+ writeSint16BE(outFile, _cTableMaccCze[i]);
+ writeSint16BE(outFile, _lTableMaccCze[i]);
+ writeSint16BE(outFile, _cTableCredCze[i]);
+ writeSint16BE(outFile, _lTableCredCze[i]);
+ writeSint16BE(outFile, _cTableObjCze[i]);
+ writeSint16BE(outFile, _lTableObjCze[i]);
+ }
+
+ // French
+ for (int i = 0; i < 256; i++) {
+ writeSint16BE(outFile, _cTableDialogFra[i]);
+ writeSint16BE(outFile, _lTableDialogFra[i]);
+ writeSint16BE(outFile, _cTableMaccFra[i]);
+ writeSint16BE(outFile, _lTableMaccFra[i]);
+ writeSint16BE(outFile, _cTableCredFra[i]);
+ writeSint16BE(outFile, _lTableCredFra[i]);
+ writeSint16BE(outFile, _cTableObjFra[i]);
+ writeSint16BE(outFile, _lTableObjFra[i]);
+ }
+
+ // Deutsch
+ for (int i = 0; i < 256; i++) {
+ writeSint16BE(outFile, _cTableDialogDeu[i]);
+ writeSint16BE(outFile, _lTableDialogDeu[i]);
+ writeSint16BE(outFile, _cTableMaccDeu[i]);
+ writeSint16BE(outFile, _lTableMaccDeu[i]);
+ writeSint16BE(outFile, _cTableCredDeu[i]);
+ writeSint16BE(outFile, _lTableCredDeu[i]);
+ writeSint16BE(outFile, _cTableObjDeu[i]);
+ writeSint16BE(outFile, _lTableObjDeu[i]);
+ }
+
+ fclose(outFile);
+ return 0;
+}
+
+void writeTextArray(FILE *outFile, const char *textArray[], int nbrText) {
+ int len, len1, pad;
+ uint8 padBuf[DATAALIGNMENT];
+
+ for (int i = 0; i < DATAALIGNMENT; i++)
+ padBuf[i] = 0;
+
+ writeUint16BE(outFile, nbrText);
+ len = DATAALIGNMENT - 2;
+ for (int i = 0; i < nbrText; i++) {
+ len1 = strlen(textArray[i]) + 1;
+ pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT;
+ len += 2 + len1 + pad;
+ }
+ writeUint16BE(outFile, len);
+
+ fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding
+ for (int i = 0; i < nbrText; i++) {
+ len = strlen(textArray[i]) + 1;
+ pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT;
+
+ writeUint16BE(outFile, len + pad + 2);
+ fwrite(textArray[i], len, 1, outFile);
+ fwrite(padBuf, pad, 1, outFile);
+ }
+}
diff --git a/devtools/create_tony/create_tony.h b/devtools/create_tony/create_tony.h
new file mode 100644
index 0000000000..3075835bd9
--- /dev/null
+++ b/devtools/create_tony/create_tony.h
@@ -0,0 +1,44 @@
+/* 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 CREATE_TONY_H
+#define CREATE_TONY_H
+
+#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
+
+#define DATAALIGNMENT 4
+
+#define TONY_DAT_VER_MAJ 0 // 1 byte
+#define TONY_DAT_VER_MIN 3 // 1 byte
+
+// Number of variants of the game. For the moment, it's the same
+// as the number of languages
+#define NUM_VARIANTS 6
+
+typedef unsigned char uint8;
+typedef unsigned char byte;
+typedef unsigned short uint16;
+typedef signed short int16;
+
+void writeTextArray(FILE *outFile, const char *textData[], int nbrText);
+
+#endif // CREATE_TONY_H
diff --git a/devtools/create_tony/module.mk b/devtools/create_tony/module.mk
new file mode 100644
index 0000000000..6ff919032b
--- /dev/null
+++ b/devtools/create_tony/module.mk
@@ -0,0 +1,10 @@
+MODULE := devtools/create_tony
+
+MODULE_OBJS := \
+ create_tony.o
+
+# Set the name of the executable
+TOOL_EXECUTABLE := create_tony
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/devtools/create_tony/staticdata.h b/devtools/create_tony/staticdata.h
new file mode 100644
index 0000000000..fff977d8dc
--- /dev/null
+++ b/devtools/create_tony/staticdata.h
@@ -0,0 +1,1370 @@
+/* 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 STATICDATA_H
+#define STATICDATA_H
+
+const int _cTableDialogIta[] = {
+ -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, -1, -1,
+ -1, -1, -1, 71, 77, -1, 80, 81, 82, 111,
+ 75, 76, -1, 68, 63, 66, 64, 78, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 65, 62,
+ 69, 83, 70, 73, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 77, 67, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 79, -1, -1, -1, -1, -1, 87,
+ -1, 84, -1, -1, 86, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 85, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 108, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 105,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 88, -1, -1, -1, 93, 99,
+ 107, 106, 89, 89, -1, 94, 90, -1, -1, 95,
+ -1, 104, 91, -1, -1, -1, 96, -1, 109, 92,
+ -1, -1, 97, -1, -1, 98};
+
+const int _lTableDialogIta[] = {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 9, 5, 5, 13, 13, 13, 13, 5,
+ 7, 7, 13, 13, 5, 13, 5, 13, 13, 13,
+ 13, 13, 10, 13, 13, 13, 13, 13, 5, 5,
+ 13, 13, 13, 10, 13, 13, 13, 13, 13, 10,
+ 11, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 5, 13, 13, 14, 15, 12,
+ 13, 12, 13, 13, 13, 6, 13, 13, 5, 16,
+ 12, 11, 11, 13, 13, 12, 13, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13};
+
+const int _cTableDialogPol[] = {
+ -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, -1, -1,
+ -1, -1, -1, 71, 77, -1, 80, 81, 82, 111,
+ 75, 76, -1, 68, 63, 66, 64, 78, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 65, 62,
+ 69, 83, 70, 73, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 77, 67, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, 128, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 125, -1, -1, 129,
+ -1, -1, -1, 118, -1, 112, -1, -1, -1, 87,
+ -1, 84, -1, -1, 86, 126, -1, -1, -1, 119,
+ -1, -1, -1, -1, -1, 113, -1, 85, -1, -1,
+ -1, 127, -1, -1, -1, -1, -1, -1, 114, -1,
+ -1, -1, 116, -1, -1, -1, -1, -1, -1, 120,
+ -1, 122, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 88, -1, -1, -1, 93, 99,
+ 115, 106, 89, 89, 117, 94, 90, -1, -1, 95,
+ -1, 121, 91, 123, -1, -1, 96, -1, 109, 92,
+ -1, -1, 97, -1, -1, 98};
+
+const int _lTableDialogPol[] = {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 9, 5, 5, 13, 13, 13, 13, 5,
+ 7, 7, 13, 13, 5, 13, 5, 13, 13, 13,
+ 13, 13, 10, 13, 13, 13, 13, 13, 5, 5,
+ 13, 13, 13, 10, 13, 13, 13, 13, 13, 10,
+ 11, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 5, 13, 13, 14, 15, 12,
+ 13, 12, 13, 13, 13, 6, 13, 13, 5, 16,
+ 12, 11, 11, 13, 13, 12, 13, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 12, 13, 13, 14, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 12, 13, 13, 13,
+ 13, 13, 13, 14, 13, 14, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 9,
+ 13, 13, 13, 13, 13, 16, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 12, 13,
+ 13, 13, 11, 13, 13, 13, 13, 13, 13, 10,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 12, 13, 13, 13, 12, 13, 13, 13, 13, 13,
+ 13, 11, 13, 11, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13};
+
+const int _cTableDialogRus[] = {
+ -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, -1, -1,
+ -1, -1, -1, 71, 77, -1, 80, 81, 82, 111,
+ 75, 76, -1, 68, 63, 66, 64, 78, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 65, 62,
+ 69, 83, 70, 73, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 77, 67, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 79, -1, -1, -1, -1, 136, 87,
+ -1, 84, -1, -1, 86, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 169, -1, -1, 85, -1, -1,
+ -1, -1, 130, 131, 132, 133, 134, 135, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 150, 151, 152, 153, 154, 155, 156, 158, 159,
+ 157, 160, 161, 162, 163, 164, 165, 166, 167, 168,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+ 191, 192, 190, 193, 194, 195};
+
+const int _lTableDialogRus[] = {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 9, 5, 5, 13, 13, 13, 13, 5,
+ 7, 7, 13, 13, 5, 13, 5, 13, 13, 13,
+ 13, 13, 10, 13, 13, 13, 13, 13, 5, 5,
+ 13, 13, 13, 10, 13, 13, 13, 13, 13, 10,
+ 11, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 5, 13, 13, 14, 15, 12,
+ 13, 12, 13, 13, 13, 6, 13, 13, 5, 16,
+ 12, 11, 11, 13, 13, 12, 13, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 11, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 12, 13, 13, 13, 13, 13,
+ 13, 13, 13, 15, 15, 11, 15, 11, 15, 10,
+ 13, 13, 12, 13, 14, 14, 13, 11, 12, 12,
+ 18, 11, 13, 12, 13, 12, 17, 18, 18, 19,
+ 16, 11, 16, 14, 14, 15, 10, 12, 13, 12,
+ 12, 10, 10, 10, 11, 12, 12, 12, 12, 10,
+ 11, 10, 14, 8, 11, 11, 12, 10, 15, 16,
+ 16, 16, 14, 9, 15, 14};
+
+const int _cTableDialogCze[] = {
+ -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, -1, -1,
+ -1, -1, -1, 71, 77, -1, 80, 81, 82, 111,
+ 75, 76, -1, 68, 63, 66, 64, 78, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 65, 62,
+ 69, 83, 70, 73, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 77, 67, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 197, -1,
+ -1, 206, 200, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 212, -1, -1, 221, 215, -1,
+ -1, -1, -1, 79, -1, -1, -1, -1, -1, 87,
+ -1, 84, -1, -1, 86, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 85, -1, -1,
+ -1, -1, -1, 202, -1, -1, -1, -1, 108, -1,
+ 198, 204, -1, -1, 196, 203, -1, 205, -1, 105,
+ 207, 208, -1, -1, -1, -1, 199, 209, 210, -1,
+ -1, 201, -1, -1, 88, 217, -1, -1, 93, 99,
+ 107, 106, 213, 219, -1, 94, 211, 218, -1, 220,
+ -1, 104, 222, 223, -1, -1, 96, -1, 214, 224,
+ 225, -1, 97, 216, -1, 98};
+
+const int _lTableDialogCze[] = {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 9, 5, 5, 13, 13, 13, 13, 5,
+ 7, 7, 13, 13, 5, 13, 5, 13, 13, 13,
+ 13, 13, 10, 13, 13, 13, 13, 13, 5, 5,
+ 13, 13, 13, 10, 13, 13, 13, 13, 13, 10,
+ 11, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 5, 13, 13, 14, 15, 12,
+ 13, 12, 13, 13, 13, 6, 13, 13, 5, 16,
+ 12, 11, 11, 13, 13, 12, 13, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 12, 13,
+ 13, 19, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 12, 13, 13, 16, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 12, 11, 13, 13, 11, 11, 13, 15, 13, 13,
+ 10, 13, 13, 13, 13, 13, 14, 13, 13, 13,
+ 13, 11, 13, 13, 13, 15, 13, 13, 13, 13,
+ 13, 13, 12, 12, 13, 13, 12, 7, 13, 17,
+ 13, 13, 11, 11, 13, 13, 13, 13, 12, 13,
+ 13, 13, 13, 11, 13, 13};
+
+const int _cTableDialogFra[] = {
+ -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, -1, -1,
+ -1, -1, -1, 71, 77, -1, 80, 81, 82, 111,
+ 75, 76, -1, 68, 63, 66, 64, 78, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 65, 62,
+ 69, 83, 70, 73, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 77, 67, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 79, -1, -1, -1, -1, -1, 87,
+ -1, 84, -1, -1, 86, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 85, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 108, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 105,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 88, -1, 226, -1, 93, 99,
+ 107, 106, 89, 227, 228, 94, 90, -1, 229, 95,
+ -1, 104, 91, -1, 232, -1, 233, -1, 109, 230,
+ -1, 231, 97, -1, -1, 98};
+
+const int _lTableDialogFra[] = {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 9, 5, 5, 13, 13, 13, 13, 5,
+ 7, 7, 13, 13, 5, 13, 5, 13, 13, 13,
+ 13, 13, 10, 13, 13, 13, 13, 13, 5, 5,
+ 13, 13, 13, 10, 13, 13, 13, 13, 13, 10,
+ 11, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 5, 13, 13, 14, 15, 12,
+ 13, 12, 13, 13, 13, 6, 13, 13, 5, 16,
+ 12, 11, 11, 13, 13, 12, 13, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 15, 13, 13, 13,
+ 13, 13, 13, 12, 12, 13, 13, 13, 9, 13,
+ 13, 13, 13, 13, 11, 13, 11, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13};
+
+const int _cTableDialogDeu[] = {
+ -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, -1, -1,
+ -1, -1, -1, 71, 77, -1, 80, 81, 82, 111,
+ 75, 76, -1, 68, 63, 66, 64, 78, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 65, 62,
+ 69, 83, 70, 73, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 77, 67, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 79, -1, -1, -1, -1, -1, 87,
+ -1, 84, -1, -1, 86, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 85, -1, -1,
+ -1, -1, -1, -1, -1, -1, 236, -1, 108, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 105,
+ -1, -1, -1, -1, 237, -1, -1, -1, -1, -1,
+ 238, -1, -1, 234, 88, -1, -1, -1, 93, 99,
+ 107, 106, 89, 89, -1, 94, 90, -1, -1, 95,
+ -1, 104, 91, -1, -1, -1, 96, -1, 109, 92,
+ -1, -1, 97, -1, -1, 98};
+
+const int _lTableDialogDeu[] = {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 9, 5, 5, 13, 13, 13, 13, 5,
+ 7, 7, 13, 13, 5, 13, 5, 13, 13, 13,
+ 13, 13, 10, 13, 13, 13, 13, 13, 5, 5,
+ 13, 13, 13, 10, 13, 13, 13, 13, 13, 10,
+ 11, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 5, 13, 13, 14, 15, 12,
+ 13, 12, 13, 13, 13, 6, 13, 13, 5, 16,
+ 12, 11, 11, 13, 13, 12, 13, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 15, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13};
+
+const int _cTableMaccIta[] = {
+ -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, -1, -1,
+ -1, -1, -1, 62, 64, -1, 65, 66, 67, -1,
+ 69, 70, 74, 75, 78, 81, 79, 84, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 80, 77,
+ 82, 71, 83, 72, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -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, -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, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 86, -1, -1, -1, 87, 88,
+ -1, 101, 89, -1, -1, 90, 92, -1, -1, 93,
+ -1, 76, 95, -1, -1, -1, 96, -1, -1, 98,
+ -1, -1, 99, -1, -1, 85};
+
+const int _lTableMaccIta[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableMaccPol[] = {
+ -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, -1, -1,
+ -1, -1, -1, 62, 64, -1, 65, 66, 67, -1,
+ 69, 70, 74, 75, 78, 81, 79, 84, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 80, 77,
+ 82, 71, 83, 72, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 114, -1, -1, 118, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 115, -1, -1, 119,
+ -1, -1, -1, 108, -1, 102, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 116, -1, -1, -1, 109,
+ -1, -1, -1, -1, -1, 103, -1, -1, -1, -1,
+ -1, 117, -1, -1, -1, -1, -1, -1, 104, -1,
+ -1, -1, 106, -1, -1, -1, -1, -1, -1, 110,
+ -1, 112, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 86, -1, -1, -1, 87, 88,
+ 105, 101, 89, -1, 107, 90, 92, -1, -1, 93,
+ -1, 111, 95, 113, -1, -1, 96, -1, -1, 98,
+ -1, -1, 99, -1, -1, 85};
+
+const int _lTableMaccPol[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 12, 10, 10, 14, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 12, 10, 10, 13,
+ 10, 10, 10, 14, 10, 14, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 13, 10, 10, 10, 9,
+ 10, 10, 10, 10, 10, 16, 10, 10, 10, 10,
+ 10, 13, 10, 10, 10, 10, 10, 10, 12, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 10,
+ 10, 13, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 12, 10, 10, 10, 12, 10, 10, 10, 10, 10,
+ 10, 11, 10, 11, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableMaccRus[] = {
+ -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, -1, -1,
+ -1, -1, -1, 62, 64, -1, 65, 66, 67, -1,
+ 69, 70, 74, 75, 78, 81, 79, 84, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 80, 77,
+ 82, 71, 83, 72, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 126, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 159, -1, -1, -1, -1, -1,
+ -1, -1, 120, 121, 122, 123, 124, 125, 127, 128,
+ 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 148, 149,
+ 147, 150, 151, 152, 153, 154, 155, 156, 157, 158,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 181, 182, 180, 183, 184, 185};
+
+const int _lTableMaccRus[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 9, 10, 10, 10, 10, 10,
+ 10, 10, 11, 11, 11, 9, 10, 10, 11, 10,
+ 10, 10, 11, 9, 11, 10, 11, 8, 10, 10,
+ 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
+ 11, 11, 11, 11, 10, 10, 11, 10, 9, 10,
+ 10, 9, 11, 11, 11, 11, 11, 11, 10, 9,
+ 11, 10, 9, 11, 10, 11, 10, 10, 11, 11,
+ 10, 10, 10, 9, 11, 11};
+
+const int _cTableMaccCze[] = {
+ -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, -1, -1,
+ -1, -1, -1, 62, 64, -1, 65, 66, 67, -1,
+ 69, 70, 74, 75, 78, 81, 79, 84, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 80, 77,
+ 82, 71, 83, 72, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 187, -1,
+ -1, 196, 190, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 202, -1, -1, 211, 205, -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, -1, -1, -1,
+ -1, -1, -1, 192, -1, -1, -1, -1, -1, -1,
+ 188, 194, -1, -1, 186, 193, -1, 195, -1, -1,
+ 197, 198, -1, -1, -1, -1, 189, 199, 200, -1,
+ -1, 191, -1, -1, 86, 207, -1, -1, 87, 88,
+ -1, 101, 203, 209, -1, 90, 201, 208, -1, 210,
+ -1, 76, 212, 213, -1, -1, 96, -1, 204, 214,
+ 215, -1, 99, 206, -1, 85};
+
+const int _lTableMaccCze[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 11, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 9, 10, 10, 11, 9, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 9, 10, 11, 10, 10,
+ 11, 11, 10, 10, 10, 10, 11, 11, 11, 10,
+ 10, 11, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 9, 10, 11,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 11,
+ 11, 10, 10, 11, 10, 10};
+
+const int _cTableMaccFra[] = {
+ -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, -1, -1,
+ -1, -1, -1, 62, 64, -1, 65, 66, 67, -1,
+ 69, 70, 74, 75, 78, 81, 79, 84, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 80, 77,
+ 82, 71, 83, 72, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -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, -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, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 86, -1, 226, -1, 87, 88,
+ -1, 101, 228, 227, -1, 90, 92, -1, 229, 93,
+ -1, 76, 95, -1, 232, -1, 233, -1, -1, 230,
+ -1, 231, 99, -1, -1, 85};
+
+const int _lTableMaccFra[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 8, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 11,
+ 10, 11, 10, 10, 10, 10};
+
+const int _cTableMaccDeu[] = {
+ -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, -1, -1,
+ -1, -1, -1, 62, 64, -1, 65, 66, 67, -1,
+ 69, 70, 74, 75, 78, 81, 79, 84, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 80, 77,
+ 82, 71, 83, 72, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -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, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 236, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 237, -1, -1, -1, -1, -1,
+ 238, -1, -1, 234, 86, -1, -1, -1, 87, 88,
+ -1, 101, 89, -1, -1, 90, 92, -1, -1, 93,
+ -1, 76, 95, -1, -1, -1, 96, -1, -1, 98,
+ -1, -1, 99, -1, -1, 85};
+
+const int _lTableMaccDeu[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableCredIta[] = {
+ -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, -1, -1,
+ -1, -1, -1, 81, -1, -1, -1, 90, 91, 111,
+ 84, 85, 99, 93, 95, -1, 100, 92, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 89, 94,
+ -1, 97, -1, 79, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 96, 98, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 77,
+ -1, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 87, -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, -1, -1, -1, -1,
+ -1, -1, -1, -1, 52, 53, -1, -1, -1, -1,
+ -1, 74, 56, 57, -1, -1, 60, 61, -1, -1,
+ -1, 73, 64, 65, -1, -1, -1, -1, -1, 68,
+ 69, -1, -1, -1, -1, -1};
+
+const int _lTableCredIta[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 5,
+ 10, 10, 10, 10, 5, 10, 5, 10, 12, 8,
+ 10, 11, 12, 11, 12, 10, 11, 10, 5, 5,
+ 10, 10, 10, 10, 10, 19, 15, 14, 13, 14,
+ 13, 16, 15, 5, 8, 15, 13, 17, 15, 14,
+ 12, 14, 14, 15, 11, 12, 12, 16, 12, 13,
+ 14, 10, 10, 10, 9, 10, 10, 11, 9, 9,
+ 10, 9, 8, 9, 10, 5, 6, 12, 6, 14,
+ 10, 11, 11, 9, 9, 9, 6, 9, 10, 14,
+ 9, 10, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 19, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableCredPol[] = {
+ -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, -1, -1,
+ -1, -1, -1, 81, -1, -1, -1, 90, 91, 111,
+ 84, 85, 99, 93, 95, -1, 100, 92, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 89, 94,
+ -1, 97, -1, 79, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 96, 98, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, 128, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 125, -1, -1, 129,
+ -1, -1, -1, 118, -1, 112, -1, -1, -1, 77,
+ -1, 86, -1, -1, -1, 126, -1, -1, -1, 119,
+ -1, -1, -1, -1, -1, 113, -1, 87, -1, -1,
+ -1, 127, -1, -1, -1, -1, -1, -1, 114, -1,
+ -1, -1, 116, -1, -1, -1, -1, -1, -1, 120,
+ -1, 122, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 52, 53, -1, -1, -1, -1,
+ 115, 74, 56, 57, 117, -1, 60, 61, -1, -1,
+ -1, 121, 64, 123, -1, -1, -1, -1, -1, 68,
+ 69, -1, -1, -1, -1, -1};
+
+const int _lTableCredPol[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 5,
+ 10, 10, 10, 10, 5, 10, 5, 10, 12, 8,
+ 10, 11, 12, 11, 12, 10, 11, 10, 5, 5,
+ 10, 10, 10, 10, 10, 19, 15, 14, 13, 14,
+ 13, 16, 15, 5, 8, 15, 13, 17, 15, 14,
+ 12, 14, 14, 15, 11, 12, 12, 16, 12, 13,
+ 14, 10, 10, 10, 9, 10, 10, 11, 9, 9,
+ 10, 9, 8, 9, 10, 5, 6, 12, 6, 14,
+ 10, 11, 11, 9, 9, 9, 6, 9, 10, 14,
+ 9, 10, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 15, 10, 10, 15, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 14, 10, 20, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 15, 10, 10, 10, 11,
+ 10, 10, 10, 10, 10, 12, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 19, 10, 15, 10,
+ 10, 10, 15, 10, 10, 10, 10, 10, 10, 16,
+ 10, 15, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableCredRus[] = {
+ -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, -1, -1,
+ -1, -1, -1, 81, -1, -1, -1, 90, 91, 111,
+ 84, 85, 99, 93, 95, -1, 100, 92, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 89, 94,
+ -1, 97, -1, 79, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 96, 98, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 136, 77,
+ -1, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 169, -1, -1, 87, -1, -1,
+ -1, -1, 130, 131, 132, 133, 134, 135, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 150, 151, 152, 153, 154, 155, 156, 158, 159,
+ 157, 160, 161, 162, 163, 164, 165, 166, 167, 168,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+ 191, 192, 190, 193, 194, 195};
+
+const int _lTableCredRus[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 5,
+ 10, 10, 10, 10, 5, 10, 5, 10, 12, 8,
+ 10, 11, 12, 11, 12, 10, 11, 10, 5, 5,
+ 10, 10, 10, 10, 10, 19, 15, 14, 13, 14,
+ 13, 16, 15, 5, 8, 15, 13, 17, 15, 14,
+ 12, 14, 14, 15, 11, 12, 12, 16, 12, 13,
+ 14, 10, 10, 10, 9, 10, 10, 11, 9, 9,
+ 10, 9, 8, 9, 10, 5, 6, 12, 6, 14,
+ 10, 11, 11, 9, 9, 9, 6, 9, 10, 14,
+ 9, 10, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 15, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 11, 10, 10, 10, 10, 10,
+ 10, 10, 20, 16, 16, 14, 22, 15, 20, 12,
+ 16, 16, 16, 22, 18, 16, 15, 14, 13, 15,
+ 12, 14, 15, 13, 16, 14, 23, 23, 12, 16,
+ 10, 12, 20, 15, 12, 10, 10, 11, 16, 10,
+ 13, 12, 13, 13, 12, 13, 14, 11, 11, 11,
+ 12, 10, 10, 10, 11, 10, 11, 10, 15, 15,
+ 12, 16, 10, 11, 13, 11};
+
+const int _cTableCredCze[] = {
+ -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, -1, -1,
+ -1, -1, -1, 81, -1, -1, -1, 90, 91, 111,
+ 84, 85, 99, 93, 95, -1, 100, 92, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 89, 94,
+ -1, 97, -1, 79, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 96, 98, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 197, -1,
+ -1, 206, 200, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 212, -1, -1, 221, 215, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 77,
+ -1, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 87, -1, -1,
+ -1, -1, -1, 202, -1, -1, -1, -1, -1, -1,
+ 198, 204, -1, -1, 196, 203, -1, 205, -1, -1,
+ 207, 208, -1, -1, -1, -1, 199, 209, 210, -1,
+ -1, 201, -1, -1, 52, 217, -1, -1, -1, -1,
+ -1, 74, 213, 219, -1, -1, 211, 218, -1, 220,
+ -1, 73, 222, 223, -1, -1, -1, -1, 214, 224,
+ 225, -1, -1, 216, -1, -1};
+
+const int _lTableCredCze[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 5,
+ 10, 10, 10, 10, 5, 10, 5, 10, 12, 8,
+ 10, 11, 12, 11, 12, 10, 11, 10, 5, 5,
+ 10, 10, 10, 10, 10, 19, 15, 14, 13, 14,
+ 13, 16, 15, 5, 8, 15, 13, 17, 15, 14,
+ 12, 14, 14, 15, 11, 12, 12, 16, 12, 13,
+ 14, 10, 10, 10, 9, 10, 10, 11, 9, 9,
+ 10, 9, 8, 9, 10, 5, 6, 12, 6, 14,
+ 10, 11, 11, 9, 9, 9, 6, 9, 10, 14,
+ 9, 10, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 15, 10,
+ 10, 19, 15, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 11, 10, 10, 12, 11, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 20, 10, 10, 19, 10, 10, 10,
+ 15, 15, 10, 10, 15, 7, 10, 20, 10, 10,
+ 16, 15, 10, 10, 10, 10, 15, 13, 13, 10,
+ 10, 14, 10, 10, 10, 12, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 11, 6, 10, 15,
+ 10, 10, 11, 11, 10, 10, 10, 10, 11, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableCredFra[] = {
+ -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, -1, -1,
+ -1, -1, -1, 81, -1, -1, -1, 90, 91, 111,
+ 84, 85, 99, 93, 95, -1, 100, 92, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 89, 94,
+ -1, 97, -1, 79, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 96, 98, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 77,
+ -1, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 87, -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, -1, -1, -1, -1,
+ -1, -1, -1, -1, 52, 53, 226, -1, -1, -1,
+ -1, 74, 56, 227, 228, -1, 60, 61, 229, -1,
+ -1, 73, 64, 65, 232, -1, 233, -1, -1, 230,
+ 69, 231, -1, -1, -1, -1};
+
+const int _lTableCredFra[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 5,
+ 10, 10, 10, 10, 5, 10, 5, 10, 12, 8,
+ 10, 11, 12, 11, 12, 10, 11, 10, 5, 5,
+ 10, 10, 10, 10, 10, 19, 15, 14, 13, 14,
+ 13, 16, 15, 5, 8, 15, 13, 17, 15, 14,
+ 12, 14, 14, 15, 11, 12, 12, 16, 12, 13,
+ 14, 10, 10, 10, 9, 10, 10, 11, 9, 9,
+ 10, 9, 8, 9, 10, 5, 6, 12, 6, 14,
+ 10, 11, 11, 9, 9, 9, 6, 9, 10, 14,
+ 9, 10, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 19, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 12, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 6, 10,
+ 10, 10, 10, 10, 11, 10, 11, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableCredDeu[] = {
+ -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, -1, -1,
+ -1, -1, -1, 81, -1, -1, -1, 90, 91, 111,
+ 84, 85, 99, 93, 95, -1, 100, 92, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 89, 94,
+ -1, 97, -1, 79, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 96, 98, -1, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 77,
+ -1, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 87, -1, -1,
+ -1, -1, -1, -1, -1, -1, 55, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 67, -1, -1, -1, -1, -1,
+ 71, -1, -1, 234, 52, 53, -1, -1, 55, -1,
+ -1, 74, 56, 57, -1, -1 , 60, 61, -1, -1,
+ -1, 73, 64, 65, -1, -1, 67, -1, -1, 68,
+ 69, -1, 71, -1, -1, -1};
+
+const int _lTableCredDeu[] = {
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 11, 10, 10, 10, 10, 10, 10, 5,
+ 10, 10, 10, 10, 5, 10, 5, 10, 12, 8,
+ 10, 11, 12, 11, 12, 10, 11, 10, 5, 5,
+ 10, 10, 10, 10, 10, 19, 15, 14, 13, 14,
+ 13, 16, 15, 5, 8, 15, 13, 17, 15, 14,
+ 12, 14, 14, 15, 11, 12, 12, 16, 12, 13,
+ 14, 10, 10, 10, 9, 10, 10, 11, 9, 9,
+ 10, 9, 8, 9, 10, 5, 6, 12, 6, 14,
+ 10, 11, 11, 9, 9, 9, 6, 9, 10, 14,
+ 9, 10, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 19, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10};
+
+const int _cTableObjIta[] = {
+ -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, -1, -1,
+ -1, -1, -1, 42, 51, -1, 53, 54, 55, 50,
+ 47, 48, 57, 41, 36, 40, 38, 46, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 39, 37,
+ 58, 49, 59, 44, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 56, -1, -1, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 91, -1, -1, 93, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 91, -1, -1, 93,
+ -1, -1, -1, 88, -1, 85, -1, -1, -1, 67,
+ -1, 60, -1, -1, 66, 92, -1, -1, -1, 88,
+ -1, -1, -1, -1, -1, 85, -1, 61, -1, -1,
+ -1, 92, -1, 69, -1, -1, 70, 71, 86, -1,
+ 72, -1, 87, 73, 75, -1, -1, 76, -1, 89,
+ 78, 90, -1, -1, 79, -1, -1, 81, -1, -1,
+ 82, -1, -1, -1, -1, -1, -1, -1, 70, -1,
+ 86, 63, -1, -1, 87, -1, -1, -1, -1, -1,
+ -1, 89, -1, 90, -1, -1, 79, -1, 62, -1,
+ -1, -1, 82, -1, -1, -1};
+
+const int _lTableObjIta[] = {
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 11, 26, 26, 26, 26, 26, 26, 8,
+ 26, 26, 26, 26, 26, 12, 8, 26, 20, 20,
+ 15, 20, 20, 20, 20, 20, 20, 20, 26, 26,
+ 26, 26, 26, 26, 26, 17, 17, 19, 17, 15,
+ 17, 19, 17, 16, 26, 17, 14, 19, 17, 19,
+ 17, 19, 14, 13, 15, 15, 13, 19, 15, 13,
+ 20, 26, 26, 26, 26, 26, 26, 17, 17, 19,
+ 17, 15, 17, 19, 17, 16, 26, 17, 14, 19,
+ 17, 19, 17, 19, 14, 13, 15, 15, 13, 19,
+ 15, 13, 20, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 15, 26, 26, 21, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 15, 26, 26, 21,
+ 26, 26, 26, 19, 26, 20, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 21, 26, 26, 26, 19,
+ 26, 26, 26, 26, 26, 20, 26, 26, 26, 26,
+ 26, 21, 26, 26, 26, 26, 17, 26, 22, 26,
+ 26, 26, 17, 26, 26, 26, 26, 26, 26, 17,
+ 26, 22, 26, 26, 19, 26, 26, 26, 26, 26,
+ 15, 26, 26, 26, 26, 26, 26, 26, 17, 26,
+ 22, 26, 26, 26, 17, 26, 26, 26, 26, 26,
+ 26, 17, 26, 22, 26, 26, 19, 26, 26, 26,
+ 26, 26, 15, 26, 26, 26};
+
+const int _cTableObjPol[] = {
+ -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, -1, -1,
+ -1, -1, -1, 42, 51, -1, 53, 54, 55, 50,
+ 47, 48, 57, 41, 36, 40, 38, 46, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 39, 37,
+ 58, 49, 59, 44, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 56, -1, -1, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 91, -1, -1, 93, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 91, -1, -1, 93,
+ -1, -1, -1, 88, -1, 85, -1, -1, -1, 67,
+ -1, 60, -1, -1, 66, 92, -1, -1, -1, 88,
+ -1, -1, -1, -1, -1, 85, -1, 61, -1, -1,
+ -1, 92, -1, 69, -1, -1, 70, 71, 86, -1,
+ 72, -1, 87, 73, 75, -1, -1, 76, -1, 89,
+ 78, 90, -1, -1, 79, -1, -1, 81, -1, -1,
+ 82, -1, -1, -1, -1, -1, -1, -1, 70, -1,
+ 86, 63, -1, -1, 87, -1, -1, -1, -1, -1,
+ -1, 89, -1, 90, -1, -1, 79, -1, 62, -1,
+ -1, -1, 82, -1, -1, -1};
+
+const int _lTableObjPol[] = {
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 11, 26, 26, 26, 26, 26, 26, 8,
+ 26, 26, 26, 26, 26, 12, 8, 26, 20, 20,
+ 15, 20, 20, 20, 20, 20, 20, 20, 26, 26,
+ 26, 26, 26, 26, 26, 17, 17, 19, 17, 15,
+ 17, 19, 17, 16, 26, 17, 14, 19, 17, 19,
+ 17, 19, 14, 13, 15, 15, 13, 19, 15, 13,
+ 20, 26, 26, 26, 26, 26, 26, 17, 17, 19,
+ 17, 15, 17, 19, 17, 16, 26, 17, 14, 19,
+ 17, 19, 17, 19, 14, 13, 15, 15, 13, 19,
+ 15, 13, 20, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 15, 26, 26, 21, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 15, 26, 26, 21,
+ 26, 26, 26, 19, 26, 20, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 21, 26, 26, 26, 19,
+ 26, 26, 26, 26, 26, 20, 26, 26, 26, 26,
+ 26, 21, 26, 26, 26, 26, 17, 26, 22, 26,
+ 26, 26, 17, 26, 26, 26, 26, 26, 26, 17,
+ 26, 22, 26, 26, 19, 26, 26, 26, 26, 26,
+ 15, 26, 26, 26, 26, 26, 26, 26, 17, 26,
+ 22, 26, 26, 26, 17, 26, 26, 26, 26, 26,
+ 26, 17, 26, 22, 26, 26, 19, 26, 26, 26,
+ 26, 26, 15, 26, 26, 26};
+
+const int _cTableObjRus[] = {
+ -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, -1, -1,
+ -1, -1, -1, 42, 51, -1, 53, 54, 55, 50,
+ 47, 48, 57, 41, 36, 40, 38, 46, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 39, 37,
+ 58, 49, 59, 44, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 56, -1, -1, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 91, -1, -1, 93, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 91, -1, -1, 93,
+ -1, -1, -1, 88, -1, 85, -1, -1, 100, 67,
+ -1, 60, -1, -1, 66, 92, -1, -1, -1, 88,
+ -1, -1, -1, -1, 100, 85, -1, 61, -1, -1,
+ -1, 92, 94, 95, 96, 97, 98, 99, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 115, 116, 117, 118, 119, 120, 122, 123,
+ 121, 124, 125, 126, 94, 95, 96, 97, 98, 99,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
+ 122, 123, 121, 124, 125, 126};
+
+const int _lTableObjRus[] = {
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 11, 26, 26, 26, 26, 26, 26, 8,
+ 26, 26, 26, 26, 26, 12, 8, 26, 20, 20,
+ 15, 20, 20, 20, 20, 20, 20, 20, 26, 26,
+ 26, 26, 26, 26, 26, 17, 17, 19, 17, 15,
+ 17, 19, 17, 16, 26, 17, 14, 19, 17, 19,
+ 17, 19, 14, 13, 15, 15, 13, 19, 15, 13,
+ 20, 26, 26, 26, 26, 26, 26, 17, 17, 19,
+ 17, 15, 17, 19, 17, 16, 26, 17, 14, 19,
+ 17, 19, 17, 19, 14, 13, 15, 15, 13, 19,
+ 15, 13, 20, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 15, 26, 26, 21, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 15, 26, 26, 21,
+ 26, 26, 26, 19, 26, 20, 26, 26, 18, 26,
+ 26, 26, 26, 26, 26, 21, 26, 26, 26, 19,
+ 26, 26, 26, 26, 18, 20, 26, 26, 26, 26,
+ 26, 21, 18, 18, 18, 17, 16, 18, 20, 18,
+ 18, 18, 18, 16, 18, 15, 22, 15, 18, 22,
+ 19, 16, 21, 20, 16, 16, 19, 22, 19, 19,
+ 18, 15, 18, 18, 18, 18, 18, 17, 16, 18,
+ 20, 18, 18, 18, 18, 16, 18, 15, 22, 15,
+ 18, 22, 19, 16, 21, 20, 16, 16, 19, 22,
+ 19, 19, 18, 15, 18, 18};
+
+const int _cTableObjCze[] = {
+ -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, -1, -1,
+ -1, -1, -1, 42, 51, -1, 53, 54, 55, 50,
+ 47, 48, 57, 41, 36, 40, 38, 46, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 39, 37,
+ 58, 49, 59, 44, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 56, -1, -1, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 128, -1,
+ 91, 137, 131, 93, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 128, -1, 91, 137, 131, 93,
+ -1, -1, -1, 88, -1, 85, -1, -1, -1, 67,
+ -1, 60, -1, -1, 66, 92, -1, -1, -1, 88,
+ -1, -1, -1, -1, -1, 85, -1, 61, -1, -1,
+ -1, 92, -1, 133, -1, -1, 70, 71, 86, -1,
+ 129, 135, 87, 73, 127, 134, -1, 136, -1, 89,
+ 138, 139, -1, -1, 79, -1, 130, 140, 141, -1,
+ 82, 132, -1, -1, -1, 133, -1, -1, 70, -1,
+ 86, 63, 129, 135, 87, -1, 127, 134, -1, 136,
+ -1, 89, 138, 139, -1, -1, 79, -1, 130, 140,
+ 141, -1, 82, 132, -1, -1};
+
+const int _lTableObjCze[] = {
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 11, 26, 26, 26, 26, 26, 26, 8,
+ 26, 26, 26, 26, 26, 12, 8, 26, 20, 20,
+ 15, 20, 20, 20, 20, 20, 20, 20, 26, 26,
+ 26, 26, 26, 26, 26, 17, 17, 19, 17, 15,
+ 17, 19, 17, 16, 26, 17, 14, 19, 17, 19,
+ 17, 19, 14, 13, 15, 15, 13, 19, 15, 13,
+ 20, 26, 26, 26, 26, 26, 26, 17, 17, 19,
+ 17, 15, 17, 19, 17, 16, 26, 17, 14, 19,
+ 17, 19, 17, 19, 14, 13, 15, 15, 13, 19,
+ 15, 13, 20, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 15, 26,
+ 15, 24, 21, 21, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 15, 26, 15, 24, 21, 21,
+ 26, 26, 26, 19, 26, 20, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 21, 26, 26, 26, 19,
+ 26, 26, 26, 26, 26, 20, 26, 26, 26, 26,
+ 26, 21, 26, 18, 26, 26, 17, 26, 22, 26,
+ 22, 17, 17, 26, 17, 19, 26, 23, 26, 17,
+ 17, 22, 26, 26, 19, 26, 18, 16, 16, 26,
+ 15, 16, 26, 26, 26, 18, 26, 26, 17, 26,
+ 22, 26, 22, 17, 17, 26, 17, 19, 26, 23,
+ 26, 17, 17, 22, 26, 26, 19, 26, 18, 16,
+ 16, 26, 15, 16, 26, 26};
+
+const int _cTableObjFra[] = {
+ -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, -1, -1,
+ -1, -1, -1, 42, 51, -1, 53, 54, 55, 50,
+ 47, 48, 57, 41, 36, 40, 38, 46, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 39, 37,
+ 58, 49, 59, 44, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 56, -1, -1, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 91, -1, -1, 93, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 91, -1, -1, 93,
+ -1, -1, -1, 88, -1, 85, -1, -1, -1, 67,
+ -1, 60, -1, -1, 66, 92, -1, -1, -1, 88,
+ -1, -1, -1, -1, -1, 85, -1, 61, -1, -1,
+ -1, 92, -1, 69, -1, -1, 70, 71, 86, -1,
+ 72, -1, 87, 73, 75, -1, -1, 76, -1, 89,
+ 78, 90, -1, -1, 79, -1, -1, 81, -1, -1,
+ 82, -1, -1, -1, 0, 0, 0, -1, 70, -1,
+ 86, 63, 4, 4, 87, -1, 8, 8, 8, -1,
+ -1, 89, 14, 14, 14, -1, 14, -1, 62, 20,
+ -1, 20, 82, -1, -1, -1};
+
+const int _lTableObjFra[] = {
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 11, 26, 26, 26, 26, 26, 26, 8,
+ 26, 26, 26, 26, 26, 12, 8, 26, 20, 20,
+ 15, 20, 20, 20, 20, 20, 20, 20, 26, 26,
+ 26, 26, 26, 26, 26, 17, 17, 19, 17, 15,
+ 17, 19, 17, 16, 26, 17, 14, 19, 17, 19,
+ 17, 19, 14, 13, 15, 15, 13, 19, 15, 13,
+ 20, 26, 26, 26, 26, 26, 26, 17, 17, 19,
+ 17, 15, 17, 19, 17, 16, 26, 17, 14, 19,
+ 17, 19, 17, 19, 14, 13, 15, 15, 13, 19,
+ 15, 13, 20, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 15, 26, 26, 21, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 15, 26, 26, 21,
+ 26, 26, 26, 19, 26, 20, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 21, 26, 26, 26, 19,
+ 26, 26, 26, 26, 26, 20, 26, 26, 26, 26,
+ 26, 21, 26, 26, 26, 26, 17, 26, 22, 26,
+ 26, 26, 17, 26, 26, 26, 26, 26, 26, 17,
+ 26, 22, 26, 26, 19, 26, 26, 26, 26, 26,
+ 15, 26, 26, 26, 17, 17, 17, 26, 17, 26,
+ 22, 26, 15, 15, 17, 26, 16, 16, 16, 26,
+ 26, 17, 19, 19, 19, 26, 19, 26, 26, 15,
+ 26, 15, 15, 26, 26, 26};
+
+const int _cTableObjDeu[] = {
+ -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, -1, -1,
+ -1, -1, -1, 42, 51, -1, 53, 54, 55, 50,
+ 47, 48, 57, 41, 36, 40, 38, 46, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 39, 37,
+ 58, 49, 59, 44, -1, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, -1, -1, -1, 56, -1, -1, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 91, -1, -1, 93, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 91, -1, -1, 93,
+ -1, -1, -1, 88, -1, 85, -1, -1, -1, 67,
+ -1, 60, -1, -1, 66, 92, -1, -1, -1, 88,
+ -1, -1, -1, -1, -1, 85, -1, 61, -1, -1,
+ -1, 92, -1, 69, -1, -1, 70, 71, 86, -1,
+ 72, -1, 87, 73, 75, -1, -1, 76, -1, 89,
+ 78, 90, -1, -1, 79, -1, -1, 81, -1, -1,
+ 82, -1, -1, 142, -1, -1, -1, -1, 70, -1,
+ 86, 63, -1, -1, 87, -1, -1, -1, -1, -1,
+ -1, 89, -1, 90, -1, -1, 79, -1, 62, -1,
+ -1, -1, 82, -1, -1, -1};
+
+const int _lTableObjDeu[] = {
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 11, 26, 26, 26, 26, 26, 26, 8,
+ 26, 26, 26, 26, 26, 12, 8, 26, 20, 20,
+ 15, 20, 20, 20, 20, 20, 20, 20, 26, 26,
+ 26, 26, 26, 26, 26, 17, 17, 19, 17, 15,
+ 17, 19, 17, 16, 26, 17, 14, 19, 17, 19,
+ 17, 19, 14, 13, 15, 15, 13, 19, 15, 13,
+ 20, 26, 26, 26, 26, 26, 26, 17, 17, 19,
+ 17, 15, 17, 19, 17, 16, 26, 17, 14, 19,
+ 17, 19, 17, 19, 14, 13, 15, 15, 13, 19,
+ 15, 13, 20, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 15, 26, 26, 21, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 15, 26, 26, 21,
+ 26, 26, 26, 19, 26, 20, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 21, 26, 26, 26, 19,
+ 26, 26, 26, 26, 26, 20, 26, 26, 26, 26,
+ 26, 21, 26, 26, 26, 26, 17, 26, 22, 26,
+ 26, 26, 17, 26, 26, 26, 26, 26, 26, 17,
+ 26, 22, 26, 26, 19, 26, 26, 26, 26, 26,
+ 15, 26, 26, 24, 26, 26, 26, 26, 17, 26,
+ 22, 26, 26, 26, 17, 26, 26, 26, 26, 26,
+ 26, 17, 26, 22, 26, 26, 19, 26, 26, 26,
+ 26, 26, 15, 26, 26, 26};
+
+#endif
diff --git a/devtools/create_translations/cp_parser.cpp b/devtools/create_translations/cp_parser.cpp
index a4202bf153..f5e4c9d6bb 100644
--- a/devtools/create_translations/cp_parser.cpp
+++ b/devtools/create_translations/cp_parser.cpp
@@ -42,9 +42,11 @@ Codepage *parseCodepageMapping(const std::string &filename) {
size_t start = filename.find_last_of("/\\");
if (start == std::string::npos)
start = 0;
+ else
+ ++start;
// 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));
+ const std::string charset(filename.substr(start, pos != std::string::npos ? (pos - start) : std::string::npos));
std::ifstream in(filename.c_str());
if (!in) {
diff --git a/devtools/create_translations/po_parser.cpp b/devtools/create_translations/po_parser.cpp
index bc49da40d4..e8d7d7a644 100644
--- a/devtools/create_translations/po_parser.cpp
+++ b/devtools/create_translations/po_parser.cpp
@@ -337,47 +337,34 @@ PoMessageEntryList *parsePoFile(const char *file, PoMessageList& messages) {
return list;
}
-char *stripLine(char *line) {
+char *stripLine(char *const line) {
// This function modifies line in place and return it.
// Keep only the text between the first two unprotected quotes.
// It also look for literal special characters (e.g. preceded by '\n', '\\', '\"', '\'', '\t')
// and replace them by the special character so that strcmp() can match them at run time.
// Look for the first quote
- int start = 0;
- int len = strlen(line);
- while (start < len && line[start++] != '"') {}
+ char const *src = line;
+ while (*src != '\0' && *src++ != '"') {}
// shift characters until we reach the end of the string or an unprotected quote
- int i = 0, j = 0;
- while (start + i + j < len && line[start + i + j] != '"') {
- if (line[start + i + j] == '\\') {
- switch (line[start + i + j + 1]) {
- case 'n':
- line[i++] = '\n';
- break;
- case 't':
- line[i++] = '\t';
- break;
- case '\"':
- line[i++] = '\"';
- break;
- case '\'':
- line[i++] = '\'';
- break;
- case '\\':
- line[i++] = '\\';
- break;
+ char *dst = line;
+ while (*src != '\0' && *src != '"') {
+ char c = *src++;
+ if (c == '\\') {
+ switch (c = *src++) {
+ case 'n': c = '\n'; break;
+ case 't': c = '\t'; break;
+ case '\"': c = '\"'; break;
+ case '\'': c = '\''; break;
+ case '\\': c = '\\'; break;
default:
// Just skip
- fprintf(stdout, "Unsupported special character \"%c%c\" in string. Please contact ScummVM developers.\n", line[start + i + j], line[start + i + j + 1]);
- ++j;
+ fprintf(stderr, "Unsupported special character \"\\%c\" in string. Please contact ScummVM developers.\n", c);
+ continue;
}
- ++j;
- } else {
- line[i] = line[start + i + j];
- ++i;
}
+ *dst++ = c;
}
- line[i] = '\0';
+ *dst = '\0';
return line;
}
diff --git a/devtools/credits.pl b/devtools/credits.pl
index 8330450984..e04e35d3be 100755
--- a/devtools/credits.pl
+++ b/devtools/credits.pl
@@ -48,7 +48,7 @@ if ($mode eq "") {
$Text::Wrap::unexpand = 0;
if ($mode eq "TEXT") {
$Text::Wrap::columns = 78;
- $max_name_width = 21; # The maximal width of a name.
+ $max_name_width = 23; # The maximal width of a name.
} elsif ($mode eq "CPP") {
$Text::Wrap::columns = 48; # Approx.
}
@@ -69,6 +69,7 @@ sub html_entities_to_ascii {
# &aring; -> aa
# &amp; -> &
# &#322; -> l
+ # &#347; -> s
# &Scaron; -> S
$text =~ s/&aacute;/a/g;
$text =~ s/&eacute;/e/g;
@@ -76,6 +77,7 @@ sub html_entities_to_ascii {
$text =~ s/&oacute;/o/g;
$text =~ s/&oslash;/o/g;
$text =~ s/&#322;/l/g;
+ $text =~ s/&#347;/s/g;
$text =~ s/&Scaron;/S/g;
$text =~ s/&aring;/aa/g;
@@ -101,6 +103,7 @@ sub html_entities_to_cpp {
$text =~ s/&oacute;/\\363/g;
$text =~ s/&oslash;/\\370/g;
$text =~ s/&#322;/l/g;
+ $text =~ s/&#347;/s/g;
$text =~ s/&Scaron;/S/g;
$text =~ s/&aring;/\\345/g;
@@ -356,6 +359,9 @@ sub add_person {
my $min_name_width = length $desc > 0 ? $max_name_width : 0;
$name = $nick if $name eq "";
$name = html_entities_to_ascii($name);
+ if (length $name > $max_name_width) {
+ print STDERR "Warning: max_name_width is too small (" . $max_name_width . " < " . (length $name) . " for \"" . $name. "\")\n";
+ }
$desc = html_entities_to_ascii($desc);
$tab = " " x ($section_level * 2 + 1);
@@ -550,7 +556,9 @@ begin_credits("Credits");
begin_section("DreamWeb");
add_person("Torbj&ouml;rn Andersson", "eriktorbjorn", "");
add_person("Bertrand Augereau", "Tramb", "");
+ add_person("Filippos Karapetis", "[md5]", "");
add_person("Vladimir Menshakov", "whoozle", "(retired)");
+ add_person("Willem Jan Palenstijn", "wjp", "");
end_section();
begin_section("Gob");
@@ -608,6 +616,10 @@ begin_credits("Credits");
add_person("", "peres", "");
end_section();
+ begin_section("Pegasus");
+ add_person("Matthew Hoops", "clone2727", "");
+ end_section();
+
begin_section("Queen");
add_person("David Eriksson", "twogood", "(retired)");
add_person("Gregory Montoir", "cyx", "(retired)");
@@ -675,6 +687,12 @@ begin_credits("Credits");
add_person("Joost Peters", "joostp", "");
end_section();
+ begin_section("Tony");
+ add_person("Arnaud Boutonn&eacute;", "Strangerke", "");
+ add_person("Paul Gilbert", "dreammaster", "");
+ add_person("Alyssa Milburn", "fuzzie", "");
+ end_section();
+
begin_section("Toon");
add_person("Sylvain Dupont", "SylvainTV", "");
end_section();
@@ -692,6 +710,10 @@ begin_credits("Credits");
add_person("Gregory Montoir", "cyx", "(retired)");
end_section();
+ begin_section("Wintermute");
+ add_person("Einar Johan T. S&oslash;m&aring;en", "somaen", "");
+ end_section();
+
end_section();
@@ -915,6 +937,9 @@ begin_credits("Credits");
begin_persons();
add_person("Thierry Crozat", "criezy", "Translation Lead");
end_persons();
+ begin_section("Basque");
+ add_person("Mikel Iturbe Urretxa", "", "");
+ end_section();
begin_section("Catalan");
add_person("Jordi Vilalta Prat", "jvprat", "");
end_section();
@@ -927,9 +952,12 @@ begin_credits("Credits");
begin_section("French");
add_person("Thierry Crozat", "criezy", "");
end_section();
+ begin_section("Galician");
+ add_person("Santiago G. Sanz", "sgsanz", "");
+ end_section();
begin_section("German");
add_person("Simon Sawatzki", "SimSaw", "");
- add_person("Lothar Serra Mari", "Lothar93", "");
+ add_person("Lothar Serra Mari", "Lothar93", "(retired)");
end_section();
begin_section("Hungarian");
add_person("Alex Bevilacqua", "", "");
@@ -939,10 +967,10 @@ begin_credits("Credits");
add_person("Matteo Angelino", "Maff", "");
end_section();
begin_section("Norwegian (Bokm&aring;l)");
- add_person("Einar Johan T. S&oslash;m&aring;en", "", "");
+ add_person("Einar Johan S&oslash;m&aring;en", "somaen", "");
end_section();
begin_section("Norwegian (Nynorsk)");
- add_person("Einar Johan T. S&oslash;m&aring;en", "", "");
+ add_person("Einar Johan S&oslash;m&aring;en", "somaen", "");
end_section();
begin_section("Polish");
add_person("GrajPoPolsku.pl Team", "", "");
@@ -1056,7 +1084,7 @@ begin_credits("Credits");
# HACK!
- $max_name_width = 16;
+ $max_name_width = 17;
begin_section("Special thanks to");
begin_persons();
@@ -1069,6 +1097,7 @@ begin_credits("Credits");
add_person("Ivan Dubrov", "", "For contributing the initial version of the Gobliiins engine");
add_person("Henrik Engqvist", "qvist", "For generously providing hosting for our buildbot, SVN repository, planet and doxygen sites as well as tons of HD space");
add_person("DOSBox Team", "", "For their awesome OPL2 and OPL3 emulator");
+ add_person("Yusuke Kamiyamane", "", "For contributing some GUI icons ");
add_person("Till Kresslein", "Krest", "For design of modern ScummVM GUI");
add_person("", "Jezar", "For his freeverb filter implementation");
add_person("Jim Leiterman", "", "Various info on his FM-TOWNS/Marty SCUMM ports");
@@ -1079,8 +1108,6 @@ begin_credits("Credits");
add_person("James Woodcock", "", "Soundtrack enhancements");
end_persons();
- add_paragraph("Some icons by Yusuke Kamiyamane");
-
add_paragraph(
"Tony Warriner and everyone at Revolution Software Ltd. for sharing ".
"with us the source of some of their brilliant games, allowing us to ".
@@ -1124,6 +1151,22 @@ begin_credits("Credits");
"Broken Sword 2.5 team for providing sources of their engine and their great ".
"support.");
+ add_paragraph(
+ "Neil Dodwell and David Dew from Creative Reality for providing the source ".
+ "of Dreamweb and for their tremendous support.");
+
+ add_paragraph(
+ "Janusz Wi&#347;niewski and Miroslaw Liminowicz from Laboratorium Komputerowe Avalon ".
+ "for providing full source code for So&#322;tys and letting us redistribute the game.");
+
+ add_paragraph(
+ "Jan Nedoma for providing the sources to the Wintermute-engine, and for his ".
+ "support while porting the engine to ScummVM.");
+
+ add_paragraph(
+ "Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for ".
+ "providing the source code of The Journeyman Project: Pegasus Prime.");
+
end_section();
end_credits();
diff --git a/devtools/module.mk b/devtools/module.mk
index 95eca50d18..1d682cdf05 100644
--- a/devtools/module.mk
+++ b/devtools/module.mk
@@ -56,7 +56,7 @@ credits:
$(srcdir)/devtools/credits.pl --text > $(srcdir)/AUTHORS
# $(srcdir)/devtools/credits.pl --rtf > $(srcdir)/Credits.rtf
$(srcdir)/devtools/credits.pl --cpp > $(srcdir)/gui/credits.h
- $(srcdir)/devtools/credits.pl --xml-website > $(srcdir)/../../web/trunk/data/credits.xml
+ $(srcdir)/devtools/credits.pl --xml-website > $(srcdir)/../scummvm-web/data/credits.xml
# $(srcdir)/devtools/credits.pl --xml-docbook > $(srcdir)/../../docs/trunk/docbook/credits.xml
md5scumm: devtools/md5table$(EXEEXT)
diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt
index e48e99a698..42dcb27d1a 100644
--- a/devtools/scumm-md5.txt
+++ b/devtools/scumm-md5.txt
@@ -148,9 +148,8 @@ indy3 Indiana Jones and the Last Crusade
loom Loom
4dc780f1bc587a193ce8a97652791438 -1 en Amiga EGA EGA - Antti Leimi, Andrea Petrucci
- 39cb9dec16fa16f38d79acd80effb059 -1 fr Amiga EGA EGA same as IT?!? Gerald Vincent
+ 39cb9dec16fa16f38d79acd80effb059 -1 All Amiga EGA EGA IT and FR Gerald Vincent (IT), Andrea Petrucci (FR)
2fe369ad70f52a8cf7ad6077ee64f81a -1 de Amiga EGA EGA - Norbert Lange
- 39cb9dec16fa16f38d79acd80effb059 -1 it Amiga EGA EGA same as FR?!? Andrea Petrucci
48b9f04b348bc5013327753f0d12a144 -1 es Amiga EGA EGA - VooD
a0a7dea72003933b8b3f8b99b9f7ddeb -1 en Atari No AdLib EGA -
0e9b01430e31d9fcd94071d433bbc6bf -1 fr Atari No AdLib EGA -
@@ -541,8 +540,8 @@ freddi3 Freddi Fish 3: The Case of the Stolen Conch Shell
freddi4 Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch
4f580a021eee026f3b4589e17d130d78 -1 All All - - - Kirben, sev
14d48c95b43ddeb983254cf6c43851f1 -1 nl All - - - adutchguy, daniel9
+ 3b832f4a90740bf22e9b8ed42ca0128c -1 gb All HE 99 - - Reckless
d74122362a77ec24525fdd50297dfd82 -1 fr Mac - - - ThierryFR
- 3b832f4a90740bf22e9b8ed42ca0128c -1 gb Windows HE 99 - - Reckless
07b810e37be7489263f7bc7627d4765d -1 ru Windows unenc Unencrypted - sev
a336134914eaab4892d35625aa15ad1d -1 ru Windows HE 99 - - George Kormendi
b5298a5c15ffbe8b381d51ea4e26d35c -1 de All HE 99 - - Joachim Eberhard
@@ -556,7 +555,7 @@ freddi4 Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch
688328c5bdc4c8ec4145688dfa077bf2 -1 de All HE 99 Demo - Joachim Eberhard
03d3b18ee3fd68114e2a687c871e38d5 -1 us Windows HE 99 Mini Game - eriktorbjorn
16effd200aa6b8abe9c569c3e578814d -1 nl All HE 99 Demo - joostp
- 499c958affc394f2a3868f1eb568c3ee -1 nl Windows HE 99 Demo - adutchguy
+ 499c958affc394f2a3868f1eb568c3ee -1 nl All HE 99 Demo - adutchguy
5fdb2ac2483908b065c6e77988338a54 -1 nl Windows HE 99 Demo - Ben
e03ed1474ec14de78359970e0457a820 -1 gb Windows HE 99 Demo - eriktorbjorn
d54622d31255619d207dd245d3f92327 -1 fr Windows HE 99 Demo - Mevi
@@ -576,6 +575,7 @@ maze Freddi Fish and Luther's Maze Madness
4f04b321a95d4315ce6d65f8e1dd0368 -1 us All HE 80 - - Kirben
cd424f143a141bc59226ad83a6e40f51 -1 nl All HE 98.5 - - daniel9, sugarcube
4dbff3787aedcd96b0b325f2d92d7ad9 -1 us All HE 100 Updated - Kirben
+ 4522564b3c31aaf218b6a96826a549fd -1 us Windows HE 99 - - legoking831
water Freddi Fish and Luther's Water Worries
4ba37f835be11a59d969f90f272f575b -1 us All HE 80 - - Kirben
@@ -591,6 +591,7 @@ FreddisFunShop Freddi Fish's One-Stop Fun Shop
catalog Humongous Interactive Catalog
11e6e244078ff09b0f3832e35420e0a7 -1 en Windows - Demo - khalek, sev
037385a953789190298494d92b89b3d0 -1 en Windows HE 72 Demo - khalek, sev
+ f7635a0e2ab82c9a0f9ace5f232a488f -1 en Windows HE 72 Demo - Kirben
a56e8d9d4281c53c3f63c9bd22a59e21 10978342 en All HE CUP Preview George Kormendi
74da3494fbe1a7d20213b0afe0954755 10841544 fr All HE CUP Preview - George Kormendi
4c4820518e16e1a0e3616a3b021a04f3 10927456 de All HE CUP Preview - Kirben
@@ -628,13 +629,13 @@ moonbase Moonbase Commander
pajama Pajama Sam 1: No Need to Hide When It's Dark Outside
672dec94b82f7f0877ebb5b5cf7f4bc1 -1 us All - - - khalek
1d7a2e1ddcade791e2de0cfceac86725 -1 fr All - - - gist974, ThierryFR
- 4fa6870d9bc8c313b65d54b1da5a1891 -1 nl Windows - - - joostp
+ 4fa6870d9bc8c313b65d54b1da5a1891 -1 nl All - - - joostp
a095e33061606d231ff37dca4c64c8ac -1 de All HE 99 - - Joachim Eberhard
898eaa21f79cf8d4f08db856244689ff 66505 en Windows HE 99 Updated - Joachim Eberhard
37aed3f91c1ef959e0bd265f9b13781f -1 us All HE 100 Updated - Kirben
- 782393c5934ecd0b536eaf5fd541bd26 -1 en Windows HE 100 Updated - Jonathan
4aa93cb30e485b728504ba3a693f12bf -1 ru Windows HE 100 - - sev
- c225bec1b6c0798a2b8c89ac226dc793 -1 en Wii HE 100 - - sanguinehearts
+ 782393c5934ecd0b536eaf5fd541bd26 -1 en Windows HE 101 Updated - Jonathan
+ c225bec1b6c0798a2b8c89ac226dc793 -1 en Wii HE 101 - - sanguinehearts
f237bf8a5ef9af78b2a6a4f3901da341 18354 en All - Demo - khalek, sev
7f945525abcd48015adf1632637a44a1 -1 fr All - Demo - Kirben
@@ -645,7 +646,7 @@ pajama Pajama Sam 1: No Need to Hide When It's Dark Outside
pajama2 Pajama Sam 2: Thunder and Lightning Aren't so Frightening
d4e79c3d8645b8266cd78c325bc35154 60557 us All - - - Kirben
6a60d395b78b205c93a956100b1bf5ae -1 de All HE 98.5 - - EdDammer
- 513f91a9dbe8d5490b39e56a3ac5bbdf -1 nl Mac HE 98.5 - - daniel9
+ 513f91a9dbe8d5490b39e56a3ac5bbdf -1 nl All HE 98.5 - - daniel9
55f4e9402bec2bded383843123f37c5c -1 de Windows HE 98.5 - - WindlePoons
e5563c8358443c4352fcddf7402a5e0a -1 fr Windows HE 98.5 - - gist974
c6907d44f1166941d982864cd42cdc89 -1 de All HE 99 - - nachbarnebenan
@@ -776,6 +777,7 @@ puttzoo Putt-Putt Saves the Zoo
f3d55aea441e260e9e9c7d2a187097e0 14337 en Windows - Demo - khalek
65fa23d6884e8ca23d5d2406d70de7e8 -1 fr Windows - Demo - gist974
2a446817ffcabfef8716e0c456ecaf81 -1 de Windows - Demo - Joachim Eberhard
+ 4e859d3ef1e146b41e7d93c35cd6cc62 -1 en iOS HE 100 Lite - clone2727
PuttTime Putt-Putt Travels Through Time
fcb78ebecab2757264c590890c319cc5 -1 nl All HE 85 - - adutchguy, daniel9
@@ -801,7 +803,9 @@ balloon Putt-Putt and Pep's Balloon-O-Rama
bab0fb81dcb12b8930c5d850b8f2a7de 12800 de Windows HE 80 - - George Kormendi
145bd3373574feb668cc2eea2ec6cf86 -1 ru Windows HE 80 - - sev
27b2ef1653089fe5b897d9cc89ce784f -1 ru Windows HE 80 - - George Kormendi
- 2232b0b9411575b1f9961713ebc9de61 -1 es Windows HE 80 - - exiltd
+ 2232b0b9411575b1f9961713ebc9de61 -1 All Windows HE 80 - ES and NL exiltd (ES), Ben Castricum (NL)
+ a22af0ad0e3126d19d22707b0267a37d -1 nl Windows HE 80 - - Ben Castricum
+ a56a05c6b865b9956639f8c51269e5ab -1 nl Mac HE 80 - - Ben Castricum
d7b247c26bf1f01f8f7daf142be84de3 -1 en Windows HE 99 Updated - iziku
8e3241ddd6c8dadf64305e8740d45e13 -1 en All HE 100 Updated - Kirben
@@ -838,7 +842,8 @@ spyfox SPY Fox 1: Dry Cereal
72ac6bc980d5101c2142189d746bd62f -1 ru Windows HE 99 - - sev
3de99ef0523f8ca7958faa3afccd035a -1 us All HE 100 Updated - Kirben
23394c8d29cc63c61313959431a12476 -1 en Windows HE 100 Updated - Jonathan
- 50b831f11b8c4b83784cf81f4dcc69ea -1 en Wii HE 100 - - sanguinehearts
+ 50b831f11b8c4b83784cf81f4dcc69ea -1 en Wii HE 101 - - sanguinehearts
+ 15878e3bee2e1e759184abee98589eaa -1 en iOS HE 100 - - clone2727
53e94115b55dd51d4b8ff0871aa1df1e 20103 en All - Demo - khalek, sev
fbdd947d21e8f5bac6d6f7a316af1c5a 15693 en All - Demo - sev
diff --git a/dists/android/AndroidManifest.xml b/dists/android/AndroidManifest.xml
index e7778fdf61..a3c02474eb 100644
--- a/dists/android/AndroidManifest.xml
+++ b/dists/android/AndroidManifest.xml
@@ -4,7 +4,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.scummvm.scummvm"
android:versionCode="@ANDROID_VERSIONCODE@"
- android:versionName="1.5.0git"
+ android:versionName="1.6.0git"
android:installLocation="preferExternal"
android:sharedUserId="org.scummvm.scummvm">
diff --git a/dists/android/plugin-manifest.xml b/dists/android/plugin-manifest.xml
index 51b39be3b1..7855c330c6 100644
--- a/dists/android/plugin-manifest.xml
+++ b/dists/android/plugin-manifest.xml
@@ -3,7 +3,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.scummvm.scummvm.plugin.@PLUGIN_NAME@"
android:versionCode="@PLUGIN_VERSION_CODE@"
- android:versionName="1.5.0git"
+ android:versionName="1.6.0git"
android:installLocation="preferExternal"
android:sharedUserId="org.scummvm.scummvm">
diff --git a/dists/bada/Res/scummmobile/THEMERC b/dists/bada/Res/scummmobile/THEMERC
index 61fccdb996..1d607086b8 100644
--- a/dists/bada/Res/scummmobile/THEMERC
+++ b/dists/bada/Res/scummmobile/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.3:ScummVM Mobile Theme:No Author]
+[SCUMMVM_STX0.8.9:ScummVM Mobile Theme:No Author]
diff --git a/dists/bada/Res/scummmobile/scummmobile_layout.stx b/dists/bada/Res/scummmobile/scummmobile_layout.stx
index c2fdfc612d..efb8ebc6b5 100644
--- a/dists/bada/Res/scummmobile/scummmobile_layout.stx
+++ b/dists/bada/Res/scummmobile/scummmobile_layout.stx
@@ -621,6 +621,32 @@
</layout>
</dialog>
+ <dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget' shading = 'dim'>
+ <layout type = 'vertical' padding = '16, 16, 16, 16'>
+ <widget name = 'customOption1Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption2Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption3Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption4Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption5Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption6Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption7Checkbox'
+ type = 'Checkbox'
+ />
+ </layout>
+ </dialog>
+
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
<layout type = 'vertical' padding = '16, 16, 16, 16' center = 'true'>
<widget name = 'Logo'
diff --git a/dists/engine-data/README b/dists/engine-data/README
index ce74d590d9..c9c4bd4817 100644
--- a/dists/engine-data/README
+++ b/dists/engine-data/README
@@ -1,6 +1,9 @@
engine-data README
-------------------------------------------------------------------------------
+drascula.dat
+TODO
+
hugo.dat:
This file contains all the hardcoded logic, strings and fonts used by Hugo
engine. Those information were stored in the original executables.
@@ -10,6 +13,9 @@ The 'kyra.dat' file is created by extracting hardcoded data, like the
roomtable, inventory names, various strings, tables for shapes and sequence
scripts, from.
+lure.dat
+TODO
+
queen.tbl:
'queen.tbl' contains a list of filenames, filesizes and offsets for the
individual files saved in QUEEN.1. This data was originally included in the
@@ -20,5 +26,11 @@ mp3/ogg/flac encoded need the datafile.
sky.cpt:
TODO
+teenagent.dat
+TODO
+
+tony.dat:
+This file contains the font table used by the different versions of the game.
+
toon.dat:
'toon.dat' contains all the strings hardcoded in the original executables.
diff --git a/dists/engine-data/drascula.dat b/dists/engine-data/drascula.dat
index 0938ef4a9a..e2b046a527 100644
--- a/dists/engine-data/drascula.dat
+++ b/dists/engine-data/drascula.dat
Binary files differ
diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat
index c89b21cbca..339b85664a 100644
--- a/dists/engine-data/kyra.dat
+++ b/dists/engine-data/kyra.dat
Binary files differ
diff --git a/dists/engine-data/teenagent.dat b/dists/engine-data/teenagent.dat
index 0dd31dad14..1492326920 100644
--- a/dists/engine-data/teenagent.dat
+++ b/dists/engine-data/teenagent.dat
Binary files differ
diff --git a/dists/engine-data/tony.dat b/dists/engine-data/tony.dat
new file mode 100644
index 0000000000..5ea53c6752
--- /dev/null
+++ b/dists/engine-data/tony.dat
Binary files differ
diff --git a/dists/gph/README-GPH b/dists/gph/README-GPH
index 29f0175306..974c2cf266 100644
--- a/dists/gph/README-GPH
+++ b/dists/gph/README-GPH
@@ -1,4 +1,4 @@
-ScummVM 1.5.0git - GPH DEVICE SPECIFIC README
+ScummVM 1.6.0git - GPH DEVICE SPECIFIC README
------------------------------------------------------------------------
diff --git a/dists/gph/scummvm.ini b/dists/gph/scummvm.ini
index 952cd0de24..7d9d85fcc2 100644
--- a/dists/gph/scummvm.ini
+++ b/dists/gph/scummvm.ini
@@ -1,5 +1,5 @@
[info]
-name="ScummVM 1.5.0git"
+name="ScummVM 1.6.0git"
path="/scummvm/scummvm.gpe"
icon="/scummvm/scummvm.png"
title="/scummvm/scummvmb.png"
diff --git a/dists/iphone/Info.plist b/dists/iphone/Info.plist
index e25cee51ea..2f6ba85b00 100644
--- a/dists/iphone/Info.plist
+++ b/dists/iphone/Info.plist
@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.5.0git</string>
+ <string>1.6.0git</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.5.0git</string>
+ <string>1.6.0git</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIconFiles</key>
diff --git a/dists/iphone/scummvm.xcodeproj/project.pbxproj b/dists/iphone/scummvm.xcodeproj/project.pbxproj
index 8f6ba6429d..8f6ba6429d 100755..100644
--- a/dists/iphone/scummvm.xcodeproj/project.pbxproj
+++ b/dists/iphone/scummvm.xcodeproj/project.pbxproj
diff --git a/dists/irix/scummvm.spec b/dists/irix/scummvm.spec
index 2e099d94a8..bbdf31cc2c 100644
--- a/dists/irix/scummvm.spec
+++ b/dists/irix/scummvm.spec
@@ -1,5 +1,5 @@
product scummvm
- id "ScummVM 1.5.0git"
+ id "ScummVM 1.6.0git"
image sw
id "software"
version 18
diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist
index 94adc00a9b..d8c28f6a08 100644
--- a/dists/macosx/Info.plist
+++ b/dists/macosx/Info.plist
@@ -28,7 +28,7 @@
<key>CFBundleExecutable</key>
<string>scummvm</string>
<key>CFBundleGetInfoString</key>
- <string>1.5.0git, Copyright 2001-2012 The ScummVM team</string>
+ <string>1.6.0git, Copyright 2001-2012 The ScummVM team</string>
<key>CFBundleIconFile</key>
<string>scummvm.icns</string>
<key>CFBundleIdentifier</key>
@@ -40,9 +40,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.5.0git</string>
+ <string>1.6.0git</string>
<key>CFBundleVersion</key>
- <string>1.5.0git</string>
+ <string>1.6.0git</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
diff --git a/dists/macosx/scummvm_osx_appcast.xml b/dists/macosx/scummvm_osx_appcast.xml
index 455b062b6b..455b062b6b 100755..100644
--- a/dists/macosx/scummvm_osx_appcast.xml
+++ b/dists/macosx/scummvm_osx_appcast.xml
diff --git a/dists/msvc11/create_msvc11.bat b/dists/msvc11/create_msvc11.bat
new file mode 100644
index 0000000000..b6a5413e3b
--- /dev/null
+++ b/dists/msvc11/create_msvc11.bat
@@ -0,0 +1,95 @@
+@echo off
+
+echo.
+echo Automatic creation of the MSVC11 project files
+echo.
+
+if "%~1"=="/stable" goto stable
+if "%~1"=="/STABLE" goto stable
+if "%~1"=="/all" goto all
+if "%~1"=="/ALL" goto all
+if "%~1"=="/tools" goto tools
+if "%~1"=="/TOOLS" goto tools
+if "%~1"=="/clean" goto clean_check
+if "%~1"=="/CLEAN" goto clean_check
+if "%~1"=="/help" goto command_help
+if "%~1"=="/HELP" goto command_help
+if "%~1"=="/?" goto command_help
+
+if "%~1"=="" goto check_tool
+
+echo Invalid command parameter: %~1
+echo.
+
+:command_help
+echo Valid command parameters are:
+echo stable Generated stable engines project files
+echo all Generate all engines project files
+echo tools Generate project files for the devtools
+echo clean Clean generated project files
+echo help Show help message
+goto done
+
+:check_tool
+if not exist create_project.exe goto no_tool
+
+:question
+echo.
+set batchanswer=S
+set /p batchanswer="Enable stable engines only, or all engines? (S/a)"
+if "%batchanswer%"=="s" goto stable
+if "%batchanswer%"=="S" goto stable
+if "%batchanswer%"=="a" goto all
+if "%batchanswer%"=="A" goto all
+goto question
+
+:no_tool
+echo create_project.exe not found in the current folder.
+echo You need to build it first and copy it in this
+echo folder
+goto done
+
+:all
+echo.
+echo Creating project files with all engines enabled (stable and unstable)
+echo.
+create_project ..\.. --enable-all-engines --msvc --msvc-version 11 --build-events
+goto done
+
+:stable
+echo.
+echo Creating normal project files, with only the stable engines enabled
+echo.
+create_project ..\.. --msvc --msvc-version 11
+goto done
+
+:tools
+echo.
+echo Creating tools project files
+echo.
+create_project ..\.. --tools --msvc --msvc-version 11
+goto done
+
+:clean_check
+echo.
+set cleananswer=N
+set /p cleananswer="This will remove all project files. Are you sure you want to continue? (N/y)"
+if "%cleananswer%"=="n" goto done
+if "%cleananswer%"=="N" goto done
+if "%cleananswer%"=="y" goto clean
+if "%cleananswer%"=="Y" goto clean
+goto clean_check
+
+:clean
+echo.
+echo Removing all project files
+del /Q *.vcxproj* > NUL 2>&1
+del /Q *.props > NUL 2>&1
+del /Q *.sln* > NUL 2>&1
+del /Q scummvm* > NUL 2>&1
+del /Q devtools* > NUL 2>&1
+goto done
+
+:done
+echo.
+pause
diff --git a/dists/msvc11/readme.txt b/dists/msvc11/readme.txt
new file mode 100644
index 0000000000..fa91a8cc12
--- /dev/null
+++ b/dists/msvc11/readme.txt
@@ -0,0 +1,6 @@
+The Visual Studio project files can now be created automatically from the GCC
+files using the create_project tool inside the /devtools/create_project folder.
+
+To create the default project files, build create_project.exe, copy it inside
+this folder and run the create_msvc11.bat file for a default build. You can run
+create_project.exe with no parameters to check the possible command-line options
diff --git a/dists/openpandora/PXML.xml b/dists/openpandora/PXML.xml
index 896210bf01..b759c311ba 100644
--- a/dists/openpandora/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="5" release="0" build="1" type="release"/>
+ <version major="1" minor="6" release="0" build="1" type="release"/>
<!-- Both title and titles are needed -->
- <title lang="en_US">ScummVM 1.5.0git</title>
+ <title lang="en_US">ScummVM 1.6.0git</title>
<titles>
- <title lang="en_US">ScummVM 1.5.0git</title>
+ <title lang="en_US">ScummVM 1.6.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="5" release="0" build="1" type="release"/>
+ <version major="1" minor="6" release="0" build="1" type="release"/>
<!-- Both title and titles are needed -->
<title lang="en_US">ScummVM</title>
<titles>
diff --git a/dists/openpandora/README-OPENPANDORA b/dists/openpandora/README-OPENPANDORA
index b3947975c0..e3c7c9d631 100644
--- a/dists/openpandora/README-OPENPANDORA
+++ b/dists/openpandora/README-OPENPANDORA
@@ -1,4 +1,4 @@
-ScummVM 1.5.0git - OPENPANDORA SPECIFIC README
+ScummVM 1.6.0git - OPENPANDORA SPECIFIC README
------------------------------------------------------------------------
Please refer to the:
diff --git a/dists/openpandora/README-PND.txt b/dists/openpandora/README-PND.txt
index 240936f755..594ad293ed 100644
--- a/dists/openpandora/README-PND.txt
+++ b/dists/openpandora/README-PND.txt
@@ -1,4 +1,4 @@
-ScummVM 1.5.0git - OPENPANDORA README - HOW TO INSTALL
+ScummVM 1.6.0git - OPENPANDORA README - HOW TO INSTALL
------------------------------------------------------------------------
Please refer to the:
diff --git a/dists/openpandora/index.html b/dists/openpandora/index.html
index d7238c1889..5da951546c 100644
--- a/dists/openpandora/index.html
+++ b/dists/openpandora/index.html
@@ -5,7 +5,7 @@
</h3>
<h4>
- <p>ScummVM 1.5.0git: OpenPandora Specific Documentation</p>
+ <p>ScummVM 1.6.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 1.5.0git: General Documentation</p>
+ <p>ScummVM 1.6.0git: General Documentation</p>
</h4>
<A href="http://www.scummvm.org/">ScummVM website</a><br/>
diff --git a/dists/redhat/scummvm-tools.spec b/dists/redhat/scummvm-tools.spec
index 99add8ba85..2f65931a70 100644
--- a/dists/redhat/scummvm-tools.spec
+++ b/dists/redhat/scummvm-tools.spec
@@ -7,7 +7,7 @@
# Prologue information
#------------------------------------------------------------------------------
Name : scummvm-tools
-Version : 1.5.0git
+Version : 1.6.0git
Release : 1
Summary : ScummVM-related tools
Group : Interpreters
diff --git a/dists/redhat/scummvm.spec b/dists/redhat/scummvm.spec
index 2ccccae79d..bd17017fbf 100644
--- a/dists/redhat/scummvm.spec
+++ b/dists/redhat/scummvm.spec
@@ -7,7 +7,7 @@
# Prologue information
#------------------------------------------------------------------------------
Name : scummvm
-Version : 1.5.0git
+Version : 1.6.0git
Release : 1
Summary : Graphic adventure game interpreter
Group : Interpreters
@@ -27,6 +27,7 @@ BuildRequires: flac-devel
BuildRequires: zlib-devel
BuildRequires: nasm
BuildRequires: SDL-devel >= 1.2.2
+BuildRequires: freetype-devel
#------------------------------------------------------------------------------
# Description
@@ -94,7 +95,7 @@ fi
#------------------------------------------------------------------------------
%files
%defattr(0644,root,root,0755)
-%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.BSD COPYRIGHT
+%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.FREEFONT COPYING.BSD COPYRIGHT
%attr(0755,root,root)%{_bindir}/scummvm
%{_datadir}/applications/*
%{_datadir}/pixmaps/scummvm.xpm
diff --git a/dists/redhat/scummvm.spec.in b/dists/redhat/scummvm.spec.in
index 3beef2f960..9dbd8add5b 100644
--- a/dists/redhat/scummvm.spec.in
+++ b/dists/redhat/scummvm.spec.in
@@ -27,6 +27,7 @@ BuildRequires: flac-devel
BuildRequires: zlib-devel
BuildRequires: nasm
BuildRequires: SDL-devel >= 1.2.2
+BuildRequires: freetype-devel
#------------------------------------------------------------------------------
# Description
@@ -94,7 +95,7 @@ fi
#------------------------------------------------------------------------------
%files
%defattr(0644,root,root,0755)
-%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.BSD COPYRIGHT
+%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.FREEFONT COPYING.BSD COPYRIGHT
%attr(0755,root,root)%{_bindir}/scummvm
%{_datadir}/applications/*
%{_datadir}/pixmaps/scummvm.xpm
diff --git a/dists/samsungtv/scummvm.dat b/dists/samsungtv/scummvm.dat
index 19d734467b..57e4b1ca6f 100644
--- a/dists/samsungtv/scummvm.dat
+++ b/dists/samsungtv/scummvm.dat
@@ -14,10 +14,10 @@
0x0031,0x0000,
0x0031,0x0000,
[Vendor]
-0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0067,0x0000,
-0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0067,0x0000,
-0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0067,0x0000,
-0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0067,0x0000,
+0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0072,0x0067,0x0000,
+0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0072,0x0067,0x0000,
+0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0072,0x0067,0x0000,
+0x0073,0x0063,0x0075,0x006d,0x006d,0x0076,0x006d,0x002e,0x006f,0x0072,0x0067,0x0000,
[Release_Date]
0x0000,
0x0000,
@@ -26,16 +26,16 @@
[Description]
0x0049,0x006e,0x0074,0x0065,0x0072,0x0070,0x0072,0x0065,0x0074,0x0065,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x00
73,0x0065,0x0076,0x0065,0x0072,0x0061,0x006C,0x0020,0x0061,0x0064,0x0076,0x0065,0x006E,0x0074,0x0075,0x0072,0x0065,0
-x0020,,0x0067,0x0061,0x006D,0x0065,0x0073,,0x0000,
+x0020,0x0067,0x0061,0x006D,0x0065,0x0073,0x0000,
0x0049,0x006e,0x0074,0x0065,0x0072,0x0070,0x0072,0x0065,0x0074,0x0065,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x00
73,0x0065,0x0076,0x0065,0x0072,0x0061,0x006C,0x0020,0x0061,0x0064,0x0076,0x0065,0x006E,0x0074,0x0075,0x0072,0x0065,0
-x0020,,0x0067,0x0061,0x006D,0x0065,0x0073,,0x0000,
+x0020,0x0067,0x0061,0x006D,0x0065,0x0073,0x0000,
0x0049,0x006e,0x0074,0x0065,0x0072,0x0070,0x0072,0x0065,0x0074,0x0065,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x00
73,0x0065,0x0076,0x0065,0x0072,0x0061,0x006C,0x0020,0x0061,0x0064,0x0076,0x0065,0x006E,0x0074,0x0075,0x0072,0x0065,0
-x0020,,0x0067,0x0061,0x006D,0x0065,0x0073,,0x0000,
+x0020,0x0067,0x0061,0x006D,0x0065,0x0073,0x0000,
0x0049,0x006e,0x0074,0x0065,0x0072,0x0070,0x0072,0x0065,0x0074,0x0065,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x00
73,0x0065,0x0076,0x0065,0x0072,0x0061,0x006C,0x0020,0x0061,0x0064,0x0076,0x0065,0x006E,0x0074,0x0075,0x0072,0x0065,0
-x0020,,0x0067,0x0061,0x006D,0x0065,0x0073,,0x0000,
+x0020,0x0067,0x0061,0x006D,0x0065,0x0073,0x0000,
[JoyStick_Support]
0
[icon_path]
diff --git a/dists/scummvm.6 b/dists/scummvm.6
index b192104684..2075a5c8f5 100644
--- a/dists/scummvm.6
+++ b/dists/scummvm.6
@@ -37,7 +37,7 @@ Output using ALSA sequencer device
.It Em amidi
Use the MorphOS MIDI system, for MorphOS users
.It Em core
-CoreAudio sound, for MacOS X users
+CoreAudio sound, for Mac OS X users
.It Em mt32
MT-32 emulation
.It Em null
diff --git a/dists/scummvm.rc b/dists/scummvm.rc
index e5d28d089a..8527c668c8 100644
--- a/dists/scummvm.rc
+++ b/dists/scummvm.rc
@@ -14,6 +14,7 @@ IDI_COUNT ICON DISCARDABLE "icons/count.ico"
ID_GDF_XML DATA "dists/win32/scummvm.gdf.xml"
+scummclassic.zip FILE "gui/themes/scummclassic.zip"
scummmodern.zip FILE "gui/themes/scummmodern.zip"
#ifdef USE_TRANSLATION
translations.dat FILE "gui/themes/translations.dat"
@@ -43,13 +44,16 @@ teenagent.dat FILE "dists/engine-data/teenagent.dat"
#if ENABLE_TOON == STATIC_PLUGIN
toon.dat FILE "dists/engine-data/toon.dat"
#endif
+#if ENABLE_TONY == STATIC_PLUGIN
+tony.dat FILE "dists/engine-data/tony.dat"
+#endif
#if ENABLE_AGI == STATIC_PLUGIN
pred.dic FILE "dists/pred.dic"
#endif
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,5,0,0
- PRODUCTVERSION 1,5,0,0
+ FILEVERSION 1,6,0,0
+ PRODUCTVERSION 1,6,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
@@ -66,13 +70,13 @@ BEGIN
BEGIN
VALUE "Comments", "Look! A three headed monkey (TM)! .. Nice use of the TM!\0"
VALUE "FileDescription", "http://www.scummvm.org/\0"
- VALUE "FileVersion", "1.5.0git\0"
+ VALUE "FileVersion", "1.6.0git\0"
VALUE "InternalName", "scummvm\0"
VALUE "LegalCopyright", "Copyright © 2001-2012 The ScummVM Team\0"
VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0"
VALUE "OriginalFilename", "scummvm.exe\0"
VALUE "ProductName", "ScummVM\0"
- VALUE "ProductVersion", "1.5.0git\0"
+ VALUE "ProductVersion", "1.6.0git\0"
END
END
diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in
index 6969e0b2a7..a874b98514 100644
--- a/dists/scummvm.rc.in
+++ b/dists/scummvm.rc.in
@@ -14,6 +14,7 @@ IDI_COUNT ICON DISCARDABLE "icons/count.ico"
ID_GDF_XML DATA "dists/win32/scummvm.gdf.xml"
+scummclassic.zip FILE "gui/themes/scummclassic.zip"
scummmodern.zip FILE "gui/themes/scummmodern.zip"
#ifdef USE_TRANSLATION
translations.dat FILE "gui/themes/translations.dat"
diff --git a/dists/slackware/scummvm.SlackBuild b/dists/slackware/scummvm.SlackBuild
index 4ccc2a8995..076a1d20ea 100755
--- a/dists/slackware/scummvm.SlackBuild
+++ b/dists/slackware/scummvm.SlackBuild
@@ -9,7 +9,7 @@ if [ "$TMP" = "" ]; then
fi
PKG=$TMP/package-scummvm
-VERSION=1.5.0git
+VERSION=1.6.0git
ARCH=i486
BUILD=1
diff --git a/dists/wii/meta.xml b/dists/wii/meta.xml
index e843d36e79..5a4c46e144 100644
--- a/dists/wii/meta.xml
+++ b/dists/wii/meta.xml
@@ -2,7 +2,7 @@
<app version="1">
<name>ScummVM</name>
<coder>The ScummVM Team</coder>
- <version>1.5.0git@REVISION@</version>
+ <version>1.6.0git@REVISION@</version>
<release_date>@TIMESTAMP@</release_date>
<short_description>Point &amp; Click Adventures</short_description>
<long_description>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!
diff --git a/dists/win32/ScummVM.iss b/dists/win32/ScummVM.iss
index d0448c5620..adea759110 100644
--- a/dists/win32/ScummVM.iss
+++ b/dists/win32/ScummVM.iss
@@ -45,6 +45,7 @@ Name: {group}\ScummVM; Filename: {app}\scummvm.exe; WorkingDir: {app}; Comment:
Name: {group}\ScummVM (noconsole); Filename: {app}\scummvm.exe; Parameters: "--no-console"; WorkingDir: {app}; Comment: scummvm; Flags: createonlyiffileexists; IconIndex: 0
Name: {group}\Authors; Filename: {app}\AUTHORS.txt; WorkingDir: {app}; Comment: AUTHORS; Flags: createonlyiffileexists
Name: {group}\Copying; Filename: {app}\COPYING.txt; WorkingDir: {app}; Comment: COPYING; Flags: createonlyiffileexists
+Name: {group}\Copying.BSD; Filename: {app}\COPYING.BSD.txt; WorkingDir: {app}; Comment: COPYING.BSD; Flags: createonlyiffileexists
Name: {group}\Copying.FREEFONT; Filename: {app}\COPYING.FREEFONT.txt; WorkingDir: {app}; Comment: COPYING.FREEFONT; Flags: createonlyiffileexists
Name: {group}\Copying.LGPL; Filename: {app}\COPYING.LGPL.txt; WorkingDir: {app}; Comment: COPYING.LGPL; Flags: createonlyiffileexists
Name: {group}\Copyright; Filename: {app}\COPYRIGHT.txt; WorkingDir: {app}; Comment: COPYRIGHT; Flags: createonlyiffileexists
@@ -84,6 +85,7 @@ Name: "{userappdata}\ScummVM\Saved Games"; MinVersion: 0, 1
[Files]
Source: AUTHORS.txt; DestDir: {app}; Flags: ignoreversion
Source: COPYING.txt; DestDir: {app}; Flags: ignoreversion
+Source: COPYING.BSD.txt; DestDir: {app}; Flags: ignoreversion
Source: COPYING.FREEFONT.txt; DestDir: {app}; Flags: ignoreversion
Source: COPYING.LGPL.txt; DestDir: {app}; Flags: ignoreversion
Source: COPYRIGHT.txt; DestDir: {app}; Flags: ignoreversion
@@ -106,18 +108,6 @@ Source: doc/se/LasMig.txt; DestDir: {app}; Flags: ignoreversion isreadme; Langua
Source: README-SDL.txt; DestDir: {app}; Flags: ignoreversion
Source: scummvm.exe; DestDir: {app}; Flags: ignoreversion
Source: SDL.dll; DestDir: {app}
-Source: scummclassic.zip; DestDir: {app}; Flags: ignoreversion
-Source: scummmodern.zip; DestDir: {app}; Flags: ignoreversion
-Source: drascula.dat; DestDir: {app}; Flags: ignoreversion
-Source: hugo.dat; DestDir: {app}; Flags: ignoreversion
-Source: kyra.dat; DestDir: {app}; Flags: ignoreversion
-Source: lure.dat; DestDir: {app}; Flags: ignoreversion
-Source: pred.dic; DestDir: {app}; Flags: ignoreversion
-Source: queen.tbl; DestDir: {app}; Flags: ignoreversion
-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/scummvm.nsi b/dists/win32/scummvm.nsi
index 7ff174befb..795eb660b6 100644
--- a/dists/win32/scummvm.nsi
+++ b/dists/win32/scummvm.nsi
@@ -72,7 +72,7 @@ Name ScummVM
# General Symbol Definitions
#########################################################################################
!define REGKEY "Software\$(^Name)\$(^Name)"
-!define VERSION "1.5.0git"
+!define VERSION "1.6.0git"
!define COMPANY "ScummVM Team"
!define URL "http://scummvm.org/"
!define DESCRIPTION "ScummVM Installer. Look! A three headed monkey (TM)!"
@@ -92,7 +92,7 @@ XPStyle on
#TargetMinimalOS 5.0 ; Minimal version of windows for installer: Windows 2000 or more recent
; (will build unicode installer with NSIS 2.50+)
-VIProductVersion 1.5.0.0
+VIProductVersion 1.6.0.0
VIAddVersionKey ProductName $(^Name)
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
diff --git a/doc/cz/PrectiMe b/doc/cz/PrectiMe
index cb2484299b..153ef09dcd 100644
--- a/doc/cz/PrectiMe
+++ b/doc/cz/PrectiMe
@@ -53,7 +53,9 @@ Obsah:
* 7.7 Podpora MIDI serveru TiMidity++
* 7.8 Použití komprimovaných zvukových souborů (MP3, Ogg Vorbis, Flac)
* 7.9 Výstupní vzorkovací kmitoÄet
-8.0) Soubor s nastavením
+8.0) Soubor s nastavením
+ * 8.1 Rozpoznávaná klíÄová slova nastavení
+ * 8.2 Vlastní herní volby, které mohou být přepínány pomoci grafického rozhraní
9.0) Sestavení
@@ -179,13 +181,18 @@ Hry AGOS od Adventuresoft/Horrorsoft:
The Feeble Files [feeble]
Hry GOB od Coktel Vision:
+ Bambou le sauveur de la jungle [bambou]
Bargon Attack [bargon]
+ Fascination [fascination]
+ Geisha [geisha]
Gobliiins [gob1]
Gobliins 2 [gob2]
Goblins 3 [gob3]
Lost in Time [lostintime]
+ Once Upon A Time: Little Red Riding Hood [littlered]
The Bizarre Adventures of Woodruff
and the Schnibble [woodruff]
+ Urban Runner [urban]
Ween: The Prophecy [ween]
Hry MADE od Activision:
@@ -216,6 +223,7 @@ Další hry:
Hry SCUMM od Humongous Entertainment:
Backyard Baseball [baseball]
Backyard Baseball 2001 [baseball2001]
+ Backyard Baseball 2003 [baseball2003]
Backyard Football [football]
Big Thinkers First Grade [thinker1]
Big Thinkers Kindergarten [thinkerk]
@@ -284,7 +292,6 @@ Hry Living Books:
Následující hry by měly jít spustit, ale zatím nejsou úplně hratelné. Hrajte je pouze na vlastní riziko a prosíme, abyste pro tyto hry nenahlašovali chyby.
Pokud chcete mít nejnovější zprávy o kompatibilitách her, navštivte naší stránku a prohlédněte si tabulku kompatibilit.
- Backyard Baseball 2003 [baseball2003]
Backyard Football 2002 [football2002]
Backyard Soccer [soccer]
Backyard Soccer MLS [soccermls]
@@ -1478,6 +1485,8 @@ Vzorový soubor s nastavením vypadá takto:
path=C:\amiga_mi2\
music_driver=windows
+8.1) Rozpoznávaná klíÄová slova nastavení
+---- ------------------------------------
Jsou rozpoznávána následující klíÄová slova:
path řetězec Cesta, kde jsou umístěny datové soubory hry
@@ -1494,7 +1503,6 @@ Jsou rozpoznávána následující klíÄová slova:
talkspeed Äíslo ZpoždÄ›ní textu v hrách SCUMM, nebo rychlost textu v jiných hrách.
fullscreen boolean Režim celé obrazovky
aspect_ratio boolean Povolit korekci poměru stran
- disable_dithering boolean Odstranit artefakty chvění v některých hrách EGA
gfx_mode řetězec Grafický režim (normální, 2x, 3x, 2xsai, super2xsai, supereagle, advmame2x, advmame3x,hq2x, hq3x, tv2x, dotmatrix)
confirm_exit boolean Zeptat se uživatele na potvrzení pÅ™ed ukonÄením (pouze jádro SDL).
console boolean Povolit okno konzole (výchozí: zapnuto) (pouze Windows).
@@ -1518,6 +1526,16 @@ Jsou rozpoznávána následující klíÄová slova:
alt_intro boolean Použít alternativní úvod pro CD verze Beneath a Steel Sky a Flight of the Amazon Queen
boot_param Äíslo PÅ™edá toto Äíslo zavádÄ›címu skriptu
+Hry Sierra používající jádro AGI pÅ™idávají následující nestandardní klíÄové slovo:
+
+originalsaveload boolean Pokud true, jsou použity původní obrazovky nahrávání/uložení místo vylepšených ze ScummVM
+
+Hry Sierra používající jádro SCI pÅ™idávají následující nestandardní klíÄová slova:
+
+ disable_dithering boolean Odstranit artefakty chvění v některých hrách EGA
+ prefer_digitalsfx boolean Pokud true, jsou upřednostňovány digitální zvukové efekty před syntetizovanými
+ originalsaveload boolean Pokud true, jsou použity původní obrazovky nahrávání/uložení místo vylepšených ze ScummVM
+ native_fb01 bool Pokud true, je ovladaÄ hudby pro kartu IBM Music Feature nebo modul syntetizátoru Yahama FB-01 FM použit jako výstup MIDI
Broken Sword II pÅ™idává následující nestandardní klíÄová slova:
gfx_details Äíslo Nastavení grafických detailů (0-3)
@@ -1526,15 +1544,28 @@ Broken Sword II pÅ™idává následující nestandardní klíÄová slova:
reverse_stereo boolean Pokud true, kanály stereo jsou obráceny
sfx_mute boolean Pokud true, zvukové efekty jsou ztlumeny
-Flight of the Amazon Queen pÅ™idává následující nestandardní klíÄová slova
+Flight of the Amazon Queen pÅ™idává následující nestandardní klíÄová slova:
music_mute boolean Pokud true, hudba je ztlumena
sfx_mute boolean Pokud true, zvukové efekty jsou ztlumeny
-King's Quest VI Windows pÅ™idává následující nestandardní klíÄová slova:
+Jones in the Fast Lane pÅ™idává následující nestandardní klíÄové slovo:
+
+ music_mute boolean Pokud true, je použito CD audio místo zvuků ve hře
+
+King's Quest VI Windows pÅ™idává následující nestandardní klíÄové slovo:
windows_cursors boolean Pokud true, jsou použity původní Äernobílé kurzory místo kurzorů z DOS. Pokud false, jsou ve verzi Windows použity kurzory DOS, zvÄ›tÅ¡ené, aby se shodovaly se zbytkem zvÄ›tÅ¡ené grafiky
+
+Lands of Lore: The Throne of Chaos pÅ™idává následující nestandardní klíÄová slova:
+
+ smooth_scrolling boolean Pokud true, je posunování při změně z jedné obrazovky na druhou plynulejší
+ floating_cursors boolean Pokud true, je kurzor zmÄ›nÄ›n na smÄ›rovou Å¡ipku pÅ™i najetí na okraj obrazovky. HrÃ¡Ä pak může kliknout pro pohyb v tomto smÄ›ru.
+
+Space Quest IV CD pÅ™idává následující nestandardní klíÄové slovo:
+ silver_cursors boolean Pokud true, je místo původních zlatých kurzorů použita alternativní sada stříbrných
+
Simon the Sorcerer 1 a 2 pÅ™idává následující nestandardní klíÄová slova:
music_mute boolean Pokud true, hudba je ztlumena
@@ -1544,10 +1575,23 @@ The Legend of Kyrandia pÅ™idává následující nestandardní klíÄové slovo:
walkspeed celé Äíslo Rychlost chůze (0-4)
+The Legend of Kyrandia: Malcolm's Revenge pÅ™idává následující nestandardní klíÄová slova:
+
+ studio_audience boolean Pokud true, je slyšet potlesk a smích kdykoliv Malcolm provede něco vtipného
+ skip_support boolean Pokud true, hrÃ¡Ä může pÅ™eskakovat text a scény hry
+ helium_mode boolean Pokud true, lidé znějí tak, jakoby se nadýchali hélia
+
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)
+8.2) Vlastní herní volby, které mohou být přepínány pomoci grafického
+---- ----------------------------------------------------------------
+rozhraní
+--------
+Mnoho vlastních herních voleb v pÅ™edchozí Äásti může být pÅ™epnuto pÅ™es grafické rozhraní. Pokud je takováto volba pro urÄitou hru dostupná, objeví se karta "Jádro" pÅ™i pÅ™idávání nebo úpravÄ› nastavení této hry.
+Pokud vlastní možnosti nejsou zobrazeny, musí být konkrétní hry spuÅ¡tÄ›ny jednou nebo znovu pÅ™idány do seznamu her spouÅ¡tÄ›Äe ScummVM. Toto aktualizuje nastavení každé položky, Äímž umožní zobrazení vlastních voleb.
+
9.0) Sestavení:
---- ----------
Pro aktuální přehled o tom, jak ScummVM sestavit pro různé platformy, prohlédněte si, prosím, naší Wiki, zvláště tuto stránku:
@@ -1620,3 +1664,4 @@ http://www.scummvm.org/
------------------------------------------------------------------------
+
diff --git a/doc/da/HurtigStart b/doc/da/HurtigStart
new file mode 100644
index 0000000000..b54590bba3
--- /dev/null
+++ b/doc/da/HurtigStart
@@ -0,0 +1,151 @@
+Dette dokument er en delvis oversættelse af den engelske README filen.
+Det originale dokument har meget mere information, så hvis du ikke kan
+finde det du har brug for her og kan forstå en smule engelsk, så prøv
+at se i den Engelske README-fil.
+
+For mere information, kompatibilitet lister, detaljer om donering, den
+seneste udgivelse, statusrapporter og mere, kan du besøge ScummVMs hjemme-
+side på: http://www.scummvm.org/
+
+Indholdsfortegnelse:
+--------------------
+1.0) Indledning
+ * 1.1 Om ScummVM
+ * 1.2 Hurtig start
+2.0) Kontakt
+ * 2.1 Rapportering af fejl
+
+1.0) Indledning:
+---- -----------
+
+1.1) Om ScummVM:
+---- -----------
+ScummVM er et program, som tillader dig at køre visse klassiske grafiske
+peg-og-klik eventyr spil, hvis du allerede har deres data filer. Den
+smarte del omkring dette: ScummVM erstatter bare de eksekverbare filer
+der fulgte med i spillet, så du kan afspille dem på systemer, hvor de
+aldrig var designet til!
+
+Oprindeligt var det designet til at køre LucasArts' SCUMM spil, såsom
+Maniac Mansion, Monkey Island, Day of the Tentacle eller Sam and Max.
+SCUMM står for 'Script Creation Utility for Maniac Mansion', som var det
+første spil som LucasArts designede dette system til. Og langt senere gav
+navn til ScummVM ('VM', betyder Virtuel Maskine).
+
+Efterhånden er understøttelse for en masse ikke-SCUMM spil blevet tilføjet,
+og ScummVM understøtter nu også mange af Sierras AGI og SCI-spil (såsom
+Kings Quest 1-6, Space Quest 1-5, ...), Discworld 1 og 2, Simon the Sorcerer
+1 og 2, Beneath A Steel Sky, Lure of the Temptress, Broken Sword I og II,
+Flight of the Amazon Queen, Gobliiins 1-3, The Legend of Kyrandia serien,
+mange af Humongous Entertainments børne SCUMM spil (herunder Freddi Fish
+and Putt Putt spil) og mange flere. Du kan finde en komplet liste med
+oplysninger om, hvilke eventyr der understøttes og hvor godt, på
+kompatibilitetssiden. ScummVM forbedres løbende, så vend ofte tilbage.
+
+Blandt de systemer, som du kan spille disse spil på er regulære desktop
+computere (Windows, Linux, Mac OS X, ...), spillekonsoller (Dreamcast,
+Nintendo DS og Wii, PS2, PSP, ...), smartphones (Android, iPhone, PocketPC,
+Symbian ...) og flere.
+
+På dette tidspunkt er ScummVM stadig under kraftig udvikling. Vær opmærksom
+på, at selvom vi forsøger at sørge for, at mange spil kan gennemføres med få
+store fejl, kan nedbrud ske, og vi tilbyder ingen garanti. NÃ¥r det er sagt,
+er nogle af spillene blevet understøttet i lang tid og bør fungerer fint
+med alle nyere stabile udgaver. Du kan få en fornemmelse af, hvor godt
+hvert spil virker i ScummVM, ved at kigge på kompatibilitetssiden. Faktisk,
+hvis du søger lidt rundt, vil du måske opdage, at ScummVM endog anvendes
+kommercielt til genudgivelse af nogle af understøttede spil på moderne
+platforme. Dette viser, at flere virksomheder er tilfredse med kvaliteten
+af ​​programmet, og hvor godt det kan køre nogle af spillene.
+
+Hvis du har fornøjelse af ScummVM, er du velkommen til at donere ved hjælp
+af PayPal-knappen på ScummVM's hjemmeside. Dette vil hjælpe os med at købe
+værktøjer nødvendige for at udvikle ScummVM nemmere og hurtigere. Hvis du
+ikke kan donere, hjælp og bidrage med en programrettelse!
+
+1.2) Hurtig start:
+---- ------------
+VIGTIGT: Denne korte vejledning antager, at du bruger ScummVM på dansk.
+Som standard vil ScummVM bruge dit operativsystem sprog. Hvis du
+foretrækker at bruge ScummVM på engelsk, kan du også foretrække at
+følge vejledning fra den engelske README fil.
+
+For de utålmodige blandt jer, er her hvordan du får ScummVM op at køre
+i fem enkle trin.
+
+1. Hent ScummVM fra <http://www.scummvm.org/downloads.php> og
+installere det.
+
+2. Opret en mappe på din harddisk og kopiere spillets datafiler fra de
+oprindelige medier til denne mappe. Gentag dette for hvert spil du
+ønsker at spille (det er bedre at bruge en separat mappe til hvert spil).
+
+3. Start ScummVM.
+
+Hvis ScummVM på dette tidspunkt vises på engelsk i stedet for dansk, gør
+som følger for at ændre sprog:
+ - Klik på 'Options'.
+ - Klik på højre pil i fanebjælken og vælg 'Misc' fanen.
+ - Vælg "Dansk" i "GUI Language'og klik på 'OK'.
+ - Bekræft meddelelsen boksen, der popper op, klik på 'Quit' for at
+ afslutte ScummVM og derefter genstarte programmet.
+
+Vælg nu 'Tilføj spil', vælge mappen med spillets datafiler (forsøg ikke
+at vælge datafilerne selv!) Og tryk på 'Vælg'
+
+4. En dialog skulle komme op, hvor du kan konfigurere forskellige
+indstillinger, hvis du ønsker det (det burde dog være fint at lade alt
+forblive på sin standard). Bekræft dialogen.
+
+5. Vælg det spil, du ønsker at spille på listen, og tryk på 'Start'.
+
+ScummVM husker de spil, du tilføjer. Så hvis du lukker ScummVM, vil
+listen over spil næste gang du starter den, indeholde alle de spil du
+tidligere har tilføjet. Du kan derfor gå direkte til trin 5, medmindre
+du ønsker at tilføje flere spil.
+
+Tip: Hvis du ønsker at tilføje flere spil på én gang, så prøv at trykke
+og holde shift-tasten nede før du klikker på 'Tilføj spil' - teksten vil
+skifte til 'Tilføj flere', og hvis du trykker på den, bliver du igen bedt
+om at vælge en mappe, men denne gang vil ScummVM søge gennem alle
+undermapper for understøttede spil.
+
+2.0) Kontakt:
+---- --------
+Den nemmeste måde at kontakte ScummVM holdet på er ved at sende fejlrapporter
+(se afsnit 2.1) eller ved at bruge vores fora på http://forums.scummvm.org.
+Du kan også deltage og e-maile til scummvm-devel postlisten, eller chatte
+med os på IRC (#scummvm på irc.freenode.net). Bed os venligst ikke om at
+understøtte et ikke-understøttet spil -- læs FAQ på vores hjemmeside først.
+Bemærk, at det officielle sprog i dette forum, mailing liste og chat er
+engelsk og ingen andre sprog bør anvendes.
+
+2.1) Rapportering af fejl:
+---- ---------------------
+For at rapportere en fejl, skal du oprette en SourceForge konto, og følge
+"Bug Tracker" linket fra vores hjemmeside. Sørg for at fejlen er reproducerbare,
+og stadig forekommer i den seneste git/Daglig byggede version.
+Kontroller også listen med kendte problemer (nedenfor) og kompatibilitetslisten
+på vores hjemmeside for spillet, for at sikre, at problemet ikke allerede er kendt:
+
+ http://www.scummvm.org/compatibility_stable.php
+
+Vær venlig ikke at rapportere fejl på spil, der ikke er anført som værende
+mulige at gennemføre i 'understøttede spil' sektionen, eller kompatibilitetslisten.
+Vi -ved- disse spil har fejl.
+
+Inkluder venligst følgende oplysninger:
+ - ScummVM version (VENLIGST test på den nyeste git/Daglig byggede)
+ - Detaljer om fejlen, herunder oplysninger om genskabelsen af fejlen
+ - Sprog i spillet (engelsk, tysk, ...)
+ - Version af spillet (talkie, diskette, ...)
+ - Platform og Kompiler (Win32, Linux, FreeBSD, ...)
+ - Medsend et gemt spil hvis det er muligt
+ - Hvis fejlen kun skete for nylig, notér venligst den sidste version
+ uden fejl, og den første version med fejlen. På denne måde kan vi
+ ordne det hurtigere ved at kigge på de foretagne ændringer.
+
+Endelig, bedes du rapportere hvert problem separat; indsend ikke flere
+problemer på samme billet. (Ellers bliver det svært at spore status for
+hver enkelt fejl). Husk også på, at alle fejlrapporter skal skrives på
+engelsk. \ No newline at end of file
diff --git a/doc/de/Liesmich b/doc/de/Liesmich
index 5d24ec050b..88b6ce6de8 100644
--- a/doc/de/Liesmich
+++ b/doc/de/Liesmich
@@ -56,6 +56,8 @@ Inhaltsverzeichnis:
* 7.8 Komprimierte Audio-Dateien verwenden (MP3, Ogg Vorbis, FLAC)
* 7.9 Ausgabefrequenzen
8.0) Konfigurationsdatei
+ * 8.1 Verwendbare Konfigurationsschlüsselwörter
+ * 8.2 Spielspezifische Optionen bei der grafischen Benutzeroberfläche
9.0) Kompilierung
@@ -273,11 +275,16 @@ AGOS-Spiele von Adventuresoft/Horrorsoft:
Floyd - Es gibt noch Helden [feeble]
GOB-Spiele von Coktel Vision:
+ Bambou le sauveur de la jungle [bambou]
Bargon Attack [bargon]
+ Fascination [fascination]
+ Geisha [geisha]
Gobliiins [gob1]
Gobliins 2 [gob2]
Goblins 3 [gob3]
Lost in Time [lostintime]
+ Once Upon A Time: Little Red Riding Hood [littlered]
+ Urban Runner [urban]
Woodruff and the Schnibble of Azimuth [woodruff]
Ween: The Prophecy [ween]
@@ -310,6 +317,7 @@ Andere Spiele:
SCUMM-Spiele von Humongous Entertainment:
Backyard Baseball [baseball]
Backyard Baseball 2001 [baseball2001]
+ Backyard Baseball 2003 [baseball2003]
Backyard Football [football]
Big Thinkers First Grade [thinker1]
Big Thinkers Kindergarten [thinkerk]
@@ -378,7 +386,6 @@ Wenn Sie über den neusten Stand bezüglich der Kompatibilität des Spiels erfah
möchten, besuchen Sie unsere Website und schauen Sie in der Kompatibilitätsliste
nach.
- Backyard Baseball 2003 [baseball2003]
Backyard Football 2002 [football2002]
Backyard Soccer [soccer]
Backyard Soccer MLS [soccermls]
@@ -558,6 +565,15 @@ Zwischensequenzen, aber diese sind von niedrigerer Qualität.) Sie können sie
auch in einem Unterverzeichnis namens „video“ ablegen, wenn Ihnen das lieber
ist.
+Bei PlayStation-Versionen können Sie die Original-Videos von CD ausgeben lassen.
+Alle Dateien mit der Endung „STR“ sollten als Raw-Sektoren von der CD ausgelesen
+werden (alle 2352 Bytes pro Sektor). Sie können stattdessen auch die weiter
+unten erwähnten umgewandelten Zwischensequenzen verwenden, aber dies
+funktioniert nicht bei allen Videos in Baphomets Fluch II. Weitere Informationen
+finden Sie hier:
+
+ http://wiki.scummvm.org/index.php/HOWTO-PlayStation_Videos
+
Einige Neuausgaben der Spiele, wie beispielsweise die PlayStation-Version, haben
keine Smacker-Videos. Revolution Software hat uns freundlicherweise erlaubt, die
Zwischensequenzen umgewandelt auf unserer Website als Download zur Verfügung zu
@@ -577,9 +593,11 @@ Ogg-Vorbis-Audio angeboten. Um diese Zwischensequenzen mit Ogg-Vorbis-Audio
abspielen zu können, ist eine Version von ScummVM erforderlich, die sowohl mit
Unterstützung von libVorbis als auch zlib kompiliert wurde.
-Für Baphomets Fluch bieten wir auch ein Untertitel-Paket an. Entpacken Sie es
-einfach und folgen Sie den Anweisungen in der liesmich.txt. (Baphomets Fluch II
-hat bereits Untertitel; für diese ist keine zusätzliche Arbeit notwendig.)
+Für Baphomets Fluch bieten wir außerdem ein Untertitelpaket an. Entpacken Sie es
+einfach und folgen Sie den Anweisungen in der liesmich.txt. Das Untertitelpaket
+funktioniert momentan nicht bei der Verwendung von PlayStation-Videos.
+(Baphomets Fluch II hat bereits Untertitel; für diese ist keine zusätzliche
+Arbeit notwendig.)
3.7.2) Zwischensequenzen von Baphomets Fluch I und II im Rückblick:
@@ -800,11 +818,11 @@ originale EXE-Datei des Spiels (mickey.exe) sowie die Spieldateien.
Für das Spiel gibt es unter ScummVM umfangreiche Mausunterstützung, obwohl es im
Originalspiel überhaupt keine Mausunterstützung gab. Menüpunkte können mit der
-Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orten zu
-wechseln. Wenn die Maus über die Kanten des Bildschirms bewegt wird, ändert sich
+Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orte zu
+wechseln. Wenn die Maus über den Rand des Bildschirms bewegt wird, ändert sich
die Farbe des Zeigers in Rot, wenn es möglich ist, in diese Richtung zu gehen.
-Der Spieler kann dann einfach auf die Kanten des Spielbildschirms klicken, um
-den Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel
+Der Spieler kann dann einfach auf den Rand des Spielbildschirms klicken, um den
+Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel
unkomplizierter ist, als sich mit dem Menü umherzubewegen.
@@ -815,11 +833,11 @@ importieren.
Für das Spiel gibt es unter ScummVM umfangreiche Mausunterstützung, obwohl es im
Originalspiel überhaupt keine Mausunterstützung gab. Menüpunkte können mit der
-Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orten zu
-wechseln. Wenn die Maus über die Kanten des Bildschirms bewegt wird, ändert sich
+Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orte zu
+wechseln. Wenn die Maus über den Rand des Bildschirms bewegt wird, ändert sich
die Farbe des Zeigers in Rot, wenn es möglich ist, in diese Richtung zu gehen.
-Der Spieler kann dann einfach auf die Kanten des Spielbildschirms klicken, um
-den Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel
+Der Spieler kann dann einfach auf den Rand des Spielbildschirms klicken, um den
+Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel
unkomplizierter ist, als sich mit dem Menü umherzubewegen.
@@ -903,7 +921,7 @@ Kompatibilitätsseite der Website aufgeführt ist, sehen Sie bitte im Abschnitt
- Sprache und Untertitel zusammen führen manchmal dazu, dass die
Sprachausgabe vorzeitig abgeschnitten wird. Dies ist eine Beschränkung des
Originalspiels.
- - Nur die Standardsprache (Englisch) der Spieldaten wird bei den Amiga- und
+ - Nur die Standard-Sprache (Englisch) der Spieldaten wird bei den Amiga- und
Macintosh-Versionen unterstützt.
Simon the Sorcerer's Game Pack:
@@ -1044,7 +1062,7 @@ gestartet werden -- siehe nächster Abschnitt.
--debugflags=FLAGGEN Aktiviert für Engine spezifische Debug-Flaggen
(getrennt durch Kommas).
-u, --dump-scripts Aktiviert die Skriptausgabe, wenn ein Verzeichnis
- namens 'dumps' im aktuellen Verzeichnis existiert.
+ namens „dumps“ im aktuellen Verzeichnis existiert.
--cdrom=ZAHL CD-Laufwerk, von dem CD-Titel wiedergegeben werden
sollen (Standard: 0 = erstes Laufwerk)
@@ -1436,7 +1454,7 @@ Spielstände werden bei einigen Plattformen standardmäßig im aktuellen
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:
+Die folgenden Plattformen haben ein anderes Standard-Verzeichnis:
Mac OS X:
$HOME/Documents/ScummVM Savegames/
@@ -1454,6 +1472,11 @@ Die folgenden Plattformen haben ein anderes Standardverzeichnis:
<Windows-Verzeichnis>\Profiles\Benutzername\
Application Data\ScummVM\Saved games\
+Hinweis für Anwender von Windows NT4/2000/XP/Vista/7: Das Standard-Verzeichnis
+für Spielstände wurde bei ScummVM 1.5.0 geändert. Die Stapelverarbeitungsdatei
+migration.bat kann verwendet werden, um die Spielstände vom alten
+Standard-Verzeichnis in das neue zu kopieren.
+
6.1) Automatische Spielstände:
---- -------------------------
@@ -1797,7 +1820,7 @@ SoundFonts):
fluidsynth -m alsa_seq /Pfad/zu/8mbgmsfx.sf2
Wenn einmal TiMidity oder FluidSynth laufen, verwenden Sie den Befehl
-„aconnect -o -l“, der bereits in diesem Abschnitt beschrieben wurde.
+„aconnect -o -lâ€, der bereits in diesem Abschnitt beschrieben wurde.
7.6.2) Sound-Wiedergabe mittels IRIX-dmedia-Sequenzer: [NUR IN UNIX]
@@ -1839,7 +1862,7 @@ Dienstprogramm):
Nun können Sie ScummVM starten und TiMidity für Musikausgabe auswählen.
Standardmäßig wird das Programm mit dem localhost:7777 verbunden, aber Sie
-können Host und Port über die Umgebungsvariable „TIMIDITY_HOST“ ändern. Sie
+können Host und Port über die Umgebungsvariable „TIMIDITY_HOST†ändern. Sie
können auch eine „Gerätenummer“ über die Umgebungsvariable „SCUMMVM_MIDIPORT“
festlegen.
@@ -2117,10 +2140,13 @@ Eine beispielhafte Konfigurationsdatei sieht wie folgt aus:
path=C:\amiga_mi2\
music_driver=windows
-Erklärung zu nachfolgender Liste: In der nachfolgenden Liste mit
-Schlüsselwörtern werden rechts das Schlüsselwort, in der Mitte der Typ der
-erwarteten Zuweisung und rechts die Erklärung angezeigt. Der Typ „Bool“ bedeutet
-Wahrheitswert. Er kann entweder „true“ (wahr) oder „false“ (falsch) sein.
+
+8.1) Verwendbare Konfigurationsschlüsselwörter
+---- -----------------------------------------
+In der nachfolgenden Liste mit Schlüsselwörtern für die Konfigurationsdatei
+werden rechts das Schlüsselwort, in der Mitte der Typ der erwarteten Zuweisung
+und rechts die Erklärung angezeigt. Der Typ „Bool“ bedeutet Wahrheitswert. Er
+kann entweder „true“ (wahr) oder „false“ (falsch) sein.
Die folgenden Schlüsselwörter werden erkannt:
@@ -2149,8 +2175,6 @@ Die folgenden Schlüsselwörter werden erkannt:
fullscreen Bool Vollbildmodus
aspect_ratio Bool Seitenverhältniskorrektur
- disable_dithering Bool Entfernung von Fehlerdiffusionsartefakten in
- EGA-Spielen
gfx_mode Text Grafikmodus (normal, 2x, 3x, 2xsai,
super2xsai, supereagle, advmame2x, advmame3x,
hq2x, hq3x, tv2x, dotmatrix)
@@ -2198,6 +2222,28 @@ Die folgenden Schlüsselwörter werden erkannt:
boot_param Zahl Ruft Boot-Skript mit dieser Nummer auf.
+Sierra-Spiele, welche die AGI-Engine verwenden, verfügen zusätzlich über
+folgendes nicht standardmäßiges Schlüsselwort:
+
+ originalsaveload Bool Falls „true“, werden die originalen Menüs zum
+ Speichern und Laden statt der
+ erweiterten von ScummVM verwendet.
+
+Sierra-Spiele, welche die SCI-Engine verwenden, verfügen zusätzlich über
+folgende nicht standardmäßige Schlüsselwörter:
+
+ disable_dithering Bool Entfernung von Fehlerdiffusionsartefakten in
+ EGA-Spielen
+ prefer_digitalsfx Bool Falls „true“, werden digitale Sound-Effekte
+ statt synthetisierter bevorzugt.
+ originalsaveload Bool Falls „true“, werden die originalen Menüs zum
+ Speichern und Laden statt der
+ erweiterten von ScummVM verwendet.
+ native_fb01 Bool Falls „true“, wird für die MIDI-Ausgabe
+ der Musiktreiber für eine Music-Feature-Karte
+ von IBM oder für ein Yamaha-FB-01-FM-
+ Synthetisierungsmodul verwendet.
+
Baphomets Fluch II verfügt zusätzlich über folgende nicht standardmäßige
Schlüsselwörter:
@@ -2213,6 +2259,12 @@ Schlüsselwörter:
music_mute Bool Falls „true“, wird Musik unterdrückt.
sfx_mute Bool Falls „true“, werden Geräusche unterdrückt.
+Jones in the Fast Lane verfügt zusätzlich über folgendes nicht standardmäßiges
+Schlüsselwort:
+
+ music_mute Bool Falls „true“, wird - sofern verfügbar - CD-Ton
+ anstatt des Tons im Spiel verwendet.
+
Die Windows-Version von King's Quest VI verfügt zusätzlich über folgendes nicht
standardmäßiges Schlüsselwort:
@@ -2223,6 +2275,25 @@ standardmäßiges Schlüsselwort:
verwendet - hochskaliert, um zum Rest der
hochskalierten Grafiken zu passen.
+Lands of Lore: The Throne of Chaos verfügt zusätzlich über folgende nicht
+standardmäßige Schlüsselwörter:
+
+ smooth_scrolling Bool Falls „true“, ist das Scrollen gleichmäßiger,
+ wenn man von einem Bildschirm zum anderen
+ wechselt.
+ floating_cursors Bool Falls „true“, verwandelt sich der Mauszeiger in
+ einen Richtungspfeil, wenn er über den
+ Bildschirmrand bewegt wird. Durch einen
+ Mausklick kann der Spieler dann in diese
+ Richtung gehen.
+
+Die CD-Version von Space Quest IV verfügt zusätzlich über folgendes nicht
+standardmäßiges Schlüsselwort:
+
+ silver_cursors Bool Falls „true“, wird ein alternativer Satz
+ silberner Mauszeiger verwendet anstatt der
+ originalen goldenen.
+
Simon the Sorcerer 1 und 2 verfügen zusätzlich über folgende nicht
standardmäßige Schlüsselwörter:
@@ -2234,6 +2305,16 @@ Schlüsselwort:
walkspeed Zahl Bewegungsgeschwindigkeit (0-4)
+The Legend of Kyrandia: Malcolm's Revenge verfügt zusätzlich über folgende nicht
+standardmäßige Schlüsselwörter:
+
+ studio_audience Bool Falls „true“, hört man stets Applaus- und
+ Jubelgeräusche, wenn Malcolm einen Scherz macht.
+ skip_support Bool Falls „true“, kann der Spieler Textteile und
+ Zwischensequenzen überspringen.
+ helium_mode Bool Falls „true“, klingen alle Spielfiguren so,
+ als hätten sie Helium eingeatmet.
+
The 7th Guest verfügt zusätzlich über folgendes nicht standardmäßiges
Schlüsselwort:
@@ -2242,6 +2323,18 @@ Schlüsselwort:
im_an_ios [ich bin ein iOS])
+8.2) Spielspezifische Optionen bei der grafischen Benutzeroberfläche
+---- ---------------------------------------------------------------
+Viele spielspezifische Optionen, die im vorigen Abschnitt aufgeführt wurden,
+können über die grafische Benutzeroberfläche angesprochen werden. Falls eine
+spielspezifische Option für ein bestimmtes Spiel verfügbar ist, erscheint ein
+neuer Reiter mit der Bezeichnung „Engine“, wenn man dieses Spiel hinzufügt oder
+dessen Spieloptionen bearbeitet. Falls die spielspezifischen Optionen nicht
+angezeigt werden, muss das betreffende Spiel einmal gestartet oder neu zur
+Spieleliste hinzugefügt werden. Dadurch wird die Konfiguration von jedem Eintrag
+aktualisiert, was die spielspezifischen Optionen zum Vorschein bringt.
+
+
9.0) Kompilierung:
---- -------------
Für eine aktuelle Übersicht dazu, wie man ScummVM für unterschiedliche
@@ -2341,7 +2434,3 @@ Viel Glück und viel Spaß beim Spielen wünscht
das ScummVM-Team.
http://www.scummvm.org/
------------------------------------------------------------------------
-
-
-(Deutscher Text basiert auf README mit SHA1-ID:
-d1de75a6ca828ab2fcdbce6352a12337f93fc21c)
diff --git a/doc/de/Neues b/doc/de/Neues
index 23fe6751c1..74203148e7 100644
--- a/doc/de/Neues
+++ b/doc/de/Neues
@@ -1,34 +1,92 @@
-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.5.0 (??.??.????)
+1.5.0 (27.07.2012)
Neue Spiele:
+ - Unterstützung für Backyard Baseball 2003 hinzugefügt.
+ - Unterstützung für Blue Force hinzugefügt.
+ - Unterstützung für Darby der Drache hinzugefügt.
+ - Unterstützung für Dreamweb hinzugefügt.
+ - Unterstützung für Geisha hinzugefügt.
+ - Unterstützung für Gregor und der Heißluftballon hinzugefügt.
+ - Unterstützung für Magic Tales: Liam Finds a Story hinzugefügt.
+ - Unterstützung für Once Upon A Time: Little Red Riding Hood hinzugefügt.
+ - Unterstützung für Sleeping Cub's Test of Courage hinzugefügt.
- Unterstützung für Soltys hinzugefügt.
+ - Unterstützung für The Princess and the Crab hinzugefügt.
+
+Allgemein:
+ - MT-32-Emulationscode auf den neusten Stand des Munt-Projekt-Schnappschusses
+ gebracht. Die Emulation hat sich drastisch verbessert.
+ - Unterstützung für TrueType-Schriftarten über FreeType2 in unserer
+ grafischen Benutzeroberfläche hinzugefügt. Damit einhergehend wurde auch
+ GNU FreeFont zu unserem modernen Thema hinzugefügt. Beachten Sie, dass
+ nicht alle Ports hiervon profitieren.
+ - Baskische Übersetzung hinzugefügt.
+ - Spiel- und engine-spezifische Optionen in den Engines AGI, DREAMWEB, KYRA,
+ QUEEN, SKY und SCI hinzugefügt. Es ist nun möglich, diese über den
+ Engine-Reiter anzusprechen, wenn man ein Spiel hinzufügt oder dessen
+ Spieloptionen bearbeitet. In den meisten Fällen müssen Sie jedes Spiel
+ einmal starten oder diese alle in ScummVMs Spieleliste neu hinzufügen, um
+ den Reiter für spielspezifische Optionen zu erhalten.
+ - Aussehen von vorhersagendem Eingabedialog verbessert.
+ - Verschiedene Verbesserungen der grafischen Benutzeroberfläche.
- SDL-Portierungen:
- - Unterstützung für OpenGL hinzugefügt. (GSoC-Aufgabe)
+ Baphomets Fluch 1:
+ - Falsche Soundeffekte in der DOS-/Windows-Demo korrigiert.
+ - Unterstützung für PlayStation-Videos hinzugefügt.
+ - Fehlende Untertitel zur Demo hinzugefügt.
+
+ Baphomets Fluch 2:
+ - Unterstützung für PlayStation-Videos hinzugefügt.
Cine:
- Roland-MT-32-Ausgabetreiber integriert.
+ Drascula:
+ - Spanische Untertitel zur Zwischensequenz mit Von Braun
+ hinzugefügt (3069981: Keine Untertitel in Szene mit „Von Braun“).
+
+ Gob:
+ - Absturz in Lost in Time beseitigt.
+ - AdLib-Abspieler umgeschrieben. Den nun funktionierenden MDY-Abspieler in
+ Fascination und Geisha aktiviert.
+
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.
+ - Grafische Störungen in HE98-Version von Pajama Sam's Lost & Found
+ beseitigt.
- Sword1:
- - Falsche Soundeffekte in der DOS-/Windows-Demo korrigiert.
+ iPhone-Portierung:
+ - Verhalten von Geste für F5 (Menü) geändert, um stattdessen das Hauptmenü zu
+ öffnen.
+ - Unterstützung für spezifische Mauszeigerpaletten hinzugefügt. Hierdurch
+ wird beispielsweise der rote Zeiger im modernen Thema verwendet.
+ - Unterstützung für Seitenverhältniskorrektur hinzugefügt.
+ - Unterstützung für 16 Bits pro Pixel bei Spielen integriert.
+
+ Maemo-Portierung:
+ - Unterstützung für Nokia 770 mit dem Betriebssystem OS2008 HE hinzugefügt.
+ - Konfigurierbare Tastenzuweisung hinzugefügt.
Windows-Portierung:
- - Standardmäßiger Speicherort für Spielstände bei
+ - Standard-Verzeichnis für Spielstände bei
Windows NT4/2000/XP/Vista/7 geändert.
+ (Die Stapelverarbeitungsdatei migration.bat kann verwendet werden, um die
+ Spielstände vom alten Standard-Verzeichnis in das neue zu kopieren.)
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.
+ Baphomets Fluch 2:
+ - Leichte Grafikverbesserung für PSX-Version.
+
+
BASS:
- Unterstützung für verbesserte Musik von James Woodcock hinzugefügt
(http://www.jameswoodcock.co.uk/?p=7695).
@@ -52,9 +110,6 @@ Sie auf Englisch unter:
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.
@@ -82,6 +137,12 @@ Sie auf Englisch unter:
- Laden und Speichern in der PC-Version von Waxworks repariert.
- Musik in den PC-Versionen von Elvira 1 und 2 sowie Waxworks korrigiert.
+ Baphomets Fluch 1:
+ - Aufhängen in Windows-Demo beseitigt.
+ - Absturz beseitigt, wenn Untertitelpaket für Zwischensequenzen in
+ Macintosh-Version verwendet wird.
+
+
Groovie:
- Unterstützung für die iOS-Version von The 7th Guest hinzugefügt.
@@ -105,11 +166,6 @@ Sie auf Englisch unter:
- Palettenhandhabung in der Amiga-Version von Indiana Jones and the
Fate of Atlantis verbessert.
- 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
Startmenü und im ScummVM-Menü innerhalb des Spiels).
@@ -189,7 +245,7 @@ Sie auf Englisch unter:
Drascula:
- Deutsche und französische Untertitel zur Zwischensequenz mit Von Braun
- hinzugefügt (3069981: Keine Untertitel in Szene mit “Von Braun“).
+ hinzugefügt (3069981: Keine Untertitel in Szene mit „Von Braun“).
- Französische Übersetzung des Spiels verbessert.
- Unterstützung für Rückkehr zur Spieleliste hinzugefügt.
@@ -1313,7 +1369,7 @@ Sie auf Englisch unter:
- Grafische Benutzeroberfläche für SoundFont-Einstellungen hinzugefügt
(werden momentan nur von CoreAudio und FluidSynth-MIDI-Treibern
verwendet).
- - Der MPEG-Spieler konnte aussetzen, wenn der Ton vorzeitig endet.
+ - Der MPEG-Abspieler konnte aussetzen, wenn der Ton vorzeitig endet.
- Automatische Skalierung der Benutzeroberfläche verbessert, um den vollen
Vorteil des Bildschirms auszunutzen.
- Fehlerbeseitigungen für GCC 4
@@ -1667,7 +1723,3 @@ Sie auf Englisch unter:
0.0.1 (08.10.2001)
- Erste Version
-
-
-(Deutscher Text basiert auf NEWS mit SHA1-ID:
-ab2b020ff10b2e5d25cc93757029838c7eac6b41)
diff --git a/doc/se/LasMig b/doc/se/LasMig
index 656210883f..9ac79b4c35 100644
--- a/doc/se/LasMig
+++ b/doc/se/LasMig
@@ -1,5 +1,4 @@
ScummVM LÄS MIG
-Senast uppdaterad: $Date$
------------------------------------------------------------------------
För ytterligare information, kompatibilitetslistor, donationsdetaljer, den senaste programversionen, utvecklingsrapporter med mera, var god besök ScummVM:s hemsida på http://www.scummvm.org/
@@ -55,6 +54,8 @@ Innehåll:
* 7.8 Att använda komprimerade ljudfiler (MP3, Ogg Vorbis, Flac)
* 7.9 Uppspelningsfrekvens
8.0) Konfigurationsfilen
+ * 8.1 Igenkända nyckelord
+ * 8.2 Spelinställningar som kan aktiveras via användargränssnittet
9.0) Kompilering
@@ -184,13 +185,18 @@ AGOS-spel från Adventuresoft/Horrorsoft:
The Feeble Files [feeble]
GOB-spel från Coktel Vision:
+ Bambou le sauveur de la jungle [bambou]
Bargon Attack [bargon]
+ Fascination [fascination]
+ Geisha [geisha]
Gobliiins [gob1]
Gobliins 2 [gob2]
Goblins 3 [gob3]
Lost in Time [lostintime]
+ Once Upon A Time: Little Red Riding Hood [littlered]
The Bizarre Adventures of Woodruff
and the Schnibble [woodruff]
+ Urban Runner [urban]
Ween: The Prophecy [ween]
MADE-spel från Activision:
@@ -221,6 +227,7 @@ MADE-spel från Activision:
SCUMM-spel från Humongous Entertainment:
Backyard Baseball [baseball]
Backyard Baseball 2001 [baseball2001]
+ Backyard Baseball 2003 [baseball2003]
Backyard Football [football]
Big Thinkers First Grade [thinker1]
Big Thinkers Kindergarten [thinkerk]
@@ -288,7 +295,6 @@ Living Books-spel:
De följande spelen borde starta, men är ännu ej helt spelbara. Spela dem på egen risk och var god skicka inga buggrapporter angående dem. För senaste nytt angående spelkompatibilitet kan du besöka vår hemsida och läsa kompatibilitetslistan.
- Backyard Baseball 2003 [baseball2003]
Backyard Football 2002 [football2002]
Backyard Soccer [soccer]
Backyard Soccer MLS [soccermls]
@@ -387,6 +393,11 @@ Instruktionerna för Broken Sword-spelen är för Sold-Out Software-versionerna
------ ---------------------------------
Filmscenerna i Broken Sword-spelen har varit med om en hel del (se nästa avdelning om du är intresserad) men i regel behöver du bara kopiera .SMK-filerna frÃ¥n â€SMACKS†eller â€SMACKSHIâ€-katalogerna pÃ¥ CD-skivorna till samma katalog där de andra datafilerna ligger. (Broken Sword har även en â€SMACKSLO†katalog med samma filmscener, men dessa har lägre kvalitet.) Du kan även lägga dem i en underkatalog med namnet â€videoâ€, om du vill.
+För PlayStation-versionerna kan du dumpa originalfilmerna frÃ¥n CD:n. Dumpa varje fil med ändelsen â€STR†som rÃ¥a sektorer frÃ¥n CD:n (samtliga 2352 bitar per sektor). DU kan även använde de omkodade filmscenerna nedan istället, men detta fungerar inte för alla filmer i Broken Sword II. För ytterligare information, se:
+
+ http://wiki.scummvm.org/index.php/HOWTO-PlayStation_Videos
+
+
Vissa nyutgåvor av spelen, tillika PlayStation-versionen, har inga Smacker videos. Revolution Software har varit goda nog att skapa nykodade filmscener som kan laddas hem från våran hemsida:
http://www.scummvm.org/downloads.php
@@ -395,7 +406,7 @@ Dessa filmscener är tillgängliga i DXA-format med FLAC-ljud. Kvaliteten är de
För de system som är för långsamma för att hantera FLAC-ljud finns ljudet för dessa filmscener att ladda hem separat som OGG Vorbis-ljud. För att se dessa filmscener med OGG Vorbis-ljud krävs en version av ScummVM som kompilerats med stöd för både libVorbis och zlib.
-Vi erbjuder även ett tillägg för undertexter i Broken Sword. Packa upp tillägget och följ instruktionerna i readme.txt-filen. (Broken Sword II har redan undertexter; inga modifikationer krävs för dem).
+Vi erbjuder även ett tillägg för undertexter i Broken Sword. Packa upp tillägget och följ instruktionerna i readme.txt-filen. Undertextpaketet fungerar för tillfället inte med PlayStation-filmer (Broken Sword II har redan undertexter; inga modifikationer krävs för dem).
3.7.2) Broken Sword-spelens filmscener – en återblick:
@@ -475,7 +486,7 @@ Döp om voices.wav på CD4 till voices4.wav
3.14) Notiser om The Legend of Kyrandia:
----- ----------------------------------
-För att spela The Legend of Kyrandia i ScummVM behöver du “kyra.datâ€-filen som är tillgänglig frÃ¥n â€Downloadsâ€-avdelningen pÃ¥ ScummVM:s hemsida.
+För att spela The Legend of Kyrandia i ScummVM behöver du “kyra.datâ€-filen. Filen borde alltid inkluderas med officiella ScummVM-paket. Om ScummVM klagar över att filen saknas kan du finna den pÃ¥ “Downloadsâ€-avdelningen av ScummVM:s hemsida. Märk att den nuvarande Windows-versionen av ScummVM borde ha filen inbyggd i programfilen, och sÃ¥lunda behöver du bara ladda hem den om ScummVM klagar över att filen saknas.
3.15) Notiser om Sierra AGI-spel med textinmatningshjälp:
@@ -537,10 +548,6 @@ Den här versionen har följande kända problem. Du behöver inte rapportera dem
FM-TOWNS-versioner av spel:
- Kanji-versioner kräver en FM-TOWNS Font ROM
- - ScummVM krashar slumpmässigt när FM-TOWNS Font Rom används för
- kanji-versionerna av de följande spelen:
- The Secret of Monkey Island, Monkey Island 2: LeChuck's Revenge
- och Indiana Jones and the Fate of Atlantis
Loom:
- Att stänga av undertexterna via konfigurationsfilen är inte pålitligt då
@@ -590,7 +597,6 @@ Den här versionen har följande kända problem. Du behöver inte rapportera dem
The Legend of Kyrandia:
- Varken musik eller ljudeffekter i Macintosh diskett-versioner.
- Macintosh-CD använder DOS-musik och ljudeffekter.
- - PC-9821-versionen saknar stöd för ljudeffekter.
Humongous Entertainment-spel:
- Endast originalgränssnittet för att ladda och spara kan användas.
@@ -668,6 +674,7 @@ Ordning: scummvm [INSTÄLLNINGAR]... [SPEL]
--themepath=PATH Sökväg dit GUI-teman lagras
--list-themes Visa full lista med alla användbara GUI-teman
-e, --music-driver=MODE Välj musik-driver (se även avdelning 7.0)
+ --list-audio-devices Visar tillgängliga ljudenheter
-q, --language=LANG Välj spelets språk (se även avdelning 5.2)
-m, --music-volume=NUM Ställ in musikvolym, 0-255 (standard: 192)
-s, --sfx-volume=NUM Ställ in ljudeffektsvolym, 0-255 (standard: 192)
@@ -822,19 +829,28 @@ Motorer som för närvarande stöder återvändo till launchern:
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
@@ -1006,8 +1022,24 @@ Notis för WinCE-användare: På grund av de begränsade tangentborden på de fl
Spardata lagras som standard i den aktiva katalogen på vissa plattformar och i förbestämda kataloger på andra plattformar. Du kan ställa in katalogen i konfigurationsfilen genom att ändra savepath-parametern. Se exempel för konfigurationsfilen senare i detta dokument.
Plattformar som för närvarande har annorlunda standardkataloger:
- Mac OS X: $HOME/Documents/ScummVM Savegames/
- Övriga unix-system: $HOME/.scummvm/
+ Mac OS X:
+ $HOME/Documents/ScummVM Savegames/
+
+ Övriga unix-system:
+ $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\
+
+Spardata lagras i en gömd map I Windows NT4/2000/XP/Vista/7, som kan kommas åt genom att köra "%APPDATA%%\ScummVM\Saved Games\" eller genom att visa dolda filer i Windows Explorer.
+
+Notis för användare av NT4/2000/XP/Vista/7: Den förutbestämda platsen för spardata har ändrats i ScummVM 1.5.0. Migrationsfilen kan användas för att kopiera spardata från den förra platsen till den nya.
6.1) Autosparning:
@@ -1059,20 +1091,28 @@ Där “xxx†står för positionsnumret (t.ex. 001) i 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:
@@ -1086,20 +1126,28 @@ Där “xxx†står för positionsnumret (t.ex. 001) i ScummVM.
Motorer som för tillfället stöder --save-slot/-x:
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 och ljud:
@@ -1396,7 +1444,7 @@ Att använda frekvenser mellan de ovansagda rekommenderas ej. Till att börja me
---- --------------------
Som standard sparas och laddas konfigrationsfilen i:
- Windows Vista:
+ Windows Vista/7:
\Users\username\AppData\Roaming\ScummVM\scummvm.ini,
Windows 2000/XP:
@@ -1458,6 +1506,9 @@ Ett exempel på en konfigurationsfil ser ut så här:
path=C:\amiga_mi2\
music_driver=windows
+
+8.1) Igenkända nyckelord
+---- -------------------
Följande nyckelord kan användas:
path string Sökvägen dit spelets datafiler ligger
@@ -1483,7 +1534,6 @@ Följande nyckelord kan användas:
fullscreen bool Fullskärmsläge
aspect_ratio bool Aktivera korrektion av bildförhållande
- disable_dithering bool Anti-gitter för EGA-spel
gfx_mode string Grafikläge (normalt, 2x, 3x, 2xsai,
super2xsai, supereagle, advmame2x, advmame3x,
hq2x, hq3x, tv2x, dotmatrix)
@@ -1529,6 +1579,29 @@ Följande nyckelord kan användas:
boot_param number Skicka det här numret till boot script
+Sierra-spel som använder AGI-motorn använder även följande nyckelord:
+
+ originalsaveload bool Ställ in till “true†för att använda
+ originalskärmarna för ladda/spara
+ istället för ScummVM:s förbättrade
+ skärmar
+
+Sierra-spel som använder SCI-motorn använder även följande nyckelord:
+
+ disable_dithering bool Tar bort gitter artefakter från EGA-spel
+ prefer_digitalsfx bool Ställ in till “true†för att föredra
+ digitala ljudeffekter istället för
+ syntetiserade ljudeffekter
+ originalsaveload bool Ställ in till “true†för att använda
+ originalskärmarna för ladda/spara
+ istället för ScummVM:s förbättrade
+ skärmar
+ native_fb01 bool Ställ in till “true†för att använda
+ ett IBM Music Feature-kort eller en
+ Yamaha FB-01 FM synthmodul för
+ MIDI-uppspelning
+
+
Broken Sword II lägger till följande nyckelord:
gfx_details number Grafisk detalj (0-3)
@@ -1546,6 +1619,13 @@ Flight of the Amazon Queen lägger till följande nyckelord:
sfx_mute bool Ställ in till “true†för att deaktivera
ljudeffekter
+
+Jones in the Fast Lane använder även följande nyckelord:
+ music_mute bool Ställ in till “true†för att använda
+ CD-ljud, om tillgängligt, istället
+ spelets vanliga ljud.
+
+
King's Quest VI Windows lägger till följande nyckelord:
windows_cursors bool Ställ in till “true†för att använda de svartvita
@@ -1553,6 +1633,25 @@ King's Quest VI Windows lägger till följande nyckelord:
Ställ in till â€false†för att använda de uppskalade
muspekarna som matchar resten av grafiken.
+
+Lands of Lore: The Throne of Chaos använder även följande nyckelord:
+
+ smooth_scrolling bool Ställ in till “true†för mjukare
+ skärmrullning när du går från en
+ skärm till en annan.
+ floating_cursors bool Ställ in till “true†för att ändra
+ pekaren till en riktningspil när den
+ närmar sig kanten av skärmen. Spelaren
+ kan sedan klicka för att gå mot
+ den riktningen.
+
+
+Space Quest IV CD använder även följande nyckelord:
+
+ silver_cursors bool Ställ in till “true†för att använda
+ silverpekare istället för gulpekarna
+
+
Simon the Sorcerer 1 och 2 lägger till följande nyckelord:
music_mute bool Ställ in till “true†för att deaktivera musik
@@ -1565,6 +1664,28 @@ The Legend of Kyrandia lägger till följande nyckelord:
walkspeed int GÃ¥nghastighet (0-4)
+The Legend of Kyrandia: Malcolm's Revenge använder även följande nyckelord:
+
+ studio_audience bool Ställ in till “true†för att höra
+ skratt och applåder när Malcolm
+ berättar ett skämt
+ skip_support bool Ställ in till “true†för att kunna
+ skippa text och filmscener
+ helium_mode bool Ställ in till “true†så låter folk
+ som att dom inandats helium
+
+The 7th Guest använder även följande nyckelord:
+
+ t7g_speed string Hastighet på videouppspelning
+ (normal, tweaked, im_an_ios)
+
+
+8.2) Spelinställningar som kan aktiveras via användargränssnittet
+---- ------------------------------------------------------------
+MÃ¥nga av inställningarna i den föregÃ¥ende avdelningen kan aktiveras via användargränssnittet. Om en inställning finns tillgänglig för ett specifikt spel visas en ny tabb med namnet â€Motor†när du lägger till eller ändrar inställningarna för spelet.
+Om specialinställningarna inte visas måste spelet köras en gång eller läggas till igen i spellistan i ScummVM:s launcher. Detta uppdaterar inställningarna för varje spel, vilket låter specialinställningarna visas.
+
+
9.0) Kompilering:
---- ------------
För en uppdaterad överblick för hur man kompilerar ScummVM på diverse plattformar var god se vår Wiki, speciellt den här här sidan:
@@ -1599,15 +1720,6 @@ På Win9x/NT/XP kan du definiera USE_WINDBG och lägga till WinDbg för att visa
* Var god se:
http://wiki.scummvm.org/index.php/Compiling_ScummVM/Windows_CE
- Debian GNU/Linux:
- * Installera paketen 'build-essential', 'fakeroot', 'debhelper',
- och 'libsdl1.2-dev' på ditt system.
- * Installera de här paketen (valfria): 'libvorbis-dev' (för Ogg
- Vorbis stöd), 'libasound2-dev' (för ALSA sequencer stöd),
- 'libmad0-dev' (för MAD MP3 stöd), 'zlib1g-dev' (för stöd av kompresserad spardata).
- * Kör 'make deb'.
- * Kör sedan 'dpkg -i ../scummvm-cvs*deb', så är du klar.
-
Mac OS X:
* Se till att du har utvecklingsverktygen istallerade.
* SDL-utvecklingspaketet för OS X som finns tillgängligt på SLD:s hemsida
@@ -1649,4 +1761,4 @@ På Win9x/NT/XP kan du definiera USE_WINDBG och lägga till WinDbg för att visa
Lycka till och glada äventyr!
ScummVM-teamet.
http://www.scummvm.org/
------------------------------------------------------------------------- \ No newline at end of file
+------------------------------------------------------------------------
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 081a97b9f1..9beba6ce4a 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -22,7 +22,6 @@
#include "common/debug.h"
#include "common/util.h"
-#include "common/hash-str.h"
#include "common/file.h"
#include "common/macresman.h"
#include "common/md5.h"
@@ -167,6 +166,34 @@ GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
return detectedGames;
}
+const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ if (!_extraGuiOptions)
+ return ExtraGuiOptions();
+
+ ExtraGuiOptions options;
+
+ // If there isn't any target specified, return all available GUI options.
+ // Only used when an engine starts in order to set option defaults.
+ if (target.empty()) {
+ for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry)
+ options.push_back(entry->option);
+
+ return options;
+ }
+
+ // Query the GUI options
+ const Common::String guiOptionsString = ConfMan.get("guioptions", target);
+ const Common::String guiOptions = parseGameGUIOptions(guiOptionsString);
+
+ // Add all the applying extra GUI options.
+ for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry) {
+ if (guiOptions.contains(entry->guioFlag))
+ options.push_back(entry->option);
+ }
+
+ return options;
+}
+
Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
assert(engine);
@@ -280,14 +307,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
return Common::kNoError;
}
-struct SizeMD5 {
- int size;
- Common::String md5;
-};
-
-typedef Common::HashMap<Common::String, SizeMD5, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SizeMD5Map;
-
-static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSizeMD5) {
+void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps) const {
// TODO: This message should be cleaned up / made more specific.
// For example, we should specify at least which engine triggered this.
//
@@ -299,7 +319,7 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz
report += _("of the game you tried to add and its version/language/etc.:");
report += "\n";
- for (SizeMD5Map::const_iterator file = filesSizeMD5.begin(); file != filesSizeMD5.end(); ++file)
+ for (ADFilePropertiesMap::const_iterator file = filesProps.begin(); file != filesProps.end(); ++file)
report += Common::String::format(" {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size);
report += "\n";
@@ -347,8 +367,36 @@ void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSL
}
}
+bool AdvancedMetaEngine::getFileProperties(const Common::FSNode &parent, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, ADFileProperties &fileProps) const {
+ // FIXME/TODO: We don't handle the case that a file is listed as a regular
+ // file and as one with resource fork.
+
+ if (game.flags & ADGF_MACRESFORK) {
+ Common::MacResManager macResMan;
+
+ if (!macResMan.open(parent, fname))
+ return false;
+
+ fileProps.md5 = macResMan.computeResForkMD5AsString(_md5Bytes);
+ fileProps.size = macResMan.getResForkDataSize();
+ return true;
+ }
+
+ if (!allFiles.contains(fname))
+ return false;
+
+ Common::File testFile;
+
+ if (!testFile.open(allFiles[fname]))
+ return false;
+
+ fileProps.size = (int32)testFile.size();
+ fileProps.md5 = Common::computeStreamMD5AsString(testFile, _md5Bytes);
+ return true;
+}
+
ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const {
- SizeMD5Map filesSizeMD5;
+ ADFilePropertiesMap filesProps;
const ADGameFileDescription *fileDesc;
const ADGameDescription *g;
@@ -363,39 +411,14 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
Common::String fname = fileDesc->fileName;
- SizeMD5 tmp;
+ ADFileProperties tmp;
- if (filesSizeMD5.contains(fname))
+ if (filesProps.contains(fname))
continue;
- // FIXME/TODO: We don't handle the case that a file is listed as a regular
- // file and as one with resource fork.
-
- if (g->flags & ADGF_MACRESFORK) {
- Common::MacResManager macResMan;
-
- if (macResMan.open(parent, fname)) {
- tmp.md5 = macResMan.computeResForkMD5AsString(_md5Bytes);
- tmp.size = macResMan.getResForkDataSize();
- debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str());
- filesSizeMD5[fname] = tmp;
- }
- } else {
- if (allFiles.contains(fname)) {
- debug(3, "+ %s", fname.c_str());
-
- Common::File testFile;
-
- if (testFile.open(allFiles[fname])) {
- tmp.size = (int32)testFile.size();
- tmp.md5 = Common::computeStreamMD5AsString(testFile, _md5Bytes);
- } else {
- tmp.size = -1;
- }
-
- debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str());
- filesSizeMD5[fname] = tmp;
- }
+ if (getFileProperties(parent, allFiles, *g, fname, tmp)) {
+ debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str());
+ filesProps[fname] = tmp;
}
}
}
@@ -428,19 +451,19 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
Common::String tstr = fileDesc->fileName;
- if (!filesSizeMD5.contains(tstr)) {
+ if (!filesProps.contains(tstr)) {
fileMissing = true;
allFilesPresent = false;
break;
}
- if (fileDesc->md5 != NULL && fileDesc->md5 != filesSizeMD5[tstr].md5) {
- debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesSizeMD5[tstr].md5.c_str());
+ if (fileDesc->md5 != NULL && fileDesc->md5 != filesProps[tstr].md5) {
+ debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesProps[tstr].md5.c_str());
fileMissing = true;
break;
}
- if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesSizeMD5[tstr].size) {
+ if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesProps[tstr].size) {
debug(3, "Size Mismatch. Skipping");
fileMissing = true;
break;
@@ -486,8 +509,8 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
// We didn't find a match
if (matched.empty()) {
- if (!filesSizeMD5.empty() && gotAnyMatchesWithAllFiles) {
- reportUnknown(parent, filesSizeMD5);
+ if (!filesProps.empty() && gotAnyMatchesWithAllFiles) {
+ reportUnknown(parent, filesProps);
}
// Filename based fallback
@@ -496,7 +519,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
return matched;
}
-const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const {
+const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const Common::FSList &fslist, const ADFileBasedFallback *fileBasedFallback, ADFilePropertiesMap *filesProps) const {
const ADFileBasedFallback *ptr;
const char* const* filenames;
@@ -526,6 +549,16 @@ const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &
maxNumMatchedFiles = numMatchedFiles;
debug(4, "and overridden");
+
+ if (filesProps) {
+ for (filenames = ptr->filenames; *filenames; ++filenames) {
+ ADFileProperties tmp;
+
+ if (getFileProperties(fslist.begin()->getParent(), allFiles, *agdesc, *filenames, tmp))
+ (*filesProps)[*filenames] = tmp;
+ }
+ }
+
}
}
}
@@ -562,8 +595,9 @@ GameDescriptor AdvancedMetaEngine::findGame(const char *gameid) const {
return GameDescriptor();
}
-AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids)
- : _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameids(gameids) {
+AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids, const ADExtraGuiOptionsMap *extraGuiOptions)
+ : _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameids(gameids),
+ _extraGuiOptions(extraGuiOptions) {
_md5Bytes = 5000;
_singleid = NULL;
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index 0cec039b5e..3eec33abe5 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -26,6 +26,8 @@
#include "engines/metaengine.h"
#include "engines/engine.h"
+#include "common/hash-str.h"
+
#include "common/gui_options.h" // FIXME: Temporary hack?
namespace Common {
@@ -46,6 +48,20 @@ struct ADGameFileDescription {
};
/**
+ * A record describing the properties of a file. Used on the existing
+ * files while detecting a game.
+ */
+struct ADFileProperties {
+ int32 size;
+ Common::String md5;
+};
+
+/**
+ * A map of all relevant existing files in a game directory while detecting.
+ */
+typedef Common::HashMap<Common::String, ADFileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ADFilePropertiesMap;
+
+/**
* A shortcut to produce an empty ADGameFileDescription record. Used to mark
* the end of a list of these.
*/
@@ -134,6 +150,24 @@ enum ADFlags {
/**
+ * Map entry for mapping GUIO_GAMEOPTIONS* to their ExtraGuiOption
+ * description.
+ */
+struct ADExtraGuiOptionsMap {
+ /**
+ * GUIO_GAMEOPTION* string.
+ */
+ const char *guioFlag;
+
+ /**
+ * The associated option.
+ */
+ ExtraGuiOption option;
+};
+
+#define AD_EXTRA_GUI_OPTIONS_TERMINATOR { 0, { 0, 0, 0, 0 } }
+
+/**
* A MetaEngine implementation based around the advanced detector code.
*/
class AdvancedMetaEngine : public MetaEngine {
@@ -159,6 +193,11 @@ protected:
const PlainGameDescriptor *_gameids;
/**
+ * A map containing all the extra game GUI options the engine supports.
+ */
+ const ADExtraGuiOptionsMap * const _extraGuiOptions;
+
+ /**
* The number of bytes to compute MD5 sum for. The AdvancedDetector
* is primarily based on computing and matching MD5 checksums of files.
* Since doing that for large files can be slow, it can be restricted
@@ -173,7 +212,7 @@ protected:
*
* Used to override gameid.
* This is a recommended setting to prevent global gameid pollution.
- * With this option set, the gameid effectively turns into engineid.
+ * With this option set, the gameid effectively turns into engineid.
*
* FIXME: This field actually removes a feature (gameid) in order to
* address a more generic problem. We should find a better way to
@@ -211,7 +250,7 @@ protected:
const char * const *_directoryGlobs;
public:
- AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids);
+ AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids, const ADExtraGuiOptionsMap *extraGuiOptions = 0);
/**
* Returns list of targets supported by the engine.
@@ -225,6 +264,8 @@ public:
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
+
protected:
// To be implemented by subclasses
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const = 0;
@@ -261,9 +302,17 @@ protected:
* In case of a tie, the entry coming first in the list is chosen.
*
* @param allFiles a map describing all present files
+ * @param fslist a list of nodes for all present files
* @param fileBasedFallback a list of ADFileBasedFallback records, zero-terminated
+ * @param filesProps if not 0, return a map of properties for all detected files here
+ */
+ const ADGameDescription *detectGameFilebased(const FileMap &allFiles, const Common::FSList &fslist, const ADFileBasedFallback *fileBasedFallback, ADFilePropertiesMap *filesProps = 0) const;
+
+ /**
+ * Log and print a report that we found an unknown game variant, together with the file
+ * names, sizes and MD5 sums.
*/
- const ADGameDescription *detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const;
+ void reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps) const;
// TODO
void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const;
@@ -273,6 +322,9 @@ protected:
* Includes nifty stuff like removing trailing dots and ignoring case.
*/
void composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth) const;
+
+ /** Get the properties (size and MD5) of this file. */
+ bool getFileProperties(const Common::FSNode &parent, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, ADFileProperties &fileProps) const;
};
#endif
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index e9c9645768..98ffca22ed 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -46,6 +46,8 @@
#include "agi/keyboard.h"
#include "agi/menu.h"
+#include "gui/predictivedialog.h"
+
namespace Agi {
void AgiEngine::allowSynthetic(bool allow) {
@@ -58,9 +60,25 @@ void AgiEngine::processEvents() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
- case Common::EVENT_PREDICTIVE_DIALOG:
- if (_predictiveDialogRunning)
- break;
+ case Common::EVENT_PREDICTIVE_DIALOG: {
+ GUI::PredictiveDialog _predictiveDialog;
+ _predictiveDialog.runModal();
+ strcpy(_predictiveResult, _predictiveDialog.getResult());
+ if (strcmp(_predictiveResult, "")) {
+ if (_game.inputMode == INPUT_NORMAL) {
+ strcpy((char *)_game.inputBuffer, _predictiveResult);
+ handleKeys(KEY_ENTER);
+ } else if (_game.inputMode == INPUT_GETSTRING) {
+ strcpy(_game.strings[_stringdata.str], _predictiveResult);
+ newInputMode(INPUT_NORMAL);
+ _gfx->printCharacter(_stringdata.x + strlen(_game.strings[_stringdata.str]) + 1,
+ _stringdata.y, ' ', _game.colorFg, _game.colorBg);
+ } else if (_game.inputMode == INPUT_NONE) {
+ for (int n = 0; _predictiveResult[n]; n++)
+ keyEnqueue(_predictiveResult[n]);
+ }
+ }
+ /*
if (predictiveDialog()) {
if (_game.inputMode == INPUT_NORMAL) {
strcpy((char *)_game.inputBuffer, _predictiveResult);
@@ -75,6 +93,8 @@ void AgiEngine::processEvents() {
keyEnqueue(_predictiveResult[n]);
}
}
+ */
+ }
break;
case Common::EVENT_LBUTTONDOWN:
key = BUTTON_LEFT;
@@ -131,65 +151,46 @@ void AgiEngine::processEvents() {
switch (key = event.kbd.keycode) {
case Common::KEYCODE_LEFT:
case Common::KEYCODE_KP4:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP4)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_LEFT;
break;
case Common::KEYCODE_RIGHT:
case Common::KEYCODE_KP6:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP6)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_RIGHT;
break;
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP8)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_UP;
break;
case Common::KEYCODE_DOWN:
case Common::KEYCODE_KP2:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP2)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN;
break;
case Common::KEYCODE_PAGEUP:
case Common::KEYCODE_KP9:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP9)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_UP_RIGHT;
break;
case Common::KEYCODE_PAGEDOWN:
case Common::KEYCODE_KP3:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP3)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN_RIGHT;
break;
case Common::KEYCODE_HOME:
case Common::KEYCODE_KP7:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP7)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_UP_LEFT;
break;
case Common::KEYCODE_END:
case Common::KEYCODE_KP1:
- if (_predictiveDialogRunning && key == Common::KEYCODE_KP1)
- key = event.kbd.ascii;
- else if (_allowSynthetic || !event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN_LEFT;
break;
case Common::KEYCODE_KP5:
- if (_predictiveDialogRunning)
- key = event.kbd.ascii;
- else
- key = KEY_STATIONARY;
+ key = KEY_STATIONARY;
break;
case Common::KEYCODE_PLUS:
key = '+';
@@ -410,7 +411,9 @@ int AgiEngine::agiInit() {
#ifdef __DS__
// Normally, the engine loads the predictive text dictionary when the predictive dialog
// is shown. On the DS version, the word completion feature needs the dictionary too.
- loadDict();
+
+ // FIXME - loadDict() no long exists in AGI as this has been moved to within the
+ // GUI Predictive Dialog, but DS Word Completion is probably broken due to this...
#endif
_egoHoldKey = false;
@@ -495,6 +498,9 @@ static const GameSettings agiSettings[] = {
};
AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+ // Assign default values to the config manager, in case settings are missing
+ ConfMan.registerDefault("originalsaveload", "false");
+
_noSaveLoadAllowed = false;
_rnd = new Common::RandomSource("agi");
@@ -575,10 +581,6 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
_oldMode = INPUT_NONE;
- _predictiveDialogRunning = false;
- _predictiveDictText = NULL;
- _predictiveDictLine = NULL;
- _predictiveDictLineCount = 0;
_firstSlot = 0;
resetControllers();
@@ -684,9 +686,6 @@ AgiEngine::~AgiEngine() {
_gfx->deinitMachine();
delete _gfx;
delete _console;
-
- free(_predictiveDictLine);
- free(_predictiveDictText);
}
Common::Error AgiBase::init() {
@@ -703,6 +702,7 @@ Common::Error AgiBase::init() {
Common::Error AgiEngine::go() {
CursorMan.showMouse(true);
+ setTotalPlayTime(0);
if (_game.state < STATE_LOADED) {
do {
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 55b4805022..520b0aae59 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -43,6 +43,7 @@
#include "agi/logic.h"
#include "agi/sound.h"
+#include "gui/predictivedialog.h"
namespace Common {
class RandomSource;
@@ -889,6 +890,9 @@ public:
int saveGameSimple();
int loadGameDialog();
int loadGameSimple();
+ int doSave(int slot, const Common::String &desc);
+ int doLoad(int slot, bool showMessages);
+ int scummVMSaveLoadDialog(bool isSave);
uint8 *_intobj;
InputMode _oldMode;
@@ -1078,26 +1082,14 @@ public:
void clearPrompt(bool useBlackBg = false);
void clearLines(int, int, int);
void flushLines(int, int);
- bool predictiveDialog();
private:
void printStatus(const char *message, ...) GCC_PRINTF(2, 3);
void printText2(int l, const char *msg, int foff, int xoff, int yoff, int len, int fg, int bg, bool checkerboard = false);
void blitTextbox(const char *p, int y, int x, int len);
void eraseTextbox();
- void loadDict();
bool matchWord();
- // Predictive dialog
- // TODO: Move this to a separate class
- char *_predictiveDictText;
- char **_predictiveDictLine;
- int32 _predictiveDictLineCount;
- char *_predictiveDictActLine;
- Common::String _currentCode;
- Common::String _currentWord;
- int _wordNumber;
- bool _predictiveDialogRunning;
public:
char _predictiveResult[40];
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 982dce8405..5f7780bfe3 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -20,9 +20,6 @@
*
*/
-// FIXME: Avoid using printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-
#include "base/plugins.h"
#include "engines/advancedDetector.h"
@@ -31,6 +28,8 @@
#include "common/md5.h"
#include "common/savefile.h"
#include "common/textconsole.h"
+#include "common/translation.h"
+
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
@@ -139,6 +138,13 @@ static const PlainGameDescriptor agiGames[] = {
{0, 0}
};
+static const ExtraGuiOption agiExtraGuiOption = {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens, instead of the ScummVM ones"),
+ "originalsaveload",
+ false
+};
+
#include "agi/detection_tables.h"
using namespace Agi;
@@ -162,6 +168,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const;
virtual void removeSaveState(const char *target, int slot) const;
@@ -177,7 +184,8 @@ bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
- (f == kSavesSupportCreationDate);
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime);
}
bool AgiBase::hasFeature(EngineFeature f) const {
@@ -219,6 +227,12 @@ bool AgiMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD
return res;
}
+const ExtraGuiOptions AgiMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ ExtraGuiOptions options;
+ options.push_back(agiExtraGuiOption);
+ return options;
+}
+
SaveStateList AgiMetaEngine::listSaves(const char *target) const {
const uint32 AGIflag = MKTAG('A','G','I',':');
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
@@ -289,6 +303,10 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
uint32 saveDate = in->readUint32BE();
uint16 saveTime = in->readUint16BE();
+ if (saveVersion >= 6) {
+ uint32 playTime = in->readUint32BE();
+ desc.setPlayTime(playTime * 1000);
+ }
int day = (saveDate >> 24) & 0xFF;
int month = (saveDate >> 16) & 0xFF;
@@ -470,10 +488,14 @@ const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXX
g_fallbackDesc.desc.gameid = _gameid.c_str();
g_fallbackDesc.desc.extra = _extra.c_str();
- printf("Your game version has been detected using fallback matching as a\n");
- printf("variant of %s (%s).\n", g_fallbackDesc.desc.gameid, g_fallbackDesc.desc.extra);
- printf("If this is an original and unmodified version or new made Fanmade game,\n");
- printf("please report any, information previously printed by ScummVM to the team.\n");
+ Common::String fallbackWarning;
+
+ fallbackWarning = "Your game version has been detected using fallback matching as a\n";
+ fallbackWarning += Common::String::format("variant of %s (%s).\n", g_fallbackDesc.desc.gameid, g_fallbackDesc.desc.extra);
+ fallbackWarning += "If this is an original and unmodified version or new made Fanmade game,\n";
+ fallbackWarning += "please report any, information previously printed by ScummVM to the team.\n";
+
+ g_system->logMessage(LogMessageType::kWarning, fallbackWarning.c_str());
return (const ADGameDescription *)&g_fallbackDesc;
}
diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index ab0e9a1fe4..9d67b15adb 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -706,10 +706,10 @@ static const AGIGameDescription gameDescriptions[] = {
FANMADE("Go West, Young Hippie", "ff31484ea465441cb5f3a0f8e956b716"),
FANMADE("Good Man (demo v3.41)", "3facd8a8f856b7b6e0f6c3200274d88c"),
- GAME_LVFPNF("agi-fanmade", "Groza (russian) [AGDS sample]", "logdir", "421da3a18004122a966d64ab6bd86d2e", -1,
+ GAME_LVFPNF("agi-fanmade", "Groza (russian) [AGDS sample]", "logdir", "421da3a18004122a966d64ab6bd86d2e", -1,
Common::RU_RUS, 0x2440, GF_AGDS, GID_FANMADE, Common::kPlatformPC,GType_V2),
- GAME_LVFPNF("agi-fanmade", "Get Outta Space Quest", "logdir", "aaea5b4a348acb669d13b0e6f22d4dc9", -1,
+ GAME_LVFPNF("agi-fanmade", "Get Outta Space Quest", "logdir", "aaea5b4a348acb669d13b0e6f22d4dc9", -1,
Common::EN_ANY, 0x2440, GF_FANMADE, GID_GETOUTTASQ, Common::kPlatformPC,GType_V2),
FANMADE_F("Half-Death - Terror At White-Mesa", "b62c05d0ace878261392073f57ae788c", GF_AGIMOUSE),
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index a7f15c16fb..b7e52f4dc3 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -133,6 +133,19 @@ int AgiEngine::handleController(int key) {
if (key == BUTTON_LEFT &&
(int)_mouse.y >= _game.lineUserInput * CHAR_LINES &&
(int)_mouse.y <= (_game.lineUserInput + 1) * CHAR_LINES) {
+ GUI::PredictiveDialog _predictiveDialog;
+ _predictiveDialog.runModal();
+ strcpy(_predictiveResult, _predictiveDialog.getResult());
+ if (strcmp(_predictiveResult, "")) {
+ if (_game.inputMode == INPUT_NONE) {
+ for (int n = 0; _predictiveResult[n]; n++)
+ keyEnqueue(_predictiveResult[n]);
+ } else {
+ strcpy((char *)_game.inputBuffer, _predictiveResult);
+ handleKeys(KEY_ENTER);
+ }
+ }
+ /*
if (predictiveDialog()) {
if (_game.inputMode == INPUT_NONE) {
for (int n = 0; _predictiveResult[n]; n++)
@@ -142,6 +155,7 @@ int AgiEngine::handleController(int key) {
handleKeys(KEY_ENTER);
}
}
+ */
return true;
}
@@ -217,6 +231,17 @@ void AgiEngine::handleGetstring(int key) {
case BUTTON_LEFT:
if ((int)_mouse.y >= _stringdata.y * CHAR_LINES &&
(int)_mouse.y <= (_stringdata.y + 1) * CHAR_LINES) {
+ GUI::PredictiveDialog _predictiveDialog;
+ _predictiveDialog.runModal();
+ strcpy(_predictiveResult, _predictiveDialog.getResult());
+ if (strcmp(_predictiveResult, "")) {
+ strcpy(_game.strings[_stringdata.str], _predictiveResult);
+ newInputMode(INPUT_NORMAL);
+ _gfx->printCharacter(_stringdata.x + strlen(_game.strings[_stringdata.str]) + 1,
+ _stringdata.y, ' ', _game.colorFg, _game.colorBg);
+ return;
+ }
+ /*
if (predictiveDialog()) {
strcpy(_game.strings[_stringdata.str], _predictiveResult);
newInputMode(INPUT_NORMAL);
@@ -224,6 +249,7 @@ void AgiEngine::handleGetstring(int key) {
_stringdata.y, ' ', _game.colorFg, _game.colorBg);
return;
}
+ */
}
break;
case KEY_ENTER:
diff --git a/engines/agi/loader_v1.cpp b/engines/agi/loader_v1.cpp
index c6a3e66705..189c98ee98 100644
--- a/engines/agi/loader_v1.cpp
+++ b/engines/agi/loader_v1.cpp
@@ -64,7 +64,7 @@ int AgiLoader_v1::detectGame() {
int AgiLoader_v1::loadDir_DDP(AgiDir *agid, int offset, int max) {
Common::File fp;
-
+
if (!fp.open(_filenameDisk0))
return errBadFileOpen;
@@ -73,13 +73,13 @@ int AgiLoader_v1::loadDir_DDP(AgiDir *agid, int offset, int max) {
agid[i].volume = 0xFF;
agid[i].offset = _EMPTY;
}
-
+
fp.seek(offset, SEEK_SET);
for (int i = 0; i <= max; i++) {
int b0 = fp.readByte();
int b1 = fp.readByte();
int b2 = fp.readByte();
-
+
if (b0 == 0xFF && b1 == 0xFF && b2 == 0xFF) {
agid[i].volume = 0xFF;
agid[i].offset = _EMPTY;
@@ -98,7 +98,7 @@ int AgiLoader_v1::loadDir_DDP(AgiDir *agid, int offset, int max) {
int AgiLoader_v1::loadDir_BC(AgiDir *agid, int offset, int max) {
Common::File fp;
-
+
if (!fp.open(_filenameDisk0))
return errBadFileOpen;
@@ -107,13 +107,13 @@ int AgiLoader_v1::loadDir_BC(AgiDir *agid, int offset, int max) {
agid[i].volume = 0xFF;
agid[i].offset = _EMPTY;
}
-
+
fp.seek(offset, SEEK_SET);
for (int i = 0; i <= max; i++) {
int b0 = fp.readByte();
int b1 = fp.readByte();
int b2 = fp.readByte();
-
+
if (b0 == 0xFF && b1 == 0xFF && b2 == 0xFF) {
agid[i].volume = 0xFF;
agid[i].offset = _EMPTY;
@@ -171,7 +171,7 @@ uint8 *AgiLoader_v1::loadVolRes(struct AgiDir *agid) {
if (offset == _EMPTY)
return NULL;
-
+
if (offset > IMAGE_SIZE) {
fp.open(_filenameDisk1);
offset -= IMAGE_SIZE;
@@ -191,7 +191,7 @@ uint8 *AgiLoader_v1::loadVolRes(struct AgiDir *agid) {
agid->len = fp.readUint16LE();
data = (uint8 *)calloc(1, agid->len + 32);
fp.read(data, agid->len);
-
+
fp.close();
return data;
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index cac1701596..d23a5a2e27 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -289,7 +289,7 @@ bool Menu::keyhandler(int key) {
_vm->_game.clockEnabled = false;
drawMenuBar();
}
-
+
// Mouse handling
if (_vm->_mouse.button) {
int hmenu, vmenu;
diff --git a/engines/agi/module.mk b/engines/agi/module.mk
index 68d86f7b2e..331a10c16e 100644
--- a/engines/agi/module.mk
+++ b/engines/agi/module.mk
@@ -28,7 +28,6 @@ MODULE_OBJS := \
preagi_mickey.o \
preagi_troll.o \
preagi_winnie.o \
- predictive.o \
saveload.o \
sound.o \
sound_2gs.o \
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 7e04328a67..5334407eb8 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1146,7 +1146,7 @@ void cmdFollowEgo(AgiGame *state, uint8 *p) {
vt.parm1 = p1 > vt.stepSize ? p1 : vt.stepSize;
vt.parm2 = p2;
vt.parm3 = 0xff;
-
+
if (getVersion() < 0x2000) {
_v[p2] = 0;
vt.flags |= fUpdate | fAnimated;
@@ -1270,7 +1270,7 @@ void cmdVersion(AgiGame *state, uint8 *p) {
// no Sierra as it wraps textbox
Common::String verMsg = TITLE " v%s";
-
+
int ver = getVersion();
int maj = (ver >> 12) & 0xf;
int min = ver & 0xfff;
@@ -1839,7 +1839,7 @@ int AgiEngine::runLogic(int n) {
// ip = 2;
// warning("running logic %d\n", n);
// }
-
+
if (_game.exitAllLogics)
break;
}
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index a44c68e0fc..4d5e6fffe1 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -403,7 +403,7 @@ int AgiEngine::testIfCode(int lognum) {
case 0xFF:
endTest = true;
continue;
-
+
default:
// Evaluate the command and skip the rest of the instruction
_agiCondCommands[op](state, p);
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index 29fb860635..7a427bd94f 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -130,7 +130,7 @@ AgiInstruction insV1[] = {
{ "...", "", &cmdUnknown }, // 4E # show.obj
{ "load.logics", "n", &cmdLoadLogic }, // 4F # load.global.logics
{ "display", "nnns", &cmdDisplay }, // 50 TODO: 4 vs 3 args
- { "prevent.input???", "", &cmdUnknown }, // 51
+ { "prevent.input???", "", &cmdUnknown }, // 51
{ "...", "", &cmdUnknown }, // 52 # nop
{ "...", "n", &cmdUnknown }, // 53 # text.screen
{ "...", "", &cmdUnknown }, // 54 ???
diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp
deleted file mode 100644
index 4bb378934d..0000000000
--- a/engines/agi/predictive.cpp
+++ /dev/null
@@ -1,617 +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 "agi/agi.h"
-#include "agi/graphics.h"
-#include "agi/keyboard.h"
-
-#include "common/config-manager.h"
-#include "common/textconsole.h"
-
-#ifdef __DS__
-#include "wordcompletion.h"
-#endif
-
-namespace Agi {
-
-enum {
- kModePre = 0,
- kModeNum = 1,
- kModeAbc = 2
-};
-
-enum {
- MAXLINELEN = 80,
- MAXWORDLEN = 24
-};
-
-uint8 countWordsInString(char *str) {
- // Count the number of (space separated) words in the given string.
- char *ptr;
-
- if (!str)
- return 0;
-
- ptr = strchr(str, ' ');
- if (!ptr) {
- debug("Invalid dictionary line");
- return 0;
- }
-
- uint8 num = 1;
- ptr++;
- while ((ptr = strchr(ptr, ' '))) {
- ptr++;
- num++;
- }
- return num;
-}
-
-void bringWordtoTop(char *str, int wordnum) {
- // This function reorders the words on the given pred.dic line
- // by moving the word at position 'wordnum' to the front (that is, right behind
- // right behind the numerical code word at the start of the line).
- Common::Array<Common::String> words;
- char buf[MAXLINELEN];
-
- if (!str)
- return;
- strncpy(buf, str, MAXLINELEN);
- buf[MAXLINELEN - 1] = 0;
- char *word = strtok(buf, " ");
- if (!word) {
- debug("Invalid dictionary line");
- return;
- }
-
- words.push_back(word);
- while ((word = strtok(NULL, " ")) != NULL)
- words.push_back(word);
- words.insert_at(1, words.remove_at(wordnum + 1));
-
- Common::String tmp;
- for (uint8 i = 0; i < words.size(); i++)
- tmp += words[i] + " ";
- tmp.deleteLastChar();
- memcpy(str, tmp.c_str(), strlen(str));
-}
-
-bool AgiEngine::predictiveDialog() {
- uint8 x;
- int y;
- int bx[17], by[17];
- Common::String prefix;
- char temp[MAXWORDLEN + 1], repeatcount[MAXWORDLEN];
- AgiBlock tmpwindow;
- bool navigationwithkeys = false;
-
- const char *buttonStr[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" };
- const char *buttons[] = {
- "(1)'-.&", "(2)abc", "(3)def",
- "(4)ghi", "(5)jkl", "(6)mno",
- "(7)pqrs", "(8)tuv", "(9)wxyz",
- "(#)next", "add",
- "<",
- "Cancel", "OK",
- "(*)Pre", "(0) ", NULL
- };
- const int colors[] = {
- 15, 0, 15, 0, 15, 0,
- 15, 0, 15, 0, 15, 0,
- 15, 0, 15, 0, 15, 0,
- 15, 12, 15, 12,
- 15, 0,
- 15, 0, 15, 0,
- 14, 0, 15, 0, 0, 0
- };
- const char *modes[] = { "(*)Pre", "(*)123", "(*)Abc" };
-
- // FIXME: Move this to a more appropriate place.
- if (!_predictiveDictText) {
- loadDict();
- if (!_predictiveDictText)
- return false;
- }
- _predictiveDictActLine = NULL;
- uint8 numMatchingWords = 0;
-
- _predictiveDialogRunning = true;
- _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, true);
-
- memset(repeatcount, 0, sizeof(repeatcount));
-
- // show the predictive dialog.
- // if another window is already in display, save its state into tmpwindow
- memset(&tmpwindow, 0, sizeof(tmpwindow));
- tmpwindow.active = false;
- if (_game.window.active)
- memcpy(&tmpwindow, &(_game.window), sizeof(AgiBlock));
- drawWindow(50, 40, 269, 159);
- _gfx->drawRectangle(62, 54, 249, 66, MSG_BOX_TEXT);
- _gfx->flushBlock(62, 54, 249, 66);
-
- bx[15] = 73; // Zero/space
- by[15] = 120;
- bx[9] = 110; // next
- by[9] = 120;
- bx[10] = 172; // add
- by[10] = 120;
- bx[14] = 200; // Mode
- by[14] = 120;
- bx[11] = 252; // Backspace
- by[11] = 57;
- bx[12] = 180; // Cancel
- by[12] = 140;
- bx[13] = 240; // OK
- by[13] = 140;
-
- x = 73;
- y = 75;
- for (int i = 0; i < 9; i++) {
- bx[i] = x;
- by[i] = y;
- x += 60;
- if (i % 3 == 2) {
- y += 15;
- x = 73;
- }
- }
-
- clearKeyQueue();
-
- prefix.clear();
- _currentCode.clear();
- _currentWord.clear();
- _wordNumber = 0;
-
- int mode = kModePre;
-
- bool needRefresh = true;
- int active = -1, lastactive = 0;
- bool rc = false;
- bool closeDialog = false;
- bool enterPredictiveResult = false;
- while (!closeDialog && !shouldQuit()) {
- if (needRefresh) {
- for (int i = 0; buttons[i]; i++) {
- int color1 = colors[i * 2];
- int color2 = colors[i * 2 + 1];
-
- if (i == 9 && !((mode != kModeAbc && _predictiveDictActLine && numMatchingWords > 1)
- || (mode == kModeAbc && _currentWord.size() && _currentWord.lastChar() != ' '))) { // Next
- color2 = 7;
- }
-
- // needs fixing, or remove it!
- bool _addIsActive = false; // FIXME: word adding is not implemented
- if (i == 10 && !_addIsActive) { // Add
- color2 = 7;
- }
- if (i == 14) {
- _gfx->drawDefaultStyleButton(bx[i], by[i], modes[mode], i == active, 0, color1, color2);
- } else {
- _gfx->drawDefaultStyleButton(bx[i], by[i], buttons[i], i == active, 0, color1, color2);
- }
- }
-
- Common::strlcpy(temp, prefix.c_str(), sizeof(temp));
- Common::strlcat(temp, _currentWord.c_str(), sizeof(temp));
-
- for (int i = prefix.size() + _currentCode.size(); i < MAXWORDLEN; i++)
- temp[i] = ' ';
- temp[MAXWORDLEN] = 0;
-
- printText(temp, 0, 8, 7, MAXWORDLEN, 15, 0);
- _gfx->flushBlock(62, 54, 249, 66);
-
- if (active >= 0 && !navigationwithkeys) {
- // provide visual feedback only when not navigating with the arrows
- // so that the user can see the active button.
- active = -1;
- needRefresh = true;
- } else
- needRefresh = false;
-
- _gfx->doUpdate();
- }
-
- bool processkey = false;
-
- pollTimer();
- int key = doPollKeyboard();
- switch (key) {
- case KEY_ENTER:
- if (navigationwithkeys) {
- // when the user has utilized arrow key navigation,
- // interpret enter as 'click' on the active button
- active = lastactive;
- } else {
- // else it is a shortcut for 'Ok'
- active = 13;
- }
- processkey = true;
- break;
- case KEY_ESCAPE:
- rc = false;
- closeDialog = true;
- break;
- case BUTTON_LEFT:
- navigationwithkeys = false;
- for (int i = 0; buttons[i]; i++) {
- if (_gfx->testButton(bx[i], by[i], buttons[i])) {
- active = i;
- processkey = true;
- break;
- }
- }
- break;
- case KEY_BACKSPACE:
- active = 11;
- processkey = true;
- break;
- case '#':
- active = 9;
- processkey = true;
- break;
- case '*':
- active = 14;
- processkey = true;
- break;
- case 0x09: // Tab
- navigationwithkeys = true;
- debugC(3, kDebugLevelText, "Focus change");
- lastactive = active = lastactive + 1;
- active %= ARRAYSIZE(buttons) - 1;
- needRefresh = true;
- break;
- case KEY_LEFT:
- navigationwithkeys = true;
- if (lastactive == 0 || lastactive == 3 || lastactive == 6)
- active = lastactive + 2;
- else if (lastactive == 9)
- active = 15;
- else if (lastactive == 11)
- active = 11;
- else if (lastactive == 12)
- active = 13;
- else if (lastactive == 14)
- active = 10;
- else
- active = lastactive - 1;
- lastactive = active;
- needRefresh = true;
- break;
- case KEY_RIGHT:
- navigationwithkeys = true;
- if (lastactive == 2 || lastactive == 5 || lastactive == 8)
- active = lastactive - 2;
- else if (lastactive == 10)
- active = 14;
- else if (lastactive == 11)
- active = 11;
- else if (lastactive == 13)
- active = 12;
- else if (lastactive == 15)
- active = 9;
- else
- active = lastactive + 1;
- lastactive = active;
- needRefresh = true;
- break;
- case KEY_UP:
- navigationwithkeys = true;
- if (lastactive <= 2)
- active = 11;
- else if (lastactive == 9 || lastactive == 10)
- active = lastactive - 2;
- else if (lastactive == 11)
- active = 13;
- else if (lastactive == 14)
- active = 8;
- else if (lastactive == 15)
- active = 6;
- else
- active = lastactive - 3;
- lastactive = active;
- needRefresh = true;
- break;
- case KEY_DOWN:
- navigationwithkeys = true;
- if (lastactive == 6)
- active = 15;
- else if (lastactive == 7 || lastactive == 8)
- active = lastactive + 2;
- else if (lastactive == 11)
- active = 0;
- else if (lastactive == 12 || lastactive == 13)
- active = 11;
- else if (lastactive == 14 || lastactive == 15)
- active = lastactive - 2;
- else
- active = lastactive + 3;
- lastactive = active;
- needRefresh = true;
- break;
- default:
- // handle numeric buttons
- if (key >= '1' && key <= '9') {
- active = key - '1';
- processkey = true;
- } else if (key == '0') {
- active = 15;
- processkey = true;
- }
- break;
- }
-
- if (processkey && !closeDialog) {
- if (active >= 0) {
- needRefresh = true;
- lastactive = active;
- if (active == 15 && mode != kModeNum) { // Space
- // bring MRU word at the top of the list when changing words
- if (mode == kModePre && _predictiveDictActLine && numMatchingWords > 1 && _wordNumber != 0)
- bringWordtoTop(_predictiveDictActLine, _wordNumber);
- strncpy(temp, _currentWord.c_str(), _currentCode.size());
- temp[_currentCode.size()] = 0;
- prefix += temp;
- prefix += " ";
- _currentCode.clear();
- _currentWord.clear();
- numMatchingWords = 0;
- memset(repeatcount, 0, sizeof(repeatcount));
- } else if (active < 9 || active == 11 || active == 15) { // number or backspace
- if (active == 11) { // backspace
- if (_currentCode.size()) {
- repeatcount[_currentCode.size() - 1] = 0;
- _currentCode.deleteLastChar();
- } else {
- if (prefix.size())
- prefix.deleteLastChar();
- }
- } else if (prefix.size() + _currentCode.size() < MAXWORDLEN - 1) { // don't overflow the dialog line
- if (active == 15) { // zero
- _currentCode += buttonStr[9];
- } else {
- _currentCode += buttonStr[active];
- }
- }
-
- switch (mode) {
- case kModeNum:
- _currentWord = _currentCode;
- break;
- case kModePre:
- if (!matchWord() && _currentCode.size()) {
- _currentCode.deleteLastChar();
- matchWord();
- }
- numMatchingWords = countWordsInString(_predictiveDictActLine);
- break;
- case kModeAbc:
- for (x = 0; x < _currentCode.size(); x++)
- if (_currentCode[x] >= '1')
- temp[x] = buttons[_currentCode[x] - '1'][3 + repeatcount[x]];
- temp[_currentCode.size()] = 0;
- _currentWord = temp;
- }
- } else if (active == 9) { // next
- if (mode == kModePre) {
- if (_predictiveDictActLine && numMatchingWords > 1) {
- _wordNumber = (_wordNumber + 1) % numMatchingWords;
- char tmp[MAXLINELEN];
- strncpy(tmp, _predictiveDictActLine, MAXLINELEN);
- tmp[MAXLINELEN - 1] = 0;
- char *tok = strtok(tmp, " ");
- for (uint8 i = 0; i <= _wordNumber; i++)
- tok = strtok(NULL, " ");
- _currentWord = Common::String(tok, _currentCode.size());
- }
- } else if (mode == kModeAbc){
- x = _currentCode.size();
- if (x) {
- if (_currentCode.lastChar() == '1' || _currentCode.lastChar() == '7' || _currentCode.lastChar() == '9')
- repeatcount[x - 1] = (repeatcount[x - 1] + 1) % 4;
- else
- repeatcount[x - 1] = (repeatcount[x - 1] + 1) % 3;
- if (_currentCode.lastChar() >= '1')
- _currentWord.setChar(buttons[_currentCode[x - 1] - '1'][3 + repeatcount[x - 1]], x-1);
- }
- }
- } else if (active == 10) { // add
- debug(0, "add");
- } else if (active == 13) { // Ok
- // bring MRU word at the top of the list when ok'ed out of the dialog
- if (mode == kModePre && _predictiveDictActLine && numMatchingWords > 1 && _wordNumber != 0)
- bringWordtoTop(_predictiveDictActLine, _wordNumber);
- rc = true;
- enterPredictiveResult = true;
- closeDialog = true;
- } else if (active == 14) { // Mode
- mode++;
- if (mode > kModeAbc)
- mode = kModePre;
-
- // truncate current input at mode change
- strncpy(temp, _currentWord.c_str(), _currentCode.size());
- temp[_currentCode.size()] = 0;
- prefix += temp;
- _currentCode.clear();
- _currentWord.clear();
- memset(repeatcount, 0, sizeof(repeatcount));
- _predictiveDictActLine = NULL;
- } else {
- enterPredictiveResult = true;
- closeDialog = true;
- }
- }
- }
- }
-
- if (enterPredictiveResult) {
- Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult));
- Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult));
- }
-
- // if another window was shown, bring it up again
- if (!tmpwindow.active)
- closeWindow();
- else {
- _gfx->restoreBlock(_game.window.x1, _game.window.y1,
- _game.window.x2, _game.window.y2, _game.window.buffer);
-
- free(_game.window.buffer);
- memcpy(&(_game.window), &tmpwindow, sizeof(AgiBlock));
- _gfx->doUpdate();
- }
-
- _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, false);
- _predictiveDialogRunning = false;
-
- return rc;
-}
-
-void AgiEngine::loadDict() {
- Common::File inFile;
- int lines = 0;
-
- ConfMan.registerDefault("predictive_dictionary", "pred.dic");
-
- uint32 time1 = _system->getMillis();
- Common::String inFileName(ConfMan.get("predictive_dictionary"));
- if (!inFile.open(inFileName))
- return;
-
- char *ptr;
- int size = inFile.size();
-
- _predictiveDictText = (char *)malloc(size + 1);
- if (!_predictiveDictText) {
- warning("Not enough memory to load the predictive dictionary");
- return;
- }
- inFile.read(_predictiveDictText, size);
- _predictiveDictText[size] = 0;
- uint32 time2 = _system->getMillis();
- debug("Time to read %s: %d bytes, %d ms", inFileName.c_str(), size, time2-time1);
- inFile.close();
-
- ptr = _predictiveDictText;
- lines = 1;
- while ((ptr = strchr(ptr, '\n'))) {
- lines++;
- ptr++;
- }
-
- _predictiveDictLine = (char **)calloc(1, sizeof(char *) * lines);
- if (_predictiveDictLine == NULL) {
- warning("Cannot allocate memory for line index buffer");
- return;
- }
- _predictiveDictLine[0] = _predictiveDictText;
- ptr = _predictiveDictText;
- int i = 1;
- while ((ptr = strchr(ptr, '\n'))) {
- *ptr = 0;
- ptr++;
-#ifdef __DS__
- // Pass the line on to the DS word list
- DS::addAutoCompleteLine(_predictiveDictLine[i - 1]);
-#endif
- _predictiveDictLine[i++] = ptr;
- }
- if (_predictiveDictLine[lines - 1][0] == 0)
- lines--;
-
- _predictiveDictLineCount = lines;
- debug("Loaded %d lines", _predictiveDictLineCount);
-
- // FIXME: We use binary search on _predictiveDictLine, yet we make no attempt
- // to ever sort this array (except for the DS port). That seems risky, doesn't it?
-
-#ifdef __DS__
- // Sort the DS word completion list, to allow for a binary chop later (in the ds backend)
- DS::sortAutoCompleteWordList();
-#endif
-
- uint32 time3 = _system->getMillis();
- debug("Time to parse pred.dic: %d, total: %d", time3-time2, time3-time1);
-}
-
-bool AgiEngine::matchWord() {
- // If no text has been entered, then there is no match.
- if (_currentCode.empty())
- return false;
-
- // If the currently entered text is too long, it cannot match anything.
- if (_currentCode.size() > MAXWORDLEN)
- return false;
-
- // The entries in the dictionary consist of a code, a space, and then
- // a space-separated list of words matching this code.
- // To exactly match a code, we therefore match the code plus the trailing
- // space in the dictionary.
- Common::String code = _currentCode + " ";
-
- // Perform a binary search on the dictionary.
- int hi = _predictiveDictLineCount - 1;
- int lo = 0;
- int line = 0;
- while (lo <= hi) {
- line = (lo + hi) / 2;
- int cmpVal = strncmp(_predictiveDictLine[line], code.c_str(), code.size());
- if (cmpVal > 0)
- hi = line - 1;
- else if (cmpVal < 0)
- lo = line + 1;
- else {
- break;
- }
- }
-
- bool partial = hi < lo;
- if (partial) {
- // Didn't find an exact match, but 'lo' now points to the first entry
- // lexicographically greater than the current code, so that will
- // be the first entry with the current code as a prefix, if it exists.
- line = lo;
- _predictiveDictActLine = NULL;
- } else {
- _predictiveDictActLine = _predictiveDictLine[line];
- }
-
- _currentWord.clear();
- _wordNumber = 0;
- if (0 == strncmp(_predictiveDictLine[line], _currentCode.c_str(), _currentCode.size())) {
- char tmp[MAXLINELEN];
- strncpy(tmp, _predictiveDictLine[line], MAXLINELEN);
- tmp[MAXLINELEN - 1] = 0;
- char *tok = strtok(tmp, " ");
- tok = strtok(NULL, " ");
- _currentWord = Common::String(tok, _currentCode.size());
- return true;
- } else {
- return false;
- }
-}
-
-} // End of namespace Agi
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 0ef6230374..d451a799a0 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -29,6 +29,10 @@
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/textconsole.h"
+#include "common/translation.h"
+
+#include "gui/saveload.h"
+
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
@@ -38,7 +42,7 @@
#include "agi/keyboard.h"
#include "agi/menu.h"
-#define SAVEGAME_VERSION 5
+#define SAVEGAME_VERSION 6
//
// Version 0 (Sarien): view table has 64 entries
@@ -47,6 +51,7 @@
// Version 3 (ScummVM): added AGIPAL save/load support
// Version 4 (ScummVM): added thumbnails and save creation date/time
// Version 5 (ScummVM): Added game md5
+// Version 6 (ScummVM): Added game played time
//
namespace Agi {
@@ -82,12 +87,14 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
uint16 saveTime = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
+ uint32 playTime = g_engine->getTotalPlayTime() / 1000;
out->writeUint32BE(saveDate);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save date (%d)", saveDate);
out->writeUint16BE(saveTime);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save time (%d)", saveTime);
- // TODO: played time
+ out->writeUint32BE(playTime);
+ debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing play time (%d)", playTime);
out->writeByte(_game.state);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing game state (%d)", _game.state);
@@ -294,7 +301,10 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
in->readUint32BE(); // save date
in->readUint16BE(); // save time
- // TODO: played time
+ if (saveVersion >= 6) {
+ uint32 playTime = in->readUint32BE();
+ g_engine->setTotalPlayTime(playTime * 1000);
+ }
}
_game.state = (State)in->readByte();
@@ -784,7 +794,78 @@ int AgiEngine::selectSlot() {
return rc;
}
+int AgiEngine::scummVMSaveLoadDialog(bool isSave) {
+ GUI::SaveLoadChooser *dialog;
+ Common::String desc;
+ int slot;
+
+ if (isSave) {
+ dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
+
+ slot = dialog->runModalWithCurrentTarget();
+ desc = dialog->getResultString();
+
+ if (desc.empty()) {
+ // create our own description for the saved game, the user didnt enter it
+ desc = dialog->createDefaultSaveDescription(slot);
+ }
+
+ if (desc.size() > 28)
+ desc = Common::String(desc.c_str(), 28);
+ } else {
+ dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
+ slot = dialog->runModalWithCurrentTarget();
+ }
+
+ delete dialog;
+
+ if (slot < 0)
+ return true;
+
+ if (isSave)
+ return doSave(slot, desc);
+ else
+ return doLoad(slot, false);
+}
+
+int AgiEngine::doSave(int slot, const Common::String &desc) {
+ Common::String fileName = getSavegameFilename(slot);
+ debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
+
+ // Make sure all graphics was blitted to screen. This fixes bug
+ // #2960567: "AGI: Ego partly erased in Load/Save thumbnails"
+ _gfx->doUpdate();
+
+ return saveGame(fileName, desc);
+}
+
+int AgiEngine::doLoad(int slot, bool showMessages) {
+ Common::String fileName = getSavegameFilename(slot);
+ debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
+
+ _sprites->eraseBoth();
+ _sound->stopSound();
+ closeWindow();
+
+ int result = loadGame(fileName);
+
+ if (result == errOK) {
+ if (showMessages)
+ messageBox("Game restored.");
+ _game.exitAllLogics = 1;
+ _menu->enableAll();
+ } else {
+ if (showMessages)
+ messageBox("Error restoring game.");
+ }
+
+ return result;
+}
+
int AgiEngine::saveGameDialog() {
+ if (!ConfMan.getBool("originalsaveload"))
+ return scummVMSaveLoadDialog(true);
+
char *desc;
const char *buttons[] = { "Do as I say!", "I regret", NULL };
char dstr[200];
@@ -854,14 +935,7 @@ int AgiEngine::saveGameDialog() {
return errOK;
}
- Common::String fileName = getSavegameFilename(_firstSlot + slot);
- debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
-
- // Make sure all graphics was blitted to screen. This fixes bug
- // #2960567: "AGI: Ego partly erased in Load/Save thumbnails"
- _gfx->doUpdate();
-
- int result = saveGame(fileName, desc);
+ int result = doSave(_firstSlot + slot, desc);
if (result == errOK)
messageBox("Game saved.");
@@ -872,6 +946,9 @@ int AgiEngine::saveGameDialog() {
}
int AgiEngine::saveGameSimple() {
+ if (!ConfMan.getBool("originalsaveload"))
+ return scummVMSaveLoadDialog(true);
+
Common::String fileName = getSavegameFilename(0);
int result = saveGame(fileName, "Default savegame");
@@ -881,7 +958,10 @@ int AgiEngine::saveGameSimple() {
}
int AgiEngine::loadGameDialog() {
- int rc, slot = 0;
+ if (!ConfMan.getBool("originalsaveload"))
+ return scummVMSaveLoadDialog(false);
+
+ int slot = 0;
int hm, vm, hp, vp; // box margins
int w;
@@ -907,37 +987,14 @@ int AgiEngine::loadGameDialog() {
return errOK;
}
- Common::String fileName = getSavegameFilename(_firstSlot + slot);
-
- if ((rc = loadGame(fileName)) == errOK) {
- messageBox("Game restored.");
- _game.exitAllLogics = 1;
- _menu->enableAll();
- } else {
- messageBox("Error restoring game.");
- }
-
- return rc;
+ return doLoad(_firstSlot + slot, true);
}
int AgiEngine::loadGameSimple() {
- int rc = 0;
-
- Common::String fileName = getSavegameFilename(0);
-
- _sprites->eraseBoth();
- _sound->stopSound();
- closeWindow();
-
- if ((rc = loadGame(fileName)) == errOK) {
- messageBox("Game restored.");
- _game.exitAllLogics = 1;
- _menu->enableAll();
- } else {
- messageBox("Error restoring game.");
- }
-
- return rc;
+ if (!ConfMan.getBool("originalsaveload"))
+ return scummVMSaveLoadDialog(false);
+ else
+ return doLoad(0, true);
}
void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index d21baa450f..5bffca5765 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -234,7 +234,7 @@ int SoundGenPCJr::getNextNote(int ch)
// if tone isn't touched.. it should be inited so it just plays silence
// return 0 if it's passing more data
// return -1 if it's passing nothing (end of data)
-int SoundGenPCJr::getNextNote_v2(int ch) {
+int SoundGenPCJr::getNextNote_v2(int ch) {
ToneChan *tpcm;
SndGenChan *chan;
const byte *data;
@@ -308,7 +308,7 @@ int SoundGenPCJr::getNextNote_v1(int ch) {
_channel[ch].attenuationCopy = 0x0F;
return -1;
}
-
+
// In the V1 player the default duration for a row is 3 ticks
if (duration > 0) {
duration--;
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 1886a74ab1..4877be2647 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -64,7 +64,7 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff,
// Note: there were extra checks for *m being a cursor character
// here (1, 2 or 3), which have been removed, as the cursor
- // character is no longer printed via this function.
+ // character is no longer printed via this function.
if (*m >= 0x20) {
int ypos = (y1 * CHAR_LINES) + yoff;
@@ -73,7 +73,7 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff,
if (xpos >= GFX_WIDTH)
continue;
-
+
_gfx->putTextCharacter(l, xpos, ypos, *m, fg, bg, checkerboard);
if (x1 > maxx)
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index 4400112247..9c5b3d349a 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -41,7 +41,7 @@ int AgiEngine::loadWords_v1(Common::File &f) {
int k;
debug(0, "Loading dictionary");
-
+
// Loop through alphabet, as words in the dictionary file are sorted by
// first character
f.seek(f.pos() + 26 * 2, SEEK_SET);
@@ -131,7 +131,7 @@ int AgiEngine::findWord(const char *word, int *flen) {
*flen = 0;
Common::Array<AgiWord *> &a = _game.words[c];
-
+
for (int i = 0; i < (int)a.size(); i++) {
int wlen = strlen(a[i]->word);
// Keep looking till we find the word itself, or the whole phrase.
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index d9f982a0fa..65f8dd1420 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -1265,7 +1265,7 @@ protected:
virtual void doOutput(const byte *src, uint len);
void clsCheck(WindowBlock *window);
- void quickLoadOrSave();
+ virtual void quickLoadOrSave();
byte *vc10_uncompressFlip(const byte *src, uint16 w, uint16 h);
byte *vc10_flip(const byte *src, uint16 w, uint16 h);
@@ -2060,6 +2060,7 @@ protected:
void windowBackSpace(WindowBlock *window);
virtual char *genSaveName(int slot);
+ virtual void quickLoadOrSave();
};
class AGOSEngine_FeebleDemo : public AGOSEngine_Feeble {
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 29d1b36e19..9176412e0e 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -260,9 +260,6 @@ bool MoviePlayerDXA::load() {
debug(0, "Playing video %s", videoName.c_str());
CursorMan.showMouse(false);
-
- _firstFrameOffset = _fileStream->pos();
-
return true;
}
@@ -271,6 +268,10 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
uint w = getWidth();
const Graphics::Surface *surface = decodeNextFrame();
+
+ if (!surface)
+ return;
+
byte *src = (byte *)surface->pixels;
dst += y * pitch + x;
@@ -281,7 +282,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
} while (--h);
if (hasDirtyPalette())
- setSystemPalette();
+ g_system->getPaletteManager()->setPalette(getPalette(), 0, 256);
}
void MoviePlayerDXA::playVideo() {
@@ -302,38 +303,11 @@ void MoviePlayerDXA::stopVideo() {
}
void MoviePlayerDXA::startSound() {
- uint32 offset, size;
-
- if (getSoundTag() == MKTAG('W','A','V','E')) {
- size = _fileStream->readUint32BE();
-
- if (_sequenceNum) {
- Common::File in;
-
- _fileStream->seek(size, SEEK_CUR);
-
- in.open("audio.wav");
- if (!in.isOpen()) {
- error("Can't read offset file 'audio.wav'");
- }
-
- in.seek(_sequenceNum * 8, SEEK_SET);
- offset = in.readUint32LE();
- size = in.readUint32LE();
-
- in.seek(offset, SEEK_SET);
- _bgSoundStream = Audio::makeWAVStream(in.readStream(size), DisposeAfterUse::YES);
- in.close();
- } else {
- _bgSoundStream = Audio::makeWAVStream(_fileStream->readStream(size), DisposeAfterUse::YES);
- }
- } else {
- _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(baseName);
- }
+ start();
if (_bgSoundStream != NULL) {
_vm->_mixer->stopHandle(_bgSound);
- _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream, -1, getVolume(), getBalance());
}
}
@@ -344,8 +318,7 @@ void MoviePlayerDXA::nextFrame() {
}
if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) {
- _fileStream->seek(_firstFrameOffset);
- _curFrame = -1;
+ rewind();
startSound();
}
@@ -374,13 +347,15 @@ bool MoviePlayerDXA::processFrame() {
copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch);
_vm->_system->unlockScreen();
- Common::Rational soundTime(_mixer->getSoundElapsedTime(_bgSound), 1000);
- if ((_bgSoundStream == NULL) || ((soundTime * getFrameRate()).toInt() / 1000 < getCurFrame() + 1)) {
+ uint32 soundTime = _mixer->getSoundElapsedTime(_bgSound);
+ uint32 nextFrameStartTime = ((Video::VideoDecoder::VideoTrack *)getTrack(0))->getNextFrameStartTime();
+
+ if ((_bgSoundStream == NULL) || soundTime < nextFrameStartTime) {
if (_bgSoundStream && _mixer->isSoundHandleActive(_bgSound)) {
- while (_mixer->isSoundHandleActive(_bgSound) && (soundTime * getFrameRate()).toInt() < getCurFrame()) {
+ while (_mixer->isSoundHandleActive(_bgSound) && soundTime < nextFrameStartTime) {
_vm->_system->delayMillis(10);
- soundTime = Common::Rational(_mixer->getSoundElapsedTime(_bgSound), 1000);
+ soundTime = _mixer->getSoundElapsedTime(_bgSound);
}
// In case the background sound ends prematurely, update
// _ticks so that we can still fall back on the no-sound
@@ -399,13 +374,44 @@ bool MoviePlayerDXA::processFrame() {
return false;
}
+void MoviePlayerDXA::readSoundData(Common::SeekableReadStream *stream) {
+ uint32 tag = stream->readUint32BE();
+
+ if (tag == MKTAG('W','A','V','E')) {
+ uint32 size = stream->readUint32BE();
+
+ if (_sequenceNum) {
+ Common::File in;
+
+ stream->skip(size);
+
+ in.open("audio.wav");
+ if (!in.isOpen()) {
+ error("Can't read offset file 'audio.wav'");
+ }
+
+ in.seek(_sequenceNum * 8, SEEK_SET);
+ uint32 offset = in.readUint32LE();
+ size = in.readUint32LE();
+
+ in.seek(offset, SEEK_SET);
+ _bgSoundStream = Audio::makeWAVStream(in.readStream(size), DisposeAfterUse::YES);
+ in.close();
+ } else {
+ _bgSoundStream = Audio::makeWAVStream(stream->readStream(size), DisposeAfterUse::YES);
+ }
+ } else {
+ _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(baseName);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// Movie player for Smacker movies
///////////////////////////////////////////////////////////////////////////////
MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
- : MoviePlayer(vm), SmackerDecoder(vm->_mixer) {
+ : MoviePlayer(vm), SmackerDecoder() {
debug(0, "Creating SMK cutscene player");
memset(baseName, 0, sizeof(baseName));
@@ -425,8 +431,6 @@ bool MoviePlayerSMK::load() {
CursorMan.showMouse(false);
- _firstFrameOffset = _fileStream->pos();
-
return true;
}
@@ -435,6 +439,10 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
uint w = getWidth();
const Graphics::Surface *surface = decodeNextFrame();
+
+ if (!surface)
+ return;
+
byte *src = (byte *)surface->pixels;
dst += y * pitch + x;
@@ -445,7 +453,7 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
} while (--h);
if (hasDirtyPalette())
- setSystemPalette();
+ g_system->getPaletteManager()->setPalette(getPalette(), 0, 256);
}
void MoviePlayerSMK::playVideo() {
@@ -458,6 +466,7 @@ void MoviePlayerSMK::stopVideo() {
}
void MoviePlayerSMK::startSound() {
+ start();
}
void MoviePlayerSMK::handleNextFrame() {
@@ -467,10 +476,8 @@ void MoviePlayerSMK::handleNextFrame() {
}
void MoviePlayerSMK::nextFrame() {
- if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) {
- _fileStream->seek(_firstFrameOffset);
- _curFrame = -1;
- }
+ if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo())
+ rewind();
if (!endOfVideo()) {
decodeNextFrame();
@@ -493,7 +500,7 @@ bool MoviePlayerSMK::processFrame() {
uint32 waitTime = getTimeToNextFrame();
- if (!waitTime) {
+ if (!waitTime && !endOfVideoTracks()) {
warning("dropped frame %i", getCurFrame());
return false;
}
diff --git a/engines/agos/animation.h b/engines/agos/animation.h
index 11936aa338..9e31fced6d 100644
--- a/engines/agos/animation.h
+++ b/engines/agos/animation.h
@@ -67,9 +67,6 @@ protected:
virtual void handleNextFrame();
virtual bool processFrame() = 0;
virtual void startSound() {}
-
-protected:
- uint32 _firstFrameOffset;
};
class MoviePlayerDXA : public MoviePlayer, Video::DXADecoder {
@@ -83,6 +80,9 @@ public:
void nextFrame();
virtual void stopVideo();
+protected:
+ void readSoundData(Common::SeekableReadStream *stream);
+
private:
void handleNextFrame();
bool processFrame();
diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp
index 87f51cfad2..262ae44f01 100644
--- a/engines/agos/charset-fontdata.cpp
+++ b/engines/agos/charset-fontdata.cpp
@@ -681,6 +681,51 @@ static const byte feeble_windowFont[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
+void AGOSEngine_Feeble::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
+ const byte *src;
+ byte color, *dst;
+ uint dstPitch, h, w, i;
+
+ if (_noOracleScroll)
+ return;
+
+ _videoLockOut |= 0x8000;
+
+ dst = getBackGround();
+ dstPitch = _backGroundBuf->pitch;
+ h = 13;
+ w = getFeebleFontSize(chr);
+
+ if (_language == Common::PL_POL) {
+ if (!strcmp(getExtra(), "4CD"))
+ src = polish4CD_feeble_windowFont + (chr - 32) * 13;
+ else
+ src = polish2CD_feeble_windowFont + (chr - 32) * 13;
+ } else {
+ src = feeble_windowFont + (chr - 32) * 13;
+ }
+ dst += y * dstPitch + x + window->textColumnOffset;
+
+ color = window->textColor;
+
+ do {
+ int8 b = *src++;
+ i = 0;
+ do {
+ if (b < 0) {
+ if (dst[i] == 0)
+ dst[i] = color;
+ }
+
+ b <<= 1;
+ } while (++i != w);
+ dst += dstPitch;
+ } while (--h);
+
+ _videoLockOut &= ~0x8000;
+}
+#endif
+
static const byte english_simon1AGAFontData[] = {
0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x50,0x20,0x10,0x40,0x88,0x30,0x40,0x00,0x88,0x20,0x00,0x00,0x50,0x20,0x00,0x00,0x50,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x50,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x05,
0x00,0x00,0x00,0x30,0x00,0x10,0x20,0x48,0x10,0x20,0x00,0x48,0x20,0x40,0x00,0x90,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,
@@ -1253,51 +1298,6 @@ void AGOSEngine::renderString(uint vgaSpriteId, uint color, uint width, uint hei
}
}
-void AGOSEngine_Feeble::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
- const byte *src;
- byte color, *dst;
- uint dstPitch, h, w, i;
-
- if (_noOracleScroll)
- return;
-
- _videoLockOut |= 0x8000;
-
- dst = getBackGround();
- dstPitch = _backGroundBuf->pitch;
- h = 13;
- w = getFeebleFontSize(chr);
-
- if (_language == Common::PL_POL) {
- if (!strcmp(getExtra(), "4CD"))
- src = polish4CD_feeble_windowFont + (chr - 32) * 13;
- else
- src = polish2CD_feeble_windowFont + (chr - 32) * 13;
- } else {
- src = feeble_windowFont + (chr - 32) * 13;
- }
- dst += y * dstPitch + x + window->textColumnOffset;
-
- color = window->textColor;
-
- do {
- int8 b = *src++;
- i = 0;
- do {
- if (b < 0) {
- if (dst[i] == 0)
- dst[i] = color;
- }
-
- b <<= 1;
- } while (++i != w);
- dst += dstPitch;
- } while (--h);
-
- _videoLockOut &= ~0x8000;
-}
-#endif
-
static const byte czech_simonFont[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x70, 0x70, 0x20, 0x20, 0x00, 0x20, 0x00,
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index ed26b96381..cc1c40c207 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -467,11 +467,7 @@ void AGOSEngine::delay(uint amount) {
memset(_saveLoadName, 0, sizeof(_saveLoadName));
sprintf(_saveLoadName, "Quick %d", _saveLoadSlot);
_saveLoadType = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2;
-
- // We should only allow a load or save when it was possible in original
- // This stops load/save during copy protection, conversations and cut scenes
- if (!_mouseHideCount && !_showPreposition)
- quickLoadOrSave();
+ quickLoadOrSave();
} else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_a) {
GUI::Dialog *_aboutDialog;
diff --git a/engines/agos/midiparser_s1d.cpp b/engines/agos/midiparser_s1d.cpp
index 9ca87436fc..bef7199a98 100644
--- a/engines/agos/midiparser_s1d.cpp
+++ b/engines/agos/midiparser_s1d.cpp
@@ -35,7 +35,7 @@ namespace AGOS {
class MidiParser_S1D : public MidiParser {
private:
byte *_data;
- bool _no_delta;
+ bool _noDelta;
struct Loop {
uint16 timer;
@@ -49,7 +49,7 @@ protected:
void resetTracking();
public:
- MidiParser_S1D() : _data(0), _no_delta(false) {}
+ MidiParser_S1D() : _data(0), _noDelta(false) {}
bool loadMusic(byte *data, uint32 size);
};
@@ -75,14 +75,14 @@ void MidiParser_S1D::chainEvent(EventInfo &info) {
}
void MidiParser_S1D::parseNextEvent(EventInfo &info) {
- info.start = _position._play_pos;
+ info.start = _position._playPos;
info.length = 0;
- info.delta = _no_delta ? 0 : readVLQ2(_position._play_pos);
- _no_delta = false;
+ info.delta = _noDelta ? 0 : readVLQ2(_position._playPos);
+ _noDelta = false;
- info.event = *_position._play_pos++;
+ info.event = *_position._playPos++;
if (!(info.event & 0x80)) {
- _no_delta = true;
+ _noDelta = true;
info.event |= 0x80;
}
@@ -94,34 +94,43 @@ void MidiParser_S1D::parseNextEvent(EventInfo &info) {
} else {
switch (info.command()) {
case 0x8: // note off
- info.basic.param1 = *_position._play_pos++;
+ info.basic.param1 = *_position._playPos++;
info.basic.param2 = 0;
break;
case 0x9: // note on
- info.basic.param1 = *_position._play_pos++;
- info.basic.param2 = *_position._play_pos++;
+ info.basic.param1 = *_position._playPos++;
+ info.basic.param2 = *_position._playPos++;
+ // Rewrite note on events with velocity 0 as note off events.
+ // This is the actual meaning of this, but theoretically this
+ // should not need to be rewritten, since all MIDI devices should
+ // interpret it like that. On the other hand all our MidiParser
+ // implementations do it and there seems to be code in MidiParser
+ // which relies on this for tracking active notes.
+ if (info.basic.param2 == 0) {
+ info.event = info.channel() | 0x80;
+ }
break;
case 0xA: { // loop control
// In case the stop mode(?) is set to 0x80 this will stop the
// track over here.
- const int16 loopIterations = int8(*_position._play_pos++);
+ const int16 loopIterations = int8(*_position._playPos++);
if (!loopIterations) {
- _loops[info.channel()].start = _position._play_pos;
+ _loops[info.channel()].start = _position._playPos;
} else {
if (!_loops[info.channel()].timer) {
if (_loops[info.channel()].start) {
_loops[info.channel()].timer = uint16(loopIterations);
- _loops[info.channel()].end = _position._play_pos;
+ _loops[info.channel()].end = _position._playPos;
// Go to the start of the loop
- _position._play_pos = _loops[info.channel()].start;
+ _position._playPos = _loops[info.channel()].start;
}
} else {
if (_loops[info.channel()].timer)
- _position._play_pos = _loops[info.channel()].start;
+ _position._playPos = _loops[info.channel()].start;
--_loops[info.channel()].timer;
}
}
@@ -141,13 +150,13 @@ void MidiParser_S1D::parseNextEvent(EventInfo &info) {
break;
case 0xC: // program change
- info.basic.param1 = *_position._play_pos++;
+ info.basic.param1 = *_position._playPos++;
info.basic.param2 = 0;
break;
case 0xD: // jump to loop end
if (_loops[info.channel()].end)
- _position._play_pos = _loops[info.channel()].end;
+ _position._playPos = _loops[info.channel()].end;
// We need to read the next midi event here. Since we can not
// safely pass this event to the MIDI event processing.
@@ -178,7 +187,7 @@ bool MidiParser_S1D::loadMusic(byte *data, uint32 size) {
pos += 1;
// And now we're at the actual data. Only one track.
- _num_tracks = 1;
+ _numTracks = 1;
_data = pos;
_tracks[0] = pos;
@@ -194,7 +203,7 @@ bool MidiParser_S1D::loadMusic(byte *data, uint32 size) {
void MidiParser_S1D::resetTracking() {
MidiParser::resetTracking();
// The first event never contains any delta.
- _no_delta = true;
+ _noDelta = true;
memset(_loops, 0, sizeof(_loops));
}
diff --git a/engines/agos/module.mk b/engines/agos/module.mk
index 7ae5e17bf2..7069d8005b 100644
--- a/engines/agos/module.mk
+++ b/engines/agos/module.mk
@@ -51,7 +51,6 @@ ifdef ENABLE_AGOS2
MODULE_OBJS += \
animation.o \
feeble.o \
- installshield_cab.o \
oracle.o \
script_dp.o \
script_ff.o \
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 0305879390..2e44a6575c 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -23,6 +23,8 @@
// Resource file routines for Simon1/Simon2
+#include "common/archive.h"
+#include "common/installshield_cab.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/textconsole.h"
@@ -31,7 +33,6 @@
#include "agos/agos.h"
#include "agos/intern.h"
#include "agos/sound.h"
-#include "agos/installshield_cab.h"
#include "common/zlib.h"
@@ -43,7 +44,10 @@ ArchiveMan::ArchiveMan() {
#ifdef ENABLE_AGOS2
void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
- add(filename, makeInstallShieldArchive(filename), priority);
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(filename);
+
+ if (stream)
+ add(filename, makeInstallShieldArchive(stream, DisposeAfterUse::YES), priority);
}
#endif
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 4fbde09ff8..e13fa214d1 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -136,15 +136,46 @@ char *AGOSEngine::genSaveName(int slot) {
return buf;
}
+#ifdef ENABLE_AGOS2
+void AGOSEngine_Feeble::quickLoadOrSave() {
+ // Quick loading and saving isn't possible in The Feeble Files or Puzzle Pack.
+}
+#endif
+
+// The function uses segments of code from the original game scripts
+// to allow quick loading and saving, but isn't perfect.
+//
+// Unfortuntely this allows loading and saving in locations,
+// which aren't supported, and will not restore correctly:
+// Various locations in Elvira 1/2 and Waxworks where saving
+// was disabled
void AGOSEngine::quickLoadOrSave() {
- // Quick load & save is only supported complete version of Simon the Sorcerer 1/2
- if (getGameType() == GType_PP || getGameType() == GType_FF ||
- (getFeatures() & GF_DEMO)) {
+ bool success;
+ Common::String buf;
+
+ // Disable loading and saving when it was not possible in the original:
+ // In overhead maps areas in Simon the Sorcerer 2
+ // In the floppy disk demo of Simon the Sorcerer 1
+ // In copy protection, conversations and cut scenes
+ if ((getGameType() == GType_SIMON2 && _boxStarHeight == 200) ||
+ (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) ||
+ _mouseHideCount || _showPreposition) {
+ buf = Common::String::format("Quick load or save game isn't supported in this location");
+ GUI::MessageDialog dialog(buf, "OK");
+ dialog.runModal();
return;
}
- bool success;
- Common::String buf;
+ // Check if Simon is walking, and stop when required
+ if (getGameType() == GType_SIMON1 && getBitFlag(11)) {
+ vcStopAnimation(11, 1122);
+ animate(4, 11, 1122, 0, 0, 2);
+ waitForSync(1122);
+ } else if (getGameType() == GType_SIMON2 && getBitFlag(11)) {
+ vcStopAnimation(11, 232);
+ animate(4, 11, 232, 0, 0, 2);
+ waitForSync(1122);
+ }
char *filename = genSaveName(_saveLoadSlot);
if (_saveLoadType == 2) {
@@ -1393,7 +1424,7 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
// The floppy disk versions of Simon the Sorcerer 2 block changing
// to scrolling rooms, if the copy protection fails. But the copy
// protection flags are never set in the CD version.
- // Setting this copy protection flag, allows saved games to be shared
+ // Setting this copy protection flag, allows saved games to be shared
// between all versions of Simon the Sorcerer 2.
if (getGameType() == GType_SIMON2) {
setBitFlag(135, 1);
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index a07c05b4fc..03aad7ebb9 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -362,6 +362,15 @@ void AGOSEngine_Simon1::os1_screenTextMsg() {
stopAnimateSimon2(2, vgaSpriteId + 2);
}
+ // WORKAROUND: Several strings in the French version of Simon the Sorcerer 1 set the incorrect width,
+ // causing crashes, or glitches in subtitles. See bug #3512776 for example.
+ if (getGameType() == GType_SIMON1 && _language == Common::FR_FRA) {
+ if ((getFeatures() & GF_TALKIE) && stringId == 33219)
+ tl->width = 96;
+ if (!(getFeatures() & GF_TALKIE) && stringId == 33245)
+ tl->width = 96;
+ }
+
if (stringPtr != NULL && stringPtr[0] != 0 && (speechId == 0 || _subtitles))
printScreenText(vgaSpriteId, color, (const char *)stringPtr, tl->x, tl->y, tl->width);
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 85c449eafc..bec41bbbd3 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -297,7 +297,7 @@ Audio::AudioStream *RawSound::makeAudioStream(uint sound) {
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);
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 37f4eb070e..7089c8e0d1 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -94,7 +94,7 @@ Bitmap::Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 fill)
// Replicate across the entire table
for (HideDesc *hdP = b + 1; hdP < (b + _h); hdP++)
*hdP = *b;
-
+
b->_skip = 0; // fix the first entry
_v = v;
_b = b;
@@ -123,12 +123,15 @@ Bitmap::~Bitmap() {
Bitmap &Bitmap::operator=(const Bitmap &bmp) {
debugC(1, kCGEDebugBitmap, "&Bitmap::operator =");
+ if (this == &bmp)
+ return *this;
uint8 *v0 = bmp._v;
_w = bmp._w;
_h = bmp._h;
_m = NULL;
_map = 0;
+ _vm = bmp._vm;
delete[] _v;
if (v0 == NULL) {
@@ -158,7 +161,7 @@ BitmapPtr Bitmap::code() {
debugC(1, kCGEDebugBitmap, "Bitmap::code()");
if (!_m)
- return false;
+ return NULL;
uint16 cnt;
@@ -354,7 +357,7 @@ bool Bitmap::loadVBM(EncryptedStream *f) {
// Read in the palette
byte palData[kPalSize];
f->read(palData, kPalSize);
-
+
const byte *srcP = palData;
for (int idx = 0; idx < kPalCount; idx++, srcP += 3) {
_vm->_bitmapPalette[idx]._r = *srcP;
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 875ac34cd0..6cc0c45963 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -30,6 +30,8 @@
#include "common/fs.h"
#include "engines/advancedDetector.h"
#include "engines/util.h"
+#include "gui/message.h"
+
#include "cge/cge.h"
#include "cge/vga13h.h"
#include "cge/cge_main.h"
@@ -50,7 +52,6 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
DebugMan.addDebugChannel(kCGEDebugEngine, "engine", "CGE Engine debug channel");
_startupMode = 1;
- _demoText = kDemo;
_oldLev = 0;
_pocPtr = 0;
_bitmapPalette = NULL;
@@ -122,7 +123,7 @@ void CGEEngine::init() {
_maxScene = 0;
_dark = false;
_game = false;
- _finis = false;
+ _endGame = false;
_now = 1;
_lev = -1;
_recentStep = -2;
@@ -134,7 +135,6 @@ void CGEEngine::init() {
_soundOk = 1;
_sprTv = NULL;
_gameCase2Cpt = 0;
- _offUseCount = 0;
_startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
@@ -196,6 +196,16 @@ Common::Error CGEEngine::run() {
// Run the game
cge_main();
+ // If game is finished, display ending message
+ if (_flag[3]) {
+ Common::String msg = Common::String(_text->getText(kSayTheEnd));
+ if (msg.size() != 0) {
+ g_system->delayMillis(10);
+ GUI::MessageDialog dialog(msg, "OK");
+ dialog.runModal();
+ }
+ }
+
// Remove game objects
deinit();
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 4ebc836ee0..0e8c5a05bb 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -78,6 +78,8 @@ class Talk;
#define kMapZCnt 20
#define kMapTop 80
+#define kSayTheEnd 41
+
// our engine debug channels
enum {
kCGEDebugBitmap = 1 << 0,
@@ -147,7 +149,6 @@ public:
const ADGameDescription *_gameDescription;
int _startupMode;
- int _demoText;
int _oldLev;
int _pocPtr;
bool _music;
@@ -157,7 +158,7 @@ public:
bool _flag[4];
bool _dark;
bool _game;
- bool _finis;
+ bool _endGame;
int _now;
int _lev;
int _mode;
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index fd7dd85c57..f4f1cd3e0b 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -150,11 +150,11 @@ void CGEEngine::sndSetVolume() {
void CGEEngine::syncHeader(Common::Serializer &s) {
debugC(1, kCGEDebugEngine, "CGEEngine::syncHeader(s)");
- int i;
+ int i = kDemo;
s.syncAsUint16LE(_now);
s.syncAsUint16LE(_oldLev);
- s.syncAsUint16LE(_demoText);
+ s.syncAsUint16LE(i); // unused Demo string id
for (i = 0; i < 5; i++)
s.syncAsUint16LE(_game);
s.syncAsSint16LE(i); // unused VGA::Mono variable
@@ -207,7 +207,7 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
readStream = new Common::MemoryReadStream(dataBuffer, size, DisposeAfterUse::YES);
} else {
- // Open up the savgame file
+ // Open up the savegame file
Common::String slotName = generateSaveName(slotNumber);
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
@@ -216,6 +216,7 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
byte *dataBuffer = (byte *)malloc(size);
saveFile->read(dataBuffer, size);
readStream = new Common::MemoryReadStream(dataBuffer, size, DisposeAfterUse::YES);
+ delete saveFile;
}
// Check to see if it's a ScummVM savegame or not
@@ -279,7 +280,7 @@ Common::Error CGEEngine::loadGameState(int slot) {
sceneDown();
_hero->park();
resetGame();
-
+
// If music is playing, kill it.
if (_music)
_midiPlayer->killMidi();
@@ -304,12 +305,21 @@ Common::Error CGEEngine::saveGameState(int slot, const Common::String &desc) {
_hero->park();
_oldLev = _lev;
+ int x = _hero->_x;
+ int y = _hero->_y;
+ int z = _hero->_z;
+
// Write out the user's progress
saveGame(slot, desc);
+ _commandHandler->addCommand(kCmdLevel, -1, _oldLev, &_sceneLight);
// Reload the scene
sceneUp();
+ // Restore player position
+ _hero->gotoxy(x, y);
+ _hero->_z = z;
+
return Common::kNoError;
}
@@ -430,11 +440,8 @@ bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &heade
// Get the thumbnail
header.thumbnail = Graphics::loadThumbnail(*in);
- if (!header.thumbnail) {
- delete header.thumbnail;
- header.thumbnail = NULL;
+ if (!header.thumbnail)
return false;
- }
// Read in save date/time
header.saveYear = in->readSint16LE();
@@ -501,7 +508,7 @@ void CGEEngine::loadMapping() {
if (!cf.err()) {
// Move to the data for the given room
cf.seek((_now - 1) * kMapArrSize);
-
+
// Read in the data
for (int z = 0; z < kMapZCnt; ++z) {
cf.read(&_clusterMap[z][0], kMapXCnt);
@@ -520,8 +527,8 @@ Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
setShapeList(MB);
}
-void Square::touch(uint16 mask, int x, int y) {
- Sprite::touch(mask, x, y);
+void Square::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
+ Sprite::touch(mask, x, y, keyCode);
if (mask & kMouseLeftUp) {
_vm->XZ(_x + x, _y + y).cell() = 0;
_vm->_commandHandlerTurbo->addCommand(kCmdKill, -1, 0, this);
@@ -708,7 +715,7 @@ void CGEEngine::qGame() {
saveGame(0, Common::String("Automatic Savegame"));
_vga->sunset();
- _finis = true;
+ _endGame = true;
}
void CGEEngine::switchScene(int newScene) {
@@ -760,12 +767,12 @@ void System::funTouch() {
_funDel = n;
}
-void System::touch(uint16 mask, int x, int y) {
+void System::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
funTouch();
if (mask & kEventKeyb) {
- if (x == Common::KEYCODE_ESCAPE) {
- // The original was calling keyClick()
+ if (keyCode == Common::KEYCODE_ESCAPE) {
+ // The original was calling keyClick()
// The sound is uselessly annoying and noisy, so it has been removed
_vm->killText();
if (_vm->_startupMode == 1) {
@@ -928,7 +935,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) {
}
#pragma argsused
-void Sprite::touch(uint16 mask, int x, int y) {
+void Sprite::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
_vm->_sys->funTouch();
if ((mask & kEventAttn) != 0)
@@ -1037,7 +1044,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
uint16 len;
for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
- len = line.size();
+ len = line.size();
lcnt++;
strcpy(tmpStr, line.c_str());
if (len == 0 || *tmpStr == '.')
@@ -1314,7 +1321,7 @@ void CGEEngine::runGame() {
_sceneLight->_flags._tran = true;
_vga->_showQ->append(_sceneLight);
- _sceneLight->_flags._hide = true;
+ _sceneLight->_flags._hide = false;
const Seq pocSeq[] = {
{ 0, 0, 0, 0, 20 },
@@ -1405,14 +1412,14 @@ void CGEEngine::runGame() {
_keyboard->setClient(_sys);
// main loop
- while (!_finis && !_quitFlag) {
- if (_flag[3])
+ while (!_endGame && !_quitFlag) {
+ if (_flag[3]) // Flag FINIS
_commandHandler->addCallback(kCmdExec, -1, 0, kQGame);
mainLoop();
}
// If finishing game due to closing ScummVM window, explicitly save the game
- if (!_finis && canSaveGameStateCurrently())
+ if (!_endGame && canSaveGameStateCurrently())
qGame();
_keyboard->setClient(NULL);
@@ -1509,22 +1516,9 @@ bool CGEEngine::showTitle(const char *name) {
_vga->_showQ->clear();
_vga->copyPage(0, 2);
- if (_mode == 0) {
-// The auto-load of savegame #0 is currently disabled
-#if 0
- if (savegameExists(0)) {
- // Load the savegame
- loadGame(0, NULL, true); // only system vars
- _vga->setColors(_vga->_sysPal, 64);
- _vga->update();
- if (_flag[3]) { //flag FINIS
- _mode++;
- _flag[3] = false;
- }
- } else
-#endif
- _mode++;
- }
+ // The original was automatically loading the savegame when available
+ if (_mode == 0)
+ _mode++;
}
if (_mode < 2)
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index 87199ee524..bde8306f36 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -78,7 +78,7 @@ namespace CGE {
#define kScrHeight 200
#define kWorldHeight (kScrHeight - kPanHeight)
#define kStackSize 2048
-#define kSavegameCheckSum (1956 + _now + _oldLev + _game + _music + _demoText)
+#define kSavegameCheckSum (1956 + _now + _oldLev + _game + _music + kDemo)
#define kSavegame0Name ("{{INIT}}" kSvgExt)
#define kSavegameStrSize 11
#define kGameFrameDelay (1000 / 50)
@@ -92,7 +92,7 @@ public:
void setPal();
void funTouch();
- virtual void touch(uint16 mask, int x, int y);
+ virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
void tick();
private:
CGEEngine *_vm;
@@ -101,7 +101,7 @@ private:
class Square : public Sprite {
public:
Square(CGEEngine *vm);
- virtual void touch(uint16 mask, int x, int y);
+ virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
private:
CGEEngine *_vm;
};
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index b3ef31f30f..3d6c24d68b 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -108,7 +108,7 @@ public:
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
- return detectGameFilebased(allFiles, CGE::fileBasedFallback);
+ return detectGameFilebased(allFiles, fslist, CGE::fileBasedFallback);
}
virtual const char *getName() const {
@@ -177,7 +177,10 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const {
// Valid savegame
if (CGE::CGEEngine::readSavegameHeader(file, header)) {
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
- delete header.thumbnail;
+ if (header.thumbnail) {
+ header.thumbnail->free();
+ delete header.thumbnail;
+ }
}
} else {
// Must be an original format savegame
@@ -195,7 +198,7 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const {
SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::String fileName = Common::String::format("%s.%03d", target, slot);
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName);
-
+
if (f) {
CGE::SavegameHeader header;
@@ -214,8 +217,6 @@ SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int sl
} else {
// Create the return descriptor
SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
desc.setThumbnail(header.thumbnail);
desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay);
desc.setSaveTime(header.saveHour, header.saveMinutes);
@@ -228,7 +229,7 @@ SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int sl
return desc;
}
}
-
+
return SaveStateDescriptor();
}
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index 3c561c5659..1530c870ef 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -55,7 +55,7 @@ Sprite *Keyboard::setClient(Sprite *spr) {
bool Keyboard::getKey(Common::Event &event) {
Common::KeyCode keycode = event.kbd.keycode;
- if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT))
+ if (((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) && event.type == Common::EVENT_KEYDOWN)
_keyAlt = true;
else
_keyAlt = false;
@@ -70,12 +70,8 @@ bool Keyboard::getKey(Common::Event &event) {
return false;
case Common::KEYCODE_F5:
if (_vm->canSaveGameStateCurrently()) {
- const EnginePlugin *plugin = NULL;
- EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
-
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
- dialog->setSaveMode(true);
- int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true);
+ int16 savegameId = dialog->runModalWithCurrentTarget();
Common::String savegameDescription = dialog->getResultString();
delete dialog;
@@ -85,12 +81,8 @@ bool Keyboard::getKey(Common::Event &event) {
return false;
case Common::KEYCODE_F7:
if (_vm->canLoadGameStateCurrently()) {
- const EnginePlugin *plugin = NULL;
- EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
-
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
- dialog->setSaveMode(false);
- int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false);
+ int16 savegameId = dialog->runModalWithCurrentTarget();
delete dialog;
if (savegameId != -1)
@@ -117,9 +109,19 @@ bool Keyboard::getKey(Common::Event &event) {
case Common::KEYCODE_3:
case Common::KEYCODE_4:
if (event.kbd.flags & Common::KBD_ALT) {
- _vm->_commandHandler->addCommand(kCmdLevel, -1, keycode - '0', NULL);
+ _vm->_commandHandler->addCommand(kCmdLevel, -1, keycode - Common::KEYCODE_0, NULL);
return false;
}
+ // Fallthrough intended
+ case Common::KEYCODE_5:
+ case Common::KEYCODE_6:
+ case Common::KEYCODE_7:
+ case Common::KEYCODE_8:
+ if (event.type == Common::EVENT_KEYDOWN && !(event.kbd.flags & Common::KBD_ALT) && keycode != Common::KEYCODE_0) {
+ _vm->selectPocket(keycode - Common::KEYCODE_1);
+ return false;
+ }
+ break;
default:
break;
}
@@ -133,9 +135,11 @@ void Keyboard::newKeyboard(Common::Event &event) {
if ((event.type == Common::EVENT_KEYDOWN) && (_client)) {
CGEEvent &evt = _vm->_eventManager->getNextEvent();
- evt._x = event.kbd.keycode; // Keycode
- evt._mask = kEventKeyb; // Event mask
- evt._spritePtr = _client; // Sprite pointer
+ evt._x = 0;
+ evt._y = 0;
+ evt._keyCode = event.kbd.keycode; // Keycode
+ evt._mask = kEventKeyb; // Event mask
+ evt._spritePtr = _client; // Sprite pointer
}
}
@@ -202,6 +206,7 @@ void Mouse::newMouse(Common::Event &event) {
CGEEvent &evt = _vm->_eventManager->getNextEvent();
evt._x = event.mouse.x;
evt._y = event.mouse.y;
+ evt._keyCode = Common::KEYCODE_INVALID;
evt._spritePtr = _vm->spriteAt(evt._x, evt._y);
switch (event.type) {
@@ -267,7 +272,7 @@ void EventManager::handleEvents() {
CGEEvent e = _eventQueue[_eventQueueTail];
if (e._mask) {
if (_vm->_mouse->_hold && e._spritePtr != _vm->_mouse->_hold)
- _vm->_mouse->_hold->touch(e._mask | kEventAttn, e._x - _vm->_mouse->_hold->_x, e._y - _vm->_mouse->_hold->_y);
+ _vm->_mouse->_hold->touch(e._mask | kEventAttn, e._x - _vm->_mouse->_hold->_x, e._y - _vm->_mouse->_hold->_y, e._keyCode);
// update mouse cursor position
if (e._mask & kMouseRoll)
@@ -276,11 +281,11 @@ void EventManager::handleEvents() {
// activate current touched SPRITE
if (e._spritePtr) {
if (e._mask & kEventKeyb)
- e._spritePtr->touch(e._mask, e._x, e._y);
+ e._spritePtr->touch(e._mask, e._x, e._y, e._keyCode);
else
- e._spritePtr->touch(e._mask, e._x - e._spritePtr->_x, e._y - e._spritePtr->_y);
+ e._spritePtr->touch(e._mask, e._x - e._spritePtr->_x, e._y - e._spritePtr->_y, e._keyCode);
} else if (_vm->_sys)
- _vm->_sys->touch(e._mask, e._x, e._y);
+ _vm->_sys->touch(e._mask, e._x, e._y, e._keyCode);
if (e._mask & kMouseLeftDown) {
_vm->_mouse->_hold = e._spritePtr;
diff --git a/engines/cge/events.h b/engines/cge/events.h
index 6bbd52e4a5..ab8d87212d 100644
--- a/engines/cge/events.h
+++ b/engines/cge/events.h
@@ -70,6 +70,7 @@ struct CGEEvent {
uint16 _mask;
uint16 _x;
uint16 _y;
+ Common::KeyCode _keyCode;
Sprite *_spritePtr;
};
@@ -104,7 +105,7 @@ private:
void handleEvents();
public:
EventManager(CGEEngine *vm);
- void poll();
+ void poll();
void clearEvent(Sprite *spr);
CGEEvent &getNextEvent();
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index c50db4e929..609d5e86aa 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -98,7 +98,7 @@ uint16 ResourceManager::XCrypt(void *buf, uint16 length) {
for (uint16 i = 0; i < length; i++)
*b++ ^= kCryptSeed;
-
+
return kCryptSeed;
}
@@ -201,9 +201,28 @@ EncryptedStream::EncryptedStream(CGEEngine *vm, const char *name) : _vm(vm) {
_error = true;
_vm->_resman->seek(kp->_pos);
- byte *dataBuffer = (byte *)malloc(kp->_size);
- _vm->_resman->read(dataBuffer, kp->_size);
- _readStream = new Common::MemoryReadStream(dataBuffer, kp->_size, DisposeAfterUse::YES);
+ byte *dataBuffer;
+ int bufSize;
+
+ if ((strlen(name) > 4) && (scumm_stricmp(name + strlen(name) - 4, ".SPR") == 0)) {
+ // SPR files have some inconsistencies. Some have extra 0x1A at the end, some others
+ // do not have a carriage return at the end of the last line
+ // Therefore, we remove this ending 0x1A and add extra new lines.
+ // This fixes bug #3537527
+ dataBuffer = (byte *)malloc(kp->_size + 2);
+ _vm->_resman->read(dataBuffer, kp->_size);
+ if (dataBuffer[kp->_size - 1] == 0x1A)
+ dataBuffer[kp->_size - 1] = '\n';
+ dataBuffer[kp->_size] = '\n';
+ dataBuffer[kp->_size + 1] = '\n';
+ bufSize = kp->_size + 2;
+ } else {
+ dataBuffer = (byte *)malloc(kp->_size);
+ _vm->_resman->read(dataBuffer, kp->_size);
+ bufSize = kp->_size;
+ }
+
+ _readStream = new Common::MemoryReadStream(dataBuffer, bufSize, DisposeAfterUse::YES);
}
uint32 EncryptedStream::read(void *dataPtr, uint32 dataSize) {
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index 646689e99e..b378898955 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -91,6 +91,12 @@ void Sound::sndDigiStart(SmpInfo *PSmpInfo) {
// Start the new sound
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle,
Audio::makeLoopingAudioStream(_audioStream, (uint)PSmpInfo->_counter));
+
+ // CGE pan:
+ // 8 = Center
+ // Less = Left
+ // More = Right
+ _vm->_mixer->setChannelBalance(_soundHandle, (int8)CLIP(((PSmpInfo->_span - 8) * 16), -127, 127));
}
void Sound::stop() {
@@ -148,8 +154,11 @@ void Fx::preload(int ref0) {
DataCk *wav = loadWave(&file);
if (wav) {
Handler *p = &_cache[find(0)];
- if (p >= cacheLim)
+ if (p >= cacheLim) {
+ delete wav;
break;
+ }
+ delete p->_wav;
p->_wav = wav;
p->_ref = ref;
} else {
@@ -166,6 +175,7 @@ DataCk *Fx::load(int idx, int ref) {
DataCk *wav = loadWave(&file);
if (wav) {
Handler *p = &_cache[idx];
+ delete p->_wav;
p->_wav = wav;
p->_ref = ref;
} else {
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index fd4120d49d..a8ce8777c5 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -63,7 +63,7 @@ int16 Text::count() {
Common::String line;
char tmpStr[kLineMax + 1];
-
+
int counter = 0;
for (line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 186de24036..e178795b7c 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -637,15 +637,6 @@ Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _
_page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
}
-#if 0
- // This part was used to display credits at the beginning of the game
- for (int i = 10; i < 20; i++) {
- char *text = _text->getText(i);
- if (text) {
- debugN(1, "%s\n", text);
- }
- }
-#endif
_oldColors = (Dac *)malloc(sizeof(Dac) * kPalCount);
_newColors = (Dac *)malloc(sizeof(Dac) * kPalCount);
getColors(_oldColors);
@@ -834,7 +825,7 @@ void Vga::update() {
}
}
- g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
+ g_system->copyRectToScreen(Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
g_system->updateScreen();
}
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index beca19f667..a816f7756f 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -29,6 +29,7 @@
#define CGE_VGA13H_H
#include "common/serializer.h"
+#include "common/events.h"
#include "graphics/surface.h"
#include "cge/general.h"
#include "cge/bitmap.h"
@@ -146,7 +147,7 @@ public:
void step(int nr = -1);
Seq *setSeq(Seq *seq);
CommandHandler::Command *snList(SnList type);
- virtual void touch(uint16 mask, int x, int y);
+ virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
virtual void tick();
void sync(Common::Serializer &s);
private:
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
index a317a765d4..910e54d267 100644
--- a/engines/cge/vmenu.cpp
+++ b/engines/cge/vmenu.cpp
@@ -63,7 +63,7 @@ Vmenu *Vmenu::_addr = NULL;
int Vmenu::_recent = -1;
Vmenu::Vmenu(CGEEngine *vm, Choice *list, int x, int y)
- : Talk(vm, VMGather(list), kTBRect), _menu(list), _bar(NULL), _vm(vm) {
+ : Talk(vm, VMGather(list), kTBRect), _menu(list), _bar(NULL), _vmgt(NULL), _vm(vm) {
Choice *cp;
_addr = this;
@@ -89,11 +89,11 @@ Vmenu::~Vmenu() {
#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
-void Vmenu::touch(uint16 mask, int x, int y) {
+void Vmenu::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
if (!_items)
return;
- Sprite::touch(mask, x, y);
+ Sprite::touch(mask, x, y, keyCode);
y -= kTextVMargin - 1;
int n = 0;
diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h
index 89ef7a9484..928b48f11c 100644
--- a/engines/cge/vmenu.h
+++ b/engines/cge/vmenu.h
@@ -58,7 +58,7 @@ public:
MenuBar *_bar;
Vmenu(CGEEngine *vm, Choice *list, int x, int y);
~Vmenu();
- virtual void touch(uint16 mask, int x, int y);
+ virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
private:
char *_vmgt;
CGEEngine *_vm;
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index 410fcca1f3..075a59cfb6 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -202,13 +202,13 @@ AnimData::AnimData(const AnimData &src) : _width(src._width),
if (src._data) {
_data = new byte[_size];
assert(_data);
- memcpy(_data, src._data, _size*sizeof(byte));
+ memcpy(_data, src._data, _size * sizeof(byte));
}
if (src._mask) {
_mask = new byte[_size];
assert(_mask);
- memcpy(_mask, src._mask, _size*sizeof(byte));
+ memcpy(_mask, src._mask, _size * sizeof(byte));
}
memset(_name, 0, sizeof(_name));
@@ -272,8 +272,7 @@ byte AnimData::getColor(int x, int y) {
* @param transparent Transparent color (for ANIM_MASKSPRITE)
*/
void AnimData::load(byte *d, int type, uint16 w, uint16 h, int16 file,
- int16 frame, const char *n, byte transparent) {
-
+ int16 frame, const char *n, byte transparent) {
assert(d);
if (_data) {
@@ -299,7 +298,7 @@ void AnimData::load(byte *d, int type, uint16 w, uint16 h, int16 file,
_size = w * h;
_data = new byte[_size];
assert(_data);
- memcpy(_data, d, _size*sizeof(byte));
+ memcpy(_data, d, _size * sizeof(byte));
break;
case ANIM_MASK:
@@ -536,7 +535,7 @@ int loadSpl(const char *resourceName, int16 idx) {
entry = idx < 0 ? emptyAnimSpace() : idx;
assert(entry >= 0);
- g_cine->_animDataTable[entry].load(dataPtr, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize, 1, foundFileIdx, 0, currentPartName);
+ g_cine->_animDataTable[entry].load(dataPtr + 0x16, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize - 0x16, 1, foundFileIdx, 0, currentPartName);
free(dataPtr);
return entry + 1;
@@ -546,9 +545,10 @@ int loadSpl(const char *resourceName, int16 idx) {
* Load 1bpp mask
* @param resourceName Mask filename
* @param idx Target index in animDataTable (-1 if any empty space will do)
+ * @param frameIndex frame of animation to load (-1 for all frames)
* @return The number of the animDataTable entry after the loaded mask (-1 if error)
*/
-int loadMsk(const char *resourceName, int16 idx) {
+int loadMsk(const char *resourceName, int16 idx, int16 frameIndex) {
int16 foundFileIdx = findFileInBundle(resourceName);
if (foundFileIdx < 0) {
return -1;
@@ -563,9 +563,18 @@ int loadMsk(const char *resourceName, int16 idx) {
loadAnimHeader(animHeader, readS);
ptr = dataPtr + 0x16;
+ int16 startFrame = 0;
+ int16 endFrame = animHeader.numFrames;
+
+ if (frameIndex >= 0) {
+ startFrame = frameIndex;
+ endFrame = frameIndex + 1;
+ ptr += frameIndex * animHeader.frameWidth * animHeader.frameHeight;
+ }
+
entry = idx < 0 ? emptyAnimSpace() : idx;
assert(entry >= 0);
- for (int16 i = 0; i < animHeader.numFrames; i++, entry++) {
+ for (int16 i = startFrame; i < endFrame; i++, entry++) {
g_cine->_animDataTable[entry].load(ptr, ANIM_MASK, animHeader.frameWidth, animHeader.frameHeight, foundFileIdx, i, currentPartName);
ptr += animHeader.frameWidth * animHeader.frameHeight;
}
@@ -578,9 +587,10 @@ int loadMsk(const char *resourceName, int16 idx) {
* Load animation
* @param resourceName Animation filename
* @param idx Target index in animDataTable (-1 if any empty space will do)
+ * @param frameIndex frame of animation to load (-1 for all frames)
* @return The number of the animDataTable entry after the loaded animation (-1 if error)
*/
-int loadAni(const char *resourceName, int16 idx) {
+int loadAni(const char *resourceName, int16 idx, int16 frameIndex) {
int16 foundFileIdx = findFileInBundle(resourceName);
if (foundFileIdx < 0) {
return -1;
@@ -596,6 +606,15 @@ int loadAni(const char *resourceName, int16 idx) {
loadAnimHeader(animHeader, readS);
ptr = dataPtr + 0x16;
+ int16 startFrame = 0;
+ int16 endFrame = animHeader.numFrames;
+
+ if (frameIndex >= 0) {
+ startFrame = frameIndex;
+ endFrame = frameIndex + 1;
+ ptr += frameIndex * animHeader.frameWidth * animHeader.frameHeight;
+ }
+
transparentColor = getAnimTransparentColor(resourceName);
// TODO: Merge this special case hack into getAnimTransparentColor somehow.
@@ -609,7 +628,7 @@ int loadAni(const char *resourceName, int16 idx) {
entry = idx < 0 ? emptyAnimSpace() : idx;
assert(entry >= 0);
- for (int16 i = 0; i < animHeader.numFrames; i++, entry++) {
+ for (int16 i = startFrame; i < endFrame; i++, entry++) {
// special case transparency handling
if (!strcmp(resourceName, "L2202.ANI")) {
transparentColor = i < 2 ? 0 : 7;
@@ -669,22 +688,23 @@ void convert8BBP2(byte *dest, byte *source, int16 width, int16 height) {
*(source + k) <<= 1;
if (k > 0 + m)
color <<= 1;
- } // end k
+ } // end k
*(dest++) = color;
- } // end i
- } // end m
+ } // end i
+ } // end m
source += 0x10;
- } // end j
+ } // end j
}
/**
* Load image set
* @param resourceName Image set filename
* @param idx Target index in animDataTable (-1 if any empty space will do)
+ * @param frameIndex frame of animation to load (-1 for all frames)
* @return The number of the animDataTable entry after the loaded image set (-1 if error)
*/
-int loadSet(const char *resourceName, int16 idx) {
+int loadSet(const char *resourceName, int16 idx, int16 frameIndex = -1) {
AnimHeader2Struct header2;
uint16 numSpriteInAnim;
int16 foundFileIdx = findFileInBundle(resourceName);
@@ -708,7 +728,16 @@ int loadSet(const char *resourceName, int16 idx) {
entry = idx < 0 ? emptyAnimSpace() : idx;
assert(entry >= 0);
- for (int16 i = 0; i < numSpriteInAnim; i++, entry++) {
+ int16 startFrame = 0;
+ int16 endFrame = numSpriteInAnim;
+
+ if (frameIndex >= 0) {
+ startFrame = frameIndex;
+ endFrame = frameIndex + 1;
+ ptr += 0x10 * frameIndex;
+ }
+
+ for (int16 i = startFrame; i < endFrame; i++, entry++) {
Common::MemoryReadStream readS(ptr, 0x10);
header2.field_0 = readS.readUint32BE();
@@ -755,7 +784,7 @@ int loadSeq(const char *resourceName, int16 idx) {
byte *dataPtr = readBundleFile(foundFileIdx);
int entry = idx < 0 ? emptyAnimSpace() : idx;
- g_cine->_animDataTable[entry].load(dataPtr+0x16, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize-0x16, 1, foundFileIdx, 0, currentPartName);
+ g_cine->_animDataTable[entry].load(dataPtr + 0x16, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize - 0x16, 1, foundFileIdx, 0, currentPartName);
free(dataPtr);
return entry + 1;
}
@@ -767,18 +796,18 @@ int loadSeq(const char *resourceName, int16 idx) {
* @return The number of the animDataTable entry after the loaded resource (-1 if error)
* @todo Implement loading of all resource types
*/
-int loadResource(const char *resourceName, int16 idx) {
+int loadResource(const char *resourceName, int16 idx, int16 frameIndex) {
int result = -1; // Return an error by default
if (strstr(resourceName, ".SPL")) {
result = loadSpl(resourceName, idx);
} else if (strstr(resourceName, ".MSK")) {
- result = loadMsk(resourceName, idx);
+ result = loadMsk(resourceName, idx, frameIndex);
} else if (strstr(resourceName, ".ANI")) {
- result = loadAni(resourceName, idx);
+ result = loadAni(resourceName, idx, frameIndex);
} else if (strstr(resourceName, ".ANM")) {
- result = loadAni(resourceName, idx);
+ result = loadAni(resourceName, idx, frameIndex);
} else if (strstr(resourceName, ".SET")) {
- result = loadSet(resourceName, idx);
+ result = loadSet(resourceName, idx, frameIndex);
} else if (strstr(resourceName, ".SEQ")) {
result = loadSeq(resourceName, idx);
} else if (strstr(resourceName, ".H32")) {
diff --git a/engines/cine/anim.h b/engines/cine/anim.h
index 9c06c260ce..c5130aab82 100644
--- a/engines/cine/anim.h
+++ b/engines/cine/anim.h
@@ -98,7 +98,7 @@ public:
void freeAnimDataTable();
void freeAnimDataRange(byte startIdx, byte numIdx);
-int loadResource(const char *resourceName, int16 idx = -1);
+int loadResource(const char *resourceName, int16 idx = -1, int16 frameIndex = -1);
void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGameFormat saveGameFormat);
void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency);
diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp
index 693fea3294..36ecf53dea 100644
--- a/engines/cine/bg_list.cpp
+++ b/engines/cine/bg_list.cpp
@@ -39,9 +39,9 @@ uint32 var8;
* @param objIdx Sprite description
*/
void addToBGList(int16 objIdx) {
- renderer->incrustSprite(g_cine->_objectTable[objIdx]);
-
createBgIncrustListElement(objIdx, 0);
+
+ renderer->incrustSprite(g_cine->_bgIncrustList.back());
}
/**
@@ -49,9 +49,9 @@ void addToBGList(int16 objIdx) {
* @param objIdx Sprite description
*/
void addSpriteFilledToBGList(int16 objIdx) {
- renderer->incrustMask(g_cine->_objectTable[objIdx]);
-
createBgIncrustListElement(objIdx, 1);
+
+ renderer->incrustMask(g_cine->_bgIncrustList.back());
}
/**
@@ -103,9 +103,9 @@ void loadBgIncrustFromSave(Common::SeekableReadStream &fHandle) {
g_cine->_bgIncrustList.push_back(tmp);
if (tmp.param == 0) {
- renderer->incrustSprite(g_cine->_objectTable[tmp.objIdx]);
+ renderer->incrustSprite(tmp);
} else {
- renderer->incrustMask(g_cine->_objectTable[tmp.objIdx]);
+ renderer->incrustMask(tmp);
}
}
}
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 6b94c33c31..aa7221f733 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -189,6 +189,19 @@ void CineEngine::initialize() {
g_cine->_messageTable.clear();
resetObjectTable();
+ if (getGameType() == Cine::GType_OS) {
+ disableSystemMenu = 1;
+ } else {
+ // WORKAROUND: We do not save this variable in FW's savegames.
+ // Initializing this to 1, like we do it in the OS case, will
+ // cause the menu disabled when loading from the launcher or
+ // command line.
+ // A proper fix here would be to save this variable in FW's saves.
+ // Since it seems these are unversioned so far, there would be need
+ // to properly add versioning to them first.
+ disableSystemMenu = 0;
+ }
+
var8 = 0;
var2 = var3 = var4 = var5 = 0;
diff --git a/engines/cine/cine.h b/engines/cine/cine.h
index 55376dce29..47edf51c30 100644
--- a/engines/cine/cine.h
+++ b/engines/cine/cine.h
@@ -159,7 +159,7 @@ private:
bool _preLoad;
int _timerDelayMultiplier;
- public:
+public:
// TODO: These are pseudo-global vars
// They better belong to appropriate classes
Common::Array<AnimData> _animDataTable;
diff --git a/engines/cine/console.cpp b/engines/cine/console.cpp
index 0a24b2408a..4af28592e7 100644
--- a/engines/cine/console.cpp
+++ b/engines/cine/console.cpp
@@ -28,7 +28,7 @@ namespace Cine {
bool labyrinthCheat;
CineConsole::CineConsole(CineEngine *vm) : GUI::Debugger(), _vm(vm) {
- DCmd_Register("labyrinthCheat", WRAP_METHOD(CineConsole, Cmd_LabyrinthCheat));
+ DCmd_Register("labyrinthCheat", WRAP_METHOD(CineConsole, Cmd_LabyrinthCheat));
labyrinthCheat = false;
}
diff --git a/engines/cine/detection_tables.h b/engines/cine/detection_tables.h
index 0ec2768bae..bf02f0519c 100644
--- a/engines/cine/detection_tables.h
+++ b/engines/cine/detection_tables.h
@@ -251,7 +251,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs00", "d6752e7d25924cb866b61eb7cb0c8b56"),
Common::EN_GRB,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -267,7 +267,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs1", "9629129b86979fa592c1787385bf3695"),
Common::EN_GRB,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -281,7 +281,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs1", "d8c3a9d05a63e4cfa801826a7063a126"),
Common::EN_USA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -295,7 +295,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs00", "862a75d76fb7fffec30e52be9ad1c474"),
Common::EN_USA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -309,7 +309,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs1", "39b91ae35d1297ce0a76a1a803ca1593"),
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -323,7 +323,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs1", "74c2dabd9d212525fca8875a5f6d8994"),
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -341,7 +341,7 @@ static const CINEGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -355,7 +355,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs00", "f143567f08cfd1a9b1c9a41c89eadfef"),
Common::FR_FRA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -369,7 +369,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs1", "da066e6b8dd93f2502c2a3755f08dc12"),
Common::IT_ITA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO0()
},
GType_OS,
@@ -383,7 +383,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "a9da5531ead0ebf9ad387fa588c0cbb0"),
Common::EN_GRB,
Common::kPlatformAmiga,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -397,7 +397,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "8a429ced2f4acff8a15ae125174042e8"),
Common::EN_GRB,
Common::kPlatformAmiga,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -411,7 +411,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "d5f27e33fc29c879f36f15b86ccfa58c"),
Common::EN_USA,
Common::kPlatformAmiga,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -425,7 +425,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "8b7dce249821d3a62b314399c4334347"),
Common::DE_DEU,
Common::kPlatformAmiga,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -439,7 +439,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "35fc295ddd0af9da932d256ba799a4b0"),
Common::ES_ESP,
Common::kPlatformAmiga,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -453,7 +453,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "d4ea4a97e01fa67ea066f9e785050ed2"),
Common::FR_FRA,
Common::kPlatformAmiga,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -467,7 +467,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("demo", "8d3a750d1c840b1b1071e42f9e6f6aa2"),
Common::EN_GRB,
Common::kPlatformAmiga,
- ADGF_DEMO,
+ ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -481,7 +481,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "1501d5ae364b2814a33ed19347c3fcae"),
Common::EN_GRB,
Common::kPlatformAtariST,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
@@ -495,7 +495,7 @@ static const CINEGameDescription gameDescriptions[] = {
AD_ENTRY1("procs0", "2148d25de3219dd4a36580ca735d0afa"),
Common::FR_FRA,
Common::kPlatformAtariST,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
GType_OS,
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 918d522606..636c0cf8d9 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -113,7 +113,7 @@ FWRenderer::FWRenderer() : _background(NULL), _backupPal(), _cmd(""),
assert(_backBuffer);
memset(_backBuffer, 0, _screenSize);
- memset(_bgName, 0, sizeof (_bgName));
+ memset(_bgName, 0, sizeof(_bgName));
}
@@ -174,7 +174,8 @@ void FWRenderer::fillSprite(const ObjectStruct &obj, uint8 color) {
* @param obj Object info
* @param fillColor Sprite color
*/
-void FWRenderer::incrustMask(const ObjectStruct &obj, uint8 color) {
+void FWRenderer::incrustMask(const BGIncrust &incrust, uint8 color) {
+ const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx];
const byte *data = g_cine->_animDataTable[obj.frame].data();
int x, y, width, height;
@@ -218,7 +219,9 @@ void FWRenderer::drawSprite(const ObjectStruct &obj) {
* Draw color sprite on background
* @param obj Object info
*/
-void FWRenderer::incrustSprite(const ObjectStruct &obj) {
+void FWRenderer::incrustSprite(const BGIncrust &incrust) {
+ const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx];
+
const byte *data = g_cine->_animDataTable[obj.frame].data();
const byte *mask = g_cine->_animDataTable[obj.frame].mask();
int x, y, width, height;
@@ -246,14 +249,16 @@ void FWRenderer::drawCommand() {
unsigned int i;
int x = 10, y = _cmdY;
- drawPlainBox(x, y, 301, 11, 0);
- drawBorder(x - 1, y - 1, 302, 12, 2);
+ if (disableSystemMenu == 0) {
+ drawPlainBox(x, y, 301, 11, 0);
+ drawBorder(x - 1, y - 1, 302, 12, 2);
- x += 2;
- y += 2;
+ x += 2;
+ y += 2;
- for (i = 0; i < _cmd.size(); i++) {
- x = drawChar(_cmd[i], x, y);
+ for (i = 0; i < _cmd.size(); i++) {
+ x = drawChar(_cmd[i], x, y);
+ }
}
}
@@ -298,10 +303,11 @@ void FWRenderer::drawMessage(const char *str, int x, int y, int width, int color
for (i = 0; str[i]; i++, line--) {
// Fit line of text into textbox
if (!line) {
- while (str[i] == ' ') i++;
+ while (str[i] == ' ')
+ i++;
line = fitLine(str + i, tw, words, cw);
- if ( str[i + line] != '\0' && str[i + line] != 0x7C && words) {
+ if (str[i + line] != '\0' && str[i + line] != 0x7C && words) {
space = (tw - cw) / words;
extraSpace = (tw - cw) % words;
} else {
@@ -465,6 +471,41 @@ int FWRenderer::drawChar(char character, int x, int y) {
return x;
}
+/**
+ * Clears the character glyph to black
+ * This function is called "undrawChar", because the original only applies
+ * this drawing after the original glyph has been drawn.
+ * Possible TODO: Find a better name.
+ * @param character Character to undraw
+ * @param x Character coordinate
+ * @param y Character coordinate
+ */
+int FWRenderer::undrawChar(char character, int x, int y) {
+ int width, idx;
+
+ if (character == ' ') {
+ x += 5;
+ } else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
+ idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ const byte *sprite = g_cine->_textHandler.textTable[idx][FONT_DATA];
+ for (uint i = 0; i < FONT_HEIGHT; ++i) {
+ byte *dst = _backBuffer + (y + i) * 320 + x;
+ for (uint j = 0; j < FONT_WIDTH; ++j, ++dst) {
+ // The original does this based on whether bit 1 of the pixel
+ // is set. Since that's the only bit ever set in (FW) this
+ // check should be fine.
+ // TODO: Check how Operation Stealth Amiga works
+ if (*sprite++) {
+ *dst = 0;
+ }
+ }
+ }
+ x += width + 1;
+ }
+
+ return x;
+}
+
int FWRenderer::getStringWidth(const char *str) {
const char *p = str;
int width = 0;
@@ -839,7 +880,7 @@ void OSRenderer::restorePalette(Common::SeekableReadStream &fHandle, int version
fHandle.read(buf, kHighPalNumBytes);
- if (colorCount == kHighPalNumBytes) {
+ if (colorCount == kHighPalNumColors) {
// Load the active 256 color palette from file
_activePal.load(buf, sizeof(buf), kHighPalFormat, kHighPalNumColors, CINE_LITTLE_ENDIAN);
} else {
@@ -963,20 +1004,29 @@ void SelectionMenu::drawMenu(FWRenderer &r, bool top) {
charX = x + 4;
if (i == _selection) {
+ int color;
+
if (isAmiga) {
- // The original Amiga version is using a different highlight color here,
- // but with our current code it is not possible to change the text color,
- // thus we can not use the Amiga's color, since otherwise the text
- // wouldn't be visible anymore.
- r.drawPlainBox(charX, lineY, _width - 8, FONT_HEIGHT, top ? r._messageBg/*2*/ : 18);
+ if (top) {
+ color = 2;
+ } else {
+ color = 18;
+ }
} else {
- r.drawPlainBox(charX, lineY, _width - 8, 9, 0);
+ color = 0;
}
+
+ r.drawPlainBox(x + 2, lineY - 1, _width - 3, 9, color);
}
const int size = _elements[i].size();
- for (int j = 0; j < size; ++j)
- charX = r.drawChar(_elements[i][j], charX, lineY);
+ for (int j = 0; j < size; ++j) {
+ if (isAmiga && i == _selection) {
+ charX = r.undrawChar(_elements[i][j], charX, lineY);
+ } else {
+ charX = r.drawChar(_elements[i][j], charX, lineY);
+ }
+ }
}
}
@@ -1119,7 +1169,8 @@ void OSRenderer::clear() {
* @param obj Object info
* @param fillColor Sprite color
*/
-void OSRenderer::incrustMask(const ObjectStruct &obj, uint8 color) {
+void OSRenderer::incrustMask(const BGIncrust &incrust, uint8 color) {
+ const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx];
const byte *data = g_cine->_animDataTable[obj.frame].data();
int x, y, width, height;
@@ -1154,15 +1205,16 @@ void OSRenderer::drawSprite(const ObjectStruct &obj) {
* Draw color sprite
* @param obj Object info
*/
-void OSRenderer::incrustSprite(const ObjectStruct &obj) {
- const byte *data = g_cine->_animDataTable[obj.frame].data();
+void OSRenderer::incrustSprite(const BGIncrust &incrust) {
+ const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx];
+ const byte *data = g_cine->_animDataTable[incrust.frame].data();
int x, y, width, height, transColor;
- x = obj.x;
- y = obj.y;
+ x = incrust.x;
+ y = incrust.y;
transColor = obj.part;
- width = g_cine->_animDataTable[obj.frame]._realWidth;
- height = g_cine->_animDataTable[obj.frame]._height;
+ width = g_cine->_animDataTable[incrust.frame]._realWidth;
+ height = g_cine->_animDataTable[incrust.frame]._height;
if (_bgTable[_currentBg].bg) {
drawSpriteRaw2(data, transColor, width, height, _bgTable[_currentBg].bg, x, y);
@@ -1225,7 +1277,6 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) {
int len, idx, width, height;
ObjectStruct *obj;
AnimData *sprite;
- byte *mask;
byte color;
switch (it->type) {
@@ -1235,12 +1286,7 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) {
break;
}
sprite = &g_cine->_animDataTable[g_cine->_objectTable[it->objIdx].frame];
- len = sprite->_realWidth * sprite->_height;
- mask = new byte[len];
- generateMask(sprite->data(), mask, len, g_cine->_objectTable[it->objIdx].part);
- remaskSprite(mask, it);
- drawMaskedSprite(g_cine->_objectTable[it->objIdx], mask);
- delete[] mask;
+ drawSprite(&(*it), sprite->data(), sprite->_realWidth, sprite->_height, _backBuffer, g_cine->_objectTable[it->objIdx].x, g_cine->_objectTable[it->objIdx].y, g_cine->_objectTable[it->objIdx].part, sprite->_bpp);
break;
// game message
@@ -1290,14 +1336,6 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) {
maskBgOverlay(_bgTable[it->x].bg, sprite->data(), sprite->_realWidth, sprite->_height, _backBuffer, obj->x, obj->y);
break;
- // FIXME: Implement correct drawing of type 21 overlays.
- // Type 21 overlays aren't just filled rectangles, I found their drawing routine
- // from Operation Stealth's drawSprite routine. So they're likely some kind of sprites
- // and it's just a coincidence that the oxygen meter during the first arcade sequence
- // works even somehow currently. I tried the original under DOSBox and the oxygen gauge
- // is a long red bar that gets shorter as the air runs out.
- case 21:
- // A filled rectangle:
case 22:
// TODO: Check it this implementation really works correctly (Some things might be wrong, needs testing).
assert(it->objIdx < NUM_MAX_OBJECT);
@@ -1307,7 +1345,7 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) {
height = obj->costume;
drawPlainBox(obj->x, obj->y, width, height, color);
debug(5, "renderOverlay: type=%d, x=%d, y=%d, width=%d, height=%d, color=%d",
- it->type, obj->x, obj->y, width, height, color);
+ it->type, obj->x, obj->y, width, height, color);
break;
// something else
@@ -1431,7 +1469,7 @@ void OSRenderer::selectBg(unsigned int idx) {
if (_bgTable[idx].bg) {
assert(_bgTable[idx].pal.isValid() && !(_bgTable[idx].pal.empty()));
- _currentBg = idx;
+ _currentBg = idx;
} else
warning("OSRenderer::selectBg(%d) - attempt to select null background", idx);
reloadPalette();
@@ -1752,6 +1790,82 @@ void drawSpriteRaw(const byte *spritePtr, const byte *maskPtr, int16 width, int1
}
}
+void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 width, int16 height, byte *page, int16 x, int16 y, byte transparentColor, byte bpp) {
+ byte *pMask = NULL;
+
+ // draw the mask based on next objects in the list
+ Common::List<overlay>::iterator it;
+ for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end(); ++it) {
+ if (&(*it) == overlayPtr) {
+ break;
+ }
+ }
+
+ while (it != g_cine->_overlayList.end()) {
+ overlay *pCurrentOverlay = &(*it);
+ if ((pCurrentOverlay->type == 5) || ((pCurrentOverlay->type == 21) && (pCurrentOverlay->x == overlayPtr->objIdx))) {
+ AnimData *sprite = &g_cine->_animDataTable[g_cine->_objectTable[it->objIdx].frame];
+
+ if (pMask == NULL) {
+ pMask = new byte[width * height];
+
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < width; j++) {
+ byte spriteColor = spritePtr[width * i + j];
+ pMask[width * i + j] = spriteColor;
+ }
+ }
+ }
+
+ for (int i = 0; i < sprite->_realWidth; i++) {
+ for (int j = 0; j < sprite->_height; j++) {
+ int inMaskX = (g_cine->_objectTable[it->objIdx].x + i) - x;
+ int inMaskY = (g_cine->_objectTable[it->objIdx].y + j) - y;
+
+ if (inMaskX >= 0 && inMaskX < width) {
+ if (inMaskY >= 0 && inMaskY < height) {
+ if (sprite->_bpp == 1) {
+ if (!sprite->getColor(i, j)) {
+ pMask[inMaskY * width + inMaskX] = page[x + y * 320 + inMaskX + inMaskY * 320];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ it++;
+ }
+
+ // now, draw with the mask we created
+ if (pMask) {
+ spritePtr = pMask;
+ }
+
+ // ignore transparent color in 1bpp
+ if (bpp == 1) {
+ transparentColor = 1;
+ }
+
+ {
+ for (int i = 0; i < height; i++) {
+ byte *destPtr = page + x + y * 320;
+ destPtr += i * 320;
+
+ for (int j = 0; j < width; j++) {
+ byte color = *(spritePtr++);
+ if ((transparentColor != color) && x + j >= 0 && x + j < 320 && i + y >= 0 && i + y < 200) {
+ *(destPtr++) = color;
+ } else {
+ destPtr++;
+ }
+ }
+ }
+ }
+
+ delete[] pMask;
+}
+
void drawSpriteRaw2(const byte *spritePtr, byte transColor, int16 width, int16 height, byte *page, int16 x, int16 y) {
int16 i, j;
diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h
index 737c49cc36..8b8843fd72 100644
--- a/engines/cine/gfx.h
+++ b/engines/cine/gfx.h
@@ -27,6 +27,7 @@
#include "common/rect.h"
#include "common/stack.h"
#include "cine/object.h"
+#include "cine/bg_list.h"
namespace Cine {
@@ -151,6 +152,7 @@ protected:
void drawBorder(int x, int y, int width, int height, byte color);
void drawDoubleBorder(int x, int y, int width, int height, byte color);
virtual int drawChar(char character, int x, int y);
+ virtual int undrawChar(char character, int x, int y);
void drawLine(int x, int y, int width, int height, byte color);
void remaskSprite(byte *mask, Common::List<overlay>::iterator it);
virtual void drawBackground();
@@ -177,8 +179,8 @@ public:
void drawFrame();
void setCommand(Common::String cmd);
- virtual void incrustMask(const ObjectStruct &obj, uint8 color = 0);
- virtual void incrustSprite(const ObjectStruct &obj);
+ virtual void incrustMask(const BGIncrust &incrust, uint8 color = 0);
+ virtual void incrustSprite(const BGIncrust &incrust);
virtual void loadBg16(const byte *bg, const char *name, unsigned int idx = 0);
virtual void loadCt16(const byte *ct, const char *name);
@@ -223,6 +225,7 @@ private:
protected:
void drawSprite(const ObjectStruct &obj);
+ void drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 width, int16 height, byte *page, int16 x, int16 y, byte transparentColor, byte bpp);
int drawChar(char character, int x, int y);
void drawBackground();
void renderOverlay(const Common::List<overlay>::iterator &it);
@@ -238,8 +241,8 @@ public:
void clear();
- void incrustMask(const ObjectStruct &obj, uint8 color = 0);
- void incrustSprite(const ObjectStruct &obj);
+ void incrustMask(const BGIncrust &incrust, uint8 color = 0);
+ void incrustSprite(const BGIncrust &incrust);
void loadBg16(const byte *bg, const char *name, unsigned int idx = 0);
void loadCt16(const byte *ct, const char *name);
@@ -285,7 +288,7 @@ byte gfxGetColor(int16 x, int16 y, const byte *ptr, int16 width);
void gfxResetRawPage(byte *pageRaw);
void gfxConvertSpriteToRaw(byte *dst, const byte *src, uint16 w, uint16 h);
-void gfxCopyRawPage(byte *source, byte * dest);
+void gfxCopyRawPage(byte *source, byte *dest);
void gfxFlipRawPage(byte *frontBuffer);
void drawSpriteRaw(const byte *spritePtr, const byte *maskPtr, int16 width, int16 height, byte *page, int16 x, int16 y);
void gfxDrawPlainBoxRaw(int16 x1, int16 y1, int16 x2, int16 y2, byte color, byte *page);
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index 971830ce8f..c822f1cabd 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -56,6 +56,12 @@ static void processEvent(Common::Event &event) {
case Common::EVENT_RBUTTONDOWN:
mouseRight = 1;
break;
+ case Common::EVENT_LBUTTONUP:
+ mouseLeft = 0;
+ break;
+ case Common::EVENT_RBUTTONUP:
+ mouseRight = 0;
+ break;
case Common::EVENT_MOUSEMOVE:
break;
case Common::EVENT_KEYDOWN:
@@ -115,7 +121,7 @@ static void processEvent(Common::Event &event) {
}
break;
case Common::KEYCODE_F10:
- if (!disableSystemMenu && !inMenu) {
+ if (!inMenu) {
g_cine->makeSystemMenu();
}
break;
@@ -174,19 +180,19 @@ static void processEvent(Common::Event &event) {
case Common::KEYCODE_F11:
renderer->showCollisionPage(false);
break;
- case Common::KEYCODE_KP5: // Emulated left mouse button click
- case Common::KEYCODE_LEFT: // Left
- case Common::KEYCODE_KP4: // Left
+ case Common::KEYCODE_KP5: // Emulated left mouse button click
+ case Common::KEYCODE_LEFT: // Left
+ case Common::KEYCODE_KP4: // Left
case Common::KEYCODE_RIGHT: // Right
- case Common::KEYCODE_KP6: // Right
- case Common::KEYCODE_UP: // Up
- case Common::KEYCODE_KP8: // Up
- case Common::KEYCODE_DOWN: // Down
- case Common::KEYCODE_KP2: // Down
- case Common::KEYCODE_KP9: // Up & Right
- case Common::KEYCODE_KP7: // Up & Left
- case Common::KEYCODE_KP1: // Down & Left
- case Common::KEYCODE_KP3: // Down & Right
+ case Common::KEYCODE_KP6: // Right
+ case Common::KEYCODE_UP: // Up
+ case Common::KEYCODE_KP8: // Up
+ case Common::KEYCODE_DOWN: // Down
+ case Common::KEYCODE_KP2: // Down
+ case Common::KEYCODE_KP9: // Up & Right
+ case Common::KEYCODE_KP7: // Up & Left
+ case Common::KEYCODE_KP1: // Down & Left
+ case Common::KEYCODE_KP3: // Down & Right
// Stop ego movement made with keyboard when releasing a known key
moveUsingKeyboard(0, 0);
break;
@@ -211,11 +217,8 @@ void manageEvents() {
g_system->delayMillis(20);
} while (g_system->getMillis() < nextFrame);
- g_sound->update();
mouseData.left = mouseLeft;
mouseData.right = mouseRight;
- mouseLeft = 0;
- mouseRight = 0;
}
void getMouseData(uint16 param, uint16 *pButton, uint16 *pX, uint16 *pY) {
@@ -311,6 +314,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
// HACK: Force amount of oxygen left to maximum during Operation Stealth's first arcade sequence.
// This makes it possible to pass the arcade sequence for now.
// FIXME: Remove the hack and make the first arcade sequence normally playable.
+ /*
if (g_cine->getGameType() == Cine::GType_OS) {
Common::String bgName(renderer->getBgName());
// Check if the background is one of the three backgrounds
@@ -320,7 +324,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
// Force the amount of oxygen left to the maximum.
g_cine->_objectTable[oxygenObjNum].x = maxOxygen;
}
- }
+ }*/
// HACK: In Operation Stealth after the first arcade sequence jump player's position to avoid getting stuck.
// After the first arcade sequence the player comes up stairs from
@@ -379,8 +383,8 @@ void CineEngine::mainLoop(int bootScriptIdx) {
playerAction = false;
_messageLen <<= 3;
- if (_messageLen < 0x800)
- _messageLen = 0x800;
+ if (_messageLen < 800)
+ _messageLen = 800;
do {
manageEvents();
@@ -429,9 +433,9 @@ void CineEngine::mainLoop(int bootScriptIdx) {
hideMouse();
g_sound->stopMusic();
- // if (g_cine->getGameType() == Cine::GType_OS) {
+ //if (g_cine->getGameType() == Cine::GType_OS) {
// freeUnkList();
- // }
+ //}
closePart();
}
diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp
index afd95c04b0..a75828abb1 100644
--- a/engines/cine/object.cpp
+++ b/engines/cine/object.cpp
@@ -59,7 +59,7 @@ void loadObject(char *pObjectName) {
assert(numEntry <= NUM_MAX_OBJECT);
for (i = 0; i < numEntry; i++) {
- if (g_cine->_objectTable[i].costume != -2 && g_cine->_objectTable[i].costume != -3) { // flag is keep ?
+ if (g_cine->_objectTable[i].costume != -2 && g_cine->_objectTable[i].costume != -3) { // flag is keep?
Common::MemoryReadStream readS(ptr, entrySize);
g_cine->_objectTable[i].x = readS.readSint16BE();
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 779c279ea1..10077ecdc9 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -92,7 +92,8 @@ void loadRelatedPalette(const char *fileName) {
paletteIndex = findPaletteFromName(localName);
if (paletteIndex == -1) {
- for (i = 0; i < 16; i++) { // generate default palette
+ // generate default palette
+ for (i = 0; i < 16; i++) {
paletteBuffer1[i] = paletteBuffer2[i] = (i << 4) + i;
}
} else {
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp
index 03cb743b46..813cbe50af 100644
--- a/engines/cine/part.cpp
+++ b/engines/cine/part.cpp
@@ -263,7 +263,7 @@ byte *readBundleSoundFile(const char *entryName, uint32 *size) {
/** Rotate byte value to the left by n bits */
byte rolByte(byte value, uint n) {
n %= 8;
- return (byte) ((value << n) | (value >> (8 - n)));
+ return (byte)((value << n) | (value >> (8 - n)));
}
byte *readFile(const char *filename, bool crypted) {
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index 223099a587..51d2c1f6be 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -991,7 +991,7 @@ void CineEngine::makeSave(char *saveFileName) {
* at a time.
*/
void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGameFormat saveGameFormat) {
- int16 currentAnim, foundFileIdx;
+ int16 foundFileIdx;
char *animName, part[256], name[10];
strcpy(part, currentPartName);
@@ -1001,10 +1001,10 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam
const int entrySize = ((saveGameFormat == ANIMSIZE_23) ? 23 : 30);
const int fileStartPos = fHandle.pos();
- currentAnim = 0;
- while (currentAnim < NUM_MAX_ANIMDATA) {
+
+ for (int resourceIndex = 0; resourceIndex < NUM_MAX_ANIMDATA; resourceIndex++) {
// Seek to the start of the current animation's entry
- fHandle.seek(fileStartPos + currentAnim * entrySize);
+ fHandle.seek(fileStartPos + resourceIndex * entrySize);
// Read in the current animation entry
fHandle.readUint16BE(); // width
fHandle.readUint16BE();
@@ -1019,7 +1019,7 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam
}
foundFileIdx = fHandle.readSint16BE();
- fHandle.readSint16BE(); // frame
+ int16 frameIndex = fHandle.readSint16BE(); // frame
fHandle.read(name, 10);
// Handle variables only present in animation entries of size 23
@@ -1029,7 +1029,7 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam
// Don't try to load invalid entries.
if (foundFileIdx < 0 || !validPtr) {
- currentAnim++; // Jump over the invalid entry
+ //resourceIndex++; // Jump over the invalid entry
continue;
}
@@ -1041,9 +1041,7 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam
animName = g_cine->_partBuffer[foundFileIdx].partName;
loadRelatedPalette(animName); // Is this for Future Wars only?
- const int16 prevAnim = currentAnim;
- currentAnim = loadResource(animName, currentAnim);
- assert(currentAnim > prevAnim); // Make sure we advance forward
+ loadResource(animName, resourceIndex, frameIndex);
}
loadPart(part);
diff --git a/engines/cine/saveload.h b/engines/cine/saveload.h
index 49c9c0cef7..fd661904af 100644
--- a/engines/cine/saveload.h
+++ b/engines/cine/saveload.h
@@ -68,7 +68,7 @@ enum CineSaveGameFormat {
};
/** Identifier for the temporary Operation Stealth savegame format. */
-static const uint32 TEMP_OS_FORMAT_ID = MKTAG('T','E','M','P');
+static const uint32 TEMP_OS_FORMAT_ID = MKTAG('T', 'E', 'M', 'P');
/** The current version number of Operation Stealth's savegame format. */
static const uint32 CURRENT_OS_SAVE_VER = 1;
diff --git a/engines/cine/script.h b/engines/cine/script.h
index 3fc86c585b..a07c8d6cfc 100644
--- a/engines/cine/script.h
+++ b/engines/cine/script.h
@@ -227,6 +227,7 @@ protected:
int o1_op72();
int o1_op73();
int o1_playSample();
+ int o1_playSampleSwapped();
int o1_disableSystemMenu();
int o1_loadMask5();
int o1_unloadMask5();
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index 66150cc5b2..b4fe68c343 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -196,7 +196,7 @@ void FWScript::setupTable() {
{ 0, 0 },
{ &FWScript::o1_playSample, "bbwbww" },
/* 78 */
- { &FWScript::o1_playSample, "bbwbww" },
+ { &FWScript::o1_playSampleSwapped, "bbwbww" },
{ &FWScript::o1_disableSystemMenu, "b" },
{ &FWScript::o1_loadMask5, "b" },
{ &FWScript::o1_unloadMask5, "b" }
@@ -352,7 +352,7 @@ void ScriptVars::load(Common::SeekableReadStream &fHandle, unsigned int len) {
* Reset all values to 0
*/
void ScriptVars::reset() {
- memset( _vars, 0, _size * sizeof(int16));
+ memset(_vars, 0, _size * sizeof(int16));
}
/**
@@ -380,10 +380,10 @@ RawScript::RawScript(const FWScriptInfo &info, const byte *data, uint16 s) :
* Copy constructor
*/
RawScript::RawScript(const RawScript &src) : _size(src._size),
- _data(new byte[_size+1]), _labels(src._labels) {
+ _data(new byte[_size + 1]), _labels(src._labels) {
assert(_data);
- memcpy(_data, src._data, _size+1);
+ memcpy(_data, src._data, _size + 1);
}
/**
@@ -398,7 +398,7 @@ RawScript::~RawScript() {
*/
RawScript &RawScript::operator=(const RawScript &src) {
assert(src._data);
- byte *tmp = new byte[src._size+1];
+ byte *tmp = new byte[src._size + 1];
assert(tmp);
_labels = src._labels;
@@ -443,14 +443,14 @@ int RawScript::getNextLabel(const FWScriptInfo &info, int offset) const {
pos += 2;
break;
case 'c': { // byte != 0 ? byte : word
- uint8 test = _data[pos];
+ uint8 test = _data[pos];
+ pos++;
+ if (test) {
pos++;
- if (test) {
- pos++;
- } else {
- pos += 2;
- }
+ } else {
+ pos += 2;
}
+ }
break;
case 'l': // label
return pos;
@@ -459,7 +459,7 @@ int RawScript::getNextLabel(const FWScriptInfo &info, int offset) const {
;
break;
case 'x': // exit script
- return -pos-1;
+ return -pos - 1;
}
}
}
@@ -498,9 +498,7 @@ void RawScript::computeLabels(const FWScriptInfo &info) {
*
* computeScriptStackFromScript replacement
*/
-uint16 RawScript::getLabel(const FWScriptInfo &info, byte index, uint16 offset)
- const {
-
+uint16 RawScript::getLabel(const FWScriptInfo &info, byte index, uint16 offset) const {
assert(_data);
int pos = offset;
@@ -519,7 +517,7 @@ uint16 RawScript::getLabel(const FWScriptInfo &info, byte index, uint16 offset)
*/
void RawScript::setData(const FWScriptInfo &info, const byte *data) {
assert(!_data); // this function should be called only once per instance
- _data = new byte[_size+1];
+ _data = new byte[_size + 1];
assert(data && _data);
memcpy(_data, data, _size * sizeof(byte));
@@ -533,7 +531,6 @@ void RawScript::setData(const FWScriptInfo &info, const byte *data) {
* @return Precalculated script labels
*/
const ScriptVars &RawScript::labels() const {
- assert(_data);
return _labels;
}
@@ -554,7 +551,7 @@ byte RawScript::getByte(unsigned int pos) const {
* @return Word of bytecode
*/
uint16 RawScript::getWord(unsigned int pos) const {
- assert(_data && pos+1 < _size);
+ assert(_data && pos + 1 < _size);
return READ_BE_UINT16(_data + pos);
}
@@ -567,7 +564,7 @@ uint16 RawScript::getWord(unsigned int pos) const {
const char *RawScript::getString(unsigned int pos) const {
assert(_data && pos < _size);
- return (const char*)(_data+pos);
+ return (const char *)(_data + pos);
}
/**
@@ -581,8 +578,8 @@ const char *RawScript::getString(unsigned int pos) const {
* instance can be used. It leaves the instance in partially invalid state.
*/
RawObjectScript::RawObjectScript(uint16 s, uint16 p1, uint16 p2, uint16 p3)
- : RawScript(s), _runCount(0), _param1(p1), _param2(p2), _param3(p3)
-{ }
+ : RawScript(s), _runCount(0), _param1(p1), _param2(p2), _param3(p3) {
+}
/**
* Complete constructor
@@ -593,8 +590,9 @@ RawObjectScript::RawObjectScript(uint16 s, uint16 p1, uint16 p2, uint16 p3)
* @param p3 Third object script parameter
*/
RawObjectScript::RawObjectScript(const FWScriptInfo &info, const byte *data,
- uint16 s, uint16 p1, uint16 p2, uint16 p3) : RawScript(info, data, s),
- _runCount(0), _param1(p1), _param2(p2), _param3(p3) { }
+ uint16 s, uint16 p1, uint16 p2, uint16 p3)
+ : RawScript(info, data, s), _runCount(0), _param1(p1), _param2(p2), _param3(p3) {
+}
/**
* Contructor for global scripts
@@ -604,7 +602,8 @@ RawObjectScript::RawObjectScript(const FWScriptInfo &info, const byte *data,
FWScript::FWScript(const RawScript &script, int16 idx) : _script(script),
_pos(0), _line(0), _compare(0), _index(idx),
_labels(script.labels()), _localVars(LOCAL_VARS_SIZE),
- _globalVars(g_cine->_globalVars), _info(new FWScriptInfo) { }
+ _globalVars(g_cine->_globalVars), _info(new FWScriptInfo) {
+}
/**
* Copy constructor
@@ -612,25 +611,27 @@ FWScript::FWScript(const RawScript &script, int16 idx) : _script(script),
FWScript::FWScript(const FWScript &src) : _script(src._script), _pos(src._pos),
_line(src._line), _compare(src._compare), _index(src._index),
_labels(src._labels), _localVars(src._localVars),
- _globalVars(src._globalVars), _info(new FWScriptInfo) { }
+ _globalVars(src._globalVars), _info(new FWScriptInfo) {
+}
/**
* Contructor for global scripts in derived classes
* @param script Script bytecode reference
* @param idx Script bytecode index
*/
-FWScript::FWScript(const RawScript &script, int16 idx, FWScriptInfo *info) :
- _script(script), _pos(0), _line(0), _compare(0), _index(idx),
+FWScript::FWScript(const RawScript &script, int16 idx, FWScriptInfo *info)
+ : _script(script), _pos(0), _line(0), _compare(0), _index(idx),
_labels(script.labels()), _localVars(LOCAL_VARS_SIZE),
- _globalVars(g_cine->_globalVars), _info(info) { }
+ _globalVars(g_cine->_globalVars), _info(info) {
+}
/**
* Constructor for object scripts in derived classes
* @param script Script bytecode reference
* @param idx Script bytecode index
*/
-FWScript::FWScript(RawObjectScript &script, int16 idx, FWScriptInfo *info) :
- _script(script), _pos(0), _line(0), _compare(0), _index(idx),
+FWScript::FWScript(RawObjectScript &script, int16 idx, FWScriptInfo *info)
+ : _script(script), _pos(0), _line(0), _compare(0), _index(idx),
_labels(script.labels()), _localVars(LOCAL_VARS_SIZE),
_globalVars(g_cine->_globalVars), _info(info) {
@@ -640,8 +641,8 @@ FWScript::FWScript(RawObjectScript &script, int16 idx, FWScriptInfo *info) :
/**
* Copy constructor for derived classes
*/
-FWScript::FWScript(const FWScript &src, FWScriptInfo *info) :
- _script(src._script), _pos(src._pos), _line(src._line),
+FWScript::FWScript(const FWScript &src, FWScriptInfo *info)
+ : _script(src._script), _pos(src._pos), _line(src._line),
_compare(src._compare), _index(src._index), _labels(src._labels),
_localVars(src._localVars), _globalVars(src._globalVars), _info(info) { }
@@ -687,7 +688,7 @@ const char *FWScript::getNextString() {
* @param pos Restored script position
*/
void FWScript::load(const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) {
- assert(pos < _script._size);
+ assert(pos <= _script._size);
_labels = labels;
_localVars = local;
_compare = compare;
@@ -705,13 +706,15 @@ void FWScript::load(const ScriptVars &labels, const ScriptVars &local, uint16 co
int FWScript::execute() {
int ret = 0;
- while (!ret) {
- _line = _pos;
- byte opcode = getNextByte();
- OpFunc handler = _info->opcodeHandler(opcode);
+ if (_script._size) {
+ while (!ret) {
+ _line = _pos;
+ byte opcode = getNextByte();
+ OpFunc handler = _info->opcodeHandler(opcode);
- if (handler) {
- ret = (this->*handler)();
+ if (handler) {
+ ret = (this->*handler)();
+ }
}
}
@@ -1815,6 +1818,9 @@ int FWScript::o1_playSample() {
if (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) {
if (size == 0xFFFF) {
size = g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height;
+ } else if (size > g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height) {
+ warning("o1_playSample: Got invalid sample size %d for sample %d", size, anim);
+ size = g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height;
}
if (channel < 10) { // || _currentOpcode == 0x78
int channel1, channel2;
@@ -1822,8 +1828,8 @@ int FWScript::o1_playSample() {
channel1 = 0;
channel2 = 1;
} else {
- channel1 = 2;
- channel2 = 3;
+ channel1 = 3;
+ channel2 = 2;
}
g_sound->playSound(channel1, freq, data, size, -1, volume, 63, repeat);
g_sound->playSound(channel2, freq, data, size, 1, volume, 0, repeat);
@@ -1857,11 +1863,58 @@ int FWScript::o1_playSample() {
return 0;
}
+int FWScript::o1_playSampleSwapped() {
+ // TODO: The DOS version probably does not have any stereo support here
+ // since the only stereo output it supports should be the Roland MT-32.
+ // So it probably does the same as o1_playSample here. Checking this will
+ // be a good idea never the less.
+ if (g_cine->getPlatform() == Common::kPlatformPC) {
+ return o1_playSample();
+ }
+
+ debugC(5, kCineDebugScript, "Line: %d: playSampleInversed()", _line);
+
+ byte anim = getNextByte();
+ byte channel = getNextByte();
+
+ uint16 freq = getNextWord();
+ byte repeat = getNextByte();
+
+ int16 volume = getNextWord();
+ uint16 size = getNextWord();
+
+ const byte *data = g_cine->_animDataTable[anim].data();
+
+ if (!data) {
+ return 0;
+ }
+
+ if (size == 0xFFFF) {
+ size = g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height;
+ } else if (size > g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height) {
+ warning("o1_playSampleSwapped: Got invalid sample size %d for sample %d", size, anim);
+ size = g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height;
+ }
+
+ int channel1, channel2;
+ if (channel == 0) {
+ channel1 = 1;
+ channel2 = 0;
+ } else {
+ channel1 = 2;
+ channel2 = 3;
+ }
+
+ g_sound->playSound(channel1, freq, data, size, -1, volume, 63, repeat);
+ g_sound->playSound(channel2, freq, data, size, 1, volume, 0, repeat);
+ return 0;
+}
+
int FWScript::o1_disableSystemMenu() {
byte param = getNextByte();
debugC(5, kCineDebugScript, "Line: %d: disableSystemMenu(%d)", _line, param);
- disableSystemMenu = (param != 0);
+ disableSystemMenu = param;
return 0;
}
@@ -2073,1034 +2126,970 @@ void decompileScript(const byte *scriptPtr, uint16 scriptSize, uint16 scriptIdx)
strcpy(lineBuffer, "");
switch (opcode - 1) {
- case -1:
- {
- break;
- }
- case 0x0:
- {
- byte param1;
- byte param2;
- int16 param3;
+ case -1: {
+ break;
+ }
+ case 0x0: {
+ byte param1;
+ byte param2;
+ int16 param3;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(lineBuffer, "obj[%d]%s = %d\n", param1, getObjPramName(param2), param3);
+ sprintf(lineBuffer, "obj[%d]%s = %d\n", param1, getObjPramName(param2), param3);
- break;
- }
- case 0x1:
- {
- byte param1;
- byte param2;
- byte param3;
+ break;
+ }
+ case 0x1: {
+ byte param1;
+ byte param2;
+ byte param3;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- param3 = *(localScriptPtr + position);
- position++;
+ param3 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "var[%d]=obj[%d]%s\n", param3, param1, getObjPramName(param2));
- break;
- }
+ sprintf(lineBuffer, "var[%d]=obj[%d]%s\n", param3, param1, getObjPramName(param2));
+ break;
+ }
case 0x2:
case 0x3:
case 0x4:
case 0x5:
- case 0x6:
- {
- byte param1;
- byte param2;
- int16 param3;
-
- param1 = *(localScriptPtr + position);
- position++;
-
- param2 = *(localScriptPtr + position);
- position++;
-
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
-
- if (opcode - 1 == 0x2) {
- sprintf(lineBuffer, "obj[%d]%s+=%d\n", param1, getObjPramName(param2), param3);
- } else if (opcode - 1 == 0x3) {
- sprintf(lineBuffer, "obj[%d]%s-=%d\n", param1, getObjPramName(param2), param3);
- } else if (opcode - 1 == 0x4) {
- sprintf(lineBuffer, "obj[%d]%s+=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
- } else if (opcode - 1 == 0x5) {
- sprintf(lineBuffer, "obj[%d]%s-=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
- } else if (opcode - 1 == 0x6) {
- sprintf(compareString1, "obj[%d]%s", param1, getObjPramName(param2));
- sprintf(compareString2, "%d", param3);
- }
- break;
+ case 0x6: {
+ byte param1;
+ byte param2;
+ int16 param3;
+
+ param1 = *(localScriptPtr + position);
+ position++;
+
+ param2 = *(localScriptPtr + position);
+ position++;
+
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
+
+ if (opcode - 1 == 0x2) {
+ sprintf(lineBuffer, "obj[%d]%s+=%d\n", param1, getObjPramName(param2), param3);
+ } else if (opcode - 1 == 0x3) {
+ sprintf(lineBuffer, "obj[%d]%s-=%d\n", param1, getObjPramName(param2), param3);
+ } else if (opcode - 1 == 0x4) {
+ sprintf(lineBuffer, "obj[%d]%s+=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
+ } else if (opcode - 1 == 0x5) {
+ sprintf(lineBuffer, "obj[%d]%s-=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
+ } else if (opcode - 1 == 0x6) {
+ sprintf(compareString1, "obj[%d]%s", param1, getObjPramName(param2));
+ sprintf(compareString2, "%d", param3);
}
+ break;
+ }
case 0x7:
- case 0x8:
- {
- byte param1;
- int16 param2;
- int16 param3;
- int16 param4;
- int16 param5;
+ case 0x8: {
+ byte param1;
+ int16 param2;
+ int16 param3;
+ int16 param4;
+ int16 param5;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param2 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param4 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param4 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param5 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param5 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- if (opcode - 1 == 0x7) {
- sprintf(lineBuffer, "setupObject(Idx:%d,X:%d,Y:%d,mask:%d,frame:%d)\n", param1, param2, param3, param4, param5);
- } else if (opcode - 1 == 0x8) {
- sprintf(lineBuffer, "checkCollision(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
- }
- break;
+ if (opcode - 1 == 0x7) {
+ sprintf(lineBuffer, "setupObject(Idx:%d,X:%d,Y:%d,mask:%d,frame:%d)\n", param1, param2, param3, param4, param5);
+ } else if (opcode - 1 == 0x8) {
+ sprintf(lineBuffer, "checkCollision(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
}
- case 0x9:
- {
- byte param1;
- int16 param2;
+ break;
+ }
+ case 0x9: {
+ byte param1;
+ int16 param2;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- if (param2) {
- byte param3;
-
- param3 = *(localScriptPtr + position);
- position++;
-
- if (param2 == 1) {
- sprintf(lineBuffer, "var[%d]=var[%d]\n", param1, param3);
- } else if (param2 == 2) {
- sprintf(lineBuffer, "var[%d]=globalVar[%d]\n", param1, param3);
- } else if (param2 == 3) {
- sprintf(lineBuffer, "var[%d]=mouse.X\n", param1);
- } else if (param2 == 4) {
- sprintf(lineBuffer, "var[%d]=mouse.Y\n", param1);
- } else if (param2 == 5) {
- sprintf(lineBuffer, "var[%d]=rand() mod %d\n", param1, param3);
- } else if (param2 == 8) {
- sprintf(lineBuffer, "var[%d]=file[%d].packedSize\n", param1, param3);
- } else if (param2 == 9) {
- sprintf(lineBuffer, "var[%d]=file[%d].unpackedSize\n", param1, param3);
- } else {
- error("decompileScript: 0x09: param2 = %d", param2);
- }
- } else {
- int16 param3;
+ if (param2) {
+ byte param3;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "var[%d]=%d\n", param1, param3);
+ if (param2 == 1) {
+ sprintf(lineBuffer, "var[%d]=var[%d]\n", param1, param3);
+ } else if (param2 == 2) {
+ sprintf(lineBuffer, "var[%d]=globalVar[%d]\n", param1, param3);
+ } else if (param2 == 3) {
+ sprintf(lineBuffer, "var[%d]=mouse.X\n", param1);
+ } else if (param2 == 4) {
+ sprintf(lineBuffer, "var[%d]=mouse.Y\n", param1);
+ } else if (param2 == 5) {
+ sprintf(lineBuffer, "var[%d]=rand() mod %d\n", param1, param3);
+ } else if (param2 == 8) {
+ sprintf(lineBuffer, "var[%d]=file[%d].packedSize\n", param1, param3);
+ } else if (param2 == 9) {
+ sprintf(lineBuffer, "var[%d]=file[%d].unpackedSize\n", param1, param3);
+ } else {
+ error("decompileScript: 0x09: param2 = %d", param2);
}
+ } else {
+ int16 param3;
- break;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
+
+ sprintf(lineBuffer, "var[%d]=%d\n", param1, param3);
}
+
+ break;
+ }
case 0xA:
case 0xB:
case 0xC:
- case 0xD:
- {
- byte param1;
- byte param2;
+ case 0xD: {
+ byte param1;
+ byte param2;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
+ param2 = *(localScriptPtr + position);
+ position++;
+
+ if (param2) {
+ byte param3;
+
+ param3 = *(localScriptPtr + position);
position++;
- if (param2) {
- byte param3;
+ if (opcode - 1 == 0xA) {
+ sprintf(lineBuffer, "var[%d]+=var[%d]\n", param1, param3);
+ } else if (opcode - 1 == 0xB) {
+ sprintf(lineBuffer, "var[%d]-=var[%d]\n", param1, param3);
+ } else if (opcode - 1 == 0xC) {
+ sprintf(lineBuffer, "var[%d]*=var[%d]\n", param1, param3);
+ } else if (opcode - 1 == 0xD) {
+ sprintf(lineBuffer, "var[%d]/=var[%d]\n", param1, param3);
+ }
+ } else {
+ int16 param3;
- param3 = *(localScriptPtr + position);
- position++;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- if (opcode - 1 == 0xA) {
- sprintf(lineBuffer, "var[%d]+=var[%d]\n", param1, param3);
- } else if (opcode - 1 == 0xB) {
- sprintf(lineBuffer, "var[%d]-=var[%d]\n", param1, param3);
- } else if (opcode - 1 == 0xC) {
- sprintf(lineBuffer, "var[%d]*=var[%d]\n", param1, param3);
- } else if (opcode - 1 == 0xD) {
- sprintf(lineBuffer, "var[%d]/=var[%d]\n", param1, param3);
- }
- } else {
- int16 param3;
-
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
-
- if (opcode - 1 == 0xA) {
- sprintf(lineBuffer, "var[%d]+=%d\n", param1, param3);
- } else if (opcode - 1 == 0xB) {
- sprintf(lineBuffer, "var[%d]-=%d\n", param1, param3);
- } else if (opcode - 1 == 0xC) {
- sprintf(lineBuffer, "var[%d]*=%d\n", param1, param3);
- } else if (opcode - 1 == 0xD) {
- sprintf(lineBuffer, "var[%d]/=%d\n", param1, param3);
- }
+ if (opcode - 1 == 0xA) {
+ sprintf(lineBuffer, "var[%d]+=%d\n", param1, param3);
+ } else if (opcode - 1 == 0xB) {
+ sprintf(lineBuffer, "var[%d]-=%d\n", param1, param3);
+ } else if (opcode - 1 == 0xC) {
+ sprintf(lineBuffer, "var[%d]*=%d\n", param1, param3);
+ } else if (opcode - 1 == 0xD) {
+ sprintf(lineBuffer, "var[%d]/=%d\n", param1, param3);
}
- break;
}
- case 0xE:
- {
- byte param1;
- byte param2;
+ break;
+ }
+ case 0xE: {
+ byte param1;
+ byte param2;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- if (param2) {
- byte param3;
+ if (param2) {
+ byte param3;
- param3 = *(localScriptPtr + position);
- position++;
+ param3 = *(localScriptPtr + position);
+ position++;
- if (param2 == 1) {
- sprintf(compareString1, "var[%d]", param1);
- sprintf(compareString2, "var[%d]", param3);
+ if (param2 == 1) {
+ sprintf(compareString1, "var[%d]", param1);
+ sprintf(compareString2, "var[%d]", param3);
- } else if (param2 == 2) {
- sprintf(compareString1, "var[%d]", param1);
- sprintf(compareString2, "globalVar[%d]", param3);
- } else {
- error("decompileScript: 0x0E: param2 = %d", param2);
- }
+ } else if (param2 == 2) {
+ sprintf(compareString1, "var[%d]", param1);
+ sprintf(compareString2, "globalVar[%d]", param3);
} else {
- int16 param3;
+ error("decompileScript: 0x0E: param2 = %d", param2);
+ }
+ } else {
+ int16 param3;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(compareString1, "var[%d]", param1);
- sprintf(compareString2, "%d", param3);
- }
- break;
+ sprintf(compareString1, "var[%d]", param1);
+ sprintf(compareString2, "%d", param3);
}
- case 0xF:
- {
- byte param1;
- byte param2;
- byte param3;
+ break;
+ }
+ case 0xF: {
+ byte param1;
+ byte param2;
+ byte param3;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- param3 = *(localScriptPtr + position);
- position++;
+ param3 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "obj[%d]%s=var[%d]\n", param1, getObjPramName(param2), param3);
+ sprintf(lineBuffer, "obj[%d]%s=var[%d]\n", param1, getObjPramName(param2), param3);
- break;
- }
+ break;
+ }
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x18:
- case 0x19:
- {
- byte param;
-
- param = *(localScriptPtr + position);
- position++;
-
- if (opcode - 1 == 0x13) {
- sprintf(lineBuffer, "loadMask0(%d)\n", param);
- } else if (opcode - 1 == 0x14) {
- sprintf(lineBuffer, "unloadMask0(%d)\n", param);
- } else if (opcode - 1 == 0x15) {
- sprintf(lineBuffer, "OP_15(%d)\n", param);
- } else if (opcode - 1 == 0x16) {
- sprintf(lineBuffer, "loadMask1(%d)\n", param);
- } else if (opcode - 1 == 0x17) {
- sprintf(lineBuffer, "unloadMask0(%d)\n", param);
- } else if (opcode - 1 == 0x18) {
- sprintf(lineBuffer, "loadMask4(%d)\n", param);
- } else if (opcode - 1 == 0x19) {
- sprintf(lineBuffer, "unloadMask4(%d)\n", param);
- }
- break;
+ case 0x19: {
+ byte param;
+
+ param = *(localScriptPtr + position);
+ position++;
+
+ if (opcode - 1 == 0x13) {
+ sprintf(lineBuffer, "loadMask0(%d)\n", param);
+ } else if (opcode - 1 == 0x14) {
+ sprintf(lineBuffer, "unloadMask0(%d)\n", param);
+ } else if (opcode - 1 == 0x15) {
+ sprintf(lineBuffer, "OP_15(%d)\n", param);
+ } else if (opcode - 1 == 0x16) {
+ sprintf(lineBuffer, "loadMask1(%d)\n", param);
+ } else if (opcode - 1 == 0x17) {
+ sprintf(lineBuffer, "unloadMask0(%d)\n", param);
+ } else if (opcode - 1 == 0x18) {
+ sprintf(lineBuffer, "loadMask4(%d)\n", param);
+ } else if (opcode - 1 == 0x19) {
+ sprintf(lineBuffer, "unloadMask4(%d)\n", param);
}
- case 0x1A:
- {
- byte param;
+ break;
+ }
+ case 0x1A: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "OP_1A(%d)\n", param);
+ sprintf(lineBuffer, "OP_1A(%d)\n", param);
- break;
- }
- case 0x1B:
- {
- sprintf(lineBuffer, "bgIncrustList.clear()\n");
- break;
- }
- case 0x1D:
- {
- byte param;
+ break;
+ }
+ case 0x1B: {
+ sprintf(lineBuffer, "bgIncrustList.clear()\n");
+ break;
+ }
+ case 0x1D: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "label(%d)\n", param);
+ sprintf(lineBuffer, "label(%d)\n", param);
- break;
- }
- case 0x1E:
- {
- byte param;
+ break;
+ }
+ case 0x1E: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "goto(%d)\n", param);
+ sprintf(lineBuffer, "goto(%d)\n", param);
- break;
- }
+ break;
+ }
// If cases
case 0x1F:
case 0x20:
case 0x21:
case 0x22:
case 0x23:
- case 0x24:
- {
- byte param;
-
- param = *(localScriptPtr + position);
- position++;
-
- if (opcode - 1 == 0x1F) {
- sprintf(lineBuffer, "if(%s>%s) goto(%d)\n", compareString1, compareString2, param);
- } else if (opcode - 1 == 0x20) {
- sprintf(lineBuffer, "if(%s>=%s) goto(%d)\n", compareString1, compareString2, param);
- } else if (opcode - 1 == 0x21) {
- sprintf(lineBuffer, "if(%s<%s) goto(%d)\n", compareString1, compareString2, param);
- } else if (opcode - 1 == 0x22) {
- sprintf(lineBuffer, "if(%s<=%s) goto(%d)\n", compareString1, compareString2, param);
- } else if (opcode - 1 == 0x23) {
- sprintf(lineBuffer, "if(%s==%s) goto(%d)\n", compareString1, compareString2, param);
- } else if (opcode - 1 == 0x24) {
- sprintf(lineBuffer, "if(%s!=%s) goto(%d)\n", compareString1, compareString2, param);
- }
- break;
+ case 0x24: {
+ byte param;
+
+ param = *(localScriptPtr + position);
+ position++;
+
+ if (opcode - 1 == 0x1F) {
+ sprintf(lineBuffer, "if(%s>%s) goto(%d)\n", compareString1, compareString2, param);
+ } else if (opcode - 1 == 0x20) {
+ sprintf(lineBuffer, "if(%s>=%s) goto(%d)\n", compareString1, compareString2, param);
+ } else if (opcode - 1 == 0x21) {
+ sprintf(lineBuffer, "if(%s<%s) goto(%d)\n", compareString1, compareString2, param);
+ } else if (opcode - 1 == 0x22) {
+ sprintf(lineBuffer, "if(%s<=%s) goto(%d)\n", compareString1, compareString2, param);
+ } else if (opcode - 1 == 0x23) {
+ sprintf(lineBuffer, "if(%s==%s) goto(%d)\n", compareString1, compareString2, param);
+ } else if (opcode - 1 == 0x24) {
+ sprintf(lineBuffer, "if(%s!=%s) goto(%d)\n", compareString1, compareString2, param);
}
- case 0x25:
- {
- byte param;
+ break;
+ }
+ case 0x25: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "removeLabel(%d)\n", param);
+ sprintf(lineBuffer, "removeLabel(%d)\n", param);
- break;
- }
- case 0x26:
- {
- byte param1;
- byte param2;
+ break;
+ }
+ case 0x26: {
+ byte param1;
+ byte param2;
- param1 = *(localScriptPtr + position);
- position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "loop(--var[%d]) -> label(%d)\n", param1, param2);
+ sprintf(lineBuffer, "loop(--var[%d]) -> label(%d)\n", param1, param2);
- break;
- }
+ break;
+ }
case 0x31:
- case 0x32:
- {
- byte param;
+ case 0x32: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- if (opcode - 1 == 0x31) {
- sprintf(lineBuffer, "startGlobalScript(%d)\n", param);
- } else if (opcode - 1 == 0x32) {
- sprintf(lineBuffer, "endGlobalScript(%d)\n", param);
- }
- break;
+ if (opcode - 1 == 0x31) {
+ sprintf(lineBuffer, "startGlobalScript(%d)\n", param);
+ } else if (opcode - 1 == 0x32) {
+ sprintf(lineBuffer, "endGlobalScript(%d)\n", param);
}
+ break;
+ }
case 0x3B:
case 0x3C:
case 0x3D:
- case OP_loadPart:
- {
- if (opcode - 1 == 0x3B) {
- sprintf(lineBuffer, "loadResource(%s)\n", localScriptPtr + position);
- } else if (opcode - 1 == 0x3C) {
- sprintf(lineBuffer, "loadBg(%s)\n", localScriptPtr + position);
- } else if (opcode - 1 == 0x3D) {
- sprintf(lineBuffer, "loadCt(%s)\n", localScriptPtr + position);
- } else if (opcode - 1 == OP_loadPart) {
- sprintf(lineBuffer, "loadPart(%s)\n", localScriptPtr + position);
- }
-
- position += strlen((const char *)localScriptPtr + position) + 1;
- break;
- }
- case 0x40:
- {
- sprintf(lineBuffer, "closePart()\n");
- break;
- }
- case OP_loadNewPrcName:
- {
- byte param;
+ case OP_loadPart: {
+ if (opcode - 1 == 0x3B) {
+ sprintf(lineBuffer, "loadResource(%s)\n", localScriptPtr + position);
+ } else if (opcode - 1 == 0x3C) {
+ sprintf(lineBuffer, "loadBg(%s)\n", localScriptPtr + position);
+ } else if (opcode - 1 == 0x3D) {
+ sprintf(lineBuffer, "loadCt(%s)\n", localScriptPtr + position);
+ } else if (opcode - 1 == OP_loadPart) {
+ sprintf(lineBuffer, "loadPart(%s)\n", localScriptPtr + position);
+ }
+
+ position += strlen((const char *)localScriptPtr + position) + 1;
+ break;
+ }
+ case 0x40: {
+ sprintf(lineBuffer, "closePart()\n");
+ break;
+ }
+ case OP_loadNewPrcName: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "loadPrc(%d,%s)\n", param, localScriptPtr + position);
+ sprintf(lineBuffer, "loadPrc(%d,%s)\n", param, localScriptPtr + position);
- position += strlen((const char *)localScriptPtr + position) + 1;
- break;
- }
- case OP_requestCheckPendingDataLoad: // nop
- {
- sprintf(lineBuffer, "requestCheckPendingDataLoad()\n");
- break;
- }
- case 0x45:
- {
- sprintf(lineBuffer, "blitAndFade()\n");
- break;
- }
- case 0x46:
- {
- sprintf(lineBuffer, "fadeToBlack()\n");
- break;
- }
- case 0x47:
- {
- byte param1;
- byte param2;
- int16 param3;
- int16 param4;
- int16 param5;
+ position += strlen((const char *)localScriptPtr + position) + 1;
+ break;
+ }
+ case OP_requestCheckPendingDataLoad: { // nop
+ sprintf(lineBuffer, "requestCheckPendingDataLoad()\n");
+ break;
+ }
+ case 0x45: {
+ sprintf(lineBuffer, "blitAndFade()\n");
+ break;
+ }
+ case 0x46: {
+ sprintf(lineBuffer, "fadeToBlack()\n");
+ break;
+ }
+ case 0x47: {
+ byte param1;
+ byte param2;
+ int16 param3;
+ int16 param4;
+ int16 param5;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param4 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param4 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param5 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param5 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(lineBuffer, "transformPaletteRange(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
+ sprintf(lineBuffer, "transformPaletteRange(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
- break;
- }
- case 0x49:
- {
- byte param;
+ break;
+ }
+ case 0x49: {
+ byte param;
- param = *(localScriptPtr + position);
- position++;
+ param = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "setDefaultMenuBgColor(%d)\n", param);
+ sprintf(lineBuffer, "setDefaultMenuBgColor(%d)\n", param);
- break;
- }
- case 0x4F:
- {
- sprintf(lineBuffer, "break()\n");
- exitScript = 1;
- break;
- }
- case 0x50:
- {
- sprintf(lineBuffer, "endScript()\n\n");
- break;
- }
- case 0x51:
- {
- byte param1;
- int16 param2;
- int16 param3;
- int16 param4;
- int16 param5;
+ break;
+ }
+ case 0x4F: {
+ sprintf(lineBuffer, "break()\n");
+ exitScript = 1;
+ break;
+ }
+ case 0x50: {
+ sprintf(lineBuffer, "endScript()\n\n");
+ break;
+ }
+ case 0x51: {
+ byte param1;
+ int16 param2;
+ int16 param3;
+ int16 param4;
+ int16 param5;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param2 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param4 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param4 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param5 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param5 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(lineBuffer, "message(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
+ sprintf(lineBuffer, "message(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
- break;
- }
+ break;
+ }
case 0x52:
- case 0x53:
- {
- byte param1;
- byte param2;
+ case 0x53: {
+ byte param1;
+ byte param2;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- if (param2) {
- byte param3;
-
- param3 = *(localScriptPtr + position);
- position++;
-
- if (param2 == 1) {
- if (opcode - 1 == 0x52) {
- sprintf(lineBuffer, "globalVar[%d] = var[%d]\n", param1, param3);
- } else if (opcode - 1 == 0x53) {
- sprintf(compareString1, "globalVar[%d]", param1);
- sprintf(compareString2, "var[%d]", param3);
- }
- } else if (param2 == 2) {
- if (opcode - 1 == 0x52) {
- sprintf(lineBuffer, "globalVar[%d] = globalVar[%d]\n", param1, param3);
- } else if (opcode - 1 == 0x53) {
- sprintf(compareString1, "globalVar[%d]", param1);
- sprintf(compareString2, "globalVar[%d]", param3);
- }
- } else {
- if (opcode - 1 == 0x52) {
- error("decompileScript: 0x52: param2 = %d", param2);
- } else if (opcode - 1 == 0x53) {
- error("decompileScript: 0x53: param2 = %d", param2);
- }
- }
- } else {
- int16 param3;
+ if (param2) {
+ byte param3;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = *(localScriptPtr + position);
+ position++;
+ if (param2 == 1) {
if (opcode - 1 == 0x52) {
- sprintf(lineBuffer, "globalVar[%d] = %d\n", param1, param3);
+ sprintf(lineBuffer, "globalVar[%d] = var[%d]\n", param1, param3);
} else if (opcode - 1 == 0x53) {
sprintf(compareString1, "globalVar[%d]", param1);
- sprintf(compareString2, "%d", param3);
+ sprintf(compareString2, "var[%d]", param3);
+ }
+ } else if (param2 == 2) {
+ if (opcode - 1 == 0x52) {
+ sprintf(lineBuffer, "globalVar[%d] = globalVar[%d]\n", param1, param3);
+ } else if (opcode - 1 == 0x53) {
+ sprintf(compareString1, "globalVar[%d]", param1);
+ sprintf(compareString2, "globalVar[%d]", param3);
+ }
+ } else {
+ if (opcode - 1 == 0x52) {
+ error("decompileScript: 0x52: param2 = %d", param2);
+ } else if (opcode - 1 == 0x53) {
+ error("decompileScript: 0x53: param2 = %d", param2);
}
}
- break;
- }
- case 0x59:
- {
- sprintf(lineBuffer, "comment: %s\n", localScriptPtr + position);
+ } else {
+ int16 param3;
- position += strlen((const char *)localScriptPtr + position);
- break;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
+
+ if (opcode - 1 == 0x52) {
+ sprintf(lineBuffer, "globalVar[%d] = %d\n", param1, param3);
+ } else if (opcode - 1 == 0x53) {
+ sprintf(compareString1, "globalVar[%d]", param1);
+ sprintf(compareString2, "%d", param3);
+ }
}
- case 0x5A:
- {
- byte param1;
- byte param2;
+ break;
+ }
+ case 0x59: {
+ sprintf(lineBuffer, "comment: %s\n", localScriptPtr + position);
- param1 = *(localScriptPtr + position);
- position++;
+ position += strlen((const char *)localScriptPtr + position);
+ break;
+ }
+ case 0x5A: {
+ byte param1;
+ byte param2;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "freePartRang(%d,%d)\n", param1, param2);
+ param2 = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x5B:
- {
- sprintf(lineBuffer, "unloadAllMasks()\n");
- break;
- }
- case 0x65:
- {
- sprintf(lineBuffer, "setupTableUnk1()\n");
- break;
- }
- case 0x66:
- {
- byte param1;
- int16 param2;
+ sprintf(lineBuffer, "freePartRang(%d,%d)\n", param1, param2);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x5B: {
+ sprintf(lineBuffer, "unloadAllMasks()\n");
+ break;
+ }
+ case 0x65: {
+ sprintf(lineBuffer, "setupTableUnk1()\n");
+ break;
+ }
+ case 0x66: {
+ byte param1;
+ int16 param2;
- param2 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param1 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "tableUnk1[%d] = %d\n", param1, param2);
+ param2 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- break;
- }
- case 0x68:
- {
- byte param;
+ sprintf(lineBuffer, "tableUnk1[%d] = %d\n", param1, param2);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x68: {
+ byte param;
- sprintf(lineBuffer, "setPlayerCommandPosY(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x69:
- {
- sprintf(lineBuffer, "allowPlayerInput()\n");
- break;
- }
- case 0x6A:
- {
- sprintf(lineBuffer, "disallowPlayerInput()\n");
- break;
- }
- case 0x6B:
- {
- byte newDisk;
+ sprintf(lineBuffer, "setPlayerCommandPosY(%d)\n", param);
- newDisk = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x69: {
+ sprintf(lineBuffer, "allowPlayerInput()\n");
+ break;
+ }
+ case 0x6A: {
+ sprintf(lineBuffer, "disallowPlayerInput()\n");
+ break;
+ }
+ case 0x6B: {
+ byte newDisk;
- sprintf(lineBuffer, "changeDataDisk(%d)\n", newDisk);
+ newDisk = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x6D:
- {
- sprintf(lineBuffer, "loadDat(%s)\n", localScriptPtr + position);
+ sprintf(lineBuffer, "changeDataDisk(%d)\n", newDisk);
- position += strlen((const char *)localScriptPtr + position) + 1;
- break;
- }
- case 0x6E: // nop
- {
- sprintf(lineBuffer, "updateDat()\n");
- break;
- }
- case 0x6F:
- {
- sprintf(lineBuffer, "OP_6F() -> dat related\n");
- break;
- }
- case 0x70:
- {
- sprintf(lineBuffer, "stopSample()\n");
- break;
- }
- case 0x79:
- {
- byte param;
+ break;
+ }
+ case 0x6D: {
+ sprintf(lineBuffer, "loadDat(%s)\n", localScriptPtr + position);
- param = *(localScriptPtr + position);
- position++;
+ position += strlen((const char *)localScriptPtr + position) + 1;
+ break;
+ }
+ case 0x6E: { // nop
+ sprintf(lineBuffer, "updateDat()\n");
+ break;
+ }
+ case 0x6F: {
+ sprintf(lineBuffer, "OP_6F() -> dat related\n");
+ break;
+ }
+ case 0x70: {
+ sprintf(lineBuffer, "stopSample()\n");
+ break;
+ }
+ case 0x79: {
+ byte param;
- sprintf(lineBuffer, "disableSystemMenu(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
+ sprintf(lineBuffer, "disableSystemMenu(%d)\n", param);
+
+ break;
+ }
case 0x77:
- case 0x78:
- {
- byte param1;
- byte param2;
- int16 param3;
- byte param4;
- int16 param5;
- int16 param6;
+ case 0x78: {
+ byte param1;
+ byte param2;
+ int16 param3;
+ byte param4;
+ int16 param5;
+ int16 param6;
- param1 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param4 = *(localScriptPtr + position);
- position++;
+ param4 = *(localScriptPtr + position);
+ position++;
- param5 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
-
- param6 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param5 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- if (opcode - 1 == 0x77) {
- sprintf(lineBuffer, "playSample(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
- } else if (opcode - 1 == 0x78) {
- sprintf(lineBuffer, "OP_78(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
- }
+ param6 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- break;
+ if (opcode - 1 == 0x77) {
+ sprintf(lineBuffer, "playSample(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
+ } else if (opcode - 1 == 0x78) {
+ sprintf(lineBuffer, "playSampleSwapped(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
}
- case 0x7A:
- {
- byte param;
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x7A: {
+ byte param;
- sprintf(lineBuffer, "OP_7A(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x7B: // OS only
- {
- byte param;
+ sprintf(lineBuffer, "OP_7A(%d)\n", param);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x7B: { // OS only
+ byte param;
- sprintf(lineBuffer, "OP_7B(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x7F: // OS only
- {
- byte param1;
- byte param2;
- byte param3;
- byte param4;
- int16 param5;
- int16 param6;
- int16 param7;
+ sprintf(lineBuffer, "OP_7B(%d)\n", param);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x7F: { // OS only
+ byte param1;
+ byte param2;
+ byte param3;
+ byte param4;
+ int16 param5;
+ int16 param6;
+ int16 param7;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param3 = *(localScriptPtr + position);
- position++;
+ param2 = *(localScriptPtr + position);
+ position++;
- param4 = *(localScriptPtr + position);
- position++;
+ param3 = *(localScriptPtr + position);
+ position++;
- param5 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param4 = *(localScriptPtr + position);
+ position++;
- param6 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param5 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param7 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param6 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(lineBuffer, "OP_7F(%d,%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6, param7);
+ param7 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- break;
- }
- case 0x80: // OS only
- {
- byte param1;
- byte param2;
+ sprintf(lineBuffer, "OP_7F(%d,%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6, param7);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x80: { // OS only
+ byte param1;
+ byte param2;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "OP_80(%d,%d)\n", param1, param2);
+ param2 = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x82: // OS only
- {
- byte param1;
- byte param2;
- uint16 param3;
- uint16 param4;
- byte param5;
+ sprintf(lineBuffer, "OP_80(%d,%d)\n", param1, param2);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x82: { // OS only
+ byte param1;
+ byte param2;
+ uint16 param3;
+ uint16 param4;
+ byte param5;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param2 = *(localScriptPtr + position);
+ position++;
- param4 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param5 = *(localScriptPtr + position);
- position++;
+ param4 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(lineBuffer, "OP_82(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
+ param5 = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x83: // OS only
- {
- byte param1;
- byte param2;
+ sprintf(lineBuffer, "OP_82(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x83: { // OS only
+ byte param1;
+ byte param2;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "OP_83(%d,%d)\n", param1, param2);
+ param2 = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x89: // OS only
- {
- byte param;
+ sprintf(lineBuffer, "OP_83(%d,%d)\n", param1, param2);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x89: { // OS only
+ byte param;
- sprintf(lineBuffer, "if(%s!=%s) goto next label(%d)\n", compareString1, compareString2, param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x8B: // OS only
- {
- byte param;
+ sprintf(lineBuffer, "if(%s!=%s) goto next label(%d)\n", compareString1, compareString2, param);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x8B: { // OS only
+ byte param;
- sprintf(lineBuffer, "OP_8B(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x8C: // OS only
- {
- byte param;
+ sprintf(lineBuffer, "OP_8B(%d)\n", param);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x8C: { // OS only
+ byte param;
- sprintf(lineBuffer, "OP_8C(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x8D: // OS only
- {
- int16 param1;
- int16 param2;
- int16 param3;
- int16 param4;
- int16 param5;
- int16 param6;
- int16 param7;
- int16 param8;
+ sprintf(lineBuffer, "OP_8C(%d)\n", param);
- param1 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ break;
+ }
+ case 0x8D: { // OS only
+ int16 param1;
+ int16 param2;
+ int16 param3;
+ int16 param4;
+ int16 param5;
+ int16 param6;
+ int16 param7;
+ int16 param8;
- param2 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param1 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param3 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param2 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param4 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param3 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param5 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param4 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param6 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param5 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param7 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param6 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- param8 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ param7 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- sprintf(compareString1, "obj[%d]", param1);
- sprintf(compareString2, "{%d,%d,%d,%d,%d,%d,%d}", param2, param3, param4, param5, param6, param7, param8);
+ param8 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- break;
- }
- case 0x8E: // OS only
- {
- byte param1;
+ sprintf(compareString1, "obj[%d]", param1);
+ sprintf(compareString2, "{%d,%d,%d,%d,%d,%d,%d}", param2, param3, param4, param5, param6, param7, param8);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x8E: { // OS only
+ byte param1;
- sprintf(lineBuffer, "ADDBG(%d,%s)\n", param1, localScriptPtr + position);
+ param1 = *(localScriptPtr + position);
+ position++;
- position += strlen((const char *)localScriptPtr + position);
+ sprintf(lineBuffer, "ADDBG(%d,%s)\n", param1, localScriptPtr + position);
- break;
- }
- case 0x8F: // OS only
- {
- byte param;
+ position += strlen((const char *)localScriptPtr + position);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x8F: { // OS only
+ byte param;
- sprintf(lineBuffer, "OP_8F(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x90: // OS only
- {
- byte param1;
+ sprintf(lineBuffer, "OP_8F(%d)\n", param);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x90: { // OS only
+ byte param1;
- sprintf(lineBuffer, "loadABS(%d,%s)\n", param1, localScriptPtr + position);
+ param1 = *(localScriptPtr + position);
+ position++;
- position += strlen((const char *)localScriptPtr + position);
+ sprintf(lineBuffer, "loadABS(%d,%s)\n", param1, localScriptPtr + position);
- break;
- }
- case 0x91: // OS only
- {
- byte param;
+ position += strlen((const char *)localScriptPtr + position);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x91: { // OS only
+ byte param;
- sprintf(lineBuffer, "OP_91(%d)\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x9D: // OS only
- {
- byte param;
+ sprintf(lineBuffer, "OP_91(%d)\n", param);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x9D: { // OS only
+ byte param;
- sprintf(lineBuffer, "OP_9D(%d) -> flip img idx\n", param);
+ param = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0x9E: // OS only
- {
- byte param;
+ sprintf(lineBuffer, "OP_9D(%d) -> flip img idx\n", param);
- param = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0x9E: { // OS only
+ byte param;
- if (param) {
- byte param2;
+ param = *(localScriptPtr + position);
+ position++;
- param2 = *(localScriptPtr + position);
- position++;
+ if (param) {
+ byte param2;
- sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
- } else {
- int16 param2;
+ param2 = *(localScriptPtr + position);
+ position++;
- param2 = READ_BE_UINT16(localScriptPtr + position);
- position += 2;
+ sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
+ } else {
+ int16 param2;
- sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
- }
+ param2 = READ_BE_UINT16(localScriptPtr + position);
+ position += 2;
- break;
+ sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
}
- case 0xA0: // OS only
- {
- byte param1;
- byte param2;
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0xA0: { // OS only
+ byte param1;
+ byte param2;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "OP_A0(%d,%d)\n", param1, param2);
+ param2 = *(localScriptPtr + position);
+ position++;
- break;
- }
- case 0xA1: // OS only
- {
- byte param1;
- byte param2;
+ sprintf(lineBuffer, "OP_A0(%d,%d)\n", param1, param2);
- param1 = *(localScriptPtr + position);
- position++;
+ break;
+ }
+ case 0xA1: { // OS only
+ byte param1;
+ byte param2;
- param2 = *(localScriptPtr + position);
- position++;
+ param1 = *(localScriptPtr + position);
+ position++;
- sprintf(lineBuffer, "OP_A1(%d,%d)\n", param1, param2);
+ param2 = *(localScriptPtr + position);
+ position++;
- break;
- }
- default:
- {
- sprintf(lineBuffer, "Unsupported opcode %X in decompileScript\n\n", opcode - 1);
- position = scriptSize;
- break;
- }
+ sprintf(lineBuffer, "OP_A1(%d,%d)\n", param1, param2);
+
+ break;
+ }
+ default: {
+ sprintf(lineBuffer, "Unsupported opcode %X in decompileScript\n\n", opcode - 1);
+ position = scriptSize;
+ break;
+ }
}
- // printf(lineBuffer);
+ //printf(lineBuffer);
strcpy(decompileBuffer[decompileBufferPosition++], lineBuffer);
exitScript = 0;
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index b2e992e8f6..10404ae56b 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -153,7 +153,7 @@ const int AdLibSoundDriver::_freqTable[] = {
const int AdLibSoundDriver::_freqTableCount = ARRAYSIZE(_freqTable);
const int AdLibSoundDriver::_operatorsTable[] = {
- 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21
+ 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21
};
const int AdLibSoundDriver::_operatorsTableCount = ARRAYSIZE(_operatorsTable);
@@ -614,7 +614,7 @@ void AdLibSoundDriverADL::playSample(const byte *data, int size, int channel, in
}
MidiSoundDriverH32::MidiSoundDriverH32(MidiDriver *output)
- : _output(output), _callback(0), _mutex() {
+ : _output(output), _callback(0), _mutex() {
}
MidiSoundDriverH32::~MidiSoundDriverH32() {
@@ -731,13 +731,13 @@ void MidiSoundDriverH32::selectInstrument(int channel, int timbreGroup, int timb
0x00, 0x00, 0x00, // offset
0x00, // Timbre group _ timbreGroup * 64 + timbreNumber should be the
0x00, // Timbre number / MT-32 instrument in case timbreGroup is 0 or 1.
- 0x18, // Key shift (= 0)
+ 0x18, // Key shift (= 0)
0x32, // Fine tune (= 0)
0x0C, // Bender Range
0x03, // Assign Mode
0x01, // Reverb Switch (= enabled)
0x00, // dummy
- 0x00, // Output level
+ 0x00, // Output level
0x07, // Panpot (= balanced)
0x00, // dummy
0x00, // dummy
@@ -785,7 +785,6 @@ PCSoundFxPlayer::~PCSoundFxPlayer() {
bool PCSoundFxPlayer::load(const char *song) {
debug(9, "PCSoundFxPlayer::load('%s')", song);
- Common::StackLock lock(_mutex);
/* stop (w/ fade out) the previous song */
while (_fadeOutCounter != 0 && _fadeOutCounter < 100) {
@@ -793,6 +792,8 @@ bool PCSoundFxPlayer::load(const char *song) {
}
_fadeOutCounter = 0;
+ Common::StackLock lock(_mutex);
+
stop();
_sfxData = readBundleSoundFile(song);
@@ -997,19 +998,55 @@ void PCSound::stopSound(int channel) {
}
PaulaSound::PaulaSound(Audio::Mixer *mixer, CineEngine *vm)
- : Sound(mixer, vm) {
+ : Sound(mixer, vm), _sfxTimer(0), _musicTimer(0), _musicFadeTimer(0) {
_moduleStream = 0;
+ // The original is using the following timer frequency:
+ // 0.709379Mhz / 8000 = 88.672375Hz
+ // 1000000 / 88.672375Hz = 11277.46944863us
+ g_system->getTimerManager()->installTimerProc(&PaulaSound::sfxTimerProc, 11277, this, "PaulaSound::sfxTimerProc");
+ // The original is using the following timer frequency:
+ // 0.709379Mhz / 14565 = 48.704359Hz
+ // 1000000 / 48.704359Hz = 20532.04313806us
+ g_system->getTimerManager()->installTimerProc(&PaulaSound::musicTimerProc, 20532, this, "PaulaSound::musicTimerProc");
}
PaulaSound::~PaulaSound() {
+ Common::StackLock sfxLock(_sfxMutex);
+ g_system->getTimerManager()->removeTimerProc(&PaulaSound::sfxTimerProc);
for (int i = 0; i < NUM_CHANNELS; ++i) {
stopSound(i);
}
+
+ Common::StackLock musicLock(_musicMutex);
+ g_system->getTimerManager()->removeTimerProc(&PaulaSound::musicTimerProc);
stopMusic();
}
void PaulaSound::loadMusic(const char *name) {
debugC(5, kCineDebugSound, "PaulaSound::loadMusic('%s')", name);
+ for (int i = 0; i < NUM_CHANNELS; ++i) {
+ stopSound(i);
+ }
+
+ // Fade music out when there is music playing.
+ _musicMutex.lock();
+ if (_mixer->isSoundHandleActive(_moduleHandle)) {
+ // Only start fade out when it is not in progress.
+ if (!_musicFadeTimer) {
+ _musicFadeTimer = 1;
+ }
+
+ _musicMutex.unlock();
+ while (_musicFadeTimer != 64) {
+ g_system->delayMillis(50);
+ }
+ } else {
+ _musicMutex.unlock();
+ }
+
+ Common::StackLock lock(_musicMutex);
+ assert(!_mixer->isSoundHandleActive(_moduleHandle));
+
if (_vm->getGameType() == GType_FW) {
// look for separate files
Common::File f;
@@ -1030,54 +1067,135 @@ void PaulaSound::loadMusic(const char *name) {
void PaulaSound::playMusic() {
debugC(5, kCineDebugSound, "PaulaSound::playMusic()");
+ Common::StackLock lock(_musicMutex);
+
_mixer->stopHandle(_moduleHandle);
if (_moduleStream) {
+ _musicFadeTimer = 0;
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_moduleHandle, _moduleStream);
}
}
void PaulaSound::stopMusic() {
debugC(5, kCineDebugSound, "PaulaSound::stopMusic()");
+ Common::StackLock lock(_musicMutex);
+
_mixer->stopHandle(_moduleHandle);
}
void PaulaSound::fadeOutMusic() {
debugC(5, kCineDebugSound, "PaulaSound::fadeOutMusic()");
- // TODO
- stopMusic();
+ Common::StackLock lock(_musicMutex);
+
+ _musicFadeTimer = 1;
}
void PaulaSound::playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) {
- // TODO: handle volume slides and repeat
debugC(5, kCineDebugSound, "PaulaSound::playSound() channel %d size %d", channel, size);
+ Common::StackLock lock(_sfxMutex);
+ assert(frequency > 0);
+
stopSound(channel);
- size = MIN<int>(size - SPL_HDR_SIZE, READ_BE_UINT16(data + 4));
- // TODO: consider skipping the header in loadSpl directly
if (size > 0) {
byte *sound = (byte *)malloc(size);
if (sound) {
- memcpy(sound, data + SPL_HDR_SIZE, size);
- playSoundChannel(channel, frequency, sound, size, volume);
+ // Create the audio stream
+ memcpy(sound, data, size);
+
+ // Clear the first and last 16 bits like in the original.
+ sound[0] = sound[1] = sound[size - 2] = sound[size - 1] = 0;
+
+ Audio::SeekableAudioStream *stream = Audio::makeRawStream(sound, size, PAULA_FREQ / frequency, 0);
+
+ // Initialize the volume control
+ _channelsTable[channel].initialize(volume, volumeStep, stepCount);
+
+ // Start the sfx
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_channelsTable[channel].handle,
+ Audio::makeLoopingAudioStream(stream, repeat ? 0 : 1),
+ -1, volume * Audio::Mixer::kMaxChannelVolume / 63,
+ _channelBalance[channel]);
}
}
}
void PaulaSound::stopSound(int channel) {
debugC(5, kCineDebugSound, "PaulaSound::stopSound() channel %d", channel);
- _mixer->stopHandle(_channelsTable[channel]);
+ Common::StackLock lock(_sfxMutex);
+
+ _mixer->stopHandle(_channelsTable[channel].handle);
}
-void PaulaSound::update() {
- // process volume slides and start sound playback
- // TODO
+void PaulaSound::sfxTimerProc(void *param) {
+ PaulaSound *sound = (PaulaSound *)param;
+ sound->sfxTimerCallback();
}
-void PaulaSound::playSoundChannel(int channel, int frequency, uint8 *data, int size, int volume) {
- assert(frequency > 0);
- frequency = PAULA_FREQ / frequency;
- Audio::AudioStream *stream = Audio::makeRawStream(data, size, frequency, 0);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_channelsTable[channel], stream);
- _mixer->setChannelVolume(_channelsTable[channel], volume * Audio::Mixer::kMaxChannelVolume / 63);
+void PaulaSound::sfxTimerCallback() {
+ Common::StackLock lock(_sfxMutex);
+
+ if (_sfxTimer < 6) {
+ ++_sfxTimer;
+
+ for (int i = 0; i < NUM_CHANNELS; ++i) {
+ // Only process active channels
+ if (!_mixer->isSoundHandleActive(_channelsTable[i].handle)) {
+ continue;
+ }
+
+ if (_channelsTable[i].curStep) {
+ --_channelsTable[i].curStep;
+ } else {
+ _channelsTable[i].curStep = _channelsTable[i].stepCount;
+ const int volume = CLIP(_channelsTable[i].volume + _channelsTable[i].volumeStep, 0, 63);
+ _channelsTable[i].volume = volume;
+ // Unlike the original we stop silent sounds
+ if (volume) {
+ _mixer->setChannelVolume(_channelsTable[i].handle, volume * Audio::Mixer::kMaxChannelVolume / 63);
+ } else {
+ _mixer->stopHandle(_channelsTable[i].handle);
+ }
+ }
+ }
+ } else {
+ _sfxTimer = 0;
+ // Possible TODO: The original only ever started sounds here. This
+ // should not be noticable though. So we do not do it for now.
+ }
+}
+
+void PaulaSound::musicTimerProc(void *param) {
+ PaulaSound *sound = (PaulaSound *)param;
+ sound->musicTimerCallback();
+}
+
+void PaulaSound::musicTimerCallback() {
+ Common::StackLock lock(_musicMutex);
+
+ ++_musicTimer;
+ if (_musicTimer == 6) {
+ _musicTimer = 0;
+ if (_musicFadeTimer) {
+ ++_musicFadeTimer;
+ if (_musicFadeTimer == 64) {
+ stopMusic();
+ } else {
+ if (_mixer->isSoundHandleActive(_moduleHandle)) {
+ _mixer->setChannelVolume(_moduleHandle, (64 - _musicFadeTimer) * Audio::Mixer::kMaxChannelVolume / 64);
+ }
+ }
+ }
+ }
}
+const int PaulaSound::_channelBalance[NUM_CHANNELS] = {
+ // L/R/R/L This is according to the Hardware Reference Manual.
+ // TODO: It seems the order is swapped for some Amiga models:
+ // http://www.amiga.org/forums/archive/index.php/t-7862.html
+ // Maybe we should consider using R/L/L/R to match Amiga 500?
+ // This also is a bit more drastic to what WineUAE defaults,
+ // which is only 70% of full panning.
+ -127, 127, 127, -127
+};
+
} // End of namespace Cine
diff --git a/engines/cine/sound.h b/engines/cine/sound.h
index afc0994a26..fdb183ad34 100644
--- a/engines/cine/sound.h
+++ b/engines/cine/sound.h
@@ -24,6 +24,7 @@
#define CINE_SOUND_H_
#include "common/util.h"
+#include "common/mutex.h"
#include "audio/mixer.h"
namespace Audio {
@@ -47,7 +48,6 @@ public:
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) = 0;
virtual void stopSound(int channel) = 0;
- virtual void update() {}
protected:
@@ -91,19 +91,39 @@ public:
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat);
virtual void stopSound(int channel);
- virtual void update();
enum {
- PAULA_FREQ = 7093789,
- NUM_CHANNELS = 4,
- SPL_HDR_SIZE = 22
+ PAULA_FREQ = 3579545,
+ NUM_CHANNELS = 4
};
protected:
- void playSoundChannel(int channel, int frequency, uint8 *data, int size, int volume);
-
- Audio::SoundHandle _channelsTable[NUM_CHANNELS];
+ struct SfxChannel {
+ Audio::SoundHandle handle;
+ int volume;
+ int volumeStep;
+ int curStep;
+ int stepCount;
+
+ void initialize(int vol, int volStep, int stepCnt) {
+ volume = vol;
+ volumeStep = volStep;
+ curStep = stepCount = stepCnt;
+ }
+ };
+ SfxChannel _channelsTable[NUM_CHANNELS];
+ static const int _channelBalance[NUM_CHANNELS];
+ Common::Mutex _sfxMutex;
+ int _sfxTimer;
+ static void sfxTimerProc(void *param);
+ void sfxTimerCallback();
+
+ Common::Mutex _musicMutex;
+ int _musicTimer;
+ int _musicFadeTimer;
+ static void musicTimerProc(void *param);
+ void musicTimerCallback();
Audio::SoundHandle _moduleHandle;
Audio::AudioStream *_moduleStream;
};
diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp
index 33ea569df7..998075c6ce 100644
--- a/engines/cine/texte.cpp
+++ b/engines/cine/texte.cpp
@@ -88,7 +88,7 @@ static const CharacterEntry fontParamTable_standard[NUM_FONT_CHARS] = {
{64, 3}, {65, 3}, { 0, 0}, { 0, 0}, {62, 2}, {74, 6}, {66, 1}, {67, 6},
{52, 6}, {53, 6}, {54, 6}, {55, 6}, {56, 6}, {57, 6}, {58, 6}, {59, 6},
{60, 6}, {61, 6}, {76, 3}, { 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, {75, 6},
- { 0, 0}, { 0, 6}, //a
+ { 0, 0}, { 0, 6}, //a
{ 1, 6}, { 2, 6}, { 3, 6}, { 4, 6}, { 5, 6}, { 6, 6},
{ 7, 6}, { 8, 3}, { 9, 6}, {10, 6}, {11, 6}, {12, 7}, {13, 6}, {14, 6},
{15, 6}, {16, 6}, {17, 6}, {18, 6}, {19, 6}, {20, 6}, {21, 6}, {22, 7},
diff --git a/engines/cine/texte.h b/engines/cine/texte.h
index dd4b7e06ee..185dc53bfd 100644
--- a/engines/cine/texte.h
+++ b/engines/cine/texte.h
@@ -46,7 +46,7 @@ struct CharacterEntry {
};
struct TextHandler {
- byte textTable[NUM_FONT_CHARS][2][FONT_WIDTH * FONT_HEIGHT];
+ byte textTable[NUM_FONT_CHARS][2][FONT_WIDTH *FONT_HEIGHT];
CharacterEntry fontParamTable[NUM_FONT_CHARS];
};
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 9b73ae1101..23f439a7a7 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -36,7 +36,7 @@
namespace Cine {
-bool disableSystemMenu = false;
+int16 disableSystemMenu = 0;
bool inMenu;
int16 commandVar3[4];
@@ -99,8 +99,7 @@ byte isInPause = 0;
* Bit on = mouse button down
* Bit off = mouse button up
*/
-enum MouseButtonState
-{
+enum MouseButtonState {
kLeftMouseButton = (1 << 0),
kRightMouseButton = (1 << 1)
};
@@ -271,7 +270,7 @@ int16 getObjectUnderCursor(uint16 x, uint16 y) {
} else if (it->type == 1 && gfxGetBit(xdif, ydif, g_cine->_animDataTable[frame].data(), g_cine->_animDataTable[frame]._width * 4)) {
return it->objIdx;
}
- } else if (it->type == 0) { // use generated mask
+ } else if (it->type == 0) { // use generated mask
if (gfxGetBit(xdif, ydif, g_cine->_animDataTable[frame].mask(), g_cine->_animDataTable[frame]._width)) {
return it->objIdx;
}
@@ -341,7 +340,7 @@ void CineEngine::makeSystemMenu() {
int16 mouseX, mouseY, mouseButton;
int16 selectedSave;
- if (!disableSystemMenu) {
+ if (disableSystemMenu != 1) {
inMenu = true;
do {
@@ -358,128 +357,122 @@ void CineEngine::makeSystemMenu() {
systemCommand = makeMenuChoice(systemMenu, numEntry, mouseX, mouseY, 140);
switch (systemCommand) {
- case 0: // Pause
- {
- renderer->drawString(otherMessages[2], 0);
- waitPlayerInput();
- break;
- }
- case 1: // Restart Game
- {
- getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
- if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
- _restartRequested = true;
- }
- break;
- }
- case 2: // Quit
- {
- getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
- if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
- quitGame();
- }
- break;
+ case 0: { // Pause
+ renderer->drawString(otherMessages[2], 0);
+ waitPlayerInput();
+ break;
+ }
+ case 1: { // Restart Game
+ getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
+ if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
+ _restartRequested = true;
}
- case 3: // Select save drive... change ?
- {
- break;
+ break;
+ }
+ case 2: { // Quit
+ getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
+ if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
+ quitGame();
}
- case 4: // load game
- {
- if (loadSaveDirectory()) {
+ break;
+ }
+ case 3: { // Select save drive... change ?
+ break;
+ }
+ case 4: { // load game
+ if (loadSaveDirectory()) {
// int16 selectedSave;
- getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
- selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
+ getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
+ selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
- if (selectedSave >= 0) {
- char saveNameBuffer[256];
- sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), selectedSave);
+ if (selectedSave >= 0) {
+ char saveNameBuffer[256];
+ sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), selectedSave);
- getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
- if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
- char loadString[256];
+ getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
+ if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
+ char loadString[256];
- sprintf(loadString, otherMessages[3], currentSaveName[selectedSave]);
- renderer->drawString(loadString, 0);
+ sprintf(loadString, otherMessages[3], currentSaveName[selectedSave]);
+ renderer->drawString(loadString, 0);
- makeLoad(saveNameBuffer);
- } else {
- renderer->drawString(otherMessages[4], 0);
- waitPlayerInput();
- checkDataDisk(-1);
- }
+ makeLoad(saveNameBuffer);
} else {
renderer->drawString(otherMessages[4], 0);
waitPlayerInput();
checkDataDisk(-1);
}
} else {
- renderer->drawString(otherMessages[5], 0);
+ renderer->drawString(otherMessages[4], 0);
waitPlayerInput();
checkDataDisk(-1);
}
- break;
+ } else {
+ renderer->drawString(otherMessages[5], 0);
+ waitPlayerInput();
+ checkDataDisk(-1);
}
- case 5: // Save game
- {
- loadSaveDirectory();
- selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
+ break;
+ }
+ case 5: { // Save game
+ loadSaveDirectory();
+ selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
- if (selectedSave >= 0) {
- char saveFileName[256];
- char saveName[20];
- saveName[0] = 0;
+ if (selectedSave >= 0) {
+ char saveFileName[256];
+ char saveName[20];
+ saveName[0] = 0;
- if (!makeTextEntryMenu(otherMessages[6], saveName, 20, 120))
- break;
+ if (!makeTextEntryMenu(otherMessages[6], saveName, 20, 120))
+ break;
- strncpy(currentSaveName[selectedSave], saveName, 20);
+ strncpy(currentSaveName[selectedSave], saveName, 20);
- sprintf(saveFileName, "%s.%1d", _targetName.c_str(), selectedSave);
+ sprintf(saveFileName, "%s.%1d", _targetName.c_str(), selectedSave);
- getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
- if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
- char saveString[256];
- Common::String tmp = Common::String::format("%s.dir", _targetName.c_str());
+ getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
+ if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
+ char saveString[256];
+ Common::String tmp = Common::String::format("%s.dir", _targetName.c_str());
- Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(tmp);
- if (!fHandle) {
- warning("Unable to open file %s for saving", tmp.c_str());
- break;
- }
+ Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(tmp);
+ if (!fHandle) {
+ warning("Unable to open file %s for saving", tmp.c_str());
+ break;
+ }
- fHandle->write(currentSaveName, 200);
- delete fHandle;
+ fHandle->write(currentSaveName, 200);
+ delete fHandle;
- sprintf(saveString, otherMessages[3], currentSaveName[selectedSave]);
- renderer->drawString(saveString, 0);
+ sprintf(saveString, otherMessages[3], currentSaveName[selectedSave]);
+ renderer->drawString(saveString, 0);
- makeSave(saveFileName);
+ makeSave(saveFileName);
- checkDataDisk(-1);
- } else {
- renderer->drawString(otherMessages[4], 0);
- waitPlayerInput();
- checkDataDisk(-1);
- }
+ checkDataDisk(-1);
+ } else {
+ renderer->drawString(otherMessages[4], 0);
+ waitPlayerInput();
+ checkDataDisk(-1);
}
- break;
}
+ break;
+ }
}
inMenu = false;
}
}
-void drawMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 offset, int16 color, byte* page) {
- gfxDrawLine(x + offset, y + offset, x + width - offset, y + offset, color, page); // top
- gfxDrawLine(x + offset, currentY + 4 - offset, x + width - offset, currentY + 4 - offset, color, page); // bottom
- gfxDrawLine(x + offset, y + offset, x + offset, currentY + 4 - offset, color, page); // left
- gfxDrawLine(x + width - offset, y + offset, x + width - offset, currentY + 4 - offset, color, page); // right
+void drawMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 offset, int16 color, byte *page) {
+ gfxDrawLine(x + offset, y + offset, x + width - offset, y + offset, color, page); // top
+ gfxDrawLine(x + offset, currentY + 4 - offset, x + width - offset, currentY + 4 - offset, color, page); // bottom
+ gfxDrawLine(x + offset, y + offset, x + offset, currentY + 4 - offset, color, page); // left
+ gfxDrawLine(x + width - offset, y + offset, x + width - offset, currentY + 4 - offset, color, page); // right
}
-void drawDoubleMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 color, byte* page) {
+void drawDoubleMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 color, byte *page) {
drawMessageBox(x, y, width, currentY, 1, 0, page);
drawMessageBox(x, y, width, currentY, 0, color, page);
}
@@ -544,14 +537,16 @@ int16 buildObjectListCommand(int16 param) {
int16 selectSubObject(int16 x, int16 y, int16 param) {
int16 listSize = buildObjectListCommand(param);
- int16 selectedObject;
+ int16 selectedObject = -1;
bool osExtras = g_cine->getGameType() == Cine::GType_OS;
if (!listSize) {
return -2;
}
- selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, osExtras);
+ if (disableSystemMenu == 0) {
+ selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, osExtras);
+ }
if (selectedObject == -1)
return -1;
@@ -579,7 +574,7 @@ void makeCommandLine() {
g_cine->_commandBuffer = "";
}
- if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection ?
+ if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection?
int16 si;
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
@@ -633,7 +628,7 @@ void makeCommandLine() {
}
if (g_cine->getGameType() == Cine::GType_OS && playerCommand != 2) {
- if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
+ if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
int16 si;
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
@@ -691,9 +686,6 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
int16 var_4;
SelectionMenu *menu;
- if (disableSystemMenu)
- return -1;
-
paramY = (height * 9) + 10;
if (X + width > 319) {
@@ -743,11 +735,11 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
mainLoopSub6();
}
- if (menuVar4 && currentSelection > 0) { // go up
+ if (menuVar4 && currentSelection > 0) { // go up
currentSelection--;
}
- if (menuVar5) { // go down
+ if (menuVar5) { // go down
if (height - 1 > currentSelection) {
currentSelection++;
}
@@ -764,7 +756,7 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
}
}
- if (currentSelection != oldSelection) { // old != new
+ if (currentSelection != oldSelection) { // old != new
if (needMouseSave) {
hideMouse();
}
@@ -790,7 +782,7 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
} while (button && !g_cine->shouldQuit());
- if (var_4 == 2) { // recheck
+ if (var_4 == 2) { // recheck
if (!recheckValue)
return -1;
else
@@ -810,14 +802,18 @@ void makeActionMenu() {
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
if (g_cine->getGameType() == Cine::GType_OS) {
- playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
+ if (disableSystemMenu == 0) {
+ playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
+ }
if (playerCommand >= 8000) {
playerCommand -= 8000;
canUseOnObject = canUseOnItemTable[playerCommand];
}
} else {
- playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
+ if (disableSystemMenu == 0) {
+ playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
+ }
}
inMenu = false;
@@ -1182,7 +1178,7 @@ void removeMessages() {
Common::List<overlay>::iterator it;
bool remove;
- for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end(); ) {
+ for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end();) {
if (g_cine->getGameType() == Cine::GType_OS) {
// NOTE: These are really removeOverlay calls that have been deferred.
// In Operation Stealth's disassembly elements are removed from the
@@ -1345,7 +1341,7 @@ void modifySeqListElement(uint16 objIdx, int16 var4Test, int16 param1, int16 par
}
void computeMove1(SeqListElement &element, int16 x, int16 y, int16 param1,
- int16 param2, int16 x2, int16 y2) {
+ int16 param2, int16 x2, int16 y2) {
element.var16 = 0;
element.var14 = 0;
@@ -1394,7 +1390,7 @@ uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &ele
int16 di;
debug(5, "addAni: param1 = %d, objIdx = %d, ptr = %p, element.var8 = %d, element.var14 = %d param3 = %d",
- param1, objIdx, ptr, element.var8, element.var14, param3);
+ param1, objIdx, ptr, element.var8, element.var14, param3);
// In the original an error string is set and 0 is returned if the following doesn't hold
assert(ptr);
@@ -1410,16 +1406,16 @@ uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &ele
di = (g_cine->_objectTable[objIdx].costume + 1) % (*ptrData);
++ptrData; // Jump over the just read byte
// Here ptr2 seems to be indexing a table of structs (8 bytes per struct):
- // struct {
- // int8 x; // 0 (Used with checkCollision)
- // int8 y; // 1 (Used with checkCollision)
- // int8 numZones; // 2 (Used with checkCollision)
- // int8 var3; // 3 (Not used in this function)
- // int8 xAdd; // 4 (Used with an object)
- // int8 yAdd; // 5 (Used with an object)
- // int8 maskAdd; // 6 (Used with an object)
- // int8 frameAdd; // 7 (Used with an object)
- // };
+ // struct {
+ // int8 x; // 0 (Used with checkCollision)
+ // int8 y; // 1 (Used with checkCollision)
+ // int8 numZones; // 2 (Used with checkCollision)
+ // int8 var3; // 3 (Not used in this function)
+ // int8 xAdd; // 4 (Used with an object)
+ // int8 yAdd; // 5 (Used with an object)
+ // int8 maskAdd; // 6 (Used with an object)
+ // int8 frameAdd; // 7 (Used with an object)
+ // };
ptr2 = ptrData + di * 8;
// We might probably safely discard the AND by 1 here because
@@ -1569,8 +1565,7 @@ void processSeqListElement(SeqListElement &element) {
var_4 = -1;
if ((element.var16 == 1
- && !addAni(3, element.objIdx, ptr1, element, 0, &var_4)) || (element.var16 == 2 && !addAni(2, element.objIdx, ptr1, element, 0,
- &var_4))) {
+ && !addAni(3, element.objIdx, ptr1, element, 0, &var_4)) || (element.var16 == 2 && !addAni(2, element.objIdx, ptr1, element, 0, &var_4))) {
if (element.varC == 255) {
g_cine->_globalVars[VAR_MOUSE_Y_POS] = 0;
}
@@ -1699,9 +1694,9 @@ bool makeTextEntryMenu(const char *messagePtr, char *inputString, int stringMaxL
}
break;
default:
- if (((keycode >= 'a') && (keycode <='z')) ||
- ((keycode >= '0') && (keycode <='9')) ||
- ((keycode >= 'A') && (keycode <='Z')) ||
+ if (((keycode >= 'a') && (keycode <= 'z')) ||
+ ((keycode >= '0') && (keycode <= '9')) ||
+ ((keycode >= 'A') && (keycode <= 'Z')) ||
(keycode == ' ')) {
if (inputLength < stringMaxLength - 1) {
ch[0] = keycode;
diff --git a/engines/cine/various.h b/engines/cine/various.h
index 0c1883c323..813619816d 100644
--- a/engines/cine/various.h
+++ b/engines/cine/various.h
@@ -41,7 +41,7 @@ void makeActionMenu();
void waitPlayerInput();
void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4);
-extern bool disableSystemMenu;
+extern int16 disableSystemMenu;
extern bool inMenu;
extern CommandeType currentSaveName[10];
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 556dad7e94..555b703da9 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -20,7 +20,7 @@
*
*/
#include "common/scummsys.h"
-
+
#include "common/config-manager.h"
#include "common/events.h"
#include "common/file.h"
@@ -381,11 +381,17 @@ void ComposerEngine::loadLibrary(uint id) {
filename = getStringFromConfig(_bookGroup, Common::String::format("%d", id));
filename = mangleFilename(filename);
+ // bookGroup is the basename of the path.
+ // TODO: tidy this up.
_bookGroup.clear();
for (uint i = 0; i < filename.size(); i++) {
- if (filename[i] == '\\' || filename[i] == ':')
+ if (filename[i] == '~' || filename[i] == '/' || filename[i] == ':')
continue;
for (uint j = 0; j < filename.size(); j++) {
+ if (filename[j] == '/') {
+ _bookGroup.clear();
+ continue;
+ }
if (filename[j] == '.')
break;
_bookGroup += filename[j];
diff --git a/engines/composer/resource.cpp b/engines/composer/resource.cpp
index a4e292747c..83e49971fb 100644
--- a/engines/composer/resource.cpp
+++ b/engines/composer/resource.cpp
@@ -240,7 +240,7 @@ bool ComposerArchive::openStream(Common::SeekableReadStream *stream) {
res.flags = flags;
debug(4, "Id %d, offset %d, size %d, flags %08x", id, offset, size, flags);
}
-
+
stream->seek(oldPos);
}
diff --git a/engines/configure.engines b/engines/configure.engines
new file mode 100644
index 0000000000..c7f142b684
--- /dev/null
+++ b/engines/configure.engines
@@ -0,0 +1,52 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine scumm "SCUMM" yes "scumm_7_8 he" "v0-v6 games"
+add_engine scumm_7_8 "v7 & v8 games" yes
+add_engine he "HE71+ games" yes
+add_engine agi "AGI" yes
+add_engine agos "AGOS" yes "agos2" "AGOS 1 games"
+add_engine agos2 "AGOS 2 games" yes
+add_engine cge "CGE" yes
+add_engine cine "Cinematique evo 1" yes
+add_engine composer "Magic Composer" yes
+add_engine cruise "Cinematique evo 2" yes
+add_engine draci "Dragon History" yes
+add_engine drascula "Drascula: The Vampire Strikes Back" yes
+add_engine dreamweb "Dreamweb" yes
+add_engine gob "Gobli*ns" yes
+add_engine groovie "Groovie" yes "groovie2" "7th Guest"
+add_engine groovie2 "Groovie 2 games" no
+add_engine hugo "Hugo Trilogy" yes
+add_engine kyra "Kyra" yes "lol eob" "Legend of Kyrandia 1-3"
+add_engine lol "Lands of Lore" yes
+add_engine eob "Eye of the Beholder" no
+add_engine lastexpress "The Last Express" no "" "" "16bit"
+add_engine lure "Lure of the Temptress" yes
+add_engine made "MADE" yes
+add_engine mohawk "Mohawk" yes "cstime myst riven" "Living Books"
+add_engine cstime "Where in Time is Carmen Sandiego?" no
+add_engine riven "Riven: The Sequel to Myst" no "" "" "16bit"
+add_engine myst "Myst" no "" "" "16bit"
+add_engine neverhood "Neverhood" no
+add_engine parallaction "Parallaction" yes
+add_engine pegasus "The Journeyman Project: Pegasus Prime" no "" "" "16bit"
+add_engine queen "Flight of the Amazon Queen" yes
+add_engine saga "SAGA" yes "ihnm saga2" "ITE"
+add_engine ihnm "IHNM" yes
+add_engine saga2 "SAGA 2 games" no
+add_engine sci "SCI" yes "sci32" "SCI 0-1.1 games"
+add_engine sci32 "SCI32 games" no
+add_engine sky "Beneath a Steel Sky" yes
+add_engine sword1 "Broken Sword" yes
+add_engine sword2 "Broken Sword II" yes
+add_engine sword25 "Broken Sword 2.5" no "" "" "png zlib 16bit"
+add_engine teenagent "Teen Agent" yes
+add_engine testbed "TestBed: the Testing framework" no
+add_engine tinsel "Tinsel" yes
+add_engine toltecs "3 Skulls of the Toltecs" no
+add_engine toon "Toonstruck" yes
+add_engine touche "Touche: The Adventures of the Fifth Musketeer" yes
+add_engine tony "Tony Tough and the Night of Roasted Moths" no "" "" "16bit"
+add_engine tsage "TsAGE" yes
+add_engine tucker "Bud Tucker in Double Trouble" yes
+add_engine wintermute "Wintermute" no "" "" "png zlib vorbis 16bit"
diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp
index cf01d9bdbc..2147419886 100644
--- a/engines/cruise/cruise.cpp
+++ b/engines/cruise/cruise.cpp
@@ -169,6 +169,9 @@ bool CruiseEngine::loadLanguageStrings() {
case Common::DE_DEU:
p = germanLanguageStrings;
break;
+ case Common::IT_ITA:
+ p = italianLanguageStrings;
+ break;
default:
return false;
}
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 6e2847d6d7..911041c1a4 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1799,32 +1799,60 @@ void CruiseEngine::mainLoop() {
// Handle frame delay
uint32 currentTick = g_system->getMillis();
- if (!bFastMode) {
- // Delay for the specified amount of time, but still respond to events
- bool skipEvents = false;
+ // Delay for the specified amount of time, but still respond to events
+ bool skipEvents = false;
- do {
- g_system->updateScreen();
+ do {
+ if (userEnabled && !userWait && !autoTrack) {
+ if (currentActiveMenu == -1) {
+ static int16 oldMouseX = -1;
+ static int16 oldMouseY = -1;
- g_system->delayMillis(10);
- currentTick = g_system->getMillis();
+ getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
- if (!skipEvents)
- skipEvents = manageEvents();
+ if (mouseX != oldMouseX || mouseY != oldMouseY) {
+ int objectType;
+ int newCursor1;
+ int newCursor2;
- if (playerDontAskQuit)
- break;
+ oldMouseX = mouseX;
+ oldMouseY = mouseY;
- _vm->getDebugger()->onFrame();
- } while (currentTick < lastTick + _gameSpeed);
- } else {
- manageEvents();
+ objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
- if (currentTick >= (lastTickDebug + 10)) {
- lastTickDebug = currentTick;
- _vm->getDebugger()->onFrame();
+ if (objectType == 9) {
+ changeCursor(CURSOR_EXIT);
+ } else if (objectType != -1) {
+ changeCursor(CURSOR_MAGNIFYING_GLASS);
+ } else {
+ changeCursor(CURSOR_WALK);
+ }
+ }
+ } else {
+ changeCursor(CURSOR_NORMAL);
+ }
+ } else {
+ changeCursor(CURSOR_NORMAL);
}
- }
+
+ g_system->updateScreen();
+
+ if (!skipEvents || bFastMode)
+ skipEvents = manageEvents();
+
+ if (bFastMode) {
+ if (currentTick >= (lastTickDebug + 10))
+ lastTickDebug = currentTick;
+ } else {
+ g_system->delayMillis(10);
+ currentTick = g_system->getMillis();
+ }
+
+ if (playerDontAskQuit)
+ break;
+
+ _vm->getDebugger()->onFrame();
+ } while (currentTick < lastTick + _gameSpeed && !bFastMode);
if (playerDontAskQuit)
break;
@@ -1844,6 +1872,14 @@ void CruiseEngine::mainLoop() {
// readKeyboard();
bool isUserWait = userWait != 0;
+ // WORKAROUND: This prevents hotspots responding during
+ // delays i.e. Menu opening if you click fast on another
+ // hotspot after trying to open a locked door, which
+ // occurred with the original interpreter.
+ if (userDelay) {
+ currentMouseButton = 0;
+ }
+
playerDontAskQuit = processInput();
if (playerDontAskQuit)
break;
@@ -1855,7 +1891,6 @@ void CruiseEngine::mainLoop() {
if (userDelay && !userWait) {
userDelay--;
- continue;
}
if (isUserWait & !userWait) {
@@ -1918,38 +1953,6 @@ void CruiseEngine::mainLoop() {
mainDraw(userWait);
flipScreen();
- if (userEnabled && !userWait && !autoTrack) {
- if (currentActiveMenu == -1) {
- static int16 oldMouseX = -1;
- static int16 oldMouseY = -1;
-
- getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
-
- if (mouseX != oldMouseX || mouseY != oldMouseY) {
- int objectType;
- int newCursor1;
- int newCursor2;
-
- oldMouseX = mouseX;
- oldMouseY = mouseY;
-
- objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
-
- if (objectType == 9) {
- changeCursor(CURSOR_EXIT);
- } else if (objectType != -1) {
- changeCursor(CURSOR_MAGNIFYING_GLASS);
- } else {
- changeCursor(CURSOR_WALK);
- }
- }
- } else {
- changeCursor(CURSOR_NORMAL);
- }
- } else {
- changeCursor(CURSOR_NORMAL);
- }
-
if (userWait == 1) {
// Waiting for press - original wait loop has been integrated into the
// main event loop
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index eb7c1c524f..ba79df4822 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -171,6 +171,19 @@ static const CRUISEGameDescription gameDescriptions[] = {
GType_CRUISE,
0,
},
+ { // Amiga Italian US GOLD edition.
+ {
+ "cruise",
+ 0,
+ AD_ENTRY1("D1", "a0011075413b7335e003e8e3c9cf51b9"),
+ Common::IT_ITA,
+ Common::kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ GType_CRUISE,
+ 0,
+ },
{ // AtariST English KixxXL edition.
{
"cruise",
@@ -282,7 +295,7 @@ void CruiseMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor CruiseMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
Cruise::CruiseEngine::getSavegameFile(slot));
-
+
if (f) {
Cruise::CruiseSavegameHeader header;
Cruise::readSavegameHeader(f, header);
@@ -290,8 +303,6 @@ SaveStateDescriptor CruiseMetaEngine::querySaveMetaInfos(const char *target, int
// Create the return descriptor
SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
desc.setThumbnail(header.thumbnail);
return desc;
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index e763e2b8a1..512259f7d7 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -207,16 +207,13 @@ int processMenu(menuStruct *pMenu) {
}
static void handleSaveLoad(bool saveFlag) {
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(_vm->getGameId(), &plugin);
GUI::SaveLoadChooser *dialog;
if (saveFlag)
- dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
+ dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
else
- dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
+ dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
- dialog->setSaveMode(saveFlag);
- int slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ int slot = dialog->runModalWithCurrentTarget();
if (slot >= 0) {
if (!saveFlag)
diff --git a/engines/cruise/staticres.cpp b/engines/cruise/staticres.cpp
index 1565f254d0..a3fc4f884b 100644
--- a/engines/cruise/staticres.cpp
+++ b/engines/cruise/staticres.cpp
@@ -320,5 +320,9 @@ const char *germanLanguageStrings[13] = {
" ", NULL, NULL, NULL, NULL, "Inventar", "Sprechen ""\xFC""ber", "Speilermen\xFC", "Speicherlaufwerk",
"Speichern", "Laden", "Neu beginnen", "Ende"
};
+const char *italianLanguageStrings[13] = {
+ "Pausa", NULL, NULL, NULL, NULL, "Inventario", "Parla di...", "Menu giocatore", NULL,
+ "Salva", "Carica", "Ricomincia", "Esci"
+};
} // End of namespace Cruise
diff --git a/engines/cruise/staticres.h b/engines/cruise/staticres.h
index a3cf13e41c..acf0b640be 100644
--- a/engines/cruise/staticres.h
+++ b/engines/cruise/staticres.h
@@ -57,6 +57,7 @@ extern const byte mouseCursorMagnifyingGlass[];
extern const char *englishLanguageStrings[13];
extern const char *frenchLanguageStrings[13];
extern const char *germanLanguageStrings[13];
+extern const char *italianLanguageStrings[13];
} // End of namespace Cruise
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 1b54c7e26a..c884075093 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -111,10 +111,8 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
_aboutDialog = new GUI::AboutDialog();
_optionsDialog = new ConfigDialog(_engine->hasFeature(Engine::kSupportsSubtitleOptions));
- _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
- _loadDialog->setSaveMode(false);
- _saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
- _saveDialog->setSaveMode(true);
+ _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
+ _saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
}
MainMenuDialog::~MainMenuDialog() {
@@ -216,26 +214,13 @@ void MainMenuDialog::reflowLayout() {
}
void MainMenuDialog::save() {
- const Common::String gameId = ConfMan.get("gameid");
-
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(gameId, &plugin);
-
- int slot = _saveDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ int slot = _saveDialog->runModalWithCurrentTarget();
if (slot >= 0) {
Common::String result(_saveDialog->getResultString());
if (result.empty()) {
// If the user was lazy and entered no save name, come up with a default name.
- #if defined(USE_SAVEGAME_TIMESTAMP)
- TimeDate curTime;
- g_system->getTimeAndDate(curTime);
- curTime.tm_year += 1900; // fixup year
- curTime.tm_mon++; // fixup month
- 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
- result = Common::String::format("Save %d", slot + 1);
- #endif
+ result = _saveDialog->createDefaultSaveDescription(slot);
}
Common::Error status = _engine->saveGameState(slot, result);
@@ -244,7 +229,7 @@ void MainMenuDialog::save() {
"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();
+ dialog.runModal();
}
close();
@@ -252,12 +237,7 @@ void MainMenuDialog::save() {
}
void MainMenuDialog::load() {
- const Common::String gameId = ConfMan.get("gameid");
-
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(gameId, &plugin);
-
- int slot = _loadDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ int slot = _loadDialog->runModalWithCurrentTarget();
_engine->setGameToLoadSlot(slot);
diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp
index de76eb83e0..2d78d05933 100644
--- a/engines/draci/detection.cpp
+++ b/engines/draci/detection.cpp
@@ -153,7 +153,7 @@ void DraciMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor DraciMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
Draci::DraciEngine::getSavegameFile(slot));
-
+
if (f) {
Draci::DraciSavegameHeader header;
Draci::readSavegameHeader(f, header);
@@ -161,8 +161,6 @@ SaveStateDescriptor DraciMetaEngine::querySaveMetaInfos(const char *target, int
// Create the return descriptor
SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
desc.setThumbnail(header.thumbnail);
int day = (header.date >> 24) & 0xFF;
diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index 3310ac0598..760d8b7d98 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -23,6 +23,7 @@
#include "base/plugins.h"
#include "engines/advancedDetector.h"
+#include "engines/savestate.h"
#include "common/file.h"
#include "drascula/drascula.h"
@@ -271,6 +272,62 @@ public:
_guioptions = GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD);
}
+ virtual bool hasFeature(MetaEngineFeature f) const {
+ return (f == kSupportsListSaves);
+ }
+
+ virtual SaveStateList listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::String pattern = Common::String::format("%s??", target);
+
+ // Get list of savefiles for target game
+ Common::StringArray filenames = saveFileMan->listSavefiles(pattern);
+ Common::Array<int> slots;
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+
+ // Obtain the last 2 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 2);
+
+ // Ensure save slot is within valid range
+ if (slotNum >= 1 && slotNum <= 10) {
+ slots.push_back(slotNum);
+ }
+ }
+
+ // Sort save slot ids
+ Common::sort<int>(slots.begin(), slots.end());
+
+ // Load save index
+ Common::String fileEpa = Common::String::format("%s.epa", target);
+ Common::InSaveFile *epa = saveFileMan->openForLoading(fileEpa);
+
+ // Get savegame names from index
+ Common::String saveDesc;
+ SaveStateList saveList;
+ int line = 1;
+ for (size_t i = 0; i < slots.size(); i++) {
+ // ignore lines corresponding to unused saveslots
+ for (; line < slots[i]; line++)
+ epa->readLine();
+
+ // copy the name in the line corresponding to the save slot and truncate to 22 characters
+ saveDesc = Common::String(epa->readLine().c_str(), 22);
+
+ // handle cases where the save directory and save index are detectably out of sync
+ if (saveDesc == "*")
+ saveDesc = "No name specified.";
+
+ // increment line number to keep it in sync with slot number
+ line++;
+
+ // Insert savegame name into list
+ saveList.push_back(SaveStateDescriptor(slots[i], saveDesc));
+ }
+ delete epa;
+
+ return saveList;
+ }
+
virtual const char *getName() const {
return "Drascula";
}
diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp
index c08bcea01f..4b8db63bb7 100644
--- a/engines/drascula/interface.cpp
+++ b/engines/drascula/interface.cpp
@@ -28,10 +28,10 @@ namespace Drascula {
void DrasculaEngine::setCursor(int cursor) {
switch (cursor) {
case kCursorCrosshair:
- CursorMan.replaceCursor((const byte *)crosshairCursor, 40, 25, 20, 17, 255);
+ CursorMan.replaceCursor(crosshairCursor, 40, 25, 20, 17, 255);
break;
case kCursorCurrentItem:
- CursorMan.replaceCursor((const byte *)mouseCursor, OBJWIDTH, OBJHEIGHT, 20, 17, 255);
+ CursorMan.replaceCursor(mouseCursor, OBJWIDTH, OBJHEIGHT, 20, 17, 255);
default:
break;
}
diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp
index 9d3797db03..f2e2f42216 100644
--- a/engines/dreamweb/detection.cpp
+++ b/engines/dreamweb/detection.cpp
@@ -24,6 +24,7 @@
#include "common/algorithm.h"
#include "common/system.h"
+#include "common/translation.h"
#include "engines/advancedDetector.h"
@@ -39,11 +40,36 @@ static const PlainGameDescriptor dreamWebGames[] = {
#include "dreamweb/detection_tables.h"
+static const ADExtraGuiOptionsMap gameGuiOptions[] = {
+ {
+ GAMEOPTION_ORIGINAL_SAVELOAD,
+ {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens, instead of the ScummVM ones"),
+ "originalsaveload",
+ false
+ }
+ },
+
+ {
+ GAMEOPTION_BRIGHTPALETTE,
+ {
+ _s("Use bright palette mode"),
+ _s("Display graphics using the game's bright palette"),
+ "bright_palette",
+ true
+ }
+ },
+
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
class DreamWebMetaEngine : public AdvancedMetaEngine {
public:
DreamWebMetaEngine():
AdvancedMetaEngine(DreamWeb::gameDescriptions,
- sizeof(DreamWeb::DreamWebGameDescription), dreamWebGames) {
+ sizeof(DreamWeb::DreamWebGameDescription), dreamWebGames,
+ gameGuiOptions) {
_singleid = "dreamweb";
_guioptions = GUIO1(GUIO_NOMIDI);
}
@@ -146,8 +172,6 @@ SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, i
saveName += (char)in->readByte();
SaveStateDescriptor desc(slot, saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
// Check if there is a ScummVM data block
if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) {
diff --git a/engines/dreamweb/detection_tables.h b/engines/dreamweb/detection_tables.h
index 216e6715dc..8a2f94f99b 100644
--- a/engines/dreamweb/detection_tables.h
+++ b/engines/dreamweb/detection_tables.h
@@ -25,6 +25,9 @@
namespace DreamWeb {
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+#define GAMEOPTION_BRIGHTPALETTE GUIO_GAMEOPTIONS2
+
struct DreamWebGameDescription {
ADGameDescription desc;
};
@@ -38,12 +41,13 @@ static const DreamWebGameDescription gameDescriptions[] = {
{
{"dreamweb.r00", 0, "3b5c87717fc40cc5a5ae19c155662ee3", 152918},
{"dreamweb.r02", 0, "28458718167a040d7e988cf7d2298eae", 210466},
+ {"dreamweb.exe", 0, "56b1d73aa56e964b45872ff552402341", 64985},
AD_LISTEND
},
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO0()
+ 0,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -59,8 +63,29 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_CD | ADGF_UNSTABLE,
- GUIO0()
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
+ },
+ },
+
+ // UK-V (Early UK) CD Release - From bug #3526483
+ // Note: r00 and r02 files are identical to international floppy release
+ // so was misidentified as floppy, resulting in disabled CD speech.
+ // Added executable to detection to avoid this.
+ {
+ {
+ "dreamweb",
+ "CD",
+ {
+ {"dreamweb.r00", 0, "3b5c87717fc40cc5a5ae19c155662ee3", 152918},
+ {"dreamweb.r02", 0, "28458718167a040d7e988cf7d2298eae", 210466},
+ {"dreamweb.exe", 0, "dd1c7793b151489e67b83cd1ecab51cd", -1},
+ AD_LISTEND
+ },
+ Common::EN_GRB,
+ Common::kPlatformPC,
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -77,7 +102,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformPC,
ADGF_CD,
- GUIO0()
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -93,8 +118,26 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::FR_FRA,
Common::kPlatformPC,
- ADGF_CD | ADGF_UNSTABLE,
- GUIO0()
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
+ },
+ },
+
+ // French CD release
+ // From bug #3524362
+ {
+ {
+ "dreamweb",
+ "CD",
+ {
+ {"dreamwfr.r00", 0, "e354582a8564faf5c515df92f207e8d1", 154657},
+ {"dreamwfr.r02", 0, "cb99f08d5aefd04184eac76927eced80", 200575},
+ AD_LISTEND
+ },
+ Common::FR_FRA,
+ Common::kPlatformPC,
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -110,8 +153,8 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO0()
+ 0,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -127,8 +170,8 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_CD | ADGF_UNSTABLE,
- GUIO0()
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -144,8 +187,8 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO0()
+ 0,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -161,8 +204,26 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_CD | ADGF_UNSTABLE,
- GUIO0()
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
+ },
+ },
+
+ // Spanish CD release
+ // From bug #3524362
+ {
+ {
+ "dreamweb",
+ "CD",
+ {
+ {"dreamwsp.r00", 0, "2df07174321de39c4f17c9ff654b268a", 153608},
+ {"dreamwsp.r02", 0, "f97d435ad5da08fb1bcf6ea3dd6e0b9e", 199499},
+ AD_LISTEND
+ },
+ Common::ES_ESP,
+ Common::kPlatformPC,
+ ADGF_CD,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
@@ -178,8 +239,8 @@ static const DreamWebGameDescription gameDescriptions[] = {
},
Common::IT_ITA,
Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO0()
+ 0,
+ GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
},
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index af55d0c72c..5f5d627553 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -35,6 +35,7 @@
#include "graphics/palette.h"
#include "graphics/surface.h"
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -46,37 +47,39 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_roomDesc(kNumRoomTexts), _freeDesc(kNumFreeTexts),
_personText(kNumPersonTexts) {
- // Setup mixer
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
-
_vSyncInterrupt = false;
_console = 0;
+ _sound = 0;
DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Animation Debug Flag");
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
_speed = 1;
_turbo = false;
_oldMouseState = 0;
- _channel0 = 0;
- _channel1 = 0;
_datafilePrefix = "DREAMWEB.";
+ _speechDirName = "SPEECH";
+ // ES and FR CD release use a different data file prefix
+ // and speech directory naming.
+ if (isCD()) {
+ switch(getLanguage()) {
+ case Common::ES_ESP:
+ _datafilePrefix = "DREAMWSP.";
+ _speechDirName = "SPANISH";
+ break;
+ case Common::FR_FRA:
+ _datafilePrefix = "DREAMWFR.";
+ _speechDirName = "FRENCH";
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+ }
_openChangeSize = kInventx+(4*kItempicsize);
_quitRequested = false;
- _currentSample = 0xff;
- _channel0Playing = 0;
- _channel0Repeat = 0;
- _channel1Playing = 0xff;
-
- _volume = 0;
- _volumeTo = 0;
- _volumeDirection = 0;
- _volumeCount = 0;
-
_speechLoaded = false;
_backdropBlocks = 0;
@@ -228,6 +231,7 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
DreamWebEngine::~DreamWebEngine() {
DebugMan.clearAllDebugChannels();
delete _console;
+ delete _sound;
}
static void vSyncInterrupt(void *refCon) {
@@ -268,7 +272,7 @@ void DreamWebEngine::processEvents() {
return;
}
- soundHandler();
+ _sound->soundHandler();
Common::Event event;
int softKey, hardKey;
while (_eventMan->pollEvent(event)) {
@@ -364,10 +368,11 @@ void DreamWebEngine::processEvents() {
Common::Error DreamWebEngine::run() {
syncSoundSettings();
_console = new DreamWebConsole(this);
+ _sound = new DreamWebSound(this);
- ConfMan.registerDefault("dreamweb_originalsaveload", "false");
+ ConfMan.registerDefault("originalsaveload", "false");
ConfMan.registerDefault("bright_palette", true);
- _hasSpeech = Common::File::exists("speech/r01c0000.raw") && !ConfMan.getBool("speech_mute");
+ _hasSpeech = Common::File::exists(_speechDirName + "/r01c0000.raw") && !ConfMan.getBool("speech_mute");
_brightPalette = ConfMan.getBool("bright_palette");
_timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
@@ -408,25 +413,6 @@ void DreamWebEngine::keyPressed(uint16 ascii) {
DreamWeb::g_keyBuffer[in] = ascii;
}
-void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) {
- processEvents();
- Common::Point pos = _eventMan->getMousePos();
- if (pos.x > 298)
- pos.x = 298;
- if (pos.x < 15)
- pos.x = 15;
- if (pos.y < 15)
- pos.y = 15;
- if (pos.y > 184)
- pos.y = 184;
- *x = pos.x;
- *y = pos.y;
-
- unsigned newState = _eventMan->getButtonState();
- *state = (newState == _oldMouseState? 0 : newState);
- _oldMouseState = newState;
-}
-
void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) {
_system->getPaletteManager()->grabPalette(data, start, count);
while (count--)
@@ -526,11 +512,56 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const {
default:
return c;
}
+ case Common::FR_FRA:
+ case Common::IT_ITA:
+ switch(c) {
+ case 133:
+ return 'Z' + 1;
+ case 130:
+ return 'Z' + 2;
+ case 138:
+ return 'Z' + 3;
+ case 136:
+ return 'Z' + 4;
+ case 140:
+ return 'Z' + 5;
+ case 135:
+ return 'Z' + 6;
+ case 149:
+ return ',' - 1;
+ case 131:
+ return ',' - 2;
+ case 141:
+ return ',' - 3;
+ case 139:
+ return ',' - 4;
+ case 151:
+ return 'A' - 1;
+ case 147:
+ return 'A' - 3;
+ case 150:
+ return 'A' - 4;
+ default:
+ return c;
+ }
default:
return c;
}
}
+Common::String DreamWebEngine::modifyFileName(const char *name) {
+ Common::String fileName(name);
+
+ // Sanity check
+ if (!fileName.hasPrefix("DREAMWEB."))
+ return fileName;
+
+ // Make sure we use the correct file name as it differs depending on the game variant
+ fileName = _datafilePrefix;
+ fileName += name + 9;
+ return fileName;
+}
+
bool DreamWebEngine::hasSpeech() {
return isCD() && _hasSpeech;
}
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 13a27449dc..a4597b1867 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -99,10 +99,12 @@ enum {
};
struct DreamWebGameDescription;
+class DreamWebSound;
class DreamWebEngine : public Engine {
private:
DreamWebConsole *_console;
+ DreamWebSound *_sound;
bool _vSyncInterrupt;
protected:
@@ -142,49 +144,31 @@ public:
void quit();
- void loadSounds(uint bank, const Common::String &suffix);
bool loadSpeech(const Common::String &filename);
void enableSavingOrLoading(bool enable = true) { _enableSavingOrLoading = enable; }
Common::Language getLanguage() const;
uint8 modifyChar(uint8 c) const;
+ Common::String modifyFileName(const char *);
- void stopSound(uint8 channel);
-
- const Common::String& getDatafilePrefix() { return _datafilePrefix; };
+ const Common::String& getDatafilePrefix() { return _datafilePrefix; }
+ const Common::String& getSpeechDirName() { return _speechDirName; }
private:
void keyPressed(uint16 ascii);
void setSpeed(uint speed);
- void soundHandler();
- void playSound(uint8 channel, uint8 id, uint8 loops);
const DreamWebGameDescription *_gameDescription;
Common::RandomSource _rnd;
Common::String _datafilePrefix;
+ Common::String _speechDirName;
uint _speed;
bool _turbo;
uint _oldMouseState;
bool _enableSavingOrLoading;
- struct Sample {
- uint offset;
- uint size;
- Sample(): offset(), size() {}
- };
-
- struct SoundData {
- Common::Array<Sample> samples;
- Common::Array<uint8> data;
- };
- SoundData _soundData[2];
- Common::Array<uint8> _speechData;
-
- Audio::SoundHandle _channelHandle[2];
- uint8 _channel0, _channel1;
-
protected:
GameVars _vars; // saved variables
@@ -212,7 +196,7 @@ protected:
// from monitor.cpp
char _inputLine[64];
- char _operand1[14];
+ char _operand1[64];
char _currentFile[14];
// from newplace.cpp
@@ -325,16 +309,6 @@ public:
// sound related
uint8 _roomsSample;
- uint8 _currentSample;
- uint8 _channel0Playing;
- uint8 _channel0Repeat;
- uint8 _channel1Playing;
-
- uint8 _volume;
- uint8 _volumeTo;
- int8 _volumeDirection;
- uint8 _volumeCount;
-
bool _speechLoaded;
// misc variables
@@ -713,15 +687,6 @@ public:
void showSaveOps();
void showLoadOps();
- // from sound.cpp
- bool loadSpeech(byte type1, int idx1, byte type2, int idx2);
- void volumeAdjust();
- void cancelCh0();
- void cancelCh1();
- void loadRoomsSample();
- void playChannel0(uint8 index, uint8 repeat);
- void playChannel1(uint8 index);
-
// from sprite.cpp
void printSprites();
void printASprite(const Sprite *sprite);
@@ -1133,7 +1098,6 @@ public:
void frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void doShake();
- void vSync();
void setMode();
void showPCX(const Common::String &suffix);
void showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height);
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
index 2ab5835997..3580f8ad52 100644
--- a/engines/dreamweb/keypad.cpp
+++ b/engines/dreamweb/keypad.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -62,11 +63,11 @@ void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
readMouse();
showKeypad();
showPointer();
- vSync();
+ waitForVSync();
if (_pressCount == 0) {
_pressed = 255;
_graphicPress = 255;
- vSync();
+ waitForVSync();
} else
--_pressCount;
@@ -85,7 +86,7 @@ void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
if (_pressed == 11) {
if (isItRight(digit0, digit1, digit2, digit3))
_vars._lockStatus = 0;
- playChannel1(11);
+ _sound->playChannel1(11);
_lightCount = 120;
_pressPointer = 0;
}
@@ -180,7 +181,7 @@ void DreamWebEngine::buttonPress(uint8 buttonId) {
_graphicPress = buttonId + 21;
_pressCount = 40;
if (buttonId != 11)
- playChannel1(10);
+ _sound->playChannel1(10);
}
}
@@ -252,7 +253,7 @@ void DreamWebEngine::useMenu() {
showMenu();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpMenu();
dumpTextLine();
@@ -311,7 +312,7 @@ void DreamWebEngine::viewFolder() {
delPointer();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
checkFolderCoords();
@@ -508,7 +509,7 @@ void DreamWebEngine::enterSymbol() {
showSymbol();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
dumpSymbol();
@@ -532,7 +533,7 @@ void DreamWebEngine::enterSymbol() {
_symbolGraphics.clear();
restoreReels();
workToScreenM();
- playChannel1(13);
+ _sound->playChannel1(13);
} else {
removeSetObject(46);
placeSetObject(43);
@@ -743,7 +744,7 @@ void DreamWebEngine::useDiary() {
readMouse();
showDiaryKeys();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpDiaryKeys();
dumpTextLine();
@@ -820,7 +821,7 @@ void DreamWebEngine::diaryKeyP() {
_pressCount)
return; // notkeyp
- playChannel1(16);
+ _sound->playChannel1(16);
_pressCount = 12;
_pressed = 'P';
_diaryPage--;
@@ -837,7 +838,7 @@ void DreamWebEngine::diaryKeyN() {
_pressCount)
return; // notkeyn
- playChannel1(16);
+ _sound->playChannel1(16);
_pressCount = 12;
_pressed = 'N';
_diaryPage++;
diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk
index 6bc4f8728e..3e367c6fdf 100644
--- a/engines/dreamweb/module.mk
+++ b/engines/dreamweb/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
dreamweb.o \
keypad.o \
monitor.o \
+ mouse.o \
newplace.o \
object.o \
pathfind.o \
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 95aa400c3a..1886a80b6a 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -97,7 +98,7 @@ void DreamWebEngine::useMon() {
_textFile3.clear();
_getBack = 1;
- playChannel1(26);
+ _sound->playChannel1(26);
_manIsOffScreen = 0;
restoreAll();
redrawMainScrn();
@@ -180,7 +181,7 @@ void DreamWebEngine::monitorLogo() {
printLogo();
//fadeUpMon(); // FIXME: Commented out in ASM
printLogo();
- playChannel1(26);
+ _sound->playChannel1(26);
randomAccess(20);
} else {
printLogo();
@@ -193,7 +194,7 @@ void DreamWebEngine::printLogo() {
}
void DreamWebEngine::input() {
- memset(_inputLine, 0, 64);
+ memset(_inputLine, 0, sizeof(_inputLine));
_curPos = 0;
printChar(_monitorCharset, _monAdX, _monAdY, '>', 0, NULL, NULL);
multiDump(_monAdX, _monAdY, 6, 8);
@@ -202,7 +203,7 @@ void DreamWebEngine::input() {
_cursLocY = _monAdY;
while (true) {
printCurs();
- vSync();
+ waitForVSync();
delCurs();
readKey();
if (_quitRequested)
@@ -288,7 +289,7 @@ void DreamWebEngine::scrollMonitor() {
printLogo();
printUnderMonitor();
workToScreen();
- playChannel1(25);
+ _sound->playChannel1(25);
}
void DreamWebEngine::showCurrentFile() {
@@ -318,8 +319,8 @@ void DreamWebEngine::accessLightOff() {
void DreamWebEngine::randomAccess(uint16 count) {
for (uint16 i = 0; i < count; ++i) {
- vSync();
- vSync();
+ waitForVSync();
+ waitForVSync();
uint16 v = _rnd.getRandomNumber(15);
if (v < 10)
accessLightOff();
@@ -626,15 +627,12 @@ void DreamWebEngine::signOn() {
_monAdX = prevX;
_monAdY = prevY;
- inputLine = (const char *)_inputLine;
- inputLine.toUppercase();
-
// The entered line has zeroes in-between each character
uint32 len = strlen(monitorKeyEntries[foundIndex].password);
bool found = true;
for (uint32 i = 0; i < len; i++) {
- if (monitorKeyEntries[foundIndex].password[i] != inputLine[i * 2]) {
+ if (monitorKeyEntries[foundIndex].password[i] != _inputLine[i * 2]) {
found = false;
break;
}
@@ -667,7 +665,7 @@ void DreamWebEngine::searchForFiles(const char *filesString) {
const char *DreamWebEngine::parser() {
char *output = _operand1;
- memset(output, 0, 14);
+ memset(output, 0, sizeof(_operand1));
*output++ = '=';
diff --git a/engines/dreamweb/mouse.cpp b/engines/dreamweb/mouse.cpp
new file mode 100644
index 0000000000..77d907611d
--- /dev/null
+++ b/engines/dreamweb/mouse.cpp
@@ -0,0 +1,171 @@
+/* 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"
+#include "dreamweb/dreamweb.h"
+
+namespace DreamWeb {
+
+void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) {
+ processEvents();
+ Common::Point pos = _eventMan->getMousePos();
+ *x = CLIP<int16>(pos.x, 15, 298);
+ *y = CLIP<int16>(pos.y, 15, 184);
+
+ unsigned newState = _eventMan->getButtonState();
+ *state = (newState == _oldMouseState ? 0 : newState);
+ _oldMouseState = newState;
+}
+
+void DreamWebEngine::readMouse() {
+ _oldButton = _mouseButton;
+ _mouseButton = readMouseState();
+}
+
+uint16 DreamWebEngine::readMouseState() {
+ _oldX = _mouseX;
+ _oldY = _mouseY;
+ uint16 x, y, state;
+ mouseCall(&x, &y, &state);
+ _mouseX = x;
+ _mouseY = y;
+ return state;
+}
+
+void DreamWebEngine::dumpPointer() {
+ dumpBlink();
+ multiDump(_delHereX, _delHereY, _delXS, _delYS);
+ if ((_oldPointerX != _delHereX) || (_oldPointerY != _delHereY))
+ multiDump(_oldPointerX, _oldPointerY, _pointerXS, _pointerYS);
+}
+
+void DreamWebEngine::showPointer() {
+ showBlink();
+ uint16 x = _mouseX;
+ _oldPointerX = _mouseX;
+ uint16 y = _mouseY;
+ _oldPointerY = _mouseY;
+ if (_pickUp == 1) {
+ const GraphicsFile *frames;
+ if (_objectType != kExObjectType)
+ frames = &_freeFrames;
+ else
+ frames = &_exFrames;
+ const Frame *frame = &frames->_frames[(3 * _itemFrame + 1)];
+
+ uint8 width = MAX<uint8>(frame->width, 12);
+ uint8 height = MAX<uint8>(frame->height, 12);
+ _pointerXS = width;
+ _pointerYS = height;
+ uint16 xMin = (x >= width / 2) ? x - width / 2 : 0;
+ uint16 yMin = (y >= height / 2) ? y - height / 2 : 0;
+ _oldPointerX = xMin;
+ _oldPointerY = yMin;
+ multiGet(_pointerBack, xMin, yMin, width, height);
+ showFrame(*frames, x, y, 3 * _itemFrame + 1, 128);
+ showFrame(_icons1, x, y, 3, 128);
+ } else {
+ const Frame *frame = &_icons1._frames[_pointerFrame + 20];
+ uint8 width = MAX<uint8>(frame->width, 12);
+ uint8 height = MAX<uint8>(frame->height, 12);
+ _pointerXS = width;
+ _pointerYS = height;
+ multiGet(_pointerBack, x, y, width, height);
+ showFrame(_icons1, x, y, _pointerFrame + 20, 0);
+ }
+}
+
+void DreamWebEngine::delPointer() {
+ if (_oldPointerX == 0xffff)
+ return;
+ _delHereX = _oldPointerX;
+ _delHereY = _oldPointerY;
+ _delXS = _pointerXS;
+ _delYS = _pointerYS;
+ multiPut(_pointerBack, _delHereX, _delHereY, _pointerXS, _pointerYS);
+}
+
+void DreamWebEngine::animPointer() {
+ if (_pointerMode == 2) {
+ _pointerFrame = 0;
+ if ((_realLocation == 14) && (_commandType == 211))
+ _pointerFrame = 5;
+ return;
+ } else if (_pointerMode == 3) {
+ if (_pointerSpeed != 0) {
+ --_pointerSpeed;
+ } else {
+ _pointerSpeed = 5;
+ ++_pointerCount;
+ if (_pointerCount == 16)
+ _pointerCount = 0;
+ }
+ _pointerFrame = (_pointerCount <= 8) ? 1 : 2;
+ return;
+ }
+ if (_vars._watchingTime != 0) {
+ _pointerFrame = 11;
+ return;
+ }
+ _pointerFrame = 0;
+ if (_inMapArea == 0)
+ return;
+ if (_pointerFirstPath == 0)
+ return;
+ uint8 flag, flagEx;
+ getFlagUnderP(&flag, &flagEx);
+ if (flag < 2)
+ return;
+ if (flag >= 128)
+ return;
+ if (flag & 4) {
+ _pointerFrame = 3;
+ return;
+ }
+ if (flag & 16) {
+ _pointerFrame = 4;
+ return;
+ }
+ if (flag & 2) {
+ _pointerFrame = 5;
+ return;
+ }
+ if (flag & 8) {
+ _pointerFrame = 6;
+ return;
+ }
+ _pointerFrame = 8;
+}
+
+void DreamWebEngine::checkCoords(const RectWithCallback *rectWithCallbacks) {
+ if (_newLocation != 0xff)
+ return;
+ const RectWithCallback *r;
+ for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) {
+ if (r->contains(_mouseX, _mouseY)) {
+ (this->*(r->_callback))();
+ return;
+ }
+ }
+}
+
+} // End of namespace DreamWeb
diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp
index 529c45bd4a..5b4b0260f5 100644
--- a/engines/dreamweb/newplace.cpp
+++ b/engines/dreamweb/newplace.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -55,7 +56,7 @@ void DreamWebEngine::selectLocation() {
_pointerFrame = 0;
showPointer();
workToScreen();
- playChannel0(9, 255);
+ _sound->playChannel0(9, 255);
_newLocation = 255;
while (_newLocation == 255) {
@@ -65,7 +66,7 @@ void DreamWebEngine::selectLocation() {
delPointer();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 443366561a..1e84aba6bd 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -147,7 +147,7 @@ void DreamWebEngine::examineOb(bool examineAgain) {
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
delPointer();
@@ -516,7 +516,7 @@ void DreamWebEngine::inToInv() {
if (_mouseButton == _oldButton || !(_mouseButton & 1))
return; // notletgo2
-
+
delPointer();
DynObject *object = getExAd(_itemFrame);
object->mapad[0] = 4;
@@ -1034,7 +1034,7 @@ void DreamWebEngine::fillOpen() {
size = 4;
findAllOpen();
for (uint8 i = 0; i < size; ++i) {
- uint8 index = _openInvList[i]._index;
+ uint8 index = _openInvList[i]._index;
uint8 type = _openInvList[i]._type;
obToInv(index, type, kInventx + i * kItempicsize, kInventy + 96);
}
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index dfb5c62618..dbb81406cd 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -149,7 +150,7 @@ void DreamWebEngine::madmanText() {
if (hasSpeech()) {
if (_speechCount > 15)
return;
- if (_channel1Playing != 255)
+ if (_sound->isChannel1Playing())
return;
origCount = _speechCount;
++_speechCount;
@@ -250,7 +251,7 @@ bool DreamWebEngine::checkSpeed(ReelRoutine &routine) {
void DreamWebEngine::sparkyDrip(ReelRoutine &routine) {
if (checkSpeed(routine))
- playChannel0(14, 0);
+ _sound->playChannel0(14, 0);
}
void DreamWebEngine::genericPerson(ReelRoutine &routine) {
@@ -410,7 +411,7 @@ void DreamWebEngine::interviewer(ReelRoutine &routine) {
if (routine.reelPointer() != 250 && routine.reelPointer() != 259 && checkSpeed(routine))
routine.incReelPointer();
-
+
showGameReel(&routine);
}
@@ -430,7 +431,7 @@ void DreamWebEngine::drinker(ReelRoutine &routine) {
void DreamWebEngine::alleyBarkSound(ReelRoutine &routine) {
uint16 prevReelPointer = routine.reelPointer() - 1;
if (prevReelPointer == 0) {
- playChannel1(14);
+ _sound->playChannel1(14);
routine.setReelPointer(1000);
} else {
routine.setReelPointer(prevReelPointer);
@@ -523,7 +524,7 @@ void DreamWebEngine::gates(ReelRoutine &routine) {
if (checkSpeed(routine)) {
uint16 nextReelPointer = routine.reelPointer() + 1;
if (nextReelPointer == 116)
- playChannel1(17);
+ _sound->playChannel1(17);
if (nextReelPointer >= 110)
routine.period = 2;
if (nextReelPointer == 120) {
@@ -579,12 +580,12 @@ void DreamWebEngine::carParkDrip(ReelRoutine &routine) {
if (!checkSpeed(routine))
return; // cantdrip2
- playChannel1(14);
+ _sound->playChannel1(14);
}
void DreamWebEngine::foghornSound(ReelRoutine &routine) {
if (randomNumber() == 198)
- playChannel1(13);
+ _sound->playChannel1(13);
}
void DreamWebEngine::train(ReelRoutine &routine) {
@@ -744,7 +745,7 @@ void DreamWebEngine::introMonks2(ReelRoutine &routine) {
if (nextReelPointer == 110) {
_introCount++;
monks2text();
-
+
if (_introCount == 35)
nextReelPointer = 111;
else
@@ -894,7 +895,7 @@ void DreamWebEngine::helicopter(ReelRoutine &routine) {
nextReelPointer = 9;
}
}
- }
+ }
routine.setReelPointer(nextReelPointer);
}
@@ -1001,7 +1002,7 @@ void DreamWebEngine::businessMan(ReelRoutine &routine) {
nextReelPointer = 92;
}
}
-
+
routine.setReelPointer(nextReelPointer);
}
@@ -1027,8 +1028,7 @@ void DreamWebEngine::endGameSeq(ReelRoutine &routine) {
fadeScreenDownHalf();
} else if (nextReelPointer == 324) {
fadeScreenDowns();
- _volumeTo = 7;
- _volumeDirection = 1;
+ _sound->volumeChange(7, 1);
}
if (nextReelPointer == 340)
@@ -1037,7 +1037,7 @@ void DreamWebEngine::endGameSeq(ReelRoutine &routine) {
showGameReel(&routine);
routine.mapY = _mapY;
-
+
if (routine.reelPointer() == 145) {
routine.setReelPointer(146);
rollEndCreditsGameWon();
@@ -1070,7 +1070,7 @@ void DreamWebEngine::poolGuard(ReelRoutine &routine) {
if (checkSpeed(routine)) {
uint16 nextReelPointer = routine.reelPointer() + 1;
-
+
if (nextReelPointer != 122) {
// Not end guard 1
if (nextReelPointer == 147) {
@@ -1103,12 +1103,12 @@ void DreamWebEngine::poolGuard(ReelRoutine &routine) {
}
}
}
-
+
routine.setReelPointer(nextReelPointer);
}
showGameReel(&routine);
-
+
if (routine.reelPointer() != 121 && routine.reelPointer() != 146) {
_pointerMode = 0;
_vars._watchingTime = 2;
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index a6b93a5590..64b9849980 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -197,7 +198,7 @@ uint8 DreamWebEngine::kernChars(uint8 firstChar, uint8 secondChar, uint8 width)
uint16 DreamWebEngine::waitFrames() {
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
delPointer();
return _mouseButton;
@@ -211,7 +212,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
while (!done) {
uint16 count = getNumber(_monitorCharset, (const uint8 *)iterator, 166, false, &x);
- do {
+ do {
char c = *iterator++;
if (c == ':')
break;
@@ -231,7 +232,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
_cursLocY = _monAdY;
_mainTimer = 1;
printCurs();
- vSync();
+ waitForVSync();
lockMon();
delCurs();
} while (--count);
@@ -246,10 +247,9 @@ const char *DreamWebEngine::monPrint(const char *string) {
}
void DreamWebEngine::rollEndCreditsGameWon() {
- playChannel0(16, 255);
- _volume = 7;
- _volumeTo = 0;
- _volumeDirection = -1;
+ _sound->playChannel0(16, 255);
+ _sound->volumeSet(7);
+ _sound->volumeChange(0, -1);
multiGet(_mapStore, 75, 20, 160, 160);
@@ -261,9 +261,9 @@ void DreamWebEngine::rollEndCreditsGameWon() {
// then move it up one pixel until we shifted it by a complete
// line of text.
for (int j = 0; j < linespacing; ++j) {
- vSync();
+ waitForVSync();
multiPut(_mapStore, 75, 20, 160, 160);
- vSync();
+ waitForVSync();
// Output up to 18 lines of text
uint16 y = 10 - j;
@@ -273,7 +273,7 @@ void DreamWebEngine::rollEndCreditsGameWon() {
y += linespacing;
}
- vSync();
+ waitForVSync();
multiDump(75, 20, 160, 160);
}
@@ -300,9 +300,9 @@ void DreamWebEngine::rollEndCreditsGameLost() {
// then move it up one pixel until we shifted it by a complete
// line of text.
for (int j = 0; j < linespacing; ++j) {
- vSync();
+ waitForVSync();
multiPut(_mapStore, 25, 20, 160, 160);
- vSync();
+ waitForVSync();
// Output up to 18 lines of text
uint16 y = 10 - j;
@@ -312,7 +312,7 @@ void DreamWebEngine::rollEndCreditsGameLost() {
y += linespacing;
}
- vSync();
+ waitForVSync();
multiDump(25, 20, 160, 160);
if (_lastHardKey == 1)
diff --git a/engines/dreamweb/rain.cpp b/engines/dreamweb/rain.cpp
index 7db4744cbf..8e42e0c161 100644
--- a/engines/dreamweb/rain.cpp
+++ b/engines/dreamweb/rain.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -50,7 +51,7 @@ void DreamWebEngine::showRain() {
}
}
- if (_channel1Playing != 255)
+ if (_sound->isChannel1Playing())
return;
if (_realLocation == 2 && _vars._beenMugged != 1)
return;
@@ -61,11 +62,11 @@ void DreamWebEngine::showRain() {
return;
uint8 soundIndex;
- if (_channel0Playing != 6)
+ if (_sound->getChannel0Playing() != 6)
soundIndex = 4;
else
soundIndex = 7;
- playChannel1(soundIndex);
+ _sound->playChannel1(soundIndex);
}
uint8 DreamWebEngine::getBlockOfPixel(uint8 x, uint8 y) {
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index a526c8a3bc..ea9cdc0249 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -20,7 +20,9 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
+
#include "engines/metaengine.h"
#include "graphics/thumbnail.h"
#include "gui/saveload.h"
@@ -119,7 +121,7 @@ void DreamWebEngine::loadGame() {
void DreamWebEngine::doLoad(int savegameId) {
_loadingOrSave = 1;
- if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) {
+ if (ConfMan.getBool("originalsaveload") && savegameId == -1) {
showOpBox();
showLoadOps();
_currentSlot = 0;
@@ -136,7 +138,7 @@ void DreamWebEngine::doLoad(int savegameId) {
delPointer();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
RectWithCallback loadlist[] = {
@@ -156,12 +158,8 @@ void DreamWebEngine::doLoad(int savegameId) {
if (savegameId == -1) {
// Open dialog to get savegameId
- const EnginePlugin *plugin = NULL;
- Common::String gameId = ConfMan.get("gameid");
- EngineMan.findGame(gameId, &plugin);
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"));
- dialog->setSaveMode(false);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
+ savegameId = dialog->runModalWithCurrentTarget();
delete dialog;
}
@@ -181,7 +179,7 @@ void DreamWebEngine::doLoad(int savegameId) {
_saveGraphics.clear();
startLoading(g_madeUpRoomDat);
- loadRoomsSample();
+ _sound->loadRoomsSample(_roomsSample);
_roomLoaded = 1;
_newLocation = 255;
clearSprites();
@@ -208,7 +206,7 @@ void DreamWebEngine::saveGame() {
_loadingOrSave = 2;
- if (ConfMan.getBool("dreamweb_originalsaveload")) {
+ if (ConfMan.getBool("originalsaveload")) {
showOpBox();
showSaveOps();
_currentSlot = 0;
@@ -227,7 +225,7 @@ void DreamWebEngine::saveGame() {
checkInput();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
@@ -243,12 +241,8 @@ void DreamWebEngine::saveGame() {
}
return;
} else {
- const EnginePlugin *plugin = NULL;
- Common::String gameId = ConfMan.get("gameid");
- EngineMan.findGame(gameId, &plugin);
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
- dialog->setSaveMode(true);
- int savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
+ int savegameId = dialog->runModalWithCurrentTarget();
Common::String game_description = dialog->getResultString();
if (game_description.empty())
game_description = "Untitled";
@@ -348,7 +342,7 @@ void DreamWebEngine::doSaveLoad() {
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
delPointer();
@@ -429,7 +423,7 @@ void DreamWebEngine::discOps() {
delPointer();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
checkCoords(discOpsList);
@@ -839,8 +833,9 @@ void DreamWebEngine::showOpBox() {
// 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())
+ // the game dialogs. It is included in the early UK CD release, which had
+ // similar data files as the floppy release (bug #3528160).
+ if (isCD() && getLanguage() != Common::EN_GRB)
showFrame(_saveGraphics, kOpsx, kOpsy + 55, 4, 0);
}
diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp
index b51527a8cd..570f76f2f9 100644
--- a/engines/dreamweb/sound.cpp
+++ b/engines/dreamweb/sound.cpp
@@ -20,28 +20,51 @@
*
*/
-#include "dreamweb/dreamweb.h"
-
-#include "audio/mixer.h"
#include "audio/decoders/raw.h"
-
#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/file.h"
+
+#include "dreamweb/dreamweb.h"
+#include "dreamweb/sound.h"
namespace DreamWeb {
-bool DreamWebEngine::loadSpeech(byte type1, int idx1, byte type2, int idx2) {
+DreamWebSound::DreamWebSound(DreamWebEngine *vm) : _vm(vm) {
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
+
+ _currentSample = 0xff;
+ _channel0Playing = 255;
+ _channel0Repeat = 0;
+ _channel0NewSound = false;
+ _channel1Playing = 255;
+ _channel1NewSound = false;
+
+ _volume = 0;
+ _volumeTo = 0;
+ _volumeDirection = 0;
+ _volumeCount = 0;
+}
+
+DreamWebSound::~DreamWebSound() {
+}
+
+bool DreamWebSound::loadSpeech(byte type1, int idx1, byte type2, int idx2) {
cancelCh1();
Common::String name = Common::String::format("%c%02d%c%04d.RAW", type1, idx1, type2, idx2);
- //debug("name = %s", name.c_str());
- bool result = loadSpeech(name);
-
- _speechLoaded = result;
- return result;
+ debug(2, "loadSpeech() name:%s", name.c_str());
+ return loadSpeech(name);
}
+void DreamWebSound::volumeChange(uint8 value, int8 direction) {
+ _volumeTo = value;
+ _volumeDirection = direction;
+}
-void DreamWebEngine::volumeAdjust() {
+void DreamWebSound::volumeAdjust() {
if (_volumeDirection == 0)
return;
if (_volume != _volumeTo) {
@@ -54,36 +77,38 @@ void DreamWebEngine::volumeAdjust() {
}
}
-void DreamWebEngine::playChannel0(uint8 index, uint8 repeat) {
- _channel0Playing = index;
- if (index >= 12)
- index -= 12;
+void DreamWebSound::playChannel0(uint8 index, uint8 repeat) {
+ debug(1, "playChannel0(index:%d, repeat:%d)", index, repeat);
+ _channel0Playing = index;
_channel0Repeat = repeat;
+ _channel0NewSound = true;
}
-void DreamWebEngine::playChannel1(uint8 index) {
+void DreamWebSound::playChannel1(uint8 index) {
+ debug(1, "playChannel1(index:%d)", index);
if (_channel1Playing == 7)
return;
_channel1Playing = index;
- if (index >= 12)
- index -= 12;
+ _channel1NewSound = true;
}
-void DreamWebEngine::cancelCh0() {
- _channel0Repeat = 0;
+void DreamWebSound::cancelCh0() {
+ debug(1, "cancelCh0()");
_channel0Playing = 255;
+ _channel0Repeat = 0;
stopSound(0);
}
-void DreamWebEngine::cancelCh1() {
+void DreamWebSound::cancelCh1() {
+ debug(1, "cancelCh1()");
_channel1Playing = 255;
stopSound(1);
}
-void DreamWebEngine::loadRoomsSample() {
- uint8 sample = _roomsSample;
+void DreamWebSound::loadRoomsSample(uint8 sample) {
+ debug(1, "loadRoomsSample(sample:%d)", sample);
if (sample == 255 || _currentSample == sample)
return; // loaded already
@@ -101,13 +126,8 @@ void DreamWebEngine::loadRoomsSample() {
loadSounds(1, sampleSuffix.c_str());
}
-} // End of namespace DreamWeb
-
-
-namespace DreamWeb {
-
-void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
- debug(1, "playSound(%u, %u, %u)", channel, id, loops);
+void DreamWebSound::playSound(uint8 channel, uint8 id, uint8 loops) {
+ debug(1, "playSound(channel:%u, id:%u, loops:%u)", channel, id, loops);
int bank = 0;
bool speech = false;
@@ -137,47 +157,38 @@ void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
error("out of memory: cannot allocate memory for sound(%u bytes)", sample.size);
memcpy(buffer, data.data.begin() + sample.offset, sample.size);
- raw = Audio::makeRawStream(
- buffer,
- sample.size, 22050, Audio::FLAG_UNSIGNED);
+ raw = Audio::makeRawStream(buffer, sample.size, 22050, Audio::FLAG_UNSIGNED);
} else {
uint8 *buffer = (uint8 *)malloc(_speechData.size());
if (!buffer)
error("out of memory: cannot allocate memory for sound(%u bytes)", _speechData.size());
memcpy(buffer, _speechData.begin(), _speechData.size());
- raw = Audio::makeRawStream(
- buffer,
- _speechData.size(), 22050, Audio::FLAG_UNSIGNED);
-
+ raw = Audio::makeRawStream(buffer, _speechData.size(), 22050, Audio::FLAG_UNSIGNED);
}
Audio::AudioStream *stream;
if (loops > 1) {
- stream = new Audio::LoopingAudioStream(raw, loops < 255? loops: 0);
+ stream = new Audio::LoopingAudioStream(raw, (loops < 255) ? loops : 0);
} else
stream = raw;
- if (_mixer->isSoundHandleActive(_channelHandle[channel]))
- _mixer->stopHandle(_channelHandle[channel]);
- _mixer->playStream(type, &_channelHandle[channel], stream);
+ if (_vm->_mixer->isSoundHandleActive(_channelHandle[channel]))
+ _vm->_mixer->stopHandle(_channelHandle[channel]);
+ _vm->_mixer->playStream(type, &_channelHandle[channel], stream);
}
-void DreamWebEngine::stopSound(uint8 channel) {
+void DreamWebSound::stopSound(uint8 channel) {
debug(1, "stopSound(%u)", channel);
assert(channel == 0 || channel == 1);
- _mixer->stopHandle(_channelHandle[channel]);
- if (channel == 0)
- _channel0 = 0;
- else
- _channel1 = 0;
+ _vm->_mixer->stopHandle(_channelHandle[channel]);
}
-bool DreamWebEngine::loadSpeech(const Common::String &filename) {
- if (!hasSpeech())
+bool DreamWebSound::loadSpeech(const Common::String &filename) {
+ if (!_vm->hasSpeech())
return false;
Common::File file;
- if (!file.open("speech/" + filename))
+ if (!file.open(_vm->getSpeechDirName() + "/" + filename))
return false;
debug(1, "loadSpeech(%s)", filename.c_str());
@@ -189,8 +200,8 @@ bool DreamWebEngine::loadSpeech(const Common::String &filename) {
return true;
}
-void DreamWebEngine::soundHandler() {
- _subtitles = ConfMan.getBool("subtitles");
+void DreamWebSound::soundHandler() {
+ _vm->_subtitles = ConfMan.getBool("subtitles");
volumeAdjust();
uint volume = _volume;
@@ -207,41 +218,31 @@ void DreamWebEngine::soundHandler() {
if (volume >= 8)
volume = 7;
volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
- _mixer->setChannelVolume(_channelHandle[0], volume);
+ _vm->_mixer->setChannelVolume(_channelHandle[0], volume);
- uint8 ch0 = _channel0Playing;
- if (ch0 == 255)
- ch0 = 0;
- uint8 ch1 = _channel1Playing;
- if (ch1 == 255)
- ch1 = 0;
- uint8 ch0loop = _channel0Repeat;
-
- if (_channel0 != ch0) {
- _channel0 = ch0;
- if (ch0) {
- playSound(0, ch0, ch0loop);
+ if (_channel0NewSound) {
+ _channel0NewSound = false;
+ if (_channel0Playing != 255) {
+ playSound(0, _channel0Playing, _channel0Repeat);
}
}
- if (_channel1 != ch1) {
- _channel1 = ch1;
- if (ch1) {
- playSound(1, ch1, 1);
+ if (_channel1NewSound) {
+ _channel1NewSound = false;
+ if (_channel1Playing != 255) {
+ playSound(1, _channel1Playing, 1);
}
}
- if (!_mixer->isSoundHandleActive(_channelHandle[0])) {
+
+ if (!_vm->_mixer->isSoundHandleActive(_channelHandle[0])) {
_channel0Playing = 255;
- _channel0 = 0;
}
- if (!_mixer->isSoundHandleActive(_channelHandle[1])) {
+ if (!_vm->_mixer->isSoundHandleActive(_channelHandle[1])) {
_channel1Playing = 255;
- _channel1 = 0;
}
-
}
-void DreamWebEngine::loadSounds(uint bank, const Common::String &suffix) {
- Common::String filename = getDatafilePrefix() + suffix;
+void DreamWebSound::loadSounds(uint bank, const Common::String &suffix) {
+ Common::String filename = _vm->getDatafilePrefix() + suffix;
debug(1, "loadSounds(%u, %s)", bank, filename.c_str());
Common::File file;
if (!file.open(filename)) {
@@ -249,9 +250,9 @@ void DreamWebEngine::loadSounds(uint bank, const Common::String &suffix) {
return;
}
- uint8 header[0x60];
+ uint8 header[96];
file.read(header, sizeof(header));
- uint tablesize = READ_LE_UINT16(header + 0x32);
+ uint tablesize = READ_LE_UINT16(header + 50);
debug(1, "table size = %u", tablesize);
SoundData &soundData = _soundData[bank];
@@ -261,8 +262,8 @@ void DreamWebEngine::loadSounds(uint bank, const Common::String &suffix) {
uint8 entry[6];
Sample &sample = soundData.samples[i];
file.read(entry, sizeof(entry));
- sample.offset = entry[0] * 0x4000 + READ_LE_UINT16(entry + 1);
- sample.size = READ_LE_UINT16(entry + 3) * 0x800;
+ sample.offset = entry[0] * 16384 + READ_LE_UINT16(entry + 1);
+ sample.size = READ_LE_UINT16(entry + 3) * 2048;
total += sample.size;
debug(1, "offset: %08x, size: %u", sample.offset, sample.size);
}
diff --git a/engines/dreamweb/sound.h b/engines/dreamweb/sound.h
new file mode 100644
index 0000000000..1ab06dc694
--- /dev/null
+++ b/engines/dreamweb/sound.h
@@ -0,0 +1,91 @@
+/* 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 DREAMWEB_SOUND_H
+#define DREAMWEB_SOUND_H
+
+#include "common/array.h"
+#include "common/str.h"
+#include "audio/mixer.h"
+
+namespace DreamWeb {
+
+class DreamWebEngine;
+
+class DreamWebSound {
+public:
+ DreamWebSound(DreamWebEngine *vm);
+ ~DreamWebSound();
+
+ bool loadSpeech(byte type1, int idx1, byte type2, int idx2);
+ void volumeSet(uint8 value) { _volume = value; }
+ void volumeChange(uint8 value, int8 direction);
+ void playChannel0(uint8 index, uint8 repeat);
+ void playChannel1(uint8 index);
+ uint8 getChannel0Playing() { return _channel0Playing; }
+ bool isChannel1Playing() { return _channel1Playing != 255; }
+ void cancelCh0();
+ void cancelCh1();
+ void loadRoomsSample(uint8 sample);
+ void soundHandler();
+ void loadSounds(uint bank, const Common::String &suffix);
+
+private:
+ DreamWebEngine *_vm;
+
+ struct Sample {
+ uint offset;
+ uint size;
+ Sample(): offset(), size() {}
+ };
+
+ struct SoundData {
+ Common::Array<Sample> samples;
+ Common::Array<uint8> data;
+ };
+
+ SoundData _soundData[2];
+ Common::Array<uint8> _speechData;
+
+ Audio::SoundHandle _channelHandle[2];
+
+ uint8 _currentSample;
+ uint8 _channel0Playing;
+ uint8 _channel0Repeat;
+ bool _channel0NewSound;
+ uint8 _channel1Playing;
+ bool _channel1NewSound;
+
+ uint8 _volume;
+ uint8 _volumeTo;
+ int8 _volumeDirection;
+ uint8 _volumeCount;
+
+ void volumeAdjust();
+ void playSound(uint8 channel, uint8 id, uint8 loops);
+ void stopSound(uint8 channel);
+ bool loadSpeech(const Common::String &filename);
+};
+
+} // End of namespace DreamWeb
+
+#endif
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 3df324abe1..01570c907a 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -51,7 +52,7 @@ void DreamWebEngine::printASprite(const Sprite *sprite) {
} else {
x = sprite->x + _mapAdX;
}
-
+
uint8 c;
if (sprite->walkFrame != 0)
c = 8;
@@ -96,7 +97,7 @@ void DreamWebEngine::spriteUpdate() {
else {
backObject(&sprite);
}
-
+
if (_nowInNewRoom == 1)
break;
}
@@ -298,7 +299,7 @@ void DreamWebEngine::doDoor(Sprite *sprite, SetObject *objData, Common::Rect che
soundIndex = 13;
else
soundIndex = 0;
- playChannel1(soundIndex);
+ _sound->playChannel1(soundIndex);
}
if (objData->frames[sprite->animFrame] == 255)
--sprite->animFrame;
@@ -315,7 +316,7 @@ void DreamWebEngine::doDoor(Sprite *sprite, SetObject *objData, Common::Rect che
soundIndex = 13;
else
soundIndex = 1;
- playChannel1(soundIndex);
+ _sound->playChannel1(soundIndex);
}
if (sprite->animFrame != 0)
--sprite->animFrame;
@@ -346,7 +347,7 @@ void DreamWebEngine::lockedDoorway(Sprite *sprite, SetObject *objData) {
if (openDoor) {
if (sprite->animFrame == 1) {
- playChannel1(0);
+ _sound->playChannel1(0);
}
if (sprite->animFrame == 6)
@@ -367,12 +368,12 @@ void DreamWebEngine::lockedDoorway(Sprite *sprite, SetObject *objData) {
// shut door
if (sprite->animFrame == 5) {
- playChannel1(1);
+ _sound->playChannel1(1);
}
if (sprite->animFrame != 0)
--sprite->animFrame;
-
+
_vars._throughDoor = 0;
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
@@ -406,7 +407,7 @@ void DreamWebEngine::liftSprite(Sprite *sprite, SetObject *objData) {
}
sprite->animFrame = 12;
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
- }
+ }
else if (liftFlag == 3) { //openlift
if (sprite->animFrame == 12) {
_vars._liftFlag = 1;
@@ -505,7 +506,7 @@ void DreamWebEngine::intro1Text() {
if (_introCount != 2 && _introCount != 4 && _introCount != 6)
return;
- if (hasSpeech() && _channel1Playing != 255) {
+ if (hasSpeech() && _sound->isChannel1Playing()) {
_introCount--;
} else {
if (_introCount == 2)
@@ -578,7 +579,7 @@ void DreamWebEngine::textForEnd() {
}
void DreamWebEngine::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
- if (hasSpeech() && _channel1Playing != 255)
+ if (hasSpeech() && _sound->isChannel1Playing())
_introCount--;
else
setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount);
@@ -614,8 +615,7 @@ void DreamWebEngine::textForMonk() {
else if (_introCount == 53) {
fadeScreenDowns();
if (hasSpeech()) {
- _volumeTo = 7;
- _volumeDirection = 1;
+ _sound->volumeChange(7, 1);
}
}
}
@@ -672,7 +672,7 @@ static const ReelSound g_roomSound6[] = {
{ 255,0 }
};
static const ReelSound g_roomSound8[] = {
-
+
{ 12, 51 },
{ 13, 53 },
{ 14, 14 },
@@ -691,7 +691,7 @@ static const ReelSound g_roomSound10[] = {
{ 13, 16 },
{ 255,0 }
};
-
+
static const ReelSound g_roomSound11[] = {
{ 13, 20 },
{ 255,0 }
@@ -779,7 +779,7 @@ static const ReelSound g_roomSound26[] = {
{ 15, 102 }, // was 90, should be mine cart
{ 255,0 }
};
-
+
static const ReelSound g_roomSound27[] = {
{ 22, 36 },
{ 13, 125 },
@@ -905,14 +905,14 @@ void DreamWebEngine::soundOnReels(uint16 reelPointer) {
continue;
_lastSoundReel = r->_reelPointer;
if (r->_sample < 64) {
- playChannel1(r->_sample);
+ _sound->playChannel1(r->_sample);
return;
}
if (r->_sample < 128) {
- playChannel0(r->_sample & 63, 0);
+ _sound->playChannel0(r->_sample & 63, 0);
return;
}
- playChannel0(r->_sample & 63, 255);
+ _sound->playChannel0(r->_sample & 63, 255);
}
if (_lastSoundReel != reelPointer)
@@ -955,9 +955,9 @@ void DreamWebEngine::getRidOfReels() {
void DreamWebEngine::liftNoise(uint8 index) {
if (_realLocation == 5 || _realLocation == 21)
- playChannel1(13); // hiss noise
+ _sound->playChannel1(13); // hiss noise
else
- playChannel1(index);
+ _sound->playChannel1(index);
}
void DreamWebEngine::checkForExit(Sprite *sprite) {
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 9789e20210..f235f7c2fd 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
#include "common/config-manager.h"
@@ -578,7 +579,7 @@ void DreamWebEngine::dreamweb() {
readSetData();
_wonGame = false;
- loadSounds(0, "V99"); // basic sample
+ _sound->loadSounds(0, "V99"); // basic sample
bool firstLoop = true;
@@ -654,7 +655,7 @@ void DreamWebEngine::dreamweb() {
_vars._location = 255;
_vars._roomAfterDream = 1;
_newLocation = 35;
- _volume = 7;
+ _sound->volumeSet(7);
loadRoom();
clearSprites();
initMan();
@@ -664,8 +665,7 @@ void DreamWebEngine::dreamweb() {
initialInv();
_lastFlag = 32;
startup1();
- _volumeTo = 0;
- _volumeDirection = -1;
+ _sound->volumeChange(0, -1);
_commandType = 255;
}
@@ -754,7 +754,7 @@ void DreamWebEngine::screenUpdate() {
showPointer();
if ((_vars._watchingTime == 0) && (_newLocation != 0xff))
return;
- vSync();
+ waitForVSync();
uint16 mouseState = 0;
mouseState |= readMouseState();
dumpPointer();
@@ -769,7 +769,7 @@ void DreamWebEngine::screenUpdate() {
showPointer();
if (_wonGame)
return;
- vSync();
+ waitForVSync();
mouseState |= readMouseState();
dumpPointer();
@@ -781,7 +781,7 @@ void DreamWebEngine::screenUpdate() {
afterNewRoom();
showPointer();
- vSync();
+ waitForVSync();
mouseState |= readMouseState();
dumpPointer();
@@ -790,7 +790,7 @@ void DreamWebEngine::screenUpdate() {
delPointer();
showPointer();
- vSync();
+ waitForVSync();
_oldButton = _mouseButton;
mouseState |= readMouseState();
_mouseButton = mouseState;
@@ -871,27 +871,11 @@ void DreamWebEngine::loadTextSegment(TextFile &file, Common::File &inFile, unsig
void DreamWebEngine::hangOnCurs(uint16 frameCount) {
for (uint16 i = 0; i < frameCount; ++i) {
printCurs();
- vSync();
+ waitForVSync();
delCurs();
}
}
-void DreamWebEngine::readMouse() {
- _oldButton = _mouseButton;
- uint16 state = readMouseState();
- _mouseButton = state;
-}
-
-uint16 DreamWebEngine::readMouseState() {
- _oldX = _mouseX;
- _oldY = _mouseY;
- uint16 x, y, state;
- mouseCall(&x, &y, &state);
- _mouseX = x;
- _mouseY = y;
- return state;
-}
-
void DreamWebEngine::dumpTextLine() {
if (_newTextLine != 1)
return;
@@ -946,7 +930,7 @@ 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,
+ // to finish (_sound->isChannel1Playing()) when we're in speech+subtitles mode,
// instead of waiting the pre-specified amount of time.
@@ -983,9 +967,9 @@ void DreamWebEngine::useTimedText() {
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);
- }
+ _speechLoaded = _sound->loadSpeech('T', voiceIndex, 'T', textIndex);
+ if (_speechLoaded)
+ _sound->playChannel1(62);
if (_speechLoaded && !_subtitles)
return;
@@ -1513,16 +1497,6 @@ void DreamWebEngine::obName(uint8 command, uint8 commandType) {
}
}
-void DreamWebEngine::delPointer() {
- if (_oldPointerX == 0xffff)
- return;
- _delHereX = _oldPointerX;
- _delHereY = _oldPointerY;
- _delXS = _pointerXS;
- _delYS = _pointerYS;
- multiPut(_pointerBack, _delHereX, _delHereY, _pointerXS, _pointerYS);
-}
-
void DreamWebEngine::showBlink() {
if (_manIsOffScreen == 1)
return;
@@ -1554,111 +1528,6 @@ void DreamWebEngine::dumpBlink() {
multiDump(44, 32, 16, 12);
}
-void DreamWebEngine::dumpPointer() {
- dumpBlink();
- multiDump(_delHereX, _delHereY, _delXS, _delYS);
- if ((_oldPointerX != _delHereX) || (_oldPointerY != _delHereY))
- multiDump(_oldPointerX, _oldPointerY, _pointerXS, _pointerYS);
-}
-
-void DreamWebEngine::showPointer() {
- showBlink();
- uint16 x = _mouseX;
- _oldPointerX = _mouseX;
- uint16 y = _mouseY;
- _oldPointerY = _mouseY;
- if (_pickUp == 1) {
- const GraphicsFile *frames;
- if (_objectType != kExObjectType)
- frames = &_freeFrames;
- else
- frames = &_exFrames;
- const Frame *frame = &frames->_frames[(3 * _itemFrame + 1)];
-
- uint8 width = frame->width;
- uint8 height = frame->height;
- if (width < 12)
- width = 12;
- if (height < 12)
- height = 12;
- _pointerXS = width;
- _pointerYS = height;
- uint16 xMin = (x >= width / 2) ? x - width / 2 : 0;
- uint16 yMin = (y >= height / 2) ? y - height / 2 : 0;
- _oldPointerX = xMin;
- _oldPointerY = yMin;
- multiGet(_pointerBack, xMin, yMin, width, height);
- showFrame(*frames, x, y, 3 * _itemFrame + 1, 128);
- showFrame(_icons1, x, y, 3, 128);
- } else {
- const Frame *frame = &_icons1._frames[_pointerFrame + 20];
- uint8 width = frame->width;
- uint8 height = frame->height;
- if (width < 12)
- width = 12;
- if (height < 12)
- height = 12;
- _pointerXS = width;
- _pointerYS = height;
- multiGet(_pointerBack, x, y, width, height);
- showFrame(_icons1, x, y, _pointerFrame + 20, 0);
- }
-}
-
-void DreamWebEngine::animPointer() {
-
- if (_pointerMode == 2) {
- _pointerFrame = 0;
- if ((_realLocation == 14) && (_commandType == 211))
- _pointerFrame = 5;
- return;
- } else if (_pointerMode == 3) {
- if (_pointerSpeed != 0) {
- --_pointerSpeed;
- } else {
- _pointerSpeed = 5;
- ++_pointerCount;
- if (_pointerCount == 16)
- _pointerCount = 0;
- }
- static const uint8 flashMouseTab[] = { 1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2 };
- _pointerFrame = flashMouseTab[_pointerCount];
- return;
- }
- if (_vars._watchingTime != 0) {
- _pointerFrame = 11;
- return;
- }
- _pointerFrame = 0;
- if (_inMapArea == 0)
- return;
- if (_pointerFirstPath == 0)
- return;
- uint8 flag, flagEx;
- getFlagUnderP(&flag, &flagEx);
- if (flag < 2)
- return;
- if (flag >= 128)
- return;
- if (flag & 4) {
- _pointerFrame = 3;
- return;
- }
- if (flag & 16) {
- _pointerFrame = 4;
- return;
- }
- if (flag & 2) {
- _pointerFrame = 5;
- return;
- }
- if (flag & 8) {
- _pointerFrame = 6;
- return;
- }
- _pointerFrame = 8;
-}
-
void DreamWebEngine::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
const uint8 *string = (const uint8 *)_commandText.getString(index);
printDirect(string, x, y, maxWidth, centered);
@@ -1765,7 +1634,7 @@ bool DreamWebEngine::checkIfSet(uint8 x, uint8 y) {
void DreamWebEngine::hangOn(uint16 frameCount) {
while (frameCount) {
- vSync();
+ waitForVSync();
--frameCount;
if (_quitRequested)
break;
@@ -1778,7 +1647,7 @@ void DreamWebEngine::hangOnW(uint16 frameCount) {
readMouse();
animPointer();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
--frameCount;
if (_quitRequested)
@@ -1796,7 +1665,7 @@ void DreamWebEngine::hangOnP(uint16 count) {
readMouse();
animPointer();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
count *= 3;
@@ -1805,7 +1674,7 @@ void DreamWebEngine::hangOnP(uint16 count) {
readMouse();
animPointer();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
if (_quitRequested)
break;
@@ -1977,7 +1846,7 @@ void DreamWebEngine::loadRoom() {
_vars._location = _newLocation;
const Room &room = g_roomData[_newLocation];
startLoading(room);
- loadRoomsSample();
+ _sound->loadRoomsSample(_roomsSample);
switchRyanOn();
drawFlags();
@@ -2091,8 +1960,8 @@ void DreamWebEngine::getRidOfAll() {
void DreamWebEngine::loadRoomData(const Room &room, bool skipDat) {
processEvents();
Common::File file;
- if (!file.open(room.name))
- error("cannot open file %s", room.name);
+ if (!file.open(modifyFileName(room.name)))
+ error("cannot open file %s", modifyFileName(room.name).c_str());
FileHeader header;
file.read((uint8 *)&header, sizeof(FileHeader));
@@ -2177,8 +2046,8 @@ void DreamWebEngine::restoreReels() {
processEvents();
Common::File file;
- if (!file.open(room.name))
- error("cannot open file %s", room.name);
+ if (!file.open(modifyFileName(room.name)))
+ error("cannot open file %s", modifyFileName(room.name).c_str());
FileHeader header;
file.read((uint8 *)&header, sizeof(FileHeader));
@@ -2263,7 +2132,7 @@ void DreamWebEngine::workToScreenM() {
animPointer();
readMouse();
showPointer();
- vSync();
+ waitForVSync();
workToScreen();
delPointer();
}
@@ -2277,12 +2146,12 @@ void DreamWebEngine::atmospheres() {
continue;
if (a->_mapX != _mapX || a->_mapY != _mapY)
continue;
- if (a->_sound != _channel0Playing) {
+ if (a->_sound != _sound->getChannel0Playing()) {
if (_vars._location == 45 && _vars._reelToWatch == 45)
continue; // "web"
- playChannel0(a->_sound, a->_repeat);
+ _sound->playChannel0(a->_sound, a->_repeat);
// NB: The asm here reads
// cmp reallocation,2
@@ -2292,21 +2161,21 @@ void DreamWebEngine::atmospheres() {
// I'm interpreting this as if the cmp reallocation is below the jz
if (_mapY == 0) {
- _volume = 0; // "fullvol"
+ _sound->volumeSet(0); // "fullvol"
return;
}
if (_realLocation == 2 && _mapX == 22 && _mapY == 10)
- _volume = 5; // "louisvol"
+ _sound->volumeSet(5); // "louisvol"
if (hasSpeech() && _realLocation == 14) {
if (_mapX == 33) {
- _volume = 0; // "ismad2"
+ _sound->volumeSet(0); // "ismad2"
return;
}
if (_mapX == 22) {
- _volume = 5;
+ _sound->volumeSet(5);
return;
}
@@ -2315,19 +2184,19 @@ void DreamWebEngine::atmospheres() {
if (_realLocation == 2) {
if (_mapX == 22) {
- _volume = 5; // "louisvol"
+ _sound->volumeSet(5); // "louisvol"
return;
}
if (_mapX == 11) {
- _volume = 0; // "fullvol"
+ _sound->volumeSet(0); // "fullvol"
return;
}
}
return;
}
- cancelCh0();
+ _sound->cancelCh0();
}
void DreamWebEngine::readKey() {
@@ -2738,7 +2607,7 @@ void DreamWebEngine::decide() {
readMouse();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
delPointer();
@@ -2773,8 +2642,8 @@ void DreamWebEngine::showGun() {
_numToFade = 128;
hangOn(200);
_roomsSample = 34;
- loadRoomsSample();
- _volume = 0;
+ _sound->loadRoomsSample(_roomsSample);
+ _sound->volumeSet(0);
GraphicsFile graphics;
loadGraphicsFile(graphics, "G13");
createPanel2();
@@ -2784,7 +2653,7 @@ void DreamWebEngine::showGun() {
graphics.clear();
fadeScreenUp();
hangOn(160);
- playChannel0(12, 0);
+ _sound->playChannel0(12, 0);
loadTempText("T83");
rollEndCreditsGameLost();
getRidOfTempText();
@@ -3051,9 +2920,7 @@ void DreamWebEngine::setupInitialVars() {
_vars._progressPoints = 0;
_vars._watchOn = 0;
_vars._shadesOn = 0;
- _vars._secondCount = 0;
- _vars._minuteCount = 30;
- _vars._hourCount = 19;
+ getTime();
_vars._zoomOn = 1;
_vars._location = 0;
_vars._exPos = 0;
@@ -3184,16 +3051,4 @@ void DreamWebEngine::purgeAnItem() {
}
}
-void DreamWebEngine::checkCoords(const RectWithCallback *rectWithCallbacks) {
- if (_newLocation != 0xff)
- return;
- const RectWithCallback *r;
- for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) {
- if (r->contains(_mouseX, _mouseY)) {
- (this->*(r->_callback))();
- return;
- }
- }
-}
-
} // End of namespace DreamWeb
diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp
index 0f59cad895..2629c23355 100644
--- a/engines/dreamweb/talk.cpp
+++ b/engines/dreamweb/talk.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -52,7 +53,7 @@ void DreamWebEngine::talk() {
readMouse();
animPointer();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
_getBack = 0;
@@ -67,9 +68,8 @@ void DreamWebEngine::talk() {
redrawMainScrn();
workToScreenM();
if (_speechLoaded) {
- cancelCh1();
- _volumeDirection = -1;
- _volumeTo = 0;
+ _sound->cancelCh1();
+ _sound->volumeChange(0, -1);
}
}
@@ -99,12 +99,10 @@ void DreamWebEngine::startTalk() {
printDirect(&str, 66, &y, 241, true);
if (hasSpeech()) {
- _speechLoaded = false;
- loadSpeech('R', _realLocation, 'C', 64*(_character & 0x7F));
+ _speechLoaded = _sound->loadSpeech('R', _realLocation, 'C', 64*(_character & 0x7F));
if (_speechLoaded) {
- _volumeDirection = 1;
- _volumeTo = 6;
- playChannel1(50 + 12);
+ _sound->volumeChange(6, 1);
+ _sound->playChannel1(62);
}
}
}
@@ -155,9 +153,9 @@ void DreamWebEngine::doSomeTalk() {
printDirect(str, 164, 64, 144, false);
- loadSpeech('R', _realLocation, 'C', (64 * (_character & 0x7F)) + _talkPos);
+ _speechLoaded = _sound->loadSpeech('R', _realLocation, 'C', (64 * (_character & 0x7F)) + _talkPos);
if (_speechLoaded)
- playChannel1(62);
+ _sound->playChannel1(62);
_pointerMode = 3;
workToScreenM();
@@ -181,9 +179,9 @@ void DreamWebEngine::doSomeTalk() {
convIcons();
printDirect(str, 48, 128, 144, false);
- loadSpeech('R', _realLocation, 'C', (64 * (_character & 0x7F)) + _talkPos);
+ _speechLoaded = _sound->loadSpeech('R', _realLocation, 'C', (64 * (_character & 0x7F)) + _talkPos);
if (_speechLoaded)
- playChannel1(62);
+ _sound->playChannel1(62);
_pointerMode = 3;
workToScreenM();
@@ -211,7 +209,7 @@ bool DreamWebEngine::hangOnPQ() {
readMouse();
animPointer();
showPointer();
- vSync();
+ waitForVSync();
dumpPointer();
dumpTextLine();
checkCoords(quitList);
@@ -220,11 +218,11 @@ bool DreamWebEngine::hangOnPQ() {
// Quit conversation
delPointer();
_pointerMode = 0;
- cancelCh1();
+ _sound->cancelCh1();
return true;
}
- if (_speechLoaded && _channel1Playing == 255) {
+ if (_speechLoaded && !_sound->isChannel1Playing()) {
speechFlag++;
if (speechFlag == 40)
break;
@@ -237,7 +235,7 @@ bool DreamWebEngine::hangOnPQ() {
}
void DreamWebEngine::redes() {
- if (_channel1Playing != 255 || _talkMode != 2) {
+ if (_sound->isChannel1Playing() || _talkMode != 2) {
blank();
return;
}
diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp
index f7486ce687..f005279ba0 100644
--- a/engines/dreamweb/titles.cpp
+++ b/engines/dreamweb/titles.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
#include "engines/util.h"
@@ -32,38 +33,36 @@ void DreamWebEngine::endGame() {
return;
gettingShot();
getRidOfTempText();
- _volumeTo = 7;
- _volumeDirection = 1;
+ _sound->volumeChange(7, 1);
hangOn(200);
}
void DreamWebEngine::monkSpeaking() {
_roomsSample = 35;
- loadRoomsSample();
+ _sound->loadRoomsSample(_roomsSample);
GraphicsFile graphics;
loadGraphicsFile(graphics, "G15");
clearWork();
showFrame(graphics, 160, 72, 0, 128); // show monk
workToScreen();
- _volume = 7;
- _volumeDirection = -1;
- _volumeTo = hasSpeech() ? 5 : 0;
- playChannel0(12, 255);
+ _sound->volumeSet(7);
+ _sound->volumeChange(hasSpeech() ? 5 : 0, -1);
+ _sound->playChannel0(12, 255);
fadeScreenUps();
hangOn(300);
// TODO: Subtitles+speech mode
if (hasSpeech()) {
for (int i = 40; i < 48; i++) {
- loadSpeech('T', 83, 'T', i);
+ _speechLoaded = _sound->loadSpeech('T', 83, 'T', i);
- playChannel1(50 + 12);
+ _sound->playChannel1(62);
do {
waitForVSync();
if (_quitRequested)
return;
- } while (_channel1Playing != 255);
+ } while (_sound->isChannel1Playing());
}
} else {
for (int i = 40; i <= 44; i++) {
@@ -83,8 +82,7 @@ void DreamWebEngine::monkSpeaking() {
}
}
- _volumeDirection = 1;
- _volumeTo = 7;
+ _sound->volumeChange(7, 1);
fadeScreenDowns();
hangOn(300);
graphics.clear();
@@ -95,8 +93,7 @@ void DreamWebEngine::gettingShot() {
clearPalette();
loadIntroRoom();
fadeScreenUps();
- _volumeTo = 0;
- _volumeDirection = -1;
+ _sound->volumeChange(0, -1);
runEndSeq();
clearBeforeLoad();
}
@@ -127,14 +124,14 @@ void DreamWebEngine::bibleQuote() {
return; // "biblequotearly"
}
- cancelCh0();
+ _sound->cancelCh0();
_lastHardKey = 0;
}
void DreamWebEngine::hangOne(uint16 delay) {
do {
- vSync();
+ waitForVSync();
if (_lastHardKey == 1)
return; // "hangonearly"
} while (--delay);
@@ -147,10 +144,9 @@ void DreamWebEngine::intro() {
_newLocation = 50;
clearPalette();
loadIntroRoom();
- _volume = 7;
- _volumeDirection = -1;
- _volumeTo = hasSpeech() ? 4 : 0;
- playChannel0(12, 255);
+ _sound->volumeSet(7);
+ _sound->volumeChange(hasSpeech() ? 4 : 0, -1);
+ _sound->playChannel0(12, 255);
fadeScreenUps();
runIntroSeq();
@@ -200,13 +196,13 @@ void DreamWebEngine::runIntroSeq() {
_getBack = 0;
do {
- vSync();
+ waitForVSync();
if (_lastHardKey == 1)
break;
spriteUpdate();
- vSync();
+ waitForVSync();
if (_lastHardKey == 1)
break;
@@ -216,14 +212,14 @@ void DreamWebEngine::runIntroSeq() {
reelsOnScreen();
afterIntroRoom();
useTimedText();
- vSync();
+ waitForVSync();
if (_lastHardKey == 1)
break;
dumpMap();
dumpTimedText();
- vSync();
+ waitForVSync();
if (_lastHardKey == 1)
break;
@@ -247,18 +243,18 @@ void DreamWebEngine::runEndSeq() {
_getBack = 0;
do {
- vSync();
+ waitForVSync();
spriteUpdate();
- vSync();
+ waitForVSync();
delEverything();
printSprites();
reelsOnScreen();
afterIntroRoom();
useTimedText();
- vSync();
+ waitForVSync();
dumpMap();
dumpTimedText();
- vSync();
+ waitForVSync();
} while (_getBack != 1 && !_quitRequested);
}
@@ -286,14 +282,14 @@ void DreamWebEngine::set16ColPalette() {
void DreamWebEngine::realCredits() {
_roomsSample = 33;
- loadRoomsSample();
- _volume = 0;
+ _sound->loadRoomsSample(_roomsSample);
+ _sound->volumeSet(0);
initGraphics(640, 480, true);
hangOn(35);
showPCX("I01");
- playChannel0(12, 0);
+ _sound->playChannel0(12, 0);
hangOne(2);
@@ -319,7 +315,7 @@ void DreamWebEngine::realCredits() {
}
showPCX("I02");
- playChannel0(12, 0);
+ _sound->playChannel0(12, 0);
hangOne(2);
if (_lastHardKey == 1) {
@@ -344,7 +340,7 @@ void DreamWebEngine::realCredits() {
}
showPCX("I03");
- playChannel0(12, 0);
+ _sound->playChannel0(12, 0);
hangOne(2);
if (_lastHardKey == 1) {
@@ -369,7 +365,7 @@ void DreamWebEngine::realCredits() {
}
showPCX("I04");
- playChannel0(12, 0);
+ _sound->playChannel0(12, 0);
hangOne(2);
if (_lastHardKey == 1) {
@@ -394,7 +390,7 @@ void DreamWebEngine::realCredits() {
}
showPCX("I05");
- playChannel0(12, 0);
+ _sound->playChannel0(12, 0);
hangOne(2);
if (_lastHardKey == 1) {
@@ -427,7 +423,7 @@ void DreamWebEngine::realCredits() {
return; // "realcreditsearly"
}
- playChannel0(13, 0);
+ _sound->playChannel0(13, 0);
hangOne(350);
if (_lastHardKey == 1) {
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index e59843539f..995eef04cd 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -201,13 +202,13 @@ void DreamWebEngine::edensCDPlayer() {
}
void DreamWebEngine::hotelBell() {
- playChannel1(12);
+ _sound->playChannel1(12);
showFirstUse();
putBackObStuff();
}
void DreamWebEngine::playGuitar() {
- playChannel1(14);
+ _sound->playChannel1(14);
showFirstUse();
putBackObStuff();
}
@@ -273,13 +274,13 @@ void DreamWebEngine::useHatch() {
}
void DreamWebEngine::wheelSound() {
- playChannel1(17);
+ _sound->playChannel1(17);
showFirstUse();
putBackObStuff();
}
void DreamWebEngine::callHotelLift() {
- playChannel1(12);
+ _sound->playChannel1(12);
showFirstUse();
_vars._countToOpen = 8;
_getBack = 1;
@@ -382,7 +383,7 @@ void DreamWebEngine::sitDownInBar() {
}
void DreamWebEngine::useDryer() {
- playChannel1(12);
+ _sound->playChannel1(12);
showFirstUse();
_getBack = 1;
}
@@ -887,7 +888,7 @@ void DreamWebEngine::usePlate() {
if (compare(_withObject, _withType, "SCRW")) {
// Unscrew plate
- playChannel1(20);
+ _sound->playChannel1(20);
showFirstUse();
placeSetObject(28);
placeSetObject(24);
@@ -992,7 +993,7 @@ void DreamWebEngine::useCart() {
removeSetObject(_command);
placeSetObject(_command + 1);
_vars._progressPoints++;
- playChannel1(17);
+ _sound->playChannel1(17);
showFirstUse();
_getBack = 1;
}
@@ -1035,7 +1036,7 @@ void DreamWebEngine::openHotelDoor() {
if (defaultUseHandler("KEYA"))
return;
- playChannel1(16);
+ _sound->playChannel1(16);
showFirstUse();
_vars._lockStatus = 0;
_getBack = 1;
@@ -1045,7 +1046,7 @@ void DreamWebEngine::openHotelDoor2() {
if (defaultUseHandler("KEYA"))
return;
- playChannel1(16);
+ _sound->playChannel1(16);
showFirstUse();
putBackObStuff();
}
@@ -1067,7 +1068,7 @@ void DreamWebEngine::usePoolReader() {
showSecondUse();
putBackObStuff();
} else {
- playChannel1(17);
+ _sound->playChannel1(17);
showFirstUse();
_vars._countToOpen = 6;
_getBack = 1;
@@ -1088,7 +1089,7 @@ void DreamWebEngine::useCardReader1() {
putBackObStuff();
} else {
// Get cash
- playChannel1(16);
+ _sound->playChannel1(16);
showPuzText(18, 300);
_vars._progressPoints++;
_vars._card1Money = 12432;
@@ -1113,7 +1114,7 @@ void DreamWebEngine::useCardReader2() {
showPuzText(22, 300);
putBackObStuff();
} else {
- playChannel1(18);
+ _sound->playChannel1(18);
showPuzText(19, 300);
placeSetObject(94);
_vars._gunPassFlag = 1;
@@ -1136,7 +1137,7 @@ void DreamWebEngine::useCardReader3() {
showPuzText(26, 300);
putBackObStuff();
} else {
- playChannel1(16);
+ _sound->playChannel1(16);
showPuzText(25, 300);
_vars._progressPoints++;
_vars._card1Money -= 8300;
@@ -1232,7 +1233,7 @@ void DreamWebEngine::useControl() {
}
if (compare(_withObject, _withType, "KEYA")) { // Right key
- playChannel1(16);
+ _sound->playChannel1(16);
if (_vars._location == 21) { // Going down
showPuzText(3, 300);
_newLocation = 30;
@@ -1257,7 +1258,7 @@ void DreamWebEngine::useControl() {
placeSetObject(30);
removeSetObject(16);
removeSetObject(17);
- playChannel1(14);
+ _sound->playChannel1(14);
showPuzText(10, 300);
_vars._progressPoints++;
_getBack = 1;
@@ -1375,7 +1376,7 @@ void DreamWebEngine::runTap() {
// Fill cup from tap
DynObject *exObject = getExAd(_withObject);
exObject->objId[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup)
- playChannel1(8);
+ _sound->playChannel1(8);
showPuzText(57, 300);
putBackObStuff();
return;
diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp
index e8999ab18c..c8f05641b5 100644
--- a/engines/dreamweb/vgafades.cpp
+++ b/engines/dreamweb/vgafades.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
namespace DreamWeb {
@@ -52,7 +53,7 @@ void DreamWebEngine::fadeDOS() {
return; // FIXME later
waitForVSync();
- //processEvents will be called from vsync
+ //processEvents will be called from waitForVSync
uint8 *dst = _startPal;
getPalette(dst, 0, 64);
for (int fade = 0; fade < 64; ++fade) {
@@ -123,7 +124,7 @@ void DreamWebEngine::fadeUpMonFirst() {
_colourPos = 0;
_numToFade = 128;
hangOn(64);
- playChannel1(26);
+ _sound->playChannel1(26);
hangOn(64);
}
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index a66f156a1d..d2390fb1fd 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -23,6 +23,7 @@
#include "dreamweb/dreamweb.h"
#include "engines/util.h"
#include "graphics/surface.h"
+#include "graphics/decoders/pcx.h"
namespace DreamWeb {
@@ -144,10 +145,6 @@ void DreamWebEngine::doShake() {
setShakePos(offset >= 0 ? offset : -offset);
}
-void DreamWebEngine::vSync() {
- waitForVSync();
-}
-
void DreamWebEngine::setMode() {
waitForVSync();
initGraphics(320, 200, false);
@@ -156,70 +153,33 @@ void DreamWebEngine::setMode() {
void DreamWebEngine::showPCX(const Common::String &suffix) {
Common::String name = getDatafilePrefix() + suffix;
Common::File pcxFile;
-
if (!pcxFile.open(name)) {
warning("showpcx: Could not open '%s'", name.c_str());
return;
}
- uint8 *mainGamePal;
- int i, j;
+ Graphics::PCXDecoder pcx;
+ if (!pcx.loadStream(pcxFile)) {
+ warning("showpcx: Could not process '%s'", name.c_str());
+ return;
+ }
// Read the 16-color palette into the 'maingamepal' buffer. Note that
// the color components have to be adjusted from 8 to 6 bits.
-
- pcxFile.seek(16, SEEK_SET);
- mainGamePal = _mainPal;
- pcxFile.read(mainGamePal, 48);
-
- memset(mainGamePal + 48, 0xff, 720);
- for (i = 0; i < 48; i++) {
- mainGamePal[i] >>= 2;
+ memset(_mainPal, 0xff, 256 * 3);
+ memcpy(_mainPal, pcx.getPalette(), 48);
+ for (int i = 0; i < 48; i++) {
+ _mainPal[i] >>= 2;
}
- // Decode the image data.
-
Graphics::Surface *s = g_system->lockScreen();
- Common::Rect rect(640, 480);
-
- s->fillRect(rect, 0);
- pcxFile.seek(128, SEEK_SET);
-
- for (int y = 0; y < 480; y++) {
- byte *dst = (byte *)s->getBasePtr(0, y);
- int decoded = 0;
-
- while (decoded < 320) {
- byte col = pcxFile.readByte();
- byte len;
-
- if ((col & 0xc0) == 0xc0) {
- len = col & 0x3f;
- col = pcxFile.readByte();
- } else {
- len = 1;
- }
-
- // The image uses 16 colors and is stored as four bit
- // planes, one for each bit of the color, least
- // significant bit plane first.
-
- for (i = 0; i < len; i++) {
- int plane = decoded / 80;
- int pos = decoded % 80;
-
- for (j = 0; j < 8; j++) {
- byte bit = (col >> (7 - j)) & 1;
- dst[8 * pos + j] |= (bit << plane);
- }
-
- decoded++;
- }
- }
- }
-
+ s->fillRect(Common::Rect(640, 480), 0);
+ const Graphics::Surface *pcxSurface = pcx.getSurface();
+ if (pcxSurface->format.bytesPerPixel != 1)
+ error("Invalid bytes per pixel in PCX surface (%d)", pcxSurface->format.bytesPerPixel);
+ for (uint16 y = 0; y < pcxSurface->h; y++)
+ memcpy((byte *)s->getBasePtr(0, y), pcxSurface->getBasePtr(0, y), pcxSurface->w);
g_system->unlockScreen();
- pcxFile.close();
}
void DreamWebEngine::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
@@ -374,9 +334,9 @@ void DreamWebEngine::zoom() {
for (size_t j = 0; j < 23; ++j) {
uint8 v = src[j];
dst[2*j+0] = v;
- dst[2*j+1] = v;
+ dst[2*j+1] = v;
dst[2*j+320] = v;
- dst[2*j+321] = v;
+ dst[2*j+321] = v;
}
src += 320;
dst += 320*2;
diff --git a/engines/engines.mk b/engines/engines.mk
index 5b0bb3bdef..87b5809b37 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -135,6 +135,11 @@ DEFINES += -DENABLE_PARALLACTION=$(ENABLE_PARALLACTION)
MODULES += engines/parallaction
endif
+ifdef ENABLE_PEGASUS
+DEFINES += -DENABLE_PEGASUS=$(ENABLE_PEGASUS)
+MODULES += engines/pegasus
+endif
+
ifdef ENABLE_QUEEN
DEFINES += -DENABLE_QUEEN=$(ENABLE_QUEEN)
MODULES += engines/queen
@@ -202,6 +207,11 @@ DEFINES += -DENABLE_TOLTECS=$(ENABLE_TOLTECS)
MODULES += engines/toltecs
endif
+ifdef ENABLE_TONY
+DEFINES += -DENABLE_TONY=$(ENABLE_TONY)
+MODULES += engines/tony
+endif
+
ifdef ENABLE_TOON
DEFINES += -DENABLE_TOON=$(ENABLE_TOON)
MODULES += engines/toon
@@ -221,3 +231,8 @@ ifdef ENABLE_TUCKER
DEFINES += -DENABLE_TUCKER=$(ENABLE_TUCKER)
MODULES += engines/tucker
endif
+
+ifdef ENABLE_WINTERMUTE
+DEFINES += -DENABLE_WINTERMUTE=$(ENABLE_WINTERMUTE)
+MODULES += engines/wintermute
+endif
diff --git a/engines/gob/anifile.cpp b/engines/gob/anifile.cpp
index 1a905f1083..085ac800cd 100644
--- a/engines/gob/anifile.cpp
+++ b/engines/gob/anifile.cpp
@@ -28,50 +28,52 @@
#include "gob/dataio.h"
#include "gob/surface.h"
#include "gob/video.h"
+#include "gob/cmpfile.h"
#include "gob/anifile.h"
namespace Gob {
-ANIFile::Layer::Layer() : surface(0), coordinates(0) {
-}
-
-ANIFile::Layer::~Layer() {
- delete coordinates;
- delete surface;
-}
-
-
ANIFile::ANIFile(GobEngine *vm, const Common::String &fileName,
uint16 width, uint8 bpp) : _vm(vm),
_width(width), _bpp(bpp), _hasPadding(false) {
- Common::SeekableReadStream *ani = _vm->_dataIO->getFile(fileName);
- if (ani) {
- Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), false, DisposeAfterUse::YES);
+ bool bigEndian = false;
+ Common::String endianFileName = fileName;
- load(sub, fileName);
- return;
- }
+ if ((_vm->getEndiannessMethod() == kEndiannessMethodAltFile) &&
+ !_vm->_dataIO->hasFile(fileName)) {
+ // If the game has alternate big-endian files, look if one exist
+
+ Common::String alternateFileName = fileName;
+ alternateFileName.setChar('_', 0);
- // File doesn't exist, try to open the big-endian'd alternate file
- Common::String alternateFileName = fileName;
- alternateFileName.setChar('_', 0);
+ if (_vm->_dataIO->hasFile(alternateFileName)) {
+ bigEndian = true;
+ endianFileName = alternateFileName;
+ }
+ } else if ((_vm->getEndiannessMethod() == kEndiannessMethodBE) ||
+ ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) &&
+ (_vm->getEndianness() == kEndiannessBE)))
+ // Game always little endian or it follows the system and it is big endian
+ bigEndian = true;
- ani = _vm->_dataIO->getFile(alternateFileName);
+ Common::SeekableReadStream *ani = _vm->_dataIO->getFile(endianFileName);
if (ani) {
- Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), true, DisposeAfterUse::YES);
+ Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), bigEndian, DisposeAfterUse::YES);
// The big endian version pads a few fields to even size
- _hasPadding = true;
+ _hasPadding = bigEndian;
load(sub, fileName);
return;
}
- warning("ANIFile::ANIFile(): No such file \"%s\"", fileName.c_str());
+ warning("ANIFile::ANIFile(): No such file \"%s\" (\"%s\")", endianFileName.c_str(), fileName.c_str());
}
ANIFile::~ANIFile() {
+ for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
+ delete *l;
}
void ANIFile::load(Common::SeekableSubReadStreamEndian &ani, const Common::String &fileName) {
@@ -90,9 +92,9 @@ void ANIFile::load(Common::SeekableSubReadStreamEndian &ani, const Common::Strin
if (_hasPadding)
ani.skip(1);
- _layers.resize(layerCount - 1);
- for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
- loadLayer(*l, ani);
+ _layers.reserve(layerCount - 1);
+ for (int i = 0; i < layerCount - 1; i++)
+ _layers.push_back(loadLayer(ani));
}
_maxWidth = 0;
@@ -158,14 +160,13 @@ void ANIFile::loadAnimation(Animation &animation, FrameArray &frames,
area.right = area.bottom = -0x7FFF;
for (ChunkList::const_iterator c = frame.begin(); c != frame.end(); c++) {
- const Layer *layer;
- const RXYFile::Coordinates *coords;
+ uint16 cL, cT, cR, cB;
- if (!getPart(c->layer, c->part, layer, coords))
+ if (!getCoordinates(c->layer, c->part, cL, cT, cR, cB))
continue;
- const uint16 width = coords->right - coords->left + 1;
- const uint16 height = coords->bottom - coords->top + 1;
+ const uint16 width = cR - cL + 1;
+ const uint16 height = cB - cT + 1;
const uint16 l = c->x;
const uint16 t = c->y;
@@ -233,33 +234,12 @@ void ANIFile::loadFrames(FrameArray &frames, Common::SeekableSubReadStreamEndian
}
}
-void ANIFile::loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &ani) {
- Common::String file = Util::readString(ani, 13);
+CMPFile *ANIFile::loadLayer(Common::SeekableSubReadStreamEndian &ani) {
+ Common::String file = Util::setExtension(Util::readString(ani, 13), "");
if (_hasPadding)
ani.skip(1);
- if (file.empty())
- return;
-
- Common::String fileRXY = Util::setExtension(file, ".RXY");
- Common::String fileCMP = Util::setExtension(file, ".CMP");
- if (!_vm->_dataIO->hasFile(fileRXY) || !_vm->_dataIO->hasFile(fileCMP))
- return;
-
- loadLayer(layer, fileRXY, fileCMP);
-}
-
-void ANIFile::loadLayer(Layer &layer, const Common::String &fileRXY,
- const Common::String &fileCMP) {
-
- Common::SeekableReadStream *dataRXY = _vm->_dataIO->getFile(fileRXY);
- if (!dataRXY)
- return;
-
- layer.coordinates = new RXYFile(*dataRXY);
- layer.surface = new Surface(_width, layer.coordinates->getHeight(), _bpp);
-
- _vm->_video->drawPackedSprite(fileCMP.c_str(), *layer.surface);
+ return new CMPFile(_vm, file, _width, 0, _bpp);
}
uint16 ANIFile::getAnimationCount() const {
@@ -277,24 +257,13 @@ const ANIFile::Animation &ANIFile::getAnimationInfo(uint16 animation) const {
return _animations[animation];
}
-bool ANIFile::getPart(uint16 layer, uint16 part,
- const Layer *&l, const RXYFile::Coordinates *&c) const {
+bool ANIFile::getCoordinates(uint16 layer, uint16 part,
+ uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) const {
if (layer >= _layers.size())
return false;
- l = &_layers[layer];
- if (!l->surface || !l->coordinates)
- return false;
-
- if (part >= l->coordinates->size())
- return false;
-
- c = &(*l->coordinates)[part];
- if (c->left == 0xFFFF)
- return false;
-
- return true;
+ return _layers[layer]->getCoordinates(part, left, top, right, bottom);
}
void ANIFile::draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16 y) const {
@@ -314,13 +283,15 @@ void ANIFile::draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16
void ANIFile::drawLayer(Surface &dest, uint16 layer, uint16 part,
int16 x, int16 y, int32 transp) const {
- const Layer *l;
- const RXYFile::Coordinates *c;
-
- if (!getPart(layer, part, l, c))
+ if (layer >= _layers.size())
return;
- dest.blit(*l->surface, c->left, c->top, c->right, c->bottom, x, y, transp);
+ _layers[layer]->draw(dest, part, x, y, transp);
+}
+
+void ANIFile::recolor(uint8 from, uint8 to) {
+ for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
+ (*l)->recolor(from, to);
}
} // End of namespace Gob
diff --git a/engines/gob/anifile.h b/engines/gob/anifile.h
index 1e10da6ff4..c930aafc6b 100644
--- a/engines/gob/anifile.h
+++ b/engines/gob/anifile.h
@@ -28,8 +28,6 @@
#include "common/array.h"
#include "common/list.h"
-#include "gob/rxyfile.h"
-
namespace Common {
class SeekableSubReadStreamEndian;
}
@@ -38,6 +36,7 @@ namespace Gob {
class GobEngine;
class Surface;
+class CMPFile;
/** An ANI file, describing an animation.
*
@@ -93,17 +92,11 @@ public:
/** Draw an animation frame. */
void draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16 y) const;
-private:
- /** A sprite layer. */
- struct Layer {
- Surface *surface; ///< The surface containing the layer sprite.
- RXYFile *coordinates; ///< The coordinates describing the layer sprite parts.
+ /** Recolor the animation sprites. */
+ void recolor(uint8 from, uint8 to);
- Layer();
- ~Layer();
- };
-
- typedef Common::Array<Layer> LayerArray;
+private:
+ typedef Common::Array<CMPFile *> LayerArray;
typedef Common::Array<Animation> AnimationArray;
/** A "chunk" of an animation frame. */
@@ -139,9 +132,7 @@ private:
void load(Common::SeekableSubReadStreamEndian &ani, const Common::String &fileName);
- void loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &ani);
- void loadLayer(Layer &layer, const Common::String &fileRXY,
- const Common::String &fileCMP);
+ CMPFile *loadLayer(Common::SeekableSubReadStreamEndian &ani);
void loadAnimation(Animation &animation, FrameArray &frames,
Common::SeekableSubReadStreamEndian &ani);
@@ -149,8 +140,8 @@ private:
// Drawing helpers
- bool getPart(uint16 layer, uint16 part,
- const Layer *&l, const RXYFile::Coordinates *&c) const;
+ bool getCoordinates(uint16 layer, uint16 part,
+ uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) const;
void drawLayer(Surface &dest, uint16 layer, uint16 part,
int16 x, int16 y, int32 transp) const;
diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
index 0ca850d1fb..7e3668a0ce 100644
--- a/engines/gob/aniobject.cpp
+++ b/engines/gob/aniobject.cpp
@@ -22,20 +22,26 @@
#include "gob/surface.h"
#include "gob/anifile.h"
+#include "gob/cmpfile.h"
#include "gob/aniobject.h"
namespace Gob {
-ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani),
- _visible(false), _paused(false), _mode(kModeContinuous),
- _x(0), _y(0), _background(0), _drawn(false) {
+ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani), _cmp(0),
+ _visible(false), _paused(false), _mode(kModeContinuous), _x(0), _y(0) {
+
+ setAnimation(0);
+ setPosition();
+}
+
+ANIObject::ANIObject(const CMPFile &cmp) : _ani(0), _cmp(&cmp),
+ _visible(false), _paused(false), _mode(kModeContinuous), _x(0), _y(0) {
setAnimation(0);
setPosition();
}
ANIObject::~ANIObject() {
- delete _background;
}
void ANIObject::setVisible(bool visible) {
@@ -67,7 +73,15 @@ void ANIObject::rewind() {
_frame = 0;
}
+void ANIObject::setFrame(uint16 frame) {
+ _frame = frame % _ani->getAnimationInfo(_animation).frameCount;
+}
+
void ANIObject::setPosition() {
+ // CMP "animations" have no default position
+ if (_cmp)
+ return;
+
if (_animation >= _ani->getAnimationCount())
return;
@@ -87,7 +101,13 @@ void ANIObject::getPosition(int16 &x, int16 &y) const {
y = _y;
}
-void ANIObject::getFramePosition(int16 &x, int16 &y) const {
+void ANIObject::getFramePosition(int16 &x, int16 &y, uint16 n) const {
+ // CMP "animations" have no specific frame positions
+ if (_cmp) {
+ getPosition(x, y);
+ return;
+ }
+
if (_animation >= _ani->getAnimationCount())
return;
@@ -95,11 +115,31 @@ void ANIObject::getFramePosition(int16 &x, int16 &y) const {
if (_frame >= animation.frameCount)
return;
- x = _x + animation.frameAreas[_frame].left;
- y = _y + animation.frameAreas[_frame].top;
+ // If we're paused, we don't advance any frames
+ if (_paused)
+ n = 0;
+
+ // Number of cycles run through after n frames
+ uint16 cycles = (_frame + n) / animation.frameCount;
+ // Frame position after n frames
+ uint16 frame = (_frame + n) % animation.frameCount;
+
+ // Only doing one cycle?
+ if (_mode == kModeOnce)
+ cycles = MAX<uint16>(cycles, 1);
+
+ x = _x + animation.frameAreas[frame].left + cycles * animation.deltaX;
+ y = _y + animation.frameAreas[frame].top + cycles * animation.deltaY;
}
-void ANIObject::getFrameSize(int16 &width, int16 &height) const {
+void ANIObject::getFrameSize(int16 &width, int16 &height, uint16 n) const {
+ if (_cmp) {
+ width = _cmp->getWidth (_animation);
+ height = _cmp->getHeight(_animation);
+
+ return;
+ }
+
if (_animation >= _ani->getAnimationCount())
return;
@@ -107,8 +147,15 @@ void ANIObject::getFrameSize(int16 &width, int16 &height) const {
if (_frame >= animation.frameCount)
return;
- width = animation.frameAreas[_frame].right - animation.frameAreas[_frame].left + 1;
- height = animation.frameAreas[_frame].bottom - animation.frameAreas[_frame].top + 1;
+ // If we're paused, we don't advance any frames
+ if (_paused)
+ n = 0;
+
+ // Frame position after n frames
+ uint16 frame = (_frame + n) % animation.frameCount;
+
+ width = animation.frameAreas[frame].right - animation.frameAreas[frame].left + 1;
+ height = animation.frameAreas[frame].bottom - animation.frameAreas[frame].top + 1;
}
bool ANIObject::isIn(int16 x, int16 y) const {
@@ -141,67 +188,88 @@ bool ANIObject::isIn(const ANIObject &obj) const {
obj.isIn(frameX + frameWidth - 1, frameY + frameHeight - 1);
}
-void ANIObject::draw(Surface &dest, int16 &left, int16 &top,
+bool ANIObject::draw(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
if (!_visible)
- return;
+ return false;
+
+ if (_cmp)
+ return drawCMP(dest, left, top, right, bottom);
+ else if (_ani)
+ return drawANI(dest, left, top, right, bottom);
+
+ return false;
+}
- if (!_background) {
+bool ANIObject::drawCMP(Surface &dest, int16 &left, int16 &top,
+ int16 &right, int16 &bottom) {
+
+ if (!hasBuffer()) {
+ uint16 width, height;
+
+ _cmp->getMaxSize(width, height);
+
+ resizeBuffer(width, height);
+ }
+
+ left = _x;
+ top = _y;
+ right = _x + _cmp->getWidth (_animation) - 1;
+ bottom = _y + _cmp->getHeight(_animation) - 1;
+
+ if (!saveScreen(dest, left, top, right, bottom))
+ return false;
+
+ _cmp->draw(dest, _animation, _x, _y, 0);
+
+ return true;
+}
+
+bool ANIObject::drawANI(Surface &dest, int16 &left, int16 &top,
+ int16 &right, int16 &bottom) {
+
+ if (!hasBuffer()) {
uint16 width, height;
_ani->getMaxSize(width, height);
- _background = new Surface(width, height, dest.getBPP());
+ resizeBuffer(width, height);
}
const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
if (_frame >= animation.frameCount)
- return;
+ return false;
const ANIFile::FrameArea &area = animation.frameAreas[_frame];
- _backgroundLeft = CLIP<int16>(area.left + _x, 0, dest.getWidth () - 1);
- _backgroundTop = CLIP<int16>(area.top + _y, 0, dest.getHeight() - 1);
- _backgroundRight = CLIP<int16>(area.right + _x, 0, dest.getWidth () - 1);
- _backgroundBottom = CLIP<int16>(area.bottom + _y, 0, dest.getHeight() - 1);
+ left = _x + area.left;
+ top = _y + area.top;
+ right = _x + area.right;
+ bottom = _y + area.bottom;
- _background->blit(dest, _backgroundLeft , _backgroundTop,
- _backgroundRight, _backgroundBottom, 0, 0);
+ if (!saveScreen(dest, left, top, right, bottom))
+ return false;
_ani->draw(dest, _animation, _frame, _x, _y);
- _drawn = true;
-
- left = _backgroundLeft;
- top = _backgroundTop;
- right = _backgroundRight;
- bottom = _backgroundBottom;
+ return true;
}
-void ANIObject::clear(Surface &dest, int16 &left, int16 &top,
+bool ANIObject::clear(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
- if (!_drawn)
- return;
-
- const int16 bgRight = _backgroundRight - _backgroundLeft;
- const int16 bgBottom = _backgroundBottom - _backgroundTop;
-
- dest.blit(*_background, 0, 0, bgRight, bgBottom, _backgroundLeft, _backgroundTop);
-
- _drawn = false;
-
- left = _backgroundLeft;
- top = _backgroundTop;
- right = _backgroundRight;
- bottom = _backgroundBottom;
+ return restoreScreen(dest, left, top, right, bottom);
}
void ANIObject::advance() {
if (_paused)
return;
+ // CMP "animations" have only one frame
+ if (_cmp)
+ return;
+
if (_animation >= _ani->getAnimationCount())
return;
@@ -229,6 +297,10 @@ uint16 ANIObject::getFrame() const {
}
bool ANIObject::lastFrame() const {
+ // CMP "animations" have only one frame
+ if (_cmp)
+ return true;
+
if (_animation >= _ani->getAnimationCount())
return true;
diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h
index e3fe301400..d8c8edc2b8 100644
--- a/engines/gob/aniobject.h
+++ b/engines/gob/aniobject.h
@@ -25,20 +25,26 @@
#include "common/system.h"
+#include "gob/backbuffer.h"
+
namespace Gob {
class ANIFile;
+class CMPFile;
class Surface;
/** An ANI object, controlling an animation within an ANI file. */
-class ANIObject {
+class ANIObject : public BackBuffer {
public:
enum Mode {
kModeContinuous, ///< Play the animation continuously.
kModeOnce ///< Play the animation only once.
};
+ /** Create an animation object from an ANI file. */
ANIObject(const ANIFile &ani);
+ /** Create an animation object from a CMP sprite. */
+ ANIObject(const CMPFile &cmp);
virtual ~ANIObject();
/** Make the object visible/invisible. */
@@ -57,17 +63,17 @@ public:
void setMode(Mode mode);
/** Set the current position to the animation's default. */
- void setPosition();
+ virtual void setPosition();
/** Set the current position. */
- void setPosition(int16 x, int16 y);
+ virtual void setPosition(int16 x, int16 y);
/** Return the current position. */
void getPosition(int16 &x, int16 &y) const;
- /** Return the current frame position. */
- void getFramePosition(int16 &x, int16 &y) const;
- /** Return the current frame size. */
- void getFrameSize(int16 &width, int16 &height) const;
+ /** Return the frame position after another n frames. */
+ void getFramePosition(int16 &x, int16 &y, uint16 n = 0) const;
+ /** Return the current frame size after another n frames. */
+ void getFrameSize(int16 &width, int16 &height, uint16 n = 0) const;
/** Are there coordinates within the animation sprite? */
bool isIn(int16 x, int16 y) const;
@@ -80,6 +86,9 @@ public:
/** Rewind the current animation to the first frame. */
void rewind();
+ /** Set the animation to a specific frame. */
+ void setFrame(uint16 frame);
+
/** Return the current animation number. */
uint16 getAnimation() const;
/** Return the current frame number. */
@@ -89,15 +98,16 @@ public:
bool lastFrame() const;
/** Draw the current frame onto the surface and return the affected rectangle. */
- void draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ virtual bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
/** Draw the current frame from the surface and return the affected rectangle. */
- void clear(Surface &dest, int16 &left , int16 &top, int16 &right, int16 &bottom);
+ virtual bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
/** Advance the animation to the next frame. */
virtual void advance();
private:
const ANIFile *_ani; ///< The managed ANI file.
+ const CMPFile *_cmp; ///< The managed CMP file.
uint16 _animation; ///< The current animation number
uint16 _frame; ///< The current frame.
@@ -110,13 +120,9 @@ private:
int16 _x; ///< The current X position.
int16 _y; ///< The current Y position.
- Surface *_background; ///< The saved background.
- bool _drawn; ///< Was the animation drawn?
- int16 _backgroundLeft; ///< The left position of the saved background.
- int16 _backgroundTop; ///< The top of the saved background.
- int16 _backgroundRight; ///< The right position of the saved background.
- int16 _backgroundBottom; ///< The bottom position of the saved background.
+ bool drawCMP(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ bool drawANI(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
};
} // End of namespace Gob
diff --git a/engines/gob/backbuffer.cpp b/engines/gob/backbuffer.cpp
new file mode 100644
index 0000000000..752042d46e
--- /dev/null
+++ b/engines/gob/backbuffer.cpp
@@ -0,0 +1,100 @@
+/* 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/backbuffer.h"
+#include "gob/surface.h"
+
+namespace Gob {
+
+BackBuffer::BackBuffer() : _background(0), _saved(false) {
+}
+
+BackBuffer::~BackBuffer() {
+ delete _background;
+}
+
+bool BackBuffer::hasBuffer() const {
+ return _background != 0;
+}
+
+bool BackBuffer::hasSavedBackground() const {
+ return _saved;
+}
+
+void BackBuffer::trashBuffer() {
+ _saved = false;
+}
+
+void BackBuffer::resizeBuffer(uint16 width, uint16 height) {
+ trashBuffer();
+
+ if (_background && (_background->getWidth() == width) && (_background->getHeight() == height))
+ return;
+
+ delete _background;
+
+ _background = new Surface(width, height, 1);
+}
+
+bool BackBuffer::saveScreen(const Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ if (!_background)
+ return false;
+
+ const int16 width = MIN<int16>(right - left + 1, _background->getWidth ());
+ const int16 height = MIN<int16>(bottom - top + 1, _background->getHeight());
+ if ((width <= 0) || (height <= 0))
+ return false;
+
+ right = left + width - 1;
+ bottom = top + height - 1;
+
+ _saveLeft = left;
+ _saveTop = top;
+ _saveRight = right;
+ _saveBottom = bottom;
+
+ _background->blit(dest, _saveLeft, _saveTop, _saveRight, _saveBottom, 0, 0);
+
+ _saved = true;
+
+ return true;
+}
+
+bool BackBuffer::restoreScreen(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ if (!_saved)
+ return false;
+
+ left = _saveLeft;
+ top = _saveTop;
+ right = _saveRight;
+ bottom = _saveBottom;
+
+ dest.blit(*_background, 0, 0, right - left, bottom - top, left, top);
+
+ _saved = false;
+
+ return true;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/backbuffer.h b/engines/gob/backbuffer.h
new file mode 100644
index 0000000000..c978689e9f
--- /dev/null
+++ b/engines/gob/backbuffer.h
@@ -0,0 +1,59 @@
+/* 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_BACKBUFFER_H
+#define GOB_BACKBUFFER_H
+
+#include "common/system.h"
+
+namespace Gob {
+
+class Surface;
+
+class BackBuffer {
+public:
+ BackBuffer();
+ ~BackBuffer();
+
+protected:
+ void trashBuffer();
+ void resizeBuffer(uint16 width, uint16 height);
+
+ bool saveScreen (const Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ bool restoreScreen( Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+ bool hasBuffer() const;
+ bool hasSavedBackground() const;
+
+private:
+ Surface *_background; ///< The saved background.
+ bool _saved; ///< Was the background saved?
+
+ int16 _saveLeft; ///< The left position of the saved background.
+ int16 _saveTop; ///< The top of the saved background.
+ int16 _saveRight; ///< The right position of the saved background.
+ int16 _saveBottom; ///< The bottom position of the saved background.
+};
+
+} // End of namespace Gob
+
+#endif // GOB_BACKBUFFER_H
diff --git a/engines/gob/cheater.h b/engines/gob/cheater.h
index 334a5e88eb..bf6c1372fb 100644
--- a/engines/gob/cheater.h
+++ b/engines/gob/cheater.h
@@ -31,6 +31,7 @@ namespace Gob {
namespace Geisha {
class Diving;
+ class Penetration;
}
class GobEngine;
@@ -48,13 +49,14 @@ protected:
class Cheater_Geisha : public Cheater {
public:
- Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving);
+ Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving, Geisha::Penetration *penetration);
~Cheater_Geisha();
bool cheat(GUI::Debugger &console);
private:
- Geisha::Diving *_diving;
+ Geisha::Diving *_diving;
+ Geisha::Penetration *_penetration;
};
} // End of namespace Gob
diff --git a/engines/gob/cheater_geisha.cpp b/engines/gob/cheater_geisha.cpp
index 3d8c56707d..567333c12f 100644
--- a/engines/gob/cheater_geisha.cpp
+++ b/engines/gob/cheater_geisha.cpp
@@ -27,11 +27,12 @@
#include "gob/inter.h"
#include "gob/minigames/geisha/diving.h"
+#include "gob/minigames/geisha/penetration.h"
namespace Gob {
-Cheater_Geisha::Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving) :
- Cheater(vm), _diving(diving) {
+Cheater_Geisha::Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving, Geisha::Penetration *penetration) :
+ Cheater(vm), _diving(diving), _penetration(penetration) {
}
@@ -45,6 +46,12 @@ bool Cheater_Geisha::cheat(GUI::Debugger &console) {
return false;
}
+ // A cheat to get around the Penetration minigame
+ if (_penetration->isPlaying()) {
+ _penetration->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);
diff --git a/engines/gob/cmpfile.cpp b/engines/gob/cmpfile.cpp
new file mode 100644
index 0000000000..d304958f76
--- /dev/null
+++ b/engines/gob/cmpfile.cpp
@@ -0,0 +1,258 @@
+/* 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/stream.h"
+#include "common/substream.h"
+#include "common/str.h"
+
+#include "gob/gob.h"
+#include "gob/util.h"
+#include "gob/surface.h"
+#include "gob/video.h"
+#include "gob/dataio.h"
+#include "gob/rxyfile.h"
+#include "gob/cmpfile.h"
+
+namespace Gob {
+
+CMPFile::CMPFile(GobEngine *vm, const Common::String &baseName,
+ uint16 width, uint16 height, uint8 bpp) :
+ _vm(vm), _width(width), _height(height), _bpp(bpp), _maxWidth(0), _maxHeight(0),
+ _surface(0), _coordinates(0) {
+
+ if (baseName.empty())
+ return;
+
+ const Common::String rxyFile = Util::setExtension(baseName, ".RXY");
+ const Common::String cmpFile = Util::setExtension(baseName, ".CMP");
+
+ if (!_vm->_dataIO->hasFile(cmpFile))
+ return;
+
+ loadRXY(rxyFile);
+ createSurface();
+
+ loadCMP(cmpFile);
+}
+
+CMPFile::CMPFile(GobEngine *vm, const Common::String &cmpFile, const Common::String &rxyFile,
+ uint16 width, uint16 height, uint8 bpp) :
+ _vm(vm), _width(width), _height(height), _bpp(bpp), _maxWidth(0), _maxHeight(0),
+ _surface(0), _coordinates(0) {
+
+ if (cmpFile.empty() || !_vm->_dataIO->hasFile(cmpFile))
+ return;
+
+ loadRXY(rxyFile);
+ createSurface();
+
+ loadCMP(cmpFile);
+}
+
+CMPFile::CMPFile(GobEngine *vm, Common::SeekableReadStream &cmp, Common::SeekableReadStream &rxy,
+ uint16 width, uint16 height, uint8 bpp) :
+ _vm(vm), _width(width), _height(height), _bpp(bpp), _maxWidth(0), _maxHeight(0),
+ _surface(0), _coordinates(0) {
+
+ loadRXY(rxy);
+ createSurface();
+
+ loadCMP(cmp);
+}
+
+CMPFile::CMPFile(GobEngine *vm, Common::SeekableReadStream &cmp,
+ uint16 width, uint16 height, uint8 bpp) :
+ _vm(vm), _width(width), _height(height), _bpp(bpp), _maxWidth(0), _maxHeight(0),
+ _surface(0), _coordinates(0) {
+
+ createRXY();
+ createSurface();
+
+ loadCMP(cmp);
+}
+
+CMPFile::~CMPFile() {
+ delete _surface;
+ delete _coordinates;
+}
+
+bool CMPFile::empty() const {
+ return (_surface == 0) || (_coordinates == 0);
+}
+
+uint16 CMPFile::getSpriteCount() const {
+ if (empty())
+ return 0;
+
+ return _coordinates->size();
+}
+
+void CMPFile::loadCMP(const Common::String &cmp) {
+ Common::SeekableReadStream *dataCMP = _vm->_dataIO->getFile(cmp);
+ if (!dataCMP)
+ return;
+
+ loadCMP(*dataCMP);
+
+ delete dataCMP;
+}
+
+void CMPFile::loadRXY(const Common::String &rxy) {
+ Common::SeekableReadStream *dataRXY = 0;
+ if (!rxy.empty())
+ dataRXY = _vm->_dataIO->getFile(rxy);
+
+ if (dataRXY)
+ loadRXY(*dataRXY);
+ else
+ createRXY();
+
+ _height = _coordinates->getHeight();
+
+ delete dataRXY;
+}
+
+void CMPFile::loadCMP(Common::SeekableReadStream &cmp) {
+ uint32 size = cmp.size();
+ byte *data = new byte[size];
+
+ if (cmp.read(data, size) != size)
+ return;
+
+ _vm->_video->drawPackedSprite(data, _surface->getWidth(), _surface->getHeight(), 0, 0, 0, *_surface);
+
+ delete[] data;
+}
+
+void CMPFile::loadRXY(Common::SeekableReadStream &rxy) {
+ bool bigEndian = (_vm->getEndiannessMethod() == kEndiannessMethodBE) ||
+ ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) &&
+ (_vm->getEndianness() == kEndiannessBE));
+
+ Common::SeekableSubReadStreamEndian sub(&rxy, 0, rxy.size(), bigEndian, DisposeAfterUse::NO);
+
+ _coordinates = new RXYFile(sub);
+
+ for (uint i = 0; i < _coordinates->size(); i++) {
+ const RXYFile::Coordinates &c = (*_coordinates)[i];
+
+ if (c.left == 0xFFFF)
+ continue;
+
+ const uint16 width = c.right - c.left + 1;
+ const uint16 height = c.bottom - c.top + 1;
+
+ _maxWidth = MAX(_maxWidth , width);
+ _maxHeight = MAX(_maxHeight, height);
+ }
+}
+
+void CMPFile::createRXY() {
+ _coordinates = new RXYFile(_width, _height);
+
+ _maxWidth = _width;
+ _maxHeight = _height;
+}
+
+void CMPFile::createSurface() {
+ if (_width == 0)
+ _width = 320;
+ if (_height == 0)
+ _height = 200;
+
+ _surface = new Surface(_width, _height, _bpp);
+}
+
+bool CMPFile::getCoordinates(uint16 sprite, uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) const {
+ if (empty() || (sprite >= _coordinates->size()))
+ return false;
+
+ left = (*_coordinates)[sprite].left;
+ top = (*_coordinates)[sprite].top;
+ right = (*_coordinates)[sprite].right;
+ bottom = (*_coordinates)[sprite].bottom;
+
+ return left != 0xFFFF;
+}
+
+uint16 CMPFile::getWidth(uint16 sprite) const {
+ if (empty() || (sprite >= _coordinates->size()))
+ return 0;
+
+ return (*_coordinates)[sprite].right - (*_coordinates)[sprite].left + 1;
+}
+
+uint16 CMPFile::getHeight(uint16 sprite) const {
+ if (empty() || (sprite >= _coordinates->size()))
+ return 0;
+
+ return (*_coordinates)[sprite].bottom - (*_coordinates)[sprite].top + 1;
+}
+
+void CMPFile::getMaxSize(uint16 &width, uint16 &height) const {
+ width = _maxWidth;
+ height = _maxHeight;
+}
+
+void CMPFile::draw(Surface &dest, uint16 sprite, uint16 x, uint16 y, int32 transp) const {
+ if (empty())
+ return;
+
+ if (sprite >= _coordinates->size())
+ return;
+
+ const RXYFile::Coordinates &coords = (*_coordinates)[sprite];
+
+ draw(dest, coords.left, coords.top, coords.right, coords.bottom, x, y, transp);
+}
+
+void CMPFile::draw(Surface &dest, uint16 left, uint16 top, uint16 right, uint16 bottom,
+ uint16 x, uint16 y, int32 transp) const {
+
+ if (!_surface)
+ return;
+
+ if (left == 0xFFFF)
+ return;
+
+ dest.blit(*_surface, left, top, right, bottom, x, y, transp);
+}
+
+uint16 CMPFile::addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom) {
+ if (empty())
+ return 0;
+
+ const uint16 height = bottom - top + 1;
+ const uint16 width = right - left + 1;
+
+ _maxWidth = MAX(_maxWidth , width);
+ _maxHeight = MAX(_maxHeight, height);
+
+ return _coordinates->add(left, top, right, bottom);
+}
+
+void CMPFile::recolor(uint8 from, uint8 to) {
+ if (_surface)
+ _surface->recolor(from, to);
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/cmpfile.h b/engines/gob/cmpfile.h
new file mode 100644
index 0000000000..9c858238af
--- /dev/null
+++ b/engines/gob/cmpfile.h
@@ -0,0 +1,100 @@
+/* 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_CMPFILE_H
+#define GOB_CMPFILE_H
+
+#include "common/system.h"
+#include "common/array.h"
+
+namespace Common {
+ class String;
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+class GobEngine;
+class Surface;
+class RXYFile;
+
+/** A CMP file, containing a sprite.
+ *
+ * Used in hardcoded "actiony" parts of gob games.
+ */
+class CMPFile {
+public:
+ CMPFile(GobEngine *vm, const Common::String &baseName,
+ uint16 width, uint16 height, uint8 bpp = 1);
+ CMPFile(GobEngine *vm, const Common::String &cmpFile, const Common::String &rxyFile,
+ uint16 width, uint16 height, uint8 bpp = 1);
+ CMPFile(GobEngine *vm, Common::SeekableReadStream &cmp, Common::SeekableReadStream &rxy,
+ uint16 width, uint16 height, uint8 bpp = 1);
+ CMPFile(GobEngine *vm, Common::SeekableReadStream &cmp,
+ uint16 width, uint16 height, uint8 bpp = 1);
+ ~CMPFile();
+
+ bool empty() const;
+
+ uint16 getSpriteCount() const;
+
+ bool getCoordinates(uint16 sprite, uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) const;
+
+ uint16 getWidth (uint16 sprite) const;
+ uint16 getHeight(uint16 sprite) const;
+
+ void getMaxSize(uint16 &width, uint16 &height) const;
+
+ void draw(Surface &dest, uint16 sprite, uint16 x, uint16 y, int32 transp = -1) const;
+ void draw(Surface &dest, uint16 left, uint16 top, uint16 right, uint16 bottom,
+ uint16 x, uint16 y, int32 transp = -1) const;
+
+ uint16 addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom);
+
+ void recolor(uint8 from, uint8 to);
+
+private:
+ GobEngine *_vm;
+
+ uint16 _width;
+ uint16 _height;
+ uint16 _bpp;
+
+ uint16 _maxWidth;
+ uint16 _maxHeight;
+
+ Surface *_surface;
+ RXYFile *_coordinates;
+
+ void loadCMP(const Common::String &cmp);
+ void loadRXY(const Common::String &rxy);
+
+ void loadCMP(Common::SeekableReadStream &cmp);
+ void loadRXY(Common::SeekableReadStream &rxy);
+
+ void createRXY();
+ void createSurface();
+};
+
+} // End of namespace Gob
+
+#endif // GOB_CMPFILE_H
diff --git a/engines/gob/decfile.cpp b/engines/gob/decfile.cpp
index f5910f0654..85b4c09ca3 100644
--- a/engines/gob/decfile.cpp
+++ b/engines/gob/decfile.cpp
@@ -29,54 +29,54 @@
#include "gob/dataio.h"
#include "gob/surface.h"
#include "gob/video.h"
-#include "gob/rxyfile.h"
+#include "gob/cmpfile.h"
#include "gob/decfile.h"
namespace Gob {
-DECFile::Layer::Layer() : surface(0), coordinates(0) {
-}
-
-DECFile::Layer::~Layer() {
- delete coordinates;
- delete surface;
-}
-
-
DECFile::DECFile(GobEngine *vm, const Common::String &fileName,
uint16 width, uint16 height, uint8 bpp) : _vm(vm),
- _width(width), _height(height), _bpp(bpp), _hasPadding(false) {
+ _width(width), _height(height), _bpp(bpp), _hasPadding(false), _backdrop(0) {
- _backdrop = new Surface(_width, _height, _bpp);
+ bool bigEndian = false;
+ Common::String endianFileName = fileName;
- Common::SeekableReadStream *dec = _vm->_dataIO->getFile(fileName);
- if (dec) {
- Common::SeekableSubReadStreamEndian sub(dec, 0, dec->size(), false, DisposeAfterUse::YES);
+ if ((_vm->getEndiannessMethod() == kEndiannessMethodAltFile) &&
+ !_vm->_dataIO->hasFile(fileName)) {
+ // If the game has alternate big-endian files, look if one exist
- load(sub, fileName);
- return;
- }
+ Common::String alternateFileName = fileName;
+ alternateFileName.setChar('_', 0);
- // File doesn't exist, try to open the big-endian'd alternate file
- Common::String alternateFileName = fileName;
- alternateFileName.setChar('_', 0);
+ if (_vm->_dataIO->hasFile(alternateFileName)) {
+ bigEndian = true;
+ endianFileName = alternateFileName;
+ }
+ } else if ((_vm->getEndiannessMethod() == kEndiannessMethodBE) ||
+ ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) &&
+ (_vm->getEndianness() == kEndiannessBE)))
+ // Game always little endian or it follows the system and it is big endian
+ bigEndian = true;
- dec = _vm->_dataIO->getFile(alternateFileName);
- if (dec) {
- Common::SeekableSubReadStreamEndian sub(dec, 0, dec->size(), true, DisposeAfterUse::YES);
+ Common::SeekableReadStream *ani = _vm->_dataIO->getFile(endianFileName);
+ if (ani) {
+ Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), bigEndian, DisposeAfterUse::YES);
// The big endian version pads a few fields to even size
- _hasPadding = true;
+ _hasPadding = bigEndian;
load(sub, fileName);
return;
}
- warning("DECFile::DECFile(): No such file \"%s\"", fileName.c_str());
+ warning("DECFile::DECFile(): No such file \"%s\" (\"%s\")", endianFileName.c_str(), fileName.c_str());
}
DECFile::~DECFile() {
delete _backdrop;
+
+ for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
+ delete *l;
}
void DECFile::load(Common::SeekableSubReadStreamEndian &dec, const Common::String &fileName) {
@@ -102,9 +102,9 @@ void DECFile::load(Common::SeekableSubReadStreamEndian &dec, const Common::Strin
}
// Load the layers
- _layers.resize(MAX(0, layerCount - 1));
- for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
- loadLayer(*l, dec);
+ _layers.reserve(MAX(0, layerCount - 1));
+ for (int i = 0; i < layerCount - 1; i++)
+ _layers.push_back(loadLayer(dec));
// Load the backdrop parts
if (backdropCount > 0)
@@ -113,43 +113,19 @@ void DECFile::load(Common::SeekableSubReadStreamEndian &dec, const Common::Strin
void DECFile::loadBackdrop(Common::SeekableSubReadStreamEndian &dec) {
// Interestingly, DEC files reference "FOO.LBM" instead of "FOO.CMP"
- Common::String file = Util::setExtension(Util::readString(dec, 13), ".CMP");
+ Common::String file = Util::setExtension(Util::readString(dec, 13), "");
if (_hasPadding)
dec.skip(1);
- if (file.empty() || !_vm->_dataIO->hasFile(file))
- return;
-
- _vm->_video->drawPackedSprite(file.c_str(), *_backdrop);
+ _backdrop = new CMPFile(_vm, file, _width, _height, _bpp);
}
-void DECFile::loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &dec) {
- Common::String file = Util::readString(dec, 13);
+CMPFile *DECFile::loadLayer(Common::SeekableSubReadStreamEndian &dec) {
+ Common::String file = Util::setExtension(Util::readString(dec, 13), "");
if (_hasPadding)
dec.skip(1);
- if (file.empty())
- return;
-
- Common::String fileRXY = Util::setExtension(file, ".RXY");
- Common::String fileCMP = Util::setExtension(file, ".CMP");
- if (!_vm->_dataIO->hasFile(fileRXY) || !_vm->_dataIO->hasFile(fileCMP))
- return;
-
- loadLayer(layer, fileRXY, fileCMP);
-}
-
-void DECFile::loadLayer(Layer &layer, const Common::String &fileRXY,
- const Common::String &fileCMP) {
-
- Common::SeekableReadStream *dataRXY = _vm->_dataIO->getFile(fileRXY);
- if (!dataRXY)
- return;
-
- layer.coordinates = new RXYFile(*dataRXY);
- layer.surface = new Surface(_width, layer.coordinates->getHeight(), _bpp);
-
- _vm->_video->drawPackedSprite(fileCMP.c_str(), *layer.surface);
+ return new CMPFile(_vm, file, _width, _height, _bpp);
}
void DECFile::loadParts(Common::SeekableSubReadStreamEndian &dec) {
@@ -188,7 +164,10 @@ void DECFile::draw(Surface &dest) const {
}
void DECFile::drawBackdrop(Surface &dest) const {
- dest.blit(*_backdrop);
+ if (!_backdrop)
+ return;
+
+ _backdrop->draw(dest, 0, 0, 0);
}
void DECFile::drawLayer(Surface &dest, uint16 layer, uint16 part,
@@ -197,18 +176,7 @@ void DECFile::drawLayer(Surface &dest, uint16 layer, uint16 part,
if (layer >= _layers.size())
return;
- const Layer &l = _layers[layer];
- if (!l.surface || !l.coordinates)
- return;
-
- if (part >= l.coordinates->size())
- return;
-
- const RXYFile::Coordinates &c = (*l.coordinates)[part];
- if (c.left == 0xFFFF)
- return;
-
- dest.blit(*l.surface, c.left, c.top, c.right, c.bottom, x, y, transp);
+ _layers[layer]->draw(dest, part, x, y, transp);
}
} // End of namespace Gob
diff --git a/engines/gob/decfile.h b/engines/gob/decfile.h
index 31d90180d3..48af740d41 100644
--- a/engines/gob/decfile.h
+++ b/engines/gob/decfile.h
@@ -34,7 +34,7 @@ namespace Gob {
class GobEngine;
class Surface;
-class RXYFile;
+class CMPFile;
/** A DEC file, describing a "decal" (background).
*
@@ -60,14 +60,6 @@ public:
uint16 x, uint16 y, int32 transp = -1) const;
private:
- struct Layer {
- Surface *surface; ///< The surface containing the layer sprite.
- RXYFile *coordinates; ///< The coordinates describing the layer sprite parts.
-
- Layer();
- ~Layer();
- };
-
struct Part {
uint8 layer;
uint8 part;
@@ -77,8 +69,8 @@ private:
bool transp;
};
- typedef Common::Array<Layer> LayerArray;
- typedef Common::Array<Part> PartArray;
+ typedef Common::Array<CMPFile *> LayerArray;
+ typedef Common::Array<Part> PartArray;
GobEngine *_vm;
@@ -88,7 +80,7 @@ private:
byte _hasPadding;
- Surface *_backdrop;
+ CMPFile *_backdrop;
LayerArray _layers;
PartArray _parts;
@@ -98,9 +90,7 @@ private:
void loadBackdrop(Common::SeekableSubReadStreamEndian &dec);
- void loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &dec);
- void loadLayer(Layer &layer, const Common::String &fileRXY,
- const Common::String &fileCMP);
+ CMPFile *loadLayer(Common::SeekableSubReadStreamEndian &dec);
void loadParts(Common::SeekableSubReadStreamEndian &dec);
void loadPart(Part &part, Common::SeekableSubReadStreamEndian &dec);
diff --git a/engines/gob/detection/detection.cpp b/engines/gob/detection/detection.cpp
new file mode 100644
index 0000000000..8fb0052a5b
--- /dev/null
+++ b/engines/gob/detection/detection.cpp
@@ -0,0 +1,220 @@
+/* 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 "base/plugins.h"
+#include "engines/advancedDetector.h"
+#include "engines/obsolete.h"
+
+#include "gob/gob.h"
+#include "gob/dataio.h"
+
+#include "gob/detection/tables.h"
+
+class GobMetaEngine : public AdvancedMetaEngine {
+public:
+ GobMetaEngine();
+
+ virtual GameDescriptor findGame(const char *gameid) const;
+
+ virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const;
+
+ virtual const char *getName() const;
+ virtual const char *getOriginalCopyright() const;
+
+ virtual bool hasFeature(MetaEngineFeature f) const;
+
+ virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+
+private:
+ /**
+ * Inspect the game archives to detect which Once Upon A Time game this is.
+ */
+ static const Gob::GOBGameDescription *detectOnceUponATime(const Common::FSList &fslist);
+};
+
+GobMetaEngine::GobMetaEngine() :
+ AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) {
+
+ _singleid = "gob";
+ _guioptions = GUIO1(GUIO_NOLAUNCHLOAD);
+}
+
+GameDescriptor GobMetaEngine::findGame(const char *gameid) const {
+ return Engines::findGameID(gameid, _gameids, obsoleteGameIDsTable);
+}
+
+const ADGameDescription *GobMetaEngine::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
+ ADFilePropertiesMap filesProps;
+
+ const Gob::GOBGameDescription *game;
+ game = (const Gob::GOBGameDescription *)detectGameFilebased(allFiles, fslist, Gob::fileBased, &filesProps);
+ if (!game)
+ return 0;
+
+ if (game->gameType == Gob::kGameTypeOnceUponATime) {
+ game = detectOnceUponATime(fslist);
+ if (!game)
+ return 0;
+ }
+
+ reportUnknown(fslist.begin()->getParent(), filesProps);
+ return (const ADGameDescription *)game;
+}
+
+const Gob::GOBGameDescription *GobMetaEngine::detectOnceUponATime(const Common::FSList &fslist) {
+ // Add the game path to the search manager
+ SearchMan.clear();
+ SearchMan.addDirectory(fslist.begin()->getParent().getPath(), fslist.begin()->getParent());
+
+ // Open the archives
+ Gob::DataIO dataIO;
+ if (!dataIO.openArchive("stk1.stk", true) ||
+ !dataIO.openArchive("stk2.stk", true) ||
+ !dataIO.openArchive("stk3.stk", true)) {
+
+ SearchMan.clear();
+ return 0;
+ }
+
+ Gob::OnceUponATime gameType = Gob::kOnceUponATimeInvalid;
+ Gob::OnceUponATimePlatform platform = Gob::kOnceUponATimePlatformInvalid;
+
+ // If these animal files are present, it's Abracadabra
+ if (dataIO.hasFile("arai.anm") &&
+ dataIO.hasFile("crab.anm") &&
+ dataIO.hasFile("crap.anm") &&
+ dataIO.hasFile("drag.anm") &&
+ dataIO.hasFile("guep.anm") &&
+ dataIO.hasFile("loup.anm") &&
+ dataIO.hasFile("mous.anm") &&
+ dataIO.hasFile("rhin.anm") &&
+ dataIO.hasFile("saut.anm") &&
+ dataIO.hasFile("scor.anm"))
+ gameType = Gob::kOnceUponATimeAbracadabra;
+
+ // If these animal files are present, it's Baba Yaga
+ if (dataIO.hasFile("abei.anm") &&
+ dataIO.hasFile("arai.anm") &&
+ dataIO.hasFile("drag.anm") &&
+ dataIO.hasFile("fauc.anm") &&
+ dataIO.hasFile("gren.anm") &&
+ dataIO.hasFile("rena.anm") &&
+ dataIO.hasFile("sang.anm") &&
+ dataIO.hasFile("serp.anm") &&
+ dataIO.hasFile("tort.anm") &&
+ dataIO.hasFile("vaut.anm"))
+ gameType = Gob::kOnceUponATimeBabaYaga;
+
+ // Detect the platform by endianness and existence of a MOD file
+ Common::SeekableReadStream *villeDEC = dataIO.getFile("ville.dec");
+ if (villeDEC && (villeDEC->size() > 6)) {
+ byte data[6];
+
+ if (villeDEC->read(data, 6) == 6) {
+ if (!memcmp(data, "\000\000\000\001\000\007", 6)) {
+ // Big endian -> Amiga or Atari ST
+
+ if (dataIO.hasFile("mod.babayaga"))
+ platform = Gob::kOnceUponATimePlatformAmiga;
+ else
+ platform = Gob::kOnceUponATimePlatformAtariST;
+
+ } else if (!memcmp(data, "\000\000\001\000\007\000", 6))
+ // Little endian -> DOS
+ platform = Gob::kOnceUponATimePlatformDOS;
+ }
+
+ delete villeDEC;
+ }
+
+ SearchMan.clear();
+
+ if ((gameType == Gob::kOnceUponATimeInvalid) || (platform == Gob::kOnceUponATimePlatformInvalid)) {
+ warning("GobMetaEngine::detectOnceUponATime(): Detection failed (%d, %d)",
+ (int) gameType, (int) platform);
+ return 0;
+ }
+
+ return &Gob::fallbackOnceUpon[gameType][platform];
+}
+
+const char *GobMetaEngine::getName() const {
+ return "Gob";
+}
+
+const char *GobMetaEngine::getOriginalCopyright() const {
+ return "Goblins Games (C) Coktel Vision";
+}
+
+bool GobMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return false;
+}
+
+bool Gob::GobEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL);
+}
+
+Common::Error GobMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
+ Engines::upgradeTargetIfNecessary(obsoleteGameIDsTable);
+ return AdvancedMetaEngine::createInstance(syst, engine);
+}
+
+bool GobMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ const Gob::GOBGameDescription *gd = (const Gob::GOBGameDescription *)desc;
+ if (gd) {
+ *engine = new Gob::GobEngine(syst);
+ ((Gob::GobEngine *)*engine)->initGame(gd);
+ }
+ return gd != 0;
+}
+
+
+#if PLUGIN_ENABLED_DYNAMIC(GOB)
+ REGISTER_PLUGIN_DYNAMIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine);
+#else
+ REGISTER_PLUGIN_STATIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine);
+#endif
+
+namespace Gob {
+
+void GobEngine::initGame(const GOBGameDescription *gd) {
+ if (gd->startTotBase == 0)
+ _startTot = "intro.tot";
+ else
+ _startTot = gd->startTotBase;
+
+ if (gd->startStkBase == 0)
+ _startStk = "intro.stk";
+ else
+ _startStk = gd->startStkBase;
+
+ _demoIndex = gd->demoIndex;
+
+ _gameType = gd->gameType;
+ _features = gd->features;
+ _language = gd->desc.language;
+ _platform = gd->desc.platform;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/detection.cpp b/engines/gob/detection/tables.h
index 17a2ae3da8..271f75af79 100644
--- a/engines/gob/detection.cpp
+++ b/engines/gob/detection/tables.h
@@ -20,11 +20,8 @@
*
*/
-#include "base/plugins.h"
-#include "engines/advancedDetector.h"
-#include "engines/obsolete.h"
-
-#include "gob/gob.h"
+#ifndef GOB_DETECTION_TABLES_H
+#define GOB_DETECTION_TABLES_H
namespace Gob {
@@ -42,6 +39,7 @@ struct GOBGameDescription {
using namespace Common;
+// Game IDs and proper names
static const PlainGameDescriptor gobGames[] = {
{"gob", "Gob engine game"},
{"gob1", "Gobliiins"},
@@ -50,8 +48,11 @@ static const PlainGameDescriptor gobGames[] = {
{"gob2cd", "Gobliins 2 CD"},
{"ween", "Ween: The Prophecy"},
{"bargon", "Bargon Attack"},
- {"littlered", "Little Red Riding Hood"},
- {"ajworld", "A.J's World of Discovery"},
+ {"babayaga", "Once Upon A Time: Baba Yaga"},
+ {"abracadabra", "Once Upon A Time: Abracadabra"},
+ {"littlered", "Once Upon A Time: Little Red Riding Hood"},
+ {"onceupon", "Once Upon A Time"},
+ {"ajworld", "A.J.'s World of Discovery"},
{"gob3", "Goblins Quest 3"},
{"gob3cd", "Goblins Quest 3 CD"},
{"lit1", "Lost in Time Part 1"},
@@ -79,87 +80,42 @@ static const PlainGameDescriptor gobGames[] = {
{0, 0}
};
+// Obsolete IDs we don't want anymore
static const Engines::ObsoleteGameID obsoleteGameIDsTable[] = {
{"gob1", "gob", kPlatformUnknown},
{"gob2", "gob", kPlatformUnknown},
{0, 0, kPlatformUnknown}
};
-#include "gob/detection_tables.h"
-
-class GobMetaEngine : public AdvancedMetaEngine {
-public:
- GobMetaEngine() : AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) {
- _singleid = "gob";
- _guioptions = GUIO1(GUIO_NOLAUNCHLOAD);
- }
-
- virtual GameDescriptor findGame(const char *gameid) const {
- return Engines::findGameID(gameid, _gameids, obsoleteGameIDsTable);
- }
-
- virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
- return detectGameFilebased(allFiles, Gob::fileBased);
- }
-
- virtual const char *getName() const {
- return "Gob";
- }
-
- virtual const char *getOriginalCopyright() const {
- return "Goblins Games (C) Coktel Vision";
- }
-
- virtual bool hasFeature(MetaEngineFeature f) const;
+namespace Gob {
- virtual Common::Error createInstance(OSystem *syst, Engine **engine) const {
- Engines::upgradeTargetIfNecessary(obsoleteGameIDsTable);
- return AdvancedMetaEngine::createInstance(syst, engine);
- }
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+// Detection tables
+static const GOBGameDescription gameDescriptions[] = {
+ #include "gob/detection/tables_gob1.h" // Gobliiins
+ #include "gob/detection/tables_gob2.h" // Gobliins 2: The Prince Buffoon
+ #include "gob/detection/tables_gob3.h" // Goblins 3 / Goblins Quest 3
+ #include "gob/detection/tables_ween.h" // Ween: The Prophecy
+ #include "gob/detection/tables_bargon.h" // Bargon Attack
+ #include "gob/detection/tables_littlered.h" // Once Upon A Time: Little Red Riding Hood
+ #include "gob/detection/tables_onceupon.h" // Once Upon A Time: Baba Yaga and Abracadabra
+ #include "gob/detection/tables_lit.h" // Lost in Time
+ #include "gob/detection/tables_fascin.h" // Fascination
+ #include "gob/detection/tables_geisha.h" // Geisha
+ #include "gob/detection/tables_inca2.h" // Inca II: Wiracocha
+ #include "gob/detection/tables_woodruff.h" // (The Bizarre Adventures of) Woodruff and the Schnibble (of Azimuth)
+ #include "gob/detection/tables_dynasty.h" // The Last Dynasty
+ #include "gob/detection/tables_urban.h" // Urban Runner
+ #include "gob/detection/tables_playtoons.h" // The Playtoons series
+ #include "gob/detection/tables_adi2.h" // The ADI / Addy 2 series
+ #include "gob/detection/tables_adi4.h" // The ADI / Addy 4 series
+ #include "gob/detection/tables_adibou.h" // The Adibou / Addy Junior series
+ #include "gob/detection/tables_ajworld.h" // A.J.'s World of Discovery / ADI Jr.
+
+ { AD_TABLE_END_MARKER, kGameTypeNone, kFeaturesNone, 0, 0, 0}
};
-bool GobMetaEngine::hasFeature(MetaEngineFeature f) const {
- return false;
-}
-
-bool Gob::GobEngine::hasFeature(EngineFeature f) const {
- return
- (f == kSupportsRTL);
-}
-bool GobMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- const Gob::GOBGameDescription *gd = (const Gob::GOBGameDescription *)desc;
- if (gd) {
- *engine = new Gob::GobEngine(syst);
- ((Gob::GobEngine *)*engine)->initGame(gd);
- }
- return gd != 0;
+// File-based fallback tables
+#include "gob/detection/tables_fallback.h"
}
-#if PLUGIN_ENABLED_DYNAMIC(GOB)
- REGISTER_PLUGIN_DYNAMIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine);
-#else
- REGISTER_PLUGIN_STATIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine);
-#endif
-
-namespace Gob {
-
-void GobEngine::initGame(const GOBGameDescription *gd) {
- if (gd->startTotBase == 0)
- _startTot = "intro.tot";
- else
- _startTot = gd->startTotBase;
-
- if (gd->startStkBase == 0)
- _startStk = "intro.stk";
- else
- _startStk = gd->startStkBase;
-
- _demoIndex = gd->demoIndex;
-
- _gameType = gd->gameType;
- _features = gd->features;
- _language = gd->desc.language;
- _platform = gd->desc.platform;
-}
-} // End of namespace Gob
+#endif // GOB_DETECTION_TABLES_H
diff --git a/engines/gob/detection/tables_adi2.h b/engines/gob/detection/tables_adi2.h
new file mode 100644
index 0000000000..da05a31f40
--- /dev/null
+++ b/engines/gob/detection/tables_adi2.h
@@ -0,0 +1,203 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for the ADI / Addy 2 series. */
+
+#ifndef GOB_DETECTION_TABLES_ADI2_H
+#define GOB_DETECTION_TABLES_ADI2_H
+
+// -- French: Adi --
+
+{
+ {
+ "adi2",
+ "Adi 2.0 for Teachers",
+ AD_ENTRY1s("adi2.stk", "da6f1fb68bff32260c5eecdf9286a2f5", 1533168),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdi2,
+ kFeaturesNone,
+ "adi2.stk", "ediintro.tot", 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1. Exact version not specified.
+ {
+ "adi2",
+ "Adi 2",
+ AD_ENTRY1s("adi2.stk", "23f279615c736dc38320f1348e70c36e", 10817668),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+{ // Found in french ADI 2 Francais-Maths CE2. Exact version not specified.
+ {
+ "adi2",
+ "Adi 2",
+ AD_ENTRY1s("adi2.stk", "d4162c4298f9423ecc1fb04965557e90", 11531214),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+{
+ {
+ "adi2",
+ "Adi 2.5",
+ AD_ENTRY1s("adi2.stk", "fcac60e6627f37aee219575b60859de9", 16944268),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+{
+ {
+ "adi2",
+ "Adi 2.5",
+ AD_ENTRY1s("adi2.stk", "072d5e2d7826a7c055865568ebf918bb", 16934596),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+{
+ {
+ "adi2",
+ "Adi 2.6",
+ AD_ENTRY1s("adi2.stk", "2fb940eb8105b12871f6b88c8c4d1615", 16780058),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+
+// -- German: Addy --
+
+{
+ {
+ "adi2",
+ "Adi 2.6",
+ AD_ENTRY1s("adi2.stk", "fde7d98a67dbf859423b6473796e932a", 18044780),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+{
+ {
+ "adi2",
+ "Adi 2.7.1",
+ AD_ENTRY1s("adi2.stk", "6fa5dffebf5c7243c6af6b8c188ee00a", 19278008),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+
+// -- Spanish: Adi --
+
+{
+ {
+ "adi2",
+ "Adi 2",
+ AD_ENTRY1s("adi2.stk", "2a40bb48ccbd4e6fb3f7f0fc2f069d80", 17720132),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", "ediintro.tot", 0
+},
+
+// -- English: ADI (Amiga) --
+
+{
+ {
+ "adi2",
+ "Adi 2",
+ AD_ENTRY1s("adi2.stk", "29694c5a649298a42f87ae731d6d6f6d", 311132),
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdi2,
+ kFeaturesNone,
+ "adi2.stk", "ediintro.tot", 0
+},
+
+// -- Demos --
+
+{
+ {
+ "adi2",
+ "Non-Interactive Demo",
+ {
+ {"demo.scn", 0, "8b5ba359fd87d586ad39c1754bf6ea35", 168},
+ {"demadi2t.vmd", 0, "08a1b18cfe2015d3b43270da35cc813d", 7250723},
+ {"demarch.vmd", 0, "4c4a4616585d40ef3df209e3c3911062", 5622731},
+ {"demobou.vmd", 0, "2208b9855775564d15c4a5a559da0aec", 3550511},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 1
+},
+
+#endif // GOB_DETECTION_TABLES_ADI2_H
diff --git a/engines/gob/detection/tables_adi4.h b/engines/gob/detection/tables_adi4.h
new file mode 100644
index 0000000000..4b967d76d3
--- /dev/null
+++ b/engines/gob/detection/tables_adi4.h
@@ -0,0 +1,222 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for the ADI / Addy 4 series. */
+
+#ifndef GOB_DETECTION_TABLES_ADI4_H
+#define GOB_DETECTION_TABLES_ADI4_H
+
+// -- French: Adi --
+
+{
+ {
+ "adi4",
+ "Adi 4.0",
+ AD_ENTRY1s("intro.stk", "a3c35d19b2d28ea261d96321d208cb5a", 6021466),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "Adi 4.0",
+ AD_ENTRY1s("intro.stk", "44491d85648810bc6fcf84f9b3aa47d5", 5834944),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "Adi 4.0",
+ AD_ENTRY1s("intro.stk", "29374c0e3c10b17dd8463b06a55ad093", 6012072),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "Adi 4.0 Limited Edition",
+ AD_ENTRY1s("intro.stk", "ebbbc5e28a4adb695535ed989c1b8d66", 5929644),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "ADI 4.10",
+ AD_ENTRY1s("intro.stk", "6afc2590856433b9f5295b032f2b205d", 5923112),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "ADI 4.11",
+ AD_ENTRY1s("intro.stk", "6296e4be4e0c270c24d1330881900c7f", 5921234),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "ADI 4.21",
+ AD_ENTRY1s("intro.stk", "c5b9f6222c0b463f51dab47317c5b687", 5950490),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+
+// -- German: Addy --
+
+{
+ {
+ "adi4",
+ "Addy 4 Grundschule Basis CD",
+ AD_ENTRY1s("intro.stk", "d2f0fb8909e396328dc85c0e29131ba8", 5847588),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "Addy 4 Sekundarstufe Basis CD",
+ AD_ENTRY1s("intro.stk", "367340e59c461b4fa36651cd74e32c4e", 5847378),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "Addy 4.21",
+ AD_ENTRY1s("intro.stk", "534f0b674cd4830df94a9c32c4ea7225", 6878034),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+
+// -- English: ADI --
+
+{
+ {
+ "adi4",
+ "ADI 4.10",
+ AD_ENTRY1s("intro.stk", "3e3fa9656e37d802027635ace88c4cc5", 5359144),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "adi4",
+ "Adi 4.0 Interactive Demo",
+ AD_ENTRY1s("intro.stk", "89ace204dbaac001425c73f394334f6f", 2413102),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "adi4",
+ "Adi 4.0 / Adibou 2 Demo",
+ AD_ENTRY1s("intro.stk", "d41d8cd98f00b204e9800998ecf8427e", 0),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_ADI4_H
diff --git a/engines/gob/detection/tables_adibou.h b/engines/gob/detection/tables_adibou.h
new file mode 100644
index 0000000000..0e652839bb
--- /dev/null
+++ b/engines/gob/detection/tables_adibou.h
@@ -0,0 +1,247 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Adibou / Addy Junior series. */
+
+#ifndef GOB_DETECTION_TABLES_ADIBOU_H
+#define GOB_DETECTION_TABLES_ADIBOU_H
+
+// -- French: Adibou --
+
+{
+ {
+ "adibou1",
+ "ADIBOU 1 Environnement 4-7 ans",
+ AD_ENTRY1s("intro.stk", "6db110188fcb7c5208d9721b5282682a", 4805104),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAdibou1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOU 2",
+ AD_ENTRY1s("intro.stk", "94ae7004348dc8bf99c23a9a6ef81827", 956162),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "Le Jardin Magique d'Adibou",
+ AD_ENTRY1s("intro.stk", "a8ff86f3cc40dfe5898e0a741217ef27", 956328),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOU Version Decouverte",
+ AD_ENTRY1s("intro.stk", "558c14327b79ed39214b49d567a75e33", 8737856),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOU 2.10 Environnement",
+ AD_ENTRY1s("intro.stk", "f2b797819aeedee557e904b0b5ccd82e", 8736454),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOU 2.11 Environnement",
+ AD_ENTRY1s("intro.stk", "7b1f1f6f6477f54401e95d913f75e333", 8736904),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOU 2.12 Environnement",
+ AD_ENTRY1s("intro.stk", "1e49c39a4a3ce6032a84b712539c2d63", 8738134),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOU 2.13s Environnement",
+ AD_ENTRY1s("intro.stk", "092707829555f27706920e4cacf1fada", 8737958),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "adibou2",
+ "ADIBOO 2.14 Environnement",
+ AD_ENTRY1s("intro.stk", "ff63637e3cb7f0a457edf79457b1c6b3", 9333874),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- German: Addy Junior --
+
+{
+ {
+ "adibou2",
+ "ADIBOU 2",
+ AD_ENTRY1s("intro.stk", "092707829555f27706920e4cacf1fada", 8737958),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Italian: Adibù --
+{
+ {
+ "adibou2",
+ "ADIB\xD9 2",
+ AD_ENTRY1s("intro.stk", "092707829555f27706920e4cacf1fada", 8737958),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeAdibou2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "adibou2",
+ "Non-Interactive Demo",
+ {
+ {"demogb.scn", 0, "9291455a908ac0e6aaaca686e532609b", 105},
+ {"demogb.vmd", 0, "bc9c1db97db7bec8f566332444fa0090", 14320840},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeAdibou2,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 9
+},
+{
+ {
+ "adibou2",
+ "Non-Interactive Demo",
+ {
+ {"demoall.scn", 0, "c8fd308c037b829800006332b2c32674", 106},
+ {"demoall.vmd", 0, "4672b2deacc6fca97484840424b1921b", 14263433},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeAdibou2,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 10
+},
+{
+ {
+ "adibou2",
+ "Non-Interactive Demo",
+ {
+ {"demofra.scn", 0, "d1b2b1618af384ea1120def8b986c02b", 106},
+ {"demofra.vmd", 0, "b494cdec1aac7e54c3f2480512d2880e", 14297100},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeAdibou2,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 11
+},
+
+#endif // GOB_DETECTION_TABLES_ADIBOU_H
diff --git a/engines/gob/detection/tables_ajworld.h b/engines/gob/detection/tables_ajworld.h
new file mode 100644
index 0000000000..d86bdb16be
--- /dev/null
+++ b/engines/gob/detection/tables_ajworld.h
@@ -0,0 +1,45 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for A.J.'s World of Discovery / ADI Jr. */
+
+#ifndef GOB_DETECTION_TABLES_AJWORLD_H
+#define GOB_DETECTION_TABLES_AJWORLD_H
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "ajworld",
+ "",
+ AD_ENTRY1s("intro.stk", "e453bea7b28a67c930764d945f64d898", 3913628),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAJWorld,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_AJWORLD_H
diff --git a/engines/gob/detection/tables_bargon.h b/engines/gob/detection/tables_bargon.h
new file mode 100644
index 0000000000..ac90355476
--- /dev/null
+++ b/engines/gob/detection/tables_bargon.h
@@ -0,0 +1,135 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Bargon Attack. */
+
+#ifndef GOB_DETECTION_TABLES_BARGON_H
+#define GOB_DETECTION_TABLES_BARGON_H
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "bargon",
+ "",
+ AD_ENTRY1("intro.stk", "da3c54be18ab73fbdb32db24624a9c23"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by cesardark in bug #1681649
+ {
+ "bargon",
+ "",
+ AD_ENTRY1s("intro.stk", "11103b304286c23945560b391fd37e7d", 3181890),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug #1692667
+ {
+ "bargon",
+ "",
+ AD_ENTRY1s("intro.stk", "da3c54be18ab73fbdb32db24624a9c23", 3181825),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by kizkoool in bugreport #2089734
+ {
+ "bargon",
+ "",
+ AD_ENTRY1s("intro.stk", "00f6b4e2ee26e5c40b488e2df5adcf03", 3975580),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by glorfindel in bugreport #1722142
+ {
+ "bargon",
+ "Fanmade",
+ AD_ENTRY1s("intro.stk", "da3c54be18ab73fbdb32db24624a9c23", 3181825),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Amiga --
+
+{ // Supplied by pwigren in bugreport #1764174
+ {
+ "bargon",
+ "",
+ AD_ENTRY1s("intro.stk", "569d679fe41d49972d34c9fce5930dda", 269825),
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Atari ST --
+
+{ // Supplied by Trekky in the forums
+ {
+ "bargon",
+ "",
+ AD_ENTRY1s("intro.stk", "2f54b330d21f65b04b7c1f8cca76426c", 262109),
+ FR_FRA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_BARGON_H
diff --git a/engines/gob/detection/tables_dynasty.h b/engines/gob/detection/tables_dynasty.h
new file mode 100644
index 0000000000..147bf32075
--- /dev/null
+++ b/engines/gob/detection/tables_dynasty.h
@@ -0,0 +1,146 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for The Last Dynasty. */
+
+#ifndef GOB_DETECTION_TABLES_DYNASTY_H
+#define GOB_DETECTION_TABLES_DYNASTY_H
+
+// -- Windows --
+
+{
+ {
+ "dynasty",
+ "",
+ AD_ENTRY1s("intro.stk", "6190e32404b672f4bbbc39cf76f41fda", 2511470),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "dynasty",
+ "",
+ AD_ENTRY1s("intro.stk", "61e4069c16e27775a6cc6d20f529fb36", 2511300),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "dynasty",
+ "",
+ AD_ENTRY1s("intro.stk", "61e4069c16e27775a6cc6d20f529fb36", 2511300),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "dynasty",
+ "",
+ AD_ENTRY1s("intro.stk", "b3f8472484b7a1df94557b51e7b6fca0", 2322644),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "dynasty",
+ "",
+ AD_ENTRY1s("intro.stk", "bdbdac8919200a5e71ffb9fb0709f704", 2446652),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "dynasty",
+ "Demo",
+ AD_ENTRY1s("intro.stk", "464538a17ed39755d7f1ba9c751af1bd", 1847864),
+ EN_USA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "dynasty",
+ "Demo",
+ AD_ENTRY1s("lda1.stk", "0e56a899357cbc0bf503260fd2dd634e", 15032774),
+ UNK_LANG,
+ kPlatformWindows,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ "lda1.stk", 0, 0
+},
+{
+ {
+ "dynasty",
+ "Demo",
+ AD_ENTRY1s("lda1.stk", "8669ea2e9a8239c070dc73958fbc8753", 15567724),
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeDynasty,
+ kFeatures640x480,
+ "lda1.stk", 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_DYNASTY_H
diff --git a/engines/gob/detection/tables_fallback.h b/engines/gob/detection/tables_fallback.h
new file mode 100644
index 0000000000..05f579c08c
--- /dev/null
+++ b/engines/gob/detection/tables_fallback.h
@@ -0,0 +1,564 @@
+/* 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_DETECTION_TABLES_FALLBACK_H
+#define GOB_DETECTION_TABLES_FALLBACK_H
+
+// -- Tables for the filename-based fallback --
+
+static const GOBGameDescription fallbackDescs[] = {
+ { //0
+ {
+ "gob1",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+ },
+ { //1
+ {
+ "gob1cd",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+ },
+ { //2
+ {
+ "gob2",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+ },
+ { //3
+ {
+ "gob2mac",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+ },
+ { //4
+ {
+ "gob2cd",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+ },
+ { //5
+ {
+ "bargon",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBargon,
+ kFeaturesNone,
+ 0, 0, 0
+ },
+ { //6
+ {
+ "gob3",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+ },
+ { //7
+ {
+ "gob3cd",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+ },
+ { //8
+ {
+ "woodruff",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //9
+ {
+ "lostintime",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+ },
+ { //10
+ {
+ "lostintime",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+ },
+ { //11
+ {
+ "lostintime",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+ },
+ { //12
+ {
+ "urban",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+ },
+ { //13
+ {
+ "playtoons1",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //14
+ {
+ "playtoons2",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //15
+ {
+ "playtoons3",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //16
+ {
+ "playtoons4",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //17
+ {
+ "playtoons5",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //18
+ {
+ "playtoons construction kit",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //19
+ {
+ "bambou",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeBambou,
+ kFeatures640x480,
+ 0, 0, 0
+ },
+ { //20
+ {
+ "fascination",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+ },
+ { //21
+ {
+ "geisha",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+ },
+ { //22
+ {
+ "littlered",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+ },
+ { //23
+ {
+ "littlered",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesNone,
+ 0, 0, 0
+ },
+ { //24
+ {
+ "onceupon",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformUnknown,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeOnceUponATime,
+ kFeaturesEGA,
+ 0, 0, 0
+ },
+ { //25
+ {
+ "adi2",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeAdi2,
+ kFeatures640x480,
+ "adi2.stk", 0, 0
+ },
+ { //26
+ {
+ "adi4",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeAdi4,
+ kFeatures640x480,
+ "adif41.stk", 0, 0
+ },
+ { //27
+ {
+ "coktelplayer",
+ "unknown",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeaturesAdLib | kFeatures640x480 | kFeaturesSCNDemo,
+ "", "", 8
+ }
+};
+
+static const ADFileBasedFallback fileBased[] = {
+ { &fallbackDescs[ 0].desc, { "intro.stk", "disk1.stk", "disk2.stk", "disk3.stk", "disk4.stk", 0 } },
+ { &fallbackDescs[ 1].desc, { "intro.stk", "gob.lic", 0 } },
+ { &fallbackDescs[ 2].desc, { "intro.stk", 0 } },
+ { &fallbackDescs[ 2].desc, { "intro.stk", "disk2.stk", "disk3.stk", 0 } },
+ { &fallbackDescs[ 3].desc, { "intro.stk", "disk2.stk", "disk3.stk", "musmac1.mid", 0 } },
+ { &fallbackDescs[ 4].desc, { "intro.stk", "gobnew.lic", 0 } },
+ { &fallbackDescs[ 5].desc, { "intro.stk", "scaa.imd", "scba.imd", "scbf.imd", 0 } },
+ { &fallbackDescs[ 6].desc, { "intro.stk", "imd.itk", 0 } },
+ { &fallbackDescs[ 7].desc, { "intro.stk", "mus_gob3.lic", 0 } },
+ { &fallbackDescs[ 8].desc, { "intro.stk", "woodruff.itk", 0 } },
+ { &fallbackDescs[ 9].desc, { "intro.stk", "commun1.itk", 0 } },
+ { &fallbackDescs[10].desc, { "intro.stk", "commun1.itk", "musmac1.mid", 0 } },
+ { &fallbackDescs[11].desc, { "intro.stk", "commun1.itk", "lost.lic", 0 } },
+ { &fallbackDescs[12].desc, { "intro.stk", "cd1.itk", "objet1.itk", 0 } },
+ { &fallbackDescs[13].desc, { "playtoon.stk", "archi.stk", 0 } },
+ { &fallbackDescs[14].desc, { "playtoon.stk", "spirou.stk", 0 } },
+ { &fallbackDescs[15].desc, { "playtoon.stk", "chato.stk", 0 } },
+ { &fallbackDescs[16].desc, { "playtoon.stk", "manda.stk", 0 } },
+ { &fallbackDescs[17].desc, { "playtoon.stk", "wakan.stk", 0 } },
+ { &fallbackDescs[18].desc, { "playtoon.stk", "dan.itk" } },
+ { &fallbackDescs[19].desc, { "intro.stk", "bambou.itk", 0 } },
+ { &fallbackDescs[20].desc, { "disk0.stk", "disk1.stk", "disk2.stk", "disk3.stk", 0 } },
+ { &fallbackDescs[21].desc, { "disk1.stk", "disk2.stk", "disk3.stk", 0 } },
+ { &fallbackDescs[22].desc, { "intro.stk", "stk2.stk", "stk3.stk", 0 } },
+ { &fallbackDescs[23].desc, { "intro.stk", "stk2.stk", "stk3.stk", "mod.babayaga", 0 } },
+ { &fallbackDescs[24].desc, { "stk1.stk", "stk2.stk", "stk3.stk", 0 } },
+ { &fallbackDescs[25].desc, { "adi2.stk", 0 } },
+ { &fallbackDescs[26].desc, { "adif41.stk", "adim41.stk", 0 } },
+ { &fallbackDescs[27].desc, { "coktelplayer.scn", 0 } },
+ { 0, { 0 } }
+};
+
+// -- Tables for detecting the specific Once Upon A Time game --
+
+enum OnceUponATime {
+ kOnceUponATimeInvalid = -1,
+ kOnceUponATimeAbracadabra = 0,
+ kOnceUponATimeBabaYaga = 1,
+ kOnceUponATimeMAX
+};
+
+enum OnceUponATimePlatform {
+ kOnceUponATimePlatformInvalid = -1,
+ kOnceUponATimePlatformDOS = 0,
+ kOnceUponATimePlatformAmiga = 1,
+ kOnceUponATimePlatformAtariST = 2,
+ kOnceUponATimePlatformMAX
+};
+
+static const GOBGameDescription fallbackOnceUpon[kOnceUponATimeMAX][kOnceUponATimePlatformMAX] = {
+ { // kOnceUponATimeAbracadabra
+ { // kOnceUponATimePlatformDOS
+ {
+ "abracadabra",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+ },
+ { // kOnceUponATimePlatformAmiga
+ {
+ "abracadabra",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+ },
+ { // kOnceUponATimePlatformAtariST
+ {
+ "abracadabra",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+ }
+ },
+ { // kOnceUponATimeBabaYaga
+ { // kOnceUponATimePlatformDOS
+ {
+ "babayaga",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+ },
+ { // kOnceUponATimePlatformAmiga
+ {
+ "babayaga",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+ },
+ { // kOnceUponATimePlatformAtariST
+ {
+ "babayaga",
+ "",
+ AD_ENTRY1(0, 0),
+ UNK_LANG,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+ }
+ }
+};
+
+#endif // GOB_DETECTION_TABLES_FALLBACK_H
diff --git a/engines/gob/detection/tables_fascin.h b/engines/gob/detection/tables_fascin.h
new file mode 100644
index 0000000000..1c9cced303
--- /dev/null
+++ b/engines/gob/detection/tables_fascin.h
@@ -0,0 +1,267 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Fascination. */
+
+#ifndef GOB_DETECTION_TABLES_FASCIN_H
+#define GOB_DETECTION_TABLES_FASCIN_H
+
+// -- DOS VGA Floppy (1 disk) --
+
+{ // Supplied by scoriae
+ {
+ "fascination",
+ "VGA",
+ AD_ENTRY1s("disk0.stk", "c14330d052fe4da5a441ac9d81bc5891", 1061955),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "VGA",
+ AD_ENTRY1s("disk0.stk", "e8ab4f200a2304849f462dc901705599", 183337),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+},
+
+// -- DOS VGA Floppy (3 disks) --
+
+{ // Supplied by alex86r in bug report #3297633
+ {
+ "fascination",
+ "VGA 3 disks edition",
+ AD_ENTRY1s("disk0.stk", "ab3dfdce43917bc806812959d692fc8f", 1061929),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "VGA 3 disks edition",
+ AD_ENTRY1s("disk0.stk", "a50a8495e1b2d67699fb562cb98fc3e2", 1064387),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "Hebrew edition (censored)",
+ AD_ENTRY1s("intro.stk", "d6e45ce548598727e2b5587a99718eba", 1055909),
+ HE_ISR,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "intro.stk", 0, 0
+},
+{ // Supplied by windlepoons in bug report #2809247
+ {
+ "fascination",
+ "VGA 3 disks edition",
+ AD_ENTRY1s("disk0.stk", "3a24e60a035250189643c86a9ceafb97", 1062480),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+},
+
+// -- DOS VGA CD --
+
+{
+ {
+ "fascination",
+ "CD Version (Censored)",
+ AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSUBTITLES)
+ },
+ kGameTypeFascination,
+ kFeaturesCD,
+ "intro.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "CD Version (Censored)",
+ AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSUBTITLES)
+ },
+ kGameTypeFascination,
+ kFeaturesCD,
+ "intro.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "CD Version (Censored)",
+ AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSUBTITLES)
+ },
+ kGameTypeFascination,
+ kFeaturesCD,
+ "intro.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "CD Version (Censored)",
+ AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSUBTITLES)
+ },
+ kGameTypeFascination,
+ kFeaturesCD,
+ "intro.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "CD Version (Censored)",
+ AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSUBTITLES)
+ },
+ kGameTypeFascination,
+ kFeaturesCD,
+ "intro.stk", 0, 0
+},
+
+// -- Amiga --
+
+{
+ {
+ "fascination",
+ "",
+ AD_ENTRY1s("disk0.stk", "68b1c01564f774c0b640075fbad1b695", 189968),
+ DE_DEU,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesNone,
+ "disk0.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "",
+ AD_ENTRY1s("disk0.stk", "7062117e9c5adfb6bfb2dac3ff74df9e", 189951),
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesNone,
+ "disk0.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "",
+ AD_ENTRY1s("disk0.stk", "55c154e5a3e8e98afebdcff4b522e1eb", 190005),
+ FR_FRA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesNone,
+ "disk0.stk", 0, 0
+},
+{
+ {
+ "fascination",
+ "",
+ AD_ENTRY1s("disk0.stk", "7691827fff35df7799f14cfd6be178ad", 189931),
+ IT_ITA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesNone,
+ "disk0.stk", 0, 0
+},
+
+// -- Atari ST --
+
+{
+ {
+ "fascination",
+ "",
+ AD_ENTRY1s("disk0.stk", "aff9fcc619f4dd19eae228affd0d34c8", 189964),
+ EN_ANY,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeFascination,
+ kFeaturesNone,
+ "disk0.stk", 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_FASCIN_H
diff --git a/engines/gob/detection/tables_geisha.h b/engines/gob/detection/tables_geisha.h
new file mode 100644
index 0000000000..a32d1ebf81
--- /dev/null
+++ b/engines/gob/detection/tables_geisha.h
@@ -0,0 +1,132 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Geisha. */
+
+#ifndef GOB_DETECTION_TABLES_GEISHA_H
+#define GOB_DETECTION_TABLES_GEISHA_H
+
+// -- DOS EGA Floppy --
+
+{
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "6eebbb98ad90cd3c44549fc2ab30f632", 212153),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+},
+{
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "6eebbb98ad90cd3c44549fc2ab30f632", 212153),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+},
+{ // Supplied by misterhands in bug report #3539797
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "0c4c16090921664f50baefdfd24d7f5d", 211889),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+},
+{ // Supplied by einstein95 in bug report #3544449
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "49107ac897e7c00af6c4ecd78a74a710", 212169),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+},
+{ // Supplied by einstein95 in bug report #3544449
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "49107ac897e7c00af6c4ecd78a74a710", 212169),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+},
+{
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "f4d4d9d20f7ad1f879fc417d47faba89", 336732),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA | kFeaturesAdLib,
+ "disk1.stk", "intro.tot", 0
+},
+
+// -- Amiga --
+
+{
+ {
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "e5892f00917c62423e93f5fd9920cf47", 208120),
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA,
+ "disk1.stk", "intro.tot", 0
+},
+
+#endif // GOB_DETECTION_TABLES_GEISHA_H
diff --git a/engines/gob/detection/tables_gob1.h b/engines/gob/detection/tables_gob1.h
new file mode 100644
index 0000000000..e6086e990a
--- /dev/null
+++ b/engines/gob/detection/tables_gob1.h
@@ -0,0 +1,716 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Gobliiins. */
+
+#ifndef GOB_DETECTION_TABLES_GOB1_H
+#define GOB_DETECTION_TABLES_GOB1_H
+
+// -- DOS EGA Floppy --
+
+{ // Supplied by Florian Zeitz on scummvm-devel
+ {
+ "gob1",
+ "EGA",
+ AD_ENTRY1("intro.stk", "c65e9cc8ba23a38456242e1f2b1caad4"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesEGA | kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "EGA",
+ AD_ENTRY1("intro.stk", "f9233283a0be2464248d83e14b95f09c"),
+ RU_RUS,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesEGA | kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- DOS VGA Floppy --
+
+{ // Supplied by Theruler76 in bug report #1201233
+ {
+ "gob1",
+ "VGA",
+ AD_ENTRY1("intro.stk", "26a9118c0770fa5ac93a9626761600b2"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by raziel_ in bug report #1891864
+ {
+ "gob1",
+ "VGA",
+ AD_ENTRY1s("intro.stk", "e157cb59c6d330ca70d12ab0ef1dd12b", 288972),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- DOS VGA CD --
+
+{ // Provided by pykman in the forums.
+ {
+ "gob1cd",
+ "Polish",
+ AD_ENTRY1s("intro.stk", "97d2443948b2e367cf567fe7e101f5f2", 4049267),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.000 version.
+ {
+ "gob1cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.000 version.
+ {
+ "gob1cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.000 version.
+ {
+ "gob1cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.000 version.
+ {
+ "gob1cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.000 version.
+ {
+ "gob1cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.02 version. Multilingual
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.02 version. Multilingual
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.02 version. Multilingual
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.02 version. Multilingual
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // CD 1.02 version. Multilingual
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
+ HU_HUN,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesCD,
+ 0, 0, 0
+},
+
+// -- Mac --
+
+{ // Supplied by raina in the forums
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "6d837c6380d8f4d984c9f6cc0026df4f", 192712),
+ EN_ANY,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ EN_ANY,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ DE_DEU,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ FR_FRA,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ IT_ITA,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ ES_ESP,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Windows --
+
+{ // Supplied by Hkz on #scummvm
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "",
+ {
+ {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
+ {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
+ IT_ITA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "gob1",
+ "Demo",
+ AD_ENTRY1("intro.stk", "972f22c6ff8144a6636423f0354ca549"),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "Interactive Demo",
+ AD_ENTRY1("intro.stk", "e72bd1e3828c7dec4c8a3e58c48bdfdb"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "Interactive Demo",
+ AD_ENTRY1s("intro.stk", "a796096280d5efd48cf8e7dfbe426eb5", 193595),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2785958
+ {
+ "gob1",
+ "Interactive Demo",
+ AD_ENTRY1s("intro.stk", "35a098571af9a03c04e2303aec7c9249", 116582),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "gob1",
+ "",
+ AD_ENTRY1s("intro.stk", "0e022d3f2481b39e9175d37b2c6ad4c6", 2390121),
+ FR_FRA,
+ kPlatformCDi,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob1,
+ kFeaturesAdLib,
+ 0, "AVT003.TOT", 0
+},
+
+#endif // GOB_DETECTION_TABLES_GOB1_H
diff --git a/engines/gob/detection/tables_gob2.h b/engines/gob/detection/tables_gob2.h
new file mode 100644
index 0000000000..659e6df063
--- /dev/null
+++ b/engines/gob/detection/tables_gob2.h
@@ -0,0 +1,641 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Gobliins 2: The Prince Buffoon. */
+
+#ifndef GOB_DETECTION_TABLES_GOB2_H
+#define GOB_DETECTION_TABLES_GOB2_H
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "b45b984ee8017efd6ea965b9becd4d66"),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "dedb5d31d8c8050a8cf77abedcc53dae"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by raziel_ in bug report #1891867
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "25a99827cd59751a80bed9620fb677a0", 893302),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "a13ecb4f6d8fd881ebbcc02e45cb5475", 837275),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by blackwhiteeagle in bug report #1605235
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "3e4e7db0d201587dd2df4003b2993ef6"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "a13892cdf4badda85a6f6fb47603a128"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2602017
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "c47faf1d406504e6ffe63243610bb1f4"),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "cd3e1df8b273636ee32e34b7064f50e8"),
+ RU_RUS,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by arcepi in bug report #1659884
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "5f53c56e3aa2f1e76c2e4f0caa15887f", 829232),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- DOS VGA CD --
+
+{
+ {
+ "gob2cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "9de5fbb41cf97182109e5fecc9d90347"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by pykman in bug report #3067489
+ {
+ "gob2cd",
+ "v2.01 Polish",
+ AD_ENTRY1s("intro.stk", "3025f05482b646c18c2c79c615a3a1df", 5011726),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "gob2cd",
+ "v2.01",
+ AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "gob2cd",
+ "v2.01",
+ AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "gob2cd",
+ "v2.01",
+ AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "gob2cd",
+ "v2.01",
+ AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "gob2cd",
+ "v2.01",
+ AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob2cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
+ HU_HUN,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob2cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob2cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob2cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob2cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+
+// -- Windows --
+
+{
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "285d7340f98ebad65d465585da12910b", 837286},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "25a99827cd59751a80bed9620fb677a0", 893302},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ EN_USA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "25a99827cd59751a80bed9620fb677a0", 893302},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "25a99827cd59751a80bed9620fb677a0", 893302},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "6efac0a14c0de4d57dde8592456c8acf", 845172},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ EN_USA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "6efac0a14c0de4d57dde8592456c8acf", 845172},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "24489330a1d67ff978211f574822a5a6", 883756),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "285d7340f98ebad65d465585da12910b", 837286),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Mac --
+
+{ // Supplied by fac76 in bug report #1673397
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "b45b984ee8017efd6ea965b9becd4d66", 828443},
+ {"musmac1.mid", 0, "7f96f491448c7a001b32df89cf8d2af2", 1658},
+ {0, 0, 0, 0}
+ },
+ UNK_LANG,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by koalet in bug report #2478585
+ {
+ "gob2",
+ "",
+ {
+ {"intro.stk", 0, "a13ecb4f6d8fd881ebbcc02e45cb5475", 837275},
+ {"musmac1.mid", 0, "7f96f491448c7a001b32df89cf8d2af2", 1658},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Amiga --
+
+{ // Supplied by fac76 in bug report #1883808
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "eebf2810122cfd17399260cd1468e994", 554014),
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "d28b9e9b41f31acfa58dcd12406c7b2c"),
+ DE_DEU,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2602057
+ {
+ "gob2",
+ "",
+ AD_ENTRY1("intro.stk", "686c88f7302a80b744aae9f8413e853d"),
+ IT_ITA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by aldozx in the forums
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "abc3e786cd78197773954c75815b278b", 554721),
+ ES_ESP,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Atari ST --
+
+{ // Supplied by bgk in bug report #1706861
+ {
+ "gob2",
+ "",
+ AD_ENTRY1s("intro.stk", "4b13c02d1069b86bcfec80f4e474b98b", 554680),
+ FR_FRA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "gob2",
+ "Non-Interactive Demo",
+ AD_ENTRY1("intro.stk", "8b1c98ff2ab2e14f47a1b891e9b92217"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, "usa.tot", 0
+},
+{
+ {
+ "gob2",
+ "Interactive Demo",
+ AD_ENTRY1("intro.stk", "cf1c95b2939bd8ff58a25c756cb6125e"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob2",
+ "Interactive Demo",
+ AD_ENTRY1("intro.stk", "4b278c2678ea01383fd5ca114d947eea"),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by polluks in bug report #1895126
+ {
+ "gob2",
+ "Interactive Demo",
+ AD_ENTRY1s("intro.stk", "9fa85aea959fa8c582085855fbd99346", 553063),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob2,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_GOB2_H
diff --git a/engines/gob/detection/tables_gob3.h b/engines/gob/detection/tables_gob3.h
new file mode 100644
index 0000000000..22ec69054b
--- /dev/null
+++ b/engines/gob/detection/tables_gob3.h
@@ -0,0 +1,564 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Goblins 3 / Goblins Quest 3. */
+
+#ifndef GOB_DETECTION_TABLES_GOB3_H
+#define GOB_DETECTION_TABLES_GOB3_H
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1s("intro.stk", "32b0f57f5ae79a9ae97e8011df38af42", 157084),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1s("intro.stk", "904fc32032295baa3efb3a41f17db611", 178582),
+ HE_ISR,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by raziel_ in bug report #1891869
+ {
+ "gob3",
+ "",
+ AD_ENTRY1s("intro.stk", "16b014bf32dbd6ab4c5163c44f56fed1", 445104),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "1e2f64ec8dfa89f42ee49936a27e66e7"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by paul66 in bug report #1652352
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "f6d225b25a180606fa5dbe6405c97380"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "e42a4f2337d6549487a80864d7826972"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by Paranoimia on #scummvm
+ {
+ "gob3",
+ "",
+ AD_ENTRY1s("intro.stk", "fe8144daece35538085adb59c2d29613", 159402),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "4e3af248a48a2321364736afab868527"),
+ RU_RUS,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "8d28ce1591b0e9cc79bf41cad0fc4c9c"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2098621
+ {
+ "gob3",
+ "",
+ AD_ENTRY1s("intro.stk", "d3b72938fbbc8159198088811f9e6d19", 160382),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Windows --
+
+{
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "16b014bf32dbd6ab4c5163c44f56fed1", 445104},
+ {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "16b014bf32dbd6ab4c5163c44f56fed1", 445104},
+ {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "16b014bf32dbd6ab4c5163c44f56fed1", 445104},
+ {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "edd7403e5dc2a14459d2665a4c17714d", 209534},
+ {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "428e2de130cf3b303c938924539dc50d", 324420},
+ {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "428e2de130cf3b303c938924539dc50d", 324420},
+ {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in Found in french ADI 2.5 Anglais Multimedia 5e
+ {
+ "gob3",
+ "",
+ AD_ENTRY1s("intro.stk", "edd7403e5dc2a14459d2665a4c17714d", 209534),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Mac --
+
+{ // Supplied by fac76 in bug report #1742716
+ {
+ "gob3",
+ "",
+ {
+ {"intro.stk", 0, "32b0f57f5ae79a9ae97e8011df38af42", 157084},
+ {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Amiga --
+
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "bd679eafde2084d8011f247e51b5a805"),
+ EN_GRB,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesNone,
+ 0, "menu.tot", 0
+},
+{
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "bd679eafde2084d8011f247e51b5a805"),
+ DE_DEU,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesNone,
+ 0, "menu.tot", 0
+},
+
+// -- DOS VGA CD --
+
+{
+ {
+ "gob3cd",
+ "v1.000",
+ AD_ENTRY1("intro.stk", "6f2c226c62dd7ab0ab6f850e89d3fc47"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by pykman in bug report #3067489
+ {
+ "gob3cd",
+ "v1.02 Polish",
+ AD_ENTRY1s("intro.stk", "978afddcac81bb95a04757b61f78471c", 619825),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
+ HU_HUN,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2810082
+ {
+ "gob3cd",
+ "v1.02",
+ AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesCD,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "gob3",
+ "Non-interactive Demo",
+ AD_ENTRY1("intro.stk", "b9b898fccebe02b69c086052d5024a55"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "Interactive Demo",
+ AD_ENTRY1("intro.stk", "7aebd94e49c2c5c518c9e7b74f25de9d"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "Interactive Demo 2",
+ AD_ENTRY1("intro.stk", "e5dcbc9f6658ebb1e8fe26bc4da0806d"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "gob3",
+ "Interactive Demo 3",
+ AD_ENTRY1s("intro.stk", "9e20ad7b471b01f84db526da34eaf0a2", 395561),
+ EN_ANY,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeGob3,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_GOB3_H
diff --git a/engines/gob/detection/tables_inca2.h b/engines/gob/detection/tables_inca2.h
new file mode 100644
index 0000000000..26989f7d1a
--- /dev/null
+++ b/engines/gob/detection/tables_inca2.h
@@ -0,0 +1,249 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Inca II: Wiracocha. */
+
+#ifndef GOB_DETECTION_TABLES_INCA2_H
+#define GOB_DETECTION_TABLES_INCA2_H
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "1fa92b00fe80a20f34ec34a8e2fa869e", 923072),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "1fa92b00fe80a20f34ec34a8e2fa869e", 923072),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "1fa92b00fe80a20f34ec34a8e2fa869e", 923072),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- DOS VGA CD --
+
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesCD,
+ 0, 0, 0
+},
+
+// -- Windows --
+
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
+ EN_USA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
+ IT_ITA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "inca2",
+ "",
+ AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "inca2",
+ "Non-Interactive Demo",
+ {
+ {"cons.imd", 0, "f896ba0c4a1ac7f7260d342655980b49", 17804},
+ {"conseil.imd", 0, "aaedd5482d5b271e233e86c5a03cf62e", 33999},
+ {"int.imd", 0, "6308222fcefbcb20925f01c1aff70dee", 30871},
+ {"inter.imd", 0, "39bd6d3540f3bedcc97293f352c7f3fc", 191719},
+ {"machu.imd", 0, "c0bc8211d93b467bfd063b63fe61b85c", 34609},
+ {"post.imd", 0, "d75cad0e3fc22cb0c8b6faf597f509b2", 1047709},
+ {"posta.imd", 0, "2a5b3fe75681ddf4d21ac724db8111b4", 547250},
+ {"postb.imd", 0, "24260ce4e80a4c472352b76637265d09", 868312},
+ {"postc.imd", 0, "24accbcc8b83a9c2be4bd82849a2bd29", 415637},
+ {"tum.imd", 0, "0993d4810ec9deb3f77c5e92095320fd", 20330},
+ {"tumi.imd", 0, "bf53f229480d694de0947fe3366fbec6", 248952},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeInca2,
+ kFeaturesAdLib | kFeaturesBATDemo,
+ 0, 0, 7
+},
+
+#endif // GOB_DETECTION_TABLES_INCA2_H
diff --git a/engines/gob/detection/tables_lit.h b/engines/gob/detection/tables_lit.h
new file mode 100644
index 0000000000..019d001f97
--- /dev/null
+++ b/engines/gob/detection/tables_lit.h
@@ -0,0 +1,484 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Lost in Time. */
+
+#ifndef GOB_DETECTION_TABLES_LIT_H
+#define GOB_DETECTION_TABLES_LIT_H
+
+// -- DOS VGA Floppy (Part I and II) --
+
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "7b7f48490dedc8a7cb999388e2fadbe3", 3930674),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "e0767783ff662ed93665446665693aef", 4371238),
+ HE_ISR,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by cartman_ on #scummvm
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "f1f78b663893b58887add182a77df151", 3944090),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2105220
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "cd322cb3c64ef2ba2f2134aa2122cfe9", 3936700),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2093672
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2093672
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2093672
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2093672
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2093672
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+{ // Supplied by SiRoCs in bug report #2093672
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesCD,
+ 0, 0, 0
+},
+
+// -- Windows (Part I and II) --
+
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4207330),
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4207330),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4207330),
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4219382),
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4219382),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Found in french ADI 2.6 Francais-Maths 4e
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "58ee9583a4fb837f02d9a58e5f442656", 3937120),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Windows (Part I only) --
+{
+ {
+ "lit1",
+ "Light install",
+ {
+ {"intro.stk", 0, "93c91bc9e783d00033042ae83144d7dd", 72318},
+ {"partie2.itk", 0, "78f00bd8eb9e680e6289bba0130b1b33", 664064},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit1",
+ "Full install",
+ {
+ {"intro.stk", 0, "93c91bc9e783d00033042ae83144d7dd", 72318},
+ {"partie2.itk", 0, "78f00bd8eb9e680e6289bba0130b1b33", 4396644},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Windows (Part II only) --
+
+{
+ {
+ "lit2",
+ "Light install",
+ AD_ENTRY1s("intro.stk", "17acbb212e62addbe48dc8f2282c98cb", 72318),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "lit2",
+ "Full install",
+ {
+ {"intro.stk", 0, "17acbb212e62addbe48dc8f2282c98cb", 72318},
+ {"partie4.itk", 0, "6ce4967e0c79d7daeabc6c1d26783d4c", 2612087},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Mac (Part I and II) --
+
+{ // Supplied by koalet in bug report #2479034
+ {
+ "lit",
+ "",
+ {
+ {"intro.stk", 0, "af98bcdc70e1f1c1635577fd726fe7f1", 3937310},
+ {"musmac1.mid", 0, "ae7229bb09c6abe4e60a2768b24bc890", 9398},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "lit",
+ "Demo",
+ AD_ENTRY1("demo.stk", "c06f8cc20eb239d4c71f225ce3093edf"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ "demo.stk", "demo.tot", 0
+},
+{
+ {
+ "lit",
+ "Non-interactive Demo",
+ AD_ENTRY1("demo.stk", "2eba8abd9e3878c57307576012dd2fec"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ "demo.stk", "demo.tot", 0
+},
+
+// -- Pirated! Do not re-add nor un-tag! --
+
+{
+ {
+ "lit",
+ "",
+ AD_ENTRY1s("intro.stk", "3712e7527ba8ce5637d2aadf62783005", 72318),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_PIRATED,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_LIT_H
diff --git a/engines/gob/detection/tables_littlered.h b/engines/gob/detection/tables_littlered.h
new file mode 100644
index 0000000000..2b41b65a71
--- /dev/null
+++ b/engines/gob/detection/tables_littlered.h
@@ -0,0 +1,265 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Once Upon A Time: Little Red Riding Hood. */
+
+#ifndef GOB_DETECTION_TABLES_LITTLERED_H
+#define GOB_DETECTION_TABLES_LITTLERED_H
+
+// -- DOS EGA Floppy --
+
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+
+// -- Windows --
+
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
+ IT_ITA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
+ FR_FRA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
+ ES_ESP,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
+ EN_GRB,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
+ IT_ITA,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{ // Found in french ADI 2 Francais-Maths CM1
+ {
+ "littlered",
+ "",
+ AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
+ DE_DEU,
+ kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+
+// -- Amiga --
+
+{
+ {
+ "littlered",
+ "",
+ {
+ {"intro.stk", 0, "0b72992f5d8b5e6e0330572a5753ea25", 256490},
+ {"mod.babayaga", 0, "43484cde74e0860785f8e19f0bc776d1", 60248},
+ {0, 0, 0, 0}
+ },
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeLittleRed,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_LITTLERED_H
diff --git a/engines/gob/detection/tables_onceupon.h b/engines/gob/detection/tables_onceupon.h
new file mode 100644
index 0000000000..366024d43c
--- /dev/null
+++ b/engines/gob/detection/tables_onceupon.h
@@ -0,0 +1,518 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Once Upon A Time: Baba Yaga and Abracadabra. */
+
+#ifndef GOB_DETECTION_TABLES_ONCEUPON_H
+#define GOB_DETECTION_TABLES_ONCEUPON_H
+
+// -- Once Upon A Time: Abracadabra, Amiga --
+
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106},
+ {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106},
+ {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106},
+ {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106},
+ {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106},
+ {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+
+// -- Once Upon A Time: Abracadabra, Atari ST --
+
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123},
+ {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123},
+ {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123},
+ {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123},
+ {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "abracadabra",
+ "",
+ {
+ {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806},
+ {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123},
+ {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeAbracadabra,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+
+// -- Once Upon A Time: Baba Yaga, DOS EGA Floppy --
+
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813},
+ {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582},
+ {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813},
+ {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582},
+ {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813},
+ {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582},
+ {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813},
+ {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582},
+ {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813},
+ {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582},
+ {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesAdLib | kFeaturesEGA,
+ 0, 0, 0
+},
+
+// -- Once Upon A Time: Baba Yaga, Amiga --
+
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090},
+ {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090},
+ {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090},
+ {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090},
+ {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090},
+ {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+
+// -- Once Upon A Time: Baba Yaga, Atari ST --
+
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095},
+ {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095},
+ {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095},
+ {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095},
+ {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+{
+ {
+ "babayaga",
+ "",
+ {
+ {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095},
+ {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128},
+ {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeBabaYaga,
+ kFeaturesEGA,
+ 0, 0, 0
+},
+
+#endif // GOB_DETECTION_TABLES_ONCEUPON_H
diff --git a/engines/gob/detection/tables_playtoons.h b/engines/gob/detection/tables_playtoons.h
new file mode 100644
index 0000000000..4eb5945b04
--- /dev/null
+++ b/engines/gob/detection/tables_playtoons.h
@@ -0,0 +1,517 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for the Playtoons series. */
+
+#ifndef GOB_DETECTION_TABLES_PLAYTOONS_H
+#define GOB_DETECTION_TABLES_PLAYTOONS_H
+
+// -- Playtoons 1: Uncle Archibald --
+
+{
+ {
+ "playtoons1",
+ "",
+ {
+ {"playtoon.stk", 0, "8c98e9a11be9bb203a55e8c6e68e519b", 25574338},
+ {"archi.stk", 0, "8d44b2a0d4e3139471213f9f0ed21e81", 5524674},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons1",
+ "Pack mes histoires anim\xE9""es",
+ {
+ {"playtoon.stk", 0, "55f0293202963854192e39474e214f5f", 30448474},
+ {"archi.stk", 0, "8d44b2a0d4e3139471213f9f0ed21e81", 5524674},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons1",
+ "",
+ {
+ {"playtoon.stk", 0, "c5ca2a288cdaefca9556cd9ae4b579cf", 25158926},
+ {"archi.stk", 0, "8d44b2a0d4e3139471213f9f0ed21e81", 5524674},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{ // Supplied by scoriae in the forums
+ {
+ "playtoons1",
+ "",
+ {
+ {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
+ {"archi.stk", 0, "00d8274519dfcf8a0d8ae3099daea0f8", 5532135},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons1",
+ "Non-Interactive Demo",
+ {
+ {"play123.scn", 0, "4689a31f543915e488c3bc46ea358add", 258},
+ {"archi.vmd", 0, "a410fcc8116bc173f038100f5857191c", 5617210},
+ {"chato.vmd", 0, "5a10e39cb66c396f2f9d8fb35e9ac016", 5445937},
+ {"genedeb.vmd", 0, "3bb4a45585f88f4d839efdda6a1b582b", 1244228},
+ {"generik.vmd", 0, "b46bdd64b063e86927fb2826500ad512", 603242},
+ {"genespi.vmd", 0, "b7611916f32a370ae9832962fc17ef72", 758719},
+ {"spirou.vmd", 0, "8513dbf7ac51c057b21d371d6b217b47", 2550788},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 3
+},
+{
+ {
+ "playtoons1",
+ "Non-Interactive Demo",
+ {
+ {"e.scn", 0, "8a0db733c3f77be86e74e8242e5caa61", 124},
+ {"demarchg.vmd", 0, "d14a95da7d8792faf5503f649ffcbc12", 5619415},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 4
+},
+{
+ {
+ "playtoons1",
+ "Non-Interactive Demo",
+ {
+ {"i.scn", 0, "8b3294474d39970463663edd22341730", 285},
+ {"demarita.vmd", 0, "84c8672b91c7312462603446e224bfec", 5742533},
+ {"dembouit.vmd", 0, "7a5fdf0a4dbdfe72e31dd489ea0f8aa2", 3536786},
+ {"demo5.vmd", 0, "2abb7b6a26406c984f389f0b24b5e28e", 13290970},
+ {"demoita.vmd", 0, "b4c0622d14c8749965cd0f5dfca4cf4b", 1183566},
+ {"wooddem3.vmd", 0, "a1700596172c2d4e264760030c3a3d47", 8994250},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 5
+},
+{
+ {
+ "playtoons1",
+ "Non-Interactive Demo",
+ {
+ {"s.scn", 0, "1f527010626b5490761f16ba7a6f639a", 251},
+ {"demaresp.vmd", 0, "3f860f944056842b35a5fd05416f208e", 5720619},
+ {"demboues.vmd", 0, "3a0caa10c98ef92a15942f8274075b43", 3535838},
+ {"demo5.vmd", 0, "2abb7b6a26406c984f389f0b24b5e28e", 13290970},
+ {"wooddem3.vmd", 0, "a1700596172c2d4e264760030c3a3d47", 8994250},
+ {0, 0, 0, 0}
+ },
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 6
+},
+
+// -- Playtoons 2: The Case of the Counterfeit Collaborator (Spirou) --
+
+{
+ {
+ "playtoons2",
+ "",
+ {
+ {"playtoon.stk", 0, "4772c96be88a57f0561519e4a1526c62", 24406262},
+ {"spirou.stk", 0, "5d9c7644d0c47840169b4d016765cc1a", 9816201},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons2",
+ "",
+ {
+ {"playtoon.stk", 0, "55a85036dd93cce93532d8f743d90074", 17467154},
+ {"spirou.stk", 0, "e3e1b6148dd72fafc3637f1a8e5764f5", 9812043},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons2",
+ "",
+ {
+ {"playtoon.stk", 0, "c5ca2a288cdaefca9556cd9ae4b579cf", 25158926},
+ {"spirou.stk", 0, "91080dc148de1bbd6a97321c1a1facf3", 9817086},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{ // Supplied by Hkz
+ {
+ "playtoons2",
+ "",
+ {
+ {"playtoon.stk", 0, "2572685400852d12759a2fbf09ec88eb", 9698780},
+ {"spirou.stk", 0, "d3cfeff920b6343a2ece55088f530dba", 7076608},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{ // Supplied by scoriae in the forums
+ {
+ "playtoons2",
+ "",
+ {
+ {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
+ {"spirou.stk", 0, "993737f112ca6a9b33c814273280d832", 9825760},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Playtoons 3: The Secret of the Castle --
+
+{
+ {
+ "playtoons3",
+ "",
+ {
+ {"playtoon.stk", 0, "8c98e9a11be9bb203a55e8c6e68e519b", 25574338},
+ {"chato.stk", 0, "4fa4ed96a427c344e9f916f9f236598d", 6033793},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons3",
+ "",
+ {
+ {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
+ {"chato.stk", 0, "8fc8d0da5b3e758908d1d7298d497d0b", 6041026},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons3",
+ "Pack mes histoires anim\xE9""es",
+ {
+ {"playtoon.stk", 0, "55f0293202963854192e39474e214f5f", 30448474},
+ {"chato.stk", 0, "4fa4ed96a427c344e9f916f9f236598d", 6033793},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{
+ {
+ "playtoons3",
+ "",
+ {
+ {"playtoon.stk", 0, "c5ca2a288cdaefca9556cd9ae4b579cf", 25158926},
+ {"chato.stk", 0, "3c6cb3ac8a5a7cf681a19971a92a748d", 6033791},
+ {0, 0, 0, 0}
+ },
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "playtoons3",
+ "",
+ {
+ {"playtoon.stk", 0, "4772c96be88a57f0561519e4a1526c62", 24406262},
+ {"chato.stk", 0, "bdef407387112bfcee90e664865ac3af", 6033867},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Playtoons 4: The Mandarin Prince --
+
+{
+ {
+ "playtoons4",
+ "",
+ {
+ {"playtoon.stk", 0, "b7f5afa2dc1b0f75970b7c07d175db1b", 24340406},
+ {"manda.stk", 0, "92529e0b927191d9898a34c2892e9a3a", 6485072},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+{ //Supplied by goodoldgeorg in bug report #2820006
+ {
+ "playtoons4",
+ "",
+ {
+ {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
+ {"manda.stk", 0, "69a79c9f61b2618e482726f2ff68078d", 6499208},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Playtoons 5: The Stone of Wakan --
+
+{
+ {
+ "playtoons5",
+ "",
+ {
+ {"playtoon.stk", 0, "55f0293202963854192e39474e214f5f", 30448474},
+ {"wakan.stk", 0, "f493bf82851bc5ba74d57de6b7e88df8", 5520153},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Playtoons Construction Kit 1: Monsters --
+
+{
+ {
+ "playtnck1",
+ "",
+ {
+ {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024},
+ {"dan.itk", 0, "906d67b3e438d5e95ec7ea9e781a94f3", 3000320},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Playtoons Construction Kit 2: Knights --
+
+{
+ {
+ "playtnck2",
+ "",
+ {
+ {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024},
+ {"dan.itk", 0, "74eeb075bd2cb47b243349730264af01", 3213312},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Playtoons Construction Kit 3: Far West --
+
+{
+ {
+ "playtnck3",
+ "",
+ {
+ {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024},
+ {"dan.itk", 0, "9a8f62809eca5a52f429b5b6a8e70f8f", 2861056},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypePlaytoons,
+ kFeatures640x480,
+ "intro2.stk", 0, 0
+},
+
+// -- Bambou le sauveur de la jungle --
+
+{
+ {
+ "bambou",
+ "",
+ {
+ {"intro.stk", 0, "2f8db6963ff8d72a8331627ebda918f4", 3613238},
+ {"bambou.itk", 0, "0875914d31126d0749313428f10c7768", 114440192},
+ {0, 0, 0, 0}
+ },
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeBambou,
+ kFeatures640x480,
+ "intro.stk", "intro.tot", 0
+},
+
+#endif // GOB_DETECTION_TABLES_PLAYTOONS_H
diff --git a/engines/gob/detection/tables_urban.h b/engines/gob/detection/tables_urban.h
new file mode 100644
index 0000000000..d24f6a5011
--- /dev/null
+++ b/engines/gob/detection/tables_urban.h
@@ -0,0 +1,151 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Urban Runner. */
+
+#ifndef GOB_DETECTION_TABLES_URBAN_H
+#define GOB_DETECTION_TABLES_URBAN_H
+
+// -- Windows --
+
+{
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "3ab2c542bd9216ae5d02cc6f45701ae1", 1252436),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+{ // Supplied by Collector9 in bug report #3228040
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "6ce3d878178932053267237ec4843ce1", 1252518),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+{ // Supplied by gamin in the forums
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "b991ed1d31c793e560edefdb349882ef", 1276408),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+{ // Supplied by jvprat on #scummvm
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "4ec3c0864e2b54c5b4ccf9f6ad96528d", 1253328),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+{ // Supplied by Alex on the gobsmacked blog
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "9ea647085a16dd0fb9ecd84cd8778ec9", 1253436),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+{ // Supplied by alex86r in bug report #3297602
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "4e4a3c017fe5475353bf94c455fe3efd", 1253448),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2770340
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "4bd31979ea3d77a58a358c09000a85ed", 1253018),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "urban",
+ "Non-Interactive Demo",
+ {
+ {"wdemo.s24", 0, "14ac9bd51db7a075d69ddb144904b271", 87},
+ {"demo.vmd", 0, "65d04715d871c292518b56dd160b0161", 9091237},
+ {"urband.vmd", 0, "60343891868c91854dd5c82766c70ecc", 922461},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor | kFeaturesSCNDemo,
+ 0, 0, 2
+},
+
+#endif // GOB_DETECTION_TABLES_URBAN_H
diff --git a/engines/gob/detection/tables_ween.h b/engines/gob/detection/tables_ween.h
new file mode 100644
index 0000000000..a02b931b85
--- /dev/null
+++ b/engines/gob/detection/tables_ween.h
@@ -0,0 +1,349 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for Ween: The Prophecy. */
+
+#ifndef GOB_DETECTION_TABLES_WEEN_H
+#define GOB_DETECTION_TABLES_WEEN_H
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "2bb8878a8042244dd2b96ff682381baa"),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "de92e5c6a8c163007ffceebef6e67f7d", 7117568),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by cybot_tmin in bug report #1667743
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "6d60f9205ecfbd8735da2ee7823a70dc", 7014426),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "4b10525a3782aa7ecd9d833b5c1d308b"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by cartman_ on #scummvm
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "63170e71f04faba88673b3f510f9c4c8"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by glorfindel in bugreport #1722142
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "8b57cd510da8a3bbd99e3a0297a8ebd1", 7018771),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Amiga --
+
+{ // Supplied by vampir_raziel in bug report #1658373
+ {
+ "ween",
+ "",
+ {
+ {"intro.stk", 0, "bfd9d02faf3d8d60a2cf744f95eb48dd", 456570},
+ {"ween.ins", 0, "d2cb24292c9ddafcad07e23382027218", 87800},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by vampir_raziel in bug report #1658373
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "257fe669705ac4971efdfd5656eef16a", 457719),
+ FR_FRA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by vampir_raziel in bug report #1658373
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "dffd1ab98fe76150d6933329ca6f4cc4", 459458),
+ FR_FRA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by vampir_raziel in bug report #1658373
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "af83debf2cbea21faa591c7b4608fe92", 458192),
+ DE_DEU,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2563539
+ {
+ "ween",
+ "",
+ {
+ {"intro.stk", 0, "dffd1ab98fe76150d6933329ca6f4cc4", 459458},
+ {"ween.ins", 0, "d2cb24292c9ddafcad07e23382027218", 87800},
+ {0, 0, 0, 0}
+ },
+ IT_ITA,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- Atari ST --
+
+{ // Supplied by pwigren in bug report #1764174
+ {
+ "ween",
+ "",
+ {
+ {"intro.stk", 0, "bfd9d02faf3d8d60a2cf744f95eb48dd", 456570},
+ {"music__5.snd", 0, "7d1819b9981ecddd53d3aacbc75f1cc8", 13446},
+ {0, 0, 0, 0}
+ },
+ EN_GRB,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "e6d13fb3b858cb4f78a8780d184d5b2c"),
+ FR_FRA,
+ kPlatformAtariST,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesNone,
+ 0, 0, 0
+},
+
+// -- DOS VGA Floppy --
+
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "2bb8878a8042244dd2b96ff682381baa"),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "de92e5c6a8c163007ffceebef6e67f7d", 7117568),
+ EN_USA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by cybot_tmin in bug report #1667743
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "6d60f9205ecfbd8735da2ee7823a70dc", 7014426),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "4b10525a3782aa7ecd9d833b5c1d308b"),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by cartman_ on #scummvm
+ {
+ "ween",
+ "",
+ AD_ENTRY1("intro.stk", "63170e71f04faba88673b3f510f9c4c8"),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+{ // Supplied by glorfindel in bugreport #1722142
+ {
+ "ween",
+ "",
+ AD_ENTRY1s("intro.stk", "8b57cd510da8a3bbd99e3a0297a8ebd1", 7018771),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "ween",
+ "Demo",
+ AD_ENTRY1("intro.stk", "2e9c2898f6bf206ede801e3b2e7ee428"),
+ UNK_LANG,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, "show.tot", 0
+},
+{
+ {
+ "ween",
+ "Demo",
+ AD_ENTRY1("intro.stk", "15fb91a1b9b09684b28ac75edf66e504"),
+ EN_USA,
+ kPlatformPC,
+ ADGF_DEMO,
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
+ },
+ kGameTypeWeen,
+ kFeaturesAdLib,
+ 0, "show.tot", 0
+},
+
+#endif // GOB_DETECTION_TABLES_WEEN_H
diff --git a/engines/gob/detection/tables_woodruff.h b/engines/gob/detection/tables_woodruff.h
new file mode 100644
index 0000000000..e369539984
--- /dev/null
+++ b/engines/gob/detection/tables_woodruff.h
@@ -0,0 +1,402 @@
+/* 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.
+ *
+ */
+
+/* Detection tables for (The Bizarre Adventures of) Woodruff and the Schnibble (of Azimuth). */
+
+#ifndef GOB_DETECTION_TABLES_WOODRUFF_H
+#define GOB_DETECTION_TABLES_WOODRUFF_H
+
+// -- Windows CD --
+
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "5f5f4e0a72c33391e67a47674b120cc6", 20296422),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by jvprat on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by jvprat on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by jvprat on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by jvprat on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by jvprat on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "f4c344023b073782d2fddd9d8b515318", 7069736),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "f4c344023b073782d2fddd9d8b515318", 7069736),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by Hkz on #scummvm
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "f4c344023b073782d2fddd9d8b515318", 7069736),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by DjDiabolik in bug report #1971294
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
+ EN_GRB,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by DjDiabolik in bug report #1971294
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
+ DE_DEU,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by DjDiabolik in bug report #1971294
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
+ FR_FRA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by DjDiabolik in bug report #1971294
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by DjDiabolik in bug report #1971294
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
+ ES_ESP,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+{ // Supplied by goodoldgeorg in bug report #2098838
+ {
+ "woodruff",
+ "",
+ AD_ENTRY1s("intro.stk", "08a96bf061af1fa4f75c6a7cc56b60a4", 20734979),
+ PL_POL,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480,
+ 0, 0, 0
+},
+
+// -- Demos --
+
+{
+ {
+ "woodruff",
+ "Non-Interactive Demo",
+ {
+ {"demo.scn", 0, "16bb85fc5f8e519147b60475dbf33962", 89},
+ {"wooddem3.vmd", 0, "a1700596172c2d4e264760030c3a3d47", 8994250},
+ {0, 0, 0, 0}
+ },
+ EN_ANY,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
+ },
+ kGameTypeWoodruff,
+ kFeatures640x480 | kFeaturesSCNDemo,
+ 0, 0, 1
+},
+
+#endif // GOB_DETECTION_TABLES_WOODRUFF_H
diff --git a/engines/gob/detection_tables.h b/engines/gob/detection_tables.h
deleted file mode 100644
index 5c6e919e12..0000000000
--- a/engines/gob/detection_tables.h
+++ /dev/null
@@ -1,5262 +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.
- *
- */
-
-namespace Gob {
-
-static const GOBGameDescription gameDescriptions[] = {
- { // Supplied by Florian Zeitz on scummvm-devel
- {
- "gob1",
- "EGA",
- AD_ENTRY1("intro.stk", "c65e9cc8ba23a38456242e1f2b1caad4"),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "EGA",
- AD_ENTRY1("intro.stk", "f9233283a0be2464248d83e14b95f09c"),
- RU_RUS,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesEGA,
- 0, 0, 0
- },
- { // Supplied by Theruler76 in bug report #1201233
- {
- "gob1",
- "VGA",
- AD_ENTRY1("intro.stk", "26a9118c0770fa5ac93a9626761600b2"),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by raziel_ in bug report #1891864
- {
- "gob1",
- "VGA",
- AD_ENTRY1s("intro.stk", "e157cb59c6d330ca70d12ab0ef1dd12b", 288972),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by raina in the forums
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "6d837c6380d8f4d984c9f6cc0026df4f", 192712),
- EN_ANY,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug report #1652352
- {
- "gob1",
- "",
- AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
- EN_ANY,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug report #1652352
- {
- "gob1",
- "",
- AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
- DE_DEU,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug report #1652352
- {
- "gob1",
- "",
- AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
- FR_FRA,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug report #1652352
- {
- "gob1",
- "",
- AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
- IT_ITA,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug report #1652352
- {
- "gob1",
- "",
- AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
- ES_ESP,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- IT_ITA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "f5f028ee39c456fa51fa63b606583918", 313472},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- IT_ITA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "",
- {
- {"intro.stk", 0, "e157cb59c6d330ca70d12ab0ef1dd12b", 288972},
- {"musmac1.mid", 0, "4f66903b33df8a20edd4c748809c0b56", 8161},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
- IT_ITA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "f5f028ee39c456fa51fa63b606583918", 313472),
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Provided by pykman in the forums.
- {
- "gob1cd",
- "Polish",
- AD_ENTRY1s("intro.stk", "97d2443948b2e367cf567fe7e101f5f2", 4049267),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.000 version.
- {
- "gob1cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.000 version.
- {
- "gob1cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.000 version.
- {
- "gob1cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.000 version.
- {
- "gob1cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.000 version.
- {
- "gob1cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "2fbf4b5b82bbaee87eb45d4404c28998"),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.02 version. Multilingual
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.02 version. Multilingual
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.02 version. Multilingual
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.02 version. Multilingual
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // CD 1.02 version. Multilingual
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
- HU_HUN,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob1cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "40d4a53818f4fce3f5997d02c3fafe73", 4049248),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "Demo",
- AD_ENTRY1("intro.stk", "972f22c6ff8144a6636423f0354ca549"),
- UNK_LANG,
- kPlatformAmiga,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "Interactive Demo",
- AD_ENTRY1("intro.stk", "e72bd1e3828c7dec4c8a3e58c48bdfdb"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "Interactive Demo",
- AD_ENTRY1s("intro.stk", "a796096280d5efd48cf8e7dfbe426eb5", 193595),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2785958
- {
- "gob1",
- "Interactive Demo",
- AD_ENTRY1s("intro.stk", "35a098571af9a03c04e2303aec7c9249", 116582),
- FR_FRA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "gob1",
- "",
- AD_ENTRY1s("intro.stk", "0e022d3f2481b39e9175d37b2c6ad4c6", 2390121),
- FR_FRA,
- kPlatformCDi,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesAdLib,
- 0, "AVT003.TOT", 0
- },
- { // Supplied by fac76 in bug report #1883808
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "eebf2810122cfd17399260cd1468e994", 554014),
- EN_ANY,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "d28b9e9b41f31acfa58dcd12406c7b2c"),
- DE_DEU,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2602057
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "686c88f7302a80b744aae9f8413e853d"),
- IT_ITA,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by bgk in bug report #1706861
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "4b13c02d1069b86bcfec80f4e474b98b", 554680),
- FR_FRA,
- kPlatformAtariST,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by fac76 in bug report #1673397
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "b45b984ee8017efd6ea965b9becd4d66", 828443},
- {"musmac1.mid", 0, "7f96f491448c7a001b32df89cf8d2af2", 1658},
- {0, 0, 0, 0}
- },
- UNK_LANG,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by koalet in bug report #2478585
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "a13ecb4f6d8fd881ebbcc02e45cb5475", 837275},
- {"musmac1.mid", 0, "7f96f491448c7a001b32df89cf8d2af2", 1658},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "b45b984ee8017efd6ea965b9becd4d66"),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "dedb5d31d8c8050a8cf77abedcc53dae"),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by raziel_ in bug report #1891867
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "25a99827cd59751a80bed9620fb677a0", 893302),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "a13ecb4f6d8fd881ebbcc02e45cb5475", 837275),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by blackwhiteeagle in bug report #1605235
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "3e4e7db0d201587dd2df4003b2993ef6"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "a13892cdf4badda85a6f6fb47603a128"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2602017
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "c47faf1d406504e6ffe63243610bb1f4"),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- AD_ENTRY1("intro.stk", "cd3e1df8b273636ee32e34b7064f50e8"),
- RU_RUS,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by arcepi in bug report #1659884
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "5f53c56e3aa2f1e76c2e4f0caa15887f", 829232),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "285d7340f98ebad65d465585da12910b", 837286},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "25a99827cd59751a80bed9620fb677a0", 893302},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- EN_USA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "25a99827cd59751a80bed9620fb677a0", 893302},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "25a99827cd59751a80bed9620fb677a0", 893302},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "6efac0a14c0de4d57dde8592456c8acf", 845172},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- EN_USA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "",
- {
- {"intro.stk", 0, "6efac0a14c0de4d57dde8592456c8acf", 845172},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in french ADI 2 Francais-Maths CM1
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "24489330a1d67ff978211f574822a5a6", 883756),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob2",
- "",
- AD_ENTRY1s("intro.stk", "285d7340f98ebad65d465585da12910b", 837286),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "9de5fbb41cf97182109e5fecc9d90347"),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by pykman in bug report #3067489
- {
- "gob2cd",
- "v2.01 Polish",
- AD_ENTRY1s("intro.stk", "3025f05482b646c18c2c79c615a3a1df", 5011726),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob2cd",
- "v2.01",
- AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob2cd",
- "v2.01",
- AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob2cd",
- "v2.01",
- AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob2cd",
- "v2.01",
- AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob2cd",
- "v2.01",
- AD_ENTRY1("intro.stk", "24a6b32757752ccb1917ce92fd7c2a04"),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob2cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
- HU_HUN,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob2cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob2cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob2cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob2cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "5ba85a4769a1ab03a283dd694588d526", 5006236),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "Non-Interactive Demo",
- AD_ENTRY1("intro.stk", "8b1c98ff2ab2e14f47a1b891e9b92217"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, "usa.tot", 0
- },
- {
- {
- "gob2",
- "Interactive Demo",
- AD_ENTRY1("intro.stk", "cf1c95b2939bd8ff58a25c756cb6125e"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob2",
- "Interactive Demo",
- AD_ENTRY1("intro.stk", "4b278c2678ea01383fd5ca114d947eea"),
- UNK_LANG,
- kPlatformAmiga,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by polluks in bug report #1895126
- {
- "gob2",
- "Interactive Demo",
- AD_ENTRY1s("intro.stk", "9fa85aea959fa8c582085855fbd99346", 553063),
- UNK_LANG,
- kPlatformAmiga,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by vampir_raziel in bug report #1658373
- {
- "ween",
- "",
- {
- {"intro.stk", 0, "bfd9d02faf3d8d60a2cf744f95eb48dd", 456570},
- {"ween.ins", 0, "d2cb24292c9ddafcad07e23382027218", 87800},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by vampir_raziel in bug report #1658373
- {
- "ween",
- "",
- AD_ENTRY1s("intro.stk", "257fe669705ac4971efdfd5656eef16a", 457719),
- FR_FRA,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by vampir_raziel in bug report #1658373
- {
- "ween",
- "",
- AD_ENTRY1s("intro.stk", "dffd1ab98fe76150d6933329ca6f4cc4", 459458),
- FR_FRA,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by vampir_raziel in bug report #1658373
- {
- "ween",
- "",
- AD_ENTRY1s("intro.stk", "af83debf2cbea21faa591c7b4608fe92", 458192),
- DE_DEU,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2563539
- {
- "ween",
- "",
- {
- {"intro.stk", 0, "dffd1ab98fe76150d6933329ca6f4cc4", 459458},
- {"ween.ins", 0, "d2cb24292c9ddafcad07e23382027218", 87800},
- {0, 0, 0, 0}
- },
- IT_ITA,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by pwigren in bug report #1764174
- {
- "ween",
- "",
- {
- {"intro.stk", 0, "bfd9d02faf3d8d60a2cf744f95eb48dd", 456570},
- {"music__5.snd", 0, "7d1819b9981ecddd53d3aacbc75f1cc8", 13446},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformAtariST,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "ween",
- "",
- AD_ENTRY1("intro.stk", "e6d13fb3b858cb4f78a8780d184d5b2c"),
- FR_FRA,
- kPlatformAtariST,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "ween",
- "",
- AD_ENTRY1("intro.stk", "2bb8878a8042244dd2b96ff682381baa"),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "ween",
- "",
- AD_ENTRY1s("intro.stk", "de92e5c6a8c163007ffceebef6e67f7d", 7117568),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by cybot_tmin in bug report #1667743
- {
- "ween",
- "",
- AD_ENTRY1s("intro.stk", "6d60f9205ecfbd8735da2ee7823a70dc", 7014426),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "ween",
- "",
- AD_ENTRY1("intro.stk", "4b10525a3782aa7ecd9d833b5c1d308b"),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by cartman_ on #scummvm
- {
- "ween",
- "",
- AD_ENTRY1("intro.stk", "63170e71f04faba88673b3f510f9c4c8"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by glorfindel in bugreport #1722142
- {
- "ween",
- "",
- AD_ENTRY1s("intro.stk", "8b57cd510da8a3bbd99e3a0297a8ebd1", 7018771),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "ween",
- "Demo",
- AD_ENTRY1("intro.stk", "2e9c2898f6bf206ede801e3b2e7ee428"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, "show.tot", 0
- },
- {
- {
- "ween",
- "Demo",
- AD_ENTRY1("intro.stk", "15fb91a1b9b09684b28ac75edf66e504"),
- EN_USA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeWeen,
- kFeaturesAdLib,
- 0, "show.tot", 0
- },
- {
- {
- "bargon",
- "",
- AD_ENTRY1("intro.stk", "da3c54be18ab73fbdb32db24624a9c23"),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by Trekky in the forums
- {
- "bargon",
- "",
- AD_ENTRY1s("intro.stk", "2f54b330d21f65b04b7c1f8cca76426c", 262109),
- FR_FRA,
- kPlatformAtariST,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by cesardark in bug #1681649
- {
- "bargon",
- "",
- AD_ENTRY1s("intro.stk", "11103b304286c23945560b391fd37e7d", 3181890),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug #1692667
- {
- "bargon",
- "",
- AD_ENTRY1s("intro.stk", "da3c54be18ab73fbdb32db24624a9c23", 3181825),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by pwigren in bugreport #1764174
- {
- "bargon",
- "",
- AD_ENTRY1s("intro.stk", "569d679fe41d49972d34c9fce5930dda", 269825),
- EN_ANY,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by kizkoool in bugreport #2089734
- {
- "bargon",
- "",
- AD_ENTRY1s("intro.stk", "00f6b4e2ee26e5c40b488e2df5adcf03", 3975580),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { // Supplied by glorfindel in bugreport #1722142
- {
- "bargon",
- "Fanmade",
- AD_ENTRY1s("intro.stk", "da3c54be18ab73fbdb32db24624a9c23", 3181825),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "0b72992f5d8b5e6e0330572a5753ea25", 256490),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- {
- {"intro.stk", 0, "0b72992f5d8b5e6e0330572a5753ea25", 256490},
- {"mod.babayaga", 0, "43484cde74e0860785f8e19f0bc776d1", 60248},
- {0, 0, 0, 0}
- },
- UNK_LANG,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
- IT_ITA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- {
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "113a16877e4f72037d9714be1c2b0221", 1187522),
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- { // Found in french ADI 2 Francais-Maths CM1
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- { // Found in french ADI 2 Francais-Maths CM1
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- { // Found in french ADI 2 Francais-Maths CM1
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- { // Found in french ADI 2 Francais-Maths CM1
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
- IT_ITA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
- { // Found in french ADI 2 Francais-Maths CM1
- {
- "littlered",
- "",
- AD_ENTRY1s("intro.stk", "5c15b37ed27ac2470854e9e09374d50e", 1248610),
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib | kFeaturesEGA,
- 0, 0, 0
- },
-// This version is not detected on purpose: it's a pirated version.
-// Tagged ADGF_PIRATED! Do not re-add nor un-tag!
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "3712e7527ba8ce5637d2aadf62783005", 72318),
- FR_FRA,
- kPlatformPC,
- ADGF_PIRATED,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "7b7f48490dedc8a7cb999388e2fadbe3", 3930674),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "e0767783ff662ed93665446665693aef", 4371238),
- HE_ISR,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by cartman_ on #scummvm
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "f1f78b663893b58887add182a77df151", 3944090),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2105220
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "cd322cb3c64ef2ba2f2134aa2122cfe9", 3936700),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by koalet in bug report #2479034
- {
- "lit",
- "",
- {
- {"intro.stk", 0, "af98bcdc70e1f1c1635577fd726fe7f1", 3937310},
- {"musmac1.mid", 0, "ae7229bb09c6abe4e60a2768b24bc890", 9398},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "6263d09e996c1b4e84ef2d650b820e57", 4831170),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2093672
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2093672
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2093672
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2093672
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2093672
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2093672
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "795be7011ec31bf5bb8ce4efdb9ee5d3", 4838904),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4207330),
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4207330),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4207330),
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4219382),
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "0ddf39cea1ec30ecc8bfe444ebd7b845", 4219382),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in french ADI 2.6 Francais-Maths 4e
- {
- "lit",
- "",
- AD_ENTRY1s("intro.stk", "58ee9583a4fb837f02d9a58e5f442656", 3937120),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit1",
- "Full install",
- {
- {"intro.stk", 0, "93c91bc9e783d00033042ae83144d7dd", 72318},
- {"partie2.itk", 0, "78f00bd8eb9e680e6289bba0130b1b33", 4396644},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit1",
- "Light install",
- {
- {"intro.stk", 0, "93c91bc9e783d00033042ae83144d7dd", 72318},
- {"partie2.itk", 0, "78f00bd8eb9e680e6289bba0130b1b33", 664064},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit2",
- "Light install",
- AD_ENTRY1s("intro.stk", "17acbb212e62addbe48dc8f2282c98cb", 72318),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit2",
- "Full install",
- {
- {"intro.stk", 0, "17acbb212e62addbe48dc8f2282c98cb", 72318},
- {"partie4.itk", 0, "6ce4967e0c79d7daeabc6c1d26783d4c", 2612087},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "lit",
- "Demo",
- AD_ENTRY1("demo.stk", "c06f8cc20eb239d4c71f225ce3093edf"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- "demo.stk", "demo.tot", 0
- },
- {
- {
- "lit",
- "Non-interactive Demo",
- AD_ENTRY1("demo.stk", "2eba8abd9e3878c57307576012dd2fec"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- "demo.stk", "demo.tot", 0
- },
- { // Supplied by scoriae
- {
- "fascination",
- "VGA",
- AD_ENTRY1s("disk0.stk", "c14330d052fe4da5a441ac9d81bc5891", 1061955),
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesAdLib,
- "disk0.stk", 0, 0
- },
- { // Supplied by alex86r in bug report #3297633
- {
- "fascination",
- "VGA 3 disks edition",
- AD_ENTRY1s("disk0.stk", "ab3dfdce43917bc806812959d692fc8f", 1061929),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesAdLib,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "VGA 3 disks edition",
- AD_ENTRY1s("disk0.stk", "a50a8495e1b2d67699fb562cb98fc3e2", 1064387),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesAdLib,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "Hebrew edition (censored)",
- AD_ENTRY1s("intro.stk", "d6e45ce548598727e2b5587a99718eba", 1055909),
- HE_ISR,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesAdLib,
- "intro.stk", 0, 0
- },
- { // Supplied by windlepoons in bug report #2809247
- {
- "fascination",
- "VGA 3 disks edition",
- AD_ENTRY1s("disk0.stk", "3a24e60a035250189643c86a9ceafb97", 1062480),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesAdLib,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "VGA",
- AD_ENTRY1s("disk0.stk", "e8ab4f200a2304849f462dc901705599", 183337),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesAdLib,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "",
- AD_ENTRY1s("disk0.stk", "68b1c01564f774c0b640075fbad1b695", 189968),
- DE_DEU,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesNone,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "",
- AD_ENTRY1s("disk0.stk", "7062117e9c5adfb6bfb2dac3ff74df9e", 189951),
- EN_ANY,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesNone,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "",
- AD_ENTRY1s("disk0.stk", "55c154e5a3e8e98afebdcff4b522e1eb", 190005),
- FR_FRA,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesNone,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "",
- AD_ENTRY1s("disk0.stk", "7691827fff35df7799f14cfd6be178ad", 189931),
- IT_ITA,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesNone,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "",
- AD_ENTRY1s("disk0.stk", "aff9fcc619f4dd19eae228affd0d34c8", 189964),
- EN_ANY,
- kPlatformAtariST,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesNone,
- "disk0.stk", 0, 0
- },
- {
- {
- "fascination",
- "CD Version (Censored)",
- AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSUBTITLES)
- },
- kGameTypeFascination,
- kFeaturesCD,
- "intro.stk", 0, 0
- },
- {
- {
- "fascination",
- "CD Version (Censored)",
- AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSUBTITLES)
- },
- kGameTypeFascination,
- kFeaturesCD,
- "intro.stk", 0, 0
- },
- {
- {
- "fascination",
- "CD Version (Censored)",
- AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSUBTITLES)
- },
- kGameTypeFascination,
- kFeaturesCD,
- "intro.stk", 0, 0
- },
- {
- {
- "fascination",
- "CD Version (Censored)",
- AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSUBTITLES)
- },
- kGameTypeFascination,
- kFeaturesCD,
- "intro.stk", 0, 0
- },
- {
- {
- "fascination",
- "CD Version (Censored)",
- AD_ENTRY1s("intro.stk", "9c61e9c22077f72921f07153e37ccf01", 545953),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSUBTITLES)
- },
- kGameTypeFascination,
- kFeaturesCD,
- "intro.stk", 0, 0
- },
- {
- {
- "geisha",
- "",
- AD_ENTRY1s("disk1.stk", "6eebbb98ad90cd3c44549fc2ab30f632", 212153),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGeisha,
- kFeaturesEGA | kFeaturesAdLib,
- "disk1.stk", "intro.tot", 0
- },
- {
- {
- "geisha",
- "",
- AD_ENTRY1s("disk1.stk", "f4d4d9d20f7ad1f879fc417d47faba89", 336732),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGeisha,
- kFeaturesEGA | kFeaturesAdLib,
- "disk1.stk", "intro.tot", 0
- },
- {
- {
- "geisha",
- "",
- AD_ENTRY1s("disk1.stk", "e5892f00917c62423e93f5fd9920cf47", 208120),
- UNK_LANG,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGeisha,
- kFeaturesEGA,
- "disk1.stk", "intro.tot", 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1s("intro.stk", "32b0f57f5ae79a9ae97e8011df38af42", 157084),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1s("intro.stk", "904fc32032295baa3efb3a41f17db611", 178582),
- HE_ISR,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by raziel_ in bug report #1891869
- {
- "gob3",
- "",
- AD_ENTRY1s("intro.stk", "16b014bf32dbd6ab4c5163c44f56fed1", 445104),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "16b014bf32dbd6ab4c5163c44f56fed1", 445104},
- {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "16b014bf32dbd6ab4c5163c44f56fed1", 445104},
- {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "16b014bf32dbd6ab4c5163c44f56fed1", 445104},
- {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by fac76 in bug report #1742716
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "32b0f57f5ae79a9ae97e8011df38af42", 157084},
- {"musmac1.mid", 0, "834e55205b710d0af5f14a6f2320dd8e", 8661},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "1e2f64ec8dfa89f42ee49936a27e66e7"),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by paul66 in bug report #1652352
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "f6d225b25a180606fa5dbe6405c97380"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "e42a4f2337d6549487a80864d7826972"),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by Paranoimia on #scummvm
- {
- "gob3",
- "",
- AD_ENTRY1s("intro.stk", "fe8144daece35538085adb59c2d29613", 159402),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "4e3af248a48a2321364736afab868527"),
- RU_RUS,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "8d28ce1591b0e9cc79bf41cad0fc4c9c"),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Supplied by SiRoCs in bug report #2098621
- {
- "gob3",
- "",
- AD_ENTRY1s("intro.stk", "d3b72938fbbc8159198088811f9e6d19", 160382),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "bd679eafde2084d8011f247e51b5a805"),
- EN_GRB,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesNone,
- 0, "menu.tot", 0
- },
- {
- {
- "gob3",
- "",
- AD_ENTRY1("intro.stk", "bd679eafde2084d8011f247e51b5a805"),
- DE_DEU,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesNone,
- 0, "menu.tot", 0
- },
- {
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "edd7403e5dc2a14459d2665a4c17714d", 209534},
- {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "428e2de130cf3b303c938924539dc50d", 324420},
- {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "",
- {
- {"intro.stk", 0, "428e2de130cf3b303c938924539dc50d", 324420},
- {"musmac1.mid", 0, "948c546cad3a9de5bff3fe4107c82bf1", 6404},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { // Found in Found in french ADI 2.5 Anglais Multimedia 5e
- {
- "gob3",
- "",
- AD_ENTRY1s("intro.stk", "edd7403e5dc2a14459d2665a4c17714d", 209534),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3cd",
- "v1.000",
- AD_ENTRY1("intro.stk", "6f2c226c62dd7ab0ab6f850e89d3fc47"),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by pykman in bug report #3067489
- {
- "gob3cd",
- "v1.02 Polish",
- AD_ENTRY1s("intro.stk", "978afddcac81bb95a04757b61f78471c", 619825),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
- HU_HUN,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2810082
- {
- "gob3cd",
- "v1.02",
- AD_ENTRY1s("intro.stk", "bfd7d4c6fedeb2cfcc8baa4d5ddb1f74", 616220),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "Interactive Demo",
- AD_ENTRY1("intro.stk", "7aebd94e49c2c5c518c9e7b74f25de9d"),
- FR_FRA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "Interactive Demo 2",
- AD_ENTRY1("intro.stk", "e5dcbc9f6658ebb1e8fe26bc4da0806d"),
- FR_FRA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "Interactive Demo 3",
- AD_ENTRY1s("intro.stk", "9e20ad7b471b01f84db526da34eaf0a2", 395561),
- EN_ANY,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "gob3",
- "Non-interactive Demo",
- AD_ENTRY1("intro.stk", "b9b898fccebe02b69c086052d5024a55"),
- UNK_LANG,
- kPlatformPC,
- ADGF_DEMO,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "47c3b452767c4f49ea7b109143e77c30", 916828),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesCD,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "1fa92b00fe80a20f34ec34a8e2fa869e", 923072),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "1fa92b00fe80a20f34ec34a8e2fa869e", 923072),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "1fa92b00fe80a20f34ec34a8e2fa869e", 923072),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
- EN_USA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
- DE_DEU,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
- IT_ITA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
- ES_ESP,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "",
- AD_ENTRY1s("intro.stk", "d33011df8758ac64ca3dca77c7719001", 908612),
- FR_FRA,
- kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "inca2",
- "Non-Interactive Demo",
- {
- {"cons.imd", 0, "f896ba0c4a1ac7f7260d342655980b49", 17804},
- {"conseil.imd", 0, "aaedd5482d5b271e233e86c5a03cf62e", 33999},
- {"int.imd", 0, "6308222fcefbcb20925f01c1aff70dee", 30871},
- {"inter.imd", 0, "39bd6d3540f3bedcc97293f352c7f3fc", 191719},
- {"machu.imd", 0, "c0bc8211d93b467bfd063b63fe61b85c", 34609},
- {"post.imd", 0, "d75cad0e3fc22cb0c8b6faf597f509b2", 1047709},
- {"posta.imd", 0, "2a5b3fe75681ddf4d21ac724db8111b4", 547250},
- {"postb.imd", 0, "24260ce4e80a4c472352b76637265d09", 868312},
- {"postc.imd", 0, "24accbcc8b83a9c2be4bd82849a2bd29", 415637},
- {"tum.imd", 0, "0993d4810ec9deb3f77c5e92095320fd", 20330},
- {"tumi.imd", 0, "bf53f229480d694de0947fe3366fbec6", 248952},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeInca2,
- kFeaturesAdLib | kFeaturesBATDemo,
- 0, 0, 7
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "dccf9d31cb720b34d75487408821b77e", 20296390),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "b50fee012a5abcd0ac2963e1b4b56bec", 20298108),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "5f5f4e0a72c33391e67a47674b120cc6", 20296422),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by jvprat on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by jvprat on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by jvprat on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by jvprat on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by jvprat on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "270529d9b8cce770b1575908a3800b52", 20296452),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "f4c344023b073782d2fddd9d8b515318", 7069736),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "f4c344023b073782d2fddd9d8b515318", 7069736),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "f4c344023b073782d2fddd9d8b515318", 7069736),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by DjDiabolik in bug report #1971294
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by DjDiabolik in bug report #1971294
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by DjDiabolik in bug report #1971294
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by DjDiabolik in bug report #1971294
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by DjDiabolik in bug report #1971294
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "60348a87651f92e8492ee070556a96d8", 7069736),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2098838
- {
- "woodruff",
- "",
- AD_ENTRY1s("intro.stk", "08a96bf061af1fa4f75c6a7cc56b60a4", 20734979),
- PL_POL,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "woodruff",
- "Non-Interactive Demo",
- {
- {"demo.scn", 0, "16bb85fc5f8e519147b60475dbf33962", 89},
- {"wooddem3.vmd", 0, "a1700596172c2d4e264760030c3a3d47", 8994250},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 1
- },
- {
- {
- "dynasty",
- "",
- AD_ENTRY1s("intro.stk", "6190e32404b672f4bbbc39cf76f41fda", 2511470),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "dynasty",
- "",
- AD_ENTRY1s("intro.stk", "61e4069c16e27775a6cc6d20f529fb36", 2511300),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "dynasty",
- "",
- AD_ENTRY1s("intro.stk", "61e4069c16e27775a6cc6d20f529fb36", 2511300),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "dynasty",
- "",
- AD_ENTRY1s("intro.stk", "b3f8472484b7a1df94557b51e7b6fca0", 2322644),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "dynasty",
- "",
- AD_ENTRY1s("intro.stk", "bdbdac8919200a5e71ffb9fb0709f704", 2446652),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "dynasty",
- "Demo",
- AD_ENTRY1s("intro.stk", "464538a17ed39755d7f1ba9c751af1bd", 1847864),
- EN_USA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "dynasty",
- "Demo",
- AD_ENTRY1s("lda1.stk", "0e56a899357cbc0bf503260fd2dd634e", 15032774),
- UNK_LANG,
- kPlatformWindows,
- ADGF_DEMO,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- "lda1.stk", 0, 0
- },
- {
- {
- "dynasty",
- "Demo",
- AD_ENTRY1s("lda1.stk", "8669ea2e9a8239c070dc73958fbc8753", 15567724),
- DE_DEU,
- kPlatformWindows,
- ADGF_DEMO,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeDynasty,
- kFeatures640x480,
- "lda1.stk", 0, 0
- },
- {
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "3ab2c542bd9216ae5d02cc6f45701ae1", 1252436),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { // Supplied by Collector9 in bug report #3228040
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "6ce3d878178932053267237ec4843ce1", 1252518),
- EN_USA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { // Supplied by gamin in the forums
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "b991ed1d31c793e560edefdb349882ef", 1276408),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { // Supplied by jvprat on #scummvm
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "4ec3c0864e2b54c5b4ccf9f6ad96528d", 1253328),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { // Supplied by Alex on the gobsmacked blog
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "9ea647085a16dd0fb9ecd84cd8778ec9", 1253436),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { // Supplied by alex86r in bug report #3297602
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "4e4a3c017fe5475353bf94c455fe3efd", 1253448),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { // Supplied by goodoldgeorg in bug report #2770340
- {
- "urban",
- "",
- AD_ENTRY1s("intro.stk", "4bd31979ea3d77a58a358c09000a85ed", 1253018),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- {
- {
- "urban",
- "Non-Interactive Demo",
- {
- {"wdemo.s24", 0, "14ac9bd51db7a075d69ddb144904b271", 87},
- {"demo.vmd", 0, "65d04715d871c292518b56dd160b0161", 9091237},
- {"urband.vmd", 0, "60343891868c91854dd5c82766c70ecc", 922461},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor | kFeaturesSCNDemo,
- 0, 0, 2
- },
- {
- {
- "playtoons1",
- "",
- {
- {"playtoon.stk", 0, "8c98e9a11be9bb203a55e8c6e68e519b", 25574338},
- {"archi.stk", 0, "8d44b2a0d4e3139471213f9f0ed21e81", 5524674},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons1",
- "Pack mes histoires anim\xE9""es",
- {
- {"playtoon.stk", 0, "55f0293202963854192e39474e214f5f", 30448474},
- {"archi.stk", 0, "8d44b2a0d4e3139471213f9f0ed21e81", 5524674},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons1",
- "",
- {
- {"playtoon.stk", 0, "c5ca2a288cdaefca9556cd9ae4b579cf", 25158926},
- {"archi.stk", 0, "8d44b2a0d4e3139471213f9f0ed21e81", 5524674},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- { // Supplied by scoriae in the forums
- {
- "playtoons1",
- "",
- {
- {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
- {"archi.stk", 0, "00d8274519dfcf8a0d8ae3099daea0f8", 5532135},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons1",
- "Non-Interactive Demo",
- {
- {"play123.scn", 0, "4689a31f543915e488c3bc46ea358add", 258},
- {"archi.vmd", 0, "a410fcc8116bc173f038100f5857191c", 5617210},
- {"chato.vmd", 0, "5a10e39cb66c396f2f9d8fb35e9ac016", 5445937},
- {"genedeb.vmd", 0, "3bb4a45585f88f4d839efdda6a1b582b", 1244228},
- {"generik.vmd", 0, "b46bdd64b063e86927fb2826500ad512", 603242},
- {"genespi.vmd", 0, "b7611916f32a370ae9832962fc17ef72", 758719},
- {"spirou.vmd", 0, "8513dbf7ac51c057b21d371d6b217b47", 2550788},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 3
- },
- {
- {
- "playtoons1",
- "Non-Interactive Demo",
- {
- {"e.scn", 0, "8a0db733c3f77be86e74e8242e5caa61", 124},
- {"demarchg.vmd", 0, "d14a95da7d8792faf5503f649ffcbc12", 5619415},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 4
- },
- {
- {
- "playtoons1",
- "Non-Interactive Demo",
- {
- {"i.scn", 0, "8b3294474d39970463663edd22341730", 285},
- {"demarita.vmd", 0, "84c8672b91c7312462603446e224bfec", 5742533},
- {"dembouit.vmd", 0, "7a5fdf0a4dbdfe72e31dd489ea0f8aa2", 3536786},
- {"demo5.vmd", 0, "2abb7b6a26406c984f389f0b24b5e28e", 13290970},
- {"demoita.vmd", 0, "b4c0622d14c8749965cd0f5dfca4cf4b", 1183566},
- {"wooddem3.vmd", 0, "a1700596172c2d4e264760030c3a3d47", 8994250},
- {0, 0, 0, 0}
- },
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 5
- },
- {
- {
- "playtoons1",
- "Non-Interactive Demo",
- {
- {"s.scn", 0, "1f527010626b5490761f16ba7a6f639a", 251},
- {"demaresp.vmd", 0, "3f860f944056842b35a5fd05416f208e", 5720619},
- {"demboues.vmd", 0, "3a0caa10c98ef92a15942f8274075b43", 3535838},
- {"demo5.vmd", 0, "2abb7b6a26406c984f389f0b24b5e28e", 13290970},
- {"wooddem3.vmd", 0, "a1700596172c2d4e264760030c3a3d47", 8994250},
- {0, 0, 0, 0}
- },
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 6
- },
- {
- {
- "playtoons2",
- "",
- {
- {"playtoon.stk", 0, "4772c96be88a57f0561519e4a1526c62", 24406262},
- {"spirou.stk", 0, "5d9c7644d0c47840169b4d016765cc1a", 9816201},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons2",
- "",
- {
- {"playtoon.stk", 0, "55a85036dd93cce93532d8f743d90074", 17467154},
- {"spirou.stk", 0, "e3e1b6148dd72fafc3637f1a8e5764f5", 9812043},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons2",
- "",
- {
- {"playtoon.stk", 0, "c5ca2a288cdaefca9556cd9ae4b579cf", 25158926},
- {"spirou.stk", 0, "91080dc148de1bbd6a97321c1a1facf3", 9817086},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- { // Supplied by Hkz
- {
- "playtoons2",
- "",
- {
- {"playtoon.stk", 0, "2572685400852d12759a2fbf09ec88eb", 9698780},
- {"spirou.stk", 0, "d3cfeff920b6343a2ece55088f530dba", 7076608},
- {0, 0, 0, 0}
- },
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- { // Supplied by scoriae in the forums
- {
- "playtoons2",
- "",
- {
- {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
- {"spirou.stk", 0, "993737f112ca6a9b33c814273280d832", 9825760},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons3",
- "",
- {
- {"playtoon.stk", 0, "8c98e9a11be9bb203a55e8c6e68e519b", 25574338},
- {"chato.stk", 0, "4fa4ed96a427c344e9f916f9f236598d", 6033793},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons3",
- "",
- {
- {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
- {"chato.stk", 0, "8fc8d0da5b3e758908d1d7298d497d0b", 6041026},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons3",
- "Pack mes histoires anim\xE9""es",
- {
- {"playtoon.stk", 0, "55f0293202963854192e39474e214f5f", 30448474},
- {"chato.stk", 0, "4fa4ed96a427c344e9f916f9f236598d", 6033793},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons3",
- "",
- {
- {"playtoon.stk", 0, "c5ca2a288cdaefca9556cd9ae4b579cf", 25158926},
- {"chato.stk", 0, "3c6cb3ac8a5a7cf681a19971a92a748d", 6033791},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- { // Supplied by Hkz on #scummvm
- {
- "playtoons3",
- "",
- {
- {"playtoon.stk", 0, "4772c96be88a57f0561519e4a1526c62", 24406262},
- {"chato.stk", 0, "bdef407387112bfcee90e664865ac3af", 6033867},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons4",
- "",
- {
- {"playtoon.stk", 0, "b7f5afa2dc1b0f75970b7c07d175db1b", 24340406},
- {"manda.stk", 0, "92529e0b927191d9898a34c2892e9a3a", 6485072},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- { //Supplied by goodoldgeorg in bug report #2820006
- {
- "playtoons4",
- "",
- {
- {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506},
- {"manda.stk", 0, "69a79c9f61b2618e482726f2ff68078d", 6499208},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtoons5",
- "",
- {
- {"playtoon.stk", 0, "55f0293202963854192e39474e214f5f", 30448474},
- {"wakan.stk", 0, "f493bf82851bc5ba74d57de6b7e88df8", 5520153},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "bambou",
- "",
- {
- {"intro.stk", 0, "2f8db6963ff8d72a8331627ebda918f4", 3613238},
- {"bambou.itk", 0, "0875914d31126d0749313428f10c7768", 114440192},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeBambou,
- kFeatures640x480,
- "intro.stk", "intro.tot", 0
- },
- {
- {
- "playtnck1",
- "",
- {
- {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024},
- {"dan.itk", 0, "906d67b3e438d5e95ec7ea9e781a94f3", 3000320},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtnck2",
- "",
- {
- {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024},
- {"dan.itk", 0, "74eeb075bd2cb47b243349730264af01", 3213312},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "playtnck3",
- "",
- {
- {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024},
- {"dan.itk", 0, "9a8f62809eca5a52f429b5b6a8e70f8f", 2861056},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- "intro2.stk", 0, 0
- },
- {
- {
- "adi2",
- "Adi 2.0 for Teachers",
- AD_ENTRY1s("adi2.stk", "da6f1fb68bff32260c5eecdf9286a2f5", 1533168),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdi2,
- kFeaturesNone,
- "adi2.stk", "ediintro.tot", 0
- },
- { // Found in french ADI 2 Francais-Maths CM1. Exact version not specified.
- {
- "adi2",
- "Adi 2",
- AD_ENTRY1s("adi2.stk", "23f279615c736dc38320f1348e70c36e", 10817668),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- { // Found in french ADI 2 Francais-Maths CE2. Exact version not specified.
- {
- "adi2",
- "Adi 2",
- AD_ENTRY1s("adi2.stk", "d4162c4298f9423ecc1fb04965557e90", 11531214),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2",
- AD_ENTRY1s("adi2.stk", "29694c5a649298a42f87ae731d6d6f6d", 311132),
- EN_ANY,
- kPlatformAmiga,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdi2,
- kFeaturesNone,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2",
- AD_ENTRY1s("adi2.stk", "2a40bb48ccbd4e6fb3f7f0fc2f069d80", 17720132),
- ES_ESP,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2.5",
- AD_ENTRY1s("adi2.stk", "fcac60e6627f37aee219575b60859de9", 16944268),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2.5",
- AD_ENTRY1s("adi2.stk", "072d5e2d7826a7c055865568ebf918bb", 16934596),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2.6",
- AD_ENTRY1s("adi2.stk", "2fb940eb8105b12871f6b88c8c4d1615", 16780058),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2.6",
- AD_ENTRY1s("adi2.stk", "fde7d98a67dbf859423b6473796e932a", 18044780),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Adi 2.7.1",
- AD_ENTRY1s("adi2.stk", "6fa5dffebf5c7243c6af6b8c188ee00a", 19278008),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", "ediintro.tot", 0
- },
- {
- {
- "adi2",
- "Non-Interactive Demo",
- {
- {"demo.scn", 0, "8b5ba359fd87d586ad39c1754bf6ea35", 168},
- {"demadi2t.vmd", 0, "08a1b18cfe2015d3b43270da35cc813d", 7250723},
- {"demarch.vmd", 0, "4c4a4616585d40ef3df209e3c3911062", 5622731},
- {"demobou.vmd", 0, "2208b9855775564d15c4a5a559da0aec", 3550511},
- {0, 0, 0, 0}
- },
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 1
- },
- {
- {
- "adi4",
- "Addy 4 Grundschule Basis CD",
- AD_ENTRY1s("intro.stk", "d2f0fb8909e396328dc85c0e29131ba8", 5847588),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Addy 4 Sekundarstufe Basis CD",
- AD_ENTRY1s("intro.stk", "367340e59c461b4fa36651cd74e32c4e", 5847378),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Adi 4.0",
- AD_ENTRY1s("intro.stk", "a3c35d19b2d28ea261d96321d208cb5a", 6021466),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Adi 4.0",
- AD_ENTRY1s("intro.stk", "44491d85648810bc6fcf84f9b3aa47d5", 5834944),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Adi 4.0",
- AD_ENTRY1s("intro.stk", "29374c0e3c10b17dd8463b06a55ad093", 6012072),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Adi 4.0 Limited Edition",
- AD_ENTRY1s("intro.stk", "ebbbc5e28a4adb695535ed989c1b8d66", 5929644),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "ADI 4.10",
- AD_ENTRY1s("intro.stk", "3e3fa9656e37d802027635ace88c4cc5", 5359144),
- EN_GRB,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "ADI 4.10",
- AD_ENTRY1s("intro.stk", "6afc2590856433b9f5295b032f2b205d", 5923112),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "ADI 4.11",
- AD_ENTRY1s("intro.stk", "6296e4be4e0c270c24d1330881900c7f", 5921234),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Addy 4.21",
- AD_ENTRY1s("intro.stk", "534f0b674cd4830df94a9c32c4ea7225", 6878034),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "ADI 4.21",
- AD_ENTRY1s("intro.stk", "c5b9f6222c0b463f51dab47317c5b687", 5950490),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Adi 4.0 Interactive Demo",
- AD_ENTRY1s("intro.stk", "89ace204dbaac001425c73f394334f6f", 2413102),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "adi4",
- "Adi 4.0 / Adibou 2 Demo",
- AD_ENTRY1s("intro.stk", "d41d8cd98f00b204e9800998ecf8427e", 0),
- FR_FRA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- 0, 0, 0
- },
- {
- {
- "ajworld",
- "",
- AD_ENTRY1s("intro.stk", "e453bea7b28a67c930764d945f64d898", 3913628),
- EN_ANY,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "adibou1",
- "ADIBOU 1 Environnement 4-7 ans",
- AD_ENTRY1s("intro.stk", "6db110188fcb7c5208d9721b5282682a", 4805104),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeAdibou1,
- kFeaturesAdLib,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU 2",
- AD_ENTRY1s("intro.stk", "94ae7004348dc8bf99c23a9a6ef81827", 956162),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "Le Jardin Magique d'Adibou",
- AD_ENTRY1s("intro.stk", "a8ff86f3cc40dfe5898e0a741217ef27", 956328),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU 2",
- AD_ENTRY1s("intro.stk", "092707829555f27706920e4cacf1fada", 8737958),
- DE_DEU,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIB\xD9 2",
- AD_ENTRY1s("intro.stk", "092707829555f27706920e4cacf1fada", 8737958),
- IT_ITA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU Version Decouverte",
- AD_ENTRY1s("intro.stk", "558c14327b79ed39214b49d567a75e33", 8737856),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU 2.10 Environnement",
- AD_ENTRY1s("intro.stk", "f2b797819aeedee557e904b0b5ccd82e", 8736454),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU 2.11 Environnement",
- AD_ENTRY1s("intro.stk", "7b1f1f6f6477f54401e95d913f75e333", 8736904),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU 2.12 Environnement",
- AD_ENTRY1s("intro.stk", "1e49c39a4a3ce6032a84b712539c2d63", 8738134),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOU 2.13s Environnement",
- AD_ENTRY1s("intro.stk", "092707829555f27706920e4cacf1fada", 8737958),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "ADIBOO 2.14 Environnement",
- AD_ENTRY1s("intro.stk", "ff63637e3cb7f0a457edf79457b1c6b3", 9333874),
- FR_FRA,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO0()
- },
- kGameTypeAdibou2,
- kFeaturesNone,
- 0, 0, 0
- },
- {
- {
- "adibou2",
- "Non-Interactive Demo",
- {
- {"demogb.scn", 0, "9291455a908ac0e6aaaca686e532609b", 105},
- {"demogb.vmd", 0, "bc9c1db97db7bec8f566332444fa0090", 14320840},
- {0, 0, 0, 0}
- },
- EN_GRB,
- kPlatformPC,
- ADGF_DEMO,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeAdibou2,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 9
- },
- {
- {
- "adibou2",
- "Non-Interactive Demo",
- {
- {"demoall.scn", 0, "c8fd308c037b829800006332b2c32674", 106},
- {"demoall.vmd", 0, "4672b2deacc6fca97484840424b1921b", 14263433},
- {0, 0, 0, 0}
- },
- DE_DEU,
- kPlatformPC,
- ADGF_DEMO,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeAdibou2,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 10
- },
- {
- {
- "adibou2",
- "Non-Interactive Demo",
- {
- {"demofra.scn", 0, "d1b2b1618af384ea1120def8b986c02b", 106},
- {"demofra.vmd", 0, "b494cdec1aac7e54c3f2480512d2880e", 14297100},
- {0, 0, 0, 0}
- },
- FR_FRA,
- kPlatformPC,
- ADGF_DEMO,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeAdibou2,
- kFeatures640x480 | kFeaturesSCNDemo,
- 0, 0, 11
- },
- { AD_TABLE_END_MARKER, kGameTypeNone, kFeaturesNone, 0, 0, 0}
-};
-
-static const GOBGameDescription fallbackDescs[] = {
- { //0
- {
- "gob1",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesNone,
- 0, 0, 0
- },
- { //1
- {
- "gob1cd",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob1,
- kFeaturesCD,
- 0, 0, 0
- },
- { //2
- {
- "gob2",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { //3
- {
- "gob2mac",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { //4
- {
- "gob2cd",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob2,
- kFeaturesCD,
- 0, 0, 0
- },
- { //5
- {
- "bargon",
- "",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeBargon,
- kFeaturesNone,
- 0, 0, 0
- },
- { //6
- {
- "gob3",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { //7
- {
- "gob3cd",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGob3,
- kFeaturesCD,
- 0, 0, 0
- },
- { //8
- {
- "woodruff",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeWoodruff,
- kFeatures640x480,
- 0, 0, 0
- },
- { //9
- {
- "lostintime",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { //10
- {
- "lostintime",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformMacintosh,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesAdLib,
- 0, 0, 0
- },
- { //11
- {
- "lostintime",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeLostInTime,
- kFeaturesCD,
- 0, 0, 0
- },
- { //12
- {
- "urban",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeatures640x480 | kFeaturesTrueColor,
- 0, 0, 0
- },
- { //13
- {
- "playtoons1",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- 0, 0, 0
- },
- { //14
- {
- "playtoons2",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- 0, 0, 0
- },
- { //15
- {
- "playtoons3",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- 0, 0, 0
- },
- { //16
- {
- "playtoons4",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- 0, 0, 0
- },
- { //17
- {
- "playtoons5",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- 0, 0, 0
- },
- { //18
- {
- "playtoons construction kit",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypePlaytoons,
- kFeatures640x480,
- 0, 0, 0
- },
- { //19
- {
- "bambou",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeBambou,
- kFeatures640x480,
- 0, 0, 0
- },
- { //20
- {
- "fascination",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeFascination,
- kFeaturesNone,
- "disk0.stk", 0, 0
- },
- { //21
- {
- "geisha",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
- },
- kGameTypeGeisha,
- kFeaturesEGA,
- "disk1.stk", "intro.tot", 0
- },
- { //22
- {
- "adi2",
- "",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeAdi2,
- kFeatures640x480,
- "adi2.stk", 0, 0
- },
- { //23
- {
- "adi4",
- "",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
- },
- kGameTypeAdi4,
- kFeatures640x480,
- "adif41.stk", 0, 0
- },
- { //24
- {
- "coktelplayer",
- "unknown",
- AD_ENTRY1(0, 0),
- UNK_LANG,
- kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOASPECT)
- },
- kGameTypeUrban,
- kFeaturesAdLib | kFeatures640x480 | kFeaturesSCNDemo,
- "", "", 8
- }
-};
-
-static const ADFileBasedFallback fileBased[] = {
- { &fallbackDescs[ 0].desc, { "intro.stk", "disk1.stk", "disk2.stk", "disk3.stk", "disk4.stk", 0 } },
- { &fallbackDescs[ 1].desc, { "intro.stk", "gob.lic", 0 } },
- { &fallbackDescs[ 2].desc, { "intro.stk", 0 } },
- { &fallbackDescs[ 2].desc, { "intro.stk", "disk2.stk", "disk3.stk", 0 } },
- { &fallbackDescs[ 3].desc, { "intro.stk", "disk2.stk", "disk3.stk", "musmac1.mid", 0 } },
- { &fallbackDescs[ 4].desc, { "intro.stk", "gobnew.lic", 0 } },
- { &fallbackDescs[ 5].desc, { "intro.stk", "scaa.imd", "scba.imd", "scbf.imd", 0 } },
- { &fallbackDescs[ 6].desc, { "intro.stk", "imd.itk", 0 } },
- { &fallbackDescs[ 7].desc, { "intro.stk", "mus_gob3.lic", 0 } },
- { &fallbackDescs[ 8].desc, { "intro.stk", "woodruff.itk", 0 } },
- { &fallbackDescs[ 9].desc, { "intro.stk", "commun1.itk", 0 } },
- { &fallbackDescs[10].desc, { "intro.stk", "commun1.itk", "musmac1.mid", 0 } },
- { &fallbackDescs[11].desc, { "intro.stk", "commun1.itk", "lost.lic", 0 } },
- { &fallbackDescs[12].desc, { "intro.stk", "cd1.itk", "objet1.itk", 0 } },
- { &fallbackDescs[13].desc, { "playtoon.stk", "archi.stk", 0 } },
- { &fallbackDescs[14].desc, { "playtoon.stk", "spirou.stk", 0 } },
- { &fallbackDescs[15].desc, { "playtoon.stk", "chato.stk", 0 } },
- { &fallbackDescs[16].desc, { "playtoon.stk", "manda.stk", 0 } },
- { &fallbackDescs[17].desc, { "playtoon.stk", "wakan.stk", 0 } },
- { &fallbackDescs[18].desc, { "playtoon.stk", "dan.itk" } },
- { &fallbackDescs[19].desc, { "intro.stk", "bambou.itk", 0 } },
- { &fallbackDescs[20].desc, { "disk0.stk", "disk1.stk", "disk2.stk", "disk3.stk", 0 } },
- { &fallbackDescs[21].desc, { "disk1.stk", "disk2.stk", "disk3.stk", 0 } },
- { &fallbackDescs[22].desc, { "adi2.stk", 0 } },
- { &fallbackDescs[23].desc, { "adif41.stk", "adim41.stk", 0 } },
- { &fallbackDescs[24].desc, { "coktelplayer.scn", 0 } },
- { 0, { 0 } }
-};
-
-}
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 4b659f51de..8c6919416d 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -117,6 +117,15 @@ Draw::Draw(GobEngine *vm) : _vm(vm) {
_cursorAnimDelays[i] = 0;
}
+ _cursorCount = 0;
+ _doCursorPalettes = 0;
+ _cursorPalettes = 0;
+ _cursorKeyColors = 0;
+ _cursorPaletteStarts = 0;
+ _cursorPaletteCounts = 0;
+ _cursorHotspotsX = 0;
+ _cursorHotspotsY = 0;
+
_palLoadData1[0] = 0;
_palLoadData1[1] = 17;
_palLoadData1[2] = 34;
@@ -134,6 +143,14 @@ Draw::Draw(GobEngine *vm) : _vm(vm) {
}
Draw::~Draw() {
+ delete[] _cursorPalettes;
+ delete[] _doCursorPalettes;
+ delete[] _cursorKeyColors;
+ delete[] _cursorPaletteStarts;
+ delete[] _cursorPaletteCounts;
+ delete[] _cursorHotspotsX;
+ delete[] _cursorHotspotsY;
+
for (int i = 0; i < kFontCount; i++)
delete _fonts[i];
}
@@ -239,7 +256,7 @@ void Draw::blitInvalidated() {
if (_cursorIndex == 4)
blitCursor();
- if (_vm->_inter->_terminate)
+ if (_vm->_inter && _vm->_inter->_terminate)
return;
if (_noInvalidated && !_applyPal)
@@ -254,7 +271,9 @@ void Draw::blitInvalidated() {
return;
}
- _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
+ if (_cursorSprites)
+ _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
+
if (_applyPal) {
clearPalette();
forceBlit();
@@ -408,28 +427,13 @@ int Draw::stringLength(const char *str, uint16 fontIndex) {
return len;
}
-void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2,
- int16 transp, Surface &dest, const Font &font) {
-
- while (*str != '\0') {
- const int16 charRight = x + font.getCharWidth(*str);
- const int16 charBottom = y + font.getCharHeight();
-
- if ((charRight <= dest.getWidth()) && (charBottom <= dest.getHeight()))
- font.drawLetter(dest, *str, x, y, color1, color2, transp);
-
- x += font.getCharWidth(*str);
- str++;
- }
-}
-
void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right,
int16 bottom, const char *str, int16 fontIndex, int16 color) {
adjustCoords(1, &left, &top);
adjustCoords(1, &right, &bottom);
- uint16 centerOffset = _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter);
+ uint16 centerOffset = _vm->_game->_script ? _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter) : 0;
if (centerOffset != 0) {
_vm->_game->_script->call(centerOffset);
@@ -488,7 +492,7 @@ void Draw::oPlaytoons_sub_F_1B(uint16 id, int16 left, int16 top, int16 right, in
adjustCoords(1, &left, &top);
adjustCoords(1, &right, &bottom);
- uint16 centerOffset = _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter);
+ uint16 centerOffset = _vm->_game->_script ? _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter) : 0;
if (centerOffset != 0) {
_vm->_game->_script->call(centerOffset);
diff --git a/engines/gob/draw.h b/engines/gob/draw.h
index 393822c33a..b51c6466e0 100644
--- a/engines/gob/draw.h
+++ b/engines/gob/draw.h
@@ -32,7 +32,8 @@ namespace Gob {
#define RENDERFLAG_COLLISIONS 0x0004
#define RENDERFLAG_CAPTUREPOP 0x0008
#define RENDERFLAG_USEDELTAS 0x0010
-#define RENDERFLAG_UNKNOWN 0x0080
+#define RENDERFLAG_BORDERHOTSPOTS 0x0040
+#define RENDERFLAG_HASWINDOWS 0x0080
#define RENDERFLAG_NOBLITINVALIDATED 0x0200
#define RENDERFLAG_NOSUBTITLES 0x0400
#define RENDERFLAG_FROMSPLIT 0x0800
@@ -145,6 +146,15 @@ public:
int8 _cursorAnimHigh[40];
int8 _cursorAnimDelays[40];
+ int32 _cursorCount;
+ bool *_doCursorPalettes;
+ byte *_cursorPalettes;
+ byte *_cursorKeyColors;
+ uint16 *_cursorPaletteStarts;
+ uint16 *_cursorPaletteCounts;
+ int32 *_cursorHotspotsX;
+ int32 *_cursorHotspotsY;
+
int16 _palLoadData1[4];
int16 _palLoadData2[4];
@@ -184,8 +194,6 @@ public:
adjustCoords(adjust, (int16 *)coord1, (int16 *)coord2);
}
int stringLength(const char *str, uint16 fontIndex);
- void drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2,
- int16 transp, Surface &dest, const Font &font);
void printTextCentered(int16 id, int16 left, int16 top, int16 right,
int16 bottom, const char *str, int16 fontIndex, int16 color);
void oPlaytoons_sub_F_1B( uint16 id, int16 left, int16 top, int16 right, int16 bottom, char *paramStr, int16 var3, int16 var4, int16 shortId);
@@ -249,6 +257,8 @@ public:
private:
uint8 _mayorWorkaroundStatus;
+
+ void fixLittleRedStrings();
};
class Draw_Bargon: public Draw_v2 {
diff --git a/engines/gob/draw_fascin.cpp b/engines/gob/draw_fascin.cpp
index 69e04f74c9..12009d7ee5 100644
--- a/engines/gob/draw_fascin.cpp
+++ b/engines/gob/draw_fascin.cpp
@@ -222,8 +222,8 @@ void Draw_Fascination::spriteOperation(int16 operation) {
_destSpriteX, _destSpriteY, _frontColor, _backColor, _transparency);
}
} else {
- drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor,
- _backColor, _transparency, *_spritesArray[_destSurface], *font);
+ font->drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor,
+ _backColor, _transparency, *_spritesArray[_destSurface]);
_destSpriteX += len * font->getCharWidth();
}
} else {
@@ -747,7 +747,7 @@ int16 Draw_Fascination::openWin(int16 id) {
int16 Draw_Fascination::getWinFromCoord(int16 &dx, int16 &dy) {
int16 bestMatch = -1;
- if ((_renderFlags & 128) == 0)
+ if (!(_renderFlags & RENDERFLAG_HASWINDOWS))
return -1;
for (int i = 0; i < 10; i++) {
@@ -790,7 +790,7 @@ int16 Draw_Fascination::handleCurWin() {
int8 matchNum = 0;
int16 bestMatch = -1;
- if ((_vm->_game->_mouseButtons != 1) || ((_renderFlags & 128) == 0))
+ if ((_vm->_game->_mouseButtons != 1) || !(_renderFlags & RENDERFLAG_HASWINDOWS))
return 0;
for (int i = 0; i < 10; i++) {
diff --git a/engines/gob/draw_playtoons.cpp b/engines/gob/draw_playtoons.cpp
index a443f81ccf..76e2ae591c 100644
--- a/engines/gob/draw_playtoons.cpp
+++ b/engines/gob/draw_playtoons.cpp
@@ -283,8 +283,8 @@ void Draw_Playtoons::spriteOperation(int16 operation) {
_destSpriteX, _destSpriteY, _frontColor, _backColor, _transparency);
}
} else {
- drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor,
- _backColor, _transparency, *_spritesArray[_destSurface], *font);
+ font->drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor,
+ _backColor, _transparency, *_spritesArray[_destSurface]);
_destSpriteX += len * font->getCharWidth();
}
} else {
diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp
index fb15fdbc19..878c1dc265 100644
--- a/engines/gob/draw_v1.cpp
+++ b/engines/gob/draw_v1.cpp
@@ -123,7 +123,7 @@ void Draw_v1::animateCursor(int16 cursor) {
(cursorIndex + 1) * _cursorWidth - 1,
_cursorHeight - 1, 0, 0);
CursorMan.replaceCursor(_scummvmCursor->getData(),
- _cursorWidth, _cursorHeight, hotspotX, hotspotY, 0, 1, &_vm->getPixelFormat());
+ _cursorWidth, _cursorHeight, hotspotX, hotspotY, 0, false, &_vm->getPixelFormat());
if (_frontSurface != _backSurface) {
_showCursor = 3;
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index 78702f2ec9..f5475278c4 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -74,16 +74,19 @@ void Draw_v2::closeScreen() {
}
void Draw_v2::blitCursor() {
- if (_cursorIndex == -1)
+ if (!_cursorSprites || (_cursorIndex == -1))
return;
_showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
}
void Draw_v2::animateCursor(int16 cursor) {
+ if (!_cursorSprites)
+ return;
+
int16 cursorIndex = cursor;
int16 newX = 0, newY = 0;
- uint16 hotspotX = 0, hotspotY = 0;
+ uint16 hotspotX, hotspotY;
_showCursor |= 1;
@@ -133,27 +136,42 @@ void Draw_v2::animateCursor(int16 cursor) {
}
// '------
- newX = _vm->_global->_inter_mouseX;
- newY = _vm->_global->_inter_mouseY;
+ hotspotX = 0;
+ hotspotY = 0;
+
if (_cursorHotspotXVar != -1) {
- newX -= hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar);
- newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar);
+ hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar);
+ hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar);
} else if (_cursorHotspotX != -1) {
- newX -= hotspotX = _cursorHotspotX;
- newY -= hotspotY = _cursorHotspotY;
+ hotspotX = _cursorHotspotX;
+ hotspotY = _cursorHotspotY;
+ } else if (_cursorHotspotsX != 0) {
+ hotspotX = _cursorHotspotsX[_cursorIndex];
+ hotspotY = _cursorHotspotsY[_cursorIndex];
}
+ newX = _vm->_global->_inter_mouseX - hotspotX;
+ newY = _vm->_global->_inter_mouseY - hotspotY;
+
_scummvmCursor->clear();
_scummvmCursor->blit(*_cursorSprites,
cursorIndex * _cursorWidth, 0,
(cursorIndex + 1) * _cursorWidth - 1,
_cursorHeight - 1, 0, 0);
- if ((_vm->getGameType() != kGameTypeAdibou2) &&
- (_vm->getGameType() != kGameTypeAdi2) &&
- (_vm->getGameType() != kGameTypeAdi4))
- CursorMan.replaceCursor(_scummvmCursor->getData(),
- _cursorWidth, _cursorHeight, hotspotX, hotspotY, 0, 1, &_vm->getPixelFormat());
+ uint32 keyColor = 0;
+ if (_doCursorPalettes && _cursorKeyColors && _doCursorPalettes[cursorIndex])
+ keyColor = _cursorKeyColors[cursorIndex];
+
+ CursorMan.replaceCursor(_scummvmCursor->getData(),
+ _cursorWidth, _cursorHeight, hotspotX, hotspotY, keyColor, false, &_vm->getPixelFormat());
+
+ if (_doCursorPalettes && _doCursorPalettes[cursorIndex]) {
+ CursorMan.replaceCursorPalette(_cursorPalettes + (cursorIndex * 256 * 3),
+ _cursorPaletteStarts[cursorIndex], _cursorPaletteCounts[cursorIndex]);
+ CursorMan.disableCursorPalette(false);
+ } else
+ CursorMan.disableCursorPalette(true);
if (_frontSurface != _backSurface) {
if (!_noInvalidated) {
@@ -790,6 +808,10 @@ void Draw_v2::spriteOperation(int16 operation) {
break;
case DRAW_PRINTTEXT:
+ // WORKAROUND: There's mistakes in Little Red's animal names.
+ // See this function for details.
+ fixLittleRedStrings();
+
len = strlen(_textToPrint);
left = _destSpriteX;
@@ -812,8 +834,8 @@ void Draw_v2::spriteOperation(int16 operation) {
getColor(_backColor), _transparency);
}
} else {
- drawString(_textToPrint, _destSpriteX, _destSpriteY, getColor(_frontColor),
- getColor(_backColor), _transparency, *_spritesArray[_destSurface], *font);
+ font->drawString(_textToPrint, _destSpriteX, _destSpriteY, getColor(_frontColor),
+ getColor(_backColor), _transparency, *_spritesArray[_destSurface]);
_destSpriteX += len * font->getCharWidth();
}
} else {
@@ -918,4 +940,39 @@ void Draw_v2::spriteOperation(int16 operation) {
}
}
+/* WORKAROUND: Fix wrong German animal names in Once Upon A Time: Little Red Riding Hood.
+ *
+ * The DOS, Amiga and Atari version of Little Red come with a small screen, accessible
+ * through the main menu, that lets children read and listen to animal names in 5
+ * languages: French, German, English, Spanish and Italian.
+ * Unfortunately, the German names are partially wrong. This is especially tragic
+ * because this is a game for small children and they're supposed to learn something
+ * here. We fix this.
+ *
+ * However, there's also problems with the recorded spoken German names:
+ * - "Der Rabe" has a far too short "a", sounding more like "Rabbe"
+ * - The wrong article for "Schmetterling" is very audible
+ * - In general, the words are way too overpronounced
+ * These are, of course, way harder to fix.
+ */
+
+static const char *kLittleRedStrings[][2] = {
+ {"die Heule" , "die Eule"},
+ {"das Schmetterling" , "der Schmetterling"},
+ {"die Vespe" , "die Wespe"},
+ {"das Eich\224rnchen" , "das Eichh\224rnchen"}
+};
+
+void Draw_v2::fixLittleRedStrings() {
+ if (!_textToPrint || (_vm->getGameType() != kGameTypeLittleRed))
+ return;
+
+ for (int i = 0; i < ARRAYSIZE(kLittleRedStrings); i++) {
+ if (!strcmp(_textToPrint, kLittleRedStrings[i][0])) {
+ _textToPrint = kLittleRedStrings[i][1];
+ return;
+ }
+ }
+}
+
} // End of namespace Gob
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index 502a440005..de0c3f2d5c 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -64,7 +64,7 @@ void Environments::clear() {
// Deleting unique variables, script and resources
for (uint i = 0; i < kEnvironmentCount; i++) {
- if (_environments[i].variables == _vm->_inter->_variables)
+ if (_vm->_inter && (_environments[i].variables == _vm->_inter->_variables))
continue;
if (!has(_environments[i].variables, i + 1))
@@ -167,6 +167,13 @@ bool Environments::has(Resources *resources, uint8 startEnv, int16 except) const
return false;
}
+void Environments::deleted(Variables *variables) {
+ for (uint i = 0; i < kEnvironmentCount; i++) {
+ if (_environments[i].variables == variables)
+ _environments[i].variables = 0;
+ }
+}
+
bool Environments::clearMedia(uint8 env) {
if (env >= kEnvironmentCount)
return false;
@@ -947,6 +954,10 @@ void Game::switchTotSub(int16 index, int16 function) {
_environments.get(_curEnvironment);
}
+void Game::deletedVars(Variables *variables) {
+ _environments.deleted(variables);
+}
+
void Game::clearUnusedEnvironment() {
if (!_environments.has(_script)) {
delete _script;
diff --git a/engines/gob/game.h b/engines/gob/game.h
index b3057ac262..995baa5629 100644
--- a/engines/gob/game.h
+++ b/engines/gob/game.h
@@ -52,6 +52,8 @@ public:
bool has(Script *script , uint8 startEnv = 0, int16 except = -1) const;
bool has(Resources *resources, uint8 startEnv = 0, int16 except = -1) const;
+ void deleted(Variables *variables);
+
void clear();
bool setMedia(uint8 env);
@@ -169,6 +171,8 @@ public:
void totSub(int8 flags, const Common::String &totFile);
void switchTotSub(int16 index, int16 function);
+ void deletedVars(Variables *variables);
+
bool loadFunctions(const Common::String &tot, uint16 flags);
bool callFunction(const Common::String &tot, const Common::String &function, int16 param);
diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp
index 1264c09860..87656a5fad 100644
--- a/engines/gob/global.cpp
+++ b/engines/gob/global.cpp
@@ -111,7 +111,6 @@ Global::Global(GobEngine *vm) : _vm(vm) {
_dontSetPalette = false;
_debugFlag = 0;
- _inVM = 0;
_inter_animDataSize = 10;
diff --git a/engines/gob/global.h b/engines/gob/global.h
index fa2f2c9637..175331dd83 100644
--- a/engines/gob/global.h
+++ b/engines/gob/global.h
@@ -127,7 +127,6 @@ public:
SurfacePtr _primarySurfDesc;
int16 _debugFlag;
- int16 _inVM;
int16 _inter_animDataSize;
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 4e7aa467b5..fcf98f0355 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -48,6 +48,10 @@
#include "gob/videoplayer.h"
#include "gob/save/saveload.h"
+#include "gob/pregob/pregob.h"
+#include "gob/pregob/onceupon/abracadabra.h"
+#include "gob/pregob/onceupon/babayaga.h"
+
namespace Gob {
#define MAX_TIME_DELTA 100
@@ -115,7 +119,7 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst), _rnd("gob") {
_vidPlayer = 0; _init = 0; _inter = 0;
_map = 0; _palAnim = 0; _scenery = 0;
_draw = 0; _util = 0; _video = 0;
- _saveLoad = 0;
+ _saveLoad = 0; _preGob = 0;
_pauseStart = 0;
@@ -180,6 +184,10 @@ void GobEngine::validateVideoMode(int16 videoMode) {
error("Video mode 0x%X is not supported", videoMode);
}
+EndiannessMethod GobEngine::getEndiannessMethod() const {
+ return _endiannessMethod;
+}
+
Endianness GobEngine::getEndianness() const {
if ((getPlatform() == Common::kPlatformAmiga) ||
(getPlatform() == Common::kPlatformMacintosh) ||
@@ -233,6 +241,10 @@ bool GobEngine::isDemo() const {
return (isSCNDemo() || isBATDemo());
}
+bool GobEngine::hasResourceSizeWorkaround() const {
+ return _resourceSizeWorkaround;
+}
+
bool GobEngine::isCurrentTot(const Common::String &tot) const {
return _game->_curTotFile.equalsIgnoreCase(tot);
}
@@ -270,15 +282,15 @@ void GobEngine::setTrueColor(bool trueColor) {
}
Common::Error GobEngine::run() {
- if (!initGameParts()) {
- GUIErrorMessage("GobEngine::init(): Unknown version of game engine");
- return Common::kUnknownError;
- }
+ Common::Error err;
- if (!initGraphics()) {
- GUIErrorMessage("GobEngine::init(): Failed to set up graphics");
- return Common::kUnknownError;
- }
+ err = initGameParts();
+ if (err.getCode() != Common::kNoError)
+ return err;
+
+ err = initGraphics();
+ if (err.getCode() != Common::kNoError)
+ return err;
// On some systems it's not safe to run CD audio games from the CD.
if (isCD())
@@ -364,11 +376,12 @@ void GobEngine::pauseEngineIntern(bool pause) {
_game->_startTimeKey += duration;
_draw->_cursorTimeKey += duration;
- if (_inter->_soundEndTimeKey != 0)
+ if (_inter && (_inter->_soundEndTimeKey != 0))
_inter->_soundEndTimeKey += duration;
}
- _vidPlayer->pauseAll(pause);
+ if (_vidPlayer)
+ _vidPlayer->pauseAll(pause);
_mixer->pauseAll(pause);
}
@@ -388,10 +401,13 @@ void GobEngine::pauseGame() {
pauseEngineIntern(false);
}
-bool GobEngine::initGameParts() {
+Common::Error GobEngine::initGameParts() {
+ _resourceSizeWorkaround = false;
+
// just detect some devices some of which will be always there if the music is not disabled
_noMusic = MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB)) == MT_NULL ? true : false;
- _saveLoad = 0;
+
+ _endiannessMethod = kEndiannessMethodSystem;
_global = new Global(this);
_util = new Util(this);
@@ -423,6 +439,8 @@ bool GobEngine::initGameParts() {
_goblin = new Goblin_v1(this);
_scenery = new Scenery_v1(this);
_saveLoad = new SaveLoad_Geisha(this, _targetName.c_str());
+
+ _endiannessMethod = kEndiannessMethodAltFile;
break;
case kGameTypeFascination:
@@ -462,6 +480,33 @@ bool GobEngine::initGameParts() {
_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
break;
+ case kGameTypeLittleRed:
+ _init = new Init_v2(this);
+ _video = new Video_v2(this);
+ _inter = new Inter_LittleRed(this);
+ _mult = new Mult_v2(this);
+ _draw = new Draw_v2(this);
+ _map = new Map_v2(this);
+ _goblin = new Goblin_v2(this);
+ _scenery = new Scenery_v2(this);
+
+ // WORKAROUND: Little Red Riding Hood has a small resource size glitch in the
+ // screen where Little Red needs to find the animals' homes.
+ _resourceSizeWorkaround = true;
+ break;
+
+ case kGameTypeAJWorld:
+ _init = new Init_v2(this);
+ _video = new Video_v2(this);
+ _inter = new Inter_v2(this);
+ _mult = new Mult_v2(this);
+ _draw = new Draw_v2(this);
+ _map = new Map_v2(this);
+ _goblin = new Goblin_v2(this);
+ _scenery = new Scenery_v2(this);
+ _saveLoad = new SaveLoad_AJWorld(this, _targetName.c_str());
+ break;
+
case kGameTypeGob3:
_init = new Init_v3(this);
_video = new Video_v2(this);
@@ -572,20 +617,45 @@ bool GobEngine::initGameParts() {
_scenery = new Scenery_v2(this);
_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
break;
+
+ case kGameTypeAbracadabra:
+ _init = new Init_v2(this);
+ _video = new Video_v2(this);
+ _mult = new Mult_v2(this);
+ _draw = new Draw_v2(this);
+ _map = new Map_v2(this);
+ _goblin = new Goblin_v2(this);
+ _scenery = new Scenery_v2(this);
+ _preGob = new OnceUpon::Abracadabra(this);
+ break;
+
+ case kGameTypeBabaYaga:
+ _init = new Init_v2(this);
+ _video = new Video_v2(this);
+ _mult = new Mult_v2(this);
+ _draw = new Draw_v2(this);
+ _map = new Map_v2(this);
+ _goblin = new Goblin_v2(this);
+ _scenery = new Scenery_v2(this);
+ _preGob = new OnceUpon::BabaYaga(this);
+ break;
+
default:
deinitGameParts();
- return false;
+ return Common::kUnsupportedGameidError;
}
// Setup mixer
syncSoundSettings();
- _inter->setupOpcodes();
+ if (_inter)
+ _inter->setupOpcodes();
- return true;
+ return Common::kNoError;
}
void GobEngine::deinitGameParts() {
+ delete _preGob; _preGob = 0;
delete _saveLoad; _saveLoad = 0;
delete _mult; _mult = 0;
delete _vidPlayer; _vidPlayer = 0;
@@ -604,10 +674,10 @@ void GobEngine::deinitGameParts() {
delete _dataIO; _dataIO = 0;
}
-bool GobEngine::initGraphics() {
+Common::Error GobEngine::initGraphics() {
if (is800x600()) {
warning("GobEngine::initGraphics(): 800x600 games currently unsupported");
- return false;
+ return Common::kUnsupportedGameidError;
} else if (is640x480()) {
_width = 640;
_height = 480;
@@ -631,7 +701,7 @@ bool GobEngine::initGraphics() {
_global->_primarySurfDesc = SurfacePtr(new Surface(_width, _height, _pixelFormat.bytesPerPixel));
- return true;
+ return Common::kNoError;
}
} // End of namespace Gob
diff --git a/engines/gob/gob.h b/engines/gob/gob.h
index ea2323807a..df73404596 100644
--- a/engines/gob/gob.h
+++ b/engines/gob/gob.h
@@ -50,6 +50,11 @@ class StaticTextWidget;
* - Bargon Attack
* - Lost in Time
* - The Bizarre Adventures of Woodruff and the Schnibble
+ * - Fascination
+ * - Urban Runner
+ * - Bambou le sauveur de la jungle
+ * - Geisha
+ * - Once Upon A Time: Little Red Riding Hood
*/
namespace Gob {
@@ -70,6 +75,7 @@ class Scenery;
class Util;
class SaveLoad;
class GobConsole;
+class PreGob;
#define WRITE_VAR_UINT32(var, val) _vm->_inter->_variables->writeVar32(var, val)
#define WRITE_VAR_UINT16(var, val) _vm->_inter->_variables->writeVar16(var, val)
@@ -123,7 +129,12 @@ enum GameType {
kGameTypeAdi2,
kGameTypeAdi4,
kGameTypeAdibou2,
- kGameTypeAdibou1
+ kGameTypeAdibou1,
+ kGameTypeAbracadabra,
+ kGameTypeBabaYaga,
+ kGameTypeLittleRed,
+ kGameTypeOnceUponATime, // Need more inspection to see if Baba Yaga or Abracadabra
+ kGameTypeAJWorld
};
enum Features {
@@ -138,6 +149,13 @@ enum Features {
kFeaturesTrueColor = 1 << 7
};
+enum EndiannessMethod {
+ kEndiannessMethodLE, ///< Always little endian.
+ kEndiannessMethodBE, ///< Always big endian.
+ kEndiannessMethodSystem, ///< Follows system endianness.
+ kEndiannessMethodAltFile ///< Different endianness in alternate file.
+};
+
enum {
kDebugFuncOp = 1 << 0,
kDebugDrawOp = 1 << 1,
@@ -161,6 +179,8 @@ private:
int32 _features;
Common::Platform _platform;
+ EndiannessMethod _endiannessMethod;
+
uint32 _pauseStart;
// Engine APIs
@@ -169,10 +189,10 @@ private:
virtual void pauseEngineIntern(bool pause);
virtual void syncSoundSettings();
- bool initGameParts();
- void deinitGameParts();
+ Common::Error initGameParts();
+ Common::Error initGraphics();
- bool initGraphics();
+ void deinitGameParts();
public:
static const Common::Language _gobToScummVMLang[];
@@ -195,6 +215,8 @@ public:
GobConsole *_console;
+ bool _resourceSizeWorkaround;
+
Global *_global;
Util *_util;
DataIO *_dataIO;
@@ -211,6 +233,7 @@ public:
Inter *_inter;
SaveLoad *_saveLoad;
VideoPlayer *_vidPlayer;
+ PreGob *_preGob;
const char *getLangDesc(int16 language) const;
void validateLanguage();
@@ -218,6 +241,7 @@ public:
void pauseGame();
+ EndiannessMethod getEndiannessMethod() const;
Endianness getEndianness() const;
Common::Platform getPlatform() const;
GameType getGameType() const;
@@ -231,6 +255,8 @@ public:
bool isTrueColor() const;
bool isDemo() const;
+ bool hasResourceSizeWorkaround() const;
+
bool isCurrentTot(const Common::String &tot) const;
void setTrueColor(bool trueColor);
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp
index 9a89f11923..ecab9bb906 100644
--- a/engines/gob/hotspots.cpp
+++ b/engines/gob/hotspots.cpp
@@ -532,34 +532,46 @@ void Hotspots::leave(uint16 index) {
call(spot.funcLeave);
}
-int16 Hotspots::curWindow(int16 &dx, int16 &dy) const {
- if ((_vm->_draw->_renderFlags & 0x80)==0)
- return(0);
+int16 Hotspots::windowCursor(int16 &dx, int16 &dy) const {
+ if (!(_vm->_draw->_renderFlags & RENDERFLAG_HASWINDOWS))
+ return 0;
+
for (int i = 0; i < 10; i++) {
- if (_vm->_draw->_fascinWin[i].id != -1) {
- if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left &&
- _vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width &&
- _vm->_global->_inter_mouseY >= _vm->_draw->_fascinWin[i].top &&
- _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + _vm->_draw->_fascinWin[i].height) {
- if (_vm->_draw->_fascinWin[i].id == _vm->_draw->_winCount-1) {
- dx = _vm->_draw->_fascinWin[i].left;
- dy = _vm->_draw->_fascinWin[i].top;
- if (_vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + 12 &&
- _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 &&
- (VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 2))
- // Cursor on 'Close Window'
- return(5);
- if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width - 12 &&
- _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 &&
- (VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 4))
- // Cursor on 'Move Window'
- return(6);
- return(-i);
- }
- }
- }
+ if (_vm->_draw->_fascinWin[i].id == -1)
+ // No such windows
+ continue;
+
+ const int left = _vm->_draw->_fascinWin[i].left;
+ const int top = _vm->_draw->_fascinWin[i].top;
+ const int right = _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width - 1;
+ const int bottom = _vm->_draw->_fascinWin[i].top + _vm->_draw->_fascinWin[i].height - 1;
+
+ if ((_vm->_global->_inter_mouseX < left) || (_vm->_global->_inter_mouseX > right) ||
+ (_vm->_global->_inter_mouseY < top ) || (_vm->_global->_inter_mouseY > bottom))
+ // We're not inside that window
+ continue;
+
+ if (_vm->_draw->_fascinWin[i].id != (_vm->_draw->_winCount - 1))
+ // Only consider the top-most window
+ continue;
+
+ dx = _vm->_draw->_fascinWin[i].left;
+ dy = _vm->_draw->_fascinWin[i].top;
+
+ if ((_vm->_global->_inter_mouseX < (left + 12)) && (_vm->_global->_inter_mouseY < (top + 12)) &&
+ (VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 2))
+ // Cursor on 'Close Window'
+ return 5;
+
+ if ((_vm->_global->_inter_mouseX > (right - 12)) & (_vm->_global->_inter_mouseY < (top + 12)) &&
+ (VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 4))
+ // Cursor on 'Move Window'
+ return 6;
+
+ return -1;
}
- return(0);
+
+ return 0;
}
uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const {
@@ -1226,13 +1238,13 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
ids[i] = 0;
// Type and window
- byte type = _vm->_game->_script->readByte();
+ byte type = _vm->_game->_script->readByte();
byte windowNum = 0;
if ((type & 0x40) != 0) {
// Got a window ID
- type -= 0x40;
+ type -= 0x40;
windowNum = _vm->_game->_script->readByte();
}
@@ -1254,31 +1266,31 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
width = _vm->_game->_script->readUint16();
height = _vm->_game->_script->readUint16();
}
- if (_vm->_draw->_renderFlags & 64) {
- _vm->_draw->_invalidatedTops[0] = 0;
- _vm->_draw->_invalidatedLefts[0] = 0;
- _vm->_draw->_invalidatedRights[0] = 319;
- _vm->_draw->_invalidatedBottoms[0] = 199;
- _vm->_draw->_invalidatedCount = 1;
+ type &= 0x7F;
+
+ // Draw a border around the hotspot
+ if (_vm->_draw->_renderFlags & RENDERFLAG_BORDERHOTSPOTS) {
+ Surface &surface = *_vm->_draw->_spritesArray[_vm->_draw->_destSurface];
+
+ _vm->_video->dirtyRectsAll();
+
if (windowNum == 0) {
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left + width - 1, top, left + width - 1, top + height - 1, 0);
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left, top + height - 1, 0);
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left + width - 1, top, 0);
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top + height - 1, left + width - 1, top + height - 1, 0);
+ // The hotspot is not inside a window, just draw border it
+ surface.drawRect(left, top, left + width - 1, top + height - 1, 0);
+
} else {
- if ((_vm->_draw->_fascinWin[windowNum].id != -1) && (_vm->_draw->_fascinWin[windowNum].id == _vm->_draw->_winCount - 1)) {
- left += _vm->_draw->_fascinWin[windowNum].left;
- top += _vm->_draw->_fascinWin[windowNum].top;
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left + width - 1, top, left + width - 1, top + height - 1, 0);
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left, top + height - 1, 0);
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left + width - 1, top, 0);
- _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top + height - 1, left + width - 1, top + height - 1, 0);
- left -= _vm->_draw->_fascinWin[windowNum].left;
- top -= _vm->_draw->_fascinWin[windowNum].top;
+ // The hotspot is inside a window, only draw it if it's the topmost window
+
+ if ((_vm->_draw->_fascinWin[windowNum].id != -1) &&
+ (_vm->_draw->_fascinWin[windowNum].id == (_vm->_draw->_winCount - 1))) {
+
+ const uint16 wLeft = left + _vm->_draw->_fascinWin[windowNum].left;
+ const uint16 wTop = top + _vm->_draw->_fascinWin[windowNum].top;
+
+ surface.drawRect(wLeft, wTop, wLeft + width - 1, wTop + height - 1, 0);
}
}
}
- type &= 0x7F;
// Apply global drawing offset
if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) {
@@ -1667,38 +1679,19 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const {
int16 deltax = 0;
int16 deltay = 0;
- if (_vm->getGameType() == kGameTypeFascination)
- cursor = curWindow(deltax, deltay);
+ // Fascination uses hard-coded windows
+ if (_vm->getGameType() == kGameTypeFascination) {
+ cursor = windowCursor(deltax, deltay);
- if (cursor == 0) {
- for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- const Hotspot &spot = _hotspots[i];
+ // We're in a window and in an area that forces a specific cursor
+ if (cursor > 0)
+ return cursor;
- if ((spot.getWindow() != 0) || spot.isDisabled())
- // Ignore disabled and non-main-windowed hotspots
- continue;
-
- if (!spot.isIn(x, y))
- // We're not in that hotspot, ignore it
- continue;
-
- if (spot.getCursor() == 0) {
- // Hotspot doesn't itself specify a cursor...
- if (spot.getType() >= kTypeInput1NoLeave) {
- // ...but the type has a generic one
- cursor = 3;
- break;
- } else if ((spot.getButton() != kMouseButtonsRight) && (cursor == 0))
- // ...but there's a generic "click" cursor
- cursor = 1;
- } else if (cursor == 0)
- // Hotspot had an attached cursor index
- cursor = spot.getCursor();
- }
- } else {
+ // We're somewhere else inside a window
if (cursor < 0) {
- int16 curType = - cursor * 256;
+ int16 curType = -cursor * 256;
cursor = 0;
+
for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
const Hotspot &spot = _hotspots[i];
// this check is /really/ Fascination specific.
@@ -1712,10 +1705,40 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const {
break;
}
}
+
+ if (_vm->_draw->_cursorAnimLow[cursor] == -1)
+ // If the cursor is invalid... there's a generic "click" cursor
+ cursor = 1;
+
+ return cursor;
}
- if (_vm->_draw->_cursorAnimLow[cursor] == -1)
- // If the cursor is invalid... there's a generic "click" cursor
- cursor = 1;
+
+ }
+
+ // Normal, non-window cursor handling
+ for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+ const Hotspot &spot = _hotspots[i];
+
+ if ((spot.getWindow() != 0) || spot.isDisabled())
+ // Ignore disabled and non-main-windowed hotspots
+ continue;
+
+ if (!spot.isIn(x, y))
+ // We're not in that hotspot, ignore it
+ continue;
+
+ if (spot.getCursor() == 0) {
+ // Hotspot doesn't itself specify a cursor...
+ if (spot.getType() >= kTypeInput1NoLeave) {
+ // ...but the type has a generic one
+ cursor = 3;
+ break;
+ } else if ((spot.getButton() != kMouseButtonsRight) && (cursor == 0))
+ // ...but there's a generic "click" cursor
+ cursor = 1;
+ } else if (cursor == 0)
+ // Hotspot had an attached cursor index
+ cursor = spot.getCursor();
}
return cursor;
diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h
index b348f9cd70..bd7b281c10 100644
--- a/engines/gob/hotspots.h
+++ b/engines/gob/hotspots.h
@@ -202,8 +202,8 @@ private:
/** Handling hotspot leave events. */
void leave(uint16 index);
- /** Which window is the mouse cursor currently in? (Fascination) */
- int16 curWindow(int16 &dx, int16 &dy) const;
+ /** Check whether a specific part of the window forces a certain cursor. */
+ int16 windowCursor(int16 &dx, int16 &dy) const;
/** Which hotspot is the mouse cursor currently at? */
uint16 checkMouse(Type type, uint16 &id, uint16 &index) const;
diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp
index a61261f355..814d4d1821 100644
--- a/engines/gob/init.cpp
+++ b/engines/gob/init.cpp
@@ -34,9 +34,13 @@
#include "gob/inter.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
+
+#include "gob/sound/sound.h"
+
#include "gob/demos/scnplayer.h"
#include "gob/demos/batplayer.h"
-#include "gob/sound/sound.h"
+
+#include "gob/pregob/pregob.h"
namespace Gob {
@@ -118,6 +122,14 @@ void Init::initGame() {
return;
}
+ if (_vm->_preGob) {
+ _vm->_preGob->run();
+ delete _palDesc;
+ _vm->_video->initPrimary(-1);
+ cleanup();
+ return;
+ }
+
Common::SeekableReadStream *infFile = _vm->_dataIO->getFile("intro.inf");
if (!infFile) {
diff --git a/engines/gob/init.h b/engines/gob/init.h
index 946a3fa4f1..ac460fd654 100644
--- a/engines/gob/init.h
+++ b/engines/gob/init.h
@@ -62,7 +62,6 @@ public:
~Init_Geisha();
void initVideo();
- void initGame();
};
class Init_v2 : public Init_v1 {
diff --git a/engines/gob/init_fascin.cpp b/engines/gob/init_fascin.cpp
index b87d816406..e6d82faa68 100644
--- a/engines/gob/init_fascin.cpp
+++ b/engines/gob/init_fascin.cpp
@@ -44,10 +44,10 @@ void Init_Fascination::updateConfig() {
}
void Init_Fascination::initGame() {
-// HACK - Suppress ADLIB_FLAG as the MDY/TBR player is not working. suppress
-// the PC Speaker too, as the script checks in the intro for it's presence
+// HACK - Suppress
+// the PC Speaker, as the script checks in the intro for it's presence
// to play or not some noices.
- _vm->_global->_soundFlags = MIDI_FLAG | BLASTER_FLAG;
+ _vm->_global->_soundFlags = MIDI_FLAG | BLASTER_FLAG | ADLIB_FLAG;
Init::initGame();
}
diff --git a/engines/gob/init_geisha.cpp b/engines/gob/init_geisha.cpp
index b5bbcff400..01081a5af6 100644
--- a/engines/gob/init_geisha.cpp
+++ b/engines/gob/init_geisha.cpp
@@ -44,11 +44,4 @@ void Init_Geisha::initVideo() {
_vm->_draw->_transparentCursor = 1;
}
-void Init_Geisha::initGame() {
- // HACK - Since the MDY/TBR player is not working, claim we have no AdLib
- _vm->_global->_soundFlags = 0;
-
- Init::initGame();
-}
-
} // End of namespace Gob
diff --git a/engines/gob/init_v1.cpp b/engines/gob/init_v1.cpp
index 25d521aca6..a8e8cbe2c3 100644
--- a/engines/gob/init_v1.cpp
+++ b/engines/gob/init_v1.cpp
@@ -41,8 +41,6 @@ void Init_v1::initVideo() {
_vm->_global->_mousePresent = 1;
- _vm->_global->_inVM = 0;
-
if ((_vm->_global->_videoMode == 0x13) && !_vm->isEGA())
_vm->_global->_colorCount = 256;
diff --git a/engines/gob/init_v2.cpp b/engines/gob/init_v2.cpp
index 1289d561ea..c204b04a40 100644
--- a/engines/gob/init_v2.cpp
+++ b/engines/gob/init_v2.cpp
@@ -45,8 +45,6 @@ void Init_v2::initVideo() {
_vm->_global->_mousePresent = 1;
- _vm->_global->_inVM = 0;
-
_vm->_global->_colorCount = 16;
if (!_vm->isEGA() &&
((_vm->getPlatform() == Common::kPlatformPC) ||
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index 9df3c06c74..4460274561 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -52,6 +52,7 @@ Inter::Inter(GobEngine *vm) : _vm(vm), _varStack(600) {
_soundEndTimeKey = 0;
_soundStopVal = 0;
+ _lastBusyWait = 0;
_noBusyWait = false;
_variables = 0;
@@ -358,6 +359,9 @@ void Inter::allocateVars(uint32 count) {
}
void Inter::delocateVars() {
+ if (_vm->_game)
+ _vm->_game->deletedVars(_variables);
+
delete _variables;
_variables = 0;
}
@@ -452,4 +456,15 @@ uint32 Inter::readValue(uint16 index, uint16 type) {
return 0;
}
+void Inter::handleBusyWait() {
+ uint32 now = _vm->_util->getTimeKey();
+
+ if (!_noBusyWait)
+ if ((now - _lastBusyWait) <= 20)
+ _vm->_util->longDelay(1);
+
+ _lastBusyWait = now;
+ _noBusyWait = false;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index c79b6e2260..63bf3eb1c6 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -31,6 +31,10 @@
#include "gob/iniconfig.h"
#include "gob/databases.h"
+namespace Common {
+ class PEResources;
+}
+
namespace Gob {
class Cheater_Geisha;
@@ -138,8 +142,9 @@ protected:
VariableStack _varStack;
- // The busy-wait detection in o1_keyFunc breaks fast scrolling in Ween
- bool _noBusyWait;
+ // Busy-wait detection
+ bool _noBusyWait;
+ uint32 _lastBusyWait;
GobEngine *_vm;
@@ -168,6 +173,8 @@ protected:
void storeString(const char *value);
uint32 readValue(uint16 index, uint16 type);
+
+ void handleBusyWait();
};
class Inter_v1 : public Inter {
@@ -509,6 +516,20 @@ protected:
void oFascin_setWinFlags();
};
+class Inter_LittleRed : public Inter_v2 {
+public:
+ Inter_LittleRed(GobEngine *vm);
+ virtual ~Inter_LittleRed() {}
+
+protected:
+ virtual void setupOpcodesDraw();
+ virtual void setupOpcodesFunc();
+ virtual void setupOpcodesGob();
+
+ void oLittleRed_keyFunc(OpFuncParams &params);
+ void oLittleRed_playComposition(OpFuncParams &params);
+};
+
class Inter_v3 : public Inter_v2 {
public:
Inter_v3(GobEngine *vm);
@@ -648,7 +669,7 @@ private:
class Inter_v7 : public Inter_Playtoons {
public:
Inter_v7(GobEngine *vm);
- virtual ~Inter_v7() {}
+ virtual ~Inter_v7();
protected:
virtual void setupOpcodesDraw();
@@ -684,7 +705,12 @@ private:
INIConfig _inis;
Databases _databases;
+ Common::PEResources *_cursors;
+
Common::String findFile(const Common::String &mask);
+
+ bool loadCursorFile();
+ void resizeCursors(int16 width, int16 height, int16 count, bool transparency);
};
} // End of namespace Gob
diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp
index 134203fa9d..029f7c697b 100644
--- a/engines/gob/inter_bargon.cpp
+++ b/engines/gob/inter_bargon.cpp
@@ -119,7 +119,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
MouseButtons buttons;
SurfacePtr surface;
SoundDesc samples[4];
- int16 comp[5] = { 0, 1, 2, 3, -1 };
+ static const int16 comp[5] = { 0, 1, 2, 3, -1 };
static const char *const sndFiles[] = {"1INTROII.snd", "2INTROII.snd", "1INTRO3.snd", "2INTRO3.snd"};
surface = _vm->_video->initSurfDesc(320, 200);
@@ -167,8 +167,8 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
MouseButtons buttons;
Video::Color *palBak;
SoundDesc samples[2];
- int16 comp[3] = { 0, 1, -1 };
byte *palettes[4];
+ static const int16 comp[3] = { 0, 1, -1 };
static const char *const sndFiles[] = {"1INTROIV.snd", "2INTROIV.snd"};
static const char *const palFiles[] = {"2ou2.clt", "2ou3.clt", "2ou4.clt", "2ou5.clt"};
diff --git a/engines/gob/inter_fascin.cpp b/engines/gob/inter_fascin.cpp
index 081b48fbad..001ec06635 100644
--- a/engines/gob/inter_fascin.cpp
+++ b/engines/gob/inter_fascin.cpp
@@ -248,12 +248,11 @@ void Inter_Fascination::oFascin_playTira(OpGobParams &params) {
void Inter_Fascination::oFascin_loadExtasy(OpGobParams &params) {
_vm->_sound->adlibLoadTBR("extasy.tbr");
_vm->_sound->adlibLoadMDY("extasy.mdy");
+ _vm->_sound->adlibSetRepeating(-1);
}
void Inter_Fascination::oFascin_adlibPlay(OpGobParams &params) {
-#ifdef ENABLE_FASCIN_ADLIB
_vm->_sound->adlibPlay();
-#endif
}
void Inter_Fascination::oFascin_adlibStop(OpGobParams &params) {
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index 7f21ceb91d..8d05cefa66 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -55,7 +55,7 @@ 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);
+ _cheater = new Cheater_Geisha(vm, _diving, _penetration);
_vm->_console->registerCheater(_cheater);
}
@@ -200,8 +200,12 @@ void Inter_Geisha::oGeisha_checkData(OpFuncParams &params) {
if (mode == SaveLoad::kSaveModeNone) {
exists = _vm->_dataIO->hasFile(file);
- if (!exists)
- warning("File \"%s\" not found", file.c_str());
+ if (!exists) {
+ // NOTE: Geisha looks if fin.tot exists to check if it needs to open disk3.stk.
+ // This is completely normal, so don't print a warning.
+ if (file != "fin.tot")
+ warning("File \"%s\" not found", file.c_str());
+ }
} else if (mode == SaveLoad::kSaveModeSave)
exists = _vm->_saveLoad->getSize(file.c_str()) >= 0;
@@ -272,12 +276,12 @@ void Inter_Geisha::oGeisha_writeData(OpFuncParams &params) {
}
void Inter_Geisha::oGeisha_gamePenetration(OpGobParams &params) {
- uint16 var1 = _vm->_game->_script->readUint16();
- uint16 var2 = _vm->_game->_script->readUint16();
- uint16 var3 = _vm->_game->_script->readUint16();
- uint16 resultVar = _vm->_game->_script->readUint16();
+ uint16 hasAccessPass = _vm->_game->_script->readUint16();
+ uint16 hasMaxEnergy = _vm->_game->_script->readUint16();
+ uint16 testMode = _vm->_game->_script->readUint16();
+ uint16 resultVar = _vm->_game->_script->readUint16();
- bool result = _penetration->play(var1, var2, var3);
+ bool result = _penetration->play(hasAccessPass, hasMaxEnergy, testMode);
WRITE_VAR_UINT32(resultVar, result ? 1 : 0);
}
@@ -298,9 +302,8 @@ void Inter_Geisha::oGeisha_loadTitleMusic(OpGobParams &params) {
}
void Inter_Geisha::oGeisha_playMusic(OpGobParams &params) {
- // TODO: The MDYPlayer is still broken!
- warning("Geisha Stub: oGeisha_playMusic");
- // _vm->_sound->adlibPlay();
+ _vm->_sound->adlibSetRepeating(-1);
+ _vm->_sound->adlibPlay();
}
void Inter_Geisha::oGeisha_stopMusic(OpGobParams &params) {
diff --git a/engines/gob/inter_littlered.cpp b/engines/gob/inter_littlered.cpp
new file mode 100644
index 0000000000..01aa4c2158
--- /dev/null
+++ b/engines/gob/inter_littlered.cpp
@@ -0,0 +1,118 @@
+/* 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/inter.h"
+#include "gob/global.h"
+#include "gob/util.h"
+#include "gob/draw.h"
+#include "gob/game.h"
+#include "gob/script.h"
+#include "gob/hotspots.h"
+#include "gob/sound/sound.h"
+
+namespace Gob {
+
+#define OPCODEVER Inter_LittleRed
+#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
+#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
+#define OPCODEGOB(i, x) _opcodesGob[i]._OPCODEGOB(OPCODEVER, x)
+
+Inter_LittleRed::Inter_LittleRed(GobEngine *vm) : Inter_v2(vm) {
+}
+
+void Inter_LittleRed::setupOpcodesDraw() {
+ Inter_v2::setupOpcodesDraw();
+}
+
+void Inter_LittleRed::setupOpcodesFunc() {
+ Inter_v2::setupOpcodesFunc();
+
+ OPCODEFUNC(0x14, oLittleRed_keyFunc);
+
+ OPCODEFUNC(0x3D, oLittleRed_playComposition);
+}
+
+void Inter_LittleRed::setupOpcodesGob() {
+ OPCODEGOB(1, o_gobNOP); // Sets some sound timer interrupt
+ OPCODEGOB(2, o_gobNOP); // Sets some sound timer interrupt
+
+ OPCODEGOB(500, o2_playProtracker);
+ OPCODEGOB(501, o2_stopProtracker);
+}
+
+void Inter_LittleRed::oLittleRed_keyFunc(OpFuncParams &params) {
+ animPalette();
+ _vm->_draw->blitInvalidated();
+
+ handleBusyWait();
+
+ int16 cmd = _vm->_game->_script->readInt16();
+ int16 key;
+ uint32 keyState;
+
+ switch (cmd) {
+ case -1:
+ break;
+
+ case 0:
+ _vm->_draw->_showCursor &= ~2;
+ _vm->_util->longDelay(1);
+ key = _vm->_game->_hotspots->check(0, 0);
+ storeKey(key);
+
+ _vm->_util->clearKeyBuf();
+ break;
+
+ case 1:
+ _vm->_util->forceMouseUp(true);
+ key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX,
+ &_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, 0);
+ storeKey(key);
+ break;
+
+ case 2:
+ _vm->_util->processInput(true);
+ keyState = _vm->_util->getKeyState();
+
+ WRITE_VAR(0, keyState);
+ _vm->_util->clearKeyBuf();
+ break;
+
+ default:
+ _vm->_sound->speakerOnUpdate(cmd);
+ if (cmd < 20) {
+ _vm->_util->delay(cmd);
+ _noBusyWait = true;
+ } else
+ _vm->_util->longDelay(cmd);
+ break;
+ }
+}
+
+void Inter_LittleRed::oLittleRed_playComposition(OpFuncParams &params) {
+ o1_playComposition(params);
+
+ _vm->_sound->blasterRepeatComposition(-1);
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 9aa190a456..dc533a210a 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -286,10 +286,40 @@ void Inter_v1::o1_loadMult() {
}
void Inter_v1::o1_playMult() {
- int16 checkEscape;
+ // NOTE: The EGA version of Gobliiins has an MDY tune.
+ // While the original doesn't play it, we do.
+ bool isGob1EGAIntro = _vm->getGameType() == kGameTypeGob1 &&
+ _vm->isEGA() &&
+ _vm->_game->_script->pos() == 1010 &&
+ _vm->isCurrentTot("intro.tot") &&
+ VAR(57) != 0xFFFFFFFF &&
+ _vm->_dataIO->hasFile("goblins.mdy") &&
+ _vm->_dataIO->hasFile("goblins.tbr");
+
+ int16 checkEscape = _vm->_game->_script->readInt16();
+
+ if (isGob1EGAIntro) {
+ _vm->_sound->adlibLoadTBR("goblins.tbr");
+ _vm->_sound->adlibLoadMDY("goblins.mdy");
+ _vm->_sound->adlibSetRepeating(-1);
+
+ _vm->_sound->adlibPlay();
+ }
- checkEscape = _vm->_game->_script->readInt16();
_vm->_mult->playMult(VAR(57), -1, checkEscape, 0);
+
+ if (isGob1EGAIntro) {
+
+ // User didn't escape the intro mult, wait for an escape here
+ if (VAR(57) != 0xFFFFFFFF) {
+ while (_vm->_util->getKey() != kKeyEscape) {
+ _vm->_util->processInput();
+ _vm->_util->longDelay(1);
+ }
+ }
+
+ _vm->_sound->adlibUnload();
+ }
}
void Inter_v1::o1_freeMultKeys() {
@@ -1159,26 +1189,15 @@ void Inter_v1::o1_palLoad(OpFuncParams &params) {
}
void Inter_v1::o1_keyFunc(OpFuncParams &params) {
- static uint32 lastCalled = 0;
- int16 cmd;
- int16 key;
- uint32 now;
-
if (!_vm->_vidPlayer->isPlayingLive()) {
_vm->_draw->forceBlit();
_vm->_video->retrace();
}
- cmd = _vm->_game->_script->readInt16();
animPalette();
_vm->_draw->blitInvalidated();
- now = _vm->_util->getTimeKey();
- if (!_noBusyWait)
- if ((now - lastCalled) <= 20)
- _vm->_util->longDelay(1);
- lastCalled = now;
- _noBusyWait = false;
+ handleBusyWait();
// WORKAROUND for bug #1726130: Ween busy-waits in the intro for a counter
// to become 5000. We deliberately slow down busy-waiting, so we shorten
@@ -1187,6 +1206,9 @@ void Inter_v1::o1_keyFunc(OpFuncParams &params) {
(_vm->_game->_script->pos() == 729) && _vm->isCurrentTot("intro5.tot"))
WRITE_VAR(59, 4000);
+ int16 cmd = _vm->_game->_script->readInt16();
+ int16 key;
+
switch (cmd) {
case -1:
break;
@@ -1554,14 +1576,13 @@ void Inter_v1::o1_waitEndPlay(OpFuncParams &params) {
}
void Inter_v1::o1_playComposition(OpFuncParams &params) {
- int16 composition[50];
- int16 dataVar;
- int16 freqVal;
+ int16 dataVar = _vm->_game->_script->readVarIndex();
+ int16 freqVal = _vm->_game->_script->readValExpr();
- dataVar = _vm->_game->_script->readVarIndex();
- freqVal = _vm->_game->_script->readValExpr();
+ int16 composition[50];
+ int maxEntries = MIN<int>(50, (_variables->getSize() - dataVar) / 4);
for (int i = 0; i < 50; i++)
- composition[i] = (int16) VAR_OFFSET(dataVar + i * 4);
+ composition[i] = (i < maxEntries) ? ((int16) VAR_OFFSET(dataVar + i * 4)) : -1;
_vm->_sound->blasterPlayComposition(composition, freqVal);
}
@@ -1744,10 +1765,15 @@ void Inter_v1::o1_writeData(OpFuncParams &params) {
void Inter_v1::o1_manageDataFile(OpFuncParams &params) {
Common::String file = _vm->_game->_script->evalString();
- if (!file.empty())
+ if (!file.empty()) {
_vm->_dataIO->openArchive(file, true);
- else
+ } else {
_vm->_dataIO->closeArchive(true);
+
+ // NOTE: Lost in Time might close a data file without explicitely closing a video in it.
+ // So we make sure that all open videos are still available.
+ _vm->_vidPlayer->reopenAll();
+ }
}
void Inter_v1::o1_setState(OpGobParams &params) {
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 1e5b7bb24c..cb58fe86f7 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1002,6 +1002,10 @@ void Inter_v2::o2_openItk() {
void Inter_v2::o2_closeItk() {
_vm->_dataIO->closeArchive(false);
+
+ // NOTE: Lost in Time might close a data file without explicitely closing a video in it.
+ // So we make sure that all open videos are still available.
+ _vm->_vidPlayer->reopenAll();
}
void Inter_v2::o2_setImdFrontSurf() {
@@ -1244,7 +1248,7 @@ void Inter_v2::o2_checkData(OpFuncParams &params) {
file = "EMAP2011.TOT";
int32 size = -1;
- SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file.c_str());
+ SaveLoad::SaveMode mode = _vm->_saveLoad ? _vm->_saveLoad->getSaveMode(file.c_str()) : SaveLoad::kSaveModeNone;
if (mode == SaveLoad::kSaveModeNone) {
size = _vm->_dataIO->fileSize(file);
@@ -1273,7 +1277,7 @@ void Inter_v2::o2_readData(OpFuncParams &params) {
debugC(2, kDebugFileIO, "Read from file \"%s\" (%d, %d bytes at %d)",
file, dataVar, size, offset);
- SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file);
+ SaveLoad::SaveMode mode = _vm->_saveLoad ? _vm->_saveLoad->getSaveMode(file) : SaveLoad::kSaveModeNone;
if (mode == SaveLoad::kSaveModeSave) {
WRITE_VAR(1, 1);
@@ -1345,7 +1349,7 @@ void Inter_v2::o2_writeData(OpFuncParams &params) {
WRITE_VAR(1, 1);
- SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file);
+ SaveLoad::SaveMode mode = _vm->_saveLoad ? _vm->_saveLoad->getSaveMode(file) : SaveLoad::kSaveModeNone;
if (mode == SaveLoad::kSaveModeSave) {
if (!_vm->_saveLoad->save(file, dataVar, size, offset)) {
diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp
index c0e8978afd..24905b08d1 100644
--- a/engines/gob/inter_v5.cpp
+++ b/engines/gob/inter_v5.cpp
@@ -281,7 +281,7 @@ void Inter_v5::o5_getSystemCDSpeed(OpGobParams &params) {
Font *font;
if ((font = _vm->_draw->loadFont("SPEED.LET"))) {
- _vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface, *font);
+ font->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface);
_vm->_draw->forceBlit();
delete font;
@@ -293,7 +293,7 @@ void Inter_v5::o5_getSystemRAM(OpGobParams &params) {
Font *font;
if ((font = _vm->_draw->loadFont("SPEED.LET"))) {
- _vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface, *font);
+ font->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface);
_vm->_draw->forceBlit();
delete font;
@@ -305,7 +305,7 @@ void Inter_v5::o5_getSystemCPUSpeed(OpGobParams &params) {
Font *font;
if ((font = _vm->_draw->loadFont("SPEED.LET"))) {
- _vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface, *font);
+ font->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface);
_vm->_draw->forceBlit();
delete font;
@@ -317,7 +317,7 @@ void Inter_v5::o5_getSystemDrawSpeed(OpGobParams &params) {
Font *font;
if ((font = _vm->_draw->loadFont("SPEED.LET"))) {
- _vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface, *font);
+ font->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface);
_vm->_draw->forceBlit();
delete font;
@@ -329,7 +329,7 @@ void Inter_v5::o5_totalSystemSpecs(OpGobParams &params) {
Font *font;
if ((font = _vm->_draw->loadFont("SPEED.LET"))) {
- _vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface, *font);
+ font->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface);
_vm->_draw->forceBlit();
delete font;
diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
index 81547f7362..6cf69ed9df 100644
--- a/engines/gob/inter_v7.cpp
+++ b/engines/gob/inter_v7.cpp
@@ -22,8 +22,11 @@
#include "common/endian.h"
#include "common/archive.h"
+#include "common/winexe.h"
+#include "common/winexe_pe.h"
#include "graphics/cursorman.h"
+#include "graphics/wincursor.h"
#include "gob/gob.h"
#include "gob/global.h"
@@ -42,7 +45,11 @@ namespace Gob {
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
#define OPCODEGOB(i, x) _opcodesGob[i]._OPCODEGOB(OPCODEVER, x)
-Inter_v7::Inter_v7(GobEngine *vm) : Inter_Playtoons(vm) {
+Inter_v7::Inter_v7(GobEngine *vm) : Inter_Playtoons(vm), _cursors(0) {
+}
+
+Inter_v7::~Inter_v7() {
+ delete _cursors;
}
void Inter_v7::setupOpcodesDraw() {
@@ -86,27 +93,121 @@ void Inter_v7::o7_draw0x0C() {
WRITE_VAR(17, 0);
}
+void Inter_v7::resizeCursors(int16 width, int16 height, int16 count, bool transparency) {
+ if (width <= 0)
+ width = _vm->_draw->_cursorWidth;
+ if (height <= 0)
+ height = _vm->_draw->_cursorHeight;
+
+ width = MAX<uint16>(width , _vm->_draw->_cursorWidth);
+ height = MAX<uint16>(height, _vm->_draw->_cursorHeight);
+
+ _vm->_draw->_transparentCursor = transparency;
+
+ // Cursors sprite already big enough
+ if ((_vm->_draw->_cursorWidth >= width) && (_vm->_draw->_cursorHeight >= height) &&
+ (_vm->_draw->_cursorCount >= count))
+ return;
+
+ _vm->_draw->_cursorCount = count;
+ _vm->_draw->_cursorWidth = width;
+ _vm->_draw->_cursorHeight = height;
+
+ _vm->_draw->freeSprite(Draw::kCursorSurface);
+ _vm->_draw->_cursorSprites.reset();
+ _vm->_draw->_cursorSpritesBack.reset();
+ _vm->_draw->_scummvmCursor.reset();
+
+ _vm->_draw->initSpriteSurf(Draw::kCursorSurface, width * count, height, 2);
+
+ _vm->_draw->_cursorSpritesBack = _vm->_draw->_spritesArray[Draw::kCursorSurface];
+ _vm->_draw->_cursorSprites = _vm->_draw->_cursorSpritesBack;
+
+ _vm->_draw->_scummvmCursor = _vm->_video->initSurfDesc(width, height, SCUMMVM_CURSOR);
+
+ for (int i = 0; i < 40; i++) {
+ _vm->_draw->_cursorAnimLow[i] = -1;
+ _vm->_draw->_cursorAnimDelays[i] = 0;
+ _vm->_draw->_cursorAnimHigh[i] = 0;
+ }
+ _vm->_draw->_cursorAnimLow[1] = 0;
+
+ delete[] _vm->_draw->_doCursorPalettes;
+ delete[] _vm->_draw->_cursorPalettes;
+ delete[] _vm->_draw->_cursorKeyColors;
+ delete[] _vm->_draw->_cursorPaletteStarts;
+ delete[] _vm->_draw->_cursorPaletteCounts;
+ delete[] _vm->_draw->_cursorHotspotsX;
+ delete[] _vm->_draw->_cursorHotspotsY;
+
+ _vm->_draw->_cursorPalettes = new byte[256 * 3 * count];
+ _vm->_draw->_doCursorPalettes = new bool[count];
+ _vm->_draw->_cursorKeyColors = new byte[count];
+ _vm->_draw->_cursorPaletteStarts = new uint16[count];
+ _vm->_draw->_cursorPaletteCounts = new uint16[count];
+ _vm->_draw->_cursorHotspotsX = new int32[count];
+ _vm->_draw->_cursorHotspotsY = new int32[count];
+
+ memset(_vm->_draw->_cursorPalettes , 0, count * 256 * 3);
+ memset(_vm->_draw->_doCursorPalettes , 0, count * sizeof(bool));
+ memset(_vm->_draw->_cursorKeyColors , 0, count * sizeof(byte));
+ memset(_vm->_draw->_cursorPaletteStarts, 0, count * sizeof(uint16));
+ memset(_vm->_draw->_cursorPaletteCounts, 0, count * sizeof(uint16));
+ memset(_vm->_draw->_cursorHotspotsX , 0, count * sizeof(int32));
+ memset(_vm->_draw->_cursorHotspotsY , 0, count * sizeof(int32));
+}
+
void Inter_v7::o7_loadCursor() {
int16 cursorIndex = _vm->_game->_script->readValExpr();
- Common::String cursorFile = _vm->_game->_script->evalString();
+ Common::String cursorName = _vm->_game->_script->evalString();
+
+ // Clear the cursor sprite at that index
+ _vm->_draw->_cursorSprites->fillRect(cursorIndex * _vm->_draw->_cursorWidth, 0,
+ cursorIndex * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1,
+ _vm->_draw->_cursorHeight - 1, 0);
+
+ // If the cursor name is empty, that cursor will be drawn by the scripts
+ if (cursorName.empty()) {
+ // Make sure the cursors sprite is big enough and set to non-extern palette
+ resizeCursors(-1, -1, cursorIndex + 1, true);
+ _vm->_draw->_doCursorPalettes[cursorIndex] = false;
+ return;
+ }
+
+ Graphics::WinCursorGroup *cursorGroup = 0;
+ Graphics::Cursor *defaultCursor = 0;
+
+ // Load the cursor file and cursor group
+ if (loadCursorFile())
+ cursorGroup = Graphics::WinCursorGroup::createCursorGroup(*_cursors, Common::WinResourceID(cursorName));
+
+ // If the requested cursor does not exist, create a default one
+ const Graphics::Cursor *cursor = 0;
+ if (!cursorGroup || cursorGroup->cursors.empty() || !cursorGroup->cursors[0].cursor) {
+ defaultCursor = Graphics::makeDefaultWinCursor();
+
+ cursor = defaultCursor;
+ } else
+ cursor = cursorGroup->cursors[0].cursor;
- warning("Addy Stub: Load cursor \"%s\" to %d", cursorFile.c_str(), cursorIndex);
+ // Make sure the cursors sprite it big enough
+ resizeCursors(cursor->getWidth(), cursor->getHeight(), cursorIndex + 1, true);
- byte cursor[9];
- byte palette[6];
+ Surface cursorSurf(cursor->getWidth(), cursor->getHeight(), 1, cursor->getSurface());
- cursor[0] = 0; cursor[1] = 0; cursor[2] = 0;
- cursor[3] = 0; cursor[4] = 1; cursor[5] = 0;
- cursor[6] = 0; cursor[7] = 0; cursor[8] = 0;
+ _vm->_draw->_cursorSprites->blit(cursorSurf, cursorIndex * _vm->_draw->_cursorWidth, 0);
- palette[0] = 0; palette[1] = 0; palette[2] = 0;
- palette[3] = 255; palette[4] = 255; palette[5] = 255;
+ memcpy(_vm->_draw->_cursorPalettes + cursorIndex * 256 * 3, cursor->getPalette(), cursor->getPaletteCount() * 3);
- CursorMan.pushCursorPalette(palette, 0, 2);
- CursorMan.disableCursorPalette(false);
- CursorMan.replaceCursor(cursor, 3, 3, 1, 1, 255);
+ _vm->_draw->_doCursorPalettes [cursorIndex] = true;
+ _vm->_draw->_cursorKeyColors [cursorIndex] = cursor->getKeyColor();
+ _vm->_draw->_cursorPaletteStarts[cursorIndex] = cursor->getPaletteStartIndex();
+ _vm->_draw->_cursorPaletteCounts[cursorIndex] = cursor->getPaletteCount();
+ _vm->_draw->_cursorHotspotsX [cursorIndex] = cursor->getHotspotX();
+ _vm->_draw->_cursorHotspotsY [cursorIndex] = cursor->getHotspotY();
- CursorMan.showMouse(true);
+ delete cursorGroup;
+ delete defaultCursor;
}
void Inter_v7::o7_displayWarning() {
@@ -529,4 +630,19 @@ Common::String Inter_v7::findFile(const Common::String &mask) {
return files.front()->getName();
}
+bool Inter_v7::loadCursorFile() {
+ if (_cursors)
+ return true;
+
+ _cursors = new Common::PEResources();
+
+ if (_cursors->loadFromEXE("cursor32.dll"))
+ return true;
+
+ delete _cursors;
+ _cursors = 0;
+
+ return false;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 6f4c6e168a..56c7b5213c 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -706,16 +706,16 @@ void Diving::updateAnims() {
for (Common::List<ANIObject *>::iterator a = _anims.reverse_begin();
a != _anims.end(); --a) {
- (*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
- _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if ((*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
// Draw the current animation frames
for (Common::List<ANIObject *>::iterator a = _anims.begin();
a != _anims.end(); ++a) {
- (*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
- _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if ((*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
(*a)->advance();
}
diff --git a/engines/gob/minigames/geisha/evilfish.cpp b/engines/gob/minigames/geisha/evilfish.cpp
index c7ef9d5622..05ae9d0ad4 100644
--- a/engines/gob/minigames/geisha/evilfish.cpp
+++ b/engines/gob/minigames/geisha/evilfish.cpp
@@ -171,7 +171,7 @@ void EvilFish::mutate(uint16 animSwimLeft, uint16 animSwimRight,
}
}
-bool EvilFish::isDead() {
+bool EvilFish::isDead() const {
return !isVisible() || (_state == kStateNone) || (_state == kStateDie);
}
diff --git a/engines/gob/minigames/geisha/evilfish.h b/engines/gob/minigames/geisha/evilfish.h
index 81efb676e2..4c82629461 100644
--- a/engines/gob/minigames/geisha/evilfish.h
+++ b/engines/gob/minigames/geisha/evilfish.h
@@ -58,7 +58,7 @@ public:
uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
/** Is the fish dead? */
- bool isDead();
+ bool isDead() const;
private:
enum State {
diff --git a/engines/gob/minigames/geisha/meter.cpp b/engines/gob/minigames/geisha/meter.cpp
index e3b9bd1ccf..7ec3119866 100644
--- a/engines/gob/minigames/geisha/meter.cpp
+++ b/engines/gob/minigames/geisha/meter.cpp
@@ -42,6 +42,10 @@ Meter::~Meter() {
delete _surface;
}
+int32 Meter::getMaxValue() const {
+ return _maxValue;
+}
+
int32 Meter::getValue() const {
return _value;
}
@@ -59,22 +63,36 @@ void Meter::setMaxValue() {
setValue(_maxValue);
}
-void Meter::increase(int32 n) {
+int32 Meter::increase(int32 n) {
+ if (n < 0)
+ return decrease(-n);
+
+ int32 overflow = MAX<int32>(0, (_value + n) - _maxValue);
+
int32 value = CLIP<int32>(_value + n, 0, _maxValue);
if (_value == value)
- return;
+ return overflow;
_value = value;
_needUpdate = true;
+
+ return overflow;
}
-void Meter::decrease(int32 n) {
+int32 Meter::decrease(int32 n) {
+ if (n < 0)
+ return increase(-n);
+
+ int32 underflow = -MIN<int32>(0, _value - n);
+
int32 value = CLIP<int32>(_value - n, 0, _maxValue);
if (_value == value)
- return;
+ return underflow;
_value = value;
_needUpdate = true;
+
+ return underflow;
}
void Meter::draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
diff --git a/engines/gob/minigames/geisha/meter.h b/engines/gob/minigames/geisha/meter.h
index a9bdb14d0f..30dc826de0 100644
--- a/engines/gob/minigames/geisha/meter.h
+++ b/engines/gob/minigames/geisha/meter.h
@@ -44,6 +44,8 @@ public:
Direction direction);
~Meter();
+ /** Return the max value the meter is measuring. */
+ int32 getMaxValue() const;
/** Return the current value the meter is measuring. */
int32 getValue() const;
@@ -53,10 +55,10 @@ public:
/** 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);
+ /** Increase the current value the meter is measuring, returning the overflow. */
+ int32 increase(int32 n = 1);
+ /** Decrease the current value the meter is measuring, returning the underflow. */
+ int32 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);
diff --git a/engines/gob/minigames/geisha/mouth.cpp b/engines/gob/minigames/geisha/mouth.cpp
new file mode 100644
index 0000000000..7ba9f86f8c
--- /dev/null
+++ b/engines/gob/minigames/geisha/mouth.cpp
@@ -0,0 +1,169 @@
+/* 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/minigames/geisha/mouth.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+Mouth::Mouth(const ANIFile &ani, const CMPFile &cmp,
+ uint16 mouthAnim, uint16 mouthSprite, uint16 floorSprite) : ANIObject(ani) {
+
+ _sprite = new ANIObject(cmp);
+ _sprite->setAnimation(mouthSprite);
+ _sprite->setVisible(true);
+
+ for (int i = 0; i < kFloorCount; i++) {
+ _floor[i] = new ANIObject(cmp);
+ _floor[i]->setAnimation(floorSprite);
+ _floor[i]->setVisible(true);
+ }
+
+ _state = kStateDeactivated;
+
+ setAnimation(mouthAnim);
+ setMode(kModeOnce);
+ setPause(true);
+ setVisible(true);
+}
+
+Mouth::~Mouth() {
+ for (int i = 0; i < kFloorCount; i++)
+ delete _floor[i];
+
+ delete _sprite;
+}
+
+void Mouth::advance() {
+ if (_state != kStateActivated)
+ return;
+
+ // Animation finished, set state to dead
+ if (isPaused()) {
+ _state = kStateDead;
+ return;
+ }
+
+ ANIObject::advance();
+}
+
+void Mouth::activate() {
+ if (_state != kStateDeactivated)
+ return;
+
+ _state = kStateActivated;
+
+ setPause(false);
+}
+
+bool Mouth::isDeactivated() const {
+ return _state == kStateDeactivated;
+}
+
+void Mouth::setPosition(int16 x, int16 y) {
+ ANIObject::setPosition(x, y);
+
+ int16 floorWidth, floorHeight;
+ _floor[0]->getFrameSize(floorWidth, floorHeight);
+
+ _sprite->setPosition(x, y);
+
+ for (int i = 0; i < kFloorCount; i++)
+ _floor[i]->setPosition(x + (i * floorWidth), y);
+}
+
+bool Mouth::draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ // If the mouth is deactivated, draw the default mouth sprite
+ if (_state == kStateDeactivated)
+ return _sprite->draw(dest, left, top, right, bottom);
+
+ // If the mouth is activated, draw the current mouth animation sprite
+ if (_state == kStateActivated)
+ return ANIObject::draw(dest, left, top, right, bottom);
+
+ // If the mouth is dead, draw the floor tiles
+ if (_state == kStateDead) {
+ int16 fLeft, fRight, fTop, fBottom;
+ bool drawn = false;
+
+ left = 0x7FFF;
+ top = 0x7FFF;
+ right = 0;
+ bottom = 0;
+
+ for (int i = 0; i < kFloorCount; i++) {
+ if (_floor[i]->draw(dest, fLeft, fTop, fRight, fBottom)) {
+ drawn = true;
+ left = MIN(left , fLeft);
+ top = MIN(top , fTop);
+ right = MAX(right , fRight);
+ bottom = MAX(bottom, fBottom);
+ }
+ }
+
+ return drawn;
+ }
+
+ return false;
+}
+
+bool Mouth::clear(Surface &dest, int16 &left , int16 &top, int16 &right, int16 &bottom) {
+ // If the mouth is deactivated, clear the default mouth sprite
+ if (_state == kStateDeactivated)
+ return _sprite->clear(dest, left, top, right, bottom);
+
+ // If the mouth is activated, clear the current mouth animation sprite
+ if (_state == kStateActivated)
+ return ANIObject::clear(dest, left, top, right, bottom);
+
+ // If the mouth is clear, draw the floor tiles
+ if (_state == kStateDead) {
+ int16 fLeft, fRight, fTop, fBottom;
+ bool cleared = false;
+
+ left = 0x7FFF;
+ top = 0x7FFF;
+ right = 0;
+ bottom = 0;
+
+ for (int i = 0; i < kFloorCount; i++) {
+ if (_floor[i]->clear(dest, fLeft, fTop, fRight, fBottom)) {
+ cleared = true;
+ left = MIN(left , fLeft);
+ top = MIN(top , fTop);
+ right = MAX(right , fRight);
+ bottom = MAX(bottom, fBottom);
+ }
+ }
+
+ return cleared;
+ }
+
+ return false;
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/mouth.h b/engines/gob/minigames/geisha/mouth.h
new file mode 100644
index 0000000000..2e0cfcd5d0
--- /dev/null
+++ b/engines/gob/minigames/geisha/mouth.h
@@ -0,0 +1,75 @@
+/* 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_MOUTH_H
+#define GOB_MINIGAMES_GEISHA_MOUTH_H
+
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+/** A kissing/biting mouth in Geisha's "Penetration" minigame. */
+class Mouth : public ANIObject {
+public:
+ Mouth(const ANIFile &ani, const CMPFile &cmp,
+ uint16 mouthAnim, uint16 mouthSprite, uint16 floorSprite);
+ ~Mouth();
+
+ /** Advance the animation to the next frame. */
+ void advance();
+
+ /** Active the mouth's animation. */
+ void activate();
+
+ /** Is the mouth deactivated? */
+ bool isDeactivated() const;
+
+ /** Set the current position. */
+ void setPosition(int16 x, int16 y);
+
+ /** Draw the current frame onto the surface and return the affected rectangle. */
+ bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ /** Draw the current frame from the surface and return the affected rectangle. */
+ bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+private:
+ static const int kFloorCount = 2;
+
+ enum State {
+ kStateDeactivated,
+ kStateActivated,
+ kStateDead
+ };
+
+ ANIObject *_sprite;
+ ANIObject *_floor[kFloorCount];
+
+ State _state;
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_MOUTH_H
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 121a45bc40..c8c4f2bba7 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -20,87 +20,1449 @@
*
*/
+#include "common/events.h"
+
#include "gob/global.h"
#include "gob/util.h"
+#include "gob/palanim.h"
#include "gob/draw.h"
#include "gob/video.h"
#include "gob/decfile.h"
+#include "gob/cmpfile.h"
#include "gob/anifile.h"
+#include "gob/aniobject.h"
+
+#include "gob/sound/sound.h"
#include "gob/minigames/geisha/penetration.h"
+#include "gob/minigames/geisha/meter.h"
+#include "gob/minigames/geisha/mouth.h"
namespace Gob {
namespace Geisha {
-static const byte kPalette[48] = {
- 0x16, 0x16, 0x16,
- 0x12, 0x14, 0x16,
- 0x34, 0x00, 0x25,
- 0x1D, 0x1F, 0x22,
- 0x24, 0x27, 0x2A,
- 0x2C, 0x0D, 0x22,
- 0x2B, 0x2E, 0x32,
- 0x12, 0x09, 0x20,
- 0x3D, 0x3F, 0x00,
- 0x3F, 0x3F, 0x3F,
- 0x00, 0x00, 0x00,
- 0x15, 0x15, 0x3F,
- 0x25, 0x22, 0x2F,
- 0x1A, 0x14, 0x28,
- 0x3F, 0x00, 0x00,
- 0x15, 0x3F, 0x15
+static const int kColorShield = 11;
+static const int kColorHealth = 15;
+static const int kColorBlack = 10;
+static const int kColorFloor = 13;
+static const int kColorFloorText = 14;
+static const int kColorExitText = 15;
+
+enum Sprite {
+ kSpriteFloorShield = 25,
+ kSpriteExit = 29,
+ kSpriteFloor = 30,
+ kSpriteWall = 31,
+ kSpriteMouthBite = 32,
+ kSpriteMouthKiss = 33,
+ kSpriteBulletN = 65,
+ kSpriteBulletS = 66,
+ kSpriteBulletW = 67,
+ kSpriteBulletE = 68,
+ kSpriteBulletSW = 85,
+ kSpriteBulletSE = 86,
+ kSpriteBulletNW = 87,
+ kSpriteBulletNE = 88
+};
+
+enum Animation {
+ kAnimationEnemyRound = 0,
+ kAnimationEnemyRoundExplode = 1,
+ kAnimationEnemySquare = 2,
+ kAnimationEnemySquareExplode = 3,
+ kAnimationMouthKiss = 33,
+ kAnimationMouthBite = 34
+};
+
+static const int kMapTileWidth = 24;
+static const int kMapTileHeight = 24;
+
+static const int kPlayAreaX = 120;
+static const int kPlayAreaY = 7;
+static const int kPlayAreaWidth = 192;
+static const int kPlayAreaHeight = 113;
+
+static const int kPlayAreaBorderWidth = kPlayAreaWidth / 2;
+static const int kPlayAreaBorderHeight = kPlayAreaHeight / 2;
+
+static const int kTextAreaLeft = 9;
+static const int kTextAreaTop = 7;
+static const int kTextAreaRight = 104;
+static const int kTextAreaBottom = 107;
+
+static const int kTextAreaBigBottom = 142;
+
+const byte Penetration::kPalettes[kFloorCount][3 * kPaletteSize] = {
+ {
+ 0x16, 0x16, 0x16,
+ 0x12, 0x14, 0x16,
+ 0x34, 0x00, 0x25,
+ 0x1D, 0x1F, 0x22,
+ 0x24, 0x27, 0x2A,
+ 0x2C, 0x0D, 0x22,
+ 0x2B, 0x2E, 0x32,
+ 0x12, 0x09, 0x20,
+ 0x3D, 0x3F, 0x00,
+ 0x3F, 0x3F, 0x3F,
+ 0x00, 0x00, 0x00,
+ 0x15, 0x15, 0x3F,
+ 0x25, 0x22, 0x2F,
+ 0x1A, 0x14, 0x28,
+ 0x3F, 0x00, 0x00,
+ 0x15, 0x3F, 0x15
+ },
+ {
+ 0x16, 0x16, 0x16,
+ 0x12, 0x14, 0x16,
+ 0x37, 0x00, 0x24,
+ 0x1D, 0x1F, 0x22,
+ 0x24, 0x27, 0x2A,
+ 0x30, 0x0E, 0x16,
+ 0x2B, 0x2E, 0x32,
+ 0x22, 0x0E, 0x26,
+ 0x3D, 0x3F, 0x00,
+ 0x3F, 0x3F, 0x3F,
+ 0x00, 0x00, 0x00,
+ 0x15, 0x15, 0x3F,
+ 0x36, 0x28, 0x36,
+ 0x30, 0x1E, 0x2A,
+ 0x3F, 0x00, 0x00,
+ 0x15, 0x3F, 0x15
+ },
+ {
+ 0x16, 0x16, 0x16,
+ 0x12, 0x14, 0x16,
+ 0x3F, 0x14, 0x22,
+ 0x1D, 0x1F, 0x22,
+ 0x24, 0x27, 0x2A,
+ 0x30, 0x10, 0x10,
+ 0x2B, 0x2E, 0x32,
+ 0x2A, 0x12, 0x12,
+ 0x3D, 0x3F, 0x00,
+ 0x3F, 0x3F, 0x3F,
+ 0x00, 0x00, 0x00,
+ 0x15, 0x15, 0x3F,
+ 0x3F, 0x23, 0x31,
+ 0x39, 0x20, 0x2A,
+ 0x3F, 0x00, 0x00,
+ 0x15, 0x3F, 0x15
+ }
+};
+
+const byte Penetration::kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight] = {
+ {
+ { // Real mode, floor 0
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0,
+ 50, 50, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50,
+ 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 0, 50, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 50, 0, 0, 50, 50, 50, 50, 0, 54, 55, 0, 0, 50, 0, 50,
+ 50, 0, 50, 49, 0, 50, 0, 52, 53, 0, 50, 50, 50, 0, 0, 0, 50,
+ 50, 57, 0, 50, 0, 0, 0, 50, 50, 50, 0, 0, 56, 50, 54, 55, 50,
+ 50, 50, 0, 0, 50, 50, 50, 0, 0, 0, 0, 50, 0, 0, 50, 0, 50,
+ 50, 51, 50, 0, 54, 55, 0, 0, 50, 50, 50, 50, 52, 53, 50, 0, 50,
+ 50, 0, 50, 0, 0, 0, 0, 0, 54, 55, 0, 0, 0, 50, 0, 0, 50,
+ 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 50,
+ 50, 50, 0, 52, 53, 0, 0, 0, 0, 0, 0, 52, 53, 0, 0, 50, 50,
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0
+ },
+ { // Real mode, floor 1
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0,
+ 50, 0, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
+ 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 50, 51, 52, 53, 0, 0, 52, 53, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 50, 0, 50, 0, 50, 0, 50, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 52, 53, 0, 0, 0, 0, 0, 52, 53, 0, 52, 53, 50,
+ 50, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 50, 52, 53, 0, 0, 52, 53, 0, 0, 0, 0, 0, 54, 55, 50,
+ 50, 0, 50, 0, 50, 0, 50, 50, 0, 50, 50, 0, 50, 0, 50, 50, 50,
+ 50, 0, 50, 49, 0, 0, 52, 53, 0, 52, 53, 0, 0, 0, 50, 56, 50,
+ 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 0, 0, 0, 0, 0, 0, 54, 55, 0, 0, 0, 0, 0, 0, 50,
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0
+ },
+ { // Real mode, floor 2
+ 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0,
+ 50, 52, 53, 0, 0, 0, 0, 50, 50, 50, 0, 0, 0, 0, 52, 53, 50,
+ 50, 0, 50, 50, 50, 0, 0, 0, 50, 0, 0, 0, 50, 50, 50, 0, 50,
+ 50, 0, 50, 52, 53, 50, 50, 52, 53, 0, 50, 50, 54, 55, 50, 0, 50,
+ 50, 0, 50, 0, 0, 0, 0, 50, 0, 50, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 52, 53, 50,
+ 0, 50, 0, 50, 50, 50, 0, 57, 50, 51, 0, 50, 50, 50, 0, 50, 0,
+ 50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 52, 53, 50, 0, 0, 0, 50,
+ 50, 0, 50, 0, 0, 0, 0, 50, 56, 50, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 50, 54, 55, 50, 50, 0, 0, 0, 50, 50, 54, 55, 50, 0, 50,
+ 50, 0, 50, 50, 50, 0, 0, 0, 50, 0, 0, 0, 50, 50, 50, 0, 50,
+ 50, 52, 53, 0, 0, 0, 0, 50, 50, 50, 0, 0, 0, 0, 52, 53, 50,
+ 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0
+ }
+ },
+ {
+ { // Test mode, floor 0
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 56, 0, 50, 0, 0, 52, 53, 0, 0, 0, 0, 52, 53, 0, 51, 50,
+ 50, 0, 0, 50, 0, 0, 0, 50, 0, 54, 55, 50, 0, 50, 50, 50, 50,
+ 50, 52, 53, 50, 50, 0, 0, 50, 50, 50, 50, 50, 0, 50, 0, 0, 50,
+ 50, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 50, 49, 50, 0, 0, 50,
+ 50, 0, 54, 55, 0, 50, 50, 54, 55, 0, 50, 50, 50, 0, 0, 0, 50,
+ 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 53, 0, 0, 54, 55, 50,
+ 50, 0, 50, 0, 50, 0, 0, 50, 0, 0, 0, 50, 0, 0, 0, 0, 50,
+ 50, 0, 50, 0, 50, 54, 55, 50, 0, 50, 50, 50, 0, 50, 0, 0, 50,
+ 50, 50, 50, 50, 50, 0, 0, 50, 0, 0, 0, 0, 0, 50, 54, 55, 50,
+ 50, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 0, 0, 0, 50,
+ 50, 57, 0, 52, 53, 0, 0, 0, 0, 54, 55, 0, 0, 0, 0, 56, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
+ },
+ { // Test mode, floor 1
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
+ 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 54, 55, 0, 50,
+ 50, 0, 50, 52, 53, 0, 0, 50, 0, 0, 54, 55, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 0, 52, 53, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 50, 50, 50, 50, 49, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 0, 50, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 51, 0, 0, 52, 53, 50, 0, 50, 0, 50,
+ 50, 57, 50, 0, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 0, 50,
+ 50, 50, 50, 0, 50, 56, 0, 0, 0, 54, 55, 0, 0, 0, 50, 0, 50,
+ 50, 56, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50,
+ 50, 50, 50, 50, 0, 0, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
+ },
+ { // Test mode, floor 2
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 57, 50, 54, 55, 0, 50, 54, 55, 0, 50, 0, 52, 53, 50, 51, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 0, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 52, 53, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 0, 0, 50, 0, 50, 0, 50, 0, 0, 0, 50, 0, 50, 0, 50,
+ 50, 0, 0, 0, 50, 52, 53, 0, 50, 52, 53, 56, 50, 0, 54, 55, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
+ }
+ }
+};
+
+static const int kLanguageCount = 5;
+static const int kFallbackLanguage = 2; // English
+
+enum String {
+ kString3rdBasement = 0,
+ kString2ndBasement,
+ kString1stBasement,
+ kStringNoExit,
+ kStringYouHave,
+ kString2Exits,
+ kString1Exit,
+ kStringToReach,
+ kStringUpperLevel1,
+ kStringUpperLevel2,
+ kStringLevel0,
+ kStringPenetration,
+ kStringSuccessful,
+ kStringDanger,
+ kStringGynoides,
+ kStringActivated,
+ kStringCount
};
-Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _objects(0) {
+static const char *kStrings[kLanguageCount][kStringCount] = {
+ { // French
+ "3EME SOUS-SOL",
+ "2EME SOUS-SOL",
+ "1ER SOUS-SOL",
+ "SORTIE REFUSEE",
+ "Vous disposez",
+ "de deux sorties",
+ "d\'une sortie",
+ "pour l\'acc\212s au",
+ "niveau",
+ "sup\202rieur",
+ "- NIVEAU 0 -",
+ "PENETRATION",
+ "REUSSIE",
+ "DANGER",
+ "GYNOIDES",
+ "ACTIVEES"
+ },
+ { // German
+ // NOTE: The original had very broken German there. We provide proper(ish) German instead.
+ // B0rken text in the comments after each line
+ "3. UNTERGESCHOSS", // "3. U.-GESCHOSS""
+ "2. UNTERGESCHOSS", // "2. U.-GESCHOSS"
+ "1. UNTERGESCHOSS", // "1. U.-GESCHOSS"
+ "AUSGANG GESPERRT",
+ "Sie haben",
+ "zwei Ausg\204nge", // "zwei Ausgang"
+ "einen Ausgang", // "Fortsetztung"
+ "um das obere", // ""
+ "Stockwerk zu", // ""
+ "erreichen", // ""
+ "- STOCKWERK 0 -", // "0 - HOHE"
+ "PENETRATION", // "DURCHDRIGEN"
+ "ERFOLGREICH", // "ERFOLG"
+ "GEFAHR",
+ "GYNOIDE",
+ "AKTIVIERT",
+ },
+ { // English
+ "3RD BASEMENT",
+ "2ND BASEMENT",
+ "1ST BASEMENT",
+ "NO EXIT",
+ "You have",
+ "2 exits",
+ "1 exit",
+ "to reach upper",
+ "level",
+ "",
+ "- 0 LEVEL -",
+ "PENETRATION",
+ "SUCCESSFUL",
+ "DANGER",
+ "GYNOIDES",
+ "ACTIVATED",
+ },
+ { // Spanish
+ "3ER. SUBSUELO",
+ "2D. SUBSUELO",
+ "1ER. SUBSUELO",
+ "SALIDA RECHAZADA",
+ "Dispones",
+ "de dos salidas",
+ "de una salida",
+ "para acceso al",
+ "nivel",
+ "superior",
+ "- NIVEL 0 -",
+ "PENETRACION",
+ "CONSEGUIDA",
+ "PELIGRO",
+ "GYNOIDAS",
+ "ACTIVADAS",
+ },
+ { // Italian
+ "SOTTOSUOLO 3",
+ "SOTTOSUOLO 2",
+ "SOTTOSUOLO 1",
+ "NON USCITA",
+ "avete",
+ "due uscite",
+ "un\' uscita",
+ "per accedere al",
+ "livello",
+ "superiore",
+ "- LIVELLO 0 -",
+ "PENETRAZIONE",
+ "RIUSCITA",
+ "PERICOLO",
+ "GYNOIDI",
+ "ATTIVATE",
+ }
+};
+
+
+Penetration::MapObject::MapObject(uint16 tX, uint16 tY, uint16 mX, uint16 mY, uint16 w, uint16 h) :
+ tileX(tX), tileY(tY), mapX(mX), mapY(mY), width(w), height(h) {
+
+ isBlocking = true;
+}
+
+Penetration::MapObject::MapObject(uint16 tX, uint16 tY, uint16 w, uint16 h) :
+ tileX(tX), tileY(tY), width(w), height(h) {
+
+ isBlocking = true;
+
+ setMapFromTilePosition();
+}
+
+void Penetration::MapObject::setTileFromMapPosition() {
+ tileX = (mapX + (width / 2)) / kMapTileWidth;
+ tileY = (mapY + (height / 2)) / kMapTileHeight;
+}
+
+void Penetration::MapObject::setMapFromTilePosition() {
+ mapX = tileX * kMapTileWidth;
+ mapY = tileY * kMapTileHeight;
+}
+
+bool Penetration::MapObject::isIn(uint16 mX, uint16 mY) const {
+ if ((mX < mapX) || (mY < mapY))
+ return false;
+ if ((mX > (mapX + width - 1)) || (mY > (mapY + height - 1)))
+ return false;
+
+ return true;
+}
+
+bool Penetration::MapObject::isIn(uint16 mX, uint16 mY, uint16 w, uint16 h) const {
+ return isIn(mX , mY ) ||
+ isIn(mX + w - 1, mY ) ||
+ isIn(mX , mY + h - 1) ||
+ isIn(mX + w - 1, mY + h - 1);
+}
+
+bool Penetration::MapObject::isIn(const MapObject &obj) const {
+ return isIn(obj.mapX, obj.mapY, obj.width, obj.height);
+}
+
+
+Penetration::ManagedMouth::ManagedMouth(uint16 tX, uint16 tY, MouthType t) :
+ MapObject(tX, tY, 0, 0), mouth(0), type(t) {
+
+}
+
+Penetration::ManagedMouth::~ManagedMouth() {
+ delete mouth;
+}
+
+
+Penetration::ManagedSub::ManagedSub(uint16 tX, uint16 tY) :
+ MapObject(tX, tY, kMapTileWidth, kMapTileHeight), sub(0) {
+
+}
+
+Penetration::ManagedSub::~ManagedSub() {
+ delete sub;
+}
+
+
+Penetration::ManagedEnemy::ManagedEnemy() : MapObject(0, 0, 0, 0), enemy(0), dead(false) {
+}
+
+Penetration::ManagedEnemy::~ManagedEnemy() {
+ delete enemy;
+}
+
+void Penetration::ManagedEnemy::clear() {
+ delete enemy;
+
+ enemy = 0;
+}
+
+
+Penetration::ManagedBullet::ManagedBullet() : MapObject(0, 0, 0, 0), bullet(0) {
+}
+
+Penetration::ManagedBullet::~ManagedBullet() {
+ delete bullet;
+}
+
+void Penetration::ManagedBullet::clear() {
+ delete bullet;
+
+ bullet = 0;
+}
+
+
+Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0), _sub(0),
+ _shieldMeter(0), _healthMeter(0), _floor(0), _isPlaying(false) {
+
_background = new Surface(320, 200, 1);
+
+ _shieldMeter = new Meter(11, 119, 92, 3, kColorShield, kColorBlack, 920, Meter::kFillToRight);
+ _healthMeter = new Meter(11, 137, 92, 3, kColorHealth, kColorBlack, 920, Meter::kFillToRight);
+
+ _map = new Surface(kMapWidth * kMapTileWidth + kPlayAreaWidth ,
+ kMapHeight * kMapTileHeight + kPlayAreaHeight, 1);
}
Penetration::~Penetration() {
deinit();
+ delete _map;
+
+ delete _shieldMeter;
+ delete _healthMeter;
+
delete _background;
}
-bool Penetration::play(uint16 var1, uint16 var2, uint16 var3) {
+bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
+ _hasAccessPass = hasAccessPass;
+ _hasMaxEnergy = hasMaxEnergy;
+ _testMode = testMode;
+
+ _isPlaying = true;
+
init();
initScreen();
+ drawFloorText();
+
_vm->_draw->blitInvalidated();
_vm->_video->retrace();
- while (!_vm->_util->keyPressed() && !_vm->shouldQuit())
- _vm->_util->longDelay(1);
+
+ while (!_vm->shouldQuit() && !_quit && !isDead() && !hasWon()) {
+ enemiesCreate();
+ bulletsMove();
+ updateAnims();
+
+ // Draw, fade in if necessary and wait for the end of the frame
+ _vm->_draw->blitInvalidated();
+ fadeIn();
+ _vm->_util->waitEndFrame(false);
+
+ // Handle the input
+ checkInput();
+
+ // Handle the sub movement
+ handleSub();
+
+ // Handle the enemies movement
+ enemiesMove();
+
+ checkExited();
+
+ if (_shotCoolDown > 0)
+ _shotCoolDown--;
+ }
deinit();
- return true;
+ drawEndText();
+
+ _isPlaying = false;
+
+ return hasWon();
+}
+
+bool Penetration::isPlaying() const {
+ return _isPlaying;
+}
+
+void Penetration::cheatWin() {
+ _floor = 3;
}
void Penetration::init() {
+ // Load sounds
+ _vm->_sound->sampleLoad(&_soundShield , SOUND_SND, "boucl.snd");
+ _vm->_sound->sampleLoad(&_soundBite , SOUND_SND, "pervet.snd");
+ _vm->_sound->sampleLoad(&_soundKiss , SOUND_SND, "baise.snd");
+ _vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
+ _vm->_sound->sampleLoad(&_soundExit , SOUND_SND, "trouve.snd");
+ _vm->_sound->sampleLoad(&_soundExplode, SOUND_SND, "virmor.snd");
+
+ _quit = false;
+ for (int i = 0; i < kKeyCount; i++)
+ _keys[i] = false;
+
_background->clear();
_vm->_video->drawPackedSprite("hyprmef2.cmp", *_background);
+ _sprites = new CMPFile(_vm, "tcifplai.cmp", 320, 200);
_objects = new ANIFile(_vm, "tcite.ani", 320);
+
+ // The shield starts down
+ _shieldMeter->setValue(0);
+
+ // If we don't have the max energy tokens, the health starts at 1/3 strength
+ if (_hasMaxEnergy)
+ _healthMeter->setMaxValue();
+ else
+ _healthMeter->setValue(_healthMeter->getMaxValue() / 3);
+
+ _floor = 0;
+
+ _shotCoolDown = 0;
+
+ createMap();
}
void Penetration::deinit() {
+ _soundShield.free();
+ _soundBite.free();
+ _soundKiss.free();
+ _soundShoot.free();
+ _soundExit.free();
+ _soundExplode.free();
+
+ clearMap();
+
delete _objects;
+ delete _sprites;
_objects = 0;
+ _sprites = 0;
+}
+
+void Penetration::clearMap() {
+ _mapAnims.clear();
+ _anims.clear();
+
+ _blockingObjects.clear();
+
+ _walls.clear();
+ _exits.clear();
+ _shields.clear();
+ _mouths.clear();
+
+ for (int i = 0; i < kEnemyCount; i++)
+ _enemies[i].clear();
+ for (int i = 0; i < kMaxBulletCount; i++)
+ _bullets[i].clear();
+
+ delete _sub;
+
+ _sub = 0;
+
+ _map->fill(kColorBlack);
+}
+
+void Penetration::createMap() {
+ if (_floor >= kFloorCount)
+ error("Geisha: Invalid floor %d in minigame penetration", _floor);
+
+ clearMap();
+
+ const byte *mapTiles = kMaps[_testMode ? 1 : 0][_floor];
+
+ bool exitWorks;
+
+ // Draw the map tiles
+ for (int y = 0; y < kMapHeight; y++) {
+ for (int x = 0; x < kMapWidth; x++) {
+ const byte mapTile = mapTiles[y * kMapWidth + x];
+
+ const int posX = kPlayAreaBorderWidth + x * kMapTileWidth;
+ const int posY = kPlayAreaBorderHeight + y * kMapTileHeight;
+
+ switch (mapTile) {
+ case 0: // Floor
+ _sprites->draw(*_map, kSpriteFloor, posX, posY);
+ break;
+
+ case 49: // Emergency exit (needs access pass)
+
+ exitWorks = _hasAccessPass;
+ if (exitWorks) {
+ _sprites->draw(*_map, kSpriteExit, posX, posY);
+ _exits.push_back(MapObject(x, y, 0, 0));
+ } else {
+ _sprites->draw(*_map, kSpriteWall, posX, posY);
+ _walls.push_back(MapObject(x, y, kMapTileWidth, kMapTileHeight));
+ }
+
+ break;
+
+ case 50: // Wall
+ _sprites->draw(*_map, kSpriteWall, posX, posY);
+ _walls.push_back(MapObject(x, y, kMapTileWidth, kMapTileHeight));
+ break;
+
+ case 51: // Regular exit
+
+ // A regular exit works always in test mode.
+ // But if we're in real mode, and on the last floor, it needs an access pass
+ exitWorks = _testMode || (_floor < 2) || _hasAccessPass;
+
+ if (exitWorks) {
+ _sprites->draw(*_map, kSpriteExit, posX, posY);
+ _exits.push_back(MapObject(x, y, 0, 0));
+ } else {
+ _sprites->draw(*_map, kSpriteWall, posX, posY);
+ _walls.push_back(MapObject(x, y, kMapTileWidth, kMapTileHeight));
+ }
+
+ break;
+
+ case 52: // Left side of biting mouth
+ _mouths.push_back(ManagedMouth(x, y, kMouthTypeBite));
+
+ _mouths.back().mouth =
+ new Mouth(*_objects, *_sprites, kAnimationMouthBite, kSpriteMouthBite, kSpriteFloor);
+
+ _mouths.back().mouth->setPosition(posX, posY);
+ break;
+
+ case 53: // Right side of biting mouth
+ break;
+
+ case 54: // Left side of kissing mouth
+ _mouths.push_back(ManagedMouth(x, y, kMouthTypeKiss));
+
+ _mouths.back().mouth =
+ new Mouth(*_objects, *_sprites, kAnimationMouthKiss, kSpriteMouthKiss, kSpriteFloor);
+
+ _mouths.back().mouth->setPosition(posX, posY);
+ break;
+
+ case 55: // Right side of kissing mouth
+ break;
+
+ case 56: // Shield lying on the floor
+ _sprites->draw(*_map, kSpriteFloor , posX , posY ); // Floor
+ _sprites->draw(*_map, kSpriteFloorShield, posX + 4, posY + 8); // Shield
+
+ _map->fillRect(posX + 4, posY + 8, posX + 7, posY + 18, kColorFloor); // Area left to shield
+ _map->fillRect(posX + 17, posY + 8, posX + 20, posY + 18, kColorFloor); // Area right to shield
+
+ _shields.push_back(MapObject(x, y, 0, 0));
+ break;
+
+ case 57: // Start position
+ _sprites->draw(*_map, kSpriteFloor, posX, posY);
+
+ delete _sub;
+
+ _sub = new ManagedSub(x, y);
+
+ _sub->sub = new Submarine(*_objects);
+ _sub->sub->setPosition(kPlayAreaX + kPlayAreaBorderWidth, kPlayAreaY + kPlayAreaBorderHeight);
+ break;
+ }
+ }
+ }
+
+ if (!_sub)
+ error("Geisha: No starting position in floor %d (testmode: %d)", _floor, _testMode);
+
+ // Walls
+ for (Common::List<MapObject>::iterator w = _walls.begin(); w != _walls.end(); ++w)
+ _blockingObjects.push_back(&*w);
+
+ // Mouths
+ for (Common::List<ManagedMouth>::iterator m = _mouths.begin(); m != _mouths.end(); ++m)
+ _mapAnims.push_back(m->mouth);
+
+ // Sub
+ _blockingObjects.push_back(_sub);
+ _anims.push_back(_sub->sub);
+
+ // Moving enemies
+ for (int i = 0; i < kEnemyCount; i++) {
+ _enemies[i].enemy = new ANIObject(*_objects);
+
+ _enemies[i].enemy->setPause(true);
+ _enemies[i].enemy->setVisible(false);
+
+ _enemies[i].isBlocking = false;
+
+ _blockingObjects.push_back(&_enemies[i]);
+ _mapAnims.push_back(_enemies[i].enemy);
+ }
+
+ // Bullets
+ for (int i = 0; i < kMaxBulletCount; i++) {
+ _bullets[i].bullet = new ANIObject(*_sprites);
+
+ _bullets[i].bullet->setPause(true);
+ _bullets[i].bullet->setVisible(false);
+
+ _bullets[i].isBlocking = false;
+
+ _mapAnims.push_back(_bullets[i].bullet);
+ }
+}
+
+void Penetration::drawFloorText() {
+ _vm->_draw->_backSurface->fillRect(kTextAreaLeft, kTextAreaTop, kTextAreaRight, kTextAreaBottom, kColorBlack);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, kTextAreaLeft, kTextAreaTop, kTextAreaRight, kTextAreaBottom);
+
+ const Font *font = _vm->_draw->_fonts[2];
+ if (!font)
+ return;
+
+ const char **strings = kStrings[getLanguage()];
+
+ const char *floorString = 0;
+ if (_floor == 0)
+ floorString = strings[kString3rdBasement];
+ else if (_floor == 1)
+ floorString = strings[kString2ndBasement];
+ else if (_floor == 2)
+ floorString = strings[kString1stBasement];
+
+ Surface &surface = *_vm->_draw->_backSurface;
+
+ if (floorString)
+ font->drawString(floorString, 10, 15, kColorFloorText, kColorBlack, 1, surface);
+
+ if (_exits.size() > 0) {
+ int exitCount = kString2Exits;
+ if (_exits.size() == 1)
+ exitCount = kString1Exit;
+
+ font->drawString(strings[kStringYouHave] , 10, 38, kColorExitText, kColorBlack, 1, surface);
+ font->drawString(strings[exitCount] , 10, 53, kColorExitText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringToReach] , 10, 68, kColorExitText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringUpperLevel1], 10, 84, kColorExitText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringUpperLevel2], 10, 98, kColorExitText, kColorBlack, 1, surface);
+
+ } else
+ font->drawString(strings[kStringNoExit], 10, 53, kColorExitText, kColorBlack, 1, surface);
+}
+
+void Penetration::drawEndText() {
+ // Only draw the end text when we've won and this isn't a test run
+ if (!hasWon() || _testMode)
+ return;
+
+ _vm->_draw->_backSurface->fillRect(kTextAreaLeft, kTextAreaTop, kTextAreaRight, kTextAreaBigBottom, kColorBlack);
+
+ const Font *font = _vm->_draw->_fonts[2];
+ if (!font)
+ return;
+
+ Surface &surface = *_vm->_draw->_backSurface;
+
+ const char **strings = kStrings[getLanguage()];
+
+ font->drawString(strings[kStringLevel0] , 11, 21, kColorExitText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringPenetration], 11, 42, kColorExitText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringSuccessful] , 11, 58, kColorExitText, kColorBlack, 1, surface);
+
+ font->drawString(strings[kStringDanger] , 11, 82, kColorFloorText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringGynoides] , 11, 98, kColorFloorText, kColorBlack, 1, surface);
+ font->drawString(strings[kStringActivated], 11, 113, kColorFloorText, kColorBlack, 1, surface);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, kTextAreaLeft, kTextAreaTop, kTextAreaRight, kTextAreaBigBottom);
+ _vm->_draw->blitInvalidated();
+ _vm->_video->retrace();
+}
+
+void Penetration::fadeIn() {
+ if (!_needFadeIn)
+ return;
+
+ // Fade to palette
+ _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+ _needFadeIn = false;
+}
+
+void Penetration::setPalette() {
+ // Fade to black
+ _vm->_palAnim->fade(0, 0, 0);
+
+ // Set palette
+ memcpy(_vm->_draw->_vgaPalette , kPalettes[_floor], 3 * kPaletteSize);
+ memcpy(_vm->_draw->_vgaSmallPalette, kPalettes[_floor], 3 * kPaletteSize);
+
+ _needFadeIn = true;
}
void Penetration::initScreen() {
_vm->_util->setFrameRate(15);
- memcpy(_vm->_draw->_vgaPalette , kPalette, 48);
- memcpy(_vm->_draw->_vgaSmallPalette, kPalette, 48);
+ setPalette();
+
+ // Draw the shield meter
+ _sprites->draw(*_background, 0, 0, 95, 6, 9, 117, 0); // Meter frame
+ _sprites->draw(*_background, 271, 176, 282, 183, 9, 108, 0); // Shield
- _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+ // Draw the health meter
+ _sprites->draw(*_background, 0, 0, 95, 6, 9, 135, 0); // Meter frame
+ _sprites->draw(*_background, 283, 176, 292, 184, 9, 126, 0); // Heart
_vm->_draw->_backSurface->blit(*_background);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
}
+void Penetration::enemiesCreate() {
+ for (int i = 0; i < kEnemyCount; i++) {
+ ManagedEnemy &enemy = _enemies[i];
+
+ if (enemy.enemy->isVisible())
+ continue;
+
+ enemy.enemy->setAnimation((i & 1) ? kAnimationEnemySquare : kAnimationEnemyRound);
+ enemy.enemy->setMode(ANIObject::kModeContinuous);
+ enemy.enemy->setPause(false);
+ enemy.enemy->setVisible(true);
+
+ int16 width, height;
+ enemy.enemy->getFrameSize(width, height);
+
+ enemy.width = width;
+ enemy.height = height;
+
+ do {
+ enemy.mapX = _vm->_util->getRandom(kMapWidth) * kMapTileWidth + 2;
+ enemy.mapY = _vm->_util->getRandom(kMapHeight) * kMapTileHeight + 4;
+ enemy.setTileFromMapPosition();
+ } while (isBlocked(enemy, enemy.mapX, enemy.mapY));
+
+ const int posX = kPlayAreaBorderWidth + enemy.mapX;
+ const int posY = kPlayAreaBorderHeight + enemy.mapY;
+
+ enemy.enemy->setPosition(posX, posY);
+
+ enemy.isBlocking = true;
+ enemy.dead = false;
+ }
+}
+
+void Penetration::enemyMove(ManagedEnemy &enemy, int x, int y) {
+ if ((x == 0) && (y == 0))
+ return;
+
+ MapObject *blockedBy;
+ findPath(enemy, x, y, &blockedBy);
+
+ enemy.setTileFromMapPosition();
+
+ const int posX = kPlayAreaBorderWidth + enemy.mapX;
+ const int posY = kPlayAreaBorderHeight + enemy.mapY;
+
+ enemy.enemy->setPosition(posX, posY);
+
+ if (blockedBy == _sub)
+ enemyAttack(enemy);
+}
+
+void Penetration::enemiesMove() {
+ for (int i = 0; i < kEnemyCount; i++) {
+ ManagedEnemy &enemy = _enemies[i];
+
+ if (!enemy.enemy->isVisible() || enemy.dead)
+ continue;
+
+ int x = 0, y = 0;
+
+ if (enemy.mapX > _sub->mapX)
+ x = -8;
+ else if (enemy.mapX < _sub->mapX)
+ x = 8;
+
+ if (enemy.mapY > _sub->mapY)
+ y = -8;
+ else if (enemy.mapY < _sub->mapY)
+ y = 8;
+
+ enemyMove(enemy, x, y);
+ }
+}
+
+void Penetration::enemyAttack(ManagedEnemy &enemy) {
+ // If we have shields, the enemy explodes at them, taking a huge chunk of energy with it.
+ // Otherwise, the enemy nibbles a small amount of health away.
+
+ if (_shieldMeter->getValue() > 0) {
+ enemyExplode(enemy);
+
+ healthLose(80);
+ } else
+ healthLose(5);
+}
+
+void Penetration::enemyExplode(ManagedEnemy &enemy) {
+ enemy.dead = true;
+ enemy.isBlocking = false;
+
+ bool isSquare = enemy.enemy->getAnimation() == kAnimationEnemySquare;
+
+ enemy.enemy->setAnimation(isSquare ? kAnimationEnemySquareExplode : kAnimationEnemyRoundExplode);
+ enemy.enemy->setMode(ANIObject::kModeOnce);
+
+ _vm->_sound->blasterPlay(&_soundExplode, 1, 0);
+}
+
+void Penetration::checkInput() {
+ Common::Event event;
+ Common::EventManager *eventMan = g_system->getEventManager();
+
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ _quit = true;
+ else if (event.kbd.keycode == Common::KEYCODE_UP)
+ _keys[kKeyUp ] = true;
+ else if (event.kbd.keycode == Common::KEYCODE_DOWN)
+ _keys[kKeyDown ] = true;
+ else if (event.kbd.keycode == Common::KEYCODE_LEFT)
+ _keys[kKeyLeft ] = true;
+ else if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+ _keys[kKeyRight] = true;
+ else if (event.kbd.keycode == Common::KEYCODE_SPACE)
+ _keys[kKeySpace] = true;
+ else if (event.kbd.keycode == Common::KEYCODE_d) {
+ _vm->getDebugger()->attach();
+ _vm->getDebugger()->onFrame();
+ }
+ break;
+
+ case Common::EVENT_KEYUP:
+ if (event.kbd.keycode == Common::KEYCODE_UP)
+ _keys[kKeyUp ] = false;
+ else if (event.kbd.keycode == Common::KEYCODE_DOWN)
+ _keys[kKeyDown ] = false;
+ else if (event.kbd.keycode == Common::KEYCODE_LEFT)
+ _keys[kKeyLeft ] = false;
+ else if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+ _keys[kKeyRight] = false;
+ else if (event.kbd.keycode == Common::KEYCODE_SPACE)
+ _keys[kKeySpace] = false;
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Penetration::handleSub() {
+ int x, y;
+ Submarine::Direction direction = getDirection(x, y);
+
+ subMove(x, y, direction);
+
+ if (_keys[kKeySpace])
+ subShoot();
+}
+
+bool Penetration::isBlocked(const MapObject &self, int16 x, int16 y, MapObject **blockedBy) {
+
+ if ((x < 0) || (y < 0))
+ return true;
+ if (((x + self.width - 1) >= (kMapWidth * kMapTileWidth)) ||
+ ((y + self.height - 1) >= (kMapHeight * kMapTileHeight)))
+ return true;
+
+ MapObject checkSelf(0, 0, self.width, self.height);
+
+ checkSelf.mapX = x;
+ checkSelf.mapY = y;
+
+ for (Common::List<MapObject *>::iterator o = _blockingObjects.begin(); o != _blockingObjects.end(); ++o) {
+ MapObject &obj = **o;
+
+ if (&obj == &self)
+ continue;
+
+ if (!obj.isBlocking)
+ continue;
+
+ if (obj.isIn(checkSelf) || checkSelf.isIn(obj)) {
+ if (blockedBy && !*blockedBy)
+ *blockedBy = &obj;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void Penetration::findPath(MapObject &obj, int x, int y, MapObject **blockedBy) {
+ if (blockedBy)
+ *blockedBy = 0;
+
+ while ((x != 0) || (y != 0)) {
+ uint16 oldX = obj.mapX;
+ uint16 oldY = obj.mapY;
+
+ uint16 newX = obj.mapX;
+ if (x > 0) {
+ newX++;
+ x--;
+ } else if (x < 0) {
+ newX--;
+ x++;
+ }
+
+ if (!isBlocked(obj, newX, obj.mapY, blockedBy))
+ obj.mapX = newX;
+
+ uint16 newY = obj.mapY;
+ if (y > 0) {
+ newY++;
+ y--;
+ } else if (y < 0) {
+ newY--;
+ y++;
+ }
+
+ if (!isBlocked(obj, obj.mapX, newY, blockedBy))
+ obj.mapY = newY;
+
+ if ((obj.mapX == oldX) && (obj.mapY == oldY))
+ break;
+ }
+}
+
+void Penetration::subMove(int x, int y, Submarine::Direction direction) {
+ if (!_sub->sub->canMove())
+ return;
+
+ if ((x == 0) && (y == 0))
+ return;
+
+ findPath(*_sub, x, y);
+
+ _sub->setTileFromMapPosition();
+
+ _sub->sub->turn(direction);
+
+ checkShields();
+ checkMouths();
+ checkExits();
+}
+
+void Penetration::subShoot() {
+ if (!_sub->sub->canMove() || _sub->sub->isShooting())
+ return;
+
+ if (_shotCoolDown > 0)
+ return;
+
+ // Creating a bullet
+ int slot = findEmptyBulletSlot();
+ if (slot < 0)
+ return;
+
+ ManagedBullet &bullet = _bullets[slot];
+
+ bullet.bullet->setAnimation(directionToBullet(_sub->sub->getDirection()));
+
+ setBulletPosition(*_sub, bullet);
+
+ const int posX = kPlayAreaBorderWidth + bullet.mapX;
+ const int posY = kPlayAreaBorderHeight + bullet.mapY;
+
+ bullet.bullet->setPosition(posX, posY);
+ bullet.bullet->setVisible(true);
+
+ // Shooting
+ _sub->sub->shoot();
+ _vm->_sound->blasterPlay(&_soundShoot, 1, 0);
+
+ _shotCoolDown = 3;
+}
+
+void Penetration::setBulletPosition(const ManagedSub &sub, ManagedBullet &bullet) const {
+ bullet.mapX = sub.mapX;
+ bullet.mapY= sub.mapY;
+
+ int16 sWidth, sHeight;
+ sub.sub->getFrameSize(sWidth, sHeight);
+
+ int16 bWidth, bHeight;
+ bullet.bullet->getFrameSize(bWidth, bHeight);
+
+ switch (sub.sub->getDirection()) {
+ case Submarine::kDirectionN:
+ bullet.mapX += sWidth / 2;
+ bullet.mapY -= bHeight;
+
+ bullet.deltaX = 0;
+ bullet.deltaY = -8;
+ break;
+
+ case Submarine::kDirectionNE:
+ bullet.mapX += sWidth;
+ bullet.mapY -= bHeight * 2;
+
+ bullet.deltaX = 8;
+ bullet.deltaY = -8;
+ break;
+
+ case Submarine::kDirectionE:
+ bullet.mapX += sWidth;
+ bullet.mapY += sHeight / 2 - bHeight;
+
+ bullet.deltaX = 8;
+ bullet.deltaY = 0;
+ break;
+
+ case Submarine::kDirectionSE:
+ bullet.mapX += sWidth;
+ bullet.mapY += sHeight;
+
+ bullet.deltaX = 8;
+ bullet.deltaY = 8;
+ break;
+
+ case Submarine::kDirectionS:
+ bullet.mapX += sWidth / 2;
+ bullet.mapY += sHeight;
+
+ bullet.deltaX = 0;
+ bullet.deltaY = 8;
+ break;
+
+ case Submarine::kDirectionSW:
+ bullet.mapX -= bWidth;
+ bullet.mapY += sHeight;
+
+ bullet.deltaX = -8;
+ bullet.deltaY = 8;
+ break;
+
+ case Submarine::kDirectionW:
+ bullet.mapX -= bWidth;
+ bullet.mapY += sHeight / 2 - bHeight;
+
+ bullet.deltaX = -8;
+ bullet.deltaY = 0;
+ break;
+
+ case Submarine::kDirectionNW:
+ bullet.mapX -= bWidth;
+ bullet.mapY -= bHeight;
+
+ bullet.deltaX = -8;
+ bullet.deltaY = -8;
+ break;
+
+ default:
+ break;
+ }
+}
+
+uint16 Penetration::directionToBullet(Submarine::Direction direction) const {
+ switch (direction) {
+ case Submarine::kDirectionN:
+ return kSpriteBulletN;
+
+ case Submarine::kDirectionNE:
+ return kSpriteBulletNE;
+
+ case Submarine::kDirectionE:
+ return kSpriteBulletE;
+
+ case Submarine::kDirectionSE:
+ return kSpriteBulletSE;
+
+ case Submarine::kDirectionS:
+ return kSpriteBulletS;
+
+ case Submarine::kDirectionSW:
+ return kSpriteBulletSW;
+
+ case Submarine::kDirectionW:
+ return kSpriteBulletW;
+
+ case Submarine::kDirectionNW:
+ return kSpriteBulletNW;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int Penetration::findEmptyBulletSlot() const {
+ for (int i = 0; i < kMaxBulletCount; i++)
+ if (!_bullets[i].bullet->isVisible())
+ return i;
+
+ return -1;
+}
+
+void Penetration::bulletsMove() {
+ for (int i = 0; i < kMaxBulletCount; i++)
+ if (_bullets[i].bullet->isVisible())
+ bulletMove(_bullets[i]);
+}
+
+void Penetration::bulletMove(ManagedBullet &bullet) {
+ MapObject *blockedBy;
+ findPath(bullet, bullet.deltaX, bullet.deltaY, &blockedBy);
+
+ if (blockedBy) {
+ checkShotEnemy(*blockedBy);
+ bullet.bullet->setVisible(false);
+ return;
+ }
+
+ const int posX = kPlayAreaBorderWidth + bullet.mapX;
+ const int posY = kPlayAreaBorderHeight + bullet.mapY;
+
+ bullet.bullet->setPosition(posX, posY);
+}
+
+void Penetration::checkShotEnemy(MapObject &shotObject) {
+ for (int i = 0; i < kEnemyCount; i++) {
+ ManagedEnemy &enemy = _enemies[i];
+
+ if ((&enemy == &shotObject) && !enemy.dead && enemy.enemy->isVisible()) {
+ enemyExplode(enemy);
+ return;
+ }
+ }
+}
+
+Submarine::Direction Penetration::getDirection(int &x, int &y) const {
+ x = _keys[kKeyRight] ? 3 : (_keys[kKeyLeft] ? -3 : 0);
+ y = _keys[kKeyDown ] ? 3 : (_keys[kKeyUp ] ? -3 : 0);
+
+ if ((x > 0) && (y > 0))
+ return Submarine::kDirectionSE;
+ if ((x > 0) && (y < 0))
+ return Submarine::kDirectionNE;
+ if ((x < 0) && (y > 0))
+ return Submarine::kDirectionSW;
+ if ((x < 0) && (y < 0))
+ return Submarine::kDirectionNW;
+ if (x > 0)
+ return Submarine::kDirectionE;
+ if (x < 0)
+ return Submarine::kDirectionW;
+ if (y > 0)
+ return Submarine::kDirectionS;
+ if (y < 0)
+ return Submarine::kDirectionN;
+
+ return Submarine::kDirectionNone;
+}
+
+void Penetration::checkShields() {
+ for (Common::List<MapObject>::iterator s = _shields.begin(); s != _shields.end(); ++s) {
+ if ((s->tileX == _sub->tileX) && (s->tileY == _sub->tileY)) {
+ // Charge shields
+ _shieldMeter->setMaxValue();
+
+ // Play the shield sound
+ _vm->_sound->blasterPlay(&_soundShield, 1, 0);
+
+ // Erase the shield from the map
+ _sprites->draw(*_map, 30, s->mapX + kPlayAreaBorderWidth, s->mapY + kPlayAreaBorderHeight);
+ _shields.erase(s);
+ break;
+ }
+ }
+}
+
+void Penetration::checkMouths() {
+ for (Common::List<ManagedMouth>::iterator m = _mouths.begin(); m != _mouths.end(); ++m) {
+ if (!m->mouth->isDeactivated())
+ continue;
+
+ if ((( m->tileX == _sub->tileX) && (m->tileY == _sub->tileY)) ||
+ (((m->tileX + 1) == _sub->tileX) && (m->tileY == _sub->tileY))) {
+
+ m->mouth->activate();
+
+ // Play the mouth sound and do health gain/loss
+ if (m->type == kMouthTypeBite) {
+ _vm->_sound->blasterPlay(&_soundBite, 1, 0);
+ healthLose(230);
+ } else if (m->type == kMouthTypeKiss) {
+ _vm->_sound->blasterPlay(&_soundKiss, 1, 0);
+ healthGain(120);
+ }
+ }
+ }
+}
+
+void Penetration::checkExits() {
+ if (!_sub->sub->canMove())
+ return;
+
+ for (Common::List<MapObject>::iterator e = _exits.begin(); e != _exits.end(); ++e) {
+ if ((e->tileX == _sub->tileX) && (e->tileY == _sub->tileY)) {
+ _sub->setMapFromTilePosition();
+
+ _sub->sub->leave();
+
+ _vm->_sound->blasterPlay(&_soundExit, 1, 0);
+ break;
+ }
+ }
+}
+
+void Penetration::healthGain(int amount) {
+ if (_shieldMeter->getValue() > 0)
+ _healthMeter->increase(_shieldMeter->increase(amount));
+ else
+ _healthMeter->increase(amount);
+}
+
+void Penetration::healthLose(int amount) {
+ _healthMeter->decrease(_shieldMeter->decrease(amount));
+
+ if (_healthMeter->getValue() == 0)
+ _sub->sub->die();
+}
+
+void Penetration::checkExited() {
+ if (_sub->sub->hasExited()) {
+ _floor++;
+
+ if (_floor >= kFloorCount)
+ return;
+
+ setPalette();
+ createMap();
+ drawFloorText();
+ }
+}
+
+bool Penetration::isDead() const {
+ return _sub && _sub->sub->isDead();
+}
+
+bool Penetration::hasWon() const {
+ return _floor >= kFloorCount;
+}
+
+int Penetration::getLanguage() const {
+ if (_vm->_global->_language < kLanguageCount)
+ return _vm->_global->_language;
+
+ return kFallbackLanguage;
+}
+
+void Penetration::updateAnims() {
+ int16 left = 0, top = 0, right = 0, bottom = 0;
+
+ // Clear the previous map animation frames
+ for (Common::List<ANIObject *>::iterator a = _mapAnims.reverse_begin();
+ a != _mapAnims.end(); --a) {
+
+ (*a)->clear(*_map, left, top, right, bottom);
+ }
+
+ // Draw the current map animation frames
+ for (Common::List<ANIObject *>::iterator a = _mapAnims.begin();
+ a != _mapAnims.end(); ++a) {
+
+ (*a)->draw(*_map, left, top, right, bottom);
+ (*a)->advance();
+ }
+
+ // Clear the previous animation frames
+ for (Common::List<ANIObject *>::iterator a = _anims.reverse_begin();
+ a != _anims.end(); --a) {
+
+ if ((*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ }
+
+ if (_sub) {
+ // Draw the map
+
+ _vm->_draw->_backSurface->blit(*_map, _sub->mapX, _sub->mapY,
+ _sub->mapX + kPlayAreaWidth - 1, _sub->mapY + kPlayAreaHeight - 1, kPlayAreaX, kPlayAreaY);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, kPlayAreaX, kPlayAreaY,
+ kPlayAreaX + kPlayAreaWidth - 1, kPlayAreaY + kPlayAreaHeight - 1);
+ }
+
+ // Draw the current animation frames
+ for (Common::List<ANIObject *>::iterator a = _anims.begin();
+ a != _anims.end(); ++a) {
+
+ if ((*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ (*a)->advance();
+ }
+
+ // Draw the meters
+ _shieldMeter->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);
+}
+
} // End of namespace Geisha
} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index c346a7bf5a..50004eba8e 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -24,34 +24,229 @@
#define GOB_MINIGAMES_GEISHA_PENETRATION_H
#include "common/system.h"
+#include "common/list.h"
+
+#include "gob/sound/sounddesc.h"
+
+#include "gob/minigames/geisha/submarine.h"
namespace Gob {
class GobEngine;
class Surface;
+class CMPFile;
class ANIFile;
namespace Geisha {
+class Meter;
+class Mouth;
+
/** Geisha's "Penetration" minigame. */
class Penetration {
public:
Penetration(GobEngine *vm);
~Penetration();
- bool play(uint16 var1, uint16 var2, uint16 var3);
+ bool play(bool hasAccessPass, bool hasMaxEnergy, bool testMode);
+
+ bool isPlaying() const;
+ void cheatWin();
private:
+ static const int kModeCount = 2;
+ static const int kFloorCount = 3;
+
+ static const int kMapWidth = 17;
+ static const int kMapHeight = 13;
+
+ static const int kPaletteSize = 16;
+
+ static const byte kPalettes[kFloorCount][3 * kPaletteSize];
+ static const byte kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight];
+
+ static const int kEnemyCount = 9;
+ static const int kMaxBulletCount = 10;
+
+ struct MapObject {
+ uint16 tileX;
+ uint16 tileY;
+
+ uint16 mapX;
+ uint16 mapY;
+
+ uint16 width;
+ uint16 height;
+
+ bool isBlocking;
+
+ MapObject(uint16 tX, uint16 tY, uint16 mX, uint16 mY, uint16 w, uint16 h);
+ MapObject(uint16 tX, uint16 tY, uint16 w, uint16 h);
+
+ void setTileFromMapPosition();
+ void setMapFromTilePosition();
+
+ bool isIn(uint16 mX, uint16 mY) const;
+ bool isIn(uint16 mX, uint16 mY, uint16 w, uint16 h) const;
+ bool isIn(const MapObject &obj) const;
+ };
+
+ enum MouthType {
+ kMouthTypeBite,
+ kMouthTypeKiss
+ };
+
+ struct ManagedMouth : public MapObject {
+ Mouth *mouth;
+
+ MouthType type;
+
+ ManagedMouth(uint16 tX, uint16 tY, MouthType t);
+ ~ManagedMouth();
+ };
+
+ struct ManagedSub : public MapObject {
+ Submarine *sub;
+
+ ManagedSub(uint16 tX, uint16 tY);
+ ~ManagedSub();
+ };
+
+ struct ManagedEnemy : public MapObject {
+ ANIObject *enemy;
+
+ bool dead;
+
+ ManagedEnemy();
+ ~ManagedEnemy();
+
+ void clear();
+ };
+
+ struct ManagedBullet : public MapObject {
+ ANIObject *bullet;
+
+ int16 deltaX;
+ int16 deltaY;
+
+ ManagedBullet();
+ ~ManagedBullet();
+
+ void clear();
+ };
+
+ enum Keys {
+ kKeyUp = 0,
+ kKeyDown,
+ kKeyLeft,
+ kKeyRight,
+ kKeySpace,
+ kKeyCount
+ };
+
GobEngine *_vm;
+ bool _hasAccessPass;
+ bool _hasMaxEnergy;
+ bool _testMode;
+
+ bool _needFadeIn;
+
+ bool _quit;
+ bool _keys[kKeyCount];
+
Surface *_background;
+ CMPFile *_sprites;
ANIFile *_objects;
+ Common::List<ANIObject *> _anims;
+ Common::List<ANIObject *> _mapAnims;
+
+ Meter *_shieldMeter;
+ Meter *_healthMeter;
+
+ uint8 _floor;
+
+ Surface *_map;
+
+ ManagedSub *_sub;
+
+ Common::List<MapObject> _walls;
+ Common::List<MapObject> _exits;
+ Common::List<MapObject> _shields;
+ Common::List<ManagedMouth> _mouths;
+
+ ManagedEnemy _enemies[kEnemyCount];
+ ManagedBullet _bullets[kMaxBulletCount];
+
+ Common::List<MapObject *> _blockingObjects;
+
+ uint8 _shotCoolDown;
+
+ SoundDesc _soundShield;
+ SoundDesc _soundBite;
+ SoundDesc _soundKiss;
+ SoundDesc _soundShoot;
+ SoundDesc _soundExit;
+ SoundDesc _soundExplode;
+
+ bool _isPlaying;
+
void init();
void deinit();
+ void clearMap();
+ void createMap();
+
void initScreen();
+
+ void setPalette();
+ void fadeIn();
+
+ void drawFloorText();
+ void drawEndText();
+
+ bool isBlocked(const MapObject &self, int16 x, int16 y, MapObject **blockedBy = 0);
+ void findPath(MapObject &obj, int x, int y, MapObject **blockedBy = 0);
+
+ void updateAnims();
+
+ void checkInput();
+
+ Submarine::Direction getDirection(int &x, int &y) const;
+
+ void handleSub();
+ void subMove(int x, int y, Submarine::Direction direction);
+ void subShoot();
+
+ int findEmptyBulletSlot() const;
+ uint16 directionToBullet(Submarine::Direction direction) const;
+ void setBulletPosition(const ManagedSub &sub, ManagedBullet &bullet) const;
+
+ void bulletsMove();
+ void bulletMove(ManagedBullet &bullet);
+ void checkShotEnemy(MapObject &shotObject);
+
+ void checkExits();
+ void checkShields();
+ void checkMouths();
+
+ void healthGain(int amount);
+ void healthLose(int amount);
+
+ void checkExited();
+
+ void enemiesCreate();
+ void enemiesMove();
+ void enemyMove(ManagedEnemy &enemy, int x, int y);
+ void enemyAttack(ManagedEnemy &enemy);
+ void enemyExplode(ManagedEnemy &enemy);
+
+ bool isDead() const;
+ bool hasWon() const;
+
+ int getLanguage() const;
};
} // End of namespace Geisha
diff --git a/engines/gob/minigames/geisha/submarine.cpp b/engines/gob/minigames/geisha/submarine.cpp
new file mode 100644
index 0000000000..bf15306e5a
--- /dev/null
+++ b/engines/gob/minigames/geisha/submarine.cpp
@@ -0,0 +1,256 @@
+/* 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/minigames/geisha/submarine.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+enum Animation {
+ kAnimationDriveS = 4,
+ kAnimationDriveE = 5,
+ kAnimationDriveN = 6,
+ kAnimationDriveW = 7,
+ kAnimationDriveSE = 8,
+ kAnimationDriveNE = 9,
+ kAnimationDriveSW = 10,
+ kAnimationDriveNW = 11,
+ kAnimationShootS = 12,
+ kAnimationShootN = 13,
+ kAnimationShootW = 14,
+ kAnimationShootE = 15,
+ kAnimationShootNE = 16,
+ kAnimationShootSE = 17,
+ kAnimationShootSW = 18,
+ kAnimationShootNW = 19,
+ kAnimationExplodeN = 28,
+ kAnimationExplodeS = 29,
+ kAnimationExplodeW = 30,
+ kAnimationExplodeE = 31,
+ kAnimationExit = 32
+};
+
+
+Submarine::Submarine(const ANIFile &ani) : ANIObject(ani), _state(kStateMove), _direction(kDirectionNone) {
+ turn(kDirectionN);
+}
+
+Submarine::~Submarine() {
+}
+
+Submarine::Direction Submarine::getDirection() const {
+ return _direction;
+}
+
+void Submarine::turn(Direction to) {
+ // Nothing to do
+ if ((to == kDirectionNone) || ((_state == kStateMove) && (_direction == to)))
+ return;
+
+ _direction = to;
+
+ move();
+}
+
+void Submarine::move() {
+ uint16 frame = getFrame();
+ uint16 anim = (_state == kStateShoot) ? directionToShoot(_direction) : directionToMove(_direction);
+
+ setAnimation(anim);
+ setFrame(frame);
+ setPause(false);
+ setVisible(true);
+
+ setMode((_state == kStateShoot) ? kModeOnce : kModeContinuous);
+}
+
+void Submarine::shoot() {
+ _state = kStateShoot;
+
+ setAnimation(directionToShoot(_direction));
+ setMode(kModeOnce);
+ setPause(false);
+ setVisible(true);
+}
+
+void Submarine::die() {
+ if (!canMove())
+ return;
+
+ _state = kStateDie;
+
+ setAnimation(directionToExplode(_direction));
+ setMode(kModeOnce);
+ setPause(false);
+ setVisible(true);
+}
+
+void Submarine::leave() {
+ _state = kStateExit;
+
+ setAnimation(kAnimationExit);
+ setMode(kModeOnce);
+ setPause(false);
+ setVisible(true);
+}
+
+void Submarine::advance() {
+ ANIObject::advance();
+
+ switch (_state) {
+ case kStateShoot:
+ if (isPaused()) {
+ _state = kStateMove;
+
+ move();
+ }
+ break;
+
+ case kStateExit:
+ if (isPaused())
+ _state = kStateExited;
+
+ break;
+
+ case kStateDie:
+ if (isPaused())
+ _state = kStateDead;
+ break;
+
+ default:
+ break;
+ }
+}
+
+bool Submarine::canMove() const {
+ return (_state == kStateMove) || (_state == kStateShoot);
+}
+
+bool Submarine::isDead() const {
+ return _state == kStateDead;
+}
+
+bool Submarine::isShooting() const {
+ return _state == kStateShoot;
+}
+
+bool Submarine::hasExited() const {
+ return _state == kStateExited;
+}
+
+uint16 Submarine::directionToMove(Direction direction) const {
+ switch (direction) {
+ case kDirectionN:
+ return kAnimationDriveN;
+
+ case kDirectionNE:
+ return kAnimationDriveNE;
+
+ case kDirectionE:
+ return kAnimationDriveE;
+
+ case kDirectionSE:
+ return kAnimationDriveSE;
+
+ case kDirectionS:
+ return kAnimationDriveS;
+
+ case kDirectionSW:
+ return kAnimationDriveSW;
+
+ case kDirectionW:
+ return kAnimationDriveW;
+
+ case kDirectionNW:
+ return kAnimationDriveNW;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+uint16 Submarine::directionToShoot(Direction direction) const {
+ switch (direction) {
+ case kDirectionN:
+ return kAnimationShootN;
+
+ case kDirectionNE:
+ return kAnimationShootNE;
+
+ case kDirectionE:
+ return kAnimationShootE;
+
+ case kDirectionSE:
+ return kAnimationShootSE;
+
+ case kDirectionS:
+ return kAnimationShootS;
+
+ case kDirectionSW:
+ return kAnimationShootSW;
+
+ case kDirectionW:
+ return kAnimationShootW;
+
+ case kDirectionNW:
+ return kAnimationShootNW;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+uint16 Submarine::directionToExplode(Direction direction) const {
+ // Only 4 exploding animations (spinning clockwise)
+
+ switch (direction) {
+ case kDirectionNW:
+ case kDirectionN:
+ return kAnimationExplodeN;
+
+ case kDirectionNE:
+ case kDirectionE:
+ return kAnimationExplodeE;
+
+ case kDirectionSE:
+ case kDirectionS:
+ return kAnimationExplodeS;
+
+ case kDirectionSW:
+ case kDirectionW:
+ return kAnimationExplodeW;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/submarine.h b/engines/gob/minigames/geisha/submarine.h
new file mode 100644
index 0000000000..a6eae57095
--- /dev/null
+++ b/engines/gob/minigames/geisha/submarine.h
@@ -0,0 +1,107 @@
+/* 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_SUBMARINE_H
+#define GOB_MINIGAMES_GEISHA_SUBMARINE_H
+
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+/** The submarine Geisha's "Penetration" minigame. */
+class Submarine : public ANIObject {
+public:
+ enum Direction {
+ kDirectionNone,
+ kDirectionN,
+ kDirectionNE,
+ kDirectionE,
+ kDirectionSE,
+ kDirectionS,
+ kDirectionSW,
+ kDirectionW,
+ kDirectionNW
+ };
+
+ Submarine(const ANIFile &ani);
+ ~Submarine();
+
+ Direction getDirection() const;
+
+ /** Turn to the specified direction. */
+ void turn(Direction to);
+
+ /** Play the shoot animation. */
+ void shoot();
+
+ /** Play the exploding animation. */
+ void die();
+
+ /** Play the exiting animation. */
+ void leave();
+
+ /** Advance the animation to the next frame. */
+ void advance();
+
+ /** Can the submarine move at the moment? */
+ bool canMove() const;
+
+ /** Is the submarine dead? */
+ bool isDead() const;
+
+ /** Is the submarine shooting? */
+ bool isShooting() const;
+
+ /** Has the submarine finished exiting the level? */
+ bool hasExited() const;
+
+private:
+ enum State {
+ kStateNone = 0,
+ kStateMove,
+ kStateShoot,
+ kStateExit,
+ kStateExited,
+ kStateDie,
+ kStateDead
+ };
+
+ State _state;
+ Direction _direction;
+
+ /** Map the directions to move animation indices. */
+ uint16 directionToMove(Direction direction) const;
+ /** Map the directions to shoot animation indices. */
+ uint16 directionToShoot(Direction direction) const;
+ /** Map the directions to explode animation indices. */
+ uint16 directionToExplode(Direction direction) const;
+
+ void move();
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_SUBMARINE_H
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index 1c83b4ae40..d5ee6478be 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -3,14 +3,15 @@ MODULE := engines/gob
MODULE_OBJS := \
anifile.o \
aniobject.o \
+ backbuffer.o \
cheater.o \
cheater_geisha.o \
+ cmpfile.o \
console.o \
dataio.o \
databases.o \
dbase.o \
decfile.o \
- detection.o \
draw.o \
draw_v1.o \
draw_v2.o \
@@ -43,6 +44,7 @@ MODULE_OBJS := \
inter_v2.o \
inter_bargon.o \
inter_fascin.o \
+ inter_littlered.o \
inter_inca2.o \
inter_playtoons.o \
inter_v3.o \
@@ -75,10 +77,24 @@ MODULE_OBJS := \
demos/demoplayer.o \
demos/scnplayer.o \
demos/batplayer.o \
+ detection/detection.o \
+ pregob/pregob.o \
+ pregob/txtfile.o \
+ pregob/gctfile.o \
+ pregob/seqfile.o \
+ pregob/onceupon/onceupon.o \
+ pregob/onceupon/abracadabra.o \
+ pregob/onceupon/babayaga.o \
+ pregob/onceupon/title.o \
+ pregob/onceupon/parents.o \
+ pregob/onceupon/stork.o \
+ pregob/onceupon/chargenchild.o \
minigames/geisha/evilfish.o \
minigames/geisha/oko.o \
minigames/geisha/meter.o \
minigames/geisha/diving.o \
+ minigames/geisha/mouth.o \
+ minigames/geisha/submarine.o \
minigames/geisha/penetration.o \
save/savefile.o \
save/savehandler.o \
@@ -90,6 +106,7 @@ MODULE_OBJS := \
save/saveload_v7.o \
save/saveload_geisha.o \
save/saveload_fascin.o \
+ save/saveload_ajworld.o \
save/saveload_inca2.o \
save/saveload_playtoons.o \
save/saveconverter.o \
@@ -100,6 +117,8 @@ MODULE_OBJS := \
sound/sounddesc.o \
sound/pcspeaker.o \
sound/adlib.o \
+ sound/musplayer.o \
+ sound/adlplayer.o \
sound/infogrames.o \
sound/protracker.o \
sound/soundmixer.o \
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index 06a7130cef..b3d7ea6263 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -366,10 +366,11 @@ void Mult::doPalAnim() {
palPtr->blue, 0, 0x13);
palPtr = _vm->_global->_pPaletteDesc->vgaPal;
- for (_counter = 0; _counter < 16; _counter++, palPtr++)
+ for (_counter = 0; _counter < 16; _counter++, palPtr++) {
_vm->_global->_redPalette[_counter] = palPtr->red;
_vm->_global->_greenPalette[_counter] = palPtr->green;
_vm->_global->_bluePalette[_counter] = palPtr->blue;
+ }
} else
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 6593565e6a..64b9d19e33 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -1082,7 +1082,7 @@ void Mult_v2::animate() {
continue;
for (int j = 0; j < numAnims; j++) {
- Mult_Object &animObj2 = *_renderObjs[i];
+ Mult_Object &animObj2 = *_renderObjs[j];
Mult_AnimData &animData2 = *(animObj2.pAnimData);
if (i == j)
diff --git a/engines/gob/palanim.cpp b/engines/gob/palanim.cpp
index 8a5327c3f1..f90b141725 100644
--- a/engines/gob/palanim.cpp
+++ b/engines/gob/palanim.cpp
@@ -75,47 +75,28 @@ bool PalAnim::fadeStepColor(int color) {
bool PalAnim::fadeStep(int16 oper) {
bool stop = true;
- byte newRed;
- byte newGreen;
- byte newBlue;
if (oper == 0) {
- if (_vm->_global->_setAllPalette) {
- if (_vm->_global->_inVM != 0)
- error("PalAnim::fadeStep(): _vm->_global->_inVM != 0 not supported");
-
- for (int i = 0; i < 256; i++) {
- newRed = fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]);
- newGreen = fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]);
- newBlue = fadeColor(_vm->_global->_bluePalette[i], _toFadeBlue[i]);
-
- if ((_vm->_global->_redPalette[i] != newRed) ||
- (_vm->_global->_greenPalette[i] != newGreen) ||
- (_vm->_global->_bluePalette[i] != newBlue)) {
-
- _vm->_video->setPalElem(i, newRed, newGreen, newBlue, 0, 0x13);
-
- _vm->_global->_redPalette[i] = newRed;
- _vm->_global->_greenPalette[i] = newGreen;
- _vm->_global->_bluePalette[i] = newBlue;
- stop = false;
- }
- }
- } else {
- for (int i = 0; i < 16; i++) {
-
- _vm->_video->setPalElem(i,
- fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]),
- fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]),
- fadeColor(_vm->_global->_bluePalette[i], _toFadeBlue[i]),
- -1, _vm->_global->_videoMode);
-
- if ((_vm->_global->_redPalette[i] != _toFadeRed[i]) ||
- (_vm->_global->_greenPalette[i] != _toFadeGreen[i]) ||
- (_vm->_global->_bluePalette[i] != _toFadeBlue[i]))
- stop = false;
+ int colorCount = _vm->_global->_setAllPalette ? _vm->_global->_colorCount : 256;
+
+ for (int i = 0; i < colorCount; i++) {
+ byte newRed = fadeColor(_vm->_global->_redPalette [i], _toFadeRed [i]);
+ byte newGreen = fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]);
+ byte newBlue = fadeColor(_vm->_global->_bluePalette [i], _toFadeBlue [i]);
+
+ if ((_vm->_global->_redPalette [i] != newRed ) ||
+ (_vm->_global->_greenPalette[i] != newGreen) ||
+ (_vm->_global->_bluePalette [i] != newBlue)) {
+
+ _vm->_video->setPalElem(i, newRed, newGreen, newBlue, 0, 0x13);
+
+ _vm->_global->_redPalette [i] = newRed;
+ _vm->_global->_greenPalette[i] = newGreen;
+ _vm->_global->_bluePalette [i] = newBlue;
+ stop = false;
}
}
+
} else if ((oper > 0) && (oper < 4))
stop = fadeStepColor(oper - 1);
@@ -124,44 +105,18 @@ bool PalAnim::fadeStep(int16 oper) {
void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) {
bool stop;
- int16 i;
if (_vm->shouldQuit())
return;
_fadeValue = (fadeV < 0) ? -fadeV : 2;
- if (!_vm->_global->_setAllPalette) {
- if (!palDesc) {
- for (i = 0; i < 16; i++) {
- _toFadeRed[i] = 0;
- _toFadeGreen[i] = 0;
- _toFadeBlue[i] = 0;
- }
- } else {
- for (i = 0; i < 16; i++) {
- _toFadeRed[i] = palDesc->vgaPal[i].red;
- _toFadeGreen[i] = palDesc->vgaPal[i].green;
- _toFadeBlue[i] = palDesc->vgaPal[i].blue;
- }
- }
- } else {
- if (_vm->_global->_inVM != 0)
- error("PalAnim::fade(): _vm->_global->_inVM != 0 is not supported");
-
- if (!palDesc) {
- for (i = 0; i < 256; i++) {
- _toFadeRed[i] = 0;
- _toFadeGreen[i] = 0;
- _toFadeBlue[i] = 0;
- }
- } else {
- for (i = 0; i < 256; i++) {
- _toFadeRed[i] = palDesc->vgaPal[i].red;
- _toFadeGreen[i] = palDesc->vgaPal[i].green;
- _toFadeBlue[i] = palDesc->vgaPal[i].blue;
- }
- }
+ int colorCount = _vm->_global->_setAllPalette ? _vm->_global->_colorCount : 256;
+
+ for (int i = 0; i < colorCount; i++) {
+ _toFadeRed [i] = (palDesc == 0) ? 0 : palDesc->vgaPal[i].red;
+ _toFadeGreen[i] = (palDesc == 0) ? 0 : palDesc->vgaPal[i].green;
+ _toFadeBlue [i] = (palDesc == 0) ? 0 : palDesc->vgaPal[i].blue;
}
if (allColors == 0) {
diff --git a/engines/gob/pregob/gctfile.cpp b/engines/gob/pregob/gctfile.cpp
new file mode 100644
index 0000000000..08c32cda76
--- /dev/null
+++ b/engines/gob/pregob/gctfile.cpp
@@ -0,0 +1,306 @@
+/* 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/random.h"
+#include "common/stream.h"
+
+#include "gob/surface.h"
+#include "gob/video.h"
+
+#include "gob/pregob/gctfile.h"
+
+namespace Gob {
+
+GCTFile::Chunk::Chunk() : type(kChunkTypeNone) {
+}
+
+
+GCTFile::GCTFile(Common::SeekableReadStream &gct, Common::RandomSource &rnd) : _rnd(&rnd),
+ _areaLeft(0), _areaTop(0), _areaRight(0), _areaBottom(0), _currentItem(0xFFFF) {
+
+ load(gct);
+}
+
+GCTFile::~GCTFile() {
+}
+
+void GCTFile::load(Common::SeekableReadStream &gct) {
+ gct.skip(4); // Required buffer size
+ gct.skip(2); // Unknown
+
+ // Read the selector and line counts for each item
+ const uint16 itemCount = gct.readUint16LE();
+ _items.resize(itemCount);
+
+ for (Items::iterator i = _items.begin(); i != _items.end(); ++i) {
+ const uint16 selector = gct.readUint16LE();
+ const uint16 lineCount = gct.readUint16LE();
+
+ i->selector = selector;
+ i->lines.resize(lineCount);
+ }
+
+ // Read all item lines
+ for (Items::iterator i = _items.begin(); i != _items.end(); ++i) {
+ for (Lines::iterator l = i->lines.begin(); l != i->lines.end(); ++l) {
+ const uint16 lineSize = gct.readUint16LE();
+
+ readLine(gct, *l, lineSize);
+ }
+ }
+
+ if (gct.err())
+ error("GCTFile::load(): Failed reading GCT");
+}
+
+void GCTFile::readLine(Common::SeekableReadStream &gct, Line &line, uint16 lineSize) const {
+ line.chunks.push_back(Chunk());
+
+ while (lineSize > 0) {
+ byte c = gct.readByte();
+ lineSize--;
+
+ if (c == 0) {
+ // Command byte
+
+ if (lineSize == 0)
+ break;
+
+ byte cmd = gct.readByte();
+ lineSize--;
+
+ // Line end command
+ if (cmd == 0)
+ break;
+
+ // Item reference command
+ if (cmd == 1) {
+ if (lineSize < 2) {
+ warning("GCTFile::readLine(): Item reference command is missing parameters");
+ break;
+ }
+
+ const uint32 itemRef = gct.readUint16LE();
+ lineSize -= 2;
+
+ line.chunks.push_back(Chunk());
+ line.chunks.back().type = kChunkTypeItem;
+ line.chunks.back().item = itemRef;
+
+ line.chunks.push_back(Chunk());
+ continue;
+ }
+
+ warning("GCTFile::readLine(): Invalid command 0x%02X", cmd);
+ break;
+ }
+
+ // Text
+ line.chunks.back().type = kChunkTypeString;
+ line.chunks.back().text += (char)c;
+ }
+
+ // Skip bytes we didn't read (because of errors)
+ gct.skip(lineSize);
+
+ // Remove empty chunks from the end of the list
+ while (!line.chunks.empty() && (line.chunks.back().type == kChunkTypeNone))
+ line.chunks.pop_back();
+}
+
+uint16 GCTFile::getLineCount(uint item) const {
+ if (item >= _items.size())
+ return 0;
+
+ return _items[item].lines.size();
+}
+
+void GCTFile::selectLine(uint item, uint16 line) {
+ if ((item >= _items.size()) && (item != kSelectorAll) && (item != kSelectorRandom))
+ return;
+
+ _items[item].selector = line;
+}
+
+void GCTFile::setText(uint item, uint16 line, const Common::String &text) {
+ if ((item >= _items.size()) || (line >= _items[item].lines.size()))
+ return;
+
+ _items[item].lines[line].chunks.clear();
+ _items[item].lines[line].chunks.push_back(Chunk());
+
+ _items[item].lines[line].chunks.back().type = kChunkTypeString;
+ _items[item].lines[line].chunks.back().text = text;
+}
+
+void GCTFile::setText(uint item, const Common::String &text) {
+ if (item >= _items.size())
+ return;
+
+ _items[item].selector = 0;
+
+ _items[item].lines.resize(1);
+
+ setText(item, 0, text);
+}
+
+void GCTFile::reset() {
+ _currentItem = 0xFFFF;
+ _currentText.clear();
+}
+
+Common::String GCTFile::getLineText(const Line &line) const {
+ Common::String text;
+
+ // Go over all chunks in this line
+ for (Chunks::const_iterator c = line.chunks.begin(); c != line.chunks.end(); ++c) {
+ // A chunk is either a direct string, or a reference to another item
+
+ if (c->type == kChunkTypeItem) {
+ Common::List<Common::String> lines;
+
+ getItemText(c->item, lines);
+ if (lines.empty())
+ continue;
+
+ if (lines.size() > 1)
+ warning("GCTFile::getLineText(): Referenced item has multiple lines");
+
+ text += lines.front();
+ } else if (c->type == kChunkTypeString)
+ text += c->text;
+ }
+
+ return text;
+}
+
+void GCTFile::getItemText(uint item, Common::List<Common::String> &text) const {
+ text.clear();
+
+ if ((item >= _items.size()) || _items[item].lines.empty())
+ return;
+
+ uint16 line = _items[item].selector;
+
+ // Draw all lines
+ if (line == kSelectorAll) {
+ for (Lines::const_iterator l = _items[item].lines.begin(); l != _items[item].lines.end(); ++l)
+ text.push_back(getLineText(*l));
+
+ return;
+ }
+
+ // Draw random line
+ if (line == kSelectorRandom)
+ line = _rnd->getRandomNumber(_items[item].lines.size() - 1);
+
+ if (line >= _items[item].lines.size())
+ return;
+
+ text.push_back(getLineText(_items[item].lines[line]));
+}
+
+void GCTFile::setArea(int16 left, int16 top, int16 right, int16 bottom) {
+ trashBuffer();
+
+ _hasArea = false;
+
+ const int16 width = right - left + 1;
+ const int16 height = bottom - top + 1;
+ if ((width <= 0) || (height <= 0))
+ return;
+
+ _areaLeft = left;
+ _areaTop = top;
+ _areaRight = right;
+ _areaBottom = bottom;
+
+ _hasArea = true;
+
+ resizeBuffer(width, height);
+}
+
+bool GCTFile::clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ return restoreScreen(dest, left, top, right, bottom);
+}
+
+bool GCTFile::fill(Surface &dest, uint8 color, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ left = _areaLeft;
+ top = _areaTop;
+ right = _areaRight;
+ bottom = _areaBottom;
+
+ if (!hasSavedBackground())
+ saveScreen(dest, left, top, right, bottom);
+
+ dest.fillRect(left, top, right, bottom, color);
+
+ return true;
+}
+
+bool GCTFile::finished() const {
+ return (_currentItem != 0xFFFF) && _currentText.empty();
+}
+
+bool GCTFile::draw(Surface &dest, uint16 item, const Font &font, uint8 color,
+ int16 &left, int16 &top, int16 &right, int16 &bottom) {
+
+ if ((item >= _items.size()) || !_hasArea)
+ return false;
+
+ left = _areaLeft;
+ top = _areaTop;
+ right = _areaRight;
+ bottom = _areaBottom;
+
+ const int16 width = right - left + 1;
+ const int16 height = bottom - top + 1;
+
+ const uint lineCount = height / font.getCharHeight();
+ if (lineCount == 0)
+ return false;
+
+ if (!hasSavedBackground())
+ saveScreen(dest, left, top, right, bottom);
+
+ if (item != _currentItem) {
+ _currentItem = item;
+
+ getItemText(_currentItem, _currentText);
+ }
+
+ if (_currentText.empty())
+ return false;
+
+ int16 y = top;
+ for (uint i = 0; (i < lineCount) && !_currentText.empty(); i++, y += font.getCharHeight()) {
+ const Common::String &line = _currentText.front();
+ const int16 x = left + ((width - (line.size() * font.getCharWidth())) / 2);
+
+ font.drawString(line, x, y, color, 0, true, dest);
+ _currentText.pop_front();
+ }
+
+ return true;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/gctfile.h b/engines/gob/pregob/gctfile.h
new file mode 100644
index 0000000000..ed6351b7a8
--- /dev/null
+++ b/engines/gob/pregob/gctfile.h
@@ -0,0 +1,149 @@
+/* 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_PREGOB_GCTFILE_H
+#define GOB_PREGOB_GCTFILE_H
+
+#include "common/str.h"
+#include "common/array.h"
+#include "common/list.h"
+
+#include "gob/backbuffer.h"
+
+namespace Common {
+ class RandomSource;
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+class Surface;
+class Font;
+
+class GCTFile : public BackBuffer {
+public:
+ static const uint16 kSelectorAll = 0xFFFE; ///< Print all lines.
+ static const uint16 kSelectorRandom = 0xFFFF; ///< Print a random line.
+
+
+ GCTFile(Common::SeekableReadStream &gct, Common::RandomSource &rnd);
+ ~GCTFile();
+
+ /** Return the number of lines in an item. */
+ uint16 getLineCount(uint item) const;
+
+ /** Set the area the text will be printed in. */
+ void setArea(int16 left, int16 top, int16 right, int16 bottom);
+
+ /** Set which line of this item should be printed. */
+ void selectLine(uint item, uint16 line);
+
+ /** Change the text of an items' line. */
+ void setText(uint item, uint16 line, const Common::String &text);
+ /** Change the item into one one line and set that line's text. */
+ void setText(uint item, const Common::String &text);
+
+ /** Reset the item drawing state. */
+ void reset();
+
+ /** Clear the drawn text, restoring the original content. */
+ bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+ /** Fill the text area with a color. */
+ bool fill(Surface &dest, uint8 color, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+ /** Draw an item onto the surface, until all text has been drawn or the area is filled. */
+ bool draw(Surface &dest, uint16 item, const Font &font, uint8 color,
+ int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+ /** Did we draw all text? */
+ bool finished() const;
+
+private:
+ /** The type of a chunk. */
+ enum ChunkType {
+ kChunkTypeNone = 0, ///< Do nothing.
+ kChunkTypeString , ///< A direct string.
+ kChunkTypeItem ///< A reference to an item to print instead.
+ };
+
+ /** A chunk in an item text line. */
+ struct Chunk {
+ ChunkType type; ///< The type of the chunk.
+
+ Common::String text; ///< Text to print.
+
+ int item; ///< Item to print instead.
+
+ Chunk();
+ };
+
+ typedef Common::List<Chunk> Chunks;
+
+ /** A line in an item. */
+ struct Line {
+ Chunks chunks; ///< The chunks that make up the line.
+ };
+
+ typedef Common::Array<Line> Lines;
+
+ /** A GCT item. */
+ struct Item {
+ Lines lines; ///< The text lines in the item
+ uint16 selector; ///< Which line to print.
+ };
+
+ typedef Common::Array<Item> Items;
+
+
+ Common::RandomSource *_rnd;
+
+ Items _items; ///< All GCT items.
+
+ // The area on which to print
+ bool _hasArea;
+ int16 _areaLeft;
+ int16 _areaTop;
+ int16 _areaRight;
+ int16 _areaBottom;
+
+ /** Index of the current item we're drawing. */
+ uint16 _currentItem;
+ /** Text left to draw. */
+ Common::List<Common::String> _currentText;
+
+
+ // -- Loading helpers --
+
+ void load(Common::SeekableReadStream &gct);
+ void readLine(Common::SeekableReadStream &gct, Line &line, uint16 lineSize) const;
+
+
+ // -- Draw helpers --
+
+ Common::String getLineText(const Line &line) const;
+ void getItemText(uint item, Common::List<Common::String> &text) const;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_GCTFILE_H
diff --git a/engines/gob/pregob/onceupon/abracadabra.cpp b/engines/gob/pregob/onceupon/abracadabra.cpp
new file mode 100644
index 0000000000..2cf6855ef8
--- /dev/null
+++ b/engines/gob/pregob/onceupon/abracadabra.cpp
@@ -0,0 +1,137 @@
+/* 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/textconsole.h"
+
+#include "gob/gob.h"
+
+#include "gob/pregob/onceupon/abracadabra.h"
+
+static const uint8 kCopyProtectionColors[7] = {
+ 14, 11, 13, 1, 7, 12, 2
+};
+
+static const uint8 kCopyProtectionShapes[7 * 20] = {
+ 3, 4, 3, 0, 1, 2, 0, 2, 2, 0, 2, 4, 0, 3, 4, 1, 1, 4, 1, 3,
+ 0, 2, 0, 4, 2, 4, 4, 2, 3, 0, 1, 1, 1, 1, 3, 0, 4, 2, 3, 4,
+ 0, 0, 1, 2, 1, 1, 2, 4, 3, 1, 4, 2, 4, 4, 2, 4, 1, 2, 3, 3,
+ 1, 0, 2, 3, 4, 2, 3, 2, 2, 0, 0, 0, 4, 2, 3, 4, 4, 0, 4, 1,
+ 4, 2, 1, 1, 1, 1, 4, 3, 4, 2, 3, 0, 0, 3, 0, 2, 3, 0, 2, 4,
+ 4, 2, 4, 3, 0, 4, 0, 2, 3, 1, 4, 1, 3, 1, 0, 0, 2, 1, 3, 2,
+ 3, 1, 0, 3, 1, 3, 4, 2, 4, 4, 3, 2, 0, 2, 0, 1, 2, 0, 1, 4
+};
+
+static const uint8 kCopyProtectionObfuscate[4] = {
+ 1, 0, 2, 3
+};
+
+namespace Gob {
+
+namespace OnceUpon {
+
+const OnceUpon::MenuButton Abracadabra::kAnimalsButtons = {
+ true, 131, 127, 183, 164, 193, 0, 243, 35, 132, 128, 0
+};
+
+const OnceUpon::MenuButton Abracadabra::kAnimalButtons[] = {
+ {false, 37, 89, 95, 127, 37, 89, 95, 127, 131, 25, 0},
+ {false, 114, 65, 172, 111, 114, 65, 172, 111, 131, 25, 1},
+ {false, 186, 72, 227, 96, 186, 72, 227, 96, 139, 25, 2},
+ {false, 249, 87, 282, 112, 249, 87, 282, 112, 143, 25, 3},
+ {false, 180, 102, 234, 138, 180, 102, 234, 138, 133, 25, 4},
+ {false, 197, 145, 242, 173, 197, 145, 242, 173, 137, 25, 5},
+ {false, 113, 151, 171, 176, 113, 151, 171, 176, 131, 25, 6},
+ {false, 114, 122, 151, 150, 114, 122, 151, 150, 141, 25, 7},
+ {false, 36, 136, 94, 176, 36, 136, 94, 176, 131, 25, 8},
+ {false, 243, 123, 295, 155, 243, 123, 295, 155, 136, 25, 9}
+};
+
+const char *Abracadabra::kAnimalNames[] = {
+ "loup",
+ "drag",
+ "arai",
+ "crap",
+ "crab",
+ "mous",
+ "saut",
+ "guep",
+ "rhin",
+ "scor"
+};
+
+// The houses where the stork can drop a bundle
+const OnceUpon::MenuButton Abracadabra::kStorkHouses[] = {
+ {false, 16, 80, 87, 125, 0, 0, 0, 0, 0, 0, 0}, // Castle , Lord & Lady
+ {false, 61, 123, 96, 149, 0, 0, 0, 0, 0, 0, 1}, // Cottage, Farmers
+ {false, 199, 118, 226, 137, 0, 0, 0, 0, 0, 0, 2}, // Hut , Woodcutters
+ {false, 229, 91, 304, 188, 0, 0, 0, 0, 0, 0, 3} // Palace , King & Queen
+};
+
+// The stork bundle drop parameters
+const Stork::BundleDrop Abracadabra::kStorkBundleDrops[] = {
+ { 14, 65, 127, true },
+ { 14, 76, 152, true },
+ { 14, 204, 137, true },
+ { 11, 275, 179, false }
+};
+
+// Parameters for the stork section.
+const OnceUpon::StorkParam Abracadabra::kStorkParam = {
+ "present.cmp", ARRAYSIZE(kStorkHouses), kStorkHouses, kStorkBundleDrops
+};
+
+
+Abracadabra::Abracadabra(GobEngine *vm) : OnceUpon(vm) {
+}
+
+Abracadabra::~Abracadabra() {
+}
+
+void Abracadabra::run() {
+ init();
+
+ // Copy protection
+ bool correctCP = doCopyProtection(kCopyProtectionColors, kCopyProtectionShapes, kCopyProtectionObfuscate);
+ if (_vm->shouldQuit() || !correctCP)
+ return;
+
+ // Show the intro
+ showIntro();
+ if (_vm->shouldQuit())
+ return;
+
+ // Handle the start menu
+ doStartMenu(&kAnimalsButtons, ARRAYSIZE(kAnimalButtons), kAnimalButtons, kAnimalNames);
+ if (_vm->shouldQuit())
+ return;
+
+ // Play the actual game
+ playGame();
+}
+
+const OnceUpon::StorkParam &Abracadabra::getStorkParameters() const {
+ return kStorkParam;
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/abracadabra.h b/engines/gob/pregob/onceupon/abracadabra.h
new file mode 100644
index 0000000000..8048213f5f
--- /dev/null
+++ b/engines/gob/pregob/onceupon/abracadabra.h
@@ -0,0 +1,61 @@
+/* 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_PREGOB_ONCEUPON_ABRACADABRA_H
+#define GOB_PREGOB_ONCEUPON_ABRACADABRA_H
+
+#include "gob/pregob/onceupon/onceupon.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+class Abracadabra : public OnceUpon {
+public:
+ Abracadabra(GobEngine *vm);
+ ~Abracadabra();
+
+ void run();
+
+protected:
+ const StorkParam &getStorkParameters() const;
+
+private:
+ /** Definition of the menu button that leads to the animal names screen. */
+ static const MenuButton kAnimalsButtons;
+
+ /** Definition of the buttons that make up the animals in the animal names screen. */
+ static const MenuButton kAnimalButtons[];
+ /** File prefixes for the name of each animal. */
+ static const char *kAnimalNames[];
+
+ // Parameters for the stork section.
+ static const MenuButton kStorkHouses[];
+ static const Stork::BundleDrop kStorkBundleDrops[];
+ static const struct StorkParam kStorkParam;
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_ABRACADABRA_H
diff --git a/engines/gob/pregob/onceupon/babayaga.cpp b/engines/gob/pregob/onceupon/babayaga.cpp
new file mode 100644
index 0000000000..ef56b9dd0b
--- /dev/null
+++ b/engines/gob/pregob/onceupon/babayaga.cpp
@@ -0,0 +1,137 @@
+/* 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/textconsole.h"
+
+#include "gob/gob.h"
+
+#include "gob/pregob/onceupon/babayaga.h"
+
+static const uint8 kCopyProtectionColors[7] = {
+ 14, 11, 13, 1, 7, 12, 2
+};
+
+static const uint8 kCopyProtectionShapes[7 * 20] = {
+ 0, 0, 1, 2, 1, 1, 2, 4, 3, 1, 4, 2, 4, 4, 2, 4, 1, 2, 3, 3,
+ 3, 1, 0, 3, 1, 3, 4, 2, 4, 4, 3, 2, 0, 2, 0, 1, 2, 0, 1, 4,
+ 1, 0, 2, 3, 4, 2, 3, 2, 2, 0, 0, 0, 4, 2, 3, 4, 4, 0, 4, 1,
+ 0, 2, 0, 4, 2, 4, 4, 2, 3, 0, 1, 1, 1, 1, 3, 0, 4, 2, 3, 4,
+ 3, 4, 3, 0, 1, 2, 0, 2, 2, 0, 2, 4, 0, 3, 4, 1, 1, 4, 1, 3,
+ 4, 2, 1, 1, 1, 1, 4, 3, 4, 2, 3, 0, 0, 3, 0, 2, 3, 0, 2, 4,
+ 4, 2, 4, 3, 0, 4, 0, 2, 3, 1, 4, 1, 3, 1, 0, 0, 2, 1, 3, 2
+};
+
+static const uint8 kCopyProtectionObfuscate[4] = {
+ 0, 1, 2, 3
+};
+
+namespace Gob {
+
+namespace OnceUpon {
+
+const OnceUpon::MenuButton BabaYaga::kAnimalsButtons = {
+ true, 131, 127, 183, 164, 193, 0, 245, 37, 131, 127, 0
+};
+
+const OnceUpon::MenuButton BabaYaga::kAnimalButtons[] = {
+ {false, 34, 84, 92, 127, 34, 84, 92, 127, 131, 25, 0},
+ {false, 114, 65, 172, 111, 114, 65, 172, 111, 131, 25, 1},
+ {false, 186, 72, 227, 96, 186, 72, 227, 96, 139, 25, 2},
+ {false, 249, 87, 282, 112, 249, 87, 282, 112, 143, 25, 3},
+ {false, 180, 97, 234, 138, 180, 97, 234, 138, 133, 25, 4},
+ {false, 197, 145, 242, 173, 197, 145, 242, 173, 137, 25, 5},
+ {false, 113, 156, 171, 176, 113, 156, 171, 176, 131, 25, 6},
+ {false, 114, 127, 151, 150, 114, 127, 151, 150, 141, 25, 7},
+ {false, 36, 136, 94, 176, 36, 136, 94, 176, 131, 25, 8},
+ {false, 245, 123, 293, 155, 245, 123, 293, 155, 136, 25, 9}
+};
+
+const char *BabaYaga::kAnimalNames[] = {
+ "vaut",
+ "drag",
+ "arai",
+ "gren",
+ "fauc",
+ "abei",
+ "serp",
+ "tort",
+ "sang",
+ "rena"
+};
+
+// The houses where the stork can drop a bundle
+const OnceUpon::MenuButton BabaYaga::kStorkHouses[] = {
+ {false, 16, 80, 87, 125, 0, 0, 0, 0, 0, 0, 0}, // Castle , Lord & Lady
+ {false, 61, 123, 96, 149, 0, 0, 0, 0, 0, 0, 1}, // Cottage, Farmers
+ {false, 199, 118, 226, 137, 0, 0, 0, 0, 0, 0, 2}, // Hut , Woodcutters
+ {false, 229, 91, 304, 188, 0, 0, 0, 0, 0, 0, 3} // Palace , King & Queen
+};
+
+// The stork bundle drop parameters
+const Stork::BundleDrop BabaYaga::kStorkBundleDrops[] = {
+ { 14, 35, 129, true },
+ { 14, 70, 148, true },
+ { 14, 206, 136, true },
+ { 11, 260, 225, false }
+};
+
+// Parameters for the stork section.
+const OnceUpon::StorkParam BabaYaga::kStorkParam = {
+ "present2.cmp", ARRAYSIZE(kStorkHouses), kStorkHouses, kStorkBundleDrops
+};
+
+
+BabaYaga::BabaYaga(GobEngine *vm) : OnceUpon(vm) {
+}
+
+BabaYaga::~BabaYaga() {
+}
+
+void BabaYaga::run() {
+ init();
+
+ // Copy protection
+ bool correctCP = doCopyProtection(kCopyProtectionColors, kCopyProtectionShapes, kCopyProtectionObfuscate);
+ if (_vm->shouldQuit() || !correctCP)
+ return;
+
+ // Show the intro
+ showIntro();
+ if (_vm->shouldQuit())
+ return;
+
+ // Handle the start menu
+ doStartMenu(&kAnimalsButtons, ARRAYSIZE(kAnimalButtons), kAnimalButtons, kAnimalNames);
+ if (_vm->shouldQuit())
+ return;
+
+ // Play the actual game
+ playGame();
+}
+
+const OnceUpon::StorkParam &BabaYaga::getStorkParameters() const {
+ return kStorkParam;
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/babayaga.h b/engines/gob/pregob/onceupon/babayaga.h
new file mode 100644
index 0000000000..0241f78f4e
--- /dev/null
+++ b/engines/gob/pregob/onceupon/babayaga.h
@@ -0,0 +1,61 @@
+/* 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_PREGOB_ONCEUPON_BABAYAGA_H
+#define GOB_PREGOB_ONCEUPON_BABAYAGA_H
+
+#include "gob/pregob/onceupon/onceupon.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+class BabaYaga : public OnceUpon {
+public:
+ BabaYaga(GobEngine *vm);
+ ~BabaYaga();
+
+ void run();
+
+protected:
+ const StorkParam &getStorkParameters() const;
+
+private:
+ /** Definition of the menu button that leads to the animal names screen. */
+ static const MenuButton kAnimalsButtons;
+
+ /** Definition of the buttons that make up the animals in the animal names screen. */
+ static const MenuButton kAnimalButtons[];
+ /** File prefixes for the name of each animal. */
+ static const char *kAnimalNames[];
+
+ // Parameters for the stork section.
+ static const MenuButton kStorkHouses[];
+ static const Stork::BundleDrop kStorkBundleDrops[];
+ static const struct StorkParam kStorkParam;
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_BABAYAGA_H
diff --git a/engines/gob/pregob/onceupon/brokenstrings.h b/engines/gob/pregob/onceupon/brokenstrings.h
new file mode 100644
index 0000000000..89acb1c6bd
--- /dev/null
+++ b/engines/gob/pregob/onceupon/brokenstrings.h
@@ -0,0 +1,60 @@
+/* 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_PREGOB_ONCEUPON_BROKENSTRINGS_H
+#define GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H
+
+struct BrokenString {
+ const char *wrong;
+ const char *correct;
+};
+
+struct BrokenStringLanguage {
+ const BrokenString *strings;
+ uint count;
+};
+
+static const BrokenString kBrokenStringsGerman[] = {
+ { "Zeichungen von Kaki," , "Zeichnungen von Kaki," },
+ { "die es in seine Wachtr\204ume", "die es in seine Tagtr\204ume" },
+ { " Spielerfahrung" , " Spielerfahren" },
+ { " Fortgeschrittene" , " Fortgeschritten" },
+ { "die Vespe" , "die Wespe" },
+ { "das Rhinoceros" , "das Rhinozeros" },
+ { "die Heusschrecke" , "die Heuschrecke" },
+ { "Das, von Drachen gebrachte" , "Das vom Drachen gebrachte" },
+ { "Am Waldesrand es sieht" , "Am Waldesrand sieht es" },
+ { " das Kind den Palast." , "das Kind den Palast." },
+ { "Am Waldessaum sieht" , "Am Waldesrand sieht" },
+ { "tipp auf ESC!" , "dr\201cke ESC!" },
+ { "Wohin fliegt der Drachen?" , "Wohin fliegt der Drache?" }
+};
+
+static const BrokenStringLanguage kBrokenStrings[kLanguageCount] = {
+ { 0, 0 }, // French
+ { kBrokenStringsGerman, ARRAYSIZE(kBrokenStringsGerman) }, // German
+ { 0, 0 }, // English
+ { 0, 0 }, // Spanish
+ { 0, 0 }, // Italian
+};
+
+#endif // GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H
diff --git a/engines/gob/pregob/onceupon/chargenchild.cpp b/engines/gob/pregob/onceupon/chargenchild.cpp
new file mode 100644
index 0000000000..ba099e4937
--- /dev/null
+++ b/engines/gob/pregob/onceupon/chargenchild.cpp
@@ -0,0 +1,117 @@
+/* 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/surface.h"
+#include "gob/anifile.h"
+
+#include "gob/pregob/onceupon/chargenchild.h"
+
+enum Animation {
+ kAnimWalkLeft = 0,
+ kAnimWalkRight = 1,
+ kAnimJumpLeft = 2,
+ kAnimJumpRight = 3,
+ kAnimTapFoot = 14
+};
+
+namespace Gob {
+
+namespace OnceUpon {
+
+CharGenChild::CharGenChild(const ANIFile &ani) : ANIObject(ani) {
+ setPosition(265, 110);
+ setAnimation(kAnimWalkLeft);
+ setVisible(true);
+ setPause(false);
+}
+
+CharGenChild::~CharGenChild() {
+}
+
+void CharGenChild::advance() {
+ bool wasLastFrame = lastFrame();
+
+ ANIObject::advance();
+
+ int16 x, y, left, top, width, height;
+ getPosition(x, y);
+ getFramePosition(left, top);
+ getFrameSize(width, height);
+
+ const int16 right = left + width - 1;
+
+ switch (getAnimation()) {
+ case kAnimWalkLeft:
+ if (left <= 147)
+ setAnimation(kAnimWalkRight);
+ break;
+
+ case kAnimWalkRight:
+ if (right >= 290) {
+ setAnimation(kAnimJumpLeft);
+
+ setPosition(x, y - 14);
+ }
+ break;
+
+ case kAnimJumpLeft:
+ if (wasLastFrame) {
+ setAnimation(kAnimTapFoot);
+
+ setPosition(x, y - 10);
+ }
+ break;
+
+ case kAnimTapFoot:
+ if (wasLastFrame) {
+ setAnimation(kAnimJumpRight);
+
+ setPosition(x, y + 10);
+ }
+ break;
+
+ case kAnimJumpRight:
+ if (wasLastFrame) {
+ setAnimation(kAnimWalkLeft);
+
+ setPosition(x, y + 14);
+ }
+ break;
+ }
+}
+
+CharGenChild::Sound CharGenChild::shouldPlaySound() const {
+ const uint16 anim = getAnimation();
+ const uint16 frame = getFrame();
+
+ if (((anim == kAnimWalkLeft) || (anim == kAnimWalkRight)) && ((frame == 1) || (frame == 6)))
+ return kSoundWalk;
+
+ if (((anim == kAnimJumpLeft) || (anim == kAnimJumpRight)) && (frame == 0))
+ return kSoundJump;
+
+ return kSoundNone;
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/chargenchild.h b/engines/gob/pregob/onceupon/chargenchild.h
new file mode 100644
index 0000000000..3b09ef112a
--- /dev/null
+++ b/engines/gob/pregob/onceupon/chargenchild.h
@@ -0,0 +1,60 @@
+/* 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_PREGOB_ONCEUPON_CHARGENCHILD_H
+#define GOB_PREGOB_ONCEUPON_CHARGENCHILD_H
+
+#include "common/system.h"
+
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+class Surface;
+class ANIFile;
+
+namespace OnceUpon {
+
+/** The child running around on the character generator screen. */
+class CharGenChild : public ANIObject {
+public:
+ enum Sound {
+ kSoundNone = 0,
+ kSoundWalk ,
+ kSoundJump
+ };
+
+ CharGenChild(const ANIFile &ani);
+ ~CharGenChild();
+
+ /** Advance the animation to the next frame. */
+ void advance();
+
+ /** Should we play a sound right now? */
+ Sound shouldPlaySound() const;
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_CHARGENCHILD_H
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp
new file mode 100644
index 0000000000..e4c2df34c0
--- /dev/null
+++ b/engines/gob/pregob/onceupon/onceupon.cpp
@@ -0,0 +1,1904 @@
+/* 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/global.h"
+#include "gob/util.h"
+#include "gob/dataio.h"
+#include "gob/surface.h"
+#include "gob/draw.h"
+#include "gob/video.h"
+#include "gob/anifile.h"
+#include "gob/aniobject.h"
+
+#include "gob/sound/sound.h"
+
+#include "gob/pregob/txtfile.h"
+#include "gob/pregob/gctfile.h"
+
+#include "gob/pregob/onceupon/onceupon.h"
+#include "gob/pregob/onceupon/palettes.h"
+#include "gob/pregob/onceupon/title.h"
+#include "gob/pregob/onceupon/parents.h"
+#include "gob/pregob/onceupon/chargenchild.h"
+
+static const uint kLanguageCount = 5;
+
+static const uint kCopyProtectionHelpStringCount = 3;
+
+static const char *kCopyProtectionHelpStrings[Gob::OnceUpon::OnceUpon::kLanguageCount][kCopyProtectionHelpStringCount] = {
+ { // French
+ "Consulte le livret des animaux, rep\212re la",
+ "page correspondant \205 la couleur de l\'\202cran",
+ "et clique le symbole associ\202 \205 l\'animal affich\202.",
+ },
+ { // German
+ "Suche im Tieralbum die Seite, die der Farbe auf",
+ "dem Bildschirm entspricht und klicke auf das",
+ "Tiersymbol.",
+ },
+ { // English
+ "Consult the book of animals, find the page",
+ "corresponding to the colour of screen and click",
+ "the symbol associated with the animal displayed.",
+ },
+ { // Spanish
+ "Consulta el libro de los animales, localiza la ",
+ "p\240gina que corresponde al color de la pantalla.",
+ "Cliquea el s\241mbolo asociado al animal que aparece.",
+ },
+ { // Italian
+ "Guarda il libretto degli animali, trova la",
+ "pagina che corrisponde al colore dello schermo,",
+ "clicca il simbolo associato all\'animale presentato",
+ }
+};
+
+static const char *kCopyProtectionWrongStrings[Gob::OnceUpon::OnceUpon::kLanguageCount] = {
+ "Tu t\'es tromp\202, dommage...", // French
+ "Schade, du hast dich geirrt." , // German
+ "You are wrong, what a pity!" , // English
+ "Te equivocas, l\240stima..." , // Spanish
+ "Sei Sbagliato, peccato..." // Italian
+};
+
+static const uint kCopyProtectionShapeCount = 5;
+
+static const int16 kCopyProtectionShapeCoords[kCopyProtectionShapeCount][6] = {
+ { 0, 51, 26, 75, 60, 154},
+ { 28, 51, 58, 81, 96, 151},
+ { 60, 51, 94, 79, 136, 152},
+ { 96, 51, 136, 71, 180, 155},
+ {140, 51, 170, 77, 228, 153}
+};
+
+enum ClownAnimation {
+ kClownAnimationClownCheer = 0,
+ kClownAnimationClownStand = 1,
+ kClownAnimationClownCry = 6
+};
+
+// 12 seconds delay for one area full of GCT text
+static const uint32 kGCTDelay = 12000;
+
+namespace Gob {
+
+namespace OnceUpon {
+
+const OnceUpon::MenuButton OnceUpon::kMainMenuDifficultyButton[] = {
+ {false, 29, 18, 77, 57, 0, 0, 0, 0, 0, 0, (int)kDifficultyBeginner},
+ {false, 133, 18, 181, 57, 0, 0, 0, 0, 0, 0, (int)kDifficultyIntermediate},
+ {false, 241, 18, 289, 57, 0, 0, 0, 0, 0, 0, (int)kDifficultyAdvanced},
+};
+
+const OnceUpon::MenuButton OnceUpon::kSectionButtons[] = {
+ {false, 27, 121, 91, 179, 0, 0, 0, 0, 0, 0, 0},
+ { true, 95, 121, 159, 179, 4, 1, 56, 49, 100, 126, 2},
+ { true, 163, 121, 227, 179, 64, 1, 120, 49, 168, 126, 6},
+ { true, 231, 121, 295, 179, 128, 1, 184, 49, 236, 126, 10}
+};
+
+const OnceUpon::MenuButton OnceUpon::kIngameButtons[] = {
+ {true, 108, 83, 139, 116, 0, 0, 31, 34, 108, 83, 0},
+ {true, 144, 83, 175, 116, 36, 0, 67, 34, 144, 83, 1},
+ {true, 180, 83, 211, 116, 72, 0, 103, 34, 180, 83, 2}
+};
+
+const OnceUpon::MenuButton OnceUpon::kAnimalNamesBack = {
+ true, 19, 13, 50, 46, 36, 0, 67, 34, 19, 13, 1
+};
+
+const OnceUpon::MenuButton OnceUpon::kLanguageButtons[] = {
+ {true, 43, 80, 93, 115, 0, 55, 50, 90, 43, 80, 0},
+ {true, 132, 80, 182, 115, 53, 55, 103, 90, 132, 80, 1},
+ {true, 234, 80, 284, 115, 106, 55, 156, 90, 234, 80, 2},
+ {true, 43, 138, 93, 173, 159, 55, 209, 90, 43, 138, 3},
+ {true, 132, 138, 182, 173, 212, 55, 262, 90, 132, 138, 4},
+ {true, 234, 138, 284, 173, 265, 55, 315, 90, 234, 138, 2}
+};
+
+const char *OnceUpon::kSound[kSoundCount] = {
+ "diamant.snd", // kSoundClick
+ "cigogne.snd", // kSoundStork
+ "saute.snd" // kSoundJump
+};
+
+const OnceUpon::SectionFunc OnceUpon::kSectionFuncs[kSectionCount] = {
+ &OnceUpon::sectionStork,
+ &OnceUpon::sectionChapter1,
+ &OnceUpon::sectionParents,
+ &OnceUpon::sectionChapter2,
+ &OnceUpon::sectionForest0,
+ &OnceUpon::sectionChapter3,
+ &OnceUpon::sectionEvilCastle,
+ &OnceUpon::sectionChapter4,
+ &OnceUpon::sectionForest1,
+ &OnceUpon::sectionChapter5,
+ &OnceUpon::sectionBossFight,
+ &OnceUpon::sectionChapter6,
+ &OnceUpon::sectionForest2,
+ &OnceUpon::sectionChapter7,
+ &OnceUpon::sectionEnd
+};
+
+
+OnceUpon::ScreenBackup::ScreenBackup() : palette(-1), changedCursor(false), cursorVisible(false) {
+ screen = new Surface(320, 200, 1);
+}
+
+OnceUpon::ScreenBackup::~ScreenBackup() {
+ delete screen;
+}
+
+
+OnceUpon::OnceUpon(GobEngine *vm) : PreGob(vm), _openedArchives(false),
+ _jeudak(0), _lettre(0), _plettre(0), _glettre(0) {
+
+}
+
+OnceUpon::~OnceUpon() {
+ deinit();
+}
+
+void OnceUpon::init() {
+ deinit();
+
+ // Open data files
+
+ bool hasSTK1 = _vm->_dataIO->openArchive("stk1.stk", true);
+ bool hasSTK2 = _vm->_dataIO->openArchive("stk2.stk", true);
+ bool hasSTK3 = _vm->_dataIO->openArchive("stk3.stk", true);
+
+ if (!hasSTK1 || !hasSTK2 || !hasSTK3)
+ error("OnceUpon::OnceUpon(): Failed to open archives");
+
+ _openedArchives = true;
+
+ // Open fonts
+
+ _jeudak = _vm->_draw->loadFont("jeudak.let");
+ _lettre = _vm->_draw->loadFont("lettre.let");
+ _plettre = _vm->_draw->loadFont("plettre.let");
+ _glettre = _vm->_draw->loadFont("glettre.let");
+
+ if (!_jeudak || !_lettre || !_plettre || !_glettre)
+ error("OnceUpon::OnceUpon(): Failed to fonts (%d, %d, %d, %d)",
+ _jeudak != 0, _lettre != 0, _plettre != 0, _glettre != 0);
+
+ // Verify the language
+
+ if (_vm->_global->_language == kLanguageAmerican)
+ _vm->_global->_language = kLanguageBritish;
+
+ if ((_vm->_global->_language >= kLanguageCount))
+ error("We do not support the language \"%s\".\n"
+ "If you are certain that your game copy includes this language,\n"
+ "please contact the ScummVM team with details about this version.\n"
+ "Thanks", _vm->getLangDesc(_vm->_global->_language));
+
+ // Load all our sounds and init the screen
+
+ loadSounds(kSound, kSoundCount);
+ initScreen();
+
+ // We start with an invalid palette
+ _palette = -1;
+
+ // No quit requested at start
+ _quit = false;
+
+ // We start with no selected difficulty and at section 0
+ _difficulty = kDifficultyCount;
+ _section = 0;
+
+ // Default name
+ _name = "Nemo";
+
+ // Default character properties
+ _house = 0;
+ _head = 0;
+ _colorHair = 0;
+ _colorJacket = 0;
+ _colorTrousers = 0;
+}
+
+void OnceUpon::deinit() {
+ // Free sounds
+ freeSounds();
+
+ // Free fonts
+
+ delete _jeudak;
+ delete _lettre;
+ delete _plettre;
+ delete _glettre;
+
+ _jeudak = 0;
+ _lettre = 0;
+ _plettre = 0;
+ _glettre = 0;
+
+ // Close archives
+
+ if (_openedArchives) {
+ _vm->_dataIO->closeArchive(true);
+ _vm->_dataIO->closeArchive(true);
+ _vm->_dataIO->closeArchive(true);
+ }
+
+ _openedArchives = false;
+}
+
+void OnceUpon::setGamePalette(uint palette) {
+ if (palette >= kPaletteCount)
+ return;
+
+ _palette = palette;
+
+ setPalette(kGamePalettes[palette], kPaletteSize);
+}
+
+void OnceUpon::setGameCursor() {
+ Surface cursor(320, 16, 1);
+
+ // Set the default game cursor
+ _vm->_video->drawPackedSprite("icon.cmp", cursor);
+ setCursor(cursor, 105, 0, 120, 15, 0, 0);
+}
+
+void OnceUpon::drawLineByLine(const Surface &src, int16 left, int16 top, int16 right, int16 bottom,
+ int16 x, int16 y) const {
+
+ // A special way of drawing something:
+ // Draw every other line "downwards", wait a bit after each line
+ // Then, draw the remaining lines "upwards" and again wait a bit after each line.
+
+ if (_vm->shouldQuit())
+ return;
+
+ const int16 width = right - left + 1;
+ const int16 height = bottom - top + 1;
+
+ if ((width <= 0) || (height <= 0))
+ return;
+
+ // Draw the even lines downwards
+ for (int16 i = 0; i < height; i += 2) {
+ if (_vm->shouldQuit())
+ return;
+
+ _vm->_draw->_backSurface->blit(src, left, top + i, right, top + i, x, y + i);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, y + i, x + width - 1, y + 1);
+ _vm->_draw->blitInvalidated();
+
+ _vm->_util->longDelay(1);
+ }
+
+ // Draw the odd lines upwards
+ for (int16 i = (height & 1) ? height : (height - 1); i >= 0; i -= 2) {
+ if (_vm->shouldQuit())
+ return;
+
+ _vm->_draw->_backSurface->blit(src, left, top + i, right, top + i, x, y + i);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, y + i, x + width - 1, y + 1);
+ _vm->_draw->blitInvalidated();
+
+ _vm->_util->longDelay(1);
+ }
+}
+
+void OnceUpon::backupScreen(ScreenBackup &backup, bool setDefaultCursor) {
+ // Backup the screen and palette
+ backup.screen->blit(*_vm->_draw->_backSurface);
+ backup.palette = _palette;
+
+ // Backup the cursor
+
+ backup.cursorVisible = isCursorVisible();
+
+ backup.changedCursor = false;
+ if (setDefaultCursor) {
+ backup.changedCursor = true;
+
+ addCursor();
+ setGameCursor();
+ }
+}
+
+void OnceUpon::restoreScreen(ScreenBackup &backup) {
+ if (_vm->shouldQuit())
+ return;
+
+ // Restore the screen
+ _vm->_draw->_backSurface->blit(*backup.screen);
+ _vm->_draw->forceBlit();
+
+ // Restore the palette
+ if (backup.palette >= 0)
+ setGamePalette(backup.palette);
+
+ // Restore the cursor
+
+ if (!backup.cursorVisible)
+ hideCursor();
+
+ if (backup.changedCursor)
+ removeCursor();
+
+ backup.changedCursor = false;
+}
+
+void OnceUpon::fixTXTStrings(TXTFile &txt) const {
+ TXTFile::LineArray &lines = txt.getLines();
+ for (uint i = 0; i < lines.size(); i++)
+ lines[i].text = fixString(lines[i].text);
+}
+
+#include "gob/pregob/onceupon/brokenstrings.h"
+Common::String OnceUpon::fixString(const Common::String &str) const {
+ const BrokenStringLanguage &broken = kBrokenStrings[_vm->_global->_language];
+
+ for (uint i = 0; i < broken.count; i++) {
+ if (str == broken.strings[i].wrong)
+ return broken.strings[i].correct;
+ }
+
+ return str;
+}
+
+enum ClownAnimation {
+ kClownAnimationStand = 0,
+ kClownAnimationCheer = 1,
+ kClownAnimationCry = 2
+};
+
+const PreGob::AnimProperties OnceUpon::kClownAnimations[] = {
+ { 1, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 0, 0, ANIObject::kModeOnce , true, false, false, 0, 0},
+ { 6, 0, ANIObject::kModeOnce , true, false, false, 0, 0}
+};
+
+enum CopyProtectionState {
+ kCPStateSetup, // Set up the screen
+ kCPStateWaitUser, // Waiting for the user to pick a shape
+ kCPStateWaitClown, // Waiting for the clown animation to finish
+ kCPStateFinish // Finishing
+};
+
+bool OnceUpon::doCopyProtection(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4]) {
+ fadeOut();
+ setPalette(kCopyProtectionPalette, kPaletteSize);
+
+ // Load the copy protection sprites
+ Surface sprites[2] = {Surface(320, 200, 1), Surface(320, 200, 1)};
+
+ _vm->_video->drawPackedSprite("grille1.cmp", sprites[0]);
+ _vm->_video->drawPackedSprite("grille2.cmp", sprites[1]);
+
+ // Load the clown animation
+ ANIFile ani (_vm, "grille.ani", 320);
+ ANIList anims;
+
+ loadAnims(anims, ani, 1, &kClownAnimations[kClownAnimationStand]);
+
+ // Set the copy protection cursor
+ setCursor(sprites[1], 5, 110, 20, 134, 3, 0);
+
+ // We start with 2 tries left, not having a correct answer and the copy protection not set up yet
+ CopyProtectionState state = kCPStateSetup;
+
+ uint8 triesLeft = 2;
+ int8 animalShape = -1;
+ bool hasCorrect = false;
+
+ while (!_vm->shouldQuit() && (state != kCPStateFinish)) {
+ clearAnim(anims);
+
+ // Set up the screen
+ if (state == kCPStateSetup) {
+ animalShape = cpSetup(colors, shapes, obfuscate, sprites);
+
+ setAnim(*anims[0], kClownAnimations[kClownAnimationStand]);
+ state = kCPStateWaitUser;
+ }
+
+ drawAnim(anims);
+
+ // If we're waiting for the clown and he finished, evaluate if we're finished
+ if (!anims[0]->isVisible() && (state == kCPStateWaitClown))
+ state = (hasCorrect || (--triesLeft == 0)) ? kCPStateFinish : kCPStateSetup;
+
+ showCursor();
+ fadeIn();
+
+ endFrame(true);
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ checkInput(mouseX, mouseY, mouseButtons);
+
+ if (state == kCPStateWaitUser) {
+ // Look if we clicked a shaped and got it right
+
+ int8 guessedShape = -1;
+ if (mouseButtons == kMouseButtonsLeft)
+ guessedShape = cpFindShape(mouseX, mouseY);
+
+ if (guessedShape >= 0) {
+ hasCorrect = guessedShape == animalShape;
+ animalShape = -1;
+
+ setAnim(*anims[0], kClownAnimations[hasCorrect ? kClownAnimationCheer : kClownAnimationCry]);
+ state = kCPStateWaitClown;
+ }
+ }
+ }
+
+ freeAnims(anims);
+
+ fadeOut();
+ hideCursor();
+ clearScreen();
+
+ // Display the "You are wrong" screen
+ if (!hasCorrect)
+ cpWrong();
+
+ return hasCorrect;
+}
+
+int8 OnceUpon::cpSetup(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4],
+ const Surface sprites[2]) {
+
+ fadeOut();
+ hideCursor();
+
+ // Get a random animal and animal color
+ int8 animalColor = _vm->_util->getRandom(7);
+ while ((colors[animalColor] == 1) || (colors[animalColor] == 7) || (colors[animalColor] == 11))
+ animalColor = _vm->_util->getRandom(7);
+
+ int8 animal = _vm->_util->getRandom(20);
+
+ int8 animalShape = shapes[animalColor * 20 + animal];
+ if (animal < 4)
+ animal = obfuscate[animal];
+
+ // Get the position of the animal sprite
+ int16 animalLeft = (animal % 4) * 80;
+ int16 animalTop = (animal / 4) * 50;
+
+ uint8 sprite = 0;
+ if (animalTop >= 200) {
+ animalTop -= 200;
+ sprite = 1;
+ }
+
+ int16 animalRight = animalLeft + 80 - 1;
+ int16 animalBottom = animalTop + 50 - 1;
+
+ // Fill with the animal color
+ _vm->_draw->_backSurface->fill(colors[animalColor]);
+
+ // Print the help line strings
+ for (uint i = 0; i < kCopyProtectionHelpStringCount; i++) {
+ const char * const helpString = kCopyProtectionHelpStrings[_vm->_global->_language][i];
+
+ const int x = 160 - (strlen(helpString) * _plettre->getCharWidth()) / 2;
+ const int y = i * 10 + 5;
+
+ _plettre->drawString(helpString, x, y, 8, 0, true, *_vm->_draw->_backSurface);
+ }
+
+ // White rectangle with black border
+ _vm->_draw->_backSurface->fillRect( 93, 43, 226, 134, 15);
+ _vm->_draw->_backSurface->drawRect( 92, 42, 227, 135, 0);
+
+ // Draw the animal in the animal color
+ _vm->_draw->_backSurface->fillRect(120, 63, 199, 112, colors[animalColor]);
+ _vm->_draw->_backSurface->blit(sprites[sprite], animalLeft, animalTop, animalRight, animalBottom, 120, 63, 0);
+
+ // Draw the shapes
+ for (uint i = 0; i < kCopyProtectionShapeCount; i++) {
+ const int16 * const coords = kCopyProtectionShapeCoords[i];
+
+ _vm->_draw->_backSurface->blit(sprites[1], coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], 0);
+ }
+
+ _vm->_draw->forceBlit();
+
+ return animalShape;
+}
+
+int8 OnceUpon::cpFindShape(int16 x, int16 y) const {
+ // Look through all shapes and check if the coordinates are inside one of them
+ for (uint i = 0; i < kCopyProtectionShapeCount; i++) {
+ const int16 * const coords = kCopyProtectionShapeCoords[i];
+
+ const int16 left = coords[4];
+ const int16 top = coords[5];
+ const int16 right = coords[4] + (coords[2] - coords[0] + 1) - 1;
+ const int16 bottom = coords[5] + (coords[3] - coords[1] + 1) - 1;
+
+ if ((x >= left) && (x <= right) && (y >= top) && (y <= bottom))
+ return i;
+ }
+
+ return -1;
+}
+
+void OnceUpon::cpWrong() {
+ // Display the "You are wrong" string, centered
+
+ const char * const wrongString = kCopyProtectionWrongStrings[_vm->_global->_language];
+ const int wrongX = 160 - (strlen(wrongString) * _plettre->getCharWidth()) / 2;
+
+ _vm->_draw->_backSurface->clear();
+ _plettre->drawString(wrongString, wrongX, 100, 15, 0, true, *_vm->_draw->_backSurface);
+
+ _vm->_draw->forceBlit();
+
+ fadeIn();
+
+ waitInput();
+
+ fadeOut();
+ clearScreen();
+}
+
+void OnceUpon::showIntro() {
+ // Show all intro parts
+
+ // "Loading"
+ showWait(10);
+ if (_vm->shouldQuit())
+ return;
+
+ // Quote about fairy tales
+ showQuote();
+ if (_vm->shouldQuit())
+ return;
+
+ // Once Upon A Time title
+ showTitle();
+ if (_vm->shouldQuit())
+ return;
+
+ // Game title screen
+ showChapter(0);
+ if (_vm->shouldQuit())
+ return;
+
+ // "Loading"
+ showWait(17);
+}
+
+void OnceUpon::showWait(uint palette) {
+ // Show the loading floppy
+
+ fadeOut();
+ clearScreen();
+ setGamePalette(palette);
+
+ Surface wait(320, 43, 1);
+
+ _vm->_video->drawPackedSprite("wait.cmp", wait);
+ _vm->_draw->_backSurface->blit(wait, 0, 0, 72, 33, 122, 84);
+
+ _vm->_draw->forceBlit();
+
+ fadeIn();
+}
+
+void OnceUpon::showQuote() {
+ // Show the quote about fairytales
+
+ fadeOut();
+ clearScreen();
+ setGamePalette(11);
+
+ static const Font *fonts[3] = { _plettre, _glettre, _plettre };
+
+ TXTFile *quote = loadTXT(getLocFile("gene.tx"), TXTFile::kFormatStringPositionColorFont);
+ quote->draw(*_vm->_draw->_backSurface, fonts, ARRAYSIZE(fonts));
+ delete quote;
+
+ _vm->_draw->forceBlit();
+
+ fadeIn();
+
+ waitInput();
+
+ fadeOut();
+}
+
+const PreGob::AnimProperties OnceUpon::kTitleAnimation = {
+ 8, 0, ANIObject::kModeContinuous, true, false, false, 0, 0
+};
+
+void OnceUpon::showTitle() {
+ fadeOut();
+ setGamePalette(10);
+
+ Title title(_vm);
+ title.play();
+}
+
+void OnceUpon::showChapter(int chapter) {
+ // Display the intro text to a chapter
+
+ fadeOut();
+ clearScreen();
+ setGamePalette(11);
+
+ // Parchment background
+ _vm->_video->drawPackedSprite("parch.cmp", *_vm->_draw->_backSurface);
+
+ static const Font *fonts[3] = { _plettre, _glettre, _plettre };
+
+ const Common::String chapterFile = getLocFile(Common::String::format("gene%d.tx", chapter));
+
+ TXTFile *gameTitle = loadTXT(chapterFile, TXTFile::kFormatStringPositionColorFont);
+ gameTitle->draw(*_vm->_draw->_backSurface, fonts, ARRAYSIZE(fonts));
+ delete gameTitle;
+
+ _vm->_draw->forceBlit();
+
+ fadeIn();
+
+ waitInput();
+
+ fadeOut();
+}
+
+void OnceUpon::showByeBye() {
+ fadeOut();
+ hideCursor();
+ clearScreen();
+ setGamePalette(1);
+
+ _plettre->drawString("Bye Bye....", 140, 80, 2, 0, true, *_vm->_draw->_backSurface);
+ _vm->_draw->forceBlit();
+
+ fadeIn();
+
+ _vm->_util->longDelay(1000);
+
+ fadeOut();
+}
+
+void OnceUpon::doStartMenu(const MenuButton *animalsButton, uint animalCount,
+ const MenuButton *animalButtons, const char * const *animalNames) {
+ clearScreen();
+
+ // Wait until we clicked on of the difficulty buttons and are ready to start playing
+ while (!_vm->shouldQuit()) {
+ MenuAction action = handleStartMenu(animalsButton);
+ if (action == kMenuActionPlay)
+ break;
+
+ // If we pressed the "listen to animal names" button, handle that screen
+ if (action == kMenuActionAnimals)
+ handleAnimalNames(animalCount, animalButtons, animalNames);
+ }
+}
+
+OnceUpon::MenuAction OnceUpon::handleStartMenu(const MenuButton *animalsButton) {
+ ScreenBackup screenBackup;
+ backupScreen(screenBackup, true);
+
+ fadeOut();
+ setGamePalette(17);
+ drawStartMenu(animalsButton);
+ showCursor();
+ fadeIn();
+
+ MenuAction action = kMenuActionNone;
+ while (!_vm->shouldQuit() && (action == kMenuActionNone)) {
+ endFrame(true);
+
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+ if (key == kKeyEscape)
+ // ESC -> Quit
+ return kMenuActionQuit;
+
+ if (mouseButtons != kMouseButtonsLeft)
+ continue;
+
+ playSound(kSoundClick);
+
+ // If we clicked on a difficulty button, show the selected difficulty and start the game
+ int diff = checkButton(kMainMenuDifficultyButton, ARRAYSIZE(kMainMenuDifficultyButton), mouseX, mouseY);
+ if (diff >= 0) {
+ _difficulty = (Difficulty)diff;
+ action = kMenuActionPlay;
+
+ drawStartMenu(animalsButton);
+ _vm->_util->longDelay(1000);
+ }
+
+ if (animalsButton && (checkButton(animalsButton, 1, mouseX, mouseY) != -1))
+ action = kMenuActionAnimals;
+
+ }
+
+ fadeOut();
+ restoreScreen(screenBackup);
+
+ return action;
+}
+
+OnceUpon::MenuAction OnceUpon::handleMainMenu() {
+ ScreenBackup screenBackup;
+ backupScreen(screenBackup, true);
+
+ fadeOut();
+ setGamePalette(17);
+ drawMainMenu();
+ showCursor();
+ fadeIn();
+
+ MenuAction action = kMenuActionNone;
+ while (!_vm->shouldQuit() && (action == kMenuActionNone)) {
+ endFrame(true);
+
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+ if (key == kKeyEscape)
+ // ESC -> Quit
+ return kMenuActionQuit;
+
+ if (mouseButtons != kMouseButtonsLeft)
+ continue;
+
+ playSound(kSoundClick);
+
+ // If we clicked on a difficulty button, change the current difficulty level
+ int diff = checkButton(kMainMenuDifficultyButton, ARRAYSIZE(kMainMenuDifficultyButton), mouseX, mouseY);
+ if ((diff >= 0) && (diff != (int)_difficulty)) {
+ _difficulty = (Difficulty)diff;
+
+ drawMainMenu();
+ }
+
+ // If we clicked on a section button, restart the game from this section
+ int section = checkButton(kSectionButtons, ARRAYSIZE(kSectionButtons), mouseX, mouseY);
+ if ((section >= 0) && (section <= _section)) {
+ _section = section;
+ action = kMenuActionRestart;
+ }
+
+ }
+
+ fadeOut();
+ restoreScreen(screenBackup);
+
+ return action;
+}
+
+OnceUpon::MenuAction OnceUpon::handleIngameMenu() {
+ ScreenBackup screenBackup;
+ backupScreen(screenBackup, true);
+
+ drawIngameMenu();
+ showCursor();
+
+ MenuAction action = kMenuActionNone;
+ while (!_vm->shouldQuit() && (action == kMenuActionNone)) {
+ endFrame(true);
+
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+ if ((key == kKeyEscape) || (mouseButtons == kMouseButtonsRight))
+ // ESC or right mouse button -> Dismiss the menu
+ action = kMenuActionPlay;
+
+ if (mouseButtons != kMouseButtonsLeft)
+ continue;
+
+ int button = checkButton(kIngameButtons, ARRAYSIZE(kIngameButtons), mouseX, mouseY);
+ if (button == 0)
+ action = kMenuActionQuit;
+ else if (button == 1)
+ action = kMenuActionMainMenu;
+ else if (button == 2)
+ action = kMenuActionPlay;
+
+ }
+
+ clearIngameMenu(*screenBackup.screen);
+ restoreScreen(screenBackup);
+
+ return action;
+}
+
+void OnceUpon::drawStartMenu(const MenuButton *animalsButton) {
+ // Draw the background
+ _vm->_video->drawPackedSprite("menu2.cmp", *_vm->_draw->_backSurface);
+
+ // Draw the "Listen to animal names" button
+ if (animalsButton) {
+ Surface elements(320, 38, 1);
+ _vm->_video->drawPackedSprite("elemenu.cmp", elements);
+ _vm->_draw->_backSurface->fillRect(animalsButton->left , animalsButton->top,
+ animalsButton->right, animalsButton->bottom, 0);
+ drawButton(*_vm->_draw->_backSurface, elements, *animalsButton);
+ }
+
+ // Highlight the current difficulty
+ drawMenuDifficulty();
+
+ _vm->_draw->forceBlit();
+}
+
+void OnceUpon::drawMainMenu() {
+ // Draw the background
+ _vm->_video->drawPackedSprite("menu.cmp", *_vm->_draw->_backSurface);
+
+ // Highlight the current difficulty
+ drawMenuDifficulty();
+
+ // Draw the section buttons
+ Surface elements(320, 200, 1);
+ _vm->_video->drawPackedSprite("elemenu.cmp", elements);
+
+ for (uint i = 0; i < ARRAYSIZE(kSectionButtons); i++) {
+ const MenuButton &button = kSectionButtons[i];
+
+ if (!button.needDraw)
+ continue;
+
+ if (_section >= (int)button.id)
+ drawButton(*_vm->_draw->_backSurface, elements, button);
+ }
+
+ _vm->_draw->forceBlit();
+}
+
+void OnceUpon::drawIngameMenu() {
+ Surface menu(320, 34, 1);
+ _vm->_video->drawPackedSprite("icon.cmp", menu);
+
+ // Draw the menu in a special way, button by button
+ for (uint i = 0; i < ARRAYSIZE(kIngameButtons); i++) {
+ const MenuButton &button = kIngameButtons[i];
+
+ drawLineByLine(menu, button.srcLeft, button.srcTop, button.srcRight, button.srcBottom,
+ button.dstX, button.dstY);
+ }
+
+ _vm->_draw->forceBlit();
+ _vm->_video->retrace();
+}
+
+void OnceUpon::drawMenuDifficulty() {
+ if (_difficulty == kDifficultyCount)
+ return;
+
+ TXTFile *difficulties = loadTXT(getLocFile("diffic.tx"), TXTFile::kFormatStringPositionColor);
+
+ // Draw the difficulty name
+ difficulties->draw((uint) _difficulty, *_vm->_draw->_backSurface, &_plettre, 1);
+
+ // Draw a border around the current difficulty
+ drawButtonBorder(kMainMenuDifficultyButton[_difficulty], difficulties->getLines()[_difficulty].color);
+
+ delete difficulties;
+}
+
+void OnceUpon::clearIngameMenu(const Surface &background) {
+ if (_vm->shouldQuit())
+ return;
+
+ // Find the area encompassing the whole ingame menu
+
+ int16 left = 0x7FFF;
+ int16 top = 0x7FFF;
+ int16 right = 0x0000;
+ int16 bottom = 0x0000;
+
+ for (uint i = 0; i < ARRAYSIZE(kIngameButtons); i++) {
+ const MenuButton &button = kIngameButtons[i];
+
+ if (!button.needDraw)
+ continue;
+
+ left = MIN<int16>(left , button.dstX);
+ top = MIN<int16>(top , button.dstY);
+ right = MAX<int16>(right , button.dstX + (button.srcRight - button.srcLeft + 1) - 1);
+ bottom = MAX<int16>(bottom, button.dstY + (button.srcBottom - button.srcTop + 1) - 1);
+ }
+
+ if ((left > right) || (top > bottom))
+ return;
+
+ // Clear it line by line
+ drawLineByLine(background, left, top, right, bottom, left, top);
+}
+
+OnceUpon::MenuAction OnceUpon::doIngameMenu() {
+ // Show the ingame menu
+ MenuAction action = handleIngameMenu();
+
+ if ((action == kMenuActionQuit) || _vm->shouldQuit()) {
+
+ // User pressed the quit button, or quit ScummVM
+ _quit = true;
+ action = kMenuActionQuit;
+
+ } else if (action == kMenuActionPlay) {
+
+ // User pressed the return to game button
+ action = kMenuActionPlay;
+
+ } else if (kMenuActionMainMenu) {
+
+ // User pressed the return to main menu button
+ action = handleMainMenu();
+ }
+
+ return action;
+}
+
+OnceUpon::MenuAction OnceUpon::doIngameMenu(int16 &key, MouseButtons &mouseButtons) {
+ if ((key != kKeyEscape) && (mouseButtons != kMouseButtonsRight))
+ return kMenuActionNone;
+
+ key = 0;
+ mouseButtons = kMouseButtonsNone;
+
+ MenuAction action = doIngameMenu();
+ if (action == kMenuActionPlay)
+ action = kMenuActionNone;
+
+ return action;
+}
+
+int OnceUpon::checkButton(const MenuButton *buttons, uint count, int16 x, int16 y, int failValue) const {
+ // Look through all buttons, and return the ID of the button we're in
+
+ for (uint i = 0; i < count; i++) {
+ const MenuButton &button = buttons[i];
+
+ if ((x >= button.left) && (x <= button.right) && (y >= button.top) && (y <= button.bottom))
+ return (int)button.id;
+ }
+
+ // We're in none of these buttons, return the fail value
+ return failValue;
+}
+
+void OnceUpon::drawButton(Surface &dest, const Surface &src, const MenuButton &button, int transp) const {
+ dest.blit(src, button.srcLeft, button.srcTop, button.srcRight, button.srcBottom, button.dstX, button.dstY, transp);
+}
+
+void OnceUpon::drawButtons(Surface &dest, const Surface &src, const MenuButton *buttons, uint count, int transp) const {
+ for (uint i = 0; i < count; i++) {
+ const MenuButton &button = buttons[i];
+
+ if (!button.needDraw)
+ continue;
+
+ drawButton(dest, src, button, transp);
+ }
+}
+
+void OnceUpon::drawButtonBorder(const MenuButton &button, uint8 color) {
+ _vm->_draw->_backSurface->drawRect(button.left, button.top, button.right, button.bottom, color);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, button.left, button.top, button.right, button.bottom);
+}
+
+enum AnimalNamesState {
+ kANStateChoose, // We're in the animal chooser
+ kANStateNames, // We're in the language chooser
+ kANStateFinish // We're finished
+};
+
+void OnceUpon::handleAnimalNames(uint count, const MenuButton *buttons, const char * const *names) {
+ fadeOut();
+ clearScreen();
+ setGamePalette(19);
+
+ bool cursorVisible = isCursorVisible();
+
+ // Set the cursor
+ addCursor();
+ setGameCursor();
+
+ anSetupChooser();
+
+ int8 _animal = -1;
+
+ AnimalNamesState state = kANStateChoose;
+ while (!_vm->shouldQuit() && (state != kANStateFinish)) {
+ showCursor();
+ fadeIn();
+
+ endFrame(true);
+
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ checkInput(mouseX, mouseY, mouseButtons);
+
+ // If we moused over an animal button, draw a border around it
+ int animal = checkButton(buttons, count, mouseX, mouseY);
+ if ((state == kANStateChoose) && (animal != _animal)) {
+ // Erase the old border
+ if (_animal >= 0)
+ drawButtonBorder(buttons[_animal], 15);
+
+ _animal = animal;
+
+ // Draw the new border
+ if (_animal >= 0)
+ drawButtonBorder(buttons[_animal], 10);
+ }
+
+ if (mouseButtons != kMouseButtonsLeft)
+ continue;
+
+ playSound(kSoundClick);
+
+ // We clicked on a language button, play the animal name
+ int language = checkButton(kLanguageButtons, ARRAYSIZE(kLanguageButtons), mouseX, mouseY);
+ if ((state == kANStateNames) && (language >= 0))
+ anPlayAnimalName(names[_animal], language);
+
+ // We clicked on an animal
+ if ((state == kANStateChoose) && (_animal >= 0)) {
+ anSetupNames(buttons[_animal]);
+
+ state = kANStateNames;
+ }
+
+ // If we clicked on the back button, go back
+ if (checkButton(&kAnimalNamesBack, 1, mouseX, mouseY) != -1) {
+ if (state == kANStateNames) {
+ anSetupChooser();
+
+ state = kANStateChoose;
+ } else if (state == kANStateChoose)
+ state = kANStateFinish;
+ }
+ }
+
+ fadeOut();
+
+ // Restore the cursor
+ if (!cursorVisible)
+ hideCursor();
+ removeCursor();
+}
+
+void OnceUpon::anSetupChooser() {
+ fadeOut();
+
+ _vm->_video->drawPackedSprite("dico.cmp", *_vm->_draw->_backSurface);
+
+ // Draw the back button
+ Surface menu(320, 34, 1);
+ _vm->_video->drawPackedSprite("icon.cmp", menu);
+ drawButton(*_vm->_draw->_backSurface, menu, kAnimalNamesBack);
+
+ // "Choose an animal"
+ TXTFile *choose = loadTXT(getLocFile("choisi.tx"), TXTFile::kFormatStringPosition);
+ choose->draw(*_vm->_draw->_backSurface, &_plettre, 1, 14);
+ delete choose;
+
+ _vm->_draw->forceBlit();
+}
+
+void OnceUpon::anSetupNames(const MenuButton &animal) {
+ fadeOut();
+
+ Surface background(320, 200, 1);
+
+ _vm->_video->drawPackedSprite("dico.cmp", background);
+
+ // Draw the background and clear what we don't need
+ _vm->_draw->_backSurface->blit(background);
+ _vm->_draw->_backSurface->fillRect(19, 19, 302, 186, 15);
+
+ // Draw the back button
+ Surface menu(320, 34, 1);
+ _vm->_video->drawPackedSprite("icon.cmp", menu);
+ drawButton(*_vm->_draw->_backSurface, menu, kAnimalNamesBack);
+
+ // Draw the animal
+ drawButton(*_vm->_draw->_backSurface, background, animal);
+
+ // Draw the language buttons
+ Surface elements(320, 200, 1);
+ _vm->_video->drawPackedSprite("elemenu.cmp", elements);
+ drawButtons(*_vm->_draw->_backSurface, elements, kLanguageButtons, ARRAYSIZE(kLanguageButtons));
+
+ // Draw the language names
+ _plettre->drawString("Fran\207ais", 43, 70, 10, 15, true, *_vm->_draw->_backSurface);
+ _plettre->drawString("Deutsch" , 136, 70, 10, 15, true, *_vm->_draw->_backSurface);
+ _plettre->drawString("English" , 238, 70, 10, 15, true, *_vm->_draw->_backSurface);
+ _plettre->drawString("Italiano" , 43, 128, 10, 15, true, *_vm->_draw->_backSurface);
+ _plettre->drawString("Espa\244ol" , 136, 128, 10, 15, true, *_vm->_draw->_backSurface);
+ _plettre->drawString("English" , 238, 128, 10, 15, true, *_vm->_draw->_backSurface);
+
+ _vm->_draw->forceBlit();
+}
+
+void OnceUpon::anPlayAnimalName(const Common::String &animal, uint language) {
+ // Sound file to play
+ Common::String soundFile = animal + "_" + kLanguageSuffixLong[language] + ".snd";
+
+ // Get the name of the animal
+ TXTFile *names = loadTXT(animal + ".anm", TXTFile::kFormatString);
+ Common::String name = names->getLines()[language].text;
+ delete names;
+
+ // It should be centered on the screen
+ const int nameX = 160 - (name.size() * _plettre->getCharWidth()) / 2;
+
+ // Backup the screen surface
+ Surface backup(162, 23, 1);
+ backup.blit(*_vm->_draw->_backSurface, 78, 123, 239, 145, 0, 0);
+
+ // Draw the name border
+ Surface nameBorder(162, 23, 1);
+ _vm->_video->drawPackedSprite("mot.cmp", nameBorder);
+ _vm->_draw->_backSurface->blit(nameBorder, 0, 0, 161, 22, 78, 123);
+
+ // Print the animal name
+ _plettre->drawString(name, nameX, 129, 10, 0, true, *_vm->_draw->_backSurface);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 78, 123, 239, 145);
+
+ playSoundFile(soundFile);
+
+ // Restore the screen
+ _vm->_draw->_backSurface->blit(backup, 0, 0, 161, 22, 78, 123);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 78, 123, 239, 145);
+}
+
+void OnceUpon::playGame() {
+ while (!_vm->shouldQuit() && !_quit) {
+ // Play a section and advance to the next section if we finished it
+ if (playSection())
+ _section = MIN(_section + 1, kSectionCount - 1);
+ }
+
+ // If we quit through the game and not through ScummVM, show the "Bye Bye" screen
+ if (!_vm->shouldQuit())
+ showByeBye();
+}
+
+bool OnceUpon::playSection() {
+ if ((_section < 0) || (_section >= ARRAYSIZE(kSectionFuncs))) {
+ _quit = true;
+ return false;
+ }
+
+ return (this->*kSectionFuncs[_section])();
+}
+
+const PreGob::AnimProperties OnceUpon::kSectionStorkAnimations[] = {
+ { 0, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 1, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 2, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 3, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 4, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 5, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 6, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 7, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 8, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ {17, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ {16, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ {15, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}
+};
+
+enum StorkState {
+ kStorkStateWaitUser,
+ kStorkStateWaitBundle,
+ kStorkStateFinish
+};
+
+bool OnceUpon::sectionStork() {
+ fadeOut();
+ hideCursor();
+ setGamePalette(0);
+ setGameCursor();
+
+ const StorkParam &param = getStorkParameters();
+
+ Surface backdrop(320, 200, 1);
+
+ // Draw the frame
+ _vm->_video->drawPackedSprite("cadre.cmp", *_vm->_draw->_backSurface);
+
+ // Draw the backdrop
+ _vm->_video->drawPackedSprite(param.backdrop, backdrop);
+ _vm->_draw->_backSurface->blit(backdrop, 0, 0, 288, 175, 16, 12);
+
+ // "Where does the stork go?"
+ TXTFile *whereStork = loadTXT(getLocFile("ouva.tx"), TXTFile::kFormatStringPositionColor);
+ whereStork->draw(*_vm->_draw->_backSurface, &_plettre, 1);
+
+ // Where the stork actually goes
+ GCTFile *thereStork = loadGCT(getLocFile("choix.gc"));
+ thereStork->setArea(17, 18, 303, 41);
+
+ ANIFile ani(_vm, "present.ani", 320);
+ ANIList anims;
+
+ Stork *stork = new Stork(_vm, ani);
+
+ loadAnims(anims, ani, ARRAYSIZE(kSectionStorkAnimations), kSectionStorkAnimations);
+ anims.push_back(stork);
+
+ drawAnim(anims);
+
+ _vm->_draw->forceBlit();
+
+ int8 storkSoundWait = 0;
+
+ StorkState state = kStorkStateWaitUser;
+ MenuAction action = kMenuActionNone;
+ while (!_vm->shouldQuit() && (state != kStorkStateFinish)) {
+ // Play the stork sound
+ if (--storkSoundWait == 0)
+ playSound(kSoundStork);
+ if (storkSoundWait <= 0)
+ storkSoundWait = 50 - _vm->_util->getRandom(30);
+
+ // Check if the bundle landed
+ if ((state == kStorkStateWaitBundle) && stork->hasBundleLanded())
+ state = kStorkStateFinish;
+
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+
+ action = doIngameMenu(key, mouseButtons);
+ if (action != kMenuActionNone) {
+ state = kStorkStateFinish;
+ break;
+ }
+
+ clearAnim(anims);
+
+ if (mouseButtons == kMouseButtonsLeft) {
+ stopSound();
+ playSound(kSoundClick);
+
+ int house = checkButton(param.houses, param.houseCount, mouseX, mouseY);
+ if ((state == kStorkStateWaitUser) && (house >= 0)) {
+
+ _house = house;
+
+ stork->dropBundle(param.drops[house]);
+ state = kStorkStateWaitBundle;
+
+ // Remove the "Where does the stork go?" text
+ int16 left, top, right, bottom;
+ if (whereStork->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ // Print the text where the stork actually goes
+ thereStork->selectLine(3, house); // The house
+ thereStork->selectLine(4, house); // The house's inhabitants
+ if (thereStork->draw(*_vm->_draw->_backSurface, 2, *_plettre, 10, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ }
+ }
+
+ drawAnim(anims);
+ showCursor();
+ fadeIn();
+
+ endFrame(true);
+ }
+
+ freeAnims(anims);
+ delete thereStork;
+ delete whereStork;
+
+ fadeOut();
+ hideCursor();
+
+ // Didn't complete the section
+ if (action != kMenuActionNone)
+ return false;
+
+ // Move on to the character generator
+
+ CharGenAction charGenAction = kCharGenRestart;
+ while (charGenAction == kCharGenRestart)
+ charGenAction = characterGenerator();
+
+ // Did we successfully create a character?
+ return charGenAction == kCharGenDone;
+}
+
+const OnceUpon::MenuButton OnceUpon::kCharGenHeadButtons[] = {
+ {true, 106, 146, 152, 180, 0, 0, 47, 34, 106, 146, 0},
+ {true, 155, 146, 201, 180, 49, 0, 96, 34, 155, 146, 1},
+ {true, 204, 146, 250, 180, 98, 0, 145, 34, 204, 146, 2},
+ {true, 253, 146, 299, 180, 147, 0, 194, 34, 253, 146, 3}
+};
+
+const OnceUpon::MenuButton OnceUpon::kCharGenHeads[] = {
+ {true, 0, 0, 0, 0, 29, 4, 68, 31, 40, 51, 0},
+ {true, 0, 0, 0, 0, 83, 4, 113, 31, 45, 51, 1},
+ {true, 0, 0, 0, 0, 132, 4, 162, 31, 45, 51, 2},
+ {true, 0, 0, 0, 0, 182, 4, 211, 31, 45, 51, 3}
+};
+
+const OnceUpon::MenuButton OnceUpon::kCharGenHairButtons[] = {
+ {true, 105, 55, 124, 70, 271, 1, 289, 15, 105, 55, 0x04},
+ {true, 105, 74, 124, 89, 271, 20, 289, 34, 105, 74, 0x07}
+};
+
+const OnceUpon::MenuButton OnceUpon::kCharGenJacketButtons[] = {
+ {true, 105, 90, 124, 105, 271, 39, 289, 53, 105, 90, 0x06},
+ {true, 105, 109, 124, 124, 271, 58, 289, 72, 105, 109, 0x02}
+};
+
+const OnceUpon::MenuButton OnceUpon::kCharGenTrousersButtons[] = {
+ {true, 105, 140, 124, 155, 271, 77, 289, 91, 105, 140, 0x01},
+ {true, 105, 159, 124, 174, 271, 96, 289, 110, 105, 159, 0x03}
+};
+
+const OnceUpon::MenuButton OnceUpon::kCharGenNameEntry[] = {
+ {true, 0, 0, 0, 0, 0, 38, 54, 48, 140, 145, 0},
+ {true, 0, 0, 0, 0, 106, 38, 159, 48, 195, 145, 0},
+ {true, 0, 0, 0, 0, 0, 105, 54, 121, 140, 156, 0},
+ {true, 0, 0, 0, 0, 106, 105, 159, 121, 195, 156, 0}
+};
+
+enum CharGenState {
+ kCharGenStateHead = 0, // Choose a head
+ kCharGenStateHair , // Choose hair color
+ kCharGenStateJacket , // Choose jacket color
+ kCharGenStateTrousers , // Choose trousers color
+ kCharGenStateName , // Choose name
+ kCharGenStateSure , // "Are you sure?"
+ kCharGenStateStoryName , // "We're going to tell the story of $NAME"
+ kCharGenStateFinish // Finished
+};
+
+void OnceUpon::charGenSetup(uint stage) {
+ Surface choix(320, 200, 1), elchoix(320, 200, 1), paperDoll(65, 137, 1);
+
+ _vm->_video->drawPackedSprite("choix.cmp" , choix);
+ _vm->_video->drawPackedSprite("elchoix.cmp", elchoix);
+
+ paperDoll.blit(choix, 200, 0, 264, 136, 0, 0);
+
+ GCTFile *text = loadGCT(getLocFile("choix.gc"));
+ text->setArea(17, 18, 303, 41);
+ text->setText(9, _name);
+
+ // Background
+ _vm->_video->drawPackedSprite("cadre.cmp", *_vm->_draw->_backSurface);
+ _vm->_draw->_backSurface->fillRect(16, 50, 303, 187, 5);
+
+ // Character sprite frame
+ _vm->_draw->_backSurface->blit(choix, 0, 38, 159, 121, 140, 54);
+
+ // Recolor the paper doll parts
+ if (_colorHair != 0xFF)
+ elchoix.recolor(0x0C, _colorHair);
+
+ if (_colorJacket != 0xFF)
+ paperDoll.recolor(0x0A, _colorJacket);
+
+ if (_colorTrousers != 0xFF)
+ paperDoll.recolor(0x09, _colorTrousers);
+
+ _vm->_draw->_backSurface->blit(paperDoll, 32, 51);
+
+ // Paper doll head
+ if (_head != 0xFF)
+ drawButton(*_vm->_draw->_backSurface, elchoix, kCharGenHeads[_head], 0);
+
+ if (stage == kCharGenStateHead) {
+ // Head buttons
+ drawButtons(*_vm->_draw->_backSurface, choix, kCharGenHeadButtons, ARRAYSIZE(kCharGenHeadButtons));
+
+ // "Choose a head"
+ int16 left, top, right, bottom;
+ text->draw(*_vm->_draw->_backSurface, 5, *_plettre, 10, left, top, right, bottom);
+
+ } else if (stage == kCharGenStateHair) {
+ // Hair color buttons
+ drawButtons(*_vm->_draw->_backSurface, choix, kCharGenHairButtons, ARRAYSIZE(kCharGenHairButtons));
+
+ // "What color is the hair?"
+ int16 left, top, right, bottom;
+ text->draw(*_vm->_draw->_backSurface, 6, *_plettre, 10, left, top, right, bottom);
+
+ } else if (stage == kCharGenStateJacket) {
+ // Jacket color buttons
+ drawButtons(*_vm->_draw->_backSurface, choix, kCharGenJacketButtons, ARRAYSIZE(kCharGenJacketButtons));
+
+ // "What color is the jacket?"
+ int16 left, top, right, bottom;
+ text->draw(*_vm->_draw->_backSurface, 7, *_plettre, 10, left, top, right, bottom);
+
+ } else if (stage == kCharGenStateTrousers) {
+ // Trousers color buttons
+ drawButtons(*_vm->_draw->_backSurface, choix, kCharGenTrousersButtons, ARRAYSIZE(kCharGenTrousersButtons));
+
+ // "What color are the trousers?"
+ int16 left, top, right, bottom;
+ text->draw(*_vm->_draw->_backSurface, 8, *_plettre, 10, left, top, right, bottom);
+
+ } else if (stage == kCharGenStateName) {
+ // Name entry field
+ drawButtons(*_vm->_draw->_backSurface, choix, kCharGenNameEntry, ARRAYSIZE(kCharGenNameEntry));
+
+ // "Enter name"
+ int16 left, top, right, bottom;
+ text->draw(*_vm->_draw->_backSurface, 10, *_plettre, 10, left, top, right, bottom);
+
+ charGenDrawName();
+ } else if (stage == kCharGenStateSure) {
+ // Name entry field
+ drawButtons(*_vm->_draw->_backSurface, choix, kCharGenNameEntry, ARRAYSIZE(kCharGenNameEntry));
+
+ // "Are you sure?"
+ TXTFile *sure = loadTXT(getLocFile("estu.tx"), TXTFile::kFormatStringPositionColor);
+ sure->draw(*_vm->_draw->_backSurface, &_plettre, 1);
+ delete sure;
+
+ charGenDrawName();
+ } else if (stage == kCharGenStateStoryName) {
+
+ // "We're going to tell the story of $NAME"
+ int16 left, top, right, bottom;
+ text->draw(*_vm->_draw->_backSurface, 11, *_plettre, 10, left, top, right, bottom);
+ }
+
+ delete text;
+}
+
+bool OnceUpon::enterString(Common::String &name, int16 key, uint maxLength, const Font &font) {
+ if (key == 0)
+ return true;
+
+ if (key == kKeyBackspace) {
+ name.deleteLastChar();
+ return true;
+ }
+
+ if (key == kKeySpace)
+ key = ' ';
+
+ if ((key >= ' ') && (key <= 0xFF)) {
+ if (name.size() >= maxLength)
+ return false;
+
+ if (!font.hasChar(key))
+ return false;
+
+ name += (char) key;
+ return true;
+ }
+
+ return false;
+}
+
+void OnceUpon::charGenDrawName() {
+ _vm->_draw->_backSurface->fillRect(147, 151, 243, 166, 1);
+
+ const int16 nameY = 151 + ((166 - 151 + 1 - _plettre->getCharHeight()) / 2);
+ const int16 nameX = 147 + ((243 - 147 + 1 - (15 * _plettre->getCharWidth ())) / 2);
+
+ _plettre->drawString(_name, nameX, nameY, 10, 0, true, *_vm->_draw->_backSurface);
+
+ const int16 cursorLeft = nameX + _name.size() * _plettre->getCharWidth();
+ const int16 cursorTop = nameY;
+ const int16 cursorRight = cursorLeft + _plettre->getCharWidth() - 1;
+ const int16 cursorBottom = cursorTop + _plettre->getCharHeight() - 1;
+
+ _vm->_draw->_backSurface->fillRect(cursorLeft, cursorTop, cursorRight, cursorBottom, 10);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 151, 243, 166);
+}
+
+OnceUpon::CharGenAction OnceUpon::characterGenerator() {
+ fadeOut();
+ hideCursor();
+ setGameCursor();
+
+ showWait(1);
+
+ _name.clear();
+
+ _head = 0xFF;
+ _colorHair = 0xFF;
+ _colorJacket = 0xFF;
+ _colorTrousers = 0xFF;
+
+ CharGenState state = kCharGenStateHead;
+ charGenSetup(state);
+
+ ANIFile ani(_vm, "ba.ani", 320);
+
+ ani.recolor(0x0F, 0x0C);
+ ani.recolor(0x0E, 0x0A);
+ ani.recolor(0x08, 0x09);
+
+ CharGenChild *child = new CharGenChild(ani);
+
+ ANIList anims;
+ anims.push_back(child);
+
+ fadeOut();
+ _vm->_draw->forceBlit();
+
+ CharGenAction action = kCharGenRestart;
+ while (!_vm->shouldQuit() && (state != kCharGenStateFinish)) {
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+
+ MenuAction menuAction = doIngameMenu(key, mouseButtons);
+ if (menuAction != kMenuActionNone) {
+ state = kCharGenStateFinish;
+ action = kCharGenAbort;
+ break;
+ }
+
+ clearAnim(anims);
+
+ if (state == kCharGenStateStoryName) {
+ if ((mouseButtons != kMouseButtonsNone) || (key != 0)) {
+ state = kCharGenStateFinish;
+ action = kCharGenDone;
+ break;
+ }
+ }
+
+ if (state == kCharGenStateSure) {
+ // Not sure => restart
+ if ((key == 'N') || (key == 'n')) { // No / Nein / Non
+ state = kCharGenStateFinish;
+ action = kCharGenRestart;
+ break;
+ }
+
+ if ((key == 'Y') || (key == 'y') || // Yes
+ (key == 'J') || (key == 'j') || // Ja
+ (key == 'S') || (key == 's') || // Si
+ (key == 'O') || (key == 'o')) { // Oui
+
+ state = kCharGenStateStoryName;
+ charGenSetup(state);
+ _vm->_draw->forceBlit();
+ }
+ }
+
+ if (state == kCharGenStateName) {
+ if (enterString(_name, key, 14, *_plettre)) {
+ _vm->_draw->_backSurface->fillRect(147, 151, 243, 166, 1);
+
+ const int16 nameY = 151 + ((166 - 151 + 1 - _plettre->getCharHeight()) / 2);
+ const int16 nameX = 147 + ((243 - 147 + 1 - (15 * _plettre->getCharWidth ())) / 2);
+
+ _plettre->drawString(_name, nameX, nameY, 10, 0, true, *_vm->_draw->_backSurface);
+
+ const int16 cursorLeft = nameX + _name.size() * _plettre->getCharWidth();
+ const int16 cursorTop = nameY;
+ const int16 cursorRight = cursorLeft + _plettre->getCharWidth() - 1;
+ const int16 cursorBottom = cursorTop + _plettre->getCharHeight() - 1;
+
+ _vm->_draw->_backSurface->fillRect(cursorLeft, cursorTop, cursorRight, cursorBottom, 10);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 151, 243, 166);
+ }
+
+ if ((key == kKeyReturn) && !_name.empty()) {
+ _name.trim();
+ _name.setChar(Util::toCP850Upper(_name[0]), 0);
+
+ state = kCharGenStateSure;
+ charGenSetup(state);
+ _vm->_draw->forceBlit();
+ }
+ }
+
+ if (mouseButtons == kMouseButtonsLeft) {
+ stopSound();
+ playSound(kSoundClick);
+
+ int trousers = checkButton(kCharGenTrousersButtons, ARRAYSIZE(kCharGenTrousersButtons), mouseX, mouseY);
+ if ((state == kCharGenStateTrousers) && (trousers >= 0)) {
+ _colorTrousers = trousers;
+
+ ani.recolor(0x09, _colorTrousers);
+
+ state = kCharGenStateName;
+ charGenSetup(state);
+ _vm->_draw->forceBlit();
+ }
+
+ int jacket = checkButton(kCharGenJacketButtons, ARRAYSIZE(kCharGenJacketButtons), mouseX, mouseY);
+ if ((state == kCharGenStateJacket) && (jacket >= 0)) {
+ _colorJacket = jacket;
+
+ ani.recolor(0x0A, _colorJacket);
+
+ state = kCharGenStateTrousers;
+ charGenSetup(state);
+ _vm->_draw->forceBlit();
+ }
+
+ int hair = checkButton(kCharGenHairButtons, ARRAYSIZE(kCharGenHairButtons), mouseX, mouseY);
+ if ((state == kCharGenStateHair) && (hair >= 0)) {
+ _colorHair = hair;
+
+ ani.recolor(0x0C, _colorHair);
+
+ state = kCharGenStateJacket;
+ charGenSetup(state);
+ _vm->_draw->forceBlit();
+ }
+
+ int head = checkButton(kCharGenHeadButtons, ARRAYSIZE(kCharGenHeadButtons), mouseX, mouseY);
+ if ((state == kCharGenStateHead) && (head >= 0)) {
+ _head = head;
+
+ state = kCharGenStateHair;
+ charGenSetup(state);
+ _vm->_draw->forceBlit();
+ }
+ }
+
+ drawAnim(anims);
+
+ // Play the child sounds
+ CharGenChild::Sound childSound = child->shouldPlaySound();
+ if (childSound == CharGenChild::kSoundWalk) {
+ beep(50, 10);
+ } else if (childSound == CharGenChild::kSoundJump) {
+ stopSound();
+ playSound(kSoundJump);
+ }
+
+ showCursor();
+ fadeIn();
+
+ endFrame(true);
+ }
+
+ fadeOut();
+ hideCursor();
+
+ freeAnims(anims);
+
+ if (_vm->shouldQuit())
+ return kCharGenAbort;
+
+ return action;
+}
+
+bool OnceUpon::sectionChapter1() {
+ showChapter(1);
+ return true;
+}
+
+bool OnceUpon::sectionParents() {
+ fadeOut();
+ setGamePalette(14);
+ clearScreen();
+
+ const Common::String seq = ((_house == 1) || (_house == 2)) ? "parents.seq" : "parents2.seq";
+ const Common::String gct = getLocFile("mefait.gc");
+
+ Parents parents(_vm, seq, gct, _name, _house, *_plettre, kGamePalettes[14], kGamePalettes[13], kPaletteSize);
+ parents.play();
+
+ warning("OnceUpon::sectionParents(): TODO: Item search");
+ return true;
+}
+
+bool OnceUpon::sectionChapter2() {
+ showChapter(2);
+ return true;
+}
+
+bool OnceUpon::sectionForest0() {
+ warning("OnceUpon::sectionForest0(): TODO");
+ return true;
+}
+
+bool OnceUpon::sectionChapter3() {
+ showChapter(3);
+ return true;
+}
+
+bool OnceUpon::sectionEvilCastle() {
+ warning("OnceUpon::sectionEvilCastle(): TODO");
+ return true;
+}
+
+bool OnceUpon::sectionChapter4() {
+ showChapter(4);
+ return true;
+}
+
+bool OnceUpon::sectionForest1() {
+ warning("OnceUpon::sectionForest1(): TODO");
+ return true;
+}
+
+bool OnceUpon::sectionChapter5() {
+ showChapter(5);
+ return true;
+}
+
+bool OnceUpon::sectionBossFight() {
+ warning("OnceUpon::sectionBossFight(): TODO");
+ return true;
+}
+
+bool OnceUpon::sectionChapter6() {
+ showChapter(6);
+ return true;
+}
+
+bool OnceUpon::sectionForest2() {
+ warning("OnceUpon::sectionForest2(): TODO");
+ return true;
+}
+
+bool OnceUpon::sectionChapter7() {
+ showChapter(7);
+ return true;
+}
+
+const PreGob::AnimProperties OnceUpon::kSectionEndAnimations[] = {
+ { 0, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 6, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ { 9, 0, ANIObject::kModeContinuous, true, false, false, 0, 0},
+ {11, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}
+};
+
+bool OnceUpon::sectionEnd() {
+ fadeOut();
+ setGamePalette(9);
+
+ _vm->_video->drawPackedSprite("cadre.cmp", *_vm->_draw->_backSurface);
+
+ Surface endBackground(320, 200, 1);
+ _vm->_video->drawPackedSprite("fin.cmp", endBackground);
+
+ _vm->_draw->_backSurface->blit(endBackground, 0, 0, 288, 137, 16, 50);
+
+ GCTFile *endText = loadGCT(getLocFile("final.gc"));
+ endText->setArea(17, 18, 303, 41);
+ endText->setText(1, _name);
+
+ ANIFile ani(_vm, "fin.ani", 320);
+ ANIList anims;
+
+ loadAnims(anims, ani, ARRAYSIZE(kSectionEndAnimations), kSectionEndAnimations);
+ drawAnim(anims);
+
+ _vm->_draw->forceBlit();
+
+ uint32 textStartTime = 0;
+
+ MenuAction action = kMenuActionNone;
+ while (!_vm->shouldQuit() && (action == kMenuActionNone)) {
+ // Check user input
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+
+ action = doIngameMenu(key, mouseButtons);
+ if (action != kMenuActionNone)
+ break;
+
+ clearAnim(anims);
+
+ // Pressed a key or mouse button => Skip to next area-full of text
+ if ((mouseButtons == kMouseButtonsLeft) || (key != 0))
+ textStartTime = 0;
+
+ // Draw the next area-full of text
+ uint32 now = _vm->_util->getTimeKey();
+ if (!endText->finished() && ((textStartTime == 0) || (now >= (textStartTime + kGCTDelay)))) {
+ textStartTime = now;
+
+ int16 left, top, right, bottom;
+ if (endText->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ if (endText->draw(*_vm->_draw->_backSurface, 0, *_plettre, 10, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ }
+
+ drawAnim(anims);
+ fadeIn();
+
+ endFrame(true);
+ }
+
+ freeAnims(anims);
+ delete endText;
+
+ // Restart requested
+ if (action == kMenuActionRestart)
+ return false;
+
+ // Last scene. Even if we didn't explicitly request a quit, the game ends here
+ _quit = true;
+ return false;
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h
new file mode 100644
index 0000000000..66ef877618
--- /dev/null
+++ b/engines/gob/pregob/onceupon/onceupon.h
@@ -0,0 +1,344 @@
+/* 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_PREGOB_ONCEUPON_ONCEUPON_H
+#define GOB_PREGOB_ONCEUPON_ONCEUPON_H
+
+#include "common/system.h"
+#include "common/str.h"
+
+#include "gob/pregob/pregob.h"
+
+#include "gob/pregob/onceupon/stork.h"
+
+namespace Gob {
+
+class Surface;
+class Font;
+
+class ANIObject;
+
+namespace OnceUpon {
+
+class OnceUpon : public PreGob {
+public:
+ /** Number of languages we support. */
+ static const uint kLanguageCount = 5;
+
+
+ OnceUpon(GobEngine *vm);
+ ~OnceUpon();
+
+
+protected:
+ /** A description of a menu button. */
+ struct MenuButton {
+ bool needDraw; ///< Does the button need drawing?
+
+ int16 left; ///< Left coordinate of the button.
+ int16 top; ///< Top coordinate of the button.
+ int16 right; ///< Right coordinate of the button.
+ int16 bottom; ///< Bottom coordinate of the button.
+
+ int16 srcLeft; ///< Left coordinate of the button's sprite.
+ int16 srcTop; ///< Top coordinate of the button's sprite.
+ int16 srcRight; ///< Right coordinate of the button's sprite.
+ int16 srcBottom; ///< Right coordinate of the button's sprite.
+
+ int16 dstX; ///< Destination X coordinate of the button's sprite.
+ int16 dstY; ///< Destination Y coordinate of the button's sprite.
+
+ uint id; ///< The button's ID.
+ };
+
+ /** Parameters for the stork section. */
+ struct StorkParam {
+ const char *backdrop; ///< Backdrop image file.
+
+ uint houseCount; ///< Number of houses.
+ const MenuButton *houses; ///< House button definitions.
+
+ const Stork::BundleDrop *drops; ///< The bundle drop parameters.
+ };
+
+ void init();
+ void deinit();
+
+ /** Handle the copy protection.
+ *
+ * @param colors Colors the copy protection animals can be.
+ * @param shapes The shape that's the correct answer for each animal in each color.
+ * @param obfuscate Extra obfuscate table. correctShape = shapes[colors][obfuscate[animal]].
+ * @return true if the user guessed the correct shape, false otherwise.
+ */
+ bool doCopyProtection(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4]);
+
+ /** Show the intro. */
+ void showIntro();
+
+ /** Handle the start menu.
+ *
+ * @param animalsButton Definition of the menu button that leads to the animal names screen. Can be 0.
+ * @param animalCount Number of animals in the animal names screen.
+ * @param animalButtons Definition of the buttons that make up the animals in the animal names screen.
+ * @param animalNames File prefixes for the name of each animal.
+ */
+ void doStartMenu(const MenuButton *animalsButton, uint animalCount,
+ const MenuButton *animalButtons, const char * const *animalNames);
+
+ /** Play the game proper. */
+ void playGame();
+
+
+ /** Return the parameters for the stork section. */
+ virtual const StorkParam &getStorkParameters() const = 0;
+
+
+private:
+ /** All actions a user can request in a menu. */
+ enum MenuAction {
+ kMenuActionNone = 0, ///< No action.
+ kMenuActionAnimals , ///< Do the animal names.
+ kMenuActionPlay , ///< Play the game.
+ kMenuActionRestart , ///< Restart the section.
+ kMenuActionMainMenu, ///< Go to the main menu.
+ kMenuActionQuit ///< Quit the game.
+ };
+
+ /** Difficulty levels. */
+ enum Difficulty {
+ kDifficultyBeginner = 0,
+ kDifficultyIntermediate = 1,
+ kDifficultyAdvanced = 2,
+ kDifficultyCount
+ };
+
+ /** The different sounds common in the game. */
+ enum Sound {
+ kSoundClick = 0,
+ kSoundStork ,
+ kSoundJump ,
+ kSoundCount
+ };
+
+ /** Action the character generation wants us to take. */
+ enum CharGenAction {
+ kCharGenDone = 0, ///< Created a character, move on.
+ kCharGenAbort , ///< Aborted the character generation.
+ kCharGenRestart ///< Restart the character generation.
+ };
+
+ /** A complete screen backup. */
+ struct ScreenBackup {
+ Surface *screen; ///< Screen contents.
+ int palette; ///< Screen palette.
+
+ bool changedCursor; ///< Did we change the cursor?
+ bool cursorVisible; ///< Was the cursor visible?
+
+ ScreenBackup();
+ ~ScreenBackup();
+ };
+
+
+ /** The number of game sections. */
+ static const int kSectionCount = 15;
+
+ static const MenuButton kMainMenuDifficultyButton[]; ///< Difficulty buttons.
+ static const MenuButton kSectionButtons[]; ///< Section buttons.
+
+ static const MenuButton kIngameButtons[]; ///< Ingame menu buttons.
+
+ static const MenuButton kAnimalNamesBack; ///< "Back" button in the animal names screens.
+ static const MenuButton kLanguageButtons[]; ///< Language buttons in the animal names screen.
+
+ static const MenuButton kSectionStorkHouses[];
+
+ static const MenuButton kCharGenHeadButtons[];
+ static const MenuButton kCharGenHeads[];
+ static const MenuButton kCharGenHairButtons[];
+ static const MenuButton kCharGenJacketButtons[];
+ static const MenuButton kCharGenTrousersButtons[];
+ static const MenuButton kCharGenNameEntry[];
+
+ /** All general game sounds we know about. */
+ static const char *kSound[kSoundCount];
+
+
+ static const AnimProperties kClownAnimations[];
+ static const AnimProperties kTitleAnimation;
+ static const AnimProperties kSectionStorkAnimations[];
+ static const AnimProperties kSectionEndAnimations[];
+
+
+ /** Function pointer type for a section handler. */
+ typedef bool (OnceUpon::*SectionFunc)();
+ /** Section handler function. */
+ static const SectionFunc kSectionFuncs[kSectionCount];
+
+
+ /** Did we open the game archives? */
+ bool _openedArchives;
+
+ // Fonts
+ Font *_jeudak;
+ Font *_lettre;
+ Font *_plettre;
+ Font *_glettre;
+
+ /** The current palette. */
+ int _palette;
+
+ bool _quit; ///< Did the user request a normal game quit?
+
+ Difficulty _difficulty; ///< The current difficulty.
+ int _section; ///< The current game section.
+
+ Common::String _name; ///< The name of the child.
+
+ uint8 _house;
+
+ uint8 _head;
+ uint8 _colorHair;
+ uint8 _colorJacket;
+ uint8 _colorTrousers;
+
+
+ // -- General helpers --
+
+ void setGamePalette(uint palette); ///< Set a game palette.
+ void setGameCursor(); ///< Set the default game cursor.
+
+ /** Draw this sprite in a fancy, animated line-by-line way. */
+ void drawLineByLine(const Surface &src, int16 left, int16 top, int16 right, int16 bottom,
+ int16 x, int16 y) const;
+
+ /** Backup the screen contents. */
+ void backupScreen(ScreenBackup &backup, bool setDefaultCursor = false);
+ /** Restore the screen contents with a previously made backup. */
+ void restoreScreen(ScreenBackup &backup);
+
+ Common::String fixString(const Common::String &str) const; ///< Fix a string if necessary.
+ void fixTXTStrings(TXTFile &txt) const; ///< Fix all strings in a TXT.
+
+
+ // -- Copy protection helpers --
+
+ /** Set up the copy protection. */
+ int8 cpSetup(const uint8 colors[7], const uint8 shapes[7 * 20],
+ const uint8 obfuscate[4], const Surface sprites[2]);
+ /** Find the shape under these coordinates. */
+ int8 cpFindShape(int16 x, int16 y) const;
+ /** Display the "You are wrong" screen. */
+ void cpWrong();
+
+
+ // -- Show different game screens --
+
+ void showWait(uint palette = 0xFFFF); ///< Show the wait / loading screen.
+ void showQuote(); ///< Show the quote about fairytales.
+ void showTitle(); ///< Show the Once Upon A Time title.
+ void showChapter(int chapter); ///< Show a chapter intro text.
+ void showByeBye(); ///< Show the "bye bye" screen.
+
+ /** Handle the "listen to animal names" part. */
+ void handleAnimalNames(uint count, const MenuButton *buttons, const char * const *names);
+
+
+ // -- Menu helpers --
+
+ MenuAction handleStartMenu(const MenuButton *animalsButton); ///< Handle the start menu.
+ MenuAction handleMainMenu(); ///< Handle the main menu.
+ MenuAction handleIngameMenu(); ///< Handle the ingame menu.
+
+ void drawStartMenu(const MenuButton *animalsButton); ///< Draw the start menu.
+ void drawMainMenu(); ///< Draw the main menu.
+ void drawIngameMenu(); ///< Draw the ingame menu.
+
+ /** Draw the difficulty label. */
+ void drawMenuDifficulty();
+
+ /** Clear the ingame menu in an animated way. */
+ void clearIngameMenu(const Surface &background);
+
+ /** Handle the whole ingame menu. */
+ MenuAction doIngameMenu();
+ /** Handle the whole ingame menu if ESC or right mouse button was pressed. */
+ MenuAction doIngameMenu(int16 &key, MouseButtons &mouseButtons);
+
+
+ // -- Menu button helpers --
+
+ /** Find the button under these coordinates. */
+ int checkButton(const MenuButton *buttons, uint count, int16 x, int16 y, int failValue = -1) const;
+
+ /** Draw a menu button. */
+ void drawButton (Surface &dest, const Surface &src, const MenuButton &button, int transp = -1) const;
+ /** Draw multiple menu buttons. */
+ void drawButtons(Surface &dest, const Surface &src, const MenuButton *buttons, uint count, int transp = -1) const;
+
+ /** Draw a border around a button. */
+ void drawButtonBorder(const MenuButton &button, uint8 color);
+
+
+ // -- Animal names helpers --
+
+ /** Set up the animal chooser. */
+ void anSetupChooser();
+ /** Set up the language chooser for one animal. */
+ void anSetupNames(const MenuButton &animal);
+ /** Play / Display the name of an animal in one language. */
+ void anPlayAnimalName(const Common::String &animal, uint language);
+
+
+ // -- Game sections --
+
+ bool playSection();
+
+ bool sectionStork();
+ bool sectionChapter1();
+ bool sectionParents();
+ bool sectionChapter2();
+ bool sectionForest0();
+ bool sectionChapter3();
+ bool sectionEvilCastle();
+ bool sectionChapter4();
+ bool sectionForest1();
+ bool sectionChapter5();
+ bool sectionBossFight();
+ bool sectionChapter6();
+ bool sectionForest2();
+ bool sectionChapter7();
+ bool sectionEnd();
+
+ CharGenAction characterGenerator();
+ void charGenSetup(uint stage);
+ void charGenDrawName();
+
+ static bool enterString(Common::String &name, int16 key, uint maxLength, const Font &font);
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_ONCEUPON_H
diff --git a/engines/gob/pregob/onceupon/palettes.h b/engines/gob/pregob/onceupon/palettes.h
new file mode 100644
index 0000000000..952581041c
--- /dev/null
+++ b/engines/gob/pregob/onceupon/palettes.h
@@ -0,0 +1,411 @@
+/* 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_PREGOB_ONCEUPON_PALETTES_H
+#define GOB_PREGOB_ONCEUPON_PALETTES_H
+
+static const int kPaletteSize = 16;
+static const uint kPaletteCount = 20;
+
+static const byte kCopyProtectionPalette[3 * kPaletteSize] = {
+ 0x00, 0x00, 0x00,
+ 0x19, 0x00, 0x19,
+ 0x00, 0x3F, 0x00,
+ 0x00, 0x2A, 0x2A,
+ 0x2A, 0x00, 0x00,
+ 0x2A, 0x00, 0x2A,
+ 0x2A, 0x15, 0x00,
+ 0x00, 0x19, 0x12,
+ 0x00, 0x00, 0x00,
+ 0x15, 0x15, 0x3F,
+ 0x15, 0x3F, 0x15,
+ 0x00, 0x20, 0x3F,
+ 0x3F, 0x00, 0x00,
+ 0x3F, 0x00, 0x20,
+ 0x3F, 0x3F, 0x00,
+ 0x3F, 0x3F, 0x3F
+};
+
+static const byte kGamePalettes[kPaletteCount][3 * kPaletteSize] = {
+ {
+ 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x10,
+ 0x00, 0x00, 0x18,
+ 0x00, 0x00, 0x3C,
+ 0x1C, 0x28, 0x00,
+ 0x10, 0x18, 0x00,
+ 0x1C, 0x1C, 0x20,
+ 0x14, 0x14, 0x14,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x14, 0x20, 0x04,
+ 0x3C, 0x2C, 0x00,
+ 0x02, 0x00, 0x18,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x38, 0x20, 0x3C,
+ 0x2C, 0x10, 0x30,
+ 0x20, 0x08, 0x28,
+ 0x14, 0x00, 0x1C,
+ 0x20, 0x20, 0x38,
+ 0x18, 0x18, 0x2C,
+ 0x10, 0x10, 0x24,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x20, 0x20,
+ 0x24, 0x14, 0x14,
+ 0x1C, 0x10, 0x10,
+ 0x14, 0x0C, 0x0C,
+ 0x1C, 0x1C, 0x1C,
+ 0x18, 0x18, 0x18,
+ 0x10, 0x10, 0x10,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x10, 0x28, 0x1C,
+ 0x10, 0x1C, 0x10,
+ 0x10, 0x14, 0x0C,
+ 0x1C, 0x1C, 0x3C,
+ 0x24, 0x24, 0x3C,
+ 0x18, 0x18, 0x24,
+ 0x10, 0x10, 0x18,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x3F, 0x26, 0x3F,
+ 0x36, 0x1C, 0x36,
+ 0x2C, 0x12, 0x2A,
+ 0x27, 0x0C, 0x24,
+ 0x22, 0x07, 0x1E,
+ 0x1D, 0x03, 0x18,
+ 0x16, 0x00, 0x10,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3A,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x3F, 0x39, 0x26,
+ 0x38, 0x34, 0x1C,
+ 0x30, 0x2F, 0x13,
+ 0x27, 0x29, 0x0C,
+ 0x1D, 0x22, 0x07,
+ 0x14, 0x1B, 0x03,
+ 0x0C, 0x14, 0x00,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3A,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x24, 0x3C, 0x3C,
+ 0x1C, 0x34, 0x38,
+ 0x14, 0x2C, 0x30,
+ 0x0C, 0x20, 0x2C,
+ 0x08, 0x18, 0x28,
+ 0x04, 0x10, 0x20,
+ 0x00, 0x08, 0x1C,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x38,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x24,
+ 0x38, 0x24, 0x1C,
+ 0x30, 0x1C, 0x14,
+ 0x28, 0x18, 0x0C,
+ 0x20, 0x10, 0x04,
+ 0x1C, 0x0C, 0x00,
+ 0x14, 0x08, 0x00,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x38,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x34, 0x24,
+ 0x38, 0x2C, 0x1C,
+ 0x30, 0x24, 0x14,
+ 0x2C, 0x1C, 0x10,
+ 0x30, 0x30, 0x3C,
+ 0x1C, 0x1C, 0x38,
+ 0x0C, 0x0C, 0x38,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0C,
+ 0x02, 0x03, 0x14,
+ 0x07, 0x07, 0x1D,
+ 0x0E, 0x0E, 0x25,
+ 0x17, 0x17, 0x2E,
+ 0x21, 0x22, 0x36,
+ 0x2F, 0x2F, 0x3F,
+ 0x3F, 0x3F, 0x3F,
+ 0x3F, 0x3B, 0x0D,
+ 0x3A, 0x31, 0x0A,
+ 0x35, 0x28, 0x07,
+ 0x30, 0x21, 0x04,
+ 0x2B, 0x19, 0x02,
+ 0x26, 0x12, 0x01,
+ 0x16, 0x0B, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00,
+ 0x21, 0x01, 0x00,
+ 0x2A, 0x02, 0x00,
+ 0x33, 0x03, 0x00,
+ 0x3D, 0x06, 0x00,
+ 0x2A, 0x19, 0x05,
+ 0x15, 0x14, 0x14,
+ 0x22, 0x1F, 0x1E,
+ 0x2F, 0x2C, 0x28,
+ 0x3F, 0x3C, 0x29,
+ 0x3F, 0x38, 0x0B,
+ 0x3B, 0x30, 0x0A,
+ 0x37, 0x29, 0x08,
+ 0x33, 0x23, 0x07,
+ 0x2F, 0x1D, 0x06
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x00, 0x1C, 0x38,
+ 0x34, 0x30, 0x28,
+ 0x2C, 0x24, 0x1C,
+ 0x24, 0x18, 0x10,
+ 0x1C, 0x10, 0x08,
+ 0x14, 0x04, 0x04,
+ 0x10, 0x00, 0x00,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x38,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x00, 0x1C, 0x38,
+ 0x34, 0x30, 0x28,
+ 0x2C, 0x24, 0x1C,
+ 0x3F, 0x3F, 0x3F,
+ 0x3F, 0x3F, 0x3F,
+ 0x3F, 0x3F, 0x3F,
+ 0x3F, 0x3F, 0x3F,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x38,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x1A, 0x30, 0x37,
+ 0x14, 0x28, 0x31,
+ 0x10, 0x20, 0x2C,
+ 0x0C, 0x19, 0x27,
+ 0x08, 0x12, 0x21,
+ 0x05, 0x0C, 0x1C,
+ 0x03, 0x07, 0x16,
+ 0x01, 0x03, 0x11,
+ 0x00, 0x00, 0x0C,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x34, 0x30, 0x34,
+ 0x30, 0x24, 0x30,
+ 0x28, 0x1C, 0x28,
+ 0x24, 0x14, 0x24,
+ 0x1C, 0x0C, 0x1C,
+ 0x18, 0x08, 0x18,
+ 0x14, 0x04, 0x14,
+ 0x0C, 0x04, 0x0C,
+ 0x08, 0x00, 0x08,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x2C, 0x24, 0x0C,
+ 0x34, 0x34, 0x28,
+ 0x2C, 0x2C, 0x1C,
+ 0x24, 0x24, 0x10,
+ 0x1C, 0x18, 0x08,
+ 0x14, 0x14, 0x08,
+ 0x10, 0x10, 0x04,
+ 0x0C, 0x0C, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x38,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00,
+ 0x14, 0x28, 0x31,
+ 0x10, 0x20, 0x2C,
+ 0x0C, 0x19, 0x27,
+ 0x08, 0x12, 0x21,
+ 0x05, 0x0C, 0x1C,
+ 0x03, 0x07, 0x16,
+ 0x01, 0x03, 0x11,
+ 0x00, 0x3C, 0x00,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x10, 0x28, 0x1C,
+ 0x10, 0x1C, 0x10,
+ 0x10, 0x14, 0x0C,
+ 0x1C, 0x1C, 0x3C,
+ 0x24, 0x24, 0x3C,
+ 0x18, 0x18, 0x24,
+ 0x10, 0x10, 0x18,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00,
+ 0x10, 0x28, 0x1C,
+ 0x10, 0x1C, 0x10,
+ 0x10, 0x14, 0x0C,
+ 0x1C, 0x1C, 0x3C,
+ 0x24, 0x24, 0x3C,
+ 0x18, 0x18, 0x24,
+ 0x10, 0x10, 0x18,
+ 0x14, 0x20, 0x04,
+ 0x00, 0x00, 0x24,
+ 0x3C, 0x3C, 0x3C,
+ 0x00, 0x00, 0x00,
+ 0x3C, 0x2C, 0x00,
+ 0x3C, 0x18, 0x00,
+ 0x3C, 0x04, 0x00,
+ 0x1C, 0x00, 0x00
+ }
+};
+
+#endif // GOB_PREGOB_ONCEUPON_PALETTES_H
diff --git a/engines/gob/pregob/onceupon/parents.cpp b/engines/gob/pregob/onceupon/parents.cpp
new file mode 100644
index 0000000000..cdaee6a38d
--- /dev/null
+++ b/engines/gob/pregob/onceupon/parents.cpp
@@ -0,0 +1,217 @@
+/* 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/global.h"
+#include "gob/dataio.h"
+#include "gob/palanim.h"
+#include "gob/draw.h"
+#include "gob/video.h"
+
+#include "gob/sound/sound.h"
+
+#include "gob/pregob/gctfile.h"
+
+#include "gob/pregob/onceupon/palettes.h"
+#include "gob/pregob/onceupon/parents.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+const char *Parents::kSound[kSoundCount] = {
+ "rire.snd", // kSoundCackle
+ "tonn.snd" // kSoundThunder
+};
+
+// So that every GCT line is displayed for 12 seconds
+const uint16 Parents::kLoop[kLoopCount][3] = {
+ { 72, 77, 33},
+ {105, 109, 38},
+ {141, 145, 38},
+ {446, 454, 23},
+ {456, 464, 23},
+ {466, 474, 23},
+ {476, 484, 23}
+};
+
+
+Parents::Parents(GobEngine *vm, const Common::String &seq, const Common::String &gct,
+ const Common::String &childName, uint8 house, const Font &font,
+ const byte *normalPalette, const byte *brightPalette, uint paletteSize) :
+ SEQFile(vm, seq),
+ _gct(0), _house(house), _font(&font),
+ _paletteSize(paletteSize), _normalPalette(normalPalette), _brightPalette(brightPalette) {
+
+ // Load sounds
+ for (int i = 0; i < kSoundCount; i++)
+ _vm->_sound->sampleLoad(&_sounds[i], SOUND_SND, kSound[i]);
+
+ // Load GCT
+ Common::SeekableReadStream *gctStream = _vm->_dataIO->getFile(gct);
+ if (gctStream) {
+ _gct = new GCTFile(*gctStream, _vm->_rnd);
+
+ delete gctStream;
+ } else
+ error("Parents::Parents(): Failed to open \"%s\"", gct.c_str());
+
+ _gct->setArea(17, 18, 303, 41);
+ _gct->setText(1, childName);
+
+ _gct->selectLine(2, _house);
+ _gct->selectLine(4, _house);
+
+ for (uint i = 0; i < kLoopCount; i++)
+ _loopID[i] = addLoop(kLoop[i][0], kLoop[i][1], kLoop[i][2]);
+}
+
+Parents::~Parents() {
+ delete _gct;
+}
+
+void Parents::play() {
+ _currentLoop = 0;
+
+ SEQFile::play(true, 496, 15);
+
+ // After playback, fade out
+ if (!_vm->shouldQuit())
+ _vm->_palAnim->fade(0, 0, 0);
+}
+
+void Parents::handleFrameEvent() {
+ switch (getFrame()) {
+ case 0:
+ // On fame 0, fade in
+ _vm->_draw->forceBlit();
+ _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+ break;
+
+ case 4:
+ drawGCT(0);
+ break;
+
+ case 55:
+ drawGCT(3, 0);
+ break;
+
+ case 79:
+ drawGCT(_house + 5, 1);
+ break;
+
+ case 110:
+ drawGCT(_house + 9, 2);
+ break;
+
+ case 146:
+ drawGCT(17);
+ break;
+
+ case 198:
+ drawGCT(13);
+ break;
+
+ case 445:
+ drawGCT(14, 3);
+ break;
+
+ case 455:
+ drawGCT(18, 4);
+ break;
+
+ case 465:
+ drawGCT(19, 5);
+ break;
+
+ case 475:
+ drawGCT(20, 6);
+ break;
+
+ case 188:
+ case 228:
+ case 237:
+ case 257:
+ case 275:
+ case 426:
+ lightningEffect();
+ break;
+
+ case 203:
+ case 243:
+ case 252:
+ case 272:
+ case 290:
+ case 441:
+ playSound(kSoundThunder);
+ break;
+
+ case 340:
+ playSound(kSoundCackle);
+ break;
+ }
+}
+
+void Parents::handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons) {
+ if ((key == kKeyEscape) || (mouseButtons == kMouseButtonsRight))
+ abortPlay();
+
+ if (((key == kKeySpace) || (mouseButtons == kMouseButtonsLeft)) && (_currentLoop < kLoopCount))
+ skipLoop(_loopID[_currentLoop]);
+}
+
+void Parents::playSound(Sound sound) {
+ _vm->_sound->blasterStop(0);
+ _vm->_sound->blasterPlay(&_sounds[sound], 0, 0);
+}
+
+void Parents::lightningEffect() {
+ for (int i = 0; (i < 5) && !_vm->shouldQuit(); i++) {
+
+ setPalette(_brightPalette, _paletteSize);
+ _vm->_util->delay(5);
+
+ setPalette(_normalPalette, _paletteSize);
+ _vm->_util->delay(5);
+ }
+}
+
+void Parents::setPalette(const byte *palette, uint size) {
+ memcpy(_vm->_draw->_vgaPalette, palette, 3 * size);
+
+ _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+ _vm->_video->retrace();
+}
+
+void Parents::drawGCT(uint item, uint loop) {
+ int16 left, top, right, bottom;
+ if (_gct->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if (_gct->draw(*_vm->_draw->_backSurface, item, *_font, 10, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ _currentLoop = loop;
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/parents.h b/engines/gob/pregob/onceupon/parents.h
new file mode 100644
index 0000000000..f5c8307b73
--- /dev/null
+++ b/engines/gob/pregob/onceupon/parents.h
@@ -0,0 +1,94 @@
+/* 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_PREGOB_ONCEUPON_PARENTS_H
+#define GOB_PREGOB_ONCEUPON_PARENTS_H
+
+#include "gob/sound/sounddesc.h"
+
+#include "gob/pregob/seqfile.h"
+
+namespace Gob {
+
+class Font;
+
+class GCTFile;
+
+namespace OnceUpon {
+
+/** The home / parents animation sequence. */
+class Parents : public SEQFile {
+public:
+ Parents(GobEngine *vm, const Common::String &seq, const Common::String &gct,
+ const Common::String &childName, uint8 house, const Font &font,
+ const byte *normalPalette, const byte *brightPalette, uint paletteSize);
+ ~Parents();
+
+ void play();
+
+protected:
+ void handleFrameEvent();
+ void handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons);
+
+private:
+ static const uint kLoopCount = 7;
+
+ static const uint16 kLoop[kLoopCount][3];
+
+ enum Sound {
+ kSoundCackle = 0,
+ kSoundThunder ,
+ kSoundCount
+ };
+
+ static const char *kSound[kSoundCount];
+
+
+ uint8 _house;
+
+ const Font *_font;
+
+ uint _paletteSize;
+ const byte *_normalPalette;
+ const byte *_brightPalette;
+
+ SoundDesc _sounds[kSoundCount];
+
+ GCTFile *_gct;
+
+ uint _loopID[kLoopCount];
+ uint _currentLoop;
+
+
+ void lightningEffect();
+
+ void playSound(Sound sound);
+ void setPalette(const byte *palette, uint size);
+
+ void drawGCT(uint item, uint loop = 0xFFFF);
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_PARENTS_H
diff --git a/engines/gob/pregob/onceupon/stork.cpp b/engines/gob/pregob/onceupon/stork.cpp
new file mode 100644
index 0000000000..3c38037d08
--- /dev/null
+++ b/engines/gob/pregob/onceupon/stork.cpp
@@ -0,0 +1,234 @@
+/* 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/str.h"
+
+#include "gob/gob.h"
+#include "gob/surface.h"
+#include "gob/anifile.h"
+#include "gob/video.h"
+
+#include "gob/pregob/onceupon/stork.h"
+
+enum Animation {
+ kAnimFlyNearWithBundle = 9,
+ kAnimFlyFarWithBundle = 12,
+ kAnimFlyNearWithoutBundle = 10,
+ kAnimFlyFarWithoutBundle = 13,
+ kAnimBundleNear = 11,
+ kAnimBundleFar = 14
+};
+
+namespace Gob {
+
+namespace OnceUpon {
+
+Stork::Stork(GobEngine *vm, const ANIFile &ani) : ANIObject(ani), _shouldDrop(false) {
+ _frame = new Surface(320, 200, 1);
+ vm->_video->drawPackedSprite("cadre.cmp", *_frame);
+
+ _bundle = new ANIObject(ani);
+
+ _bundle->setVisible(false);
+ _bundle->setPause(true);
+
+ setState(kStateFlyNearWithBundle, kAnimFlyNearWithBundle, -80);
+}
+
+Stork::~Stork() {
+ delete _frame;
+
+ delete _bundle;
+}
+
+bool Stork::hasBundleLanded() const {
+ if (!_shouldDrop || !_bundle->isVisible() || _bundle->isPaused())
+ return false;
+
+ int16 x, y, width, height;
+ _bundle->getFramePosition(x, y);
+ _bundle->getFrameSize(width, height);
+
+ return (y + height) >= _bundleDrop.landY;
+}
+
+void Stork::dropBundle(const BundleDrop &drop) {
+ if (_shouldDrop)
+ return;
+
+ _shouldDrop = true;
+ _bundleDrop = drop;
+}
+
+bool Stork::draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ left = 0x7FFF;
+ top = 0x7FFF;
+ right = 0x0000;
+ bottom = 0x0000;
+
+ bool drawn = ANIObject::draw(dest, left, top, right, bottom);
+ if (drawn) {
+ // Left frame edge
+ if (left <= 15)
+ dest.blit(*_frame, left, top, MIN<int16>(15, right), bottom, left, top);
+
+ // Right frame edge
+ if (right >= 304)
+ dest.blit(*_frame, MAX<int16>(304, left), top, right, bottom, MAX<int16>(304, left), top);
+ }
+
+ int16 bLeft, bTop, bRight, bBottom;
+ if (_bundle->draw(dest, bLeft, bTop, bRight, bBottom)) {
+ // Bottom frame edge
+ if (bBottom >= 188)
+ dest.blit(*_frame, bLeft, MAX<int16>(188, bTop), bRight, bBottom, bLeft, MAX<int16>(188, bTop));
+
+ left = MIN(left , bLeft );
+ top = MIN(top , bTop );
+ right = MAX(right , bRight );
+ bottom = MAX(bottom, bBottom);
+
+ drawn = true;
+ }
+
+ return drawn;
+}
+
+bool Stork::clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ left = 0x7FFF;
+ top = 0x7FFF;
+ right = 0x0000;
+ bottom = 0x0000;
+
+ bool cleared = _bundle->clear(dest, left, top, right, bottom);
+
+ int16 sLeft, sTop, sRight, sBottom;
+ if (ANIObject::clear(dest, sLeft, sTop, sRight, sBottom)) {
+ left = MIN(left , sLeft );
+ top = MIN(top , sTop );
+ right = MAX(right , sRight );
+ bottom = MAX(bottom, sBottom);
+
+ cleared = true;
+ }
+
+ return cleared;
+}
+
+void Stork::advance() {
+ _bundle->advance();
+
+ ANIObject::advance();
+
+ int16 curX, curY, curWidth, curHeight;
+ getFramePosition(curX, curY, 0);
+ getFrameSize(curWidth, curHeight, 0);
+
+ const int16 curRight = curX + curWidth - 1;
+
+ int16 nextX, nextY, nextWidth, nextHeight;
+ getFramePosition(nextX, nextY, 1);
+ getFrameSize(nextWidth, nextHeight, 1);
+
+ const int16 nextRight = nextX + nextWidth - 1;
+
+ switch (_state) {
+ case kStateFlyNearWithBundle:
+ if (curX >= 330)
+ setState(kStateFlyFarWithBundle, kAnimFlyFarWithBundle, 330);
+
+ if ((curRight <= _bundleDrop.dropX) &&
+ (nextRight >= _bundleDrop.dropX) && _shouldDrop && !_bundleDrop.dropWhileFar)
+ dropBundle(kStateFlyNearWithoutBundle, kAnimFlyNearWithoutBundle);
+
+ break;
+
+ case kStateFlyFarWithBundle:
+ if (curX <= -80)
+ setState(kStateFlyNearWithBundle, kAnimFlyNearWithBundle, -80);
+
+ if ((curX >= _bundleDrop.dropX) &&
+ (nextX <= _bundleDrop.dropX) && _shouldDrop && _bundleDrop.dropWhileFar)
+ dropBundle(kStateFlyFarWithoutBundle, kAnimFlyFarWithoutBundle);
+
+ break;
+
+ case kStateFlyNearWithoutBundle:
+ if (curX >= 330)
+ setState(kStateFlyFarWithoutBundle, kAnimFlyFarWithoutBundle, 330);
+ break;
+
+ case kStateFlyFarWithoutBundle:
+ if (curX <= -80)
+ setState(kStateFlyNearWithoutBundle, kAnimFlyNearWithoutBundle, -80);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Stork::dropBundle(State state, uint16 anim) {
+ setState(state, anim);
+
+ int16 x, y, width, height;
+ getFramePosition(x, y);
+ getFrameSize(width, height);
+
+ _bundle->setAnimation(_bundleDrop.anim);
+ _bundle->setPause(false);
+ _bundle->setVisible(true);
+
+ int16 bWidth, bHeight;
+ _bundle->getFrameSize(bWidth, bHeight);
+
+ // Drop position
+ x = _bundleDrop.dropX;
+ y = y + height - bHeight;
+
+ // If the stork is flying near (from left to right), drop the bundle at the right edge
+ if (!_bundleDrop.dropWhileFar)
+ x = x - bWidth;
+
+ _bundle->setPosition(x, y);
+}
+
+void Stork::setState(State state, uint16 anim) {
+ setAnimation(anim);
+ setVisible(true);
+ setPause(false);
+
+ _state = state;
+}
+
+void Stork::setState(State state, uint16 anim, int16 x) {
+ setState(state, anim);
+ setPosition();
+
+ int16 pX, pY;
+ getPosition(pX, pY);
+ setPosition( x, pY);
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/stork.h b/engines/gob/pregob/onceupon/stork.h
new file mode 100644
index 0000000000..756f5258c7
--- /dev/null
+++ b/engines/gob/pregob/onceupon/stork.h
@@ -0,0 +1,103 @@
+/* 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_PREGOB_ONCEUPON_STORK_H
+#define GOB_PREGOB_ONCEUPON_STORK_H
+
+#include "common/system.h"
+
+#include "gob/aniobject.h"
+
+namespace Common {
+ class String;
+}
+
+namespace Gob {
+
+class GobEngine;
+
+class Surface;
+class ANIFile;
+
+namespace OnceUpon {
+
+/** The stork in Baba Yaga / dragon in Abracadabra. */
+class Stork : public ANIObject {
+public:
+ /** Information on how to drop the bundle. */
+ struct BundleDrop {
+ int16 anim; ///< Animation of the bundle floating down
+
+ int16 dropX; ///< X position the stork drops the bundle
+ int16 landY; ///< Y position the bundle lands
+
+ bool dropWhileFar; ///< Does the stork drop the bundle while far instead of near?
+ };
+
+ Stork(GobEngine *vm, const ANIFile &ani);
+ ~Stork();
+
+ /** Has the bundle landed? */
+ bool hasBundleLanded() const;
+
+ /** Drop the bundle. */
+ void dropBundle(const BundleDrop &drop);
+
+ /** Draw the current frame onto the surface and return the affected rectangle. */
+ bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ /** Draw the current frame from the surface and return the affected rectangle. */
+ bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+ /** Advance the animation to the next frame. */
+ void advance();
+
+private:
+ enum State {
+ kStateFlyNearWithBundle = 0,
+ kStateFlyFarWithBundle ,
+ kStateFlyNearWithoutBundle ,
+ kStateFlyFarWithoutBundle
+ };
+
+
+ GobEngine *_vm;
+
+ Surface *_frame;
+ ANIObject *_bundle;
+
+ State _state;
+
+ bool _shouldDrop;
+ BundleDrop _bundleDrop;
+
+
+ void setState(State state, uint16 anim);
+ void setState(State state, uint16 anim, int16 x);
+
+ void dropBundle(State state, uint16 anim);
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_STORK_H
diff --git a/engines/gob/pregob/onceupon/title.cpp b/engines/gob/pregob/onceupon/title.cpp
new file mode 100644
index 0000000000..5163ff6822
--- /dev/null
+++ b/engines/gob/pregob/onceupon/title.cpp
@@ -0,0 +1,117 @@
+/* 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/global.h"
+#include "gob/palanim.h"
+#include "gob/draw.h"
+
+#include "gob/sound/sound.h"
+
+#include "gob/pregob/onceupon/title.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+Title::Title(GobEngine *vm) : SEQFile(vm, "ville.seq") {
+}
+
+Title::~Title() {
+}
+
+void Title::play() {
+ SEQFile::play(true, 0xFFFF, 15);
+
+ // After playback, fade out and stop the music
+ if (!_vm->shouldQuit())
+ _vm->_palAnim->fade(0, 0, 0);
+
+ stopMusic();
+}
+
+void Title::handleFrameEvent() {
+ // On fame 0, start the music and fade in
+ if (getFrame() == 0) {
+ playMusic();
+
+ _vm->_draw->forceBlit();
+ _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+ }
+}
+
+void Title::playMusic() {
+ // Look at what platform this is and play the appropriate music type
+
+ if (_vm->getPlatform() == Common::kPlatformPC)
+ playMusicDOS();
+ else if (_vm->getPlatform() == Common::kPlatformAmiga)
+ playMusicAmiga();
+ else if (_vm->getPlatform() == Common::kPlatformAtariST)
+ playMusicAtariST();
+}
+
+void Title::playMusicDOS() {
+ // Play an AdLib track
+
+ _vm->_sound->adlibLoadTBR("babayaga.tbr");
+ _vm->_sound->adlibLoadMDY("babayaga.mdy");
+ _vm->_sound->adlibSetRepeating(-1);
+ _vm->_sound->adlibPlay();
+}
+
+void Title::playMusicAmiga() {
+ // Play a Protracker track
+
+ _vm->_sound->protrackerPlay("mod.babayaga");
+}
+
+void Title::playMusicAtariST() {
+ // Play a Soundblaster composition
+
+ static const int16 titleMusic[21] = { 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, -1};
+ static const char * const titleFiles[ 3] = {"baba1.snd", "baba2.snd", "baba3.snd"};
+
+ for (uint i = 0; i < ARRAYSIZE(titleFiles); i++)
+ _vm->_sound->sampleLoad(_vm->_sound->sampleGetBySlot(i), SOUND_SND, titleFiles[i]);
+
+ _vm->_sound->blasterPlayComposition(titleMusic, 0);
+ _vm->_sound->blasterRepeatComposition(-1);
+}
+
+void Title::stopMusic() {
+ // Just stop everything
+
+ _vm->_sound->adlibSetRepeating(0);
+ _vm->_sound->blasterRepeatComposition(0);
+
+ _vm->_sound->adlibStop();
+ _vm->_sound->blasterStopComposition();
+ _vm->_sound->protrackerStop();
+
+ for (int i = 0; i < ::Gob::Sound::kSoundsCount; i++)
+ _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(i));
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/title.h b/engines/gob/pregob/onceupon/title.h
new file mode 100644
index 0000000000..5e7ef76d40
--- /dev/null
+++ b/engines/gob/pregob/onceupon/title.h
@@ -0,0 +1,55 @@
+/* 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_PREGOB_ONCEUPON_TITLE_H
+#define GOB_PREGOB_ONCEUPON_TITLE_H
+
+#include "gob/pregob/seqfile.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+/** The Once Upon A Time title animation sequence. */
+class Title : public SEQFile {
+public:
+ Title(GobEngine *vm);
+ ~Title();
+
+ void play();
+
+protected:
+ void handleFrameEvent();
+
+private:
+ void playMusic(); ///< Play the title music.
+ void playMusicDOS(); ///< Play the title music of the DOS version.
+ void playMusicAmiga(); ///< Play the title music of the Amiga version.
+ void playMusicAtariST(); ///< Play the title music of the Atari ST version.
+ void stopMusic(); ///< Stop the title music.
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_TITLE_H
diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp
new file mode 100644
index 0000000000..54eb3c6795
--- /dev/null
+++ b/engines/gob/pregob/pregob.cpp
@@ -0,0 +1,351 @@
+/* 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 "graphics/cursorman.h"
+
+#include "gob/gob.h"
+#include "gob/global.h"
+#include "gob/util.h"
+#include "gob/surface.h"
+#include "gob/dataio.h"
+#include "gob/palanim.h"
+#include "gob/draw.h"
+#include "gob/video.h"
+#include "gob/aniobject.h"
+
+#include "gob/sound/sound.h"
+
+#include "gob/pregob/pregob.h"
+#include "gob/pregob/gctfile.h"
+
+
+namespace Gob {
+
+const char PreGob::kLanguageSuffixShort[5] = { 't', 'g', 'a', 'e', 'i'};
+const char *PreGob::kLanguageSuffixLong [5] = {"fr", "al", "an", "it", "es"};
+
+
+PreGob::PreGob(GobEngine *vm) : _vm(vm), _fadedOut(false) {
+}
+
+PreGob::~PreGob() {
+}
+
+void PreGob::fadeOut() {
+ if (_fadedOut || _vm->shouldQuit())
+ return;
+
+ // Fade to black
+ _vm->_palAnim->fade(0, 0, 0);
+
+ _fadedOut = true;
+}
+
+void PreGob::fadeIn() {
+ if (!_fadedOut || _vm->shouldQuit())
+ return;
+
+ // Fade to palette
+ _vm->_draw->blitInvalidated();
+ _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
+
+ _fadedOut = false;
+}
+
+void PreGob::clearScreen() {
+ _vm->_draw->_backSurface->clear();
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
+ _vm->_draw->blitInvalidated();
+ _vm->_video->retrace();
+}
+
+void PreGob::initScreen() {
+ _vm->_util->setFrameRate(15);
+
+ _fadedOut = true;
+
+ _vm->_draw->initScreen();
+
+ _vm->_draw->_backSurface->clear();
+ _vm->_util->clearPalette();
+
+ _vm->_draw->forceBlit();
+ _vm->_video->retrace();
+
+ _vm->_util->processInput();
+}
+
+void PreGob::setPalette(const byte *palette, uint16 size) {
+ memcpy(_vm->_draw->_vgaPalette, palette, 3 * size);
+
+ // If we didn't fade out prior, immediately set the palette
+ if (!_fadedOut)
+ _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+}
+
+void PreGob::addCursor() {
+ CursorMan.pushCursor(0, 0, 0, 0, 0, 0);
+}
+
+void PreGob::removeCursor() {
+ CursorMan.popCursor();
+}
+
+void PreGob::setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY) {
+ CursorMan.replaceCursor(sprite.getData(), sprite.getWidth(), sprite.getHeight(), hotspotX, hotspotY, 0);
+}
+
+void PreGob::setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom,
+ int16 hotspotX, int16 hotspotY) {
+
+ const int width = right - left + 1;
+ const int height = bottom - top + 1;
+
+ if ((width <= 0) || (height <= 0))
+ return;
+
+ Surface cursor(width, height, 1);
+
+ cursor.blit(sprite, left, top, right, bottom, 0, 0);
+
+ setCursor(cursor, hotspotX, hotspotX);
+}
+
+void PreGob::showCursor() {
+ CursorMan.showMouse(true);
+
+ _vm->_draw->_showCursor = 4;
+}
+
+void PreGob::hideCursor() {
+ CursorMan.showMouse(false);
+
+ _vm->_draw->_showCursor = 0;
+}
+
+bool PreGob::isCursorVisible() const {
+ return CursorMan.isVisible();
+}
+
+void PreGob::loadSounds(const char * const *sounds, uint soundCount) {
+ freeSounds();
+
+ _sounds.resize(soundCount);
+
+ for (uint i = 0; i < soundCount; i++)
+ loadSound(_sounds[i], sounds[i]);
+}
+
+void PreGob::freeSounds() {
+ _sounds.clear();
+}
+
+bool PreGob::loadSound(SoundDesc &sound, const Common::String &file) const {
+ return _vm->_sound->sampleLoad(&sound, SOUND_SND, file.c_str());
+}
+
+void PreGob::playSound(uint sound, int16 frequency, int16 repCount) {
+ if (sound >= _sounds.size())
+ return;
+
+ _vm->_sound->blasterPlay(&_sounds[sound], repCount, frequency);
+}
+
+void PreGob::stopSound() {
+ _vm->_sound->blasterStop(0);
+}
+
+void PreGob::playSoundFile(const Common::String &file, int16 frequency, int16 repCount, bool interruptible) {
+ stopSound();
+
+ SoundDesc sound;
+ if (!loadSound(sound, file))
+ return;
+
+ _vm->_sound->blasterPlay(&sound, repCount, frequency);
+
+ _vm->_util->forceMouseUp();
+
+ bool finished = false;
+ while (!_vm->shouldQuit() && !finished && _vm->_sound->blasterPlayingSound()) {
+ endFrame(true);
+
+ finished = hasInput();
+ }
+
+ _vm->_util->forceMouseUp();
+
+ stopSound();
+}
+
+void PreGob::beep(int16 frequency, int32 length) {
+ _vm->_sound->speakerOn(frequency, length);
+}
+
+void PreGob::endFrame(bool doInput) {
+ _vm->_draw->blitInvalidated();
+ _vm->_util->waitEndFrame();
+
+ if (doInput)
+ _vm->_util->processInput();
+}
+
+int16 PreGob::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
+ _vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons);
+ _vm->_util->forceMouseUp();
+
+ return _vm->_util->checkKey();
+}
+
+int16 PreGob::waitInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
+ bool finished = false;
+
+ int16 key = 0;
+ while (!_vm->shouldQuit() && !finished) {
+ endFrame(true);
+
+ key = checkInput(mouseX, mouseY, mouseButtons);
+
+ finished = (mouseButtons != kMouseButtonsNone) || (key != 0);
+ }
+
+ return key;
+}
+
+int16 PreGob::waitInput() {
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ return waitInput(mouseX, mouseY, mouseButtons);
+}
+
+bool PreGob::hasInput() {
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ return checkInput(mouseX, mouseY, mouseButtons) || (mouseButtons != kMouseButtonsNone);
+}
+
+void PreGob::clearAnim(ANIObject &anim) {
+ int16 left, top, right, bottom;
+
+ if (anim.clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+}
+
+void PreGob::drawAnim(ANIObject &anim) {
+ int16 left, top, right, bottom;
+
+ if (anim.draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ anim.advance();
+}
+
+void PreGob::redrawAnim(ANIObject &anim) {
+ clearAnim(anim);
+ drawAnim(anim);
+}
+
+void PreGob::clearAnim(const ANIList &anims) {
+ for (int i = (anims.size() - 1); i >= 0; i--)
+ clearAnim(*anims[i]);
+}
+
+void PreGob::drawAnim(const ANIList &anims) {
+ for (ANIList::const_iterator a = anims.begin(); a != anims.end(); ++a)
+ drawAnim(**a);
+}
+
+void PreGob::redrawAnim(const ANIList &anims) {
+ clearAnim(anims);
+ drawAnim(anims);
+}
+
+void PreGob::loadAnims(ANIList &anims, ANIFile &ani, uint count, const AnimProperties *props) const {
+ freeAnims(anims);
+
+ anims.resize(count);
+ for (uint i = 0; i < count; i++) {
+ anims[i] = new ANIObject(ani);
+
+ setAnim(*anims[i], props[i]);
+ }
+}
+
+void PreGob::freeAnims(ANIList &anims) const {
+ for (ANIList::iterator a = anims.begin(); a != anims.end(); ++a)
+ delete *a;
+
+ anims.clear();
+}
+
+void PreGob::setAnim(ANIObject &anim, const AnimProperties &props) const {
+ anim.setAnimation(props.animation);
+ anim.setFrame(props.frame);
+ anim.setMode(props.mode);
+ anim.setPause(props.paused);
+ anim.setVisible(props.visible);
+
+ if (props.hasPosition)
+ anim.setPosition(props.x, props.y);
+ else
+ anim.setPosition();
+}
+
+Common::String PreGob::getLocFile(const Common::String &file) const {
+ if (_vm->_global->_language >= ARRAYSIZE(kLanguageSuffixShort))
+ return file;
+
+ return file + kLanguageSuffixShort[_vm->_global->_language];
+}
+
+TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) const {
+ Common::SeekableReadStream *txtStream = _vm->_dataIO->getFile(txtFile);
+ if (!txtStream)
+ error("PreGob::loadTXT(): Failed to open \"%s\"", txtFile.c_str());
+
+ TXTFile *txt = new TXTFile(*txtStream, format);
+
+ delete txtStream;
+
+ fixTXTStrings(*txt);
+
+ return txt;
+}
+
+void PreGob::fixTXTStrings(TXTFile &txt) const {
+}
+
+GCTFile *PreGob::loadGCT(const Common::String &gctFile) const {
+ Common::SeekableReadStream *gctStream = _vm->_dataIO->getFile(gctFile);
+ if (!gctStream)
+ error("PreGob::loadGCT(): Failed to open \"%s\"", gctFile.c_str());
+
+ GCTFile *gct = new GCTFile(*gctStream, _vm->_rnd);
+
+ delete gctStream;
+
+ return gct;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/pregob.h b/engines/gob/pregob/pregob.h
new file mode 100644
index 0000000000..632f85b88e
--- /dev/null
+++ b/engines/gob/pregob/pregob.h
@@ -0,0 +1,194 @@
+/* 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_PREGOB_PREGOB_H
+#define GOB_PREGOB_PREGOB_H
+
+#include "common/str.h"
+#include "common/array.h"
+
+#include "gob/util.h"
+#include "gob/aniobject.h"
+
+#include "gob/sound/sounddesc.h"
+
+#include "gob/pregob/txtfile.h"
+
+namespace Gob {
+
+class GobEngine;
+class Surface;
+
+class GCTFile;
+
+class PreGob {
+public:
+ PreGob(GobEngine *vm);
+ virtual ~PreGob();
+
+ virtual void run() = 0;
+
+ struct AnimProperties {
+ uint16 animation;
+ uint16 frame;
+
+ ANIObject::Mode mode;
+
+ bool visible;
+ bool paused;
+
+ bool hasPosition;
+ int16 x;
+ int16 y;
+ };
+
+protected:
+ typedef Common::Array<ANIObject *> ANIList;
+
+ static const char kLanguageSuffixShort[5];
+ static const char *kLanguageSuffixLong [5];
+
+
+ GobEngine *_vm;
+
+
+ // -- Graphics --
+
+ /** Initialize the game screen. */
+ void initScreen();
+
+ void fadeOut(); ///< Fade to black.
+ void fadeIn(); ///< Fade to the current palette.
+
+ void clearScreen();
+
+ /** Change the palette.
+ *
+ * @param palette The palette to change to.
+ * @param size Size of the palette in colors.
+ */
+ void setPalette(const byte *palette, uint16 size); ///< Change the palette
+
+ /** Add a new cursor that can be manipulated to the stack. */
+ void addCursor();
+ /** Remove the top-most cursor from the stack. */
+ void removeCursor();
+
+ /** Set the current cursor. */
+ void setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY);
+ /** Set the current cursor. */
+ void setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom,
+ int16 hotspotX, int16 hotspotY);
+
+ /** Show the cursor. */
+ void showCursor();
+ /** Hide the cursor. */
+ void hideCursor();
+
+ /** Is the cursor currently visible? */
+ bool isCursorVisible() const;
+
+ /** Remove an animation from the screen. */
+ void clearAnim(ANIObject &anim);
+ /** Draw an animation to the screen, advancing it. */
+ void drawAnim(ANIObject &anim);
+ /** Clear and draw an animation to the screen, advancing it. */
+ void redrawAnim(ANIObject &anim);
+
+ /** Remove animations from the screen. */
+ void clearAnim(const ANIList &anims);
+ /** Draw animations to the screen, advancing them. */
+ void drawAnim(const ANIList &anims);
+ /** Clear and draw animations to the screen, advancing them. */
+ void redrawAnim(const ANIList &anims);
+
+ void loadAnims(ANIList &anims, ANIFile &ani, uint count, const AnimProperties *props) const;
+ void freeAnims(ANIList &anims) const;
+
+ void setAnim(ANIObject &anim, const AnimProperties &props) const;
+
+ /** Wait for the frame to end, handling screen updates and optionally update input. */
+ void endFrame(bool doInput);
+
+
+ // -- Sound --
+
+ /** Load all sounds that can be played interactively in the game. */
+ void loadSounds(const char * const *sounds, uint soundCount);
+ /** Free all loaded sound. */
+ void freeSounds();
+
+ /** Play a loaded sound. */
+ void playSound(uint sound, int16 frequency = 0, int16 repCount = 0);
+ /** Stop all sound playback. */
+ void stopSound();
+
+ /** Play a sound until it ends or is interrupted by a keypress. */
+ void playSoundFile(const Common::String &file, int16 frequency = 0, int16 repCount = 0, bool interruptible = true);
+
+ /** Beep the PC speaker. */
+ void beep(int16 frequency, int32 length);
+
+
+ // -- Input --
+
+ /** Check mouse and keyboard input. */
+ int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
+ /** Wait for mouse or keyboard input. */
+ int16 waitInput (int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
+ /** Wait for mouse or keyboard input, but don't care about what was done with the mouse. */
+ int16 waitInput();
+ /** Did we have mouse or keyboard input? */
+ bool hasInput();
+
+
+ // -- TXT helpers --
+
+ /** Get the name of a localized file. */
+ Common::String getLocFile(const Common::String &file) const;
+ /** Open a TXT file. */
+ TXTFile *loadTXT(const Common::String &txtFile, TXTFile::Format format) const;
+
+ /** Called by loadTXT() to fix strings within the TXT file. */
+ virtual void fixTXTStrings(TXTFile &txt) const;
+
+
+ // -- GCT helpers --
+
+ GCTFile *loadGCT(const Common::String &gctFile) const;
+
+
+private:
+ /** Did we fade out? */
+ bool _fadedOut;
+
+ /** All loaded sounds. */
+ Common::Array<SoundDesc> _sounds;
+
+
+ /** Load a sound file. */
+ bool loadSound(SoundDesc &sound, const Common::String &file) const;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_PREGOB_H
diff --git a/engines/gob/pregob/seqfile.cpp b/engines/gob/pregob/seqfile.cpp
new file mode 100644
index 0000000000..91973bbb85
--- /dev/null
+++ b/engines/gob/pregob/seqfile.cpp
@@ -0,0 +1,384 @@
+/* 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/str.h"
+#include "common/stream.h"
+
+#include "gob/gob.h"
+#include "gob/dataio.h"
+#include "gob/draw.h"
+#include "gob/decfile.h"
+#include "gob/anifile.h"
+#include "gob/aniobject.h"
+
+#include "gob/pregob/seqfile.h"
+
+namespace Gob {
+
+SEQFile::SEQFile(GobEngine *vm, const Common::String &fileName) : _vm(vm) {
+ for (uint i = 0; i < kObjectCount; i++)
+ _objects[i].object = 0;
+
+ Common::SeekableReadStream *seq = _vm->_dataIO->getFile(Util::setExtension(fileName, ".SEQ"));
+ if (!seq) {
+ warning("SEQFile::SEQFile(): No such file \"%s\"", fileName.c_str());
+ return;
+ }
+
+ load(*seq);
+
+ delete seq;
+}
+
+SEQFile::~SEQFile() {
+ for (uint i = 0; i < kObjectCount; i++)
+ delete _objects[i].object;
+
+ for (Backgrounds::iterator b = _backgrounds.begin(); b != _backgrounds.end(); ++b)
+ delete *b;
+
+ for (Animations::iterator a = _animations.begin(); a != _animations.end(); ++a)
+ delete *a;
+}
+
+void SEQFile::load(Common::SeekableReadStream &seq) {
+ const uint16 decCount = (uint16)seq.readByte() + 1;
+ const uint16 aniCount = (uint16)seq.readByte() + 1;
+
+ // Load backgrounds
+ _backgrounds.reserve(decCount);
+ for (uint i = 0; i < decCount; i++) {
+ const Common::String dec = Util::readString(seq, 13);
+
+ if (!_vm->_dataIO->hasFile(dec)) {
+ warning("SEQFile::load(): No such background \"%s\"", dec.c_str());
+ return;
+ }
+
+ _backgrounds.push_back(new DECFile(_vm, dec, 320, 200));
+ }
+
+ // Load animations
+ _animations.reserve(aniCount);
+ for (uint i = 0; i < aniCount; i++) {
+ const Common::String ani = Util::readString(seq, 13);
+
+ if (!_vm->_dataIO->hasFile(ani)) {
+ warning("SEQFile::load(): No such animation \"%s\"", ani.c_str());
+ return;
+ }
+
+ _animations.push_back(new ANIFile(_vm, ani));
+ }
+
+ _frameRate = seq.readUint16LE();
+
+ // Load background change keys
+
+ const uint16 bgKeyCount = seq.readUint16LE();
+ _bgKeys.resize(bgKeyCount);
+
+ for (uint16 i = 0; i < bgKeyCount; i++) {
+ const uint16 frame = seq.readUint16LE();
+ const uint16 index = seq.readUint16LE();
+
+ _bgKeys[i].frame = frame;
+ _bgKeys[i].background = index < _backgrounds.size() ? _backgrounds[index] : 0;
+ }
+
+ // Load animation keys for all 4 objects
+
+ for (uint i = 0; i < kObjectCount; i++) {
+ const uint16 animKeyCount = seq.readUint16LE();
+ _animKeys.reserve(_animKeys.size() + animKeyCount);
+
+ for (uint16 j = 0; j < animKeyCount; j++) {
+ _animKeys.push_back(AnimationKey());
+
+ const uint16 frame = seq.readUint16LE();
+ const uint16 index = seq.readUint16LE();
+
+ uint16 animation;
+ const ANIFile *ani = findANI(index, animation);
+
+ _animKeys.back().object = i;
+ _animKeys.back().frame = frame;
+ _animKeys.back().ani = ani;
+ _animKeys.back().animation = animation;
+ _animKeys.back().x = seq.readSint16LE();
+ _animKeys.back().y = seq.readSint16LE();
+ _animKeys.back().order = seq.readSint16LE();
+ }
+ }
+
+}
+
+const ANIFile *SEQFile::findANI(uint16 index, uint16 &animation) {
+ animation = 0xFFFF;
+
+ // 0xFFFF = remove animation
+ if (index == 0xFFFF)
+ return 0;
+
+ for (Animations::const_iterator a = _animations.begin(); a != _animations.end(); ++a) {
+ if (index < (*a)->getAnimationCount()) {
+ animation = index;
+ return *a;
+ }
+
+ index -= (*a)->getAnimationCount();
+ }
+
+ return 0;
+}
+
+void SEQFile::play(bool abortable, uint16 endFrame, uint16 frameRate) {
+ if (_bgKeys.empty() && _animKeys.empty())
+ // Nothing to do
+ return;
+
+ // Init
+
+ _frame = 0;
+ _abortPlay = false;
+
+ for (uint i = 0; i < kObjectCount; i++) {
+ delete _objects[i].object;
+
+ _objects[i].object = 0;
+ _objects[i].order = 0;
+ }
+
+ for (Loops::iterator l = _loops.begin(); l != _loops.end(); ++l)
+ l->currentLoop = 0;
+
+ // Set the frame rate
+
+ int16 frameRateBack = _vm->_util->getFrameRate();
+
+ if (frameRate == 0)
+ frameRate = _frameRate;
+
+ _vm->_util->setFrameRate(frameRate);
+
+ _abortable = abortable;
+
+ while (!_vm->shouldQuit() && !_abortPlay) {
+ // Handle the frame contents
+ playFrame();
+
+ // Handle extra frame events
+ handleFrameEvent();
+
+ // Wait for the frame to end
+ _vm->_draw->blitInvalidated();
+ _vm->_util->waitEndFrame();
+
+ // Handle input
+
+ _vm->_util->processInput();
+
+ int16 key = _vm->_util->checkKey();
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+ _vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons);
+ _vm->_util->forceMouseUp();
+
+ handleInput(key, mouseX, mouseY, mouseButtons);
+
+ // Loop
+
+ bool looped = false;
+ for (Loops::iterator l = _loops.begin(); l != _loops.end(); ++l) {
+ if ((l->endFrame == _frame) && (l->currentLoop < l->loopCount)) {
+ _frame = l->startFrame;
+
+ l->currentLoop++;
+ looped = true;
+ }
+ }
+
+ // If we didn't loop, advance the frame and look if we should end here
+
+ if (!looped) {
+ _frame++;
+ if (_frame >= endFrame)
+ break;
+ }
+ }
+
+ // Restore the frame rate
+ _vm->_util->setFrameRate(frameRateBack);
+}
+
+void SEQFile::playFrame() {
+ // Remove the current animation frames
+ clearAnims();
+
+ // Handle background keys, directly updating the background
+ for (BackgroundKeys::const_iterator b = _bgKeys.begin(); b != _bgKeys.end(); ++b) {
+ if (!b->background || (b->frame != _frame))
+ continue;
+
+ b->background->draw(*_vm->_draw->_backSurface);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
+ }
+
+ // Handle the animation keys, updating the objects
+ for (AnimationKeys::const_iterator a = _animKeys.begin(); a != _animKeys.end(); ++a) {
+ if (a->frame != _frame)
+ continue;
+
+ Object &object = _objects[a->object];
+
+ delete object.object;
+ object.object = 0;
+
+ // No valid animation => remove
+ if ((a->animation == 0xFFFF) || !a->ani)
+ continue;
+
+ // Change the animation
+
+ object.object = new ANIObject(*a->ani);
+
+ object.object->setAnimation(a->animation);
+ object.object->setPosition(a->x, a->y);
+ object.object->setVisible(true);
+ object.object->setPause(false);
+
+ object.order = a->order;
+ }
+
+ // Draw the animations
+ drawAnims();
+}
+
+// NOTE: This is really not at all efficient. However, since there's only a
+// small number of objects, it should matter. We really do need a stable
+// sort, though, so Common::sort() is out.
+SEQFile::Objects SEQFile::getOrderedObjects() {
+ int16 minOrder = (int16)0x7FFF;
+ int16 maxOrder = (int16)0x8000;
+
+ Objects objects;
+
+ // Find the span of order values
+ for (uint i = 0; i < kObjectCount; i++) {
+ if (!_objects[i].object)
+ continue;
+
+ minOrder = MIN(minOrder, _objects[i].order);
+ maxOrder = MAX(maxOrder, _objects[i].order);
+ }
+
+ // Stably sort the objects by order value
+ for (int16 o = minOrder; o <= maxOrder; o++)
+ for (uint i = 0; i < kObjectCount; i++)
+ if (_objects[i].object && (_objects[i].order == o))
+ objects.push_back(_objects[i]);
+
+ return objects;
+}
+
+void SEQFile::clearAnims() {
+ Objects objects = getOrderedObjects();
+
+ // Remove the animation frames, in reverse drawing order
+ for (Objects::iterator o = objects.reverse_begin(); o != objects.end(); --o) {
+ int16 left, top, right, bottom;
+
+ if (o->object->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ }
+}
+
+void SEQFile::drawAnims() {
+ Objects objects = getOrderedObjects();
+
+ // Draw the animation frames and advance the animation
+ for (Objects::iterator o = objects.begin(); o != objects.end(); ++o) {
+ int16 left, top, right, bottom;
+
+ if (o->object->draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ o->object->advance();
+ }
+}
+
+uint16 SEQFile::getFrame() const {
+ return _frame;
+}
+
+void SEQFile::seekFrame(uint16 frame) {
+ _frame = frame;
+}
+
+uint SEQFile::addLoop(uint16 startFrame, uint16 endFrame, uint16 loopCount) {
+ _loops.resize(_loops.size() + 1);
+
+ _loops.back().startFrame = startFrame;
+ _loops.back().endFrame = endFrame;
+ _loops.back().loopCount = loopCount;
+ _loops.back().currentLoop = 0;
+ _loops.back().empty = false;
+
+ return _loops.size() - 1;
+}
+
+void SEQFile::skipLoop(uint loopID) {
+ if (loopID >= _loops.size())
+ return;
+
+ _loops[loopID].currentLoop = 0xFFFF;
+}
+
+void SEQFile::delLoop(uint loopID) {
+ if (loopID >= _loops.size())
+ return;
+
+ _loops[loopID].empty = true;
+
+ cleanLoops();
+}
+
+void SEQFile::cleanLoops() {
+ while (!_loops.empty() && _loops.back().empty)
+ _loops.pop_back();
+}
+
+void SEQFile::abortPlay() {
+ _abortPlay = true;
+}
+
+void SEQFile::handleFrameEvent() {
+}
+
+void SEQFile::handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons) {
+ if (_abortable && ((key != 0) || (mouseButtons != kMouseButtonsNone)))
+ abortPlay();
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/seqfile.h b/engines/gob/pregob/seqfile.h
new file mode 100644
index 0000000000..5e12962ef9
--- /dev/null
+++ b/engines/gob/pregob/seqfile.h
@@ -0,0 +1,193 @@
+/* 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_PREGOB_SEQFILE_H
+#define GOB_PREGOB_SEQFILE_H
+
+#include "common/system.h"
+#include "common/array.h"
+#include "common/list.h"
+
+#include "gob/util.h"
+
+namespace Common {
+ class String;
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+class GobEngine;
+
+class DECFile;
+class ANIFile;
+class ANIObject;
+
+/** A SEQ file, describing a complex animation sequence.
+ *
+ * Used in early hardcoded gob games.
+ * The principle is similar to the Mult class (see mult.h), but instead
+ * of depending on all the externally loaded animations, backgrounds and
+ * objects, a SEQ file references animation and background directly by
+ * filename.
+ */
+class SEQFile {
+public:
+ SEQFile(GobEngine *vm, const Common::String &fileName);
+ virtual ~SEQFile();
+
+ /** Play the SEQ.
+ *
+ * @param abortable If true, end playback on any user input.
+ * @param endFrame The frame on where to end, or 0xFFFF for infinite playback.
+ * @param frameRate The frame rate at which to play the SEQ, or 0 for playing at
+ * the speed the SEQ itself wants to.
+ */
+ void play(bool abortable = true, uint16 endFrame = 0xFFFF, uint16 frameRate = 0);
+
+
+protected:
+ GobEngine *_vm;
+
+
+ /** Returns the current frame number. */
+ uint16 getFrame() const;
+
+ /** Seek to a specific frame. */
+ void seekFrame(uint16 frame);
+
+ /** Add a frame loop. */
+ uint addLoop(uint16 startFrame, uint16 endFrame, uint16 loopCount);
+
+ /** Skip a frame loop. */
+ void skipLoop(uint loopID);
+
+ /** Delete a frame loop. */
+ void delLoop(uint loopID);
+
+ /** Ends SEQ playback. */
+ void abortPlay();
+
+ /** Callback for special frame events. */
+ virtual void handleFrameEvent();
+ /** Callback for special user input handling. */
+ virtual void handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons);
+
+
+private:
+ /** Number of animation objects that are visible at the same time. */
+ static const uint kObjectCount = 4;
+
+ /** A key for changing the background. */
+ struct BackgroundKey {
+ uint16 frame; ///< Frame the change is to happen.
+
+ const DECFile *background; ///< The background to use.
+ };
+
+ /** A key for playing an object animation. */
+ struct AnimationKey {
+ uint object; ///< The object this key belongs to.
+
+ uint16 frame; ///< Frame the change is to happen.
+
+ const ANIFile *ani; ///< The ANI to use.
+
+ uint16 animation; ///< The animation to use.
+
+ int16 x; ///< X position of the animation.
+ int16 y; ///< Y position of the animation.
+
+ int16 order; ///< Used to determine in which order to draw the objects.
+ };
+
+ /** A managed animation object. */
+ struct Object {
+ ANIObject *object; ///< The actual animation object.
+
+ int16 order; ///< The current drawing order.
+ };
+
+ /** A frame loop. */
+ struct Loop {
+ uint16 startFrame;
+ uint16 endFrame;
+
+ uint16 loopCount;
+ uint16 currentLoop;
+
+ bool empty;
+ };
+
+ typedef Common::Array<DECFile *> Backgrounds;
+ typedef Common::Array<ANIFile *> Animations;
+
+ typedef Common::Array<BackgroundKey> BackgroundKeys;
+ typedef Common::Array<AnimationKey> AnimationKeys;
+
+ typedef Common::List<Object> Objects;
+
+ typedef Common::Array<Loop> Loops;
+
+
+ uint16 _frame; ///< The current frame.
+ bool _abortPlay; ///< Was the end of the playback requested?
+
+ uint16 _frameRate;
+
+ Backgrounds _backgrounds; ///< All backgrounds in this SEQ.
+ Animations _animations; ///< All animations in this SEQ.
+
+ BackgroundKeys _bgKeys; ///< The background change keyframes.
+ AnimationKeys _animKeys; ///< The animation change keyframes.
+
+ Object _objects[kObjectCount]; ///< The managed animation objects.
+
+ Loops _loops;
+
+ /** Whether the playback should be abortable by user input. */
+ bool _abortable;
+
+
+ // -- Loading helpers --
+
+ void load(Common::SeekableReadStream &seq);
+
+ const ANIFile *findANI(uint16 index, uint16 &animation);
+
+ // -- Playback helpers --
+
+ void playFrame();
+
+ /** Get a list of objects ordered by drawing order. */
+ Objects getOrderedObjects();
+
+ void clearAnims(); ///< Remove all animation frames.
+ void drawAnims(); ///< Draw the animation frames.
+
+ /** Look if we can compact the loop array. */
+ void cleanLoops();
+};
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_SEQFILE_H
diff --git a/engines/gob/pregob/txtfile.cpp b/engines/gob/pregob/txtfile.cpp
new file mode 100644
index 0000000000..3ff0d4b039
--- /dev/null
+++ b/engines/gob/pregob/txtfile.cpp
@@ -0,0 +1,232 @@
+/* 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/stream.h"
+
+#include "gob/draw.h"
+
+#include "gob/pregob/txtfile.h"
+
+namespace Gob {
+
+TXTFile::TXTFile(Common::SeekableReadStream &txt, Format format) {
+ load(txt, format);
+}
+
+TXTFile::~TXTFile() {
+}
+
+TXTFile::LineArray &TXTFile::getLines() {
+ return _lines;
+}
+
+void TXTFile::load(Common::SeekableReadStream &txt, Format format) {
+ if (format == kFormatStringPositionColorFont) {
+ int numLines = getInt(txt);
+
+ _lines.reserve(numLines);
+ }
+
+ while (!txt.eos()) {
+ Line line;
+
+ line.text = getStr(txt);
+ line.x = (format >= kFormatStringPosition) ? getInt(txt) : 0;
+ line.y = (format >= kFormatStringPosition) ? getInt(txt) : 0;
+ line.color = (format >= kFormatStringPositionColor) ? getInt(txt) : 0;
+ line.font = (format >= kFormatStringPositionColorFont) ? getInt(txt) : 0;
+
+ _lines.push_back(line);
+ }
+
+ while (!_lines.empty() && _lines.back().text.empty())
+ _lines.pop_back();
+}
+
+bool TXTFile::draw(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount, int color) {
+
+ trashBuffer();
+
+ if (!getArea(left, top, right, bottom, fonts, fontCount))
+ return false;
+
+ resizeBuffer(right - left + 1, bottom - top + 1);
+ saveScreen(surface, left, top, right, bottom);
+
+ for (LineArray::const_iterator l = _lines.begin(); l != _lines.end(); ++l) {
+ if (l->font >= fontCount)
+ continue;
+
+ fonts[l->font]->drawString(l->text, l->x, l->y, (color < 0) ? l->color : color, 0, true, surface);
+ }
+
+ return true;
+}
+
+bool TXTFile::draw(uint line, Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount, int color) {
+
+ trashBuffer();
+
+ if (!getArea(line, left, top, right, bottom, fonts, fontCount))
+ return false;
+
+ resizeBuffer(right - left + 1, bottom - top + 1);
+ saveScreen(surface, left, top, right, bottom);
+
+ const Line &l = _lines[line];
+
+ fonts[l.font]->drawString(l.text, l.x, l.y, (color < 0) ? l.color : color, 0, true, surface);
+
+ return true;
+}
+
+bool TXTFile::draw(Surface &surface, const Font * const *fonts, uint fontCount, int color) {
+ int16 left, top, right, bottom;
+
+ return draw(surface, left, top, right, bottom, fonts, fontCount, color);
+}
+
+bool TXTFile::draw(uint line, Surface &surface, const Font * const *fonts, uint fontCount, int color) {
+ int16 left, top, right, bottom;
+
+ return draw(line, surface, left, top, right, bottom, fonts, fontCount, color);
+}
+
+bool TXTFile::clear(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ return restoreScreen(surface, left, top, right, bottom);
+}
+
+bool TXTFile::getArea(int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount) const {
+
+ bool hasLine = false;
+
+ left = 0x7FFF;
+ top = 0x7FFF;
+ right = 0x0000;
+ bottom = 0x0000;
+
+ for (uint i = 0; i < _lines.size(); i++) {
+ int16 lLeft, lTop, lRight, lBottom;
+
+ if (getArea(i, lLeft, lTop, lRight, lBottom, fonts, fontCount)) {
+ left = MIN(left , lLeft );
+ top = MIN(top , lTop );
+ right = MAX(right , lRight );
+ bottom = MAX(bottom, lBottom);
+
+ hasLine = true;
+ }
+ }
+
+ return hasLine;
+}
+
+bool TXTFile::getArea(uint line, int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount) const {
+
+
+ if ((line >= _lines.size()) || (_lines[line].font >= fontCount))
+ return false;
+
+ const Line &l = _lines[line];
+
+ left = l.x;
+ top = l.y;
+ right = l.x + l.text.size() * fonts[l.font]->getCharWidth() - 1;
+ bottom = l.y + fonts[l.font]->getCharHeight() - 1;
+
+ return true;
+}
+
+Common::String TXTFile::getStr(Common::SeekableReadStream &txt) {
+ // Skip all ' ', '\n' and '\r'
+ while (!txt.eos()) {
+ char c = txt.readByte();
+ if (txt.eos())
+ break;
+
+ if ((c != ' ') && (c != '\n') && (c != '\r')) {
+ txt.seek(-1, SEEK_CUR);
+ break;
+ }
+ }
+
+ if (txt.eos())
+ return "";
+
+ // Read string until ' ', '\n' or '\r'
+ Common::String string;
+ while (!txt.eos()) {
+ char c = txt.readByte();
+ if ((c == ' ') || (c == '\n') || (c == '\r'))
+ break;
+
+ string += c;
+ }
+
+ // Replace all '#' with ' ' and throw out non-printables
+ Common::String cleanString;
+
+ for (uint i = 0; i < string.size(); i++) {
+ if (string[i] == '#')
+ cleanString += ' ';
+ else if ((unsigned char)string[i] >= ' ')
+ cleanString += string[i];
+ }
+
+ return cleanString;
+}
+
+int TXTFile::getInt(Common::SeekableReadStream &txt) {
+ // Skip all [^-0-9]
+ while (!txt.eos()) {
+ char c = txt.readByte();
+ if (txt.eos())
+ break;
+
+ if ((c == '-') || ((c >= '0') && (c <= '9'))) {
+ txt.seek(-1, SEEK_CUR);
+ break;
+ }
+ }
+
+ if (txt.eos())
+ return 0;
+
+ // Read until [^-0-9]
+ Common::String string;
+ while (!txt.eos()) {
+ char c = txt.readByte();
+ if ((c != '-') && ((c < '0') || (c > '9')))
+ break;
+
+ string += c;
+ }
+
+ // Convert to integer
+ return atoi(string.c_str());
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/txtfile.h b/engines/gob/pregob/txtfile.h
new file mode 100644
index 0000000000..c623b58859
--- /dev/null
+++ b/engines/gob/pregob/txtfile.h
@@ -0,0 +1,91 @@
+/* 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_PREGOB_TXTFILE_H
+#define GOB_PREGOB_TXTFILE_H
+
+#include "common/system.h"
+#include "common/str.h"
+#include "common/array.h"
+
+#include "gob/backbuffer.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+class Surface;
+class Font;
+
+class TXTFile : public BackBuffer {
+public:
+ enum Format {
+ kFormatString,
+ kFormatStringPosition,
+ kFormatStringPositionColor,
+ kFormatStringPositionColorFont
+ };
+
+ struct Line {
+ Common::String text;
+ int x, y;
+ int color;
+ uint font;
+ };
+
+ typedef Common::Array<Line> LineArray;
+
+ TXTFile(Common::SeekableReadStream &txt, Format format);
+ ~TXTFile();
+
+ LineArray &getLines();
+
+ bool draw( Surface &surface, const Font * const *fonts, uint fontCount, int color = -1);
+ bool draw(uint line, Surface &surface, const Font * const *fonts, uint fontCount, int color = -1);
+
+ bool draw( Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount, int color = -1);
+ bool draw(uint line, Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount, int color = -1);
+
+ bool clear(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+private:
+ LineArray _lines;
+
+ void load(Common::SeekableReadStream &txt, Format format);
+
+ Common::String getStr(Common::SeekableReadStream &txt);
+ int getInt(Common::SeekableReadStream &txt);
+
+
+ bool getArea( int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount) const;
+ bool getArea(uint line, int16 &left, int16 &top, int16 &right, int16 &bottom,
+ const Font * const *fonts, uint fontCount) const;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_TXTFILE_H
diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp
index d5497c25be..a84f4ac4b8 100644
--- a/engines/gob/resources.cpp
+++ b/engines/gob/resources.cpp
@@ -716,7 +716,7 @@ byte *Resources::getIMData(TOTResourceItem &totItem) const {
return _imData + offset;
}
-byte *Resources::getEXTData(EXTResourceItem &extItem, uint32 size) const {
+byte *Resources::getEXTData(EXTResourceItem &extItem, uint32 &size) const {
Common::SeekableReadStream *stream = _vm->_dataIO->getFile(_extFile);
if (!stream)
return 0;
@@ -726,6 +726,10 @@ byte *Resources::getEXTData(EXTResourceItem &extItem, uint32 size) const {
return 0;
}
+ // If that workaround is active, limit the resource size instead of throwing an error
+ if (_vm->hasResourceSizeWorkaround())
+ size = MIN<int>(size, stream->size() - extItem.offset);
+
byte *data = new byte[extItem.packed ? (size + 2) : size];
if (stream->read(data, size) != size) {
delete[] data;
@@ -737,7 +741,7 @@ byte *Resources::getEXTData(EXTResourceItem &extItem, uint32 size) const {
return data;
}
-byte *Resources::getEXData(EXTResourceItem &extItem, uint32 size) const {
+byte *Resources::getEXData(EXTResourceItem &extItem, uint32 &size) const {
Common::SeekableReadStream *stream = _vm->_dataIO->getFile(_exFile);
if (!stream)
return 0;
@@ -747,6 +751,10 @@ byte *Resources::getEXData(EXTResourceItem &extItem, uint32 size) const {
return 0;
}
+ // If that workaround is active, limit the resource size instead of throwing an error
+ if (_vm->hasResourceSizeWorkaround())
+ size = MIN<int>(size, stream->size() - extItem.offset);
+
byte *data = new byte[extItem.packed ? (size + 2) : size];
if (stream->read(data, size) != size) {
delete[] data;
diff --git a/engines/gob/resources.h b/engines/gob/resources.h
index 39155c5176..04b3b9d31e 100644
--- a/engines/gob/resources.h
+++ b/engines/gob/resources.h
@@ -103,7 +103,7 @@ private:
static const int kTOTTextItemSize = 2 + 2;
enum ResourceType {
- kResourceTOT,
+ kResourceTOT = 0,
kResourceIM,
kResourceEXT,
kResourceEX
@@ -201,8 +201,8 @@ private:
byte *getTOTData(TOTResourceItem &totItem) const;
byte *getIMData(TOTResourceItem &totItem) const;
- byte *getEXTData(EXTResourceItem &extItem, uint32 size) const;
- byte *getEXData(EXTResourceItem &extItem, uint32 size) const;
+ byte *getEXTData(EXTResourceItem &extItem, uint32 &size) const;
+ byte *getEXData(EXTResourceItem &extItem, uint32 &size) const;
};
} // End of namespace Gob
diff --git a/engines/gob/rxyfile.cpp b/engines/gob/rxyfile.cpp
index 5311eece0f..2ff8c121cd 100644
--- a/engines/gob/rxyfile.cpp
+++ b/engines/gob/rxyfile.cpp
@@ -21,15 +21,31 @@
*/
#include "common/stream.h"
+#include "common/substream.h"
#include "gob/rxyfile.h"
namespace Gob {
RXYFile::RXYFile(Common::SeekableReadStream &rxy) : _width(0), _height(0) {
+ Common::SeekableSubReadStreamEndian sub(&rxy, 0, rxy.size(), false, DisposeAfterUse::NO);
+
+ load(sub);
+}
+
+RXYFile::RXYFile(Common::SeekableSubReadStreamEndian &rxy) : _width(0), _height(0) {
load(rxy);
}
+RXYFile::RXYFile(uint16 width, uint16 height) : _realCount(1), _width(width), _height(height) {
+ _coords.resize(1);
+
+ _coords[0].left = 0;
+ _coords[0].top = 0;
+ _coords[0].right = _width - 1;
+ _coords[0].bottom = _height - 1;
+}
+
RXYFile::~RXYFile() {
}
@@ -55,22 +71,22 @@ const RXYFile::Coordinates &RXYFile::operator[](uint i) const {
return _coords[i];
}
-void RXYFile::load(Common::SeekableReadStream &rxy) {
+void RXYFile::load(Common::SeekableSubReadStreamEndian &rxy) {
if (rxy.size() < 2)
return;
rxy.seek(0);
- _realCount = rxy.readUint16LE();
+ _realCount = rxy.readUint16();
uint16 count = (rxy.size() - 2) / 8;
_coords.resize(count);
for (CoordArray::iterator c = _coords.begin(); c != _coords.end(); ++c) {
- c->left = rxy.readUint16LE();
- c->right = rxy.readUint16LE();
- c->top = rxy.readUint16LE();
- c->bottom = rxy.readUint16LE();
+ c->left = rxy.readUint16();
+ c->right = rxy.readUint16();
+ c->top = rxy.readUint16();
+ c->bottom = rxy.readUint16();
if (c->left != 0xFFFF) {
_width = MAX<uint16>(_width , c->right + 1);
@@ -79,4 +95,15 @@ void RXYFile::load(Common::SeekableReadStream &rxy) {
}
}
+uint16 RXYFile::add(uint16 left, uint16 top, uint16 right, uint16 bottom) {
+ _coords.resize(_coords.size() + 1);
+
+ _coords.back().left = left;
+ _coords.back().top = top;
+ _coords.back().right = right;
+ _coords.back().bottom = bottom;
+
+ return _coords.size() - 1;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/rxyfile.h b/engines/gob/rxyfile.h
index 828f8b73c7..4fd46c5e40 100644
--- a/engines/gob/rxyfile.h
+++ b/engines/gob/rxyfile.h
@@ -28,6 +28,7 @@
namespace Common {
class SeekableReadStream;
+ class SeekableSubReadStreamEndian;
}
namespace Gob {
@@ -46,6 +47,8 @@ public:
};
RXYFile(Common::SeekableReadStream &rxy);
+ RXYFile(Common::SeekableSubReadStreamEndian &rxy);
+ RXYFile(uint16 width, uint16 height);
~RXYFile();
uint size() const;
@@ -57,6 +60,8 @@ public:
const Coordinates &operator[](uint i) const;
+ uint16 add(uint16 left, uint16 top, uint16 right, uint16 bottom);
+
private:
typedef Common::Array<Coordinates> CoordArray;
@@ -68,7 +73,7 @@ private:
uint16 _height;
- void load(Common::SeekableReadStream &rxy);
+ void load(Common::SeekableSubReadStreamEndian &rxy);
};
} // End of namespace Gob
diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h
index 66b3482bac..834484757b 100644
--- a/engines/gob/save/saveload.h
+++ b/engines/gob/save/saveload.h
@@ -257,6 +257,33 @@ protected:
SaveFile *getSaveFile(const char *fileName);
};
+/** Save/Load class for A.J.'s World of Discovery. */
+class SaveLoad_AJWorld : public SaveLoad {
+public:
+ SaveLoad_AJWorld(GobEngine *vm, const char *targetName);
+ virtual ~SaveLoad_AJWorld();
+
+ SaveMode getSaveMode(const char *fileName) const;
+
+protected:
+ struct SaveFile {
+ const char *sourceName;
+ SaveMode mode;
+ SaveHandler *handler;
+ const char *description;
+ };
+
+ static SaveFile _saveFiles[];
+
+ TempSpriteHandler *_tempSpriteHandler;
+
+ SaveHandler *getHandler(const char *fileName) const;
+ const char *getDescription(const char *fileName) const;
+
+ const SaveFile *getSaveFile(const char *fileName) const;
+ SaveFile *getSaveFile(const char *fileName);
+};
+
/** Save/Load class for Goblins 3 and Lost in Time. */
class SaveLoad_v3 : public SaveLoad {
public:
diff --git a/engines/gob/save/saveload_ajworld.cpp b/engines/gob/save/saveload_ajworld.cpp
new file mode 100644
index 0000000000..727d071b3e
--- /dev/null
+++ b/engines/gob/save/saveload_ajworld.cpp
@@ -0,0 +1,94 @@
+/* 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/save/saveload.h"
+#include "gob/save/saveconverter.h"
+#include "gob/inter.h"
+#include "gob/variables.h"
+
+namespace Gob {
+
+SaveLoad_AJWorld::SaveFile SaveLoad_AJWorld::_saveFiles[] = {
+ { "menu.inf", kSaveModeSave, 0, "temporary sprite"}
+};
+
+
+SaveLoad_AJWorld::SaveLoad_AJWorld(GobEngine *vm, const char *targetName) :
+ SaveLoad(vm) {
+
+ _tempSpriteHandler = new TempSpriteHandler(vm);
+
+ _saveFiles[0].handler = _tempSpriteHandler;
+}
+
+SaveLoad_AJWorld::~SaveLoad_AJWorld() {
+ delete _tempSpriteHandler;
+}
+
+const SaveLoad_AJWorld::SaveFile *SaveLoad_AJWorld::getSaveFile(const char *fileName) const {
+ fileName = stripPath(fileName);
+
+ for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
+ if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
+ return &_saveFiles[i];
+
+ return 0;
+}
+
+SaveLoad_AJWorld::SaveFile *SaveLoad_AJWorld::getSaveFile(const char *fileName) {
+ fileName = stripPath(fileName);
+
+ for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
+ if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
+ return &_saveFiles[i];
+
+ return 0;
+}
+
+SaveHandler *SaveLoad_AJWorld::getHandler(const char *fileName) const {
+ const SaveFile *saveFile = getSaveFile(fileName);
+
+ if (saveFile)
+ return saveFile->handler;
+
+ return 0;
+}
+
+const char *SaveLoad_AJWorld::getDescription(const char *fileName) const {
+ const SaveFile *saveFile = getSaveFile(fileName);
+
+ if (saveFile)
+ return saveFile->description;
+
+ return 0;
+}
+
+SaveLoad::SaveMode SaveLoad_AJWorld::getSaveMode(const char *fileName) const {
+ const SaveFile *saveFile = getSaveFile(fileName);
+
+ if (saveFile)
+ return saveFile->mode;
+
+ return kSaveModeNone;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/sound/adlib.cpp b/engines/gob/sound/adlib.cpp
index f1ab2a2d79..d9fc362547 100644
--- a/engines/gob/sound/adlib.cpp
+++ b/engines/gob/sound/adlib.cpp
@@ -20,771 +20,621 @@
*
*/
-#include "common/debug.h"
-#include "common/file.h"
-#include "common/endian.h"
+#include "common/util.h"
#include "common/textconsole.h"
+#include "common/debug.h"
+#include "common/config-manager.h"
+
+#include "audio/fmopl.h"
#include "gob/gob.h"
#include "gob/sound/adlib.h"
namespace Gob {
-const unsigned char AdLib::_operators[] = {0, 1, 2, 8, 9, 10, 16, 17, 18};
-const unsigned char AdLib::_volRegNums[] = {
- 3, 4, 5,
- 11, 12, 13,
- 19, 20, 21
+static const int kPitchTom = 24;
+static const int kPitchTomToSnare = 7;
+static const int kPitchSnareDrum = kPitchTom + kPitchTomToSnare;
+
+
+// Is the operator a modulator (0) or a carrier (1)?
+const uint8 AdLib::kOperatorType[kOperatorCount] = {
+ 0, 0, 0, 1, 1, 1,
+ 0, 0, 0, 1, 1, 1,
+ 0, 0, 0, 1, 1, 1
+};
+
+// Operator number to register offset on the OPL
+const uint8 AdLib::kOperatorOffset[kOperatorCount] = {
+ 0, 1, 2, 3, 4, 5,
+ 8, 9, 10, 11, 12, 13,
+ 16, 17, 18, 19, 20, 21
+};
+
+// For each operator, the voice it belongs to
+const uint8 AdLib::kOperatorVoice[kOperatorCount] = {
+ 0, 1, 2,
+ 0, 1, 2,
+ 3, 4, 5,
+ 3, 4, 5,
+ 6, 7, 8,
+ 6, 7, 8,
+};
+
+// Voice to operator set, for the 9 melodyvoices (only 6 useable in percussion mode)
+const uint8 AdLib::kVoiceMelodyOperator[kOperatorsPerVoice][kMelodyVoiceCount] = {
+ {0, 1, 2, 6, 7, 8, 12, 13, 14},
+ {3, 4, 5, 9, 10, 11, 15, 16, 17}
};
-AdLib::AdLib(Audio::Mixer &mixer) : _mixer(&mixer) {
- init();
+// Voice to operator set, for the 5 percussion voices (only useable in percussion mode)
+const uint8 AdLib::kVoicePercussionOperator[kOperatorsPerVoice][kPercussionVoiceCount] = {
+ {12, 16, 14, 17, 13},
+ {15, 0, 0, 0, 0}
+};
+
+// Mask bits to set each percussion instrument on/off
+const byte AdLib::kPercussionMasks[kPercussionVoiceCount] = {0x10, 0x08, 0x04, 0x02, 0x01};
+
+// Default instrument presets
+const uint16 AdLib::kPianoParams [kOperatorsPerVoice][kParamCount] = {
+ { 1, 1, 3, 15, 5, 0, 1, 3, 15, 0, 0, 0, 1, 0},
+ { 0, 1, 1, 15, 7, 0, 2, 4, 0, 0, 0, 1, 0, 0} };
+const uint16 AdLib::kBaseDrumParams[kOperatorsPerVoice][kParamCount] = {
+ { 0, 0, 0, 10, 4, 0, 8, 12, 11, 0, 0, 0, 1, 0 },
+ { 0, 0, 0, 13, 4, 0, 6, 15, 0, 0, 0, 0, 1, 0 } };
+const uint16 AdLib::kSnareDrumParams[kParamCount] = {
+ 0, 12, 0, 15, 11, 0, 8, 5, 0, 0, 0, 0, 0, 0 };
+const uint16 AdLib::kTomParams [kParamCount] = {
+ 0, 4, 0, 15, 11, 0, 7, 5, 0, 0, 0, 0, 0, 0 };
+const uint16 AdLib::kCymbalParams [kParamCount] = {
+ 0, 1, 0, 15, 11, 0, 5, 5, 0, 0, 0, 0, 0, 0 };
+const uint16 AdLib::kHihatParams [kParamCount] = {
+ 0, 1, 0, 15, 11, 0, 7, 5, 0, 0, 0, 0, 0, 0 };
+
+
+AdLib::AdLib(Audio::Mixer &mixer) : _mixer(&mixer), _opl(0),
+ _toPoll(0), _repCount(0), _first(true), _playing(false), _ended(true) {
+
+ _rate = _mixer->getOutputRate();
+
+ initFreqs();
+
+ createOPL();
+ initOPL();
+
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &_handle,
+ this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
AdLib::~AdLib() {
- Common::StackLock slock(_mutex);
-
_mixer->stopHandle(_handle);
- OPLDestroy(_opl);
- if (_data && _freeData)
- delete[] _data;
-}
-void AdLib::init() {
- _index = -1;
- _data = 0;
- _playPos = 0;
- _dataSize = 0;
+ delete _opl;
+}
- _rate = _mixer->getOutputRate();
+// Creates the OPL. Try to use the DOSBox emulator, unless that one is not compiled in,
+// or the user explicitly wants the MAME emulator. The MAME one is slightly buggy, leading
+// to some wrong sounds, especially noticeable in the title music of Gobliins 2, so we
+// really don't want to use it, if we can help it.
+void AdLib::createOPL() {
+ Common::String oplDriver = ConfMan.get("opl_driver");
- _opl = makeAdLibOPL(_rate);
+ if (oplDriver.empty() || (oplDriver == "auto") || (OPL::Config::parse(oplDriver) == -1)) {
+ // User has selected OPL driver auto detection or an invalid OPL driver.
+ // Set it to our preferred driver (DOSBox), if we can.
- _first = true;
- _ended = false;
- _playing = false;
+ if (OPL::Config::parse("db") <= 0) {
+ warning("The DOSBox AdLib emulator is not compiled in. Please keep in mind that the MAME one is buggy");
+ } else
+ oplDriver = "db";
- _freeData = false;
+ } else if (oplDriver == "mame") {
+ // User has selected the MAME OPL driver. It is buggy, so warn the user about that.
- _repCount = -1;
- _samplesTillPoll = 0;
+ warning("You have selected the MAME AdLib emulator. It is buggy; AdLib music might be slightly glitchy now");
+ }
- for (int i = 0; i < 16; i ++)
- _pollNotes[i] = 0;
- setFreqs();
+ _opl = OPL::Config::create(OPL::Config::parse(oplDriver), OPL::Config::kOpl2);
+ if (!_opl || !_opl->init(_rate)) {
+ delete _opl;
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_handle,
- this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ error("Could not create an AdLib emulator");
+ }
}
int AdLib::readBuffer(int16 *buffer, const int numSamples) {
Common::StackLock slock(_mutex);
- int samples;
- int render;
- if (!_playing || (numSamples < 0)) {
+ // Nothing to do, fill with silence
+ if (!_playing) {
memset(buffer, 0, numSamples * sizeof(int16));
return numSamples;
}
- if (_first) {
- memset(buffer, 0, numSamples * sizeof(int16));
- pollMusic();
- return numSamples;
- }
- samples = numSamples;
+ // Read samples from the OPL, polling in more music when necessary
+ uint32 samples = numSamples;
while (samples && _playing) {
- if (_samplesTillPoll) {
- render = (samples > _samplesTillPoll) ? (_samplesTillPoll) : (samples);
+ if (_toPoll) {
+ const uint32 render = MIN(samples, _toPoll);
+
+ _opl->readBuffer(buffer, render);
+
+ buffer += render;
samples -= render;
- _samplesTillPoll -= render;
- YM3812UpdateOne(_opl, buffer, render);
- buffer += render;
+ _toPoll -= render;
+
} else {
- pollMusic();
+ // Song ended, fill the rest with silence
if (_ended) {
memset(buffer, 0, samples * sizeof(int16));
samples = 0;
+ break;
}
+
+ // Poll more music
+ _toPoll = pollMusic(_first);
+ _first = false;
}
}
+ // Song ended, loop if requested
if (_ended) {
- _first = true;
- _ended = false;
+ _toPoll = 0;
- rewind();
+ // _repCount == 0: No looping (anymore); _repCount < 0: Infinite looping
+ if (_repCount != 0) {
+ if (_repCount > 0)
+ _repCount--;
+
+ _first = true;
+ _ended = false;
- _samplesTillPoll = 0;
- if (_repCount == -1) {
- reset();
- setVoices();
- } else if (_repCount > 0) {
- _repCount--;
reset();
- setVoices();
- }
- else
+ rewind();
+ } else
_playing = false;
}
- return numSamples;
-}
-void AdLib::writeOPL(byte reg, byte val) {
- debugC(6, kDebugSound, "AdLib::writeOPL (%02X, %02X)", reg, val);
- OPLWriteReg(_opl, reg, val);
+ return numSamples;
}
-void AdLib::setFreqs() {
- byte lin;
- byte col;
- long val = 0;
-
- // Run through the 11 channels
- for (lin = 0; lin < 11; lin ++) {
- _notes[lin] = 0;
- _notCol[lin] = 0;
- _notLin[lin] = 0;
- _notOn[lin] = false;
- }
-
- // Run through the 25 lines
- for (lin = 0; lin < 25; lin ++) {
- // Run through the 12 columns
- for (col = 0; col < 12; col ++) {
- if (!col)
- val = (((0x2710L + lin * 0x18) * 0xCB78 / 0x3D090) << 0xE) *
- 9 / 0x1B503;
- _freqs[lin][col] = (short)((val + 4) >> 3);
- val = val * 0x6A / 0x64;
- }
- }
+bool AdLib::isStereo() const {
+ return _opl->isStereo();
}
-void AdLib::reset() {
- _first = true;
- OPLResetChip(_opl);
- _samplesTillPoll = 0;
-
- setFreqs();
- // Set frequencies and octave to 0; notes off
- for (int i = 0; i < 9; i++) {
- writeOPL(0xA0 | i, 0);
- writeOPL(0xB0 | i, 0);
- writeOPL(0xE0 | _operators[i] , 0);
- writeOPL(0xE0 |(_operators[i] + 3), 0);
- }
-
- // Authorize the control of the waveformes
- writeOPL(0x01, 0x20);
-}
-
-void AdLib::setKey(byte voice, byte note, bool on, bool spec) {
- short freq = 0;
- short octa = 0;
-
- // Instruction AX
- if (spec) {
- // 0x7F donne 0x16B;
- // 7F
- // << 7 = 3F80
- // + E000 = 11F80
- // & FFFF = 1F80
- // * 19 = 31380
- // / 2000 = 18 => Ligne 18h, colonne 0 => freq 16B
-
- // 0x3A donne 0x2AF;
- // 3A
- // << 7 = 1D00
- // + E000 = FD00 negatif
- // * 19 = xB500
- // / 2000 = -2 => Ligne 17h, colonne -1
-
- // 2E
- // << 7 = 1700
- // + E000 = F700 negatif
- // * 19 = x1F00
- // / 2000 =
- short a;
- short lin;
- short col;
-
- a = (note << 7) + 0xE000; // Volontairement tronque
- a = (short)((long)a * 25 / 0x2000);
- if (a < 0) {
- col = - ((24 - a) / 25);
- lin = (-a % 25);
- if (lin)
- lin = 25 - lin;
- }
- else {
- col = a / 25;
- lin = a % 25;
- }
-
- _notCol[voice] = col;
- _notLin[voice] = lin;
- note = _notes[voice];
- }
- // Instructions 0X 9X 8X
- else {
- note -= 12;
- _notOn[voice] = on;
- }
-
- _notes[voice] = note;
- note += _notCol[voice];
- note = MIN((byte) 0x5F, note);
- octa = note / 12;
- freq = _freqs[_notLin[voice]][note - octa * 12];
-
- writeOPL(0xA0 + voice, freq & 0xFF);
- writeOPL(0xB0 + voice, (freq >> 8) | (octa << 2) | (0x20 * (on ? 1 : 0)));
-
- if (!freq)
- warning("AdLib::setKey Voice %d, note %02X unknown", voice, note);
+bool AdLib::endOfData() const {
+ return !_playing;
}
-void AdLib::setVolume(byte voice, byte volume) {
- debugC(6, kDebugSound, "AdLib::setVolume(%d, %d)", voice, volume);
- //assert(voice >= 0 && voice <= 9);
- volume = 0x3F - ((volume * 0x7E) + 0x7F) / 0xFE;
- writeOPL(0x40 + _volRegNums[voice], volume);
+bool AdLib::endOfStream() const {
+ return false;
}
-void AdLib::pollMusic() {
- if ((_playPos > (_data + _dataSize)) && (_dataSize != 0xFFFFFFFF)) {
- _ended = true;
- return;
- }
-
- interpret();
-}
-
-void AdLib::unload() {
- _playing = false;
- _index = -1;
-
- if (_data && _freeData)
- delete[] _data;
-
- _freeData = false;
+int AdLib::getRate() const {
+ return _rate;
}
bool AdLib::isPlaying() const {
return _playing;
}
-bool AdLib::getRepeating() const {
- return _repCount != 0;
+int32 AdLib::getRepeating() const {
+ Common::StackLock slock(_mutex);
+
+ return _repCount;
}
void AdLib::setRepeating(int32 repCount) {
+ Common::StackLock slock(_mutex);
+
_repCount = repCount;
}
-int AdLib::getIndex() const {
- return _index;
+uint32 AdLib::getSamplesPerSecond() const {
+ return _rate * (isStereo() ? 2 : 1);
}
void AdLib::startPlay() {
- if (_data) _playing = true;
+ Common::StackLock slock(_mutex);
+
+ _playing = true;
+ _ended = false;
+ _first = true;
+
+ reset();
+ rewind();
}
void AdLib::stopPlay() {
Common::StackLock slock(_mutex);
+
+ end(true);
+
_playing = false;
}
-ADLPlayer::ADLPlayer(Audio::Mixer &mixer) : AdLib(mixer) {
-}
+void AdLib::writeOPL(byte reg, byte val) {
+ debugC(6, kDebugSound, "AdLib::writeOPL (%02X, %02X)", reg, val);
-ADLPlayer::~ADLPlayer() {
+ _opl->writeReg(reg, val);
}
-bool ADLPlayer::load(const char *fileName) {
- Common::File song;
+void AdLib::reset() {
+ allOff();
+ initOPL();
+}
- unload();
- song.open(fileName);
- if (!song.isOpen())
- return false;
+void AdLib::allOff() {
+ // NOTE: Explicit casts are necessary, because of 5.16 paragraph 4 of the C++ standard
+ int numVoices = isPercussionMode() ? (int)kMaxVoiceCount : (int)kMelodyVoiceCount;
- _freeData = true;
- _dataSize = song.size();
- _data = new byte[_dataSize];
- song.read(_data, _dataSize);
- song.close();
+ for (int i = 0; i < numVoices; i++)
+ noteOff(i);
+}
+void AdLib::end(bool killRepeat) {
reset();
- setVoices();
- _playPos = _data + 3 + (_data[1] + 1) * 0x38;
- return true;
+ _ended = true;
+
+ if (killRepeat)
+ _repCount = 0;
}
-bool ADLPlayer::load(byte *data, uint32 size, int index) {
- unload();
- _repCount = 0;
+void AdLib::initOPL() {
+ _tremoloDepth = false;
+ _vibratoDepth = false;
+ _keySplit = false;
- _dataSize = size;
- _data = data;
- _index = index;
+ _enableWaveSelect = true;
- reset();
- setVoices();
- _playPos = _data + 3 + (_data[1] + 1) * 0x38;
+ for (int i = 0; i < kMaxVoiceCount; i++) {
+ _voiceNote[i] = 0;
+ _voiceOn [i] = 0;
+ }
+
+ _opl->reset();
+
+ initOperatorVolumes();
+ resetFreqs();
+
+ setPercussionMode(false);
+
+ setTremoloDepth(false);
+ setVibratoDepth(false);
+ setKeySplit(false);
+
+ for(int i = 0; i < kMelodyVoiceCount; i++)
+ voiceOff(i);
- return true;
+ setPitchRange(1);
+
+ enableWaveSelect(true);
}
-void ADLPlayer::unload() {
- AdLib::unload();
+bool AdLib::isPercussionMode() const {
+ return _percussionMode;
}
-void ADLPlayer::interpret() {
- unsigned char instr;
- byte channel;
- byte note;
- byte volume;
- uint16 tempo;
+void AdLib::setPercussionMode(bool percussion) {
+ if (percussion) {
+ voiceOff(kVoiceBaseDrum);
+ voiceOff(kVoiceSnareDrum);
+ voiceOff(kVoiceTom);
- // First tempo, we'll ignore it...
- if (_first) {
- tempo = *(_playPos++);
- // Tempo on 2 bytes
- if (tempo & 0x80)
- tempo = ((tempo & 3) << 8) | *(_playPos++);
- }
- _first = false;
-
- // Instruction
- instr = *(_playPos++);
- channel = instr & 0x0F;
-
- switch (instr & 0xF0) {
- // Note on + Volume
- case 0x00:
- note = *(_playPos++);
- _pollNotes[channel] = note;
- setVolume(channel, *(_playPos++));
- setKey(channel, note, true, false);
- break;
- // Note on
- case 0x90:
- note = *(_playPos++);
- _pollNotes[channel] = note;
- setKey(channel, note, true, false);
- break;
- // Last note off
- case 0x80:
- note = _pollNotes[channel];
- setKey(channel, note, false, false);
- break;
- // Frequency on/off
- case 0xA0:
- note = *(_playPos++);
- setKey(channel, note, _notOn[channel], true);
- break;
- // Volume
- case 0xB0:
- volume = *(_playPos++);
- setVolume(channel, volume);
- break;
- // Program change
- case 0xC0:
- setVoice(channel, *(_playPos++), false);
- break;
- // Special
- case 0xF0:
- switch (instr & 0x0F) {
- case 0xF: // End instruction
- _ended = true;
- _samplesTillPoll = 0;
- return;
- default:
- warning("ADLPlayer: Unknown special command %X, stopping playback",
- instr & 0x0F);
- _repCount = 0;
- _ended = true;
- break;
- }
- break;
- default:
- warning("ADLPlayer: Unknown command %X, stopping playback",
- instr & 0xF0);
- _repCount = 0;
- _ended = true;
- break;
+ /* set the frequency for the last 4 percussion voices: */
+ setFreq(kVoiceTom, kPitchTom, 0);
+ setFreq(kVoiceSnareDrum, kPitchSnareDrum, 0);
}
- // Temporization
- tempo = *(_playPos++);
- // End tempo
- if (tempo == 0xFF) {
- _ended = true;
- return;
- }
- // Tempo on 2 bytes
- if (tempo & 0x80)
- tempo = ((tempo & 3) << 8) | *(_playPos++);
- if (!tempo)
- tempo ++;
+ _percussionMode = percussion;
+ _percussionBits = 0;
- _samplesTillPoll = tempo * (_rate / 1000);
+ initOperatorParams();
+ writeTremoloVibratoDepthPercMode();
}
-void ADLPlayer::reset() {
- AdLib::reset();
+void AdLib::enableWaveSelect(bool enable) {
+ _enableWaveSelect = enable;
+
+ for (int i = 0; i < kOperatorCount; i++)
+ writeOPL(0xE0 + kOperatorOffset[i], 0);
+
+ writeOPL(0x011, _enableWaveSelect ? 0x20 : 0);
}
-void ADLPlayer::rewind() {
- _playPos = _data + 3 + (_data[1] + 1) * 0x38;
+void AdLib::setPitchRange(uint8 range) {
+ _pitchRange = CLIP<uint8>(range, 0, 12);
+ _pitchRangeStep = _pitchRange * kPitchStepCount;
}
-void ADLPlayer::setVoices() {
- // Definitions of the 9 instruments
- for (int i = 0; i < 9; i++)
- setVoice(i, i, true);
+void AdLib::setTremoloDepth(bool tremoloDepth) {
+ _tremoloDepth = tremoloDepth;
+
+ writeTremoloVibratoDepthPercMode();
}
-void ADLPlayer::setVoice(byte voice, byte instr, bool set) {
- uint16 strct[27];
- byte channel;
- byte *dataPtr;
+void AdLib::setVibratoDepth(bool vibratoDepth) {
+ _vibratoDepth = vibratoDepth;
- // i = 0 : 0 1 2 3 4 5 6 7 8 9 10 11 12 26
- // i = 1 : 13 14 15 16 17 18 19 20 21 22 23 24 25 27
- for (int i = 0; i < 2; i++) {
- dataPtr = _data + 3 + instr * 0x38 + i * 0x1A;
- for (int j = 0; j < 27; j++) {
- strct[j] = READ_LE_UINT16(dataPtr);
- dataPtr += 2;
- }
- channel = _operators[voice] + i * 3;
- writeOPL(0xBD, 0x00);
- writeOPL(0x08, 0x00);
- writeOPL(0x40 | channel, ((strct[0] & 3) << 6) | (strct[8] & 0x3F));
- if (!i)
- writeOPL(0xC0 | voice,
- ((strct[2] & 7) << 1) | (1 - (strct[12] & 1)));
- writeOPL(0x60 | channel, ((strct[3] & 0xF) << 4) | (strct[6] & 0xF));
- writeOPL(0x80 | channel, ((strct[4] & 0xF) << 4) | (strct[7] & 0xF));
- writeOPL(0x20 | channel, ((strct[9] & 1) << 7) |
- ((strct[10] & 1) << 6) | ((strct[5] & 1) << 5) |
- ((strct[11] & 1) << 4) | (strct[1] & 0xF));
- if (!i)
- writeOPL(0xE0 | channel, (strct[26] & 3));
- else
- writeOPL(0xE0 | channel, (strct[14] & 3));
- if (i && set)
- writeOPL(0x40 | channel, 0);
+ writeTremoloVibratoDepthPercMode();
+}
+
+void AdLib::setKeySplit(bool keySplit) {
+ _keySplit = keySplit;
+
+ writeKeySplit();
+}
+
+void AdLib::setVoiceTimbre(uint8 voice, const uint16 *params) {
+ const uint16 *params0 = params;
+ const uint16 *params1 = params + kParamCount - 1;
+ const uint16 *waves = params + 2 * (kParamCount - 1);
+
+ const int voicePerc = voice - kVoiceBaseDrum;
+
+ if (!isPercussionMode() || (voice < kVoiceBaseDrum)) {
+ setOperatorParams(kVoiceMelodyOperator[0][voice], params0, waves[0]);
+ setOperatorParams(kVoiceMelodyOperator[1][voice], params1, waves[1]);
+ } else if (voice == kVoiceBaseDrum) {
+ setOperatorParams(kVoicePercussionOperator[0][voicePerc], params0, waves[0]);
+ setOperatorParams(kVoicePercussionOperator[1][voicePerc], params1, waves[1]);
+ } else {
+ setOperatorParams(kVoicePercussionOperator[0][voicePerc], params0, waves[0]);
}
}
+void AdLib::setVoiceVolume(uint8 voice, uint8 volume) {
+ int oper;
+
+ const int voicePerc = voice - kVoiceBaseDrum;
-MDYPlayer::MDYPlayer(Audio::Mixer &mixer) : AdLib(mixer) {
- init();
+ if (!isPercussionMode() || (voice < kVoiceBaseDrum))
+ oper = kVoiceMelodyOperator[1][ voice];
+ else
+ oper = kVoicePercussionOperator[voice == kVoiceBaseDrum ? 1 : 0][voicePerc];
+
+ _operatorVolume[oper] = MIN<uint8>(volume, kMaxVolume);
+ writeKeyScaleLevelVolume(oper);
}
-MDYPlayer::~MDYPlayer() {
+void AdLib::bendVoicePitch(uint8 voice, uint16 pitchBend) {
+ if (isPercussionMode() && (voice > kVoiceBaseDrum))
+ return;
+
+ changePitch(voice, MIN<uint16>(pitchBend, kMaxPitch));
+ setFreq(voice, _voiceNote[voice], _voiceOn[voice]);
}
-void MDYPlayer::init() {
- _soundMode = 0;
+void AdLib::noteOn(uint8 voice, uint8 note) {
+ note = MAX<int>(0, note - (kStandardMidC - kOPLMidC));
+
+ if (isPercussionMode() && (voice >= kVoiceBaseDrum)) {
+
+ if (voice == kVoiceBaseDrum) {
+ setFreq(kVoiceBaseDrum , note , false);
+ } else if (voice == kVoiceTom) {
+ setFreq(kVoiceTom , note , false);
+ setFreq(kVoiceSnareDrum, note + kPitchTomToSnare, false);
+ }
+
+ _percussionBits |= kPercussionMasks[voice - kVoiceBaseDrum];
+ writeTremoloVibratoDepthPercMode();
- _timbres = 0;
- _tbrCount = 0;
- _tbrStart = 0;
- _timbresSize = 0;
+ } else
+ setFreq(voice, note, true);
}
-bool MDYPlayer::loadMDY(Common::SeekableReadStream &stream) {
- unloadMDY();
+void AdLib::noteOff(uint8 voice) {
+ if (isPercussionMode() && (voice >= kVoiceBaseDrum)) {
+ _percussionBits &= ~kPercussionMasks[voice - kVoiceBaseDrum];
+ writeTremoloVibratoDepthPercMode();
+ } else
+ setFreq(voice, _voiceNote[voice], false);
+}
- _freeData = true;
+void AdLib::writeKeyScaleLevelVolume(uint8 oper) {
+ uint16 volume = 0;
- byte mdyHeader[70];
- stream.read(mdyHeader, 70);
+ volume = (63 - (_operatorParams[oper][kParamLevel] & 0x3F)) * _operatorVolume[oper];
+ volume = 63 - ((2 * volume + kMaxVolume) / (2 * kMaxVolume));
- _tickBeat = mdyHeader[36];
- _beatMeasure = mdyHeader[37];
- _totalTick = mdyHeader[38] + (mdyHeader[39] << 8) + (mdyHeader[40] << 16) + (mdyHeader[41] << 24);
- _dataSize = mdyHeader[42] + (mdyHeader[43] << 8) + (mdyHeader[44] << 16) + (mdyHeader[45] << 24);
- _nrCommand = mdyHeader[46] + (mdyHeader[47] << 8) + (mdyHeader[48] << 16) + (mdyHeader[49] << 24);
-// _soundMode is either 0 (melodic) or 1 (percussive)
- _soundMode = mdyHeader[58];
- assert((_soundMode == 0) || (_soundMode == 1));
+ uint8 keyScale = _operatorParams[oper][kParamKeyScaleLevel] << 6;
- _pitchBendRangeStep = 25*mdyHeader[59];
- _basicTempo = mdyHeader[60] + (mdyHeader[61] << 8);
+ writeOPL(0x40 + kOperatorOffset[oper], volume | keyScale);
+}
- if (_pitchBendRangeStep < 25)
- _pitchBendRangeStep = 25;
- else if (_pitchBendRangeStep > 300)
- _pitchBendRangeStep = 300;
+void AdLib::writeKeySplit() {
+ writeOPL(0x08, _keySplit ? 0x40 : 0);
+}
- _data = new byte[_dataSize];
- stream.read(_data, _dataSize);
+void AdLib::writeFeedbackFM(uint8 oper) {
+ if (kOperatorType[oper] == 1)
+ return;
- reset();
- _playPos = _data;
+ uint8 value = 0;
- return true;
+ value |= _operatorParams[oper][kParamFeedback] << 1;
+ value |= _operatorParams[oper][kParamFM] ? 0 : 1;
+
+ writeOPL(0xC0 + kOperatorVoice[oper], value);
}
-bool MDYPlayer::loadMDY(const char *fileName) {
- Common::File song;
+void AdLib::writeAttackDecay(uint8 oper) {
+ uint8 value = 0;
+
+ value |= _operatorParams[oper][kParamAttack] << 4;
+ value |= _operatorParams[oper][kParamDecay] & 0x0F;
- song.open(fileName);
- if (!song.isOpen())
- return false;
+ writeOPL(0x60 + kOperatorOffset[oper], value);
+}
- bool loaded = loadMDY(song);
+void AdLib::writeSustainRelease(uint8 oper) {
+ uint8 value = 0;
- song.close();
+ value |= _operatorParams[oper][kParamSustain] << 4;
+ value |= _operatorParams[oper][kParamRelease] & 0x0F;
- return loaded;
+ writeOPL(0x80 + kOperatorOffset[oper], value);
}
-bool MDYPlayer::loadTBR(Common::SeekableReadStream &stream) {
- unloadTBR();
+void AdLib::writeTremoloVibratoSustainingKeyScaleRateFreqMulti(uint8 oper) {
+ uint8 value = 0;
- _timbresSize = stream.size();
+ value |= _operatorParams[oper][kParamAM] ? 0x80 : 0;
+ value |= _operatorParams[oper][kParamVib] ? 0x40 : 0;
+ value |= _operatorParams[oper][kParamSustaining] ? 0x20 : 0;
+ value |= _operatorParams[oper][kParamKeyScaleRate] ? 0x10 : 0;
+ value |= _operatorParams[oper][kParamFreqMulti] & 0x0F;
- _timbres = new byte[_timbresSize];
- stream.read(_timbres, _timbresSize);
+ writeOPL(0x20 + kOperatorOffset[oper], value);
+}
- reset();
- setVoices();
+void AdLib::writeTremoloVibratoDepthPercMode() {
+ uint8 value = 0;
+
+ value |= _tremoloDepth ? 0x80 : 0;
+ value |= _vibratoDepth ? 0x40 : 0;
+ value |= isPercussionMode() ? 0x20 : 0;
+ value |= _percussionBits;
- return true;
+ writeOPL(0xBD, value);
}
-bool MDYPlayer::loadTBR(const char *fileName) {
- Common::File timbres;
+void AdLib::writeWaveSelect(uint8 oper) {
+ uint8 wave = 0;
+ if (_enableWaveSelect)
+ wave = _operatorParams[oper][kParamWaveSelect] & 0x03;
- timbres.open(fileName);
- if (!timbres.isOpen())
- return false;
+ writeOPL(0xE0 + kOperatorOffset[ oper], wave);
+}
- bool loaded = loadTBR(timbres);
+void AdLib::writeAllParams(uint8 oper) {
+ writeTremoloVibratoDepthPercMode();
+ writeKeySplit();
+ writeKeyScaleLevelVolume(oper);
+ writeFeedbackFM(oper);
+ writeAttackDecay(oper);
+ writeSustainRelease(oper);
+ writeTremoloVibratoSustainingKeyScaleRateFreqMulti(oper);
+ writeWaveSelect(oper);
+}
- timbres.close();
+void AdLib::initOperatorParams() {
+ for (int i = 0; i < kOperatorCount; i++)
+ setOperatorParams(i, kPianoParams[kOperatorType[i]], kPianoParams[kOperatorType[i]][kParamCount - 1]);
- return loaded;
+ if (isPercussionMode()) {
+ setOperatorParams(12, kBaseDrumParams [0], kBaseDrumParams [0][kParamCount - 1]);
+ setOperatorParams(15, kBaseDrumParams [1], kBaseDrumParams [1][kParamCount - 1]);
+ setOperatorParams(16, kSnareDrumParams , kSnareDrumParams [kParamCount - 1]);
+ setOperatorParams(14, kTomParams , kTomParams [kParamCount - 1]);
+ setOperatorParams(17, kCymbalParams , kCymbalParams [kParamCount - 1]);
+ setOperatorParams(13, kHihatParams , kHihatParams [kParamCount - 1]);
+ }
}
-void MDYPlayer::unload() {
- unloadTBR();
- unloadMDY();
+void AdLib::initOperatorVolumes() {
+ for(int i = 0; i < kOperatorCount; i++)
+ _operatorVolume[i] = kMaxVolume;
}
-void MDYPlayer::unloadMDY() {
- AdLib::unload();
+void AdLib::setOperatorParams(uint8 oper, const uint16 *params, uint8 wave) {
+ byte *operParams = _operatorParams[oper];
+
+ for (int i = 0; i < (kParamCount - 1); i++)
+ operParams[i] = params[i];
+
+ operParams[kParamCount - 1] = wave & 0x03;
+
+ writeAllParams(oper);
+}
+
+void AdLib::voiceOff(uint8 voice) {
+ writeOPL(0xA0 + voice, 0);
+ writeOPL(0xB0 + voice, 0);
}
-void MDYPlayer::unloadTBR() {
- delete[] _timbres;
+int32 AdLib::calcFreq(int32 deltaDemiToneNum, int32 deltaDemiToneDenom) {
+ int32 freq = 0;
- _timbres = 0;
- _timbresSize = 0;
+ freq = ((deltaDemiToneDenom * 100) + 6 * deltaDemiToneNum) * 52088;
+ freq /= deltaDemiToneDenom * 2500;
+
+ return (freq * 147456) / 111875;
}
-void MDYPlayer::interpret() {
- unsigned char instr;
- byte channel;
- byte note;
- byte volume;
- uint8 tempoMult, tempoFrac;
- uint8 ctrlByte1, ctrlByte2;
- uint8 timbre;
+void AdLib::setFreqs(uint16 *freqs, int32 num, int32 denom) {
+ int32 val = calcFreq(num, denom);
-// TODO : Verify the loop for percussive mode (11 ?)
- if (_first) {
- for (int i = 0; i < 9; i ++)
- setVolume(i, 0);
+ *freqs++ = (4 + val) >> 3;
-// TODO : Set pitch range
+ for (int i = 1; i < kHalfToneCount; i++) {
+ val = (val * 106) / 100;
- _tempo = _basicTempo;
- _wait = *(_playPos++);
- _first = false;
+ *freqs++ = (4 + val) >> 3;
}
- do {
- instr = *_playPos;
- debugC(6, kDebugSound, "MDYPlayer::interpret instr 0x%X", instr);
- switch (instr) {
- case 0xF8:
- _wait = *(_playPos++);
- break;
- case 0xFC:
- _ended = true;
- _samplesTillPoll = 0;
- return;
- case 0xF0:
- _playPos++;
- ctrlByte1 = *(_playPos++);
- ctrlByte2 = *(_playPos++);
- debugC(6, kDebugSound, "MDYPlayer::interpret ctrlBytes 0x%X 0x%X", ctrlByte1, ctrlByte2);
- if (ctrlByte1 != 0x7F || ctrlByte2 != 0) {
- _playPos -= 2;
- while (*(_playPos++) != 0xF7)
- ;
- } else {
- tempoMult = *(_playPos++);
- tempoFrac = *(_playPos++);
- _tempo = _basicTempo * tempoMult + (unsigned)(((long)_basicTempo * tempoFrac) >> 7);
- _playPos++;
- }
- _wait = *(_playPos++);
- break;
- default:
- if (instr >= 0x80) {
- _playPos++;
- }
- channel = (int)(instr & 0x0f);
-
- switch (instr & 0xf0) {
- case 0x90:
- note = *(_playPos++);
- volume = *(_playPos++);
- _pollNotes[channel] = note;
- setVolume(channel, volume);
- setKey(channel, note, true, false);
- break;
- case 0x80:
- _playPos += 2;
- note = _pollNotes[channel];
- setKey(channel, note, false, false);
- break;
- case 0xA0:
- setVolume(channel, *(_playPos++));
- break;
- case 0xC0:
- timbre = *(_playPos++);
- setVoice(channel, timbre, false);
- break;
- case 0xE0:
- warning("MDYPlayer: Pitch bend not yet implemented");
+}
- note = *(_playPos)++;
- note += (unsigned)(*(_playPos++)) << 7;
+void AdLib::initFreqs() {
+ const int numStep = 100 / kPitchStepCount;
- setKey(channel, note, _notOn[channel], true);
+ for (int i = 0; i < kPitchStepCount; i++)
+ setFreqs(_freqs[i], i * numStep, 100);
- break;
- case 0xB0:
- _playPos += 2;
- break;
- case 0xD0:
- _playPos++;
- break;
- default:
- warning("MDYPlayer: Bad MIDI instr byte: 0%X", instr);
- while ((*_playPos) < 0x80)
- _playPos++;
- if (*_playPos != 0xF8)
- _playPos--;
- break;
- } //switch instr & 0xF0
- _wait = *(_playPos++);
- break;
- } //switch instr
- } while (_wait == 0);
-
- if (_wait == 0xF8) {
- _wait = 0xF0;
- if (*_playPos != 0xF8)
- _wait += *(_playPos++) & 0x0F;
+ resetFreqs();
+}
+
+void AdLib::resetFreqs() {
+ for (int i = 0; i < kMaxVoiceCount; i++) {
+ _freqPtr [i] = _freqs[0];
+ _halfToneOffset[i] = 0;
}
-// _playPos++;
- _samplesTillPoll = _wait * (_rate / 1000);
}
-void MDYPlayer::reset() {
- AdLib::reset();
+void AdLib::changePitch(uint8 voice, uint16 pitchBend) {
+
+ int full = 0;
+ int frac = 0;
+ int amount = ((pitchBend - kMidPitch) * _pitchRangeStep) / kMidPitch;
+
+ if (amount >= 0) {
+ // Bend up
+
+ full = amount / kPitchStepCount;
+ frac = amount % kPitchStepCount;
-// _soundMode 1 : Percussive mode.
- if (_soundMode == 1) {
- writeOPL(0xA6, 0);
- writeOPL(0xB6, 0);
- writeOPL(0xA7, 0);
- writeOPL(0xB7, 0);
- writeOPL(0xA8, 0);
- writeOPL(0xB8, 0);
+ } else {
+ // Bend down
+
+ amount = kPitchStepCount - 1 - amount;
+
+ full = -(amount / kPitchStepCount);
+ frac = (amount - kPitchStepCount + 1) % kPitchStepCount;
+ if (frac)
+ frac = kPitchStepCount - frac;
-// TODO set the correct frequency for the last 4 percussive voices
}
+
+ _halfToneOffset[voice] = full;
+ _freqPtr [voice] = _freqs[frac];
}
-void MDYPlayer::rewind() {
- _playPos = _data;
-}
-
-void MDYPlayer::setVoices() {
- byte *timbrePtr;
-
- timbrePtr = _timbres;
- debugC(6, kDebugSound, "MDYPlayer::setVoices TBR version: %X.%X", timbrePtr[0], timbrePtr[1]);
- timbrePtr += 2;
-
- _tbrCount = READ_LE_UINT16(timbrePtr);
- debugC(6, kDebugSound, "MDYPlayer::setVoices Timbres counter: %d", _tbrCount);
- timbrePtr += 2;
- _tbrStart = READ_LE_UINT16(timbrePtr);
-
- timbrePtr += 2;
- for (int i = 0; i < _tbrCount; i++)
- setVoice(i, i, true);
-}
-
-void MDYPlayer::setVoice(byte voice, byte instr, bool set) {
-// uint16 strct[27];
- uint8 strct[27];
- byte channel;
- byte *timbrePtr;
- char timbreName[10];
-
- timbreName[9] = '\0';
- for (int j = 0; j < 9; j++)
- timbreName[j] = _timbres[6 + j + (instr * 9)];
- debugC(6, kDebugSound, "MDYPlayer::setVoice Loading timbre %s", timbreName);
-
- // i = 0 : 0 1 2 3 4 5 6 7 8 9 10 11 12 26
- // i = 1 : 13 14 15 16 17 18 19 20 21 22 23 24 25 27
- for (int i = 0; i < 2; i++) {
- timbrePtr = _timbres + _tbrStart + instr * 0x38 + i * 0x1A;
- for (int j = 0; j < 27; j++) {
- if (timbrePtr >= (_timbres + _timbresSize)) {
- warning("MDYPlayer: Instrument %d out of range (%d, %d)", instr,
- (uint32) (timbrePtr - _timbres), _timbresSize);
- strct[j] = 0;
- } else
- //strct[j] = READ_LE_UINT16(timbrePtr);
- strct[j] = timbrePtr[0];
- //timbrePtr += 2;
- timbrePtr++;
- }
- channel = _operators[voice] + i * 3;
- writeOPL(0xBD, 0x00);
- writeOPL(0x08, 0x00);
- writeOPL(0x40 | channel, ((strct[0] & 3) << 6) | (strct[8] & 0x3F));
- if (!i)
- writeOPL(0xC0 | voice,
- ((strct[2] & 7) << 1) | (1 - (strct[12] & 1)));
- writeOPL(0x60 | channel, ((strct[3] & 0xF) << 4) | (strct[6] & 0xF));
- writeOPL(0x80 | channel, ((strct[4] & 0xF) << 4) | (strct[7] & 0xF));
- writeOPL(0x20 | channel, ((strct[9] & 1) << 7) |
- ((strct[10] & 1) << 6) | ((strct[5] & 1) << 5) |
- ((strct[11] & 1) << 4) | (strct[1] & 0xF));
- if (!i)
- writeOPL(0xE0 | channel, (strct[26] & 3));
- else {
- writeOPL(0xE0 | channel, (strct[14] & 3));
- writeOPL(0x40 | channel, 0);
- }
- }
+void AdLib::setFreq(uint8 voice, uint16 note, bool on) {
+ _voiceOn [voice] = on;
+ _voiceNote[voice] = note;
+
+ note = CLIP<int>(note + _halfToneOffset[voice], 0, kNoteCount - 1);
+
+ uint16 freq = _freqPtr[voice][note % kHalfToneCount];
+
+ uint8 value = 0;
+ value |= on ? 0x20 : 0;
+ value |= ((note / kHalfToneCount) << 2) | ((freq >> 8) & 0x03);
+
+ writeOPL(0xA0 + voice, freq);
+ writeOPL(0xB0 + voice, value);
}
} // End of namespace Gob
diff --git a/engines/gob/sound/adlib.h b/engines/gob/sound/adlib.h
index 934e9966eb..bd1778d2ed 100644
--- a/engines/gob/sound/adlib.h
+++ b/engines/gob/sound/adlib.h
@@ -24,148 +24,282 @@
#define GOB_SOUND_ADLIB_H
#include "common/mutex.h"
+
#include "audio/audiostream.h"
#include "audio/mixer.h"
-#include "audio/fmopl.h"
-namespace Gob {
+namespace OPL {
+ class OPL;
+}
-class GobEngine;
+namespace Gob {
+/** Base class for a player of an AdLib music format. */
class AdLib : public Audio::AudioStream {
public:
AdLib(Audio::Mixer &mixer);
virtual ~AdLib();
- bool isPlaying() const;
- int getIndex() const;
- bool getRepeating() const;
+ bool isPlaying() const; ///< Are we currently playing?
+ int32 getRepeating() const; ///< Return number of times left to loop.
+ /** Set the loop counter.
+ *
+ * @param repCount Number of times to loop (i.e. number of additional
+ * paythroughs to the first one, not overall).
+ * A negative value means infinite looping.
+ */
void setRepeating(int32 repCount);
void startPlay();
void stopPlay();
- virtual void unload();
-
// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const { return false; }
- bool endOfData() const { return !_playing; }
- bool endOfStream() const { return false; }
- int getRate() const { return _rate; }
+ bool isStereo() const;
+ bool endOfData() const;
+ bool endOfStream() const;
+ int getRate() const;
protected:
- static const unsigned char _operators[];
- static const unsigned char _volRegNums [];
+ enum kVoice {
+ kVoiceMelody0 = 0,
+ kVoiceMelody1 = 1,
+ kVoiceMelody2 = 2,
+ kVoiceMelody3 = 3,
+ kVoiceMelody4 = 4,
+ kVoiceMelody5 = 5,
+ kVoiceMelody6 = 6, // Only available in melody mode.
+ kVoiceMelody7 = 7, // Only available in melody mode.
+ kVoiceMelody8 = 8, // Only available in melody mode.
+ kVoiceBaseDrum = 6, // Only available in percussion mode.
+ kVoiceSnareDrum = 7, // Only available in percussion mode.
+ kVoiceTom = 8, // Only available in percussion mode.
+ kVoiceCymbal = 9, // Only available in percussion mode.
+ kVoiceHihat = 10 // Only available in percussion mode.
+ };
+
+ /** Operator parameters. */
+ enum kParam {
+ kParamKeyScaleLevel = 0,
+ kParamFreqMulti = 1,
+ kParamFeedback = 2,
+ kParamAttack = 3,
+ kParamSustain = 4,
+ kParamSustaining = 5,
+ kParamDecay = 6,
+ kParamRelease = 7,
+ kParamLevel = 8,
+ kParamAM = 9,
+ kParamVib = 10,
+ kParamKeyScaleRate = 11,
+ kParamFM = 12,
+ kParamWaveSelect = 13
+ };
+
+ static const int kOperatorCount = 18; ///< Number of operators.
+ static const int kParamCount = 14; ///< Number of operator parameters.
+ static const int kPitchStepCount = 25; ///< Number of pitch bend steps in a half tone.
+ static const int kOctaveCount = 8; ///< Number of octaves we can play.
+ static const int kHalfToneCount = 12; ///< Number of half tones in an octave.
+
+ static const int kOperatorsPerVoice = 2; ///< Number of operators per voice.
+
+ static const int kMelodyVoiceCount = 9; ///< Number of melody voices.
+ static const int kPercussionVoiceCount = 5; ///< Number of percussion voices.
+ static const int kMaxVoiceCount = 11; ///< Max number of voices.
+
+ /** Number of notes we can play. */
+ static const int kNoteCount = kHalfToneCount * kOctaveCount;
+
+ static const int kMaxVolume = 0x007F;
+ static const int kMaxPitch = 0x3FFF;
+ static const int kMidPitch = 0x2000;
+
+ static const int kStandardMidC = 60; ///< A mid C in standard MIDI.
+ static const int kOPLMidC = 48; ///< A mid C for the OPL.
+
+
+ /** Return the number of samples per second. */
+ uint32 getSamplesPerSecond() const;
+
+ /** Write a value into an OPL register. */
+ void writeOPL(byte reg, byte val);
+
+ /** Signal that the playback ended.
+ *
+ * @param killRepeat Explicitly request that the song is not to be looped.
+ */
+ void end(bool killRepeat = false);
+
+ /** The callback function that's called for polling more AdLib commands.
+ *
+ * @param first Is this the first poll since the start of the song?
+ * @return The number of samples until the next poll.
+ */
+ virtual uint32 pollMusic(bool first) = 0;
+
+ /** Rewind the song. */
+ virtual void rewind() = 0;
+
+ /** Return whether we're in percussion mode. */
+ bool isPercussionMode() const;
+
+ /** Set percussion or melody mode. */
+ void setPercussionMode(bool percussion);
+
+ /** Enable/Disable the wave select operator parameters.
+ *
+ * When disabled, all operators use the sine wave, regardless of the parameter.
+ */
+ void enableWaveSelect(bool enable);
+
+ /** Change the pitch bend range.
+ *
+ * @param range The range in half tones from 1 to 12 inclusive.
+ * See bendVoicePitch() for how this works in practice.
+ */
+ void setPitchRange(uint8 range);
+
+ /** Set the tremolo (amplitude vibrato) depth.
+ *
+ * @param tremoloDepth false: 1.0dB, true: 4.8dB.
+ */
+ void setTremoloDepth(bool tremoloDepth);
+
+ /** Set the frequency vibrato depth.
+ *
+ * @param vibratoDepth false: 7 cent, true: 14 cent. 1 cent = 1/100 half tone.
+ */
+ void setVibratoDepth(bool vibratoDepth);
+
+ /** Set the keyboard split point. */
+ void setKeySplit(bool keySplit);
+
+ /** Set the timbre of a voice.
+ *
+ * Layout of the operator parameters is as follows:
+ * - First 13 parameter for the first operator
+ * - First 13 parameter for the second operator
+ * - 14th parameter (wave select) for the first operator
+ * - 14th parameter (wave select) for the second operator
+ */
+ void setVoiceTimbre(uint8 voice, const uint16 *params);
+
+ /** Set a voice's volume. */
+ void setVoiceVolume(uint8 voice, uint8 volume);
+
+ /** Bend a voice's pitch.
+ *
+ * The pitchBend parameter is a value between 0 (full down) and kMaxPitch (full up).
+ * The actual frequency depends on the pitch range set previously by setPitchRange(),
+ * with full down being -range half tones and full up range half tones.
+ */
+ void bendVoicePitch(uint8 voice, uint16 pitchBend);
+
+ /** Switch a voice on.
+ *
+ * Plays one of the kNoteCount notes. However, the valid range of a note is between
+ * 0 and 127, of which only 12 to 107 are audible.
+ */
+ void noteOn(uint8 voice, uint8 note);
+
+ /** Switch a voice off. */
+ void noteOff(uint8 voice);
+
+private:
+ static const uint8 kOperatorType [kOperatorCount];
+ static const uint8 kOperatorOffset[kOperatorCount];
+ static const uint8 kOperatorVoice [kOperatorCount];
+
+ static const uint8 kVoiceMelodyOperator [kOperatorsPerVoice][kMelodyVoiceCount];
+ static const uint8 kVoicePercussionOperator[kOperatorsPerVoice][kPercussionVoiceCount];
+
+ static const byte kPercussionMasks[kPercussionVoiceCount];
+
+ static const uint16 kPianoParams [kOperatorsPerVoice][kParamCount];
+ static const uint16 kBaseDrumParams [kOperatorsPerVoice][kParamCount];
+
+ static const uint16 kSnareDrumParams[kParamCount];
+ static const uint16 kTomParams [kParamCount];
+ static const uint16 kCymbalParams [kParamCount];
+ static const uint16 kHihatParams [kParamCount];
+
Audio::Mixer *_mixer;
Audio::SoundHandle _handle;
- FM_OPL *_opl;
+ OPL::OPL *_opl;
Common::Mutex _mutex;
uint32 _rate;
- byte *_data;
- byte *_playPos;
- uint32 _dataSize;
-
- short _freqs[25][12];
- byte _notes[11];
- byte _notCol[11];
- byte _notLin[11];
- bool _notOn[11];
- byte _pollNotes[16];
+ uint32 _toPoll;
- int _samplesTillPoll;
int32 _repCount;
- bool _playing;
bool _first;
+ bool _playing;
bool _ended;
- bool _freeData;
+ bool _tremoloDepth;
+ bool _vibratoDepth;
+ bool _keySplit;
- int _index;
+ bool _enableWaveSelect;
- unsigned char _wait;
- uint8 _tickBeat;
- uint8 _beatMeasure;
- uint32 _totalTick;
- uint32 _nrCommand;
- uint16 _pitchBendRangeStep;
- uint16 _basicTempo, _tempo;
+ bool _percussionMode;
+ byte _percussionBits;
- void writeOPL(byte reg, byte val);
- void setFreqs();
- void setKey(byte voice, byte note, bool on, bool spec);
- void setVolume(byte voice, byte volume);
- void pollMusic();
+ uint8 _pitchRange;
+ uint16 _pitchRangeStep;
- virtual void interpret() = 0;
+ uint8 _voiceNote[kMaxVoiceCount]; // Last note of each voice
+ uint8 _voiceOn [kMaxVoiceCount]; // Whether each voice is currently on
- virtual void reset();
- virtual void rewind() = 0;
- virtual void setVoices() = 0;
+ uint8 _operatorVolume[kOperatorCount]; // Volume of each operator
-private:
- void init();
-};
+ byte _operatorParams[kOperatorCount][kParamCount]; // All operator parameters
-class ADLPlayer : public AdLib {
-public:
- ADLPlayer(Audio::Mixer &mixer);
- ~ADLPlayer();
+ uint16 _freqs[kPitchStepCount][kHalfToneCount];
+ uint16 *_freqPtr[kMaxVoiceCount];
- bool load(const char *fileName);
- bool load(byte *data, uint32 size, int index = -1);
+ int _halfToneOffset[kMaxVoiceCount];
- void unload();
-protected:
- void interpret();
+ void createOPL();
+ void initOPL();
void reset();
- void rewind();
+ void allOff();
- void setVoices();
- void setVoice(byte voice, byte instr, bool set);
-};
+ // Write global parameters into the OPL
+ void writeTremoloVibratoDepthPercMode();
+ void writeKeySplit();
-class MDYPlayer : public AdLib {
-public:
- MDYPlayer(Audio::Mixer &mixer);
- ~MDYPlayer();
-
- bool loadMDY(const char *fileName);
- bool loadMDY(Common::SeekableReadStream &stream);
- bool loadTBR(const char *fileName);
- bool loadTBR(Common::SeekableReadStream &stream);
-
- void unload();
-
-protected:
- byte _soundMode;
-
- byte *_timbres;
- uint16 _tbrCount;
- uint16 _tbrStart;
- uint32 _timbresSize;
+ // Write operator parameters into the OPL
+ void writeWaveSelect(uint8 oper);
+ void writeTremoloVibratoSustainingKeyScaleRateFreqMulti(uint8 oper);
+ void writeSustainRelease(uint8 oper);
+ void writeAttackDecay(uint8 oper);
+ void writeFeedbackFM(uint8 oper);
+ void writeKeyScaleLevelVolume(uint8 oper);
+ void writeAllParams(uint8 oper);
- void interpret();
+ void initOperatorParams();
+ void initOperatorVolumes();
+ void setOperatorParams(uint8 oper, const uint16 *params, uint8 wave);
- void reset();
- void rewind();
+ void voiceOff(uint8 voice);
- void setVoices();
- void setVoice(byte voice, byte instr, bool set);
+ void initFreqs();
+ void setFreqs(uint16 *freqs, int32 num, int32 denom);
+ int32 calcFreq(int32 deltaDemiToneNum, int32 deltaDemiToneDenom);
+ void resetFreqs();
- void unloadTBR();
- void unloadMDY();
+ void changePitch(uint8 voice, uint16 pitchBend);
-private:
- void init();
+ void setFreq(uint8 voice, uint16 note, bool on);
};
} // End of namespace Gob
diff --git a/engines/gob/sound/adlplayer.cpp b/engines/gob/sound/adlplayer.cpp
new file mode 100644
index 0000000000..ee23191c0d
--- /dev/null
+++ b/engines/gob/sound/adlplayer.cpp
@@ -0,0 +1,257 @@
+/* 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/stream.h"
+#include "common/memstream.h"
+#include "common/textconsole.h"
+
+#include "gob/sound/adlplayer.h"
+
+namespace Gob {
+
+ADLPlayer::ADLPlayer(Audio::Mixer &mixer) : AdLib(mixer),
+ _songData(0), _songDataSize(0), _playPos(0) {
+
+}
+
+ADLPlayer::~ADLPlayer() {
+ unload();
+}
+
+void ADLPlayer::unload() {
+ stopPlay();
+
+ _timbres.clear();
+
+ delete[] _songData;
+
+ _songData = 0;
+ _songDataSize = 0;
+
+ _playPos = 0;
+}
+
+uint32 ADLPlayer::pollMusic(bool first) {
+ if (_timbres.empty() || !_songData || !_playPos || (_playPos >= (_songData + _songDataSize))) {
+ end();
+ return 0;
+ }
+
+ // We'll ignore the first delay
+ if (first)
+ _playPos += (*_playPos & 0x80) ? 2 : 1;
+
+ byte cmd = *_playPos++;
+
+ // Song end marker
+ if (cmd == 0xFF) {
+ end();
+ return 0;
+ }
+
+ // Set the instrument that should be modified
+ if (cmd == 0xFE)
+ _modifyInstrument = *_playPos++;
+
+ if (cmd >= 0xD0) {
+ // Modify an instrument
+
+ if (_modifyInstrument == 0xFF)
+ warning("ADLPlayer: No instrument to modify");
+ else if (_modifyInstrument >= _timbres.size())
+ warning("ADLPlayer: Can't modify invalid instrument %d (%d)", _modifyInstrument, _timbres.size());
+ else
+ _timbres[_modifyInstrument].params[_playPos[0]] = _playPos[1];
+
+ _playPos += 2;
+
+ // If we currently have that instrument loaded, reload it
+ for (int i = 0; i < kMaxVoiceCount; i++)
+ if (_currentInstruments[i] == _modifyInstrument)
+ setInstrument(i, _modifyInstrument);
+ } else {
+ // Voice command
+
+ uint8 voice = cmd & 0x0F;
+ uint8 note, volume;
+
+ switch (cmd & 0xF0) {
+ case 0x00: // Note on with volume
+ note = *_playPos++;
+ volume = *_playPos++;
+
+ setVoiceVolume(voice, volume);
+ noteOn(voice, note);
+ break;
+
+ case 0xA0: // Pitch bend
+ bendVoicePitch(voice, ((uint16)*_playPos++) << 7);
+ break;
+
+ case 0xB0: // Set volume
+ setVoiceVolume(voice, *_playPos++);
+ break;
+
+ case 0xC0: // Set instrument
+ setInstrument(voice, *_playPos++);
+ break;
+
+ case 0x90: // Note on
+ noteOn(voice, *_playPos++);
+ break;
+
+ case 0x80: // Note off
+ noteOff(voice);
+ break;
+
+ default:
+ warning("ADLPlayer: Unsupported command: 0x%02X. Stopping playback.", cmd);
+ end(true);
+ return 0;
+ }
+ }
+
+ uint16 delay = *_playPos++;
+
+ if (delay & 0x80)
+ delay = ((delay & 3) << 8) | *_playPos++;
+
+ return getSampleDelay(delay);
+}
+
+uint32 ADLPlayer::getSampleDelay(uint16 delay) const {
+ if (delay == 0)
+ return 0;
+
+ return ((uint32)delay * getSamplesPerSecond()) / 1000;
+}
+
+void ADLPlayer::rewind() {
+ // Reset song data
+ _playPos = _songData;
+
+ // Set melody/percussion mode
+ setPercussionMode(_soundMode != 0);
+
+ // Reset instruments
+ for (Common::Array<Timbre>::iterator t = _timbres.begin(); t != _timbres.end(); ++t)
+ memcpy(t->params, t->startParams, kOperatorsPerVoice * kParamCount * sizeof(uint16));
+
+ for (int i = 0; i < kMaxVoiceCount; i++)
+ _currentInstruments[i] = 0;
+
+ // Reset voices
+ int numVoice = MIN<int>(_timbres.size(), _soundMode ? (int)kMaxVoiceCount : (int)kMelodyVoiceCount);
+ for (int i = 0; i < numVoice; i++) {
+ setInstrument(i, _currentInstruments[i]);
+ setVoiceVolume(i, kMaxVolume);
+ }
+
+ _modifyInstrument = 0xFF;
+}
+
+bool ADLPlayer::load(Common::SeekableReadStream &adl) {
+ unload();
+
+ int timbreCount;
+ if (!readHeader(adl, timbreCount)) {
+ unload();
+ return false;
+ }
+
+ if (!readTimbres(adl, timbreCount) || !readSongData(adl) || adl.err()) {
+ unload();
+ return false;
+ }
+
+ rewind();
+
+ return true;
+}
+
+bool ADLPlayer::readHeader(Common::SeekableReadStream &adl, int &timbreCount) {
+ // Sanity check
+ if (adl.size() < 60) {
+ warning("ADLPlayer::readHeader(): File too small (%d)", adl.size());
+ return false;
+ }
+
+ _soundMode = adl.readByte();
+ timbreCount = adl.readByte() + 1;
+
+ adl.skip(1);
+
+ return true;
+}
+
+bool ADLPlayer::readTimbres(Common::SeekableReadStream &adl, int timbreCount) {
+ _timbres.resize(timbreCount);
+ for (Common::Array<Timbre>::iterator t = _timbres.begin(); t != _timbres.end(); ++t) {
+ for (int i = 0; i < (kOperatorsPerVoice * kParamCount); i++)
+ t->startParams[i] = adl.readUint16LE();
+ }
+
+ if (adl.err()) {
+ warning("ADLPlayer::readTimbres(): Read failed");
+ return false;
+ }
+
+ return true;
+}
+
+bool ADLPlayer::readSongData(Common::SeekableReadStream &adl) {
+ _songDataSize = adl.size() - adl.pos();
+ _songData = new byte[_songDataSize];
+
+ if (adl.read(_songData, _songDataSize) != _songDataSize) {
+ warning("ADLPlayer::readSongData(): Read failed");
+ return false;
+ }
+
+ return true;
+}
+
+bool ADLPlayer::load(const byte *data, uint32 dataSize, int index) {
+ unload();
+
+ Common::MemoryReadStream stream(data, dataSize);
+ if (!load(stream))
+ return false;
+
+ _index = index;
+ return true;
+}
+
+void ADLPlayer::setInstrument(int voice, int instrument) {
+ if ((voice >= kMaxVoiceCount) || ((uint)instrument >= _timbres.size()))
+ return;
+
+ _currentInstruments[voice] = instrument;
+
+ setVoiceTimbre(voice, _timbres[instrument].params);
+}
+
+int ADLPlayer::getIndex() const {
+ return _index;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/sound/adlplayer.h b/engines/gob/sound/adlplayer.h
new file mode 100644
index 0000000000..9596447bbc
--- /dev/null
+++ b/engines/gob/sound/adlplayer.h
@@ -0,0 +1,85 @@
+/* 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_SOUND_ADLPLAYER_H
+#define GOB_SOUND_ADLPLAYER_H
+
+#include "common/array.h"
+
+#include "gob/sound/adlib.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+/** A player for Coktel Vision's ADL music format. */
+class ADLPlayer : public AdLib {
+public:
+ ADLPlayer(Audio::Mixer &mixer);
+ ~ADLPlayer();
+
+ bool load(Common::SeekableReadStream &adl);
+ bool load(const byte *data, uint32 dataSize, int index = -1);
+ void unload();
+
+ int getIndex() const;
+
+protected:
+ // AdLib interface
+ uint32 pollMusic(bool first);
+ void rewind();
+
+private:
+ struct Timbre {
+ uint16 startParams[kOperatorsPerVoice * kParamCount];
+ uint16 params[kOperatorsPerVoice * kParamCount];
+ };
+
+ uint8 _soundMode;
+
+ Common::Array<Timbre> _timbres;
+
+ byte *_songData;
+ uint32 _songDataSize;
+
+ const byte *_playPos;
+
+ int _index;
+
+ uint8 _modifyInstrument;
+ uint16 _currentInstruments[kMaxVoiceCount];
+
+
+ void setInstrument(int voice, int instrument);
+
+ bool readHeader (Common::SeekableReadStream &adl, int &timbreCount);
+ bool readTimbres (Common::SeekableReadStream &adl, int timbreCount);
+ bool readSongData(Common::SeekableReadStream &adl);
+
+ uint32 getSampleDelay(uint16 delay) const;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_SOUND_ADLPLAYER_H
diff --git a/engines/gob/sound/musplayer.cpp b/engines/gob/sound/musplayer.cpp
new file mode 100644
index 0000000000..3e41dc6ed1
--- /dev/null
+++ b/engines/gob/sound/musplayer.cpp
@@ -0,0 +1,391 @@
+/* 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/stream.h"
+#include "common/textconsole.h"
+
+#include "gob/sound/musplayer.h"
+
+namespace Gob {
+
+MUSPlayer::MUSPlayer(Audio::Mixer &mixer) : AdLib(mixer),
+ _songData(0), _songDataSize(0), _playPos(0), _songID(0) {
+
+}
+
+MUSPlayer::~MUSPlayer() {
+ unload();
+}
+
+void MUSPlayer::unload() {
+ stopPlay();
+
+ unloadSND();
+ unloadMUS();
+}
+
+uint32 MUSPlayer::getSampleDelay(uint16 delay) const {
+ if (delay == 0)
+ return 0;
+
+ uint32 freq = (_ticksPerBeat * _tempo) / 60;
+
+ return ((uint32)delay * getSamplesPerSecond()) / freq;
+}
+
+void MUSPlayer::skipToTiming() {
+ while (*_playPos < 0x80)
+ _playPos++;
+
+ if (*_playPos != 0xF8)
+ _playPos--;
+}
+
+uint32 MUSPlayer::pollMusic(bool first) {
+ if (_timbres.empty() || !_songData || !_playPos || (_playPos >= (_songData + _songDataSize))) {
+ end();
+ return 0;
+ }
+
+ if (first)
+ return getSampleDelay(*_playPos++);
+
+ uint16 delay = 0;
+ while (delay == 0) {
+ byte cmd = *_playPos;
+
+ // Delay overflow
+ if (cmd == 0xF8) {
+ _playPos++;
+ delay = 0xF8;
+ break;
+ }
+
+ // Song end marker
+ if (cmd == 0xFC) {
+ end();
+ return 0;
+ }
+
+ // Global command
+ if (cmd == 0xF0) {
+ _playPos++;
+
+ byte type1 = *_playPos++;
+ byte type2 = *_playPos++;
+
+ if ((type1 == 0x7F) && (type2 == 0)) {
+ // Tempo change, as a fraction of the base tempo
+
+ uint32 num = *_playPos++;
+ uint32 denom = *_playPos++;
+
+ _tempo = _baseTempo * num + ((_baseTempo * denom) >> 7);
+
+ _playPos++;
+ } else {
+
+ // Unsupported global command, skip it
+ _playPos -= 2;
+ while(*_playPos++ != 0xF7)
+ ;
+ }
+
+ delay = *_playPos++;
+ break;
+ }
+
+ // Voice command
+
+ if (cmd >= 0x80) {
+ _playPos++;
+
+ _lastCommand = cmd;
+ } else
+ cmd = _lastCommand;
+
+ uint8 voice = cmd & 0x0F;
+ uint8 note, volume;
+ uint16 pitch;
+
+ switch (cmd & 0xF0) {
+ case 0x80: // Note off
+ _playPos += 2;
+ noteOff(voice);
+ break;
+
+ case 0x90: // Note on
+ note = *_playPos++;
+ volume = *_playPos++;
+
+ if (volume) {
+ setVoiceVolume(voice, volume);
+ noteOn(voice, note);
+ } else
+ noteOff(voice);
+ break;
+
+ case 0xA0: // Set volume
+ setVoiceVolume(voice, *_playPos++);
+ break;
+
+ case 0xB0:
+ _playPos += 2;
+ break;
+
+ case 0xC0: // Set instrument
+ setInstrument(voice, *_playPos++);
+ break;
+
+ case 0xD0:
+ _playPos++;
+ break;
+
+ case 0xE0: // Pitch bend
+ pitch = *_playPos++;
+ pitch += *_playPos++ << 7;
+ bendVoicePitch(voice, pitch);
+ break;
+
+ default:
+ warning("MUSPlayer: Unsupported command: 0x%02X", cmd);
+ skipToTiming();
+ break;
+ }
+
+ delay = *_playPos++;
+ }
+
+ if (delay == 0xF8) {
+ delay = 240;
+
+ if (*_playPos != 0xF8)
+ delay += *_playPos++;
+ }
+
+ return getSampleDelay(delay);
+}
+
+void MUSPlayer::rewind() {
+ _playPos = _songData;
+ _tempo = _baseTempo;
+
+ _lastCommand = 0;
+
+ setPercussionMode(_soundMode != 0);
+ setPitchRange(_pitchBendRange);
+}
+
+bool MUSPlayer::loadSND(Common::SeekableReadStream &snd) {
+ unloadSND();
+
+ int timbreCount, timbrePos;
+ if (!readSNDHeader(snd, timbreCount, timbrePos))
+ return false;
+
+ if (!readSNDTimbres(snd, timbreCount, timbrePos) || snd.err()) {
+ unloadSND();
+ return false;
+ }
+
+ return true;
+}
+
+bool MUSPlayer::readString(Common::SeekableReadStream &stream, Common::String &string, byte *buffer, uint size) {
+ if (stream.read(buffer, size) != size)
+ return false;
+
+ buffer[size] = '\0';
+
+ string = (char *) buffer;
+
+ return true;
+}
+
+bool MUSPlayer::readSNDHeader(Common::SeekableReadStream &snd, int &timbreCount, int &timbrePos) {
+ // Sanity check
+ if (snd.size() <= 6) {
+ warning("MUSPlayer::readSNDHeader(): File too small (%d)", snd.size());
+ return false;
+ }
+
+ // Version
+ const uint8 versionMajor = snd.readByte();
+ const uint8 versionMinor = snd.readByte();
+
+ if ((versionMajor != 1) && (versionMinor != 0)) {
+ warning("MUSPlayer::readSNDHeader(): Unsupported version %d.%d", versionMajor, versionMinor);
+ return false;
+ }
+
+ // Number of timbres and where they start
+ timbreCount = snd.readUint16LE();
+ timbrePos = snd.readUint16LE();
+
+ const uint16 minTimbrePos = 6 + timbreCount * 9;
+
+ // Sanity check
+ if (timbrePos < minTimbrePos) {
+ warning("MUSPlayer::readSNDHeader(): Timbre offset too small: %d < %d", timbrePos, minTimbrePos);
+ return false;
+ }
+
+ const uint32 timbreParametersSize = snd.size() - timbrePos;
+ const uint32 paramSize = kOperatorsPerVoice * kParamCount * sizeof(uint16);
+
+ // Sanity check
+ if (timbreParametersSize != (timbreCount * paramSize)) {
+ warning("MUSPlayer::loadSND(): Timbre parameters size mismatch: %d != %d",
+ timbreParametersSize, timbreCount * paramSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool MUSPlayer::readSNDTimbres(Common::SeekableReadStream &snd, int timbreCount, int timbrePos) {
+ _timbres.resize(timbreCount);
+
+ // Read names
+ byte nameBuffer[10];
+ for (Common::Array<Timbre>::iterator t = _timbres.begin(); t != _timbres.end(); ++t) {
+ if (!readString(snd, t->name, nameBuffer, 9)) {
+ warning("MUSPlayer::readMUSTimbres(): Failed to read timbre name");
+ return false;
+ }
+ }
+
+ if (!snd.seek(timbrePos)) {
+ warning("MUSPlayer::readMUSTimbres(): Failed to seek to timbres");
+ return false;
+ }
+
+ // Read parameters
+ for (Common::Array<Timbre>::iterator t = _timbres.begin(); t != _timbres.end(); ++t) {
+ for (int i = 0; i < (kOperatorsPerVoice * kParamCount); i++)
+ t->params[i] = snd.readUint16LE();
+ }
+
+ return true;
+}
+
+bool MUSPlayer::loadMUS(Common::SeekableReadStream &mus) {
+ unloadMUS();
+
+ if (!readMUSHeader(mus) || !readMUSSong(mus) || mus.err()) {
+ unloadMUS();
+ return false;
+ }
+
+ rewind();
+
+ return true;
+}
+
+bool MUSPlayer::readMUSHeader(Common::SeekableReadStream &mus) {
+ // Sanity check
+ if (mus.size() <= 6)
+ return false;
+
+ // Version
+ const uint8 versionMajor = mus.readByte();
+ const uint8 versionMinor = mus.readByte();
+
+ if ((versionMajor != 1) && (versionMinor != 0)) {
+ warning("MUSPlayer::readMUSHeader(): Unsupported version %d.%d", versionMajor, versionMinor);
+ return false;
+ }
+
+ _songID = mus.readUint32LE();
+
+ byte nameBuffer[31];
+ if (!readString(mus, _songName, nameBuffer, 30)) {
+ warning("MUSPlayer::readMUSHeader(): Failed to read the song name");
+ return false;
+ }
+
+ _ticksPerBeat = mus.readByte();
+ _beatsPerMeasure = mus.readByte();
+
+ mus.skip(4); // Length of song in ticks
+
+ _songDataSize = mus.readUint32LE();
+
+ mus.skip(4); // Number of commands
+ mus.skip(8); // Unused
+
+ _soundMode = mus.readByte();
+ _pitchBendRange = mus.readByte();
+ _baseTempo = mus.readUint16LE();
+
+ mus.skip(8); // Unused
+
+ return true;
+}
+
+bool MUSPlayer::readMUSSong(Common::SeekableReadStream &mus) {
+ const uint32 realSongDataSize = mus.size() - mus.pos();
+
+ if (realSongDataSize < _songDataSize) {
+ warning("MUSPlayer::readMUSSong(): File too small for the song data: %d < %d", realSongDataSize, _songDataSize);
+ return false;
+ }
+
+ _songData = new byte[_songDataSize];
+
+ if (mus.read(_songData, _songDataSize) != _songDataSize) {
+ warning("MUSPlayer::readMUSSong(): Read failed");
+ return false;
+ }
+
+ return true;
+}
+
+void MUSPlayer::unloadSND() {
+ _timbres.clear();
+}
+
+void MUSPlayer::unloadMUS() {
+ delete[] _songData;
+
+ _songData = 0;
+ _songDataSize = 0;
+
+ _playPos = 0;
+}
+
+uint32 MUSPlayer::getSongID() const {
+ return _songID;
+}
+
+const Common::String &MUSPlayer::getSongName() const {
+ return _songName;
+}
+
+void MUSPlayer::setInstrument(uint8 voice, uint8 instrument) {
+ if (instrument >= _timbres.size())
+ return;
+
+ setVoiceTimbre(voice, _timbres[instrument].params);
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/sound/musplayer.h b/engines/gob/sound/musplayer.h
new file mode 100644
index 0000000000..6cc2a2d2ca
--- /dev/null
+++ b/engines/gob/sound/musplayer.h
@@ -0,0 +1,109 @@
+/* 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_SOUND_MUSPLAYER_H
+#define GOB_SOUND_MUSPLAYER_H
+
+#include "common/str.h"
+#include "common/array.h"
+
+#include "gob/sound/adlib.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+/** A player for the AdLib MUS format, with the instrument information in SND files.
+ *
+ * In the Gob engine, those files are usually named .MDY and .TBR instead.
+ */
+class MUSPlayer : public AdLib {
+public:
+ MUSPlayer(Audio::Mixer &mixer);
+ ~MUSPlayer();
+
+ /** Load the instruments (.SND or .TBR) */
+ bool loadSND(Common::SeekableReadStream &snd);
+ /** Load the melody (.MUS or .MDY) */
+ bool loadMUS(Common::SeekableReadStream &mus);
+
+ void unload();
+
+ uint32 getSongID() const;
+ const Common::String &getSongName() const;
+
+protected:
+ // AdLib interface
+ uint32 pollMusic(bool first);
+ void rewind();
+
+private:
+ struct Timbre {
+ Common::String name;
+
+ uint16 params[kOperatorsPerVoice * kParamCount];
+ };
+
+ Common::Array<Timbre> _timbres;
+
+ byte *_songData;
+ uint32 _songDataSize;
+
+ const byte *_playPos;
+
+ uint32 _songID;
+ Common::String _songName;
+
+ uint8 _ticksPerBeat;
+ uint8 _beatsPerMeasure;
+
+ uint8 _soundMode;
+ uint8 _pitchBendRange;
+
+ uint16 _baseTempo;
+
+ uint16 _tempo;
+
+ byte _lastCommand;
+
+
+ void unloadSND();
+ void unloadMUS();
+
+ bool readSNDHeader (Common::SeekableReadStream &snd, int &timbreCount, int &timbrePos);
+ bool readSNDTimbres(Common::SeekableReadStream &snd, int timbreCount, int timbrePos);
+
+ bool readMUSHeader(Common::SeekableReadStream &mus);
+ bool readMUSSong (Common::SeekableReadStream &mus);
+
+ uint32 getSampleDelay(uint16 delay) const;
+ void setInstrument(uint8 voice, uint8 instrument);
+ void skipToTiming();
+
+ static bool readString(Common::SeekableReadStream &stream, Common::String &string, byte *buffer, uint size);
+};
+
+} // End of namespace Gob
+
+#endif // GOB_SOUND_MUSPLAYER_H
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index bfe0394390..63af6aeef4 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -30,7 +30,8 @@
#include "gob/sound/pcspeaker.h"
#include "gob/sound/soundblaster.h"
-#include "gob/sound/adlib.h"
+#include "gob/sound/adlplayer.h"
+#include "gob/sound/musplayer.h"
#include "gob/sound/infogrames.h"
#include "gob/sound/protracker.h"
#include "gob/sound/cdrom.h"
@@ -50,6 +51,8 @@ Sound::Sound(GobEngine *vm) : _vm(vm) {
_hasAdLib = (!_vm->_noMusic && _vm->hasAdLib());
+ _hasAdLibBg = _hasAdLib;
+
if (!_vm->_noMusic && (_vm->getPlatform() == Common::kPlatformAmiga)) {
_infogrames = new Infogrames(*_vm->_mixer);
_protracker = new Protracker(*_vm->_mixer);
@@ -106,7 +109,7 @@ int Sound::sampleGetNextFreeSlot() const {
return -1;
}
-bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, bool tryExist) {
+bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName) {
if (!sndDesc)
return false;
@@ -114,12 +117,15 @@ bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName,
int32 size;
byte *data = _vm->_dataIO->getFile(fileName, size);
- if (!data) {
- warning("Can't open sample file \"%s\"", fileName);
+
+ if (!data || !sndDesc->load(type, data, size)) {
+ delete data;
+
+ warning("Sound::sampleLoad(): Failed to load sound \"%s\"", fileName);
return false;
}
- return sndDesc->load(type, data, size);
+ return true;
}
void Sound::sampleFree(SoundDesc *sndDesc, bool noteAdLib, int index) {
@@ -131,10 +137,7 @@ void Sound::sampleFree(SoundDesc *sndDesc, bool noteAdLib, int index) {
if (noteAdLib) {
if (_adlPlayer)
if ((index == -1) || (_adlPlayer->getIndex() == index))
- _adlPlayer->stopPlay();
- if (_mdyPlayer)
- if ((index == -1) || (_mdyPlayer->getIndex() == index))
- _mdyPlayer->stopPlay();
+ _adlPlayer->unload();
}
} else {
@@ -235,7 +238,17 @@ bool Sound::adlibLoadADL(const char *fileName) {
debugC(1, kDebugSound, "AdLib: Loading ADL data (\"%s\")", fileName);
- return _adlPlayer->load(fileName);
+ Common::SeekableReadStream *stream = _vm->_dataIO->getFile(fileName);
+ if (!stream) {
+ warning("Can't open ADL file \"%s\"", fileName);
+ return false;
+ }
+
+ bool loaded = _adlPlayer->load(*stream);
+
+ delete stream;
+
+ return loaded;
}
bool Sound::adlibLoadADL(byte *data, uint32 size, int index) {
@@ -266,8 +279,7 @@ bool Sound::adlibLoadMDY(const char *fileName) {
if (!_hasAdLib)
return false;
- if (!_mdyPlayer)
- _mdyPlayer = new MDYPlayer(*_vm->_mixer);
+ createMDYPlayer();
debugC(1, kDebugSound, "AdLib: Loading MDY data (\"%s\")", fileName);
@@ -277,7 +289,7 @@ bool Sound::adlibLoadMDY(const char *fileName) {
return false;
}
- bool loaded = _mdyPlayer->loadMDY(*stream);
+ bool loaded = _mdyPlayer->loadMUS(*stream);
delete stream;
@@ -288,8 +300,7 @@ bool Sound::adlibLoadTBR(const char *fileName) {
if (!_hasAdLib)
return false;
- if (!_mdyPlayer)
- _mdyPlayer = new MDYPlayer(*_vm->_mixer);
+ createMDYPlayer();
Common::SeekableReadStream *stream = _vm->_dataIO->getFile(fileName);
if (!stream) {
@@ -299,7 +310,7 @@ bool Sound::adlibLoadTBR(const char *fileName) {
debugC(1, kDebugSound, "AdLib: Loading MDY instruments (\"%s\")", fileName);
- bool loaded = _mdyPlayer->loadTBR(*stream);
+ bool loaded = _mdyPlayer->loadSND(*stream);
delete stream;
@@ -310,28 +321,23 @@ void Sound::adlibPlayTrack(const char *trackname) {
if (!_hasAdLib)
return;
- if (!_adlPlayer)
- _adlPlayer = new ADLPlayer(*_vm->_mixer);
+ createADLPlayer();
if (_adlPlayer->isPlaying())
return;
- debugC(1, kDebugSound, "AdLib: Playing ADL track \"%s\"", trackname);
-
- _adlPlayer->unload();
- _adlPlayer->load(trackname);
- _adlPlayer->startPlay();
+ if (adlibLoadADL(trackname))
+ adlibPlay();
}
void Sound::adlibPlayBgMusic() {
- if (!_hasAdLib)
+ if (!_hasAdLib || _hasAdLibBg)
return;
- if (!_adlPlayer)
- _adlPlayer = new ADLPlayer(*_vm->_mixer);
+ createADLPlayer();
static const char *const tracksMac[] = {
-// "musmac1.adl", // TODO: This track isn't played correctly at all yet
+// "musmac1.adl", // This track seems to be missing instruments...
"musmac2.adl",
"musmac3.adl",
"musmac4.adl",
@@ -347,13 +353,18 @@ void Sound::adlibPlayBgMusic() {
"musmac5.mid"
};
- if (_vm->getPlatform() == Common::kPlatformWindows) {
- int track = _vm->_util->getRandom(ARRAYSIZE(tracksWin));
- adlibPlayTrack(tracksWin[track]);
- } else {
- int track = _vm->_util->getRandom(ARRAYSIZE(tracksMac));
- adlibPlayTrack(tracksMac[track]);
+ const char *track = 0;
+ if (_vm->getPlatform() == Common::kPlatformWindows)
+ track = tracksWin[_vm->_util->getRandom(ARRAYSIZE(tracksWin))];
+ else
+ track = tracksMac[_vm->_util->getRandom(ARRAYSIZE(tracksMac))];
+
+ if (!track || !_vm->_dataIO->hasFile(track)) {
+ _hasAdLibBg = false;
+ return;
}
+
+ adlibPlayTrack(track);
}
void Sound::adlibPlay() {
@@ -398,13 +409,11 @@ int Sound::adlibGetIndex() const {
if (_adlPlayer)
return _adlPlayer->getIndex();
- if (_mdyPlayer)
- return _mdyPlayer->getIndex();
return -1;
}
-bool Sound::adlibGetRepeating() const {
+int32 Sound::adlibGetRepeating() const {
if (!_hasAdLib)
return false;
@@ -439,6 +448,10 @@ void Sound::blasterPlay(SoundDesc *sndDesc, int16 repCount,
_blaster->playSample(*sndDesc, repCount, frequency, fadeLength);
}
+void Sound::blasterRepeatComposition(int32 repCount) {
+ _blaster->repeatComposition(repCount);
+}
+
void Sound::blasterStop(int16 fadeLength, SoundDesc *sndDesc) {
if (!_blaster)
return;
@@ -448,7 +461,7 @@ void Sound::blasterStop(int16 fadeLength, SoundDesc *sndDesc) {
_blaster->stopSound(fadeLength, sndDesc);
}
-void Sound::blasterPlayComposition(int16 *composition, int16 freqVal,
+void Sound::blasterPlayComposition(const int16 *composition, int16 freqVal,
SoundDesc *sndDescs, int8 sndCount) {
if (!_blaster)
return;
@@ -719,4 +732,24 @@ void Sound::bgUnshade() {
_bgatmos->unshade();
}
+void Sound::createMDYPlayer() {
+ if (_mdyPlayer)
+ return;
+
+ delete _adlPlayer;
+ _adlPlayer = 0;
+
+ _mdyPlayer = new MUSPlayer(*_vm->_mixer);
+}
+
+void Sound::createADLPlayer() {
+ if (_adlPlayer)
+ return;
+
+ delete _mdyPlayer;
+ _mdyPlayer= 0;
+
+ _adlPlayer = new ADLPlayer(*_vm->_mixer);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h
index 585cf36703..bbc182d172 100644
--- a/engines/gob/sound/sound.h
+++ b/engines/gob/sound/sound.h
@@ -32,7 +32,7 @@ class GobEngine;
class PCSpeaker;
class SoundBlaster;
class ADLPlayer;
-class MDYPlayer;
+class MUSPlayer;
class Infogrames;
class Protracker;
class CDROM;
@@ -51,7 +51,7 @@ public:
const SoundDesc *sampleGetBySlot(int slot) const;
int sampleGetNextFreeSlot() const;
- bool sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, bool tryExist = true);
+ bool sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName);
void sampleFree(SoundDesc *sndDesc, bool noteAdLib = false, int index = -1);
@@ -60,9 +60,10 @@ public:
int16 frequency, int16 fadeLength = 0);
void blasterStop(int16 fadeLength, SoundDesc *sndDesc = 0);
- void blasterPlayComposition(int16 *composition, int16 freqVal,
+ void blasterPlayComposition(const int16 *composition, int16 freqVal,
SoundDesc *sndDescs = 0, int8 sndCount = kSoundsCount);
void blasterStopComposition();
+ void blasterRepeatComposition(int32 repCount);
char blasterPlayingSound() const;
@@ -92,7 +93,7 @@ public:
bool adlibIsPlaying() const;
int adlibGetIndex() const;
- bool adlibGetRepeating() const;
+ int32 adlibGetRepeating() const;
void adlibSetRepeating(int32 repCount);
@@ -142,17 +143,30 @@ private:
GobEngine *_vm;
bool _hasAdLib;
+ bool _hasAdLibBg;
SoundDesc _sounds[kSoundsCount];
+ // Speaker
PCSpeaker *_pcspeaker;
+
+ // PCM based
SoundBlaster *_blaster;
+ BackgroundAtmosphere *_bgatmos;
+
+ // AdLib
+ MUSPlayer *_mdyPlayer;
ADLPlayer *_adlPlayer;
- MDYPlayer *_mdyPlayer;
+
+ // Amiga Paula
Infogrames *_infogrames;
Protracker *_protracker;
+
+ // Audio CD
CDROM *_cdrom;
- BackgroundAtmosphere *_bgatmos;
+
+ void createMDYPlayer();
+ void createADLPlayer();
};
} // End of namespace Gob
diff --git a/engines/gob/sound/soundblaster.cpp b/engines/gob/sound/soundblaster.cpp
index 4ff555b0e3..f267eee32d 100644
--- a/engines/gob/sound/soundblaster.cpp
+++ b/engines/gob/sound/soundblaster.cpp
@@ -31,6 +31,8 @@ SoundBlaster::SoundBlaster(Audio::Mixer &mixer) : SoundMixer(mixer, Audio::Mixer
_compositionSamples = 0;
_compositionSampleCount = 0;
_compositionPos = -1;
+
+ _compositionRepCount = 0;
}
SoundBlaster::~SoundBlaster() {
@@ -47,6 +49,8 @@ void SoundBlaster::stopSound(int16 fadeLength, SoundDesc *sndDesc) {
if (sndDesc && (sndDesc != _curSoundDesc))
return;
+ _compositionRepCount = 0;
+
if (fadeLength <= 0)
_curSoundDesc = 0;
@@ -62,6 +66,7 @@ void SoundBlaster::stopComposition() {
void SoundBlaster::endComposition() {
_compositionPos = -1;
+ _compositionRepCount = 0;
}
void SoundBlaster::nextCompositionPos() {
@@ -79,10 +84,11 @@ void SoundBlaster::nextCompositionPos() {
if (_compositionPos == 49)
_compositionPos = -1;
}
+
_compositionPos = -1;
}
-void SoundBlaster::playComposition(int16 *composition, int16 freqVal,
+void SoundBlaster::playComposition(const int16 *composition, int16 freqVal,
SoundDesc *sndDescs, int8 sndCount) {
_compositionSamples = sndDescs;
@@ -98,6 +104,10 @@ void SoundBlaster::playComposition(int16 *composition, int16 freqVal,
nextCompositionPos();
}
+void SoundBlaster::repeatComposition(int32 repCount) {
+ _compositionRepCount = repCount;
+}
+
void SoundBlaster::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency,
int16 fadeLength) {
@@ -106,10 +116,21 @@ void SoundBlaster::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency
}
void SoundBlaster::checkEndSample() {
- if (_compositionPos != -1)
+ if (_compositionPos != -1) {
nextCompositionPos();
- else
- SoundMixer::checkEndSample();
+ return;
+ }
+
+ if (_compositionRepCount != 0) {
+ if (_compositionRepCount > 0)
+ _compositionRepCount--;
+
+ nextCompositionPos();
+ if (_compositionPos != -1)
+ return;
+ }
+
+ SoundMixer::checkEndSample();
}
void SoundBlaster::endFade() {
diff --git a/engines/gob/sound/soundblaster.h b/engines/gob/sound/soundblaster.h
index c2704c5482..3c4968d611 100644
--- a/engines/gob/sound/soundblaster.h
+++ b/engines/gob/sound/soundblaster.h
@@ -41,11 +41,13 @@ public:
int16 frequency, int16 fadeLength = 0);
void stopSound(int16 fadeLength, SoundDesc *sndDesc = 0);
- void playComposition(int16 *composition, int16 freqVal,
+ void playComposition(const int16 *composition, int16 freqVal,
SoundDesc *sndDescs = 0, int8 sndCount = 60);
void stopComposition();
void endComposition();
+ void repeatComposition(int32 repCount);
+
protected:
Common::Mutex _mutex;
@@ -54,6 +56,8 @@ protected:
int16 _composition[50];
int8 _compositionPos;
+ int32 _compositionRepCount;
+
SoundDesc *_curSoundDesc;
void setSample(SoundDesc &sndDesc, int16 repCount,
diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp
index e294209ed7..afbb7c3bae 100644
--- a/engines/gob/surface.cpp
+++ b/engines/gob/surface.cpp
@@ -280,6 +280,18 @@ Surface::Surface(uint16 width, uint16 height, uint8 bpp, byte *vidMem) :
_ownVidMem = false;
}
+Surface::Surface(uint16 width, uint16 height, uint8 bpp, const byte *vidMem) :
+ _width(width), _height(height), _bpp(bpp), _vidMem(0) {
+
+ assert((_width > 0) && (_height > 0));
+ assert((_bpp == 1) || (_bpp == 2));
+
+ _vidMem = new byte[_bpp * _width * _height];
+ _ownVidMem = true;
+
+ memcpy(_vidMem, vidMem, _bpp * _width * _height);
+}
+
Surface::~Surface() {
if (_ownVidMem)
delete[] _vidMem;
@@ -672,6 +684,12 @@ void Surface::shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom,
}
+void Surface::recolor(uint8 from, uint8 to) {
+ for (Pixel p = get(); p.isValid(); ++p)
+ if (p.get() == from)
+ p.set(to);
+}
+
void Surface::putPixel(uint16 x, uint16 y, uint32 color) {
if ((x >= _width) || (y >= _height))
return;
@@ -683,6 +701,34 @@ void Surface::drawLine(uint16 x0, uint16 y0, uint16 x1, uint16 y1, uint32 color)
Graphics::drawLine(x0, y0, x1, y1, color, &plotPixel, this);
}
+void Surface::drawRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color) {
+ // Just in case those are swapped
+ if (left > right)
+ SWAP(left, right);
+ if (top > bottom)
+ SWAP(top, bottom);
+
+ if ((left >= _width) || (top >= _height))
+ // Nothing to do
+ return;
+
+ // Area to actually draw
+ const uint16 width = CLIP<int32>(right - left + 1, 0, _width - left);
+ const uint16 height = CLIP<int32>(bottom - top + 1, 0, _height - top);
+
+ if ((width == 0) || (height == 0))
+ // Nothing to do
+ return;
+
+ right = left + width - 1;
+ bottom = top + height - 1;
+
+ drawLine(left , top , left , bottom, color);
+ drawLine(right, top , right, bottom, color);
+ drawLine(left , top , right, top , color);
+ drawLine(left , bottom, right, bottom, color);
+}
+
/*
* The original's version of the Bresenham Algorithm was a bit "unclean"
* and produced strange edges at 45, 135, 225 and 315 degrees, so using the
diff --git a/engines/gob/surface.h b/engines/gob/surface.h
index 866e63490f..8f895a7910 100644
--- a/engines/gob/surface.h
+++ b/engines/gob/surface.h
@@ -122,6 +122,7 @@ private:
class Surface {
public:
Surface(uint16 width, uint16 height, uint8 bpp, byte *vidMem = 0);
+ Surface(uint16 width, uint16 height, uint8 bpp, const byte *vidMem);
~Surface();
uint16 getWidth () const;
@@ -155,8 +156,11 @@ public:
void shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom,
uint32 color, uint8 strength);
+ void recolor(uint8 from, uint8 to);
+
void putPixel(uint16 x, uint16 y, uint32 color);
void drawLine(uint16 x0, uint16 y0, uint16 x1, uint16 y1, uint32 color);
+ void drawRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color);
void drawCircle(uint16 x0, uint16 y0, uint16 radius, uint32 color, int16 pattern = 0);
void blitToScreen(uint16 left, uint16 top, uint16 right, uint16 bottom, uint16 x, uint16 y) const;
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 7f9c6131fd..5ac4ef024e 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -21,7 +21,6 @@
*/
#include "common/stream.h"
-#include "common/events.h"
#include "graphics/palette.h"
@@ -45,6 +44,8 @@ Util::Util(GobEngine *vm) : _vm(vm) {
_frameRate = 12;
_frameWaitTime = 0;
_startFrameTime = 0;
+
+ _keyState = 0;
}
uint32 Util::getTimeKey() {
@@ -116,6 +117,8 @@ void Util::processInput(bool scroll) {
_mouseButtons = (MouseButtons) (((uint32) _mouseButtons) & ~((uint32) kMouseButtonsRight));
break;
case Common::EVENT_KEYDOWN:
+ keyDown(event);
+
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_f)
_fastMode ^= 1;
@@ -132,6 +135,7 @@ void Util::processInput(bool scroll) {
addKeyToBuffer(event.kbd);
break;
case Common::EVENT_KEYUP:
+ keyUp(event);
break;
default:
break;
@@ -185,12 +189,27 @@ bool Util::getKeyFromBuffer(Common::KeyState &key) {
return true;
}
+static const uint16 kLatin1ToCP850[] = {
+ 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE,
+ 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8,
+ 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, 0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8,
+ 0xD1, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E, 0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1,
+ 0x85, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87, 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B,
+ 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98
+};
+
+int16 Util::toCP850(uint16 latin1) {
+ if ((latin1 < 0xA0) || ((latin1 - 0xA0) >= ARRAYSIZE(kLatin1ToCP850)))
+ return 0;
+
+ return kLatin1ToCP850[latin1 - 0xA0];
+}
+
int16 Util::translateKey(const Common::KeyState &key) {
static struct keyS {
int16 from;
int16 to;
} keys[] = {
- {Common::KEYCODE_INVALID, kKeyNone },
{Common::KEYCODE_BACKSPACE, kKeyBackspace},
{Common::KEYCODE_SPACE, kKeySpace },
{Common::KEYCODE_RETURN, kKeyReturn },
@@ -212,20 +231,88 @@ int16 Util::translateKey(const Common::KeyState &key) {
{Common::KEYCODE_F10, kKeyF10 }
};
+ // Translate special keys
for (int i = 0; i < ARRAYSIZE(keys); i++)
if (key.keycode == keys[i].from)
return keys[i].to;
- if ((key.keycode >= Common::KEYCODE_SPACE) &&
- (key.keycode <= Common::KEYCODE_DELETE)) {
-
- // Used as a user input in Gobliins 2 notepad, in the save dialog, ...
+ // Return the ascii value, for text input
+ if ((key.ascii >= 32) && (key.ascii <= 127))
return key.ascii;
- }
+
+ // Translate international characters into CP850 characters
+ if ((key.ascii >= 160) && (key.ascii <= 255))
+ return toCP850(key.ascii);
return 0;
}
+static const uint8 kLowerToUpper[][2] = {
+ {0x81, 0x9A},
+ {0x82, 0x90},
+ {0x83, 0xB6},
+ {0x84, 0x8E},
+ {0x85, 0xB7},
+ {0x86, 0x8F},
+ {0x87, 0x80},
+ {0x88, 0xD2},
+ {0x89, 0xD3},
+ {0x8A, 0xD4},
+ {0x8B, 0xD8},
+ {0x8C, 0xD7},
+ {0x8D, 0xDE},
+ {0x91, 0x92},
+ {0x93, 0xE2},
+ {0x94, 0x99},
+ {0x95, 0xE3},
+ {0x96, 0xEA},
+ {0x97, 0xEB},
+ {0x95, 0xE3},
+ {0x96, 0xEA},
+ {0x97, 0xEB},
+ {0x9B, 0x9D},
+ {0xA0, 0xB5},
+ {0xA1, 0xD6},
+ {0xA2, 0xE0},
+ {0xA3, 0xE9},
+ {0xA4, 0xA5},
+ {0xC6, 0xC7},
+ {0xD0, 0xD1},
+ {0xE4, 0xE5},
+ {0xE7, 0xE8},
+ {0xEC, 0xED}
+};
+
+char Util::toCP850Lower(char cp850) {
+ const uint8 cp = (unsigned char)cp850;
+ if (cp <= 32)
+ return cp850;
+
+ if (cp <= 127)
+ return tolower(cp850);
+
+ for (uint i = 0; i < ARRAYSIZE(kLowerToUpper); i++)
+ if (cp == kLowerToUpper[i][1])
+ return (char)kLowerToUpper[i][0];
+
+ return cp850;
+}
+
+char Util::toCP850Upper(char cp850) {
+ const uint8 cp = (unsigned char)cp850;
+ if (cp <= 32)
+ return cp850;
+
+ if (cp <= 127)
+ return toupper(cp850);
+
+ for (uint i = 0; i < ARRAYSIZE(kLowerToUpper); i++)
+ if (cp == kLowerToUpper[i][0])
+ return (char)kLowerToUpper[i][1];
+
+ return cp850;
+}
+
int16 Util::getKey() {
Common::KeyState key;
@@ -363,21 +450,29 @@ void Util::notifyNewAnim() {
_startFrameTime = getTimeKey();
}
-void Util::waitEndFrame() {
+void Util::waitEndFrame(bool handleInput) {
int32 time;
- _vm->_video->waitRetrace();
-
time = getTimeKey() - _startFrameTime;
if ((time > 1000) || (time < 0)) {
+ _vm->_video->retrace();
_startFrameTime = getTimeKey();
return;
}
- int32 toWait = _frameWaitTime - time;
+ int32 toWait = 0;
+ do {
+ if (toWait > 0)
+ delay(MIN<int>(toWait, 10));
- if (toWait > 0)
- delay(toWait);
+ if (handleInput)
+ processInput();
+
+ _vm->_video->retrace();
+
+ time = getTimeKey() - _startFrameTime;
+ toWait = _frameWaitTime - time;
+ } while (toWait > 0);
_startFrameTime = getTimeKey();
}
@@ -576,4 +671,38 @@ void Util::checkJoystick() {
_vm->_global->_useJoystick = 0;
}
+uint32 Util::getKeyState() const {
+ return _keyState;
+}
+
+void Util::keyDown(const Common::Event &event) {
+ if (event.kbd.keycode == Common::KEYCODE_UP)
+ _keyState |= 0x0001;
+ else if (event.kbd.keycode == Common::KEYCODE_DOWN)
+ _keyState |= 0x0002;
+ else if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+ _keyState |= 0x0004;
+ else if (event.kbd.keycode == Common::KEYCODE_LEFT)
+ _keyState |= 0x0008;
+ else if (event.kbd.keycode == Common::KEYCODE_SPACE)
+ _keyState |= 0x0020;
+ else if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ _keyState |= 0x0040;
+}
+
+void Util::keyUp(const Common::Event &event) {
+ if (event.kbd.keycode == Common::KEYCODE_UP)
+ _keyState &= ~0x0001;
+ else if (event.kbd.keycode == Common::KEYCODE_DOWN)
+ _keyState &= ~0x0002;
+ else if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+ _keyState &= ~0x0004;
+ else if (event.kbd.keycode == Common::KEYCODE_LEFT)
+ _keyState &= ~0x0008;
+ else if (event.kbd.keycode == Common::KEYCODE_SPACE)
+ _keyState &= ~0x0020;
+ else if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ _keyState &= ~0x0040;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/util.h b/engines/gob/util.h
index 4228dac768..a4984c6207 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -25,6 +25,7 @@
#include "common/str.h"
#include "common/keyboard.h"
+#include "common/events.h"
namespace Common {
class SeekableReadStream;
@@ -110,6 +111,8 @@ public:
bool checkKey(int16 &key);
bool keyPressed();
+ uint32 getKeyState() const;
+
void getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons);
void setMousePos(int16 x, int16 y);
void waitMouseUp();
@@ -121,7 +124,7 @@ public:
int16 getFrameRate();
void setFrameRate(int16 rate);
void notifyNewAnim();
- void waitEndFrame();
+ void waitEndFrame(bool handleInput = true);
void setScrollOffset(int16 x = -1, int16 y = -1);
static void insertStr(const char *str1, char *str2, int16 pos);
@@ -140,6 +143,11 @@ public:
/** Read a constant-length string out of a stream. */
static Common::String readString(Common::SeekableReadStream &stream, int n);
+ /** Convert a character in CP850 encoding to the equivalent lower case character. */
+ static char toCP850Lower(char cp850);
+ /** Convert a character in CP850 encoding to the equivalent upper case character. */
+ static char toCP850Upper(char cp850);
+
Util(GobEngine *vm);
protected:
@@ -155,13 +163,19 @@ protected:
int16 _frameWaitTime;
uint32 _startFrameTime;
+ uint32 _keyState;
+
GobEngine *_vm;
bool keyBufferEmpty();
void addKeyToBuffer(const Common::KeyState &key);
bool getKeyFromBuffer(Common::KeyState &key);
int16 translateKey(const Common::KeyState &key);
+ int16 toCP850(uint16 latin1);
void checkJoystick();
+
+ void keyDown(const Common::Event &event);
+ void keyUp(const Common::Event &event);
};
} // End of namespace Gob
diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index ee5ff4abff..64af34cf62 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -25,7 +25,6 @@
#include "engines/util.h"
#include "graphics/cursorman.h"
-#include "graphics/fontman.h"
#include "graphics/palette.h"
#include "graphics/surface.h"
@@ -85,6 +84,10 @@ uint16 Font::getCharCount() const {
return _endItem - _startItem + 1;
}
+bool Font::hasChar(uint8 c) const {
+ return (c >= _startItem) && (c <= _endItem);
+}
+
bool Font::isMonospaced() const {
return _charWidths == 0;
}
@@ -135,6 +138,23 @@ void Font::drawLetter(Surface &surf, uint8 c, uint16 x, uint16 y,
}
}
+void Font::drawString(const Common::String &str, int16 x, int16 y, int16 color1, int16 color2,
+ bool transp, Surface &dest) const {
+
+ const char *s = str.c_str();
+
+ while (*s != '\0') {
+ const int16 charRight = x + getCharWidth(*s);
+ const int16 charBottom = y + getCharHeight();
+
+ if ((x >= 0) && (y >= 0) && (charRight <= dest.getWidth()) && (charBottom <= dest.getHeight()))
+ drawLetter(dest, *s, x, y, color1, color2, transp);
+
+ x += getCharWidth(*s);
+ s++;
+ }
+}
+
const byte *Font::getCharData(uint8 c) const {
if (_endItem == 0) {
warning("Font::getCharData(): _endItem == 0");
@@ -226,10 +246,7 @@ void Video::setSize(bool defaultTo1XScaler) {
void Video::retrace(bool mouse) {
if (mouse)
- if ((_vm->getGameType() != kGameTypeAdibou2) &&
- (_vm->getGameType() != kGameTypeAdi2) &&
- (_vm->getGameType() != kGameTypeAdi4))
- CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
+ CursorMan.showMouse((_vm->_draw->_showCursor & 6) != 0);
if (_vm->_global->_primarySurfDesc) {
int screenX = _screenDeltaX;
@@ -336,6 +353,10 @@ void Video::drawPackedSprite(byte *sprBuf, int16 width, int16 height,
void Video::drawPackedSprite(const char *path, Surface &dest, int width) {
int32 size;
byte *data = _vm->_dataIO->getFile(path, size);
+ if (!data) {
+ warning("Video::drawPackedSprite(): Failed to open sprite \"%s\"", path);
+ return;
+ }
drawPackedSprite(data, width, dest.getHeight(), 0, 0, 0, dest);
delete[] data;
diff --git a/engines/gob/video.h b/engines/gob/video.h
index ecbb579c5f..122c1e47d5 100644
--- a/engines/gob/video.h
+++ b/engines/gob/video.h
@@ -41,11 +41,16 @@ public:
uint8 getCharWidth () const;
uint8 getCharHeight() const;
+ bool hasChar(uint8 c) const;
+
bool isMonospaced() const;
void drawLetter(Surface &surf, uint8 c, uint16 x, uint16 y,
uint32 color1, uint32 color2, bool transp) const;
+ void drawString(const Common::String &str, int16 x, int16 y, int16 color1, int16 color2,
+ bool transp, Surface &dest) const;
+
private:
const byte *_dataPtr;
const byte *_data;
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 221f5ab3c9..a478492ccc 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -234,6 +234,23 @@ void VideoPlayer::closeAll() {
closeVideo(i);
}
+bool VideoPlayer::reopenVideo(int slot) {
+ Video *video = getVideoBySlot(slot);
+ if (!video)
+ return true;
+
+ return reopenVideo(*video);
+}
+
+bool VideoPlayer::reopenAll() {
+ bool all = true;
+ for (int i = 0; i < kVideoSlotCount; i++)
+ if (!reopenVideo(i))
+ all = false;
+
+ return all;
+}
+
void VideoPlayer::pauseVideo(int slot, bool pause) {
Video *video = getVideoBySlot(slot);
if (!video || !video->decoder)
@@ -850,6 +867,39 @@ Common::String VideoPlayer::findFile(const Common::String &file, Properties &pro
return video;
}
+bool VideoPlayer::reopenVideo(Video &video) {
+ if (video.isEmpty())
+ return true;
+
+ if (video.fileName.empty()) {
+ video.close();
+ return false;
+ }
+
+ Properties properties;
+
+ properties.type = video.properties.type;
+
+ Common::String fileName = findFile(video.fileName, properties);
+ if (fileName.empty()) {
+ video.close();
+ return false;
+ }
+
+ Common::SeekableReadStream *stream = _vm->_dataIO->getFile(fileName);
+ if (!stream) {
+ video.close();
+ return false;
+ }
+
+ if (!video.decoder->reloadStream(stream)) {
+ delete stream;
+ return false;
+ }
+
+ return true;
+}
+
void VideoPlayer::copyPalette(const Video &video, int16 palStart, int16 palEnd) {
if (!video.decoder->hasPalette() || !video.decoder->isPaletted())
return;
diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h
index bc7cb48768..129ccef67a 100644
--- a/engines/gob/videoplayer.h
+++ b/engines/gob/videoplayer.h
@@ -110,6 +110,9 @@ public:
void closeLiveSound();
void closeAll();
+ bool reopenVideo(int slot = 0);
+ bool reopenAll();
+
void pauseVideo(int slot, bool pause);
void pauseAll(bool pause);
@@ -163,6 +166,8 @@ private:
bool isEmpty() const;
void close();
+
+ void reopen();
};
static const int kVideoSlotCount = 32;
@@ -188,6 +193,8 @@ private:
::Video::CoktelDecoder *openVideo(const Common::String &file, Properties &properties);
+ bool reopenVideo(Video &video);
+
bool playFrame(int slot, Properties &properties);
void checkAbort(Video &video, Properties &properties);
diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp
index abefac54bd..6422570220 100644
--- a/engines/groovie/cursor.cpp
+++ b/engines/groovie/cursor.cpp
@@ -387,7 +387,7 @@ void Cursor_v2::enable() {
void Cursor_v2::showFrame(uint16 frame) {
int offset = _width * _height * frame * 2;
- CursorMan.replaceCursor((const byte *)(_img + offset), _width, _height, _width >> 1, _height >> 1, 0, 1, &_format);
+ CursorMan.replaceCursor((const byte *)(_img + offset), _width, _height, _width >> 1, _height >> 1, 0, false, &_format);
}
diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp
index 1a3b313649..895686b5e0 100644
--- a/engines/groovie/detection.cpp
+++ b/engines/groovie/detection.cpp
@@ -142,7 +142,7 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"11h", "Demo",
AD_ENTRY1s("disk.1", "aacb32ce07e0df2894bd83a3dee40c12", 70),
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE,
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE,
GUIO5(GUIO_NOLAUNCHLOAD, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieV2, 1
diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp
index c3ca03750a..73eb574dec 100644
--- a/engines/groovie/graphics.cpp
+++ b/engines/groovie/graphics.cpp
@@ -94,7 +94,7 @@ void GraphicsMan::mergeFgAndBg() {
}
void GraphicsMan::updateScreen(Graphics::Surface *source) {
- _vm->_system->copyRectToScreen((byte *)source->getBasePtr(0, 0), 640, 0, 80, 640, 320);
+ _vm->_system->copyRectToScreen(source->getBasePtr(0, 0), 640, 0, 80, 640, 320);
change();
}
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index f5f02b5cdd..726e7cbede 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -152,20 +152,26 @@ Common::Error GroovieEngine::run() {
break;
}
- // Create the music player
- switch (getPlatform()) {
- case Common::kPlatformMacintosh:
- // TODO: The 11th Hour Mac uses QuickTime MIDI files
- // Right now, since the XMIDI are present and it is still detected as
- // the DOS version, we don't have to do anything here.
- _musicPlayer = new MusicPlayerMac(this);
- break;
- case Common::kPlatformIOS:
+ // Detect ScummVM Music Enhancement Project presence (T7G only)
+ if (Common::File::exists("gu16.ogg") && _gameDescription->version == kGroovieT7G) {
+ // Load player for external files
_musicPlayer = new MusicPlayerIOS(this);
- break;
- default:
- _musicPlayer = new MusicPlayerXMI(this, _gameDescription->version == kGroovieT7G ? "fat" : "sample");
- break;
+ } else {
+ // Create the music player
+ switch (getPlatform()) {
+ case Common::kPlatformMacintosh:
+ // TODO: The 11th Hour Mac uses QuickTime MIDI files
+ // Right now, since the XMIDI are present and it is still detected as
+ // the DOS version, we don't have to do anything here.
+ _musicPlayer = new MusicPlayerMac(this);
+ break;
+ case Common::kPlatformIOS:
+ _musicPlayer = new MusicPlayerIOS(this);
+ break;
+ default:
+ _musicPlayer = new MusicPlayerXMI(this, _gameDescription->version == kGroovieT7G ? "fat" : "sample");
+ break;
+ }
}
// Load volume levels
diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp
index c26f04d6ee..42d76cabfa 100644
--- a/engines/groovie/resource.cpp
+++ b/engines/groovie/resource.cpp
@@ -242,6 +242,7 @@ uint32 ResMan_v2::getRef(Common::String name, Common::String scriptname) {
if (resname.hasPrefix(name.c_str())) {
debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource %18s matches %s", readname, name.c_str());
found = true;
+ break;
}
}
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 53f335ce68..72a61fefb2 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -30,8 +30,8 @@
#include "common/debug.h"
#include "common/textconsole.h"
-#include "graphics/jpeg.h"
#include "graphics/palette.h"
+#include "graphics/decoders/jpeg.h"
#ifdef USE_RGB_COLOR
// Required for the YUV to RGB conversion
@@ -160,7 +160,7 @@ bool ROQPlayer::playFrameInternal() {
if (_dirty) {
// Update the screen
- _syst->copyRectToScreen((byte *)_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
+ _syst->copyRectToScreen(_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
_syst->updateScreen();
// Clear the dirty flag
@@ -288,19 +288,18 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
// them it should be just fine.
_currBuf->create(width, height, Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
_prevBuf->create(width, height, Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
+ }
- // Clear the buffers with black YUV values
- byte *ptr1 = (byte *)_currBuf->getBasePtr(0, 0);
- byte *ptr2 = (byte *)_prevBuf->getBasePtr(0, 0);
- for (int i = 0; i < width * height; i++) {
- *ptr1++ = 0;
- *ptr1++ = 128;
- *ptr1++ = 128;
- *ptr2++ = 0;
- *ptr2++ = 128;
- *ptr2++ = 128;
- }
-
+ // Clear the buffers with black YUV values
+ byte *ptr1 = (byte *)_currBuf->getBasePtr(0, 0);
+ byte *ptr2 = (byte *)_prevBuf->getBasePtr(0, 0);
+ for (int i = 0; i < width * height; i++) {
+ *ptr1++ = 0;
+ *ptr1++ = 128;
+ *ptr1++ = 128;
+ *ptr2++ = 0;
+ *ptr2++ = 128;
+ *ptr2++ = 128;
}
return true;
@@ -405,7 +404,7 @@ void ROQPlayer::processBlockQuadVectorBlock(int baseX, int baseY, int8 Mx, int8
}
void ROQPlayer::processBlockQuadVectorBlockSub(int baseX, int baseY, int8 Mx, int8 My) {
- debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing quad vector sub block");
+ debugC(6, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing quad vector sub block");
uint16 codingType = getCodingType();
switch (codingType) {
@@ -433,13 +432,13 @@ void ROQPlayer::processBlockQuadVectorBlockSub(int baseX, int baseY, int8 Mx, in
bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) {
debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing still (JPEG) block");
- warning("Groovie::ROQ: JPEG frame (unfinshed)");
+ warning("Groovie::ROQ: JPEG frame (unfinished)");
- Graphics::JPEG *jpg = new Graphics::JPEG();
- jpg->read(_file);
- byte *y = (byte *)jpg->getComponent(1)->getBasePtr(0, 0);
- byte *u = (byte *)jpg->getComponent(2)->getBasePtr(0, 0);
- byte *v = (byte *)jpg->getComponent(3)->getBasePtr(0, 0);
+ Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder();
+ jpg->loadStream(*_file);
+ const byte *y = (const byte *)jpg->getComponent(1)->getBasePtr(0, 0);
+ const byte *u = (const byte *)jpg->getComponent(2)->getBasePtr(0, 0);
+ const byte *v = (const byte *)jpg->getComponent(3)->getBasePtr(0, 0);
byte *ptr = (byte *)_currBuf->getBasePtr(0, 0);
for (int i = 0; i < _currBuf->w * _currBuf->h; i++) {
diff --git a/engines/groovie/saveload.cpp b/engines/groovie/saveload.cpp
index 14e7a09cb2..1a92c02e0e 100644
--- a/engines/groovie/saveload.cpp
+++ b/engines/groovie/saveload.cpp
@@ -103,8 +103,6 @@ Common::InSaveFile *SaveLoad::openForLoading(const Common::String &target, int s
if (descriptor) {
// Initialize the SaveStateDescriptor
descriptor->setSaveSlot(slot);
- descriptor->setDeletableFlag(true);
- descriptor->setWriteProtectedFlag(false);
// TODO: Add extra information
//setSaveDate(int year, int month, int day)
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 68415233f4..cbbdecc3e7 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(_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320);
_vm->_system->updateScreen();
}
@@ -1231,7 +1231,7 @@ void Script::o_copyrecttobg() { // 0x37
memcpy(bg + offset, fg + offset, width);
offset += 640;
}
- _vm->_system->copyRectToScreen((byte *)_vm->_graphicsMan->_background.getBasePtr(left, top - 80), 640, left, top, width, height);
+ _vm->_system->copyRectToScreen(_vm->_graphicsMan->_background.getBasePtr(left, top - 80), 640, left, top, width, height);
_vm->_graphicsMan->change();
}
diff --git a/engines/hugo/console.cpp b/engines/hugo/console.cpp
index 19fd91e3fa..414c86e1d4 100644
--- a/engines/hugo/console.cpp
+++ b/engines/hugo/console.cpp
@@ -96,8 +96,8 @@ bool HugoConsole::Cmd_listObjects(int argc, const char **argv) {
DebugPrintf("Available objects for this game are:\n");
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (_vm->_object->_objects[i].genericCmd & TAKE)
- DebugPrintf("%2d - %s\n", i, _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2));
+ if (_vm->_object->_objects[i]._genericCmd & TAKE)
+ DebugPrintf("%2d - %s\n", i, _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2));
}
return true;
}
@@ -111,7 +111,7 @@ bool HugoConsole::Cmd_getObject(int argc, const char **argv) {
return true;
}
- if (_vm->_object->_objects[strToInt(argv[1])].genericCmd & TAKE)
+ if (_vm->_object->_objects[strToInt(argv[1])]._genericCmd & TAKE)
_vm->_parser->takeObject(&_vm->_object->_objects[strToInt(argv[1])]);
else
DebugPrintf("Object not available\n");
@@ -129,7 +129,7 @@ bool HugoConsole::Cmd_getAllObjects(int argc, const char **argv) {
}
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (_vm->_object->_objects[i].genericCmd & TAKE)
+ if (_vm->_object->_objects[i]._genericCmd & TAKE)
_vm->_parser->takeObject(&_vm->_object->_objects[i]);
}
@@ -145,7 +145,7 @@ bool HugoConsole::Cmd_boundaries(int argc, const char **argv) {
return true;
}
- _vm->getGameStatus().showBoundariesFl = !_vm->getGameStatus().showBoundariesFl;
+ _vm->getGameStatus()._showBoundariesFl = !_vm->getGameStatus()._showBoundariesFl;
return false;
}
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index 90708163f5..bb5944acc8 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -244,9 +244,6 @@ SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int s
Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
-
uint32 saveDate = file->readUint32BE();
uint16 saveTime = file->readUint16BE();
diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp
index c43cdd7b46..0f07d52aee 100644
--- a/engines/hugo/dialogs.cpp
+++ b/engines/hugo/dialogs.cpp
@@ -21,7 +21,7 @@
*/
#include "common/substream.h"
-#include "graphics/imagedec.h"
+#include "graphics/decoders/bmp.h"
#include "gui/gui-manager.h"
#include "gui/ThemeEval.h"
@@ -34,19 +34,19 @@
namespace Hugo {
-TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), arrayBmp(0), arraySize(0),
+TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), _arrayBmp(0), _arraySize(0),
_vm(vm) {
init();
}
TopMenu::~TopMenu() {
- for (int i = 0; i < arraySize; i++) {
- arrayBmp[i * 2]->free();
- delete arrayBmp[i * 2];
- arrayBmp[i * 2 + 1]->free();
- delete arrayBmp[i * 2 + 1];
+ for (int i = 0; i < _arraySize; i++) {
+ _arrayBmp[i * 2]->free();
+ delete _arrayBmp[i * 2];
+ _arrayBmp[i * 2 + 1]->free();
+ delete _arrayBmp[i * 2 + 1];
}
- delete[] arrayBmp;
+ delete[] _arrayBmp;
}
void TopMenu::init() {
@@ -108,53 +108,62 @@ void TopMenu::reflowLayout() {
x += kButtonWidth + kButtonPad;
// Set the graphics to the 'on' buttons, except for the variable ones
- _whatButton->setGfx(arrayBmp[4 * kMenuWhat + scale - 1]);
- _musicButton->setGfx(arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config.musicFl) ? 0 : 2)]);
- _soundFXButton->setGfx(arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config.soundFl) ? 0 : 2)]);
- _saveButton->setGfx(arrayBmp[4 * kMenuSave + scale - 1]);
- _loadButton->setGfx(arrayBmp[4 * kMenuLoad + scale - 1]);
- _recallButton->setGfx(arrayBmp[4 * kMenuRecall + scale - 1]);
- _turboButton->setGfx(arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config.turboFl) ? 0 : 2)]);
- _lookButton->setGfx(arrayBmp[4 * kMenuLook + scale - 1]);
- _inventButton->setGfx(arrayBmp[4 * kMenuInventory + scale - 1]);
+ _whatButton->setGfx(_arrayBmp[4 * kMenuWhat + scale - 1]);
+ _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config._musicFl) ? 0 : 2)]);
+ _soundFXButton->setGfx(_arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config._soundFl) ? 0 : 2)]);
+ _saveButton->setGfx(_arrayBmp[4 * kMenuSave + scale - 1]);
+ _loadButton->setGfx(_arrayBmp[4 * kMenuLoad + scale - 1]);
+ _recallButton->setGfx(_arrayBmp[4 * kMenuRecall + scale - 1]);
+ _turboButton->setGfx(_arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config._turboFl) ? 0 : 2)]);
+ _lookButton->setGfx(_arrayBmp[4 * kMenuLook + scale - 1]);
+ _inventButton->setGfx(_arrayBmp[4 * kMenuInventory + scale - 1]);
}
void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
- arraySize = in.readUint16BE();
+ _arraySize = in.readUint16BE();
- delete arrayBmp;
- arrayBmp = new Graphics::Surface *[arraySize * 2];
- for (int i = 0; i < arraySize; i++) {
+ delete _arrayBmp;
+ _arrayBmp = new Graphics::Surface *[_arraySize * 2];
+ for (int i = 0; i < _arraySize; i++) {
uint16 bmpSize = in.readUint16BE();
uint32 filPos = in.pos();
Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize);
- arrayBmp[i * 2] = Graphics::ImageDecoder::loadFile(stream, g_system->getOverlayFormat());
- arrayBmp[i * 2 + 1] = new Graphics::Surface();
- arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat());
- byte *src = (byte *)arrayBmp[i * 2]->pixels;
- byte *dst = (byte *)arrayBmp[i * 2 + 1]->pixels;
-
- for (int j = 0; j < arrayBmp[i * 2]->h; j++) {
- src = (byte *)arrayBmp[i * 2]->getBasePtr(0, j);
- dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
- for (int k = arrayBmp[i * 2]->w; k > 0; k--) {
- for (int m = arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) {
+
+ Graphics::BitmapDecoder bitmapDecoder;
+ if (!bitmapDecoder.loadStream(stream))
+ error("TopMenu::loadBmpArr(): Could not load bitmap");
+
+ const Graphics::Surface *bitmapSrc = bitmapDecoder.getSurface();
+ if (bitmapSrc->format.bytesPerPixel == 1)
+ error("TopMenu::loadBmpArr(): Unhandled paletted image");
+
+ _arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat());
+ _arrayBmp[i * 2 + 1] = new Graphics::Surface();
+ _arrayBmp[i * 2 + 1]->create(_arrayBmp[i * 2]->w * 2, _arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat());
+ byte *src = (byte *)_arrayBmp[i * 2]->pixels;
+ byte *dst = (byte *)_arrayBmp[i * 2 + 1]->pixels;
+
+ for (int j = 0; j < _arrayBmp[i * 2]->h; j++) {
+ src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j);
+ dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
+ for (int k = _arrayBmp[i * 2]->w; k > 0; k--) {
+ for (int m = _arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) {
*dst++ = *src++;
}
- src -= arrayBmp[i * 2]->format.bytesPerPixel;
+ src -= _arrayBmp[i * 2]->format.bytesPerPixel;
- for (int m = arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) {
+ for (int m = _arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) {
*dst++ = *src++;
}
}
- src = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
- dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2 + 1);
- for (int k = arrayBmp[i * 2 + 1]->pitch; k > 0; k--) {
+ src = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
+ dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2 + 1);
+ for (int k = _arrayBmp[i * 2 + 1]->pitch; k > 0; k--) {
*dst++ = *src++;
}
}
- in.skip(bmpSize);
+ in.seek(filPos + bmpSize);
}
}
@@ -162,12 +171,12 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d
switch (command) {
case kCmdWhat:
close();
- _vm->getGameStatus().helpFl = true;
+ _vm->getGameStatus()._helpFl = true;
break;
case kCmdMusic:
_vm->_sound->toggleMusic();
- _musicButton->setGfx(arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config.musicFl) ? 0 : 2)]);
+ _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config._musicFl) ? 0 : 2)]);
_musicButton->draw();
g_gui.theme()->updateScreen();
g_system->updateScreen();
@@ -185,8 +194,8 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d
break;
case kCmdSave:
close();
- if (_vm->getGameStatus().viewState == kViewPlay) {
- if (_vm->getGameStatus().gameOverFl)
+ if (_vm->getGameStatus()._viewState == kViewPlay) {
+ if (_vm->getGameStatus()._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -198,7 +207,7 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d
break;
case kCmdRecall:
close();
- _vm->getGameStatus().recallFl = true;
+ _vm->getGameStatus()._recallFl = true;
break;
case kCmdTurbo:
_vm->_parser->switchTurbo();
diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h
index 4e710ff2f8..114bcf56a9 100644
--- a/engines/hugo/dialogs.h
+++ b/engines/hugo/dialogs.h
@@ -94,8 +94,8 @@ protected:
GUI::PicButtonWidget *_lookButton;
GUI::PicButtonWidget *_inventButton;
- Graphics::Surface **arrayBmp;
- uint16 arraySize;
+ Graphics::Surface **_arrayBmp;
+ uint16 _arraySize;
};
class EntryDialog : public GUI::Dialog {
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index fa18d6b791..fbe39b3a0c 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -85,43 +85,43 @@ Screen::Screen(HugoEngine *vm) : _vm(vm) {
fontLoadedFl[i] = false;
}
for (int i = 0; i < kBlitListSize; i++) {
- _dlBlistList[i].x = 0;
- _dlBlistList[i].y = 0;
- _dlBlistList[i].dx = 0;
- _dlBlistList[i].dy = 0;
+ _dlBlistList[i]._x = 0;
+ _dlBlistList[i]._y = 0;
+ _dlBlistList[i]._dx = 0;
+ _dlBlistList[i]._dy = 0;
}
for (int i = 0; i < kRectListSize; i++) {
- _dlAddList[i].x = 0;
- _dlAddList[i].y = 0;
- _dlAddList[i].dx = 0;
- _dlAddList[i].dy = 0;
- _dlRestoreList[i].x = 0;
- _dlRestoreList[i].y = 0;
- _dlRestoreList[i].dx = 0;
- _dlRestoreList[i].dy = 0;
+ _dlAddList[i]._x = 0;
+ _dlAddList[i]._y = 0;
+ _dlAddList[i]._dx = 0;
+ _dlAddList[i]._dy = 0;
+ _dlRestoreList[i]._x = 0;
+ _dlRestoreList[i]._y = 0;
+ _dlRestoreList[i]._dx = 0;
+ _dlRestoreList[i]._dy = 0;
}
}
Screen::~Screen() {
}
-icondib_t &Screen::getIconBuffer() {
+Icondib &Screen::getIconBuffer() {
return _iconBuffer;
}
-viewdib_t &Screen::getBackBuffer() {
+Viewdib &Screen::getBackBuffer() {
return _backBuffer;
}
-viewdib_t &Screen::getBackBufferBackup() {
+Viewdib &Screen::getBackBufferBackup() {
return _backBufferBackup;
}
-viewdib_t &Screen::getFrontBuffer() {
+Viewdib &Screen::getFrontBuffer() {
return _frontBuffer;
}
-viewdib_t &Screen::getGUIBuffer() {
+Viewdib &Screen::getGUIBuffer() {
return _GUIBuffer;
}
@@ -149,7 +149,7 @@ void Screen::initDisplay() {
/**
* Move an image from source to destination
*/
-void Screen::moveImage(image_pt srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, image_pt dstImage, const int16 x2, const int16 y2, const int16 width2) {
+void Screen::moveImage(ImagePtr srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, ImagePtr dstImage, const int16 x2, const int16 y2, const int16 width2) {
debugC(3, kDebugDisplay, "moveImage(srcImage, %d, %d, %d, %d, %d, dstImage, %d, %d, %d)", x1, y1, dx, dy, width1, x2, y2, width2);
int16 wrap_src = width1 - dx; // Wrap to next src row
@@ -236,16 +236,16 @@ void Screen::setBackgroundColor(const uint16 color) {
* Merge an object frame into _frontBuffer at sx, sy and update rectangle list.
* If fore TRUE, force object above any overlay
*/
-void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool foreFl) {
+void Screen::displayFrame(const int sx, const int sy, Seq *seq, const bool foreFl) {
debugC(3, kDebugDisplay, "displayFrame(%d, %d, seq, %d)", sx, sy, (foreFl) ? 1 : 0);
- image_pt image = seq->imagePtr; // Ptr to object image data
- image_pt subFrontBuffer = &_frontBuffer[sy * kXPix + sx]; // Ptr to offset in _frontBuffer
- int16 frontBufferwrap = kXPix - seq->x2 - 1; // Wraps dest_p after each line
- int16 imageWrap = seq->bytesPerLine8 - seq->x2 - 1;
- overlayState_t overlayState = (foreFl) ? kOvlForeground : kOvlUndef; // Overlay state of object
- for (uint16 y = 0; y < seq->lines; y++) { // Each line in object
- for (uint16 x = 0; x <= seq->x2; x++) {
+ ImagePtr image = seq->_imagePtr; // Ptr to object image data
+ ImagePtr subFrontBuffer = &_frontBuffer[sy * kXPix + sx]; // Ptr to offset in _frontBuffer
+ int16 frontBufferwrap = kXPix - seq->_x2 - 1; // Wraps dest_p after each line
+ int16 imageWrap = seq->_bytesPerLine8 - seq->_x2 - 1;
+ OverlayState overlayState = (foreFl) ? kOvlForeground : kOvlUndef; // Overlay state of object
+ for (uint16 y = 0; y < seq->_lines; y++) { // Each line in object
+ for (uint16 x = 0; x <= seq->_x2; x++) {
if (*image) { // Non-transparent
byte ovlBound = _vm->_object->getFirstOverlay((uint16)(subFrontBuffer - _frontBuffer) >> 3); // Ptr into overlay bits
if (ovlBound & (0x80 >> ((uint16)(subFrontBuffer - _frontBuffer) & 7))) { // Overlay bit is set
@@ -265,24 +265,24 @@ void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool for
}
// Add this rectangle to the display list
- displayList(kDisplayAdd, sx, sy, seq->x2 + 1, seq->lines);
+ displayList(kDisplayAdd, sx, sy, seq->_x2 + 1, seq->_lines);
}
/**
* Merge rectangles A,B leaving result in B
*/
-void Screen::merge(const rect_t *rectA, rect_t *rectB) {
+void Screen::merge(const Rect *rectA, Rect *rectB) {
debugC(6, kDebugDisplay, "merge()");
- int16 xa = rectA->x + rectA->dx; // Find x2,y2 for each rectangle
- int16 xb = rectB->x + rectB->dx;
- int16 ya = rectA->y + rectA->dy;
- int16 yb = rectB->y + rectB->dy;
+ int16 xa = rectA->_x + rectA->_dx; // Find x2,y2 for each rectangle
+ int16 xb = rectB->_x + rectB->_dx;
+ int16 ya = rectA->_y + rectA->_dy;
+ int16 yb = rectB->_y + rectB->_dy;
- rectB->x = MIN(rectA->x, rectB->x); // Minimum x,y
- rectB->y = MIN(rectA->y, rectB->y);
- rectB->dx = MAX(xa, xb) - rectB->x; // Maximum dx,dy
- rectB->dy = MAX(ya, yb) - rectB->y;
+ rectB->_x = MIN(rectA->_x, rectB->_x); // Minimum x,y
+ rectB->_y = MIN(rectA->_y, rectB->_y);
+ rectB->_dx = MAX(xa, xb) - rectB->_x; // Maximum dx,dy
+ rectB->_dy = MAX(ya, yb) - rectB->_y;
}
/**
@@ -291,7 +291,7 @@ void Screen::merge(const rect_t *rectA, rect_t *rectB) {
* of blist. bmax is the max size of the blist. Note that blist can
* have holes, in which case dx = 0. Returns used length of blist.
*/
-int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 blen) {
+int16 Screen::mergeLists(Rect *list, Rect *blist, const int16 len, int16 blen) {
debugC(4, kDebugDisplay, "mergeLists()");
int16 coalesce[kBlitListSize]; // List of overlapping rects
@@ -299,9 +299,9 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble
for (int16 a = 0; a < len; a++, list++) {
// Compile list of overlapping rectangles in blit list
int16 c = 0;
- rect_t *bp = blist;
+ Rect *bp = blist;
for (int16 b = 0; b < blen; b++, bp++) {
- if (bp->dx) // blist entry used
+ if (bp->_dx) // blist entry used
if (isOverlapping(list, bp))
coalesce[c++] = b;
}
@@ -316,9 +316,9 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble
// Merge any more blist entries
while (--c) {
- rect_t *cp = &blist[coalesce[c]];
+ Rect *cp = &blist[coalesce[c]];
merge(cp, bp);
- cp->dx = 0; // Delete entry
+ cp->_dx = 0; // Delete entry
}
}
}
@@ -329,12 +329,12 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble
* Process the display list
* Trailing args are int16 x,y,dx,dy for the D_ADD operation
*/
-void Screen::displayList(dupdate_t update, ...) {
+void Screen::displayList(Dupdate update, ...) {
debugC(6, kDebugDisplay, "displayList()");
int16 blitLength = 0; // Length of blit list
va_list marker; // Args used for D_ADD operation
- rect_t *p; // Ptr to dlist entry
+ Rect *p; // Ptr to dlist entry
switch (update) {
case kDisplayInit: // Init lists, restore whole screen
@@ -348,10 +348,10 @@ void Screen::displayList(dupdate_t update, ...) {
}
va_start(marker, update); // Initialize variable arguments
p = &_dlAddList[_dlAddIndex];
- p->x = va_arg(marker, int); // x
- p->y = va_arg(marker, int); // y
- p->dx = va_arg(marker, int); // dx
- p->dy = va_arg(marker, int); // dy
+ p->_x = va_arg(marker, int); // x
+ p->_y = va_arg(marker, int); // y
+ p->_dx = va_arg(marker, int); // dx
+ p->_dy = va_arg(marker, int); // dy
va_end(marker); // Reset variable arguments
_dlAddIndex++;
break;
@@ -359,8 +359,8 @@ void Screen::displayList(dupdate_t update, ...) {
// Don't blit if newscreen just loaded because _frontBuffer will
// get blitted via InvalidateRect() at end of this cycle
// and blitting here causes objects to appear too soon.
- if (_vm->getGameStatus().newScreenFl) {
- _vm->getGameStatus().newScreenFl = false;
+ if (_vm->getGameStatus()._newScreenFl) {
+ _vm->getGameStatus()._newScreenFl = false;
break;
}
@@ -370,15 +370,15 @@ void Screen::displayList(dupdate_t update, ...) {
// Blit the combined blit-list
for (_dlRestoreIndex = 0, p = _dlBlistList; _dlRestoreIndex < blitLength; _dlRestoreIndex++, p++) {
- if (p->dx) // Marks a used entry
- displayRect(p->x, p->y, p->dx, p->dy);
+ if (p->_dx) // Marks a used entry
+ displayRect(p->_x, p->_y, p->_dx, p->_dy);
}
break;
case kDisplayRestore: // Restore each rectangle
for (_dlRestoreIndex = 0, p = _dlAddList; _dlRestoreIndex < _dlAddIndex; _dlRestoreIndex++, p++) {
// Restoring from _backBuffer to _frontBuffer
_dlRestoreList[_dlRestoreIndex] = *p; // Copy add-list to restore-list
- moveImage(_backBuffer, p->x, p->y, p->dx, p->dy, kXPix, _frontBuffer, p->x, p->y, kXPix);
+ moveImage(_backBuffer, p->_x, p->_y, p->_dx, p->_dy, kXPix, _frontBuffer, p->_x, p->_y, kXPix);
}
_dlAddIndex = 0; // Reset add-list
break;
@@ -488,7 +488,7 @@ void Screen::userHelp() const {
"F5 - Restore game\n"
"F6 - Inventory\n"
"F8 - Turbo button\n"
- "F9 - Boss button\n\n"
+ "\n"
"ESC - Return to game");
}
@@ -563,7 +563,7 @@ void Screen::initNewScreenDisplay() {
displayBackground();
// Stop premature object display in Display_list(D_DISPLAY)
- _vm->getGameStatus().newScreenFl = true;
+ _vm->getGameStatus()._newScreenFl = true;
}
/**
@@ -627,20 +627,20 @@ void Screen::hideCursor() {
CursorMan.showMouse(false);
}
-bool Screen::isInX(const int16 x, const rect_t *rect) const {
- return (x >= rect->x) && (x <= rect->x + rect->dx);
+bool Screen::isInX(const int16 x, const Rect *rect) const {
+ return (x >= rect->_x) && (x <= rect->_x + rect->_dx);
}
-bool Screen::isInY(const int16 y, const rect_t *rect) const {
- return (y >= rect->y) && (y <= rect->y + rect->dy);
+bool Screen::isInY(const int16 y, const Rect *rect) const {
+ return (y >= rect->_y) && (y <= rect->_y + rect->_dy);
}
/**
* Check if two rectangles are overlapping
*/
-bool Screen::isOverlapping(const rect_t *rectA, const rect_t *rectB) const {
- return (isInX(rectA->x, rectB) || isInX(rectA->x + rectA->dx, rectB) || isInX(rectB->x, rectA) || isInX(rectB->x + rectB->dx, rectA)) &&
- (isInY(rectA->y, rectB) || isInY(rectA->y + rectA->dy, rectB) || isInY(rectB->y, rectA) || isInY(rectB->y + rectB->dy, rectA));
+bool Screen::isOverlapping(const Rect *rectA, const Rect *rectB) const {
+ return (isInX(rectA->_x, rectB) || isInX(rectA->_x + rectA->_dx, rectB) || isInX(rectB->_x, rectA) || isInX(rectB->_x + rectB->_dx, rectA)) &&
+ (isInY(rectA->_y, rectB) || isInY(rectA->_y + rectA->_dy, rectB) || isInY(rectB->_y, rectA) || isInY(rectB->_y + rectB->_dy, rectA));
}
/**
@@ -650,19 +650,19 @@ bool Screen::isOverlapping(const rect_t *rectA, const rect_t *rectB) const {
* White = Fix objects, parts of background
*/
void Screen::drawBoundaries() {
- if (!_vm->getGameStatus().showBoundariesFl)
+ if (!_vm->getGameStatus()._showBoundariesFl)
return;
_vm->_mouse->drawHotspots();
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i]; // Get pointer to object
- if (obj->screenIndex == *_vm->_screen_p) {
- if ((obj->currImagePtr != 0) && (obj->cycling != kCycleInvisible))
- drawRectangle(false, obj->x + obj->currImagePtr->x1, obj->y + obj->currImagePtr->y1,
- obj->x + obj->currImagePtr->x2, obj->y + obj->currImagePtr->y2, _TLIGHTGREEN);
- else if ((obj->currImagePtr == 0) && (obj->vxPath != 0) && !obj->carriedFl)
- drawRectangle(false, obj->oldx, obj->oldy, obj->oldx + obj->vxPath, obj->oldy + obj->vyPath, _TBRIGHTWHITE);
+ Object *obj = &_vm->_object->_objects[i]; // Get pointer to object
+ if (obj->_screenIndex == *_vm->_screenPtr) {
+ if ((obj->_currImagePtr != 0) && (obj->_cycling != kCycleInvisible))
+ drawRectangle(false, obj->_x + obj->_currImagePtr->_x1, obj->_y + obj->_currImagePtr->_y1,
+ obj->_x + obj->_currImagePtr->_x2, obj->_y + obj->_currImagePtr->_y2, _TLIGHTGREEN);
+ else if ((obj->_currImagePtr == 0) && (obj->_vxPath != 0) && !obj->_carriedFl)
+ drawRectangle(false, obj->_oldx, obj->_oldy, obj->_oldx + obj->_vxPath, obj->_oldy + obj->_vyPath, _TBRIGHTWHITE);
}
}
g_system->copyRectToScreen(_frontBuffer, 320, 0, 0, 320, 200);
@@ -730,12 +730,12 @@ void Screen_v1d::loadFontArr(Common::ReadStream &in) {
* processed object by looking down the current column for an overlay
* base byte set (in which case the object is foreground).
*/
-overlayState_t Screen_v1d::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) {
+OverlayState Screen_v1d::findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) {
debugC(4, kDebugDisplay, "findOvl()");
- uint16 index = (uint16)(dst_p - _frontBuffer) >> 3;
+ uint16 index = (uint16)(dstPtr - _frontBuffer) >> 3;
- for (int i = 0; i < seq_p->lines-y; i++) { // Each line in object
+ for (int i = 0; i < seqPtr->_lines-y; i++) { // Each line in object
if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back.
return kOvlForeground;
index += kCompLineSize;
@@ -799,14 +799,14 @@ void Screen_v1w::loadFontArr(Common::ReadStream &in) {
* processed object by looking down the current column for an overlay
* base bit set (in which case the object is foreground).
*/
-overlayState_t Screen_v1w::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) {
+OverlayState Screen_v1w::findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) {
debugC(4, kDebugDisplay, "findOvl()");
- for (; y < seq_p->lines; y++) { // Each line in object
- byte ovb = _vm->_object->getBaseBoundary((uint16)(dst_p - _frontBuffer) >> 3); // Ptr into overlay bits
- if (ovb & (0x80 >> ((uint16)(dst_p - _frontBuffer) & 7))) // Overlay bit is set
+ for (; y < seqPtr->_lines; y++) { // Each line in object
+ byte ovb = _vm->_object->getBaseBoundary((uint16)(dstPtr - _frontBuffer) >> 3); // Ptr into overlay bits
+ if (ovb & (0x80 >> ((uint16)(dstPtr - _frontBuffer) & 7))) // Overlay bit is set
return kOvlForeground; // Found a bit - must be foreground
- dst_p += kXPix;
+ dstPtr += kXPix;
}
return kOvlBackground; // No bits set, must be background
diff --git a/engines/hugo/display.h b/engines/hugo/display.h
index 38c63e9fe5..00dc1b743c 100644
--- a/engines/hugo/display.h
+++ b/engines/hugo/display.h
@@ -31,18 +31,18 @@
#define HUGO_DISPLAY_H
namespace Hugo {
-enum overlayState_t {kOvlUndef, kOvlForeground, kOvlBackground}; // Overlay state
+enum OverlayState {kOvlUndef, kOvlForeground, kOvlBackground}; // Overlay state
static const int kCenter = -1; // Used to center text in x
class Screen {
public:
- struct rect_t { // Rectangle used in Display list
- int16 x; // Position in dib
- int16 y; // Position in dib
- int16 dx; // width
- int16 dy; // height
+ struct Rect { // Rectangle used in Display list
+ int16 _x; // Position in dib
+ int16 _y; // Position in dib
+ int16 _dx; // width
+ int16 _dy; // height
};
Screen(HugoEngine *vm);
@@ -55,8 +55,8 @@ public:
int16 stringLength(const char *s) const;
void displayBackground();
- void displayFrame(const int sx, const int sy, seq_t *seq, const bool foreFl);
- void displayList(dupdate_t update, ...);
+ void displayFrame(const int sx, const int sy, Seq *seq, const bool foreFl);
+ void displayList(Dupdate update, ...);
void displayRect(const int16 x, const int16 y, const int16 dx, const int16 dy);
void drawBoundaries();
void drawRectangle(const bool filledFl, const int16 x1, const int16 y1, const int16 x2, const int16 y2, const int color);
@@ -67,7 +67,7 @@ public:
void initDisplay();
void initNewScreenDisplay();
void loadPalette(Common::ReadStream &in);
- void moveImage(image_pt srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, image_pt dstImage, const int16 x2, const int16 y2, const int16 width2);
+ void moveImage(ImagePtr srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, ImagePtr dstImage, const int16 x2, const int16 y2, const int16 width2);
void remapPal(uint16 oldIndex, uint16 newIndex);
void resetInventoryObjId();
void restorePal(Common::ReadStream *f);
@@ -80,11 +80,11 @@ public:
void userHelp() const;
void writeStr(int16 sx, const int16 sy, const char *s, const byte color);
- icondib_t &getIconBuffer();
- viewdib_t &getBackBuffer();
- viewdib_t &getBackBufferBackup();
- viewdib_t &getFrontBuffer();
- viewdib_t &getGUIBuffer();
+ Icondib &getIconBuffer();
+ Viewdib &getBackBuffer();
+ Viewdib &getBackBufferBackup();
+ Viewdib &getFrontBuffer();
+ Viewdib &getGUIBuffer();
protected:
HugoEngine *_vm;
@@ -108,37 +108,37 @@ protected:
byte *_mainPalette;
int16 _arrayFontSize[kNumFonts];
- viewdib_t _frontBuffer;
+ Viewdib _frontBuffer;
- inline bool isInX(const int16 x, const rect_t *rect) const;
- inline bool isInY(const int16 y, const rect_t *rect) const;
- inline bool isOverlapping(const rect_t *rectA, const rect_t *rectB) const;
+ inline bool isInX(const int16 x, const Rect *rect) const;
+ inline bool isInY(const int16 y, const Rect *rect) const;
+ inline bool isOverlapping(const Rect *rectA, const Rect *rectB) const;
- virtual overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) = 0;
+ virtual OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) = 0;
private:
byte *_curPalette;
byte _iconImage[kInvDx * kInvDy];
byte _paletteSize;
- icondib_t _iconBuffer; // Inventory icon DIB
+ Icondib _iconBuffer; // Inventory icon DIB
- int16 mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 blen);
+ int16 mergeLists(Rect *list, Rect *blist, const int16 len, int16 blen);
int16 center(const char *s) const;
- viewdib_t _backBuffer;
- viewdib_t _GUIBuffer; // User interface images
- viewdib_t _backBufferBackup; // Backup _backBuffer during inventory
+ Viewdib _backBuffer;
+ Viewdib _GUIBuffer; // User interface images
+ Viewdib _backBufferBackup; // Backup _backBuffer during inventory
// Formerly static variables used by displayList()
int16 _dlAddIndex, _dlRestoreIndex; // Index into add/restore lists
- rect_t _dlRestoreList[kRectListSize]; // The restore list
- rect_t _dlAddList[kRectListSize]; // The add list
- rect_t _dlBlistList[kBlitListSize]; // The blit list
+ Rect _dlRestoreList[kRectListSize]; // The restore list
+ Rect _dlAddList[kRectListSize]; // The add list
+ Rect _dlBlistList[kBlitListSize]; // The blit list
//
void createPal();
- void merge(const rect_t *rectA, rect_t *rectB);
+ void merge(const Rect *rectA, Rect *rectB);
void writeChr(const int sx, const int sy, const byte color, const char *local_fontdata);
};
@@ -150,7 +150,7 @@ public:
void loadFont(int16 fontId);
void loadFontArr(Common::ReadStream &in);
protected:
- overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y);
+ OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y);
};
class Screen_v1w : public Screen {
@@ -161,7 +161,7 @@ public:
void loadFont(int16 fontId);
void loadFontArr(Common::ReadStream &in);
protected:
- overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y);
+ OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y);
};
} // End of namespace Hugo
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index 2217cef92a..1758f3f6a5 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -32,7 +32,11 @@
#include "common/savefile.h"
#include "common/textconsole.h"
#include "common/config-manager.h"
+
+#include "graphics/surface.h"
+#include "graphics/decoders/pcx.h"
#include "graphics/thumbnail.h"
+
#include "gui/saveload.h"
#include "hugo/hugo.h"
@@ -53,8 +57,8 @@ static const int s_bootCypherLen = sizeof(s_bootCypher) - 1;
FileManager::FileManager(HugoEngine *vm) : _vm(vm) {
- has_read_header = false;
- firstUIFFl = true;
+ _hasReadHeader = false;
+ _firstUIFFl = true;
}
FileManager::~FileManager() {
@@ -88,66 +92,33 @@ const char *FileManager::getUifFilename() const {
}
/**
- * Convert 4 planes (RGBI) data to 8-bit DIB format
- * Return original plane data ptr
- */
-byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const {
- debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, image_pt data_p)", y, bpl);
-
- dataPtr += y * bpl * 8; // Point to correct DIB line
- for (int16 r = 0, g = bpl, b = g + bpl, i = b + bpl; r < bpl; r++, g++, b++, i++) { // Each byte in all planes
- for (int8 bit = 7; bit >= 0; bit--) { // Each bit in byte
- *dataPtr++ = (((p[r] >> bit & 1) << 0) |
- ((p[g] >> bit & 1) << 1) |
- ((p[b] >> bit & 1) << 2) |
- ((p[i] >> bit & 1) << 3));
- }
- }
- return p;
-}
-
-/**
- * Read a pcx file of length len. Use supplied seq_p and image_p or
- * allocate space if NULL. Name used for errors. Returns address of seq_p
+ * Read a pcx file of length len. Use supplied seqPtr and image_p or
+ * allocate space if NULL. Name used for errors. Returns address of seqPtr
* Set first TRUE to initialize b_index (i.e. not reading a sequential image in file).
*/
-seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name) {
+Seq *FileManager::readPCX(Common::SeekableReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name) {
debugC(1, kDebugFile, "readPCX(..., %s)", name);
- // Read in the PCC header and check consistency
- PCC_header.mfctr = f.readByte();
- PCC_header.vers = f.readByte();
- PCC_header.enc = f.readByte();
- PCC_header.bpx = f.readByte();
- PCC_header.x1 = f.readUint16LE();
- PCC_header.y1 = f.readUint16LE();
- PCC_header.x2 = f.readUint16LE();
- PCC_header.y2 = f.readUint16LE();
- PCC_header.xres = f.readUint16LE();
- PCC_header.yres = f.readUint16LE();
- f.read(PCC_header.palette, sizeof(PCC_header.palette));
- PCC_header.vmode = f.readByte();
- PCC_header.planes = f.readByte();
- PCC_header.bytesPerLine = f.readUint16LE();
- f.read(PCC_header.fill2, sizeof(PCC_header.fill2));
-
- if (PCC_header.mfctr != 10)
- error("Bad data file format: %s", name);
-
- // Allocate memory for seq_t if 0
+ // Allocate memory for Seq if 0
if (seqPtr == 0) {
- if ((seqPtr = (seq_t *)malloc(sizeof(seq_t))) == 0)
+ if ((seqPtr = (Seq *)malloc(sizeof(Seq))) == 0)
error("Insufficient memory to run game.");
}
+ Graphics::PCXDecoder pcx;
+ if (!pcx.loadStream(f))
+ error("Error while reading PCX image");
+
+ const Graphics::Surface *pcxSurface = pcx.getSurface();
+ if (pcxSurface->format.bytesPerPixel != 1)
+ error("Invalid bytes per pixel in PCX surface (%d)", pcxSurface->format.bytesPerPixel);
+
// Find size of image data in 8-bit DIB format
// Note save of x2 - marks end of valid data before garbage
- uint16 bytesPerLine4 = PCC_header.bytesPerLine * 4; // 4-bit bpl
- seqPtr->bytesPerLine8 = bytesPerLine4 * 2; // 8-bit bpl
- seqPtr->lines = PCC_header.y2 - PCC_header.y1 + 1;
- seqPtr->x2 = PCC_header.x2 - PCC_header.x1 + 1;
+ seqPtr->_lines = pcxSurface->h;
+ seqPtr->_x2 = seqPtr->_bytesPerLine8 = pcxSurface->w;
// Size of the image
- uint16 size = seqPtr->lines * seqPtr->bytesPerLine8;
+ uint16 size = pcxSurface->w * pcxSurface->h;
// Allocate memory for image data if NULL
if (imagePtr == 0)
@@ -155,35 +126,18 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr
assert(imagePtr);
- seqPtr->imagePtr = imagePtr;
-
- // Process the image data, converting to 8-bit DIB format
- uint16 y = 0; // Current line index
- byte pline[kXPix]; // Hold 4 planes of data
- byte *p = pline; // Ptr to above
- while (y < seqPtr->lines) {
- byte c = f.readByte();
- if ((c & kRepeatMask) == kRepeatMask) {
- byte d = f.readByte(); // Read data byte
- for (int i = 0; i < (c & kLengthMask); i++) {
- *p++ = d;
- if ((uint16)(p - pline) == bytesPerLine4)
- p = convertPCC(pline, y++, PCC_header.bytesPerLine, imagePtr);
- }
- } else {
- *p++ = c;
- if ((uint16)(p - pline) == bytesPerLine4)
- p = convertPCC(pline, y++, PCC_header.bytesPerLine, imagePtr);
- }
- }
+ seqPtr->_imagePtr = imagePtr;
+ for (uint16 y = 0; y < pcxSurface->h; y++)
+ memcpy(imagePtr + y * pcxSurface->w, pcxSurface->getBasePtr(0, y), pcxSurface->w);
+
return seqPtr;
}
/**
* Read object file of PCC images into object supplied
*/
-void FileManager::readImage(const int objNum, object_t *objPtr) {
- debugC(1, kDebugFile, "readImage(%d, object_t *objPtr)", objNum);
+void FileManager::readImage(const int objNum, Object *objPtr) {
+ debugC(1, kDebugFile, "readImage(%d, Object *objPtr)", objNum);
/**
* Structure of object file lookup entry
@@ -193,7 +147,7 @@ void FileManager::readImage(const int objNum, object_t *objPtr) {
uint32 objLength;
};
- if (!objPtr->seqNumb) // This object has no images
+ if (!objPtr->_seqNumb) // This object has no images
return;
if (_vm->isPacked()) {
@@ -206,72 +160,72 @@ void FileManager::readImage(const int objNum, object_t *objPtr) {
_objectsArchive.seek(objBlock.objOffset, SEEK_SET);
} else {
Common::String buf;
- buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + ".PIX";
+ buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX";
if (!_objectsArchive.open(buf)) {
- buf = Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + ".PIX";
+ buf = Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX";
if (!_objectsArchive.open(buf))
error("File not found: %s", buf.c_str());
}
}
bool firstImgFl = true; // Initializes pcx read function
- seq_t *seqPtr = 0; // Ptr to sequence structure
+ Seq *seqPtr = 0; // Ptr to sequence structure
// Now read the images into an images list
- for (int j = 0; j < objPtr->seqNumb; j++) { // for each sequence
- for (int k = 0; k < objPtr->seqList[j].imageNbr; k++) { // each image
+ for (int j = 0; j < objPtr->_seqNumb; j++) { // for each sequence
+ for (int k = 0; k < objPtr->_seqList[j]._imageNbr; k++) { // each image
if (k == 0) { // First image
// Read this image - allocate both seq and image memory
- seqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->nounIndex, 0));
- objPtr->seqList[j].seqPtr = seqPtr;
+ seqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->_nounIndex, 0));
+ objPtr->_seqList[j]._seqPtr = seqPtr;
firstImgFl = false;
} else { // Subsequent image
// Read this image - allocate both seq and image memory
- seqPtr->nextSeqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->nounIndex, 0));
- seqPtr = seqPtr->nextSeqPtr;
+ seqPtr->_nextSeqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->_nounIndex, 0));
+ seqPtr = seqPtr->_nextSeqPtr;
}
// Compute the bounding box - x1, x2, y1, y2
// Note use of x2 - marks end of valid data in row
- uint16 x2 = seqPtr->x2;
- seqPtr->x1 = seqPtr->x2;
- seqPtr->x2 = 0;
- seqPtr->y1 = seqPtr->lines;
- seqPtr->y2 = 0;
-
- image_pt dibPtr = seqPtr->imagePtr;
- for (int y = 0; y < seqPtr->lines; y++, dibPtr += seqPtr->bytesPerLine8 - x2) {
+ uint16 x2 = seqPtr->_x2;
+ seqPtr->_x1 = seqPtr->_x2;
+ seqPtr->_x2 = 0;
+ seqPtr->_y1 = seqPtr->_lines;
+ seqPtr->_y2 = 0;
+
+ ImagePtr dibPtr = seqPtr->_imagePtr;
+ for (int y = 0; y < seqPtr->_lines; y++, dibPtr += seqPtr->_bytesPerLine8 - x2) {
for (int x = 0; x < x2; x++) {
if (*dibPtr++) { // Some data found
- if (x < seqPtr->x1)
- seqPtr->x1 = x;
- if (x > seqPtr->x2)
- seqPtr->x2 = x;
- if (y < seqPtr->y1)
- seqPtr->y1 = y;
- if (y > seqPtr->y2)
- seqPtr->y2 = y;
+ if (x < seqPtr->_x1)
+ seqPtr->_x1 = x;
+ if (x > seqPtr->_x2)
+ seqPtr->_x2 = x;
+ if (y < seqPtr->_y1)
+ seqPtr->_y1 = y;
+ if (y > seqPtr->_y2)
+ seqPtr->_y2 = y;
}
}
}
}
assert(seqPtr);
- seqPtr->nextSeqPtr = objPtr->seqList[j].seqPtr; // loop linked list to head
+ seqPtr->_nextSeqPtr = objPtr->_seqList[j]._seqPtr; // loop linked list to head
}
// Set the current image sequence to first or last
- switch (objPtr->cycling) {
+ switch (objPtr->_cycling) {
case kCycleInvisible: // (May become visible later)
case kCycleAlmostInvisible:
case kCycleNotCycling:
case kCycleForward:
- objPtr->currImagePtr = objPtr->seqList[0].seqPtr;
+ objPtr->_currImagePtr = objPtr->_seqList[0]._seqPtr;
break;
case kCycleBackward:
- objPtr->currImagePtr = seqPtr;
+ objPtr->_currImagePtr = seqPtr;
break;
default:
- warning("Unexpected cycling: %d", objPtr->cycling);
+ warning("Unexpected cycling: %d", objPtr->_cycling);
}
if (!_vm->isPacked())
@@ -282,7 +236,7 @@ void FileManager::readImage(const int objNum, object_t *objPtr) {
* Read sound (or music) file data. Call with SILENCE to free-up
* any allocated memory. Also returns size of data
*/
-sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
+SoundPtr FileManager::getSound(const int16 sound, uint16 *size) {
debugC(1, kDebugFile, "getSound(%d)", sound);
// No more to do if SILENCE (called for cleanup purposes)
@@ -296,27 +250,27 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
return 0;
}
- if (!has_read_header) {
+ if (!_hasReadHeader) {
for (int i = 0; i < kMaxSounds; i++) {
- s_hdr[i].size = fp.readUint16LE();
- s_hdr[i].offset = fp.readUint32LE();
+ _soundHdr[i]._size = fp.readUint16LE();
+ _soundHdr[i]._offset = fp.readUint32LE();
}
if (fp.err())
error("Wrong sound file format");
- has_read_header = true;
+ _hasReadHeader = true;
}
- *size = s_hdr[sound].size;
+ *size = _soundHdr[sound]._size;
if (*size == 0)
error("Wrong sound file format or missing sound %d", sound);
// Allocate memory for sound or music, if possible
- sound_pt soundPtr = (byte *)malloc(s_hdr[sound].size); // Ptr to sound data
+ SoundPtr soundPtr = (byte *)malloc(_soundHdr[sound]._size); // Ptr to sound data
assert(soundPtr);
// Seek to data and read it
- fp.seek(s_hdr[sound].offset, SEEK_SET);
- if (fp.read(soundPtr, s_hdr[sound].size) != s_hdr[sound].size)
+ fp.seek(_soundHdr[sound]._offset, SEEK_SET);
+ if (fp.read(soundPtr, _soundHdr[sound]._size) != _soundHdr[sound]._size)
error("Wrong sound file format");
fp.close();
@@ -330,15 +284,12 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
debugC(1, kDebugFile, "saveGame(%d, %s)", slot, descrip.c_str());
- const EnginePlugin *plugin = NULL;
int16 savegameId;
Common::String savegameDescription;
- EngineMan.findGame(_vm->getGameId(), &plugin);
if (slot == -1) {
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
- dialog->setSaveMode(true);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true);
+ savegameId = dialog->runModalWithCurrentTarget();
savegameDescription = dialog->getResultString();
delete dialog;
} else {
@@ -385,7 +336,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
_vm->_object->saveObjects(out);
- const status_t &gameStatus = _vm->getGameStatus();
+ const Status &gameStatus = _vm->getGameStatus();
// Save whether hero image is swapped
out->writeByte(_vm->_heroImage);
@@ -394,13 +345,13 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
out->writeSint16BE(_vm->getScore());
// Save story mode
- out->writeByte((gameStatus.storyModeFl) ? 1 : 0);
+ out->writeByte((gameStatus._storyModeFl) ? 1 : 0);
// Save jumpexit mode
out->writeByte((_vm->_mouse->getJumpExitFl()) ? 1 : 0);
// Save gameover status
- out->writeByte((gameStatus.gameOverFl) ? 1 : 0);
+ out->writeByte((gameStatus._gameOverFl) ? 1 : 0);
// Save screen states
for (int i = 0; i < _vm->_numStates; i++)
@@ -411,17 +362,17 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
_vm->_screen->savePal(out);
// Save maze status
- out->writeByte((_vm->_maze.enabledFl) ? 1 : 0);
- out->writeByte(_vm->_maze.size);
- out->writeSint16BE(_vm->_maze.x1);
- out->writeSint16BE(_vm->_maze.y1);
- out->writeSint16BE(_vm->_maze.x2);
- out->writeSint16BE(_vm->_maze.y2);
- out->writeSint16BE(_vm->_maze.x3);
- out->writeSint16BE(_vm->_maze.x4);
- out->writeByte(_vm->_maze.firstScreenIndex);
-
- out->writeByte((byte)_vm->getGameStatus().viewState);
+ out->writeByte((_vm->_maze._enabledFl) ? 1 : 0);
+ out->writeByte(_vm->_maze._size);
+ out->writeSint16BE(_vm->_maze._x1);
+ out->writeSint16BE(_vm->_maze._y1);
+ out->writeSint16BE(_vm->_maze._x2);
+ out->writeSint16BE(_vm->_maze._y2);
+ out->writeSint16BE(_vm->_maze._x3);
+ out->writeSint16BE(_vm->_maze._x4);
+ out->writeByte(_vm->_maze._firstScreenIndex);
+
+ out->writeByte((byte)_vm->getGameStatus()._viewState);
out->finalize();
@@ -436,14 +387,11 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
bool FileManager::restoreGame(const int16 slot) {
debugC(1, kDebugFile, "restoreGame(%d)", slot);
- const EnginePlugin *plugin = NULL;
int16 savegameId;
- EngineMan.findGame(_vm->getGameId(), &plugin);
if (slot == -1) {
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
- dialog->setSaveMode(false);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false);
+ savegameId = dialog->runModalWithCurrentTarget();
delete dialog;
} else {
savegameId = slot;
@@ -492,14 +440,14 @@ bool FileManager::restoreGame(const int16 slot) {
_vm->_object->swapImages(kHeroIndex, _vm->_heroImage);
_vm->_heroImage = heroImg;
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
int score = in->readSint16BE();
_vm->setScore(score);
- gameStatus.storyModeFl = (in->readByte() == 1);
+ gameStatus._storyModeFl = (in->readByte() == 1);
_vm->_mouse->setJumpExitFl(in->readByte() == 1);
- gameStatus.gameOverFl = (in->readByte() == 1);
+ gameStatus._gameOverFl = (in->readByte() == 1);
for (int i = 0; i < _vm->_numStates; i++)
_vm->_screenStates[i] = in->readByte();
@@ -509,18 +457,18 @@ bool FileManager::restoreGame(const int16 slot) {
_vm->_screen->restorePal(in);
// Restore maze status
- _vm->_maze.enabledFl = (in->readByte() == 1);
- _vm->_maze.size = in->readByte();
- _vm->_maze.x1 = in->readSint16BE();
- _vm->_maze.y1 = in->readSint16BE();
- _vm->_maze.x2 = in->readSint16BE();
- _vm->_maze.y2 = in->readSint16BE();
- _vm->_maze.x3 = in->readSint16BE();
- _vm->_maze.x4 = in->readSint16BE();
- _vm->_maze.firstScreenIndex = in->readByte();
-
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- if ((_vm->getGameStatus().viewState = (vstate_t) in->readByte()) != kViewPlay)
+ _vm->_maze._enabledFl = (in->readByte() == 1);
+ _vm->_maze._size = in->readByte();
+ _vm->_maze._x1 = in->readSint16BE();
+ _vm->_maze._y1 = in->readSint16BE();
+ _vm->_maze._x2 = in->readSint16BE();
+ _vm->_maze._y2 = in->readSint16BE();
+ _vm->_maze._x3 = in->readSint16BE();
+ _vm->_maze._x4 = in->readSint16BE();
+ _vm->_maze._firstScreenIndex = in->readByte();
+
+ _vm->_scheduler->restoreScreen(*_vm->_screenPtr);
+ if ((_vm->getGameStatus()._viewState = (Vstate) in->readByte()) != kViewPlay)
_vm->_screen->hideCursor();
@@ -529,49 +477,6 @@ bool FileManager::restoreGame(const int16 slot) {
}
/**
- * Read the encrypted text from the boot file and print it
- */
-void FileManager::printBootText() {
- debugC(1, kDebugFile, "printBootText()");
-
- Common::File ofp;
- if (!ofp.open(getBootFilename())) {
- if (_vm->getPlatform() == Common::kPlatformPC) {
- //TODO initialize properly _boot structure
- warning("printBootText - Skipping as Dos versions may be a freeware or shareware");
- return;
- } else {
- Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename()));
- _vm->getGameStatus().doQuitFl = true;
- return;
- }
- }
-
- // Allocate space for the text and print it
- char *buf = (char *)malloc(_vm->_boot.exit_len + 1);
- if (buf) {
- // Skip over the boot structure (already read) and read exit text
- ofp.seek((long)sizeof(_vm->_boot), SEEK_SET);
- if (ofp.read(buf, _vm->_boot.exit_len) != (size_t)_vm->_boot.exit_len) {
- Utils::notifyBox(Common::String::format("Error while reading startup file '%s'", getBootFilename()));
- _vm->getGameStatus().doQuitFl = true;
- return;
- }
-
- // Decrypt the exit text, using CRYPT substring
- int i;
- for (i = 0; i < _vm->_boot.exit_len; i++)
- buf[i] ^= s_bootCypher[i % s_bootCypherLen];
-
- buf[i] = '\0';
- Utils::notifyBox(buf);
- }
-
- free(buf);
- ofp.close();
-}
-
-/**
* Reads boot file for program environment. Fatal error if not there or
* file checksum is bad. De-crypts structure while checking checksum
*/
@@ -583,32 +488,32 @@ void FileManager::readBootFile() {
if (_vm->_gameVariant == kGameVariantH1Dos) {
//TODO initialize properly _boot structure
warning("readBootFile - Skipping as H1 Dos may be a freeware");
- memset(_vm->_boot.distrib, '\0', sizeof(_vm->_boot.distrib));
- _vm->_boot.registered = kRegFreeware;
+ memset(_vm->_boot._distrib, '\0', sizeof(_vm->_boot._distrib));
+ _vm->_boot._registered = kRegFreeware;
return;
} else if (_vm->getPlatform() == Common::kPlatformPC) {
warning("readBootFile - Skipping as H2 and H3 Dos may be shareware");
- memset(_vm->_boot.distrib, '\0', sizeof(_vm->_boot.distrib));
- _vm->_boot.registered = kRegShareware;
+ memset(_vm->_boot._distrib, '\0', sizeof(_vm->_boot._distrib));
+ _vm->_boot._registered = kRegShareware;
return;
} else {
Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename()));
- _vm->getGameStatus().doQuitFl = true;
+ _vm->getGameStatus()._doQuitFl = true;
return;
}
}
if (ofp.size() < (int32)sizeof(_vm->_boot)) {
Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename()));
- _vm->getGameStatus().doQuitFl = true;
+ _vm->getGameStatus()._doQuitFl = true;
return;
}
- _vm->_boot.checksum = ofp.readByte();
- _vm->_boot.registered = ofp.readByte();
- ofp.read(_vm->_boot.pbswitch, sizeof(_vm->_boot.pbswitch));
- ofp.read(_vm->_boot.distrib, sizeof(_vm->_boot.distrib));
- _vm->_boot.exit_len = ofp.readUint16LE();
+ _vm->_boot._checksum = ofp.readByte();
+ _vm->_boot._registered = ofp.readByte();
+ ofp.read(_vm->_boot._pbswitch, sizeof(_vm->_boot._pbswitch));
+ ofp.read(_vm->_boot._distrib, sizeof(_vm->_boot._distrib));
+ _vm->_boot._exitLen = ofp.readUint16LE();
byte *p = (byte *)&_vm->_boot;
@@ -621,7 +526,7 @@ void FileManager::readBootFile() {
if (checksum) {
Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename()));
- _vm->getGameStatus().doQuitFl = true;
+ _vm->getGameStatus()._doQuitFl = true;
}
}
@@ -630,28 +535,28 @@ void FileManager::readBootFile() {
* This file contains, between others, the bitmaps of the fonts used in the application
* UIF means User interface database (Windows Only)
*/
-uif_hdr_t *FileManager::getUIFHeader(const uif_t id) {
+UifHdr *FileManager::getUIFHeader(const Uif id) {
debugC(1, kDebugFile, "getUIFHeader(%d)", id);
// Initialize offset lookup if not read yet
- if (firstUIFFl) {
- firstUIFFl = false;
+ if (_firstUIFFl) {
+ _firstUIFFl = false;
// Open unbuffered to do far read
Common::File ip; // Image data file
if (!ip.open(getUifFilename()))
error("File not found: %s", getUifFilename());
- if (ip.size() < (int32)sizeof(UIFHeader))
+ if (ip.size() < (int32)sizeof(_UIFHeader))
error("Wrong UIF file format");
for (int i = 0; i < kMaxUifs; ++i) {
- UIFHeader[i].size = ip.readUint16LE();
- UIFHeader[i].offset = ip.readUint32LE();
+ _UIFHeader[i]._size = ip.readUint16LE();
+ _UIFHeader[i]._offset = ip.readUint32LE();
}
ip.close();
}
- return &UIFHeader[id];
+ return &_UIFHeader[id];
}
/**
@@ -666,18 +571,18 @@ void FileManager::readUIFItem(const int16 id, byte *buf) {
error("File not found: %s", getUifFilename());
// Seek to data
- uif_hdr_t *UIFHeaderPtr = getUIFHeader((uif_t)id);
- ip.seek(UIFHeaderPtr->offset, SEEK_SET);
+ UifHdr *_UIFHeaderPtr = getUIFHeader((Uif)id);
+ ip.seek(_UIFHeaderPtr->_offset, SEEK_SET);
// We support pcx images and straight data
- seq_t *dummySeq; // Dummy seq_t for image data
+ Seq *dummySeq; // Dummy Seq for image data
switch (id) {
case UIF_IMAGES: // Read uif images file
dummySeq = readPCX(ip, 0, buf, true, getUifFilename());
free(dummySeq);
break;
default: // Read file data into supplied array
- if (ip.read(buf, UIFHeaderPtr->size) != UIFHeaderPtr->size)
+ if (ip.read(buf, _UIFHeaderPtr->_size) != _UIFHeaderPtr->_size)
error("Wrong UIF file format");
break;
}
diff --git a/engines/hugo/file.h b/engines/hugo/file.h
index 3792c01ab4..44f257a2af 100644
--- a/engines/hugo/file.h
+++ b/engines/hugo/file.h
@@ -34,11 +34,11 @@ namespace Hugo {
/**
* Enumerate overlay file types
*/
-enum ovl_t {kOvlBoundary, kOvlOverlay, kOvlBase};
+enum OvlType {kOvlBoundary, kOvlOverlay, kOvlBase};
-struct uif_hdr_t { // UIF font/image look up
- uint16 size; // Size of uif item
- uint32 offset; // Offset of item in file
+struct UifHdr { // UIF font/image look up
+ uint16 _size; // Size of uif item
+ uint32 _offset; // Offset of item in file
};
@@ -47,10 +47,10 @@ public:
FileManager(HugoEngine *vm);
virtual ~FileManager();
- sound_pt getSound(const int16 sound, uint16 *size);
+ SoundPtr getSound(const int16 sound, uint16 *size);
void readBootFile();
- void readImage(const int objNum, object_t *objPtr);
+ void readImage(const int objNum, Object *objPtr);
void readUIFImages();
void readUIFItem(const int16 id, byte *buf);
bool restoreGame(const int16 slot);
@@ -69,7 +69,7 @@ public:
virtual void instructions() const = 0;
virtual void readBackground(const int screenIndex) = 0;
- virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType) = 0;
+ virtual void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) = 0;
virtual const char *fetchString(const int index) = 0;
@@ -84,48 +84,42 @@ protected:
/**
* Structure of scenery file lookup entry
*/
- struct sceneBlock_t {
- uint32 scene_off;
- uint32 scene_len;
- uint32 b_off;
- uint32 b_len;
- uint32 o_off;
- uint32 o_len;
- uint32 ob_off;
- uint32 ob_len;
+ struct SceneBlock {
+ uint32 _sceneOffset;
+ uint32 _sceneLength;
+ uint32 _boundaryOffset;
+ uint32 _boundaryLength;
+ uint32 _overlayOffset;
+ uint32 _overlayLength;
+ uint32 _baseOffset;
+ uint32 _baseLength;
};
- struct PCC_header_t { // Structure of PCX file header
- byte mfctr, vers, enc, bpx;
- uint16 x1, y1, x2, y2; // bounding box
- uint16 xres, yres;
- byte palette[3 * kNumColors]; // EGA color palette
- byte vmode, planes;
- uint16 bytesPerLine; // Bytes per line
- byte fill2[60];
+ struct PCCHeader { // Structure of PCX file header
+ byte _mfctr, _vers, _enc, _bpx;
+ uint16 _x1, _y1, _x2, _y2; // bounding box
+ uint16 _xres, _yres;
+ byte _palette[3 * kNumColors]; // EGA color palette
+ byte _vmode, _planes;
+ uint16 _bytesPerLine; // Bytes per line
+ byte _fill2[60];
}; // Header of a PCC file
- bool firstUIFFl;
- uif_hdr_t UIFHeader[kMaxUifs]; // Lookup for uif fonts/images
+ bool _firstUIFFl;
+ UifHdr _UIFHeader[kMaxUifs]; // Lookup for uif fonts/images
Common::File _stringArchive; // Handle for string file
Common::File _sceneryArchive1; // Handle for scenery file
Common::File _objectsArchive; // Handle for objects file
- PCC_header_t PCC_header;
-
- seq_t *readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name);
+ Seq *readPCX(Common::SeekableReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name);
// If this is the first call, read the lookup table
- bool has_read_header;
- sound_hdr_t s_hdr[kMaxSounds]; // Sound lookup table
+ bool _hasReadHeader;
+ SoundHdr _soundHdr[kMaxSounds]; // Sound lookup table
private:
- byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const;
- uif_hdr_t *getUIFHeader(const uif_t id);
-
-//Strangerke : Not used?
- void printBootText();
+ UifHdr *getUIFHeader(const Uif id);
};
class FileManager_v1d : public FileManager {
@@ -137,7 +131,7 @@ public:
virtual void instructions() const;
virtual void openDatabaseFiles();
virtual void readBackground(const int screenIndex);
- virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
+ virtual void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType);
virtual const char *fetchString(const int index);
};
@@ -149,7 +143,7 @@ public:
virtual void closeDatabaseFiles();
virtual void openDatabaseFiles();
virtual void readBackground(const int screenIndex);
- virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
+ virtual void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType);
const char *fetchString(const int index);
private:
char *_fetchStringBuf;
@@ -163,7 +157,7 @@ public:
void closeDatabaseFiles();
void openDatabaseFiles();
void readBackground(const int screenIndex);
- void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
+ void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType);
private:
Common::File _sceneryArchive2; // Handle for scenery file
};
@@ -181,7 +175,7 @@ public:
FileManager_v1w(HugoEngine *vm);
~FileManager_v1w();
- void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
+ void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType);
};
} // End of namespace Hugo
diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp
index c3bb0e275f..e42223fb13 100644
--- a/engines/hugo/file_v1d.cpp
+++ b/engines/hugo/file_v1d.cpp
@@ -55,11 +55,11 @@ void FileManager_v1d::closeDatabaseFiles() {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v1d::readOverlay(const int screenNum, image_pt image, const ovl_t overlayType) {
+void FileManager_v1d::readOverlay(const int screenNum, ImagePtr image, const OvlType overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
- const char *ovl_ext[] = {".b", ".o", ".ob"};
- Common::String buf = Common::String(_vm->_text->getScreenNames(screenNum)) + Common::String(ovl_ext[overlayType]);
+ const char *ovlExt[] = {".b", ".o", ".ob"};
+ Common::String buf = Common::String(_vm->_text->getScreenNames(screenNum)) + Common::String(ovlExt[overlayType]);
if (!Common::File::exists(buf)) {
memset(image, 0, kOvlSize);
@@ -70,7 +70,7 @@ void FileManager_v1d::readOverlay(const int screenNum, image_pt image, const ovl
if (!_sceneryArchive1.open(buf))
error("File not found: %s", buf.c_str());
- image_pt tmpImage = image; // temp ptr to overlay file
+ ImagePtr tmpImage = image; // temp ptr to overlay file
_sceneryArchive1.read(tmpImage, kOvlSize);
_sceneryArchive1.close();
@@ -87,7 +87,7 @@ void FileManager_v1d::readBackground(const int screenIndex) {
if (!_sceneryArchive1.open(buf))
error("File not found: %s", buf.c_str());
// Read the image into dummy seq and static dib_a
- seq_t *dummySeq; // Image sequence structure for Read_pcx
+ Seq *dummySeq; // Image sequence structure for Read_pcx
dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex));
free(dummySeq);
_sceneryArchive1.close();
diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp
index 8a06cef939..002a1dc103 100644
--- a/engines/hugo/file_v1w.cpp
+++ b/engines/hugo/file_v1w.cpp
@@ -45,35 +45,35 @@ FileManager_v1w::~FileManager_v1w() {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v1w::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v1w::readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
- image_pt tmpImage = image; // temp ptr to overlay file
- _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET);
+ ImagePtr tmpImage = image; // temp ptr to overlay file
+ _sceneryArchive1.seek((uint32)screenNum * sizeof(SceneBlock), SEEK_SET);
- sceneBlock_t sceneBlock; // Database header entry
- sceneBlock.scene_off = _sceneryArchive1.readUint32LE();
- sceneBlock.scene_len = _sceneryArchive1.readUint32LE();
- sceneBlock.b_off = _sceneryArchive1.readUint32LE();
- sceneBlock.b_len = _sceneryArchive1.readUint32LE();
- sceneBlock.o_off = _sceneryArchive1.readUint32LE();
- sceneBlock.o_len = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_off = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_len = _sceneryArchive1.readUint32LE();
+ SceneBlock sceneBlock; // Database header entry
+ sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._sceneLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseLength = _sceneryArchive1.readUint32LE();
uint32 i = 0;
switch (overlayType) {
case kOvlBoundary:
- _sceneryArchive1.seek(sceneBlock.b_off, SEEK_SET);
- i = sceneBlock.b_len;
+ _sceneryArchive1.seek(sceneBlock._boundaryOffset, SEEK_SET);
+ i = sceneBlock._boundaryLength;
break;
case kOvlOverlay:
- _sceneryArchive1.seek(sceneBlock.o_off, SEEK_SET);
- i = sceneBlock.o_len;
+ _sceneryArchive1.seek(sceneBlock._overlayOffset, SEEK_SET);
+ i = sceneBlock._overlayLength;
break;
case kOvlBase:
- _sceneryArchive1.seek(sceneBlock.ob_off, SEEK_SET);
- i = sceneBlock.ob_len;
+ _sceneryArchive1.seek(sceneBlock._baseOffset, SEEK_SET);
+ i = sceneBlock._baseLength;
break;
default:
error("Bad overlayType: %d", overlayType);
diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp
index 520e1b77b6..19c90980b0 100644
--- a/engines/hugo/file_v2d.cpp
+++ b/engines/hugo/file_v2d.cpp
@@ -78,22 +78,22 @@ void FileManager_v2d::closeDatabaseFiles() {
void FileManager_v2d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
- _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET);
+ _sceneryArchive1.seek((uint32) screenIndex * sizeof(SceneBlock), SEEK_SET);
- sceneBlock_t sceneBlock; // Read a database header entry
- sceneBlock.scene_off = _sceneryArchive1.readUint32LE();
- sceneBlock.scene_len = _sceneryArchive1.readUint32LE();
- sceneBlock.b_off = _sceneryArchive1.readUint32LE();
- sceneBlock.b_len = _sceneryArchive1.readUint32LE();
- sceneBlock.o_off = _sceneryArchive1.readUint32LE();
- sceneBlock.o_len = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_off = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_len = _sceneryArchive1.readUint32LE();
+ SceneBlock sceneBlock; // Read a database header entry
+ sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._sceneLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseLength = _sceneryArchive1.readUint32LE();
- _sceneryArchive1.seek(sceneBlock.scene_off, SEEK_SET);
+ _sceneryArchive1.seek(sceneBlock._sceneOffset, SEEK_SET);
// Read the image into dummy seq and static dib_a
- seq_t *dummySeq; // Image sequence structure for Read_pcx
+ Seq *dummySeq; // Image sequence structure for Read_pcx
dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex));
free(dummySeq);
}
@@ -101,35 +101,35 @@ void FileManager_v2d::readBackground(const int screenIndex) {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v2d::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v2d::readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
- image_pt tmpImage = image; // temp ptr to overlay file
- _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET);
+ ImagePtr tmpImage = image; // temp ptr to overlay file
+ _sceneryArchive1.seek((uint32)screenNum * sizeof(SceneBlock), SEEK_SET);
- sceneBlock_t sceneBlock; // Database header entry
- sceneBlock.scene_off = _sceneryArchive1.readUint32LE();
- sceneBlock.scene_len = _sceneryArchive1.readUint32LE();
- sceneBlock.b_off = _sceneryArchive1.readUint32LE();
- sceneBlock.b_len = _sceneryArchive1.readUint32LE();
- sceneBlock.o_off = _sceneryArchive1.readUint32LE();
- sceneBlock.o_len = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_off = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_len = _sceneryArchive1.readUint32LE();
+ SceneBlock sceneBlock; // Database header entry
+ sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._sceneLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseLength = _sceneryArchive1.readUint32LE();
uint32 i = 0;
switch (overlayType) {
case kOvlBoundary:
- _sceneryArchive1.seek(sceneBlock.b_off, SEEK_SET);
- i = sceneBlock.b_len;
+ _sceneryArchive1.seek(sceneBlock._boundaryOffset, SEEK_SET);
+ i = sceneBlock._boundaryLength;
break;
case kOvlOverlay:
- _sceneryArchive1.seek(sceneBlock.o_off, SEEK_SET);
- i = sceneBlock.o_len;
+ _sceneryArchive1.seek(sceneBlock._overlayOffset, SEEK_SET);
+ i = sceneBlock._overlayLength;
break;
case kOvlBase:
- _sceneryArchive1.seek(sceneBlock.ob_off, SEEK_SET);
- i = sceneBlock.ob_len;
+ _sceneryArchive1.seek(sceneBlock._baseOffset, SEEK_SET);
+ i = sceneBlock._baseLength;
break;
default:
error("Bad overlayType: %d", overlayType);
diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp
index d86003a040..5eb0cfc2c8 100644
--- a/engines/hugo/file_v3d.cpp
+++ b/engines/hugo/file_v3d.cpp
@@ -50,25 +50,25 @@ FileManager_v3d::~FileManager_v3d() {
void FileManager_v3d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
- _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET);
-
- sceneBlock_t sceneBlock; // Read a database header entry
- sceneBlock.scene_off = _sceneryArchive1.readUint32LE();
- sceneBlock.scene_len = _sceneryArchive1.readUint32LE();
- sceneBlock.b_off = _sceneryArchive1.readUint32LE();
- sceneBlock.b_len = _sceneryArchive1.readUint32LE();
- sceneBlock.o_off = _sceneryArchive1.readUint32LE();
- sceneBlock.o_len = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_off = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_len = _sceneryArchive1.readUint32LE();
-
- seq_t *dummySeq; // Image sequence structure for Read_pcx
+ _sceneryArchive1.seek((uint32) screenIndex * sizeof(SceneBlock), SEEK_SET);
+
+ SceneBlock sceneBlock; // Read a database header entry
+ sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._sceneLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseLength = _sceneryArchive1.readUint32LE();
+
+ Seq *dummySeq; // Image sequence structure for Read_pcx
if (screenIndex < 20) {
- _sceneryArchive1.seek(sceneBlock.scene_off, SEEK_SET);
+ _sceneryArchive1.seek(sceneBlock._sceneOffset, SEEK_SET);
// Read the image into dummy seq and static dib_a
dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex));
} else {
- _sceneryArchive2.seek(sceneBlock.scene_off, SEEK_SET);
+ _sceneryArchive2.seek(sceneBlock._sceneOffset, SEEK_SET);
// Read the image into dummy seq and static dib_a
dummySeq = readPCX(_sceneryArchive2, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex));
}
@@ -106,37 +106,37 @@ void FileManager_v3d::closeDatabaseFiles() {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v3d::readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
- image_pt tmpImage = image; // temp ptr to overlay file
- _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET);
+ ImagePtr tmpImage = image; // temp ptr to overlay file
+ _sceneryArchive1.seek((uint32)screenNum * sizeof(SceneBlock), SEEK_SET);
- sceneBlock_t sceneBlock; // Database header entry
- sceneBlock.scene_off = _sceneryArchive1.readUint32LE();
- sceneBlock.scene_len = _sceneryArchive1.readUint32LE();
- sceneBlock.b_off = _sceneryArchive1.readUint32LE();
- sceneBlock.b_len = _sceneryArchive1.readUint32LE();
- sceneBlock.o_off = _sceneryArchive1.readUint32LE();
- sceneBlock.o_len = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_off = _sceneryArchive1.readUint32LE();
- sceneBlock.ob_len = _sceneryArchive1.readUint32LE();
+ SceneBlock sceneBlock; // Database header entry
+ sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._sceneLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._overlayLength = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseOffset = _sceneryArchive1.readUint32LE();
+ sceneBlock._baseLength = _sceneryArchive1.readUint32LE();
uint32 i = 0;
if (screenNum < 20) {
switch (overlayType) {
case kOvlBoundary:
- _sceneryArchive1.seek(sceneBlock.b_off, SEEK_SET);
- i = sceneBlock.b_len;
+ _sceneryArchive1.seek(sceneBlock._boundaryOffset, SEEK_SET);
+ i = sceneBlock._boundaryLength;
break;
case kOvlOverlay:
- _sceneryArchive1.seek(sceneBlock.o_off, SEEK_SET);
- i = sceneBlock.o_len;
+ _sceneryArchive1.seek(sceneBlock._overlayOffset, SEEK_SET);
+ i = sceneBlock._overlayLength;
break;
case kOvlBase:
- _sceneryArchive1.seek(sceneBlock.ob_off, SEEK_SET);
- i = sceneBlock.ob_len;
+ _sceneryArchive1.seek(sceneBlock._baseOffset, SEEK_SET);
+ i = sceneBlock._baseLength;
break;
default:
error("Bad overlayType: %d", overlayType);
@@ -166,16 +166,16 @@ void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t ove
} else {
switch (overlayType) {
case kOvlBoundary:
- _sceneryArchive2.seek(sceneBlock.b_off, SEEK_SET);
- i = sceneBlock.b_len;
+ _sceneryArchive2.seek(sceneBlock._boundaryOffset, SEEK_SET);
+ i = sceneBlock._boundaryLength;
break;
case kOvlOverlay:
- _sceneryArchive2.seek(sceneBlock.o_off, SEEK_SET);
- i = sceneBlock.o_len;
+ _sceneryArchive2.seek(sceneBlock._overlayOffset, SEEK_SET);
+ i = sceneBlock._overlayLength;
break;
case kOvlBase:
- _sceneryArchive2.seek(sceneBlock.ob_off, SEEK_SET);
- i = sceneBlock.ob_len;
+ _sceneryArchive2.seek(sceneBlock._baseOffset, SEEK_SET);
+ i = sceneBlock._baseLength;
break;
default:
error("Bad overlayType: %d", overlayType);
diff --git a/engines/hugo/game.h b/engines/hugo/game.h
index b1c5f407b3..ed49ee8cbe 100644
--- a/engines/hugo/game.h
+++ b/engines/hugo/game.h
@@ -45,7 +45,7 @@ namespace Hugo {
enum {LOOK_NAME = 1, TAKE_NAME}; // Index of name used in showing takeables and in confirming take
// Definitions of 'generic' commands: Max # depends on size of gencmd in
-// the object_t record since each requires 1 bit. Currently up to 16
+// the Object record since each requires 1 bit. Currently up to 16
enum {LOOK = 1, TAKE = 2, DROP = 4, LOOK_S = 8};
enum TEXTCOLORS {
@@ -55,25 +55,25 @@ enum TEXTCOLORS {
_TLIGHTRED, _TLIGHTMAGENTA, _TLIGHTYELLOW, _TBRIGHTWHITE
};
-enum uif_t {U_FONT5, U_FONT6, U_FONT8, UIF_IMAGES, NUM_UIF_ITEMS};
+enum Uif {U_FONT5, U_FONT6, U_FONT8, UIF_IMAGES, NUM_UIF_ITEMS};
static const int kFirstFont = U_FONT5;
/**
* Enumerate ways of cycling a sequence of frames
*/
-enum cycle_t {kCycleInvisible, kCycleAlmostInvisible, kCycleNotCycling, kCycleForward, kCycleBackward};
+enum Cycle {kCycleInvisible, kCycleAlmostInvisible, kCycleNotCycling, kCycleForward, kCycleBackward};
/**
* Enumerate sequence index matching direction of travel
*/
enum {SEQ_RIGHT, SEQ_LEFT, SEQ_DOWN, SEQ_UP};
-enum font_t {LARGE_ROMAN, MED_ROMAN, NUM_GDI_FONTS, INIT_FONTS, DEL_FONTS};
+enum Font {LARGE_ROMAN, MED_ROMAN, NUM_GDI_FONTS, INIT_FONTS, DEL_FONTS};
/**
* Enumerate the different path types for an object
*/
-enum path_t {
+enum Path {
kPathUser, // User has control of object via cursor keys
kPathAuto, // Computer has control, controlled by action lists
kPathQuiet, // Computer has control and no commands allowed
@@ -83,55 +83,55 @@ enum path_t {
kPathWander2 // Same as WANDER, except keeps cycling when stationary
};
-struct hugo_boot_t { // Common HUGO boot file
- char checksum; // Checksum for boot structure (not exit text)
- char registered; // TRUE if registered version, else FALSE
- char pbswitch[8]; // Playback switch string
- char distrib[32]; // Distributor branding string
- uint16 exit_len; // Length of exit text (next in file)
+struct hugoBoot { // Common HUGO boot file
+ char _checksum; // Checksum for boot structure (not exit text)
+ char _registered; // TRUE if registered version, else FALSE
+ char _pbswitch[8]; // Playback switch string
+ char _distrib[32]; // Distributor branding string
+ uint16 _exitLen; // Length of exit text (next in file)
} PACKED_STRUCT;
/**
* Game specific type definitions
*/
-typedef byte *image_pt; // ptr to an object image (sprite)
-typedef byte *sound_pt; // ptr to sound (or music) data
+typedef byte *ImagePtr; // ptr to an object image (sprite)
+typedef byte *SoundPtr; // ptr to sound (or music) data
/**
* Structure for initializing maze processing
*/
-struct maze_t {
- bool enabledFl; // TRUE when maze processing enabled
- byte size; // Size of (square) maze matrix
- int x1, y1, x2, y2; // maze hotspot bounding box
- int x3, x4; // north, south x entry coordinates
- byte firstScreenIndex; // index of first screen in maze
+struct Maze {
+ bool _enabledFl; // TRUE when maze processing enabled
+ byte _size; // Size of (square) maze matrix
+ int _x1, _y1, _x2, _y2; // maze hotspot bounding box
+ int _x3, _x4; // north, south x entry coordinates
+ byte _firstScreenIndex; // index of first screen in maze
};
/**
* The following is a linked list of images in an animation sequence
* The image data is in 8-bit DIB format, i.e. 1 byte = 1 pixel
*/
-struct seq_t { // Linked list of images
- byte *imagePtr; // ptr to image
- uint16 bytesPerLine8; // bytes per line (8bits)
- uint16 lines; // lines
- uint16 x1, x2, y1, y2; // Offsets from x,y: data bounding box
- seq_t *nextSeqPtr; // ptr to next record
+struct Seq { // Linked list of images
+ byte *_imagePtr; // ptr to image
+ uint16 _bytesPerLine8; // bytes per line (8bits)
+ uint16 _lines; // lines
+ uint16 _x1, _x2, _y1, _y2; // Offsets from x,y: data bounding box
+ Seq *_nextSeqPtr; // ptr to next record
};
/**
* The following is an array of structures of above sequences
*/
-struct seqList_t {
- uint16 imageNbr; // Number of images in sequence
- seq_t *seqPtr; // Ptr to sequence structure
+struct SeqList {
+ uint16 _imageNbr; // Number of images in sequence
+ Seq *_seqPtr; // Ptr to sequence structure
};
#include "common/pack-start.h" // START STRUCT PACKING
-struct sound_hdr_t { // Sound file lookup entry
- uint16 size; // Size of sound data in bytes
- uint32 offset; // Offset of sound data in file
+struct SoundHdr { // Sound file lookup entry
+ uint16 _size; // Size of sound data in bytes
+ uint32 _offset; // Offset of sound data in file
} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
@@ -140,38 +140,38 @@ static const int kMaxSeqNumb = 4; // Number of sequences of im
/**
* Following is definition of object attributes
*/
-struct object_t {
- uint16 nounIndex; // String identifying object
- uint16 dataIndex; // String describing the object
- uint16 *stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions
- path_t pathType; // Describe path object follows
- int vxPath, vyPath; // Delta velocities (e.g. for CHASE)
- uint16 actIndex; // Action list to do on collision with hero
- byte seqNumb; // Number of sequences in list
- seq_t *currImagePtr; // Sequence image currently in use
- seqList_t seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths
- cycle_t cycling; // Whether cycling, forward or backward
- byte cycleNumb; // No. of times to cycle
- byte frameInterval; // Interval (in ticks) between frames
- byte frameTimer; // Decrementing timer for above
- int8 radius; // Defines sphere of influence by hero
- byte screenIndex; // Screen in which object resides
- int x, y; // Current coordinates of object
- int oldx, oldy; // Previous coordinates of object
- int8 vx, vy; // Velocity
- byte objValue; // Value of object
- int genericCmd; // Bit mask of 'generic' commands for object
- uint16 cmdIndex; // ptr to list of cmd structures for verbs
- bool carriedFl; // TRUE if object being carried
- byte state; // state referenced in cmd list
- bool verbOnlyFl; // TRUE if verb-only cmds allowed e.g. sit,look
- byte priority; // Whether object fore, background or floating
- int16 viewx, viewy; // Position to view object from (or 0 or -1)
- int16 direction; // Direction to view object from
- byte curSeqNum; // Save which seq number currently in use
- byte curImageNum; // Save which image of sequence currently in use
- int8 oldvx; // Previous vx (used in wandering)
- int8 oldvy; // Previous vy
+struct Object {
+ uint16 _nounIndex; // String identifying object
+ uint16 _dataIndex; // String describing the object
+ uint16 *_stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions
+ Path _pathType; // Describe path object follows
+ int _vxPath, _vyPath; // Delta velocities (e.g. for CHASE)
+ uint16 _actIndex; // Action list to do on collision with hero
+ byte _seqNumb; // Number of sequences in list
+ Seq *_currImagePtr; // Sequence image currently in use
+ SeqList _seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths
+ Cycle _cycling; // Whether cycling, forward or backward
+ byte _cycleNumb; // No. of times to cycle
+ byte _frameInterval; // Interval (in ticks) between frames
+ byte _frameTimer; // Decrementing timer for above
+ int8 _radius; // Defines sphere of influence by hero
+ byte _screenIndex; // Screen in which object resides
+ int _x, _y; // Current coordinates of object
+ int _oldx, _oldy; // Previous coordinates of object
+ int8 _vx, _vy; // Velocity
+ byte _objValue; // Value of object
+ int _genericCmd; // Bit mask of 'generic' commands for object
+ uint16 _cmdIndex; // ptr to list of cmd structures for verbs
+ bool _carriedFl; // TRUE if object being carried
+ byte _state; // state referenced in cmd list
+ bool _verbOnlyFl; // TRUE if verb-only cmds allowed e.g. sit,look
+ byte _priority; // Whether object fore, background or floating
+ int16 _viewx, _viewy; // Position to view object from (or 0 or -1)
+ int16 _direction; // Direction to view object from
+ byte _curSeqNum; // Save which seq number currently in use
+ byte _curImageNum; // Save which image of sequence currently in use
+ int8 _oldvx; // Previous vx (used in wandering)
+ int8 _oldvy; // Previous vy
};
} // End of namespace Hugo
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index df8abf32eb..9d28e0ac69 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -106,7 +106,7 @@ GUI::Debugger *HugoEngine::getDebugger() {
return _console;
}
-status_t &HugoEngine::getGameStatus() {
+Status &HugoEngine::getGameStatus() {
return _status;
}
@@ -249,24 +249,24 @@ Common::Error HugoEngine::run() {
initStatus(); // Initialize game status
initConfig(); // Initialize user's config
- if (!_status.doQuitFl) {
+ if (!_status._doQuitFl) {
initialize();
resetConfig(); // Reset user's config
initMachine();
// Start the state machine
- _status.viewState = kViewIntroInit;
+ _status._viewState = kViewIntroInit;
int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot");
if (loadSlot >= 0) {
- _status.skipIntroFl = true;
+ _status._skipIntroFl = true;
_file->restoreGame(loadSlot);
} else {
_file->saveGame(0, "New Game");
}
}
- while (!_status.doQuitFl) {
+ while (!_status._doQuitFl) {
_screen->drawBoundaries();
g_system->updateScreen();
runMachine();
@@ -289,20 +289,20 @@ Common::Error HugoEngine::run() {
_mouse->setRightButton();
break;
case Common::EVENT_QUIT:
- _status.doQuitFl = true;
+ _status._doQuitFl = true;
break;
default:
break;
}
}
- if (_status.helpFl) {
- _status.helpFl = false;
+ if (_status._helpFl) {
+ _status._helpFl = false;
_file->instructions();
}
_mouse->mouseHandler(); // Mouse activity - adds to display list
_screen->displayList(kDisplayDisplay); // Blit the display list to screen
- _status.doQuitFl |= shouldQuit(); // update game quit flag
+ _status._doQuitFl |= shouldQuit(); // update game quit flag
}
return Common::kNoError;
}
@@ -323,10 +323,10 @@ void HugoEngine::initMachine() {
* Hugo game state machine - called during onIdle
*/
void HugoEngine::runMachine() {
- status_t &gameStatus = getGameStatus();
+ Status &gameStatus = getGameStatus();
// Don't process if gameover
- if (gameStatus.gameOverFl)
+ if (gameStatus._gameOverFl)
return;
_curTime = g_system->getMillis();
@@ -338,19 +338,19 @@ void HugoEngine::runMachine() {
_lastTime = _curTime;
- switch (gameStatus.viewState) {
+ switch (gameStatus._viewState) {
case kViewIdle: // Not processing state machine
_screen->hideCursor();
_intro->preNewGame(); // Any processing before New Game selected
break;
case kViewIntroInit: // Initialization before intro begins
_intro->introInit();
- gameStatus.viewState = kViewIntro;
+ gameStatus._viewState = kViewIntro;
break;
case kViewIntro: // Do any game-dependant preamble
if (_intro->introPlay()) { // Process intro screen
_scheduler->newScreen(0); // Initialize first screen
- gameStatus.viewState = kViewPlay;
+ gameStatus._viewState = kViewPlay;
}
break;
case kViewPlay: // Playing game
@@ -368,8 +368,8 @@ void HugoEngine::runMachine() {
_inventory->runInventory(); // Process Inventory state machine
break;
case kViewExit: // Game over or user exited
- gameStatus.viewState = kViewIdle;
- _status.doQuitFl = true;
+ gameStatus._viewState = kViewIdle;
+ _status._doQuitFl = true;
break;
}
}
@@ -427,7 +427,7 @@ bool HugoEngine::loadHugoDat() {
_scheduler->loadActListArr(in);
_scheduler->loadAlNewscrIndex(in);
_hero = &_object->_objects[kHeroIndex]; // This always points to hero
- _screen_p = &(_object->_objects[kHeroIndex].screenIndex); // Current screen is hero's
+ _screenPtr = &(_object->_objects[kHeroIndex]._screenIndex); // Current screen is hero's
_heroImage = kHeroIndex; // Current in use hero image
for (int varnt = 0; varnt < _numVariant; varnt++) {
@@ -527,33 +527,20 @@ void HugoEngine::initPlaylist(bool playlist[kMaxTunes]) {
*/
void HugoEngine::initStatus() {
debugC(1, kDebugEngine, "initStatus");
- _status.storyModeFl = false; // Not in story mode
- _status.gameOverFl = false; // Hero not knobbled yet
- _status.lookFl = false; // Toolbar "look" button
- _status.recallFl = false; // Toolbar "recall" button
- _status.newScreenFl = false; // Screen not just loaded
- _status.godModeFl = false; // No special cheats allowed
- _status.showBoundariesFl = false; // Boundaries hidden by default
- _status.doQuitFl = false;
- _status.skipIntroFl = false;
- _status.helpFl = false;
+ _status._storyModeFl = false; // Not in story mode
+ _status._gameOverFl = false; // Hero not knobbled yet
+ _status._lookFl = false; // Toolbar "look" button
+ _status._recallFl = false; // Toolbar "recall" button
+ _status._newScreenFl = false; // Screen not just loaded
+ _status._godModeFl = false; // No special cheats allowed
+ _status._showBoundariesFl = false; // Boundaries hidden by default
+ _status._doQuitFl = false;
+ _status._skipIntroFl = false;
+ _status._helpFl = false;
// Initialize every start of new game
- _status.tick = 0; // Tick count
- _status.viewState = kViewIdle; // View state
-
-// Strangerke - Suppress as related to playback
-// _status.recordFl = false; // Not record mode
-// _status.playbackFl = false; // Not playback mode
-// Strangerke - Not used ?
-// _status.mmtime = false; // Multimedia timer support
-// _status.helpFl = false; // Not calling WinHelp()
-// _status.demoFl = false; // Not demo mode
-// _status.path[0] = 0; // Path to write files
-// _status.screenWidth = 0; // Desktop screen width
-// _status.saveTick = 0; // Time of last save
-// _status.saveSlot = 0; // Slot to save/restore game
-// _status.textBoxFl = false; // Not processing a text box
+ _status._tick = 0; // Tick count
+ _status._viewState = kViewIdle; // View state
}
/**
@@ -562,11 +549,11 @@ void HugoEngine::initStatus() {
void HugoEngine::initConfig() {
debugC(1, kDebugEngine, "initConfig()");
- _config.musicFl = true; // Music state initially on
- _config.soundFl = true; // Sound state initially on
- _config.turboFl = false; // Turbo state initially off
- initPlaylist(_config.playlist); // Initialize default tune playlist
- _file->readBootFile(); // Read startup structure
+ _config._musicFl = true; // Music state initially on
+ _config._soundFl = true; // Sound state initially on
+ _config._turboFl = false; // Turbo state initially off
+ initPlaylist(_config._playlist); // Initialize default tune playlist
+ _file->readBootFile(); // Read startup structure
}
/**
@@ -577,7 +564,7 @@ void HugoEngine::resetConfig() {
// Find first tune and play it
for (int16 i = 0; i < kMaxTunes; i++) {
- if (_config.playlist[i]) {
+ if (_config._playlist[i]) {
_sound->playMusic(i);
break;
}
@@ -587,7 +574,7 @@ void HugoEngine::resetConfig() {
void HugoEngine::initialize() {
debugC(1, kDebugEngine, "initialize");
- _maze.enabledFl = false;
+ _maze._enabledFl = false;
_line[0] = '\0';
_sound->initSound();
@@ -639,10 +626,10 @@ void HugoEngine::readScreenFiles(const int screenNum) {
memcpy(_screen->getBackBuffer(), _screen->getFrontBuffer(), sizeof(_screen->getFrontBuffer())); // Make a copy
// Workaround for graphic glitches in DOS versions. Cleaning the overlays fix the problem
- memset(_object->_objBound, '\0', sizeof(overlay_t));
- memset(_object->_boundary, '\0', sizeof(overlay_t));
- memset(_object->_overlay, '\0', sizeof(overlay_t));
- memset(_object->_ovlBase, '\0', sizeof(overlay_t));
+ memset(_object->_objBound, '\0', sizeof(Overlay));
+ memset(_object->_boundary, '\0', sizeof(Overlay));
+ memset(_object->_overlay, '\0', sizeof(Overlay));
+ memset(_object->_ovlBase, '\0', sizeof(Overlay));
_file->readOverlay(screenNum, _object->_boundary, kOvlBoundary); // Boundary file
_file->readOverlay(screenNum, _object->_overlay, kOvlOverlay); // Overlay file
@@ -660,7 +647,7 @@ void HugoEngine::readScreenFiles(const int screenNum) {
void HugoEngine::setNewScreen(const int screenNum) {
debugC(1, kDebugEngine, "setNewScreen(%d)", screenNum);
- *_screen_p = screenNum; // HERO object
+ *_screenPtr = screenNum; // HERO object
_object->setCarriedScreen(screenNum); // Carried objects
}
@@ -679,10 +666,10 @@ void HugoEngine::calcMaxScore() {
void HugoEngine::endGame() {
debugC(1, kDebugEngine, "endGame");
- if (_boot.registered != kRegRegistered)
+ if (_boot._registered != kRegRegistered)
Utils::notifyBox(_text->getTextEngine(kEsAdvertise));
Utils::notifyBox(Common::String::format("%s\n%s", _episode, getCopyrightString()));
- _status.viewState = kViewExit;
+ _status._viewState = kViewExit;
}
bool HugoEngine::canLoadGameStateCurrently() {
@@ -690,11 +677,11 @@ bool HugoEngine::canLoadGameStateCurrently() {
}
bool HugoEngine::canSaveGameStateCurrently() {
- return (_status.viewState == kViewPlay);
+ return (_status._viewState == kViewPlay);
}
int8 HugoEngine::getTPS() const {
- return ((_config.turboFl) ? kTurboTps : _normalTPS);
+ return ((_config._turboFl) ? kTurboTps : _normalTPS);
}
void HugoEngine::syncSoundSettings() {
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 125819a39b..9f495a9037 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -80,18 +80,18 @@ static const int kMaxPath = 256; // Max length of a full path
static const int kHeroMaxWidth = 24; // Maximum width of hero
static const int kHeroMinWidth = 16; // Minimum width of hero
-typedef char command_t[kMaxLineSize + 8]; // Command line (+spare for prompt,cursor)
+typedef char Command[kMaxLineSize + 8]; // Command line (+spare for prompt,cursor)
-struct config_t { // User's config (saved)
- bool musicFl; // State of Music button/menu item
- bool soundFl; // State of Sound button/menu item
- bool turboFl; // State of Turbo button/menu item
- bool playlist[kMaxTunes]; // Tune playlist
+struct Config { // User's config (saved)
+ bool _musicFl; // State of Music button/menu item
+ bool _soundFl; // State of Sound button/menu item
+ bool _turboFl; // State of Turbo button/menu item
+ bool _playlist[kMaxTunes]; // Tune playlist
};
-typedef byte icondib_t[kXPix * kInvDy]; // Icon bar dib
-typedef byte viewdib_t[(long)kXPix * kYPix]; // Viewport dib
-typedef byte overlay_t[kOvlSize]; // Overlay file
+typedef byte Icondib[kXPix * kInvDy]; // Icon bar dib
+typedef byte Viewdib[(long)kXPix * kYPix]; // Viewport dib
+typedef byte Overlay[kOvlSize]; // Overlay file
enum GameType {
kGameTypeNone = 0,
@@ -131,12 +131,12 @@ enum HugoRegistered {
/**
* Inventory icon bar states
*/
-enum istate_t {kInventoryOff, kInventoryUp, kInventoryDown, kInventoryActive};
+enum Istate {kInventoryOff, kInventoryUp, kInventoryDown, kInventoryActive};
/**
* Game view state machine
*/
-enum vstate_t {kViewIdle, kViewIntroInit, kViewIntro, kViewPlay, kViewInvent, kViewExit};
+enum Vstate {kViewIdle, kViewIntroInit, kViewIntro, kViewPlay, kViewInvent, kViewExit};
/**
* Enumerate whether object is foreground, background or 'floating'
@@ -152,12 +152,12 @@ enum {kPriorityForeground, kPriorityBackground, kPriorityFloating, kPriorityOver
/**
* Display list functions
*/
-enum dupdate_t {kDisplayInit, kDisplayAdd, kDisplayDisplay, kDisplayRestore};
+enum Dupdate {kDisplayInit, kDisplayAdd, kDisplayDisplay, kDisplayRestore};
/**
* Priority for sound effect
*/
-enum priority_t {kSoundPriorityLow, kSoundPriorityMedium, kSoundPriorityHigh};
+enum Priority {kSoundPriorityLow, kSoundPriorityMedium, kSoundPriorityHigh};
enum HugoGameFeatures {
GF_PACKED = (1 << 0) // Database
@@ -170,47 +170,31 @@ enum seqTextEngine {
struct HugoGameDescription;
-struct status_t { // Game status (not saved)
- bool storyModeFl; // Game is telling story - no commands
- bool gameOverFl; // Game is over - hero knobbled
- bool lookFl; // Toolbar "look" button pressed
- bool recallFl; // Toolbar "recall" button pressed
- bool newScreenFl; // New screen just loaded in dib_a
- bool godModeFl; // Allow DEBUG features in live version
- bool showBoundariesFl; // Flag used to show and hide boundaries,
+struct Status { // Game status (not saved)
+ bool _storyModeFl; // Game is telling story - no commands
+ bool _gameOverFl; // Game is over - hero knobbled
+ bool _lookFl; // Toolbar "look" button pressed
+ bool _recallFl; // Toolbar "recall" button pressed
+ bool _newScreenFl; // New screen just loaded in dib_a
+ bool _godModeFl; // Allow DEBUG features in live version
+ bool _showBoundariesFl; // Flag used to show and hide boundaries,
// used by the console
- bool doQuitFl;
- bool skipIntroFl;
- bool helpFl;
- uint32 tick; // Current time in ticks
- vstate_t viewState; // View state machine
- int16 song; // Current song
-
-// Strangerke - Suppress as related to playback
-// bool playbackFl; // Game is in playback mode
-// bool recordFl; // Game is in record mode
-// Strangerke - Not used ?
-// bool helpFl; // Calling WinHelp (don't disable music)
-// bool mmtimeFl; // Multimedia timer supported
-// bool demoFl; // Game is in demo mode
-// bool textBoxFl; // Game is (halted) in text box
-// int16 screenWidth; // Desktop screen width
-// int16 saveSlot; // Current slot to save/restore game
-// int16 cx, cy; // Cursor position (dib coords)
-// uint32 saveTick; // Time of last save in ticks
-//
-// typedef char fpath_t[kMaxPath]; // File path
-// fpath_t path; // Alternate path for saved files
+ bool _doQuitFl;
+ bool _skipIntroFl;
+ bool _helpFl;
+ uint32 _tick; // Current time in ticks
+ Vstate _viewState; // View state machine
+ int16 _song; // Current song
};
/**
* Structure to define an EXIT or other collision-activated hotspot
*/
-struct hotspot_t {
- int screenIndex; // Screen in which hotspot appears
- int x1, y1, x2, y2; // Bounding box of hotspot
- uint16 actIndex; // Actions to carry out if a 'hit'
- int16 viewx, viewy, direction; // Used in auto-route mode
+struct Hotspot {
+ int _screenIndex; // Screen in which hotspot appears
+ int _x1, _y1, _x2, _y2; // Bounding box of hotspot
+ uint16 _actIndex; // Actions to carry out if a 'hit'
+ int16 _viewx, _viewy, _direction; // Used in auto-route mode
};
class FileManager;
@@ -241,19 +225,19 @@ public:
uint16 _numStates;
int8 _normalTPS; // Number of ticks (frames) per second.
// 8 for Win versions, 9 for DOS versions
- object_t *_hero;
- byte *_screen_p;
+ Object *_hero;
+ byte *_screenPtr;
byte _heroImage;
byte *_screenStates;
- command_t _line; // Line of user text input
- config_t _config; // User's config
+ Command _line; // Line of user text input
+ Config _config; // User's config
int16 *_defltTunes;
uint16 _look;
uint16 _take;
uint16 _drop;
- maze_t _maze; // Maze control structure
- hugo_boot_t _boot; // Boot info structure
+ Maze _maze; // Maze control structure
+ hugoBoot _boot; // Boot info structure
GUI::Debugger *getDebugger();
@@ -262,8 +246,8 @@ public:
const char *_episode;
Common::String _picDir;
- command_t _statusLine;
- command_t _scoreLine;
+ Command _statusLine;
+ Command _scoreLine;
const HugoGameDescription *_gameDescription;
uint32 getFeatures() const;
@@ -295,7 +279,7 @@ public:
void shutdown();
void syncSoundSettings();
- status_t &getGameStatus();
+ Status &getGameStatus();
int getScore() const;
void setScore(const int newScore);
void adjustScore(const int adjustment);
@@ -330,7 +314,7 @@ protected:
private:
static const int kTurboTps = 16; // This many in turbo mode
- status_t _status; // Game status structure
+ Status _status; // Game status structure
uint32 _lastTime;
uint32 _curTime;
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index 72f718fe8e..f2ae06eb39 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -86,22 +86,22 @@ void intro_v1d::preNewGame() {
void intro_v1d::introInit() {
_introState = 0;
- introTicks = 0;
- surf.w = 320;
- surf.h = 200;
- surf.pixels = _vm->_screen->getFrontBuffer();
- surf.pitch = 320;
- surf.format = Graphics::PixelFormat::createFormatCLUT8();
+ _introTicks = 0;
+ _surf.w = 320;
+ _surf.h = 200;
+ _surf.pixels = _vm->_screen->getFrontBuffer();
+ _surf.pitch = 320;
+ _surf.format = Graphics::PixelFormat::createFormatCLUT8();
_vm->_screen->displayList(kDisplayInit);
}
bool intro_v1d::introPlay() {
byte introSize = getIntroSize();
- if (_vm->getGameStatus().skipIntroFl)
+ if (_vm->getGameStatus()._skipIntroFl)
return true;
- if (introTicks < introSize) {
+ if (_introTicks < introSize) {
switch (_introState++) {
case 0:
_vm->_screen->drawRectangle(true, 0, 0, 319, 199, _TMAGENTA);
@@ -113,32 +113,32 @@ bool intro_v1d::introPlay() {
_vm->_screen->drawShape(250,92,_TLIGHTMAGENTA,_TMAGENTA);
// TROMAN, size 10-5
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8");
char buffer[80];
- if (_vm->_boot.registered == kRegRegistered)
+ if (_vm->_boot._registered == kRegRegistered)
strcpy(buffer, "Registered Version");
- else if (_vm->_boot.registered == kRegShareware)
+ else if (_vm->_boot._registered == kRegShareware)
strcpy(buffer, "Shareware Version");
- else if (_vm->_boot.registered == kRegFreeware)
+ else if (_vm->_boot._registered == kRegFreeware)
strcpy(buffer, "Freeware Version");
else
- error("Unknown registration flag in hugo.bsf: %d", _vm->_boot.registered);
+ error("Unknown registration flag in hugo.bsf: %d", _vm->_boot._registered);
- font.drawString(&surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
- font.drawString(&surf, _vm->getCopyrightString(), 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, _vm->getCopyrightString(), 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
- if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) {
- sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib);
- font.drawString(&surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter);
+ if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) {
+ sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib);
+ _font.drawString(&_surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter);
}
// SCRIPT, size 24-16
strcpy(buffer, "Hugo's");
- if (font.loadFromFON("SCRIPT.FON")) {
- font.drawString(&surf, buffer, 0, 20, 320, _TMAGENTA, Graphics::kTextAlignCenter);
+ if (_font.loadFromFON("SCRIPT.FON")) {
+ _font.drawString(&_surf, buffer, 0, 20, 320, _TMAGENTA, Graphics::kTextAlignCenter);
} else {
// Workaround: SCRIPT.FON doesn't load properly at the moment
_vm->_screen->loadFont(2);
@@ -146,78 +146,78 @@ bool intro_v1d::introPlay() {
}
// TROMAN, size 30-24
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 24)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 24)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 24");
strcpy(buffer, "House of Horrors !");
- font.drawString(&surf, buffer, 0, 50, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 50, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
break;
case 2:
_vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK);
// TROMAN, size 16-9
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14");
strcpy(buffer, "S t a r r i n g :");
- font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
break;
case 3:
// TROMAN, size 20-9
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18");
strcpy(buffer, "Hugo !");
- font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
break;
case 4:
_vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK);
// TROMAN, size 16-9
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14");
strcpy(buffer, "P r o d u c e d b y :");
- font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
break;
case 5:
// TROMAN size 16-9
strcpy(buffer, "David P Gray !");
- font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
break;
case 6:
_vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK);
// TROMAN, size 16-9
strcpy(buffer, "D i r e c t e d b y :");
- font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
break;
case 7:
// TROMAN, size 16-9
strcpy(buffer, "David P Gray !");
- font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
break;
case 8:
_vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK);
// TROMAN, size 16-9
strcpy(buffer, "M u s i c b y :");
- font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter);
break;
case 9:
// TROMAN, size 16-9
strcpy(buffer, "David P Gray !");
- font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
break;
case 10:
_vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK);
// TROMAN, size 20-14
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18");
strcpy(buffer, "E n j o y !");
- font.drawString(&surf, buffer, 0, 100, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 100, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
break;
}
@@ -226,7 +226,7 @@ bool intro_v1d::introPlay() {
g_system->delayMillis(1000);
}
- return (++introTicks >= introSize);
+ return (++_introTicks >= introSize);
}
intro_v2d::intro_v2d(HugoEngine *vm) : IntroHandler(vm) {
@@ -241,29 +241,29 @@ void intro_v2d::preNewGame() {
void intro_v2d::introInit() {
_vm->_screen->displayList(kDisplayInit);
_vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen
- surf.w = 320;
- surf.h = 200;
- surf.pixels = _vm->_screen->getFrontBuffer();
- surf.pitch = 320;
- surf.format = Graphics::PixelFormat::createFormatCLUT8();
+ _surf.w = 320;
+ _surf.h = 200;
+ _surf.pixels = _vm->_screen->getFrontBuffer();
+ _surf.pitch = 320;
+ _surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128];
// TROMAN, size 10-5
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8");
- if (_vm->_boot.registered)
+ if (_vm->_boot._registered)
sprintf(buffer, "%s Registered Version", _vm->getCopyrightString());
else
sprintf(buffer, "%s Shareware Version", _vm->getCopyrightString());
- font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
- if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) {
+ if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) {
// TROMAN, size 10-5
- sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib);
- font.drawString(&surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
+ sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib);
+ _font.drawString(&_surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
}
_vm->_screen->displayBackground();
@@ -287,27 +287,27 @@ void intro_v3d::preNewGame() {
void intro_v3d::introInit() {
_vm->_screen->displayList(kDisplayInit);
_vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen
- surf.w = 320;
- surf.h = 200;
- surf.pixels = _vm->_screen->getFrontBuffer();
- surf.pitch = 320;
- surf.format = Graphics::PixelFormat::createFormatCLUT8();
+ _surf.w = 320;
+ _surf.h = 200;
+ _surf.pixels = _vm->_screen->getFrontBuffer();
+ _surf.pitch = 320;
+ _surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128];
- if (_vm->_boot.registered)
+ if (_vm->_boot._registered)
sprintf(buffer, "%s Registered Version", _vm->getCopyrightString());
else
sprintf(buffer,"%s Shareware Version", _vm->getCopyrightString());
// TROMAN, size 10-5
- if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
+ if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8");
- font.drawString(&surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter);
+ _font.drawString(&_surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter);
- if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) {
- sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib);
- font.drawString(&surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter);
+ if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) {
+ sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib);
+ _font.drawString(&_surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter);
}
_vm->_screen->displayBackground();
@@ -316,7 +316,7 @@ void intro_v3d::introInit() {
_vm->_file->readBackground(22); // display screen MAP_3d
_vm->_screen->displayBackground();
- introTicks = 0;
+ _introTicks = 0;
_vm->_sound->_DOSSongPtr = _vm->_sound->_DOSIntroSong;
}
@@ -325,15 +325,15 @@ void intro_v3d::introInit() {
* Called every tick. Returns TRUE when complete
*/
bool intro_v3d::introPlay() {
- if (_vm->getGameStatus().skipIntroFl)
+ if (_vm->getGameStatus()._skipIntroFl)
return true;
- if (introTicks < getIntroSize()) {
- font.drawString(&surf, ".", _introX[introTicks], _introY[introTicks] - kDibOffY, 320, _TBRIGHTWHITE);
+ if (_introTicks < getIntroSize()) {
+ _font.drawString(&_surf, ".", _introX[_introTicks], _introY[_introTicks] - kDibOffY, 320, _TBRIGHTWHITE);
_vm->_screen->displayBackground();
// Text boxes at various times
- switch (introTicks) {
+ switch (_introTicks) {
case 4:
Utils::notifyBox(_vm->_text->getTextIntro(kIntro1));
break;
@@ -346,7 +346,7 @@ bool intro_v3d::introPlay() {
}
}
- return (++introTicks >= getIntroSize());
+ return (++_introTicks >= getIntroSize());
}
intro_v1w::intro_v1w(HugoEngine *vm) : IntroHandler(vm) {
@@ -356,7 +356,7 @@ intro_v1w::~intro_v1w() {
}
void intro_v1w::preNewGame() {
- _vm->getGameStatus().viewState = kViewIntroInit;
+ _vm->getGameStatus()._viewState = kViewIntroInit;
}
void intro_v1w::introInit() {
@@ -407,7 +407,7 @@ void intro_v3w::introInit() {
g_system->delayMillis(3000);
_vm->_file->readBackground(22); // display screen MAP_3w
_vm->_screen->displayBackground();
- introTicks = 0;
+ _introTicks = 0;
_vm->_screen->loadFont(0);
}
@@ -416,16 +416,16 @@ void intro_v3w::introInit() {
* Called every tick. Returns TRUE when complete
*/
bool intro_v3w::introPlay() {
- if (_vm->getGameStatus().skipIntroFl)
+ if (_vm->getGameStatus()._skipIntroFl)
return true;
- if (introTicks < getIntroSize()) {
+ if (_introTicks < getIntroSize()) {
// Scale viewport x_intro,y_intro to screen (offsetting y)
- _vm->_screen->writeStr(_introX[introTicks], _introY[introTicks] - kDibOffY, "x", _TBRIGHTWHITE);
+ _vm->_screen->writeStr(_introX[_introTicks], _introY[_introTicks] - kDibOffY, "x", _TBRIGHTWHITE);
_vm->_screen->displayBackground();
// Text boxes at various times
- switch (introTicks) {
+ switch (_introTicks) {
case 4:
Utils::notifyBox(_vm->_text->getTextIntro(kIntro1));
break;
@@ -438,6 +438,6 @@ bool intro_v3w::introPlay() {
}
}
- return (++introTicks >= getIntroSize());
+ return (++_introTicks >= getIntroSize());
}
} // End of namespace Hugo
diff --git a/engines/hugo/intro.h b/engines/hugo/intro.h
index 1bb039216a..d5a5a4e4b4 100644
--- a/engines/hugo/intro.h
+++ b/engines/hugo/intro.h
@@ -42,8 +42,8 @@ enum seqTextIntro {
class IntroHandler {
public:
IntroHandler(HugoEngine *vm);
- Graphics::Surface surf;
- Graphics::WinFont font;
+ Graphics::Surface _surf;
+ Graphics::WinFont _font;
virtual ~IntroHandler();
@@ -62,7 +62,7 @@ protected:
byte *_introX;
byte *_introY;
byte _introXSize;
- int16 introTicks; // Count calls to introPlay()
+ int16 _introTicks; // Count calls to introPlay()
};
class intro_v1w : public IntroHandler {
diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp
index 410c4e715c..c2495beadb 100644
--- a/engines/hugo/inventory.cpp
+++ b/engines/hugo/inventory.cpp
@@ -56,7 +56,7 @@ void InventoryHandler::setInventoryObjId(int16 objId) {
_inventoryObjId = objId;
}
-void InventoryHandler::setInventoryState(istate_t state) {
+void InventoryHandler::setInventoryState(Istate state) {
_inventoryState = state;
}
@@ -68,7 +68,7 @@ int16 InventoryHandler::getInventoryObjId() const {
return _inventoryObjId;
}
-istate_t InventoryHandler::getInventoryState() const {
+Istate InventoryHandler::getInventoryState() const {
return _inventoryState;
}
@@ -137,8 +137,8 @@ void InventoryHandler::constructInventory(const int16 imageTotNumb, int displayN
* Process required action for inventory
* Returns objId under cursor (or -1) for INV_GET
*/
-int16 InventoryHandler::processInventory(const invact_t action, ...) {
- debugC(1, kDebugInventory, "processInventory(invact_t action, ...)");
+int16 InventoryHandler::processInventory(const InvAct action, ...) {
+ debugC(1, kDebugInventory, "processInventory(InvAct action, ...)");
int16 imageNumb; // Total number of inventory items
int displayNumb; // Total number displayed/carried
@@ -208,7 +208,7 @@ int16 InventoryHandler::processInventory(const invact_t action, ...) {
* Process inventory state machine
*/
void InventoryHandler::runInventory() {
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
debugC(1, kDebugInventory, "runInventory");
@@ -231,7 +231,7 @@ void InventoryHandler::runInventory() {
_vm->_screen->moveImage(_vm->_screen->getBackBuffer(), 0, 0, kXPix, kYPix, kXPix, _vm->_screen->getFrontBuffer(), 0, 0, kXPix);
_vm->_object->updateImages(); // Add objects back into display list for restore
_inventoryState = kInventoryOff;
- gameStatus.viewState = kViewPlay;
+ gameStatus._viewState = kViewPlay;
}
break;
case kInventoryDown: // Icon bar moving down
diff --git a/engines/hugo/inventory.h b/engines/hugo/inventory.h
index 666cc37b51..5b55c3ec94 100644
--- a/engines/hugo/inventory.h
+++ b/engines/hugo/inventory.h
@@ -34,22 +34,22 @@ namespace Hugo {
/**
* Actions for Process_inventory()
*/
-enum invact_t {kInventoryActionInit, kInventoryActionLeft, kInventoryActionRight, kInventoryActionGet};
+enum InvAct {kInventoryActionInit, kInventoryActionLeft, kInventoryActionRight, kInventoryActionGet};
class InventoryHandler {
public:
InventoryHandler(HugoEngine *vm);
void setInventoryObjId(int16 objId);
- void setInventoryState(istate_t state);
+ void setInventoryState(Istate state);
void freeInvent();
int16 getInventoryObjId() const;
- istate_t getInventoryState() const;
+ Istate getInventoryState() const;
int16 findIconId(int16 objId);
void loadInvent(Common::SeekableReadStream &in);
- int16 processInventory(const invact_t action, ...);
+ int16 processInventory(const InvAct action, ...);
void runInventory();
private:
@@ -59,7 +59,7 @@ private:
int16 _firstIconId; // Index of first icon to display
int16 *_invent;
- istate_t _inventoryState; // Inventory icon bar state
+ Istate _inventoryState; // Inventory icon bar state
int16 _inventoryHeight; // Inventory icon bar height
int16 _inventoryObjId; // Inventory object selected, or -1
byte _maxInvent;
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index d2d5b59dae..a95170696c 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -98,17 +98,17 @@ int MouseHandler::getMouseY() const {
}
int16 MouseHandler::getDirection(const int16 hotspotId) const {
- return _hotspots[hotspotId].direction;
+ return _hotspots[hotspotId]._direction;
}
int16 MouseHandler::getHotspotActIndex(const int16 hotspotId) const {
- return _hotspots[hotspotId].actIndex;
+ return _hotspots[hotspotId]._actIndex;
}
/**
* Shadow-blit supplied string into dib_a at cx,cy and add to display list
*/
-void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy, const uif_t fontId, const int16 color) {
+void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy, const Uif fontId, const int16 color) {
debugC(1, kDebugMouse, "cursorText(%s, %d, %d, %d, %d)", buffer, cx, cy, fontId, color);
_vm->_screen->loadFont(fontId);
@@ -137,9 +137,9 @@ void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy
int16 MouseHandler::findExit(const int16 cx, const int16 cy, byte screenId) {
debugC(2, kDebugMouse, "findExit(%d, %d, %d)", cx, cy, screenId);
- for (int i = 0; _hotspots[i].screenIndex >= 0; i++) {
- if (_hotspots[i].screenIndex == screenId) {
- if (cx >= _hotspots[i].x1 && cx <= _hotspots[i].x2 && cy >= _hotspots[i].y1 && cy <= _hotspots[i].y2)
+ for (int i = 0; _hotspots[i]._screenIndex >= 0; i++) {
+ if (_hotspots[i]._screenIndex == screenId) {
+ if (cx >= _hotspots[i]._x1 && cx <= _hotspots[i]._x2 && cy >= _hotspots[i]._y1 && cy <= _hotspots[i]._y2)
return i;
}
}
@@ -152,9 +152,9 @@ int16 MouseHandler::findExit(const int16 cx, const int16 cy, byte screenId) {
void MouseHandler::processRightClick(const int16 objId, const int16 cx, const int16 cy) {
debugC(1, kDebugMouse, "ProcessRightClick(%d, %d, %d)", objId, cx, cy);
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
- if (gameStatus.storyModeFl || _vm->_hero->pathType == kPathQuiet) // Make sure user has control
+ if (gameStatus._storyModeFl || _vm->_hero->_pathType == kPathQuiet) // Make sure user has control
return;
int16 inventObjId = _vm->_inventory->getInventoryObjId();
@@ -168,9 +168,9 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in
else
_vm->_object->useObject(objId); // Use status.objid on object
} else { // Clicked over viewport object
- object_t *obj = &_vm->_object->_objects[objId];
+ Object *obj = &_vm->_object->_objects[objId];
int16 x, y;
- switch (obj->viewx) { // Where to walk to
+ switch (obj->_viewx) { // Where to walk to
case -1: // Walk to object position
if (_vm->_object->findObjectSpace(obj, &x, &y))
foundFl = _vm->_route->startRoute(kRouteGet, objId, x, y);
@@ -181,8 +181,8 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in
_vm->_object->useObject(objId); // Pick up or use object
break;
default: // Walk to view point if possible
- if (!_vm->_route->startRoute(kRouteGet, objId, obj->viewx, obj->viewy)) {
- if (_vm->_hero->cycling == kCycleInvisible) // If invisible do
+ if (!_vm->_route->startRoute(kRouteGet, objId, obj->_viewx, obj->_viewy)) {
+ if (_vm->_hero->_cycling == kCycleInvisible) // If invisible do
_vm->_object->useObject(objId); // immediate use
else
Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
@@ -203,11 +203,11 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
debugC(1, kDebugMouse, "ProcessLeftClick(%d, %d, %d)", objId, cx, cy);
int16 i, x, y;
- object_t *obj;
+ Object *obj;
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
- if (gameStatus.storyModeFl || _vm->_hero->pathType == kPathQuiet) // Make sure user has control
+ if (gameStatus._storyModeFl || _vm->_hero->_pathType == kPathQuiet) // Make sure user has control
return;
switch (objId) {
@@ -223,20 +223,20 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
_vm->_screen->displayList(kDisplayAdd, 0, kDibOffY, kXPix, kInvDy);
break;
case kExitHotspot: // Walk to exit hotspot
- i = findExit(cx, cy, *_vm->_screen_p);
- x = _hotspots[i].viewx;
- y = _hotspots[i].viewy;
+ i = findExit(cx, cy, *_vm->_screenPtr);
+ x = _hotspots[i]._viewx;
+ y = _hotspots[i]._viewy;
if (x >= 0) { // Hotspot refers to an exit
// Special case of immediate exit
if (_jumpExitFl) {
// Get rid of iconbar if necessary
if (_vm->_inventory->getInventoryState() != kInventoryOff)
_vm->_inventory->setInventoryState(kInventoryUp);
- _vm->_scheduler->insertActionList(_hotspots[i].actIndex);
+ _vm->_scheduler->insertActionList(_hotspots[i]._actIndex);
} else { // Set up route to exit spot
- if (_hotspots[i].direction == Common::KEYCODE_RIGHT)
+ if (_hotspots[i]._direction == Common::KEYCODE_RIGHT)
x -= kHeroMaxWidth;
- else if (_hotspots[i].direction == Common::KEYCODE_LEFT)
+ else if (_hotspots[i]._direction == Common::KEYCODE_LEFT)
x += kHeroMaxWidth;
if (!_vm->_route->startRoute(kRouteExit, i, x, y))
Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
@@ -254,7 +254,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
_vm->_object->lookObject(obj);
} else {
bool foundFl = false; // TRUE if route found to object
- switch (obj->viewx) { // Clicked over viewport object
+ switch (obj->_viewx) { // Clicked over viewport object
case -1: // Walk to object position
if (_vm->_object->findObjectSpace(obj, &x, &y))
foundFl = _vm->_route->startRoute(kRouteLook, objId, x, y);
@@ -265,8 +265,8 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
_vm->_object->lookObject(obj);
break;
default: // Walk to view point if possible
- if (!_vm->_route->startRoute(kRouteLook, objId, obj->viewx, obj->viewy)) {
- if (_vm->_hero->cycling == kCycleInvisible) // If invisible do
+ if (!_vm->_route->startRoute(kRouteLook, objId, obj->_viewx, obj->_viewy)) {
+ if (_vm->_hero->_cycling == kCycleInvisible) // If invisible do
_vm->_object->lookObject(obj); // immediate decription
else
Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
@@ -284,16 +284,16 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
void MouseHandler::mouseHandler() {
debugC(2, kDebugMouse, "mouseHandler");
- status_t &gameStatus = _vm->getGameStatus();
- istate_t inventState = _vm->_inventory->getInventoryState();
- if ((gameStatus.viewState != kViewPlay) && (inventState != kInventoryActive))
+ Status &gameStatus = _vm->getGameStatus();
+ Istate inventState = _vm->_inventory->getInventoryState();
+ if ((gameStatus._viewState != kViewPlay) && (inventState != kInventoryActive))
return;
int16 cx = getMouseX();
int16 cy = getMouseY();
-// gameStatus.cx = cx; // Save cursor coords
-// gameStatus.cy = cy;
+// gameStatus._cx = cx; // Save cursor coords
+// gameStatus._cy = cy;
// Don't process if outside client area
if ((cx < 0) || (cx > kXPix) || (cy < kDibOffY) || (cy > kViewSizeY + kDibOffY))
@@ -309,14 +309,14 @@ void MouseHandler::mouseHandler() {
}
}
- if (!gameStatus.gameOverFl) {
+ if (!gameStatus._gameOverFl) {
if (objId == -1) // No match, check rest of view
objId = _vm->_object->findObject(cx, cy);
if (objId >= 0) { // Got a match
// Display object name next to cursor (unless CURSOR_NOCHAR)
// Note test for swapped hero name
- const char *name = _vm->_text->getNoun(_vm->_object->_objects[(objId == kHeroIndex) ? _vm->_heroImage : objId].nounIndex, kCursorNameIndex);
+ const char *name = _vm->_text->getNoun(_vm->_object->_objects[(objId == kHeroIndex) ? _vm->_heroImage : objId]._nounIndex, kCursorNameIndex);
if (name[0] != kCursorNochar)
cursorText(name, cx, cy, U_FONT8, _TBRIGHTWHITE);
@@ -327,8 +327,8 @@ void MouseHandler::mouseHandler() {
// Process cursor over an exit hotspot
if (objId == -1) {
- int i = findExit(cx, cy, *_vm->_screen_p);
- if (i != -1 && _hotspots[i].viewx >= 0) {
+ int i = findExit(cx, cy, *_vm->_screenPtr);
+ if (i != -1 && _hotspots[i]._viewx >= 0) {
objId = kExitHotspot;
cursorText(_vm->_text->getTextMouse(kMsExit), cx, cy, U_FONT8, _TBRIGHTWHITE);
}
@@ -343,29 +343,29 @@ void MouseHandler::mouseHandler() {
resetRightButton();
}
-void MouseHandler::readHotspot(Common::ReadStream &in, hotspot_t &hotspot) {
- hotspot.screenIndex = in.readSint16BE();
- hotspot.x1 = in.readSint16BE();
- hotspot.y1 = in.readSint16BE();
- hotspot.x2 = in.readSint16BE();
- hotspot.y2 = in.readSint16BE();
- hotspot.actIndex = in.readUint16BE();
- hotspot.viewx = in.readSint16BE();
- hotspot.viewy = in.readSint16BE();
- hotspot.direction = in.readSint16BE();
+void MouseHandler::readHotspot(Common::ReadStream &in, Hotspot &hotspot) {
+ hotspot._screenIndex = in.readSint16BE();
+ hotspot._x1 = in.readSint16BE();
+ hotspot._y1 = in.readSint16BE();
+ hotspot._x2 = in.readSint16BE();
+ hotspot._y2 = in.readSint16BE();
+ hotspot._actIndex = in.readUint16BE();
+ hotspot._viewx = in.readSint16BE();
+ hotspot._viewy = in.readSint16BE();
+ hotspot._direction = in.readSint16BE();
}
/**
* Load hotspots data from hugo.dat
*/
void MouseHandler::loadHotspots(Common::ReadStream &in) {
- hotspot_t *wrkHotspots = 0;
- hotspot_t tmp;
+ Hotspot *wrkHotspots = 0;
+ Hotspot tmp;
memset(&tmp, 0, sizeof(tmp));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
int numRows = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _hotspots = wrkHotspots = (hotspot_t *)malloc(sizeof(hotspot_t) * numRows);
+ _hotspots = wrkHotspots = (Hotspot *)malloc(sizeof(Hotspot) * numRows);
for (int i = 0; i < numRows; i++)
readHotspot(in, (varnt == _vm->_gameVariant) ? wrkHotspots[i] : tmp);
@@ -376,10 +376,10 @@ void MouseHandler::loadHotspots(Common::ReadStream &in) {
* Display hotspot boundaries for the current screen
*/
void MouseHandler::drawHotspots() const {
- for (int i = 0; _hotspots[i].screenIndex >= 0; i++) {
- hotspot_t *hotspot = &_hotspots[i];
- if (hotspot->screenIndex == _vm->_hero->screenIndex)
- _vm->_screen->drawRectangle(false, hotspot->x1, hotspot->y1, hotspot->x2, hotspot->y2, _TLIGHTRED);
+ for (int i = 0; _hotspots[i]._screenIndex >= 0; i++) {
+ Hotspot *hotspot = &_hotspots[i];
+ if (hotspot->_screenIndex == _vm->_hero->_screenIndex)
+ _vm->_screen->drawRectangle(false, hotspot->_x1, hotspot->_y1, hotspot->_x2, hotspot->_y2, _TLIGHTRED);
}
}
} // End of namespace Hugo
diff --git a/engines/hugo/mouse.h b/engines/hugo/mouse.h
index 35f9e4e87e..e20716f72c 100644
--- a/engines/hugo/mouse.h
+++ b/engines/hugo/mouse.h
@@ -70,17 +70,17 @@ private:
kMsExit = 1
};
- hotspot_t *_hotspots;
+ Hotspot *_hotspots;
bool _leftButtonFl; // Left mouse button pressed
bool _rightButtonFl; // Right button pressed
int _mouseX;
int _mouseY;
bool _jumpExitFl; // Allowed to jump to a screen exit
- void cursorText(const char *buffer, const int16 cx, const int16 cy, const uif_t fontId, const int16 color);
+ void cursorText(const char *buffer, const int16 cx, const int16 cy, const Uif fontId, const int16 color);
void processRightClick(const int16 objId, const int16 cx, const int16 cy);
void processLeftClick(const int16 objId, const int16 cx, const int16 cy);
- void readHotspot(Common::ReadStream &in, hotspot_t &hotspot);
+ void readHotspot(Common::ReadStream &in, Hotspot &hotspot);
};
} // End of namespace Hugo
diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp
index bc99abf410..7b4783e4d8 100644
--- a/engines/hugo/object.cpp
+++ b/engines/hugo/object.cpp
@@ -48,10 +48,10 @@ ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0), _uses(0) {
_numObj = 0;
_objCount = 0;
_usesSize = 0;
- memset(_objBound, '\0', sizeof(overlay_t));
- memset(_boundary, '\0', sizeof(overlay_t));
- memset(_overlay, '\0', sizeof(overlay_t));
- memset(_ovlBase, '\0', sizeof(overlay_t));
+ memset(_objBound, '\0', sizeof(Overlay));
+ memset(_boundary, '\0', sizeof(Overlay));
+ memset(_overlay, '\0', sizeof(Overlay));
+ memset(_ovlBase, '\0', sizeof(Overlay));
}
ObjectHandler::~ObjectHandler() {
@@ -74,55 +74,55 @@ byte ObjectHandler::getFirstOverlay(uint16 index) const {
}
bool ObjectHandler::isCarried(int objIndex) const {
- return _objects[objIndex].carriedFl;
+ return _objects[objIndex]._carriedFl;
}
void ObjectHandler::setCarry(int objIndex, bool val) {
- _objects[objIndex].carriedFl = val;
+ _objects[objIndex]._carriedFl = val;
}
void ObjectHandler::setVelocity(int objIndex, int8 vx, int8 vy) {
- _objects[objIndex].vx = vx;
- _objects[objIndex].vy = vy;
+ _objects[objIndex]._vx = vx;
+ _objects[objIndex]._vy = vy;
}
-void ObjectHandler::setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath) {
- _objects[objIndex].pathType = pathType;
- _objects[objIndex].vxPath = vxPath;
- _objects[objIndex].vyPath = vyPath;
+void ObjectHandler::setPath(int objIndex, Path pathType, int16 vxPath, int16 vyPath) {
+ _objects[objIndex]._pathType = pathType;
+ _objects[objIndex]._vxPath = vxPath;
+ _objects[objIndex]._vyPath = vyPath;
}
/**
* Save sequence number and image number in given object
*/
-void ObjectHandler::saveSeq(object_t *obj) {
+void ObjectHandler::saveSeq(Object *obj) {
debugC(1, kDebugObject, "saveSeq");
bool found = false;
- for (int i = 0; !found && (i < obj->seqNumb); i++) {
- seq_t *q = obj->seqList[i].seqPtr;
- for (int j = 0; !found && (j < obj->seqList[i].imageNbr); j++) {
- if (obj->currImagePtr == q) {
+ for (int i = 0; !found && (i < obj->_seqNumb); i++) {
+ Seq *q = obj->_seqList[i]._seqPtr;
+ for (int j = 0; !found && (j < obj->_seqList[i]._imageNbr); j++) {
+ if (obj->_currImagePtr == q) {
found = true;
- obj->curSeqNum = i;
- obj->curImageNum = j;
+ obj->_curSeqNum = i;
+ obj->_curImageNum = j;
} else {
- q = q->nextSeqPtr;
+ q = q->_nextSeqPtr;
}
}
}
}
/**
- * Set up cur_seq_p from stored sequence and image number in object
+ * Set up cur_seqPtr from stored sequence and image number in object
*/
-void ObjectHandler::restoreSeq(object_t *obj) {
+void ObjectHandler::restoreSeq(Object *obj) {
debugC(1, kDebugObject, "restoreSeq");
- seq_t *q = obj->seqList[obj->curSeqNum].seqPtr;
- for (int j = 0; j < obj->curImageNum; j++)
- q = q->nextSeqPtr;
- obj->currImagePtr = q;
+ Seq *q = obj->_seqList[obj->_curSeqNum]._seqPtr;
+ for (int j = 0; j < obj->_curImageNum; j++)
+ q = q->_nextSeqPtr;
+ obj->_currImagePtr = q;
}
/**
@@ -134,36 +134,36 @@ void ObjectHandler::useObject(int16 objId) {
const char *verb; // Background verb to use directly
int16 inventObjId = _vm->_inventory->getInventoryObjId();
- object_t *obj = &_objects[objId]; // Ptr to object
+ Object *obj = &_objects[objId]; // Ptr to object
if (inventObjId == -1) {
// Get or use objid directly
- if ((obj->genericCmd & TAKE) || obj->objValue) // Get collectible item
- sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_take, 0), _vm->_text->getNoun(obj->nounIndex, 0));
- else if (obj->cmdIndex != 0) // Use non-collectible item if able
- sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(obj->cmdIndex), 0), _vm->_text->getNoun(obj->nounIndex, 0));
- else if ((verb = _vm->_parser->useBG(_vm->_text->getNoun(obj->nounIndex, 0))) != 0)
- sprintf(_vm->_line, "%s %s", verb, _vm->_text->getNoun(obj->nounIndex, 0));
+ if ((obj->_genericCmd & TAKE) || obj->_objValue) // Get collectible item
+ sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_take, 0), _vm->_text->getNoun(obj->_nounIndex, 0));
+ else if (obj->_cmdIndex != 0) // Use non-collectible item if able
+ sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(obj->_cmdIndex), 0), _vm->_text->getNoun(obj->_nounIndex, 0));
+ else if ((verb = _vm->_parser->useBG(_vm->_text->getNoun(obj->_nounIndex, 0))) != 0)
+ sprintf(_vm->_line, "%s %s", verb, _vm->_text->getNoun(obj->_nounIndex, 0));
else
return; // Can't use object directly
} else {
// Use status.objid on objid
// Default to first cmd verb
- sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(_objects[inventObjId].cmdIndex), 0),
- _vm->_text->getNoun(_objects[inventObjId].nounIndex, 0),
- _vm->_text->getNoun(obj->nounIndex, 0));
+ sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(_objects[inventObjId]._cmdIndex), 0),
+ _vm->_text->getNoun(_objects[inventObjId]._nounIndex, 0),
+ _vm->_text->getNoun(obj->_nounIndex, 0));
// Check valid use of objects and override verb if necessary
- for (uses_t *use = _uses; use->objId != _numObj; use++) {
- if (inventObjId == use->objId) {
+ for (Uses *use = _uses; use->_objId != _numObj; use++) {
+ if (inventObjId == use->_objId) {
// Look for secondary object, if found use matching verb
bool foundFl = false;
- for (target_t *target = use->targets; target->nounIndex != 0; target++)
- if (target->nounIndex == obj->nounIndex) {
+ for (Target *target = use->_targets; target->_nounIndex != 0; target++)
+ if (target->_nounIndex == obj->_nounIndex) {
foundFl = true;
- sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(target->verbIndex, 0),
- _vm->_text->getNoun(_objects[inventObjId].nounIndex, 0),
- _vm->_text->getNoun(obj->nounIndex, 0));
+ sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(target->_verbIndex, 0),
+ _vm->_text->getNoun(_objects[inventObjId]._nounIndex, 0),
+ _vm->_text->getNoun(obj->_nounIndex, 0));
}
// No valid use of objects found, print failure string
@@ -171,7 +171,7 @@ void ObjectHandler::useObject(int16 objId) {
// Deselect dragged icon if inventory not active
if (_vm->_inventory->getInventoryState() != kInventoryActive)
_vm->_screen->resetInventoryObjId();
- Utils::notifyBox(_vm->_text->getTextData(use->dataIndex));
+ Utils::notifyBox(_vm->_text->getTextData(use->_dataIndex));
return;
}
}
@@ -195,30 +195,30 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) {
int16 objIndex = -1; // Index of found object
uint16 y2Max = 0; // Greatest y2
- object_t *obj = _objects;
+ Object *obj = _objects;
// Check objects on screen
for (int i = 0; i < _numObj; i++, obj++) {
// Object must be in current screen and "useful"
- if (obj->screenIndex == *_vm->_screen_p && (obj->genericCmd || obj->objValue || obj->cmdIndex)) {
- seq_t *curImage = obj->currImagePtr;
+ if (obj->_screenIndex == *_vm->_screenPtr && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) {
+ Seq *curImage = obj->_currImagePtr;
// Object must have a visible image...
- if (curImage != 0 && obj->cycling != kCycleInvisible) {
+ if (curImage != 0 && obj->_cycling != kCycleInvisible) {
// If cursor inside object
- if (x >= (uint16)obj->x && x <= obj->x + curImage->x2 && y >= (uint16)obj->y && y <= obj->y + curImage->y2) {
+ if (x >= (uint16)obj->_x && x <= obj->_x + curImage->_x2 && y >= (uint16)obj->_y && y <= obj->_y + curImage->_y2) {
// If object is closest so far
- if (obj->y + curImage->y2 > y2Max) {
- y2Max = obj->y + curImage->y2;
+ if (obj->_y + curImage->_y2 > y2Max) {
+ y2Max = obj->_y + curImage->_y2;
objIndex = i; // Found an object!
}
}
} else {
// ...or a dummy object that has a hotspot rectangle
- if (curImage == 0 && obj->vxPath != 0 && !obj->carriedFl) {
+ if (curImage == 0 && obj->_vxPath != 0 && !obj->_carriedFl) {
// If cursor inside special rectangle
- if ((int16)x >= obj->oldx && (int16)x < obj->oldx + obj->vxPath && (int16)y >= obj->oldy && (int16)y < obj->oldy + obj->vyPath) {
+ if ((int16)x >= obj->_oldx && (int16)x < obj->_oldx + obj->_vxPath && (int16)y >= obj->_oldy && (int16)y < obj->_oldy + obj->_vyPath) {
// If object is closest so far
- if (obj->oldy + obj->vyPath - 1 > (int16)y2Max) {
- y2Max = obj->oldy + obj->vyPath - 1;
+ if (obj->_oldy + obj->_vyPath - 1 > (int16)y2Max) {
+ y2Max = obj->_oldy + obj->_vyPath - 1;
objIndex = i; // Found an object!
}
}
@@ -233,14 +233,14 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) {
* Issue "Look at <object>" command
* Note special case of swapped hero image
*/
-void ObjectHandler::lookObject(object_t *obj) {
+void ObjectHandler::lookObject(Object *obj) {
debugC(1, kDebugObject, "lookObject");
if (obj == _vm->_hero)
// Hero swapped - look at other
obj = &_objects[_vm->_heroImage];
- _vm->_parser->command("%s %s", _vm->_text->getVerb(_vm->_look, 0), _vm->_text->getNoun(obj->nounIndex, 0));
+ _vm->_parser->command("%s %s", _vm->_text->getVerb(_vm->_look, 0), _vm->_text->getNoun(obj->_nounIndex, 0));
}
/**
@@ -249,26 +249,26 @@ void ObjectHandler::lookObject(object_t *obj) {
void ObjectHandler::freeObjects() {
debugC(1, kDebugObject, "freeObjects");
- if (_vm->_hero != 0 && _vm->_hero->seqList[0].seqPtr != 0) {
+ if (_vm->_hero != 0 && _vm->_hero->_seqList[0]._seqPtr != 0) {
// Free all sequence lists and image data
for (int16 i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i];
- for (int16 j = 0; j < obj->seqNumb; j++) {
- seq_t *seq = obj->seqList[j].seqPtr;
- seq_t *next;
+ Object *obj = &_objects[i];
+ for (int16 j = 0; j < obj->_seqNumb; j++) {
+ Seq *seq = obj->_seqList[j]._seqPtr;
+ Seq *next;
if (seq == 0) // Failure during database load
break;
- if (seq->imagePtr != 0) {
- free(seq->imagePtr);
- seq->imagePtr = 0;
+ if (seq->_imagePtr != 0) {
+ free(seq->_imagePtr);
+ seq->_imagePtr = 0;
}
- seq = seq->nextSeqPtr;
- while (seq != obj->seqList[j].seqPtr) {
- if (seq->imagePtr != 0) {
- free(seq->imagePtr);
- seq->imagePtr = 0;
+ seq = seq->_nextSeqPtr;
+ while (seq != obj->_seqList[j]._seqPtr) {
+ if (seq->_imagePtr != 0) {
+ free(seq->_imagePtr);
+ seq->_imagePtr = 0;
}
- next = seq->nextSeqPtr;
+ next = seq->_nextSeqPtr;
free(seq);
seq = next;
}
@@ -279,13 +279,13 @@ void ObjectHandler::freeObjects() {
if (_uses) {
for (int16 i = 0; i < _usesSize; i++)
- free(_uses[i].targets);
+ free(_uses[i]._targets);
free(_uses);
}
for (int16 i = 0; i < _objCount; i++) {
- free(_objects[i].stateDataIndex);
- _objects[i].stateDataIndex = 0;
+ free(_objects[i]._stateDataIndex);
+ _objects[i]._stateDataIndex = 0;
}
free(_objects);
@@ -300,27 +300,27 @@ void ObjectHandler::freeObjects() {
int ObjectHandler::y2comp(const void *a, const void *b) {
debugC(6, kDebugObject, "y2comp");
- const object_t *p1 = &HugoEngine::get()._object->_objects[*(const byte *)a];
- const object_t *p2 = &HugoEngine::get()._object->_objects[*(const byte *)b];
+ const Object *p1 = &HugoEngine::get()._object->_objects[*(const byte *)a];
+ const Object *p2 = &HugoEngine::get()._object->_objects[*(const byte *)b];
if (p1 == p2)
// Why does qsort try the same indexes?
return 0;
- if (p1->priority == kPriorityBackground)
+ if (p1->_priority == kPriorityBackground)
return -1;
- if (p2->priority == kPriorityBackground)
+ if (p2->_priority == kPriorityBackground)
return 1;
- if (p1->priority == kPriorityForeground)
+ if (p1->_priority == kPriorityForeground)
return 1;
- if (p2->priority == kPriorityForeground)
+ if (p2->_priority == kPriorityForeground)
return -1;
- int ay2 = p1->y + p1->currImagePtr->y2;
- int by2 = p2->y + p2->currImagePtr->y2;
+ int ay2 = p1->_y + p1->_currImagePtr->_y2;
+ int by2 = p2->_y + p2->_currImagePtr->_y2;
return ay2 - by2;
}
@@ -332,7 +332,7 @@ bool ObjectHandler::isCarrying(uint16 wordIndex) {
debugC(1, kDebugObject, "isCarrying(%d)", wordIndex);
for (int i = 0; i < _numObj; i++) {
- if ((wordIndex == _objects[i].nounIndex) && _objects[i].carriedFl)
+ if ((wordIndex == _objects[i]._nounIndex) && _objects[i]._carriedFl)
return true;
}
return false;
@@ -345,11 +345,11 @@ void ObjectHandler::showTakeables() {
debugC(1, kDebugObject, "showTakeables");
for (int j = 0; j < _numObj; j++) {
- object_t *obj = &_objects[j];
- if ((obj->cycling != kCycleInvisible) &&
- (obj->screenIndex == *_vm->_screen_p) &&
- (((TAKE & obj->genericCmd) == TAKE) || obj->objValue)) {
- Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->nounIndex, LOOK_NAME)));
+ Object *obj = &_objects[j];
+ if ((obj->_cycling != kCycleInvisible) &&
+ (obj->_screenIndex == *_vm->_screenPtr) &&
+ (((TAKE & obj->_genericCmd) == TAKE) || obj->_objValue)) {
+ Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->_nounIndex, LOOK_NAME)));
}
}
}
@@ -357,22 +357,22 @@ void ObjectHandler::showTakeables() {
/**
* Find a clear space around supplied object that hero can walk to
*/
-bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
+bool ObjectHandler::findObjectSpace(Object *obj, int16 *destx, int16 *desty) {
debugC(1, kDebugObject, "findObjectSpace(obj, %d, %d)", *destx, *desty);
- seq_t *curImage = obj->currImagePtr;
- int16 y = obj->y + curImage->y2 - 1;
+ Seq *curImage = obj->_currImagePtr;
+ int16 y = obj->_y + curImage->_y2 - 1;
bool foundFl = true;
// Try left rear corner
- for (int16 x = *destx = obj->x + curImage->x1; x < *destx + kHeroMaxWidth; x++) {
+ for (int16 x = *destx = obj->_x + curImage->_x1; x < *destx + kHeroMaxWidth; x++) {
if (checkBoundary(x, y))
foundFl = false;
}
if (!foundFl) { // Try right rear corner
foundFl = true;
- for (int16 x = *destx = obj->x + curImage->x2 - kHeroMaxWidth + 1; x <= obj->x + (int16)curImage->x2; x++) {
+ for (int16 x = *destx = obj->_x + curImage->_x2 - kHeroMaxWidth + 1; x <= obj->_x + (int16)curImage->_x2; x++) {
if (checkBoundary(x, y))
foundFl = false;
}
@@ -381,7 +381,7 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
if (!foundFl) { // Try left front corner
foundFl = true;
y += 2;
- for (int16 x = *destx = obj->x + curImage->x1; x < *destx + kHeroMaxWidth; x++) {
+ for (int16 x = *destx = obj->_x + curImage->_x1; x < *destx + kHeroMaxWidth; x++) {
if (checkBoundary(x, y))
foundFl = false;
}
@@ -389,7 +389,7 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
if (!foundFl) { // Try right rear corner
foundFl = true;
- for (int16 x = *destx = obj->x + curImage->x2 - kHeroMaxWidth + 1; x <= obj->x + (int16)curImage->x2; x++) {
+ for (int16 x = *destx = obj->_x + curImage->_x2 - kHeroMaxWidth + 1; x <= obj->_x + (int16)curImage->_x2; x++) {
if (checkBoundary(x, y))
foundFl = false;
}
@@ -399,29 +399,29 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
return foundFl;
}
-void ObjectHandler::readUse(Common::ReadStream &in, uses_t &curUse) {
- curUse.objId = in.readSint16BE();
- curUse.dataIndex = in.readUint16BE();
+void ObjectHandler::readUse(Common::ReadStream &in, Uses &curUse) {
+ curUse._objId = in.readSint16BE();
+ curUse._dataIndex = in.readUint16BE();
uint16 numSubElem = in.readUint16BE();
- curUse.targets = (target_t *)malloc(sizeof(target_t) * numSubElem);
+ curUse._targets = (Target *)malloc(sizeof(Target) * numSubElem);
for (int j = 0; j < numSubElem; j++) {
- curUse.targets[j].nounIndex = in.readUint16BE();
- curUse.targets[j].verbIndex = in.readUint16BE();
+ curUse._targets[j]._nounIndex = in.readUint16BE();
+ curUse._targets[j]._verbIndex = in.readUint16BE();
}
}
/**
* Load _uses from Hugo.dat
*/
void ObjectHandler::loadObjectUses(Common::ReadStream &in) {
- uses_t tmpUse;
- tmpUse.targets = 0;
+ Uses tmpUse;
+ tmpUse._targets = 0;
//Read _uses
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant) {
_usesSize = numElem;
- _uses = (uses_t *)malloc(sizeof(uses_t) * numElem);
+ _uses = (Uses *)malloc(sizeof(Uses) * numElem);
}
for (int i = 0; i < numElem; i++) {
@@ -429,83 +429,83 @@ void ObjectHandler::loadObjectUses(Common::ReadStream &in) {
readUse(in, _uses[i]);
else {
readUse(in, tmpUse);
- free(tmpUse.targets);
- tmpUse.targets = 0;
+ free(tmpUse._targets);
+ tmpUse._targets = 0;
}
}
}
}
-void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) {
- curObject.nounIndex = in.readUint16BE();
- curObject.dataIndex = in.readUint16BE();
+void ObjectHandler::readObject(Common::ReadStream &in, Object &curObject) {
+ curObject._nounIndex = in.readUint16BE();
+ curObject._dataIndex = in.readUint16BE();
uint16 numSubElem = in.readUint16BE();
if (numSubElem == 0)
- curObject.stateDataIndex = 0;
+ curObject._stateDataIndex = 0;
else
- curObject.stateDataIndex = (uint16 *)malloc(sizeof(uint16) * numSubElem);
+ curObject._stateDataIndex = (uint16 *)malloc(sizeof(uint16) * numSubElem);
for (int j = 0; j < numSubElem; j++)
- curObject.stateDataIndex[j] = in.readUint16BE();
-
- curObject.pathType = (path_t) in.readSint16BE();
- curObject.vxPath = in.readSint16BE();
- curObject.vyPath = in.readSint16BE();
- curObject.actIndex = in.readUint16BE();
- curObject.seqNumb = in.readByte();
- curObject.currImagePtr = 0;
-
- if (curObject.seqNumb == 0) {
- curObject.seqList[0].imageNbr = 0;
- curObject.seqList[0].seqPtr = 0;
+ curObject._stateDataIndex[j] = in.readUint16BE();
+
+ curObject._pathType = (Path) in.readSint16BE();
+ curObject._vxPath = in.readSint16BE();
+ curObject._vyPath = in.readSint16BE();
+ curObject._actIndex = in.readUint16BE();
+ curObject._seqNumb = in.readByte();
+ curObject._currImagePtr = 0;
+
+ if (curObject._seqNumb == 0) {
+ curObject._seqList[0]._imageNbr = 0;
+ curObject._seqList[0]._seqPtr = 0;
}
- for (int j = 0; j < curObject.seqNumb; j++) {
- curObject.seqList[j].imageNbr = in.readUint16BE();
- curObject.seqList[j].seqPtr = 0;
+ for (int j = 0; j < curObject._seqNumb; j++) {
+ curObject._seqList[j]._imageNbr = in.readUint16BE();
+ curObject._seqList[j]._seqPtr = 0;
}
- curObject.cycling = (cycle_t)in.readByte();
- curObject.cycleNumb = in.readByte();
- curObject.frameInterval = in.readByte();
- curObject.frameTimer = in.readByte();
- curObject.radius = in.readByte();
- curObject.screenIndex = in.readByte();
- curObject.x = in.readSint16BE();
- curObject.y = in.readSint16BE();
- curObject.oldx = in.readSint16BE();
- curObject.oldy = in.readSint16BE();
- curObject.vx = in.readByte();
- curObject.vy = in.readByte();
- curObject.objValue = in.readByte();
- curObject.genericCmd = in.readSint16BE();
- curObject.cmdIndex = in.readUint16BE();
- curObject.carriedFl = (in.readByte() != 0);
- curObject.state = in.readByte();
- curObject.verbOnlyFl = (in.readByte() != 0);
- curObject.priority = in.readByte();
- curObject.viewx = in.readSint16BE();
- curObject.viewy = in.readSint16BE();
- curObject.direction = in.readSint16BE();
- curObject.curSeqNum = in.readByte();
- curObject.curImageNum = in.readByte();
- curObject.oldvx = in.readByte();
- curObject.oldvy = in.readByte();
+ curObject._cycling = (Cycle)in.readByte();
+ curObject._cycleNumb = in.readByte();
+ curObject._frameInterval = in.readByte();
+ curObject._frameTimer = in.readByte();
+ curObject._radius = in.readByte();
+ curObject._screenIndex = in.readByte();
+ curObject._x = in.readSint16BE();
+ curObject._y = in.readSint16BE();
+ curObject._oldx = in.readSint16BE();
+ curObject._oldy = in.readSint16BE();
+ curObject._vx = in.readByte();
+ curObject._vy = in.readByte();
+ curObject._objValue = in.readByte();
+ curObject._genericCmd = in.readSint16BE();
+ curObject._cmdIndex = in.readUint16BE();
+ curObject._carriedFl = (in.readByte() != 0);
+ curObject._state = in.readByte();
+ curObject._verbOnlyFl = (in.readByte() != 0);
+ curObject._priority = in.readByte();
+ curObject._viewx = in.readSint16BE();
+ curObject._viewy = in.readSint16BE();
+ curObject._direction = in.readSint16BE();
+ curObject._curSeqNum = in.readByte();
+ curObject._curImageNum = in.readByte();
+ curObject._oldvx = in.readByte();
+ curObject._oldvy = in.readByte();
}
/**
* Load ObjectArr from Hugo.dat
*/
void ObjectHandler::loadObjectArr(Common::ReadStream &in) {
debugC(6, kDebugObject, "loadObject(&in)");
- object_t tmpObject;
- tmpObject.stateDataIndex = 0;
+ Object tmpObject;
+ tmpObject._stateDataIndex = 0;
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant) {
_objCount = numElem;
- _objects = (object_t *)malloc(sizeof(object_t) * numElem);
+ _objects = (Object *)malloc(sizeof(Object) * numElem);
}
for (int i = 0; i < numElem; i++) {
@@ -514,8 +514,8 @@ void ObjectHandler::loadObjectArr(Common::ReadStream &in) {
else {
// Skip over uneeded objects.
readObject(in, tmpObject);
- free(tmpObject.stateDataIndex);
- tmpObject.stateDataIndex = 0;
+ free(tmpObject._stateDataIndex);
+ tmpObject._stateDataIndex = 0;
}
}
}
@@ -528,7 +528,7 @@ void ObjectHandler::loadObjectArr(Common::ReadStream &in) {
void ObjectHandler::setCarriedScreen(int screenNum) {
for (int i = kHeroIndex + 1; i < _numObj; i++) {// Any others
if (isCarried(i)) // being carried
- _objects[i].screenIndex = screenNum;
+ _objects[i]._screenIndex = screenNum;
}
}
@@ -559,33 +559,33 @@ void ObjectHandler::restoreAllSeq() {
*/
void ObjectHandler::saveObjects(Common::WriteStream *out) {
for (int i = 0; i < _numObj; i++) {
- // Save where curr_seq_p is pointing to
+ // Save where curr_seqPtr is pointing to
saveSeq(&_objects[i]);
- out->writeByte(_objects[i].pathType);
- out->writeSint16BE(_objects[i].vxPath);
- out->writeSint16BE(_objects[i].vyPath);
- out->writeByte(_objects[i].cycling);
- out->writeByte(_objects[i].cycleNumb);
- out->writeByte(_objects[i].frameTimer);
- out->writeByte(_objects[i].screenIndex);
- out->writeSint16BE(_objects[i].x);
- out->writeSint16BE(_objects[i].y);
- out->writeSint16BE(_objects[i].oldx);
- out->writeSint16BE(_objects[i].oldy);
- out->writeSByte(_objects[i].vx);
- out->writeSByte(_objects[i].vy);
- out->writeByte(_objects[i].objValue);
- out->writeByte((_objects[i].carriedFl) ? 1 : 0);
- out->writeByte(_objects[i].state);
- out->writeByte(_objects[i].priority);
- out->writeSint16BE(_objects[i].viewx);
- out->writeSint16BE(_objects[i].viewy);
- out->writeSint16BE(_objects[i].direction);
- out->writeByte(_objects[i].curSeqNum);
- out->writeByte(_objects[i].curImageNum);
- out->writeSByte(_objects[i].oldvx);
- out->writeSByte(_objects[i].oldvy);
+ out->writeByte(_objects[i]._pathType);
+ out->writeSint16BE(_objects[i]._vxPath);
+ out->writeSint16BE(_objects[i]._vyPath);
+ out->writeByte(_objects[i]._cycling);
+ out->writeByte(_objects[i]._cycleNumb);
+ out->writeByte(_objects[i]._frameTimer);
+ out->writeByte(_objects[i]._screenIndex);
+ out->writeSint16BE(_objects[i]._x);
+ out->writeSint16BE(_objects[i]._y);
+ out->writeSint16BE(_objects[i]._oldx);
+ out->writeSint16BE(_objects[i]._oldy);
+ out->writeSByte(_objects[i]._vx);
+ out->writeSByte(_objects[i]._vy);
+ out->writeByte(_objects[i]._objValue);
+ out->writeByte((_objects[i]._carriedFl) ? 1 : 0);
+ out->writeByte(_objects[i]._state);
+ out->writeByte(_objects[i]._priority);
+ out->writeSint16BE(_objects[i]._viewx);
+ out->writeSint16BE(_objects[i]._viewy);
+ out->writeSint16BE(_objects[i]._direction);
+ out->writeByte(_objects[i]._curSeqNum);
+ out->writeByte(_objects[i]._curImageNum);
+ out->writeSByte(_objects[i]._oldvx);
+ out->writeSByte(_objects[i]._oldvy);
}
}
@@ -594,30 +594,30 @@ void ObjectHandler::saveObjects(Common::WriteStream *out) {
*/
void ObjectHandler::restoreObjects(Common::SeekableReadStream *in) {
for (int i = 0; i < _numObj; i++) {
- _objects[i].pathType = (path_t) in->readByte();
- _objects[i].vxPath = in->readSint16BE();
- _objects[i].vyPath = in->readSint16BE();
- _objects[i].cycling = (cycle_t) in->readByte();
- _objects[i].cycleNumb = in->readByte();
- _objects[i].frameTimer = in->readByte();
- _objects[i].screenIndex = in->readByte();
- _objects[i].x = in->readSint16BE();
- _objects[i].y = in->readSint16BE();
- _objects[i].oldx = in->readSint16BE();
- _objects[i].oldy = in->readSint16BE();
- _objects[i].vx = in->readSByte();
- _objects[i].vy = in->readSByte();
- _objects[i].objValue = in->readByte();
- _objects[i].carriedFl = (in->readByte() == 1);
- _objects[i].state = in->readByte();
- _objects[i].priority = in->readByte();
- _objects[i].viewx = in->readSint16BE();
- _objects[i].viewy = in->readSint16BE();
- _objects[i].direction = in->readSint16BE();
- _objects[i].curSeqNum = in->readByte();
- _objects[i].curImageNum = in->readByte();
- _objects[i].oldvx = in->readSByte();
- _objects[i].oldvy = in->readSByte();
+ _objects[i]._pathType = (Path) in->readByte();
+ _objects[i]._vxPath = in->readSint16BE();
+ _objects[i]._vyPath = in->readSint16BE();
+ _objects[i]._cycling = (Cycle) in->readByte();
+ _objects[i]._cycleNumb = in->readByte();
+ _objects[i]._frameTimer = in->readByte();
+ _objects[i]._screenIndex = in->readByte();
+ _objects[i]._x = in->readSint16BE();
+ _objects[i]._y = in->readSint16BE();
+ _objects[i]._oldx = in->readSint16BE();
+ _objects[i]._oldy = in->readSint16BE();
+ _objects[i]._vx = in->readSByte();
+ _objects[i]._vy = in->readSByte();
+ _objects[i]._objValue = in->readByte();
+ _objects[i]._carriedFl = (in->readByte() == 1);
+ _objects[i]._state = in->readByte();
+ _objects[i]._priority = in->readByte();
+ _objects[i]._viewx = in->readSint16BE();
+ _objects[i]._viewy = in->readSint16BE();
+ _objects[i]._direction = in->readSint16BE();
+ _objects[i]._curSeqNum = in->readByte();
+ _objects[i]._curImageNum = in->readByte();
+ _objects[i]._oldvx = in->readSByte();
+ _objects[i]._oldvy = in->readSByte();
}
}
@@ -627,7 +627,7 @@ void ObjectHandler::restoreObjects(Common::SeekableReadStream *in) {
int ObjectHandler::calcMaxScore() {
int score = 0;
for (int i = 0; i < _numObj; i++)
- score += _objects[i].objValue;
+ score += _objects[i]._objValue;
return score;
}
@@ -782,32 +782,32 @@ void ObjectHandler::clearScreenBoundary(const int x1, const int x2, const int y)
/**
* An object has collided with a boundary. See if any actions are required
*/
-void ObjectHandler::boundaryCollision(object_t *obj) {
+void ObjectHandler::boundaryCollision(Object *obj) {
debugC(1, kDebugEngine, "boundaryCollision");
if (obj == _vm->_hero) {
// Hotspots only relevant to HERO
int x;
- if (obj->vx > 0)
- x = obj->x + obj->currImagePtr->x2;
+ if (obj->_vx > 0)
+ x = obj->_x + obj->_currImagePtr->_x2;
else
- x = obj->x + obj->currImagePtr->x1;
- int y = obj->y + obj->currImagePtr->y2;
+ x = obj->_x + obj->_currImagePtr->_x1;
+ int y = obj->_y + obj->_currImagePtr->_y2;
- int16 index = _vm->_mouse->findExit(x, y, obj->screenIndex);
+ int16 index = _vm->_mouse->findExit(x, y, obj->_screenIndex);
if (index >= 0)
_vm->_scheduler->insertActionList(_vm->_mouse->getHotspotActIndex(index));
} else {
// Check whether an object collided with HERO
- int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - obj->currImagePtr->x1;
- int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - obj->currImagePtr->y2;
+ int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - obj->_currImagePtr->_x1;
+ int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - obj->_currImagePtr->_y2;
// If object's radius is infinity, use a closer value
- int8 radius = obj->radius;
+ int8 radius = obj->_radius;
if (radius < 0)
radius = kStepDx * 2;
if ((abs(dx) <= radius) && (abs(dy) <= radius))
- _vm->_scheduler->insertActionList(obj->actIndex);
+ _vm->_scheduler->insertActionList(obj->_actIndex);
}
}
diff --git a/engines/hugo/object.h b/engines/hugo/object.h
index 84c20db041..fd0d731a98 100644
--- a/engines/hugo/object.h
+++ b/engines/hugo/object.h
@@ -34,15 +34,15 @@
namespace Hugo {
-struct target_t { // Secondary target for action
- uint16 nounIndex; // Secondary object
- uint16 verbIndex; // Action on secondary object
+struct Target { // Secondary target for action
+ uint16 _nounIndex; // Secondary object
+ uint16 _verbIndex; // Action on secondary object
};
-struct uses_t { // Define uses of certain objects
- int16 objId; // Primary object
- uint16 dataIndex; // String if no secondary object matches
- target_t *targets; // List of secondary targets
+struct Uses { // Define uses of certain objects
+ int16 _objId; // Primary object
+ uint16 _dataIndex; // String if no secondary object matches
+ Target *_targets; // List of secondary targets
};
class ObjectHandler {
@@ -50,12 +50,12 @@ public:
ObjectHandler(HugoEngine *vm);
virtual ~ObjectHandler();
- overlay_t _objBound;
- overlay_t _boundary; // Boundary overlay file
- overlay_t _overlay; // First overlay file
- overlay_t _ovlBase; // First overlay base file
+ Overlay _objBound;
+ Overlay _boundary; // Boundary overlay file
+ Overlay _overlay; // First overlay file
+ Overlay _ovlBase; // First overlay base file
- object_t *_objects;
+ Object *_objects;
uint16 _numObj;
byte getBoundaryOverlay(uint16 index) const;
@@ -65,7 +65,7 @@ public:
int deltaX(const int x1, const int x2, const int vx, int y) const;
int deltaY(const int x1, const int x2, const int vy, const int y) const;
- void boundaryCollision(object_t *obj);
+ void boundaryCollision(Object *obj);
void clearBoundary(const int x1, const int x2, const int y);
void clearScreenBoundary(const int x1, const int x2, const int y);
void storeBoundary(const int x1, const int x2, const int y);
@@ -76,7 +76,7 @@ public:
virtual void swapImages(int objIndex1, int objIndex2) = 0;
bool isCarrying(uint16 wordIndex);
- bool findObjectSpace(object_t *obj, int16 *destx, int16 *desty);
+ bool findObjectSpace(Object *obj, int16 *destx, int16 *desty);
int calcMaxScore();
int16 findObject(uint16 x, uint16 y);
@@ -84,14 +84,14 @@ public:
void loadObjectArr(Common::ReadStream &in);
void loadObjectUses(Common::ReadStream &in);
void loadNumObj(Common::ReadStream &in);
- void lookObject(object_t *obj);
+ void lookObject(Object *obj);
void readObjectImages();
- void readObject(Common::ReadStream &in, object_t &curObject);
- void readUse(Common::ReadStream &in, uses_t &curUse);
+ void readObject(Common::ReadStream &in, Object &curObject);
+ void readUse(Common::ReadStream &in, Uses &curUse);
void restoreAllSeq();
void restoreObjects(Common::SeekableReadStream *in);
void saveObjects(Common::WriteStream *out);
- void saveSeq(object_t *obj);
+ void saveSeq(Object *obj);
void setCarriedScreen(int screenNum);
void showTakeables();
void useObject(int16 objId);
@@ -101,7 +101,7 @@ public:
bool isCarried(int objIndex) const;
void setCarry(int objIndex, bool val);
void setVelocity(int objIndex, int8 vx, int8 vy);
- void setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath);
+ void setPath(int objIndex, Path pathType, int16 vxPath, int16 vyPath);
protected:
HugoEngine *_vm;
@@ -110,11 +110,11 @@ protected:
static const int kEdge2 = kEdge * 2; // Push object further back on edge collision
static const int kMaxObjNumb = 128; // Used in Update_images()
- uint16 _objCount;
- uses_t *_uses;
- uint16 _usesSize;
+ uint16 _objCount;
+ Uses *_uses;
+ uint16 _usesSize;
- void restoreSeq(object_t *obj);
+ void restoreSeq(Object *obj);
inline bool checkBoundary(int16 x, int16 y);
template<typename T>
diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp
index 831dc88dea..7f88e9e5b8 100644
--- a/engines/hugo/object_v1d.cpp
+++ b/engines/hugo/object_v1d.cpp
@@ -59,43 +59,43 @@ void ObjectHandler_v1d::updateImages() {
debugC(5, kDebugObject, "updateImages");
// Initialize the index array to visible objects in current screen
- int num_objs = 0;
+ int objNumb = 0;
byte objindex[kMaxObjNumb]; // Array of indeces to objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i];
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= kCycleAlmostInvisible))
- objindex[num_objs++] = i;
+ Object *obj = &_objects[i];
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible))
+ objindex[objNumb++] = i;
}
// Sort the objects into increasing y+y2 (painter's algorithm)
- qsort(objindex, num_objs, sizeof(objindex[0]), y2comp);
+ qsort(objindex, objNumb, sizeof(objindex[0]), y2comp);
// Add each visible object to display list
- for (int i = 0; i < num_objs; i++) {
- object_t *obj = &_objects[objindex[i]];
+ for (int i = 0; i < objNumb; i++) {
+ Object *obj = &_objects[objindex[i]];
// Count down inter-frame timer
- if (obj->frameTimer)
- obj->frameTimer--;
+ if (obj->_frameTimer)
+ obj->_frameTimer--;
- if (obj->cycling > kCycleAlmostInvisible) { // Only if visible
- switch (obj->cycling) {
+ if (obj->_cycling > kCycleAlmostInvisible) { // Only if visible
+ switch (obj->_cycling) {
case kCycleNotCycling:
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, false);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, false);
break;
case kCycleForward:
- if (obj->frameTimer) // Not time to see next frame yet
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, false);
+ if (obj->_frameTimer) // Not time to see next frame yet
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, false);
else
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr->nextSeqPtr, false);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, false);
break;
case kCycleBackward: {
- seq_t *seqPtr = obj->currImagePtr;
- if (!obj->frameTimer) { // Show next frame
- while (seqPtr->nextSeqPtr != obj->currImagePtr)
- seqPtr = seqPtr->nextSeqPtr;
+ Seq *seqPtr = obj->_currImagePtr;
+ if (!obj->_frameTimer) { // Show next frame
+ while (seqPtr->_nextSeqPtr != obj->_currImagePtr)
+ seqPtr = seqPtr->_nextSeqPtr;
}
- _vm->_screen->displayFrame(obj->x, obj->y, seqPtr, false);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, seqPtr, false);
break;
}
default:
@@ -107,30 +107,30 @@ void ObjectHandler_v1d::updateImages() {
_vm->_scheduler->waitForRefresh();
// Cycle any animating objects
- for (int i = 0; i < num_objs; i++) {
- object_t *obj = &_objects[objindex[i]];
- if (obj->cycling != kCycleInvisible) {
+ for (int i = 0; i < objNumb; i++) {
+ Object *obj = &_objects[objindex[i]];
+ if (obj->_cycling != kCycleInvisible) {
// Only if it's visible
- if (obj->cycling == kCycleAlmostInvisible)
- obj->cycling = kCycleInvisible;
+ if (obj->_cycling == kCycleAlmostInvisible)
+ obj->_cycling = kCycleInvisible;
// Now Rotate to next picture in sequence
- switch (obj->cycling) {
+ switch (obj->_cycling) {
case kCycleNotCycling:
break;
case kCycleForward:
- if (!obj->frameTimer) {
+ if (!obj->_frameTimer) {
// Time to step to next frame
- obj->currImagePtr = obj->currImagePtr->nextSeqPtr;
+ obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr;
// Find out if this is last frame of sequence
// If so, reset frame_timer and decrement n_cycle
- if (obj->frameInterval || obj->cycleNumb) {
- obj->frameTimer = obj->frameInterval;
- for (int j = 0; j < obj->seqNumb; j++) {
- if (obj->currImagePtr->nextSeqPtr == obj->seqList[j].seqPtr) {
- if (obj->cycleNumb) { // Decr cycleNumb if Non-continous
- if (!--obj->cycleNumb)
- obj->cycling = kCycleNotCycling;
+ if (obj->_frameInterval || obj->_cycleNumb) {
+ obj->_frameTimer = obj->_frameInterval;
+ for (int j = 0; j < obj->_seqNumb; j++) {
+ if (obj->_currImagePtr->_nextSeqPtr == obj->_seqList[j]._seqPtr) {
+ if (obj->_cycleNumb) { // Decr cycleNumb if Non-continous
+ if (!--obj->_cycleNumb)
+ obj->_cycling = kCycleNotCycling;
}
}
}
@@ -138,20 +138,20 @@ void ObjectHandler_v1d::updateImages() {
}
break;
case kCycleBackward: {
- if (!obj->frameTimer) {
+ if (!obj->_frameTimer) {
// Time to step to prev frame
- seq_t *seqPtr = obj->currImagePtr;
- while (obj->currImagePtr->nextSeqPtr != seqPtr)
- obj->currImagePtr = obj->currImagePtr->nextSeqPtr;
+ Seq *seqPtr = obj->_currImagePtr;
+ while (obj->_currImagePtr->_nextSeqPtr != seqPtr)
+ obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr;
// Find out if this is first frame of sequence
// If so, reset frame_timer and decrement n_cycle
- if (obj->frameInterval || obj->cycleNumb) {
- obj->frameTimer = obj->frameInterval;
- for (int j = 0; j < obj->seqNumb; j++) {
- if (obj->currImagePtr == obj->seqList[j].seqPtr) {
- if (obj->cycleNumb){ // Decr cycleNumb if Non-continous
- if (!--obj->cycleNumb)
- obj->cycling = kCycleNotCycling;
+ if (obj->_frameInterval || obj->_cycleNumb) {
+ obj->_frameTimer = obj->_frameInterval;
+ for (int j = 0; j < obj->_seqNumb; j++) {
+ if (obj->_currImagePtr == obj->_seqList[j]._seqPtr) {
+ if (obj->_cycleNumb){ // Decr cycleNumb if Non-continous
+ if (!--obj->_cycleNumb)
+ obj->_cycling = kCycleNotCycling;
}
}
}
@@ -162,8 +162,8 @@ void ObjectHandler_v1d::updateImages() {
default:
break;
}
- obj->oldx = obj->x;
- obj->oldy = obj->y;
+ obj->_oldx = obj->_x;
+ obj->_oldy = obj->_y;
}
}
}
@@ -183,162 +183,162 @@ void ObjectHandler_v1d::moveObjects() {
// and store all (visible) object baselines into the boundary file.
// Don't store foreground or background objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if (obj->screenIndex == *_vm->_screen_p) {
- switch (obj->pathType) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if (obj->_screenIndex == *_vm->_screenPtr) {
+ switch (obj->_pathType) {
case kPathChase: {
// Allowable motion wrt boundary
- int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1;
- int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1;
+ int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1;
+ int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1;
if (abs(dx) <= 1)
- obj->vx = 0;
+ obj->_vx = 0;
else
- obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath);
+ obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath);
if (abs(dy) <= 1)
- obj->vy = 0;
+ obj->_vy = 0;
else
- obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath);
+ obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath);
// Set first image in sequence (if multi-seq object)
- if (obj->seqNumb == 4) {
- if (!obj->vx) { // Got 4 directions
- if (obj->vx != obj->oldvx) {// vx just stopped
+ if (obj->_seqNumb == 4) {
+ if (!obj->_vx) { // Got 4 directions
+ if (obj->_vx != obj->_oldvx) {// vx just stopped
if (dy > 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
+ } else if (obj->_vx != obj->_oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
}
- if (obj->vx || obj->vy) {
- if (obj->seqNumb > 1)
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy) {
+ if (obj->_seqNumb > 1)
+ obj->_cycling = kCycleForward;
} else {
- obj->cycling = kCycleNotCycling;
+ obj->_cycling = kCycleNotCycling;
boundaryCollision(obj); // Must have got hero!
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
break;
}
case kPathWander:
if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval
- obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath;
- obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath;
+ obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath;
+ obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath;
// Set first image in sequence (if multi-seq object)
- if (obj->seqNumb > 1) {
- if (!obj->vx && (obj->seqNumb > 2)) {
- if (obj->vx != obj->oldvx) { // vx just stopped
- if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ if (obj->_seqNumb > 1) {
+ if (!obj->_vx && (obj->_seqNumb > 2)) {
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
+ if (obj->_vy > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
- if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ } else if (obj->_vx != obj->_oldvx) {
+ if (obj->_vx > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
- if (obj->vx || obj->vy)
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy)
+ obj->_cycling = kCycleForward;
else
- obj->cycling = kCycleNotCycling;
+ obj->_cycling = kCycleNotCycling;
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
}
break;
default:
; // Really, nothing
}
// Store boundaries
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2);
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2);
}
}
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving
// Do object movement. Delta_x,y return allowed movement in x,y
// to move as close to a boundary as possible without crossing it.
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
// object coordinates
- int x1 = obj->x + currImage->x1; // Left edge of object
- int x2 = obj->x + currImage->x2; // Right edge
- int y1 = obj->y + currImage->y1; // Top edge
- int y2 = obj->y + currImage->y2; // Bottom edge
+ int x1 = obj->_x + currImage->_x1; // Left edge of object
+ int x2 = obj->_x + currImage->_x2; // Right edge
+ int y1 = obj->_y + currImage->_y1; // Top edge
+ int y2 = obj->_y + currImage->_y2; // Bottom edge
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(x1, x2, y2); // Clear our own boundary
// Allowable motion wrt boundary
- int dx = deltaX(x1, x2, obj->vx, y2);
- if (dx != obj->vx) {
+ int dx = deltaX(x1, x2, obj->_vx, y2);
+ if (dx != obj->_vx) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vx = 0;
+ obj->_vx = 0;
}
- int dy = deltaY(x1, x2, obj->vy, y2);
- if (dy != obj->vy) {
+ int dy = deltaY(x1, x2, obj->_vy, y2);
+ if (dy != obj->_vy) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vy = 0;
+ obj->_vy = 0;
}
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
storeBoundary(x1, x2, y2); // Re-store our own boundary
- obj->x += dx; // Update object position
- obj->y += dy;
+ obj->_x += dx; // Update object position
+ obj->_y += dy;
// Don't let object go outside screen
if (x1 < kEdge)
- obj->x = kEdge2;
+ obj->_x = kEdge2;
if (x2 > (kXPix - kEdge))
- obj->x = kXPix - kEdge2 - (x2 - x1);
+ obj->_x = kXPix - kEdge2 - (x2 - x1);
if (y1 < kEdge)
- obj->y = kEdge2;
+ obj->_y = kEdge2;
if (y2 > (kYPix - kEdge))
- obj->y = kYPix - kEdge2 - (y2 - y1);
+ obj->_y = kYPix - kEdge2 - (y2 - y1);
- if ((obj->vx == 0) && (obj->vy == 0))
- obj->cycling = kCycleNotCycling;
+ if ((obj->_vx == 0) && (obj->_vy == 0))
+ obj->_cycling = kCycleNotCycling;
}
}
// Clear all object baselines from the boundary file.
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2);
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}
// If maze mode is enabled, do special maze processing
- if (_vm->_maze.enabledFl) {
- seq_t *currImage = _vm->_hero->currImagePtr;// Get ptr to current image
+ if (_vm->_maze._enabledFl) {
+ Seq *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image
// hero coordinates
- int x1 = _vm->_hero->x + currImage->x1; // Left edge of object
- int x2 = _vm->_hero->x + currImage->x2; // Right edge
- int y1 = _vm->_hero->y + currImage->y1; // Top edge
- int y2 = _vm->_hero->y + currImage->y2; // Bottom edge
+ int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object
+ int x2 = _vm->_hero->_x + currImage->_x2; // Right edge
+ int y1 = _vm->_hero->_y + currImage->_y1; // Top edge
+ int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge
_vm->_scheduler->processMaze(x1, x2, y1, y2);
}
@@ -352,24 +352,24 @@ void ObjectHandler_v1d::moveObjects() {
void ObjectHandler_v1d::swapImages(int objIndex1, int objIndex2) {
debugC(1, kDebugObject, "swapImages(%d, %d)", objIndex1, objIndex2);
- seqList_t tmpSeqList[kMaxSeqNumb];
- int seqListSize = sizeof(seqList_t) * kMaxSeqNumb;
+ SeqList tmpSeqList[kMaxSeqNumb];
+ int seqListSize = sizeof(SeqList) * kMaxSeqNumb;
- memmove(tmpSeqList, _objects[objIndex1].seqList, seqListSize);
- memmove(_objects[objIndex1].seqList, _objects[objIndex2].seqList, seqListSize);
- memmove(_objects[objIndex2].seqList, tmpSeqList, seqListSize);
- _objects[objIndex1].currImagePtr = _objects[objIndex1].seqList[0].seqPtr;
- _objects[objIndex2].currImagePtr = _objects[objIndex2].seqList[0].seqPtr;
+ memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize);
+ memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize);
+ memmove(_objects[objIndex2]._seqList, tmpSeqList, seqListSize);
+ _objects[objIndex1]._currImagePtr = _objects[objIndex1]._seqList[0]._seqPtr;
+ _objects[objIndex2]._currImagePtr = _objects[objIndex2]._seqList[0]._seqPtr;
_vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex;
}
void ObjectHandler_v1d::homeIn(int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy) {
// object obj1 will home in on object obj2
- object_t *obj1 = &_objects[objIndex1];
- object_t *obj2 = &_objects[objIndex2];
- obj1->pathType = kPathAuto;
- int dx = obj1->x + obj1->currImagePtr->x1 - obj2->x - obj2->currImagePtr->x1;
- int dy = obj1->y + obj1->currImagePtr->y1 - obj2->y - obj2->currImagePtr->y1;
+ Object *obj1 = &_objects[objIndex1];
+ Object *obj2 = &_objects[objIndex2];
+ obj1->_pathType = kPathAuto;
+ int dx = obj1->_x + obj1->_currImagePtr->_x1 - obj2->_x - obj2->_currImagePtr->_x1;
+ int dy = obj1->_y + obj1->_currImagePtr->_y1 - obj2->_y - obj2->_currImagePtr->_y1;
if (dx == 0) // Don't EVER divide by zero!
dx = 1;
@@ -377,11 +377,11 @@ void ObjectHandler_v1d::homeIn(int objIndex1, const int objIndex2, const int8 ob
dy = 1;
if (abs(dx) > abs(dy)) {
- obj1->vx = objDx * -sign<int8>(dx);
- obj1->vy = abs((objDy * dy) / dx) * -sign<int8>(dy);
+ obj1->_vx = objDx * -sign<int8>(dx);
+ obj1->_vy = abs((objDy * dy) / dx) * -sign<int8>(dy);
} else {
- obj1->vy = objDy * sign<int8>(dy);
- obj1->vx = abs((objDx * dx) / dy) * sign<int8>(dx);
+ obj1->_vy = objDy * sign<int8>(dy);
+ obj1->_vx = abs((objDx * dx) / dy) * sign<int8>(dx);
}
}
} // End of namespace Hugo
diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp
index 4388ef5520..61b0f2e48a 100644
--- a/engines/hugo/object_v1w.cpp
+++ b/engines/hugo/object_v1w.cpp
@@ -59,43 +59,43 @@ void ObjectHandler_v1w::updateImages() {
debugC(5, kDebugObject, "updateImages");
// Initialize the index array to visible objects in current screen
- int num_objs = 0;
+ int objNumb = 0;
byte objindex[kMaxObjNumb]; // Array of indeces to objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i];
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= kCycleAlmostInvisible))
- objindex[num_objs++] = i;
+ Object *obj = &_objects[i];
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible))
+ objindex[objNumb++] = i;
}
// Sort the objects into increasing y+y2 (painter's algorithm)
- qsort(objindex, num_objs, sizeof(objindex[0]), y2comp);
+ qsort(objindex, objNumb, sizeof(objindex[0]), y2comp);
// Add each visible object to display list
- for (int i = 0; i < num_objs; i++) {
- object_t *obj = &_objects[objindex[i]];
+ for (int i = 0; i < objNumb; i++) {
+ Object *obj = &_objects[objindex[i]];
// Count down inter-frame timer
- if (obj->frameTimer)
- obj->frameTimer--;
+ if (obj->_frameTimer)
+ obj->_frameTimer--;
- if (obj->cycling > kCycleAlmostInvisible) { // Only if visible
- switch (obj->cycling) {
+ if (obj->_cycling > kCycleAlmostInvisible) { // Only if visible
+ switch (obj->_cycling) {
case kCycleNotCycling:
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay);
break;
case kCycleForward:
- if (obj->frameTimer) // Not time to see next frame yet
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay);
+ if (obj->_frameTimer) // Not time to see next frame yet
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay);
else
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr->nextSeqPtr, obj->priority == kPriorityOverOverlay);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, obj->_priority == kPriorityOverOverlay);
break;
case kCycleBackward: {
- seq_t *seqPtr = obj->currImagePtr;
- if (!obj->frameTimer) { // Show next frame
- while (seqPtr->nextSeqPtr != obj->currImagePtr)
- seqPtr = seqPtr->nextSeqPtr;
+ Seq *seqPtr = obj->_currImagePtr;
+ if (!obj->_frameTimer) { // Show next frame
+ while (seqPtr->_nextSeqPtr != obj->_currImagePtr)
+ seqPtr = seqPtr->_nextSeqPtr;
}
- _vm->_screen->displayFrame(obj->x, obj->y, seqPtr, obj->priority == kPriorityOverOverlay);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, seqPtr, obj->_priority == kPriorityOverOverlay);
break;
}
default:
@@ -105,30 +105,30 @@ void ObjectHandler_v1w::updateImages() {
}
// Cycle any animating objects
- for (int i = 0; i < num_objs; i++) {
- object_t *obj = &_objects[objindex[i]];
- if (obj->cycling != kCycleInvisible) {
+ for (int i = 0; i < objNumb; i++) {
+ Object *obj = &_objects[objindex[i]];
+ if (obj->_cycling != kCycleInvisible) {
// Only if it's visible
- if (obj->cycling == kCycleAlmostInvisible)
- obj->cycling = kCycleInvisible;
+ if (obj->_cycling == kCycleAlmostInvisible)
+ obj->_cycling = kCycleInvisible;
// Now Rotate to next picture in sequence
- switch (obj->cycling) {
+ switch (obj->_cycling) {
case kCycleNotCycling:
break;
case kCycleForward:
- if (!obj->frameTimer) {
+ if (!obj->_frameTimer) {
// Time to step to next frame
- obj->currImagePtr = obj->currImagePtr->nextSeqPtr;
+ obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr;
// Find out if this is last frame of sequence
// If so, reset frame_timer and decrement n_cycle
- if (obj->frameInterval || obj->cycleNumb) {
- obj->frameTimer = obj->frameInterval;
- for (int j = 0; j < obj->seqNumb; j++) {
- if (obj->currImagePtr->nextSeqPtr == obj->seqList[j].seqPtr) {
- if (obj->cycleNumb) { // Decr cycleNumb if Non-continous
- if (!--obj->cycleNumb)
- obj->cycling = kCycleNotCycling;
+ if (obj->_frameInterval || obj->_cycleNumb) {
+ obj->_frameTimer = obj->_frameInterval;
+ for (int j = 0; j < obj->_seqNumb; j++) {
+ if (obj->_currImagePtr->_nextSeqPtr == obj->_seqList[j]._seqPtr) {
+ if (obj->_cycleNumb) { // Decr cycleNumb if Non-continous
+ if (!--obj->_cycleNumb)
+ obj->_cycling = kCycleNotCycling;
}
}
}
@@ -136,20 +136,20 @@ void ObjectHandler_v1w::updateImages() {
}
break;
case kCycleBackward: {
- if (!obj->frameTimer) {
+ if (!obj->_frameTimer) {
// Time to step to prev frame
- seq_t *seqPtr = obj->currImagePtr;
- while (obj->currImagePtr->nextSeqPtr != seqPtr)
- obj->currImagePtr = obj->currImagePtr->nextSeqPtr;
+ Seq *seqPtr = obj->_currImagePtr;
+ while (obj->_currImagePtr->_nextSeqPtr != seqPtr)
+ obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr;
// Find out if this is first frame of sequence
// If so, reset frame_timer and decrement n_cycle
- if (obj->frameInterval || obj->cycleNumb) {
- obj->frameTimer = obj->frameInterval;
- for (int j = 0; j < obj->seqNumb; j++) {
- if (obj->currImagePtr == obj->seqList[j].seqPtr) {
- if (obj->cycleNumb){ // Decr cycleNumb if Non-continous
- if (!--obj->cycleNumb)
- obj->cycling = kCycleNotCycling;
+ if (obj->_frameInterval || obj->_cycleNumb) {
+ obj->_frameTimer = obj->_frameInterval;
+ for (int j = 0; j < obj->_seqNumb; j++) {
+ if (obj->_currImagePtr == obj->_seqList[j]._seqPtr) {
+ if (obj->_cycleNumb){ // Decr cycleNumb if Non-continous
+ if (!--obj->_cycleNumb)
+ obj->_cycling = kCycleNotCycling;
}
}
}
@@ -160,8 +160,8 @@ void ObjectHandler_v1w::updateImages() {
default:
break;
}
- obj->oldx = obj->x;
- obj->oldy = obj->y;
+ obj->_oldx = obj->_x;
+ obj->_oldy = obj->_y;
}
}
}
@@ -180,175 +180,175 @@ void ObjectHandler_v1w::moveObjects() {
// and store all (visible) object baselines into the boundary file.
// Don't store foreground or background objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if (obj->screenIndex == *_vm->_screen_p) {
- switch (obj->pathType) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if (obj->_screenIndex == *_vm->_screenPtr) {
+ switch (obj->_pathType) {
case kPathChase:
case kPathChase2: {
- int8 radius = obj->radius; // Default to object's radius
+ int8 radius = obj->_radius; // Default to object's radius
if (radius < 0) // If radius infinity, use closer value
radius = kStepDx;
// Allowable motion wrt boundary
- int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1;
- int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1;
+ int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1;
+ int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1;
if (abs(dx) <= radius)
- obj->vx = 0;
+ obj->_vx = 0;
else
- obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath);
+ obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath);
if (abs(dy) <= radius)
- obj->vy = 0;
+ obj->_vy = 0;
else
- obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath);
+ obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath);
// Set first image in sequence (if multi-seq object)
- switch (obj->seqNumb) {
+ switch (obj->_seqNumb) {
case 4:
- if (!obj->vx) { // Got 4 directions
- if (obj->vx != obj->oldvx) { // vx just stopped
+ if (!obj->_vx) { // Got 4 directions
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
if (dy >= 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
+ } else if (obj->_vx != obj->_oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
break;
case 3:
case 2:
- if (obj->vx != obj->oldvx) { // vx just stopped
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
if (dx > 0) // Left & right only
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
break;
}
- if (obj->vx || obj->vy) {
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy) {
+ obj->_cycling = kCycleForward;
} else {
- obj->cycling = kCycleNotCycling;
+ obj->_cycling = kCycleNotCycling;
boundaryCollision(obj); // Must have got hero!
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
break;
}
case kPathWander2:
case kPathWander:
if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval
- obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath;
- obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath;
+ obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath;
+ obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath;
// Set first image in sequence (if multi-seq object)
- if (obj->seqNumb > 1) {
- if (!obj->vx && (obj->seqNumb >= 4)) {
- if (obj->vx != obj->oldvx) { // vx just stopped
- if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ if (obj->_seqNumb > 1) {
+ if (!obj->_vx && (obj->_seqNumb >= 4)) {
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
+ if (obj->_vy > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
- if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ } else if (obj->_vx != obj->_oldvx) {
+ if (obj->_vx > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
}
- if (obj->vx || obj->vy)
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy)
+ obj->_cycling = kCycleForward;
break;
default:
; // Really, nothing
}
// Store boundaries
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2);
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2);
}
}
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving
// Do object movement. Delta_x,y return allowed movement in x,y
// to move as close to a boundary as possible without crossing it.
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
// object coordinates
- int x1 = obj->x + currImage->x1; // Left edge of object
- int x2 = obj->x + currImage->x2; // Right edge
- int y1 = obj->y + currImage->y1; // Top edge
- int y2 = obj->y + currImage->y2; // Bottom edge
+ int x1 = obj->_x + currImage->_x1; // Left edge of object
+ int x2 = obj->_x + currImage->_x2; // Right edge
+ int y1 = obj->_y + currImage->_y1; // Top edge
+ int y2 = obj->_y + currImage->_y2; // Bottom edge
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(x1, x2, y2); // Clear our own boundary
// Allowable motion wrt boundary
- int dx = deltaX(x1, x2, obj->vx, y2);
- if (dx != obj->vx) {
+ int dx = deltaX(x1, x2, obj->_vx, y2);
+ if (dx != obj->_vx) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vx = 0;
+ obj->_vx = 0;
}
- int dy = deltaY(x1, x2, obj->vy, y2);
- if (dy != obj->vy) {
+ int dy = deltaY(x1, x2, obj->_vy, y2);
+ if (dy != obj->_vy) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vy = 0;
+ obj->_vy = 0;
}
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
storeBoundary(x1, x2, y2); // Re-store our own boundary
- obj->x += dx; // Update object position
- obj->y += dy;
+ obj->_x += dx; // Update object position
+ obj->_y += dy;
// Don't let object go outside screen
if (x1 < kEdge)
- obj->x = kEdge2;
+ obj->_x = kEdge2;
if (x2 > (kXPix - kEdge))
- obj->x = kXPix - kEdge2 - (x2 - x1);
+ obj->_x = kXPix - kEdge2 - (x2 - x1);
if (y1 < kEdge)
- obj->y = kEdge2;
+ obj->_y = kEdge2;
if (y2 > (kYPix - kEdge))
- obj->y = kYPix - kEdge2 - (y2 - y1);
+ obj->_y = kYPix - kEdge2 - (y2 - y1);
- if ((obj->vx == 0) && (obj->vy == 0) && (obj->pathType != kPathWander2) && (obj->pathType != kPathChase2))
- obj->cycling = kCycleNotCycling;
+ if ((obj->_vx == 0) && (obj->_vy == 0) && (obj->_pathType != kPathWander2) && (obj->_pathType != kPathChase2))
+ obj->_cycling = kCycleNotCycling;
}
}
// Clear all object baselines from the boundary file.
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2);
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}
// If maze mode is enabled, do special maze processing
- if (_vm->_maze.enabledFl) {
- seq_t *currImage = _vm->_hero->currImagePtr; // Get ptr to current image
+ if (_vm->_maze._enabledFl) {
+ Seq *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image
// hero coordinates
- int x1 = _vm->_hero->x + currImage->x1; // Left edge of object
- int x2 = _vm->_hero->x + currImage->x2; // Right edge
- int y1 = _vm->_hero->y + currImage->y1; // Top edge
- int y2 = _vm->_hero->y + currImage->y2; // Bottom edge
+ int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object
+ int x2 = _vm->_hero->_x + currImage->_x2; // Right edge
+ int y1 = _vm->_hero->_y + currImage->_y1; // Top edge
+ int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge
_vm->_scheduler->processMaze(x1, x2, y1, y2);
}
@@ -364,18 +364,18 @@ void ObjectHandler_v1w::swapImages(int objIndex1, int objIndex2) {
saveSeq(&_objects[objIndex1]);
- seqList_t tmpSeqList[kMaxSeqNumb];
- int seqListSize = sizeof(seqList_t) * kMaxSeqNumb;
+ SeqList tmpSeqList[kMaxSeqNumb];
+ int seqListSize = sizeof(SeqList) * kMaxSeqNumb;
- memmove(tmpSeqList, _objects[objIndex1].seqList, seqListSize);
- memmove(_objects[objIndex1].seqList, _objects[objIndex2].seqList, seqListSize);
- memmove(_objects[objIndex2].seqList, tmpSeqList, seqListSize);
+ memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize);
+ memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize);
+ memmove(_objects[objIndex2]._seqList, tmpSeqList, seqListSize);
restoreSeq(&_objects[objIndex1]);
- _objects[objIndex2].currImagePtr = _objects[objIndex2].seqList[0].seqPtr;
+ _objects[objIndex2]._currImagePtr = _objects[objIndex2]._seqList[0]._seqPtr;
_vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex;
// Make sure baseline stays constant
- _objects[objIndex1].y += _objects[objIndex2].currImagePtr->y2 - _objects[objIndex1].currImagePtr->y2;
+ _objects[objIndex1]._y += _objects[objIndex2]._currImagePtr->_y2 - _objects[objIndex1]._currImagePtr->_y2;
}
} // End of namespace Hugo
diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp
index 4a22fab2c0..7cb6c20dd0 100644
--- a/engines/hugo/object_v2d.cpp
+++ b/engines/hugo/object_v2d.cpp
@@ -59,43 +59,43 @@ void ObjectHandler_v2d::updateImages() {
debugC(5, kDebugObject, "updateImages");
// Initialize the index array to visible objects in current screen
- int num_objs = 0;
+ int objNumb = 0;
byte objindex[kMaxObjNumb]; // Array of indeces to objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i];
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= kCycleAlmostInvisible))
- objindex[num_objs++] = i;
+ Object *obj = &_objects[i];
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible))
+ objindex[objNumb++] = i;
}
// Sort the objects into increasing y+y2 (painter's algorithm)
- qsort(objindex, num_objs, sizeof(objindex[0]), y2comp);
+ qsort(objindex, objNumb, sizeof(objindex[0]), y2comp);
// Add each visible object to display list
- for (int i = 0; i < num_objs; i++) {
- object_t *obj = &_objects[objindex[i]];
+ for (int i = 0; i < objNumb; i++) {
+ Object *obj = &_objects[objindex[i]];
// Count down inter-frame timer
- if (obj->frameTimer)
- obj->frameTimer--;
+ if (obj->_frameTimer)
+ obj->_frameTimer--;
- if (obj->cycling > kCycleAlmostInvisible) { // Only if visible
- switch (obj->cycling) {
+ if (obj->_cycling > kCycleAlmostInvisible) { // Only if visible
+ switch (obj->_cycling) {
case kCycleNotCycling:
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay);
break;
case kCycleForward:
- if (obj->frameTimer) // Not time to see next frame yet
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay);
+ if (obj->_frameTimer) // Not time to see next frame yet
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay);
else
- _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr->nextSeqPtr, obj->priority == kPriorityOverOverlay);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, obj->_priority == kPriorityOverOverlay);
break;
case kCycleBackward: {
- seq_t *seqPtr = obj->currImagePtr;
- if (!obj->frameTimer) { // Show next frame
- while (seqPtr->nextSeqPtr != obj->currImagePtr)
- seqPtr = seqPtr->nextSeqPtr;
+ Seq *seqPtr = obj->_currImagePtr;
+ if (!obj->_frameTimer) { // Show next frame
+ while (seqPtr->_nextSeqPtr != obj->_currImagePtr)
+ seqPtr = seqPtr->_nextSeqPtr;
}
- _vm->_screen->displayFrame(obj->x, obj->y, seqPtr, obj->priority == kPriorityOverOverlay);
+ _vm->_screen->displayFrame(obj->_x, obj->_y, seqPtr, obj->_priority == kPriorityOverOverlay);
break;
}
default:
@@ -107,30 +107,30 @@ void ObjectHandler_v2d::updateImages() {
_vm->_scheduler->waitForRefresh();
// Cycle any animating objects
- for (int i = 0; i < num_objs; i++) {
- object_t *obj = &_objects[objindex[i]];
- if (obj->cycling != kCycleInvisible) {
+ for (int i = 0; i < objNumb; i++) {
+ Object *obj = &_objects[objindex[i]];
+ if (obj->_cycling != kCycleInvisible) {
// Only if it's visible
- if (obj->cycling == kCycleAlmostInvisible)
- obj->cycling = kCycleInvisible;
+ if (obj->_cycling == kCycleAlmostInvisible)
+ obj->_cycling = kCycleInvisible;
// Now Rotate to next picture in sequence
- switch (obj->cycling) {
+ switch (obj->_cycling) {
case kCycleNotCycling:
break;
case kCycleForward:
- if (!obj->frameTimer) {
+ if (!obj->_frameTimer) {
// Time to step to next frame
- obj->currImagePtr = obj->currImagePtr->nextSeqPtr;
+ obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr;
// Find out if this is last frame of sequence
// If so, reset frame_timer and decrement n_cycle
- if (obj->frameInterval || obj->cycleNumb) {
- obj->frameTimer = obj->frameInterval;
- for (int j = 0; j < obj->seqNumb; j++) {
- if (obj->currImagePtr->nextSeqPtr == obj->seqList[j].seqPtr) {
- if (obj->cycleNumb) { // Decr cycleNumb if Non-continous
- if (!--obj->cycleNumb)
- obj->cycling = kCycleNotCycling;
+ if (obj->_frameInterval || obj->_cycleNumb) {
+ obj->_frameTimer = obj->_frameInterval;
+ for (int j = 0; j < obj->_seqNumb; j++) {
+ if (obj->_currImagePtr->_nextSeqPtr == obj->_seqList[j]._seqPtr) {
+ if (obj->_cycleNumb) { // Decr cycleNumb if Non-continous
+ if (!--obj->_cycleNumb)
+ obj->_cycling = kCycleNotCycling;
}
}
}
@@ -138,20 +138,20 @@ void ObjectHandler_v2d::updateImages() {
}
break;
case kCycleBackward: {
- if (!obj->frameTimer) {
+ if (!obj->_frameTimer) {
// Time to step to prev frame
- seq_t *seqPtr = obj->currImagePtr;
- while (obj->currImagePtr->nextSeqPtr != seqPtr)
- obj->currImagePtr = obj->currImagePtr->nextSeqPtr;
+ Seq *seqPtr = obj->_currImagePtr;
+ while (obj->_currImagePtr->_nextSeqPtr != seqPtr)
+ obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr;
// Find out if this is first frame of sequence
// If so, reset frame_timer and decrement n_cycle
- if (obj->frameInterval || obj->cycleNumb) {
- obj->frameTimer = obj->frameInterval;
- for (int j = 0; j < obj->seqNumb; j++) {
- if (obj->currImagePtr == obj->seqList[j].seqPtr) {
- if (obj->cycleNumb){ // Decr cycleNumb if Non-continous
- if (!--obj->cycleNumb)
- obj->cycling = kCycleNotCycling;
+ if (obj->_frameInterval || obj->_cycleNumb) {
+ obj->_frameTimer = obj->_frameInterval;
+ for (int j = 0; j < obj->_seqNumb; j++) {
+ if (obj->_currImagePtr == obj->_seqList[j]._seqPtr) {
+ if (obj->_cycleNumb){ // Decr cycleNumb if Non-continous
+ if (!--obj->_cycleNumb)
+ obj->_cycling = kCycleNotCycling;
}
}
}
@@ -162,8 +162,8 @@ void ObjectHandler_v2d::updateImages() {
default:
break;
}
- obj->oldx = obj->x;
- obj->oldy = obj->y;
+ obj->_oldx = obj->_x;
+ obj->_oldy = obj->_y;
}
}
}
@@ -183,175 +183,175 @@ void ObjectHandler_v2d::moveObjects() {
// and store all (visible) object baselines into the boundary file.
// Don't store foreground or background objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if (obj->screenIndex == *_vm->_screen_p) {
- switch (obj->pathType) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if (obj->_screenIndex == *_vm->_screenPtr) {
+ switch (obj->_pathType) {
case kPathChase:
case kPathChase2: {
- int8 radius = obj->radius; // Default to object's radius
+ int8 radius = obj->_radius; // Default to object's radius
if (radius < 0) // If radius infinity, use closer value
radius = kStepDx;
// Allowable motion wrt boundary
- int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1;
- int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1;
+ int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1;
+ int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1;
if (abs(dx) <= radius)
- obj->vx = 0;
+ obj->_vx = 0;
else
- obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath);
+ obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath);
if (abs(dy) <= radius)
- obj->vy = 0;
+ obj->_vy = 0;
else
- obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath);
+ obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath);
// Set first image in sequence (if multi-seq object)
- switch (obj->seqNumb) {
+ switch (obj->_seqNumb) {
case 4:
- if (!obj->vx) { // Got 4 directions
- if (obj->vx != obj->oldvx) { // vx just stopped
+ if (!obj->_vx) { // Got 4 directions
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
if (dy > 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
+ } else if (obj->_vx != obj->_oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
break;
case 3:
case 2:
- if (obj->vx != obj->oldvx) { // vx just stopped
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
if (dx > 0) // Left & right only
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
break;
}
- if (obj->vx || obj->vy) {
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy) {
+ obj->_cycling = kCycleForward;
} else {
- obj->cycling = kCycleNotCycling;
+ obj->_cycling = kCycleNotCycling;
boundaryCollision(obj); // Must have got hero!
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
break;
}
case kPathWander2:
case kPathWander:
if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval
- obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath;
- obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath;
+ obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath;
+ obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath;
// Set first image in sequence (if multi-seq object)
- if (obj->seqNumb > 1) {
- if (!obj->vx && (obj->seqNumb >= 4)) {
- if (obj->vx != obj->oldvx) { // vx just stopped
- if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ if (obj->_seqNumb > 1) {
+ if (!obj->_vx && (obj->_seqNumb >= 4)) {
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
+ if (obj->_vy > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
- if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ } else if (obj->_vx != obj->_oldvx) {
+ if (obj->_vx > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
}
- if (obj->vx || obj->vy)
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy)
+ obj->_cycling = kCycleForward;
break;
default:
; // Really, nothing
}
// Store boundaries
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2);
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2);
}
}
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving
// Do object movement. Delta_x,y return allowed movement in x,y
// to move as close to a boundary as possible without crossing it.
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
// object coordinates
- int x1 = obj->x + currImage->x1; // Left edge of object
- int x2 = obj->x + currImage->x2; // Right edge
- int y1 = obj->y + currImage->y1; // Top edge
- int y2 = obj->y + currImage->y2; // Bottom edge
+ int x1 = obj->_x + currImage->_x1; // Left edge of object
+ int x2 = obj->_x + currImage->_x2; // Right edge
+ int y1 = obj->_y + currImage->_y1; // Top edge
+ int y2 = obj->_y + currImage->_y2; // Bottom edge
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(x1, x2, y2); // Clear our own boundary
// Allowable motion wrt boundary
- int dx = deltaX(x1, x2, obj->vx, y2);
- if (dx != obj->vx) {
+ int dx = deltaX(x1, x2, obj->_vx, y2);
+ if (dx != obj->_vx) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vx = 0;
+ obj->_vx = 0;
}
- int dy = deltaY(x1, x2, obj->vy, y2);
- if (dy != obj->vy) {
+ int dy = deltaY(x1, x2, obj->_vy, y2);
+ if (dy != obj->_vy) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vy = 0;
+ obj->_vy = 0;
}
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
storeBoundary(x1, x2, y2); // Re-store our own boundary
- obj->x += dx; // Update object position
- obj->y += dy;
+ obj->_x += dx; // Update object position
+ obj->_y += dy;
// Don't let object go outside screen
if (x1 < kEdge)
- obj->x = kEdge2;
+ obj->_x = kEdge2;
if (x2 > (kXPix - kEdge))
- obj->x = kXPix - kEdge2 - (x2 - x1);
+ obj->_x = kXPix - kEdge2 - (x2 - x1);
if (y1 < kEdge)
- obj->y = kEdge2;
+ obj->_y = kEdge2;
if (y2 > (kYPix - kEdge))
- obj->y = kYPix - kEdge2 - (y2 - y1);
+ obj->_y = kYPix - kEdge2 - (y2 - y1);
- if ((obj->vx == 0) && (obj->vy == 0) && (obj->pathType != kPathWander2) && (obj->pathType != kPathChase2))
- obj->cycling = kCycleNotCycling;
+ if ((obj->_vx == 0) && (obj->_vy == 0) && (obj->_pathType != kPathWander2) && (obj->_pathType != kPathChase2))
+ obj->_cycling = kCycleNotCycling;
}
}
// Clear all object baselines from the boundary file.
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2);
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}
// If maze mode is enabled, do special maze processing
- if (_vm->_maze.enabledFl) {
- seq_t *currImage = _vm->_hero->currImagePtr; // Get ptr to current image
+ if (_vm->_maze._enabledFl) {
+ Seq *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image
// hero coordinates
- int x1 = _vm->_hero->x + currImage->x1; // Left edge of object
- int x2 = _vm->_hero->x + currImage->x2; // Right edge
- int y1 = _vm->_hero->y + currImage->y1; // Top edge
- int y2 = _vm->_hero->y + currImage->y2; // Bottom edge
+ int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object
+ int x2 = _vm->_hero->_x + currImage->_x2; // Right edge
+ int y1 = _vm->_hero->_y + currImage->_y1; // Top edge
+ int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge
_vm->_scheduler->processMaze(x1, x2, y1, y2);
}
@@ -359,11 +359,11 @@ void ObjectHandler_v2d::moveObjects() {
void ObjectHandler_v2d::homeIn(const int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy) {
// object obj1 will home in on object obj2
- object_t *obj1 = &_objects[objIndex1];
- object_t *obj2 = &_objects[objIndex2];
- obj1->pathType = kPathAuto;
- int dx = obj1->x + obj1->currImagePtr->x1 - obj2->x - obj2->currImagePtr->x1;
- int dy = obj1->y + obj1->currImagePtr->y1 - obj2->y - obj2->currImagePtr->y1;
+ Object *obj1 = &_objects[objIndex1];
+ Object *obj2 = &_objects[objIndex2];
+ obj1->_pathType = kPathAuto;
+ int dx = obj1->_x + obj1->_currImagePtr->_x1 - obj2->_x - obj2->_currImagePtr->_x1;
+ int dy = obj1->_y + obj1->_currImagePtr->_y1 - obj2->_y - obj2->_currImagePtr->_y1;
if (dx == 0) // Don't EVER divide by zero!
dx = 1;
@@ -371,11 +371,11 @@ void ObjectHandler_v2d::homeIn(const int objIndex1, const int objIndex2, const i
dy = 1;
if (abs(dx) > abs(dy)) {
- obj1->vx = objDx * -sign<int8>(dx);
- obj1->vy = abs((objDy * dy) / dx) * -sign<int8>(dy);
+ obj1->_vx = objDx * -sign<int8>(dx);
+ obj1->_vy = abs((objDy * dy) / dx) * -sign<int8>(dy);
} else {
- obj1->vy = objDy * -sign<int8>(dy);
- obj1->vx = abs((objDx * dx) / dy) * -sign<int8>(dx);
+ obj1->_vy = objDy * -sign<int8>(dy);
+ obj1->_vx = abs((objDx * dx) / dy) * -sign<int8>(dx);
}
}
} // End of namespace Hugo
diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp
index cde7f5fd62..7bb4b95b4a 100644
--- a/engines/hugo/object_v3d.cpp
+++ b/engines/hugo/object_v3d.cpp
@@ -64,176 +64,176 @@ void ObjectHandler_v3d::moveObjects() {
// and store all (visible) object baselines into the boundary file.
// Don't store foreground or background objects
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if (obj->screenIndex == *_vm->_screen_p) {
- switch (obj->pathType) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if (obj->_screenIndex == *_vm->_screenPtr) {
+ switch (obj->_pathType) {
case kPathChase:
case kPathChase2: {
- int8 radius = obj->radius; // Default to object's radius
+ int8 radius = obj->_radius; // Default to object's radius
if (radius < 0) // If radius infinity, use closer value
radius = kStepDx;
// Allowable motion wrt boundary
- int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1;
- int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1;
+ int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1;
+ int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1;
if (abs(dx) <= radius)
- obj->vx = 0;
+ obj->_vx = 0;
else
- obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath);
+ obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath);
if (abs(dy) <= radius)
- obj->vy = 0;
+ obj->_vy = 0;
else
- obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath);
+ obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath);
// Set first image in sequence (if multi-seq object)
- switch (obj->seqNumb) {
+ switch (obj->_seqNumb) {
case 4:
- if (!obj->vx) { // Got 4 directions
- if (obj->vx != obj->oldvx) { // vx just stopped
+ if (!obj->_vx) { // Got 4 directions
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
if (dy >= 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
+ } else if (obj->_vx != obj->_oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
break;
case 3:
case 2:
- if (obj->vx != obj->oldvx) { // vx just stopped
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
if (dx > 0) // Left & right only
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
break;
}
- if (obj->vx || obj->vy) {
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy) {
+ obj->_cycling = kCycleForward;
} else {
- obj->cycling = kCycleNotCycling;
+ obj->_cycling = kCycleNotCycling;
boundaryCollision(obj); // Must have got hero!
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
break;
}
case kPathWander2:
case kPathWander:
if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval
- obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath;
- obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath;
+ obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath;
+ obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath;
// Set first image in sequence (if multi-seq object)
- if (obj->seqNumb > 1) {
- if (!obj->vx && (obj->seqNumb >= 4)) {
- if (obj->vx != obj->oldvx) { // vx just stopped
- if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ if (obj->_seqNumb > 1) {
+ if (!obj->_vx && (obj->_seqNumb >= 4)) {
+ if (obj->_vx != obj->_oldvx) { // vx just stopped
+ if (obj->_vy > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
}
- } else if (obj->vx != obj->oldvx) {
- if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ } else if (obj->_vx != obj->_oldvx) {
+ if (obj->_vx > 0)
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
else
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
}
}
- obj->oldvx = obj->vx;
- obj->oldvy = obj->vy;
- currImage = obj->currImagePtr; // Get (new) ptr to current image
+ obj->_oldvx = obj->_vx;
+ obj->_oldvy = obj->_vy;
+ currImage = obj->_currImagePtr; // Get (new) ptr to current image
}
- if (obj->vx || obj->vy)
- obj->cycling = kCycleForward;
+ if (obj->_vx || obj->_vy)
+ obj->_cycling = kCycleForward;
break;
default:
; // Really, nothing
}
// Store boundaries
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2);
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2);
}
}
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) {
+ Object *obj = &_objects[i]; // Get pointer to object
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving
// Do object movement. Delta_x,y return allowed movement in x,y
// to move as close to a boundary as possible without crossing it.
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
// object coordinates
- int x1 = obj->x + currImage->x1; // Left edge of object
- int x2 = obj->x + currImage->x2; // Right edge
- int y1 = obj->y + currImage->y1; // Top edge
- int y2 = obj->y + currImage->y2; // Bottom edge
+ int x1 = obj->_x + currImage->_x1; // Left edge of object
+ int x2 = obj->_x + currImage->_x2; // Right edge
+ int y1 = obj->_y + currImage->_y1; // Top edge
+ int y2 = obj->_y + currImage->_y2; // Bottom edge
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(x1, x2, y2); // Clear our own boundary
// Allowable motion wrt boundary
- int dx = deltaX(x1, x2, obj->vx, y2);
- if (dx != obj->vx) {
+ int dx = deltaX(x1, x2, obj->_vx, y2);
+ if (dx != obj->_vx) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vx = 0;
+ obj->_vx = 0;
}
- int dy = deltaY(x1, x2, obj->vy, y2);
- if (dy != obj->vy) {
+ int dy = deltaY(x1, x2, obj->_vy, y2);
+ if (dy != obj->_vy) {
// An object boundary collision!
boundaryCollision(obj);
- obj->vy = 0;
+ obj->_vy = 0;
}
- if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
+ if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
storeBoundary(x1, x2, y2); // Re-store our own boundary
- obj->x += dx; // Update object position
- obj->y += dy;
+ obj->_x += dx; // Update object position
+ obj->_y += dy;
// Don't let object go outside screen
if (x1 < kEdge)
- obj->x = kEdge2;
+ obj->_x = kEdge2;
if (x2 > (kXPix - kEdge))
- obj->x = kXPix - kEdge2 - (x2 - x1);
+ obj->_x = kXPix - kEdge2 - (x2 - x1);
if (y1 < kEdge)
- obj->y = kEdge2;
+ obj->_y = kEdge2;
if (y2 > (kYPix - kEdge))
- obj->y = kYPix - kEdge2 - (y2 - y1);
+ obj->_y = kYPix - kEdge2 - (y2 - y1);
- if ((obj->vx == 0) && (obj->vy == 0) && (obj->pathType != kPathWander2) && (obj->pathType != kPathChase2))
- obj->cycling = kCycleNotCycling;
+ if ((obj->_vx == 0) && (obj->_vy == 0) && (obj->_pathType != kPathWander2) && (obj->_pathType != kPathChase2))
+ obj->_cycling = kCycleNotCycling;
}
}
// Clear all object baselines from the boundary file.
for (int i = 0; i < _numObj; i++) {
- object_t *obj = &_objects[i]; // Get pointer to object
- seq_t *currImage = obj->currImagePtr; // Get ptr to current image
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating))
- clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2);
+ Object *obj = &_objects[i]; // Get pointer to object
+ Seq *currImage = obj->_currImagePtr; // Get ptr to current image
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
+ clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}
// If maze mode is enabled, do special maze processing
- if (_vm->_maze.enabledFl) {
- seq_t *currImage = _vm->_hero->currImagePtr;// Get ptr to current image
+ if (_vm->_maze._enabledFl) {
+ Seq *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image
// hero coordinates
- int x1 = _vm->_hero->x + currImage->x1; // Left edge of object
- int x2 = _vm->_hero->x + currImage->x2; // Right edge
- int y1 = _vm->_hero->y + currImage->y1; // Top edge
- int y2 = _vm->_hero->y + currImage->y2; // Bottom edge
+ int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object
+ int x2 = _vm->_hero->_x + currImage->_x2; // Right edge
+ int y1 = _vm->_hero->_y + currImage->_y1; // Top edge
+ int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge
_vm->_scheduler->processMaze(x1, x2, y1, y2);
}
@@ -249,18 +249,18 @@ void ObjectHandler_v3d::swapImages(int objIndex1, int objIndex2) {
saveSeq(&_objects[objIndex1]);
- seqList_t tmpSeqList[kMaxSeqNumb];
- int seqListSize = sizeof(seqList_t) * kMaxSeqNumb;
+ SeqList tmpSeqList[kMaxSeqNumb];
+ int seqListSize = sizeof(SeqList) * kMaxSeqNumb;
- memmove(tmpSeqList, _objects[objIndex1].seqList, seqListSize);
- memmove(_objects[objIndex1].seqList, _objects[objIndex2].seqList, seqListSize);
- memmove(_objects[objIndex2].seqList, tmpSeqList, seqListSize);
+ memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize);
+ memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize);
+ memmove(_objects[objIndex2]._seqList, tmpSeqList, seqListSize);
restoreSeq(&_objects[objIndex1]);
- _objects[objIndex2].currImagePtr = _objects[objIndex2].seqList[0].seqPtr;
+ _objects[objIndex2]._currImagePtr = _objects[objIndex2]._seqList[0]._seqPtr;
_vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex;
// Make sure baseline stays constant
- _objects[objIndex1].y += _objects[objIndex2].currImagePtr->y2 - _objects[objIndex1].currImagePtr->y2;
+ _objects[objIndex1]._y += _objects[objIndex2]._currImagePtr->_y2 - _objects[objIndex1]._currImagePtr->_y2;
}
} // End of namespace Hugo
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index 4eaed6fecf..5fdb2026a7 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -58,21 +58,21 @@ Parser::~Parser() {
}
uint16 Parser::getCmdDefaultVerbIdx(const uint16 index) const {
- return _cmdList[index][0].verbIndex;
+ return _cmdList[index][0]._verbIndex;
}
/**
* Read a cmd structure from Hugo.dat
*/
void Parser::readCmd(Common::ReadStream &in, cmd &curCmd) {
- curCmd.verbIndex = in.readUint16BE();
- curCmd.reqIndex = in.readUint16BE();
- curCmd.textDataNoCarryIndex = in.readUint16BE();
- curCmd.reqState = in.readByte();
- curCmd.newState = in.readByte();
- curCmd.textDataWrongIndex = in.readUint16BE();
- curCmd.textDataDoneIndex = in.readUint16BE();
- curCmd.actIndex = in.readUint16BE();
+ curCmd._verbIndex = in.readUint16BE();
+ curCmd._reqIndex = in.readUint16BE();
+ curCmd._textDataNoCarryIndex = in.readUint16BE();
+ curCmd._reqState = in.readByte();
+ curCmd._newState = in.readByte();
+ curCmd._textDataWrongIndex = in.readUint16BE();
+ curCmd._textDataDoneIndex = in.readUint16BE();
+ curCmd._actIndex = in.readUint16BE();
}
/**
@@ -99,20 +99,20 @@ void Parser::loadCmdList(Common::ReadStream &in) {
}
-void Parser::readBG(Common::ReadStream &in, background_t &curBG) {
- curBG.verbIndex = in.readUint16BE();
- curBG.nounIndex = in.readUint16BE();
- curBG.commentIndex = in.readSint16BE();
- curBG.matchFl = (in.readByte() != 0);
- curBG.roomState = in.readByte();
- curBG.bonusIndex = in.readByte();
+void Parser::readBG(Common::ReadStream &in, Background &curBG) {
+ curBG._verbIndex = in.readUint16BE();
+ curBG._nounIndex = in.readUint16BE();
+ curBG._commentIndex = in.readSint16BE();
+ curBG._matchFl = (in.readByte() != 0);
+ curBG._roomState = in.readByte();
+ curBG._bonusIndex = in.readByte();
}
/**
* Read _backgrounObjects from Hugo.dat
*/
void Parser::loadBackgroundObjects(Common::ReadStream &in) {
- background_t tmpBG;
+ Background tmpBG;
memset(&tmpBG, 0, sizeof(tmpBG));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
@@ -120,13 +120,13 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) {
if (varnt == _vm->_gameVariant) {
_backgroundObjectsSize = numElem;
- _backgroundObjects = (background_t **)malloc(sizeof(background_t *) * numElem);
+ _backgroundObjects = (Background **)malloc(sizeof(Background *) * numElem);
}
for (int i = 0; i < numElem; i++) {
uint16 numSubElem = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _backgroundObjects[i] = (background_t *)malloc(sizeof(background_t) * numSubElem);
+ _backgroundObjects[i] = (Background *)malloc(sizeof(Background) * numSubElem);
for (int j = 0; j < numSubElem; j++)
readBG(in, (varnt == _vm->_gameVariant) ? _backgroundObjects[i][j] : tmpBG);
@@ -138,15 +138,15 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) {
* Read _catchallList from Hugo.dat
*/
void Parser::loadCatchallList(Common::ReadStream &in) {
- background_t *wrkCatchallList = 0;
- background_t tmpBG;
+ Background *wrkCatchallList = 0;
+ Background tmpBG;
memset(&tmpBG, 0, sizeof(tmpBG));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _catchallList = wrkCatchallList = (background_t *)malloc(sizeof(background_t) * numElem);
+ _catchallList = wrkCatchallList = (Background *)malloc(sizeof(Background) * numElem);
for (int i = 0; i < numElem; i++)
readBG(in, (varnt == _vm->_gameVariant) ? wrkCatchallList[i] : tmpBG);
@@ -164,12 +164,12 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) {
const char *Parser::useBG(const char *name) {
debugC(1, kDebugEngine, "useBG(%s)", name);
- objectList_t p = _backgroundObjects[*_vm->_screen_p];
- for (int i = 0; p[i].verbIndex != 0; i++) {
- if ((name == _vm->_text->getNoun(p[i].nounIndex, 0) &&
- p[i].verbIndex != _vm->_look) &&
- ((p[i].roomState == kStateDontCare) || (p[i].roomState == _vm->_screenStates[*_vm->_screen_p])))
- return _vm->_text->getVerb(p[i].verbIndex, 0);
+ ObjectList p = _backgroundObjects[*_vm->_screenPtr];
+ for (int i = 0; p[i]._verbIndex != 0; i++) {
+ if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) &&
+ p[i]._verbIndex != _vm->_look) &&
+ ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screenPtr])))
+ return _vm->_text->getVerb(p[i]._verbIndex, 0);
}
return 0;
@@ -198,7 +198,7 @@ void Parser::freeParser() {
}
void Parser::switchTurbo() {
- _vm->_config.turboFl = !_vm->_config.turboFl;
+ _vm->_config._turboFl = !_vm->_config._turboFl;
}
/**
@@ -208,7 +208,7 @@ void Parser::switchTurbo() {
void Parser::charHandler() {
debugC(4, kDebugParser, "charHandler");
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
// Check for one or more characters in ring buffer
while (_getIndex != _putIndex) {
@@ -222,7 +222,7 @@ void Parser::charHandler() {
_cmdLine[--_cmdLineIndex] = '\0';
break;
case Common::KEYCODE_RETURN: // EOL, pass line to line handler
- if (_cmdLineIndex && (_vm->_hero->pathType != kPathQuiet)) {
+ if (_cmdLineIndex && (_vm->_hero->_pathType != kPathQuiet)) {
// Remove inventory bar if active
if (_vm->_inventory->getInventoryState() == kInventoryActive)
_vm->_inventory->setInventoryState(kInventoryUp);
@@ -248,27 +248,27 @@ void Parser::charHandler() {
_cmdLineCursor = (_cmdLineCursor == '_') ? ' ' : '_';
// See if recall button pressed
- if (gameStatus.recallFl) {
+ if (gameStatus._recallFl) {
// Copy previous line to current cmdline
- gameStatus.recallFl = false;
+ gameStatus._recallFl = false;
strcpy(_cmdLine, _vm->_line);
_cmdLineIndex = strlen(_cmdLine);
}
sprintf(_vm->_statusLine, ">%s%c", _cmdLine, _cmdLineCursor);
- sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config.turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config.soundFl) ? "On" : "Off");
+ sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config._turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config._soundFl) ? "On" : "Off");
// See if "look" button pressed
- if (gameStatus.lookFl) {
+ if (gameStatus._lookFl) {
command("look around");
- gameStatus.lookFl = false;
+ gameStatus._lookFl = false;
}
}
void Parser::keyHandler(Common::Event event) {
debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode);
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
uint16 nChar = event.kbd.keycode;
if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_SCRL))
@@ -288,8 +288,8 @@ void Parser::keyHandler(Common::Event event) {
_vm->_file->restoreGame(0);
break;
case Common::KEYCODE_s:
- if (gameStatus.viewState == kViewPlay) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._viewState == kViewPlay) {
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -304,8 +304,8 @@ void Parser::keyHandler(Common::Event event) {
// Process key down event - called from OnKeyDown()
switch (nChar) { // Set various toggle states
case Common::KEYCODE_ESCAPE: // Escape key, may want to QUIT
- if (gameStatus.viewState == kViewIntro)
- gameStatus.skipIntroFl = true;
+ if (gameStatus._viewState == kViewIntro)
+ gameStatus._skipIntroFl = true;
else {
if (_vm->_inventory->getInventoryState() == kInventoryActive) // Remove inventory, if displayed
_vm->_inventory->setInventoryState(kInventoryUp);
@@ -333,7 +333,7 @@ void Parser::keyHandler(Common::Event event) {
break;
case Common::KEYCODE_F1: // User Help (DOS)
if (_checkDoubleF1Fl)
- gameStatus.helpFl = true;
+ gameStatus._helpFl = true;
else
_vm->_screen->userHelp();
_checkDoubleF1Fl = !_checkDoubleF1Fl;
@@ -343,11 +343,11 @@ void Parser::keyHandler(Common::Event event) {
_vm->_sound->toggleMusic();
break;
case Common::KEYCODE_F3: // Repeat last line
- gameStatus.recallFl = true;
+ gameStatus._recallFl = true;
break;
case Common::KEYCODE_F4: // Save game
- if (gameStatus.viewState == kViewPlay) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._viewState == kViewPlay) {
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -362,11 +362,8 @@ void Parser::keyHandler(Common::Event event) {
case Common::KEYCODE_F8: // Turbo mode
switchTurbo();
break;
- case Common::KEYCODE_F9: // Boss button
- warning("STUB: F9 (DOS) - BossKey");
- break;
default: // Any other key
- if (!gameStatus.storyModeFl) { // Keyboard disabled
+ if (!gameStatus._storyModeFl) { // Keyboard disabled
// Add printable keys to ring buffer
uint16 bnext = _putIndex + 1;
if (bnext >= sizeof(_ringBuffer))
@@ -452,7 +449,7 @@ void Parser::showDosInventory() const {
for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns
if (_vm->_object->isCarried(i)) {
- uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2));
+ uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2));
if (index++ & 1) // Right hand column
len2 = (len > len2) ? len : len2;
else
@@ -473,9 +470,9 @@ void Parser::showDosInventory() const {
for (int i = 0; i < _vm->_object->_numObj; i++) { // Assign strings
if (_vm->_object->isCarried(i)) {
if (index++ & 1)
- buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + "\n";
+ buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + "\n";
else
- buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)));
+ buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)));
}
}
if (index & 1)
diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h
index f8b9d9f13b..e72c46f591 100644
--- a/engines/hugo/parser.h
+++ b/engines/hugo/parser.h
@@ -48,14 +48,14 @@ enum seqTextParser {
* The following determines how a verb is acted on, for an object
*/
struct cmd {
- uint16 verbIndex; // the verb
- uint16 reqIndex; // ptr to list of required objects
- uint16 textDataNoCarryIndex; // ptr to string if any of above not carried
- byte reqState; // required state for verb to be done
- byte newState; // new states if verb done
- uint16 textDataWrongIndex; // ptr to string if wrong state
- uint16 textDataDoneIndex; // ptr to string if verb done
- uint16 actIndex; // Ptr to action list if verb done
+ uint16 _verbIndex; // the verb
+ uint16 _reqIndex; // ptr to list of required objects
+ uint16 _textDataNoCarryIndex; // ptr to string if any of above not carried
+ byte _reqState; // required state for verb to be done
+ byte _newState; // new states if verb done
+ uint16 _textDataWrongIndex; // ptr to string if wrong state
+ uint16 _textDataDoneIndex; // ptr to string if verb done
+ uint16 _actIndex; // Ptr to action list if verb done
};
/**
@@ -64,16 +64,16 @@ struct cmd {
* interesting ever happens with them. Rather than just be dumb and say
* "don't understand" we produce an interesting msg to keep user sane.
*/
-struct background_t {
- uint16 verbIndex;
- uint16 nounIndex;
- int commentIndex; // Index of comment produced on match
- bool matchFl; // TRUE if noun must match when present
- byte roomState; // "State" of room. Comments might differ.
- byte bonusIndex; // Index of bonus score (0 = no bonus)
+struct Background {
+ uint16 _verbIndex;
+ uint16 _nounIndex;
+ int _commentIndex; // Index of comment produced on match
+ bool _matchFl; // TRUE if noun must match when present
+ byte _roomState; // "State" of room. Comments might differ.
+ byte _bonusIndex; // Index of bonus score (0 = no bonus)
};
-typedef background_t *objectList_t;
+typedef Background *ObjectList;
class Parser {
public:
@@ -97,7 +97,7 @@ public:
virtual void lineHandler() = 0;
virtual void showInventory() const = 0;
- virtual void takeObject(object_t *obj) = 0;
+ virtual void takeObject(Object *obj) = 0;
protected:
HugoEngine *_vm;
@@ -105,18 +105,18 @@ protected:
int16 _cmdLineIndex; // Index into line
uint32 _cmdLineTick; // For flashing cursor
char _cmdLineCursor;
- command_t _cmdLine; // Build command line
+ Command _cmdLine; // Build command line
uint16 _backgroundObjectsSize;
uint16 _cmdListSize;
uint16 **_arrayReqs;
- background_t **_backgroundObjects;
- background_t *_catchallList;
+ Background **_backgroundObjects;
+ Background *_catchallList;
cmd **_cmdList;
const char *findNoun() const;
const char *findVerb() const;
- void readBG(Common::ReadStream &in, background_t &curBG);
+ void readBG(Common::ReadStream &in, Background &curBG);
void readCmd(Common::ReadStream &in, cmd &curCmd);
void showDosInventory() const;
@@ -136,17 +136,17 @@ public:
virtual void lineHandler();
virtual void showInventory() const;
- virtual void takeObject(object_t *obj);
+ virtual void takeObject(Object *obj);
protected:
- virtual void dropObject(object_t *obj);
+ virtual void dropObject(Object *obj);
const char *findNextNoun(const char *noun) const;
- bool isBackgroundWord_v1(const char *noun, const char *verb, objectList_t obj) const;
- bool isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, objectList_t obj) const;
- bool isGenericVerb_v1(const char *word, object_t *obj);
- bool isNear_v1(const char *verb, const char *noun, object_t *obj, char *comment) const;
- bool isObjectVerb_v1(const char *word, object_t *obj);
+ bool isBackgroundWord_v1(const char *noun, const char *verb, ObjectList obj) const;
+ bool isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, ObjectList obj) const;
+ bool isGenericVerb_v1(const char *word, Object *obj);
+ bool isNear_v1(const char *verb, const char *noun, Object *obj, char *comment) const;
+ bool isObjectVerb_v1(const char *word, Object *obj);
};
class Parser_v2d : public Parser_v1d {
@@ -164,13 +164,13 @@ public:
virtual void lineHandler();
protected:
- void dropObject(object_t *obj);
- bool isBackgroundWord_v3(objectList_t obj) const;
- bool isCatchallVerb_v3(objectList_t obj) const;
- bool isGenericVerb_v3(object_t *obj, char *comment);
- bool isNear_v3(object_t *obj, const char *verb, char *comment) const;
- bool isObjectVerb_v3(object_t *obj, char *comment);
- void takeObject(object_t *obj);
+ void dropObject(Object *obj);
+ bool isBackgroundWord_v3(ObjectList obj) const;
+ bool isCatchallVerb_v3(ObjectList obj) const;
+ bool isGenericVerb_v3(Object *obj, char *comment);
+ bool isNear_v3(Object *obj, const char *verb, char *comment) const;
+ bool isObjectVerb_v3(Object *obj, char *comment);
+ void takeObject(Object *obj);
};
class Parser_v1w : public Parser_v3d {
diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp
index ccd428311b..f29b0161f5 100644
--- a/engines/hugo/parser_v1d.cpp
+++ b/engines/hugo/parser_v1d.cpp
@@ -78,35 +78,35 @@ const char *Parser_v1d::findNextNoun(const char *noun) const {
* If object not near, return suitable string; may be similar object closer
* If radius is -1, treat radius as infinity
*/
-bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, char *comment) const {
+bool Parser_v1d::isNear_v1(const char *verb, const char *noun, Object *obj, char *comment) const {
debugC(1, kDebugParser, "isNear(%s, %s, obj, %s)", verb, noun, comment);
- if (!noun && !obj->verbOnlyFl) { // No noun specified & object not context senesitive
+ if (!noun && !obj->_verbOnlyFl) { // No noun specified & object not context senesitive
return false;
- } else if (noun && (noun != _vm->_text->getNoun(obj->nounIndex, 0))) { // Noun specified & not same as object
+ } else if (noun && (noun != _vm->_text->getNoun(obj->_nounIndex, 0))) { // Noun specified & not same as object
return false;
- } else if (obj->carriedFl) { // Object is being carried
+ } else if (obj->_carriedFl) { // Object is being carried
return true;
- } else if (obj->screenIndex != *_vm->_screen_p) { // Not in same screen
- if (obj->objValue)
+ } else if (obj->_screenIndex != *_vm->_screenPtr) { // Not in same screen
+ if (obj->_objValue)
strcpy (comment, _vm->_text->getTextParser(kCmtAny4));
return false;
}
- if (obj->cycling == kCycleInvisible) {
- if (obj->seqNumb) { // There is an image
+ if (obj->_cycling == kCycleInvisible) {
+ if (obj->_seqNumb) { // There is an image
strcpy(comment, _vm->_text->getTextParser(kCmtAny5));
return false;
} else { // No image, assume visible
- if ((obj->radius < 0) ||
- ((abs(obj->x - _vm->_hero->x) <= obj->radius) &&
- (abs(obj->y - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) {
+ if ((obj->_radius < 0) ||
+ ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) &&
+ (abs(obj->_y - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) {
return true;
} else {
// User is either not close enough (stationary, valueless objects)
// or is not carrying it (small, portable objects of value)
if (noun) { // Don't say unless object specified
- if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
+ if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
strcpy(comment, _vm->_text->getTextParser(kCmtAny4));
else
strcpy(comment, _vm->_text->getTextParser(kCmtClose));
@@ -116,15 +116,15 @@ bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, ch
}
}
- if ((obj->radius < 0) ||
- ((abs(obj->x - _vm->_hero->x) <= obj->radius) &&
- (abs(obj->y + obj->currImagePtr->y2 - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) {
+ if ((obj->_radius < 0) ||
+ ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) &&
+ (abs(obj->_y + obj->_currImagePtr->_y2 - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) {
return true;
} else {
// User is either not close enough (stationary, valueless objects)
// or is not carrying it (small, portable objects of value)
if (noun) { // Don't say unless object specified
- if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
+ if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
strcpy(comment, _vm->_text->getTextParser(kCmtAny4));
else
strcpy(comment, _vm->_text->getTextParser(kCmtClose));
@@ -140,31 +140,31 @@ bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, ch
* say_ok needed for special case of take/drop which may be handled not only
* here but also in a cmd_list with a donestr string simultaneously
*/
-bool Parser_v1d::isGenericVerb_v1(const char *word, object_t *obj) {
- debugC(1, kDebugParser, "isGenericVerb(%s, object_t *obj)", word);
+bool Parser_v1d::isGenericVerb_v1(const char *word, Object *obj) {
+ debugC(1, kDebugParser, "isGenericVerb(%s, Object *obj)", word);
- if (!obj->genericCmd)
+ if (!obj->_genericCmd)
return false;
// Following is equivalent to switch, but couldn't do one
if (word == _vm->_text->getVerb(_vm->_look, 0)) {
- if ((LOOK & obj->genericCmd) == LOOK)
- Utils::notifyBox(_vm->_text->getTextData(obj->dataIndex));
+ if ((LOOK & obj->_genericCmd) == LOOK)
+ Utils::notifyBox(_vm->_text->getTextData(obj->_dataIndex));
else
Utils::notifyBox(_vm->_text->getTextParser(kTBUnusual_1d));
} else if (word == _vm->_text->getVerb(_vm->_take, 0)) {
- if (obj->carriedFl)
+ if (obj->_carriedFl)
Utils::notifyBox(_vm->_text->getTextParser(kTBHave));
- else if ((TAKE & obj->genericCmd) == TAKE)
+ else if ((TAKE & obj->_genericCmd) == TAKE)
takeObject(obj);
- else if (!obj->verbOnlyFl) // Make sure not taking object in context!
+ else if (!obj->_verbOnlyFl) // Make sure not taking object in context!
Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse));
else
return false;
} else if (word == _vm->_text->getVerb(_vm->_drop, 0)) {
- if (!obj->carriedFl)
+ if (!obj->_carriedFl)
Utils::notifyBox(_vm->_text->getTextParser(kTBDontHave));
- else if ((DROP & obj->genericCmd) == DROP)
+ else if ((DROP & obj->_genericCmd) == DROP)
dropObject(obj);
else
Utils::notifyBox(_vm->_text->getTextParser(kTBNeed));
@@ -181,46 +181,46 @@ bool Parser_v1d::isGenericVerb_v1(const char *word, object_t *obj) {
* and if it passes, perform the actions in the action list. If the verb
* is catered for, return TRUE
*/
-bool Parser_v1d::isObjectVerb_v1(const char *word, object_t *obj) {
- debugC(1, kDebugParser, "isObjectVerb(%s, object_t *obj)", word);
+bool Parser_v1d::isObjectVerb_v1(const char *word, Object *obj) {
+ debugC(1, kDebugParser, "isObjectVerb(%s, Object *obj)", word);
// First, find matching verb in cmd list
- uint16 cmdIndex = obj->cmdIndex; // ptr to list of commands
+ uint16 cmdIndex = obj->_cmdIndex; // ptr to list of commands
if (!cmdIndex) // No commands for this obj
return false;
int i;
- for (i = 0; _cmdList[cmdIndex][i].verbIndex != 0; i++) { // For each cmd
- if (!strcmp(word, _vm->_text->getVerb(_cmdList[cmdIndex][i].verbIndex, 0))) // Is this verb catered for?
+ for (i = 0; _cmdList[cmdIndex][i]._verbIndex != 0; i++) { // For each cmd
+ if (!strcmp(word, _vm->_text->getVerb(_cmdList[cmdIndex][i]._verbIndex, 0))) // Is this verb catered for?
break;
}
- if (_cmdList[cmdIndex][i].verbIndex == 0) // No
+ if (_cmdList[cmdIndex][i]._verbIndex == 0) // No
return false;
// Verb match found, check all required objects are being carried
cmd *cmnd = &_cmdList[cmdIndex][i]; // ptr to struct cmd
- if (cmnd->reqIndex) { // At least 1 thing in list
- uint16 *reqs = _arrayReqs[cmnd->reqIndex]; // ptr to list of required objects
+ if (cmnd->_reqIndex) { // At least 1 thing in list
+ uint16 *reqs = _arrayReqs[cmnd->_reqIndex]; // ptr to list of required objects
for (i = 0; reqs[i]; i++) { // for each obj
if (!_vm->_object->isCarrying(reqs[i])) {
- Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataNoCarryIndex));
+ Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataNoCarryIndex));
return true;
}
}
}
// Required objects are present, now check state is correct
- if ((obj->state != cmnd->reqState) && (cmnd->reqState != kStateDontCare)){
- Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataWrongIndex));
+ if ((obj->_state != cmnd->_reqState) && (cmnd->_reqState != kStateDontCare)){
+ Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataWrongIndex));
return true;
}
// Everything checked. Change the state and carry out any actions
- if (cmnd->reqState != kStateDontCare) // Don't change new state if required state didn't care
- obj->state = cmnd->newState;
- Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataDoneIndex));
- _vm->_scheduler->insertActionList(cmnd->actIndex);
+ if (cmnd->_reqState != kStateDontCare) // Don't change new state if required state didn't care
+ obj->_state = cmnd->_newState;
+ Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataDoneIndex));
+ _vm->_scheduler->insertActionList(cmnd->_actIndex);
// Special case if verb is Take or Drop. Assume additional generic actions
if ((word == _vm->_text->getVerb(_vm->_take, 0)) || (word == _vm->_text->getVerb(_vm->_drop, 0)))
isGenericVerb_v1(word, obj);
@@ -231,15 +231,15 @@ bool Parser_v1d::isObjectVerb_v1(const char *word, object_t *obj) {
* Print text for possible background object. Return TRUE if match found
* Only match if both verb and noun found. Test_ca will match verb-only
*/
-bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, objectList_t obj) const {
+bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, ObjectList obj) const {
debugC(1, kDebugParser, "isBackgroundWord(%s, %s, object_list_t obj)", noun, verb);
if (!noun)
return false;
- for (int i = 0; obj[i].verbIndex; i++) {
- if ((verb == _vm->_text->getVerb(obj[i].verbIndex, 0)) && (noun == _vm->_text->getNoun(obj[i].nounIndex, 0))) {
- Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
+ for (int i = 0; obj[i]._verbIndex; i++) {
+ if ((verb == _vm->_text->getVerb(obj[i]._verbIndex, 0)) && (noun == _vm->_text->getNoun(obj[i]._nounIndex, 0))) {
+ Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex));
return true;
}
}
@@ -249,31 +249,31 @@ bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, objectL
/**
* Do all things necessary to carry an object
*/
-void Parser_v1d::takeObject(object_t *obj) {
- debugC(1, kDebugParser, "takeObject(object_t *obj)");
+void Parser_v1d::takeObject(Object *obj) {
+ debugC(1, kDebugParser, "takeObject(Object *obj)");
- obj->carriedFl = true;
- if (obj->seqNumb) // Don't change if no image to display
- obj->cycling = kCycleAlmostInvisible;
+ obj->_carriedFl = true;
+ if (obj->_seqNumb) // Don't change if no image to display
+ obj->_cycling = kCycleAlmostInvisible;
- _vm->adjustScore(obj->objValue);
+ _vm->adjustScore(obj->_objValue);
- Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME)));
+ Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->_nounIndex, TAKE_NAME)));
}
/**
* Do all necessary things to drop an object
*/
-void Parser_v1d::dropObject(object_t *obj) {
- debugC(1, kDebugParser, "dropObject(object_t *obj)");
-
- obj->carriedFl = false;
- obj->screenIndex = *_vm->_screen_p;
- if (obj->seqNumb) // Don't change if no image to display
- obj->cycling = kCycleNotCycling;
- obj->x = _vm->_hero->x - 1;
- obj->y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1;
- _vm->adjustScore(-obj->objValue);
+void Parser_v1d::dropObject(Object *obj) {
+ debugC(1, kDebugParser, "dropObject(Object *obj)");
+
+ obj->_carriedFl = false;
+ obj->_screenIndex = *_vm->_screenPtr;
+ if (obj->_seqNumb) // Don't change if no image to display
+ obj->_cycling = kCycleNotCycling;
+ obj->_x = _vm->_hero->_x - 1;
+ obj->_y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1;
+ _vm->adjustScore(-obj->_objValue);
Utils::notifyBox(_vm->_text->getTextParser(kTBOk));
}
@@ -281,18 +281,18 @@ void Parser_v1d::dropObject(object_t *obj) {
* Print text for possible background object. Return TRUE if match found
* If test_noun TRUE, must have a noun given
*/
-bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, objectList_t obj) const {
+bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, ObjectList obj) const {
debugC(1, kDebugParser, "isCatchallVerb(%d, %s, %s, object_list_t obj)", (testNounFl) ? 1 : 0, noun, verb);
- if (_vm->_maze.enabledFl)
+ if (_vm->_maze._enabledFl)
return false;
if (testNounFl && !noun)
return false;
- for (int i = 0; obj[i].verbIndex; i++) {
- if ((verb == _vm->_text->getVerb(obj[i].verbIndex, 0)) && ((noun == _vm->_text->getNoun(obj[i].nounIndex, 0)) || (obj[i].nounIndex == 0))) {
- Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
+ for (int i = 0; obj[i]._verbIndex; i++) {
+ if ((verb == _vm->_text->getVerb(obj[i]._verbIndex, 0)) && ((noun == _vm->_text->getNoun(obj[i]._nounIndex, 0)) || (obj[i]._nounIndex == 0))) {
+ Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex));
return true;
}
}
@@ -305,12 +305,12 @@ bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char
void Parser_v1d::lineHandler() {
debugC(1, kDebugParser, "lineHandler()");
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
// Toggle God Mode
if (!strncmp(_vm->_line, "PPG", 3)) {
_vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh);
- gameStatus.godModeFl = !gameStatus.godModeFl;
+ gameStatus._godModeFl = !gameStatus._godModeFl;
return;
}
@@ -321,7 +321,7 @@ void Parser_v1d::lineHandler() {
// fetch <object name> Hero carries named object
// fetch all Hero carries all possible objects
// find <object name> Takes hero to screen containing named object
- if (gameStatus.godModeFl) {
+ if (gameStatus._godModeFl) {
// Special code to allow me to go straight to any screen
if (strstr(_vm->_line, "goto")) {
for (int i = 0; i < _vm->_numScreens; i++) {
@@ -335,7 +335,7 @@ void Parser_v1d::lineHandler() {
// Special code to allow me to get objects from anywhere
if (strstr(_vm->_line, "fetch all")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (_vm->_object->_objects[i].genericCmd & TAKE)
+ if (_vm->_object->_objects[i]._genericCmd & TAKE)
takeObject(&_vm->_object->_objects[i]);
}
return;
@@ -343,7 +343,7 @@ void Parser_v1d::lineHandler() {
if (strstr(_vm->_line, "fetch")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
+ if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
takeObject(&_vm->_object->_objects[i]);
return;
}
@@ -353,8 +353,8 @@ void Parser_v1d::lineHandler() {
// Special code to allow me to goto objects
if (strstr(_vm->_line, "find")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
- _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex);
+ if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
+ _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex);
return;
}
}
@@ -369,7 +369,7 @@ void Parser_v1d::lineHandler() {
// SAVE/RESTORE
if (!strcmp("save", _vm->_line)) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -387,7 +387,7 @@ void Parser_v1d::lineHandler() {
if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces!
return;
- if (gameStatus.gameOverFl) {
+ if (gameStatus._gameOverFl) {
// No commands allowed!
_vm->gameOverMsg();
return;
@@ -403,14 +403,14 @@ void Parser_v1d::lineHandler() {
noun = findNextNoun(noun); // Find a noun in the line
// Must try at least once for objects allowing verb-context
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i];
+ Object *obj = &_vm->_object->_objects[i];
if (isNear_v1(verb, noun, obj, farComment)) {
if (isObjectVerb_v1(verb, obj) // Foreground object
|| isGenericVerb_v1(verb, obj))// Common action type
return;
}
}
- if ((*farComment == '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screen_p]))
+ if ((*farComment == '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screenPtr]))
return;
} while (noun);
}
@@ -418,15 +418,15 @@ void Parser_v1d::lineHandler() {
if (*farComment != '\0') // An object matched but not near enough
Utils::notifyBox(farComment);
else if (!isCatchallVerb_v1(true, noun, verb, _catchallList) &&
- !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screen_p]) &&
+ !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screenPtr]) &&
!isCatchallVerb_v1(false, noun, verb, _catchallList))
Utils::notifyBox(_vm->_text->getTextParser(kTBEh_1d));
}
void Parser_v1d::showInventory() const {
- status_t &gameStatus = _vm->getGameStatus();
- if (gameStatus.viewState == kViewPlay) {
- if (gameStatus.gameOverFl)
+ Status &gameStatus = _vm->getGameStatus();
+ if (gameStatus._viewState == kViewPlay) {
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
showDosInventory();
diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp
index b1657c3bf4..3722ccc0e1 100644
--- a/engines/hugo/parser_v1w.cpp
+++ b/engines/hugo/parser_v1w.cpp
@@ -56,12 +56,12 @@ Parser_v1w::~Parser_v1w() {
void Parser_v1w::lineHandler() {
debugC(1, kDebugParser, "lineHandler()");
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
// Toggle God Mode
if (!strncmp(_vm->_line, "PPG", 3)) {
_vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh);
- gameStatus.godModeFl = !gameStatus.godModeFl;
+ gameStatus._godModeFl = !gameStatus._godModeFl;
return;
}
@@ -72,7 +72,7 @@ void Parser_v1w::lineHandler() {
// fetch <object name> Hero carries named object
// fetch all Hero carries all possible objects
// find <object name> Takes hero to screen containing named object
- if (gameStatus.godModeFl) {
+ if (gameStatus._godModeFl) {
// Special code to allow me to go straight to any screen
if (strstr(_vm->_line, "goto")) {
for (int i = 0; i < _vm->_numScreens; i++) {
@@ -86,7 +86,7 @@ void Parser_v1w::lineHandler() {
// Special code to allow me to get objects from anywhere
if (strstr(_vm->_line, "fetch all")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (_vm->_object->_objects[i].genericCmd & TAKE)
+ if (_vm->_object->_objects[i]._genericCmd & TAKE)
takeObject(&_vm->_object->_objects[i]);
}
return;
@@ -94,7 +94,7 @@ void Parser_v1w::lineHandler() {
if (strstr(_vm->_line, "fetch")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
+ if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
takeObject(&_vm->_object->_objects[i]);
return;
}
@@ -104,8 +104,8 @@ void Parser_v1w::lineHandler() {
// Special code to allow me to goto objects
if (strstr(_vm->_line, "find")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
- _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex);
+ if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
+ _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex);
return;
}
}
@@ -121,12 +121,12 @@ void Parser_v1w::lineHandler() {
}
// SAVE/RESTORE
- if (!strcmp("save", _vm->_line) && gameStatus.viewState == kViewPlay) {
+ if (!strcmp("save", _vm->_line) && gameStatus._viewState == kViewPlay) {
_vm->_file->saveGame(-1, Common::String());
return;
}
- if (!strcmp("restore", _vm->_line) && (gameStatus.viewState == kViewPlay || gameStatus.viewState == kViewIdle)) {
+ if (!strcmp("restore", _vm->_line) && (gameStatus._viewState == kViewPlay || gameStatus._viewState == kViewIdle)) {
_vm->_file->restoreGame(-1);
return;
}
@@ -137,7 +137,7 @@ void Parser_v1w::lineHandler() {
if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces!
return;
- if (gameStatus.gameOverFl) {
+ if (gameStatus._gameOverFl) {
// No commands allowed!
_vm->gameOverMsg();
return;
@@ -147,8 +147,8 @@ void Parser_v1w::lineHandler() {
// Test for nearby objects referenced explicitly
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i];
- if (isWordPresent(_vm->_text->getNounArray(obj->nounIndex))) {
+ Object *obj = &_vm->_object->_objects[i];
+ if (isWordPresent(_vm->_text->getNounArray(obj->_nounIndex))) {
if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment))
return;
}
@@ -157,8 +157,8 @@ void Parser_v1w::lineHandler() {
// Test for nearby objects that only require a verb
// Note comment is unused if not near.
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i];
- if (obj->verbOnlyFl) {
+ Object *obj = &_vm->_object->_objects[i];
+ if (obj->_verbOnlyFl) {
char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects
if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment))
return;
@@ -166,9 +166,9 @@ void Parser_v1w::lineHandler() {
}
// No objects match command line, try background and catchall commands
- if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screen_p]))
+ if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screenPtr]))
return;
- if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screen_p]))
+ if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screenPtr]))
return;
if (isBackgroundWord_v3(_catchallList))
@@ -185,7 +185,7 @@ void Parser_v1w::lineHandler() {
// Nothing matches. Report recognition success to user.
const char *verb = findVerb();
const char *noun = findNoun();
- if (verb == _vm->_text->getVerb(_vm->_look, 0) && _vm->_maze.enabledFl) {
+ if (verb == _vm->_text->getVerb(_vm->_look, 0) && _vm->_maze._enabledFl) {
Utils::notifyBox(_vm->_text->getTextParser(kTBMaze));
_vm->_object->showTakeables();
} else if (verb && noun) { // A combination I didn't think of
@@ -200,16 +200,16 @@ void Parser_v1w::lineHandler() {
}
void Parser_v1w::showInventory() const {
- status_t &gameStatus = _vm->getGameStatus();
- istate_t inventState = _vm->_inventory->getInventoryState();
- if (gameStatus.gameOverFl) {
+ Status &gameStatus = _vm->getGameStatus();
+ Istate inventState = _vm->_inventory->getInventoryState();
+ if (gameStatus._gameOverFl) {
_vm->gameOverMsg();
- } else if ((inventState == kInventoryOff) && (gameStatus.viewState == kViewPlay)) {
+ } else if ((inventState == kInventoryOff) && (gameStatus._viewState == kViewPlay)) {
_vm->_inventory->setInventoryState(kInventoryDown);
- gameStatus.viewState = kViewInvent;
+ gameStatus._viewState = kViewInvent;
} else if (inventState == kInventoryActive) {
_vm->_inventory->setInventoryState(kInventoryUp);
- gameStatus.viewState = kViewInvent;
+ gameStatus._viewState = kViewInvent;
}
}
diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp
index 0095c4d726..6d71186f49 100644
--- a/engines/hugo/parser_v2d.cpp
+++ b/engines/hugo/parser_v2d.cpp
@@ -55,12 +55,12 @@ Parser_v2d::~Parser_v2d() {
void Parser_v2d::lineHandler() {
debugC(1, kDebugParser, "lineHandler()");
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
// Toggle God Mode
if (!strncmp(_vm->_line, "PPG", 3)) {
_vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh);
- gameStatus.godModeFl = !gameStatus.godModeFl;
+ gameStatus._godModeFl = !gameStatus._godModeFl;
return;
}
@@ -71,7 +71,7 @@ void Parser_v2d::lineHandler() {
// fetch <object name> Hero carries named object
// fetch all Hero carries all possible objects
// find <object name> Takes hero to screen containing named object
- if (gameStatus.godModeFl) {
+ if (gameStatus._godModeFl) {
// Special code to allow me to go straight to any screen
if (strstr(_vm->_line, "goto")) {
for (int i = 0; i < _vm->_numScreens; i++) {
@@ -85,7 +85,7 @@ void Parser_v2d::lineHandler() {
// Special code to allow me to get objects from anywhere
if (strstr(_vm->_line, "fetch all")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (_vm->_object->_objects[i].genericCmd & TAKE)
+ if (_vm->_object->_objects[i]._genericCmd & TAKE)
takeObject(&_vm->_object->_objects[i]);
}
return;
@@ -93,7 +93,7 @@ void Parser_v2d::lineHandler() {
if (strstr(_vm->_line, "fetch")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
+ if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
takeObject(&_vm->_object->_objects[i]);
return;
}
@@ -103,8 +103,8 @@ void Parser_v2d::lineHandler() {
// Special code to allow me to goto objects
if (strstr(_vm->_line, "find")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
- _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex);
+ if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
+ _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex);
return;
}
}
@@ -119,7 +119,7 @@ void Parser_v2d::lineHandler() {
// SAVE/RESTORE
if (!strcmp("save", _vm->_line)) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -137,7 +137,7 @@ void Parser_v2d::lineHandler() {
if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces!
return;
- if (gameStatus.gameOverFl) {
+ if (gameStatus._gameOverFl) {
// No commands allowed!
_vm->gameOverMsg();
return;
@@ -153,26 +153,26 @@ void Parser_v2d::lineHandler() {
noun = findNextNoun(noun); // Find a noun in the line
// Must try at least once for objects allowing verb-context
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i];
+ Object *obj = &_vm->_object->_objects[i];
if (isNear_v1(verb, noun, obj, farComment)) {
if (isObjectVerb_v1(verb, obj) // Foreground object
|| isGenericVerb_v1(verb, obj))// Common action type
return;
}
}
- if ((*farComment != '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screen_p]))
+ if ((*farComment != '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screenPtr]))
return;
} while (noun);
}
noun = findNextNoun(noun);
- if ( !isCatchallVerb_v1(true, noun, verb, _backgroundObjects[*_vm->_screen_p])
+ if ( !isCatchallVerb_v1(true, noun, verb, _backgroundObjects[*_vm->_screenPtr])
&& !isCatchallVerb_v1(true, noun, verb, _catchallList)
- && !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screen_p])
+ && !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screenPtr])
&& !isCatchallVerb_v1(false, noun, verb, _catchallList)) {
if (*farComment != '\0') { // An object matched but not near enough
Utils::notifyBox(farComment);
- } else if (_vm->_maze.enabledFl && (verb == _vm->_text->getVerb(_vm->_look, 0))) {
+ } else if (_vm->_maze._enabledFl && (verb == _vm->_text->getVerb(_vm->_look, 0))) {
Utils::notifyBox(_vm->_text->getTextParser(kTBMaze));
_vm->_object->showTakeables();
} else if (verb && noun) { // A combination I didn't think of
diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp
index b45e9186b3..a7e5896833 100644
--- a/engines/hugo/parser_v3d.cpp
+++ b/engines/hugo/parser_v3d.cpp
@@ -55,12 +55,12 @@ Parser_v3d::~Parser_v3d() {
void Parser_v3d::lineHandler() {
debugC(1, kDebugParser, "lineHandler()");
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
// Toggle God Mode
if (!strncmp(_vm->_line, "PPG", 3)) {
_vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh);
- gameStatus.godModeFl = !gameStatus.godModeFl;
+ gameStatus._godModeFl = !gameStatus._godModeFl;
return;
}
@@ -71,7 +71,7 @@ void Parser_v3d::lineHandler() {
// fetch <object name> Hero carries named object
// fetch all Hero carries all possible objects
// find <object name> Takes hero to screen containing named object
- if (gameStatus.godModeFl) {
+ if (gameStatus._godModeFl) {
// Special code to allow me to go straight to any screen
if (strstr(_vm->_line, "goto")) {
for (int i = 0; i < _vm->_numScreens; i++) {
@@ -85,7 +85,7 @@ void Parser_v3d::lineHandler() {
// Special code to allow me to get objects from anywhere
if (strstr(_vm->_line, "fetch all")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (_vm->_object->_objects[i].genericCmd & TAKE)
+ if (_vm->_object->_objects[i]._genericCmd & TAKE)
takeObject(&_vm->_object->_objects[i]);
}
return;
@@ -93,7 +93,7 @@ void Parser_v3d::lineHandler() {
if (strstr(_vm->_line, "fetch")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
+ if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
takeObject(&_vm->_object->_objects[i]);
return;
}
@@ -103,8 +103,8 @@ void Parser_v3d::lineHandler() {
// Special code to allow me to goto objects
if (strstr(_vm->_line, "find")) {
for (int i = 0; i < _vm->_object->_numObj; i++) {
- if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) {
- _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex);
+ if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) {
+ _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex);
return;
}
}
@@ -121,7 +121,7 @@ void Parser_v3d::lineHandler() {
// SAVE/RESTORE
if (!strcmp("save", _vm->_line)) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -139,7 +139,7 @@ void Parser_v3d::lineHandler() {
if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces!
return;
- if (gameStatus.gameOverFl) {
+ if (gameStatus._gameOverFl) {
// No commands allowed!
_vm->gameOverMsg();
return;
@@ -149,8 +149,8 @@ void Parser_v3d::lineHandler() {
// Test for nearby objects referenced explicitly
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i];
- if (isWordPresent(_vm->_text->getNounArray(obj->nounIndex))) {
+ Object *obj = &_vm->_object->_objects[i];
+ if (isWordPresent(_vm->_text->getNounArray(obj->_nounIndex))) {
if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment))
return;
}
@@ -159,8 +159,8 @@ void Parser_v3d::lineHandler() {
// Test for nearby objects that only require a verb
// Note comment is unused if not near.
for (int i = 0; i < _vm->_object->_numObj; i++) {
- object_t *obj = &_vm->_object->_objects[i];
- if (obj->verbOnlyFl) {
+ Object *obj = &_vm->_object->_objects[i];
+ if (obj->_verbOnlyFl) {
char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects
if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment))
return;
@@ -168,9 +168,9 @@ void Parser_v3d::lineHandler() {
}
// No objects match command line, try background and catchall commands
- if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screen_p]))
+ if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screenPtr]))
return;
- if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screen_p]))
+ if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screenPtr]))
return;
if (isBackgroundWord_v3(_catchallList))
@@ -204,51 +204,51 @@ void Parser_v3d::lineHandler() {
* If it does, and the object is near and passes the tests in the command
* list then carry out the actions in the action list and return TRUE
*/
-bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) {
- debugC(1, kDebugParser, "isObjectVerb(object_t *obj, %s)", comment);
+bool Parser_v3d::isObjectVerb_v3(Object *obj, char *comment) {
+ debugC(1, kDebugParser, "isObjectVerb(Object *obj, %s)", comment);
// First, find matching verb in cmd list
- uint16 cmdIndex = obj->cmdIndex; // ptr to list of commands
+ uint16 cmdIndex = obj->_cmdIndex; // ptr to list of commands
if (cmdIndex == 0) // No commands for this obj
return false;
int i;
- for (i = 0; _cmdList[cmdIndex][i].verbIndex != 0; i++) { // For each cmd
- if (isWordPresent(_vm->_text->getVerbArray(_cmdList[cmdIndex][i].verbIndex))) // Was this verb used?
+ for (i = 0; _cmdList[cmdIndex][i]._verbIndex != 0; i++) { // For each cmd
+ if (isWordPresent(_vm->_text->getVerbArray(_cmdList[cmdIndex][i]._verbIndex))) // Was this verb used?
break;
}
- if (_cmdList[cmdIndex][i].verbIndex == 0) // No verbs used.
+ if (_cmdList[cmdIndex][i]._verbIndex == 0) // No verbs used.
return false;
// Verb match found. Check if object is Near
- char *verb = *_vm->_text->getVerbArray(_cmdList[cmdIndex][i].verbIndex);
+ char *verb = *_vm->_text->getVerbArray(_cmdList[cmdIndex][i]._verbIndex);
if (!isNear_v3(obj, verb, comment))
return false;
// Check all required objects are being carried
cmd *cmnd = &_cmdList[cmdIndex][i]; // ptr to struct cmd
- if (cmnd->reqIndex) { // At least 1 thing in list
- uint16 *reqs = _arrayReqs[cmnd->reqIndex]; // ptr to list of required objects
+ if (cmnd->_reqIndex) { // At least 1 thing in list
+ uint16 *reqs = _arrayReqs[cmnd->_reqIndex]; // ptr to list of required objects
for (i = 0; reqs[i]; i++) { // for each obj
if (!_vm->_object->isCarrying(reqs[i])) {
- Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataNoCarryIndex));
+ Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataNoCarryIndex));
return true;
}
}
}
// Required objects are present, now check state is correct
- if ((obj->state != cmnd->reqState) && (cmnd->reqState != kStateDontCare)) {
- Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataWrongIndex));
+ if ((obj->_state != cmnd->_reqState) && (cmnd->_reqState != kStateDontCare)) {
+ Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataWrongIndex));
return true;
}
// Everything checked. Change the state and carry out any actions
- if (cmnd->reqState != kStateDontCare) // Don't change new state if required state didn't care
- obj->state = cmnd->newState;
- Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataDoneIndex));
- _vm->_scheduler->insertActionList(cmnd->actIndex);
+ if (cmnd->_reqState != kStateDontCare) // Don't change new state if required state didn't care
+ obj->_state = cmnd->_newState;
+ Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataDoneIndex));
+ _vm->_scheduler->insertActionList(cmnd->_actIndex);
// See if any additional generic actions
if ((verb == _vm->_text->getVerb(_vm->_look, 0)) || (verb == _vm->_text->getVerb(_vm->_take, 0)) || (verb == _vm->_text->getVerb(_vm->_drop, 0)))
@@ -259,21 +259,21 @@ bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) {
/**
* Test whether command line contains one of the generic actions
*/
-bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) {
- debugC(1, kDebugParser, "isGenericVerb(object_t *obj, %s)", comment);
+bool Parser_v3d::isGenericVerb_v3(Object *obj, char *comment) {
+ debugC(1, kDebugParser, "isGenericVerb(Object *obj, %s)", comment);
- if (!obj->genericCmd)
+ if (!obj->_genericCmd)
return false;
// Following is equivalent to switch, but couldn't do one
if (isWordPresent(_vm->_text->getVerbArray(_vm->_look)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_look, 0), comment)) {
// Test state-dependent look before general look
- if ((obj->genericCmd & LOOK_S) == LOOK_S) {
- Utils::notifyBox(_vm->_text->getTextData(obj->stateDataIndex[obj->state]));
+ if ((obj->_genericCmd & LOOK_S) == LOOK_S) {
+ Utils::notifyBox(_vm->_text->getTextData(obj->_stateDataIndex[obj->_state]));
} else {
- if ((LOOK & obj->genericCmd) == LOOK) {
- if (obj->dataIndex != 0)
- Utils::notifyBox(_vm->_text->getTextData(obj->dataIndex));
+ if ((LOOK & obj->_genericCmd) == LOOK) {
+ if (obj->_dataIndex != 0)
+ Utils::notifyBox(_vm->_text->getTextData(obj->_dataIndex));
else
return false;
} else {
@@ -281,22 +281,22 @@ bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) {
}
}
} else if (isWordPresent(_vm->_text->getVerbArray(_vm->_take)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_take, 0), comment)) {
- if (obj->carriedFl)
+ if (obj->_carriedFl)
Utils::notifyBox(_vm->_text->getTextParser(kTBHave));
- else if ((TAKE & obj->genericCmd) == TAKE)
+ else if ((TAKE & obj->_genericCmd) == TAKE)
takeObject(obj);
- else if (obj->cmdIndex) // No comment if possible commands
+ else if (obj->_cmdIndex) // No comment if possible commands
return false;
- else if (!obj->verbOnlyFl && (TAKE & obj->genericCmd) == TAKE) // Make sure not taking object in context!
+ else if (!obj->_verbOnlyFl && (TAKE & obj->_genericCmd) == TAKE) // Make sure not taking object in context!
Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse));
else
return false;
} else if (isWordPresent(_vm->_text->getVerbArray(_vm->_drop))) {
- if (!obj->carriedFl && ((DROP & obj->genericCmd) == DROP))
+ if (!obj->_carriedFl && ((DROP & obj->_genericCmd) == DROP))
Utils::notifyBox(_vm->_text->getTextParser(kTBDontHave));
- else if (obj->carriedFl && ((DROP & obj->genericCmd) == DROP))
+ else if (obj->_carriedFl && ((DROP & obj->_genericCmd) == DROP))
dropObject(obj);
- else if (obj->cmdIndex == 0)
+ else if (obj->_cmdIndex == 0)
Utils::notifyBox(_vm->_text->getTextParser(kTBNeed));
else
return false;
@@ -313,35 +313,35 @@ bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) {
* If radius is -1, treat radius as infinity
* Verb is included to determine correct comment if not near
*/
-bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const {
- debugC(1, kDebugParser, "isNear(object_t *obj, %s, %s)", verb, comment);
+bool Parser_v3d::isNear_v3(Object *obj, const char *verb, char *comment) const {
+ debugC(1, kDebugParser, "isNear(Object *obj, %s, %s)", verb, comment);
- if (obj->carriedFl) // Object is being carried
+ if (obj->_carriedFl) // Object is being carried
return true;
- if (obj->screenIndex != *_vm->_screen_p) {
+ if (obj->_screenIndex != *_vm->_screenPtr) {
// Not in same screen
- if (obj->objValue)
+ if (obj->_objValue)
strcpy(comment, _vm->_text->getTextParser(kCmtAny1));
else
strcpy(comment, _vm->_text->getTextParser(kCmtAny2));
return false;
}
- if (obj->cycling == kCycleInvisible) {
- if (obj->seqNumb) {
+ if (obj->_cycling == kCycleInvisible) {
+ if (obj->_seqNumb) {
// There is an image
strcpy(comment, _vm->_text->getTextParser(kCmtAny3));
return false;
} else {
// No image, assume visible
- if ((obj->radius < 0) ||
- ((abs(obj->x - _vm->_hero->x) <= obj->radius) &&
- (abs(obj->y - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) {
+ if ((obj->_radius < 0) ||
+ ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) &&
+ (abs(obj->_y - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) {
return true;
} else {
// User is not close enough
- if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
+ if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
strcpy(comment, _vm->_text->getTextParser(kCmtAny1));
else
strcpy(comment, _vm->_text->getTextParser(kCmtClose));
@@ -350,13 +350,13 @@ bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const
}
}
- if ((obj->radius < 0) ||
- ((abs(obj->x - _vm->_hero->x) <= obj->radius) &&
- (abs(obj->y + obj->currImagePtr->y2 - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) {
+ if ((obj->_radius < 0) ||
+ ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) &&
+ (abs(obj->_y + obj->_currImagePtr->_y2 - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) {
return true;
} else {
// User is not close enough
- if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
+ if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0)))
strcpy(comment, _vm->_text->getTextParser(kCmtAny1));
else
strcpy(comment, _vm->_text->getTextParser(kCmtClose));
@@ -368,36 +368,36 @@ bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const
/**
* Do all things necessary to carry an object
*/
-void Parser_v3d::takeObject(object_t *obj) {
- debugC(1, kDebugParser, "takeObject(object_t *obj)");
+void Parser_v3d::takeObject(Object *obj) {
+ debugC(1, kDebugParser, "takeObject(Object *obj)");
- obj->carriedFl = true;
- if (obj->seqNumb) { // Don't change if no image to display
- obj->cycling = kCycleInvisible;
+ obj->_carriedFl = true;
+ if (obj->_seqNumb) { // Don't change if no image to display
+ obj->_cycling = kCycleInvisible;
}
- _vm->adjustScore(obj->objValue);
+ _vm->adjustScore(obj->_objValue);
- if (obj->seqNumb > 0) // If object has an image, force walk to dropped
- obj->viewx = -1; // (possibly moved) object next time taken!
- Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME)));
+ if (obj->_seqNumb > 0) // If object has an image, force walk to dropped
+ obj->_viewx = -1; // (possibly moved) object next time taken!
+ Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->_nounIndex, TAKE_NAME)));
}
/**
* Do all necessary things to drop an object
*/
-void Parser_v3d::dropObject(object_t *obj) {
- debugC(1, kDebugParser, "dropObject(object_t *obj)");
+void Parser_v3d::dropObject(Object *obj) {
+ debugC(1, kDebugParser, "dropObject(Object *obj)");
- obj->carriedFl = false;
- obj->screenIndex = *_vm->_screen_p;
- if ((obj->seqNumb > 1) || (obj->seqList[0].imageNbr > 1))
- obj->cycling = kCycleForward;
+ obj->_carriedFl = false;
+ obj->_screenIndex = *_vm->_screenPtr;
+ if ((obj->_seqNumb > 1) || (obj->_seqList[0]._imageNbr > 1))
+ obj->_cycling = kCycleForward;
else
- obj->cycling = kCycleNotCycling;
- obj->x = _vm->_hero->x - 1;
- obj->y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1;
- obj->y = (obj->y + obj->currImagePtr->y2 < kYPix) ? obj->y : kYPix - obj->currImagePtr->y2 - 10;
- _vm->adjustScore(-obj->objValue);
+ obj->_cycling = kCycleNotCycling;
+ obj->_x = _vm->_hero->_x - 1;
+ obj->_y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1;
+ obj->_y = (obj->_y + obj->_currImagePtr->_y2 < kYPix) ? obj->_y : kYPix - obj->_currImagePtr->_y2 - 10;
+ _vm->adjustScore(-obj->_objValue);
Utils::notifyBox(_vm->_text->getTextParser(kTBOk));
}
@@ -407,22 +407,22 @@ void Parser_v3d::dropObject(object_t *obj) {
* Note that if the background command list has match set TRUE then do not
* print text if there are any recognizable nouns in the command line
*/
-bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const {
+bool Parser_v3d::isCatchallVerb_v3(ObjectList obj) const {
debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)");
- if (_vm->_maze.enabledFl)
+ if (_vm->_maze._enabledFl)
return false;
- for (int i = 0; obj[i].verbIndex != 0; i++) {
- if (isWordPresent(_vm->_text->getVerbArray(obj[i].verbIndex)) && obj[i].nounIndex == 0 &&
- (!obj[i].matchFl || !findNoun()) &&
- ((obj[i].roomState == kStateDontCare) ||
- (obj[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) {
- Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
- _vm->_scheduler->processBonus(obj[i].bonusIndex);
+ for (int i = 0; obj[i]._verbIndex != 0; i++) {
+ if (isWordPresent(_vm->_text->getVerbArray(obj[i]._verbIndex)) && obj[i]._nounIndex == 0 &&
+ (!obj[i]._matchFl || !findNoun()) &&
+ ((obj[i]._roomState == kStateDontCare) ||
+ (obj[i]._roomState == _vm->_screenStates[*_vm->_screenPtr]))) {
+ Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex));
+ _vm->_scheduler->processBonus(obj[i]._bonusIndex);
// If this is LOOK (without a noun), show any takeable objects
- if (*(_vm->_text->getVerbArray(obj[i].verbIndex)) == _vm->_text->getVerb(_vm->_look, 0))
+ if (*(_vm->_text->getVerbArray(obj[i]._verbIndex)) == _vm->_text->getVerb(_vm->_look, 0))
_vm->_object->showTakeables();
return true;
@@ -435,19 +435,19 @@ bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const {
* Search for matching verb/noun pairs in background command list
* Print text for possible background object. Return TRUE if match found
*/
-bool Parser_v3d::isBackgroundWord_v3(objectList_t obj) const {
+bool Parser_v3d::isBackgroundWord_v3(ObjectList obj) const {
debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)");
- if (_vm->_maze.enabledFl)
+ if (_vm->_maze._enabledFl)
return false;
- for (int i = 0; obj[i].verbIndex != 0; i++) {
- if (isWordPresent(_vm->_text->getVerbArray(obj[i].verbIndex)) &&
- isWordPresent(_vm->_text->getNounArray(obj[i].nounIndex)) &&
- ((obj[i].roomState == kStateDontCare) ||
- (obj[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) {
- Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
- _vm->_scheduler->processBonus(obj[i].bonusIndex);
+ for (int i = 0; obj[i]._verbIndex != 0; i++) {
+ if (isWordPresent(_vm->_text->getVerbArray(obj[i]._verbIndex)) &&
+ isWordPresent(_vm->_text->getNounArray(obj[i]._nounIndex)) &&
+ ((obj[i]._roomState == kStateDontCare) ||
+ (obj[i]._roomState == _vm->_screenStates[*_vm->_screenPtr]))) {
+ Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex));
+ _vm->_scheduler->processBonus(obj[i]._bonusIndex);
return true;
}
}
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index 281aacf031..54dae88c28 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -61,41 +61,41 @@ int16 Route::getRouteIndex() const {
void Route::setDirection(const uint16 keyCode) {
debugC(1, kDebugRoute, "setDirection(%d)", keyCode);
- object_t *obj = _vm->_hero; // Pointer to hero object
+ Object *obj = _vm->_hero; // Pointer to hero object
// Set first image in sequence
switch (keyCode) {
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
- obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
break;
case Common::KEYCODE_DOWN:
case Common::KEYCODE_KP2:
- obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
break;
case Common::KEYCODE_LEFT:
case Common::KEYCODE_KP4:
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
break;
case Common::KEYCODE_RIGHT:
case Common::KEYCODE_KP6:
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
break;
case Common::KEYCODE_HOME:
case Common::KEYCODE_KP7:
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
break;
case Common::KEYCODE_END:
case Common::KEYCODE_KP1:
- obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
break;
case Common::KEYCODE_PAGEUP:
case Common::KEYCODE_KP9:
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
break;
case Common::KEYCODE_PAGEDOWN:
case Common::KEYCODE_KP3:
- obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
+ obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
break;
}
}
@@ -107,68 +107,68 @@ void Route::setDirection(const uint16 keyCode) {
void Route::setWalk(const uint16 direction) {
debugC(1, kDebugRoute, "setWalk(%d)", direction);
- object_t *obj = _vm->_hero; // Pointer to hero object
+ Object *obj = _vm->_hero; // Pointer to hero object
- if (_vm->getGameStatus().storyModeFl || obj->pathType != kPathUser) // Make sure user has control
+ if (_vm->getGameStatus()._storyModeFl || obj->_pathType != kPathUser) // Make sure user has control
return;
- if (!obj->vx && !obj->vy)
+ if (!obj->_vx && !obj->_vy)
_oldWalkDirection = 0; // Fix for consistant restarts
if (direction != _oldWalkDirection) {
// Direction has changed
setDirection(direction); // Face new direction
- obj->vx = obj->vy = 0;
+ obj->_vx = obj->_vy = 0;
switch (direction) { // And set correct velocity
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
- obj->vy = -kStepDy;
+ obj->_vy = -kStepDy;
break;
case Common::KEYCODE_DOWN:
case Common::KEYCODE_KP2:
- obj->vy = kStepDy;
+ obj->_vy = kStepDy;
break;
case Common::KEYCODE_LEFT:
case Common::KEYCODE_KP4:
- obj->vx = -kStepDx;
+ obj->_vx = -kStepDx;
break;
case Common::KEYCODE_RIGHT:
case Common::KEYCODE_KP6:
- obj->vx = kStepDx;
+ obj->_vx = kStepDx;
break;
case Common::KEYCODE_HOME:
case Common::KEYCODE_KP7:
- obj->vx = -kStepDx;
+ obj->_vx = -kStepDx;
// Note: in v1 Dos and v2 Dos, obj->vy is set to DY
- obj->vy = -kStepDy / 2;
+ obj->_vy = -kStepDy / 2;
break;
case Common::KEYCODE_END:
case Common::KEYCODE_KP1:
- obj->vx = -kStepDx;
+ obj->_vx = -kStepDx;
// Note: in v1 Dos and v2 Dos, obj->vy is set to -DY
- obj->vy = kStepDy / 2;
+ obj->_vy = kStepDy / 2;
break;
case Common::KEYCODE_PAGEUP:
case Common::KEYCODE_KP9:
- obj->vx = kStepDx;
+ obj->_vx = kStepDx;
// Note: in v1 Dos and v2 Dos, obj->vy is set to -DY
- obj->vy = -kStepDy / 2;
+ obj->_vy = -kStepDy / 2;
break;
case Common::KEYCODE_PAGEDOWN:
case Common::KEYCODE_KP3:
- obj->vx = kStepDx;
+ obj->_vx = kStepDx;
// Note: in v1 Dos and v2 Dos, obj->vy is set to DY
- obj->vy = kStepDy / 2;
+ obj->_vy = kStepDy / 2;
break;
}
_oldWalkDirection = direction;
- obj->cycling = kCycleForward;
+ obj->_cycling = kCycleForward;
} else {
// Same key twice - halt hero
- obj->vy = 0;
- obj->vx = 0;
+ obj->_vy = 0;
+ obj->_vx = 0;
_oldWalkDirection = 0;
- obj->cycling = kCycleNotCycling;
+ obj->_cycling = kCycleNotCycling;
}
}
@@ -188,8 +188,8 @@ void Route::segment(int16 x, int16 y) {
debugC(1, kDebugRoute, "segment(%d, %d)", x, y);
// Note: use of static - can't waste stack
- static image_pt p; // Ptr to _boundaryMap[y]
- static segment_t *seg_p; // Ptr to segment
+ static ImagePtr p; // Ptr to _boundaryMap[y]
+ static Segment *segPtr; // Ptr to segment
// Bomb out if stack exhausted
// Vinterstum: Is this just a safeguard, or actually used?
@@ -228,7 +228,7 @@ void Route::segment(int16 x, int16 y) {
if (y <= 0 || y >= kYPix - 1)
return;
- if (_vm->_hero->x < x1) {
+ if (_vm->_hero->_x < x1) {
// Hero x not in segment, search x1..x2
// Find all segments above current
for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
@@ -241,7 +241,7 @@ void Route::segment(int16 x, int16 y) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
- } else if (_vm->_hero->x + kHeroMaxWidth > x2) {
+ } else if (_vm->_hero->_x + kHeroMaxWidth > x2) {
// Hero x not in segment, search x1..x2
// Find all segments above current
for (x = x2; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x >= x1; x--) {
@@ -257,22 +257,22 @@ void Route::segment(int16 x, int16 y) {
} else {
// Organize search around hero x position - this gives
// better chance for more direct route.
- for (x = _vm->_hero->x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
+ for (x = _vm->_hero->_x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
if (_boundaryMap[y - 1][x] == 0)
segment(x, y - 1);
}
- for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->x; x++) {
+ for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->_x; x++) {
if (_boundaryMap[y - 1][x] == 0)
segment(x, y - 1);
}
- for (x = _vm->_hero->x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
+ for (x = _vm->_hero->_x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
- for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->x; x++) {
+ for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->_x; x++) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
@@ -285,10 +285,10 @@ void Route::segment(int16 x, int16 y) {
_fullSegmentFl = true;
} else {
// Create segment
- seg_p = &_segment[_segmentNumb];
- seg_p->y = y;
- seg_p->x1 = x1;
- seg_p->x2 = x2;
+ segPtr = &_segment[_segmentNumb];
+ segPtr->_y = y;
+ segPtr->_x1 = x1;
+ segPtr->_x2 = x2;
_segmentNumb++;
}
}
@@ -298,7 +298,7 @@ void Route::segment(int16 x, int16 y) {
* Create and return ptr to new node. Initialize with previous node.
* Returns 0 if MAX_NODES exceeded
*/
-Point *Route::newNode() {
+Common::Point *Route::newNode() {
debugC(1, kDebugRoute, "newNode");
_routeListIndex++;
@@ -327,16 +327,16 @@ bool Route::findRoute(const int16 cx, const int16 cy) {
_destY = cy; // Destination coords
_destX = cx; // Destination coords
- int16 herox1 = _vm->_hero->x + _vm->_hero->currImagePtr->x1; // Hero baseline
- int16 herox2 = _vm->_hero->x + _vm->_hero->currImagePtr->x2; // Hero baseline
- int16 heroy = _vm->_hero->y + _vm->_hero->currImagePtr->y2; // Hero baseline
+ int16 herox1 = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1; // Hero baseline
+ int16 herox2 = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x2; // Hero baseline
+ int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2; // Hero baseline
// Store all object baselines into objbound (except hero's = [0])
- object_t *obj; // Ptr to object
+ Object *obj; // Ptr to object
int i;
for (i = 1, obj = &_vm->_object->_objects[i]; i < _vm->_object->_numObj; i++, obj++) {
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling != kCycleInvisible) && (obj->priority == kPriorityFloating))
- _vm->_object->storeBoundary(obj->oldx + obj->currImagePtr->x1, obj->oldx + obj->currImagePtr->x2, obj->oldy + obj->currImagePtr->y2);
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating))
+ _vm->_object->storeBoundary(obj->_oldx + obj->_currImagePtr->_x1, obj->_oldx + obj->_currImagePtr->_x2, obj->_oldy + obj->_currImagePtr->_y2);
}
// Combine objbound and boundary bitmaps to local byte map
@@ -350,8 +350,8 @@ bool Route::findRoute(const int16 cx, const int16 cy) {
// Clear all object baselines from objbound
for (i = 0, obj = _vm->_object->_objects; i < _vm->_object->_numObj; i++, obj++) {
- if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling != kCycleInvisible) && (obj->priority == kPriorityFloating))
- _vm->_object->clearBoundary(obj->oldx + obj->currImagePtr->x1, obj->oldx + obj->currImagePtr->x2, obj->oldy + obj->currImagePtr->y2);
+ if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating))
+ _vm->_object->clearBoundary(obj->_oldx + obj->_currImagePtr->_x1, obj->_oldx + obj->_currImagePtr->_x2, obj->_oldy + obj->_currImagePtr->_y2);
}
// Search from hero to destination
@@ -368,32 +368,32 @@ bool Route::findRoute(const int16 cx, const int16 cy) {
_route[0].y = _destY;
// Make a final segment for hero's base (we left a spare)
- _segment[_segmentNumb].y = heroy;
- _segment[_segmentNumb].x1 = herox1;
- _segment[_segmentNumb].x2 = herox2;
+ _segment[_segmentNumb]._y = heroy;
+ _segment[_segmentNumb]._x1 = herox1;
+ _segment[_segmentNumb]._x2 = herox2;
_segmentNumb++;
- Point *routeNode; // Ptr to route node
+ Common::Point *routeNode; // Ptr to route node
// Look in segments[] for straight lines from destination to hero
for (i = 0, _routeListIndex = 0; i < _segmentNumb - 1; i++) {
if ((routeNode = newNode()) == 0) // New node for new segment
return false; // Too many nodes
- routeNode->y = _segment[i].y;
+ routeNode->y = _segment[i]._y;
// Look ahead for furthest straight line
for (int16 j = i + 1; j < _segmentNumb; j++) {
- segment_t *seg_p = &_segment[j];
+ Segment *segPtr = &_segment[j];
// Can we get to this segment from previous node?
- if (seg_p->x1 <= routeNode->x && seg_p->x2 >= routeNode->x + _heroWidth - 1) {
- routeNode->y = seg_p->y; // Yes, keep updating node
+ if (segPtr->_x1 <= routeNode->x && segPtr->_x2 >= routeNode->x + _heroWidth - 1) {
+ routeNode->y = segPtr->_y; // Yes, keep updating node
} else {
// No, create another node on previous segment to reach it
if ((routeNode = newNode()) == 0) // Add new route node
return false; // Too many nodes
// Find overlap between old and new segments
- int16 x1 = MAX(_segment[j - 1].x1, seg_p->x1);
- int16 x2 = MIN(_segment[j - 1].x2, seg_p->x2);
+ int16 x1 = MAX(_segment[j - 1]._x1, segPtr->_x1);
+ int16 x2 = MIN(_segment[j - 1]._x2, segPtr->_x2);
// If room, add a little offset to reduce staircase effect
int16 dx = kHeroMaxWidth >> 1;
@@ -433,18 +433,18 @@ void Route::processRoute() {
return;
// Current hero position
- int16 herox = _vm->_hero->x + _vm->_hero->currImagePtr->x1;
- int16 heroy = _vm->_hero->y + _vm->_hero->currImagePtr->y2;
- Point *routeNode = &_route[_routeIndex];
+ int16 herox = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1;
+ int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2;
+ Common::Point *routeNode = &_route[_routeIndex];
// Arrived at node?
if (abs(herox - routeNode->x) < kStepDx + 1 && abs(heroy - routeNode->y) < kStepDy) {
// kStepDx too low
// Close enough - position hero exactly
- _vm->_hero->x = _vm->_hero->oldx = routeNode->x - _vm->_hero->currImagePtr->x1;
- _vm->_hero->y = _vm->_hero->oldy = routeNode->y - _vm->_hero->currImagePtr->y2;
- _vm->_hero->vx = _vm->_hero->vy = 0;
- _vm->_hero->cycling = kCycleNotCycling;
+ _vm->_hero->_x = _vm->_hero->_oldx = routeNode->x - _vm->_hero->_currImagePtr->_x1;
+ _vm->_hero->_y = _vm->_hero->_oldy = routeNode->y - _vm->_hero->_currImagePtr->_y2;
+ _vm->_hero->_vx = _vm->_hero->_vy = 0;
+ _vm->_hero->_cycling = kCycleNotCycling;
// Arrived at final node?
if (--_routeIndex < 0) {
@@ -458,7 +458,7 @@ void Route::processRoute() {
_vm->_object->lookObject(&_vm->_object->_objects[_routeObjId]);
turnedFl = false;
} else {
- setDirection(_vm->_object->_objects[_routeObjId].direction);
+ setDirection(_vm->_object->_objects[_routeObjId]._direction);
_routeIndex++; // Come round again
turnedFl = true;
}
@@ -468,7 +468,7 @@ void Route::processRoute() {
_vm->_object->useObject(_routeObjId);
turnedFl = false;
} else {
- setDirection(_vm->_object->_objects[_routeObjId].direction);
+ setDirection(_vm->_object->_objects[_routeObjId]._direction);
_routeIndex++; // Come round again
turnedFl = true;
}
@@ -477,7 +477,7 @@ void Route::processRoute() {
break;
}
}
- } else if (_vm->_hero->vx == 0 && _vm->_hero->vy == 0) {
+ } else if (_vm->_hero->_vx == 0 && _vm->_hero->_vy == 0) {
// Set direction of travel if at a node
// Note realignment when changing to (thinner) up/down sprite,
// otherwise hero could bump into boundaries along route.
@@ -487,10 +487,10 @@ void Route::processRoute() {
setWalk(Common::KEYCODE_LEFT);
} else if (heroy < routeNode->y) {
setWalk(Common::KEYCODE_DOWN);
- _vm->_hero->x = _vm->_hero->oldx = routeNode->x - _vm->_hero->currImagePtr->x1;
+ _vm->_hero->_x = _vm->_hero->_oldx = routeNode->x - _vm->_hero->_currImagePtr->_x1;
} else if (heroy > routeNode->y) {
setWalk(Common::KEYCODE_UP);
- _vm->_hero->x = _vm->_hero->oldx = routeNode->x - _vm->_hero->currImagePtr->x1;
+ _vm->_hero->_x = _vm->_hero->_oldx = routeNode->x - _vm->_hero->_currImagePtr->_x1;
}
}
}
@@ -500,11 +500,11 @@ void Route::processRoute() {
* go_for is the purpose, id indexes the exit or object to walk to
* Returns FALSE if route not found
*/
-bool Route::startRoute(const go_t routeType, const int16 objId, int16 cx, int16 cy) {
+bool Route::startRoute(const RouteType routeType, const int16 objId, int16 cx, int16 cy) {
debugC(1, kDebugRoute, "startRoute(%d, %d, %d, %d)", routeType, objId, cx, cy);
// Don't attempt to walk if user does not have control
- if (_vm->_hero->pathType != kPathUser)
+ if (_vm->_hero->_pathType != kPathUser)
return false;
// if inventory showing, make it go away
@@ -521,7 +521,7 @@ bool Route::startRoute(const go_t routeType, const int16 objId, int16 cx, int16
bool foundFl = false; // TRUE if route found ok
if ((foundFl = findRoute(cx, cy))) { // Found a route?
_routeIndex = _routeListIndex; // Node index
- _vm->_hero->vx = _vm->_hero->vy = 0; // Stop manual motion
+ _vm->_hero->_vx = _vm->_hero->_vy = 0; // Stop manual motion
}
return foundFl;
diff --git a/engines/hugo/route.h b/engines/hugo/route.h
index a95dd2151b..716829a201 100644
--- a/engines/hugo/route.h
+++ b/engines/hugo/route.h
@@ -30,21 +30,18 @@
#ifndef HUGO_ROUTE_H
#define HUGO_ROUTE_H
+#include "common/rect.h"
+
namespace Hugo {
/**
* Purpose of an automatic route
*/
-enum go_t {kRouteSpace, kRouteExit, kRouteLook, kRouteGet};
-
-struct Point {
- int x;
- int y;
-};
+enum RouteType {kRouteSpace, kRouteExit, kRouteLook, kRouteGet};
-struct segment_t { // Search segment
- int16 y; // y position
- int16 x1, x2; // Range of segment
+struct Segment { // Search segment
+ int16 _y; // y position
+ int16 _x1, _x2; // Range of segment
};
class Route {
@@ -55,7 +52,7 @@ public:
int16 getRouteIndex() const;
void processRoute();
- bool startRoute(const go_t routeType, const int16 objId, int16 cx, int16 cy);
+ bool startRoute(const RouteType routeType, const int16 objId, int16 cx, int16 cy);
void setDirection(const uint16 keyCode);
void setWalk(const uint16 direction);
@@ -69,13 +66,13 @@ private:
uint16 _oldWalkDirection; // Last direction char
- int16 _routeIndex; // Index into route list, or -1
- go_t _routeType; // Purpose of an automatic route
- int16 _routeObjId; // Index of exit of object walking to
+ int16 _routeIndex; // Index into route list, or -1
+ RouteType _routeType; // Purpose of an automatic route
+ int16 _routeObjId; // Index of exit of object walking to
byte _boundaryMap[kYPix][kXPix]; // Boundary byte map
- segment_t _segment[kMaxSeg]; // List of points in fill-path
- Point _route[kMaxNodes]; // List of nodes in route (global)
+ Segment _segment[kMaxSeg]; // List of points in fill-path
+ Common::Point _route[kMaxNodes]; // List of nodes in route (global)
int16 _segmentNumb; // Count number of segments
int16 _routeListIndex; // Index into route list
int16 _destX;
@@ -87,7 +84,7 @@ private:
void segment(int16 x, int16 y);
bool findRoute(const int16 cx, const int16 cy);
- Point *newNode();
+ Common::Point *newNode();
};
} // End of namespace Hugo
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 896e8fa2ce..32b8a47df7 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -66,15 +66,15 @@ void Scheduler::initCypher() {
void Scheduler::initEventQueue() {
debugC(1, kDebugSchedule, "initEventQueue");
- // Chain next_p from first to last
+ // Chain nextEvent from first to last
for (int i = kMaxEvents; --i;)
- _events[i - 1].nextEvent = &_events[i];
- _events[kMaxEvents - 1].nextEvent = 0;
+ _events[i - 1]._nextEvent = &_events[i];
+ _events[kMaxEvents - 1]._nextEvent = 0;
- // Chain prev_p from last to first
+ // Chain prevEvent from last to first
for (int i = 1; i < kMaxEvents; i++)
- _events[i].prevEvent = &_events[i - 1];
- _events[0].prevEvent = 0;
+ _events[i]._prevEvent = &_events[i - 1];
+ _events[0]._prevEvent = 0;
_headEvent = _tailEvent = 0; // Event list is empty
_freeEvent = _events; // Free list is full
@@ -83,14 +83,14 @@ void Scheduler::initEventQueue() {
/**
* Return a ptr to an event structure from the free list
*/
-event_t *Scheduler::getQueue() {
+Event *Scheduler::getQueue() {
debugC(4, kDebugSchedule, "getQueue");
if (!_freeEvent) // Error: no more events available
error("An error has occurred: %s", "getQueue");
- event_t *resEvent = _freeEvent;
- _freeEvent = _freeEvent->nextEvent;
- resEvent->nextEvent = 0;
+ Event *resEvent = _freeEvent;
+ _freeEvent = _freeEvent->_nextEvent;
+ resEvent->_nextEvent = 0;
return resEvent;
}
@@ -101,7 +101,7 @@ void Scheduler::insertActionList(const uint16 actIndex) {
debugC(1, kDebugSchedule, "insertActionList(%d)", actIndex);
if (_actListArr[actIndex]) {
- for (int i = 0; _actListArr[actIndex][i].a0.actType != ANULL; i++)
+ for (int i = 0; _actListArr[actIndex][i]._a0._actType != ANULL; i++)
insertAction(&_actListArr[actIndex][i]);
}
}
@@ -112,7 +112,7 @@ void Scheduler::insertActionList(const uint16 actIndex) {
uint32 Scheduler::getWinTicks() const {
debugC(5, kDebugSchedule, "getWinTicks()");
- return _vm->getGameStatus().tick;
+ return _vm->getGameStatus()._tick;
}
/**
@@ -147,9 +147,9 @@ uint32 Scheduler::getDosTicks(const bool updateFl) {
void Scheduler::processBonus(const int bonusIndex) {
debugC(1, kDebugSchedule, "processBonus(%d)", bonusIndex);
- if (!_points[bonusIndex].scoredFl) {
- _vm->adjustScore(_points[bonusIndex].score);
- _points[bonusIndex].scoredFl = true;
+ if (!_points[bonusIndex]._scoredFl) {
+ _vm->adjustScore(_points[bonusIndex]._score);
+ _points[bonusIndex]._scoredFl = true;
}
}
@@ -175,11 +175,11 @@ void Scheduler::newScreen(const int screenIndex) {
}
// 1. Clear out all local events
- event_t *curEvent = _headEvent; // The earliest event
- event_t *wrkEvent; // Event ptr
+ Event *curEvent = _headEvent; // The earliest event
+ Event *wrkEvent; // Event ptr
while (curEvent) { // While mature events found
- wrkEvent = curEvent->nextEvent; // Save p (becomes undefined after Del)
- if (curEvent->localActionFl)
+ wrkEvent = curEvent->_nextEvent; // Save p (becomes undefined after Del)
+ if (curEvent->_localActionFl)
delQueue(curEvent); // Return event to free list
curEvent = wrkEvent;
}
@@ -259,10 +259,10 @@ void Scheduler::loadPoints(Common::SeekableReadStream &in) {
uint16 numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant) {
_numBonuses = numElem;
- _points = (point_t *)malloc(sizeof(point_t) * _numBonuses);
+ _points = (Point *)malloc(sizeof(Point) * _numBonuses);
for (int i = 0; i < _numBonuses; i++) {
- _points[i].score = in.readByte();
- _points[i].scoredFl = false;
+ _points[i]._score = in.readByte();
+ _points[i]._scoredFl = false;
}
} else {
in.skip(numElem);
@@ -270,280 +270,280 @@ void Scheduler::loadPoints(Common::SeekableReadStream &in) {
}
}
-void Scheduler::readAct(Common::ReadStream &in, act &curAct) {
+void Scheduler::readAct(Common::ReadStream &in, Act &curAct) {
uint16 numSubAct;
- curAct.a0.actType = (action_t) in.readByte();
- switch (curAct.a0.actType) {
+ curAct._a0._actType = (Action) in.readByte();
+ switch (curAct._a0._actType) {
case ANULL: // -1
break;
case ASCHEDULE: // 0
- curAct.a0.timer = in.readSint16BE();
- curAct.a0.actIndex = in.readUint16BE();
+ curAct._a0._timer = in.readSint16BE();
+ curAct._a0._actIndex = in.readUint16BE();
break;
case START_OBJ: // 1
- curAct.a1.timer = in.readSint16BE();
- curAct.a1.objIndex = in.readSint16BE();
- curAct.a1.cycleNumb = in.readSint16BE();
- curAct.a1.cycle = (cycle_t) in.readByte();
+ curAct._a1._timer = in.readSint16BE();
+ curAct._a1._objIndex = in.readSint16BE();
+ curAct._a1._cycleNumb = in.readSint16BE();
+ curAct._a1._cycle = (Cycle) in.readByte();
break;
case INIT_OBJXY: // 2
- curAct.a2.timer = in.readSint16BE();
- curAct.a2.objIndex = in.readSint16BE();
- curAct.a2.x = in.readSint16BE();
- curAct.a2.y = in.readSint16BE();
+ curAct._a2._timer = in.readSint16BE();
+ curAct._a2._objIndex = in.readSint16BE();
+ curAct._a2._x = in.readSint16BE();
+ curAct._a2._y = in.readSint16BE();
break;
case PROMPT: // 3
- curAct.a3.timer = in.readSint16BE();
- curAct.a3.promptIndex = in.readSint16BE();
+ curAct._a3._timer = in.readSint16BE();
+ curAct._a3._promptIndex = in.readSint16BE();
numSubAct = in.readUint16BE();
- curAct.a3.responsePtr = (int *)malloc(sizeof(int) * numSubAct);
+ curAct._a3._responsePtr = (int *)malloc(sizeof(int) * numSubAct);
for (int k = 0; k < numSubAct; k++)
- curAct.a3.responsePtr[k] = in.readSint16BE();
- curAct.a3.actPassIndex = in.readUint16BE();
- curAct.a3.actFailIndex = in.readUint16BE();
- curAct.a3.encodedFl = (in.readByte() == 1) ? true : false;
+ curAct._a3._responsePtr[k] = in.readSint16BE();
+ curAct._a3._actPassIndex = in.readUint16BE();
+ curAct._a3._actFailIndex = in.readUint16BE();
+ curAct._a3._encodedFl = (in.readByte() == 1) ? true : false;
break;
case BKGD_COLOR: // 4
- curAct.a4.timer = in.readSint16BE();
- curAct.a4.newBackgroundColor = in.readUint32BE();
+ curAct._a4._timer = in.readSint16BE();
+ curAct._a4._newBackgroundColor = in.readUint32BE();
break;
case INIT_OBJVXY: // 5
- curAct.a5.timer = in.readSint16BE();
- curAct.a5.objIndex = in.readSint16BE();
- curAct.a5.vx = in.readSint16BE();
- curAct.a5.vy = in.readSint16BE();
+ curAct._a5._timer = in.readSint16BE();
+ curAct._a5._objIndex = in.readSint16BE();
+ curAct._a5._vx = in.readSint16BE();
+ curAct._a5._vy = in.readSint16BE();
break;
case INIT_CARRY: // 6
- curAct.a6.timer = in.readSint16BE();
- curAct.a6.objIndex = in.readSint16BE();
- curAct.a6.carriedFl = (in.readByte() == 1) ? true : false;
+ curAct._a6._timer = in.readSint16BE();
+ curAct._a6._objIndex = in.readSint16BE();
+ curAct._a6._carriedFl = (in.readByte() == 1) ? true : false;
break;
case INIT_HF_COORD: // 7
- curAct.a7.timer = in.readSint16BE();
- curAct.a7.objIndex = in.readSint16BE();
+ curAct._a7._timer = in.readSint16BE();
+ curAct._a7._objIndex = in.readSint16BE();
break;
case NEW_SCREEN: // 8
- curAct.a8.timer = in.readSint16BE();
- curAct.a8.screenIndex = in.readSint16BE();
+ curAct._a8._timer = in.readSint16BE();
+ curAct._a8._screenIndex = in.readSint16BE();
break;
case INIT_OBJSTATE: // 9
- curAct.a9.timer = in.readSint16BE();
- curAct.a9.objIndex = in.readSint16BE();
- curAct.a9.newState = in.readByte();
+ curAct._a9._timer = in.readSint16BE();
+ curAct._a9._objIndex = in.readSint16BE();
+ curAct._a9._newState = in.readByte();
break;
case INIT_PATH: // 10
- curAct.a10.timer = in.readSint16BE();
- curAct.a10.objIndex = in.readSint16BE();
- curAct.a10.newPathType = in.readSint16BE();
- curAct.a10.vxPath = in.readByte();
- curAct.a10.vyPath = in.readByte();
+ curAct._a10._timer = in.readSint16BE();
+ curAct._a10._objIndex = in.readSint16BE();
+ curAct._a10._newPathType = in.readSint16BE();
+ curAct._a10._vxPath = in.readByte();
+ curAct._a10._vyPath = in.readByte();
break;
case COND_R: // 11
- curAct.a11.timer = in.readSint16BE();
- curAct.a11.objIndex = in.readSint16BE();
- curAct.a11.stateReq = in.readByte();
- curAct.a11.actPassIndex = in.readUint16BE();
- curAct.a11.actFailIndex = in.readUint16BE();
+ curAct._a11._timer = in.readSint16BE();
+ curAct._a11._objIndex = in.readSint16BE();
+ curAct._a11._stateReq = in.readByte();
+ curAct._a11._actPassIndex = in.readUint16BE();
+ curAct._a11._actFailIndex = in.readUint16BE();
break;
case TEXT: // 12
- curAct.a12.timer = in.readSint16BE();
- curAct.a12.stringIndex = in.readSint16BE();
+ curAct._a12._timer = in.readSint16BE();
+ curAct._a12._stringIndex = in.readSint16BE();
break;
case SWAP_IMAGES: // 13
- curAct.a13.timer = in.readSint16BE();
- curAct.a13.objIndex1 = in.readSint16BE();
- curAct.a13.objIndex2 = in.readSint16BE();
+ curAct._a13._timer = in.readSint16BE();
+ curAct._a13._objIndex1 = in.readSint16BE();
+ curAct._a13._objIndex2 = in.readSint16BE();
break;
case COND_SCR: // 14
- curAct.a14.timer = in.readSint16BE();
- curAct.a14.objIndex = in.readSint16BE();
- curAct.a14.screenReq = in.readSint16BE();
- curAct.a14.actPassIndex = in.readUint16BE();
- curAct.a14.actFailIndex = in.readUint16BE();
+ curAct._a14._timer = in.readSint16BE();
+ curAct._a14._objIndex = in.readSint16BE();
+ curAct._a14._screenReq = in.readSint16BE();
+ curAct._a14._actPassIndex = in.readUint16BE();
+ curAct._a14._actFailIndex = in.readUint16BE();
break;
case AUTOPILOT: // 15
- curAct.a15.timer = in.readSint16BE();
- curAct.a15.objIndex1 = in.readSint16BE();
- curAct.a15.objIndex2 = in.readSint16BE();
- curAct.a15.dx = in.readByte();
- curAct.a15.dy = in.readByte();
+ curAct._a15._timer = in.readSint16BE();
+ curAct._a15._objIndex1 = in.readSint16BE();
+ curAct._a15._objIndex2 = in.readSint16BE();
+ curAct._a15._dx = in.readByte();
+ curAct._a15._dy = in.readByte();
break;
case INIT_OBJ_SEQ: // 16
- curAct.a16.timer = in.readSint16BE();
- curAct.a16.objIndex = in.readSint16BE();
- curAct.a16.seqIndex = in.readSint16BE();
+ curAct._a16._timer = in.readSint16BE();
+ curAct._a16._objIndex = in.readSint16BE();
+ curAct._a16._seqIndex = in.readSint16BE();
break;
case SET_STATE_BITS: // 17
- curAct.a17.timer = in.readSint16BE();
- curAct.a17.objIndex = in.readSint16BE();
- curAct.a17.stateMask = in.readSint16BE();
+ curAct._a17._timer = in.readSint16BE();
+ curAct._a17._objIndex = in.readSint16BE();
+ curAct._a17._stateMask = in.readSint16BE();
break;
case CLEAR_STATE_BITS: // 18
- curAct.a18.timer = in.readSint16BE();
- curAct.a18.objIndex = in.readSint16BE();
- curAct.a18.stateMask = in.readSint16BE();
+ curAct._a18._timer = in.readSint16BE();
+ curAct._a18._objIndex = in.readSint16BE();
+ curAct._a18._stateMask = in.readSint16BE();
break;
case TEST_STATE_BITS: // 19
- curAct.a19.timer = in.readSint16BE();
- curAct.a19.objIndex = in.readSint16BE();
- curAct.a19.stateMask = in.readSint16BE();
- curAct.a19.actPassIndex = in.readUint16BE();
- curAct.a19.actFailIndex = in.readUint16BE();
+ curAct._a19._timer = in.readSint16BE();
+ curAct._a19._objIndex = in.readSint16BE();
+ curAct._a19._stateMask = in.readSint16BE();
+ curAct._a19._actPassIndex = in.readUint16BE();
+ curAct._a19._actFailIndex = in.readUint16BE();
break;
case DEL_EVENTS: // 20
- curAct.a20.timer = in.readSint16BE();
- curAct.a20.actTypeDel = (action_t) in.readByte();
+ curAct._a20._timer = in.readSint16BE();
+ curAct._a20._actTypeDel = (Action) in.readByte();
break;
case GAMEOVER: // 21
- curAct.a21.timer = in.readSint16BE();
+ curAct._a21._timer = in.readSint16BE();
break;
case INIT_HH_COORD: // 22
- curAct.a22.timer = in.readSint16BE();
- curAct.a22.objIndex = in.readSint16BE();
+ curAct._a22._timer = in.readSint16BE();
+ curAct._a22._objIndex = in.readSint16BE();
break;
case EXIT: // 23
- curAct.a23.timer = in.readSint16BE();
+ curAct._a23._timer = in.readSint16BE();
break;
case BONUS: // 24
- curAct.a24.timer = in.readSint16BE();
- curAct.a24.pointIndex = in.readSint16BE();
+ curAct._a24._timer = in.readSint16BE();
+ curAct._a24._pointIndex = in.readSint16BE();
break;
case COND_BOX: // 25
- curAct.a25.timer = in.readSint16BE();
- curAct.a25.objIndex = in.readSint16BE();
- curAct.a25.x1 = in.readSint16BE();
- curAct.a25.y1 = in.readSint16BE();
- curAct.a25.x2 = in.readSint16BE();
- curAct.a25.y2 = in.readSint16BE();
- curAct.a25.actPassIndex = in.readUint16BE();
- curAct.a25.actFailIndex = in.readUint16BE();
+ curAct._a25._timer = in.readSint16BE();
+ curAct._a25._objIndex = in.readSint16BE();
+ curAct._a25._x1 = in.readSint16BE();
+ curAct._a25._y1 = in.readSint16BE();
+ curAct._a25._x2 = in.readSint16BE();
+ curAct._a25._y2 = in.readSint16BE();
+ curAct._a25._actPassIndex = in.readUint16BE();
+ curAct._a25._actFailIndex = in.readUint16BE();
break;
case SOUND: // 26
- curAct.a26.timer = in.readSint16BE();
- curAct.a26.soundIndex = in.readSint16BE();
+ curAct._a26._timer = in.readSint16BE();
+ curAct._a26._soundIndex = in.readSint16BE();
break;
case ADD_SCORE: // 27
- curAct.a27.timer = in.readSint16BE();
- curAct.a27.objIndex = in.readSint16BE();
+ curAct._a27._timer = in.readSint16BE();
+ curAct._a27._objIndex = in.readSint16BE();
break;
case SUB_SCORE: // 28
- curAct.a28.timer = in.readSint16BE();
- curAct.a28.objIndex = in.readSint16BE();
+ curAct._a28._timer = in.readSint16BE();
+ curAct._a28._objIndex = in.readSint16BE();
break;
case COND_CARRY: // 29
- curAct.a29.timer = in.readSint16BE();
- curAct.a29.objIndex = in.readSint16BE();
- curAct.a29.actPassIndex = in.readUint16BE();
- curAct.a29.actFailIndex = in.readUint16BE();
+ curAct._a29._timer = in.readSint16BE();
+ curAct._a29._objIndex = in.readSint16BE();
+ curAct._a29._actPassIndex = in.readUint16BE();
+ curAct._a29._actFailIndex = in.readUint16BE();
break;
case INIT_MAZE: // 30
- curAct.a30.timer = in.readSint16BE();
- curAct.a30.mazeSize = in.readByte();
- curAct.a30.x1 = in.readSint16BE();
- curAct.a30.y1 = in.readSint16BE();
- curAct.a30.x2 = in.readSint16BE();
- curAct.a30.y2 = in.readSint16BE();
- curAct.a30.x3 = in.readSint16BE();
- curAct.a30.x4 = in.readSint16BE();
- curAct.a30.firstScreenIndex = in.readByte();
+ curAct._a30._timer = in.readSint16BE();
+ curAct._a30._mazeSize = in.readByte();
+ curAct._a30._x1 = in.readSint16BE();
+ curAct._a30._y1 = in.readSint16BE();
+ curAct._a30._x2 = in.readSint16BE();
+ curAct._a30._y2 = in.readSint16BE();
+ curAct._a30._x3 = in.readSint16BE();
+ curAct._a30._x4 = in.readSint16BE();
+ curAct._a30._firstScreenIndex = in.readByte();
break;
case EXIT_MAZE: // 31
- curAct.a31.timer = in.readSint16BE();
+ curAct._a31._timer = in.readSint16BE();
break;
case INIT_PRIORITY: // 32
- curAct.a32.timer = in.readSint16BE();
- curAct.a32.objIndex = in.readSint16BE();
- curAct.a32.priority = in.readByte();
+ curAct._a32._timer = in.readSint16BE();
+ curAct._a32._objIndex = in.readSint16BE();
+ curAct._a32._priority = in.readByte();
break;
case INIT_SCREEN: // 33
- curAct.a33.timer = in.readSint16BE();
- curAct.a33.objIndex = in.readSint16BE();
- curAct.a33.screenIndex = in.readSint16BE();
+ curAct._a33._timer = in.readSint16BE();
+ curAct._a33._objIndex = in.readSint16BE();
+ curAct._a33._screenIndex = in.readSint16BE();
break;
case AGSCHEDULE: // 34
- curAct.a34.timer = in.readSint16BE();
- curAct.a34.actIndex = in.readUint16BE();
+ curAct._a34._timer = in.readSint16BE();
+ curAct._a34._actIndex = in.readUint16BE();
break;
case REMAPPAL: // 35
- curAct.a35.timer = in.readSint16BE();
- curAct.a35.oldColorIndex = in.readSint16BE();
- curAct.a35.newColorIndex = in.readSint16BE();
+ curAct._a35._timer = in.readSint16BE();
+ curAct._a35._oldColorIndex = in.readSint16BE();
+ curAct._a35._newColorIndex = in.readSint16BE();
break;
case COND_NOUN: // 36
- curAct.a36.timer = in.readSint16BE();
- curAct.a36.nounIndex = in.readUint16BE();
- curAct.a36.actPassIndex = in.readUint16BE();
- curAct.a36.actFailIndex = in.readUint16BE();
+ curAct._a36._timer = in.readSint16BE();
+ curAct._a36._nounIndex = in.readUint16BE();
+ curAct._a36._actPassIndex = in.readUint16BE();
+ curAct._a36._actFailIndex = in.readUint16BE();
break;
case SCREEN_STATE: // 37
- curAct.a37.timer = in.readSint16BE();
- curAct.a37.screenIndex = in.readSint16BE();
- curAct.a37.newState = in.readByte();
+ curAct._a37._timer = in.readSint16BE();
+ curAct._a37._screenIndex = in.readSint16BE();
+ curAct._a37._newState = in.readByte();
break;
case INIT_LIPS: // 38
- curAct.a38.timer = in.readSint16BE();
- curAct.a38.lipsObjIndex = in.readSint16BE();
- curAct.a38.objIndex = in.readSint16BE();
- curAct.a38.dxLips = in.readByte();
- curAct.a38.dyLips = in.readByte();
+ curAct._a38._timer = in.readSint16BE();
+ curAct._a38._lipsObjIndex = in.readSint16BE();
+ curAct._a38._objIndex = in.readSint16BE();
+ curAct._a38._dxLips = in.readByte();
+ curAct._a38._dyLips = in.readByte();
break;
case INIT_STORY_MODE: // 39
- curAct.a39.timer = in.readSint16BE();
- curAct.a39.storyModeFl = (in.readByte() == 1);
+ curAct._a39._timer = in.readSint16BE();
+ curAct._a39._storyModeFl = (in.readByte() == 1);
break;
case WARN: // 40
- curAct.a40.timer = in.readSint16BE();
- curAct.a40.stringIndex = in.readSint16BE();
+ curAct._a40._timer = in.readSint16BE();
+ curAct._a40._stringIndex = in.readSint16BE();
break;
case COND_BONUS: // 41
- curAct.a41.timer = in.readSint16BE();
- curAct.a41.BonusIndex = in.readSint16BE();
- curAct.a41.actPassIndex = in.readUint16BE();
- curAct.a41.actFailIndex = in.readUint16BE();
+ curAct._a41._timer = in.readSint16BE();
+ curAct._a41._bonusIndex = in.readSint16BE();
+ curAct._a41._actPassIndex = in.readUint16BE();
+ curAct._a41._actFailIndex = in.readUint16BE();
break;
case TEXT_TAKE: // 42
- curAct.a42.timer = in.readSint16BE();
- curAct.a42.objIndex = in.readSint16BE();
+ curAct._a42._timer = in.readSint16BE();
+ curAct._a42._objIndex = in.readSint16BE();
break;
case YESNO: // 43
- curAct.a43.timer = in.readSint16BE();
- curAct.a43.promptIndex = in.readSint16BE();
- curAct.a43.actYesIndex = in.readUint16BE();
- curAct.a43.actNoIndex = in.readUint16BE();
+ curAct._a43._timer = in.readSint16BE();
+ curAct._a43._promptIndex = in.readSint16BE();
+ curAct._a43._actYesIndex = in.readUint16BE();
+ curAct._a43._actNoIndex = in.readUint16BE();
break;
case STOP_ROUTE: // 44
- curAct.a44.timer = in.readSint16BE();
+ curAct._a44._timer = in.readSint16BE();
break;
case COND_ROUTE: // 45
- curAct.a45.timer = in.readSint16BE();
- curAct.a45.routeIndex = in.readSint16BE();
- curAct.a45.actPassIndex = in.readUint16BE();
- curAct.a45.actFailIndex = in.readUint16BE();
+ curAct._a45._timer = in.readSint16BE();
+ curAct._a45._routeIndex = in.readSint16BE();
+ curAct._a45._actPassIndex = in.readUint16BE();
+ curAct._a45._actFailIndex = in.readUint16BE();
break;
case INIT_JUMPEXIT: // 46
- curAct.a46.timer = in.readSint16BE();
- curAct.a46.jumpExitFl = (in.readByte() == 1);
+ curAct._a46._timer = in.readSint16BE();
+ curAct._a46._jumpExitFl = (in.readByte() == 1);
break;
case INIT_VIEW: // 47
- curAct.a47.timer = in.readSint16BE();
- curAct.a47.objIndex = in.readSint16BE();
- curAct.a47.viewx = in.readSint16BE();
- curAct.a47.viewy = in.readSint16BE();
- curAct.a47.direction = in.readSint16BE();
+ curAct._a47._timer = in.readSint16BE();
+ curAct._a47._objIndex = in.readSint16BE();
+ curAct._a47._viewx = in.readSint16BE();
+ curAct._a47._viewy = in.readSint16BE();
+ curAct._a47._direction = in.readSint16BE();
break;
case INIT_OBJ_FRAME: // 48
- curAct.a48.timer = in.readSint16BE();
- curAct.a48.objIndex = in.readSint16BE();
- curAct.a48.seqIndex = in.readSint16BE();
- curAct.a48.frameIndex = in.readSint16BE();
+ curAct._a48._timer = in.readSint16BE();
+ curAct._a48._objIndex = in.readSint16BE();
+ curAct._a48._seqIndex = in.readSint16BE();
+ curAct._a48._frameIndex = in.readSint16BE();
break;
case OLD_SONG: //49
- curAct.a49.timer = in.readSint16BE();
- curAct.a49.songIndex = in.readUint16BE();
+ curAct._a49._timer = in.readSint16BE();
+ curAct._a49._songIndex = in.readUint16BE();
break;
default:
- error("Engine - Unknown action type encountered: %d", curAct.a0.actType);
+ error("Engine - Unknown action type encountered: %d", curAct._a0._actType);
}
}
@@ -553,32 +553,32 @@ void Scheduler::readAct(Common::ReadStream &in, act &curAct) {
void Scheduler::loadActListArr(Common::ReadStream &in) {
debugC(6, kDebugSchedule, "loadActListArr(&in)");
- act tmpAct;
+ Act tmpAct;
int numElem, numSubElem;
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant) {
_actListArrSize = numElem;
- _actListArr = (act **)malloc(sizeof(act *) * _actListArrSize);
+ _actListArr = (Act **)malloc(sizeof(Act *) * _actListArrSize);
}
for (int i = 0; i < numElem; i++) {
numSubElem = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _actListArr[i] = (act *)malloc(sizeof(act) * (numSubElem + 1));
+ _actListArr[i] = (Act *)malloc(sizeof(Act) * (numSubElem + 1));
for (int j = 0; j < numSubElem; j++) {
if (varnt == _vm->_gameVariant) {
readAct(in, _actListArr[i][j]);
} else {
readAct(in, tmpAct);
- if (tmpAct.a0.actType == PROMPT)
- free(tmpAct.a3.responsePtr);
+ if (tmpAct._a0._actType == PROMPT)
+ free(tmpAct._a3._responsePtr);
}
}
if (varnt == _vm->_gameVariant)
- _actListArr[i][numSubElem].a0.actType = ANULL;
+ _actListArr[i][numSubElem]._a0._actType = ANULL;
}
}
}
@@ -626,9 +626,9 @@ void Scheduler::freeScheduler() {
if (_actListArr) {
for (int i = 0; i < _actListArrSize; i++) {
- for (int j = 0; _actListArr[i][j].a0.actType != ANULL; j++) {
- if (_actListArr[i][j].a0.actType == PROMPT)
- free(_actListArr[i][j].a3.responsePtr);
+ for (int j = 0; _actListArr[i][j]._a0._actType != ANULL; j++) {
+ if (_actListArr[i][j]._a0._actType == PROMPT)
+ free(_actListArr[i][j]._a3._responsePtr);
}
free(_actListArr[i]);
}
@@ -656,32 +656,32 @@ void Scheduler::screenActions(const int screenNum) {
void Scheduler::processMaze(const int x1, const int x2, const int y1, const int y2) {
debugC(1, kDebugSchedule, "processMaze");
- if (x1 < _vm->_maze.x1) {
+ if (x1 < _vm->_maze._x1) {
// Exit west
- _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - 1;
- _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x2 - kShiftSize - (x2 - x1);
- _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->y;
+ _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr - 1;
+ _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x2 - kShiftSize - (x2 - x1);
+ _actListArr[_alNewscrIndex][0]._a2._y = _vm->_hero->_y;
_vm->_route->resetRoute();
insertActionList(_alNewscrIndex);
- } else if (x2 > _vm->_maze.x2) {
+ } else if (x2 > _vm->_maze._x2) {
// Exit east
- _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + 1;
- _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x1 + kShiftSize;
- _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->y;
+ _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr + 1;
+ _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x1 + kShiftSize;
+ _actListArr[_alNewscrIndex][0]._a2._y = _vm->_hero->_y;
_vm->_route->resetRoute();
insertActionList(_alNewscrIndex);
- } else if (y1 < _vm->_maze.y1 - kShiftSize) {
+ } else if (y1 < _vm->_maze._y1 - kShiftSize) {
// Exit north
- _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - _vm->_maze.size;
- _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x3;
- _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze.y2 - kShiftSize - (y2 - y1);
+ _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr - _vm->_maze._size;
+ _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x3;
+ _actListArr[_alNewscrIndex][0]._a2._y = _vm->_maze._y2 - kShiftSize - (y2 - y1);
_vm->_route->resetRoute();
insertActionList(_alNewscrIndex);
- } else if (y2 > _vm->_maze.y2 - kShiftSize / 2) {
+ } else if (y2 > _vm->_maze._y2 - kShiftSize / 2) {
// Exit south
- _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + _vm->_maze.size;
- _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x4;
- _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze.y1 + kShiftSize;
+ _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr + _vm->_maze._size;
+ _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x4;
+ _actListArr[_alNewscrIndex][0]._a2._y = _vm->_maze._y1 + kShiftSize;
_vm->_route->resetRoute();
insertActionList(_alNewscrIndex);
}
@@ -708,17 +708,17 @@ void Scheduler::saveEvents(Common::WriteStream *f) {
// Convert event ptrs to indexes
for (int16 i = 0; i < kMaxEvents; i++) {
- event_t *wrkEvent = &_events[i];
+ Event *wrkEvent = &_events[i];
// fix up action pointer (to do better)
int16 index, subElem;
- findAction(wrkEvent->action, &index, &subElem);
+ findAction(wrkEvent->_action, &index, &subElem);
f->writeSint16BE(index);
f->writeSint16BE(subElem);
- f->writeByte((wrkEvent->localActionFl) ? 1 : 0);
- f->writeUint32BE(wrkEvent->time);
- f->writeSint16BE((wrkEvent->prevEvent == 0) ? -1 : (wrkEvent->prevEvent - _events));
- f->writeSint16BE((wrkEvent->nextEvent == 0) ? -1 : (wrkEvent->nextEvent - _events));
+ f->writeByte((wrkEvent->_localActionFl) ? 1 : 0);
+ f->writeUint32BE(wrkEvent->_time);
+ f->writeSint16BE((wrkEvent->_prevEvent == 0) ? -1 : (wrkEvent->_prevEvent - _events));
+ f->writeSint16BE((wrkEvent->_nextEvent == 0) ? -1 : (wrkEvent->_nextEvent - _events));
}
}
@@ -738,7 +738,7 @@ void Scheduler::restoreActions(Common::ReadStream *f) {
int16 Scheduler::calcMaxPoints() const {
int16 tmpScore = 0;
for (int i = 0; i < _numBonuses; i++)
- tmpScore += _points[i].score;
+ tmpScore += _points[i]._score;
return tmpScore;
}
@@ -752,282 +752,282 @@ void Scheduler::saveActions(Common::WriteStream *f) const {
for (int i = 0; i < _actListArrSize; i++) {
// write all the sub elems data
- for (nbrSubElem = 1; _actListArr[i][nbrSubElem - 1].a0.actType != ANULL; nbrSubElem++)
+ for (nbrSubElem = 1; _actListArr[i][nbrSubElem - 1]._a0._actType != ANULL; nbrSubElem++)
;
f->writeUint16BE(nbrSubElem);
for (int j = 0; j < nbrSubElem; j++) {
- subElemType = _actListArr[i][j].a0.actType;
+ subElemType = _actListArr[i][j]._a0._actType;
f->writeByte(subElemType);
switch (subElemType) {
case ANULL: // -1
break;
case ASCHEDULE: // 0
- f->writeSint16BE(_actListArr[i][j].a0.timer);
- f->writeUint16BE(_actListArr[i][j].a0.actIndex);
+ f->writeSint16BE(_actListArr[i][j]._a0._timer);
+ f->writeUint16BE(_actListArr[i][j]._a0._actIndex);
break;
case START_OBJ: // 1
- f->writeSint16BE(_actListArr[i][j].a1.timer);
- f->writeSint16BE(_actListArr[i][j].a1.objIndex);
- f->writeSint16BE(_actListArr[i][j].a1.cycleNumb);
- f->writeByte(_actListArr[i][j].a1.cycle);
+ f->writeSint16BE(_actListArr[i][j]._a1._timer);
+ f->writeSint16BE(_actListArr[i][j]._a1._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a1._cycleNumb);
+ f->writeByte(_actListArr[i][j]._a1._cycle);
break;
case INIT_OBJXY: // 2
- f->writeSint16BE(_actListArr[i][j].a2.timer);
- f->writeSint16BE(_actListArr[i][j].a2.objIndex);
- f->writeSint16BE(_actListArr[i][j].a2.x);
- f->writeSint16BE(_actListArr[i][j].a2.y);
+ f->writeSint16BE(_actListArr[i][j]._a2._timer);
+ f->writeSint16BE(_actListArr[i][j]._a2._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a2._x);
+ f->writeSint16BE(_actListArr[i][j]._a2._y);
break;
case PROMPT: // 3
- f->writeSint16BE(_actListArr[i][j].a3.timer);
- f->writeSint16BE(_actListArr[i][j].a3.promptIndex);
- for (nbrCpt = 0; _actListArr[i][j].a3.responsePtr[nbrCpt] != -1; nbrCpt++)
+ f->writeSint16BE(_actListArr[i][j]._a3._timer);
+ f->writeSint16BE(_actListArr[i][j]._a3._promptIndex);
+ for (nbrCpt = 0; _actListArr[i][j]._a3._responsePtr[nbrCpt] != -1; nbrCpt++)
;
nbrCpt++;
f->writeUint16BE(nbrCpt);
for (int k = 0; k < nbrCpt; k++)
- f->writeSint16BE(_actListArr[i][j].a3.responsePtr[k]);
- f->writeUint16BE(_actListArr[i][j].a3.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a3.actFailIndex);
- f->writeByte((_actListArr[i][j].a3.encodedFl) ? 1 : 0);
+ f->writeSint16BE(_actListArr[i][j]._a3._responsePtr[k]);
+ f->writeUint16BE(_actListArr[i][j]._a3._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a3._actFailIndex);
+ f->writeByte((_actListArr[i][j]._a3._encodedFl) ? 1 : 0);
break;
case BKGD_COLOR: // 4
- f->writeSint16BE(_actListArr[i][j].a4.timer);
- f->writeUint32BE(_actListArr[i][j].a4.newBackgroundColor);
+ f->writeSint16BE(_actListArr[i][j]._a4._timer);
+ f->writeUint32BE(_actListArr[i][j]._a4._newBackgroundColor);
break;
case INIT_OBJVXY: // 5
- f->writeSint16BE(_actListArr[i][j].a5.timer);
- f->writeSint16BE(_actListArr[i][j].a5.objIndex);
- f->writeSint16BE(_actListArr[i][j].a5.vx);
- f->writeSint16BE(_actListArr[i][j].a5.vy);
+ f->writeSint16BE(_actListArr[i][j]._a5._timer);
+ f->writeSint16BE(_actListArr[i][j]._a5._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a5._vx);
+ f->writeSint16BE(_actListArr[i][j]._a5._vy);
break;
case INIT_CARRY: // 6
- f->writeSint16BE(_actListArr[i][j].a6.timer);
- f->writeSint16BE(_actListArr[i][j].a6.objIndex);
- f->writeByte((_actListArr[i][j].a6.carriedFl) ? 1 : 0);
+ f->writeSint16BE(_actListArr[i][j]._a6._timer);
+ f->writeSint16BE(_actListArr[i][j]._a6._objIndex);
+ f->writeByte((_actListArr[i][j]._a6._carriedFl) ? 1 : 0);
break;
case INIT_HF_COORD: // 7
- f->writeSint16BE(_actListArr[i][j].a7.timer);
- f->writeSint16BE(_actListArr[i][j].a7.objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a7._timer);
+ f->writeSint16BE(_actListArr[i][j]._a7._objIndex);
break;
case NEW_SCREEN: // 8
- f->writeSint16BE(_actListArr[i][j].a8.timer);
- f->writeSint16BE(_actListArr[i][j].a8.screenIndex);
+ f->writeSint16BE(_actListArr[i][j]._a8._timer);
+ f->writeSint16BE(_actListArr[i][j]._a8._screenIndex);
break;
case INIT_OBJSTATE: // 9
- f->writeSint16BE(_actListArr[i][j].a9.timer);
- f->writeSint16BE(_actListArr[i][j].a9.objIndex);
- f->writeByte(_actListArr[i][j].a9.newState);
+ f->writeSint16BE(_actListArr[i][j]._a9._timer);
+ f->writeSint16BE(_actListArr[i][j]._a9._objIndex);
+ f->writeByte(_actListArr[i][j]._a9._newState);
break;
case INIT_PATH: // 10
- f->writeSint16BE(_actListArr[i][j].a10.timer);
- f->writeSint16BE(_actListArr[i][j].a10.objIndex);
- f->writeSint16BE(_actListArr[i][j].a10.newPathType);
- f->writeByte(_actListArr[i][j].a10.vxPath);
- f->writeByte(_actListArr[i][j].a10.vyPath);
+ f->writeSint16BE(_actListArr[i][j]._a10._timer);
+ f->writeSint16BE(_actListArr[i][j]._a10._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a10._newPathType);
+ f->writeByte(_actListArr[i][j]._a10._vxPath);
+ f->writeByte(_actListArr[i][j]._a10._vyPath);
break;
case COND_R: // 11
- f->writeSint16BE(_actListArr[i][j].a11.timer);
- f->writeSint16BE(_actListArr[i][j].a11.objIndex);
- f->writeByte(_actListArr[i][j].a11.stateReq);
- f->writeUint16BE(_actListArr[i][j].a11.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a11.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a11._timer);
+ f->writeSint16BE(_actListArr[i][j]._a11._objIndex);
+ f->writeByte(_actListArr[i][j]._a11._stateReq);
+ f->writeUint16BE(_actListArr[i][j]._a11._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a11._actFailIndex);
break;
case TEXT: // 12
- f->writeSint16BE(_actListArr[i][j].a12.timer);
- f->writeSint16BE(_actListArr[i][j].a12.stringIndex);
+ f->writeSint16BE(_actListArr[i][j]._a12._timer);
+ f->writeSint16BE(_actListArr[i][j]._a12._stringIndex);
break;
case SWAP_IMAGES: // 13
- f->writeSint16BE(_actListArr[i][j].a13.timer);
- f->writeSint16BE(_actListArr[i][j].a13.objIndex1);
- f->writeSint16BE(_actListArr[i][j].a13.objIndex2);
+ f->writeSint16BE(_actListArr[i][j]._a13._timer);
+ f->writeSint16BE(_actListArr[i][j]._a13._objIndex1);
+ f->writeSint16BE(_actListArr[i][j]._a13._objIndex2);
break;
case COND_SCR: // 14
- f->writeSint16BE(_actListArr[i][j].a14.timer);
- f->writeSint16BE(_actListArr[i][j].a14.objIndex);
- f->writeSint16BE(_actListArr[i][j].a14.screenReq);
- f->writeUint16BE(_actListArr[i][j].a14.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a14.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a14._timer);
+ f->writeSint16BE(_actListArr[i][j]._a14._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a14._screenReq);
+ f->writeUint16BE(_actListArr[i][j]._a14._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a14._actFailIndex);
break;
case AUTOPILOT: // 15
- f->writeSint16BE(_actListArr[i][j].a15.timer);
- f->writeSint16BE(_actListArr[i][j].a15.objIndex1);
- f->writeSint16BE(_actListArr[i][j].a15.objIndex2);
- f->writeByte(_actListArr[i][j].a15.dx);
- f->writeByte(_actListArr[i][j].a15.dy);
+ f->writeSint16BE(_actListArr[i][j]._a15._timer);
+ f->writeSint16BE(_actListArr[i][j]._a15._objIndex1);
+ f->writeSint16BE(_actListArr[i][j]._a15._objIndex2);
+ f->writeByte(_actListArr[i][j]._a15._dx);
+ f->writeByte(_actListArr[i][j]._a15._dy);
break;
case INIT_OBJ_SEQ: // 16
- f->writeSint16BE(_actListArr[i][j].a16.timer);
- f->writeSint16BE(_actListArr[i][j].a16.objIndex);
- f->writeSint16BE(_actListArr[i][j].a16.seqIndex);
+ f->writeSint16BE(_actListArr[i][j]._a16._timer);
+ f->writeSint16BE(_actListArr[i][j]._a16._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a16._seqIndex);
break;
case SET_STATE_BITS: // 17
- f->writeSint16BE(_actListArr[i][j].a17.timer);
- f->writeSint16BE(_actListArr[i][j].a17.objIndex);
- f->writeSint16BE(_actListArr[i][j].a17.stateMask);
+ f->writeSint16BE(_actListArr[i][j]._a17._timer);
+ f->writeSint16BE(_actListArr[i][j]._a17._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a17._stateMask);
break;
case CLEAR_STATE_BITS: // 18
- f->writeSint16BE(_actListArr[i][j].a18.timer);
- f->writeSint16BE(_actListArr[i][j].a18.objIndex);
- f->writeSint16BE(_actListArr[i][j].a18.stateMask);
+ f->writeSint16BE(_actListArr[i][j]._a18._timer);
+ f->writeSint16BE(_actListArr[i][j]._a18._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a18._stateMask);
break;
case TEST_STATE_BITS: // 19
- f->writeSint16BE(_actListArr[i][j].a19.timer);
- f->writeSint16BE(_actListArr[i][j].a19.objIndex);
- f->writeSint16BE(_actListArr[i][j].a19.stateMask);
- f->writeUint16BE(_actListArr[i][j].a19.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a19.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a19._timer);
+ f->writeSint16BE(_actListArr[i][j]._a19._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a19._stateMask);
+ f->writeUint16BE(_actListArr[i][j]._a19._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a19._actFailIndex);
break;
case DEL_EVENTS: // 20
- f->writeSint16BE(_actListArr[i][j].a20.timer);
- f->writeByte(_actListArr[i][j].a20.actTypeDel);
+ f->writeSint16BE(_actListArr[i][j]._a20._timer);
+ f->writeByte(_actListArr[i][j]._a20._actTypeDel);
break;
case GAMEOVER: // 21
- f->writeSint16BE(_actListArr[i][j].a21.timer);
+ f->writeSint16BE(_actListArr[i][j]._a21._timer);
break;
case INIT_HH_COORD: // 22
- f->writeSint16BE(_actListArr[i][j].a22.timer);
- f->writeSint16BE(_actListArr[i][j].a22.objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a22._timer);
+ f->writeSint16BE(_actListArr[i][j]._a22._objIndex);
break;
case EXIT: // 23
- f->writeSint16BE(_actListArr[i][j].a23.timer);
+ f->writeSint16BE(_actListArr[i][j]._a23._timer);
break;
case BONUS: // 24
- f->writeSint16BE(_actListArr[i][j].a24.timer);
- f->writeSint16BE(_actListArr[i][j].a24.pointIndex);
+ f->writeSint16BE(_actListArr[i][j]._a24._timer);
+ f->writeSint16BE(_actListArr[i][j]._a24._pointIndex);
break;
case COND_BOX: // 25
- f->writeSint16BE(_actListArr[i][j].a25.timer);
- f->writeSint16BE(_actListArr[i][j].a25.objIndex);
- f->writeSint16BE(_actListArr[i][j].a25.x1);
- f->writeSint16BE(_actListArr[i][j].a25.y1);
- f->writeSint16BE(_actListArr[i][j].a25.x2);
- f->writeSint16BE(_actListArr[i][j].a25.y2);
- f->writeUint16BE(_actListArr[i][j].a25.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a25.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a25._timer);
+ f->writeSint16BE(_actListArr[i][j]._a25._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a25._x1);
+ f->writeSint16BE(_actListArr[i][j]._a25._y1);
+ f->writeSint16BE(_actListArr[i][j]._a25._x2);
+ f->writeSint16BE(_actListArr[i][j]._a25._y2);
+ f->writeUint16BE(_actListArr[i][j]._a25._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a25._actFailIndex);
break;
case SOUND: // 26
- f->writeSint16BE(_actListArr[i][j].a26.timer);
- f->writeSint16BE(_actListArr[i][j].a26.soundIndex);
+ f->writeSint16BE(_actListArr[i][j]._a26._timer);
+ f->writeSint16BE(_actListArr[i][j]._a26._soundIndex);
break;
case ADD_SCORE: // 27
- f->writeSint16BE(_actListArr[i][j].a27.timer);
- f->writeSint16BE(_actListArr[i][j].a27.objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a27._timer);
+ f->writeSint16BE(_actListArr[i][j]._a27._objIndex);
break;
case SUB_SCORE: // 28
- f->writeSint16BE(_actListArr[i][j].a28.timer);
- f->writeSint16BE(_actListArr[i][j].a28.objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a28._timer);
+ f->writeSint16BE(_actListArr[i][j]._a28._objIndex);
break;
case COND_CARRY: // 29
- f->writeSint16BE(_actListArr[i][j].a29.timer);
- f->writeSint16BE(_actListArr[i][j].a29.objIndex);
- f->writeUint16BE(_actListArr[i][j].a29.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a29.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a29._timer);
+ f->writeSint16BE(_actListArr[i][j]._a29._objIndex);
+ f->writeUint16BE(_actListArr[i][j]._a29._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a29._actFailIndex);
break;
case INIT_MAZE: // 30
- f->writeSint16BE(_actListArr[i][j].a30.timer);
- f->writeByte(_actListArr[i][j].a30.mazeSize);
- f->writeSint16BE(_actListArr[i][j].a30.x1);
- f->writeSint16BE(_actListArr[i][j].a30.y1);
- f->writeSint16BE(_actListArr[i][j].a30.x2);
- f->writeSint16BE(_actListArr[i][j].a30.y2);
- f->writeSint16BE(_actListArr[i][j].a30.x3);
- f->writeSint16BE(_actListArr[i][j].a30.x4);
- f->writeByte(_actListArr[i][j].a30.firstScreenIndex);
+ f->writeSint16BE(_actListArr[i][j]._a30._timer);
+ f->writeByte(_actListArr[i][j]._a30._mazeSize);
+ f->writeSint16BE(_actListArr[i][j]._a30._x1);
+ f->writeSint16BE(_actListArr[i][j]._a30._y1);
+ f->writeSint16BE(_actListArr[i][j]._a30._x2);
+ f->writeSint16BE(_actListArr[i][j]._a30._y2);
+ f->writeSint16BE(_actListArr[i][j]._a30._x3);
+ f->writeSint16BE(_actListArr[i][j]._a30._x4);
+ f->writeByte(_actListArr[i][j]._a30._firstScreenIndex);
break;
case EXIT_MAZE: // 31
- f->writeSint16BE(_actListArr[i][j].a31.timer);
+ f->writeSint16BE(_actListArr[i][j]._a31._timer);
break;
case INIT_PRIORITY: // 32
- f->writeSint16BE(_actListArr[i][j].a32.timer);
- f->writeSint16BE(_actListArr[i][j].a32.objIndex);
- f->writeByte(_actListArr[i][j].a32.priority);
+ f->writeSint16BE(_actListArr[i][j]._a32._timer);
+ f->writeSint16BE(_actListArr[i][j]._a32._objIndex);
+ f->writeByte(_actListArr[i][j]._a32._priority);
break;
case INIT_SCREEN: // 33
- f->writeSint16BE(_actListArr[i][j].a33.timer);
- f->writeSint16BE(_actListArr[i][j].a33.objIndex);
- f->writeSint16BE(_actListArr[i][j].a33.screenIndex);
+ f->writeSint16BE(_actListArr[i][j]._a33._timer);
+ f->writeSint16BE(_actListArr[i][j]._a33._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a33._screenIndex);
break;
case AGSCHEDULE: // 34
- f->writeSint16BE(_actListArr[i][j].a34.timer);
- f->writeUint16BE(_actListArr[i][j].a34.actIndex);
+ f->writeSint16BE(_actListArr[i][j]._a34._timer);
+ f->writeUint16BE(_actListArr[i][j]._a34._actIndex);
break;
case REMAPPAL: // 35
- f->writeSint16BE(_actListArr[i][j].a35.timer);
- f->writeSint16BE(_actListArr[i][j].a35.oldColorIndex);
- f->writeSint16BE(_actListArr[i][j].a35.newColorIndex);
+ f->writeSint16BE(_actListArr[i][j]._a35._timer);
+ f->writeSint16BE(_actListArr[i][j]._a35._oldColorIndex);
+ f->writeSint16BE(_actListArr[i][j]._a35._newColorIndex);
break;
case COND_NOUN: // 36
- f->writeSint16BE(_actListArr[i][j].a36.timer);
- f->writeUint16BE(_actListArr[i][j].a36.nounIndex);
- f->writeUint16BE(_actListArr[i][j].a36.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a36.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a36._timer);
+ f->writeUint16BE(_actListArr[i][j]._a36._nounIndex);
+ f->writeUint16BE(_actListArr[i][j]._a36._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a36._actFailIndex);
break;
case SCREEN_STATE: // 37
- f->writeSint16BE(_actListArr[i][j].a37.timer);
- f->writeSint16BE(_actListArr[i][j].a37.screenIndex);
- f->writeByte(_actListArr[i][j].a37.newState);
+ f->writeSint16BE(_actListArr[i][j]._a37._timer);
+ f->writeSint16BE(_actListArr[i][j]._a37._screenIndex);
+ f->writeByte(_actListArr[i][j]._a37._newState);
break;
case INIT_LIPS: // 38
- f->writeSint16BE(_actListArr[i][j].a38.timer);
- f->writeSint16BE(_actListArr[i][j].a38.lipsObjIndex);
- f->writeSint16BE(_actListArr[i][j].a38.objIndex);
- f->writeByte(_actListArr[i][j].a38.dxLips);
- f->writeByte(_actListArr[i][j].a38.dyLips);
+ f->writeSint16BE(_actListArr[i][j]._a38._timer);
+ f->writeSint16BE(_actListArr[i][j]._a38._lipsObjIndex);
+ f->writeSint16BE(_actListArr[i][j]._a38._objIndex);
+ f->writeByte(_actListArr[i][j]._a38._dxLips);
+ f->writeByte(_actListArr[i][j]._a38._dyLips);
break;
case INIT_STORY_MODE: // 39
- f->writeSint16BE(_actListArr[i][j].a39.timer);
- f->writeByte((_actListArr[i][j].a39.storyModeFl) ? 1 : 0);
+ f->writeSint16BE(_actListArr[i][j]._a39._timer);
+ f->writeByte((_actListArr[i][j]._a39._storyModeFl) ? 1 : 0);
break;
case WARN: // 40
- f->writeSint16BE(_actListArr[i][j].a40.timer);
- f->writeSint16BE(_actListArr[i][j].a40.stringIndex);
+ f->writeSint16BE(_actListArr[i][j]._a40._timer);
+ f->writeSint16BE(_actListArr[i][j]._a40._stringIndex);
break;
case COND_BONUS: // 41
- f->writeSint16BE(_actListArr[i][j].a41.timer);
- f->writeSint16BE(_actListArr[i][j].a41.BonusIndex);
- f->writeUint16BE(_actListArr[i][j].a41.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a41.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a41._timer);
+ f->writeSint16BE(_actListArr[i][j]._a41._bonusIndex);
+ f->writeUint16BE(_actListArr[i][j]._a41._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a41._actFailIndex);
break;
case TEXT_TAKE: // 42
- f->writeSint16BE(_actListArr[i][j].a42.timer);
- f->writeSint16BE(_actListArr[i][j].a42.objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a42._timer);
+ f->writeSint16BE(_actListArr[i][j]._a42._objIndex);
break;
case YESNO: // 43
- f->writeSint16BE(_actListArr[i][j].a43.timer);
- f->writeSint16BE(_actListArr[i][j].a43.promptIndex);
- f->writeUint16BE(_actListArr[i][j].a43.actYesIndex);
- f->writeUint16BE(_actListArr[i][j].a43.actNoIndex);
+ f->writeSint16BE(_actListArr[i][j]._a43._timer);
+ f->writeSint16BE(_actListArr[i][j]._a43._promptIndex);
+ f->writeUint16BE(_actListArr[i][j]._a43._actYesIndex);
+ f->writeUint16BE(_actListArr[i][j]._a43._actNoIndex);
break;
case STOP_ROUTE: // 44
- f->writeSint16BE(_actListArr[i][j].a44.timer);
+ f->writeSint16BE(_actListArr[i][j]._a44._timer);
break;
case COND_ROUTE: // 45
- f->writeSint16BE(_actListArr[i][j].a45.timer);
- f->writeSint16BE(_actListArr[i][j].a45.routeIndex);
- f->writeUint16BE(_actListArr[i][j].a45.actPassIndex);
- f->writeUint16BE(_actListArr[i][j].a45.actFailIndex);
+ f->writeSint16BE(_actListArr[i][j]._a45._timer);
+ f->writeSint16BE(_actListArr[i][j]._a45._routeIndex);
+ f->writeUint16BE(_actListArr[i][j]._a45._actPassIndex);
+ f->writeUint16BE(_actListArr[i][j]._a45._actFailIndex);
break;
case INIT_JUMPEXIT: // 46
- f->writeSint16BE(_actListArr[i][j].a46.timer);
- f->writeByte((_actListArr[i][j].a46.jumpExitFl) ? 1 : 0);
+ f->writeSint16BE(_actListArr[i][j]._a46._timer);
+ f->writeByte((_actListArr[i][j]._a46._jumpExitFl) ? 1 : 0);
break;
case INIT_VIEW: // 47
- f->writeSint16BE(_actListArr[i][j].a47.timer);
- f->writeSint16BE(_actListArr[i][j].a47.objIndex);
- f->writeSint16BE(_actListArr[i][j].a47.viewx);
- f->writeSint16BE(_actListArr[i][j].a47.viewy);
- f->writeSint16BE(_actListArr[i][j].a47.direction);
+ f->writeSint16BE(_actListArr[i][j]._a47._timer);
+ f->writeSint16BE(_actListArr[i][j]._a47._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a47._viewx);
+ f->writeSint16BE(_actListArr[i][j]._a47._viewy);
+ f->writeSint16BE(_actListArr[i][j]._a47._direction);
break;
case INIT_OBJ_FRAME: // 48
- f->writeSint16BE(_actListArr[i][j].a48.timer);
- f->writeSint16BE(_actListArr[i][j].a48.objIndex);
- f->writeSint16BE(_actListArr[i][j].a48.seqIndex);
- f->writeSint16BE(_actListArr[i][j].a48.frameIndex);
+ f->writeSint16BE(_actListArr[i][j]._a48._timer);
+ f->writeSint16BE(_actListArr[i][j]._a48._objIndex);
+ f->writeSint16BE(_actListArr[i][j]._a48._seqIndex);
+ f->writeSint16BE(_actListArr[i][j]._a48._frameIndex);
break;
case OLD_SONG: // 49, Added by Strangerke for DOS versions
- f->writeSint16BE(_actListArr[i][j].a49.timer);
- f->writeUint16BE(_actListArr[i][j].a49.songIndex);
+ f->writeSint16BE(_actListArr[i][j]._a49._timer);
+ f->writeUint16BE(_actListArr[i][j]._a49._songIndex);
break;
default:
error("Unknown action %d", subElemType);
@@ -1039,7 +1039,7 @@ void Scheduler::saveActions(Common::WriteStream *f) const {
/*
* Find the index in the action list to be able to serialize the action to save game
*/
-void Scheduler::findAction(const act* action, int16* index, int16* subElem) {
+void Scheduler::findAction(const Act *action, int16 *index, int16 *subElem) {
assert(index && subElem);
if (!action) {
@@ -1057,7 +1057,7 @@ void Scheduler::findAction(const act* action, int16* index, int16* subElem) {
return;
}
j++;
- } while (_actListArr[i][j-1].a0.actType != ANULL);
+ } while (_actListArr[i][j-1]._a0._actType != ANULL);
}
// action not found ??
assert(0);
@@ -1090,10 +1090,10 @@ void Scheduler::restoreSchedulerData(Common::ReadStream *in) {
void Scheduler::restoreEvents(Common::ReadStream *f) {
debugC(1, kDebugSchedule, "restoreEvents");
- uint32 saveTime = f->readUint32BE(); // time of save
- int16 freeIndex = f->readSint16BE(); // Free list index
- int16 headIndex = f->readSint16BE(); // Head of list index
- int16 tailIndex = f->readSint16BE(); // Tail of list index
+ uint32 saveTime = f->readUint32BE(); // time of save
+ int16 freeIndex = f->readSint16BE(); // Free list index
+ int16 headIndex = f->readSint16BE(); // Head of list index
+ int16 tailIndex = f->readSint16BE(); // Tail of list index
// Restore events indexes to pointers
for (int i = 0; i < kMaxEvents; i++) {
@@ -1102,18 +1102,18 @@ void Scheduler::restoreEvents(Common::ReadStream *f) {
// fix up action pointer (to do better)
if ((index == -1) && (subElem == -1))
- _events[i].action = 0;
+ _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();
+ _events[i]._localActionFl = (f->readByte() == 1) ? true : false;
+ _events[i]._time = f->readUint32BE();
int16 prevIndex = f->readSint16BE();
int16 nextIndex = f->readSint16BE();
- _events[i].prevEvent = (prevIndex == -1) ? (event_t *)0 : &_events[prevIndex];
- _events[i].nextEvent = (nextIndex == -1) ? (event_t *)0 : &_events[nextIndex];
+ _events[i]._prevEvent = (prevIndex == -1) ? (Event *)0 : &_events[prevIndex];
+ _events[i]._nextEvent = (nextIndex == -1) ? (Event *)0 : &_events[nextIndex];
}
_freeEvent = (freeIndex == -1) ? 0 : &_events[freeIndex];
_headEvent = (headIndex == -1) ? 0 : &_events[headIndex];
@@ -1121,10 +1121,10 @@ void Scheduler::restoreEvents(Common::ReadStream *f) {
// Adjust times to fit our time
uint32 curTime = getTicks();
- event_t *wrkEvent = _headEvent; // The earliest event
- while (wrkEvent) { // While mature events found
- wrkEvent->time = wrkEvent->time - saveTime + curTime;
- wrkEvent = wrkEvent->nextEvent;
+ Event *wrkEvent = _headEvent; // The earliest event
+ while (wrkEvent) { // While mature events found
+ wrkEvent->_time = wrkEvent->_time - saveTime + curTime;
+ wrkEvent = wrkEvent->_nextEvent;
}
}
@@ -1132,53 +1132,53 @@ void Scheduler::restoreEvents(Common::ReadStream *f) {
* Insert the action pointed to by p into the timer event queue
* The queue goes from head (earliest) to tail (latest) timewise
*/
-void Scheduler::insertAction(act *action) {
- debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->a0.actType);
+void Scheduler::insertAction(Act *action) {
+ debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->_a0._actType);
// First, get and initialize the event structure
- event_t *curEvent = getQueue();
- curEvent->action = action;
- switch (action->a0.actType) { // Assign whether local or global
+ Event *curEvent = getQueue();
+ curEvent->_action = action;
+ switch (action->_a0._actType) { // Assign whether local or global
case AGSCHEDULE:
- curEvent->localActionFl = false; // Lasts over a new screen
+ curEvent->_localActionFl = false; // Lasts over a new screen
break;
// Workaround: When dying, switch to storyMode in order to block the keyboard.
case GAMEOVER:
- _vm->getGameStatus().storyModeFl = true;
+ _vm->getGameStatus()._storyModeFl = true;
// No break on purpose
default:
- curEvent->localActionFl = true; // Rest are for current screen only
+ curEvent->_localActionFl = true; // Rest are for current screen only
break;
}
- curEvent->time = action->a0.timer + getTicks(); // Convert rel to abs time
+ curEvent->_time = action->_a0._timer + getTicks(); // Convert rel to abs time
// Now find the place to insert the event
- if (!_tailEvent) { // Empty queue
+ if (!_tailEvent) { // Empty queue
_tailEvent = _headEvent = curEvent;
- curEvent->nextEvent = curEvent->prevEvent = 0;
+ curEvent->_nextEvent = curEvent->_prevEvent = 0;
} else {
- event_t *wrkEvent = _tailEvent; // Search from latest time back
+ Event *wrkEvent = _tailEvent; // Search from latest time back
bool found = false;
while (wrkEvent && !found) {
- if (wrkEvent->time <= curEvent->time) { // Found if new event later
+ if (wrkEvent->_time <= curEvent->_time) { // Found if new event later
found = true;
- if (wrkEvent == _tailEvent) // New latest in list
+ if (wrkEvent == _tailEvent) // New latest in list
_tailEvent = curEvent;
else
- wrkEvent->nextEvent->prevEvent = curEvent;
- curEvent->nextEvent = wrkEvent->nextEvent;
- wrkEvent->nextEvent = curEvent;
- curEvent->prevEvent = wrkEvent;
+ wrkEvent->_nextEvent->_prevEvent = curEvent;
+ curEvent->_nextEvent = wrkEvent->_nextEvent;
+ wrkEvent->_nextEvent = curEvent;
+ curEvent->_prevEvent = wrkEvent;
}
- wrkEvent = wrkEvent->prevEvent;
+ wrkEvent = wrkEvent->_prevEvent;
}
- if (!found) { // Must be earliest in list
- _headEvent->prevEvent = curEvent; // So insert as new head
- curEvent->nextEvent = _headEvent;
- curEvent->prevEvent = 0;
+ if (!found) { // Must be earliest in list
+ _headEvent->_prevEvent = curEvent; // So insert as new head
+ curEvent->_nextEvent = _headEvent;
+ curEvent->_prevEvent = 0;
_headEvent = curEvent;
}
}
@@ -1189,246 +1189,246 @@ void Scheduler::insertAction(act *action) {
* It dequeues the event and returns it to the free list. It returns a ptr
* to the next action in the list, except special case of NEW_SCREEN
*/
-event_t *Scheduler::doAction(event_t *curEvent) {
- debugC(1, kDebugSchedule, "doAction - Event action type : %d", curEvent->action->a0.actType);
+Event *Scheduler::doAction(Event *curEvent) {
+ debugC(1, kDebugSchedule, "doAction - Event action type : %d", curEvent->_action->_a0._actType);
- status_t &gameStatus = _vm->getGameStatus();
- act *action = curEvent->action;
- object_t *obj1;
- int dx, dy;
- event_t *wrkEvent; // Save ev_p->next_p for return
+ Status &gameStatus = _vm->getGameStatus();
+ Act *action = curEvent->_action;
+ Object *obj1;
+ int dx, dy;
+ Event *wrkEvent; // Save ev_p->nextEvent for return
- switch (action->a0.actType) {
- case ANULL: // Big NOP from DEL_EVENTS
+ switch (action->_a0._actType) {
+ case ANULL: // Big NOP from DEL_EVENTS
break;
- case ASCHEDULE: // act0: Schedule an action list
- insertActionList(action->a0.actIndex);
+ case ASCHEDULE: // act0: Schedule an action list
+ insertActionList(action->_a0._actIndex);
break;
- case START_OBJ: // act1: Start an object cycling
- _vm->_object->_objects[action->a1.objIndex].cycleNumb = action->a1.cycleNumb;
- _vm->_object->_objects[action->a1.objIndex].cycling = action->a1.cycle;
+ case START_OBJ: // act1: Start an object cycling
+ _vm->_object->_objects[action->_a1._objIndex]._cycleNumb = action->_a1._cycleNumb;
+ _vm->_object->_objects[action->_a1._objIndex]._cycling = action->_a1._cycle;
break;
- case INIT_OBJXY: // act2: Initialize an object
- _vm->_object->_objects[action->a2.objIndex].x = action->a2.x; // Coordinates
- _vm->_object->_objects[action->a2.objIndex].y = action->a2.y;
+ case INIT_OBJXY: // act2: Initialize an object
+ _vm->_object->_objects[action->_a2._objIndex]._x = action->_a2._x; // Coordinates
+ _vm->_object->_objects[action->_a2._objIndex]._y = action->_a2._y;
break;
- case PROMPT: // act3: Prompt user for key phrase
+ case PROMPT: // act3: Prompt user for key phrase
promptAction(action);
break;
- case BKGD_COLOR: // act4: Set new background color
- _vm->_screen->setBackgroundColor(action->a4.newBackgroundColor);
+ case BKGD_COLOR: // act4: Set new background color
+ _vm->_screen->setBackgroundColor(action->_a4._newBackgroundColor);
break;
- case INIT_OBJVXY: // act5: Initialize an object velocity
- _vm->_object->setVelocity(action->a5.objIndex, action->a5.vx, action->a5.vy);
+ case INIT_OBJVXY: // act5: Initialize an object velocity
+ _vm->_object->setVelocity(action->_a5._objIndex, action->_a5._vx, action->_a5._vy);
break;
- case INIT_CARRY: // act6: Initialize an object
- _vm->_object->setCarry(action->a6.objIndex, action->a6.carriedFl); // carried status
+ case INIT_CARRY: // act6: Initialize an object
+ _vm->_object->setCarry(action->_a6._objIndex, action->_a6._carriedFl); // carried status
break;
- case INIT_HF_COORD: // act7: Initialize an object to hero's "feet" coords
- _vm->_object->_objects[action->a7.objIndex].x = _vm->_hero->x - 1;
- _vm->_object->_objects[action->a7.objIndex].y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1;
- _vm->_object->_objects[action->a7.objIndex].screenIndex = *_vm->_screen_p; // Don't forget screen!
+ case INIT_HF_COORD: // act7: Initialize an object to hero's "feet" coords
+ _vm->_object->_objects[action->_a7._objIndex]._x = _vm->_hero->_x - 1;
+ _vm->_object->_objects[action->_a7._objIndex]._y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1;
+ _vm->_object->_objects[action->_a7._objIndex]._screenIndex = *_vm->_screenPtr; // Don't forget screen!
break;
- case NEW_SCREEN: // act8: Start new screen
- newScreen(action->a8.screenIndex);
+ case NEW_SCREEN: // act8: Start new screen
+ newScreen(action->_a8._screenIndex);
break;
- case INIT_OBJSTATE: // act9: Initialize an object state
- _vm->_object->_objects[action->a9.objIndex].state = action->a9.newState;
+ case INIT_OBJSTATE: // act9: Initialize an object state
+ _vm->_object->_objects[action->_a9._objIndex]._state = action->_a9._newState;
break;
- case INIT_PATH: // act10: Initialize an object path and velocity
- _vm->_object->setPath(action->a10.objIndex, (path_t) action->a10.newPathType, action->a10.vxPath, action->a10.vyPath);
+ case INIT_PATH: // act10: Initialize an object path and velocity
+ _vm->_object->setPath(action->_a10._objIndex, (Path) action->_a10._newPathType, action->_a10._vxPath, action->_a10._vyPath);
break;
- case COND_R: // act11: action lists conditional on object state
- if (_vm->_object->_objects[action->a11.objIndex].state == action->a11.stateReq)
- insertActionList(action->a11.actPassIndex);
+ case COND_R: // act11: action lists conditional on object state
+ if (_vm->_object->_objects[action->_a11._objIndex]._state == action->_a11._stateReq)
+ insertActionList(action->_a11._actPassIndex);
else
- insertActionList(action->a11.actFailIndex);
+ insertActionList(action->_a11._actFailIndex);
break;
- case TEXT: // act12: Text box (CF WARN)
- Utils::notifyBox(_vm->_file->fetchString(action->a12.stringIndex)); // Fetch string from file
+ case TEXT: // act12: Text box (CF WARN)
+ Utils::notifyBox(_vm->_file->fetchString(action->_a12._stringIndex)); // Fetch string from file
break;
- case SWAP_IMAGES: // act13: Swap 2 object images
- _vm->_object->swapImages(action->a13.objIndex1, action->a13.objIndex2);
+ case SWAP_IMAGES: // act13: Swap 2 object images
+ _vm->_object->swapImages(action->_a13._objIndex1, action->_a13._objIndex2);
break;
- case COND_SCR: // act14: Conditional on current screen
- if (_vm->_object->_objects[action->a14.objIndex].screenIndex == action->a14.screenReq)
- insertActionList(action->a14.actPassIndex);
+ case COND_SCR: // act14: Conditional on current screen
+ if (_vm->_object->_objects[action->_a14._objIndex]._screenIndex == action->_a14._screenReq)
+ insertActionList(action->_a14._actPassIndex);
else
- insertActionList(action->a14.actFailIndex);
+ insertActionList(action->_a14._actFailIndex);
break;
- case AUTOPILOT: // act15: Home in on a (stationary) object
- _vm->_object->homeIn(action->a15.objIndex1, action->a15.objIndex2, action->a15.dx, action->a15.dy);
+ case AUTOPILOT: // act15: Home in on a (stationary) object
+ _vm->_object->homeIn(action->_a15._objIndex1, action->_a15._objIndex2, action->_a15._dx, action->_a15._dy);
break;
- case INIT_OBJ_SEQ: // act16: Set sequence number to use
+ case INIT_OBJ_SEQ: // act16: Set sequence number to use
// Note: Don't set a sequence at time 0 of a new screen, it causes
// problems clearing the boundary bits of the object! t>0 is safe
- _vm->_object->_objects[action->a16.objIndex].currImagePtr = _vm->_object->_objects[action->a16.objIndex].seqList[action->a16.seqIndex].seqPtr;
+ _vm->_object->_objects[action->_a16._objIndex]._currImagePtr = _vm->_object->_objects[action->_a16._objIndex]._seqList[action->_a16._seqIndex]._seqPtr;
break;
- case SET_STATE_BITS: // act17: OR mask with curr obj state
- _vm->_object->_objects[action->a17.objIndex].state |= action->a17.stateMask;
+ case SET_STATE_BITS: // act17: OR mask with curr obj state
+ _vm->_object->_objects[action->_a17._objIndex]._state |= action->_a17._stateMask;
break;
- case CLEAR_STATE_BITS: // act18: AND ~mask with curr obj state
- _vm->_object->_objects[action->a18.objIndex].state &= ~action->a18.stateMask;
+ case CLEAR_STATE_BITS: // act18: AND ~mask with curr obj state
+ _vm->_object->_objects[action->_a18._objIndex]._state &= ~action->_a18._stateMask;
break;
- case TEST_STATE_BITS: // act19: If all bits set, do apass else afail
- if ((_vm->_object->_objects[action->a19.objIndex].state & action->a19.stateMask) == action->a19.stateMask)
- insertActionList(action->a19.actPassIndex);
+ case TEST_STATE_BITS: // act19: If all bits set, do apass else afail
+ if ((_vm->_object->_objects[action->_a19._objIndex]._state & action->_a19._stateMask) == action->_a19._stateMask)
+ insertActionList(action->_a19._actPassIndex);
else
- insertActionList(action->a19.actFailIndex);
+ insertActionList(action->_a19._actFailIndex);
break;
- case DEL_EVENTS: // act20: Remove all events of this action type
- delEventType(action->a20.actTypeDel);
+ case DEL_EVENTS: // act20: Remove all events of this action type
+ delEventType(action->_a20._actTypeDel);
break;
- case GAMEOVER: // act21: Game over!
+ case GAMEOVER: // act21: Game over!
// NOTE: Must wait at least 1 tick before issuing this action if
// any objects are to be made invisible!
- gameStatus.gameOverFl = true;
+ gameStatus._gameOverFl = true;
break;
- case INIT_HH_COORD: // act22: Initialize an object to hero's actual coords
- _vm->_object->_objects[action->a22.objIndex].x = _vm->_hero->x;
- _vm->_object->_objects[action->a22.objIndex].y = _vm->_hero->y;
- _vm->_object->_objects[action->a22.objIndex].screenIndex = *_vm->_screen_p;// Don't forget screen!
+ case INIT_HH_COORD: // act22: Initialize an object to hero's actual coords
+ _vm->_object->_objects[action->_a22._objIndex]._x = _vm->_hero->_x;
+ _vm->_object->_objects[action->_a22._objIndex]._y = _vm->_hero->_y;
+ _vm->_object->_objects[action->_a22._objIndex]._screenIndex = *_vm->_screenPtr;// Don't forget screen!
break;
- case EXIT: // act23: Exit game back to DOS
+ case EXIT: // act23: Exit game back to DOS
_vm->endGame();
break;
- case BONUS: // act24: Get bonus score for action
- processBonus(action->a24.pointIndex);
+ case BONUS: // act24: Get bonus score for action
+ processBonus(action->_a24._pointIndex);
break;
- case COND_BOX: // act25: Conditional on bounding box
- obj1 = &_vm->_object->_objects[action->a25.objIndex];
- dx = obj1->x + obj1->currImagePtr->x1;
- dy = obj1->y + obj1->currImagePtr->y2;
- if ((dx >= action->a25.x1) && (dx <= action->a25.x2) &&
- (dy >= action->a25.y1) && (dy <= action->a25.y2))
- insertActionList(action->a25.actPassIndex);
+ case COND_BOX: // act25: Conditional on bounding box
+ obj1 = &_vm->_object->_objects[action->_a25._objIndex];
+ dx = obj1->_x + obj1->_currImagePtr->_x1;
+ dy = obj1->_y + obj1->_currImagePtr->_y2;
+ if ((dx >= action->_a25._x1) && (dx <= action->_a25._x2) &&
+ (dy >= action->_a25._y1) && (dy <= action->_a25._y2))
+ insertActionList(action->_a25._actPassIndex);
else
- insertActionList(action->a25.actFailIndex);
+ insertActionList(action->_a25._actFailIndex);
break;
- case SOUND: // act26: Play a sound (or tune)
- if (action->a26.soundIndex < _vm->_tunesNbr)
- _vm->_sound->playMusic(action->a26.soundIndex);
+ case SOUND: // act26: Play a sound (or tune)
+ if (action->_a26._soundIndex < _vm->_tunesNbr)
+ _vm->_sound->playMusic(action->_a26._soundIndex);
else
- _vm->_sound->playSound(action->a26.soundIndex, kSoundPriorityMedium);
+ _vm->_sound->playSound(action->_a26._soundIndex, kSoundPriorityMedium);
break;
- case ADD_SCORE: // act27: Add object's value to score
- _vm->adjustScore(_vm->_object->_objects[action->a27.objIndex].objValue);
+ case ADD_SCORE: // act27: Add object's value to score
+ _vm->adjustScore(_vm->_object->_objects[action->_a27._objIndex]._objValue);
break;
- case SUB_SCORE: // act28: Subtract object's value from score
- _vm->adjustScore(-_vm->_object->_objects[action->a28.objIndex].objValue);
+ case SUB_SCORE: // act28: Subtract object's value from score
+ _vm->adjustScore(-_vm->_object->_objects[action->_a28._objIndex]._objValue);
break;
- case COND_CARRY: // act29: Conditional on object being carried
- if (_vm->_object->isCarried(action->a29.objIndex))
- insertActionList(action->a29.actPassIndex);
+ case COND_CARRY: // act29: Conditional on object being carried
+ if (_vm->_object->isCarried(action->_a29._objIndex))
+ insertActionList(action->_a29._actPassIndex);
else
- insertActionList(action->a29.actFailIndex);
- break;
- case INIT_MAZE: // act30: Enable and init maze structure
- _vm->_maze.enabledFl = true;
- _vm->_maze.size = action->a30.mazeSize;
- _vm->_maze.x1 = action->a30.x1;
- _vm->_maze.y1 = action->a30.y1;
- _vm->_maze.x2 = action->a30.x2;
- _vm->_maze.y2 = action->a30.y2;
- _vm->_maze.x3 = action->a30.x3;
- _vm->_maze.x4 = action->a30.x4;
- _vm->_maze.firstScreenIndex = action->a30.firstScreenIndex;
- break;
- case EXIT_MAZE: // act31: Disable maze mode
- _vm->_maze.enabledFl = false;
+ insertActionList(action->_a29._actFailIndex);
+ break;
+ case INIT_MAZE: // act30: Enable and init maze structure
+ _vm->_maze._enabledFl = true;
+ _vm->_maze._size = action->_a30._mazeSize;
+ _vm->_maze._x1 = action->_a30._x1;
+ _vm->_maze._y1 = action->_a30._y1;
+ _vm->_maze._x2 = action->_a30._x2;
+ _vm->_maze._y2 = action->_a30._y2;
+ _vm->_maze._x3 = action->_a30._x3;
+ _vm->_maze._x4 = action->_a30._x4;
+ _vm->_maze._firstScreenIndex = action->_a30._firstScreenIndex;
+ break;
+ case EXIT_MAZE: // act31: Disable maze mode
+ _vm->_maze._enabledFl = false;
break;
case INIT_PRIORITY:
- _vm->_object->_objects[action->a32.objIndex].priority = action->a32.priority;
+ _vm->_object->_objects[action->_a32._objIndex]._priority = action->_a32._priority;
break;
case INIT_SCREEN:
- _vm->_object->_objects[action->a33.objIndex].screenIndex = action->a33.screenIndex;
+ _vm->_object->_objects[action->_a33._objIndex]._screenIndex = action->_a33._screenIndex;
break;
- case AGSCHEDULE: // act34: Schedule a (global) action list
- insertActionList(action->a34.actIndex);
+ case AGSCHEDULE: // act34: Schedule a (global) action list
+ insertActionList(action->_a34._actIndex);
break;
- case REMAPPAL: // act35: Remap a palette color
- _vm->_screen->remapPal(action->a35.oldColorIndex, action->a35.newColorIndex);
+ case REMAPPAL: // act35: Remap a palette color
+ _vm->_screen->remapPal(action->_a35._oldColorIndex, action->_a35._newColorIndex);
break;
- case COND_NOUN: // act36: Conditional on noun mentioned
- if (_vm->_parser->isWordPresent(_vm->_text->getNounArray(action->a36.nounIndex)))
- insertActionList(action->a36.actPassIndex);
+ case COND_NOUN: // act36: Conditional on noun mentioned
+ if (_vm->_parser->isWordPresent(_vm->_text->getNounArray(action->_a36._nounIndex)))
+ insertActionList(action->_a36._actPassIndex);
else
- insertActionList(action->a36.actFailIndex);
+ insertActionList(action->_a36._actFailIndex);
break;
- case SCREEN_STATE: // act37: Set new screen state
- _vm->_screenStates[action->a37.screenIndex] = action->a37.newState;
+ case SCREEN_STATE: // act37: Set new screen state
+ _vm->_screenStates[action->_a37._screenIndex] = action->_a37._newState;
break;
- case INIT_LIPS: // act38: Position lips on object
- _vm->_object->_objects[action->a38.lipsObjIndex].x = _vm->_object->_objects[action->a38.objIndex].x + action->a38.dxLips;
- _vm->_object->_objects[action->a38.lipsObjIndex].y = _vm->_object->_objects[action->a38.objIndex].y + action->a38.dyLips;
- _vm->_object->_objects[action->a38.lipsObjIndex].screenIndex = *_vm->_screen_p; // Don't forget screen!
- _vm->_object->_objects[action->a38.lipsObjIndex].cycling = kCycleForward;
+ case INIT_LIPS: // act38: Position lips on object
+ _vm->_object->_objects[action->_a38._lipsObjIndex]._x = _vm->_object->_objects[action->_a38._objIndex]._x + action->_a38._dxLips;
+ _vm->_object->_objects[action->_a38._lipsObjIndex]._y = _vm->_object->_objects[action->_a38._objIndex]._y + action->_a38._dyLips;
+ _vm->_object->_objects[action->_a38._lipsObjIndex]._screenIndex = *_vm->_screenPtr; // Don't forget screen!
+ _vm->_object->_objects[action->_a38._lipsObjIndex]._cycling = kCycleForward;
break;
- case INIT_STORY_MODE: // act39: Init story_mode flag
+ case INIT_STORY_MODE: // act39: Init story_mode flag
// This is similar to the QUIET path mode, except that it is
// independant of it and it additionally disables the ">" prompt
- gameStatus.storyModeFl = action->a39.storyModeFl;
+ gameStatus._storyModeFl = action->_a39._storyModeFl;
break;
- case WARN: // act40: Text box (CF TEXT)
- Utils::notifyBox(_vm->_file->fetchString(action->a40.stringIndex));
+ case WARN: // act40: Text box (CF TEXT)
+ Utils::notifyBox(_vm->_file->fetchString(action->_a40._stringIndex));
break;
- case COND_BONUS: // act41: Perform action if got bonus
- if (_points[action->a41.BonusIndex].scoredFl)
- insertActionList(action->a41.actPassIndex);
+ case COND_BONUS: // act41: Perform action if got bonus
+ if (_points[action->_a41._bonusIndex]._scoredFl)
+ insertActionList(action->_a41._actPassIndex);
else
- insertActionList(action->a41.actFailIndex);
+ insertActionList(action->_a41._actFailIndex);
break;
- case TEXT_TAKE: // act42: Text box with "take" message
- Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->a42.objIndex].nounIndex, TAKE_NAME)));
+ case TEXT_TAKE: // act42: Text box with "take" message
+ Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->_a42._objIndex]._nounIndex, TAKE_NAME)));
break;
- case YESNO: // act43: Prompt user for Yes or No
- if (Utils::yesNoBox(_vm->_file->fetchString(action->a43.promptIndex)))
- insertActionList(action->a43.actYesIndex);
+ case YESNO: // act43: Prompt user for Yes or No
+ if (Utils::yesNoBox(_vm->_file->fetchString(action->_a43._promptIndex)))
+ insertActionList(action->_a43._actYesIndex);
else
- insertActionList(action->a43.actNoIndex);
+ insertActionList(action->_a43._actNoIndex);
break;
- case STOP_ROUTE: // act44: Stop any route in progress
+ case STOP_ROUTE: // act44: Stop any route in progress
_vm->_route->resetRoute();
break;
- case COND_ROUTE: // act45: Conditional on route in progress
- if (_vm->_route->getRouteIndex() >= action->a45.routeIndex)
- insertActionList(action->a45.actPassIndex);
+ case COND_ROUTE: // act45: Conditional on route in progress
+ if (_vm->_route->getRouteIndex() >= action->_a45._routeIndex)
+ insertActionList(action->_a45._actPassIndex);
else
- insertActionList(action->a45.actFailIndex);
+ insertActionList(action->_a45._actFailIndex);
break;
- case INIT_JUMPEXIT: // act46: Init status.jumpexit flag
+ case INIT_JUMPEXIT: // act46: Init status.jumpexit flag
// This is to allow left click on exit to get there immediately
// For example the plane crash in Hugo2 where hero is invisible
// Couldn't use INVISIBLE flag since conflicts with boat in Hugo1
- _vm->_mouse->setJumpExitFl(action->a46.jumpExitFl);
+ _vm->_mouse->setJumpExitFl(action->_a46._jumpExitFl);
break;
- case INIT_VIEW: // act47: Init object.viewx, viewy, dir
- _vm->_object->_objects[action->a47.objIndex].viewx = action->a47.viewx;
- _vm->_object->_objects[action->a47.objIndex].viewy = action->a47.viewy;
- _vm->_object->_objects[action->a47.objIndex].direction = action->a47.direction;
+ case INIT_VIEW: // act47: Init object._viewx, viewy, dir
+ _vm->_object->_objects[action->_a47._objIndex]._viewx = action->_a47._viewx;
+ _vm->_object->_objects[action->_a47._objIndex]._viewy = action->_a47._viewy;
+ _vm->_object->_objects[action->_a47._objIndex]._direction = action->_a47._direction;
break;
- case INIT_OBJ_FRAME: // act48: Set seq,frame number to use
+ case INIT_OBJ_FRAME: // act48: Set seq,frame number to use
// Note: Don't set a sequence at time 0 of a new screen, it causes
// problems clearing the boundary bits of the object! t>0 is safe
- _vm->_object->_objects[action->a48.objIndex].currImagePtr = _vm->_object->_objects[action->a48.objIndex].seqList[action->a48.seqIndex].seqPtr;
- for (dx = 0; dx < action->a48.frameIndex; dx++)
- _vm->_object->_objects[action->a48.objIndex].currImagePtr = _vm->_object->_objects[action->a48.objIndex].currImagePtr->nextSeqPtr;
+ _vm->_object->_objects[action->_a48._objIndex]._currImagePtr = _vm->_object->_objects[action->_a48._objIndex]._seqList[action->_a48._seqIndex]._seqPtr;
+ for (dx = 0; dx < action->_a48._frameIndex; dx++)
+ _vm->_object->_objects[action->_a48._objIndex]._currImagePtr = _vm->_object->_objects[action->_a48._objIndex]._currImagePtr->_nextSeqPtr;
break;
case OLD_SONG:
// Replaces ACT26 for DOS games.
- _vm->_sound->_DOSSongPtr = _vm->_text->getTextData(action->a49.songIndex);
+ _vm->_sound->_DOSSongPtr = _vm->_text->getTextData(action->_a49._songIndex);
break;
default:
error("An error has occurred: %s", "doAction");
break;
}
- if (action->a0.actType == NEW_SCREEN) { // New_screen() deletes entire list
- return 0; // next_p = 0 since list now empty
+ if (action->_a0._actType == NEW_SCREEN) { // New_screen() deletes entire list
+ return 0; // nextEvent = 0 since list now empty
} else {
- wrkEvent = curEvent->nextEvent;
- delQueue(curEvent); // Return event to free list
- return wrkEvent; // Return next event ptr
+ wrkEvent = curEvent->_nextEvent;
+ delQueue(curEvent); // Return event to free list
+ return wrkEvent; // Return next event ptr
}
}
@@ -1441,41 +1441,41 @@ event_t *Scheduler::doAction(event_t *curEvent) {
* was modified to allow deletes anywhere in the list, and the DEL_EVENT
* action was modified to perform the actual delete.
*/
-void Scheduler::delQueue(event_t *curEvent) {
+void Scheduler::delQueue(Event *curEvent) {
debugC(4, kDebugSchedule, "delQueue()");
- if (curEvent == _headEvent) { // If p was the head ptr
- _headEvent = curEvent->nextEvent; // then make new head_p
- } else { // Unlink p
- curEvent->prevEvent->nextEvent = curEvent->nextEvent;
- if (curEvent->nextEvent)
- curEvent->nextEvent->prevEvent = curEvent->prevEvent;
+ if (curEvent == _headEvent) { // If p was the head ptr
+ _headEvent = curEvent->_nextEvent; // then make new head_p
+ } else { // Unlink p
+ curEvent->_prevEvent->_nextEvent = curEvent->_nextEvent;
+ if (curEvent->_nextEvent)
+ curEvent->_nextEvent->_prevEvent = curEvent->_prevEvent;
else
- _tailEvent = curEvent->prevEvent;
+ _tailEvent = curEvent->_prevEvent;
}
if (_headEvent)
- _headEvent->prevEvent = 0; // Mark end of list
+ _headEvent->_prevEvent = 0; // Mark end of list
else
- _tailEvent = 0; // Empty queue
+ _tailEvent = 0; // Empty queue
- curEvent->nextEvent = _freeEvent; // Return p to free list
- if (_freeEvent) // Special case, if free list was empty
- _freeEvent->prevEvent = curEvent;
+ curEvent->_nextEvent = _freeEvent; // Return p to free list
+ if (_freeEvent) // Special case, if free list was empty
+ _freeEvent->_prevEvent = curEvent;
_freeEvent = curEvent;
}
/**
* Delete all the active events of a given type
*/
-void Scheduler::delEventType(const action_t actTypeDel) {
+void Scheduler::delEventType(const Action _actTypeDel) {
// Note: actions are not deleted here, simply turned into NOPs!
- event_t *wrkEvent = _headEvent; // The earliest event
- event_t *saveEvent;
+ Event *wrkEvent = _headEvent; // The earliest event
+ Event *saveEvent;
- while (wrkEvent) { // While events found in list
- saveEvent = wrkEvent->nextEvent;
- if (wrkEvent->action->a20.actType == actTypeDel)
+ while (wrkEvent) { // While events found in list
+ saveEvent = wrkEvent->_nextEvent;
+ if (wrkEvent->_action->_a20._actType == _actTypeDel)
delQueue(wrkEvent);
wrkEvent = saveEvent;
}
@@ -1486,8 +1486,8 @@ void Scheduler::delEventType(const action_t actTypeDel) {
*/
void Scheduler::savePoints(Common::WriteStream *out) const {
for (int i = 0; i < _numBonuses; i++) {
- out->writeByte(_points[i].score);
- out->writeByte((_points[i].scoredFl) ? 1 : 0);
+ out->writeByte(_points[i]._score);
+ out->writeByte((_points[i]._scoredFl) ? 1 : 0);
}
}
@@ -1497,8 +1497,8 @@ void Scheduler::savePoints(Common::WriteStream *out) const {
void Scheduler::restorePoints(Common::ReadStream *in) {
// Restore points table
for (int i = 0; i < _numBonuses; i++) {
- _points[i].score = in->readByte();
- _points[i].scoredFl = (in->readByte() == 1);
+ _points[i]._score = in->readByte();
+ _points[i]._scoredFl = (in->readByte() == 1);
}
}
@@ -1524,30 +1524,30 @@ uint32 Scheduler_v1d::getTicks() {
void Scheduler_v1d::runScheduler() {
debugC(6, kDebugSchedule, "runScheduler");
- uint32 ticker = getTicks(); // The time now, in ticks
- event_t *curEvent = _headEvent; // The earliest event
+ uint32 ticker = getTicks(); // The time now, in ticks
+ Event *curEvent = _headEvent; // The earliest event
- while (curEvent && (curEvent->time <= ticker)) // While mature events found
- curEvent = doAction(curEvent); // Perform the action (returns next_p)
+ while (curEvent && (curEvent->_time <= ticker)) // While mature events found
+ curEvent = doAction(curEvent); // Perform the action (returns nextEvent)
}
-void Scheduler_v1d::promptAction(act *action) {
+void Scheduler_v1d::promptAction(Act *action) {
Common::String response;
- response = Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex));
+ response = Utils::promptBox(_vm->_file->fetchString(action->_a3._promptIndex));
response.toLowercase();
char resp[256];
Common::strlcpy(resp, response.c_str(), 256);
- if (action->a3.encodedFl)
+ if (action->_a3._encodedFl)
decodeString(resp);
- if (strstr(resp, _vm->_file->fetchString(action->a3.responsePtr[0])))
- insertActionList(action->a3.actPassIndex);
+ if (strstr(resp, _vm->_file->fetchString(action->_a3._responsePtr[0])))
+ insertActionList(action->_a3._actPassIndex);
else
- insertActionList(action->a3.actFailIndex);
+ insertActionList(action->_a3._actFailIndex);
}
/**
@@ -1574,27 +1574,27 @@ const char *Scheduler_v2d::getCypher() const {
return "Copyright 1991, Gray Design Associates";
}
-void Scheduler_v2d::promptAction(act *action) {
+void Scheduler_v2d::promptAction(Act *action) {
Common::String response;
- response = Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex));
+ response = Utils::promptBox(_vm->_file->fetchString(action->_a3._promptIndex));
response.toLowercase();
- debug(1, "doAction(act3), expecting answer %s", _vm->_file->fetchString(action->a3.responsePtr[0]));
+ debug(1, "doAction(act3), expecting answer %s", _vm->_file->fetchString(action->_a3._responsePtr[0]));
bool found = false;
- const char *tmpStr; // General purpose string ptr
+ const char *tmpStr; // General purpose string ptr
- for (int dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) {
- tmpStr = _vm->_file->fetchString(action->a3.responsePtr[dx]);
+ for (int dx = 0; !found && (action->_a3._responsePtr[dx] != -1); dx++) {
+ tmpStr = _vm->_file->fetchString(action->_a3._responsePtr[dx]);
if (response.contains(tmpStr))
found = true;
}
if (found)
- insertActionList(action->a3.actPassIndex);
+ insertActionList(action->_a3._actPassIndex);
else
- insertActionList(action->a3.actFailIndex);
+ insertActionList(action->_a3._actFailIndex);
}
/**
@@ -1638,12 +1638,12 @@ uint32 Scheduler_v1w::getTicks() {
void Scheduler_v1w::runScheduler() {
debugC(6, kDebugSchedule, "runScheduler");
- uint32 ticker = getTicks(); // The time now, in ticks
- event_t *curEvent = _headEvent; // The earliest event
+ uint32 ticker = getTicks(); // The time now, in ticks
+ Event *curEvent = _headEvent; // The earliest event
- while (curEvent && (curEvent->time <= ticker)) // While mature events found
- curEvent = doAction(curEvent); // Perform the action (returns next_p)
+ while (curEvent && (curEvent->_time <= ticker)) // While mature events found
+ curEvent = doAction(curEvent); // Perform the action (returns nextEvent)
- _vm->getGameStatus().tick++; // Accessed elsewhere via getTicks()
+ _vm->getGameStatus()._tick++; // Accessed elsewhere via getTicks()
}
} // End of namespace Hugo
diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h
index 60d51f0673..37851f1ebc 100644
--- a/engines/hugo/schedule.h
+++ b/engines/hugo/schedule.h
@@ -37,7 +37,7 @@ namespace Hugo {
/**
* Following defines the action types and action list
*/
-enum action_t { // Parameters:
+enum Action { // Parameters:
ANULL = 0xff, // Special NOP used to 'delete' events in DEL_EVENTS
ASCHEDULE = 0, // 0 - Ptr to action list to be rescheduled
START_OBJ, // 1 - Object number
@@ -56,7 +56,7 @@ enum action_t { // Parameters:
SWAP_IMAGES, // 13 - Swap 2 object images
COND_SCR, // 14 - Conditional on current screen
AUTOPILOT, // 15 - Set object to home in on another (stationary) object
- INIT_OBJ_SEQ, // 16 - Object number, sequence index to set curr_seq_p to
+ INIT_OBJ_SEQ, // 16 - Object number, sequence index to set curr_seqPtr to
SET_STATE_BITS, // 17 - Objnum, mask to OR with obj states word
CLEAR_STATE_BITS, // 18 - Objnum, mask to ~AND with obj states word
TEST_STATE_BITS, // 19 - Objnum, mask to test obj states word
@@ -88,429 +88,430 @@ enum action_t { // Parameters:
COND_ROUTE, // 45 - Conditional on route in progress
INIT_JUMPEXIT, // 46 - Initialize status.jumpexit
INIT_VIEW, // 47 - Initialize viewx, viewy, dir
- INIT_OBJ_FRAME, // 48 - Object number, seq,frame to set curr_seq_p to
+ INIT_OBJ_FRAME, // 48 - Object number, seq,frame to set curr_seqPtr to
OLD_SONG = 49 // Added by Strangerke - Set currently playing sound, old way: that is, using a string index instead of a reference in a file
};
struct act0 { // Type 0 - Schedule
- action_t actType; // The type of action
- int timer; // Time to set off the action
- uint16 actIndex; // Ptr to an action list
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ uint16 _actIndex; // Ptr to an action list
};
struct act1 { // Type 1 - Start an object
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int cycleNumb; // Number of times to cycle
- cycle_t cycle; // Direction to start cycling
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _cycleNumb; // Number of times to cycle
+ Cycle _cycle; // Direction to start cycling
};
struct act2 { // Type 2 - Initialize an object coords
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int x, y; // Coordinates
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _x, _y; // Coordinates
};
struct act3 { // Type 3 - Prompt user for text
- action_t actType; // The type of action
- int timer; // Time to set off the action
- uint16 promptIndex; // Index of prompt string
- int *responsePtr; // Array of indexes to valid response string(s) (terminate list with -1)
- uint16 actPassIndex; // Ptr to action list if success
- uint16 actFailIndex; // Ptr to action list if failure
- bool encodedFl; // (HUGO 1 DOS ONLY) Whether response is encoded or not
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ uint16 _promptIndex; // Index of prompt string
+ int *_responsePtr; // Array of indexes to valid response string(s) (terminate list with -1)
+ uint16 _actPassIndex; // Ptr to action list if success
+ uint16 _actFailIndex; // Ptr to action list if failure
+ bool _encodedFl; // (HUGO 1 DOS ONLY) Whether response is encoded or not
};
struct act4 { // Type 4 - Set new background color
- action_t actType; // The type of action
- int timer; // Time to set off the action
- long newBackgroundColor; // New color
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ long _newBackgroundColor; // New color
};
struct act5 { // Type 5 - Initialize an object velocity
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int vx, vy; // velocity
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _vx, _vy; // velocity
};
struct act6 { // Type 6 - Initialize an object carrying
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- bool carriedFl; // carrying
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ bool _carriedFl; // carrying
};
struct act7 { // Type 7 - Initialize an object to hero's coords
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
};
struct act8 { // Type 8 - switch to new screen
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int screenIndex; // The new screen number
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _screenIndex; // The new screen number
};
struct act9 { // Type 9 - Initialize an object state
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- byte newState; // New state
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ byte _newState; // New state
};
struct act10 { // Type 10 - Initialize an object path type
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int newPathType; // New path type
- int8 vxPath, vyPath; // Max delta velocities e.g. for CHASE
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _newPathType; // New path type
+ int8 _vxPath, _vyPath; // Max delta velocities e.g. for CHASE
};
struct act11 { // Type 11 - Conditional on object's state
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- byte stateReq; // Required state
- uint16 actPassIndex; // Ptr to action list if success
- uint16 actFailIndex; // Ptr to action list if failure
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ byte _stateReq; // Required state
+ uint16 _actPassIndex; // Ptr to action list if success
+ uint16 _actFailIndex; // Ptr to action list if failure
};
struct act12 { // Type 12 - Simple text box
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int stringIndex; // Index (enum) of string in strings.dat
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _stringIndex; // Index (enum) of string in strings.dat
};
struct act13 { // Type 13 - Swap first object image with second
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex1; // Index of first object
- int objIndex2; // 2nd
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex1; // Index of first object
+ int _objIndex2; // 2nd
};
struct act14 { // Type 14 - Conditional on current screen
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The required object
- int screenReq; // The required screen number
- uint16 actPassIndex; // Ptr to action list if success
- uint16 actFailIndex; // Ptr to action list if failure
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The required object
+ int _screenReq; // The required screen number
+ uint16 _actPassIndex; // Ptr to action list if success
+ uint16 _actFailIndex; // Ptr to action list if failure
};
struct act15 { // Type 15 - Home in on an object
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex1; // The object number homing in
- int objIndex2; // The object number to home in on
- int8 dx, dy; // Max delta velocities
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex1; // The object number homing in
+ int _objIndex2; // The object number to home in on
+ int8 _dx, _dy; // Max delta velocities
};
+
// Note: Don't set a sequence at time 0 of a new screen, it causes
// problems clearing the boundary bits of the object! timer > 0 is safe
-struct act16 { // Type 16 - Set curr_seq_p to seq
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int seqIndex; // The index of seq array to set to
+struct act16 { // Type 16 - Set curr_seqPtr to seq
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _seqIndex; // The index of seq array to set to
};
struct act17 { // Type 17 - SET obj individual state bits
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int stateMask; // The mask to OR with current obj state
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _stateMask; // The mask to OR with current obj state
};
struct act18 { // Type 18 - CLEAR obj individual state bits
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int stateMask; // The mask to ~AND with current obj state
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _stateMask; // The mask to ~AND with current obj state
};
struct act19 { // Type 19 - TEST obj individual state bits
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int stateMask; // The mask to AND with current obj state
- uint16 actPassIndex; // Ptr to action list (all bits set)
- uint16 actFailIndex; // Ptr to action list (not all set)
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _stateMask; // The mask to AND with current obj state
+ uint16 _actPassIndex; // Ptr to action list (all bits set)
+ uint16 _actFailIndex; // Ptr to action list (not all set)
};
struct act20 { // Type 20 - Remove all events with this type of action
- action_t actType; // The type of action
- int timer; // Time to set off the action
- action_t actTypeDel; // The action type to remove
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ Action _actTypeDel; // The action type to remove
};
struct act21 { // Type 21 - Gameover. Disable hero & commands
- action_t actType; // The type of action
- int timer; // Time to set off the action
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
};
struct act22 { // Type 22 - Initialize an object to hero's coords
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
};
struct act23 { // Type 23 - Exit game back to DOS
- action_t actType; // The type of action
- int timer; // Time to set off the action
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
};
struct act24 { // Type 24 - Get bonus score
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int pointIndex; // Index into points array
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _pointIndex; // Index into points array
};
struct act25 { // Type 25 - Conditional on bounding box
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The required object number
- int x1, y1, x2, y2; // The bounding box
- uint16 actPassIndex; // Ptr to action list if success
- uint16 actFailIndex; // Ptr to action list if failure
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The required object number
+ int _x1, _y1, _x2, _y2; // The bounding box
+ uint16 _actPassIndex; // Ptr to action list if success
+ uint16 _actFailIndex; // Ptr to action list if failure
};
struct act26 { // Type 26 - Play a sound
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int16 soundIndex; // Sound index in data file
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int16 _soundIndex; // Sound index in data file
};
struct act27 { // Type 27 - Add object's value to score
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // object number
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // object number
};
struct act28 { // Type 28 - Subtract object's value from score
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // object number
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // object number
};
struct act29 { // Type 29 - Conditional on object carried
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The required object number
- uint16 actPassIndex; // Ptr to action list if success
- uint16 actFailIndex; // Ptr to action list if failure
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The required object number
+ uint16 _actPassIndex; // Ptr to action list if success
+ uint16 _actFailIndex; // Ptr to action list if failure
};
struct act30 { // Type 30 - Start special maze processing
- action_t actType; // The type of action
- int timer; // Time to set off the action
- byte mazeSize; // Size of (square) maze
- int x1, y1, x2, y2; // Bounding box of maze
- int x3, x4; // Extra x points for perspective correction
- byte firstScreenIndex; // First (top left) screen of maze
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ byte _mazeSize; // Size of (square) maze
+ int _x1, _y1, _x2, _y2; // Bounding box of maze
+ int _x3, _x4; // Extra x points for perspective correction
+ byte _firstScreenIndex; // First (top left) screen of maze
};
struct act31 { // Type 31 - Exit special maze processing
- action_t actType; // The type of action
- int timer; // Time to set off the action
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
};
struct act32 { // Type 32 - Init fbg field of object
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- byte priority; // Value of foreground/background field
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ byte _priority; // Value of foreground/background field
};
struct act33 { // Type 33 - Init screen field of object
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int screenIndex; // Screen number
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _screenIndex; // Screen number
};
struct act34 { // Type 34 - Global Schedule
- action_t actType; // The type of action
- int timer; // Time to set off the action
- uint16 actIndex; // Ptr to an action list
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ uint16 _actIndex; // Ptr to an action list
};
struct act35 { // Type 35 - Remappe palette
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int16 oldColorIndex; // Old color index, 0..15
- int16 newColorIndex; // New color index, 0..15
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int16 _oldColorIndex; // Old color index, 0..15
+ int16 _newColorIndex; // New color index, 0..15
};
struct act36 { // Type 36 - Conditional on noun mentioned
- action_t actType; // The type of action
- int timer; // Time to set off the action
- uint16 nounIndex; // The required noun (list)
- uint16 actPassIndex; // Ptr to action list if success
- uint16 actFailIndex; // Ptr to action list if failure
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ uint16 _nounIndex; // The required noun (list)
+ uint16 _actPassIndex; // Ptr to action list if success
+ uint16 _actFailIndex; // Ptr to action list if failure
};
struct act37 { // Type 37 - Set new screen state
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int screenIndex; // The screen number
- byte newState; // The new state
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _screenIndex; // The screen number
+ byte _newState; // The new state
};
struct act38 { // Type 38 - Position lips
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int lipsObjIndex; // The LIPS object
- int objIndex; // The object to speak
- byte dxLips; // Relative offset of x
- byte dyLips; // Relative offset of y
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _lipsObjIndex; // The LIPS object
+ int _objIndex; // The object to speak
+ byte _dxLips; // Relative offset of x
+ byte _dyLips; // Relative offset of y
};
struct act39 { // Type 39 - Init story mode
- action_t actType; // The type of action
- int timer; // Time to set off the action
- bool storyModeFl; // New state of story_mode flag
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ bool _storyModeFl; // New state of story_mode flag
};
struct act40 { // Type 40 - Unsolicited text box
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int stringIndex; // Index (enum) of string in strings.dat
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _stringIndex; // Index (enum) of string in strings.dat
};
struct act41 { // Type 41 - Conditional on bonus scored
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int BonusIndex; // Index into bonus list
- uint16 actPassIndex; // Index of the action list if scored for the first time
- uint16 actFailIndex; // Index of the action list if already scored
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _bonusIndex; // Index into bonus list
+ uint16 _actPassIndex; // Index of the action list if scored for the first time
+ uint16 _actFailIndex; // Index of the action list if already scored
};
struct act42 { // Type 42 - Text box with "take" string
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object taken
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object taken
};
struct act43 { // Type 43 - Prompt user for Yes or No
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int promptIndex; // index of prompt string
- uint16 actYesIndex; // Ptr to action list if YES
- uint16 actNoIndex; // Ptr to action list if NO
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _promptIndex; // index of prompt string
+ uint16 _actYesIndex; // Ptr to action list if YES
+ uint16 _actNoIndex; // Ptr to action list if NO
};
struct act44 { // Type 44 - Stop any route in progress
- action_t actType; // The type of action
- int timer; // Time to set off the action
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
};
struct act45 { // Type 45 - Conditional on route in progress
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int routeIndex; // Must be >= current status.rindex
- uint16 actPassIndex; // Ptr to action list if en-route
- uint16 actFailIndex; // Ptr to action list if not
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _routeIndex; // Must be >= current status.rindex
+ uint16 _actPassIndex; // Ptr to action list if en-route
+ uint16 _actFailIndex; // Ptr to action list if not
};
struct act46 { // Type 46 - Init status.jumpexit
- action_t actType; // The type of action
- int timer; // Time to set off the action
- bool jumpExitFl; // New state of jumpexit flag
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ bool _jumpExitFl; // New state of jumpexit flag
};
struct act47 { // Type 47 - Init viewx,viewy,dir
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object
- int16 viewx; // object.viewx
- int16 viewy; // object.viewy
- int16 direction; // object.dir
-};
-
-struct act48 { // Type 48 - Set curr_seq_p to frame n
- action_t actType; // The type of action
- int timer; // Time to set off the action
- int objIndex; // The object number
- int seqIndex; // The index of seq array to set to
- int frameIndex; // The index of frame to set to
-};
-
-struct act49 { // Added by Strangerke - Type 79 - Play a song (DOS way)
- action_t actType; // The type of action
- int timer; // Time to set off the action
- uint16 songIndex; // Song index in string array
-};
-
-union act {
- act0 a0;
- act1 a1;
- act2 a2;
- act3 a3;
- act4 a4;
- act5 a5;
- act6 a6;
- act7 a7;
- act8 a8;
- act9 a9;
- act10 a10;
- act11 a11;
- act12 a12;
- act13 a13;
- act14 a14;
- act15 a15;
- act16 a16;
- act17 a17;
- act18 a18;
- act19 a19;
- act20 a20;
- act21 a21;
- act22 a22;
- act23 a23;
- act24 a24;
- act25 a25;
- act26 a26;
- act27 a27;
- act28 a28;
- act29 a29;
- act30 a30;
- act31 a31;
- act32 a32;
- act33 a33;
- act34 a34;
- act35 a35;
- act36 a36;
- act37 a37;
- act38 a38;
- act39 a39;
- act40 a40;
- act41 a41;
- act42 a42;
- act43 a43;
- act44 a44;
- act45 a45;
- act46 a46;
- act47 a47;
- act48 a48;
- act49 a49;
-};
-
-struct event_t {
- act *action; // Ptr to action to perform
- bool localActionFl; // true if action is only for this screen
- uint32 time; // (absolute) time to perform action
- struct event_t *prevEvent; // Chain to previous event
- struct event_t *nextEvent; // Chain to next event
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object
+ int16 _viewx; // object.viewx
+ int16 _viewy; // object.viewy
+ int16 _direction; // object.dir
+};
+
+struct act48 { // Type 48 - Set curr_seqPtr to frame n
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ int _objIndex; // The object number
+ int _seqIndex; // The index of seq array to set to
+ int _frameIndex; // The index of frame to set to
+};
+
+struct act49 { // Added by Strangerke - Type 49 - Play a song (DOS way)
+ Action _actType; // The type of action
+ int _timer; // Time to set off the action
+ uint16 _songIndex; // Song index in string array
+};
+
+union Act {
+ act0 _a0;
+ act1 _a1;
+ act2 _a2;
+ act3 _a3;
+ act4 _a4;
+ act5 _a5;
+ act6 _a6;
+ act7 _a7;
+ act8 _a8;
+ act9 _a9;
+ act10 _a10;
+ act11 _a11;
+ act12 _a12;
+ act13 _a13;
+ act14 _a14;
+ act15 _a15;
+ act16 _a16;
+ act17 _a17;
+ act18 _a18;
+ act19 _a19;
+ act20 _a20;
+ act21 _a21;
+ act22 _a22;
+ act23 _a23;
+ act24 _a24;
+ act25 _a25;
+ act26 _a26;
+ act27 _a27;
+ act28 _a28;
+ act29 _a29;
+ act30 _a30;
+ act31 _a31;
+ act32 _a32;
+ act33 _a33;
+ act34 _a34;
+ act35 _a35;
+ act36 _a36;
+ act37 _a37;
+ act38 _a38;
+ act39 _a39;
+ act40 _a40;
+ act41 _a41;
+ act42 _a42;
+ act43 _a43;
+ act44 _a44;
+ act45 _a45;
+ act46 _a46;
+ act47 _a47;
+ act48 _a48;
+ act49 _a49;
+};
+
+struct Event {
+ Act *_action; // Ptr to action to perform
+ bool _localActionFl; // true if action is only for this screen
+ uint32 _time; // (absolute) time to perform action
+ struct Event *_prevEvent; // Chain to previous event
+ struct Event *_nextEvent; // Chain to next event
};
/**
* Following are points for achieving certain actions.
*/
-struct point_t {
- byte score; // The value of the point
- bool scoredFl; // Whether scored yet
+struct Point {
+ byte _score; // The value of the point
+ bool _scoredFl; // Whether scored yet
};
class Scheduler {
@@ -553,36 +554,36 @@ protected:
uint16 **_screenActs;
byte _numBonuses;
- point_t *_points;
+ Point *_points;
uint32 _curTick; // Current system time in ticks
uint32 _oldTime; // The previous wall time in ticks
uint32 _refreshTimeout;
- event_t *_freeEvent; // Free list of event structures
- event_t *_headEvent; // Head of list (earliest time)
- event_t *_tailEvent; // Tail of list (latest time)
- event_t _events[kMaxEvents]; // Statically declare event structures
+ Event *_freeEvent; // Free list of event structures
+ Event *_headEvent; // Head of list (earliest time)
+ Event *_tailEvent; // Tail of list (latest time)
+ Event _events[kMaxEvents]; // Statically declare event structures
- act **_actListArr;
+ Act **_actListArr;
virtual const char *getCypher() const = 0;
virtual uint32 getTicks() = 0;
- virtual void promptAction(act *action) = 0;
+ virtual void promptAction(Act *action) = 0;
- event_t *doAction(event_t *curEvent);
- event_t *getQueue();
+ Event *doAction(Event *curEvent);
+ Event *getQueue();
uint32 getDosTicks(const bool updateFl);
uint32 getWinTicks() const;
- void delEventType(const action_t actTypeDel);
- void delQueue(event_t *curEvent);
- void findAction(const act* action, int16* index, int16* subElem);
- void insertAction(act *action);
- void readAct(Common::ReadStream &in, act &curAct);
+ void delEventType(const Action actTypeDel);
+ void delQueue(Event *curEvent);
+ void findAction(const Act* action, int16* index, int16* subElem);
+ void insertAction(Act *action);
+ void readAct(Common::ReadStream &in, Act &curAct);
void restoreActions(Common::ReadStream *f);
void restoreEvents(Common::ReadStream *f);
void restorePoints(Common::ReadStream *in);
@@ -604,7 +605,7 @@ public:
protected:
virtual const char *getCypher() const;
virtual uint32 getTicks();
- virtual void promptAction(act *action);
+ virtual void promptAction(Act *action);
};
class Scheduler_v2d : public Scheduler_v1d {
@@ -617,7 +618,7 @@ public:
protected:
virtual const char *getCypher() const;
- void promptAction(act *action);
+ void promptAction(Act *action);
};
class Scheduler_v3d : public Scheduler_v2d {
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index d0b4e3dfe8..aefa03cd5e 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -162,31 +162,31 @@ void SoundHandler::stopMusic() {
* Turn music on and off
*/
void SoundHandler::toggleMusic() {
- _vm->_config.musicFl = !_vm->_config.musicFl;
+ _vm->_config._musicFl = !_vm->_config._musicFl;
- _midiPlayer->pause(!_vm->_config.musicFl);
+ _midiPlayer->pause(!_vm->_config._musicFl);
}
/**
* Turn digitized sound on and off
*/
void SoundHandler::toggleSound() {
- _vm->_config.soundFl = !_vm->_config.soundFl;
+ _vm->_config._soundFl = !_vm->_config._soundFl;
}
-void SoundHandler::playMIDI(sound_pt seq_p, uint16 size) {
- _midiPlayer->play(seq_p, size);
+void SoundHandler::playMIDI(SoundPtr seqPtr, uint16 size) {
+ _midiPlayer->play(seqPtr, size);
}
/**
* Read a tune sequence from the sound database and start playing it
*/
void SoundHandler::playMusic(int16 tune) {
- sound_pt seqPtr; // Sequence data from file
+ SoundPtr seqPtr; // Sequence data from file
uint16 size; // Size of sequence data
- if (_vm->_config.musicFl) {
- _vm->getGameStatus().song = tune;
+ if (_vm->_config._musicFl) {
+ _vm->getGameStatus()._song = tune;
seqPtr = _vm->_file->getSound(tune, &size);
playMIDI(seqPtr, size);
free(seqPtr);
@@ -198,22 +198,22 @@ void SoundHandler::playMusic(int16 tune) {
* Override currently playing sound only if lower or same priority
*/
void SoundHandler::playSound(int16 sound, const byte priority) {
- // uint32 dwVolume; // Left, right volume of sound
- sound_pt sound_p; // Sound data
- uint16 size; // Size of data
+ // uint32 dwVolume; // Left, right volume of sound
+ SoundPtr soundPtr; // Sound data
+ uint16 size; // Size of data
// Sound disabled
- if (!_vm->_config.soundFl || !_vm->_mixer->isReady())
+ if (!_vm->_config._soundFl || !_vm->_mixer->isReady())
return;
syncVolume();
_curPriority = priority;
// Get sound data
- if ((sound_p = _vm->_file->getSound(sound, &size)) == 0)
+ if ((soundPtr = _vm->_file->getSound(sound, &size)) == 0)
return;
- Audio::AudioStream *stream = Audio::makeRawStream(sound_p, size, 11025, Audio::FLAG_UNSIGNED);
+ Audio::AudioStream *stream = Audio::makeRawStream(soundPtr, size, 11025, Audio::FLAG_UNSIGNED);
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream);
}
@@ -245,7 +245,7 @@ void SoundHandler::checkMusic() {
return;
for (int i = 0; _vm->_defltTunes[i] != -1; i++) {
- if (_vm->_defltTunes[i] == _vm->getGameStatus().song) {
+ if (_vm->_defltTunes[i] == _vm->getGameStatus()._song) {
if (_vm->_defltTunes[i + 1] != -1)
playMusic(_vm->_defltTunes[i + 1]);
else
@@ -270,7 +270,7 @@ void SoundHandler::pcspkr_player() {
static const uint16 pcspkrFlats[8] = {1435, 1279, 2342, 2150, 1916, 1755, 1611}; // The flats, Ab to Bb
// Does the user not want any sound?
- if (!_vm->_config.soundFl || !_vm->_mixer->isReady())
+ if (!_vm->_config._soundFl || !_vm->_mixer->isReady())
return;
// Is there no song?
diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h
index cb6d4e3168..b00d93eeb1 100644
--- a/engines/hugo/sound.h
+++ b/engines/hugo/sound.h
@@ -97,7 +97,7 @@ private:
void stopSound();
void stopMusic();
- void playMIDI(sound_pt seq_p, uint16 size);
+ void playMIDI(SoundPtr seqPtr, uint16 size);
};
} // End of namespace Hugo
diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp
index 5a2378f4d0..59112504d6 100644
--- a/engines/kyra/animator_hof.cpp
+++ b/engines/kyra/animator_hof.cpp
@@ -104,9 +104,7 @@ void KyraEngine_HoF::refreshAnimObjects(int force) {
if (height + y > 143)
height -= height + y - 144;
- _screen->hideMouse();
_screen->copyRegion(x, y, x, y, width, height, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->showMouse();
curObject->needRefresh = false;
}
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index 29fa3aba80..83e774e2fc 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -175,9 +175,7 @@ void KyraEngine_MR::refreshAnimObjects(int force) {
height -= height + y - (maxY + 1);
if (height > 0) {
- _screen->hideMouse();
_screen->copyRegion(x, y, x, y, width, height, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->showMouse();
}
curObject->needRefresh = false;
@@ -209,9 +207,7 @@ void KyraEngine_MR::updateItemAnimations() {
nextFrame = true;
_screen->drawShape(2, getShapePtr(422 + i), 9, 0, 0, 0);
_screen->drawShape(2, getShapePtr(shpIdx), 9, 0, 0, 0);
- _screen->hideMouse();
_screen->copyRegion(9, 0, _inventoryX[i], _inventoryY[i], 24, 20, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->showMouse();
}
}
}
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 46dfec84ff..e422f3ea19 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -30,6 +30,7 @@
#include "common/config-manager.h"
#include "common/system.h"
#include "common/savefile.h"
+#include "common/translation.h"
#include "engines/advancedDetector.h"
@@ -50,11 +51,95 @@ const char *const directoryGlobs[] = {
0
};
+const ADExtraGuiOptionsMap gameGuiOptions[] = {
+ // Kyrandia 3 options
+
+ {
+ GAMEOPTION_KYRA3_AUDIENCE,
+ {
+ // I18N: Studio audience adds an applause and cheering sounds whenever
+ // Malcolm makes a joke.
+ _s("Studio audience"),
+ _s("Enable studio audience"),
+ "studio_audience",
+ true
+ }
+ },
+
+ {
+ GAMEOPTION_KYRA3_SKIP,
+ {
+ // I18N: This option allows the user to skip text and cutscenes.
+ _s("Skip support"),
+ _s("Allow text and cutscenes to be skipped"),
+ "skip_support",
+ true
+ }
+ },
+
+ {
+ GAMEOPTION_KYRA3_HELIUM,
+ {
+ // I18N: Helium mode makes people sound like they've inhaled Helium.
+ _s("Helium mode"),
+ _s("Enable helium mode"),
+ "helium_mode",
+ false
+ }
+ },
+
+#ifdef ENABLE_LOL
+ // LoL options
+
+ {
+ GAMEOPTION_LOL_SCROLLING,
+ {
+ // I18N: When enabled, this option makes scrolling smoother when
+ // changing from one screen to another.
+ _s("Smooth scrolling"),
+ _s("Enable smooth scrolling when walking"),
+ "smooth_scrolling",
+ true
+ }
+ },
+
+ {
+ GAMEOPTION_LOL_CURSORS,
+ {
+ // I18N: When enabled, this option changes the cursor when it floats to the
+ // edge of the screen to a directional arrow. The player can then click to
+ // walk towards that direction.
+ _s("Floating cursors"),
+ _s("Enable floating cursors"),
+ "floating_cursors",
+ false
+ }
+ },
+#endif
+
+#ifdef ENABLE_EOB
+ // EoB options
+
+ {
+ GAMEOPTION_EOB_HPGRAPHS,
+ {
+ // I18N: HP stands for Hit Points
+ _s("HP bar graphs"),
+ _s("Enable hit point bar graphs"),
+ "hpbargraphs",
+ true
+ }
+ },
+#endif
+
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
} // End of anonymous namespace
class KyraMetaEngine : public AdvancedMetaEngine {
public:
- KyraMetaEngine() : AdvancedMetaEngine(adGameDescs, sizeof(KYRAGameDescription), gameList) {
+ KyraMetaEngine() : AdvancedMetaEngine(adGameDescs, sizeof(KYRAGameDescription), gameList, gameGuiOptions) {
_md5Bytes = 1024 * 1024;
_maxScanDepth = 2;
_directoryGlobs = directoryGlobs;
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index 204c49cd2c..e2162f20e2 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -60,6 +60,15 @@ namespace {
#define EOB_FLAGS FLAGS(false, false, false, false, false, false, false, false, Kyra::GI_EOB1)
#define EOB2_FLAGS FLAGS(false, false, false, false, false, false, false, false, Kyra::GI_EOB2)
+#define GAMEOPTION_KYRA3_AUDIENCE GUIO_GAMEOPTIONS1
+#define GAMEOPTION_KYRA3_SKIP GUIO_GAMEOPTIONS2
+#define GAMEOPTION_KYRA3_HELIUM GUIO_GAMEOPTIONS3
+
+#define GAMEOPTION_LOL_SCROLLING GUIO_GAMEOPTIONS4
+#define GAMEOPTION_LOL_CURSORS GUIO_GAMEOPTIONS5
+
+#define GAMEOPTION_EOB_HPGRAPHS GUIO_GAMEOPTIONS6
+
const KYRAGameDescription adGameDescs[] = {
/* disable these targets until they get supported
{
@@ -150,7 +159,7 @@ const KYRAGameDescription adGameDescs[] = {
},
KYRA1_FLOPPY_FLAGS
},
- {
+ { // russian fan translation
{
"kyra1",
"Extracted",
@@ -775,7 +784,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FLAGS
},
@@ -791,7 +800,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FLAGS
},
@@ -807,7 +816,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FLAGS
},
@@ -825,7 +834,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_INS_FLAGS
},
@@ -841,7 +850,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_INS_FLAGS
},
@@ -857,7 +866,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_INS_FLAGS
},
@@ -875,7 +884,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_INS_FLAGS
},
@@ -891,7 +900,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_INS_FLAGS
},
@@ -907,7 +916,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_INS_FLAGS
},
@@ -925,7 +934,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -941,7 +950,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -957,7 +966,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -975,7 +984,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -991,7 +1000,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -1007,7 +1016,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -1026,7 +1035,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FLAGS
},
@@ -1043,7 +1052,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FLAGS
},
@@ -1060,7 +1069,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FLAGS
},
@@ -1077,7 +1086,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FLAGS
},
@@ -1094,7 +1103,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FLAGS
},
@@ -1111,7 +1120,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FLAGS
},
@@ -1129,7 +1138,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1147,7 +1156,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1164,7 +1173,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1182,7 +1191,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1199,7 +1208,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1216,7 +1225,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1233,7 +1242,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1250,7 +1259,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1267,7 +1276,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO7(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1283,7 +1292,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1299,7 +1308,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1315,7 +1324,23 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
+ },
+ LOL_FLOPPY_CMP_FLAGS
+ },
+
+ { // French floppy version 1.20, bug #3552534 "KYRA: LOL Floppy FR version unknown"
+ {
+ "lol",
+ 0,
+ {
+ { "WESTWOOD.1", 0, "43857e24d1fc6731f3b13d9ed6db8c3a", -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::FR_FRA,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1332,7 +1357,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_FLAGS
},
@@ -1349,7 +1374,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_FLAGS
},
@@ -1366,7 +1391,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_FLAGS
},
@@ -1383,7 +1408,24 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
+ },
+ LOL_FLOPPY_FLAGS
+ },
+
+ { // French floppy version 1.23, bug #3552534 "KYRA: LOL Floppy FR version unknown"
+ {
+ "lol",
+ "Extracted",
+ {
+ { "GENERAL.PAK", 0, "f4fd14f244bd7c7fa08d026fafe44cc5", -1 },
+ { "CHAPTER7.PAK", 0, "733e33c8444c93843dac3b683c283eaa", -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::FR_FRA,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_FLAGS
},
@@ -1401,7 +1443,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
+ GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -1418,7 +1460,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_NO_FLAGS,
- GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9801)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9801, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
},
LOL_PC98_SJIS_FLAGS
},
@@ -1469,7 +1511,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GUIO_RENDERCGA)
+ GUIO7(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GUIO_RENDERCGA, GAMEOPTION_EOB_HPGRAPHS)
},
EOB_FLAGS
},
@@ -1485,7 +1527,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GUIO_RENDERCGA)
+ GUIO7(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GUIO_RENDERCGA, GAMEOPTION_EOB_HPGRAPHS)
},
EOB_FLAGS
},
@@ -1501,7 +1543,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GAMEOPTION_EOB_HPGRAPHS)
},
EOB2_FLAGS
},
@@ -1517,7 +1559,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GAMEOPTION_EOB_HPGRAPHS)
},
EOB2_FLAGS
},
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 1489e4f1f5..fadb1066e0 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -770,7 +770,7 @@ void EoBCoreEngine::releaseItemsAndDecorationsShapes() {
if (_spellShapes) {
for (int i = 0; i < 4; i++) {
if (_spellShapes[i])
- delete [] _spellShapes[i];
+ delete[] _spellShapes[i];
}
delete[] _spellShapes;
}
@@ -820,7 +820,7 @@ void EoBCoreEngine::releaseItemsAndDecorationsShapes() {
if (_firebeamShapes[i])
delete[] _firebeamShapes[i];
}
- delete []_firebeamShapes;
+ delete[] _firebeamShapes;
}
delete[] _redSplatShape;
@@ -2066,7 +2066,7 @@ bool EoBCoreEngine::characterAttackHitTest(int charIndex, int monsterIndex, int
s = CLIP(s, 1, 20);
- return s < m ? false : true;
+ return s >= m;
}
bool EoBCoreEngine::monsterAttackHitTest(EoBMonsterInPlay *m, int charIndex) {
@@ -2300,7 +2300,7 @@ bool EoBCoreEngine::trySavingThrow(void *target, int hpModifier, int level, int
s -= constMod[c->constitutionCur];
}
- return rollDice(1, 20) < s ? false : true;
+ return rollDice(1, 20) >= s;
}
bool EoBCoreEngine::specialAttackSavingThrow(int charIndex, int type) {
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index 050fe2b794..f60e755dd7 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -263,7 +263,7 @@ protected:
// Main Menu, Intro, Finale
virtual int mainMenu() = 0;
- virtual void seq_xdeath() {};
+ virtual void seq_xdeath() {}
virtual void seq_playFinale() = 0;
bool _playFinale;
@@ -921,8 +921,8 @@ protected:
void usePotion(int charIndex, int weaponSlot);
void useWand(int charIndex, int weaponSlot);
- virtual void turnUndeadAuto() {};
- virtual void turnUndeadAutoHit() {};
+ virtual void turnUndeadAuto() {}
+ virtual void turnUndeadAutoHit() {}
void castSpell(int spell, int weaponSlot);
void removeCharacterEffect(int spell, int charIndex, int showWarning);
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index e8e69d5b1f..e3c0743e5c 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -1460,7 +1460,7 @@ void GUI_EoB::processButton(Button *button) {
// nullsub (at least EOBII)
} else if (button->data0Val1 == 4) {
if (button->data1Callback)
- (*button->data1Callback.get())(button);
+ (*button->data1Callback)(button);
}
} else if (button->data1Val1 == 2) {
if (!(button->flags2 & 4))
@@ -1469,7 +1469,7 @@ void GUI_EoB::processButton(Button *button) {
// nullsub (at least EOBII)
} else if (button->data1Val1 == 4) {
if (button->data1Callback)
- (*button->data1Callback.get())(button);
+ (*button->data1Callback)(button);
}
}
@@ -1486,7 +1486,7 @@ void GUI_EoB::processButton(Button *button) {
// nullsub (at least EOBII)
} else if (button->data0Val1 == 4) {
if (button->data2Callback)
- (*button->data2Callback.get())(button);
+ (*button->data2Callback)(button);
}
} else if (button->data2Val1 == 2) {
_screen->drawBox(sx, sy, fx2, fy2, (button->flags2 & 1) ? button->data3Val2 : button->data2Val2);
@@ -1494,7 +1494,7 @@ void GUI_EoB::processButton(Button *button) {
// nullsub (at least EOBII)
} else if (button->data2Val1 == 4) {
if (button->data2Callback)
- (*button->data2Callback.get())(button);
+ (*button->data2Callback)(button);
}
}
@@ -1507,7 +1507,7 @@ void GUI_EoB::processButton(Button *button) {
// nullsub (at least EOBII)
} else if (button->data0Val1 == 4) {
if (button->data0Callback)
- (*button->data0Callback.get())(button);
+ (*button->data0Callback)(button);
} else if (button->data0Val1 == 5) {
_screen->drawBox(sx, sy, fx2, fy2, button->data0Val2);
} else {
@@ -1876,7 +1876,7 @@ int GUI_EoB::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8
processButton(buttonList);
if (v6 && buttonList->buttonCallback)
- runLoop = ((*buttonList->buttonCallback.get())(buttonList)) ? false : true;
+ runLoop = !(*buttonList->buttonCallback)(buttonList);
if ((flgs2 & 2) && (flgs & 0x20))
runLoop = false;
@@ -2331,7 +2331,7 @@ bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
_screen->setFont(of);
_screen->setScreenDim(od);
- return newHighlight ? false : true;
+ return newHighlight == 0;
}
void GUI_EoB::messageDialogue(int dim, int id, int buttonTextCol) {
@@ -3548,7 +3548,7 @@ bool GUI_EoB::confirmDialogue(int id) {
_vm->removeInputTop();
if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
- result = lastHighlight ? false : true;
+ result = lastHighlight == 0;
inputFlag = 0x8021 + lastHighlight;
runLoop = false;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP6] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) {
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index c1bfee066f..36fbb0b40a 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -121,14 +121,12 @@ int KyraEngine_HoF::buttonInventory(Button *button) {
if (_itemInHand == kItemNone) {
if (item == kItemNone)
return 0;
- _screen->hideMouse();
clearInventorySlot(inventorySlot, 0);
snd_playSoundEffect(0x0B);
setMouseCursor(item);
int string = (_lang == 1) ? getItemCommandStringPickUp(item) : 7;
updateCommandLineEx(item+54, string, 0xD6);
_itemInHand = (int16)item;
- _screen->showMouse();
_mainCharacter.inventory[inventorySlot] = kItemNone;
} else {
if (_mainCharacter.inventory[inventorySlot] != kItemNone) {
@@ -137,23 +135,19 @@ int KyraEngine_HoF::buttonInventory(Button *button) {
item = _mainCharacter.inventory[inventorySlot];
snd_playSoundEffect(0x0B);
- _screen->hideMouse();
clearInventorySlot(inventorySlot, 0);
drawInventoryShape(0, _itemInHand, inventorySlot);
setMouseCursor(item);
int string = (_lang == 1) ? getItemCommandStringPickUp(item) : 7;
updateCommandLineEx(item+54, string, 0xD6);
- _screen->showMouse();
_mainCharacter.inventory[inventorySlot] = _itemInHand;
setHandItem(item);
} else {
snd_playSoundEffect(0x0C);
- _screen->hideMouse();
drawInventoryShape(0, _itemInHand, inventorySlot);
_screen->setMouseCursor(0, 0, getShapePtr(0));
int string = (_lang == 1) ? getItemCommandStringInv(_itemInHand) : 8;
updateCommandLineEx(_itemInHand+54, string, 0xD6);
- _screen->showMouse();
_mainCharacter.inventory[inventorySlot] = _itemInHand;
_itemInHand = kItemNone;
}
@@ -172,9 +166,7 @@ int KyraEngine_HoF::scrollInventory(Button *button) {
memcpy(src+5, dst, sizeof(Item)*5);
memcpy(dst, dst+5, sizeof(Item)*5);
memcpy(dst+5, temp, sizeof(Item)*5);
- _screen->hideMouse();
_screen->copyRegion(0x46, 0x90, 0x46, 0x90, 0x71, 0x2E, 0, 2);
- _screen->showMouse();
redrawInventory(2);
scrollInventoryWheel();
return 0;
@@ -199,9 +191,7 @@ int KyraEngine_HoF::findFreeVisibleInventorySlot() {
void KyraEngine_HoF::removeSlotFromInventory(int slot) {
_mainCharacter.inventory[slot] = kItemNone;
if (slot < 10) {
- _screen->hideMouse();
clearInventorySlot(slot, 0);
- _screen->showMouse();
}
}
@@ -223,15 +213,12 @@ bool KyraEngine_HoF::checkInventoryItemExchange(Item handItem, int slot) {
snd_playSoundEffect(0x68);
_mainCharacter.inventory[slot] = newItem;
- _screen->hideMouse();
clearInventorySlot(slot, 0);
drawInventoryShape(0, newItem, slot);
if (removeItem)
removeHandItem();
- _screen->showMouse();
-
if (_lang != 1)
updateCommandLineEx(newItem+54, 0x2E, 0xD6);
@@ -243,12 +230,10 @@ bool KyraEngine_HoF::checkInventoryItemExchange(Item handItem, int slot) {
void KyraEngine_HoF::drawInventoryShape(int page, Item item, int slot) {
_screen->drawShape(page, getShapePtr(item+64), _inventoryX[slot], _inventoryY[slot], 0, 0);
- _screen->updateScreen();
}
void KyraEngine_HoF::clearInventorySlot(int slot, int page) {
_screen->drawShape(page, getShapePtr(240+slot), _inventoryX[slot], _inventoryY[slot], 0, 0);
- _screen->updateScreen();
}
void KyraEngine_HoF::redrawInventory(int page) {
@@ -256,7 +241,6 @@ void KyraEngine_HoF::redrawInventory(int page) {
_screen->_curPage = page;
const Item *inventory = _mainCharacter.inventory;
- _screen->hideMouse();
for (int i = 0; i < 10; ++i) {
clearInventorySlot(i, page);
if (inventory[i] != kItemNone) {
@@ -264,7 +248,6 @@ void KyraEngine_HoF::redrawInventory(int page) {
drawInventoryShape(page, inventory[i], i);
}
}
- _screen->showMouse();
_screen->updateScreen();
_screen->_curPage = pageBackUp;
@@ -277,17 +260,13 @@ void KyraEngine_HoF::scrollInventoryWheel() {
memcpy(_screenBuffer, _screen->getCPagePtr(2), 64000);
uint8 overlay[0x100];
_screen->generateOverlay(_screen->getPalette(0), overlay, 0, 50);
- _screen->hideMouse();
_screen->copyRegion(0x46, 0x90, 0x46, 0x79, 0x71, 0x17, 0, 2, Screen::CR_NO_P_CHECK);
- _screen->showMouse();
snd_playSoundEffect(0x25);
bool breakFlag = false;
for (int i = 0; i <= 6 && !breakFlag; ++i) {
if (movie.opened()) {
- _screen->hideMouse();
movie.displayFrame(i % frames, 0, 0, 0, 0, 0, 0);
- _screen->showMouse();
_screen->updateScreen();
}
@@ -355,9 +334,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
_bookNewPage = _bookCurPage;
if (_screenBuffer) {
- _screen->hideMouse();
memcpy(_screenBuffer, _screen->getCPagePtr(0), 64000);
- _screen->showMouse();
}
_screen->copyPalette(2, 0);
@@ -382,9 +359,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
restorePage3();
if (_screenBuffer) {
- _screen->hideMouse();
_screen->copyBlockToPage(0, 0, 0, 320, 200, _screenBuffer);
- _screen->showMouse();
}
setHandItem(_itemInHand);
@@ -471,7 +446,6 @@ void KyraEngine_HoF::showBookPage() {
int rightPageY = _bookPageYOffset[_bookCurPage+1];
- _screen->hideMouse();
if (leftPage) {
bookDecodeText(leftPage);
bookPrintText(2, leftPage, 20, leftPageY+20, 0x31);
@@ -483,7 +457,6 @@ void KyraEngine_HoF::showBookPage() {
bookPrintText(2, rightPage, 176, rightPageY+20, 0x31);
delete[] rightPage;
}
- _screen->showMouse();
}
void KyraEngine_HoF::bookLoop() {
@@ -517,10 +490,8 @@ void KyraEngine_HoF::bookLoop() {
loadBookBkgd();
showBookPage();
snd_playSoundEffect(0x64);
- _screen->hideMouse();
_screen->copyRegion(0, 0, 0, 0, 0x140, 0xC8, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- _screen->showMouse();
}
_system->delayMillis(10);
}
@@ -550,9 +521,7 @@ void KyraEngine_HoF::bookPrintText(int dstPage, const uint8 *str, int x, int y,
Screen::FontId oldFont = _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_BOOKFONT_FNT);
_screen->_charWidth = -2;
- _screen->hideMouse();
_screen->printText((const char *)str, x, y, color, (_flags.lang == Common::JA_JPN) ? 0xf6 : 0);
- _screen->showMouse();
_screen->_charWidth = 0;
_screen->setFont(oldFont);
@@ -679,9 +648,7 @@ int GUI_HoF::optionsButton(Button *button) {
_restartGame = false;
_reloadTemporarySave = false;
- _screen->hideMouse();
updateButton(&_vm->_inventoryButtons[0]);
- _screen->showMouse();
if (!_screen->isMouseVisible() && button)
return 0;
@@ -690,9 +657,7 @@ int GUI_HoF::optionsButton(Button *button) {
if (_vm->_mouseState < -1) {
_vm->_mouseState = -1;
- _screen->hideMouse();
_screen->setMouseCursor(1, 1, _vm->getShapePtr(0));
- _screen->showMouse();
return 0;
}
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index 18470e5d76..8e18ff910d 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -48,19 +48,16 @@ int KyraEngine_LoK::buttonInventoryCallback(Button *caller) {
snd_playSoundEffect(0x36);
return 0;
} else {
- _screen->hideMouse();
_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12);
snd_playSoundEffect(0x35);
setMouseItem(inventoryItem);
updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[0], 179);
_itemInHand = inventoryItem;
- _screen->showMouse();
_currentCharacter->inventoryItems[itemOffset] = kItemNone;
}
} else {
if (inventoryItem != kItemNone) {
snd_playSoundEffect(0x35);
- _screen->hideMouse();
_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12);
_screen->drawShape(0, _shapes[216 + _itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
setMouseItem(inventoryItem);
@@ -69,16 +66,13 @@ int KyraEngine_LoK::buttonInventoryCallback(Button *caller) {
updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[0], 179);
else
updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[1], 179);
- _screen->showMouse();
_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
_itemInHand = inventoryItem;
} else {
snd_playSoundEffect(0x32);
- _screen->hideMouse();
_screen->drawShape(0, _shapes[216 + _itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
_screen->setMouseCursor(1, 1, _shapes[0]);
updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _placedList[0], 179);
- _screen->showMouse();
_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
_itemInHand = kItemNone;
}
@@ -243,7 +237,7 @@ int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel)
}
if (mouseWheel && list->mouseWheel == mouseWheel && list->buttonCallback) {
- if ((*list->buttonCallback.get())(list))
+ if ((*list->buttonCallback)(list))
break;
}
@@ -282,7 +276,7 @@ int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel)
if (processMouseClick) {
if (list->buttonCallback) {
- if ((*list->buttonCallback.get())(list))
+ if ((*list->buttonCallback)(list))
break;
}
}
@@ -349,7 +343,7 @@ void GUI_LoK::processButton(Button *button) {
if (processType == 1 && shape)
_screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10);
else if (processType == 4 && callback)
- (*callback.get())(button);
+ (*callback)(button);
}
void GUI_LoK::setGUILabels() {
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index b025aefbd0..a79da0681e 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -2165,7 +2165,7 @@ int GUI_LoL::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseW
if (buttonList->buttonCallback) {
//_vm->removeInputTop();
- if ((*buttonList->buttonCallback.get())(buttonList))
+ if ((*buttonList->buttonCallback)(buttonList))
break;
}
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index e88b7fdffb..37526f9a5f 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -104,7 +104,6 @@ int KyraEngine_MR::callbackButton3(Button *button) {
void KyraEngine_MR::showMessage(const char *string, uint8 c0, uint8 c1) {
_shownMessage = string;
- _screen->hideMouse();
restoreCommandLine();
_restoreCommandLine = false;
@@ -118,8 +117,6 @@ void KyraEngine_MR::showMessage(const char *string, uint8 c0, uint8 c1) {
_screen->updateScreen();
setCommandLineRestoreTimer(7);
}
-
- _screen->showMouse();
}
void KyraEngine_MR::showMessageFromCCode(int string, uint8 c0, int) {
@@ -330,10 +327,8 @@ void KyraEngine_MR::drawMalcolmsMoodText() {
_screen->_curPage = 2;
}
- _screen->hideMouse();
_screen->drawShape(_screen->_curPage, getShapePtr(432), 244, 189, 0, 0);
_text->printText(string, x, y+1, 0xFF, 0xF0, 0x00);
- _screen->showMouse();
_screen->_curPage = pageBackUp;
}
@@ -441,7 +436,6 @@ void KyraEngine_MR::redrawInventory(int page) {
int pageBackUp = _screen->_curPage;
_screen->_curPage = page;
- _screen->hideMouse();
for (int i = 0; i < 10; ++i) {
clearInventorySlot(i, page);
@@ -451,7 +445,6 @@ void KyraEngine_MR::redrawInventory(int page) {
}
}
- _screen->showMouse();
_screen->_curPage = pageBackUp;
if (page == 0 || page == 1)
@@ -489,14 +482,12 @@ int KyraEngine_MR::buttonInventory(Button *button) {
if (slotItem == kItemNone)
return 0;
- _screen->hideMouse();
clearInventorySlot(slot, 0);
snd_playSoundEffect(0x0B, 0xC8);
setMouseCursor(slotItem);
updateItemCommand(slotItem, (_lang == 1) ? getItemCommandStringPickUp(slotItem) : 0, 0xFF);
_itemInHand = slotItem;
_mainCharacter.inventory[slot] = kItemNone;
- _screen->showMouse();
} else if (_itemInHand == 27) {
if (_chatText)
return 0;
@@ -508,21 +499,17 @@ int KyraEngine_MR::buttonInventory(Button *button) {
snd_playSoundEffect(0x0B, 0xC8);
- _screen->hideMouse();
clearInventorySlot(slot, 0);
drawInventorySlot(0, _itemInHand, slot);
setMouseCursor(slotItem);
updateItemCommand(slotItem, (_lang == 1) ? getItemCommandStringPickUp(slotItem) : 0, 0xFF);
_mainCharacter.inventory[slot] = _itemInHand;
_itemInHand = slotItem;
- _screen->showMouse();
} else {
snd_playSoundEffect(0x0C, 0xC8);
- _screen->hideMouse();
drawInventorySlot(0, _itemInHand, slot);
_screen->setMouseCursor(0, 0, getShapePtr(0));
updateItemCommand(_itemInHand, (_lang == 1) ? getItemCommandStringInv(_itemInHand) : 2, 0xFF);
- _screen->showMouse();
_mainCharacter.inventory[slot] = _itemInHand;
_itemInHand = kItemNone;
}
@@ -624,22 +611,18 @@ int KyraEngine_MR::buttonShowScore(Button *button) {
int KyraEngine_MR::buttonJesterStaff(Button *button) {
makeCharFacingMouse();
if (_itemInHand == 27) {
- _screen->hideMouse();
removeHandItem();
snd_playSoundEffect(0x0C, 0xC8);
drawJestersStaff(1, 0);
updateItemCommand(27, 2, 0xFF);
setGameFlag(0x97);
- _screen->showMouse();
} else if (_itemInHand == kItemNone) {
if (queryGameFlag(0x97)) {
- _screen->hideMouse();
snd_playSoundEffect(0x0B, 0xC8);
setHandItem(27);
drawJestersStaff(0, 0);
updateItemCommand(27, 0, 0xFF);
resetGameFlag(0x97);
- _screen->showMouse();
} else {
if (queryGameFlag(0x2F))
objectChat((const char *)getTableEntry(_cCodeFile, 20), 0, 204, 20);
@@ -1108,9 +1091,7 @@ int GUI_MR::redrawButtonCallback(Button *button) {
if (!_displayMenu)
return 0;
- _screen->hideMouse();
_screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xD0);
- _screen->showMouse();
return 0;
}
@@ -1119,9 +1100,7 @@ int GUI_MR::redrawShadedButtonCallback(Button *button) {
if (!_displayMenu)
return 0;
- _screen->hideMouse();
_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xD1, 0xCF);
- _screen->showMouse();
return 0;
}
@@ -1162,9 +1141,7 @@ int GUI_MR::quitGame(Button *caller) {
int GUI_MR::optionsButton(Button *button) {
PauseTimer pause(*_vm->_timer);
- _screen->hideMouse();
updateButton(&_vm->_mainButtonData[0]);
- _screen->showMouse();
if (!_vm->_inventoryState && button && !_vm->_menuDirectlyToLoad)
return 0;
@@ -1179,9 +1156,7 @@ int GUI_MR::optionsButton(Button *button) {
if (_vm->_mouseState < -1) {
_vm->_mouseState = -1;
- _screen->hideMouse();
_screen->setMouseCursor(1, 1, _vm->getShapePtr(0));
- _screen->showMouse();
return 0;
}
diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp
index f3459ddfe3..cec6562dd9 100644
--- a/engines/kyra/gui_v1.cpp
+++ b/engines/kyra/gui_v1.cpp
@@ -70,8 +70,6 @@ void GUI_v1::initMenuLayout(Menu &menu) {
void GUI_v1::initMenu(Menu &menu) {
_menuButtonList = 0;
- _screen->hideMouse();
-
int textX;
int textY;
@@ -192,7 +190,6 @@ void GUI_v1::initMenu(Menu &menu) {
updateMenuButton(scrollDownButton);
}
- _screen->showMouse();
_screen->updateScreen();
}
@@ -309,10 +306,8 @@ void GUI_v1::updateMenuButton(Button *button) {
if (!_displayMenu)
return;
- _screen->hideMouse();
updateButton(button);
_screen->updateScreen();
- _screen->showMouse();
}
void GUI_v1::updateButton(Button *button) {
@@ -340,12 +335,10 @@ int GUI_v1::redrawButtonCallback(Button *button) {
if (!_displayMenu)
return 0;
- _screen->hideMouse();
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
_screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 17);
else
_screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xF8);
- _screen->showMouse();
return 0;
}
@@ -354,12 +347,10 @@ int GUI_v1::redrawShadedButtonCallback(Button *button) {
if (!_displayMenu)
return 0;
- _screen->hideMouse();
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 31, 18);
else
_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xF9, 0xFA);
- _screen->showMouse();
return 0;
}
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index 580adb0e5d..1df4149d2e 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -105,15 +105,11 @@ void GUI_v2::processButton(Button *button) {
switch (val1 - 1) {
case 0:
- _screen->hideMouse();
_screen->drawShape(_screen->_curPage, dataPtr, x, y, button->dimTableIndex, 0x10);
- _screen->showMouse();
break;
case 1:
- _screen->hideMouse();
_screen->printText((const char *)dataPtr, x, y, val2, val3);
- _screen->showMouse();
break;
case 3:
@@ -122,22 +118,16 @@ void GUI_v2::processButton(Button *button) {
break;
case 4:
- _screen->hideMouse();
_screen->drawBox(x, y, x2, y2, val2);
- _screen->showMouse();
break;
case 5:
- _screen->hideMouse();
_screen->fillRect(x, y, x2, y2, val2, -1, true);
- _screen->showMouse();
break;
default:
break;
}
-
- _screen->updateScreen();
}
int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWheel) {
@@ -360,7 +350,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWh
if (buttonList->buttonCallback) {
_vm->removeInputTop();
- if ((*buttonList->buttonCallback.get())(buttonList))
+ if ((*buttonList->buttonCallback)(buttonList))
break;
}
diff --git a/engines/kyra/items_hof.cpp b/engines/kyra/items_hof.cpp
index 711e1b8f7c..ef2c50c0c5 100644
--- a/engines/kyra/items_hof.cpp
+++ b/engines/kyra/items_hof.cpp
@@ -300,8 +300,6 @@ void KyraEngine_HoF::itemDropDown(int startX, int startY, int dstX, int dstY, in
}
void KyraEngine_HoF::exchangeMouseItem(int itemPos) {
- _screen->hideMouse();
-
deleteItemAnimEntry(itemPos);
int itemId = _itemList[itemPos].id;
@@ -317,7 +315,6 @@ void KyraEngine_HoF::exchangeMouseItem(int itemPos) {
str2 = getItemCommandStringPickUp(itemId);
updateCommandLineEx(itemId + 54, str2, 0xD6);
- _screen->showMouse();
runSceneScript6();
}
@@ -331,7 +328,6 @@ bool KyraEngine_HoF::pickUpItem(int x, int y) {
if (_itemInHand >= 0) {
exchangeMouseItem(itemPos);
} else {
- _screen->hideMouse();
deleteItemAnimEntry(itemPos);
int itemId = _itemList[itemPos].id;
_itemList[itemPos].id = kItemNone;
@@ -344,7 +340,6 @@ bool KyraEngine_HoF::pickUpItem(int x, int y) {
updateCommandLineEx(itemId + 54, str2, 0xD6);
_itemInHand = itemId;
- _screen->showMouse();
runSceneScript6();
}
diff --git a/engines/kyra/items_lok.cpp b/engines/kyra/items_lok.cpp
index 2937038463..b92cd616c1 100644
--- a/engines/kyra/items_lok.cpp
+++ b/engines/kyra/items_lok.cpp
@@ -163,17 +163,13 @@ void KyraEngine_LoK::placeItemInGenericMapScene(int item, int index) {
}
void KyraEngine_LoK::setHandItem(Item item) {
- _screen->hideMouse();
setMouseItem(item);
_itemInHand = item;
- _screen->showMouse();
}
void KyraEngine_LoK::removeHandItem() {
- _screen->hideMouse();
_screen->setMouseCursor(1, 1, _shapes[0]);
_itemInHand = kItemNone;
- _screen->showMouse();
}
void KyraEngine_LoK::setMouseItem(Item item) {
@@ -415,7 +411,6 @@ int KyraEngine_LoK::processItemDrop(uint16 sceneId, uint8 item, int x, int y, in
}
void KyraEngine_LoK::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
- _screen->hideMouse();
_animator->animRemoveGameItem(itemIndex);
assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId];
@@ -432,7 +427,6 @@ void KyraEngine_LoK::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _takenList[0], 179);
else
updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _takenList[1], 179);
- _screen->showMouse();
clickEventHandler2();
}
@@ -720,9 +714,7 @@ void KyraEngine_LoK::magicOutMouseItem(int animIndex, int itemPos) {
_itemInHand = kItemNone;
} else {
_characterList[0].inventoryItems[itemPos] = kItemNone;
- _screen->hideMouse();
_screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12, 0);
- _screen->showMouse();
}
_screen->showMouse();
@@ -793,9 +785,7 @@ void KyraEngine_LoK::magicInMouseItem(int animIndex, int item, int itemPos) {
_itemInHand = item;
} else {
_characterList[0].inventoryItems[itemPos] = item;
- _screen->hideMouse();
_screen->drawShape(0, _shapes[216 + item], _itemPosX[itemPos], _itemPosY[itemPos], 0, 0);
- _screen->showMouse();
}
_screen->showMouse();
_screen->_curPage = videoPageBackUp;
@@ -846,9 +836,7 @@ void KyraEngine_LoK::updatePlayerItemsForScene() {
++_itemInHand;
if (_itemInHand > 33)
_itemInHand = 33;
- _screen->hideMouse();
_screen->setMouseCursor(8, 15, _shapes[216 + _itemInHand]);
- _screen->showMouse();
}
bool redraw = false;
@@ -864,9 +852,7 @@ void KyraEngine_LoK::updatePlayerItemsForScene() {
}
if (redraw) {
- _screen->hideMouse();
redrawInventory(0);
- _screen->showMouse();
}
if (_itemInHand == 33)
@@ -884,7 +870,6 @@ void KyraEngine_LoK::updatePlayerItemsForScene() {
void KyraEngine_LoK::redrawInventory(int page) {
int videoPageBackUp = _screen->_curPage;
_screen->_curPage = page;
- _screen->hideMouse();
for (int i = 0; i < 10; ++i) {
_screen->fillRect(_itemPosX[i], _itemPosY[i], _itemPosX[i] + 15, _itemPosY[i] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12, page);
@@ -893,7 +878,6 @@ void KyraEngine_LoK::redrawInventory(int page) {
_screen->drawShape(page, _shapes[216 + item], _itemPosX[i], _itemPosY[i], 0, 0);
}
}
- _screen->showMouse();
_screen->_curPage = videoPageBackUp;
_screen->updateScreen();
}
diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp
index ea2acaf64d..409b53f6f0 100644
--- a/engines/kyra/items_lol.cpp
+++ b/engines/kyra/items_lol.cpp
@@ -441,20 +441,20 @@ bool LoLEngine::launchObject(int objectType, Item item, int startX, int startY,
return true;
}
-void LoLEngine::endObjectFlight(FlyingObject *t, int x, int y, int collisionObject) {
+void LoLEngine::endObjectFlight(FlyingObject *t, int x, int y, int collisionType) {
int cx = x;
int cy = y;
uint16 block = calcBlockIndex(t->x, t->y);
removeAssignedObjectFromBlock(&_levelBlockProperties[block], t->item);
removeDrawObjectFromBlock(&_levelBlockProperties[block], t->item);
- if (collisionObject == 1) {
+ if (collisionType == 1) {
cx = t->x;
cy = t->y;
}
if (t->objectType == 0 || t->objectType == 1) {
- objectFlightProcessHits(t, cx, cy, collisionObject);
+ objectFlightProcessHits(t, cx, cy, collisionType);
t->x = (cx & 0xffc0) | 0x40;
t->y = (cy & 0xffc0) | 0x40;
t->flyingHeight = 0;
@@ -488,27 +488,23 @@ void LoLEngine::updateObjectFlightPosition(FlyingObject *t) {
}
}
-void LoLEngine::objectFlightProcessHits(FlyingObject *t, int x, int y, int objectOnNextBlock) {
- uint16 r = 0;
-
- if (objectOnNextBlock == 1) {
+void LoLEngine::objectFlightProcessHits(FlyingObject *t, int x, int y, int collisionType) {
+ if (collisionType == 1) {
runLevelScriptCustom(calcNewBlockPosition(_itemsInPlay[t->item].block, t->direction >> 1), 0x8000, -1, t->item, 0, 0);
- } else if (objectOnNextBlock == 2) {
+ } else if (collisionType == 2) {
if (_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000) {
- int o = _levelBlockProperties[_itemsInPlay[t->item].block].assignedObjects;
- while (o & 0x8000) {
- LoLObject *i = findObject(o);
- o = i->nextAssignedObject;
- runItemScript(t->attackerId, t->item, 0x8000, o, 0);
+ uint16 obj = _levelBlockProperties[_itemsInPlay[t->item].block].assignedObjects;
+ while (obj & 0x8000) {
+ runItemScript(t->attackerId, t->item, 0x8000, obj, 0);
+ obj = findObject(obj)->nextAssignedObject;
}
} else {
- r = getNearestMonsterFromPos(x, y);
- runItemScript(t->attackerId, t->item, 0x8000, r, 0);
+ runItemScript(t->attackerId, t->item, 0x8000, getNearestMonsterFromPos(x, y), 0);
}
- } else if (objectOnNextBlock == 4) {
+ } else if (collisionType == 4) {
_partyAwake = true;
if (_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000) {
for (int i = 0; i < 4; i++) {
@@ -516,8 +512,7 @@ void LoLEngine::objectFlightProcessHits(FlyingObject *t, int x, int y, int objec
runItemScript(t->attackerId, t->item, 0x8000, i, 0);
}
} else {
- r = getNearestPartyMemberFromPos(x, y);
- runItemScript(t->attackerId, t->item, 0x8000, r, 0);
+ runItemScript(t->attackerId, t->item, 0x8000, getNearestPartyMemberFromPos(x, y), 0);
}
}
}
@@ -543,9 +538,9 @@ void LoLEngine::updateFlyingObject(FlyingObject *t) {
middle of a block (or making the monsters align to the middle before casting them) wouldn't help here
(and wouldn't be faithful to the original either).
*/
- int objectOnNextBlock = checkBlockBeforeObjectPlacement(x, y, /*_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000 ? 256 :*/ 63, t->flags, t->wallFlags);
- if (objectOnNextBlock) {
- endObjectFlight(t, x, y, objectOnNextBlock);
+ int collisionType = checkBlockBeforeObjectPlacement(x, y, /*_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000 ? 256 :*/ 63, t->flags, t->wallFlags);
+ if (collisionType) {
+ endObjectFlight(t, x, y, collisionType);
} else {
if (--t->distance) {
processObjectFlight(t, x, y);
@@ -567,16 +562,16 @@ void LoLEngine::assignItemToBlock(uint16 *assignedBlockObjects, int id) {
*assignedBlockObjects = id;
}
-int LoLEngine::checkDrawObjectSpace(int itemX, int itemY, int partyX, int partyY) {
- int a = itemX - partyX;
- if (a < 0)
- a = -a;
+int LoLEngine::checkDrawObjectSpace(int x1, int y1, int x2, int y2) {
+ int dx = x1 - x2;
+ if (dx < 0)
+ dx = -dx;
- int b = itemY - partyY;
- if (b < 0)
- b = -b;
+ int dy = y1 - y2;
+ if (dy < 0)
+ dy = -dy;
- return a + b;
+ return dx + dy;
}
int LoLEngine::checkSceneForItems(uint16 *blockDrawObjects, int color) {
diff --git a/engines/kyra/items_mr.cpp b/engines/kyra/items_mr.cpp
index c731627026..029f676538 100644
--- a/engines/kyra/items_mr.cpp
+++ b/engines/kyra/items_mr.cpp
@@ -319,7 +319,6 @@ void KyraEngine_MR::exchangeMouseItem(int itemPos, int runScript) {
return;
}
- _screen->hideMouse();
deleteItemAnimEntry(itemPos);
Item itemId = _itemList[itemPos].id;
@@ -335,7 +334,6 @@ void KyraEngine_MR::exchangeMouseItem(int itemPos, int runScript) {
str2 = getItemCommandStringPickUp(itemId);
updateItemCommand(itemId, str2, 0xFF);
- _screen->showMouse();
if (runScript)
runSceneScript6();
@@ -350,7 +348,6 @@ bool KyraEngine_MR::pickUpItem(int x, int y, int runScript) {
if (_itemInHand >= 0) {
exchangeMouseItem(itemPos, runScript);
} else {
- _screen->hideMouse();
deleteItemAnimEntry(itemPos);
Item itemId = _itemList[itemPos].id;
_itemList[itemPos].id = kItemNone;
@@ -363,7 +360,6 @@ bool KyraEngine_MR::pickUpItem(int x, int y, int runScript) {
updateItemCommand(itemId, itemString, 0xFF);
_itemInHand = itemId;
- _screen->showMouse();
if (runScript)
runSceneScript6();
@@ -401,7 +397,6 @@ bool KyraEngine_MR::itemListMagic(Item handItem, int itemSlot) {
assert(animObjIndex != -1);
- _screen->hideMouse();
snd_playSoundEffect(0x93, 0xC8);
for (int i = 109; i <= 141; ++i) {
_animObjects[animObjIndex].shapeIndex1 = i+248;
@@ -411,7 +406,6 @@ bool KyraEngine_MR::itemListMagic(Item handItem, int itemSlot) {
deleteItemAnimEntry(itemSlot);
_itemList[itemSlot].id = kItemNone;
- _screen->showMouse();
return true;
}
@@ -440,7 +434,6 @@ bool KyraEngine_MR::itemListMagic(Item handItem, int itemSlot) {
_itemList[itemSlot].id = (int8)resItem;
- _screen->hideMouse();
deleteItemAnimEntry(itemSlot);
addItemToAnimList(itemSlot);
@@ -448,7 +441,6 @@ bool KyraEngine_MR::itemListMagic(Item handItem, int itemSlot) {
removeHandItem();
else if (newItem != 0xFF)
setHandItem(newItem);
- _screen->showMouse();
if (_lang != 1)
updateItemCommand(resItem, 3, 0xFF);
@@ -500,7 +492,6 @@ bool KyraEngine_MR::itemInventoryMagic(Item handItem, int invSlot) {
_mainCharacter.inventory[invSlot] = (int8)resItem;
- _screen->hideMouse();
clearInventorySlot(invSlot, 0);
drawInventorySlot(0, resItem, invSlot);
@@ -508,7 +499,6 @@ bool KyraEngine_MR::itemInventoryMagic(Item handItem, int invSlot) {
removeHandItem();
else if (newItem != 0xFF)
setHandItem(newItem);
- _screen->showMouse();
if (_lang != 1)
updateItemCommand(resItem, 3, 0xFF);
diff --git a/engines/kyra/items_v2.cpp b/engines/kyra/items_v2.cpp
index c191c2e62b..2145a2c2f0 100644
--- a/engines/kyra/items_v2.cpp
+++ b/engines/kyra/items_v2.cpp
@@ -82,26 +82,19 @@ void KyraEngine_v2::resetItem(int index) {
}
void KyraEngine_v2::setHandItem(Item item) {
- Screen *scr = screen();
- scr->hideMouse();
-
if (item == kItemNone) {
removeHandItem();
} else {
setMouseCursor(item);
_itemInHand = item;
}
-
- scr->showMouse();
}
void KyraEngine_v2::removeHandItem() {
Screen *scr = screen();
- scr->hideMouse();
scr->setMouseCursor(0, 0, getShapePtr(0));
_itemInHand = kItemNone;
_mouseState = kItemNone;
- scr->showMouse();
}
} // end of namesapce Kyra
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 0ba173d9d0..7fbecb7f53 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -419,8 +419,6 @@ void KyraEngine_HoF::startup() {
_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
_screen->loadBitmap("_PLAYFLD.CPS", 3, 3, 0);
_screen->copyPage(3, 0);
- _screen->showMouse();
- _screen->hideMouse();
clearAnimObjects();
@@ -784,20 +782,16 @@ void KyraEngine_HoF::updateMouse() {
if (type != 0 && _mouseState != type && _screen->isMouseVisible()) {
_mouseState = type;
- _screen->hideMouse();
_screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex));
- _screen->showMouse();
}
if (type == 0 && _mouseState != _itemInHand && _screen->isMouseVisible()) {
if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) {
_mouseState = _itemInHand;
- _screen->hideMouse();
if (_itemInHand == kItemNone)
_screen->setMouseCursor(0, 0, getShapePtr(0));
else
_screen->setMouseCursor(8, 15, getShapePtr(_itemInHand+64));
- _screen->showMouse();
}
}
}
@@ -914,7 +908,6 @@ void KyraEngine_HoF::showMessageFromCCode(int id, int16 palIndex, int) {
void KyraEngine_HoF::showMessage(const char *string, int16 palIndex) {
_shownMessage = string;
- _screen->hideMouse();
_screen->fillRect(0, 190, 319, 199, 0xCF);
if (string) {
@@ -932,7 +925,6 @@ void KyraEngine_HoF::showMessage(const char *string, int16 palIndex) {
}
_fadeMessagePalette = false;
- _screen->showMouse();
}
void KyraEngine_HoF::showChapterMessage(int id, int16 palIndex) {
@@ -1116,9 +1108,7 @@ int KyraEngine_HoF::getDrawLayer(int x, int y) {
void KyraEngine_HoF::backUpPage0() {
if (_screenBuffer) {
- _screen->hideMouse();
memcpy(_screenBuffer, _screen->getCPagePtr(0), 64000);
- _screen->showMouse();
}
}
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index ece4a0daba..27bc2ad22a 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -454,10 +454,8 @@ void KyraEngine_LoK::mainLoop() {
if (_deathHandler != -1) {
snd_playWanderScoreViaMap(0, 1);
snd_playSoundEffect(49);
- _screen->hideMouse();
_screen->setMouseCursor(1, 1, _shapes[0]);
removeHandItem();
- _screen->showMouse();
_gui->buttonMenuCallback(0);
_deathHandler = -1;
}
@@ -706,7 +704,6 @@ int KyraEngine_LoK::processInputHelper(int xpos, int ypos) {
uint8 item = findItemAtPos(xpos, ypos);
if (item != 0xFF) {
if (_itemInHand == kItemNone) {
- _screen->hideMouse();
_animator->animRemoveGameItem(item);
snd_playSoundEffect(53);
assert(_currentCharacter->sceneId < _roomTableSize);
@@ -717,7 +714,6 @@ int KyraEngine_LoK::processInputHelper(int xpos, int ypos) {
assert(_itemList && _takenList);
updateSentenceCommand(_itemList[getItemListIndex(item2)], _takenList[0], 179);
_itemInHand = item2;
- _screen->showMouse();
clickEventHandler2();
return 1;
} else {
@@ -834,21 +830,17 @@ void KyraEngine_LoK::updateMousePointer(bool forceUpdate) {
if ((newMouseState && _mouseState != newMouseState) || (newMouseState && forceUpdate)) {
_mouseState = newMouseState;
- _screen->hideMouse();
_screen->setMouseCursor(newX, newY, _shapes[shape]);
- _screen->showMouse();
}
if (!newMouseState) {
if (_mouseState != _itemInHand || forceUpdate) {
if (mouse.y > 158 || (mouse.x >= 12 && mouse.x < 308 && mouse.y < 136 && mouse.y >= 12) || forceUpdate) {
_mouseState = _itemInHand;
- _screen->hideMouse();
if (_itemInHand == kItemNone)
_screen->setMouseCursor(1, 1, _shapes[0]);
else
_screen->setMouseCursor(8, 15, _shapes[216 + _itemInHand]);
- _screen->showMouse();
}
}
}
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 39ed0d038a..448e4ef70d 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -1298,7 +1298,6 @@ bool KyraEngine_MR::updateScore(int scoreId, int strId) {
setNextIdleAnimTimer();
_scoreFlagTable[scoreIndex] |= (1 << scoreBit);
- _screen->hideMouse();
strcpy(_stringBuffer, (const char *)getTableEntry(_scoreFile, strId));
strcat(_stringBuffer, ": ");
@@ -1308,7 +1307,6 @@ bool KyraEngine_MR::updateScore(int scoreId, int strId) {
if (count > 0)
scoreIncrease(count, _stringBuffer);
- _screen->showMouse();
setNextIdleAnimTimer();
return true;
}
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 75b568a00a..848fb18b6a 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -198,8 +198,6 @@ void KyraEngine_v2::moveCharacter(int facing, int x, int y) {
y &= ~1;
_mainCharacter.facing = facing;
- Screen *scr = screen();
- scr->hideMouse();
switch (facing) {
case 0:
while (_mainCharacter.y1 > y)
@@ -224,7 +222,6 @@ void KyraEngine_v2::moveCharacter(int facing, int x, int y) {
default:
break;
}
- scr->showMouse();
}
void KyraEngine_v2::updateCharPosWithUpdate() {
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 38e9d33259..d3028c5e2d 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1436,7 +1436,7 @@ void LoLEngine::increaseExperience(int charNum, int skill, uint32 points) {
bool loop = true;
while (loop) {
- if (_characters[charNum].experiencePts[skill] <= _expRequirements[_characters[charNum].skillLevels[skill]])
+ if (_characters[charNum].experiencePts[skill] < _expRequirements[_characters[charNum].skillLevels[skill]])
break;
_characters[charNum].skillLevels[skill]++;
@@ -2894,11 +2894,11 @@ int LoLEngine::processMagicVaelansCube() {
uint8 s = _levelBlockProperties[bl].walls[_currentDirection ^ 2];
uint8 flg = _wllWallFlags[s];
- int v = (s == 47 && (_currentLevel == 17 || _currentLevel == 24)) ? 1 : 0;
- if ((_wllVmpMap[s] == 1 || _wllVmpMap[s] == 2) && (flg & 1) && (_currentLevel == 22)) {
+ int res = (s == 47 && (_currentLevel == 17 || _currentLevel == 24)) ? 1 : 0;
+ if ((_wllVmpMap[s] == 1 || _wllVmpMap[s] == 2) && (!(flg & 1)) && (_currentLevel != 22)) {
memset(_levelBlockProperties[bl].walls, 0, 4);
gui_drawScene(0);
- v = 1;
+ res = 1;
}
uint16 o = _levelBlockProperties[bl].assignedObjects;
@@ -2906,7 +2906,7 @@ int LoLEngine::processMagicVaelansCube() {
LoLMonster *m = &_monsters[o & 0x7fff];
if (m->properties->flags & 0x1000) {
inflictDamage(o, 100, 0xffff, 0, 0x80);
- v = 1;
+ res = 1;
}
o = m->nextAssignedObject;
}
@@ -2922,7 +2922,7 @@ int LoLEngine::processMagicVaelansCube() {
delete[] tmpPal1;
delete[] tmpPal2;
- return v;
+ return res;
}
int LoLEngine::processMagicGuardian(int charNum) {
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index dbd461267f..dcd13804b3 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -1047,14 +1047,14 @@ private:
void setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight, int moveable);
void removeLevelItem(Item item, int block);
bool launchObject(int objectType, Item item, int startX, int startY, int flyingHeight, int direction, int, int attackerId, int c);
- void endObjectFlight(FlyingObject *t, int x, int y, int collisionObject);
+ void endObjectFlight(FlyingObject *t, int x, int y, int collisionType);
void processObjectFlight(FlyingObject *t, int x, int y);
void updateObjectFlightPosition(FlyingObject *t);
- void objectFlightProcessHits(FlyingObject *t, int x, int y, int objectOnNextBlock);
+ void objectFlightProcessHits(FlyingObject *t, int x, int y, int collisionType);
void updateFlyingObject(FlyingObject *t);
void assignItemToBlock(uint16 *assignedBlockObjects, int id);
- int checkDrawObjectSpace(int itemX, int itemY, int partyX, int partyY);
+ int checkDrawObjectSpace(int x1, int y1, int x2, int y2);
int checkSceneForItems(uint16 *blockDrawObjects, int color);
uint8 _moneyColumnHeight[5];
@@ -1095,7 +1095,7 @@ private:
void monsterDropItems(LoLMonster *monster);
void giveItemToMonster(LoLMonster *monster, Item item);
int checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 objectWidth, uint16 testFlag, uint16 wallFlag);
- int checkBlockForWallsAndSufficientSpace(int block, int x, int y, int objectWidth, int testFlag, int wallFlag);
+ int testBlockPassability(int block, int x, int y, int objectWidth, int testFlag, int wallFlag);
int calcMonsterSkillLevel(int id, int a);
int checkBlockOccupiedByParty(int x, int y, int testFlag);
const uint16 *getCharacterOrMonsterStats(int id);
@@ -1122,7 +1122,7 @@ private:
int checkForPossibleDistanceAttack(uint16 monsterBlock, int direction, int distance, uint16 curBlock);
int walkMonsterCheckDest(int x, int y, LoLMonster *monster, int unk);
void getNextStepCoords(int16 monsterX, int16 monsterY, int &newX, int &newY, uint16 direction);
- void rearrangeAttackingMonster(LoLMonster *monster);
+ void alignMonsterToParty(LoLMonster *monster);
void moveStrayingMonster(LoLMonster *monster);
void killMonster(LoLMonster *monster);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index d3b4d6f943..04d805737f 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -95,8 +95,23 @@ bool Screen::init() {
_use16ColorMode = _vm->gameFlags().use16ColorMode;
_isAmiga = (_vm->gameFlags().platform == Common::kPlatformAmiga);
- if (ConfMan.hasKey("render_mode"))
- _renderMode = Common::parseRenderMode(ConfMan.get("render_mode"));
+ // We only check the "render_mode" setting for both Eye of the Beholder
+ // games here, since all the other games do not support the render_mode
+ // setting or handle it differently, like Kyra 1 PC-98. This avoids
+ // graphics glitches and crashes in other games, when the user sets his
+ // global render_mode setting to EGA for example.
+ // TODO/FIXME: It would be nice not to hardcode this. But there is no
+ // trivial/non annoying way to do mode checks in an easy fashion right
+ // now.
+ // In a more general sense, we might want to think about a way to only
+ // pass valid config values, as in values which the engine can work with,
+ // to the engines. We already limit the selection via our GUIO flags in
+ // the game specific settings, but this is not enough due to global
+ // settings allowing everything.
+ if (_vm->game() == GI_EOB1 || _vm->game() == GI_EOB2) {
+ 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) {
@@ -126,7 +141,7 @@ bool Screen::init() {
if (!font)
error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'");
- _fonts[FID_SJIS_FNT] = new SJISFont(this, font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode);
+ _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode);
}
}
@@ -1113,8 +1128,6 @@ void Screen::drawBox(int x1, int y1, int x2, int y2, int color) {
void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) {
assert(x1 >= 0 && y1 >= 0);
- hideMouse();
-
fillRect(x1, y1, x2, y1 + 1, color1);
fillRect(x2 - 1, y1, x2, y2, color1);
@@ -1122,8 +1135,6 @@ void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color
drawClippedLine(x1 + 1, y1 + 1, x1 + 1, y2 - 1, color2);
drawClippedLine(x1, y2 - 1, x2 - 1, y2 - 1, color2);
drawClippedLine(x1, y2, x2, y2, color2);
-
- showMouse();
}
void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) {
@@ -3584,8 +3595,8 @@ void AMIGAFont::unload() {
memset(_chars, 0, sizeof(_chars));
}
-SJISFont::SJISFont(Screen *s, Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize)
- : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _screen(s) {
+SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize)
+ : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) {
assert(_font);
_font->setDrawingMode(outlineSize ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index b064c72bb0..60bfeb3241 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -213,7 +213,7 @@ private:
*/
class SJISFont : public Font {
public:
- SJISFont(Screen *s, Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize);
+ SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize);
~SJISFont() { unload(); }
bool usesOverlay() const { return true; }
@@ -233,7 +233,6 @@ private:
const uint8 _invisColor;
const bool _is16Color;
- const Screen *_screen;
int _sjisWidth, _asciiWidth;
int _fontHeight;
};
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index e06ca42c40..ae75c111b4 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -607,7 +607,7 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco
srcLineStart += SCREEN_W;
src = srcLineStart;
}
- delete [] colorMap;
+ delete[] colorMap;
}
return shp;
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp
index f32a898dd9..f028f93294 100644
--- a/engines/kyra/screen_lok.cpp
+++ b/engines/kyra/screen_lok.cpp
@@ -190,7 +190,6 @@ void Screen_LoK::copyBackgroundBlock(int x, int page, int flag) {
_curPage = page;
int curX = x;
- hideMouse();
copyRegionToBuffer(_curPage, 8, 8, 8, height, ptr2);
for (int i = 0; i < 19; ++i) {
int tempX = curX + 1;
@@ -208,7 +207,6 @@ void Screen_LoK::copyBackgroundBlock(int x, int page, int flag) {
curX = curX % 38;
}
}
- showMouse();
_curPage = oldVideoPage;
}
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index 08b232f400..3726b1f4b9 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -31,7 +31,7 @@
namespace Kyra {
-Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system, vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount), _vm(vm) {
+Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system, vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount) {
_paletteOverlay1 = new uint8[0x100];
_paletteOverlay2 = new uint8[0x100];
_grayOverlay = new uint8[0x100];
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index 3bba9f8b70..09496705bb 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -89,8 +89,6 @@ public:
static void convertPC98Gfx(uint8 *data, int w, int h, int pitch);
private:
- LoLEngine *_vm;
-
static const ScreenDim _screenDimTable256C[];
static const ScreenDim _screenDimTable16C[];
static const int _screenDimTableCount;
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index dde22498eb..7d4b064e2a 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -365,7 +365,7 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i
}
}
- return (w1 == -1) ? false : true;
+ return w1 != -1;
}
void Screen_v2::checkedPageUpdate(int srcPage, int dstPage) {
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index b80b8105a1..fca83ae632 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -325,7 +325,6 @@ int KyraEngine_HoF::o2_drawShape(EMCState *script) {
if (modeFlag) {
_screen->drawShape(2, shp, x, y, 2, dsFlag ? 1 : 0);
} else {
- _screen->hideMouse();
restorePage3();
_screen->drawShape(2, shp, x, y, 2, dsFlag ? 1 : 0);
memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080);
@@ -334,7 +333,6 @@ int KyraEngine_HoF::o2_drawShape(EMCState *script) {
flagAnimObjsForRefresh();
flagAnimObjsSpecialRefresh();
refreshAnimObjectsIfNeed();
- _screen->showMouse();
}
return 0;
@@ -492,7 +490,6 @@ int KyraEngine_HoF::o2_drawSceneShape(EMCState *script) {
int y = stackPos(2);
int flag = (stackPos(3) != 0) ? 1 : 0;
- _screen->hideMouse();
restorePage3();
_screen->drawShape(2, _sceneShapeTable[shape], x, y, 2, flag);
@@ -504,7 +501,6 @@ int KyraEngine_HoF::o2_drawSceneShape(EMCState *script) {
flagAnimObjsSpecialRefresh();
flagAnimObjsForRefresh();
refreshAnimObjectsIfNeed();
- _screen->showMouse();
return 0;
}
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index 8342bccab6..db9e01cabb 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -157,7 +157,6 @@ int KyraEngine_LoK::o1_dropItemInScene(EMCState *script) {
int KyraEngine_LoK::o1_drawAnimShapeIntoScene(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_drawAnimShapeIntoScene(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
- _screen->hideMouse();
_animator->restoreAllObjectBackgrounds();
int shape = stackPos(0);
int xpos = stackPos(1);
@@ -169,7 +168,6 @@ int KyraEngine_LoK::o1_drawAnimShapeIntoScene(EMCState *script) {
_animator->preserveAnyChangedBackgrounds();
_animator->flagAllObjectsForRefresh();
_animator->updateAllObjectShapes();
- _screen->showMouse();
return 0;
}
@@ -1298,7 +1296,6 @@ int KyraEngine_LoK::o1_drawItemShapeIntoScene(EMCState *script) {
if (onlyHidPage) {
_screen->drawShape(2, _shapes[216 + item], x, y, 0, flags);
} else {
- _screen->hideMouse();
_animator->restoreAllObjectBackgrounds();
_screen->drawShape(2, _shapes[216 + item], x, y, 0, flags);
_screen->drawShape(0, _shapes[216 + item], x, y, 0, flags);
@@ -1306,7 +1303,6 @@ int KyraEngine_LoK::o1_drawItemShapeIntoScene(EMCState *script) {
_animator->preserveAnyChangedBackgrounds();
_animator->flagAllObjectsForRefresh();
_animator->updateAllObjectShapes();
- _screen->showMouse();
}
return 0;
}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index c5d1d49030..9c0fe21ad4 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -958,10 +958,9 @@ int LoLEngine::olol_loadMonsterProperties(EMCState *script) {
l->hitPoints = stackPos(26);
l->speedTotalWaitTicks = 1;
l->flags = stackPos(27);
- l->unk5 = stackPos(28);
- // FIXME???
+ // This is what the original does here (setting the value first to stackPos(28) and then to stackPos(29):
+ //l->unk5 = stackPos(28);
l->unk5 = stackPos(29);
- //
l->numDistAttacks = stackPos(30);
l->numDistWeapons = stackPos(31);
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index afe11aba02..22d0bc4e95 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -150,9 +150,7 @@ int KyraEngine_MR::o3_addItemToInventory(EMCState *script) {
if (slot >= 0) {
_mainCharacter.inventory[slot] = stackPos(0);
if (_inventoryState) {
- _screen->hideMouse();
redrawInventory(0);
- _screen->showMouse();
}
}
return slot;
@@ -330,7 +328,6 @@ int KyraEngine_MR::o3_drawSceneShape(EMCState *script) {
int shape = stackPos(0);
int flag = (stackPos(1) != 0) ? 1 : 0;
- _screen->hideMouse();
restorePage3();
const int x = _sceneShapeDescs[shape].drawX;
@@ -344,7 +341,6 @@ int KyraEngine_MR::o3_drawSceneShape(EMCState *script) {
flagAnimObjsForRefresh();
refreshAnimObjectsIfNeed();
- _screen->showMouse();
return 0;
}
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index 686c3c9320..f2abfb81dc 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -32,7 +32,7 @@ namespace Kyra {
void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
seq_init();
- bool allowSkip = (!(_flags.isDemo && !_flags.isTalkie) && (startSeq == kSequenceTitle)) ? false : true;
+ bool allowSkip = (_flags.isDemo && !_flags.isTalkie) || startSeq != kSequenceTitle;
if (endSeq == -1)
endSeq = startSeq;
@@ -74,7 +74,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
_seqFrameCounter = 0;
_seqStartTime = _system->getMillis();
- allowSkip = (!(_flags.isDemo && !_flags.isTalkie) && (seqNum == kSequenceTitle)) ? false : true;
+ allowSkip = (_flags.isDemo && !_flags.isTalkie) || seqNum != kSequenceTitle;
Sequence cseq = _sequences->seq[seqNum];
SeqProc cb = _callbackS[seqNum];
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index 3475402a98..e63d0a7d8f 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -838,9 +838,7 @@ void KyraEngine_LoK::seq_fillFlaskWithWater(int item, int type) {
if (newItem == -1)
return;
- _screen->hideMouse();
setMouseItem(newItem);
- _screen->showMouse();
_itemInHand = newItem;
assert(_fullFlask);
@@ -1258,9 +1256,9 @@ void KyraEngine_LoK::seq_playCredits() {
do {
currentString = nextString;
- nextString = (uint8 *)strpbrk((const char *)currentString, stringTerms);
+ nextString = (uint8 *)strpbrk((char *)currentString, stringTerms);
if (!nextString)
- nextString = (uint8 *)strchr((const char *)currentString, 0);
+ nextString = (uint8 *)strchr((char *)currentString, 0);
CreditsLine line;
diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h
index 427bef66e2..827a487685 100644
--- a/engines/kyra/sound_intern.h
+++ b/engines/kyra/sound_intern.h
@@ -130,7 +130,6 @@ private:
void fadeOutSoundEffects();
int _lastTrack;
- Audio::AudioStream *_currentSFX;
Audio::SoundHandle _sfxHandle;
uint8 *_musicTrackData;
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp
index 0004395f6f..70cc304192 100644
--- a/engines/kyra/sound_midi.cpp
+++ b/engines/kyra/sound_midi.cpp
@@ -475,8 +475,8 @@ SoundMidiPC::SoundMidiPC(KyraEngine_v1 *vm, Audio::Mixer *mixer, MidiDriver *dri
::GUI::MessageDialog dialog(_("You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
- "General MIDI ones. After all it might happen\n"
- "that a few tracks will not be correctly played."));
+ "General MIDI ones. It is still possible that\n"
+ "some tracks sound incorrect."));
dialog.runModal();
}
}
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index 2f996de1ac..4b25db33f2 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -34,7 +34,7 @@
namespace Kyra {
SoundTowns::SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer)
- : Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), _musicTrackData(0), _sfxFileData(0), _cdaPlaying(0),
+ : Sound(vm, mixer), _lastTrack(-1), _musicTrackData(0), _sfxFileData(0), _cdaPlaying(0),
_sfxFileIndex((uint)-1), _musicFadeTable(0), _sfxWDTable(0), _sfxBTTable(0), _sfxChannel(0x46) {
_driver = new TownsEuphonyDriver(_mixer);
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 5a05d81a22..f4bae113c5 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -248,7 +248,7 @@ bool LoLEngine::updateMonsterAdjustBlocks(LoLMonster *monster) {
int16 fx2 = 0;
setLevelShapesDim(x2 + dims[y2], fx1, fx2, 13);
- return (fx1 >= fx2) ? false : true;
+ return fx1 < fx2;
}
void LoLEngine::placeMonster(LoLMonster *monster, uint16 x, uint16 y) {
@@ -355,7 +355,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
int yOffs = 0;
int flag = 0;
- int r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x, y), x, y, objectWidth, testFlag, wallFlag);
+ int r = testBlockPassability(calcBlockIndex(x, y), x, y, objectWidth, testFlag, wallFlag);
if (r)
return r;
@@ -369,7 +369,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
_objectLastDirection = 2;
x2 = x + objectWidth;
- r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x2, y), x, y, objectWidth, testFlag, wallFlag);
+ r = testBlockPassability(calcBlockIndex(x2, y), x, y, objectWidth, testFlag, wallFlag);
if (r)
return r;
@@ -385,7 +385,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
_objectLastDirection = 6;
x2 = x - objectWidth;
- r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x2, y), x, y, objectWidth, testFlag, wallFlag);
+ r = testBlockPassability(calcBlockIndex(x2, y), x, y, objectWidth, testFlag, wallFlag);
if (r)
return r;
@@ -403,7 +403,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
_objectLastDirection = 4;
y2 = y + objectWidth;
- r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x, y2), x, y, objectWidth, testFlag, wallFlag);
+ r = testBlockPassability(calcBlockIndex(x, y2), x, y, objectWidth, testFlag, wallFlag);
if (r)
return r;
@@ -420,7 +420,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
_objectLastDirection = 0;
y2 = y - objectWidth;
- r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x, y2), x, y, objectWidth, testFlag, wallFlag);
+ r = testBlockPassability(calcBlockIndex(x, y2), x, y, objectWidth, testFlag, wallFlag);
if (r)
return r;
@@ -436,7 +436,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
if (!flag)
return 0;
- r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x2, y2), x, y, objectWidth, testFlag, wallFlag);
+ r = testBlockPassability(calcBlockIndex(x2, y2), x, y, objectWidth, testFlag, wallFlag);
if (r)
return r;
@@ -447,7 +447,7 @@ int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 object
return 0;
}
-int LoLEngine::checkBlockForWallsAndSufficientSpace(int block, int x, int y, int objectWidth, int testFlag, int wallFlag) {
+int LoLEngine::testBlockPassability(int block, int x, int y, int objectWidth, int testFlag, int wallFlag) {
if (block == _currentBlock)
testFlag &= 0xfffe;
@@ -461,9 +461,9 @@ int LoLEngine::checkBlockForWallsAndSufficientSpace(int block, int x, int y, int
if (!(testFlag & 2))
return 0;
- uint16 b = _levelBlockProperties[block].assignedObjects;
- while (b & 0x8000) {
- LoLMonster *monster = &_monsters[b & 0x7fff];
+ uint16 obj = _levelBlockProperties[block].assignedObjects;
+ while (obj & 0x8000) {
+ LoLMonster *monster = &_monsters[obj & 0x7fff];
if (monster->mode < 13) {
int r = checkDrawObjectSpace(x, y, monster->x, monster->y);
@@ -471,7 +471,7 @@ int LoLEngine::checkBlockForWallsAndSufficientSpace(int block, int x, int y, int
return 2;
}
- b = findObject(b)->nextAssignedObject;
+ obj = findObject(obj)->nextAssignedObject;
}
return 0;
@@ -1105,7 +1105,7 @@ void LoLEngine::updateMonster(LoLMonster *monster) {
if ((monster->fightCurTick <= 0) || (checkDrawObjectSpace(_partyPosX, _partyPosY, monster->x, monster->y) > 256) || (monster->flags & 8))
setMonsterMode(monster, 7);
else
- rearrangeAttackingMonster(monster);
+ alignMonsterToParty(monster);
break;
case 6:
@@ -1428,26 +1428,26 @@ int LoLEngine::walkMonsterCheckDest(int x, int y, LoLMonster *monster, int unk)
uint8 m = monster->mode;
monster->mode = 15;
- int res = checkBlockBeforeObjectPlacement(x, y, monster->properties->maxWidth, 7, monster->properties->flags & 0x1000 ? 32 : unk);
+ int objType = checkBlockBeforeObjectPlacement(x, y, monster->properties->maxWidth, 7, monster->properties->flags & 0x1000 ? 32 : unk);
monster->mode = m;
- return res;
+ return objType;
}
void LoLEngine::getNextStepCoords(int16 srcX, int16 srcY, int &newX, int &newY, uint16 direction) {
- static const int8 shiftTableX[] = { 0, 32, 32, 32, 0, -32, -32, -32 };
- static const int8 shiftTableY[] = { -32, -32, 0, 32, 32, 32, 0, -32 };
+ static const int8 stepAdjustX[] = { 0, 32, 32, 32, 0, -32, -32, -32 };
+ static const int8 stepAdjustY[] = { -32, -32, 0, 32, 32, 32, 0, -32 };
- newX = (srcX + shiftTableX[direction]) & 0x1fff;
- newY = (srcY + shiftTableY[direction]) & 0x1fff;
+ newX = (srcX + stepAdjustX[direction]) & 0x1fff;
+ newY = (srcY + stepAdjustY[direction]) & 0x1fff;
}
-void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
- int t = (monster->direction >> 1);
+void LoLEngine::alignMonsterToParty(LoLMonster *monster) {
+ uint8 mdir = monster->direction >> 1;
uint16 mx = monster->x;
uint16 my = monster->y;
- uint16 *c = (t & 1) ? &my : &mx;
- bool centered = (*c & 0x7f) ? false : true;
+ uint16 *pos = (mdir & 1) ? &my : &mx;
+ bool centered = (*pos & 0x7f) == 0;
bool posFlag = true;
if (monster->properties->maxWidth <= 63) {
@@ -1464,11 +1464,13 @@ void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
r = true;
} else {
for (int i = 0; i < 3; i++) {
- t = (t + 1) & 3;
- id = _levelBlockProperties[calcNewBlockPosition(monster->block, t)].assignedObjects;
+ mdir = (mdir + 1) & 3;
+ id = _levelBlockProperties[calcNewBlockPosition(monster->block, mdir)].assignedObjects;
id = (id & 0x8000) ? (id & 0x7fff) : 0xffff;
- if (id != 0xffff)
+ if (id != 0xffff) {
r = true;
+ break;
+ }
}
}
}
@@ -1484,15 +1486,15 @@ void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
return;
if (posFlag) {
- if (*c & 0x80)
- *c -= 32;
+ if (*pos & 0x80)
+ *pos -= 32;
else
- *c += 32;
+ *pos += 32;
} else {
- if (*c & 0x80)
- *c += 32;
+ if (*pos & 0x80)
+ *pos += 32;
else
- *c -= 32;
+ *pos -= 32;
}
if (walkMonsterCheckDest(mx, my, monster, 4))
@@ -1502,8 +1504,10 @@ void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
int fy = _partyPosY;
calcSpriteRelPosition(mx, my, fx, fy, monster->direction >> 1);
- t = (fx < 0) ? -fx : fx;
- if (fy > 160 || t > 80)
+ if (fx < 0)
+ fx = -fx;
+
+ if (fy > 160 || fx > 80)
return;
placeMonster(monster, mx, my);
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 423b827092..00dc4f9e13 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -38,7 +38,7 @@
namespace Kyra {
-#define RESFILE_VERSION 82
+#define RESFILE_VERSION 83
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
diff --git a/engines/kyra/text_hof.cpp b/engines/kyra/text_hof.cpp
index 4a52d7d740..06067d6693 100644
--- a/engines/kyra/text_hof.cpp
+++ b/engines/kyra/text_hof.cpp
@@ -42,9 +42,7 @@ void TextDisplayer_HoF::restoreTalkTextMessageBkgd(int srcPage, int dstPage) {
void TextDisplayer_HoF::restoreScreen() {
_vm->restorePage3();
_vm->drawAnimObjects();
- _screen->hideMouse();
_screen->copyRegion(_talkCoords.x, _talkMessageY, _talkCoords.x, _talkMessageY, _talkCoords.w, _talkMessageH, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->showMouse();
_vm->flagAnimObjsForRefresh();
_vm->refreshAnimObjects(0);
}
@@ -58,8 +56,6 @@ void TextDisplayer_HoF::printCustomCharacterText(const char *text, int x, int y,
int x1 = 0, x2 = 0;
calcWidestLineBounds(x1, x2, w, x);
- _screen->hideMouse();
-
_talkCoords.x = x1;
_talkCoords.w = w+2;
_talkCoords.y = y;
@@ -78,7 +74,6 @@ void TextDisplayer_HoF::printCustomCharacterText(const char *text, int x, int y,
}
_screen->_curPage = curPageBackUp;
- _screen->showMouse();
}
char *TextDisplayer_HoF::preprocessString(const char *str) {
@@ -248,8 +243,6 @@ void KyraEngine_HoF::objectChatInit(const char *str, int object, int vocHigh, in
restorePage3();
_text->backupTalkTextMessageBkgd(2, 2);
- _screen->hideMouse();
-
_chatTextEnabled = textEnabled();
if (_chatTextEnabled) {
objectChatPrintText(str, object);
@@ -264,8 +257,6 @@ void KyraEngine_HoF::objectChatInit(const char *str, int object, int vocHigh, in
} else {
_chatVocHigh = _chatVocLow = -1;
}
-
- _screen->showMouse();
}
void KyraEngine_HoF::objectChatPrintText(const char *str, int object) {
diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp
index 62bdf18816..a557940868 100644
--- a/engines/kyra/text_lok.cpp
+++ b/engines/kyra/text_lok.cpp
@@ -296,10 +296,8 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNu
_animator->restoreAllObjectBackgrounds();
_screen->copyRegion(12, _text->_talkMessageY, 12, 136, 296, _text->_talkMessageH, 2, 2);
- _screen->hideMouse();
_text->printCharacterText(processedString, charNum, _characterList[charNum].x1);
- _screen->showMouse();
}
if (chatDuration == -2)
@@ -317,10 +315,8 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNu
_screen->copyRegion(12, 136, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 2);
_animator->preserveAllBackgrounds();
_animator->prepDrawAllObjects();
- _screen->hideMouse();
_screen->copyRegion(12, _text->_talkMessageY, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 0);
- _screen->showMouse();
_animator->flagAllObjectsForRefresh();
_animator->copyChangedObjectsForward(0);
}
@@ -332,7 +328,6 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNu
}
void KyraEngine_LoK::drawSentenceCommand(const char *sentence, int color) {
- _screen->hideMouse();
_screen->fillRect(8, 143, 311, 152, _flags.platform == Common::kPlatformAmiga ? 19 : 12);
if (_flags.platform == Common::kPlatformAmiga) {
@@ -354,7 +349,6 @@ void KyraEngine_LoK::drawSentenceCommand(const char *sentence, int color) {
}
_text->printText(sentence, 8, 143, 0xFF, _flags.platform == Common::kPlatformAmiga ? 19 : 12, 0);
- _screen->showMouse();
setTextFadeTimerCountdown(15);
_fadeText = false;
}
diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp
index b680e9c6f9..10b0880f29 100644
--- a/engines/kyra/text_mr.cpp
+++ b/engines/kyra/text_mr.cpp
@@ -145,9 +145,7 @@ void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8
void TextDisplayer_MR::restoreScreen() {
_vm->restorePage3();
_vm->drawAnimObjects();
- _screen->hideMouse();
_screen->copyRegion(_talkCoords.x, _talkMessageY, _talkCoords.x, _talkMessageY, _talkCoords.w, _talkMessageH, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->showMouse();
_vm->flagAnimObjsForRefresh();
_vm->refreshAnimObjects(0);
}
@@ -261,8 +259,6 @@ void KyraEngine_MR::objectChatInit(const char *str, int object, int vocHigh, int
restorePage3();
- _screen->hideMouse();
-
_chatTextEnabled = textEnabled();
if (_chatTextEnabled) {
objectChatPrintText(str, object);
@@ -277,8 +273,6 @@ void KyraEngine_MR::objectChatInit(const char *str, int object, int vocHigh, int
} else {
_chatVocHigh = _chatVocLow = -1;
}
-
- _screen->showMouse();
}
void KyraEngine_MR::objectChatPrintText(const char *str, int object) {
diff --git a/engines/kyra/timer_eob.cpp b/engines/kyra/timer_eob.cpp
index de1becfa72..766fe453ab 100644
--- a/engines/kyra/timer_eob.cpp
+++ b/engines/kyra/timer_eob.cpp
@@ -186,7 +186,7 @@ void EoBCoreEngine::timerProcessFlyingObjects(int timerNum) {
if (!fo->enable)
continue;
- bool endFlight = fo->distance ? false : true;
+ bool endFlight = fo->distance == 0;
uint8 pos = dirPosIndex[(fo->direction << 2) + (fo->curPos & 3)];
uint16 bl = fo->curBlock;
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 04455ae307..471e83c9ed 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -395,7 +395,7 @@ void VQAMovie::displayFrame(uint frameNum) {
if (frameNum >= _header.numFrames || !_opened)
return;
- bool foundSound = _stream ? false : true;
+ bool foundSound = !_stream;
bool foundFrame = false;
uint i;
diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index 28d30ec7d1..7618259e69 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -32,10 +32,8 @@
#include "common/events.h"
#include "common/rational.h"
-#include "common/rect.h"
#include "common/stream.h"
#include "common/system.h"
-#include "common/textconsole.h"
#include "engines/engine.h"
@@ -232,7 +230,7 @@ AnimFrame *Animation::processChunkFrame(Common::SeekableReadStream *in, const Ch
i.read(str, false);
// Decode the frame
- AnimFrame *f = new AnimFrame(str, i);
+ AnimFrame *f = new AnimFrame(str, i, true);
// Delete the temporary chunk buffer
delete str;
@@ -250,7 +248,7 @@ void Animation::processChunkAudio(Common::SeekableReadStream *in, const Chunk &c
// Read Snd header
uint32 header1 = in->readUint32LE();
uint16 header2 = in->readUint16LE();
- warning("Start ADPCM: %d, %d", header1, header2);
+ debugC(4, kLastExpressDebugSound, "Start ADPCM: %d, %d", header1, header2);
size -= 6;
}
@@ -272,7 +270,7 @@ void Animation::play() {
draw(s);
// XXX: Update the screen
- g_system->copyRectToScreen((byte *)s->pixels, s->pitch, 0, 0, s->w, s->h);
+ g_system->copyRectToScreen(s->pixels, s->pitch, 0, 0, s->w, s->h);
// Free the temporary surface
s->free();
diff --git a/engines/lastexpress/data/background.cpp b/engines/lastexpress/data/background.cpp
index 3d866c26f9..60379251a3 100644
--- a/engines/lastexpress/data/background.cpp
+++ b/engines/lastexpress/data/background.cpp
@@ -107,6 +107,7 @@ byte *Background::decodeComponent(Common::SeekableReadStream *in, uint32 inSize,
return NULL;
// Initialize the decoding
+ memset(out, 0, outSize * sizeof(byte));
uint32 inPos = 0;
uint32 outPos = 0;
diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp
index 86a66b49d9..d176d963d1 100644
--- a/engines/lastexpress/data/cursor.cpp
+++ b/engines/lastexpress/data/cursor.cpp
@@ -91,9 +91,9 @@ void Cursor::setStyle(CursorStyle style) {
// Reuse the screen pixel format
Graphics::PixelFormat pf = g_system->getScreenFormat();
- CursorMan.replaceCursor((const byte *)getCursorImage(style),
+ CursorMan.replaceCursor(getCursorImage(style),
32, 32, _cursors[style].hotspotX, _cursors[style].hotspotY,
- 0, 1, &pf);
+ 0, false, &pf);
}
const uint16 *Cursor::getCursorImage(CursorStyle style) const {
@@ -128,7 +128,7 @@ Common::Rect Icon::draw(Graphics::Surface *surface) {
for (int i = 0; i < 32; i++) {
// Adjust brightness
- if (_brightnessIndex == -1)
+ if (_brightnessIndex == -1 || _brightnessIndex >= ARRAYSIZE(brigthnessData))
*s = *image;
else
*s = (*image & brigthnessData[_brightnessIndex]) >> _brightnessIndex;
diff --git a/engines/lastexpress/data/font.cpp b/engines/lastexpress/data/font.cpp
index 79cf64e617..8ac1afce9a 100644
--- a/engines/lastexpress/data/font.cpp
+++ b/engines/lastexpress/data/font.cpp
@@ -149,7 +149,7 @@ uint8 Font::getCharWidth(uint16 c) const{
uint16 Font::getStringWidth(Common::String str) const {
uint16 width = 0;
for (uint i = 0; i < str.size(); i++)
- width += getCharWidth((unsigned) (int)str[i]);
+ width += getCharWidth((unsigned char)str[i]);
return width;
}
@@ -185,8 +185,8 @@ void Font::drawChar(Graphics::Surface *surface, int16 x, int16 y, uint16 c) {
Common::Rect Font::drawString(Graphics::Surface *surface, int16 x, int16 y, Common::String str) {
int16 currentX = x;
for (uint i = 0; i < str.size(); i++) {
- drawChar(surface, currentX, y, (unsigned) (int)str[i]);
- currentX += getCharWidth((unsigned) (int)str[i]);
+ drawChar(surface, currentX, y, (unsigned char)str[i]);
+ currentX += getCharWidth((unsigned char)str[i]);
}
return Common::Rect(x, y, x + currentX, y + (int16)_charHeight);
diff --git a/engines/lastexpress/data/scene.cpp b/engines/lastexpress/data/scene.cpp
index 8f279ffbb3..fdb1ac6d46 100644
--- a/engines/lastexpress/data/scene.cpp
+++ b/engines/lastexpress/data/scene.cpp
@@ -28,7 +28,6 @@
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
-#include "common/textconsole.h"
#include "common/stream.h"
namespace LastExpress {
@@ -122,7 +121,7 @@ bool SceneHotspot::isInside(const Common::Point &point) {
// Scene
Scene::~Scene() {
// Free the hotspots
- for (int i = 0; i < (int)_hotspots.size(); i++)
+ for (uint i = 0; i < _hotspots.size(); i++)
delete _hotspots[i];
}
@@ -172,7 +171,7 @@ bool Scene::checkHotSpot(const Common::Point &coord, SceneHotspot **hotspot) {
bool found = false;
int _location = 0;
- for (int i = 0; i < (int)_hotspots.size(); i++) {
+ for (uint i = 0; i < _hotspots.size(); i++) {
if (_hotspots[i]->isInside(coord)) {
if (_location <= _hotspots[i]->location) {
_location = _hotspots[i]->location;
@@ -224,7 +223,7 @@ Common::String Scene::toString() {
// Hotspots
if (_hotspots.size() != 0) {
output += "\nHotspots:\n";
- for (int i = 0; i < (int)_hotspots.size(); i++)
+ for (uint i = 0; i < _hotspots.size(); i++)
output += _hotspots[i]->toString() + "\n";
}
@@ -241,7 +240,7 @@ SceneLoader::~SceneLoader() {
void SceneLoader::clear() {
// Remove all scenes
- for (int i = 0; i < (int)_scenes.size(); i++)
+ for (uint i = 0; i < _scenes.size(); i++)
delete _scenes[i];
_scenes.clear();
@@ -292,9 +291,9 @@ Scene *SceneLoader::get(SceneIndex index) {
return NULL;
// Load the hotspots if needed
- _scenes[(int)index]->loadHotspots(_stream);
+ _scenes[(uint)index]->loadHotspots(_stream);
- return _scenes[(int)index];
+ return _scenes[(uint)index];
}
} // End of namespace LastExpress
diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp
index a62348f6c0..a5bcba84cd 100644
--- a/engines/lastexpress/data/sequence.cpp
+++ b/engines/lastexpress/data/sequence.cpp
@@ -27,7 +27,6 @@
#include "lastexpress/debug.h"
#include "common/stream.h"
-#include "common/textconsole.h"
namespace LastExpress {
@@ -77,7 +76,7 @@ void FrameInfo::read(Common::SeekableReadStream *in, bool isSequence) {
// AnimFrame
-AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f) : _palette(NULL) {
+AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool ignoreSubtype) : _palette(NULL), _ignoreSubtype(ignoreSubtype) {
_palSize = 1;
// TODO: use just the needed rectangle
_image.create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/lastexpress/data/sequence.h b/engines/lastexpress/data/sequence.h
index 9987eae48e..610a55cebf 100644
--- a/engines/lastexpress/data/sequence.h
+++ b/engines/lastexpress/data/sequence.h
@@ -49,8 +49,9 @@
byte {1} - Compression type
byte {1} - Subtype (determines which set of decompression functions will be called) => 0, 1, 2, 3
byte {1} - Unknown
+ byte {1} - Keep previous frame while drawing
+ byte {1} - Unknown
byte {1} - Unknown
- uint16 {2} - Unknown
byte {1} - Sound action
byte {1} - Unknown
uint32 {4} - positionId
@@ -129,7 +130,7 @@ struct FrameInfo {
class AnimFrame : public Drawable {
public:
- AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f);
+ AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool ignoreSubtype = false);
~AnimFrame();
Common::Rect draw(Graphics::Surface *s);
@@ -146,6 +147,7 @@ private:
uint16 _palSize;
uint16 *_palette;
Common::Rect _rect;
+ bool _ignoreSubtype;
};
class Sequence {
diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp
index a9bee6155d..a77e4a06c6 100644
--- a/engines/lastexpress/data/snd.cpp
+++ b/engines/lastexpress/data/snd.cpp
@@ -28,11 +28,9 @@
#include "lastexpress/debug.h"
#include "audio/decoders/adpcm_intern.h"
-#include "audio/audiostream.h"
#include "common/debug.h"
#include "common/memstream.h"
#include "common/system.h"
-#include "common/textconsole.h"
namespace LastExpress {
@@ -358,6 +356,8 @@ public:
Audio::ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) {
_currentFilterId = -1;
_nextFilterId = filterId;
+ _stepAdjust1 = 0;
+ _stepAdjust2 = 0;
}
int readBuffer(int16 *buffer, const int numSamples) {
@@ -378,7 +378,7 @@ public:
// Get current filter
_currentFilterId = _nextFilterId;
- _nextFilterId = -1;
+ //_nextFilterId = -1; // FIXME: the filter id should be recomputed based on the sound entry status for each block
// No filter: skip decoding
if (_currentFilterId == -1)
@@ -455,7 +455,9 @@ void SimpleSound::play(Audio::AudioStream *as) {
//////////////////////////////////////////////////////////////////////////
StreamedSound::StreamedSound() : _as(NULL), _loaded(false) {}
-StreamedSound::~StreamedSound() {}
+StreamedSound::~StreamedSound() {
+ _as = NULL;
+}
bool StreamedSound::load(Common::SeekableReadStream *stream, int32 filterId) {
if (!stream)
@@ -484,6 +486,9 @@ bool StreamedSound::isFinished() {
}
void StreamedSound::setFilterId(int32 filterId) {
+ if (!_as)
+ return;
+
((LastExpress_ADPCMStream *)_as)->setFilterId(filterId);
}
@@ -521,6 +526,7 @@ void AppendableSound::queueBuffer(Common::SeekableReadStream *bufferIn) {
// Setup the ADPCM decoder
uint32 sizeIn = (uint32)bufferIn->size();
Audio::AudioStream *adpcm = makeDecoder(bufferIn, sizeIn);
+ ((LastExpress_ADPCMStream *)adpcm)->setFilterId(16);
// Queue the stream
_as->queueAudioStream(adpcm);
diff --git a/engines/lastexpress/data/subtitle.cpp b/engines/lastexpress/data/subtitle.cpp
index 0be832cbdd..4d19c02aa7 100644
--- a/engines/lastexpress/data/subtitle.cpp
+++ b/engines/lastexpress/data/subtitle.cpp
@@ -32,7 +32,6 @@
#include "common/debug.h"
#include "common/rect.h"
#include "common/stream.h"
-#include "common/textconsole.h"
namespace LastExpress {
@@ -151,7 +150,7 @@ SubtitleManager::~SubtitleManager() {
}
void SubtitleManager::reset() {
- for (int i = 0; i < (int)_subtitles.size(); i++)
+ for (uint i = 0; i < _subtitles.size(); i++)
delete _subtitles[i];
_subtitles.clear();
@@ -211,10 +210,10 @@ void SubtitleManager::setTime(uint16 time) {
_currentIndex = -1;
// Find the appropriate line to show
- for (int16 i = 0; i < (int16)_subtitles.size(); i++) {
+ for (uint i = 0; i < _subtitles.size(); i++) {
if ((time >= _subtitles[i]->getTimeStart()) && (time <= _subtitles[i]->getTimeStop())) {
// Keep the index of the line to show
- _currentIndex = i;
+ _currentIndex = (int16)i;
return;
}
}
@@ -238,7 +237,7 @@ Common::Rect SubtitleManager::draw(Graphics::Surface *surface) {
// Draw the current line
assert(_currentIndex >= 0 && _currentIndex < (int16)_subtitles.size());
- return _subtitles[_currentIndex]->draw(surface, _font);
+ return _subtitles[(uint16)_currentIndex]->draw(surface, _font);
}
} // End of namespace LastExpress
diff --git a/engines/lastexpress/debug.cpp b/engines/lastexpress/debug.cpp
index dc2807db63..db3a3e3962 100644
--- a/engines/lastexpress/debug.cpp
+++ b/engines/lastexpress/debug.cpp
@@ -28,13 +28,13 @@
#include "lastexpress/data/cursor.h"
#include "lastexpress/data/scene.h"
#include "lastexpress/data/sequence.h"
-#include "lastexpress/data/snd.h"
#include "lastexpress/data/subtitle.h"
#include "lastexpress/fight/fight.h"
#include "lastexpress/game/action.h"
#include "lastexpress/game/beetle.h"
+#include "lastexpress/game/entities.h"
#include "lastexpress/game/inventory.h"
#include "lastexpress/game/logic.h"
#include "lastexpress/game/object.h"
@@ -44,15 +44,12 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
#include "common/debug-channels.h"
-#include "common/events.h"
#include "common/md5.h"
namespace LastExpress {
@@ -88,7 +85,6 @@ Debugger::Debugger(LastExpressEngine *engine) : _engine(engine), _command(NULL),
DCmd_Register("entity", WRAP_METHOD(Debugger, cmdEntity));
// Misc
- DCmd_Register("loadgame", WRAP_METHOD(Debugger, cmdLoadGame));
DCmd_Register("chapter", WRAP_METHOD(Debugger, cmdSwitchChapter));
DCmd_Register("clear", WRAP_METHOD(Debugger, cmdClear));
@@ -142,6 +138,9 @@ void Debugger::copyCommand(int argc, const char **argv) {
for (int i = 0; i < _numParams; i++) {
_commandParams[i] = (char *)malloc(strlen(argv[i]) + 1);
+ if (_commandParams[i] == NULL)
+ error("[Debugger::copyCommand] Cannot allocate memory for command parameters");
+
memset(_commandParams[i], 0, strlen(argv[i]) + 1);
strcpy(_commandParams[i], argv[i]);
}
@@ -155,9 +154,18 @@ void Debugger::callCommand() {
(*_command)(_numParams, const_cast<const char **>(_commandParams));
}
-void Debugger::loadArchive(ArchiveIndex index) const {
- _engine->getResourceManager()->loadArchive(index);
- getScenes()->loadSceneDataFile(index);
+bool Debugger::loadArchive(int index) {
+ if (index < 1 || index > 3) {
+ DebugPrintf("Invalid cd number (was: %d, valid: [1-3])\n", index);
+ return false;
+ }
+
+ if (!_engine->getResourceManager()->loadArchive((ArchiveIndex)index))
+ return false;
+
+ getScenes()->loadSceneDataFile((ArchiveIndex)index);
+
+ return true;
}
// Restore loaded archive
@@ -236,8 +244,10 @@ bool Debugger::cmdListFiles(int argc, const char **argv) {
Common::String filter(const_cast<char *>(argv[1]));
// Load the proper archive
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
Common::ArchiveMemberList list;
int count = _engine->getResourceManager()->listMatchingMembers(list, filter);
@@ -320,8 +330,10 @@ bool Debugger::cmdShowFrame(int argc, const char **argv) {
Common::String filename(const_cast<char *>(argv[1]));
filename += ".seq";
- if (argc == 4)
- loadArchive((ArchiveIndex)getNumber(argv[3]));
+ if (argc == 4) {
+ if (!loadArchive(getNumber(argv[3])))
+ return true;
+ }
if (!_engine->getResourceManager()->hasFile(filename)) {
DebugPrintf("Cannot find file: %s\n", filename.c_str());
@@ -380,8 +392,10 @@ bool Debugger::cmdShowBg(int argc, const char **argv) {
if (argc == 2 || argc == 3) {
Common::String filename(const_cast<char *>(argv[1]));
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
if (!_engine->getResourceManager()->hasFile(filename + ".BG")) {
DebugPrintf("Cannot find file: %s\n", (filename + ".BG").c_str());
@@ -433,8 +447,10 @@ bool Debugger::cmdPlaySeq(int argc, const char **argv) {
Common::String filename(const_cast<char *>(argv[1]));
filename += ".seq";
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
if (!_engine->getResourceManager()->hasFile(filename)) {
DebugPrintf("Cannot find file: %s\n", filename.c_str());
@@ -508,8 +524,10 @@ bool Debugger::cmdPlaySeq(int argc, const char **argv) {
bool Debugger::cmdPlaySnd(int argc, const char **argv) {
if (argc == 2 || argc == 3) {
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
// Add .SND at the end of the filename if needed
Common::String name(const_cast<char *>(argv[1]));
@@ -523,7 +541,7 @@ bool Debugger::cmdPlaySnd(int argc, const char **argv) {
_engine->_system->getMixer()->stopAll();
- _soundStream->load(getArchive(name));
+ _soundStream->load(getArchive(name), 16);
if (argc == 3)
restoreArchive();
@@ -545,8 +563,10 @@ bool Debugger::cmdPlaySbe(int argc, const char **argv) {
if (argc == 2 || argc == 3) {
Common::String filename(const_cast<char *>(argv[1]));
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
filename += ".sbe";
@@ -608,11 +628,13 @@ bool Debugger::cmdPlayNis(int argc, const char **argv) {
if (argc == 2 || argc == 3) {
Common::String name(const_cast<char *>(argv[1]));
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
// If we got a nis filename, check that the file exists
- if (name.contains('.') && _engine->getResourceManager()->hasFile(name)) {
+ if (name.contains('.') && !_engine->getResourceManager()->hasFile(name)) {
DebugPrintf("Cannot find file: %s\n", name.c_str());
return true;
}
@@ -665,8 +687,10 @@ bool Debugger::cmdLoadScene(int argc, const char **argv) {
SceneIndex index = (SceneIndex)getNumber(argv[1]);
// Check args
- if (argc == 3)
- loadArchive((ArchiveIndex)getNumber(argv[2]));
+ if (argc == 3) {
+ if (!loadArchive(getNumber(argv[2])))
+ return true;
+ }
if (index > 2500) {
DebugPrintf("Error: invalid index value (0-2500)");
@@ -1094,30 +1118,6 @@ label_error:
}
/**
- * Command: loads a game
- *
- * @param argc The argument count.
- * @param argv The values.
- *
- * @return true if it was handled, false otherwise
- */
-bool Debugger::cmdLoadGame(int argc, const char **argv) {
- if (argc == 2) {
- int id = getNumber(argv[1]);
-
- if (id == 0 || id > 6)
- goto error;
-
- getSaveLoad()->loadGame((GameId)(id - 1));
- } else {
-error:
- DebugPrintf("Syntax: loadgame <id> (id=1-6)\n");
- }
-
- return true;
-}
-
-/**
* Command: switch to a specific chapter
*
* @param argc The argument count.
diff --git a/engines/lastexpress/debug.h b/engines/lastexpress/debug.h
index d9ba6f47a1..532cb83717 100644
--- a/engines/lastexpress/debug.h
+++ b/engines/lastexpress/debug.h
@@ -79,7 +79,6 @@ private:
bool cmdShow(int argc, const char **argv);
bool cmdEntity(int argc, const char **argv);
- bool cmdLoadGame(int argc, const char **argv);
bool cmdSwitchChapter(int argc, const char **argv);
bool cmdClear(int argc, const char **argv);
@@ -87,7 +86,7 @@ private:
void copyCommand(int argc, const char **argv);
int getNumber(const char *arg) const;
- void loadArchive(ArchiveIndex index) const;
+ bool loadArchive(int index);
void restoreArchive() const;
Debuglet *_command;
diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp
index 82a6520522..2fdeef910a 100644
--- a/engines/lastexpress/detection.cpp
+++ b/engines/lastexpress/detection.cpp
@@ -173,7 +173,7 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO1(GUIO_NOASPECT)
},
-
+
// The Last Express (Russian)
// expressw.exe 1999-04-05 15:33:56
// express.exe ???
@@ -211,6 +211,7 @@ public:
return "LastExpress Engine (C) 1997 Smoking Car Productions";
}
+protected:
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const;
};
diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp
index 301c52e142..406b017d3a 100644
--- a/engines/lastexpress/entities/abbot.cpp
+++ b/engines/lastexpress/entities/abbot.cpp
@@ -34,9 +34,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -60,10 +58,10 @@ Abbot::Abbot(LastExpressEngine *engine) : Entity(engine, kEntityAbbot) {
ADD_CALLBACK_FUNCTION(Abbot, chapter2);
ADD_CALLBACK_FUNCTION(Abbot, chapter3);
ADD_CALLBACK_FUNCTION(Abbot, chapter3Handler);
- ADD_CALLBACK_FUNCTION(Abbot, function19);
- ADD_CALLBACK_FUNCTION(Abbot, function20);
- ADD_CALLBACK_FUNCTION(Abbot, function21);
- ADD_CALLBACK_FUNCTION(Abbot, function22);
+ ADD_CALLBACK_FUNCTION(Abbot, conversationWithBoutarel);
+ ADD_CALLBACK_FUNCTION(Abbot, readPaper);
+ ADD_CALLBACK_FUNCTION(Abbot, goToLunch);
+ ADD_CALLBACK_FUNCTION(Abbot, haveLunch);
ADD_CALLBACK_FUNCTION(Abbot, function23);
ADD_CALLBACK_FUNCTION(Abbot, function24);
ADD_CALLBACK_FUNCTION(Abbot, function25);
@@ -261,7 +259,7 @@ IMPLEMENT_FUNCTION(18, Abbot, chapter3Handler)
getData()->entityPosition = kPosition_6470;
getData()->location = kLocationInsideCompartment;
- setup_function19();
+ setup_conversationWithBoutarel();
break;
}
break;
@@ -274,7 +272,7 @@ IMPLEMENT_FUNCTION(18, Abbot, chapter3Handler)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(19, Abbot, function19)
+IMPLEMENT_FUNCTION(19, Abbot, conversationWithBoutarel)
switch (savepoint.action) {
default:
break;
@@ -313,21 +311,21 @@ IMPLEMENT_FUNCTION(19, Abbot, function19)
case 3:
getSavePoints()->push(kEntityAbbot, kEntityBoutarel, kAction122288808);
- setup_function20();
+ setup_readPaper();
break;
}
}
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(20, Abbot, function20)
+IMPLEMENT_FUNCTION(20, Abbot, readPaper)
switch (savepoint.action) {
default:
break;
case kActionNone:
if (getState()->time > kTime1966500 && getEntities()->isInRestaurant(kEntityBoutarel))
- setup_function21();
+ setup_goToLunch();
break;
case kActionDefault:
@@ -337,7 +335,7 @@ IMPLEMENT_FUNCTION(20, Abbot, function20)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(21, Abbot, function21)
+IMPLEMENT_FUNCTION(21, Abbot, goToLunch)
switch (savepoint.action) {
default:
break;
@@ -395,7 +393,7 @@ IMPLEMENT_FUNCTION(21, Abbot, function21)
break;
case 7:
- setup_function22();
+ setup_haveLunch();
break;
}
break;
@@ -411,13 +409,13 @@ IMPLEMENT_FUNCTION(21, Abbot, function21)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(22, Abbot, function22)
+IMPLEMENT_FUNCTION(22, Abbot, haveLunch)
switch (savepoint.action) {
default:
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime1971000, params->param1, kEntityAbbot, kEntityServers0, kAction218586752);
+ Entity::timeCheckSavepoint(kTime1971000, params->param1, kEntityAbbot, kEntityServers0, kAction218586752);
if (getState()->time > kTime1989000 && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->inventoryItem = kItemNone;
@@ -516,7 +514,8 @@ IMPLEMENT_FUNCTION(24, Abbot, function24)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->time, 900);
+ if (!Entity::updateParameter(params->param1, getState()->time, 900))
+ break;
setup_function25();
break;
@@ -617,7 +616,8 @@ IMPLEMENT_FUNCTION(26, Abbot, function26)
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->time, 4500);
+ if (!Entity::updateParameter(params->param2, getState()->time, 4500))
+ break;
if (getEntities()->isSomebodyInsideRestaurantOrSalon())
setup_function27();
@@ -691,7 +691,7 @@ IMPLEMENT_FUNCTION(28, Abbot, function28)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime2052000, params->param1, 1, setup_function29);
+ Entity::timeCheckCallback(kTime2052000, params->param1, 1, WRAP_SETUP_FUNCTION(Abbot, setup_function29));
break;
case kActionDefault:
@@ -770,7 +770,7 @@ IMPLEMENT_FUNCTION(29, Abbot, function29)
getSavePoints()->push(kEntityAbbot, kEntityBoutarel, kAction122358304);
getEntities()->drawSequenceLeft(kEntityAbbot, "508B");
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -864,7 +864,8 @@ IMPLEMENT_FUNCTION(31, Abbot, function31)
if (!params->param1)
break;
- UPDATE_PARAM(params->param5, getState()->time, 450);
+ if (!Entity::updateParameter(params->param5, getState()->time, 450))
+ break;
setCallback(6);
setup_callbackActionRestaurantOrSalon();
@@ -920,7 +921,8 @@ IMPLEMENT_FUNCTION(31, Abbot, function31)
getSavePoints()->push(kEntityAbbot, kEntityAlexei, kAction122288808);
params->param1 = 1;
- UPDATE_PARAM(params->param5, getState()->time, 450);
+ if (!Entity::updateParameter(params->param5, getState()->time, 450))
+ break;
setCallback(6);
setup_callbackActionRestaurantOrSalon();
@@ -1163,7 +1165,8 @@ IMPLEMENT_FUNCTION(36, Abbot, function36)
break;
case 2:
- UPDATE_PARAM(params->param4, getState()->time, 900);
+ if (!Entity::updateParameter(params->param4, getState()->time, 900))
+ break;
getSound()->playSound(kEntityAbbot, "Abb3042");
break;
@@ -1287,7 +1290,7 @@ IMPLEMENT_FUNCTION_II(40, Abbot, function40, CarIndex, EntityPosition)
case kActionNone:
if (getEntities()->updateEntity(kEntityAbbot, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
} else if (!getEvent(kEventAbbotInvitationDrink)
&& getEntities()->isDistanceBetweenEntities(kEntityAbbot, kEntityPlayer, 1000)
&& !getEntities()->isInsideCompartments(kEntityPlayer)
@@ -1302,7 +1305,7 @@ IMPLEMENT_FUNCTION_II(40, Abbot, function40, CarIndex, EntityPosition)
case kActionDefault:
if (getEntities()->updateEntity(kEntityAbbot, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -1321,7 +1324,7 @@ IMPLEMENT_FUNCTION(41, Abbot, chapter4Handler)
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime2358000, params->param1, kEntityAbbot, kEntityServers0, kAction218128129);
+ Entity::timeCheckSavepoint(kTime2358000, params->param1, kEntityAbbot, kEntityServers0, kAction218128129);
if (getState()->time > kTime2389500 && getEntities()->isSomebodyInsideRestaurantOrSalon())
setup_function42();
@@ -1425,10 +1428,12 @@ IMPLEMENT_FUNCTION(43, Abbot, function43)
}
label_callback_1:
- TIME_CHECK(kTime2466000, params->param5, setup_function44);
+ if (Entity::timeCheck(kTime2466000, params->param5, WRAP_SETUP_FUNCTION(Abbot, setup_function44)))
+ break;
if (params->param3) {
- UPDATE_PARAM(params->param6, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75))
+ break;
params->param2 = 1;
params->param3 = 0;
@@ -1542,7 +1547,7 @@ IMPLEMENT_FUNCTION(45, Abbot, function45)
getData()->car = kCarRedSleeping;
getData()->location = kLocationOutsideCompartment;
- RESET_ENTITY_STATE(kEntityVerges, Verges, setup_function38);
+ RESET_ENTITY_STATE(kEntityVerges, Verges, setup_resetState);
getEntities()->drawSequenceLeft(kEntityAbbot, "617Ec");
getEntities()->enterCompartment(kEntityAbbot, kObjectCompartmentC, true);
@@ -1646,14 +1651,14 @@ IMPLEMENT_FUNCTION(48, Abbot, function48)
if (ENTITY_PARAM(0, 1))
getData()->inventoryItem = kItemInvalid;
- UPDATE_PARAM_PROC(params->param1, getState()->time, 1800)
+ if (Entity::updateParameter(params->param1, getState()->time, 1800)) {
getData()->inventoryItem = kItemNone;
setCallback(4);
setup_updatePosition("126C", kCarRedSleeping, 52);
- UPDATE_PARAM_PROC_END
+ }
- TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon);
+ Entity::timeCheckCallbackInventory(kTime2533500, params->param2, 5, WRAP_SETUP_FUNCTION(Abbot, setup_callbackActionRestaurantOrSalon));
break;
case kAction1:
@@ -1705,7 +1710,7 @@ IMPLEMENT_FUNCTION(48, Abbot, function48)
getEntities()->drawSequenceLeft(kEntityAbbot, "126B");
params->param1 = 0;
- TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon);
+ Entity::timeCheckCallbackInventory(kTime2533500, params->param2, 5, WRAP_SETUP_FUNCTION(Abbot, setup_callbackActionRestaurantOrSalon));
break;
case 5:
@@ -1750,7 +1755,8 @@ IMPLEMENT_FUNCTION(49, Abbot, pickBomb)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->timeTicks, 150);
+ if (!Entity::updateParameter(params->param1, getState()->timeTicks, 150))
+ break;
getSavePoints()->push(kEntityAbbot, kEntityAbbot, kAction157489665);
break;
diff --git a/engines/lastexpress/entities/abbot.h b/engines/lastexpress/entities/abbot.h
index 462f5a491e..dc3e86db54 100644
--- a/engines/lastexpress/entities/abbot.h
+++ b/engines/lastexpress/entities/abbot.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_ABBOT_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -157,10 +156,10 @@ public:
* Handle Chapter 3 events
*/
DECLARE_FUNCTION(chapter3Handler)
- DECLARE_FUNCTION(function19)
- DECLARE_FUNCTION(function20)
- DECLARE_FUNCTION(function21)
- DECLARE_FUNCTION(function22)
+ DECLARE_FUNCTION(conversationWithBoutarel)
+ DECLARE_FUNCTION(readPaper)
+ DECLARE_FUNCTION(goToLunch)
+ DECLARE_FUNCTION(haveLunch)
DECLARE_FUNCTION(function23)
DECLARE_FUNCTION(function24)
DECLARE_FUNCTION(function25)
diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp
index 54c2d87b89..115c890f6f 100644
--- a/engines/lastexpress/entities/alexei.cpp
+++ b/engines/lastexpress/entities/alexei.cpp
@@ -31,9 +31,6 @@
#include "lastexpress/game/scenes.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -207,7 +204,7 @@ IMPLEMENT_FUNCTION(13, Alexei, function13)
getData()->entityPosition = kPosition_7500;
getEntities()->clearSequences(kEntityAlexei);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -242,7 +239,7 @@ IMPLEMENT_FUNCTION(14, Alexei, function14)
getObjects()->update(kObjectCompartment2, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
getEntities()->exitCompartment(kEntityAlexei, kObjectCompartment2, true);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -254,7 +251,7 @@ IMPLEMENT_FUNCTION(15, Alexei, function15)
break;
case kActionNone:
- UPDATE_PARAM_CHECK(params->param2, getState()->time, params->param1)
+ if (Entity::updateParameterCheck(params->param2, getState()->time, params->param1)) {
if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->location = kLocationOutsideCompartment;
@@ -292,7 +289,7 @@ IMPLEMENT_FUNCTION(15, Alexei, function15)
getData()->location = kLocationInsideCompartment;
getEntities()->drawSequenceLeft(kEntityAlexei, "103B");
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -312,12 +309,13 @@ IMPLEMENT_FUNCTION_IS(16, Alexei, function16, TimeValue)
getObjects()->update(kObjectCompartment2, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
getObjects()->update(kObjectHandleInsideBathroom, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param5) {
- UPDATE_PARAM(CURRENT_PARAM(1, 1), getState()->timeTicks, 75);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75))
+ break;
params->param5 = 0;
params->param6 = 1;
@@ -448,7 +446,7 @@ IMPLEMENT_FUNCTION(17, Alexei, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler)
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Alexei, setup_chapter1Handler));
break;
case kActionDefault:
@@ -485,7 +483,9 @@ IMPLEMENT_FUNCTION(18, Alexei, chapter1Handler)
}
if (params->param1) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90))
+ break;
+
getScenes()->loadSceneFromPosition(kCarRestaurant, 61);
} else {
params->param3 = 0;
@@ -689,7 +689,7 @@ IMPLEMENT_FUNCTION(21, Alexei, function21)
break;
case kActionNone:
- UPDATE_PARAM_CHECK(params->param2, getState()->time, params->param1)
+ if (Entity::updateParameterCheck(params->param2, getState()->time, params->param1)) {
getData()->location = kLocationOutsideCompartment;
getData()->inventoryItem = kItemNone;
@@ -751,7 +751,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22)
break;
case kActionNone:
- UPDATE_PARAM_PROC(params->param2, getState()->time, params->param2)
+ if (Entity::updateParameter(params->param2, getState()->time, params->param2)) {
if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->location = kLocationOutsideCompartment;
getData()->inventoryItem = kItemNone;
@@ -760,7 +760,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22)
setup_updatePosition("103D", kCarRestaurant, 52);
break;
}
- UPDATE_PARAM_PROC_END
+ }
if (params->param3 == kTimeInvalid || getState()->time <= kTime1111500)
break;
@@ -978,7 +978,7 @@ IMPLEMENT_FUNCTION(26, Alexei, function26)
break;
case kActionNone:
- TIME_CHECK(kTime1512000, params->param1, setup_function27)
+ Entity::timeCheck(kTime1512000, params->param1, WRAP_SETUP_FUNCTION(Alexei, setup_function27));
break;
case kActionDefault:
@@ -1333,25 +1333,26 @@ IMPLEMENT_FUNCTION(35, Alexei, function35)
case kActionNone:
if (getEntities()->isInSalon(kEntityPlayer)) {
- UPDATE_PARAM_PROC(params->param2, getState()->time, 2700)
+ if (Entity::updateParameter(params->param2, getState()->time, 2700)) {
setCallback(1);
setup_callbackActionRestaurantOrSalon();
break;
- UPDATE_PARAM_PROC_END
+ }
} else {
params->param2 = 0;
}
- UPDATE_PARAM_PROC(params->param3, getState()->time, params->param1)
+ if (Entity::updateParameter(params->param3, getState()->time, params->param1)) {
if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
setCallback(3);
setup_function15();
break;
}
- UPDATE_PARAM_PROC_END
+ }
label_callback_3:
- UPDATE_PARAM(params->param4, getState()->time, 9000);
+ if (!Entity::updateParameter(params->param4, getState()->time, 9000))
+ break;
setCallback(4);
setup_callbackActionRestaurantOrSalon();
@@ -1378,7 +1379,7 @@ label_callback_3:
case 2:
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -1400,7 +1401,8 @@ IMPLEMENT_FUNCTION(36, Alexei, function36)
if (params->param3 || params->param2)
break;
- UPDATE_PARAM(params->param4, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, params->param1))
+ break;
getEntities()->drawSequenceRight(kEntityAlexei, "124B");
@@ -1448,7 +1450,7 @@ IMPLEMENT_FUNCTION(36, Alexei, function36)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
diff --git a/engines/lastexpress/entities/alexei.h b/engines/lastexpress/entities/alexei.h
index 262826ae42..9792385863 100644
--- a/engines/lastexpress/entities/alexei.h
+++ b/engines/lastexpress/entities/alexei.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_ALEXEI_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp
index cd79870559..e834e1f7cb 100644
--- a/engines/lastexpress/entities/alouan.cpp
+++ b/engines/lastexpress/entities/alouan.cpp
@@ -28,9 +28,6 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -89,22 +86,22 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(6, Alouan, compartment6)
- COMPARTMENT_TO(Alouan, kObjectCompartment6, kPosition_4070, "621Cf", "621Df");
+ Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Cf", "621Df");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(7, Alouan, compartment8)
- COMPARTMENT_TO(Alouan, kObjectCompartment8, kPosition_2740, "621Ch", "621Dh");
+ Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Ch", "621Dh");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(8, Alouan, compartment6to8)
- COMPARTMENT_FROM_TO(Alouan, kObjectCompartment6, kPosition_4070, "621Bf", kObjectCompartment8, kPosition_2740, "621Ah");
+ Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Bf", kObjectCompartment8, kPosition_2740, "621Ah");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(9, Alouan, compartment8to6)
- COMPARTMENT_FROM_TO(Alouan, kObjectCompartment8, kPosition_2740, "621Bh", kObjectCompartment6, kPosition_4070, "621Af");
+ Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Bh", kObjectCompartment6, kPosition_4070, "621Af");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -114,7 +111,7 @@ IMPLEMENT_FUNCTION(10, Alouan, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Alouan, setup_chapter1Handler));
break;
case kActionDefault:
@@ -134,7 +131,8 @@ IMPLEMENT_FUNCTION(11, Alouan, chapter1Handler)
case kActionNone:
- TIME_CHECK_CALLBACK(kTime1096200, params->param1, 1, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTime1096200, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6)))
+ break;
label_callback1:
if (getState()->time > kTime1162800 && !params->param2) {
@@ -284,21 +282,28 @@ IMPLEMENT_FUNCTION(16, Alouan, chapter3Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTimeCitySalzbourg, params->param1, 1, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTimeCitySalzbourg, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6)))
+ break;
label_callback1:
- if (params->param2 != kTimeInvalid && getState()->time > kTime1989000)
- TIME_CHECK_CAR(kTime2119500, params->param5, 5, setup_compartment8);
+ if (params->param2 != kTimeInvalid && getState()->time > kTime1989000) {
+ if (Entity::timeCheckCar(kTime2119500, params->param5, 5, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8)))
+ break;
+ }
label_callback2:
- TIME_CHECK_CALLBACK_1(kTime2052000, params->param3, 3, setup_playSound, "Har1005");
+ if (Entity::timeCheckCallback(kTime2052000, params->param3, 3, "Har1005", WRAP_SETUP_FUNCTION_S(Alouan, setup_playSound)))
+ break;
label_callback3:
- TIME_CHECK_CALLBACK(kTime2133000, params->param4, 4, setup_compartment6to8);
+ if (Entity::timeCheckCallback(kTime2133000, params->param4, 4, WRAP_SETUP_FUNCTION(Alouan, setup_compartment6to8)))
+ break;
label_callback4:
- if (params->param5 != kTimeInvalid && getState()->time > kTime2151000)
- TIME_CHECK_CAR(kTime2241000, params->param5, 5, setup_compartment8);
+ if (params->param5 != kTimeInvalid && getState()->time > kTime2151000) {
+ if (Entity::timeCheckCar(kTime2241000, params->param5, 5, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8)))
+ break;
+ }
break;
case kActionDefault:
@@ -355,11 +360,14 @@ IMPLEMENT_FUNCTION(18, Alouan, chapter4Handler)
break;
case kActionNone:
- if (params->param1 != kTimeInvalid)
- TIME_CHECK_CAR(kTime2443500, params->param1, 1, setup_compartment8);
+ if (params->param1 != kTimeInvalid) {
+ if (Entity::timeCheckCar(kTime2443500, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8)))
+ break;
+ }
label_callback1:
- TIME_CHECK_CALLBACK(kTime2455200, params->param2, 2, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTime2455200, params->param2, 2, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6)))
+ break;
label_callback2:
if (getState()->time > kTime2475000 && !params->param3) {
@@ -441,7 +449,9 @@ IMPLEMENT_FUNCTION(22, Alouan, function22)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param1, getState()->time, 2700))
+ break;
+
setup_function23();
break;
diff --git a/engines/lastexpress/entities/alouan.h b/engines/lastexpress/entities/alouan.h
index c6a6beddd9..91254a449a 100644
--- a/engines/lastexpress/entities/alouan.h
+++ b/engines/lastexpress/entities/alouan.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_ALOUAN_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp
index b13aa21f6d..f8768032b5 100644
--- a/engines/lastexpress/entities/anna.cpp
+++ b/engines/lastexpress/entities/anna.cpp
@@ -34,9 +34,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -200,16 +198,17 @@ IMPLEMENT_FUNCTION(12, Anna, function12)
params->param2 = 1;
if (params->param6) {
- UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, 75)
+ if (Entity::updateParameter(params->param7, getState()->timeTicks, 75)) {
getSavePoints()->push(kEntityAnna, kEntityAnna, kActionEndSound);
params->param6 = 0;
params->param7 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param4) {
- UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+ break;
params->param4 = 0;
params->param5 = 1;
@@ -227,7 +226,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12)
case kActionEndSound:
if (params->param2) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -289,7 +288,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12)
getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorHandKnock, kCursorHand);
getObjects()->update(kObject53, kEntityAnna, kObjectLocation1, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -424,12 +423,13 @@ IMPLEMENT_FUNCTION_IS(15, Anna, function15, TimeValue)
getObjects()->update(kObjectCompartmentF, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
getObjects()->update(kObject53, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param5) {
- UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+ break;
params->param5 = 0;
params->param6 = 1;
@@ -547,7 +547,7 @@ IMPLEMENT_FUNCTION(16, Anna, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Anna, setup_chapter1Handler));
break;
case kActionDefault:
@@ -577,7 +577,7 @@ IMPLEMENT_FUNCTION_II(17, Anna, function17, uint32, uint32)
if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -615,7 +615,7 @@ IMPLEMENT_FUNCTION_II(17, Anna, function17, uint32, uint32)
}
if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -664,20 +664,21 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue)
case kActionNone:
if (params->param1 && params->param1 < getState()->time && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param5 && !params->param4) {
- UPDATE_PARAM_PROC(params->param6, getState()->time, 900)
+ if (Entity::updateParameter(params->param6, getState()->time, 900)) {
params->param2 |= kItemScarf;
params->param5 = 0;
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param3) {
- UPDATE_PARAM(params->param7, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param7, getState()->timeTicks, 90))
+ break;
getScenes()->loadSceneFromPosition(kCarRestaurant, 61);
} else {
@@ -757,7 +758,7 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue)
case kAction259136835:
case kAction268773672:
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -1151,15 +1152,16 @@ IMPLEMENT_FUNCTION(29, Anna, function29)
case kActionNone:
if (params->param2) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 900)
+ if (Entity::updateParameter(params->param3, getState()->time, 900)) {
getData()->inventoryItem = (InventoryItem)(getData()->inventoryItem | kItemScarf);
params->param2 = 0;
params->param3 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param1) {
- UPDATE_PARAM(params->param4, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 90))
+ break;
getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
} else {
@@ -1281,7 +1283,9 @@ IMPLEMENT_FUNCTION(30, Anna, function30)
}
if (params->param1) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 90))
+ break;
+
getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
} else {
params->param5 = 0;
@@ -1411,15 +1415,15 @@ IMPLEMENT_FUNCTION(34, Anna, function34)
case kActionNone:
if (!params->param1 && getEntities()->isPlayerPosition(kCarRedSleeping, 60)) {
- UPDATE_PARAM_PROC(params->param2, getState()->time, 150)
+ if (Entity::updateParameter(params->param2, getState()->time, 150)) {
setCallback(1);
setup_draw("419B");
break;
- UPDATE_PARAM_PROC_END
+ }
}
label_callback_1:
- TIME_CHECK(kTime1489500, params->param3, setup_function35);
+ Entity::timeCheck(kTime1489500, params->param3, WRAP_SETUP_FUNCTION(Anna, setup_function35));
break;
case kActionKnock:
@@ -1485,7 +1489,8 @@ IMPLEMENT_FUNCTION(35, Anna, function35)
if (!params->param1)
break;
- UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+ break;
switch (params->param2) {
default:
@@ -1666,7 +1671,7 @@ IMPLEMENT_FUNCTION_II(39, Anna, function39, CarIndex, EntityPosition)
if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -1687,7 +1692,7 @@ IMPLEMENT_FUNCTION_II(39, Anna, function39, CarIndex, EntityPosition)
if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -1799,7 +1804,8 @@ IMPLEMENT_FUNCTION(41, Anna, function41)
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param2, getState()->time, 2700))
+ break;
params->param5++;
switch (params->param5) {
@@ -1985,7 +1991,7 @@ IMPLEMENT_FUNCTION_I(45, Anna, function45, bool)
case 2:
getEntities()->exitCompartment(kEntityAnna, kObjectCompartmentF, true);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2092,11 +2098,11 @@ IMPLEMENT_FUNCTION(48, Anna, function48)
break;
if (params->param3 != kTimeInvalid && getState()->time > kTime1969200) {
- UPDATE_PARAM_PROC_TIME(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)
+ if (Entity::updateParameterTime(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)) {
setCallback(3);
setup_playSound("Aug3007A");
break;
- UPDATE_PARAM_PROC_END
+ }
}
label_callback_4:
@@ -2195,7 +2201,7 @@ IMPLEMENT_FUNCTION(49, Anna, leaveTableWithAugust)
getSavePoints()->push(kEntityAnna, kEntityTables3, kActionDrawTablesWithChairs, "010M");
getEntities()->clearSequences(kEntityAugust);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -2386,22 +2392,23 @@ IMPLEMENT_FUNCTION(53, Anna, function53)
case kActionNone:
if (getProgress().field_48 && params->param5 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)
+ if (Entity::updateParameterTime(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)) {
setup_function54();
break;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param3) {
- UPDATE_PARAM_PROC(params->param6, getState()->time, 9000)
+ if (Entity::updateParameter(params->param6, getState()->time, 9000)) {
params->param4 = !params->param4;
getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A");
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param1) {
- UPDATE_PARAM(params->param7, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param7, getState()->timeTicks, 75))
+ break;
CursorStyle cursor = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal;
@@ -2537,17 +2544,19 @@ IMPLEMENT_FUNCTION(54, Anna, function54)
case kActionNone:
if (params->param3) {
- TIME_CHECK(kTime2079000, params->param5, setup_function55);
+ if (Entity::timeCheck(kTime2079000, params->param5, WRAP_SETUP_FUNCTION(Anna, setup_function55)))
+ break;
- UPDATE_PARAM_PROC(params->param6, getState()->time, 9000)
+ if (Entity::updateParameter(params->param6, getState()->time, 9000)) {
params->param4 = !params->param4;
getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A");
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param1) {
- UPDATE_PARAM(params->param7, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param7, getState()->timeTicks, 75))
+ break;
CursorStyle cursor = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal;
@@ -2894,7 +2903,8 @@ IMPLEMENT_FUNCTION(59, Anna, function59)
}
if (params->param1) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
CursorStyle style = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal;
getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorNormal, style);
@@ -3040,7 +3050,7 @@ IMPLEMENT_FUNCTION(60, Anna, function60)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityAnna);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3268,7 +3278,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler)
case kActionNone:
if (getEntities()->isPlayerPosition(kCarRedSleeping, 46)) {
- UPDATE_PARAM_GOTO(params->param4, getState()->timeTicks, 30, label_next);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 30))
+ goto label_next;
getScenes()->loadSceneFromPosition(kCarRedSleeping, 8);
}
@@ -3277,7 +3288,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler)
label_next:
if (params->param1) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
@@ -3407,7 +3419,8 @@ IMPLEMENT_FUNCTION(69, Anna, function69)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param2, getState()->time, 4500);
+ if (!Entity::updateParameter(params->param2, getState()->time, 4500))
+ break;
getData()->car = kCarRedSleeping;
getData()->entityPosition = kPosition_9270;
@@ -3417,7 +3430,7 @@ IMPLEMENT_FUNCTION(69, Anna, function69)
break;
}
- TIME_CHECK_CALLBACK(kTime2535300, params->param3, 4, setup_callbackActionRestaurantOrSalon);
+ Entity::timeCheckCallback(kTime2535300, params->param3, 4, WRAP_SETUP_FUNCTION(Anna, setup_callbackActionRestaurantOrSalon));
break;
case kActionDefault:
@@ -3533,7 +3546,7 @@ IMPLEMENT_FUNCTION(71, Anna, function71)
getEntities()->exitCompartment(kEntityAnna, kObjectCompartmentF);
getData()->entityPosition = kPosition_4070;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -3589,7 +3602,7 @@ IMPLEMENT_FUNCTION_II(72, Anna, function72, CarIndex, EntityPosition)
if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -3602,7 +3615,7 @@ IMPLEMENT_FUNCTION_II(72, Anna, function72, CarIndex, EntityPosition)
case kActionDefault:
if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
} else if (!getEvent(kEventAnnaTired))
getData()->inventoryItem = kItemInvalid;
break;
@@ -3911,7 +3924,8 @@ IMPLEMENT_FUNCTION(80, Anna, function80)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->timeTicks, 450);
+ if (!Entity::updateParameter(params->param1, getState()->timeTicks, 450))
+ break;
getSound()->playSound(kEntityPlayer, "Kro5001", kFlagDefault);
break;
@@ -3980,7 +3994,8 @@ IMPLEMENT_FUNCTION(81, Anna, finalSequence)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->timeTicks, 180);
+ if (!Entity::updateParameter(params->param1, getState()->timeTicks, 180))
+ break;
getSound()->playSound(kEntityTrain, "LIB069");
getLogic()->gameOver(kSavegameTypeIndex, 2, kSceneNone, true);
diff --git a/engines/lastexpress/entities/anna.h b/engines/lastexpress/entities/anna.h
index 72c6db4bd9..205ff9d42c 100644
--- a/engines/lastexpress/entities/anna.h
+++ b/engines/lastexpress/entities/anna.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_ANNA_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index cfde8a2d6f..dbae7bad20 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -36,9 +36,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -150,7 +148,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION_SI(7, August, enterExitCompartment3, ObjectIndex)
if (savepoint.action == kAction4) {
getEntities()->exitCompartment(kEntityAugust, (ObjectIndex)params->param4);
- CALLBACK_ACTION();
+ callbackAction();
return;
}
@@ -177,7 +175,7 @@ IMPLEMENT_FUNCTION_IIS(10, August, callSavepointNoDrawing, EntityIndex, ActionIn
if (!params->param6)
getSavePoints()->call(kEntityAugust, (EntityIndex)params->param1, (ActionIndex)params->param2, (char *)&params->seq);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction10:
@@ -233,7 +231,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue)
case kActionNone:
if (params->param1 < getState()->time && !params->param2) {
params->param2 = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -262,7 +260,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue)
case 1:
if (ENTITY_PARAM(0, 1)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -272,7 +270,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue)
case 2:
case 3:
if (ENTITY_PARAM(0, 1)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -289,7 +287,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue)
case 5:
if (ENTITY_PARAM(0, 1)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -308,7 +306,7 @@ IMPLEMENT_FUNCTION_II(18, August, updateEntity2, CarIndex, EntityPosition)
case kActionNone:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
} else if (getEntities()->isDistanceBetweenEntities(kEntityAugust, kEntityPlayer, 1000)
&& !getEntities()->isInGreenCarEntrance(kEntityPlayer)
&& !getEntities()->isInsideCompartments(kEntityPlayer)
@@ -316,14 +314,14 @@ IMPLEMENT_FUNCTION_II(18, August, updateEntity2, CarIndex, EntityPosition)
if (getData()->car == kCarGreenSleeping || getData()->car == kCarRedSleeping) {
ENTITY_PARAM(0, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
}
}
break;
case kActionDefault:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -407,7 +405,7 @@ IMPLEMENT_FUNCTION_II(19, August, function19, bool, bool)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityAugust);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -503,7 +501,7 @@ IMPLEMENT_FUNCTION_I(20, August, function20, bool)
getObjects()->update(kObjectCompartment3, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
getEntities()->exitCompartment(kEntityAugust, kObjectCompartment3, true);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -520,12 +518,13 @@ IMPLEMENT_FUNCTION_I(21, August, function21, TimeValue)
getObjects()->update(kObjectCompartment3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param2) {
- UPDATE_PARAM_GOTO(params->param8, getState()->timeTicks, 75, label_continue);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+ goto label_continue;
params->param2 = 0;
params->param3 = 1;
@@ -540,10 +539,10 @@ label_continue:
break;
if (params->param6) {
- UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 6300)
+ if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 6300)) {
params->param6 = 0;
CURRENT_PARAM(1, 1) = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (!params->param4
@@ -753,7 +752,7 @@ IMPLEMENT_FUNCTION(22, August, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(August, setup_chapter1Handler));
break;
case kActionDefault:
@@ -786,7 +785,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue)
} else {
getEntities()->exitCompartment(kEntityAugust, kObjectCompartment1, true);
getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -806,7 +805,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue)
}
label_callback_8:
- UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)
+ if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)) {
getEntities()->exitCompartment(kEntityAugust, kObjectCompartment1, true);
if (getProgress().eventCorpseMovedFromFloor) {
@@ -822,7 +821,7 @@ label_callback_8:
setup_savegame(kSavegameTypeEvent, kEventAugustFindCorpse);
}
break;
- UPDATE_PARAM_PROC_END
+ }
label_callback_9:
if (params->param3 && params->param1 < getState()->time && !CURRENT_PARAM(1, 5)) {
@@ -842,7 +841,8 @@ label_callback_9:
break;
if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1) {
- UPDATE_PARAM(CURRENT_PARAM(1, 2), getState()->timeTicks, 75);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 2), getState()->timeTicks, 75))
+ break;
getObjects()->update(kObjectCompartment1, kEntityAugust, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
@@ -867,7 +867,7 @@ label_callback_9:
if (params->param8 >= 3) {
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -959,7 +959,7 @@ label_callback_9:
case 2:
getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -986,7 +986,7 @@ label_callback_9:
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 5:
@@ -1028,7 +1028,7 @@ label_callback_9:
case 12:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 13:
@@ -1056,7 +1056,7 @@ label_callback_9:
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 15:
@@ -1096,7 +1096,7 @@ IMPLEMENT_FUNCTION(24, August, dinner)
getScenes()->loadSceneFromPosition(kCarRestaurant, 61);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -1485,7 +1485,8 @@ IMPLEMENT_FUNCTION(30, August, restaurant)
break;
case kActionNone:
- UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+ break;
getData()->inventoryItem = kItemInvalid;
break;
@@ -1634,9 +1635,9 @@ IMPLEMENT_FUNCTION(32, August, function32)
break;
case kActionNone:
- UPDATE_PARAM_PROC_TIME(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0);
+ if (Entity::updateParameterTime(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0)) {
getSavePoints()->push(kEntityAugust, kEntityAnna, kAction123712592);
- UPDATE_PARAM_PROC_END
+ }
if (params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
if (!params->param4) {
@@ -1645,18 +1646,19 @@ IMPLEMENT_FUNCTION(32, August, function32)
}
if (params->param7 != kTimeInvalid && params->param4 < getState()->time) {
- UPDATE_PARAM_PROC_TIME(params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0);
+ if (Entity::updateParameterTime((TimeValue)params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0)) {
getData()->location = kLocationOutsideCompartment;
setCallback(5);
setup_updatePosition("109D", kCarRestaurant, 56);
break;
- UPDATE_PARAM_PROC_END
+ }
}
}
if (params->param3) {
- UPDATE_PARAM(params->param8, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 90))
+ break;
getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
} else {
@@ -1813,7 +1815,7 @@ IMPLEMENT_FUNCTION(36, August, chapter2Handler)
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime1755000, params->param2, kEntityAugust, kEntityServers0, kAction252568704);
+ Entity::timeCheckSavepoint(kTime1755000, params->param2, kEntityAugust, kEntityServers0, kAction252568704);
if (getState()->time > kTime1773000 && params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->inventoryItem = kItemNone;
@@ -1904,7 +1906,7 @@ IMPLEMENT_FUNCTION(37, August, function37)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_1(kTime1791000, params->param2, 5, setup_function20, true);
+ Entity::timeCheckCallback(kTime1791000, params->param2, 5, true, WRAP_SETUP_FUNCTION_B(August, setup_function20));
break;
case kActionDefault:
@@ -1962,9 +1964,9 @@ IMPLEMENT_FUNCTION(38, August, function38)
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128);
+ Entity::timeCheckSavepoint(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128);
- TIME_CHECK_CALLBACK(kTime1820700, params->param2, 3, setup_callbackActionRestaurantOrSalon);
+ Entity::timeCheckCallback(kTime1820700, params->param2, 3, WRAP_SETUP_FUNCTION(August, setup_callbackActionRestaurantOrSalon));
break;
case kActionDefault:
@@ -2110,7 +2112,7 @@ IMPLEMENT_FUNCTION_II(41, August, function41, CarIndex, EntityPosition)
getData()->inventoryItem = kItemNone;
if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -2147,7 +2149,7 @@ IMPLEMENT_FUNCTION_II(41, August, function41, CarIndex, EntityPosition)
case kActionDefault:
if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -2172,7 +2174,7 @@ IMPLEMENT_FUNCTION_III(42, August, function42, CarIndex, EntityPosition, bool)
if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -2191,7 +2193,7 @@ IMPLEMENT_FUNCTION_III(42, August, function42, CarIndex, EntityPosition, bool)
case kActionDefault:
if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -2212,7 +2214,7 @@ IMPLEMENT_FUNCTION(43, August, chapter3Handler)
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime1953000, params->param2, kEntityAugust, kEntityAnna, kAction291662081);
+ Entity::timeCheckSavepoint(kTime1953000, params->param2, kEntityAugust, kEntityAnna, kAction291662081);
// Set as same position as Anna
if (params->param1) {
@@ -2402,7 +2404,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION(46, August, function46)
switch (savepoint.action) {
default:
- TIME_CHECK_CALLBACK(kTime2088000, params->param1, 1, setup_function47);
+ Entity::timeCheckCallback(kTime2088000, params->param1, 1, WRAP_SETUP_FUNCTION(August, setup_function47));
break;
case kActionNone:
@@ -2473,7 +2475,7 @@ IMPLEMENT_FUNCTION(47, August, function47)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2487,7 +2489,7 @@ IMPLEMENT_FUNCTION(48, August, function48)
break;
case kActionNone:
- TIME_CHECK(kTimeCityLinz, params->param1, setup_function49);
+ Entity::timeCheck(kTimeCityLinz, params->param1, WRAP_SETUP_FUNCTION(August, setup_function49));
break;
case kActionKnock:
@@ -2770,7 +2772,8 @@ IMPLEMENT_FUNCTION(54, August, function54)
getData()->inventoryItem = kItemInvalid;
if (!params->param2 && params->param1) {
- UPDATE_PARAM(params->param5, getState()->time, params->param1);
+ if (!Entity::updateParameter(params->param5, getState()->time, params->param1))
+ break;
getData()->inventoryItem = kItemNone;
setup_function55();
@@ -3046,7 +3049,8 @@ IMPLEMENT_FUNCTION(60, August, function60)
if (!params->param1)
break;
- UPDATE_PARAM(params->param3, getState()->time, 9000);
+ if (!Entity::updateParameter(params->param3, getState()->time, 9000))
+ break;
setCallback(1);
setup_callbackActionRestaurantOrSalon();
@@ -3142,7 +3146,8 @@ IMPLEMENT_FUNCTION(62, August, function62)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->time, 900);
+ if (!Entity::updateParameter(params->param1, getState()->time, 900))
+ break;
getSound()->playSound(kEntityAugust, "Aug4003A");
@@ -3220,9 +3225,9 @@ IMPLEMENT_FUNCTION(63, August, function63)
break;
case kActionNone:
- UPDATE_PARAM_PROC(params->param3, getState()->time, 1800)
+ if (Entity::updateParameter(params->param3, getState()->time, 1800)) {
getData()->inventoryItem = kItemInvalid;
- UPDATE_PARAM_PROC_END
+ }
if (getState()->time > kTime2488500 && !params->param4) {
params->param4 = 1;
@@ -3231,7 +3236,8 @@ IMPLEMENT_FUNCTION(63, August, function63)
break;
}
- UPDATE_PARAM(params->param5, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, params->param1))
+ break;
params->param2 = (params->param6 < 1 ? 1 : 0);
@@ -3388,7 +3394,8 @@ IMPLEMENT_FUNCTION(68, August, function68)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
@@ -3523,7 +3530,7 @@ IMPLEMENT_FUNCTION(69, August, unhookCars)
getScenes()->loadSceneFromPosition(kCarRestaurant, 85, 1);
getSavePoints()->pushAll(kEntityAugust, kActionProceedChapter5);
- RESET_ENTITY_STATE(kEntityVerges, Verges, setup_function42)
+ RESET_ENTITY_STATE(kEntityVerges, Verges, setup_end)
}
break;
}
diff --git a/engines/lastexpress/entities/august.h b/engines/lastexpress/entities/august.h
index 2cbb31b968..606321955b 100644
--- a/engines/lastexpress/entities/august.h
+++ b/engines/lastexpress/entities/august.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_AUGUST_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp
index 315b12a69e..219ddf901b 100644
--- a/engines/lastexpress/entities/boutarel.cpp
+++ b/engines/lastexpress/entities/boutarel.cpp
@@ -32,9 +32,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -231,7 +229,7 @@ IMPLEMENT_FUNCTION_I(11, Boutarel, function11, bool)
case 7:
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -249,7 +247,7 @@ IMPLEMENT_FUNCTION(12, Boutarel, enterTableWithMmeBoutarel)
getSavePoints()->push(kEntityBoutarel, kEntityTables2, kAction136455232);
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -276,7 +274,7 @@ IMPLEMENT_FUNCTION(13, Boutarel, leaveTableWithMmeBoutarel)
getSavePoints()->push(kEntityBoutarel, kEntityTables2, kActionDrawTablesWithChairs, "008F");
getEntities()->clearSequences(kEntityMmeBoutarel);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -358,7 +356,7 @@ IMPLEMENT_FUNCTION_I(14, Boutarel, function14, bool)
getEntities()->clearSequences(kEntityBoutarel);
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -416,7 +414,7 @@ IMPLEMENT_FUNCTION_IS(15, Boutarel, function15, bool)
case 5:
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -464,7 +462,7 @@ IMPLEMENT_FUNCTION_IS(16, Boutarel, function16, bool)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityBoutarel);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -478,10 +476,13 @@ IMPLEMENT_FUNCTION_IS(17, Boutarel, function17, TimeValue)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_ACTION(params->param1, params->param6);
+ if (Entity::timeCheckCallbackAction((TimeValue)params->param1, params->param6))
+ break;
if (params->param5) {
- UPDATE_PARAM(params->param7, getState()->timeTicks, 90)
+ if (!Entity::updateParameter(params->param7, getState()->timeTicks, 90))
+ break;
+
getScenes()->loadSceneFromPosition(kCarRestaurant, 51);
} else {
params->param7 = 0;
@@ -511,12 +512,13 @@ IMPLEMENT_FUNCTION_I(18, Boutarel, function18, TimeValue)
getObjects()->update(kObjectCompartmentC, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
getObjects()->update(kObject50, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param2) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
params->param2 = 0;
params->param3 = 1;
@@ -615,7 +617,7 @@ IMPLEMENT_FUNCTION(19, Boutarel, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_chapter1Handler));
break;
case kActionDefault:
@@ -644,14 +646,14 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20)
break;
if (!params->param2) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 4500)
+ if (Entity::updateParameter(params->param3, getState()->time, 4500)) {
setCallback(3);
setup_playSound("MRB1078A");
break;
- UPDATE_PARAM_PROC_END
+ }
}
- TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false);
+ Entity::timeCheckCallback(kTime1138500, params->param4, 4, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
break;
case kActionDefault:
@@ -676,13 +678,13 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20)
break;
case 3:
- TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false);
+ Entity::timeCheckCallback(kTime1138500, params->param4, 4, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
break;
case 4:
getSavePoints()->push(kEntityBoutarel, kEntityCooks, kAction224849280);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -834,7 +836,7 @@ IMPLEMENT_FUNCTION(24, Boutarel, chapter2Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_1(kTime1759500, params->param2, 1, setup_function14, false);
+ Entity::timeCheckCallback(kTime1759500, params->param2, 1, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
break;
case kActionDefault:
@@ -934,9 +936,9 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
break;
case kActionNone:
- UPDATE_PARAM_PROC(params->param2, getState()->time, 450)
+ if (Entity::updateParameter(params->param2, getState()->time, 450)) {
getSavePoints()->push(kEntityBoutarel, kEntityServers1, kAction256200848);
- UPDATE_PARAM_PROC_END
+ }
if (!params->param1)
break;
@@ -959,7 +961,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
}
}
- TIME_CHECK_CALLBACK_1(kTime2002500, params->param4, 1, setup_function14, true);
+ Entity::timeCheckCallback(kTime2002500, params->param4, 1, true, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
break;
case kActionDefault:
@@ -972,7 +974,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
break;
case 1:
- TIME_CHECK_CALLBACK_1(kTime2002500, params->param4, 1, setup_function14, true);
+ Entity::timeCheckCallback(kTime2002500, params->param4, 1, true, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
break;
case 2:
@@ -1045,7 +1047,7 @@ IMPLEMENT_FUNCTION(32, Boutarel, chapter4Handler)
break;
case kActionNone:
- TIME_CHECK(kTime2367000, params->param1, setup_function33);
+ Entity::timeCheck(kTime2367000, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_function33));
break;
case kActionDefault:
@@ -1063,7 +1065,7 @@ IMPLEMENT_FUNCTION(33, Boutarel, function33)
case kActionNone:
if (params->param1)
- TIME_CHECK_CALLBACK_1(kTime2389500, params->param2, 3, setup_function14, false);
+ Entity::timeCheckCallback(kTime2389500, params->param2, 3, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
break;
case kActionDefault:
@@ -1111,7 +1113,8 @@ IMPLEMENT_FUNCTION(34, Boutarel, function34)
break;
case kActionNone:
- TIME_CHECK(kTime2470500, params->param1, setup_function35);
+ if (Entity::timeCheck(kTime2470500, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_function35)))
+ break;
if (getState()->time > kTime2457000 && getEvent(kEventAugustDrink)) {
getSavePoints()->push(kEntityBoutarel, kEntityAbbot, kAction159003408);
diff --git a/engines/lastexpress/entities/boutarel.h b/engines/lastexpress/entities/boutarel.h
index 5eb264631c..04838f6527 100644
--- a/engines/lastexpress/entities/boutarel.h
+++ b/engines/lastexpress/entities/boutarel.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_BOUTAREL_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index 96e08ba808..d373432710 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -63,11 +63,9 @@
#include "lastexpress/game/state.h"
#include "lastexpress/menu/menu.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -152,7 +150,7 @@ IMPLEMENT_FUNCTION(5, Chapters, resetMainEntities)
RESET_ENTITY_STATE(kEntityVesna, Vesna, setup_reset);
RESET_ENTITY_STATE(kEntityYasmin, Yasmin, setup_reset);
- CALLBACK_ACTION();
+ callbackAction();
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -191,7 +189,7 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End)
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
} else {
getSound()->playSound(kEntityPlayer, "LIB014");
getSound()->playSound(kEntityPlayer, "LIB015", kFlagDefault, 15);
@@ -386,12 +384,6 @@ IMPLEMENT_FUNCTION(7, Chapters, chapter1Init)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-#define PLAY_STEAM() { \
- getSoundQueue()->resetState(); \
- getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4)); \
- ENTITY_PARAM(0, 2) = 0; \
- }
-
IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler)
switch (savepoint.action) {
default:
@@ -401,21 +393,28 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler)
if (!getProgress().isTrainRunning || getState()->time >= kTime1458000)
goto label_processStations;
- UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param2)
+ if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param2)) {
// Play sound FX
getSound()->playLocomotiveSound();
params->param2 = 225 * (4 * rnd(5) + 20);
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
label_processStations:
// Process stations
- TIME_CHECK_CALLBACK_2(kTime1039500, params->param7, 1, setup_savegame, kSavegameTypeTime, kTimeNone);
+ if (getState()->time > kTime1039500 && !params->param7) {
+ params->param7 = 1;
+ setCallback(1);
+ setup_savegame(kSavegameTypeTime, kTimeNone);
+
+ break;
+ }
label_enter_epernay:
// Entering Epernay station
- TIME_CHECK_CALLBACK_2(kTimeEnterEpernay, params->param8, 1, setup_enterStation, "Epernay", kCityEpernay);
+ if (timeCheckEnterStation(kTimeEnterEpernay, params->param8, 1, "Epernay", kCityEpernay))
+ break;
label_exit_epernay:
// Exiting Epernay station
@@ -445,19 +444,23 @@ label_enter_chalons:
goto label_exit_strasbourg;
// Entering Chalons station
- TIME_CHECK_CALLBACK_2(kTimeEnterChalons, CURRENT_PARAM(1, 3), 5, setup_enterStation, "Chalons", kCityChalons);
+ if (timeCheckEnterStation(kTimeEnterChalons, CURRENT_PARAM(1, 3), 5, "Chalons", kCityChalons))
+ break;
label_exit_chalons:
// Exiting Chalons station
- TIME_CHECK_CALLBACK_1(kTimeExitChalons, CURRENT_PARAM(1, 4), 6, setup_exitStation, "Chalons");
+ if (timeCheckExitStation(kTimeExitChalons, CURRENT_PARAM(1, 4), 6, "Chalons"))
+ break;
label_enter_barleduc:
// Entering Bar-Le-Duc station
- TIME_CHECK_CALLBACK_2(kTimeCityBarLeDuc, CURRENT_PARAM(1, 5), 7, setup_enterStation, "BarLeDuc", kCityBarleduc);
+ if (timeCheckEnterStation(kTimeCityBarLeDuc, CURRENT_PARAM(1, 5), 7, "BarLeDuc", kCityBarleduc))
+ break;
label_exit_barleduc:
// Exiting Bar-Le-Duc station
- TIME_CHECK_CALLBACK_1(kTimeExitBarLeDuc, CURRENT_PARAM(1, 6), 8, setup_exitStation, "BarLeDuc");
+ if (timeCheckExitStation(kTimeExitBarLeDuc, CURRENT_PARAM(1, 6), 8, "BarLeDuc"))
+ break;
label_enter_nancy:
if (getState()->time > kTime1260000 && !CURRENT_PARAM(1, 7)) {
@@ -466,50 +469,67 @@ label_enter_nancy:
}
// Entering Nancy station
- TIME_CHECK_CALLBACK_2(kTimeCityNancy, CURRENT_PARAM(1, 8), 9, setup_enterStation, "Nancy", kCityNancy);
+ if (timeCheckEnterStation(kTimeCityNancy, CURRENT_PARAM(1, 8), 9, "Nancy", kCityNancy))
+ break;
label_exit_nancy:
// Exiting Nancy station
- TIME_CHECK_CALLBACK_1(kTimeExitNancy, CURRENT_PARAM(2, 1), 10, setup_exitStation, "Nancy");
+ if (timeCheckExitStation(kTimeExitNancy, CURRENT_PARAM(2, 1), 10, "Nancy"))
+ break;
label_enter_luneville:
// Entering Luneville station
- TIME_CHECK_CALLBACK_2(kTimeCityLuneville, CURRENT_PARAM(2, 2), 11, setup_enterStation, "Luneville", kCityLuneville);
+ if (timeCheckEnterStation(kTimeCityLuneville, CURRENT_PARAM(2, 2), 11, "Luneville", kCityLuneville))
+ break;
label_exit_luneville:
// Exiting Luneville station
- TIME_CHECK_CALLBACK_1(kTimeExitLuneville, CURRENT_PARAM(2, 3), 12, setup_exitStation, "Luneville");
+ if (timeCheckExitStation(kTimeExitLuneville, CURRENT_PARAM(2, 3), 12, "Luneville"))
+ break;
label_enter_avricourt:
// Entering Avricourt station
- TIME_CHECK_CALLBACK_2(kTimeCityAvricourt, CURRENT_PARAM(2, 4), 13, setup_enterStation, "Avricourt", kCityAvricourt);
+ if (timeCheckEnterStation(kTimeCityAvricourt, CURRENT_PARAM(2, 4), 13, "Avricourt", kCityAvricourt))
+ break;
label_exit_avricourt:
// Exiting Avricourt station
- TIME_CHECK_CALLBACK_1(kTimeExitAvricourt, CURRENT_PARAM(2, 5), 14, setup_exitStation, "Avricourt");
+ if (timeCheckExitStation(kTimeExitAvricourt, CURRENT_PARAM(2, 5), 14, "Avricourt"))
+ break;
label_enter_deutschavricourt:
// Entering Deutsch-Avricourt station
- TIME_CHECK_CALLBACK_2(kTimeCityDeutschAvricourt, CURRENT_PARAM(2, 6), 15, setup_enterStation, "DeutschA", kCityDeutschAvricourt);
+ if (timeCheckEnterStation(kTimeCityDeutschAvricourt, CURRENT_PARAM(2, 6), 15, "DeutschA", kCityDeutschAvricourt))
+ break;
label_exit_deutschavricourt:
// Exiting Avricourt station
- TIME_CHECK_CALLBACK_1(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, setup_exitStation, "DeutschA");
+ if (timeCheckExitStation(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, "DeutschA"))
+ break;
label_enter_strasbourg:
- TIME_CHECK_CALLBACK_2(kTimeCityStrasbourg, CURRENT_PARAM(2, 8), 17, setup_savegame, kSavegameTypeTime, kTimeNone);
+ if (getState()->time > kTimeCityStrasbourg && !CURRENT_PARAM(2, 8)) {
+ CURRENT_PARAM(2, 8) = 1;
+ setCallback(17);
+ setup_savegame(kSavegameTypeTime, kTimeNone);
+
+ break;
+ }
label_exit_strasbourg:
// Exiting Strasbourg station
- TIME_CHECK_CALLBACK_1(kTimeExitStrasbourg, CURRENT_PARAM(3, 1), 19, setup_exitStation, "Strasbou");
+ if (timeCheckExitStation(kTimeExitStrasbourg, CURRENT_PARAM(3, 1), 19, "Strasbou"))
+ break;
label_enter_badenoos:
// Entering Baden Oos station
- TIME_CHECK_CALLBACK_2(kTimeCityBadenOos, CURRENT_PARAM(3, 2), 20, setup_enterStation, "BadenOos", kCityBadenOos);
+ if (timeCheckEnterStation(kTimeCityBadenOos, CURRENT_PARAM(3, 2), 20, "BadenOos", kCityBadenOos))
+ break;
label_exit_badenoos:
// Exiting Baden Oos station
- TIME_CHECK_CALLBACK_1(kTimeExitBadenOos, CURRENT_PARAM(3, 3), 21, setup_exitStation, "BadenOos");
+ if (timeCheckExitStation(kTimeExitBadenOos, CURRENT_PARAM(3, 3), 21, "BadenOos"))
+ break;
label_chapter1_next:
if (getState()->time > kTimeChapter1End3 && ! CURRENT_PARAM(3, 4)) {
@@ -524,43 +544,43 @@ label_chapter1_next:
getSavePoints()->push(kEntityChapters, kEntityTrain, kActionTrainStopRunning);
if (getEntityData(kEntityPlayer)->location != kLocationOutsideTrain) {
- PLAY_STEAM();
+ playSteam();
break;
}
if (getEntities()->isOutsideAlexeiWindow()) {
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49);
- PLAY_STEAM();
+ playSteam();
break;
}
if (getEntities()->isOutsideAnnaWindow()) {
getScenes()->loadSceneFromPosition(kCarRedSleeping, 49);
- PLAY_STEAM();
+ playSteam();
break;
}
CarIndex car = getEntityData(kEntityPlayer)->car;
if (car < kCarRedSleeping || car > kCarCoalTender) {
if (car < kCarBaggageRear || car > kCarGreenSleeping) {
- PLAY_STEAM();
+ playSteam();
break;
}
if (getEntities()->isPlayerPosition(kCarGreenSleeping, 98)) {
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 71);
- PLAY_STEAM();
+ playSteam();
break;
}
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 82);
- PLAY_STEAM();
+ playSteam();
break;
}
getScenes()->loadSceneFromPosition(kCarRestaurant, 82);
- PLAY_STEAM();
+ playSteam();
break;
}
@@ -817,7 +837,8 @@ IMPLEMENT_FUNCTION(12, Chapters, chapter2Handler)
if (!getProgress().isTrainRunning)
break;
- UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, params->param1))
+ break;
getSound()->playLocomotiveSound();
@@ -903,15 +924,15 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
case kActionNone:
if (getProgress().isTrainRunning) {
- UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, params->param1)
+ if (Entity::updateParameter(params->param4, getState()->timeTicks, params->param1)) {
getSound()->playLocomotiveSound();
params->param1 = 225 * (4 * rnd(5) + 20);
params->param4 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
- UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, params->param2)
+ if (Entity::updateParameter(params->param5, getState()->timeTicks, params->param2)) {
switch (rnd(2)) {
default:
break;
@@ -927,30 +948,38 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
params->param2 = 225 * (4 * rnd(6) + 8);
params->param5 = 0;
- UPDATE_PARAM_PROC_END
+ }
- TIME_CHECK_CALLBACK_2(kTimeEnterSalzbourg, params->param6, 1, setup_enterStation, "Salzburg", kCitySalzbourg);
+ if (timeCheckEnterStation(kTimeEnterSalzbourg, params->param6, 1, "Salzburg", kCitySalzbourg))
+ break;
label_callback_1:
- TIME_CHECK_CALLBACK_1(kTimeExitSalzbourg, params->param7, 2, setup_exitStation, "Salzburg");
+ if (timeCheckExitStation(kTimeExitSalzbourg, params->param7, 2, "Salzburg"))
+ break;
label_callback_2:
- TIME_CHECK_CALLBACK_2(kTimeEnterAttnangPuchheim, params->param8, 3, setup_enterStation, "Attnang", kCityAttnangPuchheim);
+ if (timeCheckEnterStation(kTimeEnterAttnangPuchheim, params->param8, 3, "Attnang", kCityAttnangPuchheim))
+ break;
label_callback_3:
- TIME_CHECK_CALLBACK_1(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, setup_exitStation, "Attnang");
+ if (timeCheckExitStation(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, "Attnang"))
+ break;
label_callback_4:
- TIME_CHECK_CALLBACK_2(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, setup_enterStation, "Wels", kCityWels);
+ if (timeCheckEnterStation(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, "Wels", kCityWels))
+ break;
label_callback_5:
- TIME_CHECK_CALLBACK_1(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, setup_exitStation, "Wels");
+ if (timeCheckExitStation(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, "Wels"))
+ break;
label_callback_6:
- TIME_CHECK_CALLBACK_2(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, setup_enterStation, "Linz", kCityLinz);
+ if (timeCheckEnterStation(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, "Linz", kCityLinz))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK_1(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, setup_exitStation, "Linz");
+ if (timeCheckExitStation(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, "Linz"))
+ break;
label_callback_8:
if (getState()->time > kTime2187000 && !CURRENT_PARAM(1, 6)) {
@@ -958,7 +987,7 @@ label_callback_8:
getState()->timeDelta = 5;
}
- TIME_CHECK_CALLBACK_2(kTimeCityVienna, CURRENT_PARAM(1, 7), 9, setup_enterStation, "Vienna", kCityVienna);
+ timeCheckEnterStation(kTimeCityVienna, CURRENT_PARAM(1, 7), 9, "Vienna", kCityVienna);
break;
case kActionEndSound:
@@ -1202,15 +1231,15 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
case kActionNone:
if (getProgress().isTrainRunning) {
- UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param4);
+ if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param4)) {
getSound()->playLocomotiveSound();
params->param4 = 225 * (4 * rnd(5) + 20);
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
- UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, params->param5)
+ if (Entity::updateParameter(params->param7, getState()->timeTicks, params->param5)) {
switch (rnd(2)) {
default:
break;
@@ -1226,12 +1255,14 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
params->param5 = 225 * (4 * rnd(6) + 8);
params->param7 = 0;
- UPDATE_PARAM_PROC_END
+ }
- TIME_CHECK_CALLBACK_2(kTimeEnterPoszony, params->param8, 1, setup_enterStation, "Pozsony", kCityPoszony);
+ if (timeCheckEnterStation(kTimeEnterPoszony, params->param8, 1, "Pozsony", kCityPoszony))
+ break;
label_exitPozsony:
- TIME_CHECK_CALLBACK_1(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, setup_exitStation, "Pozsony");
+ if (timeCheckExitStation(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, "Pozsony"))
+ break;
label_enterGalanta:
if (getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1) {
@@ -1244,10 +1275,12 @@ label_enterGalanta:
if (params->param1)
goto label_callback_4;
- TIME_CHECK_CALLBACK_2(kTimeEnterGalanta, CURRENT_PARAM(1, 3), 3, setup_enterStation, "Galanta", kCityGalanta);
+ if (timeCheckEnterStation(kTimeEnterGalanta, CURRENT_PARAM(1, 3), 3, "Galanta", kCityGalanta))
+ break;
label_exitGalanta:
- TIME_CHECK_CALLBACK_1(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, setup_exitStation, "Galanta");
+ if (timeCheckExitStation(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, "Galanta"))
+ break;
label_callback_4:
if (getState()->time > kTime2470500 && !CURRENT_PARAM(1, 5)) {
@@ -1280,43 +1313,43 @@ label_callback_4:
getSavePoints()->push(kEntityChapters, kEntityTrain, kActionTrainStopRunning);
if (getEntityData(kEntityPlayer)->location != kLocationOutsideTrain) {
- PLAY_STEAM();
+ playSteam();
break;
}
if (getEntities()->isOutsideAlexeiWindow()) {
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49);
- PLAY_STEAM();
+ playSteam();
break;
}
if (getEntities()->isOutsideAnnaWindow()) {
getScenes()->loadSceneFromPosition(kCarRedSleeping, 49);
- PLAY_STEAM();
+ playSteam();
break;
}
CarIndex car = getEntityData(kEntityPlayer)->car;
if (car < kCarRedSleeping || car > kCarCoalTender) {
if (car < kCarBaggageRear || car > kCarGreenSleeping) {
- PLAY_STEAM();
+ playSteam();
break;
}
if (getEntities()->isPlayerPosition(kCarGreenSleeping, 98)) {
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 71);
- PLAY_STEAM();
+ playSteam();
break;
}
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 82);
- PLAY_STEAM();
+ playSteam();
break;
}
getScenes()->loadSceneFromPosition(kCarRestaurant, 82);
- PLAY_STEAM();
+ playSteam();
break;
}
@@ -1805,7 +1838,7 @@ void Chapters::enterExitHelper(bool isEnteringStation) {
getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
getObjects()->update(kObjectHandleOutsideRight, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
- getProgress().isTrainRunning = isEnteringStation ? false : true;
+ getProgress().isTrainRunning = !isEnteringStation;
if (isEnteringStation) {
ENTITY_PARAM(0, 2) = 1;
@@ -1815,7 +1848,37 @@ void Chapters::enterExitHelper(bool isEnteringStation) {
ENTITY_PARAM(0, 3) = 1;
}
- CALLBACK_ACTION();
+ callbackAction();
+}
+
+void Chapters::playSteam() const {
+ getSoundQueue()->resetState();
+ getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4));
+ ENTITY_PARAM(0, 2) = 0;
+}
+
+bool Chapters::timeCheckEnterStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence, CityIndex cityIndex) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ setup_enterStation(sequence, cityIndex);
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Chapters::timeCheckExitStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ setup_exitStation(sequence);
+
+ return true;
+ }
+
+ return false;
}
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/chapters.h b/engines/lastexpress/entities/chapters.h
index 353d3a6b5b..fb52ea3ee4 100644
--- a/engines/lastexpress/entities/chapters.h
+++ b/engines/lastexpress/entities/chapters.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_CHAPTERS_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -154,8 +153,11 @@ public:
DECLARE_FUNCTION(chapter5Handler)
private:
+ bool timeCheckEnterStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence, CityIndex cityIndex);
+ bool timeCheckExitStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence);
void enterExitStation(const SavePoint &savepoint, bool isEnteringStation);
void enterExitHelper(bool isEnteringStation);
+ void playSteam() const;
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/cooks.cpp b/engines/lastexpress/entities/cooks.cpp
index 42e888cc7c..5e8a2df8cb 100644
--- a/engines/lastexpress/entities/cooks.cpp
+++ b/engines/lastexpress/entities/cooks.cpp
@@ -29,9 +29,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -96,7 +94,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3)
case kActionDrawScene:
if (!getEntities()->isInKitchen(kEntityPlayer)) {
getEntities()->clearSequences(kEntityCooks);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -108,7 +106,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3)
if (!getEntities()->hasValidFrame(kEntityCooks)) {
getSound()->playSound(kEntityCooks, "LIB015");
getEntities()->clearSequences(kEntityCooks);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -122,7 +120,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3)
if (params->param1 && !getEntities()->hasValidFrame(kEntityCooks)) {
getSound()->playSound(kEntityCooks, "LIB015");
getEntities()->clearSequences(kEntityCooks);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -182,7 +180,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4)
case kActionDrawScene:
if (!getEntities()->isInKitchen(kEntityPlayer)) {
getEntities()->clearSequences(kEntityCooks);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -194,7 +192,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4)
if (!getEntities()->hasValidFrame(kEntityCooks)) {
getSound()->playSound(kEntityCooks, "LIB015");
getEntities()->clearSequences(kEntityCooks);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -208,7 +206,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4)
if (params->param1 && !getEntities()->hasValidFrame(kEntityCooks)) {
getSound()->playSound(kEntityCooks, "LIB015");
getEntities()->clearSequences(kEntityCooks);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -241,7 +239,7 @@ IMPLEMENT_FUNCTION(5, Cooks, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Cooks, setup_chapter1Handler));
break;
case kActionDefault:
@@ -262,7 +260,8 @@ IMPLEMENT_FUNCTION(6, Cooks, chapter1Handler)
break;
case kActionNone:
- UPDATE_PARAM(params->param4, getState()->time, params->param2);
+ if (!Entity::updateParameter(params->param4, getState()->time, params->param2))
+ break;
// Broken plate sound
getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks));
@@ -375,7 +374,8 @@ IMPLEMENT_FUNCTION(9, Cooks, chapter2Handler)
break;
case kActionNone:
- UPDATE_PARAM(params->param3, getState()->time, params->param1);
+ if (!Entity::updateParameter(params->param3, getState()->time, params->param1))
+ break;
// Broken plate sound
getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks));
@@ -434,12 +434,12 @@ IMPLEMENT_FUNCTION(11, Cooks, chapter3Handler)
break;
case kActionNone:
- UPDATE_PARAM_PROC(params->param4, getState()->time, params->param2)
+ if (Entity::updateParameter(params->param4, getState()->time, params->param2)) {
// Broken plate sound
getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks));
params->param2 = 225 * (4 * rnd(30) + 120);
params->param4 = 0;
- UPDATE_PARAM_PROC_END
+ }
if (getState()->time > kTime2079000 && !params->param5) {
params->param1 = 0;
@@ -526,7 +526,8 @@ IMPLEMENT_FUNCTION(13, Cooks, chapter4Handler)
break;
case kActionNone:
- UPDATE_PARAM(params->param3, getState()->time, params->param1)
+ if (!Entity::updateParameter(params->param3, getState()->time, params->param1))
+ break;
// Broken plate sound
getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks));
diff --git a/engines/lastexpress/entities/cooks.h b/engines/lastexpress/entities/cooks.h
index 3ab7d35161..f01d0b2ca0 100644
--- a/engines/lastexpress/entities/cooks.h
+++ b/engines/lastexpress/entities/cooks.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_COOKS_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index c3e7e37b88..b604277903 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -32,22 +32,11 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
-#define SAVEGAME_BLOOD_JACKET() \
- if (getProgress().jacket == kJacketBlood \
- && getEntities()->isDistanceBetweenEntities(kEntityCoudert, kEntityPlayer, 1000) \
- && !getEntities()->isInsideCompartments(kEntityPlayer) \
- && !getEntities()->checkFields10(kEntityPlayer)) { \
- setCallback(1); \
- setup_savegame(kSavegameTypeEvent, kEventMertensBloodJacket); \
- }
-
Coudert::Coudert(LastExpressEngine *engine) : Entity(engine, kEntityCoudert) {
ADD_CALLBACK_FUNCTION(Coudert, reset);
ADD_CALLBACK_FUNCTION(Coudert, bloodJacket);
@@ -126,11 +115,11 @@ IMPLEMENT_FUNCTION_S(2, Coudert, bloodJacket)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -153,7 +142,7 @@ IMPLEMENT_FUNCTION_SI(3, Coudert, enterExitCompartment, ObjectIndex)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
return;
case kActionCallback:
@@ -175,15 +164,15 @@ IMPLEMENT_FUNCTION(4, Coudert, callbackActionOnDirection)
case kActionNone:
if (getData()->direction != kDirectionRight) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -202,7 +191,7 @@ IMPLEMENT_FUNCTION_SIII(5, Coudert, enterExitCompartment2, ObjectIndex, EntityPo
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
return;
case kActionCallback:
@@ -223,11 +212,11 @@ IMPLEMENT_FUNCTION_S(6, Coudert, playSound)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -252,11 +241,11 @@ IMPLEMENT_FUNCTION_NOSETUP(7, Coudert, playSound16)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -296,7 +285,7 @@ IMPLEMENT_FUNCTION_II(9, Coudert, updateEntity, CarIndex, EntityPosition)
if (getEntities()->updateEntity(kEntityCoudert, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -332,7 +321,7 @@ IMPLEMENT_FUNCTION_II(9, Coudert, updateEntity, CarIndex, EntityPosition)
params->param3 = kItemInvalid;
if (getEntities()->updateEntity(kEntityCoudert, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -365,11 +354,12 @@ IMPLEMENT_FUNCTION_I(10, Coudert, updateFromTime, uint32)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
- UPDATE_PARAM(params->param2, getState()->time, params->param1);
+ if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+ break;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -388,11 +378,12 @@ IMPLEMENT_FUNCTION_I(11, Coudert, updateFromTicks, uint32)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
- UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, params->param1))
+ break;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -412,7 +403,7 @@ IMPLEMENT_FUNCTION_I(12, Coudert, excuseMe, EntityIndex)
return;
if (getSoundQueue()->isBuffered(kEntityCoudert)) {
- CALLBACK_ACTION();
+ callbackAction();
return;
}
@@ -452,7 +443,7 @@ IMPLEMENT_FUNCTION_I(12, Coudert, excuseMe, EntityIndex)
getSound()->playSound(kEntityCoudert, "JAC1112E");
}
- CALLBACK_ACTION();
+ callbackAction();
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -462,7 +453,7 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
if (!params->param2 && !params->param3) {
@@ -487,7 +478,8 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex)
}
}
- UPDATE_PARAM(params->param5, getState()->timeTicks, 225);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 225))
+ break;
getData()->inventoryItem = kItemNone;
setCallback(5);
@@ -561,7 +553,7 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex)
case 5:
case 6:
case 7:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 9:
@@ -584,7 +576,7 @@ IMPLEMENT_FUNCTION_I(14, Coudert, function14, EntityIndex)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionDefault:
@@ -629,7 +621,7 @@ IMPLEMENT_FUNCTION_I(14, Coudert, function14, EntityIndex)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -706,7 +698,7 @@ IMPLEMENT_FUNCTION_I(15, Coudert, function15, bool)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -724,7 +716,7 @@ IMPLEMENT_FUNCTION(16, Coudert, function16)
ENTITY_PARAM(2, 1) = 0;
getInventory()->setLocationAndProcess(kItem5, kObjectLocation1);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -743,7 +735,7 @@ IMPLEMENT_FUNCTION(16, Coudert, function16)
if (!getEntities()->isPlayerPosition(kCarRedSleeping, 2))
getData()->entityPosition = kPosition_2088;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -761,7 +753,7 @@ IMPLEMENT_FUNCTION_I(17, Coudert, function17, bool)
if (ENTITY_PARAM(2, 1)) {
ENTITY_PARAM(2, 1) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -789,7 +781,7 @@ IMPLEMENT_FUNCTION_I(17, Coudert, function17, bool)
case 1:
case 2:
case 3:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -817,7 +809,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18)
getEntities()->drawSequenceLeft(kEntityCoudert, "627K");
getScenes()->loadSceneFromItemPosition(kItem5);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -849,7 +841,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18)
break;
case 2:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -857,7 +849,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18)
ENTITY_PARAM(0, 1) = 0;
getSavePoints()->push(kEntityCoudert, kEntityCoudert, kActionDrawScene);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -876,14 +868,14 @@ IMPLEMENT_FUNCTION_I(19, Coudert, function19, bool)
|| ENTITY_PARAM(2, 4) || ENTITY_PARAM(2, 6)) {
getInventory()->setLocationAndProcess(kItem5, kObjectLocation1);
ENTITY_PARAM(2, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (ENTITY_PARAM(0, 3) || ENTITY_PARAM(0, 5) || ENTITY_PARAM(0, 4)) {
getScenes()->loadSceneFromItemPosition(kItem5);
ENTITY_PARAM(2, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -903,7 +895,7 @@ IMPLEMENT_FUNCTION_I(19, Coudert, function19, bool)
getEntities()->drawSequenceLeft(kEntityCoudert, ENTITY_PARAM(0, 2) ? "627B" : "627E");
ENTITY_PARAM(0, 1) = 0;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -916,11 +908,12 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex)
break;
case kActionNone:
- UPDATE_PARAM_PROC(CURRENT_PARAM(1, 3), getState()->time, 300)
+ if (Entity::updateParameter(CURRENT_PARAM(1, 3), getState()->time, 300)) {
getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityCoudert));
- UPDATE_PARAM_PROC_END
+ }
- UPDATE_PARAM(CURRENT_PARAM(1, 4), getState()->time, 900);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 900))
+ break;
getObjects()->updateLocation2((ObjectIndex)params->param1, kObjectLocation1);
@@ -930,7 +923,7 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex)
if (params->param2)
getObjects()->update((ObjectIndex)params->param2, (EntityIndex)params->param7, (ObjectLocation)params->param8, (CursorStyle)CURRENT_PARAM(1, 1), (CursorStyle)CURRENT_PARAM(1, 2));
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionKnock:
@@ -999,7 +992,8 @@ IMPLEMENT_FUNCTION(21, Coudert, function21)
case kActionNone:
if (!params->param1) {
- UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+ break;
setCallback(3);
setup_enterExitCompartment("627Zh", kObjectCompartmentH);
@@ -1044,7 +1038,7 @@ IMPLEMENT_FUNCTION(21, Coudert, function21)
case 5:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1073,7 +1067,7 @@ IMPLEMENT_FUNCTION(21, Coudert, function21)
getData()->location = kLocationOutsideCompartment;
getSavePoints()->push(kEntityCoudert, kEntityIvo, kAction123852928);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1100,7 +1094,8 @@ IMPLEMENT_FUNCTION(22, Coudert, function22)
case kActionNone:
if (!params->param1) {
- UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+ break;
setCallback(3);
setup_enterExitCompartment("627Rg", kObjectCompartmentG);
@@ -1145,7 +1140,7 @@ IMPLEMENT_FUNCTION(22, Coudert, function22)
case 5:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1174,7 +1169,7 @@ IMPLEMENT_FUNCTION(22, Coudert, function22)
getData()->location = kLocationOutsideCompartment;
getSavePoints()->push(kEntityCoudert, kEntityMilos, kAction123852928);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1225,7 +1220,7 @@ IMPLEMENT_FUNCTION(23, Coudert, function23)
case 3:
getEntities()->exitCompartment(kEntityCoudert, kObjectCompartmentF, true);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1296,7 +1291,7 @@ IMPLEMENT_FUNCTION(25, Coudert, function25)
getData()->location = kLocationOutsideCompartment;
getSavePoints()->push(kEntityCoudert, kEntityRebecca, kAction123852928);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1311,7 +1306,8 @@ IMPLEMENT_FUNCTION(26, Coudert, function26)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+ break;
setCallback(3);
setup_enterExitCompartment2("627Zd", kObjectCompartmentD, kPosition_5790, kPosition_6130);
@@ -1357,7 +1353,7 @@ IMPLEMENT_FUNCTION(26, Coudert, function26)
case 5:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1375,7 +1371,7 @@ IMPLEMENT_FUNCTION(26, Coudert, function26)
getData()->location = kLocationOutsideCompartment;
getSavePoints()->push(kEntityCoudert, kEntityMmeBoutarel, kAction123852928);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1402,7 +1398,8 @@ IMPLEMENT_FUNCTION(27, Coudert, function27)
case kActionNone:
if (!params->param1) {
- UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+ break;
setCallback(3);
setup_enterExitCompartment2("627Rc", kObjectCompartmentC, kPosition_6470, kPosition_6130);
@@ -1446,7 +1443,7 @@ IMPLEMENT_FUNCTION(27, Coudert, function27)
case 5:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1473,7 +1470,7 @@ IMPLEMENT_FUNCTION(27, Coudert, function27)
getData()->location = kLocationOutsideCompartment;
getSavePoints()->push(kEntityCoudert, kEntityBoutarel, kAction123852928);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1515,7 +1512,7 @@ IMPLEMENT_FUNCTION_I(30, Coudert, function30, ObjectIndex)
case kActionDefault:
switch (parameters->param1) {
default:
- CALLBACK_ACTION();
+ callbackAction();
// Stop processing here
return;
@@ -1615,7 +1612,7 @@ IMPLEMENT_FUNCTION_I(30, Coudert, function30, ObjectIndex)
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1654,7 +1651,7 @@ IMPLEMENT_FUNCTION_I(31, Coudert, function31, uint32)
case 2:
case 3:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1699,7 +1696,7 @@ IMPLEMENT_FUNCTION(32, Coudert, function32)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1726,7 +1723,7 @@ IMPLEMENT_FUNCTION(33, Coudert, function33)
setup_updateEntity(kCarRedSleeping, kPosition_540);
}
} else {
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -1763,7 +1760,7 @@ IMPLEMENT_FUNCTION(33, Coudert, function33)
case 4:
ENTITY_PARAM(2, 6) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 5:
@@ -1808,7 +1805,7 @@ IMPLEMENT_FUNCTION(33, Coudert, function33)
case 10:
ENTITY_PARAM(2, 6) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1882,7 +1879,7 @@ IMPLEMENT_FUNCTION_I(34, Coudert, function34, bool)
break;
case 7:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1902,7 +1899,8 @@ IMPLEMENT_FUNCTION_I(35, Coudert, function35, bool)
getScenes()->loadSceneFromPosition(kCarRestaurant, 65);
}
- UPDATE_PARAM(params->param2, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param2, getState()->time, 2700))
+ break;
getSavePoints()->push(kEntityCoudert, kEntityMax, kActionMaxFreeFromCage);
@@ -1951,7 +1949,7 @@ IMPLEMENT_FUNCTION_I(35, Coudert, function35, bool)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1965,7 +1963,7 @@ IMPLEMENT_FUNCTION(36, Coudert, chapter1)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTimeChapter1, params->param1, 1, setup_chapter1Handler)
+ Entity::timeCheckCallback(kTimeChapter1, params->param1, 1, WRAP_SETUP_FUNCTION(Coudert, setup_chapter1Handler));
break;
case kActionDefault:
@@ -2174,7 +2172,7 @@ IMPLEMENT_FUNCTION(39, Coudert, function39)
getSavePoints()->push(kEntityCoudert, kEntityVerges, kAction167854368);
ENTITY_PARAM(2, 2) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2283,22 +2281,22 @@ label_callback_9:
label_callback_10:
if (getState()->time > kTime1189800 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 2700);
+ if (Entity::updateParameter(params->param3, getState()->time, 2700)) {
ENTITY_PARAM(0, 2) = 1;
ENTITY_PARAM(0, 1) = 1;
getEntities()->drawSequenceLeft(kEntityCoudert, "697F");
params->param3 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (!ENTITY_PARAM(0, 2))
break;
- TIME_CHECK_OBJECT(kTime1107000, params->param4, kObject111, kObjectLocation2);
- TIME_CHECK_OBJECT(kTime1161000, params->param5, kObject111, kObjectLocation3);
- TIME_CHECK_OBJECT(kTime1206000, params->param6, kObject111, kObjectLocation4);
+ timeCheckObject(kTime1107000, params->param4, kObject111, kObjectLocation2);
+ timeCheckObject(kTime1161000, params->param5, kObject111, kObjectLocation3);
+ timeCheckObject(kTime1206000, params->param6, kObject111, kObjectLocation4);
break;
case kAction1:
@@ -2536,7 +2534,7 @@ IMPLEMENT_FUNCTION(41, Coudert, function41)
case 18:
getSavePoints()->push(kEntityCoudert, kEntityMilos, kAction208228224);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2827,28 +2825,34 @@ label_callback_12:
}
label_callback_13:
- TIME_CHECK_CALLBACK(kTime2088900, params->param1, 14, setup_function32);
+ if (Entity::timeCheckCallback(kTime2088900, params->param1, 14, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_14:
- TIME_CHECK_CALLBACK(kTime2119500, params->param2, 15, setup_function32);
+ if (Entity::timeCheckCallback(kTime2119500, params->param2, 15, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_15:
- TIME_CHECK_CALLBACK(kTime2138400, params->param3, 16, setup_function32);
+ if (Entity::timeCheckCallback(kTime2138400, params->param3, 16, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_16:
- TIME_CHECK_CALLBACK(kTime2147400, params->param4, 17, setup_function32);
+ if (Entity::timeCheckCallback(kTime2147400, params->param4, 17, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_17:
- TIME_CHECK_CALLBACK(kTime2160000, params->param5, 18, setup_function32);
+ if (Entity::timeCheckCallback(kTime2160000, params->param5, 18, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_18:
- TIME_CHECK_CALLBACK(kTime2205000, params->param6, 19, setup_function32);
+ if (Entity::timeCheckCallback(kTime2205000, params->param6, 19, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_19:
if (ENTITY_PARAM(0, 2)) {
- TIME_CHECK_OBJECT(kTime2025000, params->param7, kObject111, kObjectLocation7);
- TIME_CHECK_OBJECT(kTime2133000, params->param8, kObject111, kObjectLocation8);
- TIME_CHECK_OBJECT(kTime2173500, CURRENT_PARAM(1, 1), kObject111, kObjectLocation9);
+ timeCheckObject(kTime2025000, params->param7, kObject111, kObjectLocation7);
+ timeCheckObject(kTime2133000, params->param8, kObject111, kObjectLocation8);
+ timeCheckObject(kTime2173500, CURRENT_PARAM(1, 1), kObject111, kObjectLocation9);
}
break;
@@ -3051,7 +3055,7 @@ IMPLEMENT_FUNCTION(46, Coudert, function46)
break;
case 11:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3116,7 +3120,7 @@ IMPLEMENT_FUNCTION_I(47, Coudert, function47, bool)
break;
case 7:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3164,7 +3168,7 @@ IMPLEMENT_FUNCTION(48, Coudert, function48)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3261,7 +3265,7 @@ IMPLEMENT_FUNCTION(49, Coudert, function49)
break;
case 11:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3347,7 +3351,7 @@ IMPLEMENT_FUNCTION(50, Coudert, function50)
break;
case 9:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3541,11 +3545,11 @@ label_callback_1:
params->param2 = (uint)(getState()->time + 4500);
if (params->param3 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)
+ if (Entity::updateParameterTime((TimeValue)params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)) {
setCallback(2);
setup_function55();
break;
- UPDATE_PARAM_PROC_END
+ }
}
}
@@ -3558,18 +3562,22 @@ label_callback_2:
label_callback_3:
if (!params->param1) {
- TIME_CHECK_CALLBACK(kTime2394000, params->param4, 4, setup_function56);
+ if (Entity::timeCheckCallback(kTime2394000, params->param4, 4, WRAP_SETUP_FUNCTION(Coudert, setup_function56)))
+ break;
label_callback_4:
- TIME_CHECK_CALLBACK(kTime2434500, params->param5, 5, setup_function32);
+ if (Entity::timeCheckCallback(kTime2434500, params->param5, 5, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
label_callback_5:
- TIME_CHECK_CALLBACK(kTime2448000, params->param6, 6, setup_function32);
+ if (Entity::timeCheckCallback(kTime2448000, params->param6, 6, WRAP_SETUP_FUNCTION(Coudert, setup_function32)))
+ break;
}
label_callback_6:
if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
- UPDATE_PARAM(params->param7, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param7, getState()->time, 2700))
+ break;
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 1) = 1;
@@ -3696,7 +3704,7 @@ IMPLEMENT_FUNCTION(54, Coudert, function54)
break;
case 3:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3764,7 +3772,7 @@ IMPLEMENT_FUNCTION(55, Coudert, function55)
break;
case 7:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3868,7 +3876,7 @@ IMPLEMENT_FUNCTION(56, Coudert, function56)
break;
case 16:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -4034,7 +4042,8 @@ IMPLEMENT_FUNCTION(62, Coudert, function62)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
@@ -4168,7 +4177,7 @@ void Coudert::visitCompartment(const SavePoint &savepoint, EntityPosition positi
case 6:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
diff --git a/engines/lastexpress/entities/coudert.h b/engines/lastexpress/entities/coudert.h
index 45d13ce9bb..8303c80a32 100644
--- a/engines/lastexpress/entities/coudert.h
+++ b/engines/lastexpress/entities/coudert.h
@@ -24,8 +24,6 @@
#define LASTEXPRESS_COUDERT_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
-
namespace LastExpress {
class LastExpressEngine;
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index e136ca4776..dad5e67392 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -22,22 +22,17 @@
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
-
#include "lastexpress/data/sequence.h"
#include "lastexpress/game/action.h"
#include "lastexpress/game/entities.h"
#include "lastexpress/game/logic.h"
-#include "lastexpress/game/scenes.h"
-#include "lastexpress/game/state.h"
+#include "lastexpress/game/object.h"
#include "lastexpress/game/savegame.h"
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
+#include "lastexpress/game/scenes.h"
-#include "lastexpress/sound/sound.h"
-
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -55,6 +50,19 @@ EntityData::EntityCallData::~EntityCallData() {
SAFE_DELETE(sequence3);
}
+void EntityData::EntityCallData::syncString(Common::Serializer &s, Common::String &string, uint length) const {
+ char seqName[13];
+ memset(&seqName, 0, length);
+
+ if (s.isSaving())
+ strcpy((char *)&seqName, string.c_str());
+
+ s.syncBytes((byte *)&seqName, length);
+
+ if (s.isLoading())
+ string = seqName;
+}
+
void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) {
for (uint i = 0; i < ARRAYSIZE(callbacks); i++)
s.syncAsByte(callbacks[i]);
@@ -81,23 +89,19 @@ void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsByte(directionSwitch);
// Sync strings
-#define SYNC_STRING(varName, count) { \
- char seqName[13]; \
- memset(&seqName, 0, count); \
- if (s.isSaving()) strcpy((char *)&seqName, varName.c_str()); \
- s.syncBytes((byte *)&seqName, count); \
- if (s.isLoading()) varName = seqName; \
-}
-
- SYNC_STRING(sequenceName, 13);
- SYNC_STRING(sequenceName2, 13);
- SYNC_STRING(sequenceNamePrefix, 7);
- SYNC_STRING(sequenceNameCopy, 13);
-
-#undef SYNC_STRING
+ syncString(s, sequenceName, 13);
+ syncString(s, sequenceName2, 13);
+ syncString(s, sequenceNamePrefix, 7);
+ syncString(s, sequenceNameCopy, 13);
// Skip pointers to frame & sequences
- s.skip(5 * 4);
+ // (we are using a compressed stream, so we cannot seek on load)
+ if (s.isLoading()) {
+ byte empty[5 * 4];
+ s.syncBytes(empty, 5 * 4);
+ } else {
+ s.skip(5 * 4);
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -113,7 +117,7 @@ EntityData::EntityParameters *EntityData::getParameters(uint callback, byte inde
return _parameters[callback].parameters[index];
}
-int EntityData::getCallback(uint callback) const {
+byte EntityData::getCallback(uint callback) const {
if (callback >= 16)
error("[EntityData::getCallback] Invalid callback value (was: %d, max: 16)", callback);
@@ -246,16 +250,38 @@ void Entity::savegame(const SavePoint &savepoint) {
break;
case kActionNone:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
getSaveLoad()->saveGame((SavegameType)params->param1, _entityIndex, (EventIndex)params->param2);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
+void Entity::savegameBloodJacket() {
+ if (getProgress().jacket == kJacketBlood
+ && getEntities()->isDistanceBetweenEntities(_entityIndex, kEntityPlayer, 1000)
+ && !getEntities()->isInsideCompartments(kEntityPlayer)
+ && !getEntities()->checkFields10(kEntityPlayer)) {
+ setCallback(1);
+
+ switch (_entityIndex) {
+ default:
+ break;
+
+ case kEntityCoudert:
+ setup_savegame(kSavegameTypeEvent, kEventCoudertBloodJacket);
+ break;
+
+ case kEntityMertens:
+ setup_savegame(kSavegameTypeEvent, kEventCoudertBloodJacket);
+ break;
+ }
+ }
+}
+
void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag flag) {
EXPOSE_PARAMS(EntityData::EntityParametersSIIS)
@@ -264,7 +290,7 @@ void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag fla
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -284,7 +310,7 @@ void Entity::draw(const SavePoint &savepoint, bool handleExcuseMe) {
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -308,7 +334,7 @@ void Entity::draw2(const SavePoint &savepoint) {
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -326,8 +352,10 @@ void Entity::updateFromTicks(const SavePoint &savepoint) {
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1)
- CALLBACK_ACTION();
+ if (Entity::updateParameter(params->param2, getState()->timeTicks, params->param1))
+ break;
+
+ callbackAction();
break;
}
}
@@ -340,8 +368,10 @@ void Entity::updateFromTime(const SavePoint &savepoint) {
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->time, params->param1)
- CALLBACK_ACTION();
+ if (Entity::updateParameter(params->param2, getState()->time, params->param1))
+ break;
+
+ callbackAction();
break;
}
}
@@ -352,12 +382,12 @@ void Entity::callbackActionOnDirection(const SavePoint &savepoint) {
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
if (getData()->direction != kDirectionRight)
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -370,7 +400,7 @@ void Entity::callbackActionRestaurantOrSalon(const SavePoint &savepoint) {
case kActionNone:
case kActionDefault:
if (getEntities()->isSomebodyInsideRestaurantOrSalon())
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -395,7 +425,7 @@ void Entity::updateEntity(const SavePoint &savepoint, bool handleExcuseMe) {
case kActionNone:
case kActionDefault:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -410,7 +440,7 @@ void Entity::callSavepoint(const SavePoint &savepoint, bool handleExcuseMe) {
case kActionExitCompartment:
if (!CURRENT_PARAM(1, 1))
getSavePoints()->call(_entityIndex, (EntityIndex)params->param4, (ActionIndex)params->param5, (char *)&params->seq2);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -448,7 +478,7 @@ void Entity::enterExitCompartment(const SavePoint &savepoint, EntityPosition pos
if (updateLocation)
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -468,6 +498,74 @@ void Entity::enterExitCompartment(const SavePoint &savepoint, EntityPosition pos
}
}
+void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo) {
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionDefault:
+ getData()->entityPosition = positionFrom;
+ setCallback(1);
+ setup_enterExitCompartment(sequenceFrom.c_str(), compartmentFrom);
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ setCallback(2);
+ setup_enterExitCompartment(sequenceTo.c_str(), compartmentFrom);
+ break;
+
+ case 2:
+ getData()->entityPosition = positionFrom;
+ getEntities()->clearSequences(_entityIndex);
+ callbackAction();
+ break;
+ }
+ break;
+ }
+}
+
+void Entity::goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo) {
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionDefault:
+ getData()->entityPosition = positionFrom;
+ getData()->location = kLocationOutsideCompartment;
+ setCallback(1);
+ setup_enterExitCompartment(sequenceFrom.c_str(), compartmentFrom);
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ setCallback(2);
+ setup_updateEntity(kCarGreenSleeping, positionTo);
+ break;
+
+ case 2:
+ setCallback(3);
+ setup_enterExitCompartment(sequenceTo.c_str(), compartmentTo);
+ break;
+
+ case 3:
+ getData()->location = kLocationInsideCompartment;
+ getEntities()->clearSequences(_entityIndex);
+ callbackAction();
+ break;
+ }
+ break;
+ }
+}
+
void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) {
EXPOSE_PARAMS(EntityData::EntityParametersSIII)
@@ -477,7 +575,7 @@ void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) {
case kActionExitCompartment:
getEntities()->updatePositionExit(_entityIndex, (CarIndex)params->param4, (Position)params->param5);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -494,4 +592,385 @@ void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) {
}
}
+void Entity::callbackAction() {
+ if (getData()->currentCall == 0)
+ error("[Entity::callbackAction] currentCall is already 0, cannot proceed");
+
+ getData()->currentCall--;
+
+ getSavePoints()->setCallback(_entityIndex, _callbacks[_data->getCurrentCallback()]);
+
+ getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback);
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Setup functions
+//////////////////////////////////////////////////////////////////////////
+void Entity::setup(const char *name, uint index) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s()", name);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupI(const char *name, uint index, uint param1) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u)", name, param1);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+ EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters();
+ params->param1 = (unsigned int)param1;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupII(const char *name, uint index, uint param1, uint param2) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u)", name, param1, param2);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+ EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters();
+ params->param1 = param1;
+ params->param2 = param2;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupIII(const char *name, uint index, uint param1, uint param2, uint param3) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %u)", name, param1, param2, param3);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+ EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters();
+ params->param1 = param1;
+ params->param2 = param2;
+ params->param3 = param3;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupS(const char *name, uint index, const char *seq1) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s)", name, seq1);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+ EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters();
+ strncpy(params->seq1, seq1, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSS(const char *name, uint index, const char *seq1, const char *seq2) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s)", name, seq1, seq2);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSSII>();
+
+ EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters();
+ strncpy(params->seq1, seq1, 12);
+ strncpy(params->seq2, seq2, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSI(const char *name, uint index, const char *seq1, uint param4) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u)", name, seq1, param4);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+ EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters();
+ strncpy(params->seq1, seq1, 12);
+ params->param4 = param4;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSII(const char *name, uint index, const char *seq1, uint param4, uint param5) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u)", name, seq1, param4, param5);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+ EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters();
+ strncpy(params->seq1, seq1, 12);
+ params->param4 = param4;
+ params->param5 = param5;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSIII(const char *name, uint index, const char *seq, uint param4, uint param5, uint param6) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u, %u)", name, seq, param4, param5, param6);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSIII>();
+
+ EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII *)_data->getCurrentParameters();
+ strncpy(params->seq, seq, 12);
+ params->param4 = param4;
+ params->param5 = param5;
+ params->param6 = param6;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSIIS(const char *name, uint index, const char *seq1, uint param4, uint param5, const char *seq2) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u, %s)", name, seq1, param4, param5, seq2);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+ EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters();
+ strncpy(params->seq1, seq1, 12);
+ params->param4 = param4;
+ params->param5 = param5;
+ strncpy(params->seq2, seq2, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSSI(const char *name, uint index, const char *seq1, const char *seq2, uint param7) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s, %u)", name, seq1, seq2, param7);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersSSII>();
+
+ EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII *)_data->getCurrentParameters();
+ strncpy(params->seq1, seq1, 12);
+ strncpy(params->seq2, seq2, 12);
+ params->param7 = param7;
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupIS(const char *name, uint index, uint param1, const char *seq) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %s)", name, param1, seq);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersISII>();
+
+ EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII *)_data->getCurrentParameters();
+ params->param1 = (unsigned int)param1;
+ strncpy(params->seq, seq, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupISS(const char *name, uint index, uint param1, const char *seq1, const char *seq2) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %s, %s)", name, param1, seq1, seq2);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersISSI>();
+
+ EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI *)_data->getCurrentParameters();
+ params->param1 = param1;
+ strncpy(params->seq1, seq1, 12);
+ strncpy(params->seq2, seq2, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupIIS(const char *name, uint index, uint param1, uint param2, const char *seq) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %s)", name, param1, param2, seq);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersIISI>();
+
+ EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI *)_data->getCurrentParameters();
+ params->param1 = param1;
+ params->param2 = param2;
+ strncpy(params->seq, seq, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupIISS(const char *name, uint index, uint param1, uint param2, const char *seq1, const char *seq2) {
+ debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %s, %s)", name, param1, param2, seq1, seq2);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+ _data->setCurrentCallback(index);
+ _data->resetCurrentParameters<EntityData::EntityParametersIISS>();
+
+ EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS *)_data->getCurrentParameters();
+ params->param1 = param1;
+ params->param2 = param2;
+ strncpy(params->seq1, seq1, 12);
+ strncpy(params->seq2, seq2, 12);
+
+ _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Helper functions
+//////////////////////////////////////////////////////////////////////////
+
+bool Entity::updateParameter(uint &parameter, uint timeType, uint delta) const {
+ if (!parameter)
+ parameter = (uint)(timeType + delta);
+
+ if (parameter >= timeType)
+ return false;
+
+ parameter = kTimeInvalid;
+
+ return true;
+}
+
+bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta) const {
+ if (getState()->time <= timeValue) {
+ if (check || !parameter)
+ parameter = (uint)(getState()->time + delta);
+ }
+
+ if (parameter >= getState()->time && getState()->time <= timeValue)
+ return false;
+
+ parameter = kTimeInvalid;
+
+ return true;
+}
+
+bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) const {
+ if (parameter && parameter >= timeType)
+ return false;
+
+ if (!parameter)
+ parameter = (uint)(timeType + delta);
+
+ return true;
+}
+
+bool Entity::timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function) const {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ (*function)();
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ (*function)();
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, const char *str, Common::Functor1<const char *, void> *function) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ (*function)(str);
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, bool check, Common::Functor1<bool, void> *function) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ (*function)(check);
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Entity::timeCheckCallbackInventory(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ getData()->inventoryItem = kItemNone;
+ setCallback(callback);
+ (*function)();
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Entity::timeCheckCar(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function) {
+ if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter)
+ parameter = (uint)getState()->time + 75;
+
+ if (getState()->time > timeValue || parameter < getState()->time) {
+ parameter = kTimeInvalid;
+ setCallback(callback);
+ (*function)();
+
+ return true;
+ }
+
+ return false;
+}
+
+void Entity::timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) const {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ getSavePoints()->push(entity1, entity2, action);
+ }
+}
+
+void Entity::timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex object, ObjectLocation location) const {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ getObjects()->updateLocation2(object, location);
+ }
+}
+
+bool Entity::timeCheckCallbackAction(TimeValue timeValue, uint &parameter) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ callbackAction();
+ return true;
+ }
+
+ return false;
+}
+
+bool Entity::timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint &parameter, byte callback, const char* sound, EntityPosition position) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ getData()->entityPosition = position;
+ setCallback(callback);
+ setup_playSound(sound);
+ return true;
+ }
+
+ return false;
+}
+
+
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 039f461c7b..c67d13db9e 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -41,10 +41,229 @@ class Sequence;
class SequenceFrame;
struct SavePoint;
+//////////////////////////////////////////////////////////////////////////
+// Declaration
+//////////////////////////////////////////////////////////////////////////
+#define DECLARE_FUNCTION(name) \
+ void setup_##name(); \
+ void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_1(name, param1) \
+ void setup_##name(param1); \
+ void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_2(name, param1, param2) \
+ void setup_##name(param1, param2); \
+ void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_3(name, param1, param2, param3) \
+ void setup_##name(param1, param2, param3); \
+ void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_4(name, param1, param2, param3, param4) \
+ void setup_##name(param1, param2, param3, param4); \
+ void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_NOSETUP(name) \
+ void name(const SavePoint &savepoint);
+
+#define DECLARE_NULL_FUNCTION() \
+ void setup_nullfunction();
+
+//////////////////////////////////////////////////////////////////////////
+// Callbacks
+//////////////////////////////////////////////////////////////////////////
+#define ENTITY_CALLBACK(class, name, pointer) \
+ Common::Functor1Mem<const SavePoint&, void, class>(pointer, &class::name)
+
+#define ADD_CALLBACK_FUNCTION(class, name) \
+ _callbacks.push_back(new ENTITY_CALLBACK(class, name, this));
+
+#define ADD_NULL_FUNCTION() \
+ _callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this));
+
+#define WRAP_SETUP_FUNCTION(className, method) \
+ new Common::Functor0Mem<void, className>(this, &className::method)
+
+#define WRAP_SETUP_FUNCTION_S(className, method) \
+ new Common::Functor1Mem<const char *, void, className>(this, &className::method)
+
+#define WRAP_SETUP_FUNCTION_B(className, method) \
+ new Common::Functor1Mem<bool, void, className>(this, &className::method)
+
+//////////////////////////////////////////////////////////////////////////
+// Parameters macros
+//////////////////////////////////////////////////////////////////////////
+#define CURRENT_PARAM(index, id) \
+ ((EntityData::EntityParametersIIII*)_data->getCurrentParameters(index))->param##id
+
+#define ENTITY_PARAM(index, id) \
+ ((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id
+
+//////////////////////////////////////////////////////////////////////////
+// Misc
+//////////////////////////////////////////////////////////////////////////
+#define RESET_ENTITY_STATE(entity, class, function) \
+ getEntities()->resetState(entity); \
+ ((class *)getEntities()->get(entity))->function();
+
+//////////////////////////////////////////////////////////////////////////
+// Implementation
+//////////////////////////////////////////////////////////////////////////
+
+// Expose parameters and check validity
+#define EXPOSE_PARAMS(type) \
+ type *params = (type *)_data->getCurrentParameters(); \
+ if (!params) \
+ error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \
+
+// function signature without setup (we keep the index for consistency but never use it)
+#define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \
+ void class::name(const SavePoint &savepoint) { \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(index=" #index ")");
+
+// simple setup with no parameters
+#define IMPLEMENT_FUNCTION(index, class, name) \
+ void class::setup_##name() { \
+ Entity::setup(#class "::setup_" #name, index); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_END }
+
+// nullfunction call
+#define IMPLEMENT_NULL_FUNCTION(index, class) \
+ void class::setup_nullfunction() { \
+ Entity::setup(#class "::setup_nullfunction", index); \
+ }
+
+// setup with one uint parameter
+#define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \
+ void class::setup_##name(paramType param1) { \
+ Entity::setupI(#class "::setup_" #name, index, param1); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action));
+
+// setup with two uint parameters
+#define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \
+ void class::setup_##name(paramType1 param1, paramType2 param2) { \
+ Entity::setupII(#class "::setup_" #name, index, param1, param2); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action));
+
+// setup with three uint parameters
+#define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \
+ void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \
+ Entity::setupIII(#class "::setup_" #name, index, param1, param2, param3); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter
+#define IMPLEMENT_FUNCTION_S(index, class, name) \
+ void class::setup_##name(const char *seq1) { \
+ Entity::setupS(#class "::setup_" #name, index, seq1); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)&params->seq1, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter and one uint
+#define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \
+ void class::setup_##name(const char *seq1, paramType2 param4) { \
+ Entity::setupSI(#class "::setup_" #name, index, seq1, param4); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)&params->seq1, params->param4, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter and two uints
+#define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \
+ void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \
+ Entity::setupSII(#class "::setup_" #name, index, seq1, param4, param5); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)&params->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter and three uints
+#define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \
+ void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \
+ Entity::setupSIII(#class "::setup_" #name, index, seq, param4, param5, param6); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSIII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)&params->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \
+ void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \
+ Entity::setupSIIS(#class "::setup_" #name, index, seq1, param4, param5, seq2); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)&params->seq1, params->param4, params->param5, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_SS(index, class, name) \
+ void class::setup_##name(const char *seq1, const char *seq2) { \
+ Entity::setupSS(#class "::setup_" #name, index, seq1, seq2); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \
+ void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \
+ Entity::setupSSI(#class "::setup_" #name, index, seq1, seq2, param7); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)&params->seq1, (char *)&params->seq2, params->param7, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \
+ void class::setup_##name(paramType param1, const char *seq) { \
+ Entity::setupIS(#class "::setup_" #name, index, param1, seq); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersISII) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)&params->seq, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \
+ void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \
+ Entity::setupISS(#class "::setup_" #name, index, param1, seq1, seq2); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersISSI) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \
+ void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \
+ Entity::setupIIS(#class "::setup_" #name, index, param1, param2, seq); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersIISI) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)&params->seq, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \
+ void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \
+ Entity::setupIISS(#class "::setup_" #name, index, param1, param2, seq1, seq2); \
+ } \
+ void class::name(const SavePoint &savepoint) { \
+ EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
+ debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+
+//////////////////////////////////////////////////////////////////////////
class EntityData : Common::Serializable {
public:
- struct EntityParameters : Common::Serializable{
+ struct EntityParameters : Common::Serializable {
virtual ~EntityParameters() {}
virtual Common::String toString() = 0;
@@ -596,6 +815,15 @@ public:
return str;
}
+ /**
+ * Synchronizes a string.
+ *
+ * @param s The Common::Serializer to use.
+ * @param string The string.
+ * @param length Length of the string.
+ */
+ void syncString(Common::Serializer &s, Common::String &string, uint length) const;
+
// Serializable
void saveLoadWithSerializer(Common::Serializer &s);
};
@@ -611,32 +839,30 @@ public:
params->parameters[i] = new T();
}
- EntityCallData *getCallData() { return &_data; }
+ EntityCallData *getCallData() { return &_data; }
- EntityParameters *getParameters(uint callback, byte index) const;
- EntityParameters *getCurrentParameters(byte index = 0) { return getParameters(_data.currentCall, index); }
+ EntityParameters *getParameters(uint callback, byte index) const;
+ EntityParameters *getCurrentParameters(byte index = 0) { return getParameters(_data.currentCall, index); }
+ EntityCallParameters *getCurrentCallParameters() { return &_parameters[_data.currentCall]; }
- int getCallback(uint callback) const;
- int getCurrentCallback() { return getCallback(_data.currentCall); }
- void setCallback(uint callback, byte index);
- void setCurrentCallback(uint index) { setCallback(_data.currentCall, index); }
+ byte getCallback(uint callback) const;
+ byte getCurrentCallback() { return getCallback(_data.currentCall); }
+ void setCallback(uint callback, byte index);
+ void setCurrentCallback(uint index) { setCallback(_data.currentCall, index); }
- void updateParameters(uint32 index) const;
+ void updateParameters(uint32 index) const;
// Serializable
- void saveLoadWithSerializer(Common::Serializer &ser);
+ void saveLoadWithSerializer(Common::Serializer &ser);
private:
- EntityCallData _data;
+ EntityCallData _data;
EntityCallParameters _parameters[9];
};
class Entity : Common::Serializable {
public:
-
- typedef Common::Functor1<const SavePoint&, void> Callback;
-
Entity(LastExpressEngine *engine, EntityIndex index);
virtual ~Entity();
@@ -657,6 +883,12 @@ public:
virtual void setup_chapter4() = 0;
virtual void setup_chapter5() = 0;
+ // Shared functions
+ virtual void setup_savegame(SavegameType, uint32) { error("[Entity::setup_savegame] Trying to call the parent setup function. Use the specific entity function directly"); }
+ virtual void setup_enterExitCompartment(const char *, ObjectIndex) { error("[Entity::setup_enterExitCompartment] Trying to call the parent setup function. Use the specific entity function directly"); }
+ virtual void setup_updateEntity(CarIndex, EntityPosition) { error("[Entity::setup_updateEntity] Trying to call the parent setup function. Use the specific entity function directly"); }
+ virtual void setup_playSound(const char*) { error("[Entity::setup_playSound] Trying to call the parent setup function. Use the specific entity function directly"); }
+
// Serializable
void saveLoadWithSerializer(Common::Serializer &ser) { _data->saveLoadWithSerializer(ser); }
@@ -664,10 +896,11 @@ public:
protected:
LastExpressEngine *_engine;
+ typedef Common::Functor1<const SavePoint&, void> Callback;
- EntityIndex _entityIndex;
- EntityData *_data;
- Common::Array<Callback *> _callbacks;
+ EntityIndex _entityIndex;
+ EntityData *_data;
+ Common::Array<Callback *> _callbacks;
/**
* Saves the game
@@ -679,6 +912,13 @@ protected:
void savegame(const SavePoint &savepoint);
/**
+ * Saves the game before being found out with a blood covered jacket.
+ *
+ * @param saveFunction The setup function to call to save the game
+ */
+ void savegameBloodJacket();
+
+ /**
* Play sound
*
* @param savepoint The savepoint
@@ -782,15 +1022,83 @@ protected:
void enterExitCompartment(const SavePoint &savepoint, EntityPosition position1 = kPositionNone, EntityPosition position2 = kPositionNone, CarIndex car = kCarNone, ObjectIndex compartment = kObjectNone, bool alternate = false, bool updateLocation = false);
/**
+ * Go to compartment.
+ *
+ * @param savepoint The savepoint.
+ * @param compartmentFrom The compartment from.
+ * @param positionFrom The position from.
+ * @param sequenceFrom The sequence from.
+ * @param sequenceTo The sequence to.
+ */
+ void goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo);
+
+ /**
+ * Go to compartment from compartment.
+ *
+ * @param savepoint The savepoint.
+ * @param compartmentFrom The compartment from.
+ * @param positionFrom The position from.
+ * @param sequenceFrom The sequence from.
+ * @param compartmentTo The compartment to.
+ * @param positionTo The position to.
+ * @param sequenceTo The sequence to.
+ */
+ void goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo);
+
+ /**
* Updates the position
*
- * @param savepoint The savepoint
+ * @param savepoint The savepoint
* - Sequence name
* - CarIndex
* - Position
* @param handleExcuseMe true to handle excuseMe actions
*/
void updatePosition(const SavePoint &savepoint, bool handleExcuseMe = false);
+
+ /**
+ * Store the current callback information and perform the callback action
+ */
+ void callbackAction();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Setup functions
+ //////////////////////////////////////////////////////////////////////////
+ void setup(const char *name, uint index);
+ void setupI(const char *name, uint index, uint param1);
+ void setupII(const char *name, uint index, uint param1, uint param2);
+ void setupIII(const char *name, uint index, uint param1, uint param2, uint param3);
+ void setupS(const char *name, uint index, const char *seq1);
+ void setupSS(const char *name, uint index, const char *seq1, const char *seq2);
+ void setupSI(const char *name, uint index, const char *seq1, uint param4);
+ void setupSII(const char *name, uint index, const char *seq1, uint param4, uint param5);
+ void setupSIII(const char *name, uint index, const char *seq, uint param4, uint param5, uint param6);
+ void setupSIIS(const char *name, uint index, const char *seq1, uint param4, uint param5, const char *seq2);
+ void setupSSI(const char *name, uint index, const char *seq1, const char *seq2, uint param7);
+ void setupIS(const char *name, uint index, uint param1, const char *seq);
+ void setupISS(const char *name, uint index, uint param1, const char *seq1, const char *seq2);
+ void setupIIS(const char *name, uint index, uint param1, uint param2, const char *seq);
+ void setupIISS(const char *name, uint index, uint param1, uint param2, const char *seq1, const char *seq2);
+
+ //////////////////////////////////////////////////////////////////////////
+ // Helper functions
+ //////////////////////////////////////////////////////////////////////////
+
+ bool updateParameter(uint &parameter, uint timeType, uint delta) const;
+ bool updateParameterCheck(uint &parameter, uint timeType, uint delta) const;
+ bool updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta) const;
+
+ bool timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function) const;
+ bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
+ bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, const char *str, Common::Functor1<const char *, void> *function);
+ bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, bool check, Common::Functor1<bool, void> *function);
+ bool timeCheckCallbackInventory(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
+ bool timeCheckCar(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
+ void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) const;
+ void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location) const;
+ bool timeCheckCallbackAction(TimeValue timeValue, uint &parameter);
+ bool timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint &parameter, byte callback, const char* sound, EntityPosition position);
+
};
diff --git a/engines/lastexpress/entities/entity39.cpp b/engines/lastexpress/entities/entity39.cpp
index e786d153a0..1786cd2201 100644
--- a/engines/lastexpress/entities/entity39.cpp
+++ b/engines/lastexpress/entities/entity39.cpp
@@ -28,7 +28,6 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/entity39.h b/engines/lastexpress/entities/entity39.h
index 4335a9566e..54b65408c7 100644
--- a/engines/lastexpress/entities/entity39.h
+++ b/engines/lastexpress/entities/entity39.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_ENTITY39_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -72,4 +71,4 @@ private:
} // End of namespace LastExpress
-#endif // LASTEXPRESS_##define##_H
+#endif // LASTEXPRESS_ENTITY39_H
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 2da0da15b3..fd803676a9 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -25,502 +25,6 @@
namespace LastExpress {
-#define LOW_BYTE(w) ((unsigned char)(((unsigned long)(w)) & 0xff))
-
-//////////////////////////////////////////////////////////////////////////
-// Callbacks
-#define ENTITY_CALLBACK(class, name, pointer) \
- Common::Functor1Mem<const SavePoint&, void, class>(pointer, &class::name)
-
-#define ADD_CALLBACK_FUNCTION(class, name) \
- _callbacks.push_back(new ENTITY_CALLBACK(class, name, this));
-
-#define ADD_NULL_FUNCTION() \
- _callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this));
-
-//////////////////////////////////////////////////////////////////////////
-// Declaration
-//////////////////////////////////////////////////////////////////////////
-
-#define DECLARE_FUNCTION(name) \
- void setup_##name(); \
- void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_1(name, param1) \
- void setup_##name(param1); \
- void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_2(name, param1, param2) \
- void setup_##name(param1, param2); \
- void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_3(name, param1, param2, param3) \
- void setup_##name(param1, param2, param3); \
- void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_4(name, param1, param2, param3, param4) \
- void setup_##name(param1, param2, param3, param4); \
- void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_NOSETUP(name) \
- void name(const SavePoint &savepoint);
-
-#define DECLARE_NULL_FUNCTION() \
- void setup_nullfunction();
-
-//////////////////////////////////////////////////////////////////////////
-// Setup
-//////////////////////////////////////////////////////////////////////////
-
-#define IMPLEMENT_SETUP(class, callback_class, name, index) \
-void class::setup_##name() { \
- BEGIN_SETUP(callback_class, name, index, EntityData::EntityParametersIIII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::setup_" #name "()"); \
- END_SETUP() \
-}
-
-#define BEGIN_SETUP(class, name, index, type) \
- _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \
- _data->setCurrentCallback(index); \
- _data->resetCurrentParameters<type>();
-
-#define END_SETUP() \
- _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
-
-
-//////////////////////////////////////////////////////////////////////////
-// Implementation
-//////////////////////////////////////////////////////////////////////////
-
-// Expose parameters and check validity
-#define EXPOSE_PARAMS(type) \
- type *params = (type *)_data->getCurrentParameters(); \
- if (!params) \
- error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \
-
-
-// function signature without setup (we keep the index for consistency but never use it)
-#define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \
- void class::name(const SavePoint &savepoint) { \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(index=" #index ")");
-
-// simple setup with no parameters
-#define IMPLEMENT_FUNCTION(index, class, name) \
- IMPLEMENT_SETUP(class, class, name, index) \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_END }
-
-// nullfunction call
-#define IMPLEMENT_NULL_FUNCTION(index, class) \
- IMPLEMENT_SETUP(class, Entity, nullfunction, index)
-
-// setup with one uint parameter
-#define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \
- void class::setup_##name(paramType param1) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
- EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
- params->param1 = (unsigned int)param1; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action));
-
-// setup with two uint parameters
-#define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \
- void class::setup_##name(paramType1 param1, paramType2 param2) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
- EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
- params->param1 = param1; \
- params->param2 = param2; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action));
-
-// setup with three uint parameters
-#define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \
- void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
- EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
- params->param1 = param1; \
- params->param2 = param2; \
- params->param3 = param3; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter
-#define IMPLEMENT_FUNCTION_S(index, class, name) \
- void class::setup_##name(const char *seq1) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
- EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq1, seq1, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)&params->seq1, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter and one uint
-#define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \
- void class::setup_##name(const char *seq1, paramType2 param4) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
- EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq1, seq1, 12); \
- params->param4 = param4; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)&params->seq1, params->param4, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter and two uints
-#define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \
- void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
- EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq1, seq1, 12); \
- params->param4 = param4; \
- params->param5 = param5; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)&params->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter and three uints
-#define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \
- void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIII) \
- EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq, seq, 12); \
- params->param4 = param4; \
- params->param5 = param5; \
- params->param6 = param6; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSIII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)&params->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \
- void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
- EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq1, seq1, 12); \
- params->param4 = param4; \
- params->param5 = param5; \
- strncpy((char *)&params->seq2, seq2, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)&params->seq1, params->param4, params->param5, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_SS(index, class, name) \
- void class::setup_##name(const char *seq1, const char *seq2) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
- EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq1, seq1, 12); \
- strncpy((char *)&params->seq2, seq2, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \
- void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
- EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
- strncpy((char *)&params->seq1, seq1, 12); \
- strncpy((char *)&params->seq2, seq2, 12); \
- params->param7 = param7; \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)&params->seq1, (char *)&params->seq2, params->param7, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \
- void class::setup_##name(paramType param1, const char *seq) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersISII) \
- EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters(); \
- params->param1 = (unsigned int)param1; \
- strncpy((char *)&params->seq, seq, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersISII) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)&params->seq, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \
- void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersISSI) \
- EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters(); \
- params->param1 = param1; \
- strncpy((char *)&params->seq1, seq1, 12); \
- strncpy((char *)&params->seq2, seq2, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersISSI) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \
- void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISI) \
- EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters(); \
- params->param1 = param1; \
- params->param2 = param2; \
- strncpy((char *)&params->seq, seq, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersIISI) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)&params->seq, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \
- void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \
- BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISS) \
- EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters(); \
- params->param1 = param1; \
- params->param2 = param2; \
- strncpy((char *)&params->seq1, seq1, 12); \
- strncpy((char *)&params->seq2, seq2, 12); \
- END_SETUP() \
- } \
- void class::name(const SavePoint &savepoint) { \
- EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
- debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-
-//////////////////////////////////////////////////////////////////////////
-// Misc
-//////////////////////////////////////////////////////////////////////////
-#define RESET_ENTITY_STATE(entity, class, function) \
- getEntities()->resetState(entity); \
- ((class *)getEntities()->get(entity))->function();
-
-//////////////////////////////////////////////////////////////////////////
-// Parameters macros (for default IIII parameters)
-//////////////////////////////////////////////////////////////////////////
-#define CURRENT_PARAM(index, id) \
- ((EntityData::EntityParametersIIII*)_data->getCurrentParameters(index))->param##id
-
-#define ENTITY_PARAM(index, id) \
- ((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id
-
-//////////////////////////////////////////////////////////////////////////
-// Time check macros
-//////////////////////////////////////////////////////////////////////////
-#define TIME_CHECK(timeValue, parameter, function) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- function(); \
- break; \
- }
-
-#define TIME_CHECK_SAVEPOINT(timeValue, parameter, entity1, entity2, action) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- getSavePoints()->push(entity1, entity2, action); \
- }
-
-#define TIME_CHECK_CALLBACK(timeValue, parameter, callback, function) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- setCallback(callback); \
- function(); \
- break; \
- }
-
-#define TIME_CHECK_CALLBACK_1(timeValue, parameter, callback, function, param1) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- setCallback(callback); \
- function(param1); \
- break; \
- }
-
-#define TIME_CHECK_CALLBACK_2(timeValue, parameter, callback, function, param1, param2) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- setCallback(callback); \
- function(param1, param2); \
- break; \
- }
-
-#define TIME_CHECK_CALLBACK_3(timeValue, parameter, callback, function, param1, param2, param3) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- setCallback(callback); \
- function(param1, param2, param3); \
- break; \
- }
-
-#define TIME_CHECK_CALLBACK_INVENTORY(timeValue, parameter, callback, function) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- getData()->inventoryItem = kItemNone; \
- setCallback(callback); \
- function(); \
- break; \
- }
-
-#define TIME_CHECK_CALLBACK_ACTION(timeValue, parameter) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- CALLBACK_ACTION(); \
- break; \
- }
-
-#define TIME_CHECK_PLAYSOUND_UPDATEPOSITION(timeValue, parameter, callback, sound, position) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- getData()->entityPosition = position; \
- setCallback(callback); \
- setup_playSound(sound); \
- break; \
- }
-
-#define TIME_CHECK_OBJECT(timeValue, parameter, object, location) \
- if (getState()->time > timeValue && !parameter) { \
- parameter = 1; \
- getObjects()->updateLocation2(object, location); \
- }
-
-#define TIME_CHECK_CAR(timeValue, parameter, callback, function) {\
- if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter) \
- parameter = (uint)getState()->time + 75; \
- if (getState()->time > timeValue || parameter < getState()->time) { \
- parameter = kTimeInvalid; \
- setCallback(callback); \
- function(); \
- break; \
- } \
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Callback action
-//////////////////////////////////////////////////////////////////////////
-#define CALLBACK_ACTION() { \
- if (getData()->currentCall == 0) \
- error("[CALLBACK_ACTION] currentCall is already 0, cannot proceed"); \
- getData()->currentCall--; \
- getSavePoints()->setCallback(_entityIndex, _callbacks[_data->getCurrentCallback()]); \
- getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback); \
- }
-
-//////////////////////////////////////////////////////////////////////////
-// Param update
-//////////////////////////////////////////////////////////////////////////
-#define UPDATE_PARAM(parameter, type, value) { \
- if (!parameter) \
- parameter = (uint)(type + value); \
- if (parameter >= type) \
- break; \
- parameter = kTimeInvalid; \
-}
-
-// Todo: replace with UPDATE_PARAM_PROC as appropriate
-#define UPDATE_PARAM_GOTO(parameter, type, value, label) { \
- if (!parameter) \
- parameter = (uint)(type + value); \
- if (parameter >= type) \
- goto label; \
- parameter = kTimeInvalid; \
-}
-
-// Updating parameter with code inside the check
-#define UPDATE_PARAM_PROC(parameter, type, value) \
- if (!parameter) \
- parameter = (uint)(type + value); \
- if (parameter < type) { \
- parameter = kTimeInvalid;
-
-#define UPDATE_PARAM_PROC_TIME(timeValue, test, parameter, value) \
- if (getState()->time <= timeValue) { \
- if (test || !parameter) \
- parameter = (uint)(getState()->time + value); \
- } \
- if (parameter < getState()->time || getState()->time > timeValue) { \
- parameter = kTimeInvalid;
-
-#define UPDATE_PARAM_PROC_END }
-
-// Updating parameter with an added check (and code inside the check)
-#define UPDATE_PARAM_CHECK(parameter, type, value) \
- if (!parameter || parameter < type) { \
- if (!parameter) \
- parameter = (uint)(type + value);
-
-//////////////////////////////////////////////////////////////////////////
-// Compartments
-//////////////////////////////////////////////////////////////////////////
-// Go from one compartment to another (or the same one if no optional args are passed
-#define COMPARTMENT_TO(class, compartmentFrom, positionFrom, sequenceFrom, sequenceTo) \
- switch (savepoint.action) { \
- default: \
- break; \
- case kActionDefault: \
- getData()->entityPosition = positionFrom; \
- setCallback(1); \
- setup_enterExitCompartment(sequenceFrom, compartmentFrom); \
- break; \
- case kActionCallback: \
- switch (getCallback()) { \
- default: \
- break; \
- case 1: \
- setCallback(2); \
- setup_enterExitCompartment(sequenceTo, compartmentFrom); \
- break; \
- case 2: \
- getData()->entityPosition = positionFrom; \
- getEntities()->clearSequences(_entityIndex); \
- CALLBACK_ACTION(); \
- } \
- break; \
- }
-
-#define COMPARTMENT_FROM_TO(class, compartmentFrom, positionFrom, sequenceFrom, compartmentTo, positionTo, sequenceTo) \
- switch (savepoint.action) { \
- default: \
- break; \
- case kActionDefault: \
- getData()->entityPosition = positionFrom; \
- getData()->location = kLocationOutsideCompartment; \
- setCallback(1); \
- setup_enterExitCompartment(sequenceFrom, compartmentFrom); \
- break; \
- case kActionCallback: \
- switch (getCallback()) { \
- default: \
- break; \
- case 1: \
- setCallback(2); \
- setup_updateEntity(kCarGreenSleeping, positionTo); \
- break; \
- case 2: \
- setCallback(3); \
- setup_enterExitCompartment(sequenceTo, compartmentTo); \
- break; \
- case 3: \
- getData()->location = kLocationInsideCompartment; \
- getEntities()->clearSequences(_entityIndex); \
- CALLBACK_ACTION(); \
- break; \
- } \
- break; \
- }
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp
index 46cd790ffb..d2bbc9854c 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -32,7 +32,6 @@
#include "lastexpress/sound/queue.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
@@ -114,7 +113,7 @@ IMPLEMENT_FUNCTION_II(8, Francois, updateEntity, CarIndex, EntityPosition)
case kActionNone:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
} else {
if (!getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000)
|| !getInventory()->hasItem(kItemFirebird)
@@ -169,7 +168,7 @@ IMPLEMENT_FUNCTION_II(8, Francois, updateEntity, CarIndex, EntityPosition)
case kActionDefault:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -225,7 +224,7 @@ IMPLEMENT_FUNCTION(9, Francois, function9)
case 2:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -263,7 +262,7 @@ IMPLEMENT_FUNCTION(10, Francois, function10)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityFrancois);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -279,7 +278,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue)
case kActionNone:
if (!getSoundQueue()->isBuffered(kEntityFrancois)) {
- UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)
+ if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)) {
switch (rnd(7)) {
default:
break;
@@ -312,7 +311,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue)
params->param6 = 15 * rnd(7);
CURRENT_PARAM(1, 1) = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (!getEntities()->hasValidFrame(kEntityFrancois) || !getEntities()->isWalkingOppositeToPlayer(kEntityFrancois))
@@ -442,7 +441,7 @@ label_callback:
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -465,7 +464,7 @@ label_callback:
getData()->field_4A3 = 30;
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction205346192:
@@ -524,7 +523,7 @@ IMPLEMENT_FUNCTION(12, Francois, function12)
break;
case 7:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -609,7 +608,7 @@ IMPLEMENT_FUNCTION(13, Francois, function13)
break;
case 11:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -708,7 +707,7 @@ IMPLEMENT_FUNCTION_IIS(14, Francois, function14, ObjectIndex, EntityPosition)
break;
case 13:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -764,7 +763,7 @@ IMPLEMENT_FUNCTION(15, Francois, function15)
case 7:
if (!getEntities()->isInsideCompartment(kEntityMmeBoutarel, kCarRedSleeping, kPosition_5790)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -773,7 +772,7 @@ IMPLEMENT_FUNCTION(15, Francois, function15)
break;
case 8:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -830,7 +829,7 @@ IMPLEMENT_FUNCTION(16, Francois, function16)
getData()->entityPosition = kPosition_5790;
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -849,7 +848,7 @@ IMPLEMENT_FUNCTION(17, Francois, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Francois, setup_chapter1Handler));
break;
case kActionDefault:
@@ -867,7 +866,7 @@ IMPLEMENT_FUNCTION(18, Francois, chapter1Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_1(kTimeParisEpernay, params->param1, 1, setup_function11, kTime1093500);
+ timeCheckCallback(kTimeParisEpernay, params->param1, 1, kTime1093500);
break;
case kActionCallback:
@@ -884,7 +883,7 @@ IMPLEMENT_FUNCTION(19, Francois, function19)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime1161000, params->param1, 2, setup_function12);
+ Entity::timeCheckCallback(kTime1161000, params->param1, 2, WRAP_SETUP_FUNCTION(Francois, setup_function12));
break;
case kAction101107728:
@@ -979,17 +978,21 @@ IMPLEMENT_FUNCTION(23, Francois, function23)
}
label_callback_1:
- TIME_CHECK_CALLBACK_1(kTime1764000, params->param1, 2, setup_playSound, "Fra2011");
+ if (Entity::timeCheckCallback(kTime1764000, params->param1, 2, "Fra2011", WRAP_SETUP_FUNCTION_S(Francois, setup_playSound)))
+ break;
label_callback_2:
- TIME_CHECK_CALLBACK(kTime1800000, params->param2, 3, setup_function13);
+ if (Entity::timeCheckCallback(kTime1800000, params->param2, 3, WRAP_SETUP_FUNCTION(Francois, setup_function13)))
+ break;
label_callback_3:
if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) {
- TIME_CHECK_CALLBACK_1(kTime1768500, params->param3, 4, setup_function11, kTime1773000);
+ if (timeCheckCallback(kTime1768500, params->param3, 4, kTime1773000))
+ break;
label_callback_4:
- TIME_CHECK_CALLBACK_1(kTime1827000, params->param4, 5, setup_function11, kTime1831500);
+ if (timeCheckCallback(kTime1827000, params->param4, 5, kTime1831500))
+ break;
}
label_callback_5:
@@ -999,18 +1002,19 @@ label_callback_5:
}
if (params->param5 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75);
+ if (Entity::updateParameterTime(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75)) {
setCallback(6);
setup_playSound("Fra2010");
break;
- UPDATE_PARAM_PROC_END
+ }
}
label_callback_6:
- TIME_CHECK_CALLBACK_3(kTime1782000, params->param6, 7, setup_function14, kObjectCompartmentC, kPosition_6470, "c");
+ if (timeCheckCallbackCompartment(kTime1782000, params->param6, 7, kObjectCompartmentC, kPosition_6470, "c"))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK_3(kTime1813500, params->param7, 8, setup_function14, kObjectCompartmentF, kPosition_4070, "f");
+ timeCheckCallbackCompartment(kTime1813500, params->param7, 8, kObjectCompartmentF, kPosition_4070, "f");
break;
case kActionCallback:
@@ -1086,32 +1090,41 @@ IMPLEMENT_FUNCTION(25, Francois, chapter3Handler)
}
label_callback_2:
- TIME_CHECK_CALLBACK(kTime2025000, params->param3, 3, setup_function12);
+ if (Entity::timeCheckCallback(kTime2025000, params->param3, 3, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_3:
- TIME_CHECK_CALLBACK(kTime2052000, params->param4, 4, setup_function12);
+ if (Entity::timeCheckCallback(kTime2052000, params->param4, 4, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_4:
- TIME_CHECK_CALLBACK(kTime2079000, params->param5, 5, setup_function12);
+ if (Entity::timeCheckCallback(kTime2079000, params->param5, 5, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_5:
- TIME_CHECK_CALLBACK(kTime2092500, params->param6, 6, setup_function12);
+ if (Entity::timeCheckCallback(kTime2092500, params->param6, 6, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_6:
- TIME_CHECK_CALLBACK(kTime2173500, params->param7, 7, setup_function12);
+ if (Entity::timeCheckCallback(kTime2173500, params->param7, 7, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK(kTime2182500, params->param8, 8, setup_function12);
+ if (Entity::timeCheckCallback(kTime2182500, params->param8, 8, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_8:
- TIME_CHECK_CALLBACK(kTime2241000, CURRENT_PARAM(1, 1), 9, setup_function12);
+ if (Entity::timeCheckCallback(kTime2241000, CURRENT_PARAM(1, 1), 9, WRAP_SETUP_FUNCTION(Francois, setup_function12)))
+ break;
label_callback_9:
if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) {
- TIME_CHECK_CALLBACK_1(kTime2011500, CURRENT_PARAM(1, 2), 10, setup_function11, kTime2016000);
+ if (timeCheckCallback(kTime2011500, CURRENT_PARAM(1, 2), 10, kTime2016000))
+ break;
label_callback_10:
- TIME_CHECK_CALLBACK_1(kTime2115000, CURRENT_PARAM(1, 3), 11, setup_function11, kTime2119500);
+ if (timeCheckCallback(kTime2115000, CURRENT_PARAM(1, 3), 11, kTime2119500))
+ break;
}
label_callback_11:
@@ -1129,13 +1142,15 @@ label_callback_11:
}
label_callback_12:
- TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 5), 13, setup_function14, kObjectCompartmentE, kPosition_4840, "e");
+ if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 5), 13, kObjectCompartmentE, kPosition_4840, "e"))
+ break;
label_callback_13:
- TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 6), 14, setup_function14, kObjectCompartmentF, kPosition_4070, "f");
+ if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 6), 14, kObjectCompartmentF, kPosition_4070, "f"))
+ break;
label_callback_14:
- TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 7), 15, setup_function14, kObjectCompartmentB, kPosition_7500, "b");
+ timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 7), 15, kObjectCompartmentB, kPosition_7500, "b");
}
}
break;
@@ -1291,4 +1306,33 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_NULL_FUNCTION(31, Francois)
+
+//////////////////////////////////////////////////////////////////////////
+// Helper functions
+//////////////////////////////////////////////////////////////////////////
+bool Francois::timeCheckCallbackCompartment(TimeValue timeValue, uint &parameter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ setup_function14(compartment, position, sequenceSuffix);
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Francois::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, TimeValue timeValue2) {
+ if (getState()->time > timeValue && !parameter) {
+ parameter = 1;
+ setCallback(callback);
+ setup_function11(timeValue2);
+
+ return true;
+ }
+
+ return false;
+}
+
+
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/francois.h b/engines/lastexpress/entities/francois.h
index 19eca6fb50..51270fa4b6 100644
--- a/engines/lastexpress/entities/francois.h
+++ b/engines/lastexpress/entities/francois.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_FRANCOIS_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -160,6 +159,10 @@ public:
DECLARE_FUNCTION(function30)
DECLARE_NULL_FUNCTION()
+
+private:
+ bool timeCheckCallbackCompartment(TimeValue timeValue, uint &parameter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix);
+ bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, TimeValue timeValue2);
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp
index daa50956d3..a912fa4ecb 100644
--- a/engines/lastexpress/entities/gendarmes.cpp
+++ b/engines/lastexpress/entities/gendarmes.cpp
@@ -31,7 +31,6 @@
#include "lastexpress/game/state.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -67,7 +66,7 @@ IMPLEMENT_FUNCTION(2, Gendarmes, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Gendarmes, setup_chapter1Handler));
break;
case kActionDefault:
@@ -195,7 +194,7 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
break;
case 1:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 2:
@@ -233,7 +232,7 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
case 6:
getData()->location = kLocationOutsideCompartment;
getEntities()->exitCompartment(kEntityGendarmes, (ObjectIndex)parameters2->param5);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -267,11 +266,12 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje
getSound()->playSound(kEntityGendarmes, "POL1046A", kFlagDefault);
}
- UPDATE_PARAM(params->param7, getState()->timeTicks, 300);
+ if (!Entity::updateParameter(params->param7, getState()->timeTicks, 300))
+ break;
if (!params->param4 && getEntities()->isOutsideAlexeiWindow()) {
getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
} else {
if (getEntities()->isOutsideAlexeiWindow())
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49);
@@ -322,7 +322,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverBloodJacket, true);
getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 4:
@@ -330,7 +330,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true);
getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 5:
@@ -552,13 +552,14 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl
case kActionNone:
if (checkCallback) {
EXPOSE_PARAMS(EntityData::EntityParametersIIII);
- TIME_CHECK_CALLBACK_ACTION(params->param1, params->param2);
+ if (Entity::timeCheckCallbackAction((TimeValue)params->param1, params->param2))
+ break;
}
if (shouldUpdateEntity) {
EXPOSE_PARAMS(EntityData::EntityParametersIIII);
if (getEntities()->updateEntity(kEntityGendarmes, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -582,7 +583,7 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -599,7 +600,7 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl
if (shouldUpdateEntity) {
EXPOSE_PARAMS(EntityData::EntityParametersIIII);
if (getEntities()->updateEntity(kEntityGendarmes, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
diff --git a/engines/lastexpress/entities/gendarmes.h b/engines/lastexpress/entities/gendarmes.h
index d999cfc1fd..a761643531 100644
--- a/engines/lastexpress/entities/gendarmes.h
+++ b/engines/lastexpress/entities/gendarmes.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_GENDARMES_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
#include "lastexpress/sound/sound.h"
diff --git a/engines/lastexpress/entities/hadija.cpp b/engines/lastexpress/entities/hadija.cpp
index 8ec972b939..e9abcd888a 100644
--- a/engines/lastexpress/entities/hadija.cpp
+++ b/engines/lastexpress/entities/hadija.cpp
@@ -28,10 +28,7 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -89,22 +86,22 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(6, Hadija, compartment6)
- COMPARTMENT_TO(Hadija, kObjectCompartment6, kPosition_4070, "619Cf", "619Df");
+ Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Cf", "619Df");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(7, Hadija, compartment8)
- COMPARTMENT_TO(Hadija, kObjectCompartment8, kPosition_2740, "619Ch", "619Dh");
+ Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Ch", "619Dh");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(8, Hadija, compartment6to8)
- COMPARTMENT_FROM_TO(Hadija, kObjectCompartment6, kPosition_4070, "619Bf", kObjectCompartment8, kPosition_2740, "619Ah");
+ Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Bf", kObjectCompartment8, kPosition_2740, "619Ah");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(9, Hadija, compartment8to6)
- COMPARTMENT_FROM_TO(Hadija, kObjectCompartment8, kPosition_2740, "619Bh", kObjectCompartment6, kPosition_4070, "619Af");
+ Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Bh", kObjectCompartment6, kPosition_4070, "619Af");
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -114,7 +111,7 @@ IMPLEMENT_FUNCTION(10, Hadija, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Hadija, setup_chapter1Handler));
break;
case kActionDefault:
@@ -133,10 +130,12 @@ IMPLEMENT_FUNCTION(11, Hadija, chapter1Handler)
break;
case kActionNone:
- TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTimeParisEpernay, params->param1, 1, "Har1100", kPosition_4840);
+ if (Entity::timeCheckPlaySoundUpdatePosition(kTimeParisEpernay, params->param1, 1, "Har1100", kPosition_4840))
+ break;
label_callback1:
- TIME_CHECK_CALLBACK(kTime1084500, params->param2, 2, setup_compartment6to8);
+ if (Entity::timeCheckCallback(kTime1084500, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8)))
+ break;
label_callback2:
if (params->param3 != kTimeInvalid && getState()->time > kTime1093500) {
@@ -164,7 +163,8 @@ label_callback2:
}
label_callback3:
- TIME_CHECK_CALLBACK(kTime1156500, params->param4, 4, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTime1156500, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)))
+ break;
label_callback4:
if (params->param5 != kTimeInvalid && getState()->time > kTime1165500) {
@@ -254,7 +254,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler)
}
if (params->param2 == kTimeInvalid || getState()->time <= kTime1786500) {
- TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6);
+ Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6));
break;
}
@@ -264,7 +264,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler)
params->param2 = (uint)getState()->time + 75;
if (params->param2 >= getState()->time) {
- TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6);
+ Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6));
break;
}
}
@@ -281,7 +281,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler)
break;
case 1:
- TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6);
+ Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6));
break;
case 2:
@@ -321,20 +321,26 @@ IMPLEMENT_FUNCTION(16, Hadija, chapter3Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime1998000, params->param1, 1, setup_compartment6to8);
+ if (Entity::timeCheckCallback(kTime1998000, params->param1, 1, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8)))
+ break;
label_callback1:
- TIME_CHECK_CALLBACK(kTime2020500, params->param2, 2, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTime2020500, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)))
+ break;
label_callback2:
- TIME_CHECK_CALLBACK(kTime2079000, params->param3, 3, setup_compartment6to8);
+ if (Entity::timeCheckCallback(kTime2079000, params->param3, 3, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8)))
+ break;
label_callback3:
- TIME_CHECK_CALLBACK(kTime2187000, params->param4, 4, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTime2187000, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)))
+ break;
label_callback4:
- if (params->param5 != kTimeInvalid && getState()->time > kTime2196000)
- TIME_CHECK_CAR(kTime2254500, params->param5, 5, setup_compartment6);
+ if (params->param5 != kTimeInvalid && getState()->time > kTime2196000) {
+ if (Entity::timeCheckCar(kTime2254500, params->param5, 5, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6)))
+ break;
+ }
break;
case kActionDefault:
@@ -387,18 +393,24 @@ IMPLEMENT_FUNCTION(18, Hadija, chapter4Handler)
break;
case kActionNone:
- if (params->param1 != kTimeInvalid)
- TIME_CHECK_CAR(kTime1714500, params->param1, 1, setup_compartment6);
+ if (params->param1 != kTimeInvalid) {
+ if (Entity::timeCheckCar(kTime1714500, params->param1, 1, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6)))
+ break;
+ }
label_callback1:
- TIME_CHECK_CALLBACK(kTime2367000, params->param2, 2, setup_compartment6to8);
+ if (Entity::timeCheckCallback(kTime2367000, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8)))
+ break;
label_callback2:
- TIME_CHECK_CALLBACK(kTime2421000, params->param3, 3, setup_compartment8to6);
+ if (Entity::timeCheckCallback(kTime2421000, params->param3, 3, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)))
+ break;
label_callback3:
- if (params->param4 != kTimeInvalid && getState()->time > kTime2425500)
- TIME_CHECK_CAR(kTime2484000, params->param4, 4, setup_compartment6);
+ if (params->param4 != kTimeInvalid && getState()->time > kTime2425500) {
+ if (Entity::timeCheckCar(kTime2484000, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6)))
+ break;
+ }
break;
case kActionCallback:
@@ -468,7 +480,9 @@ IMPLEMENT_FUNCTION(22, Hadija, function22)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param1, getState()->time, 2700))
+ break;
+
setup_function23();
break;
diff --git a/engines/lastexpress/entities/hadija.h b/engines/lastexpress/entities/hadija.h
index d2495955e0..545f21ee03 100644
--- a/engines/lastexpress/entities/hadija.h
+++ b/engines/lastexpress/entities/hadija.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_HADIJA_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/ivo.cpp b/engines/lastexpress/entities/ivo.cpp
index f2261b438c..c53f4689fb 100644
--- a/engines/lastexpress/entities/ivo.cpp
+++ b/engines/lastexpress/entities/ivo.cpp
@@ -32,10 +32,7 @@
#include "lastexpress/game/scenes.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -184,7 +181,7 @@ IMPLEMENT_FUNCTION(11, Ivo, function11)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityIvo);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 4:
@@ -193,7 +190,7 @@ IMPLEMENT_FUNCTION(11, Ivo, function11)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityIvo);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -210,7 +207,7 @@ IMPLEMENT_FUNCTION(12, Ivo, sitAtTableWithSalko)
getEntities()->clearSequences(kEntitySalko);
getSavePoints()->push(kEntityIvo, kEntityTables2, kAction136455232);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -231,7 +228,7 @@ IMPLEMENT_FUNCTION(13, Ivo, leaveTableWithSalko)
getSavePoints()->push(kEntityIvo, kEntityTables2, kActionDrawTablesWithChairs, "009E");
getEntities()->clearSequences(kEntitySalko);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -249,7 +246,7 @@ IMPLEMENT_FUNCTION(14, Ivo, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Ivo, setup_chapter1Handler));
break;
case kActionDefault:
@@ -374,7 +371,7 @@ IMPLEMENT_FUNCTION(18, Ivo, chapter2)
break;
case kActionNone:
- TIME_CHECK(kTime1777500, params->param1, setup_function19);
+ Entity::timeCheck(kTime1777500, params->param1, WRAP_SETUP_FUNCTION(Ivo, setup_function19));
break;
case kActionDefault:
diff --git a/engines/lastexpress/entities/ivo.h b/engines/lastexpress/entities/ivo.h
index cd5cb7b6be..75814336e0 100644
--- a/engines/lastexpress/entities/ivo.h
+++ b/engines/lastexpress/entities/ivo.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_IVO_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp
index 2918b1e8bd..7860836a26 100644
--- a/engines/lastexpress/entities/kahina.cpp
+++ b/engines/lastexpress/entities/kahina.cpp
@@ -32,10 +32,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -90,7 +88,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION_I(4, Kahina, updateFromTime, uint32)
if (savepoint.action == kAction137503360) {
ENTITY_PARAM(0, 2) = 1;
- CALLBACK_ACTION();
+ callbackAction();
}
Entity::updateFromTime(savepoint);
@@ -111,7 +109,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
if (params->param1 < getState()->time && !params->param2) {
params->param2 = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -141,7 +139,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
case 1:
if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -151,7 +149,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
case 2:
case 3:
if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -163,7 +161,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
case 4:
if (ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -173,7 +171,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
case 5:
if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -185,7 +183,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
case kAction137503360:
ENTITY_PARAM(0, 2) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -198,12 +196,12 @@ IMPLEMENT_FUNCTION_II(7, Kahina, updateEntity2, CarIndex, EntityPosition)
case kActionNone:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
} else if (getEntities()->isDistanceBetweenEntities(kEntityKahina, kEntityPlayer, 1000)
&& !getEntities()->isInGreenCarEntrance(kEntityPlayer)
&& !getEntities()->isInsideCompartments(kEntityPlayer)
@@ -211,14 +209,14 @@ IMPLEMENT_FUNCTION_II(7, Kahina, updateEntity2, CarIndex, EntityPosition)
if (getData()->car == kCarGreenSleeping || getData()->car == kCarRedSleeping) {
ENTITY_PARAM(0, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
}
}
break;
case kAction137503360:
ENTITY_PARAM(0, 2) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -249,7 +247,7 @@ IMPLEMENT_FUNCTION(10, Kahina, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Kahina, setup_chapter1Handler));
break;
case kActionDefault:
@@ -269,7 +267,7 @@ IMPLEMENT_FUNCTION(11, Kahina, chapter1Handler)
return;
if (getProgress().jacket != kJacketOriginal)
- TIME_CHECK_SAVEPOINT(kTime1107000, params->param1, kEntityKahina, kEntityMertens, kAction238732837);
+ Entity::timeCheckSavepoint(kTime1107000, params->param1, kEntityKahina, kEntityMertens, kAction238732837);
if (getProgress().eventMertensKronosInvitation)
setup_function12();
@@ -282,7 +280,7 @@ IMPLEMENT_FUNCTION(12, Kahina, function12)
break;
case kActionNone:
- TIME_CHECK(kTime1485000, params->param2, setup_function13);
+ Entity::timeCheck(kTime1485000, params->param2, WRAP_SETUP_FUNCTION(Kahina, setup_function13));
break;
case kActionKnock:
@@ -372,12 +370,12 @@ IMPLEMENT_FUNCTION(14, Kahina, function14)
case kActionExitCompartment:
getEntities()->exitCompartment(kEntityKahina, kObjectCompartmentF);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction4:
getEntities()->exitCompartment(kEntityKahina, kObjectCompartmentF);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -396,10 +394,10 @@ IMPLEMENT_FUNCTION(15, Kahina, function15)
case kActionNone:
if (params->param2 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)
+ if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)) {
setCallback(9);
setup_updateEntity(kCarRedSleeping, kPosition_4070);
- UPDATE_PARAM_PROC_END
+ }
}
break;
@@ -542,7 +540,7 @@ IMPLEMENT_FUNCTION(15, Kahina, function15)
case 17:
getEntities()->clearSequences(kEntityKahina);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -582,18 +580,18 @@ IMPLEMENT_FUNCTION(17, Kahina, chapter2Handler)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM_PROC(params->param2, getState()->time, 9000)
+ if (Entity::updateParameter(params->param2, getState()->time, 9000)) {
params->param1 = 1;
params->param2 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (getEvent(kEventKahinaAskSpeakFirebird) && getEvent(kEventKronosConversationFirebird) && getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 900)
+ if (Entity::updateParameter(params->param3, getState()->time, 900)) {
setCallback(1);
setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird);
break;
- UPDATE_PARAM_PROC_END
+ }
}
label_callback_3:
@@ -729,7 +727,7 @@ IMPLEMENT_FUNCTION_II(19, Kahina, function19, CarIndex, EntityPosition)
RESET_ENTITY_STATE(kEntityKahina, Kahina, setup_function22);
if (getEntities()->updateEntity(kEntityKahina, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -745,7 +743,7 @@ IMPLEMENT_FUNCTION_II(19, Kahina, function19, CarIndex, EntityPosition)
case kActionDefault:
if (getEntities()->updateEntity(kEntityKahina, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -787,16 +785,17 @@ label_callback_2:
}
if (!params->param1) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 9000)
+ if (Entity::updateParameter(params->param3, getState()->time, 9000)) {
params->param1 = 1;
params->param3 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (getEvent(kEventKahinaAskSpeakFirebird)
&& !getEvent(kEventKronosConversationFirebird)
&& getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) {
- UPDATE_PARAM(params->param4, getState()->time, 900);
+ if (!Entity::updateParameter(params->param4, getState()->time, 900))
+ break;
setCallback(3);
setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird);
@@ -928,11 +927,11 @@ IMPLEMENT_FUNCTION(21, Kahina, function21)
params->param3 = (uint)getState()->time + 4500;
if (params->param6 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)
+ if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)) {
setCallback(2);
setup_function23();
break;
- UPDATE_PARAM_PROC_END
+ }
}
}
@@ -943,14 +942,14 @@ label_callback_2:
params->param4 = (uint)getState()->time + 4500;
if (params->param6 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)
+ if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)) {
getSound()->playSound(kEntityPlayer, "LIB014", getSound()->getSoundFlag(kEntityKahina));
getSound()->playSound(kEntityPlayer, "LIB015", getSound()->getSoundFlag(kEntityKahina));
getEntities()->drawSequenceLeft(kEntityKahina, "202a");
params->param2 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
}
@@ -1125,7 +1124,7 @@ IMPLEMENT_FUNCTION(23, Kahina, function23)
case 7:
getEntities()->clearSequences(kEntityKahina);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1262,7 +1261,7 @@ IMPLEMENT_FUNCTION(25, Kahina, function25)
getProgress().field_78 = 1;
ENTITY_PARAM(0, 3) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -1303,7 +1302,7 @@ IMPLEMENT_FUNCTION(25, Kahina, function25)
case 13:
getEntities()->clearSequences(kEntityKahina);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1387,7 +1386,7 @@ IMPLEMENT_FUNCTION(26, Kahina, function26)
getInventory()->setLocationAndProcess(kItemBriefcase, kObjectLocation2);
getProgress().field_78 = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -1429,7 +1428,7 @@ IMPLEMENT_FUNCTION(26, Kahina, function26)
case 9:
getEntities()->clearSequences(kEntityKahina);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
diff --git a/engines/lastexpress/entities/kahina.h b/engines/lastexpress/entities/kahina.h
index b25053e339..7479cf76f9 100644
--- a/engines/lastexpress/entities/kahina.h
+++ b/engines/lastexpress/entities/kahina.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_KAHINA_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/kronos.cpp b/engines/lastexpress/entities/kronos.cpp
index 134dce9c81..26ce3ca424 100644
--- a/engines/lastexpress/entities/kronos.cpp
+++ b/engines/lastexpress/entities/kronos.cpp
@@ -39,10 +39,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -128,7 +126,7 @@ IMPLEMENT_FUNCTION(7, Kronos, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Kronos, setup_chapter1Handler));
break;
case kActionDefault:
@@ -149,7 +147,7 @@ IMPLEMENT_FUNCTION(8, Kronos, chapter1Handler)
break;
case kActionNone:
- TIME_CHECK(kTime1489500, params->param2, setup_function11);
+ Entity::timeCheck(kTime1489500, params->param2, WRAP_SETUP_FUNCTION(Kronos, setup_function11));
break;
case kAction171849314:
@@ -191,7 +189,7 @@ IMPLEMENT_FUNCTION(10, Kronos, function10)
break;
case kActionNone:
- TIME_CHECK(kTime1489500, params->param1, setup_function11);
+ Entity::timeCheck(kTime1489500, params->param1, WRAP_SETUP_FUNCTION(Kronos, setup_function11));
break;
case kActionDefault:
@@ -295,10 +293,10 @@ IMPLEMENT_FUNCTION(15, Kronos, function15)
case kActionNone:
if (params->param1 && !getEntities()->isInSalon(kEntityBoutarel)) {
- UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 75)
+ if (Entity::updateParameter(params->param2, getState()->timeTicks, 75)) {
setup_function16();
break;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param3 != kTimeInvalid && getState()->time > kTime2002500) {
@@ -407,8 +405,7 @@ IMPLEMENT_FUNCTION(18, Kronos, function18)
params->param2 = 1;
}
- TIME_CHECK(kTime2106000, params->param3, setup_function19)
- else {
+ if (!Entity::timeCheck(kTime2106000, params->param3, WRAP_SETUP_FUNCTION(Kronos, setup_function19))) {
if (params->param1 && getEntities()->isInKronosSanctum(kEntityPlayer)) {
setCallback(1);
setup_savegame(kSavegameTypeEvent, kEventKahinaPunchSuite4);
@@ -528,9 +525,9 @@ IMPLEMENT_FUNCTION(20, Kronos, function20)
}
if (CURRENT_PARAM(1, 2) != kTimeInvalid && params->param7 < getState()->time) {
- UPDATE_PARAM_PROC_TIME(params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)
+ if (Entity::updateParameterTime((TimeValue)params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)) {
getSavePoints()->push(kEntityKronos, kEntityKahina, kAction237555748);
- UPDATE_PARAM_PROC_END
+ }
}
if (!params->param1)
diff --git a/engines/lastexpress/entities/kronos.h b/engines/lastexpress/entities/kronos.h
index 4c61b98620..a7693fcd46 100644
--- a/engines/lastexpress/entities/kronos.h
+++ b/engines/lastexpress/entities/kronos.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_KRONOS_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp
index 0e67b45cd2..af86ef8cdd 100644
--- a/engines/lastexpress/entities/mahmud.cpp
+++ b/engines/lastexpress/entities/mahmud.cpp
@@ -34,10 +34,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -86,7 +84,8 @@ IMPLEMENT_FUNCTION_SIII(4, Mahmud, enterExitCompartment2, ObjectIndex, uint32, O
break;
case kActionNone:
- UPDATE_PARAM(params->param7, getState()->timeTicks, params->param5);
+ if (!Entity::updateParameter(params->param7, getState()->timeTicks, params->param5))
+ break;
if (!getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingUp))
getScenes()->loadSceneFromObject((ObjectIndex)params->param6, true);
@@ -95,7 +94,7 @@ IMPLEMENT_FUNCTION_SIII(4, Mahmud, enterExitCompartment2, ObjectIndex, uint32, O
case kActionExitCompartment:
getEntities()->exitCompartment(kEntityMahmud, (ObjectIndex)params->param4);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -146,7 +145,8 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool)
break;
case kActionNone:
- UPDATE_PARAM(params->param6, getState()->time, 13500);
+ if (!Entity::updateParameter(params->param6, getState()->time, 13500))
+ break;
getObjects()->update(kObjectCompartment5, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand);
getObjects()->update(kObjectCompartment6, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand);
@@ -267,7 +267,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityMahmud);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -392,7 +392,7 @@ IMPLEMENT_FUNCTION(11, Mahmud, function11)
getEntities()->clearSequences(kEntityMahmud);
getObjects()->update(kObjectCompartment4, kEntityMahmud, kObjectLocation3, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -471,7 +471,7 @@ IMPLEMENT_FUNCTION(12, Mahmud, function12)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityMahmud);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -537,7 +537,7 @@ IMPLEMENT_FUNCTION(13, Mahmud, function13)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityMahmud);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -560,7 +560,8 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler)
if (!params->param2 && getProgress().chapter == kChapter1) {
- TIME_CHECK_CALLBACK(kTime1098000, params->param6, 1, setup_function13);
+ if (Entity::timeCheckCallback(kTime1098000, params->param6, 1, WRAP_SETUP_FUNCTION(Mahmud, setup_function13)))
+ break;
if (!getSoundQueue()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) {
params->param7 = 1;
@@ -572,7 +573,8 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler)
}
if (params->param5) {
- UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+ break;
params->param4 = 1;
params->param5 = 0;
@@ -732,7 +734,7 @@ IMPLEMENT_FUNCTION(15, Mahmud, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chaptersHandler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Mahmud, setup_chaptersHandler));
break;
case kActionDefault:
diff --git a/engines/lastexpress/entities/mahmud.h b/engines/lastexpress/entities/mahmud.h
index 5feb95cba5..685100f078 100644
--- a/engines/lastexpress/entities/mahmud.h
+++ b/engines/lastexpress/entities/mahmud.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_MAHMUD_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/max.cpp b/engines/lastexpress/entities/max.cpp
index eacc38bf60..abd2aae9e4 100644
--- a/engines/lastexpress/entities/max.cpp
+++ b/engines/lastexpress/entities/max.cpp
@@ -31,10 +31,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -91,7 +89,8 @@ IMPLEMENT_FUNCTION(6, Max, chapter12_handler)
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->time, params->param1);
+ if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+ break;
if (!getSoundQueue()->isBuffered(kEntityMax))
getSound()->playSound(kEntityMax, "Max1122");
@@ -125,7 +124,8 @@ IMPLEMENT_FUNCTION(7, Max, function7)
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->time, params->param1)
+ if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+ break;
if (!getSoundQueue()->isBuffered(kEntityMax))
getSound()->playSound(kEntityMax, "Max1122");
@@ -186,7 +186,7 @@ IMPLEMENT_FUNCTION(7, Max, function7)
case kAction101687594:
getEntities()->clearSequences(kEntityMax);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction122358304:
@@ -195,7 +195,7 @@ IMPLEMENT_FUNCTION(7, Max, function7)
getObjects()->update(kObjectCompartmentF, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
getObjects()->update(kObject53, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction158007856:
@@ -214,7 +214,8 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler)
break;
case kActionNone:
- UPDATE_PARAM(params->param3, getState()->time, params->param2);
+ if (!Entity::updateParameter(params->param3, getState()->time, params->param2))
+ break;
if (!getSoundQueue()->isBuffered(kEntityMax))
getSound()->playSound(kEntityMax, "Max3101");
@@ -323,7 +324,7 @@ IMPLEMENT_FUNCTION(10, Max, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter12_handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Max, setup_chapter12_handler));
break;
case kActionDefault:
@@ -392,7 +393,8 @@ IMPLEMENT_FUNCTION(13, Max, chapter3Handler)
break;
}
- UPDATE_PARAM(params->param3, getState()->time, params->param1);
+ if (!Entity::updateParameter(params->param3, getState()->time, params->param1))
+ break;
if (!getSoundQueue()->isBuffered(kEntityMax))
getSound()->playSound(kEntityMax, "Max1122");
@@ -514,7 +516,8 @@ IMPLEMENT_FUNCTION(15, Max, function15)
}
if (!params->param1) {
- UPDATE_PARAM(params->param3, getState()->time, 900);
+ if (!Entity::updateParameter(params->param3, getState()->time, 900))
+ break;
getSavePoints()->push(kEntityMax, kEntityCoudert, kAction157026693);
}
diff --git a/engines/lastexpress/entities/max.h b/engines/lastexpress/entities/max.h
index 17b58475aa..acd8235e89 100644
--- a/engines/lastexpress/entities/max.h
+++ b/engines/lastexpress/entities/max.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_MAX_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index d88962fce2..97dd293793 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -32,21 +32,11 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
-#define SAVEGAME_BLOOD_JACKET() \
- if (getProgress().jacket == kJacketBlood \
- && getEntities()->isDistanceBetweenEntities(kEntityMertens, kEntityPlayer, 1000) \
- && !getEntities()->isInsideCompartments(kEntityPlayer) \
- && !getEntities()->checkFields10(kEntityPlayer)) { \
- setCallback(1); \
- setup_savegame(kSavegameTypeEvent, kEventMertensBloodJacket); \
- }
Mertens::Mertens(LastExpressEngine *engine) : Entity(engine, kEntityMertens) {
ADD_CALLBACK_FUNCTION(Mertens, reset);
@@ -117,11 +107,11 @@ IMPLEMENT_FUNCTION_S(2, Mertens, bloodJacket)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -144,7 +134,7 @@ IMPLEMENT_FUNCTION_SI(3, Mertens, enterExitCompartment, ObjectIndex)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
return;
case kActionCallback:
@@ -165,12 +155,12 @@ IMPLEMENT_FUNCTION_SI(4, Mertens, enterExitCompartment2, ObjectIndex)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
return;
case kAction4:
getEntities()->exitCompartment(kEntityMertens, (ObjectIndex)params->param4);
- CALLBACK_ACTION();
+ callbackAction();
return;
case kActionCallback:
@@ -191,13 +181,13 @@ IMPLEMENT_FUNCTION_SIII(5, Mertens, enterExitCompartment3, ObjectIndex, EntityPo
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionExitCompartment:
getEntities()->exitCompartment(_entityIndex, (ObjectIndex)params->param4);
getData()->entityPosition = (EntityPosition)params->param5;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -229,15 +219,15 @@ IMPLEMENT_FUNCTION(6, Mertens, callbackActionOnDirection)
case kActionNone:
if (getData()->direction != kDirectionRight) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -256,11 +246,11 @@ IMPLEMENT_FUNCTION_S(7, Mertens, playSound)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -283,11 +273,11 @@ IMPLEMENT_FUNCTION_S(8, Mertens, playSound16)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -310,14 +300,6 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
-
-#define LOADSCENE_FROM_POSITION() \
- if (getData()->direction != kDirectionUp) { \
- getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750)); \
- } else { \
- getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition - 750), true); \
- }
-
switch (savepoint.action) {
default:
break;
@@ -333,7 +315,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
|| getEntities()->checkFields10(kEntityPlayer)) {
if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -364,7 +346,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) {
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -395,7 +377,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
params->param3 = 1;
if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -416,7 +398,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
ENTITY_PARAM(0, 7) = 0;
if (params->param1 != 3 || (params->param2 != kPosition_8200 && params->param2 != kPosition_9510)) {
- LOADSCENE_FROM_POSITION();
+ loadSceneFromPosition();
break;
}
@@ -428,7 +410,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
getEntities()->updateEntity(kEntityMertens, kCarGreenSleeping, kPosition_2000);
getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750));
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -444,35 +426,33 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
getEntities()->updateEntity(kEntityMertens, kCarGreenSleeping, kPosition_2000);
getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750));
- CALLBACK_ACTION();
+ callbackAction();
break;
}
- LOADSCENE_FROM_POSITION();
+ loadSceneFromPosition();
break;
case 4:
getAction()->playAnimation(kEventMertensKronosConcertInvitation);
ENTITY_PARAM(2, 4) = 0;
- LOADSCENE_FROM_POSITION();
+ loadSceneFromPosition();
break;
case 5:
getAction()->playAnimation(getData()->entityPosition < getEntityData(kEntityPlayer)->entityPosition ? kEventMertensAskTylerCompartmentD : kEventMertensAskTylerCompartment);
- LOADSCENE_FROM_POSITION();
+ loadSceneFromPosition();
break;
case 6:
getAction()->playAnimation(kEventMertensDontMakeBed);
- LOADSCENE_FROM_POSITION();
+ loadSceneFromPosition();
ENTITY_PARAM(0, 4) = 0;
break;
}
break;
}
-
-#undef LOADSCENE_FROM_POSITION
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -482,11 +462,12 @@ IMPLEMENT_FUNCTION_I(11, Mertens, function11, uint32)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
- UPDATE_PARAM(params->param2, getState()->time, params->param1)
+ if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+ break;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionCallback:
@@ -506,7 +487,7 @@ IMPLEMENT_FUNCTION_I(12, Mertens, bonsoir, EntityIndex)
return;
if (getSoundQueue()->isBuffered(kEntityMertens)) {
- CALLBACK_ACTION();
+ callbackAction();
return;
}
@@ -540,7 +521,7 @@ IMPLEMENT_FUNCTION_I(12, Mertens, bonsoir, EntityIndex)
getSound()->playSound(kEntityMertens, "CON1112G");
}
- CALLBACK_ACTION();
+ callbackAction();
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -550,23 +531,23 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
if (!params->param2 && !params->param3) {
- UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 75)
+ if (Entity::updateParameter(params->param4, getState()->timeTicks, 75)) {
getData()->inventoryItem = kItemNone;
setCallback(5);
setup_function18();
break;
- UPDATE_PARAM_PROC_END
+ }
}
- UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 225)
+ if (Entity::updateParameter(params->param5, getState()->timeTicks, 225)) {
getData()->inventoryItem = kItemNone;
setCallback(6);
setup_function18();
break;
- UPDATE_PARAM_PROC_END
+ }
getData()->inventoryItem = (getProgress().chapter == kChapter1
&& !ENTITY_PARAM(2, 1)
@@ -640,7 +621,7 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool)
case 6:
case 9:
case 10:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 7:
@@ -672,7 +653,7 @@ IMPLEMENT_FUNCTION_I(14, Mertens, function14, EntityIndex)
break;
case kActionNone:
- SAVEGAME_BLOOD_JACKET();
+ Entity::savegameBloodJacket();
break;
case kActionDefault:
@@ -719,7 +700,7 @@ IMPLEMENT_FUNCTION_I(14, Mertens, function14, EntityIndex)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -783,7 +764,7 @@ IMPLEMENT_FUNCTION_I(15, Mertens, function15, bool)
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -860,7 +841,7 @@ IMPLEMENT_FUNCTION_I(16, Mertens, function16, bool)
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -888,7 +869,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17)
getScenes()->loadSceneFromItemPosition(kItem7);
ENTITY_PARAM(2, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -926,7 +907,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17)
break;
case 2:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -944,7 +925,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17)
getSavePoints()->push(kEntityMertens, kEntityMertens, kActionDrawScene);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -970,7 +951,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18)
getInventory()->setLocationAndProcess(kItem7, kObjectLocation1);
ENTITY_PARAM(2, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -978,7 +959,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18)
getScenes()->loadSceneFromItemPosition(kItem7);
ENTITY_PARAM(2, 1) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -1009,7 +990,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18)
ENTITY_PARAM(0, 1) = 0;
getData()->inventoryItem = kItemNone;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -1025,7 +1006,7 @@ IMPLEMENT_FUNCTION(19, Mertens, function19)
if (ENTITY_PARAM(2, 1)) {
getInventory()->setLocationAndProcess(kItem7, kObjectLocation1);
ENTITY_PARAM(2, 1) = 0;
- CALLBACK_ACTION();
+ callbackAction();
} else {
setCallback(1);
setup_bloodJacket("601C");
@@ -1039,7 +1020,7 @@ IMPLEMENT_FUNCTION(19, Mertens, function19)
if (!getEntities()->isPlayerPosition(kCarGreenSleeping, 2))
getData()->entityPosition = kPosition_2088;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -1057,7 +1038,7 @@ IMPLEMENT_FUNCTION(20, Mertens, function20)
if (ENTITY_PARAM(2, 1)) {
ENTITY_PARAM(2, 1) = 0;
- CALLBACK_ACTION();
+ callbackAction();
} else {
setCallback(1);
setup_bloodJacket("601C");
@@ -1066,7 +1047,7 @@ IMPLEMENT_FUNCTION(20, Mertens, function20)
case kActionCallback:
if (getCallback() == 1)
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -1078,11 +1059,12 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex)
break;
case kActionNone:
- UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->time, 300)
+ if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 300)) {
getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityMertens));
- UPDATE_PARAM_PROC_END
+ }
- UPDATE_PARAM(CURRENT_PARAM(1, 5), getState()->time, 900);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 5), getState()->time, 900))
+ break;
// Update objects
getObjects()->updateLocation2((ObjectIndex)params->param1, kObjectLocation1);
@@ -1092,7 +1074,7 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex)
if (params->param2)
getObjects()->update((ObjectIndex)params->param2, (EntityIndex)params->param8, (ObjectLocation)CURRENT_PARAM(1, 1), (CursorStyle)CURRENT_PARAM(1, 2), (CursorStyle)CURRENT_PARAM(1, 3));
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionKnock:
@@ -1222,7 +1204,7 @@ IMPLEMENT_FUNCTION(22, Mertens, function22)
break;
case 9:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1291,7 +1273,7 @@ IMPLEMENT_FUNCTION(23, Mertens, function23)
case 6:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1306,7 +1288,8 @@ IMPLEMENT_FUNCTION(24, Mertens, function24)
case kActionNone:
if (!params->param1) {
- UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+ break;
setCallback(3);
setup_enterExitCompartment3("601Rc", kObjectCompartment3, kPosition_6470, kPosition_6130);
@@ -1351,7 +1334,7 @@ IMPLEMENT_FUNCTION(24, Mertens, function24)
case 5:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1380,7 +1363,7 @@ IMPLEMENT_FUNCTION(24, Mertens, function24)
break;
case 9:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1409,7 +1392,8 @@ IMPLEMENT_FUNCTION(25, Mertens, function25)
case kActionNone:
if (!params->param1) {
- UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+ break;
setCallback(3);
setup_enterExitCompartment3("601Zb", kObjectCompartment2, kPosition_7500, kPositionNone);
@@ -1458,7 +1442,7 @@ IMPLEMENT_FUNCTION(25, Mertens, function25)
case 5:
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -1492,7 +1476,7 @@ IMPLEMENT_FUNCTION(25, Mertens, function25)
break;
case 9:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1547,7 +1531,7 @@ IMPLEMENT_FUNCTION_I(26, Mertens, function26, bool)
case 2:
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -1613,7 +1597,7 @@ IMPLEMENT_FUNCTION_I(26, Mertens, function26, bool)
getData()->location = kLocationOutsideCompartment;
getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1628,17 +1612,17 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType)
case kActionNone:
if (getProgress().field_14 == 29) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
- UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 150)
+ if (Entity::updateParameter(params->param2, getState()->timeTicks, 150)) {
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
setCallback(10);
setup_playSound16("CON1018A");
break;
- UPDATE_PARAM_PROC_END
+ }
label_callback10:
if (!params->param3)
@@ -1646,7 +1630,8 @@ label_callback10:
if (params->param3 >= getState()->timeTicks) {
label_callback11:
- UPDATE_PARAM(params->param4, getState()->timeTicks, 375);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 375))
+ break;
getSound()->playSound(kEntityPlayer, "LIB033");
@@ -1680,7 +1665,7 @@ label_callback11:
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
} else {
@@ -1738,7 +1723,7 @@ label_callback11:
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
} else {
@@ -1763,7 +1748,7 @@ label_callback11:
default:
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 1:
@@ -1821,7 +1806,7 @@ label_callback11:
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
} else {
@@ -1930,7 +1915,7 @@ label_callback11:
getData()->location = kLocationOutsideCompartment;
getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 8:
@@ -1957,7 +1942,7 @@ label_callback11:
case 19:
case 22:
case 28:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 15:
@@ -1969,7 +1954,7 @@ label_callback11:
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 16:
@@ -1981,27 +1966,27 @@ label_callback11:
getSound()->playSound(kEntityPlayer, "LIB015");
getScenes()->loadScene(kScene41);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 23:
getProgress().eventMertensAugustWaiting = true;
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 24:
getProgress().eventMertensKronosInvitation = true;
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 25:
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2053,7 +2038,7 @@ IMPLEMENT_FUNCTION_S(28, Mertens, function28)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2115,7 +2100,7 @@ IMPLEMENT_FUNCTION_SS(29, Mertens, function29)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2140,14 +2125,14 @@ IMPLEMENT_FUNCTION_I(30, Mertens, function30, MertensActionType)
case kActionDefault:
switch (params->param1) {
default:
- CALLBACK_ACTION();
+ callbackAction();
return;
case 1:
params->param2 = kPosition_8200;
if (getProgress().field_14) {
- CALLBACK_ACTION();
+ callbackAction();
return;
}
@@ -2273,7 +2258,7 @@ IMPLEMENT_FUNCTION_I(30, Mertens, function30, MertensActionType)
break;
case 9:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2312,7 +2297,7 @@ IMPLEMENT_FUNCTION_I(31, Mertens, function31, MertensActionType)
case 2:
case 3:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2360,7 +2345,7 @@ IMPLEMENT_FUNCTION(32, Mertens, function32)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2382,7 +2367,7 @@ IMPLEMENT_FUNCTION(33, Mertens, function33)
setCallback(ENTITY_PARAM(0, 8) ? 1 : 3);
setup_updateEntity(kCarGreenSleeping, ENTITY_PARAM(0, 8) ? kPosition_1500 : kPosition_540);
} else {
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -2401,7 +2386,7 @@ IMPLEMENT_FUNCTION(33, Mertens, function33)
case 2:
ENTITY_PARAM(1, 8) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 3:
@@ -2480,7 +2465,7 @@ IMPLEMENT_FUNCTION(33, Mertens, function33)
break;
}
- CALLBACK_ACTION();
+ callbackAction();
break;
case 12:
@@ -2493,13 +2478,13 @@ IMPLEMENT_FUNCTION(33, Mertens, function33)
break;
}
- CALLBACK_ACTION();
+ callbackAction();
break;
case 13:
ENTITY_PARAM(2, 2) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2513,7 +2498,7 @@ IMPLEMENT_FUNCTION(34, Mertens, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Mertens, setup_chapter1Handler));
break;
case kActionDefault:
@@ -2548,7 +2533,7 @@ IMPLEMENT_FUNCTION(35, Mertens, function35)
case kActionDefault:
if (getProgress().field_14 == 29) {
- CALLBACK_ACTION();
+ callbackAction();
break;
} else {
getProgress().field_14 = 3;
@@ -2589,7 +2574,7 @@ IMPLEMENT_FUNCTION(35, Mertens, function35)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
case 5:
@@ -2611,7 +2596,7 @@ IMPLEMENT_FUNCTION(35, Mertens, function35)
break;
case 7:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2626,7 +2611,7 @@ IMPLEMENT_FUNCTION(36, Mertens, function36)
case kActionDefault:
if (getProgress().field_14 == 29) {
- CALLBACK_ACTION();
+ callbackAction();
} else {
getProgress().field_14 = 3;
@@ -2712,7 +2697,7 @@ IMPLEMENT_FUNCTION(36, Mertens, function36)
case 6:
case 9:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2767,7 +2752,7 @@ IMPLEMENT_FUNCTION(37, Mertens, function37)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2791,12 +2776,12 @@ IMPLEMENT_FUNCTION(38, Mertens, function38)
case kActionDefault:
if (!ENTITY_PARAM(0, 4)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (getProgress().field_14 == 29) {
- CALLBACK_ACTION();
+ callbackAction();
} else {
setCallback(1);
setup_updateEntity(kCarGreenSleeping, kPosition_8200);
@@ -2810,7 +2795,7 @@ IMPLEMENT_FUNCTION(38, Mertens, function38)
case 1:
if (!ENTITY_PARAM(0, 4)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -2820,7 +2805,7 @@ IMPLEMENT_FUNCTION(38, Mertens, function38)
case 2:
ENTITY_PARAM(0, 4) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2894,7 +2879,7 @@ IMPLEMENT_FUNCTION(39, Mertens, function39)
break;
case 10:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -2940,7 +2925,7 @@ IMPLEMENT_FUNCTION(40, Mertens, function40)
case 5:
ENTITY_PARAM(0, 6) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -3013,7 +2998,7 @@ IMPLEMENT_FUNCTION(42, Mertens, function42)
getData()->inventoryItem = kItemInvalid;
if (!params->param2) {
- TIME_CHECK_SAVEPOINT(kTime1125000, params->param3, kEntityMertens, kEntityMahmud, kAction170483072);
+ Entity::timeCheckSavepoint(kTime1125000, params->param3, kEntityMertens, kEntityMahmud, kAction170483072);
if (params->param4 != kTimeInvalid && getState()->time > kTimeCityChalons) {
@@ -3040,11 +3025,11 @@ IMPLEMENT_FUNCTION(42, Mertens, function42)
label_callback_8:
if (getState()->time > kTime1215000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
- UPDATE_PARAM_PROC(params->param5, getState()->time, 2700)
+ if (Entity::updateParameter(params->param5, getState()->time, 2700)) {
getEntities()->drawSequenceLeft(kEntityMertens, "601E");
ENTITY_PARAM(0, 1) = 1;
params->param5 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (ENTITY_PARAM(0, 8)) {
@@ -3547,19 +3532,23 @@ label_callback_5:
}
label_callback_6:
- TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 7, setup_function28, "CON3012");
+ if (Entity::timeCheckCallback(kTime1971000, params->param1, 7, "CON3012", WRAP_SETUP_FUNCTION_S(Mertens, setup_function28)))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK(kTime2117700, params->param2, 8, setup_function32);
+ if (Entity::timeCheckCallback(kTime2117700, params->param2, 8, WRAP_SETUP_FUNCTION(Mertens, setup_function32)))
+ break;
label_callback_8:
- TIME_CHECK_CALLBACK_1(kTime2124000, params->param3, 9, setup_function28, "CON2010");
+ if (Entity::timeCheckCallback(kTime2124000, params->param3, 9, "CON2010", WRAP_SETUP_FUNCTION_S(Mertens, setup_function28)))
+ break;
label_callback_9:
- TIME_CHECK_CALLBACK(kTime2146500, params->param4, 10, setup_function32);
+ if (Entity::timeCheckCallback(kTime2146500, params->param4, 10, WRAP_SETUP_FUNCTION(Mertens, setup_function32)))
+ break;
label_callback_10:
- TIME_CHECK_CALLBACK(kTime2169000, params->param5, 11, setup_function32);
+ Entity::timeCheckCallback(kTime2169000, params->param5, 11, WRAP_SETUP_FUNCTION(Mertens, setup_function32));
break;
case kAction11:
@@ -3742,21 +3731,26 @@ label_callback_3:
label_callback_4:
if (!params->param1) {
- TIME_CHECK_CALLBACK(kTime2403000, params->param2, 5, setup_function49);
+ if (Entity::timeCheckCallback(kTime2403000, params->param2, 5, WRAP_SETUP_FUNCTION(Mertens, setup_function49)))
+ break;
label_callback_5:
- TIME_CHECK_CALLBACK(kTime2430000, params->param3, 6, setup_function32);
+ if (Entity::timeCheckCallback(kTime2430000, params->param3, 6, WRAP_SETUP_FUNCTION(Mertens, setup_function32)))
+ break;
label_callback_6:
- TIME_CHECK_CALLBACK(kTime2439000, params->param4, 7, setup_function32);
+ if (Entity::timeCheckCallback(kTime2439000, params->param4, 7, WRAP_SETUP_FUNCTION(Mertens, setup_function32)))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK(kTime2448000, params->param5, 8, setup_function32);
+ if (Entity::timeCheckCallback(kTime2448000, params->param5, 8, WRAP_SETUP_FUNCTION(Mertens, setup_function32)))
+ break;
}
label_callback_8:
if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
- UPDATE_PARAM(params->param6, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param6, getState()->time, 2700))
+ break;
getEntities()->drawSequenceLeft(kEntityMertens, "601E");
@@ -3913,7 +3907,7 @@ IMPLEMENT_FUNCTION(49, Mertens, function49)
break;
case 11:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -4010,7 +4004,8 @@ IMPLEMENT_FUNCTION(53, Mertens, function53)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 0;
@@ -4108,4 +4103,15 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_NULL_FUNCTION(54, Mertens)
+//////////////////////////////////////////////////////////////////////////
+// Helper functions
+//////////////////////////////////////////////////////////////////////////
+
+void Mertens::loadSceneFromPosition() {
+ if (getData()->direction != kDirectionUp)
+ getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750));
+ else
+ getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition - 750), true);
+}
+
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/mertens.h b/engines/lastexpress/entities/mertens.h
index 31b7a97dcd..4cc58fd4ba 100644
--- a/engines/lastexpress/entities/mertens.h
+++ b/engines/lastexpress/entities/mertens.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_MERTENS_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -210,6 +209,9 @@ public:
DECLARE_FUNCTION(function53)
DECLARE_NULL_FUNCTION()
+
+private:
+ void loadSceneFromPosition();
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp
index ff3d2b6744..519a613497 100644
--- a/engines/lastexpress/entities/milos.cpp
+++ b/engines/lastexpress/entities/milos.cpp
@@ -36,10 +36,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -135,7 +133,7 @@ IMPLEMENT_FUNCTION_II(10, Milos, enterCompartmentDialog, CarIndex, EntityPositio
case kActionNone:
case kActionDefault:
if (getEntities()->updateEntity(kEntityMilos, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -173,16 +171,16 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue)
if (!params->param5 && params->param1 < getState()->time && !params->param7) {
params->param7 = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param2) {
- UPDATE_PARAM_PROC(params->param8, getState()->timeTicks, 75)
+ if (Entity::updateParameter(params->param8, getState()->timeTicks, 75)) {
params->param2 = 0;
params->param3 = 1;
getObjects()->update(kObjectCompartmentG, kEntityMilos, kObjectLocation1, kCursorNormal, kCursorNormal);
- UPDATE_PARAM_PROC_END
+ }
}
params->param8 = 0;
@@ -191,10 +189,10 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue)
break;
if (params->param6) {
- UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 4500)
+ if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 4500)) {
params->param6 = 0;
CURRENT_PARAM(1, 1) = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (!getProgress().field_CC) {
@@ -364,7 +362,7 @@ IMPLEMENT_FUNCTION(12, Milos, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Milos, setup_chapter1Handler));
break;
case kActionDefault:
@@ -394,7 +392,7 @@ IMPLEMENT_FUNCTION(13, Milos, function13)
getEntities()->clearSequences(kEntityIvo);
getEntities()->clearSequences(kEntitySalko);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -422,7 +420,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
getEntities()->exitCompartment(kEntityMilos, kObjectCompartment1, true);
getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -436,7 +434,8 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
if (CURRENT_PARAM(1, 1) < getState()->timeTicks) {
if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1) {
- UPDATE_PARAM(CURRENT_PARAM(1, 2), getState()->timeTicks, 75);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 2), getState()->timeTicks, 75))
+ break;
getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
@@ -474,7 +473,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
} else {
@@ -507,7 +506,8 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
}
label_callback_12:
- UPDATE_PARAM(CURRENT_PARAM(1, 4), getState()->timeTicks, 75);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75))
+ break;
getEntities()->exitCompartment(kEntityMilos, kObjectCompartment1, true);
@@ -593,7 +593,7 @@ label_callback_12:
getData()->location = kLocationOutsideCompartment;
getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 2:
@@ -633,7 +633,7 @@ label_callback_12:
getScenes()->loadScene(kScene41);
getData()->location = kLocationOutsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -722,7 +722,7 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler)
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime1071000, params->param3, kEntityMilos, kEntityServers1, kAction223002560);
+ Entity::timeCheckSavepoint(kTime1071000, params->param3, kEntityMilos, kEntityServers1, kAction223002560);
if (getState()->time > kTime1089000 && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
setup_function16();
@@ -730,15 +730,16 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler)
}
if (getEntities()->isPlayerPosition(kCarRestaurant, 61) && !params->param1) {
- UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 45)
+ if (Entity::updateParameter(params->param4, getState()->timeTicks, 45)) {
setCallback(1);
setup_draw("009C");
break;
- UPDATE_PARAM_PROC_END
+ }
}
if (getEntities()->isPlayerPosition(kCarRestaurant, 70) && !params->param2) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 45);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 45))
+ break;
setCallback(2);
setup_draw("009C");
@@ -953,7 +954,8 @@ IMPLEMENT_FUNCTION(21, Milos, function21)
break;
case kActionNone:
- UPDATE_PARAM(params->param2, getState()->time, 4500);
+ if (!Entity::updateParameter(params->param2, getState()->time, 4500))
+ break;
params->param1 = 1;
break;
@@ -1118,7 +1120,8 @@ IMPLEMENT_FUNCTION(24, Milos, function24)
}
if (params->param1) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
@@ -1284,14 +1287,15 @@ IMPLEMENT_FUNCTION(25, Milos, function25)
case kActionNone:
if (!getEvent(kEventMilosCompartmentVisitTyler) && !getProgress().field_54 && !ENTITY_PARAM(0, 4)) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 13500)
+ if (Entity::updateParameter(params->param3, getState()->time, 13500)) {
getSavePoints()->push(kEntityMilos, kEntityVesna, kAction155913424);
params->param3 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param1) {
- UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
@@ -1386,7 +1390,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue)
case kActionNone:
if (params->param1 < getState()->time && !params->param2) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -1415,7 +1419,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue)
case 1:
if (ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -1425,7 +1429,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue)
case 2:
case 3:
if (ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -1442,7 +1446,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue)
case 5:
if (ENTITY_PARAM(0, 2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -1461,7 +1465,7 @@ IMPLEMENT_FUNCTION_II(27, Milos, function27, CarIndex, EntityPosition)
case kActionNone:
if (getEntities()->updateEntity(kEntityMilos, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
@@ -1472,14 +1476,14 @@ IMPLEMENT_FUNCTION_II(27, Milos, function27, CarIndex, EntityPosition)
if (getData()->car == kCarRedSleeping || getData()->car == kCarGreenSleeping) {
ENTITY_PARAM(0, 2) = 1;
- CALLBACK_ACTION();
+ callbackAction();
}
}
break;
case kActionDefault:
if (getEntities()->updateEntity(kEntityMilos, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -1536,7 +1540,7 @@ IMPLEMENT_FUNCTION(29, Milos, chapter4Handler)
TIME_CHECK_PLAYSOUND_MILOS(kTime2370600, params->param5, "Mil4015");
- TIME_CHECK_SAVEPOINT(kTime2407500, params->param6, kEntityMilos, kEntityVesna, kAction55996766);
+ Entity::timeCheckSavepoint(kTime2407500, params->param6, kEntityMilos, kEntityVesna, kAction55996766);
break;
case kActionCallback:
diff --git a/engines/lastexpress/entities/milos.h b/engines/lastexpress/entities/milos.h
index d58d717f8a..e8f95dc5ff 100644
--- a/engines/lastexpress/entities/milos.h
+++ b/engines/lastexpress/entities/milos.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_MILOS_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp
index 9ca10ca374..950644cb8f 100644
--- a/engines/lastexpress/entities/mmeboutarel.cpp
+++ b/engines/lastexpress/entities/mmeboutarel.cpp
@@ -31,10 +31,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -124,7 +122,7 @@ IMPLEMENT_FUNCTION_S(8, MmeBoutarel, function8)
if (!getEntities()->isPlayerPosition(kCarRedSleeping, 2))
getData()->entityPosition = kPosition_2088;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -211,7 +209,7 @@ IMPLEMENT_FUNCTION(9, MmeBoutarel, function9)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityMmeBoutarel);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 5:
@@ -220,7 +218,7 @@ IMPLEMENT_FUNCTION(9, MmeBoutarel, function9)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityMmeBoutarel);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -246,7 +244,7 @@ IMPLEMENT_FUNCTION(10, MmeBoutarel, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_chapter1Handler));
break;
case kActionDefault:
@@ -312,7 +310,7 @@ IMPLEMENT_FUNCTION(11, MmeBoutarel, function11)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -402,7 +400,7 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13)
case kActionNone:
if (!getSoundQueue()->isBuffered(kEntityMmeBoutarel) && params->param6 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)
+ if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)) {
getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
getObjects()->update(kObject51, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
@@ -414,22 +412,24 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13)
setCallback(1);
setup_playSound("MME1037");
break;
- UPDATE_PARAM_PROC_END
+ }
}
label_callback_1:
if (getProgress().field_24 && params->param7 != kTimeInvalid) {
- UPDATE_PARAM_PROC_TIME(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)
+ if (Entity::updateParameterTime(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)) {
setCallback(2);
setup_function11();
break;
- UPDATE_PARAM_PROC_END
+ }
}
- TIME_CHECK(kTime1094400, params->param8, setup_function14);
+ if (Entity::timeCheck(kTime1094400, params->param8, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_function14)))
+ break;
if (params->param4) {
- UPDATE_PARAM(CURRENT_PARAM(1, 1), getState()->timeTicks, 75);
+ if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75))
+ break;
params->param3 = 1;
params->param4 = 0;
@@ -589,7 +589,8 @@ IMPLEMENT_FUNCTION(15, MmeBoutarel, function15)
label_callback_5:
if (params->param2) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
params->param1 = 1;
params->param2 = 0;
@@ -1018,7 +1019,8 @@ IMPLEMENT_FUNCTION(23, MmeBoutarel, chapter4Handler)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param2, getState()->time, 900);
+ if (!Entity::updateParameter(params->param2, getState()->time, 900))
+ break;
getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorKeepValue, kCursorKeepValue);
@@ -1064,10 +1066,12 @@ IMPLEMENT_FUNCTION(24, MmeBoutarel, function24)
break;
case kActionNone:
- TIME_CHECK(kTime2470500, params->param4, setup_function25);
+ if (Entity::timeCheck(kTime2470500, params->param4, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_function25)))
+ break;
if (params->param2) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
params->param1 = 1;
params->param2 = 0;
@@ -1210,7 +1214,8 @@ IMPLEMENT_FUNCTION(28, MmeBoutarel, function28)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
diff --git a/engines/lastexpress/entities/mmeboutarel.h b/engines/lastexpress/entities/mmeboutarel.h
index 772451ba15..0f6e6349fe 100644
--- a/engines/lastexpress/entities/mmeboutarel.h
+++ b/engines/lastexpress/entities/mmeboutarel.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_MMEBOUTAREL_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp
index a191273702..6e9f992390 100644
--- a/engines/lastexpress/entities/pascale.cpp
+++ b/engines/lastexpress/entities/pascale.cpp
@@ -30,10 +30,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -171,7 +169,7 @@ IMPLEMENT_FUNCTION(8, Pascale, welcomeSophieAndRebecca)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(0, 4) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -185,8 +183,8 @@ IMPLEMENT_FUNCTION(9, Pascale, sitSophieAndRebecca)
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
- break;
+ callbackAction();
+ break;
case kActionDefault:
getEntities()->drawSequenceLeft(kEntityPascale, "012C1");
@@ -217,7 +215,7 @@ IMPLEMENT_FUNCTION(10, Pascale, welcomeCath)
getScenes()->loadSceneFromPosition(kCarRestaurant, 69);
}
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction4:
@@ -239,7 +237,7 @@ IMPLEMENT_FUNCTION(10, Pascale, welcomeCath)
getScenes()->loadSceneFromPosition(kCarRestaurant, 69);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -283,7 +281,7 @@ IMPLEMENT_FUNCTION(11, Pascale, function11)
getEntities()->clearSequences(kEntityPascale);
getData()->entityPosition = kPosition_5900;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -298,7 +296,7 @@ IMPLEMENT_FUNCTION(12, Pascale, chapter1)
case kActionNone:
setup_chapter1Handler();
- break;
+ break;
case kActionDefault:
getSavePoints()->addData(kEntityPascale, kAction239072064, 0);
@@ -366,7 +364,7 @@ IMPLEMENT_FUNCTION(13, Pascale, getMessageFromAugustToTyler)
getSavePoints()->push(kEntityPascale, kEntityVerges, kActionDeliverMessageToTyler);
ENTITY_PARAM(0, 1) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -382,7 +380,7 @@ IMPLEMENT_FUNCTION(14, Pascale, sitAnna)
case kActionExitCompartment:
getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 62);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -433,7 +431,7 @@ IMPLEMENT_FUNCTION(15, Pascale, welcomeAnna)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(0, 2) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -486,7 +484,7 @@ IMPLEMENT_FUNCTION(16, Pascale, serveTatianaVassili)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(0, 3) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -648,7 +646,7 @@ IMPLEMENT_FUNCTION(21, Pascale, chapter3)
case kActionNone:
setup_chapter3Handler();
- break;
+ break;
case kActionDefault:
getEntities()->clearSequences(kEntityPascale);
@@ -685,7 +683,7 @@ label_callback:
setCallback(2);
setup_welcomeSophieAndRebecca();
}
- break;
+ break;
case kActionCallback:
if (getCallback() == 1)
@@ -727,7 +725,7 @@ IMPLEMENT_FUNCTION(23, Pascale, function23)
ENTITY_PARAM(0, 7) = 0;
getEntities()->clearSequences(kEntityPascale);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -748,7 +746,7 @@ IMPLEMENT_FUNCTION(24, Pascale, welcomeAbbot)
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kAction10:
@@ -771,7 +769,7 @@ IMPLEMENT_FUNCTION(25, Pascale, chapter4)
case kActionNone:
setup_chapter4Handler();
- break;
+ break;
case kActionDefault:
getEntities()->clearSequences(kEntityPascale);
@@ -953,7 +951,7 @@ IMPLEMENT_FUNCTION(27, Pascale, function27)
ENTITY_PARAM(1, 1) = 0;
ENTITY_PARAM(1, 2) = 1;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -999,7 +997,7 @@ IMPLEMENT_FUNCTION(28, Pascale, messageFromAnna)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(1, 2) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1037,7 +1035,7 @@ IMPLEMENT_FUNCTION(29, Pascale, function29)
case 2:
getData()->entityPosition = kPosition_850;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1075,7 +1073,7 @@ IMPLEMENT_FUNCTION(30, Pascale, function30)
case 2:
getData()->entityPosition = kPosition_5900;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1090,7 +1088,7 @@ IMPLEMENT_FUNCTION(31, Pascale, chapter5)
case kActionNone:
setup_chapter5Handler();
- break;
+ break;
case kActionDefault:
getEntities()->clearSequences(kEntityPascale);
@@ -1117,18 +1115,19 @@ IMPLEMENT_FUNCTION(33, Pascale, function33)
case kActionNone:
if (params->param4) {
- UPDATE_PARAM_PROC(params->param5, getState()->time, 4500)
+ if (Entity::updateParameter(params->param5, getState()->time, 4500)) {
getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal);
setCallback(1);
setup_playSound("Wat5010");
break;
- UPDATE_PARAM_PROC_END
+ }
}
label_callback1:
if (params->param1) {
- UPDATE_PARAM(params->param6, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 2;
diff --git a/engines/lastexpress/entities/pascale.h b/engines/lastexpress/entities/pascale.h
index 333ebcae3e..eaf0f3ba0c 100644
--- a/engines/lastexpress/entities/pascale.h
+++ b/engines/lastexpress/entities/pascale.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_PASCALE_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index b1a176b47e..5bcb6aef85 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -30,10 +30,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -179,7 +177,7 @@ IMPLEMENT_FUNCTION(15, Rebecca, function15)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityRebecca);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -261,7 +259,7 @@ IMPLEMENT_FUNCTION_I(16, Rebecca, function16, bool)
getSavePoints()->push(kEntityRebecca, kEntityTables3, kAction136455232);
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -334,7 +332,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool)
case 5:
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -343,7 +341,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool)
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -397,7 +395,7 @@ IMPLEMENT_FUNCTION(18, Rebecca, function18)
case 2:
case 3:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -473,7 +471,7 @@ IMPLEMENT_FUNCTION(19, Rebecca, function19)
case 5:
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -493,21 +491,21 @@ IMPLEMENT_FUNCTION_I(20, Rebecca, function20, TimeValue)
getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (!params->param2) {
params->param6 = 0;
} else {
- UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75)
+ if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
params->param2 = 0;
params->param3 = 1;
getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (getProgress().chapter == kChapter1 && !ENTITY_PARAM(0, 3)) {
@@ -657,7 +655,7 @@ IMPLEMENT_FUNCTION(21, Rebecca, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Rebecca, setup_chapter1Handler));
break;
case kActionDefault:
@@ -685,7 +683,8 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_1(kTime1084500, params->param3, 1, setup_playSound, "REB1015");
+ if (Entity::timeCheckCallback(kTime1084500, params->param3, 1, "REB1015", WRAP_SETUP_FUNCTION_S(Rebecca, setup_playSound)))
+ break;
if (params->param4 == kTimeInvalid)
goto label_callback_4;
@@ -699,7 +698,7 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler)
if (params->param4 >= getState()->time) {
label_callback_4:
if (params->param1) {
- UPDATE_PARAM_CHECK(params->param5, getState()->time, 900)
+ if (Entity::updateParameterCheck(params->param5, getState()->time, 900)) {
if (getEntities()->isInSalon(kEntityPlayer)) {
setCallback(5);
setup_playSound("REB1013");
@@ -710,7 +709,9 @@ label_callback_4:
label_callback_5:
if (params->param2) {
- UPDATE_PARAM(params->param6, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param6, getState()->timeTicks, 90))
+ break;
+
getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
} else {
params->param6 = 0;
@@ -774,7 +775,13 @@ IMPLEMENT_FUNCTION(23, Rebecca, function23)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_2(kTime1111500, params->param2, 3, setup_enterExitCompartment, "623De", kObjectCompartmentE);
+ if (getState()->time > kTime1111500 && !params->param2) {
+ params->param2 = 1;
+ setCallback(3);
+ setup_enterExitCompartment("623De", kObjectCompartmentE);
+
+ break;
+ }
break;
case kActionDefault:
@@ -843,12 +850,13 @@ IMPLEMENT_FUNCTION(24, Rebecca, function24)
break;
case kActionNone:
- TIME_CHECK_SAVEPOINT(kTime1134000, params->param2, kEntityRebecca, kEntityServers0, kAction223712416);
+ Entity::timeCheckSavepoint(kTime1134000, params->param2, kEntityRebecca, kEntityServers0, kAction223712416);
if (!params->param1)
break;
- TIME_CHECK_CALLBACK(kTime1165500, params->param3, 6, setup_function19);
+ if (Entity::timeCheckCallback(kTime1165500, params->param3, 6, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)))
+ break;
if (params->param4 != kTimeInvalid) {
if (getState()->time <= kTime1161000) {
@@ -965,10 +973,16 @@ IMPLEMENT_FUNCTION(26, Rebecca, function26)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_3(kTime1224000, params->param2, 1, setup_updatePosition, "118H", kCarRestaurant, 52);
+ if (getState()->time > kTime1224000 && !params->param2) {
+ params->param2 = 1;
+ setCallback(1);
+ setup_updatePosition("118H", kCarRestaurant, 52);
+ break;
+ }
if (params->param1) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90))
+ break;
getScenes()->loadSceneFromPosition(kCarRestaurant, 51);
}
@@ -1223,7 +1237,7 @@ IMPLEMENT_FUNCTION(34, Rebecca, function34)
params->param2 = (uint)getState()->time;
if (params->param2 >= getState()->time) {
- TIME_CHECK_CALLBACK(kTime2052000, params->param3, 1, setup_function19);
+ Entity::timeCheckCallback(kTime2052000, params->param3, 1, WRAP_SETUP_FUNCTION(Rebecca, setup_function19));
break;
}
}
@@ -1233,7 +1247,7 @@ IMPLEMENT_FUNCTION(34, Rebecca, function34)
getSavePoints()->push(kEntityRebecca, kEntityServers0, kAction223712416);
}
- TIME_CHECK_CALLBACK(kTime2052000, params->param3, 1, setup_function19);
+ Entity::timeCheckCallback(kTime2052000, params->param3, 1, WRAP_SETUP_FUNCTION(Rebecca, setup_function19));
break;
case kActionEndSound:
@@ -1632,7 +1646,7 @@ label_next:
label_callback_2:
if (params->param2)
- TIME_CHECK_CALLBACK(kTime2443500, params->param5, 3, setup_function19);
+ Entity::timeCheckCallback(kTime2443500, params->param5, 3, WRAP_SETUP_FUNCTION(Rebecca, setup_function19));
break;
case kActionEndSound:
@@ -1755,7 +1769,8 @@ IMPLEMENT_FUNCTION(48, Rebecca, function48)
case kActionNone:
if (params->param1) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+ break;
params->param1 = 0;
params->param2 = 1;
diff --git a/engines/lastexpress/entities/rebecca.h b/engines/lastexpress/entities/rebecca.h
index e91ee30d4d..885632f884 100644
--- a/engines/lastexpress/entities/rebecca.h
+++ b/engines/lastexpress/entities/rebecca.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_REBECCA_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp
index 63d995dc42..e8b4b4247b 100644
--- a/engines/lastexpress/entities/salko.cpp
+++ b/engines/lastexpress/entities/salko.cpp
@@ -33,10 +33,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -137,7 +135,7 @@ IMPLEMENT_FUNCTION_II(7, Salko, function7, CarIndex, EntityPosition)
break;
case kAction123668192:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -158,7 +156,7 @@ IMPLEMENT_FUNCTION(9, Salko, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Salko, setup_chapter1Handler));
break;
case kActionDefault:
@@ -301,7 +299,8 @@ IMPLEMENT_FUNCTION(15, Salko, chapter3Handler)
case kActionNone:
if (getState()->time < kTime2200500) {
- UPDATE_PARAM(params->param1, getState()->time, 81000);
+ if (!Entity::updateParameter(params->param1, getState()->time, 81000))
+ break;
setCallback(1);
setup_function16();
@@ -331,7 +330,8 @@ IMPLEMENT_FUNCTION(16, Salko, function16)
}
label_callback3:
- UPDATE_PARAM(params->param1, getState()->time, 4500);
+ if (!Entity::updateParameter(params->param1, getState()->time, 4500))
+ break;
getSavePoints()->push(kEntitySalko, kEntitySalko, kAction101169464);
break;
@@ -390,7 +390,7 @@ label_callback3:
getData()->entityPosition = kPosition_2740;
getEntities()->clearSequences(kEntitySalko);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
diff --git a/engines/lastexpress/entities/salko.h b/engines/lastexpress/entities/salko.h
index 6308211053..6ca73e39f6 100644
--- a/engines/lastexpress/entities/salko.h
+++ b/engines/lastexpress/entities/salko.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_SALKO_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/servers0.cpp b/engines/lastexpress/entities/servers0.cpp
index 989bddd662..73e0d34722 100644
--- a/engines/lastexpress/entities/servers0.cpp
+++ b/engines/lastexpress/entities/servers0.cpp
@@ -28,10 +28,7 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -113,11 +110,11 @@ IMPLEMENT_FUNCTION_NOSETUP(5, Servers0, callbackActionOnDirection)
case kActionNone:
if (getData()->direction != kDirectionRight)
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -163,7 +160,7 @@ IMPLEMENT_FUNCTION(7, Servers0, function7)
case 2:
getEntities()->clearSequences(kEntityServers0);
getData()->entityPosition = kPosition_5900;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -220,7 +217,7 @@ IMPLEMENT_FUNCTION(9, Servers0, function9)
ENTITY_PARAM(2, 2) = 0;
ENTITY_PARAM(1, 6) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -315,17 +312,17 @@ IMPLEMENT_FUNCTION(20, Servers0, chapter1Handler)
case kActionNone:
if (params->param2) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 2700);
+ if (Entity::updateParameter(params->param3, getState()->time, 2700)) {
ENTITY_PARAM(0, 4) = 1;
params->param2 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (params->param1) {
- UPDATE_PARAM_PROC(params->param4, getState()->time, 4500)
+ if (Entity::updateParameter(params->param4, getState()->time, 4500)) {
ENTITY_PARAM(0, 5) = 1;
params->param1 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (!getEntities()->isInKitchen(kEntityServers0) && !getEntities()->isSomebodyInsideRestaurantOrSalon())
@@ -486,7 +483,7 @@ IMPLEMENT_FUNCTION(25, Servers0, function25)
getEntities()->clearSequences(kEntityServers0);
ENTITY_PARAM(1, 3) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -647,7 +644,7 @@ IMPLEMENT_FUNCTION(29, Servers0, augustAnnaDateOrder)
getEntities()->clearSequences(kEntityServers0);
ENTITY_PARAM(1, 5) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -693,7 +690,7 @@ IMPLEMENT_FUNCTION(30, Servers0, function30)
getEntities()->clearSequences(kEntityServers0);
ENTITY_PARAM(2, 4) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -736,10 +733,10 @@ IMPLEMENT_FUNCTION(32, Servers0, chapter4Handler)
break;
case kActionNone:
- UPDATE_PARAM_PROC(params->param2, getState()->time, 3600)
+ if (Entity::updateParameter(params->param2, getState()->time, 3600)) {
ENTITY_PARAM(1, 8) = 1;
params->param1 = 0;
- UPDATE_PARAM_PROC_END
+ }
if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon())
break;
@@ -859,7 +856,7 @@ IMPLEMENT_FUNCTION(33, Servers0, augustOrderSteak)
getEntities()->clearSequences(kEntityServers0);
ENTITY_PARAM(1, 7) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -902,7 +899,7 @@ IMPLEMENT_FUNCTION(34, Servers0, augustServeDuck)
getEntities()->clearSequences(kEntityServers0);
ENTITY_PARAM(1, 8) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -972,7 +969,7 @@ void Servers0::handleServer(const SavePoint &savepoint, const char *name, Entity
getSavePoints()->push(kEntityServers0, entity, action);
*parameter = 0;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -1027,7 +1024,7 @@ void Servers0::serveTable(const SavePoint &savepoint, const char *seq1, EntityIn
getEntities()->clearSequences(kEntityServers0);
*parameter = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
diff --git a/engines/lastexpress/entities/servers0.h b/engines/lastexpress/entities/servers0.h
index 2e9165a410..4c35637d65 100644
--- a/engines/lastexpress/entities/servers0.h
+++ b/engines/lastexpress/entities/servers0.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_SERVERS0_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/servers1.cpp b/engines/lastexpress/entities/servers1.cpp
index 995fbbc01b..a8f4c0233c 100644
--- a/engines/lastexpress/entities/servers1.cpp
+++ b/engines/lastexpress/entities/servers1.cpp
@@ -28,10 +28,7 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -143,7 +140,7 @@ IMPLEMENT_FUNCTION(7, Servers1, function7)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(1, 2) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -219,7 +216,7 @@ IMPLEMENT_FUNCTION(9, Servers1, function9)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(0, 1) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -265,7 +262,7 @@ IMPLEMENT_FUNCTION(10, Servers1, function10)
getData()->entityPosition = kPosition_5900;
ENTITY_PARAM(0, 2) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -469,7 +466,7 @@ IMPLEMENT_FUNCTION(20, Servers1, function20)
getEntities()->drawSequenceLeft(kEntityServers1, "BLANK");
ENTITY_PARAM(0, 7) = 0;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -566,10 +563,10 @@ IMPLEMENT_FUNCTION(26, Servers1, chapter4Handler)
case kActionNone:
if (params->param2) {
- UPDATE_PARAM_PROC(params->param2, getState()->time, 900)
+ if (Entity::updateParameter(params->param2, getState()->time, 900)) {
ENTITY_PARAM(1, 5) = 1;
params->param1 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon())
@@ -705,7 +702,7 @@ void Servers1::serveTable(const SavePoint &savepoint, const char *seq1, EntityIn
if (parameter2 != NULL)
*parameter2 = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -775,7 +772,7 @@ void Servers1::serveSalon(const SavePoint &savepoint, const char *seq1, const ch
getData()->entityPosition = kPosition_5900;
*parameter = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
diff --git a/engines/lastexpress/entities/servers1.h b/engines/lastexpress/entities/servers1.h
index 13b30696f0..c8f667ec5c 100644
--- a/engines/lastexpress/entities/servers1.h
+++ b/engines/lastexpress/entities/servers1.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_SERVERS1_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/sophie.cpp b/engines/lastexpress/entities/sophie.cpp
index 57bd491949..170090005f 100644
--- a/engines/lastexpress/entities/sophie.cpp
+++ b/engines/lastexpress/entities/sophie.cpp
@@ -27,38 +27,10 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
-#define CHAPTER_IMPLEMENTATION() \
- switch (savepoint.action) { \
- default: \
- break; \
- case kActionNone: \
- setup_chaptersHandler(); \
- break; \
- case kActionDefault: \
- getEntities()->clearSequences(kEntitySophie); \
- getData()->entityPosition = kPosition_4840; \
- getData()->location = kLocationInsideCompartment; \
- getData()->car = kCarRedSleeping; \
- getData()->clothes = kClothesDefault; \
- getData()->inventoryItem = kItemNone; \
- break; \
- }
-
-#define DEFAULT_ACTION_IMPLEMENTATION() \
- if (savepoint.action == kActionDefault) { \
- getData()->entityPosition = kPosition_4840; \
- getData()->location = kLocationInsideCompartment; \
- getData()->car = kCarRedSleeping; \
- getEntities()->clearSequences(kEntitySophie); \
- }
-
Sophie::Sophie(LastExpressEngine *engine) : Entity(engine, kEntitySophie) {
ADD_CALLBACK_FUNCTION(Sophie, reset);
ADD_CALLBACK_FUNCTION(Sophie, updateEntity);
@@ -123,7 +95,7 @@ IMPLEMENT_FUNCTION_II(2, Sophie, updateEntity, CarIndex, EntityPosition)
break;
case kAction123668192:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -207,7 +179,7 @@ IMPLEMENT_FUNCTION(4, Sophie, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chaptersHandler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Sophie, setup_chaptersHandler));
break;
case kActionDefault:
@@ -220,27 +192,27 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(5, Sophie, function5)
- DEFAULT_ACTION_IMPLEMENTATION()
+ handleAction(savepoint);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(6, Sophie, chapter2)
- CHAPTER_IMPLEMENTATION()
+ handleChapter(savepoint);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(7, Sophie, chapter3)
- CHAPTER_IMPLEMENTATION()
+ handleChapter(savepoint);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(8, Sophie, chapter4)
- CHAPTER_IMPLEMENTATION()
+ handleChapter(savepoint);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(9, Sophie, function9)
- DEFAULT_ACTION_IMPLEMENTATION()
+ handleAction(savepoint);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -274,4 +246,37 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_NULL_FUNCTION(12, Sophie)
+//////////////////////////////////////////////////////////////////////////
+// Helpers functions
+//////////////////////////////////////////////////////////////////////////
+
+void Sophie::handleAction(const SavePoint &savepoint) {
+ if (savepoint.action == kActionDefault) {
+ getData()->entityPosition = kPosition_4840;
+ getData()->location = kLocationInsideCompartment;
+ getData()->car = kCarRedSleeping;
+ getEntities()->clearSequences(kEntitySophie);
+ }
+}
+
+void Sophie::handleChapter(const SavePoint &savepoint) {
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionNone:
+ setup_chaptersHandler();
+ break;
+
+ case kActionDefault:
+ getEntities()->clearSequences(kEntitySophie);
+ getData()->entityPosition = kPosition_4840;
+ getData()->location = kLocationInsideCompartment;
+ getData()->car = kCarRedSleeping;
+ getData()->clothes = kClothesDefault;
+ getData()->inventoryItem = kItemNone;
+ break;
+ }
+}
+
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/sophie.h b/engines/lastexpress/entities/sophie.h
index c2ca348027..188788bb9b 100644
--- a/engines/lastexpress/entities/sophie.h
+++ b/engines/lastexpress/entities/sophie.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_SOPHIE_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -88,6 +87,10 @@ public:
DECLARE_FUNCTION(chapter5Handler)
DECLARE_NULL_FUNCTION()
+
+private:
+ void handleAction(const SavePoint &savepoint);
+ void handleChapter(const SavePoint &savepoint);
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/tables.cpp b/engines/lastexpress/entities/tables.cpp
index 06ea4c597c..4f8d2b954d 100644
--- a/engines/lastexpress/entities/tables.cpp
+++ b/engines/lastexpress/entities/tables.cpp
@@ -29,10 +29,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/tables.h b/engines/lastexpress/entities/tables.h
index 7fcfc0499e..c213aac978 100644
--- a/engines/lastexpress/entities/tables.h
+++ b/engines/lastexpress/entities/tables.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_TABLES_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index c8901b3e30..432def6253 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -35,10 +35,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -192,7 +190,7 @@ IMPLEMENT_FUNCTION(14, Tatiana, function14)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityTatiana);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -228,7 +226,7 @@ IMPLEMENT_FUNCTION(15, Tatiana, function15)
getEntities()->exitCompartment(kEntityTatiana, kObjectCompartmentB, true);
getObjects()->update(kObjectCompartmentB, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -246,12 +244,13 @@ IMPLEMENT_FUNCTION_I(16, Tatiana, function16, uint32)
getObjects()->update(kObjectCompartmentB, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
getObjects()->update(kObject49, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param2) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
params->param2 = 0;
params->param3 = 1;
@@ -342,7 +341,7 @@ IMPLEMENT_FUNCTION(17, Tatiana, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Tatiana, setup_chapter1Handler));
break;
case kActionDefault:
@@ -375,10 +374,10 @@ IMPLEMENT_FUNCTION(18, Tatiana, function18)
}
if (!params->param1) {
- UPDATE_PARAM_PROC(params->param3, getState()->time, 4500)
+ if (Entity::updateParameter(params->param3, getState()->time, 4500)) {
getEntities()->drawSequenceRight(kEntityTatiana, "806DS");
params->param1 = 1;
- UPDATE_PARAM_PROC_END
+ }
}
}
@@ -386,14 +385,14 @@ IMPLEMENT_FUNCTION(18, Tatiana, function18)
getSavePoints()->push(kEntityTatiana, kEntityAlexei, kAction157159392);
getEntities()->clearSequences(kEntityTatiana);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
case kActionExitCompartment:
getSavePoints()->push(kEntityTatiana, kEntityAlexei, kAction188784532);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -425,27 +424,29 @@ IMPLEMENT_FUNCTION(19, Tatiana, chapter1Handler)
if (getSoundQueue()->isBuffered(kEntityTatiana) || !params->param4 || params->param3 == 2 || getSoundQueue()->isBuffered("TAT1066"))
goto label_tatiana_chapter1_2;
- UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 450)
+ if (Entity::updateParameter(params->param5, getState()->timeTicks, 450)) {
getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A");
getProgress().field_64 = 1;
params->param3++;
params->param5 = 0;
- UPDATE_PARAM_PROC_END
+ }
if (getEntities()->isPlayerPosition(kCarRestaurant, 71)) {
- UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75)
+ if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A");
getProgress().field_64 = 1;
params->param3++;
params->param6 = 0;
- UPDATE_PARAM_PROC_END
+ }
}
label_tatiana_chapter1_2:
- TIME_CHECK_SAVEPOINT(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762);
+ Entity::timeCheckSavepoint(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762);
if (params->param1) {
- UPDATE_PARAM(params->param8, getState()->timeTicks, 90);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 90))
+ break;
+
getScenes()->loadSceneFromPosition(kCarRestaurant, 65);
} else {
params->param8 = 0;
@@ -614,7 +615,7 @@ IMPLEMENT_FUNCTION(22, Tatiana, function22)
if (params->param1 == kTimeInvalid || getState()->time <= kTime1179000)
goto label_update;
- UPDATE_PARAM_PROC_TIME(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)
+ if (Entity::updateParameterTime(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)) {
label_update:
if (!getEvent(kEventTatianaAskMatchSpeakRussian)
&& !getEvent(kEventTatianaAskMatch)
@@ -623,7 +624,7 @@ label_update:
getObjects()->update(kObject25, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward);
getObjects()->update(kObjectTrainTimeTable, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward);
}
- UPDATE_PARAM_PROC_END
+ }
params->param1 = kTimeInvalid;
@@ -1022,7 +1023,7 @@ IMPLEMENT_FUNCTION(32, Tatiana, chapter3Handler)
}
if (parameters->param4 && parameters->param5) {
- UPDATE_PARAM_CHECK(parameters->param4, getState()->time, 6300)
+ if (Entity::updateParameterCheck(parameters->param4, getState()->time, 6300)) {
if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->location = kLocationOutsideCompartment;
@@ -1283,18 +1284,19 @@ IMPLEMENT_FUNCTION(37, Tatiana, function37)
params->param3 = (uint)getState()->time + 900;
if (params->param4 != kTimeInvalid && params->param3 < getState()->time) {
- UPDATE_PARAM_PROC_TIME(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)
+ if (Entity::updateParameterTime(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)) {
getProgress().field_5C = 1;
if (getEntities()->isInsideCompartment(kEntityAnna, kCarRedSleeping, kPosition_4070)) {
setup_function38();
break;
}
- UPDATE_PARAM_PROC_END
+ }
}
}
if (params->param1) {
- UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+ break;
getObjects()->update(kObjectCompartmentB, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorNormal);
getObjects()->update(kObject49, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorNormal);
@@ -1403,7 +1405,8 @@ IMPLEMENT_FUNCTION(38, Tatiana, function38)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->time, 450);
+ if (!Entity::updateParameter(params->param1, getState()->time, 450))
+ break;
getEntities()->exitCompartment(kEntityTatiana, kObjectCompartmentF, true);
@@ -1535,7 +1538,7 @@ IMPLEMENT_FUNCTION(40, Tatiana, function40)
if (getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)
|| getData()->car != getEntityData(kEntityPlayer)->car
|| getEntities()->updateEntity(kEntityTatiana, kCarKronos, kPosition_9270))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMe:
@@ -1547,7 +1550,7 @@ IMPLEMENT_FUNCTION(40, Tatiana, function40)
case kActionDefault:
if (getEntities()->updateEntity(kEntityTatiana, kCarKronos, kPosition_9270))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -1595,7 +1598,7 @@ IMPLEMENT_FUNCTION(41, Tatiana, function41)
}
getEntities()->clearSequences(kEntityTatiana);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -1629,7 +1632,7 @@ IMPLEMENT_FUNCTION(41, Tatiana, function41)
case 6:
getEntities()->clearSequences(kEntityTatiana);
- CALLBACK_ACTION();
+ callbackAction();
break;
case 4:
@@ -1952,7 +1955,8 @@ IMPLEMENT_FUNCTION(48, Tatiana, function48)
if (!params->param1 || getSoundQueue()->isBuffered(kEntityTatiana))
goto label_end;
- UPDATE_PARAM_GOTO(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30), label_end);
+ if (!Entity::updateParameter(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30)))
+ goto label_end;
getSound()->playSound(kEntityTatiana, "LIB012", kFlagDefault);
params->param2 = 0;
@@ -2199,7 +2203,8 @@ IMPLEMENT_FUNCTION(54, Tatiana, function54)
}
if (params->param1 > 3) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, 225);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, 225))
+ break;
params->param1 = 0;
params->param3 = 0;
diff --git a/engines/lastexpress/entities/tatiana.h b/engines/lastexpress/entities/tatiana.h
index c457d49b1e..8ec69db5e9 100644
--- a/engines/lastexpress/entities/tatiana.h
+++ b/engines/lastexpress/entities/tatiana.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_TATIANA_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/train.cpp b/engines/lastexpress/entities/train.cpp
index bced1da62b..e3f530ef25 100644
--- a/engines/lastexpress/entities/train.cpp
+++ b/engines/lastexpress/entities/train.cpp
@@ -32,10 +32,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -269,18 +267,20 @@ IMPLEMENT_FUNCTION(8, Train, process)
if ((getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping))
&& params->param4 && !params->param5) {
- params->param4 -= 1;
+ params->param4 -= 1;
- if (!params->param4 && getProgress().jacket == kJacketGreen) {
+ if (!params->param4 && getProgress().jacket == kJacketGreen) {
- getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay);
- params->param5 = 1;
- getScenes()->processScene();
- }
+ getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay);
+ params->param5 = 1;
+ getScenes()->processScene();
+ }
}
if (params->param6) {
- UPDATE_PARAM_GOTO(params1->param7, getState()->time, 900, label_process);
+ if (!Entity::updateParameter(params1->param7, getState()->time, 900))
+ goto label_process;
+
getScenes()->loadSceneFromPosition(kCarRestaurant, 58);
}
@@ -552,7 +552,7 @@ void Train::handleCompartmentAction() {
ENTITY_PARAM(0, 8) = params->param1;
- CALLBACK_ACTION();
+ callbackAction();
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/train.h b/engines/lastexpress/entities/train.h
index ea9e1d7a07..4b8bc10c1a 100644
--- a/engines/lastexpress/entities/train.h
+++ b/engines/lastexpress/entities/train.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_TRAIN_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp
index 22f41afa92..4695f8831f 100644
--- a/engines/lastexpress/entities/vassili.cpp
+++ b/engines/lastexpress/entities/vassili.cpp
@@ -35,10 +35,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -85,7 +83,7 @@ IMPLEMENT_FUNCTION(4, Vassili, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Vassili, setup_chapter1Handler));
break;
case kActionDefault:
@@ -146,7 +144,8 @@ IMPLEMENT_FUNCTION(6, Vassili, function6)
case kActionNone:
if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
- UPDATE_PARAM_GOTO(params->param3, getState()->timeTicks, params->param1, label_function7);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+ goto label_function7;
setCallback(1);
setup_draw("303B");
@@ -402,7 +401,8 @@ IMPLEMENT_FUNCTION(13, Vassili, sleeping)
case kActionNone:
if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+ break;
setCallback(1);
setup_draw("303B");
@@ -461,7 +461,8 @@ IMPLEMENT_FUNCTION(15, Vassili, stealEgg)
case kActionNone:
if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+ break;
setCallback(1);
setup_draw("303B");
@@ -545,7 +546,8 @@ IMPLEMENT_FUNCTION(17, Vassili, chapter4Handler)
case kActionNone:
if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
- UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1);
+ if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+ break;
setCallback(1);
setup_draw("303B");
diff --git a/engines/lastexpress/entities/vassili.h b/engines/lastexpress/entities/vassili.h
index 843a065174..d006770f7b 100644
--- a/engines/lastexpress/entities/vassili.h
+++ b/engines/lastexpress/entities/vassili.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_VASSILI_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index 8246f85145..d9ddb0a4d1 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -32,10 +32,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -48,40 +46,40 @@ Verges::Verges(LastExpressEngine *engine) : Entity(engine, kEntityVerges) {
ADD_CALLBACK_FUNCTION(Verges, callbackActionRestaurantOrSalon);
ADD_CALLBACK_FUNCTION(Verges, savegame);
ADD_CALLBACK_FUNCTION(Verges, updateEntity);
- ADD_CALLBACK_FUNCTION(Verges, function9);
- ADD_CALLBACK_FUNCTION(Verges, function10);
+ ADD_CALLBACK_FUNCTION(Verges, walkBetweenCars);
+ ADD_CALLBACK_FUNCTION(Verges, makeAnnouncement);
ADD_CALLBACK_FUNCTION(Verges, function11);
ADD_CALLBACK_FUNCTION(Verges, function12);
- ADD_CALLBACK_FUNCTION(Verges, function13);
+ ADD_CALLBACK_FUNCTION(Verges, baggageCar);
ADD_CALLBACK_FUNCTION(Verges, updateFromTime);
- ADD_CALLBACK_FUNCTION(Verges, function15);
- ADD_CALLBACK_FUNCTION(Verges, function16);
- ADD_CALLBACK_FUNCTION(Verges, function17);
+ ADD_CALLBACK_FUNCTION(Verges, dialog);
+ ADD_CALLBACK_FUNCTION(Verges, dialog2);
+ ADD_CALLBACK_FUNCTION(Verges, talkAboutPassengerList);
ADD_CALLBACK_FUNCTION(Verges, chapter1);
ADD_CALLBACK_FUNCTION(Verges, talkHarem);
ADD_CALLBACK_FUNCTION(Verges, talkPassengerList);
ADD_CALLBACK_FUNCTION(Verges, talkGendarmes);
- ADD_CALLBACK_FUNCTION(Verges, function22);
+ ADD_CALLBACK_FUNCTION(Verges, askMertensToRelayAugustInvitation);
ADD_CALLBACK_FUNCTION(Verges, function23);
ADD_CALLBACK_FUNCTION(Verges, policeGettingOffTrain);
- ADD_CALLBACK_FUNCTION(Verges, function25);
+ ADD_CALLBACK_FUNCTION(Verges, policeSearch);
ADD_CALLBACK_FUNCTION(Verges, chapter1Handler);
ADD_CALLBACK_FUNCTION(Verges, chapter2);
ADD_CALLBACK_FUNCTION(Verges, chapter2Handler);
ADD_CALLBACK_FUNCTION(Verges, chapter3);
ADD_CALLBACK_FUNCTION(Verges, function30);
- ADD_CALLBACK_FUNCTION(Verges, function31);
+ ADD_CALLBACK_FUNCTION(Verges, talkAboutMax);
ADD_CALLBACK_FUNCTION(Verges, function32);
ADD_CALLBACK_FUNCTION(Verges, function33);
ADD_CALLBACK_FUNCTION(Verges, function34);
- ADD_CALLBACK_FUNCTION(Verges, function35);
+ ADD_CALLBACK_FUNCTION(Verges, organizeConcertInvitations);
ADD_CALLBACK_FUNCTION(Verges, chapter4);
ADD_CALLBACK_FUNCTION(Verges, chapter4Handler);
- ADD_CALLBACK_FUNCTION(Verges, function38);
+ ADD_CALLBACK_FUNCTION(Verges, resetState);
ADD_CALLBACK_FUNCTION(Verges, chapter5);
ADD_CALLBACK_FUNCTION(Verges, chapter5Handler);
- ADD_CALLBACK_FUNCTION(Verges, function41);
- ADD_CALLBACK_FUNCTION(Verges, function42);
+ ADD_CALLBACK_FUNCTION(Verges, askPassengersToStayInCompartments);
+ ADD_CALLBACK_FUNCTION(Verges, end);
}
//////////////////////////////////////////////////////////////////////////
@@ -102,11 +100,11 @@ IMPLEMENT_FUNCTION(3, Verges, callbackActionOnDirection)
case kActionNone:
if (getData()->direction != kDirectionRight)
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -151,7 +149,7 @@ IMPLEMENT_FUNCTION_II(8, Verges, updateEntity, CarIndex, EntityPosition)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION_S(9, Verges, function9)
+IMPLEMENT_FUNCTION_S(9, Verges, walkBetweenCars)
switch (savepoint.action) {
default:
break;
@@ -203,7 +201,7 @@ switch (savepoint.action) {
case 3:
setCallback(4);
- setup_function10(kCarGreenSleeping, kPosition_540, (char *)&params->seq1);
+ setup_makeAnnouncement(kCarGreenSleeping, kPosition_540, (char *)&params->seq1);
break;
case 4:
@@ -219,7 +217,7 @@ switch (savepoint.action) {
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -227,7 +225,7 @@ switch (savepoint.action) {
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition)
+IMPLEMENT_FUNCTION_IIS(10, Verges, makeAnnouncement, CarIndex, EntityPosition)
switch (savepoint.action) {
default:
break;
@@ -241,12 +239,13 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition)
}
if (getEntities()->updateEntity(kEntityVerges, (CarIndex)params->param1, (EntityPosition)params->param2)) {
- CALLBACK_ACTION();
+ callbackAction();
break;
}
if (params->param6) {
- UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+ break;
getSound()->playSound(kEntityVerges, (char *)&params->seq);
@@ -266,7 +265,7 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition)
}
if (getEntities()->updateEntity(kEntityVerges, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -337,7 +336,7 @@ IMPLEMENT_FUNCTION(11, Verges, function11)
getObjects()->update(kObject104, kEntityVerges, kObjectLocationNone, kCursorNormal, kCursorHand);
getObjects()->update(kObject105, kEntityVerges, kObjectLocationNone, kCursorNormal, kCursorHand);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -397,7 +396,7 @@ IMPLEMENT_FUNCTION(12, Verges, function12)
getData()->entityPosition = kPosition_850;
getEntities()->clearSequences(kEntityVerges);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -405,7 +404,7 @@ IMPLEMENT_FUNCTION(12, Verges, function12)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION_I(13, Verges, function13, bool)
+IMPLEMENT_FUNCTION_I(13, Verges, baggageCar, bool)
switch (savepoint.action) {
default:
break;
@@ -438,7 +437,7 @@ IMPLEMENT_FUNCTION_I(13, Verges, function13, bool)
getEntities()->clearSequences(kEntityVerges);
getScenes()->loadSceneFromPosition(kCarBaggage, 91);
- CALLBACK_ACTION();
+ callbackAction();
}
break;
}
@@ -450,7 +449,7 @@ IMPLEMENT_FUNCTION_I(14, Verges, updateFromTime, uint32)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION_IS(15, Verges, function15, EntityIndex)
+IMPLEMENT_FUNCTION_IS(15, Verges, dialog, EntityIndex)
switch (savepoint.action) {
default:
break;
@@ -462,7 +461,7 @@ IMPLEMENT_FUNCTION_IS(15, Verges, function15, EntityIndex)
if (!getEntities()->isPlayerPosition(kCarGreenSleeping, 2) && !getEntities()->isPlayerPosition(kCarRedSleeping, 2))
getData()->entityPosition = kPosition_2088;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -487,7 +486,7 @@ IMPLEMENT_FUNCTION_IS(15, Verges, function15, EntityIndex)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION_ISS(16, Verges, function16, EntityIndex)
+IMPLEMENT_FUNCTION_ISS(16, Verges, dialog2, EntityIndex)
switch (savepoint.action) {
default:
break;
@@ -499,7 +498,7 @@ IMPLEMENT_FUNCTION_ISS(16, Verges, function16, EntityIndex)
if (!getEntities()->isPlayerPosition(kCarGreenSleeping, 2) && !getEntities()->isPlayerPosition(kCarRedSleeping, 2))
getData()->entityPosition = kPosition_2088;
- CALLBACK_ACTION();
+ callbackAction();
}
break;
@@ -527,7 +526,7 @@ IMPLEMENT_FUNCTION_ISS(16, Verges, function16, EntityIndex)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(17, Verges, function17)
+IMPLEMENT_FUNCTION(17, Verges, talkAboutPassengerList)
switch (savepoint.action) {
default:
break;
@@ -549,7 +548,7 @@ IMPLEMENT_FUNCTION(17, Verges, function17)
case 2:
setCallback(3);
- setup_function15(kEntityMertens, "TRA1291");
+ setup_dialog(kEntityMertens, "TRA1291");
break;
case 3:
@@ -559,7 +558,7 @@ IMPLEMENT_FUNCTION(17, Verges, function17)
case 4:
ENTITY_PARAM(0, 3) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -573,7 +572,7 @@ IMPLEMENT_FUNCTION(18, Verges, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Verges, setup_chapter1Handler));
break;
case kActionDefault:
@@ -612,7 +611,7 @@ IMPLEMENT_FUNCTION(21, Verges, talkGendarmes)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(22, Verges, function22)
+IMPLEMENT_FUNCTION(22, Verges, askMertensToRelayAugustInvitation)
switch (savepoint.action) {
default:
break;
@@ -635,10 +634,10 @@ IMPLEMENT_FUNCTION(22, Verges, function22)
case 2:
if (getEvent(kEventMertensAskTylerCompartment) || getEvent(kEventMertensAskTylerCompartmentD) || getEvent(kEventMertensAugustWaiting)) {
setCallback(3);
- setup_function16(kEntityMertens, "TRA1200", "TRA1201");
+ setup_dialog2(kEntityMertens, "TRA1200", "TRA1201");
} else {
setCallback(4);
- setup_function16(kEntityMertens, "TRA1200A", "TRA1201");
+ setup_dialog2(kEntityMertens, "TRA1200A", "TRA1201");
}
break;
@@ -651,7 +650,7 @@ IMPLEMENT_FUNCTION(22, Verges, function22)
break;
case 5:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -697,7 +696,7 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain)
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -715,7 +714,7 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(25, Verges, function25)
+IMPLEMENT_FUNCTION(25, Verges, policeSearch)
switch (savepoint.action) {
default:
break;
@@ -775,10 +774,10 @@ IMPLEMENT_FUNCTION(25, Verges, function25)
if (getData()->car == kCarRedSleeping) {
setCallback(6);
- setup_function10(kCarGreenSleeping, kPosition_540, "TRA1005");
+ setup_makeAnnouncement(kCarGreenSleeping, kPosition_540, "TRA1005");
} else {
setCallback(7);
- setup_function10(kCarRedSleeping, kPosition_9460, "TRA1006");
+ setup_makeAnnouncement(kCarRedSleeping, kPosition_9460, "TRA1006");
}
break;
}
@@ -806,7 +805,7 @@ IMPLEMENT_FUNCTION(25, Verges, function25)
getSavePoints()->push(kEntityVerges, kEntityCoudert, kAction168254872);
setCallback(4);
- setup_function10(kCarRedSleeping, kPosition_9460, "TRA1006");
+ setup_makeAnnouncement(kCarRedSleeping, kPosition_9460, "TRA1006");
break;
case 4:
@@ -818,7 +817,7 @@ IMPLEMENT_FUNCTION(25, Verges, function25)
case 11:
ENTITY_PARAM(0, 7) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
case 6:
@@ -839,7 +838,7 @@ IMPLEMENT_FUNCTION(25, Verges, function25)
getSavePoints()->push(kEntityVerges, kEntityCoudert, kAction168254872);
setCallback(10);
- setup_function10(kCarGreenSleeping, kPosition_540, "TRA1006");
+ setup_makeAnnouncement(kCarGreenSleeping, kPosition_540, "TRA1006");
break;
case 10:
@@ -893,14 +892,14 @@ IMPLEMENT_FUNCTION(26, Verges, chapter1Handler)
label_callback1:
if (getEntities()->isInBaggageCarEntrance(kEntityPlayer)) {
setCallback(2);
- setup_function13(false);
+ setup_baggageCar(false);
break;
}
label_callback2:
if (ENTITY_PARAM(0, 7)) {
setCallback(3);
- setup_function25();
+ setup_policeSearch();
break;
}
@@ -908,10 +907,12 @@ label_callback3:
if (params->param6)
goto label_callback12;
- TIME_CHECK_CALLBACK_1(kTimeChapter1, params->param7, 4, setup_function9, "TRA1001");
+ if (Entity::timeCheckCallback(kTimeChapter1, params->param7, 4, "TRA1001", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback4:
- TIME_CHECK_CALLBACK(kTime1089000, params->param8, 5, setup_function12);
+ if (Entity::timeCheckCallback(kTime1089000, params->param8, 5, WRAP_SETUP_FUNCTION(Verges, setup_function12)))
+ break;
params->param8 = 1;
@@ -922,16 +923,20 @@ label_callback4:
}
label_callback8:
- TIME_CHECK_CALLBACK_1(kTime1107000, CURRENT_PARAM(1, 1), 9, setup_function9, "TRA1001A");
+ if (Entity::timeCheckCallback(kTime1107000, CURRENT_PARAM(1, 1), 9, "TRA1001A", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback9:
- TIME_CHECK_CALLBACK_1(kTime1134000, CURRENT_PARAM(1, 2), 10, setup_function9, "TRA1002");
+ if (Entity::timeCheckCallback(kTime1134000, CURRENT_PARAM(1, 2), 10, "TRA1002", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback10:
- TIME_CHECK_CALLBACK_1(kTime1165500, CURRENT_PARAM(1, 3), 11, setup_function9, "TRA1003");
+ if (Entity::timeCheckCallback(kTime1165500, CURRENT_PARAM(1, 3), 11, "TRA1003", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback11:
- TIME_CHECK_CALLBACK_1(kTime1225800, CURRENT_PARAM(1, 4), 12, setup_function9, "TRA1004");
+ if (Entity::timeCheckCallback(kTime1225800, CURRENT_PARAM(1, 4), 12, "TRA1004", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback12:
if (ENTITY_PARAM(0, 5) && !params->param2) {
@@ -950,7 +955,7 @@ label_callback13:
label_callback14:
if (ENTITY_PARAM(0, 3) && !params->param4 && (getState()->time < kTime1134000 || getState()->time > kTime1156500)) {
setCallback(15);
- setup_function17();
+ setup_talkAboutPassengerList();
break;
}
@@ -958,14 +963,14 @@ label_callback15:
if (ENTITY_PARAM(0, 1) && !params->param5) {
if (getState()->time < kTime1134000 || getState()->time > kTime1156500) {
setCallback(16);
- setup_function22();
+ setup_askMertensToRelayAugustInvitation();
}
}
break;
case kActionOpenDoor:
setCallback(17);
- setup_function13(savepoint.param.intValue < 106 ? true : false);
+ setup_baggageCar(savepoint.param.intValue < 106 ? true : false);
break;
case kActionDefault:
@@ -1001,7 +1006,7 @@ label_callback15:
case 6:
setCallback(7);
- setup_function15(kEntityMertens, "TRA1202");
+ setup_dialog(kEntityMertens, "TRA1202");
break;
case 7:
@@ -1079,11 +1084,12 @@ IMPLEMENT_FUNCTION(28, Verges, chapter2Handler)
case kActionNone:
if (getEntities()->isInBaggageCarEntrance(kEntityPlayer)) {
setCallback(1);
- setup_function13(false);
+ setup_baggageCar(false);
}
label_callback_1:
- TIME_CHECK_CALLBACK_1(kTime1818900, params->param1, 2, setup_function9, "Tra2177");
+ if (Entity::timeCheckCallback(kTime1818900, params->param1, 2, "Tra2177", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_2:
if (params->param2 == kTimeInvalid || !getState()->time)
@@ -1111,7 +1117,7 @@ label_callback_6:
if (ENTITY_PARAM(0, 3)) {
setCallback(7);
- setup_function17();
+ setup_talkAboutPassengerList();
}
break;
@@ -1124,7 +1130,7 @@ label_callback_6:
case kActionOpenDoor:
setCallback(8);
- setup_function13(savepoint.param.intValue < 106);
+ setup_baggageCar(savepoint.param.intValue < 106);
break;
case kActionDefault:
@@ -1149,7 +1155,7 @@ label_callback_6:
case 4:
setCallback(5);
- setup_function15(kEntityCoudert, "TRA2100");
+ setup_dialog(kEntityCoudert, "TRA2100");
break;
case 5:
@@ -1171,7 +1177,7 @@ IMPLEMENT_FUNCTION(29, Verges, chapter3)
break;
case kActionNone:
- setup_function23();
+ setup_function33();
break;
case kActionDefault:
@@ -1215,7 +1221,7 @@ IMPLEMENT_FUNCTION_S(30, Verges, function30)
case 2:
setCallback(3);
- setup_function15(kEntityCoudert, (char *)&params->seq1);
+ setup_dialog(kEntityCoudert, (char *)&params->seq1);
break;
case 3:
@@ -1224,7 +1230,7 @@ IMPLEMENT_FUNCTION_S(30, Verges, function30)
break;
case 4:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1232,7 +1238,7 @@ IMPLEMENT_FUNCTION_S(30, Verges, function30)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(31, Verges, function31)
+IMPLEMENT_FUNCTION(31, Verges, talkAboutMax)
switch (savepoint.action) {
default:
break;
@@ -1254,7 +1260,7 @@ IMPLEMENT_FUNCTION(31, Verges, function31)
case 2:
setCallback(3);
- setup_function15(kEntityCoudert, "TRA3015");
+ setup_dialog(kEntityCoudert, "TRA3015");
break;
case 3:
@@ -1266,7 +1272,7 @@ IMPLEMENT_FUNCTION(31, Verges, function31)
getProgress().field_48 = 1;
ENTITY_PARAM(0, 4) = 0;
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1280,7 +1286,12 @@ IMPLEMENT_FUNCTION(32, Verges, function32)
break;
case kActionNone:
- TIME_CHECK_CALLBACK_3(kTime2263500, params->param1, 5, setup_function10, kCarRedSleeping, kPosition_9460, "TRA3006");
+ if (getState()->time > kTime2263500 && !params->param1) {
+ params->param1 = 1;
+ setCallback(5);
+ setup_makeAnnouncement(kCarRedSleeping, kPosition_9460, "TRA3006");
+ break;
+ }
break;
case kActionDefault:
@@ -1330,7 +1341,7 @@ IMPLEMENT_FUNCTION(32, Verges, function32)
case 3:
setCallback(4);
- setup_function10(kCarGreenSleeping, kPosition_540, "TRA3004");
+ setup_makeAnnouncement(kCarGreenSleeping, kPosition_540, "TRA3004");
break;
case 4:
@@ -1343,7 +1354,7 @@ IMPLEMENT_FUNCTION(32, Verges, function32)
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1401,7 +1412,7 @@ IMPLEMENT_FUNCTION(33, Verges, function33)
getSavePoints()->push(kEntityVerges, kEntityAbbot, kAction192054567);
setCallback(6);
- setup_function9("Tra3010");
+ setup_walkBetweenCars("Tra3010");
break;
case 6:
@@ -1421,49 +1432,55 @@ IMPLEMENT_FUNCTION(34, Verges, function34)
case kActionNone:
if (getEntities()->isInBaggageCarEntrance(kEntityPlayer)) {
setCallback(1);
- setup_function13(false);
+ setup_baggageCar(false);
break;
}
label_callback_1:
if (ENTITY_PARAM(0, 4)) {
setCallback(2);
- setup_function31();
+ setup_talkAboutMax();
break;
}
label_callback_2:
if (ENTITY_PARAM(0, 3)) {
setCallback(3);
- setup_function17();
+ setup_talkAboutPassengerList();
break;
}
label_callback_3:
- TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 4, setup_function9, "Tra3001");
+ if (Entity::timeCheckCallback(kTime1971000, params->param1, 4, "Tra3001", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_4:
- TIME_CHECK_CALLBACK_1(kTime1998000, params->param2, 5, setup_function9, "Tra3010a");
+ if (Entity::timeCheckCallback(kTime1998000, params->param2, 5, "Tra3010a", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_5:
- TIME_CHECK_CALLBACK(kTime2016000, params->param3, 6, setup_function35);
+ if (Entity::timeCheckCallback(kTime2016000, params->param3, 6, WRAP_SETUP_FUNCTION(Verges, setup_organizeConcertInvitations)))
+ break;
label_callback_6:
- TIME_CHECK_CALLBACK_1(kTime2070000, params->param4, 7, setup_function9, "Tra3002");
+ if (Entity::timeCheckCallback(kTime2070000, params->param4, 7, "Tra3002", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK_1(kTime2142000, params->param5, 8, setup_function9, "Tra3003");
+ if (Entity::timeCheckCallback(kTime2142000, params->param5, 8, "Tra3003", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_8:
- TIME_CHECK_CALLBACK_1(kTime2173500, params->param6, 9, setup_function30, "Tra3012");
+ if (Entity::timeCheckCallback(kTime2173500, params->param6, 9, "Tra3012", WRAP_SETUP_FUNCTION_S(Verges, setup_function30)))
+ break;
label_callback_9:
- TIME_CHECK_CALLBACK(kTime2218500, params->param7, 10, setup_function32);
+ Entity::timeCheckCallback(kTime2218500, params->param7, 10, WRAP_SETUP_FUNCTION(Verges, setup_function32));
break;
case kActionOpenDoor:
setCallback(11);
- setup_function13(savepoint.param.intValue < 106);
+ setup_baggageCar(savepoint.param.intValue < 106);
break;
case kActionCallback:
@@ -1503,7 +1520,7 @@ label_callback_9:
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(35, Verges, function35)
+IMPLEMENT_FUNCTION(35, Verges, organizeConcertInvitations)
switch (savepoint.action) {
default:
break;
@@ -1525,7 +1542,7 @@ IMPLEMENT_FUNCTION(35, Verges, function35)
case 2:
setCallback(3);
- setup_function15(kEntityMertens, "Tra3011A");
+ setup_dialog(kEntityMertens, "Tra3011A");
break;
case 3:
@@ -1537,7 +1554,7 @@ IMPLEMENT_FUNCTION(35, Verges, function35)
case 4:
setCallback(5);
- setup_function15(kEntityMertens, "Tra3011");
+ setup_dialog(kEntityMertens, "Tra3011");
break;
case 5:
@@ -1548,7 +1565,7 @@ IMPLEMENT_FUNCTION(35, Verges, function35)
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1592,7 +1609,7 @@ IMPLEMENT_FUNCTION(37, Verges, chapter4Handler)
case kActionNone:
if (getEntities()->isInBaggageCarEntrance(kEntityPlayer)) {
setCallback(1);
- setup_function13(false);
+ setup_baggageCar(false);
break;
}
@@ -1600,37 +1617,42 @@ label_callback_1:
if (ENTITY_PARAM(0, 6)) {
if (ENTITY_PARAM(0, 3)) {
setCallback(2);
- setup_function17();
+ setup_talkAboutPassengerList();
break;
}
label_callback_2:
- TIME_CHECK_CALLBACK_1(kTime2349000, params->param1, 3, setup_function9, "Tra1001");
+ if (Entity::timeCheckCallback(kTime2349000, params->param1, 3, "Tra1001", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_3:
- TIME_CHECK_CALLBACK_1(kTime2378700, params->param2, 4, setup_function9, "Tra4001");
+ if (Entity::timeCheckCallback(kTime2378700, params->param2, 4, "Tra4001", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_4:
- TIME_CHECK_CALLBACK_1(kTime2403000, params->param3, 5, setup_function9, "Tra1001A");
+ if (Entity::timeCheckCallback(kTime2403000, params->param3, 5, "Tra1001A", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_5:
- TIME_CHECK_CALLBACK_1(kTime2414700, params->param4, 6, setup_function9, "Tra4002");
+ if (Entity::timeCheckCallback(kTime2414700, params->param4, 6, "Tra4002", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_6:
- TIME_CHECK_CALLBACK_1(kTime2484000, params->param5, 7, setup_function9, "Tra4003");
+ if (Entity::timeCheckCallback(kTime2484000, params->param5, 7, "Tra4003", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
label_callback_7:
- TIME_CHECK_CALLBACK_1(kTime2511000, params->param6, 8, setup_function9, "Tra4004");
+ if (Entity::timeCheckCallback(kTime2511000, params->param6, 8, "Tra4004", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars)))
+ break;
}
label_callback_8:
- TIME_CHECK_CALLBACK_1(kTime2538000, params->param7, 9, setup_function9, "Tra4005");
-
+ Entity::timeCheckCallback(kTime2538000, params->param7, 9, "Tra4005", WRAP_SETUP_FUNCTION_S(Verges, setup_walkBetweenCars));
break;
case kActionOpenDoor:
setCallback(10);
- setup_function13(savepoint.param.intValue < 106);
+ setup_baggageCar(savepoint.param.intValue < 106);
break;
case kActionDefault:
@@ -1675,7 +1697,7 @@ label_callback_8:
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(38, Verges, function38)
+IMPLEMENT_FUNCTION(38, Verges, resetState)
switch (savepoint.action) {
default:
break;
@@ -1781,14 +1803,14 @@ IMPLEMENT_FUNCTION(40, Verges, chapter5Handler)
getAction()->playAnimation(kEventCathFreePassengers);
getSavePoints()->pushAll(kEntityVerges, kActionProceedChapter5);
getScenes()->loadSceneFromPosition(kCarRedSleeping, 40);
- setup_function41();
+ setup_askPassengersToStayInCompartments();
}
break;
}
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(41, Verges, function41)
+IMPLEMENT_FUNCTION(41, Verges, askPassengersToStayInCompartments)
switch (savepoint.action) {
default:
break;
@@ -1800,7 +1822,7 @@ IMPLEMENT_FUNCTION(41, Verges, function41)
getData()->location = kLocationInsideCompartment;
setCallback(1);
- setup_function10(kCarRedSleeping, kPosition_2000, "Tra5001");
+ setup_makeAnnouncement(kCarRedSleeping, kPosition_2000, "Tra5001");
break;
case kActionCallback:
@@ -1830,7 +1852,7 @@ IMPLEMENT_FUNCTION(41, Verges, function41)
break;
case 4:
- setup_function42();
+ setup_end();
break;
}
break;
@@ -1838,7 +1860,7 @@ IMPLEMENT_FUNCTION(41, Verges, function41)
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_FUNCTION(42, Verges, function42)
+IMPLEMENT_FUNCTION(42, Verges, end)
if (savepoint.action == kActionDefault)
getEntities()->clearSequences(kEntityVerges);
IMPLEMENT_FUNCTION_END
@@ -1869,7 +1891,7 @@ void Verges::talk(const SavePoint &savepoint, const char *sound1, const char *so
case 2:
setCallback(3);
- setup_function15(kEntityCoudert, sound1);
+ setup_dialog(kEntityCoudert, sound1);
break;
case 3:
@@ -1879,7 +1901,7 @@ void Verges::talk(const SavePoint &savepoint, const char *sound1, const char *so
case 4:
setCallback(5);
- setup_function15(kEntityMertens, sound2);
+ setup_dialog(kEntityMertens, sound2);
break;
case 5:
@@ -1887,7 +1909,7 @@ void Verges::talk(const SavePoint &savepoint, const char *sound1, const char *so
break;
case 6:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
diff --git a/engines/lastexpress/entities/verges.h b/engines/lastexpress/entities/verges.h
index 17a3c8ac40..93cc190d1e 100644
--- a/engines/lastexpress/entities/verges.h
+++ b/engines/lastexpress/entities/verges.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_VERGES_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
@@ -88,11 +87,11 @@ public:
*/
DECLARE_FUNCTION_2(updateEntity, CarIndex car, EntityPosition entityPosition)
- DECLARE_FUNCTION_1(function9, const char *soundName)
- DECLARE_FUNCTION_3(function10, CarIndex car, EntityPosition entityPosition, const char *soundName)
+ DECLARE_FUNCTION_1(walkBetweenCars, const char *soundName)
+ DECLARE_FUNCTION_3(makeAnnouncement, CarIndex car, EntityPosition entityPosition, const char *soundName)
DECLARE_FUNCTION(function11)
DECLARE_FUNCTION(function12)
- DECLARE_FUNCTION_1(function13, bool)
+ DECLARE_FUNCTION_1(baggageCar, bool)
/**
* Updates parameter 2 using time value
@@ -101,9 +100,9 @@ public:
*/
DECLARE_FUNCTION_1(updateFromTime, uint32 time)
- DECLARE_FUNCTION_2(function15, EntityIndex entity, const char *soundName)
- DECLARE_FUNCTION_3(function16, EntityIndex entityIndex, const char *soundName1, const char *soundName2)
- DECLARE_FUNCTION(function17)
+ DECLARE_FUNCTION_2(dialog, EntityIndex entity, const char *soundName)
+ DECLARE_FUNCTION_3(dialog2, EntityIndex entityIndex, const char *soundName1, const char *soundName2)
+ DECLARE_FUNCTION(talkAboutPassengerList)
/**
* Setup Chapter 1
@@ -113,10 +112,10 @@ public:
DECLARE_FUNCTION_NOSETUP(talkHarem)
DECLARE_FUNCTION(talkPassengerList)
DECLARE_FUNCTION(talkGendarmes)
- DECLARE_FUNCTION(function22)
+ DECLARE_FUNCTION(askMertensToRelayAugustInvitation)
DECLARE_FUNCTION(function23)
DECLARE_FUNCTION(policeGettingOffTrain)
- DECLARE_FUNCTION(function25)
+ DECLARE_FUNCTION(policeSearch)
/**
* Handle Chapter 1 events
@@ -139,11 +138,11 @@ public:
DECLARE_FUNCTION(chapter3)
DECLARE_FUNCTION_1(function30, const char *soundName)
- DECLARE_FUNCTION(function31)
+ DECLARE_FUNCTION(talkAboutMax)
DECLARE_FUNCTION(function32)
DECLARE_FUNCTION(function33)
DECLARE_FUNCTION(function34)
- DECLARE_FUNCTION(function35)
+ DECLARE_FUNCTION(organizeConcertInvitations)
/**
* Setup Chapter 4
@@ -155,7 +154,7 @@ public:
*/
DECLARE_FUNCTION(chapter4Handler)
- DECLARE_FUNCTION(function38)
+ DECLARE_FUNCTION(resetState)
/**
* Setup Chapter 5
@@ -167,8 +166,8 @@ public:
*/
DECLARE_FUNCTION(chapter5Handler)
- DECLARE_FUNCTION(function41)
- DECLARE_FUNCTION(function42)
+ DECLARE_FUNCTION(askPassengersToStayInCompartments)
+ DECLARE_FUNCTION(end)
private:
void talk(const SavePoint &savepoint, const char *sound1, const char *sound2);
diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp
index 7a1f1d3195..f29bce8b2b 100644
--- a/engines/lastexpress/entities/vesna.cpp
+++ b/engines/lastexpress/entities/vesna.cpp
@@ -32,10 +32,7 @@
#include "lastexpress/game/scenes.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
-
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -134,7 +131,7 @@ IMPLEMENT_FUNCTION_II(7, Vesna, updateEntity2, CarIndex, EntityPosition)
break;
case kAction123668192:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -165,7 +162,8 @@ IMPLEMENT_FUNCTION(11, Vesna, function11)
case kActionNone:
if (parameters->param3) {
- UPDATE_PARAM(parameters->param7, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(parameters->param7, getState()->timeTicks, 75))
+ break;
parameters->param2 = 1;
parameters->param3 = 0;
@@ -245,7 +243,7 @@ IMPLEMENT_FUNCTION(11, Vesna, function11)
case kAction55996766:
case kAction101687594:
- CALLBACK_ACTION();
+ callbackAction();
break;
}
IMPLEMENT_FUNCTION_END
@@ -257,7 +255,7 @@ IMPLEMENT_FUNCTION(12, Vesna, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Vesna, setup_chapter1Handler));
break;
case kActionDefault:
@@ -458,7 +456,7 @@ IMPLEMENT_FUNCTION(18, Vesna, function18)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityVesna);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -514,7 +512,8 @@ IMPLEMENT_FUNCTION(20, Vesna, chapter3Handler)
}
if (parameters->param2) {
- UPDATE_PARAM(parameters->param8, getState()->timeTicks, 75);
+ if (!Entity::updateParameter(parameters->param8, getState()->timeTicks, 75))
+ break;
parameters->param1 = 1;
parameters->param2 = 0;
@@ -711,7 +710,7 @@ IMPLEMENT_FUNCTION(21, Vesna, function21)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityVesna);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -1083,13 +1082,14 @@ IMPLEMENT_FUNCTION(30, Vesna, function30)
case kActionNone:
if (!params->param1) {
- UPDATE_PARAM_PROC(params->param3, getState()->timeTicks, 120)
+ if (Entity::updateParameter(params->param3, getState()->timeTicks, 120)) {
getSound()->playSound(kEntityVesna, "Ves50001", kFlagDefault);
params->param1 = 1;
- UPDATE_PARAM_PROC_END
+ }
}
- UPDATE_PARAM(params->param4, getState()->timeTicks, 180);
+ if (!Entity::updateParameter(params->param4, getState()->timeTicks, 180))
+ break;
setCallback(1);
setup_savegame(kSavegameTypeEvent, kEventCathVesnaTrainTopKilled);
diff --git a/engines/lastexpress/entities/vesna.h b/engines/lastexpress/entities/vesna.h
index a09664096d..025d45882e 100644
--- a/engines/lastexpress/entities/vesna.h
+++ b/engines/lastexpress/entities/vesna.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_VESNA_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp
index 45e5e11568..1d280f51e0 100644
--- a/engines/lastexpress/entities/yasmin.cpp
+++ b/engines/lastexpress/entities/yasmin.cpp
@@ -28,10 +28,8 @@
#include "lastexpress/game/savepoint.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
namespace LastExpress {
@@ -132,7 +130,7 @@ IMPLEMENT_FUNCTION(6, Yasmin, function6)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityYasmin);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -172,7 +170,7 @@ IMPLEMENT_FUNCTION(7, Yasmin, function7)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityYasmin);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
break;
@@ -186,7 +184,7 @@ IMPLEMENT_FUNCTION(8, Yasmin, chapter1)
break;
case kActionNone:
- TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler);
+ Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Yasmin, setup_chapter1Handler));
break;
case kActionDefault:
@@ -204,12 +202,22 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime1093500, params->param1, 1, setup_function6);
- TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7);
- TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTime1162800, params->param3, 4, "Har1102", kPosition_4070);
- TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104");
- TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106");
- TIME_CHECK_CALLBACK(kTime1183500, params->param6, 7, setup_function6);
+ if (Entity::timeCheckCallback(kTime1093500, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)))
+ break;
+
+ if (Entity::timeCheckCallback(kTime1161000, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function7)))
+ break;
+
+ if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070))
+ break;
+
+ if (Entity::timeCheckCallback(kTime1165500, params->param4, 5, "Har1104", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+ break;
+
+ if (Entity::timeCheckCallback(kTime1174500, params->param5, 6, "Har1106", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+ break;
+
+ Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
break;
case kActionCallback:
@@ -224,23 +232,27 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler)
break;
case 2:
- TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7);
+ if (Entity::timeCheckCallback(kTime1161000, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function7)))
+ break;
// Fallback to case 3
case 3:
- TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTime1162800, params->param3, 4, "Har1102", kPosition_4070);
+ if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070))
+ break;
// Fallback to case 4
case 4:
- TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104");
+ if (Entity::timeCheckCallback(kTime1165500, params->param4, 5, "Har1104", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+ break;
// Fallback to case 5
case 5:
- TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106");
+ if (Entity::timeCheckCallback(kTime1174500, params->param5, 6, "Har1106", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+ break;
// Fallback to case 6
case 6:
- TIME_CHECK_CALLBACK(kTime1183500, params->param6, 7, setup_function6);
+ Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
break;
}
break;
@@ -281,7 +293,8 @@ IMPLEMENT_FUNCTION(12, Yasmin, chapter2Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime1759500, params->param1, 1, setup_function7);
+ if (Entity::timeCheckCallback(kTime1759500, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function7)))
+ break;
if (getState()->time > kTime1800000 && !params->param2) {
params->param2 = 1;
@@ -334,9 +347,13 @@ IMPLEMENT_FUNCTION(14, Yasmin, chapter3Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime2062800, params->param1, 1, setup_function6);
- TIME_CHECK_CALLBACK(kTime2106000, params->param2, 2, setup_function7);
- TIME_CHECK_CALLBACK(kTime2160000, params->param3, 3, setup_function6);
+ if (Entity::timeCheckCallback(kTime2062800, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)))
+ break;
+
+ if (Entity::timeCheckCallback(kTime2106000, params->param2, 2, WRAP_SETUP_FUNCTION(Yasmin, setup_function7)))
+ break;
+
+ Entity::timeCheckCallback(kTime2160000, params->param3, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
break;
case kActionCallback:
@@ -345,11 +362,12 @@ IMPLEMENT_FUNCTION(14, Yasmin, chapter3Handler)
break;
case 1:
- TIME_CHECK_CALLBACK(kTime2106000, params->param2, 2, setup_function7);
+ if (Entity::timeCheckCallback(kTime2106000, params->param2, 2, WRAP_SETUP_FUNCTION(Yasmin, setup_function7)))
+ break;
// Fallback to case 2
case 2:
- TIME_CHECK_CALLBACK(kTime2160000, params->param3, 3, setup_function6);
+ Entity::timeCheckCallback(kTime2160000, params->param3, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
break;
}
break;
@@ -381,8 +399,10 @@ IMPLEMENT_FUNCTION(16, Yasmin, chapter4Handler)
break;
case kActionNone:
- TIME_CHECK_CALLBACK(kTime2457000, params->param1, 1, setup_function7);
- TIME_CHECK_CALLBACK(kTime2479500, params->param2, 3, setup_function6);
+ if (Entity::timeCheckCallback(kTime2457000, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function7)))
+ break;
+
+ Entity::timeCheckCallback(kTime2479500, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
break;
case kActionCallback:
@@ -397,7 +417,7 @@ IMPLEMENT_FUNCTION(16, Yasmin, chapter4Handler)
break;
case 2:
- TIME_CHECK_CALLBACK(kTime2479500, params->param2, 3, setup_function6);
+ Entity::timeCheckCallback(kTime2479500, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
break;
}
break;
@@ -445,7 +465,9 @@ IMPLEMENT_FUNCTION(20, Yasmin, function20)
break;
case kActionNone:
- UPDATE_PARAM(params->param1, getState()->time, 2700);
+ if (!Entity::updateParameter(params->param1, getState()->time, 2700))
+ break;
+
setup_function21();
break;
@@ -472,7 +494,7 @@ IMPLEMENT_FUNCTION(21, Yasmin, function21)
case kActionNone:
case kActionDefault:
if (getEntities()->updateEntity(kEntityYasmin, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
diff --git a/engines/lastexpress/entities/yasmin.h b/engines/lastexpress/entities/yasmin.h
index e943a8b158..b1413f5c2f 100644
--- a/engines/lastexpress/entities/yasmin.h
+++ b/engines/lastexpress/entities/yasmin.h
@@ -24,7 +24,6 @@
#define LASTEXPRESS_YASMIN_H
#include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
namespace LastExpress {
diff --git a/engines/lastexpress/fight/fight.cpp b/engines/lastexpress/fight/fight.cpp
index b832d46a60..49a9b85657 100644
--- a/engines/lastexpress/fight/fight.cpp
+++ b/engines/lastexpress/fight/fight.cpp
@@ -31,6 +31,7 @@
#include "lastexpress/data/cursor.h"
#include "lastexpress/data/sequence.h"
+#include "lastexpress/game/entities.h"
#include "lastexpress/game/inventory.h"
#include "lastexpress/game/logic.h"
#include "lastexpress/game/object.h"
@@ -40,7 +41,6 @@
#include "lastexpress/sound/queue.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -53,6 +53,8 @@ Fight::FightData::FightData() {
index = 0;
isFightRunning = false;
+
+ memset(&sequences, 0, sizeof(sequences));
}
Fight::FightData::~FightData() {
@@ -399,6 +401,9 @@ end_load:
}
void Fight::setOpponents() {
+ if (!_data)
+ error("[Fight::setOpponents] Data not initialized");
+
_data->player->setOpponent(_data->opponent);
_data->opponent->setOpponent(_data->player);
diff --git a/engines/lastexpress/fight/fighter.cpp b/engines/lastexpress/fight/fighter.cpp
index bae7728a2b..4b1cddabd4 100644
--- a/engines/lastexpress/fight/fighter.cpp
+++ b/engines/lastexpress/fight/fighter.cpp
@@ -53,20 +53,20 @@ Fighter::Fighter(LastExpressEngine *engine) : _engine(engine) {
}
Fighter::~Fighter() {
- clearSequences();
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Cleanup
-//////////////////////////////////////////////////////////////////////////
-void Fighter::clearSequences() {
// The original game resets the function pointers to default values, just before deleting the struct
getScenes()->removeAndRedraw(&_frame, false);
// Free sequences
- for (int i = 0; i < (int)_sequences.size(); i++)
+ for (uint i = 0; i < _sequences.size(); i++)
SAFE_DELETE(_sequences[i]);
+
+ // Zero-out passed pointers
+ _sequence = NULL;
+ _opponent = NULL;
+ _fight = NULL;
+
+ _engine = NULL;
}
//////////////////////////////////////////////////////////////////////////
@@ -113,6 +113,9 @@ void Fighter::draw() {
// Processing
//////////////////////////////////////////////////////////////////////////
void Fighter::process() {
+ if (!_fight)
+ error("[Fighter::handleAction] Fighter not initialized properly");
+
if (!_sequence) {
if (_frame) {
getScenes()->removeFromQueue(_frame);
@@ -188,6 +191,9 @@ void Fighter::process() {
// Default actions
//////////////////////////////////////////////////////////////////////////
void Fighter::handleAction(FightAction action) {
+ if (!_opponent || !_fight)
+ error("[Fighter::handleAction] Fighter not initialized properly");
+
switch (action) {
default:
return;
@@ -243,7 +249,10 @@ void Opponent::update() {
// Helpers
//////////////////////////////////////////////////////////////////////////
bool Fighter::checkFrame(uint32 val) {
- return (_frame->getInfo()->field_33 & val);
+ if (!_frame)
+ error("[Fighter::checkFrame] Invalid current frame");
+
+ return (bool)(_frame->getInfo()->field_33 & val);
}
} // End of namespace LastExpress
diff --git a/engines/lastexpress/fight/fighter.h b/engines/lastexpress/fight/fighter.h
index e37fe49d86..dad95af186 100644
--- a/engines/lastexpress/fight/fighter.h
+++ b/engines/lastexpress/fight/fighter.h
@@ -99,9 +99,6 @@ protected:
void draw();
void process();
- // Cleanup
- void clearSequences();
-
// Helpers
bool checkFrame(uint32 val);
};
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 98d74dd1a7..796abf2ce7 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -29,7 +29,6 @@
#include "lastexpress/entities/abbot.h"
#include "lastexpress/entities/anna.h"
-#include "lastexpress/entities/entity.h"
#include "lastexpress/game/beetle.h"
#include "lastexpress/game/entities.h"
@@ -42,9 +41,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -332,6 +329,22 @@ static const struct {
{"8042A", 600}
};
+template<class Arg, class Res, class T>
+class Functor1MemConst : public Common::Functor1<Arg, Res> {
+public:
+ typedef Res (T::*FuncType)(Arg) const;
+
+ Functor1MemConst(T *t, const FuncType &func) : _t(t), _func(func) {}
+
+ bool isValid() const { return _func != 0 && _t != 0; }
+ Res operator()(Arg v1) const {
+ return (_t->*_func)(v1);
+ }
+private:
+ mutable T *_t;
+ const FuncType _func;
+};
+
Action::Action(LastExpressEngine *engine) : _engine(engine) {
ADD_ACTION(dummy);
ADD_ACTION(inventory);
@@ -381,7 +394,7 @@ Action::Action(LastExpressEngine *engine) : _engine(engine) {
}
Action::~Action() {
- for (int i = 0; i < (int)_actions.size(); i++)
+ for (uint i = 0; i < _actions.size(); i++)
SAFE_DELETE(_actions[i]);
_actions.clear();
@@ -407,9 +420,7 @@ SceneIndex Action::processHotspot(const SceneHotspot &hotspot) {
//////////////////////////////////////////////////////////////////////////
// Action 0
IMPLEMENT_ACTION(dummy)
- warning("[Action::action_dummy] Dummy action function called (hotspot action: %d)", hotspot.action);
-
- return kSceneInvalid;
+ error("[Action::action_dummy] Dummy action function called (hotspot action: %d)", hotspot.action);
}
//////////////////////////////////////////////////////////////////////////
@@ -1742,14 +1753,14 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
return kCursorBackward;
case SceneHotspot::kActionKnockOnDoor:
- warning("================================= DOOR %03d =================================", object);
+ debugC(2, kLastExpressDebugScenes, "================================= DOOR %03d =================================", object);
if (object >= kObjectMax)
return kCursorNormal;
else
return (CursorStyle)getObjects()->get(object).cursor;
case SceneHotspot::kAction12:
- warning("================================= OBJECT %03d =================================", object);
+ debugC(2, kLastExpressDebugScenes, "================================= OBJECT %03d =================================", object);
if (object >= kObjectMax)
return kCursorNormal;
@@ -1759,7 +1770,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
return kCursorNormal;
case SceneHotspot::kActionPickItem:
- warning("================================= ITEM %03d =================================", object);
+ debugC(2, kLastExpressDebugScenes, "================================= ITEM %03d =================================", object);
if (object >= kObjectCompartmentA)
return kCursorNormal;
@@ -1770,7 +1781,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
return kCursorNormal;
case SceneHotspot::kActionDropItem:
- warning("================================= ITEM %03d =================================", object);
+ debugC(2, kLastExpressDebugScenes, "================================= ITEM %03d =================================", object);
if (object >= kObjectCompartmentA)
return kCursorNormal;
@@ -1887,7 +1898,7 @@ LABEL_KEY:
// Handle compartment action
case SceneHotspot::kActionCompartment:
case SceneHotspot::kActionExitCompartment:
- warning("================================= DOOR %03d =================================", object);
+ debugC(2, kLastExpressDebugScenes, "================================= DOOR %03d =================================", object);
if (object >= kObjectMax)
return kCursorNormal;
diff --git a/engines/lastexpress/game/beetle.cpp b/engines/lastexpress/game/beetle.cpp
index ab707ddae9..d7a369ba40 100644
--- a/engines/lastexpress/game/beetle.cpp
+++ b/engines/lastexpress/game/beetle.cpp
@@ -27,7 +27,6 @@
#include "lastexpress/game/scenes.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -95,7 +94,7 @@ void Beetle::load() {
// Check that all sequences are loaded properly
_data->isLoaded = true;
- for (int i = 0; i < (int)_data->sequences.size(); i++) {
+ for (uint i = 0; i < _data->sequences.size(); i++) {
if (!_data->sequences[i]->isLoaded()) {
_data->isLoaded = false;
break;
@@ -337,26 +336,13 @@ void Beetle::drawUpdate() {
}
}
-#define INVERT_Y() \
- switch (_data->indexes[_data->offset]) { \
- default: \
- break; \
- case 24: \
- case 25: \
- case 26: \
- case 27: \
- case 28: \
- _data->coordY = -_data->coordY; \
- break; \
- }
-
// Invert direction
- INVERT_Y();
+ invertDirection();
SequenceFrame *frame = new SequenceFrame(_data->currentSequence, (uint16)_data->currentFrame);
updateFrame(frame);
- INVERT_Y();
+ invertDirection();
getScenes()->addToQueue(frame);
@@ -364,6 +350,24 @@ void Beetle::drawUpdate() {
_data->frame = frame;
}
+void Beetle::invertDirection() {
+ if (!_data)
+ error("[Beetle::invertDirection] Sequences have not been loaded");
+
+ switch (_data->indexes[_data->offset]) {
+ default:
+ break;
+
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ _data->coordY = -_data->coordY;
+ break;
+ }
+}
+
void Beetle::move() {
if (!_data)
error("[Beetle::move] Sequences have not been loaded");
diff --git a/engines/lastexpress/game/beetle.h b/engines/lastexpress/game/beetle.h
index d3c47f39e5..034ebbd557 100644
--- a/engines/lastexpress/game/beetle.h
+++ b/engines/lastexpress/game/beetle.h
@@ -111,6 +111,7 @@ private:
void updateFrame(SequenceFrame *frame) const;
void updateData(uint32 index);
void drawUpdate();
+ void invertDirection();
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index f27087a609..fafbd7cb64 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -27,8 +27,6 @@
#include "lastexpress/data/sequence.h"
// Entities
-#include "lastexpress/entities/entity.h"
-
#include "lastexpress/entities/abbot.h"
#include "lastexpress/entities/alexei.h"
#include "lastexpress/entities/alouan.h"
@@ -71,10 +69,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -185,7 +181,7 @@ Entities::Entities(LastExpressEngine *engine) : _engine(engine) {
Entities::~Entities() {
SAFE_DELETE(_header);
- for (int i = 0; i < (int)_entities.size(); i++)
+ for (uint i = 0; i < _entities.size(); i++)
SAFE_DELETE(_entities[i]);
_entities.clear();
@@ -673,11 +669,12 @@ void Entities::executeCallbacks() {
//////////////////////////////////////////////////////////////////////////
// Processing
//////////////////////////////////////////////////////////////////////////
-#define INCREMENT_DIRECTION_COUNTER() { \
- data->doProcessEntity = false; \
- if (data->direction == kDirectionRight || (data->direction == kDirectionSwitch && data->directionSwitch == kDirectionRight)) \
- ++data->field_4A1; \
- }
+void Entities::incrementDirectionCounter(EntityData::EntityCallData *data) const {
+ data->doProcessEntity = false;
+
+ if (data->direction == kDirectionRight || (data->direction == kDirectionSwitch && data->directionSwitch == kDirectionRight))
+ ++data->field_4A1;
+}
void Entities::processEntity(EntityIndex entityIndex) {
EntityData::EntityCallData *data = getData(entityIndex);
@@ -696,7 +693,7 @@ void Entities::processEntity(EntityIndex entityIndex) {
getScenes()->removeAndRedraw(&data->frame, false);
getScenes()->removeAndRedraw(&data->frame1, false);
- INCREMENT_DIRECTION_COUNTER();
+ incrementDirectionCounter(data);
return;
}
@@ -726,7 +723,7 @@ label_nosequence:
processFrame(entityIndex, false, true);
if (!getFlags()->flag_entities_0 && !data->doProcessEntity) {
- INCREMENT_DIRECTION_COUNTER();
+ incrementDirectionCounter(data);
return;
}
} else {
@@ -744,7 +741,7 @@ label_nosequence:
data->position = 0;
}
- INCREMENT_DIRECTION_COUNTER();
+ incrementDirectionCounter(data);
}
return;
}
@@ -754,46 +751,44 @@ label_nosequence:
if (data->frame->getInfo()->field_30 > (data->field_49B + 1) || (data->direction == kDirectionLeft && data->sequence->count() == 1)) {
++data->field_49B;
- } else {
- if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) {
- ++data->field_49B;
- } else {
- if (data->frame->getInfo()->keepPreviousFrame == 1)
- keepPreviousFrame = true;
-
- // Increment current frame
- ++data->currentFrame;
+ } else if (data->frame->getInfo()->field_30 <= data->field_49B || data->frame->getInfo()->keepPreviousFrame) {
+ if (data->frame->getInfo()->keepPreviousFrame == 1)
+ keepPreviousFrame = true;
- if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
+ // Increment current frame
+ ++data->currentFrame;
- if (data->direction == kDirectionLeft) {
- data->currentFrame = 0;
- } else {
- keepPreviousFrame = true;
- drawNextSequence(entityIndex);
+ if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
- if (getFlags()->flag_entities_0 || data->doProcessEntity)
- return;
+ if (data->direction == kDirectionLeft) {
+ data->currentFrame = 0;
+ } else {
+ keepPreviousFrame = true;
+ drawNextSequence(entityIndex);
- if (!data->sequence2) {
- updateEntityPosition(entityIndex);
- data->doProcessEntity = false;
- return;
- }
+ if (getFlags()->flag_entities_0 || data->doProcessEntity)
+ return;
- copySequenceData(entityIndex);
+ if (!data->sequence2) {
+ updateEntityPosition(entityIndex);
+ data->doProcessEntity = false;
+ return;
}
+ copySequenceData(entityIndex);
}
- processFrame(entityIndex, keepPreviousFrame, false);
-
- if (getFlags()->flag_entities_0 || data->doProcessEntity)
- return;
}
+
+ processFrame(entityIndex, keepPreviousFrame, false);
+
+ if (getFlags()->flag_entities_0 || data->doProcessEntity)
+ return;
+ } else {
+ ++data->field_49B;
}
- INCREMENT_DIRECTION_COUNTER();
+ incrementDirectionCounter(data);
}
void Entities::computeCurrentFrame(EntityIndex entityIndex) const {
@@ -2283,7 +2278,7 @@ label_process_entity:
if (getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingUp)) {
getSavePoints()->push(kEntityPlayer, entity, kActionExcuseMeCath);
- } else if (getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingDown) || getScenes()->checkCurrentPosition(false)){
+ } else if (getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingDown) || getScenes()->checkCurrentPosition(false)) {
getSavePoints()->push(kEntityPlayer, entity, kActionExcuseMe);
if (getScenes()->checkCurrentPosition(false))
diff --git a/engines/lastexpress/game/entities.h b/engines/lastexpress/game/entities.h
index eb5eae461f..81aed627aa 100644
--- a/engines/lastexpress/game/entities.h
+++ b/engines/lastexpress/game/entities.h
@@ -344,6 +344,7 @@ private:
uint _positions[_positionsCount];
void executeCallbacks();
+ void incrementDirectionCounter(EntityData::EntityCallData *data) const;
void processEntity(EntityIndex entity);
void drawSequence(EntityIndex entity, const char *sequence, EntityDirection direction) const;
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp
index e417b1ec0d..11e7369ee1 100644
--- a/engines/lastexpress/game/inventory.cpp
+++ b/engines/lastexpress/game/inventory.cpp
@@ -26,17 +26,17 @@
#include "lastexpress/data/scene.h"
#include "lastexpress/data/snd.h"
+#include "lastexpress/game/entities.h"
#include "lastexpress/game/logic.h"
+#include "lastexpress/game/savegame.h"
#include "lastexpress/game/scenes.h"
#include "lastexpress/game/state.h"
#include "lastexpress/menu/menu.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -44,7 +44,7 @@
namespace LastExpress {
Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItemIndex(0), _itemsShown(0),
- _showingHourGlass(false), _blinkingEgg(false), _blinkingTime(0), _blinkingInterval(_defaultBlinkingInterval), _blinkingBrightness(1),
+ _showingHourGlass(false), _blinkingDirection(1), _blinkingBrightness(0),
_useMagnifier(false), _portraitHighlighted(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) {
//_inventoryRect = Common::Rect(0, 0, 32, 32);
@@ -162,13 +162,11 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
getMenu()->show(true, kSavegameTypeIndex, 0);
- } else if (ev.type == Common::EVENT_RBUTTONDOWN) {
- if (getGlobalTimer()) {
- if (getSoundQueue()->isBuffered("TIMER"))
- getSoundQueue()->removeFromQueue("TIMER");
+ } else if (ev.type == Common::EVENT_RBUTTONDOWN && getGlobalTimer()) {
+ if (getSoundQueue()->isBuffered("TIMER"))
+ getSoundQueue()->removeFromQueue("TIMER");
- setGlobalTimer(900);
- }
+ setGlobalTimer(900);
}
}
@@ -180,7 +178,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
if (_highlightedItemIndex)
drawHighlight(_highlightedItemIndex, true);
} else {
- // The user released the mouse button, we need to update the inventory state (clear hightlight and items)
+ // The user released the mouse button, we need to update the inventory state (clear highlight and items)
drawItem((CursorStyle)getProgress().portrait, 0, 0, 1);
_engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(0, 44, 32, (int16)(40 * _itemsShown + 40)));
_isOpened = false;
@@ -226,12 +224,11 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
if (getFlags()->mouseLeftPressed) {
if (getState()->sceneUseBackup) {
- if (getState()->sceneBackup2
- && getFirstExaminableItem() == _selectedItem) {
- SceneIndex sceneIndex = getState()->sceneBackup2;
- getState()->sceneBackup2 = kSceneNone;
+ if (getState()->sceneBackup2 && getFirstExaminableItem() == _selectedItem) {
+ SceneIndex sceneIndex = getState()->sceneBackup2;
+ getState()->sceneBackup2 = kSceneNone;
- getScenes()->loadScene(sceneIndex);
+ getScenes()->loadScene(sceneIndex);
}
} else {
getState()->sceneBackup = getState()->scene;
@@ -261,7 +258,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
// Change item highlight on list
if (getFlags()->mouseLeftPressed) {
- uint32 index = ev.mouse.y / 40;
+ uint32 index = (uint16)ev.mouse.y / 40;
if (_highlightedItemIndex && _highlightedItemIndex != index)
drawHighlight(_highlightedItemIndex, true);
@@ -418,12 +415,12 @@ void Inventory::show() {
drawEgg();
}
-void Inventory::setPortrait(InventoryItem item) {
+void Inventory::setPortrait(InventoryItem item) const {
getProgress().portrait = item;
drawItem((CursorStyle)getProgress().portrait, 0, 0);
}
-void Inventory::showHourGlass(){
+void Inventory::showHourGlass() const {
if (!getMenu()->isShown())
drawItem(kCursorHourGlass, 608, 448);
@@ -613,7 +610,7 @@ void Inventory::examine(InventoryItem item) {
}
}
-void Inventory::drawEgg() {
+void Inventory::drawEgg() const {
if (!getMenu()->isShown())
drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, _eggHightlighted ? 0 : 1);
@@ -621,40 +618,51 @@ void Inventory::drawEgg() {
}
// Blinking egg: we need to blink the egg for delta time, with the blinking getting faster until it's always lit.
-void Inventory::drawBlinkingEgg() {
+void Inventory::drawBlinkingEgg(uint ticks) {
+ uint globalTimer = (uint)getGlobalTimer();
+ uint timerValue = (getProgress().jacket == kJacketGreen) ? 450 : 225;
- warning("[Inventory::drawBlinkingEgg] Blinking not implemented");
+ if (globalTimer == timerValue || globalTimer == 900) {
+ _blinkingBrightness = 0;
+ _blinkingDirection = 1;
+ }
- //// TODO show egg (with or without mouseover)
+ globalTimer = globalTimer <= ticks ? 0 : globalTimer - ticks;
+ setGlobalTimer(globalTimer);
- //// Play timer sound
- //if (getGlobalTimer() < 90) {
- // if (getGlobalTimer() + ticks >= 90)
- // getSound()->playSoundWithSubtitles("TIMER.SND", 50331664, kEntityPlayer);
+ if (getFlags()->flag_0
+ || (globalTimer % 5) == 0
+ || (globalTimer <= 500 && (globalTimer % ((globalTimer + 100) / 100)) == 0))
+ blinkEgg();
- // if (getSoundQueue()->isBuffered("TIMER"))
- // setGlobalTimer(0);
- //}
+ if (globalTimer < 90) {
+ if ((globalTimer + ticks) >= 90)
+ getSound()->playSoundWithSubtitles("TIMER", (SoundFlag)(kFlagType13|kFlagDefault), kEntityPlayer);
- //// Restore egg to standard brightness
- //if (!getGlobalTimer()) {
- //
- //}
+ if (!getSoundQueue()->isBuffered("TIMER"))
+ setGlobalTimer(0);
+ }
+ if (globalTimer == 0) {
+ drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, _menuEggRect.contains(getCoords()) ? 1 : -1);
- //drawItem(608, 448, getMenu()->getGameId() + 39, _blinkingBrightness)
+ askForRedraw();
- //// TODO if delta time > _blinkingInterval, update egg & ask for redraw then adjust blinking time and remaining time
- //
+ getSaveLoad()->saveGame(kSavegameTypeAuto, kEntityChapters, 0);
+ }
+}
- //// Reset values and stop blinking
- //if (_blinkingTime == 0)
- // blinkEgg(false);
+void Inventory::blinkEgg() {
+ drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, (_blinkingBrightness == 0) ? -1 : (int16)_blinkingBrightness);
askForRedraw();
+
+ _blinkingBrightness += _blinkingDirection;
+ if (_blinkingBrightness == 0 || _blinkingBrightness == 3)
+ _blinkingDirection = -_blinkingDirection;
}
-void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessIndex) {
+void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessIndex) const {
Icon icon(id);
icon.setPosition(x, y);
@@ -678,7 +686,7 @@ void Inventory::drawSelectedItem() {
}
}
-void Inventory::clearSelectedItem() {
+void Inventory::clearSelectedItem() const {
_engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(44, 0, 44 + 32, 32));
}
@@ -733,7 +741,7 @@ void Inventory::drawHighlight(uint32 currentIndex, bool reset) {
}
}
-uint32 Inventory::getItemIndex(uint32 currentIndex) {
+uint32 Inventory::getItemIndex(uint32 currentIndex) const {
uint32 count = 0;
for (uint32 i = 1; i < ARRAYSIZE(_entries); i++) {
diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h
index b1995adce3..b1019a43c6 100644
--- a/engines/lastexpress/game/inventory.h
+++ b/engines/lastexpress/game/inventory.h
@@ -106,11 +106,10 @@ public:
// UI Control
void show();
- void blinkEgg(bool enabled);
- void showHourGlass();
- void setPortrait(InventoryItem item);
- void drawEgg();
- void drawBlinkingEgg();
+ void showHourGlass() const;
+ void setPortrait(InventoryItem item) const;
+ void drawEgg() const;
+ void drawBlinkingEgg(uint ticks = 1);
// Handle inventory UI events.
void handleMouseEvent(const Common::Event &ev);
@@ -133,8 +132,6 @@ public:
Common::String toString();
private:
- static const uint32 _defaultBlinkingInterval = 250; ///< Default blinking interval in ms
-
LastExpressEngine *_engine;
InventoryEntry _entries[32];
@@ -144,9 +141,7 @@ private:
uint32 _itemsShown;
bool _showingHourGlass;
- bool _blinkingEgg;
- uint32 _blinkingTime;
- uint32 _blinkingInterval;
+ int16 _blinkingDirection;
uint16 _blinkingBrightness;
// Flags
@@ -157,8 +152,6 @@ private:
Scene *_itemScene;
- // Important rects
- //Common::Rect _inventoryRect;
Common::Rect _menuEggRect;
Common::Rect _selectedItemRect;
@@ -168,14 +161,15 @@ private:
void close();
void examine(InventoryItem item);
void drawHighlight(uint32 currentIndex, bool reset);
- uint32 getItemIndex(uint32 currentIndex);
+ uint32 getItemIndex(uint32 currentIndex) const;
bool isItemSceneParameter(InventoryItem item) const;
- void drawItem(CursorStyle id, uint16 x, uint16 y, int16 brighnessIndex = -1);
+ void drawItem(CursorStyle id, uint16 x, uint16 y, int16 brighnessIndex = -1) const;
+ void blinkEgg();
void drawSelectedItem();
- void clearSelectedItem();
+ void clearSelectedItem() const;
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp
index aeac8cff98..09104d1bf9 100644
--- a/engines/lastexpress/game/logic.cpp
+++ b/engines/lastexpress/game/logic.cpp
@@ -47,10 +47,7 @@
#include "lastexpress/menu/menu.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
-#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -88,16 +85,6 @@ Logic::~Logic() {
//////////////////////////////////////////////////////////////////////////
// Event Handling
//////////////////////////////////////////////////////////////////////////
-#define REDRAW_CURSOR() { \
- if (getInventory()->isMagnifierInUse()) \
- _engine->getCursor()->setStyle(kCursorMagnifier); \
- if (getInventory()->isPortraitHighlighted() \
- || getInventory()->isOpened() \
- || getInventory()->isEggHighlighted()) \
- _engine->getCursor()->setStyle(kCursorNormal); \
- return; \
-}
-
void Logic::eventMouse(const Common::Event &ev) {
bool hotspotHandled = false;
@@ -168,7 +155,9 @@ void Logic::eventMouse(const Common::Event &ev) {
getInventory()->unselectItem();
}
- REDRAW_CURSOR()
+ redrawCursor();
+
+ return;
}
// Handle match case
@@ -194,7 +183,9 @@ void Logic::eventMouse(const Common::Event &ev) {
getScenes()->processScene();
}
- REDRAW_CURSOR()
+ redrawCursor();
+
+ return;
}
// Handle entity item case
@@ -315,7 +306,7 @@ void Logic::eventTick(const Common::Event &) {
//////////////////////////////////////////////////////////////////////////
// Draw the blinking egg if needed
if (getGlobalTimer() && !getFlags()->shouldDrawEggOrHourGlass)
- getInventory()->drawBlinkingEgg();
+ getInventory()->drawBlinkingEgg(ticks);
//////////////////////////////////////////////////////////////////////////
// Adjust time and save game if needed
@@ -411,9 +402,12 @@ void Logic::eventTick(const Common::Event &) {
* Resets the game state.
*/
void Logic::resetState() {
- getState()->scene = kSceneDefault;
+ getScenes()->setCoordinates(Common::Rect(80, 0, 559, 479));
+
+ SAFE_DELETE(_entities);
+ _entities = new Entities(_engine);
- warning("[Logic::resetState] Not implemented! You need to restart the engine until this is implemented.");
+ _state->reset();
}
/**
@@ -595,4 +589,14 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe
_engine->getCursor()->setStyle(style);
}
+void Logic::redrawCursor() const {
+ if (getInventory()->isMagnifierInUse())
+ _engine->getCursor()->setStyle(kCursorMagnifier);
+
+ if (getInventory()->isPortraitHighlighted()
+ || getInventory()->isOpened()
+ || getInventory()->isEggHighlighted())
+ _engine->getCursor()->setStyle(kCursorNormal);
+}
+
} // End of namespace LastExpress
diff --git a/engines/lastexpress/game/logic.h b/engines/lastexpress/game/logic.h
index 8b7dcef942..efb8f1e1a3 100644
--- a/engines/lastexpress/game/logic.h
+++ b/engines/lastexpress/game/logic.h
@@ -25,8 +25,6 @@
#include "lastexpress/shared.h"
-#include "lastexpress/game/entities.h"
-
#include "lastexpress/eventhandler.h"
#include "common/events.h"
@@ -75,6 +73,7 @@ private:
void switchChapter() const;
void showCredits() const;
+ void redrawCursor() const;
// Flags & Members
bool _flagActionPerformed;
diff --git a/engines/lastexpress/game/object.cpp b/engines/lastexpress/game/object.cpp
index d9e9e4279a..48df91ea6d 100644
--- a/engines/lastexpress/game/object.cpp
+++ b/engines/lastexpress/game/object.cpp
@@ -22,11 +22,11 @@
#include "lastexpress/game/object.h"
+#include "lastexpress/game/entities.h"
#include "lastexpress/game/logic.h"
#include "lastexpress/game/scenes.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
namespace LastExpress {
diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp
index 9c464feb6e..021dc40bb9 100644
--- a/engines/lastexpress/game/savegame.cpp
+++ b/engines/lastexpress/game/savegame.cpp
@@ -22,6 +22,7 @@
#include "lastexpress/game/savegame.h"
+#include "lastexpress/game/entities.h"
#include "lastexpress/game/inventory.h"
#include "lastexpress/game/logic.h"
#include "lastexpress/game/object.h"
@@ -34,13 +35,13 @@
#include "lastexpress/debug.h"
#include "lastexpress/lastexpress.h"
-#include "lastexpress/helpers.h"
#include "common/file.h"
-#include "common/system.h"
namespace LastExpress {
+#define DISABLE_COMPRESSION 1
+
// Names of savegames
static const struct {
const char *saveFile;
@@ -54,14 +55,305 @@ static const struct {
};
//////////////////////////////////////////////////////////////////////////
+// SavegameStream
+//////////////////////////////////////////////////////////////////////////
+
+uint32 SavegameStream::write(const void *dataPtr, uint32 dataSize) {
+#if !DISABLE_COMPRESSION
+ if (_enableCompression)
+ return writeCompressed(dataPtr, dataSize);
+#endif
+
+ return Common::MemoryWriteStreamDynamic::write(dataPtr, dataSize);
+}
+
+uint32 SavegameStream::read(void *dataPtr, uint32 dataSize) {
+#if !DISABLE_COMPRESSION
+ if (_enableCompression)
+ return readCompressed(dataPtr, dataSize);
+#endif
+
+ return readUncompressed(dataPtr, dataSize);
+}
+
+uint32 SavegameStream::readUncompressed(void *dataPtr, uint32 dataSize) {
+ if ((int32)dataSize > size() - pos()) {
+ dataSize = (uint32)(size() - pos());
+ _eos = true;
+ }
+ memcpy(dataPtr, getData() + pos(), dataSize);
+
+ seek(dataSize, SEEK_CUR);
+
+ return dataSize;
+}
+
+void SavegameStream::writeBuffer(uint8 value, bool onlyValue) {
+ if (_bufferOffset == -1)
+ _bufferOffset = 0;
+
+ if (_bufferOffset == 256) {
+ _bufferOffset = 0;
+ Common::MemoryWriteStreamDynamic::write(_buffer, 256);
+ }
+
+ if (onlyValue || value < 0xFB)
+ _buffer[_bufferOffset] = value;
+ else
+ _buffer[_bufferOffset] = 0xFE;
+
+ _offset++;
+ _bufferOffset++;
+
+ if (!onlyValue && value >= 0xFB)
+ {
+ if (_bufferOffset == 256) {
+ _bufferOffset = 0;
+ Common::MemoryWriteStreamDynamic::write(_buffer, 256);
+ }
+
+ _buffer[_bufferOffset] = value;
+
+ _bufferOffset++;
+ _offset++;
+ }
+}
+
+uint8 SavegameStream::readBuffer() {
+ if (_bufferOffset == -1 || _bufferOffset >= 256) {
+ readUncompressed(_buffer, 256);
+ _bufferOffset = 0;
+ }
+
+ byte val = _buffer[_bufferOffset];
+ _bufferOffset++;
+
+ return val;
+}
+
+uint32 SavegameStream::process() {
+ _enableCompression = !_enableCompression;
+
+#if DISABLE_COMPRESSION
+ return 0;
+#else
+ switch (_status) {
+ default:
+ break;
+
+ case kStatusReading:
+ _status = kStatusReady;
+ if (_bufferOffset != -1 && _bufferOffset != 256) {
+ seek(_bufferOffset - 256, SEEK_CUR);
+ _bufferOffset = -1;
+ }
+ break;
+
+ case kStatusWriting:
+ switch (_valueCount) {
+ default:
+ break;
+
+ case 1:
+ writeBuffer(_previousValue, false);
+ break;
+
+ case 2:
+ if (_previousValue) {
+ writeBuffer(0xFF);
+ writeBuffer(_repeatCount);
+ writeBuffer(_previousValue);
+ break;
+ }
+
+ if (_repeatCount == 3) {
+ writeBuffer(0xFB);
+ break;
+ }
+
+ if (_repeatCount == 255) {
+ writeBuffer(0xFC);
+ break;
+ }
+
+ writeBuffer(0xFD);
+ writeBuffer(_repeatCount);
+ break;
+ }
+
+ if (_bufferOffset != -1 && _bufferOffset != 0) {
+ Common::MemoryWriteStreamDynamic::write(_buffer, _bufferOffset);
+ _bufferOffset = -1;
+ }
+ break;
+ }
+
+ _status = kStatusReady;
+ _valueCount = 0;
+ uint32 offset = _offset;
+ _offset = 0;
+
+ return offset;
+#endif
+}
+
+uint32 SavegameStream::writeCompressed(const void *dataPtr, uint32 dataSize) {
+ if (_status == kStatusReading)
+ error("[SavegameStream::writeCompressed] Error: Compression buffer is in read mode.");
+
+ _status = kStatusWriting;
+ const byte *data = (const byte *)dataPtr;
+
+ while (dataSize) {
+ switch (_valueCount) {
+ default:
+ error("[SavegameStream::writeCompressed] Invalid value count (%d)", _valueCount);
+
+ case 0:
+ _previousValue = *data++;
+ _valueCount = 1;
+ break;
+
+ case 1:
+ if (*data != _previousValue) {
+ writeBuffer(_previousValue, false);
+ _previousValue = *data;
+ } else {
+ _valueCount = 2;
+ _repeatCount = 2;
+ }
+
+ ++data;
+ break;
+
+ case 2:
+ if (*data != _previousValue || _repeatCount >= 255) {
+ if (_previousValue) {
+ writeBuffer(0xFF, true);
+ writeBuffer((uint8)_repeatCount, true);
+ writeBuffer(_previousValue, true);
+
+ _previousValue = *data++;
+ _valueCount = 1;
+ break;
+ }
+
+ if (_repeatCount == 3) {
+ writeBuffer(0xFB, true);
+
+ _previousValue = *data++;
+ _valueCount = 1;
+ break;
+ }
+
+ if (_repeatCount == -1) {
+ writeBuffer(0xFC, true);
+
+ _previousValue = *data++;
+ _valueCount = 1;
+ break;
+ }
+
+ writeBuffer(0xFD, true);
+ writeBuffer((uint8)_repeatCount, true);
+
+ _previousValue = *data++;
+ _valueCount = 1;
+ }
+
+ ++data;
+ ++_repeatCount;
+ break;
+ }
+
+ --dataSize;
+ }
+
+ return _offset;
+}
+
+uint32 SavegameStream::readCompressed(void *dataPtr, uint32 dataSize) {
+ if (_status == kStatusWriting)
+ error("[SavegameStream::writeCompressed] Error: Compression buffer is in write mode.");
+
+ _status = kStatusReady;
+ byte *data = (byte *)dataPtr;
+
+ while (dataSize) {
+ switch (_valueCount) {
+ default:
+ error("[SavegameStream::readCompressed] Invalid value count (%d)", _valueCount);
+
+ case 0:
+ case 1: {
+ // Read control code
+ byte control = readBuffer();
+
+ switch (control) {
+ default:
+ // Data value
+ *data++ = control;
+ break;
+
+ case 0xFB:
+ _repeatCount = 2;
+ _previousValue = 0;
+ *data++ = 0;
+ _valueCount = 2;
+ break;
+
+ case 0xFC:
+ _repeatCount = 254;
+ _previousValue = 0;
+ *data++ = 0;
+ _valueCount = 2;
+ break;
+
+ case 0xFD:
+ _repeatCount = readBuffer() - 1;
+ _previousValue = 0;
+ *data++ = 0;
+ _valueCount = 2;
+ break;
+
+ case 0xFE:
+ *data++ = readBuffer();
+ break;
+
+ case 0xFF:
+ _repeatCount = readBuffer() - 1;
+ _previousValue = readBuffer();
+ *data++ = _previousValue;
+ _valueCount = 2;
+ break;
+ }
+ }
+ break;
+
+ case 2:
+ *data++ = _previousValue;
+ _repeatCount--;
+ if (!_repeatCount)
+ _valueCount = 1;
+ break;
+ }
+
+ --dataSize;
+ }
+
+ return _offset;
+}
+
+//////////////////////////////////////////////////////////////////////////
// Constructors
//////////////////////////////////////////////////////////////////////////
-SaveLoad::SaveLoad(LastExpressEngine *engine) : _engine(engine), _savegame(NULL), _gameTicksLastSavegame(0) {
+SaveLoad::SaveLoad(LastExpressEngine *engine) : _engine(engine), _savegame(NULL), _gameTicksLastSavegame(0), _entity(kEntityPlayer) {
}
SaveLoad::~SaveLoad() {
clear(true);
+ _savegame = NULL;
// Zero passed pointers
_engine = NULL;
@@ -81,6 +373,7 @@ void SaveLoad::flushStream(GameId id) {
error("[SaveLoad::flushStream] Savegame stream is invalid");
save->write(_savegame->getData(), (uint32)_savegame->size());
+ save->finalize();
delete save;
}
@@ -189,10 +482,10 @@ void SaveLoad::clear(bool clearStream) {
// Save & Load
//////////////////////////////////////////////////////////////////////////
-// Load game
-void SaveLoad::loadGame(GameId id) {
+// Load last saved game
+void SaveLoad::loadLastGame() {
if (!_savegame)
- error("[SaveLoad::loadGame] No savegame stream present");
+ error("[SaveLoad::loadLastGame] No savegame stream present");
// Rewind current savegame
_savegame->seek(0);
@@ -229,7 +522,29 @@ void SaveLoad::loadGame(GameId id) {
}
// Load a specific game entry
-void SaveLoad::loadGame(GameId id, uint32 index) {
+void SaveLoad::loadGame(uint32 index) {
+ if (!_savegame)
+ error("[SaveLoad::loadLastGame] No savegame stream present");
+
+ // Rewind current savegame
+ _savegame->seek(0);
+
+ // Write main header (with selected index)
+ SavegameMainHeader header;
+ header.count = index;
+ header.brightness = getState()->brightness;
+ header.volume = getState()->volume;
+
+ Common::Serializer ser(NULL, _savegame);
+ header.saveLoadWithSerializer(ser);
+
+ // TODO
+ // Go to the entry
+ // Load the entry
+ // Get offset (main and entry)
+ // Write main header again with correct entry offset
+ // Setup game and start
+
error("[SaveLoad::loadGame] Not implemented! (only loading the last entry is working for now)");
}
@@ -341,16 +656,52 @@ bool SaveLoad::loadMainHeader(Common::InSaveFile *stream, SavegameMainHeader *he
//////////////////////////////////////////////////////////////////////////
// Entries
//////////////////////////////////////////////////////////////////////////
-void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) {
-#define WRITE_ENTRY(name, func, val) { \
- uint32 _prevPosition = (uint32)_savegame->pos(); \
- func; \
- uint32 _count = (uint32)_savegame->pos() - _prevPosition; \
- debugC(kLastExpressDebugSavegame, "Savegame: Writing " #name ": %d bytes", _count); \
- if (_count != val)\
- error("[SaveLoad::writeEntry] Number of bytes written (%d) differ from expected count (%d)", _count, val); \
+uint32 SaveLoad::writeValue(Common::Serializer &ser, const char *name, Common::Functor1<Common::Serializer &, void> *function, uint size) {
+ if (!_savegame)
+ error("[SaveLoad::writeValue] Stream not initialized properly");
+
+ debugC(kLastExpressDebugSavegame, "Savegame: Writing %s: %u bytes", name, size);
+
+ uint32 prevPosition = (uint32)_savegame->pos();
+
+ // Serialize data into our buffer
+ (*function)(ser);
+
+ uint32 count = (uint32)_savegame->pos() - prevPosition;
+
+#if DISABLE_COMPRESSION
+ if (count != size)
+ error("[SaveLoad::writeValue] %s - Number of bytes written (%d) differ from expected count (%d)", name, count, size);
+#endif
+
+ return count;
}
+uint32 SaveLoad::readValue(Common::Serializer &ser, const char *name, Common::Functor1<Common::Serializer &, void> *function, uint size) {
+ if (!_savegame)
+ error("[SaveLoad::readValue] Stream not initialized properly");
+
+ debugC(kLastExpressDebugSavegame, "Savegame: Reading %s: %u bytes", name, size);
+
+ uint32 prevPosition = (uint32)_savegame->pos();
+
+ (*function)(ser);
+
+ uint32 count = (uint32)_savegame->pos() - prevPosition;
+
+#if DISABLE_COMPRESSION
+ if (size != 0 && count != size)
+ error("[SaveLoad::readValue] %s - Number of bytes read (%d) differ from expected count (%d)", name, count, size);
+#endif
+
+ return count;
+}
+
+void SaveLoad::syncEntity(Common::Serializer &ser) {
+ ser.syncAsUint32LE(_entity);
+}
+
+void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) {
if (!_savegame)
error("[SaveLoad::writeEntry] Savegame stream is invalid");
@@ -369,18 +720,22 @@ void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) {
header.saveLoadWithSerializer(ser);
// Write game data
- WRITE_ENTRY("entity index", ser.syncAsUint32LE(entity), 4);
- WRITE_ENTRY("state", getState()->saveLoadWithSerializer(ser), 4 + 4 + 4 + 4 + 1 + 4 + 4);
- WRITE_ENTRY("selected item", getInventory()->saveSelectedItem(ser), 4);
- WRITE_ENTRY("positions", getEntities()->savePositions(ser), 4 * 1000);
- WRITE_ENTRY("compartments", getEntities()->saveCompartments(ser), 4 * 16 * 2);
- WRITE_ENTRY("progress", getProgress().saveLoadWithSerializer(ser), 4 * 128);
- WRITE_ENTRY("events", getState()->syncEvents(ser), 512);
- WRITE_ENTRY("inventory", getInventory()->saveLoadWithSerializer(ser), 7 * 32);
- WRITE_ENTRY("objects", getObjects()->saveLoadWithSerializer(ser), 5 * 128);
- WRITE_ENTRY("entities", getEntities()->saveLoadWithSerializer(ser), 1262 * 40);
- WRITE_ENTRY("sound", getSoundQueue()->saveLoadWithSerializer(ser), 3 * 4 + getSoundQueue()->count() * 64);
- WRITE_ENTRY("savepoints", getSavePoints()->saveLoadWithSerializer(ser), 128 * 16 + 4 + getSavePoints()->count() * 16);
+ _entity = entity;
+
+ _savegame->process();
+ writeValue(ser, "entity index", WRAP_SYNC_FUNCTION(this, SaveLoad, syncEntity), 4);
+ writeValue(ser, "state", WRAP_SYNC_FUNCTION(getState(), State::GameState, saveLoadWithSerializer), 4 + 4 + 4 + 4 + 1 + 4 + 4);
+ writeValue(ser, "selected item", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveSelectedItem), 4);
+ writeValue(ser, "positions", WRAP_SYNC_FUNCTION(getEntities(), Entities, savePositions), 4 * 1000);
+ writeValue(ser, "compartments", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveCompartments), 4 * 16 * 2);
+ writeValue(ser, "progress", WRAP_SYNC_FUNCTION(&getProgress(), State::GameProgress, saveLoadWithSerializer), 4 * 128);
+ writeValue(ser, "events", WRAP_SYNC_FUNCTION(getState(), State::GameState, syncEvents), 512);
+ writeValue(ser, "inventory", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveLoadWithSerializer), 7 * 32);
+ writeValue(ser, "objects", WRAP_SYNC_FUNCTION(getObjects(), Objects, saveLoadWithSerializer), 5 * 128);
+ writeValue(ser, "entities", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveLoadWithSerializer), 1262 * 40);
+ writeValue(ser, "sound", WRAP_SYNC_FUNCTION(getSoundQueue(), SoundQueue, saveLoadWithSerializer), 3 * 4 + getSoundQueue()->count() * 64);
+ writeValue(ser, "savepoints", WRAP_SYNC_FUNCTION(getSavePoints(), SavePoints, saveLoadWithSerializer), 128 * 16 + 4 + getSavePoints()->count() * 16);
+ _savegame->process();
header.offset = (uint32)_savegame->pos() - (originalPosition + 32);
@@ -406,22 +761,6 @@ void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) {
}
void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, bool keepIndex) {
-#define LOAD_ENTRY(name, func, val) { \
- uint32 _prevPosition = (uint32)_savegame->pos(); \
- func; \
- uint32 _count = (uint32)_savegame->pos() - _prevPosition; \
- debugC(kLastExpressDebugSavegame, "Savegame: Reading " #name ": %d bytes", _count); \
- if (_count != val) \
- error("[SaveLoad::readEntry] Number of bytes read (%d) differ from expected count (%d)", _count, val); \
-}
-
-#define LOAD_ENTRY_ONLY(name, func) { \
- uint32 _prevPosition = (uint32)_savegame->pos(); \
- func; \
- uint32 _count = (uint32)_savegame->pos() - _prevPosition; \
- debugC(kLastExpressDebugSavegame, "Savegame: Reading " #name ": %d bytes", _count); \
-}
-
if (!type || !entity || !val)
error("[SaveLoad::readEntry] Invalid parameters passed");
@@ -444,20 +783,23 @@ void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, b
uint32 originalPosition = (uint32)_savegame->pos();
// Load game data
- LOAD_ENTRY("entity index", ser.syncAsUint32LE(*entity), 4);
- LOAD_ENTRY("state", getState()->saveLoadWithSerializer(ser), 4 + 4 + 4 + 4 + 1 + 4 + 4);
- LOAD_ENTRY("selected item", getInventory()->saveSelectedItem(ser), 4);
- LOAD_ENTRY("positions", getEntities()->savePositions(ser), 4 * 1000);
- LOAD_ENTRY("compartments", getEntities()->saveCompartments(ser), 4 * 16 * 2);
- LOAD_ENTRY("progress", getProgress().saveLoadWithSerializer(ser), 4 * 128);
- LOAD_ENTRY("events", getState()->syncEvents(ser), 512);
- LOAD_ENTRY("inventory", getInventory()->saveLoadWithSerializer(ser), 7 * 32);
- LOAD_ENTRY("objects", getObjects()->saveLoadWithSerializer(ser), 5 * 128);
- LOAD_ENTRY("entities", getEntities()->saveLoadWithSerializer(ser), 1262 * 40);
- LOAD_ENTRY_ONLY("sound", getSoundQueue()->saveLoadWithSerializer(ser));
- LOAD_ENTRY_ONLY("savepoints", getSavePoints()->saveLoadWithSerializer(ser));
+ _savegame->process();
+ readValue(ser, "entity index", WRAP_SYNC_FUNCTION(this, SaveLoad, syncEntity), 4);
+ readValue(ser, "state", WRAP_SYNC_FUNCTION(getState(), State::GameState, saveLoadWithSerializer), 4 + 4 + 4 + 4 + 1 + 4 + 4);
+ readValue(ser, "selected item", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveSelectedItem), 4);
+ readValue(ser, "positions", WRAP_SYNC_FUNCTION(getEntities(), Entities, savePositions), 4 * 1000);
+ readValue(ser, "compartments", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveCompartments), 4 * 16 * 2);
+ readValue(ser, "progress", WRAP_SYNC_FUNCTION(&getProgress(), State::GameProgress, saveLoadWithSerializer), 4 * 128);
+ readValue(ser, "events", WRAP_SYNC_FUNCTION(getState(), State::GameState, syncEvents), 512);
+ readValue(ser, "inventory", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveLoadWithSerializer), 7 * 32);
+ readValue(ser, "objects", WRAP_SYNC_FUNCTION(getObjects(), Objects, saveLoadWithSerializer), 5 * 128);
+ readValue(ser, "entities", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveLoadWithSerializer), 1262 * 40);
+ readValue(ser, "sound", WRAP_SYNC_FUNCTION(getSoundQueue(), SoundQueue, saveLoadWithSerializer));
+ readValue(ser, "savepoints", WRAP_SYNC_FUNCTION(getSavePoints(), SavePoints, saveLoadWithSerializer));
+ _savegame->process();
// Update chapter
+ *entity = _entity;
getProgress().chapter = entry.chapter;
// Skip padding
@@ -567,7 +909,7 @@ Common::InSaveFile *SaveLoad::openForLoading(GameId id) {
}
Common::OutSaveFile *SaveLoad::openForSaving(GameId id) {
- Common::OutSaveFile *save = g_system->getSavefileManager()->openForSaving(getFilename(id));
+ Common::OutSaveFile *save = g_system->getSavefileManager()->openForSaving(getFilename(id), false); // TODO Enable compression again
if (!save)
debugC(2, kLastExpressDebugSavegame, "Cannot open savegame for writing: %s", getFilename(id).c_str());
diff --git a/engines/lastexpress/game/savegame.h b/engines/lastexpress/game/savegame.h
index 6f0408487f..361957227e 100644
--- a/engines/lastexpress/game/savegame.h
+++ b/engines/lastexpress/game/savegame.h
@@ -80,11 +80,68 @@
namespace LastExpress {
// Savegame signatures
-#define SAVEGAME_SIGNATURE 0x12001200
-#define SAVEGAME_ENTRY_SIGNATURE 0xE660E660
+#define SAVEGAME_SIGNATURE 0x12001200 // 301994496
+#define SAVEGAME_ENTRY_SIGNATURE 0xE660E660 // 3865110112
+
+#define WRAP_SYNC_FUNCTION(instance, className, method) \
+ new Common::Functor1Mem<Common::Serializer &, void, className>(instance, &className::method)
class LastExpressEngine;
+class SavegameStream : public Common::MemoryWriteStreamDynamic, public Common::SeekableReadStream {
+public:
+ SavegameStream() : MemoryWriteStreamDynamic(DisposeAfterUse::YES), _eos(false) {
+ _enableCompression = false;
+ _bufferOffset = -1;
+ _valueCount = 0;
+ _previousValue = 0;
+ _repeatCount = 0;
+ _offset = 0;
+ _status = kStatusReady;
+
+ memset(_buffer, 0, 256);
+ }
+
+ int32 pos() const { return MemoryWriteStreamDynamic::pos(); }
+ int32 size() const { return MemoryWriteStreamDynamic::size(); }
+ bool seek(int32 offset, int whence = SEEK_SET) { return MemoryWriteStreamDynamic::seek(offset, whence); }
+ bool eos() const { return _eos; }
+ uint32 read(void *dataPtr, uint32 dataSize);
+ uint32 write(const void *dataPtr, uint32 dataSize);
+
+ uint32 process();
+
+private:
+ enum CompressedStreamStatus {
+ kStatusReady,
+ kStatusReading,
+ kStatusWriting
+ };
+
+ uint32 readUncompressed(void *dataPtr, uint32 dataSize);
+
+ // Compressed data
+ uint32 writeCompressed(const void *dataPtr, uint32 dataSize);
+ uint32 readCompressed(void *dataPtr, uint32 dataSize);
+
+ void writeBuffer(uint8 value, bool onlyValue = true);
+ uint8 readBuffer();
+
+private:
+ bool _eos;
+
+ // Compression handling
+ bool _enableCompression;
+ int16 _bufferOffset;
+ byte _valueCount;
+ byte _previousValue;
+ int16 _repeatCount;
+ uint32 _offset;
+ CompressedStreamStatus _status;
+
+ byte _buffer[256];
+};
+
class SaveLoad {
public:
SaveLoad(LastExpressEngine *engine);
@@ -96,8 +153,8 @@ public:
uint32 init(GameId id, bool resetHeaders);
// Save & Load
- void loadGame(GameId id);
- void loadGame(GameId id, uint32 index);
+ void loadLastGame();
+ void loadGame(uint32 index);
void saveGame(SavegameType type, EntityIndex entity, uint32 value);
void loadVolumeBrightness();
@@ -116,30 +173,6 @@ public:
uint32 getLastSavegameTicks() const { return _gameTicksLastSavegame; }
private:
- class SavegameStream : public Common::MemoryWriteStreamDynamic, public Common::SeekableReadStream {
- public:
- SavegameStream() : MemoryWriteStreamDynamic(DisposeAfterUse::YES),
- _eos(false) {}
-
- int32 pos() const { return MemoryWriteStreamDynamic::pos(); }
- int32 size() const { return MemoryWriteStreamDynamic::size(); }
- bool seek(int32 offset, int whence = SEEK_SET) { return MemoryWriteStreamDynamic::seek(offset, whence); }
- bool eos() const { return _eos; }
- uint32 read(void *dataPtr, uint32 dataSize) {
- if ((int32)dataSize > size() - pos()) {
- dataSize = size() - pos();
- _eos = true;
- }
- memcpy(dataPtr, getData() + pos(), dataSize);
-
- seek(dataSize, SEEK_CUR);
-
- return dataSize;
- }
- private:
- bool _eos;
- };
-
LastExpressEngine *_engine;
struct SavegameMainHeader : Common::Serializable {
@@ -268,6 +301,9 @@ private:
void writeEntry(SavegameType type, EntityIndex entity, uint32 val);
void readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, bool keepIndex);
+ uint32 writeValue(Common::Serializer &ser, const char *name, Common::Functor1<Common::Serializer &, void> *function, uint size);
+ uint32 readValue(Common::Serializer &ser, const char *name, Common::Functor1<Common::Serializer &, void> *function, uint size = 0);
+
SavegameEntryHeader *getEntry(uint32 index);
// Opening save files
@@ -279,6 +315,10 @@ private:
void initStream();
void loadStream(GameId id);
void flushStream(GameId id);
+
+ // Misc
+ EntityIndex _entity;
+ void syncEntity(Common::Serializer &ser);
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/game/savepoint.cpp b/engines/lastexpress/game/savepoint.cpp
index 64ae26c2be..8d14ec386b 100644
--- a/engines/lastexpress/game/savepoint.cpp
+++ b/engines/lastexpress/game/savepoint.cpp
@@ -26,7 +26,6 @@
#include "lastexpress/game/logic.h"
#include "lastexpress/game/state.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
@@ -95,7 +94,7 @@ void SavePoints::process() {
if (!updateEntityFromData(savepoint)) {
// Call requested callback
- Entity::Callback *callback = getCallback(savepoint.entity1);
+ Callback *callback = getCallback(savepoint.entity1);
if (callback && callback->isValid()) {
debugC(8, kLastExpressDebugLogic, "Savepoint: entity1=%s, action=%s, entity2=%s", ENTITY_NAME(savepoint.entity1), ACTION_NAME(savepoint.action), ENTITY_NAME(savepoint.entity2));
(*callback)(savepoint);
@@ -126,7 +125,7 @@ void SavePoints::addData(EntityIndex entity, ActionIndex action, uint32 param) {
//////////////////////////////////////////////////////////////////////////
// Callbacks
//////////////////////////////////////////////////////////////////////////
-void SavePoints::setCallback(EntityIndex index, Entity::Callback *callback) {
+void SavePoints::setCallback(EntityIndex index, Callback *callback) {
if (index >= 40)
error("[SavePoints::setCallback] Attempting to use an invalid entity index. Valid values 0-39, was %d", index);
@@ -136,7 +135,7 @@ void SavePoints::setCallback(EntityIndex index, Entity::Callback *callback) {
_callbacks[index] = callback;
}
-Entity::Callback *SavePoints::getCallback(EntityIndex index) const {
+Callback *SavePoints::getCallback(EntityIndex index) const {
if (index >= 40)
error("[SavePoints::getCallback] Attempting to use an invalid entity index. Valid values 0-39, was %d", index);
@@ -150,7 +149,7 @@ void SavePoints::call(EntityIndex entity2, EntityIndex entity1, ActionIndex acti
point.entity2 = entity2;
point.param.intValue = param;
- Entity::Callback *callback = getCallback(entity1);
+ Callback *callback = getCallback(entity1);
if (callback != NULL && callback->isValid()) {
debugC(8, kLastExpressDebugLogic, "Savepoint: entity1=%s, action=%s, entity2=%s, param=%d", ENTITY_NAME(entity1), ACTION_NAME(action), ENTITY_NAME(entity2), param);
(*callback)(point);
@@ -164,7 +163,7 @@ void SavePoints::call(EntityIndex entity2, EntityIndex entity1, ActionIndex acti
point.entity2 = entity2;
strcpy((char *)&point.param.charValue, param);
- Entity::Callback *callback = getCallback(entity1);
+ Callback *callback = getCallback(entity1);
if (callback != NULL && callback->isValid()) {
debugC(8, kLastExpressDebugLogic, "Savepoint: entity1=%s, action=%s, entity2=%s, param=%s", ENTITY_NAME(entity1), ACTION_NAME(action), ENTITY_NAME(entity2), param);
(*callback)(point);
@@ -181,7 +180,7 @@ void SavePoints::callAndProcess() {
bool isRunning = getFlags()->isGameRunning;
while (isRunning) {
- Entity::Callback *callback = getCallback(index);
+ Callback *callback = getCallback(index);
if (callback != NULL && callback->isValid()) {
(*callback)(savepoint);
isRunning = getFlags()->isGameRunning;
@@ -203,7 +202,7 @@ void SavePoints::callAndProcess() {
// Misc
//////////////////////////////////////////////////////////////////////////
bool SavePoints::updateEntityFromData(const SavePoint &savepoint) {
- for (int i = 0; i < (int)_data.size(); i++) {
+ for (uint i = 0; i < _data.size(); i++) {
// Not a data savepoint!
if (!_data[i].entity1)
@@ -211,7 +210,7 @@ bool SavePoints::updateEntityFromData(const SavePoint &savepoint) {
// Found our data!
if (_data[i].entity1 == savepoint.entity1 && _data[i].action == savepoint.action) {
- debugC(8, kLastExpressDebugLogic, "Update entity from data: entity1=%s, action=%s, param=%d", ENTITY_NAME(_data[i].entity1), ACTION_NAME(_data[i].action), _data[i].param);
+ debugC(8, kLastExpressDebugLogic, "Update entity from data: entity1=%s, action=%s, param=%u", ENTITY_NAME(_data[i].entity1), ACTION_NAME(_data[i].action), _data[i].param);
// the SavePoint param value is the index of the entity call parameter to update
getEntities()->get(_data[i].entity1)->getParamData()->updateParameters(_data[i].param);
@@ -243,7 +242,15 @@ void SavePoints::saveLoadWithSerializer(Common::Serializer &s) {
}
// Skip uninitialized data if any
- s.skip((_savePointsMaxSize - dataSize) * 16);
+ // (we are using a compressed stream, so we cannot seek on load)
+ uint32 unusedDataSize = (_savePointsMaxSize - dataSize) * 16;
+ if (s.isLoading()) {
+ byte *empty = (byte *)malloc(unusedDataSize);
+ s.syncBytes(empty, unusedDataSize);
+ free(empty);
+ } else {
+ s.skip(unusedDataSize);
+ }
// Number of savepoints
uint32 numSavepoints = _savepoints.size();
diff --git a/engines/lastexpress/game/savepoint.h b/engines/lastexpress/game/savepoint.h
index a3303b4b8a..005133891a 100644
--- a/engines/lastexpress/game/savepoint.h
+++ b/engines/lastexpress/game/savepoint.h
@@ -23,9 +23,8 @@
#ifndef LASTEXPRESS_SAVEPOINT_H
#define LASTEXPRESS_SAVEPOINT_H
-#include "lastexpress/entities/entity.h"
-
#include "lastexpress/helpers.h"
+#include "lastexpress/shared.h"
#include "common/array.h"
#include "common/list.h"
@@ -74,10 +73,9 @@ struct SavePoint {
}
};
-class SavePoints : Common::Serializable {
-private:
- typedef Common::Functor1<const SavePoint&, void> Callback;
+typedef Common::Functor1<const SavePoint&, void> Callback;
+class SavePoints : Common::Serializable {
public:
struct SavePointData {
@@ -112,7 +110,7 @@ public:
void addData(EntityIndex entity, ActionIndex action, uint32 param);
// Callbacks
- void setCallback(EntityIndex index, Entity::Callback *callback);
+ void setCallback(EntityIndex index, Callback *callback);
Callback *getCallback(EntityIndex entity) const;
void call(EntityIndex entity2, EntityIndex entity1, ActionIndex action, uint32 param = 0) const;
void call(EntityIndex entity2, EntityIndex entity1, ActionIndex action, const char *param) const;
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index b886951e0b..a2c7226b93 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -22,8 +22,6 @@
#include "lastexpress/game/scenes.h"
-#include "lastexpress/data/scene.h"
-
#include "lastexpress/game/action.h"
#include "lastexpress/game/beetle.h"
#include "lastexpress/game/entities.h"
@@ -34,10 +32,8 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -493,7 +489,7 @@ bool SceneManager::checkCurrentPosition(bool doCheckOtherCars) const {
if (position == 99)
return true;
- switch (car){
+ switch (car) {
default:
break;
@@ -743,24 +739,31 @@ void SceneManager::resetQueue() {
_queue.clear();
}
-void SceneManager::setCoordinates(SequenceFrame *frame) {
+void SceneManager::setCoordinates(const Common::Rect &rect) {
+ _flagCoordinates = true;
- if (!frame || frame->getInfo()->subType == 3)
- return;
+ if (_coords.right > rect.right)
+ _coords.right = rect.right;
- _flagCoordinates = true;
+ if (_coords.bottom > rect.bottom)
+ _coords.bottom = rect.bottom;
+
+ if (_coords.left < rect.left)
+ _coords.left = rect.left;
- if (_coords.right > (int)frame->getInfo()->xPos1)
- _coords.right = (int16)frame->getInfo()->xPos1;
+ if (_coords.top < rect.top)
+ _coords.top = rect.top;
+}
- if (_coords.bottom > (int)frame->getInfo()->yPos1)
- _coords.bottom = (int16)frame->getInfo()->yPos1;
+void SceneManager::setCoordinates(SequenceFrame *frame) {
- if (_coords.left < (int)frame->getInfo()->xPos2)
- _coords.left = (int16)frame->getInfo()->xPos2;
+ if (!frame || frame->getInfo()->subType == 3)
+ return;
- if (_coords.top < (int)frame->getInfo()->yPos2)
- _coords.top = (int16)frame->getInfo()->yPos2;
+ setCoordinates(Common::Rect((int16)frame->getInfo()->xPos1,
+ (int16)frame->getInfo()->yPos1,
+ (int16)frame->getInfo()->xPos2,
+ (int16)frame->getInfo()->yPos2));
}
void SceneManager::resetCoordinates() {
diff --git a/engines/lastexpress/game/scenes.h b/engines/lastexpress/game/scenes.h
index 172dde2683..1c7ae85f98 100644
--- a/engines/lastexpress/game/scenes.h
+++ b/engines/lastexpress/game/scenes.h
@@ -79,6 +79,7 @@ public:
void removeAndRedraw(SequenceFrame **frame, bool doRedraw);
void resetQueue();
void setCoordinates(SequenceFrame *frame);
+ void setCoordinates(const Common::Rect &rect);
// Helpers
SceneIndex getSceneIndexFromPosition(CarIndex car, Position position, int param3 = -1);
diff --git a/engines/lastexpress/game/state.cpp b/engines/lastexpress/game/state.cpp
index f3fd9720b1..02ede25595 100644
--- a/engines/lastexpress/game/state.cpp
+++ b/engines/lastexpress/game/state.cpp
@@ -49,6 +49,18 @@ State::~State() {
_engine = NULL;
}
+void State::reset() {
+ SAFE_DELETE(_inventory);
+ SAFE_DELETE(_objects);
+ SAFE_DELETE(_savepoints);
+ SAFE_DELETE(_state);
+
+ _inventory = new Inventory(_engine);
+ _objects = new Objects(_engine);
+ _savepoints = new SavePoints(_engine);
+ _state = new GameState();
+}
+
bool State::isNightTime() const {
return (_state->progress.chapter == kChapter1
|| _state->progress.chapter == kChapter4
diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h
index c937fdce9f..2c484f6976 100644
--- a/engines/lastexpress/game/state.h
+++ b/engines/lastexpress/game/state.h
@@ -621,6 +621,8 @@ public:
State(LastExpressEngine *engine);
~State();
+ void reset();
+
// Accessors
Inventory *getGameInventory() { return _inventory; }
Objects *getGameObjects() { return _objects; }
diff --git a/engines/lastexpress/graphics.cpp b/engines/lastexpress/graphics.cpp
index e129457256..753c3a39e4 100644
--- a/engines/lastexpress/graphics.cpp
+++ b/engines/lastexpress/graphics.cpp
@@ -160,7 +160,7 @@ void GraphicsManager::mergePlanes() {
void GraphicsManager::updateScreen() {
g_system->fillScreen(0);
- g_system->copyRectToScreen((byte *)_screen.getBasePtr(0, 0), 640 * 2, 0, 0, 640, 480);
+ g_system->copyRectToScreen(_screen.getBasePtr(0, 0), 640 * 2, 0, 0, 640, 480);
}
} // End of namespace LastExpress
diff --git a/engines/lastexpress/helpers.h b/engines/lastexpress/helpers.h
index 7f3f1e246c..02454be13d 100644
--- a/engines/lastexpress/helpers.h
+++ b/engines/lastexpress/helpers.h
@@ -27,6 +27,8 @@
// Misc helpers
//////////////////////////////////////////////////////////////////////////
+#define LOW_BYTE(w) ((unsigned char)(((unsigned long)(w)) & 0xff))
+
// Misc
#define getArchive(name) _engine->getResourceManager()->getFileStream(name)
#define rnd(value) _engine->getRandom().getRandomNumber(value - 1)
diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp
index 250fa0f2d0..01d2634dec 100644
--- a/engines/lastexpress/lastexpress.cpp
+++ b/engines/lastexpress/lastexpress.cpp
@@ -54,18 +54,17 @@ const char *g_entityNames[] = { "Player", "Anna", "August", "Mertens", "Coudert"
namespace LastExpress {
LastExpressEngine::LastExpressEngine(OSystem *syst, const ADGameDescription *gd) :
- Engine(syst), _gameDescription(gd),
- _debugger(NULL), _cursor(NULL),
- _font(NULL), _logic(NULL), _menu(NULL),
- _frameCounter(0), _lastFrameCount(0),
+ Engine(syst), _gameDescription(gd),
+ _debugger(NULL), _random("lastexpress"), _cursor(NULL),
+ _font(NULL), _logic(NULL), _menu(NULL),
+ _frameCounter(0), _lastFrameCount(0),
_graphicsMan(NULL), _resMan(NULL),
_sceneMan(NULL), _soundMan(NULL),
_eventMouse(NULL), _eventTick(NULL),
- _eventMouseBackup(NULL), _eventTickBackup(NULL),
- _random("lastexpress")
+ _eventMouseBackup(NULL), _eventTickBackup(NULL)
{
// Setup mixer
- syncSoundSettings();
+ Engine::syncSoundSettings();
// Adding the default directories
const Common::FSNode gameDataDir(ConfMan.get("path"));
diff --git a/engines/lastexpress/menu/menu.cpp b/engines/lastexpress/menu/menu.cpp
index f1a8bebe94..c48e55bb55 100644
--- a/engines/lastexpress/menu/menu.cpp
+++ b/engines/lastexpress/menu/menu.cpp
@@ -30,6 +30,7 @@
#include "lastexpress/fight/fight.h"
+#include "lastexpress/game/entities.h"
#include "lastexpress/game/inventory.h"
#include "lastexpress/game/logic.h"
#include "lastexpress/game/savegame.h"
@@ -41,10 +42,8 @@
#include "lastexpress/menu/trainline.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/sound/sound.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -865,7 +864,7 @@ void Menu::init(bool doSavegame, SavegameType type, uint32 value) {
doSavegame = false;
} else {
- // TODO rename saves?
+ warning("[Menu::initGame] Renaming saves not implemented");
}
// Create a new savegame if needed
@@ -876,7 +875,7 @@ void Menu::init(bool doSavegame, SavegameType type, uint32 value) {
getSaveLoad()->saveGame(kSavegameTypeEvent2, kEntityPlayer, kEventNone);
if (!getGlobalTimer()) {
- // TODO: remove existing savegame temp file
+ warning("[Menu::initGame] Removing temporary saves not implemented");
}
// Init savegame & menu values
@@ -917,13 +916,13 @@ void Menu::startGame() {
if (_lastIndex == _index) {
setGlobalTimer(0);
if (_index) {
- getSaveLoad()->loadGame(_gameId);
+ getSaveLoad()->loadLastGame();
} else {
getLogic()->resetState();
getEntities()->setup(true, kEntityPlayer);
}
} else {
- getSaveLoad()->loadGame(_gameId, _index);
+ getSaveLoad()->loadGame(_index);
}
}
diff --git a/engines/lastexpress/resource.cpp b/engines/lastexpress/resource.cpp
index ee4885e34e..1d010355ac 100644
--- a/engines/lastexpress/resource.cpp
+++ b/engines/lastexpress/resource.cpp
@@ -31,7 +31,6 @@
#include "common/debug.h"
#include "common/file.h"
-#include "common/textconsole.h"
namespace LastExpress {
@@ -129,13 +128,10 @@ bool ResourceManager::loadArchive(const Common::String &name) {
// Get a stream to file in the archive
// - same as createReadStreamForMember except it checks if the file exists and will assert / output a debug message if not
-Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String &name) {
+Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String &name) const {
// Check if the file exits in the archive
if (!hasFile(name)) {
-//#ifdef _DEBUG
-// error("[ResourceManager::getFileStream] Cannot open file: %s", name.c_str());
-//#endif
debugC(2, kLastExpressDebugResource, "Error opening file: %s", name.c_str());
return NULL;
}
diff --git a/engines/lastexpress/resource.h b/engines/lastexpress/resource.h
index f2f5d63bce..90ac9b87ad 100644
--- a/engines/lastexpress/resource.h
+++ b/engines/lastexpress/resource.h
@@ -42,7 +42,7 @@ public:
// Loading
bool loadArchive(ArchiveIndex type);
static bool isArchivePresent(ArchiveIndex type);
- Common::SeekableReadStream *getFileStream(const Common::String &name);
+ Common::SeekableReadStream *getFileStream(const Common::String &name) const;
// Archive functions
bool hasFile(const Common::String &name) const;
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index d60a498447..56cf730e24 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -80,7 +80,8 @@ enum SoundFlag {
kFlagMusic = 0x5000010,
kFlagType3 = 0x6000000,
kFlagLoop = 0x6001008,
- kFlagType9 = 0x7000000
+ kFlagType9 = 0x7000000,
+ kFlagNIS = 0x7002010
};
enum SoundState {
@@ -1732,62 +1733,6 @@ enum ActionIndex {
kActionEnd
};
-//////////////////////////////////////////////////////////////////////////
-// Functors classes used by the engine
-//////////////////////////////////////////////////////////////////////////
-
-// FIXME is this achievable with the existing Functor1Mem function
-template<class Arg, class Res, class T>
-class Functor1MemConst : public Common::Functor1<Arg, Res> {
-public:
- typedef Res (T::*FuncType)(Arg) const;
-
- Functor1MemConst(T *t, const FuncType &func) : _t(t), _func(func) {}
-
- bool isValid() const { return _func != 0 && _t != 0; }
- Res operator()(Arg v1) const {
- return (_t->*_func)(v1);
- }
-private:
- mutable T *_t;
- const FuncType _func;
-};
-
-// FIXME move this to existing func.h file
-template<class Arg1, class Arg2, class Arg3, class Arg4, class Result>
-struct QuaternaryFunction {
- typedef Arg1 FirstArgumentType;
- typedef Arg2 SecondArgumentType;
- typedef Arg3 ThirdArgumentType;
- typedef Arg4 FourthArgumentType;
- typedef Result ResultType;
-};
-
-template<class Arg1, class Arg2, class Arg3, class Arg4, class Res>
-struct Functor4 : public QuaternaryFunction<Arg1, Arg2, Arg3, Arg4, Res> {
- virtual ~Functor4() {}
-
- virtual bool isValid() const = 0;
- virtual Res operator()(Arg1, Arg2, Arg3, Arg4) const = 0;
-};
-
-template<class Arg1, class Arg2, class Arg3, class Arg4, class Res, class T>
-class Functor4Mem : public Functor4<Arg1, Arg2, Arg3, Arg4, Res> {
-public:
- typedef Res (T::*FuncType)(Arg1, Arg2, Arg3, Arg4);
-
- Functor4Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
-
- bool isValid() const { return _func != 0 && _t != 0; }
- Res operator()(Arg1 v1, Arg2 v2, Arg3 v3, Arg4 v4) const {
- return (_t->*_func)(v1, v2, v3, v4);
- }
-private:
- mutable T *_t;
- const FuncType _func;
-};
-
-
} // End of namespace LastExpress
#endif // LASTEXPRESS_SHARED_H
diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp
index 44cc68a57b..3d22657124 100644
--- a/engines/lastexpress/sound/entry.cpp
+++ b/engines/lastexpress/sound/entry.cpp
@@ -30,11 +30,9 @@
#include "lastexpress/sound/sound.h"
#include "lastexpress/graphics.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
-#include "common/stream.h"
namespace LastExpress {
@@ -47,6 +45,8 @@ namespace LastExpress {
SoundEntry::SoundEntry(LastExpressEngine *engine) : _engine(engine) {
_type = kSoundTypeNone;
+ _currentDataPtr = NULL;
+
_blockCount = 0;
_time = 0;
@@ -71,7 +71,13 @@ SoundEntry::~SoundEntry() {
// Entries that have been queued will have their streamed disposed automatically
if (!_soundStream)
SAFE_DELETE(_stream);
- delete _soundStream;
+
+ SAFE_DELETE(_soundStream);
+
+ free(_currentDataPtr);
+
+ _subtitle = NULL;
+ _stream = NULL;
// Zero passed pointers
_engine = NULL;
@@ -110,10 +116,8 @@ void SoundEntry::close() {
}
void SoundEntry::play() {
- if (!_stream) {
- warning("[SoundEntry::play] stream has been disposed");
- return;
- }
+ if (!_stream)
+ error("[SoundEntry::play] stream has been disposed");
// Prepare sound stream
if (!_soundStream)
@@ -277,7 +281,7 @@ bool SoundEntry::updateSound() {
int l = strlen(sub) + 1;
if (l - 1 > 4)
- sub[l - 1 - 4] = 0;
+ sub[l - (1 + 4)] = 0;
showSubtitle(sub);
}
} else {
@@ -393,6 +397,10 @@ SubtitleEntry::SubtitleEntry(LastExpressEngine *engine) : _engine(engine) {
SubtitleEntry::~SubtitleEntry() {
SAFE_DELETE(_data);
+
+ // Zero-out passed pointers
+ _sound = NULL;
+ _engine = NULL;
}
void SubtitleEntry::load(Common::String filename, SoundEntry *soundEntry) {
@@ -423,6 +431,9 @@ void SubtitleEntry::loadData() {
}
void SubtitleEntry::setupAndDraw() {
+ if (!_sound)
+ error("[SubtitleEntry::setupAndDraw] Sound entry not initialized");
+
if (!_data) {
_data = new SubtitleManager(_engine->getFont());
_data->load(getArchive(_filename));
diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp
index 33b4c06793..8904b48930 100644
--- a/engines/lastexpress/sound/queue.cpp
+++ b/engines/lastexpress/sound/queue.cpp
@@ -26,6 +26,7 @@
#include "lastexpress/game/state.h"
#include "lastexpress/sound/entry.h"
+#include "lastexpress/sound/sound.h"
#include "lastexpress/helpers.h"
#include "lastexpress/lastexpress.h"
@@ -39,6 +40,7 @@ SoundQueue::SoundQueue(LastExpressEngine *engine) : _engine(engine) {
_subtitlesFlag = 0;
_currentSubtitle = NULL;
+ //_soundCacheData = NULL;
}
SoundQueue::~SoundQueue() {
@@ -51,6 +53,7 @@ SoundQueue::~SoundQueue() {
_subtitles.clear();
_currentSubtitle = NULL;
+ //SAFE_DELETE(_soundCacheData);
// Zero passed pointers
_engine = NULL;
@@ -64,6 +67,8 @@ void SoundQueue::handleTimer() {
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
SoundEntry *entry = (*i);
+ if (entry == NULL)
+ error("[SoundQueue::handleTimer] Invalid entry found in sound queue");
// When the entry has stopped playing, we remove his buffer
if (entry->isFinished()) {
@@ -120,6 +125,8 @@ void SoundQueue::updateQueue() {
for (Common::List<SoundEntry *>::iterator it = _soundList.begin(); it != _soundList.end(); ++it) {
SoundEntry *entry = *it;
+ if (entry == NULL)
+ error("[SoundQueue::updateQueue] Invalid entry found in sound queue");
// Original removes the entry data from the cache and sets the archive as not loaded
// and if the sound data buffer is not full, loads a new entry to be played based on
@@ -134,7 +141,7 @@ void SoundQueue::updateQueue() {
// Original update the current entry, loading another set of samples to be decoded
- getFlags()->flag_3 = 0;
+ getFlags()->flag_3 = false;
--_flag;
}
@@ -176,6 +183,8 @@ void SoundQueue::clearQueue() {
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
SoundEntry *entry = (*i);
+ if (entry == NULL)
+ error("[SoundQueue::clearQueue] Invalid entry found in sound queue");
// Delete entry
entry->close();
@@ -340,13 +349,14 @@ void SoundQueue::updateSubtitles() {
return;
}
+ if (!subtitle)
+ return;
+
if (_subtitlesFlag & 1)
subtitle->drawOnScreen();
- if (subtitle) {
- subtitle->loadData();
- subtitle->setupAndDraw();
- }
+ subtitle->loadData();
+ subtitle->setupAndDraw();
}
//////////////////////////////////////////////////////////////////////////
@@ -368,7 +378,15 @@ void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
(*i)->saveLoadWithSerializer(s);
} else {
warning("[Sound::saveLoadWithSerializer] Loading not implemented");
- s.skip(numEntries * 64);
+
+ uint32 unusedDataSize = numEntries * 64;
+ if (s.isLoading()) {
+ byte *empty = (byte *)malloc(unusedDataSize);
+ s.syncBytes(empty, unusedDataSize);
+ free(empty);
+ } else {
+ s.skip(unusedDataSize);
+ }
}
}
diff --git a/engines/lastexpress/sound/queue.h b/engines/lastexpress/sound/queue.h
index 75fe06883a..e1f9be1cf7 100644
--- a/engines/lastexpress/sound/queue.h
+++ b/engines/lastexpress/sound/queue.h
@@ -106,7 +106,7 @@ private:
// Entries
Common::List<SoundEntry *> _soundList; ///< List of all sound entries
- void *_soundCacheData;
+ //void *_soundCacheData;
// Subtitles
int _subtitlesFlag;
diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp
index 2f7bb4a601..319f7cd4f4 100644
--- a/engines/lastexpress/sound/sound.cpp
+++ b/engines/lastexpress/sound/sound.cpp
@@ -33,7 +33,6 @@
#include "lastexpress/sound/entry.h"
#include "lastexpress/sound/queue.h"
-#include "lastexpress/helpers.h"
#include "lastexpress/graphics.h"
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
@@ -675,7 +674,7 @@ const char *SoundManager::getDialogName(EntityIndex entity) const {
//////////////////////////////////////////////////////////////////////////
// Letters & Messages
//////////////////////////////////////////////////////////////////////////
-void SoundManager::readText(int id){
+void SoundManager::readText(int id) {
if (!_queue->isBuffered(kEntityTables4))
return;
@@ -1330,23 +1329,23 @@ void SoundManager::playLoopingSound(int param) {
}
} else {
switch (getEntityData(kEntityPlayer)->car) {
- case 1:
- case 6:
+ case kCarBaggageRear:
+ case kCarBaggage:
partNumber = 4;
break;
- case 2:
- case 3:
- case 4:
- case 5:
+ case kCarKronos:
+ case kCarGreenSleeping:
+ case kCarRedSleeping:
+ case kCarRestaurant:
partNumber = 1;
break;
- case 7:
+ case kCarCoalTender:
partNumber = 5;
break;
- case 8:
+ case kCarLocomotive:
partNumber = 99;
break;
- case 9:
+ case kCar9:
partNumber = 3;
break;
default:
@@ -1357,13 +1356,13 @@ void SoundManager::playLoopingSound(int param) {
}
if (partNumber != 99)
- sprintf(tmp, "LOOP%d%c.SND", partNumber, _engine->getRandom().getRandomNumber(numLoops[partNumber] - 1) + 'A');
+ sprintf(tmp, "LOOP%d%c.SND", partNumber, (char)(_engine->getRandom().getRandomNumber(numLoops[partNumber] - 1) + 'A'));
}
if (getFlags()->flag_3)
fnameLen = 5;
- if (!entry || scumm_strnicmp(entry->getName2().c_str(), tmp, fnameLen)) {
+ if (!entry || scumm_strnicmp(entry->getName2().c_str(), tmp, (uint)fnameLen)) {
_loopingSoundDuration = _engine->getRandom().getRandomNumber(319) + 260;
if (partNumber != 99) {
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp
index ef4a22f73a..3fbbf84469 100644
--- a/engines/lure/debugger.cpp
+++ b/engines/lure/debugger.cpp
@@ -119,21 +119,21 @@ bool Debugger::cmd_listRooms(int argc, const char **argv) {
DebugPrintf("Available rooms are:\n");
for (RoomDataList::iterator i = rooms.begin(); i != rooms.end(); ++i) {
- RoomData *room = (*i).get();
+ RoomData const &room = **i;
// Explictly note the second drawbridge room as "Alt"
- if (room->roomNumber == 49) {
+ if (room.roomNumber == 49) {
strings.getString(47, buffer);
strcat(buffer, " (alt)");
} else {
- strings.getString(room->roomNumber, buffer);
+ strings.getString(room.roomNumber, buffer);
}
- DebugPrintf("#%d - %s", room->roomNumber, buffer);
+ DebugPrintf("#%d - %s", room.roomNumber, buffer);
if (++ctr % 3 == 0) DebugPrintf("\n");
else {
// Write out spaces between columns
- int numSpaces = 25 - strlen(buffer) - ((room->roomNumber >= 10) ? 2 : 1);
+ int numSpaces = 25 - strlen(buffer) - (room.roomNumber >= 10 ? 2 : 1);
char *s = buffer;
while (numSpaces-- > 0) *s++ = ' ';
*s = '\0';
@@ -243,13 +243,13 @@ bool Debugger::cmd_hotspots(int argc, const char **argv) {
// Loop for displaying active hotspots
HotspotList::iterator i;
for (i = res.activeHotspots().begin(); i != res.activeHotspots().end(); ++i) {
- Hotspot *hotspot = (*i).get();
+ Hotspot const &hotspot = **i;
- if (hotspot->nameId() == 0) strcpy(buffer, "none");
- else strings.getString(hotspot->nameId(), buffer);
+ if (hotspot.nameId() == 0) strcpy(buffer, "none");
+ else strings.getString(hotspot.nameId(), buffer);
- DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot->hotspotId(), buffer,
- hotspot->x(), hotspot->y(), hotspot->roomNumber());
+ DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot.hotspotId(), buffer,
+ hotspot.x(), hotspot.y(), hotspot.roomNumber());
}
} else {
// Presume it's a room's hotspots
@@ -257,14 +257,14 @@ bool Debugger::cmd_hotspots(int argc, const char **argv) {
HotspotDataList::iterator i;
for (i = res.hotspotData().begin(); i != res.hotspotData().end(); ++i) {
- HotspotData *hotspot = (*i).get();
+ HotspotData const &hotspot = **i;
- if (hotspot->roomNumber == roomNumber) {
- if (hotspot->nameId == 0) strcpy(buffer, "none");
- else strings.getString(hotspot->nameId, buffer);
+ if (hotspot.roomNumber == roomNumber) {
+ if (hotspot.nameId == 0) strcpy(buffer, "none");
+ else strings.getString(hotspot.nameId, buffer);
- DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot->hotspotId, buffer,
- hotspot->startX, hotspot->startY, hotspot->roomNumber);
+ DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot.hotspotId, buffer,
+ hotspot.startX, hotspot.startY, hotspot.roomNumber);
}
}
}
@@ -415,10 +415,10 @@ bool Debugger::cmd_room(int argc, const char **argv) {
else {
RoomExitHotspotList::iterator i;
for (i = exits.begin(); i != exits.end(); ++i) {
- RoomExitHotspotData *rec = (*i).get();
+ RoomExitHotspotData const &rec = **i;
DebugPrintf("\nArea - (%d,%d)-(%d,%d) Room=%d Cursor=%d Hotspot=%xh",
- rec->xs, rec->ys, rec->xe, rec->ye, rec->destRoomNumber, rec->cursorNum, rec->hotspotId);
+ rec.xs, rec.ys, rec.xe, rec.ye, rec.destRoomNumber, rec.cursorNum, rec.hotspotId);
}
DebugPrintf("\n");
@@ -430,11 +430,11 @@ bool Debugger::cmd_room(int argc, const char **argv) {
else {
RoomExitList::iterator i2;
for (i2 = room->exits.begin(); i2 != room->exits.end(); ++i2) {
- RoomExitData *rec2 = (*i2).get();
+ RoomExitData const &rec2 = **i2;
DebugPrintf("\nExit - (%d,%d)-(%d,%d) Dest=%d,(%d,%d) Dir=%s Sequence=%xh",
- rec2->xs, rec2->ys, rec2->xe, rec2->ye, rec2->roomNumber,
- rec2->x, rec2->y, directionList[rec2->direction], rec2->sequenceOffset);
+ rec2.xs, rec2.ys, rec2.xe, rec2.ye, rec2.roomNumber,
+ rec2.x, rec2.y, directionList[rec2.direction], rec2.sequenceOffset);
}
DebugPrintf("\n");
diff --git a/engines/lure/decode.cpp b/engines/lure/decode.cpp
index 1338559534..484126c43f 100644
--- a/engines/lure/decode.cpp
+++ b/engines/lure/decode.cpp
@@ -255,7 +255,7 @@ MemoryBlock *PictureDecoder::vgaDecode(MemoryBlock *src, uint32 maxOutputSize) {
decrCtr();
if (shlCarry())
break;
-
+
AL = dataIn->data()[BP + 3];
} else {
decrCtr();
@@ -375,7 +375,7 @@ uint32 AnimationDecoder::decode_data(MemoryBlock *src, MemoryBlock *dest, uint32
// Main loop
bool loopFlag = true;
while (loopFlag) {
- for (;;) {
+ for (;;) {
carry = false;
rcl(currData, carry);
if (--bitCtr == 0) {
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp
index 9542c35785..eaed7ebbe7 100644
--- a/engines/lure/game.cpp
+++ b/engines/lure/game.cpp
@@ -71,12 +71,12 @@ void Game::tick() {
uint16 *idList = new uint16[res.activeHotspots().size()];
int idSize = 0;
for (i = res.activeHotspots().begin(); i != res.activeHotspots().end(); ++i) {
- Hotspot *hotspot = (*i).get();
+ Hotspot const &hotspot = **i;
- if (!_preloadFlag || ((hotspot->layer() != 0xff) &&
- (hotspot->hotspotId() < FIRST_NONCHARACTER_ID)))
+ if (!_preloadFlag || ((hotspot.layer() != 0xff) &&
+ (hotspot.hotspotId() < FIRST_NONCHARACTER_ID)))
// Add hotspot to list to execute
- idList[idSize++] = hotspot->hotspotId();
+ idList[idSize++] = hotspot.hotspotId();
}
debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot ticks begin");
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index c7e7e81900..ee7a185ea1 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -430,7 +430,7 @@ bool Hotspot::isActiveAnimation() {
return ((_numFrames != 0) && (_layer != 0));
}
-uint16 Hotspot::nameId() {
+uint16 Hotspot::nameId() const {
if (_data == NULL)
return 0;
else
@@ -1169,30 +1169,30 @@ bool Hotspot::doorCloseCheck(uint16 doorId) {
HotspotList::iterator i;
HotspotList &lst = res.activeHotspots();
for (i = lst.begin(); i != lst.end(); ++i) {
- Hotspot *hsCurrent = (*i).get();
+ Hotspot const &hsCurrent = **i;
// Skip entry if it's the door or the character
- if ((hsCurrent->hotspotId() == hotspotId()) ||
- (hsCurrent->hotspotId() == doorHotspot->hotspotId()))
+ if ((hsCurrent.hotspotId() == hotspotId()) ||
+ (hsCurrent.hotspotId() == doorHotspot->hotspotId()))
continue;
// Skip entry if it doesn't meet certain criteria
- if ((hsCurrent->layer() == 0) ||
- (hsCurrent->roomNumber() != doorHotspot->roomNumber()) ||
- (hsCurrent->hotspotId() < PLAYER_ID) ||
- ((hsCurrent->hotspotId() >= 0x408) && (hsCurrent->hotspotId() < 0x2710)))
+ if ((hsCurrent.layer() == 0) ||
+ (hsCurrent.roomNumber() != doorHotspot->roomNumber()) ||
+ (hsCurrent.hotspotId() < PLAYER_ID) ||
+ ((hsCurrent.hotspotId() >= 0x408) && (hsCurrent.hotspotId() < 0x2710)))
continue;
// Also skip entry if special Id
- if ((hsCurrent->hotspotId() == 0xfffe) || (hsCurrent->hotspotId() == 0xffff))
+ if ((hsCurrent.hotspotId() == 0xfffe) || (hsCurrent.hotspotId() == 0xffff))
continue;
// Check to see if the character is intersecting the door area
- int tempY = hsCurrent->y() + hsCurrent->heightCopy();
- if ((hsCurrent->x() >= bounds.right) ||
- (hsCurrent->x() + hsCurrent->widthCopy() <= bounds.left) ||
- (tempY + hsCurrent->charRectY() < bounds.top) ||
- (tempY - hsCurrent->yCorrection() - hsCurrent->charRectY() > bounds.bottom))
+ int tempY = hsCurrent.y() + hsCurrent.heightCopy();
+ if ((hsCurrent.x() >= bounds.right) ||
+ (hsCurrent.x() + hsCurrent.widthCopy() <= bounds.left) ||
+ (tempY + hsCurrent.charRectY() < bounds.top) ||
+ (tempY - hsCurrent.yCorrection() - hsCurrent.charRectY() > bounds.bottom))
continue;
// At this point we know a character is blocking door, so return false
@@ -1883,12 +1883,12 @@ void Hotspot::doStatus(HotspotData *hotspot) {
HotspotDataList &list = res.hotspotData();
HotspotDataList::iterator i;
for (i = list.begin(); i != list.end(); ++i) {
- HotspotData *rec = (*i).get();
+ HotspotData const &rec = **i;
- if (rec->roomNumber == PLAYER_ID) {
+ if (rec.roomNumber == PLAYER_ID) {
if (numItems++ == 0) strcat(buffer, ": ");
else strcat(buffer, ", ");
- strings.getString(rec->nameId, buffer + strlen(buffer));
+ strings.getString(rec.nameId, buffer + strlen(buffer));
}
}
@@ -2286,7 +2286,7 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) {
charHotspot->hotspotId, id);
}
-void Hotspot::saveToStream(Common::WriteStream *stream) {
+void Hotspot::saveToStream(Common::WriteStream *stream) const {
if (_data)
_data->npcSchedule.saveToStream(stream);
else
@@ -4113,7 +4113,7 @@ void HotspotTickHandlers::npcRoomChange(Hotspot &h) {
// This method performs rounding of the number of steps depending on direciton
-int WalkingActionEntry::numSteps() {
+int WalkingActionEntry::numSteps() const {
switch (_direction) {
case UP:
case DOWN:
@@ -4385,8 +4385,8 @@ Common::String PathFinder::getDebugInfo() const {
WalkingActionList::const_iterator i;
for (i = _list.begin(); i != _list.end(); ++i) {
- WalkingActionEntry *e = (*i).get();
- buffer += Common::String::format("Direction=%d, numSteps=%d\n", e->direction(), e->numSteps());
+ WalkingActionEntry const &e = **i;
+ buffer += Common::String::format("Direction=%d, numSteps=%d\n", e.direction(), e.numSteps());
}
return buffer;
@@ -4496,7 +4496,7 @@ void PathFinder::initVars() {
_countdownCtr -= 700;
}
-void PathFinder::saveToStream(Common::WriteStream *stream) {
+void PathFinder::saveToStream(Common::WriteStream *stream) const {
stream->writeByte(_inUse);
if (_inUse) {
@@ -4504,11 +4504,10 @@ void PathFinder::saveToStream(Common::WriteStream *stream) {
stream->write(_layer, sizeof(RoomPathsDecompressedData));
// Save any active step sequence
- WalkingActionList::iterator i;
- for (i = _list.begin(); i != _list.end(); ++i) {
- WalkingActionEntry *entry = (*i).get();
- stream->writeByte(entry->direction());
- stream->writeSint16LE(entry->rawSteps());
+ for (WalkingActionList::const_iterator i = _list.begin(); i != _list.end(); ++i) {
+ WalkingActionEntry &entry = **i;
+ stream->writeByte(entry.direction());
+ stream->writeSint16LE(entry.rawSteps());
}
stream->writeByte(0xff);
stream->writeSint16LE(_stepCtr);
@@ -4683,18 +4682,17 @@ bool Support::isCharacterInList(uint16 *lst, int numEntries, uint16 charId) {
return false;
}
-void HotspotList::saveToStream(Common::WriteStream *stream) {
- HotspotList::iterator i;
- for (i = begin(); i != end(); ++i) {
- Hotspot *hotspot = (*i).get();
- debugC(ERROR_INTERMEDIATE, kLureDebugAnimations, "Saving hotspot %xh", hotspot->hotspotId());
- bool dynamicObject = hotspot->hotspotId() != hotspot->originalId();
- stream->writeUint16LE(hotspot->originalId());
+void HotspotList::saveToStream(Common::WriteStream *stream) const {
+ for (HotspotList::const_iterator i = begin(); i != end(); ++i) {
+ Hotspot const &hotspot = **i;
+ debugC(ERROR_INTERMEDIATE, kLureDebugAnimations, "Saving hotspot %xh", hotspot.hotspotId());
+ bool dynamicObject = hotspot.hotspotId() != hotspot.originalId();
+ stream->writeUint16LE(hotspot.originalId());
stream->writeByte(dynamicObject);
- stream->writeUint16LE(hotspot->destHotspotId());
- hotspot->saveToStream(stream);
+ stream->writeUint16LE(hotspot.destHotspotId());
+ hotspot.saveToStream(stream);
- debugC(ERROR_DETAILED, kLureDebugAnimations, "Saved hotspot %xh", hotspot->hotspotId());
+ debugC(ERROR_DETAILED, kLureDebugAnimations, "Saved hotspot %xh", hotspot.hotspotId());
}
stream->writeUint16LE(0);
}
diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h
index a58a34456e..85d36dc138 100644
--- a/engines/lure/hotspots.h
+++ b/engines/lure/hotspots.h
@@ -111,9 +111,9 @@ private:
int _numSteps;
public:
WalkingActionEntry(Direction dir, int steps): _direction(dir), _numSteps(steps) {}
- Direction direction() { return _direction; }
+ Direction direction() const { return _direction; }
int &rawSteps() { return _numSteps; }
- int numSteps();
+ int numSteps() const;
};
enum PathFinderResult {PF_UNFINISHED, PF_OK, PF_DEST_OCCUPIED, PF_PART_PATH, PF_NO_WALK};
@@ -158,11 +158,11 @@ public:
Common::String getDebugInfo() const;
void pop() { _list.erase(_list.begin()); }
- WalkingActionEntry &top() { return **_list.begin(); }
- bool isEmpty() { return _list.empty(); }
+ WalkingActionEntry &top() const { return **_list.begin(); }
+ bool isEmpty() const { return _list.empty(); }
int &stepCtr() { return _stepCtr; }
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -279,62 +279,62 @@ public:
void setAnimation(uint16 newAnimId);
void setAnimationIndex(int animIndex);
void setAnimation(HotspotAnimData *newRecord);
- uint16 hotspotId() { return _hotspotId; }
- uint16 originalId() { return _originalId; }
- Surface &frames() { return *_frames; }
- HotspotAnimData &anim() { return *_anim; }
- HotspotData *resource() { return _data; }
- uint16 numFrames() { return _numFrames; }
- uint16 frameNumber() { return _frameNumber; }
+ uint16 hotspotId() const { return _hotspotId; }
+ uint16 originalId() const { return _originalId; }
+ Surface &frames() const { return *_frames; }
+ HotspotAnimData &anim() const { return *_anim; }
+ HotspotData *resource() const { return _data; }
+ uint16 numFrames() const { return _numFrames; }
+ uint16 frameNumber() const { return _frameNumber; }
void setFrameNumber(uint16 frameNum) {
assert(frameNum < _numFrames);
_frameNumber = frameNum;
}
void incFrameNumber();
- Direction direction() { return _direction; }
- uint16 frameWidth() { return _width; }
- int16 x() { return _startX; }
- int16 y() { return _startY; }
- int16 destX() { return _destX; }
- int16 destY() { return _destY; }
- int8 talkX() { return _talkX; }
- int8 talkY() { return _talkY; }
- uint16 destHotspotId() { return _destHotspotId; }
- uint16 blockedOffset() { return _blockedOffset; }
- uint8 exitCtr() { return _exitCtr; }
- bool walkFlag() { return _walkFlag; }
- uint16 startRoomNumber() { return _startRoomNumber; }
- uint16 width() { return _width; }
- uint16 height() { return _height; }
- uint16 widthCopy() { return _widthCopy; }
- uint16 heightCopy() { return _heightCopy; }
- uint16 yCorrection() { return _yCorrection; }
- uint16 charRectY() { return _charRectY; }
- uint16 roomNumber() { return _roomNumber; }
- uint16 talkScript() {
+ Direction direction() const { return _direction; }
+ uint16 frameWidth() const { return _width; }
+ int16 x() const { return _startX; }
+ int16 y() const { return _startY; }
+ int16 destX() const { return _destX; }
+ int16 destY() const { return _destY; }
+ int8 talkX() const { return _talkX; }
+ int8 talkY() const { return _talkY; }
+ uint16 destHotspotId() const { return _destHotspotId; }
+ uint16 blockedOffset() const { return _blockedOffset; }
+ uint8 exitCtr() const { return _exitCtr; }
+ bool walkFlag() const { return _walkFlag; }
+ uint16 startRoomNumber() const { return _startRoomNumber; }
+ uint16 width() const { return _width; }
+ uint16 height() const { return _height; }
+ uint16 widthCopy() const { return _widthCopy; }
+ uint16 heightCopy() const { return _heightCopy; }
+ uint16 yCorrection() const { return _yCorrection; }
+ uint16 charRectY() const { return _charRectY; }
+ uint16 roomNumber() const { return _roomNumber; }
+ uint16 talkScript() const {
assert(_data);
return _data->talkScriptOffset;
}
- uint16 hotspotScript() { return _hotspotScriptOffset; }
- uint8 layer() { return _layer; }
- bool skipFlag() { return _skipFlag; }
+ uint16 hotspotScript() const { return _hotspotScriptOffset; }
+ uint8 layer() const { return _layer; }
+ bool skipFlag() const { return _skipFlag; }
void setTickProc(uint16 newVal);
- bool persistant() { return _persistant; }
+ bool persistant() const { return _persistant; }
void setPersistant(bool value) { _persistant = value; }
- uint8 colorOffset() { return _colorOffset; }
+ uint8 colorOffset() const { return _colorOffset; }
void setColorOffset(uint8 value) { _colorOffset = value; }
void setRoomNumber(uint16 roomNum) {
_roomNumber = roomNum;
if (_data) _data->roomNumber = roomNum;
}
- uint16 nameId();
+ uint16 nameId() const;
const char *getName();
bool isActiveAnimation();
void setPosition(int16 newX, int16 newY);
void setDestPosition(int16 newX, int16 newY) { _destX = newX; _destY = newY; }
void setDestHotspot(uint16 id) { _destHotspotId = id; }
void setExitCtr(uint8 value) { _exitCtr = value; }
- BlockedState blockedState() {
+ BlockedState blockedState() const {
assert(_data);
return _data->blockedState;
}
@@ -342,7 +342,7 @@ public:
assert(_data);
_data->blockedState = newState;
}
- bool blockedFlag() {
+ bool blockedFlag() const {
assert(_data);
return _data->blockedFlag;
}
@@ -376,7 +376,7 @@ public:
}
void setCharRectY(uint16 value) { _charRectY = value; }
void setSkipFlag(bool value) { _skipFlag = value; }
- CharacterMode characterMode() {
+ CharacterMode characterMode() const {
assert(_data != NULL);
return _data->characterMode;
}
@@ -384,7 +384,7 @@ public:
assert(_data != NULL);
_data->characterMode = value;
}
- uint16 delayCtr() {
+ uint16 delayCtr() const {
assert(_data);
return _data->delayCtr;
}
@@ -392,7 +392,7 @@ public:
assert(_data);
_data->delayCtr = value;
}
- uint16 pauseCtr() {
+ uint16 pauseCtr() const {
assert(_data);
return _data->pauseCtr;
}
@@ -400,7 +400,7 @@ public:
assert(_data);
_data->pauseCtr = value;
}
- VariantBool coveredFlag() {
+ VariantBool coveredFlag() const {
assert(_data);
return _data->coveredFlag;
}
@@ -408,7 +408,7 @@ public:
assert(_data);
_data->coveredFlag = value;
}
- uint16 useHotspotId() {
+ uint16 useHotspotId() const {
assert(_data);
return _data->useHotspotId;
}
@@ -416,7 +416,7 @@ public:
assert(_data);
_data->useHotspotId = value;
}
- uint16 talkGate() {
+ uint16 talkGate() const {
assert(_data);
return _data->talkGate;
}
@@ -424,7 +424,7 @@ public:
assert(_data);
_data->talkGate = value;
}
- uint16 supportValue() { return _supportValue; }
+ uint16 supportValue() const { return _supportValue; }
void setSupportValue(uint16 value) { _supportValue = value; }
void copyTo(Surface *dest);
@@ -449,16 +449,16 @@ public:
void doAction();
void doAction(Action action, HotspotData *hotspot);
- CurrentActionStack &currentActions() {
+ CurrentActionStack &currentActions() const {
assert(_data);
return _data->npcSchedule;
}
PathFinder &pathFinder() { return _pathFinder; }
DestStructure &tempDest() { return _tempDest; }
- uint16 frameCtr() { return _frameCtr; }
+ uint16 frameCtr() const { return _frameCtr; }
void setFrameCtr(uint16 value) { _frameCtr = value; }
void decrFrameCtr() { if (_frameCtr > 0) --_frameCtr; }
- uint8 actionCtr() {
+ uint8 actionCtr() const {
assert(_data);
return _data->actionCtr;
}
@@ -466,7 +466,7 @@ public:
assert(_data);
_data->actionCtr = v;
}
- uint8 voiceCtr() { return _voiceCtr; }
+ uint8 voiceCtr() const { return _voiceCtr; }
void setVoiceCtr(uint8 v) { _voiceCtr = v; }
// Miscellaneous
@@ -477,13 +477,13 @@ public:
void scheduleConverse(uint16 destHotspot, uint16 messageId);
void handleTalkDialog();
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
class HotspotList: public Common::List<Common::SharedPtr<Hotspot> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 61de2bf165..5a0dd26cba 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -276,11 +276,11 @@ uint16 PopupMenu::ShowInventory() {
HotspotDataList::iterator i;
for (i = rsc.hotspotData().begin(); i != rsc.hotspotData().end(); ++i) {
- HotspotData *hotspot = (*i).get();
- if (hotspot->roomNumber == PLAYER_ID) {
- idList[itemCtr] = hotspot->hotspotId;
+ HotspotData const &hotspot = **i;
+ if (hotspot.roomNumber == PLAYER_ID) {
+ idList[itemCtr] = hotspot.hotspotId;
char *hotspotName = itemNames[itemCtr++] = (char *) malloc(MAX_HOTSPOT_NAME_SIZE);
- strings.getString(hotspot->nameId, hotspotName);
+ strings.getString(hotspot.nameId, hotspotName);
}
}
@@ -317,52 +317,52 @@ uint16 PopupMenu::ShowItems(Action contextAction, uint16 roomNumber) {
// Loop for rooms
for (ir = rooms.begin(); ir != rooms.end(); ++ir) {
- RoomData *roomData = (*ir).get();
+ RoomData const &roomData = **ir;
// Pre-condition checks for whether to skip room
- if ((roomData->hdrFlags != 15) && ((roomData->hdrFlags & fields.hdrFlagMask()) == 0))
+ if ((roomData.hdrFlags != 15) && ((roomData.hdrFlags & fields.hdrFlagMask()) == 0))
continue;
- if (((roomData->flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((roomData->flags & HOTSPOTFLAG_FOUND) == 0))
+ if (((roomData.flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((roomData.flags & HOTSPOTFLAG_FOUND) == 0))
continue;
- if ((roomData->actions & contextBitflag) == 0)
+ if ((roomData.actions & contextBitflag) == 0)
continue;
// Add room to list of entries to display
if (numItems == MAX_NUM_DISPLAY_ITEMS) error("Out of space in ask list");
- entryIds[numItems] = roomData->roomNumber;
- nameIds[numItems] = roomData->roomNumber;
+ entryIds[numItems] = roomData.roomNumber;
+ nameIds[numItems] = roomData.roomNumber;
entryNames[numItems] = (char *) Memory::alloc(MAX_HOTSPOT_NAME_SIZE);
- strings.getString(roomData->roomNumber, entryNames[numItems]);
+ strings.getString(roomData.roomNumber, entryNames[numItems]);
++numItems;
}
// Loop for hotspots
for (ih = hotspots.begin(); ih != hotspots.end(); ++ih) {
- HotspotData *hotspot = (*ih).get();
+ HotspotData const &hotspot = **ih;
- if ((hotspot->headerFlags != 15) &&
- ((hotspot->headerFlags & fields.hdrFlagMask()) == 0))
+ if ((hotspot.headerFlags != 15) &&
+ ((hotspot.headerFlags & fields.hdrFlagMask()) == 0))
continue;
- if (((hotspot->flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((hotspot->flags & HOTSPOTFLAG_FOUND) == 0))
+ if (((hotspot.flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((hotspot.flags & HOTSPOTFLAG_FOUND) == 0))
// Skip the current hotspot
continue;
// If the hotspot is room specific, skip if the character will not be in the specified room
- if (((hotspot->flags & HOTSPOTFLAG_ROOM_SPECIFIC) != 0) &&
- (hotspot->roomNumber != roomNumber))
+ if (((hotspot.flags & HOTSPOTFLAG_ROOM_SPECIFIC) != 0) &&
+ (hotspot.roomNumber != roomNumber))
continue;
// If hotspot does not allow action, then skip it
- if ((hotspot->actions & contextBitflag) == 0)
+ if ((hotspot.actions & contextBitflag) == 0)
continue;
// If a special hotspot Id, then skip displaying
- if ((hotspot->nameId == 0x17A) || (hotspot->nameId == 0x147))
+ if ((hotspot.nameId == 0x17A) || (hotspot.nameId == 0x147))
continue;
// Check if the hotspot's name is already used in an already set item
itemCtr = 0;
- while ((itemCtr < numItems) && (nameIds[itemCtr] != hotspot->nameId))
+ while ((itemCtr < numItems) && (nameIds[itemCtr] != hotspot.nameId))
++itemCtr;
if (itemCtr != numItems)
// Item's name is already present - skip hotspot
@@ -370,10 +370,10 @@ uint16 PopupMenu::ShowItems(Action contextAction, uint16 roomNumber) {
// Add hotspot to list of entries to display
if (numItems == MAX_NUM_DISPLAY_ITEMS) error("Out of space in ask list");
- entryIds[numItems] = hotspot->hotspotId;
- nameIds[numItems] = hotspot->nameId;
+ entryIds[numItems] = hotspot.hotspotId;
+ nameIds[numItems] = hotspot.nameId;
entryNames[numItems] = (char *) Memory::alloc(MAX_HOTSPOT_NAME_SIZE);
- strings.getString(hotspot->nameId, entryNames[numItems]);
+ strings.getString(hotspot.nameId, entryNames[numItems]);
++numItems;
}
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 6328301233..9ec641140b 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -386,7 +386,6 @@ RoomData *Resources::getRoom(uint16 roomNumber) {
for (i = _roomData.begin(); i != _roomData.end(); ++i) {
RoomData *rec = (*i).get();
if (rec->roomNumber == roomNumber) return rec;
- ++rec;
}
return NULL;
@@ -678,9 +677,9 @@ void Resources::deactivateHotspot(uint16 hotspotId, bool isDestId) {
HotspotList::iterator i = _activeHotspots.begin();
while (i != _activeHotspots.end()) {
- Hotspot *h = (*i).get();
- if ((!isDestId && (h->hotspotId() == hotspotId)) ||
- (isDestId && (h->destHotspotId() == hotspotId) && (h->hotspotId() == 0xffff))) {
+ Hotspot const &h = **i;
+ if ((!isDestId && (h.hotspotId() == hotspotId)) ||
+ (isDestId && (h.destHotspotId() == hotspotId) && (h.hotspotId() == 0xffff))) {
_activeHotspots.erase(i);
break;
}
@@ -708,8 +707,7 @@ uint16 Resources::numInventoryItems() {
HotspotDataList &list = _hotspotData;
HotspotDataList::iterator i;
for (i = list.begin(); i != list.end(); ++i) {
- HotspotData *rec = (*i).get();
- if (rec->roomNumber == PLAYER_ID) ++numItems;
+ if ((*i)->roomNumber == PLAYER_ID) ++numItems;
}
return numItems;
@@ -754,12 +752,12 @@ void Resources::saveToStream(Common::WriteStream *stream) {
// Save out the schedule for any non-active NPCs
HotspotDataList::iterator i;
for (i = _hotspotData.begin(); i != _hotspotData.end(); ++i) {
- HotspotData *rec = (*i).get();
- if (!rec->npcSchedule.isEmpty()) {
- Hotspot *h = getActiveHotspot(rec->hotspotId);
+ HotspotData const &rec = **i;
+ if (!rec.npcSchedule.isEmpty()) {
+ Hotspot *h = getActiveHotspot(rec.hotspotId);
if (h == NULL) {
- stream->writeUint16LE(rec->hotspotId);
- rec->npcSchedule.saveToStream(stream);
+ stream->writeUint16LE(rec.hotspotId);
+ rec.npcSchedule.saveToStream(stream);
}
}
}
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index 222f55b5dc..aee4f11215 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -278,13 +278,11 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character
// Room data class
-void RoomDataList::saveToStream(Common::WriteStream *stream) {
- RoomDataList::iterator i;
-
- for (i = begin(); i != end(); ++i) {
- RoomData *rec = (*i).get();
- stream->writeByte(rec->flags);
- const byte *pathData = rec->paths.data();
+void RoomDataList::saveToStream(Common::WriteStream *stream) const {
+ for (RoomDataList::const_iterator i = begin(); i != end(); ++i) {
+ RoomData const &rec = **i;
+ stream->writeByte(rec.flags);
+ const byte *pathData = rec.paths.data();
stream->write(pathData, ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH);
}
}
@@ -294,10 +292,10 @@ void RoomDataList::loadFromStream(Common::ReadStream *stream) {
byte data[ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH];
for (i = begin(); i != end(); ++i) {
- RoomData *rec = (*i).get();
- rec->flags = stream->readByte();
+ RoomData &rec = **i;
+ rec.flags = stream->readByte();
stream->read(data, ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH);
- rec->paths.load(data);
+ rec.paths.load(data);
}
}
@@ -317,17 +315,17 @@ RoomExitJoinData::RoomExitJoinData(RoomExitJoinResource *rec) {
blocked = rec->blocked;
}
-void RoomExitJoinList::saveToStream(Common::WriteStream *stream) {
- for (RoomExitJoinList::iterator i = begin(); i != end(); ++i) {
- RoomExitJoinData *rec = (*i).get();
-
- stream->writeUint16LE(rec->hotspots[0].hotspotId);
- stream->writeUint16LE(rec->hotspots[1].hotspotId);
- stream->writeByte(rec->hotspots[0].currentFrame);
- stream->writeByte(rec->hotspots[0].destFrame);
- stream->writeByte(rec->hotspots[1].currentFrame);
- stream->writeByte(rec->hotspots[1].destFrame);
- stream->writeByte(rec->blocked);
+void RoomExitJoinList::saveToStream(Common::WriteStream *stream) const {
+ for (RoomExitJoinList::const_iterator i = begin(); i != end(); ++i) {
+ RoomExitJoinData const &rec = **i;
+
+ stream->writeUint16LE(rec.hotspots[0].hotspotId);
+ stream->writeUint16LE(rec.hotspots[1].hotspotId);
+ stream->writeByte(rec.hotspots[0].currentFrame);
+ stream->writeByte(rec.hotspots[0].destFrame);
+ stream->writeByte(rec.hotspots[1].currentFrame);
+ stream->writeByte(rec.hotspots[1].destFrame);
+ stream->writeByte(rec.blocked);
}
// Write end of list marker
@@ -336,21 +334,21 @@ void RoomExitJoinList::saveToStream(Common::WriteStream *stream) {
void RoomExitJoinList::loadFromStream(Common::ReadStream *stream) {
for (RoomExitJoinList::iterator i = begin(); i != end(); ++i) {
- RoomExitJoinData *rec = (*i).get();
+ RoomExitJoinData &rec = **i;
uint16 hotspot1Id = stream->readUint16LE();
if (hotspot1Id == 0xffff) error("Invalid room exit join list");
uint16 hotspot2Id = stream->readUint16LE();
- if ((rec->hotspots[0].hotspotId != hotspot1Id) ||
- (rec->hotspots[1].hotspotId != hotspot2Id))
+ if ((rec.hotspots[0].hotspotId != hotspot1Id) ||
+ (rec.hotspots[1].hotspotId != hotspot2Id))
break;
- rec->hotspots[0].currentFrame = stream->readByte();
- rec->hotspots[0].destFrame = stream->readByte();
- rec->hotspots[1].currentFrame = stream->readByte();
- rec->hotspots[1].destFrame = stream->readByte();
- rec->blocked = stream->readByte();
+ rec.hotspots[0].currentFrame = stream->readByte();
+ rec.hotspots[0].destFrame = stream->readByte();
+ rec.hotspots[1].currentFrame = stream->readByte();
+ rec.hotspots[1].destFrame = stream->readByte();
+ rec.blocked = stream->readByte();
}
// Read final end of list marker
@@ -368,8 +366,8 @@ HotspotActionData::HotspotActionData(HotspotActionResource *rec) {
uint16 HotspotActionList::getActionOffset(Action action) {
iterator i;
for (i = begin(); i != end(); ++i) {
- HotspotActionData *rec = (*i).get();
- if (rec->action == action) return rec->sequenceOffset;
+ HotspotActionData const &rec = **i;
+ if (rec.action == action) return rec.sequenceOffset;
}
return 0;
@@ -435,7 +433,7 @@ HotspotData::HotspotData(HotspotResource *rec) {
npcScheduleId = READ_LE_UINT16(&rec->npcSchedule);
}
-void HotspotData::saveToStream(Common::WriteStream *stream) {
+void HotspotData::saveToStream(Common::WriteStream *stream) const {
// Write out the basic fields
stream->writeUint16LE(nameId);
stream->writeUint16LE(descId);
@@ -534,12 +532,11 @@ void HotspotData::loadFromStream(Common::ReadStream *stream) {
// Hotspot data list
-void HotspotDataList::saveToStream(Common::WriteStream *stream) {
- iterator i;
- for (i = begin(); i != end(); ++i) {
- HotspotData *hotspot = (*i).get();
- stream->writeUint16LE(hotspot->hotspotId);
- hotspot->saveToStream(stream);
+void HotspotDataList::saveToStream(Common::WriteStream *stream) const {
+ for (const_iterator i = begin(); i != end(); ++i) {
+ HotspotData const &hotspot = **i;
+ stream->writeUint16LE(hotspot.hotspotId);
+ hotspot.saveToStream(stream);
}
stream->writeUint16LE(0);
}
@@ -582,14 +579,14 @@ bool MovementDataList::getFrame(uint16 currentFrame, int16 &xChange,
iterator i;
for (i = begin(); i != end(); ++i) {
- MovementData *rec = (*i).get();
+ MovementData const &rec = **i;
if (foundFlag || (i == begin())) {
- xChange = rec->xChange;
- yChange = rec->yChange;
- nextFrame = rec->frameNumber;
+ xChange = rec.xChange;
+ yChange = rec.yChange;
+ nextFrame = rec.frameNumber;
if (foundFlag) return true;
}
- if (rec->frameNumber == currentFrame) foundFlag = true;
+ if (rec.frameNumber == currentFrame) foundFlag = true;
}
return true;
@@ -699,15 +696,12 @@ TalkEntryData *TalkData::getResponse(int index) {
// The following class acts as a container for all the NPC conversations
-void TalkDataList::saveToStream(Common::WriteStream *stream) {
- TalkDataList::iterator i;
- for (i = begin(); i != end(); ++i) {
- TalkData *rec = (*i).get();
- TalkEntryList::iterator i2;
+void TalkDataList::saveToStream(Common::WriteStream *stream) const {
+ for (TalkDataList::const_iterator i = begin(); i != end(); ++i) {
+ TalkData const &rec = **i;
- for (i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) {
- TalkEntryData *entry = (*i2).get();
- stream->writeUint16LE(entry->descId);
+ for (TalkEntryList::const_iterator i2 = rec.entries.begin(); i2 != rec.entries.end(); ++i2) {
+ stream->writeUint16LE((*i2)->descId);
}
}
}
@@ -715,12 +709,10 @@ void TalkDataList::saveToStream(Common::WriteStream *stream) {
void TalkDataList::loadFromStream(Common::ReadStream *stream) {
TalkDataList::iterator i;
for (i = begin(); i != end(); ++i) {
- TalkData *rec = (*i).get();
- TalkEntryList::iterator i2;
+ TalkData const &rec = **i;
- for (i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) {
- TalkEntryData *entry = (*i2).get();
- entry->descId = stream->readUint16LE();
+ for (TalkEntryList::const_iterator i2 = rec.entries.begin(); i2 != rec.entries.end(); ++i2) {
+ (*i2)->descId = stream->readUint16LE();
}
}
}
@@ -785,17 +777,17 @@ void SequenceDelayList::tick() {
g_system->getMillis());
for (i = begin(); i != end(); ++i) {
- SequenceDelayData *entry = (*i).get();
- debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check %xh at time %d", entry->sequenceOffset, entry->timeoutCtr);
+ SequenceDelayData &entry = **i;
+ debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check %xh at time %d", entry.sequenceOffset, entry.timeoutCtr);
- if (entry->timeoutCtr <= GAME_FRAME_DELAY) {
+ if (entry.timeoutCtr <= GAME_FRAME_DELAY) {
// Timeout reached - delete entry from list and execute the sequence
- uint16 seqOffset = entry->sequenceOffset;
+ uint16 seqOffset = entry.sequenceOffset;
erase(i);
Script::execute(seqOffset);
return;
} else {
- entry->timeoutCtr -= GAME_FRAME_DELAY;
+ entry.timeoutCtr -= GAME_FRAME_DELAY;
}
}
}
@@ -804,22 +796,19 @@ void SequenceDelayList::clear(bool forceClear) {
SequenceDelayList::iterator i = begin();
while (i != end()) {
- SequenceDelayData *entry = (*i).get();
- if (entry->canClear || forceClear)
+ if ((*i)->canClear || forceClear)
i = erase(i);
else
++i;
}
}
-void SequenceDelayList::saveToStream(Common::WriteStream *stream) {
- SequenceDelayList::iterator i;
-
- for (i = begin(); i != end(); ++i) {
- SequenceDelayData *entry = (*i).get();
- stream->writeUint16LE(entry->sequenceOffset);
- stream->writeUint32LE(entry->timeoutCtr);
- stream->writeByte(entry->canClear);
+void SequenceDelayList::saveToStream(Common::WriteStream *stream) const {
+ for (SequenceDelayList::const_iterator i = begin(); i != end(); ++i) {
+ SequenceDelayData const &entry = **i;
+ stream->writeUint16LE(entry.sequenceOffset);
+ stream->writeUint32LE(entry.timeoutCtr);
+ stream->writeByte(entry.canClear);
}
stream->writeUint16LE(0);
@@ -1016,7 +1005,7 @@ RandomActionSet *RandomActionList::getRoom(uint16 roomNumber) {
return NULL;
}
-void RandomActionSet::saveToStream(Common::WriteStream *stream) {
+void RandomActionSet::saveToStream(Common::WriteStream *stream) const {
stream->writeByte(numActions());
for (int actionIndex = 0; actionIndex < _numActions; ++actionIndex)
stream->writeByte((byte)_types[actionIndex]);
@@ -1030,8 +1019,8 @@ void RandomActionSet::loadFromStream(Common::ReadStream *stream) {
}
-void RandomActionList::saveToStream(Common::WriteStream *stream) {
- for (iterator i = begin(); i != end(); ++i)
+void RandomActionList::saveToStream(Common::WriteStream *stream) const {
+ for (const_iterator i = begin(); i != end(); ++i)
(*i)->saveToStream(stream);
}
@@ -1052,9 +1041,9 @@ RoomExitIndexedHotspotData::RoomExitIndexedHotspotData(RoomExitIndexedHotspotRes
uint16 RoomExitIndexedHotspotList::getHotspot(uint16 roomNumber, uint8 hotspotIndexId) {
iterator i;
for (i = begin(); i != end(); ++i) {
- RoomExitIndexedHotspotData *entry = (*i).get();
- if ((entry->roomNumber == roomNumber) && (entry->hotspotIndex == hotspotIndexId))
- return entry->hotspotId;
+ RoomExitIndexedHotspotData const &entry = **i;
+ if ((entry.roomNumber == roomNumber) && (entry.hotspotIndex == hotspotIndexId))
+ return entry.hotspotId;
}
// No hotspot
@@ -1074,12 +1063,12 @@ PausedCharacter::PausedCharacter(uint16 SrcCharId, uint16 DestCharId) {
void PausedCharacterList::reset(uint16 hotspotId) {
iterator i;
for (i = begin(); i != end(); ++i) {
- PausedCharacter *rec = (*i).get();
+ PausedCharacter &rec = **i;
- if (rec->srcCharId == hotspotId) {
- rec->counter = 1;
- if (rec->destCharId < START_EXIT_ID)
- rec->charHotspot->pauseCtr = 1;
+ if (rec.srcCharId == hotspotId) {
+ rec.counter = 1;
+ if (rec.destCharId < START_EXIT_ID)
+ rec.charHotspot->pauseCtr = 1;
}
}
}
@@ -1088,15 +1077,15 @@ void PausedCharacterList::countdown() {
iterator i = begin();
while (i != end()) {
- PausedCharacter *rec = (*i).get();
- --rec->counter;
+ PausedCharacter &rec = **i;
+ --rec.counter;
// Handle reflecting counter to hotspot
- if (rec->destCharId < START_EXIT_ID)
- rec->charHotspot->pauseCtr = rec->counter + 1;
+ if (rec.destCharId < START_EXIT_ID)
+ rec.charHotspot->pauseCtr = rec.counter + 1;
// If counter has reached zero, remove entry from list
- if (rec->counter == 0)
+ if (rec.counter == 0)
i = erase(i);
else
++i;
@@ -1109,13 +1098,13 @@ void PausedCharacterList::scan(Hotspot &h) {
if (h.blockedState() != BS_NONE) {
for (i = begin(); i != end(); ++i) {
- PausedCharacter *rec = (*i).get();
+ PausedCharacter &rec = **i;
- if (rec->srcCharId == h.hotspotId()) {
- rec->counter = IDLE_COUNTDOWN_SIZE;
+ if (rec.srcCharId == h.hotspotId()) {
+ rec.counter = IDLE_COUNTDOWN_SIZE;
- if (rec->destCharId < START_EXIT_ID)
- rec->charHotspot->pauseCtr = IDLE_COUNTDOWN_SIZE;
+ if (rec.destCharId < START_EXIT_ID)
+ rec.charHotspot->pauseCtr = IDLE_COUNTDOWN_SIZE;
}
}
}
@@ -1139,9 +1128,9 @@ int PausedCharacterList::check(uint16 charId, int numImpinging, uint16 *impingin
// calling character and the impinging list entry
bool foundEntry = false;
for (i = res.pausedList().begin(); !foundEntry && (i != res.pausedList().end()); ++i) {
- PausedCharacter *rec = (*i).get();
- foundEntry = (rec->srcCharId == charId) &&
- (rec->destCharId == hotspot->hotspotId());
+ PausedCharacter const &rec = **i;
+ foundEntry = (rec.srcCharId == charId) &&
+ (rec.destCharId == hotspot->hotspotId());
}
if (foundEntry)
@@ -1196,7 +1185,7 @@ BarEntry &BarmanLists::getDetails(uint16 roomNumber) {
error("Invalid room %d specified for barman details retrieval", roomNumber);
}
-void BarmanLists::saveToStream(Common::WriteStream *stream) {
+void BarmanLists::saveToStream(Common::WriteStream *stream) const {
for (int index = 0; index < 3; ++index) {
uint16 value = (_barList[index].currentCustomer == NULL) ? 0 :
(_barList[index].currentCustomer - &_barList[index].customers[0]) / sizeof(BarEntry) + 1;
@@ -1296,7 +1285,7 @@ void ValueTableData::setField(FieldName fieldName, uint16 value) {
setField((uint16) fieldName, value);
}
-void ValueTableData::saveToStream(Common::WriteStream *stream) {
+void ValueTableData::saveToStream(Common::WriteStream *stream) const {
// Write out the special fields
stream->writeUint16LE(_numGroats);
stream->writeSint16LE(_playerNewPos.position.x);
@@ -1371,7 +1360,7 @@ void CurrentActionEntry::setSupportData(uint16 entryId) {
setSupportData(newEntry);
}
-void CurrentActionEntry::saveToStream(Common::WriteStream *stream) {
+void CurrentActionEntry::saveToStream(Common::WriteStream *stream) const {
debugC(ERROR_DETAILED, kLureDebugAnimations, "Saving hotspot action entry dyn=%d id=%d",
hasSupportData(), hasSupportData() ? supportData().id() : 0);
stream->writeByte((uint8) _action);
@@ -1443,11 +1432,11 @@ Common::String CurrentActionStack::getDebugInfo() const {
buffer += Common::String::format("CurrentActionStack::list num_actions=%d\n", size());
for (i = _actions.begin(); i != _actions.end(); ++i) {
- CurrentActionEntry *entry = (*i).get();
- buffer += Common::String::format("style=%d room#=%d", entry->action(), entry->roomNumber());
+ CurrentActionEntry const &entry = **i;
+ buffer += Common::String::format("style=%d room#=%d", entry.action(), entry.roomNumber());
- if (entry->hasSupportData()) {
- CharacterScheduleEntry &rec = entry->supportData();
+ if (entry.hasSupportData()) {
+ CharacterScheduleEntry &rec = entry.supportData();
buffer += Common::String::format(", action=%d params=", rec.action());
@@ -1466,16 +1455,13 @@ Common::String CurrentActionStack::getDebugInfo() const {
return buffer;
}
-void CurrentActionStack::saveToStream(Common::WriteStream *stream) {
- ActionsList::iterator i;
-
+void CurrentActionStack::saveToStream(Common::WriteStream *stream) const {
debugC(ERROR_DETAILED, kLureDebugAnimations, "Saving hotspot action stack");
Common::String buffer = getDebugInfo();
debugC(ERROR_DETAILED, kLureDebugAnimations, "%s", buffer.c_str());
- for (i = _actions.begin(); i != _actions.end(); ++i) {
- CurrentActionEntry *rec = (*i).get();
- rec->saveToStream(stream);
+ for (ActionsList::const_iterator i = _actions.begin(); i != _actions.end(); ++i) {
+ (*i)->saveToStream(stream);
}
stream->writeByte(0xff); // End of list marker
debugC(ERROR_DETAILED, kLureDebugAnimations, "Finished saving hotspot action stack");
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 8d6c557297..a4d2f76cec 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -300,7 +300,7 @@ public:
void load(byte *srcData) {
memcpy(_data, srcData, ROOM_PATHS_SIZE);
}
- const byte *data() { return _data; }
+ const byte *data() const { return _data; }
bool isOccupied(int x, int y);
bool isOccupied(int x, int y, int width);
void setOccupied(int x, int y, int width);
@@ -334,7 +334,7 @@ public:
class RoomDataList: public Common::List<Common::SharedPtr<RoomData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -357,7 +357,7 @@ public:
class RoomExitJoinList: public Common::List<Common::SharedPtr<RoomExitJoinData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -433,13 +433,13 @@ public:
if (_dynamicSupportData) delete _supportData;
}
- CurrentAction action() { return _action; }
- CharacterScheduleEntry &supportData() {
+ CurrentAction action() const { return _action; }
+ CharacterScheduleEntry &supportData() const {
if (!_supportData) error("Access made to non-defined action support record");
return *_supportData;
}
- bool hasSupportData() { return _supportData != NULL; }
- uint16 roomNumber() { return _roomNumber; }
+ bool hasSupportData() const { return _supportData != NULL; }
+ uint16 roomNumber() const { return _roomNumber; }
void setAction(CurrentAction newAction) { _action = newAction; }
void setRoomNumber(uint16 roomNum) { _roomNumber = roomNum; }
void setSupportData(CharacterScheduleEntry *newRec) {
@@ -452,7 +452,7 @@ public:
}
void setSupportData(uint16 entryId);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
static CurrentActionEntry *loadFromStream(Common::ReadStream *stream);
};
@@ -505,7 +505,7 @@ public:
validateStack();
}
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
void copyFrom(CurrentActionStack &stack);
};
@@ -569,13 +569,13 @@ public:
void enable() { flags |= 0x80; }
void disable() { flags &= 0x7F; }
Direction nonVisualDirection() { return (Direction) scriptLoadFlag; }
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
class HotspotDataList: public Common::List<Common::SharedPtr<HotspotData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -663,7 +663,7 @@ public:
class TalkDataList: public Common::List<Common::SharedPtr<TalkData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -722,7 +722,7 @@ public:
void tick();
void clear(bool forceClear = false);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -760,8 +760,8 @@ public:
RandomActionSet(uint16 *&offset);
~RandomActionSet();
- uint16 roomNumber() { return _roomNumber; }
- int numActions() { return _numActions; }
+ uint16 roomNumber() const { return _roomNumber; }
+ int numActions() const { return _numActions; }
void getEntry(int index, RandomActionType &actionType, uint16 &id) {
assert((index >= 0) && (index < _numActions));
actionType = _types[index];
@@ -772,14 +772,14 @@ public:
assert(_types[index] == REPEAT_ONCE);
_types[index] = REPEAT_ONCE_DONE;
}
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
class RandomActionList: public Common::List<Common::SharedPtr<RandomActionSet> > {
public:
RandomActionSet *getRoom(uint16 roomNumber);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -828,7 +828,7 @@ public:
void reset();
BarEntry &getDetails(uint16 roomNumber);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -923,7 +923,7 @@ public:
uint8 &hdrFlagMask() { return _hdrFlagMask; }
PlayerNewPosition &playerNewPos() { return _playerNewPos; }
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 219ed0263d..9a9313ece9 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -138,8 +138,8 @@ void Room::leaveRoom() {
HotspotList &list = r.activeHotspots();
HotspotList::iterator i = list.begin();
while (i != list.end()) {
- Hotspot *h = (i.operator*()).get();
- if (!h->persistant()) {
+ Hotspot const &h = **i;
+ if (!h.persistant()) {
i = list.erase(i);
} else {
++i;
@@ -153,11 +153,11 @@ void Room::loadRoomHotspots() {
HotspotDataList::iterator i;
for (i = list.begin(); i != list.end(); ++i) {
- HotspotData *rec = (*i).get();
+ HotspotData const &rec = **i;
- if ((rec->hotspotId < 0x7530) && (rec->roomNumber == _roomNumber) &&
- (rec->layer != 0))
- r.activateHotspot(rec->hotspotId);
+ if ((rec.hotspotId < 0x7530) && (rec.roomNumber == _roomNumber) &&
+ (rec.layer != 0))
+ r.activateHotspot(rec.hotspotId);
}
}
@@ -252,24 +252,24 @@ CursorType Room::checkRoomExits() {
RoomExitHotspotList::iterator i;
for (i = exits.begin(); i != exits.end(); ++i) {
- RoomExitHotspotData *rec = (*i).get();
+ RoomExitHotspotData const &rec = **i;
skipFlag = false;
- if (rec->hotspotId != 0) {
- join = res.getExitJoin(rec->hotspotId);
+ if (rec.hotspotId != 0) {
+ join = res.getExitJoin(rec.hotspotId);
if ((join) && (join->blocked != 0))
skipFlag = true;
}
- if (!skipFlag && (m.x() >= rec->xs) && (m.x() <= rec->xe) &&
- (m.y() >= rec->ys) && (m.y() <= rec->ye)) {
+ if (!skipFlag && (m.x() >= rec.xs) && (m.x() <= rec.xe) &&
+ (m.y() >= rec.ys) && (m.y() <= rec.ye)) {
// Cursor is within exit area
- CursorType cursorNum = (CursorType)rec->cursorNum;
- _destRoomNumber = rec->destRoomNumber;
+ CursorType cursorNum = (CursorType)rec.cursorNum;
+ _destRoomNumber = rec.destRoomNumber;
// If it's a hotspotted exit, change arrow to the + arrow
- if (rec->hotspotId != 0) {
- _hotspotId = rec->hotspotId;
+ if (rec.hotspotId != 0) {
+ _hotspotId = rec.hotspotId;
_hotspot = res.getHotspot(_hotspotId);
_hotspotNameId = _hotspot->nameId;
_isExit = true;
@@ -437,7 +437,7 @@ void Room::update() {
// Handle first layer (layer 3)
for (i = hotspots.begin(); i != hotspots.end(); ++i) {
- Hotspot &h = *i.operator*();
+ Hotspot &h = **i;
if ((h.roomNumber() == _roomNumber) && h.isActiveAnimation() && (h.layer() == 3)) {
addAnimation(h);
@@ -449,28 +449,28 @@ void Room::update() {
Common::List<Hotspot *> tempList;
Common::List<Hotspot *>::iterator iTemp;
for (i = hotspots.begin(); i != hotspots.end(); ++i) {
- Hotspot *h = (i.operator*()).get();
+ Hotspot *h = i->get();
if ((h->layer() != 1) || (h->roomNumber() != _roomNumber) ||
h->skipFlag() || !h->isActiveAnimation())
continue;
int16 endY = h->y() + h->heightCopy();
for (iTemp = tempList.begin(); iTemp != tempList.end(); ++iTemp) {
- Hotspot *hTemp = iTemp.operator*();
+ Hotspot *hTemp = *iTemp;
int16 tempY = hTemp->y() + hTemp->heightCopy();
if (endY < tempY) break;
}
tempList.insert(iTemp, h);
}
for (iTemp = tempList.begin(); iTemp != tempList.end(); ++iTemp) {
- Hotspot &h = *iTemp.operator*();
+ Hotspot &h = **iTemp;
addAnimation(h);
addLayers(h);
}
// Handle third layer (layer 2)
for (i = hotspots.begin(); i != hotspots.end(); ++i) {
- Hotspot &h = *i.operator*();
+ Hotspot &h = **i;
if ((h.roomNumber() == _roomNumber) && h.isActiveAnimation() && (h.layer() == 2)) {
addAnimation(h);
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index bf0abdea07..298483bed8 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -107,8 +107,7 @@ void SoundManager::saveToStream(Common::WriteStream *stream) {
SoundListIterator i;
for (i = _activeSounds.begin(); i != _activeSounds.end(); ++i) {
- SoundDescResource *rec = (*i).get();
- stream->writeByte(rec->soundNumber);
+ stream->writeByte((*i)->soundNumber);
}
stream->writeByte(0xff);
}
@@ -335,14 +334,14 @@ void SoundManager::tidySounds() {
SoundListIterator i = _activeSounds.begin();
while (i != _activeSounds.end()) {
- SoundDescResource *rec = (*i).get();
+ SoundDescResource const &rec = **i;
- if (musicInterface_CheckPlaying(rec->soundNumber))
+ if (musicInterface_CheckPlaying(rec.soundNumber))
// Still playing, so move to next entry
++i;
else {
// Mark the channels that it used as now being free
- Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false);
+ Common::fill(_channelsInUse + rec.channel, _channelsInUse + rec.channel + rec.numChannels, false);
i = _activeSounds.erase(i);
}
@@ -356,10 +355,10 @@ void SoundManager::removeSounds() {
SoundListIterator i = _activeSounds.begin();
while (i != _activeSounds.end()) {
- SoundDescResource *rec = (*i).get();
+ SoundDescResource const &rec = **i;
- if ((rec->flags & SF_IN_USE) != 0)
- musicInterface_Stop(rec->soundNumber);
+ if ((rec.flags & SF_IN_USE) != 0)
+ musicInterface_Stop(rec.soundNumber);
++i;
}
@@ -370,13 +369,13 @@ void SoundManager::restoreSounds() {
SoundListIterator i = _activeSounds.begin();
while (i != _activeSounds.end()) {
- SoundDescResource *rec = (*i).get();
+ SoundDescResource const &rec = **i;
- if ((rec->numChannels != 0) && ((rec->flags & SF_RESTORE) != 0)) {
- Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, true);
+ if ((rec.numChannels != 0) && ((rec.flags & SF_RESTORE) != 0)) {
+ Common::fill(_channelsInUse + rec.channel, _channelsInUse + rec.channel + rec.numChannels, true);
- musicInterface_Play(rec->soundNumber, rec->channel, rec->numChannels);
- musicInterface_SetVolume(rec->channel, rec->volume);
+ musicInterface_Play(rec.soundNumber, rec.channel, rec.numChannels);
+ musicInterface_SetVolume(rec.channel, rec.volume);
}
++i;
@@ -397,10 +396,10 @@ void SoundManager::fadeOut() {
g_system->lockMutex(_soundMutex);
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
- MidiMusic *music = (*i).get();
- if (music->getVolume() > 0) {
+ MidiMusic &music = **i;
+ if (music.getVolume() > 0) {
inProgress = true;
- music->setVolume(music->getVolume() >= 10 ? (music->getVolume() - 10) : 0);
+ music.setVolume(music.getVolume() >= 10 ? music.getVolume() - 10 : 0);
}
}
@@ -468,8 +467,7 @@ void SoundManager::musicInterface_Stop(uint8 soundNumber) {
g_system->lockMutex(_soundMutex);
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
- MidiMusic *music = (*i).get();
- if (music->soundNumber() == soundNum) {
+ if ((*i)->soundNumber() == soundNum) {
_playingSounds.erase(i);
break;
}
@@ -489,8 +487,7 @@ bool SoundManager::musicInterface_CheckPlaying(uint8 soundNumber) {
g_system->lockMutex(_soundMutex);
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
- MidiMusic *music = (*i).get();
- if (music->soundNumber() == soundNum) {
+ if ((*i)->soundNumber() == soundNum) {
result = true;
break;
}
@@ -511,9 +508,9 @@ void SoundManager::musicInterface_SetVolume(uint8 channelNum, uint8 volume) {
g_system->lockMutex(_soundMutex);
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
- MidiMusic *music = (*i).get();
- if (music->channelNumber() == channelNum)
- music->setVolume(volume);
+ MidiMusic &music = **i;
+ if (music.channelNumber() == channelNum)
+ music.setVolume(volume);
}
g_system->unlockMutex(_soundMutex);
}
@@ -528,8 +525,7 @@ void SoundManager::musicInterface_KillAll() {
g_system->lockMutex(_soundMutex);
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
- MidiMusic *music = (*i).get();
- music->stopMusic();
+ (*i)->stopMusic();
}
_playingSounds.clear();
@@ -561,8 +557,7 @@ void SoundManager::musicInterface_TidySounds() {
g_system->lockMutex(_soundMutex);
MusicListIterator i = _playingSounds.begin();
while (i != _playingSounds.end()) {
- MidiMusic *music = (*i).get();
- if (!music->isPlaying())
+ if (!(*i)->isPlaying())
i = _playingSounds.erase(i);
else
++i;
@@ -583,9 +578,9 @@ void SoundManager::doTimer() {
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
- MidiMusic *music = (*i).get();
- if (music->isPlaying())
- music->onTimer();
+ MidiMusic &music = **i;
+ if (music.isPlaying())
+ music.onTimer();
}
g_system->unlockMutex(_soundMutex);
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index bfada8fde6..0f13d87fbc 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -1329,8 +1329,8 @@ bool CopyProtectionDialog::show() {
++hotspot6;
// Add wording header and display screen
- (hotspot2->get())->setFrameNumber(1);
- (hotspot2->get())->copyTo(&screen.screen());
+ (*hotspot2)->setFrameNumber(1);
+ (*hotspot2)->copyTo(&screen.screen());
screen.update();
screen.setPalette(&p);
@@ -1340,8 +1340,8 @@ bool CopyProtectionDialog::show() {
} while (!events.interruptableDelay(100));
// Change title text to selection
- (hotspot2->get())->setFrameNumber(0);
- (hotspot2->get())->copyTo(&screen.screen());
+ (*hotspot2)->setFrameNumber(0);
+ (*hotspot2)->copyTo(&screen.screen());
screen.update();
// Clear any prior try
@@ -1356,18 +1356,18 @@ bool CopyProtectionDialog::show() {
HotspotsList::iterator tmpHotspot = _hotspots.begin();
for (int i = 0; i < _charIndex + 3; i++)
++tmpHotspot;
- (tmpHotspot->get())->setFrameNumber(10); // Blank space
- (tmpHotspot->get())->copyTo(&screen.screen());
+ (*tmpHotspot)->setFrameNumber(10); // Blank space
+ (*tmpHotspot)->copyTo(&screen.screen());
screen.update();
- } else if ((events.event().kbd.keycode >= Common::KEYCODE_0) &&
- (events.event().kbd.keycode <= Common::KEYCODE_9)) {
+ } else if ((events.event().kbd.ascii >= '0') &&
+ (events.event().kbd.ascii <= '9')) {
HotspotsList::iterator tmpHotspot = _hotspots.begin();
for (int i = 0; i < _charIndex + 3; i++)
++tmpHotspot;
// Number pressed
- (tmpHotspot->get())->setFrameNumber(events.event().kbd.ascii - '0');
- (tmpHotspot->get())->copyTo(&screen.screen());
+ (*tmpHotspot)->setFrameNumber(events.event().kbd.ascii - '0');
+ (*tmpHotspot)->copyTo(&screen.screen());
++_charIndex;
}
@@ -1385,11 +1385,11 @@ bool CopyProtectionDialog::show() {
return false;
// At this point, two page numbers have been entered - validate them
- int page1 = ((hotspot3->get())->frameNumber() * 10) + (hotspot4->get())->frameNumber();
- int page2 = ((hotspot5->get())->frameNumber() * 10) + (hotspot6->get())->frameNumber();
+ int page1 = ((*hotspot3)->frameNumber() * 10) + (*hotspot4)->frameNumber();
+ int page2 = ((*hotspot5)->frameNumber() * 10) + (*hotspot6)->frameNumber();
- if ((page1 == pageNumbers[(hotspot0->get())->frameNumber()]) &&
- (page2 == pageNumbers[(hotspot1->get())->frameNumber()]))
+ if ((page1 == pageNumbers[(*hotspot0)->frameNumber()]) &&
+ (page2 == pageNumbers[(*hotspot1)->frameNumber()]))
return true;
}
@@ -1404,11 +1404,11 @@ void CopyProtectionDialog::chooseCharacters() {
int char2 = rnd.getRandomNumber(19);
HotspotsList::iterator curHotspot = _hotspots.begin();
- (curHotspot->get())->setFrameNumber(char1);
- (curHotspot->get())->copyTo(&screen.screen());
+ (*curHotspot)->setFrameNumber(char1);
+ (*curHotspot)->copyTo(&screen.screen());
++curHotspot;
- (curHotspot->get())->setFrameNumber(char2);
- (curHotspot->get())->copyTo(&screen.screen());
+ (*curHotspot)->setFrameNumber(char2);
+ (*curHotspot)->copyTo(&screen.screen());
screen.update();
}
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index 6c4749f44d..cf450f7e25 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -248,7 +248,7 @@ void PmvPlayer::handleEvents() {
}
void PmvPlayer::updateScreen() {
- _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch,
+ _vm->_system->copyRectToScreen(_surface->pixels, _surface->pitch,
(320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h);
_vm->_system->updateScreen();
}
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index b49bfff840..ea7d57f82d 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -349,7 +349,7 @@ void Screen::updateSprites() {
drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0);
drawSpriteChannels(_workScreenDrawCtx, 1, 2);
- _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
+ _vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
_vm->_screen->updateScreenAndWait(10);
}
@@ -775,10 +775,10 @@ void Screen::unlockScreen() {
}
void Screen::showWorkScreen() {
- _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
+ _vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
}
-void Screen::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void Screen::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
_vm->_system->copyRectToScreen(buf, pitch, x, y, w, h);
}
diff --git a/engines/made/screen.h b/engines/made/screen.h
index a61ecabdce..266ac3811d 100644
--- a/engines/made/screen.h
+++ b/engines/made/screen.h
@@ -176,7 +176,7 @@ public:
Graphics::Surface *lockScreen();
void unlockScreen();
void showWorkScreen();
- void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
void updateScreenAndWait(int delay);
int16 addToSpriteList(int16 index, int16 xofs, int16 yofs);
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index 4e0d463b53..ad71f1fb49 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -200,10 +200,10 @@ void ScreenEffects::stepBlendedPalette() {
setBlendedPalette(_blendedPaletteStatus._palette, _blendedPaletteStatus._newPalette,
_blendedPaletteStatus._colorCount, _blendedPaletteStatus._value, _blendedPaletteStatus._maxValue);
if (_blendedPaletteStatus._value == _blendedPaletteStatus._maxValue)
- _blendedPaletteStatus._value++;
- else
- _blendedPaletteStatus._value = MIN<int16>(_blendedPaletteStatus._value + _blendedPaletteStatus._incr, _blendedPaletteStatus._maxValue);
- }
+ _blendedPaletteStatus._value++;
+ else
+ _blendedPaletteStatus._value = MIN<int16>(_blendedPaletteStatus._value + _blendedPaletteStatus._incr, _blendedPaletteStatus._maxValue);
+ }
}
void ScreenEffects::copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2) {
@@ -293,7 +293,7 @@ void ScreenEffects::vfx00(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 312);
for (int x = 0; x < 320; x += 8) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -303,7 +303,7 @@ void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 312);
for (int x = 312; x >= 0; x -= 8) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -313,7 +313,7 @@ void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 190);
for (int y = 0; y < 200; y += 10) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
+ _screen->copyRectToScreen(surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -323,7 +323,7 @@ void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 190);
for (int y = 190; y >= 0; y -= 10) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
+ _screen->copyRectToScreen(surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -333,8 +333,8 @@ void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 90);
for (int y = 0; y < 100; y += 10) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10);
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10);
+ _screen->copyRectToScreen(surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10);
+ _screen->copyRectToScreen(surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -345,8 +345,8 @@ void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 152);
for (int x = 0; x < 160; x += 8) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -357,8 +357,8 @@ void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPa
void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
startBlendedPalette(palette, newPalette, colorCount, 152);
for (int x = 152; x >= 0; x -= 8) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
@@ -368,7 +368,7 @@ void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen slide in" right to left
void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
for (int x = 8; x <= 320; x += 8) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200);
_screen->updateScreenAndWait(25);
}
setPalette(palette);
@@ -509,7 +509,7 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen slide in" left to right
void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
for (int x = 8; x <= 320; x += 8) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(320 - x, 0), surface->pitch, 0, 0, x, 200);
+ _screen->copyRectToScreen(surface->getBasePtr(320 - x, 0), surface->pitch, 0, 0, x, 200);
_screen->updateScreenAndWait(25);
}
@@ -519,7 +519,7 @@ void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen slide in" top to bottom
void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
for (int y = 4; y <= 200; y += 4) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 200 - y), surface->pitch, 0, 0, 320, y);
+ _screen->copyRectToScreen(surface->getBasePtr(0, 200 - y), surface->pitch, 0, 0, 320, y);
_screen->updateScreenAndWait(25);
}
@@ -529,7 +529,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen slide in" bottom to top
void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
for (int y = 4; y <= 200; y += 4) {
- _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 0, 200 - y, 320, y);
+ _screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 0, 200 - y, 320, y);
_screen->updateScreenAndWait(25);
}
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index de7b5b70f9..c57778fb71 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -574,7 +574,7 @@ int16 ScriptFunctions::sfLoadMouseCursor(int16 argc, int16 *argv) {
PictureResource *flex = _vm->_res->getPicture(argv[2]);
if (flex) {
Graphics::Surface *surf = flex->getPicture();
- CursorMan.replaceCursor((const byte *)surf->pixels, surf->w, surf->h, argv[1], argv[0], 0);
+ CursorMan.replaceCursor(surf->pixels, surf->w, surf->h, argv[1], argv[0], 0);
_vm->_res->freeResource(flex);
}
return 0;
diff --git a/engines/metaengine.h b/engines/metaengine.h
index d9c1360042..ffa682fc53 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -24,6 +24,7 @@
#include "common/scummsys.h"
#include "common/error.h"
+#include "common/array.h"
#include "engines/game.h"
#include "engines/savestate.h"
@@ -39,6 +40,19 @@ class String;
}
/**
+ * Per-game extra GUI options structure.
+ * Currently, this can only be used for options with checkboxes.
+ */
+struct ExtraGuiOption {
+ const char *label; // option label, e.g. "Fullscreen mode"
+ const char *tooltip; // option tooltip (when the mouse hovers above it)
+ const char *configOption; // confMan key, e.g. "fullscreen"
+ bool defaultState; // the detault state of the checkbox (checked or not)
+};
+
+typedef Common::Array<ExtraGuiOption> ExtraGuiOptions;
+
+/**
* A meta engine is essentially a factory for Engine instances with the
* added ability of listing and detecting supported games.
* Every engine "plugin" provides a hook to get an instance of a MetaEngine
@@ -98,6 +112,23 @@ public:
}
/**
+ * Return a list of extra GUI options for the specified target.
+ * If no target is specified, all of the available custom GUI options are
+ * Returned for the plugin (used to set default values).
+ *
+ * Currently, this only supports options with checkboxes.
+ *
+ * The default implementation returns an empty list.
+ *
+ * @param target name of a config manager target
+ * @return a list of extra GUI options for an engine plugin and
+ * target
+ */
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const {
+ return ExtraGuiOptions();
+ }
+
+ /**
* Return the maximum save slot that the engine supports.
*
* @note MetaEngines must indicate that this function has been implemented
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
index 4edde31236..bc19fe2d3e 100644
--- a/engines/mohawk/bitmap.cpp
+++ b/engines/mohawk/bitmap.cpp
@@ -29,6 +29,7 @@
#include "common/substream.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "graphics/decoders/bmp.h"
namespace Mohawk {
@@ -629,99 +630,39 @@ void MohawkBitmap::drawRLE8(Graphics::Surface *surface, bool isLE) {
// Myst Bitmap Decoder
//////////////////////////////////////////
-MohawkSurface *MystBitmap::decodeImage(Common::SeekableReadStream* stream) {
+MohawkSurface *MystBitmap::decodeImage(Common::SeekableReadStream *stream) {
uint32 uncompressedSize = stream->readUint32LE();
- Common::SeekableReadStream* bmpStream = decompressLZ(stream, uncompressedSize);
+ Common::SeekableReadStream *bmpStream = decompressLZ(stream, uncompressedSize);
delete stream;
- _header.type = bmpStream->readUint16BE();
+ Graphics::BitmapDecoder bitmapDecoder;
+ if (!bitmapDecoder.loadStream(*bmpStream))
+ error("Could not decode Myst bitmap");
- if (_header.type != 'BM')
- error("BMP header not detected");
+ const Graphics::Surface *bmpSurface = bitmapDecoder.getSurface();
+ Graphics::Surface *newSurface = 0;
- _header.size = bmpStream->readUint32LE();
- assert (_header.size > 0);
- _header.res1 = bmpStream->readUint16LE();
- _header.res2 = bmpStream->readUint16LE();
- _header.imageOffset = bmpStream->readUint32LE();
-
- _info.size = bmpStream->readUint32LE();
-
- if (_info.size != 40)
- error("Only Windows v3 BMP's are supported");
-
- _info.width = bmpStream->readUint32LE();
- _info.height = bmpStream->readUint32LE();
- _info.planes = bmpStream->readUint16LE();
- _info.bitsPerPixel = bmpStream->readUint16LE();
- _info.compression = bmpStream->readUint32LE();
- _info.imageSize = bmpStream->readUint32LE();
- _info.pixelsPerMeterX = bmpStream->readUint32LE();
- _info.pixelsPerMeterY = bmpStream->readUint32LE();
- _info.colorsUsed = bmpStream->readUint32LE();
- _info.colorsImportant = bmpStream->readUint32LE();
-
- if (_info.compression != 0)
- error("Unhandled BMP compression %d", _info.compression);
-
- if (_info.colorsUsed == 0)
- _info.colorsUsed = 256;
-
- if (_info.bitsPerPixel != 8 && _info.bitsPerPixel != 24)
- error("%dbpp Bitmaps not supported", _info.bitsPerPixel);
-
- byte *palData = NULL;
-
- if (_info.bitsPerPixel == 8) {
- palData = (byte *)malloc(256 * 3);
- for (uint16 i = 0; i < _info.colorsUsed; i++) {
- palData[i * 3 + 2] = bmpStream->readByte();
- palData[i * 3 + 1] = bmpStream->readByte();
- palData[i * 3 + 0] = bmpStream->readByte();
- bmpStream->readByte();
- }
- }
-
- bmpStream->seek(_header.imageOffset);
-
- Graphics::Surface *surface = createSurface(_info.width, _info.height);
- int srcPitch = _info.width * (_info.bitsPerPixel >> 3);
- const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0;
-
- if (_info.bitsPerPixel == 8) {
- byte *dst = (byte *)surface->pixels;
-
- for (uint32 i = 0; i < _info.height; i++) {
- bmpStream->read(dst + (_info.height - i - 1) * _info.width, _info.width);
- bmpStream->skip(extraDataLength);
- }
+ if (bmpSurface->format.bytesPerPixel == 1) {
+ _bitsPerPixel = 8;
+ newSurface = new Graphics::Surface();
+ newSurface->copyFrom(*bmpSurface);
} else {
- Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
-
- byte *dst = (byte *)surface->pixels + (surface->h - 1) * surface->pitch;
-
- for (uint32 i = 0; i < _info.height; i++) {
- for (uint32 j = 0; j < _info.width; j++) {
- byte b = bmpStream->readByte();
- byte g = bmpStream->readByte();
- byte r = bmpStream->readByte();
+ _bitsPerPixel = 24;
+ newSurface = bmpSurface->convertTo(g_system->getScreenFormat());
+ }
- if (pixelFormat.bytesPerPixel == 2)
- *((uint16 *)dst) = pixelFormat.RGBToColor(r, g, b);
- else
- *((uint32 *)dst) = pixelFormat.RGBToColor(r, g, b);
+ // Copy the palette to one of our own
+ byte *newPal = 0;
- dst += pixelFormat.bytesPerPixel;
- }
-
- bmpStream->skip(extraDataLength);
- dst -= surface->pitch * 2;
- }
+ if (bitmapDecoder.hasPalette()) {
+ const byte *palette = bitmapDecoder.getPalette();
+ newPal = (byte *)malloc(256 * 3);
+ memcpy(newPal, palette, 256 * 3);
}
delete bmpStream;
- return new MohawkSurface(surface, palData);
+ return new MohawkSurface(newSurface, newPal);
}
#endif
diff --git a/engines/mohawk/bitmap.h b/engines/mohawk/bitmap.h
index 74218882e8..73c117b5c7 100644
--- a/engines/mohawk/bitmap.h
+++ b/engines/mohawk/bitmap.h
@@ -154,30 +154,10 @@ public:
MohawkSurface *decodeImage(Common::SeekableReadStream *stream);
protected:
- byte getBitsPerPixel() { return _info.bitsPerPixel; }
+ byte getBitsPerPixel() { return _bitsPerPixel; }
private:
- struct BitmapHeader {
- uint16 type;
- uint32 size;
- uint16 res1;
- uint16 res2;
- uint32 imageOffset;
- } _header;
-
- struct InfoHeader {
- uint32 size;
- uint32 width;
- uint32 height;
- uint16 planes;
- uint16 bitsPerPixel;
- uint32 compression;
- uint32 imageSize;
- uint32 pixelsPerMeterX;
- uint32 pixelsPerMeterY;
- uint32 colorsUsed;
- uint32 colorsImportant;
- } _info;
+ uint16 _bitsPerPixel;
};
#endif
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index 8c72c9875e..e73d4ed6a3 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -121,11 +121,11 @@ void MystCursorManager::setCursor(uint16 id) {
// Myst ME stores some cursors as 24bpp images instead of 8bpp
if (surface->format.bytesPerPixel == 1) {
- CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0);
+ CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0);
CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256);
} else {
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
- CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), 1, &pixelFormat);
+ CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat);
}
_vm->_needsUpdate = true;
@@ -157,7 +157,7 @@ void NECursorManager::setCursor(uint16 id) {
Graphics::WinCursorGroup *cursorGroup = Graphics::WinCursorGroup::createCursorGroup(*_exe, id);
if (cursorGroup) {
- Graphics::WinCursor *cursor = cursorGroup->cursors[0].cursor;
+ Graphics::Cursor *cursor = cursorGroup->cursors[0].cursor;
CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256);
return;
@@ -257,7 +257,7 @@ void PECursorManager::setCursor(uint16 id) {
Graphics::WinCursorGroup *cursorGroup = Graphics::WinCursorGroup::createCursorGroup(*_exe, id);
if (cursorGroup) {
- Graphics::WinCursor *cursor = cursorGroup->cursors[0].cursor;
+ Graphics::Cursor *cursor = cursorGroup->cursors[0].cursor;
CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256);
delete cursorGroup;
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index f0c657897d..5664929948 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -167,7 +167,7 @@ public:
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
- return detectGameFilebased(allFiles, Mohawk::fileBased);
+ return detectGameFilebased(allFiles, fslist, Mohawk::fileBased);
}
virtual const char *getName() const {
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 08df0a2cbe..55814af1c3 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -204,24 +204,6 @@ static const MohawkGameDescription gameDescriptions[] = {
},
// Myst Masterpiece Edition
- // English Windows
- // From clone2727
- {
- {
- "myst",
- "Masterpiece Edition",
- AD_ENTRY1("MYST.DAT", "c4cae9f143b5947262e6cb2397e1617e"),
- Common::EN_ANY,
- Common::kPlatformMacintosh,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
- },
- GType_MYST,
- GF_ME,
- 0,
- },
-
- // Myst Masterpiece Edition
// German Windows
// From DrMcCoy (Included in "Myst: Die Trilogie")
{
@@ -376,7 +358,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
+ GUIO2(GUIO_NOASPECT, GUIO_NOLAUNCHLOAD)
},
GType_RIVEN,
GF_DEMO,
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index a08d034ef7..0f9a62c891 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -58,22 +58,7 @@ void MohawkSurface::convertToTrueColor() {
assert(_palette);
- Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
- Graphics::Surface *surface = new Graphics::Surface();
- surface->create(_surface->w, _surface->h, pixelFormat);
-
- for (uint16 i = 0; i < _surface->h; i++) {
- for (uint16 j = 0; j < _surface->w; j++) {
- byte palIndex = *((byte *)_surface->pixels + i * _surface->pitch + j);
- byte r = _palette[palIndex * 3 + 0];
- byte g = _palette[palIndex * 3 + 1];
- byte b = _palette[palIndex * 3 + 2];
- if (pixelFormat.bytesPerPixel == 2)
- *((uint16 *)surface->getBasePtr(j, i)) = pixelFormat.RGBToColor(r, g, b);
- else
- *((uint32 *)surface->getBasePtr(j, i)) = pixelFormat.RGBToColor(r, g, b);
- }
- }
+ Graphics::Surface *surface = _surface->convertTo(g_system->getScreenFormat(), _palette);
// Free everything and set the new surface as the converted surface
_surface->free();
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 708478a6d8..a0671d18d5 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -3378,11 +3378,10 @@ void LBLiveTextItem::readData(uint16 type, uint16 size, Common::MemoryReadStream
LiveTextWord word;
word.bounds = _vm->readRect(stream);
word.soundId = stream->readUint16();
- // TODO: unknowns
- uint16 unknown1 = stream->readUint16();
- uint16 unknown2 = stream->readUint16();
- debug(4, "Word: (%d, %d) to (%d, %d), sound %d, unknowns %04x, %04x",
- word.bounds.left, word.bounds.top, word.bounds.right, word.bounds.bottom, word.soundId, unknown1, unknown2);
+ word.itemType = stream->readUint16();
+ word.itemId = stream->readUint16();
+ debug(4, "Word: (%d, %d) to (%d, %d), sound %d, item %d (type %d)",
+ word.bounds.left, word.bounds.top, word.bounds.right, word.bounds.bottom, word.soundId, word.itemId, word.itemType);
_words.push_back(word);
}
@@ -3461,6 +3460,12 @@ void LBLiveTextItem::update() {
uint16 soundId = _words[_currentWord].soundId;
if (soundId && !_vm->_sound->isPlaying(soundId)) {
paletteUpdate(_currentWord, false);
+
+ // TODO: check this in RE
+ LBItem *item = _vm->getItemById(_words[_currentWord].itemId);
+ if (item)
+ item->togglePlaying(false, true);
+
_currentWord = 0xFFFF;
}
}
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 91d6a8cd30..76da7d8219 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -537,6 +537,9 @@ protected:
struct LiveTextWord {
Common::Rect bounds;
uint16 soundId;
+
+ uint16 itemType;
+ uint16 itemId;
};
struct LiveTextPhrase {
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index c22b30ad4d..9c0e642203 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -98,11 +98,6 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_view.soundListVolume = NULL;
_view.scriptResCount = 0;
_view.scriptResources = NULL;
-
- if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh) {
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- SearchMan.addSubDirectoryMatching(gameDataDir, "CD Data");
- }
}
MohawkEngine_Myst::~MohawkEngine_Myst() {
@@ -205,11 +200,6 @@ static const char *mystFiles[] = {
// qtw/myst/libelev.mov: libup.mov is basically the same with sound
Common::String MohawkEngine_Myst::wrapMovieFilename(const Common::String &movieName, uint16 stack) {
- // The Macintosh release of Myst ME stores its videos in a different folder
- // WORKAROUND: The gear rotation videos are not in the CD Data folder. See above comments.
- if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh && !movieName.matchString("cl1wg?"))
- return Common::String("CD Data/m/") + movieName + ".mov";
-
Common::String prefix;
switch (stack) {
@@ -252,8 +242,7 @@ Common::Error MohawkEngine_Myst::run() {
_gfx = new MystGraphics(this);
_console = new MystConsole(this);
_gameState = new MystGameState(this, _saveFileMan);
- _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
- _loadDialog->setSaveMode(false);
+ _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
_optionsDialog = new MystOptionsDialog(this);
_cursor = new MystCursorManager(this);
_rnd = new Common::RandomSource("myst");
@@ -499,52 +488,32 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS
if (!_mhk[0]->openFile(mystFiles[_curStack]))
error("Could not open %s", mystFiles[_curStack]);
- if (getPlatform() == Common::kPlatformMacintosh)
- _gfx->loadExternalPictureFile(_curStack);
-
_runExitScript = false;
// Clear the resource cache and the image cache
_cache.clear();
_gfx->clearCache();
- // Play Flyby Entry Movie on Masterpiece Edition. The Macintosh version is currently hooked
- // up to the Cinepak versions of the video (the 'c' suffix) until the SVQ1 decoder is completed.
+ // Play Flyby Entry Movie on Masterpiece Edition.
const char *flyby = 0;
if (getFeatures() & GF_ME) {
switch (_curStack) {
case kSeleniticStack:
- if (getPlatform() == Common::kPlatformMacintosh)
- flyby = "FLY_SEc";
- else
- flyby = "selenitic flyby";
+ flyby = "selenitic flyby";
break;
case kStoneshipStack:
- if (getPlatform() == Common::kPlatformMacintosh)
- flyby = "FLY_STc";
- else
- flyby = "stoneship flyby";
+ flyby = "stoneship flyby";
break;
// Myst Flyby Movie not used in Original Masterpiece Edition Engine
case kMystStack:
- if (_tweaksEnabled) {
- if (getPlatform() == Common::kPlatformMacintosh)
- flyby = "FLY_MYc";
- else
- flyby = "myst flyby";
- }
+ if (_tweaksEnabled)
+ flyby = "myst flyby";
break;
case kMechanicalStack:
- if (getPlatform() == Common::kPlatformMacintosh)
- flyby = "FLY_MEc";
- else
- flyby = "mech age flyby";
+ flyby = "mech age flyby";
break;
case kChannelwoodStack:
- if (getPlatform() == Common::kPlatformMacintosh)
- flyby = "FLY_CHc";
- else
- flyby = "channelwood flyby";
+ flyby = "channelwood flyby";
break;
default:
break;
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index fe33ceaa9b..a54b67bef4 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -134,7 +134,7 @@ const Common::String MystResourceType5::describe() {
desc += " ops:";
for (uint i = 0; i < _script->size(); i++)
- desc += " " + _vm->_scriptParser->getOpcodeDesc(_script->operator[](i).opcode);
+ desc += " " + _vm->_scriptParser->getOpcodeDesc((*_script)[i].opcode);
}
return desc;
diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp
index 151390580f..2df0f7e6ba 100644
--- a/engines/mohawk/myst_graphics.cpp
+++ b/engines/mohawk/myst_graphics.cpp
@@ -28,8 +28,8 @@
#include "common/system.h"
#include "common/textconsole.h"
#include "engines/util.h"
-#include "graphics/jpeg.h"
-#include "graphics/pict.h"
+#include "graphics/decoders/jpeg.h"
+#include "graphics/decoders/pict.h"
namespace Mohawk {
@@ -49,16 +49,6 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
if (_pixelFormat.bytesPerPixel == 1)
error("Myst requires greater than 256 colors to run");
- if (_vm->getFeatures() & GF_ME) {
- _jpegDecoder = new Graphics::JPEG();
- _pictDecoder = new Graphics::PictDecoder(_pixelFormat);
- } else {
- _jpegDecoder = NULL;
- _pictDecoder = NULL;
- }
-
- _pictureFile.entries = NULL;
-
// Initialize our buffer
_backBuffer = new Graphics::Surface();
_backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat);
@@ -69,113 +59,50 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
MystGraphics::~MystGraphics() {
delete _bmpDecoder;
- delete _jpegDecoder;
- delete _pictDecoder;
- delete[] _pictureFile.entries;
_backBuffer->free();
delete _backBuffer;
}
-static const char *s_picFileNames[] = {
- "CHpics",
- "",
- "",
- "DUpics",
- "INpics",
- "",
- "MEpics",
- "MYpics",
- "SEpics",
- "",
- "",
- "STpics"
-};
-
-void MystGraphics::loadExternalPictureFile(uint16 stack) {
- if (_vm->getPlatform() != Common::kPlatformMacintosh)
- return;
-
- if (_pictureFile.picFile.isOpen())
- _pictureFile.picFile.close();
- delete[] _pictureFile.entries;
-
- if (!scumm_stricmp(s_picFileNames[stack], ""))
- return;
-
- if (!_pictureFile.picFile.open(s_picFileNames[stack]))
- error ("Could not open external picture file \'%s\'", s_picFileNames[stack]);
+MohawkSurface *MystGraphics::decodeImage(uint16 id) {
+ // We need to grab the image from the current stack archive, however, we don't know
+ // if it's a PICT or WDIB resource. If it's Myst ME it's most likely a PICT, and if it's
+ // original it's definitely a WDIB. However, Myst ME throws us another curve ball in
+ // that PICT resources can contain WDIB's instead of PICT's.
+ Common::SeekableReadStream *dataStream = NULL;
+
+ if (_vm->getFeatures() & GF_ME && _vm->hasResource(ID_PICT, id)) {
+ // The PICT resource exists. However, it could still contain a MystBitmap
+ // instead of a PICT image...
+ dataStream = _vm->getResource(ID_PICT, id);
+ } else {
+ // No PICT, so the WDIB must exist. Let's go grab it.
+ dataStream = _vm->getResource(ID_WDIB, id);
+ }
- _pictureFile.pictureCount = _pictureFile.picFile.readUint32BE();
- _pictureFile.entries = new PictureFile::PictureEntry[_pictureFile.pictureCount];
+ bool isPict = false;
- for (uint32 i = 0; i < _pictureFile.pictureCount; i++) {
- _pictureFile.entries[i].offset = _pictureFile.picFile.readUint32BE();
- _pictureFile.entries[i].size = _pictureFile.picFile.readUint32BE();
- _pictureFile.entries[i].id = _pictureFile.picFile.readUint16BE();
- _pictureFile.entries[i].type = _pictureFile.picFile.readUint16BE();
- _pictureFile.entries[i].width = _pictureFile.picFile.readUint16BE();
- _pictureFile.entries[i].height = _pictureFile.picFile.readUint16BE();
+ if (_vm->getFeatures() & GF_ME) {
+ // Here we detect whether it's really a PICT or a WDIB. Since a MystBitmap
+ // would be compressed, there's no way to detect for the BM without a hack.
+ // So, we search for the PICT version opcode for detection.
+ dataStream->seek(512 + 10); // 512 byte pict header
+ isPict = (dataStream->readUint32BE() == 0x001102FF);
+ dataStream->seek(0);
}
-}
-MohawkSurface *MystGraphics::decodeImage(uint16 id) {
MohawkSurface *mhkSurface = 0;
- // Myst ME uses JPEG/PICT images instead of compressed Windows Bitmaps for room images,
- // though there are a few weird ones that use that format. For further nonsense with images,
- // the Macintosh version stores images in external "picture files." We check them before
- // going to check for a PICT resource.
- if (_vm->getFeatures() & GF_ME && _vm->getPlatform() == Common::kPlatformMacintosh && _pictureFile.picFile.isOpen()) {
- for (uint32 i = 0; i < _pictureFile.pictureCount; i++)
- if (_pictureFile.entries[i].id == id) {
- if (_pictureFile.entries[i].type == 0) {
- Common::SeekableReadStream *stream = new Common::SeekableSubReadStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size);
-
- if (!_jpegDecoder->read(stream))
- error("Could not decode Myst ME Mac JPEG");
-
- mhkSurface = new MohawkSurface(_jpegDecoder->getSurface(_pixelFormat));
- delete stream;
- } else if (_pictureFile.entries[i].type == 1) {
- mhkSurface = new MohawkSurface(_pictDecoder->decodeImage(new Common::SeekableSubReadStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size)));
- } else
- error ("Unknown Picture File type %d", _pictureFile.entries[i].type);
- break;
- }
- }
+ if (isPict) {
+ Graphics::PICTDecoder pict;
- // We're not using the external Mac files, so it's time to delve into the main Mohawk
- // archives. However, we still don't know if it's a PICT or WDIB resource. If it's Myst
- // ME it's most likely a PICT, and if it's original it's definitely a WDIB. However,
- // Myst ME throws us another curve ball in that PICT resources can contain WDIB's instead
- // of PICT's.
- if (!mhkSurface) {
- bool isPict = false;
- Common::SeekableReadStream *dataStream = NULL;
-
- if (_vm->getFeatures() & GF_ME && _vm->hasResource(ID_PICT, id)) {
- // The PICT resource exists. However, it could still contain a MystBitmap
- // instead of a PICT image...
- dataStream = _vm->getResource(ID_PICT, id);
- } else // No PICT, so the WDIB must exist. Let's go grab it.
- dataStream = _vm->getResource(ID_WDIB, id);
-
- if (_vm->getFeatures() & GF_ME) {
- // Here we detect whether it's really a PICT or a WDIB. Since a MystBitmap
- // would be compressed, there's no way to detect for the BM without a hack.
- // So, we search for the PICT version opcode for detection.
- dataStream->seek(512 + 10); // 512 byte pict header
- isPict = (dataStream->readUint32BE() == 0x001102FF);
- dataStream->seek(0);
- }
+ if (!pict.loadStream(*dataStream))
+ error("Could not decode Myst ME PICT");
- if (isPict)
- mhkSurface = new MohawkSurface(_pictDecoder->decodeImage(dataStream));
- else {
- mhkSurface = _bmpDecoder->decodeImage(dataStream);
- mhkSurface->convertToTrueColor();
- }
+ mhkSurface = new MohawkSurface(pict.getSurface()->convertTo(_pixelFormat));
+ } else {
+ mhkSurface = _bmpDecoder->decodeImage(dataStream);
+ mhkSurface->convertToTrueColor();
}
assert(mhkSurface);
@@ -221,7 +148,7 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
simulatePreviousDrawDelay(dest);
- _vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
+ _vm->_system->copyRectToScreen(surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
}
void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest) {
@@ -279,7 +206,7 @@ void MystGraphics::copyBackBufferToScreen(Common::Rect r) {
simulatePreviousDrawDelay(r);
- _vm->_system->copyRectToScreen((byte *)_backBuffer->getBasePtr(r.left, r.top), _backBuffer->pitch, r.left, r.top, r.width(), r.height());
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(r.left, r.top), _backBuffer->pitch, r.left, r.top, r.width(), r.height());
}
void MystGraphics::runTransition(uint16 type, Common::Rect rect, uint16 steps, uint16 delay) {
diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h
index e2b02db5fc..de8fe521e6 100644
--- a/engines/mohawk/myst_graphics.h
+++ b/engines/mohawk/myst_graphics.h
@@ -27,11 +27,6 @@
#include "common/file.h"
-namespace Graphics {
-class JPEG;
-class PictDecoder;
-}
-
namespace Mohawk {
class MystBitmap;
@@ -48,7 +43,6 @@ public:
MystGraphics(MohawkEngine_Myst*);
~MystGraphics();
- void loadExternalPictureFile(uint16 stack);
void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest);
void copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest);
void copyImageToScreen(uint16 image, Common::Rect dest);
@@ -70,22 +64,6 @@ protected:
private:
MohawkEngine_Myst *_vm;
MystBitmap *_bmpDecoder;
- Graphics::PictDecoder *_pictDecoder;
- Graphics::JPEG *_jpegDecoder;
-
- struct PictureFile {
- uint32 pictureCount;
- struct PictureEntry {
- uint32 offset;
- uint32 size;
- uint16 id;
- uint16 type;
- uint16 width;
- uint16 height;
- } *entries;
-
- Common::File picFile;
- } _pictureFile;
Graphics::Surface *_backBuffer;
Graphics::PixelFormat _pixelFormat;
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index b9353312c7..107a8b03e9 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -161,7 +161,7 @@ void MystScriptParser::runScript(MystScript script, MystResource *invokingResour
_vm->_gfx->enableDrawingTimeSimulation(true);
for (uint16 i = 0; i < script->size(); i++) {
- MystScriptEntry &entry = script->operator[](i);
+ MystScriptEntry &entry = (*script)[i];
debugC(kDebugScript, "\tOpcode %d: %d", i, entry.opcode);
if (entry.type == kMystScriptNormal)
@@ -207,7 +207,7 @@ MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, Myst
script->resize(opcodeCount);
for (uint16 i = 0; i < opcodeCount; i++) {
- MystScriptEntry &entry = script->operator[](i);
+ MystScriptEntry &entry = (*script)[i];
entry.type = type;
// Resource ID only exists in INIT and EXIT scripts
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index 2ced265f02..d103105c2d 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -103,13 +103,13 @@ void Dni::o_handPage(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
VideoHandle atrus = _vm->_video->findVideoHandle(_video);
// Good ending and Atrus asked to give page
- if (_globals.ending == 1 && _vm->_video->getElapsedTime(atrus) > (uint)Audio::Timestamp(0, 6801, 600).msecs()) {
+ if (_globals.ending == 1 && _vm->_video->getTime(atrus) > (uint)Audio::Timestamp(0, 6801, 600).msecs()) {
_globals.ending = 2;
_globals.heldPage = 0;
_vm->setMainCursor(kDefaultMystCursor);
// Play movie end (atrus leaving)
- _vm->_video->setVideoBounds(atrus, Audio::Timestamp(0, 14813, 600), Audio::Timestamp(0xFFFFFFFF));
+ _vm->_video->setVideoBounds(atrus, Audio::Timestamp(0, 14813, 600), _vm->_video->getDuration(atrus));
_vm->_video->setVideoLooping(atrus, false);
_atrusLeft = true;
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index 0af386f51f..545b97d956 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -100,12 +100,8 @@ void Intro::introMovies_run() {
switch (_introStep) {
case 0:
- // Play the Mattel (or UbiSoft) logo in the Myst ME Mac version
- if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) {
- _vm->_video->playMovie(_vm->wrapMovieFilename("mattel", kIntroStack));
- _introStep = 1;
- } else
- _introStep = 2;
+ _introStep = 1;
+ _vm->_video->playMovie(_vm->wrapMovieFilename("broder", kIntroStack));
break;
case 1:
if (!_vm->_video->isVideoPlaying())
@@ -113,10 +109,7 @@ void Intro::introMovies_run() {
break;
case 2:
_introStep = 3;
- if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh)
- _vm->_video->playMovie(_vm->wrapMovieFilename("presto", kIntroStack));
- else
- _vm->_video->playMovie(_vm->wrapMovieFilename("broder", kIntroStack));
+ _vm->_video->playMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
break;
case 3:
if (!_vm->_video->isVideoPlaying())
@@ -124,28 +117,14 @@ void Intro::introMovies_run() {
break;
case 4:
_introStep = 5;
- _vm->_video->playMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
+
+ if (!(_vm->getFeatures() & GF_DEMO)) // The demo doesn't have the intro video
+ _vm->_video->playMovie(_vm->wrapMovieFilename("intro", kIntroStack));
break;
case 5:
if (!_vm->_video->isVideoPlaying())
_introStep = 6;
break;
- case 6:
- _introStep = 7;
-
- if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video
- if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh)
- // intro.mov uses Sorenson, introc uses Cinepak. Otherwise, they're the same.
- // TODO: Switch back to the SVQ version when we support it
- _vm->_video->playMovie(_vm->wrapMovieFilename("introc", kIntroStack));
- else
- _vm->_video->playMovie(_vm->wrapMovieFilename("intro", kIntroStack));
- }
- break;
- case 7:
- if (!_vm->_video->isVideoPlaying())
- _introStep = 8;
- break;
default:
if (_vm->getFeatures() & GF_DEMO)
_vm->changeToCard(2001, true);
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 38b38d2c56..32613c6185 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -171,7 +171,7 @@ Common::Error MohawkEngine_Riven::run() {
error ("Could not find saved game");
// Attempt to load the game. On failure, just send us to the main menu.
- if (!_saveLoad->loadGame(savedGamesList[gameToLoad])) {
+ if (_saveLoad->loadGame(savedGamesList[gameToLoad]).getCode() != Common::kNoError) {
changeToStack(aspit);
changeToCard(1);
}
@@ -646,7 +646,7 @@ Common::String MohawkEngine_Riven::getName(uint16 nameResource, uint16 nameID) {
}
delete nameStream;
- delete [] stringOffsets;
+ delete[] stringOffsets;
return name;
}
@@ -713,23 +713,15 @@ void MohawkEngine_Riven::delayAndUpdate(uint32 ms) {
}
void MohawkEngine_Riven::runLoadDialog() {
- GUI::SaveLoadChooser slc(_("Load game:"), _("Load"));
- slc.setSaveMode(false);
+ GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
- Common::String gameId = ConfMan.get("gameid");
-
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(gameId, &plugin);
-
- int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ int slot = slc.runModalWithCurrentTarget();
if (slot >= 0)
loadGameState(slot);
-
- slc.close();
}
Common::Error MohawkEngine_Riven::loadGameState(int slot) {
- return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]) ? Common::kNoError : Common::kUnknownError;
+ return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]);
}
Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) {
@@ -738,7 +730,7 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
if ((uint)slot < saveList.size())
_saveLoad->deleteSave(saveList[slot]);
- return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError;
+ return _saveLoad->saveGame(desc);
}
Common::String MohawkEngine_Riven::getStackName(uint16 stack) const {
@@ -979,7 +971,7 @@ void MohawkEngine_Riven::doVideoTimer(VideoHandle handle, bool force) {
return;
// Run the opcode if we can at this point
- if (force || _video->getElapsedTime(handle) >= _scriptMan->getStoredMovieOpcodeTime())
+ if (force || _video->getTime(handle) >= _scriptMan->getStoredMovieOpcodeTime())
_scriptMan->runStoredMovieOpcode();
}
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index e99a9f78fc..961d85d61a 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -130,8 +130,8 @@ public:
GUI::Debugger *getDebugger();
- bool canLoadGameStateCurrently() { return true; }
- bool canSaveGameStateCurrently() { return true; }
+ bool canLoadGameStateCurrently() { return !(getFeatures() & GF_DEMO); }
+ bool canSaveGameStateCurrently() { return !(getFeatures() & GF_DEMO); }
Common::Error loadGameState(int slot);
Common::Error saveGameState(int slot, const Common::String &desc);
bool hasFeature(EngineFeature f) const;
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 8dfc74ebf0..337a57e3e1 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -2059,7 +2059,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
debug(0, "\tHotspot = %d -> %d", argv[3], hotspotMap[argv[3] - 1]);
// Just let the video play while we wait until Gehn opens the trap book for us
- while (_vm->_video->getElapsedTime(video) < startTime && !_vm->shouldQuit()) {
+ while (_vm->_video->getTime(video) < startTime && !_vm->shouldQuit()) {
if (_vm->_video->updateMovies())
_vm->_system->updateScreen();
@@ -2084,7 +2084,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
// OK, Gehn has opened the trap book and has asked us to go in. Let's watch
// and see what the player will do...
- while (_vm->_video->getElapsedTime(video) < endTime && !_vm->shouldQuit()) {
+ while (_vm->_video->getTime(video) < endTime && !_vm->shouldQuit()) {
bool updateScreen = _vm->_video->updateMovies();
Common::Event event;
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 9415e51412..05e66a3924 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -115,7 +115,7 @@ void RivenGraphics::updateScreen(Common::Rect updateRect) {
// Copy to screen if there's no transition. Otherwise transition. ;)
if (_scheduledTransition < 0)
- _vm->_system->copyRectToScreen((byte *)_mainScreen->getBasePtr(updateRect.left, updateRect.top), _mainScreen->pitch, updateRect.left, updateRect.top, updateRect.width(), updateRect.height());
+ _vm->_system->copyRectToScreen(_mainScreen->getBasePtr(updateRect.left, updateRect.top), _mainScreen->pitch, updateRect.left, updateRect.top, updateRect.width(), updateRect.height());
else
runScheduledTransition();
@@ -255,7 +255,7 @@ void RivenGraphics::runScheduledTransition() {
}
// For now, just copy the image to screen without doing any transition.
- _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
+ _vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
_vm->_system->updateScreen();
_scheduledTransition = -1; // Clear scheduled transition
@@ -345,7 +345,7 @@ void RivenGraphics::drawInventoryImage(uint16 id, const Common::Rect *rect) {
mhkSurface->convertToTrueColor();
Graphics::Surface *surface = mhkSurface->getSurface();
- _vm->_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h);
+ _vm->_system->copyRectToScreen(surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h);
delete mhkSurface;
}
@@ -437,7 +437,7 @@ void RivenGraphics::updateCredits() {
}
// Now flush the new screen
- _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
+ _vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
_vm->_system->updateScreen();
}
}
diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index 18c13ec12b..f5bf7782d4 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -88,13 +88,13 @@ static uint16 mapNewStackIDToOld(uint16 newID) {
return 0;
}
-bool RivenSaveLoad::loadGame(Common::String filename) {
+Common::Error RivenSaveLoad::loadGame(Common::String filename) {
if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo
- return false;
+ return Common::kNoError;
Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filename);
if (!loadFile)
- return false;
+ return Common::kReadingFailed;
debug(0, "Loading game from \'%s\'", filename.c_str());
@@ -103,7 +103,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
if (!mhk->openStream(loadFile)) {
warning("Save file is not a Mohawk archive");
delete mhk;
- return false;
+ return Common::Error(Common::kUnknownError, "Invalid save file");
}
// First, let's make sure we're using a saved game file from this version of Riven by checking the VERS resource
@@ -114,7 +114,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
|| (saveGameVersion == kDVDSaveGameVersion && !(_vm->getFeatures() & GF_DVD))) {
warning("Incompatible saved game versions. No support for this yet");
delete mhk;
- return false;
+ return Common::Error(Common::kUnknownError, "Incompatible save version");
}
// Now, we'll read in the variable values.
@@ -206,7 +206,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
delete zips;
delete mhk;
- return true;
+ return Common::kNoError;
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
@@ -273,7 +273,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
return stream;
}
-bool RivenSaveLoad::saveGame(Common::String filename) {
+Common::Error RivenSaveLoad::saveGame(Common::String filename) {
// NOTE: This code is designed to only output a Mohawk archive
// for a Riven saved game. It's hardcoded to do this because
// (as of right now) this is the only place in the engine
@@ -295,7 +295,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) {
Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
if (!saveFile)
- return false;
+ return Common::kWritingFailed;
debug (0, "Saving game to \'%s\'", filename.c_str());
@@ -418,7 +418,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) {
delete varsSection;
delete zipsSection;
- return true;
+ return Common::kNoError;
}
void RivenSaveLoad::deleteSave(Common::String saveName) {
diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h
index c1b3fc639e..37b73c26c6 100644
--- a/engines/mohawk/riven_saveload.h
+++ b/engines/mohawk/riven_saveload.h
@@ -42,8 +42,8 @@ public:
~RivenSaveLoad();
Common::StringArray generateSaveGameList();
- bool loadGame(Common::String);
- bool saveGame(Common::String);
+ Common::Error loadGame(Common::String);
+ Common::Error saveGame(Common::String);
void deleteSave(Common::String);
private:
diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp
index ba5c343e07..8ddb76eec9 100644
--- a/engines/mohawk/riven_vars.cpp
+++ b/engines/mohawk/riven_vars.cpp
@@ -305,6 +305,7 @@ void MohawkEngine_Riven::initVars() {
_vars["gnmagcar"] = 1;
_vars["omusicplayer"] = 1;
_vars["transitionmode"] = kRivenTransitionSpeedFastest;
+ _vars["tdomeelev"] = 1;
// Randomize the telescope combination
uint32 &teleCombo = _vars["tcorrectorder"];
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 8d72fa3f72..b1b99722d5 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -29,6 +29,7 @@
#include "common/textconsole.h"
#include "common/system.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "video/qt_decoder.h"
@@ -43,13 +44,12 @@ void VideoEntry::clear() {
loop = false;
enabled = false;
start = Audio::Timestamp(0, 1);
- end = Audio::Timestamp(0xFFFFFFFF, 1); // Largest possible, there is an endOfVideo() check anyway
filename.clear();
id = -1;
}
bool VideoEntry::endOfVideo() {
- return !video || video->endOfVideo() || video->getElapsedTime() >= (uint)end.msecs();
+ return !video || video->endOfVideo();
}
VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) {
@@ -207,7 +207,7 @@ bool VideoManager::updateMovies() {
// Remove any videos that are over
if (_videoStreams[i].endOfVideo()) {
if (_videoStreams[i].loop) {
- _videoStreams[i]->seekToTime(_videoStreams[i].start);
+ _videoStreams[i]->seek(_videoStreams[i].start);
} else {
// Check the video time one last time before deleting it
_vm->doVideoTimer(i, true);
@@ -227,41 +227,25 @@ bool VideoManager::updateMovies() {
Graphics::Surface *convertedFrame = 0;
if (frame && _videoStreams[i].enabled) {
- // Convert from 8bpp to the current screen format if necessary
Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();
- if (frame->format.bytesPerPixel == 1) {
- if (pixelFormat.bytesPerPixel == 1) {
- if (_videoStreams[i]->hasDirtyPalette())
- _videoStreams[i]->setSystemPalette();
- } else {
- convertedFrame = new Graphics::Surface();
- const byte *palette = _videoStreams[i]->getPalette();
- assert(palette);
-
- convertedFrame->create(frame->w, frame->h, pixelFormat);
-
- for (uint16 j = 0; j < frame->h; j++) {
- for (uint16 k = 0; k < frame->w; k++) {
- byte palIndex = *((const byte *)frame->getBasePtr(k, j));
- byte r = palette[palIndex * 3];
- byte g = palette[palIndex * 3 + 1];
- byte b = palette[palIndex * 3 + 2];
- if (pixelFormat.bytesPerPixel == 2)
- *((uint16 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b);
- else
- *((uint32 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b);
- }
- }
-
- frame = convertedFrame;
- }
+ if (frame->format != pixelFormat) {
+ // We don't support downconverting to 8bpp
+ if (pixelFormat.bytesPerPixel == 1)
+ error("Cannot convert high color video frame to 8bpp");
+
+ // Convert to the current screen format
+ convertedFrame = frame->convertTo(pixelFormat, _videoStreams[i]->getPalette());
+ frame = convertedFrame;
+ } else if (pixelFormat.bytesPerPixel == 1 && _videoStreams[i]->hasDirtyPalette()) {
+ // Set the palette when running in 8bpp mode only
+ _vm->_system->getPaletteManager()->setPalette(_videoStreams[i]->getPalette(), 0, 256);
}
// 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(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;
@@ -333,7 +317,7 @@ VideoHandle VideoManager::playMovieRiven(uint16 id) {
for (uint16 i = 0; i < _mlstRecords.size(); i++)
if (_mlstRecords[i].code == id) {
debug(1, "Play tMOV %d (non-blocking) at (%d, %d) %s", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].loop != 0 ? "looping" : "non-looping");
- return createVideoHandle(_mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].loop != 0);
+ return createVideoHandle(_mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].loop != 0, _mlstRecords[i].volume);
}
return NULL_VID_HANDLE;
@@ -389,7 +373,7 @@ void VideoManager::disableAllMovies() {
_videoStreams[i].enabled = false;
}
-VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop) {
+VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop, byte volume) {
// First, check to see if that video is already playing
for (uint32 i = 0; i < _videoStreams.size(); i++)
if (_videoStreams[i].id == id)
@@ -399,6 +383,7 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool
Video::QuickTimeDecoder *decoder = new Video::QuickTimeDecoder();
decoder->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, id));
decoder->loadStream(_vm->getResource(ID_TMOV, id));
+ decoder->setVolume(volume);
VideoEntry entry;
entry.clear();
@@ -409,6 +394,8 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool
entry.loop = loop;
entry.enabled = true;
+ entry->start();
+
// Search for any deleted videos so we can take a formerly used slot
for (uint32 i = 0; i < _videoStreams.size(); i++)
if (!_videoStreams[i].video) {
@@ -421,7 +408,7 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool
return _videoStreams.size() - 1;
}
-VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop) {
+VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop, byte volume) {
// First, check to see if that video is already playing
for (uint32 i = 0; i < _videoStreams.size(); i++)
if (_videoStreams[i].filename == filename)
@@ -444,6 +431,8 @@ VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint
}
entry->loadStream(file);
+ entry->setVolume(volume);
+ entry->start();
// Search for any deleted videos so we can take a formerly used slot
for (uint32 i = 0; i < _videoStreams.size(); i++)
@@ -489,7 +478,7 @@ VideoHandle VideoManager::findVideoHandle(const Common::String &filename) {
return NULL_VID_HANDLE;
}
-int32 VideoManager::getCurFrame(VideoHandle handle) {
+int VideoManager::getCurFrame(VideoHandle handle) {
assert(handle != NULL_VID_HANDLE);
return _videoStreams[handle]->getCurFrame();
}
@@ -499,14 +488,14 @@ uint32 VideoManager::getFrameCount(VideoHandle handle) {
return _videoStreams[handle]->getFrameCount();
}
-uint32 VideoManager::getElapsedTime(VideoHandle handle) {
+uint32 VideoManager::getTime(VideoHandle handle) {
assert(handle != NULL_VID_HANDLE);
- return _videoStreams[handle]->getElapsedTime();
+ return _videoStreams[handle]->getTime();
}
uint32 VideoManager::getDuration(VideoHandle handle) {
assert(handle != NULL_VID_HANDLE);
- return _videoStreams[handle]->getDuration();
+ return _videoStreams[handle]->getDuration().msecs();
}
bool VideoManager::endOfVideo(VideoHandle handle) {
@@ -525,14 +514,13 @@ bool VideoManager::isVideoPlaying() {
void VideoManager::setVideoBounds(VideoHandle handle, Audio::Timestamp start, Audio::Timestamp end) {
assert(handle != NULL_VID_HANDLE);
_videoStreams[handle].start = start;
- _videoStreams[handle].end = end;
- _videoStreams[handle]->seekToTime(start);
+ _videoStreams[handle]->setEndTime(end);
+ _videoStreams[handle]->seek(start);
}
void VideoManager::drawVideoFrame(VideoHandle handle, Audio::Timestamp time) {
assert(handle != NULL_VID_HANDLE);
- _videoStreams[handle].end = Audio::Timestamp(0xffffffff, 1);
- _videoStreams[handle]->seekToTime(time);
+ _videoStreams[handle]->seek(time);
updateMovies();
delete _videoStreams[handle].video;
_videoStreams[handle].clear();
@@ -540,7 +528,7 @@ void VideoManager::drawVideoFrame(VideoHandle handle, Audio::Timestamp time) {
void VideoManager::seekToTime(VideoHandle handle, Audio::Timestamp time) {
assert(handle != NULL_VID_HANDLE);
- _videoStreams[handle]->seekToTime(time);
+ _videoStreams[handle]->seek(time);
}
void VideoManager::setVideoLooping(VideoHandle handle, bool loop) {
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 34c287497f..6d2783936d 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -45,19 +45,19 @@ struct MLSTRecord {
struct VideoEntry {
// Playback variables
- Video::SeekableVideoDecoder *video;
+ Video::VideoDecoder *video;
uint16 x;
uint16 y;
bool loop;
bool enabled;
- Audio::Timestamp start, end;
+ Audio::Timestamp start;
// Identification
Common::String filename; // External video files
int id; // Internal Mohawk files
// Helper functions
- Video::SeekableVideoDecoder *operator->() const { assert(video); return video; } // TODO: Remove this eventually
+ Video::VideoDecoder *operator->() const { assert(video); return video; } // TODO: Remove this eventually
void clear();
bool endOfVideo();
};
@@ -98,9 +98,9 @@ public:
// Handle functions
VideoHandle findVideoHandle(uint16 id);
VideoHandle findVideoHandle(const Common::String &filename);
- int32 getCurFrame(VideoHandle handle);
+ int getCurFrame(VideoHandle handle);
uint32 getFrameCount(VideoHandle handle);
- uint32 getElapsedTime(VideoHandle handle);
+ uint32 getTime(VideoHandle handle);
uint32 getDuration(VideoHandle videoHandle);
bool endOfVideo(VideoHandle handle);
void setVideoBounds(VideoHandle handle, Audio::Timestamp start, Audio::Timestamp end);
@@ -120,8 +120,8 @@ private:
// Keep tabs on any videos playing
Common::Array<VideoEntry> _videoStreams;
- VideoHandle createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop);
- VideoHandle createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop);
+ VideoHandle createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop, byte volume = 0xff);
+ VideoHandle createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop, byte volume = 0xff);
};
} // End of namespace Mohawk
diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp
index 1b40c8f1f6..799f04f09a 100644
--- a/engines/neverhood/smackerplayer.cpp
+++ b/engines/neverhood/smackerplayer.cpp
@@ -76,7 +76,7 @@ SmackerPlayer::SmackerPlayer(NeverhoodEngine *vm, Scene *scene, uint32 fileHash,
SmackerPlayer::~SmackerPlayer() {
close();
-}
+}
void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) {
debug("SmackerPlayer::open(%08X)", fileHash);
@@ -98,7 +98,7 @@ void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) {
// TODO: _keepLastFrame stuff
- _smackerDecoder = new Video::SmackerDecoder(_vm->_mixer);
+ _smackerDecoder = new Video::SmackerDecoder();
_smackerDecoder->loadStream(_stream);
_palette = new Palette(_vm);
@@ -154,7 +154,7 @@ void SmackerPlayer::rewind() {
_stream = _vm->_res->createStream(_fileHash);
- _smackerDecoder = new Video::SmackerDecoder(_vm->_mixer);
+ _smackerDecoder = new Video::SmackerDecoder();
_smackerDecoder->loadStream(_stream);
}
diff --git a/engines/parallaction/adlib.cpp b/engines/parallaction/adlib.cpp
new file mode 100644
index 0000000000..134e5cfbf3
--- /dev/null
+++ b/engines/parallaction/adlib.cpp
@@ -0,0 +1,808 @@
+/* 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/debug.h"
+#include "common/system.h"
+
+#include "audio/fmopl.h"
+#include "audio/mpu401.h"
+#include "audio/softsynth/emumidi.h"
+
+namespace Parallaction {
+
+const uint kNumVoices = 9;
+// adlib FM voices 0-5
+const uint kNumMelodic = 6;
+// adlib FM voice 6 and 7-8
+const uint kNumPercussion = 5;
+
+// mask for maximum volume level
+#define LEVEL_MASK 0x7f
+
+struct OPLOperator {
+ uint8 characteristic; // amplitude modulation, vibrato, envelope, keyboard scaling, modulator frequency
+ uint8 levels;
+ uint8 attackDecay;
+ uint8 sustainRelease;
+ uint8 waveform;
+};
+
+struct MelodicProgram {
+ OPLOperator op[2];
+ uint8 feedbackAlgo;
+};
+
+struct PercussionNote {
+ OPLOperator op[2];
+ uint8 feedbackAlgo;
+ uint8 percussion;
+ uint8 valid;
+ uint16 frequency;
+ uint8 octave;
+};
+
+static const MelodicProgram melodicPrograms[128] = {
+ {{{ 0x1, 0x51, 0xf2, 0xb2, 0x0 }, { 0x11, 0x0, 0xf2, 0xa2, 0x0 }}, 0x0 },
+ {{{ 0xc2, 0x4b, 0xf1, 0x53, 0x0 }, { 0xd2, 0x0, 0xf2, 0x74, 0x0 }}, 0x4 },
+ {{{ 0x81, 0x9d, 0xf2, 0x74, 0x0 }, { 0x13, 0x0, 0xf2, 0xf1, 0x0 }}, 0x6 },
+ {{{ 0x3, 0x4f, 0xf1, 0x53, 0x0 }, { 0x17, 0x3, 0xf2, 0x74, 0x0 }}, 0x6 },
+ {{{ 0xd1, 0x81, 0x81, 0x73, 0x2 }, { 0xd4, 0x0, 0xe1, 0x34, 0x0 }}, 0x3 },
+ {{{ 0x1, 0x0, 0x94, 0xa6, 0x0 }, { 0x2, 0x0, 0x83, 0x26, 0x0 }}, 0x1 },
+ {{{ 0xf3, 0x84, 0x81, 0x2, 0x1 }, { 0x55, 0x80, 0xdd, 0x3, 0x0 }}, 0x4 },
+ {{{ 0x5, 0x8a, 0xf2, 0x26, 0x0 }, { 0x1, 0x80, 0xf3, 0x48, 0x0 }}, 0x0 },
+ {{{ 0x32, 0x0, 0xb1, 0x14, 0x0 }, { 0x12, 0x0, 0xfd, 0x36, 0x0 }}, 0x3 },
+ {{{ 0x1, 0x0, 0x82, 0xa, 0x2 }, { 0x2, 0x0, 0x85, 0x15, 0x0 }}, 0x3 },
+ {{{ 0xd1, 0x1, 0x97, 0xaa, 0x0 }, { 0x4, 0xd, 0xf3, 0xa5, 0x1 }}, 0x9 },
+ {{{ 0x17, 0x0, 0xf2, 0x62, 0x0 }, { 0x12, 0x0, 0xf2, 0x72, 0x0 }}, 0x8 },
+ {{{ 0x6, 0x0, 0xff, 0xf4, 0x0 }, { 0xc4, 0x0, 0xf8, 0xb5, 0x0 }}, 0xe },
+ {{{ 0xc0, 0x81, 0xf2, 0x13, 0x2 }, { 0xc0, 0xc1, 0xf3, 0x14, 0x2 }}, 0xb },
+ {{{ 0x44, 0x53, 0xf5, 0x31, 0x0 }, { 0x60, 0x80, 0xfd, 0x22, 0x0 }}, 0x6 },
+ {{{ 0xe0, 0x80, 0xf4, 0xf2, 0x0 }, { 0x61, 0x0, 0xf2, 0x6, 0x0 }}, 0x8 },
+ {{{ 0xc1, 0x6, 0x83, 0x23, 0x0 }, { 0xc1, 0x4, 0xf0, 0x26, 0x0 }}, 0x1 },
+ {{{ 0x26, 0x0, 0xf4, 0xb6, 0x0 }, { 0x21, 0x0, 0x81, 0x4b, 0x0 }}, 0x1 },
+ {{{ 0x24, 0x80, 0xff, 0xf, 0x0 }, { 0x21, 0x80, 0xff, 0xf, 0x0 }}, 0x1 },
+ {{{ 0x24, 0x4f, 0xf2, 0xb, 0x0 }, { 0x31, 0x0, 0x52, 0xb, 0x0 }}, 0xb },
+ {{{ 0x31, 0x8, 0x81, 0xb, 0x0 }, { 0xa1, 0x80, 0x92, 0x3b, 0x0 }}, 0x0 },
+ {{{ 0x70, 0xc5, 0x52, 0x11, 0x1 }, { 0x71, 0x80, 0x31, 0xfe, 0x1 }}, 0x0 },
+ {{{ 0x51, 0x88, 0x10, 0xf0, 0x0 }, { 0x42, 0x83, 0x40, 0xfc, 0x0 }}, 0x8 },
+ {{{ 0xf0, 0xd9, 0x81, 0x3, 0x0 }, { 0xb1, 0x80, 0xf1, 0x5, 0x0 }}, 0xa },
+ {{{ 0x21, 0x4f, 0xf1, 0x31, 0x0 }, { 0x2, 0x80, 0xc3, 0x45, 0x0 }}, 0x0 },
+ {{{ 0x7, 0x8f, 0x9c, 0x33, 0x1 }, { 0x1, 0x80, 0x8a, 0x13, 0x0 }}, 0x0 },
+ {{{ 0x21, 0x40, 0xf1, 0x31, 0x0 }, { 0x6, 0x80, 0xf4, 0x44, 0x0 }}, 0x0 },
+ {{{ 0x21, 0x40, 0xf1, 0x31, 0x3 }, { 0x81, 0x0, 0xf4, 0x44, 0x2 }}, 0x2 },
+ {{{ 0x11, 0x8d, 0xfd, 0x11, 0x0 }, { 0x11, 0x80, 0xfd, 0x11, 0x0 }}, 0x8 },
+ {{{ 0xf0, 0x1, 0x97, 0x17, 0x0 }, { 0x21, 0xd, 0xf1, 0x18, 0x0 }}, 0x8 },
+ {{{ 0xf1, 0x1, 0x97, 0x17, 0x0 }, { 0x21, 0xd, 0xf1, 0x18, 0x0 }}, 0x8 },
+ {{{ 0xcd, 0x9e, 0x55, 0xd1, 0x0 }, { 0xd1, 0x0, 0xf2, 0x71, 0x0 }}, 0xe },
+ {{{ 0x1, 0x0, 0xf2, 0x88, 0x0 }, { 0x1, 0x0, 0xf5, 0x88, 0x0 }}, 0x1 },
+ {{{ 0x30, 0xd, 0xf2, 0xef, 0x0 }, { 0x21, 0x0, 0xf5, 0x78, 0x0 }}, 0x6 },
+ {{{ 0x0, 0x10, 0xf4, 0xd9, 0x0 }, { 0x0, 0x0, 0xf5, 0xd7, 0x0 }}, 0x4 },
+ {{{ 0x1, 0x4c, 0xf2, 0x50, 0x0 }, { 0x1, 0x40, 0xd2, 0x59, 0x0 }}, 0x8 },
+ {{{ 0x20, 0x11, 0xe2, 0x8a, 0x0 }, { 0x20, 0x0, 0xe4, 0xa8, 0x0 }}, 0xa },
+ {{{ 0x21, 0x40, 0x7b, 0x4, 0x1 }, { 0x21, 0x0, 0x75, 0x72, 0x0 }}, 0x2 },
+ {{{ 0x31, 0xd, 0xf2, 0xef, 0x0 }, { 0x21, 0x0, 0xf5, 0x78, 0x0 }}, 0xa },
+ {{{ 0x1, 0xc, 0xf5, 0x2f, 0x1 }, { 0x0, 0x80, 0xf5, 0x5c, 0x0 }}, 0x0 },
+ {{{ 0xb0, 0x1c, 0x81, 0x3, 0x2 }, { 0x20, 0x0, 0x54, 0x67, 0x2 }}, 0xe },
+ {{{ 0x1, 0x0, 0xf1, 0x65, 0x0 }, { 0x1, 0x80, 0xa3, 0xa8, 0x2 }}, 0x1 },
+ {{{ 0xe1, 0x4f, 0xc1, 0xd3, 0x2 }, { 0x21, 0x0, 0x32, 0x74, 0x1 }}, 0x0 },
+ {{{ 0x2, 0x0, 0xf6, 0x16, 0x0 }, { 0x12, 0x0, 0xf2, 0xf8, 0x0 }}, 0x1 },
+ {{{ 0xe0, 0x63, 0xf8, 0xf3, 0x0 }, { 0x70, 0x80, 0xf7, 0xf3, 0x0 }}, 0x4 },
+ {{{ 0x1, 0x6, 0xf3, 0xff, 0x0 }, { 0x8, 0x0, 0xf7, 0xff, 0x0 }}, 0x4 },
+ {{{ 0x21, 0x16, 0xb0, 0x81, 0x1 }, { 0x22, 0x0, 0xb3, 0x13, 0x1 }}, 0xc },
+ {{{ 0x1, 0x4f, 0xf0, 0xff, 0x0 }, { 0x30, 0x0, 0x90, 0xf, 0x0 }}, 0x6 },
+ {{{ 0x0, 0x10, 0xf1, 0xf2, 0x2 }, { 0x1, 0x0, 0xf1, 0xf2, 0x3 }}, 0x0 },
+ {{{ 0x1, 0x4f, 0xf1, 0x50, 0x0 }, { 0x21, 0x80, 0xa3, 0x5, 0x3 }}, 0x6 },
+ {{{ 0xb1, 0x3, 0x55, 0x3, 0x0 }, { 0xb1, 0x3, 0x8, 0xa, 0x0 }}, 0x9 },
+ {{{ 0x22, 0x0, 0xa9, 0x34, 0x1 }, { 0x1, 0x0, 0xa2, 0x42, 0x2 }}, 0x2 },
+ {{{ 0xa0, 0xdc, 0x81, 0x31, 0x3 }, { 0xb1, 0x80, 0xf1, 0x1, 0x3 }}, 0x0 },
+ {{{ 0x1, 0x4f, 0xf1, 0x50, 0x0 }, { 0x21, 0x80, 0xa3, 0x5, 0x3 }}, 0x6 },
+ {{{ 0xf1, 0x80, 0xa0, 0x72, 0x0 }, { 0x74, 0x0, 0x90, 0x22, 0x0 }}, 0x9 },
+ {{{ 0xe1, 0x13, 0x71, 0xae, 0x0 }, { 0xe1, 0x0, 0xf0, 0xfc, 0x1 }}, 0xa },
+ {{{ 0x31, 0x1c, 0x41, 0xb, 0x0 }, { 0xa1, 0x80, 0x92, 0x3b, 0x0 }}, 0xe },
+ {{{ 0x71, 0x1c, 0x41, 0x1f, 0x0 }, { 0xa1, 0x80, 0x92, 0x3b, 0x0 }}, 0xe },
+ {{{ 0x21, 0x1c, 0x53, 0x1d, 0x0 }, { 0xa1, 0x80, 0x52, 0x3b, 0x0 }}, 0xc },
+ {{{ 0x21, 0x1d, 0xa4, 0xae, 0x1 }, { 0x21, 0x0, 0xb1, 0x9e, 0x0 }}, 0xc },
+ {{{ 0xe1, 0x16, 0x71, 0xae, 0x0 }, { 0xe1, 0x0, 0x81, 0x9e, 0x0 }}, 0xa },
+ {{{ 0xe1, 0x15, 0x71, 0xae, 0x0 }, { 0xe2, 0x0, 0x81, 0x9e, 0x0 }}, 0xe },
+ {{{ 0x21, 0x16, 0x71, 0xae, 0x0 }, { 0x21, 0x0, 0x81, 0x9e, 0x0 }}, 0xe },
+ {{{ 0x71, 0x1c, 0x41, 0x1f, 0x0 }, { 0xa1, 0x80, 0x92, 0x3b, 0x0 }}, 0xe },
+ {{{ 0x21, 0x4f, 0x81, 0x53, 0x0 }, { 0x32, 0x0, 0x22, 0x2c, 0x0 }}, 0xa },
+ {{{ 0x22, 0x4f, 0x81, 0x53, 0x0 }, { 0x32, 0x0, 0x22, 0x2c, 0x0 }}, 0xa },
+ {{{ 0x23, 0x4f, 0x81, 0x53, 0x0 }, { 0x34, 0x0, 0x22, 0x2c, 0x0 }}, 0xa },
+ {{{ 0xe1, 0x16, 0x71, 0xae, 0x0 }, { 0xe1, 0x0, 0x81, 0x9e, 0x0 }}, 0xa },
+ {{{ 0x71, 0xc5, 0x6e, 0x17, 0x0 }, { 0x22, 0x5, 0x8b, 0xe, 0x0 }}, 0x2 },
+ {{{ 0xe6, 0x27, 0x70, 0xf, 0x1 }, { 0xe3, 0x0, 0x60, 0x9f, 0x0 }}, 0xa },
+ {{{ 0x30, 0xc8, 0xd5, 0x19, 0x0 }, { 0xb1, 0x80, 0x61, 0x1b, 0x0 }}, 0xc },
+ {{{ 0x32, 0x9a, 0x51, 0x1b, 0x0 }, { 0xa1, 0x82, 0xa2, 0x3b, 0x0 }}, 0xc },
+ {{{ 0xad, 0x3, 0x74, 0x29, 0x0 }, { 0xa2, 0x82, 0x73, 0x29, 0x0 }}, 0x7 },
+ {{{ 0x21, 0x83, 0x74, 0x17, 0x0 }, { 0x62, 0x8d, 0x65, 0x17, 0x0 }}, 0x7 },
+ {{{ 0x94, 0xb, 0x85, 0xff, 0x1 }, { 0x13, 0x0, 0x74, 0xff, 0x0 }}, 0xc },
+ {{{ 0x74, 0x87, 0xa4, 0x2, 0x0 }, { 0xd6, 0x80, 0x45, 0x42, 0x0 }}, 0x2 },
+ {{{ 0xb3, 0x85, 0x76, 0x21, 0x1 }, { 0x20, 0x0, 0x3d, 0xc1, 0x0 }}, 0x6 },
+ {{{ 0x17, 0x4f, 0xf2, 0x61, 0x0 }, { 0x12, 0x8, 0xf1, 0xb4, 0x0 }}, 0x8 },
+ {{{ 0x4f, 0x86, 0x65, 0x1, 0x0 }, { 0x1f, 0x0, 0x32, 0x74, 0x0 }}, 0x4 },
+ {{{ 0xe1, 0x23, 0x71, 0xae, 0x0 }, { 0xe4, 0x0, 0x82, 0x9e, 0x0 }}, 0xa },
+ {{{ 0x11, 0x86, 0xf2, 0xbd, 0x0 }, { 0x4, 0x80, 0xa0, 0x9b, 0x1 }}, 0x8 },
+ {{{ 0x20, 0x90, 0xf5, 0x9e, 0x2 }, { 0x11, 0x0, 0xf4, 0x5b, 0x3 }}, 0xc },
+ {{{ 0xf0, 0x80, 0x34, 0xe4, 0x0 }, { 0x7e, 0x0, 0xa2, 0x6, 0x0 }}, 0x8 },
+ {{{ 0x90, 0xf, 0xff, 0x1, 0x3 }, { 0x0, 0x0, 0x1f, 0x1, 0x0 }}, 0xe },
+ {{{ 0x1, 0x4f, 0xf0, 0xff, 0x0 }, { 0x33, 0x0, 0x90, 0xf, 0x0 }}, 0x6 },
+ {{{ 0x1e, 0x0, 0x1f, 0xf, 0x0 }, { 0x10, 0x0, 0x1f, 0x7f, 0x0 }}, 0x0 },
+ {{{ 0xbe, 0x0, 0xf1, 0x1, 0x3 }, { 0x31, 0x0, 0xf1, 0x1, 0x0 }}, 0x4 },
+ {{{ 0xbe, 0x0, 0xf1, 0x1, 0x3 }, { 0x31, 0x0, 0xf1, 0x1, 0x0 }}, 0x4 },
+ {{{ 0x93, 0x6, 0xc1, 0x4, 0x1 }, { 0x82, 0x0, 0x51, 0x9, 0x0 }}, 0x6 },
+ {{{ 0xa0, 0x0, 0x96, 0x33, 0x0 }, { 0x20, 0x0, 0x55, 0x2b, 0x0 }}, 0x6 },
+ {{{ 0x0, 0xc0, 0xff, 0x5, 0x0 }, { 0x0, 0x0, 0xff, 0x5, 0x3 }}, 0x0 },
+ {{{ 0x4, 0x8, 0xf8, 0x7, 0x0 }, { 0x1, 0x0, 0x82, 0x74, 0x0 }}, 0x8 },
+ {{{ 0x0, 0x0, 0x2f, 0x5, 0x0 }, { 0x20, 0x0, 0xff, 0x5, 0x3 }}, 0xa },
+ {{{ 0x93, 0x0, 0xf7, 0x7, 0x2 }, { 0x0, 0x0, 0xf7, 0x7, 0x0 }}, 0xa },
+ {{{ 0x0, 0x40, 0x80, 0x7a, 0x0 }, { 0xc4, 0x0, 0xc0, 0x7e, 0x0 }}, 0x8 },
+ {{{ 0x90, 0x80, 0x55, 0xf5, 0x0 }, { 0x0, 0x0, 0x55, 0xf5, 0x0 }}, 0x8 },
+ {{{ 0xe1, 0x80, 0x34, 0xe4, 0x0 }, { 0x69, 0x0, 0xf2, 0x6, 0x0 }}, 0x8 },
+ {{{ 0x3, 0x2, 0xf0, 0xff, 0x3 }, { 0x11, 0x80, 0xf0, 0xff, 0x2 }}, 0x2 },
+ {{{ 0x1e, 0x0, 0x1f, 0xf, 0x0 }, { 0x10, 0x0, 0x1f, 0x7f, 0x0 }}, 0x0 },
+ {{{ 0x0, 0x0, 0x2f, 0x1, 0x0 }, { 0x0, 0x0, 0xff, 0x1, 0x0 }}, 0x4 },
+ {{{ 0xbe, 0x0, 0xf1, 0x1, 0x3 }, { 0x31, 0x0, 0xf1, 0x1, 0x0 }}, 0x4 },
+ {{{ 0x93, 0x85, 0x3f, 0x6, 0x1 }, { 0x0, 0x0, 0x5f, 0x7, 0x0 }}, 0x6 },
+ {{{ 0x6, 0x0, 0xa0, 0xf0, 0x0 }, { 0x44, 0x0, 0xc5, 0x75, 0x0 }}, 0xe },
+ {{{ 0x60, 0x0, 0x10, 0x81, 0x0 }, { 0x20, 0x8c, 0x12, 0x91, 0x0 }}, 0xe },
+ {{{ 0x1, 0x40, 0xf1, 0x53, 0x0 }, { 0x8, 0x40, 0xf1, 0x53, 0x0 }}, 0x0 },
+ {{{ 0x31, 0x0, 0x56, 0x31, 0x0 }, { 0x16, 0x0, 0x7d, 0x41, 0x0 }}, 0x0 },
+ {{{ 0x0, 0x10, 0xf2, 0x72, 0x0 }, { 0x13, 0x0, 0xf2, 0x72, 0x0 }}, 0xc },
+ {{{ 0x10, 0x0, 0x75, 0x93, 0x1 }, { 0x1, 0x0, 0xf5, 0x82, 0x1 }}, 0x0 },
+ {{{ 0x0, 0x0, 0xf6, 0xff, 0x2 }, { 0x0, 0x0, 0xf6, 0xff, 0x0 }}, 0x8 },
+ {{{ 0x30, 0x0, 0xff, 0xa0, 0x3 }, { 0x63, 0x0, 0x65, 0xb, 0x2 }}, 0x0 },
+ {{{ 0x2a, 0x0, 0xf6, 0x87, 0x0 }, { 0x2b, 0x0, 0x76, 0x25, 0x0 }}, 0x0 },
+ {{{ 0x85, 0x0, 0xb8, 0x84, 0x0 }, { 0x43, 0x0, 0xe5, 0x8f, 0x0 }}, 0x6 },
+ {{{ 0x7, 0x4f, 0xf2, 0x60, 0x0 }, { 0x12, 0x0, 0xf2, 0x72, 0x0 }}, 0x8 },
+ {{{ 0x5, 0x40, 0xb3, 0xd3, 0x0 }, { 0x86, 0x80, 0xf2, 0x24, 0x0 }}, 0x2 },
+ {{{ 0xd0, 0x0, 0x11, 0xcf, 0x0 }, { 0xd1, 0x0, 0xf4, 0xe8, 0x3 }}, 0x0 },
+ {{{ 0x5, 0x4e, 0xda, 0x25, 0x2 }, { 0x1, 0x0, 0xf9, 0x15, 0x0 }}, 0xa },
+ {{{ 0x3, 0x0, 0x8f, 0x7, 0x2 }, { 0x2, 0x0, 0xff, 0x6, 0x0 }}, 0x0 },
+ {{{ 0x13, 0x0, 0x8f, 0x7, 0x2 }, { 0x2, 0x0, 0xf9, 0x5, 0x0 }}, 0x0 },
+ {{{ 0xf0, 0x1, 0x97, 0x17, 0x0 }, { 0x21, 0xd, 0xf1, 0x18, 0x0 }}, 0x8 },
+ {{{ 0xf1, 0x41, 0x11, 0x11, 0x0 }, { 0xf1, 0x41, 0x11, 0x11, 0x0 }}, 0x2 },
+ {{{ 0x13, 0x0, 0x8f, 0x7, 0x2 }, { 0x2, 0x0, 0xff, 0x6, 0x0 }}, 0x0 },
+ {{{ 0x1, 0x0, 0x2f, 0x1, 0x0 }, { 0x1, 0x0, 0xaf, 0x1, 0x3 }}, 0xf },
+ {{{ 0x1, 0x6, 0xf3, 0xff, 0x0 }, { 0x8, 0x0, 0xf7, 0xff, 0x0 }}, 0x4 },
+ {{{ 0xc0, 0x4f, 0xf1, 0x3, 0x0 }, { 0xbe, 0xc, 0x10, 0x1, 0x0 }}, 0x2 },
+ {{{ 0x0, 0x2, 0xf0, 0xff, 0x0 }, { 0x11, 0x80, 0xf0, 0xff, 0x0 }}, 0x6 },
+ {{{ 0x81, 0x47, 0xf1, 0x83, 0x0 }, { 0xa2, 0x4, 0x91, 0x86, 0x0 }}, 0x6 },
+ {{{ 0xf0, 0xc0, 0xff, 0xff, 0x3 }, { 0xe5, 0x0, 0xfb, 0xf0, 0x0 }}, 0xe },
+ {{{ 0x0, 0x2, 0xf0, 0xff, 0x0 }, { 0x11, 0x80, 0xf0, 0xff, 0x0 }}, 0x6 }
+};
+
+static const PercussionNote percussionNotes[47] = {
+ {{{ 0x0, 0xb, 0xa8, 0x38, 0x0 }, { 0x0, 0x0, 0xd6, 0x49, 0x0 }}, 0x0, 0x4, 0x1, 0x97, 0x4 },
+ {{{ 0xc0, 0xc0, 0xf8, 0x3f, 0x2 }, { 0xc0, 0x0, 0xf6, 0x8e, 0x0 }}, 0x0, 0x4, 0x1, 0xf7, 0x4 },
+ {{{ 0xc0, 0x80, 0xc9, 0xab, 0x0 }, { 0xeb, 0x40, 0xb5, 0xf6, 0x0 }}, 0x1, 0x3, 0x1, 0x6a, 0x6 },
+ {{{ 0xc, 0x0, 0xd8, 0xa6, 0x0 }, { 0x0, 0x0, 0xd6, 0x4f, 0x0 }}, 0x1, 0x3, 0x1, 0x6c, 0x5 },
+ {{{ 0x1, 0x0, 0xe2, 0xd2, 0x0 }, { 0x3, 0x41, 0x8f, 0x48, 0x49 }}, 0xc, 0x4, 0x1, 0x2f, 0x5 },
+ {{{ 0x0, 0x0, 0xc8, 0x58, 0x3 }, { 0x0, 0x0, 0xf6, 0x4f, 0x0 }}, 0x9, 0x3, 0x1, 0x108, 0x4 },
+ {{{ 0x1, 0x0, 0xff, 0x5, 0x0 }, { 0xf2, 0xff, 0xe0, 0x50, 0x52 }}, 0x5d, 0x2, 0x1, 0x9f, 0x5 },
+ {{{ 0xe, 0x9, 0xb9, 0x47, 0x0 }, { 0xeb, 0x40, 0xf5, 0xe6, 0x0 }}, 0x0, 0x0, 0x1, 0x82, 0x6 },
+ {{{ 0x0, 0x0, 0xd6, 0x83, 0x0 }, { 0xd6, 0xd7, 0xe0, 0x41, 0x5e }}, 0x4a, 0x2, 0x1, 0xc7, 0x5 },
+ {{{ 0x1, 0x9, 0x89, 0x67, 0x0 }, { 0xd6, 0xd7, 0xe0, 0x41, 0x5e }}, 0x4a, 0x0, 0x1, 0x80, 0x6 },
+ {{{ 0x1, 0x0, 0xd6, 0x96, 0x0 }, { 0xd6, 0xd7, 0xe0, 0x41, 0x5e }}, 0x4a, 0x2, 0x1, 0xed, 0x5 },
+ {{{ 0x0, 0x9, 0xa9, 0x55, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x1, 0x82, 0x6 },
+ {{{ 0x2, 0x0, 0xc6, 0x96, 0x0 }, { 0xe0, 0x0, 0xe0, 0x40, 0x0 }}, 0x1, 0x2, 0x1, 0x123, 0x5 },
+ {{{ 0x5, 0x0, 0xf6, 0x56, 0x0 }, { 0xf7, 0xff, 0xb3, 0x90, 0x4f }}, 0x1, 0x2, 0x1, 0x15b, 0x5 },
+ {{{ 0x1, 0x0, 0xf7, 0x14, 0x0 }, { 0xf7, 0xff, 0x36, 0x90, 0x79 }}, 0xe7, 0x1, 0x1, 0x1ac, 0x5 },
+ {{{ 0x0, 0x0, 0xf6, 0x56, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x1, 0x2, 0x1, 0x18b, 0x5 },
+ {{{ 0x0, 0x83, 0xfb, 0x5, 0x0 }, { 0xf7, 0x41, 0x39, 0x90, 0x79 }}, 0x1, 0x1, 0x1, 0xc8, 0x5 },
+ {{{ 0x0, 0x0, 0xff, 0x5, 0x0 }, { 0xf7, 0xff, 0x36, 0x90, 0x79 }}, 0xe7, 0x1, 0x1, 0xf9, 0x5 },
+ {{{ 0x1, 0x0, 0xa0, 0x5, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x2, 0x1, 0x27a, 0x6 },
+ {{{ 0x0, 0x5, 0xf3, 0x6, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x2, 0x1, 0x108, 0x7 },
+ {{{ 0x1, 0x0, 0xf9, 0x34, 0x0 }, { 0xf7, 0xff, 0x36, 0x90, 0x79 }}, 0xe7, 0x1, 0x1, 0x147, 0x4 },
+ {{{ 0x0, 0x0, 0xf7, 0x16, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x2, 0x1, 0x120, 0x6 },
+ {{{ 0x1, 0x0, 0xff, 0x5, 0x0 }, { 0xf7, 0xff, 0x36, 0x90, 0x79 }}, 0xe7, 0x1, 0x1, 0x42, 0x6 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x1, 0x0, 0xff, 0x5, 0x0 }, { 0xf7, 0xff, 0x36, 0x90, 0x79 }}, 0xe7, 0x1, 0x1, 0x6d, 0x5 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 },
+ {{{ 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 }}, 0x0, 0x0, 0x0, 0x3fc, 0x4 }
+};
+
+const uint16 melodicFrequencies[36] = {
+ 0x55, 0x5a, 0x60, 0x66, 0x6c, 0x72, 0x79, 0x80, 0x88,
+ 0x90, 0x99, 0xa1, 0xab, 0xb5, 0xc0, 0xcc, 0xd8, 0xe5,
+ 0xf2, 0x101, 0x110, 0x120, 0x132, 0x143, 0x156, 0x16b, 0x181,
+ 0x198, 0x1b0, 0x1ca, 0x1e5, 0x202, 0x220, 0x241, 0x263, 0x286
+};
+
+class AdLibDriver;
+
+class AdLibChannel : public MidiChannel_MPU401 {
+public:
+ void reset();
+
+ uint8 _program;
+ uint8 _volume;
+ uint8 _pedal;
+};
+
+struct MelodicVoice {
+ bool _used;
+ uint8 _channel;
+ uint8 _program;
+
+ uint8 _key;
+ uint32 _timestamp;
+ uint16 _frequency;
+ int8 _octave;
+};
+
+class AdLibDriver : public MidiDriver_Emulated {
+public:
+ AdLibDriver(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) {
+ for (uint i = 0; i < 16; ++i)
+ _channels[i].init(this, i);
+ }
+
+ int open();
+ void close();
+ void send(uint32 b);
+ MidiChannel *allocateChannel();
+ MidiChannel *getPercussionChannel() { return &_channels[9]; }
+
+ bool isStereo() const { return false; }
+ int getRate() const { return _mixer->getOutputRate(); }
+
+ void generateSamples(int16 *buf, int len);
+
+protected:
+ OPL::OPL *_opl;
+ AdLibChannel _channels[16];
+ MelodicVoice _voices[kNumMelodic];
+ uint8 _notesPerPercussion[kNumPercussion];
+
+ uint _lastVoice;
+
+ uint8 _percussionMask;
+
+ void noteOff(uint8 channel, uint8 note);
+ void noteOn(uint8 channel, uint8 note, uint8 velocity);
+ void allNotesOff();
+ void setModulationWheel(uint8 channel, uint8 value);
+ void setFootController(uint8 channel, uint8 value);
+ void setVolume(uint8 channel, uint8 value);
+ void setPitchBend(uint8 channel, int16 value);
+
+ void playNote(uint8 voice, uint8 octave, uint16 frequency);
+
+ void programOperatorSimple(uint8 offset, const OPLOperator &op);
+ void programOperator(uint8 offset, const OPLOperator &op);
+ void setOperatorLevel(uint8 offset, const OPLOperator &op, uint8 velocity, uint8 channel, bool forceVolume);
+
+ void setupPercussion(const PercussionNote &note);
+ void playPercussion(uint8 channel, const PercussionNote &note, uint8 velocity);
+
+ void programMelodicVoice(uint8 voice, uint8 program);
+ void playMelodicNote(uint8 voice, uint8 channel, uint8 note, uint8 velocity);
+ void muteMelodicVoice(uint8 voice);
+
+ void initVoices();
+};
+
+MidiDriver *createAdLibDriver() {
+ return new AdLibDriver(g_system->getMixer());
+}
+
+void AdLibChannel::reset() {
+ _program = 0;
+ _volume = 127;
+ _pedal = 0;
+}
+
+/*
+ bit 7 - Clear: AM depth is 1 dB
+ bit 6 - Clear: Vibrato depth is 7 cent
+ bit 5 - Set: Rhythm enabled (6 melodic voices)
+ bit 4 - Bass drum off
+ bit 3 - Snare drum off
+ bit 2 - Tom tom off
+ bit 1 - Cymbal off
+ bit 0 - Hi Hat off
+*/
+const uint8 kDefaultPercussionMask = 0x20;
+
+int AdLibDriver::open() {
+ if (_isOpen)
+ return MERR_ALREADY_OPEN;
+
+ MidiDriver_Emulated::open();
+
+ _opl = OPL::Config::create();
+ _opl->init(getRate());
+ _opl->writeReg(0x1, 0x20); // set bit 5 (enable all waveforms)
+
+ // Reset the OPL registers.
+ for (uint i = 0; i < kNumVoices; ++i) {
+ _opl->writeReg(0xA0 + i, 0); // frequency
+ _opl->writeReg(0xB0 + i, 0); // key on
+ _opl->writeReg(0xC0 + i, 0); // feedback
+ }
+ _opl->writeReg(0xBD, kDefaultPercussionMask);
+
+ initVoices();
+
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ return 0;
+}
+
+void AdLibDriver::close() {
+ if (!_isOpen)
+ return;
+
+ _isOpen = false;
+ _mixer->stopHandle(_mixerSoundHandle);
+
+ delete _opl;
+}
+
+void AdLibDriver::send(uint32 b) {
+ uint channel = b & 0xf;
+ uint cmd = (b >> 4) & 0xf;
+ uint param1 = (b >> 8) & 0xff;
+ uint param2 = (b >> 16) & 0xff;
+
+ switch (cmd) {
+ case 8:
+ noteOff(channel, param1);
+ break;
+ case 9:
+ // TODO: map volume?
+ noteOn(channel, param1, param2);
+ break;
+ case 11:
+ // controller change
+ switch (param1) {
+ case 1:
+ setModulationWheel(channel, param2);
+ break;
+ case 4:
+ setFootController(channel, param2);
+ break;
+ case 7:
+ setVolume(channel, param2);
+ break;
+ case 123:
+ // all notes off
+ allNotesOff();
+ break;
+ }
+ break;
+ case 12:
+ // program change
+ _channels[channel]._program = param1;
+ break;
+ case 14:
+ setPitchBend(channel, (param1 | (param2 << 7)) - 0x2000);
+ break;
+ }
+}
+
+void AdLibDriver::noteOff(uint8 channel, uint8 note) {
+ if (channel == 9) {
+ if (note < 35 || note > 81)
+ return;
+
+ _percussionMask &= ~(1 << percussionNotes[note - 35].percussion);
+ _opl->writeReg(0xBD, _percussionMask);
+ return;
+ }
+
+ for (int i = kNumMelodic - 1; i >= 0; --i) {
+ if (_voices[i]._channel != channel)
+ continue;
+ if (_voices[i]._key != note)
+ continue;
+ muteMelodicVoice(i);
+ _voices[i]._used = false;
+ return;
+ }
+
+ //debug(1, "failed to find voice off for channel %d, note %d", channel, note);
+}
+
+void AdLibDriver::noteOn(uint8 channel, uint8 note, uint8 velocity) {
+ if (channel == 9) {
+ if (note < 35 || note > 81)
+ return;
+
+ const PercussionNote &info = percussionNotes[note - 35];
+ if (!info.valid)
+ return;
+
+ if (note != _notesPerPercussion[info.percussion]) {
+ setupPercussion(info);
+ _notesPerPercussion[info.percussion] = note;
+ }
+
+ playPercussion(channel, info, velocity);
+ return;
+ }
+
+ if (velocity == 0) {
+ noteOff(channel, note);
+ return;
+ }
+
+ // We want to play a note on a melodic (voice) channel.
+
+ // First, look for a voice playing the same note with the same program.
+ for (uint i = 0; i < kNumMelodic; ++i) {
+ if (_voices[i]._channel != channel || _voices[i]._key != note)
+ continue;
+ if (_voices[i]._program != _channels[channel]._program)
+ continue;
+ muteMelodicVoice(i);
+ playMelodicNote(i, channel, note, velocity);
+ return;
+ }
+
+ // The loops below try to start at _lastVoice and find a voice to use.
+ // They ignore _lastVoice itself, and update _lastVoice if they succeed.
+
+ // Then, try finding a melodic voice with the same program.
+ for (uint i = (_lastVoice + 1) % kNumMelodic; i != _lastVoice; i = (i + 1) % kNumMelodic) {
+ if (_voices[i]._used)
+ continue;
+ if (_voices[i]._program != _channels[channel]._program)
+ continue;
+ playMelodicNote(i, channel, note, velocity);
+ _lastVoice = i;
+ return;
+ }
+
+ // Then, try finding a free melodic voice of any kind.
+ for (uint i = (_lastVoice + 1) % kNumMelodic; i != _lastVoice; i = (i + 1) % kNumMelodic) {
+ if (_voices[i]._used)
+ continue;
+ programMelodicVoice(i, _channels[channel]._program);
+ playMelodicNote(i, channel, note, velocity);
+ _lastVoice = i;
+ return;
+ }
+
+ // Then just try finding a melodic voice with the same program,
+ // and steal it.
+ for (uint i = (_lastVoice + 1) % kNumMelodic; i != _lastVoice; i = (i + 1) % kNumMelodic) {
+ if (_voices[i]._program != _channels[channel]._program)
+ continue;
+ muteMelodicVoice(i);
+ playMelodicNote(i, channel, note, velocity);
+ _lastVoice = i;
+ return;
+ }
+
+ // Finally, just take control of the channel used least recently.
+ uint voiceId = 0;
+ uint32 bestTimestamp = 0xffffffff;
+ for (uint i = 0; i < kNumMelodic; ++i)
+ if (bestTimestamp > _voices[i]._timestamp) {
+ voiceId = i;
+ bestTimestamp = _voices[i]._timestamp;
+ }
+
+ //debug(1, "ran out of voices for channel %d, note %d, program %d: reused voice %d", channel, note, _channels[channel]._program, voiceId);
+ programMelodicVoice(voiceId, _channels[channel]._program);
+ playMelodicNote(voiceId, channel, note, velocity);
+ _lastVoice = voiceId;
+}
+
+// TODO: this doesn't match original
+void AdLibDriver::allNotesOff() {
+ for (uint i = 0; i < kNumMelodic; ++i) {
+ muteMelodicVoice(i);
+ _voices[i]._used = false;
+ }
+
+ _percussionMask = kDefaultPercussionMask;
+ _opl->writeReg(0xBD, kDefaultPercussionMask);
+}
+
+void AdLibDriver::setModulationWheel(uint8 channel, uint8 value) {
+ if (value >= 64)
+ _percussionMask |= 0x80;
+ else
+ _percussionMask &= 0x7f;
+
+ _opl->writeReg(0xBD, _percussionMask);
+}
+
+void AdLibDriver::setFootController(uint8 channel, uint8 value) {
+ _channels[channel]._pedal = (value >= 64);
+}
+
+void AdLibDriver::setVolume(uint8 channel, uint8 value) {
+ _channels[channel]._volume = value;
+}
+
+void AdLibDriver::setPitchBend(uint8 channel, int16 value) {
+ for (uint i = 0; i < kNumMelodic; ++i) {
+ if (_voices[i]._channel != channel || !_voices[i]._used)
+ continue;
+
+ // index into frequency table
+ uint f = 12 + (_voices[i]._key % 12);
+
+ int16 bendAmount = value;
+ if (bendAmount > 0) {
+ // bend up two semitones
+ bendAmount *= (melodicFrequencies[f + 2] - melodicFrequencies[f]);
+ } else {
+ // bend down two semitones
+ bendAmount *= (melodicFrequencies[f] - melodicFrequencies[f - 2]);
+ }
+ bendAmount /= 0x2000;
+ bendAmount += melodicFrequencies[f]; // add the base frequency
+ playNote(i, _voices[i]._octave, bendAmount);
+ _voices[i]._timestamp = g_system->getMillis();
+ }
+}
+
+void AdLibDriver::playNote(uint8 voice, uint8 octave, uint16 frequency) {
+ /* Percussions are always fed keyOn = 0 even to set the note, as they are activated using the
+ BD register instead. I wonder if they can just be fed the same value as melodic voice and
+ be done with it. */
+ uint8 keyOn = (voice < kNumMelodic) ? 0x20 : 0;
+
+ // key on, octave, high 2 bits of frequency
+ _opl->writeReg(0xB0 + voice, keyOn | ((octave & 7) << 2) | ((frequency >> 8) & 3));
+ // low 8 bits of frequency
+ _opl->writeReg(0xA0 + voice, frequency & 0xff);
+}
+
+void AdLibDriver::programOperatorSimple(uint8 offset, const OPLOperator &op) {
+ _opl->writeReg(0x40 + offset, op.levels & LEVEL_MASK);
+ _opl->writeReg(0x60 + offset, op.attackDecay);
+ _opl->writeReg(0x80 + offset, op.sustainRelease);
+}
+
+void AdLibDriver::programOperator(uint8 offset, const OPLOperator &op) {
+ _opl->writeReg(0x20 + offset, op.characteristic);
+ _opl->writeReg(0x60 + offset, op.attackDecay);
+ _opl->writeReg(0x80 + offset, op.sustainRelease);
+ _opl->writeReg(0xE0 + offset, op.waveform);
+ _opl->writeReg(0x40 + offset, op.levels);
+}
+
+const uint16 adlibLogVolume[] = {
+ 0, 37, 58, 73, 85, 95, 103, 110, 116, 121, 127, 131, 135, 139, 143, 146,
+ 149, 153, 155, 158, 161, 163, 165, 168, 170, 172, 174, 176, 178, 179, 181, 183,
+ 184, 186, 188, 189, 191, 192, 193, 195, 196, 197, 198, 200, 201, 202, 203, 204,
+ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 219,
+ 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231,
+ 232, 233, 233, 234, 234, 235, 236, 236, 237, 237, 238, 239, 239, 240, 240, 241,
+ 241, 242, 242, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 248, 249,
+ 249, 250, 250, 251, 251, 252, 252, 253, 253, 253, 254, 254, 255, 255, 256, 256,
+ 256
+};
+
+void AdLibDriver::setOperatorLevel(uint8 offset, const OPLOperator &op, uint8 velocity, uint8 channel, bool forceVolume) {
+ uint8 programLevel = LEVEL_MASK;
+ if (!forceVolume)
+ programLevel -= (op.levels & LEVEL_MASK);
+
+ uint32 noteLevel = adlibLogVolume[velocity];
+ uint32 channelLevel = adlibLogVolume[_channels[channel]._volume];
+ // programLevel comes from the static data and is probably already in the correct logarithmic scale
+ uint32 finalLevel = LEVEL_MASK - ((noteLevel * channelLevel * programLevel) >> 16);
+
+ // high 2 bits are scaling level, the rest is (inversed) volume
+ _opl->writeReg(0x40 + offset, (op.levels & 0xc0) | (finalLevel & 0x3f));
+}
+
+const uint8 operatorOffsetsForPercussion[] = {
+ 0x11, // hi-hat
+ 0x15, // cymbal
+ 0x12, // tom tom
+ 0x14 // snare drum
+};
+
+void AdLibDriver::setupPercussion(const PercussionNote &note) {
+ if (note.percussion < 4) {
+ // simple percussion (1 operator)
+
+ // turn off relevant percussion
+ _percussionMask &= ~(1 << note.percussion);
+ _opl->writeReg(0xBD, _percussionMask);
+
+ programOperatorSimple(operatorOffsetsForPercussion[note.percussion], note.op[0]);
+ return;
+ }
+
+ // bass drum (2 operators)
+
+ // turn off bass drum
+ _percussionMask &= ~(0x10);
+ _opl->writeReg(0xBD, _percussionMask);
+
+ programOperator(0x10, note.op[0]);
+ programOperator(0x13, note.op[1]);
+
+ _opl->writeReg(0xC0 + 6, note.feedbackAlgo);
+}
+
+void AdLibDriver::playPercussion(uint8 channel, const PercussionNote &note, uint8 velocity) {
+ if (note.percussion < 4) {
+ // simple percussion (1 operator)
+
+ // turn off relevant percussion
+ _percussionMask &= ~(1 << note.percussion);
+ _opl->writeReg(0xBD, _percussionMask);
+
+ setOperatorLevel(operatorOffsetsForPercussion[note.percussion], note.op[0], velocity, channel, true);
+
+ if (note.percussion == 2) {
+ // tom tom
+ playNote(8, note.octave, note.frequency);
+ } else if (note.percussion == 3) {
+ // snare drum
+ playNote(7, note.octave, note.frequency);
+ }
+
+ // turn on relevant percussion
+ _percussionMask |= (1 << note.percussion);
+ _opl->writeReg(0xBD, _percussionMask);
+ return;
+ }
+
+ // turn off bass drum
+ _percussionMask &= ~(0x10);
+ _opl->writeReg(0xBD, _percussionMask);
+
+ if (note.feedbackAlgo & 1) {
+ // operators 1 and 2 in additive synthesis
+ setOperatorLevel(0x10, note.op[0], velocity, channel, true);
+ setOperatorLevel(0x13, note.op[1], velocity, channel, true);
+ } else {
+ // operator 2 is modulating operator 1
+ setOperatorLevel(0x13, note.op[1], velocity, channel, true);
+ }
+
+ playNote(6, note.octave, note.frequency);
+
+ // turn on bass drum
+ _percussionMask |= 0x10;
+ _opl->writeReg(0xBD, _percussionMask);
+}
+
+const uint8 offset1ForMelodic[kNumVoices] = { 0x0, 0x1, 0x2, 0x8, 0x9, 0xa, 0x10, 0x11, 0x12 };
+const uint8 offset2ForMelodic[kNumVoices] = { 0x3, 0x4, 0x5, 0xb, 0xc, 0xd, 0x13, 0x14, 0x15 };
+
+void AdLibDriver::programMelodicVoice(uint8 voice, uint8 program) {
+ assert(program < 128);
+ assert(voice < kNumMelodic);
+
+ const MelodicProgram &info = melodicPrograms[program];
+ uint8 offset1 = offset1ForMelodic[voice];
+ uint8 offset2 = offset2ForMelodic[voice];
+
+ // Start at lowest volume.
+ _opl->writeReg(0x40 + offset1, LEVEL_MASK);
+ _opl->writeReg(0x40 + offset2, LEVEL_MASK);
+
+ muteMelodicVoice(voice);
+
+ programOperator(offset1, info.op[0]);
+ programOperator(offset2, info.op[1]);
+
+ _opl->writeReg(0xC0 + voice, info.feedbackAlgo);
+}
+
+void AdLibDriver::playMelodicNote(uint8 voice, uint8 channel, uint8 note, uint8 velocity) {
+ assert(voice < kNumMelodic);
+
+ uint8 octave = note / 12;
+ uint8 f = 12 + (note % 12);
+
+ if (octave > 7)
+ octave = 7;
+
+ const MelodicProgram &info = melodicPrograms[_channels[channel]._program];
+ uint8 offset1 = offset1ForMelodic[voice];
+ uint8 offset2 = offset2ForMelodic[voice];
+
+ if (info.feedbackAlgo & 1) {
+ setOperatorLevel(offset1, info.op[0], velocity, channel, false);
+ setOperatorLevel(offset2, info.op[1], velocity, channel, false);
+ } else {
+ setOperatorLevel(offset2, info.op[1], velocity, channel, true);
+ }
+
+ playNote(voice, octave, melodicFrequencies[f]);
+
+ _voices[voice]._program = _channels[channel]._program;
+ _voices[voice]._key = note;
+ _voices[voice]._channel = channel;
+ _voices[voice]._timestamp = g_system->getMillis();
+ _voices[voice]._frequency = melodicFrequencies[f];
+ _voices[voice]._octave = octave;
+ _voices[voice]._used = true;
+}
+
+void AdLibDriver::muteMelodicVoice(uint8 voice) {
+ _opl->writeReg(0xB0 + voice, 0 | ((_voices[voice]._octave & 7) << 2) | ((_voices[voice]._frequency >> 8) & 3));
+}
+
+MidiChannel *AdLibDriver::allocateChannel() {
+ for (uint i = 0; i < 16; ++i) {
+ if (i == 9)
+ continue;
+
+ if (_channels[i].allocate())
+ return &_channels[i];
+ }
+
+ return NULL;
+}
+
+void AdLibDriver::generateSamples(int16 *buf, int len) {
+ memset(buf, 0, sizeof(int16) * len);
+ _opl->readBuffer(buf, len);
+}
+
+void AdLibDriver::initVoices() {
+ _percussionMask = kDefaultPercussionMask;
+ _opl->writeReg(0xBD, _percussionMask);
+
+ for (uint i = 0; i < 16; ++i)
+ _channels[i].reset();
+
+ for (uint i = 0; i < kNumMelodic; ++i) {
+ _voices[i]._key = 0xff;
+ _voices[i]._program = 0xff;
+ _voices[i]._channel = 0xff;
+ _voices[i]._timestamp = 0;
+ _voices[i]._frequency = 0;
+ _voices[i]._octave = 0;
+ _voices[i]._used = false;
+ }
+
+ for (uint i = 0; i < kNumPercussion; ++i)
+ _notesPerPercussion[i] = 0xff;
+
+ _lastVoice = 0;
+}
+
+} // namespace Parallaction
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 64885c7ff3..c1720a1a8e 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -275,7 +275,7 @@ void Parallaction_ns::_c_contaFoglie(void *parm) {
if (num_foglie != 6)
return;
- _globalFlags |= 0x1000;
+ g_globalFlags |= 0x1000;
return;
}
@@ -286,7 +286,7 @@ void Parallaction_ns::_c_zeroFoglie(void *parm) {
}
void Parallaction_ns::_c_trasformata(void *parm) {
- _engineFlags ^= kEngineTransformedDonna;
+ g_engineFlags ^= kEngineTransformedDonna;
// No need to invoke changeCharacter here, as
// transformation happens on a location switch
// and character change is automatically triggered.
@@ -295,11 +295,11 @@ void Parallaction_ns::_c_trasformata(void *parm) {
void Parallaction_ns::_c_offMouse(void *parm) {
_input->setMouseState(MOUSE_DISABLED);
- _engineFlags |= kEngineBlockInput;
+ g_engineFlags |= kEngineBlockInput;
}
void Parallaction_ns::_c_onMouse(void *parm) {
- _engineFlags &= ~kEngineBlockInput;
+ g_engineFlags &= ~kEngineBlockInput;
_input->setMouseState(MOUSE_ENABLED_SHOW);
}
@@ -389,7 +389,7 @@ void Parallaction_ns::_c_finito(void *parm) {
}
void Parallaction_ns::_c_ridux(void *parm) {
- changeCharacter(_minidinoName);
+ changeCharacter(g_minidinoName);
return;
}
@@ -444,7 +444,7 @@ void Parallaction_ns::_c_startIntro(void *parm) {
_soundManI->playMusic();
}
- _engineFlags |= kEngineBlockInput;
+ g_engineFlags |= kEngineBlockInput;
_input->setMouseState(MOUSE_DISABLED);
_intro = true;
}
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index 0cb329e0f0..25acac9b06 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -103,7 +103,7 @@ bool Debugger::Cmd_Locations(int argc, const char **argv) {
bool Debugger::Cmd_GlobalFlags(int argc, const char **argv) {
- uint32 flags = _globalFlags;
+ uint32 flags = g_globalFlags;
DebugPrintf("+------------------------------+---------+\n"
"| flag name | value |\n"
@@ -128,10 +128,10 @@ bool Debugger::Cmd_ToggleGlobalFlag(int argc, const char **argv) {
DebugPrintf("invalid flag '%s'\n", argv[1]);
} else {
i--;
- if ((_globalFlags & (1 << i)) == 0)
- _globalFlags |= (1 << i);
+ if ((g_globalFlags & (1 << i)) == 0)
+ g_globalFlags |= (1 << i);
else
- _globalFlags &= ~(1 << i);
+ g_globalFlags &= ~(1 << i);
}
break;
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index e0bd6a6677..78cc23311f 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -192,7 +192,7 @@ void DialogueManager::transitionToState(DialogueState newState) {
bool DialogueManager::testAnswerFlags(Answer *a) {
uint32 flags = _vm->getLocationFlags();
if (a->_yesFlags & kFlagsGlobal)
- flags = _globalFlags | kFlagsGlobal;
+ flags = g_globalFlags | kFlagsGlobal;
return ((a->_yesFlags & flags) == a->_yesFlags) && ((a->_noFlags & ~flags) == a->_noFlags);
}
@@ -370,9 +370,9 @@ protected:
bool _askPassword;
bool checkPassword() {
- return ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && _vm->_password.hasPrefix("1732461")) ||
- (!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && _vm->_password.hasPrefix("1622")) ||
- (!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && _vm->_password.hasPrefix("179")));
+ return ((!scumm_stricmp(_vm->_char.getBaseName(), g_doughName) && _vm->_password.hasPrefix("1732461")) ||
+ (!scumm_stricmp(_vm->_char.getBaseName(), g_donnaName) && _vm->_password.hasPrefix("1622")) ||
+ (!scumm_stricmp(_vm->_char.getBaseName(), g_dinoName) && _vm->_password.hasPrefix("179")));
}
void resetPassword() {
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 5e39c893db..8988897456 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -31,7 +31,7 @@
namespace Parallaction {
-extern byte _braAmigaFramesDefaultPalette[];
+extern byte braAmigaFramesDefaultPalette[];
struct Sprite {
uint16 size;
@@ -475,7 +475,7 @@ void AmigaDisk_br::loadBackground(BackgroundInfo& info, const char *filename) {
}
delete stream;
} else {
- p = _braAmigaFramesDefaultPalette;
+ p = braAmigaFramesDefaultPalette;
for (i = 0; i < 16; i++) {
r = *p >> 2;
p++;
@@ -617,7 +617,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) {
}
}
- delete []shadow;
+ delete[] shadow;
delete stream;
}
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index b2285d0da3..bad854525d 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -62,7 +62,7 @@ class NSArchive : public Common::Archive {
Common::SeekableReadStream *_stream;
char _archiveDir[MAX_ARCHIVE_ENTRIES][32];
- uint32 _archiveLenghts[MAX_ARCHIVE_ENTRIES];
+ uint32 _archiveLengths[MAX_ARCHIVE_ENTRIES];
uint32 _archiveOffsets[MAX_ARCHIVE_ENTRIES];
uint32 _numFiles;
@@ -103,8 +103,8 @@ NSArchive::NSArchive(Common::SeekableReadStream *stream, Common::Platform platfo
uint32 dataOffset = (isSmallArchive) ? SMALL_ARCHIVE_DATA_OFS : NORMAL_ARCHIVE_DATA_OFS;
for (uint16 i = 0; i < _numFiles; i++) {
_archiveOffsets[i] = dataOffset;
- _archiveLenghts[i] = _stream->readUint32BE();
- dataOffset += _archiveLenghts[i];
+ _archiveLengths[i] = _stream->readUint32BE();
+ dataOffset += _archiveLengths[i];
}
}
@@ -133,7 +133,7 @@ Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::S
debugC(9, kDebugDisk, "NSArchive::createReadStreamForMember: '%s' found in slot %i", name.c_str(), index);
int offset = _archiveOffsets[index];
- int endOffset = _archiveOffsets[index] + _archiveLenghts[index];
+ int endOffset = _archiveOffsets[index] + _archiveLengths[index];
return new Common::SeekableSubReadStream(_stream, offset, endOffset, DisposeAfterUse::NO);
}
@@ -262,8 +262,15 @@ Common::SeekableReadStream *DosDisk_ns::tryOpenFile(const char* name) {
Script* Disk_ns::loadLocation(const char *name) {
char path[PATH_LEN];
+ const char *charName = _vm->_char.getBaseName();
- sprintf(path, "%s%s/%s.loc", _vm->_char.getBaseName(), _language.c_str(), name);
+ // WORKAROUND: Special case for the Multilingual DOS version: during the ending
+ // sequence, it tries to load a non-existing file using "Dinor" as a character
+ // name. In this case, the character name should be just "dino".
+ if (!strcmp(charName, "Dinor"))
+ charName = "dino";
+
+ sprintf(path, "%s%s/%s.loc", charName, _language.c_str(), name);
debugC(3, kDebugDisk, "Disk_ns::loadLocation(%s): trying '%s'", name, path);
Common::SeekableReadStream *stream = tryOpenFile(path);
@@ -328,7 +335,7 @@ GfxObj* DosDisk_ns::loadTalk(const char *name) {
}
char v20[30];
- if (_engineFlags & kEngineTransformedDonna) {
+ if (g_engineFlags & kEngineTransformedDonna) {
sprintf(v20, "%stta.cnv", name);
} else {
sprintf(v20, "%stal.cnv", name);
@@ -832,7 +839,7 @@ void AmigaDisk_ns::decodeCnv(byte *data, uint16 numFrames, uint16 width, uint16
assert(buf);
stream->read(buf, rawsize);
unpackBitmap(data, buf, numFrames, bytesPerPlane, height);
- delete []buf;
+ delete[] buf;
}
#undef NUM_PLANES
diff --git a/engines/parallaction/exec.cpp b/engines/parallaction/exec.cpp
index 8594d02641..122abf9e0e 100644
--- a/engines/parallaction/exec.cpp
+++ b/engines/parallaction/exec.cpp
@@ -56,7 +56,7 @@ void ProgramExec::runScript(ProgramPtr script, AnimationPtr a) {
}
void ProgramExec::runScripts(ProgramList::iterator first, ProgramList::iterator last) {
- if (_engineFlags & kEnginePauseJobs) {
+ if (g_engineFlags & kEnginePauseJobs) {
return;
}
@@ -110,7 +110,7 @@ void CommandExec::runList(CommandList::iterator first, CommandList::iterator las
}
if (cmd->_flagsOn & kFlagsGlobal) {
- useFlags = _globalFlags | kFlagsGlobal;
+ useFlags = g_globalFlags | kFlagsGlobal;
useLocalFlags = false;
} else {
useFlags = _vm->getLocationFlags();
@@ -182,7 +182,7 @@ void CommandExec::suspend() {
}
void CommandExec::runSuspended() {
- if (_engineFlags & kEngineWalking) {
+ if (g_engineFlags & kEngineWalking) {
return;
}
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 658ef5af82..985ea29311 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -307,7 +307,7 @@ DECLARE_COMMAND_OPCODE(testsfx) {
DECLARE_COMMAND_OPCODE(ret) {
- _engineFlags |= kEngineReturn;
+ g_engineFlags |= kEngineReturn;
}
@@ -327,7 +327,7 @@ DECLARE_INSTRUCTION_OPCODE(invalid) {
DECLARE_COMMAND_OPCODE(clear) {
if (ctxt._cmd->_flags & kFlagsGlobal) {
ctxt._cmd->_flags &= ~kFlagsGlobal;
- _globalFlags &= ~ctxt._cmd->_flags;
+ g_globalFlags &= ~ctxt._cmd->_flags;
} else {
_vm->clearLocationFlags(ctxt._cmd->_flags);
}
@@ -356,7 +356,7 @@ DECLARE_COMMAND_OPCODE(get) {
DECLARE_COMMAND_OPCODE(toggle) {
if (ctxt._cmd->_flags & kFlagsGlobal) {
ctxt._cmd->_flags &= ~kFlagsGlobal;
- _globalFlags ^= ctxt._cmd->_flags;
+ g_globalFlags ^= ctxt._cmd->_flags;
} else {
_vm->toggleLocationFlags(ctxt._cmd->_flags);
}
@@ -373,7 +373,7 @@ DECLARE_COMMAND_OPCODE(invalid) {
DECLARE_COMMAND_OPCODE(set) {
if (ctxt._cmd->_flags & kFlagsGlobal) {
ctxt._cmd->_flags &= ~kFlagsGlobal;
- _globalFlags |= ctxt._cmd->_flags;
+ g_globalFlags |= ctxt._cmd->_flags;
} else {
_vm->setLocationFlags(ctxt._cmd->_flags);
}
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index d8fbdea971..3ea4332e50 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -151,7 +151,7 @@ DECLARE_INSTRUCTION_OPCODE(call) {
DECLARE_INSTRUCTION_OPCODE(wait) {
- if (_engineFlags & kEngineWalking) {
+ if (g_engineFlags & kEngineWalking) {
ctxt._ip--;
ctxt._suspend = true;
}
@@ -198,7 +198,7 @@ DECLARE_COMMAND_OPCODE(invalid) {
DECLARE_COMMAND_OPCODE(set) {
if (ctxt._cmd->_flags & kFlagsGlobal) {
ctxt._cmd->_flags &= ~kFlagsGlobal;
- _globalFlags |= ctxt._cmd->_flags;
+ g_globalFlags |= ctxt._cmd->_flags;
} else {
_vm->setLocationFlags(ctxt._cmd->_flags);
}
@@ -208,7 +208,7 @@ DECLARE_COMMAND_OPCODE(set) {
DECLARE_COMMAND_OPCODE(clear) {
if (ctxt._cmd->_flags & kFlagsGlobal) {
ctxt._cmd->_flags &= ~kFlagsGlobal;
- _globalFlags &= ~ctxt._cmd->_flags;
+ g_globalFlags &= ~ctxt._cmd->_flags;
} else {
_vm->clearLocationFlags(ctxt._cmd->_flags);
}
@@ -267,7 +267,7 @@ DECLARE_COMMAND_OPCODE(call) {
DECLARE_COMMAND_OPCODE(toggle) {
if (ctxt._cmd->_flags & kFlagsGlobal) {
ctxt._cmd->_flags &= ~kFlagsGlobal;
- _globalFlags ^= ctxt._cmd->_flags;
+ g_globalFlags ^= ctxt._cmd->_flags;
} else {
_vm->toggleLocationFlags(ctxt._cmd->_flags);
}
diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp
index d4c9aefd32..3b40960381 100644
--- a/engines/parallaction/font.cpp
+++ b/engines/parallaction/font.cpp
@@ -29,7 +29,7 @@
namespace Parallaction {
-extern byte _amigaTopazFont[];
+extern byte amigaTopazFont[];
class BraFont : public Font {
@@ -675,7 +675,7 @@ void Parallaction_ns::initFonts() {
_introFont = _disk->loadFont("slide");
} else {
_dialogueFont = _disk->loadFont("comic");
- Common::MemoryReadStream stream(_amigaTopazFont, 2600, DisposeAfterUse::NO);
+ Common::MemoryReadStream stream(amigaTopazFont, 2600, DisposeAfterUse::NO);
_labelFont = new AmigaFont(stream);
_menuFont = _disk->loadFont("slide");
_introFont = _disk->loadFont("intro");
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index 852235ce34..a9889cc7af 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -152,22 +152,22 @@ void Gfx::freeCharacterObjects() {
freeDialogueObjects();
}
-void BackgroundInfo::loadGfxObjMask(const char *name, GfxObj *obj) {
+void BackgroundInfo::loadGfxObjMask(Parallaction *vm, const char *name, GfxObj *obj) {
debugC(1, kDebugGraphics, "BackgroundInfo::loadGfxObjMask(\"%s\")", name);
Common::Rect rect;
obj->getRect(0, rect);
- MaskBuffer *buf = _vm->_disk->loadMask(name, rect.width(), rect.height());
+ MaskBuffer *buf = vm->_disk->loadMask(name, rect.width(), rect.height());
obj->_maskId = addMaskPatch(buf);
obj->_hasMask = true;
}
-void BackgroundInfo::loadGfxObjPath(const char *name, GfxObj *obj) {
+void BackgroundInfo::loadGfxObjPath(Parallaction *vm, const char *name, GfxObj *obj) {
Common::Rect rect;
obj->getRect(0, rect);
- PathBuffer *buf = _vm->_disk->loadPath(name, rect.width(), rect.height());
+ PathBuffer *buf = vm->_disk->loadPath(name, rect.width(), rect.height());
obj->_pathId = addPathPatch(buf);
obj->_hasPath = true;
@@ -226,6 +226,11 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
rect.translate(x, y);
data = obj->getData(obj->frame);
+ // WORKAROUND: During the end credits, game scripts try to show a
+ // non-existing frame. We change it to an existing one here.
+ if (obj->frame == 14 && obj->getNum() == 9 && !strcmp(obj->getName(), "Dinor"))
+ obj->frame = 8;
+
if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
blt(rect, data, &surf, obj->layer, obj->scale, obj->transparentKey);
} else {
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 6868505c52..59cd02e6ef 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -80,11 +80,11 @@ void drawCircle(int xCenter, int yCenter, int radius, int color, void (*plotProc
Palette::Palette() {
- int gameType = _vm->getGameType();
+ int gameType = g_vm->getGameType();
if (gameType == GType_Nippon) {
_colors = 32;
- _hb = (_vm->getPlatform() == Common::kPlatformAmiga);
+ _hb = (g_vm->getPlatform() == Common::kPlatformAmiga);
} else
if (gameType == GType_BRA) {
_colors = 256;
@@ -766,7 +766,7 @@ Gfx::~Gfx() {
freeLabels();
- delete []_unpackedBitmap;
+ delete[] _unpackedBitmap;
return;
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index b43dd193b5..e9daabb194 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -144,7 +144,7 @@ public:
~Cnv() {
if (_freeData)
- delete []_data;
+ delete[] _data;
}
byte* getFramePtr(uint16 index) {
@@ -377,14 +377,14 @@ public:
void toggleMaskPatch(uint id, int x, int y, bool apply);
uint16 getMaskLayer(uint16 z) const;
void finalizeMask();
- void loadGfxObjMask(const char *name, GfxObj *obj);
+ void loadGfxObjMask(Parallaction *vm, const char *name, GfxObj *obj);
// path management
bool hasPath();
uint addPathPatch(PathBuffer *patch);
void togglePathPatch(uint id, int x, int y, bool apply);
void finalizePath();
- void loadGfxObjPath(const char *name, GfxObj *obj);
+ void loadGfxObjPath(Parallaction *vm, const char *name, GfxObj *obj);
};
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index 3794aeae29..082c37f666 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -787,7 +787,7 @@ public:
}
destroyLabels();
- _engineFlags &= ~kEngineBlockInput;
+ g_engineFlags &= ~kEngineBlockInput;
return _helper->getState("selectcharacter");
}
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 453bf9849d..4fbd9b99cc 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -188,15 +188,15 @@ int Input::updateGameInput() {
int event = kEvNone;
if (!isMouseEnabled() ||
- (_engineFlags & kEngineBlockInput) ||
- (_engineFlags & kEngineWalking) ||
- (_engineFlags & kEngineChangeLocation)) {
+ (g_engineFlags & kEngineBlockInput) ||
+ (g_engineFlags & kEngineWalking) ||
+ (g_engineFlags & kEngineChangeLocation)) {
debugC(3, kDebugInput, "updateGameInput: input flags (mouse: %i, block: %i, walking: %i, changeloc: %i)",
isMouseEnabled(),
- (_engineFlags & kEngineBlockInput) == 0,
- (_engineFlags & kEngineWalking) == 0,
- (_engineFlags & kEngineChangeLocation) == 0
+ (g_engineFlags & kEngineBlockInput) == 0,
+ (g_engineFlags & kEngineWalking) == 0,
+ (g_engineFlags & kEngineChangeLocation) == 0
);
return event;
@@ -289,7 +289,7 @@ void Input::walkTo(const Common::Point &dest) {
bool Input::translateGameInput() {
- if (_engineFlags & kEnginePauseJobs) {
+ if (g_engineFlags & kEnginePauseJobs) {
return false;
}
@@ -312,7 +312,7 @@ bool Input::translateGameInput() {
// test if mouse is hovering on an interactive zone for the currently selected inventory item
ZonePtr z = _vm->hitZone(_activeItem._id, mousePos.x, mousePos.y);
- if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) {
+ if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((g_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) {
walkTo(mousePos);
return true;
}
@@ -361,7 +361,7 @@ void Input::enterInventoryMode() {
if (hitCharacter) {
if (_activeItem._id != 0) {
_activeItem._index = (_activeItem._id >> 16) & 0xFFFF;
- _engineFlags |= kEngineDragging;
+ g_engineFlags |= kEngineDragging;
} else {
setArrowCursor();
}
@@ -384,9 +384,9 @@ void Input::exitInventoryMode() {
int pos = _vm->getHoverInventoryItem(mousePos.x, mousePos.y);
_vm->highlightInventoryItem(-1); // disable
- if ((_engineFlags & kEngineDragging)) {
+ if ((g_engineFlags & kEngineDragging)) {
- _engineFlags &= ~kEngineDragging;
+ g_engineFlags &= ~kEngineDragging;
ZonePtr z = _vm->hitZone(kZoneMerge, _activeItem._index, _vm->getInventoryItemIndex(pos));
if (z) {
diff --git a/engines/parallaction/module.mk b/engines/parallaction/module.mk
index d65653cd92..36572a51df 100644
--- a/engines/parallaction/module.mk
+++ b/engines/parallaction/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/parallaction
MODULE_OBJS := \
+ adlib.o \
balloons.o \
callables_br.o \
callables_ns.o \
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index d3529c5dd9..50556c3ec4 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -203,7 +203,7 @@ Zone::Zone() {
}
Zone::~Zone() {
- _vm->_gfx->unregisterLabel(_label);
+ g_vm->_gfx->unregisterLabel(_label);
delete _label;
}
@@ -325,7 +325,7 @@ int16 ScriptVar::getValue() {
}
if (_flags & kParaRandom) {
- return (_vm->_rnd.getRandomNumber(65536) * _value) >> 16;
+ return (g_vm->_rnd.getRandomNumber(65536) * _value) >> 16;
}
error("Parameter is not an r-value");
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 387e7af088..81761b2c6b 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -377,12 +377,12 @@ public:
int16 getValue() const {
assert(_accessor);
- return _accessor->operator()();
+ return (*_accessor)();
}
void setValue(int16 value) {
assert(_mutator);
- _mutator->operator()(value);
+ (*_mutator)(value);
}
};
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 3b1b7d54a0..e6ef53aa78 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -33,12 +33,12 @@
#include "parallaction/walk.h"
namespace Parallaction {
-Parallaction *_vm = NULL;
+Parallaction *g_vm = NULL;
// public stuff
-char _saveData1[30] = { '\0' };
-uint32 _engineFlags = 0;
-uint32 _globalFlags = 0;
+char g_saveData1[30] = { '\0' };
+uint32 g_engineFlags = 0;
+uint32 g_globalFlags = 0;
// private stuff
@@ -48,7 +48,7 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam
// Setup mixer
syncSoundSettings();
- _vm = this;
+ g_vm = this;
DebugMan.addDebugChannel(kDebugDialogue, "dialogue", "Dialogues debug level");
DebugMan.addDebugChannel(kDebugParser, "parser", "Parser debug level");
DebugMan.addDebugChannel(kDebugDisk, "disk", "Disk debug level");
@@ -87,7 +87,7 @@ Parallaction::~Parallaction() {
Common::Error Parallaction::init() {
_gameType = getGameType();
- _engineFlags = 0;
+ g_engineFlags = 0;
_objectsNames = NULL;
_globalFlagsNames = NULL;
_location._hasSound = false;
@@ -129,13 +129,9 @@ GUI::Debugger *Parallaction::getDebugger() {
return _debugger;
}
-bool canScroll() {
- return (_vm->_gfx->_backgroundInfo->width > _vm->_screenWidth);
-}
-
void Parallaction::updateView() {
- if ((_engineFlags & kEnginePauseJobs) && (_input->_inputMode != Input::kInputModeInventory)) {
+ if ((g_engineFlags & kEnginePauseJobs) && (_input->_inputMode != Input::kInputModeInventory)) {
return;
}
@@ -147,14 +143,14 @@ void Parallaction::updateView() {
void Parallaction::pauseJobs() {
debugC(9, kDebugExec, "pausing jobs execution");
- _engineFlags |= kEnginePauseJobs;
+ g_engineFlags |= kEnginePauseJobs;
return;
}
void Parallaction::resumeJobs() {
debugC(9, kDebugExec, "resuming jobs execution");
- _engineFlags &= ~kEnginePauseJobs;
+ g_engineFlags &= ~kEnginePauseJobs;
return;
}
@@ -265,7 +261,7 @@ void Parallaction::runGameFrame(int event) {
if (shouldQuit())
return;
- if (_engineFlags & kEngineChangeLocation) {
+ if (g_engineFlags & kEngineChangeLocation) {
changeLocation();
}
@@ -900,14 +896,14 @@ void CharacterName::bind(const char *name) {
if (!_dummy) {
if (!strcmp(name, "donna")) {
- _engineFlags &= ~kEngineTransformedDonna;
+ g_engineFlags &= ~kEngineTransformedDonna;
} else {
- if (_engineFlags & kEngineTransformedDonna) {
+ if (g_engineFlags & kEngineTransformedDonna) {
_suffix = _suffixTras;
} else {
const char *s = strstr(name, "tras");
if (s) {
- _engineFlags |= kEngineTransformedDonna;
+ g_engineFlags |= kEngineTransformedDonna;
_suffix = _suffixTras;
end = s;
}
@@ -953,7 +949,7 @@ void Parallaction::beep() {
void Parallaction::scheduleLocationSwitch(const char *location) {
debugC(9, kDebugExec, "scheduleLocationSwitch(%s)\n", location);
_newLocationName = location;
- _engineFlags |= kEngineChangeLocation;
+ g_engineFlags |= kEngineChangeLocation;
}
} // End of namespace Parallaction
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 0d56b62e2f..2dbb0227d6 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -104,17 +104,17 @@ struct PARALLACTIONGameDescription;
-extern uint32 _engineFlags;
-extern char _saveData1[];
-extern uint32 _globalFlags;
-extern const char *_dinoName;
-extern const char *_donnaName;
-extern const char *_doughName;
-extern const char *_drkiName;
-extern const char *_minidinoName;
-extern const char *_minidonnaName;
-extern const char *_minidoughName;
-extern const char *_minidrkiName;
+extern uint32 g_engineFlags;
+extern char g_saveData1[];
+extern uint32 g_globalFlags;
+extern const char *g_dinoName;
+extern const char *g_donnaName;
+extern const char *g_doughName;
+extern const char *g_drkiName;
+extern const char *g_minidinoName;
+extern const char *g_minidonnaName;
+extern const char *g_minidoughName;
+extern const char *g_minidrkiName;
@@ -601,7 +601,7 @@ private:
void _c_password(void *);
};
-extern Parallaction *_vm;
+extern Parallaction *g_vm;
} // End of namespace Parallaction
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 658a8e8795..07755fac5f 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -79,7 +79,7 @@ Common::Error Parallaction_br::init() {
_cmdExec = new CommandExec_br(this);
_programExec = new ProgramExec_br(this);
- _walker = new PathWalker_BR;
+ _walker = new PathWalker_BR(this);
_part = -1;
_nextPart = -1;
@@ -161,10 +161,10 @@ Common::Error Parallaction_br::go() {
// initCharacter();
- while (((_engineFlags & kEngineReturn) == 0) && (!shouldQuit())) {
+ while (((g_engineFlags & kEngineReturn) == 0) && (!shouldQuit())) {
runGame();
}
- _engineFlags &= ~kEngineReturn;
+ g_engineFlags &= ~kEngineReturn;
cleanupGame();
}
@@ -259,7 +259,7 @@ void Parallaction_br::cleanupGame() {
_countersNames = 0;
_numLocations = 0;
- _globalFlags = 0;
+ g_globalFlags = 0;
memset(_localFlags, 0, sizeof(_localFlags));
memset(_locationNames, 0, sizeof(_locationNames));
memset(_zoneFlags, 0, sizeof(_zoneFlags));
@@ -275,7 +275,7 @@ void Parallaction_br::changeLocation() {
cleanupGame();
// more cleanup needed for part changes (see also saveload)
- _globalFlags = 0;
+ g_globalFlags = 0;
cleanInventory(true);
strcpy(_characterName1, "null");
@@ -358,7 +358,7 @@ void Parallaction_br::changeLocation() {
// TODO: implement the music commands which control music execution
_soundMan->execute(SC_PLAYMUSIC);
- _engineFlags &= ~kEngineChangeLocation;
+ g_engineFlags &= ~kEngineChangeLocation;
_newLocationName.clear();
_nextPart = -1;
}
@@ -548,7 +548,7 @@ void Parallaction_br::scheduleWalk(int16 x, int16 y, bool fromUser) {
}
}
- _engineFlags |= kEngineWalking;
+ g_engineFlags |= kEngineWalking;
}
void Parallaction_br::setFollower(const Common::String &name) {
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 0b92db1f0a..d33be0aa47 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -182,7 +182,7 @@ Common::Error Parallaction_ns::init() {
_cmdExec = new CommandExec_ns(this);
_programExec = new ProgramExec_ns(this);
- _walker = new PathWalker_NS;
+ _walker = new PathWalker_NS(this);
_sarcophagusDeltaX = 0;
_movingSarcophagus = false;
@@ -310,6 +310,7 @@ void Parallaction_ns::changeBackground(const char* background, const char* mask,
_system->delayMillis(20);
_gfx->setPalette(pal);
_gfx->updateScreen();
+ return;
}
if (path == 0) {
@@ -382,8 +383,8 @@ void Parallaction_ns::changeLocation() {
changeCharacter(locname.character());
}
- strcpy(_saveData1, locname.location());
- parseLocation(_saveData1);
+ strcpy(g_saveData1, locname.location());
+ parseLocation(g_saveData1);
if (_location._startPosition.x != -1000) {
_char._ani->setX(_location._startPosition.x);
@@ -399,7 +400,7 @@ void Parallaction_ns::changeLocation() {
// BUG #1837503: kEngineChangeLocation flag must be cleared *before* commands
// and acommands are executed, so that it can be set again if needed.
- _engineFlags &= ~kEngineChangeLocation;
+ g_engineFlags &= ~kEngineChangeLocation;
_cmdExec->run(_location._commands);
@@ -412,6 +413,11 @@ void Parallaction_ns::changeLocation() {
if (!_intro) {
_input->setMouseState(oldMouseState);
+ // WORKAROUND: Fix a script bug in the Multilingual DOS version of
+ // Nippon Safes: the mouse cursor is incorrectly hidden outside the
+ // cave at the end of the game. Fix it here.
+ if (!strcmp(_location._name, "ingressocav"))
+ _input->setMouseState(MOUSE_ENABLED_SHOW);
}
debugC(1, kDebugExec, "changeLocation() done");
@@ -526,10 +532,10 @@ void Parallaction_ns::cleanupGame() {
_soundManI->stopMusic();
_inTestResult = false;
- _engineFlags &= ~kEngineTransformedDonna;
+ g_engineFlags &= ~kEngineTransformedDonna;
_numLocations = 0;
- _globalFlags = 0;
+ g_globalFlags = 0;
memset(_localFlags, 0, sizeof(_localFlags));
memset(_locationNames, 0, sizeof(_locationNames));
@@ -553,7 +559,7 @@ void Parallaction_ns::scheduleWalk(int16 x, int16 y, bool fromUser) {
}
_walker->buildPath(a, x, y);
- _engineFlags |= kEngineWalking;
+ g_engineFlags |= kEngineWalking;
}
}// namespace Parallaction
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index 0904dbf655..e7f1b1b1ed 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -767,10 +767,10 @@ void LocationParser_br::parseGetData(ZonePtr z) {
data->_gfxobj = obj;
} else
if (!scumm_stricmp(_tokens[0], "mask")) {
- _out->_info->loadGfxObjMask(_tokens[1], data->_gfxobj);
+ _out->_info->loadGfxObjMask(_vm, _tokens[1], data->_gfxobj);
} else
if (!scumm_stricmp(_tokens[0], "path")) {
- _out->_info->loadGfxObjPath(_tokens[1], data->_gfxobj);
+ _out->_info->loadGfxObjPath(_vm, _tokens[1], data->_gfxobj);
} else
if (!scumm_stricmp(_tokens[0], "icon")) {
data->_getIcon = 4 + _vm->_objectsNames->lookup(_tokens[1]);
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index f1d1db53e9..41ff74f0b4 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -246,7 +246,7 @@ DECLARE_ANIM_PARSER(file) {
char vC8[200];
strcpy(vC8, _tokens[1]);
- if (_engineFlags & kEngineTransformedDonna) {
+ if (g_engineFlags & kEngineTransformedDonna) {
if (!scumm_stricmp(_tokens[1], "donnap") || !scumm_stricmp(_tokens[1], "donnapa")) {
strcat(vC8, "tras");
}
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 3ab25f203f..2ecc5377a4 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -88,7 +88,7 @@ void SaveLoad_ns::doLoadGame(uint16 slot) {
_vm->_score = atoi(s.c_str());
s = f->readLine();
- _globalFlags = atoi(s.c_str());
+ g_globalFlags = atoi(s.c_str());
s = f->readLine();
_vm->_numLocations = atoi(s.c_str());
@@ -151,7 +151,7 @@ void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) {
sprintf(s, "%s\n", _vm->_char.getFullName());
f->writeString(s);
- sprintf(s, "%s\n", _saveData1);
+ sprintf(s, "%s\n", g_saveData1);
f->writeString(s);
sprintf(s, "%d\n", _vm->_char._ani->getX());
f->writeString(s);
@@ -159,7 +159,7 @@ void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) {
f->writeString(s);
sprintf(s, "%d\n", _vm->_score);
f->writeString(s);
- sprintf(s, "%u\n", _globalFlags);
+ sprintf(s, "%u\n", g_globalFlags);
f->writeString(s);
sprintf(s, "%d\n", _vm->_numLocations);
@@ -180,20 +180,13 @@ void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) {
}
int SaveLoad::selectSaveFile(Common::String &selectedName, bool saveMode, const Common::String &caption, const Common::String &button) {
- GUI::SaveLoadChooser slc(caption, button);
- slc.setSaveMode(saveMode);
+ GUI::SaveLoadChooser slc(caption, button, saveMode);
selectedName.clear();
- Common::String gameId = ConfMan.get("gameid");
-
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(gameId, &plugin);
-
- int idx = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ int idx = slc.runModalWithCurrentTarget();
if (idx >= 0) {
selectedName = slc.getResultString();
- slc.close();
}
return idx;
diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h
index e875e69334..e12e50e278 100644
--- a/engines/parallaction/sound.h
+++ b/engines/parallaction/sound.h
@@ -33,6 +33,7 @@
#define PATH_LEN 200
class MidiParser;
+class MidiDriver;
namespace Parallaction {
@@ -41,6 +42,7 @@ class MidiPlayer;
class Parallaction_br;
class MidiPlayer_MSC;
+MidiDriver *createAdLibDriver();
class SoundManImpl {
public:
diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index 0925e55309..ad510eb1f1 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -91,20 +91,20 @@ public:
};
void MidiParser_MSC::parseMetaEvent(EventInfo &info) {
- uint8 type = read1(_position._play_pos);
- uint8 len = read1(_position._play_pos);
+ uint8 type = read1(_position._playPos);
+ uint8 len = read1(_position._playPos);
info.ext.type = type;
info.length = len;
info.ext.data = 0;
if (type == 0x51) {
- info.ext.data = _position._play_pos;
+ info.ext.data = _position._playPos;
} else {
warning("unknown meta event 0x%02X", type);
info.ext.type = 0;
}
- _position._play_pos += len;
+ _position._playPos += len;
}
void MidiParser_MSC::parseMidiEvent(EventInfo &info) {
@@ -116,13 +116,13 @@ void MidiParser_MSC::parseMidiEvent(EventInfo &info) {
case 0xA:
case 0xB:
case 0xE:
- info.basic.param1 = read1(_position._play_pos);
- info.basic.param2 = read1(_position._play_pos);
+ info.basic.param1 = read1(_position._playPos);
+ info.basic.param2 = read1(_position._playPos);
break;
case 0xC:
case 0xD:
- info.basic.param1 = read1(_position._play_pos);
+ info.basic.param1 = read1(_position._playPos);
info.basic.param2 = 0;
break;
@@ -135,9 +135,9 @@ void MidiParser_MSC::parseMidiEvent(EventInfo &info) {
}
void MidiParser_MSC::parseNextEvent(EventInfo &info) {
- info.start = _position._play_pos;
+ info.start = _position._playPos;
- if (_position._play_pos >= _trackEnd) {
+ if (_position._playPos >= _trackEnd) {
// fake an end-of-track meta event
info.delta = 0;
info.event = 0xFF;
@@ -146,8 +146,9 @@ void MidiParser_MSC::parseNextEvent(EventInfo &info) {
return;
}
- info.delta = readVLQ(_position._play_pos);
- info.event = read1(_position._play_pos);
+ info.length = 0;
+ info.delta = readVLQ(_position._playPos);
+ info.event = read1(_position._playPos);
if (info.event == 0xFF) {
parseMetaEvent(info);
@@ -155,7 +156,7 @@ void MidiParser_MSC::parseNextEvent(EventInfo &info) {
}
if (info.event < 0x80) {
- _position._play_pos--;
+ _position._playPos--;
info.event = _lastEvent;
}
@@ -185,7 +186,7 @@ bool MidiParser_MSC::loadMusic(byte *data, uint32 size) {
_lastEvent = 0;
_trackEnd = data + size;
- _num_tracks = 1;
+ _numTracks = 1;
_tracks[0] = pos;
setTempo(500000);
@@ -224,7 +225,12 @@ MidiPlayer_MSC::MidiPlayer_MSC()
: _paused(false) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
- _driver = MidiDriver::createMidi(dev);
+ const MusicType musicType = MidiDriver::getMusicType(dev);
+ if (musicType == MT_ADLIB) {
+ _driver = createAdLibDriver();
+ } else {
+ _driver = MidiDriver::createMidi(dev);
+ }
assert(_driver);
int ret = _driver->open();
diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp
index 3cc25b36b0..0ee3d73556 100644
--- a/engines/parallaction/sound_ns.cpp
+++ b/engines/parallaction/sound_ns.cpp
@@ -168,13 +168,13 @@ void DosSoundMan_ns::playCharacterMusic(const char *character) {
char *name = const_cast<char *>(character);
const char *newMusicFile = 0;
- if (!scumm_stricmp(name, _dinoName)) {
+ if (!scumm_stricmp(name, g_dinoName)) {
newMusicFile = "dino";
} else
- if (!scumm_stricmp(name, _donnaName)) {
+ if (!scumm_stricmp(name, g_donnaName)) {
newMusicFile = "donna";
} else
- if (!scumm_stricmp(name, _doughName)) {
+ if (!scumm_stricmp(name, g_doughName)) {
newMusicFile = "nuts";
} else {
warning("unknown character '%s' in DosSoundMan_ns_ns::playCharacterMusic", character);
@@ -237,7 +237,7 @@ AmigaSoundMan_ns::~AmigaSoundMan_ns() {
stopSfx(2);
stopSfx(3);
- delete []beepSoundBuffer;
+ delete[] beepSoundBuffer;
}
Audio::AudioStream *AmigaSoundMan_ns::loadChannelData(const char *filename, Channel *ch, bool looping) {
diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp
index 73e78cae3c..f09b1241bc 100644
--- a/engines/parallaction/staticres.cpp
+++ b/engines/parallaction/staticres.cpp
@@ -89,14 +89,14 @@ byte Input::_resMouseArrow_BR_Amiga[512] = {
/*
This palette snippet is used for animations in Big Red Adventure.
*/
-byte _braAmigaFramesDefaultPalette[48] = {
+byte braAmigaFramesDefaultPalette[48] = {
0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0xFF, 0xE0, 0xCF, 0x7F, 0x7F, 0x7F, 0xD9, 0x9C, 0x84, 0x00,
0x9E, 0xF0, 0x91, 0xCC, 0x36, 0xFF, 0x6A, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0x11, 0xB0, 0xEE,
0xF0, 0xFF, 0x17, 0x3D, 0x18, 0xAC, 0x3A, 0xB0, 0x00, 0x00, 0x7D, 0x00, 0x00, 0xFF, 0xA8, 0xFF,
};
-byte _amigaTopazFont[2600] = {
+byte amigaTopazFont[2600] = {
0x00, 0x00, 0x03, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x79, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x02, 0x79,
0x70, 0xff, 0x4e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
@@ -263,7 +263,7 @@ byte _amigaTopazFont[2600] = {
};
-const char *_callableNamesRes_ns[] = {
+const char *callableNamesRes_ns[] = {
"Projector",
"HBOff",
"StartIntro",
@@ -292,7 +292,7 @@ const char *_callableNamesRes_ns[] = {
};
-const char *_callableNamesRes_br[] = {
+const char *callableNamesRes_br[] = {
"blufade",
"resetpalette",
"ferrcycle",
@@ -301,15 +301,15 @@ const char *_callableNamesRes_br[] = {
"password"
};
-const char *_dinoName = "dino";
-const char *_donnaName = "donna";
-const char *_doughName = "dough";
-const char *_drkiName = "drki";
+const char *g_dinoName = "dino";
+const char *g_donnaName = "donna";
+const char *g_doughName = "dough";
+const char *g_drkiName = "drki";
-const char *_minidinoName = "minidino";
-const char *_minidonnaName = "minidonna";
-const char *_minidoughName = "minidough";
-const char *_minidrkiName = "minidrki";
+const char *g_minidinoName = "minidino";
+const char *g_minidonnaName = "minidonna";
+const char *g_minidoughName = "minidough";
+const char *g_minidrkiName = "minidrki";
#define CALLABLE_NS(x) &Parallaction_ns::x
@@ -391,7 +391,7 @@ const Parallaction_br::Callable Parallaction_br::_amigaCallables[] = {
void Parallaction_ns::initResources() {
- _callableNames = new Table(ARRAYSIZE(_callableNamesRes_ns), _callableNamesRes_ns);
+ _callableNames = new Table(ARRAYSIZE(callableNamesRes_ns), callableNamesRes_ns);
_localFlagNames = new FixedTable(NUM_LOCATIONS, 1);
_localFlagNames->addData("visited");
@@ -406,7 +406,7 @@ void Parallaction_ns::initResources() {
void Parallaction_br::initResources() {
- _callableNames = new Table(ARRAYSIZE(_callableNamesRes_br), _callableNamesRes_br);
+ _callableNames = new Table(ARRAYSIZE(callableNamesRes_br), callableNamesRes_br);
_localFlagNames = new FixedTable(NUM_LOCATIONS, 2);
_localFlagNames->addData("visited");
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index 53237db4ef..19162cd7db 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -55,27 +55,27 @@ WalkFrames _char24WalkFrames_NS = {
};
static int getPathWidth() {
- if (!_vm->_gfx->_backgroundInfo->_path) {
+ if (!g_vm->_gfx->_backgroundInfo->_path) {
warning("getPathWidth() _path is NULL!");
return 0;
} else
- return _vm->_gfx->_backgroundInfo->_path->w;
+ return g_vm->_gfx->_backgroundInfo->_path->w;
}
static int getPathHeight() {
- if (!_vm->_gfx->_backgroundInfo->_path) {
+ if (!g_vm->_gfx->_backgroundInfo->_path) {
warning("getPathHeight() _path is NULL!");
return 0;
} else
- return _vm->_gfx->_backgroundInfo->_path->h;
+ return g_vm->_gfx->_backgroundInfo->_path->h;
}
static bool isPathClear(uint16 x, uint16 y) {
- if (!_vm->_gfx->_backgroundInfo->_path) {
+ if (!g_vm->_gfx->_backgroundInfo->_path) {
warning("isPathClear() _path is NULL!");
return false;
} else
- return (_vm->_gfx->_backgroundInfo->_path->getValue(x, y) ? true : false);
+ return (g_vm->_gfx->_backgroundInfo->_path->getValue(x, y) ? true : false);
}
// adjusts position towards nearest walkable point
@@ -306,7 +306,7 @@ void PathWalker_NS::checkDoor(const Common::Point &foot) {
}
void PathWalker_NS::finalizeWalk() {
- _engineFlags &= ~kEngineWalking;
+ g_engineFlags &= ~kEngineWalking;
Common::Point foot;
_a->getFoot(foot);
@@ -316,7 +316,7 @@ void PathWalker_NS::finalizeWalk() {
}
void PathWalker_NS::walk() {
- if ((_engineFlags & kEngineWalking) == 0) {
+ if ((g_engineFlags & kEngineWalking) == 0) {
return;
}
@@ -382,7 +382,7 @@ void PathWalker_NS::updateDirection(const Common::Point& pos, const Common::Poin
_a->setF(frames->firstWalkFrame[_direction] + (_step / frames->frameRepeat[_direction]) % frames->numWalkFrames[_direction]);
}
-PathWalker_NS::PathWalker_NS() : _direction(WALK_DOWN), _step(0) {
+PathWalker_NS::PathWalker_NS(Parallaction *vm) : _direction(WALK_DOWN), _step(0), _vm(vm) {
}
bool PathWalker_BR::directPathExists(const Common::Point &from, const Common::Point &to) {
@@ -481,7 +481,7 @@ void PathWalker_BR::buildPath(State &s, uint16 x, uint16 y) {
}
void PathWalker_BR::finalizeWalk(State &s) {
- _engineFlags &= ~kEngineWalking;
+ g_engineFlags &= ~kEngineWalking;
Common::Point foot;
_character._a->getFoot(foot);
@@ -508,8 +508,8 @@ void PathWalker_BR::finalizeWalk(State &s) {
#if 0
// TODO: Input::walkTo must be extended to support destination frame in addition to coordinates
- if (_engineFlags & FINAL_WALK_FRAME) { // this flag is set in readInput()
- _engineFlags &= ~FINAL_WALK_FRAME;
+ if (g_engineFlags & FINAL_WALK_FRAME) { // this flag is set in readInput()
+ g_engineFlags &= ~FINAL_WALK_FRAME;
_ch._a->_frame = _moveToF; // from readInput()...
} else {
_ch._a->_frame = _dirFrame; // from walk()
@@ -523,7 +523,7 @@ void PathWalker_BR::finalizeWalk(State &s) {
}
void PathWalker_BR::walk() {
- if ((_engineFlags & kEngineWalking) == 0) {
+ if ((g_engineFlags & kEngineWalking) == 0) {
return;
}
@@ -714,7 +714,7 @@ void PathWalker_BR::doWalk(State &s) {
}
}
-PathWalker_BR::PathWalker_BR() {
+PathWalker_BR::PathWalker_BR(Parallaction *vm) : _vm(vm) {
_character._active = false;
_character._step = 0;
_follower._active = false;
diff --git a/engines/parallaction/walk.h b/engines/parallaction/walk.h
index 6796991f9d..ae6db6eaf1 100644
--- a/engines/parallaction/walk.h
+++ b/engines/parallaction/walk.h
@@ -49,8 +49,10 @@ class PathWalker_NS {
void checkDoor(const Common::Point &foot);
void updateDirection(const Common::Point& pos, const Common::Point& to);
+ Parallaction *_vm;
+
public:
- PathWalker_NS();
+ PathWalker_NS(Parallaction *vm);
void buildPath(AnimationPtr a, uint16 x, uint16 y);
void walk();
@@ -79,8 +81,10 @@ class PathWalker_BR {
void doWalk(State &s);
void checkTrap(const Common::Point &p);
+ Parallaction *_vm;
+
public:
- PathWalker_BR();
+ PathWalker_BR(Parallaction *vm);
~PathWalker_BR() { }
void setCharacterPath(AnimationPtr a, uint16 x, uint16 y);
diff --git a/engines/pegasus/ai/ai_action.cpp b/engines/pegasus/ai/ai_action.cpp
new file mode 100644
index 0000000000..38d639038f
--- /dev/null
+++ b/engines/pegasus/ai/ai_action.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/ai/ai_action.h"
+#include "pegasus/ai/ai_area.h"
+
+namespace Pegasus {
+
+AICompoundAction::~AICompoundAction() {
+ for (AIActionList::iterator it = _compoundActions.begin(); it != _compoundActions.end(); it++)
+ delete *it;
+}
+
+void AICompoundAction::performAIAction(AIRule *rule) {
+ for (AIActionList::iterator it = _compoundActions.begin(); it != _compoundActions.end(); it++)
+ (*it)->performAIAction(rule);
+}
+
+AIPlayMessageAction::AIPlayMessageAction(const Common::String &movieName, bool keepLastFrame, const InputBits interruptionFilter) {
+ _movieName = movieName;
+ _keepLastFrame = keepLastFrame;
+ _interruptionFilter = interruptionFilter;
+}
+
+void AIPlayMessageAction::performAIAction(AIRule *) {
+ if (g_AIArea) {
+ g_AIArea->checkMiddleArea();
+ g_AIArea->playAIMovie(kRightAreaSignature, _movieName, _keepLastFrame, _interruptionFilter);
+ }
+}
+
+AIStartTimerAction::AIStartTimerAction(AITimerCondition *timerCondition) {
+ _timerCondition = timerCondition;
+}
+
+void AIStartTimerAction::performAIAction(AIRule *) {
+ _timerCondition->startTimer();
+}
+
+AIActivateRuleAction::AIActivateRuleAction(AIRule *rule) {
+ _rule = rule;
+}
+
+void AIActivateRuleAction::performAIAction(AIRule *) {
+ _rule->activateRule();
+}
+
+AIDeactivateRuleAction::AIDeactivateRuleAction(AIRule *rule) {
+ _rule = rule;
+}
+
+void AIDeactivateRuleAction::performAIAction(AIRule *) {
+ _rule->deactivateRule();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/ai/ai_action.h b/engines/pegasus/ai/ai_action.h
new file mode 100644
index 0000000000..6eac976f9c
--- /dev/null
+++ b/engines/pegasus/ai/ai_action.h
@@ -0,0 +1,136 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_AI_AIACTION_H
+#define PEGASUS_AI_AIACTION_H
+
+#include "common/list.h"
+
+#include "pegasus/input.h"
+#include "pegasus/types.h"
+
+namespace Pegasus {
+
+class AIRule;
+class AITimerCondition;
+
+/////////////////////////////////////////////
+//
+// AIAction
+
+class AIAction {
+friend class AIRule;
+public:
+ AIAction() { _actionCount = 1; }
+ virtual ~AIAction() {}
+
+ virtual void performAIAction(AIRule *) = 0;
+
+ void setActionCount(const uint32 count) { _actionCount = count; }
+
+protected:
+ uint32 _actionCount;
+};
+
+typedef Common::List<AIAction *> AIActionList;
+
+/////////////////////////////////////////////
+//
+// AICompoundAction
+
+class AICompoundAction : public AIAction {
+public:
+ AICompoundAction() {}
+ virtual ~AICompoundAction();
+
+ void addAction(AIAction *action) { _compoundActions.push_back(action); }
+
+ virtual void performAIAction(AIRule *);
+
+protected:
+ AIActionList _compoundActions;
+};
+
+/////////////////////////////////////////////
+//
+// AIPlayMessageAction
+
+class AIPlayMessageAction : public AIAction {
+public:
+ AIPlayMessageAction(const Common::String &movieName, bool keepLastFrame, const InputBits = kWarningInterruption);
+
+ virtual void performAIAction(AIRule *);
+
+protected:
+ Common::String _movieName;
+ InputBits _interruptionFilter;
+ bool _keepLastFrame;
+};
+
+/////////////////////////////////////////////
+//
+// AIStartTimerAction
+
+class AIStartTimerAction : public AIAction {
+public:
+ AIStartTimerAction(AITimerCondition *);
+
+ virtual void performAIAction(AIRule *);
+
+protected:
+ AITimerCondition *_timerCondition;
+};
+
+/////////////////////////////////////////////
+//
+// AIActivateRuleAction
+
+class AIActivateRuleAction : public AIAction {
+public:
+ AIActivateRuleAction(AIRule *);
+
+ virtual void performAIAction(AIRule *);
+
+protected:
+ AIRule *_rule;
+};
+
+/////////////////////////////////////////////
+//
+// AIDeactivateRuleAction
+
+class AIDeactivateRuleAction : public AIAction {
+public:
+ AIDeactivateRuleAction(AIRule *rule);
+
+ virtual void performAIAction(AIRule *);
+
+protected:
+ AIRule *_rule;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/ai/ai_area.cpp b/engines/pegasus/ai/ai_area.cpp
new file mode 100644
index 0000000000..5ac8af8812
--- /dev/null
+++ b/engines/pegasus/ai/ai_area.cpp
@@ -0,0 +1,613 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/memstream.h"
+
+#include "pegasus/cursor.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/aichip.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/items/biochips/pegasuschip.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+AIArea *g_AIArea = 0;
+
+AIArea::AIArea(InputHandler *nextHandler) : InputHandler(nextHandler), _leftAreaMovie(kAILeftAreaID),
+ _middleAreaMovie(kAIMiddleAreaID), _rightAreaMovie(kAIRightAreaID), _AIMovie(kAIMovieID) {
+ g_AIArea = this;
+ _leftAreaOwner = kNoClientSignature;
+ _middleAreaOwner = kNoClientSignature;
+ _rightAreaOwner = kNoClientSignature;
+ _leftInventoryTime = 0xffffffff;
+ _middleInventoryTime = 0xffffffff;
+ _middleBiochipTime = 0xffffffff;
+ _rightBiochipTime = 0xffffffff;
+ _lockCount = 0;
+ startIdling();
+}
+
+AIArea::~AIArea() {
+ if (_middleAreaOwner == kBiochipSignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ if (currentBiochip && currentBiochip->isSelected())
+ currentBiochip->giveUpSharedArea();
+ } else if (_middleAreaOwner == kInventorySignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ if (currentItem && currentItem->isSelected())
+ currentItem->giveUpSharedArea();
+ }
+
+ stopIdling();
+
+ for (AIRuleList::iterator it = _AIRules.begin(); it != _AIRules.end(); it++)
+ delete *it;
+
+ g_AIArea = 0;
+}
+
+// Save last state of AI rules...
+void AIArea::saveAIState() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ delete vm->_aiSaveStream;
+
+ Common::MemoryWriteStreamDynamic out;
+ writeAIRules(&out);
+
+ vm->_aiSaveStream = new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES);
+}
+
+void AIArea::restoreAIState() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ if (vm->_aiSaveStream)
+ readAIRules(vm->_aiSaveStream);
+}
+
+void AIArea::writeAIRules(Common::WriteStream *stream) {
+ _AIRules.writeAIRules(stream);
+}
+
+void AIArea::readAIRules(Common::ReadStream *stream) {
+ _AIRules.readAIRules(stream);
+}
+
+void AIArea::initAIArea() {
+ allocateSurface(Common::Rect(0, 0, 384, 96));
+
+ _leftAreaMovie.shareSurface(this);
+ _leftAreaMovie.initFromMovieFile("Images/Items/Left Area Movie");
+ _leftAreaMovie.moveElementTo(kAILeftAreaLeft, kAILeftAreaTop);
+ _leftAreaMovie.setDisplayOrder(kAILeftAreaOrder);
+ _leftAreaMovie.startDisplaying();
+ _leftAreaMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+
+ _middleAreaMovie.shareSurface(this);
+ _middleAreaMovie.initFromMovieFile("Images/Items/Middle Area Movie");
+ _middleAreaMovie.moveElementTo(kAIMiddleAreaLeft, kAIMiddleAreaTop);
+ _middleAreaMovie.moveMovieBoxTo(kAIMiddleAreaLeft - kAILeftAreaLeft, 0);
+ _middleAreaMovie.setDisplayOrder(kAIMiddleAreaOrder);
+ _middleAreaMovie.startDisplaying();
+ _middleAreaMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+
+ _rightAreaMovie.shareSurface(this);
+ _rightAreaMovie.initFromMovieFile("Images/Items/Right Area Movie");
+ _rightAreaMovie.moveElementTo(kAIRightAreaLeft, kAIRightAreaTop);
+ _rightAreaMovie.moveMovieBoxTo(kAIRightAreaLeft - kAILeftAreaLeft, 0);
+ _rightAreaMovie.setDisplayOrder(kAIRightAreaOrder);
+ _rightAreaMovie.startDisplaying();
+ _rightAreaMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+
+ _AIMovie.setDisplayOrder(kAIMovieOrder);
+}
+
+void AIArea::setAIVolume(const uint16 volume) {
+ _leftAreaMovie.setVolume(volume);
+ _middleAreaMovie.setVolume(volume);
+ _rightAreaMovie.setVolume(volume);
+}
+
+// There are only so many legal combinations of client/area.
+// Here is the list of supported pairs:
+// kInventorySignature kLeftAreaSignature
+// kInventorySignature kMiddleAreaSignature
+// kBiochipSignature kMiddleAreaSignature
+// kBiochipSignature kRightAreaSignature
+// kAISignature kLeftAreaSignature
+// Further, the kAISignature never sets a static frame time in the left area,
+// but only plays a sequence.
+
+// If this function is called while a sequence is playing, it will just "remember"
+// the time value, so that when the sequence finishes, the new time is asserted.
+
+void AIArea::setAIAreaToTime(const LowerClientSignature client, const LowerAreaSignature area, const TimeValue time) {
+ switch (area) {
+ case kLeftAreaSignature:
+ // Only support kInventorySignature client, since AI never calls SetAIAreaToTime.
+ _leftAreaMovie.setSegment(0, _leftAreaMovie.getDuration());
+
+ if (time == 0xffffffff) {
+ _leftAreaMovie.hide();
+ _leftAreaOwner = kNoClientSignature;
+ } else {
+ setLeftMovieTime(time);
+ }
+ break;
+ case kMiddleAreaSignature:
+ // Only support kInventorySignature and kBiochipSignature clients.
+ _middleAreaMovie.stop();
+ _middleAreaMovie.setFlags(0);
+ _middleAreaMovie.setSegment(0, _middleAreaMovie.getDuration());
+
+ if (time == 0xffffffff) {
+ if (client == kInventorySignature) {
+ if (_middleBiochipTime != 0xffffffff) {
+ setMiddleMovieTime(kBiochipSignature, _middleBiochipTime);
+ } else {
+ _middleAreaMovie.hide();
+ _middleAreaOwner = kNoClientSignature;
+ }
+ } else { // client == kBiochipSignature
+ if (_middleInventoryTime != 0xffffffff) {
+ setMiddleMovieTime(kInventorySignature, _middleInventoryTime);
+ } else {
+ _middleAreaMovie.hide();
+ _middleAreaOwner = kNoClientSignature;
+ }
+ }
+ } else {
+ setMiddleMovieTime(client, time);
+ }
+ break;
+ case kRightAreaSignature:
+ // Only support kBiochipSignature client.
+ _rightAreaMovie.setSegment(0, _rightAreaMovie.getDuration());
+
+ if (time == 0xffffffff) {
+ _rightAreaMovie.hide();
+ _rightAreaOwner = kNoClientSignature;
+ } else {
+ setRightMovieTime(time);
+ }
+ break;
+ }
+}
+
+// Plays a sequence on an area. When the sequence ends, the previous image
+// is restored.
+// Also, is input disabled or not?
+// Easy answer: yes.
+
+// There are only so many legal combinations of client/area.
+// Here is the list of supported pairs:
+// kBiochipSignature kMiddleAreaSignature
+// kBiochipSignature kRightAreaSignature
+// kInventorySignature kMiddleAreaSignature
+
+void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSignature area, const TimeValue start, const TimeValue stop) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ lockAIOut();
+
+ switch (area) {
+ case kLeftAreaSignature:
+ break;
+ case kMiddleAreaSignature:
+ if (_middleAreaOwner == kInventorySignature)
+ _middleInventoryTime = _middleAreaMovie.getTime();
+ else if (_middleAreaOwner == kBiochipSignature)
+ _middleBiochipTime = _middleAreaMovie.getTime();
+
+ _middleAreaMovie.stop();
+ _middleAreaMovie.setFlags(0);
+ _middleAreaMovie.setSegment(start, stop);
+ _middleAreaMovie.setTime(start);
+ _middleAreaMovie.show();
+ _middleAreaMovie.start();
+ vm->_cursor->hide();
+
+ while (_middleAreaMovie.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ _middleAreaMovie.stop();
+ vm->_cursor->hideUntilMoved();
+
+ if (_middleAreaOwner == kInventorySignature)
+ setAIAreaToTime(_middleAreaOwner, kMiddleAreaSignature, _middleInventoryTime);
+ else if (_middleAreaOwner == kBiochipSignature)
+ setAIAreaToTime(_middleAreaOwner, kMiddleAreaSignature, _middleBiochipTime);
+ else
+ setAIAreaToTime(_middleAreaOwner, kMiddleAreaSignature, 0xffffffff);
+ break;
+ case kRightAreaSignature:
+ _rightBiochipTime = _rightAreaMovie.getTime();
+ _rightAreaMovie.setSegment(start, stop);
+ _rightAreaMovie.setTime(start);
+ _rightAreaMovie.show();
+ _rightAreaMovie.start();
+ vm->_cursor->hide();
+
+ while (_rightAreaMovie.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ _rightAreaMovie.stop();
+ vm->_cursor->hideUntilMoved();
+ setAIAreaToTime(_rightAreaOwner, kRightAreaSignature, _rightBiochipTime);
+ break;
+ }
+
+ unlockAI();
+}
+
+bool AIArea::playAIMovie(const LowerAreaSignature area, const Common::String &movieName, bool keepLastFrame, const InputBits interruptFilter) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ lockAIOut();
+
+ InputDevice.waitInput(interruptFilter);
+ if (_AIMovie.isMovieValid())
+ _AIMovie.releaseMovie();
+
+ _AIMovie.shareSurface(this);
+ _AIMovie.initFromMovieFile(movieName);
+
+ if (area == kLeftAreaSignature) {
+ _AIMovie.moveElementTo(kAILeftAreaLeft, kAILeftAreaTop);
+ _leftAreaMovie.hide();
+ } else {
+ _AIMovie.moveElementTo(kAIRightAreaLeft, kAIRightAreaTop);
+ _AIMovie.moveMovieBoxTo(kAIRightAreaLeft - kAILeftAreaLeft, 0);
+ _rightAreaMovie.hide();
+ }
+
+ _AIMovie.setTime(0);
+ _AIMovie.startDisplaying();
+ _AIMovie.show();
+ _AIMovie.redrawMovieWorld();
+ _AIMovie.setVolume(vm->getSoundFXLevel());
+ _AIMovie.start();
+ vm->_cursor->hide();
+
+ bool result = true;
+ bool saveAllowed = vm->swapSaveAllowed(false);
+ bool openAllowed = vm->swapLoadAllowed(false);
+
+ while (_AIMovie.isRunning()) {
+ Input input;
+ InputDevice.getInput(input, interruptFilter);
+
+ if (input.anyInput() || vm->shouldQuit() || vm->saveRequested() || vm->loadRequested()) {
+ result = false;
+ break;
+ }
+
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ _AIMovie.stop();
+
+ vm->swapSaveAllowed(saveAllowed);
+ vm->swapLoadAllowed(openAllowed);
+
+ // This used to keep the last frame up even if the movie was interrupted.
+ // However, this only occurs in the recalibration, where interruption means skip the
+ // whole thing, so skipping causes the AI to go away even when keepLastFrame is true.
+
+ if (!(result && keepLastFrame)) {
+ _AIMovie.stopDisplaying();
+ _AIMovie.releaseMovie();
+
+ if (area == kLeftAreaSignature) {
+ _leftAreaMovie.setTime(_leftInventoryTime);
+ _leftAreaMovie.show();
+ _leftAreaMovie.redrawMovieWorld();
+ } else {
+ _rightAreaMovie.setTime(_rightBiochipTime);
+ _rightAreaMovie.show();
+ _rightAreaMovie.redrawMovieWorld();
+ }
+ }
+
+ vm->_cursor->hideUntilMoved();
+ unlockAI();
+ return result;
+}
+
+// Only implemented for kMiddleAreaSignature, kInventorySignature
+void AIArea::loopAIAreaSequence(const LowerClientSignature owner, const LowerAreaSignature area, const TimeValue start, const TimeValue stop) {
+ if (area == kMiddleAreaSignature && owner == kInventorySignature && owner == _middleAreaOwner) {
+ _middleAreaMovie.stop();
+ _middleAreaMovie.setFlags(0);
+ _middleAreaMovie.setSegment(start, stop);
+ _middleAreaMovie.setFlags(kLoopTimeBase);
+ _middleAreaMovie.setTime(start);
+ _middleAreaMovie.show();
+ _middleAreaMovie.start();
+ }
+}
+
+// Only called by kInventorySignature.
+void AIArea::setLeftMovieTime(const TimeValue time) {
+ if (!_AIMovie.isSurfaceValid()) {
+ _leftAreaMovie.setTime(time);
+ _leftAreaMovie.show();
+ _leftAreaMovie.redrawMovieWorld();
+ }
+
+ _leftAreaOwner = kInventorySignature;
+ _leftInventoryTime = time;
+}
+
+void AIArea::setMiddleMovieTime(const LowerClientSignature client, const TimeValue time) {
+ if (client == kInventorySignature) {
+ _middleInventoryTime = time;
+ if (_middleAreaOwner == kBiochipSignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ if (currentBiochip && currentBiochip->isSelected())
+ currentBiochip->giveUpSharedArea();
+ }
+ } else {
+ _middleBiochipTime = time;
+ if (_middleAreaOwner == kInventorySignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ if (currentItem && currentItem->isSelected())
+ currentItem->giveUpSharedArea();
+ }
+ }
+
+ _middleAreaMovie.setSegment(0, _middleAreaMovie.getDuration());
+ _middleAreaMovie.stop();
+ _middleAreaMovie.setFlags(0);
+ _middleAreaMovie.setTime(time);
+ _middleAreaMovie.show();
+ _middleAreaMovie.redrawMovieWorld();
+ _middleAreaOwner = client;
+}
+
+// Only called by kBiochipSignature.
+void AIArea::setRightMovieTime(const TimeValue time) {
+ if (!_AIMovie.isSurfaceValid()) {
+ // Can't do it when the AI movie is up...
+ _rightAreaMovie.setTime(time);
+ _rightAreaMovie.show();
+ _rightAreaMovie.redrawMovieWorld();
+ }
+
+ _rightAreaOwner = kBiochipSignature;
+ _rightBiochipTime = time;
+}
+
+void AIArea::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (JMPPPInput::isToggleAIMiddleInput(input))
+ toggleMiddleAreaOwner();
+ else
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void AIArea::toggleMiddleAreaOwner() {
+ if (_middleAreaOwner == kInventorySignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ if (currentBiochip) {
+ setMiddleMovieTime(kBiochipSignature, currentBiochip->getSharedAreaTime());
+ currentBiochip->takeSharedArea();
+ }
+ } else if (_middleAreaOwner == kBiochipSignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ if (currentItem) {
+ setMiddleMovieTime(kInventorySignature, currentItem->getSharedAreaTime());
+ currentItem->takeSharedArea();
+ }
+ }
+}
+
+void AIArea::activateHotspots() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ if (_middleAreaOwner == kBiochipSignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ if (currentBiochip)
+ switch (currentBiochip->getObjectID()) {
+ case kAIBiochip:
+ ((AIChip *)currentBiochip)->activateAIHotspots();
+ break;
+ case kPegasusBiochip:
+ if (!vm->isDemo())
+ ((PegasusChip *)currentBiochip)->activatePegasusHotspots();
+ break;
+ case kOpticalBiochip:
+ ((OpticalChip *)currentBiochip)->activateOpticalHotspots();
+ break;
+ }
+ } else if (_middleAreaOwner == kInventorySignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ if (currentItem && currentItem->getObjectID() == kAirMask)
+ ((AirMask *)currentItem)->activateAirMaskHotspots();
+ }
+
+ InputHandler::activateHotspots();
+}
+
+void AIArea::clickInHotspot(const Input &input, const Hotspot *hotspot) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ bool handled = false;
+
+ if (_middleAreaOwner == kBiochipSignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+
+ if (currentBiochip) {
+ switch (currentBiochip->getObjectID()) {
+ case kAIBiochip:
+ if ((hotspot->getHotspotFlags() & kAIBiochipSpotFlag) != 0) {
+ ((AIChip *)currentBiochip)->clickInAIHotspot(hotspot->getObjectID());
+ handled = true;
+ }
+ break;
+ case kPegasusBiochip:
+ if (!vm->isDemo() && ((hotspot->getHotspotFlags() & kPegasusBiochipSpotFlag) != 0)) {
+ ((PegasusChip *)currentBiochip)->clickInPegasusHotspot();
+ handled = true;
+ }
+ break;
+ case kOpticalBiochip:
+ if ((hotspot->getHotspotFlags() & kOpticalBiochipSpotFlag) != 0) {
+ ((OpticalChip *)currentBiochip)->clickInOpticalHotspot(hotspot->getObjectID());
+ handled = true;
+ }
+ break;
+ }
+ }
+ } else if (_middleAreaOwner == kInventorySignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+
+ if (currentItem) {
+ switch (currentItem->getObjectID()) {
+ case kAirMask:
+ if ((hotspot->getHotspotFlags() & kAirMaskSpotFlag) != 0) {
+ ((AirMask *)currentItem)->clickInAirMaskHotspot();
+ handled = true;
+ }
+ break;
+ }
+ }
+ }
+
+ if (!handled)
+ InputHandler::clickInHotspot(input, hotspot);
+}
+
+void AIArea::lockAIOut() {
+ if (_lockCount == 0)
+ stopIdling();
+
+ _lockCount++;
+}
+
+void AIArea::unlockAI() {
+ if (_lockCount > 0) {
+ _lockCount--;
+ if (_lockCount == 0)
+ startIdling();
+ }
+}
+
+void AIArea::forceAIUnlocked() {
+ if (_lockCount > 0) {
+ _lockCount = 1;
+ unlockAI();
+ }
+}
+
+void AIArea::checkRules() {
+ if (_lockCount == 0 && ((PegasusEngine *)g_engine)->playerAlive())
+ for (AIRuleList::iterator it = _AIRules.begin(); it != _AIRules.end(); it++)
+ if ((*it)->fireRule())
+ break;
+}
+
+void AIArea::useIdleTime() {
+ checkRules();
+}
+
+void AIArea::addAIRule(AIRule *rule) {
+ _AIRules.push_back(rule);
+}
+
+void AIArea::removeAllRules() {
+ for (AIRuleList::iterator it = _AIRules.begin(); it != _AIRules.end(); it++)
+ delete *it;
+
+ _AIRules.clear();
+}
+
+void AIArea::checkMiddleArea() {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+
+ if (currentBiochip) {
+ if (_middleAreaOwner == kBiochipSignature) {
+ switch (currentBiochip->getObjectID()) {
+ case kAIBiochip:
+ ((AIChip *)currentBiochip)->setUpAIChip();
+ break;
+ case kPegasusBiochip:
+ ((PegasusChip *)currentBiochip)->setUpPegasusChip();
+ break;
+ }
+ } else {
+ switch (currentBiochip->getObjectID()) {
+ case kAIBiochip:
+ ((AIChip *)currentBiochip)->setUpAIChipRude();
+ break;
+ case kPegasusBiochip:
+ ((PegasusChip *)currentBiochip)->setUpPegasusChipRude();
+ break;
+ }
+ }
+ }
+}
+
+TimeValue AIArea::getBigInfoTime() {
+ if (_middleAreaOwner == kInventorySignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ return currentItem->getInfoLeftTime();
+ } else if (_middleAreaOwner == kBiochipSignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ return currentBiochip->getInfoLeftTime();
+ }
+
+ return 0xffffffff;
+}
+
+void AIArea::getSmallInfoSegment(TimeValue &start, TimeValue &stop) {
+ if (_middleAreaOwner == kInventorySignature) {
+ InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ currentItem->getInfoRightTimes(start, stop);
+ } else if (_middleAreaOwner == kBiochipSignature) {
+ BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ currentBiochip->getInfoRightTimes(start, stop);
+ } else {
+ start = 0xffffffff;
+ stop = 0xffffffff;
+ }
+}
+
+LowerClientSignature AIArea::getMiddleAreaOwner() {
+ return _middleAreaOwner;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/ai/ai_area.h b/engines/pegasus/ai/ai_area.h
new file mode 100644
index 0000000000..806e6ef6bb
--- /dev/null
+++ b/engines/pegasus/ai/ai_area.h
@@ -0,0 +1,172 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_AI_AIAREA_H
+#define PEGASUS_AI_AIAREA_H
+
+#include "pegasus/input.h"
+#include "pegasus/movie.h"
+#include "pegasus/timers.h"
+#include "pegasus/ai/ai_rule.h"
+
+namespace Common {
+ class ReadStream;
+ class WriteStream;
+}
+
+/*
+
+ The AI area is the area at the bottom of the screen. There are three areas within
+ the AI area:
+ 1) the inventory/AI help area
+ 2) the middle area
+ 3) the biochip display area
+
+ Area 1 is used for displaying the current inventory item. When the player changes the
+ current item, either by selecting a new one in the inventory list or by picking
+ up a new item, area 1 updates to show the new item.
+
+ If the AI decides to give a message, the AI's head temporarily takes over area 1
+ for the duration of the message, then goes away, returning the area to the current
+ inventory item.
+
+ Area 2 is used to display the current inventory item's state, the current biochip's
+ state, and any extra information from the AI. The contention for this area is
+ resolved as follows:
+ -- If the AI needs to use the area while giving a message in area 1, it takes over
+ area 2 for the duration of its message.
+*** This is not true.
+ -- If the player selects a new inventory item, the inventory item's state gets
+ displayed immediately.
+ -- If the player selects a new biochip, the biochip's state info gets displayed
+ immediately.
+ -- If any auto drawing is to occur, it seizes the area as soon as the drawing is
+ to occur. For example, the mapping biochip does auto drawing every time the
+ player takes a step. The only exception to this rule is if the AI is presenting
+ a warning. When the AI seizes areas 1 and 2, it preempts all other uses.
+ Some inventory items and biochips can cause arbitrary drawing to occur in this area
+ at arbitrary times. The map biochip is one example which causes drawing when the
+ player takes a step. Another example is the poison gas canister, which flashes in
+ this area to indicate a dangerous compound.
+
+ Area 3 is used to display the current biochip. When the player changes the current
+ biochip, either by selecting a new one from the biochip list or by picking up a
+ new one, area 3 updates to show the new item. In addition, some biochips can play
+ animation in this area.
+
+*/
+
+namespace Pegasus {
+
+class AIArea : public Surface, public Idler, public InputHandler {
+public:
+ AIArea(InputHandler *);
+ virtual ~AIArea();
+
+ void writeAIRules(Common::WriteStream *stream);
+ void readAIRules(Common::ReadStream *stream);
+
+ void initAIArea();
+
+ void saveAIState();
+ void restoreAIState();
+
+ void handleInput(const Input &, const Hotspot *);
+ void activateHotspots();
+ void clickInHotspot(const Input &, const Hotspot *);
+
+ void setAIVolume(const uint16);
+
+ // There are only so many legal combinations of client/area.
+ // Here is the list of supported pairs:
+ // kInventorySignature kLeftAreaSignature
+ // kInventorySignature kMiddleAreaSignature
+ // kBiochipSignature kMiddleAreaSignature
+ // kBiochipSignature kRightAreaSignature
+ // kAISignature kLeftAreaSignature
+ // Further, the kAISignature never sets a static frame time in the left area,
+ // but only plays a sequence from the AI movie.
+ void setAIAreaToTime(const LowerClientSignature, const LowerAreaSignature, const TimeValue);
+
+ // The "Play" functions play the requested sequence synchronously.
+ void playAIAreaSequence(const LowerClientSignature, const LowerAreaSignature, const TimeValue, const TimeValue);
+
+ // For PlayAIMovie, it is assumed that the client is the AI itself.
+ // This is used to play AI messages as well as Optical Memory video.
+ // Returns true if the movie played all the way through, false if it was interrupted.
+ bool playAIMovie(const LowerAreaSignature, const Common::String &movieName, bool keepLastFrame, const InputBits);
+
+ // Loop the requested sequence indefinitely.
+ void loopAIAreaSequence(const LowerClientSignature, const LowerAreaSignature, const TimeValue, const TimeValue);
+
+ void addAIRule(AIRule *);
+
+ // Remove and delete all rules.
+ void removeAllRules();
+
+ void lockAIOut();
+ void unlockAI();
+ void forceAIUnlocked();
+
+ void checkMiddleArea();
+ void checkRules();
+
+ LowerClientSignature getMiddleAreaOwner();
+ void toggleMiddleAreaOwner();
+
+ TimeValue getBigInfoTime();
+ void getSmallInfoSegment(TimeValue &, TimeValue &);
+
+protected:
+ void useIdleTime();
+
+ void setLeftMovieTime(const TimeValue);
+ void setMiddleMovieTime(const LowerClientSignature, const TimeValue);
+ void setRightMovieTime(const TimeValue);
+
+ Movie _leftAreaMovie;
+ Movie _middleAreaMovie;
+ Movie _rightAreaMovie;
+ Movie _AIMovie;
+
+ LowerClientSignature _leftAreaOwner;
+ LowerClientSignature _middleAreaOwner;
+ LowerClientSignature _rightAreaOwner;
+
+ TimeValue _leftInventoryTime;
+ TimeValue _middleInventoryTime;
+ TimeValue _middleBiochipTime;
+ TimeValue _rightBiochipTime;
+
+ AIRuleList _AIRules;
+
+ uint _lockCount;
+};
+
+extern AIArea *g_AIArea;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/ai/ai_condition.cpp b/engines/pegasus/ai/ai_condition.cpp
new file mode 100644
index 0000000000..9fc9272566
--- /dev/null
+++ b/engines/pegasus/ai/ai_condition.cpp
@@ -0,0 +1,290 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/stream.h"
+
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_condition.h"
+#include "pegasus/items/itemlist.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+AIOneChildCondition::AIOneChildCondition(AICondition *child) {
+ _child = child;
+}
+
+AIOneChildCondition::~AIOneChildCondition() {
+ delete _child;
+}
+
+void AIOneChildCondition::writeAICondition(Common::WriteStream *stream) {
+ if (_child)
+ _child->writeAICondition(stream);
+}
+
+void AIOneChildCondition::readAICondition(Common::ReadStream *stream) {
+ if (_child)
+ _child->readAICondition(stream);
+}
+
+AITwoChildrenCondition::AITwoChildrenCondition(AICondition *leftChild, AICondition *rightChild) {
+ _leftChild = leftChild;
+ _rightChild = rightChild;
+}
+
+AITwoChildrenCondition::~AITwoChildrenCondition() {
+ delete _leftChild;
+ delete _rightChild;
+}
+
+void AITwoChildrenCondition::writeAICondition(Common::WriteStream *stream) {
+ if (_leftChild)
+ _leftChild->writeAICondition(stream);
+
+ if (_rightChild)
+ _rightChild->writeAICondition(stream);
+}
+
+void AITwoChildrenCondition::readAICondition(Common::ReadStream *stream) {
+ if (_leftChild)
+ _leftChild->readAICondition(stream);
+
+ if (_rightChild)
+ _rightChild->readAICondition(stream);
+}
+
+AINotCondition::AINotCondition(AICondition* child) : AIOneChildCondition(child) {
+}
+
+bool AINotCondition::fireCondition() {
+ return _child && !_child->fireCondition();
+}
+
+AIAndCondition::AIAndCondition(AICondition *leftChild, AICondition *rightChild) : AITwoChildrenCondition(leftChild, rightChild) {
+}
+
+bool AIAndCondition::fireCondition() {
+ return _leftChild && _leftChild->fireCondition() && _rightChild && _rightChild->fireCondition();
+}
+
+AIOrCondition::AIOrCondition(AICondition *leftChild, AICondition *rightChild) : AITwoChildrenCondition(leftChild, rightChild) {
+}
+
+bool AIOrCondition::fireCondition() {
+ return (_leftChild && _leftChild->fireCondition()) || (_rightChild && _rightChild->fireCondition());
+}
+
+AITimerCondition::AITimerCondition(const TimeValue time, const TimeScale scale, const bool shouldStartTimer) {
+ _timerFuse.primeFuse(time, scale);
+ _timerFuse.setFunctor(new Common::Functor0Mem<void, AITimerCondition>(this, &AITimerCondition::fire));
+ _fired = false;
+
+ if (shouldStartTimer)
+ startTimer();
+}
+
+void AITimerCondition::startTimer() {
+ _fired = false;
+ _timerFuse.lightFuse();
+}
+
+void AITimerCondition::stopTimer() {
+ _timerFuse.stopFuse();
+}
+
+void AITimerCondition::writeAICondition(Common::WriteStream *stream) {
+ stream->writeByte(_timerFuse.isFuseLit());
+ stream->writeByte(_fired);
+ stream->writeUint32BE(_timerFuse.getTimeRemaining());
+ stream->writeUint32BE(_timerFuse.getFuseScale());
+}
+
+void AITimerCondition::readAICondition(Common::ReadStream *stream) {
+ bool running = stream->readByte();
+ _fired = stream->readByte();
+ TimeValue time = stream->readUint32BE();
+ TimeScale scale = stream->readUint32BE();
+
+ _timerFuse.stopFuse();
+ _timerFuse.primeFuse(time, scale);
+
+ if (running)
+ _timerFuse.lightFuse();
+}
+
+bool AITimerCondition::fireCondition() {
+ return _fired;
+}
+
+void AITimerCondition::fire() {
+ _fired = true;
+}
+
+AILocationCondition::AILocationCondition(uint32 maxLocations) {
+ _numLocations = 0;
+ _maxLocations = maxLocations;
+ _locations = new RoomViewID[maxLocations];
+}
+
+AILocationCondition::~AILocationCondition() {
+ delete[] _locations;
+}
+
+void AILocationCondition::addLocation(const RoomViewID location) {
+ if (_numLocations < _maxLocations)
+ _locations[_numLocations++] = location;
+}
+
+bool AILocationCondition::fireCondition() {
+ RoomViewID test = GameState.getCurrentRoomAndView(), *p;
+ uint32 i;
+
+ for (i = 0, p = _locations; i < _numLocations; i++, p++) {
+ if (test == *p) {
+ *p = MakeRoomView(kNoRoomID, kNoDirection);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void AILocationCondition::writeAICondition(Common::WriteStream *stream) {
+ stream->writeUint32BE(_maxLocations);
+ stream->writeUint32BE(_numLocations);
+
+ uint32 i;
+ RoomViewID *p;
+ for (i = 0, p = _locations; i < _numLocations; i++, p++)
+ stream->writeUint32BE(*p);
+}
+
+void AILocationCondition::readAICondition(Common::ReadStream *stream) {
+ uint32 maxLocations = stream->readUint32BE();
+
+ if (_maxLocations != maxLocations) {
+ delete[] _locations;
+ _locations = new RoomViewID[maxLocations];
+ _maxLocations = maxLocations;
+ }
+
+ _numLocations = stream->readUint32BE();
+
+ uint32 i;
+ RoomViewID *p;
+ for (i = 0, p = _locations; i < _numLocations; i++, p++)
+ *p = stream->readUint32BE();
+}
+
+AIDoorOpenedCondition::AIDoorOpenedCondition(RoomViewID doorLocation) {
+ _doorLocation = doorLocation;
+}
+
+bool AIDoorOpenedCondition::fireCondition() {
+ return GameState.getCurrentRoomAndView() == _doorLocation && GameState.isCurrentDoorOpen();
+}
+
+AIHasItemCondition::AIHasItemCondition(const ItemID item) {
+ _item = item;
+}
+
+bool AIHasItemCondition::fireCondition() {
+ return _item == kNoItemID || GameState.isTakenItemID(_item);
+}
+
+AIDoesntHaveItemCondition::AIDoesntHaveItemCondition(const ItemID item) {
+ _item = item;
+}
+
+bool AIDoesntHaveItemCondition::fireCondition() {
+ return _item == kNoItemID || !GameState.isTakenItemID(_item);
+}
+
+AICurrentItemCondition::AICurrentItemCondition(const ItemID item) {
+ _item = item;
+}
+
+bool AICurrentItemCondition::fireCondition() {
+ InventoryItem *item = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+
+ if (_item == kNoItemID)
+ return item == 0;
+
+ return item != 0 && item->getObjectID() == _item;
+}
+
+AICurrentBiochipCondition::AICurrentBiochipCondition(const ItemID biochip) {
+ _biochip = biochip;
+}
+
+bool AICurrentBiochipCondition::fireCondition() {
+ BiochipItem *biochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+
+ if (_biochip == kNoItemID)
+ return biochip == 0;
+
+ return biochip != 0 && biochip->getObjectID() == _biochip;
+}
+
+AIItemStateCondition::AIItemStateCondition(const ItemID item, const ItemState state) {
+ _item = item;
+ _state = state;
+}
+
+bool AIItemStateCondition::fireCondition() {
+ Item *item = g_allItems.findItemByID(_item);
+ return item != 0 && item->getItemState() == _state;
+}
+
+AIEnergyMonitorCondition::AIEnergyMonitorCondition(const int32 energyThreshold) {
+ _energyThreshold = energyThreshold;
+}
+
+bool AIEnergyMonitorCondition::fireCondition() {
+ return g_energyMonitor != 0 && g_energyMonitor->getCurrentEnergy() < _energyThreshold;
+}
+
+AILastExtraCondition::AILastExtraCondition(const ExtraID lastExtra) {
+ _lastExtra = lastExtra;
+}
+
+bool AILastExtraCondition::fireCondition() {
+ return g_neighborhood && (ExtraID)g_neighborhood->getLastExtra() == _lastExtra;
+}
+
+AICondition *makeLocationAndDoesntHaveItemCondition(const RoomID room, const DirectionConstant direction, const ItemID item) {
+ AILocationCondition *location = new AILocationCondition(1);
+ location->addLocation(MakeRoomView(room, direction));
+
+ AIDoesntHaveItemCondition *doesntHaveItem = new AIDoesntHaveItemCondition(item);
+
+ return new AIAndCondition(location, doesntHaveItem);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/ai/ai_condition.h b/engines/pegasus/ai/ai_condition.h
new file mode 100644
index 0000000000..ae85168a36
--- /dev/null
+++ b/engines/pegasus/ai/ai_condition.h
@@ -0,0 +1,287 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_AI_AICONDITION_H
+#define PEGASUS_AI_AICONDITION_H
+
+#include "pegasus/timers.h"
+
+namespace Common {
+ class ReadStream;
+ class WriteStream;
+}
+
+namespace Pegasus {
+
+/////////////////////////////////////////////
+//
+// AICondition
+
+class AICondition {
+public:
+ AICondition() {}
+ virtual ~AICondition() {}
+
+ virtual bool fireCondition() = 0;
+
+ // Only need these for conditions that are dynamic, like timer conditions...
+ // other conditions, like item related conditions, which don't change during
+ // the run of an environment, are completely initted when the environment
+ // is created.
+ virtual void writeAICondition(Common::WriteStream *) {}
+ virtual void readAICondition(Common::ReadStream *) {}
+};
+
+/////////////////////////////////////////////
+//
+// AIOneChildCondition
+
+class AIOneChildCondition : public AICondition {
+public:
+ AIOneChildCondition(AICondition *);
+ virtual ~AIOneChildCondition();
+
+ virtual void writeAICondition(Common::WriteStream *);
+ virtual void readAICondition(Common::ReadStream *);
+
+protected:
+ AICondition *_child;
+};
+
+/////////////////////////////////////////////
+//
+// AITwoChildrenCondition
+
+class AITwoChildrenCondition : public AICondition {
+public:
+ AITwoChildrenCondition(AICondition *, AICondition *);
+ virtual ~AITwoChildrenCondition();
+
+ virtual void writeAICondition(Common::WriteStream *);
+ virtual void readAICondition(Common::ReadStream *);
+
+protected:
+ AICondition *_leftChild, *_rightChild;
+};
+
+/////////////////////////////////////////////
+//
+// AINotCondition
+
+class AINotCondition : public AIOneChildCondition {
+public:
+ AINotCondition(AICondition *);
+
+ virtual bool fireCondition();
+};
+
+/////////////////////////////////////////////
+//
+// AIAndCondition
+
+class AIAndCondition : public AITwoChildrenCondition {
+public:
+ AIAndCondition(AICondition *, AICondition *);
+
+ virtual bool fireCondition();
+};
+
+/////////////////////////////////////////////
+//
+// AIOrCondition
+
+class AIOrCondition : public AITwoChildrenCondition {
+public:
+ AIOrCondition(AICondition *, AICondition *);
+
+ virtual bool fireCondition();
+};
+
+/////////////////////////////////////////////
+//
+// AITimerCondition
+
+class AITimerCondition : public AICondition {
+public:
+ AITimerCondition(const TimeValue, const TimeScale, const bool);
+
+ void startTimer();
+ void stopTimer();
+
+ virtual bool fireCondition();
+
+ virtual void writeAICondition(Common::WriteStream *);
+ virtual void readAICondition(Common::ReadStream *);
+
+protected:
+ void fire();
+
+ FuseFunction _timerFuse;
+ bool _fired;
+};
+
+/////////////////////////////////////////////
+//
+// AILocationCondition
+
+class AILocationCondition : public AICondition {
+public:
+ AILocationCondition(uint32);
+ virtual ~AILocationCondition();
+
+ void addLocation(RoomViewID);
+ virtual bool fireCondition();
+
+ virtual void writeAICondition(Common::WriteStream *);
+ virtual void readAICondition(Common::ReadStream *);
+
+protected:
+ uint32 _numLocations, _maxLocations;
+ RoomViewID *_locations;
+};
+
+/////////////////////////////////////////////
+//
+// AIDoorOpenedCondition
+
+class AIDoorOpenedCondition : public AICondition {
+public:
+ AIDoorOpenedCondition(RoomViewID);
+ virtual ~AIDoorOpenedCondition() {}
+
+ virtual bool fireCondition();
+
+protected:
+ RoomViewID _doorLocation;
+};
+
+/////////////////////////////////////////////
+//
+// AIHasItemCondition
+
+class AIHasItemCondition : public AICondition {
+public:
+ AIHasItemCondition(const ItemID);
+
+ virtual bool fireCondition();
+
+protected:
+ ItemID _item;
+};
+
+/////////////////////////////////////////////
+//
+// AIDoesntHaveItemCondition
+
+class AIDoesntHaveItemCondition : public AICondition {
+public:
+ AIDoesntHaveItemCondition(const ItemID);
+
+ virtual bool fireCondition();
+
+protected:
+ ItemID _item;
+};
+
+/////////////////////////////////////////////
+//
+// AICurrentItemCondition
+
+class AICurrentItemCondition : public AICondition {
+public:
+ AICurrentItemCondition(const ItemID);
+
+ virtual bool fireCondition();
+
+protected:
+ ItemID _item;
+};
+
+/////////////////////////////////////////////
+//
+// AICurrentBiochipCondition
+
+class AICurrentBiochipCondition : public AICondition {
+public:
+ AICurrentBiochipCondition(const ItemID);
+
+ virtual bool fireCondition();
+
+protected:
+ ItemID _biochip;
+};
+
+/////////////////////////////////////////////
+//
+// AIItemStateCondition
+
+class AIItemStateCondition : public AICondition {
+public:
+ AIItemStateCondition(const ItemID, const ItemState);
+
+ virtual bool fireCondition();
+
+protected:
+ ItemID _item;
+ ItemState _state;
+};
+
+/////////////////////////////////////////////
+//
+// AIEnergyMonitorCondition
+
+class AIEnergyMonitorCondition : public AICondition {
+public:
+ AIEnergyMonitorCondition(const int32);
+
+ virtual bool fireCondition();
+
+protected:
+ int32 _energyThreshold;
+};
+
+/////////////////////////////////////////////
+//
+// AILastExtraCondition
+
+class AILastExtraCondition : public AICondition {
+public:
+ AILastExtraCondition(const ExtraID);
+
+ virtual bool fireCondition();
+
+protected:
+ ExtraID _lastExtra;
+};
+
+/////////////////////////////////////////////
+//
+// Helper functions
+
+AICondition *makeLocationAndDoesntHaveItemCondition(const RoomID room, const DirectionConstant direction, const ItemID item);
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/ai/ai_rule.cpp b/engines/pegasus/ai/ai_rule.cpp
new file mode 100644
index 0000000000..3aaa530a4a
--- /dev/null
+++ b/engines/pegasus/ai/ai_rule.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/stream.h"
+
+#include "pegasus/ai/ai_action.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/ai/ai_condition.h"
+#include "pegasus/ai/ai_rule.h"
+
+namespace Pegasus {
+
+bool AIRule::fireRule() {
+ if (_ruleActive && _ruleCondition && _ruleAction && _ruleCondition->fireCondition()) {
+ if (g_AIArea)
+ g_AIArea->lockAIOut();
+
+ _ruleAction->performAIAction(this);
+
+ if (--_ruleAction->_actionCount <= 0)
+ deactivateRule();
+
+ if (g_AIArea)
+ g_AIArea->unlockAI();
+
+ return true;
+ }
+
+ return false;
+}
+
+void AIRule::writeAIRule(Common::WriteStream *stream) {
+ stream->writeByte(_ruleActive);
+
+ if (_ruleCondition)
+ _ruleCondition->writeAICondition(stream);
+}
+
+void AIRule::readAIRule(Common::ReadStream *stream) {
+ _ruleActive = stream->readByte();
+
+ if (_ruleCondition)
+ _ruleCondition->readAICondition(stream);
+}
+
+void AIRuleList::writeAIRules(Common::WriteStream *stream) {
+ for (AIRuleList::iterator it = begin(); it != end(); it++)
+ (*it)->writeAIRule(stream);
+}
+
+void AIRuleList::readAIRules(Common::ReadStream *stream) {
+ for (AIRuleList::iterator it = begin(); it != end(); it++)
+ (*it)->readAIRule(stream);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/ai/ai_rule.h b/engines/pegasus/ai/ai_rule.h
new file mode 100644
index 0000000000..aa2ca07332
--- /dev/null
+++ b/engines/pegasus/ai/ai_rule.h
@@ -0,0 +1,86 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_AI_AIRULE_H
+#define PEGASUS_AI_AIRULE_H
+
+#include "common/list.h"
+
+#include "pegasus/ai/ai_action.h"
+#include "pegasus/ai/ai_condition.h"
+
+namespace Common {
+ class ReadStream;
+ class WriteStream;
+}
+
+namespace Pegasus {
+
+class AICondition;
+class AIAction;
+
+class AIRule {
+public:
+ AIRule(AICondition *condition, AIAction *rule) {
+ _ruleCondition = condition;
+ _ruleAction = rule;
+ _ruleActive = true;
+ }
+
+ ~AIRule() {
+ if (_ruleCondition)
+ delete _ruleCondition;
+
+ if (_ruleAction)
+ delete _ruleAction;
+ }
+
+ bool fireRule();
+
+ void activateRule() { _ruleActive = true; }
+ void deactivateRule() { _ruleActive = false; }
+ bool isRuleActive() { return _ruleActive; }
+
+ void writeAIRule(Common::WriteStream *);
+ void readAIRule(Common::ReadStream *);
+
+protected:
+ AICondition *_ruleCondition;
+ AIAction *_ruleAction;
+ bool _ruleActive;
+};
+
+class AIRuleList : public Common::List<AIRule *> {
+public:
+ AIRuleList() {}
+ ~AIRuleList() {}
+
+ void writeAIRules(Common::WriteStream *);
+ void readAIRules(Common::ReadStream *);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/compass.cpp b/engines/pegasus/compass.cpp
new file mode 100644
index 0000000000..5de8b91b11
--- /dev/null
+++ b/engines/pegasus/compass.cpp
@@ -0,0 +1,82 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/compass.h"
+
+namespace Pegasus {
+
+Compass *g_compass = 0;
+
+Compass::Compass() : FaderAnimation(kCompassID) {
+ // Initialize it to east...
+ setFaderValue(90);
+ g_compass = this;
+}
+
+Compass::~Compass() {
+ g_compass = 0;
+}
+
+void Compass::initCompass() {
+ if (!isCompassValid()) {
+ Common::Rect r;
+ _compassImage.initFromPICTFile("Images/Compass/Compass");
+ _compassImage.getSurfaceBounds(r);
+ r.right = kCompassWidth;
+ setBounds(r);
+ }
+}
+
+void Compass::deallocateCompass() {
+ _compassImage.deallocateSurface();
+}
+
+void Compass::setFaderValue(const int32 angle) {
+ int16 a = angle % 360;
+
+ if (a < 0)
+ a += 360;
+
+ FaderAnimation::setFaderValue(a);
+}
+
+void Compass::draw(const Common::Rect &r1) {
+ if (_compassImage.isSurfaceValid()) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ Common::Rect r2;
+ _compassImage.getSurfaceBounds(r2);
+
+ CoordType width = r2.width();
+ CoordType offsetH = width / 10 - bounds.width() / 2 + (getFaderValue() * width) / 450 - bounds.left;
+ CoordType offsetV = -bounds.top;
+ r2 = r1;
+ r2.translate(offsetH, offsetV);
+ _compassImage.drawImage(r2, r1);
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/compass.h b/engines/pegasus/compass.h
new file mode 100644
index 0000000000..67a8e06294
--- /dev/null
+++ b/engines/pegasus/compass.h
@@ -0,0 +1,58 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_COMPASS_H
+#define PEGASUS_COMPASS_H
+
+#include "pegasus/fader.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+// Compass is defined with 0 as north, 90 east, 180 south, 270 west.
+// Clockwise rotation increases the angle, counterclockwise rotation decreases the angle.
+
+class Compass : public FaderAnimation {
+public:
+ Compass();
+ virtual ~Compass();
+
+ void initCompass();
+ void deallocateCompass();
+ bool isCompassValid() const { return _compassImage.isSurfaceValid(); }
+
+ void setFaderValue(const int32);
+
+protected:
+ void draw(const Common::Rect &);
+
+ Frame _compassImage;
+};
+
+extern Compass *g_compass;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/console.cpp b/engines/pegasus/console.cpp
new file mode 100644
index 0000000000..64bd0ba5f2
--- /dev/null
+++ b/engines/pegasus/console.cpp
@@ -0,0 +1,102 @@
+/* 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 "pegasus/console.h"
+#include "pegasus/interface.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+PegasusConsole::PegasusConsole(PegasusEngine *vm) : GUI::Debugger(), _vm(vm) {
+ DCmd_Register("die", WRAP_METHOD(PegasusConsole, Cmd_Die));
+
+ // These functions are non-demo specific
+ if (!_vm->isDemo())
+ DCmd_Register("jump", WRAP_METHOD(PegasusConsole, Cmd_Jump));
+}
+
+PegasusConsole::~PegasusConsole() {
+}
+
+bool PegasusConsole::Cmd_Die(int argc, const char **argv) {
+ if (argc == 1) {
+ DebugPrintf("Usage: die <death reason>\n");
+ return true;
+ }
+
+ int reason = atoi(argv[1]);
+
+ bool invalidReason = (reason == 0 || reason > kPlayerWonGame);
+
+ if (!invalidReason && _vm->isDemo())
+ invalidReason = (reason != kDeathFallOffCliff) && (reason != kDeathEatenByDinosaur) &&
+ (reason != kDeathStranded) && (reason != kPlayerWonGame);
+
+
+ if (invalidReason) {
+ DebugPrintf("Invalid death reason %d\n", reason);
+ return true;
+ }
+
+ _vm->die(atoi(argv[1]));
+ return false;
+}
+
+bool PegasusConsole::Cmd_Jump(int argc, const char **argv) {
+ if (!g_interface) {
+ // TODO
+ DebugPrintf("Cannot jump without interface set up\n");
+ return true;
+ }
+
+ // TODO: Default room/direction for each neighborhood
+
+ if (argc < 4) {
+ DebugPrintf("Usage: jump <neighborhood> <room> <direction>\n");
+ return true;
+ }
+
+ NeighborhoodID neighborhood = (NeighborhoodID)atoi(argv[1]);
+ RoomID room = (RoomID)atoi(argv[2]);
+ DirectionConstant direction = (DirectionConstant)atoi(argv[3]);
+
+ if ((neighborhood < kCaldoriaID || neighborhood > kNoradDeltaID || neighborhood == kFinalTSAID) &&
+ neighborhood != kNoradSubChaseID) {
+ DebugPrintf("Invalid neighborhood %d", neighborhood);
+ return true;
+ }
+
+ // No real way to check room validity at this point
+
+ if (direction > kWest) {
+ DebugPrintf("Invalid direction %d", direction);
+ return true;
+ }
+
+ // Here we go!
+ // TODO: Can't clear menu since the engine is paused
+ _vm->jumpToNewEnvironment(neighborhood, room, direction);
+ return false;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/console.h b/engines/pegasus/console.h
new file mode 100644
index 0000000000..f00ee25294
--- /dev/null
+++ b/engines/pegasus/console.h
@@ -0,0 +1,46 @@
+/* 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 PEGASUS_CONSOLE_H
+#define PEGASUS_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Pegasus {
+
+class PegasusEngine;
+
+class PegasusConsole : public GUI::Debugger {
+public:
+ PegasusConsole(PegasusEngine *vm);
+ virtual ~PegasusConsole();
+
+private:
+ bool Cmd_Die(int argc, const char **argv);
+ bool Cmd_Jump(int argc, const char **argv);
+
+ PegasusEngine *_vm;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/constants.h b/engines/pegasus/constants.h
new file mode 100644
index 0000000000..f81d2197ac
--- /dev/null
+++ b/engines/pegasus/constants.h
@@ -0,0 +1,729 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_CONSTANTS_H
+#define PEGASUS_CONSTANTS_H
+
+#include "common/endian.h"
+#include "common/rect.h"
+
+#include "pegasus/types.h"
+
+namespace Pegasus {
+
+// TODO: Organize these
+
+static const GameID kGameIDNothing = -1;
+
+static const ActorID kNoActorID = kGameIDNothing;
+static const ActorID kPlayerID = 0;
+static const ItemID kNoItemID = kGameIDNothing;
+static const RoomID kNoRoomID = kGameIDNothing;
+static const ExtraID kNoExtraID = 0xFFFFFFFF;
+static const NeighborhoodID kNoNeighborhoodID = kGameIDNothing;
+static const AlternateID kNoAlternateID = 0;
+static const GameMenuCommand kMenuCmdNoCommand = 0;
+
+static const HotSpotActivationID kActivateHotSpotAlways = 0;
+static const HotSpotActivationID kActivateHotSpotNever = -1;
+
+static const ItemState kNoItemState = -1;
+
+static const DirectionConstant kNoDirection = 0xFF;
+static const DirectionConstant kNorth = 0;
+static const DirectionConstant kSouth = 1;
+static const DirectionConstant kEast = 2;
+static const DirectionConstant kWest = 3;
+
+static const TurnDirection kNoTurn = 0xFF;
+static const TurnDirection kTurnLeft = 0;
+static const TurnDirection kTurnRight = 1;
+static const TurnDirection kTurnUp = 2;
+static const TurnDirection kTurnDown = 3;
+static const TurnDirection kMaxTurns = 4;
+
+static const GameMode kNoMode = -1;
+static const GameMode kModeNavigation = 0;
+static const GameMode kLastGameShellMode = kModeNavigation;
+
+static const CanMoveForwardReason kCanMoveForward = 0;
+static const CanMoveForwardReason kCantMoveBlocked = kCanMoveForward + 1;
+static const CanMoveForwardReason kCantMoveDoorClosed = kCantMoveBlocked + 1;
+static const CanMoveForwardReason kCantMoveDoorLocked = kCantMoveDoorClosed + 1;
+static const CanMoveForwardReason kCantMoveLastReason = kCantMoveDoorLocked;
+
+static const CanTurnReason kCanTurn = 0;
+static const CanTurnReason kCantTurnNoTurn = kCanTurn + 1;
+static const CanTurnReason kCantTurnLastReason = kCantTurnNoTurn;
+
+static const CanOpenDoorReason kCanOpenDoor = 0;
+static const CanOpenDoorReason kCantOpenNoDoor = kCanOpenDoor + 1;
+static const CanOpenDoorReason kCantOpenLocked = kCantOpenNoDoor + 1;
+static const CanOpenDoorReason kCantOpenAlreadyOpen = kCantOpenLocked + 1;
+static const CanOpenDoorReason kCantOpenLastReason = kCantOpenAlreadyOpen;
+
+static const DisplayElementID kNoDisplayElement = -1;
+static const DisplayElementID kHighestReservedElementID = -2;
+
+static const DisplayElementID kCursorID = kHighestReservedElementID;
+static const DisplayElementID kLoadScreenID = kCursorID - 1;
+
+static const DisplayOrder kMinAvailableOrder = 0;
+static const DisplayOrder kMaxAvailableOrder = 999998;
+static const DisplayOrder kLoadScreenOrder = 900000;
+static const DisplayOrder kCursorOrder = 1000000;
+
+static const HotSpotID kNoHotSpotID = -1;
+static const HotSpotFlags kNoHotSpotFlags = 0;
+static const HotSpotFlags kAllHotSpotFlags = ~kNoHotSpotFlags;
+
+static const NotificationFlags kNoNotificationFlags = 0;
+
+static const DisplayElementID kCurrentDragSpriteID = 1000;
+
+static const TimeScale kDefaultTimeScale = 600;
+
+// Ticks per second.
+
+static const TimeScale kOneTickPerSecond = 1;
+static const TimeScale kTwoTicksPerSecond = 2;
+static const TimeScale kFifteenTicksPerSecond = 15;
+static const TimeScale kThirtyTicksPerSecond = 30;
+static const TimeScale kSixtyTicksPerSecond = 60;
+static const TimeScale kMovieTicksPerSecond = 600;
+
+// These times are in seconds.
+
+static const TimeValue kOneSecond = 1;
+static const TimeValue kTwoSeconds = 2;
+static const TimeValue kThreeSeconds = 3;
+static const TimeValue kFourSeconds = 4;
+static const TimeValue kFiveSeconds = 5;
+static const TimeValue kSixSeconds = 6;
+static const TimeValue kSevenSeconds = 7;
+static const TimeValue kEightSeconds = 8;
+static const TimeValue kNineSeconds = 9;
+static const TimeValue kTenSeconds = 10;
+static const TimeValue kElevenSeconds = 11;
+static const TimeValue kTwelveSeconds = 12;
+static const TimeValue kThirteenSeconds = 13;
+static const TimeValue kFourteenSeconds = 14;
+static const TimeValue kFifteenSeconds = 15;
+static const TimeValue kSixteenSeconds = 16;
+static const TimeValue kSeventeenSeconds = 17;
+static const TimeValue kEighteenSeconds = 18;
+static const TimeValue kNineteenSeconds = 19;
+static const TimeValue kTwentySeconds = 20;
+static const TimeValue kThirtySeconds = 30;
+static const TimeValue kFortySeconds = 40;
+static const TimeValue kFiftySeconds = 50;
+static const TimeValue kSixtySeconds = 60;
+static const TimeValue kOneMinute = 60;
+static const TimeValue kTwoMinutes = kOneMinute * 2;
+static const TimeValue kThreeMinutes = kOneMinute * 3;
+static const TimeValue kFourMinutes = kOneMinute * 4;
+static const TimeValue kFiveMinutes = kOneMinute * 5;
+static const TimeValue kSixMinutes = kOneMinute * 6;
+static const TimeValue kSevenMinutes = kOneMinute * 7;
+static const TimeValue kEightMinutes = kOneMinute * 8;
+static const TimeValue kNineMinutes = kOneMinute * 9;
+static const TimeValue kTenMinutes = kOneMinute * 10;
+static const TimeValue kElevenMinutes = kOneMinute * 11;
+static const TimeValue kTwelveMinutes = kOneMinute * 12;
+static const TimeValue kThirteenMinutes = kOneMinute * 13;
+static const TimeValue kFourteenMinutes = kOneMinute * 14;
+static const TimeValue kFifteenMinutes = kOneMinute * 15;
+static const TimeValue kSixteenMinutes = kOneMinute * 16;
+static const TimeValue kSeventeenMinutes = kOneMinute * 17;
+static const TimeValue kEighteenMinutes = kOneMinute * 18;
+static const TimeValue kNineteenMinutes = kOneMinute * 19;
+static const TimeValue kTwentyMinutes = kOneMinute * 20;
+static const TimeValue kThirtyMinutes = kOneMinute * 30;
+static const TimeValue kFortyMinutes = kOneMinute * 40;
+static const TimeValue kFiftyMinutes = kOneMinute * 50;
+static const TimeValue kOneHour = kOneMinute * 60;
+static const TimeValue kTwoHours = kOneHour * 2;
+
+// Common times.
+
+static const TimeValue kHalfSecondPerTwoTicks = kTwoTicksPerSecond / 2;
+static const TimeValue kHalfSecondPerThirtyTicks = kThirtyTicksPerSecond / 2;
+static const TimeValue kHalfSecondPerSixtyTicks = kSixtyTicksPerSecond / 2;
+
+static const TimeValue kOneSecondPerTwoTicks = kTwoTicksPerSecond;
+static const TimeValue kOneSecondPerThirtyTicks = kThirtyTicksPerSecond;
+static const TimeValue kOneSecondPerSixtyTicks = kSixtyTicksPerSecond;
+
+static const TimeValue kOneMinutePerFifteenTicks = kOneMinute * kFifteenTicksPerSecond;
+static const TimeValue kFiveMinutesPerFifteenTicks = kFiveMinutes * kFifteenTicksPerSecond;
+static const TimeValue kTenMinutesPerFifteenTicks = kTenMinutes * kFifteenTicksPerSecond;
+
+static const TimeValue kOneMinutePerThirtyTicks = kOneMinute * kThirtyTicksPerSecond;
+static const TimeValue kFiveMinutesPerThirtyTicks = kFiveMinutes * kThirtyTicksPerSecond;
+static const TimeValue kTenMinutesPerThirtyTicks = kTenMinutes * kThirtyTicksPerSecond;
+
+static const TimeValue kOneMinutePerSixtyTicks = kOneMinute * kSixtyTicksPerSecond;
+static const TimeValue kFiveMinutesPerSixtyTicks = kFiveMinutes * kSixtyTicksPerSecond;
+static const TimeValue kTenMinutesPerSixtyTicks = kTenMinutes * kSixtyTicksPerSecond;
+
+// Time in seconds you can hang around Caldoria without going to work...
+static const TimeValue kLateWarning2TimeLimit = kFiveMinutes;
+static const TimeValue kLateWarning3TimeLimit = kTenMinutes;
+
+static const TimeValue kSinclairShootsTimeLimit = kThreeMinutes;
+static const TimeValue kCardBombCountDownTime = kTwelveSeconds;
+
+static const TimeValue kOxyMaskFullTime = kThirtyMinutes;
+
+static const TimeValue kTSAUncreatedTimeLimit = kFiveMinutes;
+static const TimeValue kRipTimeLimit = kTenMinutesPerFifteenTicks;
+static const TimeScale kRipTimeScale = kFifteenTicksPerSecond;
+
+static const TimeValue kIntroTimeOut = kThirtySeconds;
+
+static const TimeValue kMarsRobotPatienceLimit = kFifteenSeconds;
+static const TimeValue kLockFreezeTimeLmit = kFifteenSeconds;
+static const TimeValue kSpaceChaseTimeLimit = kTenMinutes;
+static const TimeValue kVacuumSurvivalTimeLimit = kThirtySeconds;
+static const TimeValue kColorMatchingTimeLimit = kFourMinutes;
+static const TimeScale kJunkTimeScale = kFifteenTicksPerSecond;
+static const TimeValue kJunkDropBaseTime = kFiveSeconds;
+static const TimeValue kJunkDropSlopTime = kThreeSeconds;
+static const TimeValue kJunkTravelTime = kTenSeconds * kJunkTimeScale;
+static const TimeValue kCollisionReboundTime = kOneSecond * kJunkTimeScale;
+static const TimeValue kWeaponReboundTime = kTwoSeconds * kJunkTimeScale;
+
+static const TimeValue kGawkAtRobotTime = kTenSeconds;
+static const TimeValue kGawkAtRobotTime2 = kThirteenSeconds;
+static const TimeValue kPlasmaImpactTime = kTwoSeconds;
+
+static const TimeValue kNoradAirMaskTimeLimit = kOneMinute + kFifteenSeconds;
+
+static const NotificationID kNeighborhoodNotificationID = 1;
+static const NotificationID kLastNeighborhoodNotificationID = kNeighborhoodNotificationID;
+
+static const NotificationFlags kNeighborhoodMovieCompletedFlag = 1;
+static const NotificationFlags kMoveForwardCompletedFlag = kNeighborhoodMovieCompletedFlag << 1;
+static const NotificationFlags kStrideCompletedFlag = kMoveForwardCompletedFlag << 1;
+static const NotificationFlags kTurnCompletedFlag = kStrideCompletedFlag << 1;
+static const NotificationFlags kSpotCompletedFlag = kTurnCompletedFlag << 1;
+static const NotificationFlags kDoorOpenCompletedFlag = kSpotCompletedFlag << 1;
+static const NotificationFlags kExtraCompletedFlag = kDoorOpenCompletedFlag << 1;
+static const NotificationFlags kSpotSoundCompletedFlag = kExtraCompletedFlag << 1;
+static const NotificationFlags kDelayCompletedFlag = kSpotSoundCompletedFlag << 1;
+static const NotificationFlags kActionRequestCompletedFlag = kDelayCompletedFlag << 1;
+static const NotificationFlags kDeathExtraCompletedFlag = kActionRequestCompletedFlag << 1;
+static const NotificationFlags kLastNeighborhoodNotificationFlag = kDeathExtraCompletedFlag;
+
+static const NotificationFlags kNeighborhoodFlags = kNeighborhoodMovieCompletedFlag |
+ kMoveForwardCompletedFlag |
+ kStrideCompletedFlag |
+ kTurnCompletedFlag |
+ kSpotCompletedFlag |
+ kDoorOpenCompletedFlag |
+ kExtraCompletedFlag |
+ kSpotSoundCompletedFlag |
+ kDelayCompletedFlag |
+ kActionRequestCompletedFlag |
+ kDeathExtraCompletedFlag;
+
+static const uint32 kPegasusPrimeCreator = MKTAG('J', 'P', 'P', 'P');
+static const uint32 kPegasusPrimeContinueType = MKTAG('P', 'P', 'C', 'T');
+
+static const uint32 kPegasusPrimeDisk1GameType = MKTAG('P', 'P', 'G', '1');
+static const uint32 kPegasusPrimeDisk2GameType = MKTAG('P', 'P', 'G', '2');
+static const uint32 kPegasusPrimeDisk3GameType = MKTAG('P', 'P', 'G', '3');
+static const uint32 kPegasusPrimeDisk4GameType = MKTAG('P', 'P', 'G', '4');
+
+// We only support one of the save versions; the rest are from betas
+// and we are not supporting them.
+static const uint32 kPegasusPrimeVersion = 0x00009019;
+
+static const char kNormalSave = 0;
+static const char kContinueSave = 1;
+
+// Display IDs.
+
+static const DisplayElementID kNavMovieID = 1;
+static const DisplayElementID kTurnPushID = 2;
+
+static const DisplayElementID kMaxGameShellDisplayID = kTurnPushID;
+
+// Display ordering.
+
+static const DisplayOrder kNavLayer = 10000;
+static const DisplayOrder kNavMovieOrder = kNavLayer;
+static const DisplayOrder kTurnPushOrder = kNavMovieOrder + 1;
+
+/////////////////////////////////////////////
+//
+// Display IDs.
+
+static const DisplayElementID kScreenDimmerID = kMaxGameShellDisplayID + 1;
+static const DisplayElementID kInterface1ID = kScreenDimmerID + 1;
+static const DisplayElementID kInterface2ID = kInterface1ID + 1;
+static const DisplayElementID kInterface3ID = kInterface2ID + 1;
+static const DisplayElementID kInterface4ID = kInterface3ID + 1;
+static const DisplayElementID kDateID = kInterface4ID + 1;
+static const DisplayElementID kCompassID = kDateID + 1;
+static const DisplayElementID kInventoryPushID = kCompassID + 1;
+static const DisplayElementID kInventoryLidID = kInventoryPushID + 1;
+static const DisplayElementID kBiochipPushID = kInventoryLidID + 1;
+static const DisplayElementID kBiochipLidID = kBiochipPushID + 1;
+static const DisplayElementID kEnergyBarID = kBiochipLidID + 1;
+static const DisplayElementID kWarningLightID = kEnergyBarID + 1;
+static const DisplayElementID kAILeftAreaID = kWarningLightID + 1;
+static const DisplayElementID kAIMiddleAreaID = kAILeftAreaID + 1;
+static const DisplayElementID kAIRightAreaID = kAIMiddleAreaID + 1;
+static const DisplayElementID kAIMovieID = kAIRightAreaID + 1;
+static const DisplayElementID kInventoryDropHighlightID = kAIMovieID + 1;
+static const DisplayElementID kBiochipDropHighlightID = kInventoryDropHighlightID + 1;
+
+static const DisplayElementID kDraggingSpriteID = 1000;
+
+static const DisplayElementID kCroppedMovieID = 2000;
+
+static const DisplayElementID kNeighborhoodDisplayID = 3000;
+
+static const DisplayElementID kItemPictureBaseID = 5000;
+
+static const CoordType kNavAreaLeft = 64;
+static const CoordType kNavAreaTop = 64;
+
+static const CoordType kBackground1Left = 0;
+static const CoordType kBackground1Top = 64;
+
+static const CoordType kBackground2Left = 0;
+static const CoordType kBackground2Top = 0;
+
+static const CoordType kBackground3Left = 576;
+static const CoordType kBackground3Top = 64;
+
+static const CoordType kBackground4Left = 0;
+static const CoordType kBackground4Top = 320;
+
+static const CoordType kOverviewControllerLeft = 540;
+static const CoordType kOverviewControllerTop = 348;
+
+static const CoordType kSwapLeft = 194;
+static const CoordType kSwapTop = 116;
+
+static const CoordType kSwapHiliteLeft = 200;
+static const CoordType kSwapHiliteTop = 206;
+
+static const CoordType kDateLeft = 136;
+static const CoordType kDateTop = 44;
+
+static const CoordType kCompassLeft = 222;
+static const CoordType kCompassTop = 42;
+static const CoordType kCompassWidth = 92;
+
+static const CoordType kInventoryPushLeft = 74;
+static const CoordType kInventoryPushTop = 92;
+
+static const CoordType kInventoryLidLeft = 74;
+static const CoordType kInventoryLidTop = 316;
+
+static const CoordType kBiochipPushLeft = 362;
+static const CoordType kBiochipPushTop = 192;
+
+static const CoordType kBiochipLidLeft = 362;
+static const CoordType kBiochipLidTop = 316;
+
+static const CoordType kInventoryDropLeft = 0;
+static const CoordType kInventoryDropTop = 320;
+static const CoordType kInventoryDropRight = 232;
+static const CoordType kInventoryDropBottom = 480;
+
+static const CoordType kBiochipDropLeft = 302;
+static const CoordType kBiochipDropTop = 320;
+static const CoordType kBiochipDropRight = 640;
+static const CoordType kBiochipDropBottom = 480;
+
+static const CoordType kFinalMessageLeft = kInventoryPushLeft + 1;
+static const CoordType kFinalMessageTop = kInventoryPushTop + 24;
+
+/////////////////////////////////////////////
+//
+// Notifications.
+
+static const NotificationID kJMPDCShellNotificationID = kLastNeighborhoodNotificationID + 1;
+static const NotificationID kInterfaceNotificationID = kJMPDCShellNotificationID + 1;
+static const NotificationID kAINotificationID = kInterfaceNotificationID + 1;
+static const NotificationID kNoradNotificationID = kAINotificationID + 1;
+static const NotificationID kNoradECRNotificationID = kNoradNotificationID + 1;
+static const NotificationID kNoradFillingStationNotificationID = kNoradECRNotificationID + 1;
+static const NotificationID kNoradPressureNotificationID = kNoradFillingStationNotificationID + 1;
+static const NotificationID kNoradUtilityNotificationID = kNoradPressureNotificationID + 1;
+static const NotificationID kNoradElevatorNotificationID = kNoradUtilityNotificationID + 1;
+static const NotificationID kNoradSubPlatformNotificationID = kNoradElevatorNotificationID + 1;
+static const NotificationID kSubControlNotificationID = kNoradSubPlatformNotificationID + 1;
+static const NotificationID kNoradGreenBallNotificationID = kSubControlNotificationID + 1;
+static const NotificationID kNoradGlobeNotificationID = kNoradGreenBallNotificationID + 1;
+static const NotificationID kCaldoriaVidPhoneNotificationID = kNoradGlobeNotificationID + 1;
+static const NotificationID kCaldoriaMessagesNotificationID = kCaldoriaVidPhoneNotificationID + 1;
+static const NotificationID kCaldoriaBombTimerNotificationID = kCaldoriaMessagesNotificationID + 1;
+
+// Sent to the shell by fShellNotification.
+static const NotificationFlags kGameStartingFlag = 1;
+static const NotificationFlags kNeedNewJumpFlag = kGameStartingFlag << 1;
+static const NotificationFlags kPlayerDiedFlag = kNeedNewJumpFlag << 1;
+
+static const NotificationFlags kJMPShellNotificationFlags = kGameStartingFlag |
+ kNeedNewJumpFlag |
+ kPlayerDiedFlag;
+
+// Sent to the interface.
+static const NotificationFlags kInventoryLidOpenFlag = 1;
+static const NotificationFlags kInventoryLidClosedFlag = kInventoryLidOpenFlag << 1;
+static const NotificationFlags kInventoryDrawerUpFlag = kInventoryLidClosedFlag << 1;
+static const NotificationFlags kInventoryDrawerDownFlag = kInventoryDrawerUpFlag << 1;
+static const NotificationFlags kBiochipLidOpenFlag = kInventoryDrawerDownFlag << 1;
+static const NotificationFlags kBiochipLidClosedFlag = kBiochipLidOpenFlag << 1;
+static const NotificationFlags kBiochipDrawerUpFlag = kBiochipLidClosedFlag << 1;
+static const NotificationFlags kBiochipDrawerDownFlag = kBiochipDrawerUpFlag << 1;
+
+static const NotificationFlags kInterfaceNotificationFlags = kInventoryLidOpenFlag |
+ kInventoryLidClosedFlag |
+ kInventoryDrawerUpFlag |
+ kInventoryDrawerDownFlag |
+ kBiochipLidOpenFlag |
+ kBiochipLidClosedFlag |
+ kBiochipDrawerUpFlag |
+ kBiochipDrawerDownFlag;
+
+// Hot spots.
+
+// Neighborhood hot spots.
+
+static const HotSpotID kFirstNeighborhoodSpotID = 5000;
+
+// kShellSpotFlag is a flag which marks all hot spots which belong to the shell, like
+// the current item and current biochip spots.
+static const HotSpotFlags kShellSpotFlag = 1;
+// kNeighborhoodSpotFlag is a flag which marks all hot spots which belong to a
+// neighborhood, like buttons on walls and so on.
+static const HotSpotFlags kNeighborhoodSpotFlag = kShellSpotFlag << 1;
+// kZoomInSpotFlag is a flag which marks all hot spots which indicate a zoom.
+static const HotSpotFlags kZoomInSpotFlag = kNeighborhoodSpotFlag << 1;
+// kZoomOutSpotFlag is a flag which marks all hot spots which indicate a zoom.
+static const HotSpotFlags kZoomOutSpotFlag = kZoomInSpotFlag << 1;
+
+static const HotSpotFlags kClickSpotFlag = kZoomOutSpotFlag << 1;
+static const HotSpotFlags kPlayExtraSpotFlag = kClickSpotFlag << 1;
+static const HotSpotFlags kPickUpItemSpotFlag = kPlayExtraSpotFlag << 1;
+static const HotSpotFlags kDropItemSpotFlag = kPickUpItemSpotFlag << 1;
+static const HotSpotFlags kOpenDoorSpotFlag = kDropItemSpotFlag << 1;
+
+static const HotSpotFlags kZoomSpotFlags = kZoomInSpotFlag | kZoomOutSpotFlag;
+
+static const HotSpotFlags kHighestGameShellSpotFlag = kOpenDoorSpotFlag;
+
+/////////////////////////////////////////////
+//
+// Hot spots.
+
+// Shell hot spots.
+// The shell reserves all hot spot IDs from 0 to 999
+
+static const HotSpotID kCurrentItemSpotID = 0;
+static const HotSpotID kCurrentBiochipSpotID = kCurrentItemSpotID + 1;
+
+static const HotSpotID kInventoryDropSpotID = kCurrentBiochipSpotID + 1;
+static const HotSpotID kBiochipDropSpotID = kInventoryDropSpotID + 1;
+
+static const HotSpotID kInfoReturnSpotID = kBiochipDropSpotID + 1;
+
+static const HotSpotID kAIHint1SpotID = kInfoReturnSpotID + 1;
+static const HotSpotID kAIHint2SpotID = kAIHint1SpotID + 1;
+static const HotSpotID kAIHint3SpotID = kAIHint2SpotID + 1;
+static const HotSpotID kAISolveSpotID = kAIHint3SpotID + 1;
+static const HotSpotID kAIBriefingSpotID = kAISolveSpotID + 1;
+static const HotSpotID kAIScanSpotID = kAIBriefingSpotID + 1;
+
+static const HotSpotID kPegasusRecallSpotID = kAIScanSpotID + 1;
+
+static const HotSpotID kAriesSpotID = kPegasusRecallSpotID + 1;
+static const HotSpotID kMercurySpotID = kAriesSpotID + 1;
+static const HotSpotID kPoseidonSpotID = kMercurySpotID + 1;
+
+static const HotSpotID kAirMaskToggleSpotID = kPoseidonSpotID + 1;
+
+static const HotSpotID kShuttleEnergySpotID = kAirMaskToggleSpotID + 1;
+static const HotSpotID kShuttleGravitonSpotID = kShuttleEnergySpotID + 1;
+static const HotSpotID kShuttleTractorSpotID = kShuttleGravitonSpotID + 1;
+static const HotSpotID kShuttleViewSpotID = kShuttleTractorSpotID + 1;
+static const HotSpotID kShuttleTransportSpotID = kShuttleViewSpotID + 1;
+
+// Most of these are obsolete:
+
+// kInventoryDropSpotFlag is a flag which marks hot spots which are valid drop spots
+// for inventory items.
+// static const HotSpotFlags kInventoryDropSpotFlag = kHighestGameShellSpotFlag << 1;
+
+// kBiochipDropSpotFlag is a flag which marks hot spots which are valid drop spots
+// for biochips.
+// static const HotSpotFlags kBiochipDropSpotFlag = kInventoryDropSpotFlag << 1;
+
+// kInventorySpotFlag is a flag which marks hot spots which indicate inventory items
+// in the environment.
+// static const HotSpotFlags kInventorySpotFlag = kBiochipDropSpotFlag << 1;
+
+// kBiochipSpotFlag is a flag which marks hot spots which indicate biochips
+// in the environment.
+static const HotSpotFlags kPickUpBiochipSpotFlag = kHighestGameShellSpotFlag << 1;
+static const HotSpotFlags kDropBiochipSpotFlag = kPickUpBiochipSpotFlag << 1;
+
+static const HotSpotFlags kInfoReturnSpotFlag = kDropBiochipSpotFlag << 1;
+
+// Biochip and inventory hot spot flags...
+
+static const HotSpotFlags kAIBiochipSpotFlag = kInfoReturnSpotFlag << 1;
+static const HotSpotFlags kPegasusBiochipSpotFlag = kAIBiochipSpotFlag << 1;
+static const HotSpotFlags kOpticalBiochipSpotFlag = kPegasusBiochipSpotFlag << 1;
+static const HotSpotFlags kAirMaskSpotFlag = kOpticalBiochipSpotFlag << 1;
+
+static const HotSpotFlags kJMPClickingSpotFlags = kClickSpotFlag |
+ kPlayExtraSpotFlag |
+ kOpenDoorSpotFlag |
+ kInfoReturnSpotFlag |
+ kAIBiochipSpotFlag |
+ kPegasusBiochipSpotFlag |
+ kOpticalBiochipSpotFlag |
+ kAirMaskSpotFlag;
+
+static const int32 kMainMenuID = 1;
+static const int32 kPauseMenuID = 2;
+static const int32 kCreditsMenuID = 3;
+static const int32 kDeathMenuID = 4;
+
+/////////////////////////////////////////////
+//
+// Menu commands.
+
+static const GameMenuCommand kMenuCmdOverview = kMenuCmdNoCommand + 1;
+static const GameMenuCommand kMenuCmdStartAdventure = kMenuCmdOverview + 1;
+static const GameMenuCommand kMenuCmdStartWalkthrough = kMenuCmdStartAdventure + 1;
+static const GameMenuCommand kMenuCmdRestore = kMenuCmdStartWalkthrough + 1;
+static const GameMenuCommand kMenuCmdCredits = kMenuCmdRestore + 1;
+static const GameMenuCommand kMenuCmdQuit = kMenuCmdCredits + 1;
+
+static const GameMenuCommand kMenuCmdDeathContinue = kMenuCmdQuit + 1;
+
+static const GameMenuCommand kMenuCmdDeathQuitDemo = kMenuCmdDeathContinue + 1;
+static const GameMenuCommand kMenuCmdDeathMainMenuDemo = kMenuCmdDeathQuitDemo + 1;
+
+static const GameMenuCommand kMenuCmdDeathRestore = kMenuCmdDeathMainMenuDemo + 1;
+static const GameMenuCommand kMenuCmdDeathMainMenu = kMenuCmdDeathRestore + 1;
+
+static const GameMenuCommand kMenuCmdPauseSave = kMenuCmdDeathMainMenu + 1;
+static const GameMenuCommand kMenuCmdPauseContinue = kMenuCmdPauseSave + 1;
+static const GameMenuCommand kMenuCmdPauseRestore = kMenuCmdPauseContinue + 1;
+static const GameMenuCommand kMenuCmdPauseQuit = kMenuCmdPauseRestore + 1;
+
+static const GameMenuCommand kMenuCmdCreditsMainMenu = kMenuCmdPauseQuit + 1;
+
+static const GameMenuCommand kMenuCmdCancelRestart = kMenuCmdCreditsMainMenu + 1;
+static const GameMenuCommand kMenuCmdEjectRestart = kMenuCmdCancelRestart + 1;
+
+static const TimeValue kMenuButtonHiliteTime = 20;
+static const TimeScale kMenuButtonHiliteScale = kSixtyTicksPerSecond;
+
+// PICT resources:
+
+// Warning light PICTs:
+
+static const ResIDType kLightOffID = 128;
+static const ResIDType kLightYellowID = 129;
+static const ResIDType kLightOrangeID = 130;
+static const ResIDType kLightRedID = 131;
+
+// Date PICTs:
+
+static const ResIDType kDatePrehistoricID = 138;
+static const ResIDType kDate2112ID = 139;
+static const ResIDType kDate2185ID = 140;
+static const ResIDType kDate2310ID = 141;
+static const ResIDType kDate2318ID = 142;
+
+/////////////////////////////////////////////
+//
+// Display Order
+
+static const DisplayOrder kCroppedMovieLayer = 11000;
+
+static const DisplayOrder kMonitorLayer = 12000;
+
+static const DisplayOrder kDragSpriteLayer = 15000;
+static const DisplayOrder kDragSpriteOrder = kDragSpriteLayer;
+
+static const DisplayOrder kInterfaceLayer = 20000;
+static const DisplayOrder kBackground1Order = kInterfaceLayer;
+static const DisplayOrder kBackground2Order = kBackground1Order + 1;
+static const DisplayOrder kBackground3Order = kBackground2Order + 1;
+static const DisplayOrder kBackground4Order = kBackground3Order + 1;
+static const DisplayOrder kDateOrder = kBackground4Order + 1;
+static const DisplayOrder kCompassOrder = kDateOrder + 1;
+static const DisplayOrder kEnergyBarOrder = kCompassOrder + 1;
+static const DisplayOrder kEnergyLightOrder = kEnergyBarOrder + 1;
+
+static const DisplayOrder kAILayer = 22000;
+static const DisplayOrder kAILeftAreaOrder = kAILayer;
+static const DisplayOrder kAIMiddleAreaOrder = kAILeftAreaOrder + 1;
+static const DisplayOrder kAIRightAreaOrder = kAIMiddleAreaOrder + 1;
+static const DisplayOrder kAIMovieOrder = kAIRightAreaOrder + 1;
+
+static const DisplayOrder kHilitesLayer = 23000;
+static const DisplayOrder kInventoryHiliteOrder = kHilitesLayer;
+static const DisplayOrder kBiochipHiliteOrder = kInventoryHiliteOrder + 1;
+
+static const DisplayOrder kPanelsLayer = 25000;
+static const DisplayOrder kInventoryPushOrder = kPanelsLayer;
+static const DisplayOrder kInventoryLidOrder = kInventoryPushOrder + 1;
+static const DisplayOrder kBiochipPushOrder = kInventoryLidOrder + 1;
+static const DisplayOrder kBiochipLidOrder = kBiochipPushOrder + 1;
+static const DisplayOrder kFinalMessageOrder = kBiochipLidOrder + 1;
+
+static const DisplayOrder kInfoLayer = 26000;
+static const DisplayOrder kInfoBackgroundOrder = kInfoLayer;
+static const DisplayOrder kInfoSpinOrder = kInfoBackgroundOrder + 1;
+
+static const DisplayOrder kScreenDimmerOrder = 30000;
+
+static const DisplayOrder kPauseScreenLayer = 31000;
+static const DisplayOrder kPauseMenuOrder = kPauseScreenLayer;
+static const DisplayOrder kSaveGameOrder = kPauseMenuOrder + 1;
+static const DisplayOrder kContinueOrder = kSaveGameOrder + 1;
+static const DisplayOrder kRestoreOrder = kContinueOrder + 1;
+static const DisplayOrder kSoundFXOrder = kRestoreOrder + 1;
+static const DisplayOrder kAmbienceOrder = kSoundFXOrder + 1;
+static const DisplayOrder kWalkthruOrder = kAmbienceOrder + 1;
+static const DisplayOrder kQuitToMainMenuOrder = kWalkthruOrder + 1;
+static const DisplayOrder kPauseLargeHiliteOrder = kQuitToMainMenuOrder + 1;
+static const DisplayOrder kPauseSmallHiliteOrder = kPauseLargeHiliteOrder + 1;
+
+/////////////////////////////////////////////
+//
+// Death reasons.
+enum {
+ // Caldoria
+ kDeathUncreatedInCaldoria = 1,
+ kDeathCardBomb,
+ kDeathShotBySinclair,
+ kDeathSinclairShotDelegate,
+ kDeathNuclearExplosion,
+
+ // TSA
+ kDeathUncreatedInTSA,
+ kDeathShotByTSARobots,
+
+ // Prehistoric
+ kDeathFallOffCliff,
+ kDeathEatenByDinosaur,
+ kDeathStranded,
+
+ // Norad
+ kDeathGassedInNorad,
+ kDeathArrestedInNorad,
+ kDeathWokeUpNorad,
+ kDeathSubDestroyed, // Unused
+ kDeathRobotThroughNoradDoor,
+ kDeathRobotSubControlRoom,
+
+ // Mars
+ kDeathWrongShuttleLock,
+ kDeathArrestedInMars,
+ kDeathRunOverByPod,
+ kDeathDidntGetOutOfWay,
+ kDeathReactorBurn,
+ kDeathDidntFindMarsBomb,
+ kDeathDidntDisarmMarsBomb,
+ kDeathNoMaskInMaze,
+ kDeathNoAirInMaze,
+ kDeathGroundByMazebot,
+ kDeathMissedOreBucket,
+ kDeathDidntLeaveBucket,
+ kDeathRanIntoCanyonWall, // Unused
+ kDeathRanIntoSpaceJunk,
+
+ // WSC
+ kDeathDidntStopPoison,
+ kDeathArrestedInWSC,
+ kDeathHitByPlasma,
+ kDeathShotOnCatwalk,
+
+ // Winning
+ kPlayerWonGame
+};
+
+static const CoordType kAILeftAreaLeft = 76;
+static const CoordType kAILeftAreaTop = 334;
+
+static const CoordType kAILeftAreaWidth = 96;
+static const CoordType kAILeftAreaHeight = 96;
+
+static const CoordType kAIMiddleAreaLeft = 172;
+static const CoordType kAIMiddleAreaTop = 334;
+
+static const CoordType kAIMiddleAreaWidth = 192;
+static const CoordType kAIMiddleAreaHeight = 96;
+
+static const CoordType kAIRightAreaLeft = 364;
+static const CoordType kAIRightAreaTop = 334;
+
+static const CoordType kAIRightAreaWidth = 96;
+static const CoordType kAIRightAreaHeight = 96;
+
+enum {
+ kTSAPlayerNotArrived, // initial state, must be zero
+ kTSAPlayerForcedReview, // Player must watch TBP before rip occurs.
+ kTSAPlayerDetectedRip, // Player finished TBP, rip alarm just went off.
+ kTSAPlayerNeedsHistoricalLog, // Player is instructed to get historical log
+ kTSAPlayerGotHistoricalLog,
+ kTSAPlayerInstalledHistoricalLog,
+ kTSABossSawHistoricalLog,
+ kRobotsAtCommandCenter,
+ kRobotsAtFrontDoor,
+ kRobotsAtReadyRoom,
+ kPlayerLockedInPegasus,
+ kPlayerOnWayToPrehistoric,
+ kPlayerWentToPrehistoric,
+ kPlayerOnWayToNorad,
+ kPlayerOnWayToMars,
+ kPlayerOnWayToWSC,
+ kPlayerFinishedWithTSA
+};
+
+/////////////////////////////////////////////
+//
+// Mode static constants.
+
+static const GameMode kModeInventoryPick = kLastGameShellMode + 1;
+static const GameMode kModeBiochipPick = kModeInventoryPick + 1;
+static const GameMode kModeInfoScreen = kModeBiochipPick + 1;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
new file mode 100644
index 0000000000..5babdf34af
--- /dev/null
+++ b/engines/pegasus/cursor.cpp
@@ -0,0 +1,213 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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"
+#include "common/stream.h"
+#include "common/system.h"
+#include "graphics/cursorman.h"
+#include "graphics/surface.h"
+#include "graphics/decoders/pict.h"
+
+#include "pegasus/cursor.h"
+#include "pegasus/graphics.h"
+#include "pegasus/pegasus.h"
+
+namespace Pegasus {
+
+Cursor::Cursor() {
+ _cursorObscured = false;
+ _index = -1;
+ startIdling();
+}
+
+Cursor::~Cursor() {
+ for (uint32 i = 0; i < _info.size(); i++) {
+ if (_info[i].surface) {
+ _info[i].surface->free();
+ delete _info[i].surface;
+ }
+ delete[] _info[i].palette;
+ }
+
+ stopIdling();
+}
+
+void Cursor::addCursorFrames(uint16 id) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ Common::SeekableReadStream *cursStream = vm->_resFork->getResource(MKTAG('C', 'u', 'r', 's'), id);
+ if (!cursStream)
+ error("Could not load cursor frames set %d", id);
+
+ uint16 frameCount = cursStream->readUint16BE();
+ for (uint16 i = 0; i < frameCount; i++) {
+ CursorInfo info;
+ info.tag = cursStream->readUint16BE();
+ info.hotspot.x = cursStream->readUint16BE();
+ info.hotspot.y = cursStream->readUint16BE();
+ info.surface = 0;
+ info.palette = 0;
+ info.colorCount = 0;
+ _info.push_back(info);
+ }
+
+ delete cursStream;
+
+ setCurrentFrameIndex(0);
+}
+
+void Cursor::setCurrentFrameIndex(int32 index) {
+ if (_index != index) {
+ _index = index;
+ if (index != -1) {
+ loadCursorImage(_info[index]);
+ CursorMan.replaceCursorPalette(_info[index].palette, 0, _info[index].colorCount);
+ CursorMan.replaceCursor((byte *)_info[index].surface->pixels, _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0);
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
+ }
+ }
+}
+
+int32 Cursor::getCurrentFrameIndex() const {
+ return _index;
+}
+
+void Cursor::show() {
+ if (!isVisible())
+ CursorMan.showMouse(true);
+
+ _cursorObscured = false;
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
+}
+
+void Cursor::hide() {
+ CursorMan.showMouse(false);
+ setCurrentFrameIndex(0);
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
+}
+
+void Cursor::hideUntilMoved() {
+ if (!_cursorObscured) {
+ hide();
+ _cursorObscured = true;
+ }
+}
+
+void Cursor::useIdleTime() {
+ if (g_system->getEventManager()->getMousePos() != _cursorLocation) {
+ _cursorLocation = g_system->getEventManager()->getMousePos();
+ if (_index != -1 && _cursorObscured)
+ show();
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
+ }
+}
+
+void Cursor::getCursorLocation(Common::Point &pt) const {
+ pt = _cursorLocation;
+}
+
+bool Cursor::isVisible() {
+ return CursorMan.isVisible();
+}
+
+void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
+ if (cursorInfo.surface)
+ return;
+
+ cursorInfo.surface = new Graphics::Surface();
+
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ Common::SeekableReadStream *cicnStream = vm->_resFork->getResource(MKTAG('c', 'i', 'c', 'n'), cursorInfo.tag);
+
+ if (!cicnStream)
+ error("Failed to find color icon %d", cursorInfo.tag);
+
+ // PixMap section
+ Graphics::PICTDecoder::PixMap pixMap = Graphics::PICTDecoder::readPixMap(*cicnStream);
+
+ // Mask section
+ cicnStream->readUint32BE(); // mask baseAddr
+ uint16 maskRowBytes = cicnStream->readUint16BE(); // mask rowBytes
+ cicnStream->skip(3 * 2); // mask rect
+ /* uint16 maskHeight = */ cicnStream->readUint16BE();
+
+ // Bitmap section
+ cicnStream->readUint32BE(); // baseAddr
+ uint16 rowBytes = cicnStream->readUint16BE();
+ cicnStream->readUint16BE(); // top
+ cicnStream->readUint16BE(); // left
+ uint16 height = cicnStream->readUint16BE(); // bottom
+ cicnStream->readUint16BE(); // right
+
+ // Data section
+ cicnStream->readUint32BE(); // icon handle
+ cicnStream->skip(maskRowBytes * height); // FIXME: maskHeight doesn't work here, though the specs say it should
+ cicnStream->skip(rowBytes * height);
+
+ // Palette section
+ cicnStream->readUint32BE(); // always 0
+ cicnStream->readUint16BE(); // always 0
+ cursorInfo.colorCount = cicnStream->readUint16BE() + 1;
+
+ cursorInfo.palette = new byte[cursorInfo.colorCount * 3];
+ for (uint16 i = 0; i < cursorInfo.colorCount; i++) {
+ cicnStream->readUint16BE();
+ cursorInfo.palette[i * 3] = cicnStream->readUint16BE() >> 8;
+ cursorInfo.palette[i * 3 + 1] = cicnStream->readUint16BE() >> 8;
+ cursorInfo.palette[i * 3 + 2] = cicnStream->readUint16BE() >> 8;
+ }
+
+ // PixMap data
+ if (pixMap.pixelSize == 8) {
+ cursorInfo.surface->create(pixMap.rowBytes, pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
+ cicnStream->read(cursorInfo.surface->pixels, pixMap.rowBytes * pixMap.bounds.height());
+
+ // While this looks sensible, it actually doesn't work for some cursors
+ // (ie. the 'can grab' hand)
+ //cursorInfo.surface->w = pixMap.bounds.width();
+ } else if (pixMap.pixelSize == 1) {
+ cursorInfo.surface->create(pixMap.bounds.width(), pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
+
+ for (int y = 0; y < pixMap.bounds.height(); y++) {
+ byte *line = (byte *)cursorInfo.surface->getBasePtr(0, y);
+
+ for (int x = 0; x < pixMap.bounds.width();) {
+ byte b = cicnStream->readByte();
+
+ for (int i = 0; i < 8; i++) {
+ *line++ = ((b & (1 << (7 - i))) != 0) ? 1 : 0;
+
+ if (++x == pixMap.bounds.width())
+ break;
+ }
+ }
+ }
+ } else {
+ error("Unhandled %dbpp cicn images", pixMap.pixelSize);
+ }
+
+ delete cicnStream;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/cursor.h b/engines/pegasus/cursor.h
new file mode 100644
index 0000000000..ada82e3967
--- /dev/null
+++ b/engines/pegasus/cursor.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_CURSOR_H
+#define PEGASUS_CURSOR_H
+
+#include "common/array.h"
+#include "common/rect.h"
+
+#include "pegasus/timers.h"
+
+namespace Graphics {
+ struct Surface;
+}
+
+namespace Pegasus {
+
+// The original cursor code was in the graphics code directly,
+// unlike ScummVM where we have the cursor code separate. We're
+// going to go with CursorManager here and therefore not inherit
+// from the Sprite class.
+
+class Cursor : private Idler {
+public:
+ Cursor();
+ virtual ~Cursor();
+
+ void addCursorFrames(uint16 id);
+
+ void setCurrentFrameIndex(int32 index);
+ int32 getCurrentFrameIndex() const;
+
+ void show();
+ void hide();
+ void hideUntilMoved();
+ bool isVisible();
+
+ void getCursorLocation(Common::Point &) const;
+
+protected:
+ virtual void useIdleTime();
+
+private:
+ struct CursorInfo {
+ uint16 tag;
+ Common::Point hotspot;
+ Graphics::Surface *surface;
+ byte *palette;
+ uint16 colorCount;
+ };
+
+ Common::Point _cursorLocation;
+ Common::Array<CursorInfo> _info;
+ bool _cursorObscured;
+ int _index;
+
+ void loadCursorImage(CursorInfo &cursorInfo);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/detection.cpp b/engines/pegasus/detection.cpp
new file mode 100644
index 0000000000..908005b665
--- /dev/null
+++ b/engines/pegasus/detection.cpp
@@ -0,0 +1,157 @@
+/* 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 "base/plugins.h"
+
+#include "engines/advancedDetector.h"
+#include "common/config-manager.h"
+#include "common/file.h"
+#include "common/savefile.h"
+
+#include "pegasus/pegasus.h"
+
+namespace Pegasus {
+
+struct PegasusGameDescription {
+ ADGameDescription desc;
+};
+
+bool PegasusEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL)
+ || (f == kSupportsLoadingDuringRuntime)
+ || (f == kSupportsSavingDuringRuntime);
+}
+
+bool PegasusEngine::isDemo() const {
+ return (_gameDescription->desc.flags & ADGF_DEMO) != 0;
+}
+
+} // End of namespace Pegasus
+
+static const PlainGameDescriptor pegasusGames[] = {
+ {"pegasus", "The Journeyman Project: Pegasus Prime"},
+ {0, 0}
+};
+
+
+namespace Pegasus {
+
+static const PegasusGameDescription gameDescriptions[] = {
+ {
+ {
+ "pegasus",
+ "",
+ AD_ENTRY1s("JMP PP Resources", "d13a602d2498010d720a6534f097f88b", 2009943),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO0()
+ },
+ },
+
+ {
+ {
+ "pegasus",
+ "Demo",
+ AD_ENTRY1s("JMP PP Resources", "d13a602d2498010d720a6534f097f88b", 360129),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK|ADGF_DEMO,
+ GUIO1(GUIO_NOLAUNCHLOAD)
+ },
+ },
+
+ { AD_TABLE_END_MARKER }
+};
+
+} // End of namespace Pegasus
+
+
+class PegasusMetaEngine : public AdvancedMetaEngine {
+public:
+ PegasusMetaEngine() : AdvancedMetaEngine(Pegasus::gameDescriptions, sizeof(Pegasus::PegasusGameDescription), pegasusGames) {
+ _singleid = "pegasus";
+ }
+
+ virtual const char *getName() const {
+ return "The Journeyman Project: Pegasus Prime";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "The Journeyman Project: Pegasus Prime (C) Presto Studios";
+ }
+
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual SaveStateList listSaves(const char *target) const;
+ virtual int getMaximumSaveSlot() const { return 999; }
+ virtual void removeSaveState(const char *target, int slot) const;
+};
+
+bool PegasusMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves)
+ || (f == kSupportsLoadingDuringStartup)
+ || (f == kSupportsDeleteSave);
+}
+
+SaveStateList PegasusMetaEngine::listSaves(const char *target) const {
+ // The original had no pattern, so the user must rename theirs
+ // Note that we ignore the target because saves are compatible between
+ // all versions
+ Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("pegasus-*.sav");
+
+ SaveStateList saveList;
+ for (uint32 i = 0; i < filenames.size(); i++) {
+ // Isolate the description from the file name
+ Common::String desc = filenames[i].c_str() + 8;
+ for (int j = 0; j < 4; j++)
+ desc.deleteLastChar();
+
+ saveList.push_back(SaveStateDescriptor(i, desc));
+ }
+
+ return saveList;
+}
+
+void PegasusMetaEngine::removeSaveState(const char *target, int slot) const {
+ // See listSaves() for info on the pattern
+ Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("pegasus-*.sav");
+ g_system->getSavefileManager()->removeSavefile(filenames[slot].c_str());
+}
+
+bool PegasusMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ const Pegasus::PegasusGameDescription *gd = (const Pegasus::PegasusGameDescription *)desc;
+
+ if (gd)
+ *engine = new Pegasus::PegasusEngine(syst, gd);
+
+ return (gd != 0);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(PEGASUS)
+ REGISTER_PLUGIN_DYNAMIC(PEGASUS, PLUGIN_TYPE_ENGINE, PegasusMetaEngine);
+#else
+ REGISTER_PLUGIN_STATIC(PEGASUS, PLUGIN_TYPE_ENGINE, PegasusMetaEngine);
+#endif
+
diff --git a/engines/pegasus/elements.cpp b/engines/pegasus/elements.cpp
new file mode 100644
index 0000000000..c84d555444
--- /dev/null
+++ b/engines/pegasus/elements.cpp
@@ -0,0 +1,568 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/macresman.h"
+#include "common/stream.h"
+
+#include "pegasus/elements.h"
+#include "pegasus/graphics.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+DisplayElement::DisplayElement(const DisplayElementID id) : IDObject(id) {
+ _elementIsDisplaying = false;
+ _elementIsVisible = false;
+ _elementOrder = 0;
+ _triggeredElement = this;
+ _nextElement = 0;
+}
+
+DisplayElement::~DisplayElement() {
+ if (isDisplaying())
+ ((PegasusEngine *)g_engine)->_gfx->removeDisplayElement(this);
+}
+
+void DisplayElement::setDisplayOrder(const DisplayOrder order) {
+ if (_elementOrder != order) {
+ _elementOrder = order;
+ if (isDisplaying()) {
+ ((PegasusEngine *)g_engine)->_gfx->removeDisplayElement(this);
+ ((PegasusEngine *)g_engine)->_gfx->addDisplayElement(this);
+ triggerRedraw();
+ }
+ }
+}
+
+void DisplayElement::startDisplaying() {
+ if (!isDisplaying()) {
+ ((PegasusEngine *)g_engine)->_gfx->addDisplayElement(this);
+ triggerRedraw();
+ }
+}
+
+void DisplayElement::stopDisplaying() {
+ if (isDisplaying()) {
+ triggerRedraw();
+ ((PegasusEngine *)g_engine)->_gfx->removeDisplayElement(this);
+ }
+}
+
+void DisplayElement::setBounds(const CoordType left, const CoordType top, const CoordType right, const CoordType bottom) {
+ setBounds(Common::Rect(left, top, right, bottom));
+}
+
+void DisplayElement::getBounds(Common::Rect &r) const {
+ r = _bounds;
+}
+
+void DisplayElement::sizeElement(const CoordType h, const CoordType v) {
+ Common::Rect newBounds = _bounds;
+ newBounds.right = _bounds.left + h;
+ newBounds.bottom = _bounds.top + v;
+ setBounds(newBounds);
+}
+
+void DisplayElement::moveElementTo(const CoordType h, const CoordType v) {
+ Common::Rect newBounds = _bounds;
+ newBounds.moveTo(h, v);
+ setBounds(newBounds);
+}
+
+void DisplayElement::moveElement(const CoordType dh, const CoordType dv) {
+ Common::Rect newBounds = _bounds;
+ newBounds.translate(dh, dv);
+ setBounds(newBounds);
+}
+
+void DisplayElement::getLocation(CoordType &h, CoordType &v) const {
+ h = _bounds.left;
+ v = _bounds.top;
+}
+
+void DisplayElement::centerElementAt(const CoordType h, const CoordType v) {
+ Common::Rect newBounds = _bounds;
+ newBounds.moveTo(h - (_bounds.width() / 2), v - (_bounds.height() / 2));
+ setBounds(newBounds);
+}
+
+void DisplayElement::getCenter(CoordType &h, CoordType &v) const {
+ h = (_bounds.left + _bounds.right) / 2;
+ v = (_bounds.top + _bounds.bottom) / 2;
+}
+
+void DisplayElement::setBounds(const Common::Rect &r) {
+ if (r != _bounds) {
+ triggerRedraw();
+ _bounds = r;
+ triggerRedraw();
+ }
+}
+
+void DisplayElement::hide() {
+ if (_elementIsVisible) {
+ triggerRedraw();
+ _elementIsVisible = false;
+ }
+}
+
+void DisplayElement::show() {
+ if (!_elementIsVisible) {
+ _elementIsVisible = true;
+ triggerRedraw();
+ }
+}
+
+// Only invalidates this element's bounding rectangle if all these conditions are true:
+// -- The triggered element is this element.
+// -- The element is displaying on the display list.
+// -- The element is visible.
+// -- The element is part of the active layer OR is one of the reserved items.
+void DisplayElement::triggerRedraw() {
+ GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+
+ if (_triggeredElement == this) {
+ if (validToDraw(gfx->getBackOfActiveLayer(), gfx->getFrontOfActiveLayer()))
+ gfx->invalRect(_bounds);
+ } else {
+ _triggeredElement->triggerRedraw();
+ }
+}
+
+void DisplayElement::setTriggeredElement(DisplayElement *element) {
+ if (element)
+ _triggeredElement = element;
+ else
+ _triggeredElement = this;
+}
+
+bool DisplayElement::validToDraw(DisplayOrder backLayer, DisplayOrder frontLayer) {
+ return isDisplaying() && _elementIsVisible &&
+ (getObjectID() <= kHighestReservedElementID ||
+ (getDisplayOrder() >= backLayer &&
+ getDisplayOrder() <= frontLayer));
+}
+
+DropHighlight::DropHighlight(const DisplayElementID id) : DisplayElement(id) {
+ _highlightColor = 0;
+ _thickness = 2;
+ _cornerDiameter = 0;
+}
+
+void DropHighlight::draw(const Common::Rect &) {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+
+ // Since this is only used in two different ways, I'm only
+ // going to implement it in those two ways. Deal with it.
+
+ Common::Rect rect = _bounds;
+ rect.grow(-_thickness);
+ screen->frameRect(rect, _highlightColor);
+ rect.grow(1);
+ screen->frameRect(rect, _highlightColor);
+
+ if (_cornerDiameter == 8 && _thickness == 4) {
+ rect.grow(1);
+ screen->frameRect(rect, _highlightColor);
+ screen->hLine(rect.left + 1, rect.top - 1, rect.right - 2, _highlightColor);
+ screen->hLine(rect.left + 1, rect.bottom, rect.right - 2, _highlightColor);
+ screen->vLine(rect.left - 1, rect.top + 1, rect.bottom - 2, _highlightColor);
+ screen->vLine(rect.right, rect.top + 1, rect.bottom - 2, _highlightColor);
+ }
+}
+
+IdlerAnimation::IdlerAnimation(const DisplayElementID id) : Animation(id) {
+ _lastTime = 0xffffffff;
+}
+
+void IdlerAnimation::startDisplaying() {
+ if (!isDisplaying()) {
+ Animation::startDisplaying();
+ startIdling();
+ }
+}
+
+void IdlerAnimation::stopDisplaying() {
+ if (isDisplaying()) {
+ Animation::stopDisplaying();
+ stopIdling();
+ }
+}
+
+void IdlerAnimation::useIdleTime() {
+ uint32 currentTime = getTime();
+
+ if (currentTime != _lastTime) {
+ _lastTime = currentTime;
+ timeChanged(_lastTime);
+ }
+}
+
+void IdlerAnimation::timeChanged(const TimeValue) {
+ triggerRedraw();
+}
+
+FrameSequence::FrameSequence(const DisplayElementID id) : IdlerAnimation(id) {
+ _duration = 0;
+ _currentFrameNum = 0;
+ _resFork = new Common::MacResManager();
+ _numFrames = 0;
+}
+
+FrameSequence::~FrameSequence() {
+ delete _resFork;
+}
+
+void FrameSequence::useFileName(const Common::String &fileName) {
+ _resFork->open(fileName);
+}
+
+void FrameSequence::openFrameSequence() {
+ if (!_resFork->hasResFork())
+ return;
+
+ Common::SeekableReadStream *res = _resFork->getResource(MKTAG('P', 'F', 'r', 'm'), 0x80);
+
+ if (!res)
+ return;
+
+ uint32 scale = res->readUint32BE();
+ _bounds.top = res->readUint16BE();
+ _bounds.left = res->readUint16BE();
+ _bounds.bottom = res->readUint16BE();
+ _bounds.right = res->readUint16BE();
+ _numFrames = res->readUint16BE();
+ _duration = 0;
+
+ _frameTimes.clear();
+ for (uint32 i = 0; i < _numFrames; i++) {
+ TimeValue time = res->readUint32BE();
+ _duration += time;
+ _frameTimes.push_back(_duration);
+ }
+
+ setScale(scale);
+ setSegment(0, _duration);
+ setTime(0);
+ _currentFrameNum = 0;
+ newFrame(_currentFrameNum);
+ triggerRedraw();
+
+ delete res;
+}
+
+void FrameSequence::closeFrameSequence() {
+ stop();
+ _resFork->close();
+ _duration = 0;
+ _numFrames = 0;
+ _frameTimes.clear();
+}
+
+void FrameSequence::timeChanged(const TimeValue time) {
+ int16 frameNum = 0;
+ for (int16 i = _numFrames - 1; i >= 0; i--) {
+ if (_frameTimes[i] < time) {
+ frameNum = i;
+ break;
+ }
+ }
+
+ if (frameNum != _currentFrameNum) {
+ _currentFrameNum = frameNum;
+ newFrame(_currentFrameNum);
+ triggerRedraw();
+ }
+}
+
+void FrameSequence::setFrameNum(const int16 frameNum) {
+ int16 f = CLIP<int>(frameNum, 0, _numFrames);
+
+ if (_currentFrameNum != f) {
+ _currentFrameNum = f;
+ setTime(_frameTimes[f]);
+ newFrame(f);
+ triggerRedraw();
+ }
+}
+
+bool FrameSequence::isSequenceOpen() const {
+ return _numFrames != 0;
+}
+
+Sprite::Sprite(const DisplayElementID id) : DisplayElement(id) {
+ _numFrames = 0;
+ _currentFrameNum = 0xffffffff;
+ _currentFrame = 0;
+}
+
+Sprite::~Sprite() {
+ discardFrames();
+}
+
+void Sprite::discardFrames() {
+ if (!_frameArray.empty()) {
+ for (uint32 i = 0; i < _numFrames; i++) {
+ SpriteFrame *frame = _frameArray[i].frame;
+ frame->_referenceCount--;
+ if (frame->_referenceCount == 0)
+ delete frame;
+ }
+
+ _frameArray.clear();
+ _numFrames = 0;
+ _currentFrame = 0;
+ _currentFrameNum = 0xffffffff;
+ setBounds(0, 0, 0, 0);
+ }
+}
+
+void Sprite::addPICTResourceFrame(const ResIDType pictID, bool transparent, const CoordType left, const CoordType top) {
+ SpriteFrame *frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, pictID, transparent);
+ addFrame(frame, left, top);
+}
+
+uint32 Sprite::addFrame(SpriteFrame *frame, const CoordType left, const CoordType top) {
+ SpriteFrameRec frameRecord;
+ frameRecord.frame = frame;
+ frameRecord.frameLeft = left;
+ frameRecord.frameTop = top;
+ _frameArray.push_back(frameRecord);
+ _numFrames++;
+ frame->_referenceCount++;
+
+ Common::Rect frameBounds;
+ frame->getSurfaceBounds(frameBounds);
+
+ // 9/3/96
+ // BB Should this be + left or - left?
+ frameBounds.moveTo(_bounds.left + left, _bounds.top + top);
+
+ frameBounds.extend(_bounds);
+
+ if (_bounds != frameBounds)
+ setBounds(frameBounds);
+
+ return _numFrames - 1;
+}
+
+void Sprite::removeFrame(const uint32 frameNum) {
+ _frameArray[frameNum].frame->_referenceCount--;
+ if (_frameArray[frameNum].frame->_referenceCount == 0)
+ delete _frameArray[frameNum].frame;
+
+ // Calculate the new bounds
+ Common::Rect frameBounds;
+ for (uint32 i = 0; i < _numFrames; i++) {
+ if (i == frameNum)
+ continue;
+
+ Common::Rect r;
+ _frameArray[i].frame->getSurfaceBounds(r);
+ r.translate(_frameArray[i].frameLeft, _frameArray[i].frameTop);
+ frameBounds.extend(r);
+ }
+
+ _frameArray.remove_at(frameNum);
+
+ frameBounds.moveTo(_bounds.left, _bounds.top);
+ setBounds(frameBounds);
+
+ if (_currentFrameNum == frameNum)
+ triggerRedraw();
+ else if (_currentFrameNum != 0xffffffff && _currentFrameNum > frameNum)
+ --_currentFrameNum;
+}
+
+void Sprite::setCurrentFrameIndex(const int32 frameNum) {
+ if (frameNum < 0) {
+ if (_currentFrameNum != 0xffffffff) {
+ _currentFrameNum = 0xffffffff;
+ _currentFrame = 0;
+ triggerRedraw();
+ }
+ } else if (_numFrames > 0) {
+ uint32 f = frameNum % _numFrames;
+ if (f != _currentFrameNum) {
+ _currentFrameNum = f;
+ _currentFrame = &_frameArray[f];
+ triggerRedraw();
+ }
+ }
+}
+
+SpriteFrame *Sprite::getFrame(const int32 index) {
+ if (index < 0 || (uint32)index >= _numFrames)
+ return 0;
+
+ return _frameArray[index].frame;
+}
+
+void Sprite::draw(const Common::Rect &r) {
+ if (_currentFrame) {
+ Common::Rect frameBounds;
+ _currentFrame->frame->getSurfaceBounds(frameBounds);
+
+ frameBounds.translate(_bounds.left + _currentFrame->frameLeft, _bounds.top + _currentFrame->frameTop);
+ Common::Rect r1 = frameBounds.findIntersectingRect(r);
+
+ Common::Rect r2 = frameBounds;
+ r2.translate(-_bounds.left - _currentFrame->frameLeft, -_bounds.top - _currentFrame->frameTop);
+
+ _currentFrame->frame->drawImage(r2, r1);
+ }
+}
+
+SpriteSequence::SpriteSequence(const DisplayElementID id, const DisplayElementID spriteID) :
+ FrameSequence(id), _sprite(spriteID), _transparent(false) {
+}
+
+void SpriteSequence::openFrameSequence() {
+ if (!isSequenceOpen()) {
+ FrameSequence::openFrameSequence();
+
+ if (isSequenceOpen()) {
+ uint32 numFrames = getNumFrames();
+
+ for (uint32 i = 0; i < numFrames; ++i) {
+ SpriteFrame *frame = new SpriteFrame();
+ frame->initFromPICTResource(_resFork, i + 0x80, _transparent);
+ _sprite.addFrame(frame, 0, 0);
+ }
+
+ _sprite.setBounds(_bounds);
+ }
+ }
+}
+
+void SpriteSequence::closeFrameSequence() {
+ if (isSequenceOpen()) {
+ FrameSequence::closeFrameSequence();
+ _sprite.discardFrames();
+ }
+}
+
+void SpriteSequence::setBounds(const Common::Rect &bounds) {
+ FrameSequence::setBounds(bounds);
+ _sprite.setBounds(_bounds);
+}
+
+void SpriteSequence::draw(const Common::Rect &r) {
+ _sprite.draw(r);
+}
+
+void SpriteSequence::newFrame(const uint16 frame) {
+ _sprite.setCurrentFrameIndex(frame);
+}
+
+#define DRAW_PIXEL() \
+ if (bytesPerPixel == 2) \
+ *((uint16 *)dst) = black; \
+ else \
+ *((uint32 *)dst) = black; \
+ dst += bytesPerPixel
+
+#define SKIP_PIXEL() \
+ dst += bytesPerPixel
+
+void ScreenDimmer::draw(const Common::Rect &r) {
+ // We're going to emulate QuickDraw's srcOr+gray mode here
+ // In this mode, every other y column is all black (odd-columns).
+ // Basically, every row does three black and then one transparent
+ // repeatedly.
+
+ // The output is identical to the original
+
+ uint32 black = g_system->getScreenFormat().RGBToColor(0, 0, 0);
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ byte bytesPerPixel = g_system->getScreenFormat().bytesPerPixel;
+
+ // We're currently doing it to the whole screen to simplify the code
+
+ for (int y = 0; y < 480; y++) {
+ byte *dst = (byte *)screen->getBasePtr(0, y);
+
+ for (int x = 0; x < 640; x += 4) {
+ if (y & 1) {
+ DRAW_PIXEL();
+ DRAW_PIXEL();
+ SKIP_PIXEL();
+ DRAW_PIXEL();
+ } else {
+ SKIP_PIXEL();
+ DRAW_PIXEL();
+ DRAW_PIXEL();
+ DRAW_PIXEL();
+ }
+ }
+ }
+}
+
+#undef DRAW_PIXEL
+#undef SKIP_PIXEL
+
+SoundLevel::SoundLevel(const DisplayElementID id) : DisplayElement(id) {
+ _soundLevel = 0;
+}
+
+void SoundLevel::incrementLevel() {
+ if (_soundLevel < 12) {
+ _soundLevel++;
+ triggerRedraw();
+ }
+}
+
+void SoundLevel::decrementLevel() {
+ if (_soundLevel > 0) {
+ _soundLevel--;
+ triggerRedraw();
+ }
+}
+
+uint16 SoundLevel::getSoundLevel() {
+ return CLIP<int>(_soundLevel * 22, 0, 256);
+}
+
+void SoundLevel::setSoundLevel(uint16 level) {
+ uint16 newLevel = (level + 21) / 22;
+
+ if (newLevel != _soundLevel) {
+ _soundLevel = newLevel;
+ triggerRedraw();
+ }
+}
+
+void SoundLevel::draw(const Common::Rect &r) {
+ Common::Rect levelRect(_bounds.right + (8 * (_soundLevel - 12)), _bounds.top, _bounds.right, _bounds.bottom);
+ levelRect = r.findIntersectingRect(levelRect);
+
+ if (!levelRect.isEmpty()) {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ screen->fillRect(levelRect, g_system->getScreenFormat().RGBToColor(0, 0, 0));
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/elements.h b/engines/pegasus/elements.h
new file mode 100644
index 0000000000..140553f675
--- /dev/null
+++ b/engines/pegasus/elements.h
@@ -0,0 +1,254 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ELEMENTS_H
+#define PEGASUS_ELEMENTS_H
+
+#include "common/array.h"
+#include "common/rect.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "graphics/surface.h"
+
+#include "pegasus/timers.h"
+#include "pegasus/util.h"
+
+namespace Common {
+ class MacResManager;
+}
+
+namespace Pegasus {
+
+class DisplayElement : public IDObject {
+friend class GraphicsManager;
+public:
+ DisplayElement(const DisplayElementID);
+ virtual ~DisplayElement();
+
+ void setDisplayOrder(const DisplayOrder);
+ DisplayOrder getDisplayOrder() const { return _elementOrder; }
+
+ bool validToDraw(DisplayOrder, DisplayOrder);
+
+ virtual void draw(const Common::Rect&) {}
+ bool isDisplaying() { return _elementIsDisplaying; }
+ virtual void startDisplaying();
+ virtual void stopDisplaying();
+
+ virtual void show();
+ virtual void hide();
+ bool isVisible() { return _elementIsVisible; }
+
+ // triggerRedraw only triggers a draw if the element is displaying and visible.
+ void triggerRedraw();
+ void setTriggeredElement(DisplayElement *);
+
+ virtual void setBounds(const CoordType, const CoordType, const CoordType, const CoordType);
+ virtual void setBounds(const Common::Rect &);
+ virtual void getBounds(Common::Rect &) const;
+ virtual void sizeElement(const CoordType, const CoordType);
+ virtual void moveElementTo(const CoordType, const CoordType);
+ virtual void moveElement(const CoordType, const CoordType);
+ virtual void getLocation(CoordType &, CoordType &) const;
+ virtual void getCenter(CoordType &, CoordType &) const;
+ virtual void centerElementAt(const CoordType, const CoordType);
+
+protected:
+ Common::Rect _bounds;
+ bool _elementIsVisible;
+ DisplayElement *_triggeredElement;
+
+ // Used only by PegasusEngine
+ bool _elementIsDisplaying;
+ DisplayOrder _elementOrder;
+ DisplayElement *_nextElement;
+};
+
+// I'm using the proper "highlight" instead of the evil
+// QuickDraw "hilite" :P (deal with it!)
+class DropHighlight : public DisplayElement {
+public:
+ DropHighlight(const DisplayElementID);
+ virtual ~DropHighlight() {}
+
+ void setHighlightColor(const uint32 &highlight) { _highlightColor = highlight; }
+ void getHighlightColor(uint32 &highlight) const { highlight = _highlightColor; }
+
+ void setHighlightThickness(const uint16 thickness) { _thickness = thickness; }
+ uint16 getHighlightThickness() const { return _thickness; }
+
+ void setHighlightCornerDiameter(const uint16 diameter) { _cornerDiameter = diameter; }
+ uint16 getHighlightCornerDiameter() const { return _cornerDiameter; }
+
+ virtual void draw(const Common::Rect&);
+
+protected:
+ uint32 _highlightColor;
+ uint16 _thickness;
+ uint16 _cornerDiameter;
+};
+
+class Animation : public DisplayElement, public DynamicElement {
+public:
+ Animation(const DisplayElementID id) : DisplayElement(id) {}
+};
+
+class IdlerAnimation : public Animation, public Idler {
+public:
+ IdlerAnimation(const DisplayElementID);
+
+ virtual void startDisplaying();
+ virtual void stopDisplaying();
+
+ TimeValue getLastTime() const { return _lastTime; }
+
+protected:
+ virtual void useIdleTime();
+ virtual void timeChanged(const TimeValue);
+
+ TimeValue _lastTime;
+};
+
+// This class reads PICT resources and plays them like a movie.
+// Assumes there is a resource of type 'PFrm' describing the time values for each
+// PICT frame, as well as the total time in the movie.
+// Assumes that PICT frames begin at PICT 128
+
+class FrameSequence : public IdlerAnimation {
+public:
+ FrameSequence(const DisplayElementID);
+ virtual ~FrameSequence();
+
+ void useFileName(const Common::String &fileName);
+
+ virtual void openFrameSequence();
+ virtual void closeFrameSequence();
+ bool isSequenceOpen() const;
+
+ uint16 getNumFrames() const { return _numFrames; }
+ virtual uint16 getFrameNum() const { return _currentFrameNum; }
+ virtual void setFrameNum(const int16);
+
+protected:
+ virtual void timeChanged(const TimeValue);
+ virtual void newFrame(const uint16) {}
+
+ Common::MacResManager *_resFork;
+ TimeValue _duration;
+
+ uint16 _numFrames;
+ Common::Array<TimeValue> _frameTimes;
+
+ uint16 _currentFrameNum;
+};
+
+class SpriteFrame;
+
+class Sprite : public DisplayElement {
+friend class SpriteFrame;
+public:
+ Sprite(const DisplayElementID);
+ virtual ~Sprite();
+
+ virtual void addPICTResourceFrame(const ResIDType, const bool, const CoordType, const CoordType);
+ virtual uint32 addFrame(SpriteFrame *, const CoordType, const CoordType);
+ virtual void removeFrame(const uint32);
+ virtual void discardFrames();
+
+ // Setting the current frame.
+ // If the index is negative, sets the current frame to NULL and hides the sprite.
+ // If the index is larger than the number of frames in the sprite, the number
+ // is treated modulo the number of frames.
+ virtual void setCurrentFrameIndex(const int32);
+ virtual uint32 getCurrentFrameIndex() const { return _currentFrameNum; }
+
+ virtual SpriteFrame *getFrame(const int32);
+
+ virtual void draw(const Common::Rect &);
+
+ uint32 getNumFrames() const { return _numFrames; }
+
+protected:
+ struct SpriteFrameRec {
+ SpriteFrame *frame;
+ CoordType frameLeft;
+ CoordType frameTop;
+ };
+
+ uint32 _numFrames;
+ uint32 _currentFrameNum;
+ SpriteFrameRec *_currentFrame;
+ Common::Array<SpriteFrameRec> _frameArray;
+};
+
+class SpriteSequence : public FrameSequence {
+public:
+ SpriteSequence(const DisplayElementID id, const DisplayElementID spriteID);
+ virtual ~SpriteSequence() {}
+
+ void useTransparent(bool transparent) { _transparent = transparent; }
+
+ virtual void openFrameSequence();
+ virtual void closeFrameSequence();
+
+ virtual void draw(const Common::Rect &);
+
+ virtual void setBounds(const Common::Rect &);
+
+protected:
+ virtual void newFrame(const uint16);
+
+ bool _transparent;
+ Sprite _sprite;
+};
+
+class ScreenDimmer : public DisplayElement {
+public:
+ ScreenDimmer() : DisplayElement(kScreenDimmerID) {}
+ virtual ~ScreenDimmer() {}
+
+ virtual void draw(const Common::Rect &);
+};
+
+class SoundLevel : public DisplayElement {
+public:
+ SoundLevel(const DisplayElementID);
+ virtual ~SoundLevel() {}
+
+ void incrementLevel();
+ void decrementLevel();
+
+ uint16 getSoundLevel();
+ void setSoundLevel(uint16);
+
+ void draw(const Common::Rect &);
+
+protected:
+ uint16 _soundLevel;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/energymonitor.cpp b/engines/pegasus/energymonitor.cpp
new file mode 100644
index 0000000000..8aa77eb341
--- /dev/null
+++ b/engines/pegasus/energymonitor.cpp
@@ -0,0 +1,296 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+Blinker::Blinker() {
+ _sprite = 0;
+ _frame1 = -1;
+ _frame2 = -1;
+ _blinkDuration = 0;
+}
+
+void Blinker::startBlinking(Sprite *sprite, int32 frame1, int32 frame2, uint32 numBlinks, TimeValue blinkDuration, TimeScale blinkScale) {
+ stopBlinking();
+ _sprite = sprite;
+ _frame1 = frame1;
+ _frame2 = frame2;
+ _blinkDuration = blinkDuration;
+ setScale(blinkScale);
+ setSegment(0, blinkDuration * numBlinks * 2, blinkScale);
+ setTime(0);
+ start();
+}
+
+void Blinker::stopBlinking() {
+ if (_sprite) {
+ _sprite->setCurrentFrameIndex(_frame2);
+ _sprite = 0;
+ stop();
+ }
+}
+
+void Blinker::timeChanged(const TimeValue time) {
+ if (_sprite && _blinkDuration != 0) {
+ if (((time / _blinkDuration) & 1) != 0 || time == getDuration()) {
+ _sprite->setCurrentFrameIndex(_frame2);
+ if (!isRunning())
+ stopBlinking();
+ } else {
+ _sprite->setCurrentFrameIndex(_frame1);
+ }
+ }
+}
+
+static const NotificationFlags kEnergyExpiredFlag = 1;
+
+EnergyMonitor *g_energyMonitor = 0;
+
+EnergyMonitor::EnergyMonitor() : IdlerAnimation(kEnergyBarID), _energyLight(kWarningLightID) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _stage = kStageNoStage;
+
+ _calibrating = false;
+ _dontFlash = false;
+
+ setBounds(338, 48, 434, 54);
+
+ setDisplayOrder(kEnergyBarOrder);
+ startDisplaying();
+
+ SpriteFrame *frame = new SpriteFrame();
+ frame->initFromPICTResource(vm->_resFork, kLightOffID);
+ _energyLight.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(vm->_resFork, kLightYellowID);
+ _energyLight.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(vm->_resFork, kLightOrangeID);
+ _energyLight.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(vm->_resFork, kLightRedID);
+ _energyLight.addFrame(frame, 0, 0);
+
+ _energyLight.setBounds(540, 35, 600, 59);
+ _energyLight.setDisplayOrder(kEnergyLightOrder);
+ _energyLight.startDisplaying();
+
+ setScale(1);
+ setSegment(0, kMaxJMPEnergy);
+
+ setEnergyValue(kCasualEnergy);
+
+ g_energyMonitor = this;
+}
+
+EnergyMonitor::~EnergyMonitor() {
+ g_energyMonitor = 0;
+}
+
+void EnergyMonitor::setEnergyValue(const uint32 value) {
+ if (isRunning()) {
+ stop();
+ setTime(getStop() - value);
+ start();
+ } else {
+ setTime(getStop() - value);
+ }
+}
+
+void EnergyMonitor::startEnergyDraining() {
+ if (!isRunning()) {
+ _energyLight.show();
+ start();
+ show();
+ }
+}
+
+void EnergyMonitor::setEnergyDrainRate(Common::Rational rate) {
+ setRate(rate);
+}
+
+Common::Rational EnergyMonitor::getEnergyDrainRate() {
+ return getRate();
+}
+
+void EnergyMonitor::stopEnergyDraining() {
+ if (isRunning()) {
+ stop();
+ _energyLight.hide();
+ hide();
+ }
+}
+
+void EnergyMonitor::drainEnergy(const int32 delta) {
+ setTime(getTime() + delta);
+}
+
+int32 EnergyMonitor::getCurrentEnergy() {
+ return kMaxJMPEnergy - getTime();
+}
+
+void EnergyMonitor::timeChanged(const TimeValue currentTime) {
+ if (currentTime == getStop()) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ if (vm->getEnergyDeathReason() != -1)
+ vm->die(vm->getEnergyDeathReason());
+ } else {
+ uint32 currentEnergy = kMaxJMPEnergy - currentTime;
+
+ EnergyStage newStage;
+ if (currentEnergy > kWorriedEnergy)
+ newStage = kStageCasual;
+ else if (currentEnergy > kNervousEnergy)
+ newStage = kStageWorried;
+ else if (currentEnergy > kPanicStrickenEnergy)
+ newStage = kStageNervous;
+ else
+ newStage = kStagePanicStricken;
+
+ if (_stage != newStage) {
+ uint32 newFrame;
+
+ switch (newStage) {
+ case kStageCasual:
+ _barColor = g_system->getScreenFormat().RGBToColor(0x48, 0xB0, 0xD8);
+ newFrame = kFrameLightOff;
+ break;
+ case kStageWorried:
+ _barColor = g_system->getScreenFormat().RGBToColor(0xD8, 0xC0, 0x30);
+ newFrame = kFrameLightYellow;
+ break;
+ case kStageNervous:
+ _barColor = g_system->getScreenFormat().RGBToColor(0xD8, 0x78, 0x38);
+ newFrame = kFrameLightOrange;
+ break;
+ case kStagePanicStricken:
+ _barColor = g_system->getScreenFormat().RGBToColor(0xD8, 0x40, 0x38);
+ newFrame = kFrameLightRed;
+ break;
+ default:
+ error("no stage in energy monitor?");
+ break;
+ }
+
+ _stage = newStage;
+ uint32 oldFrame = _energyLight.getCurrentFrameIndex();
+
+ if (!_calibrating) {
+ if (oldFrame > newFrame || oldFrame == 0xffffffff || _dontFlash) {
+ _energyLight.setCurrentFrameIndex(newFrame);
+ _dontFlash = false;
+ } else {
+ _lightBlinker.startBlinking(&_energyLight, oldFrame, newFrame, 4, 1, 3);
+ triggerRedraw();
+ }
+ }
+ }
+
+ Common::Rect r;
+ calcLevelRect(r);
+ if (r != _levelRect) {
+ _levelRect = r;
+ triggerRedraw();
+ }
+ }
+}
+
+void EnergyMonitor::calcLevelRect(Common::Rect &r) {
+ if (getStop() == 0) {
+ r = Common::Rect();
+ } else {
+ getBounds(r);
+ r.left = r.right - r.width() * (kMaxJMPEnergy - getTime()) / getStop();
+ }
+}
+
+void EnergyMonitor::draw(const Common::Rect &r) {
+ Common::Rect r2 = r.findIntersectingRect(_levelRect);
+
+ if (!r2.isEmpty()) {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ screen->fillRect(r2, _barColor);
+ }
+}
+
+void EnergyMonitor::calibrateEnergyBar() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _calibrating = true;
+
+ vm->setEnergyDeathReason(-1);
+
+ uint32 numFrames = _energyLight.getNumFrames();
+ for (uint32 i = 1; i < numFrames; i++) {
+ _energyLight.setCurrentFrameIndex(i);
+ _energyLight.show();
+ vm->delayShell(1, 3);
+ _energyLight.hide();
+ vm->delayShell(1, 3);
+ }
+
+ _energyLight.setCurrentFrameIndex(0);
+ _energyLight.hide();
+
+ show();
+ setEnergyValue(0);
+ setEnergyDrainRate(-(int32)kMaxJMPEnergy / 2);
+
+ // Make sure warning light is hidden...
+ _energyLight.hide();
+ while (getCurrentEnergy() != (int32)kMaxJMPEnergy) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ setEnergyDrainRate(0);
+ hide();
+
+ _calibrating = false;
+}
+
+void EnergyMonitor::restoreLastEnergyValue() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _dontFlash = true;
+ setEnergyValue(vm->getSavedEnergyValue());
+ vm->resetEnergyDeathReason();
+}
+
+void EnergyMonitor::saveCurrentEnergyValue() {
+ ((PegasusEngine *)g_engine)->setLastEnergyValue(getCurrentEnergy());
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/energymonitor.h b/engines/pegasus/energymonitor.h
new file mode 100644
index 0000000000..02377d515a
--- /dev/null
+++ b/engines/pegasus/energymonitor.h
@@ -0,0 +1,111 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ENERGYMONITOR_H
+#define PEGASUS_ENERGYMONITOR_H
+
+#include "pegasus/elements.h"
+
+namespace Pegasus {
+
+class Sprite;
+
+class Blinker : private IdlerTimeBase {
+public:
+ Blinker();
+ virtual ~Blinker() {}
+
+ void startBlinking(Sprite *sprite, int32 frame1, int32 frame2, uint32 numBlinks, TimeValue blinkDuration, TimeScale blinkScale);
+ void stopBlinking();
+
+protected:
+ virtual void timeChanged(const TimeValue);
+
+ Sprite *_sprite;
+ int32 _frame1;
+ int32 _frame2;
+ TimeValue _blinkDuration;
+};
+
+// Energy monitor constants.
+
+// These are in seconds.
+// Max is two hours
+static const uint32 kMaxJMPEnergy = 7200;
+
+static const uint32 kCasualEnergy = kMaxJMPEnergy * 100 / 100; // 100%
+static const uint32 kWorriedEnergy = kMaxJMPEnergy * 50 / 100; // 50%
+static const uint32 kNervousEnergy = kMaxJMPEnergy * 25 / 100; // 25%
+static const uint32 kPanicStrickenEnergy = kMaxJMPEnergy * 5 / 100; // 5%
+
+static const uint32 kFullEnergy = kCasualEnergy;
+
+static const uint32 kFrameLightOff = 0;
+static const uint32 kFrameLightYellow = 1;
+static const uint32 kFrameLightOrange = 2;
+static const uint32 kFrameLightRed = 3;
+
+static const int kEnergyDrainNormal = 1;
+static const int kMarsReactorEnergyDrainNoShield = 6;
+static const int kMarsReactorEnergyDrainWithShield = 3;
+static const int kWSCPoisonEnergyDrainWithDart = 20;
+static const int kWSCPoisonEnergyDrainNoDart = 10;
+
+class EnergyMonitor : private IdlerAnimation {
+public:
+ EnergyMonitor();
+ virtual ~EnergyMonitor();
+
+ void setEnergyValue(const uint32);
+ void startEnergyDraining();
+ void setEnergyDrainRate(Common::Rational);
+ Common::Rational getEnergyDrainRate();
+ void stopEnergyDraining();
+ void drainEnergy(const int32);
+ int32 getCurrentEnergy();
+
+ void restoreLastEnergyValue();
+ void saveCurrentEnergyValue();
+
+ void calibrateEnergyBar();
+
+protected:
+ void timeChanged(const TimeValue);
+ void calcLevelRect(Common::Rect &);
+ void draw(const Common::Rect &);
+
+ uint32 _barColor;
+ Common::Rect _levelRect;
+ EnergyStage _stage;
+ Sprite _energyLight;
+ Blinker _lightBlinker;
+ bool _calibrating, _dontFlash;
+};
+
+extern EnergyMonitor *g_energyMonitor;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/fader.cpp b/engines/pegasus/fader.cpp
new file mode 100644
index 0000000000..a2bbf22944
--- /dev/null
+++ b/engines/pegasus/fader.cpp
@@ -0,0 +1,218 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/fader.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/sound.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+Fader::Fader() {
+ _currentValue = 0;
+ _currentFaderMove._numKnots = 0;
+}
+
+void Fader::setFaderValue(const int32 newValue) {
+ _currentValue = newValue;
+}
+
+bool Fader::initFaderMove(const FaderMoveSpec &spec) {
+ bool faderMoves = false;
+ int32 value = 0;
+
+ if (spec._numKnots > 0) {
+ stopFader();
+ value = spec._knots[0].knotValue;
+ TimeValue startTime = spec._knots[0].knotTime;
+
+ if (startTime != 0xffffffff) {
+ if (spec._numKnots > 1) {
+ TimeValue stopTime = spec._knots[spec._numKnots - 1].knotTime;
+
+ if (spec._faderScale > 0) {
+ if (stopTime > startTime) {
+ for (uint32 i = 1; i < spec._numKnots; ++i) {
+ if (spec._knots[i - 1].knotValue != spec._knots[i].knotValue) {
+ faderMoves = true;
+ break;
+ }
+ }
+
+ if (faderMoves)
+ _currentFaderMove = spec;
+ } else if (spec._knots[spec._numKnots - 1].knotValue != value) {
+ value = spec._knots[spec._numKnots - 1].knotValue;
+ }
+ }
+ }
+ }
+ }
+
+ setFaderValue(value);
+ return faderMoves;
+}
+
+void Fader::startFader(const FaderMoveSpec &spec) {
+ if (initFaderMove(spec)) {
+ setFlags(0);
+ setScale(spec._faderScale);
+ setSegment(spec._knots[0].knotTime, spec._knots[spec._numKnots - 1].knotTime);
+ setTime(spec._knots[0].knotTime);
+ start();
+ }
+}
+
+void Fader::startFaderSync(const FaderMoveSpec &spec) {
+ if (initFaderMove(spec)) {
+ setFlags(0);
+ setScale(spec._faderScale);
+ setSegment(spec._knots[0].knotTime, spec._knots[spec._numKnots - 1].knotTime);
+ setTime(spec._knots[0].knotTime);
+ start();
+
+ while (isFading()) {
+ ((PegasusEngine *)g_engine)->checkCallBacks();
+ useIdleTime();
+ }
+
+ // Once more, for good measure, to make sure that there are no boundary
+ // condition problems.
+ useIdleTime();
+ stopFader();
+ }
+}
+
+void Fader::loopFader(const FaderMoveSpec &spec) {
+ if (initFaderMove(spec)) {
+ setFlags(kLoopTimeBase);
+ setScale(spec._faderScale);
+ setSegment(spec._knots[0].knotTime, spec._knots[spec._numKnots - 1].knotTime);
+ setTime(spec._knots[0].knotTime);
+ start();
+ }
+}
+
+void Fader::stopFader() {
+ stop();
+}
+
+void Fader::pauseFader() {
+ stopFader();
+}
+
+void Fader::continueFader() {
+ if (getTime() < getStop())
+ start();
+}
+
+void Fader::timeChanged(const TimeValue newTime) {
+ if (_currentFaderMove._numKnots != 0) {
+ uint32 i;
+ for (i = 0; i < _currentFaderMove._numKnots; i++)
+ if (_currentFaderMove._knots[i].knotTime > newTime)
+ break;
+
+ int32 newValue;
+ if (i == 0)
+ newValue = _currentFaderMove._knots[0].knotValue;
+ else if (i == _currentFaderMove._numKnots)
+ newValue = _currentFaderMove._knots[i - 1].knotValue;
+ else
+ newValue = linearInterp(_currentFaderMove._knots[i - 1].knotTime, _currentFaderMove._knots[i].knotTime, newTime, _currentFaderMove._knots[i - 1].knotValue, _currentFaderMove._knots[i].knotValue);
+
+ if (newValue != _currentValue)
+ setFaderValue(newValue);
+ }
+}
+
+void FaderMoveSpec::makeOneKnotFaderSpec(const int32 knotValue) {
+ _numKnots = 1;
+ _knots[0].knotTime = 0;
+ _knots[0].knotValue = knotValue;
+}
+
+void FaderMoveSpec::makeTwoKnotFaderSpec(const TimeScale faderScale, const TimeValue time1, const int32 value1, const TimeValue time2, const int32 value2) {
+ _numKnots = 2;
+ _faderScale = faderScale;
+ _knots[0].knotTime = time1;
+ _knots[0].knotValue = value1;
+ _knots[1].knotTime = time2;
+ _knots[1].knotValue = value2;
+}
+
+void FaderMoveSpec::insertFaderKnot(const TimeValue knotTime, const int32 knotValue) {
+ if (_numKnots != kMaxFaderKnots) {
+ uint32 index;
+ for (index = 0; index < _numKnots; index++) {
+ if (knotTime == _knots[index].knotTime) {
+ _knots[index].knotValue = knotValue;
+ return;
+ } else if (knotTime < _knots[index].knotTime) {
+ break;
+ }
+ }
+
+ for (uint32 i = _numKnots; i > index; i--)
+ _knots[i] = _knots[i - 1];
+
+ _knots[index].knotTime = knotTime;
+ _knots[index].knotValue = knotValue;
+ _numKnots++;
+ }
+}
+
+void FaderAnimation::setFaderValue(const int32 newValue) {
+ if (getFaderValue() != newValue) {
+ Fader::setFaderValue(newValue);
+ triggerRedraw();
+ }
+}
+
+SoundFader::SoundFader() {
+ _sound = 0;
+ _masterVolume = 0xff;
+}
+
+void SoundFader::attachSound(Sound *sound) {
+ if (!sound && isFading())
+ stopFader();
+
+ _sound = sound;
+}
+
+void SoundFader::setFaderValue(const int32 newVolume) {
+ if (_sound)
+ _sound->setVolume((newVolume * _masterVolume) >> 8);
+
+ _currentValue = newVolume;
+}
+
+void SoundFader::setMasterVolume(const uint16 masterVolume) {
+ _masterVolume = masterVolume;
+ setFaderValue(getFaderValue());
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/fader.h b/engines/pegasus/fader.h
new file mode 100644
index 0000000000..0a8cd549e6
--- /dev/null
+++ b/engines/pegasus/fader.h
@@ -0,0 +1,130 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_FADER_H
+#define PEGASUS_FADER_H
+
+#include "pegasus/elements.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class Fader;
+
+class FaderMoveSpec {
+friend class Fader;
+public:
+ FaderMoveSpec() {
+ _faderScale = kDefaultTimeScale;
+ _numKnots = 0;
+ }
+
+ FaderMoveSpec(const TimeScale scale) {
+ _faderScale = scale;
+ _numKnots = 0;
+ }
+
+ void setFaderScale(const TimeScale scale) { _faderScale = scale; }
+ TimeScale getFaderScale() const { return _faderScale; }
+
+ void makeOneKnotFaderSpec(const int32);
+ void makeTwoKnotFaderSpec(const TimeScale, const TimeValue, const int32, const TimeValue, const int32);
+
+ void insertFaderKnot(const TimeValue, const int32);
+
+ uint32 getNumKnots() const { return _numKnots; }
+ TimeValue getNthKnotTime(const uint32 index) const { return _knots[index].knotTime; }
+ int32 getNthKnotValue(const uint32 index) const { return _knots[index].knotValue; }
+
+protected:
+ struct FaderKnot {
+ TimeValue knotTime;
+ int32 knotValue;
+ };
+
+ TimeScale _faderScale;
+ uint32 _numKnots;
+
+ static const uint32 kMaxFaderKnots = 20;
+ FaderKnot _knots[kMaxFaderKnots];
+};
+
+class Fader : public IdlerTimeBase {
+public:
+ Fader();
+ virtual ~Fader() {}
+
+ virtual void setFaderValue(const int32);
+ int32 getFaderValue() const { return _currentValue; }
+ virtual void startFader(const FaderMoveSpec &);
+ virtual void startFaderSync(const FaderMoveSpec &);
+ virtual void loopFader(const FaderMoveSpec &);
+ virtual void stopFader();
+ virtual bool isFading() { return isRunning(); }
+
+ void pauseFader();
+ void continueFader();
+
+ void getCurrentFaderMove(FaderMoveSpec &spec) { spec = _currentFaderMove; }
+
+protected:
+ bool initFaderMove(const FaderMoveSpec &);
+ virtual void timeChanged(const TimeValue);
+
+ int32 _currentValue;
+ FaderMoveSpec _currentFaderMove;
+};
+
+class FaderAnimation : public DisplayElement, public Fader {
+public:
+ FaderAnimation(const DisplayElementID id) : DisplayElement(id) {}
+ virtual ~FaderAnimation() {}
+
+ void setFaderValue(const int32);
+};
+
+class Sound;
+
+class SoundFader : public Fader {
+friend class Sound;
+public:
+ SoundFader();
+ virtual ~SoundFader() {}
+
+ void setFaderValue(const int32);
+
+ void setMasterVolume(const uint16);
+ uint16 getMasterVolume() const { return _masterVolume; }
+
+protected:
+ void attachSound(Sound *);
+
+ Sound *_sound;
+ uint16 _masterVolume;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/gamestate.cpp b/engines/pegasus/gamestate.cpp
new file mode 100644
index 0000000000..7a4e657e02
--- /dev/null
+++ b/engines/pegasus/gamestate.cpp
@@ -0,0 +1,2359 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/error.h"
+#include "common/stream.h"
+
+#include "pegasus/constants.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/scoring.h"
+
+namespace Common {
+DECLARE_SINGLETON(Pegasus::GameStateManager);
+}
+
+namespace Pegasus {
+
+Common::Error GameStateManager::writeGameState(Common::WriteStream *stream) {
+ stream->writeUint16BE(_currentNeighborhood);
+ stream->writeUint16BE(_currentRoom);
+ stream->writeByte(_currentDirection);
+ stream->writeUint16BE(_nexNeighborhoodID);
+ stream->writeUint16BE(_nextRoomID);
+ stream->writeByte(_nextDirection);
+ stream->writeUint16BE(_lastNeighborhood);
+ stream->writeUint16BE(_lastRoom);
+ stream->writeByte(_lastDirection);
+ stream->writeUint16BE(_openDoorRoom);
+ stream->writeByte(_openDoorDirection);
+
+ _globalFlags.writeToStream(stream);
+ _scoringFlags.writeToStream(stream);
+ _itemTakenFlags.writeToStream(stream);
+
+ writeCaldoriaState(stream);
+ writeTSAState(stream);
+ writePrehistoricState(stream);
+ writeNoradState(stream);
+ writeMarsState(stream);
+ writeWSCState(stream);
+
+ if (stream->err())
+ return Common::kWritingFailed;
+
+ return Common::kNoError;
+}
+
+Common::Error GameStateManager::readGameState(Common::ReadStream *stream) {
+ _currentNeighborhood = stream->readUint16BE();
+ _currentRoom = stream->readUint16BE();
+ _currentDirection = stream->readByte();
+ _nexNeighborhoodID = stream->readUint16BE();
+ _nextRoomID = stream->readUint16BE();
+ _nextDirection = stream->readByte();
+ _lastNeighborhood = stream->readUint16BE();
+ _lastRoom = stream->readUint16BE();
+ _lastDirection = stream->readByte();
+ _openDoorRoom = stream->readUint16BE();
+ _openDoorDirection = stream->readByte();
+
+ _globalFlags.readFromStream(stream);
+ _scoringFlags.readFromStream(stream);
+ _itemTakenFlags.readFromStream(stream);
+
+ readCaldoriaState(stream);
+ readTSAState(stream);
+ readPrehistoricState(stream);
+ readNoradState(stream);
+ readMarsState(stream);
+ readWSCState(stream);
+
+ if (stream->err())
+ return Common::kReadingFailed;
+
+ return Common::kNoError;
+}
+
+void GameStateManager::resetGameState() {
+ _currentNeighborhood = kNoNeighborhoodID;
+ _currentRoom = kNoRoomID;
+ _currentDirection = kNoDirection;
+ _nexNeighborhoodID = kNoNeighborhoodID;
+ _nextRoomID = kNoRoomID;
+ _nextDirection = kNoDirection;
+ _lastNeighborhood = kNoNeighborhoodID;
+ _lastRoom = kNoRoomID;
+ _lastDirection = kNoDirection;
+ _openDoorRoom = kNoRoomID;
+ _openDoorDirection = kNoDirection;
+
+ _globalFlags.clearAllFlags();
+ _scoringFlags.clearAllFlags();
+ _itemTakenFlags.clearAllFlags();
+
+ resetCaldoriaState();
+ resetTSAState();
+ resetPrehistoricState();
+ resetNoradState();
+ resetMarsState();
+ resetWSCState();
+}
+
+void GameStateManager::getCurrentLocation(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction) {
+ neighborhood = _currentNeighborhood;
+ room = _currentRoom;
+ direction = _currentDirection;
+}
+
+void GameStateManager::setCurrentLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) {
+ _lastNeighborhood = _currentNeighborhood;
+ _lastRoom = _currentRoom;
+ _lastDirection = _currentDirection;
+ _currentNeighborhood = neighborhood;
+ _currentRoom = room;
+ _currentDirection = direction;
+}
+
+NeighborhoodID GameStateManager::getCurrentNeighborhood() {
+ return _currentNeighborhood;
+}
+
+void GameStateManager::setCurrentNeighborhood(const NeighborhoodID neighborhood) {
+ _lastNeighborhood = _currentNeighborhood;
+ _currentNeighborhood = neighborhood;
+}
+
+RoomID GameStateManager::getCurrentRoom() {
+ return _currentRoom;
+}
+
+void GameStateManager::setCurrentRoom(const RoomID room) {
+ _lastRoom = _currentRoom;
+ _currentRoom = room;
+}
+
+DirectionConstant GameStateManager::getCurrentDirection() {
+ return _currentDirection;
+}
+
+void GameStateManager::setCurrentDirection(const DirectionConstant direction) {
+ _lastDirection = _currentDirection;
+ _currentDirection = direction;
+}
+
+RoomViewID GameStateManager::getCurrentRoomAndView() {
+ return MakeRoomView(_currentRoom, _currentDirection);
+}
+
+void GameStateManager::getNextLocation(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction) {
+ neighborhood = _nexNeighborhoodID;
+ room = _nextRoomID;
+ direction = _nextDirection;
+}
+
+void GameStateManager::setNextLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) {
+ _nexNeighborhoodID = neighborhood;
+ _nextRoomID = room;
+ _nextDirection = direction;
+}
+
+NeighborhoodID GameStateManager::getNextNeighborhood() {
+ return _nexNeighborhoodID;
+}
+
+void GameStateManager::setNextNeighborhood(const NeighborhoodID neighborhood) {
+ _nexNeighborhoodID = neighborhood;
+}
+
+RoomID GameStateManager::getNextRoom() {
+ return _nextRoomID;
+}
+
+void GameStateManager::setNextRoom(const RoomID room) {
+ _nextRoomID = room;
+}
+
+DirectionConstant GameStateManager::getNextDirection() {
+ return _nextDirection;
+}
+
+void GameStateManager::setNextDirection(const DirectionConstant direction) {
+ _nextDirection = direction;
+}
+
+void GameStateManager::getLastLocation(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction) {
+ neighborhood = _currentNeighborhood;
+ room = _currentRoom;
+ direction = _currentDirection;
+}
+
+void GameStateManager::setLastLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) {
+ _currentNeighborhood = neighborhood;
+ _currentRoom = room;
+ _currentDirection = direction;
+}
+
+NeighborhoodID GameStateManager::getLastNeighborhood() {
+ return _lastNeighborhood;
+}
+
+void GameStateManager::setLastNeighborhood(const NeighborhoodID neighborhood) {
+ _lastNeighborhood = neighborhood;
+}
+
+RoomID GameStateManager::getLastRoom() {
+ return _lastRoom;
+}
+
+void GameStateManager::setLastRoom(const RoomID room) {
+ _lastRoom = room;
+}
+
+DirectionConstant GameStateManager::getLastDirection() {
+ return _lastDirection;
+}
+
+void GameStateManager::setLastDirection(const DirectionConstant direction) {
+ _lastDirection = direction;
+}
+
+RoomViewID GameStateManager::getLastRoomAndView() {
+ return MakeRoomView(_lastRoom, _lastDirection);
+}
+
+void GameStateManager::getOpenDoorLocation(RoomID &room, DirectionConstant &direction) {
+ room = _openDoorRoom;
+ direction = _openDoorDirection;
+}
+
+void GameStateManager::setOpenDoorLocation(const RoomID room, const DirectionConstant direction) {
+ _openDoorRoom = room;
+ _openDoorDirection = direction;
+}
+
+RoomID GameStateManager::getOpenDoorRoom() {
+ return _openDoorRoom;
+}
+
+void GameStateManager::setOpenDoorRoom(const RoomID room) {
+ _openDoorRoom = room;
+}
+
+DirectionConstant GameStateManager::getOpenDoorDirection() {
+ return _openDoorDirection;
+}
+
+void GameStateManager::setOpenDoorDirection(const DirectionConstant direction) {
+ _openDoorDirection = direction;
+}
+
+RoomViewID GameStateManager::getDoorOpenRoomAndView() {
+ return MakeRoomView(_openDoorRoom, _openDoorDirection);
+}
+
+bool GameStateManager::isCurrentDoorOpen() {
+ return _openDoorRoom == _currentRoom && _openDoorDirection == _currentDirection;
+}
+
+GameScoreType GameStateManager::getCaldoriaTSAScore() {
+ GameScoreType result = 0;
+
+ if (_scoringFlags.getFlag(kScoringSawINNFlag))
+ result += kSawINNScore;
+ if (_scoringFlags.getFlag(kScoringTookShowerFlag))
+ result += kTookShowerScore;
+ if (_scoringFlags.getFlag(kScoringFixedHairFlag))
+ result += kFixedHairScore;
+ if (_scoringFlags.getFlag(kScoringGotKeyCardFlag))
+ result += kGotKeyCardScore;
+ if (_scoringFlags.getFlag(kScoringReadPaperFlag))
+ result += kReadPaperScore;
+ if (_scoringFlags.getFlag(kScoringLookThroughTelescopeFlag))
+ result += kLookThroughTelescopeScore;
+ if (_scoringFlags.getFlag(kScoringSawCaldoriaKioskFlag))
+ result += kSawCaldoriaKioskScore;
+ if (_scoringFlags.getFlag(kScoringGoToTSAFlag))
+ result += kGoToTSAScore;
+ if (_scoringFlags.getFlag(kScoringEnterTSAFlag))
+ result += kEnterTSAScore;
+ if (_scoringFlags.getFlag(kScoringSawBust1Flag))
+ result += kSawBust1Score;
+ if (_scoringFlags.getFlag(kScoringSawBust2Flag))
+ result += kSawBust2Score;
+ if (_scoringFlags.getFlag(kScoringSawBust3Flag))
+ result += kSawBust3Score;
+ if (_scoringFlags.getFlag(kScoringSawBust4Flag))
+ result += kSawBust4Score;
+ if (_scoringFlags.getFlag(kScoringSawBust5Flag))
+ result += kSawBust5Score;
+ if (_scoringFlags.getFlag(kScoringSawBust6Flag))
+ result += kSawBust6Score;
+ if (_scoringFlags.getFlag(kScoringSawTheoryFlag))
+ result += kSawTheoryScore;
+ if (_scoringFlags.getFlag(kScoringSawBackgroundFlag))
+ result += kSawBackgroundScore;
+ if (_scoringFlags.getFlag(kScoringSawProcedureFlag))
+ result += kSawProcedureScore;
+ if (_scoringFlags.getFlag(kScoringGotJourneymanKeyFlag))
+ result += kGotJourneymanKeyScore;
+ if (_scoringFlags.getFlag(kScoringGotPegasusBiochipFlag))
+ result += kGotPegasusBiochipScore;
+ if (_scoringFlags.getFlag(kScoringGotBiosuitFlag))
+ result += kGotBiosuitScore;
+ if (_scoringFlags.getFlag(kScoringGoToPrehistoricFlag))
+ result += kGoToPrehistoricScore;
+ if (_scoringFlags.getFlag(kScoringPutLogInReaderFlag))
+ result += kPutLogInReaderScore;
+ if (_scoringFlags.getFlag(kScoringSawCaldoriaNormalFlag))
+ result += kSawCaldoriaNormalScore;
+ if (_scoringFlags.getFlag(kScoringSawCaldoriaAlteredFlag))
+ result += kSawCaldoriaAlteredScore;
+ if (_scoringFlags.getFlag(kScoringSawNoradNormalFlag))
+ result += kSawNoradNormalScore;
+ if (_scoringFlags.getFlag(kScoringSawNoradAlteredFlag))
+ result += kSawNoradAlteredScore;
+ if (_scoringFlags.getFlag(kScoringSawMarsNormalFlag))
+ result += kSawMarsNormalScore;
+ if (_scoringFlags.getFlag(kScoringSawMarsAlteredFlag))
+ result += kSawMarsAlteredScore;
+ if (_scoringFlags.getFlag(kScoringSawWSCNormalFlag))
+ result += kSawWSCNormalScore;
+ if (_scoringFlags.getFlag(kScoringSawWSCAlteredFlag))
+ result += kSawWSCAlteredScore;
+ if (_scoringFlags.getFlag(kScoringWentToReadyRoom2Flag))
+ result += kWentToReadyRoom2Score;
+ if (_scoringFlags.getFlag(kScoringWentAfterSinclairFlag))
+ result += kWentAfterSinclairScore;
+ if (_scoringFlags.getFlag(kScoringUsedCardBombFlag))
+ result += kUsedCardBombScore;
+ if (_scoringFlags.getFlag(kScoringShieldedCardBombFlag))
+ result += kShieldedCardBombScore;
+ if (_scoringFlags.getFlag(kScoringStunnedSinclairFlag))
+ result += kStunnedSinclairScore;
+ if (_scoringFlags.getFlag(kScoringDisarmedNukeFlag))
+ result += kDisarmedNukeScore;
+
+ return result;
+}
+
+GameScoreType GameStateManager::getPrehistoricScore() {
+ GameScoreType result = 0;
+
+ if (_scoringFlags.getFlag(kScoringThrewBreakerFlag))
+ result += kThrewBreakerScore;
+ if (_scoringFlags.getFlag(kScoringExtendedBridgeFlag))
+ result += kExtendedBridgeScore;
+ if (_scoringFlags.getFlag(kScoringGotHistoricalLogFlag))
+ result += kGotHistoricalLogScore;
+ if (_scoringFlags.getFlag(kScoringFinishedPrehistoricFlag))
+ result += kFinishedPrehistoricScore;
+
+ return result;
+}
+
+GameScoreType GameStateManager::getMarsScore() {
+ GameScoreType result = 0;
+
+ if (_scoringFlags.getFlag(kScoringThrownByRobotFlag))
+ result += kThrownByRobotScore;
+ if (_scoringFlags.getFlag(kScoringGotMarsCardFlag))
+ result += kGotMarsCardScore;
+ if (_scoringFlags.getFlag(kScoringSawMarsKioskFlag))
+ result += kSawMarsKioskScore;
+ if (_scoringFlags.getFlag(kScoringSawTransportMapFlag))
+ result += kSawTransportMapScore;
+ if (_scoringFlags.getFlag(kScoringGotCrowBarFlag))
+ result += kGotCrowBarScore;
+ if (_scoringFlags.getFlag(kScoringTurnedOnTransportFlag))
+ result += kTurnedOnTransportScore;
+ if (_scoringFlags.getFlag(kScoringGotOxygenMaskFlag))
+ result += kGotOxygenMaskScore;
+ if (_scoringFlags.getFlag(kScoringAvoidedRobotFlag))
+ result += kAvoidedRobotScore;
+ if (_scoringFlags.getFlag(kScoringActivatedPlatformFlag))
+ result += kActivatedPlatformScore;
+ if (_scoringFlags.getFlag(kScoringUsedLiquidNitrogenFlag))
+ result += kUsedLiquidNitrogenScore;
+ if (_scoringFlags.getFlag(kScoringUsedCrowBarFlag))
+ result += kUsedCrowBarScore;
+ if (_scoringFlags.getFlag(kScoringFoundCardBombFlag))
+ result += kFoundCardBombScore;
+ if (_scoringFlags.getFlag(kScoringDisarmedCardBombFlag))
+ result += kDisarmedCardBombScore;
+ if (_scoringFlags.getFlag(kScoringGotCardBombFlag))
+ result += kGotCardBombScore;
+ if (_scoringFlags.getFlag(kScoringThreadedMazeFlag))
+ result += kThreadedMazeScore;
+ if (_scoringFlags.getFlag(kScoringThreadedGearRoomFlag))
+ result += kThreadedGearRoomScore;
+ if (_scoringFlags.getFlag(kScoringEnteredShuttleFlag))
+ result += kEnteredShuttleScore;
+ if (_scoringFlags.getFlag(kScoringEnteredLaunchTubeFlag))
+ result += kEnteredLaunchTubeScore;
+ if (_scoringFlags.getFlag(kScoringStoppedRobotsShuttleFlag))
+ result += kStoppedRobotsShuttleScore;
+ if (_scoringFlags.getFlag(kScoringGotMarsOpMemChipFlag))
+ result += kGotMarsOpMemChipScore;
+ if (_scoringFlags.getFlag(kScoringFinishedMarsFlag))
+ result += kFinishedMarsScore;
+
+ return result;
+}
+
+GameScoreType GameStateManager::getNoradScore() {
+ GameScoreType result = 0;
+
+ if (_scoringFlags.getFlag(kScoringSawSecurityMonitorFlag))
+ result += kSawSecurityMonitorScore;
+ if (_scoringFlags.getFlag(kScoringFilledOxygenCanisterFlag))
+ result += kFilledOxygenCanisterScore;
+ if (_scoringFlags.getFlag(kScoringFilledArgonCanisterFlag))
+ result += kFilledArgonCanisterScore;
+ if (_scoringFlags.getFlag(kScoringSawUnconsciousOperatorFlag))
+ result += kSawUnconsciousOperatorScore;
+ if (_scoringFlags.getFlag(kScoringWentThroughPressureDoorFlag))
+ result += kWentThroughPressureDoorScore;
+ if (_scoringFlags.getFlag(kScoringPreppedSubFlag))
+ result += kPreppedSubScore;
+ if (_scoringFlags.getFlag(kScoringEnteredSubFlag))
+ result += kEnteredSubScore;
+ if (_scoringFlags.getFlag(kScoringExitedSubFlag))
+ result += kExitedSubScore;
+ if (_scoringFlags.getFlag(kScoringSawRobotAt54NorthFlag))
+ result += kSawRobotAt54NorthScore;
+ if (_scoringFlags.getFlag(kScoringPlayedWithClawFlag))
+ result += kPlayedWithClawScore;
+ if (_scoringFlags.getFlag(kScoringUsedRetinalChipFlag))
+ result += kUsedRetinalChipScore;
+ if (_scoringFlags.getFlag(kScoringFinishedGlobeGameFlag))
+ result += kFinishedGlobeGameScore;
+ if (_scoringFlags.getFlag(kScoringStoppedNoradRobotFlag))
+ result += kStoppedNoradRobotScore;
+ if (_scoringFlags.getFlag(kScoringGotNoradOpMemChipFlag))
+ result += kGotNoradOpMemChipScore;
+ if (_scoringFlags.getFlag(kScoringFinishedNoradFlag))
+ result += kFinishedNoradScore;
+
+ return result;
+}
+
+GameScoreType GameStateManager::getWSCScore() {
+ GameScoreType result = 0;
+
+ if (_scoringFlags.getFlag(kScoringRemovedDartFlag))
+ result += kRemovedDartScore;
+ if (_scoringFlags.getFlag(kScoringAnalyzedDartFlag))
+ result += kAnalyzedDartScore;
+ if (_scoringFlags.getFlag(kScoringBuiltAntidoteFlag))
+ result += kBuiltAntidoteScore;
+ if (_scoringFlags.getFlag(kScoringGotSinclairKeyFlag))
+ result += kGotSinclairKeyScore;
+ if (_scoringFlags.getFlag(kScoringGotArgonCanisterFlag))
+ result += kGotArgonCanisterScore;
+ if (_scoringFlags.getFlag(kScoringGotNitrogenCanisterFlag))
+ result += kGotNitrogenCanisterScore;
+ if (_scoringFlags.getFlag(kScoringPlayedWithMessagesFlag))
+ result += kPlayedWithMessagesScore;
+ if (_scoringFlags.getFlag(kScoringSawMorphExperimentFlag))
+ result += kSawMorphExperimentScore;
+ if (_scoringFlags.getFlag(kScoringEnteredSinclairOfficeFlag))
+ result += kEnteredSinclairOfficeScore;
+ if (_scoringFlags.getFlag(kScoringSawBrochureFlag))
+ result += kSawBrochureScore;
+ if (_scoringFlags.getFlag(kScoringSawSinclairEntry1Flag))
+ result += kSawSinclairEntry1Score;
+ if (_scoringFlags.getFlag(kScoringSawSinclairEntry2Flag))
+ result += kSawSinclairEntry2Score;
+ if (_scoringFlags.getFlag(kScoringSawSinclairEntry3Flag))
+ result += kSawSinclairEntry3Score;
+ if (_scoringFlags.getFlag(kScoringSawWSCDirectoryFlag))
+ result += kSawWSCDirectoryScore;
+ if (_scoringFlags.getFlag(kScoringUsedCrowBarInWSCFlag))
+ result += kUsedCrowBarInWSCScore;
+ if (_scoringFlags.getFlag(kScoringFinishedPlasmaDodgeFlag))
+ result += kFinishedPlasmaDodgeScore;
+ if (_scoringFlags.getFlag(kScoringOpenedCatwalkFlag))
+ result += kOpenedCatwalkScore;
+ if (_scoringFlags.getFlag(kScoringStoppedWSCRobotFlag))
+ result += kStoppedWSCRobotScore;
+ if (_scoringFlags.getFlag(kScoringGotWSCOpMemChipFlag))
+ result += kGotWSCOpMemChipScore;
+ if (_scoringFlags.getFlag(kScoringFinishedWSCFlag))
+ result += kFinishedWSCScore;
+
+ return result;
+}
+
+GameScoreType GameStateManager::getGandhiScore() {
+ GameScoreType result = 0;
+
+ if (_scoringFlags.getFlag(kScoringMarsGandhiFlag))
+ result += kMarsGandhiScore;
+ if (_scoringFlags.getFlag(kScoringNoradGandhiFlag))
+ result += kNoradGandhiScore;
+ if (_scoringFlags.getFlag(kScoringWSCGandhiFlag))
+ result += kWSCGandhiScore;
+
+ return result;
+}
+
+GameScoreType GameStateManager::getTotalScore() {
+ return getCaldoriaTSAScore() +
+ getPrehistoricScore() +
+ getMarsScore() +
+ getNoradScore() +
+ getWSCScore() +
+ getGandhiScore();
+}
+
+/////////////////////////////////////////////
+//
+// Caldoria data
+
+void GameStateManager::writeCaldoriaState(Common::WriteStream *stream) {
+ _caldoriaFlags.writeToStream(stream);
+ stream->writeUint32BE(_caldoriaFuseTimeLimit);
+}
+
+void GameStateManager::readCaldoriaState(Common::ReadStream *stream) {
+ _caldoriaFlags.readFromStream(stream);
+ _caldoriaFuseTimeLimit = stream->readUint32BE();
+}
+
+void GameStateManager::resetCaldoriaState() {
+ _caldoriaFlags.clearAllFlags();
+ _caldoriaFuseTimeLimit = 0;
+}
+
+/////////////////////////////////////////////
+//
+// TSA data
+
+void GameStateManager::writeTSAState(Common::WriteStream *stream) {
+ _TSAFlags.writeToStream(stream);
+ stream->writeUint32BE(_TSARipTimerTime);
+ stream->writeUint32BE(_TSAFuseTimeLimit);
+ stream->writeByte(_TSAState);
+ stream->writeByte(_T0BMonitorMode);
+ stream->writeUint32BE(_T0BMonitorStart);
+}
+
+void GameStateManager::readTSAState(Common::ReadStream *stream) {
+ _TSAFlags.readFromStream(stream);
+ _TSARipTimerTime = stream->readUint32BE();
+ _TSAFuseTimeLimit = stream->readUint32BE();
+ _TSAState = stream->readByte();
+ _T0BMonitorMode = stream->readByte();
+ _T0BMonitorStart = stream->readUint32BE();
+}
+
+void GameStateManager::resetTSAState() {
+ _TSAFlags.clearAllFlags();
+ _TSAState = 0;
+ _T0BMonitorMode = 0;
+ _T0BMonitorStart = 0;
+ _TSARipTimerTime = 0;
+ _TSAFuseTimeLimit = kTSAUncreatedTimeLimit;
+}
+
+/////////////////////////////////////////////
+//
+// Prehistoric data
+
+void GameStateManager::writePrehistoricState(Common::WriteStream *stream) {
+ _prehistoricFlags.writeToStream(stream);
+}
+
+void GameStateManager::readPrehistoricState(Common::ReadStream *stream) {
+ _prehistoricFlags.readFromStream(stream);
+}
+
+void GameStateManager::resetPrehistoricState() {
+ _prehistoricFlags.clearAllFlags();
+}
+
+/////////////////////////////////////////////
+//
+// Norad data
+
+void GameStateManager::writeNoradState(Common::WriteStream *stream) {
+ _noradFlags.writeToStream(stream);
+ stream->writeUint16BE(_noradSubRoomPressure);
+ stream->writeByte(_noradSubPrepState);
+}
+
+void GameStateManager::readNoradState(Common::ReadStream *stream) {
+ _noradFlags.readFromStream(stream);
+ _noradSubRoomPressure = stream->readUint16BE();
+ _noradSubPrepState = (NoradSubPrepState)stream->readByte();
+}
+
+void GameStateManager::resetNoradState() {
+ _noradFlags.clearAllFlags();
+ _noradSubRoomPressure = 9;
+ _noradSubPrepState = kSubNotPrepped;
+}
+
+/////////////////////////////////////////////
+//
+// Mars data
+
+void GameStateManager::writeMarsState(Common::WriteStream *stream) {
+ _marsFlags.writeToStream(stream);
+}
+
+void GameStateManager::readMarsState(Common::ReadStream *stream) {
+ _marsFlags.readFromStream(stream);
+}
+
+void GameStateManager::resetMarsState() {
+ _marsFlags.clearAllFlags();
+}
+
+/////////////////////////////////////////////
+//
+// WSC data
+
+void GameStateManager::writeWSCState(Common::WriteStream *stream) {
+ _WSCFlags.writeToStream(stream);
+}
+
+void GameStateManager::readWSCState(Common::ReadStream *stream) {
+ _WSCFlags.readFromStream(stream);
+}
+
+void GameStateManager::resetWSCState() {
+ _WSCFlags.clearAllFlags();
+}
+
+void GameStateManager::setScoringSawINN(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawINNFlag, flag);
+}
+
+void GameStateManager::setScoringTookShower(const bool flag) {
+ _scoringFlags.setFlag(kScoringTookShowerFlag, flag);
+}
+
+void GameStateManager::setScoringFixedHair(const bool flag) {
+ _scoringFlags.setFlag(kScoringFixedHairFlag, flag);
+}
+
+void GameStateManager::setScoringGotKeyCard(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotKeyCardFlag, flag);
+}
+
+void GameStateManager::setScoringReadPaper(const bool flag) {
+ _scoringFlags.setFlag(kScoringReadPaperFlag, flag);
+}
+
+void GameStateManager::setScoringLookThroughTelescope(const bool flag) {
+ _scoringFlags.setFlag(kScoringLookThroughTelescopeFlag, flag);
+}
+
+void GameStateManager::setScoringSawCaldoriaKiosk(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawCaldoriaKioskFlag, flag);
+}
+
+void GameStateManager::setScoringGoToTSA(const bool flag) {
+ _scoringFlags.setFlag(kScoringGoToTSAFlag, flag);
+}
+
+void GameStateManager::setScoringEnterTSA(const bool flag) {
+ _scoringFlags.setFlag(kScoringEnterTSAFlag, flag);
+}
+
+void GameStateManager::setScoringSawBust1(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBust1Flag, flag);
+}
+
+void GameStateManager::setScoringSawBust2(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBust2Flag, flag);
+}
+
+void GameStateManager::setScoringSawBust3(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBust3Flag, flag);
+}
+
+void GameStateManager::setScoringSawBust4(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBust4Flag, flag);
+}
+
+void GameStateManager::setScoringSawBust5(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBust5Flag, flag);
+}
+
+void GameStateManager::setScoringSawBust6(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBust6Flag, flag);
+}
+
+void GameStateManager::setScoringSawTheory(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawTheoryFlag, flag);
+}
+
+void GameStateManager::setScoringSawBackground(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBackgroundFlag, flag);
+}
+
+void GameStateManager::setScoringSawProcedure(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawProcedureFlag, flag);
+}
+
+void GameStateManager::setScoringGotJourneymanKey(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotJourneymanKeyFlag, flag);
+}
+
+void GameStateManager::setScoringGotPegasusBiochip(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotPegasusBiochipFlag, flag);
+}
+
+void GameStateManager::setScoringGotBiosuit(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotBiosuitFlag, flag);
+}
+
+void GameStateManager::setScoringGoToPrehistoric(const bool flag) {
+ _scoringFlags.setFlag(kScoringGoToPrehistoricFlag, flag);
+}
+
+void GameStateManager::setScoringPutLogInReader(const bool flag) {
+ _scoringFlags.setFlag(kScoringPutLogInReaderFlag, flag);
+}
+
+void GameStateManager::setScoringSawCaldoriaNormal(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawCaldoriaNormalFlag, flag);
+}
+
+void GameStateManager::setScoringSawCaldoriaAltered(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawCaldoriaAlteredFlag, flag);
+}
+
+void GameStateManager::setScoringSawNoradNormal(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawNoradNormalFlag, flag);
+}
+
+void GameStateManager::setScoringSawNoradAltered(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawNoradAlteredFlag, flag);
+}
+
+void GameStateManager::setScoringSawMarsNormal(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawMarsNormalFlag, flag);
+}
+
+void GameStateManager::setScoringSawMarsAltered(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawMarsAlteredFlag, flag);
+}
+
+void GameStateManager::setScoringSawWSCNormal(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawWSCNormalFlag, flag);
+}
+
+void GameStateManager::setScoringSawWSCAltered(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawWSCAlteredFlag, flag);
+}
+
+void GameStateManager::setScoringWentToReadyRoom2(const bool flag) {
+ _scoringFlags.setFlag(kScoringWentToReadyRoom2Flag, flag);
+}
+
+void GameStateManager::setScoringWentAfterSinclair(const bool flag) {
+ _scoringFlags.setFlag(kScoringWentAfterSinclairFlag, flag);
+}
+
+void GameStateManager::setScoringUsedCardBomb(const bool flag) {
+ _scoringFlags.setFlag(kScoringUsedCardBombFlag, flag);
+}
+
+void GameStateManager::setScoringShieldedCardBomb(const bool flag) {
+ _scoringFlags.setFlag(kScoringShieldedCardBombFlag, flag);
+}
+
+void GameStateManager::setScoringStunnedSinclair(const bool flag) {
+ _scoringFlags.setFlag(kScoringStunnedSinclairFlag, flag);
+}
+
+void GameStateManager::setScoringDisarmedNuke(const bool flag) {
+ _scoringFlags.setFlag(kScoringDisarmedNukeFlag, flag);
+}
+
+void GameStateManager::setScoringThrewBreaker(const bool flag) {
+ _scoringFlags.setFlag(kScoringThrewBreakerFlag, flag);
+}
+
+void GameStateManager::setScoringExtendedBridge(const bool flag) {
+ _scoringFlags.setFlag(kScoringExtendedBridgeFlag, flag);
+}
+
+void GameStateManager::setScoringGotHistoricalLog(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotHistoricalLogFlag, flag);
+}
+
+void GameStateManager::setScoringFinishedPrehistoric(const bool flag) {
+ _scoringFlags.setFlag(kScoringFinishedPrehistoricFlag, flag);
+}
+
+void GameStateManager::setScoringThrownByRobot(const bool flag) {
+ _scoringFlags.setFlag(kScoringThrownByRobotFlag, flag);
+}
+
+void GameStateManager::setScoringGotMarsCard(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotMarsCardFlag, flag);
+}
+
+void GameStateManager::setScoringSawMarsKiosk(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawMarsKioskFlag, flag);
+}
+
+void GameStateManager::setScoringSawTransportMap(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawTransportMapFlag, flag);
+}
+
+void GameStateManager::setScoringGotCrowBar(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotCrowBarFlag, flag);
+}
+
+void GameStateManager::setScoringTurnedOnTransport(const bool flag) {
+ _scoringFlags.setFlag(kScoringTurnedOnTransportFlag, flag);
+}
+
+void GameStateManager::setScoringGotOxygenMask(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotOxygenMaskFlag, flag);
+}
+
+void GameStateManager::setScoringAvoidedRobot(const bool flag) {
+ _scoringFlags.setFlag(kScoringAvoidedRobotFlag, flag);
+}
+
+void GameStateManager::setScoringActivatedPlatform(const bool flag) {
+ _scoringFlags.setFlag(kScoringActivatedPlatformFlag, flag);
+}
+
+void GameStateManager::setScoringUsedLiquidNitrogen(const bool flag) {
+ _scoringFlags.setFlag(kScoringUsedLiquidNitrogenFlag, flag);
+}
+
+void GameStateManager::setScoringUsedCrowBar(const bool flag) {
+ _scoringFlags.setFlag(kScoringUsedCrowBarFlag, flag);
+}
+
+void GameStateManager::setScoringFoundCardBomb(const bool flag) {
+ _scoringFlags.setFlag(kScoringFoundCardBombFlag, flag);
+}
+
+void GameStateManager::setScoringDisarmedCardBomb(const bool flag) {
+ _scoringFlags.setFlag(kScoringDisarmedCardBombFlag, flag);
+}
+
+void GameStateManager::setScoringGotCardBomb(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotCardBombFlag, flag);
+}
+
+void GameStateManager::setScoringThreadedMaze(const bool flag) {
+ _scoringFlags.setFlag(kScoringThreadedMazeFlag, flag);
+}
+
+void GameStateManager::setScoringThreadedGearRoom(const bool flag) {
+ _scoringFlags.setFlag(kScoringThreadedGearRoomFlag, flag);
+}
+
+void GameStateManager::setScoringEnteredShuttle(const bool flag) {
+ _scoringFlags.setFlag(kScoringEnteredShuttleFlag, flag);
+}
+
+void GameStateManager::setScoringEnteredLaunchTube(const bool flag) {
+ _scoringFlags.setFlag(kScoringEnteredLaunchTubeFlag, flag);
+}
+
+void GameStateManager::setScoringStoppedRobotsShuttle(const bool flag) {
+ _scoringFlags.setFlag(kScoringStoppedRobotsShuttleFlag, flag);
+}
+
+void GameStateManager::setScoringGotMarsOpMemChip(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotMarsOpMemChipFlag, flag);
+}
+
+void GameStateManager::setScoringFinishedMars(const bool flag) {
+ _scoringFlags.setFlag(kScoringFinishedMarsFlag, flag);
+}
+
+void GameStateManager::setScoringSawSecurityMonitor(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawSecurityMonitorFlag, flag);
+}
+
+void GameStateManager::setScoringFilledOxygenCanister(const bool flag) {
+ _scoringFlags.setFlag(kScoringFilledOxygenCanisterFlag, flag);
+}
+
+void GameStateManager::setScoringFilledArgonCanister(const bool flag) {
+ _scoringFlags.setFlag(kScoringFilledArgonCanisterFlag, flag);
+}
+
+void GameStateManager::setScoringSawUnconsciousOperator(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawUnconsciousOperatorFlag, flag);
+}
+
+void GameStateManager::setScoringWentThroughPressureDoor(const bool flag) {
+ _scoringFlags.setFlag(kScoringWentThroughPressureDoorFlag, flag);
+}
+
+void GameStateManager::setScoringPreppedSub(const bool flag) {
+ _scoringFlags.setFlag(kScoringPreppedSubFlag, flag);
+}
+
+void GameStateManager::setScoringEnteredSub(const bool flag) {
+ _scoringFlags.setFlag(kScoringEnteredSubFlag, flag);
+}
+
+void GameStateManager::setScoringExitedSub(const bool flag) {
+ _scoringFlags.setFlag(kScoringExitedSubFlag, flag);
+}
+
+void GameStateManager::setScoringSawRobotAt54North(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawRobotAt54NorthFlag, flag);
+}
+
+void GameStateManager::setScoringPlayedWithClaw(const bool flag) {
+ _scoringFlags.setFlag(kScoringPlayedWithClawFlag, flag);
+}
+
+void GameStateManager::setScoringUsedRetinalChip(const bool flag) {
+ _scoringFlags.setFlag(kScoringUsedRetinalChipFlag, flag);
+}
+
+void GameStateManager::setScoringFinishedGlobeGame(const bool flag) {
+ _scoringFlags.setFlag(kScoringFinishedGlobeGameFlag, flag);
+}
+
+void GameStateManager::setScoringStoppedNoradRobot(const bool flag) {
+ _scoringFlags.setFlag(kScoringStoppedNoradRobotFlag, flag);
+}
+
+void GameStateManager::setScoringGotNoradOpMemChip(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotNoradOpMemChipFlag, flag);
+}
+
+void GameStateManager::setScoringFinishedNorad(const bool flag) {
+ _scoringFlags.setFlag(kScoringFinishedNoradFlag, flag);
+}
+
+void GameStateManager::setScoringRemovedDart(const bool flag) {
+ _scoringFlags.setFlag(kScoringRemovedDartFlag, flag);
+}
+
+void GameStateManager::setScoringAnalyzedDart(const bool flag) {
+ _scoringFlags.setFlag(kScoringAnalyzedDartFlag, flag);
+}
+
+void GameStateManager::setScoringBuiltAntidote(const bool flag) {
+ _scoringFlags.setFlag(kScoringBuiltAntidoteFlag, flag);
+}
+
+void GameStateManager::setScoringGotSinclairKey(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotSinclairKeyFlag, flag);
+}
+
+void GameStateManager::setScoringGotArgonCanister(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotArgonCanisterFlag, flag);
+}
+
+void GameStateManager::setScoringGotNitrogenCanister(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotNitrogenCanisterFlag, flag);
+}
+
+void GameStateManager::setScoringPlayedWithMessages(const bool flag) {
+ _scoringFlags.setFlag(kScoringPlayedWithMessagesFlag, flag);
+}
+
+void GameStateManager::setScoringSawMorphExperiment(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawMorphExperimentFlag, flag);
+}
+
+void GameStateManager::setScoringEnteredSinclairOffice(const bool flag) {
+ _scoringFlags.setFlag(kScoringEnteredSinclairOfficeFlag, flag);
+}
+
+void GameStateManager::setScoringSawBrochure(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawBrochureFlag, flag);
+}
+
+void GameStateManager::setScoringSawSinclairEntry1(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawSinclairEntry1Flag, flag);
+}
+
+void GameStateManager::setScoringSawSinclairEntry2(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawSinclairEntry2Flag, flag);
+}
+
+void GameStateManager::setScoringSawSinclairEntry3(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawSinclairEntry3Flag, flag);
+}
+
+void GameStateManager::setScoringSawWSCDirectory(const bool flag) {
+ _scoringFlags.setFlag(kScoringSawWSCDirectoryFlag, flag);
+}
+
+void GameStateManager::setScoringUsedCrowBarInWSC(const bool flag) {
+ _scoringFlags.setFlag(kScoringUsedCrowBarInWSCFlag, flag);
+}
+
+void GameStateManager::setScoringFinishedPlasmaDodge(const bool flag) {
+ _scoringFlags.setFlag(kScoringFinishedPlasmaDodgeFlag, flag);
+}
+
+void GameStateManager::setScoringOpenedCatwalk(const bool flag) {
+ _scoringFlags.setFlag(kScoringOpenedCatwalkFlag, flag);
+}
+
+void GameStateManager::setScoringStoppedWSCRobot(const bool flag) {
+ _scoringFlags.setFlag(kScoringStoppedWSCRobotFlag, flag);
+}
+
+void GameStateManager::setScoringGotWSCOpMemChip(const bool flag) {
+ _scoringFlags.setFlag(kScoringGotWSCOpMemChipFlag, flag);
+}
+
+void GameStateManager::setScoringFinishedWSC(const bool flag) {
+ _scoringFlags.setFlag(kScoringFinishedWSCFlag, flag);
+}
+
+void GameStateManager::setScoringMarsGandhi(const bool flag) {
+ _scoringFlags.setFlag(kScoringMarsGandhiFlag, flag);
+}
+
+void GameStateManager::setScoringNoradGandhi(const bool flag) {
+ _scoringFlags.setFlag(kScoringNoradGandhiFlag, flag);
+}
+
+void GameStateManager::setScoringWSCGandhi(const bool flag) {
+ _scoringFlags.setFlag(kScoringWSCGandhiFlag, flag);
+}
+
+bool GameStateManager::getScoringSawINN() {
+ return _scoringFlags.getFlag(kScoringSawINNFlag);
+}
+
+bool GameStateManager::getScoringTookShower() {
+ return _scoringFlags.getFlag(kScoringTookShowerFlag);
+}
+
+bool GameStateManager::getScoringFixedHair() {
+ return _scoringFlags.getFlag(kScoringFixedHairFlag);
+}
+
+bool GameStateManager::getScoringGotKeyCard() {
+ return _scoringFlags.getFlag(kScoringGotKeyCardFlag);
+}
+
+bool GameStateManager::getScoringReadPaper() {
+ return _scoringFlags.getFlag(kScoringReadPaperFlag);
+}
+
+bool GameStateManager::getScoringLookThroughTelescope() {
+ return _scoringFlags.getFlag(kScoringLookThroughTelescopeFlag);
+}
+
+bool GameStateManager::getScoringSawCaldoriaKiosk() {
+ return _scoringFlags.getFlag(kScoringSawCaldoriaKioskFlag);
+}
+
+bool GameStateManager::getScoringGoToTSA() {
+ return _scoringFlags.getFlag(kScoringGoToTSAFlag);
+}
+
+bool GameStateManager::getScoringEnterTSA() {
+ return _scoringFlags.getFlag(kScoringEnterTSAFlag);
+}
+
+bool GameStateManager::getScoringSawBust1() {
+ return _scoringFlags.getFlag(kScoringSawBust1Flag);
+}
+
+bool GameStateManager::getScoringSawBust2() {
+ return _scoringFlags.getFlag(kScoringSawBust2Flag);
+}
+
+bool GameStateManager::getScoringSawBust3() {
+ return _scoringFlags.getFlag(kScoringSawBust3Flag);
+}
+
+bool GameStateManager::getScoringSawBust4() {
+ return _scoringFlags.getFlag(kScoringSawBust4Flag);
+}
+
+bool GameStateManager::getScoringSawBust5() {
+ return _scoringFlags.getFlag(kScoringSawBust5Flag);
+}
+
+bool GameStateManager::getScoringSawBust6() {
+ return _scoringFlags.getFlag(kScoringSawBust6Flag);
+}
+
+bool GameStateManager::getScoringSawTheory() {
+ return _scoringFlags.getFlag(kScoringSawTheoryFlag);
+}
+
+bool GameStateManager::getScoringSawBackground() {
+ return _scoringFlags.getFlag(kScoringSawBackgroundFlag);
+}
+
+bool GameStateManager::getScoringSawProcedure() {
+ return _scoringFlags.getFlag(kScoringSawProcedureFlag);
+}
+
+bool GameStateManager::getScoringGotJourneymanKey() {
+ return _scoringFlags.getFlag(kScoringGotJourneymanKeyFlag);
+}
+
+bool GameStateManager::getScoringGotPegasusBiochip() {
+ return _scoringFlags.getFlag(kScoringGotPegasusBiochipFlag);
+}
+
+bool GameStateManager::getScoringGotBiosuit() {
+ return _scoringFlags.getFlag(kScoringGotBiosuitFlag);
+}
+
+bool GameStateManager::getScoringGoToPrehistoric() {
+ return _scoringFlags.getFlag(kScoringGoToPrehistoricFlag);
+}
+
+bool GameStateManager::getScoringPutLogInReader() {
+ return _scoringFlags.getFlag(kScoringPutLogInReaderFlag);
+}
+
+bool GameStateManager::getScoringSawCaldoriaNormal() {
+ return _scoringFlags.getFlag(kScoringSawCaldoriaNormalFlag);
+}
+
+bool GameStateManager::getScoringSawCaldoriaAltered() {
+ return _scoringFlags.getFlag(kScoringSawCaldoriaAlteredFlag);
+}
+
+bool GameStateManager::getScoringSawNoradNormal() {
+ return _scoringFlags.getFlag(kScoringSawNoradNormalFlag);
+}
+
+bool GameStateManager::getScoringSawNoradAltered() {
+ return _scoringFlags.getFlag(kScoringSawNoradAlteredFlag);
+}
+
+bool GameStateManager::getScoringSawMarsNormal() {
+ return _scoringFlags.getFlag(kScoringSawMarsNormalFlag);
+}
+
+bool GameStateManager::getScoringSawMarsAltered() {
+ return _scoringFlags.getFlag(kScoringSawMarsAlteredFlag);
+}
+
+bool GameStateManager::getScoringSawWSCNormal() {
+ return _scoringFlags.getFlag(kScoringSawWSCNormalFlag);
+}
+
+bool GameStateManager::getScoringSawWSCAltered() {
+ return _scoringFlags.getFlag(kScoringSawWSCAlteredFlag);
+}
+
+bool GameStateManager::getScoringWentToReadyRoom2() {
+ return _scoringFlags.getFlag(kScoringWentToReadyRoom2Flag);
+}
+
+bool GameStateManager::getScoringWentAfterSinclair() {
+ return _scoringFlags.getFlag(kScoringWentAfterSinclairFlag);
+}
+
+bool GameStateManager::getScoringUsedCardBomb() {
+ return _scoringFlags.getFlag(kScoringUsedCardBombFlag);
+}
+
+bool GameStateManager::getScoringShieldedCardBomb() {
+ return _scoringFlags.getFlag(kScoringShieldedCardBombFlag);
+}
+
+bool GameStateManager::getScoringStunnedSinclair() {
+ return _scoringFlags.getFlag(kScoringStunnedSinclairFlag);
+}
+
+bool GameStateManager::getScoringDisarmedNuke() {
+ return _scoringFlags.getFlag(kScoringDisarmedNukeFlag);
+}
+
+bool GameStateManager::getScoringThrewBreaker() {
+ return _scoringFlags.getFlag(kScoringThrewBreakerFlag);
+}
+
+bool GameStateManager::getScoringExtendedBridge() {
+ return _scoringFlags.getFlag(kScoringExtendedBridgeFlag);
+}
+
+bool GameStateManager::getScoringGotHistoricalLog() {
+ return _scoringFlags.getFlag(kScoringGotHistoricalLogFlag);
+}
+
+bool GameStateManager::getScoringFinishedPrehistoric() {
+ return _scoringFlags.getFlag(kScoringFinishedPrehistoricFlag);
+}
+
+bool GameStateManager::getScoringThrownByRobot() {
+ return _scoringFlags.getFlag(kScoringThrownByRobotFlag);
+}
+
+bool GameStateManager::getScoringGotMarsCard() {
+ return _scoringFlags.getFlag(kScoringGotMarsCardFlag);
+}
+
+bool GameStateManager::getScoringSawMarsKiosk() {
+ return _scoringFlags.getFlag(kScoringSawMarsKioskFlag);
+}
+
+bool GameStateManager::getScoringSawTransportMap() {
+ return _scoringFlags.getFlag(kScoringSawTransportMapFlag);
+}
+
+bool GameStateManager::getScoringGotCrowBar() {
+ return _scoringFlags.getFlag(kScoringGotCrowBarFlag);
+}
+
+bool GameStateManager::getScoringTurnedOnTransport() {
+ return _scoringFlags.getFlag(kScoringTurnedOnTransportFlag);
+}
+
+bool GameStateManager::getScoringGotOxygenMask() {
+ return _scoringFlags.getFlag(kScoringGotOxygenMaskFlag);
+}
+
+bool GameStateManager::getScoringAvoidedRobot() {
+ return _scoringFlags.getFlag(kScoringAvoidedRobotFlag);
+}
+
+bool GameStateManager::getScoringActivatedPlatform() {
+ return _scoringFlags.getFlag(kScoringActivatedPlatformFlag);
+}
+
+bool GameStateManager::getScoringUsedLiquidNitrogen() {
+ return _scoringFlags.getFlag(kScoringUsedLiquidNitrogenFlag);
+}
+
+bool GameStateManager::getScoringUsedCrowBar() {
+ return _scoringFlags.getFlag(kScoringUsedCrowBarFlag);
+}
+
+bool GameStateManager::getScoringFoundCardBomb() {
+ return _scoringFlags.getFlag(kScoringFoundCardBombFlag);
+}
+
+bool GameStateManager::getScoringDisarmedCardBomb() {
+ return _scoringFlags.getFlag(kScoringDisarmedCardBombFlag);
+}
+
+bool GameStateManager::getScoringGotCardBomb() {
+ return _scoringFlags.getFlag(kScoringGotCardBombFlag);
+}
+
+bool GameStateManager::getScoringThreadedMaze() {
+ return _scoringFlags.getFlag(kScoringThreadedMazeFlag);
+}
+
+bool GameStateManager::getScoringThreadedGearRoom() {
+ return _scoringFlags.getFlag(kScoringThreadedGearRoomFlag);
+}
+
+bool GameStateManager::getScoringEnteredShuttle() {
+ return _scoringFlags.getFlag(kScoringEnteredShuttleFlag);
+}
+
+bool GameStateManager::getScoringEnteredLaunchTube() {
+ return _scoringFlags.getFlag(kScoringEnteredLaunchTubeFlag);
+}
+
+bool GameStateManager::getScoringStoppedRobotsShuttle() {
+ return _scoringFlags.getFlag(kScoringStoppedRobotsShuttleFlag);
+}
+
+bool GameStateManager::getScoringGotMarsOpMemChip() {
+ return _scoringFlags.getFlag(kScoringGotMarsOpMemChipFlag);
+}
+
+bool GameStateManager::getScoringFinishedMars() {
+ return _scoringFlags.getFlag(kScoringFinishedMarsFlag);
+}
+
+bool GameStateManager::getScoringSawSecurityMonitor() {
+ return _scoringFlags.getFlag(kScoringSawSecurityMonitorFlag);
+}
+
+bool GameStateManager::getScoringFilledOxygenCanister() {
+ return _scoringFlags.getFlag(kScoringFilledOxygenCanisterFlag);
+}
+
+bool GameStateManager::getScoringFilledArgonCanister() {
+ return _scoringFlags.getFlag(kScoringFilledArgonCanisterFlag);
+}
+
+bool GameStateManager::getScoringSawUnconsciousOperator() {
+ return _scoringFlags.getFlag(kScoringSawUnconsciousOperatorFlag);
+}
+
+bool GameStateManager::getScoringWentThroughPressureDoor() {
+ return _scoringFlags.getFlag(kScoringWentThroughPressureDoorFlag);
+}
+
+bool GameStateManager::getScoringPreppedSub() {
+ return _scoringFlags.getFlag(kScoringPreppedSubFlag);
+}
+
+bool GameStateManager::getScoringEnteredSub() {
+ return _scoringFlags.getFlag(kScoringEnteredSubFlag);
+}
+
+bool GameStateManager::getScoringExitedSub() {
+ return _scoringFlags.getFlag(kScoringExitedSubFlag);
+}
+
+bool GameStateManager::getScoringSawRobotAt54North() {
+ return _scoringFlags.getFlag(kScoringSawRobotAt54NorthFlag);
+}
+
+bool GameStateManager::getScoringPlayedWithClaw() {
+ return _scoringFlags.getFlag(kScoringPlayedWithClawFlag);
+}
+
+bool GameStateManager::getScoringUsedRetinalChip() {
+ return _scoringFlags.getFlag(kScoringUsedRetinalChipFlag);
+}
+
+bool GameStateManager::getScoringFinishedGlobeGame() {
+ return _scoringFlags.getFlag(kScoringFinishedGlobeGameFlag);
+}
+
+bool GameStateManager::getScoringStoppedNoradRobot() {
+ return _scoringFlags.getFlag(kScoringStoppedNoradRobotFlag);
+}
+
+bool GameStateManager::getScoringGotNoradOpMemChip() {
+ return _scoringFlags.getFlag(kScoringGotNoradOpMemChipFlag);
+}
+
+bool GameStateManager::getScoringFinishedNorad() {
+ return _scoringFlags.getFlag(kScoringFinishedNoradFlag);
+}
+
+bool GameStateManager::getScoringRemovedDart() {
+ return _scoringFlags.getFlag(kScoringRemovedDartFlag);
+}
+
+bool GameStateManager::getScoringAnalyzedDart() {
+ return _scoringFlags.getFlag(kScoringAnalyzedDartFlag);
+}
+
+bool GameStateManager::getScoringBuiltAntidote() {
+ return _scoringFlags.getFlag(kScoringBuiltAntidoteFlag);
+}
+
+bool GameStateManager::getScoringGotSinclairKey() {
+ return _scoringFlags.getFlag(kScoringGotSinclairKeyFlag);
+}
+
+bool GameStateManager::getScoringGotArgonCanister() {
+ return _scoringFlags.getFlag(kScoringGotArgonCanisterFlag);
+}
+
+bool GameStateManager::getScoringGotNitrogenCanister() {
+ return _scoringFlags.getFlag(kScoringGotNitrogenCanisterFlag);
+}
+
+bool GameStateManager::getScoringPlayedWithMessages() {
+ return _scoringFlags.getFlag(kScoringPlayedWithMessagesFlag);
+}
+
+bool GameStateManager::getScoringSawMorphExperiment() {
+ return _scoringFlags.getFlag(kScoringSawMorphExperimentFlag);
+}
+
+bool GameStateManager::getScoringEnteredSinclairOffice() {
+ return _scoringFlags.getFlag(kScoringEnteredSinclairOfficeFlag);
+}
+
+bool GameStateManager::getScoringSawBrochure() {
+ return _scoringFlags.getFlag(kScoringSawBrochureFlag);
+}
+
+bool GameStateManager::getScoringSawSinclairEntry1() {
+ return _scoringFlags.getFlag(kScoringSawSinclairEntry1Flag);
+}
+
+bool GameStateManager::getScoringSawSinclairEntry2() {
+ return _scoringFlags.getFlag(kScoringSawSinclairEntry2Flag);
+}
+
+bool GameStateManager::getScoringSawSinclairEntry3() {
+ return _scoringFlags.getFlag(kScoringSawSinclairEntry3Flag);
+}
+
+bool GameStateManager::getScoringSawWSCDirectory() {
+ return _scoringFlags.getFlag(kScoringSawWSCDirectoryFlag);
+}
+
+bool GameStateManager::getScoringUsedCrowBarInWSC() {
+ return _scoringFlags.getFlag(kScoringUsedCrowBarInWSCFlag);
+}
+
+bool GameStateManager::getScoringFinishedPlasmaDodge() {
+ return _scoringFlags.getFlag(kScoringFinishedPlasmaDodgeFlag);
+}
+
+bool GameStateManager::getScoringOpenedCatwalk() {
+ return _scoringFlags.getFlag(kScoringOpenedCatwalkFlag);
+}
+
+bool GameStateManager::getScoringStoppedWSCRobot() {
+ return _scoringFlags.getFlag(kScoringStoppedWSCRobotFlag);
+}
+
+bool GameStateManager::getScoringGotWSCOpMemChip() {
+ return _scoringFlags.getFlag(kScoringGotWSCOpMemChipFlag);
+}
+
+bool GameStateManager::getScoringFinishedWSC() {
+ return _scoringFlags.getFlag(kScoringFinishedWSCFlag);
+}
+
+bool GameStateManager::getScoringMarsGandhi() {
+ return _scoringFlags.getFlag(kScoringMarsGandhiFlag);
+}
+
+bool GameStateManager::getScoringNoradGandhi() {
+ return _scoringFlags.getFlag(kScoringNoradGandhiFlag);
+}
+
+bool GameStateManager::getScoringWSCGandhi() {
+ return _scoringFlags.getFlag(kScoringWSCGandhiFlag);
+}
+
+void GameStateManager::setWalkthroughMode(bool value) {
+ _globalFlags.setFlag(kGlobalWalkthroughFlag, value);
+}
+
+bool GameStateManager::getWalkthroughMode() {
+ return _globalFlags.getFlag(kGlobalWalkthroughFlag);
+}
+
+void GameStateManager::setShieldOn(bool value) {
+ _globalFlags.setFlag(kGlobalShieldOnFlag, value);
+}
+
+bool GameStateManager::getShieldOn() {
+ return _globalFlags.getFlag(kGlobalShieldOnFlag);
+}
+
+void GameStateManager::setEasterEgg(bool value) {
+ _globalFlags.setFlag(kGlobalEasterEggFlag, value);
+}
+
+bool GameStateManager::getEasterEgg() {
+ return _globalFlags.getFlag(kGlobalEasterEggFlag);
+}
+
+void GameStateManager::setBeenToWSC(bool value) {
+ _globalFlags.setFlag(kGlobalBeenToWSCFlag, value);
+}
+
+bool GameStateManager::getBeenToWSC() {
+ return _globalFlags.getFlag(kGlobalBeenToWSCFlag);
+}
+
+void GameStateManager::setBeenToMars(bool value) {
+ _globalFlags.setFlag(kGlobalBeenToMarsFlag, value);
+}
+
+bool GameStateManager::getBeenToMars() {
+ return _globalFlags.getFlag(kGlobalBeenToMarsFlag);
+}
+
+void GameStateManager::setBeenToNorad(bool value) {
+ _globalFlags.setFlag(kGlobalBeenToNoradFlag, value);
+}
+
+bool GameStateManager::getBeenToNorad() {
+ return _globalFlags.getFlag(kGlobalBeenToNoradFlag);
+}
+
+void GameStateManager::setWSCFinished(bool value) {
+ _globalFlags.setFlag(kGlobalWSCFinishedFlag, value);
+}
+
+bool GameStateManager::getWSCFinished() {
+ return _globalFlags.getFlag(kGlobalWSCFinishedFlag);
+}
+
+void GameStateManager::setMarsFinished(bool value) {
+ _globalFlags.setFlag(kGlobalMarsFinishedFlag, value);
+}
+
+bool GameStateManager::getMarsFinished() {
+ return _globalFlags.getFlag(kGlobalMarsFinishedFlag);
+}
+
+void GameStateManager::setNoradFinished(bool value) {
+ _globalFlags.setFlag(kGlobalNoradFinishedFlag, value);
+}
+
+bool GameStateManager::getNoradFinished() {
+ return _globalFlags.getFlag(kGlobalNoradFinishedFlag);
+}
+
+bool GameStateManager::allTimeZonesFinished() {
+ return getWSCFinished() && getMarsFinished() && getNoradFinished();
+}
+
+void GameStateManager::setTakenItemID(ItemID id, bool value) {
+ _itemTakenFlags.setFlag(id, value);
+}
+
+bool GameStateManager::isTakenItemID(ItemID id) {
+ return _itemTakenFlags.getFlag(id);
+}
+
+void GameStateManager::setTakenItem(Item *item, bool value) {
+ setTakenItemID(item->getObjectID(), value);
+}
+
+bool GameStateManager::isTakenItem(Item *item) {
+ return isTakenItemID(item->getObjectID());
+}
+
+void GameStateManager::setCaldoriaFuseTimeLimit(const TimeValue timeLimit) {
+ _caldoriaFuseTimeLimit = timeLimit;
+}
+
+TimeValue GameStateManager::getCaldoriaFuseTimeLimit() {
+ return _caldoriaFuseTimeLimit;
+}
+
+void GameStateManager::setCaldoriaSeenPullback(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaSeenPullbackFlag, value);
+}
+
+bool GameStateManager::getCaldoriaSeenPullback() {
+ return _caldoriaFlags.getFlag(kCaldoriaSeenPullbackFlag);
+}
+
+void GameStateManager::setCaldoriaMadeOJ(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaMadeOJFlag, value);
+}
+
+bool GameStateManager::getCaldoriaMadeOJ() {
+ return _caldoriaFlags.getFlag(kCaldoriaMadeOJFlag);
+}
+
+void GameStateManager::setCaldoriaWokenUp(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaWokenUpFlag, value);
+}
+
+bool GameStateManager::getCaldoriaWokenUp() {
+ return _caldoriaFlags.getFlag(kCaldoriaWokenUpFlag);
+}
+
+void GameStateManager::setCaldoriaDidRecalibration(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaDidRecalibrationFlag, value);
+}
+
+bool GameStateManager::getCaldoriaDidRecalibration() {
+ return _caldoriaFlags.getFlag(kCaldoriaDidRecalibrationFlag);
+}
+
+void GameStateManager::setCaldoriaSeenSinclairInElevator(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaSeenSinclairInElevatorFlag, value);
+}
+
+bool GameStateManager::getCaldoriaSeenSinclairInElevator() {
+ return _caldoriaFlags.getFlag(kCaldoriaSeenSinclairInElevatorFlag);
+}
+
+void GameStateManager::setCaldoriaINNAnnouncing(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaINNAnnouncingFlag, value);
+}
+
+bool GameStateManager::getCaldoriaINNAnnouncing() {
+ return _caldoriaFlags.getFlag(kCaldoriaINNAnnouncingFlag);
+}
+
+void GameStateManager::setCaldoriaSeenINN(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaSeenINNFlag, value);
+}
+
+bool GameStateManager::getCaldoriaSeenINN() {
+ return _caldoriaFlags.getFlag(kCaldoriaSeenINNFlag);
+}
+
+void GameStateManager::setCaldoriaSeenMessages(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaSeenMessagesFlag, value);
+}
+
+bool GameStateManager::getCaldoriaSeenMessages() {
+ return _caldoriaFlags.getFlag(kCaldoriaSeenMessagesFlag);
+}
+
+void GameStateManager::setCaldoriaSinclairShot(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaSinclairShotFlag, value);
+}
+
+bool GameStateManager::getCaldoriaSinclairShot() {
+ return _caldoriaFlags.getFlag(kCaldoriaSinclairShotFlag);
+}
+
+void GameStateManager::setCaldoriaBombDisarmed(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaBombDisarmedFlag, value);
+}
+
+bool GameStateManager::getCaldoriaBombDisarmed() {
+ return _caldoriaFlags.getFlag(kCaldoriaBombDisarmedFlag);
+}
+
+void GameStateManager::setCaldoriaRoofDoorOpen(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaRoofDoorOpenFlag, value);
+}
+
+bool GameStateManager::getCaldoriaRoofDoorOpen() {
+ return _caldoriaFlags.getFlag(kCaldoriaRoofDoorOpenFlag);
+}
+
+void GameStateManager::setCaldoriaDoneHygiene(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaDoneHygieneFlag, value);
+}
+
+bool GameStateManager::getCaldoriaDoneHygiene() {
+ return _caldoriaFlags.getFlag(kCaldoriaDoneHygieneFlag);
+}
+
+void GameStateManager::setCaldoriaSawVoiceAnalysis(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaSawVoiceAnalysisFlag, value);
+}
+
+bool GameStateManager::getCaldoriaSawVoiceAnalysis() {
+ return _caldoriaFlags.getFlag(kCaldoriaSawVoiceAnalysisFlag);
+}
+
+void GameStateManager::setCaldoriaDoorBombed(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaDoorBombedFlag, value);
+}
+
+bool GameStateManager::getCaldoriaDoorBombed() {
+ return _caldoriaFlags.getFlag(kCaldoriaDoorBombedFlag);
+}
+
+void GameStateManager::setCaldoriaGunAimed(bool value) {
+ _caldoriaFlags.setFlag(kCaldoriaGunAimedFlag, value);
+}
+
+bool GameStateManager::getCaldoriaGunAimed() {
+ return _caldoriaFlags.getFlag(kCaldoriaGunAimedFlag);
+}
+
+void GameStateManager::setRipTimerTime(TimeValue limit) {
+ _TSARipTimerTime = limit;
+}
+
+TimeValue GameStateManager::getRipTimerTime() {
+ return _TSARipTimerTime;
+}
+
+void GameStateManager::setTSAFuseTimeLimit(TimeValue limit) {
+ _TSAFuseTimeLimit = limit;
+}
+
+TimeValue GameStateManager::getTSAFuseTimeLimit() {
+ return _TSAFuseTimeLimit;
+}
+
+void GameStateManager::setTSAState(byte state) {
+ _TSAState = state;
+}
+
+byte GameStateManager::getTSAState() {
+ return _TSAState;
+}
+
+void GameStateManager::setT0BMonitorMode(byte mode) {
+ _T0BMonitorMode = mode;
+}
+
+byte GameStateManager::getT0BMonitorMode() {
+ return _T0BMonitorMode;
+}
+
+void GameStateManager::setT0BMonitorStart(TimeValue start) {
+ _T0BMonitorStart = start;
+}
+
+TimeValue GameStateManager::getT0BMonitorStart() {
+ return _T0BMonitorStart;
+}
+
+void GameStateManager::setTSAIDedAtDoor(bool value) {
+ _TSAFlags.setFlag(kTSAIDedAtDoorFlag, value);
+}
+
+bool GameStateManager::getTSAIDedAtDoor() {
+ return _TSAFlags.getFlag(kTSAIDedAtDoorFlag);
+}
+
+void GameStateManager::setTSA0BZoomedIn(bool value) {
+ _TSAFlags.setFlag(kTSA0BZoomedInFlag, value);
+}
+
+bool GameStateManager::getTSA0BZoomedIn() {
+ return _TSAFlags.getFlag(kTSA0BZoomedInFlag);
+}
+
+void GameStateManager::setTSAFrontDoorUnlockedOutside(bool value) {
+ _TSAFlags.setFlag(kTSAFrontDoorUnlockedOutsideFlag, value);
+}
+
+bool GameStateManager::getTSAFrontDoorUnlockedOutside() {
+ return _TSAFlags.getFlag(kTSAFrontDoorUnlockedOutsideFlag);
+}
+
+void GameStateManager::setTSAFrontDoorUnlockedInside(bool value) {
+ _TSAFlags.setFlag(kTSAFrontDoorUnlockedInsideFlag, value);
+}
+
+bool GameStateManager::getTSAFrontDoorUnlockedInside() {
+ return _TSAFlags.getFlag(kTSAFrontDoorUnlockedInsideFlag);
+}
+
+void GameStateManager::setTSASeenRobotGreeting(bool value) {
+ _TSAFlags.setFlag(kTSASeenRobotGreetingFlag, value);
+}
+
+bool GameStateManager::getTSASeenRobotGreeting() {
+ return _TSAFlags.getFlag(kTSASeenRobotGreetingFlag);
+}
+
+void GameStateManager::setTSASeenTheory(bool value) {
+ _TSAFlags.setFlag(kTSASeenTheoryFlag, value);
+}
+
+bool GameStateManager::getTSASeenTheory() {
+ return _TSAFlags.getFlag(kTSASeenTheoryFlag);
+}
+
+void GameStateManager::setTSASeenBackground(bool value) {
+ _TSAFlags.setFlag(kTSASeenBackgroundFlag, value);
+}
+
+bool GameStateManager::getTSASeenBackground() {
+ return _TSAFlags.getFlag(kTSASeenBackgroundFlag);
+}
+
+void GameStateManager::setTSASeenProcedure(bool value) {
+ _TSAFlags.setFlag(kTSASeenProcedureFlag, value);
+}
+
+bool GameStateManager::getTSASeenProcedure() {
+ return _TSAFlags.getFlag(kTSASeenProcedureFlag);
+}
+
+void GameStateManager::setTSASeenAgent3AtDoor(bool value) {
+ _TSAFlags.setFlag(kTSASeenAgent3AtDoorFlag, value);
+}
+
+bool GameStateManager::getTSASeenAgent3AtDoor() {
+ return _TSAFlags.getFlag(kTSASeenAgent3AtDoorFlag);
+}
+
+void GameStateManager::setTSACommandCenterLocked(bool value) {
+ _TSAFlags.setFlag(kTSACommandCenterLockedFlag, value);
+}
+
+bool GameStateManager::getTSACommandCenterLocked() {
+ return _TSAFlags.getFlag(kTSACommandCenterLockedFlag);
+}
+
+void GameStateManager::setTSASeenCaldoriaNormal(bool value) {
+ _TSAFlags.setFlag(kTSASeenCaldoriaNormalFlag, value);
+}
+
+bool GameStateManager::getTSASeenCaldoriaNormal() {
+ return _TSAFlags.getFlag(kTSASeenCaldoriaNormalFlag);
+}
+
+void GameStateManager::setTSASeenCaldoriaAltered(bool value) {
+ _TSAFlags.setFlag(kTSASeenCaldoriaAlteredFlag, value);
+}
+
+bool GameStateManager::getTSASeenCaldoriaAltered() {
+ return _TSAFlags.getFlag(kTSASeenCaldoriaAlteredFlag);
+}
+
+void GameStateManager::setTSASeenNoradNormal(bool value) {
+ _TSAFlags.setFlag(kTSASeenNoradNormalFlag, value);
+}
+
+bool GameStateManager::getTSASeenNoradNormal() {
+ return _TSAFlags.getFlag(kTSASeenNoradNormalFlag);
+}
+
+void GameStateManager::setTSASeenNoradAltered(bool value) {
+ _TSAFlags.setFlag(kTSASeenNoradAlteredFlag, value);
+}
+
+bool GameStateManager::getTSASeenNoradAltered() {
+ return _TSAFlags.getFlag(kTSASeenNoradAlteredFlag);
+}
+
+void GameStateManager::setTSASeenMarsNormal(bool value) {
+ _TSAFlags.setFlag(kTSASeenMarsNormalFlag, value);
+}
+
+bool GameStateManager::getTSASeenMarsNormal() {
+ return _TSAFlags.getFlag(kTSASeenMarsNormalFlag);
+}
+
+void GameStateManager::setTSASeenMarsAltered(bool value) {
+ _TSAFlags.setFlag(kTSASeenMarsAlteredFlag, value);
+}
+
+bool GameStateManager::getTSASeenMarsAltered() {
+ return _TSAFlags.getFlag(kTSASeenMarsAlteredFlag);
+}
+
+void GameStateManager::setTSASeenWSCNormal(bool value) {
+ _TSAFlags.setFlag(kTSASeenWSCNormalFlag, value);
+}
+
+bool GameStateManager::getTSASeenWSCNormal() {
+ return _TSAFlags.getFlag(kTSASeenWSCNormalFlag);
+}
+
+void GameStateManager::setTSASeenWSCAltered(bool value) {
+ _TSAFlags.setFlag(kTSASeenWSCAlteredFlag, value);
+}
+
+bool GameStateManager::getTSASeenWSCAltered() {
+ return _TSAFlags.getFlag(kTSASeenWSCAlteredFlag);
+}
+
+void GameStateManager::setTSABiosuitOn(bool value) {
+ _TSAFlags.setFlag(kTSABiosuitOnFlag, value);
+}
+
+bool GameStateManager::getTSABiosuitOn() {
+ return _TSAFlags.getFlag(kTSABiosuitOnFlag);
+}
+
+void GameStateManager::setPrehistoricTriedToExtendBridge(bool value) {
+ _prehistoricFlags.setFlag(kPrehistoricTriedToExtendBridgeFlag, value);
+}
+
+bool GameStateManager::getPrehistoricTriedToExtendBridge() {
+ return _prehistoricFlags.getFlag(kPrehistoricTriedToExtendBridgeFlag);
+}
+
+void GameStateManager::setPrehistoricSeenTimeStream(bool value) {
+ _prehistoricFlags.setFlag(kPrehistoricSeenTimeStreamFlag, value);
+}
+
+bool GameStateManager::getPrehistoricSeenTimeStream() {
+ return _prehistoricFlags.getFlag(kPrehistoricSeenTimeStreamFlag);
+}
+
+void GameStateManager::setPrehistoricSeenFlyer1(bool value) {
+ _prehistoricFlags.setFlag(kPrehistoricSeenFlyer1Flag, value);
+}
+
+bool GameStateManager::getPrehistoricSeenFlyer1() {
+ return _prehistoricFlags.getFlag(kPrehistoricSeenFlyer1Flag);
+}
+
+void GameStateManager::setPrehistoricSeenFlyer2(bool value) {
+ _prehistoricFlags.setFlag(kPrehistoricSeenFlyer2Flag, value);
+}
+
+bool GameStateManager::getPrehistoricSeenFlyer2() {
+ return _prehistoricFlags.getFlag(kPrehistoricSeenFlyer2Flag);
+}
+
+void GameStateManager::setPrehistoricSeenBridgeZoom(bool value) {
+ _prehistoricFlags.setFlag(kPrehistoricSeenBridgeZoomFlag, value);
+}
+
+bool GameStateManager::getPrehistoricSeenBridgeZoom() {
+ return _prehistoricFlags.getFlag(kPrehistoricSeenBridgeZoomFlag);
+}
+
+void GameStateManager::setPrehistoricBreakerThrown(bool value) {
+ _prehistoricFlags.setFlag(kPrehistoricBreakerThrownFlag, value);
+}
+
+bool GameStateManager::getPrehistoricBreakerThrown() {
+ return _prehistoricFlags.getFlag(kPrehistoricBreakerThrownFlag);
+}
+
+void GameStateManager::setNoradSeenTimeStream(bool value) {
+ _noradFlags.setFlag(kNoradSeenTimeStreamFlag, value);
+}
+
+bool GameStateManager::getNoradSeenTimeStream() {
+ return _noradFlags.getFlag(kNoradSeenTimeStreamFlag);
+}
+
+void GameStateManager::setNoradGassed(bool value) {
+ _noradFlags.setFlag(kNoradGassedFlag, value);
+}
+
+bool GameStateManager::getNoradGassed() {
+ return _noradFlags.getFlag(kNoradGassedFlag);
+}
+
+void GameStateManager::setNoradFillingStationOn(bool value) {
+ _noradFlags.setFlag(kNoradFillingStationOnFlag, value);
+}
+
+bool GameStateManager::getNoradFillingStationOn() {
+ return _noradFlags.getFlag(kNoradFillingStationOnFlag);
+}
+
+void GameStateManager::setNoradN22MessagePlayed(bool value) {
+ _noradFlags.setFlag(kNoradN22MessagePlayedFlag, value);
+}
+
+bool GameStateManager::getNoradN22MessagePlayed() {
+ return _noradFlags.getFlag(kNoradN22MessagePlayedFlag);
+}
+
+void GameStateManager::setNoradPlayedGlobeGame(bool value) {
+ _noradFlags.setFlag(kNoradPlayedGlobeGameFlag, value);
+}
+
+bool GameStateManager::getNoradPlayedGlobeGame() {
+ return _noradFlags.getFlag(kNoradPlayedGlobeGameFlag);
+}
+
+void GameStateManager::setNoradBeatRobotWithClaw(bool value) {
+ _noradFlags.setFlag(kNoradBeatRobotWithClawFlag, value);
+}
+
+bool GameStateManager::getNoradBeatRobotWithClaw() {
+ return _noradFlags.getFlag(kNoradBeatRobotWithClawFlag);
+}
+
+void GameStateManager::setNoradBeatRobotWithDoor(bool value) {
+ _noradFlags.setFlag(kNoradBeatRobotWithDoorFlag, value);
+}
+
+bool GameStateManager::getNoradBeatRobotWithDoor() {
+ return _noradFlags.getFlag(kNoradBeatRobotWithDoorFlag);
+}
+
+void GameStateManager::setNoradRetScanGood(bool value) {
+ _noradFlags.setFlag(kNoradRetScanGoodFlag, value);
+}
+
+bool GameStateManager::getNoradRetScanGood() {
+ return _noradFlags.getFlag(kNoradRetScanGoodFlag);
+}
+
+void GameStateManager::setNoradWaitingForLaser(bool value) {
+ _noradFlags.setFlag(kNoradWaitingForLaserFlag, value);
+}
+
+bool GameStateManager::getNoradWaitingForLaser() {
+ return _noradFlags.getFlag(kNoradWaitingForLaserFlag);
+}
+
+void GameStateManager::setNoradSubRoomPressure(uint16 pressure) {
+ _noradSubRoomPressure = pressure;
+}
+
+uint16 GameStateManager::getNoradSubRoomPressure() {
+ return _noradSubRoomPressure;
+}
+
+void GameStateManager::setNoradSubPrepState(NoradSubPrepState state) {
+ _noradSubPrepState = state;
+}
+
+NoradSubPrepState GameStateManager::getNoradSubPrepState() {
+ return _noradSubPrepState;
+}
+
+void GameStateManager::setNoradArrivedFromSub(bool value) {
+ _noradFlags.setFlag(kNoradArrivedFromSubFlag, value);
+}
+
+bool GameStateManager::getNoradArrivedFromSub() {
+ return _noradFlags.getFlag(kNoradArrivedFromSubFlag);
+}
+
+void GameStateManager::setMarsSeenTimeStream(bool value) {
+ _marsFlags.setFlag(kMarsSeenTimeStreamFlag, value);
+}
+
+bool GameStateManager::getMarsSeenTimeStream() {
+ return _marsFlags.getFlag(kMarsSeenTimeStreamFlag);
+}
+
+void GameStateManager::setMarsHeardUpperPodMessage(bool value) {
+ _marsFlags.setFlag(kMarsHeardUpperPodMessageFlag, value);
+}
+
+bool GameStateManager::getMarsHeardUpperPodMessage() {
+ return _marsFlags.getFlag(kMarsHeardUpperPodMessageFlag);
+}
+
+void GameStateManager::setMarsRobotThrownPlayer(bool value) {
+ _marsFlags.setFlag(kMarsRobotThrownPlayerFlag, value);
+}
+
+bool GameStateManager::getMarsRobotThrownPlayer() {
+ return _marsFlags.getFlag(kMarsRobotThrownPlayerFlag);
+}
+
+void GameStateManager::setMarsHeardCheckInMessage(bool value) {
+ _marsFlags.setFlag(kMarsHeardCheckInMessageFlag, value);
+}
+
+bool GameStateManager::getMarsHeardCheckInMessage() {
+ return _marsFlags.getFlag(kMarsHeardCheckInMessageFlag);
+}
+
+void GameStateManager::setMarsPodAtUpperPlatform(bool value) {
+ _marsFlags.setFlag(kMarsPodAtUpperPlatformFlag, value);
+}
+
+bool GameStateManager::getMarsPodAtUpperPlatform() {
+ return _marsFlags.getFlag(kMarsPodAtUpperPlatformFlag);
+}
+
+void GameStateManager::setMarsSeenThermalScan(bool value) {
+ _marsFlags.setFlag(kMarsSeenThermalScanFlag, value);
+}
+
+bool GameStateManager::getMarsSeenThermalScan() {
+ return _marsFlags.getFlag(kMarsSeenThermalScanFlag);
+}
+
+void GameStateManager::setMarsArrivedBelow(bool value) {
+ _marsFlags.setFlag(kMarsArrivedBelowFlag, value);
+}
+
+bool GameStateManager::getMarsArrivedBelow() {
+ return _marsFlags.getFlag(kMarsArrivedBelowFlag);
+}
+
+void GameStateManager::setMarsSeenRobotAtReactor(bool value) {
+ _marsFlags.setFlag(kMarsSeenRobotAtReactorFlag, value);
+}
+
+bool GameStateManager::getMarsSeenRobotAtReactor() {
+ return _marsFlags.getFlag(kMarsSeenRobotAtReactorFlag);
+}
+
+void GameStateManager::setMarsAvoidedReactorRobot(bool value) {
+ _marsFlags.setFlag(kMarsAvoidedReactorRobotFlag, value);
+}
+
+bool GameStateManager::getMarsAvoidedReactorRobot() {
+ return _marsFlags.getFlag(kMarsAvoidedReactorRobotFlag);
+}
+
+void GameStateManager::setMarsSecurityDown(bool value) {
+ _marsFlags.setFlag(kMarsSecurityDownFlag, value);
+}
+
+bool GameStateManager::getMarsSecurityDown() {
+ return _marsFlags.getFlag(kMarsSecurityDownFlag);
+}
+
+void GameStateManager::setMarsInAirlock(bool value) {
+ _marsFlags.setFlag(kMarsInAirlockFlag, value);
+}
+
+bool GameStateManager::getMarsInAirlock() {
+ return _marsFlags.getFlag(kMarsInAirlockFlag);
+}
+
+void GameStateManager::setMarsAirlockOpen(bool value) {
+ _marsFlags.setFlag(kMarsAirlockOpenFlag, value);
+}
+
+bool GameStateManager::getMarsAirlockOpen() {
+ return _marsFlags.getFlag(kMarsAirlockOpenFlag);
+}
+
+void GameStateManager::setMarsMaskOnFiller(bool value) {
+ _marsFlags.setFlag(kMarsMaskOnFillerFlag, value);
+}
+
+bool GameStateManager::getMarsMaskOnFiller() {
+ return _marsFlags.getFlag(kMarsMaskOnFillerFlag);
+}
+
+void GameStateManager::setMarsLockFrozen(bool value) {
+ _marsFlags.setFlag(kMarsLockFrozenFlag, value);
+}
+
+bool GameStateManager::getMarsLockFrozen() {
+ return _marsFlags.getFlag(kMarsLockFrozenFlag);
+}
+
+void GameStateManager::setMarsLockBroken(bool value) {
+ _marsFlags.setFlag(kMarsLockBrokenFlag, value);
+}
+
+bool GameStateManager::getMarsLockBroken() {
+ return _marsFlags.getFlag(kMarsLockBrokenFlag);
+}
+
+void GameStateManager::setMarsMazeDoorPair1(bool value) {
+ _marsFlags.setFlag(kMarsMazeDoorPair1Flag, value);
+}
+
+bool GameStateManager::getMarsMazeDoorPair1() {
+ return _marsFlags.getFlag(kMarsMazeDoorPair1Flag);
+}
+
+void GameStateManager::setMarsMazeDoorPair2(bool value) {
+ _marsFlags.setFlag(kMarsMazeDoorPair2Flag, value);
+}
+
+bool GameStateManager::getMarsMazeDoorPair2() {
+ return _marsFlags.getFlag(kMarsMazeDoorPair2Flag);
+}
+
+void GameStateManager::setMarsMazeDoorPair3(bool value) {
+ _marsFlags.setFlag(kMarsMazeDoorPair3Flag, value);
+}
+
+bool GameStateManager::getMarsMazeDoorPair3() {
+ return _marsFlags.getFlag(kMarsMazeDoorPair3Flag);
+}
+
+void GameStateManager::setMarsSawRobotLeave(bool value) {
+ _marsFlags.setFlag(kMarsSawRobotLeaveFlag, value);
+}
+
+bool GameStateManager::getMarsSawRobotLeave() {
+ return _marsFlags.getFlag(kMarsSawRobotLeaveFlag);
+}
+
+void GameStateManager::setMarsHitRobotWithCannon(bool flag) {
+ _marsFlags.setFlag(kMarsHitRobotWithCannonFlag, flag);
+}
+
+bool GameStateManager::getMarsHitRobotWithCannon() {
+ return _marsFlags.getFlag(kMarsHitRobotWithCannonFlag);
+}
+
+void GameStateManager::setMarsReadyForShuttleTransport(bool value) {
+ _marsFlags.setFlag(kMarsReadyForShuttleTransportFlag, value);
+}
+
+bool GameStateManager::getMarsReadyForShuttleTransport() {
+ return _marsFlags.getFlag(kMarsReadyForShuttleTransportFlag);
+}
+
+void GameStateManager::setMarsFinishedCanyonChase(bool flag) {
+ _marsFlags.setFlag(kMarsFinishedCanyonChaseFlag, flag);
+}
+
+bool GameStateManager::getMarsFinishedCanyonChase() {
+ return _marsFlags.getFlag(kMarsFinishedCanyonChaseFlag);
+}
+
+void GameStateManager::setMarsThreadedMaze(bool flag) {
+ _marsFlags.setFlag(kMarsThreadedMazeFlag, flag);
+}
+
+bool GameStateManager::getMarsThreadedMaze() {
+ return _marsFlags.getFlag(kMarsThreadedMazeFlag);
+}
+
+void GameStateManager::setWSCSeenTimeStream(bool value) {
+ _WSCFlags.setFlag(kWSCSeenTimeStreamFlag, value);
+}
+
+bool GameStateManager::getWSCSeenTimeStream() {
+ return _WSCFlags.getFlag(kWSCSeenTimeStreamFlag);
+}
+
+void GameStateManager::setWSCPoisoned(bool value) {
+ _WSCFlags.setFlag(kWSCPoisonedFlag, value);
+}
+
+bool GameStateManager::getWSCPoisoned() {
+ return _WSCFlags.getFlag(kWSCPoisonedFlag);
+}
+
+void GameStateManager::setWSCAnsweredAboutDart(bool value) {
+ _WSCFlags.setFlag(kWSCAnsweredAboutDartFlag, value);
+}
+
+bool GameStateManager::getWSCAnsweredAboutDart() {
+ return _WSCFlags.getFlag(kWSCAnsweredAboutDartFlag);
+}
+
+void GameStateManager::setWSCRemovedDart(bool value) {
+ _WSCFlags.setFlag(kWSCRemovedDartFlag, value);
+}
+
+bool GameStateManager::getWSCRemovedDart() {
+ return _WSCFlags.getFlag(kWSCRemovedDartFlag);
+}
+
+void GameStateManager::setWSCAnalyzerOn(bool value) {
+ _WSCFlags.setFlag(kWSCAnalyzerOnFlag, value);
+}
+
+bool GameStateManager::getWSCAnalyzerOn() {
+ return _WSCFlags.getFlag(kWSCAnalyzerOnFlag);
+}
+
+void GameStateManager::setWSCDartInAnalyzer(bool value) {
+ _WSCFlags.setFlag(kWSCDartInAnalyzerFlag, value);
+}
+
+bool GameStateManager::getWSCDartInAnalyzer() {
+ return _WSCFlags.getFlag(kWSCDartInAnalyzerFlag);
+}
+
+void GameStateManager::setWSCAnalyzedDart(bool value) {
+ _WSCFlags.setFlag(kWSCAnalyzedDartFlag, value);
+}
+
+bool GameStateManager::getWSCAnalyzedDart() {
+ return _WSCFlags.getFlag(kWSCAnalyzedDartFlag);
+}
+
+void GameStateManager::setWSCSawMorph(bool value) {
+ _WSCFlags.setFlag(kWSCSawMorphFlag, value);
+}
+
+bool GameStateManager::getWSCSawMorph() {
+ return _WSCFlags.getFlag(kWSCSawMorphFlag);
+}
+
+void GameStateManager::setWSCDesignedAntidote(bool value) {
+ _WSCFlags.setFlag(kWSCDesignedAntidoteFlag, value);
+}
+
+bool GameStateManager::getWSCDesignedAntidote() {
+ return _WSCFlags.getFlag(kWSCDesignedAntidoteFlag);
+}
+
+void GameStateManager::setWSCPickedUpAntidote(bool value) {
+ _WSCFlags.setFlag(kWSCPickedUpAntidoteFlag, value);
+}
+
+bool GameStateManager::getWSCPickedUpAntidote() {
+ return _WSCFlags.getFlag(kWSCPickedUpAntidoteFlag);
+}
+
+void GameStateManager::setWSCOfficeMessagesOpen(bool value) {
+ _WSCFlags.setFlag(kWSCOfficeMessagesOpenFlag, value);
+}
+
+bool GameStateManager::getWSCOfficeMessagesOpen() {
+ return _WSCFlags.getFlag(kWSCOfficeMessagesOpenFlag);
+}
+
+void GameStateManager::setWSCSeenNerd(bool value) {
+ _WSCFlags.setFlag(kWSCSeenNerdFlag, value);
+}
+
+bool GameStateManager::getWSCSeenNerd() {
+ return _WSCFlags.getFlag(kWSCSeenNerdFlag);
+}
+
+void GameStateManager::setWSCHeardPage1(bool value) {
+ _WSCFlags.setFlag(kWSCHeardPage1Flag, value);
+}
+
+bool GameStateManager::getWSCHeardPage1() {
+ return _WSCFlags.getFlag(kWSCHeardPage1Flag);
+}
+
+void GameStateManager::setWSCHeardPage2(bool value) {
+ _WSCFlags.setFlag(kWSCHeardPage2Flag, value);
+}
+
+bool GameStateManager::getWSCHeardPage2() {
+ return _WSCFlags.getFlag(kWSCHeardPage2Flag);
+}
+
+void GameStateManager::setWSCHeardCheckIn(bool value) {
+ _WSCFlags.setFlag(kWSCHeardCheckInFlag, value);
+}
+
+bool GameStateManager::getWSCHeardCheckIn() {
+ return _WSCFlags.getFlag(kWSCHeardCheckInFlag);
+}
+
+void GameStateManager::setWSCDidPlasmaDodge(bool value) {
+ _WSCFlags.setFlag(kWSCDidPlasmaDodgeFlag, value);
+}
+
+bool GameStateManager::getWSCDidPlasmaDodge() {
+ return _WSCFlags.getFlag(kWSCDidPlasmaDodgeFlag);
+}
+
+void GameStateManager::setWSCSeenSinclairLecture(bool value) {
+ _WSCFlags.setFlag(kWSCSeenSinclairLectureFlag, value);
+}
+
+bool GameStateManager::getWSCSeenSinclairLecture() {
+ return _WSCFlags.getFlag(kWSCSeenSinclairLectureFlag);
+}
+
+void GameStateManager::setWSCBeenAtWSC93(bool value) {
+ _WSCFlags.setFlag(kWSCBeenAtWSC93Flag, value);
+}
+
+bool GameStateManager::getWSCBeenAtWSC93() {
+ return _WSCFlags.getFlag(kWSCBeenAtWSC93Flag);
+}
+
+void GameStateManager::setWSCCatwalkDark(bool value) {
+ _WSCFlags.setFlag(kWSCCatwalkDarkFlag, value);
+}
+
+bool GameStateManager::getWSCCatwalkDark() {
+ return _WSCFlags.getFlag(kWSCCatwalkDarkFlag);
+}
+
+void GameStateManager::setWSCRobotDead(bool value) {
+ _WSCFlags.setFlag(kWSCRobotDeadFlag, value);
+}
+
+bool GameStateManager::getWSCRobotDead() {
+ return _WSCFlags.getFlag(kWSCRobotDeadFlag);
+}
+
+void GameStateManager::setWSCRobotGone(bool value) {
+ _WSCFlags.setFlag(kWSCRobotGoneFlag, value);
+}
+
+bool GameStateManager::getWSCRobotGone() {
+ return _WSCFlags.getFlag(kWSCRobotGoneFlag);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/gamestate.h b/engines/pegasus/gamestate.h
new file mode 100644
index 0000000000..dd47bd6e51
--- /dev/null
+++ b/engines/pegasus/gamestate.h
@@ -0,0 +1,886 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_GAMESTATE_H
+#define PEGASUS_GAMESTATE_H
+
+#include "common/singleton.h"
+#include "common/util.h"
+
+#include "pegasus/types.h"
+#include "pegasus/util.h"
+#include "pegasus/items/item.h"
+
+namespace Common {
+ class Error;
+ class ReadStream;
+ class WriteStream;
+}
+
+namespace Pegasus {
+
+// The only things saved in here are things which get written out to a saved game file...
+
+enum {
+ kGlobalWalkthroughFlag,
+ kGlobalShieldOnFlag,
+ kGlobalEasterEggFlag,
+ kGlobalBeenToWSCFlag,
+ kGlobalBeenToMarsFlag,
+ kGlobalBeenToNoradFlag,
+ kGlobalWSCFinishedFlag,
+ kGlobalMarsFinishedFlag,
+ kGlobalNoradFinishedFlag,
+ kNumGlobalFlags
+};
+
+enum {
+ kScoringSawINNFlag,
+ kScoringTookShowerFlag,
+ kScoringFixedHairFlag,
+ kScoringGotKeyCardFlag,
+ kScoringReadPaperFlag,
+ kScoringLookThroughTelescopeFlag,
+ kScoringSawCaldoriaKioskFlag,
+ kScoringGoToTSAFlag,
+ kScoringEnterTSAFlag,
+ kScoringSawBust1Flag,
+ kScoringSawBust2Flag,
+ kScoringSawBust3Flag,
+ kScoringSawBust4Flag,
+ kScoringSawBust5Flag,
+ kScoringSawBust6Flag,
+ kScoringSawTheoryFlag,
+ kScoringSawBackgroundFlag,
+ kScoringSawProcedureFlag,
+ kScoringGotJourneymanKeyFlag,
+ kScoringGotPegasusBiochipFlag,
+ kScoringGotBiosuitFlag,
+ kScoringGoToPrehistoricFlag,
+ kScoringPutLogInReaderFlag,
+ kScoringSawCaldoriaNormalFlag,
+ kScoringSawCaldoriaAlteredFlag,
+ kScoringSawNoradNormalFlag,
+ kScoringSawNoradAlteredFlag,
+ kScoringSawMarsNormalFlag,
+ kScoringSawMarsAlteredFlag,
+ kScoringSawWSCNormalFlag,
+ kScoringSawWSCAlteredFlag,
+ kScoringWentToReadyRoom2Flag,
+ kScoringWentAfterSinclairFlag,
+ kScoringUsedCardBombFlag,
+ kScoringShieldedCardBombFlag,
+ kScoringStunnedSinclairFlag,
+ kScoringDisarmedNukeFlag,
+
+ kScoringThrewBreakerFlag,
+ kScoringExtendedBridgeFlag,
+ kScoringGotHistoricalLogFlag,
+ kScoringFinishedPrehistoricFlag,
+
+ kScoringThrownByRobotFlag,
+ kScoringGotMarsCardFlag,
+ kScoringSawMarsKioskFlag,
+ kScoringSawTransportMapFlag,
+ kScoringGotCrowBarFlag,
+ kScoringTurnedOnTransportFlag,
+ kScoringGotOxygenMaskFlag,
+ kScoringAvoidedRobotFlag,
+ kScoringActivatedPlatformFlag,
+ kScoringUsedLiquidNitrogenFlag,
+ kScoringUsedCrowBarFlag,
+ kScoringFoundCardBombFlag,
+ kScoringDisarmedCardBombFlag,
+ kScoringGotCardBombFlag,
+ kScoringThreadedMazeFlag,
+ kScoringThreadedGearRoomFlag,
+ kScoringEnteredShuttleFlag,
+ kScoringEnteredLaunchTubeFlag,
+ kScoringStoppedRobotsShuttleFlag,
+ kScoringGotMarsOpMemChipFlag,
+ kScoringFinishedMarsFlag,
+
+ kScoringSawSecurityMonitorFlag,
+ kScoringFilledOxygenCanisterFlag,
+ kScoringFilledArgonCanisterFlag,
+ kScoringSawUnconsciousOperatorFlag,
+ kScoringWentThroughPressureDoorFlag,
+ kScoringPreppedSubFlag,
+ kScoringEnteredSubFlag,
+ kScoringExitedSubFlag,
+ kScoringSawRobotAt54NorthFlag,
+ kScoringPlayedWithClawFlag,
+ kScoringUsedRetinalChipFlag,
+ kScoringFinishedGlobeGameFlag,
+ kScoringStoppedNoradRobotFlag,
+ kScoringGotNoradOpMemChipFlag,
+ kScoringFinishedNoradFlag,
+
+ kScoringRemovedDartFlag,
+ kScoringAnalyzedDartFlag,
+ kScoringBuiltAntidoteFlag,
+ kScoringGotSinclairKeyFlag,
+ kScoringGotArgonCanisterFlag,
+ kScoringGotNitrogenCanisterFlag,
+ kScoringPlayedWithMessagesFlag,
+ kScoringSawMorphExperimentFlag,
+ kScoringEnteredSinclairOfficeFlag,
+ kScoringSawBrochureFlag,
+ kScoringSawSinclairEntry1Flag,
+ kScoringSawSinclairEntry2Flag,
+ kScoringSawSinclairEntry3Flag,
+ kScoringSawWSCDirectoryFlag,
+ kScoringUsedCrowBarInWSCFlag,
+ kScoringFinishedPlasmaDodgeFlag,
+ kScoringOpenedCatwalkFlag,
+ kScoringStoppedWSCRobotFlag,
+ kScoringGotWSCOpMemChipFlag,
+ kScoringFinishedWSCFlag,
+
+ kScoringMarsGandhiFlag,
+ kScoringNoradGandhiFlag,
+ kScoringWSCGandhiFlag,
+
+ kNumScoringFlags
+};
+
+enum {
+ kCaldoriaSeenPullbackFlag,
+ kCaldoriaMadeOJFlag,
+ kCaldoriaWokenUpFlag,
+ kCaldoriaDidRecalibrationFlag,
+ kCaldoriaSeenSinclairInElevatorFlag,
+ kCaldoriaINNAnnouncingFlag,
+ kCaldoriaSeenINNFlag,
+ kCaldoriaSeenMessagesFlag,
+ kCaldoriaSinclairShotFlag,
+ kCaldoriaBombDisarmedFlag,
+ kCaldoriaRoofDoorOpenFlag,
+ kCaldoriaDoneHygieneFlag,
+ kCaldoriaSawVoiceAnalysisFlag,
+ kCaldoriaDoorBombedFlag,
+ kCaldoriaGunAimedFlag,
+ kNumCaldoriaFlags
+};
+
+enum {
+ kCaldoriaNoFuseRunning,
+ kCaldoriaDoorBombFuseRunning,
+ kCaldoriaSinclairFuseRunning
+};
+
+enum {
+ kTSAIDedAtDoorFlag,
+ kTSA0BZoomedInFlag,
+ kTSAFrontDoorUnlockedOutsideFlag,
+ kTSAFrontDoorUnlockedInsideFlag,
+ kTSASeenRobotGreetingFlag,
+ kTSASeenTheoryFlag,
+ kTSASeenBackgroundFlag,
+ kTSASeenProcedureFlag,
+ kTSASeenAgent3AtDoorFlag,
+ kTSACommandCenterLockedFlag,
+ kTSASeenCaldoriaNormalFlag,
+ kTSASeenCaldoriaAlteredFlag,
+ kTSASeenNoradNormalFlag,
+ kTSASeenNoradAlteredFlag,
+ kTSASeenMarsNormalFlag,
+ kTSASeenMarsAlteredFlag,
+ kTSASeenWSCNormalFlag,
+ kTSASeenWSCAlteredFlag,
+ kTSABiosuitOnFlag,
+ kNumTSAFlags
+};
+
+enum {
+ kPrehistoricTriedToExtendBridgeFlag,
+ kPrehistoricSeenTimeStreamFlag,
+ kPrehistoricSeenFlyer1Flag,
+ kPrehistoricSeenFlyer2Flag,
+ kPrehistoricSeenBridgeZoomFlag,
+ kPrehistoricBreakerThrownFlag,
+ kNumPrehistoricFlags
+};
+
+enum {
+ kNoradSeenTimeStreamFlag,
+ kNoradGassedFlag,
+ kNoradFillingStationOnFlag,
+ kNoradN22MessagePlayedFlag,
+ kNoradArrivedFromSubFlag,
+ kNoradWaitingForLaserFlag,
+ kNoradRetScanGoodFlag,
+ kNoradPlayedGlobeGameFlag,
+ kNoradBeatRobotWithClawFlag,
+ kNoradBeatRobotWithDoorFlag,
+ kNumNoradFlags
+};
+
+enum {
+ kMarsSeenTimeStreamFlag,
+ kMarsHeardUpperPodMessageFlag,
+ kMarsRobotThrownPlayerFlag,
+ kMarsHeardCheckInMessageFlag,
+ kMarsPodAtUpperPlatformFlag,
+ kMarsSeenThermalScanFlag,
+ kMarsArrivedBelowFlag,
+ kMarsSeenRobotAtReactorFlag,
+ kMarsAvoidedReactorRobotFlag,
+ kMarsInAirlockFlag,
+ kMarsAirlockOpenFlag,
+ kMarsMaskOnFillerFlag,
+ kMarsLockFrozenFlag,
+ kMarsLockBrokenFlag,
+ kMarsMazeDoorPair1Flag,
+ kMarsMazeDoorPair2Flag,
+ kMarsMazeDoorPair3Flag,
+ kMarsSawRobotLeaveFlag,
+ kMarsSecurityDownFlag,
+ kMarsHitRobotWithCannonFlag,
+ kMarsReadyForShuttleTransportFlag,
+ kMarsFinishedCanyonChaseFlag,
+ kMarsThreadedMazeFlag,
+ kNumMarsFlags
+};
+
+enum {
+ kWSCSeenTimeStreamFlag,
+ kWSCPoisonedFlag,
+ kWSCAnsweredAboutDartFlag,
+ kWSCRemovedDartFlag,
+ kWSCAnalyzerOnFlag,
+ kWSCDartInAnalyzerFlag,
+ kWSCAnalyzedDartFlag,
+ kWSCSawMorphFlag,
+ kWSCDesignedAntidoteFlag,
+ kWSCPickedUpAntidoteFlag,
+ kWSCOfficeMessagesOpenFlag,
+ kWSCSeenNerdFlag,
+ kWSCHeardPage1Flag,
+ kWSCHeardPage2Flag,
+ kWSCHeardCheckInFlag,
+ kWSCDidPlasmaDodgeFlag,
+ kWSCSeenSinclairLectureFlag,
+ kWSCBeenAtWSC93Flag,
+ kWSCCatwalkDarkFlag,
+ kWSCRobotDeadFlag,
+ kWSCRobotGoneFlag,
+ kNumWSCFlags
+};
+
+class GameStateManager : public Common::Singleton<GameStateManager> {
+public:
+ GameStateManager() { resetGameState(); }
+
+ // Base game state
+ Common::Error writeGameState(Common::WriteStream *stream);
+ Common::Error readGameState(Common::ReadStream *stream);
+
+ void resetGameState();
+
+ void getCurrentLocation(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction);
+ void setCurrentLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction);
+
+ NeighborhoodID getCurrentNeighborhood();
+ void setCurrentNeighborhood(const NeighborhoodID neighborhood);
+ RoomID getCurrentRoom();
+ void setCurrentRoom(const RoomID room);
+ DirectionConstant getCurrentDirection();
+ void setCurrentDirection(const DirectionConstant direction);
+
+ RoomViewID getCurrentRoomAndView();
+
+ void getNextLocation(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction);
+ void setNextLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction);
+
+ NeighborhoodID getNextNeighborhood();
+ void setNextNeighborhood(const NeighborhoodID neighborhood);
+ RoomID getNextRoom();
+ void setNextRoom(const RoomID room);
+ DirectionConstant getNextDirection();
+ void setNextDirection(const DirectionConstant direction);
+
+ void getLastLocation(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction);
+ void setLastLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction);
+
+ NeighborhoodID getLastNeighborhood();
+ void setLastNeighborhood(const NeighborhoodID neighborhood);
+ RoomID getLastRoom();
+ void setLastRoom(const RoomID room);
+ DirectionConstant getLastDirection();
+ void setLastDirection(const DirectionConstant direction);
+
+ RoomViewID getLastRoomAndView();
+
+ void getOpenDoorLocation(RoomID &room, DirectionConstant &direction);
+ void setOpenDoorLocation(const RoomID room, const DirectionConstant direction);
+ RoomID getOpenDoorRoom();
+ void setOpenDoorRoom(const RoomID room);
+ DirectionConstant getOpenDoorDirection();
+ void setOpenDoorDirection(const DirectionConstant direction);
+
+ RoomViewID getDoorOpenRoomAndView();
+
+ bool isCurrentDoorOpen();
+
+ // Pegasus Prime
+
+ // Scoring...
+ // Scoring "Set" functions.
+ // Caldoria/TSA scoring
+ void setScoringSawINN(const bool = true);
+ void setScoringTookShower(const bool = true);
+ void setScoringFixedHair(const bool = true);
+ void setScoringGotKeyCard(const bool = true);
+ void setScoringReadPaper(const bool = true);
+ void setScoringLookThroughTelescope(const bool = true);
+ void setScoringSawCaldoriaKiosk(const bool = true);
+ void setScoringGoToTSA(const bool = true);
+ void setScoringEnterTSA(const bool = true);
+ void setScoringSawBust1(const bool = true);
+ void setScoringSawBust2(const bool = true);
+ void setScoringSawBust3(const bool = true);
+ void setScoringSawBust4(const bool = true);
+ void setScoringSawBust5(const bool = true);
+ void setScoringSawBust6(const bool = true);
+ void setScoringSawTheory(const bool = true);
+ void setScoringSawBackground(const bool = true);
+ void setScoringSawProcedure(const bool = true);
+ void setScoringGotJourneymanKey(const bool = true);
+ void setScoringGotPegasusBiochip(const bool = true);
+ void setScoringGotBiosuit(const bool = true);
+ void setScoringGoToPrehistoric(const bool = true);
+ void setScoringPutLogInReader(const bool = true);
+ void setScoringSawCaldoriaNormal(const bool = true);
+ void setScoringSawCaldoriaAltered(const bool = true);
+ void setScoringSawNoradNormal(const bool = true);
+ void setScoringSawNoradAltered(const bool = true);
+ void setScoringSawMarsNormal(const bool = true);
+ void setScoringSawMarsAltered(const bool = true);
+ void setScoringSawWSCNormal(const bool = true);
+ void setScoringSawWSCAltered(const bool = true);
+ void setScoringWentToReadyRoom2(const bool = true);
+ void setScoringWentAfterSinclair(const bool = true);
+ void setScoringUsedCardBomb(const bool = true);
+ void setScoringShieldedCardBomb(const bool = true);
+ void setScoringStunnedSinclair(const bool = true);
+ void setScoringDisarmedNuke(const bool = true);
+
+ // Prehistoric scoring
+ void setScoringThrewBreaker(const bool = true);
+ void setScoringExtendedBridge(const bool = true);
+ void setScoringGotHistoricalLog(const bool = true);
+ void setScoringFinishedPrehistoric(const bool = true);
+
+ // Mars scoring
+ void setScoringThrownByRobot(const bool = true);
+ void setScoringGotMarsCard(const bool = true);
+ void setScoringSawMarsKiosk(const bool = true);
+ void setScoringSawTransportMap(const bool = true);
+ void setScoringGotCrowBar(const bool = true);
+ void setScoringTurnedOnTransport(const bool = true);
+ void setScoringGotOxygenMask(const bool = true);
+ void setScoringAvoidedRobot(const bool = true);
+ void setScoringActivatedPlatform(const bool = true);
+ void setScoringUsedLiquidNitrogen(const bool = true);
+ void setScoringUsedCrowBar(const bool = true);
+ void setScoringFoundCardBomb(const bool = true);
+ void setScoringDisarmedCardBomb(const bool = true);
+ void setScoringGotCardBomb(const bool = true);
+ void setScoringThreadedMaze(const bool = true);
+ void setScoringThreadedGearRoom(const bool = true);
+ void setScoringEnteredShuttle(const bool = true);
+ void setScoringEnteredLaunchTube(const bool = true);
+ void setScoringStoppedRobotsShuttle(const bool = true);
+ void setScoringGotMarsOpMemChip(const bool = true);
+ void setScoringFinishedMars(const bool = true);
+
+ // Norad scoring
+ void setScoringSawSecurityMonitor(const bool = true);
+ void setScoringFilledOxygenCanister(const bool = true);
+ void setScoringFilledArgonCanister(const bool = true);
+ void setScoringSawUnconsciousOperator(const bool = true);
+ void setScoringWentThroughPressureDoor(const bool = true);
+ void setScoringPreppedSub(const bool = true);
+ void setScoringEnteredSub(const bool = true);
+ void setScoringExitedSub(const bool = true);
+ void setScoringSawRobotAt54North(const bool = true);
+ void setScoringPlayedWithClaw(const bool = true);
+ void setScoringUsedRetinalChip(const bool = true);
+ void setScoringFinishedGlobeGame(const bool = true);
+ void setScoringStoppedNoradRobot(const bool = true);
+ void setScoringGotNoradOpMemChip(const bool = true);
+ void setScoringFinishedNorad(const bool = true);
+
+ // WSC scoring
+ void setScoringRemovedDart(const bool = true);
+ void setScoringAnalyzedDart(const bool = true);
+ void setScoringBuiltAntidote(const bool = true);
+ void setScoringGotSinclairKey(const bool = true);
+ void setScoringGotArgonCanister(const bool = true);
+ void setScoringGotNitrogenCanister(const bool = true);
+ void setScoringPlayedWithMessages(const bool = true);
+ void setScoringSawMorphExperiment(const bool = true);
+ void setScoringEnteredSinclairOffice(const bool = true);
+ void setScoringSawBrochure(const bool = true);
+ void setScoringSawSinclairEntry1(const bool = true);
+ void setScoringSawSinclairEntry2(const bool = true);
+ void setScoringSawSinclairEntry3(const bool = true);
+ void setScoringSawWSCDirectory(const bool = true);
+ void setScoringUsedCrowBarInWSC(const bool = true);
+ void setScoringFinishedPlasmaDodge(const bool = true);
+ void setScoringOpenedCatwalk(const bool = true);
+ void setScoringStoppedWSCRobot(const bool = true);
+ void setScoringGotWSCOpMemChip(const bool = true);
+ void setScoringFinishedWSC(const bool = true);
+
+ // Gandhi scoring
+ void setScoringMarsGandhi(const bool = true);
+ void setScoringNoradGandhi(const bool = true);
+ void setScoringWSCGandhi(const bool = true);
+
+ // Scoring "Get" functions.
+ bool getScoringSawINN();
+ bool getScoringTookShower();
+ bool getScoringFixedHair();
+ bool getScoringGotKeyCard();
+ bool getScoringReadPaper();
+ bool getScoringLookThroughTelescope();
+ bool getScoringSawCaldoriaKiosk();
+ bool getScoringGoToTSA();
+ bool getScoringEnterTSA();
+ bool getScoringSawBust1();
+ bool getScoringSawBust2();
+ bool getScoringSawBust3();
+ bool getScoringSawBust4();
+ bool getScoringSawBust5();
+ bool getScoringSawBust6();
+ bool getScoringSawTheory();
+ bool getScoringSawBackground();
+ bool getScoringSawProcedure();
+ bool getScoringGotJourneymanKey();
+ bool getScoringGotPegasusBiochip();
+ bool getScoringGotBiosuit();
+ bool getScoringGoToPrehistoric();
+ bool getScoringPutLogInReader();
+ bool getScoringSawCaldoriaNormal();
+ bool getScoringSawCaldoriaAltered();
+ bool getScoringSawNoradNormal();
+ bool getScoringSawNoradAltered();
+ bool getScoringSawMarsNormal();
+ bool getScoringSawMarsAltered();
+ bool getScoringSawWSCNormal();
+ bool getScoringSawWSCAltered();
+ bool getScoringWentToReadyRoom2();
+ bool getScoringWentAfterSinclair();
+ bool getScoringUsedCardBomb();
+ bool getScoringShieldedCardBomb();
+ bool getScoringStunnedSinclair();
+ bool getScoringDisarmedNuke();
+ bool getScoringThrewBreaker();
+ bool getScoringExtendedBridge();
+ bool getScoringGotHistoricalLog();
+ bool getScoringFinishedPrehistoric();
+ bool getScoringThrownByRobot();
+ bool getScoringGotMarsCard();
+ bool getScoringSawMarsKiosk();
+ bool getScoringSawTransportMap();
+ bool getScoringGotCrowBar();
+ bool getScoringTurnedOnTransport();
+ bool getScoringGotOxygenMask();
+ bool getScoringAvoidedRobot();
+ bool getScoringActivatedPlatform();
+ bool getScoringUsedLiquidNitrogen();
+ bool getScoringUsedCrowBar();
+ bool getScoringFoundCardBomb();
+ bool getScoringDisarmedCardBomb();
+ bool getScoringGotCardBomb();
+ bool getScoringThreadedMaze();
+ bool getScoringThreadedGearRoom();
+ bool getScoringEnteredShuttle();
+ bool getScoringEnteredLaunchTube();
+ bool getScoringStoppedRobotsShuttle();
+ bool getScoringGotMarsOpMemChip();
+ bool getScoringFinishedMars();
+ bool getScoringSawSecurityMonitor();
+ bool getScoringFilledOxygenCanister();
+ bool getScoringFilledArgonCanister();
+ bool getScoringSawUnconsciousOperator();
+ bool getScoringWentThroughPressureDoor();
+ bool getScoringPreppedSub();
+ bool getScoringEnteredSub();
+ bool getScoringExitedSub();
+ bool getScoringSawRobotAt54North();
+ bool getScoringPlayedWithClaw();
+ bool getScoringUsedRetinalChip();
+ bool getScoringFinishedGlobeGame();
+ bool getScoringStoppedNoradRobot();
+ bool getScoringGotNoradOpMemChip();
+ bool getScoringFinishedNorad();
+ bool getScoringRemovedDart();
+ bool getScoringAnalyzedDart();
+ bool getScoringBuiltAntidote();
+ bool getScoringGotSinclairKey();
+ bool getScoringGotArgonCanister();
+ bool getScoringGotNitrogenCanister();
+ bool getScoringPlayedWithMessages();
+ bool getScoringSawMorphExperiment();
+ bool getScoringEnteredSinclairOffice();
+ bool getScoringSawBrochure();
+ bool getScoringSawSinclairEntry1();
+ bool getScoringSawSinclairEntry2();
+ bool getScoringSawSinclairEntry3();
+ bool getScoringSawWSCDirectory();
+ bool getScoringUsedCrowBarInWSC();
+ bool getScoringFinishedPlasmaDodge();
+ bool getScoringOpenedCatwalk();
+ bool getScoringStoppedWSCRobot();
+ bool getScoringGotWSCOpMemChip();
+ bool getScoringFinishedWSC();
+ bool getScoringMarsGandhi();
+ bool getScoringNoradGandhi();
+ bool getScoringWSCGandhi();
+
+ GameScoreType getCaldoriaTSAScore();
+ GameScoreType getPrehistoricScore();
+ GameScoreType getMarsScore();
+ GameScoreType getNoradScore();
+ GameScoreType getWSCScore();
+ GameScoreType getGandhiScore();
+ GameScoreType getTotalScore();
+
+ void writeCaldoriaState(Common::WriteStream *stream);
+ void readCaldoriaState(Common::ReadStream *stream);
+ void resetCaldoriaState();
+
+ void writeTSAState(Common::WriteStream *stream);
+ void readTSAState(Common::ReadStream *stream);
+ void resetTSAState();
+
+ void writePrehistoricState(Common::WriteStream *stream);
+ void readPrehistoricState(Common::ReadStream *stream);
+ void resetPrehistoricState();
+
+ void writeNoradState(Common::WriteStream *stream);
+ void readNoradState(Common::ReadStream *stream);
+ void resetNoradState();
+
+ void writeMarsState(Common::WriteStream *stream);
+ void readMarsState(Common::ReadStream *stream);
+ void resetMarsState();
+
+ void writeWSCState(Common::WriteStream *stream);
+ void readWSCState(Common::ReadStream *stream);
+ void resetWSCState();
+
+ // Globals.
+ void setWalkthroughMode(bool);
+ bool getWalkthroughMode();
+ void setShieldOn(bool);
+ bool getShieldOn();
+ void setEasterEgg(bool);
+ bool getEasterEgg();
+ void setBeenToWSC(bool value);
+ bool getBeenToWSC();
+ void setBeenToMars(bool value);
+ bool getBeenToMars();
+ void setBeenToNorad(bool value);
+ bool getBeenToNorad();
+ void setWSCFinished(bool);
+ bool getWSCFinished();
+ void setMarsFinished(bool);
+ bool getMarsFinished();
+ void setNoradFinished(bool);
+ bool getNoradFinished();
+ bool allTimeZonesFinished();
+ void setTakenItemID(ItemID, bool);
+ bool isTakenItemID(ItemID);
+ void setTakenItem(Item *, bool);
+ bool isTakenItem(Item *);
+
+ // Caldoria
+ void setCaldoriaFuseTimeLimit(const TimeValue);
+ TimeValue getCaldoriaFuseTimeLimit();
+ void setCaldoriaSeenPullback(bool);
+ bool getCaldoriaSeenPullback();
+ void setCaldoriaMadeOJ(bool);
+ bool getCaldoriaMadeOJ();
+ void setCaldoriaWokenUp(bool);
+ bool getCaldoriaWokenUp();
+ void setCaldoriaDidRecalibration(bool);
+ bool getCaldoriaDidRecalibration();
+ void setCaldoriaSeenSinclairInElevator(bool);
+ bool getCaldoriaSeenSinclairInElevator();
+ void setCaldoriaINNAnnouncing(bool);
+ bool getCaldoriaINNAnnouncing();
+ void setCaldoriaSeenINN(bool);
+ bool getCaldoriaSeenINN();
+ void setCaldoriaSeenMessages(bool);
+ bool getCaldoriaSeenMessages();
+ void setCaldoriaSinclairShot(bool);
+ bool getCaldoriaSinclairShot();
+ void setCaldoriaBombDisarmed(bool);
+ bool getCaldoriaBombDisarmed();
+ void setCaldoriaRoofDoorOpen(bool);
+ bool getCaldoriaRoofDoorOpen();
+ void setCaldoriaDoneHygiene(bool);
+ bool getCaldoriaDoneHygiene();
+ void setCaldoriaSawVoiceAnalysis(bool);
+ bool getCaldoriaSawVoiceAnalysis();
+ void setCaldoriaDoorBombed(bool);
+ bool getCaldoriaDoorBombed();
+ void setCaldoriaGunAimed(bool);
+ bool getCaldoriaGunAimed();
+
+ // TSA
+ void setRipTimerTime(TimeValue);
+ TimeValue getRipTimerTime();
+ void setTSAFuseTimeLimit(TimeValue);
+ TimeValue getTSAFuseTimeLimit();
+ void setT0BMonitorMode(byte);
+ byte getT0BMonitorMode();
+ void setTSAState(byte);
+ byte getTSAState();
+ void setT0BMonitorStart(TimeValue);
+ TimeValue getT0BMonitorStart();
+ void setTSAIDedAtDoor(bool);
+ bool getTSAIDedAtDoor();
+ void setTSA0BZoomedIn(bool);
+ bool getTSA0BZoomedIn();
+ void setTSAFrontDoorUnlockedOutside(bool);
+ bool getTSAFrontDoorUnlockedOutside();
+ void setTSAFrontDoorUnlockedInside(bool);
+ bool getTSAFrontDoorUnlockedInside();
+ void setTSASeenRobotGreeting(bool);
+ bool getTSASeenRobotGreeting();
+ void setTSASeenTheory(bool);
+ bool getTSASeenTheory();
+ void setTSASeenBackground(bool);
+ bool getTSASeenBackground();
+ void setTSASeenProcedure(bool);
+ bool getTSASeenProcedure();
+ void setTSASeenAgent3AtDoor(bool);
+ bool getTSASeenAgent3AtDoor();
+ void setTSACommandCenterLocked(bool);
+ bool getTSACommandCenterLocked();
+ void setTSASeenCaldoriaNormal(bool);
+ bool getTSASeenCaldoriaNormal();
+ void setTSASeenCaldoriaAltered(bool);
+ bool getTSASeenCaldoriaAltered();
+ void setTSASeenNoradNormal(bool);
+ bool getTSASeenNoradNormal();
+ void setTSASeenNoradAltered(bool);
+ bool getTSASeenNoradAltered();
+ void setTSASeenMarsNormal(bool);
+ bool getTSASeenMarsNormal();
+ void setTSASeenMarsAltered(bool);
+ bool getTSASeenMarsAltered();
+ void setTSASeenWSCNormal(bool);
+ bool getTSASeenWSCNormal();
+ void setTSASeenWSCAltered(bool);
+ bool getTSASeenWSCAltered();
+ void setTSABiosuitOn(bool);
+ bool getTSABiosuitOn();
+
+ // Prehistoric
+ void setPrehistoricTriedToExtendBridge(bool);
+ bool getPrehistoricTriedToExtendBridge();
+ void setPrehistoricSeenTimeStream(bool);
+ bool getPrehistoricSeenTimeStream();
+ void setPrehistoricSeenFlyer1(bool);
+ bool getPrehistoricSeenFlyer1();
+ void setPrehistoricSeenFlyer2(bool);
+ bool getPrehistoricSeenFlyer2();
+ void setPrehistoricSeenBridgeZoom(bool);
+ bool getPrehistoricSeenBridgeZoom();
+ void setPrehistoricBreakerThrown(bool);
+ bool getPrehistoricBreakerThrown();
+
+ // Norad
+ void setNoradSeenTimeStream(bool);
+ bool getNoradSeenTimeStream();
+ void setNoradGassed(bool);
+ bool getNoradGassed();
+ void setNoradFillingStationOn(bool);
+ bool getNoradFillingStationOn();
+ void setNoradN22MessagePlayed(bool);
+ bool getNoradN22MessagePlayed();
+ void setNoradPlayedGlobeGame(bool);
+ bool getNoradPlayedGlobeGame();
+ void setNoradBeatRobotWithClaw(bool);
+ bool getNoradBeatRobotWithClaw();
+ void setNoradBeatRobotWithDoor(bool);
+ bool getNoradBeatRobotWithDoor();
+ void setNoradRetScanGood(bool);
+ bool getNoradRetScanGood();
+ void setNoradWaitingForLaser(bool);
+ bool getNoradWaitingForLaser();
+ void setNoradSubRoomPressure(uint16);
+ uint16 getNoradSubRoomPressure();
+ void setNoradSubPrepState(NoradSubPrepState);
+ NoradSubPrepState getNoradSubPrepState();
+ void setNoradArrivedFromSub(bool);
+ bool getNoradArrivedFromSub();
+
+ // Mars
+ void setMarsSeenTimeStream(bool);
+ bool getMarsSeenTimeStream();
+ void setMarsHeardUpperPodMessage(bool);
+ bool getMarsHeardUpperPodMessage();
+ void setMarsRobotThrownPlayer(bool);
+ bool getMarsRobotThrownPlayer();
+ void setMarsHeardCheckInMessage(bool);
+ bool getMarsHeardCheckInMessage();
+ void setMarsPodAtUpperPlatform(bool);
+ bool getMarsPodAtUpperPlatform();
+ void setMarsSeenThermalScan(bool);
+ bool getMarsSeenThermalScan();
+ void setMarsArrivedBelow(bool);
+ bool getMarsArrivedBelow();
+ void setMarsSeenRobotAtReactor(bool);
+ bool getMarsSeenRobotAtReactor();
+ void setMarsAvoidedReactorRobot(bool);
+ bool getMarsAvoidedReactorRobot();
+ void setMarsInAirlock(bool);
+ bool getMarsInAirlock();
+ void setMarsAirlockOpen(bool);
+ bool getMarsAirlockOpen();
+ void setMarsMaskOnFiller(bool);
+ bool getMarsMaskOnFiller();
+ void setMarsLockFrozen(bool);
+ bool getMarsLockFrozen();
+ void setMarsLockBroken(bool);
+ bool getMarsLockBroken();
+ void setMarsMazeDoorPair1(bool);
+ bool getMarsMazeDoorPair1();
+ void setMarsMazeDoorPair2(bool);
+ bool getMarsMazeDoorPair2();
+ void setMarsMazeDoorPair3(bool);
+ bool getMarsMazeDoorPair3();
+ void setMarsSawRobotLeave(bool);
+ bool getMarsSawRobotLeave();
+ void setMarsSecurityDown(bool);
+ bool getMarsSecurityDown();
+ void setMarsFinishedCanyonChase(bool);
+ bool getMarsFinishedCanyonChase();
+ void setMarsThreadedMaze(bool);
+ bool getMarsThreadedMaze();
+ void setMarsHitRobotWithCannon(bool);
+ bool getMarsHitRobotWithCannon();
+ void setMarsReadyForShuttleTransport(bool);
+ bool getMarsReadyForShuttleTransport();
+
+ // WSC
+ void setWSCSeenTimeStream(bool);
+ bool getWSCSeenTimeStream();
+ void setWSCPoisoned(bool);
+ bool getWSCPoisoned();
+ void setWSCAnsweredAboutDart(bool);
+ bool getWSCAnsweredAboutDart();
+ void setWSCRemovedDart(bool);
+ bool getWSCRemovedDart();
+ void setWSCAnalyzerOn(bool);
+ bool getWSCAnalyzerOn();
+ void setWSCDartInAnalyzer(bool);
+ bool getWSCDartInAnalyzer();
+ void setWSCAnalyzedDart(bool);
+ bool getWSCAnalyzedDart();
+ void setWSCSawMorph(bool);
+ bool getWSCSawMorph();
+ void setWSCDesignedAntidote(bool);
+ bool getWSCDesignedAntidote();
+ void setWSCPickedUpAntidote(bool);
+ bool getWSCPickedUpAntidote();
+ void setWSCOfficeMessagesOpen(bool);
+ bool getWSCOfficeMessagesOpen();
+ void setWSCSeenNerd(bool);
+ bool getWSCSeenNerd();
+ void setWSCHeardPage1(bool);
+ bool getWSCHeardPage1();
+ void setWSCHeardPage2(bool);
+ bool getWSCHeardPage2();
+ void setWSCHeardCheckIn(bool);
+ bool getWSCHeardCheckIn();
+ void setWSCDidPlasmaDodge(bool);
+ bool getWSCDidPlasmaDodge();
+ void setWSCSeenSinclairLecture(bool);
+ bool getWSCSeenSinclairLecture();
+ void setWSCBeenAtWSC93(bool);
+ bool getWSCBeenAtWSC93();
+ void setWSCCatwalkDark(bool);
+ bool getWSCCatwalkDark();
+ void setWSCRobotDead(bool);
+ bool getWSCRobotDead();
+ void setWSCRobotGone(bool);
+ bool getWSCRobotGone();
+
+protected:
+ friend class Common::Singleton<SingletonBaseType>;
+
+private:
+ // Base
+ NeighborhoodID _currentNeighborhood;
+ RoomID _currentRoom;
+ DirectionConstant _currentDirection;
+ NeighborhoodID _nexNeighborhoodID;
+ RoomID _nextRoomID;
+ DirectionConstant _nextDirection;
+ NeighborhoodID _lastNeighborhood;
+ RoomID _lastRoom;
+ DirectionConstant _lastDirection;
+ RoomID _openDoorRoom;
+ DirectionConstant _openDoorDirection;
+
+ // Pegasus Prime
+ FlagsArray<byte, kNumGlobalFlags> _globalFlags;
+ FlagsArray<byte, kNumScoringFlags> _scoringFlags;
+ FlagsArray<uint32, kNumItems> _itemTakenFlags;
+
+ FlagsArray<byte, kNumCaldoriaFlags> _caldoriaFlags;
+ TimeValue _caldoriaFuseTimeLimit;
+
+ TimeValue _TSARipTimerTime;
+ TimeValue _TSAFuseTimeLimit;
+ byte _TSAState;
+ byte _T0BMonitorMode;
+ TimeValue _T0BMonitorStart;
+ FlagsArray<byte, kNumTSAFlags> _TSAFlags;
+
+ FlagsArray<byte, kNumPrehistoricFlags> _prehistoricFlags;
+
+ FlagsArray<byte, kNumNoradFlags> _noradFlags;
+ uint16 _noradSubRoomPressure;
+ NoradSubPrepState _noradSubPrepState;
+
+ FlagsArray<byte, kNumMarsFlags> _marsFlags;
+
+ FlagsArray<byte, kNumWSCFlags> _WSCFlags;
+};
+
+} // End of namespace Pegasus
+
+#define GameState (::Pegasus::GameStateManager::instance())
+
+#endif
diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp
new file mode 100644
index 0000000000..8dbd678809
--- /dev/null
+++ b/engines/pegasus/graphics.cpp
@@ -0,0 +1,346 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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"
+#include "common/file.h"
+#include "common/textconsole.h"
+#include "engines/util.h"
+
+#include "pegasus/elements.h"
+#include "pegasus/graphics.h"
+#include "pegasus/transition.h"
+
+namespace Pegasus {
+
+GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
+ initGraphics(640, 480, true, NULL);
+
+ if (_vm->_system->getScreenFormat().bytesPerPixel == 1)
+ error("No true color mode available");
+
+ _backLayer = kMinAvailableOrder;
+ _frontLayer = kMaxAvailableOrder;
+ _firstDisplayElement = _lastDisplayElement = 0;
+ _workArea.create(640, 480, _vm->_system->getScreenFormat());
+ _modifiedScreen = false;
+ _curSurface = &_workArea;
+ _erase = false;
+ _updatesEnabled = true;
+ _screenFader = new ScreenFader();
+}
+
+GraphicsManager::~GraphicsManager() {
+ _workArea.free();
+ delete _screenFader;
+}
+
+void GraphicsManager::invalRect(const Common::Rect &rect) {
+ // We're using a simpler algorithm for dirty rect handling than the original
+ // The original was way too overcomplicated for what we need here now.
+
+ if (_dirtyRect.width() == 0 || _dirtyRect.height() == 0) {
+ // We have no dirty rect, so this is now our dirty rect
+ _dirtyRect = rect;
+ } else {
+ // Expand our dirty rect to include rect
+ _dirtyRect.extend(rect);
+ }
+
+ // Sanity check: clip our rect to the screen
+ _dirtyRect.right = MIN<int>(640, _dirtyRect.right);
+ _dirtyRect.bottom = MIN<int>(480, _dirtyRect.bottom);
+}
+
+void GraphicsManager::addDisplayElement(DisplayElement *newElement) {
+ newElement->_elementOrder = CLIP<int>(newElement->_elementOrder, kMinAvailableOrder, kMaxAvailableOrder);
+
+ if (_firstDisplayElement) {
+ DisplayElement *runner = _firstDisplayElement;
+ DisplayElement *lastRunner = 0;
+
+ // Search for first element whose display order is greater than
+ // the new element's and add the new element just before it.
+ while (runner) {
+ if (newElement->_elementOrder < runner->_elementOrder) {
+ if (lastRunner) {
+ lastRunner->_nextElement = newElement;
+ newElement->_nextElement = runner;
+ } else {
+ newElement->_nextElement = _firstDisplayElement;
+ _firstDisplayElement = newElement;
+ }
+ break;
+ }
+ lastRunner = runner;
+ runner = runner->_nextElement;
+ }
+
+ // If got here and runner == NULL, we ran through the whole list without
+ // inserting, so add at the end.
+ if (!runner) {
+ _lastDisplayElement->_nextElement = newElement;
+ _lastDisplayElement = newElement;
+ }
+ } else {
+ _firstDisplayElement = newElement;
+ _lastDisplayElement = newElement;
+ }
+
+ newElement->_elementIsDisplaying = true;
+}
+
+void GraphicsManager::removeDisplayElement(DisplayElement *oldElement) {
+ if (!_firstDisplayElement)
+ return;
+
+ if (oldElement == _firstDisplayElement) {
+ if (oldElement == _lastDisplayElement) {
+ _firstDisplayElement = 0;
+ _lastDisplayElement = 0;
+ } else {
+ _firstDisplayElement = oldElement->_nextElement;
+ }
+
+ invalRect(oldElement->_bounds);
+ } else {
+ // Scan list for element.
+ // If we get here, we know that the list has at least one item, and it
+ // is not the first item, so we can skip it.
+ DisplayElement *runner = _firstDisplayElement->_nextElement;
+ DisplayElement *lastRunner = _firstDisplayElement;
+
+ while (runner) {
+ if (runner == oldElement) {
+ lastRunner->_nextElement = runner->_nextElement;
+
+ if (oldElement == _lastDisplayElement)
+ _lastDisplayElement = lastRunner;
+
+ invalRect(oldElement->_bounds);
+ break;
+ }
+
+ lastRunner = runner;
+ runner = runner->_nextElement;
+ }
+ }
+
+ oldElement->_nextElement = 0;
+ oldElement->_elementIsDisplaying = false;
+}
+
+void GraphicsManager::updateDisplay() {
+ bool screenDirty = false;
+
+ if (!_dirtyRect.isEmpty()) {
+ // Fill the dirty area with black if erase mode is enabled
+ if (_erase)
+ _workArea.fillRect(_dirtyRect, _workArea.format.RGBToColor(0, 0, 0));
+
+ for (DisplayElement *runner = _firstDisplayElement; runner != 0; runner = runner->_nextElement) {
+ Common::Rect bounds;
+ runner->getBounds(bounds);
+
+ // TODO: Better logic; it does a bit more work than it probably needs to
+ // but it should work fine for now.
+ if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer)) {
+ runner->draw(bounds);
+ screenDirty = true;
+ }
+ }
+
+ // Copy only the dirty rect to the screen
+ if (screenDirty)
+ g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
+
+ // Clear the dirty rect
+ _dirtyRect = Common::Rect();
+ }
+
+ if (_updatesEnabled && (screenDirty || _modifiedScreen))
+ g_system->updateScreen();
+
+ _modifiedScreen = false;
+}
+
+void GraphicsManager::clearScreen() {
+ Graphics::Surface *screen = g_system->lockScreen();
+ screen->fillRect(Common::Rect(0, 0, 640, 480), g_system->getScreenFormat().RGBToColor(0, 0, 0));
+ g_system->unlockScreen();
+ _modifiedScreen = true;
+}
+
+DisplayElement *GraphicsManager::findDisplayElement(const DisplayElementID id) {
+ DisplayElement *runner = _firstDisplayElement;
+
+ while (runner) {
+ if (runner->getObjectID() == id)
+ return runner;
+ runner = runner->_nextElement;
+ }
+
+ return 0;
+}
+
+void GraphicsManager::doFadeOutSync(const TimeValue time, const TimeScale scale, bool isBlack) {
+ _updatesEnabled = false;
+ _screenFader->doFadeOutSync(time, scale, isBlack);
+}
+
+void GraphicsManager::doFadeInSync(const TimeValue time, const TimeScale scale, bool isBlack) {
+ _screenFader->doFadeInSync(time, scale, isBlack);
+ _updatesEnabled = true;
+}
+
+void GraphicsManager::markCursorAsDirty() {
+ _modifiedScreen = true;
+}
+
+void GraphicsManager::newShakePoint(int32 index1, int32 index2, int32 maxRadius) {
+ int32 index3 = (index1 + index2) >> 1;
+
+ if (maxRadius == 0) {
+ _shakeOffsets[index3].x = ((_shakeOffsets[index1].x + _shakeOffsets[index2].x) >> 1);
+ _shakeOffsets[index3].y = ((_shakeOffsets[index1].y + _shakeOffsets[index2].y) >> 1);
+ } else {
+ double angle = (int32)(_vm->getRandomNumber(360 - 1) * 3.1415926535 / 180);
+ int32 radius = maxRadius;
+ _shakeOffsets[index3].x = (int32)(((_shakeOffsets[index1].x + _shakeOffsets[index2].x) >> 1) +
+ cos(angle) / 2 * radius);
+ _shakeOffsets[index3].y = (int32)(((_shakeOffsets[index1].y + _shakeOffsets[index2].y) >> 1) +
+ sin(angle) * radius);
+ }
+
+ if (index1 < index3 - 1)
+ newShakePoint(index1, index3, maxRadius * 2 / 3);
+
+ if (index3 < index2 - 1)
+ newShakePoint(index3, index2, maxRadius * 2 / 3);
+}
+
+void GraphicsManager::shakeTheWorld(TimeValue duration, TimeScale scale) {
+ if (duration == 0 || scale == 0)
+ return;
+
+ _shakeOffsets[0].x = 0;
+ _shakeOffsets[0].y = 0;
+ _shakeOffsets[(kMaxShakeOffsets - 1) / 4].x = 0;
+ _shakeOffsets[(kMaxShakeOffsets - 1) / 4].y = 0;
+ _shakeOffsets[(kMaxShakeOffsets - 1) / 2].x = 0;
+ _shakeOffsets[(kMaxShakeOffsets - 1) / 2].y = 0;
+ _shakeOffsets[(kMaxShakeOffsets - 1) * 3 / 4].x = 0;
+ _shakeOffsets[(kMaxShakeOffsets - 1) * 3 / 4].y = 0;
+ _shakeOffsets[kMaxShakeOffsets - 1].x = 0;
+ _shakeOffsets[kMaxShakeOffsets - 1].y = 0;
+
+ newShakePoint(0, (kMaxShakeOffsets - 1) / 4, 8);
+ newShakePoint((kMaxShakeOffsets - 1) / 4, (kMaxShakeOffsets - 1) / 2, 6);
+ newShakePoint((kMaxShakeOffsets - 1) / 2, (kMaxShakeOffsets - 1) * 3 / 4, 4);
+ newShakePoint((kMaxShakeOffsets - 1) * 3 / 4, kMaxShakeOffsets - 1, 3);
+
+ Common::Point lastOffset(0, 0);
+
+ // Store the current screen for later use
+ Graphics::Surface oldScreen;
+ Graphics::Surface *curScreen = g_system->lockScreen();
+ oldScreen.copyFrom(*curScreen);
+ g_system->unlockScreen();
+
+ // Convert to millis
+ duration = duration * 1000 / scale;
+
+ uint32 startTime = g_system->getMillis();
+
+ while (g_system->getMillis() < startTime + duration) {
+ Common::Point thisOffset = _shakeOffsets[(g_system->getMillis() - startTime) * (kMaxShakeOffsets - 1) / duration];
+ if (thisOffset != lastOffset) {
+ // Fill the screen with black
+ Graphics::Surface *screen = g_system->lockScreen();
+ screen->fillRect(Common::Rect(0, 0, 640, 480), g_system->getScreenFormat().RGBToColor(0, 0, 0));
+ g_system->unlockScreen();
+
+ // Calculate the src/dst offsets and the width/height
+ int32 srcOffsetX, dstOffsetX, width;
+
+ if (thisOffset.x > 0) {
+ srcOffsetX = 0;
+ dstOffsetX = thisOffset.x;
+ width = 640 - dstOffsetX;
+ } else {
+ srcOffsetX = -thisOffset.x;
+ dstOffsetX = 0;
+ width = 640 - srcOffsetX;
+ }
+
+ int32 srcOffsetY, dstOffsetY, height;
+
+ if (thisOffset.y > 0) {
+ srcOffsetY = 0;
+ dstOffsetY = thisOffset.y;
+ height = 480 - dstOffsetY;
+ } else {
+ srcOffsetY = -thisOffset.y;
+ dstOffsetY = 0;
+ height = 480 - srcOffsetY;
+ }
+
+ // Now copy to the screen
+ g_system->copyRectToScreen((byte *)oldScreen.getBasePtr(srcOffsetX, srcOffsetY), oldScreen.pitch,
+ dstOffsetX, dstOffsetY, width, height);
+ g_system->updateScreen();
+
+ lastOffset = thisOffset;
+ }
+
+ g_system->delayMillis(10);
+ }
+
+ if (lastOffset.x != 0 || lastOffset.y != 0) {
+ g_system->copyRectToScreen((byte *)oldScreen.pixels, oldScreen.pitch, 0, 0, 640, 480);
+ g_system->updateScreen();
+ }
+
+ oldScreen.free();
+}
+
+void GraphicsManager::enableErase() {
+ _erase = true;
+}
+
+void GraphicsManager::disableErase() {
+ _erase = false;
+}
+
+void GraphicsManager::enableUpdates() {
+ _updatesEnabled = true;
+ _screenFader->setFaderValue(100);
+}
+
+void GraphicsManager::disableUpdates() {
+ _updatesEnabled = false;
+ _screenFader->setFaderValue(0);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h
new file mode 100644
index 0000000000..fcdf1c9e78
--- /dev/null
+++ b/engines/pegasus/graphics.h
@@ -0,0 +1,95 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_GRAPHICS_H
+#define PEGASUS_GRAPHICS_H
+
+#include "common/rect.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "graphics/surface.h"
+
+#include "pegasus/constants.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+class Cursor;
+class DisplayElement;
+class PegasusEngine;
+class ScreenFader;
+
+class GraphicsManager {
+friend class Cursor;
+public:
+ GraphicsManager(PegasusEngine *vm);
+ ~GraphicsManager();
+
+ void addDisplayElement(DisplayElement *element);
+ void removeDisplayElement(DisplayElement *element);
+ void invalRect(const Common::Rect &rect);
+ DisplayOrder getBackOfActiveLayer() const { return _backLayer; }
+ DisplayOrder getFrontOfActiveLayer() const { return _frontLayer; }
+ void updateDisplay();
+ Graphics::Surface *getCurSurface() { return _curSurface; }
+ void setCurSurface(Graphics::Surface *surface) { _curSurface = surface; }
+ Graphics::Surface *getWorkArea() { return &_workArea; }
+ void clearScreen();
+ DisplayElement *findDisplayElement(const DisplayElementID id);
+ void shakeTheWorld(TimeValue time, TimeScale scale);
+ void enableErase();
+ void disableErase();
+ void enableUpdates();
+ void disableUpdates();
+
+ // These default to black
+ void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
+ void doFadeInSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
+
+protected:
+ void markCursorAsDirty();
+
+private:
+ PegasusEngine *_vm;
+
+ bool _modifiedScreen, _erase;
+ Common::Rect _dirtyRect;
+ DisplayOrder _backLayer, _frontLayer;
+ DisplayElement *_firstDisplayElement, *_lastDisplayElement;
+ Graphics::Surface _workArea, *_curSurface;
+
+ // Shake Shake Shake!
+ static const int kMaxShakeOffsets = 17;
+ Common::Point _shakeOffsets[kMaxShakeOffsets];
+ void newShakePoint(int32 index1, int32 index2, int32 maxRadius);
+
+ bool _updatesEnabled;
+ ScreenFader *_screenFader;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/hotspot.cpp b/engines/pegasus/hotspot.cpp
new file mode 100644
index 0000000000..d8b07a94f4
--- /dev/null
+++ b/engines/pegasus/hotspot.cpp
@@ -0,0 +1,325 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/stream.h"
+
+#include "pegasus/hotspot.h"
+
+namespace Pegasus {
+
+Region::Region(Common::ReadStream *stream) {
+ uint16 length = stream->readUint16BE();
+
+ assert(length >= 10);
+
+ _bounds.top = stream->readUint16BE();
+ _bounds.left = stream->readUint16BE();
+ _bounds.bottom = stream->readUint16BE();
+ _bounds.right = stream->readUint16BE();
+
+ _bounds.debugPrint(0, "Bounds:");
+
+ if (length == 10)
+ return;
+
+ length -= 10;
+
+ while (length > 0) {
+ Vector v;
+ v.y = stream->readUint16BE();
+ length -= 2;
+
+ if (v.y == 0x7fff)
+ break;
+
+ debug(0, "y: %d", v.y);
+
+ // Normalize y to _bounds
+ v.y -= _bounds.top;
+
+ while (length > 0) {
+ Run run;
+ run.start = stream->readUint16BE();
+ length -= 2;
+
+ if (run.start == 0x7fff)
+ break;
+
+ run.end = stream->readUint16BE();
+ length -= 2;
+
+ debug(0, "\t[%d, %d)", run.start, run.end);
+
+ // Normalize to _bounds
+ run.start -= _bounds.left;
+ run.end -= _bounds.left;
+
+ v.push_back(run);
+ }
+
+ _vectors.push_back(v);
+ }
+}
+
+Region::Region(const Common::Rect &rect) {
+ _bounds = rect;
+}
+
+bool Region::pointInRegion(const Common::Point &point) const {
+ if (!_bounds.contains(point))
+ return false;
+
+ bool pixelActive = false;
+
+ // Normalize the points to _bounds
+ uint16 x = point.x - _bounds.left;
+ uint16 y = point.y - _bounds.top;
+
+ for (Common::List<Vector>::const_iterator v = _vectors.begin(); v != _vectors.end(); v++) {
+ if (v->y > y)
+ return pixelActive;
+
+ for (Vector::const_iterator run = v->begin(); run != v->end(); run++) {
+ if (x >= run->start && x < run->end) {
+ pixelActive = !pixelActive;
+ break;
+ }
+ }
+ }
+
+ // the case if the region is just a rect
+ return true;
+}
+
+void Region::moveTo(CoordType h, CoordType v) {
+ _bounds.moveTo(h, v);
+}
+
+void Region::moveTo(const Common::Point &point) {
+ _bounds.moveTo(point);
+}
+
+void Region::translate(CoordType h, CoordType v) {
+ _bounds.translate(h, v);
+}
+
+void Region::translate(const Common::Point &point) {
+ _bounds.translate(point.x, point.y);
+}
+
+void Region::getCenter(CoordType &h, CoordType &v) const {
+ h = (_bounds.left + _bounds.right) / 2;
+ v = (_bounds.top + _bounds.bottom) / 2;
+}
+
+void Region::getCenter(Common::Point &point) const {
+ getCenter(point.x, point.y);
+}
+
+Hotspot::Hotspot(const HotSpotID id) : IDObject(id) {
+ _spotFlags = kNoHotSpotFlags;
+ _spotActive = false;
+}
+
+Hotspot::~Hotspot() {
+}
+
+void Hotspot::setArea(const Common::Rect &area) {
+ _spotArea = Region(area);
+}
+
+void Hotspot::setArea(const CoordType left, const CoordType top, const CoordType right, const CoordType bottom) {
+ _spotArea = Region(Common::Rect(left, top, right, bottom));
+}
+
+void Hotspot::getBoundingBox(Common::Rect &r) const {
+ r = _spotArea.getBoundingBox();
+}
+
+void Hotspot::getCenter(Common::Point &pt) const {
+ _spotArea.getCenter(pt);
+}
+
+void Hotspot::getCenter(CoordType &h, CoordType &v) const {
+ _spotArea.getCenter(h, v);
+}
+
+void Hotspot::setActive() {
+ _spotActive = true;
+}
+
+void Hotspot::setInactive() {
+ _spotActive = false;
+}
+
+void Hotspot::setHotspotFlags(const HotSpotFlags flags) {
+ _spotFlags = flags;
+}
+
+void Hotspot::setMaskedHotspotFlags(const HotSpotFlags flags, const HotSpotFlags mask) {
+ _spotFlags = (_spotFlags & ~mask) | flags;
+}
+
+bool Hotspot::isSpotActive() const {
+ return _spotActive;
+}
+
+void Hotspot::moveSpotTo(const CoordType h, const CoordType v) {
+ _spotArea.moveTo(h, v);
+}
+
+void Hotspot::moveSpotTo(const Common::Point pt) {
+ _spotArea.moveTo(pt);
+}
+
+void Hotspot::moveSpot(const CoordType h, const CoordType v) {
+ _spotArea.translate(h, v);
+}
+
+void Hotspot::moveSpot(const Common::Point pt) {
+ _spotArea.translate(pt.x, pt.y);
+}
+
+bool Hotspot::pointInSpot(const Common::Point where) const {
+ return _spotActive && _spotArea.pointInRegion(where);
+}
+
+HotSpotFlags Hotspot::getHotspotFlags() const {
+ return _spotFlags;
+}
+
+HotspotList::HotspotList() {
+}
+
+HotspotList::~HotspotList() {
+ // TODO: Should this call deleteHotspots()?
+}
+
+void HotspotList::deleteHotspots() {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ delete *it;
+
+ clear();
+}
+
+Hotspot *HotspotList::findHotspot(const Common::Point where) {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ if ((*it)->pointInSpot(where))
+ return *it;
+
+ return 0;
+}
+
+HotSpotID HotspotList::findHotspotID(const Common::Point where) {
+ Hotspot *hotspot = findHotspot(where);
+ return hotspot ? hotspot->getObjectID() : kNoHotSpotID;
+}
+
+Hotspot *HotspotList::findHotspotByID(const HotSpotID id) {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ if ((*it)->getObjectID() == id)
+ return *it;
+
+ return 0;
+}
+
+Hotspot *HotspotList::findHotspotByMask(const HotSpotFlags flags) {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ if (((*it)->getHotspotFlags() & flags) == flags)
+ return *it;
+
+ return 0;
+}
+
+void HotspotList::activateMaskedHotspots(const HotSpotFlags flags) {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ if (flags == kNoHotSpotFlags || ((*it)->getHotspotFlags() & flags) != 0)
+ (*it)->setActive();
+}
+
+void HotspotList::deactivateAllHotspots() {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ (*it)->setInactive();
+}
+
+void HotspotList::deactivateMaskedHotspots(const HotSpotFlags flags) {
+ for (HotspotIterator it = begin(); it != end(); it++)
+ if (((*it)->getHotspotFlags() & flags) != 0)
+ (*it)->setInactive();
+}
+
+void HotspotList::activateOneHotspot(const HotSpotID id) {
+ for (HotspotIterator it = begin(); it != end(); it++) {
+ if ((*it)->getObjectID() == id) {
+ (*it)->setActive();
+ return;
+ }
+ }
+}
+
+void HotspotList::deactivateOneHotspot(const HotSpotID id) {
+ for (HotspotIterator it = begin(); it != end(); it++) {
+ if ((*it)->getObjectID() == id) {
+ (*it)->setInactive();
+ return;
+ }
+ }
+}
+
+void HotspotList::removeOneHotspot(const HotSpotID id) {
+ for (HotspotIterator it = begin(); it != end(); it++) {
+ if ((*it)->getObjectID() == id) {
+ erase(it);
+ return;
+ }
+ }
+}
+
+void HotspotList::removeMaskedHotspots(const HotSpotFlags flags) {
+ if (flags != kNoHotSpotFlags) {
+ for (HotspotIterator it = begin(); it != end(); ) {
+ if (((*it)->getHotspotFlags() & flags) != 0)
+ it = erase(it);
+ else
+ it++;
+ }
+ } else {
+ clear();
+ }
+}
+
+void HotspotList::setHotspotRect(const HotSpotID id, const Common::Rect &r) {
+ Hotspot *hotspot = findHotspotByID(id);
+ if (hotspot)
+ hotspot->setArea(r);
+}
+
+void HotspotList::getHotspotRect(const HotSpotID id, Common::Rect &r) {
+ Hotspot *hotspot = findHotspotByID(id);
+ if (hotspot)
+ hotspot->getBoundingBox(r);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/hotspot.h b/engines/pegasus/hotspot.h
new file mode 100644
index 0000000000..64d3fb19f9
--- /dev/null
+++ b/engines/pegasus/hotspot.h
@@ -0,0 +1,152 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_HOTSPOT_H
+#define PEGASUS_HOTSPOT_H
+
+#include "common/list.h"
+#include "common/rect.h"
+
+#include "pegasus/constants.h"
+#include "pegasus/types.h"
+#include "pegasus/util.h"
+
+/*
+
+ Hot spots combine a pixel area, an ID value and an active flag.
+
+ A point is considered in a hot spot if the point is in the hot spot's pixel area and
+ the active flag is set.
+
+ In addition, hot spots have a 32 bit word of bit flags for filtering use.
+
+*/
+
+namespace Common {
+ class ReadStream;
+}
+
+namespace Pegasus {
+
+// Our implementation of QuickDraw regions
+class Region {
+public:
+ Region() {}
+ Region(Common::ReadStream *stream);
+ Region(const Common::Rect &rect);
+
+ Common::Rect getBoundingBox() const { return _bounds; }
+
+ bool pointInRegion(const Common::Point &point) const;
+
+ void moveTo(CoordType h, CoordType v);
+ void moveTo(const Common::Point &point);
+ void translate(CoordType h, CoordType v);
+ void translate(const Common::Point &point);
+ void getCenter(CoordType &h, CoordType &v) const;
+ void getCenter(Common::Point &point) const;
+
+private:
+ Common::Rect _bounds;
+
+ struct Run {
+ uint16 start, end;
+ };
+
+ class Vector : public Common::List<Run> {
+ public:
+ uint16 y;
+ };
+
+ Common::List<Vector> _vectors;
+};
+
+class Hotspot : public IDObject {
+public:
+ Hotspot(const HotSpotID);
+ virtual ~Hotspot();
+
+ void setArea(const Region &region) { _spotArea = region; }
+ void setArea(const Common::Rect &);
+ void setArea(const CoordType, const CoordType, const CoordType, const CoordType);
+ void getBoundingBox(Common::Rect &) const;
+ void getArea(Region &) const;
+ void getCenter(Common::Point&) const;
+ void getCenter(CoordType&, CoordType&) const;
+
+ void moveSpotTo(const CoordType, const CoordType);
+ void moveSpotTo(const Common::Point);
+ void moveSpot(const CoordType, const CoordType);
+ void moveSpot(const Common::Point);
+
+ bool pointInSpot(const Common::Point) const;
+
+ void setActive();
+ void setInactive();
+ bool isSpotActive() const;
+
+ HotSpotFlags getHotspotFlags() const;
+ void setHotspotFlags(const HotSpotFlags);
+ void setMaskedHotspotFlags(const HotSpotFlags flags, const HotSpotFlags mask);
+
+protected:
+ Region _spotArea;
+ HotSpotFlags _spotFlags;
+ bool _spotActive;
+};
+
+class HotspotList : public Common::List<Hotspot *> {
+public:
+ HotspotList();
+ virtual ~HotspotList();
+
+ void deleteHotspots();
+
+ Hotspot *findHotspot(const Common::Point);
+ HotSpotID findHotspotID(const Common::Point);
+ Hotspot *findHotspotByID(const HotSpotID);
+ Hotspot *findHotspotByMask(const HotSpotFlags);
+
+ void activateMaskedHotspots(const HotSpotFlags = kNoHotSpotFlags);
+ void deactivateAllHotspots();
+ void deactivateMaskedHotspots(const HotSpotFlags);
+
+ void activateOneHotspot(const HotSpotID);
+ void deactivateOneHotspot(const HotSpotID);
+
+ void removeOneHotspot(const HotSpotID);
+ void removeMaskedHotspots(const HotSpotFlags = kNoHotSpotFlags);
+
+ void setHotspotRect(const HotSpotID, const Common::Rect&);
+ void getHotspotRect(const HotSpotID, Common::Rect&);
+};
+
+typedef HotspotList::iterator HotspotIterator;
+
+#define g_allHotspots (((PegasusEngine *)g_engine)->getAllHotspots())
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
new file mode 100644
index 0000000000..b74e4a4c45
--- /dev/null
+++ b/engines/pegasus/input.cpp
@@ -0,0 +1,373 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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"
+#include "common/system.h"
+
+#include "pegasus/cursor.h"
+#include "pegasus/input.h"
+#include "pegasus/pegasus.h"
+
+namespace Common {
+DECLARE_SINGLETON(Pegasus::InputDeviceManager);
+}
+
+namespace Pegasus {
+
+InputDeviceManager::InputDeviceManager() {
+ // Set all keys to "not down"
+ _keyMap[Common::KEYCODE_UP] = false;
+ _keyMap[Common::KEYCODE_KP8] = false;
+ _keyMap[Common::KEYCODE_LEFT] = false;
+ _keyMap[Common::KEYCODE_KP4] = false;
+ _keyMap[Common::KEYCODE_DOWN] = false;
+ _keyMap[Common::KEYCODE_KP5] = false;
+ _keyMap[Common::KEYCODE_RIGHT] = false;
+ _keyMap[Common::KEYCODE_KP6] = false;
+ _keyMap[Common::KEYCODE_RETURN] = false;
+ _keyMap[Common::KEYCODE_SPACE] = false;
+ _keyMap[Common::KEYCODE_t] = false;
+ _keyMap[Common::KEYCODE_KP_EQUALS] = false;
+ _keyMap[Common::KEYCODE_i] = false;
+ _keyMap[Common::KEYCODE_KP_DIVIDE] = false;
+ _keyMap[Common::KEYCODE_q] = false;
+ _keyMap[Common::KEYCODE_ESCAPE] = false;
+ _keyMap[Common::KEYCODE_p] = false;
+ _keyMap[Common::KEYCODE_TILDE] = false;
+ _keyMap[Common::KEYCODE_BACKQUOTE] = false;
+ _keyMap[Common::KEYCODE_NUMLOCK] = false;
+ _keyMap[Common::KEYCODE_BACKSPACE] = false;
+ _keyMap[Common::KEYCODE_KP_MULTIPLY] = false;
+ _keyMap[Common::KEYCODE_LALT] = false;
+ _keyMap[Common::KEYCODE_RALT] = false;
+ _keyMap[Common::KEYCODE_e] = false;
+ _keyMap[Common::KEYCODE_KP_ENTER] = false;
+
+ g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 2, false);
+ _lastRawBits = kAllUpBits;
+ _consoleRequested = false;
+}
+
+InputDeviceManager::~InputDeviceManager() {
+ g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
+}
+
+void InputDeviceManager::getInput(Input &input, const InputBits filter) {
+ // Poll for events, but ignore them!
+ // We'll pick them up in notifyEvent()
+ // We do that so that any pollEvent() call can update the variables
+ // (ie. if one uses enter to access the restore menu, we never receive
+ // the key up event, which leads to bad things)
+ // This is to closely emulate what the GetKeys() function did on Mac OS
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event))
+ ;
+
+ // Now create the bitfield
+ InputBits currentBits = 0;
+
+ if (_keyMap[Common::KEYCODE_UP] || _keyMap[Common::KEYCODE_KP8])
+ currentBits |= (kRawButtonDown << kUpButtonShift);
+
+ if (_keyMap[Common::KEYCODE_DOWN] || _keyMap[Common::KEYCODE_KP5])
+ currentBits |= (kRawButtonDown << kDownButtonShift);
+
+ if (_keyMap[Common::KEYCODE_LEFT] || _keyMap[Common::KEYCODE_KP4])
+ currentBits |= (kRawButtonDown << kLeftButtonShift);
+
+ if (_keyMap[Common::KEYCODE_RIGHT] || _keyMap[Common::KEYCODE_KP6])
+ currentBits |= (kRawButtonDown << kRightButtonShift);
+
+ if (_keyMap[Common::KEYCODE_SPACE] || _keyMap[Common::KEYCODE_RETURN] || _keyMap[Common::KEYCODE_KP_ENTER])
+ currentBits |= (kRawButtonDown << kTwoButtonShift);
+
+ if (_keyMap[Common::KEYCODE_t] || _keyMap[Common::KEYCODE_KP_EQUALS])
+ currentBits |= (kRawButtonDown << kThreeButtonShift);
+
+ if (_keyMap[Common::KEYCODE_i] || _keyMap[Common::KEYCODE_KP_DIVIDE])
+ currentBits |= (kRawButtonDown << kFourButtonShift);
+
+ if (_keyMap[Common::KEYCODE_q])
+ currentBits |= (kRawButtonDown << kMod1ButtonShift);
+
+ if (_keyMap[Common::KEYCODE_ESCAPE] || _keyMap[Common::KEYCODE_p])
+ currentBits |= (kRawButtonDown << kMod3ButtonShift);
+
+ if (_keyMap[Common::KEYCODE_TILDE] || _keyMap[Common::KEYCODE_BACKQUOTE] || _keyMap[Common::KEYCODE_NUMLOCK])
+ currentBits |= (kRawButtonDown << kLeftFireButtonShift);
+
+ if (_keyMap[Common::KEYCODE_BACKSPACE] || _keyMap[Common::KEYCODE_KP_MULTIPLY])
+ currentBits |= (kRawButtonDown << kRightFireButtonShift);
+
+ // Update mouse button state
+ // Note that we don't use EVENT_LBUTTONUP/EVENT_LBUTTONDOWN because
+ // they do not show if the button is being held down. We're treating
+ // both mouse buttons as the same for ease of use.
+ if (g_system->getEventManager()->getButtonState() != 0)
+ currentBits |= (kRawButtonDown << kTwoButtonShift);
+
+ // Update the mouse position too
+ input.setInputLocation(g_system->getEventManager()->getMousePos());
+
+ // Set the outgoing bits
+ InputBits filteredBits = currentBits & filter;
+ input.setInputBits((filteredBits & kAllButtonDownBits) | (filteredBits & _lastRawBits & kAllAutoBits));
+
+ // Update the last bits
+ _lastRawBits = currentBits;
+
+ // Set the console to be requested or not
+ input.setConsoleRequested(_consoleRequested);
+
+ // WORKAROUND: The original had this in currentBits, but then
+ // pressing alt would count as an event (and mess up someone
+ // trying to do alt+enter or something). Since it's only used
+ // as an easter egg, I'm just going to handle it as a separate
+ // bool value.
+ // WORKAROUND x2: I'm also accepting 'e' here since an
+ // alt+click is often intercepted by the OS. 'e' is used as the
+ // easter egg key in Buried in Time and Legacy of Time.
+ input.setAltDown(_keyMap[Common::KEYCODE_LALT] || _keyMap[Common::KEYCODE_RALT] || _keyMap[Common::KEYCODE_e]);
+}
+
+// Wait until the input device stops returning input allowed by filter...
+void InputDeviceManager::waitInput(const InputBits filter) {
+ if (filter != 0) {
+ for (;;) {
+ Input input;
+ getInput(input, filter);
+ if (!input.anyInput())
+ break;
+ }
+ }
+}
+
+bool InputDeviceManager::notifyEvent(const Common::Event &event) {
+ // We're mapping from ScummVM events to pegasus events, which
+ // are based on pippin events.
+ _consoleRequested = false;
+
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_d:
+ if (event.kbd.flags & Common::KBD_CTRL) // Console!
+ _consoleRequested = true;
+ break;
+ case Common::KEYCODE_s:
+ // We support meta where available and control elsewhere
+ if (event.kbd.flags & (Common::KBD_CTRL|Common::KBD_META))
+ ((PegasusEngine *)g_engine)->requestSave();
+ break;
+ case Common::KEYCODE_o: // o for open (original)
+ case Common::KEYCODE_l: // l for load (ScummVM terminology)
+ // We support meta where available and control elsewhere
+ if (event.kbd.flags & (Common::KBD_CTRL|Common::KBD_META))
+ ((PegasusEngine *)g_engine)->requestLoad();
+ break;
+ default:
+ // Otherwise, set the key to down if we have it
+ if (_keyMap.contains(event.kbd.keycode))
+ _keyMap[event.kbd.keycode] = true;
+ break;
+ }
+ break;
+ case Common::EVENT_KEYUP:
+ // Set the key to up if we have it
+ if (_keyMap.contains(event.kbd.keycode))
+ _keyMap[event.kbd.keycode] = false;
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+int operator==(const Input &arg1, const Input &arg2) {
+ return arg1._inputState == arg2._inputState;
+}
+
+int operator!=(const Input &arg1, const Input &arg2) {
+ return !operator==(arg1, arg2);
+}
+
+InputHandler *InputHandler::_inputHandler = 0;
+bool InputHandler::_invalHotspots = false;
+InputBits InputHandler::_lastFilter = kFilterNoInput;
+
+InputHandler *InputHandler::setInputHandler(InputHandler *currentHandler) {
+ InputHandler *result = 0;
+
+ if (_inputHandler != currentHandler && (!_inputHandler || _inputHandler->releaseInputFocus())) {
+ result = _inputHandler;
+ _inputHandler = currentHandler;
+ if (_inputHandler)
+ _inputHandler->grabInputFocus();
+ }
+
+ return result;
+}
+
+void InputHandler::pollForInput() {
+ if (_inputHandler) {
+ Input input;
+ Hotspot *cursorSpot = 0;
+
+ InputHandler::getInput(input, cursorSpot);
+ if (_inputHandler->isClickInput(input, cursorSpot))
+ _inputHandler->clickInHotspot(input, cursorSpot);
+ else
+ _inputHandler->handleInput(input, cursorSpot);
+ }
+}
+
+void InputHandler::getInput(Input &input, Hotspot *&cursorSpot) {
+ Cursor *cursor = ((PegasusEngine *)g_engine)->_cursor;
+
+ if (_inputHandler)
+ _lastFilter = _inputHandler->getInputFilter();
+ else
+ _lastFilter = kFilterAllInput;
+
+ InputDevice.getInput(input, _lastFilter);
+
+ if (_inputHandler && _inputHandler->wantsCursor() && (_lastFilter & _inputHandler->getClickFilter()) != 0) {
+ if (cursor->isVisible()) {
+ g_allHotspots.deactivateAllHotspots();
+ _inputHandler->activateHotspots();
+
+ Common::Point cursorLocation;
+ cursor->getCursorLocation(cursorLocation);
+ cursorSpot = g_allHotspots.findHotspot(cursorLocation);
+
+ if (_inputHandler)
+ _inputHandler->updateCursor(cursorLocation, cursorSpot);
+ } else {
+ cursor->hideUntilMoved();
+ }
+ } else {
+ cursor->hide();
+ }
+}
+
+void InputHandler::readInputDevice(Input &input) {
+ InputDevice.getInput(input, kFilterAllInput);
+}
+
+InputHandler::InputHandler(InputHandler *nextHandler) {
+ _nextHandler = nextHandler;
+ allowInput(true);
+}
+
+InputHandler::~InputHandler() {
+ if (_inputHandler == this)
+ setInputHandler(_nextHandler);
+}
+
+void InputHandler::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_nextHandler)
+ _nextHandler->handleInput(input, cursorSpot);
+}
+
+void InputHandler::clickInHotspot(const Input &input, const Hotspot *cursorSpot) {
+ if (_nextHandler)
+ _nextHandler->clickInHotspot(input, cursorSpot);
+}
+
+bool InputHandler::isClickInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_nextHandler)
+ return _nextHandler->isClickInput(input, cursorSpot);
+
+ return false;
+}
+
+void InputHandler::activateHotspots() {
+ if (_nextHandler)
+ _nextHandler->activateHotspots();
+}
+
+InputBits InputHandler::getInputFilter() {
+ if (_allowInput) {
+ if (_nextHandler)
+ return _nextHandler->getInputFilter();
+ else
+ return kFilterAllInput;
+ }
+
+ return kFilterNoInput;
+}
+
+InputBits InputHandler::getClickFilter() {
+ if (_allowInput && _nextHandler)
+ return _nextHandler->getClickFilter();
+
+ return kFilterNoInput;
+}
+
+void InputHandler::updateCursor(const Common::Point cursorLocation, const Hotspot *cursorSpot) {
+ if (_nextHandler)
+ _nextHandler->updateCursor(cursorLocation, cursorSpot);
+}
+
+bool InputHandler::wantsCursor() {
+ if (_allowInput) {
+ if (_nextHandler)
+ return _nextHandler->wantsCursor();
+ else
+ return true;
+ }
+
+ return false;
+}
+
+Tracker *Tracker::_currentTracker = 0;
+
+void Tracker::handleInput(const Input &input, const Hotspot *) {
+ if (stopTrackingInput(input))
+ stopTracking(input);
+ else if (isTracking())
+ continueTracking(input);
+}
+
+void Tracker::startTracking(const Input &) {
+ if (!isTracking()) {
+ _savedHandler = InputHandler::setInputHandler(this);
+ _currentTracker = this;
+ }
+}
+
+void Tracker::stopTracking(const Input &) {
+ if (isTracking()) {
+ _currentTracker = NULL;
+ InputHandler::setInputHandler(_savedHandler);
+ }
+}
+
+bool Tracker::isClickInput(const Input &input, const Hotspot *hotspot) {
+ return !isTracking() && InputHandler::isClickInput(input, hotspot);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/input.h b/engines/pegasus/input.h
new file mode 100644
index 0000000000..3e938fa42a
--- /dev/null
+++ b/engines/pegasus/input.h
@@ -0,0 +1,500 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_INPUT_H
+#define PEGASUS_INPUT_H
+
+#include "common/events.h"
+#include "common/hashmap.h"
+#include "common/rect.h"
+#include "common/singleton.h"
+
+#include "pegasus/constants.h"
+#include "pegasus/types.h"
+
+namespace Pegasus {
+
+class Hotspot;
+class Input;
+
+class InputDeviceManager : public Common::Singleton<InputDeviceManager>, public Common::EventObserver {
+public:
+ InputDeviceManager();
+ ~InputDeviceManager();
+
+ bool notifyEvent(const Common::Event &event);
+
+ void getInput(Input &, const InputBits);
+
+ void waitInput(const InputBits);
+
+protected:
+ friend class Common::Singleton<SingletonBaseType>;
+
+ // Keep track of which keys are down (= true) or not
+ Common::HashMap<uint, bool> _keyMap;
+ InputBits _lastRawBits;
+ bool _consoleRequested;
+};
+
+enum {
+ kButtonDownBit = 0,
+ kAutoButtonBit = 1,
+ kBitsPerButton = 2,
+
+ kButtonDownMask = 1 << kButtonDownBit,
+ kAutoButtonMask = 1 << kAutoButtonBit,
+
+ kButtonStateBits = kButtonDownMask | kAutoButtonMask,
+
+ kRawButtonUp = 0,
+ kRawButtonDown = kButtonDownMask | kAutoButtonMask,
+
+ kButtonUp = 0,
+ kButtonDown = kButtonDownMask,
+ kButtonAutoUp = kAutoButtonMask,
+ kButtonAutoDown = kButtonDownMask | kAutoButtonMask
+};
+
+enum {
+ kUpButtonNum = 0,
+ kLeftButtonNum = 1,
+ kDownButtonNum = 2,
+ kRightButtonNum = 3,
+ kLeftFireButtonNum = 4,
+ kRightFireButtonNum = 5,
+ kOneButtonNum = 6,
+ kTwoButtonNum = 7,
+ kThreeButtonNum = 8,
+ kFourButtonNum = 9,
+ kMod1ButtonNum = 10,
+ kMod2ButtonNum = 11,
+ kMod3ButtonNum = 12
+};
+
+enum {
+ kUpButtonShift = kUpButtonNum * kBitsPerButton,
+ kLeftButtonShift = kLeftButtonNum * kBitsPerButton,
+ kDownButtonShift = kDownButtonNum * kBitsPerButton,
+ kRightButtonShift = kRightButtonNum * kBitsPerButton,
+ kLeftFireButtonShift = kLeftFireButtonNum * kBitsPerButton,
+ kRightFireButtonShift = kRightFireButtonNum * kBitsPerButton,
+ kOneButtonShift = kOneButtonNum * kBitsPerButton,
+ kTwoButtonShift = kTwoButtonNum * kBitsPerButton,
+ kThreeButtonShift = kThreeButtonNum * kBitsPerButton,
+ kFourButtonShift = kFourButtonNum * kBitsPerButton,
+ kMod1ButtonShift = kMod1ButtonNum * kBitsPerButton,
+ kMod2ButtonShift = kMod2ButtonNum * kBitsPerButton,
+ kMod3ButtonShift = kMod3ButtonNum * kBitsPerButton
+};
+
+enum {
+ kAllUpBits = (kButtonUp << kUpButtonShift) |
+ (kButtonUp << kLeftButtonShift) |
+ (kButtonUp << kDownButtonShift) |
+ (kButtonUp << kRightButtonShift) |
+ (kButtonUp << kLeftFireButtonShift) |
+ (kButtonUp << kRightFireButtonShift) |
+ (kButtonUp << kOneButtonShift) |
+ (kButtonUp << kTwoButtonShift) |
+ (kButtonUp << kThreeButtonShift) |
+ (kButtonUp << kFourButtonShift) |
+ (kButtonUp << kMod1ButtonShift) |
+ (kButtonUp << kMod2ButtonShift) |
+ (kButtonUp << kMod3ButtonShift),
+ kDirectionBits = (kButtonDownMask << kUpButtonShift) |
+ (kButtonDownMask << kLeftButtonShift) |
+ (kButtonDownMask << kDownButtonShift) |
+ (kButtonDownMask << kRightButtonShift),
+ kButtonBits = (kButtonDownMask << kLeftFireButtonShift) |
+ (kButtonDownMask << kRightFireButtonShift) |
+ (kButtonDownMask << kOneButtonShift) |
+ (kButtonDownMask << kTwoButtonShift) |
+ (kButtonDownMask << kThreeButtonShift) |
+ (kButtonDownMask << kFourButtonShift) |
+ (kButtonDownMask << kMod1ButtonShift) |
+ (kButtonDownMask << kMod2ButtonShift) |
+ (kButtonDownMask << kMod3ButtonShift),
+ kAllButtonDownBits = kDirectionBits | kButtonBits,
+ kAllAutoBits = (kAutoButtonMask << kUpButtonShift) |
+ (kAutoButtonMask << kLeftButtonShift) |
+ (kAutoButtonMask << kDownButtonShift) |
+ (kAutoButtonMask << kRightButtonShift) |
+ (kAutoButtonMask << kLeftFireButtonShift) |
+ (kAutoButtonMask << kRightFireButtonShift) |
+ (kAutoButtonMask << kOneButtonShift) |
+ (kAutoButtonMask << kTwoButtonShift) |
+ (kAutoButtonMask << kThreeButtonShift) |
+ (kAutoButtonMask << kFourButtonShift) |
+ (kAutoButtonMask << kMod1ButtonShift) |
+ (kAutoButtonMask << kMod2ButtonShift) |
+ (kAutoButtonMask << kMod3ButtonShift),
+
+ kFilterUpButton = kButtonDownMask << kUpButtonShift,
+ kFilterUpAuto = kAutoButtonMask << kUpButtonShift,
+ kFilterUpButtonAny = kFilterUpButton | kFilterUpAuto,
+ kFilterLeftButton = kButtonDownMask << kLeftButtonShift,
+ kFilterLeftAuto = kAutoButtonMask << kLeftButtonShift,
+ kFilterLeftButtonAny = kFilterLeftButton | kFilterLeftAuto,
+ kFilterDownButton = kButtonDownMask << kDownButtonShift,
+ kFilterDownAuto = kAutoButtonMask << kDownButtonShift,
+ kFilterDownButtonAny = kFilterDownButton | kFilterDownAuto,
+ kFilterRightButton = kButtonDownMask << kRightButtonShift,
+ kFilterRightAuto = kAutoButtonMask << kRightButtonShift,
+ kFilterRightButtonAny = kFilterRightButton | kFilterRightAuto,
+ kFilterLeftFireButton = kButtonDownMask << kLeftFireButtonShift,
+ kFilterLeftFireAuto = kAutoButtonMask << kLeftFireButtonShift,
+ kFilterLeftFireButtonAny = kFilterLeftFireButton | kFilterLeftFireAuto,
+ kFilterRightFireButton = kButtonDownMask << kRightFireButtonShift,
+ kFilterRightFireAuto = kAutoButtonMask << kRightFireButtonShift,
+ kFilterRightFireButtonAny = kFilterRightFireButton | kFilterRightFireAuto,
+ kFilterOneButton = kButtonDownMask << kOneButtonShift,
+ kFilterOneAuto = kAutoButtonMask << kOneButtonShift,
+ kFilterOneButtonAny = kFilterOneButton | kFilterOneAuto,
+ kFilterTwoButton = kButtonDownMask << kTwoButtonShift,
+ kFilterTwoAuto = kAutoButtonMask << kTwoButtonShift,
+ kFilterTwoButtonAny = kFilterTwoButton | kFilterTwoAuto,
+ kFilterThreeButton = kButtonDownMask << kThreeButtonShift,
+ kFilterThreeAuto = kAutoButtonMask << kThreeButtonShift,
+ kFilterThreeButtonAny = kFilterThreeButton | kFilterThreeAuto,
+ kFilterFourButton = kButtonDownMask << kFourButtonShift,
+ kFilterFourAuto = kAutoButtonMask << kFourButtonShift,
+ kFilterFourButtonAny = kFilterFourButton | kFilterFourAuto,
+ kFilterMod1Button = kButtonDownMask << kMod1ButtonShift,
+ kFilterMod1Auto = kAutoButtonMask << kMod1ButtonShift,
+ kFilterMod1ButtonAny = kFilterMod1Button | kFilterMod1Auto,
+ kFilterMod2Button = kButtonDownMask << kMod2ButtonShift,
+ kFilterMod2Auto = kAutoButtonMask << kMod2ButtonShift,
+ kFilterMod2ButtonAny = kFilterMod2Button | kFilterMod2Auto,
+ kFilterMod3Button = kButtonDownMask << kMod3ButtonShift,
+ kFilterMod3Auto = kAutoButtonMask << kMod3ButtonShift,
+ kFilterMod3ButtonAny = kFilterMod3Button | kFilterMod3Auto,
+
+ kFilterNoInput = 0,
+ kFilterAllInput = kFilterUpButton |
+ kFilterUpAuto |
+ kFilterLeftButton |
+ kFilterLeftAuto |
+ kFilterDownButton |
+ kFilterDownAuto |
+ kFilterRightButton |
+ kFilterRightAuto |
+ kFilterLeftFireButton |
+ kFilterLeftFireAuto |
+ kFilterRightFireButton |
+ kFilterRightFireAuto |
+ kFilterOneButton |
+ kFilterOneAuto |
+ kFilterTwoButton |
+ kFilterTwoAuto |
+ kFilterThreeButton |
+ kFilterThreeAuto |
+ kFilterFourButton |
+ kFilterFourAuto |
+ kFilterMod1Button |
+ kFilterMod1Auto |
+ kFilterMod2Button |
+ kFilterMod2Auto |
+ kFilterMod3Button |
+ kFilterMod3Auto,
+
+ kFilterAllDirections = kFilterUpButton |
+ kFilterUpAuto |
+ kFilterLeftButton |
+ kFilterLeftAuto |
+ kFilterDownButton |
+ kFilterDownAuto |
+ kFilterRightButton |
+ kFilterRightAuto,
+
+ kFilterButtons = kFilterOneButton |
+ kFilterOneAuto |
+ kFilterTwoButton |
+ kFilterTwoAuto |
+ kFilterThreeButton |
+ kFilterThreeAuto |
+ kFilterFourButton |
+ kFilterFourAuto,
+
+ kFilterFireButtons = kFilterLeftFireButton |
+ kFilterLeftFireAuto |
+ kFilterRightFireButton |
+ kFilterRightFireAuto,
+
+ kFilterAllButtons = kFilterLeftFireButton |
+ kFilterLeftFireAuto |
+ kFilterRightFireButton |
+ kFilterRightFireAuto |
+ kFilterOneButton |
+ kFilterOneAuto |
+ kFilterTwoButton |
+ kFilterTwoAuto |
+ kFilterThreeButton |
+ kFilterThreeAuto |
+ kFilterFourButton |
+ kFilterFourAuto |
+ kFilterMod1Button |
+ kFilterMod1Auto |
+ kFilterMod2Button |
+ kFilterMod2Auto |
+ kFilterMod3Button |
+ kFilterMod3Auto,
+
+ kFilterAllInputNoAuto = kFilterUpButton |
+ kFilterLeftButton |
+ kFilterDownButton |
+ kFilterRightButton |
+ kFilterLeftFireButton |
+ kFilterRightFireButton |
+ kFilterOneButton |
+ kFilterTwoButton |
+ kFilterThreeButton |
+ kFilterFourButton |
+ kFilterMod1Button |
+ kFilterMod2Button |
+ kFilterMod3Button
+};
+
+static const InputBits kHintInterruption = kFilterAllInputNoAuto;
+static const InputBits kWarningInterruption = kFilterNoInput;
+static const InputBits kOpticalInterruption = kFilterAllInputNoAuto;
+
+/*
+
+ Buttons are defined as:
+ up, left, down, right direction buttons.
+ fireLeft, fireRight: fire buttons.
+ mod1, mod2, mod3: modifier buttons, similar to shift, control, etc.
+ a, b, c, d: general purpose buttons.
+
+ button state is held as bits in a long word, two bits per button.
+
+ Filter bits:
+ for each button, two bits are assigned for filtering. If bit 0 is set, the
+ corresponding button is available for "button down" input. If bit 1 is set,
+ the corresponding button is available for "auto down" input. Note that bit
+ 1 is meaningful only if bit 0 is set.
+
+*/
+
+class Input {
+friend int operator==(const Input &, const Input &);
+friend int operator!=(const Input &, const Input &);
+friend class InputDeviceManager;
+
+public:
+ Input() { clearInput(); }
+
+ bool upButtonDown() const { return (_inputState & (kButtonStateBits << kUpButtonShift)) == (kButtonDown << kUpButtonShift); }
+ bool upButtonAutoDown() const { return (_inputState & (kButtonStateBits << kUpButtonShift)) == (kButtonAutoDown << kUpButtonShift); }
+ bool upButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kUpButtonShift)) != 0; }
+
+ bool leftButtonDown() const { return (_inputState & (kButtonStateBits << kLeftButtonShift)) == (kButtonDown << kLeftButtonShift); }
+ bool leftButtonAutoDown() const { return (_inputState & (kButtonStateBits << kLeftButtonShift)) == (kButtonAutoDown << kLeftButtonShift); }
+ bool leftButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kLeftButtonShift)) != 0; }
+
+ bool downButtonDown() const { return (_inputState & (kButtonStateBits << kDownButtonShift)) == (kButtonDown << kDownButtonShift); }
+ bool downButtonAutoDown() const { return (_inputState & (kButtonStateBits << kDownButtonShift)) == (kButtonAutoDown << kDownButtonShift); }
+ bool downButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kDownButtonShift)) != 0; }
+
+ bool rightButtonDown() const { return (_inputState & (kButtonStateBits << kRightButtonShift)) == (kButtonDown << kRightButtonShift); }
+ bool rightButtonAutoDown() const { return (_inputState & (kButtonStateBits << kRightButtonShift)) == (kButtonAutoDown << kRightButtonShift); }
+ bool rightButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kRightButtonShift)) != 0; }
+
+ bool leftFireButtonDown() const { return (_inputState & (kButtonStateBits << kLeftFireButtonShift)) == (kButtonDown << kLeftFireButtonShift); }
+ bool leftFireButtonAutoDown() const { return (_inputState & (kButtonStateBits << kLeftFireButtonShift)) == (kButtonAutoDown << kLeftFireButtonShift); }
+ bool leftFireButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kLeftFireButtonShift)) != 0; }
+
+ bool rightFireButtonDown() const { return (_inputState & (kButtonStateBits << kRightFireButtonShift)) == (kButtonDown << kRightFireButtonShift); }
+ bool rightFireButtonAutoDown() const { return (_inputState & (kButtonStateBits << kRightFireButtonShift)) == (kButtonAutoDown << kRightFireButtonShift); }
+ bool rightFireButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kRightFireButtonShift)) != 0; }
+
+ bool oneButtonDown() const { return (_inputState & (kButtonStateBits << kOneButtonShift)) == (kButtonDown << kOneButtonShift); }
+ bool oneButtonAutoDown() const { return (_inputState & (kButtonStateBits << kOneButtonShift)) == (kButtonAutoDown << kOneButtonShift); }
+ bool oneButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kOneButtonShift)) != 0; }
+
+ bool twoButtonDown() const { return (_inputState & (kButtonStateBits << kTwoButtonShift)) == (kButtonDown << kTwoButtonShift); }
+ bool twoButtonAutoDown() const { return (_inputState & (kButtonStateBits << kTwoButtonShift)) == (kButtonAutoDown << kTwoButtonShift); }
+ bool twoButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kTwoButtonShift)) != 0; }
+
+ bool threeButtonDown() const { return (_inputState & (kButtonStateBits << kThreeButtonShift)) == (kButtonDown << kThreeButtonShift); }
+ bool threeButtonAutoDown() const { return (_inputState & (kButtonStateBits << kThreeButtonShift)) == (kButtonAutoDown << kThreeButtonShift); }
+ bool threeButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kThreeButtonShift)) != 0; }
+
+ bool fourButtonDown() const { return (_inputState & (kButtonStateBits << kFourButtonShift)) == (kButtonDown << kFourButtonShift); }
+ bool fourButtonAutoDown() const { return (_inputState & (kButtonStateBits << kFourButtonShift)) == (kButtonAutoDown << kFourButtonShift); }
+ bool fourButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kFourButtonShift)) != 0; }
+
+ bool mod1ButtonDown() const { return (_inputState & (kButtonStateBits << kMod1ButtonShift)) == (kButtonDown << kMod1ButtonShift); }
+ bool mod1ButtonAutoDown() const { return (_inputState & (kButtonStateBits << kMod1ButtonShift)) == (kButtonAutoDown << kMod1ButtonShift); }
+ bool mod1ButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kMod1ButtonShift)) != 0; }
+
+ bool mod2ButtonDown() const { return (_inputState & (kButtonStateBits << kMod2ButtonShift)) == (kButtonDown << kMod2ButtonShift); }
+ bool mod2ButtonAutoDown() const { return (_inputState & (kButtonStateBits << kMod2ButtonShift)) == (kButtonAutoDown << kMod2ButtonShift); }
+ bool mod2ButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kMod2ButtonShift)) != 0; }
+
+ bool mod3ButtonDown() const { return (_inputState & (kButtonStateBits << kMod3ButtonShift)) == (kButtonDown << kMod3ButtonShift); }
+ bool mod3ButtonAutoDown() const { return (_inputState & (kButtonStateBits << kMod3ButtonShift)) == (kButtonAutoDown << kMod3ButtonShift); }
+ bool mod3ButtonAnyDown() const { return (_inputState & (kButtonAutoDown << kMod3ButtonShift)) != 0; }
+
+ bool allAutoInput() const { return (_inputState & kAllAutoBits) != 0; }
+ bool anyDirectionInput() const { return (_inputState & kDirectionBits) != 0; }
+ bool anyButtonInput() const { return (_inputState & kButtonBits) != 0; }
+ bool anyInput() const { return _inputState != 0; }
+
+ void getInputLocation(Common::Point &where) const { where = _inputLocation; }
+
+ bool anyInputBitSet(const InputBits bits) const { return (_inputState & bits) != 0; }
+
+ bool isAltDown() const { return _altDown; }
+ bool isConsoleRequested() const { return _consoleRequested; }
+
+ void clearInput() {
+ _inputState = kAllUpBits;
+ _inputLocation.x = 0;
+ _inputLocation.y = 0;
+ _consoleRequested = false;
+ _altDown = false;
+ }
+
+protected:
+ void setInputBits(const InputBits state) { _inputState = state; }
+ void setInputLocation(const Common::Point &where) { _inputLocation = where; }
+ void setConsoleRequested(bool consoleRequested) { _consoleRequested = consoleRequested; }
+ void setAltDown(bool altDown) { _altDown = altDown; }
+
+ InputBits _inputState;
+ Common::Point _inputLocation;
+ bool _consoleRequested;
+ bool _altDown;
+};
+
+class InputHandler {
+public:
+ static InputHandler *setInputHandler(InputHandler*);
+ static InputHandler *getCurrentHandler() { return _inputHandler; }
+ static void pollForInput();
+ static void getInput(Input&, Hotspot*&);
+ static void readInputDevice(Input&);
+ static void invalHotspots() { _invalHotspots = true; }
+ static InputBits getCurrentFilter() { return _lastFilter; }
+
+ InputHandler(InputHandler*);
+ virtual ~InputHandler();
+
+ virtual void setNextHandler(InputHandler *nextHandler) { _nextHandler = nextHandler; }
+ virtual InputHandler *getNextHandler() { return _nextHandler; }
+
+ virtual void handleInput(const Input &, const Hotspot *);
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual void activateHotspots();
+ virtual void updateCursor(const Common::Point, const Hotspot *);
+ virtual bool isClickInput(const Input &, const Hotspot *);
+ virtual bool wantsCursor();
+
+ virtual bool releaseInputFocus() { return true; }
+ virtual void grabInputFocus() {}
+
+ // This returns bits set for what kinds of input to accept.
+ virtual InputBits getInputFilter();
+
+ // This returns bits defining what input constitutes a "click."
+ virtual InputBits getClickFilter();
+
+ virtual void allowInput(const bool allow) { _allowInput = allow; }
+
+protected:
+ static InputHandler *_inputHandler;
+ static bool _invalHotspots;
+ static InputBits _lastFilter;
+
+ InputHandler *_nextHandler;
+ bool _allowInput;
+};
+
+
+/*
+
+ Tracker implements "dragging". A Tracker can receive a startTracking message,
+ which causes it to be the current tracker, as well as setting it up as the current
+ input handler. In addition, only one tracker can be tracking at a time, and no
+ other handler can be set up as the current handler until the track finishes. By
+ default, there is no next input handler for a Tracker, but this behavior can be
+ overridden if desired.
+
+*/
+
+class Tracker : public InputHandler {
+public:
+ Tracker() : InputHandler(0) {}
+ virtual ~Tracker() {}
+
+ virtual void handleInput(const Input &, const Hotspot *);
+ virtual bool stopTrackingInput(const Input &) { return false; }
+
+ virtual void startTracking(const Input &);
+ virtual void stopTracking(const Input &);
+ virtual void continueTracking(const Input &) {}
+
+ bool isTracking() { return this == _currentTracker; }
+ bool isClickInput(const Input &, const Hotspot *);
+
+ bool releaseInputFocus() { return !isTracking(); }
+
+protected:
+ static Tracker *_currentTracker;
+
+ InputHandler *_savedHandler;
+};
+
+class JMPPPInput {
+public:
+ static bool isMenuButtonPressInput(const Input &input) { return input.twoButtonDown(); }
+
+ static InputBits getClickInputFilter() { return kFilterTwoButton; }
+ static bool isClickInput(const Input &input) { return input.twoButtonDown(); }
+ static bool isDraggingInput(const Input &input) { return input.twoButtonAnyDown(); }
+ static bool isPressingInput(const Input &input) { return input.twoButtonAnyDown(); }
+
+ static bool isRaiseInventoryInput(const Input &input) { return input.leftFireButtonDown(); }
+ static bool isRaiseBiochipsInput(const Input &input) { return input.rightFireButtonDown(); }
+ static InputBits getItemPanelsInputFilter() { return kFilterLeftFireButton | kFilterRightFireButton; }
+
+ static bool isToggleAIMiddleInput(const Input &input) { return input.threeButtonDown(); }
+
+ static bool isToggleInfoInput(const Input &input) { return input.fourButtonDown(); }
+
+ // Hmmmmm....
+ static bool isEasterEggModifierInput(const Input &input) { return input.isAltDown(); }
+
+ static bool isTogglePauseInput(const Input &input) { return input.mod3ButtonDown(); }
+};
+
+} // End of namespace Pegasus
+
+#define InputDevice (::Pegasus::InputDeviceManager::instance())
+
+#endif
diff --git a/engines/pegasus/interaction.h b/engines/pegasus/interaction.h
new file mode 100644
index 0000000000..293ee6be83
--- /dev/null
+++ b/engines/pegasus/interaction.h
@@ -0,0 +1,110 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_INTERACTION_H
+#define PEGASUS_INTERACTION_H
+
+#include "pegasus/input.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+static const InteractionID kNoInteractionID = -1;
+
+class Neighborhood;
+
+class GameInteraction : public IDObject, public InputHandler {
+public:
+ GameInteraction(const InteractionID id, Neighborhood *nextHandler) : IDObject(id), InputHandler((InputHandler *)nextHandler) {
+ _isInteracting = false;
+ _savedHandler = 0;
+ _owner = nextHandler;
+ }
+
+ // If the interaction is open (_isInteracting == true), it's too late to do anything
+ // about it here.
+ virtual ~GameInteraction() {}
+
+ // startInteraction and stopInteraction are called by the outside world to
+ // start and stop the interaction sequence.
+ // isInteracting returns a bool indicating whether or not the interaction
+ // is going.
+ void startInteraction() {
+ if (!isInteracting()) {
+ openInteraction();
+ initInteraction();
+ _isInteracting = true;
+ _savedHandler = InputHandler::setInputHandler(this);
+ }
+ }
+ void stopInteraction() {
+ if (isInteracting()) {
+ closeInteraction();
+ _isInteracting = false;
+ if (InputHandler::_inputHandler == this)
+ InputHandler::setInputHandler(_savedHandler);
+ }
+ }
+ void startOverInteraction() {
+ if (isInteracting())
+ resetInteraction();
+ }
+ bool isInteracting() const { return _isInteracting; }
+ Neighborhood *getOwner() const { return _owner; }
+
+ virtual Common::String getBriefingMovie() { return ""; }
+ virtual Common::String getEnvScanMovie() { return ""; }
+ virtual long getNumHints() { return 0; }
+ virtual Common::String getHintMovie(uint) { return ""; }
+ virtual bool canSolve() { return false; }
+
+ virtual void setSoundFXLevel(const uint16) {}
+ virtual void setAmbienceLevel(const uint16) {}
+
+ virtual void doSolve() {}
+
+protected:
+ // Subclasses override openInteraction and closeInteraction to perform
+ // specific initialization and cleanup. Override resetInteraction to
+ // "start the interaction over." resetInteraction is called only when
+ // the interaction is already open.
+ // These functions are only called in pairs, never two opens or closes
+ // in a row.
+ virtual void openInteraction() {}
+ virtual void initInteraction() {}
+ virtual void closeInteraction() {}
+ virtual void resetInteraction() {}
+
+ InputHandler *_savedHandler;
+ Neighborhood *_owner;
+
+private:
+ // Private so that only StartInteraction and StopInteraction can touch it.
+ bool _isInteracting;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/interface.cpp b/engines/pegasus/interface.cpp
new file mode 100644
index 0000000000..d9d3865192
--- /dev/null
+++ b/engines/pegasus/interface.cpp
@@ -0,0 +1,667 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/compass.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/interface.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+Interface *g_interface = 0;
+
+Interface::Interface() : InputHandler(0), _interfaceNotification(kInterfaceNotificationID, (NotificationManager *)((PegasusEngine *)g_engine)),
+ _currentItemSpot(kCurrentItemSpotID), _currentBiochipSpot(kCurrentBiochipSpotID),
+ _background1(kInterface1ID), _background2(kInterface2ID), _background3(kInterface3ID),
+ _background4(kInterface4ID), _datePicture(kDateID), _inventoryPush(kInventoryPushID),
+ _inventoryLid(kInventoryLidID, kNoDisplayElement),
+ _inventoryPanel(kNoDisplayElement, (InputHandler *)((PegasusEngine *)g_engine), ((PegasusEngine *)g_engine)->getItemsInventory()),
+ _biochipPush(kBiochipPushID), _biochipLid(kBiochipLidID, kNoDisplayElement),
+ _biochipPanel(kNoDisplayElement, (InputHandler *)((PegasusEngine *)g_engine), ((PegasusEngine *)g_engine)->getBiochipsInventory()) {
+ g_energyMonitor = 0;
+ _previousHandler = 0;
+ _inventoryRaised = false;
+ _biochipRaised = false;
+ _playingEndMessage = false;
+ g_interface = this;
+}
+
+Interface::~Interface() {
+ throwAwayInterface();
+ g_interface = 0;
+}
+
+void Interface::throwAwayInterface() {
+ g_allHotspots.removeOneHotspot(kCurrentItemSpotID);
+ g_allHotspots.removeOneHotspot(kCurrentBiochipSpotID);
+
+ throwAwayBackground();
+ throwAwayDateMonitor();
+ throwAwayEnergyMonitor();
+ throwAwayAIArea();
+ throwAwayCompass();
+ throwAwayNotifications();
+ throwAwayInventoryPanel();
+ throwAwayBiochipPanel();
+}
+
+void Interface::validateBackground() {
+ if (!_background1.isSurfaceValid()) {
+ _background1.initFromPICTFile("Images/Interface/3DInterface Left");
+ _background2.initFromPICTFile("Images/Interface/3DInterface Top");
+ _background3.initFromPICTFile("Images/Interface/3DInterface Right");
+ _background4.initFromPICTFile("Images/Interface/3DInterface Bottom");
+
+ _background1.setDisplayOrder(kBackground1Order);
+ _background1.startDisplaying();
+ _background1.moveElementTo(kBackground1Left, kBackground1Top);
+
+ _background2.setDisplayOrder(kBackground2Order);
+ _background2.startDisplaying();
+ _background2.moveElementTo(kBackground2Left, kBackground2Top);
+
+ _background3.setDisplayOrder(kBackground2Order);
+ _background3.startDisplaying();
+ _background3.moveElementTo(kBackground3Left, kBackground3Top);
+
+ _background4.setDisplayOrder(kBackground4Order);
+ _background4.startDisplaying();
+ _background4.moveElementTo(kBackground4Left, kBackground4Top);
+
+ _background1.show();
+ _background2.show();
+ _background3.show();
+ _background4.show();
+ }
+}
+
+void Interface::throwAwayBackground() {
+ _background1.stopDisplaying();
+ _background1.deallocateSurface();
+ _background2.stopDisplaying();
+ _background2.deallocateSurface();
+ _background3.stopDisplaying();
+ _background3.deallocateSurface();
+ _background4.stopDisplaying();
+ _background4.deallocateSurface();
+}
+
+void Interface::validateDateMonitor() {
+ if (!_datePicture.isSurfaceValid()) {
+ _datePicture.setDisplayOrder(kDateOrder);
+ _datePicture.startDisplaying();
+ _datePicture.moveElementTo(kDateLeft, kDateTop);
+ _datePicture.show();
+ }
+}
+
+void Interface::throwAwayDateMonitor() {
+ _datePicture.stopDisplaying();
+ _datePicture.deallocateSurface();
+}
+
+void Interface::setDate(const uint16 dateResID) {
+ validateDateMonitor();
+ _datePicture.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, dateResID);
+ _datePicture.triggerRedraw();
+}
+
+void Interface::validateCompass() {
+ if (!g_compass) {
+ new Compass();
+ g_compass->initCompass();
+ g_compass->setDisplayOrder(kCompassOrder);
+ g_compass->startDisplaying();
+ g_compass->moveElementTo(kCompassLeft, kCompassTop);
+ g_compass->show();
+ }
+}
+
+void Interface::throwAwayCompass() {
+ delete g_compass;
+}
+
+void Interface::validateNotifications() {
+ _interfaceNotification.notifyMe(this, kInterfaceNotificationFlags, kInterfaceNotificationFlags);
+ _inventoryLidCallBack.setNotification(&_interfaceNotification);
+ _inventoryPushCallBack.setNotification(&_interfaceNotification);
+ _biochipLidCallBack.setNotification(&_interfaceNotification);
+ _biochipPushCallBack.setNotification(&_interfaceNotification);
+}
+
+void Interface::throwAwayNotifications() {
+ _interfaceNotification.cancelNotification(this);
+}
+
+void Interface::validateAIArea() {
+ if (!g_AIArea) {
+ new AIArea((InputHandler *)((PegasusEngine *)g_engine));
+ if (g_AIArea)
+ g_AIArea->initAIArea();
+ }
+}
+
+void Interface::throwAwayAIArea() {
+ delete g_AIArea;
+}
+
+void Interface::validateInventoryPanel() {
+ if (!_inventoryPanel.isSurfaceValid()) {
+ _inventoryPanel.initInventoryImage(&_inventoryPush);
+ _inventoryPanel.moveElementTo(kInventoryPushLeft, kInventoryPushTop);
+ _inventoryPush.setSlideDirection(kSlideUpMask);
+ _inventoryPush.setInAndOutElements(&_inventoryPanel, 0);
+ _inventoryPush.setDisplayOrder(kInventoryPushOrder);
+ _inventoryPush.startDisplaying();
+
+ _inventoryLid.useFileName("Images/Lids/Inventory Lid Sequence");
+ _inventoryLid.useTransparent(true);
+ _inventoryLid.openFrameSequence();
+ _inventoryLid.moveElementTo(kInventoryLidLeft, kInventoryLidTop);
+ _inventoryLid.setDisplayOrder(kInventoryLidOrder);
+ _inventoryLid.startDisplaying();
+
+ _inventoryPushCallBack.initCallBack(&_inventoryPush, kCallBackAtExtremes);
+ _inventoryLidCallBack.initCallBack(&_inventoryLid, kCallBackAtExtremes);
+
+ _inventoryUp = false;
+ _inventoryRaised = false;
+
+ Item *item = getCurrentInventoryItem();
+ if (item)
+ item->select();
+ }
+}
+
+void Interface::throwAwayInventoryPanel() {
+ _inventoryPanel.stopDisplaying();
+ _inventoryPanel.throwAwayInventoryImage();
+ _inventoryPush.stopDisplaying();
+ _inventoryLid.stopDisplaying();
+ _inventoryLid.closeFrameSequence();
+ _inventoryPushCallBack.releaseCallBack();
+ _inventoryLidCallBack.releaseCallBack();
+
+ Item *item = getCurrentInventoryItem();
+ if (item)
+ item->deselect();
+
+ _inventoryUp = false;
+ _inventoryRaised = false;
+}
+
+void Interface::validateBiochipPanel() {
+ if (!_biochipPanel.isSurfaceValid()) {
+ _biochipPanel.initInventoryImage(&_biochipPush);
+ _biochipPanel.moveElementTo(kBiochipPushLeft, kBiochipPushTop);
+ _biochipPush.setSlideDirection(kSlideUpMask);
+ _biochipPush.setInAndOutElements(&_biochipPanel, 0);
+ _biochipPush.setDisplayOrder(kBiochipPushOrder);
+ _biochipPush.startDisplaying();
+
+ _biochipLid.useFileName("Images/Lids/Biochip Lid Sequence");
+ _biochipLid.useTransparent(true);
+ _biochipLid.openFrameSequence();
+ _biochipLid.moveElementTo(kBiochipLidLeft, kBiochipLidTop);
+ _biochipLid.setDisplayOrder(kBiochipLidOrder);
+ _biochipLid.startDisplaying();
+
+ _biochipPushCallBack.initCallBack(&_biochipPush, kCallBackAtExtremes);
+ _biochipLidCallBack.initCallBack(&_biochipLid, kCallBackAtExtremes);
+
+ _biochipUp = false;
+ _biochipRaised = false;
+
+ Item *item = getCurrentBiochip();
+ if (item)
+ item->select();
+ }
+}
+
+void Interface::throwAwayBiochipPanel() {
+ _biochipPanel.stopDisplaying();
+ _biochipPanel.throwAwayInventoryImage();
+ _biochipPush.stopDisplaying();
+ _biochipLid.stopDisplaying();
+ _biochipLid.closeFrameSequence();
+ _biochipPushCallBack.releaseCallBack();
+ _biochipLidCallBack.releaseCallBack();
+
+ Item *item = getCurrentBiochip();
+ if (item)
+ item->deselect();
+
+ _biochipUp = false;
+ _biochipRaised = false;
+}
+
+void Interface::validateEnergyMonitor() {
+ if (!g_energyMonitor)
+ new EnergyMonitor();
+}
+
+void Interface::throwAwayEnergyMonitor() {
+ delete g_energyMonitor;
+}
+
+void Interface::createInterface() {
+ validateBackground();
+ validateDateMonitor();
+ validateCompass();
+ validateNotifications();
+ validateAIArea();
+ validateBiochipPanel();
+ validateInventoryPanel();
+ validateEnergyMonitor();
+
+ if (!g_allHotspots.findHotspotByID(kCurrentItemSpotID)) {
+ _currentItemSpot.setArea(Common::Rect(76, 334, 172, 430));
+ _currentItemSpot.setHotspotFlags(kShellSpotFlag);
+ _currentItemSpot.setActive();
+ g_allHotspots.push_back(&_currentItemSpot);
+ }
+
+ if (!g_allHotspots.findHotspotByID(kCurrentBiochipSpotID)) {
+ _currentBiochipSpot.setArea(Common::Rect(364, 334, 460, 430));
+ _currentBiochipSpot.setHotspotFlags(kShellSpotFlag);
+ _currentBiochipSpot.setActive();
+ g_allHotspots.push_back(&_currentBiochipSpot);
+ }
+}
+
+InventoryResult Interface::addInventoryItem(InventoryItem *item) {
+ return _inventoryPanel.addInventoryItem(item);
+}
+
+InventoryResult Interface::removeInventoryItem(InventoryItem *item) {
+ return _inventoryPanel.removeInventoryItem(item);
+}
+
+void Interface::removeAllItemsFromInventory() {
+ _inventoryPanel.removeAllItems();
+}
+
+InventoryItem *Interface::getCurrentInventoryItem() {
+ return (InventoryItem *)_inventoryPanel.getCurrentItem();
+}
+
+void Interface::setCurrentInventoryItem(InventoryItem *item) {
+ setCurrentInventoryItemID(item->getObjectID());
+}
+
+void Interface::setCurrentInventoryItemID(ItemID id) {
+ _inventoryPanel.setCurrentItemID(id);
+}
+
+InventoryResult Interface::addBiochip(BiochipItem *item) {
+ return _biochipPanel.addInventoryItem(item);
+}
+
+void Interface::removeAllItemsFromBiochips() {
+ _biochipPanel.removeAllItems();
+}
+
+BiochipItem *Interface::getCurrentBiochip() {
+ return (BiochipItem *)_biochipPanel.getCurrentItem();
+}
+
+void Interface::setCurrentBiochip(BiochipItem *item) {
+ setCurrentBiochipID(item->getObjectID());
+}
+
+void Interface::setCurrentBiochipID(ItemID id) {
+ _biochipPanel.setCurrentItemID(id);
+}
+
+void Interface::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ if (notification == &_interfaceNotification) {
+ switch (flags) {
+ case kInventoryLidOpenFlag:
+ inventoryLidOpen(true);
+ break;
+ case kInventoryLidClosedFlag:
+ inventoryLidClosed();
+ break;
+ case kInventoryDrawerUpFlag:
+ inventoryDrawerUp();
+ break;
+ case kInventoryDrawerDownFlag:
+ inventoryDrawerDown(true);
+ break;
+ case kBiochipLidOpenFlag:
+ biochipLidOpen(true);
+ break;
+ case kBiochipLidClosedFlag:
+ biochipLidClosed();
+ break;
+ case kBiochipDrawerUpFlag:
+ biochipDrawerUp();
+ break;
+ case kBiochipDrawerDownFlag:
+ biochipDrawerDown(true);
+ break;
+ }
+ }
+}
+
+void Interface::raiseInventoryDrawer(const bool doCallBacks) {
+ if (!_biochipUp)
+ _previousHandler = InputHandler::getCurrentHandler();
+
+ InputHandler::setInputHandler(&_inventoryPanel);
+ _inventoryUp = true;
+ _inventoryPanel.activateInventoryPicture();
+
+ if (doCallBacks) {
+ _inventoryLidCallBack.setCallBackFlag(kInventoryLidOpenFlag);
+ _inventoryLidCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ _inventoryLid.show();
+ _inventoryPush.show();
+ _inventoryLid.start();
+}
+
+void Interface::playEndMessage() {
+ raiseInventoryDrawerForMessage();
+ _playingEndMessage = true;
+ _inventoryPanel.playEndMessage(&_inventoryPush);
+ lowerInventoryDrawerForMessage();
+ _playingEndMessage = false;
+}
+
+void Interface::raiseInventoryDrawerForMessage() {
+ _inventoryPanel.disableLooping();
+ raiseInventoryDrawerSync();
+}
+
+void Interface::lowerInventoryDrawerForMessage() {
+ lowerInventoryDrawerSync();
+}
+
+void Interface::inventoryLidOpen(const bool doCallBacks) {
+ _inventoryLid.stop();
+
+ if (doCallBacks) {
+ _inventoryPushCallBack.setCallBackFlag(kInventoryDrawerUpFlag);
+ _inventoryPushCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(60, 0, 0, 15, 1000);
+ _inventoryPush.startFader(moveSpec);
+}
+
+void Interface::inventoryDrawerUp() {
+ _inventoryPush.stopFader();
+ _inventoryPanel.panelUp();
+ _inventoryRaised = true;
+}
+
+bool Interface::isInventoryUp() {
+ return _inventoryRaised;
+}
+
+bool Interface::isInventoryDown() {
+ return !_inventoryUp;
+}
+
+void Interface::lowerInventoryDrawer(const bool doCallBacks) {
+ if (_inventoryRaised) {
+ _inventoryRaised = false;
+
+ if (!_playingEndMessage)
+ _inventoryPanel.deactivateInventoryPicture();
+
+ if (doCallBacks) {
+ _inventoryPushCallBack.setCallBackFlag(kInventoryDrawerDownFlag);
+ _inventoryPushCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(60, 0, 1000, 15, 0);
+ _inventoryPush.startFader(moveSpec);
+ }
+}
+
+void Interface::inventoryDrawerDown(const bool doCallBacks) {
+ _inventoryPush.stopFader();
+
+ if (doCallBacks) {
+ _inventoryLidCallBack.setCallBackFlag(kInventoryLidClosedFlag);
+ _inventoryLidCallBack.scheduleCallBack(kTriggerAtStart, 0, 0);
+ }
+
+ _inventoryLid.setRate(-1);
+}
+
+void Interface::inventoryLidClosed() {
+ _inventoryLid.stop();
+
+ if (!_biochipUp)
+ InputHandler::setInputHandler(_previousHandler);
+
+ _inventoryLid.hide();
+ _inventoryPush.hide();
+ _inventoryUp = false;
+}
+
+void Interface::raiseBiochipDrawer(const bool doCallBacks) {
+ if (!_inventoryUp)
+ _previousHandler = InputHandler::getCurrentHandler();
+
+ InputHandler::setInputHandler(&_biochipPanel);
+ _biochipUp = true;
+ _biochipPanel.activateInventoryPicture();
+
+ if (doCallBacks) {
+ _biochipLidCallBack.setCallBackFlag(kBiochipLidOpenFlag);
+ _biochipLidCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ _biochipLid.show();
+ _biochipPush.show();
+ _biochipLid.start();
+}
+
+void Interface::biochipLidOpen(const bool doCallBacks) {
+ _biochipLid.stop();
+
+ if (doCallBacks) {
+ _biochipPushCallBack.setCallBackFlag(kBiochipDrawerUpFlag);
+ _biochipPushCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(60, 0, 0, 9, 1000);
+ _biochipPush.startFader(moveSpec);
+}
+
+void Interface::biochipDrawerUp() {
+ _biochipPush.stopFader();
+ _biochipPanel.panelUp();
+ _biochipRaised = true;
+}
+
+void Interface::lowerBiochipDrawer(const bool doCallBacks) {
+ if (_biochipRaised) {
+ _biochipRaised = false;
+ _biochipPanel.deactivateInventoryPicture();
+
+ if (doCallBacks) {
+ _biochipPushCallBack.setCallBackFlag(kBiochipDrawerDownFlag);
+ _biochipPushCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(60, 0, 1000, 9, 0);
+ _biochipPush.startFader(moveSpec);
+ }
+}
+
+void Interface::biochipDrawerDown(const bool doCallBacks) {
+ _biochipPush.stopFader();
+
+ if (doCallBacks) {
+ _biochipLidCallBack.setCallBackFlag(kBiochipLidClosedFlag);
+ _biochipLidCallBack.scheduleCallBack(kTriggerAtStart, 0, 0);
+ }
+
+ _biochipLid.setRate(-1);
+}
+
+void Interface::biochipLidClosed() {
+ _biochipLid.stop();
+
+ if (!_inventoryUp)
+ InputHandler::setInputHandler(_previousHandler);
+
+ _biochipLid.hide();
+ _biochipPush.hide();
+ _biochipUp = false;
+}
+
+void Interface::calibrateCompass() {
+ uint32 currentValue = g_compass->getFaderValue();
+ FaderMoveSpec compassMove;
+ compassMove.makeTwoKnotFaderSpec(15, 0, currentValue, 30, currentValue + 360);
+
+ g_compass->startFader(compassMove);
+
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ while (g_compass->isFading()) {
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ g_compass->setFaderValue(currentValue);
+}
+
+void Interface::calibrateEnergyBar() {
+ g_energyMonitor->calibrateEnergyBar();
+}
+
+void Interface::raiseInventoryDrawerSync() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ raiseInventoryDrawer(false);
+
+ while (_inventoryLid.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ inventoryLidOpen(false);
+
+ while (_inventoryPush.isFading()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ inventoryDrawerUp();
+}
+
+void Interface::lowerInventoryDrawerSync() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ lowerInventoryDrawer(false);
+
+ while (_inventoryPush.isFading()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ inventoryDrawerDown(false);
+
+ while (_inventoryLid.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ inventoryLidClosed();
+}
+
+void Interface::raiseBiochipDrawerSync() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ raiseBiochipDrawer(false);
+
+ while (_biochipLid.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ biochipLidOpen(false);
+
+ while (_biochipPush.isFading()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ biochipDrawerUp();
+}
+
+void Interface::lowerBiochipDrawerSync() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ lowerBiochipDrawer(false);
+
+ while (_biochipPush.isFading()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ biochipDrawerDown(false);
+
+ while (_biochipLid.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ vm->refreshDisplay();
+ biochipLidClosed();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/interface.h b/engines/pegasus/interface.h
new file mode 100644
index 0000000000..a65d9a595a
--- /dev/null
+++ b/engines/pegasus/interface.h
@@ -0,0 +1,148 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_INTERFACE_H
+#define PEGASUS_INTERFACE_H
+
+#include "pegasus/hotspot.h"
+#include "pegasus/input.h"
+#include "pegasus/notification.h"
+#include "pegasus/surface.h"
+#include "pegasus/transition.h"
+#include "pegasus/items/inventorypicture.h"
+
+namespace Pegasus {
+
+class BiochipItem;
+class InventoryItem;
+
+class Interface : public InputHandler, public NotificationReceiver {
+public:
+ Interface();
+ virtual ~Interface();
+
+ void createInterface();
+
+ // Recalibration functions...
+ void calibrateCompass();
+ void calibrateEnergyBar();
+ void raiseInventoryDrawerSync();
+ void lowerInventoryDrawerSync();
+ void raiseBiochipDrawerSync();
+ void lowerBiochipDrawerSync();
+
+ void raiseInventoryDrawer(const bool doCallBacks = true);
+ void raiseBiochipDrawer(const bool doCallBacks = true);
+ void lowerInventoryDrawer(const bool doCallBacks = true);
+ void lowerBiochipDrawer(const bool doCallBacks = true);
+
+ void raiseInventoryDrawerForMessage();
+ void lowerInventoryDrawerForMessage();
+ bool isInventoryUp();
+ bool isInventoryDown();
+
+ InventoryResult addInventoryItem(InventoryItem *);
+ InventoryResult removeInventoryItem(InventoryItem *);
+ void removeAllItemsFromInventory();
+ InventoryItem *getCurrentInventoryItem();
+ void setCurrentInventoryItem(InventoryItem *);
+ void setCurrentInventoryItemID(ItemID);
+ InventoryResult addBiochip(BiochipItem *);
+ void removeAllItemsFromBiochips();
+ BiochipItem *getCurrentBiochip();
+ void setCurrentBiochip(BiochipItem *);
+ void setCurrentBiochipID(ItemID);
+
+ void setDate(const uint16);
+
+ void playEndMessage();
+
+ void throwAwayInterface();
+
+protected:
+ void validateBackground();
+ void validateDateMonitor();
+ void validateCompass();
+ void validateNotifications();
+ void validateAIArea();
+ void validateInventoryPanel();
+ void validateBiochipPanel();
+ void validateEnergyMonitor();
+
+ void throwAwayBackground();
+ void throwAwayDateMonitor();
+ void throwAwayCompass();
+ void throwAwayNotifications();
+ void throwAwayAIArea();
+ void throwAwayInventoryPanel();
+ void throwAwayBiochipPanel();
+ void throwAwayEnergyMonitor();
+
+ void receiveNotification(Notification *, const NotificationFlags);
+ void inventoryLidOpen(const bool doCallBacks);
+ void inventoryLidClosed();
+ void inventoryDrawerUp();
+ void inventoryDrawerDown(const bool doCallBacks);
+ void biochipLidOpen(const bool doCallBacks);
+ void biochipLidClosed();
+ void biochipDrawerUp();
+ void biochipDrawerDown(const bool doCallBacks);
+
+ Picture _background1;
+ Picture _background2;
+ Picture _background3;
+ Picture _background4;
+
+ Picture _datePicture;
+
+ InputHandler *_previousHandler;
+
+ Push _inventoryPush;
+ SpriteSequence _inventoryLid;
+ NotificationCallBack _inventoryPushCallBack;
+ NotificationCallBack _inventoryLidCallBack;
+ InventoryItemsPicture _inventoryPanel;
+ bool _inventoryUp, _inventoryRaised;
+
+ Push _biochipPush;
+ SpriteSequence _biochipLid;
+ NotificationCallBack _biochipPushCallBack;
+ NotificationCallBack _biochipLidCallBack;
+ BiochipPicture _biochipPanel;
+ bool _biochipUp, _biochipRaised;
+
+ Hotspot _currentItemSpot;
+ Hotspot _currentBiochipSpot;
+
+ Notification _interfaceNotification;
+
+ bool _playingEndMessage;
+};
+
+extern Interface *g_interface;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/autodragger.cpp b/engines/pegasus/items/autodragger.cpp
new file mode 100644
index 0000000000..40bad14a89
--- /dev/null
+++ b/engines/pegasus/items/autodragger.cpp
@@ -0,0 +1,91 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/elements.h"
+#include "pegasus/items/autodragger.h"
+
+namespace Pegasus {
+
+AutoDragger::AutoDragger() {
+ _draggingElement = NULL;
+ _lastTime = 0;
+ initCallBack(this, kCallBackAtExtremes);
+}
+
+void AutoDragger::autoDrag(DisplayElement *dragElement, const Common::Point &startPoint, const Common::Point &stopPoint,
+ TimeValue dragTime, TimeScale dragScale) {
+ _draggingElement = dragElement;
+
+ if (_draggingElement) {
+ _startLocation = startPoint;
+ _stopLocation = stopPoint;
+ _lastTime = 0;
+ _done = false;
+ _draggingElement->moveElementTo(_startLocation.x, _startLocation.y);
+ setScale(dragScale);
+ setSegment(0, dragTime);
+ setTime(0);
+ scheduleCallBack(kTriggerAtStop, 0, 0);
+ startIdling();
+ start();
+ } else {
+ stopDragging();
+ }
+}
+
+void AutoDragger::stopDragging() {
+ cancelCallBack();
+ stopIdling();
+ _draggingElement = 0;
+ _startLocation = Common::Point();
+ _stopLocation = Common::Point();
+ _lastTime = 0;
+ _done = true;
+}
+
+bool AutoDragger::isDragging() {
+ return isIdling();
+}
+
+void AutoDragger::useIdleTime() {
+ TimeValue thisTime = getTime();
+
+ if (thisTime != _lastTime) {
+ int32 offsetX = (_stopLocation.x - _startLocation.x) * (int32)thisTime / (int32)getDuration();
+ int32 offsetY = (_stopLocation.y - _startLocation.y) * (int32)thisTime / (int32)getDuration();
+ _draggingElement->moveElementTo(_startLocation.x + offsetX, _startLocation.y + offsetY);
+ _lastTime = thisTime;
+ }
+
+ if (_done)
+ stopDragging();
+}
+
+void AutoDragger::callBack() {
+ if (isIdling())
+ _done = true;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/autodragger.h b/engines/pegasus/items/autodragger.h
new file mode 100644
index 0000000000..6783fdf9a3
--- /dev/null
+++ b/engines/pegasus/items/autodragger.h
@@ -0,0 +1,57 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_AUTODRAGGER_H
+#define PEGASUS_ITEMS_AUTODRAGGER_H
+
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class DisplayElement;
+
+class AutoDragger : private Idler, private TimeBase, private TimeBaseCallBack {
+public:
+ AutoDragger();
+ virtual ~AutoDragger() {}
+
+ void autoDrag(DisplayElement *, const Common::Point &, const Common::Point &, TimeValue, TimeScale);
+ bool isDragging();
+ void stopDragging();
+
+protected:
+ void useIdleTime();
+ void callBack();
+
+ DisplayElement *_draggingElement;
+ Common::Point _startLocation, _stopLocation;
+ TimeValue _lastTime;
+ bool _done;
+};
+
+} // End of namespace Pegasus
+
+#endif
+
diff --git a/engines/pegasus/items/biochips/aichip.cpp b/engines/pegasus/items/biochips/aichip.cpp
new file mode 100644
index 0000000000..cbcfc363e8
--- /dev/null
+++ b/engines/pegasus/items/biochips/aichip.cpp
@@ -0,0 +1,279 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/aichip.h"
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+// indexed by [number of hints][number of solves (0, 1, or 2)][which button to highlight]
+static const ItemState s_highlightState[4][3][7] = {
+ {
+ {kAI000, -1, -1, -1, -1, kAI005, kAI006},
+ {kAI010, -1, -1, -1, -1, kAI015, kAI016},
+ {kAI020, -1, -1, -1, kAI024, -1, -1}
+ },
+ {
+ {kAI100, kAI101, -1, -1, -1, kAI105, kAI106},
+ {kAI110, kAI111, -1, -1, -1, kAI115, kAI116},
+ {kAI120, kAI121, -1, -1, kAI124, kAI125, kAI126}
+ },
+ {
+ {kAI200, kAI201, kAI202, -1, -1, kAI205, kAI206},
+ {kAI210, kAI211, kAI212, -1, -1, kAI215, kAI216},
+ {kAI220, kAI221, kAI222, -1, kAI224, kAI225, kAI226}
+ },
+ {
+ {kAI300, kAI301, kAI302, kAI303, -1, kAI305, kAI306},
+ {kAI310, kAI311, kAI312, kAI313, -1, kAI315, kAI316},
+ {kAI320, kAI321, kAI322, kAI323, kAI324, kAI325, kAI326}
+ }
+};
+
+AIChip *g_AIChip = 0;
+
+AIChip::AIChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ BiochipItem(id, neighborhood, room, direction), _briefingSpot(kAIBriefingSpotID), _scanSpot(kAIScanSpotID),
+ _hint1Spot(kAIHint1SpotID), _hint2Spot(kAIHint2SpotID), _hint3Spot(kAIHint3SpotID), _solveSpot(kAISolveSpotID) {
+ _briefingSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 10, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 10 + 81, kAIMiddleAreaTop + 27 + 31));
+ _briefingSpot.setHotspotFlags(kAIBiochipSpotFlag);
+ g_allHotspots.push_back(&_briefingSpot);
+
+ _scanSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 100, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 100 + 81, kAIMiddleAreaTop + 27 + 31));
+ _scanSpot.setHotspotFlags(kAIBiochipSpotFlag);
+ g_allHotspots.push_back(&_scanSpot);
+
+ _hint1Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 70, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 70 + 21, kAIMiddleAreaTop + 67 + 21));
+ _hint1Spot.setHotspotFlags(kAIBiochipSpotFlag);
+ g_allHotspots.push_back(&_hint1Spot);
+
+ _hint2Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 91, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 91 + 20, kAIMiddleAreaTop + 67 + 21));
+ _hint2Spot.setHotspotFlags(kAIBiochipSpotFlag);
+ g_allHotspots.push_back(&_hint2Spot);
+
+ _hint3Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 111, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 111 + 20, kAIMiddleAreaTop + 67 + 21));
+ _hint3Spot.setHotspotFlags(kAIBiochipSpotFlag);
+ g_allHotspots.push_back(&_hint3Spot);
+
+ _solveSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 131, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 131 + 50, kAIMiddleAreaTop + 67 + 21));
+ _solveSpot.setHotspotFlags(kAIBiochipSpotFlag);
+ g_allHotspots.push_back(&_solveSpot);
+
+ _playingMovie = false;
+ setItemState(kAI000);
+
+ g_AIChip = this;
+}
+
+AIChip::~AIChip() {
+ g_AIChip = NULL;
+
+ g_allHotspots.removeOneHotspot(kAIBriefingSpotID);
+ g_allHotspots.removeOneHotspot(kAIScanSpotID);
+ g_allHotspots.removeOneHotspot(kAIHint1SpotID);
+ g_allHotspots.removeOneHotspot(kAIHint2SpotID);
+ g_allHotspots.removeOneHotspot(kAIHint3SpotID);
+ g_allHotspots.removeOneHotspot(kAISolveSpotID);
+}
+
+void AIChip::select() {
+ BiochipItem::select();
+ setUpAIChip();
+}
+
+void AIChip::takeSharedArea() {
+ setUpAIChip();
+}
+
+void AIChip::setUpAIChip() {
+ if (!_playingMovie) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ uint numSolves;
+ if (GameState.getWalkthroughMode()) {
+ if (vm->canSolve())
+ numSolves = 2;
+ else
+ numSolves = 1;
+ } else {
+ numSolves = 0;
+ }
+
+ setItemState(s_highlightState[vm->getNumHints()][numSolves][0]);
+ }
+}
+
+// Only does something when there are hints or solves available.
+void AIChip::setUpAIChipRude() {
+ if (!_playingMovie) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ uint numSolves;
+ if (GameState.getWalkthroughMode()) {
+ if (vm->canSolve())
+ numSolves = 2;
+ else
+ numSolves = 1;
+ } else {
+ numSolves = 0;
+ }
+
+ uint numHints = vm->getNumHints();
+ if (numSolves == 2 || numHints != 0)
+ setItemState(s_highlightState[numHints][numSolves][0]);
+ }
+}
+
+void AIChip::activateAIHotspots() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ _briefingSpot.setActive();
+ _scanSpot.setActive();
+
+ switch (vm->getNumHints()) {
+ case 3:
+ _hint3Spot.setActive();
+ // fall through
+ case 2:
+ _hint2Spot.setActive();
+ // fall through
+ case 1:
+ _hint1Spot.setActive();
+ break;
+ }
+
+ if (GameState.getWalkthroughMode() && vm->canSolve())
+ _solveSpot.setActive();
+}
+
+void AIChip::showBriefingClicked() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _playingMovie = true;
+
+ uint numSolves;
+ if (GameState.getWalkthroughMode()) {
+ if (vm->canSolve())
+ numSolves = 2;
+ else
+ numSolves = 1;
+ } else {
+ numSolves = 0;
+ }
+
+ ItemState newState = s_highlightState[vm->getNumHints()][numSolves][kAIBriefingSpotID - kAIHint1SpotID + 1];
+ if (newState != -1)
+ setItemState(newState);
+}
+
+void AIChip::showEnvScanClicked() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _playingMovie = true;
+
+ uint numSolves;
+ if (GameState.getWalkthroughMode()) {
+ if (vm->canSolve())
+ numSolves = 2;
+ else
+ numSolves = 1;
+ } else {
+ numSolves = 0;
+ }
+
+ ItemState newState = s_highlightState[vm->getNumHints()][numSolves][kAIScanSpotID - kAIHint1SpotID + 1];
+
+ if (newState != -1)
+ setItemState(newState);
+}
+
+void AIChip::clearClicked() {
+ _playingMovie = false;
+ setUpAIChip();
+}
+
+void AIChip::clickInAIHotspot(HotSpotID id) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ Common::String movieName;
+
+ switch (id) {
+ case kAIBriefingSpotID:
+ movieName = vm->getBriefingMovie();
+ break;
+ case kAIScanSpotID:
+ movieName = vm->getEnvScanMovie();
+ break;
+ case kAIHint1SpotID:
+ movieName = vm->getHintMovie(1);
+ break;
+ case kAIHint2SpotID:
+ movieName = vm->getHintMovie(2);
+ break;
+ case kAIHint3SpotID:
+ movieName = vm->getHintMovie(3);
+ break;
+ case kAISolveSpotID:
+ g_neighborhood->doSolve();
+ break;
+ }
+
+ ItemState state = getItemState();
+
+ if (!movieName.empty()) {
+ _playingMovie = true;
+
+ uint numSolves;
+ if (GameState.getWalkthroughMode()) {
+ if (vm->canSolve())
+ numSolves = 2;
+ else
+ numSolves = 1;
+ } else {
+ numSolves = 0;
+ }
+
+ ItemState newState = s_highlightState[vm->getNumHints()][numSolves][id - kAIHint1SpotID + 1];
+
+ if (newState != -1)
+ setItemState(newState);
+
+ if (g_AIArea) {
+ vm->prepareForAIHint(movieName);
+ g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kHintInterruption);
+ vm->cleanUpAfterAIHint(movieName);
+ }
+
+ if (newState != -1)
+ setItemState(state);
+
+ _playingMovie = false;
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/aichip.h b/engines/pegasus/items/biochips/aichip.h
new file mode 100644
index 0000000000..7a33953612
--- /dev/null
+++ b/engines/pegasus/items/biochips/aichip.h
@@ -0,0 +1,69 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_AICHIP_H
+#define PEGASUS_ITEMS_BIOCHIPS_AICHIP_H
+
+#include "pegasus/hotspot.h"
+#include "pegasus/items/biochips/biochipitem.h"
+
+namespace Pegasus {
+
+class AIChip : public BiochipItem {
+public:
+ AIChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~AIChip();
+
+ void select();
+
+ void setUpAIChip();
+
+ // Called to set up the AI chip when the AI chip is the current chip but does not
+ // own the center area.
+ void setUpAIChipRude();
+ void activateAIHotspots();
+ void clickInAIHotspot(HotSpotID);
+
+ void takeSharedArea();
+
+ void showBriefingClicked();
+ void showEnvScanClicked();
+ void clearClicked();
+
+protected:
+ Hotspot _briefingSpot;
+ Hotspot _scanSpot;
+ Hotspot _hint1Spot;
+ Hotspot _hint2Spot;
+ Hotspot _hint3Spot;
+ Hotspot _solveSpot;
+ bool _playingMovie;
+};
+
+extern AIChip *g_AIChip;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/biochipitem.cpp b/engines/pegasus/items/biochips/biochipitem.cpp
new file mode 100644
index 0000000000..5686948937
--- /dev/null
+++ b/engines/pegasus/items/biochips/biochipitem.cpp
@@ -0,0 +1,95 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/stream.h"
+
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/biochipitem.h"
+
+namespace Pegasus {
+
+BiochipItem::BiochipItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ Item(id, neighborhood, room, direction) {
+
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ Common::SeekableReadStream *biochipInfo = vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id);
+ if (biochipInfo) {
+ _biochipInfoPanelTime = biochipInfo->readUint32BE();
+ delete biochipInfo;
+ } else {
+ _biochipInfoPanelTime = 0;
+ }
+
+ Common::SeekableReadStream *rightInfo = vm->_resFork->getResource(MKTAG('R', 'g', 'h', 't'), kItemBaseResID + id);
+ if (!rightInfo)
+ error("Could not find right info for biochip %d", id);
+
+ _rightAreaInfo = readItemState(rightInfo);
+ delete rightInfo;
+
+ setItemState(kNormalItem);
+}
+
+BiochipItem::~BiochipItem() {
+ delete[] _rightAreaInfo.entries;
+}
+
+ItemType BiochipItem::getItemType() {
+ return kBiochipItemType;
+}
+
+TimeValue BiochipItem::getRightAreaTime() const {
+ if (!_rightAreaInfo.entries)
+ return 0xffffffff;
+
+ TimeValue time;
+ ItemState state;
+
+ findItemStateEntryByState(_rightAreaInfo, _itemState, time);
+ if (time == 0xffffffff)
+ getItemStateEntry(_rightAreaInfo, 0, state, time);
+
+ return time;
+}
+
+// Must affect images in right area.
+void BiochipItem::select() {
+ Item::select();
+
+ if (g_AIArea)
+ g_AIArea->setAIAreaToTime(kBiochipSignature, kRightAreaSignature, getRightAreaTime());
+}
+
+void BiochipItem::deselect() {
+ Item::deselect();
+
+ if (g_AIArea)
+ g_AIArea->setAIAreaToTime(kBiochipSignature, kRightAreaSignature, 0xffffffff);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/biochipitem.h b/engines/pegasus/items/biochips/biochipitem.h
new file mode 100644
index 0000000000..2039e80c6f
--- /dev/null
+++ b/engines/pegasus/items/biochips/biochipitem.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_BIOCHIPITEM_H
+#define PEGASUS_ITEMS_BIOCHIPS_BIOCHIPITEM_H
+
+#include "pegasus/items/item.h"
+
+namespace Pegasus {
+
+class BiochipItem : public Item {
+public:
+ BiochipItem(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~BiochipItem();
+
+ virtual ItemType getItemType();
+
+ TimeValue getPanelTime() const { return _biochipInfoPanelTime; }
+ TimeValue getRightAreaTime() const;
+
+ // Must affect images in right area.
+ virtual void select();
+ virtual void deselect();
+
+protected:
+ TimeValue _biochipInfoPanelTime;
+ ItemStateInfo _rightAreaInfo;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/mapchip.cpp b/engines/pegasus/items/biochips/mapchip.cpp
new file mode 100644
index 0000000000..69050d5193
--- /dev/null
+++ b/engines/pegasus/items/biochips/mapchip.cpp
@@ -0,0 +1,106 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/mapchip.h"
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+MapChip *g_map = 0;
+
+MapChip::MapChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ BiochipItem(id, neighborhood, room, direction) {
+ g_map = this;
+ setItemState(kMapUnavailable);
+}
+
+MapChip::~MapChip() {
+ g_map = 0;
+}
+
+void MapChip::writeToStream(Common::WriteStream *stream) {
+ return _image.writeToStream(stream);
+}
+
+void MapChip::readFromStream(Common::ReadStream *stream) {
+ return _image.readFromStream(stream);
+}
+
+void MapChip::select() {
+ BiochipItem::select();
+ moveToMapLocation(GameState.getCurrentNeighborhood(), GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ _image.show();
+}
+
+void MapChip::takeSharedArea() {
+ _image.show();
+}
+
+void MapChip::giveUpSharedArea() {
+ _image.hide();
+}
+
+void MapChip::deselect() {
+ BiochipItem::deselect();
+ _image.unloadImage();
+}
+
+void MapChip::moveToMapLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant dir) {
+ AirQuality airQuality;
+
+ if (g_neighborhood)
+ airQuality = g_neighborhood->getAirQuality(room);
+ else
+ airQuality = kAirQualityGood;
+
+ switch (neighborhood) {
+ case kMarsID:
+ if (airQuality == kAirQualityVacuum) {
+ if (room >= kMars35 && room <= kMars39) {
+ setItemState(kMapEngaged);
+ if (isSelected() && g_AIArea && g_AIArea->getMiddleAreaOwner() == kBiochipSignature)
+ _image.loadGearRoomIfNecessary();
+ } else {
+ setItemState(kMapEngaged);
+ if (isSelected() && g_AIArea && g_AIArea->getMiddleAreaOwner() == kBiochipSignature)
+ _image.loadMazeIfNecessary();
+ }
+
+ _image.moveToMapLocation(neighborhood, room, dir);
+ } else {
+ _image.unloadImage();
+ setItemState(kMapUnavailable);
+ }
+ break;
+ default:
+ _image.unloadImage();
+ setItemState(kMapUnavailable);
+ break;
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/mapchip.h b/engines/pegasus/items/biochips/mapchip.h
new file mode 100644
index 0000000000..6690090aa4
--- /dev/null
+++ b/engines/pegasus/items/biochips/mapchip.h
@@ -0,0 +1,64 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_MAPCHIP_H
+#define PEGASUS_ITEMS_BIOCHIPS_MAPCHIP_H
+
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/biochips/mapimage.h"
+
+namespace Common {
+ class ReadStream;
+ class WriteStream;
+}
+
+namespace Pegasus {
+
+class MapChip : public BiochipItem {
+public:
+ MapChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~MapChip();
+
+ void select();
+ void deselect();
+ void takeSharedArea();
+ void giveUpSharedArea();
+
+ void moveToMapLocation(const NeighborhoodID, const RoomID, const DirectionConstant);
+
+ void writeToStream(Common::WriteStream *);
+ void readFromStream(Common::ReadStream *);
+
+ bool beenToMaze() { return _image.anyFlagSet(); }
+
+protected:
+ MapImage _image;
+};
+
+extern MapChip *g_map;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/mapimage.cpp b/engines/pegasus/items/biochips/mapimage.cpp
new file mode 100644
index 0000000000..9f4170d063
--- /dev/null
+++ b/engines/pegasus/items/biochips/mapimage.cpp
@@ -0,0 +1,443 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/items/biochips/mapimage.h"
+
+namespace Pegasus {
+
+#define FLAG_TO_INDEX(flag) ((flag) >> 2)
+#define INDEX_TO_FLAG(index) ((index) << 2)
+
+#define ROOM_TO_INDEX(room) \
+ (((room) >= kMars35 && (room) <= kMars39) ? ((room) - kMars35) : \
+ (((room) == kMars60) ? (kMars39 - kMars35 + 1) : \
+ ((room) - kMarsMaze004 + kMars39 - kMars35 + 2)))
+
+#define INDEX_TO_ROOM(index) \
+ (((index) <= ROOM_TO_INDEX(kMars39)) ? \
+ (((index) - ROOM_TO_INDEX(kMars35)) + kMars35) : \
+ ((index) <= ROOM_TO_INDEX(kMars60,)) ? kMars60 : \
+ ((((index) - ROOM_TO_INDEX(kMarsMaze004))) + kMarsMaze004))
+
+#define ROOM_TO_FLAG(room, dir) (INDEX_TO_FLAG(ROOM_TO_INDEX(room)) | (dir))
+
+#define FLAG_TO_ROOM(flag) (INDEX_TO_ROOM(FLAG_TO_INDEX(flag)))
+
+#define FLAG_TO_DIRECTION(flag) ((flag) & 3)
+
+static const int kGearRoomFlagLow = ROOM_TO_FLAG(kMars35, kNorth);
+static const int kGearRoomFlagHigh = ROOM_TO_FLAG(kMars39, kWest);
+
+static const int kMazeFlagLow = ROOM_TO_FLAG(kMars60, kNorth);
+static const int kMazeFlagHigh = ROOM_TO_FLAG(kMarsMaze200, kWest);
+
+static const CoordType kGearRoomScreenOffsetX = 49;
+static const CoordType kGearRoomScreenOffsetY = 47;
+
+static const CoordType kGearRoomGridOriginX = 1;
+static const CoordType kGearRoomGridOriginY = 4;
+
+static const CoordType kMazeScreenOffsetX = 16;
+static const CoordType kMazeScreenOffsetY = 20;
+
+static const CoordType kMazeGridOriginX = 6;
+static const CoordType kMazeGridOriginY = 1;
+
+static const CoordType kGridWidth = 4;
+static const CoordType kGridHeight = 4;
+
+static const uint16 kMapOfMazePICTID = 906;
+static const uint16 kMapOfGearRoomPICTID = 907;
+
+static const int s_mapCoords[MapImage::kNumMappingRooms][2] = {
+ /* kMars35 */ { 0, 0 },
+ /* kMars36 */ { 1, 0 },
+ /* kMars37 */ { 2, 0 },
+ /* kMars38 */ { 3, 0 },
+ /* kMars39 */ { 4, 0 },
+ /* kMars60 */ { 19, 9 },
+ /* kMarsMaze004 */ { 18, 9 },
+ /* kMarsMaze005 */ { 18, 10 },
+ /* kMarsMaze006 */ { 17, 10 },
+ /* kMarsMaze007 */ { 16, 10 },
+ /* kMarsMaze008 */ { 15, 10 },
+ /* kMarsMaze009 */ { 14, 10 },
+ /* kMarsMaze010 */ { 14, 9 },
+ /* kMarsMaze011 */ { 14, 8 },
+ /* kMarsMaze012 */ { 14, 7 },
+ /* kMarsMaze015 */ { 16, 7 },
+ /* kMarsMaze016 */ { 14, 11 },
+ /* kMarsMaze017 */ { 14, 12 },
+ /* kMarsMaze018 */ { 15, 12 },
+ /* kMarsMaze019 */ { 16, 12 },
+ /* kMarsMaze020 */ { 16, 13 },
+ /* kMarsMaze021 */ { 16, 14 },
+ /* kMarsMaze022 */ { 16, 15 },
+ /* kMarsMaze023 */ { 17, 15 },
+ /* kMarsMaze024 */ { 18, 15 },
+ /* kMarsMaze025 */ { 18, 14 },
+ /* kMarsMaze026 */ { 18, 13 },
+ /* kMarsMaze027 */ { 18, 12 },
+ /* kMarsMaze028 */ { 18, 11 },
+ /* kMarsMaze031 */ { 19, 14 },
+ /* kMarsMaze032 */ { 20, 14 },
+ /* kMarsMaze033 */ { 20, 13 },
+ /* kMarsMaze034 */ { 20, 12 },
+ /* kMarsMaze035 */ { 20, 11 },
+ /* kMarsMaze036 */ { 21, 11 },
+ /* kMarsMaze037 */ { 15, 15 },
+ /* kMarsMaze038 */ { 14, 15 },
+ /* kMarsMaze039 */ { 13, 15 },
+ /* kMarsMaze042 */ { 10, 15 },
+ /* kMarsMaze043 */ { 9, 15 },
+ /* kMarsMaze044 */ { 8, 15 },
+ /* kMarsMaze045 */ { 7, 15 },
+ /* kMarsMaze046 */ { 6, 15 },
+ /* kMarsMaze047 */ { 5, 15 },
+ /* kMarsMaze049 */ { 13, 14 },
+ /* kMarsMaze050 */ { 12, 14 },
+ /* kMarsMaze051 */ { 11, 14 },
+ /* kMarsMaze052 */ { 10, 14 },
+ /* kMarsMaze053 */ { 10, 13 },
+ /* kMarsMaze054 */ { 9, 13 },
+ /* kMarsMaze055 */ { 8, 13 },
+ /* kMarsMaze056 */ { 8, 12 },
+ /* kMarsMaze057 */ { 7, 12 },
+ /* kMarsMaze058 */ { 12, 13 },
+ /* kMarsMaze059 */ { 12, 12 },
+ /* kMarsMaze060 */ { 12, 11 },
+ /* kMarsMaze061 */ { 12, 10 },
+ /* kMarsMaze063 */ { 12, 9 },
+ /* kMarsMaze064 */ { 12, 8 },
+ /* kMarsMaze065 */ { 12, 7 },
+ /* kMarsMaze066 */ { 13, 7 },
+ /* kMarsMaze067 */ { 15, 7 },
+ /* kMarsMaze068 */ { 17, 7 },
+ /* kMarsMaze069 */ { 18, 7 },
+ /* kMarsMaze070 */ { 19, 7 },
+ /* kMarsMaze071 */ { 20, 7 },
+ /* kMarsMaze072 */ { 20, 6 },
+ /* kMarsMaze074 */ { 20, 5 },
+ /* kMarsMaze076 */ { 20, 4 },
+ /* kMarsMaze078 */ { 20, 3 },
+ /* kMarsMaze079 */ { 20, 2 },
+ /* kMarsMaze081 */ { 20, 2 },
+ /* kMarsMaze083 */ { 20, 0 },
+ /* kMarsMaze084 */ { 19, 0 },
+ /* kMarsMaze085 */ { 18, 0 },
+ /* kMarsMaze086 */ { 17, 0 },
+ /* kMarsMaze087 */ { 16, 0 },
+ /* kMarsMaze088 */ { 15, 0 },
+ /* kMarsMaze089 */ { 14, 0 },
+ /* kMarsMaze090 */ { 13, 0 },
+ /* kMarsMaze091 */ { 12, 0 },
+ /* kMarsMaze092 */ { 11, 0 },
+ /* kMarsMaze093 */ { 10, 0 },
+ /* kMarsMaze098 */ { 10, 1 },
+ /* kMarsMaze099 */ { 8, 2 },
+ /* kMarsMaze100 */ { 9, 2 },
+ /* kMarsMaze101 */ { 10, 2 },
+ /* kMarsMaze104 */ { 13, 2 },
+ /* kMarsMaze105 */ { 13, 3 },
+ /* kMarsMaze106 */ { 13, 4 },
+ /* kMarsMaze107 */ { 13, 5 },
+ /* kMarsMaze108 */ { 14, 5 },
+ /* kMarsMaze111 */ { 15, 5 },
+ /* kMarsMaze113 */ { 16, 5 },
+ /* kMarsMaze114 */ { 17, 5 },
+ /* kMarsMaze115 */ { 18, 5 },
+ /* kMarsMaze116 */ { 18, 4 },
+ /* kMarsMaze117 */ { 18, 3 },
+ /* kMarsMaze118 */ { 19, 3 },
+ /* kMarsMaze119 */ { 18, 2 },
+ /* kMarsMaze120 */ { 17, 2 },
+ /* kMarsMaze121 */ { 16, 2 },
+ /* kMarsMaze122 */ { 15, 2 },
+ /* kMarsMaze123 */ { 15, 1 },
+ /* kMarsMaze124 */ { 12, 4 },
+ /* kMarsMaze125 */ { 11, 4 },
+ /* kMarsMaze126 */ { 10, 4 },
+ /* kMarsMaze127 */ { 10, 5 },
+ /* kMarsMaze128 */ { 10, 6 },
+ /* kMarsMaze129 */ { 9, 6 },
+ /* kMarsMaze130 */ { 8, 6 },
+ /* kMarsMaze131 */ { 7, 6 },
+ /* kMarsMaze132 */ { 7, 7 },
+ /* kMarsMaze133 */ { 7, 8 },
+ /* kMarsMaze136 */ { 7, 11 },
+ /* kMarsMaze137 */ { 6, 11 },
+ /* kMarsMaze138 */ { 5, 11 },
+ /* kMarsMaze139 */ { 5, 12 },
+ /* kMarsMaze140 */ { 4, 12 },
+ /* kMarsMaze141 */ { 5, 13 },
+ /* kMarsMaze142 */ { 5, 14 },
+ /* kMarsMaze143 */ { 4, 14 },
+ /* kMarsMaze144 */ { 3, 14 },
+ /* kMarsMaze145 */ { 3, 13 },
+ /* kMarsMaze146 */ { 2, 13 },
+ /* kMarsMaze147 */ { 1, 13 },
+ /* kMarsMaze148 */ { 1, 14 },
+ /* kMarsMaze149 */ { 1, 15 },
+ /* kMarsMaze152 */ { 1, 12 },
+ /* kMarsMaze153 */ { 1, 11 },
+ /* kMarsMaze154 */ { 1, 10 },
+ /* kMarsMaze155 */ { 1, 9 },
+ /* kMarsMaze156 */ { 1, 8 },
+ /* kMarsMaze157 */ { 2, 10 },
+ /* kMarsMaze159 */ { 2, 8 },
+ /* kMarsMaze160 */ { 2, 7 },
+ /* kMarsMaze161 */ { 2, 6 },
+ /* kMarsMaze162 */ { 3, 10 },
+ /* kMarsMaze163 */ { 3, 9 },
+ /* kMarsMaze164 */ { 3, 8 },
+ /* kMarsMaze165 */ { 4, 8 },
+ /* kMarsMaze166 */ { 5, 8 },
+ /* kMarsMaze167 */ { 6, 8 },
+ /* kMarsMaze168 */ { 3, 6 },
+ /* kMarsMaze169 */ { 4, 6 },
+ /* kMarsMaze170 */ { 5, 6 },
+ /* kMarsMaze171 */ { 5, 5 },
+ /* kMarsMaze172 */ { 5, 4 },
+ /* kMarsMaze173 */ { 4, 4 },
+ /* kMarsMaze174 */ { 3, 4 },
+ /* kMarsMaze175 */ { 3, 5 },
+ /* kMarsMaze177 */ { 8, 4 },
+ /* kMarsMaze178 */ { 8, 3 },
+ /* kMarsMaze179 */ { 7, 4 },
+ /* kMarsMaze180 */ { 6, 4 },
+ /* kMarsMaze181 */ { 6, 3 },
+ /* kMarsMaze182 */ { 6, 2 },
+ /* kMarsMaze183 */ { 6, 1 },
+ /* kMarsMaze184 */ { 6, 0 },
+ /* kMarsMaze187 */ { 3, 0 },
+ /* kMarsMaze188 */ { 2, 0 },
+ /* kMarsMaze189 */ { 1, 0 },
+ /* kMarsMaze190 */ { 1, 1 },
+ /* kMarsMaze191 */ { 1, 2 },
+ /* kMarsMaze192 */ { 5, 2 },
+ /* kMarsMaze193 */ { 4, 2 },
+ /* kMarsMaze194 */ { 3, 2 },
+ /* kMarsMaze195 */ { 3, 1 },
+ /* kMarsMaze198 */ { 1, 3 },
+ /* kMarsMaze199 */ { 1, 4 },
+ /* kMarsMaze200 */ { 0, 4 }
+};
+
+MapImage::MapImage() : DisplayElement(kNoDisplayElement) {
+ _whichArea = kMapNoArea;
+ setBounds(kAIMiddleAreaLeft, kAIMiddleAreaTop, kAIMiddleAreaLeft + kAIMiddleAreaWidth, kAIMiddleAreaTop + kAIMiddleAreaHeight);
+ setDisplayOrder(kAIMiddleAreaOrder + 10);
+ startDisplaying();
+
+ _darkGreen = g_system->getScreenFormat().RGBToColor(64, 150, 10);
+ _lightGreen = g_system->getScreenFormat().RGBToColor(102, 239, 0);
+}
+
+void MapImage::writeToStream(Common::WriteStream *stream) {
+ _mappedRooms.writeToStream(stream);
+}
+
+void MapImage::readFromStream(Common::ReadStream *stream) {
+ _mappedRooms.readFromStream(stream);
+}
+
+void MapImage::loadGearRoomIfNecessary() {
+ if (_whichArea != kMapGearRoom) {
+ _mapImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMapOfGearRoomPICTID);
+
+ Common::Rect bounds;
+ _mapImage.getSurfaceBounds(bounds);
+ _mapMask.allocateSurface(bounds);
+ _whichArea = kMapGearRoom;
+
+ GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ gfx->setCurSurface(_mapMask.getSurface());
+
+ gfx->getCurSurface()->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
+
+ for (int i = kGearRoomFlagLow; i <= kGearRoomFlagHigh; i++)
+ if (_mappedRooms.getFlag(i))
+ addFlagToMask(i);
+
+ gfx->setCurSurface(gfx->getWorkArea());
+ show();
+ }
+}
+
+void MapImage::loadMazeIfNecessary() {
+ if (_whichArea != kMapMaze) {
+ _mapImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMapOfMazePICTID);
+
+ Common::Rect bounds;
+ _mapImage.getSurfaceBounds(bounds);
+ _mapMask.allocateSurface(bounds);
+ _whichArea = kMapMaze;
+
+ GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ gfx->setCurSurface(_mapMask.getSurface());
+
+ gfx->getCurSurface()->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
+
+ for (int i = kMazeFlagLow; i <= kMazeFlagHigh; i++)
+ if (_mappedRooms.getFlag(i))
+ addFlagToMask(i);
+
+ gfx->setCurSurface(gfx->getWorkArea());
+ show();
+ }
+}
+
+void MapImage::unloadImage() {
+ _mapImage.deallocateSurface();
+ _mapMask.deallocateSurface();
+ hide();
+ _whichArea = kMapNoArea;
+}
+
+void MapImage::moveToMapLocation(const NeighborhoodID, const RoomID room, const DirectionConstant dir) {
+ GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+
+ int flag = ROOM_TO_FLAG(room, dir);
+
+ if (!_mappedRooms.getFlag(flag)) {
+ _mappedRooms.setFlag(flag, true);
+
+ if (_mapMask.isSurfaceValid()) {
+ gfx->setCurSurface(_mapMask.getSurface());
+ addFlagToMask(flag);
+ gfx->setCurSurface(gfx->getWorkArea());
+ }
+ }
+
+ if (isDisplaying())
+ triggerRedraw();
+}
+
+void MapImage::addFlagToMask(const int flag) {
+ Common::Rect r1;
+ getRevealedRects(flag, r1);
+ ((PegasusEngine *)g_engine)->_gfx->getCurSurface()->fillRect(r1, g_system->getScreenFormat().RGBToColor(0, 0, 0));
+}
+
+// This function can even be sensitive to open doors.
+// clone2727 notices that it's not, though
+void MapImage::getRevealedRects(const uint32 flag, Common::Rect &r1) {
+ CoordType gridX, gridY;
+
+ switch (_whichArea) {
+ case kMapMaze:
+ gridX = kMazeGridOriginX;
+ gridY = kMazeGridOriginY;
+ break;
+ case kMapGearRoom:
+ gridX = kGearRoomGridOriginX;
+ gridY = kGearRoomGridOriginY;
+ break;
+ default:
+ return;
+ }
+
+ int index = FLAG_TO_INDEX(flag);
+ gridX += s_mapCoords[index][0] * kGridWidth;
+ gridY += s_mapCoords[index][1] * kGridHeight;
+
+ r1 = Common::Rect(gridX - 1, gridY - 1, gridX + kGridWidth + 1, gridY + kGridHeight + 1);
+}
+
+void MapImage::drawPlayer() {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+
+ CoordType gridX, gridY;
+
+ switch (_whichArea) {
+ case kMapMaze:
+ gridX = _bounds.left + kMazeScreenOffsetX + kMazeGridOriginX;
+ gridY = _bounds.top + kMazeScreenOffsetY + kMazeGridOriginY;
+ break;
+ case kMapGearRoom:
+ gridX = _bounds.left + kGearRoomScreenOffsetX + kGearRoomGridOriginX;
+ gridY = _bounds.top + kGearRoomScreenOffsetY + kGearRoomGridOriginY;
+ break;
+ default:
+ return;
+ }
+
+ int index = ROOM_TO_INDEX(GameState.getCurrentRoom());
+ gridX += s_mapCoords[index][0] * kGridWidth;
+ gridY += s_mapCoords[index][1] * kGridHeight;
+
+ // This was intended to make little arrows
+ switch (GameState.getCurrentDirection()) {
+ case kNorth:
+ screen->drawLine(gridX + 1, gridY, gridX + 2, gridY, _darkGreen);
+ screen->drawLine(gridX, gridY + 1, gridX + 3, gridY + 1, _darkGreen);
+ screen->drawLine(gridX + 1, gridY + 1, gridX + 2, gridY + 1, _lightGreen);
+ screen->drawLine(gridX, gridY + 2, gridX + 3, gridY + 2, _lightGreen);
+ break;
+ case kSouth:
+ screen->drawLine(gridX + 1, gridY + 3, gridX + 2, gridY + 3, _darkGreen);
+ screen->drawLine(gridX, gridY + 2, gridX + 3, gridY + 2, _darkGreen);
+ screen->drawLine(gridX + 1, gridY + 2, gridX + 2, gridY + 2, _lightGreen);
+ screen->drawLine(gridX, gridY + 1, gridX + 3, gridY + 1, _lightGreen);
+ break;
+ case kEast:
+ screen->drawLine(gridX + 3, gridY + 1, gridX + 3, gridY + 2, _darkGreen);
+ screen->drawLine(gridX + 2, gridY, gridX + 2, gridY + 3, _darkGreen);
+ screen->drawLine(gridX + 2, gridY + 1, gridX + 2, gridY + 2, _lightGreen);
+ screen->drawLine(gridX + 1, gridY, gridX + 1, gridY + 3, _lightGreen);
+ break;
+ case kWest:
+ screen->drawLine(gridX, gridY + 1, gridX, gridY + 2, _darkGreen);
+ screen->drawLine(gridX + 1, gridY, gridX + 1, gridY + 3, _darkGreen);
+ screen->drawLine(gridX + 1, gridY + 1, gridX + 1, gridY + 2, _lightGreen);
+ screen->drawLine(gridX + 2, gridY, gridX + 2, gridY + 3, _lightGreen);
+ break;
+ }
+}
+
+void MapImage::draw(const Common::Rect &) {
+ Common::Rect r1;
+ _mapImage.getSurfaceBounds(r1);
+
+ Common::Rect r2 = r1;
+ switch (_whichArea) {
+ case kMapMaze:
+ r2.moveTo(_bounds.left + kMazeScreenOffsetX, _bounds.top + kMazeScreenOffsetY);
+ break;
+ case kMapGearRoom:
+ r2.moveTo(_bounds.left + kGearRoomScreenOffsetX, _bounds.top + kGearRoomScreenOffsetY);
+ break;
+ default:
+ return;
+ }
+
+ _mapImage.copyToCurrentPortMasked(r1, r2, &_mapMask);
+
+ drawPlayer();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/mapimage.h b/engines/pegasus/items/biochips/mapimage.h
new file mode 100644
index 0000000000..49ad9945ee
--- /dev/null
+++ b/engines/pegasus/items/biochips/mapimage.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_MAPIMAGE_H
+#define PEGASUS_ITEMS_BIOCHIPS_MAPIMAGE_H
+
+#include "pegasus/elements.h"
+#include "pegasus/surface.h"
+#include "pegasus/util.h"
+#include "pegasus/neighborhood/mars/constants.h"
+
+namespace Common {
+ class ReadStream;
+ class WriteStream;
+}
+
+namespace Pegasus {
+
+class MapImage : public DisplayElement {
+public:
+ MapImage();
+ virtual ~MapImage() {}
+
+ void writeToStream(Common::WriteStream *);
+ void readFromStream(Common::ReadStream *);
+
+ void loadGearRoomIfNecessary();
+ void loadMazeIfNecessary();
+ void unloadImage();
+ void moveToMapLocation(const NeighborhoodID, const RoomID, const DirectionConstant);
+
+ void draw(const Common::Rect &);
+
+ bool anyFlagSet() { return _mappedRooms.anyFlagSet(); }
+
+ static const uint32 kNumMappingRooms = (kMars39 - kMars35 + 1) + (kMars60 - kMars60 + 1) +
+ (kMarsMaze200 - kMarsMaze004 + 1);
+ static const uint32 kNumMappingFlags = kNumMappingRooms * 4;
+
+protected:
+ enum MapArea {
+ kMapNoArea,
+ kMapMaze,
+ kMapGearRoom
+ };
+
+ void addFlagToMask(const int flag);
+ void getRevealedRects(const uint32, Common::Rect &);
+ void drawPlayer();
+
+ MapArea _whichArea;
+
+ FlagsArray<byte, kNumMappingFlags> _mappedRooms;
+
+ uint32 _darkGreen, _lightGreen;
+
+ Surface _mapImage, _mapMask;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/opticalchip.cpp b/engines/pegasus/items/biochips/opticalchip.cpp
new file mode 100644
index 0000000000..7b8858edae
--- /dev/null
+++ b/engines/pegasus/items/biochips/opticalchip.cpp
@@ -0,0 +1,190 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/opticalchip.h"
+
+namespace Pegasus {
+
+OpticalChip *g_opticalChip = 0;
+
+OpticalChip::OpticalChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ BiochipItem(id, neighborhood, room, direction), _ariesHotspot(kAriesSpotID), _mercuryHotspot(kMercurySpotID),
+ _poseidonHotspot(kPoseidonSpotID) {
+ _ariesHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 27 + 20));
+ _ariesHotspot.setHotspotFlags(kOpticalBiochipSpotFlag);
+ g_allHotspots.push_back(&_ariesHotspot);
+
+ _mercuryHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 47, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 47 + 20));
+ _mercuryHotspot.setHotspotFlags(kOpticalBiochipSpotFlag);
+ g_allHotspots.push_back(&_mercuryHotspot);
+
+ _poseidonHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 67 + 20));
+ _poseidonHotspot.setHotspotFlags(kOpticalBiochipSpotFlag);
+ g_allHotspots.push_back(&_poseidonHotspot);
+
+ setItemState(kOptical000);
+
+ g_opticalChip = this;
+}
+
+OpticalChip::~OpticalChip() {
+ g_allHotspots.removeOneHotspot(kAriesSpotID);
+ g_allHotspots.removeOneHotspot(kMercurySpotID);
+ g_allHotspots.removeOneHotspot(kPoseidonSpotID);
+}
+
+void OpticalChip::writeToStream(Common::WriteStream *stream) {
+ BiochipItem::writeToStream(stream);
+ _opticalFlags.writeToStream(stream);
+}
+
+void OpticalChip::readFromStream(Common::ReadStream *stream) {
+ BiochipItem::readFromStream(stream);
+ _opticalFlags.readFromStream(stream);
+}
+
+void OpticalChip::addAries() {
+ _opticalFlags.setFlag(kOpticalAriesExposed, true);
+ setUpOpticalChip();
+}
+
+void OpticalChip::addMercury() {
+ _opticalFlags.setFlag(kOpticalMercuryExposed, true);
+ setUpOpticalChip();
+}
+
+void OpticalChip::addPoseidon() {
+ _opticalFlags.setFlag(kOpticalPoseidonExposed, true);
+ setUpOpticalChip();
+}
+
+void OpticalChip::setUpOpticalChip() {
+ if (_opticalFlags.getFlag(kOpticalAriesExposed)) {
+ if (_opticalFlags.getFlag(kOpticalMercuryExposed)) {
+ if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
+ setItemState(kOptical111);
+ else
+ setItemState(kOptical011);
+ } else {
+ if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
+ setItemState(kOptical101);
+ else
+ setItemState(kOptical001);
+ }
+ } else {
+ if (_opticalFlags.getFlag(kOpticalMercuryExposed)) {
+ if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
+ setItemState(kOptical110);
+ else
+ setItemState(kOptical010);
+ } else {
+ if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
+ setItemState(kOptical100);
+ else
+ setItemState(kOptical000);
+ }
+ }
+}
+
+void OpticalChip::activateOpticalHotspots() {
+ if (_opticalFlags.getFlag(kOpticalAriesExposed))
+ _ariesHotspot.setActive();
+ if (_opticalFlags.getFlag(kOpticalMercuryExposed))
+ _mercuryHotspot.setActive();
+ if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
+ _poseidonHotspot.setActive();
+}
+
+void OpticalChip::clickInOpticalHotspot(HotSpotID id) {
+ playOpMemMovie(id);
+}
+
+void OpticalChip::playOpMemMovie(HotSpotID id) {
+ Common::String movieName;
+ switch (id) {
+ case kAriesSpotID:
+ movieName = "Images/AI/Globals/OMAI";
+ break;
+ case kMercurySpotID:
+ movieName = "Images/AI/Globals/OMMI";
+ break;
+ case kPoseidonSpotID:
+ movieName = "Images/AI/Globals/OMPI";
+ break;
+ }
+
+ ItemState state = getItemState(), newState;
+ switch (state) {
+ case kOptical001:
+ newState = kOptical002;
+ break;
+ case kOptical010:
+ newState = kOptical020;
+ break;
+ case kOptical011:
+ if (id == kAriesSpotID)
+ newState = kOptical012;
+ else
+ newState = kOptical021;
+ break;
+ case kOptical100:
+ newState = kOptical200;
+ break;
+ case kOptical101:
+ if (id == kAriesSpotID)
+ newState = kOptical102;
+ else
+ newState = kOptical201;
+ break;
+ case kOptical110:
+ if (id == kMercurySpotID)
+ newState = kOptical120;
+ else
+ newState = kOptical210;
+ break;
+ case kOptical111:
+ if (id == kAriesSpotID)
+ newState = kOptical112;
+ else if (id == kMercurySpotID)
+ newState = kOptical121;
+ else
+ newState = kOptical211;
+ break;
+ case kOptical000: // Can never happen.
+ default:
+ error("Invalid optical chip state");
+ }
+
+ setItemState(newState);
+
+ if (g_AIArea)
+ g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kOpticalInterruption);
+
+ setItemState(state);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/opticalchip.h b/engines/pegasus/items/biochips/opticalchip.h
new file mode 100644
index 0000000000..2f66f73d3a
--- /dev/null
+++ b/engines/pegasus/items/biochips/opticalchip.h
@@ -0,0 +1,71 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_OPTICALCHIP_H
+#define PEGASUS_ITEMS_BIOCHIPS_OPTICALCHIP_H
+
+#include "pegasus/hotspot.h"
+#include "pegasus/util.h"
+#include "pegasus/items/biochips/biochipitem.h"
+
+namespace Pegasus {
+
+class OpticalChip : public BiochipItem {
+public:
+ OpticalChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~OpticalChip();
+
+ virtual void writeToStream(Common::WriteStream *);
+ virtual void readFromStream(Common::ReadStream *);
+
+ void addAries();
+ void addMercury();
+ void addPoseidon();
+
+ void activateOpticalHotspots();
+ void clickInOpticalHotspot(HotSpotID);
+ void playOpMemMovie(HotSpotID);
+
+protected:
+ enum {
+ kOpticalAriesExposed,
+ kOpticalMercuryExposed,
+ kOpticalPoseidonExposed,
+ kNumOpticalChipFlags
+ };
+
+ void setUpOpticalChip();
+
+ FlagsArray<byte, kNumOpticalChipFlags> _opticalFlags;
+ Hotspot _ariesHotspot;
+ Hotspot _mercuryHotspot;
+ Hotspot _poseidonHotspot;
+};
+
+extern OpticalChip *g_opticalChip;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/pegasuschip.cpp b/engines/pegasus/items/biochips/pegasuschip.cpp
new file mode 100644
index 0000000000..fa551fce30
--- /dev/null
+++ b/engines/pegasus/items/biochips/pegasuschip.cpp
@@ -0,0 +1,198 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/items/biochips/pegasuschip.h"
+#include "pegasus/neighborhood/tsa/fulltsa.h"
+#include "pegasus/neighborhood/tsa/tinytsa.h"
+
+namespace Pegasus {
+
+PegasusChip::PegasusChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ BiochipItem(id, neighborhood, room, direction), _recallSpot(kPegasusRecallSpotID) {
+ _recallSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 116, kAIMiddleAreaTop + 63, kAIMiddleAreaLeft + 184, kAIMiddleAreaTop + 91));
+ _recallSpot.setHotspotFlags(kPegasusBiochipSpotFlag);
+ g_allHotspots.push_back(&_recallSpot);
+ setItemState(kPegasusTSA00);
+}
+
+PegasusChip::~PegasusChip() {
+ g_allHotspots.removeOneHotspot(kPegasusRecallSpotID);
+}
+
+void PegasusChip::select() {
+ BiochipItem::select();
+ setUpPegasusChip();
+}
+
+void PegasusChip::setUpPegasusChip() {
+ switch (GameState.getCurrentNeighborhood()) {
+ case kCaldoriaID:
+ setItemState(kPegasusCaldoria);
+ break;
+ case kFullTSAID:
+ case kFinalTSAID:
+ case kTinyTSAID:
+ setItemState(kPegasusTSA10);
+ break;
+ case kPrehistoricID:
+ if (((PegasusEngine *)g_engine)->playerHasItemID(kHistoricalLog))
+ setItemState(kPegasusPrehistoric00);
+ else
+ setItemState(kPegasusPrehistoric10);
+ break;
+ case kMarsID:
+ if (GameState.getMarsFinished())
+ setItemState(kPegasusMars00);
+ else
+ setItemState(kPegasusMars10);
+ break;
+ case kWSCID:
+ if (GameState.getWSCFinished())
+ setItemState(kPegasusWSC00);
+ else
+ setItemState(kPegasusWSC10);
+ break;
+ case kNoradAlphaID:
+ case kNoradDeltaID:
+ if (GameState.getNoradFinished())
+ setItemState(kPegasusNorad00);
+ else
+ setItemState(kPegasusNorad10);
+ break;
+ }
+}
+
+// Only does something if the chip should be announcing that the time zone is finished...
+void PegasusChip::setUpPegasusChipRude() {
+ switch (GameState.getCurrentNeighborhood()) {
+ case kPrehistoricID:
+ if (((PegasusEngine *)g_engine)->playerHasItemID(kHistoricalLog))
+ setItemState(kPegasusPrehistoric00);
+ break;
+ case kMarsID:
+ if (GameState.getMarsFinished())
+ setItemState(kPegasusMars00);
+ break;
+ case kWSCID:
+ if (GameState.getWSCFinished())
+ setItemState(kPegasusWSC00);
+ break;
+ case kNoradAlphaID:
+ case kNoradDeltaID:
+ if (GameState.getNoradFinished())
+ setItemState(kPegasusNorad00);
+ break;
+ }
+}
+
+void PegasusChip::activatePegasusHotspots() {
+ switch (GameState.getCurrentNeighborhood()) {
+ case kPrehistoricID:
+ // WORKAROUND: Don't allow the player to recall if they don't have
+ // the historical log. Otherwise, gameplay is broken when returning
+ // to the TSA.
+ if (!((PegasusEngine *)g_engine)->playerHasItemID(kHistoricalLog))
+ return;
+ // fall through
+ case kMarsID:
+ case kWSCID:
+ case kNoradAlphaID:
+ case kNoradDeltaID:
+ _recallSpot.setActive();
+ break;
+ }
+}
+
+void PegasusChip::clickInPegasusHotspot() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ ItemState thisState = getItemState();
+ ItemState hiliteState;
+
+ switch (thisState) {
+ case kPegasusPrehistoric00:
+ hiliteState = kPegasusPrehistoric01;
+ break;
+ case kPegasusPrehistoric10:
+ hiliteState = kPegasusPrehistoric11;
+ break;
+ case kPegasusMars00:
+ hiliteState = kPegasusMars01;
+ break;
+ case kPegasusMars10:
+ hiliteState = kPegasusMars11;
+ break;
+ case kPegasusNorad00:
+ hiliteState = kPegasusNorad01;
+ break;
+ case kPegasusNorad10:
+ hiliteState = kPegasusNorad11;
+ break;
+ case kPegasusWSC00:
+ hiliteState = kPegasusWSC01;
+ break;
+ case kPegasusWSC10:
+ hiliteState = kPegasusWSC11;
+ break;
+ default:
+ error("Invalid pegasus chip state");
+ }
+
+ // WORKAROUND: The original called setItemState() here. However,
+ // since we're overriding select() to call setUpPegasusChip(),
+ // the highlighted frame is never displayed! So, we're manually
+ // setting the state and selecting the item. Also of note is that
+ // setItemState() for this class is effectively useless since it
+ // always gets overriden in the select() function. The only reason
+ // that this doesn't end in infinite recursion is because setItemState()
+ // has a check against the current state to make sure you don't call
+ // select() again. </rant>
+ _itemState = hiliteState;
+ BiochipItem::select();
+
+ uint32 time = g_system->getMillis();
+ while (g_system->getMillis() < time + 500) {
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ setItemState(thisState);
+
+ if (!((Neighborhood *)g_neighborhood)->okayToJump())
+ return;
+
+ if (g_energyMonitor)
+ g_energyMonitor->stopEnergyDraining();
+
+ if (GameState.getTSAState() == kPlayerWentToPrehistoric || GameState.allTimeZonesFinished())
+ vm->jumpToNewEnvironment(kFullTSAID, kTSA37, kNorth);
+ else
+ vm->jumpToNewEnvironment(kTinyTSAID, kTinyTSA37, kNorth);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/pegasuschip.h b/engines/pegasus/items/biochips/pegasuschip.h
new file mode 100644
index 0000000000..7597424821
--- /dev/null
+++ b/engines/pegasus/items/biochips/pegasuschip.h
@@ -0,0 +1,55 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_PEGASUSCHIP_H
+#define PEGASUS_ITEMS_BIOCHIPS_PEGASUSCHIP_H
+
+#include "pegasus/hotspot.h"
+#include "pegasus/items/biochips/biochipitem.h"
+
+namespace Pegasus {
+
+class PegasusChip : public BiochipItem {
+public:
+ PegasusChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~PegasusChip();
+
+ void select();
+
+ void setUpPegasusChip();
+
+ // Called to set up the Pegasus chip when the Pegasus chip is the current chip but does not
+ // own the center area.
+ void setUpPegasusChipRude();
+ void activatePegasusHotspots();
+ void clickInPegasusHotspot();
+
+protected:
+ Hotspot _recallSpot;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/retscanchip.cpp b/engines/pegasus/items/biochips/retscanchip.cpp
new file mode 100644
index 0000000000..84b74a63d2
--- /dev/null
+++ b/engines/pegasus/items/biochips/retscanchip.cpp
@@ -0,0 +1,49 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/retscanchip.h"
+
+namespace Pegasus {
+
+RetScanChip::RetScanChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ BiochipItem(id, neighborhood, room, direction) {
+}
+
+void RetScanChip::searchForLaser() {
+ ItemExtraEntry entry;
+ findItemExtra(kRetinalScanSearching, entry);
+
+ if (g_AIArea)
+ g_AIArea->playAIAreaSequence(kBiochipSignature, kMiddleAreaSignature, entry.extraStart, entry.extraStop);
+
+ findItemExtra(kRetinalScanActivated, entry);
+ if (g_AIArea)
+ g_AIArea->playAIAreaSequence(kBiochipSignature, kRightAreaSignature, entry.extraStart, entry.extraStop);
+
+ setItemState(kRetinalSimulating);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/retscanchip.h b/engines/pegasus/items/biochips/retscanchip.h
new file mode 100644
index 0000000000..153e6cd071
--- /dev/null
+++ b/engines/pegasus/items/biochips/retscanchip.h
@@ -0,0 +1,43 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_RETSCANCHIP_H
+#define PEGASUS_ITEMS_BIOCHIPS_RETSCANCHIP_H
+
+#include "pegasus/items/biochips/biochipitem.h"
+
+namespace Pegasus {
+
+class RetScanChip : public BiochipItem {
+public:
+ RetScanChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~RetScanChip() {}
+
+ void searchForLaser();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/biochips/shieldchip.cpp b/engines/pegasus/items/biochips/shieldchip.cpp
new file mode 100644
index 0000000000..58cbfcc4ec
--- /dev/null
+++ b/engines/pegasus/items/biochips/shieldchip.cpp
@@ -0,0 +1,53 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/items/biochips/shieldchip.h"
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+ShieldChip *g_shield = 0;
+
+ShieldChip::ShieldChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ BiochipItem(id, neighborhood, room, direction) {
+ g_shield = this;
+}
+
+void ShieldChip::select() {
+ BiochipItem::select();
+ GameState.setShieldOn(true);
+ if (g_neighborhood)
+ g_neighborhood->shieldOn();
+}
+
+void ShieldChip::deselect() {
+ BiochipItem::deselect();
+ GameState.setShieldOn(false);
+ if (g_neighborhood)
+ g_neighborhood->shieldOff();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/biochips/shieldchip.h b/engines/pegasus/items/biochips/shieldchip.h
new file mode 100644
index 0000000000..69c6369236
--- /dev/null
+++ b/engines/pegasus/items/biochips/shieldchip.h
@@ -0,0 +1,46 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_BIOCHIPS_SHIELDCHIP_H
+#define PEGASUS_ITEMS_BIOCHIPS_SHIELDCHIP_H
+
+#include "pegasus/items/biochips/biochipitem.h"
+
+namespace Pegasus {
+
+class ShieldChip : public BiochipItem {
+public:
+ ShieldChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~ShieldChip() {}
+
+ void select();
+ void deselect();
+};
+
+extern ShieldChip *g_shield;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/inventory.cpp b/engines/pegasus/items/inventory.cpp
new file mode 100644
index 0000000000..57923b105d
--- /dev/null
+++ b/engines/pegasus/items/inventory.cpp
@@ -0,0 +1,175 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/constants.h"
+#include "pegasus/items/item.h"
+#include "pegasus/items/inventory.h"
+
+namespace Pegasus {
+
+Inventory::Inventory() {
+ _weightLimit = 100;
+ _ownerID = kNoActorID;
+ _referenceCount = 0;
+}
+
+Inventory::~Inventory() {
+}
+
+void Inventory::setWeightLimit(WeightType limit) {
+ _weightLimit = limit;
+ // *** What to do if the new weight limit is greater than the current weight?
+}
+
+WeightType Inventory::getWeight() {
+ WeightType result = 0;
+
+ for (ItemIterator it = _inventoryList.begin(); it != _inventoryList.end(); it++)
+ result += (*it)->getItemWeight();
+
+ return result;
+}
+
+// If the item already belongs, just return kInventoryOK.
+InventoryResult Inventory::addItem(Item *item) {
+ if (itemInInventory(item))
+ return kInventoryOK;
+
+ if (getWeight() + item->getItemWeight() > _weightLimit)
+ return kTooMuchWeight;
+
+ _inventoryList.push_back(item);
+ item->setItemOwner(_ownerID);
+
+ ++_referenceCount;
+ return kInventoryOK;
+}
+
+InventoryResult Inventory::removeItem(Item *item) {
+ for (ItemIterator it = _inventoryList.begin(); it != _inventoryList.end(); it++) {
+ if (*it == item) {
+ _inventoryList.erase(it);
+ item->setItemOwner(kNoActorID);
+
+ ++_referenceCount;
+ return kInventoryOK;
+ }
+ }
+
+ return kItemNotInInventory;
+}
+
+InventoryResult Inventory::removeItem(ItemID id) {
+ Item *item = findItemByID(id);
+
+ if (item) {
+ _inventoryList.remove(item);
+ item->setItemOwner(kNoActorID);
+
+ ++_referenceCount;
+ return kInventoryOK;
+ }
+
+ return kItemNotInInventory;
+}
+
+void Inventory::removeAllItems() {
+ _inventoryList.clear();
+ ++_referenceCount;
+}
+
+bool Inventory::itemInInventory(Item *item) {
+ for (ItemIterator it = _inventoryList.begin(); it != _inventoryList.end(); it++)
+ if (*it == item)
+ return true;
+
+ return false;
+}
+
+bool Inventory::itemInInventory(ItemID id) {
+ return findItemByID(id) != NULL;
+}
+
+Item *Inventory::getItemAt(int32 index) {
+ int32 i = 0;
+ for (ItemIterator it = _inventoryList.begin(); it != _inventoryList.end(); it++, i++)
+ if (i == index)
+ return *it;
+
+ return 0;
+}
+
+ItemID Inventory::getItemIDAt(int32 index) {
+ Item *item = getItemAt(index);
+
+ if (item)
+ return item->getObjectID();
+
+ return kNoItemID;
+}
+
+Item *Inventory::findItemByID(ItemID id) {
+ return _inventoryList.findItemByID(id);
+}
+
+// Return -1 if not found.
+
+int32 Inventory::findIndexOf(Item *item) {
+ uint32 i = 0;
+ for (ItemIterator it = _inventoryList.begin(); it != _inventoryList.end(); it++, i++)
+ if (*it == item)
+ return i;
+
+ return -1;
+}
+
+// Return -1 if not found.
+
+int32 Inventory::findIndexOf(ItemID id) {
+ uint32 i = 0;
+ for (ItemIterator it = _inventoryList.begin(); it != _inventoryList.end(); it++, i++)
+ if ((*it)->getObjectID() == id)
+ return i;
+
+ return -1;
+}
+
+WeightType Inventory::getWeightLimit() {
+ return _weightLimit;
+}
+
+int32 Inventory::getNumItems() {
+ return _inventoryList.size();
+}
+
+void Inventory::setOwnerID(const ActorID id) {
+ _ownerID = id;
+}
+
+ActorID Inventory::getOwnerID() const {
+ return _ownerID;
+}
+
+} // End of namespae Pegasus
diff --git a/engines/pegasus/items/inventory.h b/engines/pegasus/items/inventory.h
new file mode 100644
index 0000000000..796ec49556
--- /dev/null
+++ b/engines/pegasus/items/inventory.h
@@ -0,0 +1,80 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_INVENTORY_H
+#define PEGASUS_ITEMS_INVENTORY_H
+
+#include "pegasus/types.h"
+#include "pegasus/items/itemlist.h"
+
+namespace Pegasus {
+
+class Item;
+
+// Inventories have a "current item". This item is the default item the player can
+// use. In a text adventure system, the current item would be "it", as in
+// "Hit the troll with it," where "it" would refer to some weapon which is the current
+// item. In a graphic adventure, the current item would be the item the user selects
+// to use with the mouse or other pointing device.
+
+class Inventory {
+public:
+ Inventory();
+ virtual ~Inventory();
+
+ WeightType getWeightLimit();
+ void setWeightLimit(WeightType limit);
+ WeightType getWeight();
+
+ virtual InventoryResult addItem(Item *item);
+ virtual InventoryResult removeItem(Item *item);
+ virtual InventoryResult removeItem(ItemID id);
+ virtual bool itemInInventory(Item *item);
+ virtual bool itemInInventory(ItemID id);
+ virtual Item *getItemAt(int32 index);
+ virtual ItemID getItemIDAt(int32 index);
+ virtual Item *findItemByID(ItemID id);
+ virtual int32 findIndexOf(Item *item);
+ virtual int32 findIndexOf(ItemID id);
+ int32 getNumItems();
+ virtual void removeAllItems();
+
+ void setOwnerID(const ActorID id);
+ ActorID getOwnerID() const;
+
+ uint32 getReferenceCount() { return _referenceCount; }
+
+protected:
+ WeightType _weightLimit;
+ ActorID _ownerID;
+ ItemList _inventoryList;
+
+private:
+ uint32 _referenceCount;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/inventory/airmask.cpp b/engines/pegasus/items/inventory/airmask.cpp
new file mode 100644
index 0000000000..c65dd36102
--- /dev/null
+++ b/engines/pegasus/items/inventory/airmask.cpp
@@ -0,0 +1,249 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+AirMask *g_airMask = 0;
+
+// Based on full == 100, which is scale used by GetAirLeft().
+static const TimeValue kOxygenLowThreshold = 25;
+
+void AirMask::airMaskTimerExpired() {
+ if (g_neighborhood)
+ g_neighborhood->checkAirMask();
+}
+
+AirMask::AirMask(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ InventoryItem(id, neighborhood, room, direction), _toggleSpot(kAirMaskToggleSpotID) {
+ g_airMask = this;
+ _toggleSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 10, kAIMiddleAreaTop + 17, kAIMiddleAreaLeft + 110, kAIMiddleAreaTop + 57));
+ _toggleSpot.setHotspotFlags(kAirMaskSpotFlag);
+ g_allHotspots.push_back(&_toggleSpot);
+ setItemState(kAirMaskEmptyOff);
+ _oxygenTimer.primeFuse(0);
+ _oxygenTimer.setFunctor(new Common::Functor0Mem<void, AirMask>(this, &AirMask::airMaskTimerExpired));
+}
+
+AirMask::~AirMask() {
+ g_allHotspots.removeOneHotspot(kAirMaskToggleSpotID);
+ g_airMask = 0;
+}
+
+void AirMask::writeToStream(Common::WriteStream *stream) {
+ InventoryItem::writeToStream(stream);
+ stream->writeUint32BE(_oxygenTimer.getTimeRemaining());
+}
+
+void AirMask::readFromStream(Common::ReadStream *stream) {
+ _oxygenTimer.stopFuse();
+ InventoryItem::readFromStream(stream);
+ _oxygenTimer.primeFuse(stream->readUint32BE());
+}
+
+void AirMask::putMaskOn() {
+ AirQuality airQuality;
+
+ if (g_neighborhood)
+ airQuality = g_neighborhood->getAirQuality(GameState.getCurrentRoom());
+ else
+ airQuality = kAirQualityGood;
+
+ uint airLevel = getAirLeft();
+ ItemState newState = getItemState();
+ ItemState oldState = newState;
+
+ if (airLevel == 0) {
+ newState = kAirMaskEmptyFilter;
+ } else if (airLevel <= kOxygenLowThreshold) {
+ if (airQuality == kAirQualityVacuum)
+ newState = kAirMaskLowOn;
+ else
+ newState = kAirMaskLowFilter;
+ } else {
+ if (airQuality == kAirQualityVacuum)
+ newState = kAirMaskFullOn;
+ else
+ newState = kAirMaskFullFilter;
+ }
+
+ if (newState != oldState)
+ setItemState(newState);
+}
+
+void AirMask::takeMaskOff() {
+ uint airLevel = getAirLeft();
+ ItemState newState = getItemState();
+ ItemState oldState = newState;
+
+ if (airLevel == 0)
+ newState = kAirMaskEmptyOff;
+ else if (airLevel <= kOxygenLowThreshold)
+ newState = kAirMaskLowOff;
+ else
+ newState = kAirMaskFullOff;
+
+ if (newState != oldState)
+ setItemState(newState);
+}
+
+void AirMask::toggleItemState() {
+ if (isAirMaskInUse())
+ takeMaskOff();
+ else
+ putMaskOn();
+}
+
+void AirMask::airQualityChanged() {
+ if (isAirMaskInUse())
+ putMaskOn();
+ else
+ takeMaskOff();
+}
+
+void AirMask::setItemState(const ItemState newState) {
+ if (newState != getItemState()) {
+ InventoryItem::setItemState(newState);
+
+ switch (newState) {
+ case kAirMaskFullOn:
+ case kAirMaskLowOn:
+ if (!_oxygenTimer.isFuseLit()) {
+ _oxygenTimer.lightFuse();
+ startIdling();
+ }
+ break;
+ default:
+ if (_oxygenTimer.isFuseLit()) {
+ _oxygenTimer.stopFuse();
+ stopIdling();
+ }
+ break;
+ }
+
+ if (g_neighborhood)
+ g_neighborhood->checkAirMask();
+
+ g_AIArea->checkMiddleArea();
+ }
+}
+
+void AirMask::useIdleTime() {
+ if (getAirLeft() == 0)
+ setItemState(kAirMaskEmptyOff);
+ else if (getAirLeft() <= kOxygenLowThreshold)
+ setItemState(kAirMaskLowOn);
+}
+
+void AirMask::refillAirMask() {
+ switch (getItemState()) {
+ case kAirMaskEmptyOff:
+ case kAirMaskLowOff:
+ setItemState(kAirMaskFullOff);
+ break;
+ case kAirMaskEmptyFilter:
+ case kAirMaskLowFilter:
+ setItemState(kAirMaskFullFilter);
+ break;
+ case kAirMaskLowOn:
+ setItemState(kAirMaskFullOn);
+ break;
+ }
+
+ if (_oxygenTimer.isFuseLit()) {
+ _oxygenTimer.stopFuse();
+ _oxygenTimer.primeFuse(kOxyMaskFullTime);
+ _oxygenTimer.lightFuse();
+ } else {
+ _oxygenTimer.primeFuse(kOxyMaskFullTime);
+ }
+}
+
+// Doesn't return 0 until the timer is actually at 0.
+uint AirMask::getAirLeft() {
+ return CLIP<int>(((_oxygenTimer.getTimeRemaining() * 100) + kOxyMaskFullTime - 1) / kOxyMaskFullTime, 0, 100);
+}
+
+bool AirMask::isAirMaskInUse() {
+ switch (getItemState()) {
+ case kAirMaskEmptyOff:
+ case kAirMaskLowOff:
+ case kAirMaskFullOff:
+ return false;
+ break;
+ default:
+ return true;
+ break;
+ }
+}
+
+bool AirMask::isAirMaskOn() {
+ switch (getItemState()) {
+ case kAirMaskLowOn:
+ case kAirMaskFullOn:
+ return true;
+ break;
+ default:
+ return false;
+ break;
+ }
+}
+
+bool AirMask::isAirFilterOn() {
+ switch (getItemState()) {
+ case kAirMaskEmptyFilter:
+ case kAirMaskLowFilter:
+ case kAirMaskFullFilter:
+ return true;
+ break;
+ default:
+ return false;
+ break;
+ }
+}
+
+void AirMask::addedToInventory() {
+ GameState.setMarsMaskOnFiller(false);
+}
+
+void AirMask::removedFromInventory() {
+ if (isAirMaskInUse())
+ toggleItemState();
+}
+
+void AirMask::activateAirMaskHotspots() {
+ _toggleSpot.setActive();
+}
+
+void AirMask::clickInAirMaskHotspot() {
+ toggleItemState();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/inventory/airmask.h b/engines/pegasus/items/inventory/airmask.h
new file mode 100644
index 0000000000..6a2d708a6c
--- /dev/null
+++ b/engines/pegasus/items/inventory/airmask.h
@@ -0,0 +1,76 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_INVENTORY_AIRMASK_H
+#define PEGASUS_ITEMS_INVENTORY_AIRMASK_H
+
+#include "pegasus/hotspot.h"
+#include "pegasus/timers.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+class AirMask : public InventoryItem, private Idler {
+public:
+ AirMask(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~AirMask();
+
+ virtual void writeToStream(Common::WriteStream *);
+ virtual void readFromStream(Common::ReadStream *);
+
+ virtual void setItemState(const ItemState);
+ void putMaskOn();
+ void takeMaskOff();
+ void toggleItemState();
+ void airQualityChanged();
+
+ bool isAirMaskInUse();
+ bool isAirMaskOn();
+ bool isAirFilterOn();
+
+ void refillAirMask();
+
+ // Returns a percentage
+ uint getAirLeft();
+
+ void activateAirMaskHotspots();
+ void clickInAirMaskHotspot();
+
+protected:
+ void airMaskTimerExpired();
+
+ virtual void removedFromInventory();
+ virtual void addedToInventory();
+ void useIdleTime();
+
+ Hotspot _toggleSpot;
+ FuseFunction _oxygenTimer;
+};
+
+extern AirMask *g_airMask;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/inventory/gascanister.cpp b/engines/pegasus/items/inventory/gascanister.cpp
new file mode 100644
index 0000000000..bf63cc6542
--- /dev/null
+++ b/engines/pegasus/items/inventory/gascanister.cpp
@@ -0,0 +1,46 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/ai/ai_area.h"
+#include "pegasus/items/inventory/gascanister.h"
+
+namespace Pegasus {
+
+GasCanister::GasCanister(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ InventoryItem(id, neighborhood, room, direction) {
+}
+
+void GasCanister::select() {
+ InventoryItem::select();
+ takeSharedArea();
+}
+
+void GasCanister::takeSharedArea() {
+ ItemExtraEntry entry;
+ findItemExtra(kGasCanLoop, entry);
+ g_AIArea->loopAIAreaSequence(kInventorySignature, kMiddleAreaSignature, entry.extraStart, entry.extraStop);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/inventory/gascanister.h b/engines/pegasus/items/inventory/gascanister.h
new file mode 100644
index 0000000000..7d4d8193f5
--- /dev/null
+++ b/engines/pegasus/items/inventory/gascanister.h
@@ -0,0 +1,44 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_INVENTORY_GASCANISTER_H
+#define PEGASUS_ITEMS_INVENTORY_GASCANISTER_H
+
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+class GasCanister : public InventoryItem {
+public:
+ GasCanister(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~GasCanister() {}
+
+ void select();
+ void takeSharedArea();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/inventory/inventoryitem.cpp b/engines/pegasus/items/inventory/inventoryitem.cpp
new file mode 100644
index 0000000000..4399708879
--- /dev/null
+++ b/engines/pegasus/items/inventory/inventoryitem.cpp
@@ -0,0 +1,110 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/stream.h"
+
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+InventoryItem::InventoryItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ Item(id, neighborhood, room, direction) {
+
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ Common::SeekableReadStream *leftInfo = vm->_resFork->getResource(MKTAG('L', 'e', 'f', 't'), kItemBaseResID + id);
+ if (leftInfo) {
+ _leftAreaInfo = readItemState(leftInfo);
+ delete leftInfo;
+ } else {
+ _leftAreaInfo.numEntries = 0;
+ _leftAreaInfo.entries = 0;
+ }
+
+ Common::SeekableReadStream *inventoryInfo = vm->_resFork->getResource(MKTAG('I', 'n', 'v', 'I'), kItemBaseResID + id);
+ if (inventoryInfo) {
+ _inventoryInfo.panelStart = inventoryInfo->readUint32BE();
+ _inventoryInfo.panelStop = inventoryInfo->readUint32BE();
+ delete inventoryInfo;
+ } else {
+ _inventoryInfo.panelStart = _inventoryInfo.panelStop = 0;
+ }
+
+ _itemAnimationTime = 0;
+}
+
+InventoryItem::~InventoryItem() {
+ delete[] _leftAreaInfo.entries;
+}
+
+ItemType InventoryItem::getItemType() {
+ return kInventoryItemType;
+}
+
+TimeValue InventoryItem::getLeftAreaTime() const {
+ if (!_leftAreaInfo.entries)
+ return 0xffffffff;
+
+ TimeValue time;
+ ItemState state;
+
+ findItemStateEntryByState(_leftAreaInfo, _itemState, time);
+ if (time == 0xffffffff)
+ getItemStateEntry(_leftAreaInfo, 0, state, time);
+
+ return time;
+}
+
+void InventoryItem::setAnimationTime(const TimeValue time) {
+ _itemAnimationTime = time;
+}
+
+TimeValue InventoryItem::getAnimationTime() const {
+ return _itemAnimationTime;
+}
+
+// Must affect images in left area.
+void InventoryItem::select() {
+ Item::select();
+
+ if (g_AIArea)
+ g_AIArea->setAIAreaToTime(kInventorySignature, kLeftAreaSignature, getLeftAreaTime());
+}
+
+void InventoryItem::deselect() {
+ Item::deselect();
+
+ if (g_AIArea)
+ g_AIArea->setAIAreaToTime(kInventorySignature, kLeftAreaSignature, 0xffffffff);
+}
+
+void InventoryItem::getPanelTimes(TimeValue &start, TimeValue &stop) const {
+ start = _inventoryInfo.panelStart;
+ stop = _inventoryInfo.panelStop;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/inventory/inventoryitem.h b/engines/pegasus/items/inventory/inventoryitem.h
new file mode 100644
index 0000000000..9d78113014
--- /dev/null
+++ b/engines/pegasus/items/inventory/inventoryitem.h
@@ -0,0 +1,67 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_INVENTORY_INVENTORYITEM_H
+#define PEGASUS_ITEMS_INVENTORY_INVENTORYITEM_H
+
+#include "pegasus/items/item.h"
+
+namespace Pegasus {
+
+// JMPInventoryInfo contains the resource data used by InventoryItems.
+
+struct JMPInventoryInfo {
+ TimeValue panelStart;
+ TimeValue panelStop;
+};
+
+class InventoryItem : public Item {
+public:
+ InventoryItem(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~InventoryItem();
+
+ virtual ItemType getItemType();
+
+ void getPanelTimes(TimeValue &, TimeValue &) const;
+ TimeValue getLeftAreaTime() const;
+
+ void setAnimationTime(const TimeValue);
+ TimeValue getAnimationTime() const;
+
+ virtual void toggleItemState() {}
+
+ // Must affect images in left area.
+ virtual void select();
+ virtual void deselect();
+
+protected:
+ JMPInventoryInfo _inventoryInfo;
+ ItemStateInfo _leftAreaInfo;
+ TimeValue _itemAnimationTime;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/inventory/keycard.cpp b/engines/pegasus/items/inventory/keycard.cpp
new file mode 100644
index 0000000000..c818b6675b
--- /dev/null
+++ b/engines/pegasus/items/inventory/keycard.cpp
@@ -0,0 +1,59 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/items/inventory/keycard.h"
+
+namespace Pegasus {
+
+KeyCard::KeyCard(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
+ InventoryItem(id, neighborhood, room, direction) {
+ setItemState(kFlashlightOff);
+}
+
+void KeyCard::toggleItemState() {
+ if (getItemState() == kFlashlightOff)
+ setItemState(kFlashlightOn);
+ else
+ setItemState(kFlashlightOff);
+}
+
+void KeyCard::setItemState(const ItemState newState) {
+ if (newState != getItemState()) {
+ InventoryItem::setItemState(newState);
+ ((PegasusEngine *)g_engine)->checkFlashlight();
+ }
+}
+
+bool KeyCard::isFlashlightOn() {
+ return getItemState() == kFlashlightOn;
+}
+
+void KeyCard::removedFromInventory() {
+ if (isFlashlightOn())
+ setItemState(kFlashlightOff);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/inventory/keycard.h b/engines/pegasus/items/inventory/keycard.h
new file mode 100644
index 0000000000..846f40e6e5
--- /dev/null
+++ b/engines/pegasus/items/inventory/keycard.h
@@ -0,0 +1,48 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_INVENTORY_KEYCARD_H
+#define PEGASUS_ITEMS_INVENTORY_KEYCARD_H
+
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+class KeyCard : public InventoryItem {
+public:
+ KeyCard(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+ virtual ~KeyCard() {}
+
+ virtual void toggleItemState();
+ virtual void setItemState(const ItemState);
+ bool isFlashlightOn();
+
+protected:
+ virtual void removedFromInventory();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/inventorypicture.cpp b/engines/pegasus/items/inventorypicture.cpp
new file mode 100644
index 0000000000..fc812faae2
--- /dev/null
+++ b/engines/pegasus/items/inventorypicture.cpp
@@ -0,0 +1,370 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/transition.h"
+#include "pegasus/items/inventorypicture.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+InventoryPicture::InventoryPicture(const DisplayElementID id, InputHandler *nextHandler, Inventory *inventory) :
+ InputHandler(nextHandler), Picture(id), _panelMovie(kNoDisplayElement){
+ _inventory = inventory;
+ _lastReferenceCount = 0xffffffff;
+
+ if (_inventory->getNumItems() > 0) {
+ _currentItemIndex = 0;
+ _currentItem = (Item *)_inventory->getItemAt(0);
+ } else {
+ _currentItemIndex = -1;
+ _currentItem = 0;
+ }
+
+ _active = false;
+ _shouldDrawHighlight = true;
+ _itemsPerRow = 1;
+ _numberOfRows = 1;
+ _itemWidth = 0;
+ _itemHeight = 0;
+ _itemX = 0;
+ _itemY = 0;
+}
+
+void InventoryPicture::initInventoryImage(Transition *transition) {
+ initFromPICTFile(_pictName, true);
+ _panelMovie.shareSurface(this);
+ _panelMovie.initFromMovieFile(_movieName);
+ _panelMovie.getBounds(_highlightBounds);
+ _panelMovie.setTriggeredElement(transition);
+ _highlightImage.initFromPICTFile(_highlightName, true);
+}
+
+void InventoryPicture::throwAwayInventoryImage() {
+ if (isSurfaceValid()) {
+ _panelMovie.releaseMovie();
+ _highlightImage.deallocateSurface();
+ deallocateSurface();
+ }
+}
+
+void InventoryPicture::getItemXY(uint32 index, CoordType &x, CoordType &y) {
+ x = (index % _itemsPerRow) * _itemWidth + _itemX;
+ y = (index / _itemsPerRow) * _itemHeight + _itemY;
+}
+
+void InventoryPicture::drawItemHighlight(const Common::Rect &r) {
+ if (_highlightImage.isSurfaceValid()) {
+ Common::Rect r2 = _highlightBounds;
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ r2.translate(bounds.left, bounds.top);
+ r2 = r2.findIntersectingRect(r);
+ if (!r2.isEmpty()) {
+ Common::Rect r1 = r2;
+ r1.translate(-bounds.left - _highlightBounds.left, -bounds.top - _highlightBounds.top);
+ _highlightImage.drawImage(r1, r2);
+ }
+ }
+}
+
+void InventoryPicture::draw(const Common::Rect &r) {
+ Picture::draw(r);
+ if (_inventory->getNumItems() != 0 && _shouldDrawHighlight)
+ drawItemHighlight(r);
+}
+
+// Assumes index >= 0.
+void InventoryPicture::setCurrentItemIndex(int32 index) {
+ if (index >= _inventory->getNumItems())
+ index = _inventory->getNumItems() - 1;
+
+ Item *currentItem = 0;
+ if (index >= 0)
+ currentItem = (Item *)_inventory->getItemAt(index);
+
+ if (currentItem != _currentItem) {
+ if (_currentItem) {
+ if (_currentItem->isSelected())
+ _currentItem->deselect();
+
+ if (_active)
+ unhighlightCurrentItem();
+ }
+
+ _currentItemIndex = index;
+ _currentItem = currentItem;
+ if (_currentItem) {
+ _currentItem->select();
+
+ if (_active)
+ highlightCurrentItem();
+ }
+
+ if (_active)
+ triggerRedraw();
+ }
+}
+
+void InventoryPicture::setCurrentItemID(ItemID id) {
+ int32 index = _inventory->findIndexOf(id);
+ if (index >= 0)
+ setCurrentItemIndex(index);
+}
+
+InventoryResult InventoryPicture::addInventoryItem(Item *item) {
+ InventoryResult result = _inventory->addItem(item);
+
+ if (result == kInventoryOK)
+ setCurrentItemIndex(_inventory->findIndexOf(item));
+
+ return result;
+}
+
+InventoryResult InventoryPicture::removeInventoryItem(Item *item) {
+ InventoryResult result = _inventory->removeItem(item);
+
+ if (result == kInventoryOK)
+ setCurrentItemIndex(getCurrentItemIndex());
+
+ return result;
+}
+
+void InventoryPicture::removeAllItems() {
+ _inventory->removeAllItems();
+ setCurrentItemIndex(0);
+}
+
+bool InventoryPicture::itemInInventory(Item *item) {
+ return _inventory->itemInInventory(item);
+}
+
+bool InventoryPicture::itemInInventory(const ItemID id) {
+ return _inventory->itemInInventory(id);
+}
+
+void InventoryPicture::panelUp() {
+ allowInput(true);
+}
+
+// Must ensure that the picture matches the _inventory member variable.
+void InventoryPicture::activateInventoryPicture() {
+ if (_active)
+ return;
+
+ allowInput(false);
+
+ if (_lastReferenceCount != _inventory->getReferenceCount()) {
+ uint32 numItems = _inventory->getNumItems();
+
+ CoordType x, y;
+ getItemXY(0, x, y);
+ _panelMovie.moveMovieBoxTo(x, y);
+ _panelMovie.show();
+
+ for (uint32 i = 0; i < numItems; i++) {
+ Item *item = (Item *)_inventory->getItemAt(i);
+ if (item == _currentItem)
+ item->select();
+
+ getItemXY(i, x, y);
+ _panelMovie.moveMovieBoxTo(x, y);
+ _panelMovie.setTime(getItemPanelTime(item));
+ _panelMovie.redrawMovieWorld();
+ }
+
+ uint32 numSlots = _itemsPerRow * _numberOfRows;
+
+ for (uint32 i = numItems; i < numSlots; i++) {
+ getItemXY(i, x, y);
+ _panelMovie.moveMovieBoxTo(x, y);
+ _panelMovie.setTime(0);
+ _panelMovie.redrawMovieWorld();
+ }
+
+ _lastReferenceCount = _inventory->getReferenceCount();
+ }
+
+ show(); // *** Do we really need this?
+ if (_currentItem)
+ highlightCurrentItem();
+
+ _active = true;
+}
+
+void InventoryPicture::deactivateInventoryPicture() {
+ if (!_active)
+ return;
+
+ _active = false;
+ allowInput(false);
+ _panelMovie.hide();
+ hide();
+
+ if (_inventory->getNumItems() != 0)
+ if (!_currentItem->isActive())
+ _currentItem->activate();
+}
+
+void InventoryPicture::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_active) {
+ if (input.upButtonDown()) {
+ if (_currentItemIndex - _itemsPerRow >= 0)
+ setCurrentItemIndex(_currentItemIndex - _itemsPerRow);
+ } else if (input.downButtonDown()) {
+ if (_currentItemIndex + _itemsPerRow < _inventory->getNumItems())
+ setCurrentItemIndex(_currentItemIndex + _itemsPerRow);
+ } else if (input.leftButtonDown()) {
+ if ((_currentItemIndex % _itemsPerRow) != 0)
+ setCurrentItemIndex(_currentItemIndex - 1);
+ } else if (input.rightButtonDown()) {
+ if (((_currentItemIndex + 1) % _itemsPerRow) != 0 && _currentItemIndex + 1 < _inventory->getNumItems())
+ setCurrentItemIndex(_currentItemIndex + 1);
+ }
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void InventoryPicture::highlightCurrentItem() {
+ CoordType x, y;
+ getItemXY(_currentItemIndex, x, y);
+ _highlightBounds.moveTo(x, y);
+}
+
+InventoryItemsPicture::InventoryItemsPicture(const DisplayElementID id, InputHandler *nextHandler, Inventory *inventory) :
+ InventoryPicture(id, nextHandler, inventory) {
+ _pictName = "Images/Items/Inventory/Inventory Panel";
+ _movieName = "Images/Items/Inventory/Inventory Panel Movie";
+ _highlightName = "Images/Items/Inventory/Inventory Hilite";
+
+ _itemsPerRow = 3;
+ _numberOfRows = 3;
+ _itemWidth = 88;
+ _itemHeight = 64;
+ _itemX = 8;
+ _itemY = 26;
+ _isLooping = true;
+}
+
+void InventoryItemsPicture::loopCurrentItem() {
+ if (_isLooping) {
+ CoordType x, y;
+ getItemXY(_currentItemIndex, x, y);
+ _panelMovie.moveMovieBoxTo(x, y);
+ _highlightBounds.moveTo(x, y);
+
+ TimeValue start, stop;
+ ((InventoryItem *)_currentItem)->getPanelTimes(start, stop);
+ _panelMovie.stop();
+ _panelMovie.setFlags(0);
+ _panelMovie.setSegment(start, stop);
+ _panelMovie.setFlags(kLoopTimeBase);
+ _panelMovie.setTime(((InventoryItem *)_currentItem)->getAnimationTime());
+ _panelMovie.start();
+ }
+}
+
+void InventoryItemsPicture::highlightCurrentItem() {
+ InventoryPicture::highlightCurrentItem();
+ loopCurrentItem();
+}
+
+void InventoryItemsPicture::unhighlightCurrentItem() {
+ InventoryPicture::unhighlightCurrentItem();
+ _panelMovie.stop();
+ _panelMovie.setFlags(0);
+ ((InventoryItem *)_currentItem)->setAnimationTime(_panelMovie.getTime());
+}
+
+TimeValue InventoryItemsPicture::getItemPanelTime(Item *item) {
+ TimeValue start, stop;
+ ((InventoryItem *)item)->getPanelTimes(start, stop);
+ ((InventoryItem *)item)->setAnimationTime(start);
+ return start;
+}
+
+void InventoryItemsPicture::deactivateInventoryPicture() {
+ if (_active) {
+ InventoryPicture::deactivateInventoryPicture();
+ _panelMovie.stop();
+ _panelMovie.setFlags(0);
+ _panelMovie.setSegment(0, _panelMovie.getDuration());
+ _isLooping = true;
+ }
+}
+
+void InventoryItemsPicture::playEndMessage(DisplayElement *pushElement) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ Movie endMessage(0);
+
+ _shouldDrawHighlight = false;
+ endMessage.shareSurface(this);
+ endMessage.initFromMovieFile("Images/Caldoria/A56 Congrats");
+ endMessage.moveMovieBoxTo(kFinalMessageLeft - kInventoryPushLeft, kFinalMessageTop - kInventoryPushTop);
+ endMessage.setTriggeredElement(pushElement);
+ endMessage.start();
+
+ while (endMessage.isRunning()) {
+ vm->checkCallBacks();
+ vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ endMessage.stop();
+}
+
+BiochipPicture::BiochipPicture(const DisplayElementID id, InputHandler *nextHandler, Inventory *inventory) :
+ InventoryPicture(id, nextHandler, inventory) {
+ _pictName = "Images/Items/Biochips/Biochip Panel";
+ _movieName = "Images/Items/Biochips/Biochip Panel Movie";
+ _highlightName = "Images/Items/Biochips/BioChip Hilite";
+
+ _itemsPerRow = 4;
+ _numberOfRows = 2;
+ _itemWidth = 46;
+ _itemHeight = 46;
+ _itemX = 4;
+ _itemY = 24;
+}
+
+void BiochipPicture::unhighlightCurrentItem() {
+ InventoryPicture::unhighlightCurrentItem();
+ CoordType x, y;
+ getItemXY(_currentItemIndex, x, y);
+ _panelMovie.show();
+ _panelMovie.moveMovieBoxTo(x, y);
+ _panelMovie.setTime(getItemPanelTime(_currentItem));
+ _panelMovie.redrawMovieWorld();
+}
+
+TimeValue BiochipPicture::getItemPanelTime(Item *item) {
+ return ((BiochipItem *)item)->getPanelTime();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/inventorypicture.h b/engines/pegasus/items/inventorypicture.h
new file mode 100644
index 0000000000..88a4a4ba75
--- /dev/null
+++ b/engines/pegasus/items/inventorypicture.h
@@ -0,0 +1,125 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_INVENTORYPICTURE_H
+#define PEGASUS_ITEMS_INVENTORYPICTURE_H
+
+#include "pegasus/input.h"
+#include "pegasus/movie.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+class Inventory;
+class Item;
+class Input;
+class Transition;
+
+class InventoryPicture : public InputHandler, public Picture {
+public:
+ InventoryPicture(const DisplayElementID, InputHandler *, Inventory *);
+ virtual ~InventoryPicture() {}
+
+ void initInventoryImage(Transition *);
+ void throwAwayInventoryImage();
+
+ void panelUp();
+ void activateInventoryPicture();
+ void deactivateInventoryPicture();
+ void handleInput(const Input &, const Hotspot *);
+ bool wantsCursor() { return false; }
+
+ InventoryResult addInventoryItem(Item *);
+ InventoryResult removeInventoryItem(Item *);
+ void removeAllItems();
+ Item *getCurrentItem() { return _currentItem; }
+ void setCurrentItemIndex(int32);
+ void setCurrentItemID(ItemID);
+ int32 getCurrentItemIndex() { return _currentItemIndex; }
+ bool itemInInventory(Item *);
+ bool itemInInventory(const ItemID);
+
+protected:
+ void getItemXY(uint32, CoordType &, CoordType &);
+ void draw(const Common::Rect &);
+ void drawItemHighlight(const Common::Rect &);
+ virtual void highlightCurrentItem();
+ virtual void unhighlightCurrentItem() {}
+ virtual TimeValue getItemPanelTime(Item *) = 0;
+
+ Inventory *_inventory;
+ uint32 _lastReferenceCount;
+ Frame _highlightImage;
+ Movie _panelMovie;
+ int32 _currentItemIndex;
+ Item *_currentItem;
+ Common::Rect _highlightBounds;
+ bool _active, _shouldDrawHighlight;
+
+ Common::String _pictName;
+ Common::String _movieName;
+ Common::String _highlightName;
+ uint16 _itemsPerRow;
+ uint16 _numberOfRows;
+ uint16 _itemWidth;
+ uint16 _itemHeight;
+ uint16 _itemX;
+ uint16 _itemY;
+};
+
+class InventoryItemsPicture : public InventoryPicture {
+public:
+ InventoryItemsPicture(const DisplayElementID, InputHandler *, Inventory *);
+ virtual ~InventoryItemsPicture() {}
+
+ void deactivateInventoryPicture();
+
+ void disableLooping() { _isLooping = false; }
+
+ void playEndMessage(DisplayElement *);
+
+protected:
+ virtual void highlightCurrentItem();
+ virtual void unhighlightCurrentItem();
+ virtual TimeValue getItemPanelTime(Item *);
+ void loopCurrentItem();
+
+ InputHandler *_previousHandler;
+ bool _isLooping;
+};
+
+class BiochipPicture : public InventoryPicture {
+public:
+ BiochipPicture(const DisplayElementID, InputHandler *, Inventory *);
+ virtual ~BiochipPicture() {}
+
+protected:
+ virtual void unhighlightCurrentItem();
+ virtual TimeValue getItemPanelTime(Item *);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/item.cpp b/engines/pegasus/items/item.cpp
new file mode 100644
index 0000000000..8089f2b93d
--- /dev/null
+++ b/engines/pegasus/items/item.cpp
@@ -0,0 +1,314 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/error.h"
+#include "common/stream.h"
+
+#include "pegasus/constants.h"
+#include "pegasus/elements.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/surface.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/item.h"
+#include "pegasus/items/itemlist.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+
+namespace Pegasus {
+
+Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : IDObject(id) {
+ _itemNeighborhood = neighborhood;
+ _itemRoom = room;
+ _itemDirection = direction;
+ _itemWeight = 1;
+ _itemOwnerID = kNoActorID;
+ _itemState = 0;
+
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ Common::SeekableReadStream *info = vm->_resFork->getResource(kItemInfoResType, kItemBaseResID + id);
+ if (info) {
+ _itemInfo.infoLeftTime = info->readUint32BE();
+ _itemInfo.infoRightStart = info->readUint32BE();
+ _itemInfo.infoRightStop = info->readUint32BE();
+ _itemInfo.dragSpriteNormalID = info->readUint16BE();
+ _itemInfo.dragSpriteUsedID = info->readUint16BE();
+
+ if (vm->isDemo()) {
+ // Adjust info right times to account for the stuff that was chopped out of the
+ // info right movies.
+ // Assumes time scale of 600.
+
+ // Gap times in seconds
+ static const TimeValue kGap1 = 24;
+ static const TimeValue kGap2 = 34;
+ static const TimeValue kGap3 = 4;
+ static const TimeValue kGap4 = 4;
+
+ static const TimeValue kGapForGroup1 = kGap1;
+ static const TimeValue kGapForGroup2 = kGapForGroup1 + kGap2;
+ static const TimeValue kGapForGroup3 = kGapForGroup2 + kGap3;
+ static const TimeValue kGapForGroup4 = kGapForGroup3 + kGap4;
+
+ switch (id) {
+ case kHistoricalLog:
+ case kJourneymanKey:
+ case kKeyCard:
+ _itemInfo.infoRightStart -= 600 * kGapForGroup1;
+ _itemInfo.infoRightStop -= 600 * kGapForGroup1;
+ break;
+ case kAIBiochip:
+ _itemInfo.infoRightStart -= 600 * kGapForGroup2;
+ _itemInfo.infoRightStop -= 600 * kGapForGroup2;
+ break;
+ case kMapBiochip:
+ _itemInfo.infoRightStart -= 600 * kGapForGroup3;
+ _itemInfo.infoRightStop -= 600 * kGapForGroup3;
+ break;
+ case kPegasusBiochip:
+ _itemInfo.infoRightStart -= 600 * kGapForGroup4;
+ _itemInfo.infoRightStop -= 600 * kGapForGroup4;
+ break;
+ }
+ }
+
+ delete info;
+ } else {
+ memset(&_itemInfo, 0, sizeof(_itemInfo));
+ }
+
+ Common::SeekableReadStream *middleAreaInfo = vm->_resFork->getResource(kMiddleAreaInfoResType, kItemBaseResID + id);
+ if (middleAreaInfo) {
+ _sharedAreaInfo = readItemState(middleAreaInfo);
+ delete middleAreaInfo;
+ } else {
+ // Only kArgonPickup does not have this
+ memset(&_sharedAreaInfo, 0, sizeof(_sharedAreaInfo));
+ }
+
+ Common::SeekableReadStream *extraInfo = vm->_resFork->getResource(kItemExtraInfoResType, kItemBaseResID + id);
+ if (!extraInfo)
+ error("Extra info not found for item %d", id);
+
+ _itemExtras.numEntries = extraInfo->readUint16BE();
+ _itemExtras.entries = new ItemExtraEntry[_itemExtras.numEntries];
+ for (uint16 i = 0; i < _itemExtras.numEntries; i++) {
+ _itemExtras.entries[i].extraID = extraInfo->readUint32BE();
+ _itemExtras.entries[i].extraArea = extraInfo->readUint16BE();
+ _itemExtras.entries[i].extraStart = extraInfo->readUint32BE();
+ _itemExtras.entries[i].extraStop = extraInfo->readUint32BE();
+ }
+
+ delete extraInfo;
+
+ g_allItems.push_back(this);
+}
+
+Item::~Item() {
+ delete[] _sharedAreaInfo.entries;
+ delete[] _itemExtras.entries;
+}
+
+void Item::writeToStream(Common::WriteStream *stream) {
+ stream->writeUint16BE(_itemNeighborhood);
+ stream->writeUint16BE(_itemRoom);
+ stream->writeByte(_itemDirection);
+ stream->writeUint16BE(_itemOwnerID);
+ stream->writeUint16BE(_itemState);
+}
+
+void Item::readFromStream(Common::ReadStream *stream) {
+ _itemNeighborhood = stream->readUint16BE();
+ _itemRoom = stream->readUint16BE();
+ _itemDirection = stream->readByte();
+ _itemOwnerID = stream->readUint16BE();
+ _itemState = stream->readUint16BE();
+}
+
+ActorID Item::getItemOwner() const {
+ return _itemOwnerID;
+}
+
+void Item::setItemOwner(const ActorID owner) {
+ _itemOwnerID = owner;
+
+ if (owner == kNoActorID) {
+ if (isSelected())
+ deselect();
+ removedFromInventory();
+ } else {
+ addedToInventory();
+ }
+}
+
+WeightType Item::getItemWeight() {
+ return _itemWeight;
+}
+
+ItemState Item::getItemState() const {
+ return _itemState;
+}
+
+void Item::setItemState(const ItemState state) {
+ if (state != _itemState) {
+ _itemState = state;
+
+ if (getItemType() == kInventoryItemType && ((PegasusEngine *)g_engine)->getCurrentInventoryItem() == (InventoryItem *)this)
+ select();
+ else if (getItemType() == kBiochipItemType && ((PegasusEngine *)g_engine)->getCurrentBiochip() == (BiochipItem *)this)
+ select();
+ }
+}
+
+void Item::getItemRoom(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction) const {
+ neighborhood = _itemNeighborhood;
+ room = _itemRoom;
+ direction = _itemDirection;
+}
+
+void Item::setItemRoom(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) {
+ _itemNeighborhood = neighborhood;
+ _itemRoom = room;
+ _itemDirection = direction;
+
+ if (neighborhood == kNoNeighborhoodID)
+ pickedUp();
+ else
+ dropped();
+}
+
+NeighborhoodID Item::getItemNeighborhood() const {
+ return _itemNeighborhood;
+}
+
+TimeValue Item::getSharedAreaTime() const {
+ if (!_sharedAreaInfo.entries)
+ return 0xffffffff;
+
+ TimeValue time;
+ ItemState state;
+
+ findItemStateEntryByState(_sharedAreaInfo, _itemState, time);
+ if (time == 0xffffffff)
+ getItemStateEntry(_sharedAreaInfo, 0, state, time);
+
+ return time;
+}
+
+// Must affect images in shared area.
+void Item::select() {
+ _isSelected = true;
+
+ if (g_AIArea) {
+ if (getItemType() == kInventoryItemType)
+ g_AIArea->setAIAreaToTime(kInventorySignature, kMiddleAreaSignature, getSharedAreaTime());
+ else
+ g_AIArea->setAIAreaToTime(kBiochipSignature, kMiddleAreaSignature, getSharedAreaTime());
+ }
+}
+
+void Item::deselect() {
+ _isActive = false;
+ _isSelected = false;
+
+ if (g_AIArea) {
+ if (getItemType() == kInventoryItemType)
+ g_AIArea->setAIAreaToTime(kInventorySignature, kMiddleAreaSignature, 0xffffffff);
+ else
+ g_AIArea->setAIAreaToTime(kBiochipSignature, kMiddleAreaSignature, 0xffffffff);
+ }
+}
+
+void Item::getItemStateEntry(ItemStateInfo info, uint32 index, ItemState &state, TimeValue &time) {
+ if (index < info.numEntries) {
+ state = info.entries[index].itemState;
+ time = info.entries[index].itemTime;
+ } else {
+ state = kNoItemState;
+ time = 0xffffffff;
+ }
+}
+
+void Item::findItemStateEntryByState(ItemStateInfo info, ItemState state, TimeValue &time) {
+ for (uint16 i = 0; i < info.numEntries; i++) {
+ if (info.entries[i].itemState == state) {
+ time = info.entries[i].itemTime;
+ return;
+ }
+ }
+
+ time = 0xffffffff;
+}
+
+ItemStateInfo Item::readItemState(Common::SeekableReadStream *stream) {
+ ItemStateInfo info;
+
+ info.numEntries = stream->readUint16BE();
+ info.entries = new ItemStateEntry[info.numEntries];
+ for (uint16 i = 0; i < info.numEntries; i++) {
+ info.entries[i].itemState = stream->readSint16BE();
+ info.entries[i].itemTime = stream->readUint32BE();
+ }
+
+ return info;
+}
+
+Sprite *Item::getDragSprite(const DisplayElementID id) const {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ Sprite *result = new Sprite(id);
+ SpriteFrame *frame = new SpriteFrame();
+
+ frame->initFromPICTResource(vm->_resFork, _itemInfo.dragSpriteNormalID, true);
+ result->addFrame(frame, 0, 0);
+
+ if (_itemInfo.dragSpriteNormalID != _itemInfo.dragSpriteUsedID) {
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(vm->_resFork, _itemInfo.dragSpriteUsedID, true);
+ }
+
+ result->addFrame(frame, 0, 0);
+ result->setCurrentFrameIndex(0);
+ return result;
+}
+
+TimeValue Item::getInfoLeftTime() const {
+ return _itemInfo.infoLeftTime;
+}
+
+void Item::getInfoRightTimes(TimeValue &start, TimeValue &stop) const {
+ start = _itemInfo.infoRightStart;
+ stop = _itemInfo.infoRightStop;
+}
+
+void Item::findItemExtra(const uint32 extraID, ItemExtraEntry &entry) {
+ for (uint32 i = 0; i < _itemExtras.numEntries; i++) {
+ if (_itemExtras.entries[i].extraID == extraID) {
+ entry = _itemExtras.entries[i];
+ return;
+ }
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/item.h b/engines/pegasus/items/item.h
new file mode 100644
index 0000000000..a1451b2a58
--- /dev/null
+++ b/engines/pegasus/items/item.h
@@ -0,0 +1,363 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_ITEM_H
+#define PEGASUS_ITEMS_ITEM_H
+
+#include "common/endian.h"
+
+#include "pegasus/types.h"
+#include "pegasus/util.h"
+
+namespace Common {
+ class Error;
+ class ReadStream;
+ class WriteStream;
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+// JMPItemInfo contains resource data used by all Items.
+
+struct JMPItemInfo {
+ TimeValue infoLeftTime;
+ TimeValue infoRightStart;
+ TimeValue infoRightStop;
+ uint32 dragSpriteNormalID;
+ uint32 dragSpriteUsedID;
+};
+
+// ItemStateEntry contains a single state/TimeValue pair. The TimeValue is
+// the time value to set the shared area movie that corresponds with the given
+// state of an inventory item.
+
+struct ItemStateEntry {
+ ItemState itemState;
+ TimeValue itemTime;
+};
+
+struct ItemStateInfo {
+ uint16 numEntries; // For easy ResEdit access
+ ItemStateEntry *entries;
+};
+
+// ItemExtraEntry
+
+static const short kLeftAreaExtra = 0;
+static const short kMiddleAreaExtra = 1;
+static const short kRightAreaExtra = 2;
+
+struct ItemExtraEntry {
+ uint32 extraID;
+ uint16 extraArea;
+ TimeValue extraStart;
+ TimeValue extraStop;
+};
+
+struct ItemExtraInfo {
+ uint16 numEntries; // For easy ResEdit access
+ ItemExtraEntry *entries;
+};
+
+// Inventory info resource type and ID:
+// Individual inventory items are stored in these resource types.
+// Resource ID is item ID + kItemBaseResID.
+
+static const uint32 kItemInfoResType = MKTAG('I', 't', 'e', 'm'); // JMPItemInfoHandle
+static const uint32 kLeftAreaInfoResType = MKTAG('L', 'e', 'f', 't'); // ItemStateInfoHandle
+static const uint32 kMiddleAreaInfoResType = MKTAG('M', 'i', 'd', 'l'); // ItemStateInfoHandle
+static const uint32 kRightAreaInfoResType = MKTAG('R', 'g', 'h', 't'); // ItemStateInfoHandle
+static const uint32 kItemExtraInfoResType = MKTAG('I', 'X', 't', 'r'); // ItemExtraInfoHandle
+
+static const uint16 kItemBaseResID = 128;
+
+// Item IDs.
+
+static const ItemID kAirMask = 7;
+static const ItemID kAntidote = 8;
+static const ItemID kArgonCanister = 9;
+static const ItemID kCardBomb = 10;
+static const ItemID kCrowbar = 11;
+static const ItemID kGasCanister = 12;
+static const ItemID kHistoricalLog = 13;
+static const ItemID kJourneymanKey = 14;
+static const ItemID kKeyCard = 15;
+static const ItemID kMachineGun = 16;
+static const ItemID kMarsCard = 17;
+static const ItemID kNitrogenCanister = 18;
+static const ItemID kOrangeJuiceGlassFull = 19;
+static const ItemID kOrangeJuiceGlassEmpty = 20;
+static const ItemID kPoisonDart = 21;
+static const ItemID kSinclairKey = 22;
+static const ItemID kStunGun = 23;
+static const ItemID kArgonPickup = 24;
+
+// Biochips.
+
+static const ItemID kAIBiochip = 0;
+static const ItemID kInterfaceBiochip = 1;
+static const ItemID kMapBiochip = 2;
+static const ItemID kOpticalBiochip = 3;
+static const ItemID kPegasusBiochip = 4;
+static const ItemID kRetinalScanBiochip = 5;
+static const ItemID kShieldBiochip = 6;
+
+static const ItemID kNumItems = 25;
+
+// Item States.
+
+static const ItemState kAI000 = 0;
+static const ItemState kAI005 = 1;
+static const ItemState kAI006 = 2;
+static const ItemState kAI010 = 3;
+static const ItemState kAI015 = 4;
+static const ItemState kAI016 = 5;
+static const ItemState kAI020 = 6;
+static const ItemState kAI024 = 7;
+static const ItemState kAI100 = 8;
+static const ItemState kAI101 = 9;
+static const ItemState kAI105 = 10;
+static const ItemState kAI106 = 11;
+static const ItemState kAI110 = 12;
+static const ItemState kAI111 = 13;
+static const ItemState kAI115 = 14;
+static const ItemState kAI116 = 15;
+static const ItemState kAI120 = 16;
+static const ItemState kAI121 = 17;
+static const ItemState kAI124 = 18;
+static const ItemState kAI125 = 19;
+static const ItemState kAI126 = 20;
+static const ItemState kAI200 = 21;
+static const ItemState kAI201 = 22;
+static const ItemState kAI202 = 23;
+static const ItemState kAI205 = 24;
+static const ItemState kAI206 = 25;
+static const ItemState kAI210 = 26;
+static const ItemState kAI211 = 27;
+static const ItemState kAI212 = 28;
+static const ItemState kAI215 = 29;
+static const ItemState kAI216 = 30;
+static const ItemState kAI220 = 31;
+static const ItemState kAI221 = 32;
+static const ItemState kAI222 = 33;
+static const ItemState kAI224 = 34;
+static const ItemState kAI225 = 35;
+static const ItemState kAI226 = 36;
+static const ItemState kAI300 = 37;
+static const ItemState kAI301 = 38;
+static const ItemState kAI302 = 39;
+static const ItemState kAI303 = 40;
+static const ItemState kAI305 = 41;
+static const ItemState kAI306 = 42;
+static const ItemState kAI310 = 43;
+static const ItemState kAI311 = 44;
+static const ItemState kAI312 = 45;
+static const ItemState kAI313 = 46;
+static const ItemState kAI315 = 47;
+static const ItemState kAI316 = 48;
+static const ItemState kAI320 = 49;
+static const ItemState kAI321 = 50;
+static const ItemState kAI322 = 51;
+static const ItemState kAI323 = 52;
+static const ItemState kAI324 = 53;
+static const ItemState kAI325 = 54;
+static const ItemState kAI326 = 55;
+static const ItemState kNormalItem = 56;
+static const ItemState kMapUnavailable = 57;
+static const ItemState kMapEngaged = 58;
+static const ItemState kOptical000 = 59;
+static const ItemState kOptical001 = 60;
+static const ItemState kOptical002 = 61;
+static const ItemState kOptical010 = 62;
+static const ItemState kOptical011 = 63;
+static const ItemState kOptical012 = 64;
+static const ItemState kOptical020 = 65;
+static const ItemState kOptical021 = 66;
+static const ItemState kOptical100 = 67;
+static const ItemState kOptical101 = 68;
+static const ItemState kOptical102 = 69;
+static const ItemState kOptical110 = 70;
+static const ItemState kOptical111 = 71;
+static const ItemState kOptical112 = 72;
+static const ItemState kOptical120 = 73;
+static const ItemState kOptical121 = 74;
+static const ItemState kOptical200 = 75;
+static const ItemState kOptical201 = 76;
+static const ItemState kOptical210 = 77;
+static const ItemState kOptical211 = 78;
+static const ItemState kPegasusTSA00 = 79;
+static const ItemState kPegasusTSA10 = 80;
+static const ItemState kPegasusPrehistoric00 = 81;
+static const ItemState kPegasusPrehistoric01 = 82;
+static const ItemState kPegasusPrehistoric10 = 83;
+static const ItemState kPegasusPrehistoric11 = 84;
+static const ItemState kPegasusMars00 = 85;
+static const ItemState kPegasusMars01 = 86;
+static const ItemState kPegasusMars10 = 87;
+static const ItemState kPegasusMars11 = 88;
+static const ItemState kPegasusNorad00 = 89;
+static const ItemState kPegasusNorad01 = 90;
+static const ItemState kPegasusNorad10 = 91;
+static const ItemState kPegasusNorad11 = 92;
+static const ItemState kPegasusWSC00 = 93;
+static const ItemState kPegasusWSC01 = 94;
+static const ItemState kPegasusWSC10 = 95;
+static const ItemState kPegasusWSC11 = 96;
+static const ItemState kPegasusCaldoria = 97;
+static const ItemState kRetinalSimulating = 98;
+static const ItemState kShieldNormal = 99;
+static const ItemState kShieldRadiation = 100;
+static const ItemState kShieldPlasma = 101;
+static const ItemState kShieldCardBomb = 102;
+static const ItemState kShieldDraining = 103;
+static const ItemState kAirMaskEmptyOff = 104;
+static const ItemState kAirMaskEmptyFilter = 105;
+static const ItemState kAirMaskLowOff = 106;
+static const ItemState kAirMaskLowFilter = 107;
+static const ItemState kAirMaskLowOn = 108;
+static const ItemState kAirMaskFullOff = 109;
+static const ItemState kAirMaskFullFilter = 110;
+static const ItemState kAirMaskFullOn = 111;
+static const ItemState kArgonEmpty = 112;
+static const ItemState kArgonFull = 113;
+static const ItemState kFlashlightOff = 114;
+static const ItemState kFlashlightOn = 115;
+static const ItemState kNitrogenEmpty = 116;
+static const ItemState kNitrogenFull = 117;
+static const ItemState kFullGlass = 118;
+
+// Extra IDs.
+
+static const uint32 kRetinalScanSearching = 0;
+static const uint32 kRetinalScanActivated = 1;
+static const uint32 kShieldIntro = 2;
+static const uint32 kRemoveAirMask = 3;
+static const uint32 kRemoveArgon = 4;
+static const uint32 kRemoveCrowbar = 5;
+static const uint32 kGasCanLoop = 6;
+static const uint32 kRemoveJourneymanKey = 7;
+static const uint32 kRemoveMarsCard = 8;
+static const uint32 kRemoveNitrogen = 9;
+static const uint32 kRemoveGlass = 10;
+static const uint32 kRemoveDart = 11;
+static const uint32 kRemoveSinclairKey = 12;
+
+enum ItemType {
+ kInventoryItemType,
+ kBiochipItemType
+};
+
+class Sprite;
+
+/*
+
+ Item is an object which can be picked up and carried around.
+ Items have
+ a location
+ an ID.
+ weight
+ an owner (kNoActorID if no one is carrying the Item)
+
+*/
+
+class Item : public IDObject {
+public:
+ Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction);
+ virtual ~Item();
+
+ // WriteToStream writes everything EXCEPT the item's ID.
+ // It is assumed that the calling function will write and read the ID.
+ virtual void writeToStream(Common::WriteStream *stream);
+ virtual void readFromStream(Common::ReadStream *stream);
+
+ virtual ActorID getItemOwner() const;
+ virtual void setItemOwner(const ActorID owner);
+
+ void getItemRoom(NeighborhoodID &neighborhood, RoomID &room, DirectionConstant &direction) const;
+ void setItemRoom(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction);
+ NeighborhoodID getItemNeighborhood() const;
+
+ virtual WeightType getItemWeight();
+
+ virtual void setItemState(const ItemState state);
+ virtual ItemState getItemState() const;
+
+ virtual ItemType getItemType() = 0;
+
+ TimeValue getInfoLeftTime() const;
+ void getInfoRightTimes(TimeValue &, TimeValue &) const;
+ TimeValue getSharedAreaTime() const;
+
+ Sprite *getDragSprite(const DisplayElementID) const;
+
+ /*
+ select -- called when this item becomes current. Also called when the inventory
+ panel holding this item is raised and this is the current item.
+ deselect -- called when this item is no longer current.
+ activate -- called on the current item when the panel is closed.
+ */
+ // In an override of these three member functions, you must call the inherited
+ // member functions.
+ virtual void select();
+ virtual void deselect();
+ virtual bool isSelected() { return _isSelected; }
+
+ virtual void activate() { _isActive = true; }
+ virtual bool isActive() { return _isActive; }
+ virtual void pickedUp() {}
+ virtual void addedToInventory() {}
+ virtual void removedFromInventory() {}
+ virtual void dropped() {}
+
+ // Called when the shared area is taken by another item, but this item is still
+ // selected.
+ virtual void giveUpSharedArea() {}
+ virtual void takeSharedArea() {}
+
+ void findItemExtra(const uint32 extraID, ItemExtraEntry &entry);
+
+protected:
+ NeighborhoodID _itemNeighborhood;
+ RoomID _itemRoom;
+ DirectionConstant _itemDirection;
+ ActorID _itemOwnerID;
+ WeightType _itemWeight;
+ ItemState _itemState;
+
+ JMPItemInfo _itemInfo;
+ ItemStateInfo _sharedAreaInfo;
+ ItemExtraInfo _itemExtras;
+ bool _isActive;
+ bool _isSelected;
+
+ static void getItemStateEntry(ItemStateInfo, uint32, ItemState &, TimeValue &);
+ static void findItemStateEntryByState(ItemStateInfo, ItemState, TimeValue &);
+ static ItemStateInfo readItemState(Common::SeekableReadStream *stream);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/itemdragger.cpp b/engines/pegasus/items/itemdragger.cpp
new file mode 100644
index 0000000000..97fc5a97ac
--- /dev/null
+++ b/engines/pegasus/items/itemdragger.cpp
@@ -0,0 +1,193 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/elements.h"
+#include "pegasus/hotspot.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/items/itemdragger.h"
+
+namespace Pegasus {
+
+SpriteDragger::SpriteDragger() {
+ _draggingSprite = 0;
+ _limitRect = Common::Rect(-30000, -30000, 30000, 30000);
+ _slopRect = Common::Rect(-30000, -30000, 30000, 30000);
+ _dragOffset.x = 0;
+ _dragOffset.y = 0;
+ _lastHotspot = 0;
+}
+
+void SpriteDragger::setDragSprite(Sprite *newSprite) {
+ if (!isTracking())
+ _draggingSprite = newSprite;
+}
+
+void SpriteDragger::setDragConstraints(const Common::Rect &limitRect, const Common::Rect &slopRect) {
+ if (!isTracking()) {
+ _rawLimitRect = limitRect;
+ _slopRect = slopRect;
+ }
+}
+
+void SpriteDragger::getDragConstraints(Common::Rect &limitRect, Common::Rect &slopRect) const {
+ limitRect = _rawLimitRect;
+ slopRect = _slopRect;
+}
+
+void SpriteDragger::startTracking(const Input &input) {
+ if (_draggingSprite) {
+ Tracker::startTracking(input);
+
+ if (isTracking()) {
+ input.getInputLocation(_startPoint);
+ _lastRawPoint = _startRawPoint = _startPoint;
+
+ Common::Rect r;
+ _draggingSprite->getBounds(r);
+ _dragOffset.x = _startPoint.x - r.left;
+ _dragOffset.y = _startPoint.y - r.top;
+
+ _limitRect = _rawLimitRect;
+ _limitRect.left += _dragOffset.x;
+ _limitRect.top += _dragOffset.y;
+ _limitRect.right -= r.width() - _dragOffset.x;
+ _limitRect.bottom -= r.height() - _dragOffset.y;
+ pinPointInRect(_limitRect, _startPoint);
+
+ _lastPoint = _startPoint;
+ if (_startPoint != _startRawPoint) {
+ Common::Point pt = _startPoint - _dragOffset;
+ _draggingSprite->moveElementTo(pt.x, pt.y);
+ }
+
+ _lastHotspot = g_allHotspots.findHotspot(_lastRawPoint);
+ if (_lastHotspot)
+ enterHotspot(_lastHotspot);
+ }
+ }
+}
+
+void SpriteDragger::continueTracking(const Input &input) {
+ if (_draggingSprite) {
+ Common::Point rawPoint;
+ input.getInputLocation(rawPoint);
+
+ if (!_slopRect.contains(rawPoint))
+ rawPoint = _startRawPoint;
+
+ if (rawPoint != _lastRawPoint) {
+ Common::Point newPoint = rawPoint;
+ pinPointInRect(_limitRect, newPoint);
+ newPoint -= _dragOffset;
+
+ if (newPoint != _lastPoint) {
+ _draggingSprite->moveElementTo(newPoint.x, newPoint.y);
+ _lastPoint = newPoint;
+ }
+
+ Hotspot *newHotspot = g_allHotspots.findHotspot(rawPoint);
+ if (newHotspot != _lastHotspot) {
+ if (_lastHotspot)
+ exitHotspot(_lastHotspot);
+ if (newHotspot)
+ enterHotspot(newHotspot);
+ _lastHotspot = newHotspot;
+ }
+
+ _lastRawPoint = rawPoint;
+ }
+ }
+}
+
+void SpriteDragger::pinPointInRect(const Common::Rect &r, Common::Point &pt) {
+ pt.x = CLIP<int>(pt.x, r.left, r.right - 1);
+ pt.y = CLIP<int>(pt.y, r.top, r.bottom - 1);
+}
+
+ItemDragger::ItemDragger(PegasusEngine *owner) : _inventoryDropSpot(kInventoryDropSpotID), _biochipDropSpot(kBiochipDropSpotID),
+ _inventoryHighlight(kInventoryDropHighlightID), _biochipHighlight(kBiochipDropHighlightID) {
+ _owner = owner;
+
+ Common::Rect r(kInventoryDropLeft, kInventoryDropTop, kInventoryDropRight, kInventoryDropBottom);
+ _inventoryDropSpot.setArea(r);
+ _inventoryDropSpot.setHotspotFlags(kDropItemSpotFlag);
+ g_allHotspots.push_back(&_inventoryDropSpot);
+
+ r = Common::Rect(kBiochipDropLeft, kBiochipDropTop, kBiochipDropRight, kBiochipDropBottom);
+ _biochipDropSpot.setArea(r);
+ _biochipDropSpot.setHotspotFlags(kDropBiochipSpotFlag);
+ g_allHotspots.push_back(&_biochipDropSpot);
+}
+
+void ItemDragger::startTracking(const Input &input) {
+ _inventoryHighlight.setDisplayOrder(kInventoryHiliteOrder);
+ _inventoryHighlight.startDisplaying();
+
+ _biochipHighlight.setDisplayOrder(kBiochipHiliteOrder);
+ _biochipHighlight.startDisplaying();
+
+ SpriteDragger::startTracking(input);
+}
+
+void ItemDragger::stopTracking(const Input &input) {
+ SpriteDragger::stopTracking(input);
+ _inventoryHighlight.hide();
+ _biochipHighlight.hide();
+ _inventoryHighlight.stopDisplaying();
+ _biochipHighlight.stopDisplaying();
+ _owner->dragTerminated(input);
+}
+
+bool ItemDragger::stopTrackingInput(const Input &input) {
+ return !JMPPPInput::isDraggingInput(input);
+}
+
+void ItemDragger::enterHotspot(Hotspot *spot) {
+ if (spot->getObjectID() == kInventoryDropSpotID)
+ _inventoryHighlight.show();
+ else if (spot->getObjectID() == kBiochipDropSpotID)
+ _biochipHighlight.show();
+ else if ((spot->getHotspotFlags() & kDropItemSpotFlag) != 0)
+ _draggingSprite->setCurrentFrameIndex(1);
+}
+
+void ItemDragger::exitHotspot(Hotspot *spot) {
+ if (spot->getObjectID() == kInventoryDropSpotID)
+ _inventoryHighlight.hide();
+ else if (spot->getObjectID() == kBiochipDropSpotID)
+ _biochipHighlight.hide();
+ else if ((spot->getHotspotFlags() & kDropItemSpotFlag) != 0)
+ _draggingSprite->setCurrentFrameIndex(0);
+}
+
+void ItemDragger::setHighlightBounds() {
+ uint32 color = g_system->getScreenFormat().RGBToColor(0x48, 0x80, 0xD8);
+ _inventoryHighlight.setBounds(Common::Rect(76, 334, 172, 430));
+ _inventoryHighlight.setHighlightColor(color);
+ _biochipHighlight.setBounds(Common::Rect(364, 334, 460, 430));
+ _biochipHighlight.setHighlightColor(color);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/itemdragger.h b/engines/pegasus/items/itemdragger.h
new file mode 100644
index 0000000000..fce953d695
--- /dev/null
+++ b/engines/pegasus/items/itemdragger.h
@@ -0,0 +1,96 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_ITEMDRAGGER_H
+#define PEGASUS_ITEMS_ITEMDRAGGER_H
+
+#include "pegasus/elements.h"
+#include "pegasus/input.h"
+
+namespace Pegasus {
+
+// TODO: Merge SpriteDragger and ItemDragger
+
+class Hotspot;
+class Sprite;
+
+class SpriteDragger : public Tracker {
+public:
+ SpriteDragger();
+ virtual ~SpriteDragger() {}
+
+ void setDragSprite(Sprite *);
+ Sprite *getDragSprite() { return _draggingSprite; }
+
+ void setDragConstraints(const Common::Rect &, const Common::Rect &);
+ void getDragConstraints(Common::Rect &, Common::Rect &) const;
+
+ void startTracking(const Input &);
+ void continueTracking(const Input&);
+
+ Hotspot *getLastHotspot() const { return _lastHotspot; }
+
+protected:
+ virtual void enterHotspot(Hotspot *) {}
+ virtual void exitHotspot(Hotspot *) {}
+
+ Sprite *_draggingSprite;
+ Common::Point _startPoint, _lastPoint, _dragOffset;
+ Common::Point _startRawPoint, _lastRawPoint;
+ Common::Rect _rawLimitRect;
+ Common::Rect _limitRect;
+ Common::Rect _slopRect;
+ Hotspot *_lastHotspot;
+
+ // This is a replica of QuickDraw's PinPointInRect function
+ void pinPointInRect(const Common::Rect &, Common::Point &);
+};
+
+class PegasusEngine;
+
+class ItemDragger : public SpriteDragger {
+public:
+ ItemDragger(PegasusEngine *);
+ virtual ~ItemDragger() {}
+
+ void setHighlightBounds();
+ void startTracking(const Input &);
+ void stopTracking(const Input &);
+ bool stopTrackingInput(const Input &);
+
+protected:
+ virtual void enterHotspot(Hotspot *);
+ virtual void exitHotspot(Hotspot *);
+
+ PegasusEngine *_owner;
+ DropHighlight _inventoryHighlight;
+ Hotspot _inventoryDropSpot;
+ DropHighlight _biochipHighlight;
+ Hotspot _biochipDropSpot;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/items/itemlist.cpp b/engines/pegasus/items/itemlist.cpp
new file mode 100644
index 0000000000..ff8cae546b
--- /dev/null
+++ b/engines/pegasus/items/itemlist.cpp
@@ -0,0 +1,67 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/error.h"
+#include "common/stream.h"
+
+#include "pegasus/pegasus.h"
+#include "pegasus/items/item.h"
+#include "pegasus/items/itemlist.h"
+
+namespace Pegasus {
+
+ItemList::ItemList() {
+}
+
+ItemList::~ItemList() {
+}
+
+void ItemList::writeToStream(Common::WriteStream *stream) {
+ stream->writeUint32BE(size());
+
+ for (ItemIterator it = begin(); it != end(); it++) {
+ stream->writeUint16BE((*it)->getObjectID());
+ (*it)->writeToStream(stream);
+ }
+}
+
+void ItemList::readFromStream(Common::ReadStream *stream) {
+ uint32 itemCount = stream->readUint32BE();
+
+ for (uint32 i = 0; i < itemCount; i++) {
+ ItemID itemID = stream->readUint16BE();
+ g_allItems.findItemByID(itemID)->readFromStream(stream);
+ }
+}
+
+Item *ItemList::findItemByID(const ItemID id) {
+ for (ItemIterator it = begin(); it != end(); it++)
+ if ((*it)->getObjectID() == id)
+ return *it;
+
+ return 0;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/items/itemlist.h b/engines/pegasus/items/itemlist.h
new file mode 100644
index 0000000000..9b59206ab3
--- /dev/null
+++ b/engines/pegasus/items/itemlist.h
@@ -0,0 +1,59 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_ITEMS_ITEMLIST_H
+#define PEGASUS_ITEMS_ITEMLIST_H
+
+#include "common/list.h"
+
+#include "pegasus/types.h"
+
+namespace Common {
+ class ReadStream;
+ class WriteStream;
+}
+
+namespace Pegasus {
+
+class Item;
+
+class ItemList : public Common::List<Item *> {
+public:
+ ItemList();
+ virtual ~ItemList();
+
+ virtual void writeToStream(Common::WriteStream *stream);
+ virtual void readFromStream(Common::ReadStream *stream);
+
+ Item *findItemByID(const ItemID id);
+};
+
+typedef ItemList::iterator ItemIterator;
+
+#define g_allItems (((PegasusEngine *)g_engine)->getAllItems())
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp
new file mode 100644
index 0000000000..deaa460188
--- /dev/null
+++ b/engines/pegasus/menu.cpp
@@ -0,0 +1,1219 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/menu.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/scoring.h"
+
+namespace Pegasus {
+
+GameMenu::GameMenu(const uint32 id) : IDObject(id), InputHandler((InputHandler *)((PegasusEngine *)g_engine)) {
+ _previousHandler = 0;
+ _lastCommand = kMenuCmdNoCommand;
+}
+
+void GameMenu::becomeCurrentHandler() {
+ _previousHandler = InputHandler::setInputHandler(this);
+}
+
+void GameMenu::restorePreviousHandler() {
+ InputHandler::setInputHandler(_previousHandler);
+}
+
+void GameMenu::drawScore(GameScoreType score, GameScoreType total, const Common::Rect &scoreBounds, Surface *numbers) {
+ CoordType x = scoreBounds.right;
+ drawNumber(total, x, scoreBounds.top, numbers);
+
+ x -= 12;
+ Common::Rect r1(120, 0, 132, 12); // The slash.
+ Common::Rect r2 = r1;
+ r2.moveTo(x, scoreBounds.top);
+ numbers->copyToCurrentPort(r1, r2);
+ drawNumber(score, x, scoreBounds.top, numbers);
+}
+
+void GameMenu::drawNumber(GameScoreType number, CoordType &x, CoordType y, Surface *numbers) {
+ Common::Rect r1(0, 0, 12, 12); // Width, height of one digit
+ Common::Rect r2 = r1;
+ r2.moveTo(x - 12, y);
+
+ do {
+ uint16 digit = number % 10;
+ number /= 10;
+ r1.moveTo(digit * 12, 0);
+ numbers->copyToCurrentPort(r1, r2);
+ r2.translate(-12, 0);
+ } while (number != 0);
+
+ x = r2.right;
+}
+
+enum {
+ kMainMenuStartDemo = 0,
+ kMainMenuCreditsDemo,
+ kMainMenuQuitDemo,
+ kFirstSelectionDemo = kMainMenuStartDemo,
+ kLastSelectionDemo = kMainMenuQuitDemo,
+
+ kMainMenuOverview = 0,
+ kMainMenuStart,
+ kMainMenuRestore,
+ kMainMenuDifficulty,
+ kMainMenuCredits,
+ kMainMenuQuit,
+ kFirstSelection = kMainMenuOverview,
+ kLastSelection = kMainMenuQuit
+};
+
+static const CoordType kStartLeftDemo = 44;
+static const CoordType kStartTopDemo = 336;
+
+static const CoordType kStartSelectLeftDemo = 40;
+static const CoordType kStartSelectTopDemo = 331;
+
+static const CoordType kCreditsLeftDemo = 44;
+static const CoordType kCreditsTopDemo = 372;
+
+static const CoordType kCreditsSelectLeftDemo = 40;
+static const CoordType kCreditsSelectTopDemo = 367;
+
+static const CoordType kMainMenuQuitLeftDemo = 32;
+static const CoordType kMainMenuQuitTopDemo = 412;
+
+static const CoordType kMainMenuQuitSelectLeftDemo = 28;
+static const CoordType kMainMenuQuitSelectTopDemo = 408;
+
+static const CoordType kOverviewLeft = 200;
+static const CoordType kOverviewTop = 208;
+
+static const CoordType kOverviewSelectLeft = 152;
+static const CoordType kOverviewSelectTop = 204;
+
+static const CoordType kStartLeft = 212;
+static const CoordType kStartTop = 256;
+
+static const CoordType kStartSelectLeft = 152;
+static const CoordType kStartSelectTop = 252;
+
+static const CoordType kRestoreLeft = 212;
+static const CoordType kRestoreTop = 296;
+
+static const CoordType kRestoreSelectLeft = 152;
+static const CoordType kRestoreSelectTop = 292;
+
+static const CoordType kDifficultyLeft = 320;
+static const CoordType kDifficultyTop = 340;
+
+static const CoordType kDifficultySelectLeft = 152;
+static const CoordType kDifficultySelectTop = 336;
+
+static const CoordType kCreditsLeft = 212;
+static const CoordType kCreditsTop = 388;
+
+static const CoordType kCreditsSelectLeft = 152;
+static const CoordType kCreditsSelectTop = 384;
+
+static const CoordType kMainMenuQuitLeft = 212;
+static const CoordType kMainMenuQuitTop = 428;
+
+static const CoordType kMainMenuQuitSelectLeft = 152;
+static const CoordType kMainMenuQuitSelectTop = 424;
+
+// Never set the current input handler to the MainMenu.
+MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButton(0),
+ _restoreButton(0), _adventureButton(0), _walkthroughButton(0), _startButton(0),
+ _creditsButton(0), _quitButton(0), _largeSelect(0), _smallSelect(0) {
+
+ bool isDemo = ((PegasusEngine *)g_engine)->isDemo();
+
+ if (isDemo)
+ _menuBackground.initFromPICTFile("Images/Demo/DemoMenu.pict");
+ else
+ _menuBackground.initFromPICTFile("Images/Main Menu/MainMenu.mac");
+ _menuBackground.setDisplayOrder(0);
+ _menuBackground.startDisplaying();
+ _menuBackground.show();
+
+ if (!isDemo) {
+ _overviewButton.initFromPICTFile("Images/Main Menu/pbOvervi.pict");
+ _overviewButton.setDisplayOrder(1);
+ _overviewButton.moveElementTo(kOverviewLeft, kOverviewTop);
+ _overviewButton.startDisplaying();
+
+ _restoreButton.initFromPICTFile("Images/Main Menu/pbRestor.pict");
+ _restoreButton.setDisplayOrder(1);
+ _restoreButton.moveElementTo(kRestoreLeft, kRestoreTop);
+ _restoreButton.startDisplaying();
+
+ _adventureButton.initFromPICTFile("Images/Main Menu/BtnAdv.pict");
+ _adventureButton.setDisplayOrder(1);
+ _adventureButton.moveElementTo(kDifficultyLeft, kDifficultyTop);
+ _adventureButton.startDisplaying();
+
+ _walkthroughButton.initFromPICTFile("Images/Main Menu/BtnWlk.pict");
+ _walkthroughButton.setDisplayOrder(1);
+ _walkthroughButton.moveElementTo(kDifficultyLeft, kDifficultyTop);
+ _walkthroughButton.startDisplaying();
+ }
+
+ if (isDemo)
+ _startButton.initFromPICTFile("Images/Demo/Start.pict");
+ else
+ _startButton.initFromPICTFile("Images/Main Menu/pbStart.pict");
+ _startButton.setDisplayOrder(1);
+ _startButton.moveElementTo(isDemo ? kStartLeftDemo : kStartLeft, isDemo ? kStartTopDemo : kStartTop);
+ _startButton.startDisplaying();
+
+ if (isDemo)
+ _creditsButton.initFromPICTFile("Images/Demo/Credits.pict");
+ else
+ _creditsButton.initFromPICTFile("Images/Main Menu/pbCredit.pict");
+ _creditsButton.setDisplayOrder(1);
+ _creditsButton.moveElementTo(isDemo ? kCreditsLeftDemo : kCreditsLeft, isDemo ? kCreditsTopDemo : kCreditsTop);
+ _creditsButton.startDisplaying();
+
+ if (isDemo)
+ _quitButton.initFromPICTFile("Images/Demo/Quit.pict");
+ else
+ _quitButton.initFromPICTFile("Images/Main Menu/pbQuit.pict");
+ _quitButton.setDisplayOrder(1);
+ _quitButton.moveElementTo(isDemo ? kMainMenuQuitLeftDemo : kMainMenuQuitLeft, isDemo ? kMainMenuQuitTopDemo : kMainMenuQuitTop);
+ _quitButton.startDisplaying();
+
+ if (isDemo)
+ _largeSelect.initFromPICTFile("Images/Demo/SelectL.pict", true);
+ else
+ _largeSelect.initFromPICTFile("Images/Main Menu/SelectL.pict", true);
+ _largeSelect.setDisplayOrder(1);
+ _largeSelect.startDisplaying();
+
+ if (isDemo)
+ _smallSelect.initFromPICTFile("Images/Demo/SelectS.pict", true);
+ else
+ _smallSelect.initFromPICTFile("Images/Main Menu/SelectS.pict", true);
+ _smallSelect.setDisplayOrder(1);
+ _smallSelect.startDisplaying();
+
+ _menuSelection = isDemo ? kFirstSelectionDemo : kFirstSelection;
+
+ _adventureMode = true;
+
+ _menuLoop.attachFader(&_menuFader);
+ _menuLoop.initFromAIFFFile("Sounds/Main Menu.aiff");
+
+ updateDisplay();
+}
+
+MainMenu::~MainMenu() {
+ if (_menuLoop.isPlaying())
+ stopMainMenuLoop();
+}
+
+void MainMenu::startMainMenuLoop() {
+ FaderMoveSpec spec;
+
+ _menuLoop.loopSound();
+ spec.makeTwoKnotFaderSpec(30, 0, 0, 30, 255);
+ _menuFader.startFaderSync(spec);
+}
+
+void MainMenu::stopMainMenuLoop() {
+ FaderMoveSpec spec;
+
+ spec.makeTwoKnotFaderSpec(30, 0, 255, 30, 0);
+ _menuFader.startFaderSync(spec);
+ _menuLoop.stopSound();
+}
+
+void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ bool isDemo = vm->isDemo();
+
+ if (input.upButtonDown()) {
+ if (_menuSelection > (isDemo ? kFirstSelectionDemo : kFirstSelection)) {
+ _menuSelection--;
+ updateDisplay();
+ }
+ } else if (input.downButtonDown()) {
+ if (_menuSelection < (isDemo ? kLastSelectionDemo : kLastSelection)) {
+ _menuSelection++;
+ updateDisplay();
+ }
+ } else if (!isDemo && (input.leftButtonDown() || input.rightButtonDown())) {
+ if (_menuSelection == kMainMenuDifficulty) {
+ _adventureMode = !_adventureMode;
+ updateDisplay();
+ }
+ } else if (JMPPPInput::isMenuButtonPressInput(input)) {
+ if (isDemo) {
+ switch (_menuSelection) {
+ case kMainMenuCreditsDemo:
+ _creditsButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _creditsButton.hide();
+ setLastCommand(kMenuCmdCredits);
+ break;
+ case kMainMenuStartDemo:
+ _startButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _startButton.hide();
+ setLastCommand(kMenuCmdStartAdventure);
+ break;
+ case kMainMenuQuitDemo:
+ _quitButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _quitButton.hide();
+ setLastCommand(kMenuCmdQuit);
+ break;
+ }
+ } else {
+ switch (_menuSelection) {
+ case kMainMenuOverview:
+ _overviewButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _overviewButton.hide();
+ setLastCommand(kMenuCmdOverview);
+ break;
+ case kMainMenuRestore:
+ _restoreButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _restoreButton.hide();
+ setLastCommand(kMenuCmdRestore);
+ break;
+ case kMainMenuCredits:
+ _creditsButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _creditsButton.hide();
+ setLastCommand(kMenuCmdCredits);
+ break;
+ case kMainMenuStart:
+ _startButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _startButton.hide();
+ if (_adventureMode)
+ setLastCommand(kMenuCmdStartAdventure);
+ else
+ setLastCommand(kMenuCmdStartWalkthrough);
+ break;
+ case kMainMenuDifficulty:
+ _adventureMode = !_adventureMode;
+ updateDisplay();
+ break;
+ case kMainMenuQuit:
+ _quitButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _quitButton.hide();
+ setLastCommand(kMenuCmdQuit);
+ break;
+ }
+ }
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void MainMenu::updateDisplay() {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ if (vm->isDemo()) {
+ switch (_menuSelection) {
+ case kMainMenuStartDemo:
+ _smallSelect.moveElementTo(kStartSelectLeftDemo, kStartSelectTopDemo);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kMainMenuCreditsDemo:
+ _smallSelect.moveElementTo(kCreditsSelectLeftDemo, kCreditsSelectTopDemo);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kMainMenuQuitDemo:
+ _largeSelect.moveElementTo(kMainMenuQuitSelectLeftDemo, kMainMenuQuitSelectTopDemo);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ }
+ } else {
+ switch (_menuSelection) {
+ case kMainMenuOverview:
+ _largeSelect.moveElementTo(kOverviewSelectLeft, kOverviewSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kMainMenuRestore:
+ _smallSelect.moveElementTo(kRestoreSelectLeft, kRestoreSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kMainMenuDifficulty:
+ if (_adventureMode) {
+ _adventureButton.show();
+ _walkthroughButton.hide();
+ } else {
+ _walkthroughButton.show();
+ _adventureButton.hide();
+ }
+
+ _largeSelect.moveElementTo(kDifficultySelectLeft, kDifficultySelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kMainMenuStart:
+ _smallSelect.moveElementTo(kStartSelectLeft, kStartSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kMainMenuCredits:
+ _smallSelect.moveElementTo(kCreditsSelectLeft, kCreditsSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kMainMenuQuit:
+ _smallSelect.moveElementTo(kMainMenuQuitSelectLeft, kMainMenuQuitSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ }
+
+ vm->resetIntroTimer();
+ }
+}
+
+enum {
+ kCreditsMenuCoreTeam,
+ kCreditsMenuSupportTeam,
+ kCreditsMenuOriginalTeam,
+ kCreditsMenuTalent,
+ kCreditsMenuOtherTitles,
+ kCreditsMenuMainMenu,
+
+ kCreditsFirstSelection = kCreditsMenuCoreTeam,
+ kCreditsLastSelection = kCreditsMenuMainMenu
+};
+
+static const CoordType kCreditsMovieLeft = 288;
+static const CoordType kCreditsMovieTop = 0;
+
+static const CoordType kCoreTeamSelectLeft = 40;
+static const CoordType kCoreTeamSelectTop = 223;
+
+static const CoordType kSupportTeamSelectLeft = 40;
+static const CoordType kSupportTeamSelectTop = 259;
+
+static const CoordType kOriginalTeamSelectLeft = 40;
+static const CoordType kOriginalTeamSelectTop = 295;
+
+static const CoordType kTalentSelectLeft = 40;
+static const CoordType kTalentSelectTop = 331;
+
+static const CoordType kOtherTitlesSelectLeft = 40;
+static const CoordType kOtherTitlesSelectTop = 367;
+
+static const CoordType kCreditsMainMenuLeft = 32;
+static const CoordType kCreditsMainMenuTop = 412;
+
+static const CoordType kCreditsMainMenuSelectLeft = 30;
+static const CoordType kCreditsMainMenuSelectTop = 408;
+
+static const TimeValue kCoreTeamTime = 0;
+static const TimeValue kSupportTeamTime = 1920;
+static const TimeValue kOriginalTeamTime = 3000;
+static const TimeValue kTalentTime = 4440;
+static const TimeValue kOtherTitlesTime = 4680;
+
+static const TimeValue kFrameIncrement = 120; // Three frames...
+
+// Never set the current input handler to the CreditsMenu.
+CreditsMenu::CreditsMenu() : GameMenu(kCreditsMenuID), _menuBackground(0), _creditsMovie(0),
+ _mainMenuButton(0), _largeSelect(0), _smallSelect(0) {
+
+ _menuBackground.initFromPICTFile("Images/Credits/CredScrn.pict");
+ _menuBackground.setDisplayOrder(0);
+ _menuBackground.startDisplaying();
+ _menuBackground.show();
+
+ _creditsMovie.initFromMovieFile("Images/Credits/Credits.movie");
+ _creditsMovie.setDisplayOrder(1);
+ _creditsMovie.moveElementTo(kCreditsMovieLeft, kCreditsMovieTop);
+ _creditsMovie.startDisplaying();
+ _creditsMovie.show();
+ _creditsMovie.redrawMovieWorld();
+
+ _mainMenuButton.initFromPICTFile("Images/Credits/MainMenu.pict");
+ _mainMenuButton.setDisplayOrder(1);
+ _mainMenuButton.moveElementTo(kCreditsMainMenuLeft, kCreditsMainMenuTop);
+ _mainMenuButton.startDisplaying();
+
+ _largeSelect.initFromPICTFile("Images/Credits/SelectL.pict", true);
+ _largeSelect.setDisplayOrder(2);
+ _largeSelect.moveElementTo(kCreditsMainMenuSelectLeft, kCreditsMainMenuSelectTop);
+ _largeSelect.startDisplaying();
+
+ _smallSelect.initFromPICTFile("Images/Credits/SelectS.pict", true);
+ _smallSelect.setDisplayOrder(2);
+ _smallSelect.show();
+ _smallSelect.startDisplaying();
+
+ _menuSelection = -1;
+
+ newMenuSelection(kCreditsMenuCoreTeam);
+}
+
+// Assumes the new selection is never more than one away from the old...
+void CreditsMenu::newMenuSelection(const int newSelection) {
+ if (newSelection != _menuSelection) {
+ switch (newSelection) {
+ case kCreditsMenuCoreTeam:
+ _smallSelect.moveElementTo(kCoreTeamSelectLeft, kCoreTeamSelectTop);
+ _creditsMovie.setTime(kCoreTeamTime);
+ _creditsMovie.redrawMovieWorld();
+ break;
+ case kCreditsMenuSupportTeam:
+ _smallSelect.moveElementTo(kSupportTeamSelectLeft, kSupportTeamSelectTop);
+ _creditsMovie.setTime(kSupportTeamTime);
+ _creditsMovie.redrawMovieWorld();
+ break;
+ case kCreditsMenuOriginalTeam:
+ _smallSelect.moveElementTo(kOriginalTeamSelectLeft, kOriginalTeamSelectTop);
+ _creditsMovie.setTime(kOriginalTeamTime);
+ _creditsMovie.redrawMovieWorld();
+ break;
+ case kCreditsMenuTalent:
+ _smallSelect.moveElementTo(kTalentSelectLeft, kTalentSelectTop);
+ _creditsMovie.setTime(kTalentTime);
+ _creditsMovie.redrawMovieWorld();
+ break;
+ case kCreditsMenuOtherTitles:
+ _smallSelect.moveElementTo(kOtherTitlesSelectLeft, kOtherTitlesSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ _creditsMovie.setTime(kOtherTitlesTime);
+ _creditsMovie.redrawMovieWorld();
+ break;
+ case kCreditsMenuMainMenu:
+ _smallSelect.hide();
+ _largeSelect.show();
+ break;
+ }
+
+ _menuSelection = newSelection;
+ }
+}
+
+void CreditsMenu::newMovieTime(const TimeValue newTime) {
+ if (newTime < kSupportTeamTime) {
+ _smallSelect.moveElementTo(kCoreTeamSelectLeft, kCoreTeamSelectTop);
+ _menuSelection = kCreditsMenuCoreTeam;
+ } else if (newTime < kOriginalTeamTime) {
+ _smallSelect.moveElementTo(kSupportTeamSelectLeft, kSupportTeamSelectTop);
+ _menuSelection = kCreditsMenuSupportTeam;
+ } else if (newTime < kTalentTime) {
+ _smallSelect.moveElementTo(kOriginalTeamSelectLeft, kOriginalTeamSelectTop);
+ _menuSelection = kCreditsMenuOriginalTeam;
+ } else if (newTime < kOtherTitlesTime) {
+ _smallSelect.moveElementTo(kTalentSelectLeft, kTalentSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ _menuSelection = kCreditsMenuTalent;
+ } else if ((int)newTime == -120) {
+ // HACK: Avoid getting sent to the bottom button in the default case
+ return;
+ } else {
+ _smallSelect.moveElementTo(kOtherTitlesSelectLeft, kOtherTitlesSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ _menuSelection = kCreditsMenuOtherTitles;
+ }
+
+ _creditsMovie.setTime(newTime);
+ _creditsMovie.redrawMovieWorld();
+}
+
+void CreditsMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (input.upButtonDown()) {
+ if (_menuSelection > kCreditsFirstSelection)
+ newMenuSelection(_menuSelection - 1);
+ } else if (input.downButtonDown()) {
+ if (_menuSelection < kCreditsLastSelection)
+ newMenuSelection(_menuSelection + 1);
+ } else if (input.leftButtonDown()) {
+ newMovieTime(_creditsMovie.getTime() - kFrameIncrement);
+ } else if (input.rightButtonDown()) {
+ newMovieTime(_creditsMovie.getTime() + kFrameIncrement);
+ } else if (JMPPPInput::isMenuButtonPressInput(input)) {
+ if (_menuSelection == kCreditsMenuMainMenu) {
+ _mainMenuButton.show();
+ ((PegasusEngine *)g_engine)->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _mainMenuButton.hide();
+ setLastCommand(kMenuCmdCreditsMainMenu);
+ }
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+static const CoordType kContinueLeft = 44;
+static const CoordType kContinueTop = 336;
+
+static const CoordType kContinueSelectLeft = 40;
+static const CoordType kContinueSelectTopDemo = 331;
+static const CoordType kContinueSelectTop = 332;
+
+static const CoordType kMainMenuLeftDemo = 44;
+static const CoordType kMainMenuTopDemo = 372;
+
+static const CoordType kMainMenuSelectLeftDemo = 40;
+static const CoordType kMainMenuSelectTopDemo = 367;
+
+static const CoordType kQuitLeftDemo = 32;
+static const CoordType kQuitTopDemo = 412;
+
+static const CoordType kQuitSelectLeftDemo = 28;
+static const CoordType kQuitSelectTopDemo = 408;
+
+static const CoordType kRestoreLeftDeath = 44;
+static const CoordType kRestoreTopDeath = 372;
+
+static const CoordType kRestoreSelectLeftDeath = 40;
+static const CoordType kRestoreSelectTopDeath = 368;
+
+static const CoordType kMainMenuLeft = 32;
+static const CoordType kMainMenuTop = 412;
+
+static const CoordType kMainMenuSelectLeft = 28;
+static const CoordType kMainMenuSelectTop = 408;
+
+enum {
+ kDeathScreenContinueDemo = 0,
+ kDeathScreenMainMenuDemo,
+ kDeathScreenQuitDemo,
+
+ kFirstDeathSelectionDemo = kDeathScreenContinueDemo,
+ kLastDeathSelectionDemo = kDeathScreenQuitDemo,
+
+ kDeathScreenContinue = 0,
+ kDeathScreenRestore,
+ kDeathScreenMainMenu,
+
+ kFirstDeathSelection = kDeathScreenContinue,
+ kLastDeathSelection = kDeathScreenMainMenu
+};
+
+// Never set the current input handler to the DeathMenu.
+DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _deathBackground(0), _continueButton(0),
+ _mainMenuButton(0), _quitButton(0), _restoreButton(0), _largeSelect(0), _smallSelect(0) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+ bool isDemo = vm->isDemo();
+
+ _playerWon = (deathReason == kPlayerWonGame);
+
+ Common::String prefix = "Images/";
+ Common::String imageName;
+ if (isDemo) {
+ prefix += "Demo/";
+ imageName = prefix;
+
+ switch (deathReason) {
+ case kDeathFallOffCliff:
+ imageName += "dPfall";
+ break;
+ case kDeathEatenByDinosaur:
+ imageName += "dPdino";
+ break;
+ case kDeathStranded:
+ imageName += "dPstuck";
+ break;
+ default:
+ imageName += "dPdemowin";
+ break;
+ }
+
+ imageName += ".pict";
+ } else {
+ prefix += "Death Screens/";
+ imageName = prefix;
+
+ static const char *fileNames[] = {
+ "dAunmade", "dAbombed", "dAshot", "dAassass", "dAnuked",
+ "dTunmade", "dTshot", "dPfall", "dPdino", "dPstuck",
+ "dNchoke", "dNcaught", "dNcaught", "dNsub", "dNrobot1",
+ "dNrobot2", "dMfall", "dMcaught", "dMtracks", "dMrobot",
+ "dMtoast", "dMexplo1", "dMexplo2", "dMchoke1", "dMchoke2",
+ "dMdroid", "dMfall", "dMgears", "dMshutt1", "dMshutt2",
+ "dWpoison", "dWcaught", "dWplasma", "dWshot", "dAfinale"
+ };
+
+ imageName += fileNames[deathReason - 1];
+ imageName += ".pict";
+ }
+
+ _deathBackground.initFromPICTFile(imageName);
+ _deathReason = deathReason;
+
+ if (!isDemo) {
+ vm->_gfx->setCurSurface(_deathBackground.getSurface());
+ drawAllScores();
+ vm->_gfx->setCurSurface(vm->_gfx->getWorkArea());
+ }
+
+ _deathBackground.setDisplayOrder(0);
+ _deathBackground.startDisplaying();
+ _deathBackground.show();
+
+ if (isDemo) {
+ if (_playerWon) // Make credits button...
+ _continueButton.initFromPICTFile(prefix + "Credits.pict");
+ else // Make continue button...
+ _continueButton.initFromPICTFile(prefix + "Continue.pict");
+
+ _mainMenuButton.initFromPICTFile(prefix + "MainMenu.pict");
+ _mainMenuButton.setDisplayOrder(1);
+ _mainMenuButton.moveElementTo(kMainMenuLeftDemo, kMainMenuTopDemo);
+ _mainMenuButton.startDisplaying();
+
+ _quitButton.initFromPICTFile(prefix + "Quit.pict");
+ _quitButton.setDisplayOrder(1);
+ _quitButton.moveElementTo(kQuitLeftDemo, kQuitTopDemo);
+ _quitButton.startDisplaying();
+
+ _menuSelection = kDeathScreenContinueDemo;
+ } else {
+ if (!_playerWon) {
+ _mainMenuButton.initFromPICTFile(prefix + "MainMenu.pict");
+ _mainMenuButton.setDisplayOrder(1);
+ _mainMenuButton.moveElementTo(kMainMenuLeft, kMainMenuTop);
+ _mainMenuButton.startDisplaying();
+
+ _restoreButton.initFromPICTFile(prefix + "Restore.pict");
+ _restoreButton.setDisplayOrder(1);
+ _restoreButton.moveElementTo(kRestoreLeftDeath, kRestoreTopDeath);
+ _restoreButton.startDisplaying();
+ }
+
+ _continueButton.initFromPICTFile(prefix + "Continue.pict");
+
+ _menuSelection = kDeathScreenContinue;
+ }
+
+ _smallSelect.initFromPICTFile(prefix + "SelectS.pict", true);
+ _smallSelect.setDisplayOrder(2);
+ _smallSelect.startDisplaying();
+
+ _continueButton.setDisplayOrder(1);
+ _continueButton.moveElementTo(kContinueLeft, kContinueTop);
+ _continueButton.startDisplaying();
+
+ if (isDemo || !_playerWon) {
+ _largeSelect.initFromPICTFile(prefix + "SelectL.pict", true);
+ _largeSelect.setDisplayOrder(2);
+ _largeSelect.startDisplaying();
+ } else {
+ _triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph");
+ _triumphSound.playSound();
+ }
+
+ updateDisplay();
+}
+
+void DeathMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ if (input.upButtonDown()) {
+ if (_menuSelection > (vm->isDemo() ? kFirstDeathSelectionDemo : kFirstDeathSelection)) {
+ _menuSelection--;
+ updateDisplay();
+ }
+ } else if (input.downButtonDown() && (vm->isDemo() || !_playerWon)) {
+ if (_menuSelection < (vm->isDemo() ? kLastDeathSelectionDemo : kLastDeathSelection)) {
+ _menuSelection++;
+ updateDisplay();
+ }
+ } else if (JMPPPInput::isMenuButtonPressInput(input)) {
+ if (vm->isDemo()) {
+ switch (_menuSelection) {
+ case kDeathScreenContinueDemo:
+ _continueButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _continueButton.hide();
+ setLastCommand(kMenuCmdDeathContinue);
+ break;
+ case kDeathScreenQuitDemo:
+ _quitButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _quitButton.hide();
+ setLastCommand(kMenuCmdDeathQuitDemo);
+ break;
+ case kDeathScreenMainMenuDemo:
+ _mainMenuButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _mainMenuButton.hide();
+ setLastCommand(kMenuCmdDeathMainMenuDemo);
+ break;
+ }
+ } else {
+ switch (_menuSelection) {
+ case kDeathScreenContinue:
+ _continueButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _continueButton.hide();
+ setLastCommand(kMenuCmdDeathContinue);
+ break;
+ case kDeathScreenRestore:
+ _restoreButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _restoreButton.hide();
+ setLastCommand(kMenuCmdDeathRestore);
+ break;
+ case kDeathScreenMainMenu:
+ _mainMenuButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _mainMenuButton.hide();
+ setLastCommand(kMenuCmdDeathMainMenu);
+ break;
+ }
+ }
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void DeathMenu::updateDisplay() {
+ if (((PegasusEngine *)g_engine)->isDemo()) {
+ switch (_menuSelection) {
+ case kDeathScreenContinueDemo:
+ _smallSelect.moveElementTo(kContinueSelectLeft, kContinueSelectTopDemo);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kDeathScreenQuitDemo:
+ _largeSelect.moveElementTo(kQuitSelectLeftDemo, kQuitSelectTopDemo);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kDeathScreenMainMenuDemo:
+ _smallSelect.moveElementTo(kMainMenuSelectLeftDemo, kMainMenuSelectTopDemo);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ }
+ } else {
+ switch (_menuSelection) {
+ case kDeathScreenContinue:
+ _smallSelect.moveElementTo(kContinueSelectLeft, kContinueSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kDeathScreenRestore:
+ _smallSelect.moveElementTo(kRestoreSelectLeftDeath, kRestoreSelectTopDeath);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kDeathScreenMainMenu:
+ _largeSelect.moveElementTo(kMainMenuSelectLeft, kMainMenuSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ }
+ }
+}
+
+void DeathMenu::drawAllScores() {
+ Surface numbers;
+ numbers.getImageFromPICTFile("Images/Death Screens/Numbers.pict");
+
+ Common::Rect scoreBounds;
+ GameScoreType caldoriaTotal = 0;
+
+ switch (_deathReason) {
+ case kDeathCardBomb:
+ case kDeathShotBySinclair:
+ case kDeathSinclairShotDelegate:
+ case kDeathNuclearExplosion:
+ case kDeathGassedInNorad:
+ case kDeathWokeUpNorad:
+ case kDeathArrestedInNorad:
+ case kDeathSubDestroyed:
+ case kDeathRobotThroughNoradDoor:
+ case kDeathRobotSubControlRoom:
+ case kDeathWrongShuttleLock:
+ case kDeathArrestedInMars:
+ case kDeathRunOverByPod:
+ case kDeathDidntGetOutOfWay:
+ case kDeathReactorBurn:
+ case kDeathDidntFindMarsBomb:
+ case kDeathDidntDisarmMarsBomb:
+ case kDeathNoMaskInMaze:
+ case kDeathNoAirInMaze:
+ case kDeathGroundByMazebot:
+ case kDeathMissedOreBucket:
+ case kDeathDidntLeaveBucket:
+ case kDeathRanIntoCanyonWall:
+ case kDeathRanIntoSpaceJunk:
+ case kDeathDidntStopPoison:
+ case kDeathArrestedInWSC:
+ case kDeathHitByPlasma:
+ case kDeathShotOnCatwalk:
+ case kPlayerWonGame:
+ caldoriaTotal += kMaxCaldoriaTSAScoreAfter;
+ scoreBounds = Common::Rect(kDeathScreenScoreLeft, kDeathScreenScoreTop - kDeathScreenScoreSkipVert * 5,
+ kDeathScreenScoreLeft + kDeathScreenScoreWidth, kDeathScreenScoreTop - kDeathScreenScoreSkipVert * 5 + kDeathScreenScoreHeight);
+ drawScore(GameState.getGandhiScore(), kMaxGandhiScore, scoreBounds, &numbers);
+
+ scoreBounds.translate(0, kDeathScreenScoreSkipVert);
+ drawScore(GameState.getWSCScore(), kMaxWSCScore, scoreBounds, &numbers);
+
+ scoreBounds.translate(0, kDeathScreenScoreSkipVert);
+ drawScore(GameState.getNoradScore(), kMaxNoradScore, scoreBounds, &numbers);
+
+ scoreBounds.translate(0, kDeathScreenScoreSkipVert);
+ drawScore(GameState.getMarsScore(), kMaxMarsScore, scoreBounds, &numbers);
+ // fall through
+ case kDeathFallOffCliff:
+ case kDeathEatenByDinosaur:
+ case kDeathStranded:
+ case kDeathShotByTSARobots:
+ scoreBounds = Common::Rect(kDeathScreenScoreLeft, kDeathScreenScoreTop - kDeathScreenScoreSkipVert,
+ kDeathScreenScoreLeft + kDeathScreenScoreWidth, kDeathScreenScoreTop - kDeathScreenScoreSkipVert + kDeathScreenScoreHeight);
+ drawScore(GameState.getPrehistoricScore(), kMaxPrehistoricScore, scoreBounds, &numbers);
+ // fall through
+ case kDeathUncreatedInCaldoria:
+ case kDeathUncreatedInTSA:
+ scoreBounds = Common::Rect(kDeathScreenScoreLeft, kDeathScreenScoreTop, kDeathScreenScoreLeft + kDeathScreenScoreWidth,
+ kDeathScreenScoreTop + kDeathScreenScoreHeight);
+ caldoriaTotal += kMaxCaldoriaTSAScoreBefore;
+ drawScore(GameState.getCaldoriaTSAScore(), caldoriaTotal, scoreBounds, &numbers);
+
+ scoreBounds = Common::Rect(kDeathScreenScoreLeft, kDeathScreenScoreTop - kDeathScreenScoreSkipVert * 6,
+ kDeathScreenScoreLeft + kDeathScreenScoreWidth, kDeathScreenScoreTop - kDeathScreenScoreSkipVert * 6 + kDeathScreenScoreHeight);
+
+ drawScore(GameState.getTotalScore(), kMaxTotalScore, scoreBounds, &numbers);
+ break;
+ }
+}
+
+enum {
+ kPauseMenuSave,
+ kPauseMenuContinue,
+ kPauseMenuRestore,
+ kPauseMenuSoundFX,
+ kPauseMenuAmbience,
+ kPauseMenuWalkthru,
+ kPauseMenuQuitToMainMenu,
+
+ kFirstPauseSelection = kPauseMenuSave,
+ kLastPauseSelection = kPauseMenuQuitToMainMenu
+};
+
+static const CoordType kPauseLeft = 194;
+static const CoordType kPauseTop = 68;
+
+static const CoordType kSaveGameLeft = kPauseLeft + 6;
+static const CoordType kSaveGameTop = kPauseTop + 56;
+
+static const CoordType kSaveGameSelectLeft = kPauseLeft - 44;
+static const CoordType kSaveGameSelectTop = kPauseTop + 52;
+
+static const CoordType kPauseContinueLeft = kPauseLeft + 18;
+static const CoordType kPauseContinueTop = kPauseTop + 100;
+
+static const CoordType kPauseContinueSelectLeft = kPauseLeft - 44;
+static const CoordType kPauseContinueSelectTop = kPauseTop + 95;
+
+static const CoordType kPauseRestoreLeft = kPauseLeft + 18;
+static const CoordType kPauseRestoreTop = kPauseTop + 136;
+
+static const CoordType kPauseRestoreSelectLeft = kPauseLeft - 44;
+static const CoordType kPauseRestoreSelectTop = kPauseTop + 131;
+
+static const CoordType kSoundFXLeft = kPauseLeft + 128;
+static const CoordType kSoundFXTop = kPauseTop + 187;
+static const CoordType kSoundFXRight = kSoundFXLeft + 96;
+static const CoordType kSoundFXBottom = kSoundFXTop + 14;
+
+static const CoordType kSoundFXSelectLeft = kPauseLeft - 44;
+static const CoordType kSoundFXSelectTop = kPauseTop + 172;
+
+static const CoordType kAmbienceLeft = kPauseLeft + 128;
+static const CoordType kAmbienceTop = kPauseTop + 227;
+static const CoordType kAmbienceRight = kAmbienceLeft + 96;
+static const CoordType kAmbienceBottom = kAmbienceTop + 14;
+
+static const CoordType kAmbienceSelectLeft = kPauseLeft - 44;
+static const CoordType kAmbienceSelectTop = kPauseTop + 212;
+
+static const CoordType kWalkthruLeft = kPauseLeft + 128;
+static const CoordType kWalkthruTop = kPauseTop + 264;
+
+static const CoordType kWalkthruSelectLeft = kPauseLeft - 44;
+static const CoordType kWalkthruSelectTop = kPauseTop + 255;
+
+static const CoordType kQuitLeft = kPauseLeft + 18;
+static const CoordType kQuitTop = kPauseTop + 302;
+
+static const CoordType kQuitSelectLeft = kPauseLeft - 44;
+static const CoordType kQuitSelectTop = kPauseTop + 297;
+
+// These are relative to the pause background.
+static const CoordType kPauseScoreLeft = 130;
+static const CoordType kPauseScoreTop = 34;
+static const CoordType kPauseScoreRight = kPauseScoreLeft + 108;
+static const CoordType kPauseScoreBottom = kPauseScoreTop + 12;
+
+// Never set the current input handler to the CPauseMenu.
+PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButton(0), _restoreButton(0),
+ _walkthroughButton(0), _continueButton(0), _soundFXLevel(0), _ambienceLevel(0), _quitButton(0),
+ _largeSelect(0), _smallSelect(0) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _pauseBackground.initFromPICTFile("Images/Pause Screen/PausScrn.pict", true);
+
+ if (!vm->isDemo()) {
+ Surface numbers;
+ numbers.getImageFromPICTFile("Images/Pause Screen/Numbers.pict");
+ vm->_gfx->setCurSurface(_pauseBackground.getSurface());
+ drawScore(GameState.getTotalScore(), kMaxTotalScore,
+ Common::Rect(kPauseScoreLeft, kPauseScoreTop, kPauseScoreRight, kPauseScoreBottom), &numbers);
+ vm->_gfx->setCurSurface(vm->_gfx->getWorkArea());
+ }
+
+ _pauseBackground.setDisplayOrder(kPauseMenuOrder);
+ _pauseBackground.moveElementTo(kPauseLeft, kPauseTop);
+ _pauseBackground.startDisplaying();
+ _pauseBackground.show();
+
+ if (!vm->isDemo()) {
+ _saveButton.initFromPICTFile("Images/Pause Screen/SaveGame.pict");
+ _saveButton.setDisplayOrder(kSaveGameOrder);
+ _saveButton.moveElementTo(kSaveGameLeft, kSaveGameTop);
+ _saveButton.startDisplaying();
+
+ _restoreButton.initFromPICTFile("Images/Pause Screen/Restore.pict");
+ _restoreButton.setDisplayOrder(kRestoreOrder);
+ _restoreButton.moveElementTo(kPauseRestoreLeft, kPauseRestoreTop);
+ _restoreButton.startDisplaying();
+
+ _walkthroughButton.initFromPICTFile("Images/Pause Screen/Walkthru.pict");
+ _walkthroughButton.setDisplayOrder(kWalkthruOrder);
+ _walkthroughButton.moveElementTo(kWalkthruLeft, kWalkthruTop);
+ _walkthroughButton.startDisplaying();
+
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ }
+
+ _continueButton.initFromPICTFile("Images/Pause Screen/Continue.pict");
+ _continueButton.setDisplayOrder(kContinueOrder);
+ _continueButton.moveElementTo(kPauseContinueLeft, kPauseContinueTop);
+ _continueButton.startDisplaying();
+
+ _soundFXLevel.setDisplayOrder(kSoundFXOrder);
+ _soundFXLevel.setBounds(Common::Rect(kSoundFXLeft, kSoundFXTop, kSoundFXRight, kSoundFXBottom));
+ _soundFXLevel.startDisplaying();
+ _soundFXLevel.show();
+ _soundFXLevel.setSoundLevel(vm->getSoundFXLevel());
+
+ _ambienceLevel.setDisplayOrder(kAmbienceOrder);
+ _ambienceLevel.setBounds(Common::Rect(kAmbienceLeft, kAmbienceTop, kAmbienceRight, kAmbienceBottom));
+ _ambienceLevel.startDisplaying();
+ _ambienceLevel.show();
+ _ambienceLevel.setSoundLevel(vm->getAmbienceLevel());
+
+ _quitButton.initFromPICTFile("Images/Pause Screen/Quit2MM.pict");
+ _quitButton.setDisplayOrder(kQuitToMainMenuOrder);
+ _quitButton.moveElementTo(kQuitLeft, kQuitTop);
+ _quitButton.startDisplaying();
+
+ _largeSelect.initFromPICTFile("Images/Pause Screen/SelectL.pict", true);
+ _largeSelect.setDisplayOrder(kPauseLargeHiliteOrder);
+ _largeSelect.startDisplaying();
+
+ _smallSelect.initFromPICTFile("Images/Pause Screen/SelectS.pict", true);
+ _smallSelect.setDisplayOrder(kPauseSmallHiliteOrder);
+ _smallSelect.startDisplaying();
+
+ _menuSelection = (vm->isDemo()) ? kPauseMenuContinue : kPauseMenuSave;
+
+ updateDisplay();
+}
+
+void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ if (input.upButtonDown()) {
+ if (vm->isDemo()) {
+ if (_menuSelection > kPauseMenuContinue) {
+ switch (_menuSelection) {
+ case kPauseMenuSoundFX:
+ _menuSelection = kPauseMenuContinue;
+ break;
+ case kPauseMenuAmbience:
+ _menuSelection = kPauseMenuSoundFX;
+ break;
+ case kPauseMenuQuitToMainMenu:
+ _menuSelection = kPauseMenuAmbience;
+ break;
+ }
+ updateDisplay();
+ }
+ } else {
+ if (_menuSelection > kFirstPauseSelection) {
+ _menuSelection--;
+ updateDisplay();
+ }
+ }
+ } else if (input.downButtonDown()) {
+ if (vm->isDemo()) {
+ if (_menuSelection < kPauseMenuQuitToMainMenu) {
+ switch (_menuSelection) {
+ case kPauseMenuContinue:
+ _menuSelection = kPauseMenuSoundFX;
+ break;
+ case kPauseMenuSoundFX:
+ _menuSelection = kPauseMenuAmbience;
+ break;
+ case kPauseMenuAmbience:
+ _menuSelection = kPauseMenuQuitToMainMenu;
+ break;
+ }
+ updateDisplay();
+ }
+ } else {
+ if (_menuSelection < kLastPauseSelection) {
+ _menuSelection++;
+ updateDisplay();
+ }
+ }
+ } else if (input.leftButtonDown()) {
+ if (_menuSelection == kPauseMenuSoundFX) {
+ _soundFXLevel.decrementLevel();
+ vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
+ } else if (_menuSelection == kPauseMenuAmbience) {
+ _ambienceLevel.decrementLevel();
+ vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
+ } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
+ GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ else
+ _walkthroughButton.hide();
+ }
+ } else if (input.rightButtonDown()) {
+ if (_menuSelection == kPauseMenuSoundFX) {
+ _soundFXLevel.incrementLevel();
+ vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
+ } else if (_menuSelection == kPauseMenuAmbience) {
+ _ambienceLevel.incrementLevel();
+ vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
+ } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
+ GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ else
+ _walkthroughButton.hide();
+ }
+ } else if (JMPPPInput::isMenuButtonPressInput(input)) {
+ switch (_menuSelection) {
+ case kPauseMenuSave:
+ _saveButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _saveButton.hide();
+ setLastCommand(kMenuCmdPauseSave);
+ break;
+ case kPauseMenuRestore:
+ _restoreButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _restoreButton.hide();
+ setLastCommand(kMenuCmdPauseRestore);
+ break;
+ case kPauseMenuContinue:
+ _continueButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _continueButton.hide();
+ setLastCommand(kMenuCmdPauseContinue);
+ break;
+ case kPauseMenuWalkthru:
+ GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ else
+ _walkthroughButton.hide();
+ break;
+ case kPauseMenuQuitToMainMenu:
+ _quitButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _quitButton.hide();
+ setLastCommand(kMenuCmdPauseQuit);
+ break;
+ }
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void PauseMenu::updateDisplay() {
+ switch (_menuSelection) {
+ case kPauseMenuSave:
+ _largeSelect.moveElementTo(kSaveGameSelectLeft, kSaveGameSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuContinue:
+ _smallSelect.moveElementTo(kPauseContinueSelectLeft, kPauseContinueSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kPauseMenuRestore:
+ _smallSelect.moveElementTo(kPauseRestoreSelectLeft, kPauseRestoreSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kPauseMenuSoundFX:
+ _largeSelect.moveElementTo(kSoundFXSelectLeft, kSoundFXSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuAmbience:
+ _largeSelect.moveElementTo(kAmbienceSelectLeft, kAmbienceSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuWalkthru:
+ _largeSelect.moveElementTo(kWalkthruSelectLeft, kWalkthruSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuQuitToMainMenu:
+ _smallSelect.moveElementTo(kQuitSelectLeft, kQuitSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ }
+
+ ((PegasusEngine *)g_engine)->resetIntroTimer();
+}
+
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/menu.h b/engines/pegasus/menu.h
new file mode 100644
index 0000000000..288b846093
--- /dev/null
+++ b/engines/pegasus/menu.h
@@ -0,0 +1,171 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_MENU_H
+#define PEGASUS_MENU_H
+
+#include "pegasus/constants.h"
+#include "pegasus/fader.h"
+#include "pegasus/input.h"
+#include "pegasus/movie.h"
+#include "pegasus/sound.h"
+#include "pegasus/surface.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+class GameMenu : public IDObject, public InputHandler {
+public:
+ GameMenu(const uint32);
+ virtual ~GameMenu() {}
+
+ virtual void becomeCurrentHandler();
+ virtual void restorePreviousHandler();
+
+ GameMenuCommand getLastCommand() { return _lastCommand; }
+ void clearLastCommand() { _lastCommand = kMenuCmdNoCommand; }
+
+protected:
+ void setLastCommand(const GameMenuCommand command) { _lastCommand = command; }
+
+ InputHandler *_previousHandler;
+ GameMenuCommand _lastCommand;
+
+ void drawScore(GameScoreType, GameScoreType, const Common::Rect &, Surface *);
+
+private:
+ void drawNumber(GameScoreType, CoordType &, CoordType, Surface *);
+};
+
+class Hotspot;
+
+class MainMenu : public GameMenu {
+public:
+ MainMenu();
+ virtual ~MainMenu();
+
+ virtual void handleInput(const Input &input, const Hotspot *);
+ void startMainMenuLoop();
+ void stopMainMenuLoop();
+
+protected:
+ void updateDisplay();
+
+ uint32 _menuSelection;
+
+ // Full and Demo
+ Picture _menuBackground;
+ Picture _startButton;
+ Picture _creditsButton;
+ Picture _quitButton;
+ Picture _largeSelect;
+ Picture _smallSelect;
+
+ // Full only
+ bool _adventureMode;
+ Picture _overviewButton;
+ Picture _restoreButton;
+ Picture _adventureButton;
+ Picture _walkthroughButton;
+
+ Sound _menuLoop;
+ SoundFader _menuFader;
+};
+
+class CreditsMenu : public GameMenu {
+public:
+ CreditsMenu();
+ virtual ~CreditsMenu() {}
+
+ virtual void handleInput(const Input &input, const Hotspot *);
+
+protected:
+ void newMenuSelection(const int);
+ void newMovieTime(const TimeValue);
+
+ int _menuSelection;
+ Picture _menuBackground;
+ Movie _creditsMovie;
+ Picture _mainMenuButton;
+ Picture _largeSelect;
+ Picture _smallSelect;
+};
+
+class DeathMenu : public GameMenu {
+public:
+ DeathMenu(const DeathReason);
+ virtual ~DeathMenu() {}
+
+ virtual void handleInput(const Input &input, const Hotspot *);
+
+ bool playerWon() { return _playerWon; }
+
+protected:
+ void drawAllScores();
+
+ void updateDisplay();
+
+ bool _playerWon;
+ int _menuSelection;
+ DeathReason _deathReason;
+
+ Picture _deathBackground;
+ Picture _continueButton;
+ Picture _restoreButton;
+ Picture _mainMenuButton;
+ Picture _quitButton;
+
+ Picture _largeSelect;
+ Picture _smallSelect;
+
+ Sound _triumphSound;
+};
+
+class PauseMenu : public GameMenu {
+public:
+ PauseMenu();
+ virtual ~PauseMenu() {}
+
+ virtual void handleInput(const Input &input, const Hotspot *);
+
+protected:
+ void updateDisplay();
+
+ uint32 _menuSelection;
+ Picture _pauseBackground;
+ Picture _saveButton;
+ Picture _restoreButton;
+ Picture _walkthroughButton;
+ Picture _continueButton;
+ SoundLevel _soundFXLevel;
+ SoundLevel _ambienceLevel;
+ Picture _quitButton;
+ Picture _largeSelect;
+ Picture _smallSelect;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/module.mk b/engines/pegasus/module.mk
new file mode 100644
index 0000000000..cb44a04171
--- /dev/null
+++ b/engines/pegasus/module.mk
@@ -0,0 +1,100 @@
+MODULE := engines/pegasus
+
+MODULE_OBJS = \
+ compass.o \
+ console.o \
+ cursor.o \
+ detection.o \
+ elements.o \
+ energymonitor.o \
+ fader.o \
+ gamestate.o \
+ graphics.o \
+ hotspot.o \
+ input.o \
+ interface.o \
+ menu.o \
+ movie.o \
+ notification.o \
+ pegasus.o \
+ sound.o \
+ surface.o \
+ timers.o \
+ transition.o \
+ util.o \
+ ai/ai_action.o \
+ ai/ai_area.o \
+ ai/ai_condition.o \
+ ai/ai_rule.o \
+ items/autodragger.o \
+ items/inventory.o \
+ items/inventorypicture.o \
+ items/item.o \
+ items/itemdragger.o \
+ items/itemlist.o \
+ items/biochips/aichip.o \
+ items/biochips/biochipitem.o \
+ items/biochips/mapchip.o \
+ items/biochips/mapimage.o \
+ items/biochips/opticalchip.o \
+ items/biochips/pegasuschip.o \
+ items/biochips/retscanchip.o \
+ items/biochips/shieldchip.o \
+ items/inventory/airmask.o \
+ items/inventory/gascanister.o \
+ items/inventory/inventoryitem.o \
+ items/inventory/keycard.o \
+ neighborhood/door.o \
+ neighborhood/exit.o \
+ neighborhood/extra.o \
+ neighborhood/hotspotinfo.o \
+ neighborhood/neighborhood.o \
+ neighborhood/spot.o \
+ neighborhood/turn.o \
+ neighborhood/view.o \
+ neighborhood/zoom.o \
+ neighborhood/caldoria/caldoria.o \
+ neighborhood/caldoria/caldoria4dsystem.o \
+ neighborhood/caldoria/caldoriabomb.o \
+ neighborhood/caldoria/caldoriamessages.o \
+ neighborhood/caldoria/caldoriamirror.o \
+ neighborhood/mars/energybeam.o \
+ neighborhood/mars/gravitoncannon.o \
+ neighborhood/mars/hermite.o \
+ neighborhood/mars/mars.o \
+ neighborhood/mars/planetmover.o \
+ neighborhood/mars/reactor.o \
+ neighborhood/mars/robotship.o \
+ neighborhood/mars/shuttleenergymeter.o \
+ neighborhood/mars/shuttlehud.o \
+ neighborhood/mars/shuttleweapon.o \
+ neighborhood/mars/spacechase3d.o \
+ neighborhood/mars/spacejunk.o \
+ neighborhood/mars/tractorbeam.o \
+ neighborhood/norad/norad.o \
+ neighborhood/norad/noradelevator.o \
+ neighborhood/norad/pressuredoor.o \
+ neighborhood/norad/pressuretracker.o \
+ neighborhood/norad/subcontrolroom.o \
+ neighborhood/norad/subplatform.o \
+ neighborhood/norad/alpha/ecrmonitor.o \
+ neighborhood/norad/alpha/fillingstation.o \
+ neighborhood/norad/alpha/noradalpha.o \
+ neighborhood/norad/alpha/panorama.o \
+ neighborhood/norad/alpha/panoramascroll.o \
+ neighborhood/norad/delta/globegame.o \
+ neighborhood/norad/delta/noraddelta.o \
+ neighborhood/prehistoric/prehistoric.o \
+ neighborhood/tsa/fulltsa.o \
+ neighborhood/tsa/tinytsa.o \
+ neighborhood/wsc/moleculebin.o \
+ neighborhood/wsc/wsc.o
+
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_PEGASUS), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp
new file mode 100644
index 0000000000..75c287c7a6
--- /dev/null
+++ b/engines/pegasus/movie.cpp
@@ -0,0 +1,280 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/system.h"
+#include "graphics/surface.h"
+#include "video/qt_decoder.h"
+#include "video/video_decoder.h"
+
+#include "pegasus/movie.h"
+
+namespace Pegasus {
+
+Movie::Movie(const DisplayElementID id) : Animation(id) {
+ _video = 0;
+ setScale(600);
+}
+
+Movie::~Movie() {
+ releaseMovie();
+}
+
+// *** Make sure this will stop displaying the movie.
+
+void Movie::releaseMovie() {
+ if (_video) {
+ delete _video;
+ _video = 0;
+ disposeAllCallBacks();
+ deallocateSurface();
+ }
+
+ setBounds(Common::Rect(0, 0, 0, 0));
+}
+
+void Movie::initFromMovieFile(const Common::String &fileName, bool transparent) {
+ _transparent = transparent;
+
+ releaseMovie();
+ _video = new Video::QuickTimeDecoder();
+ if (!_video->loadFile(fileName)) {
+ // Replace any colon with an underscore, since only Mac OS X
+ // supports that. See PegasusEngine::detectOpeningClosingDirectory()
+ // for more info.
+ Common::String newName(fileName);
+ if (newName.contains(':'))
+ for (uint i = 0; i < newName.size(); i++)
+ if (newName[i] == ':')
+ newName.setChar('_', i);
+
+ if (!_video->loadFile(newName))
+ error("Could not load video '%s'", fileName.c_str());
+ }
+
+ Common::Rect bounds(0, 0, _video->getWidth(), _video->getHeight());
+ sizeElement(_video->getWidth(), _video->getHeight());
+ _movieBox = bounds;
+
+ if (!isSurfaceValid())
+ allocateSurface(bounds);
+
+ setStart(0, getScale());
+ TimeBase::setStop(_video->getDuration().convertToFramerate(getScale()).totalNumberOfFrames(), getScale());
+}
+
+void Movie::redrawMovieWorld() {
+ if (_video && _video->needsUpdate()) {
+ const Graphics::Surface *frame = _video->decodeNextFrame();
+
+ if (!frame)
+ return;
+
+ // Make sure we have a surface in the current pixel format
+ Graphics::Surface *convertedFrame = 0;
+
+ if (frame->format != g_system->getScreenFormat()) {
+ convertedFrame = frame->convertTo(g_system->getScreenFormat());
+ frame = convertedFrame;
+ }
+
+ // Copy to the surface using _movieBox
+ uint16 width = MIN<int>(frame->w, _movieBox.width());
+ uint16 height = MIN<int>(frame->h, _movieBox.height());
+
+ for (uint16 y = 0; y < height; y++)
+ memcpy((byte *)_surface->getBasePtr(_movieBox.left, _movieBox.top + y), (const byte *)frame->getBasePtr(0, y), width * frame->format.bytesPerPixel);
+
+ if (convertedFrame) {
+ convertedFrame->free();
+ delete convertedFrame;
+ }
+
+ triggerRedraw();
+ }
+}
+
+void Movie::draw(const Common::Rect &r) {
+ Common::Rect worldBounds = _movieBox;
+ Common::Rect elementBounds;
+ getBounds(elementBounds);
+
+ worldBounds.moveTo(elementBounds.left, elementBounds.top);
+ Common::Rect r1 = r.findIntersectingRect(worldBounds);
+
+ Common::Rect r2 = r1;
+ r2.translate(_movieBox.left - elementBounds.left, _movieBox.top - elementBounds.top);
+ drawImage(r2, r1);
+}
+
+void Movie::moveMovieBoxTo(const CoordType h, const CoordType v) {
+ _movieBox.moveTo(h, v);
+}
+
+void Movie::setStop(const TimeValue stopTime, const TimeScale scale) {
+ TimeBase::setStop(stopTime, scale);
+
+ if (_video)
+ _video->setEndTime(Audio::Timestamp(0, _stopTime, _stopScale));
+}
+
+void Movie::setVolume(uint16 volume) {
+ if (_video)
+ _video->setVolume(MIN<uint>(volume, 0xFF));
+}
+
+void Movie::setTime(const TimeValue time, const TimeScale scale) {
+ if (_video) {
+ // Don't go past the ends of the movie
+ Common::Rational timeFrac = Common::Rational(time, ((scale == 0) ? getScale() : scale));
+
+ if (timeFrac < Common::Rational(_startTime, _startScale))
+ timeFrac = Common::Rational(_startTime, _startScale);
+ else if (timeFrac >= Common::Rational(_stopTime, _stopScale))
+ return;
+
+ _video->seek(Audio::Timestamp(0, timeFrac.getNumerator(), timeFrac.getDenominator()));
+ _time = timeFrac;
+ _lastMillis = 0;
+ }
+}
+
+void Movie::setRate(const Common::Rational rate) {
+ if (rate != 1 && rate != 0) {
+ warning("Cannot set movie rate");
+ start();
+ return;
+ }
+
+ TimeBase::setRate(rate);
+}
+
+void Movie::start() {
+ if (_video)
+ _video->start();
+
+ TimeBase::start();
+}
+
+void Movie::stop() {
+ if (_video)
+ _video->stop();
+
+ TimeBase::stop();
+}
+
+void Movie::resume() {
+ if (_paused) {
+ if (_video)
+ _video->pauseVideo(false);
+
+ _paused = false;
+ }
+}
+
+void Movie::pause() {
+ if (isRunning() && !_paused) {
+ if (_video)
+ _video->pauseVideo(true);
+
+ _paused = true;
+ _pauseStart = g_system->getMillis();
+ }
+}
+
+TimeValue Movie::getDuration(const TimeScale scale) const {
+ // Unlike TimeBase::getDuration(), this returns the whole duration of the movie
+ // The original source has a TODO to make this behave like TimeBase::getDuration(),
+ // but the problem is that too much code requires this function to behave this way...
+
+ if (_video)
+ return _video->getDuration().convertToFramerate(((scale == 0) ? getScale() : scale)).totalNumberOfFrames();
+
+ return 0;
+}
+
+void Movie::updateTime() {
+ // The reason why we overrode TimeBase's updateTime():
+ // Again, avoiding timers and handling it here
+ if (_video && _video->isPlaying() && !_video->isPaused()) {
+ redrawMovieWorld();
+
+ uint32 startTime = _startTime * getScale() / _startScale;
+ uint32 stopTime = _stopTime * getScale() / _stopScale;
+ uint32 actualTime = CLIP<int>(_video->getTime() * getScale() / 1000, startTime, stopTime);
+
+ // HACK: Due to the inaccuracy of the time, we won't actually allow us to hit
+ // the stop time unless we've actually reached the end of the segment.
+ if (actualTime == stopTime && !_video->endOfVideo())
+ actualTime--;
+
+ _time = Common::Rational(actualTime, getScale());
+ }
+}
+
+GlowingMovie::GlowingMovie(const DisplayElementID id) : Movie(id) {
+ _glowing = false;
+}
+
+void GlowingMovie::draw(const Common::Rect &r) {
+ // Make sure the rectangles are clipped properly, OR guarantee that _bounds will
+ // never fall off the screen.
+ if (_glowing) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ copyToCurrentPortTransparentGlow(_movieBox, bounds);
+ } else {
+ Movie::draw(r);
+ }
+}
+
+void GlowingMovie::setBounds(const Common::Rect &r) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ if (r != bounds) {
+ // Avoid Movie::setBounds.
+ // clone2727 asks why, but goes along with it
+ Animation::setBounds(r);
+ }
+}
+
+ScalingMovie::ScalingMovie(const DisplayElementID id) : GlowingMovie(id) {
+}
+
+void ScalingMovie::draw(const Common::Rect &) {
+ // Make sure the rectangles are clipped properly, OR guarantee that _bounds will
+ // never fall off the screen.
+
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ if (_glowing)
+ scaleTransparentCopyGlow(_movieBox, bounds);
+ else
+ scaleTransparentCopy(_movieBox, bounds);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/movie.h b/engines/pegasus/movie.h
new file mode 100644
index 0000000000..9b9cc2bdbe
--- /dev/null
+++ b/engines/pegasus/movie.h
@@ -0,0 +1,105 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_MOVIE_H
+#define PEGASUS_MOVIE_H
+
+#include "common/str.h"
+
+#include "pegasus/elements.h"
+#include "pegasus/surface.h"
+
+namespace Video {
+class VideoDecoder;
+}
+
+namespace Pegasus {
+
+class Movie : public Animation, public PixelImage {
+public:
+ Movie(const DisplayElementID);
+ virtual ~Movie();
+
+ virtual void initFromMovieFile(const Common::String &fileName, bool transparent = false);
+
+ bool isMovieValid() { return _video != 0; }
+
+ virtual void releaseMovie();
+
+ virtual void draw(const Common::Rect &);
+ virtual void redrawMovieWorld();
+
+ virtual void setTime(const TimeValue, const TimeScale = 0);
+
+ virtual void setRate(const Common::Rational);
+
+ virtual void start();
+ virtual void stop();
+ virtual void resume();
+ virtual void pause();
+
+ virtual void moveMovieBoxTo(const CoordType, const CoordType);
+
+ virtual void setStop(const TimeValue, const TimeScale = 0);
+
+ virtual TimeValue getDuration(const TimeScale = 0) const;
+
+ // *** HACK ALERT
+ Video::VideoDecoder *getMovie() { return _video; }
+ void setVolume(uint16);
+
+protected:
+ void updateTime();
+
+ Video::VideoDecoder *_video;
+ Common::Rect _movieBox;
+};
+
+class GlowingMovie : public Movie {
+public:
+ GlowingMovie(DisplayElementID);
+ virtual ~GlowingMovie() {}
+
+ virtual void draw(const Common::Rect &);
+
+ void setBounds(const Common::Rect &);
+
+ void setGlowing(const bool glowing) { _glowing = glowing; }
+
+protected:
+ bool _glowing;
+};
+
+class ScalingMovie : public GlowingMovie {
+public:
+ ScalingMovie(DisplayElementID);
+ virtual ~ScalingMovie() {}
+
+ virtual void draw(const Common::Rect &);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
new file mode 100644
index 0000000000..140e6e8093
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
@@ -0,0 +1,1962 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/system.h"
+#include "video/qt_decoder.h"
+
+#include "pegasus/cursor.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/interface.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/caldoria/caldoria4dsystem.h"
+#include "pegasus/neighborhood/caldoria/caldoriabomb.h"
+#include "pegasus/neighborhood/caldoria/caldoriamessages.h"
+#include "pegasus/neighborhood/caldoria/caldoriamirror.h"
+#include "pegasus/neighborhood/tsa/fulltsa.h"
+
+namespace Pegasus {
+
+static const int16 kVidPhoneAngle = 30;
+static const int16 kReplicatorAngle = 50;
+static const int16 kDrawersAngle = -30;
+static const int16 kCaldoria53Angle = 45;
+static const int16 kCaldoria55Angle = -45;
+
+static const TimeValue kSinclairInterruptionTime1 = 2955;
+static const TimeValue kSinclairInterruptionTime2 = 6835;
+static const TimeValue kSinclairInterruptionTime3 = 9835;
+static const TimeValue kSinclairInterruptionTime4 = 12555;
+
+static const InputBits kPullbackInterruptFilter = kFilterAllInput;
+static const InputBits kRecalibrationInterruptFilter = kFilterAllInput;
+
+static const TimeValue kCaldoriaReplicatorIntroIn = 4933;
+static const TimeValue kCaldoriaReplicatorIntroOut = 6557;
+
+static const TimeValue kCaldoriaReplicatorWrongChoiceIn = 6557;
+static const TimeValue kCaldoriaReplicatorWrongChoiceOut = 8586;
+
+static const TimeValue kCaldoriaReplicatorOJChoiceIn = 8586;
+static const TimeValue kCaldoriaReplicatorOJChoiceOut = 11687;
+
+static const TimeValue kCaldoriaMessagesIntroIn = 11687;
+static const TimeValue kCaldoriaMessagesIntroOut = 13641;
+
+static const TimeValue kCaldoriaFirstMessageIn = 13641;
+static const TimeValue kCaldoriaFirstMessageOut = 14203;
+
+static const TimeValue kCaldoriaSecondMessageIn = 14203;
+static const TimeValue kCaldoriaSecondMessageOut = 14750;
+
+static const TimeValue kCaldoriaDoorCloseIn = 14750;
+static const TimeValue kCaldoriaDoorCloseOut = 15472;
+
+static const TimeValue kCaldoriaElevatorCloseIn = 15472;
+static const TimeValue kCaldoriaElevatorCloseOut = 16336;
+
+static const TimeValue kCaldoriaShowerCloseIn = 16336;
+static const TimeValue kCaldoriaShowerCloseOut = 17101;
+
+static const TimeValue kCaldoriaGTDoorCloseIn = 17101;
+static const TimeValue kCaldoriaGTDoorCloseOut = 18523;
+
+static const TimeValue kCaldoriaNobodyHomeIn = 18523;
+static const TimeValue kCaldoriaNobodyHomeOut = 21469;
+
+static const TimeValue kCaldoriaNoOtherFloorIn = 21469;
+static const TimeValue kCaldoriaNoOtherFloorOut = 28013;
+
+static const TimeValue kCaldoria4DInstructionsIn = 28013;
+static const TimeValue kCaldoria4DInstructionsOut = 29730;
+
+static const TimeValue kCaldoriaDrinkOJIn = 33910;
+static const TimeValue kCaldoriaDrinkOJOut = 35846;
+
+static const TimeValue kCaldoriaNoOtherDestinationIn = 35846;
+static const TimeValue kCaldoriaNoOtherDestinationOut = 37877;
+
+static const TimeValue kCaldoriaUhghIn = 37877;
+static const TimeValue kCaldoriaUhghOut = 38025;
+
+static const TimeValue kCaldoriaSinclairShootsOSIn = 38025;
+static const TimeValue kCaldoriaSinclairShootsOSOut = 40649;
+
+static const TimeValue kCaldoriaScreamingAfterIn = 40649;
+static const TimeValue kCaldoriaScreamingAfterOut = 47661;
+
+static const TimeValue k4FloorTime = 0;
+
+static const TimeValue k4To1Start = 40;
+static const TimeValue k4To1Stop = 7720;
+
+static const TimeValue k4To5Start = 7720;
+static const TimeValue k4To5Stop = 10280;
+
+static const TimeValue k4To2Time = 10280;
+
+static const TimeValue k4To3Time = 10320;
+
+static const TimeValue k1FloorTime = 10360;
+
+static const TimeValue k1To4Start = 10400;
+static const TimeValue k1To4Stop = 18080;
+
+static const TimeValue k1To5Start = 18080;
+static const TimeValue k1To5Stop = 28320;
+
+static const TimeValue k1To2Time = 28320;
+
+static const TimeValue k1To3Time = 28360;
+
+static const TimeValue k5FloorTime = 28400;
+
+static const TimeValue k5To1Start = 28440;
+static const TimeValue k5To1Stop = 38680;
+
+static const TimeValue k5To4Start = 38680;
+static const TimeValue k5To4Stop = 41240;
+
+static const TimeValue k5To2Time = 41240;
+
+static const TimeValue k5To3Time = 41280;
+
+// FuseFunction functions...
+
+const NotificationFlags kSinclairLoopDoneFlag = kLastNeighborhoodNotificationFlag << 1;
+
+SinclairCallBack::SinclairCallBack(Caldoria *caldoria) {
+ _caldoria = caldoria;
+}
+
+void SinclairCallBack::callBack() {
+ _caldoria->checkInterruptSinclair();
+}
+
+Caldoria::Caldoria(InputHandler* nextHandler, PegasusEngine *owner)
+ : Neighborhood(nextHandler, owner, "Caldoria", kCaldoriaID), _sinclairInterrupt(this) {
+ setIsItemTaken(kKeyCard);
+ setIsItemTaken(kOrangeJuiceGlassEmpty);
+ GameState.setTakenItemID(kOrangeJuiceGlassFull, GameState.isTakenItemID(kOrangeJuiceGlassEmpty));
+ _zoomOutSpot = 0;
+ _gunSprite = 0;
+}
+
+Caldoria::~Caldoria() {
+ _sinclairInterrupt.releaseCallBack();
+}
+
+void Caldoria::init() {
+ Neighborhood::init();
+
+ // We need this notification flag as well.
+ _neighborhoodNotification.notifyMe(this, kSinclairLoopDoneFlag, kSinclairLoopDoneFlag);
+
+ _sinclairInterrupt.initCallBack(&_navMovie, kCallBackAtTime);
+
+ forceStridingStop(kCaldoria55, kSouth, kAltCaldoriaSinclairDown);
+ forceStridingStop(kCaldoria50, kNorth, kAltCaldoriaSinclairDown);
+}
+
+void Caldoria::start() {
+ g_energyMonitor->stopEnergyDraining();
+
+ if (!GameState.getCaldoriaSeenPullback()) {
+ _vm->_gfx->doFadeOutSync(kOneSecond * kFifteenTicksPerSecond, kFifteenTicksPerSecond);
+
+ g_system->delayMillis(2 * 1000);
+
+ Video::VideoDecoder *pullbackMovie = new Video::QuickTimeDecoder();
+
+ if (!pullbackMovie->loadFile("Images/Caldoria/Pullback.movie"))
+ error("Could not load pullback movie");
+
+ // Draw the first frame so we can fade to it
+ const Graphics::Surface *frame = pullbackMovie->decodeNextFrame();
+ assert(frame);
+ assert(frame->format == g_system->getScreenFormat());
+ g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h);
+ _vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond);
+
+ bool saveAllowed = _vm->swapSaveAllowed(false);
+ bool openAllowed = _vm->swapLoadAllowed(false);
+
+ bool skipped = false;
+ Input input;
+
+ pullbackMovie->start();
+
+ while (!_vm->shouldQuit() && !pullbackMovie->endOfVideo()) {
+ if (pullbackMovie->needsUpdate()) {
+ frame = pullbackMovie->decodeNextFrame();
+
+ if (frame) {
+ g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h);
+ g_system->updateScreen();
+ }
+ }
+
+ InputDevice.getInput(input, kPullbackInterruptFilter);
+ if (input.anyInput() || _vm->saveRequested() || _vm->loadRequested()) {
+ skipped = true;
+ break;
+ }
+
+ g_system->delayMillis(10);
+ }
+
+ delete pullbackMovie;
+
+ if (_vm->shouldQuit())
+ return;
+
+ _vm->swapSaveAllowed(saveAllowed);
+ _vm->swapLoadAllowed(openAllowed);
+
+ ExtraTable::Entry entry;
+
+ if (!skipped) {
+ _vm->_gfx->doFadeOutSync(kThreeSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond, false);
+ g_system->delayMillis(3 * 1000 / 2);
+ getExtraEntry(kCaldoria00WakeUp1, entry);
+ _navMovie.setTime(entry.movieStart);
+ _navMovie.redrawMovieWorld();
+ _navMovie.show();
+ _vm->refreshDisplay();
+ _vm->_gfx->doFadeInSync(kOneSecond * kFifteenTicksPerSecond, kFifteenTicksPerSecond, false);
+ } else {
+ getExtraEntry(kCaldoria00WakeUp1, entry);
+ _navMovie.setTime(entry.movieStart);
+ _navMovie.redrawMovieWorld();
+ _navMovie.show();
+ }
+
+ GameState.setCaldoriaSeenPullback(true);
+ }
+
+ Neighborhood::start();
+}
+
+void Caldoria::flushGameState() {
+ GameState.setCaldoriaFuseTimeLimit(_utilityFuse.getTimeRemaining());
+}
+
+class AIBombActiveCondition : public AICondition {
+public:
+ AIBombActiveCondition() {}
+
+ bool fireCondition();
+};
+
+// Return true if player is on 53 east and Sinclair is shot.
+bool AIBombActiveCondition::fireCondition() {
+ return GameState.getCurrentRoom() == kCaldoria53 && GameState.getCurrentDirection() == kEast &&
+ GameState.getCaldoriaSinclairShot();
+}
+
+void Caldoria::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ if (g_AIArea) {
+ if (GameState.allTimeZonesFinished()) {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Caldoria/X49NB1", false);
+ AILocationCondition *locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kCaldoria49, kNorth));
+ AIRule *rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Caldoria/X56EH1", false);
+ AIBombActiveCondition *activeCondition = new AIBombActiveCondition();
+ rule = new AIRule(activeCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+ } else {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Caldoria/XAB2", false);
+ AITimerCondition *timerCondition = new AITimerCondition(kLateWarning3TimeLimit, 1, true);
+ AILocationCondition *locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kCaldoria44, kEast));
+ AINotCondition *notCondition = new AINotCondition(locCondition);
+ AIAndCondition *andCondition = new AIAndCondition(timerCondition, notCondition);
+ AIRule *rule = new AIRule(andCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Caldoria/XAB1", false);
+ timerCondition = new AITimerCondition(kLateWarning2TimeLimit, 1, true);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kCaldoria44, kEast));
+ notCondition = new AINotCondition(locCondition);
+ andCondition = new AIAndCondition(timerCondition, notCondition);
+ rule = new AIRule(andCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Caldoria/XA44EB", false);
+ locCondition = new AILocationCondition(3);
+ locCondition->addLocation(MakeRoomView(kCaldoria01, kNorth));
+ locCondition->addLocation(MakeRoomView(kCaldoria01, kEast));
+ locCondition->addLocation(MakeRoomView(kCaldoria01, kSouth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Caldoria/X42WH1", false);
+ AICondition *condition = makeLocationAndDoesntHaveItemCondition(kCaldoria44, kEast, kKeyCard);
+ rule = new AIRule(condition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ AIActivateRuleAction *ruleAction = new AIActivateRuleAction(rule);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kCaldoria42, kEast));
+ rule = new AIRule(locCondition, ruleAction);
+ g_AIArea->addAIRule(rule);
+ }
+ }
+}
+
+uint16 Caldoria::getDateResID() const {
+ return kDate2318ID;
+}
+
+TimeValue Caldoria::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraTable::Entry extra;
+ uint32 extraID = 0xffffffff;
+
+ switch (room) {
+ case kCaldoria00:
+ if (direction == kEast && _privateFlags.getFlag(kCaldoriaPrivate4DSystemOpenFlag))
+ extraID = k4DEnvironOpenView;
+ break;
+ case kCaldoriaDrawers:
+ if (direction == kNorth && _privateFlags.getFlag(kCaldoriaPrivateRightDrawerOpenFlag)) {
+ if (GameState.isTakenItemID(kKeyCard))
+ extraID = kRightDrawerOpenViewNoKeys;
+ else
+ extraID = kRightDrawerOpenViewWithKeys;
+ }
+ break;
+ case kCaldoria16:
+ if (direction == kSouth && GameState.getCaldoriaSeenSinclairInElevator())
+ extraID = kCaldoria16SouthViewWithElevator;
+ break;
+ case kCaldoriaReplicator:
+ if (GameState.getCaldoriaMadeOJ() && !(GameState.isTakenItemID(kOrangeJuiceGlassEmpty) || GameState.isTakenItemID(kOrangeJuiceGlassFull)))
+ extraID = kReplicatorNorthViewWithOJ;
+ break;
+ case kCaldoriaKiosk:
+ case kCaldoriaBinoculars:
+ return 0xffffffff;
+ case kCaldoria48:
+ if (direction == kNorth && GameState.getCaldoriaRoofDoorOpen())
+ extraID = kCa48NorthExplosion;
+ break;
+ }
+
+ if (extraID == 0xffffffff)
+ return Neighborhood::getViewTime(room, direction);
+
+ getExtraEntry(extraID, extra);
+ return extra.movieEnd - 1;
+}
+
+void Caldoria::startSpotOnceOnly(TimeValue startTime, TimeValue stopTime) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kCaldoria13, kEast):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen13CarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen13CarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria14, kEast):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen14CarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen14CarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria18, kWest):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen18CarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen18CarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria23, kSouth):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen23CarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen23CarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria33, kSouth):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen33CarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen33CarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria36, kNorth):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen36CarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen36CarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria41, kNorth):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen41NorthCarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen41NorthCarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria41, kEast):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen41EastCarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen41EastCarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ case MakeRoomView(kCaldoria41, kWest):
+ if (!_privateFlags.getFlag(kCaldoriaPrivateSeen41WestCarFlag) && _vm->getRandomBit() == 0) {
+ _privateFlags.setFlag(kCaldoriaPrivateSeen41WestCarFlag, true);
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ }
+ break;
+ default:
+ Neighborhood::startSpotOnceOnly(startTime, stopTime);
+ break;
+ }
+}
+
+void Caldoria::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &entry) {
+ Neighborhood::findSpotEntry(room, direction, flags, entry);
+
+ switch (room) {
+ case kCaldoria00:
+ if (direction == kEast && (!GameState.getCaldoriaINNAnnouncing() || GameState.getCaldoriaSeenINN()))
+ entry.clear();
+ break;
+ case kCaldoriaVidPhone:
+ if (direction == kNorth && GameState.getCaldoriaSeenMessages())
+ entry.clear();
+ break;
+ case kCaldoria44:
+ if (direction == kEast && GameState.getLastRoom() != kCaldoria42)
+ entry.clear();
+ break;
+ }
+}
+
+void Caldoria::startExitMovie(const ExitTable::Entry &exitEntry) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria05:
+ case kCaldoria07:
+ if (GameState.getCurrentDirection() == kWest)
+ closeCroppedMovie();
+ // fall through
+ case kCaldoria11:
+ if (GameState.getCurrentDirection() == kEast)
+ closeCroppedMovie();
+ break;
+ case kCaldoria13:
+ case kCaldoria14:
+ if (GameState.getCurrentDirection() == kNorth)
+ closeCroppedMovie();
+ break;
+ }
+
+ Neighborhood::startExitMovie(exitEntry);
+}
+
+void Caldoria::startZoomMovie(const ZoomTable::Entry &zoomEntry) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria12:
+ if (GameState.getCurrentDirection() == kNorth)
+ closeCroppedMovie();
+ break;
+ }
+
+ Neighborhood::startZoomMovie(zoomEntry);
+}
+
+void Caldoria::startDoorOpenMovie(const TimeValue startTime, const TimeValue stopTime) {
+ if (GameState.getCurrentRoom() == kCaldoria27 || GameState.getCurrentRoom() == kCaldoria28 || GameState.getCurrentRoom() == kCaldoria45)
+ // Must be opening elevator door.
+ closeCroppedMovie();
+
+ if (GameState.getCurrentRoom() == kCaldoria44 && GameState.getLastRoom() != kCaldoria42)
+ startExtraSequence(kArriveAtCaldoriaFromTSA, kDoorOpenCompletedFlag, false);
+ else
+ Neighborhood::startDoorOpenMovie(startTime, stopTime);
+}
+
+void Caldoria::startTurnPush(const TurnDirection turnDirection, const TimeValue newViewTime, const DirectionConstant destDirection) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria05:
+ case kCaldoria07:
+ if (GameState.getCurrentDirection() == kWest)
+ closeCroppedMovie();
+ break;
+ case kCaldoria11:
+ if (GameState.getCurrentDirection() == kEast)
+ closeCroppedMovie();
+ break;
+ case kCaldoria12:
+ case kCaldoria13:
+ case kCaldoria14:
+ case kCaldoria27:
+ case kCaldoria28:
+ case kCaldoria45:
+ if (GameState.getCurrentDirection() == kNorth)
+ closeCroppedMovie();
+ break;
+ case kCaldoria48:
+ if (_croppedMovie.isSurfaceValid())
+ closeCroppedMovie();
+ break;
+ }
+
+ Neighborhood::startTurnPush(turnDirection, newViewTime, destDirection);
+}
+
+void Caldoria::bumpIntoWall() {
+ requestSpotSound(kCaldoriaUhghIn, kCaldoriaUhghOut, kFilterNoInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+void Caldoria::closeDoorOffScreen(const RoomID room, const DirectionConstant direction) {
+ switch (room) {
+ case kCaldoria08:
+ if (direction == kNorth)
+ playSpotSoundSync(kCaldoriaShowerCloseIn, kCaldoriaShowerCloseOut);
+ else
+ playSpotSoundSync(kCaldoriaDoorCloseIn, kCaldoriaDoorCloseOut);
+ break;
+ case kCaldoria09:
+ playSpotSoundSync(kCaldoriaShowerCloseIn, kCaldoriaShowerCloseOut);
+ break;
+ case kCaldoria16:
+ case kCaldoria38:
+ case kCaldoria46:
+ case kCaldoria27:
+ case kCaldoria28:
+ case kCaldoria45:
+ playSpotSoundSync(kCaldoriaElevatorCloseIn, kCaldoriaElevatorCloseOut);
+ break;
+ case kCaldoria44:
+ case kCaldoria42:
+ if (GameState.getCurrentRoom() == kCaldoria42)
+ playSpotSoundSync(kCaldoriaGTDoorCloseIn, kCaldoriaGTDoorCloseOut);
+ break;
+ default:
+ playSpotSoundSync(kCaldoriaDoorCloseIn, kCaldoriaDoorCloseOut);
+ break;
+ }
+}
+
+int16 Caldoria::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ int16 result = Neighborhood::getStaticCompassAngle(room, dir);
+
+ switch (room) {
+ case kCaldoriaVidPhone:
+ result += kVidPhoneAngle;
+ break;
+ case kCaldoriaReplicator:
+ result += kReplicatorAngle;
+ break;
+ case kCaldoriaDrawers:
+ result += kDrawersAngle;
+ break;
+ case kCaldoria53:
+ result += kCaldoria53Angle;
+ break;
+ case kCaldoria55:
+ result += kCaldoria55Angle;
+ break;
+ }
+
+ return result;
+}
+
+void Caldoria::getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove) {
+ Neighborhood::getExitCompassMove(exitEntry, compassMove);
+
+ switch (MakeRoomView(exitEntry.room, exitEntry.direction)) {
+ case MakeRoomView(kCaldoria08, kNorth):
+ case MakeRoomView(kCaldoria09, kSouth):
+ compassMove.insertFaderKnot((exitEntry.movieStart + exitEntry.movieEnd) >> 1, compassMove.getNthKnotValue(0) + 30);
+ break;
+ case MakeRoomView(kCaldoria10, kEast):
+ compassMove.insertFaderKnot(exitEntry.movieStart + 4 * kCaldoriaFrameDuration, 90);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 19 * kCaldoriaFrameDuration, -90);
+ break;
+ case MakeRoomView(kCaldoria42, kWest):
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), exitEntry.movieStart, -90, exitEntry.movieEnd, 90);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 3 * kCaldoriaFrameDuration, -90);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 33 * kCaldoriaFrameDuration, 90);
+ break;
+ case MakeRoomView(kCaldoria54, kEast):
+ if (getCurrentAlternate() != kAltCaldoriaSinclairDown) {
+ compassMove.insertFaderKnot(exitEntry.movieStart + 16 * kCaldoriaFrameDuration, 135);
+ compassMove.insertFaderKnot(exitEntry.movieEnd, 135);
+ }
+ break;
+ case MakeRoomView(kCaldoria55, kNorth):
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), exitEntry.movieStart, 315, exitEntry.movieEnd, 270);
+ break;
+ }
+}
+
+void Caldoria::getZoomCompassMove(const ZoomTable::Entry &zoomEntry, FaderMoveSpec &compassMove) {
+ Neighborhood::getZoomCompassMove(zoomEntry, compassMove);
+
+ switch (zoomEntry.hotspot) {
+ case kCaBathroomToiletSpotID:
+ compassMove.insertFaderKnot(zoomEntry.movieStart + 4 * kCaldoriaFrameDuration, 90);
+ compassMove.insertFaderKnot(zoomEntry.movieStart + 19 * kCaldoriaFrameDuration, -90);
+ compassMove.insertFaderKnot(zoomEntry.movieEnd, -90);
+ break;
+ }
+}
+
+void Caldoria::getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove) {
+ switch (entry.extra) {
+ case kCaldoria00WakeUp1:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 90, entry.movieEnd, 180);
+ compassMove.insertFaderKnot(entry.movieStart + 1000, 90);
+ compassMove.insertFaderKnot(entry.movieStart + 1640, 120);
+ compassMove.insertFaderKnot(entry.movieStart + 2240, 135);
+ compassMove.insertFaderKnot(entry.movieStart + 2640, 180);
+ break;
+ case kCaldoria00WakeUp2:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 180, entry.movieEnd, 90);
+ compassMove.insertFaderKnot(entry.movieStart + 560, 90);
+ break;
+ case kCaldoria56BombStage1:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 90, entry.movieEnd, 10);
+ compassMove.insertFaderKnot(entry.movieStart + 31 * kCaldoriaFrameDuration, 60);
+ compassMove.insertFaderKnot(entry.movieStart + 49 * kCaldoriaFrameDuration, 60);
+ compassMove.insertFaderKnot(entry.movieStart + 66 * kCaldoriaFrameDuration, 10);
+ break;
+ case kCaldoria56BombStage7:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 10, entry.movieEnd, 90);
+ compassMove.insertFaderKnot(entry.movieStart + 131 * kCaldoriaFrameDuration, 10);
+ compassMove.insertFaderKnot(entry.movieStart + 148 * kCaldoriaFrameDuration, 60);
+ compassMove.insertFaderKnot(entry.movieStart + 165 * kCaldoriaFrameDuration, 60);
+ compassMove.insertFaderKnot(entry.movieEnd - 5 * kCaldoriaFrameDuration, 90);
+ break;
+ default:
+ Neighborhood::getExtraCompassMove(entry, compassMove);
+ break;
+ }
+}
+
+void Caldoria::loadAmbientLoops() {
+ RoomID room = GameState.getCurrentRoom();
+
+ if (room == kCaldoria00 && GameState.getCaldoriaWokenUp())
+ loadLoopSound1("Sounds/Caldoria/Apartment Music.AIFF", 0x100 / 4);
+ else if (room >= kCaldoria01 && room <= kCaldoria14)
+ loadLoopSound1("Sounds/Caldoria/Apartment Music.AIFF", 0x100 / 4);
+ else if (room == kCaldoria27 || room == kCaldoria28 || room == kCaldoria45)
+ loadLoopSound1("Sounds/Caldoria/Elevator Loop.AIFF", 0x100 / 5);
+ else if (room == kCaldoria44)
+ loadLoopSound1("Sounds/Caldoria/TSA Hum Loop.AIFF");
+ else if (room >= kCaldoria15 && room <= kCaldoria48)
+ loadLoopSound1("Sounds/Caldoria/Industrial Nuage.aiff", 2 * 0x100 / 3);
+ else if (room >= kCaldoria49 && room <= kCaldoria56)
+ loadLoopSound1("Sounds/Caldoria/A50NLB00.22K.AIFF", 0x100 / 4);
+}
+
+void Caldoria::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kCaldoria06, kSouth):
+ case MakeRoomView(kCaldoria13, kNorth):
+ case MakeRoomView(kCaldoria16, kSouth):
+ case MakeRoomView(kCaldoria38, kEast):
+ case MakeRoomView(kCaldoria38, kWest):
+ case MakeRoomView(kCaldoria40, kNorth):
+ case MakeRoomView(kCaldoria44, kEast):
+ case MakeRoomView(kCaldoria48, kNorth):
+ case MakeRoomView(kCaldoria49, kNorth):
+ makeContinuePoint();
+ break;
+ }
+}
+
+void Caldoria::spotCompleted() {
+ Neighborhood::spotCompleted();
+ if (GameState.getCurrentRoom() == kCaldoriaBinoculars)
+ startExtraSequence(kBinocularsZoomInOnShip, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void Caldoria::arriveAt(const RoomID room, const DirectionConstant direction) {
+ switch (room) {
+ case kCaldoria56:
+ if (!GameState.getCaldoriaGunAimed())
+ // Fall through...
+ case kCaldoria49:
+ case kCaldoria50:
+ case kCaldoria51:
+ case kCaldoria52:
+ case kCaldoria53:
+ case kCaldoria54:
+ case kCaldoria55:
+ if (GameState.getCaldoriaSinclairShot())
+ setCurrentAlternate(kAltCaldoriaSinclairDown);
+ break;
+ }
+
+ Neighborhood::arriveAt(room, direction);
+ Input dummy;
+
+ switch (room) {
+ case kCaldoria00:
+ arriveAtCaldoria00();
+ break;
+ case kCaldoria05:
+ if (direction == kWest && GameState.getCaldoriaINNAnnouncing())
+ loopCroppedMovie("Images/Caldoria/A05 Light Loop", kCaldoriaA05LightLoopLeft, kCaldoriaA05LightLoopTop);
+ break;
+ case kCaldoria07:
+ if (direction == kWest && GameState.getCaldoriaINNAnnouncing())
+ loopCroppedMovie("Images/Caldoria/A07 Light Loop", kCaldoriaA07LightLoopLeft, kCaldoriaA07LightLoopTop);
+ break;
+ case kCaldoria09:
+ _lastExtra = 0xffffffff;
+ break;
+ case kCaldoriaToilet:
+ GameState.setScoringReadPaper(true);
+ break;
+ case kCaldoriaReplicator:
+ setCurrentActivation(kActivateReplicatorReady);
+ requestSpotSound(kCaldoriaReplicatorIntroIn, kCaldoriaReplicatorIntroOut, kFilterNoInput, 0);
+ break;
+ case kCaldoria11:
+ setCurrentAlternate(kAltCaldoriaNormal);
+ if (direction == kEast && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A11 Message Machine Loop", kCaldoria11MessageLoopLeft, kCaldoria11MessageLoopTop);
+ break;
+ case kCaldoria12:
+ if (direction == kNorth && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A12 Message Machine Loop", kCaldoria12MessageLoopLeft, kCaldoria12MessageLoopTop);
+ break;
+ case kCaldoriaDrawers:
+ setCurrentActivation(kActivateDrawersClosed);
+ break;
+ case kCaldoria13:
+ GameState.setCaldoriaINNAnnouncing(true);
+ if (direction == kNorth && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A13 Message Machine Loop", kCaldoria13MessageLoopLeft, kCaldoria13MessageLoopTop);
+ break;
+ case kCaldoria14:
+ if (direction == kNorth && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A14 Message Machine Loop", kCaldoria14MessageLoopLeft, kCaldoria14MessageLoopTop);
+ break;
+ case kCaldoria08:
+ if (direction == kWest)
+ setCurrentActivation(kActivateMirrorReady);
+ // Fall through...
+ case kCaldoria15:
+ GameState.setCaldoriaINNAnnouncing(true);
+ break;
+ case kCaldoria27:
+ case kCaldoria28:
+ case kCaldoria45:
+ if (GameState.getCurrentDirection() == kNorth)
+ openDoor();
+ break;
+ case kCaldoriaBinoculars:
+ GameState.setScoringLookThroughTelescope(true);
+ break;
+ case kCaldoriaKiosk:
+ GameState.setScoringSawCaldoriaKiosk(true);
+ startExtraSequenceSync(kCaldoriaKioskVideo, kFilterAllInput);
+ downButton(dummy);
+ break;
+ case kCaldoria44:
+ arriveAtCaldoria44();
+ break;
+ case kCaldoria49:
+ arriveAtCaldoria49();
+ break;
+ case kCaldoria53:
+ if (direction == kEast && !GameState.getCaldoriaSinclairShot())
+ zoomToSinclair();
+ break;
+ case kCaldoria50:
+ if (direction == kNorth && !GameState.getCaldoriaSinclairShot())
+ setUpSinclairLoops();
+ break;
+ case kCaldoria54:
+ if (direction == kSouth && !GameState.getCaldoriaSinclairShot())
+ setUpSinclairLoops();
+ break;
+ case kCaldoria56:
+ arriveAtCaldoria56();
+ break;
+ case kCaldoriaDeathRoom:
+ arriveAtCaldoriaDeath();
+ break;
+ }
+
+ checkSinclairShootsOS();
+ setUpRoofTop();
+}
+
+void Caldoria::doAIRecalibration() {
+ GameState.setCaldoriaDidRecalibration(true);
+
+ if (!g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Caldoria/XA01EB1", true, kRecalibrationInterruptFilter))
+ return;
+
+ g_interface->calibrateEnergyBar();
+ if (!g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Caldoria/XA01EB4", true, kRecalibrationInterruptFilter))
+ return;
+
+ g_interface->raiseInventoryDrawerSync();
+ if (!g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Caldoria/XA01EB6", true, kRecalibrationInterruptFilter)) {
+ g_interface->lowerInventoryDrawerSync();
+ return;
+ }
+
+ g_interface->lowerInventoryDrawerSync();
+ g_interface->raiseBiochipDrawerSync();
+
+ if (!g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Caldoria/XA01EB5", true, kRecalibrationInterruptFilter)) {
+ g_interface->lowerBiochipDrawerSync();
+ return;
+ }
+
+ g_interface->lowerBiochipDrawerSync();
+
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Caldoria/XA01EB8", false, kRecalibrationInterruptFilter);
+}
+
+void Caldoria::arriveAtCaldoria00() {
+ if (GameState.getCurrentDirection() == kEast) {
+ if (GameState.getCaldoriaWokenUp()) {
+ if (!GameState.getCaldoriaDidRecalibration())
+ doAIRecalibration();
+ setCurrentActivation(kActivate4DClosed);
+ } else {
+ // Good morning, sleeping beauty
+ ExtraTable::Entry extra;
+ getExtraEntry(kCaldoria00WakeUp1, extra);
+
+ if (_navMovie.getTime() != extra.movieStart) {
+ _navMovie.setTime(extra.movieStart);
+ _navMovie.redrawMovieWorld();
+ }
+
+ startExtraSequenceSync(kCaldoria00WakeUp1, kFilterNoInput);
+ GameState.setCaldoriaWokenUp(true);
+ playCroppedMovieOnce("Images/Caldoria/VidPhone.movie", kCaldoriaVidPhoneLeft, kCaldoriaVidPhoneTop, kFilterAllInput);
+ startExtraSequence(kCaldoria00WakeUp2, kExtraCompletedFlag, kFilterNoInput);
+ }
+ }
+}
+
+bool Caldoria::wantsCursor() {
+ return GameState.getCaldoriaDidRecalibration();
+}
+
+void Caldoria::arriveAtCaldoria44() {
+ if (GameState.getLastNeighborhood() != kCaldoriaID) {
+ openDoor();
+ } else {
+ setCurrentActivation(kActivateReadyForCard);
+ loopExtraSequence(kCaldoriaTransporterArrowLoop, 0);
+ }
+}
+
+void Caldoria::arriveAtCaldoria49() {
+ if (GameState.getLastRoom() == kCaldoria48)
+ setCurrentAlternate(kAltCaldoriaNormal);
+
+ // Need to force the loop to play.
+ if (GameState.getCurrentDirection() == kNorth) {
+ GameState.setCaldoriaFuseTimeLimit(kSinclairShootsTimeLimit);
+ startExtraSequence(kCa49NorthVoiceAnalysis, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void Caldoria::arriveAtCaldoria56() {
+ if (!GameState.getCaldoriaBombDisarmed()) {
+ _privateFlags.setFlag(kCaldoriaPrivateZoomingToBombFlag, true);
+
+ if (GameState.getCurrentDirection() == kNorth) {
+ turnRight();
+ } else if (GameState.getCurrentDirection() == kSouth) {
+ turnLeft();
+ } else if (GameState.getCurrentDirection() == kEast) {
+ _privateFlags.setFlag(kCaldoriaPrivateZoomingToBombFlag, false);
+ newInteraction(kCaldoriaBombInteractionID);
+ }
+ }
+}
+
+void Caldoria::arriveAtCaldoriaDeath() {
+ if (GameState.getLastRoom() == kCaldoria49) {
+ if (GameState.getCaldoriaSinclairShot()) {
+ die(kDeathNuclearExplosion);
+ } else {
+ playSpotSoundSync(kCaldoriaSinclairShootsOSIn, kCaldoriaSinclairShootsOSOut);
+ playSpotSoundSync(kCaldoriaScreamingAfterIn, kCaldoriaScreamingAfterOut);
+ die(kDeathSinclairShotDelegate);
+ }
+ } else {
+ die(kDeathShotBySinclair);
+ }
+}
+
+void Caldoria::setUpRoofTop() {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria48:
+ if (GameState.getCurrentDirection() == kNorth) {
+ if (GameState.getCaldoriaRoofDoorOpen()) {
+ setCurrentAlternate(kAltCaldoriaRoofDoorBlown);
+ } else if (GameState.getCaldoriaDoorBombed()) {
+ // Long enough for AI hints...?
+ _utilityFuse.primeFuse(kCardBombCountDownTime);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Caldoria>(this, &Caldoria::doorBombTimerExpired));
+ _utilityFuse.lightFuse();
+
+ loopCroppedMovie("Images/Caldoria/A48 Bomb Loop", kCaldoria48CardBombLoopLeft, kCaldoria48CardBombLoopTop);
+ } else {
+ setCurrentActivation(kActivateRoofSlotEmpty);
+ }
+ }
+ break;
+ case kCaldoria56:
+ if (GameState.getCurrentDirection() == kEast && GameState.getCaldoriaGunAimed())
+ startExtraSequence(kCa53EastShootSinclair, kExtraCompletedFlag, false);
+ else
+ // Fall through...
+ case kCaldoria49:
+ case kCaldoria50:
+ case kCaldoria51:
+ case kCaldoria52:
+ case kCaldoria53:
+ case kCaldoria54:
+ case kCaldoria55:
+ if (!GameState.getCaldoriaSinclairShot()) {
+ if (GameState.getCaldoriaSawVoiceAnalysis() && !_utilityFuse.isFuseLit()) {
+ _utilityFuse.primeFuse(GameState.getCaldoriaFuseTimeLimit());
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Caldoria>(this, &Caldoria::sinclairTimerExpired));
+ _utilityFuse.lightFuse();
+ }
+ } else {
+ setCurrentAlternate(kAltCaldoriaSinclairDown);
+ }
+ break;
+ }
+}
+
+void Caldoria::downButton(const Input &input) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kCaldoria01, kEast):
+ GameState.setCaldoriaWokenUp(true);
+ startExtraSequence(kCaldoria00SitDown, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ Neighborhood::downButton(input);
+ break;
+ }
+}
+
+void Caldoria::turnTo(const DirectionConstant direction) {
+ Neighborhood::turnTo(direction);
+
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria00:
+ if (direction == kEast)
+ setCurrentActivation(kActivate4DClosed);
+ break;
+ case kCaldoria01:
+ if (direction == kEast) {
+ GameState.setCaldoriaWokenUp(true);
+ startExtraSequence(kCaldoria00SitDown, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kCaldoria05:
+ if (direction == kWest && GameState.getCaldoriaINNAnnouncing())
+ loopCroppedMovie("Images/Caldoria/A05 Light Loop", kCaldoriaA05LightLoopLeft, kCaldoriaA05LightLoopTop);
+ break;
+ case kCaldoria07:
+ if (direction == kWest && GameState.getCaldoriaINNAnnouncing())
+ loopCroppedMovie("Images/Caldoria/A07 Light Loop", kCaldoriaA07LightLoopLeft, kCaldoriaA07LightLoopTop);
+ break;
+ case kCaldoria08:
+ if (direction == kWest)
+ setCurrentActivation(kActivateMirrorReady);
+ break;
+ case kCaldoria09:
+ _lastExtra = 0xffffffff;
+ break;
+ case kCaldoria11:
+ if (direction == kEast && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A11 Message Machine Loop", kCaldoria11MessageLoopLeft, kCaldoria11MessageLoopTop);
+ break;
+ case kCaldoria12:
+ if (direction == kNorth && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A12 Message Machine Loop", kCaldoria12MessageLoopLeft, kCaldoria12MessageLoopTop);
+ break;
+ case kCaldoria13:
+ if (direction == kNorth && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A13 Message Machine Loop", kCaldoria13MessageLoopLeft, kCaldoria13MessageLoopTop);
+ break;
+ case kCaldoria14:
+ if (direction == kNorth && !GameState.getCaldoriaSeenMessages())
+ loopCroppedMovie("Images/Caldoria/A14 Message Machine Loop", kCaldoria14MessageLoopLeft, kCaldoria14MessageLoopTop);
+ break;
+ case kCaldoria27:
+ case kCaldoria28:
+ case kCaldoria45:
+ if (direction == kNorth)
+ openElevatorMovie();
+ else
+ closeCroppedMovie();
+ break;
+ case kCaldoria48:
+ if (direction == kNorth && !GameState.getCaldoriaDoorBombed())
+ setCurrentActivation(kActivateRoofSlotEmpty);
+ break;
+ case kCaldoria53:
+ if (GameState.getCurrentDirection() == kEast && !GameState.getCaldoriaSinclairShot())
+ zoomToSinclair();
+ break;
+ case kCaldoria50:
+ if (direction == kNorth && !GameState.getCaldoriaSinclairShot())
+ setUpSinclairLoops();
+ break;
+ case kCaldoria54:
+ if (direction == kSouth && !GameState.getCaldoriaSinclairShot())
+ setUpSinclairLoops();
+ break;
+ case kCaldoria56:
+ if (_privateFlags.getFlag(kCaldoriaPrivateZoomingToBombFlag)) {
+ _privateFlags.setFlag(kCaldoriaPrivateZoomingToBombFlag, false);
+ newInteraction(kCaldoriaBombInteractionID);
+ } else if (GameState.getCaldoriaBombDisarmed()) {
+ _vm->playEndMessage();
+ }
+ break;
+ }
+
+ checkSinclairShootsOS();
+}
+
+void Caldoria::zoomTo(const Hotspot *zoomOutSpot) {
+ // Need to set _zoomOutSpot here because we may come through
+ // this function another way, say by pressing the down arrow,
+ // that doesn't involve the ClickInHotSpot function.
+ _zoomOutSpot = zoomOutSpot;
+
+ if (zoomOutSpot->getObjectID() == kCaldoriaDrawersOutSpotID) {
+ if (_privateFlags.getFlag(kCaloriaPrivateLeftDrawerOpenFlag)) {
+ _privateFlags.setFlag(kCaloriaPrivateLeftDrawerOpenFlag, false);
+ startExtraSequence(kLeftDrawerClose, kExtraCompletedFlag, kFilterNoInput);
+ } else if (_privateFlags.getFlag(kCaldoriaPrivateRightDrawerOpenFlag)) {
+ _privateFlags.setFlag(kCaldoriaPrivateRightDrawerOpenFlag, false);
+ if (GameState.isTakenItemID(kKeyCard))
+ startExtraSequence(kRightDrawerCloseNoKeys, kExtraCompletedFlag, false);
+ else
+ startExtraSequence(kRightDrawerCloseWithKeys, kExtraCompletedFlag, false);
+ } else {
+ Neighborhood::zoomTo(zoomOutSpot);
+ }
+ } else {
+ Neighborhood::zoomTo(zoomOutSpot);
+ }
+}
+
+void Caldoria::setUpSinclairLoops() {
+ _navMovie.stop();
+ scheduleNavCallBack(kSinclairLoopDoneFlag);
+ _sinclairLoopCount = 0;
+ _numSinclairLoops = 2;
+ _navMovie.start();
+}
+
+void Caldoria::zoomToSinclair() {
+ _utilityFuse.stopFuse();
+ _privateFlags.setFlag(kCaldoriaPrivateReadyToShootFlag, true);
+ setCurrentActivation(kActivateZoomedOnSinclair);
+
+ ExtraTable::Entry entry;
+ getExtraEntry(kCa53EastZoomToSinclair, entry);
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime1, _navMovie.getScale());
+ startExtraSequence(kCa53EastZoomToSinclair, kExtraCompletedFlag, kFilterAllInput);
+}
+
+void Caldoria::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ Neighborhood::receiveNotification(notification, flags);
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ InventoryItem *item;
+ _interruptionFilter = kFilterAllInput;
+
+ switch (_lastExtra) {
+ case kCaldoria00WakeUp2:
+ makeContinuePoint();
+ // Force ArriveAt to do its thing...
+ GameState.setCurrentRoom(kNoRoomID);
+ arriveAt(kCaldoria00, kEast);
+ break;
+ case k4DEnvironOpenToINN:
+ GameState.setCaldoriaSeenINN(true);
+ GameState.setScoringSawINN(true);
+ // Fall through to k4DEnvironOpen...
+ case k4DEnvironOpen:
+ _privateFlags.setFlag(kCaldoriaPrivate4DSystemOpenFlag, true);
+ setCurrentActivation(kActivate4DOpen);
+ newInteraction(kCaldoria4DInteractionID);
+ break;
+ case kCaldoriaShowerUp:
+ GameState.setScoringTookShower(true);
+ GameState.setCaldoriaDoneHygiene(true);
+ break;
+ case kLeftDrawerClose:
+ case kRightDrawerCloseNoKeys:
+ case kRightDrawerCloseWithKeys:
+ if (_zoomOutSpot && _zoomOutSpot->getObjectID() == kCaldoriaDrawersOutSpotID) {
+ Input input;
+ clickInHotspot(input, _zoomOutSpot);
+ }
+ break;
+ case kCreateOrangeJuice:
+ setCurrentActivation(kActivateOJOnThePad);
+ requestSpotSound(kCaldoriaReplicatorOJChoiceIn, kCaldoriaReplicatorOJChoiceOut, kFilterNoInput, 0);
+ break;
+ case kCaldoria00SitDown:
+ arriveAt(kCaldoria00, kEast);
+ break;
+ case kCaldoria16ElevatorUp:
+ startExtraSequence(kCaldoria16ElevatorDown, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoria16ElevatorDown:
+ GameState.setCaldoriaSeenSinclairInElevator(true);
+ _privateFlags.setFlag(kCaldoriaPrivateCanOpenElevatorDoorFlag, true);
+ openDoor();
+ break;
+ case kCaldoriaFourthToGround:
+ case kCaldoriaRoofToGround:
+ arriveAt(kCaldoria28, GameState.getCurrentDirection());
+ break;
+ case kCaldoriaFourthToRoof:
+ case kCaldoriaGroundToRoof:
+ arriveAt(kCaldoria45, GameState.getCurrentDirection());
+ break;
+ case kCaldoriaGroundToFourth:
+ case kCaldoriaRoofToFourth:
+ arriveAt(kCaldoria27, GameState.getCurrentDirection());
+ break;
+ case kCaGTCardSwipe:
+ item = (InventoryItem *)_vm->getAllItems().findItemByID(kKeyCard);
+ _vm->addItemToInventory(item);
+ setCurrentActivation(kActivateReadyToTransport);
+ break;
+ case kCaGTFryTheFly:
+ case kCaGTGoToTSA:
+ _vm->jumpToNewEnvironment(kFullTSAID, kTSA00, kNorth);
+ break;
+ case kCaGTGoToTokyo:
+ playDeathExtra(kCaGTArriveAtTokyo, kDeathUncreatedInCaldoria);
+ break;
+ case kCaGTGoToBeach:
+ playDeathExtra(kCaGTArriveAtBeach, kDeathUncreatedInCaldoria);
+ break;
+ case kCa48NorthExplosion:
+ // Current biochip must be the shield if we got here.
+ _vm->getCurrentBiochip()->setItemState(kShieldNormal);
+ break;
+ case kBinocularsZoomInOnShip:
+ setCurrentActivation(kActivateFocusedOnShip);
+ break;
+ case kCa49NorthVoiceAnalysis:
+ _utilityFuse.primeFuse(kSinclairShootsTimeLimit);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Caldoria>(this, &Caldoria::sinclairTimerExpired));
+ _utilityFuse.lightFuse();
+ GameState.setCaldoriaSawVoiceAnalysis(true);
+ break;
+ case kCa53EastZoomToSinclair:
+ if (GameState.getCaldoriaSinclairShot()) {
+ delete _gunSprite;
+ _gunSprite = 0;
+ startExtraSequence(kCa53EastShootSinclair, kExtraCompletedFlag, false);
+ } else {
+ playDeathExtra(kCa53EastDeath2, kDeathSinclairShotDelegate);
+ }
+ break;
+ case kCa53EastShootSinclair:
+ _vm->addItemToInventory((InventoryItem *)_vm->getAllItems().findItemByID(kStunGun));
+ startExtraSequence(kCa53EastZoomOutFromSinclair, kExtraCompletedFlag, false);
+ GameState.setScoringStunnedSinclair(true);
+ break;
+ case kCa53EastZoomOutFromSinclair:
+ setCurrentAlternate(kAltCaldoriaSinclairDown);
+ updateViewFrame();
+ makeContinuePoint();
+ break;
+ }
+ } else if ((flags & kSpotSoundCompletedFlag) != 0) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria20:
+ case kCaldoria21:
+ case kCaldoria26:
+ case kCaldoria29:
+ case kCaldoria34:
+ case kCaldoria35:
+ updateViewFrame();
+ break;
+ case kCaldoria27:
+ case kCaldoria28:
+ case kCaldoria45:
+ updateElevatorMovie();
+ break;
+ case kCaldoriaReplicator:
+ emptyOJGlass();
+ break;
+ }
+ } else if ((flags & kSinclairLoopDoneFlag) != 0) {
+ if (++_sinclairLoopCount == _numSinclairLoops) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria50:
+ playDeathExtra(kCa50SinclairShoots, kDeathShotBySinclair);
+ break;
+ case kCaldoria54:
+ playDeathExtra(kCa54SouthDeath, kDeathShotBySinclair);
+ break;
+ }
+ } else {
+ _navMovie.stop();
+ scheduleNavCallBack(kSinclairLoopDoneFlag);
+ _navMovie.start();
+ }
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+InputBits Caldoria::getInputFilter() {
+ InputBits result = Neighborhood::getInputFilter();
+
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria00:
+ if (_privateFlags.getFlag(kCaldoriaPrivate4DSystemOpenFlag))
+ result &= ~kFilterAllDirections;
+ break;
+ case kCaldoriaBinoculars:
+ if (getCurrentActivation() == kActivateNotFocusedOnShip)
+ result &= ~(kFilterDownButton | kFilterDownAuto);
+ break;
+ case kCaldoria53:
+ if (_privateFlags.getFlag(kCaldoriaPrivateReadyToShootFlag) && !GameState.getCaldoriaSinclairShot())
+ result &= ~kFilterAllDirections;
+ break;
+ case kCaldoria48:
+ if (GameState.getCaldoriaDoorBombed())
+ result &= ~kFilterAllDirections;
+ }
+
+ return result;
+}
+
+void Caldoria::activateHotspots() {
+ Neighborhood::activateHotspots();
+
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoriaDrawers:
+ if (getCurrentActivation() == kActivateRightOpen) {
+ if (GameState.isTakenItemID(kKeyCard)) {
+ _vm->getAllHotspots().activateOneHotspot(kCaldoriaRightDrawerNoKeysCloseSpotID);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRightDrawerWithKeysCloseSpotID);
+ } else {
+ _vm->getAllHotspots().activateOneHotspot(kCaldoriaRightDrawerWithKeysCloseSpotID);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRightDrawerNoKeysCloseSpotID);
+ }
+ }
+ case kCaldoriaReplicator:
+ if (GameState.getCaldoriaMadeOJ())
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaMakeOJSpotID);
+ break;
+ case kCaldoria27:
+ if (GameState.isCurrentDoorOpen()) {
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaFourthFloorElevator1);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaFourthFloorElevator2);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaFourthFloorElevator3);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaFourthFloorElevator4);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaFourthFloorElevator5);
+ }
+ break;
+ case kCaldoria28:
+ if (GameState.isCurrentDoorOpen()) {
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaGroundElevator1);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaGroundElevator2);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaGroundElevator3);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaGroundElevator4);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaGroundElevator5);
+ }
+ break;
+ case kCaldoria45:
+ if (GameState.isCurrentDoorOpen()) {
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRoofElevator1);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRoofElevator2);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRoofElevator3);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRoofElevator4);
+ _vm->getAllHotspots().deactivateOneHotspot(kCaldoriaRoofElevator5);
+ }
+ break;
+ }
+}
+
+void Caldoria::clickInHotspot(const Input &input, const Hotspot *spot) {
+ switch (spot->getObjectID()) {
+ case kCa4DEnvironOpenSpotID:
+ if (!GameState.getCaldoriaINNAnnouncing() || GameState.getCaldoriaSeenINN()) {
+ startExtraSequence(k4DEnvironOpen, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ // This trick depends on the following sequences being in order in the
+ // world movie:
+ // k4DEnvironOpenToINN
+ // k4DINNInterruption
+ // k4DINNIntro
+ // k4DINNMarkJohnson
+ // k4DINNMeganLove
+ // k4DINNFadeOut
+ // k4DEnvironOpenFromINN
+ loadLoopSound1("");
+ loadLoopSound2("");
+ startExtraLongSequence(k4DEnvironOpenToINN, k4DEnvironOpenFromINN, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kCa4DEnvironCloseSpotID:
+ ((Caldoria4DSystem *)_currentInteraction)->shutDown4DSystem();
+ break;
+ case kCaBathroomMirrorSpotID:
+ newInteraction(kCaldoriaMirrorInteractionID);
+ break;
+ case kCaShowerSpotID:
+ requestExtraSequence(kCaldoriaShowerTitle, 0, kFilterNoInput);
+ requestExtraSequence(kCaldoriaShowerButton, 0, kFilterNoInput);
+ requestExtraSequence(kCaldoriaShowerDown, 0, kFilterNoInput);
+ requestExtraSequence(kCaldoriaShowerUp, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaLeftDrawerOpenSpotID:
+ _privateFlags.setFlag(kCaloriaPrivateLeftDrawerOpenFlag, true);
+ setCurrentActivation(kActivateLeftOpen);
+ startExtraSequence(kLeftDrawerOpen, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaLeftDrawerCloseSpotID:
+ _privateFlags.setFlag(kCaloriaPrivateLeftDrawerOpenFlag, false);
+ setCurrentActivation(kActivateDrawersClosed);
+ startExtraSequence(kLeftDrawerClose, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaRightDrawerOpenSpotID:
+ _privateFlags.setFlag(kCaldoriaPrivateRightDrawerOpenFlag, true);
+ setCurrentActivation(kActivateRightOpen);
+ if (GameState.isTakenItemID(kKeyCard))
+ startExtraSequence(kRightDrawerOpenNoKeys, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kRightDrawerOpenWithKeys, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaRightDrawerWithKeysCloseSpotID:
+ _privateFlags.setFlag(kCaldoriaPrivateRightDrawerOpenFlag, false);
+ setCurrentActivation(kActivateDrawersClosed);
+ startExtraSequence(kRightDrawerCloseWithKeys, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaRightDrawerNoKeysCloseSpotID:
+ _privateFlags.setFlag(kCaldoriaPrivateRightDrawerOpenFlag, false);
+ setCurrentActivation(kActivateDrawersClosed);
+ startExtraSequence(kRightDrawerCloseNoKeys, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaMakeStickyBunsSpotID:
+ requestSpotSound(kCaldoriaReplicatorWrongChoiceIn, kCaldoriaReplicatorWrongChoiceOut, kFilterNoInput, 0);
+ break;
+ case kCaldoriaMakeOJSpotID:
+ GameState.setCaldoriaMadeOJ(true);
+ startExtraSequence(kCreateOrangeJuice, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaBedroomVidPhoneActivationSpotID:
+ newInteraction(kCaldoriaMessagesInteractionID);
+ break;
+ case kCaldoriaFourthFloorElevatorSpotID:
+ if (!GameState.getCaldoriaSeenSinclairInElevator()) {
+ startExtraSequence(kCaldoria16ElevatorUp, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ _privateFlags.setFlag(kCaldoriaPrivateCanOpenElevatorDoorFlag, true);
+ openDoor();
+ }
+ break;
+ case kCaldoriaGroundElevatorSpotID:
+ _privateFlags.setFlag(kCaldoriaPrivateCanOpenElevatorDoorFlag, true);
+ openDoor();
+ break;
+ case kCaldoriaRoofElevatorSpotID:
+ _privateFlags.setFlag(kCaldoriaPrivateCanOpenElevatorDoorFlag, true);
+ openDoor();
+ break;
+ case kCaldoriaFourthFloorElevator1:
+ case kCaldoriaFourthFloorElevator2:
+ case kCaldoriaFourthFloorElevator3:
+ case kCaldoriaFourthFloorElevator4:
+ case kCaldoriaFourthFloorElevator5:
+ // Assumes that elevator hot spots are consecutive.
+ takeElevator(4, spot->getObjectID() - kCaldoriaFourthFloorElevator1 + 1);
+ break;
+ case kCaldoriaGroundElevator1:
+ case kCaldoriaGroundElevator2:
+ case kCaldoriaGroundElevator3:
+ case kCaldoriaGroundElevator4:
+ case kCaldoriaGroundElevator5:
+ // Assumes that elevator hot spots are consecutive.
+ takeElevator(1, spot->getObjectID() - kCaldoriaGroundElevator1 + 1);
+ break;
+ case kCaldoriaRoofElevator1:
+ case kCaldoriaRoofElevator2:
+ case kCaldoriaRoofElevator3:
+ case kCaldoriaRoofElevator4:
+ case kCaldoriaRoofElevator5:
+ // Assumes that elevator hot spots are consecutive.
+ takeElevator(5, spot->getObjectID() - kCaldoriaRoofElevator1 + 1);
+ break;
+ case kCaldoriaGTTokyoSpotID:
+ startExtraSequence(kCaGTGoToTokyo, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaGTTSASpotID:
+ GameState.setScoringGoToTSA(true);
+ startExtraLongSequence(kCaGTFryTheFly, kCaGTGoToTSA, kExtraCompletedFlag, false);
+ break;
+ case kCaldoriaGTBeachSpotID:
+ startExtraSequence(kCaGTGoToBeach, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaGTOtherSpotID:
+ showExtraView(kCaGTOtherChoice);
+ playSpotSoundSync(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut);
+ showExtraView(kCaGTCardSwipe);
+ break;
+ case kCaldoriaZoomInOnShipSpotID:
+ startExtraSequence(kBinocularsZoomInOnShip, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoriaRoofDoorSpotID:
+ startExtraSequence(kCa48NorthRooftopClosed, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaldoria20DoorbellSpotID:
+ case kCaldoria21DoorbellSpotID:
+ case kCaldoria26DoorbellSpotID:
+ case kCaldoria29DoorbellSpotID:
+ case kCaldoria34DoorbellSpotID:
+ case kCaldoria35DoorbellSpotID:
+ clickOnDoorbell(spot->getObjectID());
+ break;
+ default:
+ Neighborhood::clickInHotspot(input, spot);
+ break;
+ }
+}
+
+void Caldoria::clickOnDoorbell(const HotSpotID doorBellSpotID) {
+ uint32 extra;
+ ExtraTable::Entry entry;
+
+ switch (doorBellSpotID) {
+ case kCaldoria20DoorbellSpotID:
+ extra = kCaldoria20Doorbell;
+ break;
+ case kCaldoria21DoorbellSpotID:
+ extra = kCaldoria21Doorbell;
+ break;
+ case kCaldoria26DoorbellSpotID:
+ extra = kCaldoria26Doorbell;
+ break;
+ case kCaldoria29DoorbellSpotID:
+ extra = kCaldoria29Doorbell;
+ break;
+ case kCaldoria34DoorbellSpotID:
+ extra = kCaldoria34Doorbell;
+ break;
+ case kCaldoria35DoorbellSpotID:
+ extra = kCaldoria35Doorbell;
+ break;
+ default:
+ error("Invalid doorbell hotspot");
+ }
+
+ getExtraEntry(extra, entry);
+ showViewFrame(entry.movieStart);
+ requestSpotSound(kCaldoriaNobodyHomeIn, kCaldoriaNobodyHomeOut, kFilterNoInput, kSpotSoundCompletedFlag);
+}
+
+CanOpenDoorReason Caldoria::canOpenDoor(DoorTable::Entry &entry) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria16:
+ case kCaldoria38:
+ case kCaldoria46:
+ if (GameState.getCurrentDirection() == kSouth && !_privateFlags.getFlag(kCaldoriaPrivateCanOpenElevatorDoorFlag))
+ return kCantOpenLocked;
+ break;
+ }
+
+ return Neighborhood::canOpenDoor(entry);
+}
+
+void Caldoria::doorOpened() {
+ Neighborhood::doorOpened();
+ _privateFlags.setFlag(kCaldoriaPrivateCanOpenElevatorDoorFlag, false);
+}
+
+GameInteraction *Caldoria::makeInteraction(const InteractionID interactionID) {
+ switch (interactionID) {
+ case kCaldoria4DInteractionID:
+ return new Caldoria4DSystem(this);
+ case kCaldoriaBombInteractionID:
+ return new CaldoriaBomb(this, _vm);
+ case kCaldoriaMessagesInteractionID:
+ return new CaldoriaMessages(this, kCaldoriaMessagesNotificationID, _vm);
+ case kCaldoriaMirrorInteractionID:
+ return new CaldoriaMirror(this);
+ }
+
+ return 0;
+}
+
+void Caldoria::newInteraction(const InteractionID interactionID) {
+ Neighborhood::newInteraction(interactionID);
+
+ if (!_currentInteraction) {
+ if (_privateFlags.getFlag(kCaldoriaPrivate4DSystemOpenFlag)) {
+ _privateFlags.setFlag(kCaldoriaPrivate4DSystemOpenFlag, false);
+ setCurrentActivation(kActivate4DClosed);
+ startExtraSequence(k4DEnvironClose, kExtraCompletedFlag, kFilterNoInput);
+ } else if (GameState.getCaldoriaBombDisarmed()) {
+ turnLeft();
+ }
+ }
+}
+
+// Only called when trying to pick up an item and the player can't (because
+// the inventory is too full or because the player lets go of the item before
+// dropping it into the inventory).
+Hotspot *Caldoria::getItemScreenSpot(Item *item, DisplayElement *element) {
+ HotSpotID destSpotID = kNoHotSpotID;
+
+ switch (item->getObjectID()) {
+ case kKeyCard:
+ destSpotID = kCaldoriaKeyCardSpotID;
+ break;
+ case kOrangeJuiceGlassEmpty:
+ case kOrangeJuiceGlassFull:
+ destSpotID = kCaldoriaOrangeJuiceSpotID;
+ break;
+ }
+
+ if (destSpotID == kNoHotSpotID)
+ return Neighborhood::getItemScreenSpot(item, element);
+
+ return _vm->getAllHotspots().findHotspotByID(destSpotID);
+}
+
+void Caldoria::pickedUpItem(Item *item) {
+ switch (item->getObjectID()) {
+ case kKeyCard:
+ GameState.setScoringGotKeyCard(true);
+ break;
+ case kOrangeJuiceGlassFull:
+ setCurrentActivation(kActivateReplicatorReady);
+ requestSpotSound(kCaldoriaDrinkOJIn, kCaldoriaDrinkOJOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case kStunGun:
+ GameState.setCaldoriaGunAimed(false);
+ break;
+ }
+}
+
+void Caldoria::dropItemIntoRoom(Item *item, Hotspot *dropSpot) {
+ switch (item->getObjectID()) {
+ case kKeyCard:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ if (dropSpot->getObjectID() == kCaldoriaGTCardDropSpotID)
+ startExtraSequence(kCaGTCardSwipe, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kOrangeJuiceGlassEmpty:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ if (dropSpot->getObjectID() == kCaldoriaOrangeJuiceDropSpotID) {
+ GameState.setCaldoriaMadeOJ(false);
+ startExtraSequence(kDisposeOrangeJuice, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kCardBomb:
+ GameState.setCaldoriaDoorBombed(true);
+ setCurrentActivation(kActivateHotSpotAlways);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ // Long enough for AI hints...?
+ _utilityFuse.primeFuse(kCardBombCountDownTime);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Caldoria>(this, &Caldoria::doorBombTimerExpired));
+ _utilityFuse.lightFuse();
+ GameState.setCaldoriaFuseTimeLimit(kCardBombCountDownTime);
+ loopCroppedMovie("Images/Caldoria/A48 Bomb Loop", kCaldoria48CardBombLoopLeft, kCaldoria48CardBombLoopTop);
+ GameState.setScoringUsedCardBomb(true);
+ break;
+ case kStunGun:
+ GameState.setCaldoriaGunAimed(true);
+ GameState.setCaldoriaSinclairShot(true);
+ _gunSprite = item->getDragSprite(0);
+ _gunSprite->setCurrentFrameIndex(1);
+ _gunSprite->setDisplayOrder(kDragSpriteOrder);
+ _gunSprite->moveElementTo(kCaldoriaGunSpriteLeft, kCaldoriaGunSpriteTop);
+ _gunSprite->startDisplaying();
+ _gunSprite->show();
+ break;
+ default:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ }
+}
+
+void Caldoria::takeElevator(uint startFloor, uint endFloor) {
+ _croppedMovie.stop();
+ _croppedMovie.setSegment(0, _croppedMovie.getDuration());
+
+ switch (startFloor) {
+ case 1:
+ switch (endFloor) {
+ case 1:
+ // Do nothing.
+ break;
+ case 2:
+ _croppedMovie.setTime(k1To2Time);
+ requestSpotSound(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 3:
+ _croppedMovie.setTime(k1To3Time);
+ requestSpotSound(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 4:
+ _croppedMovie.setSegment(k1To4Start, k1To4Stop);
+ _croppedMovie.setTime(k1To4Start);
+ startExtraSequence(kCaldoriaGroundToFourth, kExtraCompletedFlag, false);
+ _croppedMovie.start();
+ break;
+ case 5:
+ _croppedMovie.setSegment(k1To5Start, k1To5Stop);
+ _croppedMovie.setTime(k1To5Start);
+ startExtraSequence(kCaldoriaGroundToRoof, kExtraCompletedFlag, false);
+ _croppedMovie.start();
+ break;
+ }
+ break;
+ case 4:
+ switch (endFloor) {
+ case 1:
+ _croppedMovie.setSegment(k4To1Start, k4To1Stop);
+ _croppedMovie.setTime(k4To1Start);
+ startExtraSequence(kCaldoriaFourthToGround, kExtraCompletedFlag, false);
+ _croppedMovie.start();
+ break;
+ case 2:
+ _croppedMovie.setTime(k4To2Time);
+ requestSpotSound(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 3:
+ _croppedMovie.setTime(k4To3Time);
+ requestSpotSound(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 4:
+ // Do nothing.
+ break;
+ case 5:
+ _croppedMovie.setSegment(k4To5Start, k4To5Stop);
+ _croppedMovie.setTime(k4To5Start);
+ startExtraSequence(kCaldoriaFourthToRoof, kExtraCompletedFlag, false);
+ _croppedMovie.start();
+ break;
+ }
+ break;
+ case 5:
+ switch (endFloor) {
+ case 1:
+ _croppedMovie.setSegment(k5To1Start, k5To1Stop);
+ _croppedMovie.setTime(k5To1Start);
+ startExtraSequence(kCaldoriaRoofToGround, kExtraCompletedFlag, false);
+ _croppedMovie.start();
+ break;
+ case 2:
+ _croppedMovie.setTime(k5To2Time);
+ requestSpotSound(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 3:
+ _croppedMovie.setTime(k5To3Time);
+ requestSpotSound(kCaldoriaNoOtherDestinationIn, kCaldoriaNoOtherDestinationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 4:
+ _croppedMovie.setSegment(k5To4Start, k5To4Stop);
+ _croppedMovie.setTime(k5To4Start);
+ startExtraSequence(kCaldoriaRoofToFourth, kExtraCompletedFlag, false);
+ _croppedMovie.start();
+ break;
+ case 5:
+ // Do nothing.
+ break;
+ }
+ break;
+ };
+}
+
+void Caldoria::updateElevatorMovie() {
+ TimeValue time = 0xffffffff;
+
+ if (GameState.getCurrentDirection() == kNorth) {
+ switch (GameState.getCurrentRoom()) {
+ case kCaldoria27:
+ time = k4FloorTime;
+ break;
+ case kCaldoria28:
+ time = k1FloorTime;
+ break;
+ case kCaldoria45:
+ time = k5FloorTime;
+ break;
+ }
+ }
+
+ _croppedMovie.stop();
+
+ if (time == 0xffffffff) {
+ _croppedMovie.hide();
+ } else {
+ _croppedMovie.stop();
+ _croppedMovie.setSegment(0, _croppedMovie.getDuration());
+ _croppedMovie.setTime(time);
+ _croppedMovie.redrawMovieWorld();
+ _croppedMovie.show();
+
+ // *** Why do I need this?
+ // clone2727: "don't ask me!"
+ _navMovie.redrawMovieWorld();
+ }
+}
+
+void Caldoria::openElevatorMovie() {
+ if (!_croppedMovie.isSurfaceValid())
+ openCroppedMovie("Images/Caldoria/Caldoria Elevator.movie", kCaldoriaElevatorLeft, kCaldoriaElevatorTop);
+
+ updateElevatorMovie();
+}
+
+void Caldoria::emptyOJGlass() {
+ GameState.setTakenItemID(kOrangeJuiceGlassFull, false);
+ GameState.setTakenItemID(kOrangeJuiceGlassEmpty, true);
+ _vm->removeItemFromInventory((InventoryItem *)_vm->getAllItems().findItemByID(kOrangeJuiceGlassFull));
+ _vm->addItemToInventory((InventoryItem *)_vm->getAllItems().findItemByID(kOrangeJuiceGlassEmpty));
+}
+
+void Caldoria::doorBombTimerExpired() {
+ closeCroppedMovie();
+
+ if (GameState.getShieldOn()) {
+ _vm->getCurrentBiochip()->setItemState(kShieldCardBomb);
+ setCurrentAlternate(kAltCaldoriaRoofDoorBlown);
+ startExtraSequence(kCa48NorthExplosion, kExtraCompletedFlag, kFilterNoInput);
+ GameState.setScoringShieldedCardBomb(true);
+ GameState.setCaldoriaDoorBombed(false);
+ GameState.setCaldoriaRoofDoorOpen(true);
+ } else {
+ playDeathExtra(kCa48NorthExplosionDeath, kDeathCardBomb);
+ }
+}
+
+void Caldoria::sinclairTimerExpired() {
+ _privateFlags.setFlag(kCaldoriaPrivateSinclairTimerExpiredFlag, true);
+ checkSinclairShootsOS();
+}
+
+void Caldoria::checkSinclairShootsOS() {
+ if (_privateFlags.getFlag(kCaldoriaPrivateSinclairTimerExpiredFlag))
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kCaldoria49, kNorth):
+ case MakeRoomView(kCaldoria49, kSouth):
+ case MakeRoomView(kCaldoria49, kEast):
+ case MakeRoomView(kCaldoria49, kWest):
+ case MakeRoomView(kCaldoria50, kSouth):
+ case MakeRoomView(kCaldoria50, kEast):
+ case MakeRoomView(kCaldoria50, kWest):
+ case MakeRoomView(kCaldoria51, kNorth):
+ case MakeRoomView(kCaldoria51, kSouth):
+ case MakeRoomView(kCaldoria51, kWest):
+ case MakeRoomView(kCaldoria52, kNorth):
+ case MakeRoomView(kCaldoria52, kSouth):
+ case MakeRoomView(kCaldoria52, kWest):
+ case MakeRoomView(kCaldoria53, kNorth):
+ case MakeRoomView(kCaldoria53, kSouth):
+ case MakeRoomView(kCaldoria53, kWest):
+ case MakeRoomView(kCaldoria54, kNorth):
+ case MakeRoomView(kCaldoria54, kEast):
+ case MakeRoomView(kCaldoria54, kWest):
+ playSpotSoundSync(kCaldoriaSinclairShootsOSIn, kCaldoriaSinclairShootsOSOut);
+ playSpotSoundSync(kCaldoriaScreamingAfterIn, kCaldoriaScreamingAfterOut);
+ die(kDeathSinclairShotDelegate);
+ break;
+ }
+}
+
+void Caldoria::checkInterruptSinclair() {
+ if (GameState.getCaldoriaSinclairShot()) {
+ _navMovie.stop();
+ _neighborhoodNotification.setNotificationFlags(kExtraCompletedFlag, kExtraCompletedFlag);
+ g_AIArea->unlockAI();
+ } else {
+ uint32 currentTime = _navMovie.getTime();
+
+ ExtraTable::Entry entry;
+ getExtraEntry(kCa53EastZoomToSinclair, entry);
+
+ if (currentTime < entry.movieStart + kSinclairInterruptionTime2)
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime2,
+ _navMovie.getScale());
+ else if (currentTime < entry.movieStart + kSinclairInterruptionTime3)
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime3,
+ _navMovie.getScale());
+ else if (currentTime < entry.movieStart + kSinclairInterruptionTime4)
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime4,
+ _navMovie.getScale());
+ }
+}
+
+Common::String Caldoria::getBriefingMovie() {
+ Common::String movieName = Neighborhood::getBriefingMovie();
+
+ if (movieName.empty()) {
+ if (GameState.allTimeZonesFinished())
+ return "Images/AI/Caldoria/XA02";
+
+ return "Images/AI/Caldoria/XA01";
+ }
+
+ return movieName;
+}
+
+Common::String Caldoria::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ RoomID room = GameState.getCurrentRoom();
+
+ if (room >= kCaldoria00 && room <= kCaldoria14) {
+ // Inside apartment.
+ if (GameState.getCaldoriaDoneHygiene())
+ return "Images/AI/Caldoria/XAE2";
+
+ return "Images/AI/Caldoria/XAE1";
+ } else if (room >= kCaldoria15 && room <= kCaldoria48) {
+ // Wandering the halls...
+ return "Images/AI/Caldoria/XAE3";
+ } else {
+ // Must be the roof.
+ return "Images/AI/Caldoria/XAEH2";
+ }
+ }
+
+ return movieName;
+}
+
+uint Caldoria::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kCaldoria44, kEast):
+ if (!GameState.isTakenItemID(kKeyCard) && GameState.getOpenDoorRoom() == kNoRoomID)
+ numHints = 1;
+ break;
+ case MakeRoomView(kCaldoria48, kNorth):
+ if (!GameState.getCaldoriaRoofDoorOpen()) {
+ if (_croppedMovie.isRunning()) // Bomb must be looping.
+ numHints = 3;
+ else if (GameState.isTakenItemID(kCardBomb))
+ numHints = 1;
+ }
+ break;
+ case MakeRoomView(kCaldoria49, kEast):
+ case MakeRoomView(kCaldoria54, kEast):
+ numHints = 1;
+ break;
+ case MakeRoomView(kCaldoria49, kNorth):
+ numHints = 1;
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String Caldoria::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty()) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kCaldoria44, kEast):
+ return "Images/AI/Caldoria/X42WH2";
+ case MakeRoomView(kCaldoria48, kNorth):
+ if (_croppedMovie.isRunning()) { // Bomb must be looping.
+ if (hintNum == 1)
+ return "Images/AI/Caldoria/X48ND1";
+ else if (hintNum == 2)
+ return "Images/AI/Caldoria/X48ND2";
+ else if (GameState.isTakenItemID(kShieldBiochip))
+ return "Images/AI/Caldoria/X48ND3";
+
+ // *** Doesn't work yet, need global movies.
+ break;
+ }
+
+ return "Images/AI/Globals/XGLOB1A";
+ case MakeRoomView(kCaldoria49, kEast):
+ case MakeRoomView(kCaldoria54, kEast):
+ return "Images/AI/Caldoria/X49E";
+ case MakeRoomView(kCaldoria49, kNorth):
+ return "Images/AI/Caldoria/X49NB2";
+ }
+ }
+
+ return movieName;
+}
+
+void Caldoria::updateCursor(const Common::Point where, const Hotspot *cursorSpot) {
+ if (cursorSpot) {
+ switch (cursorSpot->getObjectID()) {
+ case kCa4DEnvironCloseSpotID:
+ _vm->_cursor->setCurrentFrameIndex(2);
+ return;
+ case kCaldoriaKioskSpotID:
+ _vm->_cursor->setCurrentFrameIndex(3);
+ return;
+ }
+ }
+
+ Neighborhood::updateCursor(where, cursorSpot);
+}
+
+Common::String Caldoria::getNavMovieName() {
+ return "Images/Caldoria/Caldoria.movie";
+}
+
+Common::String Caldoria::getSoundSpotsName() {
+ return "Sounds/Caldoria/Caldoria Spots";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.h b/engines/pegasus/neighborhood/caldoria/caldoria.h
new file mode 100644
index 0000000000..3d6a155170
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoria.h
@@ -0,0 +1,523 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIA_H
+#define PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIA_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+static const TimeScale kCaldoriaMovieScale = 600;
+static const TimeScale kCaldoriaFramesPerSecond = 15;
+static const TimeScale kCaldoriaFrameDuration = 40;
+
+// Alternate IDs.
+
+static const AlternateID kAltCaldoriaNormal = 0;
+static const AlternateID kAltCaldoriaRoofDoorBlown = 2;
+static const AlternateID kAltCaldoriaSinclairDown = 3;
+
+// Room IDs.
+
+static const RoomID kCaldoria00 = 1;
+static const RoomID kCaldoria01 = 2;
+static const RoomID kCaldoria02 = 3;
+static const RoomID kCaldoria03 = 4;
+static const RoomID kCaldoria04 = 5;
+static const RoomID kCaldoria05 = 6;
+static const RoomID kCaldoria06 = 7;
+static const RoomID kCaldoria07 = 8;
+static const RoomID kCaldoria08 = 9;
+static const RoomID kCaldoria09 = 10;
+static const RoomID kCaldoria10 = 11;
+static const RoomID kCaldoriaToilet = 12;
+static const RoomID kCaldoria11 = 13;
+static const RoomID kCaldoria12 = 14;
+static const RoomID kCaldoriaVidPhone = 15;
+static const RoomID kCaldoriaReplicator = 16;
+static const RoomID kCaldoriaDrawers = 17;
+static const RoomID kCaldoria13 = 18;
+static const RoomID kCaldoria14 = 19;
+static const RoomID kCaldoria15 = 20;
+static const RoomID kCaldoria16 = 21;
+static const RoomID kCaldoria17 = 22;
+static const RoomID kCaldoria18 = 23;
+static const RoomID kCaldoria19 = 24;
+static const RoomID kCaldoria20 = 25;
+static const RoomID kCaldoria21 = 26;
+static const RoomID kCaldoria22 = 27;
+static const RoomID kCaldoria23 = 28;
+static const RoomID kCaldoria24 = 29;
+static const RoomID kCaldoria25 = 30;
+static const RoomID kCaldoria26 = 31;
+static const RoomID kCaldoria27 = 32;
+static const RoomID kCaldoria28 = 33;
+static const RoomID kCaldoria29 = 34;
+static const RoomID kCaldoria30 = 35;
+static const RoomID kCaldoria31 = 36;
+static const RoomID kCaldoria32 = 37;
+static const RoomID kCaldoria33 = 38;
+static const RoomID kCaldoria34 = 39;
+static const RoomID kCaldoria35 = 40;
+static const RoomID kCaldoria36 = 41;
+static const RoomID kCaldoria37 = 42;
+static const RoomID kCaldoria38 = 43;
+static const RoomID kCaldoria39 = 44;
+static const RoomID kCaldoria40 = 45;
+static const RoomID kCaldoria41 = 46;
+static const RoomID kCaldoriaBinoculars = 47;
+static const RoomID kCaldoria42 = 48;
+static const RoomID kCaldoriaKiosk = 49;
+static const RoomID kCaldoria44 = 50;
+static const RoomID kCaldoria45 = 51;
+static const RoomID kCaldoria46 = 52;
+static const RoomID kCaldoria47 = 53;
+static const RoomID kCaldoria48 = 54;
+static const RoomID kCaldoria49 = 55;
+static const RoomID kCaldoria50 = 56;
+static const RoomID kCaldoria51 = 57;
+static const RoomID kCaldoria52 = 58;
+static const RoomID kCaldoria53 = 59;
+static const RoomID kCaldoria54 = 60;
+static const RoomID kCaldoria55 = 61;
+static const RoomID kCaldoria56 = 62;
+static const RoomID kCaldoriaDeathRoom = 0;
+
+// Hot Spot Activation IDs.
+
+static const HotSpotActivationID kActivate4DClosed = 1;
+static const HotSpotActivationID kActivate4DOpen = 2;
+static const HotSpotActivationID kActivateMirrorReady = 3;
+static const HotSpotActivationID kActivateStylistReady = 4;
+static const HotSpotActivationID kActivateReplicatorReady = 5;
+static const HotSpotActivationID kActivateOJOnThePad = 6;
+static const HotSpotActivationID kActivateDrawersClosed = 7;
+static const HotSpotActivationID kActivateRightOpen = 8;
+static const HotSpotActivationID kActivateLeftOpen = 9;
+static const HotSpotActivationID kActivateFocusedOnShip = 10;
+static const HotSpotActivationID kActivateNotFocusedOnShip = 11;
+static const HotSpotActivationID kActivateReadyForCard = 12;
+static const HotSpotActivationID kActivateReadyToTransport = 13;
+static const HotSpotActivationID kActivateRoofSlotEmpty = 14;
+static const HotSpotActivationID kActivateZoomedOnSinclair = 15;
+
+// Hot Spot IDs.
+
+static const HotSpotID kCa4DEnvironOpenSpotID = 5000;
+static const HotSpotID kCa4DEnvironCloseSpotID = 5001;
+static const HotSpotID kCa4DVisualSpotID = 5002;
+static const HotSpotID kCa4DAudioSpotID = 5003;
+static const HotSpotID kCa4DChoice1SpotID = 5004;
+static const HotSpotID kCa4DChoice2SpotID = 5005;
+static const HotSpotID kCa4DChoice3SpotID = 5006;
+static const HotSpotID kCa4DChoice4SpotID = 5007;
+static const HotSpotID kCaBathroomMirrorSpotID = 5008;
+static const HotSpotID kCaHairStyle1SpotID = 5009;
+static const HotSpotID kCaHairStyle2SpotID = 5010;
+static const HotSpotID kCaHairStyle3SpotID = 5011;
+static const HotSpotID kCaShowerSpotID = 5012;
+static const HotSpotID kCaBathroomToiletSpotID = 5013;
+static const HotSpotID kCaldoriaVidPhoneSpotID = 5014;
+static const HotSpotID kCaldoriaReplicatorSpotID = 5015;
+static const HotSpotID kCaldoriaDrawersSpotID = 5016;
+static const HotSpotID kCaldoriaVidPhoneOutSpotID = 5017;
+static const HotSpotID kCaBedroomVidPhoneActivationSpotID = 5018;
+static const HotSpotID kCaldoriaReplicatorOutSpotID = 5019;
+static const HotSpotID kCaldoriaMakeOJSpotID = 5020;
+static const HotSpotID kCaldoriaMakeStickyBunsSpotID = 5021;
+static const HotSpotID kCaldoriaOrangeJuiceSpotID = 5022;
+static const HotSpotID kCaldoriaOrangeJuiceDropSpotID = 5023;
+static const HotSpotID kCaldoriaDrawersOutSpotID = 5024;
+static const HotSpotID kCaldoriaLeftDrawerOpenSpotID = 5025;
+static const HotSpotID kCaldoriaRightDrawerOpenSpotID = 5026;
+static const HotSpotID kCaldoriaKeyCardSpotID = 5027;
+static const HotSpotID kCaldoriaLeftDrawerCloseSpotID = 5028;
+static const HotSpotID kCaldoriaRightDrawerWithKeysCloseSpotID = 5029;
+static const HotSpotID kCaldoriaRightDrawerNoKeysCloseSpotID = 5030;
+static const HotSpotID kCaldoriaFourthFloorElevatorSpotID = 5031;
+static const HotSpotID kCaldoria20DoorbellSpotID = 5032;
+static const HotSpotID kCaldoria21DoorbellSpotID = 5033;
+static const HotSpotID kCaldoria26DoorbellSpotID = 5034;
+static const HotSpotID kCaldoriaFourthFloorElevator1 = 5035;
+static const HotSpotID kCaldoriaFourthFloorElevator2 = 5036;
+static const HotSpotID kCaldoriaFourthFloorElevator3 = 5037;
+static const HotSpotID kCaldoriaFourthFloorElevator4 = 5038;
+static const HotSpotID kCaldoriaFourthFloorElevator5 = 5039;
+static const HotSpotID kCaldoriaGroundElevator1 = 5040;
+static const HotSpotID kCaldoriaGroundElevator2 = 5041;
+static const HotSpotID kCaldoriaGroundElevator3 = 5042;
+static const HotSpotID kCaldoriaGroundElevator4 = 5043;
+static const HotSpotID kCaldoriaGroundElevator5 = 5044;
+static const HotSpotID kCaldoria29DoorbellSpotID = 5045;
+static const HotSpotID kCaldoria34DoorbellSpotID = 5046;
+static const HotSpotID kCaldoria35DoorbellSpotID = 5047;
+static const HotSpotID kCaldoriaGroundElevatorSpotID = 5048;
+static const HotSpotID kCaldoriaBinocularZoomInSpotID = 5049;
+static const HotSpotID kCaldoriaBinocularsOutSpotID = 5050;
+static const HotSpotID kCaldoriaZoomInOnShipSpotID = 5051;
+static const HotSpotID kCaldoriaKioskSpotID = 5052;
+static const HotSpotID kCaldoriaKioskOutSpotID = 5053;
+static const HotSpotID kCaldoriaKioskInfoSpotID = 5054;
+static const HotSpotID kCaldoriaGTCardDropSpotID = 5055;
+static const HotSpotID kCaldoriaGTTokyoSpotID = 5056;
+static const HotSpotID kCaldoriaGTTSASpotID = 5057;
+static const HotSpotID kCaldoriaGTBeachSpotID = 5058;
+static const HotSpotID kCaldoriaGTOtherSpotID = 5059;
+static const HotSpotID kCaldoriaRoofElevator1 = 5060;
+static const HotSpotID kCaldoriaRoofElevator2 = 5061;
+static const HotSpotID kCaldoriaRoofElevator3 = 5062;
+static const HotSpotID kCaldoriaRoofElevator4 = 5063;
+static const HotSpotID kCaldoriaRoofElevator5 = 5064;
+static const HotSpotID kCaldoriaRoofElevatorSpotID = 5065;
+static const HotSpotID kCaldoriaRoofDoorSpotID = 5066;
+static const HotSpotID kCaldoriaRoofCardDropSpotID = 5067;
+static const HotSpotID kCaldoria53EastSinclairTargetSpotID = 5068;
+
+// Extra sequence IDs.
+
+static const ExtraID kCaldoriaWakeUpView1 = 0;
+static const ExtraID kCaldoria00WakeUp1 = 1;
+static const ExtraID kCaldoria00WakeUp2 = 2;
+static const ExtraID kCaldoria00SitDown = 3;
+static const ExtraID k4DEnvironOpenToINN = 4;
+static const ExtraID k4DINNInterruption = 5;
+static const ExtraID k4DINNIntro = 6;
+static const ExtraID k4DINNMarkJohnson = 7;
+static const ExtraID k4DINNMeganLove = 8;
+static const ExtraID k4DINNFadeOut = 9;
+static const ExtraID k4DEnvironOpenFromINN = 10;
+static const ExtraID k4DEnvironOpen = 11;
+static const ExtraID k4DEnvironOpenView = 12;
+static const ExtraID k4DEnvironClose = 13;
+static const ExtraID k4DIslandLoop = 14;
+static const ExtraID k4DDesertLoop = 15;
+static const ExtraID k4DMountainLoop = 16;
+static const ExtraID k4DIsland1ToIsland0 = 17;
+static const ExtraID k4DIsland2ToIsland0 = 18;
+static const ExtraID k4DIsland0ToDesert0 = 19;
+static const ExtraID k4DIsland1ToDesert0 = 20;
+static const ExtraID k4DIsland2ToDesert0 = 21;
+static const ExtraID k4DIsland0ToMountain0 = 22;
+static const ExtraID k4DIsland1ToMountain0 = 23;
+static const ExtraID k4DIsland2ToMountain0 = 24;
+static const ExtraID k4DDesert0ToIsland0 = 25;
+static const ExtraID k4DDesert1ToIsland0 = 26;
+static const ExtraID k4DDesert2ToIsland0 = 27;
+static const ExtraID k4DDesert0ToMountain0 = 28;
+static const ExtraID k4DDesert1ToMountain0 = 29;
+static const ExtraID k4DDesert2ToMountain0 = 30;
+static const ExtraID k4DMountain0ToIsland0 = 31;
+static const ExtraID k4DMountain1ToIsland0 = 32;
+static const ExtraID k4DMountain2ToIsland0 = 33;
+static const ExtraID k4DMountain0ToDesert0 = 34;
+static const ExtraID k4DMountain1ToDesert0 = 35;
+static const ExtraID k4DMountain2ToDesert0 = 36;
+static const ExtraID kCaBathroomGreeting = 37;
+static const ExtraID kCaBathroomBodyFat = 38;
+static const ExtraID kCaBathroomStylistIntro = 39;
+static const ExtraID kCaBathroomRetrothrash = 40;
+static const ExtraID kCaBathroomRetrothrashReturn = 41;
+static const ExtraID kCaBathroomGeoWave = 42;
+static const ExtraID kCaBathroomGeoWaveReturn = 43;
+static const ExtraID kCaBathroomAgencyStandard = 44;
+static const ExtraID kCaldoriaShowerTitle = 45;
+static const ExtraID kCaldoriaShowerButton = 46;
+static const ExtraID kCaldoriaShowerDown = 47;
+static const ExtraID kCaldoriaShowerUp = 48;
+static const ExtraID kCaBedroomVidPhone = 49;
+static const ExtraID kCaBedroomMessage1 = 50;
+static const ExtraID kCaBedroomMessage2 = 51;
+static const ExtraID kCreateOrangeJuice = 52;
+static const ExtraID kDisposeOrangeJuice = 53;
+static const ExtraID kReplicatorNorthViewWithOJ = 54;
+static const ExtraID kLeftDrawerOpen = 55;
+static const ExtraID kLeftDrawerClose = 56;
+static const ExtraID kRightDrawerOpenWithKeys = 57;
+static const ExtraID kRightDrawerCloseWithKeys = 58;
+static const ExtraID kRightDrawerOpenNoKeys = 59;
+static const ExtraID kRightDrawerCloseNoKeys = 60;
+static const ExtraID kRightDrawerOpenViewWithKeys = 61;
+static const ExtraID kRightDrawerOpenViewNoKeys = 62;
+static const ExtraID kCaldoria16ElevatorUp = 63;
+static const ExtraID kCaldoria16ElevatorDown = 64;
+static const ExtraID kCaldoria16SouthViewWithElevator = 65;
+static const ExtraID kCaldoria20Doorbell = 66;
+static const ExtraID kCaldoria21Doorbell = 67;
+static const ExtraID kCaldoria26Doorbell = 68;
+static const ExtraID kCaldoriaFourthToGround = 69;
+static const ExtraID kCaldoriaRoofToFourth = 70;
+static const ExtraID kCaldoriaRoofToGround = 71;
+static const ExtraID kCaldoriaGroundToFourth = 72;
+static const ExtraID kCaldoriaGroundToRoof = 73;
+static const ExtraID kCaldoriaFourthToRoof = 74;
+static const ExtraID kCaldoria29Doorbell = 75;
+static const ExtraID kCaldoria34Doorbell = 76;
+static const ExtraID kCaldoria35Doorbell = 77;
+static const ExtraID kBinocularsZoomInOnShip = 78;
+static const ExtraID kCaldoriaKioskVideo = 79;
+static const ExtraID kCaldoriaTransporterArrowLoop = 80;
+static const ExtraID kArriveAtCaldoriaFromTSA = 81;
+static const ExtraID kCaGTOtherChoice = 82;
+static const ExtraID kCaGTCardSwipe = 83;
+static const ExtraID kCaGTSelectTSA = 84;
+static const ExtraID kCaGTFryTheFly = 85;
+static const ExtraID kCaGTGoToTSA = 86;
+static const ExtraID kCaGTSelectBeach = 87;
+static const ExtraID kCaGTGoToBeach = 88;
+static const ExtraID kCaGTArriveAtBeach = 89;
+static const ExtraID kCaGTSelectTokyo = 90;
+static const ExtraID kCaGTGoToTokyo = 91;
+static const ExtraID kCaGTArriveAtTokyo = 92;
+static const ExtraID kCa48NorthRooftopClosed = 93;
+static const ExtraID kCa48NorthExplosion = 94;
+static const ExtraID kCa48NorthExplosionDeath = 95;
+static const ExtraID kCa49NorthVoiceAnalysis = 96;
+static const ExtraID kCa50SinclairShoots = 97;
+static const ExtraID kCa53EastZoomToSinclair = 98;
+static const ExtraID kCa53EastDeath2 = 99;
+static const ExtraID kCa53EastShootSinclair = 100;
+static const ExtraID kCa53EastZoomOutFromSinclair = 101;
+static const ExtraID kCa54SouthDeath = 102;
+static const ExtraID kCaldoria56BombStage1 = 103;
+static const ExtraID kCaldoria56BombStage2 = 104;
+static const ExtraID kCaldoria56BombStage3 = 105;
+static const ExtraID kCaldoria56BombStage4 = 106;
+static const ExtraID kCaldoria56BombStage5 = 107;
+static const ExtraID kCaldoria56BombStage6 = 108;
+static const ExtraID kCaldoria56BombStage7 = 109;
+static const ExtraID kCaldoria56BombExplodes = 110;
+
+// Caldoria interactions.
+
+static const InteractionID kCaldoria4DInteractionID = 0;
+static const InteractionID kCaldoriaBombInteractionID = 1;
+static const InteractionID kCaldoriaMessagesInteractionID = 2;
+static const InteractionID kCaldoriaMirrorInteractionID = 3;
+
+// Caldoria:
+
+static const DisplayOrder kVidPhoneOrder = kMonitorLayer;
+static const DisplayOrder k4DSpritesOrder = kMonitorLayer;
+static const DisplayOrder kCaldoriaMessagesOrder = kMonitorLayer;
+static const DisplayOrder kCaldoriaElevatorOrder = kMonitorLayer;
+static const DisplayOrder kCaldoriaA05LightLoopOrder = kMonitorLayer;
+static const DisplayOrder kCaldoriaA07LightLoopOrder = kMonitorLayer;
+static const DisplayOrder kCaldoriaBombGridOrder = kMonitorLayer;
+static const DisplayOrder kCaldoriaBombTimerOrder = kCaldoriaBombGridOrder + 1;
+
+/////////////////////////////////////////////
+//
+// Caldoria
+
+static const CoordType kCaldoriaVidPhoneLeft = kNavAreaLeft + 105;
+static const CoordType kCaldoriaVidPhoneTop = kNavAreaTop + 28;
+
+static const CoordType kCaldoria4DSpritesLeft = kNavAreaLeft + 10;
+static const CoordType kCaldoria4DSpritesTop = kNavAreaTop + 142;
+
+static const CoordType kCaldoriaMessageLeft = kNavAreaLeft + 202;
+static const CoordType kCaldoriaMessageTop = kNavAreaTop + 26;
+
+static const CoordType kCaldoriaElevatorLeft = kNavAreaLeft + 407;
+static const CoordType kCaldoriaElevatorTop = kNavAreaTop + 138;
+
+static const CoordType kCaldoriaA05LightLoopLeft = kNavAreaLeft + 213;
+static const CoordType kCaldoriaA05LightLoopTop = kNavAreaTop + 215;
+
+static const CoordType kCaldoriaA07LightLoopLeft = kNavAreaLeft + 414;
+static const CoordType kCaldoriaA07LightLoopTop = kNavAreaTop + 215;
+
+static const CoordType kCaldoriaGunSpriteLeft = kNavAreaLeft + 276;
+static const CoordType kCaldoriaGunSpriteTop = kNavAreaTop + 115;
+
+static const CoordType kCaldoria11MessageLoopLeft = kNavAreaLeft + 135;
+static const CoordType kCaldoria11MessageLoopTop = kNavAreaTop + 214;
+
+static const CoordType kCaldoria12MessageLoopLeft = kNavAreaLeft + 209;
+static const CoordType kCaldoria12MessageLoopTop = kNavAreaTop + 170;
+
+static const CoordType kCaldoria13MessageLoopLeft = kNavAreaLeft + 480;
+static const CoordType kCaldoria13MessageLoopTop = kNavAreaTop + 191;
+
+static const CoordType kCaldoria14MessageLoopLeft = kNavAreaLeft + 248;
+static const CoordType kCaldoria14MessageLoopTop = kNavAreaTop + 191;
+
+static const CoordType kCaldoria48CardBombLoopLeft = kNavAreaLeft + 337;
+static const CoordType kCaldoria48CardBombLoopTop = kNavAreaTop + 205;
+
+static const CoordType kCaldoriaBombGridLeft = kNavAreaLeft + 290;
+static const CoordType kCaldoriaBombGridTop = kNavAreaTop + 58;
+
+static const CoordType kCaldoriaBombTimerLeft = kNavAreaLeft + 58;
+static const CoordType kCaldoriaBombTimerTop = kNavAreaTop + 204;
+
+// Caldoria display IDs.
+
+static const DisplayElementID kCaldoriaVidPhoneID = kNeighborhoodDisplayID;
+static const DisplayElementID kCaldoria4DSpritesID = kCaldoriaVidPhoneID + 1;
+static const DisplayElementID kCaldoriaMessagesID = kCaldoria4DSpritesID + 1;
+static const DisplayElementID kCaldoriaUtilityID = kCaldoriaMessagesID + 1;
+static const DisplayElementID kCaldoriaBombGridID = kCaldoriaUtilityID + 1;
+static const DisplayElementID kCaldoriaBombTimerID = kCaldoriaBombGridID + 1;
+
+static const TimeValue kCaldoria4DBlankChoiceIn = 29730;
+static const TimeValue kCaldoria4DBlankChoiceOut = 33910;
+
+class Caldoria;
+
+class SinclairCallBack : public TimeBaseCallBack {
+public:
+ SinclairCallBack(Caldoria *);
+ ~SinclairCallBack() {}
+
+protected:
+ virtual void callBack();
+
+ Caldoria *_caldoria;
+};
+
+class Caldoria : public Neighborhood {
+friend class SinclairCallBack;
+
+public:
+ Caldoria(InputHandler *, PegasusEngine *);
+ virtual ~Caldoria();
+
+ virtual uint16 getDateResID() const;
+
+ void pickedUpItem(Item *);
+
+ virtual GameInteraction *makeInteraction(const InteractionID);
+
+ virtual Common::String getBriefingMovie();
+ virtual Common::String getEnvScanMovie();
+ virtual uint getNumHints();
+ virtual Common::String getHintMovie(uint);
+ void loadAmbientLoops();
+ bool wantsCursor();
+ void flushGameState();
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+protected:
+ enum {
+ kCaldoriaPrivate4DSystemOpenFlag,
+ kCaloriaPrivateLeftDrawerOpenFlag,
+ kCaldoriaPrivateRightDrawerOpenFlag,
+ kCaldoriaPrivateReadyToShootFlag,
+ kCaldoriaPrivateZoomingToBombFlag,
+ kCaldoriaPrivateCanOpenElevatorDoorFlag,
+ kCaldoriaPrivateSinclairTimerExpiredFlag,
+ kCaldoriaPrivateSeen13CarFlag,
+ kCaldoriaPrivateSeen14CarFlag,
+ kCaldoriaPrivateSeen18CarFlag,
+ kCaldoriaPrivateSeen23CarFlag,
+ kCaldoriaPrivateSeen33CarFlag,
+ kCaldoriaPrivateSeen36CarFlag,
+ kCaldoriaPrivateSeen41NorthCarFlag,
+ kCaldoriaPrivateSeen41EastCarFlag,
+ kCaldoriaPrivateSeen41WestCarFlag,
+ kNumCaldoriaPrivateFlags
+ };
+
+ void init();
+ void start();
+
+ void setUpRoofTop();
+
+ void setUpAIRules();
+ void doAIRecalibration();
+ TimeValue getViewTime(const RoomID, const DirectionConstant);
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+ void startSpotOnceOnly(TimeValue, TimeValue);
+ void startExitMovie(const ExitTable::Entry &);
+ void startZoomMovie(const ZoomTable::Entry &);
+ void startDoorOpenMovie(const TimeValue, const TimeValue);
+ void startTurnPush(const TurnDirection, const TimeValue, const DirectionConstant);
+ void bumpIntoWall();
+ int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+ void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &);
+ void getZoomCompassMove(const ZoomTable::Entry &, FaderMoveSpec &);
+ void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &);
+ void spotCompleted();
+ void arriveAt(const RoomID, const DirectionConstant);
+ void arriveAtCaldoria00();
+ void arriveAtCaldoriaToilet();
+ void arriveAtCaldoria44();
+ void arriveAtCaldoria49();
+ void arriveAtCaldoria56();
+ void arriveAtCaldoriaDeath();
+ void turnTo(const DirectionConstant);
+ void zoomTo(const Hotspot *);
+ void downButton(const Input &);
+ void receiveNotification(Notification *, const NotificationFlags);
+ InputBits getInputFilter();
+ void activateHotspots();
+ void clickInHotspot(const Input &, const Hotspot *);
+ void newInteraction(const InteractionID);
+
+ void clickOnDoorbell(const HotSpotID);
+
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+ void dropItemIntoRoom(Item *, Hotspot *);
+ void takeElevator(uint, uint);
+ void updateElevatorMovie();
+ void openElevatorMovie();
+ void emptyOJGlass();
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+ void doorBombTimerExpired();
+ void sinclairTimerExpired();
+ void checkSinclairShootsOS();
+ void setUpSinclairLoops();
+ void zoomToSinclair();
+ void playEndMessage();
+ void checkInterruptSinclair();
+
+ CanOpenDoorReason canOpenDoor(DoorTable::Entry &);
+ void doorOpened();
+
+ void updateCursor(const Common::Point, const Hotspot *);
+
+ FlagsArray<uint16, kNumCaldoriaPrivateFlags> _privateFlags;
+
+ const Hotspot *_zoomOutSpot;
+
+ FuseFunction _utilityFuse;
+
+ long _sinclairLoopCount;
+ long _numSinclairLoops;
+
+ Sprite *_gunSprite;
+
+ SinclairCallBack _sinclairInterrupt;
+
+ Common::String getSoundSpotsName();
+ Common::String getNavMovieName();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp b/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp
new file mode 100644
index 0000000000..0494753661
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp
@@ -0,0 +1,370 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/caldoria/caldoria4dsystem.h"
+
+namespace Pegasus {
+
+static const TimeValue kSwitchableSlop = 3 * kCaldoriaFrameDuration;
+// Two seconds - some slop
+static const TimeValue kSwitchableDuration = kCaldoriaMovieScale * 2 - kSwitchableSlop;
+// Twelve frames + some slop
+static const TimeValue kNonswitchableDuration = kCaldoriaFrameDuration * 12 + kSwitchableSlop;
+
+static const TimeValue kSwitchable1Start = 0;
+static const TimeValue kSwitchable1Stop = kSwitchable1Start + kSwitchableDuration;
+
+static const TimeValue kSwitchable2Start = kSwitchable1Stop + kNonswitchableDuration;
+static const TimeValue kSwitchable2Stop = kSwitchable2Start + kSwitchableDuration;
+
+static const TimeValue kSwitchable3Start = kSwitchable2Stop + kNonswitchableDuration;
+static const TimeValue kSwitchable3Stop = kSwitchable3Start + kSwitchableDuration;
+
+static const NotificationFlags kVidPhoneDoneFlag = 1;
+
+static const TimeValue kRockMusicLoopIn = 0;
+static const TimeValue kRockMusicLoopOut = 2088;
+
+static const TimeValue kOrchestralMusicLoopIn = 2088;
+static const TimeValue kOrchestralMusicLoopOut = 4985;
+
+static const TimeValue kRhythmsMusicLoopIn = 4985;
+static const TimeValue kRhythmsMusicLoopOut = 6824;
+
+static const TimeValue kAcousticMusicLoopIn = 6824;
+static const TimeValue kAcousticMusicLoopOut = 9387;
+
+enum {
+ k4DVideoMenu,
+ k4DAudioMenu,
+ k4DShuttingDown,
+
+ // These constants are the exact frame numbers of the sprite movie.
+ k4DRockChoice = 0,
+ k4DOrchestralChoice,
+ k4DRhythmsChoice,
+ k4DAcousticChoice,
+ k4DIslandChoice,
+ k4DDesertChoice,
+ k4DMountainChoice,
+
+ k4DFirstVideoChoice = k4DIslandChoice
+};
+
+static const ExtraID s_transitionExtras0[3][3] = {
+ { 0xffffffff, k4DIsland0ToDesert0, k4DIsland0ToMountain0 },
+ { k4DDesert0ToIsland0, 0xffffffff, k4DDesert0ToMountain0 },
+ { k4DMountain0ToIsland0, k4DMountain0ToDesert0, 0xffffffff }
+};
+
+static const ExtraID s_transitionExtras1[3][3] = {
+ { 0xffffffff, k4DIsland1ToDesert0, k4DIsland1ToMountain0 },
+ { k4DDesert1ToIsland0, 0xffffffff, k4DDesert1ToMountain0 },
+ { k4DMountain1ToIsland0, k4DMountain1ToDesert0, 0xffffffff }
+};
+
+static const ExtraID s_transitionExtras2[3][3] = {
+ { 0xffffffff, k4DIsland2ToDesert0, k4DIsland2ToMountain0 },
+ { k4DDesert2ToIsland0, 0xffffffff, k4DDesert2ToMountain0 },
+ { k4DMountain2ToIsland0, k4DMountain2ToDesert0, 0xffffffff }
+};
+
+static const ExtraID s_shutDownExtras[3][3] = {
+ { 0xffffffff, k4DIsland1ToIsland0, k4DIsland2ToIsland0 },
+ { k4DDesert0ToIsland0, k4DDesert1ToIsland0, k4DDesert2ToIsland0 },
+ { k4DMountain0ToIsland0, k4DMountain1ToIsland0, k4DMountain2ToIsland0 }
+};
+
+Caldoria4DSystem::Caldoria4DSystem(Neighborhood *owner) : GameInteraction(kCaldoria4DInteractionID, owner),
+ _4DSpritesMovie(kCaldoria4DSpritesID) {
+ g_AIArea->lockAIOut();
+}
+
+Caldoria4DSystem::~Caldoria4DSystem() {
+ g_AIArea->unlockAI();
+}
+
+void Caldoria4DSystem::openInteraction() {
+ _whichMenu = k4DVideoMenu;
+ _videoChoice = k4DIslandChoice;
+ _audioChoice = k4DRockChoice;
+ _clickedHotspotID = kNoHotSpotID;
+
+ _4DSpritesMovie.initFromMovieFile("Images/Caldoria/4D Sprites", true);
+ _4DSpritesMovie.moveElementTo(kCaldoria4DSpritesLeft, kCaldoria4DSpritesTop);
+ _4DSpritesMovie.setDisplayOrder(k4DSpritesOrder);
+ _4DSpritesMovie.startDisplaying();
+ _4DSpritesMovie.show();
+
+ _4DSpritesScale = _4DSpritesMovie.getScale();
+
+ _neighborhoodNotification = _owner->getNeighborhoodNotification();
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag, kExtraCompletedFlag);
+
+ startIdling();
+}
+
+void Caldoria4DSystem::loopExtra(const ExtraID extraID) {
+ ExtraTable::Entry extraEntry;
+
+ _owner->getExtraEntry(extraID, extraEntry);
+ _loopStart = extraEntry.movieStart;
+ _owner->loopExtraSequence(extraID);
+}
+
+void Caldoria4DSystem::useIdleTime() {
+ if (_whichMenu == k4DShuttingDown) {
+ TimeValue movieTime = _owner->getNavMovie()->getTime() - _loopStart;
+ ExtraID extraID;
+
+ if (movieTime < kSwitchable1Stop)
+ extraID = s_shutDownExtras[_videoChoice - k4DFirstVideoChoice][0];
+ else if (movieTime >= kSwitchable2Start && movieTime < kSwitchable2Stop)
+ extraID = s_shutDownExtras[_videoChoice - k4DFirstVideoChoice][1];
+ else if (movieTime >= kSwitchable3Start && movieTime < kSwitchable3Stop)
+ extraID = s_shutDownExtras[_videoChoice - k4DFirstVideoChoice][2];
+ else
+ extraID = 0xffffffff;
+
+ if (extraID != 0xffffffff) {
+ setSpritesMovie();
+ _loopStart = 0;
+ _owner->startExtraSequence(extraID, kExtraCompletedFlag, kFilterNoInput);
+ }
+ } else if (_clickedHotspotID != kNoHotSpotID) {
+ TimeValue movieTime = _owner->getNavMovie()->getTime() - _loopStart;
+ ExtraID extraID;
+
+ if (movieTime < kSwitchable1Stop) {
+ extraID = s_transitionExtras0[_videoChoice - k4DFirstVideoChoice][_clickedHotspotID - kCa4DChoice1SpotID];
+ _clickedHotspotID = kNoHotSpotID;
+ } else if (movieTime >= kSwitchable2Start && movieTime < kSwitchable2Stop) {
+ extraID = s_transitionExtras1[_videoChoice - k4DFirstVideoChoice][_clickedHotspotID - kCa4DChoice1SpotID];
+ _clickedHotspotID = kNoHotSpotID;
+ } else if (movieTime >= kSwitchable3Start && movieTime < kSwitchable3Stop) {
+ extraID = s_transitionExtras2[_videoChoice - k4DFirstVideoChoice][_clickedHotspotID - kCa4DChoice1SpotID];
+ _clickedHotspotID = kNoHotSpotID;
+ } else
+ extraID = 0xffffffff;
+
+ if (extraID != 0xffffffff) {
+ switch (extraID) {
+ case k4DDesert0ToIsland0:
+ case k4DMountain0ToIsland0:
+ case k4DDesert1ToIsland0:
+ case k4DMountain1ToIsland0:
+ case k4DDesert2ToIsland0:
+ case k4DMountain2ToIsland0:
+ _videoChoice = k4DIslandChoice;
+ break;
+ case k4DIsland0ToDesert0:
+ case k4DMountain0ToDesert0:
+ case k4DIsland1ToDesert0:
+ case k4DMountain1ToDesert0:
+ case k4DIsland2ToDesert0:
+ case k4DMountain2ToDesert0:
+ _videoChoice = k4DDesertChoice;
+ break;
+ case k4DDesert0ToMountain0:
+ case k4DIsland0ToMountain0:
+ case k4DIsland1ToMountain0:
+ case k4DDesert1ToMountain0:
+ case k4DIsland2ToMountain0:
+ case k4DDesert2ToMountain0:
+ _videoChoice = k4DMountainChoice;
+ break;
+ }
+
+ setSpritesMovie();
+ _loopStart = 0;
+ _owner->startExtraSequence(extraID, kExtraCompletedFlag, kFilterNoInput);
+ }
+ }
+}
+
+void Caldoria4DSystem::initInteraction() {
+ setSpritesMovie();
+
+ _owner->loadLoopSound1("Sounds/Caldoria/Rock.aiff");
+ loopExtra(k4DIslandLoop);
+}
+
+void Caldoria4DSystem::closeInteraction() {
+ stopIdling();
+ _neighborhoodNotification->cancelNotification(this);
+ _4DSpritesMovie.releaseMovie();
+ _owner->loadAmbientLoops();
+}
+
+void Caldoria4DSystem::setSpritesMovie() {
+ if (_whichMenu == k4DShuttingDown)
+ _4DSpritesMovie.setTime(_4DSpritesScale * k4DIslandChoice);
+ else if (_whichMenu == k4DVideoMenu)
+ _4DSpritesMovie.setTime(_4DSpritesScale * _videoChoice);
+ else if (_whichMenu == k4DAudioMenu)
+ _4DSpritesMovie.setTime(_4DSpritesScale * _audioChoice);
+
+ _4DSpritesMovie.redrawMovieWorld();
+}
+
+void Caldoria4DSystem::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (input.downButtonAnyDown())
+ return;
+ if (input.anyDirectionInput())
+ shutDown4DSystem();
+ else
+ GameInteraction::handleInput(input, cursorSpot);
+}
+
+void Caldoria4DSystem::activateHotspots() {
+ GameInteraction::activateHotspots();
+ if (_whichMenu == k4DAudioMenu)
+ g_allHotspots.activateOneHotspot(kCa4DChoice4SpotID);
+}
+
+void Caldoria4DSystem::clickInHotspot(const Input &input, const Hotspot *spot) {
+ switch (spot->getObjectID()) {
+ case kCa4DVisualSpotID:
+ if (_whichMenu == k4DAudioMenu) {
+ _whichMenu = k4DVideoMenu;
+ setSpritesMovie();
+ }
+ break;
+ case kCa4DAudioSpotID:
+ if (_whichMenu == k4DVideoMenu) {
+ _whichMenu = k4DAudioMenu;
+ setSpritesMovie();
+ }
+ break;
+ case kCa4DChoice1SpotID:
+ if (_whichMenu == k4DVideoMenu)
+ makeIslandChoice();
+ else if (_whichMenu == k4DAudioMenu)
+ makeRockChoice();
+ break;
+ case kCa4DChoice2SpotID:
+ if (_whichMenu == k4DVideoMenu)
+ makeDesertChoice();
+ else if (_whichMenu == k4DAudioMenu)
+ makeOrchestralChoice();
+ break;
+ case kCa4DChoice3SpotID:
+ if (_whichMenu == k4DVideoMenu)
+ makeMountainChoice();
+ else if (_whichMenu == k4DAudioMenu)
+ makeRhythmsChoice();
+ break;
+ case kCa4DChoice4SpotID:
+ if (_whichMenu == k4DAudioMenu)
+ makeAcousticChoice();
+ else
+ _owner->playSpotSoundSync(kCaldoria4DBlankChoiceIn, kCaldoria4DBlankChoiceOut);
+ break;
+ default:
+ GameInteraction::clickInHotspot(input, spot);
+ }
+}
+
+void Caldoria4DSystem::receiveNotification(Notification *, const NotificationFlags) {
+ if (_whichMenu == k4DShuttingDown) {
+ _owner->requestDeleteCurrentInteraction();
+ } else {
+ uint32 extraID;
+
+ switch (_videoChoice) {
+ case k4DIslandChoice:
+ extraID = k4DIslandLoop;
+ break;
+ case k4DDesertChoice:
+ extraID = k4DDesertLoop;
+ break;
+ case k4DMountainChoice:
+ extraID = k4DMountainLoop;
+ break;
+ default:
+ extraID = 0xffffffff;
+ break;
+ }
+
+ if (extraID != 0xffffffff)
+ loopExtra(extraID);
+ }
+}
+
+void Caldoria4DSystem::makeIslandChoice() {
+ if (_videoChoice != k4DIslandChoice && _clickedHotspotID == kNoHotSpotID)
+ _clickedHotspotID = kCa4DChoice1SpotID;
+}
+
+void Caldoria4DSystem::makeDesertChoice() {
+ if (_videoChoice != k4DDesertChoice && _clickedHotspotID == kNoHotSpotID)
+ _clickedHotspotID = kCa4DChoice2SpotID;
+}
+
+void Caldoria4DSystem::makeMountainChoice() {
+ if (_videoChoice != k4DMountainChoice && _clickedHotspotID == kNoHotSpotID)
+ _clickedHotspotID = kCa4DChoice3SpotID;
+}
+
+void Caldoria4DSystem::makeRockChoice() {
+ if (_audioChoice != k4DRockChoice) {
+ _audioChoice = k4DRockChoice;
+ setSpritesMovie();
+ _owner->loadLoopSound1("Sounds/Caldoria/Rock.aiff");
+ }
+}
+
+void Caldoria4DSystem::makeOrchestralChoice() {
+ if (_audioChoice != k4DOrchestralChoice) {
+ _audioChoice = k4DOrchestralChoice;
+ setSpritesMovie();
+ _owner->loadLoopSound1("Sounds/Caldoria/Orchestral.aiff");
+ }
+}
+
+void Caldoria4DSystem::makeRhythmsChoice() {
+ if (_audioChoice != k4DRhythmsChoice) {
+ _audioChoice = k4DRhythmsChoice;
+ setSpritesMovie();
+ _owner->loadLoopSound1("Sounds/Caldoria/Rhythms.aiff");
+ }
+}
+
+void Caldoria4DSystem::makeAcousticChoice() {
+ if (_audioChoice != k4DAcousticChoice) {
+ _audioChoice = k4DAcousticChoice;
+ setSpritesMovie();
+ _owner->loadLoopSound1("Sounds/Caldoria/Acoustic.aiff");
+ }
+}
+
+void Caldoria4DSystem::shutDown4DSystem() {
+ _whichMenu = k4DShuttingDown;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.h b/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.h
new file mode 100644
index 0000000000..1c5fa44b90
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.h
@@ -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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIA4DSYSTEM_H
+#define PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIA4DSYSTEM_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class Neighborhood;
+
+class Caldoria4DSystem : public GameInteraction, private Idler, public NotificationReceiver {
+public:
+ Caldoria4DSystem(Neighborhood *);
+ virtual ~Caldoria4DSystem();
+
+ void shutDown4DSystem();
+
+protected:
+ void openInteraction();
+ void initInteraction();
+ void closeInteraction();
+
+ void handleInput(const Input &, const Hotspot *);
+ void activateHotspots();
+ void clickInHotspot(const Input &, const Hotspot *);
+ void receiveNotification(Notification *, const NotificationFlags);
+ void setSpritesMovie();
+ void makeIslandChoice();
+ void makeRockChoice();
+ void makeMountainChoice();
+ void makeOrchestralChoice();
+ void makeDesertChoice();
+ void makeRhythmsChoice();
+ void makeAcousticChoice();
+
+ void useIdleTime();
+ void loopExtra(const ExtraID);
+
+ Movie _4DSpritesMovie;
+ TimeScale _4DSpritesScale;
+ uint _whichMenu;
+ uint _videoChoice;
+ uint _audioChoice;
+ Notification *_neighborhoodNotification;
+ TimeValue _loopStart;
+ HotSpotID _clickedHotspotID;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
new file mode 100644
index 0000000000..abf34d3863
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
@@ -0,0 +1,1442 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/caldoria/caldoriabomb.h"
+
+namespace Pegasus {
+
+// Bomb game PICTs:
+
+static const uint16 kYellowBombPICTBaseID = 700;
+static const uint16 kRedBombPICTBaseID = 709;
+static const uint16 kTimerLeftPICTID = 718;
+static const uint16 kTimerRightPICTID = 719;
+
+static const uint32 kFlashOnTime = 20;
+static const uint32 kFlashOffTime = 10;
+
+static const uint32 kOnTime1 = kFlashOnTime;
+static const uint32 kOffTime1 = kOnTime1 + kFlashOffTime;
+static const uint32 kOnTime2 = kOffTime1 + kFlashOnTime;
+static const uint32 kOffTime2 = kOnTime2 + kFlashOffTime;
+static const uint32 kOnTime3 = kOffTime2 + kFlashOnTime;
+static const uint32 kOffTime3 = kOnTime3 + kFlashOffTime;
+static const uint32 kOnTime4 = kOffTime3 + kFlashOnTime;
+
+static const HotSpotID kVertextHotSpotBaseID = 10000;
+
+static const CoordType kVertextHotSpotWidth = 24;
+static const CoordType kVertextHotSpotHeight = 24;
+
+static const NotificationFlags kBombTimerExpiredFlag = 1;
+
+static const VertexType kBombLevelOne[] = {
+ 0, 1, 0, 1, 0, // hot vertices first.
+ 1, 1, 0, 1, 1,
+ 1, 1, 0, 1, 0,
+ 1, 1, 0, 1, 1,
+ 0, 1, 0, 1, 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,
+
+ 9, // 9 edges in this level
+
+ kEdgeOneFourth,
+ 3,
+ 1, 2, 3,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 5,
+ 5, 6, 7, 8, 9,
+ 0, 0, 0, 0,
+
+ kEdgeOneFourth,
+ 4,
+ 10, 11, 12, 13,
+ 0, 0, 0,
+
+ kEdgeOneFourth,
+ 5,
+ 15, 16, 17, 18, 19,
+ 0, 0, 0, 0,
+
+ kEdgeOneFourth,
+ 3,
+ 21, 22, 23,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 5, 10, 15,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 5,
+ 1, 6, 11, 16, 21,
+ 0, 0, 0, 0,
+
+ kEdgeOneHalf,
+ 5,
+ 3, 8, 13, 18, 23,
+ 0, 0, 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 9, 14, 19,
+ 0, 0
+};
+
+static const VertexType kBombLevelTwo[] = {
+ 0, 1, 0, 1, 0,
+ 1, 1, 1, 0, 1,
+ 0, 0, 0, 1, 0,
+ 1, 1, 1, 0, 1,
+ 0, 1, 0, 1, 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,
+
+ 15,
+
+ kEdgeOneEighth,
+ 2,
+ 5, 1,
+ 0,
+
+ kEdgeOneEighth,
+ 3,
+ 17, 13, 9,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 2,
+ 23, 19,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 3, 9,
+ 0,
+
+ kEdgeThreeEighths,
+ 3,
+ 7, 13, 19,
+ 0, 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 15, 21,
+ 0,
+
+ kEdgeOneFourth,
+ 3,
+ 1, 2, 3,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 4,
+ 6, 7, 8, 9,
+ 0, 0, 0,
+
+ kEdgeOneFourth,
+ 4,
+ 16, 17, 18, 19,
+ 0, 0, 0,
+
+ kEdgeOneFourth,
+ 3,
+ 21, 22, 23,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 5, 10, 15,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 2,
+ 1, 6,
+ 0,
+
+ kEdgeOneHalf,
+ 3,
+ 7, 12, 17,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 9, 14, 19,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 2,
+ 16, 21,
+ 0
+};
+
+static const VertexType kBombLevelThree[] = {
+ 0, 1, 0, 1, 0,
+ 1, 1, 1, 1, 1,
+ 0, 1, 1, 0, 0,
+ 1, 1, 1, 1, 1,
+ 0, 1, 0, 1, 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,
+
+ 22,
+
+ kEdgeThreeSixteenths,
+ 3,
+ 15, 12, 9,
+ 0, 0,
+
+ kEdgeFiveSixteenths,
+ 3,
+ 5, 12, 19,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 2,
+ 5, 1,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 7, 3,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 15, 11,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 21, 17,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 23, 19,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 1, 7,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 3, 9,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 5, 11,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 15, 21,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 17, 23,
+ 0,
+
+ kEdgeOneFourth,
+ 3,
+ 1, 2, 3,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 2,
+ 5, 6,
+ 0,
+
+ kEdgeOneFourth,
+ 2,
+ 8, 9,
+ 0,
+
+ kEdgeOneFourth,
+ 2,
+ 15, 16,
+ 0,
+
+ kEdgeOneFourth,
+ 2,
+ 18, 19,
+ 0,
+
+ kEdgeOneFourth,
+ 3,
+ 21, 22, 23,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 2,
+ 1, 6,
+ 0,
+
+ kEdgeOneHalf,
+ 2,
+ 3, 8,
+ 0,
+
+ kEdgeOneHalf,
+ 2,
+ 16, 21,
+ 0,
+
+ kEdgeOneHalf,
+ 2,
+ 18, 23,
+ 0
+};
+
+static const VertexType kBombLevelFour[] = {
+ 1, 1, 1, 1, 0,
+ 1, 1, 0, 1, 1,
+ 1, 0, 1, 0, 1,
+ 1, 1, 0, 1, 1,
+ 0, 1, 1, 1, 1,
+
+ 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,
+
+ kEdgeOneEighth,
+ 2,
+ 5, 1,
+ 0,
+
+ kEdgeOneEighth,
+ 3,
+ 10, 6, 2,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 3,
+ 16, 12, 8,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 3,
+ 22, 18, 14,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 2,
+ 23, 19,
+ 0,
+
+ kEdgeThreeEighths,
+ 3,
+ 2, 8, 14,
+ 0, 0,
+
+ kEdgeThreeEighths,
+ 3,
+ 10, 16, 22,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 4,
+ 0, 1, 2, 3,
+ 0, 0, 0,
+
+ kEdgeOneFourth,
+ 2,
+ 5, 6,
+ 0,
+
+ kEdgeOneFourth,
+ 2,
+ 8, 9,
+ 0,
+
+ kEdgeOneFourth,
+ 2,
+ 15, 16,
+ 0,
+
+ kEdgeOneFourth,
+ 2,
+ 18, 19,
+ 0,
+
+ kEdgeOneFourth,
+ 4,
+ 21, 22, 23, 24,
+ 0, 0, 0,
+
+ kEdgeOneHalf,
+ 4,
+ 0, 5, 10, 15,
+ 0, 0, 0,
+
+ kEdgeOneHalf,
+ 2,
+ 1, 6,
+ 0,
+
+ kEdgeOneHalf,
+ 2,
+ 3, 8,
+ 0,
+
+ kEdgeOneHalf,
+ 4,
+ 9, 14, 19, 24,
+ 0, 0, 0,
+
+ kEdgeOneHalf,
+ 2,
+ 16, 21,
+ 0,
+
+ kEdgeOneHalf,
+ 2,
+ 18, 23,
+ 0
+};
+
+static const VertexType kBombLevelFive[] = {
+ 0, 1, 0, 1, 0,
+ 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1,
+ 0, 1, 0, 1, 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,
+
+ kEdgeOneEighth,
+ 2,
+ 5, 1,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 7, 3,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 13, 9,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 15, 11,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 21, 17,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 23, 19,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 1, 7,
+ 0,
+
+ kEdgeThreeEighths,
+ 4,
+ 5, 11, 17, 23,
+ 0, 0, 0,
+
+ kEdgeThreeEighths,
+ 3,
+ 6, 12, 18,
+ 0, 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 13, 19,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 15, 21,
+ 0,
+
+ kEdgeOneFourth,
+ 5,
+ 5, 6, 7, 8, 9,
+ 0, 0, 0, 0,
+
+ kEdgeOneFourth,
+ 3,
+ 15, 16, 17,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 2,
+ 18, 19,
+ 0,
+
+ kEdgeOneFourth,
+ 3,
+ 21, 22, 23,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 5, 10, 15,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 2,
+ 1, 6,
+ 0,
+
+ kEdgeOneHalf,
+ 3,
+ 11, 16, 21,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 5,
+ 3, 8, 13, 18, 23,
+ 0, 0, 0, 0
+};
+
+static const VertexType kBombLevelSix[] = {
+ 0, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 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,
+
+ 25,
+
+ kEdgeOneSixteenth,
+ 2,
+ 10, 1,
+ 0,
+
+ kEdgeOneSixteenth,
+ 2,
+ 23, 14,
+ 0,
+
+ kEdgeSevenSixteenths,
+ 2,
+ 3, 14,
+ 0,
+
+ kEdgeSevenSixteenths,
+ 2,
+ 10, 21,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 5, 1,
+ 0,
+
+ kEdgeOneEighth,
+ 3,
+ 10, 6, 2,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 2,
+ 7, 3,
+ 0,
+
+ kEdgeOneEighth,
+ 2,
+ 21, 17,
+ 0,
+
+ kEdgeOneEighth,
+ 3,
+ 22, 18, 14,
+ 0, 0,
+
+ kEdgeOneEighth,
+ 2,
+ 23, 19,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 1, 7,
+ 0,
+
+ kEdgeThreeEighths,
+ 3,
+ 2, 8, 14,
+ 0, 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 3, 9,
+ 0,
+
+ kEdgeThreeEighths,
+ 3,
+ 10, 16, 22,
+ 0, 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 15, 21,
+ 0,
+
+ kEdgeThreeEighths,
+ 2,
+ 17, 23,
+ 0,
+
+ kEdgeOneFourth,
+ 3,
+ 1, 2, 3,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 3,
+ 6, 7, 8,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 3,
+ 16, 17, 18,
+ 0, 0,
+
+ kEdgeOneFourth,
+ 3,
+ 21, 22, 23,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 5, 10, 15,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 6, 11, 16,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 5,
+ 2, 7, 12, 17, 22,
+ 0, 0, 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 8, 13, 18,
+ 0, 0,
+
+ kEdgeOneHalf,
+ 3,
+ 9, 14, 19,
+ 0, 0
+};
+
+static const CoordType kBombGridWidth = 140;
+static const CoordType kBombGridHeight = 140;
+
+static const CoordType kDotOriginX = 0;
+static const CoordType kDotOriginY = 0;
+
+static const CoordType kVertOriginX = 2;
+static const CoordType kVertOriginY = 6;
+
+static const CoordType kHorizOriginX = 6;
+static const CoordType kHorizOriginY = 2;
+
+static const CoordType kDiagOriginX = 6;
+static const CoordType kDiagOriginY = 6;
+
+static const int g_originsX[] = {
+ kDiagOriginX,
+ kDiagOriginX,
+ kDiagOriginX,
+ kHorizOriginX,
+ kDiagOriginX,
+ kDiagOriginX,
+ kDiagOriginX,
+ kVertOriginX
+};
+
+static const int g_originsY[] = {
+ kDiagOriginY - 64,
+ kDiagOriginY - 32,
+ kDiagOriginY - 32,
+ kHorizOriginY,
+ kDiagOriginY,
+ kDiagOriginY,
+ kDiagOriginY,
+ kVertOriginY
+};
+
+struct HotVerticesList {
+ int numHotVerts;
+ VertexType hotVerts[25];
+};
+
+CoordType vertToX(VertexType vertex) {
+ return (vertex % 5) * 32;
+}
+
+CoordType vertToY(VertexType vertex) {
+ return (vertex / 5) * 32;
+}
+
+// This function returns the number of edges in the bomb edge list.
+VertexType getNumEdges(BombEdgeList edges) {
+ return edges[50];
+}
+
+// These four functions return pointers into the given edge list.
+
+// getFirstEdge and getNextEdge can be used to iterate across all edges
+// in an edge list. These functions can be used to walk all the edges
+// in a bomb edge list for drawing.
+VertexType *getFirstEdge(BombEdgeList edges) {
+ return &edges[51];
+}
+
+VertexType *getNextEdge(VertexType *anEdge) {
+ return anEdge + *(anEdge + 1) * 2 + 1;
+}
+
+// getVertices returns a pointer to all of the vertices that should are
+// hot. These vertices indicate all the vertices that should be drawn in
+// the game.
+VertexType *getVertices(BombEdgeList edges) {
+ return &edges[0];
+}
+
+// getUsedVertices returns a pointer to the "used" vertices area: the
+// area that keeps track of which vertices have been set by the
+// setVertexUsed used function.
+VertexType *getUsedVertices(BombEdgeList edges) {
+ return &edges[25];
+}
+
+// Useful for saving. Saving the state of the bomb game is as simple as writing
+// out the edge list.
+int getEdgeListSize(BombEdgeList edges) {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+
+ while (numEdges--)
+ anEdge = getNextEdge(anEdge);
+
+ return anEdge - edges + 4;
+}
+
+// Returns true if the given vertex lies on the given edge.
+bool vertexOnEdge(VertexType *anEdge, VertexType whichVertex) {
+ VertexType numVerts = *++anEdge;
+
+ while (numVerts--)
+ if (*++anEdge == whichVertex)
+ return true;
+
+ return false;
+}
+
+// Given an edge list and a from vertex, this function constructs a list
+// of all vertices that may be clicked on.
+// if fromVertex == -1, all vertices are eligible.
+// otherwise, only vertices on a line from fromVertex are eligible.
+void makeHotVertexList(BombEdgeList edges, VertexType fromVertex, HotVerticesList &hotVertices) {
+ hotVertices.numHotVerts = 0;
+
+ if (fromVertex == -1) {
+ for (VertexType i = 0; i < 25; i++)
+ if (edges[i])
+ hotVertices.hotVerts[hotVertices.numHotVerts++] = i;
+ } else {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+ hotVertices.hotVerts[hotVertices.numHotVerts++] = fromVertex;
+
+ while (numEdges--) {
+ if (vertexOnEdge(anEdge, fromVertex)) {
+ VertexType *p = anEdge + 1;
+ VertexType numVerts = *p;
+
+ while (numVerts--)
+ if (*++p != fromVertex)
+ hotVertices.hotVerts[hotVertices.numHotVerts++] = *p;
+ }
+
+ anEdge = getNextEdge(anEdge);
+ }
+ }
+}
+
+// Set all edges in the edge list to the value passed in "edgeVal".
+// For drawing purposes, 0 can mean don't draw, and 1 and higher can
+// represent different colors.
+void setAllEdgesUsed(BombEdgeList edges, VertexType used) {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+
+ while (numEdges--) {
+ VertexType *p1 = anEdge + 1;
+ VertexType numVerts = *p1;
+ p1 += numVerts + 1;
+
+ while (--numVerts)
+ *p1++ = used;
+
+ anEdge = getNextEdge(anEdge);
+ }
+
+ VertexType *p1 = edges;
+ VertexType *p2 = getUsedVertices(edges);
+
+ for (VertexType i = 0; i < 25; i++, p1++, p2++)
+ if (*p1)
+ *p2 = used;
+}
+
+// Same as setAllEdgesUsed, but only affects edges that are already set
+// to a non-zero value.
+void setAllUsedEdgesUsed(BombEdgeList edges, VertexType used) {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+
+ while (numEdges--) {
+ VertexType *p = anEdge + 1;
+ VertexType numVerts = *p;
+ p += numVerts + 1;
+
+ while (--numVerts) {
+ if (*p)
+ *p = used;
+ ++p;
+ }
+
+ anEdge = getNextEdge(anEdge);
+ }
+
+ VertexType *p = getUsedVertices(edges);
+ for (VertexType i = 0; i < 25; i++, p++)
+ if (*p)
+ *p = used;
+}
+
+// Replace all edges with value "value" with the new value "used".
+void replaceUsedEdges(BombEdgeList edges, VertexType value, VertexType used) {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+
+ while (numEdges--) {
+ VertexType *p = anEdge + 1;
+ VertexType numVerts = *p;
+ p += numVerts + 1;
+
+ while (--numVerts) {
+ if (*p == value)
+ *p = used;
+
+ p++;
+ }
+
+ anEdge = getNextEdge(anEdge);
+ }
+
+ VertexType *p = getUsedVertices(edges);
+ for (VertexType i = 0; i < 25; i++, p++)
+ if (*p == value)
+ *p = used;
+}
+
+// Set a vertex's value to "used".
+void setVertexUsed(BombEdgeList edges, VertexType whichVertex, VertexType value) {
+ *(getUsedVertices(edges) + whichVertex) = value;
+}
+
+// Mark an edge in the given list between the two vertices as "used". This marks
+// all inbetween vertices as well, even if the vertex is not marked as a "hot"
+// vertex in the hot vertex section. Returns true if doing this operation
+// crosses an already marked edge.
+bool setEdgeUsed(BombEdgeList edges, VertexType fromVertex, VertexType toVertex) {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+ bool crossed = false;
+
+ while (numEdges--) {
+ VertexType *p = anEdge;
+ VertexType numVerts = *++p;
+ VertexType *fromPtr = 0;
+ VertexType *toPtr = 0;
+ VertexType i = numVerts;
+ p++;
+
+ while (i--) {
+ if (*p == fromVertex)
+ fromPtr = p;
+ else if (*p == toVertex)
+ toPtr = p;
+
+ if (fromPtr && toPtr) {
+ // Found the edge...
+ if (fromPtr > toPtr) {
+ p = fromPtr;
+ fromPtr = toPtr;
+ toPtr = p;
+ }
+
+ p = fromPtr + numVerts;
+
+ for (i = toPtr - fromPtr; i > 0; i--, p++) {
+ ++(*p);
+
+ if (*p == 2)
+ crossed = true;
+ }
+
+ VertexType *verts = getVertices(edges);
+ VertexType *usedVerts = getUsedVertices(edges);
+ *(usedVerts + *fromPtr) = 1;
+
+ for (p = fromPtr + 1; p != toPtr; p++)
+ if (*(verts + *p))
+ *(usedVerts + *p) = 1;
+
+ *(usedVerts + *toPtr) = 1;
+ return crossed;
+ }
+
+ p++;
+ }
+
+ anEdge = getNextEdge(anEdge);
+ }
+
+ return false;
+}
+
+// Return true if all edges are used. Can be used to determine when the bomb
+// game is over.
+bool allEdgesUsed(BombEdgeList edges) {
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+
+ while (numEdges--) {
+ VertexType *p = anEdge + 1;
+ VertexType numVerts = *p;
+ p += numVerts + 1;
+
+ while (--numVerts) {
+ if (!*p)
+ return false;
+
+ ++p;
+ }
+
+ anEdge = getNextEdge(anEdge);
+ }
+
+ return true;
+}
+
+BombGrid::BombGrid(const DisplayElementID id) : Picture(id) {
+ Common::Rect bounds(0, 0, kBombGridWidth, kBombGridHeight);
+
+ allocateSurface(bounds);
+ setBounds(bounds);
+ _surface->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
+
+ _transparent = true;
+
+ _yellowDot.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID, true);
+ _yellowOneSixteenth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 1, true);
+ _yellowOneEighth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 2, true);
+ _yellowThreeSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 3, true);
+ _yellowOneFourth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 4, true);
+ _yellowFiveSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 5, true);
+ _yellowThreeEighths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 6, true);
+ _yellowSevenSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 7, true);
+ _yellowOneHalf.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 8, true);
+
+ _redDot.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID, true);
+ _redOneSixteenth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 1, true);
+ _redOneEighth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 2, true);
+ _redThreeSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 3, true);
+ _redOneFourth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 4, true);
+ _redFiveSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 5, true);
+ _redThreeEighths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 6, true);
+ _redSevenSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 7, true);
+ _redOneHalf.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 8, true);
+}
+
+void BombGrid::drawEdges(BombEdgeList edges) {
+ GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ gfx->setCurSurface(_surface);
+
+ _surface->fillRect(Common::Rect(0, 0, kBombGridWidth, kBombGridHeight), g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
+
+ Frame *yellowStuff = &_yellowDot;
+ Frame *redStuff = &_redDot;
+ VertexType numEdges = getNumEdges(edges);
+ VertexType *anEdge = getFirstEdge(edges);
+ VertexType i, *p;
+
+ Common::Rect bounds;
+ getSurfaceBounds(bounds);
+
+ while (numEdges--) {
+ p = anEdge;
+ VertexType edgeDirection = *p++;
+ VertexType numVerts = *p++;
+ VertexType numSegs = numVerts - 1;
+
+ for (i = 0; i < numSegs; i++, p++) {
+ if (*(p + numVerts) > 0 && *(p + numVerts) < 4) {
+ Frame *drawStuff;
+
+ if (*(p + numVerts) == 2)
+ drawStuff = redStuff;
+ else
+ drawStuff = yellowStuff;
+
+ int x = vertToX(*p) + g_originsX[edgeDirection];
+ int y = vertToY(*p) + g_originsY[edgeDirection];
+
+ Common::Rect r1;
+ drawStuff[edgeDirection + 1].getSurfaceBounds(r1);
+ Common::Rect r2 = r1;
+ r2.moveTo(x, y);
+ drawStuff[edgeDirection + 1].drawImage(r1, r2);
+ }
+ }
+
+ anEdge = getNextEdge(anEdge);
+ }
+
+ for (i = 0, p = getUsedVertices(edges); i < 25; i++, p++) {
+ if (*p > 0 && *p < 4) {
+ Frame *drawStuff;
+
+ if (*p == 2)
+ drawStuff = redStuff;
+ else
+ drawStuff = yellowStuff;
+
+ int x = vertToX(i) + kDotOriginX;
+ int y = vertToY(i) + kDotOriginY;
+
+ Common::Rect r1;
+ drawStuff->getSurfaceBounds(r1);
+ Common::Rect r2 = r1;
+ r2.moveTo(x, y);
+ drawStuff->drawImage(r1, r2);
+ }
+ }
+
+ triggerRedraw();
+ gfx->setCurSurface(gfx->getWorkArea());
+}
+
+BombTimer::BombTimer(const DisplayElementID id) : IdlerAnimation(id) {
+ _middle = -1;
+ _leftImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTimerLeftPICTID);
+ _rightImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTimerRightPICTID);
+
+ Common::Rect r;
+ _leftImage.getSurfaceBounds(r);
+ setBounds(r);
+}
+
+void BombTimer::draw(const Common::Rect &updateRect) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ Common::Rect r1 = bounds;
+ r1.right = _middle;
+ r1 = r1.findIntersectingRect(updateRect);
+
+ if (!r1.isEmpty()) {
+ Common::Rect r2 = r1;
+ r2.moveTo(r1.left - bounds.left, r1.top - bounds.top);
+ _leftImage.copyToCurrentPort(r2, r1);
+ }
+
+ r1 = bounds;
+ r1.left = _middle;
+ r1 = r1.findIntersectingRect(updateRect);
+
+ if (!r1.isEmpty()) {
+ Common::Rect r2 = r1;
+ r2.moveTo(r1.left - bounds.left, r1.top - bounds.top);
+ _rightImage.copyToCurrentPort(r2, r1);
+ }
+}
+
+void BombTimer::timeChanged(const TimeValue newTime) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ int newMiddle = bounds.right - bounds.width() * newTime / getDuration();
+ if (newMiddle != _middle) {
+ _middle = newMiddle;
+ triggerRedraw();
+ }
+}
+
+#define CREATE_BOMB_LEVEL(num, data) \
+ _bombLevel[num] = new VertexType[sizeof(data)]; \
+ memcpy(_bombLevel[num], data, sizeof(data))
+
+CaldoriaBomb::CaldoriaBomb(Neighborhood *owner, NotificationManager *manager) :
+ GameInteraction(kCaldoriaBombInteractionID, owner), _grid(kCaldoriaBombGridID),
+ _timer(kCaldoriaBombTimerID), _timerNotification(kCaldoriaBombTimerNotificationID, manager) {
+ CREATE_BOMB_LEVEL(0, kBombLevelOne);
+ CREATE_BOMB_LEVEL(1, kBombLevelTwo);
+ CREATE_BOMB_LEVEL(2, kBombLevelThree);
+ CREATE_BOMB_LEVEL(3, kBombLevelFour);
+ CREATE_BOMB_LEVEL(4, kBombLevelFive);
+ CREATE_BOMB_LEVEL(5, kBombLevelSix);
+ _currentLevel = 0;
+}
+
+#undef CREATE_BOMB_LEVEL
+
+CaldoriaBomb::~CaldoriaBomb() {
+ for (int i = 0; i < 6; i++)
+ delete[] _bombLevel[i];
+}
+
+void CaldoriaBomb::openInteraction() {
+ _grid.moveElementTo(kCaldoriaBombGridLeft, kCaldoriaBombGridTop);
+ _grid.setDisplayOrder(kCaldoriaBombGridOrder);
+ _grid.startDisplaying();
+
+ _timer.moveElementTo(kCaldoriaBombTimerLeft, kCaldoriaBombTimerTop);
+ _timer.setDisplayOrder(kCaldoriaBombTimerOrder);
+ _timer.startDisplaying();
+ _timer.setSegment(0, kTenMinutesPerFifteenTicks, kFifteenTicksPerSecond);
+ _timer.setTime(0);
+
+ _timerNotification.notifyMe(this, kBombTimerExpiredFlag, kBombTimerExpiredFlag);
+ _timerCallBack.setNotification(&_timerNotification);
+ _timerCallBack.initCallBack(&_timer, kCallBackAtExtremes);
+ _timerCallBack.setCallBackFlag(kBombTimerExpiredFlag);
+
+ Common::Rect r(0, 0, kVertextHotSpotWidth, kVertextHotSpotHeight);
+
+ for (VertexType i = 0; i < 25; i++) {
+ _vertexHotspot[i] = new Hotspot(i + kVertextHotSpotBaseID);
+ r.moveTo(vertToX(i) + kCaldoriaBombGridLeft - kVertextHotSpotWidth / 2 + 6,
+ vertToY(i) + kCaldoriaBombGridTop - kVertextHotSpotHeight / 2 + 6);
+ _vertexHotspot[i]->setArea(r);
+ _vertexHotspot[i]->setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ g_allHotspots.push_back(_vertexHotspot[i]);
+ }
+
+ _neighborhoodNotification = _owner->getNeighborhoodNotification();
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag, kExtraCompletedFlag);
+}
+
+void CaldoriaBomb::initInteraction() {
+ _owner->loadLoopSound1("");
+ _owner->startExtraSequence(kCaldoria56BombStage1, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void CaldoriaBomb::closeInteraction() {
+ _timer.stop();
+ _timer.hide();
+ _timer.stopDisplaying();
+ _grid.hide();
+ _grid.stopDisplaying();
+
+ // The original did not do this, but we need it here
+ // Not sure why the original worked without this; probably
+ // related to the way the List code worked in CodeWarrior.
+ // If this is not here, the notifications will later attempt
+ // to remove itself from this receiver causing a very nasty
+ // crash.
+ _timerNotification.cancelNotification(this);
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void CaldoriaBomb::startBombAmbient(Common::String ambient) {
+ _owner->loadLoopSound1(ambient);
+}
+
+void CaldoriaBomb::receiveNotification(Notification *notification, const NotificationFlags) {
+ if (notification == _neighborhoodNotification) {
+ switch (_owner->getLastExtra()) {
+ case kCaldoria56BombStage1:
+ _grid.show();
+ _timer.show();
+ _timerCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _timer.start();
+ _currentLevel = 0;
+ _lastVertex = -1;
+ startBombAmbient("Sounds/Caldoria/BmbLoop1.22K.AIFF");
+ break;
+ case kCaldoria56BombStage2:
+ case kCaldoria56BombStage3:
+ case kCaldoria56BombStage4:
+ case kCaldoria56BombStage5:
+ case kCaldoria56BombStage6:
+ _grid.show();
+ _currentLevel++;
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -1;
+ startBombAmbient(Common::String::format("Sounds/Caldoria/BmbLoop%d.22K.AIFF", _owner->getLastExtra() - kCaldoria56BombStage1 + 1));
+ break;
+ case kCaldoria56BombStage7:
+ _owner->requestDeleteCurrentInteraction();
+ GameState.setCaldoriaBombDisarmed(true);
+ GameState.setScoringDisarmedNuke(true);
+ _owner->loadAmbientLoops();
+ break;
+ }
+ } else if (notification == &_timerNotification) {
+ _grid.hide();
+ _timer.stop();
+ _timer.hide();
+ _owner->loadLoopSound1("");
+ _owner->playDeathExtra(kCaldoria56BombExplodes, kDeathNuclearExplosion);
+ }
+}
+
+void CaldoriaBomb::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ if (_currentLevel != -1 && _lastVertex >= -1) {
+ HotVerticesList hotVertices;
+ makeHotVertexList(_bombLevel[_currentLevel], _lastVertex, hotVertices);
+
+ for (VertexType i = 0; i < hotVertices.numHotVerts; i++)
+ g_allHotspots.activateOneHotspot(hotVertices.hotVerts[i] + kVertextHotSpotBaseID);
+ }
+}
+
+void CaldoriaBomb::clickInHotspot(const Input &input, const Hotspot *hotspot) {
+ int clickedVertex = (int)hotspot->getObjectID() - (int)kVertextHotSpotBaseID;
+
+ if (clickedVertex >= 0 && clickedVertex < 25) {
+ if (_lastVertex != -1 && setEdgeUsed(_bombLevel[_currentLevel], _lastVertex, clickedVertex)) {
+ clickedVertex = -2;
+ _flashTime = tickCount();
+ } else if (allEdgesUsed(_bombLevel[_currentLevel])) {
+ setVertexUsed(_bombLevel[_currentLevel], clickedVertex, 1);
+ clickedVertex = -20;
+ _flashTime = tickCount();
+ } else {
+ setVertexUsed(_bombLevel[_currentLevel], clickedVertex, 2);
+ }
+
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = clickedVertex;
+ } else {
+ GameInteraction::clickInHotspot(input, hotspot);
+ }
+}
+
+InputBits CaldoriaBomb::getInputFilter() {
+ // Disallow arrow buttons.
+ return GameInteraction::getInputFilter() & kFilterAllButtons;
+}
+
+void CaldoriaBomb::handleInput(const Input &input, const Hotspot *hotspot) {
+ GameInteraction::handleInput(input, hotspot);
+
+ switch (_lastVertex) {
+ case -2: // Flash back to yellow.
+ if (tickCount() > _flashTime + kOnTime1) {
+ replaceUsedEdges(_bombLevel[_currentLevel], 2, 3);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -3;
+ }
+ break;
+ case -3: // Flash back to red.
+ if (tickCount() > _flashTime + kOffTime1) {
+ replaceUsedEdges(_bombLevel[_currentLevel], 3, 2);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -4;
+ }
+ break;
+ case -4: // Flash all to yellow.
+ if (tickCount() > _flashTime + kOnTime2) {
+ setAllUsedEdgesUsed(_bombLevel[_currentLevel], 1);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -5;
+ }
+ break;
+ case -5: // Flash all to red.
+ if (tickCount() > _flashTime + kOffTime2) {
+ setAllUsedEdgesUsed(_bombLevel[_currentLevel], 2);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -6;
+ }
+ break;
+ case -6: // Flash all to yellow.
+ if (tickCount() > _flashTime + kOnTime3) {
+ setAllUsedEdgesUsed(_bombLevel[_currentLevel], 1);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -7;
+ }
+ break;
+ case -7: // Flash all to red.
+ if (tickCount() > _flashTime + kOffTime3) {
+ setAllUsedEdgesUsed(_bombLevel[_currentLevel], 2);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -8;
+ }
+ break;
+ case -8: // Restore to normal.
+ if (tickCount() > _flashTime + kOnTime4) {
+ setAllEdgesUsed(_bombLevel[_currentLevel], 0);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -1;
+ }
+ break;
+
+ // Flash grid after success.
+ case -20: // Flash off.
+ if (tickCount() > _flashTime + kOnTime1) {
+ setAllEdgesUsed(_bombLevel[_currentLevel], 4);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -21;
+ }
+ break;
+ case -21: // Flash on.
+ if (tickCount() > _flashTime + kOffTime1) {
+ setAllEdgesUsed(_bombLevel[_currentLevel], 1);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -22;
+ }
+ break;
+ case -22: // Flash off.
+ if (tickCount() > _flashTime + kOnTime2) {
+ setAllEdgesUsed(_bombLevel[_currentLevel], 4);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -23;
+ }
+ break;
+ case -23: // Flash on.
+ if (tickCount() > _flashTime + kOffTime2) {
+ setAllEdgesUsed(_bombLevel[_currentLevel], 1);
+ _grid.drawEdges(_bombLevel[_currentLevel]);
+ _lastVertex = -24;
+ }
+ break;
+ case -24:
+ if (tickCount() > _flashTime + kOnTime3) {
+ _grid.hide();
+ _lastVertex = -1;
+ _owner->loadLoopSound1("");
+
+ switch (_currentLevel) {
+ case 0:
+ _owner->startExtraSequence(kCaldoria56BombStage2, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 1:
+ _owner->startExtraSequence(kCaldoria56BombStage3, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 2:
+ _owner->startExtraSequence(kCaldoria56BombStage4, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 3:
+ _owner->startExtraSequence(kCaldoria56BombStage5, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 4:
+ _owner->startExtraSequence(kCaldoria56BombStage6, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 5:
+ _timer.stop();
+ _grid.hide();
+ _timer.hide();
+ _owner->startExtraSequence(kCaldoria56BombStage7, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ }
+ break;
+ }
+}
+
+long CaldoriaBomb::getNumHints() {
+ return 2;
+}
+
+Common::String CaldoriaBomb::getHintMovie(uint hintNum) {
+ return (hintNum == 1) ? "Images/AI/Caldoria/X56EH2" : "Images/AI/Caldoria/X56EH3";
+}
+
+bool CaldoriaBomb::canSolve() {
+ return true;
+}
+
+void CaldoriaBomb::doSolve() {
+ _timer.stop();
+ _grid.hide();
+ _timer.hide();
+ _owner->loadLoopSound1("");
+ _owner->startExtraSequence(kCaldoria56BombStage7, kExtraCompletedFlag, kFilterNoInput);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h
new file mode 100644
index 0000000000..5bb39b4122
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIABOMB_H
+#define PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIABOMB_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/notification.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+/*
+ Edge list is arranged as follows:
+
+ all values in the edge list are bytes.
+
+ all vertices are numbers between 0 and 24. x coordinate of vertex is vertex % 5,
+ and y coordinate is vertex / 5.
+
+ an edge is
+ a direction code
+ a number of vertices in the edge
+ an array of vertices -- all vertices along the edge, whether or not they're
+ clickable.
+ an array of bools (bytes) indicating that a portion of the edge is
+ traversed (and should be drawn). the number of bools is one less than
+ the number of vertices.
+
+ an edge list is
+ an array of 25 bools indicating which vertex is clickable.
+ an array of 25 bools indicating which vertex is used (drawn).
+ a number of edges
+ an array of edges.
+
+ a hot vertex list is
+ a number of vertices
+ an array of 25 vertices
+
+*/
+
+typedef int8 VertexType;
+typedef VertexType *BombEdgeList;
+
+static const VertexType kEdgeOneSixteenth = 0;
+static const VertexType kEdgeOneEighth = 1;
+static const VertexType kEdgeThreeSixteenths = 2;
+static const VertexType kEdgeOneFourth = 3;
+static const VertexType kEdgeFiveSixteenths = 4;
+static const VertexType kEdgeThreeEighths = 5;
+static const VertexType kEdgeSevenSixteenths = 6;
+static const VertexType kEdgeOneHalf = 7;
+
+class BombTimer : public IdlerAnimation {
+public:
+ BombTimer(const DisplayElementID);
+ virtual ~BombTimer() {}
+
+ void draw(const Common::Rect &);
+
+protected:
+ void timeChanged(const TimeValue);
+
+ int _middle;
+ Surface _leftImage, _rightImage;
+};
+
+class BombGrid : public Picture {
+public:
+ BombGrid(const DisplayElementID);
+ virtual ~BombGrid() {}
+
+ void drawEdges(BombEdgeList);
+
+protected:
+ Frame _yellowDot;
+ Frame _yellowOneSixteenth;
+ Frame _yellowOneEighth;
+ Frame _yellowThreeSixteenths;
+ Frame _yellowOneFourth;
+ Frame _yellowFiveSixteenths;
+ Frame _yellowThreeEighths;
+ Frame _yellowSevenSixteenths;
+ Frame _yellowOneHalf;
+ Frame _redDot;
+ Frame _redOneSixteenth;
+ Frame _redOneEighth;
+ Frame _redThreeSixteenths;
+ Frame _redOneFourth;
+ Frame _redFiveSixteenths;
+ Frame _redThreeEighths;
+ Frame _redSevenSixteenths;
+ Frame _redOneHalf;
+};
+
+class Hotspot;
+
+class CaldoriaBomb : public GameInteraction, public NotificationReceiver {
+public:
+ CaldoriaBomb(Neighborhood *, NotificationManager *);
+ virtual ~CaldoriaBomb();
+
+ long getNumHints();
+ Common::String getHintMovie(uint);
+ void doSolve();
+ bool canSolve();
+
+protected:
+ void openInteraction();
+ void initInteraction();
+ void closeInteraction();
+ void receiveNotification(Notification *, const NotificationFlags);
+ void activateHotspots();
+ void clickInHotspot(const Input &, const Hotspot *);
+ void handleInput(const Input &, const Hotspot *);
+ InputBits getInputFilter();
+ void startBombAmbient(Common::String);
+
+ Notification *_neighborhoodNotification;
+ BombGrid _grid;
+ BombTimer _timer;
+ BombEdgeList _bombLevel[6];
+ int _currentLevel, _flashTime;
+ Hotspot *_vertexHotspot[25];
+ VertexType _lastVertex;
+ Notification _timerNotification;
+ NotificationCallBack _timerCallBack;
+
+ TimeValue _readTime;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
new file mode 100644
index 0000000000..a3ce97d438
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
@@ -0,0 +1,115 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/neighborhood/neighborhood.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/caldoria/caldoriamessages.h"
+
+namespace Pegasus {
+
+static const NotificationFlags kMessageDoneFlag = 1;
+
+CaldoriaMessages::CaldoriaMessages(Neighborhood *owner, const NotificationID id, NotificationManager *manager) :
+ GameInteraction(kCaldoriaMessagesInteractionID, owner), Notification(id, manager), _messageMovie(kCaldoriaMessagesID) {
+}
+
+void CaldoriaMessages::openInteraction() {
+ _neighborhoodNotification = GameInteraction::_owner->getNeighborhoodNotification();
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag, kExtraCompletedFlag);
+ _messageCallBack.setNotification(this);
+ notifyMe(this, kMessageDoneFlag, kMessageDoneFlag);
+ _messageCallBack.setCallBackFlag(kMessageDoneFlag);
+ _messageNumber = 1;
+}
+
+void CaldoriaMessages::initInteraction() {
+ GameInteraction::_owner->startExtraSequence(kCaBedroomVidPhone, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void CaldoriaMessages::closeInteraction() {
+ cancelNotification(this);
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void CaldoriaMessages::receiveNotification(Notification *notification, const NotificationFlags) {
+ if (notification == _neighborhoodNotification) {
+ switch (GameInteraction::_owner->getLastExtra()) {
+ case kCaBedroomVidPhone:
+ GameInteraction::_owner->showExtraView(kCaBedroomMessage1);
+ break;
+ case kCaBedroomMessage1:
+ play1Message(1);
+ break;
+ case kCaBedroomMessage2:
+ play1Message(2);
+ break;
+ }
+ } else {
+ _messageCallBack.releaseCallBack();
+ _messageMovie.releaseMovie();
+
+ uint32 extraID = (_messageNumber == 1) ? kCaBedroomMessage1 : kCaBedroomMessage2;
+ GameInteraction::_owner->showExtraView(extraID);
+ allowInput(true);
+ }
+}
+
+void CaldoriaMessages::clickInHotspot(const Input &input, const Hotspot *spot) {
+ uint32 extraID;
+
+ switch (spot->getObjectID()) {
+ case kCaBedroomVidPhoneActivationSpotID:
+ extraID = (_messageNumber == 1) ? kCaBedroomMessage1 : kCaBedroomMessage2;
+ GameInteraction::_owner->startExtraSequence(extraID, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ GameInteraction::clickInHotspot(input, spot);
+ break;
+ }
+}
+
+void CaldoriaMessages::play1Message(uint messageNumber) {
+ if (messageNumber == 1) {
+ _messageMovie.initFromMovieFile("Images/Caldoria/A12NVA.movie");
+ _messageNumber = 2;
+ } else {
+ _messageMovie.initFromMovieFile("Images/Caldoria/A12NVB.movie");
+ _messageNumber = 1;
+ GameState.setCaldoriaSeenMessages(true);
+ }
+
+ _messageMovie.moveElementTo(kCaldoriaMessageLeft, kCaldoriaMessageTop);
+ _messageMovie.setDisplayOrder(kCaldoriaMessagesOrder);
+ _messageMovie.startDisplaying();
+ _messageCallBack.initCallBack(&_messageMovie, kCallBackAtExtremes);
+ _messageCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ allowInput(false);
+ _messageMovie.show();
+ _messageMovie.redrawMovieWorld();
+ _messageMovie.start();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h
new file mode 100644
index 0000000000..955fe10ce9
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIAMESSAGES_H
+#define PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIAMESSAGES_H
+
+#include "pegasus/input.h"
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class Neighborhood;
+
+class CaldoriaMessages : public GameInteraction, public Notification, public NotificationReceiver {
+public:
+ CaldoriaMessages(Neighborhood *, const NotificationID, NotificationManager *);
+ virtual ~CaldoriaMessages() {}
+
+protected:
+ void openInteraction();
+ void initInteraction();
+ void closeInteraction();
+ void receiveNotification(Notification *, const NotificationFlags);
+ void clickInHotspot(const Input &, const Hotspot *);
+ void play1Message(uint);
+
+ Movie _messageMovie;
+ NotificationCallBack _messageCallBack;
+ Notification *_neighborhoodNotification;
+ uint _messageNumber;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamirror.cpp b/engines/pegasus/neighborhood/caldoria/caldoriamirror.cpp
new file mode 100644
index 0000000000..ff4d1811d0
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamirror.cpp
@@ -0,0 +1,135 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/neighborhood.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/caldoria/caldoriamirror.h"
+
+namespace Pegasus {
+
+CaldoriaMirror::CaldoriaMirror(Neighborhood *owner) : GameInteraction(kCaldoriaMirrorInteractionID, owner) {
+}
+
+void CaldoriaMirror::openInteraction() {
+ _neighborhoodNotification = _owner->getNeighborhoodNotification();
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag, kExtraCompletedFlag);
+}
+
+void CaldoriaMirror::initInteraction() {
+ _owner->setCurrentActivation(kActivateMirrorReady);
+ _owner->startExtraSequence(kCaBathroomGreeting, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void CaldoriaMirror::closeInteraction() {
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void CaldoriaMirror::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_owner->getLastExtra() == (uint32)kCaBathroomAgencyStandard || !input.anyDirectionInput())
+ GameInteraction::handleInput(input, cursorSpot);
+}
+
+void CaldoriaMirror::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ switch (_owner->getLastExtra()) {
+ case kCaBathroomGreeting:
+ case kCaBathroomBodyFat:
+ case kCaBathroomRetrothrash:
+ case kCaBathroomGeoWave:
+ g_allHotspots.activateOneHotspot(kCaBathroomMirrorSpotID);
+ g_allHotspots.deactivateOneHotspot(kCaHairStyle1SpotID);
+ g_allHotspots.deactivateOneHotspot(kCaHairStyle2SpotID);
+ g_allHotspots.deactivateOneHotspot(kCaHairStyle3SpotID);
+ break;
+ case kCaBathroomStylistIntro:
+ case kCaBathroomRetrothrashReturn:
+ case kCaBathroomGeoWaveReturn:
+ g_allHotspots.activateOneHotspot(kCaHairStyle1SpotID);
+ g_allHotspots.activateOneHotspot(kCaHairStyle2SpotID);
+ g_allHotspots.activateOneHotspot(kCaHairStyle3SpotID);
+ g_allHotspots.deactivateOneHotspot(kCaBathroomMirrorSpotID);
+ break;
+ }
+}
+
+void CaldoriaMirror::clickInHotspot(const Input &input, const Hotspot *spot) {
+ switch (spot->getObjectID()) {
+ case kCaBathroomMirrorSpotID:
+ switch (_owner->getLastExtra()) {
+ case kCaBathroomGreeting:
+ _owner->startExtraSequence(kCaBathroomBodyFat, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaBathroomBodyFat:
+ _owner->startExtraSequence(kCaBathroomStylistIntro, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaBathroomRetrothrash:
+ _owner->startExtraSequence(kCaBathroomRetrothrashReturn, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaBathroomGeoWave:
+ _owner->startExtraSequence(kCaBathroomGeoWaveReturn, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ break;
+ case kCaHairStyle1SpotID:
+ _owner->startExtraSequence(kCaBathroomRetrothrash, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaHairStyle2SpotID:
+ _owner->startExtraSequence(kCaBathroomAgencyStandard, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCaHairStyle3SpotID:
+ _owner->startExtraSequence(kCaBathroomGeoWave, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ GameInteraction::clickInHotspot(input, spot);
+ break;
+ }
+}
+
+void CaldoriaMirror::receiveNotification(Notification *, const NotificationFlags) {
+ switch (_owner->getLastExtra()) {
+ case kCaBathroomRetrothrash:
+ case kCaBathroomGeoWave:
+ _owner->setCurrentActivation(kActivateMirrorReady);
+ break;
+ case kCaBathroomStylistIntro:
+ case kCaBathroomRetrothrashReturn:
+ case kCaBathroomGeoWaveReturn:
+ _owner->setCurrentActivation(kActivateStylistReady);
+ break;
+ case kCaBathroomAgencyStandard:
+ _owner->setCurrentActivation(kActivateHotSpotAlways);
+ _owner->requestDeleteCurrentInteraction();
+ GameState.setScoringFixedHair(true);
+ GameState.setCaldoriaDoneHygiene(true);
+ break;
+ }
+
+ allowInput(true);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamirror.h b/engines/pegasus/neighborhood/caldoria/caldoriamirror.h
new file mode 100644
index 0000000000..1ca47ec774
--- /dev/null
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamirror.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIAMIRROR_H
+#define PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIAMIRROR_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/notification.h"
+
+namespace Pegasus {
+
+class CaldoriaMirror : public GameInteraction, public NotificationReceiver {
+public:
+ CaldoriaMirror(Neighborhood *);
+ virtual ~CaldoriaMirror() {}
+
+protected:
+ void openInteraction();
+ void initInteraction();
+ void closeInteraction();
+
+ void handleInput(const Input &, const Hotspot *);
+ void activateHotspots();
+ void clickInHotspot(const Input &, const Hotspot *);
+ void receiveNotification(Notification *, const NotificationFlags);
+
+ Notification *_neighborhoodNotification;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/door.cpp b/engines/pegasus/neighborhood/door.cpp
new file mode 100644
index 0000000000..f7ec7559fc
--- /dev/null
+++ b/engines/pegasus/neighborhood/door.cpp
@@ -0,0 +1,64 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/door.h"
+
+namespace Pegasus {
+
+void DoorTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].room = stream->readUint16BE();
+ _entries[i].direction = stream->readByte();
+ _entries[i].altCode = stream->readByte();
+ _entries[i].movieStart = stream->readUint32BE();
+ _entries[i].movieEnd = stream->readUint32BE();
+ _entries[i].flags = stream->readByte();
+ stream->readByte(); // alignment
+ debug(0, "Door[%d]: %d %d %d %d %d %d", i, _entries[i].room, _entries[i].direction,
+ _entries[i].altCode, _entries[i].movieStart, _entries[i].movieEnd,
+ _entries[i].flags);
+ }
+}
+
+void DoorTable::clear() {
+ _entries.clear();
+}
+
+DoorTable::Entry DoorTable::findEntry(RoomID room, DirectionConstant direction, AlternateID altCode) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].room == room && _entries[i].direction == direction && _entries[i].altCode == altCode)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/door.h b/engines/pegasus/neighborhood/door.h
new file mode 100644
index 0000000000..8ea757559a
--- /dev/null
+++ b/engines/pegasus/neighborhood/door.h
@@ -0,0 +1,90 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_DOOR_H
+#define PEGASUS_NEIGHBORHOOD_DOOR_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+typedef byte DoorFlags;
+
+enum {
+ kDoorPresentBit, // Bit set if there is a door here.
+ kDoorLockedBit // Bit set if door is locked, clear if unlocked.
+};
+
+static const DoorFlags kNoDoorFlags = 0;
+static const DoorFlags kDoorPresentMask = 1 << kDoorPresentBit;
+static const DoorFlags kDoorLockedMask = 1 << kDoorLockedBit;
+
+class DoorTable {
+public:
+ DoorTable() {}
+ ~DoorTable() {}
+
+ static uint32 getResTag() { return MKTAG('D', 'o', 'o', 'r'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { clear(); }
+ bool isEmpty() { return movieStart == 0xffffffff; }
+ void clear() {
+ room = kNoRoomID;
+ direction = kNoDirection;
+ altCode = kNoAlternateID;
+ movieStart = 0xffffffff;
+ movieEnd = 0xffffffff;
+ flags = kNoDoorFlags;
+ }
+
+ RoomID room;
+ DirectionConstant direction;
+ AlternateID altCode;
+ TimeValue movieStart;
+ TimeValue movieEnd;
+ DoorFlags flags;
+ };
+
+ Entry findEntry(RoomID room, DirectionConstant direction, AlternateID altCode);
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
+
diff --git a/engines/pegasus/neighborhood/exit.cpp b/engines/pegasus/neighborhood/exit.cpp
new file mode 100644
index 0000000000..f0dfff12d3
--- /dev/null
+++ b/engines/pegasus/neighborhood/exit.cpp
@@ -0,0 +1,70 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/exit.h"
+
+namespace Pegasus {
+
+void ExitTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].room = stream->readUint16BE();
+ _entries[i].direction = stream->readByte();
+ _entries[i].altCode = stream->readByte();
+ _entries[i].movieStart = stream->readUint32BE();
+ _entries[i].movieEnd = stream->readUint32BE();
+ _entries[i].exitEnd = stream->readUint32BE();
+ _entries[i].exitLoop = stream->readUint32BE();
+ _entries[i].exitRoom = stream->readUint16BE();
+ _entries[i].exitDirection = stream->readByte();
+ stream->readByte(); // alignment
+
+ _entries[i].originalEnd = _entries[i].exitEnd;
+
+ debug(0, "Exit[%d]: %d %d %d %d %d %d %d %d %d", i, _entries[i].room, _entries[i].direction,
+ _entries[i].altCode, _entries[i].movieStart, _entries[i].movieEnd, _entries[i].exitEnd,
+ _entries[i].exitLoop, _entries[i].exitRoom, _entries[i].exitDirection);
+ }
+}
+
+void ExitTable::clear() {
+ _entries.clear();
+}
+
+ExitTable::Entry ExitTable::findEntry(RoomID room, DirectionConstant direction, AlternateID altCode) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].room == room && _entries[i].direction == direction && _entries[i].altCode == altCode)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/exit.h b/engines/pegasus/neighborhood/exit.h
new file mode 100644
index 0000000000..17150892f9
--- /dev/null
+++ b/engines/pegasus/neighborhood/exit.h
@@ -0,0 +1,93 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_EXIT_H
+#define PEGASUS_NEIGHBORHOOD_EXIT_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+class ExitTable {
+public:
+ ExitTable() {}
+ ~ExitTable() {}
+
+ static uint32 getResTag() { return MKTAG('E', 'x', 'i', 't'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { clear(); }
+ bool isEmpty() { return movieStart == 0xffffffff; }
+ void clear() {
+ room = kNoRoomID;
+ direction = kNoDirection;
+ altCode = kNoAlternateID;
+ movieStart = 0xffffffff;
+ movieEnd = 0xffffffff;
+ exitEnd = 0xffffffff;
+ originalEnd = 0xffffffff;
+ exitLoop = 0xffffffff;
+ exitRoom = kNoRoomID;
+ exitDirection = kNoDirection;
+ }
+
+ RoomID room;
+ DirectionConstant direction;
+ AlternateID altCode;
+ TimeValue movieStart;
+ TimeValue movieEnd;
+ // exitEnd is the end of the optimized run of walks.
+ TimeValue exitEnd;
+ TimeValue originalEnd;
+ // exitLoop is the loop start time of the optimized run of walks if the run
+ // loops back on itself (so far, only in TSA).
+ TimeValue exitLoop;
+ RoomID exitRoom;
+ DirectionConstant exitDirection;
+ };
+
+ Entry findEntry(RoomID room, DirectionConstant direction, AlternateID altCode);
+
+ typedef Common::Array<Entry>::iterator iterator;
+ iterator begin() { return _entries.begin(); }
+ iterator end() { return _entries.end(); }
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/extra.cpp b/engines/pegasus/neighborhood/extra.cpp
new file mode 100644
index 0000000000..b8c4e5b510
--- /dev/null
+++ b/engines/pegasus/neighborhood/extra.cpp
@@ -0,0 +1,58 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/extra.h"
+
+namespace Pegasus {
+
+void ExtraTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].extra = stream->readUint32BE();
+ _entries[i].movieStart = stream->readUint32BE();
+ _entries[i].movieEnd = stream->readUint32BE();
+ debug(0, "Extra[%d]: %d %d %d", i, _entries[i].extra, _entries[i].movieStart, _entries[i].movieEnd);
+ }
+}
+
+void ExtraTable::clear() {
+ _entries.clear();
+}
+
+ExtraTable::Entry ExtraTable::findEntry(ExtraID extra) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].extra == extra)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/extra.h b/engines/pegasus/neighborhood/extra.h
new file mode 100644
index 0000000000..14fcff1009
--- /dev/null
+++ b/engines/pegasus/neighborhood/extra.h
@@ -0,0 +1,67 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_EXTRA_H
+#define PEGASUS_NEIGHBORHOOD_EXTRA_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+class ExtraTable {
+public:
+ ExtraTable() {}
+ ~ExtraTable() {}
+
+ static uint32 getResTag() { return MKTAG('X', 't', 'r', 'a'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { movieStart = 0xffffffff; }
+ bool isEmpty() { return movieStart == 0xffffffff; }
+
+ ExtraID extra;
+ TimeValue movieStart;
+ TimeValue movieEnd;
+ };
+
+ Entry findEntry(ExtraID extra);
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/hotspotinfo.cpp b/engines/pegasus/neighborhood/hotspotinfo.cpp
new file mode 100644
index 0000000000..c7524f3a0f
--- /dev/null
+++ b/engines/pegasus/neighborhood/hotspotinfo.cpp
@@ -0,0 +1,65 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/hotspotinfo.h"
+
+namespace Pegasus {
+
+void HotspotInfoTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].hotspot = stream->readUint16BE();
+ _entries[i].hotspotActivation = stream->readSByte();
+ stream->readByte(); // alignment
+ _entries[i].hotspotRoom = stream->readUint16BE();
+ _entries[i].hotspotDirection = stream->readByte();
+ stream->readByte(); // alignment
+ _entries[i].hotspotExtra = stream->readUint32BE();
+ _entries[i].hotspotItem = stream->readUint16BE();
+ debug(0, "Hotspot[%d]: %d %d %d %d %d %d", i, _entries[i].hotspot, _entries[i].hotspotActivation,
+ _entries[i].hotspotRoom, _entries[i].hotspotDirection, _entries[i].hotspotExtra,
+ _entries[i].hotspotItem);
+ }
+}
+
+void HotspotInfoTable::clear() {
+ _entries.clear();
+}
+
+HotspotInfoTable::Entry HotspotInfoTable::findEntry(HotSpotID hotspot) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].hotspot == hotspot)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/hotspotinfo.h b/engines/pegasus/neighborhood/hotspotinfo.h
new file mode 100644
index 0000000000..965f445ba8
--- /dev/null
+++ b/engines/pegasus/neighborhood/hotspotinfo.h
@@ -0,0 +1,77 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_HOTSPOTINFO_H
+#define PEGASUS_NEIGHBORHOOD_HOTSPOTINFO_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+class HotspotInfoTable {
+public:
+ HotspotInfoTable() {}
+ ~HotspotInfoTable() {}
+
+ static uint32 getResTag() { return MKTAG('H', 'S', 'I', 'n'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { hotspotRoom = kNoRoomID; }
+ bool isEmpty() { return hotspotRoom == kNoRoomID; }
+
+ HotSpotID hotspot;
+ HotSpotActivationID hotspotActivation;
+ // Location hot spot lives in:
+ RoomID hotspotRoom;
+ DirectionConstant hotspotDirection;
+ // Extra to play if this is a "play extra" hot spot.
+ ExtraID hotspotExtra;
+ // Item corresponding to this hot spot if it is an item-related hot spot.
+ ItemID hotspotItem;
+ };
+
+ Entry findEntry(HotSpotID hotspot);
+
+ typedef Common::Array<Entry>::iterator iterator;
+ iterator begin() { return _entries.begin(); }
+ iterator end() { return _entries.end(); }
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/constants.h b/engines/pegasus/neighborhood/mars/constants.h
new file mode 100644
index 0000000000..82a7f03b68
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/constants.h
@@ -0,0 +1,941 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_CONSTANTS_H
+#define PEGASUS_NEIGHBORHOOD_MARS_CONSTANTS_H
+
+#include "pegasus/constants.h"
+
+namespace Pegasus {
+
+// Element Coordinates
+
+static const CoordType kUndoHiliteLeft = kNavAreaLeft + 140;
+static const CoordType kUndoHiliteTop = kNavAreaTop + 36;
+
+static const CoordType kCurrentGuessLeft = kNavAreaLeft + 146;
+static const CoordType kCurrentGuessTop = kNavAreaTop + 90;
+
+static const CoordType kReactorChoiceHiliteLeft = kNavAreaLeft + 116;
+static const CoordType kReactorChoiceHiliteTop = kNavAreaTop + 158;
+
+static const CoordType kReactorHistoryLeft = kNavAreaLeft + 302;
+static const CoordType kReactorHistoryTop = kNavAreaTop + 39;
+
+static const CoordType kAnswerLeft = kNavAreaLeft + 304;
+static const CoordType kAnswerTop = kNavAreaTop + 180;
+
+static const CoordType kShuttle1Left = 0;
+static const CoordType kShuttle1Top = 0;
+
+static const CoordType kShuttle2Left = 0;
+static const CoordType kShuttle2Top = 96;
+
+static const CoordType kShuttle3Left = 500;
+static const CoordType kShuttle3Top = 96;
+
+static const CoordType kShuttle4Left = 0;
+static const CoordType kShuttle4Top = 320;
+
+static const CoordType kShuttleWindowLeft = 140;
+static const CoordType kShuttleWindowTop = 96;
+static const CoordType kShuttleWindowWidth = 360;
+static const CoordType kShuttleWindowHeight = 224;
+
+static const CoordType kShuttleWindowMidH = (kShuttleWindowLeft * 2 + kShuttleWindowWidth) / 2;
+static const CoordType kShuttleWindowMidV = (kShuttleWindowTop * 2 + kShuttleWindowHeight) / 2;
+
+static const CoordType kShuttleLeftLeft = 0;
+static const CoordType kShuttleLeftTop = 128;
+
+static const CoordType kShuttleRightLeft = 506;
+static const CoordType kShuttleRightTop = 128;
+
+static const CoordType kShuttleLowerLeftLeft = 74;
+static const CoordType kShuttleLowerLeftTop = 358;
+
+static const CoordType kShuttleLowerRightLeft = 486;
+static const CoordType kShuttleLowerRightTop = 354;
+
+static const CoordType kShuttleCenterLeft = 260;
+static const CoordType kShuttleCenterTop = 336;
+
+static const CoordType kShuttleUpperLeftLeft = 30;
+static const CoordType kShuttleUpperLeftTop = 32;
+
+static const CoordType kShuttleUpperRightLeft = 506;
+static const CoordType kShuttleUpperRightTop = 52;
+
+static const CoordType kShuttleLeftEnergyLeft = 110;
+static const CoordType kShuttleLeftEnergyTop = 186;
+
+static const CoordType kShuttleRightEnergyLeft = 510;
+static const CoordType kShuttleRightEnergyTop = 186;
+
+static const CoordType kShuttleEnergyLeft = 186;
+static const CoordType kShuttleEnergyTop = 60;
+static const CoordType kShuttleEnergyWidth = 252;
+static const CoordType kShuttleEnergyHeight = 22;
+
+static const CoordType kPlanetStartLeft = kShuttleWindowLeft;
+static const CoordType kPlanetStartTop = kShuttleWindowTop + kShuttleWindowHeight;
+
+static const CoordType kPlanetStopLeft = kShuttleWindowLeft;
+static const CoordType kPlanetStopTop = kShuttleWindowTop + kShuttleWindowHeight - 100;
+
+static const CoordType kShuttleTractorLeft = kShuttleWindowLeft + 6;
+static const CoordType kShuttleTractorTop = kShuttleWindowTop + 56;
+static const CoordType kShuttleTractorWidth = 348;
+static const CoordType kShuttleTractorHeight = 112;
+
+static const CoordType kShuttleJunkLeft = kShuttleWindowLeft + 6;
+static const CoordType kShuttleJunkTop = kShuttleWindowTop + 6;
+
+static const DisplayOrder kShuttlePlanetOrder = kInterfaceLayer;
+static const DisplayOrder kShuttleAlienShipOrder = kShuttlePlanetOrder + 1;
+static const DisplayOrder kShuttleRobotShipOrder = kShuttleAlienShipOrder + 1;
+static const DisplayOrder kShuttleTractorBeamMovieOrder = kShuttleRobotShipOrder + 1;
+static const DisplayOrder kShuttleWeaponBackOrder = kShuttleTractorBeamMovieOrder + 1;
+static const DisplayOrder kShuttleJunkOrder = kShuttleWeaponBackOrder + 1;
+static const DisplayOrder kShuttleWeaponFrontOrder = kShuttleJunkOrder + 1;
+static const DisplayOrder kShuttleTractorBeamOrder = kShuttleWeaponFrontOrder + 1;
+static const DisplayOrder kShuttleHUDOrder = kShuttleTractorBeamOrder + 1;
+static const DisplayOrder kShuttleBackgroundOrder = kShuttleHUDOrder + 1;
+static const DisplayOrder kShuttleMonitorOrder = kShuttleBackgroundOrder + 1;
+static const DisplayOrder kShuttleStatusOrder = kShuttleMonitorOrder + 1;
+
+static const TimeValue kShuttleSwingStart = 0;
+static const TimeValue kShuttleSwingStop = 5 * 600;
+
+static const TimeValue kCanyonChaseStart = kShuttleSwingStop;
+static const TimeValue kCanyonChaseStop = 60 * 600 + 43 * 600 + 14 * 40;
+
+static const TimeValue kLaunchTubeReachedTime = 60 * 600 + 38 * 600 - kCanyonChaseStart;
+static const TimeValue kCanyonChaseFinishedTime = kCanyonChaseStop - kCanyonChaseStart -
+ kLaunchTubeReachedTime;
+
+// Left shuttle.
+
+static const TimeValue kShuttleLeftIntroStart = 0;
+static const TimeValue kShuttleLeftIntroStop = 400;
+
+static const TimeValue kShuttleLeftBlankTime = 400;
+
+static const TimeValue kShuttleLeftNormalTime = 440;
+
+static const TimeValue kShuttleLeftAutoTestTime = 480;
+
+static const TimeValue kShuttleLeftDamagedTime = 520;
+
+static const TimeValue kShuttleLeftDampingTime = 560;
+
+static const TimeValue kShuttleLeftGravitonTime = 600;
+
+static const TimeValue kShuttleLeftTractorTime = 640;
+
+// Right shuttle.
+
+static const TimeValue kShuttleRightIntroStart = 0;
+static const TimeValue kShuttleRightIntroStop = 400;
+
+static const TimeValue kShuttleRightDestroyedStart = 400;
+static const TimeValue kShuttleRightDestroyedStop = 840;
+
+static const TimeValue kShuttleRightBlankTime = 840;
+
+static const TimeValue kShuttleRightNormalTime = 880;
+
+static const TimeValue kShuttleRightDamagedTime = 920;
+
+static const TimeValue kShuttleRightTargetLockTime = 960;
+
+static const TimeValue kShuttleRightGravitonTime = 1000;
+
+static const TimeValue kShuttleRightOverloadTime = 1040;
+
+// Lower Left shuttle.
+
+static const TimeValue kShuttleLowerLeftCollisionTime = 0;
+
+static const TimeValue kShuttleLowerLeftTubeTime = 40;
+
+static const TimeValue kShuttleLowerLeftAutopilotTime = 80;
+
+// Lower Right shuttle.
+
+static const TimeValue kShuttleLowerRightOffTime = 0;
+
+static const TimeValue kShuttleLowerRightTrackingTime = 40;
+
+static const TimeValue kShuttleLowerRightTransportTime = 80;
+
+static const TimeValue kShuttleLowerRightTransportHiliteTime = 120;
+
+// Center shuttle.
+
+static const TimeValue kShuttleCenterBoardingTime = 0;
+
+static const TimeValue kShuttleCenterCheckTime = 40;
+
+static const TimeValue kShuttleCenterNavCompTime = 80;
+
+static const TimeValue kShuttleCenterCommTime = 120;
+
+static const TimeValue kShuttleCenterWeaponsTime = 160;
+
+static const TimeValue kShuttleCenterAllSystemsTime = 200;
+
+static const TimeValue kShuttleCenterSecureLooseTime = 240;
+
+static const TimeValue kShuttleCenterAutoTestTime = 280;
+
+static const TimeValue kShuttleCenterLaunchTime = 320;
+
+static const TimeValue kShuttleCenterEnterTubeTime = 360;
+
+static const TimeValue kShuttleCenterTargetSightedTime = 400;
+
+static const TimeValue kShuttleCenterVerifyingTime = 440;
+
+static const TimeValue kShuttleCenterScanningTime = 480;
+
+static const TimeValue kShuttleCenterSafeTime = 520;
+
+// Upper Left shuttle.
+
+static const TimeValue kShuttleUpperLeftDimTime = 0;
+
+static const TimeValue kShuttleUpperLeftDampingTime = 40;
+
+static const TimeValue kShuttleUpperLeftGravitonTime = 80;
+
+static const TimeValue kShuttleUpperLeftTractorTime = 120;
+
+// Upper Right shuttle.
+
+static const TimeValue kShuttleUpperRightLockedTime = 0;
+
+static const TimeValue kShuttleUpperRightArmedTime = 40;
+
+static const TimeValue kShuttleUpperRightAlienDestroyedTime = 80;
+
+static const TimeValue kShuttleUpperRightOverloadTime = 120;
+
+static const TimeValue kShuttleUpperRightTargetDestroyedTime = 160;
+
+// Shuttle distance
+
+static const int kShuttleDistance = 500;
+
+static const int kJunkMaxDistance = kShuttleDistance;
+static const int kJunkMinDistance = 40;
+
+static const int kEnergyBeamMaxDistance = kShuttleDistance;
+static const int kEnergyBeamMinDistance = 40;
+
+static const int kGravitonMaxDistance = kShuttleDistance;
+static const int kGravitonMinDistance = 40;
+
+static const TimeValue kMarsOxyMaskOnIn = 0;
+static const TimeValue kMarsOxyMaskOnOut = 1560;
+
+static const TimeValue kMarsAirlockButtonBeepIn = 1560;
+static const TimeValue kMarsAirlockButtonBeepOut = 1620;
+
+static const TimeValue kMarsColorMatchingButtonBeepIn = 1620;
+static const TimeValue kMarsColorMatchingButtonBeepOut = 1680;
+
+static const TimeValue kMarsKioskBeepIn = 1680;
+static const TimeValue kMarsKioskBeepOut = 1740;
+
+static const TimeValue kMarsBumpIntoWallIn = 1740;
+static const TimeValue kMarsBumpIntoWallOut = 1888;
+
+static const TimeValue kMarsGantryDoorCloseIn = 1888;
+static const TimeValue kMarsGantryDoorCloseOut = 2866;
+
+static const TimeValue kMarsTransportDoorCloseIn = 2866;
+static const TimeValue kMarsTransportDoorCloseOut = 3593;
+
+static const TimeValue kMarsAirlockPressurizeIn = 3593;
+static const TimeValue kMarsAirlockPressurizeOut = 4766;
+
+static const TimeValue kMarsBigAirlockDoorCloseIn = 4766;
+static const TimeValue kMarsBigAirlockDoorCloseOut = 7872;
+
+static const TimeValue kMarsSmallAirlockDoorCloseIn = 7872;
+static const TimeValue kMarsSmallAirlockDoorCloseOut = 10000;
+
+static const TimeValue kMarsMazeDoorCloseIn = 10000;
+static const TimeValue kMarsMazeDoorCloseOut = 10969;
+
+static const TimeValue kMarsRobotTakesTransportIn = 10969;
+static const TimeValue kMarsRobotTakesTransportOut = 12802;
+
+static const TimeValue kMarsPodDepartedUpperPlatformIn = 12802;
+static const TimeValue kMarsPodDepartedUpperPlatformOut = 15783;
+
+static const TimeValue kMarsPodDepartedLowerPlatformIn = 15783;
+static const TimeValue kMarsPodDepartedLowerPlatformOut = 18736;
+
+static const TimeValue kMarsPodArrivedUpperPlatformIn = 18736;
+static const TimeValue kMarsPodArrivedUpperPlatformOut = 21605;
+
+static const TimeValue kMarsCheckInRequiredIn = 21605;
+static const TimeValue kMarsCheckInRequiredOut = 27463;
+
+static const TimeValue kMarsCantOpenShuttleIn = 27463;
+static const TimeValue kMarsCantOpenShuttleOut = 29214;
+
+static const TimeValue kMarsShuttleLockOverrideIn = 29214;
+static const TimeValue kMarsShuttleLockOverrideOut = 30330;
+
+static const TimeValue kMarsNoShuttleIn = 30330;
+static const TimeValue kMarsNoShuttleOut = 31502;
+
+static const TimeValue kMustBeUnlockedIn = 31502;
+static const TimeValue kMustBeUnlockedOut = 33960;
+
+static const TimeValue kColorMatchBlueIn = 33960;
+static const TimeValue kColorMatchBlueOut = 34240;
+
+static const TimeValue kColorMatchRedIn = 34240;
+static const TimeValue kColorMatchRedOut = 34538;
+
+static const TimeValue kColorMatchGreenIn = 34538;
+static const TimeValue kColorMatchGreenOut = 34827;
+
+static const TimeValue kColorMatchYellowIn = 34827;
+static const TimeValue kColorMatchYellowOut = 35162;
+
+static const TimeValue kColorMatchPurpleIn = 35162;
+static const TimeValue kColorMatchPurpleOut = 35426;
+
+static const TimeValue kColorMatchZeroNodesIn = 35426;
+static const TimeValue kColorMatchZeroNodesOut = 36376;
+
+static const TimeValue kColorMatchOneNodeIn = 36376;
+static const TimeValue kColorMatchOneNodeOut = 37209;
+
+static const TimeValue kColorMatchTwoNodesIn = 37209;
+static const TimeValue kColorMatchTwoNodesOut = 37983;
+
+static const TimeValue kColorMatchThreeNodesIn = 37983;
+static const TimeValue kColorMatchThreeNodesOut = 38784;
+
+static const TimeValue kMarsShuttle1DepartedIn = 38784;
+static const TimeValue kMarsShuttle1DepartedOut = 40323;
+
+static const TimeValue kMarsShuttle2DepartedIn = 40323;
+static const TimeValue kMarsShuttle2DepartedOut = 41824;
+
+static const TimeValue kShuttleCockpitIn = 41824;
+static const TimeValue kShuttleCockpitOut = 43126;
+
+static const TimeValue kShuttleOnboardIn = 43126;
+static const TimeValue kShuttleOnboardOut = 44284;
+
+static const TimeValue kShuttleNavigationIn = 44284;
+static const TimeValue kShuttleNavigationOut = 46049;
+
+static const TimeValue kShuttleCommunicationIn = 46049;
+static const TimeValue kShuttleCommunicationOut = 47288;
+
+static const TimeValue kShuttleAutoTestingIn = 47288;
+static const TimeValue kShuttleAutoTestingOut = 48179;
+
+static const TimeValue kMarsThrusterAutoTestIn = 48179;
+static const TimeValue kMarsThrusterAutoTestOut = 49979;
+
+static const TimeValue kShuttleAllSystemsIn = 49979;
+static const TimeValue kShuttleAllSystemsOut = 51065;
+
+static const TimeValue kShuttleSecureLooseIn = 51065;
+static const TimeValue kShuttleSecureLooseOut = 52346;
+
+static const TimeValue kShuttlePrepareForDropIn = 52346;
+static const TimeValue kShuttlePrepareForDropOut = 53216;
+
+static const TimeValue kShuttleAllClearIn = 53216;
+static const TimeValue kShuttleAllClearOut = 54031;
+
+static const TimeValue kShuttleConfiguringIn = 54031;
+static const TimeValue kShuttleConfiguringOut = 54994;
+
+static const TimeValue kShuttleGeneratingIn = 54994;
+static const TimeValue kShuttleGeneratingOut = 56033;
+
+static const TimeValue kShuttleBreakawayIn = 56033;
+static const TimeValue kShuttleBreakawayOut = 57346;
+
+static const TimeValue kMarsAtmosphericBreakawayIn = 57346;
+static const TimeValue kMarsAtmosphericBreakawayOut = 59237;
+
+static const TimeValue kMarsCockpitChatterIn = 59237;
+static const TimeValue kMarsCockpitChatterOut = 70344;
+
+static const TimeValue kShuttleDamperDescIn = 70344;
+static const TimeValue kShuttleDamperDescOut = 73262;
+
+static const TimeValue kShuttleGravitonDescIn = 73262;
+static const TimeValue kShuttleGravitonDescOut = 75296;
+
+static const TimeValue kShuttleTractorDescIn = 75296;
+static const TimeValue kShuttleTractorDescOut = 78381;
+
+static const TimeValue kShuttleTargetSightedIn = 78381;
+static const TimeValue kShuttleTargetSightedOut = 79074;
+
+static const TimeValue kShuttleAutopilotEngagedIn = 79074;
+static const TimeValue kShuttleAutopilotEngagedOut = 80414;
+
+static const TimeValue kMarsEDBBlastIn = 80414;
+static const TimeValue kMarsEDBBlastOut = 80705;
+
+static const TimeValue kMarsGravitonBlastIn = 80705;
+static const TimeValue kMarsGravitonBlastOut = 81199;
+
+static const TimeValue kMarsJunkCollisionIn = 81199;
+static const TimeValue kMarsJunkCollisionOut = 81961;
+
+static const TimeValue kShuttleGravitonIn = 81961;
+static const TimeValue kShuttleGravitonOut = 82587;
+
+static const TimeValue kShuttleDampingBeamIn = 82587;
+static const TimeValue kShuttleDampingBeamOut = 83331;
+
+static const TimeValue kShuttleTractorBeamIn = 83331;
+static const TimeValue kShuttleTractorBeamOut = 83802;
+
+static const TimeValue kShuttleHullBreachIn = 83802;
+static const TimeValue kShuttleHullBreachOut = 84721;
+
+static const TimeValue kShuttleWingDamageIn = 84721;
+static const TimeValue kShuttleWingDamageOut = 85640;
+
+static const TimeValue kShuttleHullDamageIn = 85640;
+static const TimeValue kShuttleHullDamageOut = 86513;
+
+static const TimeValue kShuttleEnergyTooLowIn = 86513;
+static const TimeValue kShuttleEnergyTooLowOut = 87578;
+
+static const TimeValue kShuttleTractorLimitedIn = 87578;
+static const TimeValue kShuttleTractorLimitedOut = 89164;
+
+static const TimeValue kShuttleCantHoldIn = 89164;
+static const TimeValue kShuttleCantHoldOut = 90945;
+
+static const TimeValue kShuttleBrokeFreeIn = 90945;
+static const TimeValue kShuttleBrokeFreeOut = 92322;
+
+static const TimeValue kShuttleDestroyedIn = 92322;
+static const TimeValue kShuttleDestroyedOut = 93189;
+
+static const TimeValue kShuttleCoordinatesIn = 93189;
+static const TimeValue kShuttleCoordinatesOut = 94018;
+
+static const TimeValue kShuttleScanningIn = 94018;
+static const TimeValue kShuttleScanningOut = 94975;
+
+static const TimeValue kShuttleSafeIn = 94975;
+static const TimeValue kShuttleSafeOut = 96176;
+
+static const TimeValue kShuttleOverloadedIn = 96176;
+static const TimeValue kShuttleOverloadedOut = 101308;
+
+static const TimeScale kMarsMovieScale = 600;
+static const TimeScale kMarsFramesPerSecond = 15;
+static const TimeScale kMarsFrameDuration = 40;
+
+// Alternate IDs.
+
+static const AlternateID kAltMarsNormal = 0;
+static const AlternateID kAltMarsPodAtMars34 = 1;
+static const AlternateID kAltMarsTookCard = 2;
+static const AlternateID kAltMars35AirlockEast = 3;
+static const AlternateID kAltMars35AirlockWest = 4;
+static const AlternateID kAltMarsPodAtMars45 = 5;
+static const AlternateID kAltMarsTookMask = 6;
+static const AlternateID kAltMarsMaskOnFiller = 7;
+static const AlternateID kAltMars60AirlockEast = 8;
+static const AlternateID kAltMars60AirlockWest = 9;
+
+// Room IDs.
+
+static const RoomID kMars0A = 0;
+static const RoomID kMars00 = 1;
+static const RoomID kMars01 = 2;
+static const RoomID kMars02 = 3;
+static const RoomID kMars03 = 4;
+static const RoomID kMars04 = 5;
+static const RoomID kMars05 = 6;
+static const RoomID kMars06 = 7;
+static const RoomID kMars07 = 8;
+static const RoomID kMars08 = 9;
+static const RoomID kMars09 = 10;
+static const RoomID kMars10 = 11;
+static const RoomID kMars11 = 12;
+static const RoomID kMars12 = 13;
+static const RoomID kMars13 = 14;
+static const RoomID kMars14 = 15;
+static const RoomID kMars15 = 16;
+static const RoomID kMars16 = 17;
+static const RoomID kMars17 = 18;
+static const RoomID kMars18 = 19;
+static const RoomID kMars19 = 20;
+static const RoomID kMars20 = 21;
+static const RoomID kMars21 = 22;
+static const RoomID kMars22 = 23;
+static const RoomID kMars23 = 24;
+static const RoomID kMars24 = 25;
+static const RoomID kMars25 = 26;
+static const RoomID kMars26 = 27;
+static const RoomID kMars27 = 28;
+static const RoomID kMars28 = 29;
+static const RoomID kMars29 = 30;
+static const RoomID kMars30 = 31;
+static const RoomID kMars31 = 32;
+static const RoomID kMars31South = 33;
+static const RoomID kMars32 = 34;
+static const RoomID kMars33 = 35;
+static const RoomID kMars33North = 36;
+static const RoomID kMars34 = 37;
+static const RoomID kMars35 = 38;
+static const RoomID kMars36 = 39;
+static const RoomID kMars37 = 40;
+static const RoomID kMars38 = 41;
+static const RoomID kMars39 = 42;
+static const RoomID kMars41 = 43;
+static const RoomID kMars42 = 44;
+static const RoomID kMars43 = 45;
+static const RoomID kMars44 = 46;
+static const RoomID kMars45 = 47;
+static const RoomID kMars46 = 48;
+static const RoomID kMars47 = 49;
+static const RoomID kMars48 = 50;
+static const RoomID kMars49 = 51;
+static const RoomID kMars50 = 52;
+static const RoomID kMars51 = 53;
+static const RoomID kMars52 = 54;
+static const RoomID kMars54 = 55;
+static const RoomID kMars56 = 56;
+static const RoomID kMars58 = 57;
+static const RoomID kMars60 = 58;
+static const RoomID kMarsRobotShuttle = 59;
+static const RoomID kMarsMaze004 = 60;
+static const RoomID kMarsMaze005 = 61;
+static const RoomID kMarsMaze006 = 62;
+static const RoomID kMarsMaze007 = 63;
+static const RoomID kMarsMaze008 = 64;
+static const RoomID kMarsMaze009 = 65;
+static const RoomID kMarsMaze010 = 66;
+static const RoomID kMarsMaze011 = 67;
+static const RoomID kMarsMaze012 = 68;
+static const RoomID kMarsMaze015 = 69;
+static const RoomID kMarsMaze016 = 70;
+static const RoomID kMarsMaze017 = 71;
+static const RoomID kMarsMaze018 = 72;
+static const RoomID kMarsMaze019 = 73;
+static const RoomID kMarsMaze020 = 74;
+static const RoomID kMarsMaze021 = 75;
+static const RoomID kMarsMaze022 = 76;
+static const RoomID kMarsMaze023 = 77;
+static const RoomID kMarsMaze024 = 78;
+static const RoomID kMarsMaze025 = 79;
+static const RoomID kMarsMaze026 = 80;
+static const RoomID kMarsMaze027 = 81;
+static const RoomID kMarsMaze028 = 82;
+static const RoomID kMarsMaze031 = 83;
+static const RoomID kMarsMaze032 = 84;
+static const RoomID kMarsMaze033 = 85;
+static const RoomID kMarsMaze034 = 86;
+static const RoomID kMarsMaze035 = 87;
+static const RoomID kMarsMaze036 = 88;
+static const RoomID kMarsMaze037 = 89;
+static const RoomID kMarsMaze038 = 90;
+static const RoomID kMarsMaze039 = 91;
+static const RoomID kMarsMaze042 = 92;
+static const RoomID kMarsMaze043 = 93;
+static const RoomID kMarsMaze044 = 94;
+static const RoomID kMarsMaze045 = 95;
+static const RoomID kMarsMaze046 = 96;
+static const RoomID kMarsMaze047 = 97;
+static const RoomID kMarsMaze049 = 98;
+static const RoomID kMarsMaze050 = 99;
+static const RoomID kMarsMaze051 = 100;
+static const RoomID kMarsMaze052 = 101;
+static const RoomID kMarsMaze053 = 102;
+static const RoomID kMarsMaze054 = 103;
+static const RoomID kMarsMaze055 = 104;
+static const RoomID kMarsMaze056 = 105;
+static const RoomID kMarsMaze057 = 106;
+static const RoomID kMarsMaze058 = 107;
+static const RoomID kMarsMaze059 = 108;
+static const RoomID kMarsMaze060 = 109;
+static const RoomID kMarsMaze061 = 110;
+static const RoomID kMarsMaze063 = 111;
+static const RoomID kMarsMaze064 = 112;
+static const RoomID kMarsMaze065 = 113;
+static const RoomID kMarsMaze066 = 114;
+static const RoomID kMarsMaze067 = 115;
+static const RoomID kMarsMaze068 = 116;
+static const RoomID kMarsMaze069 = 117;
+static const RoomID kMarsMaze070 = 118;
+static const RoomID kMarsMaze071 = 119;
+static const RoomID kMarsMaze072 = 120;
+static const RoomID kMarsMaze074 = 121;
+static const RoomID kMarsMaze076 = 122;
+static const RoomID kMarsMaze078 = 123;
+static const RoomID kMarsMaze079 = 124;
+static const RoomID kMarsMaze081 = 125;
+static const RoomID kMarsMaze083 = 126;
+static const RoomID kMarsMaze084 = 127;
+static const RoomID kMarsMaze085 = 128;
+static const RoomID kMarsMaze086 = 129;
+static const RoomID kMarsMaze087 = 130;
+static const RoomID kMarsMaze088 = 131;
+static const RoomID kMarsMaze089 = 132;
+static const RoomID kMarsMaze090 = 133;
+static const RoomID kMarsMaze091 = 134;
+static const RoomID kMarsMaze092 = 135;
+static const RoomID kMarsMaze093 = 136;
+static const RoomID kMarsMaze098 = 137;
+static const RoomID kMarsMaze099 = 138;
+static const RoomID kMarsMaze100 = 139;
+static const RoomID kMarsMaze101 = 140;
+static const RoomID kMarsMaze104 = 141;
+static const RoomID kMarsMaze105 = 142;
+static const RoomID kMarsMaze106 = 143;
+static const RoomID kMarsMaze107 = 144;
+static const RoomID kMarsMaze108 = 145;
+static const RoomID kMarsMaze111 = 146;
+static const RoomID kMarsMaze113 = 147;
+static const RoomID kMarsMaze114 = 148;
+static const RoomID kMarsMaze115 = 149;
+static const RoomID kMarsMaze116 = 150;
+static const RoomID kMarsMaze117 = 151;
+static const RoomID kMarsMaze118 = 152;
+static const RoomID kMarsMaze119 = 153;
+static const RoomID kMarsMaze120 = 154;
+static const RoomID kMarsMaze121 = 155;
+static const RoomID kMarsMaze122 = 156;
+static const RoomID kMarsMaze123 = 157;
+static const RoomID kMarsMaze124 = 158;
+static const RoomID kMarsMaze125 = 159;
+static const RoomID kMarsMaze126 = 160;
+static const RoomID kMarsMaze127 = 161;
+static const RoomID kMarsMaze128 = 162;
+static const RoomID kMarsMaze129 = 163;
+static const RoomID kMarsMaze130 = 164;
+static const RoomID kMarsMaze131 = 165;
+static const RoomID kMarsMaze132 = 166;
+static const RoomID kMarsMaze133 = 167;
+static const RoomID kMarsMaze136 = 168;
+static const RoomID kMarsMaze137 = 169;
+static const RoomID kMarsMaze138 = 170;
+static const RoomID kMarsMaze139 = 171;
+static const RoomID kMarsMaze140 = 172;
+static const RoomID kMarsMaze141 = 173;
+static const RoomID kMarsMaze142 = 174;
+static const RoomID kMarsMaze143 = 175;
+static const RoomID kMarsMaze144 = 176;
+static const RoomID kMarsMaze145 = 177;
+static const RoomID kMarsMaze146 = 178;
+static const RoomID kMarsMaze147 = 179;
+static const RoomID kMarsMaze148 = 180;
+static const RoomID kMarsMaze149 = 181;
+static const RoomID kMarsMaze152 = 182;
+static const RoomID kMarsMaze153 = 183;
+static const RoomID kMarsMaze154 = 184;
+static const RoomID kMarsMaze155 = 185;
+static const RoomID kMarsMaze156 = 186;
+static const RoomID kMarsMaze157 = 187;
+static const RoomID kMarsMaze159 = 188;
+static const RoomID kMarsMaze160 = 189;
+static const RoomID kMarsMaze161 = 190;
+static const RoomID kMarsMaze162 = 191;
+static const RoomID kMarsMaze163 = 192;
+static const RoomID kMarsMaze164 = 193;
+static const RoomID kMarsMaze165 = 194;
+static const RoomID kMarsMaze166 = 195;
+static const RoomID kMarsMaze167 = 196;
+static const RoomID kMarsMaze168 = 197;
+static const RoomID kMarsMaze169 = 198;
+static const RoomID kMarsMaze170 = 199;
+static const RoomID kMarsMaze171 = 200;
+static const RoomID kMarsMaze172 = 201;
+static const RoomID kMarsMaze173 = 202;
+static const RoomID kMarsMaze174 = 203;
+static const RoomID kMarsMaze175 = 204;
+static const RoomID kMarsMaze177 = 205;
+static const RoomID kMarsMaze178 = 206;
+static const RoomID kMarsMaze179 = 207;
+static const RoomID kMarsMaze180 = 208;
+static const RoomID kMarsMaze181 = 209;
+static const RoomID kMarsMaze182 = 210;
+static const RoomID kMarsMaze183 = 211;
+static const RoomID kMarsMaze184 = 212;
+static const RoomID kMarsMaze187 = 213;
+static const RoomID kMarsMaze188 = 214;
+static const RoomID kMarsMaze189 = 215;
+static const RoomID kMarsMaze190 = 216;
+static const RoomID kMarsMaze191 = 217;
+static const RoomID kMarsMaze192 = 218;
+static const RoomID kMarsMaze193 = 219;
+static const RoomID kMarsMaze194 = 220;
+static const RoomID kMarsMaze195 = 221;
+static const RoomID kMarsMaze198 = 222;
+static const RoomID kMarsMaze199 = 223;
+static const RoomID kMarsMaze200 = 224;
+static const RoomID kMarsDeathRoom = 225;
+
+// Hot Spot Activation IDs.
+
+static const HotSpotActivationID kActivationReadyForKiosk = 1;
+static const HotSpotActivationID kActivationKioskChoice = 2;
+static const HotSpotActivationID kActivationTunnelMapReady = 3;
+static const HotSpotActivationID kActivateMarsPodClosed = 4;
+static const HotSpotActivationID kActivateMarsPodOpen = 5;
+static const HotSpotActivationID kActivateReadyToPressurizeAirlock = 6;
+static const HotSpotActivationID kActivateAirlockPressurized = 7;
+static const HotSpotActivationID kActivateMaskOnHolder = 8;
+static const HotSpotActivationID kActivateMaskOnFiller = 9;
+static const HotSpotActivationID kActivateReactorPlatformOut = 10;
+static const HotSpotActivationID kActivateReactorPlatformIn = 11;
+static const HotSpotActivationID kActivateReactorAskLowerScreen = 12;
+static const HotSpotActivationID kActivateReactorReadyForNitrogen = 13;
+static const HotSpotActivationID kActivateReactorReadyForCrowBar = 14;
+static const HotSpotActivationID kActivateReactorAskOperation = 15;
+static const HotSpotActivationID kActivateReactorRanEvaluation = 16;
+static const HotSpotActivationID kActivateReactorRanDiagnostics = 17;
+static const HotSpotActivationID kActivateReactorAnalyzed = 18;
+static const HotSpotActivationID kActivateReactorInstructions = 19;
+static const HotSpotActivationID kActivateReactorInGame = 20;
+static const HotSpotActivationID kActivateReactorBombSafe = 21;
+static const HotSpotActivationID kActivateReactorBombExposed = 22;
+static const HotSpotActivationID kActivationRobotHeadClosed = 23;
+static const HotSpotActivationID kActivationRobotHeadOpen = 24;
+
+// Hot Spot IDs.
+
+static const HotSpotID kMars11NorthKioskSpotID = 5000;
+static const HotSpotID kMars11NorthKioskSightsSpotID = 5001;
+static const HotSpotID kMars11NorthKioskColonySpotID = 5002;
+static const HotSpotID kMars12NorthKioskSpotID = 5003;
+static const HotSpotID kMars12NorthKioskSightsSpotID = 5004;
+static const HotSpotID kMars12NorthKioskColonySpotID = 5005;
+static const HotSpotID kMars31SouthSpotID = 5006;
+static const HotSpotID kMars31SouthOutSpotID = 5007;
+static const HotSpotID kMars31SouthCardSpotID = 5008;
+static const HotSpotID kMars33NorthSpotID = 5009;
+static const HotSpotID kMars33NorthOutSpotID = 5010;
+static const HotSpotID kMars33NorthMonitorSpotID = 5011;
+static const HotSpotID kMars34NorthCardDropSpotID = 5012;
+static const HotSpotID kMars34SouthOpenStorageSpotID = 5013;
+static const HotSpotID kMars34SouthCloseStorageSpotID = 5014;
+static const HotSpotID kMars34SouthCrowbarSpotID = 5015;
+static const HotSpotID kMars35EastPressurizeSpotID = 5016;
+static const HotSpotID kMars35EastSpinSpotID = 5017;
+static const HotSpotID kMars35WestPressurizeSpotID = 5018;
+static const HotSpotID kMars35WestSpinSpotID = 5019;
+static const HotSpotID kMars45NorthOpenStorageSpotID = 5020;
+static const HotSpotID kMars45NorthCloseStorageSpotID = 5021;
+static const HotSpotID kMars45NorthCrowbarSpotID = 5022;
+static const HotSpotID kAttackRobotHotSpotID = 5023;
+static const HotSpotID kMars49AirMaskSpotID = 5024;
+static const HotSpotID kMars49AirMaskFilledSpotID = 5025;
+static const HotSpotID kMars49AirFillingDropSpotID = 5026;
+static const HotSpotID kMars52MoveLeftSpotID = 5027;
+static const HotSpotID kMars52MoveRightSpotID = 5028;
+static const HotSpotID kMars52ExtractSpotID = 5029;
+static const HotSpotID kMars53RetractSpotID = 5030;
+static const HotSpotID kMars54MoveLeftSpotID = 5031;
+static const HotSpotID kMars54MoveRightSpotID = 5032;
+static const HotSpotID kMars54ExtractSpotID = 5033;
+static const HotSpotID kMars55RetractSpotID = 5034;
+static const HotSpotID kMars56MoveLeftSpotID = 5035;
+static const HotSpotID kMars56MoveRightSpotID = 5036;
+static const HotSpotID kMars56ExtractSpotID = 5037;
+static const HotSpotID kMars57RetractSpotID = 5038;
+static const HotSpotID kMars57LowerScreenSpotID = 5039;
+static const HotSpotID kMars57Retract2SpotID = 5040;
+static const HotSpotID kMars57DropNitrogenSpotID = 5041;
+static const HotSpotID kMars57DropCrowBarSpotID = 5042;
+static const HotSpotID kMars57CantOpenPanelSpotID = 5043;
+static const HotSpotID kMars57ShieldEvaluationSpotID = 5044;
+static const HotSpotID kMars57MeasureOutputSpotID = 5045;
+static const HotSpotID kMars57RunDiagnosticsSpotID = 5046;
+static const HotSpotID kMars57BackToOperationMenuSpotID = 5047;
+static const HotSpotID kMars57AnalyzeObjectSpotID = 5048;
+static const HotSpotID kMars57RemoveObjectMenuSpotID = 5049;
+static const HotSpotID kMars57CircuitLinkSpotID = 5050;
+static const HotSpotID kMars57CancelCircuitLinkSpotID = 5051;
+static const HotSpotID kMars57GameInstructionsSpotID = 5052;
+static const HotSpotID kMars57UndoMoveSpotID = 5053;
+static const HotSpotID kMars57RedMoveSpotID = 5054;
+static const HotSpotID kMars57YellowMoveSpotID = 5055;
+static const HotSpotID kMars57GreenMoveSpotID = 5056;
+static const HotSpotID kMars57BlueMoveSpotID = 5057;
+static const HotSpotID kMars57PurpleMoveSpotID = 5058;
+static const HotSpotID kMars57LowerScreenSafelySpotID = 5059;
+static const HotSpotID kMars57GrabBombSpotID = 5060;
+static const HotSpotID kMars58MoveLeftSpotID = 5061;
+static const HotSpotID kMars58MoveRightSpotID = 5062;
+static const HotSpotID kMars58ExtractSpotID = 5063;
+static const HotSpotID kMars59RetractSpotID = 5064;
+static const HotSpotID kMars60EastPressurizeSpotID = 5065;
+static const HotSpotID kMars60EastSpinSpotID = 5066;
+static const HotSpotID kMars60WestPressurizeSpotID = 5067;
+static const HotSpotID kMars60WestSpinSpotID = 5068;
+static const HotSpotID kRobotShuttleOpenHeadSpotID = 5069;
+static const HotSpotID kRobotShuttleMapChipSpotID = 5070;
+static const HotSpotID kRobotShuttleOpticalChipSpotID = 5071;
+static const HotSpotID kRobotShuttleShieldChipSpotID = 5072;
+
+// Extra sequence IDs.
+
+static const ExtraID kMarsArrivalFromTSA = 0;
+static const ExtraID kMars0AWatchShuttleDepart = 1;
+static const ExtraID kRobotThrowsPlayer = 2;
+static const ExtraID kMarsInfoKioskIntro = 3;
+static const ExtraID kMarsColonyInfo = 4;
+static const ExtraID kMarsSightsInfo = 5;
+static const ExtraID kRobotOnWayToShuttle = 6;
+static const ExtraID kMars31SouthZoomInNoCard = 7;
+static const ExtraID kMars31SouthViewNoCard = 8;
+static const ExtraID kMars31SouthZoomOutNoCard = 9;
+static const ExtraID kMars31SouthZoomViewNoCard = 10;
+static const ExtraID kMars33SlideShow1 = 11;
+static const ExtraID kMars33SlideShow2 = 12;
+static const ExtraID kMars33SlideShow3 = 13;
+static const ExtraID kMars33SlideShow4 = 14;
+static const ExtraID kMars34SpotOpenWithBar = 15;
+static const ExtraID kMars34SpotCloseWithBar = 16;
+static const ExtraID kMars34SpotOpenNoBar = 17;
+static const ExtraID kMars34SpotCloseNoBar = 18;
+static const ExtraID kMars34ViewOpenWithBar = 19;
+static const ExtraID kMars34ViewOpenNoBar = 20;
+static const ExtraID kMars34NorthPodGreeting = 21;
+static const ExtraID kMarsTurnOnPod = 22;
+static const ExtraID kMarsTakePodToMars45 = 23;
+static const ExtraID kMars35WestSpinAirlockToEast = 24;
+static const ExtraID kMars35EastSpinAirlockToWest = 25;
+static const ExtraID kMars45SpotOpenWithBar = 26;
+static const ExtraID kMars45SpotCloseWithBar = 27;
+static const ExtraID kMars45SpotOpenNoBar = 28;
+static const ExtraID kMars45SpotCloseNoBar = 29;
+static const ExtraID kMars45ViewOpenWithBar = 30;
+static const ExtraID kMars45ViewOpenNoBar = 31;
+static const ExtraID kMars48RobotApproaches = 32;
+static const ExtraID kMars48RobotKillsPlayer = 33;
+static const ExtraID kMars48RobotLoops = 34;
+static const ExtraID kMars48RobotView = 35;
+static const ExtraID kMars48RobotDefends = 36;
+static const ExtraID kMars49SouthViewMaskFilling = 37;
+static const ExtraID kMars52SpinLeft = 38;
+static const ExtraID kMars52SpinRight = 39;
+static const ExtraID kMars52Extend = 40;
+static const ExtraID kMars53Retract = 41;
+static const ExtraID kMars54SpinLeft = 42;
+static const ExtraID kMars54SpinRight = 43;
+static const ExtraID kMars54Extend = 44;
+static const ExtraID kMars55Retract = 45;
+static const ExtraID kMars56SpinLeft = 46;
+static const ExtraID kMars56SpinRight = 47;
+static const ExtraID kMars56ExtendWithBomb = 48;
+static const ExtraID kMars56ExtendNoBomb = 49;
+static const ExtraID kMars57RetractWithBomb = 50;
+static const ExtraID kMars57RetractNoBomb = 51;
+static const ExtraID kMars57LowerScreenClosed = 52;
+static const ExtraID kMars57CantOpenPanel = 53;
+static const ExtraID kMars57FreezeLock = 54;
+static const ExtraID kMars57BreakLock = 55;
+static const ExtraID kMars57LockFrozenView = 56;
+static const ExtraID kMars57ThawLock = 57;
+static const ExtraID kMars57OpenPanel = 58;
+static const ExtraID kMars57OpenPanelChoices = 59;
+static const ExtraID kMars57ShieldEvaluation = 60;
+static const ExtraID kMars57MeasureOutput = 61;
+static const ExtraID kMars57ShieldOkayLoop = 62;
+static const ExtraID kMars57RunDiagnostics = 63;
+static const ExtraID kMars57BombExplodes = 64;
+static const ExtraID kMars57BombAnalysis = 65;
+static const ExtraID kMars57DontLink = 66;
+static const ExtraID kMars57CircuitLink = 67;
+static const ExtraID kMars57GameLevel1 = 68;
+static const ExtraID kMars57GameLevel2 = 69;
+static const ExtraID kMars57GameLevel3 = 70;
+static const ExtraID kMars57BombExplodesInGame = 71;
+static const ExtraID kMars57GameSolved = 72;
+static const ExtraID kMars57ExposeBomb = 73;
+static const ExtraID kMars57BackToNormal = 74;
+static const ExtraID kMars57ViewOpenNoBomb = 75;
+static const ExtraID kMars58SpinLeft = 76;
+static const ExtraID kMars58SpinRight = 77;
+static const ExtraID kMars58Extend = 78;
+static const ExtraID kMars59Retract = 79;
+static const ExtraID kMars60WestSpinAirlockToEast = 80;
+static const ExtraID kMars60EastSpinAirlockToWest = 81;
+static const ExtraID kMarsRobotHeadOpen = 82;
+static const ExtraID kMarsRobotHeadClose = 83;
+static const ExtraID kMarsRobotHead000 = 84;
+static const ExtraID kMarsRobotHead001 = 85;
+static const ExtraID kMarsRobotHead010 = 86;
+static const ExtraID kMarsRobotHead011 = 87;
+static const ExtraID kMarsRobotHead100 = 88;
+static const ExtraID kMarsRobotHead101 = 89;
+static const ExtraID kMarsRobotHead110 = 90;
+static const ExtraID kMarsRobotHead111 = 91;
+static const ExtraID kMarsMaze007RobotApproach = 92;
+static const ExtraID kMarsMaze007RobotLoop = 93;
+static const ExtraID kMarsMaze007RobotDeath = 94;
+static const ExtraID kMarsMaze015SouthRobotApproach = 95;
+static const ExtraID kMarsMaze015SouthRobotLoop = 96;
+static const ExtraID kMarsMaze015SouthRobotDeath = 97;
+static const ExtraID kMarsMaze101EastRobotApproach = 98;
+static const ExtraID kMarsMaze101EastRobotLoop = 99;
+static const ExtraID kMarsMaze101EastRobotDeath = 100;
+static const ExtraID kMarsMaze104WestLoop = 101;
+static const ExtraID kMarsMaze104WestDeath = 102;
+static const ExtraID kMarsMaze133SouthApproach = 103;
+static const ExtraID kMarsMaze133SouthLoop = 104;
+static const ExtraID kMarsMaze133SouthDeath = 105;
+static const ExtraID kMarsMaze136NorthApproach = 106;
+static const ExtraID kMarsMaze136NorthLoop = 107;
+static const ExtraID kMarsMaze136NorthDeath = 108;
+static const ExtraID kMarsMaze184WestLoop = 109;
+static const ExtraID kMarsMaze184WestDeath = 110;
+static const ExtraID kMars200DeathInBucket = 111;
+
+static const ResIDType kReactorUndoHilitePICTID = 900;
+
+static const int16 kMars52Compass = 90;
+static const int16 kMars54Compass = 180;
+static const int16 kMars56Compass = 270;
+static const int16 kMars58Compass = 0;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/energybeam.cpp b/engines/pegasus/neighborhood/mars/energybeam.cpp
new file mode 100644
index 0000000000..964c8ba381
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/energybeam.cpp
@@ -0,0 +1,70 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/energybeam.h"
+
+namespace Pegasus {
+
+static const TimeValue kEnergyBeamTime = kOneSecond * kShuttleWeaponScale / 2;
+
+static const CoordType kEnergyBeamOriginH = kShuttleWindowMidH;
+static const CoordType kEnergyBeamOriginV = kShuttleWindowTop + kShuttleWindowHeight;
+
+static const float kBeamXOrigin = convertScreenHToSpaceX(kEnergyBeamOriginH, kEnergyBeamMinDistance);
+static const float kBeamYOrigin = convertScreenVToSpaceY(kEnergyBeamOriginV, kEnergyBeamMinDistance);
+static const float kBeamZOrigin = kEnergyBeamMinDistance;
+
+EnergyBeam::EnergyBeam() {
+ _weaponDuration = kEnergyBeamTime;
+ setSegment(0, kEnergyBeamTime);
+ _weaponOrigin = Point3D(kBeamXOrigin, kBeamYOrigin, kBeamZOrigin);
+}
+
+void EnergyBeam::draw(const Common::Rect &) {
+ static const int kBeamColorRed1 = 224;
+ static const int kBeamColorRed2 = 64;
+
+ Graphics::Surface *surface = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+
+ byte red = linearInterp(0, kEnergyBeamTime, _lastTime, kBeamColorRed1, kBeamColorRed2);
+ uint32 color = surface->format.RGBToColor(red, 0, 0);
+
+ Point3D startPoint;
+ if (_weaponTime < 0.1)
+ startPoint = _weaponOrigin;
+ else
+ linearInterp(_weaponOrigin, _weaponTarget, _weaponTime - 0.1, startPoint);
+
+ Common::Point lineStart;
+ project3DTo2D(startPoint, lineStart);
+
+ Common::Point lineEnd;
+ project3DTo2D(_weaponLocation, lineEnd);
+
+ surface->drawThickLine(lineStart.x, lineStart.y, lineEnd.x, lineEnd.y, 2, 1, color);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/energybeam.h b/engines/pegasus/neighborhood/mars/energybeam.h
new file mode 100644
index 0000000000..715ed4b01d
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/energybeam.h
@@ -0,0 +1,43 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_ENERGYBEAM_H
+#define PEGASUS_NEIGHBORHOOD_MARS_ENERGYBEAM_H
+
+#include "pegasus/neighborhood/mars/shuttleweapon.h"
+
+namespace Pegasus {
+
+class EnergyBeam : public ShuttleWeapon {
+public:
+ EnergyBeam();
+ virtual ~EnergyBeam() {}
+
+ void draw(const Common::Rect &);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/gravitoncannon.cpp b/engines/pegasus/neighborhood/mars/gravitoncannon.cpp
new file mode 100644
index 0000000000..d04b3d08b2
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/gravitoncannon.cpp
@@ -0,0 +1,134 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/neighborhood/mars/gravitoncannon.h"
+#include "pegasus/neighborhood/mars/robotship.h"
+#include "pegasus/neighborhood/mars/spacejunk.h"
+
+namespace Pegasus {
+
+static const TimeValue kGravitonTime = kOneSecond * kShuttleWeaponScale;
+
+static const CoordType kGravitonOriginH = kShuttleWindowLeft - 1;
+static const CoordType kGravitonOriginV = kShuttleWindowMidV;
+
+static const float kGravitonXOrigin = convertScreenHToSpaceX(kGravitonOriginH, kGravitonMinDistance);
+static const float kGravitonYOrigin = convertScreenVToSpaceY(kGravitonOriginV, kGravitonMinDistance);
+static const float kGravitonZOrigin = kGravitonMinDistance;
+
+// Width of graviton sprite...
+static const CoordType kGravitonMaxScreenWidth = 78;
+static const CoordType kGravitonMaxScreenHeight = 46;
+
+static const float kGravitonWidth = convertScreenHToSpaceX(kShuttleWindowMidH + kGravitonMaxScreenWidth / 2, kGravitonMinDistance)
+ - convertScreenHToSpaceX(kShuttleWindowMidH - kGravitonMaxScreenWidth / 2, kGravitonMinDistance);
+static const float kGravitonHeight = convertScreenVToSpaceY(kShuttleWindowMidV - kGravitonMaxScreenHeight / 2, kGravitonMinDistance)
+ - convertScreenVToSpaceY(kShuttleWindowMidV + kGravitonMaxScreenHeight / 2, kGravitonMinDistance);
+
+GravitonCannon::GravitonCannon() {
+ _weaponDuration = kGravitonTime;
+ setSegment(0, kGravitonTime);
+ _weaponOrigin = Point3D(kGravitonXOrigin, kGravitonYOrigin, kGravitonZOrigin);
+ _rightOrigin = Point3D(-kGravitonXOrigin, kGravitonYOrigin, kGravitonZOrigin);
+}
+
+void GravitonCannon::initShuttleWeapon() {
+ ShuttleWeapon::initShuttleWeapon();
+ _gravitonImage.getImageFromPICTFile("Images/Mars/Graviton Cannon");
+ _gravitonImage.getSurfaceBounds(_gravitonBounds);
+}
+
+void GravitonCannon::cleanUpShuttleWeapon() {
+ _gravitonImage.deallocateSurface();
+ ShuttleWeapon::cleanUpShuttleWeapon();
+}
+
+void GravitonCannon::draw(const Common::Rect &) {
+ // Left graviton...
+ Point3D pt3D = _weaponLocation;
+ pt3D.translate(-kGravitonWidth / 2, kGravitonHeight / 2, 0);
+ Common::Point pt2D;
+ project3DTo2D(pt3D, pt2D);
+ Common::Rect gravitonRect;
+ gravitonRect.left = pt2D.x;
+ gravitonRect.top = pt2D.y;
+
+ pt3D.translate(kGravitonWidth, -kGravitonHeight, 0);
+ project3DTo2D(pt3D, pt2D);
+ gravitonRect.right = pt2D.x;
+ gravitonRect.bottom = pt2D.y;
+
+ _gravitonImage.scaleTransparentCopy(_gravitonBounds, gravitonRect);
+
+ // Right graviton...
+ pt3D = _rightLocation;
+ pt3D.translate(-kGravitonWidth / 2, kGravitonHeight / 2, 0);
+ project3DTo2D(pt3D, pt2D);
+ gravitonRect.left = pt2D.x;
+ gravitonRect.top = pt2D.y;
+
+ pt3D.translate(kGravitonWidth, -kGravitonHeight, 0);
+ project3DTo2D(pt3D, pt2D);
+ gravitonRect.right = pt2D.x;
+ gravitonRect.bottom = pt2D.y;
+
+ _gravitonImage.scaleTransparentCopy(_gravitonBounds, gravitonRect);
+}
+
+void GravitonCannon::updateWeaponPosition() {
+ ShuttleWeapon::updateWeaponPosition();
+ if (_weaponTime != 1.0)
+ linearInterp(_rightOrigin, _weaponTarget, _weaponTime, _rightLocation);
+}
+
+bool GravitonCannon::collisionWithJunk(Common::Point &impactPoint) {
+ if (getDisplayOrder() == kShuttleWeaponFrontOrder) {
+ Point3D junkPosition;
+ g_spaceJunk->getJunkPosition(junkPosition);
+
+ if (junkPosition.z < _weaponLocation.z) {
+ setDisplayOrder(kShuttleWeaponBackOrder);
+ project3DTo2D(_weaponLocation, impactPoint);
+
+ if (g_spaceJunk->pointInJunk(impactPoint))
+ return true;
+
+ project3DTo2D(_rightLocation, impactPoint);
+ return g_spaceJunk->pointInJunk(impactPoint);
+ }
+ }
+
+ return false;
+}
+
+void GravitonCannon::hitJunk(Common::Point impactPoint) {
+ g_spaceJunk->hitByGravitonCannon(impactPoint);
+}
+
+void GravitonCannon::hitShuttle(Common::Point impactPoint) {
+ g_robotShip->hitByGravitonCannon(impactPoint);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/gravitoncannon.h b/engines/pegasus/neighborhood/mars/gravitoncannon.h
new file mode 100644
index 0000000000..b94fd55e5b
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/gravitoncannon.h
@@ -0,0 +1,57 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_GRAVITONCANNON_H
+#define PEGASUS_NEIGHBORHOOD_MARS_GRAVITONCANNON_H
+
+#include "pegasus/surface.h"
+#include "pegasus/neighborhood/mars/shuttleweapon.h"
+
+namespace Pegasus {
+
+class GravitonCannon : public ShuttleWeapon {
+public:
+ GravitonCannon();
+ virtual ~GravitonCannon() {}
+
+ void initShuttleWeapon();
+ void cleanUpShuttleWeapon();
+
+ void draw(const Common::Rect &);
+
+protected:
+ virtual void updateWeaponPosition();
+ virtual bool collisionWithJunk(Common::Point &impactPoint);
+ virtual void hitJunk(Common::Point impactPoint);
+ virtual void hitShuttle(Common::Point impactPoint);
+
+ Surface _gravitonImage;
+ Common::Rect _gravitonBounds;
+ Point3D _rightOrigin, _rightLocation;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/hermite.cpp b/engines/pegasus/neighborhood/mars/hermite.cpp
new file mode 100644
index 0000000000..7f631b369d
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/hermite.cpp
@@ -0,0 +1,76 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/neighborhood/mars/hermite.h"
+
+namespace Pegasus {
+
+CoordType hermite(CoordType p1, CoordType p4, CoordType r1, CoordType r4, int32 time, int32 duration) {
+ float t = (float)time / duration;
+ float tsq = t * t;
+ float tcu = t * tsq;
+ float tcu2 = tcu + tcu;
+ float tsq2 = tsq + tsq;
+ float tsq3 = tsq2 + tsq;
+ return (CoordType)((tcu2 - tsq3 + 1) * p1 + (tsq3 - tcu2) * p4 + (tcu - tsq2 + t) * r1 + (tcu - tsq) * r4);
+}
+
+CoordType dHermite(CoordType p1, CoordType p4, CoordType r1, CoordType r4, int32 time, int32 duration) {
+ float t = (float)time / duration;
+ float t2 = t + t;
+ float t4 = t2 + t2;
+ float t6 = t4 + t2;
+ float tsq = t * t;
+ float tsq3 = tsq + tsq + tsq;
+ float tsq6 = tsq3 + tsq3;
+ return (CoordType)((tsq6 - t6) * p1 + (t6 - tsq6) * p4 + (tsq3 - t4 + 1) * r1 + (tsq3 - t2) * r4);
+}
+
+void hermite(Common::Point p1, Common::Point p4, Common::Point r1, Common::Point r4, int32 time, int32 duration, Common::Point &result) {
+ float t = (float)time / duration;
+ float tsq = t * t;
+ float tcu = t * tsq;
+ float tcu2 = tcu + tcu;
+ float tsq2 = tsq + tsq;
+ float tsq3 = tsq2 + tsq;
+
+ result.x = (int16)((tcu2 - tsq3 + 1) * p1.x + (tsq3 - tcu2) * p4.x + (tcu - tsq2 + t) * r1.x + (tcu - tsq) * r4.x);
+ result.y = (int16)((tcu2 - tsq3 + 1) * p1.y + (tsq3 - tcu2) * p4.y + (tcu - tsq2 + t) * r1.y + (tcu - tsq) * r4.y);
+}
+
+void dHermite(Common::Point p1, Common::Point p4, Common::Point r1, Common::Point r4, int32 time, int32 duration, Common::Point &result) {
+ float t = (float)time / duration;
+ float t2 = t + t;
+ float t4 = t2 + t2;
+ float t6 = t4 + t2;
+ float tsq = t * t;
+ float tsq3 = tsq + tsq + tsq;
+ float tsq6 = tsq3 + tsq3;
+
+ result.x = (int16)((tsq6 - t6) * p1.x + (t6 - tsq6) * p4.x + (tsq3 - t4 + 1) * r1.x + (tsq3 - t2) * r4.x);
+ result.y = (int16)((tsq6 - t6) * p1.y + (t6 - tsq6) * p4.y + (tsq3 - t4 + 1) * r1.y + (tsq3 - t2) * r4.y);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/hermite.h b/engines/pegasus/neighborhood/mars/hermite.h
new file mode 100644
index 0000000000..44cb3a5a11
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/hermite.h
@@ -0,0 +1,41 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_HERMITE_H
+#define PEGASUS_NEIGHBORHOOD_MARS_HERMITE_H
+
+#include "common/rect.h"
+#include "pegasus/types.h"
+
+namespace Pegasus {
+
+CoordType hermite(CoordType p1, CoordType p4, CoordType r1, CoordType r4, int32 t, int32 duration);
+CoordType dHermite(CoordType p1, CoordType p4, CoordType r1, CoordType r4, int32 t, int32 duration);
+void hermite(Common::Point p1, Common::Point p4, Common::Point r1, Common::Point r4, int32 t, int32 duration, Common::Point &result);
+void dHermite(Common::Point p1, Common::Point p4, Common::Point r1, Common::Point r4, int32 t, int32 duration, Common::Point &result);
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
new file mode 100644
index 0000000000..34c9e3d0f8
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -0,0 +1,3735 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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"
+#include "video/qt_decoder.h"
+
+#include "pegasus/cursor.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/items/biochips/shieldchip.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/mars/mars.h"
+
+namespace Pegasus {
+
+// This should really be 22.5.
+// Probably no one will know the difference.
+static const int16 kMarsShieldPanelOffsetAngle = 22;
+
+static const CanMoveForwardReason kCantMoveRobotBlocking = kCantMoveLastReason + 1;
+
+static const NotificationFlags kTimeForCanyonChaseFlag = kLastNeighborhoodNotificationFlag << 1;
+static const NotificationFlags kExplosionFinishedFlag = kTimeForCanyonChaseFlag << 1;
+static const NotificationFlags kTimeToTransportFlag = kExplosionFinishedFlag << 1;
+
+static const NotificationFlags kMarsNotificationFlags = kTimeForCanyonChaseFlag |
+ kExplosionFinishedFlag |
+ kTimeToTransportFlag;
+
+static const TimeValue kLittleExplosionStart = 0 * 40;
+static const TimeValue kLittleExplosionStop = 24 * 40;
+
+static const TimeValue kBigExplosionStart = 24 * 40;
+static const TimeValue kBigExplosionStop = 62 * 40;
+
+enum {
+ kMaze007RobotLoopingEvent,
+ kMaze015RobotLoopingEvent,
+ kMaze101RobotLoopingEvent,
+ kMaze104RobotLoopingEvent,
+ kMaze133RobotLoopingEvent,
+ kMaze136RobotLoopingEvent,
+ kMaze184RobotLoopingEvent
+};
+
+enum {
+ kMaze007RobotLoopingTime = (64 + 96) * kMarsFrameDuration,
+ kMaze015RobotLoopingTime = (64 + 93) * kMarsFrameDuration,
+ kMaze101RobotLoopingTime = (64 + 45) * kMarsFrameDuration,
+ kMaze104RobotLoopingTime = 96 * kMarsFrameDuration,
+ kMaze133RobotLoopingTime = (64 + 96) * kMarsFrameDuration,
+ kMaze136RobotLoopingTime = (64 + 96) * kMarsFrameDuration,
+ kMaze184RobotLoopingTime = 96 * kMarsFrameDuration
+};
+
+// I've made a couple macros for these rects so we don't
+// have to globally construct them or whatnot
+#define kShuttleEnergyBeamBounds Common::Rect(24, 27, 24 + 112, 27 + 46)
+#define kShuttleGravitonBounds Common::Rect(24, 73, 24 + 112, 73 + 30)
+#define kShuttleTractorBounds Common::Rect(24, 103, 24 + 112, 103 + 30)
+#define kShuttleTransportBounds Common::Rect(484, 353, 89 + 484, 79 + 353)
+
+void MarsTimerEvent::fire() {
+ mars->marsTimerExpired(*this);
+}
+
+Mars::Mars(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Mars", kMarsID),
+ _guessObject(kNoDisplayElement), _undoPict(kNoDisplayElement), _guessHistory(kNoDisplayElement),
+ _choiceHighlight(kNoDisplayElement), _shuttleInterface1(kNoDisplayElement), _shuttleInterface2(kNoDisplayElement),
+ _shuttleInterface3(kNoDisplayElement), _shuttleInterface4(kNoDisplayElement), _canyonChaseMovie(kNoDisplayElement),
+ _leftShuttleMovie(kNoDisplayElement), _rightShuttleMovie(kNoDisplayElement), _lowerLeftShuttleMovie(kNoDisplayElement),
+ _lowerRightShuttleMovie(kNoDisplayElement), _centerShuttleMovie(kNoDisplayElement),
+ _upperLeftShuttleMovie(kNoDisplayElement), _upperRightShuttleMovie(kNoDisplayElement),
+ _leftDamageShuttleMovie(kNoDisplayElement), _rightDamageShuttleMovie(kNoDisplayElement), _explosions(kNoDisplayElement),
+ _planetMovie(kNoDisplayElement), _junk(kNoDisplayElement), _energyChoiceSpot(kShuttleEnergySpotID),
+ _gravitonChoiceSpot(kShuttleGravitonSpotID), _tractorChoiceSpot(kShuttleTractorSpotID),
+ _shuttleViewSpot(kShuttleViewSpotID), _shuttleTransportSpot(kShuttleTransportSpotID) {
+ _noAirFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::airStageExpired));
+ setIsItemTaken(kMarsCard);
+ setIsItemTaken(kAirMask);
+ setIsItemTaken(kCrowbar);
+ setIsItemTaken(kCardBomb);
+}
+
+Mars::~Mars() {
+ _vm->getAllHotspots().remove(&_energyChoiceSpot);
+ _vm->getAllHotspots().remove(&_gravitonChoiceSpot);
+ _vm->getAllHotspots().remove(&_tractorChoiceSpot);
+ _vm->getAllHotspots().remove(&_shuttleViewSpot);
+ _vm->getAllHotspots().remove(&_shuttleTransportSpot);
+}
+
+void Mars::init() {
+ Neighborhood::init();
+
+ Hotspot *attackSpot = _vm->getAllHotspots().findHotspotByID(kAttackRobotHotSpotID);
+ attackSpot->setMaskedHotspotFlags(kDropItemSpotFlag, kDropItemSpotFlag);
+ _attackingItem = NULL;
+
+ forceStridingStop(kMars08, kNorth, kAltMarsNormal);
+
+ _neighborhoodNotification.notifyMe(this, kMarsNotificationFlags, kMarsNotificationFlags);
+
+ _explosionCallBack.setNotification(&_neighborhoodNotification);
+ _explosionCallBack.setCallBackFlag(kExplosionFinishedFlag);
+
+ _weaponSelection = kNoWeapon;
+}
+
+void Mars::flushGameState() {
+ g_energyMonitor->saveCurrentEnergyValue();
+}
+
+void Mars::start() {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+ Neighborhood::start();
+}
+
+class AirMaskCondition : public AICondition {
+public:
+ AirMaskCondition(const uint32);
+
+ virtual bool fireCondition();
+
+protected:
+ uint32 _airThreshold;
+ uint32 _lastAirLevel;
+};
+
+AirMaskCondition::AirMaskCondition(const uint32 airThreshold) {
+ _airThreshold = airThreshold;
+ _lastAirLevel = g_airMask->getAirLeft();
+}
+
+bool AirMaskCondition::fireCondition() {
+ bool result = g_airMask && g_airMask->isAirMaskOn() &&
+ g_airMask->getAirLeft() <= _airThreshold && _lastAirLevel > _airThreshold;
+
+ _lastAirLevel = g_airMask->getAirLeft();
+ return result;
+}
+
+void Mars::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ // Don't add these rules if we're going to the robot's shuttle...
+ if (g_AIArea && !GameState.getMarsReadyForShuttleTransport()) {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB1E", false);
+ AILocationCondition *locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kMars47, kSouth));
+ AIRule *rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XM27NB", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kMars27, kNorth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XM27NB", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kMars28, kNorth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XM41ED", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kMars19, kEast));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ AIDeactivateRuleAction *deactivate = new AIDeactivateRuleAction(rule);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kMars35, kWest));
+ rule = new AIRule(locCondition, deactivate);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XM41ED", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kMars48, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ AirMaskCondition *airMask50Condition = new AirMaskCondition(50);
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XMMAZB1", false);
+ AIRule *rule50 = new AIRule(airMask50Condition, messageAction);
+
+ AirMaskCondition *airMask25Condition = new AirMaskCondition(25);
+ AICompoundAction *compound = new AICompoundAction();
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XMMAZB2", false);
+ compound->addAction(messageAction);
+ deactivate = new AIDeactivateRuleAction(rule50);
+ compound->addAction(deactivate);
+ AIRule *rule25 = new AIRule(airMask25Condition, compound);
+
+ AirMaskCondition *airMask5Condition = new AirMaskCondition(5);
+ compound = new AICompoundAction;
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XMMAZB3", false);
+ compound->addAction(messageAction);
+ deactivate = new AIDeactivateRuleAction(rule50);
+ compound->addAction(deactivate);
+ deactivate = new AIDeactivateRuleAction(rule25);
+ compound->addAction(deactivate);
+ AIRule *rule5 = new AIRule(airMask5Condition, compound);
+
+ g_AIArea->addAIRule(rule5);
+ g_AIArea->addAIRule(rule25);
+ g_AIArea->addAIRule(rule50);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Mars/XM51ND", false);
+ AIDoorOpenedCondition *doorOpen = new AIDoorOpenedCondition(MakeRoomView(kMars51, kEast));
+ rule = new AIRule(doorOpen, messageAction);
+ g_AIArea->addAIRule(rule);
+ }
+}
+
+uint16 Mars::getDateResID() const {
+ return kDate2185ID;
+}
+
+TimeValue Mars::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraTable::Entry extra;
+ SpotTable::Entry spotEntry;
+ uint32 extraID = 0xffffffff;
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kMars0A, kNorth):
+ if (!GameState.getMarsSeenTimeStream()) {
+ getExtraEntry(kMarsArrivalFromTSA, extra);
+ return extra.movieStart;
+ }
+ break;
+ case MakeRoomView(kMars31South, kSouth):
+ if (GameState.isTakenItemID(kMarsCard))
+ extraID = kMars31SouthZoomViewNoCard;
+ break;
+ case MakeRoomView(kMars31, kSouth):
+ if (GameState.isTakenItemID(kMarsCard))
+ extraID = kMars31SouthViewNoCard;
+ break;
+ case MakeRoomView(kMars34, kSouth):
+ if (_privateFlags.getFlag(kMarsPrivatePodStorageOpenFlag)) {
+ if (GameState.isTakenItemID(kCrowbar))
+ extraID = kMars34ViewOpenNoBar;
+ else
+ extraID = kMars34ViewOpenWithBar;
+ }
+ break;
+ case MakeRoomView(kMars36, kSouth):
+ case MakeRoomView(kMars37, kSouth):
+ case MakeRoomView(kMars38, kSouth):
+ findSpotEntry(room, direction, kSpotOnTurnMask | kSpotLoopsMask, spotEntry);
+ return spotEntry.movieStart;
+ case MakeRoomView(kMars45, kNorth):
+ if (_privateFlags.getFlag(kMarsPrivatePodStorageOpenFlag)) {
+ if (GameState.isTakenItemID(kCrowbar))
+ extraID = kMars45ViewOpenNoBar;
+ else
+ extraID = kMars45ViewOpenWithBar;
+ }
+ break;
+ case MakeRoomView(kMars48, kEast):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot())
+ extraID = kMars48RobotView;
+ break;
+ case MakeRoomView(kMars56, kEast):
+ if (_privateFlags.getFlag(kMarsPrivateBombExposedFlag)) {
+ if (_privateFlags.getFlag(kMarsPrivateDraggingBombFlag))
+ extraID = kMars57ViewOpenNoBomb;
+ else
+ extraID = kMars57ExposeBomb;
+ } else if (GameState.getMarsLockBroken()) {
+ extraID = kMars57OpenPanelChoices;
+ } else if (GameState.getMarsLockFrozen()) {
+ extraID = kMars57LockFrozenView;
+ }
+ break;
+ case MakeRoomView(kMarsRobotShuttle, kEast):
+ if (getCurrentActivation() == kActivationRobotHeadOpen) {
+ extraID = kMarsRobotHead111;
+
+ if (_privateFlags.getFlag(kMarsPrivateGotMapChipFlag))
+ extraID -= 1;
+ if (_privateFlags.getFlag(kMarsPrivateGotOpticalChipFlag))
+ extraID -= 2;
+ if (_privateFlags.getFlag(kMarsPrivateGotShieldChipFlag))
+ extraID -= 4;
+ }
+ break;
+ }
+
+ if (extraID == 0xffffffff)
+ return Neighborhood::getViewTime(room, direction);
+
+ getExtraEntry(extraID, extra);
+ return extra.movieEnd - 1;
+}
+
+void Mars::getZoomEntry(const HotSpotID spotID, ZoomTable::Entry &entry) {
+ Neighborhood::getZoomEntry(spotID, entry);
+
+ uint32 extraID = 0xffffffff;
+
+ switch (spotID) {
+ case kMars31SouthSpotID:
+ if (GameState.getCurrentDirection() == kSouth && GameState.isTakenItemID(kMarsCard))
+ extraID = kMars31SouthZoomInNoCard;
+ break;
+ case kMars31SouthOutSpotID:
+ if (GameState.getCurrentDirection() == kSouth && GameState.isTakenItemID(kMarsCard))
+ extraID = kMars31SouthZoomOutNoCard;
+ break;
+ }
+
+ if (extraID != 0xffffffff) {
+ ExtraTable::Entry extra;
+ getExtraEntry(extraID, extra);
+ entry.movieStart = extra.movieStart;
+ entry.movieEnd = extra.movieEnd;
+ }
+}
+
+void Mars::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &entry) {
+ Neighborhood::findSpotEntry(room, direction, flags, entry);
+
+ if ((flags & (kSpotOnArrivalMask | kSpotOnTurnMask)) != 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars27, kNorth):
+ if (GameState.getMarsSeenThermalScan())
+ entry.clear();
+ else
+ GameState.setMarsSeenThermalScan(true);
+ break;
+ case MakeRoomView(kMars28, kNorth):
+ if (GameState.getMarsSeenThermalScan())
+ entry.clear();
+ else
+ GameState.setMarsSeenThermalScan(true);
+ break;
+ }
+ }
+}
+
+CanMoveForwardReason Mars::canMoveForward(ExitTable::Entry &entry) {
+ CanMoveForwardReason reason = Neighborhood::canMoveForward(entry);
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars48, kEast):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot())
+ reason = kCantMoveRobotBlocking;
+ break;
+ case MakeRoomView(kMars48, kSouth):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot())
+ _utilityFuse.stopFuse();
+ break;
+ }
+
+ return reason;
+}
+
+void Mars::cantMoveThatWay(CanMoveForwardReason reason) {
+ if (reason == kCantMoveRobotBlocking) {
+ startExtraSequence(kMars48RobotKillsPlayer, kExtraCompletedFlag, kFilterNoInput);
+ loadLoopSound2("");
+ } else {
+ Neighborhood::cantMoveThatWay(reason);
+ }
+}
+
+void Mars::moveForward() {
+ if (GameState.getCurrentRoom() == kMars02 || (GameState.getCurrentRoom() >= kMars05 && GameState.getCurrentRoom() <= kMars08))
+ loadLoopSound2("");
+
+ Neighborhood::moveForward();
+}
+
+void Mars::bumpIntoWall() {
+ requestSpotSound(kMarsBumpIntoWallIn, kMarsBumpIntoWallOut, kFilterNoInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+CanOpenDoorReason Mars::canOpenDoor(DoorTable::Entry &entry) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars05, kEast):
+ case MakeRoomView(kMars06, kEast):
+ case MakeRoomView(kMars07, kEast):
+ if (!GameState.getMarsSecurityDown())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kMarsMaze037, kWest):
+ case MakeRoomView(kMarsMaze038, kEast):
+ if (GameState.getMarsMazeDoorPair1())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kMarsMaze050, kNorth):
+ case MakeRoomView(kMarsMaze058, kSouth):
+ if (!GameState.getMarsMazeDoorPair1())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kMarsMaze047, kNorth):
+ case MakeRoomView(kMarsMaze142, kSouth):
+ if (GameState.getMarsMazeDoorPair2())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kMarsMaze057, kNorth):
+ case MakeRoomView(kMarsMaze136, kSouth):
+ if (!GameState.getMarsMazeDoorPair2())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kMarsMaze120, kWest):
+ case MakeRoomView(kMarsMaze121, kEast):
+ if (GameState.getMarsMazeDoorPair3())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kMarsMaze081, kNorth):
+ case MakeRoomView(kMarsMaze083, kSouth):
+ if (!GameState.getMarsMazeDoorPair3())
+ return kCantOpenLocked;
+ break;
+ }
+
+ return Neighborhood::canOpenDoor(entry);
+}
+
+void Mars::cantOpenDoor(CanOpenDoorReason reason) {
+ switch (GameState.getCurrentRoom()) {
+ case kMars05:
+ case kMars06:
+ case kMars07:
+ playSpotSoundSync(kMarsCantOpenShuttleIn, kMarsCantOpenShuttleOut);
+ break;
+ default:
+ Neighborhood::cantOpenDoor(reason);
+ break;
+ }
+}
+
+void Mars::openDoor() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars06, kEast):
+ case MakeRoomView(kMars07, kEast):
+ if (GameState.getMarsSecurityDown())
+ playSpotSoundSync(kMarsNoShuttleIn, kMarsNoShuttleOut);
+ break;
+ case MakeRoomView(kMars47, kSouth):
+ if (GameState.isTakenItemID(kAirMask))
+ setCurrentAlternate(kAltMarsTookMask);
+ else
+ setCurrentAlternate(kAltMarsNormal);
+ break;
+ case MakeRoomView(kMars48, kNorth):
+ if (GameState.getMarsPodAtUpperPlatform())
+ setCurrentAlternate(kAltMarsNormal);
+ else
+ setCurrentAlternate(kAltMarsPodAtMars45);
+ break;
+ case MakeRoomView(kMars48, kEast):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot()) {
+ die(kDeathDidntGetOutOfWay);
+ return;
+ }
+ break;
+ }
+
+ Neighborhood::openDoor();
+}
+
+void Mars::doorOpened() {
+ switch (GameState.getCurrentRoom()) {
+ case kMars27:
+ case kMars28:
+ if (GameState.getCurrentDirection() == kNorth)
+ _vm->die(kDeathArrestedInMars);
+ else
+ Neighborhood::doorOpened();
+ break;
+ case kMars41:
+ case kMars42:
+ if (GameState.getCurrentDirection() == kEast)
+ _vm->die(kDeathWrongShuttleLock);
+ else
+ Neighborhood::doorOpened();
+ break;
+ case kMars51:
+ Neighborhood::doorOpened();
+ setUpReactorEnergyDrain();
+
+ if (g_AIArea)
+ g_AIArea->checkRules();
+ break;
+ case kMars19:
+ if (GameState.getCurrentDirection() == kEast)
+ GameState.setMarsAirlockOpen(true);
+
+ Neighborhood::doorOpened();
+ break;
+ case kMars48:
+ if (GameState.getCurrentDirection() == kWest)
+ GameState.setMarsAirlockOpen(true);
+
+ Neighborhood::doorOpened();
+ break;
+ default:
+ Neighborhood::doorOpened();
+ break;
+ }
+}
+
+void Mars::setUpReactorEnergyDrain() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars51, kEast):
+ if (GameState.isCurrentDoorOpen()) {
+ if (g_energyMonitor->getEnergyDrainRate() == kEnergyDrainNormal) {
+ if (GameState.getShieldOn()) {
+ g_shield->setItemState(kShieldRadiation);
+ g_energyMonitor->setEnergyDrainRate(kMarsReactorEnergyDrainWithShield);
+ } else {
+ g_energyMonitor->setEnergyDrainRate(kMarsReactorEnergyDrainNoShield);
+ }
+ _vm->setEnergyDeathReason(kDeathReactorBurn);
+ }
+ } else {
+ if (g_energyMonitor->getEnergyDrainRate() != kEnergyDrainNormal) {
+ if (GameState.getShieldOn())
+ g_shield->setItemState(kShieldNormal);
+ g_energyMonitor->setEnergyDrainRate(kEnergyDrainNormal);
+ _vm->resetEnergyDeathReason();
+ }
+ }
+ break;
+ case MakeRoomView(kMars52, kNorth):
+ case MakeRoomView(kMars52, kSouth):
+ case MakeRoomView(kMars52, kEast):
+ case MakeRoomView(kMars52, kWest):
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kEast):
+ case MakeRoomView(kMars56, kWest):
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ if (g_energyMonitor->getEnergyDrainRate() == kEnergyDrainNormal) {
+ if (GameState.getShieldOn()) {
+ g_shield->setItemState(kShieldRadiation);
+ g_energyMonitor->setEnergyDrainRate(kMarsReactorEnergyDrainWithShield);
+ } else {
+ g_energyMonitor->setEnergyDrainRate(kMarsReactorEnergyDrainNoShield);
+ }
+ _vm->setEnergyDeathReason(kDeathReactorBurn);
+ }
+ break;
+ default:
+ if (g_energyMonitor->getEnergyDrainRate() != kEnergyDrainNormal) {
+ if (GameState.getShieldOn())
+ g_shield->setItemState(kShieldNormal);
+ g_energyMonitor->setEnergyDrainRate(kEnergyDrainNormal);
+ _vm->resetEnergyDeathReason();
+ }
+ break;
+ }
+}
+
+void Mars::closeDoorOffScreen(const RoomID room, const DirectionConstant direction) {
+ switch (room) {
+ case kMars51:
+ playSpotSoundSync(kMarsGantryDoorCloseIn, kMarsGantryDoorCloseOut);
+ if (GameState.getShieldOn())
+ g_shield->setItemState(kShieldNormal);
+ g_energyMonitor->setEnergyDrainRate(kEnergyDrainNormal);
+ _vm->resetEnergyDeathReason();
+ break;
+ case kMars05:
+ case kMars06:
+ case kMars07:
+ case kMars13:
+ case kMars22:
+ case kMars47:
+ case kMars52:
+ playSpotSoundSync(kMarsGantryDoorCloseIn, kMarsGantryDoorCloseOut);
+ break;
+ case kMars18:
+ case kMars32:
+ playSpotSoundSync(kMarsTransportDoorCloseIn, kMarsTransportDoorCloseOut);
+ break;
+ case kMars19:
+ if (GameState.getCurrentRoom() != kMars35) {
+ playSpotSoundSync(kMarsBigAirlockDoorCloseIn, kMarsBigAirlockDoorCloseOut);
+ GameState.setMarsAirlockOpen(false);
+ }
+ break;
+ case kMars36:
+ if (GameState.getCurrentRoom() != kMars35)
+ playSpotSoundSync(kMarsSmallAirlockDoorCloseIn, kMarsSmallAirlockDoorCloseOut);
+ break;
+ case kMars48:
+ if (direction == kWest) {
+ if (GameState.getCurrentRoom() != kMars60) {
+ playSpotSoundSync(kMarsSmallAirlockDoorCloseIn, kMarsSmallAirlockDoorCloseOut);
+ GameState.setMarsAirlockOpen(false);
+ }
+ } else {
+ playSpotSoundSync(kMarsGantryDoorCloseIn, kMarsGantryDoorCloseOut);
+ }
+ break;
+ case kMars41:
+ case kMars42:
+ case kMars43:
+ if (direction == kWest)
+ playSpotSoundSync(kMarsGantryDoorCloseIn, kMarsGantryDoorCloseOut);
+ break;
+ case kMarsMaze037:
+ case kMarsMaze038:
+ case kMarsMaze012:
+ case kMarsMaze066:
+ case kMarsMaze050:
+ case kMarsMaze058:
+ case kMarsMaze057:
+ case kMarsMaze136:
+ case kMarsMaze047:
+ case kMarsMaze142:
+ case kMarsMaze133:
+ case kMarsMaze132:
+ case kMarsMaze113:
+ case kMarsMaze114:
+ case kMarsMaze120:
+ case kMarsMaze121:
+ case kMarsMaze081:
+ case kMarsMaze083:
+ case kMarsMaze088:
+ case kMarsMaze089:
+ case kMarsMaze179:
+ case kMarsMaze180:
+ playSpotSoundSync(kMarsMazeDoorCloseIn, kMarsMazeDoorCloseOut);
+ break;
+ }
+}
+
+void Mars::checkAirlockDoors() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars19, kWest):
+ case MakeRoomView(kMars18, kWest):
+ case MakeRoomView(kMars17, kWest):
+ case MakeRoomView(kMars16, kWest):
+ case MakeRoomView(kMars15, kWest):
+ case MakeRoomView(kMars14, kWest):
+ case MakeRoomView(kMars12, kWest):
+ case MakeRoomView(kMars11, kWest):
+ case MakeRoomView(kMars10, kWest):
+ if (GameState.getMarsInAirlock()) {
+ playSpotSoundSync(kMarsBigAirlockDoorCloseIn, kMarsBigAirlockDoorCloseOut);
+ GameState.setMarsInAirlock(false);
+ }
+ break;
+ case MakeRoomView(kMars36, kEast):
+ case MakeRoomView(kMars37, kEast):
+ case MakeRoomView(kMars38, kEast):
+ case MakeRoomView(kMars39, kEast):
+ case MakeRoomView(kMars48, kEast):
+ case MakeRoomView(kMars50, kEast):
+ case MakeRoomView(kMars51, kEast):
+ case MakeRoomView(kMars52, kEast):
+ if (GameState.getMarsInAirlock()) {
+ playSpotSoundSync(kMarsSmallAirlockDoorCloseIn, kMarsSmallAirlockDoorCloseOut);
+ GameState.setMarsInAirlock(false);
+ }
+ break;
+ case MakeRoomView(kMars35, kWest):
+ case MakeRoomView(kMars35, kEast):
+ case MakeRoomView(kMars60, kWest):
+ case MakeRoomView(kMars60, kEast):
+ GameState.setMarsInAirlock(true);
+ break;
+ default:
+ GameState.setMarsInAirlock(false);
+ break;
+ }
+}
+
+int16 Mars::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ int16 angle = Neighborhood::getStaticCompassAngle(room, dir);
+
+ switch (MakeRoomView(room, dir)) {
+ case MakeRoomView(kMars0A, kNorth):
+ angle -= 20;
+ break;
+ case MakeRoomView(kMars23, kNorth):
+ case MakeRoomView(kMars23, kSouth):
+ case MakeRoomView(kMars23, kEast):
+ case MakeRoomView(kMars23, kWest):
+ case MakeRoomView(kMars26, kNorth):
+ case MakeRoomView(kMars26, kSouth):
+ case MakeRoomView(kMars26, kEast):
+ case MakeRoomView(kMars26, kWest):
+ angle += 30;
+ break;
+ case MakeRoomView(kMars24, kNorth):
+ case MakeRoomView(kMars24, kSouth):
+ case MakeRoomView(kMars24, kEast):
+ case MakeRoomView(kMars24, kWest):
+ case MakeRoomView(kMars25, kNorth):
+ case MakeRoomView(kMars25, kSouth):
+ case MakeRoomView(kMars25, kEast):
+ case MakeRoomView(kMars25, kWest):
+ angle -= 30;
+ break;
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ angle += 90;
+ break;
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kEast):
+ case MakeRoomView(kMars56, kWest):
+ angle += 180;
+ break;
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ angle -= 90;
+ break;
+ }
+
+ return angle;
+}
+
+void Mars::getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove) {
+ Neighborhood::getExitCompassMove(exitEntry, compassMove);
+
+ if (exitEntry.room == kMars43 && exitEntry.direction == kEast) {
+ compassMove.insertFaderKnot(exitEntry.movieStart + 16 * kMarsFrameDuration, 90);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 32 * kMarsFrameDuration, 270);
+ } else if (exitEntry.room == kMars46 && exitEntry.direction == kWest && exitEntry.altCode != kAltMarsPodAtMars45) {
+ compassMove.makeTwoKnotFaderSpec(kMarsMovieScale, exitEntry.movieStart, 270, exitEntry.movieEnd, 360);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 43 * kMarsFrameDuration, 270);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 58 * kMarsFrameDuration, 360);
+ }
+}
+
+void Mars::getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove) {
+ switch (entry.extra) {
+ case kMarsTakePodToMars45:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 0, entry.movieEnd, 180);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 3), 30);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 11), 10);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 14), 40);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 16), 30);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 23), 100);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 31), 70);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 34), 100);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 37), 85);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 42), 135);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 44), 125);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 46), 145);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 49), 160);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * (kMarsFramesPerSecond * 51), 180);
+ break;
+ case kMars35WestSpinAirlockToEast:
+ case kMars60WestSpinAirlockToEast:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 90, entry.movieEnd, 270);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsMovieScale, 90);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsMovieScale * 3, 270);
+ break;
+ case kMars35EastSpinAirlockToWest:
+ case kMars60EastSpinAirlockToWest:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, 270, entry.movieEnd, 90);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsMovieScale, 270);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsMovieScale * 3, 90);
+ break;
+ case kMars52SpinLeft:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars52Compass, entry.movieEnd, kMars54Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars52Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars54Compass);
+ break;
+ case kMars52SpinRight:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars52Compass, entry.movieEnd, kMars58Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars52Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars58Compass);
+ break;
+ case kMars52Extend:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars52Compass,
+ entry.movieEnd, kMars52Compass + kMarsShieldPanelOffsetAngle);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars52Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 60, kMars52Compass + kMarsShieldPanelOffsetAngle);
+ break;
+ case kMars53Retract:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart,
+ kMars52Compass + kMarsShieldPanelOffsetAngle, entry.movieEnd, kMars52Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars52Compass + kMarsShieldPanelOffsetAngle);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 60, kMars52Compass);
+ break;
+ case kMars56ExtendWithBomb:
+ case kMars56ExtendNoBomb:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars56Compass,
+ entry.movieEnd, kMars56Compass - kMarsShieldPanelOffsetAngle);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars56Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 60, kMars56Compass - kMarsShieldPanelOffsetAngle);
+ break;
+ case kMars57RetractWithBomb:
+ case kMars57RetractNoBomb:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart,
+ kMars56Compass - kMarsShieldPanelOffsetAngle, entry.movieEnd, kMars56Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars56Compass - kMarsShieldPanelOffsetAngle);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 60, kMars56Compass);
+ break;
+ case kMars54SpinLeft:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars54Compass, entry.movieEnd, kMars56Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars54Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars56Compass);
+ break;
+ case kMars54SpinRight:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars54Compass, entry.movieEnd, kMars52Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars54Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars52Compass);
+ break;
+ case kMars56SpinLeft:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars56Compass,
+ entry.movieEnd, kMars58Compass + 360);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars56Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars58Compass + 360);
+ break;
+ case kMars56SpinRight:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars56Compass, entry.movieEnd, kMars54Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars56Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars54Compass);
+ break;
+ case kMars58SpinLeft:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart, kMars58Compass,
+ entry.movieEnd, kMars52Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars58Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars52Compass);
+ break;
+ case kMars58SpinRight:
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), entry.movieStart,
+ kMars58Compass + 360, entry.movieEnd, kMars56Compass);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 10, kMars58Compass + 360);
+ compassMove.insertFaderKnot(entry.movieStart + kMarsFrameDuration * 110, kMars56Compass);
+ break;
+ default:
+ Neighborhood::getExtraCompassMove(entry, compassMove);
+ }
+}
+
+void Mars::loadAmbientLoops() {
+ RoomID room = GameState.getCurrentRoom();
+
+ if ((room >= kMars0A && room <= kMars21) || (room >= kMars41 && room <= kMars43)) {
+ if (GameState.getMarsSeenTimeStream())
+ loadLoopSound1("Sounds/Mars/Gantry Ambient.22K.8.AIFF");
+ } else if (room >= kMars22 && room <= kMars31South) {
+ loadLoopSound1("Sounds/Mars/Reception.02.22K.8.AIFF", 0x100 / 4);
+ } else if (room >= kMars32 && room <= kMars34) {
+ loadLoopSound1("Sounds/Mars/Pod Room Ambient.22K.8.AIFF");
+ } else if (room == kMars35) {
+ if (getAirQuality(room) == kAirQualityVacuum)
+ loadLoopSound1("Sounds/Mars/Gear Room Ambient.22K.8.AIFF");
+ else
+ loadLoopSound1("Sounds/Mars/Gantry Ambient.22K.8.AIFF", 0x100 / 2);
+ } else if (room >= kMars36 && room <= kMars39) {
+ loadLoopSound1("Sounds/Mars/Gear Room Ambient.22K.8.AIFF");
+ } else if (room >= kMars45 && room <= kMars51) {
+ loadLoopSound1("Sounds/Mars/Lower Mars Ambient.22K.8.AIFF");
+ } else if (room >= kMars52 && room <= kMars58) {
+ loadLoopSound1("Sounds/Mars/ReactorLoop.22K.8.AIFF");
+ } else if (room == kMars60) {
+ if (getAirQuality(room) == kAirQualityVacuum)
+ loadLoopSound1("Sounds/Mars/Mars Maze Ambient.22K.8.AIFF");
+ else
+ loadLoopSound1("Sounds/Mars/Lower Mars Ambient.22K.8.AIFF", 0x100 / 2);
+ } else if (room >= kMarsMaze004 && room <= kMarsMaze200) {
+ loadLoopSound1("Sounds/Mars/Mars Maze Ambient.22K.8.AIFF");
+ } else if (room == kMarsRobotShuttle) {
+ loadLoopSound1("Sounds/Mars/Robot Shuttle.22K.8.AIFF");
+ }
+
+ if (!_noAirFuse.isFuseLit()) {
+ switch (room) {
+ case kMars02:
+ case kMars05:
+ case kMars06:
+ case kMars07:
+ case kMars08:
+ loadLoopSound2("Sounds/Mars/Gantry Loop.aiff", 0x100, 0, 0);
+ break;
+ // Robot at maze 48
+ case kMarsMaze037:
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ else
+ loadLoopSound2("");
+ break;
+ case kMarsMaze038:
+ case kMarsMaze039:
+ case kMarsMaze049:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100);
+ break;
+ case kMarsMaze050:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 * 3 / 4);
+ break;
+ case kMarsMaze051:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ break;
+ case kMarsMaze052:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 4);
+ break;
+ case kMarsMaze042:
+ case kMarsMaze053:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 8);
+ break;
+ case kMarsMaze058:
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 4);
+ else
+ loadLoopSound2("");
+ break;
+ // Robot at 151
+ case kMarsMaze148:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100);
+ break;
+ case kMarsMaze147:
+ case kMarsMaze149:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 * 3 / 4);
+ break;
+ case kMarsMaze146:
+ case kMarsMaze152:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ break;
+ case kMarsMaze145:
+ case kMarsMaze153:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 4);
+ break;
+ // Robots at 80 and 82.
+ case kMarsMaze079:
+ case kMarsMaze081:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100);
+ break;
+ case kMarsMaze078:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 * 3 / 4);
+ break;
+ case kMarsMaze083:
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 * 3 / 4);
+ else
+ loadLoopSound2("");
+ break;
+ case kMarsMaze118:
+ case kMarsMaze076:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ break;
+ case kMarsMaze074:
+ case kMarsMaze117:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 4);
+ break;
+ // Robot at 94
+ case kMarsMaze093:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100);
+ break;
+ case kMarsMaze091:
+ case kMarsMaze092:
+ case kMarsMaze098:
+ case kMarsMaze101:
+ case kMarsMaze100:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 * 3 / 4);
+ break;
+ case kMarsMaze090:
+ case kMarsMaze099:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ break;
+ case kMarsMaze089:
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ break;
+ case kMarsMaze178:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 4);
+ break;
+ // Robot at 197
+ case kMarsMaze191:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100);
+ break;
+ case kMarsMaze190:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 * 3 / 4);
+ break;
+ case kMarsMaze198:
+ case kMarsMaze189:
+ loadLoopSound2("Sounds/Mars/Maze Sparks.22K.AIFF", 0x100 / 2);
+ break;
+ default:
+ loadLoopSound2("");
+ break;
+ }
+ }
+}
+
+void Mars::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kMars02, kSouth):
+ case MakeRoomView(kMars19, kEast):
+ case MakeRoomView(kMars22, kNorth):
+ case MakeRoomView(kMars43, kEast):
+ case MakeRoomView(kMars51, kEast):
+ case MakeRoomView(kMars56, kEast):
+ case MakeRoomView(kMars60, kWest):
+ case MakeRoomView(kMarsMaze004, kWest):
+ case MakeRoomView(kMarsMaze009, kWest):
+ case MakeRoomView(kMarsMaze012, kWest):
+ case MakeRoomView(kMarsMaze037, kWest):
+ case MakeRoomView(kMarsMaze047, kNorth):
+ case MakeRoomView(kMarsMaze052, kWest):
+ case MakeRoomView(kMarsMaze057, kNorth):
+ case MakeRoomView(kMarsMaze071, kWest):
+ case MakeRoomView(kMarsMaze081, kNorth):
+ case MakeRoomView(kMarsMaze088, kWest):
+ case MakeRoomView(kMarsMaze093, kWest):
+ case MakeRoomView(kMarsMaze115, kNorth):
+ case MakeRoomView(kMarsMaze120, kWest):
+ case MakeRoomView(kMarsMaze126, kEast):
+ case MakeRoomView(kMarsMaze133, kNorth):
+ case MakeRoomView(kMarsMaze144, kNorth):
+ case MakeRoomView(kMarsMaze156, kEast):
+ case MakeRoomView(kMarsMaze162, kNorth):
+ case MakeRoomView(kMarsMaze177, kWest):
+ case MakeRoomView(kMarsMaze180, kNorth):
+ case MakeRoomView(kMarsMaze187, kWest):
+ case MakeRoomView(kMarsMaze199, kWest):
+ makeContinuePoint();
+ break;
+ case MakeRoomView(kMars05, kEast):
+ case MakeRoomView(kMars06, kEast):
+ case MakeRoomView(kMars07, kEast):
+ if (GameState.getMarsSecurityDown())
+ makeContinuePoint();
+ break;
+ case MakeRoomView(kMars46, kSouth):
+ if (!GameState.getMarsSeenRobotAtReactor())
+ makeContinuePoint();
+ break;
+ case MakeRoomView(kMars46, kWest):
+ if (GameState.getMarsAvoidedReactorRobot())
+ makeContinuePoint();
+ break;
+ }
+}
+
+void Mars::launchMaze007Robot() {
+ startExtraLongSequence(kMarsMaze007RobotApproach, kMarsMaze007RobotDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze007RobotLoopingTime, kMarsMovieScale, kMaze007RobotLoopingEvent);
+}
+
+void Mars::launchMaze015Robot() {
+ startExtraLongSequence(kMarsMaze015SouthRobotApproach, kMarsMaze015SouthRobotDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze015RobotLoopingTime, kMarsMovieScale, kMaze015RobotLoopingEvent);
+}
+
+void Mars::launchMaze101Robot() {
+ startExtraLongSequence(kMarsMaze101EastRobotApproach, kMarsMaze101EastRobotDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze101RobotLoopingTime, kMarsMovieScale, kMaze101RobotLoopingEvent);
+}
+
+void Mars::launchMaze104Robot() {
+ startExtraLongSequence(kMarsMaze104WestLoop, kMarsMaze104WestDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze104RobotLoopingTime, kMarsMovieScale, kMaze104RobotLoopingEvent);
+}
+
+void Mars::launchMaze133Robot() {
+ startExtraLongSequence(kMarsMaze133SouthApproach, kMarsMaze133SouthDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze133RobotLoopingTime, kMarsMovieScale, kMaze133RobotLoopingEvent);
+}
+
+void Mars::launchMaze136Robot() {
+ startExtraLongSequence(kMarsMaze136NorthApproach, kMarsMaze136NorthDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze136RobotLoopingTime, kMarsMovieScale, kMaze136RobotLoopingEvent);
+}
+
+void Mars::launchMaze184Robot() {
+ startExtraLongSequence(kMarsMaze184WestLoop, kMarsMaze184WestDeath, kExtraCompletedFlag, kFilterAllInput);
+ scheduleEvent(kMaze184RobotLoopingTime, kMarsMovieScale, kMaze184RobotLoopingEvent);
+}
+
+void Mars::timerExpired(const uint32 eventType) {
+ switch (eventType) {
+ case kMaze007RobotLoopingEvent:
+ case kMaze015RobotLoopingEvent:
+ case kMaze101RobotLoopingEvent:
+ case kMaze104RobotLoopingEvent:
+ case kMaze133RobotLoopingEvent:
+ case kMaze136RobotLoopingEvent:
+ case kMaze184RobotLoopingEvent:
+ _interruptionFilter = kFilterNoInput;
+ break;
+ }
+}
+
+void Mars::arriveAt(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kMars18, kNorth):
+ if (GameState.getMarsPodAtUpperPlatform())
+ setCurrentAlternate(kAltMarsPodAtMars34);
+ break;
+ case MakeRoomView(kMars27, kEast):
+ case MakeRoomView(kMars29, kEast):
+ if (GameState.isTakenItemID(kMarsCard))
+ setCurrentAlternate(kAltMarsTookCard);
+ else
+ setCurrentAlternate(kAltMarsNormal);
+ break;
+ case MakeRoomView(kMars35, kEast):
+ case MakeRoomView(kMars35, kWest):
+ if (GameState.getMarsAirlockOpen())
+ setCurrentAlternate(kAltMars35AirlockWest);
+ else
+ setCurrentAlternate(kAltMars35AirlockEast);
+ break;
+ case MakeRoomView(kMars60, kEast):
+ case MakeRoomView(kMars60, kWest):
+ if (GameState.getMarsAirlockOpen())
+ setCurrentAlternate(kAltMars60AirlockEast);
+ else
+ setCurrentAlternate(kAltMars60AirlockWest);
+ break;
+ case MakeRoomView(kMars45, kNorth):
+ case MakeRoomView(kMars45, kSouth):
+ case MakeRoomView(kMars45, kEast):
+ case MakeRoomView(kMars45, kWest):
+ GameState.setMarsPodAtUpperPlatform(false);
+ setCurrentAlternate(kAltMarsPodAtMars45);
+ break;
+ case MakeRoomView(kMars46, kNorth):
+ case MakeRoomView(kMars46, kSouth):
+ case MakeRoomView(kMars46, kEast):
+ case MakeRoomView(kMars46, kWest):
+ case MakeRoomView(kMars47, kNorth):
+ case MakeRoomView(kMars47, kSouth):
+ case MakeRoomView(kMars47, kEast):
+ case MakeRoomView(kMars47, kWest):
+ if (GameState.getMarsPodAtUpperPlatform())
+ setCurrentAlternate(kAltMarsNormal);
+ else
+ setCurrentAlternate(kAltMarsPodAtMars45);
+ break;
+ case MakeRoomView(kMars48, kNorth):
+ case MakeRoomView(kMars48, kSouth):
+ case MakeRoomView(kMars48, kEast):
+ case MakeRoomView(kMars48, kWest):
+ case MakeRoomView(kMars49, kNorth):
+ case MakeRoomView(kMars49, kEast):
+ case MakeRoomView(kMars49, kWest):
+ if (GameState.isTakenItemID(kAirMask))
+ setCurrentAlternate(kAltMarsTookMask);
+ else
+ setCurrentAlternate(kAltMarsNormal);
+ break;
+ case MakeRoomView(kMars49, kSouth):
+ if (GameState.getMarsMaskOnFiller())
+ setCurrentAlternate(kAltMarsMaskOnFiller);
+ else if (GameState.isTakenItemID(kAirMask))
+ setCurrentAlternate(kAltMarsTookMask);
+ else
+ setCurrentAlternate(kAltMarsNormal);
+ break;
+ }
+
+ Neighborhood::arriveAt(room, direction);
+ checkAirlockDoors();
+ setUpReactorEnergyDrain();
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kMars0A, kNorth):
+ if (!GameState.getMarsSeenTimeStream())
+ startExtraLongSequence(kMarsArrivalFromTSA, kMars0AWatchShuttleDepart, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kMars07, kSouth):
+ case MakeRoomView(kMars13, kNorth):
+ if (!GameState.getMarsHeardCheckInMessage()) {
+ playSpotSoundSync(kMarsCheckInRequiredIn, kMarsCheckInRequiredOut);
+ GameState.setMarsHeardCheckInMessage(true);
+ }
+ break;
+ case MakeRoomView(kMars44, kWest):
+ if (GameState.getMarsReadyForShuttleTransport())
+ startUpFromFinishedSpaceChase();
+ else if (GameState.getMarsFinishedCanyonChase())
+ startUpFromSpaceChase();
+ else
+ _neighborhoodNotification.setNotificationFlags(kTimeForCanyonChaseFlag, kTimeForCanyonChaseFlag);
+ break;
+ case MakeRoomView(kMars10, kNorth):
+ if (!GameState.getMarsRobotThrownPlayer())
+ startExtraSequence(kRobotThrowsPlayer, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kMars11, kSouth):
+ case MakeRoomView(kMars12, kSouth):
+ setCurrentActivation(kActivationReadyForKiosk);
+ break;
+ case MakeRoomView(kMars15, kWest):
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSecurityDown()) {
+ playSpotSoundSync(kMarsShuttle2DepartedIn, kMarsShuttle2DepartedOut);
+ restoreStriding(kMars17, kWest, kAltMarsNormal);
+ GameState.setMarsSecurityDown(true);
+ }
+ break;
+ case MakeRoomView(kMars17, kNorth):
+ case MakeRoomView(kMars17, kSouth):
+ case MakeRoomView(kMars17, kEast):
+ case MakeRoomView(kMars17, kWest):
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSecurityDown())
+ forceStridingStop(kMars17, kWest, kAltMarsNormal);
+
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSawRobotLeave()) {
+ startExtraSequence(kRobotOnWayToShuttle, kExtraCompletedFlag, kFilterNoInput);
+ restoreStriding(kMars19, kWest, kAltMarsNormal);
+ GameState.setMarsSawRobotLeave(true);
+ }
+ break;
+ case MakeRoomView(kMars19, kNorth):
+ case MakeRoomView(kMars19, kSouth):
+ case MakeRoomView(kMars19, kWest):
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSawRobotLeave())
+ forceStridingStop(kMars19, kWest, kAltMarsNormal);
+
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSecurityDown())
+ forceStridingStop(kMars17, kWest, kAltMarsNormal);
+ break;
+ case MakeRoomView(kMars19, kEast):
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSawRobotLeave())
+ forceStridingStop(kMars19, kWest, kAltMarsNormal);
+
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSecurityDown())
+ forceStridingStop(kMars17, kWest, kAltMarsNormal);
+ break;
+ case MakeRoomView(kMars32, kNorth):
+ if (!GameState.getMarsPodAtUpperPlatform()) {
+ playSpotSoundSync(kMarsPodArrivedUpperPlatformIn, kMarsPodArrivedUpperPlatformOut);
+ GameState.setMarsPodAtUpperPlatform(true);
+ }
+ break;
+ case MakeRoomView(kMars33North, kNorth):
+ setCurrentActivation(kActivationTunnelMapReady);
+ // Fall through...
+ case MakeRoomView(kMars33, kSouth):
+ case MakeRoomView(kMars33, kEast):
+ case MakeRoomView(kMars33, kWest):
+ case MakeRoomView(kMars32, kSouth):
+ case MakeRoomView(kMars32, kEast):
+ case MakeRoomView(kMars32, kWest):
+ if (!GameState.getMarsPodAtUpperPlatform())
+ GameState.setMarsPodAtUpperPlatform(true);
+ break;
+ case MakeRoomView(kMars34, kNorth):
+ startExtraSequence(kMars34NorthPodGreeting, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kMars34, kSouth):
+ case MakeRoomView(kMars45, kNorth):
+ setCurrentActivation(kActivateMarsPodClosed);
+ break;
+ case MakeRoomView(kMars35, kWest):
+ if (GameState.getMarsThreadedMaze() && !GameState.getMarsSecurityDown())
+ forceStridingStop(kMars19, kWest, kAltMarsNormal);
+ // Fall through...
+ case MakeRoomView(kMars60, kEast):
+ if (!GameState.getMarsAirlockOpen())
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ break;
+ case MakeRoomView(kMars35, kEast):
+ case MakeRoomView(kMars60, kWest):
+ if (GameState.getMarsAirlockOpen())
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ break;
+ case MakeRoomView(kMars39, kWest):
+ if (GameState.getLastRoom() == kMarsMaze200)
+ GameState.setMarsPodAtUpperPlatform(false);
+ break;
+ case MakeRoomView(kMars45, kSouth):
+ // Set up maze doors here.
+ // Doing it here makes sure that it will be the same if the player comes
+ // back out of the maze and goes back in, but will vary if
+ // the player comes back down to the maze a second time.
+ GameState.setMarsMazeDoorPair1(_vm->getRandomBit());
+ GameState.setMarsMazeDoorPair2(_vm->getRandomBit());
+ GameState.setMarsMazeDoorPair3(_vm->getRandomBit());
+ GameState.setMarsArrivedBelow(true);
+ break;
+ case MakeRoomView(kMars48, kEast):
+ if (!GameState.getMarsSeenRobotAtReactor()) {
+ // Preload the looping sound...
+ loadLoopSound2("Sounds/Mars/Robot Loop.aiff", 0, 0, 0);
+ startExtraSequence(kMars48RobotApproaches, kExtraCompletedFlag, kFilterNoInput);
+ } else if (!GameState.getMarsAvoidedReactorRobot()) {
+ loadLoopSound2("Sounds/Mars/Robot Loop.aiff", 0x100, 0, 0);
+ loopExtraSequence(kMars48RobotLoops);
+ _utilityFuse.primeFuse(kMarsRobotPatienceLimit);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::robotTiredOfWaiting));
+ _utilityFuse.lightFuse();
+ }
+ break;
+ case MakeRoomView(kMars48, kSouth):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot()) {
+ loadLoopSound2("Sounds/Mars/Robot Loop.aiff", 0x100, 0, 0);
+ _utilityFuse.primeFuse(kMarsRobotPatienceLimit);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::robotTiredOfWaiting));
+ _utilityFuse.lightFuse();
+ }
+ break;
+ case MakeRoomView(kMars49, kSouth):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot()) {
+ playSpotSoundSync(kMarsRobotTakesTransportIn, kMarsRobotTakesTransportOut);
+ playSpotSoundSync(kMarsPodDepartedLowerPlatformIn, kMarsPodDepartedLowerPlatformOut);
+ GameState.setMarsAvoidedReactorRobot(true);
+ GameState.setMarsPodAtUpperPlatform(true);
+ GameState.setScoringAvoidedRobot();
+ }
+
+ if (GameState.isTakenItemID(kAirMask))
+ setCurrentActivation(kActivateHotSpotAlways);
+ else if (GameState.getMarsMaskOnFiller())
+ setCurrentActivation(kActivateMaskOnFiller);
+ else
+ setCurrentActivation(kActivateMaskOnHolder);
+ break;
+ case MakeRoomView(kMars51, kWest):
+ case MakeRoomView(kMars50, kWest):
+ case MakeRoomView(kMars48, kWest):
+ if (GameState.getShieldOn())
+ g_shield->setItemState(kShieldNormal);
+ g_energyMonitor->setEnergyDrainRate(kEnergyDrainNormal);
+ _vm->resetEnergyDeathReason();
+ break;
+ case MakeRoomView(kMars52, kNorth):
+ case MakeRoomView(kMars52, kSouth):
+ case MakeRoomView(kMars52, kEast):
+ case MakeRoomView(kMars52, kWest):
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kWest):
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ setCurrentActivation(kActivateReactorPlatformOut);
+ break;
+ case MakeRoomView(kMars56, kEast):
+ if (GameState.getMarsLockBroken()) {
+ setCurrentActivation(kActivateReactorAskOperation);
+ _privateFlags.setFlag(kMarsPrivatePlatformZoomedInFlag, true);
+ } else if (GameState.getMarsLockFrozen()) {
+ setCurrentActivation(kActivateReactorReadyForCrowBar);
+ _privateFlags.setFlag(kMarsPrivatePlatformZoomedInFlag, true);
+ _utilityFuse.primeFuse(kLockFreezeTimeLmit);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::lockThawed));
+ _utilityFuse.lightFuse();
+ } else {
+ setCurrentActivation(kActivateReactorPlatformOut);
+ }
+ break;
+ case MakeRoomView(kMarsRobotShuttle, kEast):
+ setCurrentActivation(kActivationRobotHeadClosed);
+ break;
+ case MakeRoomView(kMarsMaze007, kNorth):
+ launchMaze007Robot();
+ break;
+ case MakeRoomView(kMarsMaze015, kSouth):
+ launchMaze015Robot();
+ break;
+ case MakeRoomView(kMarsMaze101, kEast):
+ launchMaze101Robot();
+ break;
+ case MakeRoomView(kMarsMaze104, kWest):
+ launchMaze104Robot();
+ break;
+ case MakeRoomView(kMarsMaze133, kSouth):
+ launchMaze133Robot();
+ break;
+ case MakeRoomView(kMarsMaze136, kNorth):
+ launchMaze136Robot();
+ break;
+ case MakeRoomView(kMarsMaze184, kWest):
+ launchMaze184Robot();
+ break;
+ case MakeRoomView(kMarsMaze199, kSouth):
+ GameState.setScoringThreadedMaze();
+ GameState.setMarsThreadedMaze(true);
+ break;
+ case MakeRoomView(kMarsDeathRoom, kNorth):
+ case MakeRoomView(kMarsDeathRoom, kSouth):
+ case MakeRoomView(kMarsDeathRoom, kEast):
+ case MakeRoomView(kMarsDeathRoom, kWest):
+ switch (GameState.getLastRoom()) {
+ case kMars39:
+ die(kDeathDidntLeaveBucket);
+ break;
+ case kMars46:
+ die(kDeathRunOverByPod);
+ break;
+ }
+ break;
+ }
+
+ checkAirMask();
+}
+
+void Mars::shieldOn() {
+ setUpReactorEnergyDrain();
+}
+
+void Mars::shieldOff() {
+ setUpReactorEnergyDrain();
+}
+
+void Mars::turnTo(const DirectionConstant direction) {
+ switch (MakeRoomView(GameState.getCurrentRoom(), direction)) {
+ case MakeRoomView(kMars27, kNorth):
+ case MakeRoomView(kMars27, kSouth):
+ case MakeRoomView(kMars27, kEast):
+ case MakeRoomView(kMars29, kNorth):
+ case MakeRoomView(kMars29, kSouth):
+ case MakeRoomView(kMars29, kEast):
+ if (GameState.isTakenItemID(kMarsCard))
+ setCurrentAlternate(kAltMarsTookCard);
+ break;
+ case MakeRoomView(kMars35, kNorth):
+ case MakeRoomView(kMars35, kSouth):
+ case MakeRoomView(kMars60, kNorth):
+ case MakeRoomView(kMars60, kSouth):
+ if (getCurrentActivation() == kActivateAirlockPressurized)
+ playSpotSoundSync(kMarsAirlockPressurizeIn, kMarsAirlockPressurizeOut);
+ break;
+ }
+
+ Neighborhood::turnTo(direction);
+
+ switch (MakeRoomView(GameState.getCurrentRoom(), direction)) {
+ case MakeRoomView(kMars11, kSouth):
+ case MakeRoomView(kMars12, kSouth):
+ setCurrentActivation(kActivationReadyForKiosk);
+ break;
+ case MakeRoomView(kMars18, kNorth):
+ if (GameState.getMarsPodAtUpperPlatform())
+ setCurrentAlternate(kAltMarsPodAtMars34);
+ break;
+ case MakeRoomView(kMars22, kSouth):
+ if (!GameState.getMarsHeardCheckInMessage()) {
+ playSpotSoundSync(kMarsCheckInRequiredIn, kMarsCheckInRequiredOut);
+ GameState.setMarsHeardCheckInMessage(true);
+ }
+ break;
+ case MakeRoomView(kMars34, kSouth):
+ case MakeRoomView(kMars45, kNorth):
+ setCurrentActivation(kActivateMarsPodClosed);
+ break;
+ case MakeRoomView(kMars34, kNorth):
+ startExtraSequence(kMars34NorthPodGreeting, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kMars35, kEast):
+ case MakeRoomView(kMars60, kWest):
+ if (GameState.getMarsAirlockOpen())
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ break;
+ case MakeRoomView(kMars60, kEast):
+ if (!GameState.getMarsAirlockOpen())
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ break;
+ case MakeRoomView(kMars35, kWest):
+ if (!GameState.getMarsAirlockOpen())
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+
+ // Do this here because this will be called after spinning the airlock after
+ // going through the gear room.
+ if (GameState.getMarsThreadedMaze())
+ GameState.setScoringThreadedGearRoom();
+ break;
+ case MakeRoomView(kMars48, kNorth):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot())
+ die(kDeathDidntGetOutOfWay);
+ break;
+ case MakeRoomView(kMars48, kEast):
+ if (!GameState.getMarsSeenRobotAtReactor()) {
+ // Preload the looping sound...
+ loadLoopSound2("Sounds/Mars/Robot Loop.aiff", 0, 0, 0);
+ startExtraSequence(kMars48RobotApproaches, kExtraCompletedFlag, kFilterNoInput);
+ } else if (!GameState.getMarsAvoidedReactorRobot()) {
+ loopExtraSequence(kMars48RobotLoops);
+ } else if (GameState.isTakenItemID(kAirMask)) {
+ setCurrentAlternate(kAltMarsTookMask);
+ } else {
+ setCurrentAlternate(kAltMarsNormal);
+ }
+ break;
+ case MakeRoomView(kMars48, kWest):
+ if (GameState.getMarsSeenRobotAtReactor() && !GameState.getMarsAvoidedReactorRobot())
+ die(kDeathDidntGetOutOfWay);
+ else if (GameState.isTakenItemID(kAirMask))
+ setCurrentAlternate(kAltMarsTookMask);
+ else
+ setCurrentAlternate(kAltMarsNormal);
+ break;
+ case MakeRoomView(kMars49, kSouth):
+ if (GameState.isTakenItemID(kAirMask))
+ setCurrentActivation(kActivateHotSpotAlways);
+ else
+ setCurrentActivation(kActivateMaskOnHolder);
+ break;
+ case MakeRoomView(kMars52, kNorth):
+ case MakeRoomView(kMars52, kSouth):
+ case MakeRoomView(kMars52, kEast):
+ case MakeRoomView(kMars52, kWest):
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kEast):
+ case MakeRoomView(kMars56, kWest):
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ setCurrentActivation(kActivateReactorPlatformOut);
+ break;
+ case MakeRoomView(kMarsMaze007, kNorth):
+ launchMaze007Robot();
+ break;
+ case MakeRoomView(kMarsMaze015, kSouth):
+ launchMaze015Robot();
+ break;
+ case MakeRoomView(kMarsMaze101, kEast):
+ launchMaze101Robot();
+ break;
+ case MakeRoomView(kMarsMaze104, kWest):
+ launchMaze104Robot();
+ break;
+ case MakeRoomView(kMarsMaze133, kSouth):
+ launchMaze133Robot();
+ break;
+ case MakeRoomView(kMarsMaze136, kNorth):
+ launchMaze136Robot();
+ break;
+ case MakeRoomView(kMarsMaze184, kWest):
+ launchMaze184Robot();
+ break;
+ }
+}
+
+void Mars::activateOneHotspot(HotspotInfoTable::Entry &entry, Hotspot *hotspot) {
+ switch (hotspot->getObjectID()) {
+ case kMars57RedMoveSpotID:
+ case kMars57YellowMoveSpotID:
+ case kMars57GreenMoveSpotID:
+ if (!_choiceHighlight.choiceHighlighted(hotspot->getObjectID() - kMars57RedMoveSpotID))
+ hotspot->setActive();
+ break;
+ case kMars57BlueMoveSpotID:
+ if (_reactorStage >= 2 && !_choiceHighlight.choiceHighlighted(3))
+ hotspot->setActive();
+ break;
+ case kMars57PurpleMoveSpotID:
+ if (_reactorStage == 3 && !_choiceHighlight.choiceHighlighted(4))
+ hotspot->setActive();
+ break;
+ default:
+ Neighborhood::activateOneHotspot(entry, hotspot);
+ break;
+ }
+}
+
+void Mars::activateHotspots() {
+ InventoryItem *item;
+
+ Neighborhood::activateHotspots();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars48, kEast):
+ if ((_navMovie.getFlags() & kLoopTimeBase) != 0 && _vm->getDragType() == kDragInventoryUse)
+ _vm->getAllHotspots().activateOneHotspot(kAttackRobotHotSpotID);
+ break;
+ case MakeRoomView(kMars56, kEast):
+ switch (getCurrentActivation()) {
+ case kActivateReactorReadyForNitrogen:
+ item = (InventoryItem *)_vm->getAllItems().findItemByID(kNitrogenCanister);
+ if (item->getItemState() != kNitrogenFull)
+ _vm->getAllHotspots().deactivateOneHotspot(kMars57DropNitrogenSpotID);
+ // Fall through...
+ case kActivateReactorReadyForCrowBar:
+ _vm->getAllHotspots().activateOneHotspot(kMars57CantOpenPanelSpotID);
+ break;
+ }
+ break;
+ case MakeRoomView(kMarsRobotShuttle, kEast):
+ if (_privateFlags.getFlag(kMarsPrivateGotMapChipFlag))
+ _vm->getAllHotspots().deactivateOneHotspot(kRobotShuttleMapChipSpotID);
+ else
+ _vm->getAllHotspots().activateOneHotspot(kRobotShuttleMapChipSpotID);
+
+ if (_privateFlags.getFlag(kMarsPrivateGotOpticalChipFlag))
+ _vm->getAllHotspots().deactivateOneHotspot(kRobotShuttleOpticalChipSpotID);
+ else
+ _vm->getAllHotspots().activateOneHotspot(kRobotShuttleOpticalChipSpotID);
+
+ if (_privateFlags.getFlag(kMarsPrivateGotShieldChipFlag))
+ _vm->getAllHotspots().deactivateOneHotspot(kRobotShuttleShieldChipSpotID);
+ else
+ _vm->getAllHotspots().activateOneHotspot(kRobotShuttleShieldChipSpotID);
+ break;
+ default:
+ if (_privateFlags.getFlag(kMarsPrivateInSpaceChaseFlag)) {
+ if (GameState.getMarsReadyForShuttleTransport()) {
+ _shuttleTransportSpot.setActive();
+ } else {
+ _energyChoiceSpot.setActive();
+ _gravitonChoiceSpot.setActive();
+ _tractorChoiceSpot.setActive();
+ if (_weaponSelection != kNoWeapon)
+ _shuttleViewSpot.setActive();
+ }
+ }
+ break;
+ }
+}
+
+void Mars::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ switch (clickedSpot->getObjectID()) {
+ case kMars11NorthKioskSpotID:
+ case kMars12NorthKioskSpotID:
+ playSpotSoundSync(kMarsKioskBeepIn, kMarsKioskBeepOut);
+ Neighborhood::clickInHotspot(input, clickedSpot);
+ break;
+ case kMars11NorthKioskSightsSpotID:
+ case kMars12NorthKioskSightsSpotID:
+ playSpotSoundSync(kMarsKioskBeepIn, kMarsKioskBeepOut);
+ if (!startExtraSequenceSync(kMarsSightsInfo, kFilterAllInput))
+ showExtraView(kMarsInfoKioskIntro);
+ break;
+ case kMars11NorthKioskColonySpotID:
+ case kMars12NorthKioskColonySpotID:
+ playSpotSoundSync(kMarsKioskBeepIn, kMarsKioskBeepOut);
+ if (!startExtraSequenceSync(kMarsColonyInfo, kFilterAllInput))
+ showExtraView(kMarsInfoKioskIntro);
+ break;
+ case kMars33NorthMonitorSpotID:
+ switch (_lastExtra) {
+ case kMars33SlideShow1:
+ startExtraSequence(kMars33SlideShow2, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars33SlideShow2:
+ startExtraSequence(kMars33SlideShow3, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars33SlideShow3:
+ startExtraSequence(kMars33SlideShow4, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars33SlideShow4:
+ // Should never happen...
+ default:
+ startExtraSequence(kMars33SlideShow1, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ break;
+ case kMars34SouthOpenStorageSpotID:
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars34SpotOpenNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars34SpotOpenWithBar, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars34SouthCloseStorageSpotID:
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars34SpotCloseNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars34SpotCloseWithBar, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars35WestPressurizeSpotID:
+ case kMars35EastPressurizeSpotID:
+ case kMars60WestPressurizeSpotID:
+ case kMars60EastPressurizeSpotID:
+ playSpotSoundSync(kMarsAirlockButtonBeepIn, kMarsAirlockButtonBeepOut);
+ playSpotSoundSync(kMarsAirlockPressurizeIn, kMarsAirlockPressurizeOut);
+ setCurrentActivation(kActivateAirlockPressurized);
+ break;
+ case kMars45NorthOpenStorageSpotID:
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars45SpotOpenNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars45SpotOpenWithBar, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars45NorthCloseStorageSpotID:
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars45SpotCloseNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars45SpotCloseWithBar, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars56ExtractSpotID:
+ if (GameState.isTakenItemID(kCardBomb)) {
+ startExtraSequence(kMars56ExtendNoBomb, kExtraCompletedFlag, kFilterNoInput);
+ setCurrentActivation(kActivateReactorPlatformIn);
+ } else {
+ startExtraSequence(kMars56ExtendWithBomb, kExtraCompletedFlag, kFilterNoInput);
+ setCurrentActivation(kActivateReactorAskLowerScreen);
+ }
+ break;
+ case kMars57UndoMoveSpotID:
+ playSpotSoundSync(kMarsColorMatchingButtonBeepIn, kMarsColorMatchingButtonBeepOut);
+ doUndoOneGuess();
+ break;
+ case kMars57RedMoveSpotID:
+ playSpotSoundSync(kMarsColorMatchingButtonBeepIn, kMarsColorMatchingButtonBeepOut);
+ doReactorGuess(0);
+ break;
+ case kMars57YellowMoveSpotID:
+ playSpotSoundSync(kMarsColorMatchingButtonBeepIn, kMarsColorMatchingButtonBeepOut);
+ doReactorGuess(1);
+ break;
+ case kMars57GreenMoveSpotID:
+ playSpotSoundSync(kMarsColorMatchingButtonBeepIn, kMarsColorMatchingButtonBeepOut);
+ doReactorGuess(2);
+ break;
+ case kMars57BlueMoveSpotID:
+ playSpotSoundSync(kMarsColorMatchingButtonBeepIn, kMarsColorMatchingButtonBeepOut);
+ doReactorGuess(3);
+ break;
+ case kMars57PurpleMoveSpotID:
+ playSpotSoundSync(kMarsColorMatchingButtonBeepIn, kMarsColorMatchingButtonBeepOut);
+ doReactorGuess(4);
+ break;
+ case kShuttleEnergySpotID:
+ case kShuttleGravitonSpotID:
+ case kShuttleTractorSpotID:
+ case kShuttleViewSpotID:
+ case kShuttleTransportSpotID:
+ spaceChaseClick(input, clickedSpot->getObjectID());
+ break;
+ default:
+ Neighborhood::clickInHotspot(input, clickedSpot);
+ break;
+ }
+}
+
+InputBits Mars::getInputFilter() {
+ InputBits result = Neighborhood::getInputFilter();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars49, kSouth):
+ if (GameState.getMarsMaskOnFiller())
+ // Can't move when mask is on filler.
+ result &= ~kFilterAllDirections;
+ break;
+ case MakeRoomView(kMars52, kNorth):
+ case MakeRoomView(kMars52, kSouth):
+ case MakeRoomView(kMars52, kEast):
+ case MakeRoomView(kMars52, kWest):
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kEast):
+ case MakeRoomView(kMars56, kWest):
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ if (_privateFlags.getFlag(kMarsPrivatePlatformZoomedInFlag))
+ // Can't move when platform is extended.
+ result &= ~kFilterAllDirections;
+ break;
+ case MakeRoomView(kMars44, kWest):
+ if (_canyonChaseMovie.isMovieValid() && _canyonChaseMovie.isRunning())
+ result &= ~kFilterAllDirections;
+ break;
+ }
+
+ return result;
+}
+
+// Only called when trying to pick up an item and the player can't (because
+// the inventory is too full or because the player lets go of the item before
+// dropping it into the inventory).
+Hotspot *Mars::getItemScreenSpot(Item *item, DisplayElement *element) {
+ HotSpotID destSpotID;
+
+ switch (item->getObjectID()) {
+ case kCardBomb:
+ destSpotID = kMars57GrabBombSpotID;
+ break;
+ case kMarsCard:
+ destSpotID = kMars31SouthCardSpotID;
+ break;
+ case kAirMask:
+ if (GameState.getMarsMaskOnFiller())
+ destSpotID = kMars49AirFillingDropSpotID;
+ else
+ destSpotID = kMars49AirMaskSpotID;
+ break;
+ case kCrowbar:
+ if (GameState.getCurrentRoom() == kMars34)
+ destSpotID = kMars34SouthCrowbarSpotID;
+ else
+ destSpotID = kMars45NorthCrowbarSpotID;
+ break;
+ case kMapBiochip:
+ destSpotID = kRobotShuttleMapChipSpotID;
+ break;
+ case kOpticalBiochip:
+ destSpotID = kRobotShuttleOpticalChipSpotID;
+ break;
+ case kShieldBiochip:
+ destSpotID = kRobotShuttleShieldChipSpotID;
+ break;
+ default:
+ destSpotID = kNoHotSpotID;
+ break;
+ }
+
+ if (destSpotID == kNoHotSpotID)
+ return Neighborhood::getItemScreenSpot(item, element);
+
+ return _vm->getAllHotspots().findHotspotByID(destSpotID);
+}
+
+void Mars::takeItemFromRoom(Item *item) {
+ switch (item->getObjectID()) {
+ case kAirMask:
+ setCurrentAlternate(kAltMarsTookMask);
+ break;
+ case kCardBomb:
+ _privateFlags.setFlag(kMarsPrivateDraggingBombFlag, true);
+ break;
+ case kMapBiochip:
+ _privateFlags.setFlag(kMarsPrivateGotMapChipFlag, true);
+ break;
+ case kShieldBiochip:
+ _privateFlags.setFlag(kMarsPrivateGotShieldChipFlag, true);
+ break;
+ case kOpticalBiochip:
+ _privateFlags.setFlag(kMarsPrivateGotOpticalChipFlag, true);
+ break;
+ }
+
+ Neighborhood::takeItemFromRoom(item);
+}
+
+void Mars::pickedUpItem(Item *item) {
+ switch (item->getObjectID()) {
+ case kAirMask:
+ setCurrentActivation(kActivateHotSpotAlways);
+ if (!GameState.getScoringGotOxygenMask()) {
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Mars/XM48SB", false, kWarningInterruption);
+ GameState.setScoringGotOxygenMask();
+ }
+ break;
+ case kCrowbar:
+ GameState.setScoringGotCrowBar();
+ g_AIArea->checkMiddleArea();
+ break;
+ case kMarsCard:
+ GameState.setScoringGotMarsCard();
+ g_AIArea->checkMiddleArea();
+ break;
+ case kCardBomb:
+ GameState.setScoringGotCardBomb();
+ if (GameState.getMarsLockBroken()) {
+ startExtraSequence(kMars57BackToNormal, kExtraCompletedFlag, kFilterNoInput);
+ GameState.setMarsLockBroken(false);
+ }
+
+ _privateFlags.setFlag(kMarsPrivateDraggingBombFlag, false);
+ break;
+ case kMapBiochip:
+ if (_privateFlags.getFlag(kMarsPrivateGotMapChipFlag) &&
+ _privateFlags.getFlag(kMarsPrivateGotShieldChipFlag) &&
+ _privateFlags.getFlag(kMarsPrivateGotOpticalChipFlag)) {
+ GameState.setMarsFinished(true);
+ GameState.setScoringMarsGandhi();
+ startExtraSequence(kMarsRobotHeadClose, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kShieldBiochip:
+ if (_privateFlags.getFlag(kMarsPrivateGotMapChipFlag) &&
+ _privateFlags.getFlag(kMarsPrivateGotShieldChipFlag) &&
+ _privateFlags.getFlag(kMarsPrivateGotOpticalChipFlag)) {
+ GameState.setMarsFinished(true);
+ GameState.setScoringMarsGandhi();
+ startExtraSequence(kMarsRobotHeadClose, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kOpticalBiochip:
+ g_opticalChip->addAries();
+ GameState.setScoringGotMarsOpMemChip();
+
+ if (_privateFlags.getFlag(kMarsPrivateGotMapChipFlag) &&
+ _privateFlags.getFlag(kMarsPrivateGotShieldChipFlag) &&
+ _privateFlags.getFlag(kMarsPrivateGotOpticalChipFlag)) {
+ GameState.setMarsFinished(true);
+ GameState.setScoringMarsGandhi();
+ startExtraSequence(kMarsRobotHeadClose, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ }
+}
+
+void Mars::dropItemIntoRoom(Item *item, Hotspot *dropSpot) {
+ if (dropSpot->getObjectID() == kAttackRobotHotSpotID) {
+ _attackingItem = (InventoryItem *)item;
+ startExtraSequence(kMars48RobotDefends, kExtraCompletedFlag, kFilterNoInput);
+ loadLoopSound2("");
+ } else {
+ switch (item->getObjectID()) {
+ case kMarsCard:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ if (dropSpot && dropSpot->getObjectID() == kMars34NorthCardDropSpotID)
+ startExtraSequence(kMarsTurnOnPod, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kNitrogenCanister:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ if (dropSpot && dropSpot->getObjectID() == kMars57DropNitrogenSpotID)
+ startExtraSequence(kMars57FreezeLock, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kCrowbar:
+ _utilityFuse.stopFuse();
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ if (dropSpot && dropSpot->getObjectID() == kMars57DropCrowBarSpotID)
+ startExtraSequence(kMars57BreakLock, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kAirMask:
+ if (dropSpot) {
+ if (dropSpot->getObjectID() == kMars49AirFillingDropSpotID) {
+ if (!GameState.getMarsMaskOnFiller()) {
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ startExtraSequence(kMars49SouthViewMaskFilling, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ setCurrentActivation(kActivateMaskOnFiller);
+ setCurrentAlternate(kAltMarsMaskOnFiller);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ }
+ } else if (dropSpot->getObjectID() == kMars49AirMaskSpotID) {
+ setCurrentAlternate(kAltMarsNormal);
+ setCurrentActivation(kActivateMaskOnHolder);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ }
+ }
+ break;
+ case kCardBomb:
+ _privateFlags.setFlag(kMarsPrivateDraggingBombFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ case kMapBiochip:
+ _privateFlags.setFlag(kMarsPrivateGotMapChipFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ case kShieldBiochip:
+ _privateFlags.setFlag(kMarsPrivateGotShieldChipFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ case kOpticalBiochip:
+ _privateFlags.setFlag(kMarsPrivateGotOpticalChipFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ default:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ }
+ }
+}
+
+void Mars::robotTiredOfWaiting() {
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kMars48, kEast)) {
+ if (_attackingItem) {
+ startExtraSequence(kMars48RobotKillsPlayer, kExtraCompletedFlag, kFilterNoInput);
+ loadLoopSound2("");
+ } else {
+ _privateFlags.setFlag(kMarsPrivateRobotTiredOfWaitingFlag, true);
+ }
+ } else {
+ die(kDeathDidntGetOutOfWay);
+ }
+}
+
+void Mars::turnLeft() {
+ if (isEventTimerRunning())
+ cancelEvent();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars34, kSouth):
+ if (_privateFlags.getFlag(kMarsPrivatePodStorageOpenFlag)) {
+ _privateFlags.setFlag(kMarsPrivatePodTurnLeftFlag, true);
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars34SpotCloseNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars34SpotCloseWithBar, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ Neighborhood::turnLeft();
+ }
+ break;
+ case MakeRoomView(kMars45, kNorth):
+ if (_privateFlags.getFlag(kMarsPrivatePodStorageOpenFlag)) {
+ _privateFlags.setFlag(kMarsPrivatePodTurnLeftFlag, true);
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars45SpotCloseNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars45SpotCloseWithBar, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ Neighborhood::turnLeft();
+ }
+ break;
+ default:
+ Neighborhood::turnLeft();
+ break;
+ }
+}
+
+void Mars::turnRight() {
+ if (isEventTimerRunning())
+ cancelEvent();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars34, kSouth):
+ if (_privateFlags.getFlag(kMarsPrivatePodStorageOpenFlag)) {
+ _privateFlags.setFlag(kMarsPrivatePodTurnRightFlag, true);
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars34SpotCloseNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars34SpotCloseWithBar, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ Neighborhood::turnRight();
+ }
+ break;
+ case MakeRoomView(kMars45, kNorth):
+ if (_privateFlags.getFlag(kMarsPrivatePodStorageOpenFlag)) {
+ _privateFlags.setFlag(kMarsPrivatePodTurnRightFlag, true);
+ if (GameState.isTakenItemID(kCrowbar))
+ startExtraSequence(kMars45SpotCloseNoBar, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMars45SpotCloseWithBar, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ Neighborhood::turnRight();
+ }
+ break;
+ default:
+ Neighborhood::turnRight();
+ break;
+ }
+}
+
+void Mars::receiveNotification(Notification *notification, const NotificationFlags flag) {
+ InventoryItem *item;
+
+ Neighborhood::receiveNotification(notification, flag);
+
+ if ((flag & kExtraCompletedFlag) != 0) {
+ _interruptionFilter = kFilterAllInput;
+
+ switch (_lastExtra) {
+ case kMarsArrivalFromTSA:
+ GameState.setMarsSeenTimeStream(true);
+ loadAmbientLoops();
+ playSpotSoundSync(kMarsShuttle1DepartedIn, kMarsShuttle1DepartedOut);
+ makeContinuePoint();
+ break;
+ case kRobotThrowsPlayer:
+ GameState.setMarsRobotThrownPlayer(true);
+ GameState.setScoringThrownByRobot();
+ restoreStriding(kMars08, kNorth, kAltMarsNormal);
+ arriveAt(kMars08, kNorth);
+ if (!GameState.getMarsHeardUpperPodMessage()) {
+ playSpotSoundSync(kMarsPodDepartedUpperPlatformIn,
+ kMarsPodDepartedUpperPlatformOut);
+ GameState.setMarsHeardUpperPodMessage(true);
+ }
+ break;
+ case kMarsInfoKioskIntro:
+ GameState.setScoringSawMarsKiosk();
+ setCurrentActivation(kActivationKioskChoice);
+ break;
+ case kMars33SlideShow4:
+ GameState.setScoringSawTransportMap();
+ setCurrentActivation(kActivateHotSpotAlways);
+ break;
+ case kMars34SpotOpenNoBar:
+ case kMars34SpotOpenWithBar:
+ case kMars45SpotOpenNoBar:
+ case kMars45SpotOpenWithBar:
+ _privateFlags.setFlag(kMarsPrivatePodStorageOpenFlag, true);
+ setCurrentActivation(kActivateMarsPodOpen);
+ break;
+ case kMars34SpotCloseNoBar:
+ case kMars34SpotCloseWithBar:
+ case kMars45SpotCloseNoBar:
+ case kMars45SpotCloseWithBar:
+ _privateFlags.setFlag(kMarsPrivatePodStorageOpenFlag, false);
+ setCurrentActivation(kActivateMarsPodClosed);
+ if (_privateFlags.getFlag(kMarsPrivatePodTurnLeftFlag)) {
+ _privateFlags.setFlag(kMarsPrivatePodTurnLeftFlag, false);
+ turnLeft();
+ } else if (_privateFlags.getFlag(kMarsPrivatePodTurnRightFlag)) {
+ _privateFlags.setFlag(kMarsPrivatePodTurnRightFlag, false);
+ turnRight();
+ }
+ break;
+ case kMarsTurnOnPod:
+ item = (InventoryItem *)_vm->getAllItems().findItemByID(kMarsCard);
+ _vm->addItemToInventory(item);
+ GameState.setScoringTurnedOnTransport();
+ loadLoopSound1("");
+ loadLoopSound2("");
+ startExtraSequence(kMarsTakePodToMars45, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMarsTakePodToMars45:
+ arriveAt(kMars45, kSouth);
+ break;
+ case kMars35WestSpinAirlockToEast:
+ GameState.setMarsAirlockOpen(false);
+ setCurrentAlternate(kAltMars35AirlockEast);
+ turnTo(kWest);
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ g_airMask->airQualityChanged();
+ checkAirMask();
+ loadAmbientLoops();
+ break;
+ case kMars35EastSpinAirlockToWest:
+ GameState.setMarsAirlockOpen(true);
+ setCurrentAlternate(kAltMars35AirlockWest);
+ turnTo(kEast);
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ g_airMask->airQualityChanged();
+ checkAirMask();
+ loadAmbientLoops();
+ break;
+ case kMars48RobotApproaches:
+ loadLoopSound2("Sounds/Mars/Robot Loop.aiff", 0x100, 0, 0);
+ GameState.setMarsSeenRobotAtReactor(true);
+ loopExtraSequence(kMars48RobotLoops);
+ _utilityFuse.primeFuse(kMarsRobotPatienceLimit);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::robotTiredOfWaiting));
+ _utilityFuse.lightFuse();
+ break;
+ case kMars48RobotDefends:
+ _vm->addItemToInventory(_attackingItem);
+ _attackingItem = 0;
+ if (_privateFlags.getFlag(kMarsPrivateRobotTiredOfWaitingFlag)) {
+ startExtraSequence(kMars48RobotKillsPlayer, kExtraCompletedFlag, kFilterNoInput);
+ loadLoopSound2("", 0x100, 0, 0);
+ } else {
+ loadLoopSound2("Sounds/Mars/Robot Loop.aiff", 0x100, 0, 0);
+ loopExtraSequence(kMars48RobotLoops, kExtraCompletedFlag);
+ }
+ break;
+ case kMars48RobotKillsPlayer:
+ loadLoopSound2("");
+ die(kDeathDidntGetOutOfWay);
+ break;
+ case kMars49SouthViewMaskFilling:
+ setCurrentActivation(kActivateMaskOnFiller);
+ setCurrentAlternate(kAltMarsMaskOnFiller);
+ GameState.setMarsMaskOnFiller(true);
+ break;
+ case kMars58SpinLeft:
+ case kMars54SpinRight:
+ GameState.setScoringActivatedPlatform();
+ arriveAt(kMars52, kEast);
+ break;
+ case kMars52SpinLeft:
+ case kMars56SpinRight:
+ GameState.setScoringActivatedPlatform();
+ arriveAt(kMars54, kEast);
+ break;
+ case kMars54SpinLeft:
+ case kMars58SpinRight:
+ GameState.setScoringActivatedPlatform();
+ arriveAt(kMars56, kEast);
+ break;
+ case kMars56SpinLeft:
+ case kMars52SpinRight:
+ GameState.setScoringActivatedPlatform();
+ arriveAt(kMars58, kEast);
+ break;
+ case kMars52Extend:
+ case kMars54Extend:
+ case kMars56ExtendNoBomb:
+ case kMars58Extend:
+ GameState.setScoringActivatedPlatform();
+ setCurrentActivation(kActivateReactorPlatformIn);
+ _privateFlags.setFlag(kMarsPrivatePlatformZoomedInFlag, true);
+ break;
+ case kMars53Retract:
+ case kMars55Retract:
+ case kMars57RetractWithBomb:
+ case kMars57RetractNoBomb:
+ case kMars59Retract:
+ GameState.setScoringActivatedPlatform();
+ setCurrentActivation(kActivateReactorPlatformOut);
+ _privateFlags.setFlag(kMarsPrivatePlatformZoomedInFlag, false);
+ break;
+ case kMars56ExtendWithBomb:
+ playSpotSoundSync(kMustBeUnlockedIn, kMustBeUnlockedOut);
+ GameState.setScoringActivatedPlatform();
+ _privateFlags.setFlag(kMarsPrivatePlatformZoomedInFlag, true);
+ break;
+ case kMars57CantOpenPanel:
+ GameState.setScoringActivatedPlatform();
+ setCurrentActivation(kActivateReactorAskLowerScreen);
+ break;
+ case kMars57LowerScreenClosed:
+ case kMars57ThawLock:
+ setCurrentActivation(kActivateReactorReadyForNitrogen);
+ GameState.setMarsLockFrozen(false);
+ break;
+ case kMars57FreezeLock:
+ item = (InventoryItem *)_vm->getAllItems().findItemByID(kNitrogenCanister);
+ item->setItemState(kNitrogenEmpty);
+ _vm->addItemToInventory(item);
+ setCurrentActivation(kActivateReactorReadyForCrowBar);
+ GameState.setScoringUsedLiquidNitrogen();
+ GameState.setMarsLockFrozen(true);
+ showExtraView(kMars57LockFrozenView);
+ _utilityFuse.primeFuse(kLockFreezeTimeLmit);
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::lockThawed));
+ _utilityFuse.lightFuse();
+ break;
+ case kMars57BreakLock:
+ item = (InventoryItem *)_vm->getAllItems().findItemByID(kCrowbar);
+ _vm->addItemToInventory(item);
+ GameState.setScoringUsedCrowBar();
+ GameState.setMarsLockBroken(true);
+ GameState.setMarsLockFrozen(false);
+ startExtraLongSequence(kMars57OpenPanel, kMars57OpenPanelChoices, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars57OpenPanel:
+ case kMars57OpenPanelChoices:
+ setCurrentActivation(kActivateReactorAskOperation);
+ break;
+ case kMars57ShieldEvaluation:
+ case kMars57MeasureOutput:
+ setCurrentActivation(kActivateReactorRanEvaluation);
+ loopExtraSequence(kMars57ShieldOkayLoop);
+ break;
+ case kMars57RunDiagnostics:
+ setCurrentActivation(kActivateReactorRanDiagnostics);
+ GameState.setScoringFoundCardBomb();
+ break;
+ case kMars57BombExplodes:
+ case kMars57BombExplodesInGame:
+ die(kDeathDidntDisarmMarsBomb);
+ break;
+ case kMars57BombAnalysis:
+ setCurrentActivation(kActivateReactorAnalyzed);
+ break;
+ case kMars57DontLink:
+ startExtraSequence(kMars57OpenPanelChoices, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kMars57CircuitLink:
+ setCurrentActivation(kActivateReactorInstructions);
+ break;
+ case kMars57GameLevel1:
+ setUpReactorLevel1();
+ break;
+ case kMars57GameLevel2:
+ case kMars57GameLevel3:
+ setUpNextReactorLevel();
+ break;
+ case kMars57GameSolved:
+ setCurrentActivation(kActivateReactorBombSafe);
+ break;
+ case kMars57ExposeBomb:
+ setCurrentActivation(kActivateReactorBombExposed);
+ _privateFlags.setFlag(kMarsPrivateBombExposedFlag, true);
+ break;
+ case kMars57BackToNormal:
+ setCurrentActivation(kActivateReactorPlatformIn);
+ _privateFlags.setFlag(kMarsPrivateBombExposedFlag, false);
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Mars/XM51SW", false, kWarningInterruption);
+ break;
+ case kMars60WestSpinAirlockToEast:
+ GameState.setMarsAirlockOpen(true);
+ setCurrentAlternate(kAltMars60AirlockEast);
+ turnTo(kWest);
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ g_airMask->airQualityChanged();
+ checkAirMask();
+ loadAmbientLoops();
+ break;
+ case kMars60EastSpinAirlockToWest:
+ GameState.setMarsAirlockOpen(false);
+ setCurrentAlternate(kAltMars60AirlockWest);
+ turnTo(kEast);
+ setCurrentActivation(kActivateReadyToPressurizeAirlock);
+ g_airMask->airQualityChanged();
+ checkAirMask();
+ loadAmbientLoops();
+ break;
+ case kMarsRobotHeadOpen:
+ setCurrentActivation(kActivationRobotHeadOpen);
+ break;
+ case kMarsRobotHeadClose:
+ recallToTSASuccess();
+ break;
+ case kMarsMaze007RobotApproach:
+ case kMarsMaze015SouthRobotApproach:
+ case kMarsMaze101EastRobotApproach:
+ case kMarsMaze104WestLoop:
+ case kMarsMaze133SouthApproach:
+ case kMarsMaze136NorthApproach:
+ case kMarsMaze184WestLoop:
+ die(kDeathGroundByMazebot);
+ break;
+ }
+ } else if ((flag & kTimeForCanyonChaseFlag) != 0) {
+ doCanyonChase();
+ } else if ((flag & kExplosionFinishedFlag) != 0) {
+ _explosions.stop();
+ _explosions.hide();
+ if (g_robotShip->isDead()) {
+ GameState.setMarsFinished(true);
+ _centerShuttleMovie.hide();
+ _upperRightShuttleMovie.show();
+ _upperRightShuttleMovie.setTime(kShuttleUpperRightTargetDestroyedTime);
+ _upperRightShuttleMovie.redrawMovieWorld();
+ _rightDamageShuttleMovie.hide();
+ playMovieSegment(&_rightShuttleMovie, kShuttleRightDestroyedStart, kShuttleRightDestroyedStop);
+ playSpotSoundSync(kShuttleDestroyedIn, kShuttleDestroyedOut);
+ throwAwayMarsShuttle();
+ reinstateMonocleInterface();
+ recallToTSASuccess();
+ }
+ } else if ((flag & kTimeToTransportFlag) != 0) {
+ transportToRobotShip();
+ }
+
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+}
+
+void Mars::spotCompleted() {
+ Neighborhood::spotCompleted();
+
+ if (GameState.getCurrentRoom() == kMarsRobotShuttle)
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Mars/XN59WD", false, kWarningInterruption);
+}
+
+void Mars::doCanyonChase() {
+ GameState.setScoringEnteredShuttle();
+ setNextHandler(_vm);
+ throwAwayInterface();
+
+ _vm->_cursor->hide();
+
+ // Open the spot sounds movie again...
+ _spotSounds.initFromQuickTime(getSoundSpotsName());
+ _spotSounds.setVolume(_vm->getSoundFXLevel());
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (!video->loadFile("Images/Mars/M44ESA.movie"))
+ error("Could not load interface->shuttle transition video");
+
+ video->start();
+
+ while (!_vm->shouldQuit() && !video->endOfVideo()) {
+ if (video->needsUpdate()) {
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame)
+ _vm->drawScaledFrame(frame, 0, 0);
+ }
+
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event))
+ ;
+
+ g_system->delayMillis(10);
+ }
+
+ delete video;
+
+ if (_vm->shouldQuit())
+ return;
+
+ initOnePicture(&_shuttleInterface1, "Images/Mars/MCmain1.pict", kShuttleBackgroundOrder, kShuttle1Left,
+ kShuttle1Top, true);
+ initOnePicture(&_shuttleInterface2, "Images/Mars/MCmain2.pict", kShuttleBackgroundOrder, kShuttle2Left,
+ kShuttle2Top, true);
+ initOnePicture(&_shuttleInterface3, "Images/Mars/MCmain3.pict", kShuttleBackgroundOrder, kShuttle3Left,
+ kShuttle3Top, true);
+ initOnePicture(&_shuttleInterface4, "Images/Mars/MCmain4.pict", kShuttleBackgroundOrder, kShuttle4Left,
+ kShuttle4Top, true);
+
+ initOneMovie(&_canyonChaseMovie, "Images/Mars/Canyon.movie",
+ kShuttleMonitorOrder, kShuttleWindowLeft, kShuttleWindowTop, true);
+ _canyonChaseMovie.setVolume(_vm->getSoundFXLevel());
+
+ loadLoopSound1("Sounds/Mars/Inside Cockpit.22K.8.AIFF");
+
+ // Swing shuttle around...
+ playMovieSegment(&_canyonChaseMovie, kShuttleSwingStart, kShuttleSwingStop);
+
+ initOneMovie(&_leftShuttleMovie, "Images/Mars/Left Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleLeftLeft, kShuttleLeftTop, false);
+
+ initOneMovie(&_rightShuttleMovie, "Images/Mars/Right Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleRightLeft, kShuttleRightTop, false);
+
+ initOneMovie(&_lowerLeftShuttleMovie, "Images/Mars/Lower Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerLeftLeft, kShuttleLowerLeftTop, false);
+
+ initOneMovie(&_lowerRightShuttleMovie, "Images/Mars/Lower Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerRightLeft, kShuttleLowerRightTop, false);
+
+ initOneMovie(&_centerShuttleMovie, "Images/Mars/Center Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleCenterLeft, kShuttleCenterTop, false);
+
+ initOneMovie(&_upperLeftShuttleMovie, "Images/Mars/Upper Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperLeftLeft, kShuttleUpperLeftTop, false);
+
+ initOneMovie(&_upperRightShuttleMovie, "Images/Mars/Upper Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperRightLeft, kShuttleUpperRightTop, false);
+
+ initOneMovie(&_leftDamageShuttleMovie, "Images/Mars/Left Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleLeftEnergyLeft, kShuttleLeftEnergyTop, false);
+
+ initOneMovie(&_rightDamageShuttleMovie, "Images/Mars/Right Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleRightEnergyLeft, kShuttleRightEnergyTop, false);
+
+ _centerShuttleMovie.show();
+ _centerShuttleMovie.setTime(kShuttleCenterBoardingTime);
+ playSpotSoundSync(kShuttleCockpitIn, kShuttleCockpitOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterCheckTime);
+ playSpotSoundSync(kShuttleOnboardIn, kShuttleOnboardOut);
+
+ _shuttleEnergyMeter.initShuttleEnergyMeter();
+ _shuttleEnergyMeter.powerUpMeter();
+ while (_shuttleEnergyMeter.isFading()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ g_system->updateScreen();
+ }
+
+ _leftShuttleMovie.show();
+ playMovieSegment(&_leftShuttleMovie, kShuttleLeftIntroStart, kShuttleLeftIntroStop);
+
+ _leftShuttleMovie.setTime(kShuttleLeftNormalTime);
+ _leftShuttleMovie.redrawMovieWorld();
+
+ _leftDamageShuttleMovie.show();
+ playMovieSegment(&_leftDamageShuttleMovie);
+
+ // Take it down a tick initially. This sets the time to the time of the last tick,
+ // so that subsequence drops will drop it down a tick.
+ _leftDamageShuttleMovie.setTime(_leftDamageShuttleMovie.getTime() - 40);
+ _leftDamageShuttleMovie.redrawMovieWorld();
+
+ _lowerRightShuttleMovie.show();
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightOffTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+ _centerShuttleMovie.setTime(kShuttleCenterNavCompTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleNavigationIn, kShuttleNavigationOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterCommTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleCommunicationIn, kShuttleCommunicationOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterAllSystemsTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleAllSystemsIn, kShuttleAllSystemsOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterSecureLooseTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleSecureLooseIn, kShuttleSecureLooseOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterAutoTestTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleAutoTestingIn, kShuttleAutoTestingOut);
+
+ _leftShuttleMovie.setTime(kShuttleLeftAutoTestTime);
+ _leftShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kMarsThrusterAutoTestIn, kMarsThrusterAutoTestOut);
+ _leftShuttleMovie.setTime(kShuttleLeftNormalTime);
+ _leftShuttleMovie.redrawMovieWorld();
+
+ _centerShuttleMovie.setTime(kShuttleCenterLaunchTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttlePrepareForDropIn, kShuttlePrepareForDropOut);
+
+ playSpotSoundSync(kShuttleAllClearIn, kShuttleAllClearOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterEnterTubeTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ _lowerLeftShuttleMovie.show();
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftCollisionTime);
+
+ loadLoopSound1("");
+
+ _canyonChaseMovie.setSegment(kCanyonChaseStart, kCanyonChaseStop);
+ _canyonChaseMovie.start();
+
+ startMarsTimer(kLaunchTubeReachedTime, kMovieTicksPerSecond, kMarsLaunchTubeReached);
+}
+
+void Mars::startUpFromFinishedSpaceChase() {
+ setNextHandler(_vm);
+ throwAwayInterface();
+
+ initOnePicture(&_shuttleInterface1, "Images/Mars/MCmain1.pict", kShuttleBackgroundOrder, kShuttle1Left,
+ kShuttle1Top, true);
+ initOnePicture(&_shuttleInterface2, "Images/Mars/MCmain2.pict", kShuttleBackgroundOrder, kShuttle2Left,
+ kShuttle2Top, true);
+ initOnePicture(&_shuttleInterface3, "Images/Mars/MCmain3.pict", kShuttleBackgroundOrder, kShuttle3Left,
+ kShuttle3Top, true);
+ initOnePicture(&_shuttleInterface4, "Images/Mars/MCmain4.pict", kShuttleBackgroundOrder, kShuttle4Left,
+ kShuttle4Top, true);
+
+ initOneMovie(&_leftShuttleMovie, "Images/Mars/Left Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleLeftLeft, kShuttleLeftTop, false);
+
+ initOneMovie(&_rightShuttleMovie, "Images/Mars/Right Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleRightLeft, kShuttleRightTop, false);
+
+ initOneMovie(&_lowerLeftShuttleMovie, "Images/Mars/Lower Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerLeftLeft, kShuttleLowerLeftTop, false);
+
+ initOneMovie(&_lowerRightShuttleMovie, "Images/Mars/Lower Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerRightLeft, kShuttleLowerRightTop, false);
+
+ initOneMovie(&_centerShuttleMovie, "Images/Mars/Center Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleCenterLeft, kShuttleCenterTop, false);
+
+ initOneMovie(&_upperLeftShuttleMovie, "Images/Mars/Upper Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperLeftLeft, kShuttleUpperLeftTop, false);
+
+ initOneMovie(&_upperRightShuttleMovie, "Images/Mars/Upper Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperRightLeft, kShuttleUpperRightTop, false);
+
+ initOneMovie(&_leftDamageShuttleMovie, "Images/Mars/Left Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleLeftEnergyLeft, kShuttleLeftEnergyTop, false);
+
+ initOneMovie(&_rightDamageShuttleMovie, "Images/Mars/Right Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleRightEnergyLeft, kShuttleRightEnergyTop, false);
+
+ _centerShuttleMovie.show();
+
+ _shuttleEnergyMeter.initShuttleEnergyMeter();
+ _shuttleEnergyMeter.setEnergyValue(kFullShuttleEnergy);
+
+ _leftShuttleMovie.show();
+ _leftShuttleMovie.setTime(kShuttleLeftNormalTime);
+ _leftShuttleMovie.redrawMovieWorld();
+
+ _leftDamageShuttleMovie.show();
+ _leftDamageShuttleMovie.setTime(_leftDamageShuttleMovie.getDuration() - 40);
+ _leftDamageShuttleMovie.redrawMovieWorld();
+
+ _lowerRightShuttleMovie.show();
+
+ _lowerLeftShuttleMovie.show();
+
+ loadLoopSound1("Sounds/Mars/Space Ambient.22K.8.AIFF");
+
+ initOneMovie(&_junk, "Images/Mars/Junk.movie", kShuttleJunkOrder, kShuttleJunkLeft,
+ kShuttleJunkTop, false);
+
+ initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false);
+ _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes);
+
+ _energyBeam.initShuttleWeapon();
+ _gravitonCannon.initShuttleWeapon();
+
+ _upperLeftShuttleMovie.show();
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftDimTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+
+ _rightShuttleMovie.show();
+ _rightShuttleMovie.setTime(kShuttleRightIntroStop - 1);
+ _rightShuttleMovie.redrawMovieWorld();
+
+ _rightDamageShuttleMovie.show();
+ _rightDamageShuttleMovie.setTime(40);
+ _rightDamageShuttleMovie.redrawMovieWorld();
+
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftAutopilotTime);
+ _lowerLeftShuttleMovie.redrawMovieWorld();
+
+ _shuttleTransportSpot.setArea(kShuttleTransportBounds);
+ _shuttleTransportSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_shuttleTransportSpot);
+
+ _privateFlags.setFlag(kMarsPrivateInSpaceChaseFlag, true);
+
+ _upperRightShuttleMovie.show();
+ _upperRightShuttleMovie.setTime(kShuttleUpperRightOverloadTime);
+ _upperRightShuttleMovie.redrawMovieWorld();
+
+ _centerShuttleMovie.setTime(kShuttleCenterSafeTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightTransportTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+
+ initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder,
+ kShuttleWindowLeft, kShuttleWindowTop, true);
+ _canyonChaseMovie.setTime(_canyonChaseMovie.getDuration());
+ _canyonChaseMovie.redrawMovieWorld();
+}
+
+void Mars::startUpFromSpaceChase() {
+ setNextHandler(_vm);
+ throwAwayInterface();
+
+ // Open the spot sounds movie again...
+ _spotSounds.initFromQuickTime(getSoundSpotsName());
+ _spotSounds.setVolume(_vm->getSoundFXLevel());;
+
+ initOnePicture(&_shuttleInterface1, "Images/Mars/MCmain1.pict", kShuttleBackgroundOrder, kShuttle1Left,
+ kShuttle1Top, true);
+ initOnePicture(&_shuttleInterface2, "Images/Mars/MCmain2.pict", kShuttleBackgroundOrder, kShuttle2Left,
+ kShuttle2Top, true);
+ initOnePicture(&_shuttleInterface3, "Images/Mars/MCmain3.pict", kShuttleBackgroundOrder, kShuttle3Left,
+ kShuttle3Top, true);
+ initOnePicture(&_shuttleInterface4, "Images/Mars/MCmain4.pict", kShuttleBackgroundOrder, kShuttle4Left,
+ kShuttle4Top, true);
+
+ initOneMovie(&_leftShuttleMovie, "Images/Mars/Left Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleLeftLeft, kShuttleLeftTop, false);
+
+ initOneMovie(&_rightShuttleMovie, "Images/Mars/Right Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleRightLeft, kShuttleRightTop, false);
+
+ initOneMovie(&_lowerLeftShuttleMovie, "Images/Mars/Lower Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerLeftLeft, kShuttleLowerLeftTop, false);
+
+ initOneMovie(&_lowerRightShuttleMovie, "Images/Mars/Lower Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerRightLeft, kShuttleLowerRightTop, false);
+
+ initOneMovie(&_centerShuttleMovie, "Images/Mars/Center Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleCenterLeft, kShuttleCenterTop, false);
+
+ initOneMovie(&_upperLeftShuttleMovie, "Images/Mars/Upper Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperLeftLeft, kShuttleUpperLeftTop, false);
+
+ initOneMovie(&_upperRightShuttleMovie, "Images/Mars/Upper Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperRightLeft, kShuttleUpperRightTop, false);
+
+ initOneMovie(&_leftDamageShuttleMovie, "Images/Mars/Left Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleLeftEnergyLeft, kShuttleLeftEnergyTop, false);
+
+ initOneMovie(&_rightDamageShuttleMovie, "Images/Mars/Right Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleRightEnergyLeft, kShuttleRightEnergyTop, false);
+
+ _centerShuttleMovie.show();
+
+ _shuttleEnergyMeter.initShuttleEnergyMeter();
+ _shuttleEnergyMeter.setEnergyValue(kFullShuttleEnergy);
+
+ _leftShuttleMovie.show();
+ _leftShuttleMovie.setTime(kShuttleLeftNormalTime);
+ _leftShuttleMovie.redrawMovieWorld();
+
+ _leftDamageShuttleMovie.show();
+ _leftDamageShuttleMovie.setTime(_leftDamageShuttleMovie.getDuration() - 40);
+ _leftDamageShuttleMovie.redrawMovieWorld();
+
+ _lowerRightShuttleMovie.show();
+
+ _lowerLeftShuttleMovie.show();
+
+ loadLoopSound1("Sounds/Mars/Space Ambient.22K.8.AIFF");
+
+ initOneMovie(&_planetMovie, "Images/Mars/Planet.movie", kShuttlePlanetOrder,
+ kPlanetStartLeft, kPlanetStartTop, true);
+ _planetMovie.setFlags(kLoopTimeBase);
+
+ initOneMovie(&_junk, "Images/Mars/Junk.movie", kShuttleJunkOrder, kShuttleJunkLeft,
+ kShuttleJunkTop, false);
+
+ initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false);
+ _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes);
+
+ _energyBeam.initShuttleWeapon();
+ _gravitonCannon.initShuttleWeapon();
+
+ _upperLeftShuttleMovie.show();
+
+ _robotShip.initRobotShip();
+
+ _planetMovie.start();
+ _planetMover.startMoving(&_planetMovie);
+
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftDimTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+
+ _centerShuttleMovie.setTime(kShuttleCenterTargetSightedTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightTrackingTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+
+ _rightShuttleMovie.show();
+ _rightShuttleMovie.setTime(kShuttleRightIntroStop - 1);
+ _rightShuttleMovie.redrawMovieWorld();
+
+ _rightDamageShuttleMovie.show();
+ _rightDamageShuttleMovie.setTime(_rightDamageShuttleMovie.getDuration() - 40);
+ _rightDamageShuttleMovie.redrawMovieWorld();
+
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftAutopilotTime);
+ _lowerLeftShuttleMovie.redrawMovieWorld();
+
+ _robotShip.startMoving();
+
+ _shuttleHUD.initShuttleHUD();
+
+ _tractorBeam.startDisplaying();
+
+ _energyChoiceSpot.setArea(kShuttleEnergyBeamBounds);
+ _energyChoiceSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_energyChoiceSpot);
+ _gravitonChoiceSpot.setArea(kShuttleGravitonBounds);
+ _gravitonChoiceSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_gravitonChoiceSpot);
+ _tractorChoiceSpot.setArea(kShuttleTractorBounds);
+ _tractorChoiceSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_tractorChoiceSpot);
+ _shuttleViewSpot.setArea(kShuttleWindowLeft, kShuttleWindowTop,
+ kShuttleWindowLeft + kShuttleWindowWidth, kShuttleWindowTop + kShuttleWindowHeight);
+ _shuttleViewSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_shuttleViewSpot);
+ _shuttleTransportSpot.setArea(kShuttleTransportBounds);
+ _shuttleTransportSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_shuttleTransportSpot);
+
+ _privateFlags.setFlag(kMarsPrivateInSpaceChaseFlag, true);
+
+ startMarsTimer(kSpaceChaseTimeLimit, kOneTickPerSecond, kMarsSpaceChaseFinished);
+}
+
+void Mars::setSoundFXLevel(const uint16 level) {
+ Neighborhood::setSoundFXLevel(level);
+
+ if (_canyonChaseMovie.isMovieValid())
+ _canyonChaseMovie.setVolume(level);
+
+ if (_explosions.isMovieValid())
+ _explosions.setVolume(level);
+}
+
+void Mars::startMarsTimer(TimeValue time, TimeScale scale, MarsTimerCode code) {
+ _utilityFuse.primeFuse(time, scale);
+ _marsEvent.mars = this;
+ _marsEvent.event = code;
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, MarsTimerEvent>(&_marsEvent, &MarsTimerEvent::fire));
+ _utilityFuse.lightFuse();
+}
+
+void Mars::marsTimerExpired(MarsTimerEvent &event) {
+ Common::Rect r;
+ uint16 x, y;
+
+ switch (event.event) {
+ case kMarsLaunchTubeReached:
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftTubeTime);
+ _lowerLeftShuttleMovie.redrawMovieWorld();
+ startMarsTimer(kCanyonChaseFinishedTime, kMovieTicksPerSecond, kMarsCanyonChaseFinished);
+ break;
+ case kMarsCanyonChaseFinished:
+ GameState.setScoringEnteredLaunchTube();
+
+ while (_canyonChaseMovie.isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _canyonChaseMovie.stop();
+ _canyonChaseMovie.stopDisplaying();
+ _canyonChaseMovie.releaseMovie();
+
+ _vm->_gfx->enableErase();
+
+ loadLoopSound1("Sounds/Mars/Space Ambient.22K.8.AIFF");
+
+ playSpotSoundSync(kShuttleConfiguringIn, kShuttleConfiguringOut);
+ playSpotSoundSync(kShuttleGeneratingIn, kShuttleGeneratingOut);
+ playSpotSoundSync(kShuttleBreakawayIn, kShuttleBreakawayOut);
+ playSpotSoundSync(kMarsAtmosphericBreakawayIn, kMarsAtmosphericBreakawayOut);
+
+ initOneMovie(&_planetMovie, "Images/Mars/Planet.movie", kShuttlePlanetOrder, kPlanetStartLeft, kPlanetStartTop, true);
+ _planetMovie.setFlags(kLoopTimeBase);
+
+ initOneMovie(&_junk, "Images/Mars/Junk.movie", kShuttleJunkOrder, kShuttleJunkLeft, kShuttleJunkTop, false);
+
+ initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false);
+ _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes);
+
+ _energyBeam.initShuttleWeapon();
+ _gravitonCannon.initShuttleWeapon();
+
+ _centerShuttleMovie.setTime(kShuttleCenterWeaponsTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ _upperLeftShuttleMovie.show();
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftDampingTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+
+ _robotShip.initRobotShip();
+
+ _planetMovie.start();
+ _planetMover.startMoving(&_planetMovie);
+
+ playSpotSoundSync(kShuttleDamperDescIn, kShuttleDamperDescOut);
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftGravitonTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kShuttleGravitonDescIn, kShuttleGravitonDescOut);
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftTractorTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kShuttleTractorDescIn, kShuttleTractorDescOut);
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftDimTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+
+ _centerShuttleMovie.setTime(kShuttleCenterTargetSightedTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleTargetSightedIn, kShuttleTargetSightedOut);
+
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightTrackingTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+ _rightShuttleMovie.show();
+ playMovieSegment(&_rightShuttleMovie, kShuttleRightIntroStart, kShuttleRightIntroStop);
+
+ _rightDamageShuttleMovie.show();
+ playMovieSegment(&_rightDamageShuttleMovie);
+
+ // Take it down a tick initially. This sets the time to the time of the last tick,
+ // so that subsequence drops will drop it down a tick.
+ _rightDamageShuttleMovie.setTime(_rightDamageShuttleMovie.getTime() - 40);
+ _rightDamageShuttleMovie.redrawMovieWorld();
+
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftAutopilotTime);
+ _lowerLeftShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleAutopilotEngagedIn, kShuttleAutopilotEngagedOut);
+
+ _robotShip.startMoving();
+
+ _shuttleHUD.initShuttleHUD();
+
+ _tractorBeam.startDisplaying();
+
+ _energyChoiceSpot.setArea(kShuttleEnergyBeamBounds);
+ _energyChoiceSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_energyChoiceSpot);
+ _gravitonChoiceSpot.setArea(kShuttleGravitonBounds);
+ _gravitonChoiceSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_gravitonChoiceSpot);
+ _tractorChoiceSpot.setArea(kShuttleTractorBounds);
+ _tractorChoiceSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_tractorChoiceSpot);
+ _shuttleViewSpot.setArea(kShuttleWindowLeft, kShuttleWindowTop,
+ kShuttleWindowLeft + kShuttleWindowWidth, kShuttleWindowTop + kShuttleWindowHeight);
+ _shuttleViewSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_shuttleViewSpot);
+ _shuttleTransportSpot.setArea(kShuttleTransportBounds);
+ _shuttleTransportSpot.setHotspotFlags(kNeighborhoodSpotFlag | kClickSpotFlag);
+ _vm->getAllHotspots().push_back(&_shuttleTransportSpot);
+
+ _privateFlags.setFlag(kMarsPrivateInSpaceChaseFlag, true);
+
+ playSpotSoundSync(kMarsCockpitChatterIn, kMarsCockpitChatterOut);
+
+ GameState.setMarsFinishedCanyonChase(true);
+
+ startMarsTimer(kSpaceChaseTimeLimit, kOneTickPerSecond, kMarsSpaceChaseFinished);
+
+ _vm->_cursor->hideUntilMoved();
+ break;
+ case kMarsSpaceChaseFinished:
+ // Player failed to stop the robot in time...
+ _interruptionFilter = kFilterNoInput;
+
+ _rightShuttleMovie.setTime(kShuttleRightTargetLockTime);
+ _rightShuttleMovie.redrawMovieWorld();
+
+ _upperRightShuttleMovie.show();
+ _upperRightShuttleMovie.setTime(kShuttleUpperRightLockedTime);
+ _upperRightShuttleMovie.redrawMovieWorld();
+
+ _rightShuttleMovie.setTime(kShuttleRightGravitonTime);
+ _rightShuttleMovie.redrawMovieWorld();
+ _upperRightShuttleMovie.setTime(kShuttleUpperRightArmedTime);
+ _upperRightShuttleMovie.redrawMovieWorld();
+
+ _vm->delayShell(3, 1);
+
+ x = _vm->getRandomNumber(19);
+ y = _vm->getRandomNumber(19);
+
+ r = Common::Rect(kShuttleWindowMidH - x, kShuttleWindowMidV - y,
+ kShuttleWindowMidH - x + 20, kShuttleWindowMidV - y + 20);
+ showBigExplosion(r, kShuttleAlienShipOrder);
+
+ while (_explosions.isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ g_system->delayMillis(10);
+ }
+
+ throwAwayMarsShuttle();
+ reinstateMonocleInterface();
+ recallToTSAFailure();
+ break;
+ default:
+ break;
+ }
+
+ _interruptionFilter = kFilterAllInput;
+}
+
+void Mars::throwAwayMarsShuttle() {
+ _shuttleInterface1.deallocateSurface();
+ _shuttleInterface1.stopDisplaying();
+ _shuttleInterface2.deallocateSurface();
+ _shuttleInterface2.stopDisplaying();
+ _shuttleInterface3.deallocateSurface();
+ _shuttleInterface3.stopDisplaying();
+ _shuttleInterface4.deallocateSurface();
+ _shuttleInterface4.stopDisplaying();
+
+ _spotSounds.disposeSound();
+
+ _canyonChaseMovie.releaseMovie();
+ _canyonChaseMovie.stopDisplaying();
+ _leftShuttleMovie.releaseMovie();
+ _leftShuttleMovie.stopDisplaying();
+ _rightShuttleMovie.releaseMovie();
+ _rightShuttleMovie.stopDisplaying();
+ _lowerLeftShuttleMovie.releaseMovie();
+ _lowerLeftShuttleMovie.stopDisplaying();
+ _lowerRightShuttleMovie.releaseMovie();
+ _lowerRightShuttleMovie.stopDisplaying();
+ _centerShuttleMovie.releaseMovie();
+ _centerShuttleMovie.stopDisplaying();
+ _upperLeftShuttleMovie.releaseMovie();
+ _upperLeftShuttleMovie.stopDisplaying();
+ _upperRightShuttleMovie.releaseMovie();
+ _upperRightShuttleMovie.stopDisplaying();
+ _leftDamageShuttleMovie.releaseMovie();
+ _leftDamageShuttleMovie.stopDisplaying();
+ _rightDamageShuttleMovie.releaseMovie();
+ _rightDamageShuttleMovie.stopDisplaying();
+
+ _shuttleEnergyMeter.disposeShuttleEnergyMeter();
+ _robotShip.cleanUpRobotShip();
+ _shuttleHUD.cleanUpShuttleHUD();
+ _tractorBeam.stopDisplaying();
+ _junk.releaseMovie();
+ _junk.stopDisplaying();
+ _energyBeam.cleanUpShuttleWeapon();
+ _gravitonCannon.cleanUpShuttleWeapon();
+ _vm->getAllHotspots().remove(&_energyChoiceSpot);
+ _vm->getAllHotspots().remove(&_gravitonChoiceSpot);
+ _vm->getAllHotspots().remove(&_tractorChoiceSpot);
+ _vm->getAllHotspots().remove(&_shuttleViewSpot);
+ _vm->getAllHotspots().remove(&_shuttleTransportSpot);
+ _explosions.releaseMovie();
+ _explosions.stopDisplaying();
+
+ loadLoopSound1("");
+}
+
+void Mars::transportToRobotShip() {
+ throwAwayMarsShuttle();
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (!video->loadFile("Images/Mars/M98EAE.movie"))
+ error("Could not load shuttle->interface transition video");
+
+ video->start();
+
+ while (!_vm->shouldQuit() && !video->endOfVideo()) {
+ if (video->needsUpdate()) {
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame)
+ _vm->drawScaledFrame(frame, 0, 0);
+ }
+
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event))
+ ;
+
+ g_system->delayMillis(10);
+ }
+
+ delete video;
+
+ if (_vm->shouldQuit())
+ return;
+
+ reinstateMonocleInterface();
+
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+
+ arriveAt(kMarsRobotShuttle, kEast);
+
+ _navMovie.stop();
+ _navMovie.setTime(_navMovie.getStart());
+ _navMovie.start();
+}
+
+const int kRobotTooStrong = 1;
+const int kTractorTooWeak = 2;
+const int kCapturedRobotShip = 3;
+
+void Mars::spaceChaseClick(const Input &input, const HotSpotID id) {
+ Common::Point pt;
+
+ switch (id) {
+ case kShuttleEnergySpotID:
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftDampingTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+ _leftShuttleMovie.setTime(kShuttleLeftDampingTime);
+ _leftShuttleMovie.redrawMovieWorld();
+ _shuttleHUD.hide();
+ _weaponSelection = kEnergyBeam;
+ playSpotSoundSync(kShuttleDampingBeamIn, kShuttleDampingBeamOut);
+ break;
+ case kShuttleGravitonSpotID:
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftGravitonTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+ _leftShuttleMovie.setTime(kShuttleLeftGravitonTime);
+ _leftShuttleMovie.redrawMovieWorld();
+ _shuttleHUD.hide();
+ _weaponSelection = kGravitonCannon;
+ playSpotSoundSync(kShuttleGravitonIn, kShuttleGravitonOut);
+ break;
+ case kShuttleTractorSpotID:
+ _upperLeftShuttleMovie.setTime(kShuttleUpperLeftTractorTime);
+ _upperLeftShuttleMovie.redrawMovieWorld();
+ _leftShuttleMovie.setTime(kShuttleLeftTractorTime);
+ _leftShuttleMovie.redrawMovieWorld();
+ _shuttleHUD.show();
+ _weaponSelection = kTractorBeam;
+ playSpotSoundSync(kShuttleTractorBeamIn, kShuttleTractorBeamOut);
+ break;
+ case kShuttleViewSpotID:
+ switch (_weaponSelection) {
+ case kEnergyBeam:
+ if (_shuttleEnergyMeter.getEnergyValue() < kMinDampingEnergy) {
+ playSpotSoundSync(kShuttleEnergyTooLowIn, kShuttleEnergyTooLowOut);
+ } else {
+ if (_energyBeam.canFireWeapon()) {
+ _shuttleEnergyMeter.dropEnergyValue(kMinDampingEnergy);
+ input.getInputLocation(pt);
+ _energyBeam.fireWeapon(pt.x, pt.y);
+ playSpotSoundSync(kMarsEDBBlastIn, kMarsEDBBlastOut);
+ }
+ }
+ break;
+ case kGravitonCannon:
+ if (_shuttleEnergyMeter.getEnergyValue() < kMinGravitonEnergy) {
+ playSpotSoundSync(kShuttleEnergyTooLowIn, kShuttleEnergyTooLowOut);
+ } else {
+ if (_gravitonCannon.canFireWeapon()) {
+ _shuttleEnergyMeter.dropEnergyValue(kMinGravitonEnergy);
+ input.getInputLocation(pt);
+ _gravitonCannon.fireWeapon(pt.x, pt.y);
+ playSpotSoundSync(kMarsGravitonBlastIn, kMarsGravitonBlastOut);
+ }
+ }
+ break;
+ case kTractorBeam:
+ if (_shuttleHUD.isTargetLocked()) {
+ // play tractor beam sound?
+ _utilityFuse.stopFuse();
+
+ _tractorBeam.show();
+
+ int capture;
+ if (_rightDamageShuttleMovie.getTime() > 40) {
+ capture = kRobotTooStrong;
+ } else if (!_shuttleEnergyMeter.enoughEnergyForTractorBeam()) {
+ capture = kTractorTooWeak;
+ } else {
+ _robotShip.snareByTractorBeam();
+ capture = kCapturedRobotShip;
+ _planetMover.dropPlanetOutOfSight();
+ }
+
+ _shuttleEnergyMeter.drainForTractorBeam();
+
+ while (_shuttleEnergyMeter.isFading()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _shuttleEnergyMeter.setEnergyValue(_shuttleEnergyMeter.getEnergyValue());
+
+ switch (capture) {
+ case kRobotTooStrong:
+ _tractorBeam.hide();
+ playSpotSoundSync(kShuttleBrokeFreeIn, kShuttleBrokeFreeOut);
+ _utilityFuse.lightFuse();
+ break;
+ case kTractorTooWeak:
+ playSpotSoundSync(kShuttleCantHoldIn, kShuttleCantHoldOut);
+ _tractorBeam.hide();
+ _utilityFuse.lightFuse();
+ break;
+ case kCapturedRobotShip:
+ _tractorBeam.hide();
+ _shuttleHUD.hide();
+ _robotShip.cleanUpRobotShip();
+ _planetMovie.stop();
+ _planetMovie.stopDisplaying();
+ _planetMovie.releaseMovie();
+
+ // Shameless reuse of a variable :P
+ initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder,
+ kShuttleWindowLeft, kShuttleWindowTop, true);
+ _canyonChaseMovie.redrawMovieWorld();
+ playMovieSegment(&_canyonChaseMovie, 0, _canyonChaseMovie.getDuration());
+
+ // wait here until any junk clears...
+ while (_junk.junkFlying()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _upperRightShuttleMovie.show();
+ _upperRightShuttleMovie.setTime(kShuttleUpperRightOverloadTime);
+ _upperRightShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kShuttleOverloadedIn, kShuttleOverloadedOut);
+ _centerShuttleMovie.setTime(kShuttleCenterVerifyingTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kShuttleCoordinatesIn, kShuttleCoordinatesOut);
+ _centerShuttleMovie.setTime(kShuttleCenterScanningTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kShuttleScanningIn, kShuttleScanningOut);
+ _centerShuttleMovie.setTime(kShuttleCenterSafeTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kShuttleSafeIn, kShuttleSafeOut);
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightTransportTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+ GameState.setMarsReadyForShuttleTransport(true);
+ break;
+ }
+ } else {
+ playSpotSoundSync(kShuttleTractorLimitedIn, kShuttleTractorLimitedOut);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case kShuttleTransportSpotID:
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightTransportHiliteTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+ _neighborhoodNotification.setNotificationFlags(kTimeToTransportFlag, kTimeToTransportFlag);
+ break;
+ }
+}
+
+void Mars::showBigExplosion(const Common::Rect &r, const DisplayOrder order) {
+ if (_explosions.isMovieValid()) {
+ _explosions.setDisplayOrder(order);
+
+ Common::Rect r2 = r;
+ int dx = r.width() / 2;
+ int dy = r.height() / 2;
+ r2.left -= dx;
+ r2.right += dx;
+ r2.top -= dy;
+ r2.bottom += dy;
+
+ _explosions.setBounds(r2);
+ _explosions.show();
+ _explosions.stop();
+ _explosions.setSegment(kBigExplosionStart, kBigExplosionStop);
+ _explosions.setTime(kBigExplosionStart);
+ _explosionCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _explosions.start();
+ }
+}
+
+void Mars::showLittleExplosion(const Common::Rect &r, const DisplayOrder order) {
+ if (_explosions.isMovieValid()) {
+ _explosions.setDisplayOrder(order);
+
+ Common::Rect r2 = r;
+ int dx = r.width() / 2;
+ int dy = r.height() / 2;
+ r2.left -= dx;
+ r2.right += dx;
+ r2.top -= dy;
+ r2.bottom += dy;
+ _explosions.setBounds(r2);
+
+ _explosions.show();
+ _explosions.stop();
+ _explosions.setSegment(kLittleExplosionStart, kLittleExplosionStop);
+ _explosions.setTime(kLittleExplosionStart);
+ _explosionCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _explosions.start();
+ }
+}
+
+void Mars::hitByJunk() {
+ _leftDamageShuttleMovie.setTime(_leftDamageShuttleMovie.getTime() - 40);
+ _leftDamageShuttleMovie.redrawMovieWorld();
+
+ playSpotSoundSync(kMarsJunkCollisionIn, kMarsJunkCollisionOut);
+
+ if (_leftDamageShuttleMovie.getTime() == 0) {
+ die(kDeathRanIntoSpaceJunk);
+ } else {
+ TimeValue t = _leftDamageShuttleMovie.getTime() / 40;
+
+ if (t == 1)
+ playSpotSoundSync(kShuttleHullBreachIn, kShuttleHullBreachOut);
+
+ t = _leftShuttleMovie.getTime();
+ _leftShuttleMovie.setTime(kShuttleLeftDamagedTime);
+ _leftShuttleMovie.redrawMovieWorld();
+ _vm->delayShell(1, 3);
+ _leftShuttleMovie.setTime(t);
+ _leftShuttleMovie.redrawMovieWorld();
+ }
+}
+
+void Mars::setUpNextDropTime() {
+ _robotShip.setUpNextDropTime();
+}
+
+void Mars::decreaseRobotShuttleEnergy(const int delta, Common::Point impactPoint) {
+ _rightDamageShuttleMovie.setTime(_rightDamageShuttleMovie.getTime() - 40 * delta);
+ _rightDamageShuttleMovie.redrawMovieWorld();
+
+ if (_rightDamageShuttleMovie.getTime() == 0) {
+ Common::Rect r;
+ _robotShip.getShuttleBounds(r);
+ int size = MAX(r.width(), r.height());
+ r = Common::Rect::center(impactPoint.x, impactPoint.y, size, size);
+ _robotShip.killRobotShip();
+ showBigExplosion(r, kShuttleRobotShipOrder);
+ } else if (delta > 1) {
+ Common::Rect r;
+ _robotShip.getShuttleBounds(r);
+ int size = MIN(r.width(), r.height());
+ r = Common::Rect::center(impactPoint.x, impactPoint.y, size, size);
+ showLittleExplosion(r, kShuttleWeaponBackOrder);
+ TimeValue t = _rightShuttleMovie.getTime();
+ _rightShuttleMovie.setTime(kShuttleRightDamagedTime);
+ _rightShuttleMovie.redrawMovieWorld();
+ _vm->delayShell(1, 3);
+ _rightShuttleMovie.setTime(t);
+ _rightShuttleMovie.redrawMovieWorld();
+ }
+
+ if (_rightDamageShuttleMovie.getTime() <= 40) {
+ GameState.setScoringStoppedRobotsShuttle();
+ if (!GameState.getMarsHitRobotWithCannon())
+ GameState.setScoringMarsGandhi();
+ }
+}
+
+void Mars::updateCursor(const Common::Point cursorLocation, const Hotspot *cursorSpot) {
+ if (cursorSpot && cursorSpot->getObjectID() == kShuttleViewSpotID) {
+ if (_weaponSelection != kNoWeapon)
+ _vm->_cursor->setCurrentFrameIndex(6);
+ else
+ _vm->_cursor->setCurrentFrameIndex(0);
+ } else {
+ Neighborhood::updateCursor(cursorLocation, cursorSpot);
+ }
+}
+
+AirQuality Mars::getAirQuality(const RoomID room) {
+ if ((room >= kMars36 && room <= kMars39) || (room >= kMarsMaze004 && room <= kMarsMaze200))
+ return kAirQualityVacuum;
+ if (room == kMars35 && !GameState.getMarsAirlockOpen())
+ return kAirQualityVacuum;
+ if (room == kMars60 && !GameState.getMarsAirlockOpen())
+ return kAirQualityVacuum;
+
+ return Neighborhood::getAirQuality(room);
+}
+
+// Start up panting sound if necessary.
+
+void Mars::checkAirMask() {
+ Neighborhood::checkAirMask();
+
+ if (getAirQuality(GameState.getCurrentRoom()) == kAirQualityVacuum) {
+ if (g_airMask->isAirMaskOn()) {
+ if (_noAirFuse.isFuseLit()) {
+ _noAirFuse.stopFuse();
+ loadLoopSound2("");
+ loadAmbientLoops();
+ playSpotSoundSync(kMarsOxyMaskOnIn, kMarsOxyMaskOnOut);
+ }
+ } else {
+ if (!_noAirFuse.isFuseLit()) {
+ loadLoopSound2("Sounds/Mars/SukWind1.22K.AIFF");
+ _noAirFuse.primeFuse(kVacuumSurvivalTimeLimit);
+ _noAirFuse.lightFuse();
+ }
+ }
+ } else {
+ if (_noAirFuse.isFuseLit()) {
+ _noAirFuse.stopFuse();
+ loadLoopSound2("");
+ loadAmbientLoops();
+ }
+ }
+}
+
+void Mars::airStageExpired() {
+ if (((PegasusEngine *)g_engine)->playerHasItemID(kAirMask))
+ die(kDeathNoAirInMaze);
+ else
+ die(kDeathNoMaskInMaze);
+}
+
+void Mars::lockThawed() {
+ startExtraSequence(kMars57ThawLock, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void Mars::setUpReactorLevel1() {
+ _reactorStage = 1;
+ makeColorSequence();
+ _guessObject.initReactorGuess();
+ _undoPict.initFromPICTResource(_vm->_resFork, kReactorUndoHilitePICTID);
+ _undoPict.setDisplayOrder(kMonitorLayer);
+ _undoPict.moveElementTo(kUndoHiliteLeft, kUndoHiliteTop);
+ _undoPict.startDisplaying();
+ _guessHistory.initReactorHistory();
+ _choiceHighlight.initReactorChoiceHighlight();
+ setCurrentActivation(kActivateReactorInGame);
+ _bombFuse.primeFuse(kColorMatchingTimeLimit);
+ _bombFuse.setFunctor(new Common::Functor0Mem<void, Mars>(this, &Mars::bombExplodesInGame));
+ _bombFuse.lightFuse();
+}
+
+void Mars::setUpNextReactorLevel() {
+ _guessObject.show();
+ _guessHistory.show();
+ _guessHistory.clearHistory();
+ _choiceHighlight.show();
+ _reactorStage++;
+ makeColorSequence();
+}
+
+void Mars::makeColorSequence() {
+ int32 code[5];
+ int32 highest = _reactorStage + 2;
+
+ for (int32 i = 0; i < highest; i++)
+ code[i] = i;
+
+ _vm->shuffleArray(code, highest);
+ _currentGuess[0] = -1;
+ _currentGuess[1] = -1;
+ _currentGuess[2] = -1;
+ _nextGuess = 0;
+ _guessObject.setGuess(-1, -1, -1);
+ _guessHistory.setAnswer(code[0], code[1], code[2]);
+}
+
+void Mars::doUndoOneGuess() {
+ if (_nextGuess > 0) {
+ _undoPict.show();
+ _vm->delayShell(1, 2);
+ _undoPict.hide();
+ _nextGuess--;
+ _currentGuess[_nextGuess] = -1;
+ _guessObject.setGuess(_currentGuess[0], _currentGuess[1], _currentGuess[2]);
+ _choiceHighlight.resetHighlight();
+
+ if (_currentGuess[0] != -1) {
+ _choiceHighlight.highlightChoice(_currentGuess[0]);
+
+ if (_currentGuess[1] != -1) {
+ _choiceHighlight.highlightChoice(_currentGuess[1]);
+
+ if (_currentGuess[2] != -1)
+ _choiceHighlight.highlightChoice(_currentGuess[2]);
+ }
+ }
+ }
+}
+
+void Mars::doReactorGuess(int32 guess) {
+ _choiceHighlight.highlightChoice(guess);
+ _currentGuess[_nextGuess] = guess;
+ _guessObject.setGuess(_currentGuess[0], _currentGuess[1], _currentGuess[2]);
+
+ switch (guess) {
+ case 0:
+ playSpotSoundSync(kColorMatchRedIn, kColorMatchRedOut);
+ break;
+ case 1:
+ playSpotSoundSync(kColorMatchYellowIn, kColorMatchYellowOut);
+ break;
+ case 2:
+ playSpotSoundSync(kColorMatchGreenIn, kColorMatchGreenOut);
+ break;
+ case 3:
+ playSpotSoundSync(kColorMatchBlueIn, kColorMatchBlueOut);
+ break;
+ case 4:
+ playSpotSoundSync(kColorMatchPurpleIn, kColorMatchPurpleOut);
+ break;
+ }
+
+ _nextGuess++;
+
+ if (_nextGuess == 3) {
+ _vm->delayShell(1, 2);
+ _nextGuess = 0;
+ _guessHistory.addGuess(_currentGuess[0], _currentGuess[1], _currentGuess[2]);
+
+ switch (_guessHistory.getCurrentNumCorrect()) {
+ case 0:
+ playSpotSoundSync(kColorMatchZeroNodesIn, kColorMatchZeroNodesOut);
+ break;
+ case 1:
+ playSpotSoundSync(kColorMatchOneNodeIn, kColorMatchOneNodeOut);
+ break;
+ case 2:
+ playSpotSoundSync(kColorMatchTwoNodesIn, kColorMatchTwoNodesOut);
+ break;
+ case 3:
+ playSpotSoundSync(kColorMatchThreeNodesIn, kColorMatchThreeNodesOut);
+ break;
+ }
+
+ _currentGuess[0] = -1;
+ _currentGuess[1] = -1;
+ _currentGuess[2] = -1;
+ _guessObject.setGuess(-1, -1, -1);
+ _choiceHighlight.resetHighlight();
+
+ if (_guessHistory.isSolved()) {
+ _guessHistory.showAnswer();
+ _vm->delayShell(1, 2);
+ _guessObject.hide();
+ _guessHistory.hide();
+ _choiceHighlight.hide();
+
+ switch (_reactorStage) {
+ case 1:
+ startExtraSequence(kMars57GameLevel2, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 2:
+ startExtraSequence(kMars57GameLevel3, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 3:
+ _bombFuse.stopFuse();
+ _guessObject.disposeReactorGuess();
+ _undoPict.deallocateSurface();
+ _guessHistory.disposeReactorHistory();
+ _choiceHighlight.disposeReactorChoiceHighlight();
+ GameState.setScoringDisarmedCardBomb();
+ startExtraSequence(kMars57GameSolved, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ } else if (_guessHistory.getNumGuesses() >= 5) {
+ _vm->delayShell(2, 1);
+ bombExplodesInGame();
+ }
+ }
+}
+
+void Mars::bombExplodesInGame() {
+ _guessObject.disposeReactorGuess();
+ _undoPict.deallocateSurface();
+ _guessHistory.disposeReactorHistory();
+ _choiceHighlight.disposeReactorChoiceHighlight();
+ startExtraSequence(kMars57BombExplodesInGame, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void Mars::didntFindBomb() {
+ die(kDeathDidntFindMarsBomb);
+}
+
+Common::String Mars::getBriefingMovie() {
+ Common::String movieName = Neighborhood::getBriefingMovie();
+
+ if (!movieName.empty())
+ return movieName;
+
+ return "Images/AI/Mars/XM01";
+}
+
+Common::String Mars::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ RoomID room = GameState.getCurrentRoom();
+
+ if (room >= kMars0A && room <= kMars21)
+ return "Images/AI/Mars/XME1";
+ else if (room >= kMars22 && room <= kMars31South)
+ return "Images/AI/Mars/XME2";
+ else if (room >= kMars52 && room <= kMars58)
+ return "Images/AI/Mars/XMREACE";
+
+ return "Images/AI/Mars/XME3";
+ }
+
+ return movieName;
+}
+
+uint Mars::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars27, kNorth):
+ case MakeRoomView(kMars28, kNorth):
+ case MakeRoomView(kMars49, kSouth):
+ numHints = 1;
+ break;
+ case MakeRoomView(kMars31, kSouth):
+ case MakeRoomView(kMars31South, kSouth):
+ if (!GameState.isTakenItemID(kMarsCard))
+ numHints = 1;
+ break;
+ case MakeRoomView(kMars34, kNorth):
+ if (!GameState.isTakenItemID(kMarsCard))
+ numHints = 2;
+ break;
+ case MakeRoomView(kMars34, kSouth):
+ case MakeRoomView(kMars45, kNorth):
+ if (!GameState.isTakenItemID(kCrowbar))
+ numHints = 1;
+ break;
+ case MakeRoomView(kMars51, kEast):
+ if (GameState.isCurrentDoorOpen() && !GameState.getShieldOn()) {
+ if (GameState.isTakenItemID(kShieldBiochip))
+ numHints = 1;
+ else
+ numHints = 2;
+ }
+ break;
+ case MakeRoomView(kMars52, kNorth):
+ case MakeRoomView(kMars52, kSouth):
+ case MakeRoomView(kMars52, kEast):
+ case MakeRoomView(kMars52, kWest):
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kWest):
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ if (!GameState.getShieldOn()) {
+ if (GameState.isTakenItemID(kShieldBiochip))
+ numHints = 1;
+ else
+ numHints = 2;
+ }
+ break;
+ case MakeRoomView(kMars56, kEast):
+ if (getCurrentActivation() == kActivateReactorReadyForNitrogen) {
+ if ((ExtraID)_lastExtra == kMars57LowerScreenClosed)
+ numHints = 3;
+ } else if (getCurrentActivation() == kActivateReactorPlatformOut) {
+ if (!GameState.getShieldOn()) {
+ if (GameState.isTakenItemID(kShieldBiochip))
+ numHints = 1;
+ else
+ numHints = 2;
+ }
+ }
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String Mars::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty()) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kMars27, kNorth):
+ case MakeRoomView(kMars28, kNorth):
+ return "Images/AI/Globals/XGLOB5C";
+ case MakeRoomView(kMars31, kSouth):
+ case MakeRoomView(kMars31South, kSouth):
+ case MakeRoomView(kMars34, kSouth):
+ case MakeRoomView(kMars45, kNorth):
+ return "Images/AI/Globals/XGLOB1C";
+ case MakeRoomView(kMars34, kNorth):
+ if (hintNum == 1)
+ return "Images/AI/Globals/XGLOB2C";
+
+ return "Images/AI/Globals/XGLOB3G";
+ case MakeRoomView(kMars49, kSouth):
+ if (GameState.isTakenItemID(kAirMask))
+ return "Images/AI/Globals/XGLOB3E";
+
+ return "Images/AI/Globals/XGLOB1C";
+ case MakeRoomView(kMars51, kEast):
+ if (GameState.isTakenItemID(kShieldBiochip))
+ return "Images/AI/Mars/XM52NW";
+
+ if (hintNum == 1)
+ return "Images/AI/Globals/XGLOB2D";
+
+ return "Images/AI/Globals/XGLOB3F";
+ case MakeRoomView(kMars52, kNorth):
+ case MakeRoomView(kMars52, kSouth):
+ case MakeRoomView(kMars52, kEast):
+ case MakeRoomView(kMars52, kWest):
+ case MakeRoomView(kMars54, kNorth):
+ case MakeRoomView(kMars54, kSouth):
+ case MakeRoomView(kMars54, kEast):
+ case MakeRoomView(kMars54, kWest):
+ case MakeRoomView(kMars56, kNorth):
+ case MakeRoomView(kMars56, kSouth):
+ case MakeRoomView(kMars56, kWest):
+ case MakeRoomView(kMars58, kNorth):
+ case MakeRoomView(kMars58, kSouth):
+ case MakeRoomView(kMars58, kEast):
+ case MakeRoomView(kMars58, kWest):
+ if (hintNum == 1) {
+ if (GameState.isTakenItemID(kShieldBiochip))
+ return "Images/AI/Mars/XM52NW";
+
+ return "Images/AI/Globals/XGLOB2D";
+ }
+
+ return "Images/AI/Globals/XGLOB3F";
+ case MakeRoomView(kMars56, kEast):
+ if (getCurrentActivation() == kActivateReactorReadyForNitrogen)
+ return Common::String::format("Images/AI/Mars/XM57SD%d", hintNum);
+
+ if (hintNum == 1) {
+ if (GameState.isTakenItemID(kShieldBiochip))
+ return "Images/AI/Mars/XM52NW";
+
+ return "Images/AI/Globals/XGLOB2D";
+ }
+
+ return "Images/AI/Globals/XGLOB3F";
+ }
+ }
+
+ return movieName;
+}
+
+bool Mars::inColorMatchingGame() {
+ return _guessObject.isDisplaying();
+}
+
+bool Mars::canSolve() {
+ return GameState.getCurrentRoomAndView() == MakeRoomView(kMars56, kEast) && (getCurrentActivation() == kActivateReactorReadyForNitrogen ||
+ getCurrentActivation() == kActivateReactorReadyForCrowBar || inColorMatchingGame());
+}
+
+void Mars::doSolve() {
+ if (getCurrentActivation() == kActivateReactorReadyForNitrogen || getCurrentActivation() == kActivateReactorReadyForCrowBar) {
+ _utilityFuse.stopFuse();
+ GameState.setMarsLockBroken(true);
+ GameState.setMarsLockFrozen(false);
+ startExtraLongSequence(kMars57OpenPanel, kMars57OpenPanelChoices, kExtraCompletedFlag, kFilterNoInput);
+ } else if (inColorMatchingGame()) {
+ _bombFuse.stopFuse();
+ _guessObject.disposeReactorGuess();
+ _undoPict.deallocateSurface();
+ _guessHistory.disposeReactorHistory();
+ _choiceHighlight.disposeReactorChoiceHighlight();
+ startExtraSequence(kMars57GameSolved, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+Common::String Mars::getSoundSpotsName() {
+ return "Sounds/Mars/Mars Spots";
+}
+
+Common::String Mars::getNavMovieName() {
+ return "Images/Mars/Mars.movie";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/mars.h b/engines/pegasus/neighborhood/mars/mars.h
new file mode 100644
index 0000000000..0859522890
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/mars.h
@@ -0,0 +1,238 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_MARS_H
+#define PEGASUS_NEIGHBORHOOD_MARS_MARS_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/energybeam.h"
+#include "pegasus/neighborhood/mars/gravitoncannon.h"
+#include "pegasus/neighborhood/mars/planetmover.h"
+#include "pegasus/neighborhood/mars/reactor.h"
+#include "pegasus/neighborhood/mars/robotship.h"
+#include "pegasus/neighborhood/mars/shuttleenergymeter.h"
+#include "pegasus/neighborhood/mars/shuttlehud.h"
+#include "pegasus/neighborhood/mars/spacejunk.h"
+#include "pegasus/neighborhood/mars/tractorbeam.h"
+
+namespace Pegasus {
+
+class InventoryItem;
+class Mars;
+
+enum MarsTimerCode {
+ kMarsLaunchTubeReached,
+ kMarsCanyonChaseFinished,
+ kMarsSpaceChaseFinished // Player ran out of time...
+};
+
+struct MarsTimerEvent {
+ Mars *mars;
+ MarsTimerCode event;
+
+ void fire();
+};
+
+enum ShuttleWeaponSelection {
+ kNoWeapon,
+ kEnergyBeam,
+ kGravitonCannon,
+ kTractorBeam
+};
+
+class Mars : public Neighborhood {
+friend struct MarsTimerEvent;
+public:
+ Mars(InputHandler *, PegasusEngine *);
+ virtual ~Mars();
+
+ void flushGameState();
+
+ virtual uint16 getDateResID() const;
+
+ virtual AirQuality getAirQuality(const RoomID);
+
+ void checkAirMask();
+
+ void showBigExplosion(const Common::Rect &, const DisplayOrder);
+ void showLittleExplosion(const Common::Rect &, const DisplayOrder);
+ void hitByJunk();
+ void decreaseRobotShuttleEnergy(const int, Common::Point impactPoint);
+ void setUpNextDropTime();
+
+ Common::String getBriefingMovie();
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+
+ virtual void shieldOn();
+ virtual void shieldOff();
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ void setSoundFXLevel(const uint16);
+
+ bool canSolve();
+ void doSolve();
+
+ bool inColorMatchingGame();
+
+protected:
+ enum {
+ kMarsPrivatePodStorageOpenFlag,
+ kMarsPrivatePodTurnLeftFlag,
+ kMarsPrivatePodTurnRightFlag,
+ kMarsPrivateRobotTiredOfWaitingFlag,
+ kMarsPrivatePlatformZoomedInFlag,
+ kMarsPrivateBombExposedFlag,
+ kMarsPrivateDraggingBombFlag,
+ kMarsPrivateInSpaceChaseFlag,
+ kMarsPrivateGotMapChipFlag,
+ kMarsPrivateGotOpticalChipFlag,
+ kMarsPrivateGotShieldChipFlag,
+ kNumMarsPrivateFlags
+ };
+
+ void init();
+ void start();
+ void setUpAIRules();
+ void arriveAt(const RoomID, const DirectionConstant);
+ void takeItemFromRoom(Item *);
+ void dropItemIntoRoom(Item *, Hotspot *);
+ void activateHotspots();
+ void activateOneHotspot(HotspotInfoTable::Entry &, Hotspot *);
+ void clickInHotspot(const Input &, const Hotspot *);
+ InputBits getInputFilter();
+
+ TimeValue getViewTime(const RoomID, const DirectionConstant);
+ void getZoomEntry(const HotSpotID, ZoomTable::Entry &);
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+ CanOpenDoorReason canOpenDoor(DoorTable::Entry &);
+ void openDoor();
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+ int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+ void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &);
+ void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &);
+ void turnTo(const DirectionConstant);
+ void receiveNotification(Notification *, const NotificationFlags);
+ void doorOpened();
+ void setUpReactorEnergyDrain();
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+ void lockThawed();
+ void robotTiredOfWaiting();
+
+ void setUpReactorLevel1();
+ void setUpNextReactorLevel();
+ void makeColorSequence();
+ void doUndoOneGuess();
+ void doReactorGuess(int32 guess);
+ void bombExplodesInGame();
+ void didntFindBomb();
+ CanMoveForwardReason canMoveForward(ExitTable::Entry &);
+ void cantMoveThatWay(CanMoveForwardReason);
+ void moveForward();
+ void bumpIntoWall();
+ void turnLeft();
+ void turnRight();
+ void airStageExpired();
+ void loadAmbientLoops();
+ void checkAirlockDoors();
+ void pickedUpItem(Item *item);
+ void cantOpenDoor(CanOpenDoorReason);
+ void launchMaze007Robot();
+ void launchMaze015Robot();
+ void launchMaze101Robot();
+ void launchMaze104Robot();
+ void launchMaze133Robot();
+ void launchMaze136Robot();
+ void launchMaze184Robot();
+ void timerExpired(const uint32);
+ void spotCompleted();
+
+ void doCanyonChase(void);
+ void startMarsTimer(TimeValue, TimeScale, MarsTimerCode);
+ void marsTimerExpired(MarsTimerEvent &);
+ void throwAwayMarsShuttle();
+ void startUpFromFinishedSpaceChase();
+ void startUpFromSpaceChase();
+ void transportToRobotShip();
+ void spaceChaseClick(const Input &, const HotSpotID);
+ void updateCursor(const Common::Point, const Hotspot *);
+
+ Common::String getSoundSpotsName();
+ Common::String getNavMovieName();
+
+ InventoryItem *_attackingItem;
+ FuseFunction _bombFuse;
+ FuseFunction _noAirFuse;
+ FuseFunction _utilityFuse;
+ FlagsArray<byte, kNumMarsPrivateFlags> _privateFlags;
+ uint _reactorStage, _nextGuess;
+ int32 _currentGuess[3];
+ ReactorGuess _guessObject;
+ Picture _undoPict;
+ ReactorHistory _guessHistory;
+ ReactorChoiceHighlight _choiceHighlight;
+
+ Picture _shuttleInterface1;
+ Picture _shuttleInterface2;
+ Picture _shuttleInterface3;
+ Picture _shuttleInterface4;
+ Movie _canyonChaseMovie;
+
+ MarsTimerEvent _marsEvent;
+
+ Movie _leftShuttleMovie;
+ Movie _rightShuttleMovie;
+ Movie _lowerLeftShuttleMovie;
+ Movie _lowerRightShuttleMovie;
+ Movie _centerShuttleMovie;
+ Movie _upperLeftShuttleMovie;
+ Movie _upperRightShuttleMovie;
+ Movie _leftDamageShuttleMovie;
+ Movie _rightDamageShuttleMovie;
+ ShuttleEnergyMeter _shuttleEnergyMeter;
+ Movie _planetMovie;
+ PlanetMover _planetMover;
+ RobotShip _robotShip;
+ ShuttleHUD _shuttleHUD;
+ TractorBeam _tractorBeam;
+ SpaceJunk _junk;
+ EnergyBeam _energyBeam;
+ GravitonCannon _gravitonCannon;
+ Hotspot _energyChoiceSpot;
+ Hotspot _gravitonChoiceSpot;
+ Hotspot _tractorChoiceSpot;
+ Hotspot _shuttleViewSpot;
+ Hotspot _shuttleTransportSpot;
+ ShuttleWeaponSelection _weaponSelection;
+ ScalingMovie _explosions;
+ NotificationCallBack _explosionCallBack;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/planetmover.cpp b/engines/pegasus/neighborhood/mars/planetmover.cpp
new file mode 100644
index 0000000000..a340120c12
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/planetmover.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/movie.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/hermite.h"
+#include "pegasus/neighborhood/mars/planetmover.h"
+#include "pegasus/neighborhood/mars/shuttleenergymeter.h"
+
+namespace Pegasus {
+
+static const TimeScale kRovingScale = kTractorBeamScale;
+static const TimeValue kRovingTime = kTenSeconds * kRovingScale;
+static const TimeValue kRovingSlop = kTwoSeconds * kRovingScale;
+
+static const CoordType kMaxVelocity = 20;
+
+PlanetMover::PlanetMover() {
+ setScale(kRovingScale);
+ _dropping = false;
+ _planetMovie = 0;
+}
+
+void PlanetMover::startMoving(Movie *planetMovie) {
+ _planetMovie = planetMovie;
+ _p4 = kPlanetStartTop;
+ _r4 = ((PegasusEngine *)g_engine)->getRandomNumber(kMaxVelocity - 1);
+ if (_r4 + _p4 < kPlanetStopTop)
+ _r4 = kPlanetStopTop - _p4;
+ newDestination();
+}
+
+void PlanetMover::stopMoving() {
+ stop();
+}
+
+void PlanetMover::dropPlanetOutOfSight() {
+ stop();
+ CoordType currentLoc = hermite(_p1, _p4, _r1, _r4, _lastTime, _duration);
+ CoordType currentV = dHermite(_p1, _p4, _r1, _r4, _lastTime, _duration);
+ _p1 = currentLoc;
+ _r1 = currentV;
+ _p4 = kPlanetStartTop;
+ _r4 = 0;
+ _duration = kTractorBeamTime - kTractorBeamScale;
+ _dropping = true;
+ setSegment(0, _duration);
+ setTime(0);
+ start();
+}
+
+void PlanetMover::newDestination() {
+ _p1 = _p4;
+ _r1 = _r4;
+
+ _p4 = kPlanetStopTop + ((PegasusEngine *)g_engine)->getRandomNumber(kPlanetStartTop - kPlanetStopTop - 1);
+ _r4 = ((PegasusEngine *)g_engine)->getRandomNumber(kMaxVelocity - 1);
+
+ if (_r4 + _p4 < kPlanetStopTop)
+ _r4 = kPlanetStopTop - _p4;
+
+ stop();
+ _duration = kRovingTime + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingSlop - 1);
+ setSegment(0, _duration);
+ setTime(0);
+ start();
+}
+
+void PlanetMover::timeChanged(const TimeValue) {
+ if (_planetMovie) {
+ _planetMovie->moveElementTo(kPlanetStartLeft, hermite(_p1, _p4, _r1, _r4, _lastTime, _duration));
+ if (_lastTime == _duration) {
+ if (_dropping)
+ stop();
+ else
+ newDestination();
+ }
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/planetmover.h b/engines/pegasus/neighborhood/mars/planetmover.h
new file mode 100644
index 0000000000..2c195387e8
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/planetmover.h
@@ -0,0 +1,57 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_PLANETMOVER_H
+#define PEGASUS_NEIGHBORHOOD_MARS_PLANETMOVER_H
+
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class Movie;
+
+class PlanetMover : IdlerTimeBase {
+public:
+ PlanetMover();
+ virtual ~PlanetMover() {}
+
+ void startMoving(Movie *);
+ void stopMoving();
+
+ void dropPlanetOutOfSight();
+
+protected:
+ void newDestination();
+ virtual void timeChanged(const TimeValue);
+
+ Movie *_planetMovie;
+ CoordType _p1, _p4, _r1, _r4;
+ TimeValue _duration;
+ bool _dropping;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/reactor.cpp b/engines/pegasus/neighborhood/mars/reactor.cpp
new file mode 100644
index 0000000000..334fb98879
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/reactor.cpp
@@ -0,0 +1,297 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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
+ * aint32 with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/reactor.h"
+
+namespace Pegasus {
+
+static const CoordType kCurrentGuessWidth = 121;
+static const CoordType kCurrentGuessHeight = 23;
+
+static const CoordType kOneGuessWidth = 25;
+static const CoordType kOneGuessHeight = 23;
+
+static const ResIDType kReactorChoicesPICTID = 905;
+
+static const CoordType kCurrentGuessLeft = kNavAreaLeft + 146;
+static const CoordType kCurrentGuessTop = kNavAreaTop + 90;
+
+ReactorGuess::ReactorGuess(const DisplayElementID id) : DisplayElement(id) {
+ setBounds(kCurrentGuessLeft, kCurrentGuessTop, kCurrentGuessLeft + kCurrentGuessWidth,
+ kCurrentGuessTop + kCurrentGuessHeight);
+ setDisplayOrder(kMonitorLayer);
+ _currentGuess[0] = -1;
+ _currentGuess[1] = -1;
+ _currentGuess[2] = -1;
+}
+
+void ReactorGuess::initReactorGuess() {
+ _colors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorChoicesPICTID);
+ startDisplaying();
+ show();
+}
+
+void ReactorGuess::disposeReactorGuess() {
+ stopDisplaying();
+ _colors.deallocateSurface();
+}
+
+void ReactorGuess::setGuess(int32 a, int32 b, int32 c) {
+ _currentGuess[0] = a;
+ _currentGuess[1] = b;
+ _currentGuess[2] = c;
+ triggerRedraw();
+}
+
+void ReactorGuess::draw(const Common::Rect &) {
+ if (_colors.isSurfaceValid()) {
+ Common::Rect r1(0, 0, kOneGuessWidth, kOneGuessHeight);
+ Common::Rect r2 = r1;
+
+ for (int i = 0; i < 3; i++) {
+ if (_currentGuess[i] >= 0) {
+ r1.moveTo(kOneGuessWidth * _currentGuess[i], 0);
+ r2.moveTo(kCurrentGuessLeft + 48 * i, kCurrentGuessTop);
+ _colors.copyToCurrentPortTransparent(r1, r2);
+ }
+ }
+ }
+}
+
+static const CoordType kReactorChoiceHiliteWidth = 166;
+static const CoordType kReactorChoiceHiliteHeight = 26;
+
+static const CoordType kChoiceHiliteLefts[6] = {
+ 0,
+ 34,
+ 34 + 34,
+ 34 + 34 + 32,
+ 34 + 34 + 32 + 34,
+ 34 + 34 + 32 + 34 + 32
+};
+
+static const ResIDType kReactorChoiceHilitePICTID = 901;
+
+static const CoordType kReactorChoiceHiliteLeft = kNavAreaLeft + 116;
+static const CoordType kReactorChoiceHiliteTop = kNavAreaTop + 158;
+
+ReactorChoiceHighlight::ReactorChoiceHighlight(const DisplayElementID id) : DisplayElement(id) {
+ setBounds(kReactorChoiceHiliteLeft, kReactorChoiceHiliteTop, kReactorChoiceHiliteLeft + kReactorChoiceHiliteWidth,
+ kReactorChoiceHiliteTop + kReactorChoiceHiliteHeight);
+ setDisplayOrder(kMonitorLayer);
+}
+
+void ReactorChoiceHighlight::initReactorChoiceHighlight() {
+ _colors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorChoiceHilitePICTID);
+ startDisplaying();
+ show();
+}
+
+void ReactorChoiceHighlight::disposeReactorChoiceHighlight() {
+ stopDisplaying();
+ _colors.deallocateSurface();
+}
+
+void ReactorChoiceHighlight::draw(const Common::Rect &) {
+ if (_colors.isSurfaceValid()) {
+ for (int i = 0; i < 5; ++i) {
+ if (_choices.getFlag(i)) {
+ Common::Rect r1(0, 0, kChoiceHiliteLefts[i + 1] - kChoiceHiliteLefts[i], kReactorChoiceHiliteHeight);
+ Common::Rect r2 = r1;
+ r1.moveTo(kChoiceHiliteLefts[i], 0);
+ r2.moveTo(kReactorChoiceHiliteLeft + kChoiceHiliteLefts[i], kReactorChoiceHiliteTop);
+ _colors.copyToCurrentPort(r1, r2);
+ }
+ }
+ }
+}
+
+static const CoordType kReactorHistoryWidth = 128;
+static const CoordType kReactorHistoryHeight = 168;
+
+static const CoordType kColorWidths[5] = { 24, 25, 25, 26, 27 };
+static const CoordType kColorHeights[5] = { 14, 15, 17, 17, 19};
+
+static const CoordType kHistoryLefts[5][3] = {
+ { 302 + kNavAreaLeft, 329 + kNavAreaLeft, 357 + kNavAreaLeft },
+ { 302 + kNavAreaLeft, 331 + kNavAreaLeft, 360 + kNavAreaLeft },
+ { 303 + kNavAreaLeft, 333 + kNavAreaLeft, 363 + kNavAreaLeft },
+ { 304 + kNavAreaLeft, 335 + kNavAreaLeft, 366 + kNavAreaLeft },
+ { 305 + kNavAreaLeft, 337 + kNavAreaLeft, 369 + kNavAreaLeft }
+};
+
+static const CoordType kHistoryTops[5] = {
+ 39 + kNavAreaTop,
+ 61 + kNavAreaTop,
+ 84 + kNavAreaTop,
+ 110 + kNavAreaTop,
+ 137 + kNavAreaTop
+};
+
+static const CoordType kOneAnswerWidth = 35;
+static const CoordType kOneAnswerHeight = 27;
+
+static const CoordType kDigitWidth = 16;
+static const CoordType kDigitHeight = 12;
+
+static const CoordType kCorrectCountLefts[5] = {
+ 388 + kNavAreaLeft,
+ 392 + kNavAreaLeft,
+ 398 + kNavAreaLeft,
+ 402 + kNavAreaLeft,
+ 406 + kNavAreaLeft
+};
+
+static const CoordType kCorrectCountTops[5] = {
+ 40 + kNavAreaTop,
+ 62 + kNavAreaTop,
+ 86 + kNavAreaTop,
+ 112 + kNavAreaTop,
+ 140 + kNavAreaTop
+};
+
+static const ResIDType kReactorDigitsPICTID = 902;
+static const ResIDType kReactorHistoryPICTID = 903;
+static const ResIDType kReactorAnswerPICTID = 904;
+
+static const CoordType kReactorHistoryLeft = kNavAreaLeft + 302;
+static const CoordType kReactorHistoryTop = kNavAreaTop + 39;
+
+static const CoordType kAnswerLeft = kNavAreaLeft + 304;
+static const CoordType kAnswerTop = kNavAreaTop + 180;
+
+ReactorHistory::ReactorHistory(const DisplayElementID id) : DisplayElement(id) {
+ setBounds(kReactorHistoryLeft, kReactorHistoryTop, kReactorHistoryLeft + kReactorHistoryWidth,
+ kReactorHistoryTop + kReactorHistoryHeight);
+ setDisplayOrder(kMonitorLayer);
+ _numGuesses = 0;
+ _answer[0] = -1;
+ _answer[1] = -1;
+ _answer[2] = -1;
+ _showAnswer = false;
+}
+
+void ReactorHistory::initReactorHistory() {
+ _colors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorHistoryPICTID);
+ _digits.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorDigitsPICTID);
+ _answerColors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorAnswerPICTID);
+ startDisplaying();
+ show();
+}
+
+void ReactorHistory::disposeReactorHistory() {
+ stopDisplaying();
+ _colors.deallocateSurface();
+}
+
+void ReactorHistory::addGuess(int32 a, int32 b, int32 c) {
+ _history[_numGuesses][0] = a;
+ _history[_numGuesses][1] = b;
+ _history[_numGuesses][2] = c;
+ _numGuesses++;
+ triggerRedraw();
+}
+
+void ReactorHistory::clearHistory() {
+ _numGuesses = 0;
+ _showAnswer = false;
+ triggerRedraw();
+}
+
+void ReactorHistory::setAnswer(int32 a, int32 b, int32 c) {
+ _answer[0] = a;
+ _answer[1] = b;
+ _answer[2] = c;
+}
+
+void ReactorHistory::showAnswer() {
+ _showAnswer = true;
+ triggerRedraw();
+}
+
+bool ReactorHistory::isSolved() {
+ for (int i = 0; i < _numGuesses; i++)
+ if (_history[i][0] == _answer[0] && _history[i][1] == _answer[1] && _history[i][2] == _answer[2])
+ return true;
+
+ return false;
+}
+
+void ReactorHistory::draw(const Common::Rect &) {
+ static const CoordType kColorTops[5] = {
+ 0,
+ kColorHeights[0],
+ kColorHeights[0] + kColorHeights[1],
+ kColorHeights[0] + kColorHeights[1] + kColorHeights[2],
+ kColorHeights[0] + kColorHeights[1] + kColorHeights[2] + kColorHeights[3],
+ };
+
+ if (_colors.isSurfaceValid() && _digits.isSurfaceValid()) {
+ for (int i = 0; i < _numGuesses; ++i) {
+ Common::Rect r1(0, 0, kColorWidths[i], kColorHeights[i]);
+ Common::Rect r2 = r1;
+ Common::Rect r3(0, 0, kDigitWidth, kDigitHeight);
+ Common::Rect r4 = r3;
+ int correct = 0;
+
+ for (int j = 0; j < 3; ++j) {
+ r1.moveTo(kColorWidths[i] * _history[i][j], kColorTops[i]);
+ r2.moveTo(kHistoryLefts[i][j], kHistoryTops[i]);
+ _colors.copyToCurrentPortTransparent(r1, r2);
+
+ if (_history[i][j] == _answer[j])
+ correct++;
+ }
+
+ r3.moveTo(kDigitWidth * correct, 0);
+ r4.moveTo(kCorrectCountLefts[i], kCorrectCountTops[i]);
+ _digits.copyToCurrentPort(r3, r4);
+ }
+
+ if (_showAnswer && _answerColors.isSurfaceValid()) {
+ Common::Rect r1(0, 0, kOneAnswerWidth, kOneAnswerHeight);
+ Common::Rect r2 = r1;
+
+ for (int i = 0; i < 3; i++) {
+ r1.moveTo(kOneAnswerWidth * _answer[i], 0);
+ r2.moveTo(kAnswerLeft + 34 * i, kAnswerTop);
+ _answerColors.copyToCurrentPortTransparent(r1, r2);
+ }
+ }
+ }
+}
+
+int32 ReactorHistory::getCurrentNumCorrect() {
+ int correct = 0;
+
+ for (int i = 0; i < 3; i++)
+ if (_history[_numGuesses - 1][i] == _answer[i])
+ correct++;
+
+ return correct;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/reactor.h b/engines/pegasus/neighborhood/mars/reactor.h
new file mode 100644
index 0000000000..86338f8266
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/reactor.h
@@ -0,0 +1,108 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_REACTOR_H
+#define PEGASUS_NEIGHBORHOOD_MARS_REACTOR_H
+
+#include "pegasus/elements.h"
+#include "pegasus/surface.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+class ReactorGuess : public DisplayElement {
+public:
+ ReactorGuess(const DisplayElementID);
+ virtual ~ReactorGuess() {}
+
+ void initReactorGuess();
+ void disposeReactorGuess();
+
+ void setGuess(int32, int32, int32);
+
+ void draw(const Common::Rect &);
+
+protected:
+ int32 _currentGuess[3];
+
+ Surface _colors;
+};
+
+class ReactorChoiceHighlight : public DisplayElement {
+public:
+ ReactorChoiceHighlight(const DisplayElementID);
+ virtual ~ReactorChoiceHighlight() {}
+
+ void initReactorChoiceHighlight();
+ void disposeReactorChoiceHighlight();
+
+ void resetHighlight() {
+ _choices.clearAllFlags();
+ triggerRedraw();
+ }
+
+ bool choiceHighlighted(uint32 whichChoice) { return _choices.getFlag(whichChoice); }
+
+ void draw(const Common::Rect &);
+
+ void highlightChoice(uint32 whichChoice) {
+ _choices.setFlag(whichChoice);
+ triggerRedraw();
+ }
+
+protected:
+ Surface _colors;
+ FlagsArray<byte, 5> _choices;
+};
+
+class ReactorHistory : public DisplayElement {
+public:
+ ReactorHistory(const DisplayElementID);
+ virtual ~ReactorHistory() {}
+
+ void initReactorHistory();
+ void disposeReactorHistory();
+
+ void draw(const Common::Rect &);
+
+ void addGuess(int32, int32, int32);
+ int32 getNumGuesses() { return _numGuesses; }
+ void clearHistory();
+ void setAnswer(int32, int32, int32);
+ void showAnswer();
+ bool isSolved();
+ int32 getCurrentNumCorrect();
+
+protected:
+ Surface _colors, _digits, _answerColors;
+ int32 _answer[3];
+ int32 _history[5][3];
+ int32 _numGuesses;
+ bool _showAnswer;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/robotship.cpp b/engines/pegasus/neighborhood/mars/robotship.cpp
new file mode 100644
index 0000000000..1f4bbc1779
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/robotship.cpp
@@ -0,0 +1,267 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/hermite.h"
+#include "pegasus/neighborhood/mars/mars.h"
+#include "pegasus/neighborhood/mars/robotship.h"
+#include "pegasus/neighborhood/mars/spacechase3d.h"
+#include "pegasus/neighborhood/mars/spacejunk.h"
+
+namespace Pegasus {
+
+static const TimeScale kRovingScale = kTractorBeamScale;
+static const TimeValue kRovingTime = kSixSeconds * kRovingScale;
+static const TimeValue kRovingSlop = kThreeSeconds * kRovingScale;
+
+static const int kNumSpriteColumns = 15;
+static const int kNumSpriteRows = 16;
+
+static const CoordType kInitialLocationLeft = kShuttleWindowLeft - 50;
+static const CoordType kInitialLocationTop = kShuttleWindowTop - 50;
+static const CoordType kInitialLocationWidth = kShuttleWindowWidth + 100;
+static const CoordType kInitialLocationHeight = kShuttleWindowHeight + 100;
+
+static const CoordType kVelocityVectorLength = 100;
+static const CoordType kVelocityVectorSlop = 50;
+
+static const CoordType kRovingLeft = kShuttleWindowLeft + 20;
+static const CoordType kRovingTop = kShuttleWindowTop + 20;
+static const CoordType kRovingWidth = kShuttleWindowMidH - kRovingLeft;
+static const CoordType kRovingHeight = kShuttleWindowMidV - kRovingTop;
+
+RobotShip *g_robotShip = 0;
+
+RobotShip::RobotShip() : _spritesMovie(kNoDisplayElement) {
+ g_robotShip = this;
+ _shipRange = Common::Rect(kShuttleWindowLeft, kShuttleWindowTop, kShuttleWindowLeft + kShuttleWindowWidth,
+ kShuttleWindowTop + kShuttleWindowHeight);
+ setScale(kRovingScale);
+ _currentLocation.x = 0;
+ _currentLocation.y = 0;
+ _snaring = false;
+ _dropJunkFuse.setFunctor(new Common::Functor0Mem<void, RobotShip>(this, &RobotShip::timeToDropJunk));
+ _duration = 0xFFFFFFFF;
+}
+
+RobotShip::~RobotShip() {
+ g_robotShip = 0;
+}
+
+void RobotShip::initRobotShip() {
+ _spritesMovie.initFromMovieFile("Images/Mars/Ship.movie", true);
+ _spritesMovie.setDisplayOrder(kShuttleRobotShipOrder);
+ _spritesMovie.moveElementTo(kPlanetStartLeft, kPlanetStartTop);
+ _spritesMovie.startDisplaying();
+ _spritesMovie.show();
+
+ Common::Rect r;
+ _spritesMovie.getBounds(r);
+ _shipWidth = r.width();
+ _shipHeight = r.height();
+ _dead = false;
+}
+
+void RobotShip::cleanUpRobotShip() {
+ _dropJunkFuse.stopFuse();
+ _spritesMovie.stopDisplaying();
+ _spritesMovie.releaseMovie();
+}
+
+void RobotShip::startMoving() {
+ if (((PegasusEngine *)g_engine)->getRandomBit()) {
+ _p4.x = kInitialLocationLeft + ((PegasusEngine *)g_engine)->getRandomNumber(kInitialLocationWidth - 1);
+ if (((PegasusEngine *)g_engine)->getRandomBit())
+ _p4.y = kInitialLocationTop;
+ else
+ _p4.y = kInitialLocationTop + kInitialLocationHeight;
+ } else {
+ _p4.y = kInitialLocationTop + ((PegasusEngine *)g_engine)->getRandomNumber(kInitialLocationHeight - 1);
+ if (((PegasusEngine *)g_engine)->getRandomBit())
+ _p4.x = kInitialLocationLeft;
+ else
+ _p4.x = kInitialLocationLeft + kInitialLocationWidth;
+ }
+
+ makeVelocityVector(_p4.x, _p4.y, kShuttleWindowLeft + kShuttleWindowWidth / 2,
+ kShuttleWindowTop + kShuttleWindowHeight / 2, _r4);
+ newDestination();
+ setUpNextDropTime();
+}
+
+void RobotShip::killRobotShip() {
+ cleanUpRobotShip();
+ _dead = true;
+}
+
+void RobotShip::setUpNextDropTime() {
+ if (!isSnared()) {
+ _dropJunkFuse.primeFuse(kJunkDropBaseTime + ((PegasusEngine *)g_engine)->getRandomNumber(kJunkDropSlopTime));
+ _dropJunkFuse.lightFuse();
+ }
+}
+
+void RobotShip::timeToDropJunk() {
+ if (g_spaceJunk) {
+ CoordType x, y;
+ _spritesMovie.getCenter(x, y);
+ g_spaceJunk->launchJunk(((PegasusEngine *)g_engine)->getRandomNumber(24), x, y);
+ }
+}
+
+void RobotShip::newDestination() {
+ _p1 = _p4;
+ _r1 = _r4;
+
+ _p4.x = kRovingLeft + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingWidth - 1);
+ _p4.y = kRovingTop + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingHeight - 1);
+
+ if (((PegasusEngine *)g_engine)->getRandomNumber(7) < 6) {
+ if (!sameSign(_p4.x - kShuttleWindowMidH, kShuttleWindowMidH - _p1.x)) {
+ if (sign(_p4.x - kShuttleWindowMidH) > 0)
+ _p4.x -= kRovingWidth;
+ else
+ _p4.x += kRovingWidth;
+ }
+ }
+
+ if (((PegasusEngine *)g_engine)->getRandomNumber(7) < 6) {
+ if (!sameSign(_p4.y - kShuttleWindowMidV, kShuttleWindowMidV - _p1.y)) {
+ if (sign(_p4.y - kShuttleWindowMidV) > 0)
+ _p4.y -= kRovingHeight;
+ else
+ _p4.y += kRovingHeight;
+ }
+ }
+
+ makeVelocityVector(_p4.x, _p4.y, kShuttleWindowLeft + kShuttleWindowWidth / 2,
+ kShuttleWindowTop + kShuttleWindowHeight / 2, _r4);
+ stop();
+ _duration = kRovingTime + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingSlop - 1);
+ setSegment(0, _duration);
+ setTime(0);
+ start();
+}
+
+void RobotShip::moveRobotTo(CoordType x, CoordType y) {
+ _currentLocation.x = x;
+ _currentLocation.y = y;
+
+ if (_spritesMovie.isMovieValid()) {
+ _spritesMovie.moveElementTo(x - (_shipWidth >> 1), y - (_shipHeight >> 1));
+
+ if (x < _shipRange.left)
+ x = 0;
+ else if (x > _shipRange.right - 1)
+ x = _shipRange.width() - 1;
+ else
+ x -= _shipRange.left;
+
+ if (y < _shipRange.top)
+ y = 0;
+ else if (y > _shipRange.bottom - 1)
+ y = _shipRange.height() - 1;
+ else
+ y -= _shipRange.top;
+
+ x = kNumSpriteColumns * x / _shipRange.width();
+ y = kNumSpriteRows * y / _shipRange.height();
+
+ _spritesMovie.setTime(40 * (x + y * kNumSpriteColumns));
+ _spritesMovie.redrawMovieWorld();
+ }
+}
+
+bool RobotShip::pointInShuttle(Common::Point &pt) {
+ Common::Rect r;
+ _spritesMovie.getBounds(r);
+
+ int dx = r.width() / 4;
+ int dy = r.height() / 6;
+
+ r.left += dx;
+ r.right -= dx;
+ r.top += dy;
+ r.bottom -= dy;
+
+ return r.contains(pt);
+}
+
+void RobotShip::hitByEnergyBeam(Common::Point impactPoint) {
+ ((Mars *)g_neighborhood)->decreaseRobotShuttleEnergy(1, impactPoint);
+ setGlowing(true);
+ ((PegasusEngine *)g_engine)->delayShell(1, 3);
+ setGlowing(false);
+}
+
+void RobotShip::hitByGravitonCannon(Common::Point impactPoint) {
+ GameState.setMarsHitRobotWithCannon(true);
+ ((Mars *)g_neighborhood)->decreaseRobotShuttleEnergy(6, impactPoint);
+}
+
+void RobotShip::snareByTractorBeam() {
+ _dropJunkFuse.stopFuse();
+ stop();
+
+ Common::Point currentV;
+ dHermite(_p1, _p4, _r1, _r4, _lastTime, _duration, currentV);
+
+ _p1 = _currentLocation;
+ _r1 = currentV;
+ _p4.x = kShuttleWindowMidH;
+ _p4.y = kShuttleWindowMidV;
+ _r4.x = 0;
+ _r4.y = 0;
+ _duration = kTractorBeamTime;
+ _snaring = true;
+ setSegment(0, _duration);
+ setTime(0);
+ start();
+}
+
+void RobotShip::timeChanged(const TimeValue) {
+ Common::Point newLocation;
+ hermite(_p1, _p4, _r1, _r4, _lastTime, _duration, newLocation);
+ moveRobotTo(newLocation.x, newLocation.y);
+
+ if (_lastTime == _duration) {
+ if (_snaring)
+ stop();
+ else
+ newDestination();
+ }
+}
+
+void RobotShip::makeVelocityVector(CoordType x1, CoordType y1, CoordType x2, CoordType y2, Common::Point &vector) {
+ CoordType length = ((PegasusEngine *)g_engine)->getRandomNumber(kVelocityVectorSlop - 1) + kVelocityVectorLength;
+ vector.x = x2 - x1;
+ vector.y = y2 - y1;
+ float oldLength = sqrt((float)(vector.x * vector.x + vector.y * vector.y));
+ vector.x = (int)(vector.x * length / oldLength);
+ vector.y = (int)(vector.y * length / oldLength);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/robotship.h b/engines/pegasus/neighborhood/mars/robotship.h
new file mode 100644
index 0000000000..04be3ea56e
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/robotship.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_ROBOTSHIP_H
+#define PEGASUS_NEIGHBORHOOD_MARS_ROBOTSHIP_H
+
+#include "pegasus/movie.h"
+
+namespace Pegasus {
+
+static const CoordType kShuttleMovieWidth = 114;
+static const CoordType kShuttleMovieHeight = 42;
+
+class RobotShip : IdlerTimeBase {
+public:
+ RobotShip();
+ virtual ~RobotShip();
+
+ void initRobotShip();
+ void cleanUpRobotShip();
+
+ void startMoving();
+
+ void killRobotShip();
+
+ bool pointInShuttle(Common::Point&);
+
+ void hitByEnergyBeam(Common::Point impactPoint);
+ void hitByGravitonCannon(Common::Point impactPoint);
+
+ void getShuttleBounds(Common::Rect &r) { _spritesMovie.getBounds(r); }
+
+ void setGlowing(const bool glowing) { _spritesMovie.setGlowing(glowing); }
+
+ void snareByTractorBeam();
+ bool isSnared() { return _snaring && getTime() == _duration; }
+
+ bool isDead() { return _dead; }
+
+ void setUpNextDropTime();
+
+protected:
+ void newDestination();
+ void moveRobotTo(CoordType, CoordType);
+ void timeToDropJunk();
+ virtual void timeChanged(const TimeValue);
+ void makeVelocityVector(CoordType, CoordType, CoordType, CoordType, Common::Point &);
+
+ GlowingMovie _spritesMovie;
+ Common::Rect _shipRange;
+ int _shipWidth, _shipHeight;
+ Common::Point _p1, _p4, _r1, _r4, _currentLocation;
+ FuseFunction _dropJunkFuse;
+ TimeValue _duration;
+ bool _snaring, _dead;
+};
+
+extern RobotShip *g_robotShip;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/shuttleenergymeter.cpp b/engines/pegasus/neighborhood/mars/shuttleenergymeter.cpp
new file mode 100644
index 0000000000..cd08dbae6a
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttleenergymeter.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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/shuttleenergymeter.h"
+
+namespace Pegasus {
+
+ShuttleEnergyMeter::ShuttleEnergyMeter() : FaderAnimation(kNoDisplayElement) {
+ setBounds(kShuttleEnergyLeft, kShuttleEnergyTop, kShuttleEnergyLeft + kShuttleEnergyWidth,
+ kShuttleEnergyTop + kShuttleEnergyHeight);
+ setDisplayOrder(kShuttleStatusOrder);
+ setFaderValue(0);
+}
+
+void ShuttleEnergyMeter::initShuttleEnergyMeter() {
+ _meterImage.getImageFromPICTFile("Images/Mars/Shuttle Energy.pict");
+ _lowWarning.getImageFromPICTFile("Images/Mars/Shuttle Low Energy.pict");
+ startDisplaying();
+ show();
+}
+
+void ShuttleEnergyMeter::disposeShuttleEnergyMeter() {
+ stopFader();
+ hide();
+ stopDisplaying();
+ _meterImage.deallocateSurface();
+ _lowWarning.deallocateSurface();
+}
+
+void ShuttleEnergyMeter::draw(const Common::Rect &) {
+ int32 currentValue = getFaderValue();
+
+ Common::Rect r1, r2, bounds;
+ getBounds(bounds);
+
+ if (currentValue < kLowShuttleEnergy) {
+ _lowWarning.getSurfaceBounds(r1);
+ r2 = r1;
+ r2.moveTo(bounds.left, bounds.top);
+ _lowWarning.copyToCurrentPort(r1, r2);
+ }
+
+ _meterImage.getSurfaceBounds(r1);
+ r1.right = r1.left + r1.width() * currentValue / kFullShuttleEnergy;
+ r2 = r1;
+ r2.moveTo(bounds.left + 102, bounds.top + 6);
+ _meterImage.copyToCurrentPort(r1, r2);
+}
+
+void ShuttleEnergyMeter::powerUpMeter() {
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(kThirtyTicksPerSecond, 0, 0, 45, kFullShuttleEnergy);
+ startFader(moveSpec);
+}
+
+void ShuttleEnergyMeter::setEnergyValue(const int32 value) {
+ stopFader();
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(kFifteenTicksPerSecond, value * 3, value, kFullShuttleEnergy * 3, kFullShuttleEnergy);
+ startFader(moveSpec);
+}
+
+void ShuttleEnergyMeter::drainForTractorBeam() {
+ stopFader();
+ TimeValue startTime = 0, stopTime;
+ int32 startValue = getFaderValue(), stopValue;
+
+ if (startValue < kTractorBeamEnergy) {
+ stopTime = startValue * kTractorBeamTime / kTractorBeamEnergy;
+ stopValue = 0;
+ } else {
+ stopTime = kTractorBeamTime;
+ stopValue = startValue - kTractorBeamEnergy;
+ }
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(kTractorBeamScale, startTime, startValue, stopTime, stopValue);
+ startFader(moveSpec);
+}
+
+int32 ShuttleEnergyMeter::getEnergyValue() const {
+ return getFaderValue();
+}
+
+void ShuttleEnergyMeter::dropEnergyValue(const int32 delta) {
+ setEnergyValue(getFaderValue() - delta);
+}
+
+bool ShuttleEnergyMeter::enoughEnergyForTractorBeam() const {
+ return getEnergyValue() >= kTractorBeamEnergy;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/shuttleenergymeter.h b/engines/pegasus/neighborhood/mars/shuttleenergymeter.h
new file mode 100644
index 0000000000..51161e094e
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttleenergymeter.h
@@ -0,0 +1,73 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEENERGYMETER_H
+#define PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEENERGYMETER_H
+
+#include "pegasus/fader.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+static const int32 kFullShuttleEnergy = 100;
+// Low is 20 percent
+static const int32 kLowShuttleEnergy = kFullShuttleEnergy * 20 / 100;
+
+static const int32 kMinDampingEnergy = 15;
+static const int32 kMinGravitonEnergy = 63;
+
+static const TimeScale kTractorBeamScale = kFifteenTicksPerSecond;
+static const TimeValue kTractorBeamTime = kFiveSeconds * kTractorBeamScale;
+static const int32 kTractorBeamEnergy = kLowShuttleEnergy;
+
+class ShuttleEnergyMeter : public FaderAnimation {
+public:
+ ShuttleEnergyMeter();
+ ~ShuttleEnergyMeter() {}
+
+ void initShuttleEnergyMeter();
+ void disposeShuttleEnergyMeter();
+
+ void powerUpMeter();
+
+ void setEnergyValue(const int32);
+ int32 getEnergyValue() const;
+
+ void dropEnergyValue(const int32);
+
+ void drainForTractorBeam();
+
+ bool enoughEnergyForTractorBeam() const;
+
+ void draw(const Common::Rect &);
+
+protected:
+ Surface _meterImage;
+ Surface _lowWarning;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/shuttlehud.cpp b/engines/pegasus/neighborhood/mars/shuttlehud.cpp
new file mode 100644
index 0000000000..11e826278b
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttlehud.cpp
@@ -0,0 +1,246 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/robotship.h"
+#include "pegasus/neighborhood/mars/shuttlehud.h"
+
+namespace Pegasus {
+
+static const CoordType kHUDTargetGridLeft = kShuttleWindowLeft + 16;
+static const CoordType kHUDTargetGridTop = kShuttleWindowTop + 8;
+static const CoordType kHUDTargetGridWidth = 328;
+static const CoordType kHUDTargetGridHeight = 206;
+
+static const CoordType kHUDRS232Left = kHUDTargetGridLeft + 264;
+static const CoordType kHUDRS232Top = kHUDTargetGridTop + 2;
+
+static const CoordType kHUDLockLeft = kShuttleWindowLeft + 101;
+static const CoordType kHUDLockTop = kShuttleWindowTop + 49;
+static const CoordType kHUDLockWidth = 145;
+static const CoordType kHUDLockHeight = 124;
+
+static const CoordType kTractorLockWidth = 50;
+static const CoordType kTractorLockHeight = 30;
+
+static const CoordType kTractorLockLeft = kShuttleWindowMidH - kTractorLockWidth / 2;
+static const CoordType kTractorLockTop = kShuttleWindowMidV - kTractorLockHeight / 2;
+static const CoordType kTractorLockRight = kTractorLockLeft + kTractorLockWidth;
+static const CoordType kTractorLockBottom = kTractorLockTop + kTractorLockHeight;
+
+static const uint16 s_RS232Data[] = {
+ 0xF0E1, 0xCE70,
+ 0xF9E1, 0xEF78,
+ 0x4900, 0x2108,
+ 0x79C0, 0xE738,
+ 0x70E1, 0xC770,
+ 0x5821, 0x0140,
+ 0x4DE1, 0xEF78,
+ 0x45C1, 0xEE78
+};
+
+static const uint16 s_lockData[] = {
+ 0xE007, 0xFE1F, 0xF8E0, 0x7000,
+ 0xE00F, 0xFF3F, 0xFCE0, 0xE000,
+ 0xE00E, 0x0738, 0x1CE1, 0xC000,
+ 0xE00E, 0x0738, 0x00FF, 0x8000,
+ 0xE00E, 0x0738, 0x00FF, 0x0000,
+ 0xE00E, 0x0738, 0x00E3, 0x8000,
+ 0xE00E, 0x0738, 0x1CE1, 0xC000,
+ 0xFFCF, 0xFF3F, 0xFCE0, 0xE000,
+ 0xFFC7, 0xFE1F, 0xF8E0, 0x7000
+};
+
+#define drawHUDLockLine(x1, y1, x2, y2, penX, penY, color) \
+ screen->drawThickLine((x1) + kHUDLockLeft, (y1) + kHUDLockTop, \
+ (x2) + kHUDLockLeft, (y2) + kHUDLockTop, penX, penY, color)
+
+#define drawHUDLockArrows(offset, color) \
+ drawHUDLockLine(63, 0 + (offset), 68, 5 + (offset), 1, 3, color); \
+ drawHUDLockLine(71, 8 + (offset), 77, 14 + (offset), 1, 3, color); \
+ drawHUDLockLine(78, 14 + (offset), 84, 8 + (offset), 1, 3, color); \
+ drawHUDLockLine(87, 5 + (offset), 92, 0 + (offset), 1, 3, color); \
+ drawHUDLockLine(63, 121 - (offset), 68, 116 - (offset), 1, 3, color); \
+ drawHUDLockLine(71, 113 - (offset), 77, 107 - (offset), 1, 3, color); \
+ drawHUDLockLine(78, 107 - (offset), 84, 113 - (offset), 1, 3, color); \
+ drawHUDLockLine(87, 116 - (offset), 92, 121 - (offset), 1, 3, color); \
+\
+ drawHUDLockLine(13 + (offset), 47, 18 + (offset), 52, 3, 1, color); \
+ drawHUDLockLine(21 + (offset), 55, 27 + (offset), 61, 3, 1, color); \
+ drawHUDLockLine(27 + (offset), 62, 21 + (offset), 68, 3, 1, color); \
+ drawHUDLockLine(18 + (offset), 71, 13 + (offset), 76, 3, 1, color); \
+ drawHUDLockLine(142 - (offset), 47, 137 - (offset), 52, 3, 1, color); \
+ drawHUDLockLine(134 - (offset), 55, 128 - (offset), 61, 3, 1, color); \
+ drawHUDLockLine(128 - (offset), 62, 134 - (offset), 68, 3, 1, color); \
+ drawHUDLockLine(137 - (offset), 71, 142 - (offset), 76, 3, 1, color)
+
+ShuttleHUD::ShuttleHUD() : DisplayElement(kNoDisplayElement) {
+ _lightGreen = g_system->getScreenFormat().RGBToColor(0, 204, 0);
+ _gridDarkGreen = g_system->getScreenFormat().RGBToColor(0, 85, 0);
+ _lockDarkGreen1 = g_system->getScreenFormat().RGBToColor(0, 68, 0);
+ _lockDarkGreen2 = g_system->getScreenFormat().RGBToColor(0, 65, 0);
+
+ _targetLocked = false;
+ setBounds(kShuttleWindowLeft, kShuttleWindowTop, kShuttleWindowLeft + kShuttleWindowWidth,
+ kShuttleWindowTop + kShuttleWindowHeight);
+ setDisplayOrder(kShuttleHUDOrder);
+}
+
+void ShuttleHUD::initShuttleHUD() {
+ startDisplaying();
+ startIdling();
+}
+
+void ShuttleHUD::cleanUpShuttleHUD() {
+ stopIdling();
+ stopDisplaying();
+}
+
+void ShuttleHUD::showTargetGrid() {
+ show();
+}
+
+void ShuttleHUD::hideTargetGrid() {
+ hide();
+ unlockOnTarget();
+}
+
+void ShuttleHUD::useIdleTime() {
+ if (isVisible()) {
+ Common::Rect r;
+ g_robotShip->getShuttleBounds(r);
+ if (r.left < kTractorLockRight && r.right > kTractorLockLeft && r.top < kTractorLockBottom && r.bottom > kTractorLockTop)
+ lockOnTarget();
+ else
+ unlockOnTarget();
+ }
+}
+
+void ShuttleHUD::lockOnTarget() {
+ if (!_targetLocked) {
+ _targetLocked = true;
+ triggerRedraw();
+ }
+}
+
+void ShuttleHUD::unlockOnTarget() {
+ if (_targetLocked) {
+ _targetLocked = false;
+ triggerRedraw();
+ }
+}
+
+void ShuttleHUD::draw(const Common::Rect &) {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+
+ for (int y = 0; y < 35; y++) {
+ Common::Rect r;
+
+ if (y & 1) {
+ if (y == 17) {
+ r = Common::Rect(0, 0, 4, 2);
+ r.moveTo(kHUDTargetGridLeft + 8, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 12, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+
+ r = Common::Rect(0, 0, 6, 2);
+ r.moveTo(kHUDTargetGridLeft + 2, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _lightGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 8, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _lightGreen);
+
+ r = Common::Rect(0, 0, 23, 2);
+ r.moveTo(kHUDTargetGridLeft + 12, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _lightGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 35, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _lightGreen);
+ } else if (y == 1 || y == 15 || y == 19 || y == 33) {
+ r = Common::Rect(0, 0, 4, 2);
+ r.moveTo(kHUDTargetGridLeft + 2, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 6, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+
+ r = Common::Rect(0, 0, 15, 2);
+ r.moveTo(kHUDTargetGridLeft + 8, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 23, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ } else {
+ r = Common::Rect(0, 0, 4, 2);
+ r.moveTo(kHUDTargetGridLeft + 2, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 6, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+
+ r = Common::Rect(0, 0, 10, 2);
+ r.moveTo(kHUDTargetGridLeft + 8, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 18, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ }
+ } else {
+ r = Common::Rect(0, 0, 2, 2);
+ r.moveTo(kHUDTargetGridLeft, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 2, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+
+ r = Common::Rect(0, 0, 4, 2);
+ r.moveTo(kHUDTargetGridLeft + 8, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ r.moveTo(kHUDTargetGridLeft + kHUDTargetGridWidth - 12, y * 6 + kHUDTargetGridTop);
+ screen->fillRect(r, _gridDarkGreen);
+ }
+ }
+
+ drawOneBitImageOr(screen, s_RS232Data, 2, Common::Rect(kHUDRS232Left, kHUDRS232Top,
+ kHUDRS232Left + 29, kHUDRS232Top + 8), _gridDarkGreen);
+
+ if (_targetLocked) {
+ drawHUDLockArrows(0, _lockDarkGreen2);
+ drawHUDLockArrows(12, _lockDarkGreen1);
+ drawHUDLockArrows(24, _lightGreen);
+ drawOneBitImageOr(screen, s_lockData, 4, Common::Rect(kHUDLockLeft, kHUDLockTop + 115,
+ kHUDLockLeft + 52, kHUDLockTop + 115 + 9), _lightGreen);
+ }
+}
+
+void ShuttleHUD::drawOneBitImageOr(Graphics::Surface *screen, const uint16 *data, int pitch, const Common::Rect &bounds, uint32 color) {
+ for (int y = 0; y < bounds.height(); y++) {
+ for (int x = 0; x < bounds.width(); x++) {
+ if ((data[y * pitch + x / 16] & (1 << (15 - (x % 16)))) != 0) {
+ if (screen->format.bytesPerPixel == 2)
+ WRITE_UINT16((byte *)screen->getBasePtr(x + bounds.left, y + bounds.top), color);
+ else
+ WRITE_UINT32((byte *)screen->getBasePtr(x + bounds.left, y + bounds.top), color);
+ }
+ }
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/shuttlehud.h b/engines/pegasus/neighborhood/mars/shuttlehud.h
new file mode 100644
index 0000000000..f7dbbaeae8
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttlehud.h
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEHUD_H
+#define PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEHUD_H
+
+#include "pegasus/elements.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class ShuttleHUD : public DisplayElement, public Idler {
+public:
+ ShuttleHUD();
+
+ void showTargetGrid();
+ void hideTargetGrid();
+
+ void initShuttleHUD();
+ void cleanUpShuttleHUD();
+
+ bool isTargetLocked() { return _targetLocked; }
+
+ void draw(const Common::Rect &);
+
+protected:
+ void useIdleTime();
+ void lockOnTarget();
+ void unlockOnTarget();
+ void drawOneBitImageOr(Graphics::Surface *, const uint16 *, int, const Common::Rect &, uint32);
+
+ bool _targetLocked;
+ uint32 _lightGreen, _gridDarkGreen, _lockDarkGreen1, _lockDarkGreen2;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/shuttleweapon.cpp b/engines/pegasus/neighborhood/mars/shuttleweapon.cpp
new file mode 100644
index 0000000000..b4c360b280
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttleweapon.cpp
@@ -0,0 +1,129 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/robotship.h"
+#include "pegasus/neighborhood/mars/shuttleweapon.h"
+#include "pegasus/neighborhood/mars/spacejunk.h"
+
+namespace Pegasus {
+
+ShuttleWeapon::ShuttleWeapon() : IdlerAnimation(kNoDisplayElement) {
+ setScale(kShuttleWeaponScale);
+ _weaponDuration = kShuttleWeaponScale * 2;
+ setSegment(0, _weaponDuration);
+ setBounds(kShuttleWindowLeft, kShuttleWindowTop, kShuttleWindowLeft + kShuttleWindowWidth,
+ kShuttleWindowTop + kShuttleWindowHeight);
+ setDisplayOrder(kShuttleWeaponFrontOrder);
+}
+
+void ShuttleWeapon::initShuttleWeapon() {
+ startDisplaying();
+}
+
+void ShuttleWeapon::cleanUpShuttleWeapon() {
+ stop();
+ hide();
+ stopDisplaying();
+}
+
+bool ShuttleWeapon::canFireWeapon() {
+ return !isRunning();
+}
+
+void ShuttleWeapon::fireWeapon(const CoordType hStop, const CoordType vStop) {
+ if (!isRunning()) {
+ stop();
+ setTime(0);
+ show();
+
+ Common::Point pt2D(hStop, vStop);
+ project2DTo3D(pt2D, kShuttleDistance, _weaponTarget);
+ _weaponTime = 0;
+ setDisplayOrder(kShuttleWeaponFrontOrder);
+ start();
+ }
+}
+
+void ShuttleWeapon::updateWeaponPosition() {
+ _weaponTime = (float)_lastTime / _weaponDuration;
+ linearInterp(_weaponOrigin, _weaponTarget, _weaponTime, _weaponLocation);
+
+ if (_weaponTime == 1.0) {
+ stop();
+ hide();
+ } else {
+ triggerRedraw();
+ }
+}
+
+void ShuttleWeapon::timeChanged(const TimeValue) {
+ updateWeaponPosition();
+
+ bool hit = false;
+ Common::Point impactPoint;
+
+ if (g_spaceJunk->isJunkFlying()) {
+ hit = collisionWithJunk(impactPoint);
+ if (hit) {
+ stop();
+ hide();
+ hitJunk(impactPoint);
+ }
+ }
+
+ if (!hit && _weaponTime == 1.0 && collisionWithShuttle(impactPoint))
+ hitShuttle(impactPoint);
+}
+
+bool ShuttleWeapon::collisionWithJunk(Common::Point &impactPoint) {
+ if (getDisplayOrder() == kShuttleWeaponFrontOrder) {
+ Point3D junkPosition;
+ g_spaceJunk->getJunkPosition(junkPosition);
+
+ if (junkPosition.z < _weaponLocation.z) {
+ setDisplayOrder(kShuttleWeaponBackOrder);
+ project3DTo2D(_weaponLocation, impactPoint);
+ return g_spaceJunk->pointInJunk(impactPoint);
+ }
+ }
+
+ return false;
+}
+
+bool ShuttleWeapon::collisionWithShuttle(Common::Point &impactPoint) {
+ project3DTo2D(_weaponLocation, impactPoint);
+ return g_robotShip->pointInShuttle(impactPoint);
+}
+
+void ShuttleWeapon::hitJunk(Common::Point impactPoint) {
+ g_spaceJunk->hitByEnergyBeam(impactPoint);
+}
+
+void ShuttleWeapon::hitShuttle(Common::Point impactPoint) {
+ g_robotShip->hitByEnergyBeam(impactPoint);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/shuttleweapon.h b/engines/pegasus/neighborhood/mars/shuttleweapon.h
new file mode 100644
index 0000000000..38529c8919
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttleweapon.h
@@ -0,0 +1,68 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEWEAPON_H
+#define PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEWEAPON_H
+
+#include "pegasus/elements.h"
+#include "pegasus/neighborhood/mars/spacechase3d.h"
+
+namespace Pegasus {
+
+// Can fire multiple times?
+// For now, no...
+// clone2727 adds: And now forever
+
+static const TimeScale kShuttleWeaponScale = kFifteenTicksPerSecond;
+
+class ShuttleWeapon : public IdlerAnimation {
+public:
+ ShuttleWeapon();
+ virtual ~ShuttleWeapon() {}
+
+ virtual void initShuttleWeapon();
+ virtual void cleanUpShuttleWeapon();
+
+ virtual void fireWeapon(const CoordType, const CoordType);
+
+ bool canFireWeapon();
+
+protected:
+ void timeChanged(const TimeValue);
+ virtual void updateWeaponPosition();
+ virtual bool collisionWithJunk(Common::Point &impactPoint);
+ bool collisionWithShuttle(Common::Point &impactPoint);
+ virtual void hitJunk(Common::Point impactPoint);
+ virtual void hitShuttle(Common::Point impactPoint);
+
+ Point3D _weaponOrigin, _weaponTarget;
+ Point3D _weaponLocation;
+ float _weaponTime;
+ TimeValue _weaponDuration;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/spacechase3d.cpp b/engines/pegasus/neighborhood/mars/spacechase3d.cpp
new file mode 100644
index 0000000000..05f8233763
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/spacechase3d.cpp
@@ -0,0 +1,106 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/neighborhood/mars/spacechase3d.h"
+
+namespace Pegasus {
+
+void project3DTo2D(const Point3D &pt3D, Common::Point &pt2D) {
+ pt2D.x = (int)convertSpaceXToScreenH(pt3D.x, pt3D.z);
+ pt2D.y = (int)convertSpaceYToScreenV(pt3D.y, pt3D.z);
+}
+
+void project2DTo3D(const Common::Point &pt2D, const float screenDistance, Point3D &pt3D) {
+ pt3D.x = convertScreenHToSpaceX(pt2D.x, screenDistance);
+ pt3D.y = convertScreenVToSpaceY(pt2D.y, screenDistance);
+ pt3D.z = screenDistance;
+}
+
+void linearInterp(const Point3D &pt1, const Point3D &pt2, const float t, Point3D &pt3) {
+ pt3.x = pt1.x + (pt2.x - pt1.x) * t;
+ pt3.y = pt1.y + (pt2.y - pt1.y) * t;
+ pt3.z = pt1.z + (pt2.z - pt1.z) * t;
+}
+
+void linearInterp(const Point3D &pt1, const float x2, const float y2, const float z2, const float t, Point3D &pt3) {
+ pt3.x = pt1.x + (x2 - pt1.x) * t;
+ pt3.y = pt1.y + (y2 - pt1.y) * t;
+ pt3.z = pt1.z + (z2 - pt1.z) * t;
+}
+
+void linearInterp(const float x1, const float y1, const float z1, const Point3D &pt2, const float t, Point3D &pt3) {
+ pt3.x = x1 + (pt2.x - x1) * t;
+ pt3.y = y1 + (pt2.y - y1) * t;
+ pt3.z = z1 + (pt2.z - z1) * t;
+}
+
+void linearInterp(const float x1, const float y1, const float z1, const float x2, const float y2, const float z2,
+ const float t, Point3D &pt3) {
+ pt3.x = x1 + (x2 - x1) * t;
+ pt3.y = y1 + (y2 - y1) * t;
+ pt3.z = z1 + (z2 - z1) * t;
+}
+
+void linearInterp(const Common::Point &pt1, const Common::Point &pt2, const float t, Common::Point &pt3) {
+ pt3.x = (int)(pt1.x + (pt2.x - pt1.x) * t);
+ pt3.y = (int)(pt1.y + (pt2.y - pt1.y) * t);
+}
+
+void linearInterp(const Common::Point &pt1, const float h2, const float v2, const float t, Common::Point &pt3) {
+ pt3.x = (int)(pt1.x + (h2 - pt1.x) * t);
+ pt3.y = (int)(pt1.y + (v2 - pt1.y) * t);
+}
+
+void linearInterp(const float h1, const float v1, const Common::Point &pt2, const float t, Common::Point &pt3) {
+ pt3.x = (int)(h1 + (pt2.x - h1) * t);
+ pt3.y = (int)(v1 + (pt2.y - v1) * t);
+}
+
+void linearInterp(const float h1, const float v1, const float h2, const float v2, const float t, Common::Point &pt3) {
+ pt3.x = (int)(h1 + (h2 - h1) * t);
+ pt3.y = (int)(v1 + (v2 - v1) * t);
+}
+
+float linearInterp(const float arg1, const float arg2, const float t) {
+ return arg1 + (arg2 - arg1) * t;
+}
+
+bool isNegative(int a) {
+ return a < 0;
+}
+
+bool isPositive(int a) {
+ return a > 0;
+}
+
+int sign(int a) {
+ return isNegative(a) ? -1 : isPositive(a) ? 1 : 0;
+}
+
+bool sameSign(int a, int b) {
+ return sign(a) == sign(b);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/spacechase3d.h b/engines/pegasus/neighborhood/mars/spacechase3d.h
new file mode 100644
index 0000000000..f6815e69bd
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/spacechase3d.h
@@ -0,0 +1,91 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_SPACECHASE3D_H
+#define PEGASUS_NEIGHBORHOOD_MARS_SPACECHASE3D_H
+
+#include "pegasus/neighborhood/mars/constants.h"
+
+namespace Pegasus {
+
+// This is approximately right for a field of view of 72 degrees
+// (Should be set to the tangent of FOV).
+//static const float kTangentFOV = 0.76254;
+static const float kTangentFOV = 1.0;
+
+// Define these as macros and they can be used to define constants...
+#define convertSpaceXToScreenH(x, z) \
+ ((x) / (z) * (kScreenWidth / (2 * kTangentFOV)) + kShuttleWindowMidH)
+
+#define convertSpaceYToScreenV(y, z) \
+ (kShuttleWindowMidV - (y) / (z) * (kScreenWidth / (2 * kTangentFOV)))
+
+#define convertScreenHToSpaceX(x, d) \
+ (((2.0 * kTangentFOV) / kScreenWidth) * ((float)(x) - kShuttleWindowMidH) * (d))
+
+#define convertScreenVToSpaceY(y, d) \
+ (((2.0 * kTangentFOV) / kScreenWidth) * ((float)kShuttleWindowMidV - (y)) * (d))
+
+struct Point3D {
+ float x, y, z;
+
+ Point3D() : x(0), y(0), z(0) {}
+ Point3D(float x1, float y1, float z1) : x(x1), y(y1), z(z1) {}
+ bool operator==(const Point3D &p) const { return x == p.x && y == p.y && z == p.z; }
+ bool operator!=(const Point3D &p) const { return x != p.x || y != p.y || z != p.z; }
+
+ void translate(float dx, float dy, float dz) {
+ x += dx;
+ y += dy;
+ z += dz;
+ }
+};
+
+static const int kScreenWidth = kShuttleWindowWidth;
+
+bool isNegative(int a);
+bool isPositive(int a);
+int sign(int a);
+bool sameSign(int a, int b);
+
+void project3DTo2D(const Point3D &pt3D, Common::Point &pt2D);
+void project2DTo3D(const Common::Point &pt2D, const float screenDistance, Point3D &pt3D);
+
+void linearInterp(const Point3D &pt1, const Point3D &pt2, const float t, Point3D &pt3);
+void linearInterp(const Point3D &pt1, const float x2, const float y2, const float z2, const float t, Point3D &pt3);
+void linearInterp(const float x1, const float y1, const float z1, const Point3D &pt2, const float t, Point3D &pt3);
+void linearInterp(const float x1, const float y1, const float z1, const float x2,
+ const float y2, const float z2, const float t, Point3D &pt3);
+
+void linearInterp(const Common::Point &pt1, const Common::Point &pt2, const float t, Common::Point &pt3);
+void linearInterp(const Common::Point &pt1, const float h2, const float v2, const float t, Common::Point &pt3);
+void linearInterp(const float h1, const float v1, const Common::Point &pt2, const float t, Common::Point &pt3);
+void linearInterp(const float h1, const float v1, const float h2, const float v2, const float t, Common::Point &pt3);
+
+float linearInterp(const float arg1, const float arg2, const float t);
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/spacejunk.cpp b/engines/pegasus/neighborhood/mars/spacejunk.cpp
new file mode 100644
index 0000000000..3912e659c2
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/spacejunk.cpp
@@ -0,0 +1,212 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/mars.h"
+#include "pegasus/neighborhood/mars/spacejunk.h"
+
+namespace Pegasus {
+
+static const CoordType kMaxBounceSize = 90;
+static const CoordType kBounceTargetHRange = 640 - kMaxBounceSize - 2;
+static const CoordType kBounceTargetVRange = 480 - kMaxBounceSize - 2;
+
+static const float kJunkXTarget = 0;
+static const float kJunkYTarget = 0;
+static const float kJunkZTarget = kJunkMinDistance;
+
+SpaceJunk *g_spaceJunk = 0;
+
+SpaceJunk::SpaceJunk(const DisplayElementID id) : ScalingMovie(id) {
+ _timer.setScale(kJunkTimeScale);
+ _bouncing = false;
+ g_spaceJunk = this;
+}
+
+SpaceJunk::~SpaceJunk() {
+ g_spaceJunk = 0;
+}
+
+void SpaceJunk::launchJunk(int16 whichJunk, CoordType xOrigin, CoordType yOrigin) {
+ _bouncing = false;
+ TimeValue startTime = whichJunk * 16 * 40;
+ TimeValue stopTime = startTime + 16 * 40;
+
+ _launchPoint = Point3D(convertScreenHToSpaceX(xOrigin, kJunkMaxDistance),
+ convertScreenVToSpaceY(yOrigin, kJunkMaxDistance), kJunkMaxDistance);
+ startIdling();
+ stop();
+ setFlags(0);
+ setSegment(startTime, stopTime);
+ setFlags(kLoopTimeBase);
+ setTime(startTime);
+ start();
+ show();
+ _timer.stop();
+ _timer.setSegment(0, kJunkTravelTime);
+ _timer.setTime(0);
+
+ // Force it to set up correctly from the get-go
+ useIdleTime();
+
+ _timer.start();
+}
+
+void SpaceJunk::setCenter(const CoordType centerX, const CoordType centerY) {
+ _center.x = centerX;
+ _center.y = centerY;
+
+ Common::Rect r;
+ getBounds(r);
+ r.moveTo(CLIP<int>(centerX - (r.width() >> 1), 0, 640 - r.width()), CLIP<int>(centerY - (r.height() >> 1), 0, 480 - r.height()));
+ setBounds(r);
+}
+
+void SpaceJunk::setScaleSize(const CoordType size) {
+ Common::Rect r;
+ r.left = _center.x - (size >> 1);
+ r.top = _center.y - (size >> 1);
+ r.right = r.left + size;
+ r.bottom = r.top + size;
+ setBounds(r);
+}
+
+void SpaceJunk::useIdleTime() {
+ if (_bouncing) {
+ TimeValue time = _timer.getTime();
+ Common::Point pt;
+ pt.x = linearInterp(0, _bounceTime, time, _bounceStart.x, _bounceStop.x);
+ pt.y = linearInterp(0, _bounceTime, time, _bounceStart.y, _bounceStop.y);
+ CoordType size = linearInterp(0, _bounceTime, time, _bounceSizeStart, _bounceSizeStop);
+ setCenter(pt.x, pt.y);
+ setScaleSize(size);
+
+ if (time == _bounceTime) {
+ stop();
+ stopIdling();
+ hide();
+ ((Mars *)g_neighborhood)->setUpNextDropTime();
+ }
+ } else {
+ float t = (float)_timer.getTime() / kJunkTravelTime;
+ linearInterp(_launchPoint, kJunkXTarget, kJunkYTarget, kJunkZTarget, t, _junkPosition);
+
+ Common::Point pt2D;
+ project3DTo2D(_junkPosition, pt2D);
+ setCenter(pt2D.x, pt2D.y);
+ setScaleSize((int)(convertSpaceYToScreenV(_junkPosition.y - kJunkSize / 2, _junkPosition.z) -
+ convertSpaceYToScreenV(_junkPosition.y + kJunkSize / 2, _junkPosition.z)));
+
+ if (t == 1.0) {
+ rebound(kCollisionReboundTime);
+ ((Mars *)g_neighborhood)->hitByJunk();
+ }
+ }
+}
+
+bool SpaceJunk::pointInJunk(const Common::Point &pt) {
+ Common::Rect r;
+ getBounds(r);
+
+ int dx = r.width() / 4;
+ int dy = r.height() / 4;
+
+ r.left += dx;
+ r.right -= dx;
+ r.top += dy;
+ r.top -= dy;
+
+ return r.contains(pt);
+}
+
+void SpaceJunk::rebound(const TimeValue reboundTime) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ _bounceStart.x = (bounds.left + bounds.right) >> 1;
+ _bounceStart.y = (bounds.top + bounds.bottom) >> 1;
+
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ switch (vm->getRandomNumber(3)) {
+ case 0:
+ _bounceStop.x = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetHRange - 1);
+ _bounceStop.y = kMaxBounceSize / 2 + 1;
+ break;
+ case 1:
+ _bounceStop.x = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetHRange - 1);
+ _bounceStop.y = 480 - kMaxBounceSize / 2 + 1;
+ break;
+ case 2:
+ _bounceStop.x = kMaxBounceSize / 2 + 1;
+ _bounceStop.y = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetVRange - 1);
+ break;
+ case 3:
+ _bounceStop.x = 640 - kMaxBounceSize / 2 + 1;
+ _bounceStop.y = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetVRange - 1);
+ break;
+ }
+
+ _bounceSizeStart = bounds.width();
+ _bounceSizeStop = MIN(_bounceSizeStart, kMaxBounceSize);
+
+ _timer.stop();
+ _timer.setSegment(0, reboundTime);
+ _bounceTime = reboundTime;
+ _timer.setTime(0);
+ _timer.start();
+
+ _bouncing = true;
+}
+
+void SpaceJunk::hitByEnergyBeam(Common::Point) {
+ rebound(kWeaponReboundTime);
+ setGlowing(true);
+ ((PegasusEngine *)g_engine)->delayShell(1, 3);
+ setGlowing(false);
+}
+
+void SpaceJunk::hitByGravitonCannon(Common::Point impactPoint) {
+ stop();
+ stopIdling();
+ hide();
+
+ Common::Rect r;
+ getBounds(r);
+ r = Common::Rect::center(impactPoint.x, impactPoint.y, r.width(), r.height());
+
+ ((Mars *)g_neighborhood)->showBigExplosion(r, kShuttleJunkOrder);
+ ((Mars *)g_neighborhood)->setUpNextDropTime();
+}
+
+void SpaceJunk::getJunkPosition(Point3D &position) {
+ position = _junkPosition;
+}
+
+bool SpaceJunk::isJunkFlying() {
+ return isIdling();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/spacejunk.h b/engines/pegasus/neighborhood/mars/spacejunk.h
new file mode 100644
index 0000000000..2ec9192513
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/spacejunk.h
@@ -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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_SPACEJUNK_H
+#define PEGASUS_NEIGHBORHOOD_MARS_SPACEJUNK_H
+
+#include "pegasus/movie.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/spacechase3d.h"
+
+namespace Pegasus {
+
+static const CoordType kJunkMaxScreenSize = 250;
+
+static const float kJunkSize = convertScreenVToSpaceY(kShuttleWindowMidV - kJunkMaxScreenSize / 2, kJunkMinDistance) -
+ convertScreenVToSpaceY(kShuttleWindowMidV + kJunkMaxScreenSize / 2, kJunkMinDistance);
+
+class SpaceJunk : public ScalingMovie, public Idler {
+public:
+ SpaceJunk(const DisplayElementID);
+ virtual ~SpaceJunk();
+
+ void setCenter(const CoordType, const CoordType);
+ void setScaleSize(const CoordType);
+
+ void useIdleTime();
+
+ void launchJunk(int16, CoordType, CoordType);
+
+ void getJunkPosition(Point3D &);
+ bool isJunkFlying();
+
+ bool pointInJunk(const Common::Point &);
+
+ void hitByEnergyBeam(Common::Point impactPoint);
+ void hitByGravitonCannon(Common::Point impactPoint);
+
+ bool junkFlying() { return _timer.isRunning(); }
+
+protected:
+ void rebound(const TimeValue);
+
+ TimeBase _timer;
+ Point3D _launchPoint, _junkPosition;
+ Common::Point _center;
+ bool _bouncing;
+ Common::Point _bounceStart, _bounceStop;
+ CoordType _bounceSizeStart, _bounceSizeStop;
+ TimeValue _bounceTime;
+};
+
+extern SpaceJunk *g_spaceJunk;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/mars/tractorbeam.cpp b/engines/pegasus/neighborhood/mars/tractorbeam.cpp
new file mode 100644
index 0000000000..d3f9c94328
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/tractorbeam.cpp
@@ -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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/mars/tractorbeam.h"
+
+namespace Pegasus {
+
+TractorBeam::TractorBeam() : DisplayElement(kNoDisplayElement) {
+ setBounds(kShuttleTractorLeft, kShuttleTractorTop, kShuttleTractorLeft + kShuttleTractorWidth,
+ kShuttleTractorTop + kShuttleTractorHeight);
+ setDisplayOrder(kShuttleTractorBeamOrder);
+
+}
+
+static const int kHalfWidth = kShuttleTractorWidth >> 1;
+static const int kHalfHeight = kShuttleTractorHeight >> 1;
+
+static const int kW3Vert = kHalfHeight * kHalfHeight * kHalfHeight;
+static const int kW3Div2Vert = kW3Vert >> 1;
+
+static const int kW3Horiz = kHalfWidth * kHalfWidth * kHalfWidth;
+static const int kW3Div2Horiz = kW3Horiz >> 1;
+
+static const int kMaxLevel = 50;
+
+static const int kAVert = -2 * kMaxLevel;
+static const int kBVert = 3 * kMaxLevel * kHalfHeight;
+
+#define READ_PIXEL(ptr) \
+ if (screen->format.bytesPerPixel == 2) \
+ color = READ_UINT16(ptr); \
+ else \
+ color = READ_UINT32(ptr); \
+ screen->format.colorToRGB(color, r, g, b)
+
+#define WRITE_PIXEL(ptr) \
+ color = screen->format.RGBToColor(r, g, b); \
+ if (screen->format.bytesPerPixel == 2) \
+ WRITE_UINT16(ptr, color); \
+ else \
+ WRITE_UINT32(ptr, color)
+
+#define DO_BLEND(ptr) \
+ READ_PIXEL(ptr); \
+ g += (((0xff - g) * blendHoriz) >> 8); \
+ b += (((0xff - b) * blendHoriz) >> 8); \
+ WRITE_PIXEL(ptr)
+
+void TractorBeam::draw(const Common::Rect &) {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+
+ // Set up vertical DDA.
+ int blendVert = 0;
+ int dVert = 0;
+ int d1Vert = kAVert + kBVert;
+ int d2Vert = 6 * kAVert + 2 * kBVert;
+ int d3Vert = 6 * kAVert;
+
+ byte *rowPtrTop = (byte *)screen->getBasePtr(_bounds.left, _bounds.top);
+ byte *rowPtrBottom = (byte *)screen->getBasePtr(_bounds.left, _bounds.top + ((kHalfHeight << 1) - 1));
+
+ for (int y = kHalfHeight; y > 0; y--) {
+ // Set up horizontal DDA
+ int A = -2 * blendVert;
+ int B = 3 * blendVert * kHalfWidth;
+ int blendHoriz = 0;
+ int dHoriz = 0;
+ int d1Horiz = A + B;
+ int d2Horiz = 6 * A + 2 * B;
+ int d3Horiz = 6 * A;
+
+ byte *pTopLeft = rowPtrTop;
+ byte *pTopRight = rowPtrTop + (kHalfWidth * 2 - 1) * screen->format.bytesPerPixel;
+ byte *pBottomLeft = rowPtrBottom;
+ byte *pBottomRight = rowPtrBottom + (kHalfWidth * 2 - 1) * screen->format.bytesPerPixel;
+
+ for (int x = kHalfWidth; x > 0; x--) {
+ byte r, g, b;
+ uint32 color;
+
+ DO_BLEND(pTopLeft);
+ DO_BLEND(pTopRight);
+ DO_BLEND(pBottomLeft);
+ DO_BLEND(pBottomRight);
+
+ pTopLeft += screen->format.bytesPerPixel;
+ pBottomLeft += screen->format.bytesPerPixel;
+ pTopRight -= screen->format.bytesPerPixel;
+ pBottomRight -= screen->format.bytesPerPixel;
+
+ while (dHoriz > kW3Div2Horiz) {
+ blendHoriz++;
+ dHoriz -= kW3Horiz;
+ }
+
+ dHoriz += d1Horiz;
+ d1Horiz += d2Horiz;
+ d2Horiz += d3Horiz;
+ }
+
+ rowPtrTop += screen->pitch;
+ rowPtrBottom -= screen->pitch;
+
+ while (dVert > kW3Div2Vert) {
+ blendVert++;
+ dVert -= kW3Vert;
+ }
+
+ dVert += d1Vert;
+ d1Vert += d2Vert;
+ d2Vert += d3Vert;
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/tractorbeam.h b/engines/pegasus/neighborhood/mars/tractorbeam.h
new file mode 100644
index 0000000000..cd87992d11
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/tractorbeam.h
@@ -0,0 +1,43 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_MARS_TRACTORBEAM_H
+#define PEGASUS_NEIGHBORHOOD_MARS_TRACTORBEAM_H
+
+#include "pegasus/elements.h"
+
+namespace Pegasus {
+
+class TractorBeam : public DisplayElement {
+public:
+ TractorBeam();
+ virtual ~TractorBeam() {}
+
+ void draw(const Common::Rect &);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/neighborhood.cpp b/engines/pegasus/neighborhood/neighborhood.cpp
new file mode 100644
index 0000000000..07be62c957
--- /dev/null
+++ b/engines/pegasus/neighborhood/neighborhood.cpp
@@ -0,0 +1,1774 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+
+#include "pegasus/compass.h"
+#include "pegasus/cursor.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/graphics.h"
+#include "pegasus/input.h"
+#include "pegasus/interaction.h"
+#include "pegasus/interface.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/mapchip.h"
+#include "pegasus/neighborhood/neighborhood.h"
+#include "pegasus/neighborhood/tsa/fulltsa.h"
+#include "pegasus/neighborhood/tsa/tinytsa.h"
+
+namespace Pegasus {
+
+StriderCallBack::StriderCallBack(Neighborhood *neighborhood) {
+ _neighborhood = neighborhood;
+}
+
+void StriderCallBack::callBack() {
+ _neighborhood->checkStriding();
+}
+
+static const TimeValue kStridingSlop = 39;
+
+Neighborhood *g_neighborhood = 0;
+
+Neighborhood::Neighborhood(InputHandler *nextHandler, PegasusEngine *vm, const Common::String &resName, NeighborhoodID id)
+ : InputHandler(nextHandler), IDObject(id), _vm(vm), _resName(resName), _navMovie(kNavMovieID), _stridingCallBack(this),
+ _neighborhoodNotification(kNeighborhoodNotificationID, (NotificationManager *)vm), _pushIn(kNoDisplayElement),
+ _turnPush(kTurnPushID), _croppedMovie(kCroppedMovieID) {
+ GameState.setOpenDoorLocation(kNoRoomID, kNoDirection);
+ _currentAlternate = 0;
+ _currentActivation = kActivateHotSpotAlways;
+ _interruptionFilter = kFilterAllInput;
+ allowInput(true);
+ resetLastExtra();
+ g_neighborhood = this;
+ _currentInteraction = 0;
+ _doneWithInteraction = false;
+ _croppedMovie.setDisplayOrder(kCroppedMovieLayer);
+}
+
+Neighborhood::~Neighborhood() {
+ for (HotspotIterator it = _neighborhoodHotspots.begin(); it != _neighborhoodHotspots.end(); it++)
+ _vm->getAllHotspots().remove(*it);
+
+ _neighborhoodHotspots.deleteHotspots();
+ g_neighborhood = 0;
+
+ loadLoopSound1("");
+ loadLoopSound2("");
+ newInteraction(kNoInteractionID);
+
+ if (g_AIArea)
+ g_AIArea->removeAllRules();
+}
+
+void Neighborhood::init() {
+ _neighborhoodNotification.notifyMe(this, kNeighborhoodFlags, kNeighborhoodFlags);
+ _navMovieCallBack.setNotification(&_neighborhoodNotification);
+ _turnPushCallBack.setNotification(&_neighborhoodNotification);
+ _delayCallBack.setNotification(&_neighborhoodNotification);
+ _spotSoundCallBack.setNotification(&_neighborhoodNotification);
+
+ debug(0, "Loading '%s' neighborhood resources", _resName.c_str());
+
+ Common::SeekableReadStream *stream = _vm->_resFork->getResource(_doorTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load doors");
+ _doorTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_exitTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load exits");
+ _exitTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_extraTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load extras");
+ _extraTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_hotspotInfoTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load hotspot info");
+ _hotspotInfoTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_spotTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load spots");
+ _spotTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_turnTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load turns");
+ _turnTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_viewTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load views");
+ _viewTable.loadFromStream(stream);
+ delete stream;
+
+ stream = _vm->_resFork->getResource(_zoomTable.getResTag(), _resName);
+ if (!stream)
+ error("Failed to load zooms");
+ _zoomTable.loadFromStream(stream);
+ delete stream;
+
+ createNeighborhoodSpots();
+
+ _navMovie.initFromMovieFile(getNavMovieName());
+ _navMovie.setVolume(_vm->getSoundFXLevel());
+
+ Common::String soundSpotsName = getSoundSpotsName();
+ if (soundSpotsName.empty()) {
+ _spotSounds.disposeSound();
+ } else {
+ _spotSounds.initFromQuickTime(getSoundSpotsName());
+ _spotSounds.setVolume(_vm->getSoundFXLevel());
+ }
+
+ _navMovie.setDisplayOrder(kNavMovieOrder);
+ _navMovie.startDisplaying();
+
+ Common::Rect bounds;
+ _navMovie.getBounds(bounds);
+ _pushIn.allocateSurface(bounds);
+
+ _turnPush.setInAndOutElements(&_pushIn, &_navMovie);
+ _turnPush.setDisplayOrder(kTurnPushOrder);
+ _turnPush.startDisplaying();
+ _navMovieCallBack.initCallBack(&_navMovie, kCallBackAtExtremes);
+ _stridingCallBack.initCallBack(&_navMovie, kCallBackAtTime);
+ _turnPushCallBack.initCallBack(&_turnPush, kCallBackAtExtremes);
+ _delayCallBack.initCallBack(&_delayTimer, kCallBackAtExtremes);
+ _spotSoundCallBack.initCallBack(&_spotSounds, kCallBackAtExtremes);
+
+ setUpAIRules();
+
+ if (g_compass)
+ g_compass->setFaderValue(getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection()));
+
+ _soundLoop1.attachFader(&_loop1Fader);
+ _soundLoop2.attachFader(&_loop2Fader);
+ startIdling();
+}
+
+void Neighborhood::start() {
+ GameState.setCurrentRoom(GameState.getLastRoom());
+ GameState.setCurrentDirection(GameState.getLastDirection());
+ arriveAt(GameState.getNextRoom(), GameState.getNextDirection());
+}
+
+void Neighborhood::receiveNotification(Notification *, const NotificationFlags flags) {
+ if ((flags & (kNeighborhoodMovieCompletedFlag | kTurnCompletedFlag)) != 0 && g_AIArea)
+ g_AIArea->unlockAI();
+ if (flags & kMoveForwardCompletedFlag)
+ arriveAt(GameState.getNextRoom(), GameState.getNextDirection());
+ if (flags & kTurnCompletedFlag)
+ turnTo(GameState.getNextDirection());
+ if (flags & kSpotCompletedFlag)
+ spotCompleted();
+ if (flags & kDoorOpenCompletedFlag)
+ doorOpened();
+ if (flags & kActionRequestCompletedFlag)
+ popActionQueue();
+ if (flags & kDeathExtraCompletedFlag)
+ die(_extraDeathReason);
+}
+
+void Neighborhood::arriveAt(const RoomID room, const DirectionConstant direction) {
+ if (g_map)
+ g_map->moveToMapLocation(GameState.getCurrentNeighborhood(), room, direction);
+
+ GameState.setCurrentNeighborhood(getObjectID());
+
+ _currentActivation = kActivateHotSpotAlways;
+ _interruptionFilter = kFilterAllInput;
+
+ if (room != GameState.getCurrentRoom() || direction != GameState.getCurrentDirection()) {
+ GameState.setCurrentRoom(room);
+ GameState.setCurrentDirection(direction);
+ loadAmbientLoops();
+ activateCurrentView(room, direction, kSpotOnArrivalMask);
+ } else {
+ loadAmbientLoops();
+ showViewFrame(getViewTime(GameState.getCurrentRoom(), GameState.getCurrentDirection()));
+ }
+
+ if (GameState.getOpenDoorRoom() != kNoRoomID) {
+ // Arriving always closes a door.
+ loadAmbientLoops();
+ closeDoorOffScreen(GameState.getOpenDoorRoom(), GameState.getOpenDoorDirection());
+ GameState.setOpenDoorLocation(kNoRoomID, kNoDirection);
+ }
+
+ if (g_compass)
+ g_compass->setFaderValue(getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection()));
+
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+
+ checkContinuePoint(room, direction);
+}
+
+// These functions can be overridden to tweak the exact frames used.
+
+void Neighborhood::getExitEntry(const RoomID room, const DirectionConstant direction, ExitTable::Entry &entry) {
+ entry = _exitTable.findEntry(room, direction, _currentAlternate);
+
+ if (entry.isEmpty())
+ entry = _exitTable.findEntry(room, direction, kNoAlternateID);
+}
+
+TimeValue Neighborhood::getViewTime(const RoomID room, const DirectionConstant direction) {
+ if (GameState.getOpenDoorRoom() == room && GameState.getOpenDoorDirection() == direction) {
+ // If we get here, the door entry for this location must exist.
+ DoorTable::Entry doorEntry = _doorTable.findEntry(room, direction, _currentAlternate);
+
+ if (doorEntry.isEmpty())
+ doorEntry = _doorTable.findEntry(room, direction, kNoAlternateID);
+
+ return doorEntry.movieEnd - 1;
+ }
+
+ ViewTable::Entry viewEntry = _viewTable.findEntry(room, direction, _currentAlternate);
+
+ if (viewEntry.isEmpty())
+ viewEntry = _viewTable.findEntry(room, direction, kNoAlternateID);
+
+ return viewEntry.time;
+}
+
+void Neighborhood::getDoorEntry(const RoomID room, const DirectionConstant direction, DoorTable::Entry &doorEntry) {
+ doorEntry = _doorTable.findEntry(room, direction, _currentAlternate);
+
+ if (doorEntry.isEmpty())
+ doorEntry = _doorTable.findEntry(room, direction, kNoAlternateID);
+}
+
+DirectionConstant Neighborhood::getTurnEntry(const RoomID room, const DirectionConstant direction, const TurnDirection turnDirection) {
+ TurnTable::Entry turnEntry = _turnTable.findEntry(room, direction, turnDirection, _currentAlternate);
+
+ if (turnEntry.isEmpty())
+ turnEntry = _turnTable.findEntry(room, direction, turnDirection, kNoAlternateID);
+
+ return turnEntry.endDirection;
+}
+
+void Neighborhood::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &spotEntry) {
+ spotEntry = _spotTable.findEntry(room, direction, flags, _currentAlternate);
+
+ if (spotEntry.isEmpty())
+ spotEntry = _spotTable.findEntry(room, direction, flags, kNoAlternateID);
+}
+
+void Neighborhood::getZoomEntry(const HotSpotID id, ZoomTable::Entry &zoomEntry) {
+ zoomEntry = _zoomTable.findEntry(id);
+}
+
+void Neighborhood::getHotspotEntry(const HotSpotID id, HotspotInfoTable::Entry &hotspotEntry) {
+ hotspotEntry = _hotspotInfoTable.findEntry(id);
+}
+
+void Neighborhood::getExtraEntry(const uint32 id, ExtraTable::Entry &extraEntry) {
+ extraEntry = _extraTable.findEntry(id);
+}
+
+/////////////////////////////////////////////
+//
+// "Can" functions: Called to see whether or not a user is allowed to do something
+
+CanMoveForwardReason Neighborhood::canMoveForward(ExitTable::Entry &entry) {
+ DoorTable::Entry door;
+
+ getExitEntry(GameState.getCurrentRoom(), GameState.getCurrentDirection(), entry);
+ getDoorEntry(GameState.getCurrentRoom(), GameState.getCurrentDirection(), door);
+
+ // Fixed this so that doors that don't lead anywhere can be opened, but not walked
+ // through.
+ if (door.flags & kDoorPresentMask) {
+ if (GameState.isCurrentDoorOpen()) {
+ if (entry.exitRoom == kNoRoomID)
+ return kCantMoveBlocked;
+ else
+ return kCanMoveForward;
+ } else if (door.flags & kDoorLockedMask) {
+ return kCantMoveDoorLocked;
+ } else {
+ return kCantMoveDoorClosed;
+ }
+ } else if (entry.exitRoom == kNoRoomID) {
+ return kCantMoveBlocked;
+ }
+
+ return kCanMoveForward;
+}
+
+CanTurnReason Neighborhood::canTurn(TurnDirection turnDirection, DirectionConstant &nextDir) {
+ nextDir = getTurnEntry(GameState.getCurrentRoom(), GameState.getCurrentDirection(), turnDirection);
+
+ if (nextDir == kNoDirection)
+ return kCantTurnNoTurn;
+
+ return kCanTurn;
+}
+
+CanOpenDoorReason Neighborhood::canOpenDoor(DoorTable::Entry &entry) {
+ getDoorEntry(GameState.getCurrentRoom(), GameState.getCurrentDirection(), entry);
+
+ if (entry.flags & kDoorPresentMask) {
+ if (GameState.isCurrentDoorOpen())
+ return kCantOpenAlreadyOpen;
+
+ if (entry.flags & kDoorLockedMask)
+ return kCantOpenLocked;
+
+ return kCanOpenDoor;
+ }
+
+ return kCantOpenNoDoor;
+}
+
+void Neighborhood::createNeighborhoodSpots() {
+ Common::SeekableReadStream *hotspotList = _vm->_resFork->getResource(MKTAG('H', 'S', 'L', 's'), _resName);
+ if (!hotspotList)
+ error("Could not load neighborhood hotspots");
+
+ uint32 hotspotCount = hotspotList->readUint32BE();
+
+ while (hotspotCount--) {
+ uint16 id = hotspotList->readUint16BE();
+ uint32 flags = hotspotList->readUint32BE();
+ uint32 rgnSize = hotspotList->readUint32BE();
+
+ int32 startPos = hotspotList->pos();
+
+ debug(0, "Hotspot %d:", id);
+ Region region(hotspotList);
+
+ hotspotList->seek(startPos + rgnSize);
+
+ Hotspot *hotspot = new Hotspot(id);
+ hotspot->setHotspotFlags(flags);
+ hotspot->setArea(region);
+
+ _vm->getAllHotspots().push_back(hotspot);
+ _neighborhoodHotspots.push_back(hotspot);
+ }
+
+ delete hotspotList;
+}
+
+void Neighborhood::popActionQueue() {
+ if (!_actionQueue.empty()) {
+ QueueRequest topRequest = _actionQueue.pop();
+
+ switch (topRequest.requestType) {
+ case kNavExtraRequest:
+ _navMovie.stop();
+ break;
+ case kSpotSoundRequest:
+ _spotSounds.stopSound();
+ break;
+ case kDelayRequest:
+ _delayTimer.stop();
+ break;
+ }
+
+ serviceActionQueue();
+ }
+}
+
+void Neighborhood::serviceActionQueue() {
+ if (!_actionQueue.empty()) {
+ QueueRequest &topRequest = _actionQueue.front();
+
+ if (!topRequest.playing) {
+ topRequest.playing = true;
+ switch (topRequest.requestType) {
+ case kNavExtraRequest:
+ startExtraSequence(topRequest.extra, topRequest.flags, topRequest.interruptionFilter);
+ break;
+ case kSpotSoundRequest:
+ _spotSounds.stopSound();
+ _spotSounds.playSoundSegment(topRequest.start, topRequest.stop);
+ _interruptionFilter = topRequest.interruptionFilter;
+ _spotSoundCallBack.setCallBackFlag(topRequest.flags);
+ _spotSoundCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ break;
+ case kDelayRequest:
+ _delayTimer.stop();
+ _delayCallBack.setCallBackFlag(topRequest.flags);
+ _delayTimer.setSegment(0, topRequest.start, topRequest.stop);
+ _delayTimer.setTime(0);
+ _delayCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _interruptionFilter = topRequest.interruptionFilter;
+ _delayTimer.start();
+ break;
+ }
+ }
+ } else {
+ _interruptionFilter = kFilterAllInput;
+ }
+}
+
+void Neighborhood::requestAction(const QueueRequestType requestType, const ExtraID extra, const TimeValue in, const TimeValue out,
+ const InputBits interruptionFilter, const NotificationFlags flags) {
+
+ QueueRequest request;
+
+ request.requestType = requestType;
+ request.extra = extra;
+ request.start = in;
+ request.stop = out;
+ request.interruptionFilter = interruptionFilter;
+ request.playing = false;
+ request.flags = flags | kActionRequestCompletedFlag;
+ request.notification = &_neighborhoodNotification;
+ _actionQueue.push(request);
+ if (_actionQueue.size() == 1)
+ serviceActionQueue();
+}
+
+void Neighborhood::requestExtraSequence(const ExtraID whichExtra, const NotificationFlags flags, const InputBits interruptionFilter) {
+ requestAction(kNavExtraRequest, whichExtra, 0, 0, interruptionFilter, flags);
+}
+
+void Neighborhood::requestSpotSound(const TimeValue in, const TimeValue out, const InputBits interruptionFilter, const NotificationFlags flags) {
+ requestAction(kSpotSoundRequest, 0xFFFFFFFF, in, out, interruptionFilter, flags);
+}
+
+void Neighborhood::playSpotSoundSync(const TimeValue in, const TimeValue out) {
+ // Let the action queue play out first...
+ while (!actionQueueEmpty()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->checkNotifications();
+ _vm->_system->delayMillis(10);
+ }
+
+ _spotSounds.stopSound();
+ _spotSounds.playSoundSegment(in, out);
+
+ while (_spotSounds.isPlaying()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+}
+
+void Neighborhood::requestDelay(const TimeValue delayDuration, const TimeScale delayScale, const InputBits interruptionFilter, const NotificationFlags flags) {
+ requestAction(kDelayRequest, 0xFFFFFFFF, delayDuration, delayScale, interruptionFilter, flags);
+}
+
+bool operator==(const QueueRequest &arg1, const QueueRequest &arg2) {
+ return arg1.requestType == arg2.requestType && arg1.extra == arg2.extra &&
+ arg1.start == arg2.start && arg1.stop == arg2.stop;
+}
+
+bool operator!=(const QueueRequest &arg1, const QueueRequest &arg2) {
+ return !operator==(arg1, arg2);
+}
+
+Common::String Neighborhood::getBriefingMovie() {
+ if (_currentInteraction)
+ return _currentInteraction->getBriefingMovie();
+
+ return Common::String();
+}
+
+Common::String Neighborhood::getEnvScanMovie() {
+ if (_currentInteraction)
+ return _currentInteraction->getEnvScanMovie();
+
+ return Common::String();
+}
+
+uint Neighborhood::getNumHints() {
+ if (_currentInteraction)
+ return _currentInteraction->getNumHints();
+
+ return 0;
+}
+
+Common::String Neighborhood::getHintMovie(uint hintNum) {
+ if (_currentInteraction)
+ return _currentInteraction->getHintMovie(hintNum);
+
+ return Common::String();
+}
+
+bool Neighborhood::canSolve() {
+ if (_currentInteraction)
+ return _currentInteraction->canSolve();
+
+ return false;
+}
+
+void Neighborhood::doSolve() {
+ if (_currentInteraction)
+ _currentInteraction->doSolve();
+}
+
+bool Neighborhood::okayToJump() {
+ return !_vm->playerHasItemID(kGasCanister) && !_vm->playerHasItemID(kMachineGun);
+}
+
+AirQuality Neighborhood::getAirQuality(const RoomID) {
+ return kAirQualityGood;
+}
+
+void Neighborhood::checkStriding() {
+ if (stillMoveForward()) {
+ ExitTable::Entry nextExit;
+ getExitEntry(GameState.getNextRoom(), GameState.getNextDirection(), nextExit);
+ keepStriding(nextExit);
+ } else {
+ stopStriding();
+ }
+}
+
+bool Neighborhood::stillMoveForward() {
+ Input input;
+
+ InputHandler::readInputDevice(input);
+ return input.upButtonAnyDown();
+}
+
+void Neighborhood::keepStriding(ExitTable::Entry &nextExitEntry) {
+ FaderMoveSpec compassMove;
+
+ if (g_map)
+ g_map->moveToMapLocation(GameState.getCurrentNeighborhood(), GameState.getNextRoom(), GameState.getNextDirection());
+
+ if (g_compass)
+ getExitCompassMove(nextExitEntry, compassMove);
+
+ GameState.setCurrentRoom(GameState.getNextRoom());
+ GameState.setCurrentDirection(GameState.getNextDirection());
+ GameState.setNextRoom(nextExitEntry.exitRoom);
+ GameState.setNextDirection(nextExitEntry.exitDirection);
+
+ if (nextExitEntry.movieEnd == nextExitEntry.exitEnd)
+ scheduleNavCallBack(kNeighborhoodMovieCompletedFlag | kMoveForwardCompletedFlag);
+ else
+ scheduleStridingCallBack(nextExitEntry.movieEnd - kStridingSlop, kStrideCompletedFlag);
+
+ if (g_compass)
+ g_compass->startFader(compassMove);
+}
+
+void Neighborhood::stopStriding() {
+ _navMovie.stop();
+ _neighborhoodNotification.setNotificationFlags(kNeighborhoodMovieCompletedFlag |
+ kMoveForwardCompletedFlag, kNeighborhoodMovieCompletedFlag | kMoveForwardCompletedFlag);
+}
+
+// Compass support
+int16 Neighborhood::getStaticCompassAngle(const RoomID, const DirectionConstant dir) {
+ // North, south, east, west
+ static const int16 compassAngles[] = { 0, 180, 90, 270 };
+ return compassAngles[dir];
+}
+
+void Neighborhood::getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove) {
+ int32 startAngle = getStaticCompassAngle(exitEntry.room, exitEntry.direction);
+ int32 stopAngle = getStaticCompassAngle(exitEntry.exitRoom, exitEntry.exitDirection);
+
+ if (startAngle > stopAngle) {
+ if (stopAngle + 180 < startAngle)
+ stopAngle += 360;
+ } else {
+ if (startAngle + 180 < stopAngle)
+ startAngle += 360;
+ }
+
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), exitEntry.movieStart, startAngle, exitEntry.movieEnd, stopAngle);
+}
+
+void Neighborhood::scheduleNavCallBack(NotificationFlags flags) {
+ _navMovieCallBack.cancelCallBack();
+
+ if (flags != 0) {
+ _navMovieCallBack.setCallBackFlag(flags);
+ _navMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+}
+
+void Neighborhood::scheduleStridingCallBack(const TimeValue strideStop, NotificationFlags flags) {
+ _stridingCallBack.cancelCallBack();
+
+ if (flags != 0)
+ _stridingCallBack.scheduleCallBack(kTriggerTimeFwd, strideStop, _navMovie.getScale());
+}
+
+void Neighborhood::moveNavTo(const CoordType h, const CoordType v) {
+ CoordType oldH, oldV;
+ _navMovie.getLocation(oldH, oldV);
+
+ CoordType offH = h - oldH;
+ CoordType offV = v - oldV;
+
+ _navMovie.moveElementTo(h, v);
+ _turnPush.moveElementTo(h, v);
+
+ if (offH != 0 || offV != 0)
+ for (HotspotList::iterator it = _neighborhoodHotspots.begin(); it != _neighborhoodHotspots.end(); it++)
+ if ((*it)->getHotspotFlags() & kNeighborhoodSpotFlag)
+ (*it)->moveSpot(offH, offV);
+}
+
+void Neighborhood::activateHotspots() {
+ InputHandler::activateHotspots();
+
+ for (HotspotInfoTable::iterator it = _hotspotInfoTable.begin(); it != _hotspotInfoTable.end(); it++) {
+ HotspotInfoTable::Entry entry = *it;
+
+ if (entry.hotspotRoom == GameState.getCurrentRoom() && entry.hotspotDirection == GameState.getCurrentDirection()
+ && (entry.hotspotActivation == _currentActivation || entry.hotspotActivation == kActivateHotSpotAlways)) {
+ Hotspot *hotspot = _vm->getAllHotspots().findHotspotByID(entry.hotspot);
+ if (hotspot)
+ activateOneHotspot(entry, hotspot);
+ }
+ }
+}
+
+void Neighborhood::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ HotSpotFlags flags = clickedSpot->getHotspotFlags();
+
+ if ((flags & (kPickUpItemSpotFlag | kPickUpBiochipSpotFlag)) != 0) {
+ ItemID itemID = kNoItemID;
+
+ for (HotspotInfoTable::iterator it = _hotspotInfoTable.begin(); it != _hotspotInfoTable.end(); it++) {
+ if (it->hotspot == clickedSpot->getObjectID()) {
+ itemID = it->hotspotItem;
+ break;
+ }
+ }
+
+ if (itemID != kNoItemID) {
+ Item *draggingItem = _vm->getAllItems().findItemByID(itemID);
+
+ if (draggingItem) {
+ takeItemFromRoom(draggingItem);
+
+ if ((flags & kPickUpItemSpotFlag) != 0)
+ _vm->dragItem(input, draggingItem, kDragInventoryPickup);
+ else
+ _vm->dragItem(input, draggingItem, kDragBiochipPickup);
+ }
+ }
+ } else {
+ // Check other flags here?
+ if ((flags & kZoomSpotFlags) != 0) {
+ zoomTo(clickedSpot);
+ } else if ((flags & kPlayExtraSpotFlag) != 0) {
+ HotspotInfoTable::Entry hotspotEntry;
+ getHotspotEntry(clickedSpot->getObjectID(), hotspotEntry);
+ startExtraSequence(hotspotEntry.hotspotExtra, kExtraCompletedFlag, kFilterNoInput);
+ } else if ((flags & kOpenDoorSpotFlag) != 0) {
+ openDoor();
+ } else {
+ InputHandler::clickInHotspot(input, clickedSpot);
+ }
+ }
+}
+
+void Neighborhood::cantMoveThatWay(CanMoveForwardReason reason) {
+ switch (reason) {
+ case kCantMoveDoorClosed:
+ case kCantMoveDoorLocked:
+ openDoor();
+ break;
+ case kCantMoveBlocked:
+ zoomUpOrBump();
+ break;
+ default:
+ bumpIntoWall();
+ break;
+ }
+}
+
+void Neighborhood::cantOpenDoor(CanOpenDoorReason) {
+ bumpIntoWall();
+}
+
+void Neighborhood::turnTo(const DirectionConstant direction) {
+ if (g_map)
+ g_map->moveToMapLocation(GameState.getCurrentNeighborhood(), GameState.getCurrentRoom(), direction);
+
+ // clone2727 says: Is this necessary?
+ _vm->_gfx->setCurSurface(_navMovie.getSurface());
+ _pushIn.copyToCurrentPort();
+ _vm->_gfx->setCurSurface(_vm->_gfx->getWorkArea());
+
+ // Added 2/10/97. Shouldn't this be here? Shouldn't we set the current activation to
+ // always when turning to a new view?
+ _currentActivation = kActivateHotSpotAlways;
+
+ _interruptionFilter = kFilterAllInput;
+
+ if (direction != GameState.getCurrentDirection()) {
+ GameState.setCurrentDirection(direction);
+ activateCurrentView(GameState.getCurrentRoom(), direction, kSpotOnTurnMask);
+ } else {
+ showViewFrame(getViewTime(GameState.getCurrentRoom(), GameState.getCurrentDirection()));
+ }
+
+ if (GameState.getOpenDoorRoom() != kNoRoomID) {
+ // Turning always closes a door.
+ loadAmbientLoops();
+ closeDoorOffScreen(GameState.getOpenDoorRoom(), GameState.getOpenDoorDirection());
+ GameState.setOpenDoorLocation(kNoRoomID, kNoDirection);
+ }
+
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+
+ checkContinuePoint(GameState.getCurrentRoom(), direction);
+
+ _vm->_cursor->hideUntilMoved();
+}
+
+void Neighborhood::spotCompleted() {
+ _interruptionFilter = kFilterAllInput;
+ showViewFrame(getViewTime(GameState.getCurrentRoom(), GameState.getCurrentDirection()));
+}
+
+void Neighborhood::doorOpened() {
+ _interruptionFilter = kFilterAllInput;
+
+ // 2/23/97
+ // Fixes funny bug with doors that are opened by dropping things on them...
+ setCurrentActivation(kActivateHotSpotAlways);
+
+ GameState.setOpenDoorLocation(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+
+ SpotTable::Entry entry;
+ findSpotEntry(GameState.getCurrentRoom(), GameState.getCurrentDirection(), kSpotOnDoorOpenMask, entry);
+
+ if (entry.dstFlags & kSpotOnDoorOpenMask) {
+ startSpotOnceOnly(entry.movieStart, entry.movieEnd);
+ } else {
+ findSpotEntry(GameState.getCurrentRoom(), GameState.getCurrentDirection(), kSpotOnDoorOpenMask | kSpotLoopsMask, entry);
+
+ if (entry.dstFlags & kSpotOnDoorOpenMask)
+ startSpotLoop(entry.movieStart, entry.movieEnd);
+ }
+
+ loadAmbientLoops();
+
+ if (g_map)
+ g_map->moveToMapLocation(GameState.getCurrentNeighborhood(), GameState.getNextRoom(), GameState.getNextDirection());
+
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+}
+
+void Neighborhood::moveForward() {
+ ExitTable::Entry exitEntry;
+ CanMoveForwardReason moveReason = canMoveForward(exitEntry);
+
+ if (moveReason == kCanMoveForward)
+ startExitMovie(exitEntry);
+ else
+ cantMoveThatWay(moveReason);
+}
+
+void Neighborhood::turn(const TurnDirection turnDirection) {
+ DirectionConstant nextDir;
+ CanTurnReason turnReason = canTurn(turnDirection, nextDir);
+
+ if (turnReason == kCanTurn)
+ startTurnPush(turnDirection, getViewTime(GameState.getCurrentRoom(), nextDir), nextDir);
+ else
+ cantTurnThatWay(turnReason);
+}
+
+void Neighborhood::turnLeft() {
+ turn(kTurnLeft);
+}
+
+void Neighborhood::turnRight() {
+ turn(kTurnRight);
+}
+
+void Neighborhood::turnUp() {
+ turn(kTurnUp);
+}
+
+void Neighborhood::turnDown() {
+ turn(kTurnDown);
+}
+
+void Neighborhood::openDoor() {
+ DoorTable::Entry door;
+ CanOpenDoorReason doorReason = canOpenDoor(door);
+
+ if (doorReason == kCanOpenDoor)
+ startDoorOpenMovie(door.movieStart, door.movieEnd);
+ else
+ cantOpenDoor(doorReason);
+}
+
+void Neighborhood::zoomTo(const Hotspot *hotspot) {
+ ZoomTable::Entry zoomEntry;
+ getZoomEntry(hotspot->getObjectID(), zoomEntry);
+ if (!zoomEntry.isEmpty())
+ startZoomMovie(zoomEntry);
+}
+
+void Neighborhood::updateViewFrame() {
+ showViewFrame(getViewTime(GameState.getCurrentRoom(), GameState.getCurrentDirection()));
+}
+
+void Neighborhood::startSpotLoop(TimeValue startTime, TimeValue stopTime, NotificationFlags flags) {
+ _turnPush.hide();
+ startMovieSequence(startTime, stopTime, flags, true, kFilterAllInput);
+}
+
+void Neighborhood::showViewFrame(TimeValue viewTime) {
+ if ((int32)viewTime >= 0) {
+ _turnPush.hide();
+ _navMovie.stop();
+ _navMovie.setFlags(0);
+ _navMovie.setSegment(0, _navMovie.getDuration());
+ _navMovie.setTime(viewTime);
+
+ Common::Rect pushBounds;
+ _turnPush.getBounds(pushBounds);
+
+ _navMovie.moveElementTo(pushBounds.left, pushBounds.top);
+ _navMovie.show();
+ _navMovie.redrawMovieWorld();
+ }
+}
+
+void Neighborhood::startExtraSequence(const ExtraID extraID, const NotificationFlags flags, const InputBits interruptionFilter) {
+ ExtraTable::Entry entry;
+ getExtraEntry(extraID, entry);
+
+ if (entry.movieStart != 0xffffffff)
+ playExtraMovie(entry, flags, interruptionFilter);
+}
+
+bool Neighborhood::startExtraSequenceSync(const ExtraID extraID, const InputBits interruptionFilter) {
+ InputDevice.waitInput(interruptionFilter);
+ return prepareExtraSync(extraID) && waitMovieFinish(&_navMovie, interruptionFilter);
+}
+
+void Neighborhood::loopExtraSequence(const uint32 extraID, NotificationFlags flags) {
+ ExtraTable::Entry entry;
+ getExtraEntry(extraID, entry);
+
+ if (entry.movieStart != 0xffffffff) {
+ _lastExtra = extraID;
+ startSpotLoop(entry.movieStart, entry.movieEnd, flags);
+ }
+}
+
+bool Neighborhood::navMoviePlaying() {
+ return _navMovie.isRunning();
+}
+
+void Neighborhood::playDeathExtra(ExtraID extra, DeathReason deathReason) {
+ _extraDeathReason = deathReason;
+ startExtraSequence(extra, kDeathExtraCompletedFlag, kFilterNoInput);
+}
+
+void Neighborhood::die(const DeathReason deathReason) {
+ loadLoopSound1("");
+ loadLoopSound2("");
+ _vm->die(deathReason);
+}
+
+void Neighborhood::setSoundFXLevel(const uint16 fxLevel) {
+ if (_navMovie.isSurfaceValid())
+ _navMovie.setVolume(fxLevel);
+ if (_spotSounds.isSoundLoaded())
+ _spotSounds.setVolume(fxLevel);
+ if (_currentInteraction)
+ _currentInteraction->setSoundFXLevel(fxLevel);
+}
+
+void Neighborhood::setAmbienceLevel(const uint16 ambientLevel) {
+ if (_soundLoop1.isSoundLoaded())
+ _loop1Fader.setMasterVolume(_vm->getAmbienceLevel());
+ if (_soundLoop2.isSoundLoaded())
+ _loop2Fader.setMasterVolume(_vm->getAmbienceLevel());
+ if (_currentInteraction)
+ _currentInteraction->setAmbienceLevel(ambientLevel);
+}
+
+// Force the exit taken from (room, direction, alternate) to come to a stop.
+void Neighborhood::forceStridingStop(const RoomID room, const DirectionConstant direction, const AlternateID alternate) {
+ ExitTable::Entry entry = _exitTable.findEntry(room, direction, alternate);
+
+ if (entry.movieStart != 0xffffffff) {
+ TimeValue strideStop = entry.exitEnd;
+ TimeValue exitStop = entry.movieEnd;
+
+ if (strideStop != exitStop) {
+ for (ExitTable::iterator it = _exitTable.begin(); it != _exitTable.end(); it++) {
+ entry = *it;
+
+ if (entry.exitEnd == strideStop && entry.movieEnd <= exitStop) {
+ entry.exitEnd = exitStop;
+ *it = entry;
+ }
+ }
+ }
+ }
+}
+
+// Restore the exit taken from (room, direction, alternate) to stride.
+void Neighborhood::restoreStriding(const RoomID room, const DirectionConstant direction, const AlternateID alternate) {
+ ExitTable::Entry entry = _exitTable.findEntry(room, direction, alternate);
+
+ if (entry.movieStart != 0xffffffff) {
+ TimeValue strideStop = entry.exitEnd;
+ TimeValue exitStop = entry.movieEnd;
+
+ if (strideStop != entry.originalEnd) {
+ for (ExitTable::iterator it = _exitTable.begin(); it != _exitTable.end(); it++) {
+ entry = *it;
+
+ if (entry.exitEnd == strideStop && entry.movieEnd <= exitStop) {
+ entry.exitEnd = entry.originalEnd;
+ *it = entry;
+ }
+ }
+ }
+ }
+}
+
+HotspotInfoTable::Entry *Neighborhood::findHotspotEntry(const HotSpotID id) {
+ for (HotspotInfoTable::iterator it = _hotspotInfoTable.begin(); it != _hotspotInfoTable.end(); it++)
+ if (it->hotspot == id)
+ return &(*it);
+
+ return 0;
+}
+
+void Neighborhood::hideNav() {
+ _isRunning = _navMovie.isRunning();
+ _navMovie.stop();
+ _navMovie.hide();
+ _turnPush.stopFader();
+ _turnPush.hide();
+}
+
+void Neighborhood::showNav() {
+ _navMovie.show();
+ _turnPush.hide();
+ if (_isRunning)
+ _navMovie.start();
+}
+
+void Neighborhood::startExitMovie(const ExitTable::Entry &exitEntry) {
+ FaderMoveSpec compassMove;
+
+ if (g_compass)
+ getExitCompassMove(exitEntry, compassMove);
+
+ GameState.setNextRoom(exitEntry.exitRoom);
+ GameState.setNextDirection(exitEntry.exitDirection);
+
+ if (exitEntry.movieEnd == exitEntry.exitEnd) // Just a walk.
+ startMovieSequence(exitEntry.movieStart, exitEntry.movieEnd, kMoveForwardCompletedFlag, kFilterNoInput, false);
+ else // We're stridin'!
+ startMovieSequence(exitEntry.movieStart, exitEntry.exitEnd, kStrideCompletedFlag, kFilterNoInput, false, exitEntry.movieEnd);
+
+ if (g_compass)
+ g_compass->startFader(compassMove);
+}
+
+void Neighborhood::startZoomMovie(const ZoomTable::Entry &zoomEntry) {
+ FaderMoveSpec compassMove;
+
+ if (g_compass)
+ getZoomCompassMove(zoomEntry, compassMove);
+
+ GameState.setNextRoom(zoomEntry.room);
+ GameState.setNextDirection(zoomEntry.direction);
+
+ startMovieSequence(zoomEntry.movieStart, zoomEntry.movieEnd, kMoveForwardCompletedFlag, kFilterNoInput, false);
+
+ if (g_compass)
+ g_compass->startFader(compassMove);
+}
+
+void Neighborhood::startDoorOpenMovie(const TimeValue startTime, const TimeValue stopTime) {
+ startMovieSequence(startTime, stopTime, kDoorOpenCompletedFlag, kFilterNoInput, false);
+}
+
+void Neighborhood::startTurnPush(const TurnDirection turnDirection, const TimeValue newView, const DirectionConstant nextDir) {
+ if (g_AIArea)
+ g_AIArea->lockAIOut();
+
+ _vm->_cursor->hide();
+
+ GameState.setNextDirection(nextDir);
+
+ _interruptionFilter = kFilterNoInput;
+ _turnPush.stopFader();
+
+ // Set up callback.
+ _turnPushCallBack.setCallBackFlag(kTurnCompletedFlag);
+ _turnPushCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ // Stop nav movie.
+ _navMovie.stop();
+ _navMovie.setFlags(0);
+
+ // Set segment of nav movie to whole movie, so that subsequent initFromMovieFrame
+ // will work.
+ _navMovie.setSegment(0, _navMovie.getDuration());
+
+ _pushIn.initFromMovieFrame(_navMovie.getMovie(), newView);
+
+ _navMovie.hide();
+
+ switch (turnDirection) {
+ case kTurnLeft:
+ _turnPush.setSlideDirection(kSlideRightMask);
+ break;
+ case kTurnRight:
+ _turnPush.setSlideDirection(kSlideLeftMask);
+ break;
+ case kTurnUp:
+ _turnPush.setSlideDirection(kSlideDownMask);
+ break;
+ case kTurnDown:
+ _turnPush.setSlideDirection(kSlideUpMask);
+ break;
+ }
+
+ _turnPush.show();
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(60, 0, 0, 15, 1000);
+ _turnPush.startFader(moveSpec);
+
+ if (g_compass) {
+ _turnPush.pauseFader();
+
+ int32 startAngle = getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ int32 stopAngle = getStaticCompassAngle(GameState.getCurrentRoom(), nextDir);
+
+ if (turnDirection == kTurnLeft) {
+ if (startAngle < stopAngle)
+ startAngle += 360;
+ } else {
+ if (stopAngle < startAngle)
+ stopAngle += 360;
+ }
+
+ FaderMoveSpec turnSpec;
+ _turnPush.getCurrentFaderMove(turnSpec);
+
+ FaderMoveSpec compassMove;
+ compassMove.makeTwoKnotFaderSpec(turnSpec.getFaderScale(), turnSpec.getNthKnotTime(0), startAngle, turnSpec.getNthKnotTime(1), stopAngle);
+ g_compass->startFader(compassMove);
+ }
+
+ _turnPushCallBack.cancelCallBack();
+ _turnPush.continueFader();
+
+ do {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ } while (_turnPush.isFading());
+
+ _turnPush.stopFader();
+ _neighborhoodNotification.setNotificationFlags(kTurnCompletedFlag, kTurnCompletedFlag);
+}
+
+void Neighborhood::playExtraMovie(const ExtraTable::Entry &extraEntry, const NotificationFlags flags, const InputBits interruptionInput) {
+ FaderMoveSpec compassMove;
+
+ if (g_compass)
+ getExtraCompassMove(extraEntry, compassMove);
+
+ _lastExtra = extraEntry.extra;
+ _turnPush.hide();
+ startMovieSequence(extraEntry.movieStart, extraEntry.movieEnd, flags, false, interruptionInput);
+
+ if (g_compass)
+ g_compass->startFader(compassMove);
+}
+
+void Neighborhood::activateCurrentView(const RoomID room, const DirectionConstant direction, SpotFlags flag) {
+ SpotTable::Entry entry;
+ findSpotEntry(room, direction, flag, entry);
+
+ if (entry.dstFlags & flag) {
+ startSpotOnceOnly(entry.movieStart, entry.movieEnd);
+ } else {
+ findSpotEntry(room, direction, flag | kSpotLoopsMask, entry);
+
+ if (entry.dstFlags & flag)
+ startSpotLoop(entry.movieStart, entry.movieEnd);
+ else
+ showViewFrame(getViewTime(room, direction));
+ }
+}
+
+void Neighborhood::activateOneHotspot(HotspotInfoTable::Entry &entry, Hotspot *hotspot) {
+ switch (_vm->getDragType()) {
+ case kDragInventoryUse:
+ if ((hotspot->getHotspotFlags() & kDropItemSpotFlag) != 0 &&
+ _vm->getDraggingItem()->getObjectID() == entry.hotspotItem)
+ hotspot->setActive();
+ break;
+ case kDragInventoryPickup:
+ case kDragBiochipPickup:
+ // Do nothing -- neighborhoods activate no hot spots in this case...
+ break;
+ default:
+ if ((hotspot->getHotspotFlags() & kPickUpBiochipSpotFlag) != 0) {
+ Item *item = _vm->getAllItems().findItemByID(entry.hotspotItem);
+ if (item && item->getItemNeighborhood() == getObjectID())
+ hotspot->setActive();
+ } else {
+ HotSpotFlags flags = hotspot->getHotspotFlags();
+
+ if ((flags & kNeighborhoodSpotFlag) != 0) {
+ if (flags & kOpenDoorSpotFlag) {
+ if (!GameState.isCurrentDoorOpen())
+ hotspot->setActive();
+ } else if ((flags & (kZoomSpotFlags | kClickSpotFlag | kPlayExtraSpotFlag)) != 0) {
+ hotspot->setActive();
+ } else if ((flags & kPickUpItemSpotFlag) != 0) {
+ // Changed this 2/19/96
+ // Should only light up this hot spot if the item's taken flag is not
+ // set. It's not based on neighborhood ID since that can be reset by the
+ // destroying process.
+
+ if (!GameState.isTakenItemID(entry.hotspotItem))
+ hotspot->setActive();
+ }
+ }
+ }
+ break;
+ }
+}
+
+void Neighborhood::startSpotOnceOnly(TimeValue startTime, TimeValue stopTime) {
+ _turnPush.hide();
+ startMovieSequence(startTime, stopTime, kSpotCompletedFlag, kFilterNoInput, false);
+}
+
+void Neighborhood::startMovieSequence(const TimeValue startTime, const TimeValue stopTime, NotificationFlags flags, bool loopSequence,
+ const InputBits interruptionInput, const TimeValue strideStop) {
+ if (!loopSequence && g_AIArea)
+ g_AIArea->lockAIOut();
+
+ _interruptionFilter = interruptionInput;
+
+ // Stop the movie before doing anything else
+ _navMovie.stop();
+
+ Common::Rect pushBounds;
+ _turnPush.getBounds(pushBounds);
+
+ _navMovie.moveElementTo(pushBounds.left, pushBounds.top);
+ _navMovie.show();
+ _navMovie.setFlags(0);
+ _navMovie.setSegment(startTime, stopTime);
+ _navMovie.setTime(startTime);
+
+ if (loopSequence)
+ _navMovie.setFlags(kLoopTimeBase);
+ else
+ flags |= kNeighborhoodMovieCompletedFlag;
+
+ if (strideStop != 0xffffffff)
+ // Subtract a little slop from the striding stop time to keep from "pumping" at the
+ // end of a walk.
+ // 40 is one frame (scale == 600, 15 fps).
+ scheduleStridingCallBack(strideStop - kStridingSlop, flags);
+ else
+ scheduleNavCallBack(flags);
+
+ _navMovie.start();
+}
+
+void Neighborhood::throwAwayInterface() {
+ _doorTable.clear();
+ _exitTable.clear();
+ _extraTable.clear();
+ _hotspotInfoTable.clear();
+ _spotTable.clear();
+ _turnTable.clear();
+ _viewTable.clear();
+ _zoomTable.clear();
+
+ _navMovie.stopDisplaying();
+ _navMovie.releaseMovie();
+ _pushIn.deallocateSurface();
+ _turnPush.stopDisplaying();
+ _turnPush.setInAndOutElements(0, 0);
+ _turnPush.disposeAllCallBacks();
+
+ for (HotspotList::iterator it = _neighborhoodHotspots.begin(); it != _neighborhoodHotspots.end(); it++)
+ _vm->getAllHotspots().remove(*it);
+
+ _neighborhoodHotspots.deleteHotspots();
+ _spotSounds.disposeSound();
+ _delayTimer.disposeAllCallBacks();
+
+ if (g_AIArea) {
+ g_AIArea->saveAIState();
+ g_AIArea->removeAllRules();
+ }
+
+ if (_currentInteraction)
+ newInteraction(kNoInteractionID);
+
+ _croppedMovie.releaseMovie();
+
+ loadLoopSound1("");
+ loadLoopSound2("");
+
+ if (g_energyMonitor) {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->saveCurrentEnergyValue();
+ }
+
+ delete g_interface;
+}
+
+bool Neighborhood::prepareExtraSync(const ExtraID extraID) {
+ ExtraTable::Entry extraEntry;
+ FaderMoveSpec compassMove;
+
+ if (g_compass) {
+ getExtraEntry(extraID, extraEntry);
+ getExtraCompassMove(extraEntry, compassMove);
+ }
+
+ ExtraTable::Entry entry;
+ getExtraEntry(extraID, entry);
+ bool result;
+
+ if (entry.movieStart != 0xffffffff) {
+ _turnPush.hide();
+
+ // Stop the movie before doing anything else
+ _navMovie.stop();
+
+ Common::Rect pushBounds;
+ _turnPush.getBounds(pushBounds);
+ _navMovie.moveElementTo(pushBounds.left, pushBounds.top);
+
+ _navMovie.show();
+ _navMovie.setFlags(0);
+ _navMovie.setSegment(entry.movieStart, entry.movieEnd);
+ _navMovie.setTime(entry.movieStart);
+ _navMovie.start();
+ result = true;
+ } else {
+ result = false;
+ }
+
+ if (result && g_compass)
+ g_compass->startFader(compassMove);
+
+ return result;
+}
+
+bool Neighborhood::waitMovieFinish(Movie *movie, const InputBits interruptionFilter) {
+ Input input;
+ bool result = true;
+ bool saveAllowed = _vm->swapSaveAllowed(false);
+ bool openAllowed = _vm->swapLoadAllowed(false);
+
+ while (movie->isRunning()) {
+ InputDevice.getInput(input, interruptionFilter);
+
+ if (input.anyInput() || _vm->shouldQuit()) {
+ result = false;
+ break;
+ }
+
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ movie->stop();
+ _vm->swapSaveAllowed(saveAllowed);
+ _vm->swapLoadAllowed(openAllowed);
+
+ return result;
+}
+
+InputBits Neighborhood::getInputFilter() {
+ return _interruptionFilter & InputHandler::getInputFilter();
+}
+
+void Neighborhood::getZoomCompassMove(const ZoomTable::Entry &zoomEntry, FaderMoveSpec &compassMove) {
+ int32 startAngle = getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ int32 stopAngle = getStaticCompassAngle(zoomEntry.room, zoomEntry.direction);
+
+ if (startAngle > stopAngle) {
+ if (stopAngle + 180 < startAngle)
+ stopAngle += 360;
+ } else {
+ if (startAngle + 180 < stopAngle)
+ startAngle += 360;
+ }
+
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), zoomEntry.movieStart, startAngle, zoomEntry.movieEnd, stopAngle);
+}
+
+void Neighborhood::getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &compassMove) {
+ compassMove.makeOneKnotFaderSpec(g_compass->getFaderValue());
+}
+
+void Neighborhood::setUpAIRules() {
+ // Set up default rules here:
+ // -- Energy warning rules.
+
+ if (g_AIArea) {
+ g_AIArea->forceAIUnlocked();
+
+ if (!_vm->isDemo() && (getObjectID() == kPrehistoricID || getObjectID() == kNoradAlphaID ||
+ getObjectID() == kNoradDeltaID || getObjectID() == kMarsID || getObjectID() == kWSCID)) {
+
+ AIEnergyMonitorCondition *condition50 = new AIEnergyMonitorCondition(kWorriedEnergy);
+ AIPlayMessageAction *message = new AIPlayMessageAction("Images/AI/Globals/XGLOB4A", false);
+ AIRule *rule50 = new AIRule(condition50, message);
+
+ AIEnergyMonitorCondition *condition25 = new AIEnergyMonitorCondition(kNervousEnergy);
+ AICompoundAction *compound = new AICompoundAction();
+ message = new AIPlayMessageAction("Images/AI/Globals/XGLOB4B", false);
+ compound->addAction(message);
+ AIDeactivateRuleAction *deactivate = new AIDeactivateRuleAction(rule50);
+ compound->addAction(deactivate);
+ AIRule *rule25 = new AIRule(condition25, compound);
+
+ AIEnergyMonitorCondition *condition5 = new AIEnergyMonitorCondition(kPanicStrickenEnergy);
+ compound = new AICompoundAction();
+ message = new AIPlayMessageAction("Images/AI/Globals/XGLOB4C", false);
+ compound->addAction(message);
+ deactivate = new AIDeactivateRuleAction(rule50);
+ compound->addAction(deactivate);
+ deactivate = new AIDeactivateRuleAction(rule25);
+ compound->addAction(deactivate);
+ AIRule *rule5 = new AIRule(condition5, compound);
+
+ g_AIArea->addAIRule(rule5);
+ g_AIArea->addAIRule(rule25);
+ g_AIArea->addAIRule(rule50);
+ }
+ }
+}
+
+GameInteraction *Neighborhood::makeInteraction(const InteractionID interactionID) {
+ if (interactionID == kNoInteractionID)
+ return 0;
+
+ return new GameInteraction(interactionID, this);
+}
+
+void Neighborhood::newInteraction(const InteractionID interactionID) {
+ GameInteraction *interaction = makeInteraction(interactionID);
+ _doneWithInteraction = false;
+
+ if (_currentInteraction) {
+ _currentInteraction->stopInteraction();
+ delete _currentInteraction;
+ }
+
+ _currentInteraction = interaction;
+
+ if (_currentInteraction)
+ _currentInteraction->startInteraction();
+
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+}
+
+void Neighborhood::bumpIntoWall() {
+ _vm->_gfx->shakeTheWorld(15, 30);
+}
+
+void Neighborhood::zoomUpOrBump() {
+ Hotspot *zoomSpot = 0;
+
+ for (HotspotList::iterator it = _vm->getAllHotspots().begin(); it != _vm->getAllHotspots().end(); it++) {
+ Hotspot *hotspot = *it;
+
+ if ((hotspot->getHotspotFlags() & (kNeighborhoodSpotFlag | kZoomInSpotFlag)) == (kNeighborhoodSpotFlag | kZoomInSpotFlag)) {
+ HotspotInfoTable::Entry *entry = findHotspotEntry(hotspot->getObjectID());
+
+ if (entry && entry->hotspotRoom == GameState.getCurrentRoom() && entry->hotspotDirection == GameState.getCurrentDirection()) {
+ if (zoomSpot) {
+ zoomSpot = 0;
+ break;
+ } else {
+ zoomSpot = hotspot;
+ }
+ }
+ }
+ }
+
+ if (zoomSpot)
+ zoomTo(zoomSpot);
+ else
+ bumpIntoWall();
+}
+
+void Neighborhood::loadLoopSound1(const Common::String &soundName, uint16 volume, TimeValue fadeOut, TimeValue fadeIn, TimeScale fadeScale) {
+ FaderMoveSpec faderMove;
+
+ if (!loop1Loaded(soundName)) {
+ _loop1SoundString = soundName;
+
+ if (_soundLoop1.isSoundLoaded()) {
+ faderMove.makeTwoKnotFaderSpec(fadeScale, 0, _loop1Fader.getFaderValue(), fadeOut, 0);
+ _loop1Fader.startFaderSync(faderMove);
+ }
+
+ if (!_loop1SoundString.empty()) {
+ _soundLoop1.initFromAIFFFile(_loop1SoundString);
+ _soundLoop1.loopSound();
+ _loop1Fader.setMasterVolume(_vm->getAmbienceLevel());
+ _loop1Fader.setFaderValue(0);
+ faderMove.makeTwoKnotFaderSpec(fadeScale, 0, 0, fadeIn, volume);
+ _loop1Fader.startFaderSync(faderMove);
+ } else {
+ _soundLoop1.disposeSound();
+ }
+ } else if (_loop1Fader.getFaderValue() != volume) {
+ faderMove.makeTwoKnotFaderSpec(fadeScale, 0, _loop1Fader.getFaderValue(), fadeIn, volume);
+ _loop1Fader.startFaderSync(faderMove);
+ }
+}
+
+void Neighborhood::loadLoopSound2(const Common::String &soundName, uint16 volume, TimeValue fadeOut, TimeValue fadeIn, TimeScale fadeScale) {
+ FaderMoveSpec faderMove;
+
+ if (!loop2Loaded(soundName)) {
+ _loop2SoundString = soundName;
+
+ if (_soundLoop2.isSoundLoaded()) {
+ faderMove.makeTwoKnotFaderSpec(fadeScale, 0, _loop2Fader.getFaderValue(), fadeOut, 0);
+ _loop2Fader.startFaderSync(faderMove);
+ }
+
+ if (!_loop2SoundString.empty()) {
+ _soundLoop2.initFromAIFFFile(_loop2SoundString);
+ _soundLoop2.loopSound();
+ _loop2Fader.setMasterVolume(_vm->getAmbienceLevel());
+ _loop2Fader.setFaderValue(0);
+ faderMove.makeTwoKnotFaderSpec(fadeScale, 0, 0, fadeIn, volume);
+ _loop2Fader.startFaderSync(faderMove);
+ } else {
+ _soundLoop2.disposeSound();
+ }
+ } else if (_loop2Fader.getFaderValue() != volume) {
+ faderMove.makeTwoKnotFaderSpec(fadeScale, 0, _loop2Fader.getFaderValue(), fadeIn, volume);
+ _loop2Fader.startFaderSync(faderMove);
+ }
+}
+
+void Neighborhood::takeItemFromRoom(Item *item) {
+ item->setItemRoom(kNoNeighborhoodID, kNoRoomID, kNoDirection);
+ // Also set the taken item flag. Do this before updating the view frame.
+ GameState.setTakenItem(item, true);
+ updateViewFrame();
+}
+
+void Neighborhood::dropItemIntoRoom(Item *item, Hotspot *) {
+ item->setItemRoom(getObjectID(), GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ // Also set the taken item flag. Do this before updating the view frame.
+ GameState.setTakenItem(item, false);
+ updateViewFrame();
+}
+
+void Neighborhood::makeContinuePoint() {
+ _vm->makeContinuePoint();
+}
+
+void Neighborhood::startLoop1Fader(const FaderMoveSpec &faderMove) {
+ _loop1Fader.startFader(faderMove);
+}
+
+void Neighborhood::startLoop2Fader(const FaderMoveSpec &faderMove) {
+ _loop2Fader.startFader(faderMove);
+}
+
+// *** Revised 6/13/96 to use the last frame of the extra sequence.
+// Necessary for Cinepak buildup.
+void Neighborhood::showExtraView(uint32 extraID) {
+ ExtraTable::Entry entry;
+ getExtraEntry(extraID, entry);
+
+ if (entry.movieEnd != 0xffffffff)
+ showViewFrame(entry.movieEnd - 1);
+}
+
+void Neighborhood::startExtraLongSequence(const uint32 firstExtra, const uint32 lastExtra, NotificationFlags flags,
+ const InputBits interruptionFilter) {
+ ExtraTable::Entry firstEntry, lastEntry;
+ getExtraEntry(firstExtra, firstEntry);
+
+ if (firstEntry.movieStart != 0xffffffff) {
+ getExtraEntry(lastExtra, lastEntry);
+ _lastExtra = firstExtra;
+ _turnPush.hide();
+ startMovieSequence(firstEntry.movieStart, lastEntry.movieEnd, flags, kFilterNoInput, interruptionFilter);
+ }
+}
+
+void Neighborhood::openCroppedMovie(const Common::String &movieName, CoordType left, CoordType top) {
+ if (_croppedMovie.isMovieValid())
+ closeCroppedMovie();
+
+ _croppedMovie.initFromMovieFile(movieName);
+ _croppedMovie.moveElementTo(left, top);
+ _croppedMovie.startDisplaying();
+ _croppedMovie.show();
+}
+
+void Neighborhood::loopCroppedMovie(const Common::String &movieName, CoordType left, CoordType top) {
+ openCroppedMovie(movieName, left, top);
+ _croppedMovie.redrawMovieWorld();
+ _croppedMovie.setFlags(kLoopTimeBase);
+ _croppedMovie.start();
+}
+
+void Neighborhood::closeCroppedMovie() {
+ _croppedMovie.releaseMovie();
+}
+
+void Neighborhood::playCroppedMovieOnce(const Common::String &movieName, CoordType left, CoordType top, const InputBits interruptionFilter) {
+ openCroppedMovie(movieName, left, top);
+ _croppedMovie.redrawMovieWorld();
+ _croppedMovie.start();
+
+ InputBits oldInterruptionFilter = _interruptionFilter;
+ if (oldInterruptionFilter != kFilterNoInput)
+ _interruptionFilter = kFilterNoInput;
+
+ bool saveAllowed = _vm->swapSaveAllowed(false);
+ bool openAllowed = _vm->swapLoadAllowed(false);
+
+ Input input;
+ while (_croppedMovie.isRunning() && !_vm->shouldQuit()) {
+ _vm->processShell();
+ InputDevice.getInput(input, interruptionFilter);
+ if (input.anyInput() || _vm->saveRequested() || _vm->loadRequested() || _vm->shouldQuit())
+ break;
+ _vm->_system->delayMillis(10);
+ }
+
+ if (oldInterruptionFilter != kFilterNoInput)
+ _interruptionFilter = oldInterruptionFilter;
+
+ closeCroppedMovie();
+ _vm->swapSaveAllowed(saveAllowed);
+ _vm->swapLoadAllowed(openAllowed);
+}
+
+void Neighborhood::playMovieSegment(Movie *movie, TimeValue startTime, TimeValue stopTime) {
+ TimeValue oldStart, oldStop;
+ movie->getSegment(oldStart, oldStop);
+
+ if (stopTime == 0xffffffff)
+ stopTime = movie->getDuration();
+
+ movie->setSegment(startTime, stopTime);
+ movie->setTime(startTime);
+ movie->start();
+
+ while (movie->isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ movie->stop();
+ movie->setSegment(oldStart, oldStop);
+}
+
+void Neighborhood::recallToTSASuccess() {
+ if (GameState.allTimeZonesFinished())
+ _vm->jumpToNewEnvironment(kFullTSAID, kTSA37, kNorth);
+ else
+ _vm->jumpToNewEnvironment(kTinyTSAID, kTinyTSA37, kNorth);
+}
+
+void Neighborhood::recallToTSAFailure() {
+ _vm->jumpToNewEnvironment(kTinyTSAID, kTinyTSA37, kNorth);
+}
+
+void Neighborhood::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_vm->getGameMode() == kModeNavigation) {
+ if (input.upButtonAnyDown())
+ upButton(input);
+ else if (input.downButtonAnyDown())
+ downButton(input);
+ else if (input.leftButtonAnyDown())
+ leftButton(input);
+ else if (input.rightButtonAnyDown())
+ rightButton(input);
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void Neighborhood::setHotspotFlags(const HotSpotID id, const HotSpotFlags flags) {
+ Hotspot *hotspot = _vm->getAllHotspots().findHotspotByID(id);
+ hotspot->setMaskedHotspotFlags(flags, flags);
+}
+
+void Neighborhood::setIsItemTaken(const ItemID id) {
+ GameState.setTakenItemID(id, _vm->playerHasItemID(id));
+}
+
+void Neighborhood::upButton(const Input &) {
+ moveForward();
+}
+
+void Neighborhood::leftButton(const Input &) {
+ turnLeft();
+}
+
+void Neighborhood::rightButton(const Input &) {
+ turnRight();
+}
+
+void Neighborhood::downButton(const Input &) {
+ if (_inputHandler->wantsCursor()) {
+ _vm->getAllHotspots().deactivateAllHotspots();
+ _inputHandler->activateHotspots();
+
+ for (HotspotList::iterator it = _vm->getAllHotspots().begin(); it != _vm->getAllHotspots().end(); it++) {
+ Hotspot *hotspot = *it;
+
+ if (hotspot->isSpotActive() && (hotspot->getHotspotFlags() & (kNeighborhoodSpotFlag | kZoomOutSpotFlag)) == (kNeighborhoodSpotFlag | kZoomOutSpotFlag)) {
+ HotspotInfoTable::Entry *entry = findHotspotEntry(hotspot->getObjectID());
+
+ if (entry && entry->hotspotRoom == GameState.getCurrentRoom() && entry->hotspotDirection == GameState.getCurrentDirection()) {
+ Input scratch;
+ _inputHandler->clickInHotspot(scratch, hotspot);
+ return;
+ }
+ }
+ }
+ }
+}
+
+void Neighborhood::initOnePicture(Picture *picture, const Common::String &pictureName, DisplayOrder order, CoordType left, CoordType top, bool show) {
+ picture->initFromPICTFile(pictureName);
+ picture->setDisplayOrder(order);
+ picture->moveElementTo(left, top);
+ picture->startDisplaying();
+ if (show)
+ picture->show();
+}
+
+void Neighborhood::initOneMovie(Movie *movie, const Common::String &movieName, DisplayOrder order, CoordType left, CoordType top, bool show) {
+ movie->initFromMovieFile(movieName);
+ movie->setDisplayOrder(order);
+ movie->moveElementTo(left, top);
+ movie->startDisplaying();
+
+ if (show)
+ movie->show();
+
+ movie->redrawMovieWorld();
+}
+
+void Neighborhood::reinstateMonocleInterface() {
+ _vm->_gfx->disableErase();
+
+ _vm->createInterface();
+
+ if (g_AIArea)
+ setNextHandler(g_AIArea);
+
+ init();
+
+ moveNavTo(kNavAreaLeft, kNavAreaTop);
+
+ if (g_interface)
+ g_interface->setDate(getDateResID());
+
+ if (g_AIArea)
+ g_AIArea->restoreAIState();
+}
+
+void Neighborhood::useIdleTime() {
+ if (_doneWithInteraction) {
+ newInteraction(kNoInteractionID);
+ loadAmbientLoops();
+ }
+}
+
+void Neighborhood::timerFunction() {
+ timerExpired(getTimerEvent());
+}
+
+void Neighborhood::scheduleEvent(const TimeValue time, const TimeScale scale, const uint32 eventType) {
+ _eventTimer.stopFuse();
+ _eventTimer.primeFuse(time, scale);
+ _timerEvent = eventType;
+ _eventTimer.setFunctor(new Common::Functor0Mem<void, Neighborhood>(this, &Neighborhood::timerFunction));
+ _eventTimer.lightFuse();
+}
+
+void Neighborhood::cancelEvent() {
+ _eventTimer.stopFuse();
+}
+
+void Neighborhood::pauseTimer() {
+ _eventTimer.pauseFuse();
+}
+
+void Neighborhood::resumeTimer() {
+ // NOTE: Yes, this function calls pauseFuse!
+ // Looks like an original game bug, will need
+ // to investigate how this affects gameplay.
+ _eventTimer.pauseFuse();
+}
+
+bool Neighborhood::timerPaused() {
+ return _eventTimer.isFusePaused();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/neighborhood.h b/engines/pegasus/neighborhood/neighborhood.h
new file mode 100644
index 0000000000..3c1c5eac92
--- /dev/null
+++ b/engines/pegasus/neighborhood/neighborhood.h
@@ -0,0 +1,408 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_H
+#define PEGASUS_NEIGHBORHOOD_H
+
+#include "common/queue.h"
+#include "common/str.h"
+
+#include "pegasus/fader.h"
+#include "pegasus/hotspot.h"
+#include "pegasus/input.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+#include "pegasus/sound.h"
+#include "pegasus/timers.h"
+#include "pegasus/transition.h"
+#include "pegasus/util.h"
+#include "pegasus/neighborhood/door.h"
+#include "pegasus/neighborhood/exit.h"
+#include "pegasus/neighborhood/extra.h"
+#include "pegasus/neighborhood/hotspotinfo.h"
+#include "pegasus/neighborhood/spot.h"
+#include "pegasus/neighborhood/turn.h"
+#include "pegasus/neighborhood/view.h"
+#include "pegasus/neighborhood/zoom.h"
+
+namespace Pegasus {
+
+class PegasusEngine;
+
+// Pegasus Prime neighborhood id's
+static const NeighborhoodID kCaldoriaID = 0;
+static const NeighborhoodID kFullTSAID = 1;
+static const NeighborhoodID kFinalTSAID = 2;
+static const NeighborhoodID kTinyTSAID = 3;
+static const NeighborhoodID kPrehistoricID = 4;
+static const NeighborhoodID kMarsID = 5;
+static const NeighborhoodID kWSCID = 6;
+static const NeighborhoodID kNoradAlphaID = 7;
+static const NeighborhoodID kNoradDeltaID = 8;
+// The sub chase is not really a neighborhood, but we define a constant that is used
+// to allow an easy transition out of Norad Alpha.
+static const NeighborhoodID kNoradSubChaseID = 1000;
+
+static const TimeScale kDefaultLoopFadeScale = kThirtyTicksPerSecond;
+static const TimeValue kDefaultLoopFadeOut = kHalfSecondPerThirtyTicks;
+static const TimeValue kDefaultLoopFadeIn = kHalfSecondPerThirtyTicks;
+
+enum QueueRequestType {
+ kNavExtraRequest,
+ kSpotSoundRequest,
+ kDelayRequest
+};
+
+// For delay requests, start is interpreted as the total delay and stop is interpreted
+// as the scale the delay is in.
+// For extra requests, start and stop are not used.
+struct QueueRequest {
+ QueueRequestType requestType;
+ ExtraID extra;
+ TimeValue start, stop;
+ InputBits interruptionFilter;
+ bool playing;
+ NotificationFlags flags;
+ Notification *notification;
+};
+
+bool operator==(const QueueRequest &arg1, const QueueRequest &arg2);
+bool operator!=(const QueueRequest &arg1, const QueueRequest &arg2);
+
+class GameInteraction;
+class Item;
+class Neighborhood;
+
+class StriderCallBack : public TimeBaseCallBack {
+public:
+ StriderCallBack(Neighborhood *);
+ virtual ~StriderCallBack() {}
+
+protected:
+ virtual void callBack();
+
+ Neighborhood *_neighborhood;
+};
+
+typedef Common::Queue<QueueRequest> NeighborhoodActionQueue;
+
+class Neighborhood : public IDObject, public NotificationReceiver, public InputHandler, public Idler {
+friend class StriderCallBack;
+
+public:
+ Neighborhood(InputHandler *nextHandler, PegasusEngine *vm, const Common::String &resName, NeighborhoodID id);
+ virtual ~Neighborhood();
+
+ virtual void init();
+ virtual void start();
+ virtual void moveNavTo(const CoordType, const CoordType);
+ virtual void checkContinuePoint(const RoomID, const DirectionConstant) = 0;
+ void makeContinuePoint();
+
+ virtual void activateHotspots();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual CanMoveForwardReason canMoveForward(ExitTable::Entry &entry);
+ virtual CanTurnReason canTurn(TurnDirection turn, DirectionConstant &nextDir);
+ virtual CanOpenDoorReason canOpenDoor(DoorTable::Entry &entry);
+
+ virtual void cantMoveThatWay(CanMoveForwardReason);
+ virtual void cantTurnThatWay(CanTurnReason) {}
+ virtual void cantOpenDoor(CanOpenDoorReason);
+ virtual void arriveAt(const RoomID room, const DirectionConstant direction);
+ virtual void turnTo(const DirectionConstant);
+ virtual void spotCompleted();
+ virtual void doorOpened();
+ virtual void closeDoorOffScreen(const RoomID, const DirectionConstant) {}
+
+ virtual void moveForward();
+ virtual void turn(const TurnDirection);
+ virtual void turnLeft();
+ virtual void turnRight();
+ virtual void turnUp();
+ virtual void turnDown();
+ virtual void openDoor();
+ virtual void zoomTo(const Hotspot *);
+
+ virtual void updateViewFrame();
+
+ void requestExtraSequence(const ExtraID, const NotificationFlags, const InputBits interruptionFilter);
+ void requestSpotSound(const TimeValue, const TimeValue, const InputBits interruptionFilter, const NotificationFlags);
+ void playSpotSoundSync(const TimeValue in, const TimeValue out);
+ void requestDelay(const TimeValue, const TimeScale, const InputBits interruptionFilter, const NotificationFlags);
+
+ Notification *getNeighborhoodNotification() { return &_neighborhoodNotification; }
+
+ virtual void getExtraEntry(const uint32 id, ExtraTable::Entry &extraEntry);
+ virtual void startSpotLoop(TimeValue, TimeValue, NotificationFlags = 0);
+ virtual bool actionQueueEmpty() { return _actionQueue.empty(); }
+ virtual void showViewFrame(TimeValue);
+ virtual void findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &spotEntry);
+ virtual void startExtraSequence(const ExtraID, const NotificationFlags, const InputBits interruptionFilter);
+ bool startExtraSequenceSync(const ExtraID, const InputBits);
+ virtual void loopExtraSequence(const uint32, NotificationFlags = 0);
+ int32 getLastExtra() const { return _lastExtra; }
+ virtual void scheduleNavCallBack(NotificationFlags);
+
+ Movie *getNavMovie() { return &_navMovie; }
+ bool navMoviePlaying();
+
+ void setCurrentAlternate(const AlternateID alt) { _currentAlternate = alt; }
+ AlternateID getCurrentAlternate() const { return _currentAlternate; }
+
+ void setCurrentActivation(const HotSpotActivationID a) { _currentActivation = a; }
+ HotSpotActivationID getCurrentActivation() { return _currentActivation; }
+
+ virtual void playDeathExtra(ExtraID, DeathReason);
+ virtual void die(const DeathReason);
+
+ virtual void setSoundFXLevel(const uint16);
+ virtual void setAmbienceLevel(const uint16);
+
+ void forceStridingStop(const RoomID, const DirectionConstant, const AlternateID);
+ void restoreStriding(const RoomID, const DirectionConstant, const AlternateID);
+
+ HotspotInfoTable::Entry *findHotspotEntry(const HotSpotID);
+
+ Push *getTurnPush() { return &_turnPush; }
+ Picture *getTurnPushPicture() { return &_pushIn; }
+
+ void hideNav();
+ void showNav();
+
+ virtual void loadAmbientLoops() {}
+
+ virtual void flushGameState() {}
+
+ virtual Common::String getBriefingMovie();
+ virtual Common::String getEnvScanMovie();
+ virtual uint getNumHints();
+ virtual Common::String getHintMovie(uint);
+ virtual bool canSolve();
+ virtual void prepareForAIHint(const Common::String &) {}
+ virtual void cleanUpAfterAIHint(const Common::String &) {}
+ virtual void doSolve();
+
+ virtual bool okayToJump();
+
+ virtual AirQuality getAirQuality(const RoomID);
+ virtual void checkAirMask() {}
+ virtual void checkFlashlight() {}
+ virtual void shieldOn() {}
+ virtual void shieldOff() {}
+
+ virtual void loadLoopSound1(const Common::String &, const uint16 volume = 0x100,
+ const TimeValue fadeOut = kDefaultLoopFadeOut, const TimeValue fadeIn = kDefaultLoopFadeIn,
+ const TimeScale fadeScale = kDefaultLoopFadeScale);
+ virtual void loadLoopSound2(const Common::String &, const uint16 volume = 0x100,
+ const TimeValue fadeOut = kDefaultLoopFadeOut, const TimeValue fadeIn = kDefaultLoopFadeIn,
+ const TimeScale fadeScale = kDefaultLoopFadeScale);
+ bool loop1Loaded(const Common::String &soundName) { return _loop1SoundString == soundName; }
+ bool loop2Loaded(const Common::String &soundName) { return _loop2SoundString == soundName; }
+ void startLoop1Fader(const FaderMoveSpec &);
+ void startLoop2Fader(const FaderMoveSpec &);
+
+ virtual void takeItemFromRoom(Item *);
+ virtual void dropItemIntoRoom(Item *, Hotspot *);
+ virtual Hotspot *getItemScreenSpot(Item *, DisplayElement *) { return 0; }
+
+ virtual GameInteraction *makeInteraction(const InteractionID);
+ virtual void requestDeleteCurrentInteraction() { _doneWithInteraction = true; }
+
+ virtual uint16 getDateResID() const = 0;
+
+ virtual void showExtraView(uint32);
+ virtual void startExtraLongSequence(const uint32, const uint32, NotificationFlags, const InputBits interruptionFilter);
+
+ void openCroppedMovie(const Common::String &, CoordType, CoordType);
+ void loopCroppedMovie(const Common::String &, CoordType, CoordType);
+ void closeCroppedMovie();
+ void playCroppedMovieOnce(const Common::String &, CoordType, CoordType, const InputBits interruptionFilter = kFilterNoInput);
+
+ void playMovieSegment(Movie *, TimeValue = 0, TimeValue = 0xffffffff);
+
+ virtual void recallToTSASuccess();
+ virtual void recallToTSAFailure();
+
+ virtual void pickedUpItem(Item *) {}
+
+ virtual void handleInput(const Input &, const Hotspot *);
+protected:
+ PegasusEngine *_vm;
+ Common::String _resName;
+
+ virtual Common::String getSoundSpotsName() = 0;
+ virtual Common::String getNavMovieName() = 0;
+
+ // Notification function.
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ // Map info functions.
+ virtual void getExitEntry(const RoomID room, const DirectionConstant direction, ExitTable::Entry &entry);
+ virtual TimeValue getViewTime(const RoomID room, const DirectionConstant direction);
+ virtual void getDoorEntry(const RoomID room, const DirectionConstant direction, DoorTable::Entry &doorEntry);
+ virtual DirectionConstant getTurnEntry(const RoomID room, const DirectionConstant direction, const TurnDirection turn);
+ virtual void getZoomEntry(const HotSpotID id, ZoomTable::Entry &zoomEntry);
+ virtual void getHotspotEntry(const HotSpotID id, HotspotInfoTable::Entry &hotspotEntry);
+
+ // Nav movie sequences.
+ virtual void startExitMovie(const ExitTable::Entry &);
+ virtual void keepStriding(ExitTable::Entry &);
+ virtual void stopStriding();
+ virtual void checkStriding();
+ virtual bool stillMoveForward();
+ virtual void scheduleStridingCallBack(const TimeValue, NotificationFlags flags);
+ virtual void startZoomMovie(const ZoomTable::Entry &);
+ virtual void startDoorOpenMovie(const TimeValue, const TimeValue);
+ virtual void startTurnPush(const TurnDirection, const TimeValue, const DirectionConstant);
+ virtual void playExtraMovie(const ExtraTable::Entry &, const NotificationFlags, const InputBits interruptionFilter);
+
+ virtual void activateCurrentView(const RoomID, const DirectionConstant, SpotFlags);
+
+ virtual void activateOneHotspot(HotspotInfoTable::Entry &, Hotspot *);
+
+ virtual void startSpotOnceOnly(TimeValue, TimeValue);
+
+ virtual void startMovieSequence(const TimeValue, const TimeValue, NotificationFlags,
+ bool loopSequence, const InputBits interruptionFilter, const TimeValue strideStop = 0xffffffff);
+
+ virtual void createNeighborhoodSpots();
+
+ void resetLastExtra() { _lastExtra = -1; }
+
+ virtual void throwAwayInterface();
+
+ // Action queue stuff
+ void popActionQueue();
+ void serviceActionQueue();
+ void requestAction(const QueueRequestType, const ExtraID, const TimeValue, const TimeValue, const InputBits, const NotificationFlags);
+
+ virtual bool prepareExtraSync(const ExtraID);
+ virtual bool waitMovieFinish(Movie *, const InputBits);
+
+ virtual InputBits getInputFilter();
+
+ // Misc.
+ virtual int16 getStaticCompassAngle(const RoomID, const DirectionConstant dir);
+ virtual void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &);
+ virtual void getZoomCompassMove(const ZoomTable::Entry &, FaderMoveSpec&);
+ virtual void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec&);
+
+ virtual void setUpAIRules();
+ virtual void setHotspotFlags(const HotSpotID, const HotSpotFlags);
+ virtual void setIsItemTaken(const ItemID);
+
+ virtual void upButton(const Input &);
+ virtual void leftButton(const Input &);
+ virtual void rightButton(const Input &);
+ virtual void downButton(const Input &);
+
+ void initOnePicture(Picture *, const Common::String &, DisplayOrder, CoordType, CoordType, bool);
+ void initOneMovie(Movie *, const Common::String &, DisplayOrder, CoordType, CoordType, bool);
+
+ void reinstateMonocleInterface();
+
+ virtual void newInteraction(const InteractionID);
+ virtual void useIdleTime();
+ virtual void bumpIntoWall();
+ virtual void zoomUpOrBump();
+
+ void scheduleEvent(const TimeValue, const TimeScale, const uint32);
+ void cancelEvent();
+ virtual void timerExpired(const uint32) {}
+ bool isEventTimerRunning() { return _eventTimer.isFuseLit(); }
+ uint32 getTimerEvent() { return _timerEvent; }
+ void timerFunction();
+
+ void pauseTimer();
+ void resumeTimer();
+ bool timerPaused();
+
+ // Navigation Data
+ DoorTable _doorTable;
+ ExitTable _exitTable;
+ ExtraTable _extraTable;
+ HotspotInfoTable _hotspotInfoTable;
+ SpotTable _spotTable;
+ TurnTable _turnTable;
+ ViewTable _viewTable;
+ ZoomTable _zoomTable;
+ AlternateID _currentAlternate;
+ HotSpotActivationID _currentActivation;
+
+ int32 _lastExtra;
+ DeathReason _extraDeathReason;
+
+ // Graphics
+ Movie _navMovie;
+ Picture _pushIn;
+ Push _turnPush;
+
+ // Callbacks
+ Notification _neighborhoodNotification;
+ NotificationCallBack _navMovieCallBack;
+ StriderCallBack _stridingCallBack;
+ NotificationCallBack _turnPushCallBack;
+ NotificationCallBack _spotSoundCallBack;
+ NotificationCallBack _delayCallBack;
+
+ // Hotspots
+ HotspotList _neighborhoodHotspots;
+
+ // Sounds
+ SoundTimeBase _spotSounds;
+
+ // Action queue
+ NeighborhoodActionQueue _actionQueue;
+ TimeBase _delayTimer;
+
+ // Interruptibility...
+ InputBits _interruptionFilter;
+
+ // Nav hiding (for info support...)
+ bool _isRunning;
+
+ GameInteraction *_currentInteraction;
+ bool _doneWithInteraction;
+ Movie _croppedMovie;
+
+ Sound _soundLoop1;
+ Common::String _loop1SoundString;
+ SoundFader _loop1Fader;
+
+ Sound _soundLoop2;
+ Common::String _loop2SoundString;
+ SoundFader _loop2Fader;
+
+ // The event timer...
+ FuseFunction _eventTimer;
+ uint32 _timerEvent;
+};
+
+extern Neighborhood *g_neighborhood;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
new file mode 100644
index 0000000000..e2a0267231
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
@@ -0,0 +1,219 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/alpha/ecrmonitor.h"
+
+namespace Pegasus {
+
+static const NotificationFlags kECRSection1FinishedFlag = 1;
+static const NotificationFlags kECRPanFinishedFlag = kECRSection1FinishedFlag << 1;
+static const NotificationFlags kECRSection2FinishedFlag = kECRPanFinishedFlag << 1;
+static const NotificationFlags kECRNotificationFlags = kECRSection1FinishedFlag |
+ kECRPanFinishedFlag |
+ kECRSection2FinishedFlag;
+
+static const TimeValue kSection1Start = 0;
+static const TimeValue kSection1Stop = 25;
+static const TimeValue kPanStart = 0;
+static const TimeValue kPanStop = 20;
+static const TimeValue kSection2Start = 26;
+static const TimeValue kSection2Stop = 1000;
+
+// Seems to be a good value for a 20 second pan.
+static const CoordType kPanPixelsPerFrame = 8;
+
+// Interesting times are in seconds.
+static const TimeValue s_ECRInterestingTimes[] = {
+ 0, 1, 2, 10, 25, 26, 56, 64, 72, 80, 88, 94, 102, 108, 116, 999
+};
+
+// Index into s_ECRInterestingTimes of interesting time before security pan.
+static const int kBeforePanTime = 3;
+
+// Index into s_ECRInterestingTimes of interesting time after security pan.
+static const int kAfterPanTime = 5;
+
+NoradAlphaECRMonitor::NoradAlphaECRMonitor(Neighborhood *nextHandler) : GameInteraction(kNoradECRMonitorInteractionID, nextHandler),
+ _ecrSlideShowNotification(kNoradECRNotificationID, (PegasusEngine *)g_engine), _ecrMovie(kECRSlideShowMovieID),
+ _ecrPan(kECRPanID) {
+}
+
+void NoradAlphaECRMonitor::receiveNotification(Notification *, const NotificationFlags flags) {
+ if (flags & kECRSection1FinishedFlag)
+ ecrSection1Finished();
+ else if (flags & kECRPanFinishedFlag)
+ ecrPanFinished();
+ else if (flags & kECRSection2FinishedFlag)
+ ecrSection2Finished();
+}
+
+int NoradAlphaECRMonitor::findCurrentInterestingTime() {
+ TimeValue time = _ecrMovie.getTime();
+ TimeScale scale = _ecrMovie.getScale();
+
+ for (int i = ARRAYSIZE(s_ECRInterestingTimes) - 1; i >= 0; i--)
+ if (time >= s_ECRInterestingTimes[i] * scale)
+ return i;
+
+ return 0;
+}
+
+void NoradAlphaECRMonitor::skipToNextInterestingTime() {
+ if (_ecrMovie.isRunning()) {
+ int interestingTime = findCurrentInterestingTime();
+ _ecrMovie.setTime(s_ECRInterestingTimes[interestingTime + 1] * _ecrMovie.getScale());
+ _ecrMovie.redrawMovieWorld();
+ } else if (_ecrPan.isRunning()) {
+ _ecrPanCallBack.cancelCallBack();
+ ecrPanFinished();
+ }
+}
+
+void NoradAlphaECRMonitor::skipToPreviousInterestingTime() {
+ if (_ecrPan.isRunning()) {
+ _ecrPan.stop();
+ _ecrPan.stopDisplaying();
+ _ecrPanCallBack.cancelCallBack();
+
+ _ecrMovieCallBack.setCallBackFlag(kECRSection1FinishedFlag);
+ _ecrMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection1Start * scale, kSection1Stop * scale + 1);
+ _ecrMovie.setTime(s_ECRInterestingTimes[kBeforePanTime] * scale);
+ _ecrMovie.start();
+ } else {
+ int interestingTime = findCurrentInterestingTime();
+
+ if (interestingTime == kAfterPanTime) {
+ _ecrMovieCallBack.cancelCallBack();
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection1Start * scale, kSection1Stop * scale + 1);
+ _ecrMovie.setTime(kSection1Stop * scale);
+ ecrSection1Finished();
+ } else if (interestingTime == 0) {
+ _ecrMovie.setTime(kSection1Start * _ecrMovie.getScale());
+ _ecrMovie.redrawMovieWorld();
+ } else {
+ _ecrMovie.setTime(s_ECRInterestingTimes[interestingTime - 1] * _ecrMovie.getScale());
+ _ecrMovie.redrawMovieWorld();
+ }
+ }
+}
+
+void NoradAlphaECRMonitor::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (isInteracting()) {
+ if (input.rightButtonDown())
+ skipToNextInterestingTime();
+ else if (input.leftButtonDown())
+ skipToPreviousInterestingTime();
+ else
+ InputHandler::handleInput(input, cursorSpot);
+ } else {
+ InputHandler::handleInput(input, cursorSpot);
+ }
+}
+
+void NoradAlphaECRMonitor::ecrSection1Finished() {
+ _ecrMovie.stop();
+ _ecrPanCallBack.setNotification(&_ecrSlideShowNotification);
+ _ecrPanCallBack.initCallBack(&_ecrPan, kCallBackAtExtremes);
+ _ecrPanCallBack.setCallBackFlag(kECRPanFinishedFlag);
+ _ecrSlideShowNotification.notifyMe(this, kECRNotificationFlags, kECRNotificationFlags);
+ _ecrPanCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _ecrPan.startDisplaying();
+ _ecrPan.show();
+
+ TimeScale scale = _ecrPan.getScale();
+ _ecrPan.setSegment(kPanStart * scale, kPanStop * scale);
+ _ecrPan.setTime(0);
+ _ecrPan.start();
+}
+
+void NoradAlphaECRMonitor::ecrPanFinished() {
+ _ecrPan.stop();
+ _ecrPan.stopDisplaying();
+ _ecrMovieCallBack.setCallBackFlag(kECRSection2FinishedFlag);
+ _ecrMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection2Start * scale, kSection2Stop * scale);
+ _ecrMovie.start();
+}
+
+void NoradAlphaECRMonitor::ecrSection2Finished() {
+ _ecrMovie.stop();
+ _ecrMovie.stopDisplaying();
+}
+
+void NoradAlphaECRMonitor::openInteraction() {
+ // Initialize the security pan.
+ _ecrPan.initFromMovieFile("Images/Norad Alpha/Security Pan.pano");
+ _ecrPan.initMaskFromPICTFile("Images/Norad Alpha/Security Pan Mask");
+ _ecrPan.setBounds(Common::Rect(kECRPanLeft, kECRPanTop, kECRPanRight, kECRPanBottom));
+ _ecrPan.setDisplayOrder(kECRPanOrder);
+ _ecrPan.setScale(15); // 15 fps.
+
+ // Begin the lame ECR slide show.
+ // clone2727: I didn't say it :P
+ _ecrMovie.initFromMovieFile("Images/Norad Alpha/ECR Monitor Movie");
+
+ _ecrMovieCallBack.setNotification(&_ecrSlideShowNotification);
+ _ecrMovieCallBack.initCallBack(&_ecrMovie, kCallBackAtExtremes);
+ _ecrMovieCallBack.setCallBackFlag(kECRSection1FinishedFlag);
+
+ _ecrSlideShowNotification.notifyMe(this, kECRNotificationFlags, kECRNotificationFlags);
+ _ecrMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ _ecrMovie.moveElementTo(kECRSlideShowLeft, kECRSlideShowTop);
+ _ecrMovie.setDisplayOrder(kECRMonitorOrder);
+ _ecrMovie.startDisplaying();
+ _ecrMovie.show();
+ _ecrMovie.redrawMovieWorld();
+
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection1Start * scale, kSection1Stop * scale + 1);
+
+ _ecrMovie.start();
+}
+
+void NoradAlphaECRMonitor::closeInteraction() {
+ _ecrMovieCallBack.releaseCallBack();
+ _ecrMovie.stop();
+ _ecrMovie.stopDisplaying();
+ _ecrMovie.releaseMovie();
+ _ecrMovieCallBack.releaseCallBack();
+
+ _ecrPanCallBack.releaseCallBack();
+ _ecrPan.stop();
+ _ecrPan.stopDisplaying();
+ _ecrPan.releasePanorama();
+ _ecrPanCallBack.releaseCallBack();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h
new file mode 100644
index 0000000000..9e286ed337
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h
@@ -0,0 +1,65 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_ecrMONITOR_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_ecrMONITOR_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/notification.h"
+#include "pegasus/neighborhood/norad/alpha/panoramascroll.h"
+
+namespace Pegasus {
+
+class NoradAlphaECRMonitor : public GameInteraction, public NotificationReceiver {
+public:
+ NoradAlphaECRMonitor(Neighborhood *);
+ virtual ~NoradAlphaECRMonitor() {}
+
+ virtual void handleInput(const Input &, const Hotspot *);
+
+protected:
+ virtual void openInteraction();
+ virtual void closeInteraction();
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ void ecrSection1Finished();
+ void ecrPanFinished();
+ void ecrSection2Finished();
+
+ int findCurrentInterestingTime();
+ void skipToNextInterestingTime();
+ void skipToPreviousInterestingTime();
+
+ Notification _ecrSlideShowNotification;
+ Movie _ecrMovie;
+ NotificationCallBack _ecrMovieCallBack;
+ PanoramaScroll _ecrPan;
+ NotificationCallBack _ecrPanCallBack;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
new file mode 100644
index 0000000000..169f75f7d2
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
@@ -0,0 +1,445 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/alpha/fillingstation.h"
+#include "pegasus/neighborhood/norad/alpha/noradalpha.h"
+
+namespace Pegasus {
+
+static const NotificationFlags kFSPowerUpFinishedFlag = 1;
+static const NotificationFlags kFSSplashFinishedFlag = kFSPowerUpFinishedFlag << 1;
+static const NotificationFlags kFSIntakeWarningFinishedFlag = kFSSplashFinishedFlag << 1;
+static const NotificationFlags kFSIntakeHiliteFinishedFlag = kFSIntakeWarningFinishedFlag << 1;
+static const NotificationFlags kFSDispenseHiliteFinishedFlag = kFSIntakeHiliteFinishedFlag << 1;
+static const NotificationFlags kFSArHiliteFinishedFlag = kFSDispenseHiliteFinishedFlag << 1;
+static const NotificationFlags kFSCO2HiliteFinishedFlag = kFSArHiliteFinishedFlag << 1;
+static const NotificationFlags kFSHeHiliteFinishedFlag = kFSCO2HiliteFinishedFlag << 1;
+static const NotificationFlags kFSOHiliteFinishedFlag = kFSHeHiliteFinishedFlag << 1;
+static const NotificationFlags kFSNHiliteFinishedFlag = kFSOHiliteFinishedFlag << 1;
+
+static const NotificationFlags kFSNotificationFlags = kFSPowerUpFinishedFlag |
+ kFSSplashFinishedFlag |
+ kFSIntakeWarningFinishedFlag |
+ kFSIntakeHiliteFinishedFlag |
+ kFSDispenseHiliteFinishedFlag |
+ kFSArHiliteFinishedFlag |
+ kFSCO2HiliteFinishedFlag |
+ kFSHeHiliteFinishedFlag |
+ kFSOHiliteFinishedFlag |
+ kFSNHiliteFinishedFlag;
+
+static const int16 kNoState = 0;
+static const int16 kMainMenu = 1;
+static const int16 kWaitingForAttach = 2;
+static const int16 kDispenseMenu = 3;
+static const int16 kWaitingForDispense = 4;
+
+// Dummy itemIDs
+static const ItemID kCO2Item = 10000;
+static const ItemID kHeItem = 10001;
+
+// Interactive points.
+static const TimeValue kFSPowerUpStartStart = 0;
+static const TimeValue kFSPowerUpStartStop = 600;
+static const TimeValue kFSSplashStart = 600;
+static const TimeValue kFSSplashStop = 7800;
+static const TimeValue kFSSplashIntakeStart = 7800;
+static const TimeValue kFSSplashIntakeStop = 18600;
+
+static const TimeValue kFSMainMenu = 18600;
+static const TimeValue kFSIntakeHiliteStart = 19200;
+static const TimeValue kFSIntakeHiliteStop = 19800;
+static const TimeValue kFSDispenseHiliteStart = 19800;
+static const TimeValue kFSDispenseHiliteStop = 20400;
+
+static const TimeValue kFSDispenseMenu = 20400;
+
+static const TimeValue kFSArHiliteStart = 21000;
+static const TimeValue kFSArHiliteStop = 21600;
+static const TimeValue kFSArAttach = 21600;
+static const TimeValue kFSArFilledStart = 22200;
+static const TimeValue kFSArFilledStop = 25200;
+static const TimeValue kFSArIncompatibleStart = 25200;
+static const TimeValue kFSArIncompatibleStop = 30000;
+
+static const TimeValue kFSCO2HiliteStart = 30000;
+static const TimeValue kFSCO2HiliteStop = 30600;
+static const TimeValue kFSCO2Attach = 30600;
+static const TimeValue kFSCO2FilledStart = 31200;
+static const TimeValue kFSCO2FilledStop = 34200;
+static const TimeValue kFSCO2IncompatibleStart = 34200;
+static const TimeValue kFSCO2IncompatibleStop = 39000;
+
+static const TimeValue kFSHeHiliteStart = 39000;
+static const TimeValue kFSHeHiliteStop = 39600;
+static const TimeValue kFSHeAttach = 39600;
+static const TimeValue kFSHeFilledStart = 40200;
+static const TimeValue kFSHeFilledStop = 43200;
+static const TimeValue kFSHeIncompatibleStart = 43200;
+static const TimeValue kFSHeIncompatibleStop = 48000;
+
+static const TimeValue kFSOHiliteStart = 48000;
+static const TimeValue kFSOHiliteStop = 48600;
+static const TimeValue kFSOAttach = 48600;
+static const TimeValue kFSOFilledStart = 49200;
+static const TimeValue kFSOFilledStop = 52200;
+static const TimeValue kFSOIncompatibleStart = 52200;
+static const TimeValue kFSOIncompatibleStop = 57000;
+
+static const TimeValue kFSNHiliteStart = 57000;
+static const TimeValue kFSNHiliteStop = 57600;
+static const TimeValue kFSNAttach = 57600;
+static const TimeValue kFSNFilledStart = 58200;
+static const TimeValue kFSNFilledStop = 61200;
+static const TimeValue kFSNIncompatibleStart = 61200;
+static const TimeValue kFSNIncompatibleStop = 66000;
+
+static const TimeValue kFSIntakeMenu = 66000;
+static const TimeValue kFSIntakeInProgressStart = 66600;
+static const TimeValue kFSIntakeInProgressStop = 69600;
+
+NoradAlphaFillingStation::NoradAlphaFillingStation(Neighborhood *owner) : GameInteraction(kNoradFillingStationInteractionID, owner),
+ _rightSideMovie(kN01RightSideID), _rightSideNotification(kNoradFillingStationNotificationID, ((PegasusEngine *)g_engine)) {
+ _state = kNoState;
+}
+
+void NoradAlphaFillingStation::openInteraction() {
+ _rightSideMovie.initFromMovieFile("Images/Norad Alpha/N01W Right Side");
+ _rightSideMovie.moveElementTo(kNoradAlpha01RightSideLeft, kNoradAlpha01RightSideTop);
+ _rightSideMovie.setDisplayOrder(kN01RightSideOrder);
+ _rightSideMovie.startDisplaying();
+ _rightSideCallBack.setNotification(&_rightSideNotification);
+ _rightSideCallBack.initCallBack(&_rightSideMovie, kCallBackAtExtremes);
+ _rightSideCallBack.setCallBackFlag(kFSPowerUpFinishedFlag);
+ _rightSideNotification.notifyMe(this, kFSNotificationFlags, kFSNotificationFlags);
+ _rightSideCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _rightSideMovie.show();
+ _rightSideMovie.redrawMovieWorld();
+ _rightSideMovie.setSegment(kFSPowerUpStartStart, kFSPowerUpStartStop);
+}
+
+void NoradAlphaFillingStation::initInteraction() {
+ allowInput(false);
+
+ _rightSideMovie.setRate(2);
+}
+
+void NoradAlphaFillingStation::closeInteraction() {
+ _rightSideMovie.stop();
+ _rightSideMovie.stopDisplaying();
+ _rightSideMovie.releaseMovie();
+ _rightSideCallBack.releaseCallBack();
+ ((NoradAlpha *)getOwner())->turnOffFillingStation();
+}
+
+void NoradAlphaFillingStation::setStaticState(TimeValue time, int16 state) {
+ _rightSideMovie.stop();
+ _rightSideMovie.setSegment(0, _rightSideMovie.getDuration());
+ _rightSideMovie.setTime(time);
+ _rightSideMovie.redrawMovieWorld();
+ _state = state;
+ allowInput(true);
+}
+
+void NoradAlphaFillingStation::setSegmentState(TimeValue start, TimeValue stop, NotificationFlags flag, int16 state) {
+ _rightSideMovie.stop();
+ _rightSideMovie.setSegment(start, stop);
+ _rightSideMovie.setTime(start);
+ _rightSideCallBack.setCallBackFlag(flag);
+ _rightSideCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _state = state;
+ allowInput(false);
+ _rightSideMovie.setRate(2);
+}
+
+void NoradAlphaFillingStation::powerUpFinished() {
+ ((NoradAlpha *)getOwner())->turnOnFillingStation();
+ setSegmentState(kFSSplashStart, kFSSplashStop, kFSSplashFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::splashFinished() {
+ if (GameState.getNoradGassed())
+ setSegmentState(kFSSplashIntakeStart, kFSSplashIntakeStop, kFSIntakeWarningFinishedFlag, kNoState);
+ else
+ intakeWarningFinished();
+}
+
+void NoradAlphaFillingStation::intakeWarningFinished() {
+ setStaticState(kFSMainMenu, kMainMenu);
+}
+
+void NoradAlphaFillingStation::showIntakeInProgress(uint16 numSeconds) {
+ if (numSeconds == 0) {
+ setSegmentState(kFSIntakeInProgressStart, kFSIntakeInProgressStop, kFSIntakeWarningFinishedFlag, kNoState);
+ Item *item = ((NoradAlpha *)getOwner())->getFillingItem();
+
+ if (item->getObjectID() == kGasCanister) {
+ GameState.setNoradGassed(true);
+ ((NoradAlpha *)getOwner())->loadAmbientLoops();
+ getOwner()->restoreStriding(kNorad03, kEast, kAltNoradAlphaNormal);
+ }
+ } else {
+ setSegmentState(kFSIntakeInProgressStart, kFSIntakeInProgressStart + _rightSideMovie.getScale() * numSeconds,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ }
+}
+
+void NoradAlphaFillingStation::intakeHighlightFinished() {
+ _rightSideMovie.stop();
+
+ if (GameState.getNoradGassed()) {
+ showIntakeInProgress(2);
+ } else {
+ Item *item = ((NoradAlpha *)getOwner())->getFillingItem();
+ if (item)
+ showIntakeInProgress(0);
+ else
+ setStaticState(kFSIntakeMenu, kWaitingForAttach);
+ }
+}
+
+void NoradAlphaFillingStation::dispenseHighlightFinished() {
+ setStaticState(kFSDispenseMenu, kDispenseMenu);
+}
+
+void NoradAlphaFillingStation::dispenseGas() {
+ Item *item = ((NoradAlpha *)getOwner())->getFillingItem();
+
+ if (item) {
+ if (item->getObjectID() != _dispenseItemID)
+ switch (_dispenseItemID) {
+ case kArgonCanister:
+ setSegmentState(kFSArIncompatibleStart, kFSArIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kCO2Item:
+ setSegmentState(kFSCO2IncompatibleStart, kFSCO2IncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kHeItem:
+ setSegmentState(kFSHeIncompatibleStart, kFSHeIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kAirMask:
+ setSegmentState(kFSOIncompatibleStart, kFSOIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kNitrogenCanister:
+ setSegmentState(kFSNIncompatibleStart, kFSNIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ }
+ else {
+ if (_dispenseItemID == kArgonCanister) {
+ setSegmentState(kFSArFilledStart, kFSArFilledStop, kFSIntakeWarningFinishedFlag, kNoState);
+ item->setItemState(kArgonFull);
+ GameState.setScoringFilledArgonCanister(true);
+ } else if (_dispenseItemID == kAirMask) {
+ setSegmentState(kFSOFilledStart, kFSOFilledStop, kFSIntakeWarningFinishedFlag, kNoState);
+ ((AirMask *)item)->refillAirMask();
+ GameState.setScoringFilledOxygenCanister(true);
+ } else if (_dispenseItemID == kNitrogenCanister) {
+ setSegmentState(kFSNFilledStart, kFSNFilledStop, kFSIntakeWarningFinishedFlag, kNoState);
+ item->setItemState(kNitrogenFull);
+ }
+ }
+ } else {
+ switch (_dispenseItemID) {
+ case kArgonCanister:
+ setStaticState(kFSArAttach, kWaitingForDispense);
+ break;
+ case kCO2Item:
+ setStaticState(kFSCO2Attach, kWaitingForDispense);
+ break;
+ case kHeItem:
+ setStaticState(kFSHeAttach, kWaitingForDispense);
+ break;
+ case kAirMask:
+ setStaticState(kFSOAttach, kWaitingForDispense);
+ break;
+ case kNitrogenCanister:
+ setStaticState(kFSNAttach, kWaitingForDispense);
+ break;
+ }
+ }
+}
+
+void NoradAlphaFillingStation::ArHighlightFinished() {
+ _dispenseItemID = kArgonCanister;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::CO2HighlightFinished() {
+ _dispenseItemID = kCO2Item;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::HeHighlightFinished() {
+ _dispenseItemID = kHeItem;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::OHighlightFinished() {
+ _dispenseItemID = kAirMask;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::NHighlightFinished() {
+ _dispenseItemID = kNitrogenCanister;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::receiveNotification(Notification *, const NotificationFlags flags) {
+ switch (flags) {
+ case kFSPowerUpFinishedFlag:
+ powerUpFinished();
+ break;
+ case kFSSplashFinishedFlag:
+ splashFinished();
+ break;
+ case kFSIntakeWarningFinishedFlag:
+ intakeWarningFinished();
+ break;
+ case kFSIntakeHiliteFinishedFlag:
+ intakeHighlightFinished();
+ break;
+ case kFSDispenseHiliteFinishedFlag:
+ dispenseHighlightFinished();
+ break;
+ case kFSArHiliteFinishedFlag:
+ ArHighlightFinished();
+ break;
+ case kFSCO2HiliteFinishedFlag:
+ CO2HighlightFinished();
+ break;
+ case kFSHeHiliteFinishedFlag:
+ HeHighlightFinished();
+ break;
+ case kFSOHiliteFinishedFlag:
+ OHighlightFinished();
+ break;
+ case kFSNHiliteFinishedFlag:
+ NHighlightFinished();
+ break;
+ }
+}
+
+void NoradAlphaFillingStation::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void NoradAlphaFillingStation::clickInIntake() {
+ setSegmentState(kFSIntakeHiliteStart, kFSIntakeHiliteStop, kFSIntakeHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInDispense() {
+ setSegmentState(kFSDispenseHiliteStart, kFSDispenseHiliteStop, kFSDispenseHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInAr() {
+ setSegmentState(kFSArHiliteStart, kFSArHiliteStop, kFSArHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInCO2() {
+ setSegmentState(kFSCO2HiliteStart, kFSCO2HiliteStop, kFSCO2HiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInHe() {
+ setSegmentState(kFSHeHiliteStart, kFSHeHiliteStop, kFSHeHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInO() {
+ setSegmentState(kFSOHiliteStart, kFSOHiliteStop, kFSOHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInN() {
+ setSegmentState(kFSNHiliteStart, kFSNHiliteStop, kFSNHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInHotspot(const Input &input, const Hotspot *spot) {
+ GameInteraction::clickInHotspot(input, spot);
+
+ switch (spot->getObjectID()) {
+ case kNorad01IntakeSpotID:
+ clickInIntake();
+ break;
+ case kNorad01DispenseSpotID:
+ clickInDispense();
+ break;
+ case kNorad01ArSpotID:
+ clickInAr();
+ break;
+ case kNorad01CO2SpotID:
+ clickInCO2();
+ break;
+ case kNorad01HeSpotID:
+ clickInHe();
+ break;
+ case kNorad01OSpotID:
+ clickInO();
+ break;
+ case kNorad01NSpotID:
+ clickInN();
+ break;
+ }
+}
+
+void NoradAlphaFillingStation::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ switch (_state) {
+ case kMainMenu:
+ g_allHotspots.activateOneHotspot(kNorad01IntakeSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01DispenseSpotID);
+ break;
+ case kDispenseMenu:
+ g_allHotspots.activateOneHotspot(kNorad01ArSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01CO2SpotID);
+ g_allHotspots.activateOneHotspot(kNorad01HeSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01OSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01NSpotID);
+ break;
+ }
+}
+
+void NoradAlphaFillingStation::newFillingItem(Item *item) {
+ switch (_state) {
+ case kWaitingForAttach:
+ if (item)
+ showIntakeInProgress(0);
+ break;
+ case kWaitingForDispense:
+ dispenseGas();
+ break;
+ default:
+ break;
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/fillingstation.h b/engines/pegasus/neighborhood/norad/alpha/fillingstation.h
new file mode 100644
index 0000000000..eb2088e373
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/fillingstation.h
@@ -0,0 +1,91 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_FILLINGSTATION_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_FILLINGSTATION_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+
+namespace Pegasus {
+
+class Item;
+
+class NoradAlphaFillingStation : public GameInteraction, public NotificationReceiver {
+public:
+ NoradAlphaFillingStation(Neighborhood *);
+ virtual ~NoradAlphaFillingStation() {}
+
+ virtual void handleInput(const Input &, const Hotspot *);
+
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+ virtual void activateHotspots();
+
+ void newFillingItem(Item *);
+
+protected:
+ void receiveNotification(Notification *, const NotificationFlags);
+
+ virtual void openInteraction();
+ virtual void initInteraction();
+ virtual void closeInteraction();
+
+ void powerUpFinished();
+ void splashFinished();
+ void intakeWarningFinished();
+ void intakeHighlightFinished();
+ void dispenseHighlightFinished();
+ void ArHighlightFinished();
+ void CO2HighlightFinished();
+ void HeHighlightFinished();
+ void OHighlightFinished();
+ void NHighlightFinished();
+
+ void showIntakeInProgress(uint16);
+
+ void clickInIntake();
+ void clickInDispense();
+ void clickInAr();
+ void clickInCO2();
+ void clickInHe();
+ void clickInO();
+ void clickInN();
+
+ void dispenseGas();
+
+ void setStaticState(TimeValue, int16);
+ void setSegmentState(TimeValue, TimeValue, NotificationFlags, int16);
+
+ Movie _rightSideMovie;
+ Notification _rightSideNotification;
+ NotificationCallBack _rightSideCallBack;
+ int16 _state;
+ ItemID _dispenseItemID;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp b/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp
new file mode 100644
index 0000000000..e4a5e26473
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp
@@ -0,0 +1,763 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/subcontrolroom.h"
+#include "pegasus/neighborhood/norad/alpha/ecrmonitor.h"
+#include "pegasus/neighborhood/norad/alpha/fillingstation.h"
+#include "pegasus/neighborhood/norad/alpha/noradalpha.h"
+
+namespace Pegasus {
+
+const uint32 NoradAlpha::_noradAlphaClawExtras[22] = {
+ kN22ClawFromAToB,
+ kN22ClawALoop,
+ kN22ClawAPinch,
+ kN22ClawACounterclockwise,
+ kN22ClawAClockwise,
+ kN22ClawFromBToA,
+ kN22ClawFromBToC,
+ kN22ClawFromBToD,
+ kN22ClawBLoop,
+ kN22ClawBPinch,
+ kN22ClawBCounterclockwise,
+ kN22ClawBClockwise,
+ kN22ClawFromCToB,
+ kN22ClawCLoop,
+ kN22ClawCPinch,
+ kN22ClawCCounterclockwise,
+ kN22ClawCClockwise,
+ kN22ClawFromDToB,
+ kN22ClawDLoop,
+ kN22ClawDPinch,
+ kN22ClawDCounterclockwise,
+ kN22ClawDClockwise
+};
+
+NoradAlpha::NoradAlpha(InputHandler *nextHandler, PegasusEngine *owner) : Norad(nextHandler, owner, "Norad Alpha", kNoradAlphaID) {
+ _elevatorUpRoomID = kNorad11South;
+ _elevatorDownRoomID = kNorad12South;
+ _elevatorUpSpotID = kNorad12ElevatorUpSpotID;
+ _elevatorDownSpotID = kNorad11ElevatorDownSpotID;
+
+ _subRoomEntryRoom1 = kNorad10;
+ _subRoomEntryDir1 = kEast;
+ _subRoomEntryRoom2 = kNorad21;
+ _subRoomEntryDir2 = kWest;
+ _upperPressureDoorRoom = kNorad10East;
+ _lowerPressureDoorRoom = kNorad21West;
+
+ _upperPressureDoorUpSpotID = kAlphaUpperPressureDoorUpSpotID;
+ _upperPressureDoorDownSpotID = kAlphaUpperPressureDoorDownSpotID;
+ _upperPressureDoorAbortSpotID = kNorad10EastOutSpotID;
+
+ _lowerPressureDoorUpSpotID = kAlphaLowerPressureDoorUpSpotID;
+ _lowerPressureDoorDownSpotID = kAlphaLowerPressureDoorDownSpotID;
+ _lowerPressureDoorAbortSpotID = kNorad21WestOutSpotID;
+
+ _pressureSoundIn = kPressureDoorIntro1In;
+ _pressureSoundOut = kPressureDoorIntro1Out;
+ _equalizeSoundIn = kPressureDoorIntro2In;
+ _equalizeSoundOut = kPressureDoorIntro2Out;
+ _accessDeniedIn = kAlphaAccessDeniedIn;
+ _accessDeniedOut = kAlphaAccessDeniedOut;
+
+ _platformRoom = kNorad19West;
+ _subControlRoom = kNorad22West;
+
+ _subPrepFailed = false;
+
+ setIsItemTaken(kGasCanister);
+}
+
+void NoradAlpha::init() {
+ Norad::init();
+
+ Hotspot *hotspot = _vm->getAllHotspots().findHotspotByID(kN01GasCanisterSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ HotspotInfoTable::Entry *hotspotEntry = findHotspotEntry(kN01GasCanisterSpotID);
+ hotspotEntry->hotspotItem = kGasCanister;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01ArgonCanisterSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ hotspotEntry = findHotspotEntry(kN01ArgonCanisterSpotID);
+ hotspotEntry->hotspotItem = kArgonCanister;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01NitrogenCanisterSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ hotspotEntry = findHotspotEntry(kN01NitrogenCanisterSpotID);
+ hotspotEntry->hotspotItem = kNitrogenCanister;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01AirMaskSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ hotspotEntry = findHotspotEntry(kN01AirMaskSpotID);
+ hotspotEntry->hotspotItem = kAirMask;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01GasOutletSpotID);
+ hotspot->setMaskedHotspotFlags(kDropItemSpotFlag, kDropItemSpotFlag);
+}
+
+void NoradAlpha::start() {
+ if (g_energyMonitor) {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+ }
+
+ NeighborhoodID itemNeighborhood;
+ RoomID itemRoom;
+ DirectionConstant itemDirection;
+
+ Item *item = (Item *)_vm->getAllItems().findItemByID(kGasCanister);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ if (itemNeighborhood == getObjectID()) {
+ _fillingStationItem = item;
+ } else {
+ item = (Item *)_vm->getAllItems().findItemByID(kAirMask);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ if (itemNeighborhood == getObjectID()) {
+ _fillingStationItem = item;
+ } else {
+ item = (Item *)_vm->getAllItems().findItemByID(kNitrogenCanister);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ if (itemNeighborhood == getObjectID()) {
+ _fillingStationItem = item;
+ } else {
+ item = (Item *)_vm->getAllItems().findItemByID(kArgonCanister);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+ if (itemNeighborhood == getObjectID())
+ _fillingStationItem = item;
+ else
+ _fillingStationItem = 0;
+ }
+ }
+ }
+
+ if (!GameState.getNoradGassed())
+ forceStridingStop(kNorad03, kEast, kAltNoradAlphaNormal);
+
+ GameState.setNoradArrivedFromSub(false);
+ Norad::start();
+}
+
+void NoradAlpha::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ if (g_AIArea) {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Norad/XN01WD1", false);
+ AIHasItemCondition *hasGasCanisterCondition = new AIHasItemCondition(kGasCanister);
+ AIRule *rule = new AIRule(hasGasCanisterCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+ }
+}
+
+bool NoradAlpha::okayToJump() {
+ bool result = Neighborhood::okayToJump();
+
+ if (!result)
+ playSpotSoundSync(kAlphaCantTransportIn, kAlphaCantTransportOut);
+
+ return result;
+}
+
+void NoradAlpha::getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove) {
+ if (entry.extra == kNorad19ExitToSub) {
+ compassMove.makeTwoKnotFaderSpec(kNoradAlphaMovieScale, entry.movieStart, 270 + kSubPlatformCompassAngle,
+ entry.movieEnd, 90 + 20 + 360);
+ compassMove.insertFaderKnot(entry.movieStart + 10 * kNoradAlphaFrameDuration, 270 + kSubPlatformCompassAngle);
+ compassMove.insertFaderKnot(entry.movieStart + 29 * kNoradAlphaFrameDuration, 270 + kSubPlatformCompassAngle + 20);
+ compassMove.insertFaderKnot(entry.movieStart + 52 * kNoradAlphaFrameDuration, 270 + kSubPlatformCompassAngle + 20);
+ compassMove.insertFaderKnot(entry.movieStart + 84 * kNoradAlphaFrameDuration, 360 + 90);
+ compassMove.insertFaderKnot(entry.movieStart + 198 * kNoradAlphaFrameDuration, 360 + 90);
+ compassMove.insertFaderKnot(entry.movieStart + 270 * kNoradAlphaFrameDuration, 360 + 90 + 15);
+ compassMove.insertFaderKnot(entry.movieStart + 280 * kNoradAlphaFrameDuration, 360 + 90 + 20);
+ } else {
+ Norad::getExtraCompassMove(entry, compassMove);
+ }
+}
+
+void NoradAlpha::playClawMonitorIntro() {
+ playSpotSoundSync(kLoadClawIntroIn, kLoadClawIntroOut);
+}
+
+GameInteraction *NoradAlpha::makeInteraction(const InteractionID interactionID) {
+ switch (interactionID) {
+ case kNoradECRMonitorInteractionID:
+ return new NoradAlphaECRMonitor(this);
+ case kNoradFillingStationInteractionID:
+ return new NoradAlphaFillingStation(this);
+ }
+
+ return Norad::makeInteraction(interactionID);
+}
+
+void NoradAlpha::loadAmbientLoops() {
+ // clone2727 would like to point out that the following comment does not quite
+ // match the code logic below
+
+/*
+ Logic:
+
+ loop sound 1:
+ if gassed,
+ play warning loop of some sort
+ else
+ play nothing
+ loop sound 2:
+ if gassed and not wearing air mask
+ if in ECR
+ play breathing water loop
+ else
+ play breathing
+ else
+ if in ECR
+ play water loop
+ if at N07 north
+ play unmanned loop
+*/
+
+ if (!GameState.getNoradSeenTimeStream())
+ return;
+
+ RoomID room = GameState.getCurrentRoom();
+ if (GameState.getNoradGassed()) {
+ if (room >= kNorad11 && room <= kNorad19West)
+ loadLoopSound1("Sounds/Norad/NEW SUB AMB.22K.AIFF", kNoradWarningVolume * 3);
+ else if (room >= kNorad21 && room <= kNorad22West)
+ loadLoopSound1("Sounds/Norad/SUB CONTRL LOOP.22K.AIFF", kNoradWarningVolume * 3);
+ else
+ loadLoopSound1("Sounds/Norad/WARNING LOOP.22K.AIFF", kNoradWarningVolume);
+ } else {
+ loadLoopSound1("");
+ }
+
+ if (GameState.getNoradGassed() && !g_airMask->isAirFilterOn()) {
+ if (room >= kNorad01 && room <= kNorad01West) {
+ loadLoopSound2("Sounds/Norad/Breathing Water.22K.AIFF", kNoradSuckWindVolume);
+ } else if (room == kNorad02) {
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Norad/Breathing Water.22K.AIFF", kNoradSuckWindVolume);
+ else
+ loadLoopSound2("Sounds/Norad/SUCKING WIND.22K.AIFF", kNoradSuckWindVolume, 0, 0);
+ } else {
+ loadLoopSound2("Sounds/Norad/SUCKING WIND.22K.AIFF", kNoradSuckWindVolume, 0, 0);
+ }
+ } else {
+ if (room >= kNorad01 && room <= kNorad01West) {
+ loadLoopSound2("Sounds/Norad/WATER FLOWING.AIFF", 0x100 / 2);
+ } else if (room == kNorad02) {
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Norad/WATER FLOWING.AIFF", 0x100 / 2);
+ else
+ loadLoopSound2("");
+ } else {
+ loadLoopSound2("");
+ }
+ }
+
+}
+
+void NoradAlpha::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kNorad02, kEast):
+ case MakeRoomView(kNorad06, kEast):
+ case MakeRoomView(kNorad11, kEast):
+ case MakeRoomView(kNorad15, kEast):
+ case MakeRoomView(kNorad19, kWest):
+ case MakeRoomView(kNorad21, kSouth):
+ makeContinuePoint();
+ break;
+ }
+}
+
+void NoradAlpha::arriveAt(const RoomID room, const DirectionConstant direction) {
+ Norad::arriveAt(room, direction);
+
+ switch (GameState.getCurrentRoom()) {
+ case kNorad01:
+ arriveAtNorad01();
+ break;
+ case kNorad01East:
+ arriveAtNorad01East();
+ break;
+ case kNorad01West:
+ arriveAtNorad01West();
+ break;
+ case kNorad04:
+ arriveAtNorad04();
+ break;
+ case kNorad07North:
+ GameState.setScoringSawUnconsciousOperator(true);
+ break;
+ case kNorad11:
+ GameState.setScoringWentThroughPressureDoor(true);
+ break;
+ case kNorad22:
+ arriveAtNorad22();
+ break;
+ }
+}
+
+void NoradAlpha::arriveAtNorad01() {
+ if (!GameState.getNoradSeenTimeStream() && GameState.getCurrentDirection() == kSouth) {
+ GameState.setNoradN22MessagePlayed(false);
+ requestExtraSequence(kNoradArriveFromTSA, kExtraCompletedFlag, kFilterNoInput);
+ // You are no match for me, human.
+ requestExtraSequence(kNorad01RobotTaunt, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void NoradAlpha::arriveAtNorad01East() {
+ GameState.setScoringSawSecurityMonitor(true);
+ newInteraction(kNoradECRMonitorInteractionID);
+}
+
+void NoradAlpha::arriveAtNorad01West() {
+ newInteraction(kNoradFillingStationInteractionID);
+}
+
+void NoradAlpha::arriveAtNorad04() {
+ if (GameState.getCurrentDirection() == kEast && !GameState.getNoradGassed())
+ playDeathExtra(kNorad04EastDeath, kDeathWokeUpNorad);
+}
+
+void NoradAlpha::arriveAtNorad22() {
+ if (!GameState.getNoradN22MessagePlayed() && GameState.getCurrentDirection() == kSouth) {
+ startExtraSequence(kNorad22SouthIntro, kExtraCompletedFlag, kFilterNoInput);
+ GameState.setNoradN22MessagePlayed(true);
+ }
+}
+
+void NoradAlpha::bumpIntoWall() {
+ requestSpotSound(kAlphaBumpIntoWallIn, kAlphaBumpIntoWallOut, kFilterNoInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+void NoradAlpha::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ if ((flags & kExtraCompletedFlag) != 0) {
+ switch (_lastExtra) {
+ case kNoradArriveFromTSA:
+ GameState.setNoradSeenTimeStream(true);
+ loadAmbientLoops();
+ break;
+ case kNorad01RobotTaunt:
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Norad/XN01SB", false, kWarningInterruption);
+ _interruptionFilter = kFilterAllInput;
+ makeContinuePoint();
+ break;
+ }
+ }
+
+ Norad::receiveNotification(notification, flags);
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ switch (_lastExtra) {
+ case kNorad22SouthIntro:
+ loopExtraSequence(kNorad22SouthReply);
+ playSpotSoundSync(kN22ReplyIn, kN22ReplyOut);
+ startExtraSequence(kNorad22SouthFinish, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kNorad22SouthFinish:
+ _interruptionFilter = kFilterAllInput;
+ // Force ArriveAt to do its thing...
+ GameState.setCurrentRoom(kNorad21);
+ arriveAt(kNorad22, kSouth);
+ break;
+ }
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+void NoradAlpha::getZoomEntry(const HotSpotID spotID, ZoomTable::Entry &entry) {
+ Norad::getZoomEntry(spotID, entry);
+
+ ExtraTable::Entry extra;
+
+ if (spotID == kNorad01GasSpotID) {
+ if (_fillingStationItem) {
+ if (_fillingStationItem->getObjectID() == kGasCanister) {
+ getExtraEntry(kNorad01ZoomInWithGasCanister, extra);
+ entry.movieStart = extra.movieStart;
+ entry.movieEnd = extra.movieEnd;
+ } else {
+ entry.clear();
+ }
+ }
+ } else if (spotID == kNorad01GasOutSpotID) {
+ if (_fillingStationItem) {
+ if (_fillingStationItem->getObjectID() == kGasCanister) {
+ getExtraEntry(kNorad01ZoomOutWithGasCanister, extra);
+ entry.movieStart = extra.movieStart;
+ entry.movieEnd = extra.movieEnd;
+ } else {
+ entry.clear();
+ }
+ }
+ }
+}
+
+TimeValue NoradAlpha::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraTable::Entry entry;
+
+ if (room == kNorad01 && direction == kSouth && !GameState.getNoradSeenTimeStream()) {
+ getExtraEntry(kNoradArriveFromTSA, entry);
+ return entry.movieStart;
+ }
+
+ if (room == kNorad01 && direction == kWest) {
+ if (!_fillingStationItem) {
+ return Norad::getViewTime(room, direction);
+ } else {
+ getExtraEntry(kN01WGasCanister, entry);
+ return entry.movieStart;
+ }
+ } else if (room == kNorad01West && direction == kWest) {
+ uint32 extraID = 0xffffffff;
+ if (_fillingStationItem) {
+ switch (_fillingStationItem->getObjectID()) {
+ case kArgonCanister:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZArgonCanisterLit;
+ else
+ extraID = kN01WZArgonCanisterDim;
+ break;
+ case kGasCanister:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZGasCanisterLit;
+ else
+ extraID = kN01WZGasCanisterDim;
+ break;
+ case kAirMask:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZAirMaskLit;
+ else
+ extraID = kN01WZAirMaskDim;
+ break;
+ case kNitrogenCanister:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZNitrogenCanisterLit;
+ else
+ extraID = kN01WZNitrogenCanisterDim;
+ break;
+ default:
+ // Should never happen.
+ break;
+ }
+ } else if (GameState.getNoradFillingStationOn()) {
+ extraID = kN01WZEmptyLit;
+ }
+
+ if (extraID == 0xffffffff) {
+ return Norad::getViewTime(room, direction);
+ } else {
+ getExtraEntry(extraID, entry);
+ return entry.movieStart;
+ }
+ }
+
+ return Norad::getViewTime(room, direction);
+}
+
+void NoradAlpha::turnOnFillingStation() {
+ if (GameState.getCurrentRoom() == kNorad01West && !GameState.getNoradFillingStationOn()) {
+ GameState.setNoradFillingStationOn(true);
+ updateViewFrame();
+ }
+}
+
+void NoradAlpha::turnOffFillingStation() {
+ if (GameState.getCurrentRoom() == kNorad01West && GameState.getNoradFillingStationOn()) {
+ GameState.setNoradFillingStationOn(false);
+ updateViewFrame();
+ }
+}
+
+void NoradAlpha::activateHotspots() {
+ Norad::activateHotspots();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad01West, kWest):
+ if (_vm->getDragType() == kDragInventoryUse) {
+ if (!_fillingStationItem) {
+ ItemID itemID = _vm->getDraggingItem()->getObjectID();
+ if (itemID == kArgonCanister || itemID == kGasCanister || itemID == kAirMask ||
+ itemID == kNitrogenCanister)
+ _vm->getAllHotspots().activateOneHotspot(kN01GasOutletSpotID);
+ }
+ } else {
+ HotSpotID spotID;
+
+ if (_fillingStationItem) {
+ switch (_fillingStationItem->getObjectID()) {
+ case kArgonCanister:
+ spotID = kN01ArgonCanisterSpotID;
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad01GasOutSpotID);
+ break;
+ case kGasCanister:
+ spotID = kN01GasCanisterSpotID;
+ break;
+ case kAirMask:
+ spotID = kN01AirMaskSpotID;
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad01GasOutSpotID);
+ break;
+ case kNitrogenCanister:
+ spotID = kN01NitrogenCanisterSpotID;
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad01GasOutSpotID);
+ break;
+ default:
+ // Should never happen.
+ spotID = kNoHotSpotID;
+ break;
+ }
+ _vm->getAllHotspots().activateOneHotspot(spotID);
+ }
+ }
+ break;
+ case MakeRoomView(kNorad10, kEast):
+ if (GameState.isCurrentDoorOpen())
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad10DoorSpotID);
+ break;
+ case MakeRoomView(kNorad21, kWest):
+ if (GameState.isCurrentDoorOpen())
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad21WestSpotID);
+ break;
+ }
+}
+
+void NoradAlpha::clickInHotspot(const Input &input, const Hotspot *cursorSpot) {
+ Norad::clickInHotspot(input, cursorSpot);
+
+ if (_vm->getDragType() == kDragInventoryUse) {
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad01West, kWest)) {
+ Item *item = _vm->getDraggingItem();
+ if (item->getObjectID() == kAirMask || item->getObjectID() == kArgonCanister ||
+ item->getObjectID() == kNitrogenCanister || item->getObjectID() == kGasCanister) {
+ HotspotInfoTable::Entry *hotspotEntry = findHotspotEntry(kN01GasOutletSpotID);
+ hotspotEntry->hotspotItem = item->getObjectID();
+ }
+ }
+ }
+}
+
+void NoradAlpha::takeItemFromRoom(Item *item) {
+ if (GameState.getCurrentRoom() == kNorad01West) {
+ if (_fillingStationItem == item) {
+ _fillingStationItem = 0;
+ GameState.setNoradGassed(false);
+ loadAmbientLoops();
+ ((NoradAlphaFillingStation *)_currentInteraction)->newFillingItem(0);
+ forceStridingStop(kNorad03, kEast, kAltNoradAlphaNormal);
+ }
+ }
+
+ Norad::takeItemFromRoom(item);
+}
+
+void NoradAlpha::dropItemIntoRoom(Item *item, Hotspot *droppedSpot) {
+ if (GameState.getCurrentRoom() == kNorad01West) {
+ if (!_fillingStationItem) {
+ _fillingStationItem = item;
+ ((NoradAlphaFillingStation *)_currentInteraction)->newFillingItem(item);
+ }
+ }
+
+ Norad::dropItemIntoRoom(item, droppedSpot);
+}
+
+void NoradAlpha::getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID, HotSpotID &clawControlSpotID, HotSpotID &pinchClawSpotID,
+ HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID, HotSpotID &moveClawLeftSpotID, HotSpotID &moveClawUpSpotID,
+ HotSpotID &clawCCWSpotID, HotSpotID &clawCWSpotID, uint32 &clawPosition, const uint32 *&clawExtraIDs) {
+ outSpotID = kNorad22MonitorOutSpotID;
+ prepSpotID = kNorad22LaunchPrepSpotID;
+ clawControlSpotID = kNorad22ClawControlSpotID;
+ pinchClawSpotID = kNorad22ClawPinchSpotID;
+ moveClawDownSpotID = kNorad22ClawDownSpotID;
+ moveClawRightSpotID = kNorad22ClawRightSpotID;
+ moveClawLeftSpotID = kNorad22ClawLeftSpotID;
+ moveClawUpSpotID = kNorad22ClawUpSpotID;
+ clawCCWSpotID = kNorad22ClawCCWSpotID;
+ clawCWSpotID = kNorad22ClawCWSpotID;
+ clawPosition = kClawAtD;
+ clawExtraIDs = _noradAlphaClawExtras;
+}
+
+Hotspot *NoradAlpha::getItemScreenSpot(Item *item, DisplayElement *element) {
+ switch (item->getObjectID()) {
+ case kGasCanister:
+ return _vm->getAllHotspots().findHotspotByID(kN01GasCanisterSpotID);
+ case kAirMask:
+ return _vm->getAllHotspots().findHotspotByID(kN01AirMaskSpotID);
+ case kArgonCanister:
+ return _vm->getAllHotspots().findHotspotByID(kN01ArgonCanisterSpotID);
+ case kNitrogenCanister:
+ return _vm->getAllHotspots().findHotspotByID(kN01NitrogenCanisterSpotID);
+ }
+
+ return Norad::getItemScreenSpot(item, element);
+}
+
+Common::String NoradAlpha::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ RoomID room = GameState.getCurrentRoom();
+ if (room >= kNorad01 && room <= kNorad01West)
+ return "Images/AI/Norad/XNE1";
+ else if ((room >= kNorad02 && room <= kNorad19West))
+ return "Images/AI/Norad/XNE2";
+
+ return "Images/AI/Norad/XNE3";
+ }
+
+ return movieName;
+}
+
+uint NoradAlpha::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad01, kNorth):
+ case MakeRoomView(kNorad01, kSouth):
+ case MakeRoomView(kNorad01, kEast):
+ case MakeRoomView(kNorad01, kWest):
+ case MakeRoomView(kNorad01East, kEast):
+ case MakeRoomView(kNorad01West, kWest):
+ if (GameState.getNoradGassed()) {
+ if (g_airMask->isAirFilterOn())
+ numHints = 0;
+ else
+ numHints = 3;
+ } else {
+ numHints = 2;
+ }
+ break;
+ case MakeRoomView(kNorad19West, kWest):
+ if (getSubPrepFailed() && GameState.getNoradSubPrepState() != kSubPrepped)
+ numHints = 1;
+ break;
+ case MakeRoomView(kNorad22, kWest):
+ numHints = 1;
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String NoradAlpha::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty()) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad01, kNorth):
+ case MakeRoomView(kNorad01, kSouth):
+ case MakeRoomView(kNorad01, kEast):
+ case MakeRoomView(kNorad01, kWest):
+ case MakeRoomView(kNorad01East, kEast):
+ case MakeRoomView(kNorad01West, kWest):
+ switch (hintNum) {
+ case 1:
+ if (GameState.getNoradGassed())
+ return "Images/AI/Norad/XN01SW";
+
+ return "Images/AI/Norad/XN01WD2";
+ case 2:
+ if (GameState.getNoradGassed()) {
+ if (_vm->playerHasItemID(kAirMask))
+ // Mask must not be on if we get here...
+ return "Images/AI/Globals/XGLOB1A";
+
+ return "Images/AI/Globals/XGLOB3D";
+ }
+
+ return "Images/AI/Globals/XGLOB5C";
+ case 3:
+ return "Images/AI/Norad/XN01SH";
+ }
+ break;
+ case MakeRoomView(kNorad19West, kWest):
+ return "Images/AI/Norad/XN19NH";
+ case MakeRoomView(kNorad22, kWest):
+ return "Images/AI/Globals/XGLOB1C";
+ }
+ }
+
+ return movieName;
+}
+
+void NoradAlpha::closeDoorOffScreen(const RoomID room, const DirectionConstant) {
+ switch (room) {
+ case kNorad12:
+ case kNorad13:
+ case kNorad18:
+ case kNorad19:
+ playSpotSoundSync(kAlphaElevatorDoorCloseIn, kAlphaElevatorDoorCloseOut);
+ break;
+ default:
+ playSpotSoundSync(kAlphaRegDoorCloseIn, kAlphaRegDoorCloseOut);
+ break;
+ }
+}
+
+void NoradAlpha::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &spotEntry) {
+ if (room == kNorad01 && direction == kSouth)
+ spotEntry.clear();
+ else
+ Norad::findSpotEntry(room, direction, flags, spotEntry);
+}
+
+bool NoradAlpha::canSolve() {
+ return Norad::canSolve() || getHintMovie(1) == "Images/AI/Norad/XN01SW";
+}
+
+void NoradAlpha::doSolve() {
+ Norad::doSolve();
+
+ if (getHintMovie(1) == "Images/AI/Norad/XN01SW") {
+ _vm->addItemToInventory(g_airMask);
+ g_airMask->putMaskOn();
+ }
+}
+
+Common::String NoradAlpha::getNavMovieName() {
+ return "Images/Norad Alpha/Norad Alpha.movie";
+}
+
+Common::String NoradAlpha::getSoundSpotsName() {
+ return "Sounds/Norad/Norad Alpha Spots";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/noradalpha.h b/engines/pegasus/neighborhood/norad/alpha/noradalpha.h
new file mode 100644
index 0000000000..582d6c2bb3
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/noradalpha.h
@@ -0,0 +1,115 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_NORADALPHA_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_NORADALPHA_H
+
+#include "pegasus/neighborhood/norad/norad.h"
+
+namespace Pegasus {
+
+class Item;
+
+class NoradAlpha : public Norad {
+public:
+ NoradAlpha(InputHandler *, PegasusEngine *);
+ virtual ~NoradAlpha() {}
+
+ virtual void init();
+ void start();
+
+ virtual bool okayToJump();
+
+ void playClawMonitorIntro();
+
+ void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &);
+
+ void turnOnFillingStation();
+ void turnOffFillingStation();
+ Item *getFillingItem() { return _fillingStationItem; }
+ bool gasCanisterIntake();
+
+ virtual void takeItemFromRoom(Item *);
+ virtual void dropItemIntoRoom(Item *, Hotspot *);
+
+ virtual GameInteraction *makeInteraction(const InteractionID);
+
+ virtual void getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID, HotSpotID &clawControlSpotID,
+ HotSpotID &pinchClawSpotID, HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID,
+ HotSpotID &moveClawLeftSpotID, HotSpotID &moveClawUpSpotID, HotSpotID &clawCCWSpotID,
+ HotSpotID &clawCWSpotID, uint32 &, const uint32 *&);
+
+ void loadAmbientLoops();
+
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+ void setUpAIRules();
+
+ void setSubPrepFailed(bool value) { _subPrepFailed = value; }
+ bool getSubPrepFailed() { return _subPrepFailed; }
+
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+ void clickInHotspot(const Input &, const Hotspot *);
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ bool canSolve();
+ void doSolve();
+
+protected:
+ static const uint32 _noradAlphaClawExtras[22];
+
+ virtual void arriveAtNorad01();
+ virtual void arriveAtNorad01East();
+ virtual void arriveAtNorad01West();
+ virtual void arriveAtNorad04();
+ virtual void arriveAtNorad22();
+
+ virtual void arriveAt(const RoomID, const DirectionConstant);
+
+ virtual void getZoomEntry(const HotSpotID, ZoomTable::Entry &);
+ virtual TimeValue getViewTime(const RoomID, const DirectionConstant);
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ virtual void activateHotspots();
+
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+
+ void bumpIntoWall();
+
+ Item *_fillingStationItem;
+
+ bool _subPrepFailed;
+
+ Common::String getSoundSpotsName();
+ Common::String getNavMovieName();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/panorama.cpp b/engines/pegasus/neighborhood/norad/alpha/panorama.cpp
new file mode 100644
index 0000000000..5a717a84e7
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panorama.cpp
@@ -0,0 +1,239 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/macresman.h"
+#include "common/stream.h"
+#include "pegasus/neighborhood/norad/alpha/panorama.h"
+
+namespace Pegasus {
+
+Panorama::Panorama() : _panoramaMovie(kNoDisplayElement) {
+ blankFields();
+}
+
+Panorama::~Panorama() {
+ releasePanorama();
+}
+
+void Panorama::blankFields() {
+ _viewBounds = Common::Rect();
+ _drawBounds = Common::Rect();
+ _mask = 0;
+ _panoramaWidth = 0;
+ _panoramaHeight = 0;
+ _stripWidth = 0;
+ _stripLeft = -1;
+ _stripRight = -1;
+}
+
+void Panorama::releasePanorama() {
+ if (_panoramaMovie.isMovieValid()) {
+ _panoramaMovie.releaseMovie();
+ _panoramaWorld.deallocateSurface();
+ blankFields();
+ }
+}
+
+static const uint32 kPanoramaResType = MKTAG('P', 'a', 'n', 'I'); // Panorama Information.
+static const uint16 kPanoramaResID = 128;
+
+void Panorama::initFromMovieFile(const Common::String &fileName) {
+ // First, we need the resource fork for other reasons -- PanI resource
+ Common::MacResManager *resFork = new Common::MacResManager();
+ if (!resFork->open(fileName) || !resFork->hasResFork())
+ error("Could not open the resource fork of '%s'", fileName.c_str());
+
+ Common::SeekableReadStream *resource = resFork->getResource(kPanoramaResType, kPanoramaResID);
+ if (!resource)
+ error("No panorama information in the resource fork of '%s'", fileName.c_str());
+
+ _panoramaWidth = resource->readUint16BE();
+ _panoramaHeight = resource->readUint16BE();
+ _stripWidth = resource->readUint16BE();
+
+ delete resource;
+ delete resFork;
+
+ // Now we open the movie like normal
+ _panoramaMovie.initFromMovieFile(fileName);
+}
+
+void Panorama::setMask(Surface *mask) {
+ _mask = mask;
+}
+
+// If the panorama is not open, do nothing and return.
+// Otherwise, set up the view bounds.
+void Panorama::setViewBounds(const Common::Rect &newView) {
+ if (!isPanoramaOpen())
+ return;
+
+ if (newView.isEmpty())
+ return;
+
+ Common::Rect r = newView;
+
+ if (r.width() > _panoramaWidth) {
+ r.left = 0;
+ r.right = _panoramaWidth;
+ } else {
+ if (r.right > _panoramaWidth)
+ r.translate(_panoramaWidth - r.right, 0);
+
+ if (r.left < 0)
+ r.translate(-r.left, 0);
+ }
+
+ if (r.height() > _panoramaHeight) {
+ r.top = 0;
+ r.bottom = _panoramaHeight;
+ } else {
+ if (r.bottom > _panoramaHeight)
+ r.translate(0, _panoramaHeight - r.bottom);
+
+ if (r.top < 0)
+ r.translate(0, -r.top);
+ }
+
+ if (_viewBounds != r) {
+ CoordType stripLeft = 0;
+
+ if (r.width() != _viewBounds.width() || !_panoramaWorld.isSurfaceValid()) {
+ _panoramaWorld.deallocateSurface();
+ makeNewSurface(r);
+ } else {
+ CoordType stripRight;
+ calcStripRange(r, stripLeft, stripRight);
+ loadStrips(stripLeft, stripRight);
+ }
+
+ _viewBounds = r;
+ _drawBounds = r;
+ _drawBounds.translate(-stripLeft * _stripWidth, 0);
+ }
+}
+
+void Panorama::getViewBounds(Common::Rect &r) const {
+ r = _viewBounds;
+}
+
+void Panorama::getPanoramaBounds(Common::Rect &r) const {
+ r = Common::Rect(0, 0, _panoramaWidth, _panoramaHeight);
+}
+
+void Panorama::drawPanorama(const Common::Rect &destRect) {
+ if (_panoramaWorld.isSurfaceValid()) {
+ if (_mask)
+ _panoramaWorld.copyToCurrentPortMasked(_drawBounds, destRect, _mask);
+ else
+ _panoramaWorld.copyToCurrentPortTransparent(_drawBounds, destRect);
+ }
+}
+
+// Make a new Surface big enough to show r, which is assumed to be a valid view bounds.
+// Assumptions:
+// r is a valid view bounds.
+// _panoramaWorld is not allocated.
+// _panoramaHeight, _stripWidth is correct.
+// _panoramaMovie is allocated.
+void Panorama::makeNewSurface(const Common::Rect& view) {
+ CoordType stripLeft, stripRight;
+ calcStripRange(view, stripLeft, stripRight);
+
+ Common::Rect r(0, 0, (stripRight - stripLeft + 1) * _stripWidth, _panoramaHeight);
+ _panoramaWorld.allocateSurface(r);
+ _panoramaMovie.shareSurface(&_panoramaWorld);
+ loadStrips(stripLeft, stripRight);
+}
+
+// Assumes view is not empty.
+void Panorama::calcStripRange(const Common::Rect &view, CoordType &stripLeft, CoordType &stripRight) {
+ stripLeft = view.left / _stripWidth;
+ stripRight = (view.left - view.left % _stripWidth + _stripWidth - 1 + view.width()) / _stripWidth;
+}
+
+// Load in all needed strips to put range (stripLeft, stripRight) into the
+// panorama's Surface. Try to optimize by saving any pixels already in the Surface.
+// Assumptions:
+// Surface is allocated and is big enough for maximum range of
+// stripLeft and stripRight
+void Panorama::loadStrips(CoordType stripLeft, CoordType stripRight) {
+ if (_stripLeft == -1) {
+ // Surface has just been allocated.
+ // Load in all strips.
+ for (CoordType i = stripLeft; i <= stripRight; i++)
+ loadOneStrip(i, stripLeft);
+
+ _stripLeft = stripLeft;
+ _stripRight = stripRight;
+ } else if (stripLeft != _stripLeft) {
+ CoordType overlapLeft = MAX(stripLeft, _stripLeft);
+ CoordType overlapRight = MIN(stripRight, _stripRight);
+
+ if (overlapLeft <= overlapRight) {
+ Common::Rect r1((overlapLeft - _stripLeft) * _stripWidth, 0,
+ (overlapRight - _stripLeft + 1) * _stripWidth, _panoramaHeight);
+
+ if (stripLeft < _stripLeft) {
+ Common::Rect bounds;
+ _panoramaWorld.getSurfaceBounds(bounds);
+ _panoramaWorld.getSurface()->move(bounds.right - r1.right, 0, _panoramaHeight);
+
+ for (CoordType i = stripLeft; i < _stripLeft; i++)
+ loadOneStrip(i, stripLeft);
+ } else {
+ _panoramaWorld.getSurface()->move(-r1.left, 0, _panoramaHeight);
+
+ for (CoordType i = _stripRight + 1; i <= stripRight; i++)
+ loadOneStrip(i, stripLeft);
+ }
+ } else {
+ // No overlap.
+ // Load everything.
+ for (CoordType i = stripLeft; i <= stripRight; i++)
+ loadOneStrip(i, stripLeft);
+ }
+
+ _stripLeft = stripLeft;
+ _stripRight = stripRight;
+ } else if (stripRight > _stripRight) {
+ // Need to add one or more strips.
+ for (CoordType i = _stripRight + 1; i <= stripRight; i++)
+ loadOneStrip(i, _stripLeft);
+
+ _stripRight = stripRight;
+ } else if (stripRight < _stripRight) {
+ // Need to chop off one strip.
+ _stripRight = stripRight;
+ }
+}
+
+void Panorama::loadOneStrip(CoordType stripToLoad, CoordType leftStrip) {
+ _panoramaMovie.moveMovieBoxTo((stripToLoad - leftStrip) * _stripWidth, 0);
+ _panoramaMovie.setTime(stripToLoad, 1);
+ _panoramaMovie.redrawMovieWorld();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/panorama.h b/engines/pegasus/neighborhood/norad/alpha/panorama.h
new file mode 100644
index 0000000000..87c7b3bd4e
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panorama.h
@@ -0,0 +1,98 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMA_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMA_H
+
+#include "pegasus/movie.h"
+
+namespace Pegasus {
+
+/*
+
+ Panorama implements a wide image using a specially constructed movie file.
+ The movie holds the image as a series of vertical strips, say 16 or 32 pixels wide.
+
+ The panorama bounds defines the entire panorama. The view bounds represents the
+ area on the panorama that is kept in memory.
+
+ The panorama bounds is also stored in the movie file; it cannot be changed. The
+ view bounds must always be a subset of the panorama bounds.
+
+ In actuality, the area kept in memory is at least as wide as the view bounds (but
+ may be wider to coincide with the width of the movies slices), and is as tall as
+ the panorama bounds. The view bounds is used by the drawPanorama function to draw
+ a piece of the panorama to the current screen.
+
+ The panorama movie is built at a time scale of 1, with each strip lasting for one
+ second, so that strip number corresponds exactly with the time value at which the
+ strip is stored.
+
+ TO USE:
+
+ Call one initFromMovieFile to open the movie. Then set up a view rect by
+ calling setViewBounds. Once these two functions have been called, drawPanorama
+ will draw the panorama.
+
+*/
+
+class Panorama {
+public:
+ Panorama();
+ virtual ~Panorama();
+
+ void initFromMovieFile(const Common::String &);
+ void releasePanorama();
+ bool isPanoramaOpen() { return _panoramaMovie.isMovieValid(); }
+
+ void setViewBounds(const Common::Rect &);
+ void getViewBounds(Common::Rect &) const;
+
+ void setMask(Surface *);
+
+ void getPanoramaBounds(Common::Rect &) const;
+
+ void drawPanorama(const Common::Rect &);
+
+protected:
+ void blankFields();
+ void makeNewSurface(const Common::Rect &);
+ void calcStripRange(const Common::Rect &, CoordType &, CoordType &);
+ void loadStrips(CoordType, CoordType);
+ void loadOneStrip(CoordType, CoordType);
+
+ Movie _panoramaMovie;
+ Surface _panoramaWorld, *_mask;
+ Common::Rect _viewBounds;
+ Common::Rect _drawBounds;
+ CoordType _panoramaWidth, _panoramaHeight;
+ CoordType _stripWidth; // Pixels per strip.
+ CoordType _numStrips;
+ CoordType _stripLeft, _stripRight;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp
new file mode 100644
index 0000000000..7865bbb442
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp
@@ -0,0 +1,91 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/neighborhood/norad/alpha/panoramascroll.h"
+
+namespace Pegasus {
+
+PanoramaScroll::PanoramaScroll(const DisplayElementID id) : IdlerAnimation(id) {
+ _boundsWidth = 0;
+ _totalWidth = 0;
+}
+
+void PanoramaScroll::initFromMovieFile(const Common::String &fileName) {
+ _panorama.initFromMovieFile(fileName);
+
+ Common::Rect r;
+ _panorama.getPanoramaBounds(r);
+ _totalWidth = r.width();
+}
+
+void PanoramaScroll::initMaskFromPICTFile(const Common::String &fileName) {
+ if (!_panorama.isPanoramaOpen())
+ return;
+
+ _mask.getImageFromPICTFile(fileName);
+ _panorama.setMask(&_mask);
+}
+
+void PanoramaScroll::releasePanorama() {
+ if (_panorama.isPanoramaOpen())
+ _panorama.releasePanorama();
+
+ _mask.deallocateSurface();
+}
+
+void PanoramaScroll::setBounds(const Common::Rect &r) {
+ Animation::setBounds(r);
+
+ _boundsWidth = r.width();
+
+ Common::Rect r2;
+ _panorama.getViewBounds(r2);
+ r2.right = r2.left + _boundsWidth;
+ r2.bottom = r2.top + r.height();
+ _panorama.setViewBounds(r2);
+}
+
+void PanoramaScroll::draw(const Common::Rect &) {
+ _panorama.drawPanorama(_bounds);
+}
+
+void PanoramaScroll::timeChanged(const TimeValue newTime) {
+ CoordType leftPixel = (_totalWidth - _boundsWidth) * newTime / getDuration();
+
+ Common::Rect r;
+ _panorama.getViewBounds(r);
+ if (leftPixel != r.left) {
+ _panorama.getViewBounds(r);
+ r.moveTo(leftPixel, 0);
+ _panorama.setViewBounds(r);
+ triggerRedraw();
+ }
+}
+
+void PanoramaScroll::getPanoramaBounds(Common::Rect &r) const {
+ _panorama.getPanoramaBounds(r);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/panoramascroll.h b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.h
new file mode 100644
index 0000000000..6a3e1515e2
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.h
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMASCROLL_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMASCROLL_H
+
+#include "pegasus/neighborhood/norad/alpha/panorama.h"
+
+namespace Pegasus {
+
+class PanoramaScroll : public IdlerAnimation {
+public:
+ PanoramaScroll(const DisplayElementID);
+ virtual ~PanoramaScroll() {}
+
+ void initFromMovieFile(const Common::String &);
+ void initMaskFromPICTFile(const Common::String &);
+
+ void releasePanorama();
+
+ bool isPanoramaOpen() { return _panorama.isPanoramaOpen(); }
+ void getPanoramaBounds(Common::Rect &) const;
+
+ void setBounds(const Common::Rect&);
+
+ void draw(const Common::Rect &);
+
+protected:
+ void timeChanged(const TimeValue);
+
+ Panorama _panorama;
+ Surface _mask;
+ CoordType _totalWidth, _boundsWidth;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/constants.h b/engines/pegasus/neighborhood/norad/constants.h
new file mode 100644
index 0000000000..37c1769309
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/constants.h
@@ -0,0 +1,755 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_CONSTANTS_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_CONSTANTS_H
+
+#include "pegasus/constants.h"
+
+namespace Pegasus {
+
+// Norad Alpha spot constants
+
+static const TimeValue kAlphaBumpIntoWallIn = 0;
+static const TimeValue kAlphaBumpIntoWallOut = 303;
+
+static const TimeValue kAlphaAccessDeniedIn = 303;
+static const TimeValue kAlphaAccessDeniedOut = 3045;
+
+static const TimeValue kAlphaRegDoorCloseIn = 3045;
+static const TimeValue kAlphaRegDoorCloseOut = 4476;
+
+static const TimeValue kAlphaElevatorDoorCloseIn = 4476;
+static const TimeValue kAlphaElevatorDoorCloseOut = 5071;
+
+static const TimeValue kAlphaCantTransportIn = 5071;
+static const TimeValue kAlphaCantTransportOut = 9348;
+
+static const TimeValue kAlphaPressureDoorIntro1In = 9348;
+static const TimeValue kAlphaPressureDoorIntro1Out = 11061;
+
+static const TimeValue kAlphaPressureDoorIntro2In = 11061;
+static const TimeValue kAlphaPressureDoorIntro2Out = 14098;
+
+static const TimeValue kN22ReplyIn = 14098;
+static const TimeValue kN22ReplyOut = 18442;
+
+static const TimeValue kAlphaLoadClawIntroIn = 18442;
+static const TimeValue kAlphaLoadClawIntroOut = 20698;
+
+// Norad Delta spot constants
+
+static const TimeValue kDeltaBumpIntoWallIn = 0;
+static const TimeValue kDeltaBumpIntoWallOut = 303;
+
+static const TimeValue kDeltaAccessDeniedIn = 303;
+static const TimeValue kDeltaAccessDeniedOut = 3045;
+
+static const TimeValue kDeltaRegDoorCloseIn = 3045;
+static const TimeValue kDeltaRegDoorCloseOut = 4476;
+
+static const TimeValue kDeltaElevatorDoorCloseIn = 4476;
+static const TimeValue kDeltaElevatorDoorCloseOut = 5071;
+
+static const TimeValue kPressureDoorIntro1In = 5071;
+static const TimeValue kPressureDoorIntro1Out = 6784;
+
+static const TimeValue kPressureDoorIntro2In = 6784;
+static const TimeValue kPressureDoorIntro2Out = 9821;
+
+static const TimeValue kLoadClawIntroIn = 9821;
+static const TimeValue kLoadClawIntroOut = 12077;
+
+static const TimeValue kHoldForRetinalIn = 12077;
+static const TimeValue kHoldForRetinalOut = 14104;
+
+static const TimeValue kRetinalScanFailedIn = 14104;
+static const TimeValue kRetinalScanFailedOut = 17538;
+
+static const TimeValue kAddisAbabaIn = 17538;
+static const TimeValue kAddisAbabaOut = 19263;
+
+static const TimeValue kBangkokIn = 19263;
+static const TimeValue kBangkokOut = 20201;
+
+static const TimeValue kBonnIn = 20201;
+static const TimeValue kBonnOut = 20915;
+
+static const TimeValue kDublinIn = 20915;
+static const TimeValue kDublinOut = 21660;
+
+static const TimeValue kHonoluluIn = 21660;
+static const TimeValue kHonoluluOut = 22498;
+
+static const TimeValue kMadridIn = 22498;
+static const TimeValue kMadridOut = 23474;
+
+static const TimeValue kReykjavikIn = 23474;
+static const TimeValue kReykjavikOut = 24488;
+
+static const TimeValue kSanAntonioIn = 24488;
+static const TimeValue kSanAntonioOut = 25561;
+
+static const TimeValue kSeoulIn = 25561;
+static const TimeValue kSeoulOut = 26461;
+
+static const TimeValue kSvortalskIn = 26461;
+static const TimeValue kSvortalskOut = 27582;
+
+static const TimeValue kSiloBeepIn = 27582;
+static const TimeValue kSiloBeepOut = 27721;
+
+static const TimeValue kAllSilosDeactivatedIn = 27721;
+static const TimeValue kAllSilosDeactivatedOut = 28928;
+
+static const TimeValue kGlobalLaunchOverrideIn = 28928;
+static const TimeValue kGlobalLaunchOverrideOut = 30736;
+
+static const TimeValue kLaunchSiloSelectedIn = 30736;
+static const TimeValue kLaunchSiloSelectedOut = 31660;
+
+static const TimeValue kLaunchToProceedIn = 31660;
+static const TimeValue kLaunchToProceedOut = 32536;
+
+static const TimeValue kMaximumDeactivationIn = 32536;
+static const TimeValue kMaximumDeactivationOut = 34337;
+
+static const TimeValue kMissileLaunchedIn = 34337;
+static const TimeValue kMissileLaunchedOut = 35082;
+
+static const TimeValue kNewLaunchSiloIn = 35082;
+static const TimeValue kNewLaunchSiloOut = 36320;
+
+static const TimeValue kStrikeAuthorizedIn = 36320;
+static const TimeValue kStrikeAuthorizedOut = 37393;
+
+static const TimeValue kPrimaryTargetIn = 37393;
+static const TimeValue kPrimaryTargetOut = 38628;
+
+static const TimeValue kSiloDeactivatedIn = 38628;
+static const TimeValue kSiloDeactivatedOut = 39566;
+
+static const TimeValue kStrikeCodeRejectedIn = 39566;
+static const TimeValue kStrikeCodeRejectedOut = 41056;
+
+static const TimeValue kToDeactivateIn = 41056;
+static const TimeValue kToDeactivateOut = 46494;
+
+static const TimeValue kTwoMinutesIn = 46494;
+static const TimeValue kTwoMinutesOut = 47166;
+
+static const TimeValue kOneMinuteIn = 47166;
+static const TimeValue kOneMinuteOut = 47856;
+
+static const TimeValue kFiftySecondsIn = 47856;
+static const TimeValue kFiftySecondsOut = 48691;
+
+static const TimeValue kFortySecondsIn = 48691;
+static const TimeValue kFortySecondsOut = 49500;
+
+static const TimeValue kThirtySecondsIn = 49500;
+static const TimeValue kThirtySecondsOut = 50362;
+
+static const TimeValue kTwentySecondsIn = 50362;
+static const TimeValue kTwentySecondsOut = 51245;
+
+static const TimeValue kTenSecondsIn = 51245;
+static const TimeValue kTenSecondsOut = 52069;
+
+static const TimeValue kGiveUpHumanIn = 52069;
+static const TimeValue kGiveUpHumanOut = 55023;
+
+static const TimeValue kIJustBrokeIn = 55023;
+static const TimeValue kIJustBrokeOut = 59191;
+
+static const TimeValue kTheOnlyGoodHumanIn = 59191;
+static const TimeValue kTheOnlyGoodHumanOut = 62379;
+
+static const TimeValue kYouAreRunningIn = 62379;
+static const TimeValue kYouAreRunningOut = 64201;
+
+static const TimeValue kYouCannotPossiblyIn = 64201;
+static const TimeValue kYouCannotPossiblyOut = 65740;
+
+static const TimeValue kYouWillFailIn = 65740;
+static const TimeValue kYouWillFailOut = 67217;
+
+static const CanOpenDoorReason kCantOpenBadPressure = kCantOpenLastReason + 1;
+
+static const NotificationFlags kAirTimerExpiredFlag = kLastNeighborhoodNotificationFlag << 1;
+
+static const uint16 kNoradWarningVolume = 0x100 / 3;
+static const uint16 kNoradSuckWindVolume = 0x100 / 2;
+
+static const int16 kElevatorCompassAngle = -40;
+static const int16 kSubPlatformCompassAngle = 45;
+static const int16 kSubControlCompassAngle = -10;
+
+// Norad interactions.
+
+static const InteractionID kNoradGlobeGameInteractionID = 0;
+static const InteractionID kNoradECRMonitorInteractionID = 1;
+static const InteractionID kNoradFillingStationInteractionID = 2;
+static const InteractionID kNoradElevatorInteractionID = 3;
+static const InteractionID kNoradPressureDoorInteractionID = 4;
+static const InteractionID kNoradSubControlRoomInteractionID = 5;
+static const InteractionID kNoradSubPlatformInteractionID = 6;
+
+/////////////////////////////////////////////
+//
+// Norad Alpha
+
+static const CoordType kECRSlideShowLeft = kNavAreaLeft + 78;
+static const CoordType kECRSlideShowTop = kNavAreaTop + 1;
+
+static const CoordType kECRPanLeft = kNavAreaLeft + 78 + 5;
+static const CoordType kECRPanTop = kNavAreaTop + 1 + 4;
+static const CoordType kECRPanRight = kECRPanLeft + 213;
+static const CoordType kECRPanBottom = kECRPanTop + 241;
+
+static const CoordType kNoradAlphaElevatorControlsLeft = kNavAreaLeft + 332;
+static const CoordType kNoradAlphaElevatorControlsTop = kNavAreaTop + 127;
+
+static const CoordType kNoradAlpha01LeftSideLeft = kNavAreaLeft + 0;
+static const CoordType kNoradAlpha01LeftSideTop = kNavAreaTop + 0;
+
+static const CoordType kNoradAlpha01RightSideLeft = kNavAreaLeft + 240;
+static const CoordType kNoradAlpha01RightSideTop = kNavAreaTop + 12;
+
+static const CoordType kNoradUpperLevelsLeft = kNavAreaLeft + 98;
+static const CoordType kNoradUpperLevelsTop = kNavAreaTop + 31;
+
+static const CoordType kNoradUpperTypeLeft = kNoradUpperLevelsLeft + 114;
+static const CoordType kNoradUpperTypeTop = kNoradUpperLevelsTop + 8;
+
+static const CoordType kNoradUpperUpLeft = kNavAreaLeft + 361;
+static const CoordType kNoradUpperUpTop = kNavAreaTop + 32;
+
+static const CoordType kNoradUpperDownLeft = kNavAreaLeft + 367;
+static const CoordType kNoradUpperDownTop = kNavAreaTop + 66;
+
+static const CoordType kNoradLowerLevelsLeft = kNavAreaLeft + 74;
+static const CoordType kNoradLowerLevelsTop = kNavAreaTop + 157;
+
+static const CoordType kNoradLowerTypeLeft = kNoradLowerLevelsLeft + 144;
+static const CoordType kNoradLowerTypeTop = kNoradLowerLevelsTop + 9;
+
+static const CoordType kNoradLowerUpLeft = kNavAreaLeft + 380;
+static const CoordType kNoradLowerUpTop = kNavAreaTop + 164;
+
+static const CoordType kNoradLowerDownLeft = kNavAreaLeft + 388;
+static const CoordType kNoradLowerDownTop = kNavAreaTop + 212;
+
+static const CoordType kNoradPlatformLeft = kNavAreaLeft + 36;
+static const CoordType kNoradPlatformTop = kNavAreaTop + 87;
+
+static const CoordType kNoradSubControlLeft = kNavAreaLeft + 0;
+static const CoordType kNoradSubControlTop = kNavAreaTop + 84;
+
+static const CoordType kNoradSubControlPinchLeft = kNoradSubControlLeft + 106;
+static const CoordType kNoradSubControlPinchTop = kNoradSubControlTop + 86;
+
+static const CoordType kNoradSubControlDownLeft = kNoradSubControlLeft + 66;
+static const CoordType kNoradSubControlDownTop = kNoradSubControlTop + 106;
+
+static const CoordType kNoradSubControlRightLeft = kNoradSubControlLeft + 83;
+static const CoordType kNoradSubControlRightTop = kNoradSubControlTop + 90;
+
+static const CoordType kNoradSubControlLeftLeft = kNoradSubControlLeft + 56;
+static const CoordType kNoradSubControlLeftTop = kNoradSubControlTop + 91;
+
+static const CoordType kNoradSubControlUpLeft = kNoradSubControlLeft + 66;
+static const CoordType kNoradSubControlUpTop = kNoradSubControlTop + 81;
+
+static const CoordType kNoradSubControlCCWLeft = kNoradSubControlLeft + 29;
+static const CoordType kNoradSubControlCCWTop = kNoradSubControlTop + 88;
+
+static const CoordType kNoradSubControlCWLeft = kNoradSubControlLeft + 0;
+static const CoordType kNoradSubControlCWTop = kNoradSubControlTop + 89;
+
+static const CoordType kNoradClawMonitorLeft = kNavAreaLeft + 288;
+static const CoordType kNoradClawMonitorTop = kNavAreaTop + 97;
+
+static const CoordType kNoradGreenBallAtALeft = kNoradClawMonitorLeft + 179;
+static const CoordType kNoradGreenBallAtATop = kNoradClawMonitorTop + 82;
+
+static const CoordType kNoradGreenBallAtBLeft = kNoradClawMonitorLeft + 130;
+static const CoordType kNoradGreenBallAtBTop = kNoradClawMonitorTop + 73;
+
+static const CoordType kNoradGreenBallAtCLeft = kNoradClawMonitorLeft + 110;
+static const CoordType kNoradGreenBallAtCTop = kNoradClawMonitorTop + 26;
+
+static const CoordType kNoradGreenBallAtDLeft = kNoradClawMonitorLeft + 21;
+static const CoordType kNoradGreenBallAtDTop = kNoradClawMonitorTop + 49;
+
+/////////////////////////////////////////////
+//
+// Norad Delta
+
+static const CoordType kGlobeMonitorLeft = kNavAreaLeft + 360;
+static const CoordType kGlobeMonitorTop = kNavAreaTop + 144;
+
+static const CoordType kGlobeLeft = kNavAreaLeft + 172;
+static const CoordType kGlobeTop = kNavAreaTop;
+
+static const CoordType kGlobeCircleLeftLeft = kNavAreaLeft + 186;
+static const CoordType kGlobeCircleLeftTop = kNavAreaTop + 41;
+
+static const CoordType kGlobeCircleRightLeft = kNavAreaLeft + 321;
+static const CoordType kGlobeCircleRightTop = kNavAreaTop + 41;
+
+static const CoordType kGlobeCircleUpLeft = kNavAreaLeft + 220;
+static const CoordType kGlobeCircleUpTop = kNavAreaTop + 7;
+
+static const CoordType kGlobeCircleDownLeft = kNavAreaLeft + 220;
+static const CoordType kGlobeCircleDownTop = kNavAreaTop + 142;
+
+static const CoordType kGlobeUpperLeftHiliteLeft = kNavAreaLeft + 207;
+static const CoordType kGlobeUpperLeftHiliteTop = kNavAreaTop + 28;
+
+static const CoordType kGlobeUpperRightHiliteLeft = kNavAreaLeft + 307;
+static const CoordType kGlobeUpperRightHiliteTop = kNavAreaTop + 28;
+
+static const CoordType kGlobeLowerLeftHiliteLeft = kNavAreaLeft + 207;
+static const CoordType kGlobeLowerLeftHiliteTop = kNavAreaTop + 128;
+
+static const CoordType kGlobeLowerRightHiliteLeft = kNavAreaLeft + 307;
+static const CoordType kGlobeLowerRightHiliteTop = kNavAreaTop + 128;
+
+static const CoordType kGlobeLeftMotionHiliteLeft = kNavAreaLeft + 182;
+static const CoordType kGlobeLeftMotionHiliteTop = kNavAreaTop + 60;
+
+static const CoordType kGlobeRightMotionHiliteLeft = kNavAreaLeft + 331;
+static const CoordType kGlobeRightMotionHiliteTop = kNavAreaTop + 60;
+
+static const CoordType kGlobeUpMotionHiliteLeft = kNavAreaLeft + 239;
+static const CoordType kGlobeUpMotionHiliteTop = kNavAreaTop + 3;
+
+static const CoordType kGlobeDownMotionHiliteLeft = kNavAreaLeft + 239;
+static const CoordType kGlobeDownMotionHiliteTop = kNavAreaTop + 152;
+
+static const CoordType kGlobeUpperNamesLeft = kNavAreaLeft + 368;
+static const CoordType kGlobeUpperNamesTop = kNavAreaTop + 188;
+
+static const CoordType kGlobeLowerNamesLeft = kNavAreaLeft + 368;
+static const CoordType kGlobeLowerNamesTop = kNavAreaTop + 212;
+
+static const CoordType kGlobeCountdownLeft = kNavAreaLeft + 478;
+static const CoordType kGlobeCountdownTop = kNavAreaTop + 164;
+
+// Norad Alpha display IDs.
+
+static const DisplayElementID kECRSlideShowMovieID = kNeighborhoodDisplayID;
+static const DisplayElementID kECRPanID = kECRSlideShowMovieID + 1;
+static const DisplayElementID kNoradAlphaDeathMovieID = kECRPanID + 1;
+static const DisplayElementID kNoradElevatorControlsID = kNoradAlphaDeathMovieID + 1;
+static const DisplayElementID kN01LeftSideID = kNoradElevatorControlsID + 1;
+static const DisplayElementID kN01RightSideID = kN01LeftSideID + 1;
+static const DisplayElementID kPressureDoorLevelsID = kN01RightSideID + 1;
+static const DisplayElementID kPressureDoorTypeID = kPressureDoorLevelsID + 1;
+static const DisplayElementID kPressureDoorUpButtonID = kPressureDoorTypeID + 1;
+static const DisplayElementID kPressureDoorDownButtonID = kPressureDoorUpButtonID + 1;
+static const DisplayElementID kPlatformMonitorID = kPressureDoorDownButtonID + 1;
+static const DisplayElementID kSubControlMonitorID = kPlatformMonitorID + 1;
+static const DisplayElementID kClawMonitorID = kSubControlMonitorID + 1;
+static const DisplayElementID kSubControlPinchID = kClawMonitorID + 1;
+static const DisplayElementID kSubControlDownID = kSubControlPinchID + 1;
+static const DisplayElementID kSubControlRightID = kSubControlDownID + 1;
+static const DisplayElementID kSubControlLeftID = kSubControlRightID + 1;
+static const DisplayElementID kSubControlUpID = kSubControlLeftID + 1;
+static const DisplayElementID kSubControlCCWID = kSubControlUpID + 1;
+static const DisplayElementID kSubControlCWID = kSubControlCCWID + 1;
+static const DisplayElementID kClawMonitorGreenBallID = kSubControlCWID + 1;
+
+// Norad Delta display IDs.
+
+static const DisplayElementID kGlobeMonitorID = kNeighborhoodDisplayID;
+static const DisplayElementID kGlobeMovieID = kGlobeMonitorID + 14;
+static const DisplayElementID kGlobeCircleLeftID = kGlobeMovieID + 1;
+static const DisplayElementID kGlobeCircleRightID = kGlobeCircleLeftID + 1;
+static const DisplayElementID kGlobeCircleUpID = kGlobeCircleRightID + 1;
+static const DisplayElementID kGlobeCircleDownID = kGlobeCircleUpID + 1;
+static const DisplayElementID kMotionHiliteLeftID = kGlobeCircleDownID + 1;
+static const DisplayElementID kMotionHiliteRightID = kMotionHiliteLeftID + 1;
+static const DisplayElementID kMotionHiliteUpID = kMotionHiliteRightID + 1;
+static const DisplayElementID kMotionHiliteDownID = kMotionHiliteUpID + 1;
+static const DisplayElementID kTargetHiliteUpperLeftID = kMotionHiliteDownID + 1;
+static const DisplayElementID kTargetHiliteUpperRightID = kTargetHiliteUpperLeftID + 1;
+static const DisplayElementID kTargetHiliteLowerLeftID = kTargetHiliteUpperRightID + 1;
+static const DisplayElementID kTargetHiliteLowerRightID = kTargetHiliteLowerLeftID + 1;
+static const DisplayElementID kGlobeUpperNamesID = kTargetHiliteLowerRightID + 1;
+static const DisplayElementID kGlobeLowerNamesID = kGlobeUpperNamesID + 1;
+static const DisplayElementID kGlobeCountdownID = kGlobeLowerNamesID + 1;
+
+// Norad Alpha:
+
+static const DisplayOrder kECRMonitorOrder = kMonitorLayer;
+static const DisplayOrder kECRPanOrder = kECRMonitorOrder + 1;
+
+static const DisplayOrder kN01LeftSideOrder = kMonitorLayer;
+static const DisplayOrder kN01RightSideOrder = kN01LeftSideOrder + 1;
+
+static const DisplayOrder kElevatorControlsOrder = kMonitorLayer;
+
+static const DisplayOrder kPressureLevelsOrder = kMonitorLayer;
+static const DisplayOrder kPressureTypeOrder = kPressureLevelsOrder + 1;
+static const DisplayOrder kPressureUpOrder = kPressureTypeOrder + 1;
+static const DisplayOrder kPressureDownOrder = kPressureUpOrder + 1;
+
+static const DisplayOrder kPlatformOrder = kMonitorLayer;
+
+static const DisplayOrder kSubControlOrder = kMonitorLayer;
+static const DisplayOrder kClawMonitorOrder = kSubControlOrder + 1;
+static const DisplayOrder kSubControlPinchOrder = kClawMonitorOrder + 1;
+static const DisplayOrder kSubControlDownOrder = kSubControlPinchOrder + 1;
+static const DisplayOrder kSubControlRightOrder = kSubControlDownOrder + 1;
+static const DisplayOrder kSubControlLeftOrder = kSubControlRightOrder + 1;
+static const DisplayOrder kSubControlUpOrder = kSubControlLeftOrder + 1;
+static const DisplayOrder kSubControlCCWOrder = kSubControlUpOrder + 1;
+static const DisplayOrder kSubControlCWOrder = kSubControlCCWOrder + 1;
+static const DisplayOrder kClawMonitorGreenBallOrder = kSubControlCWOrder + 1;
+
+// Norad Delta:
+
+static const DisplayOrder kGlobeMonitorLayer = kMonitorLayer;
+static const DisplayOrder kGlobeMovieLayer = kGlobeMonitorLayer + 1;
+static const DisplayOrder kGlobeCircleLayer = kGlobeMovieLayer + 1;
+static const DisplayOrder kGlobeHilitesLayer = kGlobeCircleLayer + 1;
+static const DisplayOrder kGlobeUpperNamesLayer = kGlobeHilitesLayer + 1;
+static const DisplayOrder kGlobeLowerNamesLayer = kGlobeUpperNamesLayer + 1;
+static const DisplayOrder kGlobeCountdownLayer = kGlobeLowerNamesLayer + 1;
+
+// Norad Alpha Tables
+
+static const TimeScale kNoradAlphaMovieScale = 600;
+static const TimeScale kNoradAlphaFramesPerSecond = 15;
+static const TimeScale kNoradAlphaFrameDuration = 40;
+
+// Alternate IDs.
+
+static const AlternateID kAltNoradAlphaNormal = 0;
+
+// Room IDs.
+
+static const RoomID kNorad01 = 0;
+static const RoomID kNorad01East = 1;
+static const RoomID kNorad01West = 2;
+static const RoomID kNorad02 = 3;
+static const RoomID kNorad03 = 4;
+static const RoomID kNorad04 = 5;
+static const RoomID kNorad05 = 6;
+static const RoomID kNorad06 = 7;
+static const RoomID kNorad07 = 8;
+static const RoomID kNorad07North = 9;
+static const RoomID kNorad08 = 10;
+static const RoomID kNorad09 = 11;
+static const RoomID kNorad10 = 12;
+static const RoomID kNorad10East = 13;
+static const RoomID kNorad11 = 14;
+static const RoomID kNorad11South = 15;
+static const RoomID kNorad12 = 16;
+static const RoomID kNorad12South = 17;
+static const RoomID kNorad13 = 18;
+static const RoomID kNorad14 = 19;
+static const RoomID kNorad15 = 20;
+static const RoomID kNorad16 = 21;
+static const RoomID kNorad17 = 22;
+static const RoomID kNorad18 = 23;
+static const RoomID kNorad19 = 24;
+static const RoomID kNorad19West = 25;
+static const RoomID kNorad21 = 26;
+static const RoomID kNorad21West = 27;
+static const RoomID kNorad22 = 28;
+static const RoomID kNorad22West = 29;
+
+// Hot Spot Activation IDs.
+
+
+// Hot Spot IDs.
+
+static const HotSpotID kNorad01ECRSpotID = 5000;
+static const HotSpotID kNorad01GasSpotID = 5001;
+static const HotSpotID kNorad01ECROutSpotID = 5002;
+static const HotSpotID kNorad01GasOutSpotID = 5003;
+static const HotSpotID kNorad01MonitorSpotID = 5004;
+static const HotSpotID kNorad01IntakeSpotID = 5005;
+static const HotSpotID kNorad01DispenseSpotID = 5006;
+static const HotSpotID kNorad01ArSpotID = 5007;
+static const HotSpotID kNorad01CO2SpotID = 5008;
+static const HotSpotID kNorad01HeSpotID = 5009;
+static const HotSpotID kNorad01OSpotID = 5010;
+static const HotSpotID kNorad01NSpotID = 5011;
+static const HotSpotID kN01GasCanisterSpotID = 5012;
+static const HotSpotID kN01ArgonCanisterSpotID = 5013;
+static const HotSpotID kN01AirMaskSpotID = 5014;
+static const HotSpotID kN01NitrogenCanisterSpotID = 5015;
+static const HotSpotID kN01GasOutletSpotID = 5016;
+static const HotSpotID kNorad07DoorSpotID = 5017;
+static const HotSpotID kNorad07DoorOutSpotID = 5018;
+static const HotSpotID kNorad10DoorSpotID = 5019;
+static const HotSpotID kNorad10EastOutSpotID = 5020;
+static const HotSpotID kAlphaUpperPressureDoorUpSpotID = 5021;
+static const HotSpotID kAlphaUpperPressureDoorDownSpotID = 5022;
+static const HotSpotID kNorad11ElevatorSpotID = 5023;
+static const HotSpotID kNorad11ElevatorOutSpotID = 5024;
+static const HotSpotID kNorad11ElevatorDownSpotID = 5025;
+static const HotSpotID kNorad12ElevatorSpotID = 5026;
+static const HotSpotID kNorad12ElevatorOutSpotID = 5027;
+static const HotSpotID kNorad12ElevatorUpSpotID = 5028;
+static const HotSpotID kNorad19MonitorSpotID = 5029;
+static const HotSpotID kNorad19MonitorOutSpotID = 5030;
+static const HotSpotID kNorad19ActivateMonitorSpotID = 5031;
+static const HotSpotID kNorad21WestSpotID = 5032;
+static const HotSpotID kNorad21WestOutSpotID = 5033;
+static const HotSpotID kAlphaLowerPressureDoorUpSpotID = 5034;
+static const HotSpotID kAlphaLowerPressureDoorDownSpotID = 5035;
+static const HotSpotID kNorad22MonitorSpotID = 5036;
+static const HotSpotID kNorad22MonitorOutSpotID = 5037;
+static const HotSpotID kNorad22LaunchPrepSpotID = 5038;
+static const HotSpotID kNorad22ClawControlSpotID = 5039;
+static const HotSpotID kNorad22ClawPinchSpotID = 5040;
+static const HotSpotID kNorad22ClawDownSpotID = 5041;
+static const HotSpotID kNorad22ClawRightSpotID = 5042;
+static const HotSpotID kNorad22ClawLeftSpotID = 5043;
+static const HotSpotID kNorad22ClawUpSpotID = 5044;
+static const HotSpotID kNorad22ClawCCWSpotID = 5045;
+static const HotSpotID kNorad22ClawCWSpotID = 5046;
+
+// Extra sequence IDs.
+
+static const ExtraID kNoradArriveFromTSA = 0;
+static const ExtraID kNorad01RobotTaunt = 1;
+static const ExtraID kNorad01ZoomInWithGasCanister = 2;
+static const ExtraID kN01WGasCanister = 3;
+static const ExtraID kNorad01ZoomOutWithGasCanister = 4;
+static const ExtraID kN01WZEmptyLit = 5;
+static const ExtraID kN01WZGasCanisterDim = 6;
+static const ExtraID kN01WZGasCanisterLit = 7;
+static const ExtraID kN01WZArgonCanisterDim = 8;
+static const ExtraID kN01WZArgonCanisterLit = 9;
+static const ExtraID kN01WZAirMaskDim = 10;
+static const ExtraID kN01WZAirMaskLit = 11;
+static const ExtraID kN01WZNitrogenCanisterDim = 12;
+static const ExtraID kN01WZNitrogenCanisterLit = 13;
+static const ExtraID kNorad04EastDeath = 14;
+static const ExtraID kNorad19PrepSub = 15;
+static const ExtraID kNorad19ExitToSub = 16;
+static const ExtraID kNorad22SouthIntro = 17;
+static const ExtraID kNorad22SouthReply = 18;
+static const ExtraID kNorad22SouthFinish = 19;
+static const ExtraID kN22ClawFromAToB = 20;
+static const ExtraID kN22ClawALoop = 21;
+static const ExtraID kN22ClawAPinch = 22;
+static const ExtraID kN22ClawACounterclockwise = 23;
+static const ExtraID kN22ClawAClockwise = 24;
+static const ExtraID kN22ClawFromBToA = 25;
+static const ExtraID kN22ClawFromBToC = 26;
+static const ExtraID kN22ClawFromBToD = 27;
+static const ExtraID kN22ClawBLoop = 28;
+static const ExtraID kN22ClawBPinch = 29;
+static const ExtraID kN22ClawBCounterclockwise = 30;
+static const ExtraID kN22ClawBClockwise = 31;
+static const ExtraID kN22ClawFromCToB = 32;
+static const ExtraID kN22ClawCLoop = 33;
+static const ExtraID kN22ClawCPinch = 34;
+static const ExtraID kN22ClawCCounterclockwise = 35;
+static const ExtraID kN22ClawCClockwise = 36;
+static const ExtraID kN22ClawFromDToB = 37;
+static const ExtraID kN22ClawDLoop = 38;
+static const ExtraID kN22ClawDPinch = 39;
+static const ExtraID kN22ClawDCounterclockwise = 40;
+static const ExtraID kN22ClawDClockwise = 41;
+
+
+// Norad Delta Extra sequence IDs.
+
+static const ExtraID kArriveFromSubChase = 0;
+static const ExtraID kN59ZoomWithRobot = 1;
+static const ExtraID kN59RobotApproaches = 2;
+static const ExtraID kN59RobotPunchLoop = 3;
+static const ExtraID kN59PlayerWins1 = 4;
+static const ExtraID kN59PlayerWins2 = 5;
+static const ExtraID kN59RobotWins = 6;
+static const ExtraID kN59RobotHeadOpens = 7;
+static const ExtraID kN59Biochips111 = 8;
+static const ExtraID kN59Biochips011 = 9;
+static const ExtraID kN59Biochips101 = 10;
+static const ExtraID kN59Biochips001 = 11;
+static const ExtraID kN59Biochips110 = 12;
+static const ExtraID kN59Biochips010 = 13;
+static const ExtraID kN59Biochips100 = 14;
+static const ExtraID kN59Biochips000 = 15;
+static const ExtraID kN59RobotDisappears = 16;
+static const ExtraID kN60ClawFromAToB = 17;
+static const ExtraID kN60ClawALoop = 18;
+static const ExtraID kN60ClawAPinch = 19;
+static const ExtraID kN60ClawACounterclockwise = 20;
+static const ExtraID kN60ClawAClockwise = 21;
+static const ExtraID kN60ClawFromBToA = 22;
+static const ExtraID kN60ClawFromBToC = 23;
+static const ExtraID kN60ClawFromBToD = 24;
+static const ExtraID kN60ClawBLoop = 25;
+static const ExtraID kN60ClawBPinch = 26;
+static const ExtraID kN60ClawBCounterclockwise = 27;
+static const ExtraID kN60ClawBClockwise = 28;
+static const ExtraID kN60ClawFromCToB = 29;
+static const ExtraID kN60ClawCLoop = 30;
+static const ExtraID kN60ClawCPinch = 31;
+static const ExtraID kN60ClawCCounterclockwise = 32;
+static const ExtraID kN60ClawCClockwise = 33;
+static const ExtraID kN60ClawFromDToB = 34;
+static const ExtraID kN60ClawDLoop = 35;
+static const ExtraID kN60ClawDPinch = 36;
+static const ExtraID kN60ClawDCounterclockwise = 37;
+static const ExtraID kN60ClawDClockwise = 38;
+static const ExtraID kN60RobotApproaches = 39;
+static const ExtraID kN60FirstMistake = 40;
+static const ExtraID kN60ArmActivated = 41;
+static const ExtraID kN60SecondMistake = 42;
+static const ExtraID kN60ArmToPositionB = 43;
+static const ExtraID kN60ThirdMistake = 44;
+static const ExtraID kN60ArmGrabsRobot = 45;
+static const ExtraID kN60FourthMistake = 46;
+static const ExtraID kN60ArmCarriesRobotToPositionA = 47;
+static const ExtraID kN60PlayerFollowsRobotToDoor = 48;
+static const ExtraID kN60RobotHeadOpens = 49;
+static const ExtraID kN60Biochips111 = 50;
+static const ExtraID kN60Biochips011 = 51;
+static const ExtraID kN60Biochips101 = 52;
+static const ExtraID kN60Biochips001 = 53;
+static const ExtraID kN60Biochips110 = 54;
+static const ExtraID kN60Biochips010 = 55;
+static const ExtraID kN60Biochips100 = 56;
+static const ExtraID kN60Biochips000 = 57;
+static const ExtraID kN60RobotDisappears = 58;
+static const ExtraID kNoradDeltaRetinalScanBad = 59;
+static const ExtraID kNoradDeltaRetinalScanGood = 60;
+static const ExtraID kN79BrightView = 61;
+
+// Norad Delta Tables
+
+static const TimeScale kNoradDeltaMovieScale = 600;
+static const TimeScale kNoradDeltaFramesPerSecond = 15;
+static const TimeScale kNoradDeltaFrameDuration = 40;
+
+// Alternate IDs.
+
+static const AlternateID kAltNoradDeltaNormal = 0;
+
+// Room IDs.
+
+static const RoomID kNorad41 = 0;
+static const RoomID kNorad42 = 1;
+static const RoomID kNorad43 = 2;
+static const RoomID kNorad44 = 3;
+static const RoomID kNorad45 = 4;
+static const RoomID kNorad46 = 5;
+static const RoomID kNorad47 = 6;
+static const RoomID kNorad48 = 7;
+static const RoomID kNorad48South = 8;
+static const RoomID kNorad49 = 9;
+static const RoomID kNorad49South = 10;
+static const RoomID kNorad50 = 11;
+static const RoomID kNorad50East = 12;
+static const RoomID kNorad51 = 13;
+static const RoomID kNorad52 = 14;
+static const RoomID kNorad53 = 15;
+static const RoomID kNorad54 = 16;
+static const RoomID kNorad54North = 17;
+static const RoomID kNorad55 = 18;
+static const RoomID kNorad56 = 19;
+static const RoomID kNorad57 = 20;
+static const RoomID kNorad58 = 21;
+static const RoomID kNorad59 = 22;
+static const RoomID kNorad59West = 23;
+static const RoomID kNorad60 = 24;
+static const RoomID kNorad60West = 25;
+static const RoomID kNorad61 = 26;
+static const RoomID kNorad62 = 27;
+static const RoomID kNorad63 = 28;
+static const RoomID kNorad64 = 29;
+static const RoomID kNorad65 = 30;
+static const RoomID kNorad66 = 31;
+static const RoomID kNorad67 = 32;
+static const RoomID kNorad68 = 33;
+static const RoomID kNorad68West = 34;
+static const RoomID kNorad69 = 35;
+static const RoomID kNorad78 = 36;
+static const RoomID kNorad79 = 37;
+static const RoomID kNorad79West = 38;
+
+// Hot Spot Activation IDs.
+
+
+// Hot Spot IDs.
+
+static const HotSpotID kNorad48ElevatorSpotID = 5000;
+static const HotSpotID kNorad48ElevatorOutSpotID = 5001;
+static const HotSpotID kNorad48ElevatorUpSpotID = 5002;
+static const HotSpotID kNorad49ElevatorSpotID = 5003;
+static const HotSpotID kNorad49ElevatorOutSpotID = 5004;
+static const HotSpotID kNorad49ElevatorDownSpotID = 5005;
+static const HotSpotID kNorad50DoorSpotID = 5006;
+static const HotSpotID kNorad50DoorOutSpotID = 5007;
+static const HotSpotID kDeltaUpperPressureDoorUpSpotID = 5008;
+static const HotSpotID kDeltaUpperPressureDoorDownSpotID = 5009;
+static const HotSpotID kNorad54DoorSpotID = 5010;
+static const HotSpotID kNorad54DoorOutSpotID = 5011;
+static const HotSpotID kNorad59WestSpotID = 5012;
+static const HotSpotID kNorad59WestOutSpotID = 5013;
+static const HotSpotID kDeltaLowerPressureDoorUpSpotID = 5014;
+static const HotSpotID kDeltaLowerPressureDoorDownSpotID = 5015;
+static const HotSpotID kDelta59RobotHeadSpotID = 5016;
+static const HotSpotID kDelta59RobotShieldBiochipSpotID = 5017;
+static const HotSpotID kDelta59RobotOpMemBiochipSpotID = 5018;
+static const HotSpotID kDelta59RobotRetinalBiochipSpotID = 5019;
+static const HotSpotID kNorad60MonitorSpotID = 5020;
+static const HotSpotID kNorad60MonitorOutSpotID = 5021;
+static const HotSpotID kNorad60LaunchPrepSpotID = 5022;
+static const HotSpotID kNorad60ClawControlSpotID = 5023;
+static const HotSpotID kNorad60ClawPinchSpotID = 5024;
+static const HotSpotID kNorad60ClawDownSpotID = 5025;
+static const HotSpotID kNorad60ClawRightSpotID = 5026;
+static const HotSpotID kNorad60ClawLeftSpotID = 5027;
+static const HotSpotID kNorad60ClawUpSpotID = 5028;
+static const HotSpotID kNorad60ClawCCWSpotID = 5029;
+static const HotSpotID kNorad60ClawCWSpotID = 5030;
+static const HotSpotID kDelta60RobotHeadSpotID = 5031;
+static const HotSpotID kDelta60RobotShieldBiochipSpotID = 5032;
+static const HotSpotID kDelta60RobotOpMemBiochipSpotID = 5033;
+static const HotSpotID kDelta60RobotRetinalBiochipSpotID = 5034;
+static const HotSpotID kNorad68WestSpotID = 5035;
+static const HotSpotID kNorad68WestOutSpotID = 5036;
+static const HotSpotID kNorad79WestSpotID = 5037;
+static const HotSpotID kNorad79WestOutSpotID = 5038;
+static const HotSpotID kNorad79SpinLeftSpotID = 5039;
+static const HotSpotID kNorad79SpinRightSpotID = 5040;
+static const HotSpotID kNorad79SpinUpSpotID = 5041;
+static const HotSpotID kNorad79SpinDownSpotID = 5042;
+static const HotSpotID kNorad79SiloAreaSpotID = 5043;
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.cpp b/engines/pegasus/neighborhood/norad/delta/globegame.cpp
new file mode 100644
index 0000000000..06e40c2b3a
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/delta/globegame.cpp
@@ -0,0 +1,1062 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/cursor.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/delta/globegame.h"
+#include "pegasus/neighborhood/norad/delta/noraddelta.h"
+
+namespace Pegasus {
+
+static const TimeValue kDurationPerFrame = 600 / 15;
+static const TimeValue kDurationPerRow = kNumLongSlices * kDurationPerFrame;
+static const short kVerticalDuration = 16;
+
+GlobeTracker::GlobeTracker(Movie *globeMovie, Picture *leftHighlight, Picture *rightHighlight,
+ Picture *upHighlight, Picture *downHighlight) {
+ _globeMovie = globeMovie;
+ _leftHighlight = leftHighlight;
+ _rightHighlight = rightHighlight;
+ _upHighlight = upHighlight;
+ _downHighlight = downHighlight;
+}
+
+void GlobeTracker::setTrackParameters(const Hotspot *trackSpot, GlobeTrackDirection direction) {
+ _trackSpot = trackSpot;
+ _trackDirection = direction;
+
+ TimeValue time, newTime, start;
+
+ switch (_trackDirection) {
+ case kTrackLeft:
+ time = _globeMovie->getTime();
+
+ if (((time / kDurationPerRow) & 1) == 0) {
+ start = (time / kDurationPerRow + 1) * kDurationPerRow;
+ newTime = start + kDurationPerRow - time % kDurationPerRow;
+ } else {
+ start = (time / kDurationPerRow) * kDurationPerRow;
+ newTime = time;
+ }
+
+ _globeMovie->setSegment(start, start + kDurationPerRow);
+
+ if (newTime != time) {
+ _globeMovie->setTime(newTime);
+ _globeMovie->redrawMovieWorld();
+ }
+
+ _globeMovie->setFlags(kLoopTimeBase);
+ break;
+ case kTrackRight:
+ time = _globeMovie->getTime();
+
+ if (((time / kDurationPerRow) & 1) == 0) {
+ start = (time / kDurationPerRow) * kDurationPerRow;
+ newTime = time;
+ } else {
+ start = (time / kDurationPerRow - 1) * kDurationPerRow;
+ newTime = start + kDurationPerRow - time % kDurationPerRow;
+ }
+
+ _globeMovie->setSegment(start, start + kDurationPerRow);
+
+ if (newTime != time) {
+ _globeMovie->setTime(newTime);
+ _globeMovie->redrawMovieWorld();
+ }
+
+ _globeMovie->setFlags(kLoopTimeBase);
+ break;
+ case kTrackUp:
+ case kTrackDown:
+ _globeMovie->setSegment(0, _globeMovie->getDuration());
+ _globeMovie->setFlags(0);
+ break;
+ }
+}
+
+void GlobeTracker::activateHotspots() {
+ Tracker::activateHotspots();
+
+ if (_trackSpot)
+ g_allHotspots.activateOneHotspot(_trackSpot->getObjectID());
+}
+
+bool GlobeTracker::stopTrackingInput(const Input &input) {
+ return !JMPPPInput::isPressingInput(input);
+}
+
+void GlobeTracker::continueTracking(const Input &input) {
+ Common::Point where;
+ input.getInputLocation(where);
+
+ if (g_allHotspots.findHotspot(where) == _trackSpot)
+ trackGlobeMovie();
+ else
+ stopGlobeMovie();
+}
+
+void GlobeTracker::startTracking(const Input &input) {
+ Tracker::startTracking(input);
+ trackGlobeMovie();
+}
+
+void GlobeTracker::stopTracking(const Input &input) {
+ Tracker::stopTracking(input);
+ stopGlobeMovie();
+}
+
+void GlobeTracker::trackGlobeMovie() {
+ TimeValue time;
+
+ switch (_trackDirection) {
+ case kTrackLeft:
+ if (!_globeMovie->isRunning())
+ _globeMovie->start();
+
+ _leftHighlight->show();
+ break;
+ case kTrackRight:
+ if (!_globeMovie->isRunning())
+ _globeMovie->start();
+
+ _rightHighlight->show();
+ break;
+ case kTrackUp:
+ time = _globeMovie->getTime();
+
+ if (_trackTime == 0) {
+ _trackTime = tickCount();
+ } else if ((int)time - (int)kDurationPerRow * 2 >= 0 && (int)tickCount() >= _trackTime + kVerticalDuration) {
+ _trackTime = tickCount();
+ _globeMovie->setTime(time - kDurationPerRow * 2);
+ _globeMovie->redrawMovieWorld();
+ }
+
+ _upHighlight->show();
+ break;
+ case kTrackDown:
+ time = _globeMovie->getTime();
+
+ if (_trackTime == 0) {
+ _trackTime = tickCount();
+ } else if (time + kDurationPerRow * 2 < _globeMovie->getDuration() && (int)tickCount() >= _trackTime + kVerticalDuration) {
+ _trackTime = tickCount();
+ _globeMovie->setTime(time + kDurationPerRow * 2);
+ _globeMovie->redrawMovieWorld();
+ }
+
+ _downHighlight->show();
+ break;
+ }
+}
+
+void GlobeTracker::stopGlobeMovie() {
+ switch (_trackDirection) {
+ case kTrackLeft:
+ _leftHighlight->hide();
+ _globeMovie->stop();
+ break;
+ case kTrackRight:
+ _rightHighlight->hide();
+ _globeMovie->stop();
+ break;
+ case kTrackUp:
+ _upHighlight->hide();
+ _trackTime = tickCount() - kVerticalDuration;
+ break;
+ case kTrackDown:
+ _downHighlight->hide();
+ _trackTime = tickCount() - kVerticalDuration;
+ break;
+ }
+}
+
+// Globe game PICTs:
+static const ResIDType kGlobeCircleLeftPICTID = 300;
+static const ResIDType kGlobeCircleRightPICTID = 301;
+static const ResIDType kGlobeCircleUpPICTID = 302;
+static const ResIDType kGlobeCircleDownPICTID = 303;
+static const ResIDType kTargetUpperLeftPICTID = 304;
+static const ResIDType kTargetUpperRightPICTID = 305;
+static const ResIDType kTargetLowerLeftPICTID = 306;
+static const ResIDType kTargetLowerRightPICTID = 307;
+static const ResIDType kMotionHiliteLeftPICTID = 308;
+static const ResIDType kMotionHiliteRightPICTID = 309;
+static const ResIDType kMotionHiliteUpPICTID = 310;
+static const ResIDType kMotionHiliteDownPICTID = 311;
+
+static const ResIDType kGlobeCountdownDigitsID = 350;
+
+static const int kGlobeCountdownWidth = 28;
+static const int kGlobeCountdownHeight = 12;
+static const int kGlobeCountdownOffset1 = 12;
+static const int kGlobeCountdownOffset2 = 20;
+
+GlobeCountdown::GlobeCountdown(const DisplayElementID id) : IdlerAnimation(id) {
+ _digits.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCountdownDigitsID);
+
+ Common::Rect r;
+ _digits.getSurfaceBounds(r);
+ _digitOffset = r.width() / 10;
+ setScale(1);
+ sizeElement(kGlobeCountdownWidth, kGlobeCountdownHeight);
+}
+
+void GlobeCountdown::setDisplayOrder(const DisplayOrder order) {
+ IdlerAnimation::setDisplayOrder(order);
+}
+
+void GlobeCountdown::show() {
+ IdlerAnimation::show();
+}
+
+void GlobeCountdown::hide() {
+ IdlerAnimation::hide();
+}
+
+void GlobeCountdown::moveElementTo(const CoordType x, const CoordType y) {
+ IdlerAnimation::moveElementTo(x, y);
+}
+
+void GlobeCountdown::setCountdownTime(const int numSeconds) {
+ stop();
+ setSegment(0, numSeconds);
+ setTime(numSeconds);
+}
+
+void GlobeCountdown::startCountdown() {
+ setRate(-1);
+}
+
+void GlobeCountdown::stopCountdown() {
+ stop();
+}
+
+void GlobeCountdown::draw(const Common::Rect &) {
+ Common::Rect r1;
+ _digits.getSurfaceBounds(r1);
+ r1.right = r1.left + _digitOffset;
+ Common::Rect r2 = r1;
+ TimeValue time = getTime();
+
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ if (time > 60 * 9 + 59) {
+ r2.moveTo(bounds.left, bounds.top);
+ r1.moveTo(9 * _digitOffset, 0);
+ _digits.copyToCurrentPort(r1, r2);
+
+ r2.moveTo(bounds.left + kGlobeCountdownOffset1, bounds.top);
+ r1.moveTo(5 * _digitOffset, 0);
+ _digits.copyToCurrentPort(r1, r2);
+
+ r2.moveTo(bounds.left + kGlobeCountdownOffset2, bounds.top);
+ r1.moveTo(9 * _digitOffset, 0);
+ _digits.copyToCurrentPort(r1, r2);
+ } else {
+ r2.moveTo(bounds.left, bounds.top);
+ r1.moveTo((time / 60) * _digitOffset, 0);
+ _digits.copyToCurrentPort(r1, r2);
+
+ time %= 60;
+ r2.moveTo(bounds.left + kGlobeCountdownOffset1, bounds.top);
+ r1.moveTo((time / 10) * _digitOffset, 0);
+ _digits.copyToCurrentPort(r1, r2);
+
+ r2.moveTo(bounds.left + kGlobeCountdownOffset2, bounds.top);
+ r1.moveTo((time % 10) * _digitOffset, 0);
+ _digits.copyToCurrentPort(r1, r2);
+ }
+}
+
+const int16 GlobeGame::_siloCoords[kNumAllSilos][2] = {
+ { 60, -151 }, // Anchorage, Alaska
+ { 6, 39 }, // Addis Ababa, Ethiopia
+ { -22, 44 }, // Antaro, Madagascar
+ { 30, -83 }, // Atlanta, Georgia
+ { -41, 173 }, // Auckland, New Zealand
+ { 39, -78 }, // Baltimore, Maryland
+ { 11, 101 }, // Bangkok, Thailand
+ { 2, -75 }, // Bogota, Colombia
+ { 46, 4 }, // Bonn, Germany
+ { 51, -7 }, // Dublin, Ireland
+ { 28, -1 }, // El Menia, Algeria
+ { 67, -111 }, // Ellesmere, Canada
+ { 43, -107 }, // Glasgow, Montana
+ { 61, -48 }, // Godthab, Greenland
+ { 19, -157 }, // Honolulu, Hawaii
+ { 6, 5 }, // Ibadan, Nigeria
+ { -29, 26 }, // Johannesburg, South Africa
+ { 46, 92 }, // Kobdo, Mongolia
+ { -15, -63 }, // La Paz, Bolivia
+ { -35, -61 }, // La Plata, Argentina
+ { -9, -76 }, // Lima, Peru
+ { 38, -4 }, // Madrid, Spain
+ { -8, -51 }, // Manaus, Brazil
+ { 13, 120 }, // Manila, Phillipines
+ { -35, 143 }, // Melbourne, Australia
+ { 60, -161 }, // Nome, Alaska
+ { -7, 142 }, // Papua, New Guinea
+ { -32, 117 }, // Perth, West Australia
+ { 34, -114 }, // Phoenix, Arizona
+ { 18, -71 }, // Port-Au-Prince, Haiti
+ { 42, -121 }, // Portland, Oregon
+ { 61, -20 }, // Reykjavik, Iceland
+ { -22, -46 }, // Rio de Janeiro
+ { 27, -101 }, // San Antonio, Texas
+ { 34, 126 }, // Seoul, Korea
+ { 37, -87 }, // Saint Louis, Missouri
+ { 60, 30 }, // Saint Petersberg, Russia
+ { 56, 12 }, // Stockholm, Sweden
+ { 51, 105 }, // Svortalsk, Siberia
+ { 36, -96 } // Tulsa, Oklahoma
+};
+
+const int16 GlobeGame::_targetSilo[kNumTargetSilos] = {
+ 14, 9, 1, 33, 6, 8, 34, 31, 38, 21
+};
+
+const short GlobeGame::_timeLimit[kNumTargetSilos] = {
+ 120, 110, 100, 90, 80, 70, 60, 50, 40, 30
+};
+
+const TimeValue GlobeGame::_siloName[kNumTargetSilos][2] = {
+ { kHonoluluIn, kHonoluluOut },
+ { kDublinIn, kDublinOut },
+ { kAddisAbabaIn, kAddisAbabaOut },
+ { kSanAntonioIn, kSanAntonioOut },
+ { kBangkokIn, kBangkokOut },
+ { kBonnIn, kBonnOut },
+ { kSeoulIn, kSeoulOut },
+ { kReykjavikIn, kReykjavikOut },
+ { kSvortalskIn, kSvortalskOut },
+ { kMadridIn, kMadridOut }
+};
+
+// From globe room models
+
+static const GlobeGame::Point3D kCameraLocation = { 0.53f, 4.4f, -0.86f };
+static const GlobeGame::Point3D kGlobeCenter = { -31.5f, 8.0f, 0.0f };
+static const float kGlobeRadius = 8.25f;
+static const int16 kDegreesPerLongSlice = 360 / kNumLongSlices;
+static const int16 kDegreesPerLatSlice = 25;
+static const int16 kLongOrigin = -95;
+
+// Other constants.
+
+static const float kTanFieldOfView = 0.7082373180482f;
+static const float kPicturePlaneDistance = 10.0f; // Completely arbitrary.
+static const int16 kLatError = 2;
+static const int16 kLongError = 2;
+static const TimeValue kGlobeMovieStartTime = 2 * 2 * kNumLongSlices * 600 / 15;
+
+static const TimeValue kTimePerGlobeFrame = 40;
+
+static const NotificationFlags kGlobeSplash1Finished = 1;
+static const NotificationFlags kGlobeTimerExpired = kGlobeSplash1Finished << 1;
+static const NotificationFlags kMaxDeactivatedFinished = kGlobeTimerExpired << 1;
+
+static const NotificationFlags kGlobeNotificationFlags = kGlobeSplash1Finished |
+ kGlobeTimerExpired |
+ kMaxDeactivatedFinished;
+
+static const int16 kSplash1End = 4;
+static const int16 kSplash2End = 5;
+static const int16 kSplash3Start = 8;
+static const int16 kSplash3Stop = 9;
+static const int16 kSplash4Start = 9;
+static const int16 kSplash4Stop = 10;
+static const int16 kNewLaunchSiloTime = 10;
+static const int16 kSiloDeactivatedTime = 11;
+static const int16 kMissileLaunchedTime = 12;
+static const int16 kMaxDeactivatedStart = 13;
+static const int16 kMaxDeactivatedStop = 23;
+
+static const int16 kGamePlaying = 1;
+static const int16 kGameOver = 2;
+
+enum {
+ kGameIntro,
+ kPlayingRobotIntro,
+ kPlayingStrikeAuthorized,
+ kPlayingPrimaryTarget,
+ kPlayingNewSilo1,
+ kPlayingNewSilo2,
+ kPlayingNewSilo3,
+ kPlayingTime,
+ kPlayingInstructions,
+ kWaitingForPlayer,
+ kSiloDeactivated,
+ kRobotTaunting,
+ kDelayingPlayer,
+ kPlayerWon1,
+ kPlayerWon2,
+ kPlayerLost1
+};
+
+// TODO: Use ScummVM equivalent
+static const float kPI = 3.1415926535f;
+
+float degreesToRadians(float angle) {
+ return (angle * kPI) / 180;
+}
+
+float radiansToDegrees(float angle) {
+ return (angle * 180) / kPI;
+}
+
+GlobeGame::GlobeGame(Neighborhood *handler) : GameInteraction(kNoradGlobeGameInteractionID, handler),
+ _monitorMovie(kGlobeMonitorID), _globeMovie(kGlobeMovieID), _upperNamesMovie(kGlobeUpperNamesID),
+ _lowerNamesMovie(kGlobeLowerNamesID), _globeNotification(kNoradGlobeNotificationID, (PegasusEngine *)g_engine),
+ _globeCircleLeft(kGlobeCircleLeftID), _globeCircleRight(kGlobeCircleRightID),
+ _globeCircleUp(kGlobeCircleUpID), _globeCircleDown(kGlobeCircleDownID),
+ _motionHighlightLeft(kMotionHiliteLeftID), _motionHighlightRight(kMotionHiliteRightID),
+ _motionHighlightUp(kMotionHiliteUpID), _motionHighlightDown(kMotionHiliteDownID),
+ _targetHighlightUpperLeft(kTargetHiliteUpperLeftID), _targetHighlightUpperRight(kTargetHiliteUpperRightID),
+ _targetHighlightLowerLeft(kTargetHiliteLowerLeftID), _targetHighlightLowerRight(kTargetHiliteLowerRightID),
+ _globeTracker(&_globeMovie, &_motionHighlightLeft, &_motionHighlightRight, &_motionHighlightUp,
+ &_motionHighlightDown), _countdown(kGlobeCountdownID) {
+ _neighborhoodNotification = handler->getNeighborhoodNotification();
+}
+
+void GlobeGame::openInteraction() {
+ _monitorMovie.initFromMovieFile("Images/Norad Delta/N79 Left Monitor");
+ _monitorMovie.moveElementTo(kGlobeMonitorLeft, kGlobeMonitorTop);
+ _monitorMovie.setDisplayOrder(kGlobeMonitorLayer);
+ _monitorMovie.startDisplaying();
+ _monitorMovie.setSegment(0, kSplash1End * _monitorMovie.getScale());
+ _monitorMovie.show();
+
+ _monitorCallBack.setNotification(&_globeNotification);
+ _monitorCallBack.initCallBack(&_monitorMovie, kCallBackAtExtremes);
+ _monitorCallBack.setCallBackFlag(kGlobeSplash1Finished);
+ _monitorCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ _upperNamesMovie.initFromMovieFile("Images/Norad Delta/Upper Names");
+ _upperNamesMovie.moveElementTo(kGlobeUpperNamesLeft, kGlobeUpperNamesTop);
+ _upperNamesMovie.setDisplayOrder(kGlobeUpperNamesLayer);
+ _upperNamesMovie.startDisplaying();
+
+ _lowerNamesMovie.initFromMovieFile("Images/Norad Delta/Lower Names");
+ _lowerNamesMovie.moveElementTo(kGlobeLowerNamesLeft, kGlobeLowerNamesTop);
+ _lowerNamesMovie.setDisplayOrder(kGlobeLowerNamesLayer);
+ _lowerNamesMovie.startDisplaying();
+
+ _globeMovie.initFromMovieFile("Images/Norad Delta/Spinning Globe");
+ _globeMovie.moveElementTo(kGlobeLeft, kGlobeTop);
+ _globeMovie.setDisplayOrder(kGlobeMovieLayer);
+ _globeMovie.startDisplaying();
+ _globeMovie.setTime(kGlobeMovieStartTime);
+ _globeMovie.redrawMovieWorld();
+
+ _globeCircleLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleLeftPICTID, true);
+ _globeCircleLeft.moveElementTo(kGlobeCircleLeftLeft, kGlobeCircleLeftTop);
+ _globeCircleLeft.setDisplayOrder(kGlobeCircleLayer);
+ _globeCircleLeft.startDisplaying();
+
+ _globeCircleRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleRightPICTID, true);
+ _globeCircleRight.moveElementTo(kGlobeCircleRightLeft, kGlobeCircleRightTop);
+ _globeCircleRight.setDisplayOrder(kGlobeCircleLayer);
+ _globeCircleRight.startDisplaying();
+
+ _globeCircleUp.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleUpPICTID, true);
+ _globeCircleUp.moveElementTo(kGlobeCircleUpLeft, kGlobeCircleUpTop);
+ _globeCircleUp.setDisplayOrder(kGlobeCircleLayer);
+ _globeCircleUp.startDisplaying();
+
+ _globeCircleDown.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleDownPICTID, true);
+ _globeCircleDown.moveElementTo(kGlobeCircleDownLeft, kGlobeCircleDownTop);
+ _globeCircleDown.setDisplayOrder(kGlobeCircleLayer);
+ _globeCircleDown.startDisplaying();
+
+ _motionHighlightLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteLeftPICTID, true);
+ _motionHighlightLeft.moveElementTo(kGlobeLeftMotionHiliteLeft, kGlobeLeftMotionHiliteTop);
+ _motionHighlightLeft.setDisplayOrder(kGlobeHilitesLayer);
+ _motionHighlightLeft.startDisplaying();
+
+ _motionHighlightRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteRightPICTID, true);
+ _motionHighlightRight.moveElementTo(kGlobeRightMotionHiliteLeft, kGlobeRightMotionHiliteTop);
+ _motionHighlightRight.setDisplayOrder(kGlobeCircleLayer);
+ _motionHighlightRight.startDisplaying();
+
+ _motionHighlightUp.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteUpPICTID, true);
+ _motionHighlightUp.moveElementTo(kGlobeUpMotionHiliteLeft, kGlobeUpMotionHiliteTop);
+ _motionHighlightUp.setDisplayOrder(kGlobeHilitesLayer);
+ _motionHighlightUp.startDisplaying();
+
+ _motionHighlightDown.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteDownPICTID, true);
+ _motionHighlightDown.moveElementTo(kGlobeDownMotionHiliteLeft, kGlobeDownMotionHiliteTop);
+ _motionHighlightDown.setDisplayOrder(kGlobeHilitesLayer);
+ _motionHighlightDown.startDisplaying();
+
+ _targetHighlightUpperLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetUpperLeftPICTID, true);
+ _targetHighlightUpperLeft.moveElementTo(kGlobeUpperLeftHiliteLeft, kGlobeUpperLeftHiliteTop);
+ _targetHighlightUpperLeft.setDisplayOrder(kGlobeHilitesLayer);
+ _targetHighlightUpperLeft.startDisplaying();
+
+ _targetHighlightUpperRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetUpperRightPICTID, true);
+ _targetHighlightUpperRight.moveElementTo(kGlobeUpperRightHiliteLeft, kGlobeUpperRightHiliteTop);
+ _targetHighlightUpperRight.setDisplayOrder(kGlobeHilitesLayer);
+ _targetHighlightUpperRight.startDisplaying();
+
+ _targetHighlightLowerLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetLowerLeftPICTID, true);
+ _targetHighlightLowerLeft.moveElementTo(kGlobeLowerLeftHiliteLeft, kGlobeLowerLeftHiliteTop);
+ _targetHighlightLowerLeft.setDisplayOrder(kGlobeHilitesLayer);
+ _targetHighlightLowerLeft.startDisplaying();
+
+ _targetHighlightLowerRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetLowerRightPICTID, true);
+ _targetHighlightLowerRight.moveElementTo(kGlobeLowerRightHiliteLeft, kGlobeLowerRightHiliteTop);
+ _targetHighlightLowerRight.setDisplayOrder(kGlobeHilitesLayer);
+ _targetHighlightLowerRight.startDisplaying();
+
+ _countdown.setDisplayOrder(kGlobeCountdownLayer);
+ _countdown.moveElementTo(kGlobeCountdownLeft, kGlobeCountdownTop);
+ _countdown.startDisplaying();
+ _countdown.setCountdownTime(_timeLimit[0]);
+
+ _countdownCallBack.setNotification(&_globeNotification);
+ _countdownCallBack.initCallBack(&_countdown, kCallBackAtExtremes);
+ _countdownCallBack.setCallBackFlag(kGlobeTimerExpired);
+ _countdownCallBack.scheduleCallBack(kTriggerAtStart, 0, 0);
+
+ _globeNotification.notifyMe(this, kGlobeNotificationFlags, kGlobeNotificationFlags);
+
+ _gameState = kGameIntro;
+ _currentSiloIndex = 0;
+ _playedInstructions = false;
+
+ _neighborhoodNotification->notifyMe(this, kDelayCompletedFlag | kSpotSoundCompletedFlag, kDelayCompletedFlag | kSpotSoundCompletedFlag);
+}
+
+void GlobeGame::initInteraction() {
+ _monitorMovie.start();
+ _monitorMovie.redrawMovieWorld();
+}
+
+void GlobeGame::closeInteraction() {
+ _monitorMovie.stop();
+ _monitorMovie.stopDisplaying();
+ _monitorMovie.releaseMovie();
+ _monitorCallBack.releaseCallBack();
+
+ _globeMovie.stop();
+ _globeMovie.stopDisplaying();
+ _globeMovie.releaseMovie();
+ _globeNotification.cancelNotification(this);
+
+ _upperNamesMovie.stop();
+ _upperNamesMovie.stopDisplaying();
+ _upperNamesMovie.releaseMovie();
+
+ _lowerNamesMovie.stop();
+ _lowerNamesMovie.stopDisplaying();
+ _lowerNamesMovie.releaseMovie();
+
+ _countdown.hide();
+ _countdown.stopDisplaying();
+ _countdownCallBack.releaseCallBack();
+
+ _globeCircleLeft.stopDisplaying();
+ _globeCircleLeft.deallocateSurface();
+ _globeCircleRight.stopDisplaying();
+ _globeCircleRight.deallocateSurface();
+ _globeCircleUp.stopDisplaying();
+ _globeCircleUp.deallocateSurface();
+ _globeCircleDown.stopDisplaying();
+ _globeCircleDown.deallocateSurface();
+
+ _motionHighlightLeft.stopDisplaying();
+ _motionHighlightLeft.deallocateSurface();
+ _motionHighlightRight.stopDisplaying();
+ _motionHighlightRight.deallocateSurface();
+ _motionHighlightUp.stopDisplaying();
+ _motionHighlightUp.deallocateSurface();
+ _motionHighlightDown.stopDisplaying();
+ _motionHighlightDown.deallocateSurface();
+
+ _targetHighlightUpperLeft.stopDisplaying();
+ _targetHighlightUpperLeft.deallocateSurface();
+ _targetHighlightUpperRight.stopDisplaying();
+ _targetHighlightUpperRight.deallocateSurface();
+ _targetHighlightLowerLeft.stopDisplaying();
+ _targetHighlightLowerLeft.deallocateSurface();
+ _targetHighlightLowerRight.stopDisplaying();
+ _targetHighlightLowerRight.deallocateSurface();
+
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void GlobeGame::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ TimeScale scale = _monitorMovie.getScale();
+
+ if (notification == _neighborhoodNotification) {
+ switch (_gameState) {
+ case kPlayingRobotIntro:
+ _monitorMovie.stop();
+ _monitorMovie.setSegment(0, _monitorMovie.getDuration());
+ _monitorMovie.setTime(kSplash2End * scale - 1);
+ _monitorMovie.setFlags(0);
+
+ _owner->requestDelay(1, 2, kFilterNoInput, 0);
+ _owner->requestSpotSound(kStrikeAuthorizedIn, kStrikeAuthorizedOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ _gameState = kPlayingStrikeAuthorized;
+ break;
+ case kPlayingStrikeAuthorized:
+ _monitorMovie.setSegment(kSplash3Start * scale, kSplash3Stop * scale);
+ _monitorMovie.setTime(kSplash3Start * scale);
+ _monitorMovie.redrawMovieWorld();
+
+ _owner->requestDelay(1, 3, kFilterNoInput, 0);
+ _owner->requestSpotSound(kPrimaryTargetIn, kPrimaryTargetOut, kFilterNoInput, 0);
+ _owner->requestDelay(1, 5, kFilterNoInput, kDelayCompletedFlag);
+ _monitorMovie.start();
+ _gameState = kPlayingPrimaryTarget;
+ break;
+ case kPlayingPrimaryTarget:
+ _monitorMovie.stop();
+ _monitorMovie.setSegment(0, _monitorMovie.getDuration());
+ _monitorMovie.setTime(kNewLaunchSiloTime * scale);
+ _owner->requestSpotSound(kNewLaunchSiloIn, kNewLaunchSiloOut, kFilterNoInput,
+ kSpotSoundCompletedFlag);
+ _gameState = kPlayingNewSilo1;
+ break;
+ case kPlayingNewSilo1:
+ _monitorMovie.stop();
+ _monitorMovie.setSegment(0, _monitorMovie.getDuration());
+ _owner->requestDelay(1, 3, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayingNewSilo2;
+ break;
+ case kPlayingNewSilo2:
+ _upperNamesMovie.show();
+ _upperNamesMovie.setTime(_currentSiloIndex * _upperNamesMovie.getScale());
+ _upperNamesMovie.redrawMovieWorld();
+ _monitorMovie.setTime(kSplash4Stop * scale - 1);
+ _monitorMovie.redrawMovieWorld();
+ _owner->requestSpotSound(_siloName[_currentSiloIndex][0], _siloName[_currentSiloIndex][1], kFilterNoInput, 0);
+ _owner->requestDelay(1, 3, kFilterNoInput, 0);
+ _owner->requestSpotSound(kLaunchToProceedIn, kLaunchToProceedOut, kFilterNoInput, 0);
+ _owner->requestDelay(1, 5, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayingNewSilo3;
+ break;
+ case kPlayingNewSilo3:
+ _countdown.stopCountdown();
+ _countdown.setCountdownTime(_timeLimit[_currentSiloIndex]);
+ _countdown.show();
+ _gameState = kPlayingTime;
+
+ if (_timeLimit[_currentSiloIndex] >= 120)
+ _owner->requestSpotSound(kTwoMinutesIn, kTwoMinutesOut, kFilterNoInput, 0);
+ else if (_timeLimit[_currentSiloIndex] >= 60)
+ _owner->requestSpotSound(kOneMinuteIn, kOneMinuteOut, kFilterNoInput, 0);
+
+ switch (_timeLimit[_currentSiloIndex] % 60) {
+ case 0:
+ _owner->requestDelay(1, 5, kFilterNoInput, kDelayCompletedFlag);
+ break;
+ case 10:
+ _owner->requestDelay(1, 5, kFilterNoInput, 0);
+ _owner->requestSpotSound(kTenSecondsIn, kTenSecondsOut, kFilterNoInput,
+ kSpotSoundCompletedFlag);
+ break;
+ case 20:
+ _owner->requestDelay(1, 5, kFilterNoInput, 0);
+ _owner->requestSpotSound(kTwentySecondsIn, kTwentySecondsOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 30:
+ _owner->requestDelay(1, 5, kFilterNoInput, 0);
+ _owner->requestSpotSound(kThirtySecondsIn, kThirtySecondsOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 40:
+ _owner->requestDelay(1, 5, kFilterNoInput, 0);
+ _owner->requestSpotSound(kFortySecondsIn, kFortySecondsOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 50:
+ _owner->requestDelay(1, 5, kFilterNoInput, 0);
+ _owner->requestSpotSound(kFiftySecondsIn, kFiftySecondsOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ }
+ case kPlayingTime:
+ _gameState = kPlayingInstructions;
+ _globeMovie.show();
+ _globeCircleLeft.show();
+ _globeCircleRight.show();
+ _globeCircleUp.show();
+ _globeCircleDown.show();
+
+ if (_playedInstructions) {
+ receiveNotification(notification, flags);
+ } else {
+ _owner->requestSpotSound(kToDeactivateIn, kToDeactivateOut, kFilterNoInput,
+ kSpotSoundCompletedFlag);
+ _playedInstructions = true;
+ }
+ break;
+ case kPlayingInstructions:
+ _gameState = kWaitingForPlayer;
+ _countdown.startCountdown();
+ break;
+ case kSiloDeactivated:
+ _gameState = kRobotTaunting;
+
+ switch (_currentSiloIndex) {
+ case 3:
+ _owner->requestSpotSound(kYouCannotPossiblyIn, kYouCannotPossiblyOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ case 5:
+ _owner->requestSpotSound(kYouWillFailIn, kYouWillFailOut, kFilterNoInput,
+ kSpotSoundCompletedFlag);
+ break;
+ case 7:
+ _owner->requestSpotSound(kGiveUpHumanIn, kGiveUpHumanOut, kFilterNoInput,
+ kSpotSoundCompletedFlag);
+ break;
+ case 9:
+ _owner->requestSpotSound(kYouAreRunningIn, kYouAreRunningOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ break;
+ default:
+ _owner->requestSpotSound(kNewLaunchSiloIn, kNewLaunchSiloOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ _monitorMovie.setTime(kNewLaunchSiloTime * scale);
+ _monitorMovie.redrawMovieWorld();
+ _gameState = kPlayingNewSilo1;
+ break;
+ }
+ break;
+ case kRobotTaunting:
+ _owner->requestDelay(1, 1, kFilterNoInput, 0);
+ _owner->requestSpotSound(kNewLaunchSiloIn, kNewLaunchSiloOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ _monitorMovie.setTime(kNewLaunchSiloTime * scale);
+ _monitorMovie.redrawMovieWorld();
+ _gameState = kPlayingNewSilo1;
+ break;
+ case kDelayingPlayer:
+ _gameState = kWaitingForPlayer;
+ break;
+ case kPlayerLost1:
+ _owner->recallToTSAFailure();
+ break;
+ case kPlayerWon2:
+ ((NoradDelta *)_owner)->finishedGlobeGame();
+ _owner->requestDeleteCurrentInteraction();
+ break;
+ default:
+ break;
+ }
+ } else if (notification == &_globeNotification) {
+ ExtraTable::Entry entry;
+
+ switch (flags) {
+ case kGlobeSplash1Finished:
+ _owner->getExtraEntry(kN79BrightView, entry);
+ _monitorMovie.stop();
+ _monitorMovie.setSegment(kSplash1End * scale, kSplash2End * scale);
+ _monitorMovie.setFlags(kLoopTimeBase);
+ _monitorMovie.start();
+ _owner->showViewFrame(entry.movieStart);
+ _owner->requestSpotSound(kIJustBrokeIn, kIJustBrokeOut, kFilterNoInput, 0);
+ _owner->requestDelay(1, 2, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayingRobotIntro;
+ break;
+ case kGlobeTimerExpired:
+ // Missile launched, player loses.
+ _owner->requestSpotSound(kMissileLaunchedIn, kMissileLaunchedOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ _gameState = kPlayerLost1;
+ break;
+ case kMaxDeactivatedFinished:
+ _monitorMovie.stop();
+ _monitorMovie.setSegment(0, _monitorMovie.getDuration());
+ _owner->requestDelay(1, 2, kFilterNoInput, 0);
+ _owner->requestSpotSound(kTheOnlyGoodHumanIn, kTheOnlyGoodHumanOut, kFilterNoInput, 0);
+ _owner->requestDelay(1, 2, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayerWon2;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+// Prevent the player from getting up until the game is over.
+
+void GlobeGame::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ Common::Point where;
+ input.getInputLocation(where);
+ Hotspot *spot = g_allHotspots.findHotspot(where);
+
+ if (((PegasusEngine *)g_engine)->_cursor->isVisible() && spot != 0 &&
+ spot->getObjectID() == kNorad79SiloAreaSpotID && findClickedSilo(input) != -1) {
+ _targetHighlightUpperLeft.show();
+ _targetHighlightUpperRight.show();
+ _targetHighlightLowerLeft.show();
+ _targetHighlightLowerRight.show();
+ } else {
+ _targetHighlightUpperLeft.hide();
+ _targetHighlightUpperRight.hide();
+ _targetHighlightLowerLeft.hide();
+ _targetHighlightLowerRight.hide();
+ }
+
+ // Interrupt certain inputs to prevent player from switching modes.
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+int16 GlobeGame::findClickedSilo(const Input &input) {
+ Common::Point screenPoint;
+ input.getInputLocation(screenPoint);
+ screenPoint.x -= kNavAreaLeft;
+ screenPoint.y -= kNavAreaTop;
+
+ Line3D ray;
+ screenPointTo3DPoint(screenPoint.x, screenPoint.y, ray.pt2);
+ ray.pt1 = kCameraLocation;
+
+ Point3D globePoint;
+ if (lineHitsGlobe(ray, globePoint)) {
+ int16 latOrigin, longOrigin, latitude, longitude;
+ globeMovieFrameToOrigin(_globeMovie.getTime() / kTimePerGlobeFrame, latOrigin, longOrigin);
+ globePointToLatLong(globePoint, latOrigin, longOrigin, latitude, longitude);
+
+ for (int16 i = 0; i < kNumAllSilos; i++)
+ if (_siloCoords[i][0] >= latitude - kLatError && _siloCoords[i][0] <= latitude + kLatError &&
+ _siloCoords[i][1] >= longitude - kLongError && _siloCoords[i][1] <= longitude + kLongError)
+ return i;
+ }
+
+ return -1;
+}
+
+void GlobeGame::spinGlobe(const Input &input, const Hotspot *spot, GlobeTrackDirection trackDirection) {
+ _globeTracker.setTrackParameters(spot, trackDirection);
+ _globeTracker.startTracking(input);
+}
+
+void GlobeGame::clickGlobe(const Input &input) {
+ int16 newSilo = findClickedSilo(input);
+
+ if (newSilo != -1) {
+ _targetHighlightUpperLeft.hide();
+ _targetHighlightUpperRight.hide();
+ _targetHighlightLowerLeft.hide();
+ _targetHighlightLowerRight.hide();
+ _lowerNamesMovie.show();
+ _lowerNamesMovie.setTime(newSilo * _lowerNamesMovie.getScale());
+ _lowerNamesMovie.redrawMovieWorld();
+ _owner->requestSpotSound(kSiloBeepIn, kSiloBeepOut, kFilterNoInput, 0);
+
+ if (newSilo == _targetSilo[_currentSiloIndex]) {
+ _currentSiloIndex++;
+ _countdown.stopCountdown();
+ _owner->requestSpotSound(kSiloDeactivatedIn, kSiloDeactivatedOut, kFilterNoInput, 0);
+
+ if (_currentSiloIndex == kNumTargetSilos) {
+ // Player won.
+ _owner->requestDelay(1, 2, kFilterNoInput, 0);
+ _upperNamesMovie.hide();
+ _lowerNamesMovie.hide();
+ _countdown.hide();
+ _monitorMovie.setSegment(kMaxDeactivatedStart * _monitorMovie.getScale(),
+ kMaxDeactivatedStop * _monitorMovie.getScale());
+ _monitorMovie.setTime(kMaxDeactivatedStart * _monitorMovie.getScale());
+ _monitorCallBack.setCallBackFlag(kMaxDeactivatedFinished);
+ _monitorCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _monitorMovie.start();
+ _owner->requestSpotSound(kMaximumDeactivationIn, kMaximumDeactivationOut,
+ kFilterNoInput, kSpotSoundCompletedFlag);
+ _gameState = kPlayerWon1;
+ } else {
+ _owner->requestDelay(2, 1, kFilterNoInput, kDelayCompletedFlag);
+ _upperNamesMovie.hide();
+ _lowerNamesMovie.hide();
+ _countdown.hide();
+ _monitorMovie.setTime(kSiloDeactivatedTime * _monitorMovie.getScale());
+ _monitorMovie.redrawMovieWorld();
+ _gameState = kSiloDeactivated;
+ }
+ } else {
+ _owner->requestDelay(5, 1, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kDelayingPlayer;
+ // Play "incorrect" sound?
+ }
+ }
+}
+
+void GlobeGame::clickInHotspot(const Input &input, const Hotspot *spot) {
+ switch (spot->getObjectID()) {
+ case kNorad79SpinLeftSpotID:
+ spinGlobe(input, spot, kTrackLeft);
+ break;
+ case kNorad79SpinRightSpotID:
+ spinGlobe(input, spot, kTrackRight);
+ break;
+ case kNorad79SpinUpSpotID:
+ spinGlobe(input, spot, kTrackUp);
+ break;
+ case kNorad79SpinDownSpotID:
+ spinGlobe(input, spot, kTrackDown);
+ break;
+ case kNorad79SiloAreaSpotID:
+ clickGlobe(input);
+ break;
+ default:
+ GameInteraction::clickInHotspot(input, spot);
+ break;
+ }
+}
+
+void GlobeGame::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ switch (_gameState) {
+ case kWaitingForPlayer:
+ g_allHotspots.deactivateOneHotspot(kNorad79WestOutSpotID);
+ g_allHotspots.activateOneHotspot(kNorad79SpinLeftSpotID);
+ g_allHotspots.activateOneHotspot(kNorad79SpinRightSpotID);
+ g_allHotspots.activateOneHotspot(kNorad79SpinUpSpotID);
+ g_allHotspots.activateOneHotspot(kNorad79SpinDownSpotID);
+ g_allHotspots.activateOneHotspot(kNorad79SiloAreaSpotID);
+ break;
+ default:
+ g_allHotspots.deactivateOneHotspot(kNorad79WestOutSpotID);
+ break;
+ }
+}
+
+void GlobeGame::globeMovieFrameToOrigin(int16 frameNum, int16 &latOrigin, int16 &longOrigin) {
+ latOrigin = kDegreesPerLatSlice * 2 - (frameNum / (kNumLongSlices * 2)) * kDegreesPerLatSlice;
+ frameNum %= kNumLongSlices * 2;
+
+ if (frameNum >= kNumLongSlices)
+ longOrigin = kLongOrigin + (kNumLongSlices * 2 - 1 - frameNum) * kDegreesPerLongSlice;
+ else
+ longOrigin = kLongOrigin + frameNum * kDegreesPerLongSlice;
+
+ if (longOrigin > 180)
+ longOrigin -= 360;
+}
+
+void GlobeGame::globePointToLatLong(const GlobeGame::Point3D &pt, int16 latOrigin, int16 longOrigin,
+ int16 &latitude, int16 &longitude) {
+ Point3D scratch = pt;
+
+ // Translate globe center to origin.
+ scratch.x -= kGlobeCenter.x;
+ scratch.y -= kGlobeCenter.y;
+ scratch.z -= kGlobeCenter.z;
+
+ // Rotate around z axis latOrigin degrees to bring equator parallel with XZ plane
+ float theta = degreesToRadians(latOrigin);
+ float s = sin(theta);
+ float c = cos(theta);
+ float x = scratch.x * c - scratch.y * s;
+ float y = scratch.y * c + scratch.x * s;
+ scratch.x = x;
+ scratch.y = y;
+
+ // Calculate latitude
+ latitude = (int16)radiansToDegrees(asin(scratch.y / kGlobeRadius));
+
+ // Rotate around y axis longOrigin degrees to bring longitude 0 to positive X axis
+ theta = degreesToRadians(longOrigin);
+ s = sin(theta);
+ c = cos(theta);
+ x = scratch.x * c - scratch.z * s;
+ float z = scratch.z * c + scratch.x * s;
+ scratch.x = x;
+ scratch.z = z;
+
+ // Calculate longitude
+ longitude = (int16)radiansToDegrees(acos(scratch.x / sqrt(scratch.x * scratch.x + scratch.z * scratch.z)));
+
+ if (scratch.z < 0)
+ longitude = -longitude;
+}
+
+// h, v in [0, 511][0, 255]
+// Looking down negative x axis.
+void GlobeGame::screenPointTo3DPoint(int16 h, int16 v, GlobeGame::Point3D &pt) {
+ pt.x = kCameraLocation.x - kPicturePlaneDistance;
+ pt.y = kCameraLocation.y + (128 - v) * kPicturePlaneDistance * kTanFieldOfView / 256;
+ pt.z = kCameraLocation.z + (h - 256) * kPicturePlaneDistance * kTanFieldOfView / 256;
+}
+
+// Fundamentals of Three-Dimensional Graphics, by Alan Watt
+// pp. 163-164
+bool GlobeGame::lineHitsGlobe(const GlobeGame::Line3D &line, GlobeGame::Point3D &pt) {
+ float i = line.pt2.x - line.pt1.x;
+ float j = line.pt2.y - line.pt1.y;
+ float k = line.pt2.z - line.pt1.z;
+ float a = i * i + j * j + k * k;
+ float b = 2 * i * (line.pt1.x - kGlobeCenter.x) + 2 * j * (line.pt1.y - kGlobeCenter.y) +
+ 2 * k * (line.pt1.z - kGlobeCenter.z);
+ float c = kGlobeCenter.x * kGlobeCenter.x + kGlobeCenter.y * kGlobeCenter.y +
+ kGlobeCenter.z * kGlobeCenter.z + line.pt1.x * line.pt1.x + line.pt1.y * line.pt1.y +
+ line.pt1.z * line.pt1.z + -2 * (kGlobeCenter.x * line.pt1.x + kGlobeCenter.y * line.pt1.y +
+ kGlobeCenter.z * line.pt1.z) - kGlobeRadius * kGlobeRadius;
+
+ // Solve quadratic equation of a, b, c.
+ float t = b * b - 4 * a * c;
+
+ if (t >= 0.0f) {
+ // Return smaller root, which corresponds to closest intersection point.
+ t = (-b - sqrt(t)) / (2 * a);
+ pt.x = i * t + line.pt1.x;
+ pt.y = j * t + line.pt1.y;
+ pt.z = k * t + line.pt1.z;
+ return true;
+ }
+
+ return false;
+}
+
+bool GlobeGame::canSolve() {
+ return _gameState != kPlayerWon1 && _gameState != kPlayerWon2 && _gameState != kPlayerLost1;
+}
+
+void GlobeGame::doSolve() {
+ _owner->requestDelay(1, 2, kFilterNoInput, 0);
+ _upperNamesMovie.hide();
+ _lowerNamesMovie.hide();
+ _countdown.hide();
+ _monitorMovie.setSegment(kMaxDeactivatedStart * _monitorMovie.getScale(), kMaxDeactivatedStop * _monitorMovie.getScale());
+ _monitorMovie.setTime(kMaxDeactivatedStart * _monitorMovie.getScale());
+ _monitorCallBack.setCallBackFlag(kMaxDeactivatedFinished);
+ _monitorCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _monitorMovie.start();
+ _owner->requestSpotSound(kMaximumDeactivationIn, kMaximumDeactivationOut, kFilterNoInput, kSpotSoundCompletedFlag);
+ _gameState = kPlayerWon1;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.h b/engines/pegasus/neighborhood/norad/delta/globegame.h
new file mode 100644
index 0000000000..73ed48866f
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/delta/globegame.h
@@ -0,0 +1,169 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_DELTA_GLOBEGAME_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_DELTA_GLOBEGAME_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+
+namespace Pegasus {
+
+enum GlobeTrackDirection {
+ kTrackLeft,
+ kTrackRight,
+ kTrackUp,
+ kTrackDown
+};
+
+// This class assumes that the globe movie is built at 15 frames per second with a
+// time scale of 600, yielding 40 time unit per frame.
+
+class GlobeTracker : public Tracker {
+public:
+ GlobeTracker(Movie *, Picture *, Picture *, Picture *, Picture *);
+ virtual ~GlobeTracker() {}
+
+ void setTrackParameters(const Hotspot *, GlobeTrackDirection);
+ void continueTracking(const Input &);
+ void startTracking(const Input &);
+ void stopTracking(const Input &);
+ void activateHotspots();
+ bool stopTrackingInput(const Input &);
+
+protected:
+ void trackGlobeMovie();
+ void stopGlobeMovie();
+
+ Movie *_globeMovie;
+ Picture *_leftHighlight;
+ Picture *_rightHighlight;
+ Picture *_upHighlight;
+ Picture *_downHighlight;
+ const Hotspot *_trackSpot;
+ int _trackTime;
+ GlobeTrackDirection _trackDirection;
+};
+
+class GlobeCountdown : public IdlerAnimation {
+public:
+ GlobeCountdown(const DisplayElementID);
+ virtual ~GlobeCountdown() {}
+
+ void setCountdownTime(const int);
+ void startCountdown();
+ void stopCountdown();
+
+ void setDisplayOrder(const DisplayOrder);
+ void show();
+ void hide();
+ void moveElementTo(const CoordType, const CoordType);
+
+ void draw(const Common::Rect &);
+
+protected:
+ Surface _digits;
+ int16 _digitOffset;
+};
+
+static const int16 kNumAllSilos = 40;
+static const int16 kNumTargetSilos = 10;
+static const int16 kNumLongSlices = 72;
+
+class GlobeGame : public GameInteraction, public NotificationReceiver {
+public:
+ GlobeGame(Neighborhood *);
+ virtual ~GlobeGame() {}
+
+ void handleInput(const Input &, const Hotspot *);
+ void clickInHotspot(const Input &, const Hotspot *);
+ void activateHotspots();
+
+ bool canSolve();
+ void doSolve();
+
+ struct Point3D {
+ float x, y, z;
+ };
+
+ struct Line3D {
+ Point3D pt1, pt2;
+ };
+
+protected:
+ // Latitude (-90 - 90) and longitude (-180 - 180)
+ static const int16 _siloCoords[kNumAllSilos][2];
+
+ static const int16 _targetSilo[kNumTargetSilos];
+ static const int16 _timeLimit[kNumTargetSilos];
+ static const TimeValue _siloName[kNumTargetSilos][2];
+
+ void openInteraction();
+ void initInteraction();
+ void closeInteraction();
+
+ void receiveNotification(Notification *, const NotificationFlags);
+
+ void spinGlobe(const Input &, const Hotspot *, GlobeTrackDirection);
+ void clickGlobe(const Input &);
+
+ int16 findClickedSilo(const Input &);
+
+ void globeMovieFrameToOrigin(int16, int16 &, int16 &);
+ void globePointToLatLong(const Point3D &, int16, int16, int16 &, int16 &);
+ void screenPointTo3DPoint(int16, int16, Point3D &);
+ bool lineHitsGlobe(const Line3D &, Point3D &);
+
+ Movie _monitorMovie;
+ Movie _globeMovie;
+ Movie _upperNamesMovie;
+ Movie _lowerNamesMovie;
+ Notification _globeNotification;
+ NotificationCallBack _monitorCallBack;
+ GlobeTracker _globeTracker;
+ Picture _globeCircleLeft;
+ Picture _globeCircleRight;
+ Picture _globeCircleUp;
+ Picture _globeCircleDown;
+ Picture _motionHighlightLeft;
+ Picture _motionHighlightRight;
+ Picture _motionHighlightUp;
+ Picture _motionHighlightDown;
+ Picture _targetHighlightUpperLeft;
+ Picture _targetHighlightUpperRight;
+ Picture _targetHighlightLowerLeft;
+ Picture _targetHighlightLowerRight;
+ GlobeCountdown _countdown;
+ NotificationCallBack _countdownCallBack;
+ int16 _gameState;
+ int16 _currentSiloIndex;
+ Notification *_neighborhoodNotification;
+ bool _playedInstructions;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp
new file mode 100644
index 0000000000..f2ea53ff89
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp
@@ -0,0 +1,869 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/interface.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/items/biochips/retscanchip.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/subcontrolroom.h"
+#include "pegasus/neighborhood/norad/delta/globegame.h"
+#include "pegasus/neighborhood/norad/delta/noraddelta.h"
+
+namespace Pegasus {
+
+const uint32 NoradDelta::_noradDeltaClawExtras[22] = {
+ kN60ClawFromAToB,
+ kN60ClawALoop,
+ kN60ClawAPinch,
+ kN60ClawACounterclockwise,
+ kN60ClawAClockwise,
+ kN60ClawFromBToA,
+ kN60ClawFromBToC,
+ kN60ClawFromBToD,
+ kN60ClawBLoop,
+ kN60ClawBPinch,
+ kN60ClawBCounterclockwise,
+ kN60ClawBClockwise,
+ kN60ClawFromCToB,
+ kN60ClawCLoop,
+ kN60ClawCPinch,
+ kN60ClawCCounterclockwise,
+ kN60ClawCClockwise,
+ kN60ClawFromDToB,
+ kN60ClawDLoop,
+ kN60ClawDPinch,
+ kN60ClawDCounterclockwise,
+ kN60ClawDClockwise
+};
+
+NoradDelta::NoradDelta(InputHandler *nextHandler, PegasusEngine *owner) : Norad(nextHandler, owner, "Norad Delta", kNoradDeltaID) {
+ _elevatorUpRoomID = kNorad49South;
+ _elevatorDownRoomID = kNorad48South;
+ _elevatorUpSpotID = kNorad48ElevatorUpSpotID;
+ _elevatorDownSpotID = kNorad49ElevatorDownSpotID;
+
+ // Pressure door stuff.
+
+ _subRoomEntryRoom1 = kNorad50;
+ _subRoomEntryDir1 = kEast;
+ _subRoomEntryRoom2 = kNorad59;
+ _subRoomEntryDir2 = kWest;
+ _upperPressureDoorRoom = kNorad50East;
+ _lowerPressureDoorRoom = kNorad59West;
+
+ _upperPressureDoorUpSpotID = kDeltaUpperPressureDoorUpSpotID;
+ _upperPressureDoorDownSpotID = kDeltaUpperPressureDoorDownSpotID;
+ _upperPressureDoorAbortSpotID = kNorad50DoorOutSpotID;
+
+ _lowerPressureDoorUpSpotID = kDeltaLowerPressureDoorUpSpotID;
+ _lowerPressureDoorDownSpotID = kDeltaLowerPressureDoorDownSpotID;
+ _lowerPressureDoorAbortSpotID = kNorad59WestOutSpotID;
+
+ _pressureSoundIn = kPressureDoorIntro1In;
+ _pressureSoundOut = kPressureDoorIntro1Out;
+ _equalizeSoundIn = kPressureDoorIntro2In;
+ _equalizeSoundOut = kPressureDoorIntro2Out;
+ _accessDeniedIn = kDeltaAccessDeniedIn;
+ _accessDeniedOut = kDeltaAccessDeniedOut;
+
+ GameState.setNoradSubPrepState(kSubDamaged);
+
+ _subControlRoom = kNorad60West;
+}
+
+void NoradDelta::init() {
+ Norad::init();
+
+ // Little fix for the retinal scan zoom in spot...
+ Hotspot *hotspot = _vm->getAllHotspots().findHotspotByID(kNorad68WestSpotID);
+ hotspot->setMaskedHotspotFlags(kZoomInSpotFlag, kZoomInSpotFlag | kZoomOutSpotFlag);
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kNorad79WestSpotID);
+ hotspot->setMaskedHotspotFlags(kZoomInSpotFlag, kZoomInSpotFlag | kZoomOutSpotFlag);
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kDelta59RobotShieldBiochipSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpBiochipSpotFlag, kPickUpBiochipSpotFlag);
+ HotspotInfoTable::Entry *hotspotEntry = findHotspotEntry(kDelta59RobotShieldBiochipSpotID);
+ hotspotEntry->hotspotItem = kShieldBiochip;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kDelta59RobotOpMemBiochipSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpBiochipSpotFlag, kPickUpBiochipSpotFlag);
+ hotspotEntry = findHotspotEntry(kDelta59RobotOpMemBiochipSpotID);
+ hotspotEntry->hotspotItem = kOpticalBiochip;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kDelta59RobotRetinalBiochipSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpBiochipSpotFlag, kPickUpBiochipSpotFlag);
+ hotspotEntry = findHotspotEntry(kDelta59RobotRetinalBiochipSpotID);
+ hotspotEntry->hotspotItem = kRetinalScanBiochip;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kDelta60RobotShieldBiochipSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpBiochipSpotFlag, kPickUpBiochipSpotFlag);
+ hotspotEntry = findHotspotEntry(kDelta60RobotShieldBiochipSpotID);
+ hotspotEntry->hotspotItem = kShieldBiochip;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kDelta60RobotOpMemBiochipSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpBiochipSpotFlag, kPickUpBiochipSpotFlag);
+ hotspotEntry = findHotspotEntry(kDelta60RobotOpMemBiochipSpotID);
+ hotspotEntry->hotspotItem = kOpticalBiochip;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kDelta60RobotRetinalBiochipSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpBiochipSpotFlag, kPickUpBiochipSpotFlag);
+ hotspotEntry = findHotspotEntry(kDelta60RobotRetinalBiochipSpotID);
+ hotspotEntry->hotspotItem = kRetinalScanBiochip;
+}
+
+void NoradDelta::start() {
+ if (g_energyMonitor) {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+ }
+
+ Norad::start();
+}
+
+void NoradDelta::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ if (g_AIArea) {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Norad/XN07NE", false);
+ AILocationCondition *locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kNorad68, kWest));
+ AIRule *rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+ }
+}
+
+void NoradDelta::getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove) {
+ switch (entry.extra) {
+ case kArriveFromSubChase:
+ compassMove.makeTwoKnotFaderSpec(kNoradDeltaMovieScale, entry.movieStart, 20, entry.movieEnd, 90);
+ compassMove.insertFaderKnot(entry.movieStart + 25 * kNoradDeltaFrameDuration, 20);
+ compassMove.insertFaderKnot(entry.movieStart + 94 * kNoradDeltaFrameDuration, 45);
+ compassMove.insertFaderKnot(entry.movieStart + 101 * kNoradDeltaFrameDuration, 45);
+ compassMove.insertFaderKnot(entry.movieStart + 146 * kNoradDeltaFrameDuration, 90 + 15);
+ compassMove.insertFaderKnot(entry.movieStart + 189 * kNoradDeltaFrameDuration, 90 + 15);
+ compassMove.insertFaderKnot(entry.movieStart + 204 * kNoradDeltaFrameDuration, 90 + 30);
+ compassMove.insertFaderKnot(entry.movieStart + 214 * kNoradDeltaFrameDuration, 90 + 20);
+ compassMove.insertFaderKnot(entry.movieStart + 222 * kNoradDeltaFrameDuration, 90 + 20);
+ compassMove.insertFaderKnot(entry.movieStart + 228 * kNoradDeltaFrameDuration, 90 + 10);
+ compassMove.insertFaderKnot(entry.movieStart + 245 * kNoradDeltaFrameDuration, 90 + 85);
+ compassMove.insertFaderKnot(entry.movieStart + 262 * kNoradDeltaFrameDuration, 90 + 70);
+ compassMove.insertFaderKnot(entry.movieStart + 273 * kNoradDeltaFrameDuration, 90 + 80);
+ compassMove.insertFaderKnot(entry.movieStart + 287 * kNoradDeltaFrameDuration, 90);
+ break;
+ case kN60PlayerFollowsRobotToDoor:
+ compassMove.makeTwoKnotFaderSpec(kNoradDeltaMovieScale, entry.movieStart, 270 + kSubControlCompassAngle,
+ entry.movieEnd, 270 - 15);
+ compassMove.insertFaderKnot(entry.movieStart + 280, 270 + kSubControlCompassAngle);
+ compassMove.insertFaderKnot(entry.movieStart + 920, 360);
+ compassMove.insertFaderKnot(entry.movieStart + 1840, 360);
+ compassMove.insertFaderKnot(entry.movieStart + 2520, 270);
+ compassMove.insertFaderKnot(entry.movieStart + 3760, 270);
+ compassMove.insertFaderKnot(entry.movieStart + 4640, 270 + kSubControlCompassAngle);
+ break;
+ case kN59PlayerWins2:
+ compassMove.makeTwoKnotFaderSpec(kNoradDeltaMovieScale, entry.movieStart, 270, entry.movieEnd, 280);
+ compassMove.insertFaderKnot(entry.movieEnd - 1000, 270);
+ default:
+ Norad::getExtraCompassMove(entry, compassMove);
+ break;
+ }
+}
+
+GameInteraction *NoradDelta::makeInteraction(const InteractionID interactionID) {
+ if (interactionID == kNoradGlobeGameInteractionID)
+ return new GlobeGame(this);
+
+ return Norad::makeInteraction(interactionID);
+}
+
+void NoradDelta::playClawMonitorIntro() {
+ playSpotSoundSync(kLoadClawIntroIn, kLoadClawIntroOut);
+}
+
+void NoradDelta::getExitEntry(const RoomID room, const DirectionConstant direction, ExitTable::Entry &entry) {
+ Norad::getExitEntry(room, direction, entry);
+
+ if (room == kNorad61 && direction == kSouth)
+ entry.movieStart += kNoradDeltaFrameDuration;
+}
+
+void NoradDelta::getZoomEntry(const HotSpotID id, ZoomTable::Entry &zoomEntry) {
+ Norad::getZoomEntry(id, zoomEntry);
+
+ if (id == kNorad59WestSpotID && GameState.getNoradPlayedGlobeGame()) {
+ ExtraTable::Entry extraEntry;
+ getExtraEntry(kN59ZoomWithRobot, extraEntry);
+ zoomEntry.movieStart = extraEntry.movieStart;
+ zoomEntry.movieEnd = extraEntry.movieEnd;
+ }
+}
+
+void NoradDelta::loadAmbientLoops() {
+/*
+ Logic:
+
+ loop sound 1:
+ if room == kNorad79West
+ if player globe game
+ play kNoradGlobeLoop2SoundNum
+ else
+ play kNoradRedAlertLoopSoundNum
+ else if room >= kNorad78 && room <= kNorad79
+ play kNoradGlobeLoop2SoundNum
+ else if gassed,
+ if room >= kNorad41 && room <= kNorad49South
+ play kNoradNewSubLoopSoundNum, kNoradWarningVolume
+ else if room >= kNorad59 && room <= kNorad60West
+ play kNoradSubControlLoopSoundNum, kNoradWarningVolume
+ else
+ play kNoradWarningLoopSoundNum, kNoradWarningVolume
+ else
+ play nothing
+ loop sound 2:
+ if gassed and not wearing air mask
+ if room == kNorad54North
+ play breathing unmanned loop
+ else
+ play breathing
+ else
+ if room == kNorad54North
+ play unmanned loop
+ else
+ play nothing
+*/
+
+ if (GameState.getNoradArrivedFromSub()) {
+ RoomID room = GameState.getCurrentRoom();
+
+ if (room == kNorad79West) {
+ if (_privateFlags.getFlag(kNoradPrivateFinishedGlobeGameFlag))
+ loadLoopSound1("Sounds/Norad/GlobAmb2.22K.AIFF");
+ else
+ loadLoopSound1("Sounds/Norad/RedAlert.22K.AIFF");
+ } else if (room >= kNorad78 && room <= kNorad79) {
+ // clone2727 says: This looks like it should be loadLoopSound1...
+ loadLoopSound2("Sounds/Norad/RedAlert.22K.AIFF");
+ } else if (GameState.getNoradGassed()) {
+ if (room >= kNorad41 && room <= kNorad49South)
+ loadLoopSound1("Sounds/Norad/NEW SUB AMB.22K.AIFF", kNoradWarningVolume * 3);
+ else if (room >= kNorad59 && room <= kNorad60West)
+ loadLoopSound1("Sounds/Norad/SUB CONTRL LOOP.22K.AIFF", kNoradWarningVolume * 3);
+ else
+ loadLoopSound1("Sounds/Norad/WARNING LOOP.22K.AIFF", kNoradWarningVolume);
+ } else {
+ loadLoopSound1("");
+ }
+
+ if (GameState.getNoradGassed() && !g_airMask->isAirFilterOn()) {
+ if (room == kNorad54North)
+ loadLoopSound2("Sounds/Norad/Breathing Typing.22K.AIFF", 0x100 / 2);
+ else
+ loadLoopSound2("Sounds/Norad/SUCKING WIND.22K.AIFF", kNoradSuckWindVolume, 0, 0);
+ } else {
+ if (room == kNorad54North)
+ loadLoopSound2("Sounds/Norad/N54NAS.22K.AIFF", 0x100 / 2);
+ else
+ loadLoopSound2("");
+ }
+ } else {
+ // Start them off at zero...
+ if (GameState.getNoradGassed())
+ loadLoopSound1("Sounds/Norad/NEW SUB AMB.22K.AIFF", 0, 0, 0);
+ if (!g_airMask->isAirFilterOn())
+ loadLoopSound2("Sounds/Norad/SUCKING WIND.22K.AIFF", 0, 0, 0);
+ }
+}
+
+void NoradDelta::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kNorad41, kEast):
+ case MakeRoomView(kNorad49, kEast):
+ case MakeRoomView(kNorad49, kWest):
+ case MakeRoomView(kNorad61, kSouth):
+ case MakeRoomView(kNorad68, kEast):
+ case MakeRoomView(kNorad79, kWest):
+ makeContinuePoint();
+ break;
+ }
+}
+
+void NoradDelta::arriveAt(const RoomID room, const DirectionConstant direction) {
+ if (room != kNorad68)
+ GameState.setNoradRetScanGood(false);
+
+ Norad::arriveAt(room, direction);
+
+ FaderMoveSpec loop1Spec, loop2Spec;
+ ExtraTable::Entry entry;
+
+ switch (room) {
+ case kNorad41:
+ if (direction == kEast && !GameState.getNoradArrivedFromSub()) {
+ GameState.setNoradPlayedGlobeGame(false);
+
+ GameState.setNoradBeatRobotWithClaw(false);
+ GameState.setNoradBeatRobotWithDoor(false);
+ GameState.setNoradRetScanGood(false);
+
+ GameState.setScoringExitedSub(true);
+
+ getExtraEntry(kArriveFromSubChase, entry);
+
+ loop1Spec.makeTwoKnotFaderSpec(kNoradDeltaMovieScale, 0, 0, entry.movieEnd -
+ entry.movieStart, kNoradWarningVolume);
+ loop1Spec.insertFaderKnot(7320, 0);
+ loop1Spec.insertFaderKnot(7880, kNoradWarningVolume);
+
+ loop2Spec.makeTwoKnotFaderSpec(kNoradDeltaMovieScale, 0, 0, entry.movieEnd -
+ entry.movieStart, kNoradSuckWindVolume);
+ loop1Spec.insertFaderKnot(7320, 0);
+ loop1Spec.insertFaderKnot(7880, kNoradSuckWindVolume);
+
+ startExtraSequence(kArriveFromSubChase, kExtraCompletedFlag, kFilterNoInput);
+
+ startLoop1Fader(loop1Spec);
+ startLoop2Fader(loop2Spec);
+ }
+ break;
+ case kNorad54North:
+ GameState.setScoringSawRobotAt54North(true);
+ break;
+ case kNorad68:
+ if (GameState.getNoradRetScanGood())
+ openDoor();
+ break;
+ case kNorad68West:
+ arriveAtNorad68West();
+ break;
+ case kNorad79West:
+ arriveAtNorad79West();
+ break;
+ default:
+ break;
+ }
+}
+
+void NoradDelta::doorOpened() {
+ Norad::doorOpened();
+ GameState.setNoradRetScanGood(false);
+}
+
+void NoradDelta::arriveAtNorad68West() {
+ playSpotSoundSync(kHoldForRetinalIn, kHoldForRetinalOut);
+
+ BiochipItem *retScan = _vm->getCurrentBiochip();
+
+ if (retScan != 0 && retScan->getObjectID() == kRetinalScanBiochip) {
+ ((RetScanChip *)retScan)->searchForLaser();
+ succeedRetinalScan();
+ } else {
+ failRetinalScan();
+ }
+}
+
+void NoradDelta::arriveAtNorad79West() {
+ if (!GameState.getNoradPlayedGlobeGame())
+ newInteraction(kNoradGlobeGameInteractionID);
+}
+
+void NoradDelta::bumpIntoWall() {
+ requestSpotSound(kDeltaBumpIntoWallIn, kDeltaBumpIntoWallOut, kFilterNoInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+void NoradDelta::failRetinalScan() {
+ startExtraSequence(kNoradDeltaRetinalScanBad, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void NoradDelta::succeedRetinalScan() {
+ startExtraSequence(kNoradDeltaRetinalScanGood, kExtraCompletedFlag, kFilterNoInput);
+ GameState.setNoradRetScanGood(true);
+ GameState.setScoringUsedRetinalChip(true);
+}
+
+void NoradDelta::getDoorEntry(const RoomID room, const DirectionConstant direction, DoorTable::Entry &entry) {
+ Norad::getDoorEntry(room, direction, entry);
+
+ if (room == kNorad68 && direction == kWest && !GameState.getNoradRetScanGood())
+ entry.flags = kDoorPresentMask | kDoorLockedMask;
+}
+
+void NoradDelta::finishedGlobeGame() {
+ GameState.setNoradPlayedGlobeGame(true);
+ _privateFlags.setFlag(kNoradPrivateFinishedGlobeGameFlag, true);
+ GameState.setScoringFinishedGlobeGame(true);
+ loadAmbientLoops();
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Norad/XN60WD1", false, kWarningInterruption);
+}
+
+bool NoradDelta::playingAgainstRobot() {
+ return GameState.getNoradPlayedGlobeGame();
+}
+
+void NoradDelta::getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID, HotSpotID &clawControlSpotID, HotSpotID &pinchClawSpotID,
+ HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID, HotSpotID &moveClawLeftSpotID, HotSpotID &moveClawUpSpotID,
+ HotSpotID &clawCCWSpotID, HotSpotID &clawCWSpotID, uint32 &clawPosition, const uint32 *&clawExtraIDs) {
+ outSpotID = kNorad60MonitorOutSpotID;
+ prepSpotID = kNorad60LaunchPrepSpotID;
+ clawControlSpotID = kNorad60ClawControlSpotID;
+ pinchClawSpotID = kNorad60ClawPinchSpotID;
+ moveClawDownSpotID = kNorad60ClawDownSpotID;
+ moveClawRightSpotID = kNorad60ClawRightSpotID;
+ moveClawLeftSpotID = kNorad60ClawLeftSpotID;
+ moveClawUpSpotID = kNorad60ClawUpSpotID;
+ clawCCWSpotID = kNorad60ClawCCWSpotID;
+ clawCWSpotID = kNorad60ClawCWSpotID;
+ clawPosition = kClawAtC;
+ clawExtraIDs = _noradDeltaClawExtras;
+}
+
+void NoradDelta::playerBeatRobotWithDoor() {
+ GameState.setNoradBeatRobotWithDoor(true);
+ updateViewFrame();
+ GameState.setScoringStoppedNoradRobot(true);
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Norad/XN59WD", false, kWarningInterruption);
+}
+
+void NoradDelta::playerBeatRobotWithClaw() {
+ GameState.setNoradBeatRobotWithClaw(true);
+ updateViewFrame();
+ GameState.setScoringStoppedNoradRobot(true);
+ GameState.setScoringNoradGandhi(true);
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Norad/XN59WD", false, kWarningInterruption);
+}
+
+TimeValue NoradDelta::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraTable::Entry entry;
+
+ if (room == kNorad41 && direction == kSouth && !GameState.getNoradArrivedFromSub()) {
+ getExtraEntry(kArriveFromSubChase, entry);
+ return entry.movieStart;
+ }
+
+ if (GameState.getNoradBeatRobotWithDoor()) {
+ if (_privateFlags.getFlag(kNoradPrivateRobotHeadOpenFlag)) {
+ uint32 extraID = kN59Biochips111;
+ if (_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag))
+ extraID += 1;
+ if (_privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag))
+ extraID += 2;
+ if (_privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag))
+ extraID += 4;
+ getExtraEntry(extraID, entry);
+ return entry.movieStart;
+ }
+
+ getExtraEntry(kN59RobotHeadOpens, entry);
+ return entry.movieStart;
+ } else if (GameState.getNoradBeatRobotWithClaw()) {
+ if (_privateFlags.getFlag(kNoradPrivateRobotHeadOpenFlag)) {
+ uint32 extraID = kN60Biochips111;
+ if (_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag))
+ extraID += 1;
+ if (_privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag))
+ extraID += 2;
+ if (_privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag))
+ extraID += 4;
+ getExtraEntry(extraID, entry);
+ return entry.movieStart;
+ }
+
+ getExtraEntry(kN60RobotHeadOpens, entry);
+ return entry.movieStart;
+ }
+
+ return Norad::getViewTime(room, direction);
+}
+
+void NoradDelta::openDoor() {
+ if (GameState.getCurrentRoom() == kNorad59 && GameState.getCurrentDirection() == kWest && GameState.getNoradPlayedGlobeGame()) {
+ Input scratch;
+ InputHandler::_inputHandler->clickInHotspot(scratch, _vm->getAllHotspots().findHotspotByID(kNorad59WestSpotID));
+ } else {
+ Norad::openDoor();
+ }
+}
+
+void NoradDelta::activateHotspots() {
+ Norad::activateHotspots();
+
+ if (GameState.getCurrentRoom() == kNorad59West && GameState.getCurrentDirection() == kWest && GameState.getNoradBeatRobotWithDoor()) {
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad59WestOutSpotID);
+
+ if (_privateFlags.getFlag(kNoradPrivateRobotHeadOpenFlag)) {
+ if (!_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag))
+ _vm->getAllHotspots().activateOneHotspot(kDelta59RobotShieldBiochipSpotID);
+ else
+ _vm->getAllHotspots().deactivateOneHotspot(kDelta59RobotShieldBiochipSpotID);
+
+ if (!_privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag))
+ _vm->getAllHotspots().activateOneHotspot(kDelta59RobotOpMemBiochipSpotID);
+ else
+ _vm->getAllHotspots().deactivateOneHotspot(kDelta59RobotOpMemBiochipSpotID);
+
+ if (!_privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag))
+ _vm->getAllHotspots().activateOneHotspot(kDelta59RobotRetinalBiochipSpotID);
+ else
+ _vm->getAllHotspots().deactivateOneHotspot(kDelta59RobotRetinalBiochipSpotID);
+ } else
+ _vm->getAllHotspots().activateOneHotspot(kDelta59RobotHeadSpotID);
+ } else if (GameState.getCurrentRoom() == kNorad60West && GameState.getCurrentDirection() == kWest &&
+ GameState.getNoradBeatRobotWithClaw()) {
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad60MonitorOutSpotID);
+
+ if (_privateFlags.getFlag(kNoradPrivateRobotHeadOpenFlag)) {
+ if (!_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag))
+ _vm->getAllHotspots().activateOneHotspot(kDelta60RobotShieldBiochipSpotID);
+ else
+ _vm->getAllHotspots().deactivateOneHotspot(kDelta60RobotShieldBiochipSpotID);
+
+ if (!_privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag))
+ _vm->getAllHotspots().activateOneHotspot(kDelta60RobotOpMemBiochipSpotID);
+ else
+ _vm->getAllHotspots().deactivateOneHotspot(kDelta60RobotOpMemBiochipSpotID);
+
+ if (!_privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag))
+ _vm->getAllHotspots().activateOneHotspot(kDelta60RobotRetinalBiochipSpotID);
+ else
+ _vm->getAllHotspots().deactivateOneHotspot(kDelta60RobotRetinalBiochipSpotID);
+ } else {
+ _vm->getAllHotspots().activateOneHotspot(kDelta60RobotHeadSpotID);
+ }
+ } else if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad50, kEast)) {
+ if (GameState.isCurrentDoorOpen())
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad50DoorSpotID);
+ } else if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad59, kWest)) {
+ if (GameState.isCurrentDoorOpen())
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad59WestSpotID);
+ }
+}
+
+void NoradDelta::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ switch (clickedSpot->getObjectID()) {
+ case kDelta59RobotHeadSpotID:
+ startExtraSequence(kN59RobotHeadOpens, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kDelta60RobotHeadSpotID:
+ startExtraSequence(kN60RobotHeadOpens, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ Norad::clickInHotspot(input, clickedSpot);
+ break;
+ }
+}
+
+void NoradDelta::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ Norad::receiveNotification(notification, flags);
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ RetScanChip *retScan;
+ Input dummy;
+
+ switch (_lastExtra) {
+ case kArriveFromSubChase:
+ GameState.setNoradArrivedFromSub(true);
+ GameState.setCurrentRoom(kNoRoomID);
+ GameState.setCurrentDirection(kNoDirection);
+ arriveAt(kNorad41, kEast);
+ break;
+ case kN59RobotHeadOpens:
+ case kN60RobotHeadOpens:
+ _privateFlags.setFlag(kNoradPrivateRobotHeadOpenFlag, true);
+ break;
+ case kNoradDeltaRetinalScanBad:
+ retScan = (RetScanChip *)_vm->getCurrentBiochip();
+ retScan->setItemState(kNormalItem);
+ playSpotSoundSync(kRetinalScanFailedIn, kRetinalScanFailedOut);
+ downButton(dummy);
+ break;
+ case kNoradDeltaRetinalScanGood:
+ retScan = (RetScanChip *)_vm->getCurrentBiochip();
+ retScan->setItemState(kNormalItem);
+ downButton(dummy);
+ break;
+ case kN59RobotDisappears:
+ case kN60RobotDisappears:
+ recallToTSASuccess();
+ break;
+ }
+
+ _interruptionFilter = kFilterAllInput;
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+void NoradDelta::pickedUpItem(Item *item) {
+ switch (item->getObjectID()) {
+ case kShieldBiochip:
+ if (_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag) &&
+ _privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag) &&
+ _privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag)) {
+ GameState.setNoradFinished(true);
+
+ if (GameState.getCurrentRoom() == kNorad59West)
+ startExtraSequence(kN59RobotDisappears, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kN60RobotDisappears, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kRetinalScanBiochip:
+ if (_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag) &&
+ _privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag) &&
+ _privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag)) {
+ GameState.setNoradFinished(true);
+
+ if (GameState.getCurrentRoom() == kNorad59West)
+ startExtraSequence(kN59RobotDisappears, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kN60RobotDisappears, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kOpticalBiochip:
+ g_opticalChip->addPoseidon();
+ GameState.setScoringGotNoradOpMemChip();
+
+ if (_privateFlags.getFlag(kNoradPrivateGotShieldChipFlag) &&
+ _privateFlags.getFlag(kNoradPrivateGotRetScanChipFlag) &&
+ _privateFlags.getFlag(kNoradPrivateGotOpticalChipFlag)) {
+ GameState.setNoradFinished(true);
+
+ if (GameState.getCurrentRoom() == kNorad59West)
+ startExtraSequence(kN59RobotDisappears, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kN60RobotDisappears, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ }
+
+ Norad::pickedUpItem(item);
+}
+
+void NoradDelta::takeItemFromRoom(Item *item) {
+ switch (item->getObjectID()) {
+ case kShieldBiochip:
+ _privateFlags.setFlag(kNoradPrivateGotShieldChipFlag, true);
+ break;
+ case kRetinalScanBiochip:
+ _privateFlags.setFlag(kNoradPrivateGotRetScanChipFlag, true);
+ break;
+ case kOpticalBiochip:
+ _privateFlags.setFlag(kNoradPrivateGotOpticalChipFlag, true);
+ break;
+ }
+
+ Norad::takeItemFromRoom(item);
+}
+
+void NoradDelta::dropItemIntoRoom(Item *item, Hotspot *hotspot) {
+ switch (item->getObjectID()) {
+ case kShieldBiochip:
+ _privateFlags.setFlag(kNoradPrivateGotShieldChipFlag, false);
+ break;
+ case kOpticalBiochip:
+ _privateFlags.setFlag(kNoradPrivateGotOpticalChipFlag, false);
+ break;
+ case kRetinalScanBiochip:
+ _privateFlags.setFlag(kNoradPrivateGotRetScanChipFlag, false);
+ break;
+ }
+
+ Norad::dropItemIntoRoom(item, hotspot);
+}
+
+Hotspot *NoradDelta::getItemScreenSpot(Item *item, DisplayElement *element) {
+ HotSpotID id = kNoHotSpotID;
+
+ switch (item->getObjectID()) {
+ case kShieldBiochip:
+ if (GameState.getNoradBeatRobotWithDoor())
+ id = kDelta59RobotShieldBiochipSpotID;
+ else
+ id = kDelta60RobotShieldBiochipSpotID;
+ break;
+ case kOpticalBiochip:
+ if (GameState.getNoradBeatRobotWithDoor())
+ id = kDelta59RobotOpMemBiochipSpotID;
+ else
+ id = kDelta60RobotOpMemBiochipSpotID;
+ break;
+ case kRetinalScanBiochip:
+ if (GameState.getNoradBeatRobotWithDoor())
+ id = kDelta59RobotRetinalBiochipSpotID;
+ else
+ id = kDelta60RobotRetinalBiochipSpotID;
+ break;
+ }
+
+ if (id != kNoHotSpotID)
+ return _vm->getAllHotspots().findHotspotByID(id);
+
+ return Norad::getItemScreenSpot(item, element);
+}
+
+Common::String NoradDelta::getEnvScanMovie() {
+ return "Images/AI/Norad/XNE2";
+}
+
+uint NoradDelta::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad60, kWest):
+ if (GameState.getNoradPlayedGlobeGame())
+ numHints = 2;
+ else
+ numHints = 1;
+ break;
+ case MakeRoomView(kNorad59, kNorth):
+ case MakeRoomView(kNorad59, kSouth):
+ case MakeRoomView(kNorad59, kEast):
+ case MakeRoomView(kNorad59, kWest):
+ case MakeRoomView(kNorad60, kNorth):
+ case MakeRoomView(kNorad60, kSouth):
+ case MakeRoomView(kNorad60, kEast):
+ if (GameState.getNoradPlayedGlobeGame())
+ numHints = 2;
+ break;
+ case MakeRoomView(kNorad68, kWest):
+ if (_vm->playerHasItemID(kRetinalScanBiochip)) {
+ BiochipItem *retScan = _vm->getCurrentBiochip();
+ if (retScan == 0 || retScan->getObjectID() != kRetinalScanBiochip)
+ numHints = 2;
+ } else if (!GameState.isCurrentDoorOpen()) {
+ numHints = 2;
+ }
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String NoradDelta::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty()) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad60, kWest):
+ if (GameState.getNoradPlayedGlobeGame()) {
+ if (hintNum == 1)
+ return "Images/AI/Norad/XN60WD2";
+
+ return "Images/AI/Norad/XN60WD3";
+ }
+
+ return "Images/AI/Globals/XGLOB1C";
+ case MakeRoomView(kNorad59, kNorth):
+ case MakeRoomView(kNorad59, kSouth):
+ case MakeRoomView(kNorad59, kEast):
+ case MakeRoomView(kNorad59, kWest):
+ case MakeRoomView(kNorad60, kNorth):
+ case MakeRoomView(kNorad60, kSouth):
+ case MakeRoomView(kNorad60, kEast):
+ if (hintNum == 1)
+ return "Images/AI/Norad/XN60WD2";
+
+ return "Images/AI/Norad/XN60WD3";
+ case MakeRoomView(kNorad68, kWest):
+ if (_vm->playerHasItemID(kRetinalScanBiochip)) {
+ if (hintNum == 1)
+ return "Images/AI/Globals/XGLOB1A";
+
+ return "Images/AI/Globals/XGLOB1C";
+ }
+
+ if (hintNum == 1)
+ return "Images/AI/Globals/XGLOB1B";
+
+ return "Images/AI/Globals/XGLOB3B";
+ }
+ }
+
+ return movieName;
+}
+
+void NoradDelta::closeDoorOffScreen(const RoomID room, const DirectionConstant) {
+ switch (room) {
+ case kNorad47:
+ case kNorad48:
+ case kNorad41:
+ case kNorad42:
+ playSpotSoundSync(kDeltaElevatorDoorCloseIn, kDeltaElevatorDoorCloseOut);
+ break;
+ default:
+ playSpotSoundSync(kDeltaRegDoorCloseIn, kDeltaRegDoorCloseOut);
+ break;
+ }
+}
+
+bool NoradDelta::canSolve() {
+ if (Norad::canSolve())
+ return true;
+
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad68, kWest)) {
+ BiochipItem *biochip = _vm->getCurrentBiochip();
+ if (biochip != 0 && biochip->getObjectID() != kRetinalScanBiochip)
+ return true;
+ }
+
+ return false;
+}
+
+void NoradDelta::doSolve() {
+ Norad::doSolve();
+
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad68, kWest)) {
+ if (!_vm->playerHasItemID(kRetinalScanBiochip))
+ _vm->addItemToBiochips((BiochipItem *)_vm->getAllItems().findItemByID(kRetinalScanBiochip));
+
+ BiochipItem *biochip = _vm->getCurrentBiochip();
+ if (biochip != 0 && biochip->getObjectID() != kRetinalScanBiochip && g_interface)
+ g_interface->setCurrentBiochipID(kRetinalScanBiochip);
+
+ Hotspot *spot = _vm->getAllHotspots().findHotspotByID(kNorad68WestSpotID);
+ Input scratch;
+ InputHandler::_inputHandler->clickInHotspot(scratch, spot);
+ }
+}
+
+Common::String NoradDelta::getSoundSpotsName() {
+ return "Sounds/Norad/Norad Delta Spots";
+}
+
+Common::String NoradDelta::getNavMovieName() {
+ return "Images/Norad Delta/Norad Delta.movie";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.h b/engines/pegasus/neighborhood/norad/delta/noraddelta.h
new file mode 100644
index 0000000000..11065f2c9d
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.h
@@ -0,0 +1,117 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_DELTA_NORADDELTA_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_DELTA_NORADDELTA_H
+
+#include "pegasus/neighborhood/norad/norad.h"
+
+namespace Pegasus {
+
+class NoradDelta : public Norad {
+public:
+ NoradDelta(InputHandler *, PegasusEngine *);
+ virtual ~NoradDelta() {}
+
+ void init();
+
+ void start();
+
+ void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &);
+
+ void finishedGlobeGame();
+
+ virtual GameInteraction *makeInteraction(const InteractionID);
+
+ void playClawMonitorIntro();
+
+ virtual void getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID, HotSpotID &clawControlSpotID,
+ HotSpotID &pinchClawSpotID, HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID,
+ HotSpotID &moveClawLeftSpotID, HotSpotID &moveClawUpSpotID, HotSpotID &clawCCWSpotID,
+ HotSpotID &clawCWSpotID, uint32 &, const uint32 *&);
+
+ void playerBeatRobotWithClaw();
+ void playerBeatRobotWithDoor();
+
+ void loadAmbientLoops();
+
+ void setUpAIRules();
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ bool canSolve();
+ void doSolve();
+
+ void doorOpened();
+
+protected:
+ enum {
+ kNoradPrivateArrivedFromSubFlag,
+ kNoradPrivateFinishedGlobeGameFlag,
+ kNoradPrivateRobotHeadOpenFlag,
+ kNoradPrivateGotShieldChipFlag,
+ kNoradPrivateGotOpticalChipFlag,
+ kNoradPrivateGotRetScanChipFlag,
+ kNumNoradPrivateFlags
+ };
+
+ static const uint32 _noradDeltaClawExtras[22];
+
+ void getExitEntry(const RoomID, const DirectionConstant, ExitTable::Entry &);
+ void getZoomEntry(const HotSpotID, ZoomTable::Entry &);
+ virtual void arriveAt(const RoomID, const DirectionConstant);
+ void arriveAtNorad68West();
+ void arriveAtNorad79West();
+ TimeValue getViewTime(const RoomID, const DirectionConstant);
+ void openDoor();
+ void activateHotspots();
+ void clickInHotspot(const Input &, const Hotspot *);
+ void receiveNotification(Notification *, const NotificationFlags);
+ void pickedUpItem(Item *item);
+ void takeItemFromRoom(Item *item);
+ void dropItemIntoRoom(Item *item, Hotspot *);
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+
+ virtual bool playingAgainstRobot();
+
+ void failRetinalScan();
+ void succeedRetinalScan();
+ void getDoorEntry(const RoomID, const DirectionConstant, DoorTable::Entry &);
+
+ void bumpIntoWall();
+
+ FlagsArray<byte, kNumNoradPrivateFlags> _privateFlags;
+
+ Common::String getSoundSpotsName();
+ Common::String getNavMovieName();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/norad.cpp b/engines/pegasus/neighborhood/norad/norad.cpp
new file mode 100644
index 0000000000..578f062dea
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/norad.cpp
@@ -0,0 +1,285 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/noradelevator.h"
+#include "pegasus/neighborhood/norad/pressuredoor.h"
+#include "pegasus/neighborhood/norad/subcontrolroom.h"
+#include "pegasus/neighborhood/norad/subplatform.h"
+
+namespace Pegasus {
+
+const NotificationFlags kDoneWithPressureDoorNotification = 1;
+
+const NotificationFlags kNoradNotificationFlags = kDoneWithPressureDoorNotification;
+
+// This class handles everything that Norad Alpha and Delta have in common, such as
+// oxygen mask usage, the elevator and the pressure doors.
+
+Norad::Norad(InputHandler *nextHandler, PegasusEngine *vm, const Common::String &resName, NeighborhoodID id) :
+ Neighborhood(nextHandler, vm, resName, id), _noradNotification(kNoradNotificationID, vm) {
+ _elevatorUpSpotID = kNoHotSpotID;
+ _elevatorDownSpotID = kNoHotSpotID;
+ _elevatorUpRoomID = kNoHotSpotID;
+ _elevatorDownRoomID = kNoHotSpotID;
+
+ _subRoomEntryRoom1 = kNoRoomID;
+ _subRoomEntryDir1 = kNoDirection;
+ _subRoomEntryRoom2 = kNoRoomID;
+ _subRoomEntryDir2 = kNoDirection;
+ _upperPressureDoorRoom = kNoRoomID;
+ _lowerPressureDoorRoom = kNoRoomID;
+
+ _upperPressureDoorUpSpotID = kNoHotSpotID;
+ _upperPressureDoorDownSpotID = kNoHotSpotID;
+ _upperPressureDoorAbortSpotID = kNoHotSpotID;
+
+ _lowerPressureDoorUpSpotID = kNoHotSpotID;
+ _lowerPressureDoorDownSpotID = kNoHotSpotID;
+ _lowerPressureDoorAbortSpotID = kNoHotSpotID;
+
+ _pressureSoundIn = 0xffffffff;
+ _pressureSoundOut = 0xffffffff;
+ _equalizeSoundIn = 0xffffffff;
+ _equalizeSoundOut = 0xffffffff;
+ _accessDeniedIn = 0xffffffff;
+ _accessDeniedOut = 0xffffffff;
+
+ _platformRoom = kNoRoomID;
+ _subControlRoom = kNoRoomID;
+
+ _doneWithPressureDoor = false;
+
+ _noradNotification.notifyMe(this, kNoradNotificationFlags, kNoradNotificationFlags);
+}
+
+GameInteraction *Norad::makeInteraction(const InteractionID interactionID) {
+ PressureDoor *pressureDoor;
+ SubControlRoom *subControl;
+
+ switch (interactionID) {
+ case kNoradElevatorInteractionID:
+ return new NoradElevator(this, _elevatorUpRoomID, _elevatorDownRoomID, _elevatorUpSpotID, _elevatorDownSpotID);
+ case kNoradPressureDoorInteractionID:
+ if (GameState.getCurrentRoom() == _upperPressureDoorRoom)
+ pressureDoor = new PressureDoor(this, true, _upperPressureDoorUpSpotID, _upperPressureDoorDownSpotID,
+ _upperPressureDoorAbortSpotID, _pressureSoundIn, _pressureSoundOut, _equalizeSoundIn, _equalizeSoundOut);
+ else
+ pressureDoor = new PressureDoor(this, false, _lowerPressureDoorUpSpotID, _lowerPressureDoorDownSpotID,
+ _lowerPressureDoorAbortSpotID, _pressureSoundIn, _pressureSoundOut, _equalizeSoundIn, _equalizeSoundOut);
+
+ if (GameState.getCurrentRoom() == kNorad59West && playingAgainstRobot())
+ pressureDoor->playAgainstRobot();
+
+ return pressureDoor;
+ case kNoradSubControlRoomInteractionID:
+ subControl = new SubControlRoom(this);
+
+ if (GameState.getCurrentRoom() == kNorad60West && playingAgainstRobot())
+ subControl->playAgainstRobot();
+
+ return subControl;
+ case kNoradSubPlatformInteractionID:
+ return new SubPlatform(this);
+ default:
+ return 0;
+ }
+}
+
+void Norad::flushGameState() {
+ g_energyMonitor->saveCurrentEnergyValue();
+}
+
+void Norad::start() {
+ setUpAirMask();
+ Neighborhood::start();
+}
+
+void Norad::activateHotspots() {
+ Neighborhood::activateHotspots();
+
+ RoomID room = GameState.getCurrentRoom();
+ if (room == _elevatorUpRoomID)
+ _neighborhoodHotspots.activateOneHotspot(_elevatorDownSpotID);
+ else if (room == _elevatorDownRoomID)
+ _neighborhoodHotspots.activateOneHotspot(_elevatorUpSpotID);
+}
+
+void Norad::arriveAt(const RoomID room, const DirectionConstant direction) {
+ Neighborhood::arriveAt(room, direction);
+
+ if (GameState.getCurrentRoom() == _elevatorUpRoomID || GameState.getCurrentRoom() == _elevatorDownRoomID)
+ arriveAtNoradElevator();
+ else if (GameState.getCurrentRoom() == _upperPressureDoorRoom)
+ arriveAtUpperPressureDoorRoom();
+ else if (GameState.getCurrentRoom() == _lowerPressureDoorRoom)
+ arriveAtLowerPressureDoorRoom();
+ else if (GameState.getCurrentRoom() == _platformRoom)
+ arriveAtSubPlatformRoom();
+ else if (GameState.getCurrentRoom() == _subControlRoom)
+ arriveAtSubControlRoom();
+
+ if (_doneWithPressureDoor) {
+ _doneWithPressureDoor = false;
+ openDoor();
+ }
+}
+
+void Norad::arriveAtNoradElevator() {
+ if (_currentInteraction)
+ _currentInteraction->startOverInteraction();
+ else
+ newInteraction(kNoradElevatorInteractionID);
+}
+
+void Norad::arriveAtUpperPressureDoorRoom() {
+ newInteraction(kNoradPressureDoorInteractionID);
+}
+
+void Norad::arriveAtLowerPressureDoorRoom() {
+ newInteraction(kNoradPressureDoorInteractionID);
+}
+
+void Norad::arriveAtSubPlatformRoom() {
+ newInteraction(kNoradSubPlatformInteractionID);
+}
+
+void Norad::arriveAtSubControlRoom() {
+ newInteraction(kNoradSubControlRoomInteractionID);
+}
+
+int16 Norad::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ int16 result = Neighborhood::getStaticCompassAngle(room, dir);
+
+ if (room == _elevatorUpRoomID || room == _elevatorDownRoomID)
+ result += kElevatorCompassAngle;
+ else if (room == _platformRoom)
+ result += kSubPlatformCompassAngle;
+ else if (room == _subControlRoom)
+ result += kSubControlCompassAngle;
+
+ return result;
+}
+
+CanOpenDoorReason Norad::canOpenDoor(DoorTable::Entry &entry) {
+ if (((GameState.getCurrentRoom() == _subRoomEntryRoom1 && GameState.getCurrentDirection() == _subRoomEntryDir1) ||
+ (GameState.getCurrentRoom() == _subRoomEntryRoom2 && GameState.getCurrentDirection() == _subRoomEntryDir2)) &&
+ GameState.getNoradSubRoomPressure() != kNormalSubRoomPressure)
+ return kCantOpenBadPressure;
+
+ return Neighborhood::canOpenDoor(entry);
+}
+
+void Norad::cantOpenDoor(CanOpenDoorReason reason) {
+ if (reason == kCantOpenBadPressure)
+ playSpotSoundSync(_pressureSoundIn, _pressureSoundOut);
+ else
+ playSpotSoundSync(_accessDeniedIn, _accessDeniedOut);
+}
+
+void Norad::startExitMovie(const ExitTable::Entry &exitEntry) {
+ if (GameState.getCurrentRoom() == _elevatorUpRoomID) {
+ if (exitEntry.exitRoom != _elevatorDownRoomID)
+ newInteraction(kNoInteractionID);
+ } else if (GameState.getCurrentRoom() == _elevatorDownRoomID) {
+ if (exitEntry.exitRoom != _elevatorUpRoomID)
+ newInteraction(kNoInteractionID);
+ } else {
+ newInteraction(kNoInteractionID);
+ }
+
+ Neighborhood::startExitMovie(exitEntry);
+}
+
+void Norad::startZoomMovie(const ZoomTable::Entry &zoomEntry) {
+ newInteraction(kNoInteractionID);
+ Neighborhood::startZoomMovie(zoomEntry);
+}
+
+void Norad::upButton(const Input &input) {
+ if (GameState.getCurrentRoom() != _elevatorUpRoomID && GameState.getCurrentRoom() != _elevatorDownRoomID)
+ Neighborhood::upButton(input);
+}
+
+void Norad::setUpAirMask() {
+ _airMaskCallBack.setNotification(&_neighborhoodNotification);
+ _airMaskCallBack.initCallBack(&_airMaskTimer, kCallBackAtExtremes);
+ _airMaskCallBack.setCallBackFlag(kAirTimerExpiredFlag);
+ _neighborhoodNotification.notifyMe(this, kAirTimerExpiredFlag, kAirTimerExpiredFlag);
+ _airMaskCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _airMaskTimer.setScale(1);
+ _airMaskTimer.setSegment(0, kNoradAirMaskTimeLimit);
+ checkAirMask();
+}
+
+void Norad::checkAirMask() {
+ if (g_airMask && g_airMask->isAirFilterOn()) {
+ _airMaskTimer.stop();
+ } else if (GameState.getNoradGassed() && !_airMaskTimer.isRunning()) {
+ _airMaskTimer.setTime(0);
+ _airMaskTimer.start();
+ }
+
+ loadAmbientLoops();
+}
+
+void Norad::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ if (notification == &_neighborhoodNotification && (flags & kAirTimerExpiredFlag) != 0)
+ ((PegasusEngine *)g_engine)->die(kDeathGassedInNorad);
+
+ Neighborhood::receiveNotification(notification, flags);
+
+ if (notification == &_noradNotification) {
+ // Must be kDoneWithPressureDoorNotification...
+ Input scratch;
+ _doneWithPressureDoor = true;
+ downButton(scratch);
+ }
+}
+
+uint16 Norad::getDateResID() const {
+ return kDate2112ID;
+}
+
+Common::String Norad::getBriefingMovie() {
+ return "Images/AI/Norad/XNO";
+}
+
+void Norad::pickedUpItem(Item *item) {
+ Neighborhood::pickedUpItem(item);
+ g_AIArea->checkMiddleArea();
+}
+
+void Norad::doneWithPressureDoor() {
+ _noradNotification.setNotificationFlags(kDoneWithPressureDoorNotification, kDoneWithPressureDoorNotification);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/norad.h b/engines/pegasus/neighborhood/norad/norad.h
new file mode 100644
index 0000000000..3cd77cc54b
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/norad.h
@@ -0,0 +1,121 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_NORAD_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_NORAD_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+// This is the code common to both Norad Alpha and Norad Delta
+
+class Norad : public Neighborhood {
+public:
+ Norad(InputHandler *, PegasusEngine *owner, const Common::String &resName, const NeighborhoodID);
+ virtual ~Norad() {}
+
+ void flushGameState();
+
+ virtual void start();
+
+ virtual void getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID,
+ HotSpotID &clawControlSpotID, HotSpotID &pinchClawSpotID,
+ HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID,
+ HotSpotID &moveClawLeftSpotID,HotSpotID &moveClawUpSpotID,
+ HotSpotID &clawCCWSpotID, HotSpotID &clawCWSpotID, uint32 &, const uint32 *&) = 0;
+ void checkAirMask();
+
+ virtual uint16 getDateResID() const;
+
+ virtual GameInteraction *makeInteraction(const InteractionID);
+
+ Common::String getBriefingMovie();
+
+ void pickedUpItem(Item *);
+
+ virtual void playClawMonitorIntro() {}
+
+ void doneWithPressureDoor();
+
+protected:
+ CanOpenDoorReason canOpenDoor(DoorTable::Entry &);
+ void cantOpenDoor(CanOpenDoorReason);
+ int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+ virtual void startExitMovie(const ExitTable::Entry &);
+ void startZoomMovie(const ZoomTable::Entry &);
+ virtual void upButton(const Input &);
+ virtual void activateHotspots();
+
+ virtual void arriveAt(const RoomID, const DirectionConstant);
+ virtual void arriveAtNoradElevator();
+ virtual void arriveAtUpperPressureDoorRoom();
+ virtual void arriveAtLowerPressureDoorRoom();
+ virtual void arriveAtSubPlatformRoom();
+ virtual void arriveAtSubControlRoom();
+ void setUpAirMask();
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+ virtual bool playingAgainstRobot() { return false; }
+
+ Notification _noradNotification;
+ bool _doneWithPressureDoor;
+
+ RoomID _elevatorUpRoomID;
+ RoomID _elevatorDownRoomID;
+ HotSpotID _elevatorUpSpotID;
+ HotSpotID _elevatorDownSpotID;
+
+ TimeBase _airMaskTimer;
+ NotificationCallBack _airMaskCallBack;
+
+ RoomID _subRoomEntryRoom1;
+ DirectionConstant _subRoomEntryDir1;
+ RoomID _subRoomEntryRoom2;
+ DirectionConstant _subRoomEntryDir2;
+ RoomID _upperPressureDoorRoom;
+ RoomID _lowerPressureDoorRoom;
+
+ HotSpotID _upperPressureDoorUpSpotID;
+ HotSpotID _upperPressureDoorDownSpotID;
+ HotSpotID _upperPressureDoorAbortSpotID;
+
+ HotSpotID _lowerPressureDoorUpSpotID;
+ HotSpotID _lowerPressureDoorDownSpotID;
+ HotSpotID _lowerPressureDoorAbortSpotID;
+
+ TimeValue _pressureSoundIn;
+ TimeValue _pressureSoundOut;
+ TimeValue _equalizeSoundIn;
+ TimeValue _equalizeSoundOut;
+ TimeValue _accessDeniedIn;
+ TimeValue _accessDeniedOut;
+
+ RoomID _platformRoom;
+ RoomID _subControlRoom;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/noradelevator.cpp b/engines/pegasus/neighborhood/norad/noradelevator.cpp
new file mode 100644
index 0000000000..1751f4dcb6
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/noradelevator.cpp
@@ -0,0 +1,130 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/noradelevator.h"
+
+namespace Pegasus {
+
+// Norad elevator PICTs:
+static const ResIDType kElevatorLabelID = 200;
+static const ResIDType kElevatorButtonsID = 201;
+static const ResIDType kElevatorDownOnID = 202;
+static const ResIDType kElevatorUpOnID = 203;
+
+NoradElevator::NoradElevator(Neighborhood *handler, const RoomID upRoom, const RoomID downRoom,
+ const HotSpotID upHotspot, const HotSpotID downHotspot) : GameInteraction(kNoradElevatorInteractionID, handler),
+ _elevatorControls(kNoradElevatorControlsID), _elevatorNotification(kNoradElevatorNotificationID, ((PegasusEngine *)g_engine)) {
+ _timerExpired = false;
+ _upRoom = upRoom;
+ _downRoom = downRoom;
+ _upHotspot = upHotspot;
+ _downHotspot = downHotspot;
+}
+
+void NoradElevator::openInteraction() {
+ SpriteFrame *frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorLabelID, true);
+ _elevatorControls.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorButtonsID, true);
+ _elevatorControls.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorDownOnID, true);
+ _elevatorControls.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorUpOnID, true);
+ _elevatorControls.addFrame(frame, 0, 0);
+
+ _elevatorControls.setCurrentFrameIndex(0);
+ _elevatorControls.setDisplayOrder(kElevatorControlsOrder);
+
+ Common::Rect r;
+ frame->getSurfaceBounds(r);
+ r.moveTo(kNoradAlphaElevatorControlsLeft, kNoradAlphaElevatorControlsTop);
+
+ _elevatorControls.setBounds(r);
+ _elevatorControls.startDisplaying();
+ _elevatorControls.show();
+}
+
+void NoradElevator::initInteraction() {
+ _elevatorTimer.setScale(2);
+ _elevatorTimer.setSegment(0, 1);
+ _elevatorCallBack.initCallBack(&_elevatorTimer, kCallBackAtExtremes);
+ _elevatorCallBack.setCallBackFlag(1);
+ _elevatorCallBack.setNotification(&_elevatorNotification);
+ _elevatorNotification.notifyMe(this, 1, 1);
+ _elevatorCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _elevatorTimer.start();
+}
+
+void NoradElevator::closeInteraction() {
+ _elevatorControls.stopDisplaying();
+ _elevatorControls.discardFrames();
+ _elevatorCallBack.releaseCallBack();
+}
+
+void NoradElevator::resetInteraction() {
+ _elevatorControls.setCurrentFrameIndex(1);
+}
+
+void NoradElevator::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ if (_timerExpired) {
+ if (GameState.getCurrentRoom() == _upRoom)
+ g_allHotspots.activateOneHotspot(_downHotspot);
+ else if (GameState.getCurrentRoom() == _downRoom)
+ g_allHotspots.activateOneHotspot(_upHotspot);
+ }
+}
+
+void NoradElevator::clickInHotspot(const Input &input, const Hotspot *spot) {
+ HotSpotID id = spot->getObjectID();
+
+ if (id == _upHotspot || id == _downHotspot) {
+ g_neighborhood->moveForward();
+ if (id == _downHotspot)
+ _elevatorControls.setCurrentFrameIndex(2);
+ else
+ _elevatorControls.setCurrentFrameIndex(3);
+ } else {
+ GameInteraction::clickInHotspot(input, spot);
+ }
+}
+
+void NoradElevator::receiveNotification(Notification *, const NotificationFlags) {
+ _elevatorControls.setCurrentFrameIndex(1);
+ _timerExpired = true;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/noradelevator.h b/engines/pegasus/neighborhood/norad/noradelevator.h
new file mode 100644
index 0000000000..24aa488534
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/noradelevator.h
@@ -0,0 +1,67 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_NORADELEVATOR_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_NORADELEVATOR_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/notification.h"
+#include "pegasus/surface.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class Neighborhood;
+
+class NoradElevator : public GameInteraction, private NotificationReceiver {
+public:
+ NoradElevator(Neighborhood *, const RoomID, const RoomID, const HotSpotID, const HotSpotID);
+ virtual ~NoradElevator() {}
+
+protected:
+ virtual void openInteraction();
+ virtual void initInteraction();
+ virtual void closeInteraction();
+ virtual void resetInteraction();
+
+ virtual void activateHotspots();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ RoomID _upRoom;
+ RoomID _downRoom;
+ HotSpotID _upHotspot;
+ HotSpotID _downHotspot;
+ Sprite _elevatorControls;
+ TimeBase _elevatorTimer;
+ NotificationCallBack _elevatorCallBack;
+ Notification _elevatorNotification;
+ bool _timerExpired;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/pressuredoor.cpp b/engines/pegasus/neighborhood/norad/pressuredoor.cpp
new file mode 100644
index 0000000000..d1378567d3
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/pressuredoor.cpp
@@ -0,0 +1,554 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/pressuredoor.h"
+#include "pegasus/neighborhood/norad/delta/noraddelta.h"
+
+namespace Pegasus {
+
+static const TimeValue kLevelsSplashStart = 0;
+static const TimeValue kLevelsSplashStop = 1;
+static const TimeValue kPressureBase = 1;
+
+static const TimeValue kDoorSealedTime = 0;
+static const TimeValue kEqualizeTime = 1;
+static const TimeValue kMaxPressureLoopStart = 2;
+static const TimeValue kMaxPressureLoopStop = 3;
+static const TimeValue kOpeningDoorLoopStart = 3;
+static const TimeValue kOpeningDoorLoopStop = 4;
+static const TimeValue kIncreasingPressureTime = 4;
+static const TimeValue kDecreasingPressureTime = 5;
+static const TimeValue kCautionLoopStart = 6;
+static const TimeValue kCautionLoopStop = 7;
+
+static const NotificationFlags kSplashFinished = 1;
+static const NotificationFlags kPressureDroppingFlag = kSplashFinished << 1;
+
+static const NotificationFlags kPressureNotificationFlags = kSplashFinished |
+ kPressureDroppingFlag;
+
+static const NotificationFlags kDoorJumpsUpFlag = 1;
+static const NotificationFlags kDoorJumpsBackFlag = kDoorJumpsUpFlag << 1;
+static const NotificationFlags kDoorCrushedFlag = kDoorJumpsBackFlag << 1;
+
+static const NotificationFlags kUtilityNotificationFlags = kDoorJumpsUpFlag |
+ kDoorJumpsBackFlag |
+ kDoorCrushedFlag;
+
+enum {
+ kPlayingRobotApproaching,
+ kRobotPunching,
+ kRobotComingThrough,
+ kRobotDying,
+ kRobotDead
+};
+
+const short kMaxPunches = 5;
+
+enum {
+ kPlayingSplash,
+ kPlayingPressureMessage,
+ kPlayingEqualizeMessage,
+ kWaitingForPlayer,
+ kPlayingDoneMessage,
+ kGameOver
+};
+
+// Pressure values range from 0 to 11.
+static const short kMinPressure = 0;
+static const short kMaxPressure = 11;
+
+static const TimeScale kNavTimeScale = 600;
+static const TimeValue kNavFrameRate = 15;
+static const TimeValue kNavTimePerFrame = kNavTimeScale / kNavFrameRate;
+
+static const TimeValue kApproachPunchInTime = 122 * kNavTimePerFrame;
+static const TimeValue kLoopPunchInTime = 38 * kNavTimePerFrame;
+static const TimeValue kPunchThroughTime = 38 * kNavTimePerFrame;
+
+// Pressure door PICTs:
+static const ResIDType kUpperPressureUpOffPICTID = 400;
+static const ResIDType kUpperPressureUpOnPICTID = 401;
+static const ResIDType kUpperPressureDownOffPICTID = 402;
+static const ResIDType kUpperPressureDownOnPICTID = 403;
+
+static const ResIDType kLowerPressureUpOffPICTID = 404;
+static const ResIDType kLowerPressureUpOnPICTID = 405;
+static const ResIDType kLowerPressureDownOffPICTID = 406;
+static const ResIDType kLowerPressureDownOnPICTID = 407;
+
+PressureDoor::PressureDoor(Neighborhood *handler, bool isUpperDoor, const HotSpotID upSpotID, const HotSpotID downSpotID,
+ const HotSpotID outSpotID, TimeValue pressureSoundIn, TimeValue pressureSoundOut, TimeValue equalizeSoundIn,
+ TimeValue equalizeSoundOut) : GameInteraction(kNoradPressureDoorInteractionID, handler),
+ _levelsMovie(kPressureDoorLevelsID), _typeMovie(kPressureDoorTypeID), _upButton(kPressureDoorUpButtonID),
+ _downButton(kPressureDoorDownButtonID), _pressureNotification(kNoradPressureNotificationID, ((PegasusEngine *)g_engine)),
+ _doorTracker(this), _utilityNotification(kNoradUtilityNotificationID, ((PegasusEngine *)g_engine)) {
+ _neighborhoodNotification = handler->getNeighborhoodNotification();
+ _upHotspotID = upSpotID;
+ _downHotspotID = downSpotID;
+ _outHotspotID = outSpotID;
+ _pressureSoundIn = pressureSoundIn;
+ _pressureSoundOut = pressureSoundOut;
+ _equalizeSoundIn = equalizeSoundIn;
+ _equalizeSoundOut = equalizeSoundOut;
+ _playingAgainstRobot = false;
+ _isUpperDoor = isUpperDoor;
+}
+
+void PressureDoor::openInteraction() {
+ if (_isUpperDoor) {
+ _levelsMovie.initFromMovieFile("Images/Norad Alpha/Upper Levels Movie");
+ _levelsMovie.moveElementTo(kNoradUpperLevelsLeft, kNoradUpperLevelsTop);
+ } else {
+ _levelsMovie.initFromMovieFile("Images/Norad Alpha/Lower Levels Movie");
+ _levelsMovie.moveElementTo(kNoradLowerLevelsLeft, kNoradLowerLevelsTop);
+ }
+
+ _levelsScale = _levelsMovie.getScale();
+ _levelsMovie.setDisplayOrder(kPressureLevelsOrder);
+ _levelsMovie.startDisplaying();
+ _levelsMovie.setSegment(kLevelsSplashStart * _levelsScale, kLevelsSplashStop * _levelsScale);
+ _levelsMovie.setTime(kLevelsSplashStart * _levelsScale);
+ _levelsMovie.redrawMovieWorld();
+ _levelsMovie.show();
+
+ _pressureCallBack.setNotification(&_pressureNotification);
+ _pressureCallBack.initCallBack(&_levelsMovie, kCallBackAtExtremes);
+ _pressureCallBack.setCallBackFlag(kSplashFinished);
+ _pressureCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ _pressureNotification.notifyMe(this, kPressureNotificationFlags, kPressureNotificationFlags);
+
+ if (_isUpperDoor) {
+ _typeMovie.initFromMovieFile("Images/Norad Alpha/Upper Type Movie");
+ _typeMovie.moveElementTo(kNoradUpperTypeLeft, kNoradUpperTypeTop);
+ } else {
+ _typeMovie.initFromMovieFile("Images/Norad Alpha/Lower Type Movie");
+ _typeMovie.moveElementTo(kNoradLowerTypeLeft, kNoradLowerTypeTop);
+ }
+
+ _typeScale = _typeMovie.getScale();
+ _typeMovie.setDisplayOrder(kPressureTypeOrder);
+ _typeMovie.startDisplaying();
+ _typeMovie.setTime(kDoorSealedTime * _typeScale);
+ _typeMovie.redrawMovieWorld();
+
+ SpriteFrame *frame = new SpriteFrame();
+ if (_isUpperDoor)
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureUpOffPICTID);
+ else
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureUpOffPICTID);
+ _upButton.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ if (_isUpperDoor)
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureUpOnPICTID);
+ else
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureUpOnPICTID);
+ _upButton.addFrame(frame, 0, 0);
+
+ _upButton.setCurrentFrameIndex(0);
+ _upButton.setDisplayOrder(kPressureUpOrder);
+
+ Common::Rect r;
+ frame->getSurfaceBounds(r);
+ if (_isUpperDoor)
+ r.moveTo(kNoradUpperUpLeft, kNoradUpperUpTop);
+ else
+ r.moveTo(kNoradLowerUpLeft, kNoradLowerUpTop);
+
+ _upButton.setBounds(r);
+ _upButton.startDisplaying();
+ _upButton.show();
+
+ frame = new SpriteFrame();
+ if (_isUpperDoor)
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureDownOffPICTID);
+ else
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureDownOffPICTID);
+ _downButton.addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ if (_isUpperDoor)
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureDownOnPICTID);
+ else
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureDownOnPICTID);
+ _downButton.addFrame(frame, 0, 0);
+
+ _downButton.setCurrentFrameIndex(0);
+ _downButton.setDisplayOrder(kPressureDownOrder);
+
+ frame->getSurfaceBounds(r);
+ if (_isUpperDoor)
+ r.moveTo(kNoradUpperDownLeft, kNoradUpperDownTop);
+ else
+ r.moveTo(kNoradLowerDownLeft, kNoradLowerDownTop);
+
+ _downButton.setBounds(r);
+ _downButton.startDisplaying();
+ _downButton.show();
+
+ _utilityCallBack.setNotification(&_utilityNotification);
+ _utilityCallBack.initCallBack(&_utilityTimer, kCallBackAtTime);
+ _utilityNotification.notifyMe(this, kUtilityNotificationFlags, kUtilityNotificationFlags);
+ _utilityTimer.setMasterTimeBase(getOwner()->getNavMovie());
+
+ if (_playingAgainstRobot)
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag | kDelayCompletedFlag |
+ kSpotSoundCompletedFlag, kExtraCompletedFlag | kDelayCompletedFlag | kSpotSoundCompletedFlag);
+ else
+ _neighborhoodNotification->notifyMe(this, kDelayCompletedFlag | kSpotSoundCompletedFlag,
+ kDelayCompletedFlag | kSpotSoundCompletedFlag);
+
+ _gameState = kPlayingSplash;
+}
+
+void PressureDoor::initInteraction() {
+ _levelsMovie.start();
+
+ if (_playingAgainstRobot) {
+ ExtraTable::Entry entry;
+ _owner->getExtraEntry(kN59RobotApproaches, entry);
+ _utilityTimer.setSegment(entry.movieStart, entry.movieEnd);
+ _utilityCallBack.setCallBackFlag(kDoorJumpsUpFlag);
+ _punchInTime = kApproachPunchInTime + entry.movieStart;
+ _utilityCallBack.scheduleCallBack(kTriggerTimeFwd, _punchInTime, kNavTimeScale);
+ _utilityTimer.setTime(entry.movieStart);
+ _owner->startExtraSequence(kN59RobotApproaches, kExtraCompletedFlag, kFilterAllInput);
+ _utilityTimer.start();
+ _robotState = kPlayingRobotApproaching;
+ }
+
+ _levelsMovie.redrawMovieWorld();
+}
+
+void PressureDoor::closeInteraction() {
+ _pressureNotification.cancelNotification(this);
+ _pressureCallBack.releaseCallBack();
+ _utilityNotification.cancelNotification(this);
+ _utilityCallBack.releaseCallBack();
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void PressureDoor::playAgainstRobot() {
+ _playingAgainstRobot = true;
+}
+
+void PressureDoor::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ Neighborhood *owner = getOwner();
+
+ if (notification == _neighborhoodNotification) {
+ if (_playingAgainstRobot && (flags & kExtraCompletedFlag) != 0) {
+ ExtraTable::Entry entry;
+
+ switch (_robotState) {
+ case kPlayingRobotApproaching:
+ _utilityTimer.stop();
+ if (GameState.getNoradSubRoomPressure() == kMaxPressure) {
+ owner->getExtraEntry(kN59PlayerWins1, entry);
+ _utilityTimer.setSegment(entry.movieStart, entry.movieEnd);
+ _utilityTimer.setTime(entry.movieStart);
+ _utilityCallBack.setCallBackFlag(kDoorJumpsUpFlag);
+ _punchInTime = kLoopPunchInTime + entry.movieStart;
+ _utilityCallBack.scheduleCallBack(kTriggerTimeFwd, _punchInTime, kNavTimeScale);
+ owner->startExtraSequence(kN59PlayerWins1, kExtraCompletedFlag, kFilterNoInput);
+ _utilityTimer.start();
+ _robotState = kRobotDying;
+ } else {
+ owner->getExtraEntry(kN59RobotPunchLoop, entry);
+ _utilityTimer.setSegment(entry.movieStart, entry.movieEnd);
+ _utilityTimer.setTime(entry.movieStart);
+ _utilityCallBack.setCallBackFlag(kDoorJumpsUpFlag);
+ _punchInTime = kLoopPunchInTime + entry.movieStart;
+ _utilityCallBack.scheduleCallBack(kTriggerTimeFwd, _punchInTime, kNavTimeScale);
+ owner->startSpotLoop(entry.movieStart, entry.movieEnd, kExtraCompletedFlag);
+ _utilityTimer.start();
+ _robotState = kRobotPunching;
+ _punchCount = 1;
+ }
+ break;
+ case kRobotPunching:
+ if (GameState.getNoradSubRoomPressure() == kMaxPressure) {
+ owner->startExtraSequence(kN59PlayerWins1, kExtraCompletedFlag, kFilterNoInput);
+ _robotState = kRobotDying;
+ } else if (++_punchCount >= kMaxPunches) {
+ _robotState = kRobotComingThrough;
+ owner->getExtraEntry(kN59RobotWins, entry);
+ _utilityTimer.stop();
+ _utilityTimer.setSegment(entry.movieStart, entry.movieEnd);
+ _utilityTimer.setTime(entry.movieStart);
+ _utilityCallBack.cancelCallBack();
+ _utilityCallBack.setCallBackFlag(kDoorCrushedFlag);
+ _utilityCallBack.scheduleCallBack(kTriggerTimeFwd, kPunchThroughTime + entry.movieStart, kNavTimeScale);
+ owner->startExtraSequence(kN59RobotWins, kExtraCompletedFlag, kFilterNoInput);
+ _utilityTimer.start();
+ } else {
+ _utilityCallBack.setCallBackFlag(kDoorJumpsUpFlag);
+ _utilityCallBack.scheduleCallBack(kTriggerTimeFwd, _punchInTime, kNavTimeScale);
+ owner->scheduleNavCallBack(kExtraCompletedFlag);
+ }
+ break;
+ case kRobotComingThrough:
+ g_system->delayMillis(2 * 1000);
+ ((PegasusEngine *)g_engine)->die(kDeathRobotThroughNoradDoor);
+ break;
+ case kRobotDying:
+ _robotState = kRobotDead;
+ _levelsMovie.stop();
+ _levelsMovie.setSegment((kNormalSubRoomPressure + kPressureBase) * _levelsScale,
+ (GameState.getNoradSubRoomPressure() + kPressureBase) * _levelsScale);
+ _pressureCallBack.setCallBackFlag(kPressureDroppingFlag);
+ _pressureCallBack.scheduleCallBack(kTriggerAtStart, 0, 0);
+ _typeMovie.stop();
+ _typeMovie.setSegment(0, _typeMovie.getDuration());
+ _typeMovie.setTime(kDecreasingPressureTime * _typeScale);
+ _typeMovie.redrawMovieWorld();
+ _typeMovie.show();
+ _downButton.show();
+ _downButton.setCurrentFrameIndex(1);
+ _gameState = kGameOver;
+ allowInput(false);
+ _levelsMovie.setRate(Common::Rational(0x5555, 0x10000) - 1); // Should match door tracker.
+ break;
+ case kRobotDead:
+ allowInput(true);
+ ((NoradDelta *)owner)->playerBeatRobotWithDoor();
+ owner->requestDeleteCurrentInteraction();
+ break;
+ }
+ }
+
+ if ((flags & (kDelayCompletedFlag | kSpotSoundCompletedFlag)) != 0) {
+ switch (_gameState) {
+ case kPlayingPressureMessage:
+ _typeMovie.setTime(kEqualizeTime * _typeScale);
+ _typeMovie.redrawMovieWorld();
+ owner->requestDelay(1, 5, kFilterNoInput, 0);
+ owner->requestSpotSound(_equalizeSoundIn, _equalizeSoundOut, kFilterNoInput, 0);
+ owner->requestDelay(1, 5, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayingEqualizeMessage;
+ break;
+ case kPlayingEqualizeMessage:
+ _gameState = kWaitingForPlayer;
+ stopChangingPressure();
+ break;
+ case kPlayingDoneMessage:
+ _gameState = kWaitingForPlayer;
+ _typeMovie.stop();
+ _typeMovie.setFlags(0);
+ _typeMovie.hide();
+ if (!_playingAgainstRobot)
+ ((Norad *)_owner)->doneWithPressureDoor();
+ break;
+ }
+ }
+ } else if (notification == &_pressureNotification) {
+ switch (flags) {
+ case kSplashFinished:
+ _levelsMovie.stop();
+ _levelsMovie.setSegment(0, _levelsMovie.getDuration());
+ _levelsMovie.setTime((GameState.getNoradSubRoomPressure() + kPressureBase) * _levelsScale);
+ _levelsMovie.redrawMovieWorld();
+
+ if (GameState.getNoradSubRoomPressure() != kNormalSubRoomPressure) {
+ _typeMovie.show();
+ owner->requestDelay(1, 5, kFilterNoInput, 0);
+ owner->requestSpotSound(_pressureSoundIn, _pressureSoundOut, kFilterNoInput, 0);
+ owner->requestDelay(1, 5, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayingPressureMessage;
+ } else {
+ _gameState = kWaitingForPlayer;
+ }
+ break;
+ case kPressureDroppingFlag:
+ _levelsMovie.stop();
+ _levelsMovie.hide();
+ _typeMovie.stop();
+ _typeMovie.hide();
+ _upButton.hide();
+ _downButton.hide();
+ owner->startExtraSequence(kN59PlayerWins2, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ } else if (notification == &_utilityNotification) {
+ switch (flags) {
+ case kDoorJumpsUpFlag:
+ _utilityCallBack.setCallBackFlag(kDoorJumpsBackFlag);
+ _utilityCallBack.scheduleCallBack(kTriggerTimeFwd, _punchInTime + kNavTimePerFrame, kNavTimeScale);
+ _levelsMovie.hide();
+ _typePunched = _typeMovie.isVisible();
+ if (_typePunched == true)
+ _typeMovie.hide();
+ _upButton.hide();
+ _downButton.hide();
+ break;
+ case kDoorJumpsBackFlag:
+ _levelsMovie.show();
+ _upButton.show();
+ _downButton.show();
+ if (_typePunched)
+ _typeMovie.show();
+ break;
+ case kDoorCrushedFlag:
+ _levelsMovie.hide();
+ _typeMovie.hide();
+ _upButton.hide();
+ _downButton.hide();
+ break;
+ }
+ }
+}
+
+void PressureDoor::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ switch (_gameState) {
+ case kWaitingForPlayer:
+ g_allHotspots.activateOneHotspot(_upHotspotID);
+ g_allHotspots.activateOneHotspot(_downHotspotID);
+ if (!_playingAgainstRobot)
+ g_allHotspots.activateOneHotspot(_outHotspotID);
+ break;
+ default:
+ break;
+ }
+}
+
+void PressureDoor::clickInHotspot(const Input &input, const Hotspot *spot) {
+ HotSpotID id = spot->getObjectID();
+
+ if (id == _upHotspotID || id == _downHotspotID) {
+ if (id == _upHotspotID)
+ _doorTracker.setTrackParameters(spot, &_upButton);
+ else
+ _doorTracker.setTrackParameters(spot, &_downButton);
+
+ _doorTracker.startTracking(input);
+ } else {
+ GameInteraction::clickInHotspot(input, spot);
+ }
+}
+
+void PressureDoor::incrementPressure(const HotSpotID id) {
+ _typeMovie.stop();
+ _typeMovie.setSegment(0, _typeMovie.getDuration());
+ _typeMovie.setFlags(0);
+
+ if (id == _upHotspotID) {
+ if (GameState.getNoradSubRoomPressure() < kMaxPressure) {
+ GameState.setNoradSubRoomPressure(GameState.getNoradSubRoomPressure() + 1);
+ _levelsMovie.setTime((GameState.getNoradSubRoomPressure() + kPressureBase) * _levelsScale);
+ _levelsMovie.redrawMovieWorld();
+ _typeMovie.setTime(kIncreasingPressureTime * _typeScale);
+ _typeMovie.redrawMovieWorld();
+ _typeMovie.show();
+ g_AIArea->checkMiddleArea();
+ } else {
+ _typeMovie.hide();
+ }
+ } else if (id == _downHotspotID) {
+ if (GameState.getNoradSubRoomPressure() > kMinPressure) {
+ GameState.setNoradSubRoomPressure(GameState.getNoradSubRoomPressure() - 1);
+ _levelsMovie.setTime((GameState.getNoradSubRoomPressure() + kPressureBase) * _levelsScale);
+ _levelsMovie.redrawMovieWorld();
+ _typeMovie.setTime(kDecreasingPressureTime * _typeScale);
+ _typeMovie.redrawMovieWorld();
+ _typeMovie.show();
+ g_AIArea->checkMiddleArea();
+ } else {
+ _typeMovie.hide();
+ }
+ }
+}
+
+void PressureDoor::stopChangingPressure() {
+ Neighborhood *owner;
+
+ switch (GameState.getNoradSubRoomPressure()) {
+ case 11:
+ _typeMovie.setSegment(kMaxPressureLoopStart * _typeScale, kMaxPressureLoopStop * _typeScale);
+ _typeMovie.setFlags(kLoopTimeBase);
+ _typeMovie.show();
+ _typeMovie.start();
+ break;
+ case 10:
+ _typeMovie.setSegment(kCautionLoopStart * _typeScale, kCautionLoopStop * _typeScale);
+ _typeMovie.setFlags(kLoopTimeBase);
+ _typeMovie.show();
+ _typeMovie.start();
+ break;
+ case kNormalSubRoomPressure:
+ owner = getOwner();
+ _typeMovie.setSegment(kOpeningDoorLoopStart * _typeScale, kOpeningDoorLoopStop * _typeScale);
+ _typeMovie.setFlags(kLoopTimeBase);
+ _typeMovie.show();
+ _gameState = kPlayingDoneMessage;
+ owner->requestDelay(2, 1, kFilterNoInput, kDelayCompletedFlag);
+ _typeMovie.start();
+ break;
+ default:
+ _typeMovie.hide();
+ break;
+ }
+}
+
+bool PressureDoor::canSolve() {
+ if (_playingAgainstRobot)
+ return GameState.getNoradSubRoomPressure() < 11;
+
+ return GameState.getNoradSubRoomPressure() != kNormalSubRoomPressure;
+}
+
+void PressureDoor::doSolve() {
+ if (_playingAgainstRobot) {
+ GameState.setNoradSubRoomPressure(11);
+ _levelsMovie.setTime((11 + kPressureBase) * _levelsScale);
+ _levelsMovie.redrawMovieWorld();
+ _typeMovie.setSegment(kMaxPressureLoopStart * _typeScale, kMaxPressureLoopStop * _typeScale);
+ _typeMovie.setFlags(kLoopTimeBase);
+ _typeMovie.show();
+ _typeMovie.start();
+ g_AIArea->checkMiddleArea();
+ } else {
+ GameState.setNoradSubRoomPressure(kNormalSubRoomPressure);
+ _levelsMovie.setTime((kNormalSubRoomPressure + kPressureBase) * _levelsScale);
+ _levelsMovie.redrawMovieWorld();
+ _typeMovie.setSegment(kOpeningDoorLoopStart * _typeScale, kOpeningDoorLoopStop * _typeScale);
+ _typeMovie.setFlags(kLoopTimeBase);
+ _typeMovie.show();
+ Neighborhood *owner = getOwner();
+ owner->requestDelay(2, 1, kFilterNoInput, kDelayCompletedFlag);
+ _gameState = kPlayingDoneMessage;
+ _typeMovie.start();
+ g_AIArea->checkMiddleArea();
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/pressuredoor.h b/engines/pegasus/neighborhood/norad/pressuredoor.h
new file mode 100644
index 0000000000..b2018bfcf7
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/pressuredoor.h
@@ -0,0 +1,93 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_PRESSUREDOOR_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_PRESSUREDOOR_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+#include "pegasus/neighborhood/norad/pressuretracker.h"
+
+namespace Pegasus {
+
+static const short kNormalSubRoomPressure = 2;
+
+class PressureDoor : public GameInteraction, public NotificationReceiver {
+public:
+ PressureDoor(Neighborhood *, bool isUpperDoor, const HotSpotID, const HotSpotID,
+ const HotSpotID, TimeValue pressureSoundIn, TimeValue pressureSoundOut,
+ TimeValue equalizeSoundIn, TimeValue equalizeSoundOut);
+ virtual ~PressureDoor() {}
+
+ void incrementPressure(const HotSpotID);
+ void stopChangingPressure();
+
+ void playAgainstRobot();
+
+ bool canSolve();
+ void doSolve();
+
+protected:
+ virtual void openInteraction();
+ virtual void initInteraction();
+ virtual void closeInteraction();
+
+ virtual void activateHotspots();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ Movie _levelsMovie;
+ TimeScale _levelsScale;
+ Movie _typeMovie;
+ TimeScale _typeScale;
+ Sprite _upButton;
+ Sprite _downButton;
+ Notification _pressureNotification;
+ NotificationCallBack _pressureCallBack;
+ Notification *_neighborhoodNotification;
+ int _gameState;
+ HotSpotID _upHotspotID;
+ HotSpotID _downHotspotID;
+ HotSpotID _outHotspotID;
+ PressureTracker _doorTracker;
+ TimeValue _pressureSoundIn;
+ TimeValue _pressureSoundOut;
+ TimeValue _equalizeSoundIn;
+ TimeValue _equalizeSoundOut;
+ bool _isUpperDoor;
+
+ bool _playingAgainstRobot, _typePunched;
+ int _robotState, _punchCount;
+ TimeBase _utilityTimer;
+ Notification _utilityNotification;
+ NotificationCallBack _utilityCallBack;
+ TimeValue _punchInTime;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/pressuretracker.cpp b/engines/pegasus/neighborhood/norad/pressuretracker.cpp
new file mode 100644
index 0000000000..5aac19dcbe
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/pressuretracker.cpp
@@ -0,0 +1,87 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/hotspot.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/norad/pressuredoor.h"
+#include "pegasus/neighborhood/norad/pressuretracker.h"
+
+namespace Pegasus {
+
+PressureTracker::PressureTracker(PressureDoor *pressureDoor) {
+ _pressureDoor = pressureDoor;
+ _trackSpot = 0;
+ _trackTime = 0;
+}
+
+void PressureTracker::setTrackParameters(const Hotspot *trackSpot, Sprite *trackButton) {
+ _trackSpot = trackSpot;
+ _trackButton = trackButton;
+ _trackTime = 0;
+}
+
+void PressureTracker::activateHotspots() {
+ Tracker::activateHotspots();
+
+ if (_trackSpot)
+ g_allHotspots.activateOneHotspot(_trackSpot->getObjectID());
+}
+
+// For click-hold dragging.
+bool PressureTracker::stopTrackingInput(const Input &input) {
+ return !JMPPPInput::isPressingInput(input);
+}
+
+void PressureTracker::continueTracking(const Input &input) {
+ Common::Point where;
+ input.getInputLocation(where);
+
+ if (g_allHotspots.findHotspot(where) == _trackSpot) {
+ trackPressure();
+ _trackButton->setCurrentFrameIndex(1);
+ } else {
+ _trackButton->setCurrentFrameIndex(0);
+ }
+}
+
+void PressureTracker::startTracking(const Input &input) {
+ Tracker::startTracking(input);
+ trackPressure();
+}
+
+void PressureTracker::stopTracking(const Input &input) {
+ _trackButton->setCurrentFrameIndex(0);
+ _pressureDoor->stopChangingPressure();
+ Tracker::stopTracking(input);
+}
+
+void PressureTracker::trackPressure() {
+ if (g_system->getMillis() - _trackTime > kPressureDoorTrackInterval * 1000 / 60) {
+ _pressureDoor->incrementPressure(_trackSpot->getObjectID());
+ _trackTime = g_system->getMillis();
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/pressuretracker.h b/engines/pegasus/neighborhood/norad/pressuretracker.h
new file mode 100644
index 0000000000..6ca7252e22
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/pressuretracker.h
@@ -0,0 +1,69 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_PRESSURETRACKER_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_PRESSURETRACKER_H
+
+#include "pegasus/input.h"
+
+namespace Pegasus {
+
+// This class assumes that the globe movie is built at 15 frames per second with a
+// time scale of 600, yielding 40 time unit per frame.
+
+enum PressureTrackDirection {
+ kTrackPressureUp,
+ kTrackPressureDown
+};
+
+static const int kPressureDoorTrackInterval = 45;
+
+class PressureDoor;
+class Sprite;
+
+class PressureTracker : public Tracker {
+public:
+ PressureTracker(PressureDoor *);
+ virtual ~PressureTracker() {}
+
+ void setTrackParameters(const Hotspot *, Sprite *);
+ void continueTracking(const Input &);
+ void startTracking(const Input &);
+ void stopTracking(const Input &);
+ void activateHotspots();
+ bool stopTrackingInput(const Input &);
+
+protected:
+ void trackPressure();
+
+ PressureDoor *_pressureDoor;
+ const Hotspot *_trackSpot;
+ Sprite *_trackButton;
+ long _trackTime;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/subcontrolroom.cpp b/engines/pegasus/neighborhood/norad/subcontrolroom.cpp
new file mode 100644
index 0000000000..d48481e925
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/subcontrolroom.cpp
@@ -0,0 +1,1178 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/subcontrolroom.h"
+#include "pegasus/neighborhood/norad/delta/noraddelta.h"
+
+namespace Pegasus {
+
+// Right Monitor times
+
+static const TimeValue kAlphaClawSplashStart = 0;
+static const TimeValue kAlphaClawSplashStop = 4000;
+
+static const TimeValue kDeltaClawSplashStart = 4000;
+static const TimeValue kDeltaClawSplashStop = 8000;
+
+static const TimeValue kClawAtATime = 8000;
+static const TimeValue kClawAtAPinchedTime = 8600;
+static const TimeValue kClawAtATurnedTime = 9200;
+static const TimeValue kClawAtAWithRobotPinchedTime = 9800;
+
+static const TimeValue kClawAtBTime = 10400;
+static const TimeValue kClawAtBPinchedTime = 11000;
+static const TimeValue kClawAtBTurnedTime = 11600;
+static const TimeValue kClawAtBWithRobotTime = 12200;
+static const TimeValue kClawAtBWithRobotPinchedTime = 12800;
+
+static const TimeValue kClawAtCTime = 13400;
+static const TimeValue kClawAtCPinchedTime = 14000;
+static const TimeValue kClawAtCTurnedTime = 14600;
+
+static const TimeValue kClawAtDTime = 15200;
+static const TimeValue kClawAtDPinchedTime = 15800;
+static const TimeValue kClawAtDTurnedTime = 16400;
+
+static const TimeValue kAToBStart = 17000;
+static const TimeValue kAToBStop = 18680;
+static const TimeValue kAPinchStart = 18680;
+static const TimeValue kAPinchStop = 20200;
+static const TimeValue kACCWStart = 20200;
+static const TimeValue kACCWStop = 21600;
+static const TimeValue kACWStart = 21600;
+static const TimeValue kACWStop = 23000;
+
+static const TimeValue kBToAStart = 23000;
+static const TimeValue kBToAStop = 24680;
+static const TimeValue kBToCStart = 24680;
+static const TimeValue kBToCStop = 26520;
+static const TimeValue kBToDStart = 26520;
+static const TimeValue kBToDStop = 28320;
+static const TimeValue kBPinchStart = 28320;
+static const TimeValue kBPinchStop = 29680;
+static const TimeValue kBCCWStart = 29680;
+static const TimeValue kBCCWStop = 31200;
+static const TimeValue kBCWStart = 31200;
+static const TimeValue kBCWStop = 32720;
+
+static const TimeValue kCToBStart = 32720;
+static const TimeValue kCToBStop = 34560;
+static const TimeValue kCPinchStart = 34560;
+static const TimeValue kCPinchStop = 36400;
+static const TimeValue kCCCWStart = 36400;
+static const TimeValue kCCCWStop = 37840;
+static const TimeValue kCCWStart = 37840;
+static const TimeValue kCCWStop = 39280;
+
+static const TimeValue kDToBStart = 39280;
+static const TimeValue kDToBStop = 41080;
+static const TimeValue kDPinchStart = 41080;
+static const TimeValue kDPinchStop = 42600;
+static const TimeValue kDCCWStart = 42600;
+static const TimeValue kDCCWStop = 44000;
+static const TimeValue kDCWStart = 44000;
+static const TimeValue kDCWStop = 45400;
+
+static const TimeValue kRobotApproachStart = 45400;
+static const TimeValue kRobotApproachStop = 56800;
+
+static const TimeValue kCToBWithRobotStart = 56800;
+static const TimeValue kCToBWithRobotStop = 58600;
+
+static const TimeValue kBPinchWithRobotStart = 58600;
+static const TimeValue kBPinchWithRobotStop = 60400;
+static const TimeValue kBToAWithRobotStart = 60400;
+static const TimeValue kBToAWithRobotStop = 62240;
+
+// As usual, times here are in seconds.
+
+// Left monitor times.
+
+static const TimeValue kAlphaSplashStart = 0;
+static const TimeValue kAlphaSplashStop = 2;
+
+static const TimeValue kMainMenuTime = 2;
+static const TimeValue kLaunchPrepRolloverTime = 3;
+static const TimeValue kLaunchPrepHighlightStart = 4;
+static const TimeValue kLaunchPrepHighlightStop = 5;
+static const TimeValue kClawControlRolloverTime = 5;
+static const TimeValue kClawControlHighlightStart = 6;
+static const TimeValue kClawControlHighlightStop = 7;
+
+static const TimeValue kAlphaLaunchPrepStart = 7;
+static const TimeValue kAlphaLaunchPrepStop = 17;
+
+static const TimeValue kClawMenuStart = 17;
+static const TimeValue kClawMenuStop = 18;
+
+static const TimeValue kClawMenuTime = 18;
+
+static const TimeValue kDeltaSplashStart = 19;
+static const TimeValue kDeltaSplashStop = 21;
+
+static const TimeValue kDeltaLaunchPrepStart = 21;
+static const TimeValue kDeltaLaunchPrepStop = 30;
+
+// Right monitor times.
+
+static const NotificationFlags kAlphaSplashFinished = 1;
+static const NotificationFlags kAlphaPrepFinished = kAlphaSplashFinished << 1;
+static const NotificationFlags kPrepHighlightFinished = kAlphaPrepFinished << 1;
+static const NotificationFlags kClawHighlightFinished = kPrepHighlightFinished << 1;
+static const NotificationFlags kClawMenuFinished = kClawHighlightFinished << 1;
+static const NotificationFlags kDeltaSplashFinished = kClawMenuFinished << 1;
+static const NotificationFlags kDeltaPrepFinished = kDeltaSplashFinished << 1;
+
+static const NotificationFlags kSubControlNotificationFlags = kAlphaSplashFinished |
+ kAlphaPrepFinished |
+ kPrepHighlightFinished |
+ kClawHighlightFinished |
+ kClawMenuFinished |
+ kDeltaSplashFinished |
+ kDeltaPrepFinished;
+
+static const NotificationFlags kOneSecondOfMoveFinished = 1;
+
+static const NotificationFlags kGreenBallNotificationFlags = kOneSecondOfMoveFinished;
+
+enum {
+ kButtonDimFrame,
+ kButtonActiveFrame,
+ kButtonHighlightedFrame
+};
+
+enum {
+ kAlphaSplash,
+ kAlphaMainMenu,
+ kDeltaSplash,
+ kDeltaMainMenu,
+ kClawMenu,
+ kPlayingHighlight,
+ kPuttingClawAway
+};
+
+// The owning neighborhood must provide an array of longs which hold the various
+// extra IDs for moving the claw around. In addition, the owner must tell the sub
+// control room interaction what position the claw starts out in (which is also the
+// position the claw must be in before leaving).
+
+// Standard array indices:
+enum {
+ kClawFromAToBIndex,
+ kClawALoopIndex,
+ kClawAPinchIndex,
+ kClawACounterclockwiseIndex,
+ kClawAClockwiseIndex,
+ kClawFromBToAIndex,
+ kClawFromBToCIndex,
+ kClawFromBToDIndex,
+ kClawBLoopIndex,
+ kClawBPinchIndex,
+ kClawBCounterclockwiseIndex,
+ kClawBClockwiseIndex,
+ kClawFromCToBIndex,
+ kClawCLoopIndex,
+ kClawCPinchIndex,
+ kClawCCounterclockwiseIndex,
+ kClawCClockwiseIndex,
+ kClawFromDToBIndex,
+ kClawDLoopIndex,
+ kClawDPinchIndex,
+ kClawDCounterclockwiseIndex,
+ kClawDClockwiseIndex
+};
+
+// Action indices for s_clawStateTable:
+// Can also be used as indices into _buttons (except for kNoActionIndex and kLoopActionIndex).
+enum {
+ kNoActionIndex = -1,
+ kPinchActionIndex = 0,
+ kMoveDownActionIndex,
+ kMoveRightActionIndex,
+ kMoveLeftActionIndex,
+ kMoveUpActionIndex,
+ kCCWActionIndex,
+ kCWActionIndex,
+ kLoopActionIndex
+};
+
+/*
+ _currentAction and _nextAction:
+
+ At any time, _currentAction contains an action index (defined above). The current
+ action index is what the claw is doing right now. If the player presses a button
+ before the current action completes, _nextAction saves the new action and input
+ is disabled. This has the effect of implementing a queue of commands for the claw
+ that can save at most one extra command.
+
+ The general strategy for using _currentAction and _nextAction are:
+ -- If the player presses a claw button and _currentAction is kNoActionIndex,
+ do the command immediately and set _currentAction accordingly.
+ -- If the player presses a claw button and _currentAction is not kNoActionIndex,
+ save the appropriate action index in _nextAction.
+ -- When a command animation completes, set _nextAction to kNoActionIndex, then
+ check if _nextAction has a command waiting in it. If so, play the appriate
+ animation, copy _nextAction into _currentAction and set _nextAction to
+ kNoActionIndex.
+ -- If the player tries to get up, disable input (including all claw buttons) until
+ the player rises. Then, if the claw is in its original position, play the
+ animation of the player rising.
+ -- If the claw needs to be put back, play the first move required to put the
+ claw back by setting _currentAction and playing the appropriate animation.
+ Leave _nextAction alone. When the animation, completes, check to see if the
+ claw is in its original position or not. If so, complete the player rising
+ sequence by playing the rising animation. If not, repeat this whole step.
+
+ Using this general strategy allows the use of a single function,
+ DispatchClawAction, which can both cause the claw to perform a command and saving
+ the next command in _nextAction.
+*/
+
+// Array indexed by [claw position] [action]
+// array yields an index into the neighborhood's extra id table for claw animation or -1.
+static const int s_clawStateTable[4][8] = {
+ {
+ kClawAPinchIndex,
+ kNoActionIndex,
+ kNoActionIndex,
+ kClawFromAToBIndex,
+ kNoActionIndex,
+ kClawACounterclockwiseIndex,
+ kClawAClockwiseIndex,
+ kClawALoopIndex
+ },
+ {
+ kClawBPinchIndex,
+ kNoActionIndex,
+ kClawFromBToAIndex,
+ kClawFromBToDIndex,
+ kClawFromBToCIndex,
+ kClawBCounterclockwiseIndex,
+ kClawBClockwiseIndex,
+ kClawBLoopIndex
+ },
+ {
+ kClawCPinchIndex,
+ kClawFromCToBIndex,
+ kNoActionIndex,
+ kNoActionIndex,
+ kNoActionIndex,
+ kClawCCounterclockwiseIndex,
+ kClawCClockwiseIndex,
+ kClawCLoopIndex
+ },
+ {
+ kClawDPinchIndex,
+ kNoActionIndex,
+ kClawFromDToBIndex,
+ kNoActionIndex,
+ kNoActionIndex,
+ kClawDCounterclockwiseIndex,
+ kClawDClockwiseIndex,
+ kClawDLoopIndex
+ }
+};
+
+// Move directions for s_clawMovieTable:
+enum {
+ kMoveClawDown,
+ kMoveClawRight,
+ kMoveClawLeft,
+ kMoveClawUp
+};
+
+static const int kClawNowhere = -1;
+
+// Array indexed by [claw position] [move direction]
+// array yields new claw position or -1.
+static const int s_clawMovieTable[4][4] = {
+ {
+ kClawNowhere,
+ kClawNowhere,
+ kClawAtB,
+ kClawNowhere
+ },
+ {
+ kClawNowhere,
+ kClawAtA,
+ kClawAtD,
+ kClawAtC
+ },
+ {
+ kClawAtB,
+ kClawNowhere,
+ kClawNowhere,
+ kClawNowhere
+ },
+ {
+ kClawNowhere,
+ kClawAtB,
+ kClawNowhere,
+ kClawNowhere
+ }
+};
+
+// Indexed by claw action index, claw position, plus 0 for start, 1 for stop.
+// (Never indexed with kLoopActionIndex.)
+static const TimeValue s_clawMonitorTable[7][4][2] = {
+ {
+ { kAPinchStart, kAPinchStop },
+ { kBPinchStart, kBPinchStop },
+ { kCPinchStart, kCPinchStop },
+ { kDPinchStart, kDPinchStop }
+ },
+ {
+ { 0xffffffff, 0xffffffff },
+ { 0xffffffff, 0xffffffff },
+ { kCToBStart, kCToBStop },
+ { 0xffffffff, 0xffffffff }
+ },
+ {
+ { 0xffffffff, 0xffffffff },
+ { kBToAStart, kBToAStop },
+ { 0xffffffff, 0xffffffff },
+ { kDToBStart, kDToBStop }
+ },
+ {
+ { kAToBStart, kAToBStop },
+ { kBToDStart, kBToDStop },
+ { 0xffffffff, 0xffffffff },
+ { 0xffffffff, 0xffffffff }
+ },
+ {
+ { 0xffffffff, 0xffffffff },
+ { kBToCStart, kBToCStop },
+ { 0xffffffff, 0xffffffff },
+ { 0xffffffff, 0xffffffff }
+ },
+ {
+ { kACCWStart, kACCWStop },
+ { kBCCWStart, kBCCWStop },
+ { kCCCWStart, kCCCWStop },
+ { kDCCWStart, kDCCWStop }
+ },
+ {
+ { kACWStart, kACWStop },
+ { kBCWStart, kBCWStop },
+ { kCCWStart, kCCWStop },
+ { kDCWStart, kDCWStop }
+ }
+};
+
+// Frame indices for the green ball sprite.
+enum {
+ kGreenBallAtA,
+ kGreenBallAtAWithClaw,
+ kGreenBallAtAWithClawAndRobot,
+ kGreenBallAtB,
+ kGreenBallAtBWithClaw,
+ kGreenBallAtBWithClawAndRobot,
+ kGreenBallAtCArmAtA,
+ kGreenBallAtCArmAtB,
+ kGreenBallAtCArmAtD,
+ kGreenBallAtCWithClaw,
+ kGreenBallAtD,
+ kGreenBallAtDWithClaw,
+ kNumClawGreenBalls
+};
+
+// State constants for _robotState.
+enum {
+ kNoRobot,
+ kRobotApproaching,
+ kPunchingOnce,
+ kPunchingTwice,
+ kPunchingThrice,
+ kCarriedToDoor,
+ kPlayerWon,
+ kRobotWon
+};
+
+// Sub Control Room button PICTs:
+static const ResIDType kSubControlButtonBaseID = 500;
+static const ResIDType kClawMonitorGreenBallBaseID = 600;
+
+// Constructor
+SubControlRoom::SubControlRoom(Neighborhood *handler) : GameInteraction(kNoradSubControlRoomInteractionID, handler),
+ _subControlMovie(kSubControlMonitorID), _subControlNotification(kSubControlNotificationID, (PegasusEngine *)g_engine),
+ _clawMonitorMovie(kClawMonitorID), _pinchButton(kSubControlPinchID), _downButton(kSubControlDownID),
+ _rightButton(kSubControlRightID), _leftButton(kSubControlLeftID), _upButton(kSubControlUpID),
+ _ccwButton(kSubControlCCWID), _cwButton(kSubControlCWID), _greenBall(kClawMonitorGreenBallID),
+ _greenBallNotification(kNoradGreenBallNotificationID, (PegasusEngine *)g_engine) {
+ _neighborhoodNotification = handler->getNeighborhoodNotification();
+ _playingAgainstRobot = false;
+ _robotState = kNoRobot;
+}
+
+void SubControlRoom::playAgainstRobot() {
+ _playingAgainstRobot = true;
+}
+
+void SubControlRoom::openInteraction() {
+ _currentAction = kNoActionIndex;
+ _nextAction = kNoActionIndex;
+
+ Norad *owner = (Norad *)getOwner();
+ owner->getClawInfo(_outSpotID, _prepSpotID, _clawControlSpotID, _clawButtonSpotIDs[0],
+ _clawButtonSpotIDs[1], _clawButtonSpotIDs[2], _clawButtonSpotIDs[3],
+ _clawButtonSpotIDs[4], _clawButtonSpotIDs[5], _clawButtonSpotIDs[6],
+ _clawStartPosition, _clawExtraIDs);
+
+ _clawPosition = _clawStartPosition;
+ _clawNextPosition = _clawPosition;
+ _subControlMovie.initFromMovieFile("Images/Norad Alpha/N22 Left Monitor Movie");
+ _subControlMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _subControlMovie.moveElementTo(kNoradSubControlLeft, kNoradSubControlTop);
+ _subControlScale = _subControlMovie.getScale();
+ _subControlMovie.setDisplayOrder(kSubControlOrder);
+ _subControlMovie.startDisplaying();
+ _subControlCallBack.setNotification(&_subControlNotification);
+ _subControlCallBack.initCallBack(&_subControlMovie, kCallBackAtExtremes);
+
+ _clawMonitorMovie.initFromMovieFile("Images/Norad Alpha/N22:N60 Right Monitor");
+ _clawMonitorMovie.moveElementTo(kNoradClawMonitorLeft, kNoradClawMonitorTop);
+ _clawMonitorMovie.setDisplayOrder(kClawMonitorOrder);
+ _clawMonitorMovie.startDisplaying();
+ _clawMonitorCallBack.setNotification(&_subControlNotification);
+ _clawMonitorCallBack.initCallBack(&_clawMonitorMovie, kCallBackAtExtremes);
+
+ _subControlNotification.notifyMe(this, kSubControlNotificationFlags, kSubControlNotificationFlags);
+
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag, kExtraCompletedFlag);
+
+ _buttons[0] = &_pinchButton;
+ _buttons[1] = &_downButton;
+ _buttons[2] = &_rightButton;
+ _buttons[3] = &_leftButton;
+ _buttons[4] = &_upButton;
+ _buttons[5] = &_ccwButton;
+ _buttons[6] = &_cwButton;
+
+ _pinchButton.setDisplayOrder(kSubControlPinchOrder);
+ _downButton.setDisplayOrder(kSubControlDownOrder);
+ _rightButton.setDisplayOrder(kSubControlRightOrder);
+ _leftButton.setDisplayOrder(kSubControlLeftOrder);
+ _upButton.setDisplayOrder(kSubControlUpOrder);
+ _ccwButton.setDisplayOrder(kSubControlCCWOrder);
+ _cwButton.setDisplayOrder(kSubControlCWOrder);
+
+ for (int i = 0; i < kNumClawButtons; i++) {
+ SpriteFrame *frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kSubControlButtonBaseID + i * 3, true);
+ _buttons[i]->addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kSubControlButtonBaseID + i * 3 + 1, true);
+ _buttons[i]->addFrame(frame, 0, 0);
+
+ frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kSubControlButtonBaseID + i * 3 + 2, true);
+ _buttons[i]->addFrame(frame, 0, 0);
+
+ _buttons[i]->setCurrentFrameIndex(0);
+ _buttons[i]->startDisplaying();
+ }
+
+ _pinchButton.moveElementTo(kNoradSubControlPinchLeft, kNoradSubControlPinchTop);
+ _downButton.moveElementTo(kNoradSubControlDownLeft, kNoradSubControlDownTop);
+ _rightButton.moveElementTo(kNoradSubControlRightLeft, kNoradSubControlRightTop);
+ _leftButton.moveElementTo(kNoradSubControlLeftLeft, kNoradSubControlLeftTop);
+ _upButton.moveElementTo(kNoradSubControlUpLeft, kNoradSubControlUpTop);
+ _ccwButton.moveElementTo(kNoradSubControlCCWLeft, kNoradSubControlCCWTop);
+ _cwButton.moveElementTo(kNoradSubControlCWLeft, kNoradSubControlCWTop);
+
+ _greenBall.setDisplayOrder(kClawMonitorGreenBallOrder);
+
+ for (int i = 0; i < kNumClawGreenBalls; i++) {
+ SpriteFrame *frame = new SpriteFrame();
+ frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kClawMonitorGreenBallBaseID + i);
+ _greenBall.addFrame(frame, 0, 0);
+ }
+
+ _greenBall.setCurrentFrameIndex(0);
+ _greenBall.startDisplaying();
+
+ _greenBallTimer.setScale(owner->getNavMovie()->getScale());
+ _greenBallCallBack.setNotification(&_greenBallNotification);
+ _greenBallCallBack.initCallBack(&_greenBallTimer, kCallBackAtExtremes);
+ _greenBallCallBack.setCallBackFlag(kOneSecondOfMoveFinished);
+ _greenBallNotification.notifyMe(this, kGreenBallNotificationFlags, kGreenBallNotificationFlags);
+
+ _subControlMovie.show();
+ _clawMonitorMovie.show();
+}
+
+void SubControlRoom::initInteraction() {
+ if (GameState.getNoradSubPrepState() == kSubDamaged) {
+ playControlMonitorSection(kDeltaSplashStart * _subControlScale, kDeltaSplashStop * _subControlScale,
+ 0, kDeltaSplash, false);
+ playClawMonitorSection(kDeltaClawSplashStart, kDeltaClawSplashStop, kDeltaSplashFinished, _gameState, false);
+ } else {
+ playControlMonitorSection(kAlphaSplashStart * _subControlScale, kAlphaSplashStop * _subControlScale,
+ 0, kAlphaSplash, false);
+ playClawMonitorSection(kAlphaClawSplashStart, kAlphaClawSplashStop, kAlphaSplashFinished, _gameState, false);
+ }
+
+ _subControlMovie.redrawMovieWorld();
+ _clawMonitorMovie.redrawMovieWorld();
+}
+
+void SubControlRoom::closeInteraction() {
+ _subControlNotification.cancelNotification(this);
+ _subControlCallBack.releaseCallBack();
+ _greenBallNotification.cancelNotification(this);
+ _greenBallCallBack.releaseCallBack();
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void SubControlRoom::setSoundFXLevel(const uint16 fxLevel) {
+ _subControlMovie.setVolume(fxLevel);
+}
+
+void SubControlRoom::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ Norad *owner = (Norad *)getOwner();
+
+ if (notification == &_subControlNotification) {
+ switch (flags) {
+ case kAlphaSplashFinished:
+ setControlMonitorToTime(kMainMenuTime * _subControlScale, kAlphaMainMenu, true);
+ break;
+ case kPrepHighlightFinished:
+ if (GameState.getNoradSubPrepState() == kSubDamaged)
+ playControlMonitorSection(kDeltaLaunchPrepStart * _subControlScale,
+ kDeltaLaunchPrepStop * _subControlScale, kDeltaPrepFinished, _gameState, false);
+ else
+ playControlMonitorSection(kAlphaLaunchPrepStart * _subControlScale,
+ kAlphaLaunchPrepStop * _subControlScale, kAlphaPrepFinished, _gameState, false);
+ break;
+ case kAlphaPrepFinished:
+ GameState.setNoradSubPrepState(kSubPrepped);
+ GameState.setScoringPreppedSub(true);
+ setControlMonitorToTime(kMainMenuTime * _subControlScale, kAlphaMainMenu, true);
+ break;
+ case kClawHighlightFinished:
+ playControlMonitorSection(kClawMenuStart * _subControlScale, kClawMenuStop * _subControlScale,
+ kClawMenuFinished, _gameState, false);
+ break;
+ case kClawMenuFinished:
+ owner->playClawMonitorIntro();
+ showButtons();
+ setControlMonitorToTime(kClawMenuTime * _subControlScale, kClawMenu, true);
+
+ if (!_playingAgainstRobot) {
+ updateClawMonitor();
+ owner->loopExtraSequence(_clawExtraIDs[s_clawStateTable[_clawPosition][kLoopActionIndex]]);
+ }
+ break;
+ case kDeltaSplashFinished:
+ setControlMonitorToTime(kMainMenuTime * _subControlScale, kDeltaMainMenu, true);
+
+ if (_playingAgainstRobot) {
+ _robotState = kRobotApproaching;
+ playClawMonitorSection(kRobotApproachStart, kRobotApproachStop, 0, _gameState, true);
+ owner->startExtraSequence(kN60RobotApproaches, kExtraCompletedFlag, kFilterAllInput);
+ }
+ break;
+ case kDeltaPrepFinished:
+ setControlMonitorToTime(kMainMenuTime * _subControlScale, kDeltaMainMenu, true);
+ break;
+ }
+ } else if (notification == &_greenBallNotification) {
+ if (_robotState == kRobotWon) {
+ // We are using the green ball notification to hide stuff when the robot comes through
+ // the glass.
+ hideEverything();
+ } else {
+ // We are now midway through a move, time to update the claw's position and the green
+ // ball.
+ _clawPosition = _clawNextPosition;
+ updateClawMonitor();
+ updateGreenBall();
+ }
+ } else if (notification == _neighborhoodNotification) {
+ _currentAction = kNoActionIndex;
+ if (_playingAgainstRobot) {
+ switch (_robotState) {
+ case kRobotApproaching:
+ if (_gameState == kClawMenu) {
+ _robotState = kPunchingOnce;
+ dispatchClawAction(kNoActionIndex);
+ } else {
+ robotKillsPlayer(kN60FirstMistake, owner);
+ }
+ break;
+ case kPunchingOnce:
+ if (_nextAction == kMoveDownActionIndex) {
+ _robotState = kPunchingTwice;
+ performActionImmediately(_nextAction, _clawExtraIDs[s_clawStateTable[_clawPosition][_nextAction]], owner);
+ } else {
+ robotKillsPlayer(kN60SecondMistake, owner);
+ }
+ break;
+ case kPunchingTwice:
+ if (_nextAction == kPinchActionIndex) {
+ _robotState = kPunchingThrice;
+ performActionImmediately(_nextAction, _clawExtraIDs[s_clawStateTable[_clawPosition][_nextAction]], owner);
+ } else {
+ robotKillsPlayer(kN60ThirdMistake, owner);
+ }
+ break;
+ case kPunchingThrice:
+ if (_nextAction == kMoveRightActionIndex) {
+ _robotState = kCarriedToDoor;
+ performActionImmediately(_nextAction, _clawExtraIDs[s_clawStateTable[_clawPosition][_nextAction]], owner);
+ } else {
+ robotKillsPlayer(kN60FourthMistake, owner);
+ }
+ break;
+ case kCarriedToDoor:
+ hideEverything();
+ _robotState = kPlayerWon;
+ owner->startExtraSequence(kN60PlayerFollowsRobotToDoor, kExtraCompletedFlag, kFilterAllInput);
+ break;
+ case kPlayerWon:
+ ((NoradDelta *)owner)->playerBeatRobotWithClaw();
+ owner->requestDeleteCurrentInteraction();
+ break;
+ case kRobotWon:
+ g_system->delayMillis(2 * 1000); // 120 ticks
+ ((PegasusEngine *)g_engine)->die(kDeathRobotSubControlRoom);
+ break;
+ }
+ } else {
+ if (_gameState == kPuttingClawAway && _nextAction == kNoActionIndex) {
+ if (_clawPosition == _clawStartPosition) {
+ Input scratch;
+ GameInteraction::clickInHotspot(scratch, g_allHotspots.findHotspotByID(_outSpotID));
+ } else {
+ switch (_clawPosition) {
+ case kClawAtA:
+ dispatchClawAction(kMoveLeftActionIndex);
+ break;
+ case kClawAtB:
+ if (_clawStartPosition == kClawAtD) // Norad Alpha
+ dispatchClawAction(kMoveLeftActionIndex);
+ else if (_clawStartPosition == kClawAtC) // Norad Delta
+ dispatchClawAction(kMoveUpActionIndex);
+ break;
+ case kClawAtC:
+ dispatchClawAction(kMoveDownActionIndex);
+ break;
+ case kClawAtD:
+ dispatchClawAction(kMoveRightActionIndex);
+ break;
+ }
+ }
+ } else {
+ dispatchClawAction(_nextAction);
+ }
+ }
+ }
+}
+
+void SubControlRoom::hideEverything() {
+ hideButtons();
+ _subControlMovie.hide();
+ _clawMonitorMovie.hide();
+ _greenBall.hide();
+}
+
+void SubControlRoom::robotKillsPlayer(const uint32 extraID, Neighborhood *owner) {
+ _robotState = kRobotWon;
+ owner->startExtraSequence(extraID, kExtraCompletedFlag, kFilterAllInput);
+ _greenBallTimer.stop();
+ _greenBallTimer.setSegment(0, 32 * _greenBallTimer.getScale() / 15);
+ _greenBallTimer.setTime(0);
+ _greenBallCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _greenBallTimer.start();
+}
+
+void SubControlRoom::activateHotspots() {
+ if (_robotState == kRobotWon || _robotState == kPlayerWon)
+ return;
+
+ GameInteraction::activateHotspots();
+
+ switch (_gameState) {
+ case kAlphaMainMenu:
+ case kDeltaMainMenu:
+ g_allHotspots.activateOneHotspot(_prepSpotID);
+ g_allHotspots.activateOneHotspot(_clawControlSpotID);
+ break;
+ case kClawMenu:
+ // This could be called during a move, so use _clawNextPosition.
+ if (_playingAgainstRobot) {
+ g_allHotspots.deactivateOneHotspot(_outSpotID);
+ if (_robotState != kRobotApproaching && _nextAction == kNoActionIndex)
+ for (int i = 0; i < kNumClawButtons; i++)
+ if (s_clawStateTable[_clawNextPosition][i] != kNoActionIndex)
+ g_allHotspots.activateOneHotspot(_clawButtonSpotIDs[i]);
+ } else if (_nextAction == kNoActionIndex) {
+ for (int i = 0; i < kNumClawButtons; i++)
+ if (s_clawStateTable[_clawNextPosition][i] != kNoActionIndex)
+ g_allHotspots.activateOneHotspot(_clawButtonSpotIDs[i]);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void SubControlRoom::showButtons() {
+ if (_playingAgainstRobot && _robotState == kRobotApproaching) {
+ for (int i = 0; i < kNumClawButtons; i++) {
+ _buttons[i]->show();
+ _buttons[i]->setCurrentFrameIndex(kButtonDimFrame);
+ }
+ } else if (_nextAction != kNoActionIndex) {
+ for (int i = 0; i < kNumClawButtons; i++) {
+ _buttons[i]->show();
+ if (i == _currentAction || i == _nextAction)
+ _buttons[i]->setCurrentFrameIndex(kButtonHighlightedFrame);
+ else
+ _buttons[i]->setCurrentFrameIndex(kButtonDimFrame);
+ }
+ } else {
+ for (int i = 0; i < kNumClawButtons; i++) {
+ _buttons[i]->show();
+ if (i == _currentAction)
+ _buttons[i]->setCurrentFrameIndex(kButtonHighlightedFrame);
+ else if (s_clawStateTable[_clawNextPosition][i] != kNoActionIndex &&
+ _gameState != kPuttingClawAway) // this could be called during a move, so check _clawNextPosition
+ _buttons[i]->setCurrentFrameIndex(kButtonActiveFrame);
+ else
+ _buttons[i]->setCurrentFrameIndex(kButtonDimFrame);
+ }
+ }
+}
+
+void SubControlRoom::hideButtons() {
+ for (int i = 0; i < kNumClawButtons; i++)
+ _buttons[i]->hide();
+}
+
+int SubControlRoom::findActionIndex(HotSpotID id) {
+ for (int i = 0; i < kNumClawButtons; i++)
+ if (id == _clawButtonSpotIDs[i])
+ return i;
+
+ return kNoActionIndex;
+}
+
+void SubControlRoom::clickInHotspot(const Input &input, const Hotspot *spot) {
+ HotSpotID clickedID = spot->getObjectID();
+ int actionIndex = findActionIndex(clickedID);
+
+ if (actionIndex != kNoActionIndex) {
+ dispatchClawAction(actionIndex);
+ } else if (clickedID == _prepSpotID) {
+ playControlMonitorSection(kLaunchPrepHighlightStart * _subControlScale,
+ kLaunchPrepHighlightStop * _subControlScale,
+ kPrepHighlightFinished, kPlayingHighlight, false);
+ } else if (clickedID == _clawControlSpotID) {
+ playControlMonitorSection(kClawControlHighlightStart * _subControlScale,
+ kClawControlHighlightStop * _subControlScale,
+ kClawHighlightFinished, kPlayingHighlight, false);
+ } else if (clickedID == _outSpotID) {
+ _gameState = kPuttingClawAway;
+
+ if (_currentAction == kNoActionIndex) {
+ if (_clawPosition == _clawStartPosition) {
+ GameInteraction::clickInHotspot(input, spot);
+ } else {
+ switch (_clawPosition) {
+ case kClawAtA:
+ dispatchClawAction(kMoveLeftActionIndex);
+ break;
+ case kClawAtB:
+ if (_clawStartPosition == kClawAtD) // Norad Alpha
+ dispatchClawAction(kMoveLeftActionIndex);
+ else if (_clawStartPosition == kClawAtC) // Norad Delta
+ dispatchClawAction(kMoveUpActionIndex);
+ break;
+ case kClawAtC:
+ dispatchClawAction(kMoveDownActionIndex);
+ break;
+ case kClawAtD:
+ dispatchClawAction(kMoveRightActionIndex);
+ break;
+ }
+ }
+ }
+ } else {
+ GameInteraction::clickInHotspot(input, spot);
+ }
+}
+
+void SubControlRoom::dispatchClawAction(const int newAction) {
+ GameState.setScoringPlayedWithClaw(true);
+
+ Neighborhood *owner = getOwner();
+
+ if (newAction == kNoActionIndex) {
+ _currentAction = kNoActionIndex;
+ _nextAction = kNoActionIndex;
+ showButtons();
+ updateGreenBall();
+
+ if (_playingAgainstRobot)
+ owner->startExtraSequence(kN60ArmActivated, kExtraCompletedFlag, kFilterAllInput);
+ else
+ owner->loopExtraSequence(_clawExtraIDs[s_clawStateTable[_clawPosition][kLoopActionIndex]]);
+ } else {
+ if (_currentAction == kNoActionIndex) {
+ if (_playingAgainstRobot) {
+ _nextAction = newAction;
+ showButtons();
+ updateGreenBall();
+ } else {
+ performActionImmediately(newAction, _clawExtraIDs[s_clawStateTable[_clawPosition][newAction]], owner);
+ }
+ } else if (_nextAction == kNoActionIndex) {
+ _nextAction = newAction;
+ showButtons();
+ updateGreenBall();
+ }
+ }
+}
+
+void SubControlRoom::performActionImmediately(const int action, const uint32 extraID, Neighborhood *owner) {
+ _currentAction = action;
+ _nextAction = kNoActionIndex;
+ ExtraTable::Entry entry;
+
+ switch (action) {
+ case kMoveDownActionIndex:
+ case kMoveRightActionIndex:
+ case kMoveLeftActionIndex:
+ case kMoveUpActionIndex:
+ // Set up green ball callback.
+ owner->getExtraEntry(extraID, entry);
+ _greenBallTimer.stop();
+ _greenBallTimer.setSegment(entry.movieStart, entry.movieStart + owner->getNavMovie()->getScale());
+ _greenBallTimer.setTime(entry.movieStart);
+ _greenBallCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ // Start move.
+ _greenBallTimer.start();
+ break;
+ }
+
+ if (_playingAgainstRobot) {
+ switch (_robotState) {
+ case kPunchingTwice:
+ owner->startExtraSequence(kN60ArmToPositionB, kExtraCompletedFlag, kFilterAllInput);
+ break;
+ case kPunchingThrice:
+ owner->startExtraSequence(kN60ArmGrabsRobot, kExtraCompletedFlag, kFilterAllInput);
+ break;
+ case kCarriedToDoor:
+ owner->startExtraSequence(kN60ArmCarriesRobotToPositionA, kExtraCompletedFlag, kFilterAllInput);
+ break;
+ }
+ } else {
+ owner->startExtraSequence(extraID, kExtraCompletedFlag, kFilterAllInput);
+ }
+
+ switch (action) {
+ case kMoveDownActionIndex:
+ _clawNextPosition = s_clawMovieTable[_clawPosition][kMoveClawDown];
+ break;
+ case kMoveRightActionIndex:
+ _clawNextPosition = s_clawMovieTable[_clawPosition][kMoveClawRight];
+ break;
+ case kMoveLeftActionIndex:
+ _clawNextPosition = s_clawMovieTable[_clawPosition][kMoveClawLeft];
+ break;
+ case kMoveUpActionIndex:
+ _clawNextPosition = s_clawMovieTable[_clawPosition][kMoveClawUp];
+ break;
+ case kLoopActionIndex:
+ // Do nothing.
+ break;
+ default:
+ playClawMonitorSection(s_clawMonitorTable[action][_clawPosition][0],
+ s_clawMonitorTable[action][_clawPosition][1], 0, _gameState, true);
+ break;
+ }
+
+ showButtons();
+ updateGreenBall();
+}
+
+void SubControlRoom::setControlMonitorToTime(const TimeValue newTime, const int newState, const bool shouldAllowInput) {
+ _subControlMovie.stop();
+ _subControlMovie.setSegment(0, _subControlMovie.getDuration());
+ _subControlMovie.setTime(newTime);
+ _subControlMovie.redrawMovieWorld();
+ _gameState = newState;
+ allowInput(shouldAllowInput);
+}
+
+void SubControlRoom::playControlMonitorSection(const TimeValue in, const TimeValue out, const NotificationFlags flags,
+ const int newState, const bool shouldAllowInput) {
+ _subControlMovie.stop();
+ _subControlMovie.setSegment(in, out);
+ _subControlMovie.setTime(in);
+
+ if (flags != 0) {
+ _subControlCallBack.setCallBackFlag(flags);
+ _subControlCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ _gameState = newState;
+ allowInput(shouldAllowInput);
+ _subControlMovie.start();
+}
+
+void SubControlRoom::updateClawMonitor() {
+ switch (_clawPosition) {
+ case kClawAtA:
+ setClawMonitorToTime(kClawAtATime);
+ break;
+ case kClawAtB:
+ setClawMonitorToTime(kClawAtBTime);
+ break;
+ case kClawAtC:
+ setClawMonitorToTime(kClawAtCTime);
+ break;
+ case kClawAtD:
+ setClawMonitorToTime(kClawAtDTime);
+ break;
+ }
+}
+
+void SubControlRoom::setClawMonitorToTime(const TimeValue newTime) {
+ _clawMonitorMovie.stop();
+ _clawMonitorMovie.setSegment(0, _clawMonitorMovie.getDuration());
+ _clawMonitorMovie.setTime(newTime);
+ _clawMonitorMovie.redrawMovieWorld();
+}
+
+void SubControlRoom::playClawMonitorSection(const TimeValue in, const TimeValue out, const NotificationFlags flags,
+ const int newState, const bool shouldAllowInput) {
+ _clawMonitorMovie.stop();
+ _clawMonitorMovie.setSegment(in, out);
+ _clawMonitorMovie.setTime(in);
+
+ if (flags != 0) {
+ _clawMonitorCallBack.setCallBackFlag(flags);
+ _clawMonitorCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ }
+
+ _gameState = newState;
+ allowInput(shouldAllowInput);
+ _clawMonitorMovie.start();
+}
+
+void SubControlRoom::updateGreenBall() {
+ switch (_currentAction) {
+ case kMoveDownActionIndex:
+ switch (_nextAction) {
+ case kMoveRightActionIndex:
+ moveGreenBallToA();
+ break;
+ case kMoveLeftActionIndex:
+ moveGreenBallToD();
+ break;
+ case kMoveUpActionIndex:
+ moveGreenBallToC();
+ break;
+ default:
+ moveGreenBallToB();
+ break;
+ }
+ break;
+ case kMoveRightActionIndex:
+ if (_clawNextPosition == kClawAtA) {
+ switch (_nextAction) {
+ case kMoveLeftActionIndex:
+ moveGreenBallToB();
+ break;
+ default:
+ moveGreenBallToA();
+ break;
+ }
+ } else {
+ switch (_nextAction) {
+ case kMoveRightActionIndex:
+ moveGreenBallToA();
+ break;
+ case kMoveLeftActionIndex:
+ moveGreenBallToD();
+ break;
+ case kMoveUpActionIndex:
+ moveGreenBallToC();
+ break;
+ default:
+ moveGreenBallToB();
+ break;
+ }
+ }
+ break;
+ case kMoveLeftActionIndex:
+ if (_clawNextPosition == kClawAtB) {
+ switch (_nextAction) {
+ case kMoveRightActionIndex:
+ moveGreenBallToA();
+ break;
+ case kMoveLeftActionIndex:
+ moveGreenBallToD();
+ break;
+ case kMoveUpActionIndex:
+ moveGreenBallToC();
+ break;
+ default:
+ moveGreenBallToB();
+ break;
+ }
+ } else {
+ switch (_nextAction) {
+ case kMoveRightActionIndex:
+ moveGreenBallToB();
+ break;
+ default:
+ moveGreenBallToD();
+ break;
+ }
+ }
+ break;
+ case kMoveUpActionIndex:
+ switch (_nextAction) {
+ case kMoveDownActionIndex:
+ moveGreenBallToB();
+ break;
+ default:
+ moveGreenBallToC();
+ break;
+ }
+ break;
+ default:
+ switch (_nextAction) {
+ case kMoveDownActionIndex:
+ moveGreenBallToB();
+ break;
+ case kMoveRightActionIndex:
+ if (_clawPosition == kClawAtB)
+ moveGreenBallToA();
+ else
+ moveGreenBallToB();
+ break;
+ case kMoveLeftActionIndex:
+ if (_clawPosition == kClawAtB)
+ moveGreenBallToD();
+ else
+ moveGreenBallToB();
+ break;
+ case kMoveUpActionIndex:
+ moveGreenBallToC();
+ break;
+ default:
+ _greenBall.hide();
+ break;
+ }
+ break;
+ }
+}
+
+void SubControlRoom::moveGreenBallToA() {
+ if (_clawPosition == kClawAtA) {
+ if (_playingAgainstRobot)
+ _greenBall.setCurrentFrameIndex(kGreenBallAtAWithClawAndRobot);
+ else
+ _greenBall.setCurrentFrameIndex(kGreenBallAtAWithClaw);
+ } else {
+ _greenBall.setCurrentFrameIndex(kGreenBallAtA);
+ }
+
+ _greenBall.moveElementTo(kNoradGreenBallAtALeft, kNoradGreenBallAtATop);
+ _greenBall.show();
+}
+
+void SubControlRoom::moveGreenBallToB() {
+ if (_clawPosition == kClawAtB) {
+ if (_playingAgainstRobot)
+ _greenBall.setCurrentFrameIndex(kGreenBallAtBWithClawAndRobot);
+ else
+ _greenBall.setCurrentFrameIndex(kGreenBallAtBWithClaw);
+ } else {
+ _greenBall.setCurrentFrameIndex(kGreenBallAtB);
+ }
+
+ _greenBall.moveElementTo(kNoradGreenBallAtBLeft, kNoradGreenBallAtBTop);
+ _greenBall.show();
+}
+
+void SubControlRoom::moveGreenBallToC() {
+ switch (_clawPosition) {
+ case kClawAtA:
+ _greenBall.setCurrentFrameIndex(kGreenBallAtCArmAtA);
+ break;
+ case kClawAtB:
+ _greenBall.setCurrentFrameIndex(kGreenBallAtCArmAtB);
+ break;
+ case kClawAtC:
+ _greenBall.setCurrentFrameIndex(kGreenBallAtCWithClaw);
+ break;
+ case kClawAtD:
+ _greenBall.setCurrentFrameIndex(kGreenBallAtCArmAtD);
+ break;
+ }
+
+ _greenBall.moveElementTo(kNoradGreenBallAtCLeft, kNoradGreenBallAtCTop);
+ _greenBall.show();
+}
+
+void SubControlRoom::moveGreenBallToD() {
+ if (_clawPosition == kClawAtD)
+ _greenBall.setCurrentFrameIndex(kGreenBallAtDWithClaw);
+ else
+ _greenBall.setCurrentFrameIndex(kGreenBallAtD);
+
+ _greenBall.moveElementTo(kNoradGreenBallAtDLeft, kNoradGreenBallAtDTop);
+ _greenBall.show();
+}
+
+bool SubControlRoom::canSolve() {
+ return _playingAgainstRobot && _robotState < kCarriedToDoor;
+}
+
+void SubControlRoom::doSolve() {
+ _robotState = kCarriedToDoor;
+ hideEverything();
+ getOwner()->startExtraSequence(kN60ArmGrabsRobot, kExtraCompletedFlag, kFilterAllInput);
+}
+
+InputBits SubControlRoom::getInputFilter() {
+ if (_playingAgainstRobot)
+ return GameInteraction::getInputFilter() & ~kFilterDownButtonAny;
+
+ return GameInteraction::getInputFilter();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/subcontrolroom.h b/engines/pegasus/neighborhood/norad/subcontrolroom.h
new file mode 100644
index 0000000000..6ce599db42
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/subcontrolroom.h
@@ -0,0 +1,133 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_SUBCONTROLROOM_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_SUBCONTROLROOM_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/notification.h"
+
+namespace Pegasus {
+
+static const uint32 kClawAtA = 0;
+static const uint32 kClawAtB = 1;
+static const uint32 kClawAtC = 2;
+static const uint32 kClawAtD = 3;
+
+static const int kNumClawButtons = 7;
+
+class Norad;
+
+class SubControlRoom : public GameInteraction, public NotificationReceiver {
+public:
+ SubControlRoom(Neighborhood *);
+ virtual ~SubControlRoom() {}
+
+ void playAgainstRobot();
+
+ virtual void setSoundFXLevel(const uint16);
+
+ bool canSolve();
+ void doSolve();
+
+protected:
+ virtual void openInteraction();
+ virtual void initInteraction();
+ virtual void closeInteraction();
+
+ virtual void activateHotspots();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ void robotKillsPlayer(const uint32, Neighborhood *);
+ InputBits getInputFilter();
+
+ int findActionIndex(HotSpotID);
+ void dispatchClawAction(const int);
+ void performActionImmediately(const int, const uint32, Neighborhood *);
+
+ void hideEverything();
+ void showButtons();
+ void hideButtons();
+
+ void updateGreenBall();
+ void moveGreenBallToA();
+ void moveGreenBallToB();
+ void moveGreenBallToC();
+ void moveGreenBallToD();
+
+ void setControlMonitorToTime(const TimeValue, const int, const bool);
+ void playControlMonitorSection(const TimeValue, const TimeValue, const NotificationFlags,
+ const int, const bool);
+
+ void updateClawMonitor();
+ void setClawMonitorToTime(const TimeValue);
+ void playClawMonitorSection(const TimeValue, const TimeValue, const NotificationFlags,
+ const int, const bool);
+
+ Movie _subControlMovie;
+ TimeScale _subControlScale;
+ Notification _subControlNotification;
+ NotificationCallBack _subControlCallBack;
+ Movie _clawMonitorMovie;
+ NotificationCallBack _clawMonitorCallBack;
+ int _gameState;
+ uint32 _clawStartPosition;
+ uint32 _clawPosition;
+ uint32 _clawNextPosition;
+ const uint32 *_clawExtraIDs;
+
+ int _currentAction;
+ int _nextAction;
+
+ Sprite *_buttons[kNumClawButtons];
+ Sprite _pinchButton;
+ Sprite _downButton;
+ Sprite _rightButton;
+ Sprite _leftButton;
+ Sprite _upButton;
+ Sprite _ccwButton;
+ Sprite _cwButton;
+
+ Sprite _greenBall;
+ TimeBase _greenBallTimer;
+ Notification _greenBallNotification;
+ NotificationCallBack _greenBallCallBack;
+
+ HotSpotID _outSpotID;
+ HotSpotID _prepSpotID;
+ HotSpotID _clawControlSpotID;
+ HotSpotID _clawButtonSpotIDs[kNumClawButtons];
+
+ Notification *_neighborhoodNotification;
+
+ bool _playingAgainstRobot;
+ int _robotState;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/subplatform.cpp b/engines/pegasus/neighborhood/norad/subplatform.cpp
new file mode 100644
index 0000000000..97079a9f53
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/subplatform.cpp
@@ -0,0 +1,205 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/subplatform.h"
+#include "pegasus/neighborhood/norad/alpha/noradalpha.h"
+
+namespace Pegasus {
+
+// As usual, times here are in seconds.
+
+static const TimeValue kNormalSplashStart = 0;
+static const TimeValue kNormalSplashStop = 5;
+
+static const TimeValue kPrepSubStart = 5;
+static const TimeValue kPrepSubStop = 15;
+
+static const TimeValue kPrepIncompleteStart = 15;
+static const TimeValue kPrepIncompleteStop = 19;
+
+static const TimeValue kDamagedStart = 19;
+static const TimeValue kDamagedStop = 28;
+
+static const NotificationFlags kNormalSplashFinished = 1;
+static const NotificationFlags kPrepSubFinished = kNormalSplashFinished << 1;
+static const NotificationFlags kPrepIncompleteFinished = kPrepSubFinished << 1;
+static const NotificationFlags kDamagedFinished = kPrepIncompleteFinished << 1;
+
+static const NotificationFlags kPlatformNotificationFlags = kNormalSplashFinished |
+ kPrepSubFinished |
+ kPrepIncompleteFinished |
+ kDamagedFinished;
+
+static const uint16 kSubPreppedBit = (1 << 0);
+static const uint16 kWaitingForPlayerBit = (1 << 1);
+
+SubPlatform::SubPlatform(Neighborhood *handler) : GameInteraction(kNoradSubPlatformInteractionID, handler),
+ _platformMovie(kPlatformMonitorID), _platformNotification(kNoradSubPlatformNotificationID, (PegasusEngine *)g_engine) {
+ _neighborhoodNotification = handler->getNeighborhoodNotification();
+}
+
+void SubPlatform::openInteraction() {
+ _stateBits = 0;
+
+ // TODO: These next two lines seem unused?
+ if (GameState.getNoradSubPrepState() == kSubPrepped)
+ _stateBits |= kSubPreppedBit;
+
+ _stateBits |= kWaitingForPlayerBit;
+ _platformMovie.initFromMovieFile("Images/Norad Alpha/Platform Monitor Movie");
+ _platformMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _platformMovie.moveElementTo(kNoradPlatformLeft, kNoradPlatformTop);
+ _platformScale = _platformMovie.getScale();
+ _platformMovie.setDisplayOrder(kPlatformOrder);
+ _platformMovie.startDisplaying();
+ _platformCallBack.setNotification(&_platformNotification);
+ _platformCallBack.initCallBack(&_platformMovie, kCallBackAtExtremes);
+
+ _platformNotification.notifyMe(this, kPlatformNotificationFlags, kPlatformNotificationFlags);
+}
+
+void SubPlatform::initInteraction() {
+ _neighborhoodNotification->notifyMe(this, kExtraCompletedFlag, kExtraCompletedFlag);
+}
+
+void SubPlatform::closeInteraction() {
+ _platformNotification.cancelNotification(this);
+ _platformCallBack.releaseCallBack();
+ _neighborhoodNotification->cancelNotification(this);
+}
+
+void SubPlatform::setSoundFXLevel(const uint16 fxLevel) {
+ _platformMovie.setVolume(fxLevel);
+}
+
+void SubPlatform::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ FaderMoveSpec loop1Spec, loop2Spec;
+ ExtraTable::Entry entry;
+
+ Norad *owner = (Norad *)getOwner();
+
+ if (notification == &_platformNotification) {
+ switch (flags) {
+ case kNormalSplashFinished:
+ _platformMovie.stop();
+ switch (GameState.getNoradSubPrepState()) {
+ case kSubNotPrepped:
+ _platformMovie.setSegment(kPrepIncompleteStart * _platformScale, kPrepIncompleteStop * _platformScale);
+ _platformMovie.setTime(kPrepIncompleteStart * _platformScale);
+ _platformCallBack.setCallBackFlag(kPrepIncompleteFinished);
+ _platformCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _platformMovie.start();
+ break;
+ case kSubPrepped:
+ _platformMovie.setSegment(kPrepSubStart * _platformScale, kPrepSubStop * _platformScale);
+ _platformMovie.setTime(kPrepSubStart * _platformScale);
+ _platformCallBack.setCallBackFlag(kPrepSubFinished);
+ _platformCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ owner->startExtraSequence(kNorad19PrepSub, 0, kFilterNoInput);
+ _platformMovie.start();
+ break;
+ case kSubDamaged:
+ // Shouldn't happen.
+ break;
+ }
+ break;
+ case kPrepSubFinished:
+ _platformMovie.stop();
+ _platformMovie.stopDisplaying();
+
+ owner->getExtraEntry(kNorad19ExitToSub, entry);
+
+ loop1Spec.makeTwoKnotFaderSpec(kNoradAlphaMovieScale, 0, kNoradWarningVolume,
+ entry.movieEnd - entry.movieStart, 0);
+ loop1Spec.insertFaderKnot(4560, kNoradWarningVolume);
+ loop1Spec.insertFaderKnot(5080, 0);
+
+ loop2Spec.makeTwoKnotFaderSpec(kNoradAlphaMovieScale, 0, kNoradSuckWindVolume,
+ entry.movieEnd - entry.movieStart, 0);
+ loop1Spec.insertFaderKnot(4560, kNoradSuckWindVolume);
+ loop1Spec.insertFaderKnot(5080, 0);
+
+ owner->startExtraSequence(kNorad19ExitToSub, kExtraCompletedFlag, kFilterNoInput);
+
+ owner->startLoop1Fader(loop1Spec);
+ owner->startLoop2Fader(loop2Spec);
+ break;
+ case kPrepIncompleteFinished:
+ ((NoradAlpha *)owner)->setSubPrepFailed(true);
+ g_AIArea->checkMiddleArea();
+ // Fall through...
+ case kDamagedFinished:
+ _platformMovie.stop();
+ _platformMovie.hide();
+ _stateBits |= kWaitingForPlayerBit;
+ allowInput(true);
+ break;
+ }
+ } else if (notification == _neighborhoodNotification) {
+ allowInput(true);
+ ((PegasusEngine *)g_engine)->jumpToNewEnvironment(kNoradSubChaseID, kNoRoomID, kNoDirection);
+ GameState.setScoringEnteredSub(true);
+ }
+}
+
+void SubPlatform::activateHotspots() {
+ if (_stateBits & kWaitingForPlayerBit)
+ g_allHotspots.activateOneHotspot(kNorad19ActivateMonitorSpotID);
+
+ GameInteraction::activateHotspots();
+}
+
+void SubPlatform::clickInHotspot(const Input &input, const Hotspot *spot) {
+ if (spot->getObjectID() == kNorad19ActivateMonitorSpotID) {
+ if (GameState.getNoradSubPrepState() == kSubDamaged) {
+ _platformMovie.setSegment(kDamagedStart * _platformScale, kDamagedStop * _platformScale);
+ _platformMovie.setTime(kDamagedStart * _platformScale);
+ _platformCallBack.setCallBackFlag(kDamagedFinished);
+ } else {
+ _platformMovie.setSegment(kNormalSplashStart * _platformScale, kNormalSplashStop * _platformScale);
+ _platformMovie.setTime(kNormalSplashStart * _platformScale);
+ _platformCallBack.setCallBackFlag(kNormalSplashFinished);
+ }
+
+ _platformCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ _platformMovie.show();
+ _platformMovie.start();
+ _platformMovie.redrawMovieWorld();
+
+ _stateBits &= ~kWaitingForPlayerBit;
+
+ allowInput(false);
+ } else {
+ GameInteraction::clickInHotspot(input, spot);
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/subplatform.h b/engines/pegasus/neighborhood/norad/subplatform.h
new file mode 100644
index 0000000000..82e86ecae2
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/subplatform.h
@@ -0,0 +1,63 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_NORAD_SUBPLATFORM_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_SUBPLATFORM_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+class SubPlatform : public GameInteraction, public NotificationReceiver {
+public:
+ SubPlatform(Neighborhood *);
+ virtual ~SubPlatform() {}
+
+ virtual void setSoundFXLevel(const uint16);
+
+protected:
+ virtual void openInteraction();
+ virtual void initInteraction();
+ virtual void closeInteraction();
+
+ virtual void activateHotspots();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ Movie _platformMovie;
+ TimeScale _platformScale;
+ Notification _platformNotification;
+ NotificationCallBack _platformCallBack;
+ Notification *_neighborhoodNotification;
+ uint16 _stateBits;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp b/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp
new file mode 100644
index 0000000000..814d7717de
--- /dev/null
+++ b/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp
@@ -0,0 +1,689 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/compass.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_action.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/ai/ai_condition.h"
+#include "pegasus/ai/ai_rule.h"
+#include "pegasus/neighborhood/prehistoric/prehistoric.h"
+
+namespace Pegasus {
+
+static const int16 s_prehistoricCompass[kPrehistoric25 + 1][4] = {
+ { 0, 170, 90, 270 }, // kPrehistoric01
+ { 0, 180, 90, 270 }, // kPrehistoric02
+ { 10, 180, 90, 270 }, // kPrehistoric03
+ { 10, 190, 90, 270 }, // kPrehistoric04
+ { 10, 195, 90, 270 }, // kPrehistoric05
+ { 20, 210, 90, 270 }, // kPrehistoric06
+ { 20, 200, 130, 276 }, // kPrehistoric07
+ { 20, 176, 110, 260 }, // kPrehistoric08
+ { 20, 200, 100, 270 }, // kPrehistoric09
+ { 14, 186, 100, 280 }, // kPrehistoric10
+ { 26, 206, 116, 296 }, // kPrehistoric11
+ { 60, 226, 140, 320 }, // kPrehistoric12
+ { 0, 180, 80, 270 }, // kPrehistoric13
+ { 14, 200, 106, 286 }, // kPrehistoric14
+ { -10, 174, 80, 260 }, // kPrehistoric15
+ { 54, 236, 140, 210 }, // kPrehistoric16
+ { -24, 160, 70, 250 }, // kPrehistoric17
+ { 26, 206, 140, 296 }, // kPrehistoric18
+ { -16, 160, 70, 250 }, // kPrehistoric19
+ { -16, 160, 70, 250 }, // kPrehistoric20
+ { -10, 160, 90, 250 }, // kPrehistoric21
+ { -20, 160, 70, 244 }, // kPrehistoric22
+ { -20, 160, 70, 244 }, // kPrehistoric22North
+ { 60, 234, 150, 330 }, // kPrehistoric23
+ { 50, 230, 140, 320 }, // kPrehistoric24
+ { 60, 240, 140, 330 } // kPrehistoric25
+};
+
+static const TimeValue kPrehistoricFlashlightClickIn = 0;
+static const TimeValue kPrehistoricFlashlightClickOut = 138;
+
+static const TimeValue kPrehistoricBumpIntoWallIn = 138;
+static const TimeValue kPrehistoricBumpIntoWallOut = 291;
+
+static const TimeValue kBridgeRetractIn = 291;
+static const TimeValue kBridgeRetractOut = 1499;
+
+static const TimeValue kPrehistoricWarningTimeLimit = kTenMinutes;
+
+Prehistoric::Prehistoric(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Prehistoric", kPrehistoricID) {
+ setIsItemTaken(kHistoricalLog);
+}
+
+uint16 Prehistoric::getDateResID() const {
+ return kDatePrehistoricID;
+}
+
+void Prehistoric::init() {
+ Neighborhood::init();
+
+ // Forces a stop so the flashlight can turn off...
+ forceStridingStop(kPrehistoric12, kSouth, kNoAlternateID);
+}
+
+void Prehistoric::start() {
+ if (g_energyMonitor) {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+ }
+
+ Neighborhood::start();
+}
+
+class FinishPrehistoricAction : public AIPlayMessageAction {
+public:
+ FinishPrehistoricAction() : AIPlayMessageAction("Images/AI/Prehistoric/XP25W", false) {}
+ ~FinishPrehistoricAction() {}
+
+ void performAIAction(AIRule *);
+
+};
+
+void FinishPrehistoricAction::performAIAction(AIRule *rule) {
+ AIPlayMessageAction::performAIAction(rule);
+ ((PegasusEngine *)g_engine)->die(kPlayerWonGame);
+}
+
+void Prehistoric::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ if (g_AIArea) {
+ if (_vm->isDemo()) {
+ FinishPrehistoricAction *doneAction = new FinishPrehistoricAction();
+ AIHasItemCondition *hasLogCondition = new AIHasItemCondition(kHistoricalLog);
+ AIRule *rule = new AIRule(hasLogCondition, doneAction);
+ g_AIArea->addAIRule(rule);
+ } else {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP1NB", false);
+ AILocationCondition *locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kPrehistoric16, kNorth));
+ AIRule *rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP2SB", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kPrehistoric01, kSouth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP2SB", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kPrehistoric08, kEast));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP2SB", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kPrehistoric25, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP16NB", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kPrehistoric23, kNorth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP18NB", false);
+ AITimerCondition *timerCondition = new AITimerCondition(kPrehistoricWarningTimeLimit, 1, true);
+ rule = new AIRule(timerCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Prehistoric/XP25W", false);
+ AIHasItemCondition *hasLogCondition = new AIHasItemCondition(kHistoricalLog);
+ rule = new AIRule(hasLogCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+ }
+ }
+}
+
+TimeValue Prehistoric::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraTable::Entry extra;
+ uint32 extraID = 0xffffffff;
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kPrehistoric02, kSouth):
+ if (!GameState.getPrehistoricSeenTimeStream()) {
+ getExtraEntry(kPreArrivalFromTSA, extra);
+ return extra.movieStart;
+ }
+ break;
+ case MakeRoomView(kPrehistoric25, kEast):
+ if (_privateFlags.getFlag(kPrehistoricPrivateVaultOpenFlag)) {
+ if (_vm->itemInLocation(kHistoricalLog, kPrehistoricID, kPrehistoric25, kEast))
+ extraID = kPre25EastViewWithLog;
+ else
+ extraID = kPre25EastViewNoLog;
+ }
+ break;
+ }
+
+ if (extraID == 0xffffffff)
+ return Neighborhood::getViewTime(room, direction);
+
+ getExtraEntry(extraID, extra);
+ return extra.movieEnd - 1;
+}
+
+
+void Prehistoric::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &entry) {
+ Neighborhood::findSpotEntry(room, direction, flags, entry);
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kPrehistoric01, kSouth):
+ case MakeRoomView(kPrehistoric25, kSouth):
+ entry.clear();
+ break;
+ case MakeRoomView(kPrehistoric01, kEast):
+ if (GameState.getPrehistoricSeenFlyer1())
+ entry.clear();
+ else
+ GameState.setPrehistoricSeenFlyer1(true);
+ break;
+ case MakeRoomView(kPrehistoric08, kEast):
+ if (GameState.getPrehistoricSeenFlyer2())
+ entry.clear();
+ else
+ GameState.setPrehistoricSeenFlyer2(true);
+ break;
+ }
+}
+
+int16 Prehistoric::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ if (room == kPrehistoricDeath)
+ return g_compass->getFaderValue();
+
+ return s_prehistoricCompass[room][dir];
+}
+
+void Prehistoric::getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove) {
+ uint32 angle;
+ Neighborhood::getExitCompassMove(exitEntry, compassMove);
+
+ switch (MakeRoomView(exitEntry.room, exitEntry.direction)) {
+ case MakeRoomView(kPrehistoric01, kNorth):
+ compassMove.insertFaderKnot(exitEntry.movieStart + (exitEntry.movieEnd - exitEntry.movieStart) / 2, -10);
+ break;
+ case MakeRoomView(kPrehistoric06, kEast):
+ compassMove.insertFaderKnot(exitEntry.movieStart + (exitEntry.movieEnd - exitEntry.movieStart) / 4, 95);
+ compassMove.insertFaderKnot(exitEntry.movieStart + (exitEntry.movieEnd - exitEntry.movieStart) / 4 * 1, 100);
+ break;
+ case MakeRoomView(kPrehistoric18, kEast):
+ if (getCurrentAlternate() == kAltPrehistoricBridgeSet) {
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 11, 145);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 26, 145);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 39, 148);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 114, 140);
+ } else {
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 10, 140);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 16, 145);
+ compassMove.insertFaderKnot(exitEntry.movieEnd, 145);
+ }
+ break;
+ case MakeRoomView(kPrehistoric23, kWest):
+ angle = compassMove.getNthKnotValue(0);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 17, angle);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kPrehistoricFrameDuration * 32, angle - 90);
+ compassMove.insertFaderKnot(exitEntry.movieEnd, angle - 90);
+ break;
+ }
+}
+
+void Prehistoric::turnTo(const DirectionConstant newDirection) {
+ setCurrentAlternate(kAltPrehistoricNormal);
+ _privateFlags.setFlag(kPrehistoricPrivateVaultOpenFlag, false);
+ Neighborhood::turnTo(newDirection);
+
+ Item *keyCard;
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kPrehistoric18, kEast):
+ zoomToVault();
+ break;
+ case MakeRoomView(kPrehistoric18, kNorth):
+ case MakeRoomView(kPrehistoric18, kSouth):
+ if (_privateFlags.getFlag(kPrehistoricPrivateExtendedBridgeFlag)) {
+ playSpotSoundSync(kBridgeRetractIn, kBridgeRetractOut);
+ _privateFlags.setFlag(kPrehistoricPrivateExtendedBridgeFlag, false);
+ loadAmbientLoops();
+ }
+ // fall through
+ case MakeRoomView(kPrehistoric25, kEast):
+ setCurrentActivation(kActivationVaultClosed);
+ break;
+ case MakeRoomView(kPrehistoric16, kNorth):
+ case MakeRoomView(kPrehistoric21, kWest):
+ keyCard = _vm->getAllItems().findItemByID(kKeyCard);
+ if (keyCard->getItemState() == kFlashlightOff) {
+ keyCard->setItemState(kFlashlightOn);
+ playSpotSoundSync(kPrehistoricFlashlightClickIn, kPrehistoricFlashlightClickOut);
+ }
+ break;
+ case MakeRoomView(kPrehistoric16, kEast):
+ case MakeRoomView(kPrehistoric16, kWest):
+ case MakeRoomView(kPrehistoric21, kNorth):
+ case MakeRoomView(kPrehistoric21, kSouth):
+ keyCard = _vm->getAllItems().findItemByID(kKeyCard);
+ if (keyCard->getItemState() == kFlashlightOn) {
+ keyCard->setItemState(kFlashlightOff);
+ playSpotSoundSync(kPrehistoricFlashlightClickIn, kPrehistoricFlashlightClickOut);
+ }
+ break;
+ }
+}
+
+void Prehistoric::zoomToVault() {
+ if (!GameState.getPrehistoricSeenBridgeZoom())
+ startExtraSequence(kPre18EastZoom, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void Prehistoric::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kPrehistoric08, kEast):
+ case MakeRoomView(kPrehistoric18, kSouth):
+ case MakeRoomView(kPrehistoric16, kNorth):
+ case MakeRoomView(kPrehistoric21, kNorth):
+ case MakeRoomView(kPrehistoric25, kNorth):
+ makeContinuePoint();
+ break;
+ }
+}
+
+void Prehistoric::arriveAt(const RoomID room, const DirectionConstant direction) {
+ Item *keyCard;
+
+ if (MakeRoomView(room, direction) == MakeRoomView(kPrehistoric25, kEast) &&
+ _privateFlags.getFlag(kPrehistoricPrivateExtendedBridgeFlag)) {
+ _navMovie.stop();
+ playSpotSoundSync(kBridgeRetractIn, kBridgeRetractOut);
+ _privateFlags.setFlag(kPrehistoricPrivateExtendedBridgeFlag, false);
+ }
+
+ Neighborhood::arriveAt(room, direction);
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kPrehistoricDeath, kNorth):
+ case MakeRoomView(kPrehistoricDeath, kSouth):
+ case MakeRoomView(kPrehistoricDeath, kEast):
+ case MakeRoomView(kPrehistoricDeath, kWest):
+ if (GameState.getLastRoom() == kPrehistoric23)
+ die(kDeathEatenByDinosaur);
+ else
+ die(kDeathFallOffCliff);
+ break;
+ case MakeRoomView(kPrehistoric02, kSouth):
+ if (!GameState.getPrehistoricSeenTimeStream()) {
+ GameState.setPrehistoricTriedToExtendBridge(false);
+ GameState.setPrehistoricSeenFlyer1(false);
+ GameState.setPrehistoricSeenFlyer2(false);
+ GameState.setPrehistoricSeenBridgeZoom(false);
+ GameState.setPrehistoricBreakerThrown(false);
+ startExtraSequence(kPreArrivalFromTSA, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case MakeRoomView(kPrehistoric18, kEast):
+ zoomToVault();
+ break;
+ case MakeRoomView(kPrehistoric16, kNorth):
+ keyCard = _vm->getAllItems().findItemByID(kKeyCard);
+
+ if (keyCard->getItemState() == kFlashlightOff) {
+ keyCard->setItemState(kFlashlightOn);
+ playSpotSoundSync(kPrehistoricFlashlightClickIn, kPrehistoricFlashlightClickOut);
+ }
+
+ if (g_AIArea)
+ g_AIArea->checkRules();
+ break;
+ case MakeRoomView(kPrehistoric01, kSouth):
+ case MakeRoomView(kPrehistoric23, kNorth):
+ if (g_AIArea)
+ g_AIArea->checkRules();
+ break;
+ case MakeRoomView(kPrehistoric08, kSouth):
+ case MakeRoomView(kPrehistoric10, kSouth):
+ case MakeRoomView(kPrehistoric12, kSouth):
+ case MakeRoomView(kPrehistoric13, kNorth):
+ case MakeRoomView(kPrehistoric14, kSouth):
+ case MakeRoomView(kPrehistoric15, kNorth):
+ case MakeRoomView(kPrehistoric16, kSouth):
+ case MakeRoomView(kPrehistoric17, kNorth):
+ case MakeRoomView(kPrehistoric18, kSouth):
+ case MakeRoomView(kPrehistoric19, kNorth):
+ case MakeRoomView(kPrehistoric20, kNorth):
+ case MakeRoomView(kPrehistoric21, kEast):
+ keyCard = _vm->getAllItems().findItemByID(kKeyCard);
+
+ if (keyCard->getItemState() == kFlashlightOn) {
+ keyCard->setItemState(kFlashlightOff);
+ playSpotSoundSync(kPrehistoricFlashlightClickIn, kPrehistoricFlashlightClickOut);
+ }
+ break;
+ case MakeRoomView(kPrehistoric25, kEast):
+ setCurrentActivation(kActivationVaultClosed);
+ break;
+ }
+}
+
+void Prehistoric::loadAmbientLoops() {
+ RoomID room = GameState.getCurrentRoom();
+
+ switch (room) {
+ case kPrehistoric02:
+ // 1/4 volume.
+ if (GameState.getPrehistoricSeenTimeStream())
+ loadLoopSound1("Sounds/Prehistoric/P02SAL00.22k.AIFF", 64);
+ break;
+ case kPrehistoric01:
+ case kPrehistoric03:
+ case kPrehistoric04:
+ case kPrehistoric05:
+ case kPrehistoric06:
+ case kPrehistoric07:
+ case kPrehistoric09:
+ case kPrehistoric11:
+ case kPrehistoric13:
+ case kPrehistoric15:
+ case kPrehistoric17:
+ case kPrehistoric19:
+ case kPrehistoric20:
+ // 1/4 volume.
+ loadLoopSound1("Sounds/Prehistoric/P02SAL00.22k.AIFF", 64);
+ break;
+ case kPrehistoric08:
+ case kPrehistoric10:
+ case kPrehistoric12:
+ case kPrehistoric14:
+ case kPrehistoric16:
+ case kPrehistoric18:
+ case kPrehistoric21:
+ // 3/16 volume.
+ loadLoopSound1("Sounds/Prehistoric/P02SAL00.22k.AIFF", 48);
+ break;
+ case kPrehistoric25:
+ // 1/8 volume.
+ loadLoopSound1("Sounds/Prehistoric/P02SAL00.22k.AIFF", 32);
+ break;
+ case kPrehistoric22:
+ case kPrehistoric22North:
+ case kPrehistoric23:
+ case kPrehistoric24:
+ case kPrehistoricDeath:
+ // 0 volume.
+ loadLoopSound1("");
+ break;
+ }
+
+ switch (room) {
+ case kPrehistoric02:
+ case kPrehistoric03:
+ case kPrehistoric04:
+ case kPrehistoric05:
+ case kPrehistoric06:
+ case kPrehistoric07:
+ case kPrehistoric08:
+ case kPrehistoric09:
+ case kPrehistoric10:
+ case kPrehistoric11:
+ case kPrehistoric12:
+ case kPrehistoric13:
+ case kPrehistoric14:
+ case kPrehistoric15:
+ case kPrehistoric16:
+ case kPrehistoric17:
+ case kPrehistoric19:
+ case kPrehistoric20:
+ case kPrehistoric21:
+ case kPrehistoricDeath:
+ loadLoopSound2("");
+ break;
+ case kPrehistoric01:
+ case kPrehistoric25:
+ loadLoopSound2("Sounds/Prehistoric/VolcLoop.22K.AIFF", 64);
+ break;
+ case kPrehistoric18:
+ if (_privateFlags.getFlag(kPrehistoricPrivateExtendedBridgeFlag))
+ loadLoopSound2("Sounds/Prehistoric/P18EAL00.22k.AIFF", 0x100, 0, 0);
+ else
+ loadLoopSound2("");
+ break;
+ case kPrehistoric23:
+ case kPrehistoric24:
+ case kPrehistoric22:
+ case kPrehistoric22North:
+ loadLoopSound2("Sounds/Prehistoric/P24NAL00.22k.AIFF", 64);
+ break;
+ }
+}
+
+void Prehistoric::activateHotspots() {
+ Neighborhood::activateHotspots();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kPrehistoric18, kEast):
+ if (!_privateFlags.getFlag(kPrehistoricPrivateExtendedBridgeFlag))
+ _vm->getAllHotspots().activateOneHotspot(kPre18EastSpotID);
+ break;
+ case MakeRoomView(kPrehistoric22North, kNorth):
+ _vm->getAllHotspots().activateOneHotspot(kPre22NorthBreakerSpotID);
+ break;
+ }
+}
+
+void Prehistoric::clickInHotspot(const Input &input, const Hotspot *spot) {
+ switch (spot->getObjectID()) {
+ case kPre18EastSpotID:
+ if (GameState.getPrehistoricBreakerThrown())
+ startExtraSequence(kPre18EastBridgeOn, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kPre18EastBridgeOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kPre22NorthBreakerSpotID:
+ startExtraSequence(kPre22ThrowBreaker, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ Neighborhood::clickInHotspot(input, spot);
+ break;
+ }
+}
+
+void Prehistoric::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ Neighborhood::receiveNotification(notification, flags);
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ _interruptionFilter = kFilterAllInput;
+
+ switch (_lastExtra) {
+ case kPreArrivalFromTSA:
+ GameState.setPrehistoricSeenTimeStream(true);
+ loadAmbientLoops();
+ makeContinuePoint();
+ break;
+ case kPre18EastZoom:
+ startExtraSequence(kPre18EastZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kPre18EastZoomOut:
+ GameState.setPrehistoricSeenBridgeZoom(true);
+ break;
+ case kPre18EastBridgeOn:
+ _privateFlags.setFlag(kPrehistoricPrivateExtendedBridgeFlag, true);
+ setCurrentAlternate(kAltPrehistoricBridgeSet);
+ GameState.setPrehistoricTriedToExtendBridge(false);
+ loadAmbientLoops();
+ GameState.setScoringExtendedBridge(true);
+ break;
+ case kPre18EastBridgeOut:
+ GameState.setPrehistoricTriedToExtendBridge(true);
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+ break;
+ case kPre22ThrowBreaker:
+ GameState.setPrehistoricBreakerThrown(true);
+ GameState.setScoringThrewBreaker(true);
+ break;
+ case kPre25EastUnlockingVaultNoLog:
+ case kPre25EastUnlockingVaultWithLog:
+ _vm->addItemToInventory((InventoryItem *)_vm->getAllItems().findItemByID(kJourneymanKey));
+ break;
+ }
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+Common::String Prehistoric::getBriefingMovie() {
+ Common::String movieName = Neighborhood::getBriefingMovie();
+
+ if (movieName.empty())
+ movieName = "Images/AI/Prehistoric/XPE";
+
+ return movieName;
+}
+
+Common::String Prehistoric::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ if (!_vm->isDemo()) {
+ switch (GameState.getCurrentRoom()) {
+ case kPrehistoric16:
+ case kPrehistoric23:
+ case kPrehistoric24:
+ return "Images/AI/Prehistoric/XP7WB";
+ }
+ }
+
+ return "Images/AI/Prehistoric/XP17NB";
+ }
+
+ return movieName;
+}
+
+uint Prehistoric::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kPrehistoric18, kEast):
+ if (!GameState.getPrehistoricBreakerThrown() && GameState.getPrehistoricTriedToExtendBridge() &&
+ !_privateFlags.getFlag(kPrehistoricPrivateExtendedBridgeFlag))
+ numHints = 1;
+ break;
+ case MakeRoomView(kPrehistoric25, kEast):
+ if (!_privateFlags.getFlag(kPrehistoricPrivateVaultOpenFlag))
+ numHints = 1;
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String Prehistoric::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty()) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kPrehistoric18, kEast):
+ return "Images/AI/Prehistoric/XP18WD";
+ case MakeRoomView(kPrehistoric25, kEast):
+ return "Images/AI/Globals/XGLOB1A";
+ }
+ }
+
+ return movieName;
+}
+
+bool Prehistoric::canSolve() {
+ return GameState.getCurrentRoomAndView() == MakeRoomView(kPrehistoric18, kEast) &&
+ !GameState.getPrehistoricBreakerThrown() &&
+ GameState.getPrehistoricTriedToExtendBridge() &&
+ !_privateFlags.getFlag(kPrehistoricPrivateExtendedBridgeFlag);
+}
+
+void Prehistoric::doSolve() {
+ GameState.setPrehistoricBreakerThrown(true);
+ startExtraSequence(kPre18EastBridgeOn, kExtraCompletedFlag, kFilterNoInput);
+}
+
+Hotspot *Prehistoric::getItemScreenSpot(Item *item, DisplayElement *element) {
+ if (item->getObjectID() == kHistoricalLog)
+ return _vm->getAllHotspots().findHotspotByID(kPrehistoricHistoricalLogSpotID);
+
+ return Neighborhood::getItemScreenSpot(item, element);
+}
+
+void Prehistoric::pickedUpItem(Item *item) {
+ switch (item->getObjectID()) {
+ case kHistoricalLog:
+ GameState.setScoringGotHistoricalLog(true);
+ break;
+ }
+
+ Neighborhood::pickedUpItem(item);
+}
+
+void Prehistoric::dropItemIntoRoom(Item *item, Hotspot *dropSpot) {
+ switch (item->getObjectID()) {
+ case kJourneymanKey:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+
+ if (GameState.isTakenItemID(kHistoricalLog))
+ startExtraLongSequence(kPre25EastUnlockingVaultNoLog, kPre25EastVaultOpenNoLog, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraLongSequence(kPre25EastUnlockingVaultWithLog, kPre25EastVaultOpenWithLog, kExtraCompletedFlag, kFilterNoInput);
+
+ _privateFlags.setFlag(kPrehistoricPrivateVaultOpenFlag, true);
+ setCurrentActivation(kActivationVaultOpen);
+ break;
+ default:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ }
+}
+
+void Prehistoric::bumpIntoWall() {
+ requestSpotSound(kPrehistoricBumpIntoWallIn, kPrehistoricBumpIntoWallOut, kFilterAllInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+Common::String Prehistoric::getNavMovieName() {
+ return "Images/Prehistoric/Prehistoric.movie";
+}
+
+Common::String Prehistoric::getSoundSpotsName() {
+ return "Sounds/Prehistoric/Prehistoric Spots";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/prehistoric/prehistoric.h b/engines/pegasus/neighborhood/prehistoric/prehistoric.h
new file mode 100644
index 0000000000..17f9993014
--- /dev/null
+++ b/engines/pegasus/neighborhood/prehistoric/prehistoric.h
@@ -0,0 +1,158 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_PREHISTORIC_H
+#define PEGASUS_NEIGHBORHOOD_PREHISTORIC_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+static const TimeScale kPrehistoricMovieScale = 600;
+static const TimeScale kPrehistoricFramesPerSecond = 15;
+static const TimeScale kPrehistoricFrameDuration = 40;
+
+// Alternate IDs.
+
+static const AlternateID kAltPrehistoricNormal = 0;
+static const AlternateID kAltPrehistoricBridgeSet = 1;
+
+// Room IDs.
+
+static const RoomID kPrehistoric01 = 0;
+static const RoomID kPrehistoric02 = 1;
+static const RoomID kPrehistoric03 = 2;
+static const RoomID kPrehistoric04 = 3;
+static const RoomID kPrehistoric05 = 4;
+static const RoomID kPrehistoric06 = 5;
+static const RoomID kPrehistoric07 = 6;
+static const RoomID kPrehistoric08 = 7;
+static const RoomID kPrehistoric09 = 8;
+static const RoomID kPrehistoric10 = 9;
+static const RoomID kPrehistoric11 = 10;
+static const RoomID kPrehistoric12 = 11;
+static const RoomID kPrehistoric13 = 12;
+static const RoomID kPrehistoric14 = 13;
+static const RoomID kPrehistoric15 = 14;
+static const RoomID kPrehistoric16 = 15;
+static const RoomID kPrehistoric17 = 16;
+static const RoomID kPrehistoric18 = 17;
+static const RoomID kPrehistoric19 = 18;
+static const RoomID kPrehistoric20 = 19;
+static const RoomID kPrehistoric21 = 20;
+static const RoomID kPrehistoric22 = 21;
+static const RoomID kPrehistoric22North = 22;
+static const RoomID kPrehistoric23 = 23;
+static const RoomID kPrehistoric24 = 24;
+static const RoomID kPrehistoric25 = 25;
+static const RoomID kPrehistoricDeath = 26;
+
+// Hot Spot Activation IDs.
+
+static const HotSpotActivationID kActivationVaultClosed = 1;
+static const HotSpotActivationID kActivationVaultOpen = 2;
+
+// Hot Spot IDs.
+
+static const HotSpotID kPre18EastSpotID = 5000;
+static const HotSpotID kPre22NorthSpotID = 5001;
+static const HotSpotID kPre22NorthOutSpotID = 5002;
+static const HotSpotID kPre22NorthBreakerSpotID = 5003;
+static const HotSpotID kPrehistoricKeyDropSpotID = 5004;
+static const HotSpotID kPrehistoricHistoricalLogSpotID = 5005;
+
+// Extra sequence IDs.
+
+static const ExtraID kPreArrivalFromTSA = 0;
+static const ExtraID kPre18EastBridgeOut = 1;
+static const ExtraID kPre18EastBridgeOn = 2;
+static const ExtraID kPre18EastZoom = 3;
+static const ExtraID kPre18EastZoomOut = 4;
+static const ExtraID kPre22ThrowBreaker = 5;
+static const ExtraID kPre25EastUnlockingVaultWithLog = 6;
+static const ExtraID kPre25EastVaultOpenWithLog = 7;
+static const ExtraID kPre25EastViewWithLog = 8;
+static const ExtraID kPre25EastUnlockingVaultNoLog = 9;
+static const ExtraID kPre25EastVaultOpenNoLog = 10;
+static const ExtraID kPre25EastViewNoLog = 11;
+
+class PegasusEngine;
+
+class Prehistoric : public Neighborhood {
+public:
+ Prehistoric(InputHandler *, PegasusEngine *);
+ virtual ~Prehistoric() {}
+
+ virtual uint16 getDateResID() const;
+ virtual void init();
+
+ virtual void arriveAt(const RoomID, const DirectionConstant);
+ virtual void activateHotspots();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+ Common::String getBriefingMovie();
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+ void dropItemIntoRoom(Item *, Hotspot *);
+ void pickedUpItem(Item *);
+
+ void start();
+
+ void bumpIntoWall();
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ bool canSolve();
+ void doSolve();
+
+protected:
+ enum {
+ kPrehistoricPrivateVaultOpenFlag,
+ kPrehistoricPrivateExtendedBridgeFlag,
+ kNumPrehistoricPrivateFlags
+ };
+
+ void setUpAIRules();
+ int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+ void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &);
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+ void turnTo(const DirectionConstant);
+ void zoomToVault();
+ TimeValue getViewTime(const RoomID, const DirectionConstant);
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+
+ void loadAmbientLoops();
+
+ FlagsArray<byte, kNumPrehistoricPrivateFlags> _privateFlags;
+
+ Common::String getNavMovieName();
+ Common::String getSoundSpotsName();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/spot.cpp b/engines/pegasus/neighborhood/spot.cpp
new file mode 100644
index 0000000000..f285bf9bc2
--- /dev/null
+++ b/engines/pegasus/neighborhood/spot.cpp
@@ -0,0 +1,70 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/spot.h"
+
+namespace Pegasus {
+
+void SpotTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].room = stream->readUint16BE();
+ _entries[i].direction = stream->readByte();
+ _entries[i].srcFlags = stream->readByte();
+ _entries[i].altCode = stream->readByte();
+ stream->readByte(); // alignment
+ _entries[i].movieStart = stream->readUint32BE();
+ _entries[i].movieEnd = stream->readUint32BE();
+ _entries[i].dstFlags = stream->readByte();
+ stream->readByte(); // alignment
+ debug(0, "Spot[%d]: %d %d %d %d %d %d %d", i, _entries[i].room, _entries[i].direction,
+ _entries[i].srcFlags, _entries[i].altCode, _entries[i].movieStart,
+ _entries[i].movieEnd, _entries[i].dstFlags);
+ }
+}
+
+void SpotTable::clear() {
+ _entries.clear();
+}
+
+// Two SpotTable::Entries are equal if
+// In addition to having their rooms, directions and alt codes identical...
+// They are both either loops or once only animations AND
+// They overlap in at least one of the on arrival, on turn and on door open bits.
+SpotTable::Entry SpotTable::findEntry(RoomID room, DirectionConstant direction, SpotFlags srcFlags, AlternateID altCode) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].room == room && _entries[i].direction == direction && _entries[i].altCode == altCode && (_entries[i].srcFlags & kSpotLoopsMask) == (srcFlags & kSpotLoopsMask) && ((_entries[i].srcFlags & srcFlags) & kSpotTriggers) != 0)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/spot.h b/engines/pegasus/neighborhood/spot.h
new file mode 100644
index 0000000000..a985420b7c
--- /dev/null
+++ b/engines/pegasus/neighborhood/spot.h
@@ -0,0 +1,97 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_SPOT_H
+#define PEGASUS_NEIGHBORHOOD_SPOT_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+typedef byte SpotFlags;
+
+enum {
+ kSpotLoopsBit, // Loop or once only?
+ kSpotOnArrivalBit,
+ kSpotOnTurnBit,
+ kSpotOnDoorOpenBit
+};
+
+static const SpotFlags kNoSpotFlags = 0;
+static const SpotFlags kSpotLoopsMask = 1 << kSpotLoopsBit;
+static const SpotFlags kSpotOnArrivalMask = 1 << kSpotOnArrivalBit;
+static const SpotFlags kSpotOnTurnMask = 1 << kSpotOnTurnBit;
+static const SpotFlags kSpotOnDoorOpenMask = 1 << kSpotOnDoorOpenBit;
+
+static const SpotFlags kSpotTriggers = kSpotOnArrivalMask | kSpotOnTurnMask | kSpotOnDoorOpenMask;
+
+class SpotTable {
+public:
+ SpotTable() {}
+ ~SpotTable() {}
+
+ static uint32 getResTag() { return MKTAG('S', 'p', 'o', 't'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { clear(); }
+ bool isEmpty() { return movieStart == 0xffffffff; }
+ void clear() {
+ room = kNoRoomID;
+ direction = kNoDirection;
+ srcFlags = kNoSpotFlags;
+ altCode = kNoAlternateID;
+ movieStart = 0xffffffff;
+ movieEnd = 0xffffffff;
+ dstFlags = kNoSpotFlags;
+ }
+
+ RoomID room;
+ DirectionConstant direction;
+ SpotFlags srcFlags;
+ AlternateID altCode;
+ TimeValue movieStart;
+ TimeValue movieEnd;
+ SpotFlags dstFlags;
+ };
+
+ Entry findEntry(RoomID room, DirectionConstant direction, SpotFlags srcFlags, AlternateID altCode);
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/tsa/fulltsa.cpp b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
new file mode 100644
index 0000000000..b598841b45
--- /dev/null
+++ b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
@@ -0,0 +1,3023 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/cursor.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/aichip.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/prehistoric/prehistoric.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/tsa/fulltsa.h"
+#include "pegasus/neighborhood/wsc/wsc.h"
+
+namespace Pegasus {
+
+// TSA PICTs:
+
+static const ResIDType kTBPCloseBoxPICTID = 800;
+static const ResIDType kTBPRewindPICTID = 801;
+static const ResIDType kUnresolvedPICTID = 802;
+static const ResIDType kResolvedPICTID = 803;
+static const ResIDType kJumpMenuPICTID = 804;
+static const ResIDType kJumpMenuHilitedPICTID = 805;
+static const ResIDType kExitPICTID = 806;
+static const ResIDType kExitHilitedPICTID = 807;
+static const ResIDType kLeftRipPICTID = 808;
+static const ResIDType kComparisonCloseBoxPICTID = 809;
+static const ResIDType kComparisonLeftRewindPICTID = 810;
+static const ResIDType kComparisonRightRewindPICTID = 811;
+static const ResIDType kComparisonHiliteNoradPICTID = 812;
+static const ResIDType kComparisonHiliteMarsPICTID = 813;
+static const ResIDType kComparisonHiliteCaldoriaPICTID = 814;
+static const ResIDType kComparisonHiliteWSCPICTID = 815;
+static const ResIDType kComparisonChancesNoradPICTID = 816;
+static const ResIDType kComparisonChancesMarsPICTID = 817;
+static const ResIDType kComparisonChancesCaldoriaPICTID = 818;
+static const ResIDType kComparisonChancesWSCPICTID = 819;
+static const ResIDType kRedirectionCCRolloverPICTID = 820;
+static const ResIDType kRedirectionRRRolloverPICTID = 821;
+static const ResIDType kRedirectionFDRolloverPICTID = 822;
+static const ResIDType kRedirectionCCDoorPICTID = 823;
+static const ResIDType kRedirectionRRDoorPICTID = 824;
+static const ResIDType kRedirectionFDDoorPICTID = 825;
+static const ResIDType kRedirectionSecuredPICTID = 826;
+static const ResIDType kRedirectionNewTargetPICTID = 827;
+static const ResIDType kRedirectionClosePICTID = 828;
+
+static const int16 kCompassShift = 15;
+
+static const TimeScale kFullTSAMovieScale = 600;
+static const TimeScale kFullTSAFramesPerSecond = 15;
+static const TimeScale kFullTSAFrameDuration = 40;
+
+// Alternate IDs.
+static const AlternateID kAltTSANormal = 0;
+static const AlternateID kAltTSARobotsAtReadyRoom = 1;
+static const AlternateID kAltTSARobotsAtFrontDoor = 2;
+static const AlternateID kAltTSARedAlert = 3;
+
+// Room IDs.
+static const RoomID kTSA01 = 1;
+static const RoomID kTSA02 = 2;
+static const RoomID kTSA03 = 3;
+static const RoomID kTSA04 = 4;
+static const RoomID kTSA05 = 5;
+static const RoomID kTSA0A = 6;
+static const RoomID kTSA06 = 7;
+static const RoomID kTSA07 = 8;
+static const RoomID kTSA08 = 9;
+static const RoomID kTSA09 = 10;
+static const RoomID kTSA10 = 11;
+static const RoomID kTSA11 = 12;
+static const RoomID kTSA12 = 13;
+static const RoomID kTSA13 = 14;
+static const RoomID kTSA14 = 15;
+static const RoomID kTSA15 = 16;
+static const RoomID kTSA16 = 17;
+static const RoomID kTSA17 = 18;
+static const RoomID kTSA18 = 19;
+static const RoomID kTSA19 = 20;
+static const RoomID kTSA0B = 21;
+static const RoomID kTSA21Cyan = 22;
+static const RoomID kTSA22Cyan = 23;
+static const RoomID kTSA23Cyan = 24;
+static const RoomID kTSA24Cyan = 25;
+static const RoomID kTSA25Cyan = 26;
+static const RoomID kTSA21Red = 27;
+static const RoomID kTSA23Red = 29;
+static const RoomID kTSA24Red = 30;
+static const RoomID kTSA25Red = 31;
+static const RoomID kTSA26 = 32;
+static const RoomID kTSA27 = 33;
+static const RoomID kTSA28 = 34;
+static const RoomID kTSA29 = 35;
+static const RoomID kTSA30 = 36;
+static const RoomID kTSA31 = 37;
+static const RoomID kTSA32 = 38;
+static const RoomID kTSA33 = 39;
+static const RoomID kTSA34 = 40;
+static const RoomID kTSA35 = 41;
+static const RoomID kTSADeathRoom = 43;
+
+// Hot Spot Activation IDs.
+static const HotSpotActivationID kActivateTSAReadyForCard = 1;
+static const HotSpotActivationID kActivateTSAReadyToTransport = 2;
+static const HotSpotActivationID kActivateTSARobotsAwake = 3;
+static const HotSpotActivationID kActivateTSA0BZoomedOut = 4;
+static const HotSpotActivationID kActivateTSA0BZoomedIn = 5;
+static const HotSpotActivationID kActivateTSA0BComparisonVideo = 6;
+static const HotSpotActivationID kActivationLogReaderOpen = 7;
+static const HotSpotActivationID kActivateTSA0BTBPVideo = 8;
+static const HotSpotActivationID kActivationDoesntHaveKey = 9;
+static const HotSpotActivationID kActivationKeyVaultOpen = 10;
+static const HotSpotActivationID kActivationDoesntHaveChips = 11;
+static const HotSpotActivationID kActivationChipVaultOpen = 12;
+static const HotSpotActivationID kActivationJumpToPrehistoric = 13;
+static const HotSpotActivationID kActivationJumpToNorad = 14;
+static const HotSpotActivationID kActivationJumpToMars = 15;
+static const HotSpotActivationID kActivationJumpToWSC = 16;
+static const HotSpotActivationID kActivationReadyToExit = 17;
+static const HotSpotActivationID kActivationReadyForJumpMenu = 18;
+static const HotSpotActivationID kActivationMainJumpMenu = 19;
+
+// Hot Spot IDs.
+static const HotSpotID kTSAGTCardDropSpotID = 5000;
+static const HotSpotID kTSAGTTokyoSpotID = 5001;
+static const HotSpotID kTSAGTCaldoriaSpotID = 5002;
+static const HotSpotID kTSAGTBeachSpotID = 5003;
+static const HotSpotID kTSAGTOtherSpotID = 5004;
+static const HotSpotID kTSA02DoorSpotID = 5005;
+static const HotSpotID kTSA03EastJimenezSpotID = 5006;
+static const HotSpotID kTSA03WestCrenshawSpotID = 5007;
+static const HotSpotID kTSA04EastMatsumotoSpotID = 5008;
+static const HotSpotID kTSA04WestCastilleSpotID = 5009;
+static const HotSpotID kTSA05EastSinclairSpotID = 5010;
+static const HotSpotID kTSA05WestWhiteSpotID = 5011;
+static const HotSpotID kTSA0AEastSpotID = 5012;
+static const HotSpotID kTSA0AWastSpotID = 5013;
+static const HotSpotID kTSA0BEastMonitorSpotID = 5014;
+static const HotSpotID kTSA0BEastMonitorOutSpotID = 5015;
+static const HotSpotID kTSA0BEastCompareNoradSpotID = 5016;
+static const HotSpotID kTSA0BEastCompareMarsSpotID = 5017;
+static const HotSpotID kTSA0BEastCompareCaldoriaSpotID = 5018;
+static const HotSpotID kTSA0BEastCompareWSCSpotID = 5019;
+static const HotSpotID kTSA0BEastLeftRewindSpotID = 5020;
+static const HotSpotID kTSA0BEastLeftPlaySpotID = 5021;
+static const HotSpotID kTSA0BEastRightRewindSpotID = 5022;
+static const HotSpotID kTSA0BEastRightPlaySpotID = 5023;
+static const HotSpotID kTSA0BEastCloseVideoSpotID = 5024;
+static const HotSpotID kTSA0BNorthMonitorSpotID = 5025;
+static const HotSpotID kTSA0BNorthMonitorOutSpotID = 5026;
+static const HotSpotID kTSA0BNorthHistLogSpotID = 5027;
+static const HotSpotID kTSA0BNorthRobotsToCommandCenterSpotID = 5028;
+static const HotSpotID kTSA0BNorthRobotsToReadyRoomSpotID = 5029;
+static const HotSpotID kTSA0BNorthRobotsToFrontDoorSpotID = 5030;
+static const HotSpotID kTSA0BWestMonitorSpotID = 5031;
+static const HotSpotID kTSA0BWestMonitorOutSpotID = 5032;
+static const HotSpotID kTSA0BWestTheorySpotID = 5033;
+static const HotSpotID kTSA0BWestBackgroundSpotID = 5034;
+static const HotSpotID kTSA0BWestProcedureSpotID = 5035;
+static const HotSpotID kTSA0BWestCloseVideoSpotID = 5036;
+static const HotSpotID kTSA0BWestPlayVideoSpotID = 5037;
+static const HotSpotID kTSA0BWestRewindVideoSpotID = 5038;
+static const HotSpotID kTSA22EastMonitorSpotID = 5039;
+static const HotSpotID kTSA22EastKeySpotID = 5040;
+static const HotSpotID kTSA23WestMonitorSpotID = 5041;
+static const HotSpotID kTSA23WestChipsSpotID = 5042;
+static const HotSpotID kTSA34NorthDoorSpotID = 5043;
+static const HotSpotID kTSA37NorthJumpToPrehistoricSpotID = 5044;
+static const HotSpotID kTSA37NorthJumpToNoradSpotID = 5045;
+static const HotSpotID kTSA37NorthCancelNoradSpotID = 5046;
+static const HotSpotID kTSA37NorthJumpToMarsSpotID = 5047;
+static const HotSpotID kTSA37NorthCancelMarsSpotID = 5048;
+static const HotSpotID kTSA37NorthJumpToWSCSpotID = 5049;
+static const HotSpotID kTSA37NorthCancelWSCSpotID = 5050;
+static const HotSpotID kTSA37NorthExitSpotID = 5051;
+static const HotSpotID kTSA37NorthJumpMenuSpotID = 5052;
+static const HotSpotID kTSA37NorthNoradMenuSpotID = 5053;
+static const HotSpotID kTSA37NorthMarsMenuSpotID = 5054;
+static const HotSpotID kTSA37NorthWSCMenuSpotID = 5055;
+
+// Extra sequence IDs.
+static const ExtraID kTSATransporterArrowLoop = 0;
+static const ExtraID kTSAArriveFromCaldoria = 1;
+static const ExtraID kTSAGTOtherChoice = 2;
+static const ExtraID kTSAGTCardSwipe = 3;
+static const ExtraID kTSAGTSelectCaldoria = 4;
+static const ExtraID kTSAGTGoToCaldoria = 5;
+static const ExtraID kTSAGTSelectBeach = 6;
+static const ExtraID kTSAGTGoToBeach = 7;
+static const ExtraID kTSAGTArriveAtBeach = 8;
+static const ExtraID kTSAGTSelectTokyo = 9;
+static const ExtraID kTSAGTGoToTokyo = 10;
+static const ExtraID kTSAGTArriveAtTokyo = 11;
+static const ExtraID kTSA02NorthZoomIn = 12;
+static const ExtraID kTSA02NorthTenSecondDoor = 13;
+static const ExtraID kTSA02NorthZoomOut = 14;
+static const ExtraID kTSA02NorthDoorWithAgent3 = 15;
+static const ExtraID kTSA03JimenezZoomIn = 16;
+static const ExtraID kTSA03JimenezSpeech = 17;
+static const ExtraID kTSA03JimenezZoomOut = 18;
+static const ExtraID kTSA03CrenshawZoomIn = 19;
+static const ExtraID kTSA03CrenshawSpeech = 20;
+static const ExtraID kTSA03CrenshawZoomOut = 21;
+static const ExtraID kTSA03SouthRobotDeath = 22;
+static const ExtraID kTSA04NorthRobotGreeting = 23;
+static const ExtraID kTSA04MatsumotoZoomIn = 24;
+static const ExtraID kTSA04MatsumotoSpeech = 25;
+static const ExtraID kTSA04MatsumotoZoomOut = 26;
+static const ExtraID kTSA04CastilleZoomIn = 27;
+static const ExtraID kTSA04CastilleSpeech = 28;
+static const ExtraID kTSA04CastilleZoomOut = 29;
+static const ExtraID kTSA05SinclairZoomIn = 30;
+static const ExtraID kTSA05SinclairSpeech = 31;
+static const ExtraID kTSA05SinclairZoomOut = 32;
+static const ExtraID kTSA05WhiteZoomIn = 33;
+static const ExtraID kTSA05WhiteSpeech = 34;
+static const ExtraID kTSA05WhiteZoomOut = 35;
+static const ExtraID kTSA0AEastRobot = 36;
+static const ExtraID kTSA0AWestRobot = 37;
+static const ExtraID kTSA16NorthRobotDeath = 38;
+static const ExtraID kTSA0BEastZoomIn = 39;
+static const ExtraID kTSA0BEastZoomedView = 40;
+static const ExtraID kTSA0BEastZoomOut = 41;
+static const ExtraID kTSA0BEastTurnLeft = 42;
+static const ExtraID kTSA0BComparisonStartup = 43;
+static const ExtraID kTSA0BComparisonView0000 = 44;
+static const ExtraID kTSA0BComparisonView0002 = 45;
+static const ExtraID kTSA0BComparisonView0020 = 46;
+static const ExtraID kTSA0BComparisonView0022 = 47;
+static const ExtraID kTSA0BComparisonView0200 = 48;
+static const ExtraID kTSA0BComparisonView0202 = 49;
+static const ExtraID kTSA0BComparisonView0220 = 50;
+static const ExtraID kTSA0BComparisonView0222 = 51;
+static const ExtraID kTSA0BComparisonView2000 = 52;
+static const ExtraID kTSA0BComparisonView2002 = 53;
+static const ExtraID kTSA0BComparisonView2020 = 54;
+static const ExtraID kTSA0BComparisonView2022 = 55;
+static const ExtraID kTSA0BComparisonView2200 = 56;
+static const ExtraID kTSA0BComparisonView2202 = 57;
+static const ExtraID kTSA0BComparisonView2220 = 58;
+static const ExtraID kTSA0BComparisonView2222 = 59;
+static const ExtraID kTSA0BNoradComparisonView = 60;
+static const ExtraID kTSA0BNoradUnaltered = 61;
+static const ExtraID kTSA0BNoradAltered = 62;
+static const ExtraID kTSA0BMarsComparisonView = 63;
+static const ExtraID kTSA0BMarsUnaltered = 64;
+static const ExtraID kTSA0BMarsAltered = 65;
+static const ExtraID kTSA0BWSCComparisonView = 66;
+static const ExtraID kTSA0BWSCUnaltered = 67;
+static const ExtraID kTSA0BWSCAltered = 68;
+static const ExtraID kTSA0BCaldoriaComparisonView = 69;
+static const ExtraID kTSA0BCaldoriaUnaltered = 70;
+static const ExtraID kTSA0BCaldoriaAltered = 71;
+static const ExtraID kTSA0BNorthZoomIn = 72;
+static const ExtraID kTSA0BNorthZoomedView = 73;
+static const ExtraID kTSA0BNorthZoomOut = 74;
+static const ExtraID kTSA0BNorthTurnLeft = 75;
+static const ExtraID kTSA0BNorthTurnRight = 76;
+static const ExtraID kTSA0BNorthHistLogOpen = 77;
+static const ExtraID kTSA0BNorthHistLogClose = 78;
+static const ExtraID kTSA0BNorthHistLogCloseWithLog = 79;
+static const ExtraID kTSA0BNorthCantChangeHistory = 80;
+static const ExtraID kTSA0BNorthYoureBusted = 81;
+static const ExtraID kTSA0BNorthFinallyHappened = 82;
+static const ExtraID kTSA0BShowRip1 = 83;
+static const ExtraID kTSA0BNorthRipView1 = 84;
+static const ExtraID kTSA0BShowRip2 = 85;
+static const ExtraID kTSA0BShowGuardRobots = 86;
+static const ExtraID kTSA0BAIInterruption = 87;
+static const ExtraID kTSA0BRobotsToCommandCenter = 88;
+static const ExtraID kTSA0BNorthRobotsAtCCView = 89;
+static const ExtraID kTSA0BNorthRobotsAtRRView = 90;
+static const ExtraID kTSA0BNorthRobotsAtFDView = 91;
+static const ExtraID kTSA0BRobotsFromCommandCenterToReadyRoom = 92;
+static const ExtraID kTSA0BRobotsFromReadyRoomToCommandCenter = 93;
+static const ExtraID kTSA0BRobotsFromCommandCenterToFrontDoor = 94;
+static const ExtraID kTSA0BRobotsFromFrontDoorToCommandCenter = 95;
+static const ExtraID kTSA0BRobotsFromFrontDoorToReadyRoom = 96;
+static const ExtraID kTSA0BRobotsFromReadyRoomToFrontDoor = 97;
+static const ExtraID kTSA0BWestZoomIn = 98;
+static const ExtraID kTSA0BWestZoomedView = 99;
+static const ExtraID kTSA0BWestZoomOut = 100;
+static const ExtraID kTSA0BWestTurnRight = 101;
+static const ExtraID kTSA0BTBPTheoryHighlight = 102;
+static const ExtraID kTSA0BTBPBackgroundHighlight = 103;
+static const ExtraID kTSA0BTBPProcedureHighlight = 104;
+static const ExtraID kTSA0BTBPTheory = 105;
+static const ExtraID kTSA0BTBPBackground = 106;
+static const ExtraID kTSA0BTBPProcedure = 107;
+static const ExtraID kTSA0BRipAlarmScreen = 108;
+static const ExtraID kTSA22RedEastZoomInSequence = 109;
+static const ExtraID kTSA22RedEastVaultViewWithKey = 110;
+static const ExtraID kTSA22RedEastVaultViewNoKey = 111;
+static const ExtraID kTSA23RedWestVaultZoomInSequence = 112;
+static const ExtraID kTSA23RedWestVaultViewWithChips = 113;
+static const ExtraID kTSA23RedWestVaultViewNoChips = 114;
+static const ExtraID kTSA25NorthDeniedNoKey = 115;
+static const ExtraID kTSA25NorthDeniedNoChip = 116;
+static const ExtraID kTSA25NorthPutOnSuit = 117;
+static const ExtraID kTSA25NorthAlreadyHaveSuit = 118;
+static const ExtraID kTSA25NorthDescending1 = 119;
+static const ExtraID kTSA25NorthDescending2 = 120;
+static const ExtraID kTSA37HorseToAI1 = 121;
+static const ExtraID kTSA37PegasusAI1 = 122;
+static const ExtraID kTSA37AI1ToCommissioner1 = 123;
+static const ExtraID kTSA37Commissioner1 = 124;
+static const ExtraID kTSA37Commissioner1ToZoom = 125;
+static const ExtraID kTSA37ZoomToPrehistoric = 126;
+static const ExtraID kTSA37PrehistoricToAI2 = 127;
+static const ExtraID kTSA37PegasusAI2 = 128;
+static const ExtraID kTSA37AI2ToPrehistoric = 129;
+static const ExtraID kTSA37PrehistoricToDepart = 130;
+static const ExtraID kTSA37PegasusDepart = 131;
+static const ExtraID kTSA37TimeJumpToPegasus = 132;
+static const ExtraID kTSA37RecallToDownload = 133;
+static const ExtraID kTSA37DownloadToColonel1 = 134;
+static const ExtraID kTSA37Colonel1 = 135;
+static const ExtraID kTSA37Colonel1ToReviewRequired = 136;
+static const ExtraID kTSA37ReviewRequiredToExit = 137;
+static const ExtraID kTSA37ExitHilited = 138;
+static const ExtraID kTSA37ExitToHorse = 139;
+static const ExtraID kTSA37HorseToColonel2 = 140;
+static const ExtraID kTSA37Colonel2 = 141;
+static const ExtraID kTSA37PegasusAI3 = 142;
+static const ExtraID kTSA37AI3ToHorse = 143;
+static const ExtraID kTSA37HorseToZoom = 144;
+static const ExtraID kTSA37ZoomToMainMenu = 145;
+static const ExtraID kTSA37MainMenuToAI4 = 146;
+static const ExtraID kTSA37PegasusAI4 = 147;
+static const ExtraID kTSA37AI4ToMainMenu = 148;
+static const ExtraID kTSA37JumpMenu000 = 149;
+static const ExtraID kTSA37JumpMenu001 = 150;
+static const ExtraID kTSA37JumpMenu010 = 151;
+static const ExtraID kTSA37JumpMenu011 = 152;
+static const ExtraID kTSA37JumpMenu100 = 153;
+static const ExtraID kTSA37JumpMenu101 = 154;
+static const ExtraID kTSA37JumpMenu110 = 155;
+static const ExtraID kTSA37JumpMenu111 = 156;
+static const ExtraID kTSA37JumpToWSCMenu = 157;
+static const ExtraID kTSA37CancelWSC = 158;
+static const ExtraID kTSA37JumpToWSC = 159;
+static const ExtraID kTSA37WSCToAI5 = 160;
+static const ExtraID kTSA37PegasusAI5 = 161;
+static const ExtraID kTSA37AI5ToWSC = 162;
+static const ExtraID kTSA37WSCToDepart = 163;
+static const ExtraID kTSA37JumpToMarsMenu = 164;
+static const ExtraID kTSA37CancelMars = 165;
+static const ExtraID kTSA37JumpToMars = 166;
+static const ExtraID kTSA37MarsToAI6 = 167;
+static const ExtraID kTSA37PegasusAI6 = 168;
+static const ExtraID kTSA37AI6ToMars = 169;
+static const ExtraID kTSA37MarsToDepart = 170;
+static const ExtraID kTSA37JumpToNoradMenu = 171;
+static const ExtraID kTSA37CancelNorad = 172;
+static const ExtraID kTSA37JumpToNorad = 173;
+static const ExtraID kTSA37NoradToAI7 = 174;
+static const ExtraID kTSA37PegasusAI7 = 175;
+static const ExtraID kTSA37AI7ToNorad = 176;
+static const ExtraID kTSA37NoradToDepart = 177;
+static const ExtraID kTSA37EnvironmentalScan = 178;
+static const ExtraID kTSA37DownloadToMainMenu = 179;
+static const ExtraID kTSA37DownloadToOpMemReview = 180;
+static const ExtraID kTSA37OpMemReviewToMainMenu = 181;
+static const ExtraID kTSA37OpMemReviewToAllClear = 182;
+static const ExtraID kTSA37AllClearToCongratulations = 183;
+static const ExtraID kTSA37Congratulations = 184;
+static const ExtraID kTSA37CongratulationsToExit = 185;
+
+const DisplayOrder kRipTimerOrder = kMonitorLayer;
+
+
+const CoordType kUnresolvedLeft = kNavAreaLeft + 14;
+const CoordType kUnresolvedTop = kNavAreaTop + 236;
+
+const CoordType kResolvedLeft = kNavAreaLeft + 36;
+const CoordType kResolvedTop = kNavAreaTop + 236;
+
+const CoordType kJumpMenuLeft = kNavAreaLeft + 360;
+const CoordType kJumpMenuTop = kNavAreaTop + 202;
+
+const CoordType kJumpMenuHilitedLeft = kNavAreaLeft + 354;
+const CoordType kJumpMenuHilitedTop = kNavAreaTop + 196;
+
+const CoordType kExitLeft = kNavAreaLeft + 360;
+const CoordType kExitTop = kNavAreaTop + 216;
+
+const CoordType kExitHilitedLeft = kNavAreaLeft + 354;
+const CoordType kExitHilitedTop = kNavAreaTop + 210;
+
+const CoordType kRipTimerLeft = kNavAreaLeft + 95;
+const CoordType kRipTimerTop = kNavAreaTop + 87;
+
+const CoordType kTBPCloseLeft = kNavAreaLeft + 30;
+const CoordType kTBPCloseTop = kNavAreaTop + 16;
+
+const CoordType kTBPRewindLeft = kNavAreaLeft + 86;
+const CoordType kTBPRewindTop = kNavAreaTop + 218;
+
+const CoordType kComparisonCloseLeft = kNavAreaLeft + 50;
+const CoordType kComparisonCloseTop = kNavAreaTop + 14;
+
+const CoordType kComparisonLeftRewindLeft = kNavAreaLeft + 96;
+const CoordType kComparisonLeftRewindTop = kNavAreaTop + 190;
+
+const CoordType kComparisonRightRewindLeft = kNavAreaLeft + 282;
+const CoordType kComparisonRightRewindTop = kNavAreaTop + 190;
+
+const CoordType kComparisonHiliteSpriteLeft = kNavAreaLeft + 45;
+const CoordType kComparisonHiliteSpriteTop = kNavAreaTop + 65;
+
+const CoordType kComparisonHiliteNoradLeft = kNavAreaLeft + 45;
+const CoordType kComparisonHiliteNoradTop = kNavAreaTop + 65;
+
+const CoordType kComparisonHiliteMarsLeft = kNavAreaLeft + 45 + 4;
+const CoordType kComparisonHiliteMarsTop = kNavAreaTop + 65 + 23;
+
+const CoordType kComparisonHiliteCaldoriaLeft = kNavAreaLeft + 45 + 7;
+const CoordType kComparisonHiliteCaldoriaTop = kNavAreaTop + 65 + 46;
+
+const CoordType kComparisonHiliteWSCLeft = kNavAreaLeft + 45 + 11;
+const CoordType kComparisonHiliteWSCTop = kNavAreaTop + 65 + 68;
+
+const CoordType kComparisonChancesSpriteLeft = kNavAreaLeft + 148;
+const CoordType kComparisonChancesSpriteTop = kNavAreaTop + 162;
+
+const CoordType kComparisonChancesNoradLeft = kNavAreaLeft + 148;
+const CoordType kComparisonChancesNoradTop = kNavAreaTop + 162;
+
+const CoordType kComparisonChancesMarsLeft = kNavAreaLeft + 148;
+const CoordType kComparisonChancesMarsTop = kNavAreaTop + 162;
+
+const CoordType kComparisonChancesCaldoriaLeft = kNavAreaLeft + 148;
+const CoordType kComparisonChancesCaldoriaTop = kNavAreaTop + 162 + 1;
+
+const CoordType kComparisonChancesWSCLeft = kNavAreaLeft + 148;
+const CoordType kComparisonChancesWSCTop = kNavAreaTop + 162;
+
+const CoordType kRedirectionSprite1Left = kNavAreaLeft + 58;
+const CoordType kRedirectionSprite1Top = kNavAreaTop + 16;
+
+const CoordType kRedirectionSprite2Left = kNavAreaLeft + 36;
+const CoordType kRedirectionSprite2Top = kNavAreaTop + 166;
+
+const CoordType kRedirectionCCRolloverLeft = kNavAreaLeft + 58;
+const CoordType kRedirectionCCRolloverTop = kNavAreaTop + 16;
+
+const CoordType kRedirectionRRRolloverLeft = kNavAreaLeft + 430;
+const CoordType kRedirectionRRRolloverTop = kNavAreaTop + 30;
+
+const CoordType kRedirectionFDRolloverLeft = kNavAreaLeft + 278;
+const CoordType kRedirectionFDRolloverTop = kNavAreaTop + 160;
+
+const CoordType kRedirectionCCDoorLeft = kNavAreaLeft + 174;
+const CoordType kRedirectionCCDoorTop = kNavAreaTop + 36;
+
+const CoordType kRedirectionRRDoorLeft = kNavAreaLeft + 418;
+const CoordType kRedirectionRRDoorTop = kNavAreaTop + 32;
+
+const CoordType kRedirectionFDDoorLeft = kNavAreaLeft + 298;
+const CoordType kRedirectionFDDoorTop = kNavAreaTop + 240;
+
+const CoordType kRedirectionSecuredLeft = kNavAreaLeft + 36;
+const CoordType kRedirectionSecuredTop = kNavAreaTop + 166;
+
+const CoordType kRedirectionNewTargetLeft = kNavAreaLeft + 36;
+const CoordType kRedirectionNewTargetTop = kNavAreaTop + 166;
+
+const CoordType kRedirectionCloseLeft = kNavAreaLeft + 56;
+const CoordType kRedirectionCloseTop = kNavAreaTop + 220;
+
+static const TimeValue kTSABumpIntoWallIn = 0;
+static const TimeValue kTSABumpIntoWallOut = 148;
+
+static const TimeValue kTSAGTDoorCloseIn = 148;
+static const TimeValue kTSAGTDoorCloseOut = 1570;
+
+static const TimeValue kTSANoOtherDestinationIn = 1570;
+static const TimeValue kTSANoOtherDestinationOut = 3601;
+
+static const TimeValue kTSAEntryDoorCloseIn = 3601;
+static const TimeValue kTSAEntryDoorCloseOut = 4200;
+
+static const TimeValue kTSAInsideDoorCloseIn = 4200;
+static const TimeValue kTSAInsideDoorCloseOut = 4800;
+
+static const TimeValue kTSAVaultCloseIn = 4800;
+static const TimeValue kTSAVaultCloseOut = 5388;
+
+static const TimeValue kTSAPegasusDoorCloseIn = 5388;
+static const TimeValue kTSAPegasusDoorCloseOut = 6457;
+
+static const bool kPegasusUnresolved = false;
+static const bool kPegasusResolved = true;
+static const bool kPegasusCantExit = false;
+static const bool kPegasusCanExit = true;
+
+// Monitor modes
+enum {
+ kMonitorNeutral = 0,
+ kMonitorTheory = 1,
+ kMonitorProcedure = 2,
+ kMonitorBackground = 3,
+ kMonitorNoradComparison = 4,
+ kMonitorMarsComparison = 5,
+ kMonitorCaldoriaComparison = 6,
+ kMonitorWSCComparison = 7,
+
+ kRawModeMask = 0x0F,
+ kPlayingTBPMask = 0x10,
+ kPlayingLeftComparisonMask = 0x20,
+ kPlayingRightComparisonMask = 0x40,
+
+ kPlayingAnyMask = kPlayingTBPMask |
+ kPlayingLeftComparisonMask |
+ kPlayingRightComparisonMask,
+
+ kMonitorPlayingTheory = kMonitorTheory | kPlayingTBPMask,
+ kMonitorPlayingProcedure = kMonitorProcedure | kPlayingTBPMask,
+ kMonitorPlayingBackground = kMonitorBackground | kPlayingTBPMask,
+
+ kMonitorPlayingLeftNoradComparison = kMonitorNoradComparison |
+ kPlayingLeftComparisonMask,
+ kMonitorPlayingRightNoradComparison = kMonitorNoradComparison |
+ kPlayingRightComparisonMask,
+ kMonitorPlayingLeftMarsComparison = kMonitorMarsComparison |
+ kPlayingLeftComparisonMask,
+ kMonitorPlayingRightMarsComparison = kMonitorMarsComparison |
+ kPlayingRightComparisonMask,
+ kMonitorPlayingLeftCaldoriaComparison = kMonitorCaldoriaComparison |
+ kPlayingLeftComparisonMask,
+ kMonitorPlayingRightCaldoriaComparison = kMonitorCaldoriaComparison |
+ kPlayingRightComparisonMask,
+ kMonitorPlayingLeftWSCComparison = kMonitorWSCComparison |
+ kPlayingLeftComparisonMask,
+ kMonitorPlayingRightWSCComparison = kMonitorWSCComparison |
+ kPlayingRightComparisonMask
+};
+
+static const ExtraID s_historicalLogViews[16] = {
+ kTSA0BComparisonView0000,
+ kTSA0BComparisonView0002,
+ kTSA0BComparisonView0020,
+ kTSA0BComparisonView0022,
+ kTSA0BComparisonView0200,
+ kTSA0BComparisonView0202,
+ kTSA0BComparisonView0220,
+ kTSA0BComparisonView0222,
+ kTSA0BComparisonView2000,
+ kTSA0BComparisonView2002,
+ kTSA0BComparisonView2020,
+ kTSA0BComparisonView2022,
+ kTSA0BComparisonView2200,
+ kTSA0BComparisonView2202,
+ kTSA0BComparisonView2220,
+ kTSA0BComparisonView2222
+};
+
+static const int kRedirectionCCRolloverSprite = 0;
+static const int kRedirectionRRRolloverSprite = 1;
+static const int kRedirectionFDRolloverSprite = 2;
+static const int kRedirectionCCDoorSprite = 3;
+static const int kRedirectionRRDoorSprite = 4;
+static const int kRedirectionFDDoorSprite = 5;
+static const int kRedirectionCloseSprite = 6;
+static const int kRedirectionSecuredSprite = 0;
+static const int kRedirectionNewTargetSprite = 1;
+
+void RipTimer::initImage() {
+ _middle = -1;
+
+ _timerImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLeftRipPICTID);
+
+ Common::Rect r;
+ _timerImage.getSurfaceBounds(r);
+ setBounds(r);
+}
+
+void RipTimer::releaseImage() {
+ _timerImage.deallocateSurface();
+}
+
+void RipTimer::draw(const Common::Rect &updateRect) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ Common::Rect r1 = bounds;
+ r1.right = _middle;
+ r1 = updateRect.findIntersectingRect(r1);
+
+ if (!r1.isEmpty()) {
+ Common::Rect r2 = r1;
+ r2.moveTo(r1.left - _bounds.left, r1.top - bounds.top);
+ _timerImage.copyToCurrentPort(r2, r1);
+ }
+}
+
+void RipTimer::timeChanged(const TimeValue newTime) {
+ Common::Rect bounds;
+ getBounds(bounds);
+
+ CoordType newMiddle = bounds.left + bounds.width() * newTime / getDuration();
+
+ if (newMiddle != _middle) {
+ _middle = newMiddle;
+ triggerRedraw();
+ }
+
+ if (newTime == getStop())
+ ((PegasusEngine *)g_engine)->die(kDeathUncreatedInTSA);
+}
+
+FullTSA::FullTSA(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Full TSA", kFullTSAID),
+ _ripTimer(kNoDisplayElement), _sprite1(kNoDisplayElement), _sprite2(kNoDisplayElement), _sprite3(kNoDisplayElement) {
+ setIsItemTaken(kJourneymanKey);
+ setIsItemTaken(kPegasusBiochip);
+ setIsItemTaken(kMapBiochip);
+}
+
+void FullTSA::init() {
+ Neighborhood::init();
+ _ripTimer.setDisplayOrder(kRipTimerOrder);
+ _ripTimer.startDisplaying();
+
+ if (!GameState.getTSASeenRobotGreeting())
+ forceStridingStop(kTSA03, kNorth, kNoAlternateID);
+
+ _sprite1.setDisplayOrder(kMonitorLayer);
+ _sprite1.startDisplaying();
+ _sprite2.setDisplayOrder(kMonitorLayer);
+ _sprite2.startDisplaying();
+ _sprite3.setDisplayOrder(kMonitorLayer);
+ _sprite3.startDisplaying();
+
+ // Fix a mistake in the world builder tables.
+ HotspotInfoTable::Entry *entry = findHotspotEntry(kTSA23WestChipsSpotID);
+ entry->hotspotItem = kPegasusBiochip;
+}
+
+void FullTSA::dieUncreatedInTSA() {
+ die(kDeathUncreatedInTSA);
+}
+
+void FullTSA::start() {
+ g_energyMonitor->stopEnergyDraining();
+
+ if (!GameState.getScoringEnterTSA()) {
+ _utilityFuse.primeFuse(GameState.getTSAFuseTimeLimit());
+ _utilityFuse.setFunctor(new Common::Functor0Mem<void, FullTSA>(this, &FullTSA::dieUncreatedInTSA));
+ _utilityFuse.lightFuse();
+ } else if (GameState.getTSAState() == kTSAPlayerDetectedRip || GameState.getTSAState() == kTSAPlayerNeedsHistoricalLog) {
+ _ripTimer.initImage();
+ _ripTimer.moveElementTo(kRipTimerLeft, kRipTimerTop);
+ _ripTimer.setSegment(0, kRipTimeLimit, kRipTimeScale);
+ _ripTimer.setTime(GameState.getRipTimerTime());
+ _ripTimer.start();
+ }
+
+ Neighborhood::start();
+}
+
+void FullTSA::flushGameState() {
+ GameState.setRipTimerTime(_ripTimer.getTime());
+ GameState.setTSAFuseTimeLimit(_utilityFuse.getTimeRemaining());
+}
+
+Common::String FullTSA::getBriefingMovie() {
+ Common::String movieName = Neighborhood::getBriefingMovie();
+
+ if (movieName.empty()) {
+ RoomID room = GameState.getCurrentRoom();
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNotArrived:
+ case kTSAPlayerForcedReview:
+ if (room >= kTSA16 && room <= kTSA0B)
+ return "Images/AI/TSA/XT01A";
+
+ return "Images/AI/TSA/XT01";
+ case kTSAPlayerDetectedRip:
+ case kTSAPlayerNeedsHistoricalLog:
+ return "Images/AI/TSA/XT02";
+ case kTSAPlayerGotHistoricalLog:
+ case kTSAPlayerInstalledHistoricalLog:
+ return "Images/AI/TSA/XT03";
+ default:
+ switch (getCurrentActivation()) {
+ case kActivationJumpToPrehistoric:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTSA37PegasusAI2, kHintInterruption);
+ startExtraSequenceSync(kTSA37AI2ToPrehistoric, kFilterNoInput);
+ g_AIChip->clearClicked();
+ break;
+ case kActivationJumpToNorad:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTSA37PegasusAI7, kHintInterruption);
+ startExtraSequenceSync(kTSA37AI7ToNorad, kFilterNoInput);
+ g_AIChip->clearClicked();
+ break;
+ case kActivationJumpToMars:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTSA37PegasusAI6, kHintInterruption);
+ startExtraSequenceSync(kTSA37AI6ToMars, kFilterNoInput);
+ g_AIChip->clearClicked();
+ break;
+ case kActivationJumpToWSC:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTSA37PegasusAI5, kHintInterruption);
+ startExtraSequenceSync(kTSA37AI5ToWSC, kFilterNoInput);
+ g_AIChip->clearClicked();
+ break;
+ default:
+ if (GameState.allTimeZonesFinished())
+ return "Images/AI/TSA/XT05";
+
+ return "Images/AI/TSA/XT04";
+ }
+ break;
+ }
+ }
+
+ return movieName;
+}
+
+Common::String FullTSA::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNotArrived:
+ case kTSAPlayerForcedReview:
+ case kTSAPlayerDetectedRip:
+ case kTSAPlayerNeedsHistoricalLog:
+ return "Images/AI/TSA/XTE1";
+ default:
+ if (GameState.getCurrentRoom() == kTSA37) {
+ g_AIChip->showEnvScanClicked();
+ startExtraSequenceSync(kTSA37EnvironmentalScan, kHintInterruption);
+
+ switch (getCurrentActivation()) {
+ case kActivationJumpToPrehistoric:
+ startExtraSequenceSync(kTSA37AI2ToPrehistoric, kFilterNoInput);
+ break;
+ case kActivationJumpToNorad:
+ startExtraSequenceSync(kTSA37AI7ToNorad, kFilterNoInput);
+ showExtraView(kTSA37JumpToNoradMenu);
+ break;
+ case kActivationJumpToMars:
+ startExtraSequenceSync(kTSA37AI6ToMars, kFilterNoInput);
+ showExtraView(kTSA37JumpToMarsMenu);
+ break;
+ case kActivationJumpToWSC:
+ startExtraSequenceSync(kTSA37AI5ToWSC, kFilterNoInput);
+ showExtraView(kTSA37JumpToWSCMenu);
+ break;
+ default:
+ startExtraSequenceSync(kTSA37AI4ToMainMenu, kFilterNoInput);
+ break;
+ }
+
+ g_AIChip->clearClicked();
+ } else if (GameState.allTimeZonesFinished()) {
+ return "Images/AI/TSA/XTE1";
+ } else {
+ return "Images/AI/TSA/XTE2";
+ }
+ break;
+ }
+ }
+
+ return movieName;
+}
+
+uint FullTSA::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ if (GameState.getCurrentRoom() == kTSA0B && GameState.getTSA0BZoomedIn())
+ numHints = 3;
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String FullTSA::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty())
+ movieName = Common::String::format("Images/AI/TSA/XT20NH%d", hintNum);
+
+ return movieName;
+}
+
+void FullTSA::loadAmbientLoops() {
+ RoomID room = GameState.getCurrentRoom();
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerDetectedRip:
+ case kTSAPlayerNeedsHistoricalLog:
+ if ((room >= kTSA16 && room <= kTSA0B) || (room >= kTSA21Cyan && room <= kTSA24Cyan) || (room >= kTSA21Red && room <= kTSA24Red))
+ loadLoopSound1("Sounds/TSA/TSA CLAXON.22K.AIFF", 0x100 / 4, 0, 0);
+ else if (room == kTSA25Cyan || room == kTSA25Red)
+ loadLoopSound1("Sounds/TSA/TSA CLAXON.22K.AIFF", 0x100 / 6, 0, 0);
+ else
+ loadLoopSound1("Sounds/TSA/TSA EchoClaxon.22K.AIFF", 0x100 / 4, 0, 0);
+ break;
+ default:
+ if (room >= kTSA00 && room <= kTSA02)
+ loadLoopSound1("Sounds/TSA/T01NAE.NEW.22K.AIFF");
+ else if (room >= kTSA03 && room <= kTSA15)
+ loadLoopSound1("Sounds/TSA/T01NAE.NEW.22K.AIFF");
+ else if (room >= kTSA16 && room <= kTSA0B)
+ loadLoopSound1("Sounds/TSA/T14SAEO1.22K.AIFF");
+ else if (room >= kTSA21Cyan && room <= kTSA25Red)
+ loadLoopSound1("Sounds/TSA/T15SAE01.22K.AIFF");
+ else if (room >= kTSA26 && room <= kTSA37)
+ loadLoopSound1("Sounds/TSA/T01NAE.NEW.22K.AIFF");
+ break;
+ }
+}
+
+short FullTSA::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ int16 result = Neighborhood::getStaticCompassAngle(room, dir);
+
+ switch (room) {
+ case kTSA08:
+ result += kCompassShift;
+ break;
+ case kTSA09:
+ result -= kCompassShift;
+ break;
+ case kTSA10:
+ result += kCompassShift * 2;
+ break;
+ case kTSA11:
+ case kTSA22Cyan:
+ case kTSA22Red:
+ result -= kCompassShift * 2;
+ break;
+ case kTSA12:
+ result += kCompassShift * 3;
+ break;
+ case kTSA13:
+ result -= kCompassShift * 3;
+ break;
+ case kTSA14:
+ case kTSA16:
+ case kTSA17:
+ case kTSA18:
+ case kTSA19:
+ result += kCompassShift * 4;
+ break;
+ case kTSA0B:
+ result += kCompassShift * 4;
+
+ if (dir == kWest)
+ result += 30;
+ else if (dir == kEast)
+ result -= 30;
+ break;
+ case kTSA33:
+ result += kCompassShift * 4;
+ break;
+ case kTSA15:
+ case kTSA21Cyan:
+ case kTSA24Cyan:
+ case kTSA25Cyan:
+ case kTSA21Red:
+ case kTSA24Red:
+ case kTSA25Red:
+ case kTSA26:
+ case kTSA27:
+ case kTSA28:
+ case kTSA29:
+ case kTSA30:
+ result -= kCompassShift * 4;
+ break;
+ case kTSA23Cyan:
+ case kTSA23Red:
+ result -= kCompassShift * 6;
+ break;
+ case kTSA32:
+ result -= kCompassShift * 8;
+ break;
+ case kTSA34:
+ result -= kCompassShift * 12;
+ break;
+ case kTSA35:
+ result += kCompassShift * 8;
+ break;
+ case kTSA37:
+ result -= kCompassShift * 2;
+ break;
+ }
+
+ return result;
+}
+
+void FullTSA::getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove) {
+ Neighborhood::getExitCompassMove(exitEntry, compassMove);
+
+ switch (MakeRoomView(exitEntry.room, exitEntry.direction)) {
+ case MakeRoomView(kTSA01, kSouth):
+ compassMove.insertFaderKnot(exitEntry.movieStart, -180);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 3, -180);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 33,
+ getStaticCompassAngle(exitEntry.exitRoom, exitEntry.exitDirection));
+ break;
+ case MakeRoomView(kTSA11, kEast):
+ if (getCurrentAlternate() == kAltTSARobotsAtReadyRoom) {
+ compassMove.makeTwoKnotFaderSpec(kFullTSAMovieScale, exitEntry.movieStart,
+ getStaticCompassAngle(kTSA11, kEast), exitEntry.movieEnd,
+ getStaticCompassAngle(kTSA13, kEast));
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 13, compassMove.getNthKnotValue(1));
+ }
+ break;
+ case MakeRoomView(kTSA34, kNorth):
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 48,
+ getStaticCompassAngle(exitEntry.room, exitEntry.direction));
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 68,
+ getStaticCompassAngle(exitEntry.exitRoom, exitEntry.exitDirection));
+ break;
+ case MakeRoomView(kTSA37, kNorth):
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 38,
+ getStaticCompassAngle(exitEntry.room, exitEntry.direction));
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 64,
+ getStaticCompassAngle(exitEntry.room, exitEntry.direction) + kCompassShift * 3 / 2);
+ compassMove.insertFaderKnot(exitEntry.movieStart + kFullTSAFrameDuration * 105,
+ getStaticCompassAngle(exitEntry.exitRoom, exitEntry.exitDirection));
+ break;
+ }
+}
+
+void FullTSA::getExtraCompassMove(const ExtraTable::Entry &extraEntry, FaderMoveSpec &compassMove) {
+ int16 angle;
+
+ switch (extraEntry.extra) {
+ case kTSA0BEastTurnLeft:
+ case kTSA0BNorthTurnLeft:
+ angle =getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), extraEntry.movieStart, angle,
+ extraEntry.movieEnd, angle - 60);
+ break;
+ case kTSA0BNorthTurnRight:
+ case kTSA0BWestTurnRight:
+ angle = getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), extraEntry.movieStart, angle,
+ extraEntry.movieEnd, angle + 60);
+ break;
+ case kTSA22RedEastZoomInSequence:
+ angle = getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), extraEntry.movieStart, angle,
+ extraEntry.movieEnd, angle);
+ compassMove.insertFaderKnot(extraEntry.movieStart + 1200, angle - kCompassShift * 2);
+ compassMove.insertFaderKnot(extraEntry.movieStart + 8160, angle - kCompassShift * 2);
+ compassMove.insertFaderKnot(extraEntry.movieStart + 9840, angle);
+ break;
+ case kTSA23RedWestVaultZoomInSequence:
+ angle = getStaticCompassAngle(GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ compassMove.makeTwoKnotFaderSpec(_navMovie.getScale(), extraEntry.movieStart, angle,
+ extraEntry.movieEnd, angle);
+ compassMove.insertFaderKnot(extraEntry.movieStart + 1200, angle - kCompassShift * 2);
+ compassMove.insertFaderKnot(extraEntry.movieStart + 10100, angle - kCompassShift * 2);
+ compassMove.insertFaderKnot(extraEntry.movieStart + 11880, angle);
+ break;
+ default:
+ Neighborhood::getExtraCompassMove(extraEntry, compassMove);
+ break;
+ }
+}
+
+uint16 FullTSA::getDateResID() const {
+ return kDate2318ID;
+}
+
+TimeValue FullTSA::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraID extraID = 0xffffffff;
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kTSA0B, kEast):
+ if (GameState.getTSA0BZoomedIn())
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerInstalledHistoricalLog:
+ case kTSABossSawHistoricalLog:
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ extraID = s_historicalLogViews[getHistoricalLogIndex()];
+ break;
+ default:
+ extraID = kTSA0BEastZoomedView;
+ break;
+ }
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (GameState.getTSA0BZoomedIn())
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNeedsHistoricalLog:
+ extraID = kTSA0BNorthRipView1;
+ break;
+ default:
+ extraID = kTSA0BNorthZoomedView;
+ break;
+ }
+ break;
+ case MakeRoomView(kTSA0B, kWest):
+ if (GameState.getTSA0BZoomedIn())
+ extraID = kTSA0BWestZoomedView;
+ break;
+ case MakeRoomView(kTSA22Red, kEast):
+ if (_privateFlags.getFlag(kTSAPrivateKeyVaultOpenFlag)) {
+ if (_vm->itemInLocation(kJourneymanKey, kFullTSAID, kTSA22Red, kEast))
+ extraID = kTSA22RedEastVaultViewWithKey;
+ else
+ extraID = kTSA22RedEastVaultViewNoKey;
+ }
+ break;
+ case MakeRoomView(kTSA23Red, kWest):
+ if (_privateFlags.getFlag(kTSAPrivateChipVaultOpenFlag)) {
+ if (_vm->itemInLocation(kPegasusBiochip, kFullTSAID, kTSA23Red, kWest))
+ extraID = kTSA23RedWestVaultViewWithChips;
+ else
+ extraID = kTSA23RedWestVaultViewNoChips;
+ }
+ break;
+ case MakeRoomView(kTSA37, kNorth):
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerGotHistoricalLog:
+ extraID = kTSA37ReviewRequiredToExit;
+ break;
+ case kPlayerFinishedWithTSA:
+ extraID = kTSA37CongratulationsToExit;
+ break;
+ default:
+ extraID = kTSA37AI3ToHorse;
+ break;
+ }
+ break;
+ }
+
+ if (extraID != 0xffffffff) {
+ ExtraTable::Entry entry;
+ getExtraEntry(extraID, entry);
+ return entry.movieEnd - 1;
+ }
+
+ return Neighborhood::getViewTime(room, direction);
+}
+
+void FullTSA::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &entry) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kTSA0B, kNorth):
+ case MakeRoomView(kTSA0B, kEast):
+ case MakeRoomView(kTSA0B, kWest):
+ if (!GameState.getTSA0BZoomedIn())
+ Neighborhood::findSpotEntry(room, direction, flags, entry);
+ break;
+ default:
+ Neighborhood::findSpotEntry(room, direction, flags, entry);
+ break;
+ }
+}
+
+void FullTSA::getExtraEntry(const uint32 id, ExtraTable::Entry &extraEntry) {
+ Neighborhood::getExtraEntry(id, extraEntry);
+
+ if (id == kTSA0BShowGuardRobots)
+ extraEntry.movieStart += kFullTSAFrameDuration * 3;
+}
+
+void FullTSA::pickedUpItem(Item *item) {
+ BiochipItem *biochip;
+
+ switch (item->getObjectID()) {
+ case kJourneymanKey:
+ GameState.setScoringGotJourneymanKey(true);
+ break;
+ case kPegasusBiochip:
+ biochip = (BiochipItem *)_vm->getAllItems().findItemByID(kMapBiochip);
+ _vm->addItemToBiochips(biochip);
+ GameState.setScoringGotPegasusBiochip(true);
+ break;
+ }
+}
+
+void FullTSA::playExtraMovie(const ExtraTable::Entry &extraEntry, const NotificationFlags flags, const InputBits interruptionInput) {
+ switch (extraEntry.extra) {
+ case kTSA0BNorthZoomIn:
+ if (_privateFlags.getFlag(kTSAPrivateLogReaderOpenFlag)) {
+ _privateFlags.setFlag(kTSAPrivateLogReaderOpenFlag, false);
+ requestExtraSequence(kTSA0BNorthHistLogClose, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthZoomIn, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ Neighborhood::playExtraMovie(extraEntry, flags, interruptionInput);
+ }
+ break;
+ case kTSA0BNorthZoomOut:
+ if (_ripTimer.isVisible())
+ _ripTimer.hide();
+
+ shutDownRobotMonitor();
+ Neighborhood::playExtraMovie(extraEntry, flags, interruptionInput);
+ break;
+ case kTSA0BEastZoomOut:
+ shutDownComparisonMonitor();
+ Neighborhood::playExtraMovie(extraEntry, flags, interruptionInput);
+ break;
+ default:
+ Neighborhood::playExtraMovie(extraEntry, flags, interruptionInput);
+ break;
+ }
+}
+
+void FullTSA::startDoorOpenMovie(const TimeValue startTime, const TimeValue stopTime) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kTSA00, kNorth):
+ if (GameState.getLastNeighborhood() != kFullTSAID) {
+ startExtraSequence(kTSAArriveFromCaldoria, kDoorOpenCompletedFlag, kFilterNoInput);
+ return;
+ }
+ break;
+ case MakeRoomView(kTSA02, kNorth):
+ if (!GameState.getTSAIDedAtDoor()) {
+ GameState.setTSAIDedAtDoor(true);
+ requestExtraSequence(kTSA02NorthZoomIn, 0, kFilterNoInput);
+ requestExtraSequence(kTSA02NorthTenSecondDoor, 0, kFilterNoInput);
+
+ if (GameState.getTSASeenAgent3AtDoor()) {
+ requestExtraSequence(kTSA02NorthZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ GameState.setTSASeenAgent3AtDoor(true);
+ requestExtraSequence(kTSA02NorthZoomOut, 0, kFilterNoInput);
+ requestExtraSequence(kTSA02NorthDoorWithAgent3, kDoorOpenCompletedFlag, kFilterNoInput);
+ }
+ return;
+ }
+ break;
+ case MakeRoomView(kTSA03, kSouth):
+ if (GameState.getTSAState() == kRobotsAtFrontDoor) {
+ playDeathExtra(kTSA03SouthRobotDeath, kDeathShotByTSARobots);
+ return;
+ }
+ break;
+ case MakeRoomView(kTSA16, kNorth):
+ if (GameState.getTSAState() == kRobotsAtCommandCenter) {
+ playDeathExtra(kTSA16NorthRobotDeath, kDeathShotByTSARobots);
+ return;
+ }
+ break;
+ }
+
+ Neighborhood::startDoorOpenMovie(startTime, stopTime);
+}
+
+InputBits FullTSA::getInputFilter() {
+ InputBits result = Neighborhood::getInputFilter();
+
+ switch (GameState.getCurrentRoom()) {
+ case kTSA0B:
+ if (GameState.getT0BMonitorMode() != kMonitorNeutral)
+ // Only allow a click.
+ result &= JMPPPInput::getClickInputFilter();
+ break;
+ case kTSA37:
+ // Can't move forward in Pegasus. Only press the exit button.
+ result &= ~(kFilterUpButton | kFilterUpAuto);
+ break;
+ }
+
+ return result;
+}
+
+void FullTSA::turnLeft() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kTSA15, kNorth):
+ if (GameState.getTSAState() == kTSAPlayerNeedsHistoricalLog)
+ setCurrentAlternate(kAltTSANormal);
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (_ripTimer.isVisible())
+ _ripTimer.hide();
+ releaseSprites();
+ break;
+ case MakeRoomView(kTSA0B, kEast):
+ shutDownComparisonMonitor();
+ break;
+ }
+
+ Neighborhood::turnLeft();
+}
+
+void FullTSA::turnRight() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kTSA15, kSouth):
+ if (GameState.getTSAState() == kTSAPlayerNeedsHistoricalLog)
+ setCurrentAlternate(kAltTSANormal);
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (_ripTimer.isVisible())
+ _ripTimer.hide();
+ releaseSprites();
+ break;
+ case MakeRoomView(kTSA0B, kEast):
+ shutDownComparisonMonitor();
+ break;
+ }
+
+ Neighborhood::turnRight();
+}
+
+void FullTSA::openDoor() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kTSA15, kSouth):
+ if (GameState.getTSAState() == kTSAPlayerNeedsHistoricalLog || GameState.getTSAState() == kRobotsAtFrontDoor)
+ setCurrentAlternate(kAltTSARedAlert);
+ break;
+ }
+
+ Neighborhood::openDoor();
+}
+
+CanMoveForwardReason FullTSA::canMoveForward(ExitTable::Entry &entry) {
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kTSA25Red, kNorth))
+ return kCantMoveBlocked;
+
+ return Neighborhood::canMoveForward(entry);
+}
+
+CanOpenDoorReason FullTSA::canOpenDoor(DoorTable::Entry &entry) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kTSA02, kNorth):
+ if (!GameState.getTSAFrontDoorUnlockedOutside())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kTSA03, kSouth):
+ if (!GameState.getTSAFrontDoorUnlockedInside())
+ return kCantOpenLocked;
+ break;
+ case MakeRoomView(kTSA16, kNorth):
+ if (GameState.getTSACommandCenterLocked())
+ return kCantOpenLocked;
+ break;
+ }
+
+ return Neighborhood::canOpenDoor(entry);
+}
+
+void FullTSA::bumpIntoWall() {
+ requestSpotSound(kTSABumpIntoWallIn, kTSABumpIntoWallOut, kFilterAllInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+void FullTSA::downButton(const Input &input) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kTSA0B, kEast):
+ if (GameState.getTSA0BZoomedIn())
+ startExtraSequence(kTSA0BEastZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (GameState.getTSA0BZoomedIn())
+ startExtraSequence(kTSA0BNorthZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kTSA0B, kWest):
+ if (GameState.getTSA0BZoomedIn() && GameState.getT0BMonitorMode() == kMonitorNeutral)
+ startExtraSequence(kTSA0BWestZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ Neighborhood::downButton(input);
+ }
+}
+
+void FullTSA::activateOneHotspot(HotspotInfoTable::Entry &entry, Hotspot *spot) {
+ switch (spot->getObjectID()) {
+ case kTSA0BEastLeftRewindSpotID:
+ case kTSA0BEastLeftPlaySpotID:
+ if (_privateFlags.getFlag(kTSAPrivatePlayingRightComparisonFlag))
+ spot->setInactive();
+ else
+ Neighborhood::activateOneHotspot(entry, spot);
+ break;
+ case kTSA0BEastRightRewindSpotID:
+ case kTSA0BEastRightPlaySpotID:
+ if (_privateFlags.getFlag(kTSAPrivatePlayingLeftComparisonFlag))
+ spot->setInactive();
+ else
+ Neighborhood::activateOneHotspot(entry, spot);
+ break;
+ default:
+ Neighborhood::activateOneHotspot(entry, spot);
+ break;
+ }
+}
+
+void FullTSA::activateHotspots() {
+ Neighborhood::activateHotspots();
+
+ switch (MakeRoomView(GameState.getCurrentRoom(), GameState.getCurrentDirection())) {
+ case MakeRoomView(kTSA02, kNorth):
+ if (!GameState.getTSAFrontDoorUnlockedOutside())
+ _vm->getAllHotspots().activateOneHotspot(kTSA02DoorSpotID);
+ break;
+ case MakeRoomView(kTSA0B, kEast):
+ if (GameState.getTSA0BZoomedIn())
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerInstalledHistoricalLog:
+ case kTSABossSawHistoricalLog:
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ if (getCurrentActivation() != kActivateTSA0BComparisonVideo) {
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BEastCompareNoradSpotID);
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BEastCompareMarsSpotID);
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BEastCompareCaldoriaSpotID);
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BEastCompareWSCSpotID);
+ }
+ break;
+ }
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (GameState.getTSA0BZoomedIn())
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BNorthRobotsToCommandCenterSpotID);
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BNorthRobotsToReadyRoomSpotID);
+ _vm->getAllHotspots().activateOneHotspot(kTSA0BNorthRobotsToFrontDoorSpotID);
+ break;
+ }
+ break;
+ }
+}
+
+void FullTSA::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ switch (clickedSpot->getObjectID()) {
+ case kTSAGTOtherSpotID:
+ showExtraView(kTSAGTOtherChoice);
+ playSpotSoundSync(kTSANoOtherDestinationIn, kTSANoOtherDestinationOut);
+ showExtraView(kTSAGTCardSwipe);
+ break;
+ case kTSA02DoorSpotID:
+ GameState.setTSAFrontDoorUnlockedOutside(true);
+ Neighborhood::clickInHotspot(input, clickedSpot);
+ break;
+ case kTSA03EastJimenezSpotID:
+ startExtraLongSequence(kTSA03JimenezZoomIn, kTSA03JimenezZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA03WestCrenshawSpotID:
+ startExtraLongSequence(kTSA03CrenshawZoomIn, kTSA03CrenshawZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA04EastMatsumotoSpotID:
+ startExtraLongSequence(kTSA04MatsumotoZoomIn, kTSA04MatsumotoZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA04WestCastilleSpotID:
+ startExtraLongSequence(kTSA04CastilleZoomIn, kTSA04CastilleZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA05EastSinclairSpotID:
+ startExtraLongSequence(kTSA05SinclairZoomIn, kTSA05SinclairZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA05WestWhiteSpotID:
+ startExtraLongSequence(kTSA05WhiteZoomIn, kTSA05WhiteZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA0BEastCompareNoradSpotID:
+ initializeComparisonMonitor(kMonitorNoradComparison, kTSA0BNoradComparisonView);
+ break;
+ case kTSA0BEastCompareMarsSpotID:
+ initializeComparisonMonitor(kMonitorMarsComparison, kTSA0BMarsComparisonView);
+ break;
+ case kTSA0BEastCompareCaldoriaSpotID:
+ initializeComparisonMonitor(kMonitorCaldoriaComparison, kTSA0BCaldoriaComparisonView);
+ break;
+ case kTSA0BEastCompareWSCSpotID:
+ initializeComparisonMonitor(kMonitorWSCComparison, kTSA0BWSCComparisonView);
+ break;
+ case kTSA0BEastCloseVideoSpotID:
+ _navMovie.stop();
+ _sprite3.show();
+ _vm->delayShell(1, 2);
+ _sprite3.hide();
+ initializeComparisonMonitor(kMonitorNeutral, 0);
+ break;
+ case kTSA0BEastLeftPlaySpotID:
+ playLeftComparison();
+ break;
+ case kTSA0BEastRightPlaySpotID:
+ playRightComparison();
+ break;
+
+ // Command center
+ case kTSA0BWestTheorySpotID:
+ initializeTBPMonitor(kMonitorTheory, kTSA0BTBPTheoryHighlight);
+ break;
+ case kTSA0BWestBackgroundSpotID:
+ initializeTBPMonitor(kMonitorBackground, kTSA0BTBPBackgroundHighlight);
+ break;
+ case kTSA0BWestProcedureSpotID:
+ initializeTBPMonitor(kMonitorProcedure, kTSA0BTBPProcedureHighlight);
+ break;
+ case kTSA0BWestCloseVideoSpotID:
+ _navMovie.stop();
+ _sprite2.show();
+ _vm->delayShell(1, 2);
+ _sprite2.hide();
+ initializeTBPMonitor(kMonitorNeutral, 0);
+ break;
+ case kTSA0BWestPlayVideoSpotID:
+ playTBPMonitor();
+ break;
+ case kTSA0BEastLeftRewindSpotID:
+ case kTSA0BEastRightRewindSpotID:
+ case kTSA0BWestRewindVideoSpotID:
+ if ((GameState.getT0BMonitorMode() & kPlayingAnyMask) != 0) {
+ bool playing = _navMovie.isRunning();
+ if (playing)
+ _navMovie.stop();
+
+ if (clickedSpot->getObjectID() == kTSA0BEastRightRewindSpotID)
+ _sprite2.show();
+ else
+ _sprite1.show();
+
+ _vm->delayShell(1, 2);
+
+ if (clickedSpot->getObjectID() == kTSA0BEastRightRewindSpotID)
+ _sprite2.hide();
+ else
+ _sprite1.hide();
+
+ _navMovie.setTime(GameState.getT0BMonitorStart());
+
+ if (playing) {
+ _navMovie.start();
+ } else {
+ _privateFlags.setFlag(kTSAPrivatePlayingLeftComparisonFlag, false);
+ _privateFlags.setFlag(kTSAPrivatePlayingRightComparisonFlag, false);
+ }
+ }
+ break;
+ case kTSA22EastMonitorSpotID:
+ requestExtraSequence(kTSA22RedEastZoomInSequence, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA23WestMonitorSpotID:
+ requestExtraSequence(kTSA23RedWestVaultZoomInSequence, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA0BNorthRobotsToCommandCenterSpotID:
+ _sprite1.setCurrentFrameIndex(kRedirectionCCDoorSprite);
+ _sprite1.show();
+ _vm->delayShell(1, 2);
+ _sprite1.hide();
+
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ // Nothing
+ break;
+ case kRobotsAtFrontDoor:
+ GameState.setTSAState(kRobotsAtCommandCenter);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromFrontDoorToCommandCenter, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kRobotsAtReadyRoom:
+ GameState.setTSAState(kRobotsAtCommandCenter);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromReadyRoomToCommandCenter, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ break;
+ case kTSA0BNorthRobotsToReadyRoomSpotID:
+ _sprite1.setCurrentFrameIndex(kRedirectionRRDoorSprite);
+ _sprite1.show();
+ _vm->delayShell(1, 2);
+ _sprite1.hide();
+
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ GameState.setTSAState(kRobotsAtReadyRoom);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromCommandCenterToReadyRoom, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kRobotsAtFrontDoor:
+ GameState.setTSAState(kRobotsAtReadyRoom);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromFrontDoorToReadyRoom, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kRobotsAtReadyRoom:
+ // Nothing
+ break;
+ }
+ break;
+ case kTSA0BNorthRobotsToFrontDoorSpotID:
+ _sprite1.setCurrentFrameIndex(kRedirectionFDDoorSprite);
+ _sprite1.show();
+ _vm->delayShell(1, 2);
+ _sprite1.hide();
+
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ GameState.setTSAState(kRobotsAtFrontDoor);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromCommandCenterToFrontDoor, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kRobotsAtFrontDoor:
+ // Nothing
+ break;
+ case kRobotsAtReadyRoom:
+ GameState.setTSAState(kRobotsAtFrontDoor);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromReadyRoomToFrontDoor, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ break;
+
+ // Pegasus
+ case kTSA37NorthJumpToPrehistoricSpotID:
+ startExtraSequence(kTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA37NorthExitSpotID:
+ _sprite2.setCurrentFrameIndex(1);
+ _vm->delayShell(1, 2);
+ releaseSprites();
+ moveForward();
+ break;
+ case kTSA37NorthJumpMenuSpotID:
+ _sprite2.setCurrentFrameIndex(1);
+ _vm->delayShell(1, 2);
+ releaseSprites();
+ break;
+ case kTSA37NorthJumpToNoradSpotID:
+ GameState.setTSAState(kPlayerOnWayToNorad);
+ requestExtraSequence(kTSA37JumpToNorad, 0, kFilterNoInput);
+
+ if (!GameState.getBeenToNorad()) {
+ requestExtraSequence(kTSA37NoradToAI7, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37PegasusAI7, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37AI7ToNorad, 0, kFilterNoInput);
+ GameState.setBeenToNorad(true);
+ }
+
+ requestExtraSequence(kTSA37NoradToDepart, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA37NorthJumpToMarsSpotID:
+ GameState.setTSAState(kPlayerOnWayToMars);
+ requestExtraSequence(kTSA37JumpToMars, 0, kFilterNoInput);
+
+ if (!GameState.getBeenToMars()) {
+ requestExtraSequence(kTSA37MarsToAI6, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37PegasusAI6, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37AI6ToMars, 0, kFilterNoInput);
+ GameState.setBeenToMars(true);
+ }
+
+ requestExtraSequence(kTSA37MarsToDepart, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA37NorthJumpToWSCSpotID:
+ GameState.setTSAState(kPlayerOnWayToWSC);
+ requestExtraSequence(kTSA37JumpToWSC, 0, kFilterNoInput);
+
+ if (!GameState.getBeenToWSC()) {
+ requestExtraSequence(kTSA37WSCToAI5, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37PegasusAI5, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37AI5ToWSC, 0, kFilterNoInput);
+ GameState.setBeenToWSC(true);
+ }
+
+ requestExtraSequence(kTSA37WSCToDepart, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ Neighborhood::clickInHotspot(input, clickedSpot);
+ break;
+ }
+}
+
+void FullTSA::showMainJumpMenu() {
+ ExtraID jumpMenuView = kTSA37JumpMenu000;
+
+ if (GameState.getNoradFinished())
+ jumpMenuView += 4;
+ if (GameState.getMarsFinished())
+ jumpMenuView += 2;
+ if (GameState.getWSCFinished())
+ jumpMenuView += 1;
+
+ showExtraView(jumpMenuView);
+ setCurrentActivation(kActivationMainJumpMenu);
+}
+
+void FullTSA::playTBPMonitor() {
+ InputDevice.waitInput(kFilterAllButtons);
+
+ if ((GameState.getT0BMonitorMode() & kPlayingTBPMask) == 0) {
+ ExtraID extra;
+
+ switch (GameState.getT0BMonitorMode() & kRawModeMask) {
+ case kMonitorTheory:
+ GameState.setTSASeenTheory(true);
+ extra = kTSA0BTBPTheory;
+ GameState.setScoringSawTheory(true);
+ break;
+ case kMonitorBackground:
+ GameState.setTSASeenBackground(true);
+ extra = kTSA0BTBPBackground;
+ GameState.setScoringSawBackground(true);
+ break;
+ case kMonitorProcedure:
+ GameState.setTSASeenProcedure(true);
+ extra = kTSA0BTBPProcedure;
+ GameState.setScoringSawProcedure(true);
+ break;
+ default:
+ error("Invalid monitor mode");
+ }
+
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() | kPlayingTBPMask);
+
+ ExtraTable::Entry entry;
+ getExtraEntry(extra, entry);
+ _lastExtra = extra;
+
+ GameState.setT0BMonitorStart(entry.movieStart + kFullTSAFrameDuration * 5);
+ startMovieSequence(GameState.getT0BMonitorStart(), entry.movieEnd, kExtraCompletedFlag, false, kFilterAllInput);
+ } else if (_navMovie.isRunning()) {
+ _navMovie.stop();
+ } else {
+ _navMovie.start();
+ }
+}
+
+void FullTSA::initializeTBPMonitor(const int newMode, const ExtraID highlightExtra) {
+ GameState.setT0BMonitorMode(newMode);
+
+ if (newMode != kMonitorNeutral) {
+ showExtraView(highlightExtra);
+ _vm->delayShell(1, 2);
+ setCurrentActivation(kActivateTSA0BTBPVideo);
+ _sprite1.addPICTResourceFrame(kTBPRewindPICTID, false, 0, 0);
+ _sprite1.moveElementTo(kTBPRewindLeft, kTBPRewindTop);
+ _sprite1.setCurrentFrameIndex(0);
+ _sprite2.addPICTResourceFrame(kTBPCloseBoxPICTID, false, 0, 0);
+ _sprite2.moveElementTo(kTBPCloseLeft, kTBPCloseTop);
+ _sprite2.setCurrentFrameIndex(0);
+ playTBPMonitor();
+ } else {
+ if (GameState.getTSAState() == kTSAPlayerForcedReview && GameState.getTSASeenTheory() &&
+ GameState.getTSASeenBackground() && GameState.getTSASeenProcedure()) {
+ setOffRipAlarm();
+ } else {
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ updateViewFrame();
+ }
+
+ releaseSprites();
+ }
+
+ _interruptionFilter = kFilterAllInput;
+}
+
+void FullTSA::startUpComparisonMonitor() {
+ releaseSprites();
+
+ _sprite1.addPICTResourceFrame(kComparisonHiliteNoradPICTID, false,
+ kComparisonHiliteNoradLeft - kComparisonHiliteSpriteLeft,
+ kComparisonHiliteNoradTop - kComparisonHiliteSpriteTop);
+ _sprite1.addPICTResourceFrame(kComparisonHiliteMarsPICTID, false,
+ kComparisonHiliteMarsLeft - kComparisonHiliteSpriteLeft,
+ kComparisonHiliteMarsTop - kComparisonHiliteSpriteTop);
+ _sprite1.addPICTResourceFrame(kComparisonHiliteCaldoriaPICTID, false,
+ kComparisonHiliteCaldoriaLeft - kComparisonHiliteSpriteLeft,
+ kComparisonHiliteCaldoriaTop - kComparisonHiliteSpriteTop);
+ _sprite1.addPICTResourceFrame(kComparisonHiliteWSCPICTID, false,
+ kComparisonHiliteWSCLeft - kComparisonHiliteSpriteLeft,
+ kComparisonHiliteWSCTop - kComparisonHiliteSpriteTop);
+
+ _sprite1.setCurrentFrameIndex(0);
+ _sprite1.moveElementTo(kComparisonHiliteSpriteLeft, kComparisonHiliteSpriteTop);
+
+ _sprite2.addPICTResourceFrame(kComparisonChancesNoradPICTID, false,
+ kComparisonChancesNoradLeft - kComparisonChancesSpriteLeft,
+ kComparisonChancesNoradTop - kComparisonChancesSpriteTop);
+ _sprite2.addPICTResourceFrame(kComparisonChancesMarsPICTID, false,
+ kComparisonChancesMarsLeft - kComparisonChancesSpriteLeft,
+ kComparisonChancesMarsTop - kComparisonChancesSpriteTop);
+ _sprite2.addPICTResourceFrame(kComparisonChancesCaldoriaPICTID, false,
+ kComparisonChancesCaldoriaLeft - kComparisonChancesSpriteLeft,
+ kComparisonChancesCaldoriaTop - kComparisonChancesSpriteTop);
+ _sprite2.addPICTResourceFrame(kComparisonChancesWSCPICTID, false,
+ kComparisonChancesWSCLeft - kComparisonChancesSpriteLeft,
+ kComparisonChancesWSCTop - kComparisonChancesSpriteTop);
+
+ _sprite2.setCurrentFrameIndex(0);
+ _sprite2.moveElementTo(kComparisonChancesSpriteLeft, kComparisonChancesSpriteTop);
+ updateViewFrame();
+}
+
+void FullTSA::shutDownComparisonMonitor() {
+ releaseSprites();
+}
+
+void FullTSA::initializeComparisonMonitor(const int newMode, const ExtraID comparisonView) {
+ GameState.setT0BMonitorMode(newMode);
+ _privateFlags.setFlag(kTSAPrivatePlayingLeftComparisonFlag, false);
+ _privateFlags.setFlag(kTSAPrivatePlayingRightComparisonFlag, false);
+
+ if (newMode != kMonitorNeutral) {
+ shutDownComparisonMonitor();
+ setCurrentActivation(kActivateTSA0BComparisonVideo);
+ _sprite1.addPICTResourceFrame(kComparisonLeftRewindPICTID, false, 0, 0);
+ _sprite1.moveElementTo(kComparisonLeftRewindLeft, kComparisonLeftRewindTop);
+ _sprite1.setCurrentFrameIndex(0);
+ _sprite2.addPICTResourceFrame(kComparisonRightRewindPICTID, false, 0, 0);
+ _sprite2.moveElementTo(kComparisonRightRewindLeft, kComparisonRightRewindTop);
+ _sprite2.setCurrentFrameIndex(0);
+ _sprite3.addPICTResourceFrame(kComparisonCloseBoxPICTID, false, 0, 0);
+ _sprite3.moveElementTo(kComparisonCloseLeft, kComparisonCloseTop);
+ _sprite3.setCurrentFrameIndex(0);
+ showExtraView(comparisonView);
+ } else {
+ if (GameState.getTSAState() == kTSAPlayerInstalledHistoricalLog &&
+ GameState.getTSASeenNoradNormal() &&
+ GameState.getTSASeenNoradAltered() &&
+ GameState.getTSASeenMarsNormal() &&
+ GameState.getTSASeenMarsAltered() &&
+ GameState.getTSASeenCaldoriaNormal() &&
+ GameState.getTSASeenCaldoriaAltered() &&
+ GameState.getTSASeenWSCNormal() &&
+ GameState.getTSASeenWSCAltered()) {
+ GameState.setTSAState(kTSABossSawHistoricalLog);
+ requestExtraSequence(kTSA0BEastZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BEastTurnLeft, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthZoomIn, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ releaseSprites();
+ startUpComparisonMonitor();
+ }
+ }
+
+ _interruptionFilter = kFilterAllInput;
+}
+
+void FullTSA::playLeftComparison() {
+ InputDevice.waitInput(kFilterAllButtons);
+
+ if ((GameState.getT0BMonitorMode() & kPlayingLeftComparisonMask) == 0) {
+ ExtraID extra;
+
+ switch (GameState.getT0BMonitorMode() & kRawModeMask) {
+ case kMonitorNoradComparison:
+ GameState.setTSASeenNoradAltered(true);
+ extra = kTSA0BNoradAltered;
+ GameState.setScoringSawNoradAltered(true);
+ break;
+ case kMonitorMarsComparison:
+ GameState.setTSASeenMarsAltered(true);
+ extra = kTSA0BMarsAltered;
+ GameState.setScoringSawMarsAltered(true);
+ break;
+ case kMonitorCaldoriaComparison:
+ GameState.setTSASeenCaldoriaAltered(true);
+ extra = kTSA0BCaldoriaAltered;
+ GameState.setScoringSawCaldoriaAltered(true);
+ break;
+ case kMonitorWSCComparison:
+ GameState.setTSASeenWSCAltered(true);
+ extra = kTSA0BWSCAltered;
+ GameState.setScoringSawWSCAltered(true);
+ break;
+ default:
+ error("Invalid monitor mode");
+ }
+
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() | kPlayingLeftComparisonMask);
+
+ ExtraTable::Entry entry;
+ getExtraEntry(extra, entry);
+ _lastExtra = extra;
+
+ // skip first five frames of movie
+ // (this is a dissolve that doesn't belong...)
+ GameState.setT0BMonitorStart(entry.movieStart + kFullTSAFrameDuration * 5);
+ _privateFlags.setFlag(kTSAPrivatePlayingLeftComparisonFlag);
+
+ // Allow clicking...
+ startMovieSequence(GameState.getT0BMonitorStart(), entry.movieEnd,
+ kExtraCompletedFlag, false, JMPPPInput::getClickInputFilter());
+ } else if (_navMovie.isRunning()) {
+ _navMovie.stop();
+ } else {
+ _navMovie.start();
+ }
+}
+
+void FullTSA::playRightComparison() {
+ InputDevice.waitInput(kFilterAllButtons);
+
+ if ((GameState.getT0BMonitorMode() & kPlayingRightComparisonMask) == 0) {
+ ExtraID extra;
+
+ switch (GameState.getT0BMonitorMode() & kRawModeMask) {
+ case kMonitorNoradComparison:
+ GameState.setTSASeenNoradNormal(true);
+ extra = kTSA0BNoradUnaltered;
+ GameState.setScoringSawNoradNormal(true);
+ break;
+ case kMonitorMarsComparison:
+ GameState.setTSASeenMarsNormal(true);
+ extra = kTSA0BMarsUnaltered;
+ GameState.setScoringSawMarsNormal(true);
+ break;
+ case kMonitorCaldoriaComparison:
+ GameState.setTSASeenCaldoriaNormal(true);
+ extra = kTSA0BCaldoriaUnaltered;
+ GameState.setScoringSawCaldoriaNormal(true);
+ break;
+ case kMonitorWSCComparison:
+ GameState.setTSASeenWSCNormal(true);
+ extra = kTSA0BWSCUnaltered;
+ GameState.setScoringSawWSCNormal(true);
+ break;
+ default:
+ error("Invalid monitor mode");
+ }
+
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() | kPlayingRightComparisonMask);
+
+ ExtraTable::Entry entry;
+ getExtraEntry(extra, entry);
+ _lastExtra = extra;
+
+ // skip first five frames of movie
+ // (this is a dissolve that doesn't belong...)
+ GameState.setT0BMonitorStart(entry.movieStart + kFullTSAFrameDuration * 5);
+ _privateFlags.setFlag(kTSAPrivatePlayingRightComparisonFlag);
+
+ // Allow clicking...
+ startMovieSequence(GameState.getT0BMonitorStart(), entry.movieEnd,
+ kExtraCompletedFlag, false, JMPPPInput::getClickInputFilter());
+ } else if (_navMovie.isRunning()) {
+ _navMovie.stop();
+ } else {
+ _navMovie.start();
+ }
+}
+
+// When this function is called, the player is zoomed up on the center monitor, and the
+// TSA state is kTSABossSawHistoricalLog.
+void FullTSA::startRobotGame() {
+ requestExtraSequence(kTSA0BNorthCantChangeHistory, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BAIInterruption, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BShowGuardRobots, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BRobotsToCommandCenter, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void FullTSA::startUpRobotMonitor() {
+ releaseSprites();
+
+ _sprite1.addPICTResourceFrame(kRedirectionCCRolloverPICTID, true,
+ kRedirectionCCRolloverLeft - kRedirectionSprite1Left,
+ kRedirectionCCRolloverTop - kRedirectionSprite1Top);
+ _sprite1.addPICTResourceFrame(kRedirectionRRRolloverPICTID, true,
+ kRedirectionRRRolloverLeft - kRedirectionSprite1Left,
+ kRedirectionRRRolloverTop - kRedirectionSprite1Top);
+ _sprite1.addPICTResourceFrame(kRedirectionFDRolloverPICTID, false,
+ kRedirectionFDRolloverLeft - kRedirectionSprite1Left,
+ kRedirectionFDRolloverTop - kRedirectionSprite1Top);
+ _sprite1.addPICTResourceFrame(kRedirectionCCDoorPICTID, true,
+ kRedirectionCCDoorLeft - kRedirectionSprite1Left,
+ kRedirectionCCDoorTop - kRedirectionSprite1Top);
+ _sprite1.addPICTResourceFrame(kRedirectionRRDoorPICTID, true,
+ kRedirectionRRDoorLeft - kRedirectionSprite1Left,
+ kRedirectionRRDoorTop - kRedirectionSprite1Top);
+ _sprite1.addPICTResourceFrame(kRedirectionFDDoorPICTID, false,
+ kRedirectionFDDoorLeft - kRedirectionSprite1Left,
+ kRedirectionFDDoorTop - kRedirectionSprite1Top);
+ _sprite1.addPICTResourceFrame(kRedirectionClosePICTID, false,
+ kRedirectionCloseLeft - kRedirectionSprite1Left,
+ kRedirectionCloseTop - kRedirectionSprite1Top);
+ _sprite1.moveElementTo(kRedirectionSprite1Left, kRedirectionSprite1Top);
+
+ _sprite2.addPICTResourceFrame(kRedirectionSecuredPICTID, false,
+ kRedirectionSecuredLeft - kRedirectionSprite2Left,
+ kRedirectionSecuredTop - kRedirectionSprite2Top);
+ _sprite2.addPICTResourceFrame(kRedirectionNewTargetPICTID, false,
+ kRedirectionNewTargetLeft - kRedirectionSprite2Left,
+ kRedirectionNewTargetTop - kRedirectionSprite2Top);
+ _sprite2.moveElementTo(kRedirectionSprite2Left, kRedirectionSprite2Top);
+
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ showExtraView(kTSA0BNorthRobotsAtCCView);
+ break;
+ case kRobotsAtFrontDoor:
+ showExtraView(kTSA0BNorthRobotsAtFDView);
+ break;
+ case kRobotsAtReadyRoom:
+ showExtraView(kTSA0BNorthRobotsAtRRView);
+ break;
+ }
+}
+
+void FullTSA::shutDownRobotMonitor() {
+ releaseSprites();
+}
+
+// Assume this is called only when zoomed in at T0B west
+void FullTSA::setOffRipAlarm() {
+ GameState.setTSAState(kTSAPlayerDetectedRip);
+ _ripTimer.initImage();
+ _ripTimer.moveElementTo(kRipTimerLeft, kRipTimerTop);
+ _ripTimer.setSegment(0, kRipTimeLimit, kRipTimeScale);
+ _ripTimer.start();
+ loadAmbientLoops();
+ startExtraSequenceSync(kTSA0BRipAlarmScreen, kFilterNoInput);
+ _vm->delayShell(2, 1); // Two seconds..
+ requestExtraSequence(kTSA0BWestZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BWestTurnRight, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthZoomIn, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthFinallyHappened, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BShowRip1, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void FullTSA::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kTSA04, kNorth):
+ case MakeRoomView(kTSA14, kEast):
+ case MakeRoomView(kTSA15, kWest):
+ case MakeRoomView(kTSA16, kNorth):
+ case MakeRoomView(kTSA16, kSouth):
+ case MakeRoomView(kTSA21Cyan, kSouth):
+ case MakeRoomView(kTSA21Red, kSouth):
+ case MakeRoomView(kTSA26, kNorth):
+ makeContinuePoint();
+ break;
+ }
+}
+
+void FullTSA::arriveAt(const RoomID room, const DirectionConstant direction) {
+ checkRobotLocations(room, direction);
+ Neighborhood::arriveAt(room, direction);
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kTSADeathRoom, kNorth):
+ case MakeRoomView(kTSADeathRoom, kSouth):
+ case MakeRoomView(kTSADeathRoom, kEast):
+ case MakeRoomView(kTSADeathRoom, kWest):
+ die(kDeathShotByTSARobots);
+ break;
+ case MakeRoomView(kTSA00, kNorth):
+ if (GameState.getLastNeighborhood() != kFullTSAID) {
+ makeContinuePoint();
+ openDoor();
+ } else {
+ setCurrentActivation(kActivateTSAReadyForCard);
+ loopExtraSequence(kTSATransporterArrowLoop, 0);
+ }
+ break;
+ case MakeRoomView(kTSA03, kNorth):
+ case MakeRoomView(kTSA05, kNorth):
+ case MakeRoomView(kTSA0A, kNorth):
+ case MakeRoomView(kTSA06, kNorth):
+ case MakeRoomView(kTSA07, kNorth):
+ if (_utilityFuse.isFuseLit())
+ _utilityFuse.stopFuse();
+ GameState.setScoringEnterTSA(true);
+ break;
+ case MakeRoomView(kTSA04, kNorth):
+ if (_utilityFuse.isFuseLit())
+ _utilityFuse.stopFuse();
+ if (!GameState.getTSASeenRobotGreeting())
+ startExtraSequence(kTSA04NorthRobotGreeting, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kTSA03, kSouth):
+ GameState.setTSAFrontDoorUnlockedInside(GameState.getTSAState() == kRobotsAtFrontDoor || GameState.allTimeZonesFinished());
+ break;
+ case MakeRoomView(kTSA0A, kEast):
+ case MakeRoomView(kTSA0A, kWest):
+ if (GameState.getTSAState() == kTSAPlayerNotArrived)
+ setCurrentActivation(kActivateTSARobotsAwake);
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (GameState.getTSA0BZoomedIn()) {
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNeedsHistoricalLog:
+ _ripTimer.show();
+ break;
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ startUpRobotMonitor();
+ break;
+ }
+ } else {
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNotArrived:
+ requestExtraSequence(kTSA0BNorthZoomIn, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthYoureBusted, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthZoomOut, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthTurnLeft, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BWestZoomIn, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSAPlayerGotHistoricalLog:
+ startExtraSequence(kTSA0BNorthHistLogOpen, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ }
+ break;
+ case MakeRoomView(kTSA0B, kSouth):
+ GameState.setTSA0BZoomedIn(false);
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+ break;
+ case MakeRoomView(kTSA0B, kWest):
+ if (GameState.getTSA0BZoomedIn()) {
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ initializeTBPMonitor(kMonitorNeutral, 0);
+ } else {
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+ }
+ break;
+ case MakeRoomView(kTSA0B, kEast):
+ if (GameState.getTSA0BZoomedIn()) {
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerInstalledHistoricalLog:
+ case kTSABossSawHistoricalLog:
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ initializeComparisonMonitor(kMonitorNeutral, 0);
+ break;
+ }
+ } else {
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+ }
+ break;
+ case MakeRoomView(kTSA21Red, kSouth):
+ if (GameState.getTSAState() == kRobotsAtFrontDoor)
+ GameState.setScoringWentToReadyRoom2(true);
+ break;
+ case MakeRoomView(kTSA22Red, kEast):
+ if (!_vm->playerHasItemID(kJourneymanKey))
+ setCurrentActivation(kActivationDoesntHaveKey);
+ break;
+ case MakeRoomView(kTSA23Red, kWest):
+ if (!_vm->playerHasItemID(kPegasusBiochip))
+ setCurrentActivation(kActivationDoesntHaveChips);
+ break;
+ case MakeRoomView(kTSA25Red, kNorth):
+ arriveAtTSA25Red();
+ break;
+ case MakeRoomView(kTSA34, kSouth):
+ if (GameState.getLastRoom() == kTSA37)
+ closeDoorOffScreen(kTSA37, kNorth);
+ break;
+ case MakeRoomView(kTSA37, kNorth):
+ arriveAtTSA37();
+ break;
+ }
+}
+
+void FullTSA::checkRobotLocations(const RoomID room, const DirectionConstant dir) {
+ switch (room) {
+ case kTSA03:
+ case kTSA04:
+ case kTSA05:
+ case kTSA06:
+ case kTSA0A:
+ case kTSA07:
+ case kTSA08:
+ case kTSA09:
+ case kTSA10:
+ case kTSA11:
+ case kTSA12:
+ case kTSA13:
+ case kTSA14:
+ case kTSA15:
+ switch (GameState.getTSAState()) {
+ case kRobotsAtFrontDoor:
+ setCurrentAlternate(kAltTSARobotsAtFrontDoor);
+ break;
+ case kRobotsAtReadyRoom:
+ setCurrentAlternate(kAltTSARobotsAtReadyRoom);
+ break;
+ }
+ break;
+ case kTSA16:
+ if (dir == kNorth) {
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ if (!_privateFlags.getFlag(kTSAPrivateSeenRobotWarningFlag)) {
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/TSA/XT11WB", false, kWarningInterruption);
+ _privateFlags.setFlag(kTSAPrivateSeenRobotWarningFlag, true);
+ }
+ break;
+ case kRobotsAtFrontDoor:
+ setCurrentAlternate(kAltTSARobotsAtFrontDoor);
+ break;
+ case kRobotsAtReadyRoom:
+ setCurrentAlternate(kAltTSARobotsAtReadyRoom);
+ break;
+ }
+ }
+ break;
+ }
+}
+
+void FullTSA::arriveAtTSA25Red() {
+ if (!_vm->playerHasItemID(kJourneymanKey))
+ startExtraSequence(kTSA25NorthDeniedNoKey, kExtraCompletedFlag, kFilterNoInput);
+ else if (!_vm->playerHasItemID(kPegasusBiochip))
+ startExtraSequence(kTSA25NorthDeniedNoChip, kExtraCompletedFlag, kFilterNoInput);
+ else if (GameState.getTSABiosuitOn())
+ startExtraSequence(kTSA25NorthAlreadyHaveSuit, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kTSA25NorthPutOnSuit, kExtraCompletedFlag, kFilterNoInput);
+}
+
+void FullTSA::arriveAtTSA37() {
+ _ripTimer.stop();
+ _ripTimer.releaseImage();
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNeedsHistoricalLog:
+ startExtraLongSequence(kTSA37HorseToAI1, kTSA37AI2ToPrehistoric, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kPlayerOnWayToPrehistoric:
+ setCurrentActivation(kActivationJumpToPrehistoric);
+ showExtraView(kTSA37AI2ToPrehistoric);
+ break;
+ case kTSAPlayerGotHistoricalLog:
+ initializePegasusButtons(false);
+ break;
+ case kPlayerWentToPrehistoric:
+ case kPlayerOnWayToNorad:
+ case kPlayerOnWayToMars:
+ case kPlayerOnWayToWSC:
+ startExtraSequence(kTSA37TimeJumpToPegasus, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kRobotsAtFrontDoor:
+ startExtraLongSequence(kTSA37HorseToColonel2, kTSA37AI4ToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kPlayerLockedInPegasus:
+ showMainJumpMenu();
+ break;
+ case kPlayerFinishedWithTSA:
+ initializePegasusButtons(true);
+ break;
+ }
+}
+
+void FullTSA::turnTo(const DirectionConstant newDirection) {
+ Neighborhood::turnTo(newDirection);
+
+ switch (MakeRoomView(GameState.getCurrentRoom(), newDirection)) {
+ case MakeRoomView(kTSA03, kSouth):
+ if (GameState.getTSAState() == kRobotsAtFrontDoor || GameState.allTimeZonesFinished())
+ GameState.setTSAFrontDoorUnlockedInside(true);
+ else
+ GameState.setTSAFrontDoorUnlockedInside(false);
+ break;
+ case MakeRoomView(kTSA0A, kEast):
+ case MakeRoomView(kTSA0A, kWest):
+ setCurrentActivation(kActivateTSARobotsAwake);
+ break;
+ case MakeRoomView(kTSA0B, kEast):
+ if (GameState.getTSA0BZoomedIn())
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ else
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() & ~kPlayingAnyMask);
+
+ if (_privateFlags.getFlag(kTSAPrivateLogReaderOpenFlag))
+ _privateFlags.setFlag(kTSAPrivateLogReaderOpenFlag, false);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerInstalledHistoricalLog:
+ case kTSABossSawHistoricalLog:
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ if (GameState.getTSA0BZoomedIn())
+ startUpComparisonMonitor();
+ break;
+ }
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (GameState.getTSA0BZoomedIn())
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ else
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() & ~kPlayingAnyMask);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNeedsHistoricalLog:
+ if (GameState.getTSA0BZoomedIn())
+ _ripTimer.show();
+ break;
+ case kTSAPlayerGotHistoricalLog:
+ if (!GameState.getTSA0BZoomedIn())
+ startExtraSequence(kTSA0BNorthHistLogOpen, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSAPlayerInstalledHistoricalLog:
+ if (GameState.getTSA0BZoomedIn()) {
+ if ((GameState.getTSASeenNoradNormal() || GameState.getTSASeenNoradAltered()) &&
+ (GameState.getTSASeenMarsNormal() || GameState.getTSASeenMarsAltered()) &&
+ (GameState.getTSASeenCaldoriaNormal() || GameState.getTSASeenCaldoriaAltered()) &&
+ (GameState.getTSASeenWSCNormal() || GameState.getTSASeenWSCAltered())) {
+ GameState.setTSAState(kTSABossSawHistoricalLog);
+ startRobotGame();
+ }
+ }
+ break;
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ if (GameState.getTSA0BZoomedIn())
+ startExtraSequence(kTSA0BShowGuardRobots, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ break;
+ case MakeRoomView(kTSA0B, kWest):
+ if (GameState.getTSA0BZoomedIn())
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ else
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() & ~kPlayingAnyMask);
+
+ if (_privateFlags.getFlag(kTSAPrivateLogReaderOpenFlag))
+ _privateFlags.setFlag(kTSAPrivateLogReaderOpenFlag, false);
+
+ if (GameState.getTSA0BZoomedIn())
+ initializeTBPMonitor(kMonitorNeutral, 0);
+ break;
+ case MakeRoomView(kTSA0B, kSouth):
+ GameState.setTSA0BZoomedIn(false);
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+ break;
+ case MakeRoomView(kTSA16, kNorth):
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ if (!_privateFlags.getFlag(kTSAPrivateSeenRobotWarningFlag)) {
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/TSA/XT11WB", false, kWarningInterruption);
+ _privateFlags.setFlag(kTSAPrivateSeenRobotWarningFlag, true);
+ }
+ break;
+ case kRobotsAtFrontDoor:
+ setCurrentAlternate(kAltTSARobotsAtFrontDoor);
+ break;
+ case kRobotsAtReadyRoom:
+ setCurrentAlternate(kAltTSARobotsAtReadyRoom);
+ break;
+ }
+ break;
+ case MakeRoomView(kTSA22Red, kEast):
+ if (!_vm->playerHasItemID(kJourneymanKey))
+ setCurrentActivation(kActivationDoesntHaveKey);
+ break;
+ case MakeRoomView(kTSA22Red, kNorth):
+ case MakeRoomView(kTSA22Red, kSouth):
+ if (_privateFlags.getFlag(kTSAPrivateKeyVaultOpenFlag)) {
+ playSpotSoundSync(kTSAVaultCloseIn, kTSAVaultCloseOut);
+ _privateFlags.setFlag(kTSAPrivateKeyVaultOpenFlag, false);
+ }
+
+ setCurrentActivation(kActivateHotSpotAlways);
+ break;
+ case MakeRoomView(kTSA23Red, kWest):
+ if (!_vm->playerHasItemID(kPegasusBiochip))
+ setCurrentActivation(kActivationDoesntHaveChips);
+ break;
+ case MakeRoomView(kTSA23Red, kNorth):
+ case MakeRoomView(kTSA23Red, kSouth):
+ if (_privateFlags.getFlag(kTSAPrivateChipVaultOpenFlag)) {
+ playSpotSoundSync(kTSAVaultCloseIn, kTSAVaultCloseOut);
+ _privateFlags.setFlag(kTSAPrivateChipVaultOpenFlag, false);
+ }
+
+ setCurrentActivation(kActivateHotSpotAlways);
+ break;
+ }
+
+ // Make sure the TBP monitor is forced neutral.
+ GameState.setT0BMonitorMode(kMonitorNeutral);
+}
+
+void FullTSA::closeDoorOffScreen(const RoomID room, const DirectionConstant) {
+ switch (room) {
+ case kTSA00:
+ case kTSA01:
+ if (GameState.getCurrentRoom() == kTSA01 || GameState.getCurrentRoom() == kTSA02)
+ playSpotSoundSync(kTSAGTDoorCloseIn, kTSAGTDoorCloseOut);
+ break;
+ case kTSA02:
+ case kTSA03:
+ playSpotSoundSync(kTSAEntryDoorCloseIn, kTSAEntryDoorCloseOut);
+ break;
+ case kTSA14:
+ case kTSA15:
+ case kTSA16:
+ case kTSA21Cyan:
+ case kTSA21Red:
+ playSpotSoundSync(kTSAInsideDoorCloseIn, kTSAInsideDoorCloseOut);
+ break;
+ case kTSA34:
+ case kTSA37:
+ playSpotSoundSync(kTSAPegasusDoorCloseIn, kTSAPegasusDoorCloseOut);
+ break;
+ }
+}
+
+void FullTSA::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ ExtraID lastExtra = _lastExtra;
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ switch (lastExtra) {
+ case kTSA0BEastTurnLeft:
+ // Need to check this here because turnTo will call _navMovie.stop,
+ // so it has to happen before Neighborhood::receiveNotification,
+ // which may end up starting another sequence...
+ turnTo(kNorth);
+ break;
+ }
+ }
+
+ Neighborhood::receiveNotification(notification, flags);
+
+ InventoryItem *item;
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ // Only allow input if we're not in the middle of series of queue requests.
+ if (actionQueueEmpty())
+ _interruptionFilter = kFilterAllInput;
+
+ switch (lastExtra) {
+ case kTSAGTCardSwipe:
+ item = (InventoryItem *)_vm->getAllItems().findItemByID(kKeyCard);
+ _vm->addItemToInventory(item);
+ setCurrentActivation(kActivateTSAReadyToTransport);
+ break;
+ case kTSAGTGoToCaldoria:
+ _vm->jumpToNewEnvironment(kCaldoriaID, kCaldoria44, kEast);
+
+ if (GameState.allTimeZonesFinished())
+ GameState.setScoringWentAfterSinclair(true);
+ break;
+ case kTSAGTGoToTokyo:
+ case kTSAGTGoToBeach:
+ if (GameState.allTimeZonesFinished())
+ die(kDeathSinclairShotDelegate);
+ else
+ die(kDeathUncreatedInTSA);
+ break;
+ case kTSA02NorthZoomOut:
+ openDoor();
+ break;
+
+ // Hall of suspects.
+ case kTSA04NorthRobotGreeting:
+ GameState.setTSASeenRobotGreeting(true);
+ restoreStriding(kTSA03, kNorth, kNoAlternateID);
+ break;
+ case kTSA03JimenezZoomIn:
+ GameState.setScoringSawBust1(true);
+ break;
+ case kTSA03CrenshawZoomIn:
+ GameState.setScoringSawBust2(true);
+ break;
+ case kTSA04MatsumotoZoomIn:
+ GameState.setScoringSawBust3(true);
+ break;
+ case kTSA04CastilleZoomIn:
+ GameState.setScoringSawBust4(true);
+ break;
+ case kTSA05SinclairZoomIn:
+ GameState.setScoringSawBust5(true);
+ break;
+ case kTSA05WhiteZoomIn:
+ GameState.setScoringSawBust6(true);
+ break;
+
+ // Command center
+ // Historical comparison...
+ case kTSA0BEastZoomIn:
+ GameState.setTSA0BZoomedIn(true);
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() & ~kPlayingAnyMask);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerInstalledHistoricalLog:
+ case kTSABossSawHistoricalLog:
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ startUpComparisonMonitor();
+ break;
+ }
+ break;
+ case kTSA0BEastZoomOut:
+ GameState.setTSA0BZoomedIn(false);
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+
+ switch (GameState.getTSAState()) {
+ case kTSABossSawHistoricalLog:
+ // Prevent current view from activating.
+ break;
+ default:
+ activateCurrentView(GameState.getCurrentRoom(), GameState.getCurrentDirection(),
+ kSpotOnTurnMask);
+ break;
+ }
+ break;
+ case kTSA0BComparisonStartup:
+ if ((flags & kActionRequestCompletedFlag) != 0) {
+ _privateFlags.setFlag(kTSAPrivateLogReaderOpenFlag, false);
+ GameState.setTSAState(kTSAPlayerInstalledHistoricalLog);
+ turnTo(kEast);
+ }
+
+ startUpComparisonMonitor();
+ break;
+ case kTSA0BNoradAltered:
+ case kTSA0BMarsAltered:
+ case kTSA0BCaldoriaAltered:
+ case kTSA0BWSCAltered:
+ case kTSA0BNoradUnaltered:
+ case kTSA0BMarsUnaltered:
+ case kTSA0BCaldoriaUnaltered:
+ case kTSA0BWSCUnaltered:
+ initializeComparisonMonitor(kMonitorNeutral, 0);
+ break;
+
+ // Center monitor.
+ case kTSA0BNorthZoomIn:
+ GameState.setTSA0BZoomedIn(true);
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+ GameState.setT0BMonitorMode(GameState.getT0BMonitorMode() & ~kPlayingAnyMask);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerNeedsHistoricalLog:
+ startExtraSequence(kTSA0BShowRip1, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSABossSawHistoricalLog:
+ case kTSAPlayerInstalledHistoricalLog:
+ if ((GameState.getTSASeenNoradNormal() || GameState.getTSASeenNoradAltered()) &&
+ (GameState.getTSASeenMarsNormal() || GameState.getTSASeenMarsAltered()) &&
+ (GameState.getTSASeenCaldoriaNormal() || GameState.getTSASeenCaldoriaAltered()) &&
+ (GameState.getTSASeenWSCNormal() || GameState.getTSASeenWSCAltered())) {
+ GameState.setTSAState(kTSABossSawHistoricalLog);
+ startRobotGame();
+ }
+ break;
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ startExtraSequence(kTSA0BShowGuardRobots, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ break;
+ case kTSA0BNorthZoomOut:
+ GameState.setTSA0BZoomedIn(false);
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+ break;
+ case kTSA0BShowRip1:
+ GameState.setTSAState(kTSAPlayerNeedsHistoricalLog);
+ GameState.setTSACommandCenterLocked(false);
+
+ if ((flags & kActionRequestCompletedFlag) != 0)
+ turnTo(kNorth);
+
+ _ripTimer.show();
+ break;
+ case kTSA0BNorthHistLogOpen:
+ setCurrentActivation(kActivationLogReaderOpen);
+ _privateFlags.setFlag(kTSAPrivateLogReaderOpenFlag, true);
+ break;
+ case kTSA0BRobotsToCommandCenter:
+ GameState.setTSAState(kRobotsAtCommandCenter);
+ // Fall through
+ case kTSA0BShowGuardRobots:
+ startUpRobotMonitor();
+ // Fall through
+ case kTSA0BRobotsFromCommandCenterToReadyRoom:
+ case kTSA0BRobotsFromReadyRoomToCommandCenter:
+ case kTSA0BRobotsFromCommandCenterToFrontDoor:
+ case kTSA0BRobotsFromFrontDoorToCommandCenter:
+ case kTSA0BRobotsFromFrontDoorToReadyRoom:
+ case kTSA0BRobotsFromReadyRoomToFrontDoor:
+ _sprite2.setCurrentFrameIndex(kRedirectionSecuredSprite);
+ _sprite2.show();
+ break;
+
+ // TBP monitor.
+ case kTSA0BWestZoomIn:
+ GameState.setTSA0BZoomedIn(true);
+ setCurrentActivation(kActivateTSA0BZoomedIn);
+
+ if (GameState.getTSAState() == kTSAPlayerNotArrived) {
+ turnTo(kWest);
+ GameState.setTSACommandCenterLocked(true);
+ GameState.setTSAState(kTSAPlayerForcedReview);
+ }
+
+ initializeTBPMonitor(kMonitorNeutral, 0);
+ break;
+ case kTSA0BWestZoomOut:
+ GameState.setTSA0BZoomedIn(false);
+ setCurrentActivation(kActivateTSA0BZoomedOut);
+ GameState.setT0BMonitorMode(kMonitorNeutral);
+
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerDetectedRip:
+ // Keep the current view from activating.
+ break;
+ default:
+ activateCurrentView(GameState.getCurrentRoom(), GameState.getCurrentDirection(),
+ kSpotOnTurnMask);
+ break;
+ }
+ break;
+ case kTSA0BTBPTheory:
+ case kTSA0BTBPBackground:
+ case kTSA0BTBPProcedure:
+ initializeTBPMonitor(kMonitorNeutral, 0);
+ break;
+
+ // Ready room
+ case kTSA22RedEastZoomInSequence:
+ _privateFlags.setFlag(kTSAPrivateKeyVaultOpenFlag, true);
+ setCurrentActivation(kActivationKeyVaultOpen);
+ break;
+ case kTSA23RedWestVaultZoomInSequence:
+ _privateFlags.setFlag(kTSAPrivateChipVaultOpenFlag, true);
+ setCurrentActivation(kActivationChipVaultOpen);
+ break;
+ case kTSA25NorthPutOnSuit:
+ GameState.setTSABiosuitOn(true);
+ GameState.setScoringGotBiosuit(true);
+ // Fall through...
+ case kTSA25NorthAlreadyHaveSuit:
+ requestExtraSequence(kTSA25NorthDescending1, 0, kFilterNoInput);
+ requestExtraSequence(kTSA25NorthDescending2, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTSA25NorthDescending2:
+ arriveAt(kTSA26, kNorth);
+ break;
+
+ // Pegasus.
+ case kTSA37HorseToAI1:
+ case kTSA37AI2ToPrehistoric:
+ setCurrentActivation(kActivationJumpToPrehistoric);
+ GameState.setTSAState(kPlayerOnWayToPrehistoric);
+ break;
+ case kTSA37PegasusDepart:
+ _vm->setLastEnergyValue(kFullEnergy);
+
+ switch (GameState.getTSAState()) {
+ case kPlayerOnWayToPrehistoric:
+ _vm->jumpToNewEnvironment(kPrehistoricID, kPrehistoric02, kSouth);
+ GameState.setPrehistoricSeenTimeStream(false);
+ GameState.setPrehistoricSeenFlyer1(false);
+ GameState.setPrehistoricSeenFlyer2(false);
+ GameState.setPrehistoricSeenBridgeZoom(false);
+ GameState.setPrehistoricBreakerThrown(false);
+ GameState.setScoringGoToPrehistoric(true);
+ GameState.setTSAState(kPlayerWentToPrehistoric);
+ break;
+ case kPlayerOnWayToNorad:
+ _vm->jumpToNewEnvironment(kNoradAlphaID, kNorad01, kSouth);
+ GameState.setNoradSeenTimeStream(false);
+ GameState.setNoradGassed(true);
+ GameState.setNoradFillingStationOn(false);
+ GameState.setNoradN22MessagePlayed(false);
+ GameState.setNoradPlayedGlobeGame(false);
+ GameState.setNoradBeatRobotWithClaw(false);
+ GameState.setNoradBeatRobotWithDoor(false);
+ GameState.setNoradRetScanGood(false);
+ GameState.setNoradWaitingForLaser(false);
+ GameState.setNoradSubRoomPressure(9);
+ GameState.setNoradSubPrepState(kSubNotPrepped);
+ break;
+ case kPlayerOnWayToMars:
+ _vm->jumpToNewEnvironment(kMarsID, kMars0A, kNorth);
+ GameState.setMarsSeenTimeStream(false);
+ GameState.setMarsHeardUpperPodMessage(false);
+ GameState.setMarsRobotThrownPlayer(false);
+ GameState.setMarsHeardCheckInMessage(false);
+ GameState.setMarsPodAtUpperPlatform(false);
+ GameState.setMarsSeenThermalScan(false);
+ GameState.setMarsArrivedBelow(false);
+ GameState.setMarsSeenRobotAtReactor(false);
+ GameState.setMarsAvoidedReactorRobot(false);
+ GameState.setMarsLockFrozen(false);
+ GameState.setMarsLockBroken(false);
+ GameState.setMarsSecurityDown(false);
+ GameState.setMarsAirlockOpen(false);
+ GameState.setMarsReadyForShuttleTransport(false);
+ GameState.setMarsFinishedCanyonChase(false);
+ GameState.setMarsThreadedMaze(false);
+ break;
+ case kPlayerOnWayToWSC:
+ _vm->jumpToNewEnvironment(kWSCID, kWSC01, kWest);
+ GameState.setWSCSeenTimeStream(false);
+ GameState.setWSCPoisoned(false);
+ GameState.setWSCAnsweredAboutDart(false);
+ GameState.setWSCRemovedDart(false);
+ GameState.setWSCAnalyzerOn(false);
+ GameState.setWSCDartInAnalyzer(false);
+ GameState.setWSCAnalyzedDart(false);
+ GameState.setWSCPickedUpAntidote(false);
+ GameState.setWSCSawMorph(false);
+ GameState.setWSCDesignedAntidote(false);
+ GameState.setWSCOfficeMessagesOpen(false);
+ GameState.setWSCSeenNerd(false);
+ GameState.setWSCHeardPage1(false);
+ GameState.setWSCHeardPage2(false);
+ GameState.setWSCHeardCheckIn(false);
+ GameState.setWSCDidPlasmaDodge(false);
+ GameState.setWSCSeenSinclairLecture(false);
+ GameState.setWSCBeenAtWSC93(false);
+ GameState.setWSCCatwalkDark(false);
+ GameState.setWSCRobotDead(false);
+ GameState.setWSCRobotGone(false);
+ break;
+ };
+ break;
+ case kTSA37TimeJumpToPegasus:
+ if (g_energyMonitor)
+ g_energyMonitor->stopEnergyDraining();
+
+ switch (GameState.getTSAState()) {
+ case kPlayerWentToPrehistoric:
+ arriveFromPrehistoric();
+ break;
+ case kPlayerOnWayToNorad:
+ arriveFromNorad();
+ break;
+ case kPlayerOnWayToMars:
+ arriveFromMars();
+ break;
+ case kPlayerOnWayToWSC:
+ arriveFromWSC();
+ break;
+ default:
+ break;
+ }
+ break;
+ case kTSA37DownloadToOpMemReview:
+ switch (GameState.getTSAState()) {
+ case kPlayerOnWayToNorad:
+ g_opticalChip->playOpMemMovie(kPoseidonSpotID);
+ break;
+ case kPlayerOnWayToMars:
+ g_opticalChip->playOpMemMovie(kAriesSpotID);
+ break;
+ case kPlayerOnWayToWSC:
+ g_opticalChip->playOpMemMovie(kMercurySpotID);
+ break;
+ }
+
+ if (GameState.allTimeZonesFinished()) {
+ requestExtraSequence(kTSA37OpMemReviewToAllClear, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37AllClearToCongratulations, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37Congratulations, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37CongratulationsToExit, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTSA37OpMemReviewToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kTSA37RecallToDownload:
+ case kTSA37ReviewRequiredToExit:
+ GameState.setTSAState(kTSAPlayerGotHistoricalLog);
+ initializePegasusButtons(kPegasusUnresolved);
+ break;
+ case kTSA37ZoomToMainMenu:
+ case kTSA37HorseToColonel2:
+ case kTSA37DownloadToMainMenu:
+ case kTSA37OpMemReviewToMainMenu:
+ case kTSA37AI4ToMainMenu:
+ GameState.setTSAState(kPlayerLockedInPegasus);
+ showMainJumpMenu();
+ makeContinuePoint();
+ break;
+ case kTSA37JumpToNoradMenu:
+ setCurrentActivation(kActivationJumpToNorad);
+ break;
+ case kTSA37JumpToMarsMenu:
+ setCurrentActivation(kActivationJumpToMars);
+ break;
+ case kTSA37JumpToWSCMenu:
+ setCurrentActivation(kActivationJumpToWSC);
+ break;
+ case kTSA37CancelNorad:
+ case kTSA37CancelMars:
+ case kTSA37CancelWSC:
+ showMainJumpMenu();
+ break;
+ case kTSA37CongratulationsToExit:
+ GameState.setTSAState(kPlayerFinishedWithTSA);
+ initializePegasusButtons(true);
+ break;
+ }
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+void FullTSA::arriveFromPrehistoric() {
+ if (_vm->playerHasItemID(kHistoricalLog)) {
+ GameState.setScoringFinishedPrehistoric();
+ requestExtraSequence(kTSA37RecallToDownload, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37DownloadToColonel1, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37Colonel1, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37Colonel1ToReviewRequired, 0, kFilterNoInput);
+ requestExtraSequence(kTSA37ReviewRequiredToExit, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ // Make sure rip timer is going...
+ startExtraSequence(kTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void FullTSA::arriveFromNorad() {
+ requestExtraSequence(kTSA37RecallToDownload, 0, kFilterNoInput);
+
+ if (GameState.getNoradFinished() && !GameState.getScoringFinishedNorad()) {
+ GameState.setScoringFinishedNorad();
+ requestExtraSequence(kTSA37DownloadToOpMemReview, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void FullTSA::arriveFromMars() {
+ requestExtraSequence(kTSA37RecallToDownload, 0, kFilterNoInput);
+
+ if (GameState.getMarsFinished() && !GameState.getScoringFinishedMars()) {
+ GameState.setScoringFinishedMars();
+ requestExtraSequence(kTSA37DownloadToOpMemReview, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void FullTSA::arriveFromWSC() {
+ requestExtraSequence(kTSA37RecallToDownload, 0, kFilterNoInput);
+
+ if (GameState.getWSCFinished() && !GameState.getScoringFinishedWSC()) {
+ GameState.setScoringFinishedWSC();
+ requestExtraSequence(kTSA37DownloadToOpMemReview, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void FullTSA::initializePegasusButtons(bool resolved) {
+ if (resolved) {
+ _sprite1.addPICTResourceFrame(kResolvedPICTID, false, 0, 0);
+ _sprite1.moveElementTo(kResolvedLeft, kResolvedTop);
+ } else {
+ _sprite1.addPICTResourceFrame(kUnresolvedPICTID, false, 0, 0);
+ _sprite1.moveElementTo(kUnresolvedLeft, kUnresolvedTop);
+ }
+
+ _sprite1.setCurrentFrameIndex(0);
+ _sprite1.show();
+
+ _sprite2.addPICTResourceFrame(kExitPICTID, false, kExitLeft - kExitHilitedLeft, kExitTop - kExitHilitedTop);
+ _sprite2.addPICTResourceFrame(kExitHilitedPICTID, false, 0, 0);
+ _sprite2.moveElementTo(kExitHilitedLeft, kExitHilitedTop);
+ setCurrentActivation(kActivationReadyToExit);
+ _sprite2.setCurrentFrameIndex(0);
+ _sprite2.show();
+}
+
+Hotspot *FullTSA::getItemScreenSpot(Item *item, DisplayElement *element) {
+ switch (item->getObjectID()) {
+ case kJourneymanKey:
+ return _vm->getAllHotspots().findHotspotByID(kTSA22EastKeySpotID);
+ break;
+ case kPegasusBiochip:
+ return _vm->getAllHotspots().findHotspotByID(kTSA23WestChipsSpotID);
+ break;
+ }
+
+ return Neighborhood::getItemScreenSpot(item, element);
+}
+
+void FullTSA::dropItemIntoRoom(Item *item, Hotspot *dropSpot) {
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+
+ switch (item->getObjectID()) {
+ case kKeyCard:
+ if (dropSpot->getObjectID() == kTSAGTCardDropSpotID)
+ startExtraSequence(kTSAGTCardSwipe, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kHistoricalLog:
+ if (dropSpot->getObjectID() == kTSA0BNorthHistLogSpotID) {
+ requestExtraSequence(kTSA0BNorthHistLogCloseWithLog, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BNorthTurnRight, 0, kFilterNoInput);
+ requestExtraSequence(kTSA0BEastZoomIn, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kTSA0BComparisonStartup, kExtraCompletedFlag, kFilterNoInput);
+ GameState.setScoringPutLogInReader(true);
+ }
+ break;
+ }
+}
+
+uint FullTSA::getHistoricalLogIndex() {
+ uint index;
+
+ if (GameState.getTSASeenNoradNormal() && GameState.getTSASeenNoradAltered())
+ index = 8;
+ else
+ index = 0;
+
+ if (GameState.getTSASeenMarsNormal() && GameState.getTSASeenMarsAltered())
+ index += 4;
+
+ if (GameState.getTSASeenCaldoriaNormal() && GameState.getTSASeenCaldoriaAltered())
+ index += 2;
+
+ if (GameState.getTSASeenWSCNormal() && GameState.getTSASeenWSCAltered())
+ index += 1;
+
+ return index;
+}
+
+void FullTSA::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ switch (MakeRoomView(GameState.getCurrentRoom(), GameState.getCurrentDirection())) {
+ case MakeRoomView(kTSA0B, kEast):
+ if (GameState.getTSA0BZoomedIn() && !_navMovie.isRunning() && GameState.getT0BMonitorMode() == kMonitorNeutral) {
+ switch (GameState.getTSAState()) {
+ case kTSAPlayerInstalledHistoricalLog:
+ case kTSABossSawHistoricalLog:
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ if (cursorSpot) {
+ switch (cursorSpot->getObjectID()) {
+ case kTSA0BEastCompareNoradSpotID:
+ _sprite1.setCurrentFrameIndex(0);
+ _sprite2.setCurrentFrameIndex(0);
+ _sprite1.show();
+ _sprite2.show();
+ break;
+ case kTSA0BEastCompareMarsSpotID:
+ _sprite1.setCurrentFrameIndex(1);
+ _sprite2.setCurrentFrameIndex(1);
+ _sprite1.show();
+ _sprite2.show();
+ break;
+ case kTSA0BEastCompareCaldoriaSpotID:
+ _sprite1.setCurrentFrameIndex(2);
+ _sprite2.setCurrentFrameIndex(2);
+ _sprite1.show();
+ _sprite2.show();
+ break;
+ case kTSA0BEastCompareWSCSpotID:
+ _sprite1.setCurrentFrameIndex(3);
+ _sprite2.setCurrentFrameIndex(3);
+ _sprite1.show();
+ _sprite2.show();
+ break;
+ default:
+ _sprite1.hide();
+ _sprite2.hide();
+ break;
+ }
+ } else {
+ _sprite1.hide();
+ _sprite2.hide();
+ }
+ break;
+ }
+ }
+ break;
+ case MakeRoomView(kTSA0B, kNorth):
+ if (GameState.getTSA0BZoomedIn() && !_navMovie.isRunning()) {
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ case kRobotsAtFrontDoor:
+ case kRobotsAtReadyRoom:
+ if (cursorSpot) {
+ switch (cursorSpot->getObjectID()) {
+ case kTSA0BNorthRobotsToCommandCenterSpotID:
+ _sprite1.setCurrentFrameIndex(kRedirectionCCRolloverSprite);
+ _sprite1.show();
+ break;
+ case kTSA0BNorthRobotsToReadyRoomSpotID:
+ _sprite1.setCurrentFrameIndex(kRedirectionRRRolloverSprite);
+ _sprite1.show();
+ break;
+ case kTSA0BNorthRobotsToFrontDoorSpotID:
+ _sprite1.setCurrentFrameIndex(kRedirectionFDRolloverSprite);
+ _sprite1.show();
+ break;
+ default:
+ _sprite1.hide();
+ break;
+ }
+ } else {
+ _sprite1.hide();
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ Neighborhood::handleInput(input, cursorSpot);
+}
+
+void FullTSA::releaseSprites() {
+ _sprite1.hide();
+ _sprite2.hide();
+ _sprite3.hide();
+ _sprite1.discardFrames();
+ _sprite2.discardFrames();
+ _sprite3.discardFrames();
+}
+
+bool FullTSA::canSolve() {
+ return GameState.getCurrentRoomAndView() == MakeRoomView(kTSA0B, kNorth) &&
+ GameState.getTSA0BZoomedIn() &&
+ (GameState.getTSAState() == kRobotsAtCommandCenter ||
+ GameState.getTSAState() == kRobotsAtFrontDoor ||
+ GameState.getTSAState() == kRobotsAtReadyRoom);
+}
+
+void FullTSA::doSolve() {
+ // REROUTING ROBOTS
+
+ _sprite1.setCurrentFrameIndex(kRedirectionFDDoorSprite);
+ _sprite1.show();
+ _vm->delayShell(1, 2);
+ _sprite1.hide();
+
+ switch (GameState.getTSAState()) {
+ case kRobotsAtCommandCenter:
+ GameState.setTSAState(kRobotsAtFrontDoor);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromCommandCenterToFrontDoor, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kRobotsAtFrontDoor:
+ // Nothing
+ break;
+ case kRobotsAtReadyRoom:
+ GameState.setTSAState(kRobotsAtFrontDoor);
+ _sprite2.setCurrentFrameIndex(kRedirectionNewTargetSprite);
+ startExtraSequence(kTSA0BRobotsFromReadyRoomToFrontDoor, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+}
+
+void FullTSA::updateCursor(const Common::Point where, const Hotspot *cursorSpot) {
+ if (cursorSpot) {
+ switch (cursorSpot->getObjectID()) {
+ case kTSA0BEastMonitorSpotID:
+ case kTSA0BNorthMonitorSpotID:
+ case kTSA0BWestMonitorSpotID:
+ case kTSA22EastMonitorSpotID:
+ case kTSA23WestMonitorSpotID:
+ _vm->_cursor->setCurrentFrameIndex(1);
+ return;
+ case kTSA0BEastMonitorOutSpotID:
+ case kTSA0BNorthMonitorOutSpotID:
+ case kTSA0BWestMonitorOutSpotID:
+ _vm->_cursor->setCurrentFrameIndex(2);
+ return;
+ }
+ }
+
+ Neighborhood::updateCursor(where, cursorSpot);
+}
+
+Common::String FullTSA::getNavMovieName() {
+ return "Images/TSA/Full TSA.movie";
+}
+
+Common::String FullTSA::getSoundSpotsName() {
+ return "Sounds/TSA/TSA Spots";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/tsa/fulltsa.h b/engines/pegasus/neighborhood/tsa/fulltsa.h
new file mode 100644
index 0000000000..a646d57e6c
--- /dev/null
+++ b/engines/pegasus/neighborhood/tsa/fulltsa.h
@@ -0,0 +1,159 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_TSA_FULLTSA_H
+#define PEGASUS_NEIGHBORHOOD_TSA_FULLTSA_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+class RipTimer : public IdlerAnimation {
+public:
+ RipTimer(const DisplayElementID id) : IdlerAnimation(id) {}
+ virtual ~RipTimer() {}
+
+ void initImage();
+ void releaseImage();
+
+ void draw(const Common::Rect &);
+
+protected:
+ void timeChanged(const TimeValue);
+
+ CoordType _middle;
+ Surface _timerImage;
+};
+
+// Room IDs.
+
+static const RoomID kTSA00 = 0;
+static const RoomID kTSA22Red = 28;
+static const RoomID kTSA37 = 42;
+
+class FullTSA : public Neighborhood {
+public:
+ FullTSA(InputHandler *, PegasusEngine *);
+ virtual ~FullTSA() {}
+
+ virtual void init();
+
+ void start();
+
+ virtual uint16 getDateResID() const;
+
+ void flushGameState();
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ bool canSolve();
+ void doSolve();
+
+ void updateCursor(const Common::Point, const Hotspot *);
+
+protected:
+ enum {
+ kTSAPrivateLogReaderOpenFlag,
+ kTSAPrivateKeyVaultOpenFlag,
+ kTSAPrivateChipVaultOpenFlag,
+ kTSAPrivatePlayingLeftComparisonFlag,
+ kTSAPrivatePlayingRightComparisonFlag,
+ kTSAPrivateSeenRobotWarningFlag,
+ kNumTSAPrivateFlags
+ };
+
+ Common::String getBriefingMovie();
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+ void loadAmbientLoops();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+ void activateOneHotspot(HotspotInfoTable::Entry &, Hotspot *spot);
+ virtual void activateHotspots();
+ void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &);
+ void dropItemIntoRoom(Item *, Hotspot *);
+ void downButton(const Input &);
+ void startDoorOpenMovie(const TimeValue, const TimeValue);
+ TimeValue getViewTime(const RoomID, const DirectionConstant);
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+ void turnTo(const DirectionConstant);
+ CanMoveForwardReason canMoveForward(ExitTable::Entry &);
+ CanOpenDoorReason canOpenDoor(DoorTable::Entry &);
+ void bumpIntoWall();
+ void initializeTBPMonitor(const int, const ExtraID);
+ void playTBPMonitor();
+ void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &);
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+ void openDoor();
+ void turnRight();
+ void turnLeft();
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+ void playExtraMovie(const ExtraTable::Entry &, const NotificationFlags, const InputBits interruptionInput);
+ void handleInput(const Input &, const Hotspot *);
+ void arriveAtTSA25Red();
+ void startUpComparisonMonitor();
+ void shutDownComparisonMonitor();
+ void initializeComparisonMonitor(const int, const ExtraID);
+ void playLeftComparison();
+ void playRightComparison();
+ void startRobotGame();
+ void setOffRipAlarm();
+ uint getHistoricalLogIndex();
+ void startUpRobotMonitor();
+ void shutDownRobotMonitor();
+ void pickedUpItem(Item *item);
+ void arriveFromPrehistoric();
+
+ void arriveFromNorad();
+ void arriveFromMars();
+ void arriveFromWSC();
+
+ InputBits getInputFilter();
+ void arriveAt(const RoomID, const DirectionConstant);
+ void initializePegasusButtons(bool);
+ void releaseSprites();
+ void showMainJumpMenu();
+ void arriveAtTSA37();
+ void receiveNotification(Notification *, const NotificationFlags);
+ void checkRobotLocations(const RoomID, const DirectionConstant);
+ void getExtraEntry(const uint32, ExtraTable::Entry &);
+
+ Sprite _sprite1, _sprite2, _sprite3;
+ FuseFunction _utilityFuse;
+ RipTimer _ripTimer;
+
+ FlagsArray<byte, kNumTSAPrivateFlags> _privateFlags;
+
+ Common::String getNavMovieName();
+ Common::String getSoundSpotsName();
+
+ void dieUncreatedInTSA();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/tsa/tinytsa.cpp b/engines/pegasus/neighborhood/tsa/tinytsa.cpp
new file mode 100644
index 0000000000..4f109620c1
--- /dev/null
+++ b/engines/pegasus/neighborhood/tsa/tinytsa.cpp
@@ -0,0 +1,453 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/aichip.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/neighborhood/mars/constants.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/tsa/tinytsa.h"
+#include "pegasus/neighborhood/wsc/wsc.h"
+
+namespace Pegasus {
+
+static const int16 kCompassShift = 30;
+
+static const TimeScale kTinyTSAMovieScale = 600;
+static const TimeScale kTinyTSAFramesPerSecond = 15;
+static const TimeScale kTinyTSAFrameDuration = 40;
+
+// Alternate IDs.
+static const AlternateID kAltTinyTSANormal = 0;
+
+// Hot Spot Activation IDs.
+static const HotSpotActivationID kActivationTinyTSAJumpToNorad = 1;
+static const HotSpotActivationID kActivationTinyTSAJumpToMars = 2;
+static const HotSpotActivationID kActivationTinyTSAJumpToWSC = 3;
+static const HotSpotActivationID kActivationTinyTSAReadyForJumpMenu = 4;
+static const HotSpotActivationID kActivationTinyTSAMainJumpMenu = 5;
+
+// Hot Spot IDs.
+static const HotSpotID kTinyTSA37NorthJumpToNoradSpotID = 5000;
+static const HotSpotID kTinyTSA37NorthCancelNoradSpotID = 5001;
+static const HotSpotID kTinyTSA37NorthJumpToMarsSpotID = 5002;
+static const HotSpotID kTinyTSA37NorthCancelMarsSpotID = 5003;
+static const HotSpotID kTinyTSA37NorthJumpToWSCSpotID = 5004;
+static const HotSpotID kTinyTSA37NorthCancelWSCSpotID = 5005;
+static const HotSpotID kTinyTSA37NorthJumpMenuSpotID = 5006;
+static const HotSpotID kTinyTSA37NorthNoradMenuSpotID = 5007;
+static const HotSpotID kTinyTSA37NorthMarsMenuSpotID = 5008;
+static const HotSpotID kTinyTSA37NorthWSCMenuSpotID = 5009;
+
+// Extra sequence IDs.
+static const ExtraID kTinyTSA37PegasusDepart = 0;
+static const ExtraID kTinyTSA37TimeJumpToPegasus = 1;
+static const ExtraID kTinyTSA37RecallToDownload = 2;
+static const ExtraID kTinyTSA37ExitHilited = 3;
+static const ExtraID kTinyTSA37ExitToHorse = 4;
+static const ExtraID kTinyTSA37JumpMenu000 = 5;
+static const ExtraID kTinyTSA37JumpMenu001 = 6;
+static const ExtraID kTinyTSA37JumpMenu010 = 7;
+static const ExtraID kTinyTSA37JumpMenu011 = 8;
+static const ExtraID kTinyTSA37JumpMenu100 = 9;
+static const ExtraID kTinyTSA37JumpMenu101 = 10;
+static const ExtraID kTinyTSA37JumpMenu110 = 11;
+static const ExtraID kTinyTSA37JumpMenu111 = 12;
+static const ExtraID kTinyTSA37JumpToWSCMenu = 13;
+static const ExtraID kTinyTSA37CancelWSC = 14;
+static const ExtraID kTinyTSA37JumpToWSC = 15;
+static const ExtraID kTinyTSA37WSCToAI5 = 16;
+static const ExtraID kTinyTSA37PegasusAI5 = 17;
+static const ExtraID kTinyTSA37AI5ToWSC = 18;
+static const ExtraID kTinyTSA37WSCToDepart = 19;
+static const ExtraID kTinyTSA37JumpToMarsMenu = 20;
+static const ExtraID kTinyTSA37CancelMars = 21;
+static const ExtraID kTinyTSA37JumpToMars = 22;
+static const ExtraID kTinyTSA37MarsToAI6 = 23;
+static const ExtraID kTinyTSA37PegasusAI6 = 24;
+static const ExtraID kTinyTSA37AI6ToMars = 25;
+static const ExtraID kTinyTSA37MarsToDepart = 26;
+static const ExtraID kTinyTSA37JumpToNoradMenu = 27;
+static const ExtraID kTinyTSA37CancelNorad = 28;
+static const ExtraID kTinyTSA37JumpToNorad = 29;
+static const ExtraID kTinyTSA37NoradToAI7 = 30;
+static const ExtraID kTinyTSA37PegasusAI7 = 31;
+static const ExtraID kTinyTSA37AI7ToNorad = 32;
+static const ExtraID kTinyTSA37NoradToDepart = 33;
+static const ExtraID kTinyTSA37EnvironmentalScan = 34;
+static const ExtraID kTinyTSA37DownloadToMainMenu = 35;
+static const ExtraID kTinyTSA37DownloadToOpMemReview = 36;
+static const ExtraID kTinyTSA37OpMemReviewToMainMenu = 37;
+
+TinyTSA::TinyTSA(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Tiny TSA", kTinyTSAID) {
+}
+
+void TinyTSA::start() {
+ g_energyMonitor->stopEnergyDraining();
+ Neighborhood::start();
+}
+
+Common::String TinyTSA::getBriefingMovie() {
+ Common::String movieName = Neighborhood::getBriefingMovie();
+
+ if (movieName.empty()) {
+ switch (getCurrentActivation()) {
+ case kActivationTinyTSAJumpToNorad:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTinyTSA37PegasusAI7, kHintInterruption);
+ startExtraSequenceSync(kTinyTSA37AI7ToNorad, kFilterNoInput);
+ g_AIChip->clearClicked();
+ movieName = "";
+ break;
+ case kActivationTinyTSAJumpToMars:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTinyTSA37PegasusAI6, kHintInterruption);
+ startExtraSequenceSync(kTinyTSA37AI6ToMars, kFilterNoInput);
+ g_AIChip->clearClicked();
+ movieName = "";
+ break;
+ case kActivationTinyTSAJumpToWSC:
+ g_AIChip->showBriefingClicked();
+ startExtraSequenceSync(kTinyTSA37PegasusAI5, kHintInterruption);
+ startExtraSequenceSync(kTinyTSA37AI5ToWSC, kFilterNoInput);
+ g_AIChip->clearClicked();
+ movieName = "";
+ break;
+ default:
+ movieName = "Images/AI/TSA/XT04";
+ break;
+ }
+ }
+
+ return movieName;
+}
+
+Common::String TinyTSA::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ g_AIChip->showEnvScanClicked();
+ startExtraSequenceSync(kTinyTSA37EnvironmentalScan, kHintInterruption);
+
+ switch (getCurrentActivation()) {
+ case kActivationTinyTSAJumpToNorad:
+ startExtraSequenceSync(kTinyTSA37AI7ToNorad, kFilterNoInput);
+ showExtraView(kTinyTSA37JumpToNoradMenu);
+ break;
+ case kActivationTinyTSAJumpToMars:
+ startExtraSequenceSync(kTinyTSA37AI6ToMars, kFilterNoInput);
+ showExtraView(kTinyTSA37JumpToMarsMenu);
+ break;
+ case kActivationTinyTSAJumpToWSC:
+ startExtraSequenceSync(kTinyTSA37AI5ToWSC, kFilterNoInput);
+ showExtraView(kTinyTSA37JumpToWSCMenu);
+ break;
+ default:
+ showMainJumpMenu();
+ break;
+ }
+
+ g_AIChip->clearClicked();
+ }
+
+ return movieName;
+}
+
+void TinyTSA::loadAmbientLoops() {
+ loadLoopSound1("Sounds/TSA/T01NAE.NEW.22K.AIFF");
+}
+
+int16 TinyTSA::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ return Neighborhood::getStaticCompassAngle(room, dir) - kCompassShift;
+}
+
+uint16 TinyTSA::getDateResID() const {
+ return kDate2318ID;
+}
+
+InputBits TinyTSA::getInputFilter() {
+ // Can't move forward...
+ return Neighborhood::getInputFilter() & ~(kFilterUpButton | kFilterUpAuto);
+}
+
+void TinyTSA::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ if (clickedSpot) {
+ switch (clickedSpot->getObjectID()) {
+ case kTinyTSA37NorthJumpMenuSpotID:
+ // This hotspot isn't accessable from Tiny TSA
+ warning("jump menu spot");
+ return;
+ case kTinyTSA37NorthJumpToNoradSpotID:
+ GameState.setTSAState(kPlayerOnWayToNorad);
+ requestExtraSequence(kTinyTSA37JumpToNorad, 0, kFilterNoInput);
+ if (!GameState.getBeenToNorad()) {
+ requestExtraSequence(kTinyTSA37NoradToAI7, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37PegasusAI7, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37AI7ToNorad, 0, kFilterNoInput);
+ GameState.setBeenToNorad(true);
+ }
+
+ requestExtraSequence(kTinyTSA37NoradToDepart, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ return;
+ case kTinyTSA37NorthJumpToMarsSpotID:
+ GameState.setTSAState(kPlayerOnWayToMars);
+ requestExtraSequence(kTinyTSA37JumpToMars, 0, kFilterNoInput);
+ if (!GameState.getBeenToMars()) {
+ requestExtraSequence(kTinyTSA37MarsToAI6, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37PegasusAI6, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37AI6ToMars, 0, kFilterNoInput);
+ GameState.setBeenToMars(true);
+ }
+
+ requestExtraSequence(kTinyTSA37MarsToDepart, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ return;
+ case kTinyTSA37NorthJumpToWSCSpotID:
+ GameState.setTSAState(kPlayerOnWayToWSC);
+ requestExtraSequence(kTinyTSA37JumpToWSC, 0, kFilterNoInput);
+ if (!GameState.getBeenToWSC()) {
+ requestExtraSequence(kTinyTSA37WSCToAI5, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37PegasusAI5, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37AI5ToWSC, 0, kFilterNoInput);
+ GameState.setBeenToWSC(true);
+ }
+
+ requestExtraSequence(kTinyTSA37WSCToDepart, 0, kFilterNoInput);
+ requestExtraSequence(kTinyTSA37PegasusDepart, kExtraCompletedFlag, kFilterNoInput);
+ return;
+ }
+ }
+
+ Neighborhood::clickInHotspot(input, clickedSpot);
+}
+
+void TinyTSA::showMainJumpMenu() {
+ ExtraID jumpMenuView = kTinyTSA37JumpMenu000;
+
+ if (GameState.getNoradFinished())
+ jumpMenuView += 4;
+ if (GameState.getMarsFinished())
+ jumpMenuView += 2;
+ if (GameState.getWSCFinished())
+ jumpMenuView += 1;
+
+ showExtraView(jumpMenuView);
+ setCurrentActivation(kActivationTinyTSAMainJumpMenu);
+}
+
+void TinyTSA::checkContinuePoint(const RoomID, const DirectionConstant) {
+ makeContinuePoint();
+}
+
+void TinyTSA::arriveAt(const RoomID room, const DirectionConstant direction) {
+ Neighborhood::arriveAt(room, direction);
+
+ switch (GameState.getTSAState()) {
+ case kPlayerOnWayToNorad:
+ case kPlayerOnWayToMars:
+ case kPlayerOnWayToWSC:
+ startExtraSequence(kTinyTSA37TimeJumpToPegasus, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kPlayerLockedInPegasus:
+ showMainJumpMenu();
+ break;
+ }
+}
+
+void TinyTSA::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ ExtraID lastExtra = _lastExtra;
+
+ Neighborhood::receiveNotification(notification, flags);
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ // Only allow input if we're not in the middle of series of queue requests.
+ if (actionQueueEmpty())
+ _interruptionFilter = kFilterAllInput;
+
+ switch (lastExtra) {
+ case kTinyTSA37PegasusDepart:
+ _vm->setLastEnergyValue(kFullEnergy);
+
+ switch (GameState.getTSAState()) {
+ case kPlayerOnWayToNorad:
+ _vm->jumpToNewEnvironment(kNoradAlphaID, kNorad01, kSouth);
+ GameState.setNoradSeenTimeStream(false);
+ GameState.setNoradGassed(true);
+ GameState.setNoradFillingStationOn(false);
+ GameState.setNoradN22MessagePlayed(false);
+ GameState.setNoradPlayedGlobeGame(false);
+ GameState.setNoradBeatRobotWithClaw(false);
+ GameState.setNoradBeatRobotWithDoor(false);
+ GameState.setNoradRetScanGood(false);
+ GameState.setNoradWaitingForLaser(false);
+ GameState.setNoradSubRoomPressure(9);
+ GameState.setNoradSubPrepState(kSubNotPrepped);
+ break;
+ case kPlayerOnWayToMars:
+ _vm->jumpToNewEnvironment(kMarsID, kMars0A, kNorth);
+ GameState.setMarsSeenTimeStream(false);
+ GameState.setMarsHeardUpperPodMessage(false);
+ GameState.setMarsRobotThrownPlayer(false);
+ GameState.setMarsHeardCheckInMessage(false);
+ GameState.setMarsPodAtUpperPlatform(false);
+ GameState.setMarsSeenThermalScan(false);
+ GameState.setMarsArrivedBelow(false);
+ GameState.setMarsSeenRobotAtReactor(false);
+ GameState.setMarsAvoidedReactorRobot(false);
+ GameState.setMarsLockFrozen(false);
+ GameState.setMarsLockBroken(false);
+ GameState.setMarsSecurityDown(false);
+ GameState.setMarsAirlockOpen(false);
+ GameState.setMarsReadyForShuttleTransport(false);
+ GameState.setMarsFinishedCanyonChase(false);
+ GameState.setMarsThreadedMaze(false);
+ break;
+ case kPlayerOnWayToWSC:
+ _vm->jumpToNewEnvironment(kWSCID, kWSC01, kWest);
+ GameState.setWSCSeenTimeStream(false);
+ GameState.setWSCPoisoned(false);
+ GameState.setWSCAnsweredAboutDart(false);
+ GameState.setWSCDartInAnalyzer(false);
+ GameState.setWSCRemovedDart(false);
+ GameState.setWSCAnalyzerOn(false);
+ GameState.setWSCAnalyzedDart(false);
+ GameState.setWSCPickedUpAntidote(false);
+ GameState.setWSCSawMorph(false);
+ GameState.setWSCDesignedAntidote(false);
+ GameState.setWSCOfficeMessagesOpen(false);
+ GameState.setWSCSeenNerd(false);
+ GameState.setWSCHeardPage1(false);
+ GameState.setWSCHeardPage2(false);
+ GameState.setWSCHeardCheckIn(false);
+ GameState.setWSCDidPlasmaDodge(false);
+ GameState.setWSCSeenSinclairLecture(false);
+ GameState.setWSCBeenAtWSC93(false);
+ GameState.setWSCCatwalkDark(false);
+ GameState.setWSCRobotDead(false);
+ GameState.setWSCRobotGone(false);
+ break;
+ };
+ break;
+ case kTinyTSA37TimeJumpToPegasus:
+ if (g_energyMonitor)
+ g_energyMonitor->stopEnergyDraining();
+
+ switch (GameState.getTSAState()) {
+ case kPlayerOnWayToNorad:
+ arriveFromNorad();
+ break;
+ case kPlayerOnWayToMars:
+ arriveFromMars();
+ break;
+ case kPlayerOnWayToWSC:
+ arriveFromWSC();
+ break;
+ default:
+ break;
+ }
+ break;
+ case kTinyTSA37DownloadToOpMemReview:
+ switch (GameState.getTSAState()) {
+ case kPlayerOnWayToNorad:
+ g_opticalChip->playOpMemMovie(kPoseidonSpotID);
+ break;
+ case kPlayerOnWayToMars:
+ g_opticalChip->playOpMemMovie(kAriesSpotID);
+ break;
+ case kPlayerOnWayToWSC:
+ g_opticalChip->playOpMemMovie(kMercurySpotID);
+ break;
+ }
+
+ requestExtraSequence(kTinyTSA37OpMemReviewToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTinyTSA37DownloadToMainMenu:
+ case kTinyTSA37OpMemReviewToMainMenu:
+ GameState.setTSAState(kPlayerLockedInPegasus);
+ showMainJumpMenu();
+ makeContinuePoint();
+ break;
+ case kTinyTSA37JumpToNoradMenu:
+ setCurrentActivation(kActivationTinyTSAJumpToNorad);
+ break;
+ case kTinyTSA37JumpToMarsMenu:
+ setCurrentActivation(kActivationTinyTSAJumpToMars);
+ break;
+ case kTinyTSA37JumpToWSCMenu:
+ setCurrentActivation(kActivationTinyTSAJumpToWSC);
+ break;
+ case kTinyTSA37CancelNorad:
+ case kTinyTSA37CancelMars:
+ case kTinyTSA37CancelWSC:
+ showMainJumpMenu();
+ break;
+ }
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+void TinyTSA::arriveFromNorad() {
+ requestExtraSequence(kTinyTSA37RecallToDownload, 0, kFilterNoInput);
+
+ if (GameState.getNoradFinished() && !GameState.getScoringFinishedNorad()) {
+ GameState.setScoringFinishedNorad();
+ requestExtraSequence(kTinyTSA37DownloadToOpMemReview, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTinyTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void TinyTSA::arriveFromMars() {
+ requestExtraSequence(kTinyTSA37RecallToDownload, 0, kFilterNoInput);
+
+ if (GameState.getMarsFinished() && !GameState.getScoringFinishedMars()) {
+ GameState.setScoringFinishedMars();
+ requestExtraSequence(kTinyTSA37DownloadToOpMemReview, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTinyTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void TinyTSA::arriveFromWSC() {
+ requestExtraSequence(kTinyTSA37RecallToDownload, 0, kFilterNoInput);
+
+ if (GameState.getWSCFinished() && !GameState.getScoringFinishedWSC()) {
+ GameState.setScoringFinishedWSC();
+ requestExtraSequence(kTinyTSA37DownloadToOpMemReview, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ requestExtraSequence(kTinyTSA37DownloadToMainMenu, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+Common::String TinyTSA::getNavMovieName() {
+ return "Images/TSA/Tiny TSA.movie";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/tsa/tinytsa.h b/engines/pegasus/neighborhood/tsa/tinytsa.h
new file mode 100644
index 0000000000..2dc234675d
--- /dev/null
+++ b/engines/pegasus/neighborhood/tsa/tinytsa.h
@@ -0,0 +1,71 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_TSA_TINYTSA_H
+#define PEGASUS_NEIGHBORHOOD_TSA_TINYTSA_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Pegasus {
+
+// Room IDs.
+
+static const RoomID kTinyTSA37 = 0;
+
+class TinyTSA : public Neighborhood {
+public:
+ TinyTSA(InputHandler *, PegasusEngine *);
+ virtual ~TinyTSA() {}
+
+ virtual uint16 getDateResID() const;
+
+ void start();
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+protected:
+ Common::String getBriefingMovie();
+ Common::String getEnvScanMovie();
+ void loadAmbientLoops();
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+
+ virtual int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+
+ void arriveFromNorad();
+ void arriveFromMars();
+ void arriveFromWSC();
+
+ InputBits getInputFilter();
+ void arriveAt(const RoomID, const DirectionConstant);
+ void showMainJumpMenu();
+ void receiveNotification(Notification *, const NotificationFlags);
+
+ Common::String getNavMovieName();
+ Common::String getSoundSpotsName() { return ""; }
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/turn.cpp b/engines/pegasus/neighborhood/turn.cpp
new file mode 100644
index 0000000000..1157796f55
--- /dev/null
+++ b/engines/pegasus/neighborhood/turn.cpp
@@ -0,0 +1,63 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/turn.h"
+
+namespace Pegasus {
+
+void TurnTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].room = stream->readUint16BE();
+ _entries[i].direction = stream->readByte();
+ _entries[i].turnDirection = stream->readByte();
+ _entries[i].altCode = stream->readByte();
+ stream->readByte(); // alignment
+ _entries[i].endDirection = stream->readByte();
+ stream->readByte(); // alignment
+ debug(0, "Turn[%d]: %d %d %d %d %d", i, _entries[i].room, _entries[i].direction,
+ _entries[i].turnDirection, _entries[i].altCode, _entries[i].endDirection);
+ }
+}
+
+void TurnTable::clear() {
+ _entries.clear();
+}
+
+TurnTable::Entry TurnTable::findEntry(RoomID room, DirectionConstant direction, TurnDirection turnDirection, AlternateID altCode) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].room == room && _entries[i].direction == direction && _entries[i].turnDirection == turnDirection && _entries[i].altCode == altCode)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/turn.h b/engines/pegasus/neighborhood/turn.h
new file mode 100644
index 0000000000..329b03eddb
--- /dev/null
+++ b/engines/pegasus/neighborhood/turn.h
@@ -0,0 +1,69 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_TURN_H
+#define PEGASUS_NEIGHBORHOOD_TURN_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+class TurnTable {
+public:
+ TurnTable() {}
+ ~TurnTable() {}
+
+ static uint32 getResTag() { return MKTAG('T', 'u', 'r', 'n'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { endDirection = kNoDirection; }
+ bool isEmpty() { return endDirection == kNoDirection; }
+
+ RoomID room;
+ DirectionConstant direction;
+ TurnDirection turnDirection;
+ AlternateID altCode;
+ DirectionConstant endDirection;
+ };
+
+ Entry findEntry(RoomID room, DirectionConstant direction, TurnDirection turnDirection, AlternateID altCode);
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/view.cpp b/engines/pegasus/neighborhood/view.cpp
new file mode 100644
index 0000000000..4e46f5374e
--- /dev/null
+++ b/engines/pegasus/neighborhood/view.cpp
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/view.h"
+
+namespace Pegasus {
+
+void ViewTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].room = stream->readUint16BE();
+ _entries[i].direction = stream->readByte();
+ _entries[i].altCode = stream->readByte();
+ _entries[i].time = stream->readUint32BE();
+ debug(0, "View[%d]: %d %d %d %d", i, _entries[i].room, _entries[i].direction,
+ _entries[i].altCode, _entries[i].time);
+ }
+}
+
+void ViewTable::clear() {
+ _entries.clear();
+}
+
+ViewTable::Entry ViewTable::findEntry(RoomID room, DirectionConstant direction, AlternateID altCode) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].room == room && _entries[i].direction == direction && _entries[i].altCode == altCode)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace pegasus
diff --git a/engines/pegasus/neighborhood/view.h b/engines/pegasus/neighborhood/view.h
new file mode 100644
index 0000000000..3397508b61
--- /dev/null
+++ b/engines/pegasus/neighborhood/view.h
@@ -0,0 +1,68 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_VIEW_H
+#define PEGASUS_NEIGHBORHOOD_VIEW_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+class ViewTable {
+public:
+ ViewTable() {}
+ ~ViewTable() {}
+
+ static uint32 getResTag() { return MKTAG('V', 'i', 'e', 'w'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry() { time = 0xffffffff; }
+ bool isEmpty() { return time == 0xffffffff; }
+
+ RoomID room;
+ DirectionConstant direction;
+ AlternateID altCode;
+ TimeValue time;
+ };
+
+ Entry findEntry(RoomID room, DirectionConstant direction, AlternateID altCode);
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/wsc/moleculebin.cpp b/engines/pegasus/neighborhood/wsc/moleculebin.cpp
new file mode 100644
index 0000000000..210c0ad313
--- /dev/null
+++ b/engines/pegasus/neighborhood/wsc/moleculebin.cpp
@@ -0,0 +1,127 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/graphics.h"
+#include "pegasus/neighborhood/wsc/moleculebin.h"
+#include "pegasus/neighborhood/wsc/wsc.h"
+
+namespace Pegasus {
+
+static const CoordType kMoleculeBinWidth = 138;
+static const CoordType kMoleculeBinHeight = 128;
+
+static const CoordType kMoleculeWidth = 66;
+static const CoordType kMoleculeHeight = 40;
+
+static const CoordType kMoleculeBinLeft = kNavAreaLeft + 286;
+static const CoordType kMoleculeBinTop = kNavAreaLeft + 96;
+
+// Layouts:
+
+MoleculeBin::MoleculeBin() : DisplayElement(kNoDisplayElement) {
+ _highlightColor = g_system->getScreenFormat().RGBToColor(0xff, 0xff, 102);
+ _selectedMolecule = -1;
+}
+
+void MoleculeBin::initMoleculeBin() {
+ if (!isDisplaying()) {
+ for (int i = 0; i < 6; i++)
+ _binLayout[i] = i;
+
+ resetBin();
+ _binImages.getImageFromPICTFile("Images/World Science Center/Molecules");
+ setDisplayOrder(kWSCMoleculeBinOrder);
+ setBounds(kMoleculeBinLeft, kMoleculeBinTop, kMoleculeBinLeft + kMoleculeBinWidth,
+ kMoleculeBinTop + kMoleculeBinHeight);
+ startDisplaying();
+ show();
+ }
+}
+
+void MoleculeBin::cleanUpMoleculeBin() {
+ if (isDisplaying()) {
+ stopDisplaying();
+ _binImages.deallocateSurface();
+ }
+}
+
+void MoleculeBin::setBinLayout(const uint32 *layout) {
+ for (int i = 0; i < 6; i++)
+ _binLayout[i] = layout[i];
+}
+
+void MoleculeBin::highlightMolecule(const uint32 whichMolecule) {
+ if (!_moleculeFlags.getFlag(whichMolecule)) {
+ _moleculeFlags.setFlag(whichMolecule, true);
+ triggerRedraw();
+ }
+}
+
+bool MoleculeBin::isMoleculeHighlighted(uint32 whichMolecule) {
+ return _moleculeFlags.getFlag(whichMolecule);
+}
+
+void MoleculeBin::selectMolecule(const int whichMolecule) {
+ if (_selectedMolecule != whichMolecule) {
+ _selectedMolecule = whichMolecule;
+ triggerRedraw();
+ }
+}
+
+void MoleculeBin::resetBin() {
+ _moleculeFlags.clearAllFlags();
+ _selectedMolecule = -1;
+ triggerRedraw();
+}
+
+void MoleculeBin::draw(const Common::Rect &) {
+ Common::Rect r1(0, 0, kMoleculeWidth, kMoleculeHeight);
+ Common::Rect r2 = r1;
+
+ for (int i = 0; i < 6; i++) {
+ r1.moveTo(i * (kMoleculeWidth * 2), 0);
+
+ if (_moleculeFlags.getFlag(_binLayout[i]))
+ r1.translate(kMoleculeWidth, 0);
+
+ r2.moveTo((_binLayout[i] & 1) * (kMoleculeWidth + 2) + _bounds.left + 2,
+ (_binLayout[i] >> 1) * (kMoleculeHeight + 2) + _bounds.top + 2);
+
+ _binImages.copyToCurrentPort(r1, r2);
+ }
+
+ if (_selectedMolecule >= 0) {
+ r2.moveTo((_selectedMolecule & 1) * (kMoleculeWidth + 2) + _bounds.left + 2,
+ (_selectedMolecule >> 1) * (kMoleculeHeight + 2) + _bounds.top + 2);
+
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+
+ screen->frameRect(r2, _highlightColor);
+ r2.grow(1);
+ screen->frameRect(r2, _highlightColor);
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/wsc/moleculebin.h b/engines/pegasus/neighborhood/wsc/moleculebin.h
new file mode 100644
index 0000000000..3de4b5ed2a
--- /dev/null
+++ b/engines/pegasus/neighborhood/wsc/moleculebin.h
@@ -0,0 +1,72 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_WSC_MOLECULEBIN_H
+#define PEGASUS_NEIGHBORHOOD_WSC_MOLECULEBIN_H
+
+#include "pegasus/elements.h"
+#include "pegasus/surface.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+enum {
+ kMolecule1,
+ kMolecule2,
+ kMolecule3,
+ kMolecule4,
+ kMolecule5,
+ kMolecule6
+};
+
+class MoleculeBin : public DisplayElement {
+public:
+ MoleculeBin();
+ virtual ~MoleculeBin() {}
+
+ void initMoleculeBin();
+ void cleanUpMoleculeBin();
+
+ void setBinLayout(const uint32 *);
+
+ void highlightMolecule(const uint32 whichMolecule);
+ void selectMolecule(const int whichMolecule);
+ void resetBin();
+
+ bool isMoleculeHighlighted(uint32);
+
+protected:
+ void draw(const Common::Rect &);
+
+ Surface _binImages;
+ FlagsArray<byte, kMolecule6 + 1> _moleculeFlags;
+ int _selectedMolecule;
+ uint32 _binLayout[6];
+ uint32 _highlightColor;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/wsc/wsc.cpp b/engines/pegasus/neighborhood/wsc/wsc.cpp
new file mode 100644
index 0000000000..f3bf113333
--- /dev/null
+++ b/engines/pegasus/neighborhood/wsc/wsc.cpp
@@ -0,0 +1,2542 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/items/biochips/shieldchip.h"
+#include "pegasus/neighborhood/wsc/wsc.h"
+
+namespace Pegasus {
+
+static const CanMoveForwardReason kCantMoveWatchingDiagnosis = kCantMoveLastReason + 1;
+
+static const CanTurnReason kCantTurnWatchingDiagnosis = kCantTurnLastReason + 1;
+static const CanTurnReason kCantTurnWatchingAnalysis = kCantTurnWatchingDiagnosis + 1;
+static const CanTurnReason kCantTurnInMoleculeGame = kCantTurnWatchingAnalysis + 1;
+
+static const TimeScale kMoleculesMovieScale = 600;
+static const TimeValue kMoleculeLoopTime = 4 * kMoleculesMovieScale;
+static const TimeValue kMoleculeFailTime = 2 * kMoleculesMovieScale;
+
+enum {
+ kMoleculeLoop0Time = 0,
+ kMoleculeFail0Time = kMoleculeLoop0Time + kMoleculeLoopTime,
+ kMoleculeLoop1Time = kMoleculeFail0Time + kMoleculeFailTime,
+ kMoleculeFail1Time = kMoleculeLoop1Time + kMoleculeLoopTime,
+ kMoleculeLoop2Time = kMoleculeFail1Time + kMoleculeFailTime,
+ kMoleculeFail2Time = kMoleculeLoop2Time + kMoleculeLoopTime,
+ kMoleculeLoop3Time = kMoleculeFail2Time + kMoleculeFailTime,
+ kMoleculeFail3Time = kMoleculeLoop3Time + kMoleculeLoopTime,
+ kMoleculeLoop4Time = kMoleculeFail3Time + kMoleculeFailTime,
+ kMoleculeFail4Time = kMoleculeLoop4Time + kMoleculeLoopTime,
+ kMoleculeLoop5Time = kMoleculeFail4Time + kMoleculeFailTime,
+ kMoleculeFail5Time = kMoleculeLoop5Time + kMoleculeLoopTime,
+ kMoleculeLoop6Time = kMoleculeFail5Time + kMoleculeFailTime
+};
+
+static const TimeValue s_moleculeLoopTimes[] = {
+ kMoleculeLoop0Time,
+ kMoleculeLoop1Time,
+ kMoleculeLoop2Time,
+ kMoleculeLoop3Time,
+ kMoleculeLoop4Time,
+ kMoleculeLoop5Time,
+ kMoleculeLoop6Time
+};
+
+static const TimeValue s_moleculeFailTimes[] = {
+ kMoleculeFail0Time,
+ kMoleculeFail1Time,
+ kMoleculeFail2Time,
+ kMoleculeFail3Time,
+ kMoleculeFail4Time,
+ kMoleculeFail5Time
+};
+
+static const int16 kAuditoriumAngleOffset = 5;
+
+static const int kPlasmaEnergyWithShield = kMaxJMPEnergy * 10 / 100;
+static const int kPlasmaEnergyNoShield = kMaxJMPEnergy * 20 / 100;
+
+static const int kTimerEventPlasmaHit = 0;
+static const int kTimerEventPlayerGawkingAtRobot = 1;
+static const int kTimerEventPlayerGawkingAtRobot2 = 2;
+
+static const TimeValue kWSCMolecule1In = 0;
+static const TimeValue kWSCMolecule1Out = 937;
+
+static const TimeValue kWSCMolecule2In = 937;
+static const TimeValue kWSCMolecule2Out = 1864;
+
+static const TimeValue kWSCMolecule3In = 1864;
+static const TimeValue kWSCMolecule3Out = 2790;
+
+static const TimeValue kWSCClick1In = 2790;
+static const TimeValue kWSCClick1Out = 2890;
+
+static const TimeValue kWSCClick2In = 2890;
+static const TimeValue kWSCClick2Out = 3059;
+
+static const TimeValue kWSCClick3In = 3059;
+static const TimeValue kWSCClick3Out = 3156;
+
+static const TimeValue kWSCFlashlightClickIn = 3156;
+static const TimeValue kWSCFlashlightClickOut = 3211;
+
+static const TimeValue kWSCBumpIntoWallIn = 3211;
+static const TimeValue kWSCBumpIntoWallOut = 3514;
+
+static const TimeValue kWSCCantTransportIn = 3514;
+static const TimeValue kWSCCantTransportOut = 7791;
+
+static const TimeValue kHernandezNotHomeIn = 7791;
+static const TimeValue kHernandezNotHomeOut = 10199;
+
+static const TimeValue kWashingtonNotHomeIn = 10199;
+static const TimeValue kWashingtonNotHomeOut = 12649;
+
+static const TimeValue kSullivanNotHomeIn = 12649;
+static const TimeValue kSullivanNotHomeOut = 15031;
+
+static const TimeValue kNakamuraNotHomeIn = 15031;
+static const TimeValue kNakamuraNotHomeOut = 17545;
+
+static const TimeValue kGrailisNotHomeIn = 17545;
+static const TimeValue kGrailisNotHomeOut = 19937;
+
+static const TimeValue kTheriaultNotHomeIn = 19937;
+static const TimeValue kTheriaultNotHomeOut = 22395;
+
+static const TimeValue kGlennerNotHomeIn = 22395;
+static const TimeValue kGlennerNotHomeOut = 24770;
+
+static const TimeValue kSinclairNotHomeIn = 24770;
+static const TimeValue kSinclairNotHomeOut = 27328;
+
+static const TimeValue kWSCLabClosedIn = 27328;
+static const TimeValue kWSCLabClosedOut = 28904;
+
+static const TimeValue kSlidingDoorCloseIn = 28904;
+static const TimeValue kSlidingDoorCloseOut = 29295;
+
+static const TimeValue kSlimyDoorCloseIn = 29295;
+static const TimeValue kSlimyDoorCloseOut = 29788;
+
+static const TimeValue kPaging1In = 29788;
+static const TimeValue kPaging1Out = 32501;
+
+static const TimeValue kPaging2In = 32501;
+static const TimeValue kPaging2Out = 34892;
+
+static const TimeValue kCheckInIn = 34892;
+static const TimeValue kCheckInOut = 37789;
+
+static const TimeValue kDrinkAntidoteIn = 37789;
+static const TimeValue kDrinkAntidoteOut = 39725;
+
+static const TimeScale kWSCMovieScale = 600;
+static const TimeScale kWSCFramesPerSecond = 15;
+static const TimeScale kWSCFrameDuration = 40;
+
+// Alternate IDs.
+static const AlternateID kAltWSCNormal = 0;
+static const AlternateID kAltWSCTookMachineGun = 1;
+static const AlternateID kAltWSCW0ZDoorOpen = 2;
+static const AlternateID kAltWSCPeopleAtW19North = 3;
+
+// Room IDs.
+static const RoomID kWSC02 = 1;
+static const RoomID kWSC03 = 4;
+static const RoomID kWSC04 = 5;
+static const RoomID kWSC06 = 6;
+static const RoomID kWSC07 = 7;
+static const RoomID kWSC08 = 8;
+static const RoomID kWSC09 = 9;
+static const RoomID kWSC10 = 10;
+static const RoomID kWSC11 = 11;
+static const RoomID kWSC13 = 12;
+static const RoomID kWSC14 = 13;
+static const RoomID kWSC15 = 14;
+static const RoomID kWSC16 = 15;
+static const RoomID kWSC17 = 16;
+static const RoomID kWSC18 = 17;
+static const RoomID kWSC19 = 18;
+static const RoomID kWSC20 = 19;
+static const RoomID kWSC21 = 20;
+static const RoomID kWSC22 = 21;
+static const RoomID kWSC23 = 22;
+static const RoomID kWSC24 = 23;
+static const RoomID kWSC25 = 24;
+static const RoomID kWSC26 = 25;
+static const RoomID kWSC27 = 26;
+static const RoomID kWSC28 = 27;
+static const RoomID kWSC29 = 28;
+static const RoomID kWSC31 = 29;
+static const RoomID kWSC32 = 30;
+static const RoomID kWSC33 = 31;
+static const RoomID kWSC34 = 32;
+static const RoomID kWSC35 = 33;
+static const RoomID kWSC36 = 34;
+static const RoomID kWSC37 = 35;
+static const RoomID kWSC38 = 36;
+static const RoomID kWSC39 = 37;
+static const RoomID kWSC40 = 38;
+static const RoomID kWSC41 = 39;
+static const RoomID kWSC42 = 40;
+static const RoomID kWSC43 = 41;
+static const RoomID kWSC44 = 42;
+static const RoomID kWSC45 = 43;
+static const RoomID kWSC46 = 44;
+static const RoomID kWSC47 = 45;
+static const RoomID kWSC48 = 46;
+static const RoomID kWSC49 = 47;
+static const RoomID kWSC50 = 48;
+static const RoomID kWSC52 = 49;
+static const RoomID kWSC53 = 50;
+static const RoomID kWSC54 = 51;
+static const RoomID kWSC55 = 52;
+static const RoomID kWSC56 = 53;
+static const RoomID kWSC57 = 54;
+static const RoomID kWSC58 = 55;
+static const RoomID kWSC60 = 56;
+static const RoomID kWSC60East = 57;
+static const RoomID kWSC60North = 58;
+static const RoomID kWSC61 = 59;
+static const RoomID kWSC61South = 60;
+static const RoomID kWSC61West = 61;
+static const RoomID kWSC63 = 63;
+static const RoomID kWSC64 = 64;
+static const RoomID kWSC65 = 65;
+static const RoomID kWSC65Screen = 66;
+static const RoomID kWSC66 = 67;
+static const RoomID kWSC67 = 68;
+static const RoomID kWSC68 = 69;
+static const RoomID kWSC69 = 70;
+static const RoomID kWSC70 = 71;
+static const RoomID kWSC71 = 72;
+static const RoomID kWSC72 = 73;
+static const RoomID kWSC73 = 74;
+static const RoomID kWSC74 = 75;
+static const RoomID kWSC75 = 76;
+static const RoomID kWSC0Z = 77;
+static const RoomID kWSC76 = 78;
+static const RoomID kWSC77 = 79;
+static const RoomID kWSC78 = 80;
+static const RoomID kWSC79 = 81;
+static const RoomID kWSC80 = 82;
+static const RoomID kWSC81 = 83;
+static const RoomID kWSC82 = 84;
+static const RoomID kWSC83 = 85;
+static const RoomID kWSC84 = 86;
+static const RoomID kWSC85 = 87;
+static const RoomID kWSC86 = 88;
+static const RoomID kWSC87 = 89;
+static const RoomID kWSC88 = 90;
+static const RoomID kWSC89 = 91;
+static const RoomID kWSC90 = 92;
+static const RoomID kWSC91 = 93;
+static const RoomID kWSC92 = 94;
+static const RoomID kWSC93 = 95;
+static const RoomID kWSC94 = 96;
+static const RoomID kWSC95 = 97;
+static const RoomID kWSC96 = 98;
+static const RoomID kWSC97 = 99;
+static const RoomID kWSC98 = 100;
+static const RoomID kWSCDeathRoom = 101;
+
+// Hot Spot Activation IDs.
+static const HotSpotActivationID kActivationZoomedInToAnalyzer = 1;
+static const HotSpotActivationID kActivationShotByRobot = 2;
+static const HotSpotActivationID kActivationWarnedAboutPoison = 3;
+static const HotSpotActivationID kActivationMorphScreenOff = 4;
+static const HotSpotActivationID kActivationReadyForMorph = 5;
+static const HotSpotActivationID kActivationMorphLooping = 6;
+static const HotSpotActivationID kActivationMorphInterrupted = 7;
+static const HotSpotActivationID kActivationW03NorthOff = 8;
+static const HotSpotActivationID kActivationW03NorthReadyForInstructions = 9;
+static const HotSpotActivationID kActivationW03NorthSawInstructions = 10;
+static const HotSpotActivationID kActivationW03NorthInGame = 11;
+static const HotSpotActivationID kActivationReadyForSynthesis = 12;
+static const HotSpotActivationID kActivationSynthesizerLooping = 13;
+static const HotSpotActivationID kActivationReadyForMap = 14;
+static const HotSpotActivationID kActivationSinclairOfficeLocked = 15;
+static const HotSpotActivationID kActivationW58SouthDoorLocked = 16;
+static const HotSpotActivationID kActivationW61SouthOff = 17;
+static const HotSpotActivationID kActivationW61SouthOn = 18;
+static const HotSpotActivationID kActivationW61MessagesOff = 19;
+static const HotSpotActivationID kActivationW61MessagesOn = 20;
+static const HotSpotActivationID kActivationWSCRobotHeadOpen = 21;
+static const HotSpotActivationID kActivationRobotTurning = 22;
+static const HotSpotActivationID kActivationRobotDead = 23;
+static const HotSpotActivationID kActivationRobotGone = 24;
+
+// Hot Spot IDs.
+static const HotSpotID kWSCDropDartSpotID = 5000;
+static const HotSpotID kWSCTurnOnAnalyzerSpotID = 5001;
+static const HotSpotID kWSCAnalyzerScreenSpotID = 5002;
+static const HotSpotID kWSCSpinRobotSpotID = 5003;
+static const HotSpotID kWSC01YesSpotID = 5004;
+static const HotSpotID kWSC01NoSpotID = 5005;
+static const HotSpotID kWSC01AcknowledgeWarningSpotID = 5006;
+static const HotSpotID kWSC02SouthMorphSpotID = 5007;
+static const HotSpotID kWSC02SouthMessagesSpotID = 5008;
+static const HotSpotID kWSC02SouthMorphOutSpotID = 5009;
+static const HotSpotID kWSC02ActivateMorphScreenSpotID = 5010;
+static const HotSpotID kWSC02SouthStartMorphSpotID = 5011;
+static const HotSpotID kWSC02SouthInterruptMorphSpotID = 5012;
+static const HotSpotID kWSC02SouthMorphFinishedSpotID = 5013;
+static const HotSpotID kWSC02SouthTakeArgonSpotID = 5014;
+static const HotSpotID kWSC02SouthMessagesOutSpotID = 5015;
+static const HotSpotID kWSC02SouthTakeNitrogenSpotID = 5016;
+static const HotSpotID kWSC02SouthPlayMessagesSpotID = 5017;
+static const HotSpotID kWSC03NorthActivateScreenSpotID = 5018;
+static const HotSpotID kWSC03NorthBuildMoleculeSpotID = 5019;
+static const HotSpotID kWSC03NorthProceedSpotID = 5020;
+static const HotSpotID kWSC03NorthMolecule1SpotID = 5021;
+static const HotSpotID kWSC03NorthMolecule2SpotID = 5022;
+static const HotSpotID kWSC03NorthMolecule3SpotID = 5023;
+static const HotSpotID kWSC03NorthMolecule4SpotID = 5024;
+static const HotSpotID kWSC03NorthMolecule5SpotID = 5025;
+static const HotSpotID kWSC03NorthMolecule6SpotID = 5026;
+static const HotSpotID kWSC03SouthActivateSynthesizerSpotID = 5027;
+static const HotSpotID kWSC03SouthPickUpAntidoteSpotID = 5028;
+static const HotSpotID kWSC07SouthMapSpotID = 5029;
+static const HotSpotID kW42EastUnlockDoorSpotID = 5030;
+static const HotSpotID kW56NorthMapSpotID = 5031;
+static const HotSpotID kW58SouthPryDoorSpotID = 5032;
+static const HotSpotID kWSC60EastSpotID = 5033;
+static const HotSpotID kWSC60NorthSpotID = 5034;
+static const HotSpotID kWSC60EastOutSpotID = 5035;
+static const HotSpotID kWSC60NorthOutSpotID = 5036;
+static const HotSpotID kWSC61EastSpotID = 5037;
+static const HotSpotID kWSC61SouthSpotID = 5038;
+static const HotSpotID kW61SouthMachineGunSpotID = 5039;
+static const HotSpotID kW61SouthDropMachineGunSpotID = 5040;
+static const HotSpotID kWSC61WestSpotID = 5041;
+static const HotSpotID kWSC61SouthOutSpotID = 5042;
+static const HotSpotID kW61SouthActivateSpotID = 5043;
+static const HotSpotID kW61SmartAlloysSpotID = 5044;
+static const HotSpotID kW61MorphingSpotID = 5045;
+static const HotSpotID kW61TimeBendingSpotID = 5046;
+static const HotSpotID kWSC61WestOutSpotID = 5047;
+static const HotSpotID kW61TurnOnMessagesSpotID = 5048;
+static const HotSpotID kW61WhiteMessageSpotID = 5049;
+static const HotSpotID kW61WalchekMessageSpotID = 5050;
+static const HotSpotID kWSC65SouthScreenSpotID = 5051;
+static const HotSpotID kWSC65SouthScreenOutSpotID = 5052;
+static const HotSpotID kW98RetinalChipSpotID = 5053;
+static const HotSpotID kW98MapChipSpotID = 5054;
+static const HotSpotID kW98OpticalChipSpotID = 5055;
+static const HotSpotID kW98DropArgonSpotID = 5056;
+static const HotSpotID kW98GrabCableSpotID = 5057;
+static const HotSpotID kW98OpenRobotSpotID = 5058;
+static const HotSpotID kW98StunGunSpotID = 5059;
+
+// Extra sequence IDs.
+static const ExtraID kWSCArrivalFromTSA = 0;
+static const ExtraID kWSCShotByRobot = 1;
+static const ExtraID kWSCDartScan1 = 2;
+static const ExtraID kWSCDartScan2 = 3;
+static const ExtraID kWSCDartScanNo = 4;
+static const ExtraID kWSCDartScan3 = 5;
+static const ExtraID kWSCAnalyzerPowerUp = 6;
+static const ExtraID kWSCAnalyzerPowerUpWithDart = 7;
+static const ExtraID kWSCDropDartIntoAnalyzer = 8;
+static const ExtraID kWSCAnalyzeDart = 9;
+static const ExtraID kWSCZoomOutFromAnalyzer = 10;
+static const ExtraID kWSCSpinRobot = 11;
+static const ExtraID kWSC02MorphZoomNoArgon = 12;
+static const ExtraID kWSC02MessagesZoomNoNitrogen = 13;
+static const ExtraID kWSC02ZoomOutNoArgon = 14;
+static const ExtraID kWSC02TurnOnMorphScreen = 15;
+static const ExtraID kWSC02DropToMorphExperiment = 16;
+static const ExtraID kWSC02MorphLoop = 17;
+static const ExtraID kWSC02MorphInterruption = 18;
+static const ExtraID kWSC02MorphFinished = 19;
+static const ExtraID kWSC02TurnOffMorphScreen = 20;
+static const ExtraID kWSC02SouthViewNoArgon = 21;
+static const ExtraID kMessagesMovedToOffice = 22;
+static const ExtraID kMessagesOff = 23;
+static const ExtraID kMessagesZoomOutNoNitrogen = 24;
+static const ExtraID kMessagesMovedToOfficeNoNitrogen = 25;
+static const ExtraID kMessagesOffNoNitrogen = 26;
+static const ExtraID kMessagesViewNoNitrogen = 27;
+static const ExtraID kMessagesViewMachineOnNoNitrogen = 28;
+static const ExtraID kW03NorthActivate = 29;
+static const ExtraID kW03NorthGetData = 30;
+static const ExtraID kW03NorthInstructions = 31;
+static const ExtraID kW03NorthPrepMolecule1 = 32;
+static const ExtraID kW03NorthPrepMolecule2 = 33;
+static const ExtraID kW03NorthPrepMolecule3 = 34;
+static const ExtraID kW03NorthFinishSynthesis = 35;
+static const ExtraID kW03SouthCreateAntidote = 36;
+static const ExtraID kW03SouthAntidoteLoop = 37;
+static const ExtraID kW03SouthDeactivate = 38;
+static const ExtraID kW03SouthViewNoAntidote = 39;
+static const ExtraID kWSC07SouthMap = 40;
+static const ExtraID kW17WestPeopleCrossing = 41;
+static const ExtraID kW17WestPeopleCrossingView = 42;
+static const ExtraID kW21SouthPeopleCrossing = 43;
+static const ExtraID kW24SouthPeopleCrossing = 44;
+static const ExtraID kW34EastPeopleCrossing = 45;
+static const ExtraID kW36WestPeopleCrossing = 46;
+static const ExtraID kW38NorthPeopleCrossing = 47;
+static const ExtraID kW46SouthPeopleCrossing = 48;
+static const ExtraID kW49NorthPeopleCrossing = 49;
+static const ExtraID kW49NorthPeopleCrossingView = 50;
+static const ExtraID kWSC56SouthMap = 51;
+static const ExtraID kNerdAtTheDoor1 = 52;
+static const ExtraID kNerdAtTheDoor2 = 53;
+static const ExtraID kW61SouthZoomInNoGun = 54;
+static const ExtraID kW61Brochure = 55;
+static const ExtraID kW61SouthScreenOnWithGun = 56;
+static const ExtraID kW61SouthScreenOffWithGun = 57;
+static const ExtraID kW61SouthSmartAlloysWithGun = 58;
+static const ExtraID kW61SouthMorphingWithGun = 59;
+static const ExtraID kW61SouthTimeBendingWithGun = 60;
+static const ExtraID kW61SouthZoomOutNoGun = 61;
+static const ExtraID kW61SouthScreenOnNoGun = 62;
+static const ExtraID kW61SouthScreenOffNoGun = 63;
+static const ExtraID kW61SouthSmartAlloysNoGun = 64;
+static const ExtraID kW61SouthMorphingNoGun = 65;
+static const ExtraID kW61SouthTimeBendingNoGun = 66;
+static const ExtraID kW61MessagesOn = 67;
+static const ExtraID kW61MessagesOff = 68;
+static const ExtraID kW61WhiteMessage = 69;
+static const ExtraID kW61WalchekMessage = 70;
+static const ExtraID kW61WalchekEasterEgg1 = 71;
+static const ExtraID kW62SouthPlasmaRobotAppears = 72;
+static const ExtraID kW62ZoomToRobot = 73;
+static const ExtraID kW62ZoomOutFromRobot = 74;
+static const ExtraID kW62PlasmaDodgeSurvive = 75;
+static const ExtraID kW62PlasmaDodgeDie = 76;
+static const ExtraID kW65SouthSinclairLecture = 77;
+static const ExtraID kW73WestPeopleCrossing = 78;
+static const ExtraID kW73WestPeopleCrossingView = 79;
+static const ExtraID kW0ZSpottedByWomen = 80;
+static const ExtraID kW95RobotShoots = 81;
+static const ExtraID kW98MorphsToRobot = 82;
+static const ExtraID kW98RobotShoots = 83;
+static const ExtraID kW98RobotShocked = 84;
+static const ExtraID kW98RobotGassed = 85;
+static const ExtraID kW98RobotHeadOpensDark = 86;
+static const ExtraID kW98RobotHead000Dark = 87;
+static const ExtraID kW98RobotHead001Dark = 88;
+static const ExtraID kW98RobotHead010Dark = 89;
+static const ExtraID kW98RobotHead011Dark = 90;
+static const ExtraID kW98RobotHead100Dark = 91;
+static const ExtraID kW98RobotHead101Dark = 92;
+static const ExtraID kW98RobotHead110Dark = 93;
+static const ExtraID kW98RobotHead111Dark = 94;
+static const ExtraID kW98RobotHeadClosesDark = 95;
+static const ExtraID kW98WestViewWithGunDark = 96;
+static const ExtraID kW98WestViewNoGunDark = 97;
+static const ExtraID kW98RobotHeadOpensLight = 98;
+static const ExtraID kW98RobotHead000Light = 99;
+static const ExtraID kW98RobotHead001Light = 100;
+static const ExtraID kW98RobotHead010Light = 101;
+static const ExtraID kW98RobotHead011Light = 102;
+static const ExtraID kW98RobotHead100Light = 103;
+static const ExtraID kW98RobotHead101Light = 104;
+static const ExtraID kW98RobotHead110Light = 105;
+static const ExtraID kW98RobotHead111Light = 106;
+static const ExtraID kW98RobotHeadClosesLight = 107;
+static const ExtraID kW98WestViewWithGunLight = 108;
+static const ExtraID kW98WestViewNoGunLight = 109;
+
+static const CoordType kMoleculesMovieLeft = kNavAreaLeft + 112;
+static const CoordType kMoleculesMovieTop = kNavAreaTop + 40;
+
+WSC::WSC(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "WSC", kWSCID),
+ _moleculesMovie(kNoDisplayElement) {
+ setIsItemTaken(kArgonCanister);
+ setIsItemTaken(kSinclairKey);
+ setIsItemTaken(kNitrogenCanister);
+ setIsItemTaken(kPoisonDart);
+ setIsItemTaken(kAntidote);
+ setIsItemTaken(kMachineGun);
+ setIsItemTaken(kStunGun);
+
+ GameState.setTakenItemID(kArgonPickup, GameState.isTakenItemID(kArgonCanister) &&
+ GameState.isTakenItemID(kSinclairKey));
+}
+
+uint16 WSC::getDateResID() const {
+ return kDate2310ID;
+}
+
+void WSC::init() {
+ Neighborhood::init();
+
+ _cachedZoomSpot = 0;
+ _argonSprite = 0;
+
+ // HACK: Fix the drag item for picking up the Sinclair Key Card
+ HotspotInfoTable::Entry *entry = findHotspotEntry(kWSC02SouthTakeArgonSpotID);
+ entry->hotspotItem = kArgonPickup;
+}
+
+void WSC::flushGameState() {
+ g_energyMonitor->saveCurrentEnergyValue();
+}
+
+void WSC::start() {
+ if (g_energyMonitor) {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+ }
+
+ if (!GameState.getWSCDidPlasmaDodge())
+ forceStridingStop(kWSC58, kSouth, kAltWSCNormal);
+
+ Neighborhood::start();
+}
+
+class PryDoorMessage : public AIPlayMessageAction {
+public:
+ PryDoorMessage() : AIPlayMessageAction("Images/AI/WSC/XW59SD3", false) {}
+
+protected:
+ virtual void performAIAction(AIRule *);
+};
+
+void PryDoorMessage::performAIAction(AIRule *rule) {
+ if (((PegasusEngine *)g_engine)->playerHasItemID(kShieldBiochip)
+ && ((PegasusEngine *)g_engine)->getCurrentBiochip()->getObjectID() != kShieldBiochip)
+ AIPlayMessageAction::performAIAction(rule);
+}
+
+void WSC::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ if (g_AIArea) {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/WSC/XW1WB1", false);
+ AILastExtraCondition *extraCondition = new AILastExtraCondition(kWSCDartScan1);
+ AIRule *rule = new AIRule(extraCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ AILocationCondition *locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC06, kNorth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC10, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC28, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC49, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC65, kSouth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC73, kSouth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB5A", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC79, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/WSC/XW59SD1", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC58, kSouth));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ PryDoorMessage *pryDoorMessage = new PryDoorMessage();
+ AIDoorOpenedCondition *doorCondition = new AIDoorOpenedCondition(MakeRoomView(kWSC58, kSouth));
+ rule = new AIRule(doorCondition, pryDoorMessage);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/WSC/XW61E", false);
+ AIHasItemCondition *itemCondition = new AIHasItemCondition(kMachineGun);
+ rule = new AIRule(itemCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+
+ messageAction = new AIPlayMessageAction("Images/AI/Globals/XGLOB1E", false);
+ locCondition = new AILocationCondition(1);
+ locCondition->addLocation(MakeRoomView(kWSC95, kWest));
+ rule = new AIRule(locCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+ }
+}
+
+Common::String WSC::getBriefingMovie() {
+ return "Images/AI/WSC/XWO";
+}
+
+Common::String WSC::getEnvScanMovie() {
+ RoomID room = GameState.getCurrentRoom();
+
+ if (room >= kWSC01 && room <= kWSC04)
+ return "Images/AI/WSC/XWE1";
+ else if (room >= kWSC06 && room <= kWSC58)
+ return "Images/AI/WSC/XWE2";
+ else if (room >= kWSC60 && room <= kWSC61West)
+ return "Images/AI/WSC/XWE3";
+ else if (room >= kWSC64 && room <= kWSC98)
+ return "Images/AI/WSC/XWE4";
+
+ return "Images/AI/WSC/XWE5";
+}
+
+uint WSC::getNumHints() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC10, kWest):
+ case MakeRoomView(kWSC28, kWest):
+ case MakeRoomView(kWSC49, kWest):
+ case MakeRoomView(kWSC65, kSouth):
+ case MakeRoomView(kWSC75, kSouth):
+ case MakeRoomView(kWSC79, kWest):
+ return 2;
+ case MakeRoomView(kWSC02, kSouth):
+ if (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote())
+ return 3;
+ else if (!GameState.getScoringGotNitrogenCanister() ||
+ !GameState.getScoringGotSinclairKey())
+ return 1;
+ break;
+ case MakeRoomView(kWSC03, kNorth):
+ if (inSynthesizerGame() || (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote()))
+ return 3;
+ break;
+ case MakeRoomView(kWSC01, kNorth):
+ case MakeRoomView(kWSC01, kSouth):
+ case MakeRoomView(kWSC01, kEast):
+ case MakeRoomView(kWSC01, kWest):
+ case MakeRoomView(kWSC02, kNorth):
+ case MakeRoomView(kWSC02, kEast):
+ case MakeRoomView(kWSC02, kWest):
+ case MakeRoomView(kWSC02Morph, kNorth):
+ case MakeRoomView(kWSC02Morph, kEast):
+ case MakeRoomView(kWSC02Morph, kWest):
+ case MakeRoomView(kWSC02Messages, kNorth):
+ case MakeRoomView(kWSC02Messages, kEast):
+ case MakeRoomView(kWSC02Messages, kWest):
+ case MakeRoomView(kWSC03, kSouth):
+ case MakeRoomView(kWSC03, kEast):
+ case MakeRoomView(kWSC03, kWest):
+ case MakeRoomView(kWSC04, kNorth):
+ case MakeRoomView(kWSC04, kSouth):
+ case MakeRoomView(kWSC04, kEast):
+ case MakeRoomView(kWSC04, kWest):
+ if (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote())
+ return 3;
+ break;
+ case MakeRoomView(kWSC02Messages, kSouth):
+ if (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote())
+ return 3;
+ else if (!GameState.getScoringGotNitrogenCanister())
+ return 1;
+ break;
+ case MakeRoomView(kWSC02Morph, kSouth):
+ if (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote())
+ return 3;
+ else if (!GameState.getScoringGotSinclairKey())
+ return 1;
+ break;
+ case MakeRoomView(kWSC42, kEast):
+ if (!GameState.isCurrentDoorOpen())
+ return 1;
+ break;
+ case MakeRoomView(kWSC58, kSouth):
+ if (GameState.isCurrentDoorOpen()) {
+ if (GameState.getWSCDidPlasmaDodge())
+ return 0;
+ else
+ return 1;
+ } else if (_vm->playerHasItemID(kCrowbar))
+ return 2;
+
+ return 3;
+ case MakeRoomView(kWSC61, kEast):
+ if (!GameState.getScoringSawBrochure())
+ return 1;
+ break;
+ case MakeRoomView(kWSC61, kSouth):
+ if (!GameState.getScoringSawSinclairEntry1() ||
+ !GameState.getScoringSawSinclairEntry2() ||
+ !GameState.getScoringSawSinclairEntry3())
+ return 1;
+ break;
+ case MakeRoomView(kWSC98, kWest):
+ if (getCurrentActivation() == kActivationRobotTurning)
+ return 1;
+ break;
+ }
+
+ return 0;
+}
+
+Common::String WSC::getHintMovie(uint hintNum) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC10, kWest):
+ case MakeRoomView(kWSC28, kWest):
+ case MakeRoomView(kWSC49, kWest):
+ case MakeRoomView(kWSC65, kSouth):
+ case MakeRoomView(kWSC75, kSouth):
+ case MakeRoomView(kWSC79, kWest):
+ if (hintNum == 1)
+ return "Images/AI/Globals/XGLOB5B";
+
+ return "Images/AI/Globals/XGLOB5C";
+ case MakeRoomView(kWSC02, kSouth):
+ if (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote())
+ return Common::String::format("Images/AI/WSC/XWPH%d", hintNum);
+
+ return "Images/AI/Globals/XGLOB1C";
+ case MakeRoomView(kWSC61, kEast):
+ case MakeRoomView(kWSC61, kSouth):
+ return "Images/AI/Globals/XGLOB1C";
+ case MakeRoomView(kWSC42, kEast):
+ if (_vm->playerHasItemID(kSinclairKey))
+ return "Images/AI/Globals/XGLOB1A";
+
+ return "Images/AI/Globals/XGLOB2C";
+ case MakeRoomView(kWSC58, kSouth):
+ switch (hintNum) {
+ case 1:
+ if (GameState.isCurrentDoorOpen()) {
+ // Only get here if we haven't done the plasma dodge game...
+ if (_vm->playerHasItemID(kShieldBiochip))
+ return "Images/AI/Globals/XGLOB1A";
+ else
+ return "Images/AI/Globals/XGLOB3F";
+ } else if (_vm->playerHasItemID(kCrowbar)) {
+ return "Images/AI/Globals/XGLOB1A";
+ }
+
+ return "Images/AI/Globals/XGLOB1B";
+ case 2:
+ // Only get here if the door is still locked...
+ if (_vm->playerHasItemID(kCrowbar))
+ return "Images/AI/WSC/XW59SD2";
+
+ return "Images/AI/Globals/XGLOB2D";
+ case 3:
+ // Only get here if the door is still locked and we don't have the
+ // crowbar...
+ return "Images/AI/WSC/XW59SD2";
+ }
+ break;
+ case MakeRoomView(kWSC03, kNorth):
+ if (inSynthesizerGame())
+ return Common::String::format("Images/AI/WSC/XW03NH%d", hintNum);
+
+ return Common::String::format("Images/AI/WSC/XWPH%d", hintNum);
+ case MakeRoomView(kWSC01, kNorth):
+ case MakeRoomView(kWSC01, kSouth):
+ case MakeRoomView(kWSC01, kEast):
+ case MakeRoomView(kWSC01, kWest):
+ case MakeRoomView(kWSC02, kNorth):
+ case MakeRoomView(kWSC02, kEast):
+ case MakeRoomView(kWSC02, kWest):
+ case MakeRoomView(kWSC02Morph, kNorth):
+ case MakeRoomView(kWSC02Morph, kEast):
+ case MakeRoomView(kWSC02Morph, kWest):
+ case MakeRoomView(kWSC02Messages, kNorth):
+ case MakeRoomView(kWSC02Messages, kEast):
+ case MakeRoomView(kWSC02Messages, kWest):
+ case MakeRoomView(kWSC03, kSouth):
+ case MakeRoomView(kWSC03, kEast):
+ case MakeRoomView(kWSC03, kWest):
+ case MakeRoomView(kWSC04, kNorth):
+ case MakeRoomView(kWSC04, kSouth):
+ case MakeRoomView(kWSC04, kEast):
+ case MakeRoomView(kWSC04, kWest):
+ // analyzer hint
+ return Common::String::format("Images/AI/WSC/XWPH%d", hintNum);
+ case MakeRoomView(kWSC02Messages, kSouth):
+ case MakeRoomView(kWSC02Morph, kSouth):
+ if (_vm->getEnergyDeathReason() == kDeathDidntStopPoison &&
+ !_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag) &&
+ !GameState.getWSCDesignedAntidote())
+ // analyzer hint
+ return Common::String::format("Images/AI/WSC/XWPH%d", hintNum);
+
+ return "Images/AI/Globals/XGLOB1C";
+ case MakeRoomView(kWSC98, kWest):
+ return "Images/AI/WSC/XW98WH2";
+ }
+
+ return "";
+}
+
+void WSC::prepareForAIHint(const Common::String &movieName) {
+ if (movieName == "Images/AI/WSC/XW98WH2" && isEventTimerRunning())
+ pauseTimer();
+}
+
+void WSC::cleanUpAfterAIHint(const Common::String &movieName) {
+ if (movieName == "Images/AI/WSC/XW98WH2" && isEventTimerRunning())
+ resumeTimer();
+}
+
+bool WSC::okayToJump() {
+ if (GameState.getWSCPoisoned()) {
+ die(kDeathDidntStopPoison);
+ return false;
+ }
+
+ bool result = Neighborhood::okayToJump();
+ if (!result)
+ playSpotSoundSync(kWSCCantTransportIn, kWSCCantTransportOut);
+
+ return result;
+}
+
+TimeValue WSC::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraID viewExtra = 0xffffffff;
+ ExtraTable::Entry extra;
+
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kWSC01, kWest):
+ if (!GameState.getWSCSeenTimeStream()) {
+ getExtraEntry(kWSCArrivalFromTSA, extra);
+ return extra.movieStart;
+ } else if (GameState.getWSCPoisoned() && !GameState.getWSCAnsweredAboutDart()) {
+ viewExtra = kWSCDartScan1;
+ }
+ break;
+ case MakeRoomView(kWSC02Morph, kSouth):
+ if (GameState.isTakenItemID(kArgonPickup) || GameState.isTakenItemID(kArgonCanister))
+ viewExtra = kWSC02SouthViewNoArgon;
+ break;
+ case MakeRoomView(kWSC02Messages, kSouth):
+ if (GameState.isTakenItemID(kNitrogenCanister)) {
+ if (_privateFlags.getFlag(kWSCPrivateLabMessagesOpenFlag))
+ viewExtra = kMessagesViewMachineOnNoNitrogen;
+ else
+ viewExtra = kMessagesViewNoNitrogen;
+ }
+ break;
+ case MakeRoomView(kWSC03, kSouth):
+ if (_privateFlags.getFlag(kWSCDraggingAntidoteFlag))
+ viewExtra = kW03SouthViewNoAntidote;
+ break;
+ case MakeRoomView(kWSC17, kWest):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt17WestFlag))
+ viewExtra = kW17WestPeopleCrossingView;
+ break;
+ case MakeRoomView(kWSC49, kNorth):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt49NorthFlag))
+ viewExtra = kW49NorthPeopleCrossingView;
+ break;
+ case MakeRoomView(kWSC73, kWest):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt73WestFlag))
+ viewExtra = kW73WestPeopleCrossingView;
+ break;
+ case MakeRoomView(kWSC98, kWest):
+ if (GameState.getWSCRobotDead()) {
+ if (GameState.getWSCRobotGone()) {
+ if (GameState.isTakenItemID(kStunGun)) {
+ if (GameState.getWSCCatwalkDark())
+ viewExtra = kW98WestViewNoGunDark;
+ else
+ viewExtra = kW98WestViewNoGunLight;
+ } else {
+ if (GameState.getWSCCatwalkDark())
+ viewExtra = kW98WestViewWithGunDark;
+ else
+ viewExtra = kW98WestViewWithGunLight;
+ }
+ } else if (_privateFlags.getFlag(kWSCPrivateRobotHeadOpenFlag)) {
+ if (GameState.getWSCCatwalkDark())
+ viewExtra = kW98RobotHead111Dark;
+ else
+ viewExtra = kW98RobotHead111Light;
+
+ if (_privateFlags.getFlag(kWSCPrivateGotRetScanChipFlag))
+ viewExtra -= 1;
+ if (_privateFlags.getFlag(kWSCPrivateGotMapChipFlag))
+ viewExtra -= 2;
+ if (_privateFlags.getFlag(kWSCPrivateGotOpticalChipFlag))
+ viewExtra -= 4;
+ } else if (GameState.getWSCRobotDead()) {
+ // Should only happen on loading a saved game, so it can take its time.
+ if (GameState.getWSCCatwalkDark())
+ viewExtra = kW98RobotShocked;
+ else
+ viewExtra = kW98RobotGassed;
+ }
+ }
+ break;
+ }
+
+ if (viewExtra != 0xffffffff) {
+ getExtraEntry(viewExtra, extra);
+ return extra.movieEnd - 1;
+ }
+
+ return Neighborhood::getViewTime(room, direction);
+}
+
+void WSC::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &spotEntry) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kWSC58, kSouth):
+ case MakeRoomView(kWSC79, kWest):
+ if ((flags & kSpotOnTurnMask) != 0) {
+ spotEntry.clear();
+ return;
+ }
+ break;
+ }
+
+ Neighborhood::findSpotEntry(room, direction, flags, spotEntry);
+}
+
+void WSC::getZoomEntry(const HotSpotID id, ZoomTable::Entry &zoomEntry) {
+ Neighborhood::getZoomEntry(id, zoomEntry);
+
+ ExtraTable::Entry extra;
+ ExtraID zoomExtra = 0xffffffff;
+
+ switch (id) {
+ case kWSC02SouthMessagesSpotID:
+ if (GameState.isTakenItemID(kNitrogenCanister))
+ zoomExtra = kWSC02MessagesZoomNoNitrogen;
+ break;
+ case kWSC02SouthMessagesOutSpotID:
+ if (GameState.isTakenItemID(kNitrogenCanister))
+ zoomExtra = kMessagesZoomOutNoNitrogen;
+ break;
+ case kWSC02SouthMorphSpotID:
+ if (GameState.isTakenItemID(kArgonCanister))
+ zoomExtra = kWSC02MorphZoomNoArgon;
+ break;
+ case kWSC02SouthMorphOutSpotID:
+ if (GameState.isTakenItemID(kArgonCanister))
+ zoomExtra = kWSC02ZoomOutNoArgon;
+ break;
+ case kWSC61SouthSpotID:
+ if (GameState.isTakenItemID(kMachineGun))
+ zoomExtra = kW61SouthZoomInNoGun;
+ break;
+ case kWSC61SouthOutSpotID:
+ if (GameState.isTakenItemID(kMachineGun))
+ zoomExtra = kW61SouthZoomOutNoGun;
+ break;
+ }
+
+ if (zoomExtra != 0xffffffff) {
+ getExtraEntry(zoomExtra, extra);
+ zoomEntry.movieStart = extra.movieStart;
+ zoomEntry.movieEnd = extra.movieEnd;
+ }
+}
+
+void WSC::getExtraEntry(const uint32 id, ExtraTable::Entry &extraEntry) {
+ switch (id) {
+ case kWSCZoomOutFromAnalyzer:
+ Neighborhood::getExtraEntry(kWSCZoomOutFromAnalyzer, extraEntry);
+ extraEntry.movieEnd = extraEntry.movieStart + 14 * kWSCFrameDuration;
+ break;
+ case kW61WalchekMessage:
+ if (GameState.getEasterEgg())
+ Neighborhood::getExtraEntry(kW61WalchekEasterEgg1, extraEntry);
+ else
+ Neighborhood::getExtraEntry(id, extraEntry);
+ break;
+ case kW61SouthScreenOnWithGun:
+ if (GameState.isTakenItemID(kMachineGun))
+ Neighborhood::getExtraEntry(id, extraEntry);
+ else
+ Neighborhood::getExtraEntry(kW61SouthScreenOnNoGun, extraEntry);
+ break;
+ case kW61SouthSmartAlloysWithGun:
+ if (GameState.isTakenItemID(kMachineGun))
+ Neighborhood::getExtraEntry(id, extraEntry);
+ else
+ Neighborhood::getExtraEntry(kW61SouthSmartAlloysNoGun, extraEntry);
+ break;
+ case kW61SouthMorphingWithGun:
+ if (GameState.isTakenItemID(kMachineGun))
+ Neighborhood::getExtraEntry(id, extraEntry);
+ else
+ Neighborhood::getExtraEntry(kW61SouthMorphingNoGun, extraEntry);
+ break;
+ case kW61SouthTimeBendingWithGun:
+ if (GameState.isTakenItemID(kMachineGun))
+ Neighborhood::getExtraEntry(id, extraEntry);
+ else
+ Neighborhood::getExtraEntry(kW61SouthTimeBendingNoGun, extraEntry);
+ break;
+ case kW98RobotHeadOpensLight:
+ if (GameState.getWSCCatwalkDark())
+ Neighborhood::getExtraEntry(kW98RobotHeadOpensDark, extraEntry);
+ else
+ Neighborhood::getExtraEntry(id, extraEntry);
+ break;
+ default:
+ Neighborhood::getExtraEntry(id, extraEntry);
+ break;
+ }
+}
+
+CanMoveForwardReason WSC::canMoveForward(ExitTable::Entry &entry) {
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kWSC01, kWest) &&
+ getCurrentActivation() != kActivateHotSpotAlways)
+ return kCantMoveWatchingDiagnosis;
+
+ return Neighborhood::canMoveForward(entry);
+}
+
+// Also add cases here for compound analyzer...
+CanTurnReason WSC::canTurn(TurnDirection turnDirection, DirectionConstant &nextDir) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC01, kWest):
+ if (getCurrentActivation() != kActivateHotSpotAlways)
+ return kCantTurnWatchingDiagnosis;
+ break;
+ case MakeRoomView(kWSC01, kEast):
+ if (getCurrentActivation() != kActivateHotSpotAlways)
+ return kCantTurnWatchingAnalysis;
+ break;
+ case MakeRoomView(kWSC03, kNorth):
+ if (_privateFlags.getFlag(kWSCPrivateInMoleculeGameFlag))
+ return kCantTurnInMoleculeGame;
+ break;
+ }
+
+ return Neighborhood::canTurn(turnDirection, nextDir);
+}
+
+CanOpenDoorReason WSC::canOpenDoor(DoorTable::Entry &entry) {
+ switch (GameState.getCurrentRoom()) {
+ case kWSC42:
+ if (!_privateFlags.getFlag(kWSCPrivateSinclairOfficeOpenFlag))
+ return kCantOpenLocked;
+ break;
+ case kWSC58:
+ if (!_privateFlags.getFlag(kWSCPrivate58SouthOpenFlag))
+ return kCantOpenLocked;
+ break;
+ }
+
+ return Neighborhood::canOpenDoor(entry);
+}
+
+void WSC::bumpIntoWall() {
+ requestSpotSound(kWSCBumpIntoWallIn, kWSCBumpIntoWallOut, kFilterAllInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+void WSC::closeDoorOffScreen(const RoomID room, const DirectionConstant) {
+ Item *keyCard;
+
+ switch (room) {
+ case kWSC58:
+ case kWSC62:
+ case kWSC63:
+ case kWSC64:
+ case kWSC85:
+ case kWSC86:
+ case kWSC88:
+ case kWSC89:
+ playSpotSoundSync(kSlidingDoorCloseIn, kSlidingDoorCloseOut);
+ break;
+ case kWSC81:
+ case kWSC82:
+ case kWSC92:
+ case kWSC93:
+ keyCard = _vm->getAllItems().findItemByID(kKeyCard);
+ if (keyCard->getItemState() == kFlashlightOn && (GameState.getCurrentRoom() == kWSC81 ||
+ GameState.getCurrentRoom() == kWSC93)) {
+ keyCard->setItemState(kFlashlightOff);
+ playSpotSoundSync(kWSCFlashlightClickIn, kWSCFlashlightClickOut);
+ } else if (keyCard->getItemState() == kFlashlightOff && (GameState.getCurrentRoom() == kWSC82 ||
+ GameState.getCurrentRoom() == kWSC92)) {
+ keyCard->setItemState(kFlashlightOn);
+ playSpotSoundSync(kWSCFlashlightClickIn, kWSCFlashlightClickOut);
+ }
+
+ playSpotSoundSync(kSlimyDoorCloseIn, kSlimyDoorCloseOut);
+ break;
+ default:
+ playSpotSoundSync(kSlimyDoorCloseIn, kSlimyDoorCloseOut);
+ break;
+ }
+}
+
+void WSC::cantMoveThatWay(CanMoveForwardReason reason) {
+ if (reason != kCantMoveWatchingDiagnosis)
+ Neighborhood::cantMoveThatWay(reason);
+}
+
+void WSC::cantOpenDoor(CanOpenDoorReason reason) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC22, kWest):
+ playSpotSoundSync(kNakamuraNotHomeIn, kNakamuraNotHomeOut);
+ break;
+ case MakeRoomView(kWSC23, kEast):
+ playSpotSoundSync(kHernandezNotHomeIn, kHernandezNotHomeOut);
+ break;
+ case MakeRoomView(kWSC26, kWest):
+ playSpotSoundSync(kGrailisNotHomeIn, kGrailisNotHomeOut);
+ break;
+ case MakeRoomView(kWSC27, kEast):
+ playSpotSoundSync(kWashingtonNotHomeIn, kWashingtonNotHomeOut);
+ break;
+ case MakeRoomView(kWSC32, kWest):
+ playSpotSoundSync(kTheriaultNotHomeIn, kTheriaultNotHomeOut);
+ break;
+ case MakeRoomView(kWSC33, kEast):
+ playSpotSoundSync(kSullivanNotHomeIn, kSullivanNotHomeOut);
+ break;
+ case MakeRoomView(kWSC41, kWest):
+ playSpotSoundSync(kGlennerNotHomeIn, kGlennerNotHomeOut);
+ break;
+ case MakeRoomView(kWSC42, kEast):
+ playSpotSoundSync(kSinclairNotHomeIn, kSinclairNotHomeOut);
+ break;
+ case MakeRoomView(kWSC15, kWest):
+ case MakeRoomView(kWSC25, kWest):
+ case MakeRoomView(kWSC33, kWest):
+ case MakeRoomView(kWSC41, kEast):
+ case MakeRoomView(kWSC46, kWest):
+ playSpotSoundSync(kWSCLabClosedIn, kWSCLabClosedOut);
+ break;
+ default:
+ Neighborhood::cantOpenDoor(reason);
+ break;
+ }
+}
+
+void WSC::doorOpened() {
+ Neighborhood::doorOpened();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC42, kEast):
+ _vm->addItemToInventory((InventoryItem *)_vm->getAllItems().findItemByID(kSinclairKey));
+ break;
+ case MakeRoomView(kWSC58, kSouth):
+ GameState.setScoringUsedCrowBarInWSC();
+ _vm->addItemToInventory((InventoryItem *)_vm->getAllItems().findItemByID(kCrowbar));
+ break;
+ case MakeRoomView(kWSC06, kNorth):
+ case MakeRoomView(kWSC79, kWest):
+ die(kDeathArrestedInWSC);
+ break;
+ case MakeRoomView(kWSC60, kWest):
+ if (_vm->itemInInventory(kMachineGun))
+ startExtraSequence(kNerdAtTheDoor2, kExtraCompletedFlag, kFilterNoInput);
+ else if (!GameState.getWSCSeenNerd())
+ startExtraSequence(kNerdAtTheDoor1, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC95, kWest):
+ GameState.setScoringOpenedCatwalk();
+ scheduleEvent(kGawkAtRobotTime, 1, kTimerEventPlayerGawkingAtRobot);
+ break;
+ }
+}
+
+void WSC::turnLeft() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC17, kNorth):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt17WestFlag) && _vm->getRandomNumber(2) == 0)
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt17WestFlag, true);
+ break;
+ case MakeRoomView(kWSC49, kEast):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt49NorthFlag) && _vm->getRandomNumber(2) == 0)
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt49NorthFlag, true);
+ break;
+ case MakeRoomView(kWSC73, kNorth):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt73WestFlag) && _vm->getRandomNumber(2) == 0)
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt73WestFlag, true);
+ break;
+ case MakeRoomView(kWSC73, kWest):
+ if (!GameState.getWSCBeenAtWSC93())
+ setCurrentAlternate(kAltWSCW0ZDoorOpen);
+ break;
+ case MakeRoomView(kWSC95, kWest):
+ cancelEvent();
+ break;
+ }
+
+ Neighborhood::turnLeft();
+}
+
+void WSC::turnRight() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC17, kSouth):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt17WestFlag) && _vm->getRandomNumber(2) == 0)
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt17WestFlag, true);
+ break;
+ case MakeRoomView(kWSC49, kWest):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt49NorthFlag) && _vm->getRandomNumber(2) == 0)
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt49NorthFlag, true);
+ break;
+ case MakeRoomView(kWSC73, kSouth):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt73WestFlag) && _vm->getRandomNumber(2) == 0)
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt73WestFlag, true);
+ break;
+ case MakeRoomView(kWSC73, kEast):
+ if (!GameState.getWSCBeenAtWSC93())
+ setCurrentAlternate(kAltWSCW0ZDoorOpen);
+ break;
+ case MakeRoomView(kWSC95, kWest):
+ cancelEvent();
+ break;
+ }
+
+ Neighborhood::turnRight();
+}
+
+void WSC::moveForward() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC19, kNorth):
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt19NorthFlag))
+ setCurrentAlternate(kAltWSCPeopleAtW19North);
+ break;
+ case MakeRoomView(kWSC95, kWest):
+ cancelEvent();
+ break;
+ }
+
+ Neighborhood::moveForward();
+}
+
+void WSC::zoomTo(const Hotspot *hotspot) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC02Messages, kSouth):
+ if (_privateFlags.getFlag(kWSCPrivateLabMessagesOpenFlag)) {
+ _cachedZoomSpot = hotspot;
+ if (GameState.isTakenItemID(kNitrogenCanister))
+ startExtraSequence(kMessagesOffNoNitrogen, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMessagesOff, kExtraCompletedFlag, kFilterNoInput);
+ return;
+ }
+ break;
+ case MakeRoomView(kWSC61West, kWest):
+ if (GameState.getWSCOfficeMessagesOpen()) {
+ _cachedZoomSpot = hotspot;
+ startExtraSequence(kW61MessagesOff, kExtraCompletedFlag, kFilterNoInput);
+ return;
+ }
+ break;
+ case MakeRoomView(kWSC61South, kSouth):
+ if (_privateFlags.getFlag(kWSCPrivateOfficeLogOpenFlag)) {
+ _cachedZoomSpot = hotspot;
+ if (GameState.isTakenItemID(kMachineGun))
+ startExtraSequence(kW61SouthScreenOffNoGun, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kW61SouthScreenOffWithGun, kExtraCompletedFlag, kFilterNoInput);
+ return;
+ }
+ break;
+ }
+
+ Neighborhood::zoomTo(hotspot);
+}
+
+void WSC::startExtraSequence(const ExtraID extraID, const NotificationFlags flags, const InputBits interruptionFilter) {
+ if (extraID == kW61Brochure)
+ loadLoopSound1("");
+
+ Neighborhood::startExtraSequence(extraID, flags, interruptionFilter);
+}
+
+int16 WSC::getStaticCompassAngle(const RoomID room, const DirectionConstant dir) {
+ int16 angle = Neighborhood::getStaticCompassAngle(room, dir);
+
+ switch (room) {
+ case kWSC02Messages:
+ angle -= 50;
+ break;
+ case kWSC02Morph:
+ angle += 5;
+ break;
+ case kWSC60East:
+ angle -= 10;
+ break;
+ case kWSC66:
+ angle -= kAuditoriumAngleOffset;
+ break;
+ case kWSC67:
+ angle += kAuditoriumAngleOffset;
+ break;
+ case kWSC68:
+ angle -= kAuditoriumAngleOffset * 2;
+ break;
+ case kWSC69:
+ angle += kAuditoriumAngleOffset * 2;
+ break;
+ case kWSC70:
+ angle -= kAuditoriumAngleOffset * 3;
+ break;
+ case kWSC71:
+ angle += kAuditoriumAngleOffset * 3;
+ break;
+ case kWSC72:
+ if (dir == kEast || dir == kWest)
+ angle -= kAuditoriumAngleOffset * 4;
+ break;
+ case kWSC73:
+ if (dir == kEast || dir == kWest)
+ angle += kAuditoriumAngleOffset * 4;
+ break;
+ }
+
+ return angle;
+}
+
+void WSC::getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove) {
+ Neighborhood::getExitCompassMove(exitEntry, compassMove);
+
+ if (exitEntry.room == kWSC65 && exitEntry.direction == kSouth) {
+ compassMove.insertFaderKnot(exitEntry.movieStart + 100 * kWSCFrameDuration, 180);
+ compassMove.insertFaderKnot(exitEntry.movieStart + 108 * kWSCFrameDuration, 150);
+ compassMove.insertFaderKnot(exitEntry.movieEnd, 150);
+ }
+}
+
+void WSC::getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove) {
+ switch (entry.extra) {
+ case kW61Brochure:
+ compassMove.insertFaderKnot(entry.movieStart + 15 * kWSCFrameDuration, 85);
+ compassMove.insertFaderKnot(entry.movieEnd - 15 * kWSCFrameDuration, 85);
+ compassMove.insertFaderKnot(entry.movieEnd, 90);
+ break;
+ default:
+ Neighborhood::getExtraCompassMove(entry, compassMove);
+ break;
+ }
+}
+
+void WSC::loadAmbientLoops() {
+ RoomID room = GameState.getCurrentRoom();
+
+ if (room >= kWSC01 && room <= kWSC04) {
+ if (GameState.getWSCSeenTimeStream())
+ loadLoopSound1("Sounds/World Science Center/WLabLoop.22K.AIFF", 0x100 / 2);
+ } else if ((room >= kWSC06 && room <= kWSC58) || (room >= kWSC62 && room <= kWSC63))
+ loadLoopSound1("Sounds/World Science Center/Organic Walls.22K.AIFF", 0x100 / 2);
+ else if (room >= kWSC82 && room <= kWSC92)
+ loadLoopSound1("Sounds/World Science Center/Creature Feature.22K.AIFF");
+ else if ((room >= kWSC60 && room <= kWSC61West) || (room >= kWSC64 && room <= kWSC81) ||
+ (room >= kWSC93 && room <= kWSC97))
+ loadLoopSound1("Sounds/World Science Center/The Other Side.22K.AIFF", 0x100 / 12);
+ else if (room == kWSC98)
+ loadLoopSound1("Sounds/World Science Center/WCatLoop.22K.AIFF");
+}
+
+void WSC::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kWSC07, kNorth):
+ case MakeRoomView(kWSC11, kSouth):
+ case MakeRoomView(kWSC13, kSouth):
+ case MakeRoomView(kWSC13, kWest):
+ case MakeRoomView(kWSC16, kWest):
+ case MakeRoomView(kWSC17, kEast):
+ case MakeRoomView(kWSC19, kWest):
+ case MakeRoomView(kWSC28, kNorth):
+ case MakeRoomView(kWSC28, kSouth):
+ case MakeRoomView(kWSC28, kEast):
+ case MakeRoomView(kWSC28, kWest):
+ case MakeRoomView(kWSC29, kNorth):
+ case MakeRoomView(kWSC29, kSouth):
+ case MakeRoomView(kWSC29, kEast):
+ case MakeRoomView(kWSC29, kWest):
+ case MakeRoomView(kWSC40, kEast):
+ case MakeRoomView(kWSC42, kEast):
+ case MakeRoomView(kWSC49, kWest):
+ case MakeRoomView(kWSC49, kNorth):
+ case MakeRoomView(kWSC50, kNorth):
+ case MakeRoomView(kWSC55, kEast):
+ case MakeRoomView(kWSC65, kSouth):
+ case MakeRoomView(kWSC65, kEast):
+ case MakeRoomView(kWSC65, kWest):
+ case MakeRoomView(kWSC72, kEast):
+ case MakeRoomView(kWSC72, kSouth):
+ case MakeRoomView(kWSC73, kWest):
+ case MakeRoomView(kWSC73, kSouth):
+ case MakeRoomView(kWSC79, kWest):
+ case MakeRoomView(kWSC81, kEast):
+ case MakeRoomView(kWSC93, kNorth):
+ case MakeRoomView(kWSC95, kWest):
+ makeContinuePoint();
+ break;
+ case MakeRoomView(kWSC58, kSouth):
+ if (!GameState.getWSCDidPlasmaDodge())
+ makeContinuePoint();
+ break;
+ case MakeRoomView(kWSC60, kWest):
+ if (_vm->playerHasItemID(kMachineGun))
+ makeContinuePoint();
+ break;
+ }
+}
+
+void WSC::arriveAt(const RoomID room, const DirectionConstant dir) {
+ switch (MakeRoomView(room, dir)) {
+ case MakeRoomView(kWSC60, kNorth):
+ case MakeRoomView(kWSC60, kSouth):
+ case MakeRoomView(kWSC60, kEast):
+ case MakeRoomView(kWSC60, kWest):
+ case MakeRoomView(kWSC60East, kNorth):
+ case MakeRoomView(kWSC60East, kSouth):
+ case MakeRoomView(kWSC60East, kEast):
+ case MakeRoomView(kWSC60East, kWest):
+ case MakeRoomView(kWSC60North, kNorth):
+ case MakeRoomView(kWSC60North, kSouth):
+ case MakeRoomView(kWSC60North, kEast):
+ case MakeRoomView(kWSC60North, kWest):
+ case MakeRoomView(kWSC61, kNorth):
+ case MakeRoomView(kWSC61, kSouth):
+ case MakeRoomView(kWSC61, kEast):
+ case MakeRoomView(kWSC61, kWest):
+ case MakeRoomView(kWSC61South, kNorth):
+ case MakeRoomView(kWSC61South, kSouth):
+ case MakeRoomView(kWSC61South, kEast):
+ case MakeRoomView(kWSC61South, kWest):
+ case MakeRoomView(kWSC61West, kNorth):
+ case MakeRoomView(kWSC61West, kSouth):
+ case MakeRoomView(kWSC61West, kEast):
+ case MakeRoomView(kWSC61West, kWest):
+ if (GameState.isTakenItemID(kMachineGun))
+ setCurrentAlternate(kAltWSCTookMachineGun);
+ else
+ setCurrentAlternate(kAltWSCNormal);
+ break;
+ case MakeRoomView(kWSC73, kSouth):
+ case MakeRoomView(kWSC75, kNorth):
+ case MakeRoomView(kWSC75, kSouth):
+ case MakeRoomView(kWSC75, kEast):
+ case MakeRoomView(kWSC75, kWest):
+ if (!GameState.getWSCBeenAtWSC93())
+ setCurrentAlternate(kAltWSCW0ZDoorOpen);
+ break;
+ }
+
+ Neighborhood::arriveAt(room, dir);
+
+ switch (MakeRoomView(room, dir)) {
+ case MakeRoomView(kWSC01, kWest):
+ if (!GameState.getWSCSeenTimeStream()) {
+ requestExtraSequence(kWSCArrivalFromTSA, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kWSCShotByRobot, 0, kFilterNoInput);
+ requestExtraSequence(kWSCDartScan1, kExtraCompletedFlag, kFilterNoInput);
+ } else if (GameState.getWSCPoisoned() && !GameState.getWSCAnsweredAboutDart()) {
+ setCurrentActivation(kActivationShotByRobot);
+ }
+ break;
+ case MakeRoomView(kWSC01, kEast):
+ if (GameState.getWSCDartInAnalyzer())
+ requestExtraSequence(kWSCDropDartIntoAnalyzer, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC02Morph, kSouth):
+ setCurrentActivation(kActivationMorphScreenOff);
+ break;
+ case MakeRoomView(kWSC03, kNorth):
+ setCurrentActivation(kActivationW03NorthOff);
+ break;
+ case MakeRoomView(kWSC03, kSouth):
+ if (GameState.getWSCDesignedAntidote() && !GameState.getWSCPickedUpAntidote())
+ setCurrentActivation(kActivationReadyForSynthesis);
+ break;
+ case MakeRoomView(kWSC16, kNorth):
+ if (getCurrentAlternate() == kAltWSCPeopleAtW19North) {
+ setCurrentAlternate(kAltWSCNormal);
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt19NorthFlag, true);
+ }
+ break;
+ case MakeRoomView(kWSC07, kSouth):
+ case MakeRoomView(kWSC56, kNorth):
+ setCurrentActivation(kActivationReadyForMap);
+ break;
+ case MakeRoomView(kWSC42, kWest):
+ setCurrentAlternate(kAltWSCNormal);
+ break;
+ case MakeRoomView(kWSC42, kEast):
+ _privateFlags.setFlag(kWSCPrivateSinclairOfficeOpenFlag, false);
+ setCurrentActivation(kActivationSinclairOfficeLocked);
+ break;
+ case MakeRoomView(kWSC58, kSouth):
+ setCurrentActivation(kActivationW58SouthDoorLocked);
+ _privateFlags.setFlag(kWSCPrivate58SouthOpenFlag, false);
+ break;
+ case MakeRoomView(kWSC60, kEast):
+ GameState.setScoringEnteredSinclairOffice();
+ break;
+ case MakeRoomView(kWSC61West, kWest):
+ setCurrentActivation(kActivationW61MessagesOff);
+ break;
+ case MakeRoomView(kWSC61South, kSouth):
+ setCurrentActivation(kActivationW61SouthOff);
+ break;
+ case MakeRoomView(kWSC62, kSouth):
+ if (!GameState.getWSCDidPlasmaDodge()) {
+ g_AIArea->lockAIOut();
+ loadLoopSound1("Sounds/World Science Center/Plasma Rock.22K.AIFF");
+ requestExtraSequence(kW62SouthPlasmaRobotAppears, 0, kFilterNoInput);
+ requestExtraSequence(kW62ZoomToRobot, 0, kFilterNoInput);
+ requestExtraSequence(kW62ZoomOutFromRobot, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case MakeRoomView(kWSC65Screen, kSouth):
+ if (!GameState.getWSCSeenSinclairLecture()) {
+ GameState.setWSCSeenSinclairLecture(true);
+ startExtraSequence(kW65SouthSinclairLecture, kExtraCompletedFlag, kFilterAllInput);
+ }
+ break;
+ case MakeRoomView(kWSC66, kWest):
+ case MakeRoomView(kWSC67, kEast):
+ if (!GameState.getWSCHeardPage2()) {
+ playSpotSoundSync(kPaging2In, kPaging2Out);
+ GameState.setWSCHeardPage2(true);
+ }
+ case MakeRoomView(kWSC10, kNorth):
+ case MakeRoomView(kWSC26, kSouth):
+ case MakeRoomView(kWSC72, kWest):
+ case MakeRoomView(kWSC83, kWest):
+ if (!GameState.getWSCHeardCheckIn()) {
+ playSpotSoundSync(kCheckInIn, kCheckInOut);
+ GameState.setWSCHeardCheckIn(true);
+ }
+ break;
+ case MakeRoomView(kWSC0Z, kSouth):
+ if (getCurrentAlternate() == kAltWSCW0ZDoorOpen)
+ turnLeft();
+ break;
+ case MakeRoomView(kWSC93, kEast):
+ GameState.setWSCBeenAtWSC93(true);
+ break;
+ case MakeRoomView(kWSC98, kWest):
+ if (!GameState.getWSCRobotDead()) {
+ scheduleEvent(kGawkAtRobotTime2, 1, kTimerEventPlayerGawkingAtRobot2);
+ setCurrentActivation(kActivationRobotTurning);
+ if (g_AIArea)
+ g_AIArea->checkMiddleArea();
+ } else if (!GameState.getWSCRobotGone()) {
+ setCurrentActivation(kActivationRobotDead);
+ } else {
+ if (GameState.getWSCCatwalkDark()) {
+ // Change the gun hot spot...
+ _vm->getAllHotspots().setHotspotRect(kW98StunGunSpotID, Common::Rect(181 + kNavAreaLeft,
+ 99 + kNavAreaTop,372 + kNavAreaLeft, 149 + kNavAreaTop));
+ }
+ setCurrentActivation(kActivationRobotGone);
+ }
+ break;
+ case MakeRoomView(kWSCDeathRoom, kNorth):
+ case MakeRoomView(kWSCDeathRoom, kSouth):
+ case MakeRoomView(kWSCDeathRoom, kEast):
+ case MakeRoomView(kWSCDeathRoom, kWest):
+ die(kDeathArrestedInWSC);
+ break;
+ }
+
+ checkPeopleCrossing();
+ setUpPoison();
+}
+
+void WSC::turnTo(const DirectionConstant direction) {
+ Neighborhood::turnTo(direction);
+
+ switch (MakeRoomView(GameState.getCurrentRoom(), direction)) {
+ case MakeRoomView(kWSC01, kNorth):
+ case MakeRoomView(kWSC01, kSouth):
+ GameState.setWSCAnalyzerOn(false);
+ break;
+ case MakeRoomView(kWSC03, kNorth):
+ setCurrentActivation(kActivationW03NorthOff);
+ break;
+ case MakeRoomView(kWSC03, kSouth):
+ if (GameState.getWSCDesignedAntidote() && !GameState.getWSCPickedUpAntidote())
+ setCurrentActivation(kActivationReadyForSynthesis);
+ break;
+ case MakeRoomView(kWSC07, kSouth):
+ case MakeRoomView(kWSC56, kNorth):
+ setCurrentActivation(kActivationReadyForMap);
+ break;
+ case MakeRoomView(kWSC18, kSouth):
+ case MakeRoomView(kWSC57, kEast):
+ case MakeRoomView(kWSC75, kEast):
+ case MakeRoomView(kWSC90, kSouth):
+ if (!GameState.getWSCHeardCheckIn()) {
+ playSpotSoundSync(kCheckInIn, kCheckInOut);
+ GameState.setWSCHeardCheckIn(true);
+ }
+ break;
+ case MakeRoomView(kWSC56, kSouth):
+ if (!GameState.getWSCHeardPage1()) {
+ playSpotSoundSync(kPaging1In, kPaging1Out);
+ GameState.setWSCHeardPage1(true);
+ }
+ // clone2727 says: This falls through?!??! WTF?
+ case MakeRoomView(kWSC42, kEast):
+ _privateFlags.setFlag(kWSCPrivateSinclairOfficeOpenFlag, false);
+ setCurrentActivation(kActivationSinclairOfficeLocked);
+ break;
+ case MakeRoomView(kWSC58, kSouth):
+ setCurrentActivation(kActivationW58SouthDoorLocked);
+ _privateFlags.setFlag(kWSCPrivate58SouthOpenFlag, false);
+ break;
+ case MakeRoomView(kWSC73, kWest):
+ setCurrentAlternate(kAltWSCNormal);
+ break;
+ case MakeRoomView(kWSC0Z, kEast):
+ if (getCurrentAlternate() == kAltWSCW0ZDoorOpen)
+ startExtraSequence(kW0ZSpottedByWomen, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+
+ checkPeopleCrossing();
+}
+
+void WSC::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ int32 currentEnergy;
+ Item *item;
+
+ if (flags & kExtraCompletedFlag) {
+ _interruptionFilter = kFilterAllInput;
+
+ switch (_lastExtra) {
+ case kWSCArrivalFromTSA:
+ GameState.setWSCSeenTimeStream(true);
+ loadAmbientLoops();
+ break;
+ case kWSCDartScan1:
+ setCurrentActivation(kActivationShotByRobot);
+ GameState.setWSCPoisoned(true);
+ setUpPoison();
+ makeContinuePoint();
+ break;
+ case kWSCDartScan2:
+ _vm->addItemToInventory((InventoryItem *)_vm->getAllItems().findItemByID(kPoisonDart));
+ GameState.setScoringRemovedDart();
+ GameState.setWSCRemovedDart(true);
+ setUpPoison();
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/WSC/XW1WB2", false, kHintInterruption);
+ // Fall through...
+ case kWSCDartScanNo:
+ GameState.setWSCAnsweredAboutDart(true);
+ startExtraSequence(kWSCDartScan3, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kWSCDartScan3:
+ setCurrentActivation(kActivateHotSpotAlways);
+ break;
+ case kWSCAnalyzerPowerUp:
+ case kWSCAnalyzerPowerUpWithDart:
+ GameState.setWSCAnalyzerOn(true);
+ break;
+ case kWSCDropDartIntoAnalyzer:
+ setCurrentActivation(kActivationZoomedInToAnalyzer);
+ break;
+ case kWSCAnalyzeDart:
+ GameState.setWSCAnalyzedDart(true);
+ GameState.setScoringAnalyzedDart();
+ break;
+ case kWSCZoomOutFromAnalyzer:
+ setCurrentActivation(kActivateHotSpotAlways);
+ GameState.setWSCAnalyzerOn(false);
+ GameState.setWSCDartInAnalyzer(false);
+ updateViewFrame();
+ break;
+ case kMessagesMovedToOffice:
+ case kMessagesMovedToOfficeNoNitrogen:
+ _privateFlags.setFlag(kWSCPrivateLabMessagesOpenFlag, true);
+ GameState.setScoringPlayedWithMessages();
+ break;
+ case kMessagesOff:
+ case kMessagesOffNoNitrogen:
+ _privateFlags.setFlag(kWSCPrivateLabMessagesOpenFlag, false);
+ if (_cachedZoomSpot) {
+ zoomTo(_cachedZoomSpot);
+ _cachedZoomSpot = 0;
+ }
+ break;
+ case kWSC02TurnOnMorphScreen:
+ setCurrentActivation(kActivationReadyForMorph);
+ break;
+ case kWSC02DropToMorphExperiment:
+ loopExtraSequence(kWSC02MorphLoop, kExtraCompletedFlag);
+ setCurrentActivation(kActivationMorphLooping);
+ break;
+ case kWSC02MorphLoop:
+ if (_privateFlags.getFlag(kWSCPrivateInterruptedMorphFlag))
+ startExtraSequence(kWSC02MorphInterruption, kExtraCompletedFlag, kFilterNoInput);
+ else
+ scheduleNavCallBack(kExtraCompletedFlag);
+ break;
+ case kWSC02MorphInterruption:
+ setCurrentActivation(kActivationMorphInterrupted);
+ GameState.setScoringSawMorphExperiment();
+ break;
+ case kWSC02TurnOffMorphScreen:
+ setCurrentActivation(kActivationMorphScreenOff);
+ GameState.setWSCSawMorph(true);
+ break;
+ case kW03NorthActivate:
+ if (GameState.getWSCAnalyzedDart() && !GameState.getWSCDesignedAntidote())
+ startExtraSequence(kW03NorthGetData, kExtraCompletedFlag, kFilterNoInput);
+ else
+ setCurrentActivation(kActivateHotSpotAlways);
+ break;
+ case kW03NorthGetData:
+ setCurrentActivation(kActivationW03NorthReadyForInstructions);
+ break;
+ case kW03NorthInstructions:
+ setCurrentActivation(kActivationW03NorthSawInstructions);
+ break;
+ case kW03NorthPrepMolecule1:
+ setUpMoleculeGame();
+ break;
+ case kW03NorthPrepMolecule2:
+ case kW03NorthPrepMolecule3:
+ nextMoleculeGameLevel();
+ break;
+ case kW03NorthFinishSynthesis:
+ setCurrentActivation(kActivateHotSpotAlways);
+ _privateFlags.setFlag(kWSCPrivateInMoleculeGameFlag, false);
+ GameState.setWSCDesignedAntidote(true);
+ GameState.setScoringBuiltAntidote();
+ break;
+ case kW03SouthCreateAntidote:
+ setCurrentActivation(kActivationSynthesizerLooping);
+ loopExtraSequence(kW03SouthAntidoteLoop);
+ break;
+ case kW03SouthDeactivate:
+ setCurrentActivation(kActivateHotSpotAlways);
+ break;
+ case kWSC07SouthMap:
+ case kWSC56SouthMap:
+ setCurrentActivation(kActivateHotSpotAlways);
+ GameState.setScoringSawWSCDirectory();
+ break;
+ case kNerdAtTheDoor1:
+ GameState.setWSCSeenNerd(true);
+ break;
+ case kNerdAtTheDoor2:
+ die(kDeathArrestedInWSC);
+ break;
+ case kW61Brochure:
+ GameState.setScoringSawBrochure();
+ loadAmbientLoops();
+ break;
+ case kW61SouthSmartAlloysWithGun:
+ case kW61SouthSmartAlloysNoGun:
+ GameState.setScoringSawSinclairEntry1();
+ break;
+ case kW61SouthMorphingWithGun:
+ case kW61SouthMorphingNoGun:
+ GameState.setScoringSawSinclairEntry2();
+ break;
+ case kW61SouthTimeBendingWithGun:
+ case kW61SouthTimeBendingNoGun:
+ GameState.setScoringSawSinclairEntry3();
+ break;
+ case kW61MessagesOn:
+ GameState.setWSCOfficeMessagesOpen(true);
+ setCurrentActivation(kActivationW61MessagesOn);
+ break;
+ case kW61MessagesOff:
+ GameState.setWSCOfficeMessagesOpen(false);
+ setCurrentActivation(kActivationW61MessagesOff);
+ if (_cachedZoomSpot) {
+ zoomTo(_cachedZoomSpot);
+ _cachedZoomSpot = 0;
+ }
+ break;
+ case kW61SouthScreenOnWithGun:
+ case kW61SouthScreenOnNoGun:
+ _privateFlags.setFlag(kWSCPrivateOfficeLogOpenFlag, true);
+ setCurrentActivation(kActivationW61SouthOn);
+ break;
+ case kW61SouthScreenOffWithGun:
+ case kW61SouthScreenOffNoGun:
+ _privateFlags.setFlag(kWSCPrivateOfficeLogOpenFlag, false);
+ setCurrentActivation(kActivationW61SouthOff);
+ if (_cachedZoomSpot) {
+ zoomTo(_cachedZoomSpot);
+ _cachedZoomSpot = 0;
+ }
+ break;
+ case kW62ZoomOutFromRobot:
+ // Handle action queue before starting new movie sequences.
+ Neighborhood::receiveNotification(notification, flags);
+ _energyDrainRate = g_energyMonitor->getEnergyDrainRate();
+ g_energyMonitor->setEnergyDrainRate(0);
+ currentEnergy = g_energyMonitor->getCurrentEnergy();
+ _vm->setEnergyDeathReason(kDeathHitByPlasma);
+
+ if (GameState.getShieldOn())
+ currentEnergy -= kPlasmaEnergyWithShield;
+ else
+ currentEnergy -= kPlasmaEnergyNoShield;
+
+ if (currentEnergy <= 0)
+ startExtraSequence(kW62PlasmaDodgeDie, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kW62PlasmaDodgeSurvive, kExtraCompletedFlag, kFilterNoInput);
+
+ scheduleEvent(kPlasmaImpactTime, kOneTickPerSecond, kTimerEventPlasmaHit);
+ break;
+ case kW62PlasmaDodgeDie:
+ g_energyMonitor->setEnergyValue(0);
+ break;
+ case kW62PlasmaDodgeSurvive:
+ if (GameState.getShieldOn()) {
+ g_shield->setItemState(kShieldNormal);
+ g_energyMonitor->drainEnergy(kPlasmaEnergyWithShield);
+ } else {
+ g_energyMonitor->drainEnergy(kPlasmaEnergyNoShield);
+ }
+
+ g_energyMonitor->setEnergyDrainRate(_energyDrainRate);
+ g_AIArea->unlockAI();
+ GameState.setScoringFinishedPlasmaDodge();
+ GameState.setWSCDidPlasmaDodge(true);
+ restoreStriding(kWSC58, kSouth, kAltWSCNormal);
+ loadAmbientLoops();
+ break;
+ case kW0ZSpottedByWomen:
+ die(kDeathArrestedInWSC);
+ break;
+ case kW17WestPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt17WestFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt17WestFlag, false);
+ break;
+ case kW21SouthPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt21SouthFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt21SouthFlag, true);
+ break;
+ case kW24SouthPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt24SouthFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt24SouthFlag, true);
+ break;
+ case kW34EastPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt34EastFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt34EastFlag, true);
+ break;
+ case kW36WestPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt36WestFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt36WestFlag, true);
+ break;
+ case kW38NorthPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt38NorthFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt38NorthFlag, true);
+ break;
+ case kW46SouthPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt46SouthFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt46SouthFlag, true);
+ break;
+ case kW49NorthPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt49NorthFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt49NorthFlag, false);
+ break;
+ case kW73WestPeopleCrossing:
+ _privateFlags.setFlag(kWSCPrivateSeenPeopleAt73WestFlag, true);
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt73WestFlag, false);
+ break;
+ case kW95RobotShoots:
+ case kW98RobotShoots:
+ die(kDeathShotOnCatwalk);
+ break;
+ case kW98MorphsToRobot:
+ if (_argonSprite) {
+ delete _argonSprite; _argonSprite = 0;
+ startExtraSequence(kW98RobotGassed, kExtraCompletedFlag, kFilterNoInput);
+ } else if (_privateFlags.getFlag(kWSCPrivateClickedCatwalkCableFlag)) {
+ startExtraSequence(kW98RobotShocked, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ startExtraSequence(kW98RobotShoots, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kW98RobotShocked:
+ GameState.setWSCCatwalkDark(true);
+ // Change the gun hot spot...
+ _vm->getAllHotspots().setHotspotRect(kW98StunGunSpotID, Common::Rect(181 + kNavAreaLeft, 99 + kNavAreaTop,
+ 372 + kNavAreaLeft, 149 + kNavAreaTop));
+ setCurrentActivation(kActivationRobotDead);
+ GameState.setWSCRobotDead(true);
+ GameState.setScoringStoppedWSCRobot();
+
+ // Video is not present
+ //g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/WSC/XN59WD", false, kWarningInterruption);
+ break;
+ case kW98RobotGassed:
+ item = (Item *)_vm->getAllItems().findItemByID(kArgonCanister);
+ _vm->addItemToInventory((InventoryItem *)item);
+ setCurrentActivation(kActivationRobotDead);
+ GameState.setWSCRobotDead(true);
+ GameState.setScoringStoppedWSCRobot();
+
+ // Video is not present
+ //g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/WSC/XN59WD", false, kWarningInterruption);
+ break;
+ case kW98RobotHeadOpensLight:
+ case kW98RobotHeadOpensDark:
+ setCurrentActivation(kActivationWSCRobotHeadOpen);
+ _privateFlags.setFlag(kWSCPrivateRobotHeadOpenFlag, true);
+ break;
+ case kW98RobotHeadClosesDark:
+ case kW98RobotHeadClosesLight:
+ setCurrentActivation(kActivationRobotGone);
+ _privateFlags.setFlag(kWSCPrivateRobotHeadOpenFlag, false);
+ GameState.setWSCRobotGone(true);
+ break;
+ }
+ }
+
+ Neighborhood::receiveNotification(notification, flags);
+ g_AIArea->checkMiddleArea();
+}
+
+void WSC::timerExpired(const uint32 event) {
+ switch (event) {
+ case kTimerEventPlasmaHit:
+ if (GameState.getShieldOn())
+ g_shield->setItemState(kShieldPlasma);
+ break;
+ case kTimerEventPlayerGawkingAtRobot:
+ startExtraSequence(kW95RobotShoots, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kTimerEventPlayerGawkingAtRobot2:
+ startExtraSequence(kW98MorphsToRobot, kExtraCompletedFlag, kFilterAllInput);
+ break;
+ }
+}
+
+void WSC::setUpMoleculeGame() {
+ _privateFlags.setFlag(kWSCPrivateInMoleculeGameFlag, true);
+ setCurrentActivation(kActivationW03NorthInGame);
+ initOneMovie(&_moleculesMovie, "Images/World Science Center/Molecules.movie",
+ kWSCMoleculesMovieOrder, kMoleculesMovieLeft, kMoleculesMovieTop, true);
+ _moleculesMovie.redrawMovieWorld();
+ _moleculeBin.initMoleculeBin();
+ _moleculeGameLevel = 0;
+ nextMoleculeGameLevel();
+}
+
+void WSC::nextMoleculeGameLevel() {
+ _moleculeGameLevel++;
+
+ for (byte i = 0; i < 6; ++i)
+ _levelArray[i] = i;
+
+ _vm->shuffleArray((int32 *)_levelArray, 6);
+ _moleculeBin.setBinLayout(_levelArray);
+ startMoleculeGameLevel();
+}
+
+void WSC::startMoleculeGameLevel() {
+ _moleculeBin.resetBin();
+ _numCorrect = 0;
+ _moleculesMovie.stop();
+ _moleculesMovie.setFlags(0);
+ _moleculesMovie.setSegment(s_moleculeLoopTimes[0], s_moleculeLoopTimes[0] + kMoleculeLoopTime);
+ _moleculesMovie.setTime(s_moleculeLoopTimes[0]);
+ _moleculesMovie.setFlags(kLoopTimeBase);
+ _moleculesMovie.show();
+
+ switch (_moleculeGameLevel) {
+ case 1:
+ playSpotSoundSync(kWSCMolecule1In, kWSCMolecule1Out);
+ break;
+ case 2:
+ playSpotSoundSync(kWSCMolecule2In, kWSCMolecule2Out);
+ break;
+ case 3:
+ playSpotSoundSync(kWSCMolecule3In, kWSCMolecule3Out);
+ break;
+ }
+
+ _moleculesMovie.start();
+}
+
+void WSC::moleculeGameClick(const HotSpotID id) {
+ uint32 molecule = id - kWSC03NorthMolecule1SpotID;
+
+ _moleculeBin.highlightMolecule(molecule);
+ _moleculeBin.selectMolecule(molecule);
+
+ if (molecule == _levelArray[_numCorrect]) {
+ playSpotSoundSync(kWSCClick2In, kWSCClick2Out);
+ _numCorrect++;
+ _moleculesMovie.stop();
+ _moleculesMovie.setFlags(0);
+
+ TimeValue time = _moleculesMovie.getTime();
+ _moleculesMovie.setSegment(s_moleculeLoopTimes[_numCorrect], s_moleculeLoopTimes[_numCorrect] + kMoleculeLoopTime);
+ _moleculesMovie.setTime(s_moleculeLoopTimes[_numCorrect] + time - s_moleculeLoopTimes[_numCorrect - 1]);
+
+ if (_numCorrect == 6) {
+ _moleculesMovie.start();
+
+ while (_moleculesMovie.isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _moleculesMovie.stop();
+ _moleculesMovie.hide();
+
+ switch (_moleculeGameLevel) {
+ case 1:
+ startExtraSequence(kW03NorthPrepMolecule2, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 2:
+ startExtraSequence(kW03NorthPrepMolecule3, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case 3:
+ _moleculesMovie.releaseMovie();
+ _moleculeBin.cleanUpMoleculeBin();
+ requestExtraSequence(kW03NorthFinishSynthesis, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ }
+ } else {
+ _moleculesMovie.setFlags(kLoopTimeBase);
+ _moleculesMovie.start();
+ }
+ } else {
+ // FAIL
+ playSpotSoundSync(kWSCClick3In, kWSCClick3Out);
+
+ _moleculesMovie.stop();
+ _moleculesMovie.setFlags(0);
+ _moleculesMovie.start();
+
+ while (_moleculesMovie.isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _moleculesMovie.stop();
+ _moleculesMovie.setFlags(0);
+ _moleculesMovie.setSegment(s_moleculeFailTimes[_numCorrect], s_moleculeFailTimes[_numCorrect] + kMoleculeFailTime);
+ _moleculesMovie.setTime(s_moleculeFailTimes[_numCorrect]);
+ _moleculesMovie.start();
+
+
+ while (_moleculesMovie.isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _moleculesMovie.stop();
+ startMoleculeGameLevel();
+ }
+}
+
+void WSC::activateOneHotspot(HotspotInfoTable::Entry &entry, Hotspot *hotspot) {
+ Neighborhood::activateOneHotspot(entry, hotspot);
+
+ Item *argonCanister;
+
+ switch (hotspot->getObjectID()) {
+ case kWSCTurnOnAnalyzerSpotID:
+ if (GameState.getWSCAnalyzerOn())
+ hotspot->setInactive();
+ break;
+ case kWSC02SouthTakeArgonSpotID:
+ if (!GameState.getWSCSawMorph() || GameState.isTakenItemID(kArgonCanister))
+ hotspot->setInactive();
+ break;
+ case kWSC02ActivateMorphScreenSpotID:
+ if (GameState.getWSCSawMorph())
+ hotspot->setInactive();
+ break;
+ case kWSC03NorthMolecule1SpotID:
+ case kWSC03NorthMolecule2SpotID:
+ case kWSC03NorthMolecule3SpotID:
+ case kWSC03NorthMolecule4SpotID:
+ case kWSC03NorthMolecule5SpotID:
+ case kWSC03NorthMolecule6SpotID:
+ if (_moleculeBin.isMoleculeHighlighted(hotspot->getObjectID() - kWSC03NorthMolecule1SpotID))
+ hotspot->setInactive();
+ break;
+ case kWSC03SouthPickUpAntidoteSpotID:
+ if (getCurrentActivation() == kActivationSynthesizerLooping)
+ hotspot->setActive();
+ break;
+ case kW98DropArgonSpotID:
+ argonCanister = _vm->getAllItems().findItemByID(kArgonCanister);
+ if (argonCanister->getItemState() != kArgonFull)
+ hotspot->setInactive();
+ break;
+ }
+}
+
+void WSC::activateHotspots() {
+ Neighborhood::activateHotspots();
+
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kWSC98, kWest) && _privateFlags.getFlag(kWSCPrivateRobotHeadOpenFlag)) {
+ if (_privateFlags.getFlag(kWSCPrivateGotRetScanChipFlag))
+ _vm->getAllHotspots().deactivateOneHotspot(kW98RetinalChipSpotID);
+ else
+ _vm->getAllHotspots().activateOneHotspot(kW98RetinalChipSpotID);
+
+ if (_privateFlags.getFlag(kWSCPrivateGotMapChipFlag))
+ _vm->getAllHotspots().deactivateOneHotspot(kW98MapChipSpotID);
+ else
+ _vm->getAllHotspots().activateOneHotspot(kW98MapChipSpotID);
+
+ if (_privateFlags.getFlag(kWSCPrivateGotOpticalChipFlag))
+ _vm->getAllHotspots().deactivateOneHotspot(kW98OpticalChipSpotID);
+ else
+ _vm->getAllHotspots().activateOneHotspot(kW98OpticalChipSpotID);
+ }
+}
+
+void WSC::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ if (JMPPPInput::isEasterEggModifierInput(input))
+ GameState.setEasterEgg(true);
+
+ if (clickedSpot) {
+ switch (clickedSpot->getObjectID()) {
+ case kWSCAnalyzerScreenSpotID:
+ requestExtraSequence(kWSCAnalyzeDart, kExtraCompletedFlag, kFilterNoInput);
+ requestExtraSequence(kWSCZoomOutFromAnalyzer, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kWSC02SouthPlayMessagesSpotID:
+ if (GameState.isTakenItemID(kNitrogenCanister)) {
+ if (_lastExtra == (uint32)kMessagesMovedToOfficeNoNitrogen)
+ startExtraSequence(kMessagesOffNoNitrogen, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMessagesMovedToOfficeNoNitrogen, kExtraCompletedFlag, kFilterNoInput);
+ } else {
+ if (_lastExtra == (uint32)kMessagesMovedToOffice)
+ startExtraSequence(kMessagesOff, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kMessagesMovedToOffice, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kWSC02SouthInterruptMorphSpotID:
+ _privateFlags.setFlag(kWSCPrivateInterruptedMorphFlag, true);
+ break;
+ case kWSC02SouthMorphFinishedSpotID:
+ requestExtraSequence(kWSC02MorphFinished, 0, kFilterNoInput);
+ requestExtraSequence(kWSC02TurnOffMorphScreen, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kWSC03NorthMolecule1SpotID:
+ case kWSC03NorthMolecule2SpotID:
+ case kWSC03NorthMolecule3SpotID:
+ case kWSC03NorthMolecule4SpotID:
+ case kWSC03NorthMolecule5SpotID:
+ case kWSC03NorthMolecule6SpotID:
+ moleculeGameClick(clickedSpot->getObjectID());
+ break;
+ case kW98GrabCableSpotID:
+ if (isEventTimerRunning()) {
+ cancelEvent();
+ startExtraSequence(kW98MorphsToRobot, kExtraCompletedFlag, kFilterAllInput);
+ }
+
+ _privateFlags.setFlag(kWSCPrivateClickedCatwalkCableFlag, true);
+ break;
+ default:
+ Neighborhood::clickInHotspot(input, clickedSpot);
+ break;
+ }
+ } else {
+ Neighborhood::clickInHotspot(input, clickedSpot);
+ }
+
+ GameState.setEasterEgg(false);
+}
+
+void WSC::dropItemIntoRoom(Item *item, Hotspot *dropSpot) {
+ CoordType h, v;
+
+ switch (item->getObjectID()) {
+ case kPoisonDart:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ GameState.setWSCDartInAnalyzer(true);
+ if (dropSpot && dropSpot->getObjectID() == kWSCDropDartSpotID) {
+ if (!GameState.getWSCAnalyzerOn())
+ requestExtraSequence(kWSCAnalyzerPowerUpWithDart, kExtraCompletedFlag, kFilterNoInput);
+
+ requestExtraSequence(kWSCDropDartIntoAnalyzer, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kAntidote:
+ _privateFlags.setFlag(kWSCDraggingAntidoteFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ loopExtraSequence(kW03SouthAntidoteLoop);
+ break;
+ case kSinclairKey:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ _privateFlags.setFlag(kWSCPrivateSinclairOfficeOpenFlag, true);
+ openDoor();
+ break;
+ case kCrowbar:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ _privateFlags.setFlag(kWSCPrivate58SouthOpenFlag, true);
+ openDoor();
+ break;
+ case kMachineGun:
+ setCurrentAlternate(kAltWSCNormal);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ case kArgonCanister:
+ item->setItemState(kArgonEmpty);
+ _argonSprite = item->getDragSprite(0);
+ _argonSprite->setCurrentFrameIndex(1);
+ _argonSprite->setDisplayOrder(kDragSpriteOrder);
+ dropSpot->getCenter(h, v);
+ _argonSprite->centerElementAt(h, v);
+ _argonSprite->startDisplaying();
+ _argonSprite->show();
+
+ if (isEventTimerRunning()) {
+ cancelEvent();
+ startExtraSequence(kW98MorphsToRobot, kExtraCompletedFlag, kFilterAllInput);
+ }
+ break;
+ case kRetinalScanBiochip:
+ _privateFlags.setFlag(kWSCPrivateGotRetScanChipFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ case kMapBiochip:
+ _privateFlags.setFlag(kWSCPrivateGotMapChipFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ case kOpticalBiochip:
+ _privateFlags.setFlag(kWSCPrivateGotOpticalChipFlag, false);
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ default:
+ Neighborhood::dropItemIntoRoom(item, dropSpot);
+ break;
+ }
+}
+
+void WSC::takeItemFromRoom(Item *item) {
+ switch (item->getObjectID()) {
+ case kAntidote:
+ _privateFlags.setFlag(kWSCDraggingAntidoteFlag, true);
+ Neighborhood::takeItemFromRoom(item);
+ break;
+ case kMachineGun:
+ setCurrentAlternate(kAltWSCTookMachineGun);
+ Neighborhood::takeItemFromRoom(item);
+ break;
+ case kRetinalScanBiochip:
+ _privateFlags.setFlag(kWSCPrivateGotRetScanChipFlag, true);
+ Neighborhood::takeItemFromRoom(item);
+ break;
+ case kMapBiochip:
+ _privateFlags.setFlag(kWSCPrivateGotMapChipFlag, true);
+ Neighborhood::takeItemFromRoom(item);
+ break;
+ case kOpticalBiochip:
+ _privateFlags.setFlag(kWSCPrivateGotOpticalChipFlag, true);
+ Neighborhood::takeItemFromRoom(item);
+ break;
+ default:
+ Neighborhood::takeItemFromRoom(item);
+ break;
+ }
+}
+
+Hotspot *WSC::getItemScreenSpot(Item *item, DisplayElement *element) {
+ HotSpotID destSpotID;
+
+ switch (item->getObjectID()) {
+ case kNitrogenCanister:
+ destSpotID = kWSC02SouthTakeNitrogenSpotID;
+ break;
+ case kArgonPickup:
+ destSpotID = kWSC02SouthTakeArgonSpotID;
+ break;
+ case kAntidote:
+ destSpotID = kWSC03SouthPickUpAntidoteSpotID;
+ break;
+ case kMachineGun:
+ destSpotID = kW61SouthMachineGunSpotID;
+ break;
+ case kRetinalScanBiochip:
+ destSpotID = kW98RetinalChipSpotID;
+ break;
+ case kMapBiochip:
+ destSpotID = kW98MapChipSpotID;
+ break;
+ case kOpticalBiochip:
+ destSpotID = kW98OpticalChipSpotID;
+ break;
+ default:
+ destSpotID = kNoHotSpotID;
+ break;
+ }
+
+ if (destSpotID == kNoHotSpotID)
+ return Neighborhood::getItemScreenSpot(item, element);
+
+ return _vm->getAllHotspots().findHotspotByID(destSpotID);
+}
+
+void WSC::pickedUpItem(Item *item) {
+ switch (item->getObjectID()) {
+ case kAntidote:
+ if (!GameState.getWSCPickedUpAntidote()) {
+ GameState.setWSCPoisoned(false);
+ GameState.setWSCRemovedDart(false);
+ GameState.setWSCPickedUpAntidote(true);
+ _privateFlags.setFlag(kWSCDraggingAntidoteFlag, false);
+ playSpotSoundSync(kDrinkAntidoteIn, kDrinkAntidoteOut);
+ setUpPoison();
+ startExtraSequence(kW03SouthDeactivate, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kArgonPickup:
+ _vm->removeItemFromInventory((InventoryItem *)item);
+ item = (Item *)_vm->getAllItems().findItemByID(kArgonCanister);
+ _vm->addItemToInventory((InventoryItem *)item);
+ item = (Item *)_vm->getAllItems().findItemByID(kSinclairKey);
+ _vm->addItemToInventory((InventoryItem *)item);
+ _vm->getAllHotspots().setHotspotRect(kWSC02SouthMorphOutSpotID,
+ Common::Rect(kNavAreaLeft, kNavAreaTop, 512 + kNavAreaLeft, 256 + kNavAreaTop));
+ break;
+ case kArgonCanister:
+ GameState.setScoringGotArgonCanister();
+ break;
+ case kSinclairKey:
+ GameState.setScoringGotSinclairKey();
+ break;
+ case kNitrogenCanister:
+ GameState.setScoringGotNitrogenCanister();
+ break;
+ case kRetinalScanBiochip:
+ if (_privateFlags.getFlag(kWSCPrivateGotMapChipFlag) && _privateFlags.getFlag(kWSCPrivateGotOpticalChipFlag)) {
+ if (GameState.getWSCCatwalkDark())
+ startExtraSequence(kW98RobotHeadClosesDark, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kW98RobotHeadClosesLight, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kMapBiochip:
+ if (_privateFlags.getFlag(kWSCPrivateGotRetScanChipFlag) && _privateFlags.getFlag(kWSCPrivateGotOpticalChipFlag)) {
+ if (GameState.getWSCCatwalkDark())
+ startExtraSequence(kW98RobotHeadClosesDark, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kW98RobotHeadClosesLight, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kOpticalBiochip:
+ g_opticalChip->addMercury();
+ GameState.setScoringGotWSCOpMemChip();
+ if (_privateFlags.getFlag(kWSCPrivateGotRetScanChipFlag) && _privateFlags.getFlag(kWSCPrivateGotMapChipFlag)) {
+ if (GameState.getWSCCatwalkDark())
+ startExtraSequence(kW98RobotHeadClosesDark, kExtraCompletedFlag, kFilterNoInput);
+ else
+ startExtraSequence(kW98RobotHeadClosesLight, kExtraCompletedFlag, kFilterNoInput);
+ }
+ break;
+ case kStunGun:
+ GameState.setWSCFinished(true);
+
+ if (!GameState.getWSCCatwalkDark())
+ GameState.setScoringWSCGandhi();
+
+ recallToTSASuccess();
+ break;
+ }
+}
+
+void WSC::checkPeopleCrossing() {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kWSC17, kWest):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt17WestFlag))
+ startExtraSequence(kW17WestPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC21, kSouth):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt21SouthFlag))
+ startExtraSequence(kW21SouthPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC24, kSouth):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt24SouthFlag))
+ startExtraSequence(kW24SouthPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC34, kEast):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt34EastFlag))
+ startExtraSequence(kW34EastPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC36, kWest):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt36WestFlag))
+ startExtraSequence(kW36WestPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC38, kNorth):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt38NorthFlag))
+ startExtraSequence(kW38NorthPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC46, kSouth):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt46SouthFlag))
+ startExtraSequence(kW46SouthPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC49, kNorth):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt49NorthFlag))
+ startExtraSequence(kW49NorthPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case MakeRoomView(kWSC73, kWest):
+ if (_privateFlags.getFlag(kWSCPrivateNeedPeopleAt73WestFlag))
+ startExtraSequence(kW73WestPeopleCrossing, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ default:
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt21SouthFlag) && _vm->getRandomNumber(2) == 0) {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt21SouthFlag, true);
+ forceStridingStop(kWSC18, kSouth, kAltWSCNormal);
+ } else {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt21SouthFlag, false);
+ restoreStriding(kWSC18, kSouth, kAltWSCNormal);
+ }
+
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt19NorthFlag) && _vm->getRandomNumber(2) == 0) {
+ forceStridingStop(kWSC22, kNorth, kAltWSCNormal);
+ } else {
+ restoreStriding(kWSC22, kNorth, kAltWSCNormal);
+ }
+
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt24SouthFlag) && _vm->getRandomNumber(2) == 0) {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt24SouthFlag, true);
+ forceStridingStop(kWSC22, kSouth, kAltWSCNormal);
+ } else {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt24SouthFlag, false);
+ restoreStriding(kWSC22, kSouth, kAltWSCNormal);
+ }
+
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt34EastFlag) && _vm->getRandomNumber(2) == 0) {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt34EastFlag, true);
+ forceStridingStop(kWSC28, kEast, kAltWSCNormal);
+ } else {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt34EastFlag, false);
+ restoreStriding(kWSC28, kEast, kAltWSCNormal);
+ }
+
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt36WestFlag) && _vm->getRandomNumber(2) == 0) {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt36WestFlag, true);
+ forceStridingStop(kWSC40, kWest, kAltWSCNormal);
+ } else {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt36WestFlag, false);
+ restoreStriding(kWSC40, kWest, kAltWSCNormal);
+ }
+
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt38NorthFlag) && _vm->getRandomNumber(2) == 0) {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt38NorthFlag, true);
+ forceStridingStop(kWSC42, kNorth, kAltWSCNormal);
+ } else {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt38NorthFlag, false);
+ restoreStriding(kWSC42, kNorth, kAltWSCNormal);
+ }
+
+ if (!_privateFlags.getFlag(kWSCPrivateSeenPeopleAt46SouthFlag) && _vm->getRandomNumber(2) == 0) {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt46SouthFlag, true);
+ forceStridingStop(kWSC44, kSouth, kAltWSCNormal);
+ } else {
+ _privateFlags.setFlag(kWSCPrivateNeedPeopleAt46SouthFlag, false);
+ restoreStriding(kWSC44, kSouth, kAltWSCNormal);
+ }
+ break;
+ }
+}
+
+void WSC::setUpPoison() {
+ if (GameState.getWSCPoisoned()) {
+ if (GameState.getWSCRemovedDart()) {
+ if (g_energyMonitor->getEnergyDrainRate() != kWSCPoisonEnergyDrainNoDart) {
+ g_energyMonitor->setEnergyDrainRate(kWSCPoisonEnergyDrainNoDart);
+ _vm->setEnergyDeathReason(kDeathDidntStopPoison);
+ }
+ } else {
+ if (g_energyMonitor->getEnergyDrainRate() != kWSCPoisonEnergyDrainWithDart) {
+ g_energyMonitor->setEnergyDrainRate(kWSCPoisonEnergyDrainWithDart);
+ _vm->setEnergyDeathReason(kDeathDidntStopPoison);
+ }
+ }
+ } else if (g_energyMonitor->getEnergyDrainRate() != kEnergyDrainNormal) {
+ g_energyMonitor->setEnergyDrainRate(kEnergyDrainNormal);
+ _vm->resetEnergyDeathReason();
+ }
+}
+
+bool WSC::inSynthesizerGame() {
+ return _moleculesMovie.isMovieValid();
+}
+
+bool WSC::canSolve() {
+ return (inSynthesizerGame() || (GameState.getCurrentRoom() == kWSC98 && !GameState.getWSCRobotDead()));
+}
+
+void WSC::doSolve() {
+ if (inSynthesizerGame()) {
+ _moleculesMovie.releaseMovie();
+ _moleculeBin.cleanUpMoleculeBin();
+ requestExtraSequence(kW03NorthFinishSynthesis, kExtraCompletedFlag, kFilterNoInput);
+ } else if (GameState.getCurrentRoom() == kWSC98 && !GameState.getWSCRobotDead()) {
+ cancelEvent();
+ startExtraSequence(kW98RobotShocked, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+Common::String WSC::getNavMovieName() {
+ return "Images/World Science Center/WSC.movie";
+}
+
+Common::String WSC::getSoundSpotsName() {
+ return "Sounds/World Science Center/WSC Spots";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/wsc/wsc.h b/engines/pegasus/neighborhood/wsc/wsc.h
new file mode 100644
index 0000000000..d9634b3539
--- /dev/null
+++ b/engines/pegasus/neighborhood/wsc/wsc.h
@@ -0,0 +1,166 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_WSC_WSC_H
+#define PEGASUS_NEIGHBORHOOD_WSC_WSC_H
+
+#include "pegasus/neighborhood/neighborhood.h"
+#include "pegasus/neighborhood/wsc/moleculebin.h"
+
+namespace Pegasus {
+
+static const DisplayOrder kWSCMoleculeBinOrder = kMonitorLayer;
+static const DisplayOrder kWSCMoleculesMovieOrder = kWSCMoleculeBinOrder + 1;
+
+static const RoomID kWSC01 = 0;
+static const RoomID kWSC02Morph = 2;
+static const RoomID kWSC02Messages = 3;
+static const RoomID kWSC62 = 62;
+
+class WSC : public Neighborhood {
+public:
+ WSC(InputHandler *, PegasusEngine *);
+ virtual ~WSC() {}
+
+ void flushGameState();
+
+ virtual uint16 getDateResID() const;
+
+ bool okayToJump();
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ bool inSynthesizerGame();
+
+ bool canSolve();
+ void doSolve();
+
+ virtual void prepareForAIHint(const Common::String &);
+ virtual void cleanUpAfterAIHint(const Common::String &);
+
+ void init();
+ void start();
+
+protected:
+ enum {
+ kWSCDraggingAntidoteFlag,
+
+ kWSCPrivateLabMessagesOpenFlag,
+ kWSCPrivateInterruptedMorphFlag,
+ kWSCPrivateInMoleculeGameFlag,
+ kWSCPrivateSinclairOfficeOpenFlag,
+ kWSCPrivateOfficeLogOpenFlag,
+ kWSCPrivate58SouthOpenFlag,
+ kWSCPrivateClickedCatwalkCableFlag,
+ kWSCPrivateRobotHeadOpenFlag,
+
+ kWSCPrivateSeenPeopleAt17WestFlag,
+ kWSCPrivateSeenPeopleAt19NorthFlag,
+ kWSCPrivateSeenPeopleAt21SouthFlag,
+ kWSCPrivateSeenPeopleAt24SouthFlag,
+ kWSCPrivateSeenPeopleAt34EastFlag,
+ kWSCPrivateSeenPeopleAt36WestFlag,
+ kWSCPrivateSeenPeopleAt38NorthFlag,
+ kWSCPrivateSeenPeopleAt46SouthFlag,
+ kWSCPrivateSeenPeopleAt49NorthFlag,
+ kWSCPrivateSeenPeopleAt73WestFlag,
+
+ kWSCPrivateNeedPeopleAt17WestFlag,
+ kWSCPrivateNeedPeopleAt21SouthFlag,
+ kWSCPrivateNeedPeopleAt24SouthFlag,
+ kWSCPrivateNeedPeopleAt34EastFlag,
+ kWSCPrivateNeedPeopleAt36WestFlag,
+ kWSCPrivateNeedPeopleAt38NorthFlag,
+ kWSCPrivateNeedPeopleAt46SouthFlag,
+ kWSCPrivateNeedPeopleAt49NorthFlag,
+ kWSCPrivateNeedPeopleAt73WestFlag,
+
+ kWSCPrivateGotRetScanChipFlag,
+ kWSCPrivateGotMapChipFlag,
+ kWSCPrivateGotOpticalChipFlag,
+
+ kNumWSCPrivateFlags
+ };
+
+ void arriveAt(const RoomID, const DirectionConstant);
+ void turnTo(const DirectionConstant);
+ void receiveNotification(Notification *, const NotificationFlags);
+ void dropItemIntoRoom(Item *, Hotspot *);
+ void clickInHotspot(const Input &, const Hotspot *);
+ TimeValue getViewTime(const RoomID, const DirectionConstant);
+ void getZoomEntry(const HotSpotID, ZoomTable::Entry &);
+ CanMoveForwardReason canMoveForward(ExitTable::Entry &entry);
+ void cantMoveThatWay(CanMoveForwardReason reason);
+ CanTurnReason canTurn(TurnDirection turn, DirectionConstant &nextDir);
+ void zoomTo(const Hotspot *hotspot);
+ void activateOneHotspot(HotspotInfoTable::Entry &, Hotspot *);
+ void setUpMoleculeGame();
+ void nextMoleculeGameLevel();
+ void startMoleculeGameLevel();
+ void moleculeGameClick(const HotSpotID);
+ void loadAmbientLoops();
+ CanOpenDoorReason canOpenDoor(DoorTable::Entry &);
+ void cantOpenDoor(CanOpenDoorReason);
+ void pickedUpItem(Item *);
+ void doorOpened();
+ void startExtraSequence(const ExtraID, const NotificationFlags, const InputBits);
+ void getExtraEntry(const uint32, ExtraTable::Entry &);
+ void takeItemFromRoom(Item *item);
+ void checkPeopleCrossing();
+ void turnLeft();
+ void turnRight();
+ void moveForward();
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+ int16 getStaticCompassAngle(const RoomID, const DirectionConstant);
+ void getExitCompassMove(const ExitTable::Entry &exitEntry, FaderMoveSpec &compassMove);
+ void getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove);
+ void bumpIntoWall();
+ void activateHotspots();
+ void setUpAIRules();
+ Common::String getBriefingMovie();
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+ void setUpPoison();
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+ void timerExpired(const uint32);
+
+ Common::String getSoundSpotsName();
+ Common::String getNavMovieName();
+
+ FlagsArray<byte, kNumWSCPrivateFlags> _privateFlags;
+ const Hotspot *_cachedZoomSpot;
+ MoleculeBin _moleculeBin;
+ int32 _moleculeGameLevel, _numCorrect;
+ Movie _moleculesMovie;
+ uint32 _levelArray[6];
+ Common::Rational _energyDrainRate;
+ Sprite *_argonSprite;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/zoom.cpp b/engines/pegasus/neighborhood/zoom.cpp
new file mode 100644
index 0000000000..478ec6e493
--- /dev/null
+++ b/engines/pegasus/neighborhood/zoom.cpp
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/debug.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+
+#include "pegasus/neighborhood/zoom.h"
+
+namespace Pegasus {
+
+void ZoomTable::loadFromStream(Common::SeekableReadStream *stream) {
+ uint32 count = stream->readUint32BE();
+ _entries.resize(count);
+
+ for (uint32 i = 0; i < count; i++) {
+ _entries[i].hotspot = stream->readUint16BE();
+ _entries[i].movieStart = stream->readUint32BE();
+ _entries[i].movieEnd = stream->readUint32BE();
+ _entries[i].room = stream->readUint16BE();
+ _entries[i].direction = stream->readByte();
+ debug(0, "Zoom[%d]: %d %d %d %d %d", i, _entries[i].hotspot, _entries[i].movieStart,
+ _entries[i].movieEnd, _entries[i].room, _entries[i].direction);
+ stream->readByte(); // alignment
+ }
+}
+
+void ZoomTable::clear() {
+ _entries.clear();
+}
+
+ZoomTable::Entry::Entry() {
+ clear();
+}
+
+void ZoomTable::Entry::clear() {
+ hotspot = kNoHotSpotID;
+ movieStart = 0xffffffff;
+ movieEnd = 0xffffffff;
+ room = kNoRoomID;
+ direction = kNoDirection;
+}
+
+ZoomTable::Entry ZoomTable::findEntry(HotSpotID hotspot) {
+ for (uint32 i = 0; i < _entries.size(); i++)
+ if (_entries[i].hotspot == hotspot)
+ return _entries[i];
+
+ return Entry();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/zoom.h b/engines/pegasus/neighborhood/zoom.h
new file mode 100644
index 0000000000..8bcf8974f8
--- /dev/null
+++ b/engines/pegasus/neighborhood/zoom.h
@@ -0,0 +1,70 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NEIGHBORHOOD_ZOOM_H
+#define PEGASUS_NEIGHBORHOOD_ZOOM_H
+
+#include "common/array.h"
+#include "common/endian.h"
+
+#include "pegasus/constants.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Pegasus {
+
+class ZoomTable {
+public:
+ ZoomTable() {}
+ ~ZoomTable() {}
+
+ static uint32 getResTag() { return MKTAG('Z', 'o', 'o', 'm'); }
+
+ void loadFromStream(Common::SeekableReadStream *stream);
+ void clear();
+
+ struct Entry {
+ Entry();
+ void clear();
+ bool isEmpty() { return movieStart == 0xffffffff; }
+
+ HotSpotID hotspot;
+ TimeValue movieStart;
+ TimeValue movieEnd;
+ RoomID room;
+ DirectionConstant direction;
+ };
+
+ Entry findEntry(HotSpotID hotspot);
+
+private:
+ Common::Array<Entry> _entries;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/notification.cpp b/engines/pegasus/notification.cpp
new file mode 100644
index 0000000000..2d57fcc5e7
--- /dev/null
+++ b/engines/pegasus/notification.cpp
@@ -0,0 +1,149 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/constants.h"
+#include "pegasus/notification.h"
+
+namespace Pegasus {
+
+typedef ReceiverList::iterator ReceiverIterator;
+
+Notification::Notification(const NotificationID id, NotificationManager *owner) : IDObject(id) {
+ _owner = owner;
+ _currentFlags = kNoNotificationFlags;
+ if (_owner)
+ _owner->addNotification(this);
+}
+
+Notification::~Notification() {
+ for (uint i = 0; i < _receivers.size(); i++)
+ _receivers[i].receiver->newNotification(NULL);
+
+ if (_owner)
+ _owner->removeNotification(this);
+}
+
+// Selectively set or clear notificiation bits.
+// Wherever mask is 0, leave existing bits untouched.
+// Wherever mask is 1, set bit equivalent to flags.
+void Notification::notifyMe(NotificationReceiver *receiver, NotificationFlags flags, NotificationFlags mask) {
+ for (uint i = 0; i < _receivers.size(); i++) {
+ if (_receivers[i].receiver == receiver) {
+ _receivers[i].mask = (_receivers[i].mask & ~mask) | (flags & mask);
+ receiver->newNotification(this);
+ return;
+ }
+ }
+
+ ReceiverEntry newEntry;
+ newEntry.receiver = receiver;
+ newEntry.mask = flags;
+ _receivers.push_back(newEntry);
+
+ receiver->newNotification(this);
+}
+
+void Notification::cancelNotification(NotificationReceiver *receiver) {
+ for (uint i = 0; i < _receivers.size(); i++) {
+ if (_receivers[i].receiver == receiver) {
+ _receivers.remove_at(i);
+ i--;
+ }
+ }
+}
+
+void Notification::setNotificationFlags(NotificationFlags flags, NotificationFlags mask) {
+ _currentFlags = (_currentFlags & ~mask) | flags;
+}
+
+void Notification::checkReceivers() {
+ NotificationFlags currentFlags = _currentFlags;
+ _currentFlags = kNoNotificationFlags;
+
+ for (uint i = 0; i < _receivers.size(); i++)
+ if (_receivers[i].mask & currentFlags)
+ _receivers[i].receiver->receiveNotification(this, currentFlags);
+}
+
+// Receiver entries are equal if their receivers are equal.
+
+int operator==(const ReceiverEntry &entry1, const ReceiverEntry &entry2) {
+ return entry1.receiver == entry2.receiver;
+}
+
+int operator!=(const ReceiverEntry &entry1, const ReceiverEntry &entry2) {
+ return entry1.receiver != entry2.receiver;
+}
+
+NotificationReceiver::NotificationReceiver() {
+ _notification = NULL;
+}
+
+NotificationReceiver::~NotificationReceiver() {
+ if (_notification)
+ _notification->cancelNotification(this);
+}
+
+void NotificationReceiver::receiveNotification(Notification *, const NotificationFlags) {
+}
+
+void NotificationReceiver::newNotification(Notification *notification) {
+ _notification = notification;
+}
+
+typedef NotificationList::iterator NotificationIterator;
+
+NotificationManager::NotificationManager() {
+}
+
+NotificationManager::~NotificationManager() {
+ detachNotifications();
+}
+
+void NotificationManager::addNotification(Notification *notification) {
+ _notifications.push_back(notification);
+}
+
+void NotificationManager::removeNotification(Notification *notification) {
+ for (NotificationIterator it = _notifications.begin(); it != _notifications.end();) {
+ if ((*it) == notification)
+ it = _notifications.erase(it);
+ else
+ it++;
+ }
+}
+
+void NotificationManager::detachNotifications() {
+ for (NotificationIterator it = _notifications.begin(); it != _notifications.end(); it++)
+ (*it)->_owner = 0;
+}
+
+void NotificationManager::checkNotifications() {
+ for (NotificationIterator it = _notifications.begin(); it != _notifications.end(); it++)
+ if ((*it)->_currentFlags != kNoNotificationFlags)
+ (*it)->checkReceivers();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/notification.h b/engines/pegasus/notification.h
new file mode 100644
index 0000000000..19b69829be
--- /dev/null
+++ b/engines/pegasus/notification.h
@@ -0,0 +1,123 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_NOTIFICATION_H
+#define PEGASUS_NOTIFICATION_H
+
+#include "common/array.h"
+#include "common/list.h"
+
+#include "pegasus/types.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+class NotificationManager;
+class NotificationReceiver;
+
+struct ReceiverEntry {
+ NotificationReceiver *receiver;
+ NotificationFlags mask;
+};
+
+int operator==(const ReceiverEntry &entry1, const ReceiverEntry &entry2);
+int operator!=(const ReceiverEntry &entry1, const ReceiverEntry &entry2);
+
+typedef Common::Array<ReceiverEntry> ReceiverList;
+
+/*
+ A notification can have 32 flags associated with it, which can be user-defined.
+*/
+
+class Notification : public IDObject {
+friend class NotificationManager;
+
+public:
+ Notification(const NotificationID id, NotificationManager *owner);
+ virtual ~Notification();
+
+ // notifyMe will have this receiver notified when any of the specified notification
+ // flags are set.
+ // If there is already a notification set for this receiver, notifyMe does a bitwise
+ // OR with the receiver's current notification flags.
+
+ // Can selectively set or clear notification bits by using the flags and mask argument.
+
+ void notifyMe(NotificationReceiver*, NotificationFlags flags, NotificationFlags mask);
+ void cancelNotification(NotificationReceiver *receiver);
+
+ void setNotificationFlags(NotificationFlags flags, NotificationFlags mask);
+ NotificationFlags getNotificationFlags() { return _currentFlags; }
+
+ void clearNotificationFlags() { setNotificationFlags(0, ~(NotificationFlags)0); }
+
+protected:
+ void checkReceivers();
+
+ NotificationManager *_owner;
+ ReceiverList _receivers;
+ NotificationFlags _currentFlags;
+};
+
+class NotificationReceiver {
+friend class Notification;
+
+public:
+ NotificationReceiver();
+ virtual ~NotificationReceiver();
+
+protected:
+ // receiveNotification is called automatically whenever a notification that this
+ // receiver depends on has its flags set
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+ virtual void newNotification(Notification *notification);
+
+private:
+ Notification *_notification;
+};
+
+typedef Common::List<Notification *> NotificationList;
+
+class NotificationManager : public NotificationReceiver {
+friend class Notification;
+
+public:
+ NotificationManager();
+ virtual ~NotificationManager();
+
+ void checkNotifications();
+
+protected:
+ void addNotification(Notification *notification);
+ void removeNotification(Notification *notification);
+ void detachNotifications();
+
+ NotificationList _notifications;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
new file mode 100644
index 0000000000..81e8058628
--- /dev/null
+++ b/engines/pegasus/pegasus.cpp
@@ -0,0 +1,2346 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/config-manager.h"
+#include "common/error.h"
+#include "common/events.h"
+#include "common/fs.h"
+#include "common/file.h"
+#include "common/memstream.h"
+#include "common/savefile.h"
+#include "common/textconsole.h"
+#include "common/translation.h"
+#include "common/random.h"
+#include "base/plugins.h"
+#include "base/version.h"
+#include "gui/saveload.h"
+#include "video/qt_decoder.h"
+
+#include "pegasus/console.h"
+#include "pegasus/cursor.h"
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/interface.h"
+#include "pegasus/menu.h"
+#include "pegasus/movie.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/timers.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/itemlist.h"
+#include "pegasus/items/biochips/aichip.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/biochips/mapchip.h"
+#include "pegasus/items/biochips/opticalchip.h"
+#include "pegasus/items/biochips/pegasuschip.h"
+#include "pegasus/items/biochips/retscanchip.h"
+#include "pegasus/items/biochips/shieldchip.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/items/inventory/gascanister.h"
+#include "pegasus/items/inventory/inventoryitem.h"
+#include "pegasus/items/inventory/keycard.h"
+#include "pegasus/neighborhood/neighborhood.h"
+#include "pegasus/neighborhood/caldoria/caldoria.h"
+#include "pegasus/neighborhood/mars/mars.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/alpha/noradalpha.h"
+#include "pegasus/neighborhood/norad/delta/noraddelta.h"
+#include "pegasus/neighborhood/prehistoric/prehistoric.h"
+#include "pegasus/neighborhood/tsa/fulltsa.h"
+#include "pegasus/neighborhood/tsa/tinytsa.h"
+#include "pegasus/neighborhood/wsc/wsc.h"
+
+namespace Pegasus {
+
+PegasusEngine::PegasusEngine(OSystem *syst, const PegasusGameDescription *gamedesc) : Engine(syst), InputHandler(0), _gameDescription(gamedesc),
+ _shellNotification(kJMPDCShellNotificationID, this), _returnHotspot(kInfoReturnSpotID), _itemDragger(this), _bigInfoMovie(kNoDisplayElement),
+ _smallInfoMovie(kNoDisplayElement) {
+ _continuePoint = 0;
+ _saveAllowed = _loadAllowed = true;
+ _saveRequested = _loadRequested = false;
+ _gameMenu = 0;
+ _deathReason = kDeathStranded;
+ _neighborhood = 0;
+ _FXLevel = 0x80;
+ _ambientLevel = 0x80;
+ _gameMode = kNoMode;
+ _switchModesSync = false;
+ _draggingItem = 0;
+ _dragType = kDragNoDrag;
+ _idlerHead = 0;
+ _currentCD = 1;
+ _introTimer = 0;
+ _aiSaveStream = 0;
+}
+
+PegasusEngine::~PegasusEngine() {
+ delete _resFork;
+ delete _console;
+ delete _cursor;
+ delete _continuePoint;
+ delete _gameMenu;
+ delete _neighborhood;
+ delete _rnd;
+ delete _introTimer;
+ delete _aiSaveStream;
+
+ for (ItemIterator it = _allItems.begin(); it != _allItems.end(); it++)
+ delete *it;
+
+ InputDeviceManager::destroy();
+ GameStateManager::destroy();
+
+ // NOTE: This must be deleted last!
+ delete _gfx;
+}
+
+Common::Error PegasusEngine::run() {
+ _console = new PegasusConsole(this);
+ _gfx = new GraphicsManager(this);
+ _resFork = new Common::MacResManager();
+ _cursor = new Cursor();
+ _rnd = new Common::RandomSource("Pegasus");
+
+ if (!_resFork->open("JMP PP Resources") || !_resFork->hasResFork())
+ error("Could not load JMP PP Resources");
+
+ // Initialize items
+ createItems();
+
+ // Initialize cursors
+ _cursor->addCursorFrames(0x80); // Main
+ _cursor->addCursorFrames(900); // Mars Shuttle
+
+ // Initialize the item dragger bounds
+ _itemDragger.setHighlightBounds();
+
+ if (!isDemo() && !detectOpeningClosingDirectory()) {
+ Common::String message = "Missing intro directory. ";
+
+ // Give Mac OS X a more specific message because we can
+#ifdef MACOSX
+ message += "Make sure \"Opening/Closing\" is present.";
+#else
+ message += "Be sure to rename \"Opening/Closing\" to \"Opening_Closing\".";
+#endif
+
+ GUIErrorMessage(message);
+ warning("%s", message.c_str());
+ return Common::kNoGameDataFoundError;
+ }
+
+ // Set up input
+ InputHandler::setInputHandler(this);
+ allowInput(true);
+
+ // Set up inventories
+ _items.setWeightLimit(9);
+ _items.setOwnerID(kPlayerID);
+ _biochips.setWeightLimit(8);
+ _biochips.setOwnerID(kPlayerID);
+
+ _returnHotspot.setArea(Common::Rect(kNavAreaLeft, kNavAreaTop, 512 + kNavAreaLeft, 256 + kNavAreaTop));
+ _returnHotspot.setHotspotFlags(kInfoReturnSpotFlag);
+ _allHotspots.push_back(&_returnHotspot);
+
+ _screenDimmer.setBounds(Common::Rect(0, 0, 640, 480));
+ _screenDimmer.setDisplayOrder(kScreenDimmerOrder);
+
+ // Load from the launcher/cli if requested (and don't show the intro in those cases)
+ bool doIntro = true;
+ if (ConfMan.hasKey("save_slot")) {
+ uint32 gameToLoad = ConfMan.getInt("save_slot");
+ doIntro = (loadGameState(gameToLoad).getCode() != Common::kNoError);
+ }
+
+ _shellNotification.notifyMe(this, kJMPShellNotificationFlags, kJMPShellNotificationFlags);
+
+ if (doIntro)
+ // Start up the first notification
+ _shellNotification.setNotificationFlags(kGameStartingFlag, kGameStartingFlag);
+
+ if (!isDemo()) {
+ _introTimer = new FuseFunction();
+ _introTimer->setFunctor(new Common::Functor0Mem<void, PegasusEngine>(this, &PegasusEngine::introTimerExpired));
+ }
+
+ while (!shouldQuit()) {
+ processShell();
+ _system->delayMillis(10); // Ease off the CPU
+ }
+
+ return Common::kNoError;
+}
+
+bool PegasusEngine::canLoadGameStateCurrently() {
+ return _loadAllowed && !isDemo();
+}
+
+bool PegasusEngine::canSaveGameStateCurrently() {
+ return _saveAllowed && !isDemo() && g_neighborhood;
+}
+
+bool PegasusEngine::detectOpeningClosingDirectory() {
+ // We need to detect what our Opening/Closing directory is listed as
+ // On the original disc, it was 'Opening/Closing' but only HFS(+) supports the slash
+ // Mac OS X will display this as 'Opening:Closing' and we can use that directly
+ // On other systems, users will need to rename to "Opening_Closing"
+
+ Common::FSNode gameDataDir(ConfMan.get("path"));
+ gameDataDir = gameDataDir.getChild("Images");
+
+ if (!gameDataDir.exists())
+ return false;
+
+ Common::FSList fsList;
+ if (!gameDataDir.getChildren(fsList, Common::FSNode::kListDirectoriesOnly, true))
+ return false;
+
+ for (uint i = 0; i < fsList.size() && _introDirectory.empty(); i++) {
+ Common::String name = fsList[i].getName();
+
+ if (name.equalsIgnoreCase("Opening:Closing"))
+ _introDirectory = name;
+ else if (name.equalsIgnoreCase("Opening_Closing"))
+ _introDirectory = name;
+ }
+
+ if (_introDirectory.empty())
+ return false;
+
+ debug(0, "Detected intro location as '%s'", _introDirectory.c_str());
+ _introDirectory = Common::String("Images/") + _introDirectory;
+ return true;
+}
+
+void PegasusEngine::createItems() {
+ Common::SeekableReadStream *res = _resFork->getResource(MKTAG('N', 'I', 't', 'm'), 0x80);
+
+ uint16 entryCount = res->readUint16BE();
+
+ for (uint16 i = 0; i < entryCount; i++) {
+ ItemID itemID = res->readUint16BE();
+ NeighborhoodID neighborhoodID = res->readUint16BE();
+ RoomID roomID = res->readUint16BE();
+ DirectionConstant direction = res->readByte();
+ res->readByte(); // alignment
+
+ createItem(itemID, neighborhoodID, roomID, direction);
+ }
+
+ delete res;
+}
+
+void PegasusEngine::createItem(ItemID itemID, NeighborhoodID neighborhoodID, RoomID roomID, DirectionConstant direction) {
+ switch (itemID) {
+ case kInterfaceBiochip:
+ // Unused in game, but still in the data and we need to create
+ // it because it's saved/loaded from save files.
+ new BiochipItem(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kAIBiochip:
+ new AIChip(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kPegasusBiochip:
+ new PegasusChip(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kOpticalBiochip:
+ new OpticalChip(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kMapBiochip:
+ new MapChip(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kRetinalScanBiochip:
+ new RetScanChip(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kShieldBiochip:
+ new ShieldChip(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kAirMask:
+ new AirMask(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kKeyCard:
+ new KeyCard(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kGasCanister:
+ new GasCanister(itemID, neighborhoodID, roomID, direction);
+ break;
+ default:
+ // Everything else is a normal inventory item
+ new InventoryItem(itemID, neighborhoodID, roomID, direction);
+ break;
+ }
+}
+
+void PegasusEngine::runIntro() {
+ stopIntroTimer();
+
+ bool skipped = false;
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) {
+ video->start();
+
+ while (!shouldQuit() && !video->endOfVideo() && !skipped) {
+ if (video->needsUpdate()) {
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame) {
+ _system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
+ _system->updateScreen();
+ }
+ }
+
+ Input input;
+ InputDevice.getInput(input, kFilterAllInput);
+ if (input.anyInput())
+ skipped = true;
+
+ _system->delayMillis(10);
+ }
+ }
+
+ delete video;
+
+ if (shouldQuit() || skipped)
+ return;
+
+ video = new Video::QuickTimeDecoder();
+
+ if (!video->loadFile(_introDirectory + "/Big Movie.movie"))
+ error("Could not load intro movie");
+
+ video->seek(Audio::Timestamp(0, 10 * 600, 600));
+ video->start();
+
+ playMovieScaled(video, 0, 0);
+
+ delete video;
+}
+
+Common::Error PegasusEngine::showLoadDialog() {
+ GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
+
+ Common::String gameId = ConfMan.get("gameid");
+
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(gameId, &plugin);
+
+ int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+
+ Common::Error result;
+
+ if (slot >= 0) {
+ if (loadGameState(slot).getCode() == Common::kNoError)
+ result = Common::kNoError;
+ else
+ result = Common::kUnknownError;
+ } else {
+ result = Common::kUserCanceled;
+ }
+
+ return result;
+}
+
+Common::Error PegasusEngine::showSaveDialog() {
+ GUI::SaveLoadChooser slc(_("Save game:"), _("Save"), true);
+
+ Common::String gameId = ConfMan.get("gameid");
+
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(gameId, &plugin);
+
+ int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+
+ Common::Error result;
+
+ if (slot >= 0) {
+ if (saveGameState(slot, slc.getResultString()).getCode() == Common::kNoError)
+ result = Common::kNoError;
+ else
+ result = Common::kUnknownError;
+ } else {
+ result = Common::kUserCanceled;
+ }
+
+ return result;
+}
+
+GUI::Debugger *PegasusEngine::getDebugger() {
+ return _console;
+}
+
+void PegasusEngine::addIdler(Idler *idler) {
+ idler->_nextIdler = _idlerHead;
+ if (_idlerHead)
+ _idlerHead->_prevIdler = idler;
+ idler->_prevIdler = 0;
+ _idlerHead = idler;
+}
+
+void PegasusEngine::removeIdler(Idler *idler) {
+ if (idler->_prevIdler)
+ idler->_prevIdler->_nextIdler = idler->_nextIdler;
+ if (idler->_nextIdler)
+ idler->_nextIdler->_prevIdler = idler->_prevIdler;
+ if (idler == _idlerHead)
+ _idlerHead = idler->_nextIdler;
+ idler->_nextIdler = 0;
+ idler->_prevIdler = 0;
+}
+
+void PegasusEngine::giveIdleTime() {
+ for (Idler *idler = _idlerHead; idler != 0; idler = idler->_nextIdler)
+ idler->useIdleTime();
+}
+
+void PegasusEngine::addTimeBase(TimeBase *timeBase) {
+ _timeBases.push_back(timeBase);
+}
+
+void PegasusEngine::removeTimeBase(TimeBase *timeBase) {
+ _timeBases.remove(timeBase);
+}
+
+bool PegasusEngine::loadFromStream(Common::ReadStream *stream) {
+ // Dispose currently running stuff
+ useMenu(0);
+ useNeighborhood(0);
+ removeAllItemsFromInventory();
+ removeAllItemsFromBiochips();
+ _currentItemID = kNoItemID;
+ _currentBiochipID = kNoItemID;
+
+ if (!g_interface)
+ createInterface();
+
+ // Signature
+ uint32 creator = stream->readUint32BE();
+ if (creator != kPegasusPrimeCreator) {
+ warning("Bad save creator '%s'", tag2str(creator));
+ return false;
+ }
+
+ uint32 gameType = stream->readUint32BE();
+ int saveType;
+
+ switch (gameType) {
+ case kPegasusPrimeDisk1GameType:
+ case kPegasusPrimeDisk2GameType:
+ case kPegasusPrimeDisk3GameType:
+ case kPegasusPrimeDisk4GameType:
+ _currentCD = gameType - kPegasusPrimeDisk1GameType + 1;
+ saveType = kNormalSave;
+ break;
+ case kPegasusPrimeContinueType:
+ saveType = kContinueSave;
+ break;
+ default:
+ // There are five other possible game types on the Pippin
+ // version, but hopefully we don't see any of those here
+ warning("Unhandled pegasus game type '%s'", tag2str(gameType));
+ return false;
+ }
+
+ uint32 version = stream->readUint32BE();
+ if (version != kPegasusPrimeVersion) {
+ warning("Where did you get this save? It's a beta (v%04x)!", version & 0x7fff);
+ return false;
+ }
+
+ // Game State
+ GameState.readGameState(stream);
+
+ // Energy
+ setLastEnergyValue(stream->readUint32BE());
+
+ // Death reason
+ setEnergyDeathReason(stream->readByte());
+
+ // Items
+ _allItems.readFromStream(stream);
+
+ // Inventory
+ byte itemCount = stream->readByte();
+
+ if (itemCount > 0) {
+ for (byte i = 0; i < itemCount; i++) {
+ InventoryItem *inv = (InventoryItem *)_allItems.findItemByID((ItemID)stream->readUint16BE());
+ addItemToInventory(inv);
+ }
+
+ g_interface->setCurrentInventoryItemID((ItemID)stream->readUint16BE());
+ }
+
+ // Biochips
+ byte biochipCount = stream->readByte();
+
+ if (biochipCount > 0) {
+ for (byte i = 0; i < biochipCount; i++) {
+ BiochipItem *biochip = (BiochipItem *)_allItems.findItemByID((ItemID)stream->readUint16BE());
+ addItemToBiochips(biochip);
+ }
+
+ g_interface->setCurrentBiochipID((ItemID)stream->readUint16BE());
+ }
+
+
+ // TODO: Disc check
+
+ // Jump to environment
+ jumpToNewEnvironment(GameState.getCurrentNeighborhood(), GameState.getCurrentRoom(), GameState.getCurrentDirection());
+ _shellNotification.setNotificationFlags(0, kNeedNewJumpFlag);
+ performJump(GameState.getCurrentNeighborhood());
+
+ // AI rules
+ if (g_AIArea)
+ g_AIArea->readAIRules(stream);
+
+ startNeighborhood();
+
+ // Make a new continue point if this isn't already one
+ if (saveType == kNormalSave)
+ makeContinuePoint();
+
+ return true;
+}
+
+bool PegasusEngine::writeToStream(Common::WriteStream *stream, int saveType) {
+ // WORKAROUND: If we don't have the interface, we can't actually save.
+ // However, we should still have a continue point, so we will just dump that
+ // out. This is needed for saving a game while in the space chase.
+ if (!g_interface) {
+ // Saving a continue stream from a continue stream should
+ // never happen. In addition, we do need to have a continue
+ // stream for this to work.
+ if (saveType != kNormalSave || !_continuePoint)
+ return false;
+
+ writeContinueStream(stream);
+ return true;
+ }
+
+ if (g_neighborhood)
+ g_neighborhood->flushGameState();
+
+ // Signature
+ stream->writeUint32BE(kPegasusPrimeCreator);
+
+ if (saveType == kNormalSave)
+ stream->writeUint32BE(kPegasusPrimeDisk1GameType + _currentCD - 1);
+ else // Continue
+ stream->writeUint32BE(kPegasusPrimeContinueType);
+
+ stream->writeUint32BE(kPegasusPrimeVersion);
+
+ // Game State
+ GameState.writeGameState(stream);
+
+ // Energy
+ stream->writeUint32BE(getSavedEnergyValue());
+
+ // Death reason
+ stream->writeByte(getEnergyDeathReason());
+
+ // Items
+ _allItems.writeToStream(stream);
+
+ // Inventory
+ byte itemCount = _items.getNumItems();
+ stream->writeByte(itemCount);
+
+ if (itemCount > 0) {
+ for (uint32 i = 0; i < itemCount; i++)
+ stream->writeUint16BE(_items.getItemIDAt(i));
+
+ stream->writeUint16BE(g_interface->getCurrentInventoryItem()->getObjectID());
+ }
+
+ // Biochips
+ byte biochipCount = _biochips.getNumItems();
+ stream->writeByte(biochipCount);
+
+ if (biochipCount > 0) {
+ for (uint32 i = 0; i < biochipCount; i++)
+ stream->writeUint16BE(_biochips.getItemIDAt(i));
+
+ stream->writeUint16BE(g_interface->getCurrentBiochip()->getObjectID());
+ }
+
+ // AI rules
+ if (g_AIArea)
+ g_AIArea->writeAIRules(stream);
+
+ return true;
+}
+
+void PegasusEngine::makeContinuePoint() {
+ // WORKAROUND: Do not attempt to make a continue point if the interface is not set
+ // up. The original did *not* do this and attempting to restore the game using the pause
+ // menu during the canyon/space chase sequence would segfault the game and crash the
+ // system. Nice!
+ if (!g_interface)
+ return;
+
+ delete _continuePoint;
+
+ Common::MemoryWriteStreamDynamic newPoint(DisposeAfterUse::NO);
+ writeToStream(&newPoint, kContinueSave);
+ _continuePoint = new Common::MemoryReadStream(newPoint.getData(), newPoint.size(), DisposeAfterUse::YES);
+}
+
+void PegasusEngine::loadFromContinuePoint() {
+ // Failure to load a continue point is fatal
+
+ if (!_continuePoint)
+ error("Attempting to load from non-existant continue point");
+
+ _continuePoint->seek(0);
+
+ if (!loadFromStream(_continuePoint))
+ error("Failed loading continue point");
+}
+
+void PegasusEngine::writeContinueStream(Common::WriteStream *stream) {
+ // We're going to pretty much copy the stream, except for the save type
+ _continuePoint->seek(0);
+ stream->writeUint32BE(_continuePoint->readUint32BE());
+ _continuePoint->readUint32BE(); // skip the continue type
+ stream->writeUint32BE(kPegasusPrimeDisk1GameType + _currentCD - 1);
+
+ // Now just copy over the rest
+ uint32 size = _continuePoint->size() - _continuePoint->pos();
+ byte *data = new byte[size];
+ _continuePoint->read(data, size);
+ stream->write(data, size);
+ delete[] data;
+}
+
+Common::Error PegasusEngine::loadGameState(int slot) {
+ Common::StringArray filenames = _saveFileMan->listSavefiles("pegasus-*.sav");
+ Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filenames[slot]);
+ if (!loadFile)
+ return Common::kUnknownError;
+
+ bool valid = loadFromStream(loadFile);
+ delete loadFile;
+
+ return valid ? Common::kNoError : Common::kUnknownError;
+}
+
+Common::Error PegasusEngine::saveGameState(int slot, const Common::String &desc) {
+ Common::String output = Common::String::format("pegasus-%s.sav", desc.c_str());
+ Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(output, false);
+ if (!saveFile)
+ return Common::kUnknownError;
+
+ bool valid = writeToStream(saveFile, kNormalSave);
+ delete saveFile;
+
+ return valid ? Common::kNoError : Common::kUnknownError;
+}
+
+void PegasusEngine::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ if (&_shellNotification == notification) {
+ switch (flags) {
+ case kGameStartingFlag: {
+ useMenu(new MainMenu());
+
+ if (!isDemo()) {
+ runIntro();
+ resetIntroTimer();
+ } else {
+ showTempScreen("Images/Demo/NGsplashScrn.pict");
+ }
+
+ if (shouldQuit())
+ return;
+
+ _gfx->invalRect(Common::Rect(0, 0, 640, 480));
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ break;
+ }
+ case kPlayerDiedFlag:
+ doDeath();
+ break;
+ case kNeedNewJumpFlag:
+ performJump(GameState.getNextNeighborhood());
+ startNeighborhood();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void PegasusEngine::checkCallBacks() {
+ for (Common::List<TimeBase *>::iterator it = _timeBases.begin(); it != _timeBases.end(); it++)
+ (*it)->checkCallBacks();
+}
+
+void PegasusEngine::resetIntroTimer() {
+ if (!isDemo() && _gameMenu && _gameMenu->getObjectID() == kMainMenuID) {
+ _introTimer->stopFuse();
+ _introTimer->primeFuse(kIntroTimeOut);
+ _introTimer->lightFuse();
+ }
+}
+
+void PegasusEngine::introTimerExpired() {
+ if (_gameMenu && _gameMenu->getObjectID() == kMainMenuID) {
+ ((MainMenu *)_gameMenu)->stopMainMenuLoop();
+
+ bool skipped = false;
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (!video->loadFile(_introDirectory + "/LilMovie.movie"))
+ error("Failed to load little movie");
+
+ bool saveAllowed = swapSaveAllowed(false);
+ bool openAllowed = swapLoadAllowed(false);
+
+ video->start();
+ skipped = playMovieScaled(video, 0, 0);
+
+ delete video;
+
+ if (shouldQuit())
+ return;
+
+ if (!skipped) {
+ runIntro();
+
+ if (shouldQuit())
+ return;
+ }
+
+ resetIntroTimer();
+ _gfx->invalRect(Common::Rect(0, 0, 640, 480));
+
+ swapSaveAllowed(saveAllowed);
+ swapLoadAllowed(openAllowed);
+
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ }
+}
+
+void PegasusEngine::stopIntroTimer() {
+ if (_introTimer)
+ _introTimer->stopFuse();
+}
+
+void PegasusEngine::delayShell(TimeValue time, TimeScale scale) {
+ if (time == 0 || scale == 0)
+ return;
+
+ uint32 startTime = g_system->getMillis();
+ uint32 timeInMillis = time * 1000 / scale;
+
+ while (g_system->getMillis() < startTime + timeInMillis) {
+ checkCallBacks();
+ _gfx->updateDisplay();
+ }
+}
+
+void PegasusEngine::useMenu(GameMenu *newMenu) {
+ if (_gameMenu) {
+ _gameMenu->restorePreviousHandler();
+ delete _gameMenu;
+ }
+
+ _gameMenu = newMenu;
+
+ if (_gameMenu)
+ _gameMenu->becomeCurrentHandler();
+}
+
+bool PegasusEngine::checkGameMenu() {
+ GameMenuCommand command = kMenuCmdNoCommand;
+
+ if (_gameMenu) {
+ command = _gameMenu->getLastCommand();
+ if (command != kMenuCmdNoCommand) {
+ _gameMenu->clearLastCommand();
+ doGameMenuCommand(command);
+ }
+ }
+
+ return command != kMenuCmdNoCommand;
+}
+
+void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) {
+ Common::Error result;
+
+ switch (command) {
+ case kMenuCmdStartAdventure:
+ stopIntroTimer();
+ GameState.setWalkthroughMode(false);
+ startNewGame();
+ break;
+ case kMenuCmdCredits:
+ if (isDemo()) {
+ showTempScreen("Images/Demo/DemoCredits.pict");
+ _gfx->doFadeOutSync();
+ _gfx->updateDisplay();
+ _gfx->doFadeInSync();
+ } else {
+ stopIntroTimer();
+ _gfx->doFadeOutSync();
+ useMenu(new CreditsMenu());
+ _gfx->updateDisplay();
+ _gfx->doFadeInSync();
+ }
+ break;
+ case kMenuCmdQuit:
+ case kMenuCmdDeathQuitDemo:
+ if (isDemo())
+ showTempScreen("Images/Demo/NGquitScrn.pict");
+ _system->quit();
+ break;
+ case kMenuCmdOverview:
+ stopIntroTimer();
+ doInterfaceOverview();
+ resetIntroTimer();
+ break;
+ case kMenuCmdStartWalkthrough:
+ stopIntroTimer();
+ GameState.setWalkthroughMode(true);
+ startNewGame();
+ break;
+ case kMenuCmdRestore:
+ stopIntroTimer();
+ // fall through
+ case kMenuCmdDeathRestore:
+ result = showLoadDialog();
+ if (command == kMenuCmdRestore && result.getCode() != Common::kNoError)
+ resetIntroTimer();
+ break;
+ case kMenuCmdCreditsMainMenu:
+ _gfx->doFadeOutSync();
+ useMenu(new MainMenu());
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ _gfx->doFadeInSync();
+ resetIntroTimer();
+ break;
+ case kMenuCmdDeathContinue:
+ if (((DeathMenu *)_gameMenu)->playerWon()) {
+ if (isDemo()) {
+ showTempScreen("Images/Demo/DemoCredits.pict");
+ _gfx->doFadeOutSync();
+ _gfx->updateDisplay();
+ _gfx->doFadeInSync();
+ } else {
+ _gfx->doFadeOutSync();
+ useMenu(0);
+ _gfx->clearScreen();
+ _gfx->updateDisplay();
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (!video->loadFile(_introDirectory + "/Closing.movie"))
+ error("Could not load closing movie");
+
+ uint16 x = (640 - video->getWidth() * 2) / 2;
+ uint16 y = (480 - video->getHeight() * 2) / 2;
+
+ video->start();
+ playMovieScaled(video, x, y);
+
+ delete video;
+
+ if (shouldQuit())
+ return;
+
+ useMenu(new MainMenu());
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ _gfx->doFadeInSync();
+ resetIntroTimer();
+ }
+ } else {
+ loadFromContinuePoint();
+ }
+ break;
+ case kMenuCmdDeathMainMenuDemo:
+ case kMenuCmdDeathMainMenu:
+ _gfx->doFadeOutSync();
+ useMenu(new MainMenu());
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ _gfx->doFadeInSync();
+ resetIntroTimer();
+ break;
+ case kMenuCmdPauseSave:
+ if (showSaveDialog().getCode() != Common::kUserCanceled)
+ pauseMenu(false);
+ break;
+ case kMenuCmdPauseContinue:
+ pauseMenu(false);
+ break;
+ case kMenuCmdPauseRestore:
+ makeContinuePoint();
+ result = showLoadDialog();
+
+ if (result.getCode() == Common::kNoError) {
+ // Successfully loaded, unpause the game
+ pauseMenu(false);
+ } else if (result.getCode() != Common::kUserCanceled) {
+ // Try to get us back to a sane state
+ loadFromContinuePoint();
+ }
+ break;
+ case kMenuCmdPauseQuit:
+ _gfx->doFadeOutSync();
+ throwAwayEverything();
+ pauseMenu(false);
+ useMenu(new MainMenu());
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ _gfx->doFadeInSync();
+ resetIntroTimer();
+ break;
+ case kMenuCmdNoCommand:
+ break;
+ default:
+ error("Unknown menu command %d", command);
+ }
+}
+
+void PegasusEngine::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (!checkGameMenu())
+ shellGameInput(input, cursorSpot);
+
+ // Handle the console here
+ if (input.isConsoleRequested()) {
+ _console->attach();
+ _console->onFrame();
+ }
+
+ // Handle save requests here
+ if (_saveRequested && _saveAllowed) {
+ _saveRequested = false;
+
+ // Can only save during a game and not in the demo
+ if (g_neighborhood && !isDemo()) {
+ pauseEngine(true);
+ showSaveDialog();
+ pauseEngine(false);
+ }
+ }
+
+ // Handle load requests here
+ if (_loadRequested && _loadAllowed) {
+ _loadRequested = false;
+
+ // WORKAROUND: Do not entertain load requests when the pause menu is up
+ // The original did and the game entered a bad state after loading.
+ // It's theoretically possible to make it so it does work while the
+ // pause menu is up, but the pause state of the engine is just too weird.
+ // Just use the pause menu's restore button since it's there for that
+ // for you to load anyway.
+ if (!isDemo() && !(_gameMenu && _gameMenu->getObjectID() == kPauseMenuID)) {
+ pauseEngine(true);
+
+ if (g_neighborhood) {
+ makeContinuePoint();
+
+ Common::Error result = showLoadDialog();
+ if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled)
+ loadFromContinuePoint();
+ } else {
+ if (_introTimer)
+ _introTimer->stopFuse();
+
+ Common::Error result = showLoadDialog();
+ if (result.getCode() != Common::kNoError) {
+ if (!_gameMenu) {
+ useMenu(new MainMenu());
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ }
+
+ resetIntroTimer();
+ }
+ }
+
+ pauseEngine(false);
+ }
+ }
+}
+
+void PegasusEngine::doInterfaceOverview() {
+ static const short kNumOverviewSpots = 11;
+ static const Common::Rect overviewSpots[kNumOverviewSpots] = {
+ Common::Rect(354, 318, 354 + 204, 318 + 12),
+ Common::Rect(211, 34, 211 + 114, 34 + 28),
+ Common::Rect(502, 344, 502 + 138, 344 + 120),
+ Common::Rect(132, 40, 132 + 79, 40 + 22),
+ Common::Rect(325, 40, 332 + 115, 40 + 22),
+ Common::Rect(70, 318, 70 + 284, 318 + 12),
+ Common::Rect(76, 334, 76 + 96, 334 + 96),
+ Common::Rect(64, 64, 64 + 512, 64 + 256),
+ Common::Rect(364, 334, 364 + 96, 334 + 96),
+ Common::Rect(172, 334, 172 + 192, 334 + 96),
+ Common::Rect(542, 36, 542 + 58, 36 + 20)
+ };
+
+ _gfx->doFadeOutSync();
+ useMenu(0);
+
+ Picture leftBackground(kNoDisplayElement);
+ leftBackground.initFromPICTFile("Images/Interface/OVLeft.mac");
+ leftBackground.setDisplayOrder(0);
+ leftBackground.moveElementTo(kBackground1Left, kBackground1Top);
+ leftBackground.startDisplaying();
+ leftBackground.show();
+
+ Picture topBackground(kNoDisplayElement);
+ topBackground.initFromPICTFile("Images/Interface/OVTop.mac");
+ topBackground.setDisplayOrder(0);
+ topBackground.moveElementTo(kBackground2Left, kBackground2Top);
+ topBackground.startDisplaying();
+ topBackground.show();
+
+ Picture rightBackground(kNoDisplayElement);
+ rightBackground.initFromPICTFile("Images/Interface/OVRight.mac");
+ rightBackground.setDisplayOrder(0);
+ rightBackground.moveElementTo(kBackground3Left, kBackground3Top);
+ rightBackground.startDisplaying();
+ rightBackground.show();
+
+ Picture bottomBackground(kNoDisplayElement);
+ bottomBackground.initFromPICTFile("Images/Interface/OVBottom.mac");
+ bottomBackground.setDisplayOrder(0);
+ bottomBackground.moveElementTo(kBackground4Left, kBackground4Top);
+ bottomBackground.startDisplaying();
+ bottomBackground.show();
+
+ Picture controllerHighlight(kNoDisplayElement);
+ controllerHighlight.initFromPICTFile("Images/Interface/OVcontrollerHilite.mac");
+ controllerHighlight.setDisplayOrder(0);
+ controllerHighlight.moveElementTo(kOverviewControllerLeft, kOverviewControllerTop);
+ controllerHighlight.startDisplaying();
+
+ Movie overviewText(kNoDisplayElement);
+ overviewText.initFromMovieFile("Images/Interface/Overview Mac.movie");
+ overviewText.setDisplayOrder(0);
+ overviewText.moveElementTo(kNavAreaLeft, kNavAreaTop);
+ overviewText.startDisplaying();
+ overviewText.show();
+ overviewText.redrawMovieWorld();
+
+ DropHighlight highlight(kNoDisplayElement);
+ highlight.setDisplayOrder(1);
+ highlight.startDisplaying();
+ highlight.setHighlightThickness(4);
+ highlight.setHighlightColor(g_system->getScreenFormat().RGBToColor(239, 239, 0));
+ highlight.setHighlightCornerDiameter(8);
+
+ Input input;
+ InputDevice.getInput(input, kFilterAllInput);
+
+ Common::Point cursorLoc;
+ input.getInputLocation(cursorLoc);
+
+ uint16 i;
+ for (i = 0; i < kNumOverviewSpots; ++i)
+ if (overviewSpots[i].contains(cursorLoc))
+ break;
+
+ TimeValue time;
+ if (i == kNumOverviewSpots)
+ time = 5;
+ else if (i > 4)
+ time = i + 1;
+ else
+ time = i;
+
+ if (time == 2) {
+ highlight.hide();
+ controllerHighlight.show();
+ } else if (i != kNumOverviewSpots) {
+ controllerHighlight.hide();
+ Common::Rect r = overviewSpots[i];
+ r.grow(5);
+ highlight.setBounds(r);
+ highlight.show();
+ } else {
+ highlight.hide();
+ controllerHighlight.hide();
+ }
+
+ overviewText.setTime(time * 3 + 2, 15);
+ overviewText.redrawMovieWorld();
+
+ _cursor->setCurrentFrameIndex(3);
+ _cursor->show();
+
+ _gfx->updateDisplay();
+ _gfx->doFadeInSync();
+
+ for (;;) {
+ InputDevice.getInput(input, kFilterAllInput);
+
+ if (input.anyInput() || shouldQuit() || _loadRequested || _saveRequested)
+ break;
+
+ input.getInputLocation(cursorLoc);
+ for (i = 0; i < kNumOverviewSpots; ++i)
+ if (overviewSpots[i].contains(cursorLoc))
+ break;
+
+ if (i == kNumOverviewSpots)
+ time = 5;
+ else if (i > 4)
+ time = i + 1;
+ else
+ time = i;
+
+ if (time == 2) {
+ highlight.hide();
+ controllerHighlight.show();
+ } else if (i != kNumOverviewSpots) {
+ controllerHighlight.hide();
+ Common::Rect r = overviewSpots[i];
+ r.grow(5);
+ highlight.setBounds(r);
+ highlight.show();
+ } else {
+ highlight.hide();
+ controllerHighlight.hide();
+ }
+
+ overviewText.setTime(time * 3 + 2, 15);
+ overviewText.redrawMovieWorld();
+
+ refreshDisplay();
+ }
+
+ if (shouldQuit())
+ return;
+
+ highlight.hide();
+ _cursor->hide();
+
+ _gfx->doFadeOutSync();
+ useMenu(new MainMenu());
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ _gfx->doFadeInSync();
+
+ _saveRequested = false;
+ _loadRequested = false;
+}
+
+void PegasusEngine::showTempScreen(const Common::String &fileName) {
+ _gfx->doFadeOutSync();
+
+ Picture picture(0);
+ picture.initFromPICTFile(fileName);
+ picture.setDisplayOrder(kMaxAvailableOrder);
+ picture.startDisplaying();
+ picture.show();
+ _gfx->updateDisplay();
+
+ _gfx->doFadeInSync();
+
+ // Wait for the next event
+ bool done = false;
+ while (!shouldQuit() && !done) {
+ Common::Event event;
+ while (_eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
+ case Common::EVENT_KEYDOWN:
+ done = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ _system->delayMillis(10);
+ }
+}
+
+void PegasusEngine::refreshDisplay() {
+ giveIdleTime();
+ _gfx->updateDisplay();
+}
+
+void PegasusEngine::resetEnergyDeathReason() {
+ switch (getCurrentNeighborhoodID()) {
+ case kMarsID:
+ _deathReason = kDeathArrestedInMars;
+ break;
+ case kNoradAlphaID:
+ case kNoradDeltaID:
+ _deathReason = kDeathArrestedInNorad;
+ break;
+ case kWSCID:
+ _deathReason = kDeathArrestedInWSC;
+ break;
+ default:
+ _deathReason = kDeathStranded;
+ break;
+ }
+}
+
+bool PegasusEngine::playerHasItem(const Item *item) {
+ return playerHasItemID(item->getObjectID());
+}
+
+bool PegasusEngine::playerHasItemID(const ItemID itemID) {
+ return itemInInventory(itemID) || itemInBiochips(itemID);
+}
+
+InventoryItem *PegasusEngine::getCurrentInventoryItem() {
+ if (g_interface)
+ return g_interface->getCurrentInventoryItem();
+
+ return 0;
+}
+
+bool PegasusEngine::itemInInventory(InventoryItem *item) {
+ return _items.itemInInventory(item);
+}
+
+bool PegasusEngine::itemInInventory(ItemID id) {
+ return _items.itemInInventory(id);
+}
+
+BiochipItem *PegasusEngine::getCurrentBiochip() {
+ if (g_interface)
+ return g_interface->getCurrentBiochip();
+
+ return 0;
+}
+
+bool PegasusEngine::itemInBiochips(BiochipItem *item) {
+ return _biochips.itemInInventory(item);
+}
+
+bool PegasusEngine::itemInBiochips(ItemID id) {
+ return _biochips.itemInInventory(id);
+}
+
+bool PegasusEngine::playerAlive() {
+ return (_shellNotification.getNotificationFlags() & kPlayerDiedFlag) == 0;
+}
+
+Common::String PegasusEngine::getBriefingMovie() {
+ if (_neighborhood)
+ return _neighborhood->getBriefingMovie();
+
+ return Common::String();
+}
+
+Common::String PegasusEngine::getEnvScanMovie() {
+ if (_neighborhood)
+ return _neighborhood->getEnvScanMovie();
+
+ return Common::String();
+}
+
+uint PegasusEngine::getNumHints() {
+ if (_neighborhood)
+ return _neighborhood->getNumHints();
+
+ return 0;
+}
+
+Common::String PegasusEngine::getHintMovie(uint hintNum) {
+ if (_neighborhood)
+ return _neighborhood->getHintMovie(hintNum);
+
+ return Common::String();
+}
+
+bool PegasusEngine::canSolve() {
+ if (_neighborhood)
+ return _neighborhood->canSolve();
+
+ return false;
+}
+
+void PegasusEngine::prepareForAIHint(const Common::String &movieName) {
+ if (g_neighborhood)
+ g_neighborhood->prepareForAIHint(movieName);
+}
+
+void PegasusEngine::cleanUpAfterAIHint(const Common::String &movieName) {
+ if (g_neighborhood)
+ g_neighborhood->cleanUpAfterAIHint(movieName);
+}
+
+void PegasusEngine::jumpToNewEnvironment(const NeighborhoodID neighborhoodID, const RoomID roomID, const DirectionConstant direction) {
+ GameState.setNextLocation(neighborhoodID, roomID, direction);
+ _shellNotification.setNotificationFlags(kNeedNewJumpFlag, kNeedNewJumpFlag);
+}
+
+void PegasusEngine::checkFlashlight() {
+ if (_neighborhood)
+ _neighborhood->checkFlashlight();
+}
+
+bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 y) {
+ bool skipped = false;
+
+ while (!shouldQuit() && !video->endOfVideo() && !skipped) {
+ if (video->needsUpdate()) {
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame)
+ drawScaledFrame(frame, x, y);
+ }
+
+ Input input;
+ InputDevice.getInput(input, kFilterAllInput);
+ if (input.anyInput() || _saveRequested || _loadRequested)
+ skipped = true;
+
+ _system->delayMillis(10);
+ }
+
+ return skipped;
+}
+
+void PegasusEngine::die(const DeathReason reason) {
+ Input dummy;
+ if (isDragging())
+ _itemDragger.stopTracking(dummy);
+
+ _deathReason = reason;
+ _shellNotification.setNotificationFlags(kPlayerDiedFlag, kPlayerDiedFlag);
+}
+
+void PegasusEngine::doDeath() {
+ _gfx->doFadeOutSync();
+ throwAwayEverything();
+ useMenu(new DeathMenu(_deathReason));
+ _gfx->updateDisplay();
+ _gfx->doFadeInSync();
+}
+
+void PegasusEngine::throwAwayEverything() {
+ if (_items.getNumItems() != 0 && g_interface)
+ _currentItemID = g_interface->getCurrentInventoryItem()->getObjectID();
+ else
+ _currentItemID = kNoItemID;
+
+ if (_biochips.getNumItems() != 0 && g_interface)
+ _currentBiochipID = g_interface->getCurrentBiochip()->getObjectID();
+ else
+ _currentBiochipID = kNoItemID;
+
+ useMenu(0);
+ useNeighborhood(0);
+
+ delete g_interface;
+ g_interface = 0;
+}
+
+void PegasusEngine::processShell() {
+ checkCallBacks();
+ checkNotifications();
+ InputHandler::pollForInput();
+ refreshDisplay();
+}
+
+void PegasusEngine::createInterface() {
+ if (!g_interface)
+ new Interface();
+
+ g_interface->createInterface();
+}
+
+void PegasusEngine::setGameMode(const GameMode newMode) {
+ if (newMode != _gameMode && canSwitchGameMode(newMode, _gameMode)) {
+ switchGameMode(newMode, _gameMode);
+ _gameMode = newMode;
+ }
+}
+
+void PegasusEngine::switchGameMode(const GameMode newMode, const GameMode oldMode) {
+ // Start raising panels before lowering panels, to give the activating panel time
+ // to set itself up without cutting into the lowering panel's animation time.
+
+ if (_switchModesSync) {
+ if (newMode == kModeInventoryPick)
+ raiseInventoryDrawerSync();
+ else if (newMode == kModeBiochipPick)
+ raiseBiochipDrawerSync();
+ else if (newMode == kModeInfoScreen)
+ showInfoScreen();
+
+ if (oldMode == kModeInventoryPick)
+ lowerInventoryDrawerSync();
+ else if (oldMode == kModeBiochipPick)
+ lowerBiochipDrawerSync();
+ else if (oldMode == kModeInfoScreen)
+ hideInfoScreen();
+ } else {
+ if (newMode == kModeInventoryPick)
+ raiseInventoryDrawer();
+ else if (newMode == kModeBiochipPick)
+ raiseBiochipDrawer();
+ else if (newMode == kModeInfoScreen)
+ showInfoScreen();
+
+ if (oldMode == kModeInventoryPick)
+ lowerInventoryDrawer();
+ else if (oldMode == kModeBiochipPick)
+ lowerBiochipDrawer();
+ else if (oldMode == kModeInfoScreen)
+ hideInfoScreen();
+ }
+}
+
+bool PegasusEngine::canSwitchGameMode(const GameMode newMode, const GameMode oldMode) {
+ if (newMode == kModeInventoryPick && oldMode == kModeBiochipPick)
+ return false;
+ if (newMode == kModeBiochipPick && oldMode == kModeInventoryPick)
+ return false;
+ return true;
+}
+
+bool PegasusEngine::itemInLocation(const ItemID itemID, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) {
+ NeighborhoodID itemNeighborhood;
+ RoomID itemRoom;
+ DirectionConstant itemDirection;
+
+ Item *item = _allItems.findItemByID(itemID);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ return itemNeighborhood == neighborhood && itemRoom == room && itemDirection == direction;
+}
+
+InventoryResult PegasusEngine::addItemToInventory(InventoryItem *item) {
+ InventoryResult result;
+
+ do {
+ if (g_interface)
+ result = g_interface->addInventoryItem(item);
+ else
+ result = _items.addItem(item);
+
+ if (result == kTooMuchWeight)
+ destroyInventoryItem(pickItemToDestroy());
+ } while (result != kInventoryOK);
+
+ GameState.setTakenItem(item, true);
+ if (g_neighborhood)
+ g_neighborhood->pickedUpItem(item);
+
+ g_AIArea->checkMiddleArea();
+
+ return result;
+}
+
+void PegasusEngine::useNeighborhood(Neighborhood *neighborhood) {
+ delete _neighborhood;
+ _neighborhood = neighborhood;
+
+ if (_neighborhood) {
+ InputHandler::setInputHandler(_neighborhood);
+ _neighborhood->init();
+ _neighborhood->moveNavTo(kNavAreaLeft, kNavAreaTop);
+ g_interface->setDate(_neighborhood->getDateResID());
+ } else {
+ InputHandler::setInputHandler(this);
+ }
+}
+
+void PegasusEngine::performJump(NeighborhoodID neighborhoodID) {
+ if (_neighborhood)
+ useNeighborhood(0);
+
+ // Sub chase is special
+ if (neighborhoodID == kNoradSubChaseID) {
+ throwAwayEverything();
+ _loadAllowed = false;
+ doSubChase();
+
+ if (shouldQuit())
+ return;
+
+ neighborhoodID = kNoradDeltaID;
+ GameState.setNextRoom(kNorad41);
+ GameState.setNextDirection(kEast);
+ _loadAllowed = true;
+ }
+
+ Neighborhood *neighborhood;
+ makeNeighborhood(neighborhoodID, neighborhood);
+ useNeighborhood(neighborhood);
+
+ // Update the CD variable (used just for saves currently)
+ _currentCD = getNeighborhoodCD(neighborhoodID);
+}
+
+void PegasusEngine::startNeighborhood() {
+ if (g_interface && _currentItemID != kNoItemID)
+ g_interface->setCurrentInventoryItemID(_currentItemID);
+
+ if (g_interface && _currentBiochipID != kNoItemID)
+ g_interface->setCurrentBiochipID(_currentBiochipID);
+
+ setGameMode(kModeNavigation);
+
+ if (_neighborhood)
+ _neighborhood->start();
+}
+
+void PegasusEngine::startNewGame() {
+ // WORKAROUND: The original game ignored the menu difficulty
+ // setting. We're going to pass it through here so that
+ // the menu actually makes sense now.
+ bool isWalkthrough = GameState.getWalkthroughMode();
+ GameState.resetGameState();
+ GameState.setWalkthroughMode(isWalkthrough);
+
+ // TODO: Enable erase
+ _gfx->doFadeOutSync();
+ useMenu(0);
+ _gfx->updateDisplay();
+ _gfx->enableUpdates();
+
+ createInterface();
+
+ if (isDemo()) {
+ setLastEnergyValue(kFullEnergy);
+ jumpToNewEnvironment(kPrehistoricID, kPrehistoric02, kSouth);
+ GameState.setPrehistoricSeenTimeStream(false);
+ GameState.setPrehistoricSeenFlyer1(false);
+ GameState.setPrehistoricSeenFlyer2(false);
+ GameState.setPrehistoricSeenBridgeZoom(false);
+ GameState.setPrehistoricBreakerThrown(false);
+ } else {
+ jumpToNewEnvironment(kCaldoriaID, kCaldoria00, kEast);
+ }
+
+ removeAllItemsFromInventory();
+ removeAllItemsFromBiochips();
+
+ BiochipItem *biochip = (BiochipItem *)_allItems.findItemByID(kAIBiochip);
+ addItemToBiochips(biochip);
+
+ if (isDemo()) {
+ biochip = (BiochipItem *)_allItems.findItemByID(kPegasusBiochip);
+ addItemToBiochips(biochip);
+ biochip = (BiochipItem *)_allItems.findItemByID(kMapBiochip);
+ addItemToBiochips(biochip);
+ InventoryItem *item = (InventoryItem *)_allItems.findItemByID(kKeyCard);
+ addItemToInventory(item);
+ item = (InventoryItem *)_allItems.findItemByID(kJourneymanKey);
+ addItemToInventory(item);
+ _currentItemID = kJourneymanKey;
+ } else {
+ _currentItemID = kNoItemID;
+ }
+
+ _currentBiochipID = kAIBiochip;
+
+ // Clear jump notification flags and just perform the jump...
+ _shellNotification.setNotificationFlags(0, kNeedNewJumpFlag);
+
+ performJump(GameState.getNextNeighborhood());
+
+ startNeighborhood();
+}
+
+void PegasusEngine::makeNeighborhood(NeighborhoodID neighborhoodID, Neighborhood *&neighborhood) {
+ // TODO: CD check
+
+ switch (neighborhoodID) {
+ case kCaldoriaID:
+ neighborhood = new Caldoria(g_AIArea, this);
+ break;
+ case kMarsID:
+ neighborhood = new Mars(g_AIArea, this);
+ break;
+ case kPrehistoricID:
+ neighborhood = new Prehistoric(g_AIArea, this);
+ break;
+ case kFullTSAID:
+ neighborhood = new FullTSA(g_AIArea, this);
+ break;
+ case kTinyTSAID:
+ neighborhood = new TinyTSA(g_AIArea, this);
+ break;
+ case kWSCID:
+ neighborhood = new WSC(g_AIArea, this);
+ break;
+ case kNoradAlphaID:
+ neighborhood = new NoradAlpha(g_AIArea, this);
+ break;
+ case kNoradDeltaID:
+ createInterface();
+ neighborhood = new NoradDelta(g_AIArea, this);
+ break;
+ default:
+ error("Unknown neighborhood %d", neighborhoodID);
+ }
+}
+
+bool PegasusEngine::wantsCursor() {
+ return _gameMenu == 0;
+}
+
+void PegasusEngine::updateCursor(const Common::Point, const Hotspot *cursorSpot) {
+ if (_itemDragger.isTracking()) {
+ _cursor->setCurrentFrameIndex(5);
+ } else {
+ if (!cursorSpot) {
+ _cursor->setCurrentFrameIndex(0);
+ } else {
+ uint32 id = cursorSpot->getObjectID();
+
+ switch (id) {
+ case kCurrentItemSpotID:
+ if (countInventoryItems() != 0)
+ _cursor->setCurrentFrameIndex(4);
+ else
+ _cursor->setCurrentFrameIndex(0);
+ break;
+ default:
+ HotSpotFlags flags = cursorSpot->getHotspotFlags();
+
+ if (flags & kZoomInSpotFlag)
+ _cursor->setCurrentFrameIndex(1);
+ else if (flags & kZoomOutSpotFlag)
+ _cursor->setCurrentFrameIndex(2);
+ else if (flags & (kPickUpItemSpotFlag | kPickUpBiochipSpotFlag))
+ _cursor->setCurrentFrameIndex(4);
+ else if (flags & kJMPClickingSpotFlags)
+ _cursor->setCurrentFrameIndex(3);
+ else
+ _cursor->setCurrentFrameIndex(0);
+ }
+ }
+ }
+}
+
+void PegasusEngine::toggleInventoryDisplay() {
+ if (_gameMode == kModeInventoryPick)
+ setGameMode(kModeNavigation);
+ else
+ setGameMode(kModeInventoryPick);
+}
+
+void PegasusEngine::toggleBiochipDisplay() {
+ if (_gameMode == kModeBiochipPick)
+ setGameMode(kModeNavigation);
+ else
+ setGameMode(kModeBiochipPick);
+}
+
+void PegasusEngine::showInfoScreen() {
+ if (g_neighborhood) {
+ // Break the input handler chain...
+ _savedHandler = InputHandler::getCurrentHandler();
+ InputHandler::setInputHandler(this);
+
+ Picture *pushPicture = ((Neighborhood *)g_neighborhood)->getTurnPushPicture();
+
+ _bigInfoMovie.shareSurface(pushPicture);
+ _smallInfoMovie.shareSurface(pushPicture);
+
+ g_neighborhood->hideNav();
+
+ _smallInfoMovie.initFromMovieFile("Images/Items/Info Right Movie");
+ _smallInfoMovie.setDisplayOrder(kInfoSpinOrder);
+ _smallInfoMovie.moveElementTo(kNavAreaLeft + 304, kNavAreaTop + 8);
+ _smallInfoMovie.moveMovieBoxTo(304, 8);
+ _smallInfoMovie.startDisplaying();
+ _smallInfoMovie.show();
+
+ TimeValue startTime, stopTime;
+ g_AIArea->getSmallInfoSegment(startTime, stopTime);
+ _smallInfoMovie.setSegment(startTime, stopTime);
+ _smallInfoMovie.setTime(startTime);
+ _smallInfoMovie.setFlags(kLoopTimeBase);
+
+ _bigInfoMovie.initFromMovieFile("Images/Items/Info Left Movie");
+ _bigInfoMovie.setDisplayOrder(kInfoBackgroundOrder);
+ _bigInfoMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
+ _bigInfoMovie.startDisplaying();
+ _bigInfoMovie.show();
+ _bigInfoMovie.setTime(g_AIArea->getBigInfoTime());
+
+ _bigInfoMovie.redrawMovieWorld();
+ _smallInfoMovie.redrawMovieWorld();
+ _smallInfoMovie.start();
+ }
+}
+
+void PegasusEngine::hideInfoScreen() {
+ if (g_neighborhood) {
+ InputHandler::setInputHandler(_savedHandler);
+
+ _bigInfoMovie.hide();
+ _bigInfoMovie.stopDisplaying();
+ _bigInfoMovie.releaseMovie();
+
+ _smallInfoMovie.hide();
+ _smallInfoMovie.stopDisplaying();
+ _smallInfoMovie.stop();
+ _smallInfoMovie.releaseMovie();
+
+ g_neighborhood->showNav();
+ }
+}
+
+void PegasusEngine::raiseInventoryDrawer() {
+ if (g_interface)
+ g_interface->raiseInventoryDrawer();
+}
+
+void PegasusEngine::raiseBiochipDrawer() {
+ if (g_interface)
+ g_interface->raiseBiochipDrawer();
+}
+
+void PegasusEngine::lowerInventoryDrawer() {
+ if (g_interface)
+ g_interface->lowerInventoryDrawer();
+}
+
+void PegasusEngine::lowerBiochipDrawer() {
+ if (g_interface)
+ g_interface->lowerBiochipDrawer();
+}
+
+void PegasusEngine::raiseInventoryDrawerSync() {
+ if (g_interface)
+ g_interface->raiseInventoryDrawerSync();
+}
+
+void PegasusEngine::raiseBiochipDrawerSync() {
+ if (g_interface)
+ g_interface->raiseBiochipDrawerSync();
+}
+
+void PegasusEngine::lowerInventoryDrawerSync() {
+ if (g_interface)
+ g_interface->lowerInventoryDrawerSync();
+}
+
+void PegasusEngine::lowerBiochipDrawerSync() {
+ if (g_interface)
+ g_interface->lowerBiochipDrawerSync();
+}
+
+void PegasusEngine::toggleInfo() {
+ if (_gameMode == kModeInfoScreen)
+ setGameMode(kModeNavigation);
+ else if (_gameMode == kModeNavigation)
+ setGameMode(kModeInfoScreen);
+}
+
+void PegasusEngine::dragTerminated(const Input &) {
+ Hotspot *finalSpot = _itemDragger.getLastHotspot();
+ InventoryResult result;
+
+ if (_dragType == kDragInventoryPickup) {
+ if (finalSpot && finalSpot->getObjectID() == kInventoryDropSpotID)
+ result = addItemToInventory((InventoryItem *)_draggingItem);
+ else
+ result = kTooMuchWeight;
+
+ if (result != kInventoryOK)
+ autoDragItemIntoRoom(_draggingItem, _draggingSprite);
+ else
+ delete _draggingSprite;
+ } else if (_dragType == kDragBiochipPickup) {
+ if (finalSpot && finalSpot->getObjectID() == kBiochipDropSpotID)
+ result = addItemToBiochips((BiochipItem *)_draggingItem);
+ else
+ result = kTooMuchWeight;
+
+ if (result != kInventoryOK)
+ autoDragItemIntoRoom(_draggingItem, _draggingSprite);
+ else
+ delete _draggingSprite;
+ } else if (_dragType == kDragInventoryUse) {
+ if (finalSpot && (finalSpot->getHotspotFlags() & kDropItemSpotFlag) != 0) {
+ // *** Need to decide on a case by case basis what to do here.
+ // the crowbar should break the cover off the Mars reactor if its frozen, the
+ // global transport card should slide through the slot, the oxygen mask should
+ // attach to the filling station, and so on...
+ _neighborhood->dropItemIntoRoom(_draggingItem, finalSpot);
+ delete _draggingSprite;
+ } else {
+ autoDragItemIntoInventory(_draggingItem, _draggingSprite);
+ }
+ }
+
+ _dragType = kDragNoDrag;
+
+ if (g_AIArea)
+ g_AIArea->unlockAI();
+}
+
+
+void PegasusEngine::dragItem(const Input &input, Item *item, DragType type) {
+ _draggingItem = item;
+ _dragType = type;
+
+ // Create the sprite.
+ _draggingSprite = _draggingItem->getDragSprite(kDraggingSpriteID);
+ Common::Point where;
+ input.getInputLocation(where);
+ Common::Rect r1;
+ _draggingSprite->getBounds(r1);
+ r1 = Common::Rect::center(where.x, where.y, r1.width(), r1.height());
+ _draggingSprite->setBounds(r1);
+
+ // Set up drag constraints.
+ DisplayElement *navMovie = _gfx->findDisplayElement(kNavMovieID);
+ Common::Rect r2;
+ navMovie->getBounds(r2);
+ r2.left -= r1.width() / 3;
+ r2.right += r1.width() / 3;
+ r2.top -= r1.height() / 3;
+ r2.bottom += r2.height() / 3;
+
+ r1 = Common::Rect(-30000, -30000, 30000, 30000);
+ _itemDragger.setDragConstraints(r2, r1);
+
+ // Start dragging.
+ _draggingSprite->setDisplayOrder(kDragSpriteOrder);
+ _draggingSprite->startDisplaying();
+ _draggingSprite->show();
+ _itemDragger.setDragSprite(_draggingSprite);
+ _itemDragger.setNextHandler(_neighborhood);
+ _itemDragger.startTracking(input);
+
+ if (g_AIArea)
+ g_AIArea->lockAIOut();
+}
+
+void PegasusEngine::shellGameInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_gameMode == kModeInfoScreen) {
+ if (JMPPPInput::isToggleAIMiddleInput(input)) {
+ LowerClientSignature middleOwner = g_AIArea->getMiddleAreaOwner();
+ g_AIArea->toggleMiddleAreaOwner();
+
+ if (middleOwner != g_AIArea->getMiddleAreaOwner()) {
+ _bigInfoMovie.setTime(g_AIArea->getBigInfoTime());
+ _smallInfoMovie.stop();
+ _smallInfoMovie.setFlags(0);
+
+ TimeValue startTime, stopTime;
+ g_AIArea->getSmallInfoSegment(startTime, stopTime);
+ _smallInfoMovie.setSegment(startTime, stopTime);
+ _smallInfoMovie.setTime(startTime);
+ _smallInfoMovie.setFlags(kLoopTimeBase);
+
+ _bigInfoMovie.redrawMovieWorld();
+ _smallInfoMovie.redrawMovieWorld();
+ _smallInfoMovie.start();
+ }
+ }
+ } else {
+ if (JMPPPInput::isRaiseInventoryInput(input))
+ toggleInventoryDisplay();
+
+ if (JMPPPInput::isRaiseBiochipsInput(input))
+ toggleBiochipDisplay();
+
+ if (JMPPPInput::isTogglePauseInput(input) && _neighborhood)
+ pauseMenu(!isPaused());
+ }
+
+ if (JMPPPInput::isToggleInfoInput(input))
+ toggleInfo();
+}
+
+void PegasusEngine::activateHotspots() {
+ if (_gameMode == kModeInfoScreen) {
+ _allHotspots.activateOneHotspot(kInfoReturnSpotID);
+ } else {
+ // Set up hot spots.
+ if (_dragType == kDragInventoryPickup)
+ _allHotspots.activateOneHotspot(kInventoryDropSpotID);
+ else if (_dragType == kDragBiochipPickup)
+ _allHotspots.activateOneHotspot(kBiochipDropSpotID);
+ else if (_dragType == kDragNoDrag)
+ _allHotspots.activateMaskedHotspots(kShellSpotFlag);
+ }
+}
+
+bool PegasusEngine::isClickInput(const Input &input, const Hotspot *cursorSpot) {
+ if (_cursor->isVisible() && cursorSpot)
+ return JMPPPInput::isClickInput(input);
+ else
+ return false;
+}
+
+InputBits PegasusEngine::getClickFilter() {
+ return JMPPPInput::getClickInputFilter();
+}
+
+void PegasusEngine::clickInHotspot(const Input &input, const Hotspot *clickedSpot) {
+ if (clickedSpot->getObjectID() == kCurrentItemSpotID) {
+ InventoryItem *currentItem = getCurrentInventoryItem();
+ if (currentItem) {
+ removeItemFromInventory(currentItem);
+ dragItem(input, currentItem, kDragInventoryUse);
+ }
+ } else if (clickedSpot->getObjectID() == kInfoReturnSpotID) {
+ toggleInfo();
+ }
+}
+
+InventoryResult PegasusEngine::removeItemFromInventory(InventoryItem *item) {
+ InventoryResult result;
+
+ if (g_interface)
+ result = g_interface->removeInventoryItem(item);
+ else
+ result = _items.removeItem(item);
+
+ // This should never happen
+ assert(result == kInventoryOK);
+
+ return result;
+}
+
+void PegasusEngine::removeAllItemsFromInventory() {
+ if (g_interface)
+ g_interface->removeAllItemsFromInventory();
+ else
+ _items.removeAllItems();
+}
+
+/////////////////////////////////////////////
+//
+// Biochip handling.
+
+// Adding biochips to the biochip drawer is a little funny, because of two things:
+// -- We get the map biochip and pegasus biochip at the same time by dragging
+// one sprite in TSA
+// -- We can drag in more than one copy of the various biochips.
+// Because of this we need to make sure that no more than one copy of each biochip
+// is ever added.
+
+InventoryResult PegasusEngine::addItemToBiochips(BiochipItem *biochip) {
+ InventoryResult result;
+
+ if (g_interface)
+ result = g_interface->addBiochip(biochip);
+ else
+ result = _biochips.addItem(biochip);
+
+ // This can never happen
+ assert(result == kInventoryOK);
+
+ GameState.setTakenItem(biochip, true);
+
+ if (g_neighborhood)
+ g_neighborhood->pickedUpItem(biochip);
+
+ g_AIArea->checkMiddleArea();
+
+ return result;
+}
+
+void PegasusEngine::removeAllItemsFromBiochips() {
+ if (g_interface)
+ g_interface->removeAllItemsFromBiochips();
+ else
+ _biochips.removeAllItems();
+}
+
+void PegasusEngine::setSoundFXLevel(uint16 fxLevel) {
+ _FXLevel = fxLevel;
+ if (_neighborhood)
+ _neighborhood->setSoundFXLevel(fxLevel);
+ if (g_AIArea)
+ g_AIArea->setAIVolume(fxLevel);
+}
+
+void PegasusEngine::setAmbienceLevel(uint16 ambientLevel) {
+ _ambientLevel = ambientLevel;
+ if (_neighborhood)
+ _neighborhood->setAmbienceLevel(ambientLevel);
+}
+
+void PegasusEngine::pauseMenu(bool menuUp) {
+ if (menuUp) {
+ pauseEngine(true);
+ _screenDimmer.startDisplaying();
+ _screenDimmer.show();
+ _gfx->updateDisplay();
+ useMenu(new PauseMenu());
+ } else {
+ pauseEngine(false);
+ _screenDimmer.hide();
+ _screenDimmer.stopDisplaying();
+ useMenu(0);
+ g_AIArea->checkMiddleArea();
+ }
+}
+
+void PegasusEngine::autoDragItemIntoRoom(Item *item, Sprite *draggingSprite) {
+ if (g_AIArea)
+ g_AIArea->lockAIOut();
+
+ Common::Point start, stop;
+ draggingSprite->getLocation(start.x, start.y);
+
+ Hotspot *dropSpot = _neighborhood->getItemScreenSpot(item, draggingSprite);
+
+ if (dropSpot) {
+ dropSpot->getCenter(stop.x, stop.y);
+ } else {
+ stop.x = kNavAreaLeft + 256;
+ stop.y = kNavAreaTop + 128;
+ }
+
+ Common::Rect bounds;
+ draggingSprite->getBounds(bounds);
+ stop.x -= bounds.width() >> 1;
+ stop.y -= bounds.height() >> 1;
+
+ int dx = ABS(stop.x - start.x);
+ int dy = ABS(stop.y - start.y);
+ TimeValue time = MAX(dx, dy);
+
+ allowInput(false);
+ _autoDragger.autoDrag(draggingSprite, start, stop, time, kDefaultTimeScale);
+
+ while (_autoDragger.isDragging()) {
+ checkCallBacks();
+ refreshDisplay();
+ _system->delayMillis(10);
+ }
+
+ _neighborhood->dropItemIntoRoom(_draggingItem, dropSpot);
+ allowInput(true);
+ delete _draggingSprite;
+
+ if (g_AIArea)
+ g_AIArea->unlockAI();
+}
+
+void PegasusEngine::autoDragItemIntoInventory(Item *, Sprite *draggingSprite) {
+ if (g_AIArea)
+ g_AIArea->lockAIOut();
+
+ Common::Point start;
+ draggingSprite->getLocation(start.x, start.y);
+
+ Common::Rect r;
+ draggingSprite->getBounds(r);
+
+ Common::Point stop((76 + 172 - r.width()) / 2, 334 - (2 * r.height() / 3));
+
+ int dx = ABS(stop.x - start.x);
+ int dy = ABS(stop.y - start.y);
+ TimeValue time = MAX(dx, dy);
+
+ allowInput(false);
+ _autoDragger.autoDrag(draggingSprite, start, stop, time, kDefaultTimeScale);
+
+ while (_autoDragger.isDragging()) {
+ checkCallBacks();
+ refreshDisplay();
+ _system->delayMillis(10);
+ }
+
+ addItemToInventory((InventoryItem *)_draggingItem);
+ allowInput(true);
+ delete _draggingSprite;
+
+ if (g_AIArea)
+ g_AIArea->unlockAI();
+}
+
+NeighborhoodID PegasusEngine::getCurrentNeighborhoodID() const {
+ if (_neighborhood)
+ return _neighborhood->getObjectID();
+
+ return kNoNeighborhoodID;
+}
+
+void PegasusEngine::pauseEngineIntern(bool pause) {
+ Engine::pauseEngineIntern(pause);
+
+ if (pause) {
+ for (Common::List<TimeBase *>::iterator it = _timeBases.begin(); it != _timeBases.end(); it++)
+ (*it)->pause();
+ } else {
+ for (Common::List<TimeBase *>::iterator it = _timeBases.begin(); it != _timeBases.end(); it++)
+ (*it)->resume();
+ }
+}
+
+uint PegasusEngine::getRandomBit() {
+ return _rnd->getRandomBit();
+}
+
+uint PegasusEngine::getRandomNumber(uint max) {
+ return _rnd->getRandomNumber(max);
+}
+
+void PegasusEngine::shuffleArray(int32 *arr, int32 count) {
+ if (count > 1) {
+ for (int32 i = 1; i < count; ++i) {
+ int32 j = _rnd->getRandomNumber(i);
+ if (j != i)
+ SWAP(arr[i], arr[j]);
+ }
+ }
+}
+
+void PegasusEngine::playEndMessage() {
+ if (g_interface) {
+ allowInput(false);
+ g_interface->playEndMessage();
+ allowInput(true);
+ }
+
+ die(kPlayerWonGame);
+}
+
+void PegasusEngine::doSubChase() {
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (!video->loadFile("Images/Norad Alpha/Sub Chase Movie"))
+ error("Failed to load sub chase");
+
+ video->setEndTime(Audio::Timestamp(0, 133200, 600));
+ video->start();
+
+ while (!shouldQuit() && !video->endOfVideo()) {
+ if (video->needsUpdate()) {
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame)
+ drawScaledFrame(frame, 0, 0);
+ }
+
+ Common::Event event;
+ while (_eventMan->pollEvent(event))
+ ;
+
+ _system->delayMillis(10);
+ }
+
+ delete video;
+}
+
+template<typename PixelInt>
+static void scaleFrame(const PixelInt *src, PixelInt *dst, int w, int h, int srcPitch) {
+ assert((srcPitch % sizeof(PixelInt)) == 0); // sanity check; allows some simpler code
+
+ PixelInt *dst1 = dst;
+ PixelInt *dst2 = dst + w * 2;
+
+ int srcInc = (srcPitch / sizeof(PixelInt)) - w;
+ int dstInc = w * 2;
+
+ while (h--) {
+ for (int x = 0; x < w; x++) {
+ PixelInt pixel = *src++;
+ *dst1++ = pixel;
+ *dst1++ = pixel;
+ *dst2++ = pixel;
+ *dst2++ = pixel;
+ }
+
+ src += srcInc;
+ dst1 += dstInc;
+ dst2 += dstInc;
+ }
+}
+
+void PegasusEngine::drawScaledFrame(const Graphics::Surface *frame, uint16 x, uint16 y) {
+ // Scale up the frame doing some simple scaling
+ Graphics::Surface scaledFrame;
+ scaledFrame.create(frame->w * 2, frame->h * 2, frame->format);
+
+ if (frame->format.bytesPerPixel == 2)
+ scaleFrame<uint16>((uint16 *)frame->pixels, (uint16 *)scaledFrame.pixels, frame->w, frame->h, frame->pitch);
+ else
+ scaleFrame<uint32>((uint32 *)frame->pixels, (uint32 *)scaledFrame.pixels, frame->w, frame->h, frame->pitch);
+
+ _system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
+ _system->updateScreen();
+ scaledFrame.free();
+}
+
+void PegasusEngine::destroyInventoryItem(const ItemID itemID) {
+ InventoryItem *item = (InventoryItem *)_allItems.findItemByID(itemID);
+
+ ItemExtraEntry entry;
+
+ switch (itemID) {
+ case kAirMask:
+ item->findItemExtra(kRemoveAirMask, entry);
+ item->setItemRoom(kMarsID, kMars49, kSouth);
+ break;
+ case kArgonCanister:
+ item->findItemExtra(kRemoveArgon, entry);
+ item->setItemRoom(kWSCID, kWSC02Morph, kSouth);
+ break;
+ case kCrowbar:
+ item->findItemExtra(kRemoveCrowbar, entry);
+ item->setItemRoom(kMarsID, kMars34, kSouth);
+ break;
+ case kJourneymanKey:
+ item->findItemExtra(kRemoveJourneymanKey, entry);
+ item->setItemRoom(kFullTSAID, kTSA22Red, kEast);
+ break;
+ case kMarsCard:
+ item->findItemExtra(kRemoveMarsCard, entry);
+ item->setItemRoom(kMarsID, kMars31South, kSouth);
+ break;
+ case kNitrogenCanister:
+ item->findItemExtra(kRemoveNitrogen, entry);
+ item->setItemRoom(kWSCID, kWSC02Messages, kSouth);
+ break;
+ case kOrangeJuiceGlassEmpty:
+ item->findItemExtra(kRemoveGlass, entry);
+ item->setItemRoom(kCaldoriaID, kCaldoriaReplicator, kNorth);
+ break;
+ case kPoisonDart:
+ item->findItemExtra(kRemoveDart, entry);
+ item->setItemRoom(kWSCID, kWSC01, kWest);
+ break;
+ case kSinclairKey:
+ item->findItemExtra(kRemoveSinclairKey, entry);
+ item->setItemRoom(kWSCID, kWSC02Morph, kSouth);
+ break;
+ default:
+ return;
+ }
+
+ g_interface->setCurrentInventoryItemID(itemID);
+ g_AIArea->playAIAreaSequence(kInventorySignature, kMiddleAreaSignature, entry.extraStart, entry.extraStop);
+ removeItemFromInventory(item);
+}
+
+ItemID PegasusEngine::pickItemToDestroy() {
+/*
+ Must pick an item to destroy
+
+ Part I: Polite -- try to find an item that's been used
+ Part II: Desperate -- return the first available item.
+*/
+
+ // Polite:
+ if (playerHasItemID(kOrangeJuiceGlassEmpty))
+ return kOrangeJuiceGlassEmpty;
+ if (playerHasItemID(kPoisonDart)) {
+ if (GameState.getCurrentNeighborhood() != kWSCID ||
+ GameState.getWSCAnalyzedDart())
+ return kPoisonDart;
+ }
+ if (playerHasItemID(kJourneymanKey)) {
+ if (GameState.getTSAState() >= kTSAPlayerGotHistoricalLog &&
+ GameState.getTSAState() != kPlayerOnWayToPrehistoric &&
+ GameState.getTSAState() != kPlayerWentToPrehistoric)
+ return kJourneymanKey;
+ }
+ if (playerHasItemID(kMarsCard)) {
+ if (GameState.getCurrentNeighborhood() != kMarsID || GameState.getMarsArrivedBelow())
+ return kMarsCard;
+ }
+
+ // Don't want to deal with deleting the sinclair key and argon canister, since it's
+ // impossible to pick them up one at a time.
+
+ if (playerHasItemID(kNitrogenCanister)) {
+ if (GameState.getScoringGotCardBomb() && GameState.getCurrentNeighborhood() != kMarsID)
+ return kNitrogenCanister;
+ }
+ if (playerHasItemID(kCrowbar)) {
+ if (GameState.getCurrentNeighborhood() == kWSCID) {
+ if (GameState.getCurrentRoom() >= kWSC62)
+ return kCrowbar;
+ } else if (GameState.getCurrentNeighborhood() == kMarsID) {
+ if (GameState.getScoringGotCardBomb())
+ return kCrowbar;
+ } else
+ return kCrowbar;
+ }
+ if (playerHasItemID(kAirMask)) {
+ if (GameState.getCurrentNeighborhood() == kMarsID) {
+ if (g_neighborhood->getAirQuality(GameState.getCurrentRoom()) == kAirQualityGood)
+ return kAirMask;
+ } else if (GameState.getCurrentNeighborhood() != kNoradAlphaID &&
+ GameState.getCurrentNeighborhood() != kNoradDeltaID) {
+ return kAirMask;
+ }
+ }
+
+ // Desperate:
+ if (playerHasItemID(kPoisonDart))
+ return kPoisonDart;
+ if (playerHasItemID(kJourneymanKey))
+ return kJourneymanKey;
+ if (playerHasItemID(kMarsCard))
+ return kMarsCard;
+ if (playerHasItemID(kNitrogenCanister))
+ return kNitrogenCanister;
+ if (playerHasItemID(kCrowbar))
+ return kCrowbar;
+ if (playerHasItemID(kAirMask))
+ return kAirMask;
+
+ // Should never get this far...
+ error("Could not find item to delete");
+
+ return kNoItemID;
+}
+
+uint PegasusEngine::getNeighborhoodCD(const NeighborhoodID neighborhood) const {
+ switch (neighborhood) {
+ case kCaldoriaID:
+ case kNoradAlphaID:
+ case kNoradSubChaseID:
+ return 1;
+ case kFullTSAID:
+ case kPrehistoricID:
+ return 2;
+ case kMarsID:
+ return 3;
+ case kWSCID:
+ case kNoradDeltaID:
+ return 4;
+ case kTinyTSAID:
+ // Tiny TSA exists on three of the CD's, so just continue
+ // with the CD we're on
+ return _currentCD;
+ }
+
+ // Can't really happen, but it's a good fallback anyway :P
+ return 1;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
new file mode 100644
index 0000000000..2a8ba22470
--- /dev/null
+++ b/engines/pegasus/pegasus.h
@@ -0,0 +1,327 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_H
+#define PEGASUS_H
+
+#include "common/list.h"
+#include "common/macresman.h"
+#include "common/rect.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/util.h"
+
+#include "engines/engine.h"
+
+#include "pegasus/graphics.h"
+#include "pegasus/hotspot.h"
+#include "pegasus/input.h"
+#include "pegasus/notification.h"
+#include "pegasus/timers.h"
+#include "pegasus/items/autodragger.h"
+#include "pegasus/items/inventory.h"
+#include "pegasus/items/itemdragger.h"
+#include "pegasus/neighborhood/neighborhood.h"
+
+namespace Common {
+ class RandomSource;
+}
+
+namespace Video {
+ class VideoDecoder;
+}
+
+namespace Pegasus {
+
+class PegasusConsole;
+struct PegasusGameDescription;
+class SoundManager;
+class GraphicsManager;
+class Idler;
+class Cursor;
+class TimeBase;
+class GameMenu;
+class InventoryItem;
+class BiochipItem;
+class Neighborhood;
+
+class PegasusEngine : public ::Engine, public InputHandler, public NotificationManager {
+friend class InputHandler;
+
+public:
+ PegasusEngine(OSystem *syst, const PegasusGameDescription *gamedesc);
+ virtual ~PegasusEngine();
+
+ // Engine stuff
+ const PegasusGameDescription *_gameDescription;
+ bool hasFeature(EngineFeature f) const;
+ GUI::Debugger *getDebugger();
+ bool canLoadGameStateCurrently();
+ bool canSaveGameStateCurrently();
+ Common::Error loadGameState(int slot);
+ Common::Error saveGameState(int slot, const Common::String &desc);
+
+ // Base classes
+ GraphicsManager *_gfx;
+ Common::MacResManager *_resFork;
+ Cursor *_cursor;
+
+ // Menu
+ void useMenu(GameMenu *menu);
+ bool checkGameMenu();
+
+ // Misc.
+ bool isDemo() const;
+ void addIdler(Idler *idler);
+ void removeIdler(Idler *idler);
+ void addTimeBase(TimeBase *timeBase);
+ void removeTimeBase(TimeBase *timeBase);
+ void delayShell(TimeValue time, TimeScale scale);
+ void resetIntroTimer();
+ void introTimerExpired();
+ void refreshDisplay();
+ bool playerAlive();
+ void processShell();
+ void checkCallBacks();
+ void createInterface();
+ void setGameMode(const GameMode);
+ GameMode getGameMode() const { return _gameMode; }
+ uint getRandomBit();
+ uint getRandomNumber(uint max);
+ void shuffleArray(int32 *arr, int32 count);
+ void drawScaledFrame(const Graphics::Surface *frame, uint16 x, uint16 y);
+ HotspotList &getAllHotspots() { return _allHotspots; }
+
+ // Energy
+ void setLastEnergyValue(const int32 value) { _savedEnergyValue = value; }
+ int32 getSavedEnergyValue() { return _savedEnergyValue; }
+
+ // Death
+ void setEnergyDeathReason(const DeathReason reason) { _deathReason = reason; }
+ DeathReason getEnergyDeathReason() { return _deathReason; }
+ void resetEnergyDeathReason();
+ void die(const DeathReason);
+ void playEndMessage();
+
+ // Volume
+ uint16 getSoundFXLevel() { return _FXLevel; }
+ void setSoundFXLevel(uint16);
+ uint16 getAmbienceLevel() { return _ambientLevel; }
+ void setAmbienceLevel(uint16);
+
+ // Items
+ ItemList &getAllItems() { return _allItems; }
+ bool playerHasItem(const Item *);
+ bool playerHasItemID(const ItemID);
+ void checkFlashlight();
+ bool itemInLocation(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
+
+ // Inventory Items
+ InventoryItem *getCurrentInventoryItem();
+ bool itemInInventory(InventoryItem *);
+ bool itemInInventory(ItemID);
+ Inventory *getItemsInventory() { return &_items; }
+ InventoryResult addItemToInventory(InventoryItem *);
+ void removeAllItemsFromInventory();
+ InventoryResult removeItemFromInventory(InventoryItem *);
+ uint32 countInventoryItems() { return _items.getNumItems(); }
+
+ // Biochips
+ BiochipItem *getCurrentBiochip();
+ bool itemInBiochips(BiochipItem *);
+ bool itemInBiochips(ItemID);
+ Inventory *getBiochipsInventory() { return &_biochips; }
+ void removeAllItemsFromBiochips();
+ InventoryResult addItemToBiochips(BiochipItem *);
+
+ // AI
+ Common::String getBriefingMovie();
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+ bool canSolve();
+ void prepareForAIHint(const Common::String &);
+ void cleanUpAfterAIHint(const Common::String &);
+ Common::SeekableReadStream *_aiSaveStream;
+
+ // Neighborhood
+ void jumpToNewEnvironment(const NeighborhoodID, const RoomID, const DirectionConstant);
+ NeighborhoodID getCurrentNeighborhoodID() const;
+
+ // Dragging
+ void dragItem(const Input &, Item *, DragType);
+ bool isDragging() const { return _dragType != kDragNoDrag; }
+ DragType getDragType() const { return _dragType; }
+ Item *getDraggingItem() const { return _draggingItem; }
+ void dragTerminated(const Input &);
+ void autoDragItemIntoRoom(Item *, Sprite *);
+ void autoDragItemIntoInventory(Item *, Sprite*);
+
+ // Save/Load
+ void makeContinuePoint();
+ bool swapSaveAllowed(bool allow) {
+ bool old = _saveAllowed;
+ _saveAllowed = allow;
+ return old;
+ }
+ bool swapLoadAllowed(bool allow) {
+ bool old = _loadAllowed;
+ _loadAllowed = allow;
+ return old;
+ }
+ void requestSave() { _saveRequested = true; }
+ bool saveRequested() const { return _saveRequested; }
+ void requestLoad() { _loadRequested = true; }
+ bool loadRequested() const { return _loadRequested; }
+
+protected:
+ Common::Error run();
+ void pauseEngineIntern(bool pause);
+
+ Notification _shellNotification;
+ virtual void receiveNotification(Notification *notification, const NotificationFlags flags);
+
+ void handleInput(const Input &input, const Hotspot *cursorSpot);
+ virtual bool isClickInput(const Input &, const Hotspot *);
+ virtual InputBits getClickFilter();
+
+ void clickInHotspot(const Input &, const Hotspot *);
+ void activateHotspots(void);
+
+ void updateCursor(const Common::Point, const Hotspot *);
+ bool wantsCursor();
+
+private:
+ // Console
+ PegasusConsole *_console;
+
+ // Intro
+ void runIntro();
+ void stopIntroTimer();
+ bool detectOpeningClosingDirectory();
+ Common::String _introDirectory;
+ FuseFunction *_introTimer;
+
+ // Idlers
+ Idler *_idlerHead;
+ void giveIdleTime();
+
+ // Items
+ ItemList _allItems;
+ void createItems();
+ void createItem(ItemID itemID, NeighborhoodID neighborhoodID, RoomID roomID, DirectionConstant direction);
+ Inventory _items;
+ Inventory _biochips;
+ ItemID _currentItemID;
+ ItemID _currentBiochipID;
+ void destroyInventoryItem(const ItemID itemID);
+ ItemID pickItemToDestroy();
+
+ // TimeBases
+ Common::List<TimeBase *> _timeBases;
+
+ // Save/Load
+ bool loadFromStream(Common::ReadStream *stream);
+ bool writeToStream(Common::WriteStream *stream, int saveType);
+ void loadFromContinuePoint();
+ void writeContinueStream(Common::WriteStream *stream);
+ Common::SeekableReadStream *_continuePoint;
+ bool _saveAllowed, _loadAllowed; // It's so nice that this was in the original code already :P
+ Common::Error showLoadDialog();
+ Common::Error showSaveDialog();
+ bool _saveRequested, _loadRequested;
+
+ // Misc.
+ Hotspot _returnHotspot;
+ HotspotList _allHotspots;
+ InputHandler *_savedHandler;
+ void showTempScreen(const Common::String &fileName);
+ bool playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 y);
+ void throwAwayEverything();
+ void shellGameInput(const Input &input, const Hotspot *cursorSpot);
+ Common::RandomSource *_rnd;
+ void doSubChase();
+ uint getNeighborhoodCD(const NeighborhoodID neighborhood) const;
+ uint _currentCD;
+
+ // Menu
+ GameMenu *_gameMenu;
+ void doGameMenuCommand(const GameMenuCommand);
+ void doInterfaceOverview();
+ ScreenDimmer _screenDimmer;
+ void pauseMenu(bool menuUp);
+
+ // Energy
+ int32 _savedEnergyValue;
+
+ // Death
+ DeathReason _deathReason;
+ void doDeath();
+
+ // Neighborhood
+ Neighborhood *_neighborhood;
+ void useNeighborhood(Neighborhood *neighborhood);
+ void performJump(NeighborhoodID start);
+ void startNewGame();
+ void startNeighborhood();
+ void makeNeighborhood(NeighborhoodID, Neighborhood *&);
+
+ // Sound
+ uint16 _ambientLevel;
+ uint16 _FXLevel;
+
+ // Game Mode
+ GameMode _gameMode;
+ bool _switchModesSync;
+ void switchGameMode(const GameMode, const GameMode);
+ bool canSwitchGameMode(const GameMode, const GameMode);
+
+ // Dragging
+ ItemDragger _itemDragger;
+ Item *_draggingItem;
+ Sprite *_draggingSprite;
+ DragType _dragType;
+ AutoDragger _autoDragger;
+
+ // Interface
+ void toggleInventoryDisplay();
+ void toggleBiochipDisplay();
+ void raiseInventoryDrawer();
+ void raiseBiochipDrawer();
+ void lowerInventoryDrawer();
+ void lowerBiochipDrawer();
+ void raiseInventoryDrawerSync();
+ void raiseBiochipDrawerSync();
+ void lowerInventoryDrawerSync();
+ void lowerBiochipDrawerSync();
+ void showInfoScreen();
+ void hideInfoScreen();
+ void toggleInfo();
+ Movie _bigInfoMovie, _smallInfoMovie;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/scoring.h b/engines/pegasus/scoring.h
new file mode 100644
index 0000000000..fbf8641ecb
--- /dev/null
+++ b/engines/pegasus/scoring.h
@@ -0,0 +1,281 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_SCORING_H
+#define PEGASUS_SCORING_H
+
+#include "pegasus/types.h"
+
+namespace Pegasus {
+
+/////////////////////////////////////////////
+//
+// Scoring.
+
+static const CoordType kDeathScreenScoreLeft = 151;
+static const CoordType kDeathScreenScoreTop = 212;
+static const CoordType kDeathScreenScoreWidth = 124;
+static const CoordType kDeathScreenScoreHeight = 12;
+static const CoordType kDeathScreenScoreSkipVert = -16;
+
+// Caldoria & TSA
+
+static const GameScoreType kSawINNScore = 5;
+static const GameScoreType kTookShowerScore = 2;
+static const GameScoreType kFixedHairScore = 2;
+static const GameScoreType kGotKeyCardScore = 5;
+static const GameScoreType kReadPaperScore = 2;
+static const GameScoreType kLookThroughTelescopeScore = 2;
+static const GameScoreType kSawCaldoriaKioskScore = 2;
+static const GameScoreType kGoToTSAScore = 3;
+
+static const GameScoreType kEnterTSAScore = 2;
+static const GameScoreType kSawBust1Score = 2;
+static const GameScoreType kSawBust2Score = 2;
+static const GameScoreType kSawBust3Score = 2;
+static const GameScoreType kSawBust4Score = 2;
+static const GameScoreType kSawBust5Score = 2;
+static const GameScoreType kSawBust6Score = 2;
+static const GameScoreType kSawTheoryScore = 4;
+static const GameScoreType kSawBackgroundScore = 4;
+static const GameScoreType kSawProcedureScore = 4;
+static const GameScoreType kGotJourneymanKeyScore = 5;
+static const GameScoreType kGotPegasusBiochipScore = 5;
+static const GameScoreType kGotBiosuitScore = 5;
+static const GameScoreType kGoToPrehistoricScore = 5;
+
+static const GameScoreType kPutLogInReaderScore = 5;
+static const GameScoreType kSawCaldoriaNormalScore = 2;
+static const GameScoreType kSawCaldoriaAlteredScore = 2;
+static const GameScoreType kSawNoradNormalScore = 2;
+static const GameScoreType kSawNoradAlteredScore = 2;
+static const GameScoreType kSawMarsNormalScore = 2;
+static const GameScoreType kSawMarsAlteredScore = 2;
+static const GameScoreType kSawWSCNormalScore = 2;
+static const GameScoreType kSawWSCAlteredScore = 2;
+static const GameScoreType kWentToReadyRoom2Score = 5;
+static const GameScoreType kWentAfterSinclairScore = 5;
+static const GameScoreType kUsedCardBombScore = 10;
+static const GameScoreType kShieldedCardBombScore = 5;
+static const GameScoreType kStunnedSinclairScore = 10;
+static const GameScoreType kDisarmedNukeScore = 10;
+
+static const GameScoreType kMaxCaldoriaTSAScoreBefore = kSawINNScore +
+ kTookShowerScore +
+ kFixedHairScore +
+ kGotKeyCardScore +
+ kReadPaperScore +
+ kLookThroughTelescopeScore +
+ kSawCaldoriaKioskScore +
+ kGoToTSAScore +
+ kEnterTSAScore +
+ kSawBust1Score +
+ kSawBust2Score +
+ kSawBust3Score +
+ kSawBust4Score +
+ kSawBust5Score +
+ kSawBust6Score +
+ kSawTheoryScore +
+ kSawBackgroundScore +
+ kSawProcedureScore +
+ kGotJourneymanKeyScore +
+ kGotPegasusBiochipScore +
+ kGotBiosuitScore +
+ kGoToPrehistoricScore +
+ kPutLogInReaderScore +
+ kSawCaldoriaNormalScore +
+ kSawCaldoriaAlteredScore +
+ kSawNoradNormalScore +
+ kSawNoradAlteredScore +
+ kSawMarsNormalScore +
+ kSawMarsAlteredScore +
+ kSawWSCNormalScore +
+ kSawWSCAlteredScore +
+ kWentToReadyRoom2Score;
+
+static const GameScoreType kMaxCaldoriaTSAScoreAfter = kWentAfterSinclairScore +
+ kUsedCardBombScore +
+ kShieldedCardBombScore +
+ kStunnedSinclairScore +
+ kDisarmedNukeScore;
+
+static const GameScoreType kMaxCaldoriaTSAScore = kMaxCaldoriaTSAScoreBefore +
+ kMaxCaldoriaTSAScoreAfter;
+
+// Prehistoric
+
+static const GameScoreType kThrewBreakerScore = 10;
+static const GameScoreType kExtendedBridgeScore = 10;
+static const GameScoreType kGotHistoricalLogScore = 5;
+static const GameScoreType kFinishedPrehistoricScore = 10;
+
+static const GameScoreType kMaxPrehistoricScore = kThrewBreakerScore +
+ kExtendedBridgeScore +
+ kGotHistoricalLogScore +
+ kFinishedPrehistoricScore;
+
+// Mars
+
+static const GameScoreType kThrownByRobotScore = 3;
+static const GameScoreType kGotMarsCardScore = 5;
+static const GameScoreType kSawMarsKioskScore = 2;
+static const GameScoreType kSawTransportMapScore = 2;
+static const GameScoreType kGotCrowBarScore = 5;
+static const GameScoreType kTurnedOnTransportScore = 5;
+static const GameScoreType kGotOxygenMaskScore = 5;
+static const GameScoreType kAvoidedRobotScore = 5;
+static const GameScoreType kActivatedPlatformScore = 2;
+static const GameScoreType kUsedLiquidNitrogenScore = 3;
+static const GameScoreType kUsedCrowBarScore = 3;
+static const GameScoreType kFoundCardBombScore = 4;
+static const GameScoreType kDisarmedCardBombScore = 8;
+static const GameScoreType kGotCardBombScore = 5;
+static const GameScoreType kThreadedMazeScore = 5;
+static const GameScoreType kThreadedGearRoomScore = 2;
+static const GameScoreType kEnteredShuttleScore = 2;
+static const GameScoreType kEnteredLaunchTubeScore = 4;
+static const GameScoreType kStoppedRobotsShuttleScore = 10;
+static const GameScoreType kGotMarsOpMemChipScore = 10;
+static const GameScoreType kFinishedMarsScore = 10;
+
+static const GameScoreType kMaxMarsScore = kThrownByRobotScore +
+ kGotMarsCardScore +
+ kSawMarsKioskScore +
+ kSawTransportMapScore +
+ kGotCrowBarScore +
+ kTurnedOnTransportScore +
+ kGotOxygenMaskScore +
+ kAvoidedRobotScore +
+ kActivatedPlatformScore +
+ kUsedLiquidNitrogenScore +
+ kUsedCrowBarScore +
+ kFoundCardBombScore +
+ kDisarmedCardBombScore +
+ kGotCardBombScore +
+ kThreadedMazeScore +
+ kThreadedGearRoomScore +
+ kEnteredShuttleScore +
+ kEnteredLaunchTubeScore +
+ kStoppedRobotsShuttleScore +
+ kGotMarsOpMemChipScore +
+ kFinishedMarsScore;
+
+// Norad
+
+static const GameScoreType kSawSecurityMonitorScore = 5;
+static const GameScoreType kFilledOxygenCanisterScore = 5;
+static const GameScoreType kFilledArgonCanisterScore = 5;
+static const GameScoreType kSawUnconsciousOperatorScore = 5;
+static const GameScoreType kWentThroughPressureDoorScore = 5;
+static const GameScoreType kPreppedSubScore = 5;
+static const GameScoreType kEnteredSubScore = 5;
+static const GameScoreType kExitedSubScore = 10;
+static const GameScoreType kSawRobotAt54NorthScore = 5;
+static const GameScoreType kPlayedWithClawScore = 5;
+static const GameScoreType kUsedRetinalChipScore = 5;
+static const GameScoreType kFinishedGlobeGameScore = 10;
+static const GameScoreType kStoppedNoradRobotScore = 10;
+static const GameScoreType kGotNoradOpMemChipScore = 10;
+static const GameScoreType kFinishedNoradScore = 10;
+
+static const GameScoreType kMaxNoradScore = kSawSecurityMonitorScore +
+ kFilledOxygenCanisterScore +
+ kFilledArgonCanisterScore +
+ kSawUnconsciousOperatorScore +
+ kWentThroughPressureDoorScore +
+ kPreppedSubScore +
+ kEnteredSubScore +
+ kExitedSubScore +
+ kSawRobotAt54NorthScore +
+ kPlayedWithClawScore +
+ kUsedRetinalChipScore +
+ kFinishedGlobeGameScore +
+ kStoppedNoradRobotScore +
+ kGotNoradOpMemChipScore +
+ kFinishedNoradScore;
+
+// WSC
+
+static const GameScoreType kRemovedDartScore = 5;
+static const GameScoreType kAnalyzedDartScore = 5;
+static const GameScoreType kBuiltAntidoteScore = 5;
+static const GameScoreType kGotSinclairKeyScore = 5;
+static const GameScoreType kGotArgonCanisterScore = 5;
+static const GameScoreType kGotNitrogenCanisterScore = 5;
+static const GameScoreType kPlayedWithMessagesScore = 2;
+static const GameScoreType kSawMorphExperimentScore = 3;
+static const GameScoreType kEnteredSinclairOfficeScore = 2;
+static const GameScoreType kSawBrochureScore = 3;
+static const GameScoreType kSawSinclairEntry1Score = 3;
+static const GameScoreType kSawSinclairEntry2Score = 3;
+static const GameScoreType kSawSinclairEntry3Score = 3;
+static const GameScoreType kSawWSCDirectoryScore = 3;
+static const GameScoreType kUsedCrowBarInWSCScore = 5;
+static const GameScoreType kFinishedPlasmaDodgeScore = 10;
+static const GameScoreType kOpenedCatwalkScore = 3;
+static const GameScoreType kStoppedWSCRobotScore = 10;
+static const GameScoreType kGotWSCOpMemChipScore = 10;
+static const GameScoreType kFinishedWSCScore = 10;
+
+static const GameScoreType kMaxWSCScore = kRemovedDartScore +
+ kAnalyzedDartScore +
+ kBuiltAntidoteScore +
+ kGotSinclairKeyScore +
+ kGotArgonCanisterScore +
+ kGotNitrogenCanisterScore +
+ kPlayedWithMessagesScore +
+ kSawMorphExperimentScore +
+ kEnteredSinclairOfficeScore +
+ kSawBrochureScore +
+ kSawSinclairEntry1Score +
+ kSawSinclairEntry2Score +
+ kSawSinclairEntry3Score +
+ kSawWSCDirectoryScore +
+ kUsedCrowBarInWSCScore +
+ kFinishedPlasmaDodgeScore +
+ kOpenedCatwalkScore +
+ kStoppedWSCRobotScore +
+ kGotWSCOpMemChipScore +
+ kFinishedWSCScore;
+
+// Gandhi
+
+static const GameScoreType kMarsGandhiScore = 10;
+static const GameScoreType kNoradGandhiScore = 10;
+static const GameScoreType kWSCGandhiScore = 10;
+
+static const GameScoreType kMaxGandhiScore = kMarsGandhiScore +
+ kNoradGandhiScore +
+ kWSCGandhiScore;
+
+static const GameScoreType kMaxTotalScore = kMaxCaldoriaTSAScore +
+ kMaxPrehistoricScore +
+ kMaxMarsScore +
+ kMaxNoradScore +
+ kMaxWSCScore +
+ kMaxGandhiScore;
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/sound.cpp b/engines/pegasus/sound.cpp
new file mode 100644
index 0000000000..bf15858e80
--- /dev/null
+++ b/engines/pegasus/sound.cpp
@@ -0,0 +1,181 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "audio/audiostream.h"
+#include "audio/decoders/aiff.h"
+#include "audio/decoders/quicktime.h"
+#include "common/file.h"
+#include "common/system.h"
+
+#include "pegasus/fader.h"
+#include "pegasus/sound.h"
+
+namespace Pegasus {
+
+Sound::Sound() {
+ _stream = 0;
+ _volume = 0xFF;
+ _fader = 0;
+}
+
+Sound::~Sound() {
+ disposeSound();
+}
+
+void Sound::disposeSound() {
+ stopSound();
+ delete _stream; _stream = 0;
+}
+
+void Sound::initFromAIFFFile(const Common::String &fileName) {
+ disposeSound();
+
+ Common::File *file = new Common::File();
+ if (!file->open(fileName)) {
+ warning("Failed to open AIFF file '%s'", fileName.c_str());
+ delete file;
+ return;
+ }
+
+ _stream = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
+}
+
+void Sound::initFromQuickTime(const Common::String &fileName) {
+ disposeSound();
+
+ _stream = Audio::makeQuickTimeStream(fileName);
+
+ if (!_stream)
+ warning("Failed to open QuickTime file '%s'", fileName.c_str());
+}
+
+void Sound::attachFader(SoundFader *fader) {
+ if (_fader)
+ _fader->attachSound(0);
+
+ _fader = fader;
+
+ if (_fader)
+ _fader->attachSound(this);
+}
+
+void Sound::playSound() {
+ if (!isSoundLoaded())
+ return;
+
+ stopSound();
+
+ if (_fader)
+ setVolume(_fader->getFaderValue());
+
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, _stream, -1, _volume, 0, DisposeAfterUse::NO);
+}
+
+void Sound::loopSound() {
+ if (!isSoundLoaded())
+ return;
+
+ stopSound();
+
+ // Create a looping stream
+ Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
+
+ // Assume that if there is a fader, we're going to fade the sound in.
+ if (_fader)
+ setVolume(0);
+
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, loopStream, -1, _volume, 0, DisposeAfterUse::YES);
+}
+
+void Sound::playSoundSegment(uint32 start, uint32 end) {
+ if (!isSoundLoaded())
+ return;
+
+ stopSound();
+
+ Audio::AudioStream *subStream = new Audio::SubSeekableAudioStream(_stream, Audio::Timestamp(0, start, 600), Audio::Timestamp(0, end, 600), DisposeAfterUse::NO);
+
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, subStream, -1, _volume, 0, DisposeAfterUse::YES);
+}
+
+void Sound::stopSound() {
+ g_system->getMixer()->stopHandle(_handle);
+}
+
+void Sound::setVolume(const uint16 volume) {
+ // Clipping the volume to [0x00, 0xFF] instead of Apple's [0, 0x100]
+ // We store the volume in case SetVolume is called before the sound starts
+
+ _volume = (volume == 0x100) ? 0xFF : volume;
+ g_system->getMixer()->setChannelVolume(_handle, _volume);
+}
+
+bool Sound::isPlaying() {
+ return isSoundLoaded() && g_system->getMixer()->isSoundHandleActive(_handle);
+}
+
+bool Sound::isSoundLoaded() const {
+ return _stream != 0;
+}
+
+SoundTimeBase::SoundTimeBase() {
+ setScale(600);
+ _startScale = 600;
+ _stopScale = 600;
+ _setToStart = false;
+}
+
+void SoundTimeBase::playSoundSegment(uint32 startTime, uint32 endTime) {
+ _startTime = startTime;
+ _stopTime = endTime;
+ _setToStart = true;
+ _time = Common::Rational(startTime, getScale());
+ setRate(1);
+ Sound::playSoundSegment(startTime, endTime);
+}
+
+void SoundTimeBase::updateTime() {
+ if (_setToStart) {
+ if (isPlaying()) {
+ // Not at the end, let's get the time
+ uint numFrames = g_system->getMixer()->getSoundElapsedTime(_handle) * 600 / 1000;
+
+ // WORKAROUND: Our mixer is woefully inaccurate and quite often returns
+ // times that exceed the actual length of the clip. We'll just fake times
+ // that are under the final time to ensure any trigger for the end time is
+ // only sent when the sound has actually stopped.
+ if (numFrames >= (_stopTime - _startTime))
+ numFrames = _stopTime - _startTime - 1;
+
+ _time = Common::Rational(_startTime + numFrames, getScale());
+ } else {
+ // Assume we reached the end
+ _setToStart = false;
+ _time = Common::Rational(_stopTime, getScale());
+ }
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/sound.h b/engines/pegasus/sound.h
new file mode 100644
index 0000000000..57cfd52e41
--- /dev/null
+++ b/engines/pegasus/sound.h
@@ -0,0 +1,108 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_SOUND_H
+#define PEGASUS_SOUND_H
+
+#include "audio/mixer.h"
+#include "common/str.h"
+#include "pegasus/timers.h"
+
+namespace Audio {
+ class SeekableAudioStream;
+}
+
+namespace Pegasus {
+
+class SoundFader;
+
+// Things you might want to do with sound:
+// - Start it
+// - Stop it
+// - Loop it
+// - Pause it
+// - Set the volume
+// - Set the pitch (rate)
+// - Pan the sound
+// - Change these settings dynamically over time
+
+class Sound {
+public:
+ Sound();
+ ~Sound();
+
+ // We only have one access point here because we should
+ // only be opening an AIFF file from a file name. We're
+ // not using the resource fork string resources.
+ void initFromAIFFFile(const Common::String &fileName);
+
+ // Unlike the original game, we're going to use a regular
+ // audio stream for sound spots. The original treated them
+ // as movies.
+ void initFromQuickTime(const Common::String &fileName);
+
+ void disposeSound();
+ bool isSoundLoaded() const;
+ void playSound();
+ void loopSound();
+ void playSoundSegment(uint32 start, uint32 end);
+ void stopSound();
+ void setVolume(const uint16 volume);
+ bool isPlaying();
+
+ void attachFader(SoundFader *fader);
+
+protected:
+ Audio::SeekableAudioStream *_stream;
+ Audio::SoundHandle _handle;
+ byte _volume;
+
+ SoundFader *_fader;
+};
+
+// TODO: Make this class follow TimeBase better
+// Right now it's just a loose wrapper to plug callbacks
+// into sounds. Since this is only used for spot sounds,
+// I'm not too worried about it right now as its usage
+// is very limited.
+// At the very least, the regular TimeBase functions for
+// setting/getting should be neutered.
+class SoundTimeBase : public Sound, public TimeBase {
+public:
+ SoundTimeBase();
+ ~SoundTimeBase() {}
+
+ void playSoundSegment(uint32 start, uint32 end);
+
+protected:
+ void updateTime();
+
+private:
+ bool _setToStart;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp
new file mode 100644
index 0000000000..e9e0958f9d
--- /dev/null
+++ b/engines/pegasus/surface.cpp
@@ -0,0 +1,392 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/file.h"
+#include "common/macresman.h"
+#include "common/stream.h"
+#include "common/system.h"
+#include "graphics/surface.h"
+#include "graphics/decoders/pict.h"
+#include "video/video_decoder.h"
+
+#include "pegasus/pegasus.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+Surface::Surface() {
+ _ownsSurface = false;
+ _surface = 0;
+}
+
+Surface::~Surface() {
+ deallocateSurface();
+}
+
+void Surface::deallocateSurface() {
+ if (_surface) {
+ if (_ownsSurface) {
+ _surface->free();
+ delete _surface;
+ }
+
+ _surface = 0;
+ _bounds = Common::Rect();
+ _ownsSurface = false;
+ }
+}
+
+void Surface::shareSurface(Surface *surface) {
+ deallocateSurface();
+
+ if (surface) {
+ _ownsSurface = false;
+ _surface = surface->getSurface();
+ surface->getSurfaceBounds(_bounds);
+ }
+}
+
+void Surface::allocateSurface(const Common::Rect &bounds) {
+ deallocateSurface();
+
+ if (bounds.isEmpty())
+ return;
+
+ _bounds = bounds;
+ _surface = new Graphics::Surface();
+ _surface->create(bounds.width(), bounds.height(), g_system->getScreenFormat());
+ _ownsSurface = true;
+}
+
+void Surface::getImageFromPICTFile(const Common::String &fileName) {
+ Common::File pict;
+ if (!pict.open(fileName))
+ error("Could not open picture '%s'", fileName.c_str());
+
+ getImageFromPICTStream(&pict);
+}
+
+void Surface::getImageFromPICTResource(Common::MacResManager *resFork, uint16 id) {
+ Common::SeekableReadStream *res = resFork->getResource(MKTAG('P', 'I', 'C', 'T'), id);
+ if (!res)
+ error("Could not open PICT resource %d from '%s'", id, resFork->getBaseFileName().c_str());
+
+ getImageFromPICTStream(res);
+ delete res;
+}
+
+void Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) {
+ Graphics::PICTDecoder pict;
+
+ if (!pict.loadStream(*stream))
+ error("Failed to load PICT image");
+
+ _surface = pict.getSurface()->convertTo(g_system->getScreenFormat(), pict.getPalette());
+ _ownsSurface = true;
+ _bounds = Common::Rect(0, 0, _surface->w, _surface->h);
+}
+
+void Surface::getImageFromMovieFrame(Video::VideoDecoder *video, TimeValue time) {
+ video->seek(Audio::Timestamp(0, time, 600));
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame) {
+ if (!_surface)
+ _surface = new Graphics::Surface();
+
+ _surface->copyFrom(*frame);
+ _ownsSurface = true;
+ _bounds = Common::Rect(0, 0, _surface->w, _surface->h);
+ } else {
+ deallocateSurface();
+ }
+}
+
+void Surface::copyToCurrentPort() const {
+ copyToCurrentPort(_bounds);
+}
+
+void Surface::copyToCurrentPortTransparent() const {
+ copyToCurrentPortTransparent(_bounds);
+}
+
+void Surface::copyToCurrentPort(const Common::Rect &rect) const {
+ copyToCurrentPort(rect, rect);
+}
+
+void Surface::copyToCurrentPortTransparent(const Common::Rect &rect) const {
+ copyToCurrentPortTransparent(rect, rect);
+}
+
+void Surface::copyToCurrentPort(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
+ byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
+
+ int lineSize = srcRect.width() * _surface->format.bytesPerPixel;
+
+ for (int y = 0; y < srcRect.height(); y++) {
+ memcpy(dst, src, lineSize);
+ src += _surface->pitch;
+ dst += screen->pitch;
+ }
+}
+
+void Surface::copyToCurrentPortTransparent(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
+ byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
+
+ int lineSize = srcRect.width() * _surface->format.bytesPerPixel;
+
+ for (int y = 0; y < srcRect.height(); y++) {
+ for (int x = 0; x < srcRect.width(); x++) {
+ if (g_system->getScreenFormat().bytesPerPixel == 2) {
+ uint16 color = READ_UINT16(src);
+ if (!isTransparent(color))
+ memcpy(dst, src, 2);
+ } else if (g_system->getScreenFormat().bytesPerPixel == 4) {
+ uint32 color = READ_UINT32(src);
+ if (!isTransparent(color))
+ memcpy(dst, src, 4);
+ }
+
+ src += g_system->getScreenFormat().bytesPerPixel;
+ dst += g_system->getScreenFormat().bytesPerPixel;
+ }
+
+ src += _surface->pitch - lineSize;
+ dst += screen->pitch - lineSize;
+ }
+}
+
+void Surface::copyToCurrentPortMasked(const Common::Rect &srcRect, const Common::Rect &dstRect, const Surface *mask) const {
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
+ byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
+
+ int lineSize = srcRect.width() * _surface->format.bytesPerPixel;
+
+ for (int y = 0; y < srcRect.height(); y++) {
+ byte *maskSrc = (byte *)mask->getSurface()->getBasePtr(0, y);
+
+ for (int x = 0; x < srcRect.width(); x++) {
+ if (g_system->getScreenFormat().bytesPerPixel == 2) {
+ uint16 color = READ_UINT16(maskSrc);
+ if (!isTransparent(color))
+ memcpy(dst, src, 2);
+ } else if (g_system->getScreenFormat().bytesPerPixel == 4) {
+ uint32 color = READ_UINT32(maskSrc);
+ if (!isTransparent(color))
+ memcpy(dst, src, 4);
+ }
+
+ src += g_system->getScreenFormat().bytesPerPixel;
+ maskSrc += g_system->getScreenFormat().bytesPerPixel;
+ dst += g_system->getScreenFormat().bytesPerPixel;
+ }
+
+ src += _surface->pitch - lineSize;
+ dst += screen->pitch - lineSize;
+ }
+}
+
+void Surface::copyToCurrentPortTransparentGlow(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
+ // This is the same as copyToCurrentPortTransparent(), but turns the red value of each
+ // pixel all the way up.
+
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
+ byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
+
+ int lineSize = srcRect.width() * _surface->format.bytesPerPixel;
+
+ for (int y = 0; y < srcRect.height(); y++) {
+ for (int x = 0; x < srcRect.width(); x++) {
+ if (g_system->getScreenFormat().bytesPerPixel == 2) {
+ uint16 color = READ_UINT16(src);
+ if (!isTransparent(color))
+ WRITE_UINT16(dst, getGlowColor(color));
+ } else if (g_system->getScreenFormat().bytesPerPixel == 4) {
+ uint32 color = READ_UINT32(src);
+ if (!isTransparent(color))
+ WRITE_UINT32(dst, getGlowColor(color));
+ }
+
+ src += g_system->getScreenFormat().bytesPerPixel;
+ dst += g_system->getScreenFormat().bytesPerPixel;
+ }
+
+ src += _surface->pitch - lineSize;
+ dst += screen->pitch - lineSize;
+ }
+}
+
+void Surface::scaleTransparentCopy(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
+ // I'm doing simple linear scaling here
+ // dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH);
+
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+
+ int srcW = srcRect.width();
+ int srcH = srcRect.height();
+ int dstW = dstRect.width();
+ int dstH = dstRect.height();
+
+ for (int y = 0; y < dstH; y++) {
+ for (int x = 0; x < dstW; x++) {
+ if (g_system->getScreenFormat().bytesPerPixel == 2) {
+ uint16 color = READ_UINT16((byte *)_surface->getBasePtr(
+ x * srcW / dstW + srcRect.left,
+ y * srcH / dstH + srcRect.top));
+ if (!isTransparent(color))
+ WRITE_UINT16((byte *)screen->getBasePtr(x + dstRect.left, y + dstRect.top), color);
+ } else if (g_system->getScreenFormat().bytesPerPixel == 4) {
+ uint32 color = READ_UINT32((byte *)_surface->getBasePtr(
+ x * srcW / dstW + srcRect.left,
+ y * srcH / dstH + srcRect.top));
+ if (!isTransparent(color))
+ WRITE_UINT32((byte *)screen->getBasePtr(x + dstRect.left, y + dstRect.top), color);
+ }
+ }
+ }
+}
+
+void Surface::scaleTransparentCopyGlow(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
+ // This is the same as scaleTransparentCopy(), but turns the red value of each
+ // pixel all the way up.
+
+ Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+
+ int srcW = srcRect.width();
+ int srcH = srcRect.height();
+ int dstW = dstRect.width();
+ int dstH = dstRect.height();
+
+ for (int y = 0; y < dstH; y++) {
+ for (int x = 0; x < dstW; x++) {
+ if (g_system->getScreenFormat().bytesPerPixel == 2) {
+ uint16 color = READ_UINT16((byte *)_surface->getBasePtr(
+ x * srcW / dstW + srcRect.left,
+ y * srcH / dstH + srcRect.top));
+ if (!isTransparent(color))
+ WRITE_UINT16((byte *)screen->getBasePtr(x + dstRect.left, y + dstRect.top), getGlowColor(color));
+ } else if (g_system->getScreenFormat().bytesPerPixel == 4) {
+ uint32 color = READ_UINT32((byte *)_surface->getBasePtr(
+ x * srcW / dstW + srcRect.left,
+ y * srcH / dstH + srcRect.top));
+ if (!isTransparent(color))
+ WRITE_UINT32((byte *)screen->getBasePtr(x + dstRect.left, y + dstRect.top), getGlowColor(color));
+ }
+ }
+ }
+}
+
+uint32 Surface::getGlowColor(uint32 color) const {
+ // Can't just 'or' it on like the original did :P
+ byte r, g, b;
+ g_system->getScreenFormat().colorToRGB(color, r, g, b);
+ return g_system->getScreenFormat().RGBToColor(0xff, g, b);
+}
+
+bool Surface::isTransparent(uint32 color) const {
+ // HACK: Seems we're truncating some color data somewhere...
+ uint32 transColor1 = g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff);
+ uint32 transColor2 = g_system->getScreenFormat().RGBToColor(0xf8, 0xf8, 0xf8);
+
+ return color == transColor1 || color == transColor2;
+}
+
+PixelImage::PixelImage() {
+ _transparent = false;
+}
+
+void PixelImage::drawImage(const Common::Rect &sourceBounds, const Common::Rect &destBounds) {
+ if (!isSurfaceValid())
+ return;
+
+ // Draw from sourceBounds to destBounds based on _transparent
+ if (_transparent)
+ copyToCurrentPortTransparent(sourceBounds, destBounds);
+ else
+ copyToCurrentPort(sourceBounds, destBounds);
+}
+
+void Frame::initFromPICTFile(const Common::String &fileName, bool transparent) {
+ getImageFromPICTFile(fileName);
+ _transparent = transparent;
+}
+
+void Frame::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent) {
+ getImageFromPICTResource(resFork, id);
+ _transparent = transparent;
+}
+
+void Frame::initFromMovieFrame(Video::VideoDecoder *video, TimeValue time, bool transparent) {
+ getImageFromMovieFrame(video, time);
+ _transparent = transparent;
+}
+
+void Picture::draw(const Common::Rect &r) {
+ Common::Rect surfaceBounds;
+ getSurfaceBounds(surfaceBounds);
+ Common::Rect r1 = r;
+
+ Common::Rect bounds;
+ getBounds(bounds);
+ surfaceBounds.moveTo(bounds.left, bounds.top);
+ r1 = r1.findIntersectingRect(surfaceBounds);
+ getSurfaceBounds(surfaceBounds);
+
+ Common::Rect r2 = r1;
+ r2.translate(surfaceBounds.left - bounds.left, surfaceBounds.top - bounds.top);
+ drawImage(r2, r1);
+}
+
+void Picture::initFromPICTFile(const Common::String &fileName, bool transparent) {
+ Frame::initFromPICTFile(fileName, transparent);
+
+ Common::Rect surfaceBounds;
+ getSurfaceBounds(surfaceBounds);
+ sizeElement(surfaceBounds.width(), surfaceBounds.height());
+}
+
+void Picture::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent) {
+ Frame::initFromPICTResource(resFork, id, transparent);
+
+ Common::Rect surfaceBounds;
+ getSurfaceBounds(surfaceBounds);
+ sizeElement(surfaceBounds.width(), surfaceBounds.height());
+}
+
+void Picture::initFromMovieFrame(Video::VideoDecoder *video, TimeValue time, bool transparent) {
+ Frame::initFromMovieFrame(video, time, transparent);
+
+ Common::Rect surfaceBounds;
+ getSurfaceBounds(surfaceBounds);
+ sizeElement(surfaceBounds.width(), surfaceBounds.height());
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h
new file mode 100644
index 0000000000..4588146fb4
--- /dev/null
+++ b/engines/pegasus/surface.h
@@ -0,0 +1,140 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_SURFACE_H
+#define PEGASUS_SURFACE_H
+
+#include "common/rect.h"
+#include "common/str.h"
+
+#include "pegasus/elements.h"
+#include "pegasus/types.h"
+
+namespace Common {
+ class MacResManager;
+}
+
+namespace Graphics {
+ struct Surface;
+}
+
+namespace Video {
+ class VideoDecoder;
+}
+
+namespace Pegasus {
+
+// Surface bounds are always normalized.
+
+class Surface {
+public:
+ Surface();
+ virtual ~Surface();
+
+ virtual void allocateSurface(const Common::Rect &);
+ virtual void deallocateSurface();
+ virtual void shareSurface(Surface *surface);
+ bool isSurfaceValid() const { return _surface != 0; }
+
+ Graphics::Surface *getSurface() const { return _surface; }
+ void getSurfaceBounds(Common::Rect &r) { r = _bounds; }
+
+ // None of the copyToCurrentPort* functions do any sanity checks.
+ // It's up to clients to make sure that the Surface is valid.
+ void copyToCurrentPort() const;
+ void copyToCurrentPortTransparent() const;
+ void copyToCurrentPort(const Common::Rect &) const;
+ void copyToCurrentPortTransparent(const Common::Rect &) const;
+ void copyToCurrentPort(const Common::Rect &, const Common::Rect &) const;
+ void copyToCurrentPortTransparent(const Common::Rect &, const Common::Rect &) const;
+ void copyToCurrentPortMasked(const Common::Rect &, const Common::Rect &, const Surface *) const;
+ void copyToCurrentPortTransparentGlow(const Common::Rect &, const Common::Rect &) const;
+ void scaleTransparentCopy(const Common::Rect &, const Common::Rect &) const;
+ void scaleTransparentCopyGlow(const Common::Rect &, const Common::Rect &) const;
+
+ virtual void getImageFromPICTFile(const Common::String &fileName);
+ virtual void getImageFromPICTResource(Common::MacResManager *resFork, uint16 id);
+ virtual void getImageFromMovieFrame(Video::VideoDecoder *, TimeValue);
+
+protected:
+ bool _ownsSurface;
+ Graphics::Surface *_surface;
+ Common::Rect _bounds;
+
+private:
+ void getImageFromPICTStream(Common::SeekableReadStream *stream);
+
+ uint32 getGlowColor(uint32 color) const;
+ bool isTransparent(uint32 color) const;
+};
+
+class PixelImage : public Surface {
+public:
+ PixelImage();
+ virtual ~PixelImage() {}
+
+ void drawImage(const Common::Rect &, const Common::Rect &);
+
+protected:
+ virtual void setTransparent(bool transparent) { _transparent = transparent; }
+
+ bool _transparent;
+};
+
+class Frame : public PixelImage {
+public:
+ Frame() {}
+ virtual ~Frame() {}
+
+ virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false);
+ virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false);
+ virtual void initFromMovieFrame(Video::VideoDecoder *, TimeValue, bool transparent = false);
+};
+
+class SpriteFrame : public Frame {
+friend class Sprite;
+public:
+ SpriteFrame() { _referenceCount = 0; }
+ virtual ~SpriteFrame() {}
+
+protected:
+ uint32 _referenceCount;
+};
+
+class Picture : public DisplayElement, public Frame {
+public:
+ Picture(const DisplayElementID id) : DisplayElement(id) {}
+ virtual ~Picture() {}
+
+ virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false);
+ virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false);
+ virtual void initFromMovieFrame(Video::VideoDecoder *, TimeValue, bool transparent = false);
+
+ virtual void draw(const Common::Rect &);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp
new file mode 100644
index 0000000000..3b875038cc
--- /dev/null
+++ b/engines/pegasus/timers.cpp
@@ -0,0 +1,429 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 "pegasus/pegasus.h"
+#include "pegasus/notification.h"
+#include "pegasus/timers.h"
+
+namespace Pegasus {
+
+Idler::Idler() {
+ _isIdling = false;
+ _nextIdler = 0;
+ _prevIdler = 0;
+}
+
+Idler::~Idler() {
+ stopIdling();
+}
+
+void Idler::startIdling() {
+ if (!isIdling()) {
+ ((PegasusEngine *)g_engine)->addIdler(this);
+ _isIdling = true;
+ }
+}
+
+void Idler::stopIdling() {
+ if (isIdling()) {
+ ((PegasusEngine *)g_engine)->removeIdler(this);
+ _isIdling = false;
+ }
+}
+
+TimeBase::TimeBase(const TimeScale preferredScale) {
+ _preferredScale = preferredScale;
+ _callBackList = 0;
+ _paused = false;
+ _flags = 0;
+ _lastMillis = 0;
+ _time = 0;
+ _rate = 0;
+ _startTime = 0;
+ _startScale = 1;
+ _stopTime = 0xffffffff;
+ _stopScale = 1;
+ _master = 0;
+ _pausedRate = 0;
+ _pauseStart = 0;
+
+ ((PegasusEngine *)g_engine)->addTimeBase(this);
+}
+
+TimeBase::~TimeBase() {
+ if (_master)
+ _master->_slaves.remove(this);
+
+ ((PegasusEngine *)g_engine)->removeTimeBase(this);
+ disposeAllCallBacks();
+
+ // TODO: Remove slaves? Make them remove themselves?
+}
+
+void TimeBase::setTime(const TimeValue time, const TimeScale scale) {
+ _time = Common::Rational(time, (scale == 0) ? _preferredScale : scale);
+ _lastMillis = 0;
+}
+
+TimeValue TimeBase::getTime(const TimeScale scale) {
+ return _time.getNumerator() * ((scale == 0) ? _preferredScale : scale) / _time.getDenominator();
+}
+
+void TimeBase::setRate(const Common::Rational rate) {
+ _rate = rate;
+
+ if (_rate == 0)
+ _paused = false;
+}
+
+Common::Rational TimeBase::getEffectiveRate() const {
+ return _rate * ((_master == 0) ? 1 : _master->getEffectiveRate());
+}
+
+void TimeBase::start() {
+ if (_paused)
+ _pausedRate = 1;
+ else
+ setRate(1);
+}
+
+void TimeBase::stop() {
+ setRate(0);
+ _paused = false;
+}
+
+void TimeBase::pause() {
+ if (isRunning() && !_paused) {
+ _pausedRate = getRate();
+ stop();
+ _paused = true;
+ _pauseStart = g_system->getMillis();
+ }
+}
+
+void TimeBase::resume() {
+ if (_paused) {
+ setRate(_pausedRate);
+ _paused = false;
+
+ if (isRunning())
+ _lastMillis += g_system->getMillis() - _pauseStart;
+ }
+}
+
+bool TimeBase::isRunning() {
+ if (_paused && _pausedRate != 0)
+ return true;
+
+ Common::Rational rate = getRate();
+
+ if (rate == 0)
+ return false;
+
+ if (getFlags() & kLoopTimeBase)
+ return true;
+
+ if (rate > 0)
+ return getTime() != getStop();
+
+ return getTime() != getStart();
+}
+
+void TimeBase::setStart(const TimeValue startTime, const TimeScale scale) {
+ _startTime = startTime;
+ _startScale = (scale == 0) ? _preferredScale : scale;
+}
+
+TimeValue TimeBase::getStart(const TimeScale scale) const {
+ if (scale)
+ return _startTime * scale / _startScale;
+
+ return _startTime * _preferredScale / _startScale;
+}
+
+void TimeBase::setStop(const TimeValue stopTime, const TimeScale scale) {
+ _stopTime = stopTime;
+ _stopScale = (scale == 0) ? _preferredScale : scale;
+}
+
+TimeValue TimeBase::getStop(const TimeScale scale) const {
+ if (scale)
+ return _stopTime * scale / _stopScale;
+
+ return _stopTime * _preferredScale / _stopScale;
+}
+
+void TimeBase::setSegment(const TimeValue startTime, const TimeValue stopTime, const TimeScale scale) {
+ setStart(startTime, scale);
+ setStop(stopTime, scale);
+}
+
+void TimeBase::getSegment(TimeValue &startTime, TimeValue &stopTime, const TimeScale scale) const {
+ startTime = getStart(scale);
+ stopTime = getStop(scale);
+}
+
+TimeValue TimeBase::getDuration(const TimeScale scale) const {
+ TimeValue startTime, stopTime;
+ getSegment(startTime, stopTime, scale);
+ return stopTime - startTime;
+}
+
+void TimeBase::setMasterTimeBase(TimeBase *tb) {
+ // TODO: We're just ignoring the master (except for effective rate)
+ // for now to simplify things
+ if (_master)
+ _master->_slaves.remove(this);
+
+ _master = tb;
+
+ if (_master)
+ _master->_slaves.push_back(this);
+}
+
+void TimeBase::updateTime() {
+ if (_lastMillis == 0) {
+ _lastMillis = g_system->getMillis();
+ } else {
+ uint32 curTime = g_system->getMillis();
+ if (_lastMillis == curTime) // No change
+ return;
+
+ _time += Common::Rational(curTime - _lastMillis, 1000) * getEffectiveRate();
+ _lastMillis = curTime;
+ }
+}
+
+void TimeBase::checkCallBacks() {
+ // Nothing to do if we're paused or not running
+ if (_paused || !isRunning())
+ return;
+
+ Common::Rational startTime = Common::Rational(_startTime, _startScale);
+ Common::Rational stopTime = Common::Rational(_stopTime, _stopScale);
+
+ // First step: update the times
+ updateTime();
+
+ // Clip time to the boundaries
+ if (_time >= stopTime)
+ _time = stopTime;
+ else if (_time <= startTime)
+ _time = startTime;
+
+ // TODO: Update the slaves?
+
+ Common::Rational time = Common::Rational(getTime(), getScale());
+
+ // Check if we've triggered any callbacks
+ for (TimeBaseCallBack *runner = _callBackList; runner != 0; runner = runner->_nextCallBack) {
+ if (runner->_hasBeenTriggered)
+ continue;
+
+ if (runner->_type == kCallBackAtTime && runner->_trigger == kTriggerTimeFwd) {
+ if (getTime() >= (runner->_param2 * _preferredScale / runner->_param3) && getRate() > 0) {
+ uint param2 = runner->_param2, param3 = runner->_param3;
+ runner->callBack();
+ // HACK: Only stop future time forward callbacks if the parameters have not been changed
+ // This fixes striding callbacks. Since only striding callbacks do this kind of
+ // craziness, I'm not too worried about this.
+ runner->_hasBeenTriggered = (runner->_param2 == param2 && runner->_param3 == param3);
+ }
+ } else if (runner->_type == kCallBackAtExtremes) {
+ if (runner->_trigger == kTriggerAtStop) {
+ if (time == stopTime) {
+ runner->callBack();
+ runner->_hasBeenTriggered = true;
+ }
+ } else if (runner->_trigger == kTriggerAtStart) {
+ if (time == startTime) {
+ runner->callBack();
+ runner->_hasBeenTriggered = true;
+ }
+ }
+ }
+ }
+
+ if (getFlags() & kLoopTimeBase) {
+ // Loop if necessary
+ if (getRate() < 0 && time == startTime)
+ setTime(_stopTime, _stopScale);
+ else if (getRate() > 0 && time == stopTime)
+ setTime(_startTime, _startScale);
+ } else {
+ // Stop at the end
+ if ((getRate() > 0 && time == stopTime) || (getRate() < 0 && time == startTime))
+ stop();
+ }
+}
+
+// Protected functions only called by TimeBaseCallBack.
+
+void TimeBase::addCallBack(TimeBaseCallBack *callBack) {
+ callBack->_nextCallBack = _callBackList;
+ _callBackList = callBack;
+}
+
+void TimeBase::removeCallBack(TimeBaseCallBack *callBack) {
+ if (_callBackList == callBack) {
+ _callBackList = callBack->_nextCallBack;
+ } else {
+ TimeBaseCallBack *runner, *prevRunner;
+
+ for (runner = _callBackList->_nextCallBack, prevRunner = _callBackList; runner != callBack; prevRunner = runner, runner = runner->_nextCallBack)
+ ;
+
+ prevRunner->_nextCallBack = runner->_nextCallBack;
+ }
+
+ callBack->_nextCallBack = 0;
+}
+
+void TimeBase::disposeAllCallBacks() {
+ TimeBaseCallBack *nextRunner;
+
+ for (TimeBaseCallBack *runner = _callBackList; runner != 0; runner = nextRunner) {
+ nextRunner = runner->_nextCallBack;
+ runner->disposeCallBack();
+ runner->_nextCallBack = 0;
+ }
+
+ _callBackList = 0;
+}
+
+TimeBaseCallBack::TimeBaseCallBack() {
+ _timeBase = 0;
+ _nextCallBack = 0;
+ _trigger = kTriggerNone;
+ _type = kCallBackNone;
+ _hasBeenTriggered = false;
+}
+
+TimeBaseCallBack::~TimeBaseCallBack() {
+ releaseCallBack();
+}
+
+void TimeBaseCallBack::initCallBack(TimeBase *tb, CallBackType type) {
+ releaseCallBack();
+ _timeBase = tb;
+ _timeBase->addCallBack(this);
+ _type = type;
+}
+
+void TimeBaseCallBack::releaseCallBack() {
+ if (_timeBase)
+ _timeBase->removeCallBack(this);
+ disposeCallBack();
+}
+
+void TimeBaseCallBack::disposeCallBack() {
+ _timeBase = 0;
+ _hasBeenTriggered = false;
+}
+
+void TimeBaseCallBack::scheduleCallBack(CallBackTrigger trigger, uint32 param2, uint32 param3) {
+ // TODO: Rename param2/param3?
+ _trigger = trigger;
+ _param2 = param2;
+ _param3 = param3;
+ _hasBeenTriggered = false;
+}
+
+void TimeBaseCallBack::cancelCallBack() {
+ _trigger = kTriggerNone;
+ _hasBeenTriggered = false;
+}
+
+IdlerTimeBase::IdlerTimeBase() {
+ _lastTime = 0xffffffff;
+ startIdling();
+}
+
+void IdlerTimeBase::useIdleTime() {
+ uint32 currentTime = getTime();
+ if (currentTime != _lastTime) {
+ _lastTime = currentTime;
+ timeChanged(_lastTime);
+ }
+}
+
+NotificationCallBack::NotificationCallBack() {
+ _callBackFlag = 0;
+ _notifier = 0;
+}
+
+void NotificationCallBack::callBack() {
+ if (_notifier)
+ _notifier->setNotificationFlags(_callBackFlag, _callBackFlag);
+}
+
+static const NotificationFlags kFuseExpiredFlag = 1;
+
+Fuse::Fuse() : _fuseNotification(0, (NotificationManager *)((PegasusEngine *)g_engine)) {
+ _fuseNotification.notifyMe(this, kFuseExpiredFlag, kFuseExpiredFlag);
+ _fuseCallBack.setNotification(&_fuseNotification);
+ _fuseCallBack.initCallBack(&_fuseTimer, kCallBackAtExtremes);
+ _fuseCallBack.setCallBackFlag(kFuseExpiredFlag);
+}
+
+void Fuse::primeFuse(const TimeValue frequency, const TimeScale scale) {
+ stopFuse();
+ _fuseTimer.setScale(scale);
+ _fuseTimer.setSegment(0, frequency);
+ _fuseTimer.setTime(0);
+}
+
+void Fuse::lightFuse() {
+ if (!_fuseTimer.isRunning()) {
+ _fuseCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _fuseTimer.start();
+ }
+}
+
+void Fuse::stopFuse() {
+ _fuseTimer.stop();
+ _fuseCallBack.cancelCallBack();
+ // Make sure the fuse has not triggered but not been caught yet...
+ _fuseNotification.setNotificationFlags(0, 0xffffffff);
+}
+
+void Fuse::advanceFuse(const TimeValue time) {
+ if (_fuseTimer.isRunning()) {
+ _fuseTimer.stop();
+ _fuseTimer.setTime(_fuseTimer.getTime() + time);
+ _fuseTimer.start();
+ }
+}
+
+TimeValue Fuse::getTimeRemaining() {
+ return _fuseTimer.getStop() - _fuseTimer.getTime();
+}
+
+void Fuse::receiveNotification(Notification *, const NotificationFlags) {
+ stopFuse();
+ invokeAction();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/timers.h b/engines/pegasus/timers.h
new file mode 100644
index 0000000000..bcdca6e860
--- /dev/null
+++ b/engines/pegasus/timers.h
@@ -0,0 +1,260 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_TIMERS_H
+#define PEGASUS_TIMERS_H
+
+#include "common/list.h"
+#include "common/rational.h"
+#include "common/func.h"
+
+#include "pegasus/constants.h"
+#include "pegasus/notification.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+class Idler {
+friend class PegasusEngine;
+
+public:
+ Idler();
+ virtual ~Idler();
+
+ virtual void startIdling();
+ virtual void stopIdling();
+ bool isIdling() const { return _isIdling; }
+
+protected:
+ virtual void useIdleTime() {}
+
+ bool _isIdling;
+ Idler *_nextIdler, *_prevIdler;
+};
+
+enum {
+ kLoopTimeBase = 1,
+ kPalindromeLoopTimeBase = 2,
+ kMaintainTimeBaseZero = 4
+};
+
+class TimeBaseCallBack;
+
+class TimeBase {
+friend class TimeBaseCallBack;
+public:
+ TimeBase(const TimeScale = kDefaultTimeScale);
+ virtual ~TimeBase();
+
+ virtual void setTime(const TimeValue, const TimeScale = 0);
+ virtual TimeValue getTime(const TimeScale = 0);
+
+ virtual void setScale(const TimeScale scale) { _preferredScale = scale; }
+ virtual TimeScale getScale() const { return _preferredScale; }
+
+ virtual void setRate(const Common::Rational);
+ virtual Common::Rational getRate() const { return _rate; }
+
+ virtual void start();
+ virtual void stop();
+ virtual bool isRunning();
+
+ virtual void pause();
+ virtual void resume();
+ bool isPaused() const { return _paused; }
+
+ virtual void setFlags(const uint32 flags) { _flags = flags; }
+ virtual uint32 getFlags() const { return _flags; }
+
+ virtual void setStart(const TimeValue, const TimeScale = 0);
+ virtual TimeValue getStart(const TimeScale = 0) const;
+
+ virtual void setStop(const TimeValue, const TimeScale = 0);
+ virtual TimeValue getStop(const TimeScale = 0) const;
+
+ virtual void setSegment(const TimeValue, const TimeValue, const TimeScale = 0);
+ virtual void getSegment(TimeValue&, TimeValue&, const TimeScale = 0) const;
+
+ virtual TimeValue getDuration(const TimeScale = 0) const;
+
+ virtual void setMasterTimeBase(TimeBase *timeBase);
+
+ void disposeAllCallBacks();
+
+ // ScummVM's API additions (to replace the need for actual timers)
+ virtual void checkCallBacks();
+
+protected:
+ void addCallBack(TimeBaseCallBack *);
+ void removeCallBack(TimeBaseCallBack *);
+ virtual void updateTime();
+
+ TimeBase *_master;
+ TimeScale _preferredScale;
+ TimeBaseCallBack *_callBackList;
+ Common::Rational _rate, _pausedRate;
+ bool _paused;
+ uint32 _startTime, _startScale;
+ uint32 _stopTime, _stopScale;
+ uint32 _flags;
+
+ Common::Rational _time;
+ uint32 _lastMillis, _pauseStart;
+
+private:
+ Common::Rational getEffectiveRate() const;
+
+ Common::List<TimeBase *> _slaves;
+};
+
+// Type passed to initCallBack()
+enum CallBackType {
+ kCallBackNone = 0,
+ kCallBackAtTime = 1,
+ kCallBackAtExtremes = 4
+};
+
+// Trigger passed to scheduleCallBack()
+enum CallBackTrigger {
+ kTriggerNone = 0,
+
+ // AtTime flags
+ kTriggerTimeFwd = 1,
+
+ // AtExtremes flags
+ kTriggerAtStart = 1,
+ kTriggerAtStop = 2
+};
+
+class TimeBaseCallBack {
+friend class TimeBase;
+
+public:
+ TimeBaseCallBack();
+ virtual ~TimeBaseCallBack();
+
+ void initCallBack(TimeBase *, CallBackType type);
+
+ void releaseCallBack();
+
+ void scheduleCallBack(CallBackTrigger trigger, uint32 param2, uint32 param3);
+ void cancelCallBack();
+
+protected:
+ virtual void callBack() = 0;
+
+ TimeBase *_timeBase;
+
+ // Owned and operated by TimeBase;
+ TimeBaseCallBack *_nextCallBack;
+
+ // Our storage of the QuickTime timer crap
+ CallBackType _type;
+ CallBackTrigger _trigger;
+ uint32 _param2, _param3;
+ bool _hasBeenTriggered;
+
+private:
+ void disposeCallBack();
+};
+
+class IdlerTimeBase : public Idler, public TimeBase {
+public:
+ IdlerTimeBase();
+ virtual ~IdlerTimeBase() { stopIdling(); }
+
+ TimeValue getLastTime() const { return _lastTime; }
+
+protected:
+ virtual void useIdleTime();
+ virtual void timeChanged(const TimeValue) {}
+
+ TimeValue _lastTime;
+
+};
+
+class NotificationCallBack : public TimeBaseCallBack {
+public:
+ NotificationCallBack();
+ virtual ~NotificationCallBack() {}
+
+ void setNotification(Notification *notifier) { _notifier = notifier; }
+
+ void setCallBackFlag(const NotificationFlags flag) { _callBackFlag = flag; }
+ NotificationFlags getCallBackFlag() const { return _callBackFlag; }
+
+protected:
+ void callBack();
+
+ Notification *_notifier;
+ NotificationFlags _callBackFlag;
+};
+
+class DynamicElement : public TimeBase {
+public:
+ TimeValue percentSeconds(const uint32 percent) { return getScale() * percent / 100; }
+};
+
+class Fuse : private NotificationReceiver {
+public:
+ Fuse();
+ virtual ~Fuse() {}
+
+ void primeFuse(const TimeValue, const TimeScale = 1); // An appropriately named function :P
+ void lightFuse();
+ void stopFuse();
+ bool isFuseLit() { return _fuseTimer.isRunning() || _fuseTimer.isPaused(); }
+ void advanceFuse(const TimeValue);
+ TimeValue getTimeRemaining();
+ TimeScale getFuseScale() { return _fuseTimer.getScale(); }
+
+ void pauseFuse() { _fuseTimer.pause(); }
+ void resumeFuse() { _fuseTimer.resume(); }
+ bool isFusePaused() { return _fuseTimer.isPaused(); }
+
+protected:
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+ virtual void invokeAction() {}
+
+ TimeBase _fuseTimer;
+ NotificationCallBack _fuseCallBack;
+ Notification _fuseNotification;
+};
+
+class FuseFunction : public Fuse {
+public:
+ FuseFunction() : _functor(0) {}
+ virtual ~FuseFunction() { delete _functor; }
+
+ void setFunctor(Common::Functor0<void> *functor) { delete _functor; _functor = functor; }
+protected:
+ virtual void invokeAction() { if (_functor && _functor->isValid()) (*_functor)(); }
+
+ Common::Functor0<void> *_functor;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/transition.cpp b/engines/pegasus/transition.cpp
new file mode 100644
index 0000000000..1ae212df85
--- /dev/null
+++ b/engines/pegasus/transition.cpp
@@ -0,0 +1,200 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/system.h"
+#include "graphics/surface.h"
+
+#include "pegasus/transition.h"
+
+namespace Pegasus {
+
+ScreenFader::ScreenFader() {
+ _isBlack = true;
+ // Initially, assume screens are on at full brightness.
+ Fader::setFaderValue(100);
+ _screen = new Graphics::Surface();
+}
+
+ScreenFader::~ScreenFader() {
+ _screen->free();
+ delete _screen;
+}
+
+void ScreenFader::doFadeOutSync(const TimeValue duration, const TimeValue scale, bool isBlack) {
+ _isBlack = isBlack;
+ _screen->copyFrom(*g_system->lockScreen());
+ g_system->unlockScreen();
+
+ FaderMoveSpec spec;
+ spec.makeTwoKnotFaderSpec(scale, 0, getFaderValue(), duration, 0);
+ startFaderSync(spec);
+
+ _screen->free();
+}
+
+void ScreenFader::doFadeInSync(const TimeValue duration, const TimeValue scale, bool isBlack) {
+ _isBlack = isBlack;
+ _screen->copyFrom(*g_system->lockScreen());
+ g_system->unlockScreen();
+
+ FaderMoveSpec spec;
+ spec.makeTwoKnotFaderSpec(scale, 0, getFaderValue(), duration, 100);
+ startFaderSync(spec);
+
+ _screen->free();
+}
+
+void ScreenFader::setFaderValue(const int32 value) {
+ if (value != getFaderValue()) {
+ Fader::setFaderValue(value);
+
+ if (_screen->pixels) {
+ // The original game does a gamma fade here using the Mac API. In order to do
+ // that, it would require an immense amount of CPU processing. This does a
+ // linear fade instead, which looks fairly well, IMO.
+ Graphics::Surface *screen = g_system->lockScreen();
+
+ for (uint y = 0; y < _screen->h; y++) {
+ for (uint x = 0; x < _screen->w; x++) {
+ if (_screen->format.bytesPerPixel == 2)
+ WRITE_UINT16(screen->getBasePtr(x, y), fadePixel(READ_UINT16(_screen->getBasePtr(x, y)), value));
+ else
+ WRITE_UINT32(screen->getBasePtr(x, y), fadePixel(READ_UINT32(_screen->getBasePtr(x, y)), value));
+ }
+ }
+
+ g_system->unlockScreen();
+ g_system->updateScreen();
+ }
+ }
+}
+
+static inline byte fadeComponent(byte comp, int32 percent) {
+ return comp * percent / 100;
+}
+
+uint32 ScreenFader::fadePixel(uint32 color, int32 percent) const {
+ byte r, g, b;
+ g_system->getScreenFormat().colorToRGB(color, r, g, b);
+
+ if (_isBlack) {
+ r = fadeComponent(r, percent);
+ g = fadeComponent(g, percent);
+ b = fadeComponent(b, percent);
+ } else {
+ r = 0xFF - fadeComponent(0xFF - r, percent);
+ g = 0xFF - fadeComponent(0xFF - g, percent);
+ b = 0xFF - fadeComponent(0xFF - b, percent);
+ }
+
+ return g_system->getScreenFormat().RGBToColor(r, g, b);
+}
+
+Transition::Transition(const DisplayElementID id) : FaderAnimation(id) {
+ _outPicture = 0;
+ _inPicture = 0;
+}
+
+void Transition::setBounds(const Common::Rect &r) {
+ FaderAnimation::setBounds(r);
+ _boundsWidth = _bounds.width();
+ _boundsHeight = _bounds.height();
+}
+
+void Transition::setInAndOutElements(DisplayElement *inElement, DisplayElement *outElement) {
+ _inPicture = inElement;
+ _outPicture = outElement;
+
+ Common::Rect r;
+
+ if (_outPicture)
+ _outPicture->getBounds(r);
+ else if (_inPicture)
+ _inPicture->getBounds(r);
+
+ setBounds(r);
+}
+
+void Slide::draw(const Common::Rect &r) {
+ Common::Rect oldBounds, newBounds;
+
+ adjustSlideRects(oldBounds, newBounds);
+ drawElements(r, oldBounds, newBounds);
+}
+
+void Slide::adjustSlideRects(Common::Rect &oldBounds, Common::Rect &newBounds) {
+ oldBounds = _bounds;
+ newBounds = _bounds;
+}
+
+void Slide::drawElements(const Common::Rect &drawRect, const Common::Rect &oldBounds, const Common::Rect &newBounds) {
+ drawSlideElement(drawRect, oldBounds, _outPicture);
+ drawSlideElement(drawRect, newBounds, _inPicture);
+}
+
+void Slide::drawSlideElement(const Common::Rect &drawRect, const Common::Rect &oldBounds, DisplayElement *picture) {
+ if (picture && drawRect.intersects(oldBounds)) {
+ picture->moveElementTo(oldBounds.left, oldBounds.top);
+ picture->draw(drawRect.findIntersectingRect(oldBounds));
+ }
+}
+
+void Push::adjustSlideRects(Common::Rect &oldBounds, Common::Rect &newBounds) {
+ switch (_direction & kSlideHorizMask) {
+ case kSlideLeftMask:
+ newBounds.left = oldBounds.right = _bounds.right - pegasusRound(getFaderValue() * _boundsWidth, kTransitionRange);
+ newBounds.right = newBounds.left + _boundsWidth;
+ oldBounds.left = oldBounds.right - _boundsWidth;
+ break;
+ case kSlideRightMask:
+ oldBounds.left = newBounds.right = _bounds.left + pegasusRound(getFaderValue() * _boundsWidth, kTransitionRange);
+ oldBounds.right = oldBounds.left + _boundsWidth;
+ newBounds.left = newBounds.right - _boundsWidth;
+ break;
+ default:
+ newBounds.left = oldBounds.left = _bounds.left;
+ newBounds.right = oldBounds.right = _bounds.right;
+ break;
+ }
+
+ switch (_direction & kSlideVertMask) {
+ case kSlideDownMask:
+ oldBounds.top = newBounds.bottom = _bounds.top + pegasusRound(getFaderValue() * _boundsHeight, kTransitionRange);
+ oldBounds.bottom = oldBounds.top + _boundsHeight;
+ newBounds.top = newBounds.bottom - _boundsHeight;
+ break;
+ case kSlideUpMask:
+ newBounds.top = oldBounds.bottom = _bounds.bottom - pegasusRound(getFaderValue() * _boundsHeight, kTransitionRange);
+ newBounds.bottom = newBounds.top + _boundsHeight;
+ oldBounds.top = oldBounds.bottom - _boundsHeight;
+ break;
+ default:
+ newBounds.top = oldBounds.top = _bounds.top;
+ newBounds.bottom = oldBounds.bottom = _bounds.bottom;
+ break;
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/transition.h b/engines/pegasus/transition.h
new file mode 100644
index 0000000000..84241a2bd2
--- /dev/null
+++ b/engines/pegasus/transition.h
@@ -0,0 +1,108 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_TRANSITION_H
+#define PEGASUS_TRANSITION_H
+
+#include "pegasus/fader.h"
+
+namespace Graphics {
+struct Surface;
+}
+
+namespace Pegasus {
+
+class ScreenFader : public Fader {
+public:
+ ScreenFader();
+ virtual ~ScreenFader();
+
+ void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
+ void doFadeInSync(const TimeValue = kHalfSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
+
+ void setFaderValue(const int32);
+
+private:
+ bool _isBlack;
+ uint32 fadePixel(uint32 color, int32 percent) const;
+ Graphics::Surface *_screen;
+};
+
+// Transitions are faders that range over [0,1000], which makes their
+// "resolution" one tenth of a percent
+
+static const int kTransitionBottom = 0;
+static const int kTransitionTop = 1000;
+
+static const int kTransitionRange = kTransitionTop - kTransitionBottom;
+
+class Transition : public FaderAnimation {
+public:
+ Transition(const DisplayElementID id);
+ virtual ~Transition() {}
+
+ virtual void setBounds(const Common::Rect &);
+
+ virtual void setInAndOutElements(DisplayElement *, DisplayElement *);
+ DisplayElement *getInElement() { return _inPicture; }
+ DisplayElement *getOutElement() { return _outPicture; }
+
+protected:
+ DisplayElement *_outPicture;
+ DisplayElement *_inPicture;
+
+ CoordType _boundsWidth, _boundsHeight;
+};
+
+class Slide : public Transition {
+public:
+ Slide(const DisplayElementID id) : Transition(id) {}
+ virtual ~Slide() {}
+
+ virtual void setSlideDirection(SlideDirection dir) { _direction = dir; }
+ virtual void draw(const Common::Rect &);
+
+ virtual void setDirection(const SlideDirection dir) { _direction = dir; }
+
+protected:
+ virtual void adjustSlideRects(Common::Rect &, Common::Rect &);
+ virtual void drawElements(const Common::Rect &, const Common::Rect &, const Common::Rect &);
+ virtual void drawSlideElement(const Common::Rect &, const Common::Rect &, DisplayElement *);
+
+ SlideDirection _direction;
+};
+
+class Push : public Slide {
+public:
+ Push(const DisplayElementID id) : Slide(id) {}
+ virtual ~Push() {}
+
+protected:
+ virtual void adjustSlideRects(Common::Rect &, Common::Rect &);
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/types.h b/engines/pegasus/types.h
new file mode 100644
index 0000000000..64ab4e5bb2
--- /dev/null
+++ b/engines/pegasus/types.h
@@ -0,0 +1,161 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_TYPES_H
+#define PEGASUS_TYPES_H
+
+#include "common/scummsys.h"
+
+namespace Pegasus {
+
+// TODO: Probably all of these don't really need to be typedef'd...
+
+typedef int32 DisplayElementID;
+typedef int32 DisplayOrder;
+
+typedef int16 HotSpotID;
+typedef uint32 HotSpotFlags;
+
+typedef byte ButtonState;
+typedef uint32 InputBits;
+
+typedef int32 NotificationID;
+typedef uint32 NotificationFlags;
+
+// Mac types.
+typedef int16 ResIDType;
+typedef int16 CoordType;
+
+enum SlideDirection {
+ kSlideLeftMask = 1,
+ kSlideRightMask = kSlideLeftMask << 1,
+ kSlideUpMask = kSlideRightMask << 1 << 1,
+ kSlideDownMask = kSlideUpMask << 1,
+
+ kSlideHorizMask = kSlideLeftMask | kSlideRightMask,
+ kSlideVertMask = kSlideUpMask | kSlideDownMask,
+
+ kSlideUpLeftMask = kSlideLeftMask | kSlideUpMask,
+ kSlideUpRightMask = kSlideRightMask | kSlideUpMask,
+ kSlideDownLeftMask = kSlideLeftMask | kSlideDownMask,
+ kSlideDownRightMask = kSlideRightMask | kSlideDownMask
+};
+
+// ScummVM QuickTime/QuickDraw replacement types
+typedef uint TimeValue;
+typedef uint TimeScale;
+
+typedef int16 GameID;
+
+typedef GameID ItemID;
+typedef GameID ActorID;
+typedef GameID RoomID;
+typedef GameID NeighborhoodID;
+typedef byte AlternateID;
+typedef int8 HotSpotActivationID;
+
+typedef int16 WeightType;
+
+typedef byte DirectionConstant;
+typedef byte TurnDirection;
+
+// Meant to be room in low 16 bits and direction in high 16 bits.
+typedef uint32 RoomViewID;
+
+#define MakeRoomView(room, direction) (((RoomViewID) (room)) | (((RoomViewID) (direction)) << 16))
+
+typedef uint32 ExtraID;
+
+typedef int16 GameMode;
+
+typedef int16 WeightType;
+
+typedef int16 ItemState;
+
+typedef int8 DeathReason;
+
+typedef int32 GameMenuCommand;
+
+typedef int32 GameScoreType;
+
+typedef long CanMoveForwardReason;
+
+typedef long CanTurnReason;
+
+typedef long CanOpenDoorReason;
+
+enum InventoryResult {
+ kInventoryOK,
+ kTooMuchWeight,
+ kItemNotInInventory
+};
+
+typedef int32 InteractionID;
+
+typedef int32 AIConditionID;
+
+enum EnergyStage {
+ kStageNoStage,
+ kStageCasual, // more than 50% energy
+ kStageWorried, // more than 25% energy
+ kStageNervous, // more than 5% energy
+ kStagePanicStricken // less than 5% energy
+};
+
+enum NoradSubPrepState {
+ kSubNotPrepped,
+ kSubPrepped,
+ kSubDamaged
+};
+
+enum LowerClientSignature {
+ kNoClientSignature,
+ kInventorySignature,
+ kBiochipSignature,
+ kAISignature
+};
+
+enum LowerAreaSignature {
+ kLeftAreaSignature,
+ kMiddleAreaSignature,
+ kRightAreaSignature
+};
+
+enum AirQuality {
+ kAirQualityGood,
+ kAirQualityDirty,
+ kAirQualityVacuum
+};
+
+enum DragType {
+ kDragNoDrag,
+ kDragInventoryPickup,
+ kDragBiochipPickup,
+ kDragInventoryUse
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/util.cpp b/engines/pegasus/util.cpp
new file mode 100644
index 0000000000..59df610c33
--- /dev/null
+++ b/engines/pegasus/util.cpp
@@ -0,0 +1,77 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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/random.h"
+#include "common/system.h"
+#include "common/util.h"
+
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+IDObject::IDObject(const int32 id) {
+ _objectID = id;
+}
+
+IDObject::~IDObject() {
+}
+
+int32 IDObject::getObjectID() const {
+ return _objectID;
+}
+
+int operator==(const IDObject &arg1, const IDObject &arg2) {
+ return arg1.getObjectID() == arg2.getObjectID();
+}
+
+int operator!=(const IDObject &arg1, const IDObject &arg2) {
+ return arg1.getObjectID() != arg2.getObjectID();
+}
+
+int32 pegasusRound(const int32 a, const int32 b) {
+ if (b < 0)
+ if (a < 0)
+ return -((a - (-b >> 1)) / -b);
+ else
+ return -((a + (-b >> 1)) / -b);
+ else
+ if (a < 0)
+ return (a - (b >> 1)) / b;
+ else
+ return (a + (b >> 1)) / b;
+}
+
+int32 linearInterp(const int32 start1, const int32 stop1, const int32 current1, const int32 start2, const int32 stop2) {
+ if (start2 == stop2)
+ return start2;
+ else
+ return start2 + pegasusRound((current1 - start1) * (stop2 - start2), (stop1 - start1));
+}
+
+uint32 tickCount() {
+ return g_system->getMillis() * 60 / 1000;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/util.h b/engines/pegasus/util.h
new file mode 100644
index 0000000000..97ba1c20c3
--- /dev/null
+++ b/engines/pegasus/util.h
@@ -0,0 +1,117 @@
+/* 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.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * 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 PEGASUS_UTIL_H
+#define PEGASUS_UTIL_H
+
+#include "common/stream.h"
+
+#include "pegasus/types.h"
+
+namespace Common {
+ class RandomSource;
+}
+
+namespace Pegasus {
+
+class IDObject {
+public:
+ IDObject(const int32 id);
+ ~IDObject();
+
+ int32 getObjectID() const;
+
+private:
+ int32 _objectID;
+};
+
+#define NUM_FLAGS (sizeof(Unit) * 8)
+#define BIT_INDEX_SHIFT (sizeof(Unit) + 2 - (sizeof(Unit)) / 3)
+#define BIT_INDEX_MASK (NUM_FLAGS - 1)
+
+template <typename Unit, uint32 kNumFlags>
+class FlagsArray {
+public:
+ FlagsArray() { clearAllFlags(); }
+ void clearAllFlags() { memset(_flags, 0, sizeof(_flags)); }
+ void setAllFlags() { memset(_flags, ~((Unit)0), sizeof(_flags)); }
+ void setFlag(uint32 flag) { _flags[flag >> BIT_INDEX_SHIFT] |= 1 << (flag & BIT_INDEX_MASK); }
+ void clearFlag(uint32 flag) { _flags[flag >> BIT_INDEX_SHIFT] &= ~(1 << (flag & BIT_INDEX_MASK)); }
+ void setFlag(uint32 flag, bool val) { if (val) setFlag(flag); else clearFlag(flag); }
+ bool getFlag(uint32 flag) { return (_flags[flag >> BIT_INDEX_SHIFT] & (1 << (flag & BIT_INDEX_MASK))) != 0; }
+ bool anyFlagSet() {
+ for (uint32 i = 0; i < sizeof(_flags); i++)
+ if (_flags[i] != 0)
+ return true;
+ return false;
+ }
+
+ void readFromStream(Common::ReadStream *stream) {
+ // Shortcut
+ if (sizeof(Unit) == 1) {
+ stream->read(_flags, sizeof(_flags));
+ return;
+ }
+
+ for (uint32 i = 0; i < ARRAYSIZE(_flags); i++) {
+ if (sizeof(Unit) == 2)
+ _flags[i] = stream->readUint16BE();
+ else /* if (sizeof(Unit) == 4) */
+ _flags[i] = stream->readUint32BE();
+ }
+ }
+
+ void writeToStream(Common::WriteStream *stream) {
+ // Shortcut
+ if (sizeof(Unit) == 1) {
+ stream->write(_flags, sizeof(_flags));
+ return;
+ }
+
+ for (uint32 i = 0; i < ARRAYSIZE(_flags); i++) {
+ if (sizeof(Unit) == 2)
+ stream->writeUint16BE(_flags[i]);
+ else /* if (sizeof(Unit) == 4) */
+ stream->writeUint32BE(_flags[i]);
+ }
+ }
+
+private:
+ Unit _flags[(kNumFlags - 1) / NUM_FLAGS + 1];
+};
+
+#undef NUM_FLAGS
+#undef BIT_INDEX_SHIFT
+#undef BIT_INDEX_MASK
+
+int32 linearInterp(const int32 start1, const int32 stop1, const int32 current1, const int32 start2, const int32 stop2);
+
+int32 pegasusRound(const int32 a, const int32 b);
+
+uint32 tickCount();
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/plugins_table.h b/engines/plugins_table.h
new file mode 100644
index 0000000000..152c45f658
--- /dev/null
+++ b/engines/plugins_table.h
@@ -0,0 +1,115 @@
+// This file is being included by "base/plugins.cpp"
+#if PLUGIN_ENABLED_STATIC(SCUMM)
+LINK_PLUGIN(SCUMM)
+#endif
+#if PLUGIN_ENABLED_STATIC(AGI)
+LINK_PLUGIN(AGI)
+#endif
+#if PLUGIN_ENABLED_STATIC(AGOS)
+LINK_PLUGIN(AGOS)
+#endif
+#if PLUGIN_ENABLED_STATIC(CGE)
+LINK_PLUGIN(CGE)
+#endif
+#if PLUGIN_ENABLED_STATIC(CINE)
+LINK_PLUGIN(CINE)
+#endif
+#if PLUGIN_ENABLED_STATIC(COMPOSER)
+LINK_PLUGIN(COMPOSER)
+#endif
+#if PLUGIN_ENABLED_STATIC(CRUISE)
+LINK_PLUGIN(CRUISE)
+#endif
+#if PLUGIN_ENABLED_STATIC(DRACI)
+LINK_PLUGIN(DRACI)
+#endif
+#if PLUGIN_ENABLED_STATIC(DRASCULA)
+LINK_PLUGIN(DRASCULA)
+#endif
+#if PLUGIN_ENABLED_STATIC(DREAMWEB)
+LINK_PLUGIN(DREAMWEB)
+#endif
+#if PLUGIN_ENABLED_STATIC(GOB)
+LINK_PLUGIN(GOB)
+#endif
+#if PLUGIN_ENABLED_STATIC(GROOVIE)
+LINK_PLUGIN(GROOVIE)
+#endif
+#if PLUGIN_ENABLED_STATIC(HUGO)
+LINK_PLUGIN(HUGO)
+#endif
+#if PLUGIN_ENABLED_STATIC(KYRA)
+LINK_PLUGIN(KYRA)
+#endif
+#if PLUGIN_ENABLED_STATIC(LASTEXPRESS)
+LINK_PLUGIN(LASTEXPRESS)
+#endif
+#if PLUGIN_ENABLED_STATIC(LURE)
+LINK_PLUGIN(LURE)
+#endif
+#if PLUGIN_ENABLED_STATIC(MADE)
+LINK_PLUGIN(MADE)
+#endif
+#if PLUGIN_ENABLED_STATIC(MOHAWK)
+LINK_PLUGIN(MOHAWK)
+#endif
+#if PLUGIN_ENABLED_STATIC(NEVERHOOD)
+LINK_PLUGIN(NEVERHOOD)
+#endif
+#if PLUGIN_ENABLED_STATIC(PARALLACTION)
+LINK_PLUGIN(PARALLACTION)
+#endif
+#if PLUGIN_ENABLED_STATIC(PEGASUS)
+LINK_PLUGIN(PEGASUS)
+#endif
+#if PLUGIN_ENABLED_STATIC(QUEEN)
+LINK_PLUGIN(QUEEN)
+#endif
+#if PLUGIN_ENABLED_STATIC(SAGA)
+LINK_PLUGIN(SAGA)
+#endif
+#if PLUGIN_ENABLED_STATIC(SCI)
+LINK_PLUGIN(SCI)
+#endif
+#if PLUGIN_ENABLED_STATIC(SKY)
+LINK_PLUGIN(SKY)
+#endif
+#if PLUGIN_ENABLED_STATIC(SWORD1)
+LINK_PLUGIN(SWORD1)
+#endif
+#if PLUGIN_ENABLED_STATIC(SWORD2)
+LINK_PLUGIN(SWORD2)
+#endif
+#if PLUGIN_ENABLED_STATIC(SWORD25)
+LINK_PLUGIN(SWORD25)
+#endif
+#if PLUGIN_ENABLED_STATIC(TEENAGENT)
+LINK_PLUGIN(TEENAGENT)
+#endif
+#if PLUGIN_ENABLED_STATIC(TESTBED)
+LINK_PLUGIN(TESTBED)
+#endif
+#if PLUGIN_ENABLED_STATIC(TINSEL)
+LINK_PLUGIN(TINSEL)
+#endif
+#if PLUGIN_ENABLED_STATIC(TOLTECS)
+LINK_PLUGIN(TOLTECS)
+#endif
+#if PLUGIN_ENABLED_STATIC(TONY)
+LINK_PLUGIN(TONY)
+#endif
+#if PLUGIN_ENABLED_STATIC(TOON)
+LINK_PLUGIN(TOON)
+#endif
+#if PLUGIN_ENABLED_STATIC(TSAGE)
+LINK_PLUGIN(TSAGE)
+#endif
+#if PLUGIN_ENABLED_STATIC(TOUCHE)
+LINK_PLUGIN(TOUCHE)
+#endif
+#if PLUGIN_ENABLED_STATIC(TUCKER)
+LINK_PLUGIN(TUCKER)
+#endif
+#if PLUGIN_ENABLED_STATIC(WINTERMUTE)
+LINK_PLUGIN(WINTERMUTE)
+#endif
diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index 83dc1a9f60..cd9a1075fa 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -23,9 +23,13 @@
#include "common/system.h"
#include "common/events.h"
+#include "common/stream.h"
+#include "common/memstream.h"
#include "graphics/cursorman.h"
#include "graphics/palette.h"
+#include "graphics/surface.h"
+#include "graphics/decoders/pcx.h"
#include "queen/display.h"
#include "queen/input.h"
@@ -806,28 +810,22 @@ void Display::fill(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint16 w,
}
void Display::decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd) {
- *w = READ_LE_UINT16(src + 12);
- *h = READ_LE_UINT16(src + 14);
+ Common::MemoryReadStream str(src, srcSize);
+
+ ::Graphics::PCXDecoder pcx;
+ if (!pcx.loadStream(str))
+ error("Error while reading PCX image");
+
+ const ::Graphics::Surface *pcxSurface = pcx.getSurface();
+ if (pcxSurface->format.bytesPerPixel != 1)
+ error("Invalid bytes per pixel in PCX surface (%d)", pcxSurface->format.bytesPerPixel);
+ *w = pcxSurface->w;
+ *h = pcxSurface->h;
assert(palStart <= palEnd && palEnd <= 256);
- const uint8 *palData = src + srcSize - 768;
- memcpy(pal, palData + palStart * 3, (palEnd - palStart) * 3);
-
- src += 128;
- for (int y = 0; y < *h; ++y) {
- uint8 *p = dst;
- while (p < dst + *w) {
- uint8 col = *src++;
- if ((col & 0xC0) == 0xC0) {
- uint8 len = col & 0x3F;
- memset(p, *src++, len);
- p += len;
- } else {
- *p++ = col;
- }
- }
- dst += dstPitch;
- }
+ memcpy(pal, pcx.getPalette() + palStart * 3, (palEnd - palStart) * 3);
+ for (uint16 y = 0; y < pcxSurface->h; y++)
+ memcpy(dst + y * dstPitch, pcxSurface->getBasePtr(0, y), pcxSurface->w);
}
void Display::decodeLBM(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase) {
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index d17268e16b..c403536e22 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -30,6 +30,7 @@
#include "common/system.h"
#include "common/events.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "engines/util.h"
@@ -54,6 +55,13 @@ static const PlainGameDescriptor queenGameDescriptor = {
"queen", "Flight of the Amazon Queen"
};
+static const ExtraGuiOption queenExtraGuiOption = {
+ _s("Alternative intro"),
+ _s("Use an alternative game intro (CD version only)"),
+ "alt_intro",
+ false
+};
+
class QueenMetaEngine : public MetaEngine {
public:
virtual const char *getName() const;
@@ -61,9 +69,11 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const Common::FSList &fslist) const;
virtual SaveStateList listSaves(const char *target) const;
+ virtual int getMaximumSaveSlot() const;
virtual void removeSaveState(const char *target, int slot) const;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
@@ -87,6 +97,8 @@ bool QueenMetaEngine::hasFeature(MetaEngineFeature f) const {
bool Queen::QueenEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime) ||
(f == kSupportsSubtitleOptions);
}
@@ -96,6 +108,27 @@ GameList QueenMetaEngine::getSupportedGames() const {
return games;
}
+int QueenMetaEngine::getMaximumSaveSlot() const { return 99; }
+
+const ExtraGuiOptions QueenMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ Common::String guiOptions;
+ ExtraGuiOptions options;
+
+ if (target.empty()) {
+ options.push_back(queenExtraGuiOption);
+ return options;
+ }
+
+ if (ConfMan.hasKey("guioptions", target)) {
+ guiOptions = ConfMan.get("guioptions", target);
+ guiOptions = parseGameGUIOptions(guiOptions);
+ }
+
+ if (!guiOptions.contains(GUIO_NOSPEECH))
+ options.push_back(queenExtraGuiOption);
+ return options;
+}
+
GameDescriptor QueenMetaEngine::findGame(const char *gameid) const {
if (0 == scumm_stricmp(gameid, queenGameDescriptor.gameid)) {
return queenGameDescriptor;
@@ -316,6 +349,14 @@ bool QueenEngine::canLoadOrSave() const {
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
}
+bool QueenEngine::canLoadGameStateCurrently() {
+ return canLoadOrSave();
+}
+
+bool QueenEngine::canSaveGameStateCurrently() {
+ return canLoadOrSave();
+}
+
Common::Error QueenEngine::saveGameState(int slot, const Common::String &desc) {
debug(3, "Saving game to slot %d", slot);
char name[20];
diff --git a/engines/queen/queen.h b/engines/queen/queen.h
index bb299e2a80..a8b0e9f6ed 100644
--- a/engines/queen/queen.h
+++ b/engines/queen/queen.h
@@ -112,6 +112,8 @@ public:
void update(bool checkPlayerInput = false);
bool canLoadOrSave() const;
+ bool canLoadGameStateCurrently();
+ bool canSaveGameStateCurrently();
Common::Error saveGameState(int slot, const Common::String &desc);
Common::Error loadGameState(int slot);
void makeGameStateName(int slot, char *buf) const;
diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp
index 3e10aba6b6..d0f1cf2b5b 100644
--- a/engines/saga/actor_path.cpp
+++ b/engines/saga/actor_path.cpp
@@ -23,6 +23,7 @@
#include "saga/saga.h"
#include "saga/actor.h"
+#include "saga/objectmap.h"
#include "saga/scene.h"
namespace Saga {
@@ -99,6 +100,47 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
_debugPointsCount = 0;
#endif
+ // WORKAROUND for bug #3360396. Path finding in IHNM is a bit buggy
+ // compared to the original, which occasionally leads to the player
+ // leaving the room instead of interacting with an object. So far, no
+ // one has figured out how to fix this properly. As a temporary [*]
+ // solution, we try to fix this on a case-by-case basis.
+ //
+ // The workaround is to assume that the player wants to stay in the
+ // room, unless he or she explicitly clicked on an exit zone.
+ //
+ // [*] And there is nothing more permanent than a temporary solution...
+
+ bool pathFindingWorkaround = false;
+
+ if (_vm->getGameId() == GID_IHNM) {
+ int chapter = _vm->_scene->currentChapterNumber();
+ int scene = _vm->_scene->currentSceneNumber();
+
+ // Ellen, in the room with the monitors.
+ if (chapter == 3 && scene == 54)
+ pathFindingWorkaround = true;
+
+ // Nimdok in the recovery room
+ if (chapter == 4 && scene == 71)
+ pathFindingWorkaround = true;
+ }
+
+ int hitZoneIndex;
+ const HitZone *hitZone;
+ bool restrictToRoom = false;
+
+ if (pathFindingWorkaround) {
+ restrictToRoom = true;
+ hitZoneIndex = _vm->_scene->_actionMap->hitTest(toPoint);
+ if (hitZoneIndex != -1) {
+ hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex);
+ if (hitZone->getFlags() & kHitZoneExit) {
+ restrictToRoom = false;
+ }
+ }
+ }
+
actor->_walkStepsCount = 0;
if (fromPoint == toPoint) {
actor->addWalkStepPoint(toPoint);
@@ -110,6 +152,15 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
if (_vm->_scene->validBGMaskPoint(iteratorPoint)) {
maskType = _vm->_scene->getBGMaskType(iteratorPoint);
setPathCell(iteratorPoint, _vm->_scene->getDoorState(maskType) ? kPathCellBarrier : kPathCellEmpty);
+ if (restrictToRoom) {
+ hitZoneIndex = _vm->_scene->_actionMap->hitTest(iteratorPoint);
+ if (hitZoneIndex != -1) {
+ hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex);
+ if (hitZone->getFlags() & kHitZoneExit) {
+ setPathCell(iteratorPoint, kPathCellBarrier);
+ }
+ }
+ }
} else {
setPathCell(iteratorPoint, kPathCellBarrier);
}
@@ -223,7 +274,6 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
int currentRating;
Point bestPath;
int pointCounter;
- int startDirection;
const PathDirectionData *samplePathDirection;
Point nextPoint;
int directionCount;
@@ -235,7 +285,7 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
bestRating = quickDistance(fromPoint, toPoint, compressX);
bestPath = fromPoint;
- for (startDirection = 0; startDirection < 4; startDirection++) {
+ for (int8 startDirection = 0; startDirection < 4; startDirection++) {
PathDirectionData tmp = { startDirection, fromPoint.x, fromPoint.y };
pathDirectionQueue.push_back(tmp);
}
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index d39ec34cc8..9c178559f2 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -252,9 +252,6 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s
debug(0, "Save is for: %s", title);
}
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
-
if (version >= 6) {
Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp
index 364c4cf306..6015e6757a 100644
--- a/engines/saga/introproc_ihnm.cpp
+++ b/engines/saga/introproc_ihnm.cpp
@@ -212,7 +212,7 @@ bool Scene::playTitle(int title, int time, int mode) {
break;
case 2: // display background
- _vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+ _vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h);
phase++;
startTime = curTime;
@@ -247,7 +247,7 @@ bool Scene::playTitle(int title, int time, int mode) {
frameTime = curTime;
- _vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+ _vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h);
}
@@ -274,7 +274,7 @@ bool Scene::playTitle(int title, int time, int mode) {
_vm->_anim->endVideo();
memset((byte *)backBufferSurface->pixels, 0, backBufferSurface->w * backBufferSurface->h);
- _vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+ _vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h);
return interrupted;
diff --git a/engines/saga/introproc_ite.cpp b/engines/saga/introproc_ite.cpp
index 9248f2b530..484ebe1779 100644
--- a/engines/saga/introproc_ite.cpp
+++ b/engines/saga/introproc_ite.cpp
@@ -126,21 +126,25 @@ EventColumns *Scene::ITEQueueDialogue(EventColumns *eventColumns, int n_dialogue
textEntry.text = dialogue[i].i_str;
entry = _vm->_scene->_textList.addEntry(textEntry);
- // Display text
- event.type = kEvTOneshot;
- event.code = kTextEvent;
- event.op = kEventDisplay;
- event.data = entry;
- event.time = (i == 0) ? 0 : VOICE_PAD;
- eventColumns = _vm->_events->chain(eventColumns, event);
+ if (_vm->_subtitlesEnabled) {
+ // Display text
+ event.type = kEvTOneshot;
+ event.code = kTextEvent;
+ event.op = kEventDisplay;
+ event.data = entry;
+ event.time = (i == 0) ? 0 : VOICE_PAD;
+ eventColumns = _vm->_events->chain(eventColumns, event);
+ }
- // Play voice
- event.type = kEvTOneshot;
- event.code = kVoiceEvent;
- event.op = kEventPlay;
- event.param = dialogue[i].i_voice_rn;
- event.time = 0;
- _vm->_events->chain(eventColumns, event);
+ if (_vm->_voicesEnabled) {
+ // Play voice
+ event.type = kEvTOneshot;
+ event.code = kVoiceEvent;
+ event.op = kEventPlay;
+ event.param = dialogue[i].i_voice_rn;
+ event.time = 0;
+ _vm->_events->chain(eventColumns, event);
+ }
voice_len = _vm->_sndRes->getVoiceLength(dialogue[i].i_voice_rn);
if (voice_len < 0) {
diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp
index bdf8936a55..260eca98e6 100644
--- a/engines/saga/introproc_saga2.cpp
+++ b/engines/saga/introproc_saga2.cpp
@@ -32,6 +32,7 @@
#include "common/keyboard.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "video/smk_decoder.h"
@@ -92,7 +93,7 @@ int Scene::FTA2EndProc(FTA2Endings whichEnding) {
}
void Scene::playMovie(const char *filename) {
- Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(_vm->_mixer);
+ Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder();
if (!smkDecoder->loadFile(filename))
return;
@@ -101,14 +102,16 @@ void Scene::playMovie(const char *filename) {
uint16 y = (g_system->getHeight() - smkDecoder->getHeight()) / 2;
bool skipVideo = false;
+ smkDecoder->start();
+
while (!_vm->shouldQuit() && !smkDecoder->endOfVideo() && !skipVideo) {
if (smkDecoder->needsUpdate()) {
const Graphics::Surface *frame = smkDecoder->decodeNextFrame();
if (frame) {
- _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
if (smkDecoder->hasDirtyPalette())
- smkDecoder->setSystemPalette();
+ _vm->_system->getPaletteManager()->setPalette(smkDecoder->getPalette(), 0, 256);
_vm->_system->updateScreen();
}
diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp
index 96746b538c..3efc554cb3 100644
--- a/engines/saga/script.cpp
+++ b/engines/saga/script.cpp
@@ -948,7 +948,7 @@ void Script::opSpeak(SCRIPTOP_PARAMS) {
// scripts change to scene 5, but do not clear the cutaway that appears
// before Gorrister's speech starts, resulting in a deadlock. We do this
// manually here.
- if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 1 &&
+ if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 1 &&
_vm->_scene->currentSceneNumber() == 5 && _vm->_anim->hasCutaway()) {
_vm->_anim->returnFromCutaway();
}
diff --git a/engines/saga/shorten.cpp b/engines/saga/shorten.cpp
index 5efc8d1f67..69c27b6a6b 100644
--- a/engines/saga/shorten.cpp
+++ b/engines/saga/shorten.cpp
@@ -519,9 +519,6 @@ byte *loadShortenFromStream(Common::ReadStream &stream, int &size, int &rate, by
if (maxLPC > 0)
free(lpc);
- if (size > 0)
- free(unpackedBuffer);
-
delete gReader;
return unpackedBuffer;
}
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 5a97eb6019..71044034d7 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -104,9 +104,6 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm), _sfxContext(NULL), _voiceContext(NULL)
}
}
-SndRes::~SndRes() {
-}
-
void SndRes::setVoiceBank(int serial) {
Common::File *file;
if (_voiceSerial == serial)
diff --git a/engines/saga/sndres.h b/engines/saga/sndres.h
index 979c0288f6..bc38bed431 100644
--- a/engines/saga/sndres.h
+++ b/engines/saga/sndres.h
@@ -39,7 +39,6 @@ class SndRes {
public:
SndRes(SagaEngine *vm);
- ~SndRes();
void playSound(uint32 resourceId, int volume, bool loop);
void playVoice(uint32 resourceId);
diff --git a/engines/savestate.h b/engines/savestate.h
index 6cbdb22edf..c233554657 100644
--- a/engines/savestate.h
+++ b/engines/savestate.h
@@ -40,6 +40,8 @@ struct Surface;
*
* Further possibilites are a thumbnail, play time, creation date,
* creation time, delete protected, write protection.
+ *
+ * Saves are writable and deletable by default.
*/
class SaveStateDescriptor {
public:
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 9607a8e66d..5ae8245e5a 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -53,6 +53,7 @@
#include "video/avi_decoder.h"
#include "sci/video/seq_decoder.h"
#ifdef ENABLE_SCI32
+#include "sci/graphics/frameout.h"
#include "video/coktel_decoder.h"
#include "sci/video/robot_decoder.h"
#endif
@@ -131,6 +132,10 @@ Console::Console(SciEngine *engine) : GUI::Debugger(),
DCmd_Register("al", WRAP_METHOD(Console, cmdAnimateList)); // alias
DCmd_Register("window_list", WRAP_METHOD(Console, cmdWindowList));
DCmd_Register("wl", WRAP_METHOD(Console, cmdWindowList)); // alias
+ DCmd_Register("plane_list", WRAP_METHOD(Console, cmdPlaneList));
+ DCmd_Register("pl", WRAP_METHOD(Console, cmdPlaneList)); // alias
+ DCmd_Register("plane_items", WRAP_METHOD(Console, cmdPlaneItemList));
+ DCmd_Register("pi", WRAP_METHOD(Console, cmdPlaneItemList)); // alias
DCmd_Register("saved_bits", WRAP_METHOD(Console, cmdSavedBits));
DCmd_Register("show_saved_bits", WRAP_METHOD(Console, cmdShowSavedBits));
// Segments
@@ -245,20 +250,18 @@ void Console::postEnter() {
#endif
if (_videoFile.hasSuffix(".seq")) {
- SeqDecoder *seqDecoder = new SeqDecoder();
- seqDecoder->setFrameDelay(_videoFrameDelay);
- videoDecoder = seqDecoder;
+ videoDecoder = new SEQDecoder(_videoFrameDelay);
#ifdef ENABLE_SCI32
} else if (_videoFile.hasSuffix(".vmd")) {
- videoDecoder = new Video::VMDDecoder(g_system->getMixer());
+ videoDecoder = new Video::AdvancedVMDDecoder();
} else if (_videoFile.hasSuffix(".rbt")) {
- videoDecoder = new RobotDecoder(g_system->getMixer(), _engine->getPlatform() == Common::kPlatformMacintosh);
+ videoDecoder = new RobotDecoder(_engine->getPlatform() == Common::kPlatformMacintosh);
} else if (_videoFile.hasSuffix(".duk")) {
duckMode = true;
- videoDecoder = new Video::AviDecoder(g_system->getMixer());
+ videoDecoder = new Video::AVIDecoder();
#endif
} else if (_videoFile.hasSuffix(".avi")) {
- videoDecoder = new Video::AviDecoder(g_system->getMixer());
+ videoDecoder = new Video::AVIDecoder();
} else {
warning("Unrecognized video type");
}
@@ -365,7 +368,10 @@ bool Console::cmdHelp(int argc, const char **argv) {
DebugPrintf(" pic_visualize - Enables visualization of the drawing process of EGA pictures\n");
DebugPrintf(" undither - Enable/disable undithering\n");
DebugPrintf(" play_video - Plays a SEQ, AVI, VMD, RBT or DUK video\n");
- DebugPrintf(" animate_object_list / al - Shows the current list of objects in kAnimate's draw list\n");
+ DebugPrintf(" animate_list / al - Shows the current list of objects in kAnimate's draw list (SCI0 - SCI1.1)\n");
+ DebugPrintf(" window_list / wl - Shows a list of all the windows (ports) in the draw list (SCI0 - SCI1.1)\n");
+ DebugPrintf(" plane_list / pl - Shows a list of all the planes in the draw list (SCI2+)\n");
+ DebugPrintf(" plane_items / pi - Shows a list of all items for a plane (SCI2+)\n");
DebugPrintf(" saved_bits - List saved bits on the hunk\n");
DebugPrintf(" show_saved_bits - Display saved bits\n");
DebugPrintf("\n");
@@ -1209,12 +1215,33 @@ bool Console::cmdRestartGame(int argc, const char **argv) {
return Cmd_Exit(0, 0);
}
+// The scripts get IDs ranging from 100->199, because the scripts require us to assign unique ids THAT EVEN STAY BETWEEN
+// SAVES and the scripts also use "saves-count + 1" to create a new savedgame slot.
+// SCI1.1 actually recycles ids, in that case we will currently get "0".
+// This behavior is required especially for LSL6. In this game, it's possible to quick save. The scripts will use
+// the last-used id for that feature. If we don't assign sticky ids, the feature will overwrite different saves all the
+// time. And sadly we can't just use the actual filename ids directly, because of the creation method for new slots.
+
+extern void listSavegames(Common::Array<SavegameDesc> &saves);
+
+bool Console::cmdListSaves(int argc, const char **argv) {
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+
+ for (uint i = 0; i < saves.size(); i++) {
+ Common::String filename = g_sci->getSavegameName(saves[i].id);
+ DebugPrintf("%s: '%s'\n", filename.c_str(), saves[i].name);
+ }
+
+ return true;
+}
+
bool Console::cmdClassTable(int argc, const char **argv) {
DebugPrintf("Available classes (parse a parameter to filter the table by a specific class):\n");
for (uint i = 0; i < _engine->_gamestate->_segMan->classTableSize(); i++) {
Class temp = _engine->_gamestate->_segMan->_classTable[i];
- if (temp.reg.segment) {
+ if (temp.reg.getSegment()) {
const char *className = _engine->_gamestate->_segMan->getObjectName(temp.reg);
if (argc == 1 || (argc == 2 && !strcmp(className, argv[1]))) {
DebugPrintf(" Class 0x%x (%s) at %04x:%04x (script %d)\n", i,
@@ -1589,6 +1616,8 @@ bool Console::cmdAnimateList(int argc, const char **argv) {
if (_engine->_gfxAnimate) {
DebugPrintf("Animate list:\n");
_engine->_gfxAnimate->printAnimateList(this);
+ } else {
+ DebugPrintf("This SCI version does not have an animate list\n");
}
return true;
}
@@ -1597,9 +1626,52 @@ bool Console::cmdWindowList(int argc, const char **argv) {
if (_engine->_gfxPorts) {
DebugPrintf("Window list:\n");
_engine->_gfxPorts->printWindowList(this);
+ } else {
+ DebugPrintf("This SCI version does not have a list of ports\n");
}
return true;
+}
+
+bool Console::cmdPlaneList(int argc, const char **argv) {
+#ifdef ENABLE_SCI32
+ if (_engine->_gfxFrameout) {
+ DebugPrintf("Plane list:\n");
+ _engine->_gfxFrameout->printPlaneList(this);
+ } else {
+ DebugPrintf("This SCI version does not have a list of planes\n");
+ }
+#else
+ DebugPrintf("SCI32 isn't included in this compiled executable\n");
+#endif
+ return true;
+}
+bool Console::cmdPlaneItemList(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Shows the list of items for a plane\n");
+ DebugPrintf("Usage: %s <plane address>\n", argv[0]);
+ return true;
+ }
+
+ reg_t planeObject = NULL_REG;
+
+ if (parse_reg_t(_engine->_gamestate, argv[1], &planeObject, false)) {
+ DebugPrintf("Invalid address passed.\n");
+ DebugPrintf("Check the \"addresses\" command on how to use addresses\n");
+ return true;
+ }
+
+#ifdef ENABLE_SCI32
+ if (_engine->_gfxFrameout) {
+ DebugPrintf("Plane item list:\n");
+ _engine->_gfxFrameout->printPlaneItemList(this, planeObject);
+ } else {
+ DebugPrintf("This SCI version does not have a list of plane items\n");
+ }
+#else
+ DebugPrintf("SCI32 isn't included in this compiled executable\n");
+#endif
+ return true;
}
bool Console::cmdSavedBits(int argc, const char **argv) {
@@ -1614,7 +1686,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) {
Common::Array<reg_t> entries = hunks->listAllDeallocatable(id);
for (uint i = 0; i < entries.size(); ++i) {
- uint16 offset = entries[i].offset;
+ uint16 offset = entries[i].getOffset();
const Hunk& h = hunks->_table[offset];
if (strcmp(h.type, "SaveBits()") == 0) {
byte* memoryPtr = (byte *)h.mem;
@@ -1677,12 +1749,12 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) {
return true;
}
- if (memoryHandle.segment != id || !hunks->isValidOffset(memoryHandle.offset)) {
+ if (memoryHandle.getSegment() != id || !hunks->isValidOffset(memoryHandle.getOffset())) {
DebugPrintf("Invalid address.\n");
return true;
}
- const Hunk& h = hunks->_table[memoryHandle.offset];
+ const Hunk& h = hunks->_table[memoryHandle.getOffset()];
if (strcmp(h.type, "SaveBits()") != 0) {
DebugPrintf("Invalid address.\n");
@@ -2192,16 +2264,16 @@ bool Console::cmdGCShowReachable(int argc, const char **argv) {
return true;
}
- SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.segment);
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment());
if (!mobj) {
- DebugPrintf("Unknown segment : %x\n", addr.segment);
+ DebugPrintf("Unknown segment : %x\n", addr.getSegment());
return 1;
}
DebugPrintf("Reachable from %04x:%04x:\n", PRINT_REG(addr));
const Common::Array<reg_t> tmp = mobj->listAllOutgoingReferences(addr);
for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it)
- if (it->segment)
+ if (it->getSegment())
g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(*it));
return true;
@@ -2224,16 +2296,16 @@ bool Console::cmdGCShowFreeable(int argc, const char **argv) {
return true;
}
- SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.segment);
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment());
if (!mobj) {
- DebugPrintf("Unknown segment : %x\n", addr.segment);
+ DebugPrintf("Unknown segment : %x\n", addr.getSegment());
return true;
}
- DebugPrintf("Freeable in segment %04x:\n", addr.segment);
- const Common::Array<reg_t> tmp = mobj->listAllDeallocatable(addr.segment);
+ DebugPrintf("Freeable in segment %04x:\n", addr.getSegment());
+ const Common::Array<reg_t> tmp = mobj->listAllDeallocatable(addr.getSegment());
for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it)
- if (it->segment)
+ if (it->getSegment())
g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(*it));
return true;
@@ -2257,9 +2329,9 @@ bool Console::cmdGCNormalize(int argc, const char **argv) {
return true;
}
- SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.segment);
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment());
if (!mobj) {
- DebugPrintf("Unknown segment : %x\n", addr.segment);
+ DebugPrintf("Unknown segment : %x\n", addr.getSegment());
return true;
}
@@ -2498,12 +2570,12 @@ bool Console::cmdViewReference(int argc, const char **argv) {
DebugPrintf("%04x:%04x is of type 0x%x: ", PRINT_REG(reg), type_mask);
- if (reg.segment == 0 && reg.offset == 0) {
+ if (reg.getSegment() == 0 && reg.getOffset() == 0) {
DebugPrintf("Null.\n");
return true;
}
- if (reg_end.segment != reg.segment && reg_end != NULL_REG) {
+ if (reg_end.getSegment() != reg.getSegment() && reg_end != NULL_REG) {
DebugPrintf("Ending segment different from starting segment. Assuming no bound on dump.\n");
reg_end = NULL_REG;
}
@@ -2539,7 +2611,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
printObject(reg);
break;
case SIG_TYPE_REFERENCE: {
- switch (_engine->_gamestate->_segMan->getSegmentType(reg.segment)) {
+ switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) {
#ifdef ENABLE_SCI32
case SEG_TYPE_STRING: {
DebugPrintf("SCI32 string\n");
@@ -2555,21 +2627,20 @@ bool Console::cmdViewReference(int argc, const char **argv) {
}
#endif
default: {
- int size;
const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg);
- size = block.maxSize;
+ uint16 size = block.maxSize;
DebugPrintf("raw data\n");
- if (reg_end.segment != 0 && size < reg_end.offset - reg.offset) {
+ if (reg_end.getSegment() != 0 && (size < reg_end.getOffset() - reg.getOffset())) {
DebugPrintf("Block end out of bounds (size %d). Resetting.\n", size);
reg_end = NULL_REG;
}
- if (reg_end.segment != 0 && (size >= reg_end.offset - reg.offset))
- size = reg_end.offset - reg.offset;
+ if (reg_end.getSegment() != 0 && (size >= reg_end.getOffset() - reg.getOffset()))
+ size = reg_end.getOffset() - reg.getOffset();
- if (reg_end.segment != 0)
+ if (reg_end.getSegment() != 0)
DebugPrintf("Block size less than or equal to %d\n", size);
if (block.isRaw)
@@ -2581,7 +2652,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
break;
}
case SIG_TYPE_INTEGER:
- DebugPrintf("arithmetic value\n %d (%04x)\n", (int16) reg.offset, reg.offset);
+ DebugPrintf("arithmetic value\n %d (%04x)\n", (int16) reg.getOffset(), reg.getOffset());
break;
default:
DebugPrintf("unknown type %d.\n", type);
@@ -2651,7 +2722,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) {
switch (call.type) {
case EXEC_STACK_TYPE_CALL: // Normal function
if (call.type == EXEC_STACK_TYPE_CALL)
- DebugPrintf(" %x: script %d - ", i, (*(Script *)_engine->_gamestate->_segMan->_heap[call.addr.pc.segment]).getScriptNumber());
+ DebugPrintf(" %x: script %d - ", i, (*(Script *)_engine->_gamestate->_segMan->_heap[call.addr.pc.getSegment()]).getScriptNumber());
if (call.debugSelector != -1) {
DebugPrintf("%s::%s(", objname, _engine->getKernel()->getSelectorName(call.debugSelector).c_str());
} else if (call.debugExportId != -1) {
@@ -2811,17 +2882,17 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
reg_t addr = NULL_REG;
if (!obj) {
- DebugPrintf("Not an object.");
+ DebugPrintf("Not an object.\n");
return true;
}
if (selectorId < 0) {
- DebugPrintf("Not a valid selector name.");
+ DebugPrintf("Not a valid selector name.\n");
return true;
}
if (lookupSelector(_engine->_gamestate->_segMan, objAddr, selectorId, NULL, &addr) != kSelectorMethod) {
- DebugPrintf("Not a method.");
+ DebugPrintf("Not a method.\n");
return true;
}
@@ -2840,10 +2911,11 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
if (jumpTarget > farthestTarget)
farthestTarget = jumpTarget;
}
- addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode);
+ // TODO: Use a true 32-bit reg_t for the position (addr)
+ addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), printBWTag, printBytecode);
if (addr.isNull() && prevAddr < farthestTarget)
addr = prevAddr + 1; // skip past the ret
- } while (addr.offset > 0);
+ } while (addr.getOffset() > 0);
return true;
}
@@ -2860,10 +2932,10 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
}
reg_t vpc = NULL_REG;
- int opCount = 1;
+ uint opCount = 1;
bool printBWTag = false;
bool printBytes = false;
- int size;
+ uint16 size;
if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) {
DebugPrintf("Invalid address passed.\n");
@@ -2872,7 +2944,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
}
SegmentRef ref = _engine->_gamestate->_segMan->dereference(vpc);
- size = ref.maxSize + vpc.offset; // total segment size
+ size = ref.maxSize + vpc.getOffset(); // total segment size
for (int i = 2; i < argc; i++) {
if (!scumm_stricmp(argv[i], "bwt"))
@@ -2887,14 +2959,10 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
}
}
- if (opCount < 0) {
- DebugPrintf("Invalid op_count\n");
- return true;
- }
-
do {
- vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes);
- } while ((vpc.offset > 0) && (vpc.offset + 6 < size) && (--opCount));
+ // TODO: Use a true 32-bit reg_t for the position (vpc)
+ vpc = disassemble(_engine->_gamestate, make_reg32(vpc.getSegment(), vpc.getOffset()), printBWTag, printBytes);
+ } while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount));
return true;
}
@@ -2917,8 +2985,9 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
// 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)) {
+ (_engine->getGameId() == GID_KQ7 && itr->getNumber() == 111) ||
+ (_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980) ||
+ (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947)) {
continue;
}
@@ -2937,7 +3006,7 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
// Now dissassemble each method of the script object
for (uint16 i = 0; i < obj->getMethodCount(); i++) {
reg_t fptr = obj->getFunction(i);
- uint16 offset = fptr.offset;
+ uint16 offset = fptr.getOffset();
int16 opparams[4];
byte extOpcode;
byte opcode;
@@ -3584,10 +3653,14 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
relativeOffset = true;
if (!scumm_strnicmp(str + 1, "PC", 2)) {
- *dest = s->_executionStack.back().addr.pc;
+ // TODO: Handle 32-bit PC addresses
+ reg32_t pc = s->_executionStack.back().addr.pc;
+ *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset());
offsetStr = str + 3;
} else if (!scumm_strnicmp(str + 1, "P", 1)) {
- *dest = s->_executionStack.back().addr.pc;
+ // TODO: Handle 32-bit PC addresses
+ reg32_t pc = s->_executionStack.back().addr.pc;
+ *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset());
offsetStr = str + 2;
} else if (!scumm_strnicmp(str + 1, "PREV", 4)) {
*dest = s->r_prev;
@@ -3625,8 +3698,8 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
return 1;
// Now lookup the script's segment
- dest->segment = s->_segMan->getScriptSegment(script_nr);
- if (!dest->segment) {
+ dest->setSegment(s->_segMan->getScriptSegment(script_nr));
+ if (!dest->getSegment()) {
return 1;
}
@@ -3708,19 +3781,19 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
offsetStr = colon + 1;
Common::String segmentStr(str, colon);
- dest->segment = strtol(segmentStr.c_str(), &endptr, 16);
+ dest->setSegment(strtol(segmentStr.c_str(), &endptr, 16));
if (*endptr)
return 1;
} else {
int val = 0;
- dest->segment = 0;
+ dest->setSegment(0);
if (charsCountNumber == charsCount) {
// Only numbers in input, assume decimal value
val = strtol(str, &endptr, 10);
if (*endptr)
return 1; // strtol failed?
- dest->offset = val;
+ dest->setOffset(val);
return 0;
} else {
// We also got letters, check if there were only hexadecimal letters and '0x' at the start or 'h' at the end
@@ -3728,7 +3801,7 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
val = strtol(str, &endptr, 16);
if ((*endptr != 'h') && (*endptr != 0))
return 1;
- dest->offset = val;
+ dest->setOffset(val);
return 0;
} else {
// Something else was in input, assume object name
@@ -3777,9 +3850,9 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
int val = strtol(offsetStr, &endptr, 16);
if (relativeOffset)
- dest->offset += val;
+ dest->incOffset(val);
else
- dest->offset = val;
+ dest->setOffset(val);
if (*endptr)
return 1;
@@ -3859,15 +3932,15 @@ void Console::printList(List *list) {
while (!pos.isNull()) {
Node *node;
- NodeTable *nt = (NodeTable *)_engine->_gamestate->_segMan->getSegment(pos.segment, SEG_TYPE_NODES);
+ NodeTable *nt = (NodeTable *)_engine->_gamestate->_segMan->getSegment(pos.getSegment(), SEG_TYPE_NODES);
- if (!nt || !nt->isValidEntry(pos.offset)) {
+ if (!nt || !nt->isValidEntry(pos.getOffset())) {
DebugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n",
PRINT_REG(pos));
return;
}
- node = &(nt->_table[pos.offset]);
+ node = &(nt->_table[pos.getOffset()]);
DebugPrintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
@@ -3886,37 +3959,37 @@ void Console::printList(List *list) {
}
int Console::printNode(reg_t addr) {
- SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(addr.segment, SEG_TYPE_LISTS);
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(addr.getSegment(), SEG_TYPE_LISTS);
if (mobj) {
ListTable *lt = (ListTable *)mobj;
List *list;
- if (!lt->isValidEntry(addr.offset)) {
+ if (!lt->isValidEntry(addr.getOffset())) {
DebugPrintf("Address does not contain a list\n");
return 1;
}
- list = &(lt->_table[addr.offset]);
+ list = &(lt->_table[addr.getOffset()]);
DebugPrintf("%04x:%04x : first x last = (%04x:%04x, %04x:%04x)\n", PRINT_REG(addr), PRINT_REG(list->first), PRINT_REG(list->last));
} else {
NodeTable *nt;
Node *node;
- mobj = _engine->_gamestate->_segMan->getSegment(addr.segment, SEG_TYPE_NODES);
+ mobj = _engine->_gamestate->_segMan->getSegment(addr.getSegment(), SEG_TYPE_NODES);
if (!mobj) {
- DebugPrintf("Segment #%04x is not a list or node segment\n", addr.segment);
+ DebugPrintf("Segment #%04x is not a list or node segment\n", addr.getSegment());
return 1;
}
nt = (NodeTable *)mobj;
- if (!nt->isValidEntry(addr.offset)) {
+ if (!nt->isValidEntry(addr.getOffset())) {
DebugPrintf("Address does not contain a node\n");
return 1;
}
- node = &(nt->_table[addr.offset]);
+ node = &(nt->_table[addr.getOffset()]);
DebugPrintf("%04x:%04x : prev x next = (%04x:%04x, %04x:%04x); maps %04x:%04x -> %04x:%04x\n",
PRINT_REG(addr), PRINT_REG(node->pred), PRINT_REG(node->succ), PRINT_REG(node->key), PRINT_REG(node->value));
@@ -3954,8 +4027,8 @@ int Console::printObject(reg_t pos) {
reg_t val = obj->getVariable(i);
DebugPrintf("%04x:%04x", PRINT_REG(val));
- if (!val.segment)
- DebugPrintf(" (%d)", val.offset);
+ if (!val.getSegment())
+ DebugPrintf(" (%d)", val.getOffset());
const Object *ref = s->_segMan->getObject(val);
if (ref)
@@ -3968,8 +4041,8 @@ int Console::printObject(reg_t pos) {
reg_t fptr = obj->getFunction(i);
DebugPrintf(" [%03x] %s = %04x:%04x\n", obj->getFuncSelector(i), _engine->getKernel()->getSelectorName(obj->getFuncSelector(i)).c_str(), PRINT_REG(fptr));
}
- if (s->_segMan->_heap[pos.segment]->getType() == SEG_TYPE_SCRIPT)
- DebugPrintf("\nOwner script: %d\n", s->_segMan->getScript(pos.segment)->getScriptNumber());
+ if (s->_segMan->_heap[pos.getSegment()]->getType() == SEG_TYPE_SCRIPT)
+ DebugPrintf("\nOwner script: %d\n", s->_segMan->getScript(pos.getSegment())->getScriptNumber());
return 0;
}
diff --git a/engines/sci/console.h b/engines/sci/console.h
index d943923ba1..1c54748842 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -33,7 +33,7 @@ namespace Sci {
class SciEngine;
struct List;
-reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode);
+reg_t disassemble(EngineState *s, reg32_t pos, bool printBWTag, bool printBytecode);
bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpOffset);
class Console : public GUI::Debugger {
@@ -94,6 +94,8 @@ private:
bool cmdPlayVideo(int argc, const char **argv);
bool cmdAnimateList(int argc, const char **argv);
bool cmdWindowList(int argc, const char **argv);
+ bool cmdPlaneList(int argc, const char **argv);
+ bool cmdPlaneItemList(int argc, const char **argv);
bool cmdSavedBits(int argc, const char **argv);
bool cmdShowSavedBits(int argc, const char **argv);
// Segments
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index c43849056b..58ac5f1fa6 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -26,6 +26,7 @@
#include "common/ptr.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/translation.h"
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
@@ -362,6 +363,83 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
#include "sci/detection_tables.h"
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_EGA_UNDITHER,
+ {
+ _s("EGA undithering"),
+ _s("Enable undithering in EGA games"),
+ "disable_dithering",
+ false
+ }
+ },
+
+ {
+ GAMEOPTION_PREFER_DIGITAL_SFX,
+ {
+ _s("Prefer digital sound effects"),
+ _s("Prefer digital sound effects instead of synthesized ones"),
+ "prefer_digitalsfx",
+ true
+ }
+ },
+
+ {
+ GAMEOPTION_ORIGINAL_SAVELOAD,
+ {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens, instead of the ScummVM ones"),
+ "originalsaveload",
+ false
+ }
+ },
+
+ {
+ GAMEOPTION_FB01_MIDI,
+ {
+ _s("Use IMF/Yamaha FB-01 for MIDI output"),
+ _s("Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI output"),
+ "native_fb01",
+ false
+ }
+ },
+
+ // Jones in the Fast Lane - CD audio tracks or resource.snd
+ {
+ GAMEOPTION_JONES_CDAUDIO,
+ {
+ _s("Use CD audio"),
+ _s("Use CD audio instead of in-game audio, if available"),
+ "use_cdaudio",
+ true
+ }
+ },
+
+ // KQ6 Windows - windows cursors
+ {
+ GAMEOPTION_KQ6_WINDOWS_CURSORS,
+ {
+ _s("Use Windows cursors"),
+ _s("Use the Windows cursors (smaller and monochrome) instead of the DOS ones"),
+ "windows_cursors",
+ false
+ }
+ },
+
+ // SQ4 CD - silver cursors
+ {
+ GAMEOPTION_SQ4_SILVER_CURSORS,
+ {
+ _s("Use silver cursors"),
+ _s("Use the alternate set of silver cursors, instead of the normal golden ones"),
+ "silver_cursors",
+ false
+ }
+ },
+
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
/**
* The fallback game descriptor used by the SCI engine's fallbackDetector.
* Contents of this struct are overwritten by the fallbackDetector.
@@ -373,14 +451,14 @@ static ADGameDescription s_fallbackDesc = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI)
};
static char s_fallbackGameIdBuf[256];
class SciMetaEngine : public AdvancedMetaEngine {
public:
- SciMetaEngine() : AdvancedMetaEngine(Sci::SciGameDescriptions, sizeof(ADGameDescription), s_sciGameTitles) {
+ SciMetaEngine() : AdvancedMetaEngine(Sci::SciGameDescriptions, sizeof(ADGameDescription), s_sciGameTitles, optionsList) {
_singleid = "sci";
}
@@ -435,7 +513,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
s_fallbackDesc.flags = ADGF_NO_FLAGS;
s_fallbackDesc.platform = Common::kPlatformPC; // default to PC platform
s_fallbackDesc.gameid = "sci";
- s_fallbackDesc.guioptions = GUIO0();
+ s_fallbackDesc.guioptions = GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI);
if (allFiles.contains("resource.map") || allFiles.contains("Data1")
|| allFiles.contains("resmap.001") || allFiles.contains("resmap.001")) {
@@ -565,7 +643,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
const bool isCD = (s_fallbackDesc.flags & ADGF_CD);
if (!isCD)
- s_fallbackDesc.guioptions = GUIO1(GUIO_NOSPEECH);
+ s_fallbackDesc.guioptions = GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI);
if (gameId.hasSuffix("sci")) {
s_fallbackDesc.extra = "SCI";
@@ -684,9 +762,6 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
-
int day = (meta.saveDate >> 24) & 0xFF;
int month = (meta.saveDate >> 16) & 0xFF;
int year = meta.saveDate & 0xFFFF;
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 63eda1c348..b978f40aba 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -22,6 +22,14 @@
namespace Sci {
+#define GAMEOPTION_PREFER_DIGITAL_SFX GUIO_GAMEOPTIONS1
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS2
+#define GAMEOPTION_FB01_MIDI GUIO_GAMEOPTIONS3
+#define GAMEOPTION_JONES_CDAUDIO GUIO_GAMEOPTIONS4
+#define GAMEOPTION_KQ6_WINDOWS_CURSORS GUIO_GAMEOPTIONS5
+#define GAMEOPTION_SQ4_SILVER_CURSORS GUIO_GAMEOPTIONS6
+#define GAMEOPTION_EGA_UNDITHER GUIO_GAMEOPTIONS7
+
// SCI3 games have a different script format (in CSC files) and are currently unsupported
#define ENABLE_SCI3_GAMES
@@ -29,7 +37,7 @@ namespace Sci {
{"sci-fanmade", name, { \
{"resource.map", 0, resMapMd5, resMapSize}, \
{"resource.001", 0, resMd5, resSize}, \
- AD_LISTEND}, lang, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) \
+ AD_LISTEND}, lang, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) \
}
#define FANMADE(name, resMapMd5, resMapSize, resMd5, resSize) FANMADE_L(name, resMapMd5, resMapSize, resMd5, resSize, Common::EN_ANY)
@@ -42,7 +50,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "f3d1be7752d30ba60614533d531e2e98", 474},
{"resource.001", 0, "6fd05926c2199af0af6f72f90d0d7260", 126895},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.005.000"
@@ -54,7 +62,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "d226d7d3b4f77c4a566913fc310487fc", 792380},
{"resource.003", 0, "d226d7d3b4f77c4a566913fc310487fc", 464348},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - German Amiga (from www.back2roots.org, also includes English language)
// Executable scanning reports "1.005.001"
@@ -66,7 +74,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 826309},
{"resource.003", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 493638},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain Macintosh (from omer_mor, bug report #3328251)
{"castlebrain", "", {
@@ -76,7 +84,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "e1a6b6f1060f60be9dcb6d28ad7a2a20", 1168310},
{"resource.003", 0, "6c3d1bb26ad532c94046bc9ac49b5ff4", 891295},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English DOS Non-Interactive Demo
// SCI interpreter version 1.000.005
@@ -85,7 +93,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "9780f040d58182994e22d2e34fab85b0", 67367},
{"resource.001", 0, "2af49dbd8f2e1db4ab09f9310dc91259", 570553},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English DOS 5.25" Floppy EGA (from omer_mor, bug report #3035349)
{"castlebrain", "EGA", {
@@ -98,7 +106,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "8a5ed3ba96e2eaf18e36fedfaab89419", 297838},
{"resource.006", 0, "dceed92e709cad1bd9582809a235b0a0", 266682},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English DOS 3.5" Floppy EGA (from nozomi77, bug report #3405307)
{"castlebrain", "EGA", {
@@ -108,7 +116,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "de2f182529efaad2c4b510b452ab77ac", 633662},
{"resource.003", 0, "38b4b37febc6b4f5061c461a283df148", 430388},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English DOS Floppy (from jvprat)
// Executable scanning reports "1.000.044", Floppy label reports "1.0, 10.30.91", VERSION file reports "1.000"
@@ -119,7 +127,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d2f5a1be74ed963fa849a76892be5290", 794832},
{"resource.002", 0, "c0c29c51af66d65cb53f49e785a2d978", 1280907},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English DOS Floppy 1.1
{"castlebrain", "", {
@@ -128,7 +136,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "13e81e1839cd7b216d2bb5615c1ca160", 796776},
{"resource.002", 0, "930e416bec196b9703a331d81b3d66f2", 1283812},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - English DOS Floppy 1.000
// Reported by graxer in bug report #3037942
@@ -143,7 +151,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "1d778a0c65cac9ddbab65495e50a94ee", 335281},
{"resource.007", 0, "063bb8ce4157c778cf30d1c912c006f1", 335631},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Castle of Dr. Brain - Spanish DOS (also includes english language)
// SCI interpreter version 1.000.510
@@ -152,7 +160,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 1197694},
{"resource.001", 0, "735be4e58957180cfc807d5e18fdffcd", 1433302},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Christmas Card 1988 - English DOS
// SCI interpreter version 0.000.294
@@ -160,7 +168,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "39485580d34a72997f3d5b3aba4d24f1", 426},
{"resource.001", 0, "11391434f41c834090d7a1e9488ce936", 129739},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Christmas Card 1990: The Seasoned Professional - English DOS (16 Colors)
// SCI interpreter version 1.000.172
@@ -168,7 +176,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8f656714a05b94423ac6eb10ee8797d0", 600},
{"resource.001", 0, "acde93e58fca4f7a2a5a220558a94aa8", 272629},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Christmas Card 1990: The Seasoned Professional - English DOS (256 Colors)
// SCI interpreter version 1.000.174
@@ -176,7 +184,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "44b8f45b841b9b5e17e939a35e443988", 600},
{"resource.001", 0, "acde93e58fca4f7a2a5a220558a94aa8", 335362},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Christmas Card 1992 - English DOS
// SCI interpreter version 1.001.055
@@ -184,7 +192,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "f1f8c8a8443f523422af70b4ec85b71c", 318},
{"resource.000", 0, "62fb9256f8e7e6e65a6875efdb7939ac", 203396},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Codename: Iceman - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.031"
@@ -198,7 +206,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "8613c45fc771d658e5a505b9a4a54f31", 713382},
{"resource.005", 0, "605b67a9ef199a9bb015745e7c004cf4", 478384},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Codename: Iceman - English DOS Non-Interactive Demo
// Executable scanning reports "0.000.685"
@@ -206,7 +214,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "782974f29d8a824782d2d4aea39964e3", 1056},
{"resource.001", 0, "d4b75e280d1c3a97cfef1b0bebff387c", 573647},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Codename: Iceman - English DOS (from jvprat)
// Executable scanning reports "0.000.685", Floppy label reports "1.033, 6.8.90", VERSION file reports "1.033"
@@ -219,7 +227,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "d97a96f1ab91b41cf46a02cc89b0a04e", 624303},
{"resource.004", 0, "8613c45fc771d658e5a505b9a4a54f31", 670883},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Codename: Iceman - English DOS (from FRG)
// SCI interpreter version 0.000.668
@@ -231,7 +239,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "dc7c5280e7acfaffe6ef2a6c963c5f94", 622118},
{"resource.004", 0, "64f342463f6f35ba71b3509ef696ae3f", 669188},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Codename: Iceman - English DOS (supplied by ssburnout in bug report #3049193)
// 1.022 9x5.25" (label: Int#0.000.668)
@@ -246,7 +254,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "08050329aa113a9f14ed99cbfe3536ec", 232942},
{"resource.007", 0, "64f342463f6f35ba71b3509ef696ae3f", 267811},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Codename: Iceman - English DOS 1.023 (from abevi, bug report #2612718)
{"iceman", "", {
@@ -260,7 +268,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "08050329aa113a9f14ed99cbfe3536ec", 232942},
{"resource.007", 0, "64f342463f6f35ba71b3509ef696ae3f", 267702},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of Camelot - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.030"
@@ -275,7 +283,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "c6e551bdc24f0acc193159038d4ca767", 605882},
{"resource.006", 0, "8f880a536908ab496bbc552f7f5c3738", 585255},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of Camelot - English DOS Non-Interactive Demo
// SCI interpreter version 0.000.668
@@ -283,7 +291,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "f4cd75c15be75e04cdca3acda2c0b0ea", 468},
{"resource.001", 0, "4930708722f34bfbaa4945fb08f55f61", 232523},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of Camelot - English DOS (from jvprat)
// Executable scanning reports "0.000.685", Floppy label reports "1.001, 0.000.685", VERSION file reports "1.001.000"
@@ -295,7 +303,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "8e1a3a8c588007404b532b8dfacc1460", 723712},
{"resource.004", 0, "8e1a3a8c588007404b532b8dfacc1460", 729143},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of Camelot - English DOS
// SCI interpreter version 0.000.685
@@ -309,7 +317,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "8e1a3a8c588007404b532b8dfacc1460", 332446},
{"resource.007", 0, "8e1a3a8c588007404b532b8dfacc1460", 358182},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.005.001"
@@ -324,7 +332,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "1c3804e56b114028c5873a35c2f06d13", 653002},
{"resource.006", 0, "f9487732289a4f4966b4e34eea413325", 842817},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow - English DOS
// SCI interpreter version 1.000.510
@@ -338,7 +346,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1154950},
{"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1042966},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow - English DOS Floppy (from jvprat)
// Executable scanning reports "1.000.168", Floppy label reports "1.1, 1.13.92", VERSION file reports "1.1"
@@ -352,7 +360,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1261462},
{"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284720},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow - English DOS
// SCI interpreter version 1.000.510
@@ -365,7 +373,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1260237},
{"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284609},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow EGA - English DOS
// SCI interpreter version 1.000.510
@@ -378,7 +386,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b7bb35c027bb424ecefcd122768e5e60", 705631},
{"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243},
{"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158},
- AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow DOS 1.0 EGA (4 x 5.25" disks)
// Provided by ssburnout in bug report #3046802
@@ -388,7 +396,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "76c729e563809170e6cc8b2f3f6cf0a4", 1196133},
{"resource.002", 0, "8c767b3939add63d11274065e46aad04", 1152478},
{"resource.003", 0, "7025b87e735b1df3f0e9488a621f4333", 1171439},
- AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow - English DOS Non-Interactive Demo
// SCI interpreter version 1.000.510
@@ -396,7 +404,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "cbc5cb73341de1bff1b1e20a640af220", 588},
{"resource.001", 0, "f05a20cc07eee85da8e999d0ac0f596b", 869916},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Conquests of the Longbow - German DOS (suplied by markcoolio in bug report #2727681, also includes english language)
// SCI interpreter version 1.000.510
@@ -410,7 +418,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1176914},
{"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1123585},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - English DOS Non-Interactive Demo (from FRG)
// Executable scanning reports "x.yyy.zzz"
@@ -419,7 +427,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "c819e171359b7c95f4c13b846d5c034e", 873},
{"resource.001", 0, "baf9393a9bfa73098adb501e5bc5487b", 657518},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - English DOS CD 1.1
// SCI interpreter version 1.001.064
@@ -427,7 +435,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a4b73d5d2b55bdb6e44345e99c8fbdd0", 4804},
{"resource.000", 0, "d908dbef56816ac6c60dd145fdeafb2b", 3536046},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - English DOS CD 1.1
// SCI interpreter version 1.001.064
@@ -437,7 +445,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a4b73d5d2b55bdb6e44345e99c8fbdd0", 4804},
{"resource.000", 0, "d908dbef56816ac6c60dd145fdeafb2b", 3536046},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO4(GUIO_MIDIGM, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - English DOS Floppy
// SCI interpreter version 1.000.510
@@ -448,7 +456,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "28fe9b4f0567e71feb198bc9f3a2c605", 1241816},
{"resource.003", 0, "f3146df0ad4297f5ce35aa8c4753bf6c", 586832},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - English DOS Floppy
// SCI interpreter version 1.000.510
@@ -459,7 +467,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "323b3b12f43d53f27d259beb225f0aa7", 1129316},
{"resource.003", 0, "83ac03e4bddb2c1ac2d36d2a587d0536", 1145616},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - German DOS Floppy (supplied by markcoolio in bug report #2723744, also includes english language)
// SCI interpreter version 1.000.510
@@ -470,7 +478,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "02d7d0411f7903aacb3bc8b0f8ca8a9a", 1202581},
{"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1175835},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - Spanish DOS Floppy (from jvprat, also includes english language)
// Executable scanning reports "1.ECO.013", VERSION file reports "1.000, 11.12.92"
@@ -482,7 +490,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "2d21a1d2dcbffa551552e3e0725d2284", 1186033},
{"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1174993},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest - French DOS Floppy (from Strangerke, also includes english language)
// SCI interpreter version 1.ECO.013
@@ -493,7 +501,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "b836c6ee9de67d814ac5d1b05f5b9858", 1173872},
{"resource.003", 0, "f8f767f9d6351432621c6e54c1b2ba8c", 1141520},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest 2 - English DOS Non-Interactive Demo
// SCI interpreter version 1.001.055
@@ -501,7 +509,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "607cfa0d8a03b7d348c06ee727e3d939", 1321},
{"resource.000", 0, "dd6f614c43c029f063e93cd243af90a4", 525992},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest 2 - English DOS Floppy (supplied by markcoolio in bug report #2723761)
// SCI interpreter version 1.001.065
@@ -509,7 +517,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "28fb7b6abb9fc1cb8882d7c2e701b63f", 5658},
{"resource.000", 0, "cc1d17e5637528dbe4a812699e1cbfc6", 4208192},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest 2 - French DOS Floppy (from Strangerke)
// SCI interpreter version 1.001.081
@@ -517,7 +525,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "c22ab8b33c339c138b6b1697b77b9e79", 5588},
{"resource.000", 0, "1c4093f7248240329121fdf8c0d59152", 4231946},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Eco Quest 2 - Spanish DOS Floppy (supplied by umbrio in bug report #3313962)
{"ecoquest2", "Floppy", {
@@ -525,7 +533,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "1c4093f7248240329121fdf8c0d59152", 4209150},
{"resource.msg", 0, "eff8be1925d42288de55e405983e9314", 117810},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - English DOS demo (from FRG)
// SCI interpreter version 1.001.069
@@ -533,7 +541,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "97aa9fcfe84c9993a64debd28c32393a", 1909},
{"resource.000", 0, "5ea8e7a3ea10cce6efd5c106dc62fd8c", 867724},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - English CD DOS (from FRG)
// SCI interpreter version 1.001.132
@@ -541,7 +549,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "d46b282f228a67ba13bd4b4009e95f8f", 6058},
{"resource.000", 0, "ee3c64ffff0ba9fb08bea2624631c598", 5490246},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - English DOS Floppy (updated information from markcoolio in bug reports #2723773 and #2724720)
// Executable scanning reports "1.cfs.081"
@@ -551,7 +559,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "96b07e9b914dba1c8dc6c78a176326df", 5233230},
{"resource.msg", 0, "554f65315d851184f6e38211489fdd8f", -1},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - Windows (supplied by abevi in bug report #2612718)
// Executable scanning reports "1.cfs.081"
@@ -560,7 +568,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a32674e7fbf7b213b4a066c8037f16b6", 5816},
{"resource.000", 0, "fed4808fdb72486908ac7ad0044b14d8", 5233230},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformWindows, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - German DOS Floppy (from Tobis87, updated information from markcoolio in bug reports #2723772 and #2724720)
// Executable scanning reports "1.cfs.081"
@@ -570,7 +578,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "96b07e9b914dba1c8dc6c78a176326df", 5233230},
{"resource.msg", 0, "304b5a5781800affd2235152a5794fa8", -1},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - Spanish DOS (from jvprat)
// Executable scanning reports "1.cfs.081", VERSION file reports "1.000, March 30, 1995"
@@ -583,7 +591,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "05acdc256c742e79c50b9fe7ec2cc898", 863310},
{"resource.msg", 0, "45b5bf74933ac3727e4cc844446dc052", 796156},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - Spanish DOS (from jvprat)
// Executable scanning reports "1.cfs.081", VERSION file reports "1.000, March 30, 1995"
@@ -593,7 +601,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "96b07e9b914dba1c8dc6c78a176326df", 5233230},
{"resource.msg", 0, "45b5bf74933ac3727e4cc844446dc052", 796156},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - English DOS CD Demo
// SCI interpreter version 1.001.095
@@ -601,14 +609,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a62a7eae85dd1e6b07f39662b278437e", 1918},
{"resource.000", 0, "4962a3c4dd44e36e78ea4a7a374c2220", 957382},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Freddy Pharkas - English Macintosh
{"freddypharkas", "", {
{"Data1", 0, "ef7cbd62727989818f1cfae69c9fd61d", 3038492},
{"Data2", 0, "2424b418f7d52c385cea4701f529c69a", 4721732},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Fun Seeker's Guide - English DOS
// SCI interpreter version 0.000.506
@@ -616,7 +624,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7ee6859ef74314f6d91938c3595348a9", 282},
{"resource.001", 0, "f1e680095424e31f7fae1255d36bacba", 40692},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - English DOS CD Demo
// SCI interpreter version 1.001.092
@@ -624,7 +632,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "39645952ae0ed8072c7e838f31b75464", 2490},
{"resource.000", 0, "eb3ed7477ca4110813fe1fcf35928561", 1718450},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Gabriel Knight - English DOS Floppy
@@ -633,7 +641,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "372d059f75856afa6d73dd84cbb8913d", 10783},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 13022630},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - English DOS Floppy (supplied my markcoolio in bug report #2723777)
// SCI interpreter version 2.000.000
@@ -641,7 +649,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "65e8c14092e4c9b3b3538b7602c8c5ec", 10783},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 13022630},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - English DOS Floppy
// SCI interpreter version 2.000.000, VERSION file reports "1.0\nGabriel Knight\n11/22/10:33 pm\n\x1A"
@@ -649,7 +657,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ef41df08cf2c1f680216cdbeed0f8311", 10783},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 13022630},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - German DOS Floppy (supplied my markcoolio in bug report #2723775)
// SCI interpreter version 2.000.000
@@ -657,7 +665,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ad6508b0296b25c07b1f58828dc33696", 10789},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13077029},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - English DOS CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "01.100.000"
@@ -665,7 +673,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "372d059f75856afa6d73dd84cbb8913d", 10996},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 12581736},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - English Windows CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "01.100.000"
@@ -673,7 +681,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "372d059f75856afa6d73dd84cbb8913d", 10996},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 12581736},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - German DOS CD (from Tobis87)
// SCI interpreter version 2.000.000
@@ -681,7 +689,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a7d3e55114c65647310373cb390815ba", 11392},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13400497},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - Spanish DOS CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "1.000.000, April 13, 1995"
@@ -689,7 +697,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7cb6e9bba15b544ec7a635c45bde9953", 11404},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13381599},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - French DOS CD (from Hkz)
// VERSION file reports "1.000.000, May 3, 1994"
@@ -697,7 +705,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "55f909ba93a2515042a08d8a2da8414e", 11392},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13325145},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - German Windows CD (from Tobis87)
// SCI interpreter version 2.000.000
@@ -705,7 +713,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a7d3e55114c65647310373cb390815ba", 11392},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13400497},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - Spanish Windows CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "1.000.000, April 13, 1995"
@@ -713,7 +721,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7cb6e9bba15b544ec7a635c45bde9953", 11404},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13381599},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::ES_ESP, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight - English Macintosh
{"gk1", "", {
@@ -722,7 +730,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data3", 0, "f25068b408b09275d8b698866462f578", 3677599},
{"Data4", 0, "1cceebbe411b26c860a74f91c337fdf3", 3230086},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight 2 - English Windows Non-Interactive Demo
// Executable scanning reports "2.100.002"
@@ -730,7 +738,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e0effce11c4908f4b91838741716c83d", 1351},
{"resource.000", 0, "d04cfc7f04b6f74d13025378be49ec2b", 4640330},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight 2 - English DOS (GOG version) - ressci.* merged in ressci.000
// using Enrico Rolfi's HD/DVD installer: http://gkpatches.vogons.zetafleet.com/
@@ -738,7 +746,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "b996fa1e57389a1e179a00a0049de1f4", 8110},
{"ressci.000", 0, "a19fc3604c6e5407abcf03d59ee87217", 168522221},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight 2 - English DOS (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.1"
@@ -756,7 +764,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.006", 0, "ce9359037277b7d7976da185c2fa0aad", 2977},
{"ressci.006", 0, "8e44e03890205a7be12f45aaba9644b4", 60659424},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight 2 - French DOS (6-CDs Sierra Originals reedition)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -774,7 +782,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.006", 0, "11b2e722170b8c93fdaa5428e2c7676f", 3001},
{"ressci.006", 0, "4037d941aec39d2e654e20960429aefc", 60568486},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Gabriel Knight 2 - English Macintosh
// NOTE: This only contains disc 1 files (as well as the persistent file:
@@ -786,7 +794,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data4", 0, "8b843c62eb53136a855d6e0087e3cb0d", 5889553},
{"Data5", 0, "f9fcf9ab2eb13b2125c33a1cda03a093", 14349984},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI32
@@ -798,7 +806,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "e0dd44069a62a463fd124974b915f10d", 342149},
{"resource.003", 0, "e0dd44069a62a463fd124974b915f10d", 328925},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 1 - English DOS (supplied by wibble92 in bug report #2644547)
// SCI interpreter version 0.000.530
@@ -808,7 +816,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "e0dd44069a62a463fd124974b915f10d", 342309},
{"resource.003", 0, "e0dd44069a62a463fd124974b915f10d", 328912},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 1 - English DOS (supplied by merkur in bug report #2719227)
// SCI interpreter version 0.000.530
@@ -816,14 +824,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1034a218943d12f1f36e753fa10c95b8", 4386},
{"resource.001", 0, "e0dd44069a62a463fd124974b915f10d", 518308},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 1 3.5' - English DOS (supplied by eddydrama in bug report #3052366 and dinnerx in bug report #3090841)
{"hoyle1", "", {
{"resource.map", 0, "0af9a3dcd72a091960de070432e1f524", 4386},
{"resource.001", 0, "e0dd44069a62a463fd124974b915f10d", 518127},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#if 0 // TODO: unknown if these files are corrupt
// Hoyle 1 - English Amiga (from www.back2roots.org)
@@ -833,7 +841,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "e0dd44069a62a463fd124974b915f10d", 218755},
{"resource.002", 0, "e0dd44069a62a463fd124974b915f10d", 439502},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif
// Hoyle 2 - English DOS
@@ -843,7 +851,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "8f2dd70abe01112eca464cda818b5eb6", 98138},
{"resource.002", 0, "8f2dd70abe01112eca464cda818b5eb6", 196631},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 2 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.000.011 1x3.5" (label:Int#6.21.90)
@@ -851,7 +859,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "db0ba08b953e9904a4960ad99cd29c20", 1356},
{"resource.001", 0, "8f2dd70abe01112eca464cda818b5eb6", 216315},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 2 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.032"
@@ -860,7 +868,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "62ed48d20c580e5a98f102f7cd93706a", 1356},
{"resource.001", 0, "8f2dd70abe01112eca464cda818b5eb6", 222704},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 2 - English Macintosh
// Executable scanning reports "x.yyy.zzz"
@@ -868,7 +876,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1af1d3aa3cf564f93477c9f87e53f495", 1728},
{"resource.001", 0, "b73b8131669d69d41a326415e4519138", 482882},
{NULL, 0, NULL, 0}},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#if 0 // TODO: unknown if these files are corrupt
// Hoyle 3 - English Amiga (from www.back2roots.org)
@@ -879,7 +887,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "595b6039ea1356e7f96a52c58eedcf22", 355791},
{"resource.001", 0, "143df8aef214a2db34c2d48190742012", 632273},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif
// Hoyle 3 - English DOS Non-Interactive Demo
@@ -889,7 +897,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0d06cacc87dc21a08cd017e73036f905", 735},
{"resource.001", 0, "24db2bccda0a3c43ac4a7b5edb116c7e", 797678},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 3 - English DOS Floppy (from jvprat)
// Executable scanning reports "x.yyy.zzz", Floppy label reports "1.0, 11.2.91", VERSION file reports "1.000"
@@ -899,7 +907,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 541845},
{"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 845795},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 3 - English DOS Floppy (supplied by eddydrama in bug report #3038837)
{"hoyle3", "", {
@@ -910,7 +918,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "97cfd72633f8f9b2a0b1d4116cf3ee81", 346116},
{"resource.004", 0, "2884fb91b225fabd9ca87ea231293b48", 351218},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 3 EGA - English DOS Floppy 1.0 (supplied by abevi in bug report #2612718)
{"hoyle3", "EGA", {
@@ -918,14 +926,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 319905},
{"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 526438},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 4 (Hoyle Classic Card Games) - English DOS Demo
{"hoyle4", "Demo", {
{"resource.map", 0, "60f764020a6b788bbbe415dbc2ccb9f3", 931},
{"resource.000", 0, "5fe3670e3ddcd4f85c10013b5453141a", 615522},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 4 (Hoyle Classic Card Games) - English DOS Demo
// SCI interpreter version 1.001.200 (just a guess)
@@ -934,7 +942,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "662087cb383e52e3cc4ae7ecb10e20aa", 938},
{"resource.000", 0, "24c10844792c54d476d272213cbac300", 675252},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 4 (Hoyle Classic Card Games) - English DOS/Win
// Supplied by abevi in bug report #3039291
@@ -942,7 +950,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2b577c975cc8d8d43f61b6a756129fe3", 4352},
{"resource.000", 0, "43e2c15ce436aab611a462ad0603e12d", 2000132},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Hoyle 4 (Hoyle Classic Card Games) - English Macintosh Floppy
// VERSION file reports "2.0"
@@ -950,7 +958,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data1", 0, "99575fae4579540a314bbedd72d51e8c", 7682887},
{"Data2", 0, "7d4bf5bdf3c02edbf35cb8471c84ec13", 1539134},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Jones in the Fast Lane EGA - English DOS
// SCI interpreter version 1.000.172 (not 100% sure FIXME)
@@ -959,14 +967,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 202105},
{"resource.002", 0, "b86daa3ba2784d1502da881eedb80d9b", 341771},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Jones in the Fast Lane EGA - English DOS (supplied by EddyDrama in bug report #3038761)
{"jones", "EGA", {
{"resource.map", 0, "8e92cf319180cc8b5b87b2ce93a4fe22", 1602},
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 511528},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Jones in the Fast Lane VGA - English DOS
// SCI interpreter version 1.000.172
@@ -975,7 +983,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 313476},
{"resource.002", 0, "b86daa3ba2784d1502da881eedb80d9b", 719747},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Jones in the Fast Lane VGA - English DOS (supplied by omer_mor in bug report #3037054)
// VERSION file reports "1.000.060"
@@ -983,14 +991,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "db175ab494ab0666f19ab8f2597a8e49", 1602},
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 994487},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Jones in the Fast Lane - English DOS CD
{"jones", "CD", {
{"resource.map", 0, "459f5b04467bc2107aec02f5c4b71b37", 4878},
{"resource.001", 0, "3876da2ce16fb7dea2f5d943d946fa84", 1652150},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO1(GAMEOPTION_JONES_CDAUDIO) },
// Jones in the Fast Lane - English DOS CD
// Same entry as the DOS version above. This one is used for the alternate
@@ -999,7 +1007,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "459f5b04467bc2107aec02f5c4b71b37", 4878},
{"resource.001", 0, "3876da2ce16fb7dea2f5d943d946fa84", 1652150},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO4(GUIO_MIDIGM, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_FB01_MIDI, GAMEOPTION_JONES_CDAUDIO) },
// King's Quest 1 SCI Remake - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.003.007"
@@ -1011,7 +1019,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "9ae2a13708d691cd42f9129173c4b39d", 763224},
{"resource.004", 0, "9ae2a13708d691cd42f9129173c4b39d", 820443},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 1 SCI Remake - English DOS Non-Interactive Demo
// Executable scanning reports "S.old.010"
@@ -1019,7 +1027,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "59b13619078bd47011421468959ee5d4", 954},
{"resource.001", 0, "4cfb9040db152868f7cb6a1e8151c910", 296555},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 1 SCI Remake - English DOS (from the King's Quest Collection)
// Executable scanning reports "S.old.010", VERSION file reports "1.000.051"
@@ -1030,7 +1038,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "fed9e0072ffd511d248674e60dee2099", 714062},
{"resource.003", 0, "fed9e0072ffd511d248674e60dee2099", 717478},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 1 SCI Remake - English DOS (supplied by ssburnout in bug report #3049193)
// 1.000.051 9x5.25" (label: INT#9.19.90)
@@ -1044,7 +1052,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "fed9e0072ffd511d248674e60dee2099", 351062},
{"resource.007", 0, "fed9e0072ffd511d248674e60dee2099", 330472},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.032"
@@ -1057,7 +1065,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "fd16c9c223f7dc5b65f06447615224ff", 683016},
{"resource.004", 0, "3fac034c7d130e055d05bc43a1f8d5f8", 549993},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English DOS Non-Interactive Demo
// Executable scanning reports "0.000.494"
@@ -1065,7 +1073,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "992ac7cc31d3717fe53818a9bb6d1dae", 594},
{"resource.001", 0, "143e1c14f15ad0fbfc714f648a65f661", 205330},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English DOS (original boxed release, 3 1/2" disks)
// SCI interpreter version 0.000.247
@@ -1076,7 +1084,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "851a62d00972dc4002f472cc0d84e71d", 683145},
{"resource.004", 0, "851a62d00972dc4002f472cc0d84e71d", 649441},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English DOS (from the King's Quest Collection)
// Executable scanning reports "0.000.502"
@@ -1088,7 +1096,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "77615c595388acf3d1df8e107bfb6b52", 707591},
{"resource.004", 0, "77615c595388acf3d1df8e107bfb6b52", 479562},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.006.003 8x5.25" (label: Int.#0.000.502)
@@ -1102,7 +1110,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "6db7de6f93c6ea62dca78abee677f8c0", 324789},
{"resource.007", 0, "6db7de6f93c6ea62dca78abee677f8c0", 334441},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English DOS
// SCI interpreter version 0.000.274
@@ -1116,7 +1124,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "851a62d00972dc4002f472cc0d84e71d", 333777},
{"resource.007", 0, "851a62d00972dc4002f472cc0d84e71d", 341038},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English DOS
// SCI interpreter version 0.000.253
@@ -1130,7 +1138,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "0c8566848a76eea19a6d6220914030a7", 337288},
{"resource.007", 0, "0c8566848a76eea19a6d6220914030a7", 343882},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 4 - English Atari ST (double-sided diskettes)
// Game version 1.003.006 (January 12, 1989)
@@ -1143,7 +1151,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "a3cdb4848fb859fdd302976fff56490f", 705074},
{"resource.004", 0, "a3cdb4848fb859fdd302976fff56490f", 478366},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.004.018"
@@ -1159,7 +1167,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "26c0c25399b6715fec03fc3e12544fe3", 823048},
{"resource.007", 0, "b914b5901e786327213e779725d30dd1", 778772},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - German Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -1175,7 +1183,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "56546b20db11a4836f900efa6d3a3e74", 672099},
{"resource.007", 0, "56546b20db11a4836f900efa6d3a3e74", 794194},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - Italian Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -1191,7 +1199,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "11cb750f5f816445ad0f4b9f50a4f59a", 672527},
{"resource.007", 0, "11cb750f5f816445ad0f4b9f50a4f59a", 794259},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::IT_ITA, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - English DOS CD (from the King's Quest Collection)
// Executable scanning reports "x.yyy.zzz", VERSION file reports "1.000.052"
@@ -1201,7 +1209,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368},
{"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - English DOS CD (from the King's Quest Collection)
// Executable scanning reports "x.yyy.zzz", VERSION file reports "1.000.052"
@@ -1213,7 +1221,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368},
{"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO4(GUIO_MIDIGM, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - English DOS Floppy
// SCI interpreter version 1.000.060
@@ -1228,7 +1236,25 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "672ede1136e9e401658538e51bd5dc22", 1172619},
{"resource.007", 0, "2f48faf27666b58c276dda20f91f4a93", 1240456},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // King's Quest 5 - English DOS Floppy
+ // VERSION file reports "0.000.051"
+ // Supplied by misterhands in bug report #3536863.
+ // This is the original English version, which has been externally patched to
+ // Polish in the Polish release below.
+ {"kq5", "", {
+ {"resource.map", 0, "70010c20138541f89013bb5e1b30f16a", 7998},
+ {"resource.000", 0, "a591bd4b879fc832b8095c0b3befe9e2", 276398},
+ {"resource.001", 0, "c0f48d4a7ebeaa6aa074fc98d77423e9", 1018560},
+ {"resource.002", 0, "7f188a95acdb60bbe32a8379ba299393", 1307048},
+ {"resource.003", 0, "0860785af59518b94d54718dddcd6907", 1348500},
+ {"resource.004", 0, "c4745dd1e261c22daa6477961d08bf6c", 1239887},
+ {"resource.005", 0, "6556ff8e7c4d1acf6a78aea154daa76c", 1287869},
+ {"resource.006", 0, "da82e4beb744731d0a151f1d4922fafa", 1170456},
+ {"resource.007", 0, "431def14ca29cdb5e6a5e84d3f38f679", 1240176},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - English DOS Floppy (supplied by omer_mor in bug report #3036996)
// VERSION file reports "0.000.051"
@@ -1243,7 +1269,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "06cb3f689836086ebe08b1efc0126592", 921113},
{"resource.007", 0, "252249753c6e850eacceb8af634986d3", 1133608},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 EGA (supplied by markcoolio in bug report #2829470)
// SCI interpreter version 1.000.060
@@ -1259,7 +1285,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "698c698570cde9015e4d51eb8d2e9db1", 666527},
{"resource.007", 0, "703d8df30e89541af337d7706540d5c4", 541743},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 EGA 1.2M disk version (from LordHoto)
// VERSION file reports "0.000.055"
@@ -1271,7 +1297,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "53206afb4fd73871a484e83acab80f31", 7608},
{"resource.004", 0, "83568edf7fde18b3eed988bc5d22ceb1", 1188053},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 EGA (supplied by omer_mor in bug report #3035421)
// VERSION file reports "0.000.062"
@@ -1286,7 +1312,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "698c698570cde9015e4d51eb8d2e9db1", 666541},
{"resource.007", 0, "703d8df30e89541af337d7706540d5c4", 541762},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest V DOS 0.000.062 EGA (5 x 5.25" disks)
// Supplied by ssburnout in bug report #3046780
@@ -1298,7 +1324,22 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "3cca5b2dae8afe94532edfdc98d7edbe", 1092325},
{"resource.004", 0, "8e5c1bc4d738cf7316ff506f59d265e2", 1187803},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // King's Quest 5 DOS Spanish Floppy 0.000.062 VGA (5 x 3.5" disks)
+ // Supplied by dianiu in bug report #3555646
+ {"kq5", "", {
+ {"resource.map", 0, "c09896a2a30c9b002c5cbbc62f5a5c3a", 8169},
+ {"resource.000", 0, "1f1d03aead44da46362ff40c0074a3ec", 335871},
+ {"resource.001", 0, "d1803ad904127ae091edb274ee8c047f", 1180637},
+ {"resource.002", 0, "d9cd5972016f650cc31fb7c2a2b0953a", 1102207},
+ {"resource.003", 0, "829c8caeff793f3cfcea2cb01aaa4150", 965586},
+ {"resource.004", 0, "0bd9e570ee04b025e43d3075998fae5b", 1117965},
+ {"resource.005", 0, "4aaa2e9a69089b9afbaaccbbf2c4e647", 1202936},
+ {"resource.006", 0, "65b520e60c4217e6a6572d9edf77193b", 1141985},
+ {"resource.007", 0, "f42b0100f0a1c30806814f8648b6bc28", 1145583},
+ AD_LISTEND},
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - German DOS Floppy (supplied by markcoolio in bug report #2727101, also includes english language)
// SCI interpreter version 1.000.060
@@ -1313,7 +1354,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "d1a75fdc01840664d00366cff6919366", 1208972},
{"resource.007", 0, "c07494f0cce7c05210893938786a955b", 1337361},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - French DOS Floppy (from the King's Quest Collector's Edition 1994, also includes english language)
// Supplied by aroenai in bug report #2812611
@@ -1329,7 +1370,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f7dc85307632ef657ceb1651204f6f51", 1210081},
{"resource.007", 0, "7db4d0a1d8d547c0019cb7d2a6acbdd4", 1338473},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - Italian DOS Floppy (from glorifindel, includes english language)
// SCI interpreter version 1.000.060
@@ -1344,10 +1385,12 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "8eeabd92af71e766e323db2100879102", 1209325},
{"resource.007", 0, "dc10c107e0923b902326a040b9c166b9", 1337859},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
- // King's Quest 5 - Polish DOS Floppy (supplied by jacek909 in bug report #2725722, includes english language?!)
+ // King's Quest 5 - Polish DOS Floppy (supplied by jacek909 in bug report #2725722)
// SCI interpreter version 1.000.060
+ // VERSION file reports "0.000.051".
+ // This is actually an English version with external text resource patches (bug #3536863).
{"kq5", "", {
{"resource.map", 0, "70010c20138541f89013bb5e1b30f16a", 7998},
{"resource.000", 0, "a591bd4b879fc832b8095c0b3befe9e2", 276398},
@@ -1358,8 +1401,9 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "6556ff8e7c4d1acf6a78aea154daa76c", 1287869},
{"resource.006", 0, "da82e4beb744731d0a151f1d4922fafa", 1170456},
{"resource.007", 0, "431def14ca29cdb5e6a5e84d3f38f679", 1240176},
+ {"text.000", 0, "601aa35a3ddeb558e1280e0963e955a2", 1517},
AD_LISTEND},
- Common::PL_POL, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::PL_POL, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - English Macintosh
// VERSION file reports "1.000.055"
@@ -1374,7 +1418,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "3d22904a374c192f51e5665b74364133", 1264079},
{"resource.007", 0, "ffe17e23d5833a79f3695addfc149a56", 1361965},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 5 - FM-Towns (supplied by abevi in bug report #3038720)
{"kq5", "", {
@@ -1400,7 +1444,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "e114ce8f884601c43308fb5cbbea4874", 1174129},
{"resource.005", 0, "349ad9438172265d00680075c5a988d0", 1019669},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 6 - English DOS Non-Interactive Demo
// Executable scanning reports "1.001.055", VERSION file reports "1.000.000"
@@ -1410,7 +1454,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "535b1b920441ec73f42eaa4ccfd47b89", 264116},
{"resource.msg", 0, "54d1fdc936f98c81f9e4c19e04fb1510", 8260},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 6 - English DOS Floppy
// SCI interpreter version 1.001.054
@@ -1419,7 +1463,16 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "f2b7f753992c56a0c7a08d6a5077c895", 7863324},
{"resource.msg", 0, "3cf5de44de36191f109d425b8450efc8", 258590},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // King's Quest 6 - French DOS Floppy (supplied by misterhands in bug #3503425)
+ // SCI interpreter version ???
+ {"kq6", "", {
+ {"resource.map", 0, "a362063318eebe7d6423b1d9dc6213e1", 8703},
+ {"resource.000", 0, "f2b7f753992c56a0c7a08d6a5077c895", 7863324},
+ {"resource.msg", 0, "adc2aa8adbdcc97507d44a6f492fbd77", 265194},
+ AD_LISTEND},
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 6 - German DOS Floppy (supplied by markcoolio in bug report #2727156)
// SCI interpreter version 1.001.054
@@ -1428,7 +1481,17 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "f2b7f753992c56a0c7a08d6a5077c895", 7863324},
{"resource.msg", 0, "756297b2155db9e43f621c6f6fb763c3", 282822},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // King's Quest 6 - Spanish DOS Floppy (from jvprat)
+ // Executable scanning reports "1.cfs.158", VERSION file reports "1.000.000, July 5, 1994"
+ // SCI interpreter version 1.001.055
+ {"kq6", "", {
+ {"resource.map", 0, "a73a5ab04b8f60c4b75b946a4dccea5a", 8953},
+ {"resource.000", 0, "4da3ad5868a775549a7cc4f72770a58e", 8537260},
+ {"resource.msg", 0, "41eed2d3893e1ca6c3695deba4e9d2e8", 267102},
+ AD_LISTEND},
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 6 - English DOS CD (from the King's Quest Collection)
// Executable scanning reports "1.cfs.158", VERSION file reports "1.034 9/11/94 - KQ6 version 1.000.00G"
@@ -1437,7 +1500,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7a550ebfeae2575ca00d47703a6a774c", 9215},
{"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 6 - English Windows CD (from the King's Quest Collection)
// Executable scanning reports "1.cfs.158", VERSION file reports "1.034 9/11/94 - KQ6 version 1.000.00G"
@@ -1446,17 +1509,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7a550ebfeae2575ca00d47703a6a774c", 9215},
{"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_NOASPECT) },
-
- // King's Quest 6 - Spanish DOS CD (from jvprat)
- // Executable scanning reports "1.cfs.158", VERSION file reports "1.000.000, July 5, 1994"
- // SCI interpreter version 1.001.055
- {"kq6", "CD", {
- {"resource.map", 0, "a73a5ab04b8f60c4b75b946a4dccea5a", 8953},
- {"resource.000", 0, "4da3ad5868a775549a7cc4f72770a58e", 8537260},
- {"resource.msg", 0, "41eed2d3893e1ca6c3695deba4e9d2e8", 267102},
- AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO5(GUIO_NOASPECT, GAMEOPTION_KQ6_WINDOWS_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 6 - English Macintosh Floppy
// VERSION file reports "1.0"
@@ -1464,7 +1517,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data1", 0, "a183fc0c22fcbd9be4c8800d974b5599", 3892124},
{"Data2", 0, "b3722460dfd3097a1fbaf99a21ad8ea5", 15031272},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
@@ -1475,7 +1528,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4948e4e1506f1e1c4e1d47abfa06b7f8", 204385195},
{"resource.map", 0, "40ccafb2195301504eba2e4f4f2c7f3d", 18925},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 7 - English Windows (from the King's Quest Collection)
// Executable scanning reports "2.100.002", VERSION file reports "1.4"
@@ -1483,7 +1536,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2be9ab94429c721af8e05c507e048a15", 18697},
{"resource.000", 0, "eb63ea3a2c2469dc2d777d351c626404", 203882535},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 7 - English DOS (from FRG)
// SCI interpreter version 2.100.002, VERSION file reports "2.00b"
@@ -1491,7 +1544,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8676b0fbbd7362989a029fe72fea14c6", 18709},
{"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 7 - English Windows (from FRG)
// SCI interpreter version 2.100.002, VERSION file reports "2.00b"
@@ -1499,7 +1552,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8676b0fbbd7362989a029fe72fea14c6", 18709},
{"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 7 - German Windows (supplied by markcoolio in bug report #2727402)
// SCI interpreter version 2.100.002
@@ -1507,7 +1560,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "838b9ff132bd6962026fee832e8a7ddb", 18697},
{"resource.000", 0, "eb63ea3a2c2469dc2d777d351c626404", 206626576},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 7 - Spanish DOS (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "2.00"
@@ -1515,7 +1568,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0b62693cbe87e3aaca3e8655a437f27f", 18709},
{"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// King's Quest 7 - English DOS Non-Interactive Demo
// SCI interpreter version 2.100.002
@@ -1523,7 +1576,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "b44f774108d63faa1d021101221c5a54", 1690},
{"resource.000", 0, "d9659d2cf0c269c6a9dc776707f5bea0", 2433827},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI32
@@ -1539,7 +1592,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "aa553977f7e5804081de293800d3bcce", 695067},
{"resource.005", 0, "bfd870d51dc97729f0914095f58e6957", 676881},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow - English Atari ST (from jvprat)
// Executable scanning reports "1.002.030", Floppy label reports "1.000.062, 9.23.90"
@@ -1551,7 +1604,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 667365},
{"resource.004", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 683737},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow - English DOS Non-Interactive Demo
// Executable scanning reports "x.yyy.zzz"
@@ -1559,7 +1612,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e625726268ff4e123ada11f31f0249f3", 768},
{"resource.001", 0, "0c8912290af0890f8d95faeb4ddb2d68", 333031},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow - English DOS 3.5" Floppy (from "The Roberta Williams Anthology"/1996)
// SCI interpreter version 0.000.631
@@ -1570,7 +1623,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 667468},
{"resource.004", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 683807},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow - English DOS (from FRG)
// SCI interpreter version 0.000.631
@@ -1584,7 +1637,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 328390},
{"resource.007", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 317687},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow 2 - English DOS Non-Interactive Demo (from FRG)
// Executable scanning reports "x.yyy.zzz"
@@ -1593,7 +1646,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "24dffc5db1d88c7999f13e8767ed7346", 855},
{"resource.000", 0, "2b2b1b4f7584f9b38fd13f6ab95634d1", 781912},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow 2 - English DOS Floppy
// Executable scanning reports "2.000.274"
@@ -1602,7 +1655,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "610bfd9a852004222f0faaf5fc9e630a", 6489},
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5035964},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow 2 - English DOS CD (from "The Roberta Williams Antology"/1996)
// Executable scanning reports "1.001.072", VERSION file reports "1.1" (from jvprat)
@@ -1611,7 +1664,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a70945e61ba7ac7bfea6b7bd72c6aec5", 7274},
{"resource.000", 0, "82578b8d5a7e09c4c58891ca49fae35b", 5598672},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow 2 v1.1 - French DOS Floppy (from Hkz)
{"laurabow2", "", {
@@ -1619,7 +1672,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5028766},
{"resource.msg", 0, "0fceedfbdd85a4bc7851fdd9dd2d2f19", 278253},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow 2 v1.1 - German DOS Floppy (from Tobis87, updated info from markcoolio in bug report #2723787, updated info from #2797962))
// Executable scanning reports "2.000.274"
@@ -1628,7 +1681,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5028766},
{"resource.msg", 0, "795c928cd00dfec9fbc62ebcd12e1f65", 303185},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Laura Bow 2 - Spanish DOS CD (from jvprat)
// Executable scanning reports "2.000.274", VERSION file reports "1.000.000, May 10, 1994"
@@ -1637,7 +1690,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5028766},
{"resource.msg", 0, "71f1f0cd9f082da2e750c793a8ed9d84", 286141},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 EGA Remake - English DOS (from spookypeanut)
// SCI interpreter version 0.000.510 (or 0.000.577?)
@@ -1648,7 +1701,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "24c958bc922b07f91e25e8c93aa01fcf", 491230},
{"resource.003", 0, "685cd6c1e05a695ab1e0db826337ee2a", 553279},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#if 0
// The resource.002 file, contained in disk 3, is broken in this version
@@ -1666,7 +1719,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "5790ac0505f7ca98d4567132b875eb1e", 681041},
{"resource.003", 0, "4a34c3367c2fe7eb380d741374da1989", 572251},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif
// Larry 1 VGA Remake - English DOS (from spookypeanut)
@@ -1677,7 +1730,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "ec20246209d7b19f38989261e5c8f5b8", 1111226},
{"resource.002", 0, "85d6935ef77e6b0e16bc307640a0d913", 1088312},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 VGA Remake - English DOS (from FRG)
// SCI interpreter version 1.000.510
@@ -1687,7 +1740,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d34cadb11e1aefbb497cf91bc1d3baa7", 1114688},
{"resource.002", 0, "85b030bb66d5342b0a068f1208c431a8", 1078443},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 VGA Remake - English Macintosh (from omer_mor, bug report #3328262)
{"lsl1sci", "SCI", {
@@ -1696,7 +1749,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "aa6f153f70f1e32d1bde465fff08eecf", 1137418},
{"resource.002", 0, "b22c616aa789ebef990290c7ffd86548", 1097477},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 VGA Remake - English DOS Non-Interactive Demo
// SCI interpreter version 1.000.084
@@ -1704,7 +1757,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "434e1f6c39d71647b34f0ee57b2bbd68", 444},
{"resource.001", 0, "0c0768215c562d9dace4a5ca53696cf3", 359913},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 VGA Remake - Spanish DOS (from the Leisure Suit Larry Collection, also includes english language)
// Executable scanning reports "1.SQ4.057", VERSION file reports "1.000"
@@ -1717,7 +1770,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "3fe2a3aec0ed53c7d6db1845a67e3aa2", 1095908},
{"resource.003", 0, "ac175df0ea9a2cba57f0248651856d27", 376556},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 VGA Remake - Russian DOS (also includes english language?!)
// Executable scanning reports "1.000.510", VERSION file reports "2.0"
@@ -1728,7 +1781,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bc8ca10c807515d959cbd91f9ba47735", 1123759},
{"resource.002", 0, "b7409ab32bc3bee2d6cce887cd33f2b6", 1092160},
AD_LISTEND},
- Common::RU_RUS, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::RU_RUS, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 1 VGA Remake - Polish DOS (from Polish Leisure Suit Larry Collection, official release)
// SCI interpreter version 1.000.577, VERSION file reports "2.1" (this release does NOT include english text)
@@ -1736,7 +1789,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "58330a85767e42a2487129913283ab5b", 3228},
{"resource.000", 0, "b6097ff35cdc8469f02150fe2f824198", 4781210},
AD_LISTEND},
- Common::PL_POL, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::PL_POL, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 2 - English Amiga (from www.back2roots.org)
// Executable scanning reports "x.yyy.zzz"
@@ -1748,7 +1801,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "a0d4a625311d307257da7fc43d00459d", 570356},
{"resource.004", 0, "a0d4a625311d307257da7fc43d00459d", 717844},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 2 - English DOS Non-Interactive Demo
// Executable scanning reports "x.yyy.zzz"
@@ -1757,7 +1810,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "03dba704bb77da55a91ad27b5a3cac09", 528},
{"resource.001", 0, "9f5520f0297206928df0b0b36493cd33", 127532},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 2 - English DOS
// SCI interpreter version 0.000.409
@@ -1770,7 +1823,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "4a24443a25e2b1492462a52809605dc2", 277732},
{"resource.006", 0, "4a24443a25e2b1492462a52809605dc2", 345683},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 2 - English DOS
// SCI interpreter version 0.000.343
@@ -1785,7 +1838,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
//{"resource.006", 0, "96033f57accfca903750413fd09193c8", 345818},
{"resource.006", 0, "96033f57accfca903750413fd09193c8", -1}, // 345818 or 208739
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 2 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.000.011 3x3.5" (label: Int. #0.000.343)
@@ -1795,7 +1848,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "96033f57accfca903750413fd09193c8", 407014},
{"resource.003", 0, "96033f57accfca903750413fd09193c8", 592834},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 2 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.002.000 3x3.5" (label: INT#0.000.409)
@@ -1805,7 +1858,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "4a24443a25e2b1492462a52809605dc2", 406935},
{"resource.003", 0, "4a24443a25e2b1492462a52809605dc2", 592533},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.032"
@@ -1819,7 +1872,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "f408e59cbee1457f042e5773b8c53951", 651634},
{"resource.005", 0, "433911eb764089d493aed1f958a5615a", 524259},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - English DOS
// SCI interpreter version 0.000.572
@@ -1830,7 +1883,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "f18441027154292836b973c655fa3175", 506807},
{"resource.004", 0, "f18441027154292836b973c655fa3175", 513651},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.021 8x5.25" (label: Int#5.15.90)
@@ -1844,7 +1897,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f18441027154292836b973c655fa3175", 282649},
{"resource.007", 0, "f18441027154292836b973c655fa3175", 257178},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - English DOS
// SCI interpreter version 0.000.572
@@ -1858,7 +1911,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f18441027154292836b973c655fa3175", 282465},
{"resource.007", 0, "f18441027154292836b973c655fa3175", 257174},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - English DOS Non-Interactive Demo
// SCI interpreter version 0.000.530
@@ -1867,7 +1920,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "f773d79b93dfd4052ec8c1cc64c1e6ab", 76525},
{"resource.002", 0, "f773d79b93dfd4052ec8c1cc64c1e6ab", 268299},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - German DOS (from Tobis87, updated info from markcoolio in bug report #2723832, also includes english language)
// Executable scanning reports "S.old.123"
@@ -1879,7 +1932,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "3827a9b17b926e12dcc336860f50612a", 587036},
{"resource.004", 0, "3827a9b17b926e12dcc336860f50612a", 691932},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 - French DOS (provided by richiefs in bug report #2670691, also includes english language)
// Executable scanning reports "S.old.123"
@@ -1891,7 +1944,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "65f1bdaa20f6d0470e9d969f22473873", 586921},
{"resource.004", 0, "65f1bdaa20f6d0470e9d969f22473873", 690826},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 3 1.050 Fr/En (9 x 5.25" disks)
// Provided by ssburnout in bug report #3046779
@@ -1905,7 +1958,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "65f1bdaa20f6d0470e9d969f22473873", 325292},
{"resource.007", 0, "65f1bdaa20f6d0470e9d969f22473873", 308982},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - English Amiga
// Executable scanning reports "1.004.023"
@@ -1920,7 +1973,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "f8b2d1137bb767e5d232056b99dd69eb", 623621},
{"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 715598},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - German Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -1936,7 +1989,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 754966},
{"resource.007", 0, "59eba83ad465b08d763b44f86afa86f6", 683135},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.000.181
@@ -1944,7 +1997,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "efe8d3f45ce4f6bd9a6643e0ac8d2a97", 504},
{"resource.001", 0, "8bd8d9c0b5f455ee1269d63ce86c50dd", 531380},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - English DOS (from spookypeanut)
// SCI interpreter version 1.000.510
@@ -1959,7 +2012,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1024810},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 1030656},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - English Macintosh (from omer_mor, bug report #3328257)
{"lsl5", "", {
@@ -1973,7 +2026,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1110043},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 989801},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - German DOS (from Tobis87)
// SCI interpreter version T.A00.196
@@ -1988,7 +2041,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1021774},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 993408},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - French DOS (provided by richiefs in bug report #2670691)
// Executable scanning reports "1.lsl5.019"
@@ -2004,7 +2057,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 946540},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 958842},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - Spanish DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "1.ls5.006", VERSION file reports "1.000, 4/21/92"
@@ -2020,7 +2073,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1015136},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 987222},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 - Italian DOS Floppy (from glorifindel)
// SCI interpreter version 1.000.510 (just a guess)
@@ -2028,7 +2081,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a99776df795127f387cb35dae872d4e4", 5919},
{"resource.000", 0, "a8989a5a89e7d4f702b26b378c7a357a", 7001981},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::IT_ITA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 1.0 EGA DOS (8 x 3.5" disks)
// Provided by ssburnout in bug report #3046806
@@ -2043,7 +2096,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f6046a8445422f17d40b1b10ab21ebf3", 568551},
{"resource.007", 0, "640ee65595d40372ef95462f2c1ae28a", 593429},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 5 EGA
// Supplied by omer_mor in bug report #3049771
@@ -2054,7 +2107,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "5a55af4e40728b1a8103dc47ad2afa8d", 1100539},
{"resource.003", 0, "16f4d8fb1b526125edaca4fc6cbb7530", 1064563},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - English DOS (from spookypeanut)
// SCI interpreter version 1.001.113
@@ -2062,7 +2115,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "bb8a39d9e2a77ba449a1e591109ad9a8", 6973},
{"resource.000", 0, "4462fe48c7452d98fddcec327a3e738d", 5789138},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - English/German/French DOS CD - LOWRES
// SCI interpreter version 1.001.115
@@ -2070,7 +2123,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0b91234b7112782962cb480b7791b6e2", 7263},
{"resource.000", 0, "57d5fe8bb9e044158514476ea7678eb0", 5754790},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - German DOS CD - LOWRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 1.001.115
@@ -2078,7 +2131,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "bafe85f32738854135991d4324ad147e", 7268},
{"resource.000", 0, "f6cbc6da7b90ea135883e0759848ca2c", 5773160},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - French DOS CD - LOWRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 1.001.115
@@ -2086,7 +2139,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "97797ea775baaf18a1907d357d3c0ea6", 7268},
{"resource.000", 0, "f6cbc6da7b90ea135883e0759848ca2c", 5776092},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - Spanish DOS - LOWRES (from the Leisure Suit Larry Collection)
// Executable scanning reports "1.001.113", VERSION file reports "1.000, 11.06.93, FIVE PATCHES ADDED TO DISK 6 ON 11-18-93"
@@ -2094,7 +2147,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "633bf8f42170b6271019917c8009989b", 6943},
{"resource.000", 0, "7884a8db9253e29e6b37a2651fd90ba3", 5733116},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Crazy Nick's Software Picks: Leisure Suit Larry's Casino - English DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "1.001.029", VERSION file reports "1.000"
@@ -2102,35 +2155,35 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "194f1578f2624db813c9072359ad1639", 783},
{"resource.001", 0, "3733433b517ec3d14a3331d9ab3842ae", 344830},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Crazy Nick's Software Picks: King Graham's Board Game Challenge
{"cnick-kq", "", {
{"resource.map", 0, "44bc538a5cd24b39ffccc967c0ebf84d", 1137},
{"resource.001", 0, "470e7a4a3504635e70b623c44461e1ac", 451272},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Crazy Nick's Software Picks: Parlor Games with Laura Bow
{"cnick-laurabow", "", {
{"resource.map", 0, "3b826bfe64f8ff1ccf30eef93cd2f727", 999},
{"resource.001", 0, "985ac8db6f636f2b4334c04b0fbb44fb", 336698},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Crazy Nick's Software Picks: Robin Hood's Game of Skill and Chance
{"cnick-longbow", "", {
{"resource.map", 0, "4a5c81f485a2416bde12978506f2fb5f", 897},
{"resource.001", 0, "ef16dc9e867eb8eeb5b13e110b90bd4b", 571466},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Crazy Nick's Software Picks: Roger Wilco's Spaced Out Game Pack
{"cnick-sq", "", {
{"resource.map", 0, "b4d95b02d84e297441bd999d34eaa6b1", 879},
{"resource.001", 0, "82ff2b64a60117886fbcd6a3a8c977c6", 364921},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Larry 6 - English/German DOS CD - HIRES
@@ -2139,7 +2192,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0c0804434ea62278dd15032b1947426c", 8872},
{"resource.000", 0, "9a9f4870504444cda863dd14d077a680", 18520872},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - German DOS CD - HIRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
@@ -2147,7 +2200,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "badfdf446ffed569a310d2c63a249421", 8896},
{"resource.000", 0, "bd944d2b06614a5b39f1586906f0ee88", 18534274},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 6 - French DOS CD - HIRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
@@ -2155,7 +2208,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "d184e9aa4f2d4b5670ddb3669db82cda", 8896},
{"resource.000", 0, "bd944d2b06614a5b39f1586906f0ee88", 18538987},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 7 - English DOS Demo (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
@@ -2163,7 +2216,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "5cc6159688b2dc03790a67c90ccc67f9", 10195878},
{"resmap.000", 0, "6a2b2811eef82e87cde91cf1de845af8", 2695},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI3_GAMES
// Larry 7 - English DOS CD (from spookypeanut)
@@ -2172,7 +2225,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "eae93e1b1d1ccc58b4691c371281c95d", 8188},
{"ressci.000", 0, "89353723488219e25589165d73ed663e", 66965678},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 7 - German DOS (from Tobis87)
// SCI interpreter version 3.000.000
@@ -2180,7 +2233,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "c11e6bfcfc2f2d05da47e5a7df3e9b1a", 8188},
{"ressci.000", 0, "a8c6817bb94f332ff498a71c8b47f893", 66971724},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 7 - French DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 3.000.000
@@ -2188,7 +2241,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "4407849fd52fe3efb0c30fba60cd5cd4", 8206},
{"ressci.000", 0, "dc37c3055fffbefb494ff22b145d377b", 66964472},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 7 - Italian DOS CD (from glorifindel)
// SCI interpreter version 3.000.000
@@ -2196,7 +2249,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "9852a97141f789413f29bf956052acdb", 8212},
{"ressci.000", 0, "440b9fed89590abb4e4386ed6f948ee2", 67140181},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::IT_ITA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Larry 7 - Spanish DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "3.000.000", VERSION file reports "1.0s"
@@ -2204,7 +2257,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "8f3d603e1acc834a5d598b30cdfc93f3", 8188},
{"ressci.000", 0, "32792f9bc1bf3633a88b382bb3f6e40d", 67071418},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif
// Lighthouse - English Windows Demo (from jvprat)
@@ -2213,7 +2266,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "543124606352bfa5e07696ddf2a669be", 64},
{"resource.000", 0, "5d7714416b612463d750fb9c5690c859", 28952},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI3_GAMES
// Lighthouse - English Windows Demo
@@ -2222,7 +2275,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "3bdee7a16926975a4729f75cf6b80a92", 1525},
{"ressci.000", 0, "3c585827fa4a82f4c04a56a0bc52ccee", 11494351},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Lighthouse - English DOS (from jvprat)
// Executable scanning reports "3.000.000", VERSION file reports "1.1"
@@ -2232,7 +2285,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "c68db5333f152fea6ca2dfc75cad8b34", 7573},
{"ressci.002", 0, "175468431a979b9f317c294ce3bc1430", 94628315},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Lighthouse - Spanish DOS (from jvprat)
// Executable scanning reports "3.000.000", VERSION file reports "1.1"
@@ -2242,7 +2295,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "e7dc85884a2417e2eff9de0c63dd65fa", 7630},
{"ressci.002", 0, "3c8d627c555b0e3e4f1d9955bc0f0df4", 94631127},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI3_GAMES
#endif // ENABLE_SCI32
@@ -2253,7 +2306,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "8be56a3a88c065ee00c02c0e29199f3a", 14643},
{"resource.001", 0, "9e33566515b18bee7915db448063bba2", 871853},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Fairy Tales - English DOS Floppy EGA (from omer_mor, bug report #3035350)
{"fairytales", "EGA", {
@@ -2264,7 +2317,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "509b2467ba779100d5933ed51a9ae32f", 560255},
{"resource.004", 0, "93afc85d5ffa60ea555d6cc336d22c03", 651109},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Fairy Tales v1.000 - English DOS (supplied by markcoolio in bug report #2723791)
// Executable scanning reports "1.000.145"
@@ -2276,7 +2329,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "b1288e0821ee358d1ffe877e5900c8ec", 1047565},
{"resource.004", 0, "f79daa70390d73746742ffcfc3dc4471", 937580},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Fairy Tales - English DOS Floppy (from jvprat)
// Executable scanning reports "1.000.145", Floppy label reports "1.0, 11.13.91", VERSION file reports "1.000"
@@ -2287,7 +2340,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "564f516d991032e781492592a4eaa275", 1414142},
{"resource.003", 0, "dd6cef0c592eadb7e6be9a25307c57a2", 1344719},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.003.009"
@@ -2297,7 +2350,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "fb552ae550ca1dac19ed8f6a3767612d", 262885},
{"resource.002", 0, "fb552ae550ca1dac19ed8f6a3767612d", 817191},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose - English DOS Floppy EGA (from omer_mor, bug report #3035354)
{"mothergoose", "EGA", {
@@ -2305,7 +2358,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d893892d62b3f061357291d66775e360", 239906},
{"resource.002", 0, "d893892d62b3f061357291d66775e360", 719398},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose - English DOS Floppy EGA (supplied by ssburnout in bug report #3049193)
// 1.011 5x5.25" (label: Int#8.2.90)
@@ -2318,7 +2371,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "dbbc22f124533ce308bc386b08956326", 146251},
{"resource.005", 0, "2ba5348e7fad641b9c4c7ff7c7cf4e68", 110979},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose v2.000 - English DOS Floppy (supplied by markcoolio in bug report #2723795)
// Executable scanning reports "1.001.031"
@@ -2326,7 +2379,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "52aae15e493cafd1da7e1c9b657a5bb9", 7026},
{"resource.000", 0, "b7ecd8ae9e254e80310b5a668b276e6e", 2948975},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose - English DOS CD (from jvprat)
// Executable scanning reports "x.yyy.zzz"
@@ -2335,7 +2388,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1c7f311b0a2c927b2fbe81ae341fb2f6", 5790},
{"resource.001", 0, "5a0ed1d745855148364de1b3be099bac", 4369438},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose - English Windows Interactive Demo
// Executable scanning reports "x.yyy.zzz"
@@ -2343,19 +2396,19 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "87f9dc1cafc4d4fa835fb2f00cf3a6ef", 4560},
{"resource.001", 0, "5a0ed1d745855148364de1b3be099bac", 2070072},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose - FM-Towns (supplied by abevi in bug report #3038720)
{"mothergoose256", "", {
{"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
{"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
{"mothergoose256", "", {
{"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
{"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformFMTowns, 0, GUIO1(GUIO_NOASPECT) },
+ Common::JA_JPN, Common::kPlatformFMTowns, 0, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Mixed-Up Mother Goose Deluxe - English Windows/DOS CD (supplied by markcoolio in bug report #2723810)
@@ -2364,7 +2417,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5159a1578c4306bfe070a3e4d8c2e1d3", 4741},
{"resource.000", 0, "1926925c95d82f0999590e93b02887c5", 15150768},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Mixed-Up Mother Goose Deluxe - Multilingual Windows CD (English/French/German/Spanish)
// Executable scanning reports "2.100.002"
@@ -2372,7 +2425,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "ef611af561898dcfea87846919ebf3eb", 4969},
{"ressci.000", 0, "227685bc59d90821978d330713e44a7a", 17205800},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI32
// Ms. Astro Chicken - English DOS
@@ -2381,7 +2434,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5b457cbe5042f557e5b610148171f6c0", 1158},
{"resource.001", 0, "453ea81ef66a50cbe33ce06302afe47f", 229737},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Phantasmagoria - English DOS (from jvprat)
@@ -2402,7 +2455,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.007", 0, "afbd16ea77869a720afa1c5371de107d", 7972},
//{"ressci.007", 0, "3aae6559aa1df273bc542d5ac6330d75", 25859038},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Phantasmagoria - English DOS Demo
// Executable scanning reports "2.100.002"
@@ -2410,7 +2463,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.001", 0, "416138651ea828219ca454cae18341a3", 11518},
{"ressci.001", 0, "3aae6559aa1df273bc542d5ac6330d75", 65844612},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Phantasmagoria - English DOS/Windows (GOG version) - ressci.* merged in ressci.000
// Windows executable scanning reports "2.100.002" - "Sep 19 1995 15:09:43"
@@ -2421,7 +2474,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "cd5967f9b9586e3380645961c0765be3", 116822037},
{"resmap.000", 0, "3cafc1c6a53945c1f3babbfd6380c64c", 16468},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Phantasmagoria - English Macintosh
// NOTE: This only contains disc 1 files (as well as the two persistent files:
@@ -2437,7 +2490,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
// Data8-12 are empty
{"Data13", 0, "6d2c450fca19a69b5af74ed5b03c0a17", 14923328},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI3_GAMES
// Phantasmagoria 2 - English Windows (from jvprat)
@@ -2454,7 +2507,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.005", 0, "8bd5ceeedcbe16dfe55d1b90dcd4be84", 1942},
{"ressci.005", 0, "05f9fe2bee749659acb3cd2c90252fc5", 67905112},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Phantasmagoria 2 - English DOS (GOG version) - ressci.* merged in ressci.000
// Executable scanning reports "3.000.000" - "Dec 07 1996 09:29:03"
@@ -2464,7 +2517,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "c54f26d9f43f908151263254b6d97053", 108134481},
{"resmap.000", 0, "de154a223a9ef4ea7358b76adc38ef5b", 2956},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI3_GAMES
#endif // ENABLE_SCI32
@@ -2475,7 +2528,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "72726dc81c1b4c1110c486be77369bc8", 5179},
{"resource.000", 0, "670d0c53622429f4b11275caf7f8d292", 5459574},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Pepper - English DOS Non-Interactive Demo
// Executable scanning reports "1.001.060", VERSION file reports "1.000"
@@ -2483,7 +2536,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "379bb4fb896630b14f2d91ed21e36ba1", 984},
{"resource.000", 0, "118f6c31a93ec7fd9a231c61125229e3", 645494},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Pepper - English DOS/Windows Interactive Demo
// Executable scanning reports "1.001.069", VERSION file reports ".001"
@@ -2491,7 +2544,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "975e8df76106a5c13d12ab674f906a02", 2514},
{"resource.000", 0, "e6a918a2dd7a4bcecd8fb389f43287c2", 1698164},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Pepper - English DOS Interactive Demo
// Executable scanning reports "1.001.072", VERSION file reports "1.000"
@@ -2499,7 +2552,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "9c9b7b900651a370dd3fb38d478b1798", 2524},
{"resource.000", 0, "e6a918a2dd7a4bcecd8fb389f43287c2", 1713544},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 1 VGA Remake - English DOS (from the Police Quest Collection)
// Executable scanning reports "1.001.029", VERSION file reports "2.000"
@@ -2507,7 +2560,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "35efa814fb994b1cbdac9611e401da67", 5013},
{"resource.000", 0, "e0d5ddf34eda903a38f0837e2aa7145b", 6401433},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 - English Amiga (from www.back2roots.org)
// SCI interpreter version 0.000.685 (just a guess)
@@ -2518,7 +2571,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "499737c21a28ac026e11ab817100d610", 511099},
{"resource.003", 0, "e008f5d6e2a7c4d4a0da0173e4fa8f8b", 553970},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 - English DOS Non-Interactive Demo
// Executable scanning reports "0.000.413"
@@ -2526,7 +2579,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8b77d0d4650c2052b356cece28294b58", 576},
{"resource.001", 0, "376ef6d6eaaeed66e1424bd219c4b9ab", 215398},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 - English DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 0.000.395
@@ -2539,7 +2592,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "77f02def3094af804fd2371db25b7100", 349899},
{"resource.006", 0, "77f02def3094af804fd2371db25b7100", 354991},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 - English DOS (from the Police Quest Collection)
// Executable scanning reports "0.000.490"
@@ -2549,7 +2602,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "77f02def3094af804fd2371db25b7100", 546000},
{"resource.003", 0, "77f02def3094af804fd2371db25b7100", 591851},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 - English DOS (from FRG)
// SCI interpreter version 0.000.395
@@ -2559,7 +2612,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "77f02def3094af804fd2371db25b7100", 542897},
{"resource.003", 0, "77f02def3094af804fd2371db25b7100", 586857},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 English DOS 1.001.006 (supplied by merkur-kun in bug report #3028479)
{"pq2", "", {
@@ -2568,7 +2621,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "77f02def3094af804fd2371db25b7100", 541261},
{"resource.003", 0, "77f02def3094af804fd2371db25b7100", 587511},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 2 - Japanese PC-98 (also includes english language)
// SCI interpreter version unknown
@@ -2578,7 +2631,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "05fdee43a228dd6ea4d1a92ccae3f788", 637662},
{"resource.003", 0, "05fdee43a228dd6ea4d1a92ccae3f788", 684395},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 3 - English Amiga
// Executable scanning reports "1.004.024"
@@ -2591,7 +2644,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "630bfa65beb05f743552704ac2899dae", 759891},
{"resource.004", 0, "7b229fbdf30d670d0728cede3e984a7e", 838663},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 3 - German Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -2605,7 +2658,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "6258d5dd85898d8e218eb8113ebc9059", 722738},
{"resource.005", 0, "6258d5dd85898d8e218eb8113ebc9059", 704485},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 3 - English DOS (from the Police Quest Collection)
// Executable scanning reports "T.A00.178", VERSION file reports "1.00"
@@ -2618,7 +2671,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "8791b9eef53edf77c2dac950142221d3", 1159791},
{"resource.004", 0, "1b91e891a3c60a941dac0eecdf83375b", 1143606},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 3 - English DOS Non-Interactive Demo
// Executable scanning reports "T.A00.052"
@@ -2628,7 +2681,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "277f97771f7a6d89677141f02da313d6", 65150},
{"resource.001", 0, "5c5a551b6c86cce2ee75becb90e0b586", 624411},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 3 - German DOS (supplied by markcoolio in bug report #2723837, also includes english language)
// Executable scanning reports "T.A00.178"
@@ -2641,7 +2694,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "4836f460f4cfc8de61e2df4c45775504", 1180956},
{"resource.004", 0, "0c3eb84b9755852d9e795e0d5c9373c7", 1171760},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // Police Quest 3 - Spanish DOS v1.000 - Supplied by dianiu in bug report #3555647
+ {"pq3", "", {
+ {"resource.map", 0, "ffa0b4631c4e36d69631256d19ba29e7", 5421},
+ {"resource.000", 0, "5ee460af3d70c06a745cc482b6c783ba", 5410263},
+ AD_LISTEND},
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 3 EGA
// Reported by musiclyinspired in bug report #3046573
@@ -2654,7 +2714,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b96a86ab681769e4cbb439670d967ca6", 449682},
{"resource.005", 0, "9e6c53a0e7eef53694d260fade8b1fc7", 724000},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 4 - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.001.096
@@ -2662,7 +2722,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "be56f87a1c4a13062a30a362df860c2f", 1472},
{"resource.000", 0, "527d5684016e6816157cd15d9071b11b", 1121310},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Police Quest 4 - English DOS CD (from the Police Quest Collection)
@@ -2671,7 +2731,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "379dfe80ed6bd16c47e4b950c4722eac", 11374},
{"resource.000", 0, "fd316a09b628b7032248139003369022", 18841068},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 4 - German DOS CD (German text, English speech)
// Supplied by markcoolio in bug report #3392955
@@ -2679,7 +2739,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a398076371ed0e1e706c8f9fb9fc7ac5", 11386},
{"resource.000", 0, "6ff21954e0a2c5992279e7eb787c8d56", 18918747},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 4 - English DOS
// SCI interpreter version 2.000.000 (a guess?)
@@ -2687,7 +2747,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "aed9643158ccf01b71f359db33137f82", 9895},
{"resource.000", 0, "da383857b3be1e4514daeba2524359e0", 15141432},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 4 - French DOS (supplied by abevi in bug report #2612718)
// SCI interpreter version 2.000.000
@@ -2695,7 +2755,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "008030846edcc7c5c7a812c7f4ae4ceb", 9256},
{"resource.000", 0, "6ba98bd2e436739d87ecd2a9b99cabb4", 14730153},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest 4 - German DOS (supplied by markcoolio in bug report #2723840)
// SCI interpreter version 2.000.000 (a guess?)
@@ -2703,7 +2763,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2393ee728ab930b2762cb5889f9b5aff", 9256},
{"resource.000", 0, "6ba98bd2e436739d87ecd2a9b99cabb4", 14730155},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest: SWAT - English DOS/Windows Demo (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "0.001.200"
@@ -2711,7 +2771,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8c96733ef94c21526792f7ca4e3f2120", 1648},
{"resource.000", 0, "d8892f1b8c56c8f7704325460f49b300", 3676175},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest: SWAT - English DOS (from GOG.com)
// Executable scanning reports "2.100.002", VERSION file reports "1.0c"
@@ -2719,7 +2779,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "1c2563fee189885e29d9348f37306d94", 12175},
{"ressci.000", 0, "b2e1826ca81ce2e7e764587f5a14eee9", 127149181},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Police Quest: SWAT - English Windows (from the Police Quest Collection)
// Executable scanning reports "2.100.002", VERSION file reports "1.0c"
@@ -2734,7 +2794,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.004", 0, "4228038906f041623e65789500b22285", 6835},
{"ressci.004", 0, "b7e619e6ecf62fe65d5116a3a422e5f0", 46223872},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI32
// Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy (supplied by merkur in bug report #2718784)
@@ -2747,7 +2807,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 642203},
{"resource.004", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 641688},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy (supplied by alonzotg in bug report #3206006)
{"qfg1", "", {
@@ -2758,7 +2818,32 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 642203},
{"resource.004", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 641688},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy v1.102 Int#0.000.629 (suppled by digitoxin1 in bug report #3554611)
+ {"qfg1", "", {
+ {"resource.map", 0, "b162dbd4632250d4d83bed46d0783c10", 6396},
+ {"resource.000", 0, "40332d3ebfc70a4b6a6a0443c2763287", 78800},
+ {"resource.001", 0, "a270012fa74445d74c044d1b65a9ff8c", 459835},
+ {"resource.002", 0, "e64004e020fdf1813be52b639b08be89", 635561},
+ {"resource.003", 0, "f0af87c60ec869946da442833aa5afa8", 640502},
+ {"resource.004", 0, "f0af87c60ec869946da442833aa5afa8", 644575},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy v1.102 Int#0.000.629 (suppled by digitoxin1 in bug report #3554611)
+ {"qfg1", "", {
+ {"resource.map", 0, "5772a2c1bfae46f26582582c9901121e", 6858},
+ {"resource.000", 0, "40332d3ebfc70a4b6a6a0443c2763287", 78800},
+ {"resource.001", 0, "a270012fa74445d74c044d1b65a9ff8c", 75090},
+ {"resource.002", 0, "d22695c53835dfdece056d86f26c251e", 271354},
+ {"resource.003", 0, "3cd085e27078f269b3ece5838812ff41", 258084},
+ {"resource.004", 0, "8927c7a04a78f1e76f342db3ccc9d879", 267835},
+ {"resource.005", 0, "13d16cc9b90b51e2c8643cdf52a62957", 268807},
+ {"resource.006", 0, "48b2b3c964dcbeccb68e984e6d4e97db", 278473},
+ {"resource.007", 0, "f0af87c60ec869946da442833aa5afa8", 269237},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by markcoolio in bug report #2723843)
// Executable scanning reports "0.000.566"
@@ -2773,7 +2858,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "69366c2a2f99917199fe1b60a4fee19d", 267852},
{"resource.007", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 272747},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by ssburnout in bug report #3049193)
// 1.001 10x5.25" (label: INT.#0.000.566)
@@ -2788,7 +2873,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "69366c2a2f99917199fe1b60a4fee19d", 267852},
{"resource.007", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 272747},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by ssburnout in bug report #3049193)
// 1.200 10x5.25" (label: INT#9.10.90)
@@ -2803,7 +2888,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f46690dca714abc8c89357d30e363dd3", 278387},
{"resource.007", 0, "951299a82a8134ed12c5c18118d45c2f", 269173},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 / Hero's Quest - English DOS Demo
// Executable scanning reports "0.000.685"
@@ -2811,7 +2896,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "df34c758cbb9026da175793ff686b0e6", 882},
{"resource.001", 0, "73fbaafdd313b39aeedb80fbf85ecef1", 389884},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy (also includes English language)
// Executable scanning reports "S.old.201"
@@ -2821,7 +2906,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "a21451ef6fa8179bd4b22c4950004c44", 1136968},
{"resource.003", 0, "a21451ef6fa8179bd4b22c4950004c44", 769897},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO3(GUIO_NOSPEECH, GUIO_NOASPECT, GUIO_EGAUNDITHER) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO3(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_EGA_UNDITHER) },
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy (also includes English language)
// Executable scanning reports "S.old.201"
@@ -2831,7 +2916,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "a21451ef6fa8179bd4b22c4950004c44", 1147121},
{"resource.003", 0, "a21451ef6fa8179bd4b22c4950004c44", 777575},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO3(GUIO_NOSPEECH, GUIO_NOASPECT, GUIO_EGAUNDITHER) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO3(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_EGA_UNDITHER) },
// Quest for Glory 1 - English Amiga
// Executable scanning reports "1.002.020"
@@ -2845,18 +2930,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "16cd4414c37ae3bb6d6da33dce8e25e8", 689124},
{"resource.005", 0, "5f3386ef2f2b1254e4a066f5d9027324", 609529},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
-
- // Quest for Glory 1 (from abevi, bug report #2612718)
- {"qfg1", "", {
- {"resource.map", 0, "b162dbd4632250d4d83bed46d0783c10", 6396},
- {"resource.000", 0, "40332d3ebfc70a4b6a6a0443c2763287", 78800},
- {"resource.001", 0, "a270012fa74445d74c044d1b65a9ff8c", 459835},
- {"resource.002", 0, "e64004e020fdf1813be52b639b08be89", 635561},
- {"resource.003", 0, "f0af87c60ec869946da442833aa5afa8", 640502},
- {"resource.004", 0, "f0af87c60ec869946da442833aa5afa8", 644575},
- AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 - English DOS
// SCI interpreter version 0.000.629
@@ -2868,7 +2942,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "951299a82a8134ed12c5c18118d45c2f", 640483},
{"resource.004", 0, "951299a82a8134ed12c5c18118d45c2f", 644443},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 VGA Remake - English DOS
// Executable scanning reports "2.000.411"
@@ -2876,7 +2950,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a731fb6c9c0b282443f7027bc8694d4c", 8469},
{"resource.000", 0, "ecace1a2771846b1a8aa1afdd44111a0", 6570147},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 VGA Remake - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.001.029
@@ -2884,7 +2958,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ac0257051c95a59c0cdc0be24d9b11fa", 729},
{"resource.000", 0, "ec6f5cf369054dd3e5392995e9975b9e", 768218},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 1 VGA Remake - English Macintosh Floppy
// VERSION file reports "2.0"
@@ -2892,7 +2966,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data1", 0, "106527ff8756e4e1a795d63d23e8b833", 1752358},
{"Data2", 0, "5cdd92033231159c6e9c71d43e9f194d", 6574746},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 2 - English Amiga
// Executable scanning reports "1.003.004"
@@ -2908,7 +2982,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "ccf5dba33e5cab6d5872838c0f8db44c", 500039},
{"resource.007", 0, "4c9fc1587545879295cb9627f56a2cb8", 575056},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 2 - English (supplied by ssburnout in bug report #3049193)
// 1.000 5x5.25" (label: INT#10.31.90)
@@ -2920,7 +2994,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "0790f67d87642132be515cab05026baa", 972144},
{"resource.004", 0, "2ac1e6fea9aa1f5b91a06693a67b9766", 982830},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 2 - English (supplied by ssburnout in bug report #3049193)
// 1.000 9x3.5" (label: INT#10.31.90)
@@ -2935,7 +3009,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "5e9deacbdb17198ad844988e04833520", 498593},
{"resource.007", 0, "2ac1e6fea9aa1f5b91a06693a67b9766", 490151},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 2 - English (from FRG)
// Executable scanning reports "1.000.072"
@@ -2947,7 +3021,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "b192607c42f6960ecdf2ad2e4f90e9bc", 972804},
{"resource.004", 0, "cd2de58e27665d5853530de93fae7cd6", 983617},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 2 - English DOS
// Executable scanning reports "1.000.072"
@@ -2962,7 +3036,22 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "b1944bd664ddbd2859cdaa0c4a0d6281", 507489},
{"resource.007", 0, "cd2de58e27665d5853530de93fae7cd6", 490794},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // Quest for Glory 2 - English DOS (supplied by digitoxin1 in bug report #3554614)
+ // v1.102 9x3.5" (label: Int#11.20.90)
+ {"qfg2", "", {
+ {"resource.map", 0, "367023314ea33e3156297402f6c1da49", 8166},
+ {"resource.000", 0, "a17e374c4d33b81208c862bc0ffc1a38", 212119},
+ {"resource.001", 0, "e08d7887e30b12008c40f9570447711a", 331995},
+ {"resource.002", 0, "df137dc7869cab07e1149ba2333c815c", 467461},
+ {"resource.003", 0, "df137dc7869cab07e1149ba2333c815c", 502560},
+ {"resource.004", 0, "df137dc7869cab07e1149ba2333c815c", 488532},
+ {"resource.005", 0, "df137dc7869cab07e1149ba2333c815c", 478574},
+ {"resource.006", 0, "b1944bd664ddbd2859cdaa0c4a0d6281", 507489},
+ {"resource.007", 0, "cd2de58e27665d5853530de93fae7cd6", 490794},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 2 - English DOS Non-Interactive Demo
// Executable scanning reports "1.000.046"
@@ -2970,7 +3059,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e75eb86bdd517b3ef709058249986a87", 906},
{"resource.001", 0, "9b098f9e1008abe30e56c93b896494e6", 362123},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG)
// Executable scanning reports "1.001.021", VERSION file reports "1.000, 0.001.059, 6.12.92"
@@ -2978,7 +3067,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "fd71de9b588a45f085317caacf050e91", 687},
{"resource.000", 0, "b6c69bf6c18bf177492249fe81fc6a6d", 648702},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - English DOS
// SCI interpreter version 1.001.050
@@ -2986,7 +3075,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "19e2bf9b693932b5e2bb59b9f9ab86c9", 5958},
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868000},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - English DOS (supplied by abevi in bug report #2612718)
// SCI interpreter version 1.001.050
@@ -2994,7 +3083,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "62c185d190363d7df06330fa0cc45b36", 5958},
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5867442},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - English DOS (supplied by dknute in bug report #3125559)
{"qfg3", "", {
@@ -3002,7 +3091,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868042},
{"resource.msg", 0, "27e5419c98ce444253f88c95dced14a9", 246888},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - German DOS (supplied by markcoolio in bug report #2723846)
// Executable scanning reports "L.rry.083"
@@ -3010,7 +3099,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "19e2bf9b693932b5e2bb59b9f9ab86c9", 5958},
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868042},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - Spanish DOS CD (from jvprat)
// Executable scanning reports "L.rry.083", VERSION file reports "1.000.000, June 30, 1994"
@@ -3019,7 +3108,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "ba7ac86155e4c531e46cd73c86daa80a", 5884098},
{"resource.msg", 0, "a63974730d294dec0bea10057c36e506", 256014},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO0() },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 3 - Italian DOS
// Supplied by ghoost in bug report #3053457
@@ -3028,7 +3117,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868000},
{"resource.msg", 0, "5a0a896ff3e4a628db38a75eb6c84114", 259018},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, 0, GUIO0() },
+ Common::IT_ITA, Common::kPlatformPC, 0, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 4 - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.001.069 (just a guess)
@@ -3036,7 +3125,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1ba7c7ae1efb315326d45cb931569b1b", 922},
{"resource.000", 0, "41ba03f0b188b029132daa3ece0d3e14", 623154},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Quest for Glory 4 1.1 Floppy - English DOS (supplied by markcool in bug report #2723852)
@@ -3045,7 +3134,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "685bdb1ed47bbbb0e5e25db392da83ce", 9301},
{"resource.000", 0, "f64fd6aa3977939a86ff30783dd677e1", 11004993},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 4 1.1 Floppy - English DOS (supplied by abevi in bug report #2612718)
// SCI interpreter version 2.000.000
@@ -3053,7 +3142,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "d10a4cc177d2091d744e2ad8c049b0ae", 9295},
{"resource.000", 0, "f64fd6aa3977939a86ff30783dd677e1", 11003589},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 4 1.1 Floppy - German DOS (supplied by markcool in bug report #2723850)
// Executable scanning reports "2.000.000", VERSION file reports "1.1"
@@ -3061,7 +3150,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "9e0abba8746f40565bc7eb5720522ecd", 9301},
{"resource.000", 0, "57f22cdc54eeb35fce1f26b31b5c3ee1", 11076197},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Quest for Glory 4 CD - English DOS/Windows (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -3069,7 +3158,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "aba367f2102e81782d961b14fbe3d630", 10246},
{"resource.000", 0, "263dce4aa34c49d3ad29bec889007b1c", 11571394},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// RAMA - English DOS/Windows Demo
// Executable scanning reports "2.100.002", VERSION file reports "000.000.008"
@@ -3077,7 +3166,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.001", 0, "775304e9b2a545156be4d94209550094", 1393},
{"ressci.001", 0, "259437fd75fdf51e8207fda8c01fa4fd", 2334384},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI3_GAMES
// RAMA - English Windows (from jvprat)
@@ -3090,7 +3179,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.003", 0, "31ef4c0621711585d031f0ae81707251", 1636},
{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6860492},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// RAMA - English Windows (from Quietust, in bug report #2850645)
{"rama", "", {
@@ -3101,7 +3190,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.003", 0, "48841e4b84ef1b98b48d43566fda9e13", 1636},
{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6870356},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// RAMA - Italian Windows CD (from glorifindel)
// SCI interpreter version 3.000.000 (a guess?)
@@ -3109,7 +3198,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.001", 0, "2a68edd064e5e4937b5e9c74b38f2082", 70611091},
{"resmap.001", 0, "70ba2ff04a2b7fb2c52420ba7fbd47c2", 8338},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI3_GAMES
// Shivers - English Windows (from jvprat)
@@ -3118,14 +3207,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "f2ead37749ed8f6535a2445a7d05a0cc", 46525},
{"ressci.000", 0, "4294c6d7510935f2e0a52e302073c951", 262654836},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Shivers - German Windows (from Tobis87)
{"shivers", "", {
{"resmap.000", 0, "f483d0a1f78334c18052e92785c3086e", 46537},
{"ressci.000", 0, "6751b144671e2deed919eb9d284b07eb", 262390692},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Shivers - English Windows Demo
// Executable scanning reports "2.100.002"
@@ -3133,7 +3222,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "d9e0bc5eddefcbe47f528760085d8927", 1186},
{"ressci.000", 0, "3a93c6340b54e07e65d0e5583354d186", 10505469},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Shivers 2 doesn't contain SCI scripts. The whole game logic has
// been reimplemented from SCI in native code placed in DLL files.
@@ -3151,7 +3240,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "d8659188b84beaef076bd869837cd530", 634},
{"ressci.000", 0, "7fbac0807a044c9543e8ac376d200e59", 4925003},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Shivers 2 - English Windows (from abevi)
// VERSION.TXT Version 1.0 (3/25/97)
@@ -3159,7 +3248,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.001", 0, "a79d03d6eb75be0a79324f14e3d2ace4", 95346793},
{"resmap.001", 0, "a4804d436d90c4ec2e46b537f5e954db", 6268},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif
@@ -3172,7 +3261,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.msg", 0, "1aeafe2b495de288d002109650b66614", 1364},
{"resource.000", 0, "8e10d4f05c1fd9f883384fa38a898489", 377394},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Slater & Charlie Go Camping - English DOS/Windows
{"slater", "", {
@@ -3180,7 +3269,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "21f85414124dc23e54544a5536dc35cd", 4044},
{"resource.msg", 0, "c44f51fb955eae266fecf360ebcd5ad2", 1132},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Slater & Charlie Go Camping - English DOS/Windows (Sierra Originals)
@@ -3189,7 +3278,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "21f85414124dc23e54544a5536dc35cd", 4044},
{"resource.msg", 0, "c44f51fb955eae266fecf360ebcd5ad2", 1132},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Slater & Charlie Go Camping - English Macintosh
{"slater", "", {
@@ -3209,7 +3298,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b25a1539c71701f7715f738c5037e9a6", 775515},
{"resource.005", 0, "640ffe1a9acde392cc33cc1b1a528328", 806324},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 1 VGA Remake - English DOS (from the Space Quest Collection)
// Executable scanning reports "T.A00.081", VERSION file reports "2.000"
@@ -3222,7 +3311,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "c47600e50c6fc591957ae0c5020ee7b8", 1213262},
{"resource.004", 0, "e19ea4ad131472f9238590f2e1d40289", 1203051},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 1 VGA Remake - English Mac (from Fingolfin)
{"sq1sci", "SCI", {
@@ -3233,7 +3322,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "ae46e195e66df5a131917f0aa80b5669", 1242794},
{"resource.004", 0, "91d58a9eb2187c38424990afe4c12bc6", 1250949},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 1 VGA Remake - English Non-Interactive Demo (from FRG)
// SCI interpreter version 1.000.181
@@ -3241,7 +3330,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5af709ac5e0e923e0b8174f49978c30e", 636},
{"resource.001", 0, "fd99ea43f57576ded7c86036996346cf", 507642},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 1 VGA Remake - Spanish DOS Floppy (from jvprat)
// Executable scanning reports "T.A00.081", VERSION file reports "2.000"
@@ -3255,7 +3344,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9b78228ad4f9f335fedf74f1812dcfca", 513325},
{"resource.005", 0, "7d4ebcb745c0bf8fc42e4013f52ecd49", 1101812},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest I 2.0 EGA DOS (6 x 3.5" disks)
// Provided by ssburnout in bug report #3046805
@@ -3268,7 +3357,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "975c6e81194ae6b65e960a248129ecaa", 684119},
{"resource.005", 0, "13d96f7905637552c0647175ff816145", 695589},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - English Amiga (from www.back2roots.org)
// SCI interpreter version 0.000.453 (just a guess)
@@ -3279,7 +3368,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 746496},
{"resource.004", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 761984},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - German Amiga (also includes english language)
// Executable scanning reports "1.004.006"
@@ -3292,7 +3381,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 545053},
{"resource.005", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 687507},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - English DOS Non-Interactive Demo
// SCI interpreter version 0.000.453
@@ -3300,7 +3389,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ec66ac2b1ce58b2575ba00b65058de1a", 612},
{"resource.001", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 180245},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - English DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 0.000.453
@@ -3310,7 +3399,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 720244},
{"resource.003", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 688367},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - English DOS (from the Space Quest Collection)
// Executable scanning reports "0.000.685", VERSION file reports "1.018"
@@ -3320,7 +3409,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "8b55c4875298f45ea5696a5ee8f6a7fe", 715777},
{"resource.003", 0, "8b55c4875298f45ea5696a5ee8f6a7fe", 703370},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - English DOS (from abevi, bug report #2612718)
{"sq3", "", {
@@ -3332,7 +3421,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 328278},
{"resource.006", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 356702},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - English Mac (from Fingolfin)
{"sq3", "", {
@@ -3341,7 +3430,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "0d8dfe42683b46f3131823233a91ce6a", 794072},
{"resource.003", 0, "0d8dfe42683b46f3131823233a91ce6a", 776536},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 - German DOS (from Tobis87, also includes english language)
// SCI interpreter version 0.000.453 (?)
@@ -3355,7 +3444,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "9107c2aa5398e28b5c5406df13491f85", 320643},
{"resource.007", 0, "9107c2aa5398e28b5c5406df13491f85", 344287},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 3 v1.052 - German DOS (supplied by markcoolio in bug report #2723860, also includes english language)
// Executable scanning reports "S.old.114"
@@ -3365,7 +3454,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "9107c2aa5398e28b5c5406df13491f85", 596768},
{"resource.003", 0, "9107c2aa5398e28b5c5406df13491f85", 693573},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - English Amiga
// Executable scanning reports "1.004.024"
@@ -3380,7 +3469,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "3540d1cc84d674cf4b2c898b88a3b563", 790296},
{"resource.006", 0, "ade814bc4d56244c156d9e9bcfebbc11", 664085},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - German Amiga (from www.back2roots.org, also includes english language)
// SCI interpreter version 1.000.200 (just a guess)
@@ -3394,7 +3483,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "10ee1709e6559c724676d058199b75b5", 818745},
{"resource.006", 0, "67fb188b191d88efe8414af6ea297b93", 672675},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - English DOS - THIS VERSION IS PIRATED/CRACKED AND REPACKAGED =DO NOT RE-ADD=
// Executable scanning reports "1.000.753"
@@ -3403,7 +3492,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a18088c8aceb06025dbc945f29e02935", 5124},
{"resource.000", 0, "e1f46832cd2458796028e054a0466031", 5502009},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - English DOS
// Executable scanning reports "1.000.753"
@@ -3412,7 +3501,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "71ccf4f82ac4efb588731acfb7bf2603", 5646},
{"resource.000", 0, "e1f46832cd2458796028e054a0466031", 933928},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 1.052 - English DOS Floppy (supplied by markcoolio in bug report #2723865)
// Executable scanning reports "1.000.753"
@@ -3426,7 +3515,20 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "ff9c87da3bc53473fdee8b9d3edbc93c", 1200631},
{"resource.005", 0, "e33019ac19f755ae33fbf49b4fc9066c", 1053294},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // Space Quest 4 1.000 - French DOS Floppy (supplied by misterhands in bug report #3515247)
+ {"sq4", "", {
+
+ {"resource.map", 0, "1fd6f356f6a59ad2057686ce6573caeb", 6159},
+ {"resource.000", 0, "8000a55aebc50a68b7cce07a8c33758c", 205287},
+ {"resource.001", 0, "99a6df6d366b3f061271ff3450ac0d32", 1269850},
+ {"resource.002", 0, "a6a8d7a24dbb7a266a26b084e7275e89", 1242668},
+ {"resource.003", 0, "482a99c8103b4bcb5706e5969d1c1193", 1323083},
+ {"resource.004", 0, "b2cca3afcf2e013b8ce86b64155af766", 1254353},
+ {"resource.005", 0, "9e520577e035547c4b5149a6d12ef85b", 1098814},
+ AD_LISTEND},
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 1.000 - English DOS Floppy (from abevi, bug report #2612718)
{"sq4", "", {
@@ -3438,7 +3540,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "c06350184a490c10eb4585fff0aa3192", 1254368},
{"resource.005", 0, "b8d6efbd3235329bfe844c794097b2c9", 1098717},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest IV DOS 1.060 EGA (6 x 3.5" disks)
// Supplied by ssburnout in bug report #3046781
@@ -3451,7 +3553,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9a673e33c3f6dd560b993ffed77eeb49", 534994},
{"resource.005", 0, "3c4841d0a3ebba4404af588c93620c22", 595465},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - German DOS (from Tobis87, also includes english language)
// SCI interpreter version 1.000.200 (just a guess)
@@ -3465,7 +3567,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "47ee647b5b12232d27e63cc627c25899", 1156765},
{"resource.006", 0, "dfb023e4e2a1e7a00fa18f9ede72a91b", 924059},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - Italian DOS Floppy (from glorifindel, also includes english language)
// SCI interpreter version 1.000.200 (just a guess)
@@ -3478,7 +3580,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "4277c61bed40a50dadc4b5a344520af2", 1251000},
{"resource.005", 0, "5f885abd335978e2fd4e5f886d7676c8", 1102880},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - Japanese PC-98 5.25" Floppy (also includes english language)
// SCI interpreter version 1.000.1068
@@ -3488,7 +3590,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - Japanese PC-98 5.25" Floppy (also includes english language)
// SCI interpreter version 1.000.1068
@@ -3498,7 +3600,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - English DOS CD (from the Space Quest Collection)
// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -3506,7 +3608,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054},
{"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO5(GUIO_MIDIGM, GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - English Windows CD (from the Space Quest Collection)
// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -3516,7 +3618,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054},
{"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO5(GUIO_MIDIGM, GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - Spanish DOS CD (from jvprat, is still text only, not talkie, also includes english language)
// Executable scanning reports "1.SQ4.057", VERSION file reports "1.000"
@@ -3530,7 +3632,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "776fba81c110d1908776232cbe190e20", 1253752},
{"resource.005", 0, "55fae26c2a92f16ef72c1e216e827c0f", 1098328},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO0() },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - Spanish DOS Floppy (from jvprat, also includes english language)
// Executable scanning reports "1.SQ4.056", VERSION file reports "1.000"
@@ -3542,7 +3644,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "74c62fa2146ff3b3b2ea2b3fb95b9af9", 1140801},
{"resource.003", 0, "42a307941edeb1a3be31daeb2e4be90b", 1088408},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 1.000 - German DOS Floppy (supplied by markcoolio in bug report #2723862, also includes english language)
// Executable scanning reports "1.SQ4.030"
@@ -3556,7 +3658,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "c06350184a490c10eb4585fff0aa3192", 1254368},
{"resource.005", 0, "b8d6efbd3235329bfe844c794097b2c9", 1098717},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - English Macintosh
// Executable scanning reports "x.yyy.zzz"
@@ -3571,7 +3673,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "869d16cab6641c80b06f4dcee18f86bc", 1426228},
{"resource.006", 0, "91d23407bc0447a3722fbeb952d7edee", 1402451},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 4 - Russian DOS
// Executable scanning reports "1.000.753", VERSION file reports "1.994"
@@ -3584,7 +3686,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "2763fe4f0cb74df716ec8b0c464b0988", 1217428},
{"resource.005", 0, "d608713197c5ba1cd8c6ed46299c3069", 1057924},
AD_LISTEND},
- Common::RU_RUS, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::RU_RUS, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 - English DOS (from the Space Quest Collection)
// Executable scanning reports "1.001.068", VERSION file reports "1.04"
@@ -3593,7 +3695,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4147edc5045e6d62998018b5614c58ec", 5496486},
{"resource.msg", 0, "bb8ad78793c26bdb3f77498b1d6515a9", 125988},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 - English DOS - THIS IS THE UNOFFICIAL BETA VERSION, WHICH IS OBVIOUSLY PIRATED AND CONTAINS MANY BUGS
// ffs. http://www.akril15.com/sr/sq5alt/sq5alt.html =DO NOT RE-ADD=
@@ -3602,7 +3704,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8bde0a9adb9a3e9aaa861826874c9834", 6473},
{"resource.000", 0, "f4a48705764544d7cc64a7bb22a610df", 6025184},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 v1.04 - German DOS (from Tobis87, updated information by markcool from bug reports #2723935 and #2724762)
// SCI interpreter version 1.001.068
@@ -3611,7 +3713,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4147edc5045e6d62998018b5614c58ec", 5496486},
{"resource.msg", 0, "7c71cfc36153cfe07b450423a51f7e68", 146282},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 v1.04 - French DOS (from Hkz, Included in Space Quest Collector's Edition, with chapters I-V)
{"sq5", "", {
@@ -3619,7 +3721,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4147edc5045e6d62998018b5614c58ec", 5496486},
{"resource.msg", 0, "877c42380320eb1db7dad83ccd261214", 140374},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 - Italian DOS Floppy (from glorifindel)
// SCI interpreter version 1.001.068 (just a guess)
@@ -3627,7 +3729,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "5040026519f37199f3616fb1d4704dff", 6047170},
{"resource.map", 0, "5b09168baa2f6e2e22787429b2d72f54", 6492},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::IT_ITA, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 - Spanish DOS Floppy (from mirir, bug report #3090664)
{"sq5", "", {
@@ -3635,7 +3737,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5714a899033bdebf2d61ad333c8c6637", 6492},
{"resource.msg", 0, "46deca7ef9cf057f7d442df98c1a2ae2", 134612},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 5 - Russian DOS
// Executable scanning reports "1.001.068", VERSION file reports "1.994"
@@ -3644,7 +3746,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6f9ed21e1001526b4137f6703ed476af", 6103778},
{"resource.msg", 0, "0a8931990cd2eac1691602391c68ab85", 147580},
AD_LISTEND},
- Common::RU_RUS, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::RU_RUS, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Space Quest 6 - English DOS/Win3.11 CD (from the Space Quest Collection)
@@ -3653,7 +3755,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "6dddfa3a8f3a3a513ec9dfdfae955005", 10528},
{"resource.000", 0, "c4259ab7355aead07773397b1052827d", 41150806},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 6 - English DOS/Win3.11 CD ver 1.11 (from FRG)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3661,7 +3763,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e0615d6e4e10e37ae42e6a2a95aaf145", 10528},
{"resource.000", 0, "c4259ab7355aead07773397b1052827d", 41150806},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 6 - French DOS/Win3.11 CD (from French magazine Joystick - September 1997)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -3669,7 +3771,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "3c831625931d5079b73ae8c275f52c95", 10534},
{"resource.000", 0, "4195ca940f759424f62b90e262cc1737", 40932397},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 6 - German DOS (from Tobis87, updated info from markcoolio in bug report #2723884)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3677,7 +3779,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "664d797415484f85c90b1b45aedc7686", 10534},
{"resource.000", 0, "ba87ba91e5bdabb4169dd0df75777722", 40933685},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// Space Quest 6 - English DOS/Win3.11 Interactive Demo (from FRG)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3685,7 +3787,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "368f07b07433db3f819fa3fa0e5efee5", 2572},
{"resource.000", 0, "ab12724e078dea34b624e0d2a38dcd7c", 2272050},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI32
// The Island of Dr. Brain - English DOS CD (from jvprat)
@@ -3694,7 +3796,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2388efef8430b041b0f3b00b9050e4a2", 3281},
{"resource.000", 0, "b3acd9b9dd7fe53c4ee133ac9a1acfab", 2103560},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO0() },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// The Island of Dr. Brain - English DOS (from Quietust)
// Executable scanning reports "1.001.053", VERSION file reports "1.1 2.3.93"
@@ -3702,7 +3804,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "3c07da06bdd1689f9d07af78fb94d0ec", 3101},
{"resource.000", 0, "ecc686e0034fb4d41de077ac7167b3cf", 1947866},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
// The Island of Dr. Brain - English DOS Non-Interactive Demo
// SCI interpreter version 1.001.053 (just a guess)
@@ -3710,57 +3812,65 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a8e5ca8ed1996974afa59f4c45e06195", 986},
{"resource.000", 0, "b3acd9b9dd7fe53c4ee133ac9a1acfab", 586560},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#ifdef ENABLE_SCI32
// Torin's Passage - English Windows Interactive Demo
- // SCI interpreter version 2.100.002 (just a guess)
+ // SCI interpreter version 2.100.002
{"torin", "Demo", {
{"resmap.000", 0, "9a3e172cde9963d0a969f26469318cec", 3403},
{"ressci.000", 0, "db3e290481c35c3224e9602e71e4a1f1", 5073868},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
- // Torin's Passage - English Windows
- // SCI interpreter version 2.100.002 (just a guess)
+ // Torin's Passage (Multilingual) - English Windows CD
+ // SCI interpreter version 2.100.002
{"torin", "", {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
- // Torin's Passage - Spanish Windows (from jvprat)
+ // Torin's Passage (Multilingual) - Spanish Windows CD (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
{"torin", "", {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
// TODO: depend on one of the patches?
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
- // Torin's Passage - French Windows
- // SCI interpreter version 2.100.002 (just a guess)
+ // Torin's Passage (Multilingual) - French Windows CD
+ // SCI interpreter version 2.100.002
{"torin", "", {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
- // Torin's Passage - German Windows
- // SCI interpreter version 2.100.002 (just a guess)
+ // Torin's Passage (Multilingual) - German Windows CD
+ // SCI interpreter version 2.100.002
{"torin", "", {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+ Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
- // Torin's Passage - Italian Windows CD (from glorifindel)
- // SCI interpreter version 2.100.002 (just a guess)
+ // Torin's Passage (Multilingual) - Italian Windows CD (from glorifindel)
+ // SCI interpreter version 2.100.002
{"torin", "", {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
+ Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
+
+ // Torin's Passage - French Windows (from LePhilousophe)
+ // SCI interpreter version 2.100.002
+ {"torin", "", {
+ {"resmap.000", 0, "66ed46e3e56f487e688d52f05b33d0ba", 9787},
+ {"ressci.000", 0, "118f9bec04bfe17c4f87bbb5ddb43c18", 56126981},
+ AD_LISTEND},
+ Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
#endif // ENABLE_SCI32
// SCI Fanmade Games
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index b3cfee873c..22c0a1479d 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -26,6 +26,7 @@
#include "sci/engine/selector.h"
#include "sci/engine/vm.h"
+#include "common/config-manager.h"
#include "common/file.h"
namespace Sci {
@@ -42,6 +43,9 @@ GameFeatures::GameFeatures(SegManager *segMan, Kernel *kernel) : _segMan(segMan)
_sci2StringFunctionType = kSci2StringFunctionUninitialized;
#endif
_usesCdTrack = Common::File::exists("cdaudio.map");
+ if (!ConfMan.getBool("use_cdaudio"))
+ _usesCdTrack = false;
+ _forceDOSTracks = false;
}
reg_t GameFeatures::getDetectionAddr(const Common::String &objName, Selector slc, int methodNum) {
@@ -70,11 +74,11 @@ bool GameFeatures::autoDetectSoundType() {
// Look up the script address
reg_t addr = getDetectionAddr("Sound", SELECTOR(play));
- if (!addr.segment)
+ if (!addr.getSegment())
return false;
- uint16 offset = addr.offset;
- Script *script = _segMan->getScript(addr.segment);
+ uint16 offset = addr.getOffset();
+ Script *script = _segMan->getScript(addr.getSegment());
uint16 intParam = 0xFFFF;
bool foundTarget = false;
@@ -217,11 +221,11 @@ bool GameFeatures::autoDetectLofsType(Common::String gameSuperClassName, int met
// Look up the script address
reg_t addr = getDetectionAddr(gameSuperClassName.c_str(), -1, methodNum);
- if (!addr.segment)
+ if (!addr.getSegment())
return false;
- uint16 offset = addr.offset;
- Script *script = _segMan->getScript(addr.segment);
+ uint16 offset = addr.getOffset();
+ Script *script = _segMan->getScript(addr.getSegment());
while (true) {
int16 opparams[4];
@@ -316,11 +320,11 @@ bool GameFeatures::autoDetectGfxFunctionsType(int methodNum) {
// Look up the script address
reg_t addr = getDetectionAddr("Rm", SELECTOR(overlay), methodNum);
- if (!addr.segment)
+ if (!addr.getSegment())
return false;
- uint16 offset = addr.offset;
- Script *script = _segMan->getScript(addr.segment);
+ uint16 offset = addr.getOffset();
+ Script *script = _segMan->getScript(addr.getSegment());
while (true) {
int16 opparams[4];
@@ -470,11 +474,11 @@ bool GameFeatures::autoDetectSci21KernelType() {
// Look up the script address
reg_t addr = getDetectionAddr("Sound", SELECTOR(play));
- if (!addr.segment)
+ if (!addr.getSegment())
return false;
- uint16 offset = addr.offset;
- Script *script = _segMan->getScript(addr.segment);
+ uint16 offset = addr.getOffset();
+ Script *script = _segMan->getScript(addr.getSegment());
while (true) {
int16 opparams[4];
@@ -546,11 +550,11 @@ bool GameFeatures::autoDetectSci21StringFunctionType() {
// Look up the script address
reg_t addr = getDetectionAddr("Str", SELECTOR(size));
- if (!addr.segment)
+ if (!addr.getSegment())
return false;
- uint16 offset = addr.offset;
- Script *script = _segMan->getScript(addr.segment);
+ uint16 offset = addr.getOffset();
+ Script *script = _segMan->getScript(addr.getSegment());
while (true) {
int16 opparams[4];
@@ -583,11 +587,11 @@ bool GameFeatures::autoDetectMoveCountType() {
// Look up the script address
reg_t addr = getDetectionAddr("Motion", SELECTOR(doit));
- if (!addr.segment)
+ if (!addr.getSegment())
return false;
- uint16 offset = addr.offset;
- Script *script = _segMan->getScript(addr.segment);
+ uint16 offset = addr.getOffset();
+ Script *script = _segMan->getScript(addr.getSegment());
bool foundTarget = false;
while (true) {
@@ -639,7 +643,7 @@ MoveCountType GameFeatures::detectMoveCountType() {
}
bool GameFeatures::useAltWinGMSound() {
- if (g_sci && g_sci->getPlatform() == Common::kPlatformWindows && g_sci->isCD()) {
+ if (g_sci && g_sci->getPlatform() == Common::kPlatformWindows && g_sci->isCD() && !_forceDOSTracks) {
SciGameId id = g_sci->getGameId();
return (id == GID_ECOQUEST ||
id == GID_JONES ||
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index 4592c5be9c..f6bb0b5759 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -117,6 +117,12 @@ public:
*/
bool useAltWinGMSound();
+ /**
+ * Forces DOS soundtracks in Windows CD versions when the user hasn't
+ * selected a MIDI output device
+ */
+ void forceDOSTracks() { _forceDOSTracks = true; }
+
private:
reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);
@@ -137,6 +143,7 @@ private:
MoveCountType _moveCountType;
bool _usesCdTrack;
+ bool _forceDOSTracks;
SegManager *_segMan;
Kernel *_kernel;
diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
new file mode 100644
index 0000000000..3dc042389e
--- /dev/null
+++ b/engines/sci/engine/file.cpp
@@ -0,0 +1,464 @@
+/* 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/savefile.h"
+#include "common/stream.h"
+
+#include "sci/sci.h"
+#include "sci/engine/file.h"
+#include "sci/engine/kernel.h"
+#include "sci/engine/savegame.h"
+#include "sci/engine/selector.h"
+#include "sci/engine/state.h"
+
+namespace Sci {
+
+/*
+ * Note on how file I/O is implemented: In ScummVM, one can not create/write
+ * arbitrary data files, simply because many of our target platforms do not
+ * support this. The only files one can create are savestates. But SCI has an
+ * opcode to create and write to seemingly 'arbitrary' files. This is mainly
+ * used in LSL3 for LARRY3.DRV (which is a game data file, not a driver, used
+ * for persisting the results of the "age quiz" across restarts) and in LSL5
+ * for MEMORY.DRV (which is again a game data file and contains the game's
+ * password, XOR encrypted).
+ * To implement that opcode, we combine the SaveFileManager with regular file
+ * code, similarly to how the SCUMM HE engine does it.
+ *
+ * To handle opening a file called "foobar", what we do is this: First, we
+ * create an 'augmented file name', by prepending the game target and a dash,
+ * so if we running game target sq1sci, the name becomes "sq1sci-foobar".
+ * Next, we check if such a file is known to the SaveFileManager. If so, we
+ * we use that for reading/writing, delete it, whatever.
+ *
+ * If no such file is present but we were only asked to *read* the file,
+ * we fallback to looking for a regular file called "foobar", and open that
+ * for reading only.
+ */
+
+reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename) {
+ Common::String englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH);
+ englishName.toLowercase();
+
+ Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName;
+ Common::SeekableReadStream *inFile = 0;
+ Common::WriteStream *outFile = 0;
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+
+ bool isCompressed = true;
+ const SciGameId gameId = g_sci->getGameId();
+ if ((gameId == GID_QFG1 || gameId == GID_QFG1VGA || gameId == GID_QFG2 || gameId == GID_QFG3)
+ && englishName.hasSuffix(".sav")) {
+ // QFG Characters are saved via the CharSave object.
+ // We leave them uncompressed so that they can be imported in later QFG
+ // games.
+ // Rooms/Scripts: QFG1: 601, QFG2: 840, QFG3/4: 52
+ isCompressed = false;
+ }
+
+ if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
+ // Try to open file, abort if not possible
+ inFile = saveFileMan->openForLoading(wrappedName);
+ // If no matching savestate exists: fall back to reading from a regular
+ // file
+ if (!inFile)
+ inFile = SearchMan.createReadStreamForMember(englishName);
+
+ if (!inFile)
+ debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_OPEN_OR_FAIL): failed to open file '%s'", englishName.c_str());
+ } else if (mode == _K_FILE_MODE_CREATE) {
+ // Create the file, destroying any content it might have had
+ outFile = saveFileMan->openForSaving(wrappedName, isCompressed);
+ if (!outFile)
+ debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str());
+ } else if (mode == _K_FILE_MODE_OPEN_OR_CREATE) {
+ // Try to open file, create it if it doesn't exist
+ outFile = saveFileMan->openForSaving(wrappedName, isCompressed);
+ if (!outFile)
+ debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str());
+
+ // QfG1 opens the character export file with _K_FILE_MODE_CREATE first,
+ // closes it immediately and opens it again with this here. Perhaps
+ // other games use this for read access as well. I guess changing this
+ // whole code into using virtual files and writing them after close
+ // would be more appropriate.
+ } else {
+ error("file_open: unsupported mode %d (filename '%s')", mode, englishName.c_str());
+ }
+
+ if (!inFile && !outFile) { // Failed
+ debugC(kDebugLevelFile, " -> file_open() failed");
+ return SIGNAL_REG;
+ }
+
+ // Find a free file handle
+ uint handle = 1; // Ignore _fileHandles[0]
+ while ((handle < s->_fileHandles.size()) && s->_fileHandles[handle].isOpen())
+ handle++;
+
+ if (handle == s->_fileHandles.size()) {
+ // Hit size limit => Allocate more space
+ s->_fileHandles.resize(s->_fileHandles.size() + 1);
+ }
+
+ s->_fileHandles[handle]._in = inFile;
+ s->_fileHandles[handle]._out = outFile;
+ s->_fileHandles[handle]._name = englishName;
+
+ debugC(kDebugLevelFile, " -> opened file '%s' with handle %d", englishName.c_str(), handle);
+ return make_reg(0, handle);
+}
+
+FileHandle *getFileFromHandle(EngineState *s, uint handle) {
+ if (handle == 0 || handle == VIRTUALFILE_HANDLE) {
+ error("Attempt to use invalid file handle (%d)", handle);
+ return 0;
+ }
+
+ if ((handle >= s->_fileHandles.size()) || !s->_fileHandles[handle].isOpen()) {
+ warning("Attempt to use invalid/unused file handle %d", handle);
+ return 0;
+ }
+
+ return &s->_fileHandles[handle];
+}
+
+int fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle) {
+ FileHandle *f = getFileFromHandle(s, handle);
+ if (!f)
+ return 0;
+
+ if (!f->_in) {
+ error("fgets_wrapper: Trying to read from file '%s' opened for writing", f->_name.c_str());
+ return 0;
+ }
+ int readBytes = 0;
+ if (maxsize > 1) {
+ memset(dest, 0, maxsize);
+ f->_in->readLine(dest, maxsize);
+ readBytes = strlen(dest); // FIXME: sierra sci returned byte count and didn't react on NUL characters
+ // The returned string must not have an ending LF
+ if (readBytes > 0) {
+ if (dest[readBytes - 1] == 0x0A)
+ dest[readBytes - 1] = 0;
+ }
+ } else {
+ *dest = 0;
+ }
+
+ debugC(kDebugLevelFile, " -> FGets'ed \"%s\"", dest);
+ return readBytes;
+}
+
+static bool _savegame_sort_byDate(const SavegameDesc &l, const SavegameDesc &r) {
+ if (l.date != r.date)
+ return (l.date > r.date);
+ return (l.time > r.time);
+}
+
+// Create a sorted array containing all found savedgames
+void listSavegames(Common::Array<SavegameDesc> &saves) {
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+
+ // Load all saves
+ Common::StringArray saveNames = saveFileMan->listSavefiles(g_sci->getSavegamePattern());
+
+ for (Common::StringArray::const_iterator iter = saveNames.begin(); iter != saveNames.end(); ++iter) {
+ Common::String filename = *iter;
+ Common::SeekableReadStream *in;
+ if ((in = saveFileMan->openForLoading(filename))) {
+ SavegameMetadata meta;
+ if (!get_savegame_metadata(in, &meta) || meta.name.empty()) {
+ // invalid
+ delete in;
+ continue;
+ }
+ delete in;
+
+ SavegameDesc desc;
+ desc.id = strtol(filename.end() - 3, NULL, 10);
+ desc.date = meta.saveDate;
+ // We need to fix date in here, because we save DDMMYYYY instead of
+ // YYYYMMDD, so sorting wouldn't work
+ desc.date = ((desc.date & 0xFFFF) << 16) | ((desc.date & 0xFF0000) >> 8) | ((desc.date & 0xFF000000) >> 24);
+ desc.time = meta.saveTime;
+ desc.version = meta.version;
+
+ if (meta.name.lastChar() == '\n')
+ meta.name.deleteLastChar();
+
+ Common::strlcpy(desc.name, meta.name.c_str(), SCI_MAX_SAVENAME_LENGTH);
+
+ debug(3, "Savegame in file %s ok, id %d", filename.c_str(), desc.id);
+
+ saves.push_back(desc);
+ }
+ }
+
+ // Sort the list by creation date of the saves
+ Common::sort(saves.begin(), saves.end(), _savegame_sort_byDate);
+}
+
+// Find a savedgame according to virtualId and return the position within our array
+int findSavegame(Common::Array<SavegameDesc> &saves, int16 savegameId) {
+ for (uint saveNr = 0; saveNr < saves.size(); saveNr++) {
+ if (saves[saveNr].id == savegameId)
+ return saveNr;
+ }
+ return -1;
+}
+
+
+FileHandle::FileHandle() : _in(0), _out(0) {
+}
+
+FileHandle::~FileHandle() {
+ close();
+}
+
+void FileHandle::close() {
+ delete _in;
+ delete _out;
+ _in = 0;
+ _out = 0;
+ _name.clear();
+}
+
+bool FileHandle::isOpen() const {
+ return _in || _out;
+}
+
+
+void DirSeeker::addAsVirtualFiles(Common::String title, Common::String fileMask) {
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ Common::StringArray foundFiles = saveFileMan->listSavefiles(fileMask);
+ if (!foundFiles.empty()) {
+ _files.push_back(title);
+ _virtualFiles.push_back("");
+ Common::StringArray::iterator it;
+ Common::StringArray::iterator it_end = foundFiles.end();
+
+ for (it = foundFiles.begin(); it != it_end; it++) {
+ Common::String regularFilename = *it;
+ Common::String wrappedFilename = Common::String(regularFilename.c_str() + fileMask.size() - 1);
+
+ Common::SeekableReadStream *testfile = saveFileMan->openForLoading(regularFilename);
+ int32 testfileSize = testfile->size();
+ delete testfile;
+ if (testfileSize > 1024) // check, if larger than 1k. in that case its a saved game.
+ continue; // and we dont want to have those in the list
+ // We need to remove the prefix for display purposes
+ _files.push_back(wrappedFilename);
+ // but remember the actual name as well
+ _virtualFiles.push_back(regularFilename);
+ }
+ }
+}
+
+Common::String DirSeeker::getVirtualFilename(uint fileNumber) {
+ if (fileNumber >= _virtualFiles.size())
+ error("invalid virtual filename access");
+ return _virtualFiles[fileNumber];
+}
+
+reg_t DirSeeker::firstFile(const Common::String &mask, reg_t buffer, SegManager *segMan) {
+ // Verify that we are given a valid buffer
+ if (!buffer.getSegment()) {
+ error("DirSeeker::firstFile('%s') invoked with invalid buffer", mask.c_str());
+ return NULL_REG;
+ }
+ _outbuffer = buffer;
+ _files.clear();
+ _virtualFiles.clear();
+
+ int QfGImport = g_sci->inQfGImportRoom();
+ if (QfGImport) {
+ _files.clear();
+ addAsVirtualFiles("-QfG1-", "qfg1-*");
+ addAsVirtualFiles("-QfG1VGA-", "qfg1vga-*");
+ if (QfGImport > 2)
+ addAsVirtualFiles("-QfG2-", "qfg2-*");
+ if (QfGImport > 3)
+ addAsVirtualFiles("-QfG3-", "qfg3-*");
+
+ if (QfGImport == 3) {
+ // QfG3 sorts the filelisting itself, we can't let that happen otherwise our
+ // virtual list would go out-of-sync
+ reg_t savedHeros = segMan->findObjectByName("savedHeros");
+ if (!savedHeros.isNull())
+ writeSelectorValue(segMan, savedHeros, SELECTOR(sort), 0);
+ }
+
+ } else {
+ // Prefix the mask
+ const Common::String wrappedMask = g_sci->wrapFilename(mask);
+
+ // Obtain a list of all files matching the given mask
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ _files = saveFileMan->listSavefiles(wrappedMask);
+ }
+
+ // Reset the list iterator and write the first match to the output buffer,
+ // if any.
+ _iter = _files.begin();
+ return nextFile(segMan);
+}
+
+reg_t DirSeeker::nextFile(SegManager *segMan) {
+ if (_iter == _files.end()) {
+ return NULL_REG;
+ }
+
+ Common::String string;
+
+ if (_virtualFiles.empty()) {
+ // Strip the prefix, if we don't got a virtual filelisting
+ const Common::String wrappedString = *_iter;
+ string = g_sci->unwrapFilename(wrappedString);
+ } else {
+ string = *_iter;
+ }
+ if (string.size() > 12)
+ string = Common::String(string.c_str(), 12);
+ segMan->strcpy(_outbuffer, string.c_str());
+
+ // Return the result and advance the list iterator :)
+ ++_iter;
+ return _outbuffer;
+}
+
+
+#ifdef ENABLE_SCI32
+
+VirtualIndexFile::VirtualIndexFile(Common::String fileName) : _fileName(fileName), _changed(false) {
+ Common::SeekableReadStream *inFile = g_sci->getSaveFileManager()->openForLoading(fileName);
+
+ _bufferSize = inFile->size();
+ _buffer = new char[_bufferSize];
+ inFile->read(_buffer, _bufferSize);
+ _ptr = _buffer;
+ delete inFile;
+}
+
+VirtualIndexFile::VirtualIndexFile(uint32 initialSize) : _changed(false) {
+ _bufferSize = initialSize;
+ _buffer = new char[_bufferSize];
+ _ptr = _buffer;
+}
+
+VirtualIndexFile::~VirtualIndexFile() {
+ close();
+
+ _bufferSize = 0;
+ delete[] _buffer;
+ _buffer = 0;
+}
+
+uint32 VirtualIndexFile::read(char *buffer, uint32 size) {
+ uint32 curPos = _ptr - _buffer;
+ uint32 finalSize = MIN<uint32>(size, _bufferSize - curPos);
+ char *localPtr = buffer;
+
+ for (uint32 i = 0; i < finalSize; i++)
+ *localPtr++ = *_ptr++;
+
+ return finalSize;
+}
+
+uint32 VirtualIndexFile::write(const char *buffer, uint32 size) {
+ _changed = true;
+ uint32 curPos = _ptr - _buffer;
+
+ // Check if the buffer needs to be resized
+ if (curPos + size >= _bufferSize) {
+ _bufferSize = curPos + size + 1;
+ char *tmp = _buffer;
+ _buffer = new char[_bufferSize];
+ _ptr = _buffer + curPos;
+ memcpy(_buffer, tmp, _bufferSize);
+ delete[] tmp;
+ }
+
+ for (uint32 i = 0; i < size; i++)
+ *_ptr++ = *buffer++;
+
+ return size;
+}
+
+uint32 VirtualIndexFile::readLine(char *buffer, uint32 size) {
+ uint32 startPos = _ptr - _buffer;
+ uint32 bytesRead = 0;
+ char *localPtr = buffer;
+
+ // This is not a full-blown implementation of readLine, but it
+ // suffices for Phantasmagoria
+ while (startPos + bytesRead < size) {
+ bytesRead++;
+
+ if (*_ptr == 0 || *_ptr == 0x0A) {
+ _ptr++;
+ *localPtr = 0;
+ return bytesRead;
+ } else {
+ *localPtr++ = *_ptr++;
+ }
+ }
+
+ return bytesRead;
+}
+
+bool VirtualIndexFile::seek(int32 offset, int whence) {
+ uint32 startPos = _ptr - _buffer;
+ assert(offset >= 0);
+
+ switch (whence) {
+ case SEEK_CUR:
+ assert(startPos + offset < _bufferSize);
+ _ptr += offset;
+ break;
+ case SEEK_SET:
+ assert(offset < (int32)_bufferSize);
+ _ptr = _buffer + offset;
+ break;
+ case SEEK_END:
+ assert((int32)_bufferSize - offset >= 0);
+ _ptr = _buffer + (_bufferSize - offset);
+ break;
+ }
+
+ return true;
+}
+
+void VirtualIndexFile::close() {
+ if (_changed && !_fileName.empty()) {
+ Common::WriteStream *outFile = g_sci->getSaveFileManager()->openForSaving(_fileName);
+ outFile->write(_buffer, _bufferSize);
+ delete outFile;
+ }
+
+ // Maintain the buffer, and seek to the beginning of it
+ _ptr = _buffer;
+}
+
+#endif
+
+} // End of namespace Sci
diff --git a/engines/sci/engine/file.h b/engines/sci/engine/file.h
new file mode 100644
index 0000000000..1c8e302d15
--- /dev/null
+++ b/engines/sci/engine/file.h
@@ -0,0 +1,140 @@
+/* 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 SCI_ENGINE_FILE_H
+#define SCI_ENGINE_FILE_H
+
+#include "common/str-array.h"
+#include "common/stream.h"
+
+namespace Sci {
+
+enum {
+ _K_FILE_MODE_OPEN_OR_CREATE = 0,
+ _K_FILE_MODE_OPEN_OR_FAIL = 1,
+ _K_FILE_MODE_CREATE = 2
+};
+
+/* Maximum length of a savegame name (including terminator character). */
+#define SCI_MAX_SAVENAME_LENGTH 0x24
+
+enum {
+ MAX_SAVEGAME_NR = 20 /**< Maximum number of savegames */
+};
+
+#define VIRTUALFILE_HANDLE 200
+#define PHANTASMAGORIA_SAVEGAME_INDEX "phantsg.dir"
+
+struct SavegameDesc {
+ int16 id;
+ int virtualId; // straight numbered, according to id but w/o gaps
+ int date;
+ int time;
+ int version;
+ char name[SCI_MAX_SAVENAME_LENGTH];
+};
+
+class FileHandle {
+public:
+ Common::String _name;
+ Common::SeekableReadStream *_in;
+ Common::WriteStream *_out;
+
+public:
+ FileHandle();
+ ~FileHandle();
+
+ void close();
+ bool isOpen() const;
+};
+
+
+class DirSeeker {
+protected:
+ reg_t _outbuffer;
+ Common::StringArray _files;
+ Common::StringArray _virtualFiles;
+ Common::StringArray::const_iterator _iter;
+
+public:
+ DirSeeker() {
+ _outbuffer = NULL_REG;
+ _iter = _files.begin();
+ }
+
+ reg_t firstFile(const Common::String &mask, reg_t buffer, SegManager *segMan);
+ reg_t nextFile(SegManager *segMan);
+
+ Common::String getVirtualFilename(uint fileNumber);
+
+private:
+ void addAsVirtualFiles(Common::String title, Common::String fileMask);
+};
+
+
+#ifdef ENABLE_SCI32
+
+/**
+ * An implementation of a virtual file that supports basic read and write
+ * operations simultaneously.
+ *
+ * This class has been initially implemented for Phantasmagoria, which has its
+ * own custom save/load code. The load code keeps checking for the existence
+ * of the save index file and keeps closing and reopening it for each save
+ * slot. This is notoriously slow and clumsy, and introduces noticeable delays,
+ * especially for non-desktop systems. Also, its game scripts request to open
+ * the index file for reading and writing with the same parameters
+ * (SaveManager::setCurrentSave and SaveManager::getCurrentSave). Moreover,
+ * the game scripts reopen the index file for writing in order to update it
+ * and seek within it. We do not support seeking in writeable streams, and the
+ * fact that our saved games are ZIP files makes this operation even more
+ * expensive. Finally, the savegame index file is supposed to be expanded when
+ * a new save slot is added.
+ * For the aforementioned reasons, this class has been implemented, which offers
+ * the basic functionality needed by the game scripts in Phantasmagoria.
+ */
+class VirtualIndexFile {
+public:
+ VirtualIndexFile(Common::String fileName);
+ VirtualIndexFile(uint32 initialSize);
+ ~VirtualIndexFile();
+
+ uint32 read(char *buffer, uint32 size);
+ uint32 readLine(char *buffer, uint32 size);
+ uint32 write(const char *buffer, uint32 size);
+ bool seek(int32 offset, int whence);
+ void close();
+
+private:
+ char *_buffer;
+ uint32 _bufferSize;
+ char *_ptr;
+
+ Common::String _fileName;
+ bool _changed;
+};
+
+#endif
+
+} // End of namespace Sci
+
+#endif // SCI_ENGINE_FILE_H
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 2d71878bda..9a30ff3e17 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -47,7 +47,7 @@ const char *segmentTypeNames[] = {
#endif
void WorklistManager::push(reg_t reg) {
- if (!reg.segment) // No numbers
+ if (!reg.getSegment()) // No numbers
return;
debugC(kDebugLevelGC, "[GC] Adding %04x:%04x", PRINT_REG(reg));
@@ -69,7 +69,7 @@ static AddrSet *normalizeAddresses(SegManager *segMan, const AddrSet &nonnormal_
for (AddrSet::const_iterator i = nonnormal_map.begin(); i != nonnormal_map.end(); ++i) {
reg_t reg = i->_key;
- SegmentObj *mobj = segMan->getSegmentObj(reg.segment);
+ SegmentObj *mobj = segMan->getSegmentObj(reg.getSegment());
if (mobj) {
reg = mobj->findCanonicAddress(segMan, reg);
@@ -85,11 +85,11 @@ static void processWorkList(SegManager *segMan, WorklistManager &wm, const Commo
while (!wm._worklist.empty()) {
reg_t reg = wm._worklist.back();
wm._worklist.pop_back();
- if (reg.segment != stackSegment) { // No need to repeat this one
+ if (reg.getSegment() != stackSegment) { // No need to repeat this one
debugC(kDebugLevelGC, "[GC] Checking %04x:%04x", PRINT_REG(reg));
- if (reg.segment < heap.size() && heap[reg.segment]) {
+ if (reg.getSegment() < heap.size() && heap[reg.getSegment()]) {
// Valid heap object? Find its outgoing references!
- wm.pushArray(heap[reg.segment]->listAllOutgoingReferences(reg));
+ wm.pushArray(heap[reg.getSegment()]->listAllOutgoingReferences(reg));
}
}
}
diff --git a/engines/sci/engine/gc.h b/engines/sci/engine/gc.h
index 97aa6513b6..9e02bbd0bd 100644
--- a/engines/sci/engine/gc.h
+++ b/engines/sci/engine/gc.h
@@ -32,7 +32,7 @@ namespace Sci {
struct reg_t_Hash {
uint operator()(const reg_t& x) const {
- return (x.segment << 3) ^ x.offset ^ (x.offset << 16);
+ return (x.getSegment() << 3) ^ x.getOffset() ^ (x.getOffset() << 16);
}
};
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index c99bc4fe47..46051ef145 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -357,27 +357,27 @@ static uint16 *parseKernelSignature(const char *kernelName, const char *writtenS
uint16 Kernel::findRegType(reg_t reg) {
// No segment? Must be integer
- if (!reg.segment)
- return SIG_TYPE_INTEGER | (reg.offset ? 0 : SIG_TYPE_NULL);
+ if (!reg.getSegment())
+ return SIG_TYPE_INTEGER | (reg.getOffset() ? 0 : SIG_TYPE_NULL);
- if (reg.segment == 0xFFFF)
+ if (reg.getSegment() == 0xFFFF)
return SIG_TYPE_UNINITIALIZED;
// Otherwise it's an object
- SegmentObj *mobj = _segMan->getSegmentObj(reg.segment);
+ SegmentObj *mobj = _segMan->getSegmentObj(reg.getSegment());
if (!mobj)
return SIG_TYPE_ERROR;
uint16 result = 0;
- if (!mobj->isValidOffset(reg.offset))
+ if (!mobj->isValidOffset(reg.getOffset()))
result |= SIG_IS_INVALID;
switch (mobj->getType()) {
case SEG_TYPE_SCRIPT:
- if (reg.offset <= (*(Script *)mobj).getBufSize() &&
- reg.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET &&
- RAW_IS_OBJECT((*(Script *)mobj).getBuf(reg.offset)) ) {
- result |= ((Script *)mobj)->getObject(reg.offset) ? SIG_TYPE_OBJECT : SIG_TYPE_REFERENCE;
+ if (reg.getOffset() <= (*(Script *)mobj).getBufSize() &&
+ reg.getOffset() >= (uint)-SCRIPT_OBJECT_MAGIC_OFFSET &&
+ (*(Script *)mobj).offsetIsObject(reg.getOffset())) {
+ result |= ((Script *)mobj)->getObject(reg.getOffset()) ? SIG_TYPE_OBJECT : SIG_TYPE_REFERENCE;
} else
result |= SIG_TYPE_REFERENCE;
break;
@@ -608,7 +608,7 @@ void Kernel::mapFunctions() {
_kernelFuncs[id].workarounds = kernelMap->workarounds;
if (kernelMap->subFunctions) {
// Get version for subfunction identification
- SciVersion mySubVersion = (SciVersion)kernelMap->function(NULL, 0, NULL).offset;
+ SciVersion mySubVersion = (SciVersion)kernelMap->function(NULL, 0, NULL).getOffset();
// Now check whats the highest subfunction-id for this version
const SciKernelMapSubEntry *kernelSubMap = kernelMap->subFunctions;
uint16 subFunctionCount = 0;
@@ -757,13 +757,26 @@ bool Kernel::debugSetFunction(const char *kernelName, int logging, int breakpoin
return true;
}
-void Kernel::setDefaultKernelNames(GameFeatures *features) {
- _kernelNames = Common::StringArray(s_defaultKernelNames, ARRAYSIZE(s_defaultKernelNames));
+#ifdef ENABLE_SCI32
+enum {
+ kKernelEntriesSci2 = 0x8b,
+ kKernelEntriesGk2Demo = 0xa0,
+ kKernelEntriesSci21 = 0x9d,
+ kKernelEntriesSci3 = 0xa1
+};
+#endif
+
+void Kernel::loadKernelNames(GameFeatures *features) {
+ _kernelNames.clear();
- // Some (later) SCI versions replaced CanBeHere by CantBeHere
- // If vocab.999 exists, the kernel function is still named CanBeHere
- if (_selectorCache.cantBeHere != -1)
- _kernelNames[0x4d] = "CantBeHere";
+ if (getSciVersion() <= SCI_VERSION_1_1) {
+ _kernelNames = Common::StringArray(s_defaultKernelNames, ARRAYSIZE(s_defaultKernelNames));
+
+ // Some (later) SCI versions replaced CanBeHere by CantBeHere
+ // If vocab.999 exists, the kernel function is still named CanBeHere
+ if (_selectorCache.cantBeHere != -1)
+ _kernelNames[0x4d] = "CantBeHere";
+ }
switch (getSciVersion()) {
case SCI_VERSION_0_EARLY:
@@ -817,66 +830,60 @@ void Kernel::setDefaultKernelNames(GameFeatures *features) {
_kernelNames[0x7c] = "Message";
break;
- default:
- // Use default table for the other versions
- break;
- }
-}
-
#ifdef ENABLE_SCI32
+ case SCI_VERSION_2:
+ _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2);
+ break;
-enum {
- kKernelEntriesSci2 = 0x8b,
- kKernelEntriesGk2Demo = 0xa0,
- kKernelEntriesSci21 = 0x9d,
- kKernelEntriesSci3 = 0xa1
-};
-
-void Kernel::setKernelNamesSci2() {
- _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2);
-}
+ case SCI_VERSION_2_1:
+ if (features->detectSci21KernelType() == SCI_VERSION_2) {
+ // Some early SCI2.1 games use a modified SCI2 kernel table instead of
+ // the SCI2.1 kernel table. We detect which version to use based on
+ // how kDoSound is called from Sound::play().
+ // Known games that use this:
+ // GK2 demo
+ // KQ7 1.4
+ // PQ4 SWAT demo
+ // LSL6
+ // PQ4CD
+ // QFG4CD
+
+ // This is interesting because they all have the same interpreter
+ // version (2.100.002), yet they would not be compatible with other
+ // games of the same interpreter.
+
+ _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo);
+ // OnMe is IsOnMe here, but they should be compatible
+ _kernelNames[0x23] = "Robot"; // Graph in SCI2
+ _kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2
+ } else {
+ // Normal SCI2.1 kernel table
+ _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21);
+ }
+ break;
-void Kernel::setKernelNamesSci21(GameFeatures *features) {
- // Some SCI games use a modified SCI2 kernel table instead of the
- // SCI2.1 kernel table. We detect which version to use based on
- // how kDoSound is called from Sound::play().
- // Known games that use this:
- // GK2 demo
- // KQ7 1.4
- // PQ4 SWAT demo
- // LSL6
- // PQ4CD
- // QFG4CD
-
- // This is interesting because they all have the same interpreter
- // version (2.100.002), yet they would not be compatible with other
- // games of the same interpreter.
-
- if (getSciVersion() != SCI_VERSION_3 && features->detectSci21KernelType() == SCI_VERSION_2) {
- _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo);
- // OnMe is IsOnMe here, but they should be compatible
- _kernelNames[0x23] = "Robot"; // Graph in SCI2
- _kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2
- } else if (getSciVersion() != SCI_VERSION_3) {
- _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21);
- } else if (getSciVersion() == SCI_VERSION_3) {
+ case SCI_VERSION_3:
_kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci3);
- }
-}
-#endif
-
-void Kernel::loadKernelNames(GameFeatures *features) {
- _kernelNames.clear();
+ // In SCI3, some kernel functions have been removed, and others have been added
+ _kernelNames[0x18] = "Dummy"; // AddMagnify in SCI2.1
+ _kernelNames[0x19] = "Dummy"; // DeleteMagnify in SCI2.1
+ _kernelNames[0x30] = "Dummy"; // SetScroll in SCI2.1
+ _kernelNames[0x39] = "Dummy"; // ShowMovie in SCI2.1
+ _kernelNames[0x4c] = "Dummy"; // ScrollWindow in SCI2.1
+ _kernelNames[0x56] = "Dummy"; // VibrateMouse in SCI2.1 (only used in QFG4 floppy)
+ _kernelNames[0x64] = "Dummy"; // AvoidPath in SCI2.1
+ _kernelNames[0x66] = "Dummy"; // MergePoly in SCI2.1
+ _kernelNames[0x8d] = "MessageBox"; // Dummy in SCI2.1
+ _kernelNames[0x9b] = "Minimize"; // Dummy in SCI2.1
-#ifdef ENABLE_SCI32
- if (getSciVersion() >= SCI_VERSION_2_1)
- setKernelNamesSci21(features);
- else if (getSciVersion() == SCI_VERSION_2)
- setKernelNamesSci2();
- else
+ break;
#endif
- setDefaultKernelNames(features);
+
+ default:
+ // Use default table for the other versions
+ break;
+ }
mapFunctions();
}
@@ -885,15 +892,15 @@ Common::String Kernel::lookupText(reg_t address, int index) {
char *seeker;
Resource *textres;
- if (address.segment)
+ if (address.getSegment())
return _segMan->getString(address);
int textlen;
int _index = index;
- textres = _resMan->findResource(ResourceId(kResourceTypeText, address.offset), 0);
+ textres = _resMan->findResource(ResourceId(kResourceTypeText, address.getOffset()), 0);
if (!textres) {
- error("text.%03d not found", address.offset);
+ error("text.%03d not found", address.getOffset());
return NULL; /* Will probably segfault */
}
@@ -907,7 +914,7 @@ Common::String Kernel::lookupText(reg_t address, int index) {
if (textlen)
return seeker;
- error("Index %d out of bounds in text.%03d", _index, address.offset);
+ error("Index %d out of bounds in text.%03d", _index, address.getOffset());
return NULL;
}
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index e549c1f8ae..f985a69ebc 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -224,23 +224,6 @@ public:
private:
/**
- * Sets the default kernel function names, based on the SCI version used.
- */
- void setDefaultKernelNames(GameFeatures *features);
-
-#ifdef ENABLE_SCI32
- /**
- * Sets the default kernel function names to the SCI2 kernel functions.
- */
- void setKernelNamesSci2();
-
- /**
- * Sets the default kernel function names to the SCI2.1 kernel functions.
- */
- void setKernelNamesSci21(GameFeatures *features);
-#endif
-
- /**
* Loads the kernel selector names.
*/
void loadSelectorNames();
@@ -276,9 +259,6 @@ private:
const Common::String _invalid;
};
-/* Maximum length of a savegame name (including terminator character). */
-#define SCI_MAX_SAVENAME_LENGTH 0x24
-
/******************** Kernel functions ********************/
reg_t kStrLen(EngineState *s, int argc, reg_t *argv);
@@ -326,10 +306,6 @@ reg_t kTimesCot(EngineState *s, int argc, reg_t *argv);
reg_t kCosDiv(EngineState *s, int argc, reg_t *argv);
reg_t kSinDiv(EngineState *s, int argc, reg_t *argv);
reg_t kValidPath(EngineState *s, int argc, reg_t *argv);
-reg_t kFOpen(EngineState *s, int argc, reg_t *argv);
-reg_t kFPuts(EngineState *s, int argc, reg_t *argv);
-reg_t kFGets(EngineState *s, int argc, reg_t *argv);
-reg_t kFClose(EngineState *s, int argc, reg_t *argv);
reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv);
reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv);
reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv);
@@ -436,6 +412,7 @@ reg_t kListAt(EngineState *s, int argc, reg_t *argv);
reg_t kString(EngineState *s, int argc, reg_t *argv);
reg_t kMulDiv(EngineState *s, int argc, reg_t *argv);
reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv);
+reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv);
// "Screen items" in SCI32 are views
reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv);
reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv);
@@ -458,10 +435,15 @@ reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv);
reg_t kInPolygon(EngineState *s, int argc, reg_t *argv);
reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv);
reg_t kEditText(EngineState *s, int argc, reg_t *argv);
+reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv);
+reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv);
+reg_t kSetScroll(EngineState *s, int argc, reg_t *argv);
+reg_t kPalCycle(EngineState *s, int argc, reg_t *argv);
// SCI2.1 Kernel Functions
reg_t kText(EngineState *s, int argc, reg_t *argv);
reg_t kSave(EngineState *s, int argc, reg_t *argv);
+reg_t kAutoSave(EngineState *s, int argc, reg_t *argv);
reg_t kList(EngineState *s, int argc, reg_t *argv);
reg_t kRobot(EngineState *s, int argc, reg_t *argv);
reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv);
@@ -473,12 +455,16 @@ reg_t kMoveToEnd(EngineState *s, int argc, reg_t *argv);
reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv);
reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
reg_t kGetConfig(EngineState *s, int argc, reg_t *argv);
+reg_t kGetSierraProfileInt(EngineState *s, int argc, reg_t *argv);
reg_t kCelInfo(EngineState *s, int argc, reg_t *argv);
reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv);
reg_t kFont(EngineState *s, int argc, reg_t *argv);
reg_t kBitmap(EngineState *s, int argc, reg_t *argv);
+reg_t kAddLine(EngineState *s, int argc, reg_t *argv);
+reg_t kUpdateLine(EngineState *s, int argc, reg_t *argv);
+reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv);
// SCI3 Kernel functions
reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv);
@@ -556,6 +542,7 @@ reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv);
+reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv);
#endif
//@}
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 622511c906..b6b36c47e7 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -239,12 +239,27 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
{ SIG_SCI32, 15, MAP_CALL(FileIOReadWord), "i", NULL },
{ SIG_SCI32, 16, MAP_CALL(FileIOWriteWord), "ii", NULL },
{ SIG_SCI32, 17, MAP_CALL(FileIOCreateSaveSlot), "ir", NULL },
- { SIG_SCI32, 19, MAP_CALL(Stub), "r", NULL }, // for Torin / Torin demo
+ { SIG_SCI32, 18, MAP_EMPTY(FileIOChangeDirectory), "r", NULL }, // for SQ6, when changing the savegame directory in the save/load dialog
+ { SIG_SCI32, 19, MAP_CALL(FileIOIsValidDirectory), "r", NULL }, // for Torin / Torin demo
#endif
SCI_SUBOPENTRY_TERMINATOR
};
#ifdef ENABLE_SCI32
+
+static const SciKernelMapSubEntry kSave_subops[] = {
+ { SIG_SCI32, 0, MAP_CALL(SaveGame), "[r0]i[r0](r0)", NULL },
+ { SIG_SCI32, 1, MAP_CALL(RestoreGame), "[r0]i[r0]", NULL },
+ { SIG_SCI32, 2, MAP_CALL(GetSaveDir), "(r*)", NULL },
+ { SIG_SCI32, 3, MAP_CALL(CheckSaveGame), ".*", NULL },
+ // Subop 4 hasn't been encountered yet
+ { SIG_SCI32, 5, MAP_CALL(GetSaveFiles), "rrr", NULL },
+ { SIG_SCI32, 6, MAP_CALL(MakeSaveCatName), "rr", NULL },
+ { SIG_SCI32, 7, MAP_CALL(MakeSaveFileName), "rri", NULL },
+ { SIG_SCI32, 8, MAP_CALL(AutoSave), "[o0]", NULL },
+ SCI_SUBOPENTRY_TERMINATOR
+};
+
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kList_subops[] = {
{ SIG_SCI21, 0, MAP_CALL(NewList), "", NULL },
@@ -337,10 +352,10 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(EditControl), SIG_EVERYWHERE, "[o0][o0]", NULL, NULL },
{ MAP_CALL(Empty), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(EmptyList), SIG_EVERYWHERE, "l", NULL, NULL },
- { MAP_CALL(FClose), SIG_EVERYWHERE, "i", NULL, NULL },
- { MAP_CALL(FGets), SIG_EVERYWHERE, "rii", NULL, NULL },
- { MAP_CALL(FOpen), SIG_EVERYWHERE, "ri", NULL, NULL },
- { MAP_CALL(FPuts), SIG_EVERYWHERE, "ir", NULL, NULL },
+ { "FClose", kFileIOClose, SIG_EVERYWHERE, "i", NULL, NULL },
+ { "FGets", kFileIOReadString, SIG_EVERYWHERE, "rii", NULL, NULL },
+ { "FOpen", kFileIOOpen, SIG_EVERYWHERE, "ri", NULL, NULL },
+ { "FPuts", kFileIOWriteString, SIG_EVERYWHERE, "ir", NULL, NULL },
{ MAP_CALL(FileIO), SIG_EVERYWHERE, "i(.*)", kFileIO_subops, NULL },
{ MAP_CALL(FindKey), SIG_EVERYWHERE, "l.", NULL, kFindKey_workarounds },
{ MAP_CALL(FirstNode), SIG_EVERYWHERE, "[l0]", NULL, NULL },
@@ -404,7 +419,10 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(PriCoord), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(Random), SIG_EVERYWHERE, "i(i)(i)", NULL, NULL },
{ MAP_CALL(ReadNumber), SIG_EVERYWHERE, "r", NULL, NULL },
- { MAP_CALL(RemapColors), SIG_EVERYWHERE, "i(i)(i)(i)(i)(i)", NULL, NULL },
+ { MAP_CALL(RemapColors), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(i)", NULL, NULL },
+#ifdef ENABLE_SCI32
+ { "RemapColors", kRemapColors32, SIG_SCI32, SIGFOR_ALL, "i(i)(i)(i)(i)(i)", NULL, NULL },
+#endif
{ MAP_CALL(ResCheck), SIG_EVERYWHERE, "ii(iiii)", NULL, NULL },
{ MAP_CALL(RespondsTo), SIG_EVERYWHERE, ".i", NULL, NULL },
{ MAP_CALL(RestartGame), SIG_EVERYWHERE, "", NULL, NULL },
@@ -500,29 +518,23 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(UpdateScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(ObjectIntersect), SIG_EVERYWHERE, "oo", NULL, NULL },
{ MAP_CALL(EditText), SIG_EVERYWHERE, "o", NULL, NULL },
-
- // SCI2 unmapped functions - TODO!
-
- // SetScroll - called by script 64909, Styler::doit()
- // PalCycle - called by Game::newRoom. Related to RemapColors.
- // VibrateMouse - used in QFG4
+ { MAP_CALL(MakeSaveCatName), SIG_EVERYWHERE, "rr", NULL, NULL },
+ { MAP_CALL(MakeSaveFileName), SIG_EVERYWHERE, "rri", NULL, NULL },
+ { MAP_CALL(SetScroll), SIG_EVERYWHERE, "oiiiii(i)", NULL, NULL },
+ { MAP_CALL(PalCycle), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
// SCI2 Empty functions
-
+
// Debug function used to track resources
{ MAP_EMPTY(ResourceTrack), SIG_EVERYWHERE, "(.*)", NULL, NULL },
-
- // SCI2 functions that are used in the original save/load menus. Marked as dummy, so
- // that the engine errors out on purpose. TODO: Implement once the original save/load
- // menus are implemented.
-
- // Creates the name of the save catalogue/directory to save into.
- // TODO: Implement once the original save/load menus are implemented.
- { MAP_DUMMY(MakeSaveCatName), SIG_EVERYWHERE, "(.*)", NULL, NULL },
-
- // Creates the name of the save file to save into
- // TODO: Implement once the original save/load menus are implemented.
- { MAP_DUMMY(MakeSaveFileName), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ // Future TODO: This call is used in the floppy version of QFG4 to add
+ // vibration to exotic mice with force feedback, such as the Logitech
+ // Cyberman and Wingman mice. Since this is only used for very exotic
+ // hardware and we have no direct and cross-platform way of communicating
+ // with them via SDL, plus we would probably need to make changes to common
+ // code, this call is mapped to an empty function for now as it's a rare
+ // feature not worth the effort.
+ { MAP_EMPTY(VibrateMouse), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// Unused / debug SCI2 unused functions, always mapped to kDummy
@@ -549,6 +561,11 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_DUMMY(InputText), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_DUMMY(TextWidth), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_DUMMY(PointSize), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ // SetScroll is called by script 64909, Styler::doit(), but it doesn't seem to
+ // be used at all (plus, it was then changed to a dummy function in SCI3).
+ // Since this is most likely unused, and we got no test case, error out when
+ // it is called in order to find an actual call to it.
+ { MAP_DUMMY(SetScroll), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// SCI2.1 Kernel Functions
{ MAP_CALL(CD), SIG_EVERYWHERE, "(.*)", NULL, NULL },
@@ -557,18 +574,22 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(MulDiv), SIG_EVERYWHERE, "iii", NULL, NULL },
{ MAP_CALL(PlayVMD), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(Robot), SIG_EVERYWHERE, "(.*)", NULL, NULL },
- { MAP_CALL(Save), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(Save), SIG_EVERYWHERE, "i(.*)", kSave_subops, NULL },
{ MAP_CALL(Text), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(AddPicAt), SIG_EVERYWHERE, "oiii", NULL, NULL },
{ MAP_CALL(GetWindowsOption), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(WinHelp), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(GetConfig), SIG_EVERYWHERE, "ro", NULL, NULL },
+ { MAP_CALL(GetSierraProfileInt), SIG_EVERYWHERE, "rri", NULL, NULL },
{ MAP_CALL(CelInfo), SIG_EVERYWHERE, "iiiiii", NULL, NULL },
{ MAP_CALL(SetLanguage), SIG_EVERYWHERE, "r", NULL, NULL },
- { MAP_CALL(ScrollWindow), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(ScrollWindow), SIG_EVERYWHERE, "io(.*)", NULL, NULL },
{ MAP_CALL(SetFontRes), SIG_EVERYWHERE, "ii", NULL, NULL },
{ MAP_CALL(Font), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
{ MAP_CALL(Bitmap), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(AddLine), SIG_EVERYWHERE, "oiiiiiiiii", NULL, NULL },
+ { MAP_CALL(UpdateLine), SIG_EVERYWHERE, "[r0]oiiiiiiiii", NULL, NULL },
+ { MAP_CALL(DeleteLine), SIG_EVERYWHERE, "[r0]o", NULL, NULL },
// SCI2.1 Empty Functions
@@ -582,11 +603,6 @@ static SciKernelMapEntry s_kernelMap[] = {
// the game window in Phantasmagoria 2. We ignore these settings completely.
{ MAP_EMPTY(SetWindowsOption), SIG_EVERYWHERE, "ii", NULL, NULL },
- // Used by the Windows version of Phantasmagoria 1 to get the video speed setting. This is called after
- // kGetConfig and overrides the setting obtained by it. It is a dummy function in the DOS Version. We can
- // just use GetConfig and mark this one as empty, like the DOS version does.
- { MAP_EMPTY(GetSierraProfileInt), SIG_EVERYWHERE, "(.*)", NULL, NULL },
-
// Debug function called whenever the current room changes
{ MAP_EMPTY(NewRoom), SIG_EVERYWHERE, "(.*)", NULL, NULL },
@@ -618,14 +634,14 @@ static SciKernelMapEntry s_kernelMap[] = {
// SCI2.1 unmapped functions - TODO!
+ // SetHotRectangles - used by Phantasmagoria 1, script 64981 (used in the chase scene)
+ // <lskovlun> The idea, if I understand correctly, is that the engine generates events
+ // of a special HotRect type continuously when the mouse is on that rectangle
+
// MovePlaneItems - used by SQ6 to scroll through the inventory via the up/down buttons
- // AddLine - used by Torin's Passage to highlight the chapter buttons
- // DeleteLine - used by Torin's Passage to delete the highlight from the chapter buttons
- // UpdateLine - used by LSL6
// SetPalStyleRange - 2 integer parameters, start and end. All styles from start-end
// (inclusive) are set to 0
// MorphOn - used by SQ6, script 900, the datacorder reprogramming puzzle (from room 270)
- // SetHotRectangles - used by Phantasmagoria 1
// SCI3 Kernel Functions
{ MAP_CALL(PlayDuck), SIG_EVERYWHERE, "(.*)", NULL, NULL },
@@ -820,7 +836,7 @@ static const char *const sci2_default_knames[] = {
/*0x20*/ "AddMagnify",
/*0x21*/ "DeleteMagnify",
/*0x22*/ "IsHiRes",
- /*0x23*/ "Graph",
+ /*0x23*/ "Graph", // Robot in early SCI2.1 games with a SCI2 kernel table
/*0x24*/ "InvertRect", // only in SCI2, not used in any SCI2 game
/*0x25*/ "TextSize",
/*0x26*/ "Message",
@@ -831,7 +847,7 @@ static const char *const sci2_default_knames[] = {
/*0x2b*/ "EditText",
/*0x2c*/ "InputText", // unused function
/*0x2d*/ "CreateTextBitmap",
- /*0x2e*/ "DisposeTextBitmap",
+ /*0x2e*/ "DisposeTextBitmap", // Priority in early SCI2.1 games with a SCI2 kernel table
/*0x2f*/ "GetEvent",
/*0x30*/ "GlobalToLocal",
/*0x31*/ "LocalToGlobal",
@@ -1091,7 +1107,7 @@ static const char *const sci21_default_knames[] = {
/*0x8a*/ "LoadChunk",
/*0x8b*/ "SetPalStyleRange",
/*0x8c*/ "AddPicAt",
- /*0x8d*/ "MessageBox", // SCI3, was Dummy in SCI2.1
+ /*0x8d*/ "Dummy", // MessageBox in SCI3
/*0x8e*/ "NewRoom", // debug function
/*0x8f*/ "Dummy",
/*0x90*/ "Priority",
@@ -1105,7 +1121,7 @@ static const char *const sci21_default_knames[] = {
/*0x98*/ "GetWindowsOption", // Windows only
/*0x99*/ "WinDLL", // Windows only
/*0x9a*/ "Dummy",
- /*0x9b*/ "Minimize", // SCI3, was Dummy in SCI2.1
+ /*0x9b*/ "Dummy", // Minimize in SCI3
/*0x9c*/ "DeletePic",
// == SCI3 only ===============
/*0x9d*/ "Dummy",
@@ -1119,57 +1135,73 @@ static const char *const sci21_default_knames[] = {
// Base set of opcode formats. They're copied and adjusted slightly in
// script_adjust_opcode_format depending on SCI version.
static const opcode_format g_base_opcode_formats[128][4] = {
- /*00*/
+ // 00 - 03 / bnot, add, sub, mul
{Script_None}, {Script_None}, {Script_None}, {Script_None},
- /*04*/
+ // 04 - 07 / div, mod, shr, shl
{Script_None}, {Script_None}, {Script_None}, {Script_None},
- /*08*/
+ // 08 - 0B / xor, and, or, neg
{Script_None}, {Script_None}, {Script_None}, {Script_None},
- /*0C*/
+ // 0C - 0F / not, eq, ne, gt
{Script_None}, {Script_None}, {Script_None}, {Script_None},
- /*10*/
+ // 10 - 13 / ge, lt, le, ugt
{Script_None}, {Script_None}, {Script_None}, {Script_None},
- /*14*/
+ // 14 - 17 / uge, ult, ule, bt
{Script_None}, {Script_None}, {Script_None}, {Script_SRelative},
- /*18*/
+ // 18 - 1B / bnt, jmp, ldi, push
{Script_SRelative}, {Script_SRelative}, {Script_SVariable}, {Script_None},
- /*1C*/
+ // 1C - 1F / pushi, toss, dup, link
{Script_SVariable}, {Script_None}, {Script_None}, {Script_Variable},
- /*20*/
+ // 20 - 23 / call, callk, callb, calle
{Script_SRelative, Script_Byte}, {Script_Variable, Script_Byte}, {Script_Variable, Script_Byte}, {Script_Variable, Script_SVariable, Script_Byte},
- /*24 (24=ret)*/
+ // 24 - 27 / ret, send, dummy, dummy
{Script_End}, {Script_Byte}, {Script_Invalid}, {Script_Invalid},
- /*28*/
+ // 28 - 2B / class, dummy, self, super
{Script_Variable}, {Script_Invalid}, {Script_Byte}, {Script_Variable, Script_Byte},
- /*2C*/
+ // 2C - 2F / rest, lea, selfID, dummy
{Script_SVariable}, {Script_SVariable, Script_Variable}, {Script_None}, {Script_Invalid},
- /*30*/
+ // 30 - 33 / pprev, pToa, aTop, pTos
{Script_None}, {Script_Property}, {Script_Property}, {Script_Property},
- /*34*/
+ // 34 - 37 / sTop, ipToa, dpToa, ipTos
{Script_Property}, {Script_Property}, {Script_Property}, {Script_Property},
- /*38*/
+ // 38 - 3B / dpTos, lofsa, lofss, push0
{Script_Property}, {Script_SRelative}, {Script_SRelative}, {Script_None},
- /*3C*/
+ // 3C - 3F / push1, push2, pushSelf, line
{Script_None}, {Script_None}, {Script_None}, {Script_Word},
- /*40-4F*/
+ // ------------------------------------------------------------------------
+ // 40 - 43 / lag, lal, lat, lap
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 44 - 47 / lsg, lsl, lst, lsp
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 48 - 4B / lagi, lali, lati, lapi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 4C - 4F / lsgi, lsli, lsti, lspi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
- /*50-5F*/
+ // ------------------------------------------------------------------------
+ // 50 - 53 / sag, sal, sat, sap
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 54 - 57 / ssg, ssl, sst, ssp
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 58 - 5B / sagi, sali, sati, sapi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 5C - 5F / ssgi, ssli, ssti, sspi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
- /*60-6F*/
+ // ------------------------------------------------------------------------
+ // 60 - 63 / plusag, plusal, plusat, plusap
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 64 - 67 / plussg, plussl, plusst, plussp
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 68 - 6B / plusagi, plusali, plusati, plusapi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 6C - 6F / plussgi, plussli, plussti, plusspi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
- /*70-7F*/
+ // ------------------------------------------------------------------------
+ // 70 - 73 / minusag, minusal, minusat, minusap
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 74 - 77 / minussg, minussl, minusst, minussp
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 78 - 7B / minusagi, minusali, minusati, minusapi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param},
+ // 7C - 7F / minussgi, minussli, minussti, minusspi
{Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}
};
#undef END
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index df3b3efd57..34477cc23b 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -157,7 +157,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
s->r_acc = NULL_REG;
}
- if ((s->r_acc.offset) && (g_sci->_debugState.stopOnEvent)) {
+ if ((s->r_acc.getOffset()) && (g_sci->_debugState.stopOnEvent)) {
g_sci->_debugState.stopOnEvent = false;
// A SCI event occurred, and we have been asked to stop, so open the debug console
@@ -248,7 +248,7 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
SegManager *segMan = s->_segMan;
- if (obj.segment) {
+ if (obj.getSegment()) {
int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
@@ -267,7 +267,7 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
SegManager *segMan = s->_segMan;
- if (obj.segment) {
+ if (obj.getSegment()) {
int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 312497720a..e977f15c0c 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -33,6 +33,7 @@
#include "gui/saveload.h"
#include "sci/sci.h"
+#include "sci/engine/file.h"
#include "sci/engine/state.h"
#include "sci/engine/kernel.h"
#include "sci/engine/savegame.h"
@@ -40,209 +41,11 @@
namespace Sci {
-struct SavegameDesc {
- int16 id;
- int virtualId; // straight numbered, according to id but w/o gaps
- int date;
- int time;
- int version;
- char name[SCI_MAX_SAVENAME_LENGTH];
-};
-
-/*
- * Note on how file I/O is implemented: In ScummVM, one can not create/write
- * arbitrary data files, simply because many of our target platforms do not
- * support this. The only files one can create are savestates. But SCI has an
- * opcode to create and write to seemingly 'arbitrary' files. This is mainly
- * used in LSL3 for LARRY3.DRV (which is a game data file, not a driver, used
- * for persisting the results of the "age quiz" across restarts) and in LSL5
- * for MEMORY.DRV (which is again a game data file and contains the game's
- * password, XOR encrypted).
- * To implement that opcode, we combine the SaveFileManager with regular file
- * code, similarly to how the SCUMM HE engine does it.
- *
- * To handle opening a file called "foobar", what we do is this: First, we
- * create an 'augmented file name', by prepending the game target and a dash,
- * so if we running game target sq1sci, the name becomes "sq1sci-foobar".
- * Next, we check if such a file is known to the SaveFileManager. If so, we
- * we use that for reading/writing, delete it, whatever.
- *
- * If no such file is present but we were only asked to *read* the file,
- * we fallback to looking for a regular file called "foobar", and open that
- * for reading only.
- */
-
-
-
-FileHandle::FileHandle() : _in(0), _out(0) {
-}
-
-FileHandle::~FileHandle() {
- close();
-}
-
-void FileHandle::close() {
- delete _in;
- delete _out;
- _in = 0;
- _out = 0;
- _name.clear();
-}
-
-bool FileHandle::isOpen() const {
- return _in || _out;
-}
-
-
-
-enum {
- _K_FILE_MODE_OPEN_OR_CREATE = 0,
- _K_FILE_MODE_OPEN_OR_FAIL = 1,
- _K_FILE_MODE_CREATE = 2
-};
-
-
-
-reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename) {
- Common::String englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH);
- Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName;
- Common::SeekableReadStream *inFile = 0;
- Common::WriteStream *outFile = 0;
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
-
- if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
- // Try to open file, abort if not possible
- inFile = saveFileMan->openForLoading(wrappedName);
- // If no matching savestate exists: fall back to reading from a regular
- // file
- if (!inFile)
- inFile = SearchMan.createReadStreamForMember(englishName);
-
- if (!inFile)
- debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_OPEN_OR_FAIL): failed to open file '%s'", englishName.c_str());
- } else if (mode == _K_FILE_MODE_CREATE) {
- // Create the file, destroying any content it might have had
- outFile = saveFileMan->openForSaving(wrappedName);
- if (!outFile)
- debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str());
- } else if (mode == _K_FILE_MODE_OPEN_OR_CREATE) {
- // Try to open file, create it if it doesn't exist
- outFile = saveFileMan->openForSaving(wrappedName);
- if (!outFile)
- debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str());
- // QfG1 opens the character export file with _K_FILE_MODE_CREATE first,
- // closes it immediately and opens it again with this here. Perhaps
- // other games use this for read access as well. I guess changing this
- // whole code into using virtual files and writing them after close
- // would be more appropriate.
- } else {
- error("file_open: unsupported mode %d (filename '%s')", mode, englishName.c_str());
- }
-
- if (!inFile && !outFile) { // Failed
- debugC(kDebugLevelFile, " -> file_open() failed");
- return SIGNAL_REG;
- }
-
- // Find a free file handle
- uint handle = 1; // Ignore _fileHandles[0]
- while ((handle < s->_fileHandles.size()) && s->_fileHandles[handle].isOpen())
- handle++;
-
- if (handle == s->_fileHandles.size()) {
- // Hit size limit => Allocate more space
- s->_fileHandles.resize(s->_fileHandles.size() + 1);
- }
-
- s->_fileHandles[handle]._in = inFile;
- s->_fileHandles[handle]._out = outFile;
- s->_fileHandles[handle]._name = englishName;
-
- debugC(kDebugLevelFile, " -> opened file '%s' with handle %d", englishName.c_str(), handle);
- return make_reg(0, handle);
-}
-
-reg_t kFOpen(EngineState *s, int argc, reg_t *argv) {
- Common::String name = s->_segMan->getString(argv[0]);
- int mode = argv[1].toUint16();
-
- debugC(kDebugLevelFile, "kFOpen(%s,0x%x)", name.c_str(), mode);
- return file_open(s, name, mode, true);
-}
-
-static FileHandle *getFileFromHandle(EngineState *s, uint handle) {
- if (handle == 0) {
- error("Attempt to use file handle 0");
- return 0;
- }
-
- if ((handle >= s->_fileHandles.size()) || !s->_fileHandles[handle].isOpen()) {
- warning("Attempt to use invalid/unused file handle %d", handle);
- return 0;
- }
-
- return &s->_fileHandles[handle];
-}
-
-reg_t kFClose(EngineState *s, int argc, reg_t *argv) {
- debugC(kDebugLevelFile, "kFClose(%d)", argv[0].toUint16());
- if (argv[0] != SIGNAL_REG) {
- FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
- if (f)
- f->close();
- }
- return s->r_acc;
-}
-
-reg_t kFPuts(EngineState *s, int argc, reg_t *argv) {
- int handle = argv[0].toUint16();
- Common::String data = s->_segMan->getString(argv[1]);
-
- FileHandle *f = getFileFromHandle(s, handle);
- if (f)
- f->_out->write(data.c_str(), data.size());
-
- return s->r_acc;
-}
-
-static int fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle) {
- FileHandle *f = getFileFromHandle(s, handle);
- if (!f)
- return 0;
-
- if (!f->_in) {
- error("fgets_wrapper: Trying to read from file '%s' opened for writing", f->_name.c_str());
- return 0;
- }
- int readBytes = 0;
- if (maxsize > 1) {
- memset(dest, 0, maxsize);
- f->_in->readLine(dest, maxsize);
- readBytes = strlen(dest); // FIXME: sierra sci returned byte count and didn't react on NUL characters
- // The returned string must not have an ending LF
- if (readBytes > 0) {
- if (dest[readBytes - 1] == 0x0A)
- dest[readBytes - 1] = 0;
- }
- } else {
- *dest = 0;
- }
-
- debugC(kDebugLevelFile, " -> FGets'ed \"%s\"", dest);
- return readBytes;
-}
-
-reg_t kFGets(EngineState *s, int argc, reg_t *argv) {
- int maxsize = argv[1].toUint16();
- char *buf = new char[maxsize];
- int handle = argv[2].toUint16();
-
- debugC(kDebugLevelFile, "kFGets(%d, %d)", handle, maxsize);
- int readBytes = fgets_wrapper(s, buf, maxsize, handle);
- s->_segMan->memcpy(argv[0], (const byte*)buf, maxsize);
- delete[] buf;
- return readBytes ? argv[0] : NULL_REG;
-}
+extern reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename);
+extern FileHandle *getFileFromHandle(EngineState *s, uint handle);
+extern int fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle);
+extern void listSavegames(Common::Array<SavegameDesc> &saves);
+extern int findSavegame(Common::Array<SavegameDesc> &saves, int16 savegameId);
/**
* Writes the cwd to the supplied address and returns the address in acc.
@@ -258,9 +61,6 @@ reg_t kGetCWD(EngineState *s, int argc, reg_t *argv) {
return argv[0];
}
-static void listSavegames(Common::Array<SavegameDesc> &saves);
-static int findSavegame(Common::Array<SavegameDesc> &saves, int16 saveId);
-
enum {
K_DEVICE_INFO_GET_DEVICE = 0,
K_DEVICE_INFO_GET_CURRENT_DEVICE = 1,
@@ -331,7 +131,7 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
s->_segMan->strcpy(argv[1], "__throwaway");
debug(3, "K_DEVICE_INFO_GET_SAVEFILE_NAME(%s,%d) -> %s", game_prefix.c_str(), virtualId, "__throwaway");
if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END))
- error("kDeviceInfo(deleteSave): invalid savegame-id specified");
+ error("kDeviceInfo(deleteSave): invalid savegame ID specified");
uint savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
Common::Array<SavegameDesc> saves;
listSavegames(saves);
@@ -352,18 +152,6 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
-reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv) {
-#ifdef ENABLE_SCI32
- // SCI32 uses a parameter here. It is used to modify a string, stored in a
- // global variable, so that game scripts store the save directory. We
- // don't really set a save game directory, thus not setting the string to
- // anything is the correct thing to do here.
- //if (argc > 0)
- // warning("kGetSaveDir called with %d parameter(s): %04x:%04x", argc, PRINT_REG(argv[0]));
-#endif
- return s->_segMan->getSaveDirPtr();
-}
-
reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv) {
if (argc > 1) {
// SCI1.1/SCI32
@@ -394,354 +182,43 @@ reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, 1);
}
-static bool _savegame_sort_byDate(const SavegameDesc &l, const SavegameDesc &r) {
- if (l.date != r.date)
- return (l.date > r.date);
- return (l.time > r.time);
-}
-
-// Create a sorted array containing all found savedgames
-static void listSavegames(Common::Array<SavegameDesc> &saves) {
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
-
- // Load all saves
- Common::StringArray saveNames = saveFileMan->listSavefiles(g_sci->getSavegamePattern());
-
- for (Common::StringArray::const_iterator iter = saveNames.begin(); iter != saveNames.end(); ++iter) {
- Common::String filename = *iter;
- Common::SeekableReadStream *in;
- if ((in = saveFileMan->openForLoading(filename))) {
- SavegameMetadata meta;
- if (!get_savegame_metadata(in, &meta) || meta.name.empty()) {
- // invalid
- delete in;
- continue;
- }
- delete in;
-
- SavegameDesc desc;
- desc.id = strtol(filename.end() - 3, NULL, 10);
- desc.date = meta.saveDate;
- // We need to fix date in here, because we save DDMMYYYY instead of
- // YYYYMMDD, so sorting wouldn't work
- desc.date = ((desc.date & 0xFFFF) << 16) | ((desc.date & 0xFF0000) >> 8) | ((desc.date & 0xFF000000) >> 24);
- desc.time = meta.saveTime;
- desc.version = meta.version;
-
- if (meta.name.lastChar() == '\n')
- meta.name.deleteLastChar();
-
- Common::strlcpy(desc.name, meta.name.c_str(), SCI_MAX_SAVENAME_LENGTH);
-
- debug(3, "Savegame in file %s ok, id %d", filename.c_str(), desc.id);
-
- saves.push_back(desc);
- }
- }
-
- // Sort the list by creation date of the saves
- Common::sort(saves.begin(), saves.end(), _savegame_sort_byDate);
-}
-
-// Find a savedgame according to virtualId and return the position within our array
-static int findSavegame(Common::Array<SavegameDesc> &saves, int16 savegameId) {
- for (uint saveNr = 0; saveNr < saves.size(); saveNr++) {
- if (saves[saveNr].id == savegameId)
- return saveNr;
- }
- return -1;
-}
-
-// The scripts get IDs ranging from 100->199, because the scripts require us to assign unique ids THAT EVEN STAY BETWEEN
-// SAVES and the scripts also use "saves-count + 1" to create a new savedgame slot.
-// SCI1.1 actually recycles ids, in that case we will currently get "0".
-// This behavior is required especially for LSL6. In this game, it's possible to quick save. The scripts will use
-// the last-used id for that feature. If we don't assign sticky ids, the feature will overwrite different saves all the
-// time. And sadly we can't just use the actual filename ids directly, because of the creation method for new slots.
-
-bool Console::cmdListSaves(int argc, const char **argv) {
- Common::Array<SavegameDesc> saves;
- listSavegames(saves);
-
- for (uint i = 0; i < saves.size(); i++) {
- Common::String filename = g_sci->getSavegameName(saves[i].id);
- DebugPrintf("%s: '%s'\n", filename.c_str(), saves[i].name);
- }
-
- return true;
-}
-
-reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) {
- Common::String game_id = s->_segMan->getString(argv[0]);
- uint16 virtualId = argv[1].toUint16();
-
- debug(3, "kCheckSaveGame(%s, %d)", game_id.c_str(), virtualId);
-
- Common::Array<SavegameDesc> saves;
- listSavegames(saves);
-
- // we allow 0 (happens in QfG2 when trying to restore from an empty saved game list) and return false in that case
- if (virtualId == 0)
- return NULL_REG;
-
- // Find saved-game
- if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END))
- error("kCheckSaveGame: called with invalid savegameId");
- uint savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
- int savegameNr = findSavegame(saves, savegameId);
- if (savegameNr == -1)
- return NULL_REG;
-
- // Check for compatible savegame version
- int ver = saves[savegameNr].version;
- if (ver < MINIMUM_SAVEGAME_VERSION || ver > CURRENT_SAVEGAME_VERSION)
- return NULL_REG;
-
- // Otherwise we assume the savegame is OK
- return TRUE_REG;
-}
-
-reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) {
- Common::String game_id = s->_segMan->getString(argv[0]);
-
- debug(3, "kGetSaveFiles(%s)", game_id.c_str());
-
- // Scripts ask for current save files, we can assume that if afterwards they ask us to create a new slot they really
- // mean new slot instead of overwriting the old one
- s->_lastSaveVirtualId = SAVEGAMEID_OFFICIALRANGE_START;
-
- Common::Array<SavegameDesc> saves;
- listSavegames(saves);
- uint totalSaves = MIN<uint>(saves.size(), MAX_SAVEGAME_NR);
-
- reg_t *slot = s->_segMan->derefRegPtr(argv[2], totalSaves);
-
- if (!slot) {
- warning("kGetSaveFiles: %04X:%04X invalid or too small to hold slot data", PRINT_REG(argv[2]));
- totalSaves = 0;
- }
-
- const uint bufSize = (totalSaves * SCI_MAX_SAVENAME_LENGTH) + 1;
- char *saveNames = new char[bufSize];
- char *saveNamePtr = saveNames;
-
- for (uint i = 0; i < totalSaves; i++) {
- *slot++ = make_reg(0, saves[i].id + SAVEGAMEID_OFFICIALRANGE_START); // Store the virtual savegame-id ffs. see above
- strcpy(saveNamePtr, saves[i].name);
- saveNamePtr += SCI_MAX_SAVENAME_LENGTH;
- }
-
- *saveNamePtr = 0; // Terminate list
-
- s->_segMan->memcpy(argv[1], (byte *)saveNames, bufSize);
- delete[] saveNames;
-
- return make_reg(0, totalSaves);
-}
-
-reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
- Common::String game_id;
- int16 virtualId = argv[1].toSint16();
- int16 savegameId = -1;
- Common::String game_description;
- Common::String version;
-
- if (argc > 3)
- version = s->_segMan->getString(argv[3]);
-
- // We check here, we don't want to delete a users save in case we are within a kernel function
- if (s->executionStackBase) {
- warning("kSaveGame - won't save from within kernel function");
- return NULL_REG;
- }
-
- if (argv[0].isNull()) {
- // Direct call, from a patched Game::save
- if ((argv[1] != SIGNAL_REG) || (!argv[2].isNull()))
- error("kSaveGame: assumed patched call isn't accurate");
-
- // we are supposed to show a dialog for the user and let him choose where to save
- g_sci->_soundCmd->pauseAll(true); // pause music
- const EnginePlugin *plugin = NULL;
- EngineMan.findGame(g_sci->getGameIdStr(), &plugin);
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
- dialog->setSaveMode(true);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- game_description = dialog->getResultString();
- if (game_description.empty()) {
- // create our own description for the saved game, the user didnt enter it
- #if defined(USE_SAVEGAME_TIMESTAMP)
- TimeDate curTime;
- g_system->getTimeAndDate(curTime);
- curTime.tm_year += 1900; // fixup year
- curTime.tm_mon++; // fixup month
- game_description = 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
- game_description = Common::String::format("Save %d", savegameId + 1);
- #endif
- }
- delete dialog;
- g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
- if (savegameId < 0)
- return NULL_REG;
-
- } else {
- // Real call from script
- game_id = s->_segMan->getString(argv[0]);
- if (argv[2].isNull())
- error("kSaveGame: called with description being NULL");
- game_description = s->_segMan->getString(argv[2]);
-
- debug(3, "kSaveGame(%s,%d,%s,%s)", game_id.c_str(), virtualId, game_description.c_str(), version.c_str());
-
- Common::Array<SavegameDesc> saves;
- listSavegames(saves);
-
- if ((virtualId >= SAVEGAMEID_OFFICIALRANGE_START) && (virtualId <= SAVEGAMEID_OFFICIALRANGE_END)) {
- // savegameId is an actual Id, so search for it just to make sure
- savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
- if (findSavegame(saves, savegameId) == -1)
- return NULL_REG;
- } else if (virtualId < SAVEGAMEID_OFFICIALRANGE_START) {
- // virtualId is low, we assume that scripts expect us to create new slot
- if (virtualId == s->_lastSaveVirtualId) {
- // if last virtual id is the same as this one, we assume that caller wants to overwrite last save
- savegameId = s->_lastSaveNewId;
- } else {
- uint savegameNr;
- // savegameId is in lower range, scripts expect us to create a new slot
- for (savegameId = 0; savegameId < SAVEGAMEID_OFFICIALRANGE_START; savegameId++) {
- for (savegameNr = 0; savegameNr < saves.size(); savegameNr++) {
- if (savegameId == saves[savegameNr].id)
- break;
- }
- if (savegameNr == saves.size())
- break;
- }
- if (savegameId == SAVEGAMEID_OFFICIALRANGE_START)
- error("kSavegame: no more savegame slots available");
- }
- } else {
- error("kSaveGame: invalid savegameId used");
- }
-
- // Save in case caller wants to overwrite last newly created save
- s->_lastSaveVirtualId = virtualId;
- s->_lastSaveNewId = savegameId;
- }
-
- s->r_acc = NULL_REG;
-
- Common::String filename = g_sci->getSavegameName(savegameId);
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
- Common::OutSaveFile *out;
-
- out = saveFileMan->openForSaving(filename);
- if (!out) {
- warning("Error opening savegame \"%s\" for writing", filename.c_str());
- } else {
- if (!gamestate_save(s, out, game_description, version)) {
- warning("Saving the game failed");
- } else {
- s->r_acc = TRUE_REG; // save successful
- }
+reg_t kValidPath(EngineState *s, int argc, reg_t *argv) {
+ Common::String path = s->_segMan->getString(argv[0]);
- out->finalize();
- if (out->err()) {
- warning("Writing the savegame failed");
- s->r_acc = NULL_REG; // write failure
- }
- delete out;
- }
+ debug(3, "kValidPath(%s) -> %d", path.c_str(), s->r_acc.getOffset());
- return s->r_acc;
+ // Always return true
+ return make_reg(0, 1);
}
-reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
- Common::String game_id = !argv[0].isNull() ? s->_segMan->getString(argv[0]) : "";
- int16 savegameId = argv[1].toSint16();
- bool pausedMusic = false;
-
- debug(3, "kRestoreGame(%s,%d)", game_id.c_str(), savegameId);
+#ifdef ENABLE_SCI32
- if (argv[0].isNull()) {
- // Direct call, either from launcher or from a patched Game::restore
- if (savegameId == -1) {
- // we are supposed to show a dialog for the user and let him choose a saved game
- g_sci->_soundCmd->pauseAll(true); // pause music
- const EnginePlugin *plugin = NULL;
- EngineMan.findGame(g_sci->getGameIdStr(), &plugin);
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"));
- dialog->setSaveMode(false);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- delete dialog;
- if (savegameId < 0) {
- g_sci->_soundCmd->pauseAll(false); // unpause music
- return s->r_acc;
- }
- pausedMusic = true;
- }
- // don't adjust ID of the saved game, it's already correct
- } else {
- if (argv[2].isNull())
- error("kRestoreGame: called with parameter 2 being NULL");
- // Real call from script, we need to adjust ID
- if ((savegameId < SAVEGAMEID_OFFICIALRANGE_START) || (savegameId > SAVEGAMEID_OFFICIALRANGE_END)) {
- warning("Savegame ID %d is not allowed", savegameId);
+reg_t kCD(EngineState *s, int argc, reg_t *argv) {
+ // TODO: Stub
+ switch (argv[0].toUint16()) {
+ case 0:
+ if (argc == 1) {
+ // Check if a disc is in the drive
return TRUE_REG;
- }
- savegameId -= SAVEGAMEID_OFFICIALRANGE_START;
- }
-
- s->r_acc = NULL_REG; // signals success
-
- Common::Array<SavegameDesc> saves;
- listSavegames(saves);
- if (findSavegame(saves, savegameId) == -1) {
- s->r_acc = TRUE_REG;
- warning("Savegame ID %d not found", savegameId);
- } else {
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
- Common::String filename = g_sci->getSavegameName(savegameId);
- Common::SeekableReadStream *in;
-
- in = saveFileMan->openForLoading(filename);
- if (in) {
- // found a savegame file
-
- gamestate_restore(s, in);
- delete in;
-
- if (g_sci->getGameId() == GID_MOTHERGOOSE256) {
- // WORKAROUND: Mother Goose SCI1/SCI1.1 does some weird things for
- // saving a previously restored game.
- // We set the current savedgame-id directly and remove the script
- // code concerning this via script patch.
- s->variables[VAR_GLOBAL][0xB3].offset = SAVEGAMEID_OFFICIALRANGE_START + savegameId;
- }
} else {
- s->r_acc = TRUE_REG;
- warning("Savegame #%d not found", savegameId);
+ // Check if the specified disc is in the drive
+ // and return the current disc number. We just
+ // return the requested disc number.
+ return argv[1];
}
+ case 1:
+ // Return the current CD number
+ return make_reg(0, 1);
+ default:
+ warning("CD(%d)", argv[0].toUint16());
}
- if (!s->r_acc.isNull()) {
- // no success?
- if (pausedMusic)
- g_sci->_soundCmd->pauseAll(false); // unpause music
- }
-
- return s->r_acc;
+ return NULL_REG;
}
-reg_t kValidPath(EngineState *s, int argc, reg_t *argv) {
- Common::String path = s->_segMan->getString(argv[0]);
-
- debug(3, "kValidPath(%s) -> %d", path.c_str(), s->r_acc.offset);
+#endif
- // Always return true
- return make_reg(0, 1);
-}
+// ---- FileIO operations -----------------------------------------------------
reg_t kFileIO(EngineState *s, int argc, reg_t *argv) {
if (!s)
@@ -779,6 +256,73 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
}
debugC(kDebugLevelFile, "kFileIO(open): %s, 0x%x", name.c_str(), mode);
+#ifdef ENABLE_SCI32
+ if (name == PHANTASMAGORIA_SAVEGAME_INDEX) {
+ if (s->_virtualIndexFile) {
+ return make_reg(0, VIRTUALFILE_HANDLE);
+ } else {
+ Common::String englishName = g_sci->getSciLanguageString(name, K_LANG_ENGLISH);
+ Common::String wrappedName = g_sci->wrapFilename(englishName);
+ if (!g_sci->getSaveFileManager()->listSavefiles(wrappedName).empty()) {
+ s->_virtualIndexFile = new VirtualIndexFile(wrappedName);
+ return make_reg(0, VIRTUALFILE_HANDLE);
+ }
+ }
+ }
+
+ // Shivers is trying to store savegame descriptions and current spots in
+ // separate .SG files, which are hardcoded in the scripts.
+ // Essentially, there is a normal save file, created by the executable
+ // and an extra hardcoded save file, created by the game scripts, probably
+ // because they didn't want to modify the save/load code to add the extra
+ // information.
+ // Each slot in the book then has two strings, the save description and a
+ // description of the current spot that the player is at. Currently, the
+ // spot strings are always empty (probably related to the unimplemented
+ // kString subop 14, which gets called right before this call).
+ // For now, we don't allow the creation of these files, which means that
+ // all the spot descriptions next to each slot description will be empty
+ // (they are empty anyway). Until a viable solution is found to handle these
+ // extra files and until the spot description strings are initialized
+ // correctly, we resort to virtual files in order to make the load screen
+ // useable. Without this code it is unusable, as the extra information is
+ // always saved to 0.SG for some reason, but on restore the correct file is
+ // used. Perhaps the virtual ID is not taken into account when saving.
+ //
+ // Future TODO: maintain spot descriptions and show them too, ideally without
+ // having to return to this logic of extra hardcoded files.
+ if (g_sci->getGameId() == GID_SHIVERS && name.hasSuffix(".SG")) {
+ if (mode == _K_FILE_MODE_OPEN_OR_CREATE || mode == _K_FILE_MODE_CREATE) {
+ // Game scripts are trying to create a file with the save
+ // description, stop them here
+ debugC(kDebugLevelFile, "Not creating unused file %s", name.c_str());
+ return SIGNAL_REG;
+ } else if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
+ // Create a virtual file containing the save game description
+ // and slot number, as the game scripts expect.
+ int slotNumber;
+ sscanf(name.c_str(), "%d.SG", &slotNumber);
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+ int savegameNr = findSavegame(saves, slotNumber - SAVEGAMEID_OFFICIALRANGE_START);
+
+ if (!s->_virtualIndexFile) {
+ // Make the virtual file buffer big enough to avoid having it grow dynamically.
+ // 50 bytes should be more than enough.
+ s->_virtualIndexFile = new VirtualIndexFile(50);
+ }
+
+ s->_virtualIndexFile->seek(0, SEEK_SET);
+ s->_virtualIndexFile->write(saves[savegameNr].name, strlen(saves[savegameNr].name));
+ s->_virtualIndexFile->write("\0", 1);
+ s->_virtualIndexFile->write("\0", 1); // Spot description (empty)
+ s->_virtualIndexFile->seek(0, SEEK_SET);
+ return make_reg(0, VIRTUALFILE_HANDLE);
+ }
+ }
+#endif
+
// QFG import rooms get a virtual filelisting instead of an actual one
if (g_sci->inQfGImportRoom()) {
// We need to find out what the user actually selected, "savedHeroes" is
@@ -794,44 +338,82 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
reg_t kFileIOClose(EngineState *s, int argc, reg_t *argv) {
debugC(kDebugLevelFile, "kFileIO(close): %d", argv[0].toUint16());
- FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
+ if (argv[0] == SIGNAL_REG)
+ return s->r_acc;
+
+ uint16 handle = argv[0].toUint16();
+
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE) {
+ s->_virtualIndexFile->close();
+ return SIGNAL_REG;
+ }
+#endif
+
+ FileHandle *f = getFileFromHandle(s, handle);
if (f) {
f->close();
+ if (getSciVersion() <= SCI_VERSION_0_LATE)
+ return s->r_acc; // SCI0 semantics: no value returned
return SIGNAL_REG;
}
+
+ if (getSciVersion() <= SCI_VERSION_0_LATE)
+ return s->r_acc; // SCI0 semantics: no value returned
return NULL_REG;
}
reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv) {
- int handle = argv[0].toUint16();
- int size = argv[2].toUint16();
+ uint16 handle = argv[0].toUint16();
+ uint16 size = argv[2].toUint16();
int bytesRead = 0;
char *buf = new char[size];
debugC(kDebugLevelFile, "kFileIO(readRaw): %d, %d", handle, size);
- FileHandle *f = getFileFromHandle(s, handle);
- if (f) {
- bytesRead = f->_in->read(buf, size);
- s->_segMan->memcpy(argv[1], (const byte*)buf, size);
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE) {
+ bytesRead = s->_virtualIndexFile->read(buf, size);
+ } else {
+#endif
+ FileHandle *f = getFileFromHandle(s, handle);
+ if (f)
+ bytesRead = f->_in->read(buf, size);
+#ifdef ENABLE_SCI32
}
+#endif
+
+ // TODO: What happens if less bytes are read than what has
+ // been requested? (i.e. if bytesRead is non-zero, but still
+ // less than size)
+ if (bytesRead > 0)
+ s->_segMan->memcpy(argv[1], (const byte*)buf, size);
delete[] buf;
return make_reg(0, bytesRead);
}
reg_t kFileIOWriteRaw(EngineState *s, int argc, reg_t *argv) {
- int handle = argv[0].toUint16();
- int size = argv[2].toUint16();
+ uint16 handle = argv[0].toUint16();
+ uint16 size = argv[2].toUint16();
char *buf = new char[size];
bool success = false;
s->_segMan->memcpy((byte *)buf, argv[1], size);
debugC(kDebugLevelFile, "kFileIO(writeRaw): %d, %d", handle, size);
- FileHandle *f = getFileFromHandle(s, handle);
- if (f) {
- f->_out->write(buf, size);
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE) {
+ s->_virtualIndexFile->write(buf, size);
success = true;
+ } else {
+#endif
+ FileHandle *f = getFileFromHandle(s, handle);
+ if (f) {
+ f->_out->write(buf, size);
+ success = true;
+ }
+#ifdef ENABLE_SCI32
}
+#endif
delete[] buf;
if (success)
@@ -863,6 +445,20 @@ reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv) {
int savedir_nr = saves[slotNum].id;
name = g_sci->getSavegameName(savedir_nr);
result = saveFileMan->removeSavefile(name);
+ } else if (getSciVersion() >= SCI_VERSION_2) {
+ // The file name may be already wrapped, so check both cases
+ result = saveFileMan->removeSavefile(name);
+ if (!result) {
+ const Common::String wrappedName = g_sci->wrapFilename(name);
+ result = saveFileMan->removeSavefile(wrappedName);
+ }
+
+#ifdef ENABLE_SCI32
+ if (name == PHANTASMAGORIA_SAVEGAME_INDEX) {
+ delete s->_virtualIndexFile;
+ s->_virtualIndexFile = 0;
+ }
+#endif
} else {
const Common::String wrappedName = g_sci->wrapFilename(name);
result = saveFileMan->removeSavefile(wrappedName);
@@ -875,15 +471,22 @@ reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv) {
}
reg_t kFileIOReadString(EngineState *s, int argc, reg_t *argv) {
- int size = argv[1].toUint16();
- char *buf = new char[size];
- int handle = argv[2].toUint16();
- debugC(kDebugLevelFile, "kFileIO(readString): %d, %d", handle, size);
+ uint16 maxsize = argv[1].toUint16();
+ char *buf = new char[maxsize];
+ uint16 handle = argv[2].toUint16();
+ debugC(kDebugLevelFile, "kFileIO(readString): %d, %d", handle, maxsize);
+ uint32 bytesRead;
+
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE)
+ bytesRead = s->_virtualIndexFile->readLine(buf, maxsize);
+ else
+#endif
+ bytesRead = fgets_wrapper(s, buf, maxsize, handle);
- int readBytes = fgets_wrapper(s, buf, size, handle);
- s->_segMan->memcpy(argv[0], (const byte*)buf, size);
+ s->_segMan->memcpy(argv[0], (const byte*)buf, maxsize);
delete[] buf;
- return readBytes ? argv[0] : NULL_REG;
+ return bytesRead ? argv[0] : NULL_REG;
}
reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv) {
@@ -891,126 +494,55 @@ reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv) {
Common::String str = s->_segMan->getString(argv[1]);
debugC(kDebugLevelFile, "kFileIO(writeString): %d", handle);
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE) {
+ s->_virtualIndexFile->write(str.c_str(), str.size());
+ return NULL_REG;
+ }
+#endif
+
FileHandle *f = getFileFromHandle(s, handle);
if (f) {
f->_out->write(str.c_str(), str.size());
+ if (getSciVersion() <= SCI_VERSION_0_LATE)
+ return s->r_acc; // SCI0 semantics: no value returned
return NULL_REG;
}
+ if (getSciVersion() <= SCI_VERSION_0_LATE)
+ return s->r_acc; // SCI0 semantics: no value returned
return make_reg(0, 6); // DOS - invalid handle
}
reg_t kFileIOSeek(EngineState *s, int argc, reg_t *argv) {
- int handle = argv[0].toUint16();
- int offset = argv[1].toUint16();
- int whence = argv[2].toUint16();
+ uint16 handle = argv[0].toUint16();
+ uint16 offset = ABS<int16>(argv[1].toSint16()); // can be negative
+ uint16 whence = argv[2].toUint16();
debugC(kDebugLevelFile, "kFileIO(seek): %d, %d, %d", handle, offset, whence);
- FileHandle *f = getFileFromHandle(s, handle);
-
- if (f)
- s->r_acc = make_reg(0, f->_in->seek(offset, whence));
-
- return SIGNAL_REG;
-}
-
-void DirSeeker::addAsVirtualFiles(Common::String title, Common::String fileMask) {
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
- Common::StringArray foundFiles = saveFileMan->listSavefiles(fileMask);
- if (!foundFiles.empty()) {
- _files.push_back(title);
- _virtualFiles.push_back("");
- Common::StringArray::iterator it;
- Common::StringArray::iterator it_end = foundFiles.end();
-
- for (it = foundFiles.begin(); it != it_end; it++) {
- Common::String regularFilename = *it;
- Common::String wrappedFilename = Common::String(regularFilename.c_str() + fileMask.size() - 1);
-
- Common::SeekableReadStream *testfile = saveFileMan->openForLoading(regularFilename);
- int32 testfileSize = testfile->size();
- delete testfile;
- if (testfileSize > 1024) // check, if larger than 1k. in that case its a saved game.
- continue; // and we dont want to have those in the list
- // We need to remove the prefix for display purposes
- _files.push_back(wrappedFilename);
- // but remember the actual name as well
- _virtualFiles.push_back(regularFilename);
- }
- }
-}
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE)
+ return make_reg(0, s->_virtualIndexFile->seek(offset, whence));
+#endif
-Common::String DirSeeker::getVirtualFilename(uint fileNumber) {
- if (fileNumber >= _virtualFiles.size())
- error("invalid virtual filename access");
- return _virtualFiles[fileNumber];
-}
+ FileHandle *f = getFileFromHandle(s, handle);
-reg_t DirSeeker::firstFile(const Common::String &mask, reg_t buffer, SegManager *segMan) {
- // Verify that we are given a valid buffer
- if (!buffer.segment) {
- error("DirSeeker::firstFile('%s') invoked with invalid buffer", mask.c_str());
- return NULL_REG;
- }
- _outbuffer = buffer;
- _files.clear();
- _virtualFiles.clear();
-
- int QfGImport = g_sci->inQfGImportRoom();
- if (QfGImport) {
- _files.clear();
- addAsVirtualFiles("-QfG1-", "qfg1-*");
- addAsVirtualFiles("-QfG1VGA-", "qfg1vga-*");
- if (QfGImport > 2)
- addAsVirtualFiles("-QfG2-", "qfg2-*");
- if (QfGImport > 3)
- addAsVirtualFiles("-QfG3-", "qfg3-*");
-
- if (QfGImport == 3) {
- // QfG3 sorts the filelisting itself, we can't let that happen otherwise our
- // virtual list would go out-of-sync
- reg_t savedHeros = segMan->findObjectByName("savedHeros");
- if (!savedHeros.isNull())
- writeSelectorValue(segMan, savedHeros, SELECTOR(sort), 0);
+ if (f && f->_in) {
+ // Backward seeking isn't supported in zip file streams, thus adapt the
+ // parameters accordingly if games ask for such a seek mode. A known
+ // case where this is requested is the save file manager in Phantasmagoria
+ if (whence == SEEK_END) {
+ whence = SEEK_SET;
+ offset = f->_in->size() - offset;
}
- } else {
- // Prefix the mask
- const Common::String wrappedMask = g_sci->wrapFilename(mask);
-
- // Obtain a list of all files matching the given mask
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
- _files = saveFileMan->listSavefiles(wrappedMask);
+ return make_reg(0, f->_in->seek(offset, whence));
+ } else if (f && f->_out) {
+ error("kFileIOSeek: Unsupported seek operation on a writeable stream (offset: %d, whence: %d)", offset, whence);
}
- // Reset the list iterator and write the first match to the output buffer,
- // if any.
- _iter = _files.begin();
- return nextFile(segMan);
-}
-
-reg_t DirSeeker::nextFile(SegManager *segMan) {
- if (_iter == _files.end()) {
- return NULL_REG;
- }
-
- Common::String string;
-
- if (_virtualFiles.empty()) {
- // Strip the prefix, if we don't got a virtual filelisting
- const Common::String wrappedString = *_iter;
- string = g_sci->unwrapFilename(wrappedString);
- } else {
- string = *_iter;
- }
- if (string.size() > 12)
- string = Common::String(string.c_str(), 12);
- segMan->strcpy(_outbuffer, string.c_str());
-
- // Return the result and advance the list iterator :)
- ++_iter;
- return _outbuffer;
+ return SIGNAL_REG;
}
reg_t kFileIOFindFirst(EngineState *s, int argc, reg_t *argv) {
@@ -1033,6 +565,14 @@ reg_t kFileIOFindNext(EngineState *s, int argc, reg_t *argv) {
reg_t kFileIOExists(EngineState *s, int argc, reg_t *argv) {
Common::String name = s->_segMan->getString(argv[0]);
+#ifdef ENABLE_SCI32
+ // Cache the file existence result for the Phantasmagoria
+ // save index file, as the game scripts keep checking for
+ // its existence.
+ if (name == PHANTASMAGORIA_SAVEGAME_INDEX && s->_virtualIndexFile)
+ return TRUE_REG;
+#endif
+
bool exists = false;
// Check for regular file
@@ -1084,7 +624,7 @@ reg_t kFileIOExists(EngineState *s, int argc, reg_t *argv) {
// Special case for KQ6 Mac: The game checks for two video files to see
// if they exist before it plays them. Since we support multiple naming
// schemes for resource fork files, we also need to support that here in
- // case someone has a "HalfDome.bin" file, etc.
+ // case someone has a "HalfDome.bin" file, etc.
if (!exists && g_sci->getGameId() == GID_KQ6 && g_sci->getPlatform() == Common::kPlatformMacintosh &&
(name == "HalfDome" || name == "Kq6Movie"))
exists = Common::MacResManager::exists(name);
@@ -1155,51 +695,328 @@ reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv) {
return TRUE_REG; // slot creation was successful
}
-reg_t kCD(EngineState *s, int argc, reg_t *argv) {
- // TODO: Stub
- switch (argv[0].toUint16()) {
- case 0:
- // Return whether the contents of disc argv[1] is available.
- return TRUE_REG;
- default:
- warning("CD(%d)", argv[0].toUint16());
+reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv) {
+ // Used in Torin's Passage and LSL7 to determine if the directory passed as
+ // a parameter (usually the save directory) is valid. We always return true
+ // here.
+ return TRUE_REG;
+}
+
+#endif
+
+// ---- Save operations -------------------------------------------------------
+
+#ifdef ENABLE_SCI32
+
+reg_t kSave(EngineState *s, int argc, reg_t *argv) {
+ if (!s)
+ return make_reg(0, getSciVersion());
+ error("not supposed to call this");
+}
+
+#endif
+
+reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
+ Common::String game_id;
+ int16 virtualId = argv[1].toSint16();
+ int16 savegameId = -1;
+ Common::String game_description;
+ Common::String version;
+
+ if (argc > 3)
+ version = s->_segMan->getString(argv[3]);
+
+ // We check here, we don't want to delete a users save in case we are within a kernel function
+ if (s->executionStackBase) {
+ warning("kSaveGame - won't save from within kernel function");
+ return NULL_REG;
}
- return NULL_REG;
+ if (argv[0].isNull()) {
+ // Direct call, from a patched Game::save
+ if ((argv[1] != SIGNAL_REG) || (!argv[2].isNull()))
+ error("kSaveGame: assumed patched call isn't accurate");
+
+ // we are supposed to show a dialog for the user and let him choose where to save
+ g_sci->_soundCmd->pauseAll(true); // pause music
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
+ savegameId = dialog->runModalWithCurrentTarget();
+ game_description = dialog->getResultString();
+ if (game_description.empty()) {
+ // create our own description for the saved game, the user didnt enter it
+ game_description = dialog->createDefaultSaveDescription(savegameId);
+ }
+ delete dialog;
+ g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
+ if (savegameId < 0)
+ return NULL_REG;
+
+ } else {
+ // Real call from script
+ game_id = s->_segMan->getString(argv[0]);
+ if (argv[2].isNull())
+ error("kSaveGame: called with description being NULL");
+ game_description = s->_segMan->getString(argv[2]);
+
+ debug(3, "kSaveGame(%s,%d,%s,%s)", game_id.c_str(), virtualId, game_description.c_str(), version.c_str());
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+
+ if ((virtualId >= SAVEGAMEID_OFFICIALRANGE_START) && (virtualId <= SAVEGAMEID_OFFICIALRANGE_END)) {
+ // savegameId is an actual Id, so search for it just to make sure
+ savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
+ if (findSavegame(saves, savegameId) == -1)
+ return NULL_REG;
+ } else if (virtualId < SAVEGAMEID_OFFICIALRANGE_START) {
+ // virtualId is low, we assume that scripts expect us to create new slot
+ if (virtualId == s->_lastSaveVirtualId) {
+ // if last virtual id is the same as this one, we assume that caller wants to overwrite last save
+ savegameId = s->_lastSaveNewId;
+ } else {
+ uint savegameNr;
+ // savegameId is in lower range, scripts expect us to create a new slot
+ for (savegameId = 0; savegameId < SAVEGAMEID_OFFICIALRANGE_START; savegameId++) {
+ for (savegameNr = 0; savegameNr < saves.size(); savegameNr++) {
+ if (savegameId == saves[savegameNr].id)
+ break;
+ }
+ if (savegameNr == saves.size())
+ break;
+ }
+ if (savegameId == SAVEGAMEID_OFFICIALRANGE_START)
+ error("kSavegame: no more savegame slots available");
+ }
+ } else {
+ error("kSaveGame: invalid savegameId used");
+ }
+
+ // Save in case caller wants to overwrite last newly created save
+ s->_lastSaveVirtualId = virtualId;
+ s->_lastSaveNewId = savegameId;
+ }
+
+ s->r_acc = NULL_REG;
+
+ Common::String filename = g_sci->getSavegameName(savegameId);
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ Common::OutSaveFile *out;
+
+ out = saveFileMan->openForSaving(filename);
+ if (!out) {
+ warning("Error opening savegame \"%s\" for writing", filename.c_str());
+ } else {
+ if (!gamestate_save(s, out, game_description, version)) {
+ warning("Saving the game failed");
+ } else {
+ s->r_acc = TRUE_REG; // save successful
+ }
+
+ out->finalize();
+ if (out->err()) {
+ warning("Writing the savegame failed");
+ s->r_acc = NULL_REG; // write failure
+ }
+ delete out;
+ }
+
+ return s->r_acc;
}
-reg_t kSave(EngineState *s, int argc, reg_t *argv) {
- switch (argv[0].toUint16()) {
- case 0:
- return kSaveGame(s, argc - 1,argv + 1);
- case 1:
- return kRestoreGame(s, argc - 1,argv + 1);
- case 2:
- return kGetSaveDir(s, argc - 1, argv + 1);
- case 3:
- return kCheckSaveGame(s, argc - 1, argv + 1);
- case 5:
- return kGetSaveFiles(s, argc - 1, argv + 1);
- case 6:
- // This is used in Shivers to delete saved games, however it
- // always passes the same file name (SHIVER), so it doesn't
- // actually delete anything...
- // TODO: Check why this happens
- // argv[1] is a string (most likely the save game directory)
- return kFileIOUnlink(s, argc - 2, argv + 2);
- case 8:
- // TODO
- // This is a timer callback, with 1 parameter: the timer object
- // (e.g. "timers").
- // It's used for auto-saving (i.e. save every X minutes, by checking
- // the elapsed time from the timer object)
-
- // This function has to return something other than 0 to proceed
- return s->r_acc;
- default:
- kStub(s, argc, argv);
+reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
+ Common::String game_id = !argv[0].isNull() ? s->_segMan->getString(argv[0]) : "";
+ int16 savegameId = argv[1].toSint16();
+ bool pausedMusic = false;
+
+ debug(3, "kRestoreGame(%s,%d)", game_id.c_str(), savegameId);
+
+ if (argv[0].isNull()) {
+ // Direct call, either from launcher or from a patched Game::restore
+ if (savegameId == -1) {
+ // we are supposed to show a dialog for the user and let him choose a saved game
+ g_sci->_soundCmd->pauseAll(true); // pause music
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
+ savegameId = dialog->runModalWithCurrentTarget();
+ delete dialog;
+ if (savegameId < 0) {
+ g_sci->_soundCmd->pauseAll(false); // unpause music
+ return s->r_acc;
+ }
+ pausedMusic = true;
+ }
+ // don't adjust ID of the saved game, it's already correct
+ } else {
+ if (argv[2].isNull())
+ error("kRestoreGame: called with parameter 2 being NULL");
+ // Real call from script, we need to adjust ID
+ if ((savegameId < SAVEGAMEID_OFFICIALRANGE_START) || (savegameId > SAVEGAMEID_OFFICIALRANGE_END)) {
+ warning("Savegame ID %d is not allowed", savegameId);
+ return TRUE_REG;
+ }
+ savegameId -= SAVEGAMEID_OFFICIALRANGE_START;
+ }
+
+ s->r_acc = NULL_REG; // signals success
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+ if (findSavegame(saves, savegameId) == -1) {
+ s->r_acc = TRUE_REG;
+ warning("Savegame ID %d not found", savegameId);
+ } else {
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ Common::String filename = g_sci->getSavegameName(savegameId);
+ Common::SeekableReadStream *in;
+
+ in = saveFileMan->openForLoading(filename);
+ if (in) {
+ // found a savegame file
+
+ gamestate_restore(s, in);
+ delete in;
+
+ if (g_sci->getGameId() == GID_MOTHERGOOSE256) {
+ // WORKAROUND: Mother Goose SCI1/SCI1.1 does some weird things for
+ // saving a previously restored game.
+ // We set the current savedgame-id directly and remove the script
+ // code concerning this via script patch.
+ s->variables[VAR_GLOBAL][0xB3].setOffset(SAVEGAMEID_OFFICIALRANGE_START + savegameId);
+ }
+ } else {
+ s->r_acc = TRUE_REG;
+ warning("Savegame #%d not found", savegameId);
+ }
+ }
+
+ if (!s->r_acc.isNull()) {
+ // no success?
+ if (pausedMusic)
+ g_sci->_soundCmd->pauseAll(false); // unpause music
+ }
+
+ return s->r_acc;
+}
+
+reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv) {
+#ifdef ENABLE_SCI32
+ // SCI32 uses a parameter here. It is used to modify a string, stored in a
+ // global variable, so that game scripts store the save directory. We
+ // don't really set a save game directory, thus not setting the string to
+ // anything is the correct thing to do here.
+ //if (argc > 0)
+ // warning("kGetSaveDir called with %d parameter(s): %04x:%04x", argc, PRINT_REG(argv[0]));
+#endif
+ return s->_segMan->getSaveDirPtr();
+}
+
+reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) {
+ Common::String game_id = s->_segMan->getString(argv[0]);
+ uint16 virtualId = argv[1].toUint16();
+
+ debug(3, "kCheckSaveGame(%s, %d)", game_id.c_str(), virtualId);
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+
+ // we allow 0 (happens in QfG2 when trying to restore from an empty saved game list) and return false in that case
+ if (virtualId == 0)
return NULL_REG;
+
+ // Find saved-game
+ if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END))
+ error("kCheckSaveGame: called with invalid savegameId");
+ uint savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
+ int savegameNr = findSavegame(saves, savegameId);
+ if (savegameNr == -1)
+ return NULL_REG;
+
+ // Check for compatible savegame version
+ int ver = saves[savegameNr].version;
+ if (ver < MINIMUM_SAVEGAME_VERSION || ver > CURRENT_SAVEGAME_VERSION)
+ return NULL_REG;
+
+ // Otherwise we assume the savegame is OK
+ return TRUE_REG;
+}
+
+reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) {
+ Common::String game_id = s->_segMan->getString(argv[0]);
+
+ debug(3, "kGetSaveFiles(%s)", game_id.c_str());
+
+ // Scripts ask for current save files, we can assume that if afterwards they ask us to create a new slot they really
+ // mean new slot instead of overwriting the old one
+ s->_lastSaveVirtualId = SAVEGAMEID_OFFICIALRANGE_START;
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+ uint totalSaves = MIN<uint>(saves.size(), MAX_SAVEGAME_NR);
+
+ reg_t *slot = s->_segMan->derefRegPtr(argv[2], totalSaves);
+
+ if (!slot) {
+ warning("kGetSaveFiles: %04X:%04X invalid or too small to hold slot data", PRINT_REG(argv[2]));
+ totalSaves = 0;
}
+
+ const uint bufSize = (totalSaves * SCI_MAX_SAVENAME_LENGTH) + 1;
+ char *saveNames = new char[bufSize];
+ char *saveNamePtr = saveNames;
+
+ for (uint i = 0; i < totalSaves; i++) {
+ *slot++ = make_reg(0, saves[i].id + SAVEGAMEID_OFFICIALRANGE_START); // Store the virtual savegame ID ffs. see above
+ strcpy(saveNamePtr, saves[i].name);
+ saveNamePtr += SCI_MAX_SAVENAME_LENGTH;
+ }
+
+ *saveNamePtr = 0; // Terminate list
+
+ s->_segMan->memcpy(argv[1], (byte *)saveNames, bufSize);
+ delete[] saveNames;
+
+ return make_reg(0, totalSaves);
+}
+
+#ifdef ENABLE_SCI32
+
+reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv) {
+ // Normally, this creates the name of the save catalogue/directory to save into.
+ // First parameter is the string to save the result into. Second is a string
+ // with game parameters. We don't have a use for this at all, as we have our own
+ // savegame directory management, thus we always return an empty string.
+ return argv[0];
+}
+
+reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv) {
+ // Creates a savegame name from a slot number. Used when deleting saved games.
+ // Param 0: the output buffer (same as in kMakeSaveCatName)
+ // Param 1: a string with game parameters, ignored
+ // Param 2: the selected slot
+
+ SciString *resultString = s->_segMan->lookupString(argv[0]);
+ uint16 virtualId = argv[2].toUint16();
+ if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END))
+ error("kMakeSaveFileName: invalid savegame ID specified");
+ uint saveSlot = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+
+ Common::String filename = g_sci->getSavegameName(saveSlot);
+ resultString->fromString(filename);
+
+ return argv[0];
+}
+
+reg_t kAutoSave(EngineState *s, int argc, reg_t *argv) {
+ // TODO
+ // This is a timer callback, with 1 parameter: the timer object
+ // (e.g. "timers").
+ // It's used for auto-saving (i.e. save every X minutes, by checking
+ // the elapsed time from the timer object)
+
+ // This function has to return something other than 0 to proceed
+ return TRUE_REG;
}
#endif
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index caae562d67..da377319c0 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -25,12 +25,10 @@
#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"
#include "sci/sci.h"
-#include "sci/debug.h" // for g_debug_sleeptime_factor
#include "sci/event.h"
#include "sci/resource.h"
#include "sci/engine/features.h"
@@ -50,10 +48,7 @@
#include "sci/graphics/text16.h"
#include "sci/graphics/view.h"
#ifdef ENABLE_SCI32
-#include "sci/graphics/controls32.h"
-#include "sci/graphics/font.h" // TODO: remove once kBitmap is moved in a separate class
#include "sci/graphics/text32.h"
-#include "sci/graphics/frameout.h"
#endif
namespace Sci {
@@ -342,7 +337,7 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
Common::String sep_str;
const char *sep = NULL;
- if ((argc > 4) && (argv[4].segment)) {
+ if ((argc > 4) && (argv[4].getSegment())) {
sep_str = s->_segMan->getString(argv[4]);
sep = sep_str.c_str();
}
@@ -650,6 +645,20 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) {
if (paletteChanged)
g_sci->_gfxPalette->kernelAnimateSet();
+ // WORKAROUND: The game scripts in SQ4 floppy count the number of elapsed
+ // cycles in the intro from the number of successive kAnimate calls during
+ // the palette cycling effect, while showing the SQ4 logo. This worked in
+ // older computers because each animate call took awhile to complete.
+ // Normally, such scripts are handled automatically by our speed throttler,
+ // however in this case there are no calls to kGameIsRestarting (where the
+ // speed throttler gets called) between the different palette animation calls.
+ // Thus, we add a small delay between each animate call to make the whole
+ // palette animation effect slower and visible, and not have the logo screen
+ // get skipped because the scripts don't wait between animation steps. Fixes
+ // bug #3537232.
+ if (g_sci->getGameId() == GID_SQ4 && !g_sci->isCD() && s->currentRoomNumber() == 1)
+ g_sci->sleep(10);
+
return s->r_acc;
}
@@ -794,7 +803,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
Common::Rect rect;
TextAlignment alignment;
int16 mode, maxChars, cursorPos, upperPos, listCount, i;
- int16 upperOffset, cursorOffset;
+ uint16 upperOffset, cursorOffset;
GuiResourceId viewId;
int16 loopNo;
int16 celNo;
@@ -876,7 +885,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
listCount = 0; listSeeker = textReference;
while (s->_segMan->strlen(listSeeker) > 0) {
listCount++;
- listSeeker.offset += maxChars;
+ listSeeker.incOffset(maxChars);
}
// TODO: This is rather convoluted... It would be a lot cleaner
@@ -890,11 +899,11 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
for (i = 0; i < listCount; i++) {
listStrings[i] = s->_segMan->getString(listSeeker);
listEntries[i] = listStrings[i].c_str();
- if (listSeeker.offset == upperOffset)
+ if (listSeeker.getOffset() == upperOffset)
upperPos = i;
- if (listSeeker.offset == cursorOffset)
+ if (listSeeker.getOffset() == cursorOffset)
cursorPos = i;
- listSeeker.offset += maxChars;
+ listSeeker.incOffset(maxChars);
}
}
@@ -941,8 +950,9 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) {
}
}
if (objName == "savedHeros") {
- // Import of QfG character files dialog is shown
- // display additional popup information before letting user use it
+ // Import of QfG character files dialog is shown.
+ // Display additional popup information before letting user use it.
+ // For the SCI32 version of this, check kernelAddPlane().
reg_t changeDirButton = s->_segMan->findObjectByName("changeDirItem");
if (!changeDirButton.isNull()) {
// check if checkDirButton is still enabled, in that case we are called the first time during that room
@@ -955,6 +965,8 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) {
"for Quest for Glory 2. Example: 'qfg2-thief.sav'.");
}
}
+
+ // For the SCI32 version of this, check kListAt().
s->_chosenQfGImportItem = readSelectorValue(s->_segMan, controlObject, SELECTOR(mark));
}
@@ -1109,7 +1121,7 @@ reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) {
rect2 = Common::Rect (argv[5].toSint16(), argv[4].toSint16(), argv[7].toSint16(), argv[6].toSint16());
Common::String title;
- if (argv[4 + argextra].segment) {
+ if (argv[4 + argextra].getSegment()) {
title = s->_segMan->getString(argv[4 + argextra]);
title = g_sci->strSplit(title.c_str(), NULL);
}
@@ -1148,7 +1160,7 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) {
Common::String text;
- if (textp.segment) {
+ if (textp.getSegment()) {
argc--; argv++;
text = s->_segMan->getString(textp);
} else {
@@ -1209,688 +1221,33 @@ reg_t kShow(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+// Early variant of the SCI32 kRemapColors kernel function, used in the demo of QFG4
reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
uint16 operation = argv[0].toUint16();
switch (operation) {
- case 0: { // Set remapping to base. 0 turns remapping off.
- int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
- 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
- // The demo of QFG4 calls this with 1+3 parameters, thus there are differences here
- //int16 unk1 = argv[1].toSint16();
- //int16 unk2 = argv[2].toSint16();
- //int16 unk3 = argv[3].toSint16();
- //uint16 unk4 = argv[4].toUint16();
- //uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0;
- kStub(s, argc, argv);
- }
- break;
- case 2: { // remap by percent
- // This adjusts the alpha value of a specific color, and it operates on
- // an RGBA palette. Since we're operating on an RGB palette, we just
- // modify the color intensity instead
- // TODO: From what I understand, palette remapping should be placed
- // separately, so that it can be reset by case 0 above. Thus, we
- // should adjust the functionality of the Palette class accordingly.
- int16 color = argv[1].toSint16();
- if (color >= 10)
- color -= 10;
- uint16 percent = argv[2].toUint16(); // 0 - 100
- if (argc >= 4)
- warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16());
- g_sci->_gfxPalette->kernelSetIntensity(color, 255, percent, false);
- }
- break;
- case 3: { // remap to gray
- // NOTE: This adjusts the alpha value of a specific color, and it operates on
- // an RGBA palette
- int16 color = argv[1].toSint16(); // this is subtracted from a maximum color value, and can be offset by 10
- int16 percent = argv[2].toSint16(); // 0 - 100
- uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
- warning("kRemapColors: RemapToGray color %d by %d percent (unk3 = %d)", color, percent, unk3);
- }
- break;
- case 4: { // unknown
- //int16 unk1 = argv[1].toSint16();
- //uint16 unk2 = argv[2].toUint16();
- //uint16 unk3 = argv[3].toUint16();
- //uint16 unk4 = (argc >= 5) ? argv[4].toUint16() : 0;
- kStub(s, argc, argv);
- }
- break;
- case 5: { // increment color
- //int16 unk1 = argv[1].toSint16();
- //uint16 unk2 = argv[2].toUint16();
- kStub(s, argc, argv);
- }
- break;
- default:
- break;
- }
-
- return s->r_acc;
-}
-
-#ifdef ENABLE_SCI32
-
-reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv) {
- // Returns 0 if the screen width or height is less than 640 or 400,
- // respectively.
- if (g_system->getWidth() < 640 || g_system->getHeight() < 400)
- return make_reg(0, 0);
-
- return make_reg(0, 1);
-}
-
-// SCI32 variant, can't work like sci16 variants
-reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv) {
- // TODO
-// reg_t curObject = argv[0];
-// reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
-
- return NULL_REG;
-}
-
-reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) {
- if (g_sci->_gfxFrameout->findScreenItem(argv[0]) == NULL)
- g_sci->_gfxFrameout->kernelAddScreenItem(argv[0]);
- else
- g_sci->_gfxFrameout->kernelUpdateScreenItem(argv[0]);
- return s->r_acc;
-}
-
-reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelUpdateScreenItem(argv[0]);
- return s->r_acc;
-}
-
-reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelDeleteScreenItem(argv[0]);
- return s->r_acc;
-}
-
-reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelAddPlane(argv[0]);
- return s->r_acc;
-}
-
-reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelDeletePlane(argv[0]);
- return s->r_acc;
-}
-
-reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelUpdatePlane(argv[0]);
- return s->r_acc;
-}
-
-reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
- reg_t planeObj = argv[0];
- GuiResourceId pictureId = argv[1].toUint16();
- int16 pictureX = argv[2].toSint16();
- int16 pictureY = argv[3].toSint16();
-
- g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, pictureX, pictureY);
- return s->r_acc;
-}
-
-reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
- return make_reg(0, g_sci->_gfxFrameout->kernelGetHighPlanePri());
-}
-
-reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelFrameout();
- return NULL_REG;
-}
-
-reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv) {
- Common::Rect objRect1 = g_sci->_gfxCompare->getNSRect(argv[0]);
- Common::Rect objRect2 = g_sci->_gfxCompare->getNSRect(argv[1]);
- return make_reg(0, objRect1.intersects(objRect2));
-}
-
-// Tests if the coordinate is on the passed object
-reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
- uint16 x = argv[0].toUint16();
- uint16 y = argv[1].toUint16();
- reg_t targetObject = argv[2];
- uint16 illegalBits = argv[3].offset;
- Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
-
- // we assume that x, y are local coordinates
-
- bool contained = nsRect.contains(x, y);
- if (contained && illegalBits) {
- // If illegalbits are set, we check the color of the pixel that got clicked on
- // for now, we return false if the pixel is transparent
- // although illegalBits may get differently set, don't know yet how this really works out
- uint16 viewId = readSelectorValue(s->_segMan, targetObject, SELECTOR(view));
- int16 loopNo = readSelectorValue(s->_segMan, targetObject, SELECTOR(loop));
- int16 celNo = readSelectorValue(s->_segMan, targetObject, SELECTOR(cel));
- if (g_sci->_gfxCompare->kernelIsItSkip(viewId, loopNo, celNo, Common::Point(x - nsRect.left, y - nsRect.top)))
- contained = false;
- }
- return make_reg(0, contained);
-}
-
-reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
- switch (argv[0].toUint16()) {
- case 0: {
- if (argc != 4) {
- warning("kCreateTextBitmap(0): expected 4 arguments, got %i", argc);
- return NULL_REG;
- }
- reg_t object = argv[3];
- Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
- debugC(kDebugLevelStrings, "kCreateTextBitmap case 0 (%04x:%04x, %04x:%04x, %04x:%04x)",
- PRINT_REG(argv[1]), PRINT_REG(argv[2]), PRINT_REG(argv[3]));
- debugC(kDebugLevelStrings, "%s", text.c_str());
- uint16 maxWidth = argv[1].toUint16(); // nsRight - nsLeft + 1
- uint16 maxHeight = argv[2].toUint16(); // nsBottom - nsTop + 1
- return g_sci->_gfxText32->createTextBitmap(object, maxWidth, maxHeight);
- }
- case 1: {
- if (argc != 2) {
- warning("kCreateTextBitmap(1): expected 2 arguments, got %i", argc);
- return NULL_REG;
- }
- reg_t object = argv[1];
- Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
- debugC(kDebugLevelStrings, "kCreateTextBitmap case 1 (%04x:%04x)", PRINT_REG(argv[1]));
- debugC(kDebugLevelStrings, "%s", text.c_str());
- return g_sci->_gfxText32->createTextBitmap(object);
- }
- default:
- warning("CreateTextBitmap(%d)", argv[0].toUint16());
- return NULL_REG;
- }
-}
-
-reg_t kDisposeTextBitmap(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxText32->disposeTextBitmap(argv[0]);
- return s->r_acc;
-}
-
-reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv) {
- uint16 windowsOption = argv[0].toUint16();
- switch (windowsOption) {
- case 0:
- // Title bar on/off in Phantasmagoria, we return 0 (off)
- return NULL_REG;
- default:
- warning("GetWindowsOption: Unknown option %d", windowsOption);
- return NULL_REG;
- }
-}
-
-reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) {
- switch (argv[0].toUint16()) {
- case 1:
- // Load a help file
- // Maybe in the future we can implement this, but for now this message should suffice
- showScummVMDialog("Please use an external viewer to open the game's help file: " + s->_segMan->getString(argv[1]));
- break;
- case 2:
- // Looks like some init function
- break;
- default:
- warning("Unknown kWinHelp subop %d", argv[0].toUint16());
- }
-
- 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.
- */
-reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
- // Can be called with 7 or 8 parameters
- // The style defines which transition to perform. Related to the transition
- // tables inside graphics/transitions.cpp
- uint16 showStyle = argv[0].toUint16(); // 0 - 15
- reg_t planeObj = argv[1]; // the affected plane
- 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;
- if (hasFadeArray) {
- // argv[7]
- divisions = (argc >= 9) ? argv[8].toSint16() : -1; // divisions (transition steps?)
- } else {
- 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
-
- 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;
-}
-
-reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
- // Used by Shivers 1, room 23601 to determine what blocks on the red door puzzle board
- // are occupied by pieces already
-
- switch (argv[0].toUint16()) { // subops 0 - 4
- // 0 - return the view
- // 1 - return the loop
- // 2, 3 - nop
- case 4: {
- GuiResourceId viewId = argv[1].toSint16();
- int16 loopNo = argv[2].toSint16();
- int16 celNo = argv[3].toSint16();
- int16 x = argv[4].toUint16();
- int16 y = argv[5].toUint16();
- byte color = g_sci->_gfxCache->kernelViewGetColorAtCoordinate(viewId, loopNo, celNo, x, y);
- return make_reg(0, color);
+ case 0: { // remap by percent
+ uint16 percent = argv[1].toUint16();
+ g_sci->_gfxPalette->resetRemapping();
+ g_sci->_gfxPalette->setRemappingPercent(254, percent);
}
- default: {
- kStub(s, argc, argv);
- return s->r_acc;
- }
- }
-}
-
-reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv) {
- // Used by Phantasmagoria 1 and SQ6. In SQ6, it is used for the messages
- // shown in the scroll window at the bottom of the screen.
-
- // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
- kStub(s, argc, argv);
-
- switch (argv[0].toUint16()) {
- case 0: // Init
- // 2 parameters
- // argv[1] points to the scroll object (e.g. textScroller in SQ6)
- // argv[2] is an integer (e.g. 0x32)
- break;
- case 1: // Show message
- // 5 or 6 parameters
- // Seems to be called with 5 parameters when the narrator speaks, and
- // with 6 when Roger speaks
- // argv[1] unknown (usually 0)
- // argv[2] the text to show
- // argv[3] a small integer (e.g. 0x32)
- // argv[4] a small integer (e.g. 0x54)
- // argv[5] optional, unknown (usually 0)
- warning("kScrollWindow: '%s'", s->_segMan->getString(argv[2]).c_str());
- break;
- case 2: // Clear
- // 2 parameters
- // TODO
- break;
- case 3: // Page up
- // 2 parameters
- // TODO
- break;
- case 4: // Page down
- // 2 parameters
- // TODO
- break;
- case 5: // Up arrow
- // 2 parameters
- // TODO
- break;
- case 6: // Down arrow
- // 2 parameters
- // TODO
- break;
- case 7: // Home
- // 2 parameters
- // TODO
- break;
- case 8: // End
- // 2 parameters
- // TODO
- break;
- case 9: // Resize
- // 3 parameters
- // TODO
- break;
- case 10: // Where
- // 3 parameters
- // TODO
- break;
- case 11: // Go
- // 4 parameters
- // TODO
- break;
- case 12: // Insert
- // 7 parameters
- // TODO
break;
- case 13: // Delete
- // 3 parameters
- // TODO
- break;
- case 14: // Modify
- // 7 or 8 parameters
- // TODO
- break;
- case 15: // Hide
- // 2 parameters
- // TODO
- break;
- case 16: // Show
- // 2 parameters
- // TODO
- break;
- case 17: // Destroy
- // 2 parameters
- // TODO
- break;
- case 18: // Text
- // 2 parameters
- // TODO
- break;
- case 19: // Reconstruct
- // 3 parameters
- // TODO
- break;
- default:
- error("kScrollWindow: unknown subop %d", argv[0].toUint16());
- break;
- }
-
- return s->r_acc;
-}
-
-reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv) {
- // TODO: This defines the resolution that the fonts are supposed to be displayed
- // in. Currently, this is only used for showing high-res fonts in GK1 Mac, but
- // should be extended to handle other font resolutions such as those
-
- int xResolution = argv[0].toUint16();
- //int yResolution = argv[1].toUint16();
-
- g_sci->_gfxScreen->setFontIsUpscaled(xResolution == 640 &&
- g_sci->_gfxScreen->getUpscaledHires() != GFX_SCREEN_UPSCALED_DISABLED);
-
- return s->r_acc;
-}
-
-reg_t kFont(EngineState *s, int argc, reg_t *argv) {
- // Handle font settings for SCI2.1
-
- switch (argv[0].toUint16()) {
- case 1:
- // Set font resolution
- return kSetFontRes(s, argc - 1, argv + 1);
- default:
- warning("kFont: unknown subop %d", argv[0].toUint16());
- }
-
- return s->r_acc;
-}
-
-// TODO: Eventually, all of the kBitmap operations should be put
-// in a separate class
-
-#define BITMAP_HEADER_SIZE 46
-
-reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
- // Used for bitmap operations in SCI2.1 and SCI3.
- // This is the SCI2.1 version, the functionality seems to have changed in SCI3.
-
- switch (argv[0].toUint16()) {
- case 0: // init bitmap surface
- {
- // 6 params, called e.g. from TextView::init() in Torin's Passage,
- // script 64890 and TransView::init() in script 64884
- uint16 width = argv[1].toUint16();
- uint16 height = argv[2].toUint16();
- //uint16 skip = argv[3].toUint16();
- uint16 back = argv[4].toUint16(); // usually equals skip
- //uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
- //uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
- //uint16 transparentFlag = (argc >= 8) ? argv[7].toUint16() : 0;
-
- // TODO: skip, width2, height2, transparentFlag
- // (used for transparent bitmaps)
- int entrySize = width * height + BITMAP_HEADER_SIZE;
- reg_t memoryId = s->_segMan->allocateHunkEntry("Bitmap()", entrySize);
- byte *memoryPtr = s->_segMan->getHunkPointer(memoryId);
- memset(memoryPtr, 0, BITMAP_HEADER_SIZE); // zero out the bitmap header
- memset(memoryPtr + BITMAP_HEADER_SIZE, back, width * height);
- // Save totalWidth, totalHeight
- // TODO: Save the whole bitmap header, like SSCI does
- WRITE_LE_UINT16(memoryPtr, width);
- WRITE_LE_UINT16(memoryPtr + 2, height);
- return memoryId;
+ case 1: { // remap by range
+ uint16 from = argv[1].toUint16();
+ uint16 to = argv[2].toUint16();
+ uint16 base = argv[3].toUint16();
+ g_sci->_gfxPalette->resetRemapping();
+ g_sci->_gfxPalette->setRemappingRange(254, from, to, base);
}
break;
- case 1: // dispose text bitmap surface
- return kDisposeTextBitmap(s, argc - 1, argv + 1);
- case 2: // dispose bitmap surface, with extra param
- // 2 params, called e.g. from MenuItem::dispose in Torin's Passage,
- // script 64893
- warning("kBitmap(2), unk1 %d, bitmap ptr %04x:%04x", argv[1].toUint16(), PRINT_REG(argv[2]));
- break;
- case 3: // tiled surface
- {
- // 6 params, called e.g. from TiledBitmap::resize() in Torin's Passage,
- // script 64869
- reg_t hunkId = argv[1]; // obtained from kBitmap(0)
- // The tiled view seems to always have 2 loops.
- // These loops need to have 1 cel in loop 0 and 8 cels in loop 1.
- uint16 viewNum = argv[2].toUint16(); // vTiles selector
- uint16 loop = argv[3].toUint16();
- uint16 cel = argv[4].toUint16();
- uint16 x = argv[5].toUint16();
- uint16 y = argv[6].toUint16();
-
- byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
- // Get totalWidth, totalHeight
- uint16 totalWidth = READ_LE_UINT16(memoryPtr);
- uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
- byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
-
- GfxView *view = g_sci->_gfxCache->getView(viewNum);
- uint16 tileWidth = view->getWidth(loop, cel);
- uint16 tileHeight = view->getHeight(loop, cel);
- const byte *tileBitmap = view->getBitmap(loop, cel);
- uint16 width = MIN<uint16>(totalWidth - x, tileWidth);
- uint16 height = MIN<uint16>(totalHeight - y, tileHeight);
-
- for (uint16 curY = 0; curY < height; curY++) {
- for (uint16 curX = 0; curX < width; curX++) {
- bitmap[(curY + y) * totalWidth + (curX + x)] = tileBitmap[curY * tileWidth + curX];
- }
- }
-
- }
- break;
- case 4: // add text to bitmap
- {
- // 13 params, called e.g. from TextButton::createBitmap() in Torin's Passage,
- // script 64894
- reg_t hunkId = argv[1]; // obtained from kBitmap(0)
- Common::String text = s->_segMan->getString(argv[2]);
- uint16 textX = argv[3].toUint16();
- uint16 textY = argv[4].toUint16();
- //reg_t unk5 = argv[5];
- //reg_t unk6 = argv[6];
- //reg_t unk7 = argv[7]; // skip?
- //reg_t unk8 = argv[8]; // back?
- //reg_t unk9 = argv[9];
- uint16 fontId = argv[10].toUint16();
- //uint16 mode = argv[11].toUint16();
- uint16 dimmed = argv[12].toUint16();
- //warning("kBitmap(4): bitmap ptr %04x:%04x, font %d, mode %d, dimmed %d - text: \"%s\"",
- // PRINT_REG(bitmapPtr), font, mode, dimmed, text.c_str());
- uint16 foreColor = 255; // TODO
-
- byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
- // Get totalWidth, totalHeight
- uint16 totalWidth = READ_LE_UINT16(memoryPtr);
- uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
- byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
-
- GfxFont *font = g_sci->_gfxCache->getFont(fontId);
-
- int16 charCount = 0;
- uint16 curX = textX, curY = textY;
- const char *txt = text.c_str();
-
- while (*txt) {
- charCount = g_sci->_gfxText32->GetLongest(txt, totalWidth, font);
- if (charCount == 0)
- break;
-
- for (int i = 0; i < charCount; i++) {
- unsigned char curChar = txt[i];
- font->drawToBuffer(curChar, curY, curX, foreColor, dimmed, bitmap, totalWidth, totalHeight);
- curX += font->getCharWidth(curChar);
- }
-
- curX = textX;
- curY += font->getHeight();
- txt += charCount;
- while (*txt == ' ')
- txt++; // skip over breaking spaces
- }
-
- }
- break;
- case 5: // fill with color
- {
- // 6 params, called e.g. from TextView::init() and TextView::draw()
- // in Torin's Passage, script 64890
- reg_t hunkId = argv[1]; // obtained from kBitmap(0)
- uint16 x = argv[2].toUint16();
- uint16 y = argv[3].toUint16();
- uint16 fillWidth = argv[4].toUint16(); // width - 1
- uint16 fillHeight = argv[5].toUint16(); // height - 1
- uint16 back = argv[6].toUint16();
-
- byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
- // Get totalWidth, totalHeight
- uint16 totalWidth = READ_LE_UINT16(memoryPtr);
- uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
- uint16 width = MIN<uint16>(totalWidth - x, fillWidth);
- uint16 height = MIN<uint16>(totalHeight - y, fillHeight);
- byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
-
- for (uint16 curY = 0; curY < height; curY++) {
- for (uint16 curX = 0; curX < width; curX++) {
- bitmap[(curY + y) * totalWidth + (curX + x)] = back;
- }
- }
-
- }
+ case 2: // turn remapping off (unused)
+ error("Unused subop kRemapColors(2) has been called");
break;
default:
- kStub(s, argc, argv);
break;
}
return s->r_acc;
}
-// Used for edit boxes in save/load dialogs. It's a rewritten version of kEditControl,
-// but it handles events on its own, using an internal loop, instead of using SCI
-// scripts for event management like kEditControl does. Called by script 64914,
-// DEdit::hilite().
-reg_t kEditText(EngineState *s, int argc, reg_t *argv) {
- reg_t controlObject = argv[0];
-
- if (!controlObject.isNull()) {
- g_sci->_gfxControls32->kernelTexteditChange(controlObject);
- }
-
- return s->r_acc;
-}
-
-#endif
-
} // End of namespace Sci
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
new file mode 100644
index 0000000000..8b3afeef99
--- /dev/null
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -0,0 +1,812 @@
+/* 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/system.h"
+
+#include "engines/util.h"
+#include "graphics/cursorman.h"
+#include "graphics/surface.h"
+
+#include "gui/message.h"
+
+#include "sci/sci.h"
+#include "sci/event.h"
+#include "sci/resource.h"
+#include "sci/engine/features.h"
+#include "sci/engine/state.h"
+#include "sci/engine/selector.h"
+#include "sci/engine/kernel.h"
+#include "sci/graphics/animate.h"
+#include "sci/graphics/cache.h"
+#include "sci/graphics/compare.h"
+#include "sci/graphics/controls16.h"
+#include "sci/graphics/coordadjuster.h"
+#include "sci/graphics/cursor.h"
+#include "sci/graphics/palette.h"
+#include "sci/graphics/paint16.h"
+#include "sci/graphics/picture.h"
+#include "sci/graphics/ports.h"
+#include "sci/graphics/screen.h"
+#include "sci/graphics/text16.h"
+#include "sci/graphics/view.h"
+#ifdef ENABLE_SCI32
+#include "sci/graphics/controls32.h"
+#include "sci/graphics/font.h" // TODO: remove once kBitmap is moved in a separate class
+#include "sci/graphics/text32.h"
+#include "sci/graphics/frameout.h"
+#endif
+
+namespace Sci {
+#ifdef ENABLE_SCI32
+
+extern void showScummVMDialog(const Common::String &message);
+
+reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv) {
+ // Returns 0 if the screen width or height is less than 640 or 400,
+ // respectively.
+ if (g_system->getWidth() < 640 || g_system->getHeight() < 400)
+ return make_reg(0, 0);
+
+ return make_reg(0, 1);
+}
+
+// SCI32 variant, can't work like sci16 variants
+reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv) {
+ // TODO
+// reg_t curObject = argv[0];
+// reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
+
+ return NULL_REG;
+}
+
+reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) {
+ if (g_sci->_gfxFrameout->findScreenItem(argv[0]) == NULL)
+ g_sci->_gfxFrameout->kernelAddScreenItem(argv[0]);
+ else
+ g_sci->_gfxFrameout->kernelUpdateScreenItem(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxFrameout->kernelUpdateScreenItem(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxFrameout->kernelDeleteScreenItem(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxFrameout->kernelAddPlane(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxFrameout->kernelDeletePlane(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxFrameout->kernelUpdatePlane(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
+ reg_t planeObj = argv[0];
+ GuiResourceId pictureId = argv[1].toUint16();
+ int16 pictureX = argv[2].toSint16();
+ int16 pictureY = argv[3].toSint16();
+
+ g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, pictureX, pictureY);
+ return s->r_acc;
+}
+
+reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
+ return make_reg(0, g_sci->_gfxFrameout->kernelGetHighPlanePri());
+}
+
+reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxFrameout->kernelFrameout();
+ return NULL_REG;
+}
+
+reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv) {
+ Common::Rect objRect1 = g_sci->_gfxCompare->getNSRect(argv[0]);
+ Common::Rect objRect2 = g_sci->_gfxCompare->getNSRect(argv[1]);
+ return make_reg(0, objRect1.intersects(objRect2));
+}
+
+// Tests if the coordinate is on the passed object
+reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
+ uint16 x = argv[0].toUint16();
+ uint16 y = argv[1].toUint16();
+ reg_t targetObject = argv[2];
+ uint16 illegalBits = argv[3].getOffset();
+ Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
+
+ // we assume that x, y are local coordinates
+
+ bool contained = nsRect.contains(x, y);
+ if (contained && illegalBits) {
+ // If illegalbits are set, we check the color of the pixel that got clicked on
+ // for now, we return false if the pixel is transparent
+ // although illegalBits may get differently set, don't know yet how this really works out
+ uint16 viewId = readSelectorValue(s->_segMan, targetObject, SELECTOR(view));
+ int16 loopNo = readSelectorValue(s->_segMan, targetObject, SELECTOR(loop));
+ int16 celNo = readSelectorValue(s->_segMan, targetObject, SELECTOR(cel));
+ if (g_sci->_gfxCompare->kernelIsItSkip(viewId, loopNo, celNo, Common::Point(x - nsRect.left, y - nsRect.top)))
+ contained = false;
+ }
+ return make_reg(0, contained);
+}
+
+reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
+ switch (argv[0].toUint16()) {
+ case 0: {
+ if (argc != 4) {
+ warning("kCreateTextBitmap(0): expected 4 arguments, got %i", argc);
+ return NULL_REG;
+ }
+ reg_t object = argv[3];
+ Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ debugC(kDebugLevelStrings, "kCreateTextBitmap case 0 (%04x:%04x, %04x:%04x, %04x:%04x)",
+ PRINT_REG(argv[1]), PRINT_REG(argv[2]), PRINT_REG(argv[3]));
+ debugC(kDebugLevelStrings, "%s", text.c_str());
+ int16 maxWidth = argv[1].toUint16();
+ int16 maxHeight = argv[2].toUint16();
+ g_sci->_gfxCoordAdjuster->fromScriptToDisplay(maxHeight, maxWidth);
+ // These values can be larger than the screen in the SQ6 demo, room 100
+ // TODO: Find out why. For now, don't show any text in that room.
+ if (g_sci->getGameId() == GID_SQ6 && g_sci->isDemo() && s->currentRoomNumber() == 100)
+ return NULL_REG;
+ return g_sci->_gfxText32->createTextBitmap(object, maxWidth, maxHeight);
+ }
+ case 1: {
+ if (argc != 2) {
+ warning("kCreateTextBitmap(1): expected 2 arguments, got %i", argc);
+ return NULL_REG;
+ }
+ reg_t object = argv[1];
+ Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ debugC(kDebugLevelStrings, "kCreateTextBitmap case 1 (%04x:%04x)", PRINT_REG(argv[1]));
+ debugC(kDebugLevelStrings, "%s", text.c_str());
+ return g_sci->_gfxText32->createTextBitmap(object);
+ }
+ default:
+ warning("CreateTextBitmap(%d)", argv[0].toUint16());
+ return NULL_REG;
+ }
+}
+
+reg_t kDisposeTextBitmap(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxText32->disposeTextBitmap(argv[0]);
+ return s->r_acc;
+}
+
+reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) {
+ switch (argv[0].toUint16()) {
+ case 1:
+ // Load a help file
+ // Maybe in the future we can implement this, but for now this message should suffice
+ showScummVMDialog("Please use an external viewer to open the game's help file: " + s->_segMan->getString(argv[1]));
+ break;
+ case 2:
+ // Looks like some init function
+ break;
+ default:
+ warning("Unknown kWinHelp subop %d", argv[0].toUint16());
+ }
+
+ return s->r_acc;
+}
+
+/**
+ * Used for scene transitions, replacing (but reusing parts of) the old
+ * transition code.
+ */
+reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
+ // Can be called with 7 or 8 parameters
+ // The style defines which transition to perform. Related to the transition
+ // tables inside graphics/transitions.cpp
+ uint16 showStyle = argv[0].toUint16(); // 0 - 15
+ reg_t planeObj = argv[1]; // the affected plane
+ Common::String planeObjName = s->_segMan->getObjectName(planeObj);
+ 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;
+ if (hasFadeArray) {
+ // argv[7]
+ divisions = (argc >= 9) ? argv[8].toSint16() : -1; // divisions (transition steps?)
+ } else {
+ 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;
+ }
+
+ // GK1 calls fadeout (13) / fadein (14) with the following parameters:
+ // seconds: 1
+ // backColor: 0 / -1
+ // fade: 200
+ // animate: 0
+ // refFrame: 0
+ // divisions: 0 / 20
+
+ // TODO: Check if the plane is in the list of planes to draw
+
+ Common::String effectName = "unknown";
+
+ switch (showStyle) {
+ case 0: // no transition / show
+ effectName = "show";
+ break;
+ case 13: // fade out
+ effectName = "fade out";
+ // TODO
+ break;
+ case 14: // fade in
+ effectName = "fade in";
+ // TODO
+ break;
+ default:
+ // TODO
+ break;
+ }
+
+ warning("kSetShowStyle: effect %d (%s) - plane: %04x:%04x (%s), sec: %d, "
+ "back: %d, prio: %d, animate: %d, ref frame: %d, divisions: %d",
+ showStyle, effectName.c_str(), PRINT_REG(planeObj), planeObjName.c_str(),
+ seconds, backColor, priority, animate, refFrame, divisions);
+ return s->r_acc;
+}
+
+reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
+ // Used by Shivers 1, room 23601 to determine what blocks on the red door puzzle board
+ // are occupied by pieces already
+
+ switch (argv[0].toUint16()) { // subops 0 - 4
+ // 0 - return the view
+ // 1 - return the loop
+ // 2, 3 - nop
+ case 4: {
+ GuiResourceId viewId = argv[1].toSint16();
+ int16 loopNo = argv[2].toSint16();
+ int16 celNo = argv[3].toSint16();
+ int16 x = argv[4].toUint16();
+ int16 y = argv[5].toUint16();
+ byte color = g_sci->_gfxCache->kernelViewGetColorAtCoordinate(viewId, loopNo, celNo, x, y);
+ return make_reg(0, color);
+ }
+ default: {
+ kStub(s, argc, argv);
+ return s->r_acc;
+ }
+ }
+}
+
+reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv) {
+ // Used by SQ6 and LSL6 hires for the text area in the bottom of the
+ // screen. The relevant scripts also exist in Phantasmagoria 1, but they're
+ // unused. This is always called by scripts 64906 (ScrollerWindow) and
+ // 64907 (ScrollableWindow).
+
+ reg_t kWindow = argv[1];
+ uint16 op = argv[0].toUint16();
+ switch (op) {
+ case 0: // Init
+ g_sci->_gfxFrameout->initScrollText(argv[2].toUint16()); // maxItems
+ g_sci->_gfxFrameout->clearScrollTexts();
+ return argv[1]; // kWindow
+ case 1: // Show message, called by ScrollableWindow::addString
+ case 14: // Modify message, called by ScrollableWindow::modifyString
+ // 5 or 6 parameters
+ // Seems to be called with 5 parameters when the narrator speaks, and
+ // with 6 when Roger speaks
+ {
+ Common::String text = s->_segMan->getString(argv[2]);
+ uint16 x = 0;//argv[3].toUint16(); // TODO: can't be x (values are all wrong)
+ uint16 y = 0;//argv[4].toUint16(); // TODO: can't be y (values are all wrong)
+ // TODO: argv[5] is an optional unknown parameter (an integer set to 0)
+ g_sci->_gfxFrameout->addScrollTextEntry(text, kWindow, x, y, (op == 14));
+ }
+ break;
+ case 2: // Clear, called by ScrollableWindow::erase
+ g_sci->_gfxFrameout->clearScrollTexts();
+ break;
+ case 3: // Page up, called by ScrollableWindow::scrollTo
+ // TODO
+ kStub(s, argc, argv);
+ break;
+ case 4: // Page down, called by ScrollableWindow::scrollTo
+ // TODO
+ kStub(s, argc, argv);
+ break;
+ case 5: // Up arrow, called by ScrollableWindow::scrollTo
+ g_sci->_gfxFrameout->prevScrollText();
+ break;
+ case 6: // Down arrow, called by ScrollableWindow::scrollTo
+ g_sci->_gfxFrameout->nextScrollText();
+ break;
+ case 7: // Home, called by ScrollableWindow::scrollTo
+ g_sci->_gfxFrameout->firstScrollText();
+ break;
+ case 8: // End, called by ScrollableWindow::scrollTo
+ g_sci->_gfxFrameout->lastScrollText();
+ break;
+ case 9: // Resize, called by ScrollableWindow::resize and ScrollerWindow::resize
+ // TODO
+ kStub(s, argc, argv);
+ break;
+ case 10: // Where, called by ScrollableWindow::where
+ // TODO
+ // argv[2] is an unknown integer
+ // Silenced the warnings because of the high amount of console spam
+ //kStub(s, argc, argv);
+ break;
+ case 11: // Go, called by ScrollableWindow::scrollTo
+ // 2 extra parameters here
+ // TODO
+ kStub(s, argc, argv);
+ break;
+ case 12: // Insert, called by ScrollableWindow::insertString
+ // 3 extra parameters here
+ // TODO
+ kStub(s, argc, argv);
+ break;
+ // case 13 (Delete) is handled below
+ // case 14 (Modify) is handled above
+ case 15: // Hide, called by ScrollableWindow::hide
+ g_sci->_gfxFrameout->toggleScrollText(false);
+ break;
+ case 16: // Show, called by ScrollableWindow::show
+ g_sci->_gfxFrameout->toggleScrollText(true);
+ break;
+ case 17: // Destroy, called by ScrollableWindow::dispose
+ g_sci->_gfxFrameout->clearScrollTexts();
+ break;
+ case 13: // Delete, unused
+ case 18: // Text, unused
+ case 19: // Reconstruct, unused
+ error("kScrollWindow: Unused subop %d invoked", op);
+ break;
+ default:
+ error("kScrollWindow: unknown subop %d", op);
+ break;
+ }
+
+ return s->r_acc;
+}
+
+reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv) {
+ // TODO: This defines the resolution that the fonts are supposed to be displayed
+ // in. Currently, this is only used for showing high-res fonts in GK1 Mac, but
+ // should be extended to handle other font resolutions such as those
+
+ int xResolution = argv[0].toUint16();
+ //int yResolution = argv[1].toUint16();
+
+ g_sci->_gfxScreen->setFontIsUpscaled(xResolution == 640 &&
+ g_sci->_gfxScreen->getUpscaledHires() != GFX_SCREEN_UPSCALED_DISABLED);
+
+ return s->r_acc;
+}
+
+reg_t kFont(EngineState *s, int argc, reg_t *argv) {
+ // Handle font settings for SCI2.1
+
+ switch (argv[0].toUint16()) {
+ case 1:
+ // Set font resolution
+ return kSetFontRes(s, argc - 1, argv + 1);
+ default:
+ warning("kFont: unknown subop %d", argv[0].toUint16());
+ }
+
+ return s->r_acc;
+}
+
+// TODO: Eventually, all of the kBitmap operations should be put
+// in a separate class
+
+#define BITMAP_HEADER_SIZE 46
+
+reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
+ // Used for bitmap operations in SCI2.1 and SCI3.
+ // This is the SCI2.1 version, the functionality seems to have changed in SCI3.
+
+ switch (argv[0].toUint16()) {
+ case 0: // init bitmap surface
+ {
+ // 6 params, called e.g. from TextView::init() in Torin's Passage,
+ // script 64890 and TransView::init() in script 64884
+ uint16 width = argv[1].toUint16();
+ uint16 height = argv[2].toUint16();
+ //uint16 skip = argv[3].toUint16();
+ uint16 back = argv[4].toUint16(); // usually equals skip
+ //uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
+ //uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
+ //uint16 transparentFlag = (argc >= 8) ? argv[7].toUint16() : 0;
+
+ // TODO: skip, width2, height2, transparentFlag
+ // (used for transparent bitmaps)
+ int entrySize = width * height + BITMAP_HEADER_SIZE;
+ reg_t memoryId = s->_segMan->allocateHunkEntry("Bitmap()", entrySize);
+ byte *memoryPtr = s->_segMan->getHunkPointer(memoryId);
+ memset(memoryPtr, 0, BITMAP_HEADER_SIZE); // zero out the bitmap header
+ memset(memoryPtr + BITMAP_HEADER_SIZE, back, width * height);
+ // Save totalWidth, totalHeight
+ // TODO: Save the whole bitmap header, like SSCI does
+ WRITE_LE_UINT16(memoryPtr, width);
+ WRITE_LE_UINT16(memoryPtr + 2, height);
+ return memoryId;
+ }
+ break;
+ case 1: // dispose text bitmap surface
+ return kDisposeTextBitmap(s, argc - 1, argv + 1);
+ case 2: // dispose bitmap surface, with extra param
+ // 2 params, called e.g. from MenuItem::dispose in Torin's Passage,
+ // script 64893
+ warning("kBitmap(2), unk1 %d, bitmap ptr %04x:%04x", argv[1].toUint16(), PRINT_REG(argv[2]));
+ break;
+ case 3: // tiled surface
+ {
+ // 6 params, called e.g. from TiledBitmap::resize() in Torin's Passage,
+ // script 64869
+ reg_t hunkId = argv[1]; // obtained from kBitmap(0)
+ // The tiled view seems to always have 2 loops.
+ // These loops need to have 1 cel in loop 0 and 8 cels in loop 1.
+ uint16 viewNum = argv[2].toUint16(); // vTiles selector
+ uint16 loop = argv[3].toUint16();
+ uint16 cel = argv[4].toUint16();
+ uint16 x = argv[5].toUint16();
+ uint16 y = argv[6].toUint16();
+
+ byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
+ // Get totalWidth, totalHeight
+ uint16 totalWidth = READ_LE_UINT16(memoryPtr);
+ uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+
+ GfxView *view = g_sci->_gfxCache->getView(viewNum);
+ uint16 tileWidth = view->getWidth(loop, cel);
+ uint16 tileHeight = view->getHeight(loop, cel);
+ const byte *tileBitmap = view->getBitmap(loop, cel);
+ uint16 width = MIN<uint16>(totalWidth - x, tileWidth);
+ uint16 height = MIN<uint16>(totalHeight - y, tileHeight);
+
+ for (uint16 curY = 0; curY < height; curY++) {
+ for (uint16 curX = 0; curX < width; curX++) {
+ bitmap[(curY + y) * totalWidth + (curX + x)] = tileBitmap[curY * tileWidth + curX];
+ }
+ }
+
+ }
+ break;
+ case 4: // add text to bitmap
+ {
+ // 13 params, called e.g. from TextButton::createBitmap() in Torin's Passage,
+ // script 64894
+ reg_t hunkId = argv[1]; // obtained from kBitmap(0)
+ Common::String text = s->_segMan->getString(argv[2]);
+ uint16 textX = argv[3].toUint16();
+ uint16 textY = argv[4].toUint16();
+ //reg_t unk5 = argv[5];
+ //reg_t unk6 = argv[6];
+ //reg_t unk7 = argv[7]; // skip?
+ //reg_t unk8 = argv[8]; // back?
+ //reg_t unk9 = argv[9];
+ uint16 fontId = argv[10].toUint16();
+ //uint16 mode = argv[11].toUint16();
+ uint16 dimmed = argv[12].toUint16();
+ //warning("kBitmap(4): bitmap ptr %04x:%04x, font %d, mode %d, dimmed %d - text: \"%s\"",
+ // PRINT_REG(bitmapPtr), font, mode, dimmed, text.c_str());
+ uint16 foreColor = 255; // TODO
+
+ byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
+ // Get totalWidth, totalHeight
+ uint16 totalWidth = READ_LE_UINT16(memoryPtr);
+ uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+
+ GfxFont *font = g_sci->_gfxCache->getFont(fontId);
+
+ int16 charCount = 0;
+ uint16 curX = textX, curY = textY;
+ const char *txt = text.c_str();
+
+ while (*txt) {
+ charCount = g_sci->_gfxText32->GetLongest(txt, totalWidth, font);
+ if (charCount == 0)
+ break;
+
+ for (int i = 0; i < charCount; i++) {
+ unsigned char curChar = txt[i];
+ font->drawToBuffer(curChar, curY, curX, foreColor, dimmed, bitmap, totalWidth, totalHeight);
+ curX += font->getCharWidth(curChar);
+ }
+
+ curX = textX;
+ curY += font->getHeight();
+ txt += charCount;
+ while (*txt == ' ')
+ txt++; // skip over breaking spaces
+ }
+
+ }
+ break;
+ case 5: // fill with color
+ {
+ // 6 params, called e.g. from TextView::init() and TextView::draw()
+ // in Torin's Passage, script 64890
+ reg_t hunkId = argv[1]; // obtained from kBitmap(0)
+ uint16 x = argv[2].toUint16();
+ uint16 y = argv[3].toUint16();
+ uint16 fillWidth = argv[4].toUint16(); // width - 1
+ uint16 fillHeight = argv[5].toUint16(); // height - 1
+ uint16 back = argv[6].toUint16();
+
+ byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
+ // Get totalWidth, totalHeight
+ uint16 totalWidth = READ_LE_UINT16(memoryPtr);
+ uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
+ uint16 width = MIN<uint16>(totalWidth - x, fillWidth);
+ uint16 height = MIN<uint16>(totalHeight - y, fillHeight);
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+
+ for (uint16 curY = 0; curY < height; curY++) {
+ for (uint16 curX = 0; curX < width; curX++) {
+ bitmap[(curY + y) * totalWidth + (curX + x)] = back;
+ }
+ }
+
+ }
+ break;
+ default:
+ kStub(s, argc, argv);
+ break;
+ }
+
+ return s->r_acc;
+}
+
+// Used for edit boxes in save/load dialogs. It's a rewritten version of kEditControl,
+// but it handles events on its own, using an internal loop, instead of using SCI
+// scripts for event management like kEditControl does. Called by script 64914,
+// DEdit::hilite().
+reg_t kEditText(EngineState *s, int argc, reg_t *argv) {
+ reg_t controlObject = argv[0];
+
+ if (!controlObject.isNull()) {
+ g_sci->_gfxControls32->kernelTexteditChange(controlObject);
+ }
+
+ return s->r_acc;
+}
+
+reg_t kAddLine(EngineState *s, int argc, reg_t *argv) {
+ reg_t plane = argv[0];
+ Common::Point startPoint(argv[1].toUint16(), argv[2].toUint16());
+ Common::Point endPoint(argv[3].toUint16(), argv[4].toUint16());
+ // argv[5] is unknown (a number, usually 200)
+ byte color = (byte)argv[6].toUint16();
+ byte priority = (byte)argv[7].toUint16();
+ byte control = (byte)argv[8].toUint16();
+ // argv[9] is unknown (usually a small number, 1 or 2). Thickness, perhaps?
+ return g_sci->_gfxFrameout->addPlaneLine(plane, startPoint, endPoint, color, priority, control);
+}
+
+reg_t kUpdateLine(EngineState *s, int argc, reg_t *argv) {
+ reg_t hunkId = argv[0];
+ reg_t plane = argv[1];
+ Common::Point startPoint(argv[2].toUint16(), argv[3].toUint16());
+ Common::Point endPoint(argv[4].toUint16(), argv[5].toUint16());
+ // argv[6] is unknown (a number, usually 200)
+ byte color = (byte)argv[7].toUint16();
+ byte priority = (byte)argv[8].toUint16();
+ byte control = (byte)argv[9].toUint16();
+ // argv[10] is unknown (usually a small number, 1 or 2). Thickness, perhaps?
+ g_sci->_gfxFrameout->updatePlaneLine(plane, hunkId, startPoint, endPoint, color, priority, control);
+ return s->r_acc;
+}
+reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv) {
+ reg_t hunkId = argv[0];
+ reg_t plane = argv[1];
+ g_sci->_gfxFrameout->deletePlaneLine(plane, hunkId);
+ return s->r_acc;
+}
+
+reg_t kSetScroll(EngineState *s, int argc, reg_t *argv) {
+ // Called in the intro of LSL6 hires (room 110)
+ // The end effect of this is the same as the old screen scroll transition
+
+ // 7 parameters
+ reg_t planeObject = argv[0];
+ //int16 x = argv[1].toSint16();
+ //int16 y = argv[2].toSint16();
+ uint16 pictureId = argv[3].toUint16();
+ // param 4: int (0 in LSL6, probably scroll direction? The picture in LSL6 scrolls down)
+ // param 5: int (first call is 1, then the subsequent one is 0 in LSL6)
+ // param 6: optional int (0 in LSL6)
+
+ // Set the new picture directly for now
+ //writeSelectorValue(s->_segMan, planeObject, SELECTOR(left), x);
+ //writeSelectorValue(s->_segMan, planeObject, SELECTOR(top), y);
+ writeSelectorValue(s->_segMan, planeObject, SELECTOR(picture), pictureId);
+ // and update our draw list
+ g_sci->_gfxFrameout->kernelUpdatePlane(planeObject);
+
+ // TODO
+ return kStub(s, argc, argv);
+}
+
+reg_t kPalCycle(EngineState *s, int argc, reg_t *argv) {
+ // Examples: GK1 room 480 (Bayou ritual), LSL6 room 100 (title screen)
+
+ switch (argv[0].toUint16()) {
+ case 0: { // Palette animation initialization
+ // 3 or 4 extra params
+ // Case 1 sends fromColor and speed again, so we don't need them here.
+ // Only toColor is stored
+ //uint16 fromColor = argv[1].toUint16();
+ s->_palCycleToColor = argv[2].toUint16();
+ //uint16 speed = argv[3].toUint16();
+
+ // Invalidate the picture, so that the palette steps calls (case 1
+ // below) can update its palette without it being overwritten by the
+ // view/picture palettes.
+ g_sci->_gfxScreen->_picNotValid = 1;
+
+ // TODO: The fourth optional parameter is an unknown integer, and is 0 by default
+ if (argc == 5) {
+ // When this variant is used, picNotValid doesn't seem to be set
+ // (e.g. GK1 room 480). In this case, the animation step calls are
+ // not made, so perhaps this signifies the palette cycling steps
+ // to make.
+ // GK1 sets this to 6 (6 palette steps?)
+ g_sci->_gfxScreen->_picNotValid = 0;
+ }
+ kStub(s, argc, argv);
+ }
+ break;
+ case 1: { // Palette animation step
+ // This is the same as the old kPaletteAnimate call, with 1 set of colors.
+ // The end color is set up during initialization in case 0 above.
+
+ // 1 or 2 extra params
+ uint16 fromColor = argv[1].toUint16();
+ uint16 speed = (argc == 2) ? 1 : argv[2].toUint16();
+ // TODO: For some reason, this doesn't set the color correctly
+ // (e.g. LSL6 intro, room 100, Sierra logo)
+ if (g_sci->_gfxPalette->kernelAnimate(fromColor, s->_palCycleToColor, speed))
+ g_sci->_gfxPalette->kernelAnimateSet();
+ }
+ // No kStub() call here, as this gets called loads of times, like kPaletteAnimate
+ break;
+ // case 2 hasn't been encountered
+ // case 3 hasn't been encountered
+ case 4: // reset any palette cycling and make the picture valid again
+ // Gets called when changing rooms and after palette cycling animations finish
+ // 0 or 1 extra params
+ if (argc == 1) {
+ g_sci->_gfxScreen->_picNotValid = 0;
+ // TODO: This also seems to perform more steps
+ } else {
+ // The variant with the 1 extra param resets remapping to base
+ // TODO
+ }
+ kStub(s, argc, argv);
+ break;
+ default:
+ // TODO
+ kStub(s, argc, argv);
+ break;
+ }
+
+ return s->r_acc;
+}
+
+reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) {
+ uint16 operation = argv[0].toUint16();
+
+ switch (operation) {
+ case 0: { // turn remapping off
+ // WORKAROUND: Game scripts in QFG4 erroneously turn remapping off in room
+ // 140 (the character point allocation screen) and never turn it back on,
+ // even if it's clearly used in that screen.
+ if (g_sci->getGameId() == GID_QFG4 && s->currentRoomNumber() == 140)
+ return s->r_acc;
+
+ int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
+ if (base > 0)
+ warning("kRemapColors(0) called with base %d", base);
+ g_sci->_gfxPalette->resetRemapping();
+ }
+ break;
+ case 1: { // remap by range
+ uint16 color = argv[1].toUint16();
+ uint16 from = argv[2].toUint16();
+ uint16 to = argv[3].toUint16();
+ uint16 base = argv[4].toUint16();
+ uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0;
+ if (unk5 > 0)
+ warning("kRemapColors(1) called with 6 parameters, unknown parameter is %d", unk5);
+ g_sci->_gfxPalette->setRemappingRange(color, from, to, base);
+ }
+ break;
+ case 2: { // remap by percent
+ uint16 color = argv[1].toUint16();
+ uint16 percent = argv[2].toUint16(); // 0 - 100
+ if (argc >= 4)
+ warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16());
+ g_sci->_gfxPalette->setRemappingPercent(color, percent);
+ }
+ break;
+ case 3: { // remap to gray
+ // Example call: QFG4 room 490 (Baba Yaga's hut) - params are color 253, 75% and 0.
+ // In this room, it's used for the cloud before Baba Yaga appears.
+ int16 color = argv[1].toSint16();
+ int16 percent = argv[2].toSint16(); // 0 - 100
+ if (argc >= 4)
+ warning("RemapToGray called with 4 parameters, unknown parameter is %d", argv[3].toUint16());
+ g_sci->_gfxPalette->setRemappingPercentGray(color, percent);
+ }
+ break;
+ case 4: { // remap to percent gray
+ // Example call: QFG4 rooms 530/535 (swamp) - params are 253, 100%, 200
+ int16 color = argv[1].toSint16();
+ int16 percent = argv[2].toSint16(); // 0 - 100
+ // argv[3] is unknown (a number, e.g. 200) - start color, perhaps?
+ if (argc >= 5)
+ warning("RemapToGrayPercent called with 5 parameters, unknown parameter is %d", argv[4].toUint16());
+ g_sci->_gfxPalette->setRemappingPercentGray(color, percent);
+ }
+ break;
+ case 5: { // don't map to range
+ //int16 mapping = argv[1].toSint16();
+ uint16 intensity = argv[2].toUint16();
+ // HACK for PQ4
+ if (g_sci->getGameId() == GID_PQ4)
+ g_sci->_gfxPalette->kernelSetIntensity(0, 255, intensity, true);
+
+ kStub(s, argc, argv);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return s->r_acc;
+}
+
+#endif
+
+} // End of namespace Sci
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 2a33df26bc..342fa95eda 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -409,10 +409,14 @@ int sort_temp_cmp(const void *p1, const void *p2) {
const sort_temp_t *st1 = (const sort_temp_t *)p1;
const sort_temp_t *st2 = (const sort_temp_t *)p2;
- if (st1->order.segment < st2->order.segment || (st1->order.segment == st2->order.segment && st1->order.offset < st2->order.offset))
+ if (st1->order.getSegment() < st2->order.getSegment() ||
+ (st1->order.getSegment() == st2->order.getSegment() &&
+ st1->order.getOffset() < st2->order.getOffset()))
return -1;
- if (st1->order.segment > st2->order.segment || (st1->order.segment == st2->order.segment && st1->order.offset > st2->order.offset))
+ if (st1->order.getSegment() > st2->order.getSegment() ||
+ (st1->order.getSegment() == st2->order.getSegment() &&
+ st1->order.getOffset() > st2->order.getOffset()))
return 1;
return 0;
@@ -502,6 +506,11 @@ reg_t kListAt(EngineState *s, int argc, reg_t *argv) {
curIndex++;
}
+ // Update the virtual file selected in the character import screen of QFG4.
+ // For the SCI0-SCI1.1 version of this, check kDrawControl().
+ if (g_sci->inQfGImportRoom() && !strcmp(s->_segMan->getObjectName(curObject), "SelectorDText"))
+ s->_chosenQfGImportItem = listIndex;
+
return curObject;
}
@@ -575,8 +584,11 @@ reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv) {
// First, check if the target selector is a variable
if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) {
- // Can this happen with variable selectors?
- error("kListFirstTrue: Attempted to access a variable selector");
+ // If it's a variable selector, check its value.
+ // Example: script 64893 in Torin, MenuHandler::isHilited checks
+ // all children for variable selector 0x03ba (bHilited).
+ if (!readSelector(s->_segMan, curObject, slc).isNull())
+ return curObject;
} else {
invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2);
@@ -609,16 +621,16 @@ reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv) {
// First, check if the target selector is a variable
if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) {
- // Can this happen with variable selectors?
- error("kListAllTrue: Attempted to access a variable selector");
+ // If it's a variable selector, check its value
+ s->r_acc = readSelector(s->_segMan, curObject, slc);
} else {
invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2);
-
- // Check if the result isn't true
- if (s->r_acc.isNull())
- break;
}
+ // Check if the result isn't true
+ if (s->r_acc.isNull())
+ break;
+
curNode = s->_segMan->lookupNode(nextNode);
}
@@ -662,15 +674,15 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
if (argv[2].toUint16() == 3)
return kString(s, argc, argv);
} else {
- if (s->_segMan->getSegmentType(argv[1].segment) == SEG_TYPE_STRING ||
- s->_segMan->getSegmentType(argv[1].segment) == SEG_TYPE_SCRIPT) {
+ if (s->_segMan->getSegmentType(argv[1].getSegment()) == SEG_TYPE_STRING ||
+ s->_segMan->getSegmentType(argv[1].getSegment()) == SEG_TYPE_SCRIPT) {
return kString(s, argc, argv);
}
#if 0
if (op == 6) {
- if (s->_segMan->getSegmentType(argv[3].segment) == SEG_TYPE_STRING ||
- s->_segMan->getSegmentType(argv[3].segment) == SEG_TYPE_SCRIPT) {
+ if (s->_segMan->getSegmentType(argv[3].getSegment()) == SEG_TYPE_STRING ||
+ s->_segMan->getSegmentType(argv[3].getSegment()) == SEG_TYPE_SCRIPT) {
return kString(s, argc, argv);
}
}
@@ -789,7 +801,7 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
#endif
return NULL_REG;
}
- if (s->_segMan->getSegmentObj(argv[1].segment)->getType() != SEG_TYPE_ARRAY)
+ if (s->_segMan->getSegmentObj(argv[1].getSegment())->getType() != SEG_TYPE_ARRAY)
error("kArray(Dup): Request to duplicate a segment which isn't an array");
reg_t arrayHandle;
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index 7570856dff..4b8fadbb84 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -77,7 +77,18 @@ reg_t kSqrt(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, (int16) sqrt((float) ABS(argv[0].toSint16())));
}
+/**
+ * Returns the angle (in degrees) between the two points determined by (x1, y1)
+ * and (x2, y2). The angle ranges from 0 to 359 degrees.
+ * What this function does is pretty simple but apparently the original is not
+ * accurate.
+ */
uint16 kGetAngleWorker(int16 x1, int16 y1, int16 x2, int16 y2) {
+ // SCI1 games (QFG2 and newer) use a simple atan implementation. SCI0 games
+ // use a somewhat less accurate calculation (below).
+ if (getSciVersion() >= SCI_VERSION_1_EGA_ONLY)
+ return (int16)(360 - atan2((double)(x1 - x2), (double)(y1 - y2)) * 57.2958) % 360;
+
int16 xRel = x2 - x1;
int16 yRel = y1 - y2; // y-axis is mirrored.
int16 angle;
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 02aa1d3ece..05ba7005d7 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -94,7 +94,7 @@ reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {
reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) {
reg_t eventObject = argv[0];
- bool pauseSound = argc > 1 ? (argv[1].isNull() ? false : true) : true;
+ bool pauseSound = argc <= 1 || !argv[1].isNull();
return g_sci->_gfxMenu->kernelSelect(eventObject, pauseSound);
}
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index a32480c168..8b7fc4ffec 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -128,7 +128,7 @@ reg_t kMemoryInfo(EngineState *s, int argc, reg_t *argv) {
// fragmented
const uint16 size = 0x7fea;
- switch (argv[0].offset) {
+ switch (argv[0].getOffset()) {
case K_MEMORYINFO_LARGEST_HEAP_BLOCK:
// In order to prevent "Memory fragmented" dialogs from
// popping up in some games, we must return FREE_HEAP - 2 here.
@@ -140,7 +140,7 @@ reg_t kMemoryInfo(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, size);
default:
- error("Unknown MemoryInfo operation: %04x", argv[0].offset);
+ error("Unknown MemoryInfo operation: %04x", argv[0].getOffset());
}
return NULL_REG;
@@ -304,7 +304,7 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
break;
}
case K_MEMORY_PEEK : {
- if (!argv[1].segment) {
+ if (!argv[1].getSegment()) {
// This occurs in KQ5CD when interacting with certain objects
warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
return s->r_acc;
@@ -334,11 +334,11 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
}
if (ref.isRaw) {
- if (argv[2].segment) {
+ if (argv[2].getSegment()) {
error("Attempt to poke memory reference %04x:%04x to %04x:%04x", PRINT_REG(argv[2]), PRINT_REG(argv[1]));
return s->r_acc;
}
- WRITE_SCIENDIAN_UINT16(ref.raw, argv[2].offset); // Amiga versions are BE
+ WRITE_SCIENDIAN_UINT16(ref.raw, argv[2].getOffset()); // Amiga versions are BE
} else {
if (ref.skipByte)
error("Attempt to poke memory at odd offset %04X:%04X", PRINT_REG(argv[1]));
@@ -356,10 +356,81 @@ reg_t kGetConfig(EngineState *s, int argc, reg_t *argv) {
Common::String setting = s->_segMan->getString(argv[0]);
reg_t data = readSelector(s->_segMan, argv[1], SELECTOR(data));
- warning("Get config setting %s", setting.c_str());
- s->_segMan->strcpy(data, "");
+ // This function is used to get the benchmarked results stored in the
+ // resource.cfg configuration file in Phantasmagoria 1. Normally,
+ // the configuration file contains values stored by the installer
+ // regarding audio and video settings, which are then used by the
+ // executable. In Phantasmagoria, two extra executable files are used
+ // to perform system benchmarks:
+ // - CPUID for the CPU benchmarks, sets the cpu and cpuspeed settings
+ // - HDDTEC for the graphics and CD-ROM benchmarks, sets the videospeed setting
+ //
+ // These settings are then used by the game scripts directly to modify
+ // the game speed and graphics output. The result of this call is stored
+ // in global 178. The scripts check these values against the value 425.
+ // Anything below that makes Phantasmagoria awfully sluggish, so we're
+ // setting everything to 500, which makes the game playable.
+
+ setting.toLowercase();
+
+ if (setting == "videospeed") {
+ s->_segMan->strcpy(data, "500");
+ } else if (setting == "cpu") {
+ // We always return the fastest CPU setting that CPUID can detect
+ // (i.e. 586).
+ s->_segMan->strcpy(data, "586");
+ } else if (setting == "cpuspeed") {
+ s->_segMan->strcpy(data, "500");
+ } else if (setting == "language") {
+ Common::String languageId = Common::String::format("%d", g_sci->getSciLanguage());
+ s->_segMan->strcpy(data, languageId.c_str());
+ } else if (setting == "torindebug") {
+ // Used to enable the debug mode in Torin's Passage (French).
+ // If true, the debug mode is enabled.
+ s->_segMan->strcpy(data, "");
+ } else if (setting == "leakdump") {
+ // An unknown setting in LSL7. Likely used for debugging.
+ s->_segMan->strcpy(data, "");
+ } else if (setting == "startroom") {
+ // Debug setting in LSL7, specifies the room to start from.
+ s->_segMan->strcpy(data, "");
+ } else {
+ error("GetConfig: Unknown configuration setting %s", setting.c_str());
+ }
+
return argv[1];
}
+
+// Likely modelled after the Windows 3.1 function GetPrivateProfileInt:
+// http://msdn.microsoft.com/en-us/library/windows/desktop/ms724345%28v=vs.85%29.aspx
+reg_t kGetSierraProfileInt(EngineState *s, int argc, reg_t *argv) {
+ Common::String category = s->_segMan->getString(argv[0]); // always "config"
+ category.toLowercase();
+ Common::String setting = s->_segMan->getString(argv[1]);
+ setting.toLowercase();
+ // The third parameter is the default value returned if the configuration key is missing
+
+ if (category == "config" && setting == "videospeed") {
+ // We return the same fake value for videospeed as with kGetConfig
+ return make_reg(0, 500);
+ }
+
+ warning("kGetSierraProfileInt: Returning default value %d for unknown setting %s.%s", argv[2].toSint16(), category.c_str(), setting.c_str());
+ return argv[2];
+}
+
+reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv) {
+ uint16 windowsOption = argv[0].toUint16();
+ switch (windowsOption) {
+ case 0:
+ // Title bar on/off in Phantasmagoria, we return 0 (off)
+ return NULL_REG;
+ default:
+ warning("GetWindowsOption: Unknown option %d", windowsOption);
+ return NULL_REG;
+ }
+}
+
#endif
// kIconBar is really a subop of kMacPlatform for SCI1.1 Mac
diff --git a/engines/sci/engine/kparse.cpp b/engines/sci/engine/kparse.cpp
index 59694cb6ee..5e861daaa4 100644
--- a/engines/sci/engine/kparse.cpp
+++ b/engines/sci/engine/kparse.cpp
@@ -48,7 +48,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) {
const int debug_parser = 0;
#endif
- if (!heap_said_block.segment)
+ if (!heap_said_block.getSegment())
return NULL_REG;
said_block = (byte *)s->_segMan->derefBulkPtr(heap_said_block, 0);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 089b325a7f..4061795f82 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -31,6 +31,9 @@
#include "common/debug-channels.h"
#include "common/list.h"
#include "common/system.h"
+#include "common/math.h"
+
+//#define DEBUG_MERGEPOLY
namespace Sci {
@@ -71,11 +74,25 @@ enum {
struct FloatPoint {
FloatPoint() : x(0), y(0) {}
FloatPoint(float x_, float y_) : x(x_), y(y_) {}
+ FloatPoint(Common::Point p) : x(p.x), y(p.y) {}
Common::Point toPoint() {
return Common::Point((int16)(x + 0.5), (int16)(y + 0.5));
}
+ float operator*(const FloatPoint &p) const {
+ return x*p.x + y*p.y;
+ }
+ FloatPoint operator*(float l) const {
+ return FloatPoint(l*x, l*y);
+ }
+ FloatPoint operator-(const FloatPoint &p) const {
+ return FloatPoint(x-p.x, y-p.y);
+ }
+ float norm() const {
+ return x*x+y*y;
+ }
+
float x, y;
};
@@ -135,15 +152,20 @@ public:
return _head;
}
- void insertHead(Vertex *elm) {
+ void insertAtEnd(Vertex *elm) {
if (_head == NULL) {
elm->_next = elm->_prev = elm;
+ _head = elm;
} else {
elm->_next = _head;
elm->_prev = _head->_prev;
_head->_prev = elm;
elm->_prev->_next = elm;
}
+ }
+
+ void insertHead(Vertex *elm) {
+ insertAtEnd(elm);
_head = elm;
}
@@ -367,7 +389,7 @@ static void draw_input(EngineState *s, reg_t poly_list, Common::Point start, Com
draw_point(s, start, 1, width, height);
draw_point(s, end, 0, width, height);
- if (!poly_list.segment)
+ if (!poly_list.getSegment())
return;
list = s->_segMan->lookupList(poly_list);
@@ -423,7 +445,7 @@ static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Co
debug("End point: (%i, %i)", end.x, end.y);
debug("Optimization level: %i", opt);
- if (!poly_list.segment)
+ if (!poly_list.getSegment())
return;
list = s->_segMan->lookupList(poly_list);
@@ -788,10 +810,10 @@ int PathfindingState::findNearPoint(const Common::Point &p, Polygon *polygon, Co
* including the vertices themselves)
* Parameters: (const Common::Point &) a, b: The line segment (a, b)
* (Vertex *) vertex: The first vertex of the edge
- * Returns : (int) FP_OK on success, PF_ERROR otherwise
+ * Returns : (int) PF_OK on success, PF_ERROR otherwise
* (FloatPoint) *ret: The intersection point
*/
-static int intersection(const Common::Point &a, const Common::Point &b, Vertex *vertex, FloatPoint *ret) {
+static int intersection(const Common::Point &a, const Common::Point &b, const Vertex *vertex, FloatPoint *ret) {
// Parameters of parametric equations
float s, t;
// Numerator and denominator of equations
@@ -1180,7 +1202,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
PathfindingState *pf_s = new PathfindingState(width, height);
// Convert all polygons
- if (poly_list.segment) {
+ if (poly_list.getSegment()) {
List *list = s->_segMan->lookupList(poly_list);
Node *node = s->_segMan->lookupNode(list->first);
@@ -1503,7 +1525,7 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) {
draw_point(s, start, 1, width, height);
draw_point(s, end, 0, width, height);
- if (poly_list.segment) {
+ if (poly_list.getSegment()) {
print_input(s, poly_list, start, end, opt);
draw_input(s, poly_list, start, end, opt, width, height);
}
@@ -1783,39 +1805,619 @@ reg_t kIntersections(EngineState *s, int argc, reg_t *argv) {
}
}
+// ==========================================================================
+// kMergePoly utility functions
+
+// Compute square of the distance of p to the segment a-b.
+static float pointSegDistance(const Common::Point &a, const Common::Point &b,
+ const Common::Point &p) {
+ FloatPoint ba(b-a);
+ FloatPoint pa(p-a);
+ FloatPoint bp(b-p);
+
+ // Check if the projection of p on the line a-b lies between a and b
+ if (ba*pa >= 0.0f && ba*bp >= 0.0f) {
+ // If yes, return the (squared) distance of p to the line a-b:
+ // translate a to origin, project p and subtract
+ float linedist = (ba*((ba*pa)/(ba*ba)) - pa).norm();
+
+ return linedist;
+ } else {
+ // If no, return the (squared) distance to either a or b, whichever
+ // is closest.
+
+ // distance to a:
+ float adist = pa.norm();
+ // distance to b:
+ float bdist = FloatPoint(p-b).norm();
+
+ return MIN(adist, bdist);
+ }
+}
+
+// find intersection between edges of two polygons.
+// endpoints count, except v2->_next
+static bool segSegIntersect(const Vertex *v1, const Vertex *v2, Common::Point &intp) {
+ const Common::Point &a = v1->v;
+ const Common::Point &b = v1->_next->v;
+ const Common::Point &c = v2->v;
+ const Common::Point &d = v2->_next->v;
+
+ // First handle the endpoint cases manually
+
+ if (collinear(a, b, c) && collinear(a, b, d))
+ return false;
+
+ if (collinear(a, b, c)) {
+ // a, b, c collinear
+ // return true/c if c is between a and b
+ intp = c;
+ if (a.x != b.x) {
+ if ((a.x <= c.x && c.x <= b.x) || (b.x <= c.x && c.x <= a.x))
+ return true;
+ } else {
+ if ((a.y <= c.y && c.y <= b.y) || (b.y <= c.y && c.y <= a.y))
+ return true;
+ }
+ }
+
+ if (collinear(a, b, d)) {
+ intp = d;
+ // a, b, d collinear
+ // return false/d if d is between a and b
+ if (a.x != b.x) {
+ if ((a.x <= d.x && d.x <= b.x) || (b.x <= d.x && d.x <= a.x))
+ return false;
+ } else {
+ if ((a.y <= d.y && d.y <= b.y) || (b.y <= d.y && d.y <= a.y))
+ return false;
+ }
+ }
+
+ int len_dc = c.sqrDist(d);
+
+ if (!len_dc) error("zero length edge in polygon");
+
+ if (pointSegDistance(c, d, a) <= 2.0f) {
+ intp = a;
+ return true;
+ }
+
+ if (pointSegDistance(c, d, b) <= 2.0f) {
+ intp = b;
+ return true;
+ }
+
+ // If not an endpoint, call the generic intersection function
+
+ FloatPoint p;
+ if (intersection(a, b, v2, &p) == PF_OK) {
+ intp = p.toPoint();
+ return true;
+ } else {
+ return false;
+ }
+}
+
+// For intersecting polygon segments, determine if
+// * the v2 edge enters polygon 1 at this intersection: positive return value
+// * the v2 edge and the v1 edges are parallel: zero return value
+// * the v2 edge exits polygon 1 at this intersection: negative return value
+static int intersectDir(const Vertex *v1, const Vertex *v2) {
+ Common::Point p1 = v1->_next->v - v1->v;
+ Common::Point p2 = v2->_next->v - v2->v;
+ return (p1.x*p2.y - p2.x*p1.y);
+}
+
+// Direction of edge in degrees from pos. x-axis, between -180 and 180
+static int edgeDir(const Vertex *v) {
+ Common::Point p = v->_next->v - v->v;
+ int deg = (int)Common::rad2deg(atan2((double)p.y, (double)p.x));
+ if (deg < -180) deg += 360;
+ if (deg > 180) deg -= 360;
+ return deg;
+}
+
+// For points p1, p2 on the polygon segment v, determine if
+// * p1 lies before p2: negative return value
+// * p1 and p2 are the same: zero return value
+// * p1 lies after p2: positive return value
+static int liesBefore(const Vertex *v, const Common::Point &p1, const Common::Point &p2) {
+ return v->v.sqrDist(p1) - v->v.sqrDist(p2);
+}
+
+// Structure describing an "extension" to the work polygon following edges
+// of the polygon being merged.
+
+// The patch begins on the point intersection1, being the intersection
+// of the edges starting at indexw1/vertexw1 on the work polygon, and at
+// indexp1/vertexp1 on the polygon being merged.
+// It ends with the point intersection2, being the analogous intersection.
+struct Patch {
+ unsigned int indexw1;
+ unsigned int indexp1;
+ const Vertex *vertexw1;
+ const Vertex *vertexp1;
+ Common::Point intersection1;
+
+ unsigned int indexw2;
+ unsigned int indexp2;
+ const Vertex *vertexw2;
+ const Vertex *vertexp2;
+ Common::Point intersection2;
+
+ bool disabled; // If true, this Patch was made superfluous by another Patch
+};
+
+
+// Check if the given vertex on the work polygon is bypassed by this patch.
+static bool isVertexCovered(const Patch &p, unsigned int wi) {
+
+ // / v (outside)
+ // ---w1--1----p----w2--2----
+ // ^ \ (inside)
+ if (wi > p.indexw1 && wi <= p.indexw2)
+ return true;
+
+ // v / (outside)
+ // ---w2--2----p----w1--1----
+ // \ ^ (inside)
+ if (p.indexw1 > p.indexw2 && (wi <= p.indexw2 || wi > p.indexw1))
+ return true;
+
+ // v / (outside)
+ // ---w1--2--1-------p-----
+ // w2 \ ^ (inside)
+ if (p.indexw1 == p.indexw2 && liesBefore(p.vertexw1, p.intersection1, p.intersection2) > 0)
+ return true; // This patch actually covers _all_ vertices on work
+
+ return false;
+}
+
+// Check if patch p1 makes patch p2 superfluous.
+static bool isPatchCovered(const Patch &p1, const Patch &p2) {
+
+ // Same exit and entry points
+ if (p1.intersection1 == p2.intersection1 && p1.intersection2 == p2.intersection2)
+ return true;
+
+ // / * v (outside)
+ // ---p1w1--1----p2w1-1---p1w2--2----
+ // ^ * \ (inside)
+ if (p1.indexw1 < p2.indexw1 && p2.indexw1 < p1.indexw2)
+ return true;
+ if (p1.indexw1 > p1.indexw2 && (p2.indexw1 > p1.indexw1 || p2.indexw1 < p1.indexw2))
+ return true;
+
+
+ // / * v (outside)
+ // ---p1w1--11----p2w2-2---p1w2--12----
+ // ^ * \ (inside)
+ if (p1.indexw1 < p2.indexw2 && p2.indexw2 < p1.indexw2)
+ return true;
+ if (p1.indexw1 > p1.indexw2 && (p2.indexw2 > p1.indexw1 || p2.indexw2 < p1.indexw2))
+ return true;
+
+ // Opposite of two above situations
+ if (p2.indexw1 < p1.indexw1 && p1.indexw1 < p2.indexw2)
+ return false;
+ if (p2.indexw1 > p2.indexw2 && (p1.indexw1 > p2.indexw1 || p1.indexw1 < p2.indexw2))
+ return false;
+
+ if (p2.indexw1 < p1.indexw2 && p1.indexw2 < p2.indexw2)
+ return false;
+ if (p2.indexw1 > p2.indexw2 && (p1.indexw2 > p2.indexw1 || p1.indexw2 < p2.indexw2))
+ return false;
+
+
+ // The above checks covered the cases where one patch covers the other and
+ // the intersections of the patches are on different edges.
+
+ // So, if we passed the above checks, we have to check the order of
+ // intersections on edges.
+
+
+ if (p1.indexw1 != p1.indexw2) {
+
+ // / * v (outside)
+ // ---p1w1--11---21--------p1w2--2----
+ // p2w1 ^ * \ (inside)
+ if (p1.indexw1 == p2.indexw1)
+ return (liesBefore(p1.vertexw1, p1.intersection1, p2.intersection1) < 0);
+
+ // / * v (outside)
+ // ---p1w1--11---------p1w2--21---12----
+ // ^ p2w1 * \ (inside)
+ if (p1.indexw2 == p2.indexw1)
+ return (liesBefore(p1.vertexw2, p1.intersection2, p2.intersection1) > 0);
+
+ // If neither of the above, then the intervals of the polygon
+ // covered by patch1 and patch2 are disjoint
+ return false;
+ }
+
+ // p1w1 == p1w2
+ // Also, p1w1/p1w2 isn't strictly between p2
+
+
+ // v / * (outside)
+ // ---p1w1--12--11-------p2w1-21----
+ // p1w2 \ ^ * (inside)
+
+ // v / / (outside)
+ // ---p1w1--12--21--11---------
+ // p1w2 \ ^ ^ (inside)
+ // p2w1
+ if (liesBefore(p1.vertexw1, p1.intersection1, p1.intersection2) > 0)
+ return (p1.indexw1 != p2.indexw1);
+
+ // CHECKME: This is meaningless if p2w1 != p2w2 ??
+ if (liesBefore(p2.vertexw1, p2.intersection1, p2.intersection2) > 0)
+ return false;
+
+ // CHECKME: This is meaningless if p1w1 != p2w1 ??
+ if (liesBefore(p2.vertexw1, p2.intersection1, p1.intersection1) <= 0)
+ return false;
+
+ // CHECKME: This is meaningless if p1w2 != p2w1 ??
+ if (liesBefore(p2.vertexw1, p2.intersection1, p1.intersection2) >= 0)
+ return false;
+
+ return true;
+}
+
+// Merge a single polygon into the work polygon.
+// If there is an intersection between work and polygon, this function
+// returns true, and replaces the vertex list of work by an extended version,
+// that covers polygon.
+//
+// NOTE: The strategy used matches qfg1new closely, and is a bit error-prone.
+// A more robust strategy would be inserting all intersection points directly
+// into both vertex lists as a first pass. This would make finding the merged
+// polygon a much more straightforward edge-walk, and avoid cases where SSCI's
+// algorithm mixes up the order of multiple intersections on a single edge.
+bool mergeSinglePolygon(Polygon &work, const Polygon &polygon) {
+#ifdef DEBUG_MERGEPOLY
+ const Vertex *vertex;
+ debugN("work:");
+ CLIST_FOREACH(vertex, &(work.vertices)) {
+ debugN(" (%d,%d) ", vertex->v.x, vertex->v.y);
+ }
+ debugN("\n");
+ debugN("poly:");
+ CLIST_FOREACH(vertex, &(polygon.vertices)) {
+ debugN(" (%d,%d) ", vertex->v.x, vertex->v.y);
+ }
+ debugN("\n");
+#endif
+ uint workSize = work.vertices.size();
+ uint polygonSize = polygon.vertices.size();
+
+ int patchCount = 0;
+ Patch patchList[8];
+
+ const Vertex *workv = work.vertices._head;
+ const Vertex *polyv = polygon.vertices._head;
+ for (uint wi = 0; wi < workSize; ++wi, workv = workv->_next) {
+ for (uint pi = 0; pi < polygonSize; ++pi, polyv = polyv->_next) {
+ Common::Point intersection1;
+ Common::Point intersection2;
+
+ bool intersects = segSegIntersect(workv, polyv, intersection1);
+ if (!intersects)
+ continue;
+
+#ifdef DEBUG_MERGEPOLY
+ debug("mergePoly: intersection at work %d, poly %d", wi, pi);
+#endif
+
+ if (intersectDir(workv, polyv) >= 0)
+ continue;
+
+#ifdef DEBUG_MERGEPOLY
+ debug("mergePoly: intersection in right direction");
+#endif
+
+ int angle = 0;
+ int baseAngle = edgeDir(workv);
+
+ // We now found the point where an edge of 'polygon' left 'work'.
+ // Now find the re-entry point.
+
+ // NOTE: The order in which this searches does not always work
+ // properly if the correct patch would only use a single partial
+ // edge of poly. Because it starts at polyv->_next, it will skip
+ // the correct re-entry and proceed to the next.
+
+ const Vertex *workv2;
+ const Vertex *polyv2 = polyv->_next;
+
+ intersects = false;
+
+ uint pi2, wi2;
+ for (pi2 = 0; pi2 < polygonSize; ++pi2, polyv2 = polyv2->_next) {
+
+ int newAngle = edgeDir(polyv2);
+
+ int relAngle = newAngle - baseAngle;
+ if (relAngle > 180) relAngle -= 360;
+ if (relAngle < -180) relAngle += 360;
+
+ angle += relAngle;
+ baseAngle = newAngle;
+
+ workv2 = workv;
+ for (wi2 = 0; wi2 < workSize; ++wi2, workv2 = workv2->_next) {
+ intersects = segSegIntersect(workv2, polyv2, intersection2);
+ if (!intersects)
+ continue;
+#ifdef DEBUG_MERGEPOLY
+ debug("mergePoly: re-entry intersection at work %d, poly %d", (wi + wi2) % workSize, (pi + 1 + pi2) % polygonSize);
+#endif
+
+ if (intersectDir(workv2, polyv2) > 0) {
+#ifdef DEBUG_MERGEPOLY
+ debug("mergePoly: re-entry intersection in right direction, angle = %d", angle);
+#endif
+ break; // found re-entry point
+ }
+
+ }
+
+ if (intersects)
+ break;
+
+ }
+
+ if (!intersects || angle < 0)
+ continue;
+
+
+ if (patchCount >= 8)
+ error("kMergePoly: Too many patches");
+
+ // convert relative to absolute vertex indices
+ pi2 = (pi + 1 + pi2) % polygonSize;
+ wi2 = (wi + wi2) % workSize;
+
+ Patch &newPatch = patchList[patchCount];
+ newPatch.indexw1 = wi;
+ newPatch.vertexw1 = workv;
+ newPatch.indexp1 = pi;
+ newPatch.vertexp1 = polyv;
+ newPatch.intersection1 = intersection1;
+
+ newPatch.indexw2 = wi2;
+ newPatch.vertexw2 = workv2;
+ newPatch.indexp2 = pi2;
+ newPatch.vertexp2 = polyv2;
+ newPatch.intersection2 = intersection2;
+ newPatch.disabled = false;
+
+#ifdef DEBUG_MERGEPOLY
+ debug("mergePoly: adding patch at work %d, poly %d", wi, pi);
+#endif
+
+ if (patchCount == 0) {
+ patchCount++;
+ continue;
+ }
+
+ bool necessary = true;
+ for (int i = 0; i < patchCount; ++i) {
+ if (isPatchCovered(patchList[i], newPatch)) {
+ necessary = false;
+ break;
+ }
+ }
+
+ if (!necessary)
+ continue;
+
+ patchCount++;
+
+ if (patchCount > 1) {
+ // check if this patch makes other patches superfluous
+ for (int i = 0; i < patchCount-1; ++i)
+ if (isPatchCovered(newPatch, patchList[i]))
+ patchList[i].disabled = true;
+ }
+ }
+ }
+
+
+ if (patchCount == 0)
+ return false; // nothing changed
+
+
+ // Determine merged work by doing a walk over the edges
+ // of work, crossing over to polygon when encountering a patch.
+
+ Polygon output(0);
+
+ workv = work.vertices._head;
+ for (uint wi = 0; wi < workSize; ++wi, workv = workv->_next) {
+
+ bool covered = false;
+ for (int p = 0; p < patchCount; ++p) {
+ if (patchList[p].disabled) continue;
+ if (isVertexCovered(patchList[p], wi)) {
+ covered = true;
+ break;
+ }
+ }
+
+ if (!covered) {
+ // Add vertex to output
+ output.vertices.insertAtEnd(new Vertex(workv->v));
+ }
+
+
+ // CHECKME: Why is this the correct order in which to process
+ // the patches? (What if two of them start on this line segment
+ // in the opposite order?)
+
+ for (int p = 0; p < patchCount; ++p) {
+
+ const Patch &patch = patchList[p];
+ if (patch.disabled) continue;
+ if (patch.indexw1 != wi) continue;
+ if (patch.intersection1 != workv->v) {
+ // Add intersection point to output
+ output.vertices.insertAtEnd(new Vertex(patch.intersection1));
+ }
+
+ // Add vertices from polygon between vertexp1 (excl) and vertexp2 (incl)
+ for (polyv = patch.vertexp1->_next; polyv != patch.vertexp2; polyv = polyv->_next)
+ output.vertices.insertAtEnd(new Vertex(polyv->v));
+
+ output.vertices.insertAtEnd(new Vertex(patch.vertexp2->v));
+
+ if (patch.intersection2 != patch.vertexp2->v) {
+ // Add intersection point to output
+ output.vertices.insertAtEnd(new Vertex(patch.intersection2));
+ }
+
+ // TODO: We could continue after the re-entry point here?
+ }
+ }
+ // Remove last vertex if it's the same as the first vertex
+ if (output.vertices._head->v == output.vertices._head->_prev->v)
+ output.vertices.remove(output.vertices._head->_prev);
+
+
+ // Slight hack: swap vertex lists of output and work polygons.
+ SWAP(output.vertices._head, work.vertices._head);
+
+ return true;
+}
+
+
/**
* This is a quite rare kernel function. An example of when it's called
* is in QFG1VGA, after killing any monster.
+ *
+ * It takes a polygon, and extends it to also cover any polygons from the
+ * input list with which it intersects. Any of those polygons so covered
+ * from the input list are marked by adding 0x10 to their type field.
*/
reg_t kMergePoly(EngineState *s, int argc, reg_t *argv) {
-#if 0
// 3 parameters: raw polygon data, polygon list, list size
reg_t polygonData = argv[0];
List *list = s->_segMan->lookupList(argv[1]);
- Node *node = s->_segMan->lookupNode(list->first);
- // List size is not needed
- Polygon *polygon;
- int count = 0;
+ // The size of the "work" point list SSCI uses. We use a dynamic one instead
+ //reg_t listSize = argv[2];
+
+ SegmentRef pointList = s->_segMan->dereference(polygonData);
+ if (!pointList.isValid() || pointList.skipByte) {
+ warning("kMergePoly: Polygon data pointer is invalid");
+ return make_reg(0, 0);
+ }
+
+ Node *node;
+
+#ifdef DEBUG_MERGEPOLY
+ node = s->_segMan->lookupNode(list->first);
+ while (node) {
+ draw_polygon(s, node->value, 320, 190);
+ node = s->_segMan->lookupNode(node->succ);
+ }
+ Common::Point prev, first;
+ prev = first = readPoint(pointList, 0);
+ for (int i = 1; readPoint(pointList, i).x != 0x7777; i++) {
+ Common::Point point = readPoint(pointList, i);
+ draw_line(s, prev, point, 1, 320, 190);
+ prev = point;
+ }
+ draw_line(s, prev, first, 1, 320, 190);
+ // Update the whole screen
+ g_sci->_gfxScreen->copyToScreen();
+ g_system->updateScreen();
+ g_system->delayMillis(1000);
+#endif
+
+ // The work polygon which we're going to merge with the polygons in list
+ Polygon work(0);
+
+ for (int i = 0; true; ++i) {
+ Common::Point p = readPoint(pointList, i);
+ if (p.x == POLY_LAST_POINT)
+ break;
+ Vertex *vertex = new Vertex(p);
+ work.vertices.insertAtEnd(vertex);
+ }
+
+ // TODO: Check behaviour for single-vertex polygons
+ node = s->_segMan->lookupNode(list->first);
while (node) {
- polygon = convert_polygon(s, node->value);
+ Polygon *polygon = convert_polygon(s, node->value);
if (polygon) {
- count += readSelectorValue(s->_segMan, node->value, SELECTOR(size));
+ // CHECKME: Confirm vertex order that convert_polygon and
+ // fix_vertex_order output. For now, we re-reverse the order since
+ // convert_polygon reads the vertices reversed, and fix up head.
+ polygon->vertices.reverse();
+ polygon->vertices._head = polygon->vertices._head->_next;
+
+ // Merge this polygon into the work polygon if there is an
+ // intersection.
+ bool intersected = mergeSinglePolygon(work, *polygon);
+
+ // If so, flag it
+ if (intersected) {
+ writeSelectorValue(s->_segMan, node->value,
+ SELECTOR(type), polygon->type + 0x10);
+#ifdef DEBUG_MERGEPOLY
+ debugN("Merged polygon: ");
+ // Iterate over edges
+ Vertex *vertex;
+ CLIST_FOREACH(vertex, &(work.vertices)) {
+ debugN(" (%d,%d) ", vertex->v.x, vertex->v.y);
+ }
+ debugN("\n");
+#endif
+ }
}
node = s->_segMan->lookupNode(node->succ);
}
-#endif
- // TODO: actually merge the polygon. We return an empty polygon for now.
- // In QFG1VGA, you can walk over enemy bodies after killing them, since
- // this is a stub.
- reg_t output = allocateOutputArray(s->_segMan, 1);
+
+ // Allocate output array
+ reg_t output = allocateOutputArray(s->_segMan, work.vertices.size()+1);
SegmentRef arrayRef = s->_segMan->dereference(output);
- writePoint(arrayRef, 0, Common::Point(POLY_LAST_POINT, POLY_LAST_POINT));
- warning("Stub: kMergePoly");
+
+ // Copy work.vertices into arrayRef
+ Vertex *vertex;
+ unsigned int n = 0;
+ CLIST_FOREACH(vertex, &work.vertices) {
+ if (vertex == work.vertices._head || vertex->v != vertex->_prev->v)
+ writePoint(arrayRef, n++, vertex->v);
+ }
+
+ writePoint(arrayRef, n, Common::Point(POLY_LAST_POINT, POLY_LAST_POINT));
+
+#ifdef DEBUG_MERGEPOLY
+ prev = first = readPoint(arrayRef, 0);
+ for (int i = 1; readPoint(arrayRef, i).x != 0x7777; i++) {
+ Common::Point point = readPoint(arrayRef, i);
+ draw_line(s, prev, point, 3, 320, 190);
+ prev = point;
+ }
+
+ draw_line(s, prev, first, 3, 320, 190);
+
+ // Update the whole screen
+ g_sci->_gfxScreen->copyToScreen();
+ g_system->updateScreen();
+ if (!g_sci->_gfxPaint16)
+ g_system->delayMillis(1000);
+
+ debug("kMergePoly done");
+#endif
+
return output;
}
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 9b0e490d7e..2c115be500 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -140,7 +140,7 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) {
debugC(kDebugLevelMemory, "Attempting to clone from %04x:%04x", PRINT_REG(parentAddr));
- uint16 infoSelector = parentObj->getInfoSelector().offset;
+ uint16 infoSelector = parentObj->getInfoSelector().getOffset();
cloneObj = s->_segMan->allocateClone(&cloneAddr);
if (!cloneObj) {
@@ -169,8 +169,8 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) {
cloneObj->setSpeciesSelector(cloneObj->getPos());
if (parentObj->isClass())
cloneObj->setSuperClassSelector(parentObj->getPos());
- s->_segMan->getScript(parentObj->getPos().segment)->incrementLockers();
- s->_segMan->getScript(cloneObj->getPos().segment)->incrementLockers();
+ s->_segMan->getScript(parentObj->getPos().getSegment())->incrementLockers();
+ s->_segMan->getScript(cloneObj->getPos().getSegment())->incrementLockers();
return cloneAddr;
}
@@ -191,7 +191,7 @@ reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) {
// At least kq4early relies on this behavior. The scripts clone "Sound", then set bit 1 manually
// and call kDisposeClone later. In that case we may not free it, otherwise we will run into issues
// later, because kIsObject would then return false and Sound object wouldn't get checked.
- uint16 infoSelector = object->getInfoSelector().offset;
+ uint16 infoSelector = object->getInfoSelector().getOffset();
if ((infoSelector & 3) == kInfoFlagClone)
object->markAsFreed();
@@ -203,7 +203,7 @@ reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
int script = argv[0].toUint16();
uint16 index = (argc > 1) ? argv[1].toUint16() : 0;
- if (argv[0].segment)
+ if (argv[0].getSegment())
return argv[0];
SegmentId scriptSeg = s->_segMan->getScriptSegment(script, SCRIPT_GET_LOAD);
@@ -226,11 +226,6 @@ reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
- if (index > scr->getExportsNr()) {
- error("Dispatch index too big: %d > %d", index, scr->getExportsNr());
- return NULL_REG;
- }
-
uint16 address = scr->validateExportFunc(index, true);
// Point to the heap for SCI1.1 - SCI2.1 games
@@ -251,12 +246,12 @@ reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
}
reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv) {
- int script = argv[0].offset;
+ int script = argv[0].getOffset();
SegmentId id = s->_segMan->getScriptSegment(script);
Script *scr = s->_segMan->getScriptIfLoaded(id);
if (scr && !scr->isMarkedAsDeleted()) {
- if (s->_executionStack.back().addr.pc.segment != id)
+ if (s->_executionStack.back().addr.pc.getSegment() != id)
scr->setLockers(1);
}
@@ -273,7 +268,7 @@ reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv) {
}
reg_t kIsObject(EngineState *s, int argc, reg_t *argv) {
- if (argv[0].offset == SIGNAL_OFFSET) // Treated specially
+ if (argv[0].getOffset() == SIGNAL_OFFSET) // Treated specially
return NULL_REG;
else
return make_reg(0, s->_segMan->isHeapObject(argv[0]));
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index c469f775f9..0633267db4 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -140,8 +140,14 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
((argv[3].toUint16() & 0xff) << 16) |
((argv[4].toUint16() & 0xff) << 8) |
(argv[5].toUint16() & 0xff);
- if (argc == 8)
- warning("kDoAudio: Play called with SQ6 extra parameters");
+ // Removed warning because of the high amount of console spam
+ /*if (argc == 8) {
+ // TODO: Handle the extra 2 SCI21 params
+ // argv[6] is always 1
+ // argv[7] is the contents of global 229 (0xE5)
+ warning("kDoAudio: Play called with SCI2.1 extra parameters: %04x:%04x and %04x:%04x",
+ PRINT_REG(argv[6]), PRINT_REG(argv[7]));
+ }*/
} else {
warning("kDoAudio: Play called with an unknown number of parameters (%d)", argc);
return NULL_REG;
@@ -240,6 +246,11 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
// Used in Pharkas whenever a speech sample starts (takes no params)
//warning("kDoAudio: Unhandled case 13, %d extra arguments passed", argc - 1);
break;
+ case 17:
+ // Seems to be some sort of audio sync, used in SQ6. Silenced the
+ // warning due to the high level of spam it produces. (takes no params)
+ //warning("kDoAudio: Unhandled case 17, %d extra arguments passed", argc - 1);
+ break;
default:
warning("kDoAudio: Unhandled case %d, %d extra arguments passed", argv[0].toUint16(), argc - 1);
}
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index fe8d631497..c4db0b891c 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -33,7 +33,7 @@ namespace Sci {
reg_t kStrEnd(EngineState *s, int argc, reg_t *argv) {
reg_t address = argv[0];
- address.offset += s->_segMan->strlen(address);
+ address.incOffset(s->_segMan->strlen(address));
return address;
}
@@ -96,7 +96,7 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
byte value;
byte newvalue = 0;
- unsigned int offset = argv[1].toUint16();
+ uint16 offset = argv[1].toUint16();
if (argc > 2)
newvalue = argv[2].toSint16();
@@ -123,18 +123,22 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
oddOffset = !oddOffset;
if (!oddOffset) {
- value = tmp.offset & 0x00ff;
+ value = tmp.getOffset() & 0x00ff;
if (argc > 2) { /* Request to modify this char */
- tmp.offset &= 0xff00;
- tmp.offset |= newvalue;
- tmp.segment = 0;
+ uint16 tmpOffset = tmp.toUint16();
+ tmpOffset &= 0xff00;
+ tmpOffset |= newvalue;
+ tmp.setOffset(tmpOffset);
+ tmp.setSegment(0);
}
} else {
- value = tmp.offset >> 8;
+ value = tmp.getOffset() >> 8;
if (argc > 2) { /* Request to modify this char */
- tmp.offset &= 0x00ff;
- tmp.offset |= newvalue << 8;
- tmp.segment = 0;
+ uint16 tmpOffset = tmp.toUint16();
+ tmpOffset &= 0x00ff;
+ tmpOffset |= newvalue << 8;
+ tmp.setOffset(tmpOffset);
+ tmp.setSegment(0);
}
}
}
@@ -161,6 +165,7 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
// do clipping. In SQ4 we get the door code in here and that's even
// larger than uint32!
if (*source == '-') {
+ // FIXME: Setting result to -1 does _not_ negate the output.
result = -1;
source++;
}
@@ -204,7 +209,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
int strLength = 0; /* Used for stuff like "%13s" */
bool unsignedVar = false;
- if (position.segment)
+ if (position.getSegment())
startarg = 2;
else {
// WORKAROUND: QFG1 VGA Mac calls this without the first parameter (dest). It then
@@ -291,7 +296,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
if (extralen < 0)
extralen = 0;
- if (reg.segment) /* Heap address? */
+ if (reg.getSegment()) /* Heap address? */
paramindex++;
else
paramindex += 2; /* No, text resource address */
@@ -653,10 +658,16 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
case 1: // Size
return make_reg(0, s->_segMan->getString(argv[1]).size());
case 2: { // At (return value at an index)
- if (argv[1].segment == s->_segMan->getStringSegmentId())
- return make_reg(0, s->_segMan->lookupString(argv[1])->getRawData()[argv[2].toUint16()]);
-
- return make_reg(0, s->_segMan->getString(argv[1])[argv[2].toUint16()]);
+ // Note that values are put in bytes to avoid sign extension
+ if (argv[1].getSegment() == s->_segMan->getStringSegmentId()) {
+ SciString *string = s->_segMan->lookupString(argv[1]);
+ byte val = string->getRawData()[argv[2].toUint16()];
+ return make_reg(0, val);
+ } else {
+ Common::String string = s->_segMan->getString(argv[1]);
+ byte val = string[argv[2].toUint16()];
+ return make_reg(0, val);
+ }
}
case 3: { // Atput (put value at an index)
SciString *string = s->_segMan->lookupString(argv[1]);
@@ -699,7 +710,7 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
uint32 string2Size = 0;
Common::String string;
- if (argv[3].segment == s->_segMan->getStringSegmentId()) {
+ if (argv[3].getSegment() == s->_segMan->getStringSegmentId()) {
SciString *sstr;
sstr = s->_segMan->lookupString(argv[3]);
string2 = sstr->getRawData();
@@ -749,7 +760,7 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
SciString *dupString = s->_segMan->allocateString(&stringHandle);
- if (argv[1].segment == s->_segMan->getStringSegmentId()) {
+ if (argv[1].getSegment() == s->_segMan->getStringSegmentId()) {
*dupString = *s->_segMan->lookupString(argv[1]);
} else {
dupString->fromString(s->_segMan->getString(argv[1]));
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index c9cf652013..9b0cb38f51 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -32,6 +32,7 @@
#include "common/str.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "graphics/palette.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
#include "video/video_decoder.h"
@@ -49,6 +50,8 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
if (!videoDecoder)
return;
+ videoDecoder->start();
+
byte *scaleBuffer = 0;
byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel;
uint16 width = videoDecoder->getWidth();
@@ -86,9 +89,12 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
}
bool skipVideo = false;
+ EngineState *s = g_sci->getEngineState();
- if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+ if (videoDecoder->hasDirtyPalette()) {
+ const byte *palette = videoDecoder->getPalette() + s->_vmdPalStart * 3;
+ g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart);
+ }
while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) {
@@ -100,11 +106,13 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel);
g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height);
} else {
- g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, width, height);
+ g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, width, height);
}
- if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+ if (videoDecoder->hasDirtyPalette()) {
+ const byte *palette = videoDecoder->getPalette() + s->_vmdPalStart * 3;
+ g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart);
+ }
g_system->updateScreen();
}
@@ -135,7 +143,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
Video::VideoDecoder *videoDecoder = 0;
- if (argv[0].segment != 0) {
+ if (argv[0].getSegment() != 0) {
Common::String filename = s->_segMan->getString(argv[0]);
if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
@@ -156,9 +164,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
} else {
// DOS SEQ
// SEQ's are called with no subops, just the string and delay
- SeqDecoder *seqDecoder = new SeqDecoder();
- seqDecoder->setFrameDelay(argv[1].toUint16()); // Time between frames in ticks
- videoDecoder = seqDecoder;
+ // Time is specified as ticks
+ videoDecoder = new SEQDecoder(argv[1].toUint16());
if (!videoDecoder->loadFile(filename)) {
warning("Failed to open movie file %s", filename.c_str());
@@ -184,7 +191,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
switch (argv[0].toUint16()) {
case 0: {
Common::String filename = s->_segMan->getString(argv[1]);
- videoDecoder = new Video::AviDecoder(g_system->getMixer());
+ videoDecoder = new Video::AVIDecoder();
if (filename.equalsIgnoreCase("gk2a.avi")) {
// HACK: Switch to 16bpp graphics for Indeo3.
@@ -203,6 +210,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
warning("Failed to open movie file %s", filename.c_str());
delete videoDecoder;
videoDecoder = 0;
+ } else {
+ s->_videoState.fileName = filename;
}
break;
}
@@ -244,6 +253,7 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
int16 y = argv[5].toUint16();
warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y);
g_sci->_robotDecoder->load(id);
+ g_sci->_robotDecoder->start();
g_sci->_robotDecoder->setPos(x, y);
}
break;
@@ -259,12 +269,13 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
warning("kRobot(%d)", subop);
break;
case 8: // sync
- if ((uint32)g_sci->_robotDecoder->getCurFrame() != g_sci->_robotDecoder->getFrameCount() - 1) {
- writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG);
- } else {
+ //if (true) { // debug: automatically skip all robot videos
+ if (g_sci->_robotDecoder->endOfVideo()) {
g_sci->_robotDecoder->close();
// Signal the engine scripts that the video is done
writeSelector(s->_segMan, argv[1], SELECTOR(signal), SIGNAL_REG);
+ } else {
+ writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG);
}
break;
default:
@@ -302,7 +313,7 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
// with subfx 21. The subtleness has to do with creation of temporary
// planes and positioning relative to such planes.
- uint16 flags = argv[3].offset;
+ uint16 flags = argv[3].getOffset();
Common::String flagspec;
if (argc > 3) {
@@ -330,16 +341,22 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
s->_videoState.flags = flags;
}
- warning("x, y: %d, %d", argv[1].offset, argv[2].offset);
- s->_videoState.x = argv[1].offset;
- s->_videoState.y = argv[2].offset;
+ warning("x, y: %d, %d", argv[1].getOffset(), argv[2].getOffset());
+ s->_videoState.x = argv[1].getOffset();
+ s->_videoState.y = argv[2].getOffset();
if (argc > 4 && flags & 16)
- warning("gammaBoost: %d%% between palette entries %d and %d", argv[4].offset, argv[5].offset, argv[6].offset);
+ warning("gammaBoost: %d%% between palette entries %d and %d", argv[4].getOffset(), argv[5].getOffset(), argv[6].getOffset());
break;
}
case 6: // Play
- videoDecoder = new Video::VMDDecoder(g_system->getMixer());
+ videoDecoder = new Video::AdvancedVMDDecoder();
+
+ if (s->_videoState.fileName.empty()) {
+ // Happens in Lighthouse
+ warning("kPlayVMD: Empty filename passed");
+ return s->r_acc;
+ }
if (!videoDecoder->loadFile(s->_videoState.fileName)) {
warning("Could not open VMD %s", s->_videoState.fileName.c_str());
@@ -354,6 +371,10 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
if (reshowCursor)
g_sci->_gfxCursor->kernelShow();
break;
+ case 23: // set video palette range
+ s->_vmdPalStart = argv[1].toUint16();
+ s->_vmdPalEnd = argv[2].toUint16();
+ break;
case 14:
// Takes an additional integer parameter (e.g. 3)
case 16:
@@ -387,7 +408,7 @@ reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv) {
s->_videoState.reset();
s->_videoState.fileName = Common::String::format("%d.duk", argv[1].toUint16());
- videoDecoder = new Video::AviDecoder(g_system->getMixer());
+ videoDecoder = new Video::AVIDecoder();
if (!videoDecoder->loadFile(s->_videoState.fileName)) {
warning("Could not open Duck %s", s->_videoState.fileName.c_str());
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index cddd01e10c..a92d572d35 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -400,11 +400,21 @@ Common::String MessageState::processString(const char *s) {
void MessageState::outputString(reg_t buf, const Common::String &str) {
#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
- SciString *sciString = _segMan->lookupString(buf);
- sciString->setSize(str.size() + 1);
- for (uint32 i = 0; i < str.size(); i++)
- sciString->setValue(i, str.c_str()[i]);
- sciString->setValue(str.size(), 0);
+ if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_STRING) {
+ SciString *sciString = _segMan->lookupString(buf);
+ sciString->setSize(str.size() + 1);
+ for (uint32 i = 0; i < str.size(); i++)
+ sciString->setValue(i, str.c_str()[i]);
+ sciString->setValue(str.size(), 0);
+ } else if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_ARRAY) {
+ // Happens in the intro of LSL6, we are asked to write the string
+ // into an array
+ SciArray<reg_t> *sciString = _segMan->lookupArray(buf);
+ sciString->setSize(str.size() + 1);
+ for (uint32 i = 0; i < str.size(); i++)
+ sciString->setValue(i, make_reg(0, str.c_str()[i]));
+ sciString->setValue(str.size(), NULL_REG);
+ }
} else {
#endif
SegmentRef buffer_r = _segMan->dereference(buf);
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp
index 78e216cdb5..b28026b71f 100644
--- a/engines/sci/engine/object.cpp
+++ b/engines/sci/engine/object.cpp
@@ -44,15 +44,15 @@ static bool relocateBlock(Common::Array<reg_t> &block, int block_location, Segme
error("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location);
return false;
}
- block[idx].segment = segment; // Perform relocation
+ block[idx].setSegment(segment); // Perform relocation
if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1)
- block[idx].offset += scriptSize;
+ block[idx].incOffset(scriptSize);
return true;
}
void Object::init(byte *buf, reg_t obj_pos, bool initVariables) {
- byte *data = buf + obj_pos.offset;
+ byte *data = buf + obj_pos.getOffset();
_baseObj = data;
_pos = obj_pos;
@@ -109,16 +109,16 @@ int Object::locateVarSelector(SegManager *segMan, Selector slc) const {
}
bool Object::relocateSci0Sci21(SegmentId segment, int location, size_t scriptSize) {
- return relocateBlock(_variables, getPos().offset, segment, location, scriptSize);
+ return relocateBlock(_variables, getPos().getOffset(), segment, location, scriptSize);
}
-bool Object::relocateSci3(SegmentId segment, int location, int offset, size_t scriptSize) {
+bool Object::relocateSci3(SegmentId segment, uint32 location, int offset, size_t scriptSize) {
assert(_propertyOffsetsSci3);
for (uint i = 0; i < _variables.size(); ++i) {
if (location == _propertyOffsetsSci3[i]) {
- _variables[i].segment = segment;
- _variables[i].offset += offset;
+ _variables[i].setSegment(segment);
+ _variables[i].incOffset(offset);
return true;
}
}
@@ -148,21 +148,21 @@ int Object::propertyOffsetToId(SegManager *segMan, int propertyOffset) const {
}
void Object::initSpecies(SegManager *segMan, reg_t addr) {
- uint16 speciesOffset = getSpeciesSelector().offset;
+ uint16 speciesOffset = getSpeciesSelector().getOffset();
if (speciesOffset == 0xffff) // -1
setSpeciesSelector(NULL_REG); // no species
else
- setSpeciesSelector(segMan->getClassAddress(speciesOffset, SCRIPT_GET_LOCK, addr));
+ setSpeciesSelector(segMan->getClassAddress(speciesOffset, SCRIPT_GET_LOCK, addr.getSegment()));
}
void Object::initSuperClass(SegManager *segMan, reg_t addr) {
- uint16 superClassOffset = getSuperClassSelector().offset;
+ uint16 superClassOffset = getSuperClassSelector().getOffset();
if (superClassOffset == 0xffff) // -1
setSuperClassSelector(NULL_REG); // no superclass
else
- setSuperClassSelector(segMan->getClassAddress(superClassOffset, SCRIPT_GET_LOCK, addr));
+ setSuperClassSelector(segMan->getClassAddress(superClassOffset, SCRIPT_GET_LOCK, addr.getSegment()));
}
bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClass) {
@@ -187,7 +187,7 @@ bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClas
// The effect is that a number of its method selectors may be
// treated as variable selectors, causing unpredictable effects.
- int objScript = segMan->getScript(_pos.segment)->getScriptNumber();
+ int objScript = segMan->getScript(_pos.getSegment())->getScriptNumber();
// We have to do a little bit of work to get the name of the object
// before any relocations are done.
@@ -196,7 +196,7 @@ bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClas
if (nameReg.isNull()) {
name = "<no name>";
} else {
- nameReg.segment = _pos.segment;
+ nameReg.setSegment(_pos.getSegment());
name = segMan->derefString(nameReg);
if (!name)
name = "<invalid name>";
@@ -286,7 +286,7 @@ void Object::initSelectorsSci3(const byte *buf) {
_variables.resize(properties);
uint16 *propertyIds = (uint16 *)malloc(sizeof(uint16) * properties);
// uint16 *methodOffsets = (uint16 *)malloc(sizeof(uint16) * 2 * methods);
- uint16 *propertyOffsets = (uint16 *)malloc(sizeof(uint16) * properties);
+ uint32 *propertyOffsets = (uint32 *)malloc(sizeof(uint32) * properties);
int propertyCounter = 0;
int methodCounter = 0;
@@ -314,7 +314,8 @@ void Object::initSelectorsSci3(const byte *buf) {
WRITE_SCI11ENDIAN_UINT16(&propertyIds[propertyCounter],
groupBaseId + bit);
_variables[propertyCounter] = make_reg(0, value);
- propertyOffsets[propertyCounter] = (seeker + bit * 2) - buf;
+ uint32 propertyOffset = (seeker + bit * 2) - buf;
+ propertyOffsets[propertyCounter] = propertyOffset;
++propertyCounter;
} else if (value != 0xffff) { // Method
_baseMethod.push_back(groupBaseId + bit);
diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h
index 0ca16b48a2..1ea9ae449a 100644
--- a/engines/sci/engine/object.h
+++ b/engines/sci/engine/object.h
@@ -168,7 +168,7 @@ public:
uint16 offset = (getSciVersion() < SCI_VERSION_1_1) ? _methodCount + 1 + i : i * 2 + 2;
if (getSciVersion() == SCI_VERSION_3)
offset--;
- return make_reg(_pos.segment, _baseMethod[offset]);
+ return make_reg(_pos.getSegment(), _baseMethod[offset]);
}
Selector getFuncSelector(uint16 i) const {
@@ -198,7 +198,7 @@ public:
*/
int locateVarSelector(SegManager *segMan, Selector slc) const;
- bool isClass() const { return (getInfoSelector().offset & kInfoFlagClass); }
+ bool isClass() const { return (getInfoSelector().getOffset() & kInfoFlagClass); }
const Object *getClass(SegManager *segMan) const;
void markAsFreed() { _flags |= OBJECT_FLAG_FREED; }
@@ -223,7 +223,7 @@ public:
}
bool relocateSci0Sci21(SegmentId segment, int location, size_t scriptSize);
- bool relocateSci3(SegmentId segment, int location, int offset, size_t scriptSize);
+ bool relocateSci3(SegmentId segment, uint32 location, int offset, size_t scriptSize);
int propertyOffsetToId(SegManager *segMan, int propertyOffset) const;
@@ -238,7 +238,7 @@ private:
const byte *_baseObj; /**< base + object offset within base */
const uint16 *_baseVars; /**< Pointer to the varselector area for this object */
Common::Array<uint16> _baseMethod; /**< Pointer to the method selector area for this object */
- uint16 *_propertyOffsetsSci3; /**< This is used to enable relocation of property valuesa in SCI3 */
+ uint32 *_propertyOffsetsSci3; /**< This is used to enable relocation of property valuesa in SCI3 */
Common::Array<reg_t> _variables;
uint16 _methodCount;
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 404bea799d..ff3f19b53d 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -115,8 +115,9 @@ void syncArray(Common::Serializer &s, Common::Array<T> &arr) {
template<>
void syncWithSerializer(Common::Serializer &s, reg_t &obj) {
- s.syncAsUint16LE(obj.segment);
- s.syncAsUint16LE(obj.offset);
+ // Segment and offset are accessed directly here
+ s.syncAsUint16LE(obj._segment);
+ s.syncAsUint16LE(obj._offset);
}
template<>
@@ -189,7 +190,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
assert(mobj);
- // Let the object sync custom data
+ // Let the object sync custom data. Scripts are loaded at this point.
mobj->saveLoadWithSerializer(s);
if (type == SEG_TYPE_SCRIPT) {
@@ -200,12 +201,9 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
// Hook the script up in the script->segment map
_scriptSegMap[scr->getScriptNumber()] = i;
- // Now, load the script itself
- scr->load(g_sci->getResMan());
-
ObjMap objects = scr->getObjectMap();
for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it)
- it->_value.syncBaseObject(scr->getBuf(it->_value.getPos().offset));
+ it->_value.syncBaseObject(scr->getBuf(it->_value.getPos().getOffset()));
}
@@ -467,7 +465,7 @@ void Script::syncStringHeap(Common::Serializer &s) {
break;
} while (1);
- } else {
+ } else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1){
// Strings in SCI1.1 come after the object instances
byte *buf = _heapStart + 4 + READ_SCI11ENDIAN_UINT16(_heapStart + 2) * 2;
@@ -477,6 +475,8 @@ void Script::syncStringHeap(Common::Serializer &s) {
// Now, sync everything till the end of the buffer
s.syncBytes(buf, _heapSize - (buf - _heapStart));
+ } else if (getSciVersion() == SCI_VERSION_3) {
+ warning("TODO: syncStringHeap(): Implement SCI3 variant");
}
}
@@ -484,7 +484,7 @@ void Script::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(_nr);
if (s.isLoading())
- init(_nr, g_sci->getResMan());
+ load(_nr, g_sci->getResMan());
s.skip(4, VER(14), VER(22)); // OBSOLETE: Used to be _bufSize
s.skip(4, VER(14), VER(22)); // OBSOLETE: Used to be _scriptSize
s.skip(4, VER(14), VER(22)); // OBSOLETE: Used to be _heapSize
@@ -508,7 +508,7 @@ void Script::saveLoadWithSerializer(Common::Serializer &s) {
Object tmp;
for (uint i = 0; i < numObjs; ++i) {
syncWithSerializer(s, tmp);
- _objects[tmp.getPos().offset] = tmp;
+ _objects[tmp.getPos().getOffset()] = tmp;
}
} else {
ObjMap::iterator it;
@@ -817,7 +817,7 @@ bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::Strin
Resource *script0 = g_sci->getResMan()->findResource(ResourceId(kResourceTypeScript, 0), false);
meta.script0Size = script0->size;
- meta.gameObjectOffset = g_sci->getGameObject().offset;
+ meta.gameObjectOffset = g_sci->getGameObject().getOffset();
// Checking here again
if (s->executionStackBase) {
@@ -868,7 +868,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
if (meta.gameObjectOffset > 0 && meta.script0Size > 0) {
Resource *script0 = g_sci->getResMan()->findResource(ResourceId(kResourceTypeScript, 0), false);
- if (script0->size != meta.script0Size || g_sci->getGameObject().offset != meta.gameObjectOffset) {
+ if (script0->size != meta.script0Size || g_sci->getGameObject().getOffset() != meta.gameObjectOffset) {
//warning("This saved game was created with a different version of the game, unable to load it");
showScummVMDialog("This saved game was created with a different version of the game, unable to load it");
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 8b26969f4a..36d2841b07 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -32,58 +32,48 @@
namespace Sci {
-Script::Script() : SegmentObj(SEG_TYPE_SCRIPT) {
+Script::Script() : SegmentObj(SEG_TYPE_SCRIPT), _buf(NULL) {
+ freeScript();
+}
+
+Script::~Script() {
+ freeScript();
+}
+
+void Script::freeScript() {
_nr = 0;
+
+ free(_buf);
_buf = NULL;
_bufSize = 0;
_scriptSize = 0;
+ _heapStart = NULL;
_heapSize = 0;
- _synonyms = NULL;
- _heapStart = NULL;
_exportTable = NULL;
+ _numExports = 0;
+ _synonyms = NULL;
+ _numSynonyms = 0;
_localsOffset = 0;
_localsSegment = 0;
_localsBlock = NULL;
_localsCount = 0;
+ _lockers = 1;
_markedAsDeleted = false;
+ _objects.clear();
}
-Script::~Script() {
+void Script::load(int script_nr, ResourceManager *resMan) {
freeScript();
-}
-
-void Script::freeScript() {
- free(_buf);
- _buf = NULL;
- _bufSize = 0;
-
- _objects.clear();
-}
-void Script::init(int script_nr, ResourceManager *resMan) {
Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
-
if (!script)
error("Script %d not found", script_nr);
- _localsOffset = 0;
- _localsBlock = NULL;
- _localsCount = 0;
-
- _markedAsDeleted = false;
-
_nr = script_nr;
- _buf = 0;
- _heapStart = 0;
-
- _scriptSize = script->size;
- _bufSize = script->size;
- _heapSize = 0;
-
- _lockers = 1;
+ _bufSize = _scriptSize = script->size;
if (getSciVersion() == SCI_VERSION_0_EARLY) {
_bufSize += READ_LE_UINT16(script->data) * 2;
@@ -115,16 +105,18 @@ void Script::init(int script_nr, ResourceManager *resMan) {
// scheme. We need an overlaying mechanism, or a mechanism to split script parts
// in different segments to handle these. For now, simply stop when such a script
// is found.
+ //
+ // Known large SCI 3 scripts are:
+ // Lighthouse: 9, 220, 270, 351, 360, 490, 760, 765, 800
+ // LSL7: 240, 511, 550
+ // Phantasmagoria 2: none (hooray!)
+ // RAMA: 70
+ //
// TODO: Remove this once such a mechanism is in place
if (script->size > 65535)
error("TODO: SCI script %d is over 64KB - it's %d bytes long. This can't "
"be handled at the moment, thus stopping", script_nr, script->size);
}
-}
-
-void Script::load(ResourceManager *resMan) {
- Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, _nr), 0);
- assert(script != 0);
uint extraLocalsWorkaround = 0;
if (g_sci->getGameId() == GID_FANMADE && _nr == 1 && script->size == 11140) {
@@ -152,15 +144,10 @@ void Script::load(ResourceManager *resMan) {
_heapStart = _buf + _scriptSize;
- assert(_bufSize - _scriptSize <= heap->size);
+ assert(_bufSize - _scriptSize >= heap->size);
memcpy(_heapStart, heap->data, heap->size);
}
- _exportTable = 0;
- _numExports = 0;
- _synonyms = 0;
- _numSynonyms = 0;
-
if (getSciVersion() <= SCI_VERSION_1_LATE) {
_exportTable = (const uint16 *)findBlockSCI0(SCI_OBJ_EXPORTS);
if (_exportTable) {
@@ -212,7 +199,7 @@ void Script::load(ResourceManager *resMan) {
_localsOffset = 0;
if (_localsOffset + _localsCount * 2 + 1 >= (int)_bufSize) {
- error("Locals extend beyond end of script: offset %04x, count %d vs size %d", _localsOffset, _localsCount, _bufSize);
+ error("Locals extend beyond end of script: offset %04x, count %d vs size %d", _localsOffset, _localsCount, (int)_bufSize);
//_localsCount = (_bufSize - _localsOffset) >> 1;
}
}
@@ -252,14 +239,14 @@ const Object *Script::getObject(uint16 offset) const {
Object *Script::scriptObjInit(reg_t obj_pos, bool fullObjectInit) {
if (getSciVersion() < SCI_VERSION_1_1 && fullObjectInit)
- obj_pos.offset += 8; // magic offset (SCRIPT_OBJECT_MAGIC_OFFSET)
+ obj_pos.incOffset(8); // magic offset (SCRIPT_OBJECT_MAGIC_OFFSET)
- if (obj_pos.offset >= _bufSize)
+ if (obj_pos.getOffset() >= _bufSize)
error("Attempt to initialize object beyond end of script");
// Get the object at the specified position and init it. This will
// automatically "allocate" space for it in the _objects map if necessary.
- Object *obj = &_objects[obj_pos.offset];
+ Object *obj = &_objects[obj_pos.getOffset()];
obj->init(_buf, obj_pos, fullObjectInit);
return obj;
@@ -282,9 +269,9 @@ static bool relocateBlock(Common::Array<reg_t> &block, int block_location, Segme
error("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location);
return false;
}
- block[idx].segment = segment; // Perform relocation
+ block[idx].setSegment(segment); // Perform relocation
if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1)
- block[idx].offset += scriptSize;
+ block[idx].incOffset(scriptSize);
return true;
}
@@ -323,23 +310,23 @@ void Script::relocateSci0Sci21(reg_t block) {
heapOffset = _scriptSize;
}
- if (block.offset >= (uint16)heapSize ||
- READ_SCI11ENDIAN_UINT16(heap + block.offset) * 2 + block.offset >= (uint16)heapSize)
+ if (block.getOffset() >= (uint16)heapSize ||
+ READ_SCI11ENDIAN_UINT16(heap + block.getOffset()) * 2 + block.getOffset() >= (uint16)heapSize)
error("Relocation block outside of script");
- int count = READ_SCI11ENDIAN_UINT16(heap + block.offset);
+ int count = READ_SCI11ENDIAN_UINT16(heap + block.getOffset());
int exportIndex = 0;
int pos = 0;
for (int i = 0; i < count; i++) {
- pos = READ_SCI11ENDIAN_UINT16(heap + block.offset + 2 + (exportIndex * 2)) + heapOffset;
+ pos = READ_SCI11ENDIAN_UINT16(heap + block.getOffset() + 2 + (exportIndex * 2)) + heapOffset;
// This occurs in SCI01/SCI1 games where usually one export value is
// zero. It seems that in this situation, we should skip the export and
// move to the next one, though the total count of valid exports remains
// the same
if (!pos) {
exportIndex++;
- pos = READ_SCI11ENDIAN_UINT16(heap + block.offset + 2 + (exportIndex * 2)) + heapOffset;
+ pos = READ_SCI11ENDIAN_UINT16(heap + block.getOffset() + 2 + (exportIndex * 2)) + heapOffset;
if (!pos)
error("Script::relocate(): Consecutive zero exports found");
}
@@ -348,12 +335,12 @@ void Script::relocateSci0Sci21(reg_t block) {
// We only relocate locals and objects here, and ignore relocation of
// code blocks. In SCI1.1 and newer versions, only locals and objects
// are relocated.
- if (!relocateLocal(block.segment, pos)) {
+ if (!relocateLocal(block.getSegment(), pos)) {
// Not a local? It's probably an object or code block. If it's an
// object, relocate it.
const ObjMap::iterator end = _objects.end();
for (ObjMap::iterator it = _objects.begin(); it != end; ++it)
- if (it->_value.relocateSci0Sci21(block.segment, pos, _scriptSize))
+ if (it->_value.relocateSci0Sci21(block.getSegment(), pos, _scriptSize))
break;
}
@@ -370,7 +357,7 @@ void Script::relocateSci3(reg_t block) {
const byte *seeker = relocStart;
while (seeker < _buf + _bufSize) {
// TODO: Find out what UINT16 at (seeker + 8) means
- it->_value.relocateSci3(block.segment,
+ it->_value.relocateSci3(block.getSegment(),
READ_SCI11ENDIAN_UINT32(seeker),
READ_SCI11ENDIAN_UINT32(seeker + 4),
_scriptSize);
@@ -398,7 +385,7 @@ void Script::setLockers(int lockers) {
_lockers = lockers;
}
-uint16 Script::validateExportFunc(int pubfunct, bool relocate) {
+uint32 Script::validateExportFunc(int pubfunct, bool relocSci3) {
bool exportsAreWide = (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE);
if (_numExports <= pubfunct) {
@@ -409,17 +396,17 @@ uint16 Script::validateExportFunc(int pubfunct, bool relocate) {
if (exportsAreWide)
pubfunct *= 2;
- uint16 offset;
+ uint32 offset;
- if (getSciVersion() != SCI_VERSION_3 || !relocate) {
+ if (getSciVersion() != SCI_VERSION_3) {
offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct);
} else {
- offset = relocateOffsetSci3(pubfunct * 2 + 22);
+ if (!relocSci3)
+ offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct) + getCodeBlockOffsetSci3();
+ else
+ offset = relocateOffsetSci3(pubfunct * 2 + 22);
}
- if (offset >= _bufSize)
- error("Invalid export function pointer");
-
// Check if the offset found points to a second export table (e.g. script 912
// in Camelot and script 306 in KQ4). Such offsets are usually small (i.e. < 10),
// thus easily distinguished from actual code offsets.
@@ -432,11 +419,16 @@ uint16 Script::validateExportFunc(int pubfunct, bool relocate) {
if (secondExportTable) {
secondExportTable += 3; // skip header plus 2 bytes (secondExportTable is a uint16 pointer)
offset = READ_SCI11ENDIAN_UINT16(secondExportTable + pubfunct);
- if (offset >= _bufSize)
- error("Invalid export function pointer");
}
}
+ // Note that it's perfectly normal to return a zero offset, especially in
+ // SCI1.1 and newer games. Examples include script 64036 in Torin's Passage,
+ // script 64908 in the demo of RAMA and script 1013 in KQ6 floppy.
+
+ if (offset >= _bufSize)
+ error("Invalid export function pointer");
+
return offset;
}
@@ -479,7 +471,7 @@ bool Script::isValidOffset(uint16 offset) const {
}
SegmentRef Script::dereference(reg_t pointer) {
- if (pointer.offset > _bufSize) {
+ if (pointer.getOffset() > _bufSize) {
error("Script::dereference(): Attempt to dereference invalid pointer %04x:%04x into script segment (script size=%d)",
PRINT_REG(pointer), (uint)_bufSize);
return SegmentRef();
@@ -487,8 +479,8 @@ SegmentRef Script::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = true;
- ret.maxSize = _bufSize - pointer.offset;
- ret.raw = _buf + pointer.offset;
+ ret.maxSize = _bufSize - pointer.getOffset();
+ ret.raw = _buf + pointer.getOffset();
return ret;
}
@@ -553,7 +545,7 @@ void Script::initializeClasses(SegManager *segMan) {
uint16 marker;
bool isClass = false;
- uint16 classpos;
+ uint32 classpos;
int16 species = 0;
while (true) {
@@ -564,7 +556,7 @@ void Script::initializeClasses(SegManager *segMan) {
if (getSciVersion() <= SCI_VERSION_1_LATE && !marker)
break;
- if (getSciVersion() >= SCI_VERSION_1_1 && marker != 0x1234)
+ if (getSciVersion() >= SCI_VERSION_1_1 && marker != SCRIPT_OBJECT_MAGIC_NUMBER)
break;
if (getSciVersion() <= SCI_VERSION_1_LATE) {
@@ -666,7 +658,7 @@ void Script::initializeObjectsSci11(SegManager *segMan, SegmentId segmentId) {
// Copy base from species class, as we need its selector IDs
obj->setSuperClassSelector(
- segMan->getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, NULL_REG));
+ segMan->getClassAddress(obj->getSuperClassSelector().getOffset(), SCRIPT_GET_LOCK, 0));
// If object is instance, get -propDict- from class and set it for this
// object. This is needed for ::isMemberOf() to work.
@@ -699,7 +691,7 @@ void Script::initializeObjectsSci3(SegManager *segMan, SegmentId segmentId) {
reg_t reg = make_reg(segmentId, seeker - _buf);
Object *obj = scriptObjInit(reg);
- obj->setSuperClassSelector(segMan->getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, NULL_REG));
+ obj->setSuperClassSelector(segMan->getClassAddress(obj->getSuperClassSelector().getOffset(), SCRIPT_GET_LOCK, 0));
seeker += READ_SCI11ENDIAN_UINT16(seeker + 2);
}
@@ -716,7 +708,7 @@ void Script::initializeObjects(SegManager *segMan, SegmentId segmentId) {
}
reg_t Script::findCanonicAddress(SegManager *segMan, reg_t addr) const {
- addr.offset = 0;
+ addr.setOffset(0);
return addr;
}
@@ -738,8 +730,8 @@ Common::Array<reg_t> Script::listAllDeallocatable(SegmentId segId) const {
Common::Array<reg_t> Script::listAllOutgoingReferences(reg_t addr) const {
Common::Array<reg_t> tmp;
- if (addr.offset <= _bufSize && addr.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT(_buf + addr.offset)) {
- const Object *obj = getObject(addr.offset);
+ if (addr.getOffset() <= _bufSize && addr.getOffset() >= (uint)-SCRIPT_OBJECT_MAGIC_OFFSET && offsetIsObject(addr.getOffset())) {
+ const Object *obj = getObject(addr.getOffset());
if (obj) {
// Note all local variables, if we have a local variable environment
if (_localsSegment)
@@ -774,4 +766,8 @@ Common::Array<reg_t> Script::listObjectReferences() const {
return tmp;
}
+bool Script::offsetIsObject(uint16 offset) const {
+ return (READ_SCI11ENDIAN_UINT16((const byte *)_buf + offset + SCRIPT_OBJECT_MAGIC_OFFSET) == SCRIPT_OBJECT_MAGIC_NUMBER);
+}
+
} // End of namespace Sci
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 1ebae3b7a8..0b499203c2 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -57,7 +57,7 @@ private:
int _lockers; /**< Number of classes and objects that require this script */
size_t _scriptSize;
size_t _heapSize;
- uint16 _bufSize;
+ size_t _bufSize;
const uint16 *_exportTable; /**< Abs. offset of the export table or 0 if not present */
uint16 _numExports; /**< Number of entries in the exports table */
@@ -89,14 +89,14 @@ public:
void syncLocalsBlock(SegManager *segMan);
ObjMap &getObjectMap() { return _objects; }
const ObjMap &getObjectMap() const { return _objects; }
+ bool offsetIsObject(uint16 offset) const;
public:
Script();
~Script();
void freeScript();
- void init(int script_nr, ResourceManager *resMan);
- void load(ResourceManager *resMan);
+ void load(int script_nr, ResourceManager *resMan);
void matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uint32 scriptSize);
int32 findSignature(const SciScriptSignature *signature, const byte *scriptData, const uint32 scriptSize);
@@ -197,11 +197,11 @@ public:
* Validate whether the specified public function is exported by
* the script in the specified segment.
* @param pubfunct Index of the function to validate
- * @param relocate Decide whether to relocate this public function or not
+ * @param relocSci3 Decide whether to relocate this SCI3 public function or not
* @return NULL if the public function is invalid, its
* offset into the script's segment otherwise
*/
- uint16 validateExportFunc(int pubfunct, bool relocate);
+ uint32 validateExportFunc(int pubfunct, bool relocSci3);
/**
* Marks the script as deleted.
@@ -249,7 +249,7 @@ public:
/**
* Gets an offset to the beginning of the code block in a SCI3 script
*/
- int getCodeBlockOffset() { return READ_SCI11ENDIAN_UINT32(_buf); }
+ int getCodeBlockOffsetSci3() { return READ_SCI11ENDIAN_UINT32(_buf); }
private:
/**
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 187f1ce021..8454be514a 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -775,7 +775,7 @@ const uint16 mothergoose256PatchReplay[] = {
PATCH_END
};
-// when saving, it also checks if the savegame-id is below 13.
+// when saving, it also checks if the savegame ID is below 13.
// we change this to check if below 113 instead
const byte mothergoose256SignatureSaveLimit[] = {
5,
@@ -915,9 +915,53 @@ const uint16 qfg3PatchImportDialog[] = {
PATCH_END
};
+
+
+// ===========================================================================
+// Patch for the Woo dialog option in Uhura's conversation. Bug #3040722
+// Problem: The Woo dialog option (0xffb5) is negative, and therefore
+// treated as an option opening a submenu. This leads to uhuraTell::doChild
+// being called, which calls hero::solvePuzzle and then proceeds with
+// Teller::doChild to open the submenu. However, there is no actual submenu
+// defined for option -75 since -75 does not show up in uhuraTell::keys.
+// This will cause Teller::doChild to run out of bounds while scanning through
+// uhuraTell::keys.
+// Strategy: there is another conversation option in uhuraTell::doChild calling
+// hero::solvePuzzle (0xfffc) which does a ret afterwards without going to
+// Teller::doChild. We jump to this call of hero::solvePuzzle to get that same
+// behaviour.
+
+const byte qfg3SignatureWooDialog[] = {
+ 30,
+ 0x67, 0x12, // pTos 12 (query)
+ 0x35, 0xb6, // ldi b6
+ 0x1a, // eq?
+ 0x2f, 0x05, // bt 05
+ 0x67, 0x12, // pTos 12 (query)
+ 0x35, 0x9b, // ldi 9b
+ 0x1a, // eq?
+ 0x31, 0x0c, // bnt 0c
+ 0x38, 0x97, 0x02, // pushi 0297
+ 0x7a, // push2
+ 0x38, 0x0c, 0x01, // pushi 010c
+ 0x7a, // push2
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x08, // send 08
+ 0x67, 0x12, // pTos 12 (query)
+ 0x35, 0xb5, // ldi b5
+ 0
+};
+
+const uint16 qfg3PatchWooDialog[] = {
+ PATCH_ADDTOOFFSET | +0x29,
+ 0x33, 0x11, // jmp to 0x6a2, the call to hero::solvePuzzle for 0xFFFC
+ PATCH_END
+};
+
// script, description, magic DWORD, adjust
const SciScriptSignature qfg3Signatures[] = {
{ 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x2a, 0x31, 0x0b, 0x7a), -1, qfg3SignatureImportDialog, qfg3PatchImportDialog },
+ { 440, "dialog crash when asking about Woo", 1, PATCH_MAGICDWORD(0x67, 0x12, 0x35, 0xb5), -26, qfg3SignatureWooDialog, qfg3PatchWooDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -978,7 +1022,27 @@ const uint16 sq4CdPatchTextOptionsButton[] = {
PATCH_END
};
-// Patch 2: Add the ability to toggle among the three available options,
+// Patch 2: Adjust a check in babbleIcon::init, which handles the babble icon
+// (e.g. the two guys from Andromeda) shown when dying/quitting.
+// Fixes bug #3538418.
+const byte sq4CdSignatureBabbleIcon[] = {
+ 7,
+ 0x89, 0x5a, // lsg 5a
+ 0x35, 0x02, // ldi 02
+ 0x1a, // eq?
+ 0x31, 0x26, // bnt 26 [02a7]
+ 0
+};
+
+const uint16 sq4CdPatchBabbleIcon[] = {
+ 0x89, 0x5a, // lsg 5a
+ 0x35, 0x01, // ldi 01
+ 0x1a, // eq?
+ 0x2f, 0x26, // bt 26 [02a7]
+ PATCH_END
+};
+
+// Patch 3: Add the ability to toggle among the three available options,
// when the text options button is clicked: "Speech", "Text" and "Both".
// Refer to the patch above for additional details.
// iconTextSwitch::doit (called when the text options button is clicked)
@@ -1030,6 +1094,7 @@ const SciScriptSignature sq4Signatures[] = {
{ 298, "Floppy: endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x44), -3, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight },
{ 298, "Floppy (German): endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x4c), -3, sq4FloppySignatureEndlessFlightGerman, sq4FloppyPatchEndlessFlight },
{ 818, "CD: Speech and subtitles option", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x3c, 0x35), 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions },
+ { 0, "CD: Babble icon speech and subtitles fix", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x35, 0x02), 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon },
{ 818, "CD: Speech and subtitles option button", 1, PATCH_MAGICDWORD(0x35, 0x01, 0xa1, 0x53), 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton },
SCI_SIGNATUREENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index ef61b2e28a..b2f22aa985 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -50,7 +50,7 @@ const char *opcodeNames[] = {
"lea", "selfID", "dummy", "pprev", "pToa",
"aTop", "pTos", "sTop", "ipToa", "dpToa",
"ipTos", "dpTos", "lofsa", "lofss", "push0",
- "push1", "push2", "pushSelf", "dummy", "lag",
+ "push1", "push2", "pushSelf", "line", "lag",
"lal", "lat", "lap", "lsg", "lsl",
"lst", "lsp", "lagi", "lali", "lati",
"lapi", "lsgi", "lsli", "lsti", "lspi",
@@ -68,18 +68,18 @@ const char *opcodeNames[] = {
#endif // REDUCE_MEMORY_USAGE
// Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
-reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode) {
- SegmentObj *mobj = s->_segMan->getSegment(pos.segment, SEG_TYPE_SCRIPT);
+reg_t disassemble(EngineState *s, reg32_t pos, bool printBWTag, bool printBytecode) {
+ SegmentObj *mobj = s->_segMan->getSegment(pos.getSegment(), SEG_TYPE_SCRIPT);
Script *script_entity = NULL;
const byte *scr;
- int scr_size;
- reg_t retval = make_reg(pos.segment, pos.offset + 1);
+ uint32 scr_size;
+ reg_t retval = make_reg(pos.getSegment(), pos.getOffset() + 1);
uint16 param_value = 0xffff; // Suppress GCC warning by setting default value, chose value as invalid to getKernelName etc.
- int i = 0;
+ uint i = 0;
Kernel *kernel = g_sci->getKernel();
if (!mobj) {
- warning("Disassembly failed: Segment %04x non-existant or not a script", pos.segment);
+ warning("Disassembly failed: Segment %04x non-existant or not a script", pos.getSegment());
return retval;
} else
script_entity = (Script *)mobj;
@@ -87,28 +87,37 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
scr = script_entity->getBuf();
scr_size = script_entity->getBufSize();
- if (pos.offset >= scr_size) {
+ if (pos.getOffset() >= scr_size) {
warning("Trying to disassemble beyond end of script");
return NULL_REG;
}
int16 opparams[4];
byte opsize;
- int bytecount = readPMachineInstruction(scr + pos.offset, opsize, opparams);
+ uint bytecount = readPMachineInstruction(scr + pos.getOffset(), opsize, opparams);
const byte opcode = opsize >> 1;
- opsize &= 1; // byte if true, word if false
-
debugN("%04x:%04x: ", PRINT_REG(pos));
+ if (opcode == op_pushSelf) { // 0x3e (62)
+ if ((opsize & 1) && g_sci->getGameId() != GID_FANMADE) {
+ // Debug opcode op_file
+ debugN("file \"%s\"\n", scr + pos.getOffset() + 1); // +1: op_pushSelf size
+ retval.incOffset(bytecount - 1);
+ return retval;
+ }
+ }
+
+ opsize &= 1; // byte if true, word if false
+
if (printBytecode) {
- if (pos.offset + bytecount > scr_size) {
+ if (pos.getOffset() + bytecount > scr_size) {
warning("Operation arguments extend beyond end of script");
return retval;
}
for (i = 0; i < bytecount; i++)
- debugN("%02x ", scr[pos.offset + i]);
+ debugN("%02x ", scr[pos.getOffset() + i]);
for (i = bytecount; i < 5; i++)
debugN(" ");
@@ -130,16 +139,16 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
case Script_SByte:
case Script_Byte:
- param_value = scr[retval.offset];
- debugN(" %02x", scr[retval.offset]);
- retval.offset++;
+ param_value = scr[retval.getOffset()];
+ debugN(" %02x", scr[retval.getOffset()]);
+ retval.incOffset(1);
break;
case Script_Word:
case Script_SWord:
- param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]);
- debugN(" %04x", READ_SCI11ENDIAN_UINT16(&scr[retval.offset]));
- retval.offset += 2;
+ param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.getOffset()]);
+ debugN(" %04x", READ_SCI11ENDIAN_UINT16(&scr[retval.getOffset()]));
+ retval.incOffset(2);
break;
case Script_SVariable:
@@ -149,11 +158,12 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
case Script_Local:
case Script_Temp:
case Script_Param:
- if (opsize)
- param_value = scr[retval.offset++];
- else {
- param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]);
- retval.offset += 2;
+ if (opsize) {
+ param_value = scr[retval.getOffset()];
+ retval.incOffset(1);
+ } else {
+ param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.getOffset()]);
+ retval.incOffset(2);
}
if (opcode == op_callk)
@@ -166,24 +176,26 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
break;
case Script_Offset:
- if (opsize)
- param_value = scr[retval.offset++];
- else {
- param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]);
- retval.offset += 2;
+ if (opsize) {
+ param_value = scr[retval.getOffset()];
+ retval.incOffset(1);
+ } else {
+ param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.getOffset()]);
+ retval.incOffset(2);
}
debugN(opsize ? " %02x" : " %04x", param_value);
break;
case Script_SRelative:
if (opsize) {
- int8 offset = (int8)scr[retval.offset++];
- debugN(" %02x [%04x]", 0xff & offset, 0xffff & (retval.offset + offset));
+ int8 offset = (int8)scr[retval.getOffset()];
+ retval.incOffset(1);
+ debugN(" %02x [%04x]", 0xff & offset, 0xffff & (retval.getOffset() + offset));
}
else {
- int16 offset = (int16)READ_SCI11ENDIAN_UINT16(&scr[retval.offset]);
- retval.offset += 2;
- debugN(" %04x [%04x]", 0xffff & offset, 0xffff & (retval.offset + offset));
+ int16 offset = (int16)READ_SCI11ENDIAN_UINT16(&scr[retval.getOffset()]);
+ retval.incOffset(2);
+ debugN(" %04x [%04x]", 0xffff & offset, 0xffff & (retval.getOffset() + offset));
}
break;
@@ -216,8 +228,8 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
if (pos == s->xs->addr.pc) { // Extra information if debugging the current opcode
if (opcode == op_callk) {
- int stackframe = (scr[pos.offset + 2] >> 1) + (s->r_rest);
- int argc = ((s->xs->sp)[- stackframe - 1]).offset;
+ int stackframe = (scr[pos.getOffset() + 2] >> 1) + (s->r_rest);
+ int argc = ((s->xs->sp)[- stackframe - 1]).getOffset();
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
if (!oldScriptHeader)
@@ -233,13 +245,13 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
debugN(")\n");
} else if ((opcode == op_send) || (opcode == op_self)) {
int restmod = s->r_rest;
- int stackframe = (scr[pos.offset + 1] >> 1) + restmod;
+ int stackframe = (scr[pos.getOffset() + 1] >> 1) + restmod;
reg_t *sb = s->xs->sp;
uint16 selector;
reg_t fun_ref;
while (stackframe > 0) {
- int argc = sb[- stackframe + 1].offset;
+ int argc = sb[- stackframe + 1].getOffset();
const char *name = NULL;
reg_t called_obj_addr = s->xs->objp;
@@ -248,7 +260,7 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
else if (opcode == op_self)
called_obj_addr = s->xs->objp;
- selector = sb[- stackframe].offset;
+ selector = sb[- stackframe].getOffset();
name = s->_segMan->getObjectName(called_obj_addr);
@@ -290,20 +302,20 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
}
bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpTarget) {
- SegmentObj *mobj = s->_segMan->getSegment(pos.segment, SEG_TYPE_SCRIPT);
+ SegmentObj *mobj = s->_segMan->getSegment(pos.getSegment(), SEG_TYPE_SCRIPT);
if (!mobj)
return false;
Script *script_entity = (Script *)mobj;
const byte *scr = script_entity->getBuf();
- int scr_size = script_entity->getScriptSize();
+ uint scr_size = script_entity->getScriptSize();
- if (pos.offset >= scr_size)
+ if (pos.getOffset() >= scr_size)
return false;
int16 opparams[4];
byte opsize;
- int bytecount = readPMachineInstruction(scr + pos.offset, opsize, opparams);
+ int bytecount = readPMachineInstruction(scr + pos.getOffset(), opsize, opparams);
const byte opcode = opsize >> 1;
switch (opcode) {
@@ -313,7 +325,7 @@ bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpTarget) {
{
reg_t jmpTarget = pos + bytecount + opparams[0];
// QFG2 has invalid jumps outside the script buffer in script 260
- if (jmpTarget.offset >= scr_size)
+ if (jmpTarget.getOffset() >= scr_size)
return false;
jumpTarget = jmpTarget;
}
@@ -335,17 +347,17 @@ void SciEngine::scriptDebug() {
}
if (_debugState.seeking != kDebugSeekNothing) {
- const reg_t pc = s->xs->addr.pc;
- SegmentObj *mobj = s->_segMan->getSegment(pc.segment, SEG_TYPE_SCRIPT);
+ const reg32_t pc = s->xs->addr.pc;
+ SegmentObj *mobj = s->_segMan->getSegment(pc.getSegment(), SEG_TYPE_SCRIPT);
if (mobj) {
Script *scr = (Script *)mobj;
const byte *code_buf = scr->getBuf();
- int code_buf_size = scr->getBufSize();
- int opcode = pc.offset >= code_buf_size ? 0 : code_buf[pc.offset];
+ uint16 code_buf_size = scr->getBufSize(); // TODO: change to a 32-bit integer for large SCI3 scripts
+ int opcode = pc.getOffset() >= code_buf_size ? 0 : code_buf[pc.getOffset()];
int op = opcode >> 1;
- int paramb1 = pc.offset + 1 >= code_buf_size ? 0 : code_buf[pc.offset + 1];
- int paramf1 = (opcode & 1) ? paramb1 : (pc.offset + 2 >= code_buf_size ? 0 : (int16)READ_SCI11ENDIAN_UINT16(code_buf + pc.offset + 1));
+ uint16 paramb1 = pc.getOffset() + 1 >= code_buf_size ? 0 : code_buf[pc.getOffset() + 1];
+ uint16 paramf1 = (opcode & 1) ? paramb1 : (pc.getOffset() + 2 >= code_buf_size ? 0 : (int16)READ_SCI11ENDIAN_UINT16(code_buf + pc.getOffset() + 1));
switch (_debugState.seeking) {
case kDebugSeekSpecialCallk:
@@ -502,7 +514,7 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
if (!objType) {
debugN("End of script object (#0) encountered.\n");
- debugN("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)",
+ debugN("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)\n",
objectctr[6], objectctr[1], objectctr[7], objectctr[10]);
return;
}
@@ -515,7 +527,8 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
_seeker += objsize;
- objectctr[objType]++;
+ if (objType >= 0 && objType < ARRAYSIZE(objectctr))
+ objectctr[objType]++;
switch (objType) {
case SCI_OBJ_OBJECT:
@@ -714,7 +727,7 @@ void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *ke
else if (regType & SIG_IS_INVALID)
debugN("INVALID");
else if (regType & SIG_TYPE_INTEGER)
- debugN("%d", argv[parmNr].offset);
+ debugN("%d", argv[parmNr].getOffset());
else {
debugN("%04x:%04x", PRINT_REG(argv[parmNr]));
switch (regType) {
@@ -723,12 +736,12 @@ void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *ke
break;
case SIG_TYPE_REFERENCE:
{
- SegmentObj *mobj = s->_segMan->getSegmentObj(argv[parmNr].segment);
+ SegmentObj *mobj = s->_segMan->getSegmentObj(argv[parmNr].getSegment());
switch (mobj->getType()) {
case SEG_TYPE_HUNK:
{
HunkTable *ht = (HunkTable *)mobj;
- int index = argv[parmNr].offset;
+ int index = argv[parmNr].getOffset();
if (ht->isValidEntry(index)) {
// NOTE: This ", deleted" isn't as useful as it could
// be because it prints the status _after_ the kernel
@@ -765,7 +778,7 @@ void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *ke
if (result.isPointer())
debugN(" = %04x:%04x\n", PRINT_REG(result));
else
- debugN(" = %d\n", result.offset);
+ debugN(" = %d\n", result.getOffset());
}
} // End of namespace Sci
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index cc127c8dbc..04c1dab158 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -81,7 +81,7 @@ void SegManager::initSysStrings() {
if (getSciVersion() <= SCI_VERSION_1_1) {
// We need to allocate system strings in one segment, for compatibility reasons
allocDynmem(512, "system strings", &_saveDirPtr);
- _parserPtr = make_reg(_saveDirPtr.segment, _saveDirPtr.offset + 256);
+ _parserPtr = make_reg(_saveDirPtr.getSegment(), _saveDirPtr.getOffset() + 256);
#ifdef ENABLE_SCI32
} else {
SciString *saveDirString = allocateString(&_saveDirPtr);
@@ -143,16 +143,27 @@ Script *SegManager::allocateScript(int script_nr, SegmentId *segid) {
}
void SegManager::deallocate(SegmentId seg) {
- if (!check(seg))
- error("SegManager::deallocate(): invalid segment ID");
+ if (seg < 1 || (uint)seg >= _heap.size())
+ error("Attempt to deallocate an invalid segment ID");
SegmentObj *mobj = _heap[seg];
+ if (!mobj)
+ error("Attempt to deallocate an already freed segment");
if (mobj->getType() == SEG_TYPE_SCRIPT) {
Script *scr = (Script *)mobj;
_scriptSegMap.erase(scr->getScriptNumber());
- if (scr->getLocalsSegment())
- deallocate(scr->getLocalsSegment());
+ if (scr->getLocalsSegment()) {
+ // Check if the locals segment has already been deallocated.
+ // If the locals block has been stored in a segment with an ID
+ // smaller than the segment ID of the script itself, it will be
+ // already freed at this point. This can happen when scripts are
+ // uninstantiated and instantiated again: they retain their own
+ // segment ID, but are allocated a new locals segment, which can
+ // have an ID smaller than the segment of the script itself.
+ if (_heap[scr->getLocalsSegment()])
+ deallocate(scr->getLocalsSegment());
+ }
}
delete mobj;
@@ -163,7 +174,7 @@ bool SegManager::isHeapObject(reg_t pos) const {
const Object *obj = getObject(pos);
if (obj == NULL || (obj && obj->isFreed()))
return false;
- Script *scr = getScriptIfLoaded(pos.segment);
+ Script *scr = getScriptIfLoaded(pos.getSegment());
return !(scr && scr->isMarkedAsDeleted());
}
@@ -214,21 +225,21 @@ SegmentObj *SegManager::getSegment(SegmentId seg, SegmentType type) const {
}
Object *SegManager::getObject(reg_t pos) const {
- SegmentObj *mobj = getSegmentObj(pos.segment);
+ SegmentObj *mobj = getSegmentObj(pos.getSegment());
Object *obj = NULL;
if (mobj != NULL) {
if (mobj->getType() == SEG_TYPE_CLONES) {
CloneTable *ct = (CloneTable *)mobj;
- if (ct->isValidEntry(pos.offset))
- obj = &(ct->_table[pos.offset]);
+ if (ct->isValidEntry(pos.getOffset()))
+ obj = &(ct->_table[pos.getOffset()]);
else
warning("getObject(): Trying to get an invalid object");
} else if (mobj->getType() == SEG_TYPE_SCRIPT) {
Script *scr = (Script *)mobj;
- if (pos.offset <= scr->getBufSize() && pos.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET
- && RAW_IS_OBJECT(scr->getBuf(pos.offset))) {
- obj = scr->getObject(pos.offset);
+ if (pos.getOffset() <= scr->getBufSize() && pos.getOffset() >= (uint)-SCRIPT_OBJECT_MAGIC_OFFSET
+ && scr->offsetIsObject(pos.getOffset())) {
+ obj = scr->getObject(pos.getOffset());
}
}
}
@@ -246,7 +257,7 @@ const char *SegManager::getObjectName(reg_t pos) {
return "<no name>";
const char *name = 0;
- if (nameReg.segment)
+ if (nameReg.getSegment())
name = derefString(nameReg);
if (!name)
return "<invalid name>";
@@ -272,7 +283,7 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
const Script *scr = (const Script *)mobj;
const ObjMap &objects = scr->getObjectMap();
for (ObjMap::const_iterator it = objects.begin(); it != objects.end(); ++it) {
- objpos.offset = it->_value.getPos().offset;
+ objpos.setOffset(it->_value.getPos().getOffset());
if (name == getObjectName(objpos))
result.push_back(objpos);
}
@@ -283,7 +294,7 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
if (!ct->isValidEntry(idx))
continue;
- objpos.offset = idx;
+ objpos.setOffset(idx);
if (name == getObjectName(objpos))
result.push_back(objpos);
}
@@ -307,21 +318,6 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
return result[index];
}
-// validate the seg
-// return:
-// false - invalid seg
-// true - valid seg
-bool SegManager::check(SegmentId seg) {
- if (seg < 1 || (uint)seg >= _heap.size()) {
- return false;
- }
- if (!_heap[seg]) {
- warning("SegManager: seg %x is removed from memory, but not removed from hash_map", seg);
- return false;
- }
- return true;
-}
-
// return the seg if script_id is valid and in the map, else 0
SegmentId SegManager::getScriptSegment(int script_id) const {
return _scriptSegMap.getVal(script_id, 0);
@@ -364,14 +360,14 @@ void SegManager::freeHunkEntry(reg_t addr) {
return;
}
- HunkTable *ht = (HunkTable *)getSegment(addr.segment, SEG_TYPE_HUNK);
+ HunkTable *ht = (HunkTable *)getSegment(addr.getSegment(), SEG_TYPE_HUNK);
if (!ht) {
warning("Attempt to free Hunk from address %04x:%04x: Invalid segment type", PRINT_REG(addr));
return;
}
- ht->freeEntryContents(addr.offset);
+ ht->freeEntryContents(addr.getOffset());
}
reg_t SegManager::allocateHunkEntry(const char *hunk_type, int size) {
@@ -398,14 +394,14 @@ reg_t SegManager::allocateHunkEntry(const char *hunk_type, int size) {
}
byte *SegManager::getHunkPointer(reg_t addr) {
- HunkTable *ht = (HunkTable *)getSegment(addr.segment, SEG_TYPE_HUNK);
+ HunkTable *ht = (HunkTable *)getSegment(addr.getSegment(), SEG_TYPE_HUNK);
- if (!ht || !ht->isValidEntry(addr.offset)) {
+ if (!ht || !ht->isValidEntry(addr.getOffset())) {
// Valid SCI behavior, e.g. when loading/quitting
return NULL;
}
- return (byte *)ht->_table[addr.offset].mem;
+ return (byte *)ht->_table[addr.getOffset()].mem;
}
Clone *SegManager::allocateClone(reg_t *addr) {
@@ -462,35 +458,35 @@ reg_t SegManager::newNode(reg_t value, reg_t key) {
}
List *SegManager::lookupList(reg_t addr) {
- if (getSegmentType(addr.segment) != SEG_TYPE_LISTS) {
+ if (getSegmentType(addr.getSegment()) != SEG_TYPE_LISTS) {
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
return NULL;
}
- ListTable *lt = (ListTable *)_heap[addr.segment];
+ ListTable *lt = (ListTable *)_heap[addr.getSegment()];
- if (!lt->isValidEntry(addr.offset)) {
+ if (!lt->isValidEntry(addr.getOffset())) {
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
return NULL;
}
- return &(lt->_table[addr.offset]);
+ return &(lt->_table[addr.getOffset()]);
}
Node *SegManager::lookupNode(reg_t addr, bool stopOnDiscarded) {
if (addr.isNull())
return NULL; // Non-error null
- SegmentType type = getSegmentType(addr.segment);
+ SegmentType type = getSegmentType(addr.getSegment());
if (type != SEG_TYPE_NODES) {
error("Attempt to use non-node %04x:%04x (type %d) as list node", PRINT_REG(addr), type);
return NULL;
}
- NodeTable *nt = (NodeTable *)_heap[addr.segment];
+ NodeTable *nt = (NodeTable *)_heap[addr.getSegment()];
- if (!nt->isValidEntry(addr.offset)) {
+ if (!nt->isValidEntry(addr.getOffset())) {
if (!stopOnDiscarded)
return NULL;
@@ -498,19 +494,19 @@ Node *SegManager::lookupNode(reg_t addr, bool stopOnDiscarded) {
return NULL;
}
- return &(nt->_table[addr.offset]);
+ return &(nt->_table[addr.getOffset()]);
}
SegmentRef SegManager::dereference(reg_t pointer) {
SegmentRef ret;
- if (!pointer.segment || (pointer.segment >= _heap.size()) || !_heap[pointer.segment]) {
+ if (!pointer.getSegment() || (pointer.getSegment() >= _heap.size()) || !_heap[pointer.getSegment()]) {
// This occurs in KQ5CD when interacting with certain objects
warning("SegManager::dereference(): Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer));
return ret; /* Invalid */
}
- SegmentObj *mobj = _heap[pointer.segment];
+ SegmentObj *mobj = _heap[pointer.getSegment()];
return mobj->dereference(pointer);
}
@@ -522,7 +518,7 @@ static void *derefPtr(SegManager *segMan, reg_t pointer, int entries, bool wantR
if (ret.isRaw != wantRaw) {
warning("Dereferencing pointer %04x:%04x (type %d) which is %s, but expected %s", PRINT_REG(pointer),
- segMan->getSegmentType(pointer.segment),
+ segMan->getSegmentType(pointer.getSegment()),
ret.isRaw ? "raw" : "not raw",
wantRaw ? "raw" : "not raw");
}
@@ -565,15 +561,15 @@ static inline char getChar(const SegmentRef &ref, uint offset) {
// segment 0xFFFF means that the scripts are using uninitialized temp-variable space
// we can safely ignore this, if it isn't one of the first 2 chars.
// foreign lsl3 uses kFileIO(readraw) and then immediately uses kReadNumber right at the start
- if (val.segment != 0)
- if (!((val.segment == 0xFFFF) && (offset > 1)))
+ if (val.getSegment() != 0)
+ if (!((val.getSegment() == 0xFFFF) && (offset > 1)))
warning("Attempt to read character from non-raw data");
bool oddOffset = offset & 1;
if (g_sci->isBE())
oddOffset = !oddOffset;
- return (oddOffset ? val.offset >> 8 : val.offset & 0xff);
+ return (oddOffset ? val.getOffset() >> 8 : val.getOffset() & 0xff);
}
static inline void setChar(const SegmentRef &ref, uint offset, byte value) {
@@ -582,16 +578,16 @@ static inline void setChar(const SegmentRef &ref, uint offset, byte value) {
reg_t *val = ref.reg + offset / 2;
- val->segment = 0;
+ val->setSegment(0);
bool oddOffset = offset & 1;
if (g_sci->isBE())
oddOffset = !oddOffset;
if (oddOffset)
- val->offset = (val->offset & 0x00ff) | (value << 8);
+ val->setOffset((val->getOffset() & 0x00ff) | (value << 8));
else
- val->offset = (val->offset & 0xff00) | value;
+ val->setOffset((val->getOffset() & 0xff00) | value);
}
// TODO: memcpy, strcpy and strncpy could maybe be folded into a single function
@@ -829,10 +825,11 @@ byte *SegManager::allocDynmem(int size, const char *descr, reg_t *addr) {
}
bool SegManager::freeDynmem(reg_t addr) {
- if (addr.segment < 1 || addr.segment >= _heap.size() || !_heap[addr.segment] || _heap[addr.segment]->getType() != SEG_TYPE_DYNMEM)
+ if (addr.getSegment() < 1 || addr.getSegment() >= _heap.size() ||
+ !_heap[addr.getSegment()] || _heap[addr.getSegment()]->getType() != SEG_TYPE_DYNMEM)
return false; // error
- deallocate(addr.segment);
+ deallocate(addr.getSegment());
return true; // OK
}
@@ -854,28 +851,28 @@ SciArray<reg_t> *SegManager::allocateArray(reg_t *addr) {
}
SciArray<reg_t> *SegManager::lookupArray(reg_t addr) {
- if (_heap[addr.segment]->getType() != SEG_TYPE_ARRAY)
+ if (_heap[addr.getSegment()]->getType() != SEG_TYPE_ARRAY)
error("Attempt to use non-array %04x:%04x as array", PRINT_REG(addr));
- ArrayTable *arrayTable = (ArrayTable *)_heap[addr.segment];
+ ArrayTable *arrayTable = (ArrayTable *)_heap[addr.getSegment()];
- if (!arrayTable->isValidEntry(addr.offset))
+ if (!arrayTable->isValidEntry(addr.getOffset()))
error("Attempt to use non-array %04x:%04x as array", PRINT_REG(addr));
- return &(arrayTable->_table[addr.offset]);
+ return &(arrayTable->_table[addr.getOffset()]);
}
void SegManager::freeArray(reg_t addr) {
- if (_heap[addr.segment]->getType() != SEG_TYPE_ARRAY)
+ if (_heap[addr.getSegment()]->getType() != SEG_TYPE_ARRAY)
error("Attempt to use non-array %04x:%04x as array", PRINT_REG(addr));
- ArrayTable *arrayTable = (ArrayTable *)_heap[addr.segment];
+ ArrayTable *arrayTable = (ArrayTable *)_heap[addr.getSegment()];
- if (!arrayTable->isValidEntry(addr.offset))
+ if (!arrayTable->isValidEntry(addr.getOffset()))
error("Attempt to use non-array %04x:%04x as array", PRINT_REG(addr));
- arrayTable->_table[addr.offset].destroy();
- arrayTable->freeEntry(addr.offset);
+ arrayTable->_table[addr.getOffset()].destroy();
+ arrayTable->freeEntry(addr.getOffset());
}
SciString *SegManager::allocateString(reg_t *addr) {
@@ -894,28 +891,28 @@ SciString *SegManager::allocateString(reg_t *addr) {
}
SciString *SegManager::lookupString(reg_t addr) {
- if (_heap[addr.segment]->getType() != SEG_TYPE_STRING)
+ if (_heap[addr.getSegment()]->getType() != SEG_TYPE_STRING)
error("lookupString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
- StringTable *stringTable = (StringTable *)_heap[addr.segment];
+ StringTable *stringTable = (StringTable *)_heap[addr.getSegment()];
- if (!stringTable->isValidEntry(addr.offset))
+ if (!stringTable->isValidEntry(addr.getOffset()))
error("lookupString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
- return &(stringTable->_table[addr.offset]);
+ return &(stringTable->_table[addr.getOffset()]);
}
void SegManager::freeString(reg_t addr) {
- if (_heap[addr.segment]->getType() != SEG_TYPE_STRING)
+ if (_heap[addr.getSegment()]->getType() != SEG_TYPE_STRING)
error("freeString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
- StringTable *stringTable = (StringTable *)_heap[addr.segment];
+ StringTable *stringTable = (StringTable *)_heap[addr.getSegment()];
- if (!stringTable->isValidEntry(addr.offset))
+ if (!stringTable->isValidEntry(addr.getOffset()))
error("freeString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
- stringTable->_table[addr.offset].destroy();
- stringTable->freeEntry(addr.offset);
+ stringTable->_table[addr.getOffset()].destroy();
+ stringTable->freeEntry(addr.getOffset());
}
#endif
@@ -939,7 +936,7 @@ void SegManager::createClassTable() {
_resMan->unlockResource(vocab996);
}
-reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, reg_t caller) {
+reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, uint16 callerSegment) {
if (classnr == 0xffff)
return NULL_REG;
@@ -948,16 +945,16 @@ reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, reg_t caller
return NULL_REG;
} else {
Class *the_class = &_classTable[classnr];
- if (!the_class->reg.segment) {
+ if (!the_class->reg.getSegment()) {
getScriptSegment(the_class->script, lock);
- if (!the_class->reg.segment) {
+ if (!the_class->reg.getSegment()) {
error("[VM] Trying to instantiate class %x by instantiating script 0x%x (%03d) failed;", classnr, the_class->script, the_class->script);
return NULL_REG;
}
} else
- if (caller.segment != the_class->reg.segment)
- getScript(the_class->reg.segment)->incrementLockers();
+ if (callerSegment != the_class->reg.getSegment())
+ getScript(the_class->reg.getSegment())->incrementLockers();
return the_class->reg;
}
@@ -977,8 +974,7 @@ int SegManager::instantiateScript(int scriptNum) {
scr = allocateScript(scriptNum, &segmentId);
}
- scr->init(scriptNum, _resMan);
- scr->load(_resMan);
+ scr->load(scriptNum, _resMan);
scr->initializeLocals(this);
scr->initializeClasses(this);
scr->initializeObjects(this, segmentId);
@@ -1003,7 +999,7 @@ void SegManager::uninstantiateScript(int script_nr) {
// Free all classtable references to this script
for (uint i = 0; i < classTableSize(); i++)
- if (getClass(i).reg.segment == segmentId)
+ if (getClass(i).reg.getSegment() == segmentId)
setClassOffset(i, NULL_REG);
if (getSciVersion() < SCI_VERSION_1_1)
@@ -1027,18 +1023,18 @@ void SegManager::uninstantiateScriptSci0(int script_nr) {
// Make a pass over the object in order to uninstantiate all superclasses
do {
- reg.offset += objLength; // Step over the last checked object
+ reg.incOffset(objLength); // Step over the last checked object
- objType = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.offset));
+ objType = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.getOffset()));
if (!objType)
break;
- objLength = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.offset + 2));
+ objLength = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.getOffset() + 2));
- reg.offset += 4; // Step over header
+ reg.incOffset(4); // Step over header
if ((objType == SCI_OBJ_OBJECT) || (objType == SCI_OBJ_CLASS)) { // object or class?
- reg.offset += 8; // magic offset (SCRIPT_OBJECT_MAGIC_OFFSET)
- int16 superclass = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.offset + 2));
+ reg.incOffset(8); // magic offset (SCRIPT_OBJECT_MAGIC_OFFSET)
+ int16 superclass = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.getOffset() + 2));
if (superclass >= 0) {
int superclass_script = getClass(superclass).script;
@@ -1052,10 +1048,10 @@ void SegManager::uninstantiateScriptSci0(int script_nr) {
// Recurse to assure that the superclass lockers number gets decreased
}
- reg.offset += SCRIPT_OBJECT_MAGIC_OFFSET;
+ reg.incOffset(SCRIPT_OBJECT_MAGIC_OFFSET);
} // if object or class
- reg.offset -= 4; // Step back on header
+ reg.incOffset(-4); // Step back on header
} while (objType != 0);
}
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 62e711e686..074d3f6b0a 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -125,7 +125,7 @@ private:
public:
// TODO: document this
- reg_t getClassAddress(int classnr, ScriptLoadType lock, reg_t caller);
+ reg_t getClassAddress(int classnr, ScriptLoadType lock, uint16 callerSegment);
/**
* Return a pointer to the specified script.
@@ -471,14 +471,6 @@ private:
void createClassTable();
SegmentId findFreeSegment() const;
-
- /**
- * Check segment validity
- * @param[in] seg The segment to validate
- * @return false if 'seg' is an invalid segment, true if
- * 'seg' is a valid segment
- */
- bool check(SegmentId seg);
};
} // End of namespace Sci
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 36b7d92c07..a7f147a15a 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -93,11 +93,11 @@ Common::Array<reg_t> CloneTable::listAllOutgoingReferences(reg_t addr) const {
Common::Array<reg_t> tmp;
// assert(addr.segment == _segId);
- if (!isValidEntry(addr.offset)) {
+ if (!isValidEntry(addr.getOffset())) {
error("Unexpected request for outgoing references from clone at %04x:%04x", PRINT_REG(addr));
}
- const Clone *clone = &(_table[addr.offset]);
+ const Clone *clone = &(_table[addr.getOffset()]);
// Emit all member variables (including references to the 'super' delegate)
for (uint i = 0; i < clone->getVarCount(); i++)
@@ -112,7 +112,7 @@ Common::Array<reg_t> CloneTable::listAllOutgoingReferences(reg_t addr) const {
void CloneTable::freeAtAddress(SegManager *segMan, reg_t addr) {
#ifdef GC_DEBUG
- Object *victim_obj = &(_table[addr.offset]);
+ Object *victim_obj = &(_table[addr.getOffset()]);
if (!(victim_obj->_flags & OBJECT_FLAG_FREED))
warning("[GC] Clone %04x:%04x not reachable and not freed (freeing now)", PRINT_REG(addr));
@@ -124,7 +124,7 @@ void CloneTable::freeAtAddress(SegManager *segMan, reg_t addr) {
#endif
#endif
- freeEntry(addr.offset);
+ freeEntry(addr.getOffset());
}
@@ -133,15 +133,15 @@ void CloneTable::freeAtAddress(SegManager *segMan, reg_t addr) {
SegmentRef LocalVariables::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = false; // reg_t based data!
- ret.maxSize = (_locals.size() - pointer.offset / 2) * 2;
+ ret.maxSize = (_locals.size() - pointer.getOffset() / 2) * 2;
- if (pointer.offset & 1) {
+ if (pointer.getOffset() & 1) {
ret.maxSize -= 1;
ret.skipByte = true;
}
if (ret.maxSize > 0) {
- ret.reg = &_locals[pointer.offset / 2];
+ ret.reg = &_locals[pointer.getOffset() / 2];
} else {
if ((g_sci->getEngineState()->currentRoomNumber() == 160 ||
g_sci->getEngineState()->currentRoomNumber() == 220)
@@ -181,14 +181,14 @@ Common::Array<reg_t> LocalVariables::listAllOutgoingReferences(reg_t addr) const
SegmentRef DataStack::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = false; // reg_t based data!
- ret.maxSize = (_capacity - pointer.offset / 2) * 2;
+ ret.maxSize = (_capacity - pointer.getOffset() / 2) * 2;
- if (pointer.offset & 1) {
+ if (pointer.getOffset() & 1) {
ret.maxSize -= 1;
ret.skipByte = true;
}
- ret.reg = &_entries[pointer.offset / 2];
+ ret.reg = &_entries[pointer.getOffset() / 2];
return ret;
}
@@ -204,11 +204,11 @@ Common::Array<reg_t> DataStack::listAllOutgoingReferences(reg_t object) const {
Common::Array<reg_t> ListTable::listAllOutgoingReferences(reg_t addr) const {
Common::Array<reg_t> tmp;
- if (!isValidEntry(addr.offset)) {
+ if (!isValidEntry(addr.getOffset())) {
error("Invalid list referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
}
- const List *list = &(_table[addr.offset]);
+ const List *list = &(_table[addr.getOffset()]);
tmp.push_back(list->first);
tmp.push_back(list->last);
@@ -222,10 +222,10 @@ Common::Array<reg_t> ListTable::listAllOutgoingReferences(reg_t addr) const {
Common::Array<reg_t> NodeTable::listAllOutgoingReferences(reg_t addr) const {
Common::Array<reg_t> tmp;
- if (!isValidEntry(addr.offset)) {
+ if (!isValidEntry(addr.getOffset())) {
error("Invalid node referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
}
- const Node *node = &(_table[addr.offset]);
+ const Node *node = &(_table[addr.getOffset()]);
// We need all four here. Can't just stick with 'pred' OR 'succ' because node operations allow us
// to walk around from any given node
@@ -242,8 +242,8 @@ Common::Array<reg_t> NodeTable::listAllOutgoingReferences(reg_t addr) const {
SegmentRef DynMem::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = true;
- ret.maxSize = _size - pointer.offset;
- ret.raw = _buf + pointer.offset;
+ ret.maxSize = _size - pointer.getOffset();
+ ret.raw = _buf + pointer.getOffset();
return ret;
}
@@ -252,27 +252,27 @@ SegmentRef DynMem::dereference(reg_t pointer) {
SegmentRef ArrayTable::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = false;
- ret.maxSize = _table[pointer.offset].getSize() * 2;
- ret.reg = _table[pointer.offset].getRawData();
+ ret.maxSize = _table[pointer.getOffset()].getSize() * 2;
+ ret.reg = _table[pointer.getOffset()].getRawData();
return ret;
}
void ArrayTable::freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- _table[sub_addr.offset].destroy();
- freeEntry(sub_addr.offset);
+ _table[sub_addr.getOffset()].destroy();
+ freeEntry(sub_addr.getOffset());
}
Common::Array<reg_t> ArrayTable::listAllOutgoingReferences(reg_t addr) const {
Common::Array<reg_t> tmp;
- if (!isValidEntry(addr.offset)) {
+ if (!isValidEntry(addr.getOffset())) {
error("Invalid array referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
}
- const SciArray<reg_t> *array = &(_table[addr.offset]);
+ const SciArray<reg_t> *array = &(_table[addr.getOffset()]);
for (uint32 i = 0; i < array->getSize(); i++) {
reg_t value = array->getValue(i);
- if (value.segment != 0)
+ if (value.getSegment() != 0)
tmp.push_back(value);
}
@@ -305,8 +305,8 @@ void SciString::fromString(const Common::String &string) {
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.maxSize = _table[pointer.getOffset()].getSize();
+ ret.raw = (byte *)_table[pointer.getOffset()].getRawData();
return ret;
}
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index 54cf7b98af..0d54b651e1 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -175,7 +175,7 @@ public:
}
virtual SegmentRef dereference(reg_t pointer);
virtual reg_t findCanonicAddress(SegManager *segMan, reg_t addr) const {
- return make_reg(addr.segment, 0);
+ return make_reg(addr.getSegment(), 0);
}
virtual Common::Array<reg_t> listAllOutgoingReferences(reg_t object) const;
@@ -291,7 +291,7 @@ struct NodeTable : public SegmentObjTable<Node> {
NodeTable() : SegmentObjTable<Node>(SEG_TYPE_NODES) {}
virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- freeEntry(sub_addr.offset);
+ freeEntry(sub_addr.getOffset());
}
virtual Common::Array<reg_t> listAllOutgoingReferences(reg_t object) const;
@@ -304,7 +304,7 @@ struct ListTable : public SegmentObjTable<List> {
ListTable() : SegmentObjTable<List>(SEG_TYPE_LISTS) {}
virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- freeEntry(sub_addr.offset);
+ freeEntry(sub_addr.getOffset());
}
virtual Common::Array<reg_t> listAllOutgoingReferences(reg_t object) const;
@@ -333,7 +333,7 @@ struct HunkTable : public SegmentObjTable<Hunk> {
}
virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- freeEntry(sub_addr.offset);
+ freeEntry(sub_addr.getOffset());
}
virtual void saveLoadWithSerializer(Common::Serializer &ser);
@@ -358,7 +358,7 @@ public:
}
virtual SegmentRef dereference(reg_t pointer);
virtual reg_t findCanonicAddress(SegManager *segMan, reg_t addr) const {
- return make_reg(addr.segment, 0);
+ return make_reg(addr.getSegment(), 0);
}
virtual Common::Array<reg_t> listAllDeallocatable(SegmentId segId) const {
const reg_t r = make_reg(segId, 0);
@@ -502,8 +502,8 @@ struct StringTable : public SegmentObjTable<SciString> {
StringTable() : SegmentObjTable<SciString>(SEG_TYPE_STRING) {}
virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- _table[sub_addr.offset].destroy();
- freeEntry(sub_addr.offset);
+ _table[sub_addr.getOffset()].destroy();
+ freeEntry(sub_addr.getOffset());
}
void saveLoadWithSerializer(Common::Serializer &ser);
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index a8b1cf7ec2..2f6b4d58dd 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -181,6 +181,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(skip);
FIND_SELECTOR(fixPriority);
FIND_SELECTOR(mirrored);
+ FIND_SELECTOR(visible);
FIND_SELECTOR(useInsetRect);
FIND_SELECTOR(inTop);
FIND_SELECTOR(inLeft);
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index 4b913a866a..5d3d0752ac 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -149,6 +149,7 @@ struct SelectorCache {
Selector fixPriority;
Selector mirrored;
+ Selector visible;
Selector useInsetRect;
Selector inTop, inLeft, inBottom, inRight;
@@ -170,7 +171,7 @@ struct SelectorCache {
* SelectorCache and mapped in script.cpp.
*/
reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId);
-#define readSelectorValue(segMan, _obj_, _slc_) (readSelector(segMan, _obj_, _slc_).offset)
+#define readSelectorValue(segMan, _obj_, _slc_) (readSelector(segMan, _obj_, _slc_).getOffset())
/**
* Writes a selector value to an object.
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 28818cddef..0f0c8dcd66 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -26,6 +26,7 @@
#include "sci/debug.h" // for g_debug_sleeptime_factor
#include "sci/event.h"
+#include "sci/engine/file.h"
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
@@ -68,21 +69,26 @@ static const uint16 s_halfWidthSJISMap[256] = {
};
EngineState::EngineState(SegManager *segMan)
-: _segMan(segMan), _dirseeker() {
+: _segMan(segMan),
+#ifdef ENABLE_SCI32
+ _virtualIndexFile(0),
+#endif
+ _dirseeker() {
reset(false);
}
EngineState::~EngineState() {
delete _msgState;
+#ifdef ENABLE_SCI32
+ delete _virtualIndexFile;
+#endif
}
void EngineState::reset(bool isRestoring) {
if (!isRestoring) {
_memorySegmentSize = 0;
-
_fileHandles.resize(5);
-
abortScriptProcessing = kAbortNone;
}
@@ -116,6 +122,11 @@ void EngineState::reset(bool isRestoring) {
_videoState.reset();
_syncedAudioOptions = false;
+
+ _vmdPalStart = 0;
+ _vmdPalEnd = 256;
+
+ _palCycleToColor = 255;
}
void EngineState::speedThrottler(uint32 neededSleep) {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index dcffe6dbb3..81090876c7 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -34,6 +34,7 @@ class WriteStream;
}
#include "sci/sci.h"
+#include "sci/engine/file.h"
#include "sci/engine/seg_manager.h"
#include "sci/parser/vocabulary.h"
@@ -42,9 +43,12 @@ class WriteStream;
namespace Sci {
+class FileHandle;
+class DirSeeker;
class EventManager;
class MessageState;
class SoundCommandParser;
+class VirtualIndexFile;
enum AbortGameState {
kAbortNone = 0,
@@ -53,32 +57,6 @@ enum AbortGameState {
kAbortQuitGame = 3
};
-class DirSeeker {
-protected:
- reg_t _outbuffer;
- Common::StringArray _files;
- Common::StringArray _virtualFiles;
- Common::StringArray::const_iterator _iter;
-
-public:
- DirSeeker() {
- _outbuffer = NULL_REG;
- _iter = _files.begin();
- }
-
- reg_t firstFile(const Common::String &mask, reg_t buffer, SegManager *segMan);
- reg_t nextFile(SegManager *segMan);
-
- Common::String getVirtualFilename(uint fileNumber);
-
-private:
- void addAsVirtualFiles(Common::String title, Common::String fileMask);
-};
-
-enum {
- MAX_SAVEGAME_NR = 20 /**< Maximum number of savegames */
-};
-
// We assume that scripts give us savegameId 0->99 for creating a new save slot
// and savegameId 100->199 for existing save slots ffs. kfile.cpp
enum {
@@ -92,20 +70,6 @@ enum {
GAMEISRESTARTING_RESTORE = 2
};
-class FileHandle {
-public:
- Common::String _name;
- Common::SeekableReadStream *_in;
- Common::WriteStream *_out;
-
-public:
- FileHandle();
- ~FileHandle();
-
- void close();
- bool isOpen() const;
-};
-
enum VideoFlags {
kNone = 0,
kDoubled = 1 << 0,
@@ -163,6 +127,10 @@ public:
int16 _lastSaveVirtualId; // last virtual id fed to kSaveGame, if no kGetSaveFiles was called inbetween
int16 _lastSaveNewId; // last newly created filename-id by kSaveGame
+#ifdef ENABLE_SCI32
+ VirtualIndexFile *_virtualIndexFile;
+#endif
+
uint _chosenQfGImportItem; // Remembers the item selected in QfG import rooms
bool _cursorWorkaroundActive; // ffs. GfxCursor::setPosition()
@@ -228,8 +196,11 @@ public:
byte _memorySegment[kMemorySegmentMax];
VideoState _videoState;
+ uint16 _vmdPalStart, _vmdPalEnd;
bool _syncedAudioOptions;
+ uint16 _palCycleToColor;
+
/**
* Resets the engine state.
*/
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 162dce9fcc..ef8f165084 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -119,7 +119,7 @@ extern const char *opcodeNames[]; // from scriptdebug.cpp
static reg_t read_var(EngineState *s, int type, int index) {
if (validate_variable(s->variables[type], s->stack_base, type, s->variablesMax[type], index)) {
- if (s->variables[type][index].segment == 0xffff) {
+ if (s->variables[type][index].getSegment() == 0xffff) {
switch (type) {
case VAR_TEMP: {
// Uninitialized read on a temp
@@ -195,8 +195,8 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
// this happens at least in sq1/room 44 (slot-machine), because a send is missing parameters, then
// those parameters are taken from uninitialized stack and afterwards they are copied back into temps
// if we don't remove the segment, we would get false-positive uninitialized reads later
- if (type == VAR_TEMP && value.segment == 0xffff)
- value.segment = 0;
+ if (type == VAR_TEMP && value.getSegment() == 0xffff)
+ value.setSegment(0);
s->variables[type][index] = value;
@@ -225,30 +225,15 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
scr = s->_segMan->getScript(seg);
}
- int temp = scr->validateExportFunc(pubfunct, false);
-
- if (getSciVersion() == SCI_VERSION_3)
- temp += scr->getCodeBlockOffset();
-
- if (!temp) {
-#ifdef ENABLE_SCI32
- 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);
+ uint32 exportAddr = scr->validateExportFunc(pubfunct, false);
+ if (!exportAddr)
return NULL;
- }
// Check if a breakpoint is set on this method
g_sci->checkExportBreakpoint(script, pubfunct);
ExecStack xstack(calling_obj, calling_obj, sp, argc, argp,
- seg, make_reg(seg, temp), -1, pubfunct, -1,
+ seg, make_reg32(seg, exportAddr), -1, pubfunct, -1,
s->_executionStack.size() - 1, EXEC_STACK_TYPE_CALL);
s->_executionStack.push_back(xstack);
return &(s->_executionStack.back());
@@ -304,11 +289,12 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
ExecStackType stackType = EXEC_STACK_TYPE_VARSELECTOR;
StackPtr curSP = NULL;
- reg_t curFP = NULL_REG;
+ reg32_t curFP = make_reg32(0, 0);
if (selectorType == kSelectorMethod) {
stackType = EXEC_STACK_TYPE_CALL;
curSP = sp;
- curFP = funcp;
+ // TODO: Will this offset suffice for large SCI3 scripts?
+ curFP = make_reg32(funcp.getSegment(), funcp.getOffset());
sp = CALL_SP_CARRY; // Destroy sp, as it will be carried over
}
@@ -342,7 +328,7 @@ static void addKernelCallToExecStack(EngineState *s, int kernelCallNr, int argc,
// Add stack frame to indicate we're executing a callk.
// This is useful in debugger backtraces if this
// kernel function calls a script itself.
- ExecStack xstack(NULL_REG, NULL_REG, NULL, argc, argv - 1, 0xFFFF, NULL_REG,
+ ExecStack xstack(NULL_REG, NULL_REG, NULL, argc, argv - 1, 0xFFFF, make_reg32(0, 0),
kernelCallNr, -1, -1, s->_executionStack.size() - 1, EXEC_STACK_TYPE_KERNEL);
s->_executionStack.push_back(xstack);
}
@@ -578,16 +564,16 @@ void run_vm(EngineState *s) {
int var_type; // See description below
int var_number;
- g_sci->_debugState.old_pc_offset = s->xs->addr.pc.offset;
+ g_sci->_debugState.old_pc_offset = s->xs->addr.pc.getOffset();
g_sci->_debugState.old_sp = s->xs->sp;
if (s->abortScriptProcessing != kAbortNone)
return; // Stop processing
if (s->_executionStackPosChanged) {
- scr = s->_segMan->getScriptIfLoaded(s->xs->addr.pc.segment);
+ scr = s->_segMan->getScriptIfLoaded(s->xs->addr.pc.getSegment());
if (!scr)
- error("No script in segment %d", s->xs->addr.pc.segment);
+ error("No script in segment %d", s->xs->addr.pc.getSegment());
s->xs = &(s->_executionStack.back());
s->_executionStackPosChanged = false;
@@ -624,13 +610,13 @@ void run_vm(EngineState *s) {
s->variablesMax[VAR_TEMP] = s->xs->sp - s->xs->fp;
- if (s->xs->addr.pc.offset >= scr->getBufSize())
+ if (s->xs->addr.pc.getOffset() >= scr->getBufSize())
error("run_vm(): program counter gone astray, addr: %d, code buffer size: %d",
- s->xs->addr.pc.offset, scr->getBufSize());
+ s->xs->addr.pc.getOffset(), scr->getBufSize());
// Get opcode
byte extOpcode;
- s->xs->addr.pc.offset += readPMachineInstruction(scr->getBuf() + s->xs->addr.pc.offset, extOpcode, opparams);
+ s->xs->addr.pc.incOffset(readPMachineInstruction(scr->getBuf(s->xs->addr.pc.getOffset()), extOpcode, opparams));
const byte opcode = extOpcode >> 1;
//debug("%s: %d, %d, %d, %d, acc = %04x:%04x, script %d, local script %d", opcodeNames[opcode], opparams[0], opparams[1], opparams[2], opparams[3], PRINT_REG(s->r_acc), scr->getScriptNumber(), local_script->getScriptNumber());
@@ -705,7 +691,7 @@ void run_vm(EngineState *s) {
break;
case op_not: // 0x0c (12)
- s->r_acc = make_reg(0, !(s->r_acc.offset || s->r_acc.segment));
+ s->r_acc = make_reg(0, !(s->r_acc.getOffset() || s->r_acc.getSegment()));
// Must allow pointers to be negated, as this is used for checking whether objects exist
break;
@@ -765,30 +751,30 @@ void run_vm(EngineState *s) {
case op_bt: // 0x17 (23)
// Branch relative if true
- if (s->r_acc.offset || s->r_acc.segment)
- s->xs->addr.pc.offset += opparams[0];
+ if (s->r_acc.getOffset() || s->r_acc.getSegment())
+ s->xs->addr.pc.incOffset(opparams[0]);
- if (s->xs->addr.pc.offset >= local_script->getScriptSize())
+ if (s->xs->addr.pc.getOffset() >= local_script->getScriptSize())
error("[VM] op_bt: request to jump past the end of script %d (offset %d, script is %d bytes)",
- local_script->getScriptNumber(), s->xs->addr.pc.offset, local_script->getScriptSize());
+ local_script->getScriptNumber(), s->xs->addr.pc.getOffset(), local_script->getScriptSize());
break;
case op_bnt: // 0x18 (24)
// Branch relative if not true
- if (!(s->r_acc.offset || s->r_acc.segment))
- s->xs->addr.pc.offset += opparams[0];
+ if (!(s->r_acc.getOffset() || s->r_acc.getSegment()))
+ s->xs->addr.pc.incOffset(opparams[0]);
- if (s->xs->addr.pc.offset >= local_script->getScriptSize())
+ if (s->xs->addr.pc.getOffset() >= local_script->getScriptSize())
error("[VM] op_bnt: request to jump past the end of script %d (offset %d, script is %d bytes)",
- local_script->getScriptNumber(), s->xs->addr.pc.offset, local_script->getScriptSize());
+ local_script->getScriptNumber(), s->xs->addr.pc.getOffset(), local_script->getScriptSize());
break;
case op_jmp: // 0x19 (25)
- s->xs->addr.pc.offset += opparams[0];
+ s->xs->addr.pc.incOffset(opparams[0]);
- if (s->xs->addr.pc.offset >= local_script->getScriptSize())
+ if (s->xs->addr.pc.getOffset() >= local_script->getScriptSize())
error("[VM] op_jmp: request to jump past the end of script %d (offset %d, script is %d bytes)",
- local_script->getScriptNumber(), s->xs->addr.pc.offset, local_script->getScriptSize());
+ local_script->getScriptNumber(), s->xs->addr.pc.getOffset(), local_script->getScriptSize());
break;
case op_ldi: // 0x1a (26)
@@ -831,13 +817,13 @@ void run_vm(EngineState *s) {
int argc = (opparams[1] >> 1) // Given as offset, but we need count
+ 1 + s->r_rest;
StackPtr call_base = s->xs->sp - argc;
- s->xs->sp[1].offset += s->r_rest;
+ s->xs->sp[1].incOffset(s->r_rest);
- uint16 localCallOffset = s->xs->addr.pc.offset + opparams[0];
+ uint32 localCallOffset = s->xs->addr.pc.getOffset() + opparams[0];
ExecStack xstack(s->xs->objp, s->xs->objp, s->xs->sp,
(call_base->requireUint16()) + s->r_rest, call_base,
- s->xs->local_segment, make_reg(s->xs->addr.pc.segment, localCallOffset),
+ s->xs->local_segment, make_reg32(s->xs->addr.pc.getSegment(), localCallOffset),
NULL_SELECTOR, -1, localCallOffset, s->_executionStack.size() - 1,
EXEC_STACK_TYPE_CALL);
@@ -894,9 +880,9 @@ void run_vm(EngineState *s) {
s_temp = s->xs->sp;
s->xs->sp -= temp;
- s->xs->sp[0].offset += s->r_rest;
+ s->xs->sp[0].incOffset(s->r_rest);
xs_new = execute_method(s, 0, opparams[0], s_temp, s->xs->objp,
- s->xs->sp[0].offset, s->xs->sp);
+ s->xs->sp[0].getOffset(), s->xs->sp);
s->r_rest = 0; // Used up the &rest adjustment
if (xs_new) // in case of error, keep old stack
s->_executionStackPosChanged = true;
@@ -908,11 +894,10 @@ void run_vm(EngineState *s) {
s_temp = s->xs->sp;
s->xs->sp -= temp;
- s->xs->sp[0].offset += s->r_rest;
+ s->xs->sp[0].incOffset(s->r_rest);
xs_new = execute_method(s, opparams[0], opparams[1], s_temp, s->xs->objp,
- s->xs->sp[0].offset, s->xs->sp);
+ s->xs->sp[0].getOffset(), s->xs->sp);
s->r_rest = 0; // Used up the &rest adjustment
-
if (xs_new) // in case of error, keep old stack
s->_executionStackPosChanged = true;
break;
@@ -965,7 +950,7 @@ void run_vm(EngineState *s) {
s_temp = s->xs->sp;
s->xs->sp -= ((opparams[0] >> 1) + s->r_rest); // Adjust stack
- s->xs->sp[1].offset += s->r_rest;
+ s->xs->sp[1].incOffset(s->r_rest);
xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp,
(int)(opparams[0] >> 1) + (uint16)s->r_rest, s->xs->sp);
@@ -996,7 +981,7 @@ void run_vm(EngineState *s) {
case op_class: // 0x28 (40)
// Get class address
s->r_acc = s->_segMan->getClassAddress((unsigned)opparams[0], SCRIPT_GET_LOCK,
- s->xs->addr.pc);
+ s->xs->addr.pc.getSegment());
break;
case 0x29: // (41)
@@ -1008,7 +993,7 @@ void run_vm(EngineState *s) {
s_temp = s->xs->sp;
s->xs->sp -= ((opparams[0] >> 1) + s->r_rest); // Adjust stack
- s->xs->sp[1].offset += s->r_rest;
+ s->xs->sp[1].incOffset(s->r_rest);
xs_new = send_selector(s, s->xs->objp, s->xs->objp,
s_temp, (int)(opparams[0] >> 1) + (uint16)s->r_rest,
s->xs->sp);
@@ -1021,7 +1006,7 @@ void run_vm(EngineState *s) {
case op_super: // 0x2b (43)
// Send to any class
- r_temp = s->_segMan->getClassAddress(opparams[0], SCRIPT_GET_LOAD, s->xs->addr.pc);
+ r_temp = s->_segMan->getClassAddress(opparams[0], SCRIPT_GET_LOAD, s->xs->addr.pc.getSegment());
if (!r_temp.isPointer())
error("[VM]: Invalid superclass in object");
@@ -1029,7 +1014,7 @@ void run_vm(EngineState *s) {
s_temp = s->xs->sp;
s->xs->sp -= ((opparams[1] >> 1) + s->r_rest); // Adjust stack
- s->xs->sp[1].offset += s->r_rest;
+ s->xs->sp[1].incOffset(s->r_rest);
xs_new = send_selector(s, r_temp, s->xs->objp, s_temp,
(int)(opparams[1] >> 1) + (uint16)s->r_rest,
s->xs->sp);
@@ -1058,14 +1043,14 @@ void run_vm(EngineState *s) {
var_number = temp & 0x03; // Get variable type
// Get variable block offset
- r_temp.segment = s->variablesSegment[var_number];
- r_temp.offset = s->variables[var_number] - s->variablesBase[var_number];
+ r_temp.setSegment(s->variablesSegment[var_number]);
+ r_temp.setOffset(s->variables[var_number] - s->variablesBase[var_number]);
if (temp & 0x08) // Add accumulator offset if requested
- r_temp.offset += s->r_acc.requireSint16();
+ r_temp.incOffset(s->r_acc.requireSint16());
- r_temp.offset += opparams[1]; // Add index
- r_temp.offset *= 2; // variables are 16 bit
+ r_temp.incOffset(opparams[1]); // Add index
+ r_temp.setOffset(r_temp.getOffset() * 2); // variables are 16 bit
// That's the immediate address now
s->r_acc = r_temp;
break;
@@ -1129,28 +1114,28 @@ void run_vm(EngineState *s) {
case op_lofsa: // 0x39 (57)
case op_lofss: // 0x3a (58)
// Load offset to accumulator or push to stack
- r_temp.segment = s->xs->addr.pc.segment;
+ r_temp.setSegment(s->xs->addr.pc.getSegment());
switch (g_sci->_features->detectLofsType()) {
case SCI_VERSION_0_EARLY:
- r_temp.offset = s->xs->addr.pc.offset + opparams[0];
+ r_temp.setOffset((uint16)s->xs->addr.pc.getOffset() + opparams[0]);
break;
case SCI_VERSION_1_MIDDLE:
- r_temp.offset = opparams[0];
+ r_temp.setOffset(opparams[0]);
break;
case SCI_VERSION_1_1:
- r_temp.offset = opparams[0] + local_script->getScriptSize();
+ r_temp.setOffset(opparams[0] + local_script->getScriptSize());
break;
case SCI_VERSION_3:
// In theory this can break if the variant with a one-byte argument is
// used. For now, assume it doesn't happen.
- r_temp.offset = local_script->relocateOffsetSci3(s->xs->addr.pc.offset-2);
+ r_temp.setOffset(local_script->relocateOffsetSci3(s->xs->addr.pc.getOffset() - 2));
break;
default:
error("Unknown lofs type");
}
- if (r_temp.offset >= scr->getBufSize())
+ if (r_temp.getOffset() >= scr->getBufSize())
error("VM: lofsa/lofss operation overflowed: %04x:%04x beyond end"
" of script (at %04x)", PRINT_REG(r_temp), scr->getBufSize());
@@ -1188,6 +1173,7 @@ void run_vm(EngineState *s) {
case op_line: // 0x3f (63)
// Debug opcode (line number)
+ //debug("Script %d, line %d", scr->getScriptNumber(), opparams[0]);
break;
case op_lag: // 0x40 (64)
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 334d224baf..8b38faa013 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -61,8 +61,6 @@ struct Class {
reg_t reg; ///< offset; script-relative offset, segment: 0 if not instantiated
};
-#define RAW_IS_OBJECT(datablock) (READ_SCI11ENDIAN_UINT16(((const byte *) datablock) + SCRIPT_OBJECT_MAGIC_OFFSET) == SCRIPT_OBJECT_MAGIC_NUMBER)
-
// A reference to an object's variable.
// The object is stored as a reg_t, the variable as an index into _variables
struct ObjVarRef {
@@ -84,7 +82,7 @@ struct ExecStack {
union {
ObjVarRef varp; // Variable pointer for r/w access
- reg_t pc; // Pointer to the initial program counter. Not accurate for the TOS element
+ reg32_t pc; // Pointer to the initial program counter. Not accurate for the TOS element
} addr;
StackPtr fp; // Frame pointer
@@ -104,7 +102,7 @@ struct ExecStack {
reg_t* getVarPointer(SegManager *segMan) const;
ExecStack(reg_t objp_, reg_t sendp_, StackPtr sp_, int argc_, StackPtr argp_,
- SegmentId localsSegment_, reg_t pc_, Selector debugSelector_,
+ SegmentId localsSegment_, reg32_t pc_, Selector debugSelector_,
int debugExportId_, int debugLocalCallOffset_, int debugOrigin_,
ExecStackType type_) {
objp = objp_;
@@ -118,7 +116,7 @@ struct ExecStack {
if (localsSegment_ != 0xFFFF)
local_segment = localsSegment_;
else
- local_segment = pc_.segment;
+ local_segment = pc_.getSegment();
debugSelector = debugSelector_;
debugExportId = debugExportId_;
debugLocalCallOffset = debugLocalCallOffset_;
@@ -139,7 +137,7 @@ enum {
GC_INTERVAL = 0x8000
};
-enum sci_opcodes {
+enum SciOpcodes {
op_bnot = 0x00, // 000
op_add = 0x01, // 001
op_sub = 0x02, // 002
@@ -204,6 +202,7 @@ enum sci_opcodes {
op_push2 = 0x3d, // 061
op_pushSelf = 0x3e, // 062
op_line = 0x3f, // 063
+ //
op_lag = 0x40, // 064
op_lal = 0x41, // 065
op_lat = 0x42, // 066
@@ -220,6 +219,7 @@ enum sci_opcodes {
op_lsli = 0x4d, // 077
op_lsti = 0x4e, // 078
op_lspi = 0x4f, // 079
+ //
op_sag = 0x50, // 080
op_sal = 0x51, // 081
op_sat = 0x52, // 082
@@ -236,6 +236,7 @@ enum sci_opcodes {
op_ssli = 0x5d, // 093
op_ssti = 0x5e, // 094
op_sspi = 0x5f, // 095
+ //
op_plusag = 0x60, // 096
op_plusal = 0x61, // 097
op_plusat = 0x62, // 098
@@ -252,6 +253,7 @@ enum sci_opcodes {
op_plussli = 0x6d, // 109
op_plussti = 0x6e, // 110
op_plusspi = 0x6f, // 111
+ //
op_minusag = 0x70, // 112
op_minusal = 0x71, // 113
op_minusat = 0x72, // 114
diff --git a/engines/sci/engine/vm_types.cpp b/engines/sci/engine/vm_types.cpp
index b95fd58129..27015d9be4 100644
--- a/engines/sci/engine/vm_types.cpp
+++ b/engines/sci/engine/vm_types.cpp
@@ -43,17 +43,17 @@ reg_t reg_t::lookForWorkaround(const reg_t right) const {
reg_t reg_t::operator+(const reg_t right) const {
if (isPointer() && right.isNumber()) {
// Pointer arithmetics. Only some pointer types make sense here
- SegmentObj *mobj = g_sci->getEngineState()->_segMan->getSegmentObj(segment);
+ SegmentObj *mobj = g_sci->getEngineState()->_segMan->getSegmentObj(getSegment());
if (!mobj)
- error("[VM]: Attempt to add %d to invalid pointer %04x:%04x", right.offset, PRINT_REG(*this));
+ error("[VM]: Attempt to add %d to invalid pointer %04x:%04x", right.getOffset(), PRINT_REG(*this));
switch (mobj->getType()) {
case SEG_TYPE_LOCALS:
case SEG_TYPE_SCRIPT:
case SEG_TYPE_STACK:
case SEG_TYPE_DYNMEM:
- return make_reg(segment, offset + right.toSint16());
+ return make_reg(getSegment(), getOffset() + right.toSint16());
default:
return lookForWorkaround(right);
}
@@ -69,12 +69,12 @@ reg_t reg_t::operator+(const reg_t right) const {
}
reg_t reg_t::operator-(const reg_t right) const {
- if (segment == right.segment) {
+ if (getSegment() == right.getSegment()) {
// We can subtract numbers, or pointers with the same segment,
// an operation which will yield a number like in C
return make_reg(0, toSint16() - right.toSint16());
} else {
- return *this + make_reg(right.segment, -right.offset);
+ return *this + make_reg(right.getSegment(), -right.toSint16());
}
}
@@ -174,7 +174,7 @@ reg_t reg_t::operator^(const reg_t right) const {
}
int reg_t::cmp(const reg_t right, bool treatAsUnsigned) const {
- if (segment == right.segment) { // can compare things in the same segment
+ if (getSegment() == right.getSegment()) { // can compare things in the same segment
if (treatAsUnsigned || !isNumber())
return toUint16() - right.toUint16();
else
@@ -218,7 +218,7 @@ bool reg_t::pointerComparisonWithInteger(const reg_t right) const {
// SQ1, room 28, when throwing water at the Orat
// SQ1, room 58, when giving the ID card to the robot
// SQ4 CD, at the first game screen, when the narrator is about to speak
- return (isPointer() && right.isNumber() && right.offset <= 2000 && getSciVersion() <= SCI_VERSION_1_1);
+ return (isPointer() && right.isNumber() && right.getOffset() <= 2000 && getSciVersion() <= SCI_VERSION_1_1);
}
} // End of namespace Sci
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 7b155a4532..9a7589e9a7 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -31,43 +31,64 @@ namespace Sci {
typedef uint16 SegmentId;
struct reg_t {
- SegmentId segment;
- uint16 offset;
+ // Segment and offset. These should never be accessed directly
+ SegmentId _segment;
+ uint16 _offset;
+
+ inline SegmentId getSegment() const {
+ return _segment;
+ }
+
+ inline void setSegment(SegmentId segment) {
+ _segment = segment;
+ }
+
+ inline uint16 getOffset() const {
+ return _offset;
+ }
+
+ inline void setOffset(uint16 offset) {
+ _offset = offset;
+ }
+
+ inline void incOffset(int16 offset) {
+ setOffset(getOffset() + offset);
+ }
inline bool isNull() const {
- return (offset | segment) == 0;
+ return (_offset | getSegment()) == 0;
}
inline uint16 toUint16() const {
- return offset;
+ return _offset;
}
inline int16 toSint16() const {
- return (int16)offset;
+ return (int16)_offset;
}
bool isNumber() const {
- return segment == 0;
+ return getSegment() == 0;
}
bool isPointer() const {
- return segment != 0 && segment != 0xFFFF;
+ return getSegment() != 0 && getSegment() != 0xFFFF;
}
uint16 requireUint16() const;
int16 requireSint16() const;
inline bool isInitialized() const {
- return segment != 0xFFFF;
+ return getSegment() != 0xFFFF;
}
// Comparison operators
bool operator==(const reg_t &x) const {
- return (offset == x.offset) && (segment == x.segment);
+ return (getOffset() == x.getOffset()) && (getSegment() == x.getSegment());
}
bool operator!=(const reg_t &x) const {
- return (offset != x.offset) || (segment != x.segment);
+ return (getOffset() != x.getOffset()) || (getSegment() != x.getSegment());
}
bool operator>(const reg_t right) const {
@@ -141,12 +162,55 @@ private:
static inline reg_t make_reg(SegmentId segment, uint16 offset) {
reg_t r;
- r.offset = offset;
- r.segment = segment;
+ r.setSegment(segment);
+ r.setOffset(offset);
return r;
}
-#define PRINT_REG(r) (0xffff) & (unsigned) (r).segment, (unsigned) (r).offset
+#define PRINT_REG(r) (0xffff) & (unsigned) (r).getSegment(), (unsigned) (r).getOffset()
+
+// A true 32-bit reg_t
+struct reg32_t {
+ // Segment and offset. These should never be accessed directly
+ SegmentId _segment;
+ uint32 _offset;
+
+ inline SegmentId getSegment() const {
+ return _segment;
+ }
+
+ inline void setSegment(SegmentId segment) {
+ _segment = segment;
+ }
+
+ inline uint32 getOffset() const {
+ return _offset;
+ }
+
+ inline void setOffset(uint32 offset) {
+ _offset = offset;
+ }
+
+ inline void incOffset(int32 offset) {
+ setOffset(getOffset() + offset);
+ }
+
+ // Comparison operators
+ bool operator==(const reg32_t &x) const {
+ return (getOffset() == x.getOffset()) && (getSegment() == x.getSegment());
+ }
+
+ bool operator!=(const reg32_t &x) const {
+ return (getOffset() != x.getOffset()) || (getSegment() != x.getSegment());
+ }
+};
+
+static inline reg32_t make_reg32(SegmentId segment, uint32 offset) {
+ reg32_t r;
+ r.setSegment(segment);
+ r.setOffset(offset);
+ return r;
+}
// Stack pointer type
typedef reg_t *StackPtr;
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index a556134e32..9fa0368784 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -36,13 +36,15 @@ const SciWorkaroundEntry arithmeticWorkarounds[] = {
{ GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xcc6, 0, { WORKAROUND_FAKE, 0 } }, // op_or: when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464
{ GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xce0, 0, { WORKAROUND_FAKE, 0 } }, // Same as above, for the Spanish version - bug #3313962
{ GID_FANMADE, 516, 983, 0, "Wander", "setTarget", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_mul: The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #3038913
+ { GID_GK1, 800,64992, 0, "Fwd", "doit", -1, 0, { WORKAROUND_FAKE, 1 } }, // op_gt: when Mosely finds Gabriel and Grace near the end of the game, compares the Grooper object with 7
{ GID_ICEMAN, 199, 977, 0, "Grooper", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_add: While dancing with the girl
{ GID_MOTHERGOOSE256, -1, 999, 0, "Event", "new", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_and: constantly during the game (SCI1 version)
{ GID_MOTHERGOOSE256, -1, 4, 0, "rm004", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_or: when going north and reaching the castle (rooms 4 and 37) - bug #3038228
{ GID_MOTHERGOOSEHIRES,90, 90, 0, "newGameButton", "select", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_ge: MUMG Deluxe, when selecting "New Game" in the main menu. It tries to compare an integer with a list. Needs to return false for the game to continue.
+ { GID_PHANTASMAGORIA, 902, 0, 0, "", "export 7", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_shr: when starting a chapter in Phantasmagoria
{ GID_QFG1VGA, 301, 928, 0, "Blink", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_div: when entering the inn, gets called with 1 parameter, but 2nd parameter is used for div which happens to be an object
{ GID_QFG2, 200, 200, 0, "astro", "messages", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_lsi: when getting asked for your name by the astrologer bug #3039879
- { GID_GK1, 800,64992, 0, "Fwd", "doit", -1, 0, { WORKAROUND_FAKE, 1 } }, // op_gt: when Mosely finds Gabriel and Grace near the end of the game, compares the Grooper object with 7
+ { GID_QFG4, 710,64941, 0, "RandCycle", "doit", -1, 0, { WORKAROUND_FAKE, 1 } }, // op_gt: when the tentacle appears in the third room of the caves
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -162,11 +164,12 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_SQ1, -1, 703, 0, "", "export 1", -1, 0, { WORKAROUND_FAKE, 0 } }, // sub that's called from several objects while on sarien battle cruiser
{ GID_SQ1, -1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { WORKAROUND_FAKE, 0 } }, // export 1, but called locally (when shooting at aliens)
{ GID_SQ4, -1, 398, 0, "showBox", "changeState", -1, 0, { WORKAROUND_FAKE, 0 } }, // CD: called when rummaging in Software Excess bargain bin
- { GID_SQ4, -1, 928, 0, "Narrator", "startText", -1, 1000, { WORKAROUND_FAKE, 1 } }, // CD: method returns this to the caller
+ { GID_SQ4, -1, 928, -1, "Narrator", "startText", -1, 1000, { WORKAROUND_FAKE, 1 } }, // CD: happens in the options dialog and in-game when speech and subtitles are used simultaneously
{ GID_SQ5, 201, 201, 0, "buttonPanel", "doVerb", -1, 0, { WORKAROUND_FAKE, 1 } }, // when looking at the orange or red button - bug #3038563
{ GID_SQ6, -1, 0, 0, "SQ6", "init", -1, 2, { WORKAROUND_FAKE, 0 } }, // Demo and full version: called when the game starts (demo: room 0, full: room 100)
- { GID_SQ6, 100, 64950, 0, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // called when pressing "Start game" in the main menu
+ { GID_SQ6, -1, 64950, -1, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // called when pressing "Start game" in the main menu, when entering the Orion's Belt bar (room 300), and perhaps other places
{ GID_SQ6, -1, 64964, 0, "DPath", "init", -1, 1, { WORKAROUND_FAKE, 0 } }, // during the game
+ { GID_TORIN, -1, 64017, 0, "oFlags", "clear", -1, 0, { WORKAROUND_FAKE, 0 } }, // entering Torin's home in the French version
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -176,6 +179,7 @@ const SciWorkaroundEntry kAbs_workarounds[] = {
{ GID_HOYLE1, 2, 2, 0, "room2", "doit", -1, 0, { WORKAROUND_FAKE, 0x3e9 } }, // old maid - called with objects instead of integers
{ GID_HOYLE1, 3, 3, 0, "room3", "doit", -1, 0, { WORKAROUND_FAKE, 0x3e9 } }, // hearts - called with objects instead of integers
{ GID_QFG1VGA, -1, -1, 0, NULL, "doit", -1, 0, { WORKAROUND_FAKE, 0x3e9 } }, // when the game is patched with the NRS patch
+ { GID_QFG3 , -1, -1, 0, NULL, "doit", -1, 0, { WORKAROUND_FAKE, 0x3e9 } }, // when the game is patched with the NRS patch (bugs #3528416, #3528542)
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -250,8 +254,9 @@ const SciWorkaroundEntry kDoSoundFade_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kGetAngle_workarounds[] = {
- { GID_FANMADE, 516, 992, 0, "Motion", "init", -1, 0, { WORKAROUND_IGNORE, 0 } }, // The Legend of the Lost Jewel Demo (fan made): called with third/fourth parameters as objects
+ { GID_FANMADE, 516, 992, 0, "Motion", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // The Legend of the Lost Jewel Demo (fan made): called with third/fourth parameters as objects
{ GID_KQ6, -1, 752, 0, "throwDazzle", "changeState", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // room 740/790 after the Genie is exposed in the Palace (short and long ending), it starts shooting lightning bolts around. An extra 5th parameter is passed - bug #3034610 & #3041734
+ { GID_SQ1, -1, 927, 0, "PAvoider", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // all rooms in Ulence Flats after getting the Pilot Droid: called with a single parameter when the droid is in Roger's path - bug #3513207
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -320,8 +325,9 @@ const SciWorkaroundEntry kGraphRedrawBox_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kGraphUpdateBox_workarounds[] = {
{ GID_ECOQUEST2, 100, 333, 0, "showEcorder", "changeState", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // necessary workaround for our ecorder script patch, because there isn't enough space to patch the function
- { GID_PQ3, 202, 202, 0, "MapEdit", "movePt", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters - bug #3038077
{ GID_PQ3, 202, 202, 0, "MapEdit", "addPt", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters - bug #3038077
+ { GID_PQ3, 202, 202, 0, "MapEdit", "movePt", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters - bug #3038077
+ { GID_PQ3, 202, 202, 0, "MapEdit", "dispose", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -336,6 +342,7 @@ const SciWorkaroundEntry kIsObject_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kMemory_workarounds[] = {
{ GID_LAURABOW2, -1, 999, 0, "", "export 6", -1, 0, { WORKAROUND_FAKE, 0 } }, // during the intro, when exiting the train (room 160), talking to Mr. Augustini, etc. - bug #3034490
+ { GID_SQ1, -1, 999, 0, "", "export 6", -1, 0, { WORKAROUND_FAKE, 0 } }, // during walking Roger around Ulence Flats - bug #3513765
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -392,6 +399,7 @@ const SciWorkaroundEntry kUnLoad_workarounds[] = {
{ GID_LSL6, 740, 740, 0, "showCartoon", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during ending, 4 additional parameters are passed by accident
{ GID_LSL6HIRES, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during intro, a 3rd parameter is passed by accident
{ GID_SQ1, 43, 303, 0, "slotGuy", "dispose", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when leaving ulence flats bar, parameter 1 is not passed - script error
+ { GID_QFG4, -1, 110, 0, "dreamer", "dispose", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during the dream sequence, a 3rd parameter is passed by accident
SCI_WORKAROUNDENTRY_TERMINATOR
};
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 378e88b7df..14443db1e2 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -102,8 +102,8 @@ const MouseEventConversion mouseEventMappings[] = {
{ Common::EVENT_RBUTTONDOWN, SCI_EVENT_MOUSE_PRESS, 2 },
{ Common::EVENT_MBUTTONDOWN, SCI_EVENT_MOUSE_PRESS, 3 },
{ Common::EVENT_LBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 1 },
- { Common::EVENT_LBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 2 },
- { Common::EVENT_LBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 3 }
+ { Common::EVENT_RBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 2 },
+ { Common::EVENT_MBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 3 }
};
EventManager::EventManager(bool fontIsExtended) : _fontIsExtended(fontIsExtended) {
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 983e697481..ee28c5ca31 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -723,7 +723,7 @@ void GfxAnimate::printAnimateList(Console *con) {
const AnimateList::iterator end = _list.end();
for (it = _list.begin(); it != end; ++it) {
- Script *scr = _s->_segMan->getScriptIfLoaded(it->object.segment);
+ Script *scr = _s->_segMan->getScriptIfLoaded(it->object.getSegment());
int16 scriptNo = scr ? scr->getScriptNumber() : -1;
con->DebugPrintf("%04x:%04x (%s), script %d, view %d (%d, %d), pal %d, "
diff --git a/engines/sci/graphics/controls16.cpp b/engines/sci/graphics/controls16.cpp
index ab54e468d1..7c09969717 100644
--- a/engines/sci/graphics/controls16.cpp
+++ b/engines/sci/graphics/controls16.cpp
@@ -297,7 +297,7 @@ void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *t
_paint16->eraseRect(rect);
_paint16->frameRect(rect);
rect.grow(-2);
- _ports->textGreyedOutput(style & 1 ? false : true);
+ _ports->textGreyedOutput(!(style & SCI_CONTROLS_STYLE_ENABLED));
_text16->Box(text, false, rect, SCI_TEXT16_ALIGNMENT_CENTER, fontId);
_ports->textGreyedOutput(false);
rect.grow(1);
diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp
index ad1d9e8623..5535a7408a 100644
--- a/engines/sci/graphics/controls32.cpp
+++ b/engines/sci/graphics/controls32.cpp
@@ -68,7 +68,7 @@ void GfxControls32::kernelTexteditChange(reg_t controlObject) {
while (captureEvents) {
curEvent = g_sci->getEventManager()->getSciEvent(SCI_EVENT_KEYBOARD | SCI_EVENT_PEEK);
-
+
if (curEvent.type == SCI_EVENT_NONE) {
eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
} else {
@@ -170,11 +170,11 @@ void GfxControls32::kernelTexteditChange(reg_t controlObject) {
// Note: the following checkAltInput call might make the text
// too wide to fit, but SSCI fails to check that too.
}
-
+
reg_t hunkId = readSelector(_segMan, controlObject, SELECTOR(bitmap));
Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(controlObject);
//texteditCursorErase(); // TODO: Cursor
-
+
// Write back string
_segMan->strcpy(textReference, text.c_str());
// Modify the buffer and show it
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 52a5961070..ce77cf6ed3 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -132,7 +132,7 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
resourceData = resource->data;
- if (getSciVersion() <= SCI_VERSION_0_LATE) {
+ if (getSciVersion() <= SCI_VERSION_01) {
// 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.
@@ -148,11 +148,13 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
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.
+ // TODO: Figure out if the grey color is hardcoded
+ // HACK for the magnifier cursor in LB1, fixes its color (bug #3487092)
if (g_sci->getGameId() == GID_LAURABOW && resourceId == 1)
colorMapping[3] = _screen->getColorWhite();
+ // HACK for Longbow cursors, fixes the shade of grey they're using (bug #3489101)
+ if (g_sci->getGameId() == GID_LONGBOW)
+ colorMapping[3] = _palette->matchColor(223, 223, 223); // Light Grey
// Seek to actual data
resourceData += 4;
@@ -409,7 +411,7 @@ void GfxCursor::refreshPosition() {
}
}
- CursorMan.replaceCursor((const byte *)_cursorSurface, cursorCelInfo->width, cursorCelInfo->height, cursorHotspot.x, cursorHotspot.y, cursorCelInfo->clearKey);
+ CursorMan.replaceCursor(_cursorSurface, cursorCelInfo->width, cursorCelInfo->height, cursorHotspot.x, cursorHotspot.y, cursorCelInfo->clearKey);
}
}
diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp
index fcdd057509..30184cc091 100644
--- a/engines/sci/graphics/font.cpp
+++ b/engines/sci/graphics/font.cpp
@@ -54,7 +54,7 @@ GfxFontFromResource::GfxFontFromResource(ResourceManager *resMan, GfxScreen *scr
}
GfxFontFromResource::~GfxFontFromResource() {
- delete []_chars;
+ delete[] _chars;
_resMan->unlockResource(_resource);
}
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index b12413ab69..8b7fa2c384 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -28,9 +28,11 @@
#include "common/system.h"
#include "common/textconsole.h"
#include "engines/engine.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "sci/sci.h"
+#include "sci/console.h"
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
@@ -52,12 +54,18 @@ namespace Sci {
// TODO/FIXME: This is all guesswork
+enum SciSpeciaPlanelPictureCodes {
+ kPlaneTranslucent = 0xfffe, // -2
+ kPlanePlainColored = 0xffff // -1
+};
+
GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32)
: _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette), _paint32(paint32) {
_coordAdjuster = (GfxCoordAdjuster32 *)coordAdjuster;
- _scriptsRunningWidth = 320;
- _scriptsRunningHeight = 200;
+ _curScrollText = -1;
+ _showScrollText = false;
+ _maxScrollTexts = 0;
}
GfxFrameout::~GfxFrameout() {
@@ -68,32 +76,88 @@ void GfxFrameout::clear() {
deletePlaneItems(NULL_REG);
_planes.clear();
deletePlanePictures(NULL_REG);
+ clearScrollTexts();
+}
+
+void GfxFrameout::clearScrollTexts() {
+ _scrollTexts.clear();
+ _curScrollText = -1;
+}
+
+void GfxFrameout::addScrollTextEntry(Common::String &text, reg_t kWindow, uint16 x, uint16 y, bool replace) {
+ //reg_t bitmapHandle = g_sci->_gfxText32->createScrollTextBitmap(text, kWindow);
+ // HACK: We set the container dimensions manually
+ reg_t bitmapHandle = g_sci->_gfxText32->createScrollTextBitmap(text, kWindow, 480, 70);
+ ScrollTextEntry textEntry;
+ textEntry.bitmapHandle = bitmapHandle;
+ textEntry.kWindow = kWindow;
+ textEntry.x = x;
+ textEntry.y = y;
+ if (!replace || _scrollTexts.size() == 0) {
+ if (_scrollTexts.size() > _maxScrollTexts) {
+ _scrollTexts.remove_at(0);
+ _curScrollText--;
+ }
+ _scrollTexts.push_back(textEntry);
+ _curScrollText++;
+ } else {
+ _scrollTexts.pop_back();
+ _scrollTexts.push_back(textEntry);
+ }
+}
+
+void GfxFrameout::showCurrentScrollText() {
+ if (!_showScrollText || _curScrollText < 0)
+ return;
+
+ uint16 size = (uint16)_scrollTexts.size();
+ if (size > 0) {
+ assert(_curScrollText < size);
+ ScrollTextEntry textEntry = _scrollTexts[_curScrollText];
+ g_sci->_gfxText32->drawScrollTextBitmap(textEntry.kWindow, textEntry.bitmapHandle, textEntry.x, textEntry.y);
+ }
}
+extern void showScummVMDialog(const Common::String &message);
+
void GfxFrameout::kernelAddPlane(reg_t object) {
PlaneEntry newPlane;
if (_planes.empty()) {
// There has to be another way for sierra sci to do this or maybe script resolution is compiled into
// interpreter (TODO)
- uint16 tmpRunningWidth = readSelectorValue(_segMan, object, SELECTOR(resX));
- uint16 tmpRunningHeight = readSelectorValue(_segMan, object, SELECTOR(resY));
+ uint16 scriptWidth = readSelectorValue(_segMan, object, SELECTOR(resX));
+ uint16 scriptHeight = readSelectorValue(_segMan, object, SELECTOR(resY));
- // The above can be 0 in SCI3 (e.g. Phantasmagoria 2)
- if (tmpRunningWidth > 0 && tmpRunningHeight > 0) {
- _scriptsRunningWidth = tmpRunningWidth;
- _scriptsRunningHeight = tmpRunningHeight;
+ // Phantasmagoria 2 doesn't specify a script width/height
+ if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
+ scriptWidth = 640;
+ scriptHeight = 480;
}
- _coordAdjuster->setScriptsResolution(_scriptsRunningWidth, _scriptsRunningHeight);
+ assert(scriptWidth > 0 && scriptHeight > 0);
+ _coordAdjuster->setScriptsResolution(scriptWidth, scriptHeight);
+ }
+
+ // Import of QfG character files dialog is shown in QFG4.
+ // Display additional popup information before letting user use it.
+ // For the SCI0-SCI1.1 version of this, check kDrawControl().
+ if (g_sci->inQfGImportRoom() && !strcmp(_segMan->getObjectName(object), "DSPlane")) {
+ showScummVMDialog("Characters saved inside ScummVM are shown "
+ "automatically. Character files saved in the original "
+ "interpreter need to be put inside ScummVM's saved games "
+ "directory and a prefix needs to be added depending on which "
+ "game it was saved in: 'qfg1-' for Quest for Glory 1, 'qfg2-' "
+ "for Quest for Glory 2, 'qfg3-' for Quest for Glory 3. "
+ "Example: 'qfg2-thief.sav'.");
}
newPlane.object = object;
newPlane.priority = readSelectorValue(_segMan, object, SELECTOR(priority));
- newPlane.lastPriority = 0xFFFF; // hidden
+ newPlane.lastPriority = -1; // hidden
newPlane.planeOffsetX = 0;
newPlane.planeOffsetY = 0;
- newPlane.pictureId = 0xFFFF;
+ newPlane.pictureId = kPlanePlainColored;
newPlane.planePictureMirrored = false;
newPlane.planeBack = 0;
_planes.push_back(newPlane);
@@ -111,7 +175,8 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
if (lastPictureId != it->pictureId) {
// picture got changed, load new picture
deletePlanePictures(object);
- if ((it->pictureId != 0xFFFF) && (it->pictureId != 0xFFFE)) {
+ // Draw the plane's picture if it's not a translucent/plane colored frame
+ if ((it->pictureId != kPlanePlainColored) && (it->pictureId != kPlaneTranslucent)) {
// SQ6 gives us a bad picture number for the control menu
if (_resMan->testResource(ResourceId(kResourceTypePic, it->pictureId)))
addPlanePicture(object, it->pictureId, 0);
@@ -122,11 +187,8 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
it->planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom));
it->planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right));
- Common::Rect screenRect(_screen->getWidth(), _screen->getHeight());
- it->planeRect.top = (it->planeRect.top * screenRect.height()) / _scriptsRunningHeight;
- it->planeRect.left = (it->planeRect.left * screenRect.width()) / _scriptsRunningWidth;
- it->planeRect.bottom = (it->planeRect.bottom * screenRect.height()) / _scriptsRunningHeight;
- it->planeRect.right = (it->planeRect.right * screenRect.width()) / _scriptsRunningWidth;
+ _coordAdjuster->fromScriptToDisplay(it->planeRect.top, it->planeRect.left);
+ _coordAdjuster->fromScriptToDisplay(it->planeRect.bottom, it->planeRect.right);
// We get negative left in kq7 in scrolling rooms
if (it->planeRect.left < 0) {
@@ -135,7 +197,7 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
} else {
it->planeOffsetX = 0;
}
-
+
if (it->planeRect.top < 0) {
it->planeOffsetY = -it->planeRect.top;
it->planeRect.top = 0;
@@ -191,11 +253,9 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom));
planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right));
- Common::Rect screenRect(_screen->getWidth(), _screen->getHeight());
- planeRect.top = (planeRect.top * screenRect.height()) / _scriptsRunningHeight;
- planeRect.left = (planeRect.left * screenRect.width()) / _scriptsRunningWidth;
- planeRect.bottom = (planeRect.bottom * screenRect.height()) / _scriptsRunningHeight;
- planeRect.right = (planeRect.right * screenRect.width()) / _scriptsRunningWidth;
+ _coordAdjuster->fromScriptToDisplay(planeRect.top, planeRect.left);
+ _coordAdjuster->fromScriptToDisplay(planeRect.bottom, planeRect.right);
+
// Blackout removed plane rect
_paint32->fillRect(planeRect, 0);
return;
@@ -204,6 +264,9 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
}
void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY) {
+ if (pictureId == kPlanePlainColored || pictureId == kPlaneTranslucent) // sanity check
+ return;
+
PlanePictureEntry newPicture;
newPicture.object = object;
newPicture.pictureId = pictureId;
@@ -228,15 +291,76 @@ void GfxFrameout::deletePlanePictures(reg_t object) {
}
}
+// Provides the same functionality as kGraph(DrawLine)
+reg_t GfxFrameout::addPlaneLine(reg_t object, Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) {
+ for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
+ if (it->object == object) {
+ PlaneLineEntry line;
+ line.hunkId = _segMan->allocateHunkEntry("PlaneLine()", 1); // we basically use this for a unique ID
+ line.startPoint = startPoint;
+ line.endPoint = endPoint;
+ line.color = color;
+ line.priority = priority;
+ line.control = control;
+ it->lines.push_back(line);
+ return line.hunkId;
+ }
+ }
+
+ return NULL_REG;
+}
+
+void GfxFrameout::updatePlaneLine(reg_t object, reg_t hunkId, Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) {
+ // Check if we're asked to update a line that was never added
+ if (hunkId.isNull())
+ return;
+
+ for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
+ if (it->object == object) {
+ for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) {
+ if (it2->hunkId == hunkId) {
+ it2->startPoint = startPoint;
+ it2->endPoint = endPoint;
+ it2->color = color;
+ it2->priority = priority;
+ it2->control = control;
+ return;
+ }
+ }
+ }
+ }
+}
+
+void GfxFrameout::deletePlaneLine(reg_t object, reg_t hunkId) {
+ // Check if we're asked to delete a line that was never added (happens during the intro of LSL6)
+ if (hunkId.isNull())
+ return;
+
+ for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
+ if (it->object == object) {
+ for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) {
+ if (it2->hunkId == hunkId) {
+ _segMan->freeHunkEntry(hunkId);
+ it2 = it->lines.erase(it2);
+ return;
+ }
+ }
+ }
+ }
+}
+
void GfxFrameout::kernelAddScreenItem(reg_t object) {
// Ignore invalid items
- if (!_segMan->isObject(object))
+ if (!_segMan->isObject(object)) {
+ warning("kernelAddScreenItem: Attempt to add an invalid object (%04x:%04x)", PRINT_REG(object));
return;
+ }
FrameoutEntry *itemEntry = new FrameoutEntry();
memset(itemEntry, 0, sizeof(FrameoutEntry));
itemEntry->object = object;
itemEntry->givenOrderNr = _screenItems.size();
+ itemEntry->visible = true;
_screenItems.push_back(itemEntry);
kernelUpdateScreenItem(object);
@@ -244,8 +368,10 @@ void GfxFrameout::kernelAddScreenItem(reg_t object) {
void GfxFrameout::kernelUpdateScreenItem(reg_t object) {
// Ignore invalid items
- if (!_segMan->isObject(object))
+ if (!_segMan->isObject(object)) {
+ warning("kernelUpdateScreenItem: Attempt to update an invalid object (%04x:%04x)", PRINT_REG(object));
return;
+ }
FrameoutEntry *itemEntry = findScreenItem(object);
if (!itemEntry) {
@@ -266,14 +392,18 @@ void GfxFrameout::kernelUpdateScreenItem(reg_t object) {
itemEntry->signal = readSelectorValue(_segMan, object, SELECTOR(signal));
itemEntry->scaleX = readSelectorValue(_segMan, object, SELECTOR(scaleX));
itemEntry->scaleY = readSelectorValue(_segMan, object, SELECTOR(scaleY));
+ itemEntry->visible = true;
+
+ // Check if the entry can be hidden
+ if (lookupSelector(_segMan, object, SELECTOR(visible), NULL, NULL) != kSelectorNone)
+ itemEntry->visible = readSelectorValue(_segMan, object, SELECTOR(visible));
}
void GfxFrameout::kernelDeleteScreenItem(reg_t object) {
FrameoutEntry *itemEntry = findScreenItem(object);
- if (!itemEntry) {
- warning("kernelDeleteScreenItem: invalid object %04x:%04x", PRINT_REG(object));
+ // If the item could not be found, it may already have been deleted
+ if (!itemEntry)
return;
- }
_screenItems.remove(itemEntry);
delete itemEntry;
@@ -290,7 +420,7 @@ void GfxFrameout::deletePlaneItems(reg_t planeObject) {
} else {
objectMatches = true;
}
-
+
if (objectMatches) {
FrameoutEntry *itemEntry = *listIterator;
listIterator = _screenItems.erase(listIterator);
@@ -330,15 +460,10 @@ bool sortHelper(const FrameoutEntry* entry1, const FrameoutEntry* entry2) {
}
bool planeSortHelper(const PlaneEntry &entry1, const PlaneEntry &entry2) {
-// SegManager *segMan = g_sci->getEngineState()->_segMan;
-
-// uint16 plane1Priority = readSelectorValue(segMan, entry1, SELECTOR(priority));
-// uint16 plane2Priority = readSelectorValue(segMan, entry2, SELECTOR(priority));
-
- if (entry1.priority == 0xffff)
+ if (entry1.priority < 0)
return true;
- if (entry2.priority == 0xffff)
+ if (entry2.priority < 0)
return false;
return entry1.priority < entry2.priority;
@@ -357,23 +482,6 @@ void GfxFrameout::sortPlanes() {
Common::sort(_planes.begin(), _planes.end(), planeSortHelper);
}
-int16 GfxFrameout::upscaleHorizontalCoordinate(int16 coordinate) {
- return ((coordinate * _screen->getWidth()) / _scriptsRunningWidth);
-}
-
-int16 GfxFrameout::upscaleVerticalCoordinate(int16 coordinate) {
- return ((coordinate * _screen->getHeight()) / _scriptsRunningHeight);
-}
-
-Common::Rect GfxFrameout::upscaleRect(Common::Rect &rect) {
- rect.top = (rect.top * _scriptsRunningHeight) / _screen->getHeight();
- rect.left = (rect.left * _scriptsRunningWidth) / _screen->getWidth();
- rect.bottom = (rect.bottom * _scriptsRunningHeight) / _screen->getHeight();
- rect.right = (rect.right * _scriptsRunningWidth) / _screen->getWidth();
-
- return rect;
-}
-
void GfxFrameout::showVideo() {
bool skipVideo = false;
RobotDecoder *videoDecoder = g_sci->_robotDecoder;
@@ -381,16 +489,16 @@ void GfxFrameout::showVideo() {
uint16 y = videoDecoder->getPos().y;
if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+ g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256);
while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) {
const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
if (frame) {
- g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+ g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256);
g_system->updateScreen();
}
@@ -433,6 +541,7 @@ void GfxFrameout::createPlaneItemList(reg_t planeObject, FrameoutList &itemList)
picEntry->x = planePicture->getSci32celX(pictureCelNr);
picEntry->picStartX = pictureIt->startX;
picEntry->picStartY = pictureIt->startY;
+ picEntry->visible = true;
picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
@@ -507,13 +616,26 @@ void GfxFrameout::kernelFrameout() {
for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) {
reg_t planeObject = it->object;
- uint16 planeLastPriority = it->lastPriority;
+
+ // Draw any plane lines, if they exist
+ // These are drawn on invisible planes as well. (e.g. "invisiblePlane" in LSL6 hires)
+ // FIXME: Lines aren't always drawn (e.g. when the narrator speaks in LSL6 hires).
+ // Perhaps something is painted over them?
+ for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) {
+ Common::Point startPoint = it2->startPoint;
+ Common::Point endPoint = it2->endPoint;
+ _coordAdjuster->kernelLocalToGlobal(startPoint.x, startPoint.y, it->object);
+ _coordAdjuster->kernelLocalToGlobal(endPoint.x, endPoint.y, it->object);
+ _screen->drawLine(startPoint, endPoint, it2->color, it2->priority, it2->control);
+ }
+
+ int16 planeLastPriority = it->lastPriority;
// Update priority here, sq6 sets it w/o UpdatePlane
- uint16 planePriority = it->priority = readSelectorValue(_segMan, planeObject, SELECTOR(priority));
+ int16 planePriority = it->priority = readSelectorValue(_segMan, planeObject, SELECTOR(priority));
it->lastPriority = planePriority;
- if (planePriority == 0xffff) { // Plane currently not meant to be shown
+ if (planePriority < 0) { // Plane currently not meant to be shown
// If plane was shown before, delete plane rect
if (planePriority != planeLastPriority)
_paint32->fillRect(it->planeRect, 0);
@@ -523,44 +645,40 @@ 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) // FIXME: This is what SSCI does, and fixes the intro of LSL7, but breaks the dialogs in GK1 (adds black boxes)
- if (it->planeBack)
+ //if (it->pictureId == kPlanePlainColored) // FIXME: This is what SSCI does, and fixes the intro of LSL7, but breaks the dialogs in GK1 (adds black boxes)
+ if (it->pictureId == kPlanePlainColored && (it->planeBack || g_sci->getGameId() != GID_GK1))
_paint32->fillRect(it->planeRect, it->planeBack);
- GuiResourceId planeMainPictureId = it->pictureId;
-
_coordAdjuster->pictureSetDisplayArea(it->planeRect);
- _palette->drewPicture(planeMainPictureId);
+ _palette->drewPicture(it->pictureId);
FrameoutList itemList;
createPlaneItemList(planeObject, itemList);
-// warning("Plane %s", _segMan->getObjectName(planeObject));
-
for (FrameoutList::iterator listIterator = itemList.begin(); listIterator != itemList.end(); listIterator++) {
FrameoutEntry *itemEntry = *listIterator;
+ if (!itemEntry->visible)
+ continue;
+
if (itemEntry->object.isNull()) {
// Picture cel data
- itemEntry->x = upscaleHorizontalCoordinate(itemEntry->x);
- itemEntry->y = upscaleVerticalCoordinate(itemEntry->y);
- itemEntry->picStartX = upscaleHorizontalCoordinate(itemEntry->picStartX);
- itemEntry->picStartY = upscaleVerticalCoordinate(itemEntry->picStartY);
+ _coordAdjuster->fromScriptToDisplay(itemEntry->y, itemEntry->x);
+ _coordAdjuster->fromScriptToDisplay(itemEntry->picStartY, itemEntry->picStartX);
if (!isPictureOutOfView(itemEntry, it->planeRect, it->planeOffsetX, it->planeOffsetY))
drawPicture(itemEntry, it->planeOffsetX, it->planeOffsetY, it->planePictureMirrored);
} else {
GfxView *view = (itemEntry->viewId != 0xFFFF) ? _cache->getView(itemEntry->viewId) : NULL;
-
+ int16 dummyX = 0;
+
if (view && view->isSci2Hires()) {
- int16 dummyX = 0;
view->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
view->adjustToUpscaledCoordinates(itemEntry->z, dummyX);
- } else if (getSciVersion() == SCI_VERSION_2_1) {
- itemEntry->x = upscaleHorizontalCoordinate(itemEntry->x);
- itemEntry->y = upscaleVerticalCoordinate(itemEntry->y);
- itemEntry->z = upscaleVerticalCoordinate(itemEntry->z);
+ } else if (getSciVersion() >= SCI_VERSION_2_1) {
+ _coordAdjuster->fromScriptToDisplay(itemEntry->y, itemEntry->x);
+ _coordAdjuster->fromScriptToDisplay(itemEntry->z, dummyX);
}
// Adjust according to current scroll position
@@ -581,13 +699,13 @@ void GfxFrameout::kernelFrameout() {
// TODO: maybe we should clip the cels rect with this, i'm not sure
// the only currently known usage is game menu of gk1
} else if (view) {
- if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
- view->getCelRect(itemEntry->loopNo, itemEntry->celNo,
- itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect);
- else
- view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo,
- itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX,
- itemEntry->scaleY, itemEntry->celRect);
+ if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
+ view->getCelRect(itemEntry->loopNo, itemEntry->celNo,
+ itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect);
+ else
+ view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo,
+ itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX,
+ itemEntry->scaleY, itemEntry->celRect);
Common::Rect nsRect = itemEntry->celRect;
// Translate back to actual coordinate within scrollable plane
@@ -596,8 +714,9 @@ void GfxFrameout::kernelFrameout() {
if (view && view->isSci2Hires()) {
view->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left);
view->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right);
- } else if (getSciVersion() == SCI_VERSION_2_1) {
- nsRect = upscaleRect(nsRect);
+ } else if (getSciVersion() >= SCI_VERSION_2_1) {
+ _coordAdjuster->fromDisplayToScript(nsRect.top, nsRect.left);
+ _coordAdjuster->fromDisplayToScript(nsRect.bottom, nsRect.right);
}
if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
@@ -610,17 +729,11 @@ void GfxFrameout::kernelFrameout() {
g_sci->_gfxCompare->setNSRect(itemEntry->object, nsRect);
}
- int16 screenHeight = _screen->getHeight();
- int16 screenWidth = _screen->getWidth();
- if (view && view->isSci2Hires()) {
- screenHeight = _screen->getDisplayHeight();
- screenWidth = _screen->getDisplayWidth();
- }
-
- if (itemEntry->celRect.bottom < 0 || itemEntry->celRect.top >= screenHeight)
- continue;
-
- if (itemEntry->celRect.right < 0 || itemEntry->celRect.left >= screenWidth)
+ // Don't attempt to draw sprites that are outside the visible
+ // screen area. An example is the random people walking in
+ // Jackson Square in GK1.
+ if (itemEntry->celRect.bottom < 0 || itemEntry->celRect.top >= _screen->getDisplayHeight() ||
+ itemEntry->celRect.right < 0 || itemEntry->celRect.left >= _screen->getDisplayWidth())
continue;
Common::Rect clipRect, translatedClipRect;
@@ -631,6 +744,9 @@ void GfxFrameout::kernelFrameout() {
translatedClipRect = clipRect;
translatedClipRect.translate(it->upscaledPlaneRect.left, it->upscaledPlaneRect.top);
} else {
+ // QFG4 passes invalid rectangles when a battle is starting
+ if (!clipRect.isValidRect())
+ continue;
clipRect.clip(it->planeClipRect);
translatedClipRect = clipRect;
translatedClipRect.translate(it->planeRect.left, it->planeRect.top);
@@ -639,10 +755,10 @@ void GfxFrameout::kernelFrameout() {
if (view) {
if (!clipRect.isEmpty()) {
if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
- view->draw(itemEntry->celRect, clipRect, translatedClipRect,
+ view->draw(itemEntry->celRect, clipRect, translatedClipRect,
itemEntry->loopNo, itemEntry->celNo, 255, 0, view->isSci2Hires());
else
- view->drawScaled(itemEntry->celRect, clipRect, translatedClipRect,
+ view->drawScaled(itemEntry->celRect, clipRect, translatedClipRect,
itemEntry->loopNo, itemEntry->celNo, 255, itemEntry->scaleX, itemEntry->scaleY);
}
}
@@ -662,9 +778,61 @@ void GfxFrameout::kernelFrameout() {
}
}
+ showCurrentScrollText();
+
_screen->copyToScreen();
g_sci->getEngineState()->_throttleTrigger = true;
}
+void GfxFrameout::printPlaneList(Console *con) {
+ for (PlaneList::const_iterator it = _planes.begin(); it != _planes.end(); ++it) {
+ PlaneEntry p = *it;
+ Common::String curPlaneName = _segMan->getObjectName(p.object);
+ Common::Rect r = p.upscaledPlaneRect;
+ Common::Rect cr = p.upscaledPlaneClipRect;
+
+ con->DebugPrintf("%04x:%04x (%s): prio %d, lastprio %d, offsetX %d, offsetY %d, pic %d, mirror %d, back %d\n",
+ PRINT_REG(p.object), curPlaneName.c_str(),
+ (int16)p.priority, (int16)p.lastPriority,
+ p.planeOffsetX, p.planeOffsetY, p.pictureId,
+ p.planePictureMirrored, p.planeBack);
+ con->DebugPrintf(" rect: (%d, %d, %d, %d), clip rect: (%d, %d, %d, %d)\n",
+ r.left, r.top, r.right, r.bottom,
+ cr.left, cr.top, cr.right, cr.bottom);
+
+ if (p.pictureId != 0xffff && p.pictureId != 0xfffe) {
+ con->DebugPrintf("Pictures:\n");
+
+ for (PlanePictureList::iterator pictureIt = _planePictures.begin(); pictureIt != _planePictures.end(); pictureIt++) {
+ if (pictureIt->object == p.object) {
+ con->DebugPrintf(" Picture %d: x %d, y %d\n", pictureIt->pictureId, pictureIt->startX, pictureIt->startY);
+ }
+ }
+ }
+ }
+}
+
+void GfxFrameout::printPlaneItemList(Console *con, reg_t planeObject) {
+ for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) {
+ FrameoutEntry *e = *listIterator;
+ reg_t itemPlane = readSelector(_segMan, e->object, SELECTOR(plane));
+
+ if (planeObject == itemPlane) {
+ Common::String curItemName = _segMan->getObjectName(e->object);
+ Common::Rect icr = e->celRect;
+ GuiResourceId picId = e->picture ? e->picture->getResourceId() : 0;
+
+ con->DebugPrintf("%d: %04x:%04x (%s), view %d, loop %d, cel %d, x %d, y %d, z %d, "
+ "signal %d, scale signal %d, scaleX %d, scaleY %d, rect (%d, %d, %d, %d), "
+ "pic %d, picX %d, picY %d, visible %d\n",
+ e->givenOrderNr, PRINT_REG(e->object), curItemName.c_str(),
+ e->viewId, e->loopNo, e->celNo, e->x, e->y, e->z,
+ e->signal, e->scaleSignal, e->scaleX, e->scaleY,
+ icr.left, icr.top, icr.right, icr.bottom,
+ picId, e->picStartX, e->picStartY, e->visible);
+ }
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 8c3cc261d5..5fd2824224 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -27,10 +27,21 @@ namespace Sci {
class GfxPicture;
+struct PlaneLineEntry {
+ reg_t hunkId;
+ Common::Point startPoint;
+ Common::Point endPoint;
+ byte color;
+ byte priority;
+ byte control;
+};
+
+typedef Common::List<PlaneLineEntry> PlaneLineList;
+
struct PlaneEntry {
reg_t object;
- uint16 priority;
- uint16 lastPriority;
+ int16 priority;
+ int16 lastPriority;
int16 planeOffsetX;
int16 planeOffsetY;
GuiResourceId pictureId;
@@ -40,6 +51,7 @@ struct PlaneEntry {
Common::Rect upscaledPlaneClipRect;
bool planePictureMirrored;
byte planeBack;
+ PlaneLineList lines;
};
typedef Common::List<PlaneEntry> PlaneList;
@@ -60,6 +72,7 @@ struct FrameoutEntry {
GfxPicture *picture;
int16 picStartX;
int16 picStartY;
+ bool visible;
};
typedef Common::List<FrameoutEntry *> FrameoutList;
@@ -75,6 +88,15 @@ struct PlanePictureEntry {
typedef Common::List<PlanePictureEntry> PlanePictureList;
+struct ScrollTextEntry {
+ reg_t bitmapHandle;
+ reg_t kWindow;
+ uint16 x;
+ uint16 y;
+};
+
+typedef Common::Array<ScrollTextEntry> ScrollTextList;
+
class GfxCache;
class GfxCoordAdjuster32;
class GfxPaint32;
@@ -102,16 +124,30 @@ public:
void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY = 0);
void deletePlanePictures(reg_t object);
+ reg_t addPlaneLine(reg_t object, Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control);
+ void updatePlaneLine(reg_t object, reg_t hunkId, Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control);
+ void deletePlaneLine(reg_t object, reg_t hunkId);
void clear();
+ // Scroll text functions
+ void addScrollTextEntry(Common::String &text, reg_t kWindow, uint16 x, uint16 y, bool replace);
+ void showCurrentScrollText();
+ void initScrollText(uint16 maxItems) { _maxScrollTexts = maxItems; }
+ void clearScrollTexts();
+ void firstScrollText() { if (_scrollTexts.size() > 0) _curScrollText = 0; }
+ void lastScrollText() { if (_scrollTexts.size() > 0) _curScrollText = _scrollTexts.size() - 1; }
+ void prevScrollText() { if (_curScrollText > 0) _curScrollText--; }
+ void nextScrollText() { if (_curScrollText + 1 < (uint16)_scrollTexts.size()) _curScrollText++; }
+ void toggleScrollText(bool show) { _showScrollText = show; }
+
+ void printPlaneList(Console *con);
+ void printPlaneItemList(Console *con, reg_t planeObject);
+
private:
void showVideo();
void createPlaneItemList(reg_t planeObject, FrameoutList &itemList);
bool isPictureOutOfView(FrameoutEntry *itemEntry, Common::Rect planeRect, int16 planeOffsetX, int16 planeOffsetY);
void drawPicture(FrameoutEntry *itemEntry, int16 planeOffsetX, int16 planeOffsetY, bool planePictureMirrored);
- int16 upscaleHorizontalCoordinate(int16 coordinate);
- int16 upscaleVerticalCoordinate(int16 coordinate);
- Common::Rect upscaleRect(Common::Rect &rect);
SegManager *_segMan;
ResourceManager *_resMan;
@@ -124,11 +160,12 @@ private:
FrameoutList _screenItems;
PlaneList _planes;
PlanePictureList _planePictures;
+ ScrollTextList _scrollTexts;
+ int16 _curScrollText;
+ bool _showScrollText;
+ uint16 _maxScrollTexts;
void sortPlanes();
-
- uint16 _scriptsRunningWidth;
- uint16 _scriptsRunningHeight;
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp
index bff145ad53..dfb50b0edb 100644
--- a/engines/sci/graphics/maciconbar.cpp
+++ b/engines/sci/graphics/maciconbar.cpp
@@ -31,8 +31,8 @@
#include "common/memstream.h"
#include "common/system.h"
-#include "graphics/pict.h"
#include "graphics/surface.h"
+#include "graphics/decoders/pict.h"
namespace Sci {
@@ -129,7 +129,7 @@ void GfxMacIconBar::drawIcon(uint16 iconIndex, bool selected) {
void GfxMacIconBar::drawEnabledImage(Graphics::Surface *surface, const Common::Rect &rect) {
if (surface)
- g_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, rect.left, rect.top, rect.width(), rect.height());
+ g_system->copyRectToScreen(surface->pixels, surface->pitch, rect.left, rect.top, rect.width(), rect.height());
}
void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::Rect &rect) {
@@ -153,7 +153,7 @@ void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::
*((byte *)newSurf.getBasePtr(j, i)) = 0;
}
- g_system->copyRectToScreen((byte *)newSurf.pixels, newSurf.pitch, rect.left, rect.top, rect.width(), rect.height());
+ g_system->copyRectToScreen(newSurf.pixels, newSurf.pitch, rect.left, rect.top, rect.width(), rect.height());
newSurf.free();
}
@@ -201,18 +201,20 @@ void GfxMacIconBar::setInventoryIcon(int16 icon) {
}
Graphics::Surface *GfxMacIconBar::loadPict(ResourceId id) {
- Graphics::PictDecoder pictDecoder(Graphics::PixelFormat::createFormatCLUT8());
+ Graphics::PICTDecoder pictDecoder;
Resource *res = g_sci->getResMan()->findResource(id, false);
if (!res || res->size == 0)
return 0;
- byte palette[256 * 3];
- Common::SeekableReadStream *stream = new Common::MemoryReadStream(res->data, res->size);
- Graphics::Surface *surface = pictDecoder.decodeImage(stream, palette);
- remapColors(surface, palette);
+ Common::MemoryReadStream stream(res->data, res->size);
+ if (!pictDecoder.loadStream(stream))
+ return 0;
+
+ Graphics::Surface *surface = new Graphics::Surface();
+ surface->copyFrom(*pictDecoder.getSurface());
+ remapColors(surface, pictDecoder.getPalette());
- delete stream;
return surface;
}
@@ -221,7 +223,7 @@ Graphics::Surface *GfxMacIconBar::createImage(uint32 iconIndex, bool isSelected)
return loadPict(ResourceId(type, iconIndex + 1));
}
-void GfxMacIconBar::remapColors(Graphics::Surface *surf, byte *palette) {
+void GfxMacIconBar::remapColors(Graphics::Surface *surf, const byte *palette) {
byte *pixels = (byte *)surf->pixels;
// Remap to the screen palette
diff --git a/engines/sci/graphics/maciconbar.h b/engines/sci/graphics/maciconbar.h
index 43de37a904..eca10b804c 100644
--- a/engines/sci/graphics/maciconbar.h
+++ b/engines/sci/graphics/maciconbar.h
@@ -61,7 +61,7 @@ private:
Graphics::Surface *loadPict(ResourceId id);
Graphics::Surface *createImage(uint32 iconIndex, bool isSelected);
- void remapColors(Graphics::Surface *surf, byte *palette);
+ void remapColors(Graphics::Surface *surf, const byte *palette);
void drawIcon(uint16 index, bool selected);
void drawSelectedImage(uint16 index);
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index 673729784f..bfecc296a2 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -219,7 +219,7 @@ void GfxMenu::kernelAddEntry(Common::String title, Common::String content, reg_t
}
}
itemEntry->textVmPtr = contentVmPtr;
- itemEntry->textVmPtr.offset += beginPos;
+ itemEntry->textVmPtr.incOffset(beginPos);
if (rightAlignedPos) {
rightAlignedPos++;
@@ -286,7 +286,7 @@ void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeI
switch (attributeId) {
case SCI_MENU_ATTRIBUTE_ENABLED:
- itemEntry->enabled = value.isNull() ? false : true;
+ itemEntry->enabled = !value.isNull();
break;
case SCI_MENU_ATTRIBUTE_SAID:
itemEntry->saidVmPtr = value;
@@ -297,13 +297,13 @@ void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeI
// We assume here that no script ever creates a separatorLine dynamically
break;
case SCI_MENU_ATTRIBUTE_KEYPRESS:
- itemEntry->keyPress = tolower(value.offset);
+ itemEntry->keyPress = tolower(value.getOffset());
itemEntry->keyModifier = 0;
// TODO: Find out how modifier is handled
- debug("setAttr keypress %X %X", value.segment, value.offset);
+ debug("setAttr keypress %X %X", value.getSegment(), value.getOffset());
break;
case SCI_MENU_ATTRIBUTE_TAG:
- itemEntry->tag = value.offset;
+ itemEntry->tag = value.getOffset();
break;
default:
// Happens when loading a game in LSL3 - attribute 1A
@@ -606,7 +606,7 @@ void GfxMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
listItemEntry = *listItemIterator;
if (listItemEntry->menuId == newMenuId) {
if (!listItemEntry->separatorLine) {
- _ports->textGreyedOutput(listItemEntry->enabled ? false : true);
+ _ports->textGreyedOutput(!listItemEntry->enabled);
_ports->moveTo(_menuRect.left, topPos);
_text16->DrawString(listItemEntry->textSplit.c_str());
_ports->moveTo(_menuRect.right - listItemEntry->textRightAlignedWidth - 5, topPos);
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 23177dfc7b..d20aa80c77 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -491,10 +491,10 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
// processing codes in argv
while (argc > 0) {
displayArg = argv[0];
- if (displayArg.segment)
- displayArg.offset = 0xFFFF;
+ if (displayArg.getSegment())
+ displayArg.setOffset(0xFFFF);
argc--; argv++;
- switch (displayArg.offset) {
+ switch (displayArg.getOffset()) {
case SCI_DISPLAY_MOVEPEN:
_ports->moveTo(argv[0].toUint16(), argv[1].toUint16());
argc -= 2; argv += 2;
@@ -513,7 +513,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
argc--; argv++;
break;
case SCI_DISPLAY_SETGREYEDOUTPUT:
- _ports->textGreyedOutput(argv[0].isNull() ? false : true);
+ _ports->textGreyedOutput(!argv[0].isNull());
argc--; argv++;
break;
case SCI_DISPLAY_SETFONT:
@@ -547,9 +547,9 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
if (!(g_sci->getGameId() == GID_LONGBOW && g_sci->isDemo()) &&
!(g_sci->getGameId() == GID_QFG1 && g_sci->isDemo()) &&
!(g_sci->getGameId() == GID_PQ2))
- error("Unknown kDisplay argument %d", displayArg.offset);
+ error("Unknown kDisplay argument %d", displayArg.getOffset());
- if (displayArg.offset == SCI_DISPLAY_DUMMY2) {
+ if (displayArg.getOffset() == SCI_DISPLAY_DUMMY2) {
if (!argc)
error("No parameter left for kDisplay(115)");
argc--; argv++;
@@ -559,8 +559,8 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
SciTrackOriginReply originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply);
if (solution.type == WORKAROUND_NONE)
- error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)",
- PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(),
+ error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)",
+ PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(),
originReply.scriptNr, originReply.localCallOffset);
assert(solution.type == WORKAROUND_IGNORE);
break;
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 47d1647c6c..53d69cdcca 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -100,6 +100,9 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen)
default:
error("GfxPalette: Unknown view type");
}
+
+ _remapOn = false;
+ resetRemapping();
}
GfxPalette::~GfxPalette() {
@@ -140,8 +143,9 @@ void GfxPalette::createFromData(byte *data, int bytesLeft, Palette *paletteOut)
memset(paletteOut, 0, sizeof(Palette));
// Setup 1:1 mapping
- for (colorNo = 0; colorNo < 256; colorNo++)
+ for (colorNo = 0; colorNo < 256; colorNo++) {
paletteOut->mapping[colorNo] = colorNo;
+ }
if (bytesLeft < 37) {
// This happens when loading palette of picture 0 in sq5 - the resource is broken and doesn't contain a full
@@ -329,6 +333,79 @@ void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge) {
}
}
+byte GfxPalette::remapColor(byte remappedColor, byte screenColor) {
+ assert(_remapOn);
+ if (_remappingType[remappedColor] == kRemappingByRange)
+ return _remappingByRange[screenColor];
+ else if (_remappingType[remappedColor] == kRemappingByPercent)
+ return _remappingByPercent[screenColor];
+ else
+ error("remapColor(): Color %d isn't remapped", remappedColor);
+
+ return 0; // should never reach here
+}
+
+void GfxPalette::resetRemapping() {
+ _remapOn = false;
+ _remappingPercentToSet = 0;
+
+ for (int i = 0; i < 256; i++) {
+ _remappingType[i] = kRemappingNone;
+ _remappingByPercent[i] = i;
+ _remappingByRange[i] = i;
+ }
+}
+
+void GfxPalette::setRemappingPercent(byte color, byte percent) {
+ _remapOn = true;
+
+ // We need to defer the setup of the remapping table every time the screen
+ // palette is changed, so that kernelFindColor() can find the correct
+ // colors. Set it once here, in case the palette stays the same and update
+ // it on each palette change by copySysPaletteToScreen().
+ _remappingPercentToSet = percent;
+
+ for (int i = 0; i < 256; i++) {
+ byte r = _sysPalette.colors[i].r * _remappingPercentToSet / 100;
+ byte g = _sysPalette.colors[i].g * _remappingPercentToSet / 100;
+ byte b = _sysPalette.colors[i].b * _remappingPercentToSet / 100;
+ _remappingByPercent[i] = kernelFindColor(r, g, b);
+ }
+
+ _remappingType[color] = kRemappingByPercent;
+}
+
+void GfxPalette::setRemappingPercentGray(byte color, byte percent) {
+ _remapOn = true;
+
+ // We need to defer the setup of the remapping table every time the screen
+ // palette is changed, so that kernelFindColor() can find the correct
+ // colors. Set it once here, in case the palette stays the same and update
+ // it on each palette change by copySysPaletteToScreen().
+ _remappingPercentToSet = percent;
+
+ // Note: This is not what the original does, but the results are the same visually
+ for (int i = 0; i < 256; i++) {
+ byte rComponent = _sysPalette.colors[i].r * _remappingPercentToSet * 0.30 / 100;
+ byte gComponent = _sysPalette.colors[i].g * _remappingPercentToSet * 0.59 / 100;
+ byte bComponent = _sysPalette.colors[i].b * _remappingPercentToSet * 0.11 / 100;
+ byte luminosity = rComponent + gComponent + bComponent;
+ _remappingByPercent[i] = kernelFindColor(luminosity, luminosity, luminosity);
+ }
+
+ _remappingType[color] = kRemappingByPercent;
+}
+
+void GfxPalette::setRemappingRange(byte color, byte from, byte to, byte base) {
+ _remapOn = true;
+
+ for (int i = from; i <= to; i++) {
+ _remappingByRange[i] = i + base;
+ }
+
+ _remappingType[color] = kRemappingByRange;
+}
+
bool GfxPalette::insert(Palette *newPalette, Palette *destPalette) {
bool paletteChanged = false;
@@ -491,6 +568,16 @@ void GfxPalette::copySysPaletteToScreen() {
}
}
+ // Check if we need to reset remapping by percent with the new colors.
+ if (_remappingPercentToSet) {
+ for (int i = 0; i < 256; i++) {
+ byte r = _sysPalette.colors[i].r * _remappingPercentToSet / 100;
+ byte g = _sysPalette.colors[i].g * _remappingPercentToSet / 100;
+ byte b = _sysPalette.colors[i].b * _remappingPercentToSet / 100;
+ _remappingByPercent[i] = kernelFindColor(r, g, b);
+ }
+ }
+
g_system->getPaletteManager()->setPalette(bpal, 0, 256);
}
@@ -698,7 +785,7 @@ void GfxPalette::palVaryInit() {
}
bool GfxPalette::palVaryLoadTargetPalette(GuiResourceId resourceId) {
- _palVaryResourceId = resourceId;
+ _palVaryResourceId = (resourceId != 65535) ? resourceId : -1;
Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), false);
if (palResource) {
// Load and initialize destination palette
@@ -999,8 +1086,9 @@ bool GfxPalette::loadClut(uint16 clutId) {
memset(&pal, 0, sizeof(Palette));
// Setup 1:1 mapping
- for (int i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++) {
pal.mapping[i] = i;
+ }
// Now load in the palette
for (int i = 1; i <= 236; i++) {
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index a9ea1c32de..e974781d49 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -31,6 +31,12 @@ namespace Sci {
class ResourceManager;
class GfxScreen;
+enum ColorRemappingType {
+ kRemappingNone = 0,
+ kRemappingByRange = 1,
+ kRemappingByPercent = 2
+};
+
/**
* Palette class, handles palette operations like changing intensity, setting up the palette, merging different palettes
*/
@@ -53,6 +59,15 @@ public:
void getSys(Palette *pal);
uint16 getTotalColorCount() const { return _totalScreenColors; }
+ void resetRemapping();
+ void setRemappingPercent(byte color, byte percent);
+ void setRemappingPercentGray(byte color, byte percent);
+ void setRemappingRange(byte color, byte from, byte to, byte base);
+ bool isRemapped(byte color) const {
+ return _remapOn && (_remappingType[color] != kRemappingNone);
+ }
+ byte remapColor(byte remappedColor, byte screenColor);
+
void setOnScreen();
void copySysPaletteToScreen();
@@ -123,6 +138,12 @@ private:
int _palVarySignal;
uint16 _totalScreenColors;
+ bool _remapOn;
+ ColorRemappingType _remappingType[256];
+ byte _remappingByPercent[256];
+ byte _remappingByRange[256];
+ uint16 _remappingPercentToSet;
+
void loadMacIconBarPalette();
byte *_macClut;
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp
index 6b4c8180bf..8acdeed763 100644
--- a/engines/sci/graphics/ports.cpp
+++ b/engines/sci/graphics/ports.cpp
@@ -380,17 +380,50 @@ Window *GfxPorts::addWindow(const Common::Rect &dims, const Common::Rect *restor
int16 oldtop = pwnd->dims.top;
int16 oldleft = pwnd->dims.left;
- if (wmprect.top > pwnd->dims.top)
+ // WORKAROUND: We also adjust the restore rect when adjusting the window
+ // rect.
+ // SSCI does not do this. It wasn't necessary in the original interpreter,
+ // but it is needed for Freddy Pharkas CD. This version does not normally
+ // have text, but we allow this by modifying the text/speech setting
+ // according to what is set in the ScummVM GUI (refer to syncIngameAudioOptions()
+ // in sci.cpp). Since the text used in Freddy Pharkas CD is quite large in
+ // some cases, it ends up being offset in order to fit inside the screen,
+ // but the associated restore rect isn't adjusted accordingly, leading to
+ // artifacts being left on screen when some text boxes are removed. The
+ // fact that the restore rect wasn't ever adjusted doesn't make sense, and
+ // adjusting it shouldn't have any negative side-effects (it *should* be
+ // adjusted, normally, but SCI doesn't do it). The big text boxes are still
+ // odd-looking, because the text rect is drawn outside the text window rect,
+ // but at least there aren't any leftover textbox artifacts left when the
+ // boxes are removed. Adjusting the text window rect would require more
+ // invasive changes than this one, thus it's not really worth the effort
+ // for a feature that was not present in the original game, and its
+ // implementation is buggy in the first place.
+ // Adjusting the restore rect properly fixes bug #3575276.
+
+ if (wmprect.top > pwnd->dims.top) {
pwnd->dims.moveTo(pwnd->dims.left, wmprect.top);
+ if (restoreRect)
+ pwnd->restoreRect.moveTo(pwnd->restoreRect.left, wmprect.top);
+ }
- if (wmprect.bottom < pwnd->dims.bottom)
+ if (wmprect.bottom < pwnd->dims.bottom) {
pwnd->dims.moveTo(pwnd->dims.left, wmprect.bottom - pwnd->dims.bottom + pwnd->dims.top);
+ if (restoreRect)
+ pwnd->restoreRect.moveTo(pwnd->restoreRect.left, wmprect.bottom - pwnd->restoreRect.bottom + pwnd->restoreRect.top);
+ }
- if (wmprect.right < pwnd->dims.right)
+ if (wmprect.right < pwnd->dims.right) {
pwnd->dims.moveTo(wmprect.right + pwnd->dims.left - pwnd->dims.right, pwnd->dims.top);
+ if (restoreRect)
+ pwnd->restoreRect.moveTo(wmprect.right + pwnd->restoreRect.left - pwnd->restoreRect.right, pwnd->restoreRect.top);
+ }
- if (wmprect.left > pwnd->dims.left)
+ if (wmprect.left > pwnd->dims.left) {
pwnd->dims.moveTo(wmprect.left, pwnd->dims.top);
+ if (restoreRect)
+ pwnd->restoreRect.moveTo(wmprect.left, pwnd->restoreRect.top);
+ }
pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft, pwnd->rect.top + pwnd->dims.top - oldtop);
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 4020518b72..246b6bfff9 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -53,23 +53,35 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
#ifdef ENABLE_SCI32
// GK1 Mac uses a 640x480 resolution too
- if (g_sci->getGameId() == GID_GK1 && g_sci->getPlatform() == Common::kPlatformMacintosh)
- _upscaledHires = GFX_SCREEN_UPSCALED_640x480;
+ if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
+ if (g_sci->getGameId() == GID_GK1)
+ _upscaledHires = GFX_SCREEN_UPSCALED_640x480;
+ }
#endif
if (_resMan->detectHires()) {
_width = 640;
+ _pitch = 640;
_height = 480;
} else {
_width = 320;
+ _pitch = 320;
_height = getLowResScreenHeight();
}
+#ifdef ENABLE_SCI32
+ // Phantasmagoria 1 sets a window area of 630x450
+ if (g_sci->getGameId() == GID_PHANTASMAGORIA) {
+ _width = 630;
+ _height = 450;
+ }
+#endif
+
// Japanese versions of games use hi-res font on upscaled version of the game.
if ((g_sci->getLanguage() == Common::JA_JPN) && (getSciVersion() <= SCI_VERSION_1_1))
_upscaledHires = GFX_SCREEN_UPSCALED_640x400;
- _pixels = _width * _height;
+ _pixels = _pitch * _height;
switch (_upscaledHires) {
case GFX_SCREEN_UPSCALED_640x400:
@@ -91,7 +103,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
_upscaledMapping[i] = (i * 12) / 5;
break;
default:
- _displayWidth = _width;
+ _displayWidth = _pitch;
_displayHeight = _height;
memset(&_upscaledMapping, 0, sizeof(_upscaledMapping) );
break;
@@ -207,7 +219,7 @@ byte GfxScreen::getDrawingMask(byte color, byte prio, byte control) {
}
void GfxScreen::putPixel(int x, int y, byte drawMask, byte color, byte priority, byte control) {
- int offset = y * _width + x;
+ int offset = y * _pitch + x;
if (drawMask & GFX_SCREEN_MASK_VISUAL) {
_visualScreen[offset] = color;
@@ -240,7 +252,7 @@ void GfxScreen::putFontPixel(int startingY, int x, int y, byte color) {
// Do not scale ourselves, but put it on the display directly
putPixelOnDisplay(x, y + startingY, color);
} else {
- int offset = (startingY + y) * _width + x;
+ int offset = (startingY + y) * _pitch + x;
_visualScreen[offset] = color;
if (!_upscaledHires) {
@@ -342,19 +354,19 @@ void GfxScreen::putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, u
}
byte GfxScreen::getVisual(int x, int y) {
- return _visualScreen[y * _width + x];
+ return _visualScreen[y * _pitch + x];
}
byte GfxScreen::getPriority(int x, int y) {
- return _priorityScreen[y * _width + x];
+ return _priorityScreen[y * _pitch + x];
}
byte GfxScreen::getControl(int x, int y) {
- return _controlScreen[y * _width + x];
+ return _controlScreen[y * _pitch + x];
}
byte GfxScreen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color, byte t_pri, byte t_con, bool isEGA) {
- int offset = y * _width + x;
+ int offset = y * _pitch + x;
byte match = 0;
if (screenMask & GFX_SCREEN_MASK_VISUAL) {
@@ -415,14 +427,14 @@ void GfxScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) {
memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask);
if (mask & GFX_SCREEN_MASK_VISUAL) {
- bitsSaveScreen(rect, _visualScreen, _width, memoryPtr);
+ bitsSaveScreen(rect, _visualScreen, _pitch, memoryPtr);
bitsSaveDisplayScreen(rect, memoryPtr);
}
if (mask & GFX_SCREEN_MASK_PRIORITY) {
- bitsSaveScreen(rect, _priorityScreen, _width, memoryPtr);
+ bitsSaveScreen(rect, _priorityScreen, _pitch, memoryPtr);
}
if (mask & GFX_SCREEN_MASK_CONTROL) {
- bitsSaveScreen(rect, _controlScreen, _width, memoryPtr);
+ bitsSaveScreen(rect, _controlScreen, _pitch, memoryPtr);
}
if (mask & GFX_SCREEN_MASK_DISPLAY) {
if (!_upscaledHires)
@@ -475,14 +487,14 @@ void GfxScreen::bitsRestore(byte *memoryPtr) {
memcpy((void *)&mask, memoryPtr, sizeof(mask)); memoryPtr += sizeof(mask);
if (mask & GFX_SCREEN_MASK_VISUAL) {
- bitsRestoreScreen(rect, memoryPtr, _visualScreen, _width);
+ bitsRestoreScreen(rect, memoryPtr, _visualScreen, _pitch);
bitsRestoreDisplayScreen(rect, memoryPtr);
}
if (mask & GFX_SCREEN_MASK_PRIORITY) {
- bitsRestoreScreen(rect, memoryPtr, _priorityScreen, _width);
+ bitsRestoreScreen(rect, memoryPtr, _priorityScreen, _pitch);
}
if (mask & GFX_SCREEN_MASK_CONTROL) {
- bitsRestoreScreen(rect, memoryPtr, _controlScreen, _width);
+ bitsRestoreScreen(rect, memoryPtr, _controlScreen, _pitch);
}
if (mask & GFX_SCREEN_MASK_DISPLAY) {
if (!_upscaledHires)
@@ -560,7 +572,7 @@ void GfxScreen::dither(bool addToFlag) {
if (!_unditheringEnabled) {
// Do dithering on visual and display-screen
for (y = 0; y < _height; y++) {
- for (x = 0; x < _width; x++) {
+ for (x = 0; x < _pitch; x++) {
color = *visualPtr;
if (color & 0xF0) {
color ^= color << 4;
@@ -585,7 +597,7 @@ void GfxScreen::dither(bool addToFlag) {
memset(&_ditheredPicColors, 0, sizeof(_ditheredPicColors));
// Do dithering on visual screen and put decoded but undithered byte onto display-screen
for (y = 0; y < _height; y++) {
- for (x = 0; x < _width; x++) {
+ for (x = 0; x < _pitch; x++) {
color = *visualPtr;
if (color & 0xF0) {
color ^= color << 4;
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 73ea596ba1..01fb899edb 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -132,6 +132,7 @@ public:
private:
uint16 _width;
+ uint16 _pitch;
uint16 _height;
uint _pixels;
uint16 _displayWidth;
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 7894c7109c..f14ae2ef0b 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -49,9 +49,12 @@ GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts, GfxScreen *screen)
GfxText32::~GfxText32() {
}
+reg_t GfxText32::createScrollTextBitmap(Common::String text, reg_t textObject, uint16 maxWidth, uint16 maxHeight, reg_t prevHunk) {
+ return createTextBitmapInternal(text, textObject, maxWidth, maxHeight, prevHunk);
+
+}
reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxHeight, reg_t prevHunk) {
reg_t stringObject = readSelector(_segMan, textObject, SELECTOR(text));
-
// The object in the text selector of the item can be either a raw string
// or a Str object. In the latter case, we need to access the object's data
// selector to get the raw string.
@@ -59,6 +62,11 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH
stringObject = readSelector(_segMan, stringObject, SELECTOR(data));
Common::String text = _segMan->getString(stringObject);
+
+ return createTextBitmapInternal(text, textObject, maxWidth, maxHeight, prevHunk);
+}
+
+reg_t GfxText32::createTextBitmapInternal(Common::String &text, reg_t textObject, uint16 maxWidth, uint16 maxHeight, reg_t prevHunk) {
// HACK: The character offsets of the up and down arrow buttons are off by one
// in GK1, for some unknown reason. Fix them here.
if (text.size() == 1 && (text[0] == 29 || text[0] == 30)) {
@@ -91,7 +99,11 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH
reg_t memoryId = NULL_REG;
if (prevHunk.isNull()) {
memoryId = _segMan->allocateHunkEntry("TextBitmap()", entrySize);
- writeSelector(_segMan, textObject, SELECTOR(bitmap), memoryId);
+
+ // Scroll text objects have no bitmap selector!
+ ObjVarRef varp;
+ if (lookupSelector(_segMan, textObject, SELECTOR(bitmap), &varp, NULL) == kSelectorVariable)
+ writeSelector(_segMan, textObject, SELECTOR(bitmap), memoryId);
} else {
memoryId = prevHunk;
}
@@ -153,10 +165,24 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH
warning("Invalid alignment %d used in TextBox()", alignment);
}
+ byte curChar;
+
for (int i = 0; i < charCount; i++) {
- unsigned char curChar = txt[i];
- font->drawToBuffer(curChar, curY + offsetY, curX + offsetX, foreColor, dimmed, bitmap, width, height);
- curX += font->getCharWidth(curChar);
+ curChar = txt[i];
+
+ switch (curChar) {
+ case 0x0A:
+ case 0x0D:
+ case 0:
+ break;
+ case 0x7C:
+ warning("Code processing isn't implemented in SCI32");
+ break;
+ default:
+ font->drawToBuffer(curChar, curY + offsetY, curX + offsetX, foreColor, dimmed, bitmap, width, height);
+ curX += font->getCharWidth(curChar);
+ break;
+ }
}
curX = 0;
@@ -175,7 +201,25 @@ void GfxText32::disposeTextBitmap(reg_t hunkId) {
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));
+ drawTextBitmapInternal(x, y, planeRect, textObject, hunkId);
+}
+
+void GfxText32::drawScrollTextBitmap(reg_t textObject, reg_t hunkId, uint16 x, uint16 y) {
+ /*reg_t plane = readSelector(_segMan, textObject, SELECTOR(plane));
+ Common::Rect planeRect;
+ planeRect.top = readSelectorValue(_segMan, plane, SELECTOR(top));
+ planeRect.left = readSelectorValue(_segMan, plane, SELECTOR(left));
+ planeRect.bottom = readSelectorValue(_segMan, plane, SELECTOR(bottom));
+ planeRect.right = readSelectorValue(_segMan, plane, SELECTOR(right));
+
+ drawTextBitmapInternal(x, y, planeRect, textObject, hunkId);*/
+
+ // HACK: we pretty much ignore the plane rect and x, y...
+ drawTextBitmapInternal(0, 0, Common::Rect(20, 390, 600, 460), textObject, hunkId);
+}
+
+void GfxText32::drawTextBitmapInternal(int16 x, int16 y, Common::Rect planeRect, reg_t textObject, reg_t hunkId) {
+ int16 backColor = (int16)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())
@@ -187,13 +231,17 @@ void GfxText32::drawTextBitmap(int16 x, int16 y, Common::Rect planeRect, reg_t t
byte *memoryPtr = _segMan->getHunkPointer(hunkId);
- if (!memoryPtr)
- error("Attempt to draw an invalid text bitmap");
+ if (!memoryPtr) {
+ // Happens when restoring in some SCI32 games (e.g. SQ6).
+ // Commented out to reduce console spam
+ //warning("Attempt to draw an invalid text bitmap");
+ return;
+ }
byte *surface = memoryPtr + BITMAP_HEADER_SIZE;
int curByte = 0;
- uint16 skipColor = readSelectorValue(_segMan, textObject, SELECTOR(skip));
+ int16 skipColor = (int16)readSelectorValue(_segMan, textObject, SELECTOR(skip));
uint16 textX = planeRect.left + x;
uint16 textY = planeRect.top + y;
// Get totalWidth, totalHeight
@@ -206,10 +254,13 @@ void GfxText32::drawTextBitmap(int16 x, int16 y, Common::Rect planeRect, reg_t t
textY = textY * _screen->getDisplayHeight() / _screen->getHeight();
}
+ bool translucent = (skipColor == -1 && backColor == -1);
+
for (int curY = 0; curY < height; curY++) {
for (int curX = 0; curX < width; curX++) {
byte pixel = surface[curByte++];
- if (pixel != skipColor && pixel != backColor)
+ if ((!translucent && pixel != skipColor && pixel != backColor) ||
+ (translucent && pixel != 0xFF))
_screen->putFontPixel(textY, curX + textX, curY, pixel);
}
}
@@ -265,7 +316,7 @@ void GfxText32::StringWidth(const char *str, GuiResourceId fontId, int16 &textWi
}
void GfxText32::Width(const char *text, int16 from, int16 len, GuiResourceId fontId, int16 &textWidth, int16 &textHeight, bool restoreFont) {
- uint16 curChar;
+ byte curChar;
textWidth = 0; textHeight = 0;
GfxFont *font = _cache->getFont(fontId);
@@ -277,7 +328,6 @@ void GfxText32::Width(const char *text, int16 from, int16 len, GuiResourceId fon
switch (curChar) {
case 0x0A:
case 0x0D:
- case 0x9781: // this one is used by SQ4/japanese as line break as well
textHeight = MAX<int16> (textHeight, font->getHeight());
break;
case 0x7C:
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 3505de85eb..ce78003fdf 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -33,13 +33,17 @@ public:
GfxText32(SegManager *segMan, GfxCache *fonts, GfxScreen *screen);
~GfxText32();
reg_t createTextBitmap(reg_t textObject, uint16 maxWidth = 0, uint16 maxHeight = 0, reg_t prevHunk = NULL_REG);
- void disposeTextBitmap(reg_t hunkId);
+ reg_t createScrollTextBitmap(Common::String text, reg_t textObject, uint16 maxWidth = 0, uint16 maxHeight = 0, reg_t prevHunk = NULL_REG);
void drawTextBitmap(int16 x, int16 y, Common::Rect planeRect, reg_t textObject);
+ void drawScrollTextBitmap(reg_t textObject, reg_t hunkId, uint16 x, uint16 y);
+ void disposeTextBitmap(reg_t hunkId);
int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font);
void kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight);
private:
+ reg_t createTextBitmapInternal(Common::String &text, reg_t textObject, uint16 maxWidth, uint16 maxHeight, reg_t hunkId);
+ void drawTextBitmapInternal(int16 x, int16 y, Common::Rect planeRect, reg_t textObject, reg_t hunkId);
int16 Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth);
void Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight, bool restoreFont);
void StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight);
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index a77bcccc52..36aaae9232 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -720,6 +720,19 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left);
+ // WORKAROUND: EcoQuest French and German draw the fish and anemone sprites
+ // with priority 15 in scene 440. Afterwards, a dialog is shown on top of
+ // these sprites with priority 15 as well. This is undefined behavior
+ // actually, as the sprites and dialog share the same priority, so in our
+ // implementation the sprites get drawn incorrectly on top of the dialog.
+ // Perhaps this worked by mistake in SSCI because of subtle differences in
+ // how sprites are drawn. We compensate for this by resetting the priority
+ // of all sprites that have a priority of 15 in scene 440 to priority 14,
+ // so that the speech bubble can be drawn correctly on top of them. Fixes
+ // bug #3040625.
+ if (g_sci->getGameId() == GID_ECOQUEST && g_sci->getEngineState()->currentRoomNumber() == 440 && priority == 15)
+ priority = 14;
+
if (!_EGAmapping) {
for (y = 0; y < height; y++, bitmap += celWidth) {
for (x = 0; x < width; x++) {
@@ -728,8 +741,14 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
const int x2 = clipRectTranslated.left + x;
const int y2 = clipRectTranslated.top + y;
if (!upscaledHires) {
- if (priority >= _screen->getPriority(x2, y2))
- _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0);
+ if (priority >= _screen->getPriority(x2, y2)) {
+ if (!_palette->isRemapped(palette->mapping[color])) {
+ _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0);
+ } else {
+ byte remappedColor = _palette->remapColor(palette->mapping[color], _screen->getVisual(x2, y2));
+ _screen->putPixel(x2, y2, drawMask, remappedColor, priority, 0);
+ }
+ }
} else {
// UpscaledHires means view is hires and is supposed to
// get drawn onto lowres screen.
@@ -838,7 +857,12 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect,
const int x2 = clipRectTranslated.left + x;
const int y2 = clipRectTranslated.top + y;
if (color != clearKey && priority >= _screen->getPriority(x2, y2)) {
- _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0);
+ if (!_palette->isRemapped(palette->mapping[color])) {
+ _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0);
+ } else {
+ byte remappedColor = _palette->remapColor(palette->mapping[color], _screen->getVisual(x2, y2));
+ _screen->putPixel(x2, y2, drawMask, remappedColor, priority, 0);
+ }
}
}
}
diff --git a/engines/sci/module.mk b/engines/sci/module.mk
index 90a0f33f06..6b6058c819 100644
--- a/engines/sci/module.mk
+++ b/engines/sci/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS := \
sci.o \
util.o \
engine/features.o \
+ engine/file.o \
engine/gc.o \
engine/kernel.o \
engine/kevent.o \
@@ -79,6 +80,7 @@ MODULE_OBJS := \
ifdef ENABLE_SCI32
MODULE_OBJS += \
+ engine/kgraphics32.o \
graphics/controls32.o \
graphics/frameout.o \
graphics/paint32.o \
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 77a6a40a92..c9c0d25bc6 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -93,7 +93,7 @@ const char *getSciVersionDesc(SciVersion version) {
//#define SCI_VERBOSE_RESMAN 1
-static const char *const sci_error_types[] = {
+static const char *const s_errorDescriptions[] = {
"No error",
"I/O error",
"Resource is empty (size 0)",
@@ -101,10 +101,8 @@ static const char *const sci_error_types[] = {
"resource.map file not found",
"No resource files found",
"Unknown compression method",
- "Decompression failed: Decompression buffer overflow",
"Decompression failed: Sanity check failed",
- "Decompression failed: Resource too big",
- "SCI version is unsupported"
+ "Decompression failed: Resource too big"
};
static const char *const s_resourceTypeNames[] = {
@@ -576,7 +574,7 @@ void ResourceSource::loadResource(ResourceManager *resMan, Resource *res) {
if (error) {
warning("Error %d occurred while reading %s from resource file %s: %s",
error, res->_id.toString().c_str(), res->getResourceLocation().c_str(),
- sci_error_types[error]);
+ s_errorDescriptions[error]);
res->unalloc();
}
@@ -1876,6 +1874,9 @@ int Resource::readResourceInfo(ResVersion volVersion, Common::SeekableReadStream
uint32 wCompression, szUnpacked;
ResourceType type;
+ if (file->size() == 0)
+ return SCI_ERROR_EMPTY_RESOURCE;
+
switch (volVersion) {
case kResVersionSci0Sci1Early:
case kResVersionSci1Middle:
@@ -1920,7 +1921,7 @@ int Resource::readResourceInfo(ResVersion volVersion, Common::SeekableReadStream
break;
#endif
default:
- return SCI_ERROR_INVALID_RESMAP_ENTRY;
+ return SCI_ERROR_RESMAP_INVALID_ENTRY;
}
// check if there were errors while reading
@@ -1961,7 +1962,7 @@ int Resource::readResourceInfo(ResVersion volVersion, Common::SeekableReadStream
compression = kCompUnknown;
}
- return compression == kCompUnknown ? SCI_ERROR_UNKNOWN_COMPRESSION : 0;
+ return (compression == kCompUnknown) ? SCI_ERROR_UNKNOWN_COMPRESSION : SCI_ERROR_NONE;
}
int Resource::decompress(ResVersion volVersion, Common::SeekableReadStream *file) {
@@ -2589,7 +2590,7 @@ Common::String ResourceManager::findSierraGameId() {
if (!heap)
return "";
- int16 gameObjectOffset = findGameObject(false).offset;
+ int16 gameObjectOffset = findGameObject(false).getOffset();
if (!gameObjectOffset)
return "";
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 294a4672e2..4baf39c67f 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -54,17 +54,17 @@ enum ResourceStatus {
kResStatusLocked /**< Allocated and in use */
};
-/** Initialization result types */
-enum {
+/** Resource error codes. Should be in sync with s_errorDescriptions */
+enum ResourceErrorCodes {
+ SCI_ERROR_NONE = 0,
SCI_ERROR_IO_ERROR = 1,
- SCI_ERROR_INVALID_RESMAP_ENTRY = 2, /**< Invalid resource.map entry */
- SCI_ERROR_RESMAP_NOT_FOUND = 3,
- SCI_ERROR_NO_RESOURCE_FILES_FOUND = 4, /**< No resource at all was found */
- SCI_ERROR_UNKNOWN_COMPRESSION = 5,
- SCI_ERROR_DECOMPRESSION_ERROR = 6, /**< sanity checks failed during decompression */
+ SCI_ERROR_EMPTY_RESOURCE = 2,
+ SCI_ERROR_RESMAP_INVALID_ENTRY = 3, /**< Invalid resource.map entry */
+ SCI_ERROR_RESMAP_NOT_FOUND = 4,
+ SCI_ERROR_NO_RESOURCE_FILES_FOUND = 5, /**< No resource at all was found */
+ SCI_ERROR_UNKNOWN_COMPRESSION = 6,
+ SCI_ERROR_DECOMPRESSION_ERROR = 7, /**< sanity checks failed during decompression */
SCI_ERROR_RESOURCE_TOO_BIG = 8 /**< Resource size exceeds SCI_MAX_RESOURCE_SIZE */
-
- /* the first critical error number */
};
enum {
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 4ae55cbcba..15b18ce8e6 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -191,7 +191,7 @@ extern void showScummVMDialog(const Common::String &message);
Common::Error SciEngine::run() {
// Assign default values to the config manager, in case settings are missing
- ConfMan.registerDefault("sci_originalsaveload", "false");
+ ConfMan.registerDefault("originalsaveload", "false");
ConfMan.registerDefault("native_fb01", "false");
ConfMan.registerDefault("windows_cursors", "false"); // Windows cursors for KQ6 Windows
ConfMan.registerDefault("silver_cursors", "false"); // Silver cursors for SQ4 CD
@@ -385,7 +385,7 @@ bool SciEngine::gameHasFanMadePatch() {
{ GID_PQ3, 994, 4686, 1291, 0x78 }, // English
{ GID_PQ3, 994, 4734, 1283, 0x78 }, // German
{ GID_QFG1VGA, 994, 4388, 0, 0x00 },
- { GID_QFG3, 994, 4714, 0, 0x00 },
+ { GID_QFG3, 33, 260, 0, 0x00 },
// TODO: Disabled, as it fixes a whole lot of bugs which can't be tested till SCI2.1 support is finished
//{ GID_QFG4, 710, 11477, 0, 0x00 },
{ GID_SQ1, 994, 4740, 0, 0x00 },
@@ -453,8 +453,8 @@ static byte patchGameRestoreSaveSci21[] = {
};
static void patchGameSaveRestoreCode(SegManager *segMan, reg_t methodAddress, byte id) {
- Script *script = segMan->getScript(methodAddress.segment);
- byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.offset));
+ Script *script = segMan->getScript(methodAddress.getSegment());
+ byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.getOffset()));
if (getSciVersion() <= SCI_VERSION_1_1)
memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave));
else // SCI2+
@@ -463,8 +463,8 @@ static void patchGameSaveRestoreCode(SegManager *segMan, reg_t methodAddress, by
}
static void patchGameSaveRestoreCodeSci21(SegManager *segMan, reg_t methodAddress, byte id, bool doRestore) {
- Script *script = segMan->getScript(methodAddress.segment);
- byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.offset));
+ Script *script = segMan->getScript(methodAddress.getSegment());
+ byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.getOffset()));
memcpy(patchPtr, patchGameRestoreSaveSci21, sizeof(patchGameRestoreSaveSci21));
if (doRestore)
patchPtr[2] = 0x78; // push1
@@ -492,7 +492,7 @@ void SciEngine::patchGameSaveRestore() {
break;
}
- if (ConfMan.getBool("sci_originalsaveload"))
+ if (ConfMan.getBool("originalsaveload"))
return;
uint16 kernelNamesSize = _kernel->getKernelNamesSize();
@@ -632,7 +632,7 @@ void SciEngine::initGraphics() {
_gfxPaint = _gfxPaint32;
_gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache, _gfxScreen);
_gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxScreen, _gfxText32);
- _robotDecoder = new RobotDecoder(g_system->getMixer(), getPlatform() == Common::kPlatformMacintosh);
+ _robotDecoder = new RobotDecoder(getPlatform() == Common::kPlatformMacintosh);
_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette, _gfxPaint32);
} else {
#endif
@@ -740,7 +740,7 @@ GUI::Debugger *SciEngine::getDebugger() {
if (_gamestate) {
ExecStack *xs = &(_gamestate->_executionStack.back());
if (xs) {
- xs->addr.pc.offset = _debugState.old_pc_offset;
+ xs->addr.pc.setOffset(_debugState.old_pc_offset);
xs->sp = _debugState.old_sp;
}
}
@@ -876,6 +876,7 @@ void SciEngine::syncIngameAudioOptions() {
if (getGameId() == GID_SQ4
|| getGameId() == GID_FREDDYPHARKAS
|| getGameId() == GID_ECOQUEST
+ || getGameId() == GID_LSL6
// TODO: The following need script patches for simultaneous speech and subtitles
//|| getGameId() == GID_KQ6
//|| getGameId() == GID_LAURABOW2
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 9f18219cb7..3441e26c01 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -228,6 +228,26 @@ public:
bool canLoadGameStateCurrently();
bool canSaveGameStateCurrently();
void syncSoundSettings();
+
+ /**
+ * Syncs the audio options of the ScummVM launcher (speech, subtitles or
+ * both) with the in-game audio options of certain CD game versions. For
+ * some games, this allows simultaneous playing of speech and subtitles,
+ * even if the original games didn't support this feature.
+ *
+ * SCI1.1 games which support simultaneous speech and subtitles:
+ * - EcoQuest 1 CD
+ * - Leisure Suit Larry 6 CD
+ * SCI1.1 games which don't support simultaneous speech and subtitles,
+ * and we add this functionality in ScummVM:
+ * - Space Quest 4 CD
+ * - Freddy Pharkas CD
+ * SCI1.1 games which don't support simultaneous speech and subtitles,
+ * and we haven't added any extra functionality in ScummVM because extra
+ * script patches are needed:
+ * - Laura Bow 2 CD
+ * - King's Quest 6 CD
+ */
void syncIngameAudioOptions();
const SciGameId &getGameId() const { return _gameId; }
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 123dd21894..528bb51393 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -67,7 +67,8 @@ int AudioPlayer::startAudio(uint16 module, uint32 number) {
if (audioStream) {
_wPlayFlag = false;
- _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream);
+ Audio::Mixer::SoundType soundType = (module == 65535) ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType;
+ _mixer->playStream(soundType, &_audioHandle, audioStream);
return sampleLen;
} else {
// Don't throw a warning in this case. getAudioStream() already has. Some games
diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp
index db9317e071..191e13db0a 100644
--- a/engines/sci/sound/drivers/adlib.cpp
+++ b/engines/sci/sound/drivers/adlib.cpp
@@ -807,6 +807,9 @@ int MidiPlayer_AdLib::open(ResourceManager *resMan) {
int size = f.size();
const uint patchSize = 1344;
+ // Note: Funseeker's Guide also has another version of adl.drv, 8803 bytes.
+ // This isn't supported, but it's not really used anywhere, as that demo
+ // doesn't have sound anyway.
if ((size == 5684) || (size == 5720) || (size == 5727)) {
byte *buf = new byte[patchSize];
diff --git a/engines/sci/sound/drivers/fmtowns.cpp b/engines/sci/sound/drivers/fmtowns.cpp
index 6d8bb2e525..21cb2f1e43 100644
--- a/engines/sci/sound/drivers/fmtowns.cpp
+++ b/engines/sci/sound/drivers/fmtowns.cpp
@@ -52,8 +52,8 @@ public:
uint16 _duration;
private:
- uint8 _id;
- uint8 _velo;
+ uint8 _id;
+ uint8 _velo;
uint8 _program;
MidiDriver_FMTowns *_drv;
@@ -76,7 +76,7 @@ public:
void addChannels(int num);
void dropChannels(int num);
-
+
uint8 currentProgram() const;
private:
@@ -132,7 +132,7 @@ private:
TownsMidiPart **_parts;
TownsChannel **_out;
-
+
uint8 _masterVolume;
bool _soundOn;
@@ -590,7 +590,7 @@ void MidiDriver_FMTowns::addMissingChannels() {
avlChan -= _parts[i]->_chanMissing;
uint8 m = _parts[i]->_chanMissing;
_parts[i]->_chanMissing = 0;
- _parts[i]->addChannels(m);
+ _parts[i]->addChannels(m);
} else {
_parts[i]->_chanMissing -= avlChan;
_parts[i]->addChannels(avlChan);
@@ -601,7 +601,7 @@ void MidiDriver_FMTowns::addMissingChannels() {
void MidiDriver_FMTowns::updateParser() {
if (_timerProc)
- _timerProc(_timerProcPara);
+ _timerProc(_timerProcPara);
}
void MidiDriver_FMTowns::updateChannels() {
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 93a2308410..37eb37b292 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -563,7 +563,7 @@ void MidiPlayer_Midi::readMt32GmPatch(const byte *data, int size) {
switch (command & 0xf0) {
case 0xf0: {
- byte *sysExEnd = (byte *)memchr(midi + i, 0xf7, midiSize - i);
+ const byte *sysExEnd = (const byte *)memchr(midi + i, 0xf7, midiSize - i);
if (!sysExEnd)
error("Failed to find end of sysEx");
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index 422948f975..4e54797960 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -98,7 +98,7 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in
midiMixChannels();
}
- _num_tracks = 1;
+ _numTracks = 1;
_tracks[0] = _mixedData;
if (_pSnd)
setTrack(0);
@@ -144,7 +144,7 @@ byte *MidiParser_SCI::midiMixChannels() {
_mixedData = outData;
long ticker = 0;
byte channelNr, curDelta;
- byte midiCommand = 0, midiParam, global_prev = 0;
+ byte midiCommand = 0, midiParam, globalPrev = 0;
long newDelta;
SoundResource::Channel *channel;
@@ -190,13 +190,13 @@ byte *MidiParser_SCI::midiMixChannels() {
byte midiChannel = midiCommand & 0xF;
_channelUsed[midiChannel] = true;
- if (midiCommand != global_prev)
+ if (midiCommand != globalPrev)
*outData++ = midiCommand;
*outData++ = midiParam;
if (nMidiParams[(midiCommand >> 4) - 8] == 2)
*outData++ = channel->data[channel->curPos++];
channel->prev = midiCommand;
- global_prev = midiCommand;
+ globalPrev = midiCommand;
}
}
@@ -372,8 +372,8 @@ void MidiParser_SCI::unloadMusic() {
resetTracking();
allNotesOff();
}
- _num_tracks = 0;
- _active_track = 255;
+ _numTracks = 0;
+ _activeTrack = 255;
_resetOnPause = false;
if (_mixedData) {
@@ -454,26 +454,26 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
debugC(4, kDebugLevelSound, "signal %04x", _signalToSet);
}
- info.start = _position._play_pos;
+ info.start = _position._playPos;
info.delta = 0;
- while (*_position._play_pos == 0xF8) {
+ while (*_position._playPos == 0xF8) {
info.delta += 240;
- _position._play_pos++;
+ _position._playPos++;
}
- info.delta += *(_position._play_pos++);
+ info.delta += *(_position._playPos++);
// Process the next info.
- if ((_position._play_pos[0] & 0xF0) >= 0x80)
- info.event = *(_position._play_pos++);
+ if ((_position._playPos[0] & 0xF0) >= 0x80)
+ info.event = *(_position._playPos++);
else
- info.event = _position._running_status;
+ info.event = _position._runningStatus;
if (info.event < 0x80)
return;
- _position._running_status = info.event;
+ _position._runningStatus = info.event;
switch (info.command()) {
case 0xC:
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
if (info.channel() == 0xF) {// SCI special case
if (info.basic.param1 != kSetSignalLoop) {
@@ -488,23 +488,23 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
// in glitches (e.g. the intro of LB1 Amiga gets stuck - bug
// #3297883). Refer to MusicEntry::setSignal() in sound/music.cpp.
if (_soundVersion <= SCI_VERSION_0_LATE ||
- _position._play_tick || info.delta) {
+ _position._playTick || info.delta) {
_signalSet = true;
_signalToSet = info.basic.param1;
}
} else {
- _loopTick = _position._play_tick + info.delta;
+ _loopTick = _position._playTick + info.delta;
}
}
break;
case 0xD:
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
case 0xB:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
// Reference for some events:
// http://wiki.scummvm.org/index.php/SCI/Specifications/Sound/SCI0_Resource_Format#Status_Reference
@@ -588,8 +588,8 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
case 0x9:
case 0xA:
case 0xE:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
if (info.command() == 0x9 && info.basic.param2 == 0)
info.event = info.channel() | 0x80;
info.length = 0;
@@ -598,12 +598,12 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
case 0xF: // System Common, Meta or SysEx event
switch (info.event & 0x0F) {
case 0x2: // Song Position Pointer
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
break;
case 0x3: // Song Select
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
@@ -617,16 +617,16 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
break;
case 0x0: // SysEx
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
break;
case 0xF: // META event
- info.ext.type = *(_position._play_pos++);
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.ext.type = *(_position._playPos++);
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
if (info.ext.type == 0x2F) {// end of track reached
if (_pSnd->loop)
_pSnd->loop--;
@@ -677,21 +677,21 @@ void MidiParser_SCI::allNotesOff() {
// Turn off all active notes
for (i = 0; i < 128; ++i) {
for (j = 0; j < 16; ++j) {
- if ((_active_notes[i] & (1 << j)) && (_channelRemap[j] != -1)){
+ if ((_activeNotes[i] & (1 << j)) && (_channelRemap[j] != -1)){
sendToDriver(0x80 | j, i, 0);
}
}
}
// Turn off all hanging notes
- for (i = 0; i < ARRAYSIZE(_hanging_notes); i++) {
- byte midiChannel = _hanging_notes[i].channel;
- if ((_hanging_notes[i].time_left) && (_channelRemap[midiChannel] != -1)) {
- sendToDriver(0x80 | midiChannel, _hanging_notes[i].note, 0);
- _hanging_notes[i].time_left = 0;
+ for (i = 0; i < ARRAYSIZE(_hangingNotes); i++) {
+ byte midiChannel = _hangingNotes[i].channel;
+ if ((_hangingNotes[i].timeLeft) && (_channelRemap[midiChannel] != -1)) {
+ sendToDriver(0x80 | midiChannel, _hangingNotes[i].note, 0);
+ _hangingNotes[i].timeLeft = 0;
}
}
- _hanging_notes_count = 0;
+ _hangingNotesCount = 0;
// To be sure, send an "All Note Off" event (but not all MIDI devices
// support this...).
@@ -703,7 +703,7 @@ void MidiParser_SCI::allNotesOff() {
}
}
- memset(_active_notes, 0, sizeof(_active_notes));
+ memset(_activeNotes, 0, sizeof(_activeNotes));
}
void MidiParser_SCI::setMasterVolume(byte masterVolume) {
diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h
index 82f34070a4..d3fd337644 100644
--- a/engines/sci/sound/midiparser_sci.h
+++ b/engines/sci/sound/midiparser_sci.h
@@ -65,7 +65,7 @@ public:
void setMasterVolume(byte masterVolume);
void setVolume(byte volume);
void stop() {
- _abort_parse = true;
+ _abortParse = true;
allNotesOff();
}
void pause() {
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 09cab75c39..a8a65d2aa4 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -88,6 +88,12 @@ void SciMusic::init() {
uint32 dev = MidiDriver::detectDevice(deviceFlags);
_musicType = MidiDriver::getMusicType(dev);
+ if (g_sci->_features->useAltWinGMSound() && _musicType != MT_GM) {
+ warning("A Windows CD version with an alternate MIDI soundtrack has been chosen, "
+ "but no MIDI music device has been selected. Reverting to the DOS soundtrack");
+ g_sci->_features->forceDOSTracks();
+ }
+
switch (_musicType) {
case MT_ADLIB:
// FIXME: There's no Amiga sound option, so we hook it up to AdLib
@@ -119,7 +125,13 @@ void SciMusic::init() {
_pMidiDrv->setTimerCallback(this, &miditimerCallback);
_dwTempo = _pMidiDrv->getBaseTempo();
} else {
- error("Failed to initialize sound driver");
+ if (g_sci->getGameId() == GID_FUNSEEKER) {
+ // HACK: The Fun Seeker's Guide demo doesn't have patch 3 and the version
+ // of the Adlib driver (adl.drv) that it includes is unsupported. That demo
+ // doesn't have any sound anyway, so this shouldn't be fatal.
+ } else {
+ error("Failed to initialize sound driver");
+ }
}
// Find out what the first possible channel is (used, when doing channel
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index b8be898abc..5d32f40f18 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -32,14 +32,11 @@
namespace Sci {
-//#define ENABLE_SFX_TYPE_SELECTION
-
SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, AudioPlayer *audio, SciVersion soundVersion) :
_resMan(resMan), _segMan(segMan), _kernel(kernel), _audio(audio), _soundVersion(soundVersion) {
-#ifdef ENABLE_SFX_TYPE_SELECTION
// Check if the user wants synthesized or digital sound effects in SCI1.1
- // games based on the multi_midi config setting
+ // games based on the prefer_digitalsfx config setting
// In SCI2 and later games, this check should always be true - there was
// always only one version of each sound effect or digital music track
@@ -47,12 +44,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
// resource number, but it's totally unrelated to the menu music).
// The GK1 demo (very late SCI1.1) does the same thing
// TODO: Check the QFG4 demo
-
- _useDigitalSFX = (getSciVersion() >= SCI_VERSION_2 || g_sci->getGameId() == GID_GK1 || ConfMan.getBool("multi_midi"));
-#else
- // Always prefer digital sound effects
- _useDigitalSFX = true;
-#endif
+ _useDigitalSFX = (getSciVersion() >= SCI_VERSION_2 || g_sci->getGameId() == GID_GK1 || ConfMan.getBool("prefer_digitalsfx"));
_music = new SciMusic(_soundVersion, _useDigitalSFX);
_music->init();
@@ -69,7 +61,7 @@ reg_t SoundCommandParser::kDoSoundInit(int argc, reg_t *argv, reg_t acc) {
}
int SoundCommandParser::getSoundResourceId(reg_t obj) {
- int resourceId = obj.segment ? readSelectorValue(_segMan, obj, SELECTOR(number)) : -1;
+ int resourceId = obj.getSegment() ? readSelectorValue(_segMan, obj, SELECTOR(number)) : -1;
// Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did.
if (g_sci && g_sci->_features->useAltWinGMSound()) {
// Check if the alternate MIDI song actually exists...
@@ -104,7 +96,7 @@ void SoundCommandParser::initSoundResource(MusicEntry *newSound) {
if (_useDigitalSFX || !newSound->soundRes) {
int sampleLen;
newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen);
- newSound->soundType = Audio::Mixer::kSpeechSoundType;
+ newSound->soundType = Audio::Mixer::kSFXSoundType;
}
}
@@ -299,7 +291,7 @@ reg_t SoundCommandParser::kDoSoundPause(int argc, reg_t *argv, reg_t acc) {
reg_t obj = argv[0];
uint16 value = argc > 1 ? argv[1].toUint16() : 0;
- if (!obj.segment) { // pause the whole playlist
+ if (!obj.getSegment()) { // pause the whole playlist
_music->pauseAll(value);
} else { // pause a playlist slot
MusicEntry *musicSlot = _music->getSlot(obj);
@@ -375,24 +367,36 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
case 4: // SCI01+
case 5: // SCI1+ (SCI1 late sound scheme), with fade and continue
- musicSlot->fadeTo = CLIP<uint16>(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX);
- // sometimes we get objects in that position, fix it up (ffs. workarounds)
- if (!argv[1].segment)
- musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16();
- else
- musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5;
- musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo();
- musicSlot->fadeTicker = 0;
-
if (argc == 5) {
// TODO: We currently treat this argument as a boolean, but may
// have to handle different non-zero values differently. (e.g.,
- // some KQ6 scripts pass 3 here)
- musicSlot->stopAfterFading = (argv[4].toUint16() != 0);
+ // some KQ6 scripts pass 3 here).
+ // There is a script bug in KQ6, room 460 (the room with the flying
+ // books). An object is passed here, which should not be treated as
+ // a true flag. Fixes bugs #3555404 and #3291115.
+ musicSlot->stopAfterFading = (argv[4].isNumber() && argv[4].toUint16() != 0);
} else {
musicSlot->stopAfterFading = false;
}
+ musicSlot->fadeTo = CLIP<uint16>(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX);
+ // Check if the song is already at the requested volume. If it is, don't
+ // perform any fading. Happens for example during the intro of Longbow.
+ if (musicSlot->fadeTo != musicSlot->volume) {
+ // sometimes we get objects in that position, fix it up (ffs. workarounds)
+ if (!argv[1].getSegment())
+ musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16();
+ else
+ musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5;
+ musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo();
+ } else {
+ // Stop the music, if requested. Fixes bug #3555404.
+ if (musicSlot->stopAfterFading)
+ processStopSound(obj, false);
+ }
+
+ musicSlot->fadeTicker = 0;
+
// WORKAROUND/HACK: In the labyrinth in KQ6, when falling in the pit and
// lighting the lantern, the game scripts perform a fade in of the game
// music, but set it to stop after fading. Remove that flag here. This is
@@ -505,12 +509,7 @@ void SoundCommandParser::processUpdateCues(reg_t obj) {
// fireworks).
// It is also needed in other games, e.g. LSL6 when talking to the
// receptionist (bug #3192166).
- if (g_sci->getGameId() == GID_LONGBOW && g_sci->getEngineState()->currentRoomNumber() == 95) {
- // HACK: Don't set a signal here in the intro of Longbow, as that makes some dialog
- // boxes disappear too soon (bug #3044844).
- } else {
- writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
- }
+ writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
if (_soundVersion <= SCI_VERSION_0_LATE) {
processStopSound(obj, false);
} else {
diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp
index 77f45e0788..0337a8d306 100644
--- a/engines/sci/video/robot_decoder.cpp
+++ b/engines/sci/video/robot_decoder.cpp
@@ -22,11 +22,13 @@
#include "common/archive.h"
#include "common/stream.h"
+#include "common/substream.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "common/util.h"
#include "graphics/surface.h"
+#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include "sci/resource.h"
@@ -63,46 +65,26 @@ namespace Sci {
// our graphics engine, it looks just like a part of the room. A RBT can move
// around the screen and go behind other objects. (...)
-#ifdef ENABLE_SCI32
-
-enum robotPalTypes {
+enum RobotPalTypes {
kRobotPalVariable = 0,
kRobotPalConstant = 1
};
-RobotDecoder::RobotDecoder(Audio::Mixer *mixer, bool isBigEndian) {
- _surface = 0;
- _width = 0;
- _height = 0;
+RobotDecoder::RobotDecoder(bool isBigEndian) {
_fileStream = 0;
- _audioStream = 0;
- _dirtyPalette = false;
_pos = Common::Point(0, 0);
- _mixer = mixer;
_isBigEndian = isBigEndian;
+ _frameTotalSize = 0;
}
RobotDecoder::~RobotDecoder() {
close();
}
-bool RobotDecoder::load(GuiResourceId id) {
- Common::String fileName = Common::String::format("%d.rbt", id);
- Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(fileName);
-
- if (!stream) {
- warning("Unable to open robot file %s", fileName.c_str());
- return false;
- }
-
- return loadStream(stream);
-}
-
bool RobotDecoder::loadStream(Common::SeekableReadStream *stream) {
close();
_fileStream = new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), _isBigEndian, DisposeAfterUse::YES);
- _surface = new Graphics::Surface();
readHeaderChunk();
@@ -114,131 +96,60 @@ bool RobotDecoder::loadStream(Common::SeekableReadStream *stream) {
if (_header.version < 4 || _header.version > 6)
error("Unknown robot version: %d", _header.version);
- if (_header.hasSound) {
- _audioStream = Audio::makeQueuingAudioStream(11025, false);
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_audioHandle, _audioStream);
- }
+ RobotVideoTrack *videoTrack = new RobotVideoTrack(_header.frameCount);
+ addTrack(videoTrack);
- readPaletteChunk(_header.paletteDataSize);
- readFrameSizesChunk();
- calculateVideoDimensions();
- _surface->create(_width, _height, Graphics::PixelFormat::createFormatCLUT8());
+ if (_header.hasSound)
+ addTrack(new RobotAudioTrack());
+ videoTrack->readPaletteChunk(_fileStream, _header.paletteDataSize);
+ readFrameSizesChunk();
+ videoTrack->calculateVideoDimensions(_fileStream, _frameTotalSize);
return true;
}
-void RobotDecoder::readHeaderChunk() {
- // Header (60 bytes)
- _fileStream->skip(6);
- _header.version = _fileStream->readUint16();
- _header.audioChunkSize = _fileStream->readUint16();
- _header.audioSilenceSize = _fileStream->readUint16();
- _fileStream->skip(2);
- _header.frameCount = _fileStream->readUint16();
- _header.paletteDataSize = _fileStream->readUint16();
- _header.unkChunkDataSize = _fileStream->readUint16();
- _fileStream->skip(5);
- _header.hasSound = _fileStream->readByte();
- _fileStream->skip(34);
-
- // Some videos (e.g. robot 1305 in Phantasmagoria and
- // robot 184 in Lighthouse) have an unknown chunk before
- // the palette chunk (probably used for sound preloading).
- // Skip it here.
- if (_header.unkChunkDataSize)
- _fileStream->skip(_header.unkChunkDataSize);
-}
-
-void RobotDecoder::readPaletteChunk(uint16 chunkSize) {
- byte *paletteData = new byte[chunkSize];
- _fileStream->read(paletteData, chunkSize);
+bool RobotDecoder::load(GuiResourceId id) {
+ // TODO: RAMA's robot 1003 cannot be played (shown at the menu screen) -
+ // its drawn at odd coordinates. SV can't play it either (along with some
+ // others), so it must be some new functionality added in RAMA's robot
+ // videos. Skip it for now.
+ if (g_sci->getGameId() == GID_RAMA && id == 1003)
+ return false;
- // SCI1.1 palette
- byte palFormat = paletteData[32];
- uint16 palColorStart = paletteData[25];
- uint16 palColorCount = READ_SCI11ENDIAN_UINT16(paletteData + 29);
+ // TODO: The robot video in the Lighthouse demo gets stuck
+ if (g_sci->getGameId() == GID_LIGHTHOUSE && id == 16)
+ return false;
- int palOffset = 37;
- memset(_palette, 0, 256 * 3);
+ Common::String fileName = Common::String::format("%d.rbt", id);
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(fileName);
- for (uint16 colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) {
- if (palFormat == kRobotPalVariable)
- palOffset++;
- _palette[colorNo * 3 + 0] = paletteData[palOffset++];
- _palette[colorNo * 3 + 1] = paletteData[palOffset++];
- _palette[colorNo * 3 + 2] = paletteData[palOffset++];
+ if (!stream) {
+ warning("Unable to open robot file %s", fileName.c_str());
+ return false;
}
- _dirtyPalette = true;
- delete[] paletteData;
+ return loadStream(stream);
}
+void RobotDecoder::close() {
+ VideoDecoder::close();
-void RobotDecoder::readFrameSizesChunk() {
- // The robot video file contains 2 tables, with one entry for each frame:
- // - A table containing the size of the image in each video frame
- // - A table containing the total size of each video frame.
- // In v5 robots, the tables contain 16-bit integers, whereas in v6 robots,
- // they contain 32-bit integers.
-
- _frameTotalSize = new uint32[_header.frameCount];
-
- // TODO: The table reading code can probably be removed once the
- // audio chunk size is figured out (check the TODO inside processNextFrame())
-#if 0
- // We don't need any of the two tables to play the video, so we ignore
- // both of them.
- uint16 wordSize = _header.version == 6 ? 4 : 2;
- _fileStream->skip(_header.frameCount * wordSize * 2);
-#else
- switch (_header.version) {
- case 4:
- case 5: // sizes are 16-bit integers
- // Skip table with frame image sizes, as we don't need it
- _fileStream->skip(_header.frameCount * 2);
- for (int i = 0; i < _header.frameCount; ++i)
- _frameTotalSize[i] = _fileStream->readUint16();
- break;
- case 6: // sizes are 32-bit integers
- // Skip table with frame image sizes, as we don't need it
- _fileStream->skip(_header.frameCount * 4);
- for (int i = 0; i < _header.frameCount; ++i)
- _frameTotalSize[i] = _fileStream->readUint32();
- break;
- default:
- error("Can't yet handle index table for robot version %d", _header.version);
- }
-#endif
-
- // 2 more unknown tables
- _fileStream->skip(1024 + 512);
+ delete _fileStream;
+ _fileStream = 0;
- // Pad to nearest 2 kilobytes
- uint32 curPos = _fileStream->pos();
- if (curPos & 0x7ff)
- _fileStream->seek((curPos & ~0x7ff) + 2048);
+ delete[] _frameTotalSize;
+ _frameTotalSize = 0;
}
-void RobotDecoder::calculateVideoDimensions() {
- // This is an O(n) operation, as each frame has a different size.
- // We need to know the actual frame size to have a constant video size.
- uint32 pos = _fileStream->pos();
-
- for (uint32 curFrame = 0; curFrame < _header.frameCount; curFrame++) {
- _fileStream->skip(4);
- uint16 frameWidth = _fileStream->readUint16();
- uint16 frameHeight = _fileStream->readUint16();
- if (frameWidth > _width)
- _width = frameWidth;
- if (frameHeight > _height)
- _height = frameHeight;
- _fileStream->skip(_frameTotalSize[curFrame] - 8);
- }
+void RobotDecoder::readNextPacket() {
+ // Get our track
+ RobotVideoTrack *videoTrack = (RobotVideoTrack *)getTrack(0);
+ videoTrack->increaseCurFrame();
+ Graphics::Surface *surface = videoTrack->getSurface();
- _fileStream->seek(pos);
-}
+ if (videoTrack->endOfTrack())
+ return;
-const Graphics::Surface *RobotDecoder::decodeNextFrame() {
// Read frame image header (24 bytes)
_fileStream->skip(3);
byte frameScale = _fileStream->readByte();
@@ -247,23 +158,28 @@ const Graphics::Surface *RobotDecoder::decodeNextFrame() {
_fileStream->skip(4); // unknown, almost always 0
uint16 frameX = _fileStream->readUint16();
uint16 frameY = _fileStream->readUint16();
+
// TODO: In v4 robot files, frameX and frameY have a different meaning.
// Set them both to 0 for v4 for now, so that robots in PQ:SWAT show up
// correctly.
if (_header.version == 4)
frameX = frameY = 0;
+
uint16 compressedSize = _fileStream->readUint16();
uint16 frameFragments = _fileStream->readUint16();
_fileStream->skip(4); // unknown
uint32 decompressedSize = frameWidth * frameHeight * frameScale / 100;
+
// FIXME: A frame's height + position can go off limits... why? With the
// following, we cut the contents to fit the frame
- uint16 scaledHeight = CLIP<uint16>(decompressedSize / frameWidth, 0, _height - frameY);
+ uint16 scaledHeight = CLIP<uint16>(decompressedSize / frameWidth, 0, surface->h - frameY);
+
// FIXME: Same goes for the frame's width + position. In this case, we
// modify the position to fit the contents on screen.
- if (frameWidth + frameX > _width)
- frameX = _width - frameWidth;
- assert (frameWidth + frameX <= _width && scaledHeight + frameY <= _height);
+ if (frameWidth + frameX > surface->w)
+ frameX = surface->w - frameWidth;
+
+ assert(frameWidth + frameX <= surface->w && scaledHeight + frameY <= surface->h);
DecompressorLZS lzs;
byte *decompressedFrame = new byte[decompressedSize];
@@ -294,24 +210,23 @@ const Graphics::Surface *RobotDecoder::decodeNextFrame() {
// Copy over the decompressed frame
byte *inFrame = decompressedFrame;
- byte *outFrame = (byte *)_surface->pixels;
+ byte *outFrame = (byte *)surface->pixels;
// Black out the surface
- memset(outFrame, 0, _width * _height);
+ memset(outFrame, 0, surface->w * surface->h);
// Move to the correct y coordinate
- outFrame += _width * frameY;
+ outFrame += surface->w * frameY;
for (uint16 y = 0; y < scaledHeight; y++) {
memcpy(outFrame + frameX, inFrame, frameWidth);
inFrame += frameWidth;
- outFrame += _width;
+ outFrame += surface->w;
}
delete[] decompressedFrame;
- // +1 because we start with frame number -1
- uint32 audioChunkSize = _frameTotalSize[_curFrame + 1] - (24 + compressedSize);
+ uint32 audioChunkSize = _frameTotalSize[videoTrack->getCurFrame()] - (24 + compressedSize);
// TODO: The audio chunk size below is usually correct, but there are some
// exceptions (e.g. robot 4902 in Phantasmagoria, towards its end)
@@ -326,41 +241,166 @@ const Graphics::Surface *RobotDecoder::decodeNextFrame() {
// Queue the next audio frame
// FIXME: For some reason, there are audio hiccups/gaps
if (_header.hasSound) {
- _fileStream->skip(8); // header
- _audioStream->queueBuffer(g_sci->_audio->getDecodedRobotAudioFrame(_fileStream, audioChunkSize - 8),
- (audioChunkSize - 8) * 2, DisposeAfterUse::NO,
- Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN);
+ RobotAudioTrack *audioTrack = (RobotAudioTrack *)getTrack(1);
+ _fileStream->skip(8); // header
+ audioChunkSize -= 8;
+ audioTrack->queueBuffer(g_sci->_audio->getDecodedRobotAudioFrame(_fileStream, audioChunkSize), audioChunkSize * 2);
} else {
_fileStream->skip(audioChunkSize);
}
+}
- if (_curFrame == -1)
- _startTime = g_system->getMillis();
-
- _curFrame++;
+void RobotDecoder::readHeaderChunk() {
+ // Header (60 bytes)
+ _fileStream->skip(6);
+ _header.version = _fileStream->readUint16();
+ _header.audioChunkSize = _fileStream->readUint16();
+ _header.audioSilenceSize = _fileStream->readUint16();
+ _fileStream->skip(2);
+ _header.frameCount = _fileStream->readUint16();
+ _header.paletteDataSize = _fileStream->readUint16();
+ _header.unkChunkDataSize = _fileStream->readUint16();
+ _fileStream->skip(5);
+ _header.hasSound = _fileStream->readByte();
+ _fileStream->skip(34);
- return _surface;
+ // Some videos (e.g. robot 1305 in Phantasmagoria and
+ // robot 184 in Lighthouse) have an unknown chunk before
+ // the palette chunk (probably used for sound preloading).
+ // Skip it here.
+ if (_header.unkChunkDataSize)
+ _fileStream->skip(_header.unkChunkDataSize);
}
-void RobotDecoder::close() {
- if (!_fileStream)
- return;
+void RobotDecoder::readFrameSizesChunk() {
+ // The robot video file contains 2 tables, with one entry for each frame:
+ // - A table containing the size of the image in each video frame
+ // - A table containing the total size of each video frame.
+ // In v5 robots, the tables contain 16-bit integers, whereas in v6 robots,
+ // they contain 32-bit integers.
- delete _fileStream;
- _fileStream = 0;
+ _frameTotalSize = new uint32[_header.frameCount];
+
+ // TODO: The table reading code can probably be removed once the
+ // audio chunk size is figured out (check the TODO inside processNextFrame())
+#if 0
+ // We don't need any of the two tables to play the video, so we ignore
+ // both of them.
+ uint16 wordSize = _header.version == 6 ? 4 : 2;
+ _fileStream->skip(_header.frameCount * wordSize * 2);
+#else
+ switch (_header.version) {
+ case 4:
+ case 5: // sizes are 16-bit integers
+ // Skip table with frame image sizes, as we don't need it
+ _fileStream->skip(_header.frameCount * 2);
+ for (int i = 0; i < _header.frameCount; ++i)
+ _frameTotalSize[i] = _fileStream->readUint16();
+ break;
+ case 6: // sizes are 32-bit integers
+ // Skip table with frame image sizes, as we don't need it
+ _fileStream->skip(_header.frameCount * 4);
+ for (int i = 0; i < _header.frameCount; ++i)
+ _frameTotalSize[i] = _fileStream->readUint32();
+ break;
+ default:
+ error("Can't yet handle index table for robot version %d", _header.version);
+ }
+#endif
+ // 2 more unknown tables
+ _fileStream->skip(1024 + 512);
+
+ // Pad to nearest 2 kilobytes
+ uint32 curPos = _fileStream->pos();
+ if (curPos & 0x7ff)
+ _fileStream->seek((curPos & ~0x7ff) + 2048);
+}
+
+RobotDecoder::RobotVideoTrack::RobotVideoTrack(int frameCount) : _frameCount(frameCount) {
+ _surface = new Graphics::Surface();
+ _curFrame = -1;
+ _dirtyPalette = false;
+}
+
+RobotDecoder::RobotVideoTrack::~RobotVideoTrack() {
_surface->free();
delete _surface;
- _surface = 0;
+}
- if (_header.hasSound) {
- _mixer->stopHandle(_audioHandle);
- //delete _audioStream; _audioStream = 0;
+uint16 RobotDecoder::RobotVideoTrack::getWidth() const {
+ return _surface->w;
+}
+
+uint16 RobotDecoder::RobotVideoTrack::getHeight() const {
+ return _surface->h;
+}
+
+Graphics::PixelFormat RobotDecoder::RobotVideoTrack::getPixelFormat() const {
+ return _surface->format;
+}
+
+void RobotDecoder::RobotVideoTrack::readPaletteChunk(Common::SeekableSubReadStreamEndian *stream, uint16 chunkSize) {
+ byte *paletteData = new byte[chunkSize];
+ stream->read(paletteData, chunkSize);
+
+ // SCI1.1 palette
+ byte palFormat = paletteData[32];
+ uint16 palColorStart = paletteData[25];
+ uint16 palColorCount = READ_SCI11ENDIAN_UINT16(paletteData + 29);
+
+ int palOffset = 37;
+ memset(_palette, 0, 256 * 3);
+
+ for (uint16 colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) {
+ if (palFormat == kRobotPalVariable)
+ palOffset++;
+ _palette[colorNo * 3 + 0] = paletteData[palOffset++];
+ _palette[colorNo * 3 + 1] = paletteData[palOffset++];
+ _palette[colorNo * 3 + 2] = paletteData[palOffset++];
}
- reset();
+ _dirtyPalette = true;
+ delete[] paletteData;
}
-#endif
+void RobotDecoder::RobotVideoTrack::calculateVideoDimensions(Common::SeekableSubReadStreamEndian *stream, uint32 *frameSizes) {
+ // This is an O(n) operation, as each frame has a different size.
+ // We need to know the actual frame size to have a constant video size.
+ uint32 pos = stream->pos();
+
+ uint16 width = 0, height = 0;
+
+ for (int curFrame = 0; curFrame < _frameCount; curFrame++) {
+ stream->skip(4);
+ uint16 frameWidth = stream->readUint16();
+ uint16 frameHeight = stream->readUint16();
+ if (frameWidth > width)
+ width = frameWidth;
+ if (frameHeight > height)
+ height = frameHeight;
+ stream->skip(frameSizes[curFrame] - 8);
+ }
+
+ stream->seek(pos);
+
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+}
+
+RobotDecoder::RobotAudioTrack::RobotAudioTrack() {
+ _audioStream = Audio::makeQueuingAudioStream(11025, false);
+}
+
+RobotDecoder::RobotAudioTrack::~RobotAudioTrack() {
+ delete _audioStream;
+}
+
+void RobotDecoder::RobotAudioTrack::queueBuffer(byte *buffer, int size) {
+ _audioStream->queueBuffer(buffer, size, DisposeAfterUse::YES, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN);
+}
+
+Audio::AudioStream *RobotDecoder::RobotAudioTrack::getAudioStream() const {
+ return _audioStream;
+}
} // End of namespace Sci
diff --git a/engines/sci/video/robot_decoder.h b/engines/sci/video/robot_decoder.h
index 3f93582418..437954f7fb 100644
--- a/engines/sci/video/robot_decoder.h
+++ b/engines/sci/video/robot_decoder.h
@@ -25,79 +25,103 @@
#include "common/rational.h"
#include "common/rect.h"
-#include "common/stream.h"
-#include "common/substream.h"
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "graphics/pixelformat.h"
#include "video/video_decoder.h"
-namespace Sci {
+namespace Audio {
+class QueuingAudioStream;
+}
-#ifdef ENABLE_SCI32
-
-struct RobotHeader {
- // 6 bytes, identifier bytes
- uint16 version;
- uint16 audioChunkSize;
- uint16 audioSilenceSize;
- // 2 bytes, unknown
- uint16 frameCount;
- uint16 paletteDataSize;
- uint16 unkChunkDataSize;
- // 5 bytes, unknown
- byte hasSound;
- // 34 bytes, unknown
-};
+namespace Common {
+class SeekableSubReadStreamEndian;
+}
-class RobotDecoder : public Video::FixedRateVideoDecoder {
+namespace Sci {
+
+class RobotDecoder : public Video::VideoDecoder {
public:
- RobotDecoder(Audio::Mixer *mixer, bool isBigEndian);
+ RobotDecoder(bool isBigEndian);
virtual ~RobotDecoder();
bool loadStream(Common::SeekableReadStream *stream);
bool load(GuiResourceId id);
void close();
- bool isVideoLoaded() const { return _fileStream != 0; }
- uint16 getWidth() const { return _width; }
- uint16 getHeight() const { return _height; }
- uint32 getFrameCount() const { return _header.frameCount; }
- const Graphics::Surface *decodeNextFrame();
- Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
- const byte *getPalette() { _dirtyPalette = false; return _palette; }
- bool hasDirtyPalette() const { return _dirtyPalette; }
void setPos(uint16 x, uint16 y) { _pos = Common::Point(x, y); }
Common::Point getPos() const { return _pos; }
protected:
- Common::Rational getFrameRate() const { return Common::Rational(60, 10); }
+ void readNextPacket();
private:
+ class RobotVideoTrack : public FixedRateVideoTrack {
+ public:
+ RobotVideoTrack(int frameCount);
+ ~RobotVideoTrack();
+
+ uint16 getWidth() const;
+ uint16 getHeight() const;
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ const Graphics::Surface *decodeNextFrame() { return _surface; }
+ const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ bool hasDirtyPalette() const { return _dirtyPalette; }
+
+ void readPaletteChunk(Common::SeekableSubReadStreamEndian *stream, uint16 chunkSize);
+ void calculateVideoDimensions(Common::SeekableSubReadStreamEndian *stream, uint32 *frameSizes);
+ Graphics::Surface *getSurface() { return _surface; }
+ void increaseCurFrame() { _curFrame++; }
+
+ protected:
+ Common::Rational getFrameRate() const { return Common::Rational(60, 10); }
+
+ private:
+ int _frameCount;
+ int _curFrame;
+ byte _palette[256 * 3];
+ mutable bool _dirtyPalette;
+ Graphics::Surface *_surface;
+ };
+
+ class RobotAudioTrack : public AudioTrack {
+ public:
+ RobotAudioTrack();
+ ~RobotAudioTrack();
+
+ Audio::Mixer::SoundType getSoundType() const { return Audio::Mixer::kMusicSoundType; }
+
+ void queueBuffer(byte *buffer, int size);
+
+ protected:
+ Audio::AudioStream *getAudioStream() const;
+
+ private:
+ Audio::QueuingAudioStream *_audioStream;
+ };
+
+ struct RobotHeader {
+ // 6 bytes, identifier bytes
+ uint16 version;
+ uint16 audioChunkSize;
+ uint16 audioSilenceSize;
+ // 2 bytes, unknown
+ uint16 frameCount;
+ uint16 paletteDataSize;
+ uint16 unkChunkDataSize;
+ // 5 bytes, unknown
+ byte hasSound;
+ // 34 bytes, unknown
+ } _header;
+
void readHeaderChunk();
- void readPaletteChunk(uint16 chunkSize);
void readFrameSizesChunk();
- void calculateVideoDimensions();
- void freeData();
-
- RobotHeader _header;
Common::Point _pos;
bool _isBigEndian;
+ uint32 *_frameTotalSize;
Common::SeekableSubReadStreamEndian *_fileStream;
-
- uint16 _width;
- uint16 _height;
- uint32 *_frameTotalSize;
- byte _palette[256 * 3];
- bool _dirtyPalette;
- Graphics::Surface *_surface;
- Audio::QueuingAudioStream *_audioStream;
- Audio::SoundHandle _audioHandle;
- Audio::Mixer *_mixer;
};
-#endif
} // End of namespace Sci
diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp
index abd64911a7..a7b6346eca 100644
--- a/engines/sci/video/seq_decoder.cpp
+++ b/engines/sci/video/seq_decoder.cpp
@@ -41,33 +41,44 @@ enum seqFrameTypes {
kSeqFrameDiff = 1
};
-SeqDecoder::SeqDecoder() {
- _fileStream = 0;
- _surface = 0;
- _dirtyPalette = false;
+SEQDecoder::SEQDecoder(uint frameDelay) : _frameDelay(frameDelay) {
}
-SeqDecoder::~SeqDecoder() {
+SEQDecoder::~SEQDecoder() {
close();
}
-bool SeqDecoder::loadStream(Common::SeekableReadStream *stream) {
+bool SEQDecoder::loadStream(Common::SeekableReadStream *stream) {
close();
+ addTrack(new SEQVideoTrack(stream, _frameDelay));
+
+ return true;
+}
+
+SEQDecoder::SEQVideoTrack::SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay) {
+ assert(stream);
+ assert(frameDelay != 0);
_fileStream = stream;
+ _frameDelay = frameDelay;
+ _curFrame = -1;
+
_surface = new Graphics::Surface();
_surface->create(SEQ_SCREEN_WIDTH, SEQ_SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_frameCount = _fileStream->readUint16LE();
- // Set palette
- int paletteChunkSize = _fileStream->readUint32LE();
- readPaletteChunk(paletteChunkSize);
+ // Set initial palette
+ readPaletteChunk(_fileStream->readUint32LE());
+}
- return true;
+SEQDecoder::SEQVideoTrack::~SEQVideoTrack() {
+ delete _fileStream;
+ _surface->free();
+ delete _surface;
}
-void SeqDecoder::readPaletteChunk(uint16 chunkSize) {
+void SEQDecoder::SEQVideoTrack::readPaletteChunk(uint16 chunkSize) {
byte *paletteData = new byte[chunkSize];
_fileStream->read(paletteData, chunkSize);
@@ -91,23 +102,7 @@ void SeqDecoder::readPaletteChunk(uint16 chunkSize) {
delete[] paletteData;
}
-void SeqDecoder::close() {
- if (!_fileStream)
- return;
-
- _frameDelay = 0;
-
- delete _fileStream;
- _fileStream = 0;
-
- _surface->free();
- delete _surface;
- _surface = 0;
-
- reset();
-}
-
-const Graphics::Surface *SeqDecoder::decodeNextFrame() {
+const Graphics::Surface *SEQDecoder::SEQVideoTrack::decodeNextFrame() {
int16 frameWidth = _fileStream->readUint16LE();
int16 frameHeight = _fileStream->readUint16LE();
int16 frameLeft = _fileStream->readUint16LE();
@@ -142,9 +137,6 @@ const Graphics::Surface *SeqDecoder::decodeNextFrame() {
delete[] buf;
}
- if (_curFrame == -1)
- _startTime = g_system->getMillis();
-
_curFrame++;
return _surface;
}
@@ -159,7 +151,7 @@ const Graphics::Surface *SeqDecoder::decodeNextFrame() {
} \
memcpy(dest + writeRow * SEQ_SCREEN_WIDTH + writeCol, litData + litPos, n);
-bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) {
+bool SEQDecoder::SEQVideoTrack::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) {
int writeRow = 0;
int writeCol = left;
int litPos = 0;
@@ -237,4 +229,9 @@ bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litS
return true;
}
+const byte *SEQDecoder::SEQVideoTrack::getPalette() const {
+ _dirtyPalette = false;
+ return _palette;
+}
+
} // End of namespace Sci
diff --git a/engines/sci/video/seq_decoder.h b/engines/sci/video/seq_decoder.h
index 800a3c9024..890f349feb 100644
--- a/engines/sci/video/seq_decoder.h
+++ b/engines/sci/video/seq_decoder.h
@@ -40,44 +40,49 @@ namespace Sci {
/**
* Implementation of the Sierra SEQ decoder, used in KQ6 DOS floppy/CD and GK1 DOS
*/
-class SeqDecoder : public Video::FixedRateVideoDecoder {
+class SEQDecoder : public Video::VideoDecoder {
public:
- SeqDecoder();
- virtual ~SeqDecoder();
+ SEQDecoder(uint frameDelay);
+ virtual ~SEQDecoder();
bool loadStream(Common::SeekableReadStream *stream);
- void close();
-
- void setFrameDelay(int frameDelay) { _frameDelay = frameDelay; }
-
- bool isVideoLoaded() const { return _fileStream != 0; }
- uint16 getWidth() const { return SEQ_SCREEN_WIDTH; }
- uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; }
- uint32 getFrameCount() const { return _frameCount; }
- const Graphics::Surface *decodeNextFrame();
- Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
- const byte *getPalette() { _dirtyPalette = false; return _palette; }
- bool hasDirtyPalette() const { return _dirtyPalette; }
-
-protected:
- Common::Rational getFrameRate() const { assert(_frameDelay); return Common::Rational(60, _frameDelay); }
private:
- enum {
- SEQ_SCREEN_WIDTH = 320,
- SEQ_SCREEN_HEIGHT = 200
+ class SEQVideoTrack : public FixedRateVideoTrack {
+ public:
+ SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay);
+ ~SEQVideoTrack();
+
+ uint16 getWidth() const { return SEQ_SCREEN_WIDTH; }
+ uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; }
+ Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ const Graphics::Surface *decodeNextFrame();
+ const byte *getPalette() const;
+ bool hasDirtyPalette() const { return _dirtyPalette; }
+
+ protected:
+ Common::Rational getFrameRate() const { return Common::Rational(60, _frameDelay); }
+
+ private:
+ enum {
+ SEQ_SCREEN_WIDTH = 320,
+ SEQ_SCREEN_HEIGHT = 200
+ };
+
+ void readPaletteChunk(uint16 chunkSize);
+ bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
+
+ Common::SeekableReadStream *_fileStream;
+ int _curFrame, _frameCount;
+ byte _palette[256 * 3];
+ mutable bool _dirtyPalette;
+ Graphics::Surface *_surface;
+ uint _frameDelay;
};
- void readPaletteChunk(uint16 chunkSize);
- bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
-
- uint16 _width, _height;
- uint16 _frameDelay;
- Common::SeekableReadStream *_fileStream;
- byte _palette[256 * 3];
- bool _dirtyPalette;
- uint32 _frameCount;
- Graphics::Surface *_surface;
+ uint _frameDelay;
};
} // End of namespace Sci
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index b8722b6963..0c375efcdd 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -573,19 +573,19 @@ bool Actor_v2::checkWalkboxesHaveDirectPath(Common::Point &foundPath) {
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)
+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 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 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
@@ -599,16 +599,16 @@ bool Actor_v0::intersectLineSegments(const Common::Point &line1Start, const Comm
}
/*
- * MM v0 allows the actor to walk in a direct line between boxes to the target
+ * 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
+ * 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
+ * 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)
+ * 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
@@ -992,7 +992,7 @@ void Actor_v0::setDirection(int direction) {
res = 7; // Face Camera
break;
}
-
+
_animFrameRepeat = -1;
animateActor(res);
if (_moving)
@@ -1408,7 +1408,7 @@ void Actor::showActor() {
if (_vm->_game.version == 0) {
Actor_v0 *a = ((Actor_v0 *)this);
-
+
a->_costCommand = a->_costCommandNew = 0xFF;
for (int i = 0; i < 8; ++i) {
@@ -2056,7 +2056,7 @@ void Actor_v0::animateCostume() {
void Actor_v0::speakCheck() {
if (v0ActorTalkArray[_number] & 0x80)
return;
-
+
int cmd = newDirToOldDir(_facing);
if (_speaking & 0x80)
@@ -2884,7 +2884,7 @@ void Actor_v0::animateActor(int anim) {
_costCommandNew = anim;
_vm->_costumeLoader->costumeDecodeData(this, 0, 0);
-
+
if (dir == -1)
return;
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index 0ed239d005..a733fdb4ed 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -377,7 +377,7 @@ public:
virtual void saveLoadWithSerializer(Serializer *ser);
protected:
- bool intersectLineSegments(const Common::Point &line1Start, const Common::Point &line1End,
+ 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/charset.cpp b/engines/scumm/charset.cpp
index 4064853b6b..9ae75b6683 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -69,7 +69,7 @@ void ScummEngine::loadCJKFont() {
_cjkFont->setDrawingMode(Graphics::FontSJIS::kShadowMode);
_2byteWidth = _2byteHeight = 12;
- _useCJKMode = true;
+ _useCJKMode = true;
#endif
} else if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD && _language == Common::JA_JPN) {
int numChar = 1413;
@@ -499,7 +499,7 @@ int CharsetRendererV3::getCharWidth(uint16 chr) {
if (_vm->_useCJKMode && (chr & 0x80))
spacing = _vm->_2byteWidth / 2;
-
+
if (!spacing)
spacing = *(_widthTable + chr);
@@ -644,7 +644,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
drawBits1(*vs, _left + vs->xstart, drawTop, charPtr, drawTop, origWidth, origHeight);
else
drawBits1(_vm->_textSurface, _left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier, charPtr, drawTop, origWidth, origHeight);
-
+
if (is2byte) {
origWidth /= _vm->_textSurfaceMultiplier;
height /= _vm->_textSurfaceMultiplier;
@@ -1399,7 +1399,7 @@ void CharsetRendererTownsClassic::drawBitsN(const Graphics::Surface&, byte *dst,
_vm->_cjkFont->drawChar(_vm->_textSurface, _sjisCurChar, _left * _vm->_textSurfaceMultiplier, (_top - _vm->_screenTop) * _vm->_textSurfaceMultiplier, _vm->_townsCharsetColorMap[1], _shadowColor);
return;
}
-
+
bool scale2x = (_vm->_textSurfaceMultiplier == 2);
dst = (byte *)_vm->_textSurface.pixels + (_top - _vm->_screenTop) * _vm->_textSurface.pitch * _vm->_textSurfaceMultiplier + _left * _vm->_textSurfaceMultiplier;
diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h
index b8f1d84045..1c1df51921 100644
--- a/engines/scumm/charset.h
+++ b/engines/scumm/charset.h
@@ -112,7 +112,7 @@ public:
class CharsetRendererClassic : public CharsetRendererCommon {
protected:
virtual void drawBitsN(const Graphics::Surface &s, byte *dst, const byte *src, byte bpp, int drawTop, int width, int height);
- void printCharIntern(bool is2byte, const byte *charPtr, int origWidth, int origHeight, int width, int height, VirtScreen *vs, bool ignoreCharsetMask);
+ void printCharIntern(bool is2byte, const byte *charPtr, int origWidth, int origHeight, int width, int height, VirtScreen *vs, bool ignoreCharsetMask);
virtual bool prepareDraw(uint16 chr);
int _width, _height, _origWidth, _origHeight;
@@ -195,7 +195,7 @@ public:
int getCharWidth(uint16 chr);
int getFontHeight();
-
+
private:
void enableShadow(bool enable);
void drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height);
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 6e7e9ff688..4ebdd00fdc 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -592,7 +592,7 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
} while (1);
}
-void PCESetCostumeData(byte block[16][16], int index, byte value) {
+static void PCESetCostumeData(byte block[16][16], int index, byte value) {
int row = (index % 16);
int plane = (index / 16) % 4;
int colOffset = (index < 64) ? 8 : 0;
@@ -1188,7 +1188,7 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) {
_draw_top = 200;
_draw_bottom = 0;
}
-
+
// Invalid current position?
if (a->_cost.curpos[limb] == 0xFFFF)
return 0;
@@ -1377,7 +1377,7 @@ byte V0CostumeLoader::increaseAnim(Actor *a, int limb) {
// 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;
diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index 42f11498d9..269ae9e10a 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -121,13 +121,13 @@ void ScummEngine::updateCursor() {
CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height,
_cursor.hotspotX, _cursor.hotspotY,
(_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor),
- (_game.heversion == 70 ? 2 : 1),
+ (_game.heversion == 70 ? true : false),
&format);
#else
CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height,
_cursor.hotspotX, _cursor.hotspotY,
(_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor),
- (_game.heversion == 70 ? 2 : 1));
+ (_game.heversion == 70 ? true : false));
#endif
}
@@ -180,7 +180,7 @@ void ScummEngine_v70he::setDefaultCursor() {
0xff, 0xff, 0xff,
0, 0, 0, };
-
+
memset(_grabbedCursor, 5, sizeof(_grabbedCursor));
_cursor.hotspotX = _cursor.hotspotY = 2;
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index edcf2e6fea..dc5acbdb7d 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -382,7 +382,7 @@ 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,
+ DebugPrintf("Name of actor %d: %s\n", actnum,
_vm->getObjOrActorName(_vm->actorToObj(actnum)));
} else if (!strcmp(argv[2], "condmask")) {
if (argc > 3) {
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index b47982af00..e5c3023380 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -20,9 +20,6 @@
*
*/
-// FIXME: Avoid using printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-
#include "base/plugins.h"
#include "common/archive.h"
@@ -156,6 +153,7 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
case kGenHEMac:
case kGenHEMacNoParens:
case kGenHEPC:
+ case kGenHEIOS:
if (_game.heversion >= 98 && room >= 0) {
int disk = 0;
if (_heV7DiskOffsets)
@@ -168,7 +166,11 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
break;
case 1:
id = 'a';
- result = Common::String::format("%s.(a)", _filenamePattern.pattern);
+ // Some of the newer HE games for iOS use the ".hea" suffix instead
+ if (_filenamePattern.genMethod == kGenHEIOS)
+ result = Common::String::format("%s.hea", _filenamePattern.pattern);
+ else
+ result = Common::String::format("%s.(a)", _filenamePattern.pattern);
break;
default:
id = '0';
@@ -180,7 +182,7 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
id = (room == 0) ? '0' : '1';
}
- if (_filenamePattern.genMethod == kGenHEPC) {
+ if (_filenamePattern.genMethod == kGenHEPC || _filenamePattern.genMethod == kGenHEIOS) {
// For HE >= 98, we already called snprintf above.
if (_game.heversion < 98 || room < 0)
result = Common::String::format("%s.he%c", _filenamePattern.pattern, id);
@@ -217,6 +219,7 @@ static Common::String generateFilenameForDetection(const char *pattern, Filename
break;
case kGenHEPC:
+ case kGenHEIOS:
result = Common::String::format("%s.he0", pattern);
break;
@@ -239,6 +242,10 @@ static Common::String generateFilenameForDetection(const char *pattern, Filename
return result;
}
+bool ScummEngine::isMacM68kIMuse() const {
+ return _game.platform == Common::kPlatformMacintosh && (_game.id == GID_MONKEY2 || _game.id == GID_INDY4) && !(_game.features & GF_MAC_CONTAINER);
+}
+
struct DetectorDesc {
Common::FSNode node;
Common::String md5;
@@ -470,6 +477,11 @@ static void computeGameSettingsFromMD5(const Common::FSList &fslist, const GameF
if (dr.language == UNK_LANG) {
dr.language = detectLanguage(fslist, dr.game.id);
}
+
+ // HACK: Detect between 68k and PPC versions
+ if (dr.game.platform == Common::kPlatformMacintosh && dr.game.version >= 5 && dr.game.heversion == 0 && strstr(gfp->pattern, "Data"))
+ dr.game.features |= GF_MAC_CONTAINER;
+
break;
}
}
@@ -589,11 +601,11 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
file.c_str(), md5str.c_str(), filesize);
// Sanity check: We *should* have found a matching gameid / variant at this point.
- // If not, then there's a bug in our data tables...
- assert(dr.game.gameid != 0);
-
- // Add it to the list of detected games
- results.push_back(dr);
+ // If not, we may have #ifdef'ed the entry out in our detection_tables.h because we
+ // don't have the required stuff compiled in, or there's a bug in our data tables...
+ if (dr.game.gameid != 0)
+ // Add it to the list of detected games
+ results.push_back(dr);
}
}
@@ -1060,19 +1072,31 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
// unknown MD5, or with a medium debug level in case of a known MD5 (for
// debugging purposes).
if (!findInMD5Table(res.md5.c_str())) {
- printf("Your game version appears to be unknown. If this is *NOT* a fan-modified\n");
- printf("version (in particular, not a fan-made translation), please, report the\n");
- printf("following data to the ScummVM team along with name of the game you tried\n");
- printf("to add and its version/language/etc.:\n");
+ Common::String md5Warning;
+
+ md5Warning = "Your game version appears to be unknown. If this is *NOT* a fan-modified\n";
+ md5Warning += "version (in particular, not a fan-made translation), please, report the\n";
+ md5Warning += "following data to the ScummVM team along with name of the game you tried\n";
+ md5Warning += "to add and its version/language/etc.:\n";
- printf(" SCUMM gameid '%s', file '%s', MD5 '%s'\n\n",
+ md5Warning += Common::String::format(" SCUMM gameid '%s', file '%s', MD5 '%s'\n\n",
res.game.gameid,
generateFilenameForDetection(res.fp.pattern, res.fp.genMethod).c_str(),
res.md5.c_str());
+
+ g_system->logMessage(LogMessageType::kWarning, md5Warning.c_str());
} else {
debug(1, "Using MD5 '%s'", res.md5.c_str());
}
+ // We don't support the "Lite" version off puttzoo iOS because it contains
+ // the full game.
+ if (!strcmp(res.game.gameid, "puttzoo") && !strcmp(res.extra, "Lite")) {
+ GUIErrorMessage("The Lite version of Putt-Putt Saves the Zoo iOS is not supported to avoid piracy.\n"
+ "The full version is available for purchase from the iTunes Store.");
+ return Common::kUnsupportedGameidError;
+ }
+
// If the GUI options were updated, we catch this here and update them in the users config
// file transparently.
Common::updateGameGUIOptions(res.game.guioptions, getGameGUIOptionsDescriptionLanguage(res.language));
@@ -1121,6 +1145,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
case 200:
*engine = new ScummEngine_vCUPhe(syst, res);
break;
+ case 101:
case 100:
*engine = new ScummEngine_v100he(syst, res);
break;
@@ -1251,7 +1276,6 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int
Graphics::Surface *thumbnail = ScummEngine::loadThumbnailFromSlot(target, slot);
SaveStateDescriptor desc(slot, saveDesc);
- desc.setDeletableFlag(true);
desc.setThumbnail(thumbnail);
SaveStateMetaInfos infos;
diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h
index b6dfa757bb..5ed6b5aab0 100644
--- a/engines/scumm/detection.h
+++ b/engines/scumm/detection.h
@@ -99,6 +99,7 @@ enum FilenameGenMethod {
kGenHEMac,
kGenHEMacNoParens,
kGenHEPC,
+ kGenHEIOS,
kGenUnchanged
};
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 22708de2d3..3120017db6 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -236,7 +236,7 @@ static const GameSettings gameVariantsTable[] = {
{"monkey", "VGA", "vga", GID_MONKEY_VGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
{"monkey", "EGA", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_16COLOR, Common::kPlatformPC, GUIO1(GUIO_NOSPEECH)},
{"monkey", "No AdLib", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR, GF_16COLOR, Common::kPlatformAtariST, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
- {"monkey", "Demo", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"monkey", "Demo", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"monkey", "CD", 0, GID_MONKEY, 5, 0, MDT_ADLIB, GF_AUDIOTRACKS, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"monkey", "FM-TOWNS", 0, GID_MONKEY, 5, 0, MDT_TOWNS, GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
{"monkey", "SEGA", 0, GID_MONKEY, 5, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
@@ -382,14 +382,16 @@ static const GameSettings gameVariantsTable[] = {
{"pjgames", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Added the use of bink videos
- {"Baseball2003", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"basketball", 0, 0, GID_BASKETBALL, 6, 100, MDT_NONE, GF_USE_KEY| GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"football2002", 0, 0, GID_FOOTBALL, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
{"Soccer2004", 0, 0, GID_SOCCER2004, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// U32 code required, for testing only
{"moonbase", 0, 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
{"moonbase", "Demo", 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR | GF_DEMO, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+
+ // HE100 games, which use older o72_debugInput code
+ {"Baseball2003", 0, 0, GID_BASEBALL2003, 6, 101, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"basketball", 0, 0, GID_BASKETBALL, 6, 101, MDT_NONE, GF_USE_KEY| GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"football2002", 0, 0, GID_FOOTBALL2002, 6, 101, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
#endif
// The following are meant to be generic HE game variants and as such do
@@ -407,6 +409,7 @@ static const GameSettings gameVariantsTable[] = {
{"", "HE 98.5", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
{"", "HE 99", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
{"", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 101", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
#endif
{NULL, NULL, 0, 0, 0, MDT_NONE, 0, 0, UNK, 0}
};
@@ -552,7 +555,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "freddicove", "freddicove", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddicove", "FreddiCCC", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddicove", "FreddiCove", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
- { "freddicove", "FreddiDZZ", kGenHEPC, Common::NL_NLD, UNK, 0 },
+ { "freddicove", "FreddiDZZ", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 },
{ "freddicove", "FreddiDZZ", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "freddicove", "FreddiMML", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "freddicove", "FreddiMML", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 },
@@ -597,6 +600,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "balloon", "balloon", kGenHEPC, UNK_LANG, UNK, 0 },
{ "balloon", "Balloon-O-Rama", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
+ { "balloon", "Ballon-O-Rama", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "baseball", "baseball", kGenHEPC, UNK_LANG, UNK, 0 },
{ "baseball", "BaseBall", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -649,6 +653,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "freddi", "freddi", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi", "Freddi", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi", "Freddi1", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "freddi", "Freddemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi", "freddemo", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi", "Freddi Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi", "Freddi Fish", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -659,6 +664,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "freddi", "MM-DEMO", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi2", "freddi2", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "freddi2", "FF2-demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 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 },
@@ -693,14 +699,16 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "freddi4", "freddi4", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "freddi4", "Freddi4", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
- { "freddi4", "f4-demo", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "freddi4", "f4-demo", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "freddi4", "ff4demo", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "freddi4", "Ff4demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
+ { "freddi4", "FF4 demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi4", "Freddi 4", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi4", "Freddi 4 Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi4", "FreddiGS", kGenHEPC, Common::DE_DEU, UNK, 0 },
{ "freddi4", "FreddiGS", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 },
- { "freddi4", "FreddiHRBG", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "freddi4", "FreddiHRBG", kGenHEPC, Common::EN_GRB, UNK, 0 },
+ { "freddi4", "FreddiHRBG", kGenHEMac, Common::EN_GRB, Common::kPlatformMacintosh, 0 },
{ "freddi4", "FreddiMini", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi4", "Malice4", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 },
{ "freddi4", "MaliceMRC", kGenHEPC, Common::FR_FRA, UNK, 0 },
@@ -727,11 +735,11 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "mustard", "mustard", kGenHEPC, UNK_LANG, UNK, 0 },
{ "mustard", "Mustard", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
- { "pajama", "pajama", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "pajama", "pajama", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "pajama", "Pyjama Pit", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 },
{ "pajama", "Pajama Sam", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "pajama", "PajamaNHD", kGenHEPC, UNK_LANG, UNK, 0 },
- { "pajama", "PJS-DEMO", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "pajama", "PJS-DEMO", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "pajama", "PJS-DEMO", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "pajama", "pjsam", kGenHEPC, UNK_LANG, UNK, 0 },
{ "pajama", "PjSamDemo", kGenHEPC, UNK_LANG, UNK, 0 },
@@ -741,7 +749,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "pajama", "sampyjam", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "pajama", "SamPyjam", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 },
- { "pajama2", "pajama2", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "pajama2", "pajama2", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "pajama2", "Pajama2", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "pajama2", "pyjam2", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "pajama2", "Pajama Sam 2", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -784,7 +792,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "puttcircus", "PouceDLC", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "puttcircus", "Putt Circus Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "puttcircus", "Putt Circus", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
- { "puttcircus", "PuttIHC", kGenHEPC, Common::NL_NLD, UNK, 0 },
+ { "puttcircus", "PuttIHC", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 },
{ "puttcircus", "PuttPuttIHC", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "puttcircus", "PuttPuttJTC", kGenHEPC, UNK_LANG, UNK, 0 },
{ "puttcircus", "ToffToff", kGenHEPC, Common::DE_DEU, UNK, 0 },
@@ -812,13 +820,13 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "PuttsFunShop", "PuttsFunShop", kGenHEPC, UNK_LANG, UNK, 0 },
{ "PuttsFunShop", "Putt's FunShop", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
- { "putttime", "putttime", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "putttime", "putttime", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "putttime", "PuttTime", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "putttime", "pouce", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "putttime", "Pouce-Pouce", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 },
{ "putttime", "PuttPuttTTT", kGenHEPC, UNK_LANG, UNK, 0 },
{ "putttime", "PuttPuttTTT", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
- { "putttime", "PuttTijd", kGenHEPC, Common::NL_NLD, UNK, 0 },
+ { "putttime", "PuttTijd", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 },
{ "putttime", "PuttTijd", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "putttime", "Putt Time", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "putttime", "PuttTTT", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -844,6 +852,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "puttzoo", "T\xD6""FFZOO", kGenHEPC, Common::DE_DEU, UNK, 0 }, // Windows encoding
{ "puttzoo", "T\xC3\xB6""ff-T\xC3\xB6""ff\xE2\x84\xA2 Zoo Demo", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 }, // UTF-8 encoding
{ "puttzoo", "T\xF6""ff-T""\xF6""ff\x99 Zoo Demo", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 }, // Windows encoding
+ { "puttzoo", "Zoodemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "puttzoo", "zoodemo", kGenHEPC, UNK_LANG, UNK, 0 },
{ "puttzoo", "Zoo Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "puttzoo", "Putt-Putt Saves the Zoo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -860,11 +869,11 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "socks", "SokkenSoep", kGenHEPC, Common::NL_NLD, UNK, 0 },
{ "socks", "SokkenSoep", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
- { "spyfox", "spyfox", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "spyfox", "spyfox", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "spyfox", "Fuchsdem", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 },
{ "spyfox", "FUCHSDEM", kGenHEPC, Common::DE_DEU, UNK, 0 },
{ "spyfox", "FoxDemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
- { "spyfox", "foxdemo", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "spyfox", "foxdemo", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "spyfox", "JAMESDEM", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "spyfox", "renard", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "spyfox", "Spydemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -880,6 +889,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "spyfox", "Spy Fox", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "spyfox", "Spy Fox Demo", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "spyfox", "JR-Demo", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 },
+ { "spyfox", "game", kGenHEIOS, Common::EN_ANY, Common::kPlatformIOS, 0 },
{ "spyfox2", "spyfox2", kGenHEPC, UNK_LANG, UNK, 0 },
{ "spyfox2", "sf2-demo", kGenHEPC, UNK_LANG, UNK, 0 },
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 0e531daf73..945c5b6611 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -180,7 +180,7 @@ static const ResString string_map_table_v345[] = {
// "Moechten Sie wirklich neu starten? (J/N)J"
// Will react to J as 'Yes'
{5, _s("Are you sure you want to restart? (Y/N)")},
- // I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
+ // I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
{6, _s("Are you sure you want to quit? (Y/N)")},
// Added in SCUMM4
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 2cf4a429db..ffff329036 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -755,7 +755,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
memset(blackbuf, 0, 16 * 240); // Prepare a buffer 16px wide and 240px high, to fit on a lateral strip
width = 240; // Fix right strip
- _system->copyRectToScreen((const byte *)blackbuf, 16, 0, 0, 16, 240); // Fix left strip
+ _system->copyRectToScreen(blackbuf, 16, 0, 0, 16, 240); // Fix left strip
}
}
@@ -763,7 +763,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
}
// Finally blit the whole thing to the screen
- _system->copyRectToScreen((const byte *)src, pitch, x, y, width, height);
+ _system->copyRectToScreen(src, pitch, x, y, width, height);
}
// CGA
diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp
index 8bffcab4a0..f86a4e56d5 100644
--- a/engines/scumm/gfx_towns.cpp
+++ b/engines/scumm/gfx_towns.cpp
@@ -271,7 +271,7 @@ void TownsScreen::setupLayer(int layer, int width, int height, int numCol, void
l->enabled = true;
_layers[0].onBottom = true;
- _layers[1].onBottom = _layers[0].enabled ? false : true;
+ _layers[1].onBottom = !_layers[0].enabled;
l->ready = true;
}
@@ -424,7 +424,7 @@ void TownsScreen::toggleLayers(int flag) {
_layers[0].enabled = (flag & 1) ? true : false;
_layers[0].onBottom = true;
_layers[1].enabled = (flag & 2) ? true : false;
- _layers[1].onBottom = _layers[0].enabled ? false : true;
+ _layers[1].onBottom = !_layers[0].enabled;
_dirtyRects.clear();
_dirtyRects.push_back(Common::Rect(_width - 1, _height - 1));
diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp
index 40e99c26a8..be17a3b305 100644
--- a/engines/scumm/he/animation_he.cpp
+++ b/engines/scumm/he/animation_he.cpp
@@ -40,7 +40,7 @@ MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer) : _vm(vm) {
_video = new Video::BinkDecoder();
else
#endif
- _video = new Video::SmackerDecoder(mixer);
+ _video = new Video::SmackerDecoder();
_flags = 0;
_wizResNum = 0;
@@ -61,11 +61,16 @@ int MoviePlayer::load(const char *filename, int flags, int image) {
if (_video->isVideoLoaded())
_video->close();
+ // Ensure that Bink will use our PixelFormat
+ _video->setDefaultHighColorFormat(g_system->getScreenFormat());
+
if (!_video->loadFile(filename)) {
warning("Failed to load video file %s", filename);
return -1;
}
+ _video->start();
+
debug(1, "Playing video %s", filename);
if (flags & 2)
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index cdc5faa084..fc5e4bcdf0 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -187,6 +187,8 @@ public:
Wiz *_wiz;
+ virtual int setupStringArray(int size);
+
protected:
virtual void setupOpcodes();
@@ -201,7 +203,6 @@ protected:
virtual void clearDrawQueues();
int getStringCharWidth(byte chr);
- virtual int setupStringArray(int size);
void appendSubstring(int dst, int src, int len2, int len);
void adjustRect(Common::Rect &rect);
@@ -258,6 +259,9 @@ public:
virtual void resetScumm();
+ virtual byte *getStringAddress(ResId idx);
+ virtual int setupStringArray(int size);
+
protected:
virtual void setupOpcodes();
@@ -265,7 +269,6 @@ protected:
virtual void resetScummVars();
virtual void readArrayFromIndexFile();
- virtual byte *getStringAddress(ResId idx);
virtual void readMAXS(int blockSize);
virtual void redrawBGAreas();
@@ -280,7 +283,6 @@ protected:
void copyArray(int array1, int a1_dim2start, int a1_dim2end, int a1_dim1start, int a1_dim1end,
int array2, int a2_dim2start, int a2_dim2end, int a2_dim1start, int a2_dim1end);
void copyArrayHelper(ArrayHeader *ah, int idx2, int idx1, int len1, byte **data, int *size, int *num);
- virtual int setupStringArray(int size);
int readFileToArray(int slot, int32 size);
void writeFileFromArray(int slot, int32 resID);
diff --git a/engines/scumm/he/logic/football.cpp b/engines/scumm/he/logic/football.cpp
index f86f97eaf7..b405d634a4 100644
--- a/engines/scumm/he/logic/football.cpp
+++ b/engines/scumm/he/logic/football.cpp
@@ -20,6 +20,8 @@
*
*/
+#include "common/savefile.h"
+
#include "scumm/he/intern_he.h"
#include "scumm/he/logic_he.h"
@@ -35,16 +37,16 @@ public:
LogicHEfootball(ScummEngine_v90he *vm) : LogicHE(vm) {}
int versionID();
- int32 dispatch(int op, int numArgs, int32 *args);
-
-private:
- int op_1004(int32 *args);
- int op_1006(int32 *args);
- int op_1007(int32 *args);
- int op_1010(int32 *args);
- int op_1022(int32 *args);
- int op_1023(int32 *args);
- int op_1024(int32 *args);
+ virtual int32 dispatch(int op, int numArgs, int32 *args);
+
+protected:
+ int lineEquation3D(int32 *args);
+ virtual int translateWorldToScreen(int32 *args);
+ int fieldGoalScreenTranslation(int32 *args);
+ virtual int translateScreenToWorld(int32 *args);
+ int nextPoint(int32 *args);
+ int computePlayerBallIntercepts(int32 *args);
+ int computeTwoCircleIntercepts(int32 *args);
};
int LogicHEfootball::versionID() {
@@ -56,31 +58,31 @@ int32 LogicHEfootball::dispatch(int op, int numArgs, int32 *args) {
switch (op) {
case 1004:
- res = op_1004(args);
+ res = lineEquation3D(args);
break;
case 1006:
- res = op_1006(args);
+ res = translateWorldToScreen(args);
break;
case 1007:
- res = op_1007(args);
+ res = fieldGoalScreenTranslation(args);
break;
case 1010:
- res = op_1010(args);
+ res = translateScreenToWorld(args);
break;
case 1022:
- res = op_1022(args);
+ res = nextPoint(args);
break;
case 1023:
- res = op_1023(args);
+ res = computePlayerBallIntercepts(args);
break;
case 1024:
- res = op_1024(args);
+ res = computeTwoCircleIntercepts(args);
break;
case 8221968:
@@ -123,8 +125,8 @@ int32 LogicHEfootball::dispatch(int op, int numArgs, int32 *args) {
return res;
}
-int LogicHEfootball::op_1004(int32 *args) {
- // Identical to LogicHEsoccer::op_1004
+int LogicHEfootball::lineEquation3D(int32 *args) {
+ // Identical to soccer's 1004 opcode
double res, a2, a4, a5;
a5 = ((double)args[4] - (double)args[1]) / ((double)args[5] - (double)args[2]);
@@ -141,8 +143,8 @@ int LogicHEfootball::op_1004(int32 *args) {
return 1;
}
-int LogicHEfootball::op_1006(int32 *args) {
- // This seems to be more or less the inverse of op_1010
+int LogicHEfootball::translateWorldToScreen(int32 *args) {
+ // This is more or less the inverse of translateScreenToWorld
const double a1 = args[1];
double res;
@@ -167,7 +169,7 @@ int LogicHEfootball::op_1006(int32 *args) {
return 1;
}
-int LogicHEfootball::op_1007(int32 *args) {
+int LogicHEfootball::fieldGoalScreenTranslation(int32 *args) {
double res, temp;
temp = (double)args[1] * 0.32;
@@ -188,8 +190,8 @@ int LogicHEfootball::op_1007(int32 *args) {
return 1;
}
-int LogicHEfootball::op_1010(int32 *args) {
- // This seems to be more or less the inverse of op_1006
+int LogicHEfootball::translateScreenToWorld(int32 *args) {
+ // This is more or less the inverse of translateWorldToScreen
double a1 = (640.0 - (double)args[1] - 26.0) / 1.1588235e-1;
// 2.9411764e-4 = 1/3400
@@ -205,7 +207,7 @@ int LogicHEfootball::op_1010(int32 *args) {
return 1;
}
-int LogicHEfootball::op_1022(int32 *args) {
+int LogicHEfootball::nextPoint(int32 *args) {
double res;
double var10 = args[4] - args[1];
double var8 = args[5] - args[2];
@@ -226,7 +228,7 @@ int LogicHEfootball::op_1022(int32 *args) {
return 1;
}
-int LogicHEfootball::op_1023(int32 *args) {
+int LogicHEfootball::computePlayerBallIntercepts(int32 *args) {
double var10, var18, var20, var28, var30, var30_;
double argf[7];
@@ -272,7 +274,8 @@ int LogicHEfootball::op_1023(int32 *args) {
return 1;
}
-int LogicHEfootball::op_1024(int32 *args) {
+int LogicHEfootball::computeTwoCircleIntercepts(int32 *args) {
+ // Looks like this was just dummied out
writeScummVar(108, 0);
writeScummVar(109, 0);
writeScummVar(110, 0);
@@ -281,8 +284,125 @@ int LogicHEfootball::op_1024(int32 *args) {
return 1;
}
+class LogicHEfootball2002 : public LogicHEfootball {
+public:
+ LogicHEfootball2002(ScummEngine_v90he *vm) : LogicHEfootball(vm) {}
+
+ int32 dispatch(int op, int numArgs, int32 *args);
+
+private:
+ int translateWorldToScreen(int32 *args);
+ int translateScreenToWorld(int32 *args);
+ int getDayOfWeek();
+ int initScreenTranslations();
+ int getPlaybookFiles(int32 *args);
+ int largestFreeBlock();
+};
+
+int32 LogicHEfootball2002::dispatch(int op, int numArgs, int32 *args) {
+ int32 res = 0;
+
+ switch (op) {
+ case 1025:
+ res = getDayOfWeek();
+ break;
+
+ case 1026:
+ res = initScreenTranslations();
+ break;
+
+ case 1027:
+ res = getPlaybookFiles(args);
+ break;
+
+ case 1028:
+ res = largestFreeBlock();
+ break;
+
+ case 1029:
+ // Clean-up off heap
+ // Dummied in the Windows U32
+ res = 1;
+ break;
+
+ case 1516:
+ // Start auto LAN game
+ break;
+
+ default:
+ res = LogicHEfootball::dispatch(op, numArgs, args);
+ break;
+ }
+
+ return res;
+}
+
+int LogicHEfootball2002::translateWorldToScreen(int32 *args) {
+ // TODO: Implement modified 2002 version
+ return LogicHEfootball::translateWorldToScreen(args);
+}
+
+int LogicHEfootball2002::translateScreenToWorld(int32 *args) {
+ // TODO: Implement modified 2002 version
+ return LogicHEfootball::translateScreenToWorld(args);
+}
+
+int LogicHEfootball2002::getDayOfWeek() {
+ // Get day of week, store in var 108
+
+ TimeDate time;
+ _vm->_system->getTimeAndDate(time);
+ writeScummVar(108, time.tm_wday);
+
+ return 1;
+}
+
+int LogicHEfootball2002::initScreenTranslations() {
+ // TODO: Set values used by translateWorldToScreen/translateScreenToWorld
+ return 1;
+}
+
+int LogicHEfootball2002::getPlaybookFiles(int32 *args) {
+ // Get the pattern and then skip over the directory prefix ("*\" or "*:")
+ Common::String pattern = (const char *)_vm->getStringAddress(args[0] & ~0x33539000) + 2;
+
+ // Prepare a buffer to hold the file names
+ char buffer[1000];
+ buffer[0] = 0;
+
+ // Get the list of file names that match the pattern and iterate over it
+ Common::StringArray fileList = _vm->getSaveFileManager()->listSavefiles(pattern);
+
+ for (uint32 i = 0; i < fileList.size() && strlen(buffer) < 970; i++) {
+ // Isolate the base part of the filename and concatenate it to our buffer
+ Common::String fileName = Common::String(fileList[i].c_str(), fileList[i].size() - (pattern.size() - 1));
+ strcat(buffer, fileName.c_str());
+ strcat(buffer, ">"); // names separated by '>'
+ }
+
+ // Now store the result in an array
+ int array = _vm->setupStringArray(strlen(buffer));
+ strcpy((char *)_vm->getStringAddress(array), buffer);
+
+ // And store the array index in variable 108
+ writeScummVar(108, array);
+
+ return 1;
+}
+
+int LogicHEfootball2002::largestFreeBlock() {
+ // The Windows version always sets the variable to this
+ // The Mac version actually checks for the largest free block
+ writeScummVar(108, 100000000);
+ return 1;
+}
+
LogicHE *makeLogicHEfootball(ScummEngine_v90he *vm) {
return new LogicHEfootball(vm);
}
+LogicHE *makeLogicHEfootball2002(ScummEngine_v90he *vm) {
+ return new LogicHEfootball2002(vm);
+}
+
} // End of namespace Scumm
diff --git a/engines/scumm/he/logic/soccer.cpp b/engines/scumm/he/logic/soccer.cpp
index 05f377a736..2b29f93173 100644
--- a/engines/scumm/he/logic/soccer.cpp
+++ b/engines/scumm/he/logic/soccer.cpp
@@ -303,7 +303,7 @@ int LogicHEsoccer::op_1008(int outArray, int srcX, int srcY, int srcZ, int vecX,
putInArray(outArray, segmentsSoFar, 5, vecX);
putInArray(outArray, segmentsSoFar, 6, vecY);
putInArray(outArray, segmentsSoFar++, 7, vecZ);
- }
+ }
} else {
srcY = 0;
int thisVecX = vecX;
@@ -628,7 +628,7 @@ int LogicHEsoccer::op_1014(int32 srcX, int32 srcY, int32 srcZ, int32 velX, int32
adjustedVelZ = ((double)srcZ - 3869.0) / 100.0;
break;
}
-
+
int foundCollision = 0;
// work out which collision objects we might collide with (if any)
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index a76c393e13..0f9454ba28 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -87,6 +87,9 @@ LogicHE *LogicHE::makeLogicHE(ScummEngine_v90he *vm) {
case GID_FOOTBALL:
return makeLogicHEfootball(vm);
+ case GID_FOOTBALL2002:
+ return makeLogicHEfootball2002(vm);
+
case GID_SOCCER:
case GID_SOCCERMLS:
case GID_SOCCER2004:
diff --git a/engines/scumm/he/logic_he.h b/engines/scumm/he/logic_he.h
index 893dc81b87..93c0569a4f 100644
--- a/engines/scumm/he/logic_he.h
+++ b/engines/scumm/he/logic_he.h
@@ -61,6 +61,7 @@ protected:
LogicHE *makeLogicHErace(ScummEngine_v90he *vm);
LogicHE *makeLogicHEfunshop(ScummEngine_v90he *vm);
LogicHE *makeLogicHEfootball(ScummEngine_v90he *vm);
+LogicHE *makeLogicHEfootball2002(ScummEngine_v90he *vm);
LogicHE *makeLogicHEsoccer(ScummEngine_v90he *vm);
LogicHE *makeLogicHEbaseball2001(ScummEngine_v90he *vm);
LogicHE *makeLogicHEbasketball(ScummEngine_v90he *vm);
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 42748d08ed..ce4b2239d2 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -129,7 +129,7 @@ bool Win32ResExtractor::extractResource(int id, CachedCursor *cc) {
if (!group)
return false;
- Graphics::WinCursor *cursor = group->cursors[0].cursor;
+ Graphics::Cursor *cursor = group->cursors[0].cursor;
cc->bitmap = new byte[cursor->getWidth() * cursor->getHeight()];
cc->width = cursor->getWidth();
diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp
index 56ea10f507..a2eb42214b 100644
--- a/engines/scumm/he/script_v100he.cpp
+++ b/engines/scumm/he/script_v100he.cpp
@@ -876,6 +876,7 @@ void ScummEngine_v100he::o100_floodFill() {
_floodFillParams.box.top = 0;
_floodFillParams.box.right = 639;
_floodFillParams.box.bottom = 479;
+ adjustRect(_floodFillParams.box);
break;
case 6:
_floodFillParams.y = pop();
@@ -886,6 +887,7 @@ void ScummEngine_v100he::o100_floodFill() {
_floodFillParams.box.right = pop();
_floodFillParams.box.top = pop();
_floodFillParams.box.left = pop();
+ adjustRect(_floodFillParams.box);
break;
case 20:
_floodFillParams.flags = pop();
@@ -1345,6 +1347,7 @@ void ScummEngine_v100he::o100_wizImageOps() {
_wizParams.fillColor = pop();
_wizParams.box2.top = _wizParams.box2.bottom = pop();
_wizParams.box2.left = _wizParams.box2.right = pop();
+ adjustRect(_wizParams.box2);
break;
case 135:
_wizParams.processFlags |= kWPFDstResNum;
@@ -1358,6 +1361,7 @@ void ScummEngine_v100he::o100_wizImageOps() {
_wizParams.box2.right = pop();
_wizParams.box2.top = pop();
_wizParams.box2.left = pop();
+ adjustRect(_wizParams.box2);
break;
case 137:
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
@@ -1365,6 +1369,7 @@ void ScummEngine_v100he::o100_wizImageOps() {
_wizParams.fillColor = pop();
_wizParams.box2.top = _wizParams.box2.bottom = pop();
_wizParams.box2.left = _wizParams.box2.right = pop();
+ adjustRect(_wizParams.box2);
break;
case 138:
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
@@ -1374,6 +1379,7 @@ void ScummEngine_v100he::o100_wizImageOps() {
_wizParams.box2.right = pop();
_wizParams.box2.top = pop();
_wizParams.box2.left = pop();
+ adjustRect(_wizParams.box2);
break;
default:
error("o100_wizImageOps: Unknown case %d", subOp);
@@ -2339,6 +2345,13 @@ void ScummEngine_v100he::o100_writeFile() {
}
void ScummEngine_v100he::o100_debugInput() {
+ // Backyard Baseball 2003 / Basketball / Football 2002
+ // use older o72_debugInput code
+ if (_game.heversion == 101) {
+ ScummEngine_v72he::o72_debugInput();
+ return;
+ }
+
byte subOp = fetchScriptByte();
switch (subOp) {
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp
index dbeee567bf..5e359385b6 100644
--- a/engines/scumm/he/script_v60he.cpp
+++ b/engines/scumm/he/script_v60he.cpp
@@ -124,8 +124,6 @@ int ScummEngine_v60he::convertFilePath(byte *dst, int dstSize) {
} else if (dst[0] == '.' && dst[1] == '/') { // Game Data Path
// The default game data path is set to './' by ScummVM
r = 2;
- } else if (dst[2] == 'b' && dst[5] == 'k') { // Backyard Basketball INI
- r = 13;
} else if (dst[0] == '*' && dst[1] == '/') { // Save Game Path (Windows HE72 - HE100)
// The default save game path is set to '*/' by ScummVM
r = 2;
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index 0beebdb7a1..1ea9960a18 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -244,6 +244,7 @@ void ScummEngine_v90he::o90_wizImageOps() {
_wizParams.box2.right = pop();
_wizParams.box2.top = pop();
_wizParams.box2.left = pop();
+ adjustRect(_wizParams.box2);
break;
case 134: // HE99+
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
@@ -253,6 +254,7 @@ void ScummEngine_v90he::o90_wizImageOps() {
_wizParams.box2.right = pop();
_wizParams.box2.top = pop();
_wizParams.box2.left = pop();
+ adjustRect(_wizParams.box2);
break;
case 135: // HE99+
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
@@ -260,6 +262,7 @@ void ScummEngine_v90he::o90_wizImageOps() {
_wizParams.fillColor = pop();
_wizParams.box2.top = _wizParams.box2.bottom = pop();
_wizParams.box2.left = _wizParams.box2.right = pop();
+ adjustRect(_wizParams.box2);
break;
case 136: // HE99+
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
@@ -267,6 +270,7 @@ void ScummEngine_v90he::o90_wizImageOps() {
_wizParams.fillColor = pop();
_wizParams.box2.top = _wizParams.box2.bottom = pop();
_wizParams.box2.left = _wizParams.box2.right = pop();
+ adjustRect(_wizParams.box2);
break;
case 137: // HE99+
_wizParams.processFlags |= kWPFDstResNum;
@@ -1488,6 +1492,7 @@ void ScummEngine_v90he::o90_floodFill() {
_floodFillParams.box.top = 0;
_floodFillParams.box.right = 639;
_floodFillParams.box.bottom = 479;
+ adjustRect(_floodFillParams.box);
break;
case 65:
_floodFillParams.y = pop();
@@ -1501,6 +1506,7 @@ void ScummEngine_v90he::o90_floodFill() {
_floodFillParams.box.right = pop();
_floodFillParams.box.top = pop();
_floodFillParams.box.left = pop();
+ adjustRect(_floodFillParams.box);
break;
case 255:
floodFill(&_floodFillParams, this);
@@ -1666,7 +1672,7 @@ void ScummEngine_v90he::o90_getPolygonOverlap() {
{
Common::Rect r2;
_sprite->getSpriteBounds(args2[0], false, r2);
- Common::Rect r1(args1[0], args1[1], args1[2], args1[3]);
+ Common::Rect r1(args1[0], args1[1], args1[2] + 1, args1[3] + 1);
if (r2.isValidRect() == false) {
push(0);
break;
@@ -1711,7 +1717,7 @@ void ScummEngine_v90he::o90_getPolygonOverlap() {
{
Common::Rect r2;
_sprite->getSpriteBounds(args2[0], true, r2);
- Common::Rect r1(args1[0], args1[1], args1[2], args1[3]);
+ Common::Rect r1(args1[0], args1[1], args1[2] + 1, args1[3] + 1);
if (r2.isValidRect() == false) {
push(0);
break;
@@ -2373,8 +2379,8 @@ void ScummEngine_v90he::o90_kernelSetFunctions() {
case 2001:
_logicHE->dispatch(args[1], num - 2, (int32 *)&args[2]);
break;
- case 201102:
- // Used in puttzoo iOS
+ case 201102: // Used in puttzoo iOS
+ case 20111014: // Used in spyfox iOS
break;
default:
error("o90_kernelSetFunctions: default case %d (param count %d)", args[0], num);
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 1007d2a7b0..f94b74ac45 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -65,7 +65,7 @@ void SoundHE::addSoundToQueue(int sound, int heOffset, int heChannel, int heFlag
if (_vm->VAR_LAST_SOUND != 0xFF)
_vm->VAR(_vm->VAR_LAST_SOUND) = sound;
- if ((_vm->_game.heversion <= 99 && (heFlags & 16)) || (_vm->_game.heversion == 100 && (heFlags & 8))) {
+ if ((_vm->_game.heversion <= 99 && (heFlags & 16)) || (_vm->_game.heversion >= 100 && (heFlags & 8))) {
playHESound(sound, heOffset, heChannel, heFlags);
return;
} else {
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 47b4b8ad33..798f703db6 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -2286,8 +2286,7 @@ void Wiz::fillWizLine(const WizParameters *params) {
lineP.depth = bitDepth;
if (params->processFlags & kWPFParams) {
- assert (params->params2 == 1); // Catch untested usage
- Graphics::drawThickLine(x1, y1, x2, y2, params->params1, color, drawProc, &lineP);
+ Graphics::drawThickLine(x1, y1, x2, y2, params->params1, params->params2, color, drawProc, &lineP);
} else {
Graphics::drawLine(x1, y1, x2, y2, color, drawProc, &lineP);
}
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 27a72c2afe..016ba89e7b 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -164,7 +164,7 @@ bool IMuseInternal::isMT32(int sound) {
return true;
case MKTAG('M', 'A', 'C', ' '): // Occurs in the Mac version of FOA and MI2
- return true;
+ return false;
case MKTAG('G', 'M', 'D', ' '):
return false;
@@ -226,6 +226,45 @@ bool IMuseInternal::isMIDI(int sound) {
return false;
}
+bool IMuseInternal::supportsPercussion(int sound) {
+ byte *ptr = g_scumm->_res->_types[rtSound][sound]._address;
+ if (ptr == NULL)
+ return false;
+
+ uint32 tag = READ_BE_UINT32(ptr);
+ switch (tag) {
+ case MKTAG('A', 'D', 'L', ' '):
+ case MKTAG('A', 'S', 'F', 'X'): // Special AD class for old AdLib sound effects
+ case MKTAG('S', 'P', 'K', ' '):
+ return false;
+
+ case MKTAG('A', 'M', 'I', ' '):
+ case MKTAG('R', 'O', 'L', ' '):
+ return true;
+
+ case MKTAG('M', 'A', 'C', ' '): // Occurs in the Mac version of FOA and MI2
+ // This is MIDI, i.e. uses MIDI style program changes, but without a
+ // special percussion channel.
+ return false;
+
+ case MKTAG('G', 'M', 'D', ' '):
+ case MKTAG('M', 'I', 'D', 'I'): // Occurs in Sam & Max
+ return true;
+ }
+
+ // Old style 'RO' has equivalent properties to 'ROL'
+ if (ptr[0] == 'R' && ptr[1] == 'O')
+ return true;
+ // Euphony tracks show as 'SO' and have equivalent properties to 'ADL'
+ // FIXME: Right now we're pretending it's GM.
+ if (ptr[4] == 'S' && ptr[5] == 'O')
+ return true;
+
+ error("Unknown music type: '%c%c%c%c'", (char)tag >> 24, (char)tag >> 16, (char)tag >> 8, (char)tag);
+
+ return false;
+}
+
MidiDriver *IMuseInternal::getBestMidiDriver(int sound) {
MidiDriver *driver = NULL;
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index 3b0d36e119..846e2d7545 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -204,6 +204,7 @@ protected:
bool _isMT32;
bool _isMIDI;
+ bool _supportsPercussion;
protected:
// Player part
@@ -458,6 +459,7 @@ protected:
byte *findStartOfSound(int sound, int ct = (kMThd | kFORM));
bool isMT32(int sound);
bool isMIDI(int sound);
+ bool supportsPercussion(int sound);
int get_queue_sound_status(int sound) const;
void handle_marker(uint id, byte data);
int get_channel_volume(uint a);
diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp
index 73e7704469..89c16a8bb5 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -27,6 +27,7 @@
#include "common/util.h"
#include "scumm/imuse/imuse_internal.h"
#include "scumm/saveload.h"
+#include "scumm/scumm.h"
namespace Scumm {
@@ -365,7 +366,17 @@ void Part::set_instrument(uint b) {
_bank = (byte)(b >> 8);
if (_bank)
error("Non-zero instrument bank selection. Please report this");
- _instrument.program((byte)b, _player->isMT32());
+ // HACK: Horrible hack to allow tracing of program change source.
+ // The Mac m68k versions of MI2 and Indy4 use a different program "bank"
+ // when it gets program change events through the iMuse SysEx handler.
+ // We emulate this by introducing a special instrument, which sets
+ // the instrument via sysEx_customInstrument. This seems to be
+ // exclusively used for special sound effects like the "spit" sound.
+ if (g_scumm->isMacM68kIMuse()) {
+ _instrument.macSfx(b);
+ } else {
+ _instrument.program((byte)b, _player->isMT32());
+ }
if (clearToTransmit())
_instrument.send(_mc);
}
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 53ccfb3734..3a9c42a920 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -78,6 +78,7 @@ Player::Player() :
_speed(128),
_isMT32(false),
_isMIDI(false),
+ _supportsPercussion(false),
_se(0),
_vol_chan(0) {
}
@@ -103,6 +104,7 @@ bool Player::startSound(int sound, MidiDriver *midi) {
_isMT32 = _se->isMT32(sound);
_isMIDI = _se->isMIDI(sound);
+ _supportsPercussion = _se->supportsPercussion(sound);
_parts = NULL;
_active = true;
@@ -386,6 +388,8 @@ void Player::sysEx(const byte *p, uint16 len) {
// SysEx manufacturer 0x97 has been spotted in the
// Monkey Island 2 AdLib music, so don't make this a
// fatal error. See bug #1481383.
+ // The Macintosh version of Monkey Island 2 simply
+ // ignores these SysEx events too.
if (a == 0)
warning("Unknown SysEx manufacturer 0x00 0x%02X 0x%02X", p[0], p[1]);
else
@@ -1009,6 +1013,7 @@ void Player::fixAfterLoad() {
_parser->jumpToTick(_music_tick); // start_seq_sound already switched tracks
_isMT32 = _se->isMT32(_id);
_isMIDI = _se->isMIDI(_id);
+ _supportsPercussion = _se->supportsPercussion(_id);
}
}
diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp
index 11bb4e7605..61c73b1e2d 100644
--- a/engines/scumm/imuse/instrument.cpp
+++ b/engines/scumm/imuse/instrument.cpp
@@ -278,6 +278,21 @@ private:
byte _instrument[23];
};
+class Instrument_MacSfx : public InstrumentInternal {
+private:
+ byte _program;
+
+public:
+ Instrument_MacSfx(byte program);
+ Instrument_MacSfx(Serializer *s);
+ void saveOrLoad(Serializer *s);
+ void send(MidiChannel *mc);
+ void copy_to(Instrument *dest) { dest->macSfx(_program); }
+ bool is_valid() {
+ return (_program < 128);
+ }
+};
+
////////////////////////////////////////
//
// Instrument class members
@@ -326,6 +341,14 @@ void Instrument::pcspk(const byte *instrument) {
_instrument = new Instrument_PcSpk(instrument);
}
+void Instrument::macSfx(byte prog) {
+ clear();
+ if (prog > 127)
+ return;
+ _type = itMacSfx;
+ _instrument = new Instrument_MacSfx(prog);
+}
+
void Instrument::saveOrLoad(Serializer *s) {
if (s->isSaving()) {
s->saveByte(_type);
@@ -349,6 +372,9 @@ void Instrument::saveOrLoad(Serializer *s) {
case itPcSpk:
_instrument = new Instrument_PcSpk(s);
break;
+ case itMacSfx:
+ _instrument = new Instrument_MacSfx(s);
+ break;
default:
warning("No known instrument classification #%d", (int)_type);
_type = itNone;
@@ -528,4 +554,38 @@ void Instrument_PcSpk::send(MidiChannel *mc) {
mc->sysEx_customInstrument('SPK ', (byte *)&_instrument);
}
+////////////////////////////////////////
+//
+// Instrument_MacSfx class members
+//
+////////////////////////////////////////
+
+Instrument_MacSfx::Instrument_MacSfx(byte program) :
+ _program(program) {
+ if (program > 127) {
+ _program = 255;
+ }
+}
+
+Instrument_MacSfx::Instrument_MacSfx(Serializer *s) {
+ _program = 255;
+ if (!s->isSaving()) {
+ saveOrLoad(s);
+ }
+}
+
+void Instrument_MacSfx::saveOrLoad(Serializer *s) {
+ if (s->isSaving()) {
+ s->saveByte(_program);
+ } else {
+ _program = s->loadByte();
+ }
+}
+
+void Instrument_MacSfx::send(MidiChannel *mc) {
+ if (_program > 127) {
+ return;
+ }
+ mc->sysEx_customInstrument('MAC ', &_program);
+}
} // End of namespace Scumm
diff --git a/engines/scumm/imuse/instrument.h b/engines/scumm/imuse/instrument.h
index a855c64155..7e09e86fa5 100644
--- a/engines/scumm/imuse/instrument.h
+++ b/engines/scumm/imuse/instrument.h
@@ -52,7 +52,8 @@ public:
itProgram = 1,
itAdLib = 2,
itRoland = 3,
- itPcSpk = 4
+ itPcSpk = 4,
+ itMacSfx = 5
};
Instrument() : _type(0), _instrument(0) { }
@@ -72,6 +73,7 @@ public:
void adlib(const byte *instrument);
void roland(const byte *instrument);
void pcspk(const byte *instrument);
+ void macSfx(byte program);
byte getType() { return _type; }
bool isValid() { return (_instrument ? _instrument->is_valid() : false); }
diff --git a/engines/scumm/imuse/mac_m68k.cpp b/engines/scumm/imuse/mac_m68k.cpp
new file mode 100644
index 0000000000..0980ef1fd2
--- /dev/null
+++ b/engines/scumm/imuse/mac_m68k.cpp
@@ -0,0 +1,514 @@
+/* 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 "scumm/imuse/mac_m68k.h"
+
+#include "common/util.h"
+#include "common/macresman.h"
+#include "common/stream.h"
+
+namespace Scumm {
+
+MacM68kDriver::MacM68kDriver(Audio::Mixer *mixer)
+ : MidiDriver_Emulated(mixer) {
+}
+
+MacM68kDriver::~MacM68kDriver() {
+}
+
+int MacM68kDriver::open() {
+ if (_isOpen) {
+ return MERR_ALREADY_OPEN;
+ }
+
+ const int error = MidiDriver_Emulated::open();
+ if (error) {
+ return error;
+ }
+
+ for (uint i = 0; i < ARRAYSIZE(_channels); ++i) {
+ _channels[i].init(this, i);
+ }
+
+ memset(_voiceChannels, 0, sizeof(_voiceChannels));
+ _lastUsedVoiceChannel = 0;
+
+ loadAllInstruments();
+
+ _pitchTable[116] = 1664510;
+ _pitchTable[117] = 1763487;
+ _pitchTable[118] = 1868350;
+ _pitchTable[119] = 1979447;
+ _pitchTable[120] = 2097152;
+ _pitchTable[121] = 2221855;
+ _pitchTable[122] = 2353973;
+ _pitchTable[123] = 2493948;
+ _pitchTable[124] = 2642246;
+ _pitchTable[125] = 2799362;
+ _pitchTable[126] = 2965820;
+ _pitchTable[127] = 3142177;
+ for (int i = 115; i >= 0; --i) {
+ _pitchTable[i] = _pitchTable[i + 12] / 2;
+ }
+
+ _volumeTable = new byte[8192];
+ for (int i = 0; i < 32; ++i) {
+ for (int j = 0; j < 256; ++j) {
+ _volumeTable[i * 256 + j] = ((-128 + j) * _volumeBaseTable[i]) / 127 - 128;
+ }
+ }
+
+ _mixBuffer = 0;
+ _mixBufferLength = 0;
+
+ // We set the output sound type to music here to allow sound volume
+ // adjustment. The drawback here is that we can not control the music and
+ // sfx separately here. But the AdLib output has the same issue so it
+ // should not be that bad.
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+
+ return 0;
+}
+
+void MacM68kDriver::close() {
+ if (!_isOpen) {
+ return;
+ }
+
+ _mixer->stopHandle(_mixerSoundHandle);
+ _isOpen = false;
+ for (InstrumentMap::iterator i = _instruments.begin(); i != _instruments.end(); ++i) {
+ delete[] i->_value.data;
+ }
+ _instruments.clear();
+ delete[] _volumeTable;
+ _volumeTable = 0;
+ delete[] _mixBuffer;
+ _mixBuffer = 0;
+ _mixBufferLength = 0;
+}
+
+void MacM68kDriver::send(uint32 d) {
+ assert(false);
+}
+
+void MacM68kDriver::sysEx_customInstrument(byte channel, uint32 type, const byte *instr) {
+ assert(false);
+}
+
+MidiChannel *MacM68kDriver::allocateChannel() {
+ for (uint i = 0; i < ARRAYSIZE(_channels); ++i) {
+ if (_channels[i].allocate()) {
+ return &_channels[i];
+ }
+ }
+
+ return 0;
+}
+
+MacM68kDriver::Instrument MacM68kDriver::getInstrument(int idx) const {
+ InstrumentMap::const_iterator i = _instruments.find(idx);
+ if (i != _instruments.end()) {
+ return i->_value;
+ } else {
+ return _defaultInstrument;
+ }
+}
+
+void MacM68kDriver::generateSamples(int16 *buf, int len) {
+ int silentChannels = 0;
+
+ if (_mixBufferLength < len) {
+ delete[] _mixBuffer;
+
+ _mixBufferLength = len;
+ _mixBuffer = new int[_mixBufferLength];
+ assert(_mixBuffer);
+ }
+ memset(_mixBuffer, 0, sizeof(int) * _mixBufferLength);
+
+ for (int i = 0; i < kChannelCount; ++i) {
+ OutputChannel &out = _voiceChannels[i].out;
+ if (out.isFinished) {
+ ++silentChannels;
+ continue;
+ }
+
+ byte *volumeTable = &_volumeTable[(out.volume / 4) * 256];
+ int *buffer = _mixBuffer;
+
+ int samplesLeft = len;
+ while (samplesLeft) {
+ out.subPos += out.pitchModifier;
+ while (out.subPos >= 0x10000) {
+ out.subPos -= 0x10000;
+ out.instrument++;
+ }
+
+ if (out.instrument >= out.end) {
+ if (!out.start) {
+ break;
+ }
+
+ out.instrument = out.start;
+ out.subPos = 0;
+ }
+
+ *buffer++ += volumeTable[*out.instrument];
+ --samplesLeft;
+ }
+
+ if (samplesLeft) {
+ out.isFinished = true;
+ while (samplesLeft--) {
+ *buffer++ += 0x80;
+ }
+ }
+ }
+
+ const int *buffer = _mixBuffer;
+ const int silenceAdd = silentChannels << 7;
+ while (len--) {
+ *buf++ = (((*buffer++ + silenceAdd) >> 3) << 8) ^ 0x8000;
+ }
+}
+
+void MacM68kDriver::loadAllInstruments() {
+ Common::MacResManager resource;
+ if (resource.open("iMUSE Setups")) {
+ if (!resource.hasResFork()) {
+ error("MacM68kDriver::loadAllInstruments: \"iMUSE Setups\" loaded, but no resource fork present");
+ }
+
+ for (int i = 0x3E7; i < 0x468; ++i) {
+ Common::SeekableReadStream *stream = resource.getResource(MKTAG('s', 'n', 'd', ' '), i);
+ if (stream) {
+ addInstrument(i, stream);
+ delete stream;
+ }
+ }
+
+ for (int i = 0x7D0; i < 0x8D0; ++i) {
+ Common::SeekableReadStream *stream = resource.getResource(MKTAG('s', 'n', 'd', ' '), i);
+ if (stream) {
+ addInstrument(i, stream);
+ delete stream;
+ }
+ }
+
+ InstrumentMap::iterator inst = _instruments.find(kDefaultInstrument);
+ if (inst != _instruments.end()) {
+ _defaultInstrument = inst->_value;
+ } else {
+ error("MacM68kDriver::loadAllInstruments: Could not load default instrument");
+ }
+ } else {
+ error("MacM68kDriver::loadAllInstruments: Could not load \"iMUSE Setups\"");
+ }
+}
+
+void MacM68kDriver::addInstrument(int idx, Common::SeekableReadStream *data) {
+ // We parse the "SND" files manually here, since we need special data
+ // from their header and need to work on them raw while mixing.
+ data->skip(2);
+ int count = data->readUint16BE();
+ data->skip(2 * (3 * count));
+ count = data->readUint16BE();
+ data->skip(2 * (4 * count));
+
+ Instrument inst;
+ // Skip (optional) pointer to data
+ data->skip(4);
+ inst.length = data->readUint32BE();
+ inst.sampleRate = data->readUint32BE();
+ inst.loopStart = data->readUint32BE();
+ inst.loopEnd = data->readUint32BE();
+ // Skip encoding
+ data->skip(1);
+ inst.baseFrequency = data->readByte();
+
+ inst.data = new byte[inst.length];
+ assert(inst.data);
+ data->read(inst.data, inst.length);
+ _instruments[idx] = inst;
+}
+
+void MacM68kDriver::setPitch(OutputChannel *out, int frequency) {
+ out->frequency = frequency;
+ out->isFinished = false;
+
+ const int pitchIdx = (frequency >> 7) + 60 - out->baseFrequency;
+ assert(pitchIdx >= 0);
+
+ const int low7Bits = frequency & 0x7F;
+ if (low7Bits) {
+ out->pitchModifier = _pitchTable[pitchIdx] + (((_pitchTable[pitchIdx + 1] - _pitchTable[pitchIdx]) * low7Bits) >> 7);
+ } else {
+ out->pitchModifier = _pitchTable[pitchIdx];
+ }
+}
+
+void MacM68kDriver::VoiceChannel::off() {
+ if (out.start) {
+ out.isFinished = true;
+ }
+
+ part->removeVoice(this);
+ part = 0;
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::release() {
+ _allocated = false;
+ while (_voice) {
+ _voice->off();
+ }
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::send(uint32 b) {
+ uint8 type = b & 0xF0;
+ uint8 p1 = (b >> 8) & 0xFF;
+ uint8 p2 = (b >> 16) & 0xFF;
+
+ switch (type) {
+ case 0x80:
+ noteOff(p1);
+ break;
+
+ case 0x90:
+ if (p2) {
+ noteOn(p1, p2);
+ } else {
+ noteOff(p1);
+ }
+ break;
+
+ case 0xB0:
+ controlChange(p1, p2);
+ break;
+
+ case 0xE0:
+ pitchBend((p1 | (p2 << 7)) - 0x2000);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::noteOff(byte note) {
+ for (VoiceChannel *i = _voice; i; i = i->next) {
+ if (i->note == note) {
+ if (_sustain) {
+ i->sustainNoteOff = true;
+ } else {
+ i->off();
+ }
+ }
+ }
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::noteOn(byte note, byte velocity) {
+ // Do not start a not unless there is an instrument set up
+ if (!_instrument.data) {
+ return;
+ }
+
+ // Allocate a voice channel
+ VoiceChannel *voice = _owner->allocateVoice(_priority);
+ if (!voice) {
+ return;
+ }
+ addVoice(voice);
+
+ voice->note = note;
+ // This completly ignores the note's volume, but is in accordance
+ // to the original.
+ voice->out.volume = _volume;
+
+ // Set up the instrument data
+ voice->out.baseFrequency = _instrument.baseFrequency;
+ voice->out.soundStart = _instrument.data;
+ voice->out.soundEnd = _instrument.data + _instrument.length;
+ if (_instrument.loopEnd && _instrument.loopEnd - 12 > _instrument.loopStart) {
+ voice->out.loopStart = _instrument.data + _instrument.loopStart;
+ voice->out.loopEnd = _instrument.data + _instrument.loopEnd;
+ } else {
+ voice->out.loopStart = 0;
+ voice->out.loopEnd = voice->out.soundEnd;
+ }
+
+ voice->out.start = voice->out.loopStart;
+ voice->out.end = voice->out.loopEnd;
+
+ // Set up the pitch
+ _owner->setPitch(&voice->out, (note << 7) + _pitchBend);
+
+ // Set up the sample position
+ voice->out.instrument = voice->out.soundStart;
+ voice->out.subPos = 0;
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::programChange(byte program) {
+ _instrument = _owner->getInstrument(program + kProgramChangeBase);
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::pitchBend(int16 bend) {
+ _pitchBend = (bend * _pitchBendFactor) >> 6;
+ for (VoiceChannel *i = _voice; i; i = i->next) {
+ _owner->setPitch(&i->out, (i->note << 7) + _pitchBend);
+ }
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::controlChange(byte control, byte value) {
+ switch (control) {
+ // volume change
+ case 7:
+ _volume = value;
+ for (VoiceChannel *i = _voice; i; i = i->next) {
+ i->out.volume = value;
+ i->out.isFinished = false;
+ }
+ break;
+
+ // sustain
+ case 64:
+ _sustain = value;
+ if (!_sustain) {
+ for (VoiceChannel *i = _voice; i; i = i->next) {
+ if (i->sustainNoteOff) {
+ i->off();
+ }
+ }
+ }
+ break;
+
+ // all notes off
+ case 123:
+ for (VoiceChannel *i = _voice; i; i = i->next) {
+ i->off();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::pitchBendFactor(byte value) {
+ _pitchBendFactor = value;
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::priority(byte value) {
+ _priority = value;
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::sysEx_customInstrument(uint32 type, const byte *instr) {
+ assert(instr);
+ if (type == 'MAC ') {
+ _instrument = _owner->getInstrument(*instr + kSysExBase);
+ }
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::init(MacM68kDriver *owner, byte channel) {
+ _owner = owner;
+ _number = channel;
+ _allocated = false;
+}
+
+bool MacM68kDriver::MidiChannel_MacM68k::allocate() {
+ if (_allocated) {
+ return false;
+ }
+
+ _allocated = true;
+ _voice = 0;
+ _priority = 0;
+ memset(&_instrument, 0, sizeof(_instrument));
+ _pitchBend = 0;
+ _pitchBendFactor = 0;
+ _volume = 0;
+ return true;
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::addVoice(VoiceChannel *voice) {
+ voice->next = _voice;
+ voice->prev = 0;
+ voice->part = this;
+ if (_voice) {
+ _voice->prev = voice;
+ }
+ _voice = voice;
+}
+
+void MacM68kDriver::MidiChannel_MacM68k::removeVoice(VoiceChannel *voice) {
+ VoiceChannel *i = _voice;
+ while (i && i != voice) {
+ i = i->next;
+ }
+
+ if (i) {
+ if (i->next) {
+ i->next->prev = i->prev;
+ }
+
+ if (i->prev) {
+ i->prev->next = i->next;
+ } else {
+ _voice = i->next;
+ }
+ }
+}
+
+MacM68kDriver::VoiceChannel *MacM68kDriver::allocateVoice(int priority) {
+ VoiceChannel *channel = 0;
+ for (int i = 0; i < kChannelCount; ++i) {
+ if (++_lastUsedVoiceChannel == kChannelCount) {
+ _lastUsedVoiceChannel = 0;
+ }
+
+ VoiceChannel *cur = &_voiceChannels[_lastUsedVoiceChannel];
+ if (!cur->part) {
+ memset(cur, 0, sizeof(*cur));
+ return cur;
+ } else if (!cur->next) {
+ if (cur->part->_priority <= priority) {
+ priority = cur->part->_priority;
+ channel = cur;
+ }
+ }
+ }
+
+ if (channel) {
+ channel->off();
+ memset(channel, 0, sizeof(*channel));
+ }
+
+ return channel;
+}
+
+const int MacM68kDriver::_volumeBaseTable[32] = {
+ 0, 0, 1, 1, 2, 3, 5, 6,
+ 8, 11, 13, 16, 19, 22, 26, 30,
+ 34, 38, 43, 48, 53, 58, 64, 70,
+ 76, 83, 89, 96, 104, 111, 119, 127
+};
+
+} // End of namespace Scumm
diff --git a/engines/scumm/imuse/mac_m68k.h b/engines/scumm/imuse/mac_m68k.h
new file mode 100644
index 0000000000..59e2f68b9b
--- /dev/null
+++ b/engines/scumm/imuse/mac_m68k.h
@@ -0,0 +1,177 @@
+/* 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 SCUMM_IMUSE_MAC_M68K_H
+#define SCUMM_IMUSE_MAC_M68K_H
+
+#include "audio/softsynth/emumidi.h"
+
+#include "common/hashmap.h"
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Scumm {
+
+class MacM68kDriver : public MidiDriver_Emulated {
+ friend class MidiChannel_MacM68k;
+public:
+ MacM68kDriver(Audio::Mixer *mixer);
+ ~MacM68kDriver();
+
+ virtual int open();
+ virtual void close();
+
+ virtual void send(uint32 d);
+ virtual void sysEx_customInstrument(byte channel, uint32 type, const byte *instr);
+
+ virtual MidiChannel *allocateChannel();
+ virtual MidiChannel *getPercussionChannel() { return 0; }
+
+ virtual bool isStereo() const { return false; }
+ virtual int getRate() const {
+ // The original is using a frequency of approx. 22254.54546 here.
+ // To be precise it uses the 16.16 fixed point value 0x56EE8BA3.
+ return 22254;
+ }
+
+protected:
+ virtual void generateSamples(int16 *buf, int len);
+ virtual void onTimer() {}
+
+private:
+ int *_mixBuffer;
+ int _mixBufferLength;
+
+ struct Instrument {
+ uint length;
+ uint sampleRate;
+ uint loopStart;
+ uint loopEnd;
+ int baseFrequency;
+
+ byte *data;
+ };
+
+ enum {
+ kDefaultInstrument = 0x3E7,
+ kProgramChangeBase = 0x3E8,
+ kSysExBase = 0x7D0
+ };
+
+ Instrument getInstrument(int idx) const;
+ typedef Common::HashMap<int, Instrument> InstrumentMap;
+ InstrumentMap _instruments;
+ Instrument _defaultInstrument;
+ void loadAllInstruments();
+ void addInstrument(int idx, Common::SeekableReadStream *data);
+
+ struct OutputChannel {
+ int pitchModifier;
+
+ const byte *instrument;
+ uint subPos;
+
+ const byte *start;
+ const byte *end;
+
+ const byte *soundStart;
+ const byte *soundEnd;
+ const byte *loopStart;
+ const byte *loopEnd;
+
+ int frequency;
+ int volume;
+
+ bool isFinished;
+
+ int baseFrequency;
+ };
+
+ void setPitch(OutputChannel *out, int frequency);
+ int _pitchTable[128];
+
+ byte *_volumeTable;
+ static const int _volumeBaseTable[32];
+
+ class MidiChannel_MacM68k;
+
+ struct VoiceChannel {
+ MidiChannel_MacM68k *part;
+ VoiceChannel *prev, *next;
+ int channel;
+ int note;
+ bool sustainNoteOff;
+ OutputChannel out;
+
+ void off();
+ };
+
+ class MidiChannel_MacM68k : public MidiChannel {
+ friend class MacM68kDriver;
+ public:
+ virtual MidiDriver *device() { return _owner; }
+ virtual byte getNumber() { return _number; }
+ virtual void release();
+
+ virtual void send(uint32 b);
+ virtual void noteOff(byte note);
+ virtual void noteOn(byte note, byte velocity);
+ virtual void programChange(byte program);
+ virtual void pitchBend(int16 bend);
+ virtual void controlChange(byte control, byte value);
+ virtual void pitchBendFactor(byte value);
+ virtual void priority(byte value);
+ virtual void sysEx_customInstrument(uint32 type, const byte *instr);
+
+ void init(MacM68kDriver *owner, byte channel);
+ bool allocate();
+
+ void addVoice(VoiceChannel *voice);
+ void removeVoice(VoiceChannel *voice);
+ private:
+ MacM68kDriver *_owner;
+ bool _allocated;
+ int _number;
+
+ VoiceChannel *_voice;
+ int _priority;
+ int _sustain;
+ Instrument _instrument;
+ int _pitchBend;
+ int _pitchBendFactor;
+ int _volume;
+ };
+
+ MidiChannel_MacM68k _channels[32];
+
+ enum {
+ kChannelCount = 8
+ };
+ VoiceChannel _voiceChannels[kChannelCount];
+ int _lastUsedVoiceChannel;
+ VoiceChannel *allocateVoice(int priority);
+};
+
+} // End of namespace Scumm
+
+#endif
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index 85ffc86f47..8f230ebac3 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -71,7 +71,7 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
part->set_pri(buf[2]);
part->volume(buf[3]);
part->set_pan(buf[4]);
- part->_percussion = player->_isMIDI ? ((buf[5] & 0x80) > 0) : false;
+ part->_percussion = player->_supportsPercussion ? ((buf[5] & 0x80) > 0) : false;
part->set_transpose(buf[5]);
part->set_detune(buf[6]);
part->pitchBendFactor(buf[7]);
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.h b/engines/scumm/imuse_digi/dimuse_sndmgr.h
index f869c62eb5..ff6281d5e3 100644
--- a/engines/scumm/imuse_digi/dimuse_sndmgr.h
+++ b/engines/scumm/imuse_digi/dimuse_sndmgr.h
@@ -47,7 +47,7 @@ public:
private:
struct Region {
int32 offset; // offset of region
- int32 length; // lenght of region
+ int32 length; // length of region
};
struct Jump {
diff --git a/engines/scumm/insane/insane_scenes.cpp b/engines/scumm/insane/insane_scenes.cpp
index 6db1cb5059..db0b0171bc 100644
--- a/engines/scumm/insane/insane_scenes.cpp
+++ b/engines/scumm/insane/insane_scenes.cpp
@@ -1386,7 +1386,7 @@ void Insane::postCase12(byte *renderBitmap, int32 codecparam, int32 setupsan12,
break;
case EN_TORQUE:
turnBen(false);
- if (_actor[1].y != 300)
+ if (_actor[1].y == 300)
prepareScenePropScene(57, 1, 0);
break;
default:
diff --git a/engines/scumm/midiparser_ro.cpp b/engines/scumm/midiparser_ro.cpp
index 1a31d1ca82..8549a9262d 100644
--- a/engines/scumm/midiparser_ro.cpp
+++ b/engines/scumm/midiparser_ro.cpp
@@ -62,13 +62,13 @@ void MidiParser_RO::parseNextEvent (EventInfo &info) {
info.delta = 0;
do {
- info.start = _position._play_pos;
- info.event = *(_position._play_pos++);
+ info.start = _position._playPos;
+ info.event = *(_position._playPos++);
if (info.command() == 0xA) {
++_lastMarkerCount;
info.event = 0xF0;
} else if (info.event == 0xF0 || info.event == 0xF1) {
- byte delay = *(_position._play_pos++);
+ byte delay = *(_position._playPos++);
info.delta += delay;
if (info.event == 0xF1) {
// This event is, as far as we have been able
@@ -95,16 +95,16 @@ void MidiParser_RO::parseNextEvent (EventInfo &info) {
if (info.event < 0x80)
return;
- _position._running_status = info.event;
+ _position._runningStatus = info.event;
switch (info.command()) {
case 0xC:
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
case 0x8: case 0x9: case 0xB:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
if (info.command() == 0x9 && info.basic.param2 == 0)
info.event = info.channel() | 0x80;
info.length = 0;
@@ -133,7 +133,7 @@ bool MidiParser_RO::loadMusic (byte *data, uint32 size) {
return false;
}
- _num_tracks = 1;
+ _numTracks = 1;
_ppqn = 120;
_tracks[0] = pos + 2;
_markerCount = _lastMarkerCount = 0;
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index 1f219f5187..8499c9bad3 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -27,6 +27,7 @@ MODULE_OBJS := \
imuse/imuse_part.o \
imuse/imuse_player.o \
imuse/instrument.o \
+ imuse/mac_m68k.o \
imuse/pcspk.o \
imuse/sysex_samnmax.o \
imuse/sysex_scumm.o \
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index 399cd91324..77c75c4ad6 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -335,7 +335,7 @@ int ScummEngine::whereIsObject(int object) const {
return WIO_NOT_FOUND;
if ((_game.version != 0 || OBJECT_V0_TYPE(object) == 0) &&
- _objectOwnerTable[object] != OF_OWNER_ROOM)
+ _objectOwnerTable[object] != OF_OWNER_ROOM)
{
for (i = 0; i < _numInventory; i++)
if (_inventory[i] == object)
@@ -1225,7 +1225,7 @@ byte *ScummEngine::getOBCDFromObject(int obj, bool v0CheckInventory) {
byte *ptr;
if ((_game.version != 0 || OBJECT_V0_TYPE(obj) == 0) &&
- _objectOwnerTable[obj] != OF_OWNER_ROOM)
+ _objectOwnerTable[obj] != OF_OWNER_ROOM)
{
if (_game.version == 0 && !v0CheckInventory)
return 0;
diff --git a/engines/scumm/player_apple2.cpp b/engines/scumm/player_apple2.cpp
index a8e150caa9..58e4f78a94 100644
--- a/engines/scumm/player_apple2.cpp
+++ b/engines/scumm/player_apple2.cpp
@@ -61,8 +61,8 @@ public:
private:
void _update(int interval /*a*/, int count /*y*/) { // D076
- assert(interval > 0); // 0 == 256?
- assert(count > 0); // 0 == 256?
+ assert(interval > 0); // 0 == 256?
+ assert(count > 0); // 0 == 256?
for (; count >= 0; --count) {
_player->speakerToggle();
@@ -99,7 +99,7 @@ public:
++_pos;
return false;
- }
+ }
return true;
}
@@ -112,7 +112,7 @@ private:
assert(interval > 0); // 0 == 256?
int a = (interval >> 3) + count;
- for (int y = a; y > 0; --y) {
+ for (int y = a; y > 0; --y) {
_player->generateSamples(1292 - 5*interval);
_player->speakerToggle();
@@ -206,7 +206,7 @@ private:
_bitmask1 = 0x3;
_bitmask2 = 0x3;
-
+
_updateInterval2 = param0;
if (_updateInterval2 == 0)
_bitmask2 = 0x0;
@@ -234,9 +234,9 @@ private:
if (_updateRemain2 == 0) {
_updateRemain2 = _updateInterval2;
- // use only first voice's data (bitmask1) if both voices are triggered
+ // use only first voice's data (bitmask1) if both voices are triggered
if (_updateRemain1 != 0) {
- _speakerShiftReg ^= _bitmask2;
+ _speakerShiftReg ^= _bitmask2;
}
}
@@ -256,7 +256,7 @@ private:
protected:
const byte *_params;
-
+
byte _updateRemain1;
byte _updateRemain2;
@@ -309,7 +309,7 @@ private:
for (int i = count; i > 0; --i) {
_player->generateSamples(10 + 5*interval);
_player->speakerToggle();
-
+
_player->generateSamples(5 + 5*interval);
_player->speakerToggle();
}
@@ -332,20 +332,20 @@ private:
// LD000[loc] ^ LD00A[loc]
const byte AppleII_SoundFunction5_Noise::_noiseTable[256] = {
- 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63,
- 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c,
- 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc,
- 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64,
+ 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63,
+ 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c,
+ 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc,
+ 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64,
0xe5, 0xb5, 0x5d, 0xe0, 0xb7, 0x7d, 0xe9, 0x8c, 0x55, 0x65, 0xc5, 0xb5, 0x5d, 0xd8, 0x09, 0x0d,
- 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3,
- 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a,
- 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d,
- 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c,
+ 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3,
+ 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a,
+ 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d,
+ 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c,
0x0a, 0x5d, 0x1d, 0x61, 0x10, 0x3c, 0x0b, 0x19, 0x88, 0x21, 0xc0, 0x21, 0x07, 0x00, 0x65, 0x62,
- 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06,
- 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d,
- 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48,
- 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37,
+ 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06,
+ 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d,
+ 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48,
+ 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37,
0x19, 0x37, 0x00, 0xf1, 0x00, 0x01, 0x1f, 0x00, 0xad, 0xc1, 0x01, 0x01, 0x2e, 0x00, 0x40, 0xc6,
0x7a, 0x9b, 0x95, 0x43, 0xfc, 0x18, 0xd2, 0x9e, 0x2a, 0x5a, 0x4b, 0x2a, 0xb6, 0x87, 0x30, 0x6c
};
@@ -394,20 +394,20 @@ void Player_AppleII::startSound(int nr) {
case 0: // empty (nothing to play)
resetState();
return;
- case 1:
- _soundFunc = new AppleII_SoundFunction1_FreqUpDown();
+ case 1:
+ _soundFunc = new AppleII_SoundFunction1_FreqUpDown();
break;
- case 2:
- _soundFunc = new AppleII_SoundFunction2_SymmetricWave();
+ case 2:
+ _soundFunc = new AppleII_SoundFunction2_SymmetricWave();
break;
- case 3:
- _soundFunc = new AppleII_SoundFunction3_AsymmetricWave();
+ case 3:
+ _soundFunc = new AppleII_SoundFunction3_AsymmetricWave();
break;
- case 4:
- _soundFunc = new AppleII_SoundFunction4_Polyphone();
+ case 4:
+ _soundFunc = new AppleII_SoundFunction4_Polyphone();
break;
- case 5:
- _soundFunc = new AppleII_SoundFunction5_Noise();
+ case 5:
+ _soundFunc = new AppleII_SoundFunction5_Noise();
break;
}
_soundFunc->init(this, _params);
@@ -484,7 +484,7 @@ int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) {
// toggle speaker on/off
void Player_AppleII::speakerToggle() {
- _speakerState ^= 0x1;
+ _speakerState ^= 0x1;
}
void Player_AppleII::generateSamples(int cycles) {
@@ -492,8 +492,8 @@ void Player_AppleII::generateSamples(int cycles) {
}
void Player_AppleII::wait(int interval, int count /*y*/) {
- assert(count > 0); // 0 == 256?
- assert(interval > 0); // 0 == 256?
+ assert(count > 0); // 0 == 256?
+ assert(interval > 0); // 0 == 256?
generateSamples(11 + count*(8 + 5 * interval));
}
diff --git a/engines/scumm/player_apple2.h b/engines/scumm/player_apple2.h
index b4a7d409fb..e1ec9d8946 100644
--- a/engines/scumm/player_apple2.h
+++ b/engines/scumm/player_apple2.h
@@ -36,7 +36,7 @@ namespace Scumm {
class ScummEngine;
/*
- * Optimized for use with periodical read/write phases when the buffer
+ * Optimized for use with periodical read/write phases when the buffer
* is filled in a write phase and completely read in a read phase.
* The growing strategy is optimized for repeated small (e.g. 2 bytes)
* single writes resulting in large buffers
@@ -133,7 +133,7 @@ static const double APPLEII_CPU_CLOCK = 1020484.5; // ~ 1.02 MHz
/*
* Converts the 1-bit speaker state values into audio samples.
- * This is done by aggregation of the speaker states at each
+ * This is done by aggregation of the speaker states at each
* CPU cycle in a sampling period into an audio sample.
*/
class SampleConverter {
@@ -144,7 +144,7 @@ private:
}
public:
- SampleConverter() :
+ SampleConverter() :
_cyclesPerSampleFP(0),
_missingCyclesFP(0),
_sampleCyclesSumFP(0),
@@ -156,7 +156,7 @@ public:
void reset() {
_missingCyclesFP = 0;
_sampleCyclesSumFP = 0;
- _buffer.clear();
+ _buffer.clear();
}
uint32 availableSize() const {
@@ -245,7 +245,7 @@ public:
virtual void setMusicVolume(int vol) { _sampleConverter.setMusicVolume(vol); }
void setSampleRate(int rate) {
_sampleRate = rate;
- _sampleConverter.setSampleRate(rate);
+ _sampleConverter.setSampleRate(rate);
}
virtual void startSound(int sound);
virtual void stopSound(int sound);
diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/player_towns.cpp
index 2588026e59..33e3e40e39 100644
--- a/engines/scumm/player_towns.cpp
+++ b/engines/scumm/player_towns.cpp
@@ -87,7 +87,7 @@ void Player_Towns::restoreAfterLoad() {
if (!_v2)
restoredSounds.push_back(_pcmCurrentSound[i].index);
-
+
uint8 *ptr = _vm->getResourceAddress(rtSound, _pcmCurrentSound[i].index);
if (!ptr)
continue;
diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp
index d4b21774ed..c1242e0645 100644
--- a/engines/scumm/player_v2cms.cpp
+++ b/engines/scumm/player_v2cms.cpp
@@ -718,38 +718,38 @@ void Player_V2CMS::playMusicChips(const MusicChip *table) {
}
const Player_V2CMS::MidiNote Player_V2CMS::_midiNotes[132] = {
- { 3, 0 }, { 31, 0 }, { 58, 0 }, { 83, 0 },
- { 107, 0 }, { 130, 0 }, { 151, 0 }, { 172, 0 },
- { 191, 0 }, { 209, 0 }, { 226, 0 }, { 242, 0 },
- { 3, 1 }, { 31, 1 }, { 58, 1 }, { 83, 1 },
- { 107, 1 }, { 130, 1 }, { 151, 1 }, { 172, 1 },
- { 191, 1 }, { 209, 1 }, { 226, 1 }, { 242, 1 },
- { 3, 2 }, { 31, 2 }, { 58, 2 }, { 83, 2 },
- { 107, 2 }, { 130, 2 }, { 151, 2 }, { 172, 2 },
- { 191, 2 }, { 209, 2 }, { 226, 2 }, { 242, 2 },
- { 3, 3 }, { 31, 3 }, { 58, 3 }, { 83, 3 },
- { 107, 3 }, { 130, 3 }, { 151, 3 }, { 172, 3 },
- { 191, 3 }, { 209, 3 }, { 226, 3 }, { 242, 3 },
- { 3, 4 }, { 31, 4 }, { 58, 4 }, { 83, 4 },
- { 107, 4 }, { 130, 4 }, { 151, 4 }, { 172, 4 },
- { 191, 4 }, { 209, 4 }, { 226, 4 }, { 242, 4 },
- { 3, 5 }, { 31, 5 }, { 58, 5 }, { 83, 5 },
- { 107, 5 }, { 130, 5 }, { 151, 5 }, { 172, 5 },
- { 191, 5 }, { 209, 5 }, { 226, 5 }, { 242, 5 },
- { 3, 6 }, { 31, 6 }, { 58, 6 }, { 83, 6 },
- { 107, 6 }, { 130, 6 }, { 151, 6 }, { 172, 6 },
- { 191, 6 }, { 209, 6 }, { 226, 6 }, { 242, 6 },
- { 3, 7 }, { 31, 7 }, { 58, 7 }, { 83, 7 },
- { 107, 7 }, { 130, 7 }, { 151, 7 }, { 172, 7 },
- { 191, 7 }, { 209, 7 }, { 226, 7 }, { 242, 7 },
- { 3, 8 }, { 31, 8 }, { 58, 8 }, { 83, 8 },
- { 107, 8 }, { 130, 8 }, { 151, 8 }, { 172, 8 },
- { 191, 8 }, { 209, 8 }, { 226, 8 }, { 242, 8 },
- { 3, 9 }, { 31, 9 }, { 58, 9 }, { 83, 9 },
- { 107, 9 }, { 130, 9 }, { 151, 9 }, { 172, 9 },
- { 191, 9 }, { 209, 9 }, { 226, 9 }, { 242, 9 },
- { 3, 10 }, { 31, 10 }, { 58, 10 }, { 83, 10 },
- { 107, 10 }, { 130, 10 }, { 151, 10 }, { 172, 10 },
+ { 3, 0 }, { 31, 0 }, { 58, 0 }, { 83, 0 },
+ { 107, 0 }, { 130, 0 }, { 151, 0 }, { 172, 0 },
+ { 191, 0 }, { 209, 0 }, { 226, 0 }, { 242, 0 },
+ { 3, 1 }, { 31, 1 }, { 58, 1 }, { 83, 1 },
+ { 107, 1 }, { 130, 1 }, { 151, 1 }, { 172, 1 },
+ { 191, 1 }, { 209, 1 }, { 226, 1 }, { 242, 1 },
+ { 3, 2 }, { 31, 2 }, { 58, 2 }, { 83, 2 },
+ { 107, 2 }, { 130, 2 }, { 151, 2 }, { 172, 2 },
+ { 191, 2 }, { 209, 2 }, { 226, 2 }, { 242, 2 },
+ { 3, 3 }, { 31, 3 }, { 58, 3 }, { 83, 3 },
+ { 107, 3 }, { 130, 3 }, { 151, 3 }, { 172, 3 },
+ { 191, 3 }, { 209, 3 }, { 226, 3 }, { 242, 3 },
+ { 3, 4 }, { 31, 4 }, { 58, 4 }, { 83, 4 },
+ { 107, 4 }, { 130, 4 }, { 151, 4 }, { 172, 4 },
+ { 191, 4 }, { 209, 4 }, { 226, 4 }, { 242, 4 },
+ { 3, 5 }, { 31, 5 }, { 58, 5 }, { 83, 5 },
+ { 107, 5 }, { 130, 5 }, { 151, 5 }, { 172, 5 },
+ { 191, 5 }, { 209, 5 }, { 226, 5 }, { 242, 5 },
+ { 3, 6 }, { 31, 6 }, { 58, 6 }, { 83, 6 },
+ { 107, 6 }, { 130, 6 }, { 151, 6 }, { 172, 6 },
+ { 191, 6 }, { 209, 6 }, { 226, 6 }, { 242, 6 },
+ { 3, 7 }, { 31, 7 }, { 58, 7 }, { 83, 7 },
+ { 107, 7 }, { 130, 7 }, { 151, 7 }, { 172, 7 },
+ { 191, 7 }, { 209, 7 }, { 226, 7 }, { 242, 7 },
+ { 3, 8 }, { 31, 8 }, { 58, 8 }, { 83, 8 },
+ { 107, 8 }, { 130, 8 }, { 151, 8 }, { 172, 8 },
+ { 191, 8 }, { 209, 8 }, { 226, 8 }, { 242, 8 },
+ { 3, 9 }, { 31, 9 }, { 58, 9 }, { 83, 9 },
+ { 107, 9 }, { 130, 9 }, { 151, 9 }, { 172, 9 },
+ { 191, 9 }, { 209, 9 }, { 226, 9 }, { 242, 9 },
+ { 3, 10 }, { 31, 10 }, { 58, 10 }, { 83, 10 },
+ { 107, 10 }, { 130, 10 }, { 151, 10 }, { 172, 10 },
{ 191, 10 }, { 209, 10 }, { 226, 10 }, { 242, 10 }
};
diff --git a/engines/scumm/proc3ARM.s b/engines/scumm/proc3ARM.s
index 5833bcf90b..75dd4b4a7f 100644
--- a/engines/scumm/proc3ARM.s
+++ b/engines/scumm/proc3ARM.s
@@ -25,37 +25,40 @@
.global _ClassicProc3RendererShadowARM
-.set _scaleIndexY , 112
-.set _numStrips , 108
-.set _palette , 104
-.set _shadow_table , 100
-.set _scaleIndexX , 96
-.set _scaleX , 92
-.set _height , 88
-.set store_r14 , 84
-.set store_r11 , 80
-.set store_r10 , 76
-.set store_r9 , 72
-.set store_r8 , 68
-.set store_r7 , 64
-.set store_r6 , 60
-.set store_r5 , 56
-.set store_r4 , 52
-.set src , 48
-.set height , 44
-.set len , 40
-.set v1_shr , 36
-.set v1_skip_width , 32
-.set v1_destptr , 28
-.set v1_scaleXstep , 24
-.set v1_mask_ptr , 20
-.set v1_y , 16
-.set v1_scaletable , 12
-.set pitch , 8
-.set scaleIdxXPtr , 4
-.set scaleIdxYPtr , 0
-.set space , 48
+.set space, 48
+
+.set _scaleIndexY, store_r14 + 28
+.set _numStrips, store_r14 + 24
+.set _palette, store_r14 + 20
+.set _shadow_table, store_r14 + 16
+.set _scaleIndexX, store_r14 + 12
+.set _scaleX, store_r14 + 8
+.set _height, store_r14 + 4
+
+.set store_r14, space + 36
+.set store_r11, space + 32
+.set store_r10, space + 28
+.set store_r9, space + 24
+.set store_r8, space + 20
+.set store_r7, space + 16
+.set store_r6, space + 12
+.set store_r5, space + 8
+.set store_r4, space + 4
+
+.set src, 48
+.set height, 44
+.set len, 40
+.set v1_shr, 36
+.set v1_skip_width, 32
+.set v1_destptr, 28
+.set v1_scaleXstep, 24
+.set v1_mask_ptr, 20
+.set v1_y, 16
+.set v1_scaletable, 12
+.set pitch, 8
+.set scaleIdxXPtr, 4
+.set scaleIdxYPtr, 0
@ r0 = _scaleY
@ r1 = v1
@@ -103,7 +106,7 @@ _ClassicProc3RendererShadowARM:
LDRB r1, [r1,#30] @ r1 = repcolor
STR r8, [r13,#v1_shr]
STR r9, [r13,#v1_destptr]
- STR r10,[r13,#v1_mask_ptr]
+ STR r10,[r13,#v1_mask_ptr]
STR r11,[r13,#v1_scaleXstep]
LDR r12,[r13,#_height]
@@ -123,10 +126,10 @@ _ClassicProc3RendererShadowARM:
@ r12= _height
@ r14= v1.replen
- MOV r8,#0x80
+ MOV r8,#0x80
AND r11,r3,#7 @ r11= v1.x & 7
MOV r8,r8,LSR r11 @ r8 = maskbit = revBitMask(v1.x & 7)
- ADD r10,r10,r3,ASR #3 @ r10= mask = v1.mask_ptr + (v1.x>>3)
+ ADD r10,r10,r3,ASR #3 @ r10= mask = v1.mask_ptr + (v1.x>>3)
@ r0 = _scaleY
@ r1 = color = v1.repcolor
@@ -152,7 +155,8 @@ _ClassicProc3RendererShadowARM:
SUB r14,r14,r5
STR r12,[r13,#height]
STR r14,[r13,#len]
- LDR r12,[r13,#pitch]
+ LDR r12,[r13,#pitch]
+ LDR r11,[r13,#_numStrips]
B startpos
outerloop:
@@ -173,13 +177,13 @@ outerloop:
LDR r11,[r13,#src]
LDR r5,[r13,#v1_shr]
- @ stall
+ @ stall
LDRB r14,[r11],#1 @ r14= len = *src++
@ stall
@ stall
MOV r1, r14,LSR r5 @ r1 = color = len>>v1.shr
- BICS r14,r14,r1,LSL r5 @ r14= len
- LDREQB r14,[r11],#1 @ if (!len) r14 = len = *src++
+ BICS r14,r14,r1,LSL r5 @ r14= len
+ LDREQB r14,[r11],#1 @ if (!len) r14 = len = *src++
STR r11,[r13,#src]
CMP r14,#0
middleloop:
@@ -231,13 +235,13 @@ innerloop:
CMPLE r0,r14 @ || _scaleY >= r14
BLE startpos
- LDRB r14,[r10],r11 @ r14 = mask[0] mask += _numStrips
- ADDS r4,r4,#1 @ y >= 0 (equiv to y>-1,y+1>0)
+ ADDS r4,r4,#1 @ y >= 0 (equiv to y>-1,y+1>0)
CMPGT r1,#0 @ && color > 0
CMPGT r6,r4 @ && _out.h+1 > y+1
CMNGT r3,#1 @ && x >= 0 (equiv to x>-1,x+1>0)
CMPGT r7,r3 @ && _out.w > x
BLE masked
+ LDRB r14,[r10] @ r14 = mask[0]
TST r14,r8 @ && !(mask[0] && maskbit)
LDREQ r14,[r13,#_palette]
BNE masked
@@ -247,15 +251,16 @@ innerloop:
@ stall
@ stall
CMP r14,#13 @ if (pcolor == 13)
- LDREQ r12,[r13,#_shadow_table]
+ LDREQ r12,[r13,#_shadow_table]
LDREQB r14,[r9] @ r14 = *dst
@ stallEQ
@ stallEQ
LDREQB r14,[r12,r14] @ r14 = pcolor=_shadow_tab[r14]
- LDREQ r12,[r13,#pitch]
+ LDREQ r12,[r13,#pitch]
@ stallEQ
STRB r14,[r9] @ *dst = pcolor
masked:
+ ADD r10,r10,r11 @ mask += _numStrips
ADD r9,r9,r12 @ dst += _out.pitch
startpos:
SUBS r5,r5,#1 @ loopCount -=1
@@ -280,7 +285,7 @@ startpos:
BLE noXstep
SUB r11,r7,#1
- ADDS r3,r3,r12 @ v1.x += v1.scaleXstep
+ ADDS r3,r3,r12 @ v1.x += v1.scaleXstep
@ if v1.x < 0 ||
CMPGE r11,r3 @ _out.w-1 < v1.x
BLT end
@@ -295,7 +300,7 @@ noXstep:
LDR r12,[r13,#_height] @ r12= height = _height
LDR r4,[r13,#v1_y] @ r4 = y = v1.y
LDR r2,[r13,#scaleIdxYPtr] @ r2 = v1.scaletable[sclIdxY]
- ADD r10,r10,r3,ASR #3 @ mask=v1.mask_ptr+(v1.x>>3)
+ ADD r10,r10,r3,ASR #3 @ mask=v1.mask_ptr+(v1.x>>3)
notheight:
CMP r14,#0 @ while (len > 0)
BGT middleloop
@@ -303,5 +308,5 @@ notheight:
end:
LDR r0,[r13,#v1_scaletable]
SUB r0,r2,r0
- ADD r13,r13,#space
+ ADD r13,r13,#space
LDMFD r13!,{r3-r11,PC}
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index beac077fd1..72896e097a 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1298,7 +1298,7 @@ void ScummEngine::saveOrLoad(Serializer *s) {
s->saveLoadArrayOf(_16BitPalette, 512, sizeof(_16BitPalette[0]), sleUint16);
}
-
+
// FM-Towns specific (extra palette data, color cycle data, etc.)
// In earlier save game versions (below 87) the FM-Towns specific data would get saved (and loaded) even in non FM-Towns games.
// This would cause an unnecessary save file incompatibility between DS (which uses the DISABLE_TOWNS_DUAL_LAYER_MODE setting)
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index d5f7ea526e..a640bc1e17 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 92
+#define CURRENT_VER 93
/**
* An auxillary macro, used to specify savegame versions. We use this instead
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 39420ee974..d8c4948ea8 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -250,7 +250,7 @@ void ScummEngine::stopScript(int script) {
if (vm.nest[i].number == script &&
(vm.nest[i].where == WIO_GLOBAL || vm.nest[i].where == WIO_LOCAL)) {
nukeArrays(vm.nest[i].slot);
- vm.nest[i].number = 0xFF;
+ vm.nest[i].number = 0;
vm.nest[i].slot = 0xFF;
vm.nest[i].where = 0xFF;
}
@@ -284,7 +284,7 @@ void ScummEngine::stopObjectScript(int script) {
if (vm.nest[i].number == script &&
(vm.nest[i].where == WIO_ROOM || vm.nest[i].where == WIO_INVENTORY || vm.nest[i].where == WIO_FLOBJECT)) {
nukeArrays(vm.nest[i].slot);
- vm.nest[i].number = 0xFF;
+ vm.nest[i].number = 0;
vm.nest[i].slot = 0xFF;
vm.nest[i].where = 0xFF;
}
@@ -318,7 +318,7 @@ void ScummEngine::runScriptNested(int script) {
nest = &vm.nest[vm.numNestedScripts];
if (_currentScript == 0xFF) {
- nest->number = 0xFF;
+ nest->number = 0;
nest->where = 0xFF;
} else {
// Store information about the currently running script
@@ -338,7 +338,7 @@ void ScummEngine::runScriptNested(int script) {
if (vm.numNestedScripts != 0)
vm.numNestedScripts--;
- if (nest->number != 0xFF) {
+ if (nest->number) {
// Try to resume the script which called us, if its status has not changed
// since it invoked us. In particular, we only resume it if it hasn't been
// stopped in the meantime, and if it did not already move on.
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 45901186cd..361287d29f 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -471,7 +471,7 @@ void ScummEngine_v0::drawSentenceLine() {
actorName = " ";
} else {
Actor *a = derefActor(actorId, "drawSentenceLine");
- actorName = (char *)a->getActorName();
+ actorName = (const char *)a->getActorName();
}
_sentenceBuf += Common::String::format("%-13s", actorName);
}
@@ -602,7 +602,7 @@ void ScummEngine_v0::o_loadRoomWithEgo() {
x = r.x;
y = r.y;
a->putActor(x, y, _currentRoom);
-
+
camera._dest.x = camera._cur.x = a->getPos().x;
setCameraAt(a->getPos().x, a->getPos().y);
setCameraFollows(a);
@@ -635,18 +635,18 @@ void ScummEngine_v0::setMode(byte mode) {
case kModeCutscene:
_redrawSentenceLine = false;
// Note: do not change freeze state here
- state = USERSTATE_SET_IFACE |
+ state = USERSTATE_SET_IFACE |
USERSTATE_SET_CURSOR;
break;
case kModeKeypad:
_redrawSentenceLine = false;
- state = USERSTATE_SET_IFACE |
+ state = USERSTATE_SET_IFACE |
USERSTATE_SET_CURSOR | USERSTATE_CURSOR_ON |
USERSTATE_SET_FREEZE | USERSTATE_FREEZE_ON;
break;
case kModeNormal:
case kModeNoNewKid:
- state = USERSTATE_SET_IFACE | USERSTATE_IFACE_ALL |
+ state = USERSTATE_SET_IFACE | USERSTATE_IFACE_ALL |
USERSTATE_SET_CURSOR | USERSTATE_CURSOR_ON |
USERSTATE_SET_FREEZE;
break;
@@ -688,7 +688,7 @@ void ScummEngine_v0::o_animateActor() {
Actor_v0 *a = (Actor_v0*) derefActor(act, "o_animateActor");
a->_animFrameRepeat = repeat;
-
+
switch (anim) {
case 0xFE:
@@ -700,7 +700,7 @@ void ScummEngine_v0::o_animateActor() {
// 0x69A3
a->_speaking = 0x00;
return;
-
+
case 0xFF:
a->stopActorMoving();
return;
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index ce162b4a6a..96d422d5bb 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -993,7 +993,7 @@ void ScummEngine_v2::o2_drawSentence() {
const byte *temp;
int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0);
- if (!((_userState & USERSTATE_IFACE_SENTENCE) ||
+ if (!((_userState & USERSTATE_IFACE_SENTENCE) ||
(_game.platform == Common::kPlatformNES && (_userState & USERSTATE_IFACE_ALL))))
return;
@@ -1486,8 +1486,8 @@ void ScummEngine_v2::o2_cutscene() {
VAR(VAR_CURSORSTATE) = 200;
// Hide inventory, freeze scripts, hide cursor
- setUserState(USERSTATE_SET_IFACE |
- USERSTATE_SET_CURSOR |
+ setUserState(USERSTATE_SET_IFACE |
+ USERSTATE_SET_CURSOR |
USERSTATE_SET_FREEZE | USERSTATE_FREEZE_ON);
_sentenceNum = 0;
diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index a5591b701f..0bf51a2816 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -1097,7 +1097,7 @@ void ScummEngine_v5::o5_getDist() {
int r;
getResultPos();
-
+
o1 = getVarOrDirectWord(PARAM_1);
o2 = getVarOrDirectWord(PARAM_2);
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index f7f7678a9f..d4eefe8c28 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 Wed Feb 22 19:57:16 2012
+ This file was generated by the md5table tool on Sat Jul 07 23:39:27 2012
DO NOT EDIT MANUALLY!
*/
@@ -73,6 +73,7 @@ static const MD5Table md5table[] = {
{ "151071053a1d0021198216713939521d", "freddi2", "HE 80", "", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "15240c59d3681ed53f714f8d925cb2d6", "maniac", "V2", "V2", -1, Common::ES_ESP, Common::kPlatformAtariST },
{ "157367c3c21e0d03a0cba44361b4cf65", "indy3", "No AdLib", "EGA", -1, Common::EN_ANY, Common::kPlatformAtariST },
+ { "15878e3bee2e1e759184abee98589eaa", "spyfox", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformIOS },
{ "15e03ffbfeddb9c2aebc13dcb2a4a8f4", "monkey", "VGA", "VGA", 8357, Common::EN_ANY, Common::kPlatformPC },
{ "15f588e887e857e8c56fe6ade4956168", "atlantis", "Floppy", "Floppy", -1, Common::ES_ESP, Common::kPlatformAmiga },
{ "16542a7342a918bfe4ba512007d36c47", "FreddisFunShop", "HE 99L", "", -1, Common::EN_USA, Common::kPlatformUnknown },
@@ -110,7 +111,7 @@ static const MD5Table md5table[] = {
{ "2108d83dcf09f8adb4bc524669c8cf51", "PuttTime", "HE 99", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "21a6592322f92550f144f68a8a4e685e", "dig", "", "", -1, Common::FR_FRA, Common::kPlatformMacintosh },
{ "21abe302e1b1e2b66d6f5c12e241ebfd", "freddicove", "unenc", "Unencrypted", -1, Common::RU_RUS, Common::kPlatformWindows },
- { "2232b0b9411575b1f9961713ebc9de61", "balloon", "HE 80", "", -1, Common::ES_ESP, Common::kPlatformWindows },
+ { "2232b0b9411575b1f9961713ebc9de61", "balloon", "HE 80", "", -1, Common::UNK_LANG, Common::kPlatformWindows },
{ "225e18566e810c634bf7de63e7568e3e", "mustard", "", "", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "22c9eb04455440131ffc157aeb8d40a8", "fbear", "HE 70", "Demo", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "22de86b2f7ec6e5db745ed1123310b44", "spyfox2", "", "Demo", 15832, Common::FR_FRA, Common::kPlatformWindows },
@@ -163,8 +164,7 @@ static const MD5Table md5table[] = {
{ "387a544b8b10b26912d8413bab63a853", "monkey2", "", "Demo", -1, Common::EN_ANY, Common::kPlatformPC },
{ "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 },
+ { "39cb9dec16fa16f38d79acd80effb059", "loom", "EGA", "EGA", -1, Common::UNK_LANG, Common::kPlatformAmiga },
{ "39fd6db10d0222d817025c4d3346e3b4", "farm", "", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh },
{ "3a03dab514e4038df192d8a8de469788", "atlantis", "Floppy", "Floppy", -1, Common::EN_ANY, Common::kPlatformAmiga },
{ "3a0c35f3c147b98a2bdf8d400cfc4ab5", "indy3", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns },
@@ -174,7 +174,7 @@ static const MD5Table md5table[] = {
{ "3ae7f002d9256b8bdf76aaf8a3a069f8", "freddi", "HE 100", "", 34837, Common::EN_GRB, Common::kPlatformWii },
{ "3af61c5edf8e15b43dbafd285b2e9777", "puttcircus", "", "Demo", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "3b301b7892f883ce42ab4be6a274fea6", "samnmax", "Floppy", "Floppy", -1, Common::EN_ANY, Common::kPlatformPC },
- { "3b832f4a90740bf22e9b8ed42ca0128c", "freddi4", "HE 99", "", -1, Common::EN_GRB, Common::kPlatformWindows },
+ { "3b832f4a90740bf22e9b8ed42ca0128c", "freddi4", "HE 99", "", -1, Common::EN_GRB, Common::kPlatformUnknown },
{ "3c4c471342bd95505a42334367d8f127", "puttmoon", "HE 70", "", 12161, Common::RU_RUS, Common::kPlatformWindows },
{ "3cce1913a3bc586b51a75c3892ff18dd", "indy3", "VGA", "VGA", -1, Common::RU_RUS, Common::kPlatformPC },
{ "3d219e7546039543307b55a91282bf18", "funpack", "", "", -1, Common::EN_ANY, Common::kPlatformPC },
@@ -191,13 +191,14 @@ static const MD5Table md5table[] = {
{ "45082a5c9f42ba14dacfe1fdeeba819d", "freddicove", "HE 100", "Demo", 18422, Common::EN_ANY, Common::kPlatformUnknown },
{ "45152f7cf2ba8f43cf8a8ea2e740ae09", "monkey", "VGA", "VGA", 8357, Common::ES_ESP, Common::kPlatformPC },
{ "4521138d15d1fd7649c31fb981746231", "pajama2", "HE 98.5", "Demo", -1, Common::DE_DEU, Common::kPlatformUnknown },
+ { "4522564b3c31aaf218b6a96826a549fd", "maze", "HE 99", "", -1, Common::EN_USA, Common::kPlatformWindows },
{ "46b53fd430adcfbed791b48a0d4b079f", "funpack", "", "", -1, Common::EN_ANY, Common::kPlatformPC },
{ "470c45b636139bb40716daa1c7edaad0", "loom", "EGA", "EGA", -1, Common::DE_DEU, Common::kPlatformPC },
{ "477dbafbd66a53c98416dc01aef019ad", "monkey", "EGA", "EGA", -1, Common::IT_ITA, Common::kPlatformPC },
{ "47e75b1bdcb44c78cb94883d1731ccf8", "fbear", "HE 62", "Demo", 6203, Common::EN_ANY, Common::kPlatformPC },
{ "48b9f04b348bc5013327753f0d12a144", "loom", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformAmiga },
{ "49210e124e4c2b30f1290a9ef6306301", "monkey", "EGA", "EGA", 8357, Common::EN_ANY, Common::kPlatformPC },
- { "499c958affc394f2a3868f1eb568c3ee", "freddi4", "HE 99", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows },
+ { "499c958affc394f2a3868f1eb568c3ee", "freddi4", "HE 99", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "49a1739981a89066b1121fac04b710f4", "spyfox2", "HE CUP", "Preview", 5756234, Common::UNK_LANG, Common::kPlatformUnknown },
{ "4aa93cb30e485b728504ba3a693f12bf", "pajama", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "4af4a6b248103c1fe9edef619677f540", "puttmoon", "", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh },
@@ -215,21 +216,22 @@ static const MD5Table md5table[] = {
{ "4dbff3787aedcd96b0b325f2d92d7ad9", "maze", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "4dc780f1bc587a193ce8a97652791438", "loom", "EGA", "EGA", -1, Common::EN_ANY, Common::kPlatformAmiga },
{ "4e5867848ee61bc30d157e2c94eee9b4", "PuttTime", "HE 90", "Demo", 18394, Common::EN_USA, Common::kPlatformUnknown },
+ { "4e859d3ef1e146b41e7d93c35cd6cc62", "puttzoo", "HE 100", "Lite", -1, Common::EN_ANY, Common::kPlatformIOS },
{ "4edbf9d03550f7ba01e7f34d69b678dd", "spyfox", "HE 98.5", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "4f04b321a95d4315ce6d65f8e1dd0368", "maze", "HE 80", "", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "4f138ac6f9b2ac5a41bc68b2c3296064", "freddi4", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "4f1d6f8b38343dba405472538b5037ed", "fbear", "HE 62", "", 7717, Common::EN_ANY, Common::kPlatformPC },
{ "4f267a901719623de7dde83e47d5b474", "atlantis", "Floppy", "Floppy", -1, Common::DE_DEU, Common::kPlatformAmiga },
{ "4f580a021eee026f3b4589e17d130d78", "freddi4", "", "", -1, Common::UNK_LANG, Common::kPlatformUnknown },
- { "4fa6870d9bc8c313b65d54b1da5a1891", "pajama", "", "", -1, Common::NL_NLD, Common::kPlatformWindows },
+ { "4fa6870d9bc8c313b65d54b1da5a1891", "pajama", "", "", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "4fbbe9f64b8bc547503a379a301183ce", "tentacle", "", "CD", -1, Common::IT_ITA, Common::kPlatformUnknown },
{ "4fe6a2e8df3c4536b278fdd2fbcb181e", "pajama3", "", "Mini Game", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "5057fb0e99e5aa29df1836329232f101", "freddi2", "HE 80", "", -1, Common::UNK_LANG, Common::kPlatformWindows },
{ "507bb360688dc4180fdf0d7597352a69", "freddi", "HE 73", "", 26402, Common::SE_SWE, Common::kPlatformWindows },
- { "50b831f11b8c4b83784cf81f4dcc69ea", "spyfox", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformWii },
+ { "50b831f11b8c4b83784cf81f4dcc69ea", "spyfox", "HE 101", "", -1, Common::EN_ANY, Common::kPlatformWii },
{ "50fcdc982a25063b78ad46bf389b8e8d", "tentacle", "Floppy", "Floppy", -1, Common::IT_ITA, Common::kPlatformPC },
{ "51305e929e330e24a75a0351c8f9975e", "freddi2", "HE 99", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
- { "513f91a9dbe8d5490b39e56a3ac5bbdf", "pajama2", "HE 98.5", "", -1, Common::NL_NLD, Common::kPlatformMacintosh },
+ { "513f91a9dbe8d5490b39e56a3ac5bbdf", "pajama2", "HE 98.5", "", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "5262a27afcaee04e5c4900220bd463e7", "PuttsFunShop", "", "", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "52a4bae0746a11d7b1e8554e91a6645c", "zak", "V2", "V2", -1, Common::FR_FRA, Common::kPlatformPC },
{ "53e94115b55dd51d4b8ff0871aa1df1e", "spyfox", "", "Demo", 20103, Common::EN_ANY, Common::kPlatformUnknown },
@@ -333,7 +335,7 @@ static const MD5Table md5table[] = {
{ "7766c9487f9d53a8cb0edabda5119c3d", "puttputt", "HE 60", "", 8022, Common::EN_ANY, Common::kPlatformPC },
{ "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 },
+ { "782393c5934ecd0b536eaf5fd541bd26", "pajama", "HE 101", "Updated", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "784b499c98d07260a30952685758636b", "pajama3", "", "Demo", 13911, Common::DE_DEU, Common::kPlatformWindows },
{ "78bd5f036ea35a878b74e4f47941f784", "freddi4", "HE 99", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "78c07ca088526d8d4446a4c2cb501203", "freddi3", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformUnknown },
@@ -432,6 +434,7 @@ static const MD5Table md5table[] = {
{ "a0a7dea72003933b8b3f8b99b9f7ddeb", "loom", "No AdLib", "EGA", -1, Common::EN_ANY, Common::kPlatformAtariST },
{ "a194f15f51ee62badab74b9e7da97693", "baseball2001", "", "Demo", 20507, Common::EN_ANY, Common::kPlatformUnknown },
{ "a197a87ae77f3b3333f09a7a2c448fe2", "freddi", "HE 99", "Updated", -1, Common::EN_ANY, Common::kPlatformWindows },
+ { "a22af0ad0e3126d19d22707b0267a37d", "balloon", "HE 80", "", -1, Common::NL_NLD, Common::kPlatformWindows },
{ "a2386da005672cbd5136f4f27a626c5f", "farm", "", "", 87061, Common::NL_NLD, Common::kPlatformWindows },
{ "a28135a7ade38cc0208b04507c46efd1", "spyfox", "HE 99", "", -1, Common::DE_DEU, Common::kPlatformUnknown },
{ "a2bb6aa0537402c1b3c2ea899ccef64b", "lost", "HE 99", "Demo", 15540, Common::EN_ANY, Common::kPlatformWindows },
@@ -439,6 +442,7 @@ static const MD5Table md5table[] = {
{ "a336134914eaab4892d35625aa15ad1d", "freddi4", "HE 99", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "a525c1753c1db5011c00417da37887ef", "PuttTime", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "a561d2e2413cc1c71d5a1bf87bf493ea", "lost", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
+ { "a56a05c6b865b9956639f8c51269e5ab", "balloon", "HE 80", "", -1, Common::NL_NLD, Common::kPlatformMacintosh },
{ "a56e8d9d4281c53c3f63c9bd22a59e21", "catalog", "HE CUP", "Preview", 10978342, Common::EN_ANY, Common::kPlatformUnknown },
{ "a570381b028972d891052ee1e51dc011", "maniac", "V2", "V2", 1988, Common::EN_ANY, Common::kPlatformAtariST },
{ "a59a438cb182124c30c4447d8ed469e9", "freddi", "HE 100", "", 34837, Common::NB_NOR, Common::kPlatformWii },
@@ -491,7 +495,7 @@ static const MD5Table md5table[] = {
{ "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::kPlatformUnknown },
- { "c225bec1b6c0798a2b8c89ac226dc793", "pajama", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformWii },
+ { "c225bec1b6c0798a2b8c89ac226dc793", "pajama", "HE 101", "", -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 },
{ "c30ef068add4277104243c31ce46c12b", "monkey2", "", "", -1, Common::FR_FRA, Common::kPlatformAmiga },
@@ -620,6 +624,7 @@ static const MD5Table md5table[] = {
{ "f40a7f495f59188ca57a9d1d50301bb6", "puttputt", "HE 60", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh },
{ "f5228b0cc1c19e6ea8268ba2eeb61f60", "freddi", "HE 73", "Demo", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "f73883f13b5a302749a5bad31d909780", "tentacle", "", "CD", -1, Common::DE_DEU, Common::kPlatformMacintosh },
+ { "f7635a0e2ab82c9a0f9ace5f232a488f", "catalog", "HE 72", "Demo", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "f7711f9264d4d43c2a1518ec7c10a607", "pajama3", "", "", 79382, Common::EN_USA, Common::kPlatformUnknown },
{ "f79e60c17cca601e411f1f75e8ee9b5a", "spyfox2", "", "", 51286, Common::UNK_LANG, Common::kPlatformUnknown },
{ "f8be685007a8b425ba2a455da732f59f", "pajama2", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformMacintosh },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index fc46f88df4..2c79fb8de0 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -73,6 +73,7 @@
#include "scumm/util.h"
#include "scumm/verbs.h"
#include "scumm/imuse/pcspk.h"
+#include "scumm/imuse/mac_m68k.h"
#include "backends/audiocd/audiocd.h"
@@ -1835,17 +1836,31 @@ void ScummEngine::setupMusic(int midi) {
} else if (_game.version >= 3 && _game.heversion <= 62) {
MidiDriver *nativeMidiDriver = 0;
MidiDriver *adlibMidiDriver = 0;
-
- if (_sound->_musicType != MDT_ADLIB && _sound->_musicType != MDT_TOWNS && _sound->_musicType != MDT_PCSPK)
+ bool multi_midi = ConfMan.getBool("multi_midi") && _sound->_musicType != MDT_NONE && _sound->_musicType != MDT_PCSPK && (midi & MDT_ADLIB);
+ bool useOnlyNative = false;
+
+ if (isMacM68kIMuse()) {
+ // We setup this driver as native MIDI driver to avoid playback
+ // of the Mac music via a selected MIDI device.
+ nativeMidiDriver = new MacM68kDriver(_mixer);
+ // The Mac driver is never MT-32.
+ _native_mt32 = false;
+ // Ignore non-native drivers. This also ignores the multi MIDI setting.
+ useOnlyNative = true;
+ } else if (_sound->_musicType != MDT_ADLIB && _sound->_musicType != MDT_TOWNS && _sound->_musicType != MDT_PCSPK) {
nativeMidiDriver = MidiDriver::createMidi(dev);
+ }
+
if (nativeMidiDriver != NULL && _native_mt32)
nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
- bool multi_midi = ConfMan.getBool("multi_midi") && _sound->_musicType != MDT_NONE && _sound->_musicType != MDT_PCSPK && (midi & MDT_ADLIB);
- if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS || multi_midi) {
- adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_sound->_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB));
- adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0);
- } else if (_sound->_musicType == MDT_PCSPK) {
- adlibMidiDriver = new PcSpkDriver(_mixer);
+
+ if (!useOnlyNative) {
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS || multi_midi) {
+ adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_sound->_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB));
+ adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0);
+ } else if (_sound->_musicType == MDT_PCSPK) {
+ adlibMidiDriver = new PcSpkDriver(_mixer);
+ }
}
_imuse = IMuse::create(_system, nativeMidiDriver, adlibMidiDriver);
@@ -1917,6 +1932,13 @@ void ScummEngine::syncSoundSettings() {
if (VAR_CHARINC != 0xFF)
VAR(VAR_CHARINC) = _defaultTalkDelay;
}
+
+ // Backyard Baseball 2003 uses a unique subtitle variable,
+ // rather than VAR_SUBTITLES
+ if (_game.id == GID_BASEBALL2003) {
+ _scummVars[632] = ConfMan.getBool("subtitles");
+ }
+
}
void ScummEngine::setTalkSpeed(int talkspeed) {
@@ -1964,11 +1986,11 @@ 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
+ // 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)) ||
+ // otherwise (delta < 6) a single kid is able to escape.
+ if ((_game.version == 0 && isScriptRunning(132)) ||
(_game.version == 1 && isScriptRunning(137)))
delta = 6;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index cacf8c214e..a77c1c0141 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -150,7 +150,13 @@ enum GameFeatures {
GF_HE_985 = 1 << 14,
/** HE games with 16 bit color */
- GF_16BIT_COLOR = 1 << 15
+ GF_16BIT_COLOR = 1 << 15,
+
+ /**
+ * SCUMM v5-v7 Mac games stored in a container file
+ * Used to differentiate between m68k and PPC versions of Indy4
+ */
+ GF_MAC_CONTAINER = 1 << 16
};
/* SCUMM Debug Channels */
@@ -241,10 +247,12 @@ enum ScummGameId {
GID_PUTTRACE,
GID_FUNSHOP, // Used for all three funshops
GID_FOOTBALL,
+ GID_FOOTBALL2002,
GID_SOCCER,
GID_SOCCERMLS,
GID_SOCCER2004,
GID_BASEBALL2001,
+ GID_BASEBALL2003,
GID_BASKETBALL,
GID_MOONBASE,
GID_HECUP // CUP demos
@@ -711,6 +719,9 @@ public:
bool openFile(BaseScummFile &file, const Common::String &filename, bool resourceFile = false);
+ /** Is this game a Mac m68k v5 game with iMuse? */
+ bool isMacM68kIMuse() const;
+
protected:
int _resourceHeaderSize;
byte _resourceMapper[128];
@@ -1361,7 +1372,7 @@ public:
public:
bool towns_isRectInStringBox(int x1, int y1, int x2, int y2);
byte _townsPaletteFlags;
- byte _townsCharsetColorMap[16];
+ byte _townsCharsetColorMap[16];
protected:
void towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, int srcX, int srcY, int w, int h);
diff --git a/engines/scumm/scumm_v7.h b/engines/scumm/scumm_v7.h
index 81bb25e0b5..6fb98a0af7 100644
--- a/engines/scumm/scumm_v7.h
+++ b/engines/scumm/scumm_v7.h
@@ -72,7 +72,7 @@ protected:
int _languageIndexSize;
char _lastStringTag[12+1];
-#if defined(__SYMBIAN32__) || defined (_WIN32_WCE) // for some reason VC6 cannot find the base class TextObject
+#if defined(__SYMBIAN32__) || defined(_WIN32_WCE) // for some reason VC6 cannot find the base class TextObject
struct SubtitleText {
int16 xpos, ypos;
byte color;
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 1dc026ad52..a1cecfa0b3 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -248,7 +248,10 @@ void Sound::playSound(int soundID) {
_mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
}
// Support for sampled sound effects in Monkey Island 1 and 2
- else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','B','L',' ')) {
+ else if (_vm->_game.platform != Common::kPlatformFMTowns
+ // The Macintosh m68k versions of MI2/Indy4 just ignore SBL effects.
+ && !_vm->isMacM68kIMuse()
+ && READ_BE_UINT32(ptr) == MKTAG('S','B','L',' ')) {
debugC(DEBUG_SOUND, "Using SBL sound effect");
// SBL resources essentially contain VOC sound data.
@@ -954,7 +957,7 @@ void Sound::setupSfxFile() {
if (file.open(tmp))
_sfxFilename = tmp;
-
+
if (_vm->_game.heversion <= 74)
_sfxFileEncByte = 0x69;
@@ -1179,7 +1182,7 @@ int ScummEngine::readSoundResource(ResId idx) {
// its sound resources, and Amiga games, which feature only ROL
// resources, since we are a doing Midi -> AdLib conversion for
// these.
- if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 16
+ if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 16
&& pri != 15 && pri != 10 && pri != 2 && _game.platform != Common::kPlatformAmiga)
pri = -1;
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 567ca31485..0d0f6cdb95 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -84,7 +84,7 @@ int ScummEngine_v0::verbPrepIdType(int verbid) {
switch (verbid) {
case kVerbUse: // depends on object1
return kVerbPrepObject;
- case kVerbGive:
+ case kVerbGive:
return kVerbPrepTo;
case kVerbUnlock: case kVerbFix:
return kVerbPrepWith;
@@ -693,7 +693,7 @@ void ScummEngine_v0::verbExec() {
if (_activeVerb == kVerbWhatIs)
return;
-
+
if (!(_activeVerb == kVerbWalkTo && _activeObject == 0)) {
doSentence(_activeVerb, _activeObject, _activeObject2);
if (_activeVerb != kVerbWalkTo) {
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index c1ed763281..57c1f6b48b 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -203,6 +203,7 @@ Control::Control(Common::SaveFileManager *saveFileMan, Screen *screen, Disk *dis
_skySound = sound;
_skyCompact = skyCompact;
_system = system;
+ _controlPanel = NULL;
}
ConResource *Control::createResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, int16 pX, int16 pY, uint32 pText, uint8 pOnClick, uint8 panelType) {
@@ -225,6 +226,7 @@ void Control::removePanel() {
free(_sprites.slide2); free(_sprites.slode);
free(_sprites.slode2); free(_sprites.musicBodge);
delete _controlPanel; delete _exitButton;
+ _controlPanel = NULL;
delete _slide; delete _slide2;
delete _slode; delete _restorePanButton;
delete _savePanel; delete _saveButton;
@@ -383,6 +385,8 @@ void Control::animClick(ConResource *pButton) {
_text->drawToScreen(WITH_MASK);
_system->updateScreen();
delay(150);
+ if (!_controlPanel)
+ return;
pButton->_curSprite--;
_text->flushForRedraw();
pButton->drawToScreen(NO_MASK);
@@ -480,6 +484,8 @@ void Control::doControlPanel() {
_system->updateScreen();
_mouseClicked = false;
delay(50);
+ if (!_controlPanel)
+ return;
if (_keyPressed.keycode == Common::KEYCODE_ESCAPE) { // escape pressed
_mouseClicked = false;
quitPanel = true;
@@ -492,6 +498,8 @@ void Control::doControlPanel() {
buttonControl(_controlPanLookList[lookCnt]);
if (_mouseClicked && _controlPanLookList[lookCnt]->_onClick) {
clickRes = handleClick(_controlPanLookList[lookCnt]);
+ if (!_controlPanel) //game state was destroyed
+ return;
_text->flushForRedraw();
drawMainPanel();
_text->drawToScreen(WITH_MASK);
@@ -618,6 +626,11 @@ bool Control::getYesNo(char *text) {
}
_system->updateScreen();
delay(50);
+ if (!_controlPanel) {
+ free(dlgTextDat);
+ delete dlgText;
+ return retVal;
+ }
Common::Point mouse = _system->getEventManager()->getMousePos();
if ((mouse.y >= 83) && (mouse.y <= 110)) {
if ((mouse.x >= 77) && (mouse.x <= 114)) { // over 'yes'
@@ -650,6 +663,8 @@ uint16 Control::doMusicSlide() {
uint8 volume;
while (_mouseClicked) {
delay(50);
+ if (!_controlPanel)
+ return 0;
mouse = _system->getEventManager()->getMousePos();
int newY = ofsY + mouse.y;
if (newY < 59) newY = 59;
@@ -679,6 +694,8 @@ uint16 Control::doSpeedSlide() {
speedDelay += 2;
while (_mouseClicked) {
delay(50);
+ if (!_controlPanel)
+ return SPEED_CHANGED;
mouse = _system->getEventManager()->getMousePos();
int newY = ofsY + mouse.y;
if (newY < MPNL_Y + 93) newY = MPNL_Y + 93;
@@ -870,12 +887,16 @@ uint16 Control::saveRestorePanel(bool allowSave) {
_system->updateScreen();
_mouseClicked = false;
delay(50);
+ if (!_controlPanel)
+ return clickRes;
if (_keyPressed.keycode == Common::KEYCODE_ESCAPE) { // escape pressed
_mouseClicked = false;
clickRes = CANCEL_PRESSED;
quitPanel = true;
} else if ((_keyPressed.keycode == Common::KEYCODE_RETURN) || (_keyPressed.keycode == Common::KEYCODE_KP_ENTER)) {
clickRes = handleClick(lookList[0]);
+ if (!_controlPanel) //game state was destroyed
+ return clickRes;
if (clickRes == GAME_SAVED)
saveDescriptions(saveGameTexts);
else if (clickRes == NO_DISK_SPACE)
@@ -912,6 +933,8 @@ uint16 Control::saveRestorePanel(bool allowSave) {
_mouseClicked = false;
clickRes = handleClick(lookList[cnt]);
+ if (!_controlPanel) //game state was destroyed
+ return clickRes;
if (clickRes == SHIFTED) {
_selectedGame = _firstText;
@@ -1420,7 +1443,8 @@ uint16 Control::restoreGameFromFile(bool autoSave) {
uint16 Control::quickXRestore(uint16 slot) {
uint16 result;
- initPanel();
+ if (!_controlPanel)
+ initPanel();
_mouseClicked = false;
_savedCharSet = _skyText->giveCurrentCharSet();
diff --git a/engines/sky/control.h b/engines/sky/control.h
index 280f7e19cd..1380d29ee2 100644
--- a/engines/sky/control.h
+++ b/engines/sky/control.h
@@ -203,6 +203,11 @@ private:
void drawMainPanel();
+ /**
+ * Waits for a specified amount while still processing events.
+ *
+ * @param amount The duration in milliseconds to wait
+ */
void delay(unsigned int amount);
void animClick(ConResource *pButton);
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 2b702e99ea..8f6c2bb6a2 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -27,17 +27,26 @@
#include "common/config-manager.h"
#include "engines/advancedDetector.h"
+#include "engines/metaengine.h"
#include "common/system.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/savefile.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "engines/metaengine.h"
static const PlainGameDescriptor skySetting =
{"sky", "Beneath a Steel Sky" };
+static const ExtraGuiOption skyExtraGuiOption = {
+ _s("Floppy intro"),
+ _s("Use the floppy version's intro (CD version only)"),
+ "alt_intro",
+ false
+};
+
struct SkyVersion {
int dinnerTableEntries;
int dataDiskSize;
@@ -68,6 +77,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const Common::FSList &fslist) const;
@@ -106,6 +116,25 @@ GameList SkyMetaEngine::getSupportedGames() const {
return games;
}
+const ExtraGuiOptions SkyMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ Common::String guiOptions;
+ ExtraGuiOptions options;
+
+ if (target.empty()) {
+ options.push_back(skyExtraGuiOption);
+ return options;
+ }
+
+ if (ConfMan.hasKey("guioptions", target)) {
+ guiOptions = ConfMan.get("guioptions", target);
+ guiOptions = parseGameGUIOptions(guiOptions);
+ }
+
+ if (!guiOptions.contains(GUIO_NOSPEECH))
+ options.push_back(skyExtraGuiOption);
+ return options;
+}
+
GameDescriptor SkyMetaEngine::findGame(const char *gameid) const {
if (0 == scumm_stricmp(gameid, skySetting.gameid))
return skySetting;
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 1e2964054a..ff3c897dba 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -37,6 +37,7 @@
#include "gui/message.h"
+#include "video/dxa_decoder.h"
#include "video/psx_decoder.h"
#include "video/smk_decoder.h"
@@ -68,7 +69,7 @@ static const char *const sequenceList[20] = {
};
// This is the list of the names of the PlayStation videos
-// TODO: fight.str, flashy.str,
+// TODO: fight.str, flashy.str,
static const char *const sequenceListPSX[20] = {
"e_ferr1",
"ladder1",
@@ -96,9 +97,8 @@ static const char *const sequenceListPSX[20] = {
// Basic movie player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType)
- : _vm(vm), _textMan(textMan), _resMan(resMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) {
- _bgSoundStream = NULL;
+MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType)
+ : _vm(vm), _textMan(textMan), _resMan(resMan), _system(system) {
_decoderType = decoderType;
_decoder = decoder;
@@ -107,7 +107,6 @@ MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::
}
MoviePlayer::~MoviePlayer() {
- delete _bgSoundHandle;
delete _decoder;
}
@@ -116,16 +115,12 @@ MoviePlayer::~MoviePlayer() {
* @param id the id of the file
*/
bool MoviePlayer::load(uint32 id) {
- Common::File f;
Common::String filename;
- if (_decoderType == kVideoDecoderDXA)
- _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(sequenceList[id]);
- else
- _bgSoundStream = NULL;
-
if (SwordEngine::_systemVars.showText) {
+ Common::File f;
filename = Common::String::format("%s.txt", sequenceList[id]);
+
if (f.open(filename)) {
Common::String line;
int lineNo = 0;
@@ -157,19 +152,18 @@ bool MoviePlayer::load(uint32 id) {
warning("%s:%d startFrame (%d) <= lastEnd (%d)", filename.c_str(), lineNo, startFrame, lastEnd);
continue;
}
-
+
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();
}
}
@@ -189,6 +183,7 @@ bool MoviePlayer::load(uint32 id) {
// Need to load here in case it fails in which case we'd need
// to go back to paletted mode
if (_decoder->loadFile(filename)) {
+ _decoder->start();
return true;
} else {
initGraphics(g_system->getWidth(), g_system->getHeight(), true);
@@ -197,30 +192,27 @@ bool MoviePlayer::load(uint32 id) {
break;
}
- return _decoder->loadFile(filename.c_str());
-}
+ if (!_decoder->loadFile(filename))
+ return false;
-void MoviePlayer::play() {
- if (_bgSoundStream)
- _snd->playStream(Audio::Mixer::kSFXSoundType, _bgSoundHandle, _bgSoundStream);
+ // For DXA, also add the external sound file
+ if (_decoderType == kVideoDecoderDXA)
+ _decoder->addStreamFileTrack(sequenceList[id]);
- bool terminated = false;
+ _decoder->start();
+ return true;
+}
+void MoviePlayer::play() {
_textX = 0;
_textY = 0;
- terminated = !playVideo();
-
- if (terminated)
- _snd->stopHandle(*_bgSoundHandle);
+ playVideo();
_textMan->releaseText(2, false);
_movieTexts.clear();
- while (_snd->isSoundHandleActive(*_bgSoundHandle))
- _system->delayMillis(100);
-
// It's tempting to call _screen->fullRefresh() here to restore the old
// palette. However, that causes glitches with DXA movies, where the
// previous location would be momentarily drawn, before switching to
@@ -316,11 +308,11 @@ bool MoviePlayer::playVideo() {
if (_decoderType == kVideoDecoderPSX)
drawFramePSX(frame);
else
- _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
}
if (_decoder->hasDirtyPalette()) {
- _decoder->setSystemPalette();
+ _vm->_system->getPaletteManager()->setPalette(_decoder->getPalette(), 0, 256);
if (!_movieTexts.empty()) {
// Look for the best color indexes to use to display the subtitles
@@ -501,29 +493,17 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) {
uint16 x = (g_system->getWidth() - scaledFrame.w) / 2;
uint16 y = (g_system->getHeight() - scaledFrame.h) / 2;
- _vm->_system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
+ _vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
scaledFrame.free();
}
-DXADecoderWithSound::DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle)
- : _mixer(mixer), _bgSoundHandle(bgSoundHandle) {
-}
-
-uint32 DXADecoderWithSound::getElapsedTime() const {
- if (_mixer->isSoundHandleActive(*_bgSoundHandle))
- return _mixer->getSoundElapsedTime(*_bgSoundHandle);
-
- return DXADecoder::getElapsedTime();
-}
-
///////////////////////////////////////////////////////////////////////////////
// Factory function for creating the appropriate cutscene player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system) {
+MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system) {
Common::String filename;
- Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle;
// For the PSX version, we'll try the PlayStation stream files
if (vm->isPsx()) {
@@ -534,7 +514,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *
#ifdef USE_RGB_COLOR
// All BS1 PSX videos run the videos at 2x speed
Video::VideoDecoder *psxDecoder = new Video::PSXStreamDecoder(Video::PSXStreamDecoder::kCD2x);
- return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, psxDecoder, kVideoDecoderPSX);
+ return new MoviePlayer(vm, textMan, resMan, system, psxDecoder, kVideoDecoderPSX);
#else
GUI::MessageDialog dialog(Common::String::format(_("PSX stream cutscene '%s' cannot be played in paletted mode"), filename.c_str()), _("OK"));
dialog.runModal();
@@ -546,20 +526,20 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *
filename = Common::String::format("%s.smk", sequenceList[id]);
if (Common::File::exists(filename)) {
- Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd);
- return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
+ Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder();
+ return new MoviePlayer(vm, textMan, resMan, system, smkDecoder, kVideoDecoderSMK);
}
filename = Common::String::format("%s.dxa", sequenceList[id]);
if (Common::File::exists(filename)) {
#ifdef USE_ZLIB
- DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle);
- return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA);
+ Video::VideoDecoder *dxaDecoder = new Video::DXADecoder();
+ return new MoviePlayer(vm, textMan, resMan, system, dxaDecoder, kVideoDecoderDXA);
#else
GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK"));
dialog.runModal();
- return NULL;
+ return 0;
#endif
}
@@ -569,7 +549,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *
if (Common::File::exists(filename)) {
GUI::MessageDialog dialog(_("MPEG2 cutscenes are no longer supported"), _("OK"));
dialog.runModal();
- return NULL;
+ return 0;
}
if (!vm->isPsx() || scumm_stricmp(sequenceList[id], "enddemo") != 0) {
@@ -578,7 +558,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *
dialog.runModal();
}
- return NULL;
+ return 0;
}
} // End of namespace Sword1
diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h
index f64b03dd1b..d0c61f5eb3 100644
--- a/engines/sword1/animation.h
+++ b/engines/sword1/animation.h
@@ -23,16 +23,19 @@
#ifndef SWORD1_ANIMATION_H
#define SWORD1_ANIMATION_H
-#include "video/dxa_decoder.h"
-#include "video/video_decoder.h"
-
#include "common/list.h"
-#include "audio/audiostream.h"
-
#include "sword1/screen.h"
#include "sword1/sound.h"
+namespace Graphics {
+struct Surface;
+}
+
+namespace Video {
+class VideoDecoder;
+}
+
namespace Sword1 {
enum DecoderType {
@@ -55,21 +58,9 @@ public:
}
};
-class DXADecoderWithSound : public Video::DXADecoder {
-public:
- DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle);
- ~DXADecoderWithSound() {}
-
- uint32 getElapsedTime() const;
-
-private:
- Audio::Mixer *_mixer;
- Audio::SoundHandle *_bgSoundHandle;
-};
-
class MoviePlayer {
public:
- MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType);
+ MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType);
virtual ~MoviePlayer();
bool load(uint32 id);
void play();
@@ -78,7 +69,6 @@ protected:
SwordEngine *_vm;
Text *_textMan;
ResMan *_resMan;
- Audio::Mixer *_snd;
OSystem *_system;
Common::List<MovieText> _movieTexts;
int _textX, _textY, _textWidth, _textHeight;
@@ -88,8 +78,6 @@ protected:
DecoderType _decoderType;
Video::VideoDecoder *_decoder;
- Audio::SoundHandle *_bgSoundHandle;
- Audio::AudioStream *_bgSoundStream;
bool playVideo();
void performPostProcessing(byte *screen);
@@ -100,7 +88,7 @@ protected:
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);
+MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system);
} // End of namespace Sword1
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index 6e395116f9..7cd85dff54 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -541,7 +541,9 @@ void Control::setupMainPanel() {
if (SwordEngine::_systemVars.controlPanelMode == CP_DEATHSCREEN)
panelId = SR_DEATHPANEL;
else {
- if (SwordEngine::_systemVars.language <= BS1_SPANISH)
+ if (SwordEngine::_systemVars.realLanguage == Common::EN_USA)
+ panelId = SR_PANEL_AMERICAN;
+ else if (SwordEngine::_systemVars.language <= BS1_SPANISH)
panelId = SR_PANEL_ENGLISH + SwordEngine::_systemVars.language;
else
panelId = SR_PANEL_ENGLISH;
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 087dcd09d8..5662e4672b 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -268,9 +268,6 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int
SaveStateDescriptor desc(slot, name);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
-
if (versionSave < 2) // These older version of the savegames used a flag to signal presence of thumbnail
in->skip(1);
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 8e04861edf..757d768780 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -959,7 +959,7 @@ int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int3
// meantime, we don't want any looping sound effects still playing.
_sound->quitScreen();
- MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _resMan, _mixer, _system);
+ MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _resMan, _system);
if (player) {
_screen->clearScreen();
if (player->load(sequenceId))
diff --git a/engines/sword1/objectman.cpp b/engines/sword1/objectman.cpp
index ed994a97fa..3e70a95699 100644
--- a/engines/sword1/objectman.cpp
+++ b/engines/sword1/objectman.cpp
@@ -99,13 +99,64 @@ uint8 ObjectMan::fnCheckForTextLine(uint32 textId) {
char *ObjectMan::lockText(uint32 textId) {
uint8 lang = SwordEngine::_systemVars.language;
+ char *text = lockText(textId, lang);
+ if (text == 0) {
+ if (lang != BS1_ENGLISH) {
+ text = lockText(textId, BS1_ENGLISH);
+ if (text != 0)
+ warning("Missing translation for textId %u (\"%s\")", textId, text);
+ unlockText(textId, BS1_ENGLISH);
+ }
+
+ return _missingSubTitleStr;
+ }
+ return text;
+}
+
+char *ObjectMan::lockText(uint32 textId, uint8 lang) {
char *addr = (char *)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]);
if (addr == 0)
- return _missingSubTitleStr;
+ return NULL;
addr += sizeof(Header);
if ((textId & ITM_ID) >= _resMan->readUint32(addr)) {
+ // Workaround for missing sentences in some langages in the demo.
+ switch(textId) {
+ case 8455194:
+ return const_cast<char *>(_translationId8455194[lang]);
+ case 8455195:
+ return const_cast<char *>(_translationId8455195[lang]);
+ case 8455196:
+ return const_cast<char *>(_translationId8455196[lang]);
+ case 8455197:
+ return const_cast<char *>(_translationId8455197[lang]);
+ case 8455198:
+ return const_cast<char *>(_translationId8455198[lang]);
+ case 8455199:
+ return const_cast<char *>(_translationId8455199[lang]);
+ case 8455200:
+ return const_cast<char *>(_translationId8455200[lang]);
+ case 8455201:
+ return const_cast<char *>(_translationId8455201[lang]);
+ case 8455202:
+ return const_cast<char *>(_translationId8455202[lang]);
+ case 8455203:
+ return const_cast<char *>(_translationId8455203[lang]);
+ case 8455204:
+ return const_cast<char *>(_translationId8455204[lang]);
+ case 8455205:
+ return const_cast<char *>(_translationId8455205[lang]);
+ case 6488080:
+ return const_cast<char *>(_translationId6488080[lang]);
+ case 6488081:
+ return const_cast<char *>(_translationId6488081[lang]);
+ case 6488082:
+ return const_cast<char *>(_translationId6488082[lang]);
+ case 6488083:
+ return const_cast<char *>(_translationId6488083[lang]);
+ }
+
warning("ObjectMan::lockText(%d): only %d texts in file", textId & ITM_ID, _resMan->readUint32(addr));
- textId = 0; // get first line instead
+ return NULL;
}
uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1) * 4);
if (offset == 0) {
@@ -115,13 +166,17 @@ char *ObjectMan::lockText(uint32 textId) {
return const_cast<char *>(_translationId2950145[lang]);
warning("ObjectMan::lockText(%d): text number has no text lines", textId);
- return _missingSubTitleStr;
+ return NULL;
}
return addr + offset;
}
void ObjectMan::unlockText(uint32 textId) {
- _resMan->resClose(_textList[textId / ITM_PER_SEC][SwordEngine::_systemVars.language]);
+ unlockText(textId, SwordEngine::_systemVars.language);
+}
+
+void ObjectMan::unlockText(uint32 textId, uint8 lang) {
+ _resMan->resClose(_textList[textId / ITM_PER_SEC][lang]);
}
uint32 ObjectMan::lastTextNumber(int section) {
@@ -186,7 +241,193 @@ const char *const ObjectMan::_translationId2950145[7] = {
"Eh?", // Italian
"\277Eh?", // Spanish
"Ano?", // Czech
- " " // Portuguese
+ NULL // Portuguese
+};
+
+// The translations for the next texts are missing in the demo but are present
+// in the full game. The translations were therefore extracted from the full game.
+
+// Missing translation for textId 8455194 (in the demo).
+const char *const ObjectMan::_translationId8455194[7] = {
+ NULL, // "Who was the guy you were supposed to meet?", // English (not needed)
+ "Qui \351tait l'homme que vous deviez rencontrer?", // French
+ "Wer war der Typ, den Du treffen wolltest?", // German
+ "Chi dovevi incontrare?", // Italian
+ "\277Qui\351n era el hombre con el que ten\355as que encontrarte?", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455195 (in the demo).
+const char *const ObjectMan::_translationId8455195[7] = {
+ NULL, // "His name was Plantard. I didn't know him, but he called me last night.", // English (not needed)
+ "Son nom \351tait Plantard. Je ne le connaissais pas, mais il m'avait t\351l\351phon\351 la veille.", // French
+ "Sein Name war Plantard. Ich kannte ihn nicht, aber er hat mich letzte Nacht angerufen.", // German
+ "Si chiamava Plantard. Mi ha chiamato ieri sera, ma non lo conoscevo.", // Italian
+ "Su nombre era Plantard. Yo no lo conoc\355a pero \351l me llam\363 ayer por la noche.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455196 (in the demo).
+const char *const ObjectMan::_translationId8455196[7] = {
+ NULL, // "He said he had a story which would interest me.", // English (not needed)
+ "Il a dit qu'il avait une histoire qui devrait m'int\351resser.", // French
+ "Er sagte, er h\344tte eine Story, die mich interessieren w\374rde.", // German
+ "Mi disse che aveva una storia che mi poteva interessare.", // Italian
+ "Dijo que ten\355a una historia que me interesar\355a.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455197 (in the demo).
+const char *const ObjectMan::_translationId8455197[7] = {
+ NULL, // "He asked me to meet him at the caf\351.", // English (not needed)
+ "Il m'a demand\351 de le rencontrer au caf\351.", // French
+ "Er fragte mich, ob wir uns im Caf\351 treffen k\366nnten.", // German
+ "Mi chiese di incontrarci al bar.", // Italian
+ "Me pidi\363 que nos encontr\341ramos en el caf\351.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455198 (in the demo).
+const char *const ObjectMan::_translationId8455198[7] = {
+ NULL, // "I guess I'll never know what he wanted to tell me...", // English (not needed)
+ "Je suppose que je ne saurai jamais ce qu'il voulait me dire...", // French
+ "Ich werde wohl nie erfahren, was er mir sagen wollte...", // German
+ "Penso che non sapr\362 mai che cosa voleva dirmi...", // Italian
+ "Supongo que nunca sabr\351 qu\351 me quer\355a contar...", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455199 (in the demo).
+const char *const ObjectMan::_translationId8455199[7] = {
+ NULL, // "Not unless you have Rosso's gift for psychic interrogation.", // English (not needed)
+ "Non, \340 moins d'avoir les dons de Rosso pour les interrogatoires psychiques.", // French
+ "Es sei denn, Du h\344ttest Rosso's Gabe der parapsychologischen Befragung.", // German
+ "A meno che tu non riesca a fare interrogatori telepatici come Rosso.", // Italian
+ "A no ser que tengas el don de Rosso para la interrogaci\363n ps\355quica.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455200 (in the demo).
+const char *const ObjectMan::_translationId8455200[7] = {
+ NULL, // "How did Plantard get your name?", // English (not needed)
+ "Comment Plantard a-t-il obtenu votre nom?", // French
+ "Woher hat Plantard Deinen Namen?", // German
+ "Come ha fatto Plantard a sapere il tuo nome?", // Italian
+ "\277C\363mo consigui\363 Plantard tu nombre?", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455201 (in the demo).
+const char *const ObjectMan::_translationId8455201[7] = {
+ NULL, // "Through the newspaper - La Libert\351.", // English (not needed)
+ "Par mon journal... La Libert\351.", // French
+ "\334ber die Zeitung - La Libert\351.", // German
+ "Tramite il giornale La Libert\351.", // Italian
+ "Por el peri\363dico - La Libert\351.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455202 (in the demo).
+const char *const ObjectMan::_translationId8455202[7] = {
+ NULL, // "I'd written an article linking two unsolved murders, one in Italy, the other in Japan.", // English (not needed)
+ "J'ai \351crit un article o\371 je faisais le lien entre deux meurtres inexpliqu\351s, en Italie et au japon.", // French
+ "Ich habe einen Artikel geschrieben, in dem ich zwei ungel\366ste Morde miteinander in Verbindung bringe, einen in Italien, einen anderen in Japan.", // German
+ "Ho scritto un articolo che metteva in collegamento due omicidi insoluti in Italia e Giappone.", // Italian
+ "Yo hab\355a escrito un art\355culo conectando dos asesinatos sin resolver, uno en Italia, el otro en Jap\363n.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455203 (in the demo).
+const char *const ObjectMan::_translationId8455203[7] = {
+ NULL, // "The cases were remarkably similar...", // English (not needed)
+ "Les affaires \351taient quasiment identiques...", // French
+ "Die F\344lle sind sich bemerkenswert \344hnlich...", // German
+ "I casi erano sorprendentemente uguali...", // Italian
+ "Los casos eran incre\355blemente parecidos...", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455204 (in the demo).
+const char *const ObjectMan::_translationId8455204[7] = {
+ NULL, // "...a wealthy victim, no apparent motive, and a costumed killer.", // English (not needed)
+ "...une victime riche, pas de motif apparent, et un tueur d\351guis\351.", // French
+ "...ein wohlhabendes Opfer, kein offensichtliches Motiv, und ein verkleideter Killer.", // German
+ "...una vittima ricca, nessun motivo apparente e un assassino in costume.", // Italian
+ "...una v\355ctima rica, sin motivo aparente, y un asesino disfrazado.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 8455205 (in the demo).
+const char *const ObjectMan::_translationId8455205[7] = {
+ NULL, // "Plantard said he could supply me with more information.", // English (not needed)
+ "Plantard m'a dit qu'il pourrait me fournir des renseignements.", // French
+ "Plantard sagte, er k\366nne mir weitere Informationen beschaffen.", // German
+ "Plantard mi disse che mi avrebbe fornito ulteriori informazioni.", // Italian
+ "Plantard dijo que \351l me pod\355a proporcionar m\341s informaci\363n.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 6488080 (in the demo).
+const char *const ObjectMan::_translationId6488080[7] = {
+ NULL, // "I wasn't going to head off all over Paris until I'd investigated some more.", // English (not needed)
+ "Je ferais mieux d'enqu\351ter un peu par ici avant d'aller me promener ailleurs.", // French
+ "Ich durchquere nicht ganz Paris, bevor ich etwas mehr herausgefunden habe.", // German
+ "Non mi sarei incamminato per tutta Parigi prima di ulteriori indagini.", // Italian
+ "No iba a ponerme a recorrer Par\355s sin haber investigado un poco m\341s.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// The next three sentences are specific to the demo and only the english text is present.
+// The translations were provided by:
+// French: Thierry Crozat
+// German: Simon Sawatzki
+// Italian: Matteo Angelino
+// Spanish: Tomás Maidagan
+
+// Missing translation for textId 6488081 (in the demo).
+const char *const ObjectMan::_translationId6488081[7] = {
+ NULL, // "I wasn't sure what I was going to do when I caught up with that clown...", // English (not needed)
+ "Je ne savais pas ce que je ferais quand je rattraperais le clown...", // French
+ "Ich wu\337te nicht, worauf ich mich einlie\337, als ich dem Clown nachjagte...", // German
+ "Non sapevo cosa avrei fatto una volta raggiunto quel clown...", // Italian
+ "No sab\355a muy bien qu\351 es lo que har\355a cuando alcanzara al payaso...", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 6488082 (in the demo).
+const char *const ObjectMan::_translationId6488082[7] = {
+ NULL, // "...but before I knew it, I was drawn into a desperate race between two ruthless enemies.", // English (not needed)
+ "...mais avant de m'en rendre compte je me retrouvais happ\351 dans une course effr\351n\351e entre deux ennemis impitoyables.", // French
+ "... doch bevor ich mich versah, war ich inmitten eines Wettlaufs von zwei r\374cksichtslosen Feinden.", // German
+ "... ma prima che me ne rendessi conto, fui trascinato in una corsa disperata con due spietati nemici.", // Italian
+ "...pero sin darme cuenta, acab\351 en medio de una desesperada carrera entre dos despiadados enemigos.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
+};
+
+// Missing translation for textId 6488083 (in the demo).
+const char *const ObjectMan::_translationId6488083[7] = {
+ NULL, // "The goal: the mysterious power of the Broken Sword.", // English (not needed)
+ "Le but: les pouvoirs myst\351rieux de l'\351p\351e bris\351e.", // French
+ "Das Ziel: die geheimnisvolle Macht des zerbrochenen Schwertes.", // German
+ "Obiettivo: il misterioso potere della Spada spezzata.", // Italian
+ "El objetivo: el misterioso poder de la Espada Rota.", // Spanish
+ NULL, // Czech
+ NULL // Portuguese
};
} // End of namespace Sword1
diff --git a/engines/sword1/objectman.h b/engines/sword1/objectman.h
index ca3c7c1526..197b437c15 100644
--- a/engines/sword1/objectman.h
+++ b/engines/sword1/objectman.h
@@ -53,6 +53,9 @@ public:
void saveLiveList(uint16 *dest); // for loading/saving
void loadLiveList(uint16 *src);
private:
+ char *lockText(uint32 textId, uint8 language);
+ void unlockText(uint32 textId, uint8 language);
+
ResMan *_resMan;
static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files
static const uint32 _textList[TOTAL_SECTIONS][7]; //a table of pointers to text files
@@ -60,6 +63,22 @@ private:
uint8 *_cptData[TOTAL_SECTIONS];
static char _missingSubTitleStr[];
static const char *const _translationId2950145[7]; //translation for textId 2950145 (missing from cluster file for some langages)
+ static const char *const _translationId8455194[7]; //translation for textId 8455194 (missing in the demo)
+ static const char *const _translationId8455195[7]; //translation for textId 8455195 (missing in the demo)
+ static const char *const _translationId8455196[7]; //translation for textId 8455196 (missing in the demo)
+ static const char *const _translationId8455197[7]; //translation for textId 8455197 (missing in the demo)
+ static const char *const _translationId8455198[7]; //translation for textId 8455198 (missing in the demo)
+ static const char *const _translationId8455199[7]; //translation for textId 8455199 (missing in the demo)
+ static const char *const _translationId8455200[7]; //translation for textId 8455200 (missing in the demo)
+ static const char *const _translationId8455201[7]; //translation for textId 8455201 (missing in the demo)
+ static const char *const _translationId8455202[7]; //translation for textId 8455202 (missing in the demo)
+ static const char *const _translationId8455203[7]; //translation for textId 8455203 (missing in the demo)
+ static const char *const _translationId8455204[7]; //translation for textId 8455204 (missing in the demo)
+ static const char *const _translationId8455205[7]; //translation for textId 8455205 (missing in the demo)
+ static const char *const _translationId6488080[7]; //translation for textId 6488081 (missing in the demo)
+ static const char *const _translationId6488081[7]; //translation for textId 6488081 (missing in the demo)
+ static const char *const _translationId6488082[7]; //translation for textId 6488082 (missing in the demo)
+ static const char *const _translationId6488083[7]; //translation for textId 6488083 (missing in the demo)
};
} // End of namespace Sword1
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 3574074b00..61bf5257ab 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -142,7 +142,7 @@ void Sound::checkSpeechFileEndianness() {
be_diff_sum += fabs((double)(be_value - prev_be_value));
prev_be_value = be_value;
}
- delete [] data;
+ delete[] data;
}
// Set the big endian flag
_bigEndianSpeech = (be_diff_sum < le_diff_sum);
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 75e8f72d9d..fa593b8df4 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -116,8 +116,9 @@ Common::Error SwordEngine::init() {
_systemVars.controlPanelMode = CP_NEWGAME;
_systemVars.forceRestart = false;
_systemVars.wantFade = true;
+ _systemVars.realLanguage = Common::parseLanguage(ConfMan.get("language"));
- switch (Common::parseLanguage(ConfMan.get("language"))) {
+ switch (_systemVars.realLanguage) {
case Common::DE_DEU:
_systemVars.language = BS1_GERMAN;
break;
@@ -138,6 +139,7 @@ Common::Error SwordEngine::init() {
break;
default:
_systemVars.language = BS1_ENGLISH;
+ break;
}
_systemVars.showText = ConfMan.getBool("subtitles");
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index ccdc2d3a59..ec6555b4b3 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -75,6 +75,7 @@ struct SystemVars {
uint8 language;
bool isDemo;
Common::Platform platform;
+ Common::Language realLanguage;
};
class SwordEngine : public Engine {
diff --git a/engines/sword1/text.cpp b/engines/sword1/text.cpp
index 3bd2fdb2e6..f23ac5f182 100644
--- a/engines/sword1/text.cpp
+++ b/engines/sword1/text.cpp
@@ -156,6 +156,8 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
}
uint16 Text::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) {
+ if (ch < SPACE)
+ ch = 64;
FrameHeader *chFrame = _resMan->fetchFrame(_font, ch - SPACE);
uint8 *chData = ((uint8 *)chFrame) + sizeof(FrameHeader);
uint8 *dest = sprPtr;
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index e77ae98163..00260f789a 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -38,8 +38,11 @@
#include "sword2/screen.h"
#include "sword2/animation.h"
+#include "graphics/palette.h"
+
#include "gui/message.h"
+#include "video/dxa_decoder.h"
#include "video/smk_decoder.h"
#include "video/psx_decoder.h"
@@ -51,9 +54,8 @@ namespace Sword2 {
// Basic movie player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer::MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType)
- : _vm(vm), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) {
- _bgSoundStream = NULL;
+MoviePlayer::MoviePlayer(Sword2Engine *vm, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType)
+ : _vm(vm), _system(system) {
_decoderType = decoderType;
_decoder = decoder;
@@ -62,7 +64,6 @@ MoviePlayer::MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, A
}
MoviePlayer::~MoviePlayer() {
- delete _bgSoundHandle;
delete _decoder;
}
@@ -75,11 +76,6 @@ bool MoviePlayer::load(const char *name) {
if (_vm->shouldQuit())
return false;
- if (_decoderType == kVideoDecoderDXA)
- _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(name);
- else
- _bgSoundStream = NULL;
-
_textSurface = NULL;
Common::String filename;
@@ -99,6 +95,7 @@ bool MoviePlayer::load(const char *name) {
// Need to load here in case it fails in which case we'd need
// to go back to paletted mode
if (_decoder->loadFile(filename)) {
+ _decoder->start();
return true;
} else {
initGraphics(640, 480, true);
@@ -106,7 +103,15 @@ bool MoviePlayer::load(const char *name) {
}
}
- return _decoder->loadFile(filename.c_str());
+ if (!_decoder->loadFile(filename))
+ return false;
+
+ // For DXA, also add the external sound file
+ if (_decoderType == kVideoDecoderDXA)
+ _decoder->addStreamFileTrack(name);
+
+ _decoder->start();
+ return true;
}
void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadIn, uint32 leadOut) {
@@ -122,24 +127,15 @@ void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadI
if (leadIn)
_vm->_sound->playMovieSound(leadIn, kLeadInSound);
- if (_bgSoundStream)
- _snd->playStream(Audio::Mixer::kSFXSoundType, _bgSoundHandle, _bgSoundStream);
-
- bool terminated = false;
-
- terminated = !playVideo();
+ bool terminated = !playVideo();
closeTextObject(_currentMovieText, NULL, 0);
if (terminated) {
- _snd->stopHandle(*_bgSoundHandle);
_vm->_sound->stopMovieSounds();
_vm->_sound->stopSpeech();
}
- while (_snd->isSoundHandleActive(*_bgSoundHandle))
- _system->delayMillis(100);
-
if (_decoderType == kVideoDecoderPSX) {
// Need to jump back to paletted color
initGraphics(640, 480, true);
@@ -332,11 +328,11 @@ bool MoviePlayer::playVideo() {
if (_decoderType == kVideoDecoderPSX)
drawFramePSX(frame);
else
- _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
}
if (_decoder->hasDirtyPalette()) {
- _decoder->setSystemPalette();
+ _vm->_system->getPaletteManager()->setPalette(_decoder->getPalette(), 0, 256);
uint32 maxWeight = 0;
uint32 minWeight = 0xFFFFFFFF;
@@ -401,36 +397,24 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) {
uint16 x = (g_system->getWidth() - scaledFrame.w) / 2;
uint16 y = (g_system->getHeight() - scaledFrame.h) / 2;
- _vm->_system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
+ _vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
scaledFrame.free();
}
-DXADecoderWithSound::DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle)
- : _mixer(mixer), _bgSoundHandle(bgSoundHandle) {
-}
-
-uint32 DXADecoderWithSound::getElapsedTime() const {
- if (_mixer->isSoundHandleActive(*_bgSoundHandle))
- return _mixer->getSoundElapsedTime(*_bgSoundHandle);
-
- return DXADecoder::getElapsedTime();
-}
-
///////////////////////////////////////////////////////////////////////////////
// Factory function for creating the appropriate cutscene player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, uint32 frameCount) {
+MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system, uint32 frameCount) {
Common::String filename;
- Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle;
filename = Common::String::format("%s.str", name);
if (Common::File::exists(filename)) {
#ifdef USE_RGB_COLOR
Video::VideoDecoder *psxDecoder = new Video::PSXStreamDecoder(Video::PSXStreamDecoder::kCD2x, frameCount);
- return new MoviePlayer(vm, snd, system, bgSoundHandle, psxDecoder, kVideoDecoderPSX);
+ return new MoviePlayer(vm, system, psxDecoder, kVideoDecoderPSX);
#else
GUI::MessageDialog dialog(_("PSX cutscenes found but ScummVM has been built without RGB color support"), _("OK"));
dialog.runModal();
@@ -441,16 +425,16 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *s
filename = Common::String::format("%s.smk", name);
if (Common::File::exists(filename)) {
- Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd);
- return new MoviePlayer(vm, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
+ Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder();
+ return new MoviePlayer(vm, system, smkDecoder, kVideoDecoderSMK);
}
filename = Common::String::format("%s.dxa", name);
if (Common::File::exists(filename)) {
#ifdef USE_ZLIB
- DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle);
- return new MoviePlayer(vm, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA);
+ Video::DXADecoder *dxaDecoder = new Video::DXADecoder();
+ return new MoviePlayer(vm, system, dxaDecoder, kVideoDecoderDXA);
#else
GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK"));
dialog.runModal();
diff --git a/engines/sword2/animation.h b/engines/sword2/animation.h
index 3ef8dac754..b2a243b2ca 100644
--- a/engines/sword2/animation.h
+++ b/engines/sword2/animation.h
@@ -25,12 +25,16 @@
#ifndef SWORD2_ANIMATION_H
#define SWORD2_ANIMATION_H
-#include "video/dxa_decoder.h"
-#include "video/video_decoder.h"
-#include "audio/mixer.h"
-
#include "sword2/screen.h"
+namespace Graphics {
+struct Surface;
+}
+
+namespace Video {
+class VideoDecoder;
+}
+
namespace Sword2 {
enum DecoderType {
@@ -55,20 +59,9 @@ struct MovieText {
}
};
-class DXADecoderWithSound : public Video::DXADecoder {
-public:
- DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle);
- ~DXADecoderWithSound() {}
-
- uint32 getElapsedTime() const;
-private:
- Audio::Mixer *_mixer;
- Audio::SoundHandle *_bgSoundHandle;
-};
-
class MoviePlayer {
public:
- MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType);
+ MoviePlayer(Sword2Engine *vm, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType);
virtual ~MoviePlayer();
bool load(const char *name);
@@ -76,7 +69,6 @@ public:
protected:
Sword2Engine *_vm;
- Audio::Mixer *_snd;
OSystem *_system;
MovieText *_movieTexts;
uint32 _numMovieTexts;
@@ -87,8 +79,6 @@ protected:
DecoderType _decoderType;
Video::VideoDecoder *_decoder;
- Audio::SoundHandle *_bgSoundHandle;
- Audio::AudioStream *_bgSoundStream;
uint32 _leadOut;
int _leadOutFrame;
@@ -105,7 +95,7 @@ protected:
uint32 getWhiteColor();
};
-MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, uint32 frameCount);
+MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system, uint32 frameCount);
} // End of namespace Sword2
diff --git a/engines/sword2/function.cpp b/engines/sword2/function.cpp
index 836b252d6c..07fcaa094b 100644
--- a/engines/sword2/function.cpp
+++ b/engines/sword2/function.cpp
@@ -2139,7 +2139,7 @@ int32 Logic::fnPlaySequence(int32 *params) {
uint32 frameCount = Sword2Engine::isPsx() ? params[1] : 0;
- _moviePlayer = makeMoviePlayer(filename, _vm, _vm->_mixer, _vm->_system, frameCount);
+ _moviePlayer = makeMoviePlayer(filename, _vm, _vm->_system, frameCount);
if (_moviePlayer && _moviePlayer->load(filename)) {
_moviePlayer->play(_sequenceTextList, _sequenceTextLines, _smackerLeadIn, _smackerLeadOut);
diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp
index cb0923cc2f..91a5e2e86b 100644
--- a/engines/sword2/sprite.cpp
+++ b/engines/sword2/sprite.cpp
@@ -772,7 +772,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
src = sprite + rs.top * srcPitch + rs.left;
dst = _buffer + _screenWide * rd.top + rd.left;
- if (s->type & RDSPR_BLEND) {
+ 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
@@ -783,7 +783,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
// 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()) {
+ 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/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index c395186570..458a2d33ed 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -32,6 +32,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "engines/metaengine.h"
#include "engines/util.h"
@@ -74,6 +75,13 @@ static const GameSettings sword2_settings[] = {
} // End of namespace Sword2
+static const ExtraGuiOption sword2ExtraGuiOption = {
+ _s("Show object labels"),
+ _s("Show labels for objects on mouse hover"),
+ "object_labels",
+ false
+};
+
class Sword2MetaEngine : public MetaEngine {
public:
virtual const char *getName() const {
@@ -85,6 +93,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const Common::FSList &fslist) const;
virtual SaveStateList listSaves(const char *target) const;
@@ -119,6 +128,12 @@ GameList Sword2MetaEngine::getSupportedGames() const {
return games;
}
+const ExtraGuiOptions Sword2MetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ ExtraGuiOptions options;
+ options.push_back(sword2ExtraGuiOption);
+ return options;
+}
+
GameDescriptor Sword2MetaEngine::findGame(const char *gameid) const {
const Sword2::GameSettings *g = Sword2::sword2_settings;
while (g->gameid) {
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp
index d0ad41de22..a95532ec65 100644
--- a/engines/sword25/fmv/movieplayer.cpp
+++ b/engines/sword25/fmv/movieplayer.cpp
@@ -61,6 +61,7 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) {
// Get the file and load it into the decoder
Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(filename);
_decoder.loadStream(in);
+ _decoder.start();
GraphicEngine *pGfx = Kernel::getInstance()->getGfx();
@@ -129,10 +130,10 @@ void MoviePlayer::update() {
assert(s->format.bytesPerPixel == 4);
#ifdef THEORA_INDIRECT_RENDERING
- byte *frameData = (byte *)s->getBasePtr(0, 0);
+ const byte *frameData = (const byte *)s->getBasePtr(0, 0);
_outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch);
#else
- g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
+ g_system->copyRectToScreen(s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
g_system->updateScreen();
#endif
}
@@ -167,7 +168,7 @@ void MoviePlayer::setScaleFactor(float scaleFactor) {
}
double MoviePlayer::getTime() {
- return _decoder.getElapsedTime() / 1000.0;
+ return _decoder.getTime() / 1000.0;
}
#else // USE_THEORADEC
diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h
index 1d256e56ba..2f5614b505 100644
--- a/engines/sword25/fmv/movieplayer.h
+++ b/engines/sword25/fmv/movieplayer.h
@@ -39,7 +39,7 @@
#include "sword25/gfx/bitmap.h"
#ifdef USE_THEORADEC
-#include "sword25/fmv/theora_decoder.h"
+#include "video/theora_decoder.h"
#endif
#define THEORA_INDIRECT_RENDERING
@@ -141,7 +141,7 @@ private:
#ifdef USE_THEORADEC
- TheoraDecoder _decoder;
+ Video::TheoraDecoder _decoder;
Graphics::Surface *_backSurface;
int _outX, _outY;
diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp
deleted file mode 100644
index a7ebb5df8c..0000000000
--- a/engines/sword25/fmv/theora_decoder.cpp
+++ /dev/null
@@ -1,555 +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.
- *
- */
-
-/*
- * Source is based on the player example from libvorbis package,
- * available at: http://svn.xiph.org/trunk/theora/examples/player_example.c
- *
- * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.
- *
- * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009
- * by the Xiph.Org Foundation and contributors http://www.xiph.org/
- *
- */
-
-#include "sword25/fmv/theora_decoder.h"
-
-#ifdef USE_THEORADEC
-#include "common/system.h"
-#include "common/textconsole.h"
-#include "common/util.h"
-#include "graphics/yuv_to_rgb.h"
-#include "audio/decoders/raw.h"
-#include "sword25/kernel/common.h"
-
-namespace Sword25 {
-
-#define AUDIOFD_FRAGSIZE 10240
-
-static double rint(double v) {
- return floor(v + 0.5);
-}
-
-TheoraDecoder::TheoraDecoder(Audio::Mixer::SoundType soundType) {
- _fileStream = 0;
-
- _theoraPacket = 0;
- _vorbisPacket = 0;
- _theoraDecode = 0;
- _theoraSetup = 0;
- _nextFrameStartTime = 0.0;
-
- _soundType = soundType;
- _audStream = 0;
- _audHandle = new Audio::SoundHandle();
-
- ogg_sync_init(&_oggSync);
-
- _curFrame = -1;
- _audiobuf = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t));
-
- reset();
-}
-
-TheoraDecoder::~TheoraDecoder() {
- close();
- delete _fileStream;
- delete _audHandle;
- free(_audiobuf);
-}
-
-void TheoraDecoder::queuePage(ogg_page *page) {
- if (_theoraPacket)
- ogg_stream_pagein(&_theoraOut, page);
-
- if (_vorbisPacket)
- ogg_stream_pagein(&_vorbisOut, page);
-}
-
-int TheoraDecoder::bufferData() {
- char *buffer = ogg_sync_buffer(&_oggSync, 4096);
- int bytes = _fileStream->read(buffer, 4096);
-
- ogg_sync_wrote(&_oggSync, bytes);
-
- return bytes;
-}
-
-bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
- close();
-
- _endOfAudio = false;
- _endOfVideo = false;
- _fileStream = stream;
-
- // start up Ogg stream synchronization layer
- ogg_sync_init(&_oggSync);
-
- // init supporting Vorbis structures needed in header parsing
- vorbis_info_init(&_vorbisInfo);
- vorbis_comment_init(&_vorbisComment);
-
- // init supporting Theora structures needed in header parsing
- th_comment_init(&_theoraComment);
- th_info_init(&_theoraInfo);
-
- // Ogg file open; parse the headers
- // Only interested in Vorbis/Theora streams
- bool foundHeader = false;
- while (!foundHeader) {
- int ret = bufferData();
-
- if (ret == 0)
- break;
-
- while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) {
- ogg_stream_state test;
-
- // is this a mandated initial header? If not, stop parsing
- if (!ogg_page_bos(&_oggPage)) {
- // don't leak the page; get it into the appropriate stream
- queuePage(&_oggPage);
- foundHeader = true;
- break;
- }
-
- ogg_stream_init(&test, ogg_page_serialno(&_oggPage));
- ogg_stream_pagein(&test, &_oggPage);
- ogg_stream_packetout(&test, &_oggPacket);
-
- // identify the codec: try theora
- if (!_theoraPacket && th_decode_headerin(&_theoraInfo, &_theoraComment, &_theoraSetup, &_oggPacket) >= 0) {
- // it is theora
- memcpy(&_theoraOut, &test, sizeof(test));
- _theoraPacket = 1;
- } else if (!_vorbisPacket && vorbis_synthesis_headerin(&_vorbisInfo, &_vorbisComment, &_oggPacket) >= 0) {
- // it is vorbis
- memcpy(&_vorbisOut, &test, sizeof(test));
- _vorbisPacket = 1;
- } else {
- // whatever it is, we don't care about it
- ogg_stream_clear(&test);
- }
- }
- // fall through to non-bos page parsing
- }
-
- // we're expecting more header packets.
- while ((_theoraPacket && _theoraPacket < 3) || (_vorbisPacket && _vorbisPacket < 3)) {
- int ret;
-
- // look for further theora headers
- while (_theoraPacket && (_theoraPacket < 3) && (ret = ogg_stream_packetout(&_theoraOut, &_oggPacket))) {
- if (ret < 0)
- error("Error parsing Theora stream headers; corrupt stream?");
-
- if (!th_decode_headerin(&_theoraInfo, &_theoraComment, &_theoraSetup, &_oggPacket))
- error("Error parsing Theora stream headers; corrupt stream?");
-
- _theoraPacket++;
- }
-
- // look for more vorbis header packets
- while (_vorbisPacket && (_vorbisPacket < 3) && (ret = ogg_stream_packetout(&_vorbisOut, &_oggPacket))) {
- if (ret < 0)
- error("Error parsing Vorbis stream headers; corrupt stream?");
-
- if (vorbis_synthesis_headerin(&_vorbisInfo, &_vorbisComment, &_oggPacket))
- error("Error parsing Vorbis stream headers; corrupt stream?");
-
- _vorbisPacket++;
-
- if (_vorbisPacket == 3)
- break;
- }
-
- // The header pages/packets will arrive before anything else we
- // care about, or the stream is not obeying spec
-
- if (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) {
- queuePage(&_oggPage); // demux into the appropriate stream
- } else {
- ret = bufferData(); // someone needs more data
-
- if (ret == 0)
- error("End of file while searching for codec headers.");
- }
- }
-
- // and now we have it all. initialize decoders
- if (_theoraPacket) {
- _theoraDecode = th_decode_alloc(&_theoraInfo, _theoraSetup);
- debugN(1, "Ogg logical stream %lx is Theora %dx%d %.02f fps",
- _theoraOut.serialno, _theoraInfo.pic_width, _theoraInfo.pic_height,
- (double)_theoraInfo.fps_numerator / _theoraInfo.fps_denominator);
-
- switch (_theoraInfo.pixel_fmt) {
- case TH_PF_420:
- debug(1, " 4:2:0 video");
- break;
- case TH_PF_422:
- debug(1, " 4:2:2 video");
- break;
- case TH_PF_444:
- debug(1, " 4:4:4 video");
- break;
- case TH_PF_RSVD:
- default:
- debug(1, " video\n (UNKNOWN Chroma sampling!)");
- break;
- }
-
- if (_theoraInfo.pic_width != _theoraInfo.frame_width || _theoraInfo.pic_height != _theoraInfo.frame_height)
- debug(1, " Frame content is %dx%d with offset (%d,%d).",
- _theoraInfo.frame_width, _theoraInfo.frame_height, _theoraInfo.pic_x, _theoraInfo.pic_y);
-
- switch (_theoraInfo.colorspace){
- case TH_CS_UNSPECIFIED:
- /* nothing to report */
- break;
- case TH_CS_ITU_REC_470M:
- debug(1, " encoder specified ITU Rec 470M (NTSC) color.");
- break;
- case TH_CS_ITU_REC_470BG:
- debug(1, " encoder specified ITU Rec 470BG (PAL) color.");
- break;
- default:
- debug(1, "warning: encoder specified unknown colorspace (%d).", _theoraInfo.colorspace);
- break;
- }
-
- debug(1, "Encoded by %s", _theoraComment.vendor);
- if (_theoraComment.comments) {
- debug(1, "theora comment header:");
- for (int i = 0; i < _theoraComment.comments; i++) {
- if (_theoraComment.user_comments[i]) {
- int len = _theoraComment.comment_lengths[i];
- char *value = (char *)malloc(len + 1);
- if (value) {
- memcpy(value, _theoraComment.user_comments[i], len);
- value[len] = '\0';
- debug(1, "\t%s", value);
- free(value);
- }
- }
- }
- }
-
- th_decode_ctl(_theoraDecode, TH_DECCTL_GET_PPLEVEL_MAX, &_ppLevelMax, sizeof(_ppLevelMax));
- _ppLevel = _ppLevelMax;
- th_decode_ctl(_theoraDecode, TH_DECCTL_SET_PPLEVEL, &_ppLevel, sizeof(_ppLevel));
- _ppInc = 0;
- } else {
- // tear down the partial theora setup
- th_info_clear(&_theoraInfo);
- th_comment_clear(&_theoraComment);
- }
-
- th_setup_free(_theoraSetup);
- _theoraSetup = 0;
-
- if (_vorbisPacket) {
- vorbis_synthesis_init(&_vorbisDSP, &_vorbisInfo);
- vorbis_block_init(&_vorbisDSP, &_vorbisBlock);
- debug(3, "Ogg logical stream %lx is Vorbis %d channel %ld Hz audio.",
- _vorbisOut.serialno, _vorbisInfo.channels, _vorbisInfo.rate);
-
- _audStream = Audio::makeQueuingAudioStream(_vorbisInfo.rate, _vorbisInfo.channels);
-
- // Get enough audio data to start us off
- while (_audStream->numQueuedStreams() == 0) {
- // Queue more data
- bufferData();
- while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0)
- queuePage(&_oggPage);
-
- queueAudio();
- }
-
- if (_audStream)
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _audHandle, _audStream);
- } else {
- // tear down the partial vorbis setup
- vorbis_info_clear(&_vorbisInfo);
- vorbis_comment_clear(&_vorbisComment);
- _endOfAudio = true;
- }
-
- _surface.create(_theoraInfo.frame_width, _theoraInfo.frame_height, g_system->getScreenFormat());
-
- // Set up a display surface
- _displaySurface.pixels = _surface.getBasePtr(_theoraInfo.pic_x, _theoraInfo.pic_y);
- _displaySurface.w = _theoraInfo.pic_width;
- _displaySurface.h = _theoraInfo.pic_height;
- _displaySurface.format = _surface.format;
- _displaySurface.pitch = _surface.pitch;
-
- // Set the frame rate
- _frameRate = Common::Rational(_theoraInfo.fps_numerator, _theoraInfo.fps_denominator);
-
- return true;
-}
-
-void TheoraDecoder::close() {
- if (_vorbisPacket) {
- ogg_stream_clear(&_vorbisOut);
- vorbis_block_clear(&_vorbisBlock);
- vorbis_dsp_clear(&_vorbisDSP);
- vorbis_comment_clear(&_vorbisComment);
- vorbis_info_clear(&_vorbisInfo);
-
- g_system->getMixer()->stopHandle(*_audHandle);
-
- _audStream = 0;
- _vorbisPacket = false;
- }
- if (_theoraPacket) {
- ogg_stream_clear(&_theoraOut);
- th_decode_free(_theoraDecode);
- th_comment_clear(&_theoraComment);
- th_info_clear(&_theoraInfo);
- _theoraDecode = 0;
- _theoraPacket = false;
- }
-
- if (!_fileStream)
- return;
-
- ogg_sync_clear(&_oggSync);
-
- delete _fileStream;
- _fileStream = 0;
-
- _surface.free();
- _displaySurface.pixels = 0;
- _displaySurface.free();
-
- reset();
-}
-
-const Graphics::Surface *TheoraDecoder::decodeNextFrame() {
- // First, let's get our frame
- while (_theoraPacket) {
- // theora is one in, one out...
- if (ogg_stream_packetout(&_theoraOut, &_oggPacket) > 0) {
-
- if (_ppInc) {
- _ppLevel += _ppInc;
- th_decode_ctl(_theoraDecode, TH_DECCTL_SET_PPLEVEL, &_ppLevel, sizeof(_ppLevel));
- _ppInc = 0;
- }
-
- if (th_decode_packetin(_theoraDecode, &_oggPacket, NULL) == 0) {
- _curFrame++;
-
- // Convert YUV data to RGB data
- th_ycbcr_buffer yuv;
- th_decode_ycbcr_out(_theoraDecode, yuv);
- translateYUVtoRGBA(yuv);
-
- if (_curFrame == 0)
- _startTime = g_system->getMillis();
-
- double time = th_granule_time(_theoraDecode, _oggPacket.granulepos);
-
- // We need to calculate when the next frame should be shown
- // This is all in floating point because that's what the Ogg code gives us
- // Ogg is a lossy container format, so it doesn't always list the time to the
- // next frame. In such cases, we need to calculate it ourselves.
- if (time == -1.0)
- _nextFrameStartTime += _frameRate.getInverse().toDouble();
- else
- _nextFrameStartTime = time;
-
- // break out
- break;
- }
- } else {
- // If we can't get any more frames, we're done.
- if (_theoraOut.e_o_s || _fileStream->eos()) {
- _endOfVideo = true;
- break;
- }
-
- // Queue more data
- bufferData();
- while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0)
- queuePage(&_oggPage);
- }
-
- // Update audio if we can
- queueAudio();
- }
-
- // Force at least some audio to be buffered
- // TODO: 5 is very arbitrary. We probably should do something like QuickTime does.
- while (!_endOfAudio && _audStream->numQueuedStreams() < 5) {
- bufferData();
- while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0)
- queuePage(&_oggPage);
-
- bool queuedAudio = queueAudio();
- if ((_vorbisOut.e_o_s || _fileStream->eos()) && !queuedAudio) {
- _endOfAudio = true;
- break;
- }
- }
-
- return &_displaySurface;
-}
-
-bool TheoraDecoder::queueAudio() {
- if (!_audStream)
- return false;
-
- // An audio buffer should have been allocated (either in the constructor or after queuing the current buffer)
- if (!_audiobuf) {
- warning("[TheoraDecoder::queueAudio] Invalid audio buffer");
- return false;
- }
-
- bool queuedAudio = false;
-
- for (;;) {
- float **pcm;
-
- // if there's pending, decoded audio, grab it
- int ret = vorbis_synthesis_pcmout(&_vorbisDSP, &pcm);
- if (ret > 0) {
- int count = _audiobufFill / 2;
- int maxsamples = ((AUDIOFD_FRAGSIZE - _audiobufFill) / _vorbisInfo.channels) >> 1;
- int i;
- for (i = 0; i < ret && i < maxsamples; i++)
- for (int j = 0; j < _vorbisInfo.channels; j++) {
- int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767);
- _audiobuf[count++] = val;
- }
-
- vorbis_synthesis_read(&_vorbisDSP, i);
- _audiobufFill += (i * _vorbisInfo.channels) << 1;
-
- if (_audiobufFill == AUDIOFD_FRAGSIZE) {
- byte flags = Audio::FLAG_16BITS | Audio::FLAG_STEREO;
-#ifdef SCUMM_LITTLE_ENDIAN
- flags |= Audio::FLAG_LITTLE_ENDIAN;
-#endif
- _audStream->queueBuffer((byte *)_audiobuf, AUDIOFD_FRAGSIZE, DisposeAfterUse::NO, flags);
-
- // The audio mixer is now responsible for the old audio buffer.
- // We need to create a new one.
- _audiobuf = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t));
- if (!_audiobuf) {
- warning("[TheoraDecoder::queueAudio] Cannot allocate memory for audio buffer");
- return false;
- }
-
- _audiobufFill = 0;
- queuedAudio = true;
- }
- } else {
- // no pending audio; is there a pending packet to decode?
- if (ogg_stream_packetout(&_vorbisOut, &_oggPacket) > 0) {
- if (vorbis_synthesis(&_vorbisBlock, &_oggPacket) == 0) // test for success!
- vorbis_synthesis_blockin(&_vorbisDSP, &_vorbisBlock);
- } else // we've buffered all we have, break out for now
- return queuedAudio;
- }
- }
-
- // Unreachable
- return false;
-}
-
-void TheoraDecoder::reset() {
- VideoDecoder::reset();
-
- // FIXME: This does a rewind() instead of a reset()!
-
- if (_fileStream)
- _fileStream->seek(0);
-
- _audiobufFill = 0;
- _audiobufReady = false;
-
- _curFrame = -1;
-
- _theoraPacket = 0;
- _vorbisPacket = 0;
-}
-
-bool TheoraDecoder::endOfVideo() const {
- return !isVideoLoaded() || (_endOfVideo && (!_audStream || (_audStream->endOfData() && _endOfAudio)));
-}
-
-uint32 TheoraDecoder::getTimeToNextFrame() const {
- if (endOfVideo() || _curFrame < 0)
- return 0;
-
- uint32 elapsedTime = getElapsedTime();
- uint32 nextFrameStartTime = (uint32)(_nextFrameStartTime * 1000);
-
- if (nextFrameStartTime <= elapsedTime)
- return 0;
-
- return nextFrameStartTime - elapsedTime;
-}
-
-uint32 TheoraDecoder::getElapsedTime() const {
- if (_audStream)
- return g_system->getMixer()->getSoundElapsedTime(*_audHandle);
-
- return VideoDecoder::getElapsedTime();
-}
-
-void TheoraDecoder::pauseVideoIntern(bool pause) {
- if (_audStream)
- g_system->getMixer()->pauseHandle(*_audHandle, pause);
-}
-
-enum TheoraYUVBuffers {
- kBufferY = 0,
- kBufferU = 1,
- kBufferV = 2
-};
-
-void TheoraDecoder::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer) {
- // Width and height of all buffers have to be divisible by 2.
- assert((YUVBuffer[kBufferY].width & 1) == 0);
- assert((YUVBuffer[kBufferY].height & 1) == 0);
- assert((YUVBuffer[kBufferU].width & 1) == 0);
- assert((YUVBuffer[kBufferV].width & 1) == 0);
-
- // UV images have to have a quarter of the Y image resolution
- assert(YUVBuffer[kBufferU].width == YUVBuffer[kBufferY].width >> 1);
- assert(YUVBuffer[kBufferV].width == YUVBuffer[kBufferY].width >> 1);
- assert(YUVBuffer[kBufferU].height == YUVBuffer[kBufferY].height >> 1);
- assert(YUVBuffer[kBufferV].height == YUVBuffer[kBufferY].height >> 1);
-
- Graphics::convertYUV420ToRGB(&_surface, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride);
-}
-
-} // End of namespace Sword25
-
-#endif
diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h
deleted file mode 100644
index e8cc5ab8b9..0000000000
--- a/engines/sword25/fmv/theora_decoder.h
+++ /dev/null
@@ -1,141 +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 SWORD25_THEORADECODER_H
-#define SWORD25_THEORADECODER_H
-
-#include "common/scummsys.h" // for USE_THEORADEC
-
-#ifdef USE_THEORADEC
-
-#include "common/rational.h"
-#include "video/video_decoder.h"
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "graphics/pixelformat.h"
-#include "graphics/surface.h"
-
-#include <theora/theoradec.h>
-#include <vorbis/codec.h>
-
-namespace Common {
-class SeekableReadStream;
-}
-
-namespace Sword25 {
-
-/**
- *
- * Decoder for Theora videos.
- * Video decoder used in engines:
- * - sword25
- */
-class TheoraDecoder : public Video::VideoDecoder {
-public:
- TheoraDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
- virtual ~TheoraDecoder();
-
- /**
- * Load a video file
- * @param stream the stream to load
- */
- bool loadStream(Common::SeekableReadStream *stream);
- void close();
- void reset();
-
- /**
- * Decode the next frame and return the frame's surface
- * @note the return surface should *not* be freed
- * @note this may return 0, in which case the last frame should be kept on screen
- */
- const Graphics::Surface *decodeNextFrame();
-
- bool isVideoLoaded() const { return _fileStream != 0; }
- uint16 getWidth() const { return _displaySurface.w; }
- uint16 getHeight() const { return _displaySurface.h; }
-
- uint32 getFrameCount() const {
- // It is not possible to get frame count easily
- // I.e. seeking is required
- assert(0);
- return 0;
- }
-
- Graphics::PixelFormat getPixelFormat() const { return _displaySurface.format; }
- uint32 getElapsedTime() const;
- uint32 getTimeToNextFrame() const;
-
- bool endOfVideo() const;
-
-protected:
- void pauseVideoIntern(bool pause);
-
-private:
- void queuePage(ogg_page *page);
- bool queueAudio();
- int bufferData();
- void translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer);
-
- Common::SeekableReadStream *_fileStream;
- Graphics::Surface _surface;
- Graphics::Surface _displaySurface;
- Common::Rational _frameRate;
- double _nextFrameStartTime;
- bool _endOfVideo;
- bool _endOfAudio;
-
- Audio::Mixer::SoundType _soundType;
- Audio::SoundHandle *_audHandle;
- Audio::QueuingAudioStream *_audStream;
-
- ogg_sync_state _oggSync;
- ogg_page _oggPage;
- ogg_packet _oggPacket;
- ogg_stream_state _vorbisOut;
- ogg_stream_state _theoraOut;
- th_info _theoraInfo;
- th_comment _theoraComment;
- th_dec_ctx *_theoraDecode;
- th_setup_info *_theoraSetup;
- vorbis_info _vorbisInfo;
- vorbis_dsp_state _vorbisDSP;
- vorbis_block _vorbisBlock;
- vorbis_comment _vorbisComment;
-
- int _theoraPacket;
- int _vorbisPacket;
-
- int _ppLevelMax;
- int _ppLevel;
- int _ppInc;
-
- // single audio fragment audio buffering
- int _audiobufFill;
- bool _audiobufReady;
- ogg_int16_t *_audiobuf;
-};
-
-} // End of namespace Sword25
-
-#endif
-
-#endif
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 14ba032107..6f5da32bc4 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -216,7 +216,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
}
}
- g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(rect.left, rect.top), _backSurface.pitch, rect.left, rect.top, rect.width(), rect.height());
+ g_system->copyRectToScreen(_backSurface.getBasePtr(rect.left, rect.top), _backSurface.pitch, rect.left, rect.top, rect.width(), rect.height());
}
return true;
diff --git a/engines/sword25/gfx/image/art.cpp b/engines/sword25/gfx/image/art.cpp
index 3944a207c8..9c4b9fe8bd 100644
--- a/engines/sword25/gfx/image/art.cpp
+++ b/engines/sword25/gfx/image/art.cpp
@@ -2367,38 +2367,30 @@ ArtSVPRenderAAIter *art_svp_render_aa_iter(const ArtSVP *svp,
return iter;
}
-#define ADD_STEP(xpos, xdelta) \
+#define ADD_STEP(xpos, xdelta) \
/* stereotype code fragment for adding a step */ \
- if (n_steps == 0 || steps[n_steps - 1].x < xpos) \
- { \
+ if (n_steps == 0 || steps[n_steps - 1].x < xpos) { \
sx = n_steps; \
steps[sx].x = xpos; \
steps[sx].delta = xdelta; \
n_steps++; \
- } \
- else \
- { \
- for (sx = n_steps; sx > 0; sx--) \
- { \
- if (steps[sx - 1].x == xpos) \
- { \
+ } else { \
+ for (sx = n_steps; sx > 0; sx--) { \
+ if (steps[sx - 1].x == xpos) { \
steps[sx - 1].delta += xdelta; \
sx = n_steps; \
break; \
- } \
- else if (steps[sx - 1].x < xpos) \
- { \
+ } else if (steps[sx - 1].x < xpos) { \
break; \
- } \
- } \
- if (sx < n_steps) \
- { \
+ } \
+ } \
+ if (sx < n_steps) { \
memmove (&steps[sx + 1], &steps[sx], \
(n_steps - sx) * sizeof(steps[0])); \
steps[sx].x = xpos; \
steps[sx].delta = xdelta; \
n_steps++; \
- } \
+ } \
}
void art_svp_render_aa_iter_step(ArtSVPRenderAAIter *iter, int *p_start,
diff --git a/engines/sword25/gfx/image/art.h b/engines/sword25/gfx/image/art.h
index 8c9c97bc57..40bcb55aa7 100644
--- a/engines/sword25/gfx/image/art.h
+++ b/engines/sword25/gfx/image/art.h
@@ -50,7 +50,7 @@ namespace Sword25 {
be variables. They can also be pstruct->el lvalues. */
#define art_expand(p, type, max) \
do { \
- if(max) {\
+ if (max) {\
type *tmp = art_renew(p, type, max <<= 1); \
if (!tmp) error("Cannot reallocate memory for art data"); \
p = tmp; \
diff --git a/engines/sword25/gfx/image/imgloader.cpp b/engines/sword25/gfx/image/imgloader.cpp
index 1df0fba70c..e103626416 100644
--- a/engines/sword25/gfx/image/imgloader.cpp
+++ b/engines/sword25/gfx/image/imgloader.cpp
@@ -33,18 +33,19 @@
#include "sword25/gfx/image/image.h"
#include "sword25/gfx/image/imgloader.h"
#include "graphics/pixelformat.h"
-#include "graphics/png.h"
+#include "graphics/decoders/png.h"
namespace Sword25 {
bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize, byte *&uncompressedDataPtr, int &width, int &height, int &pitch) {
Common::MemoryReadStream *fileStr = new Common::MemoryReadStream(fileDataPtr, fileSize, DisposeAfterUse::NO);
- Graphics::PNG *png = new Graphics::PNG();
- if (!png->read(fileStr)) // the fileStr pointer, and thus pFileData will be deleted after this is done
+
+ Graphics::PNGDecoder png;
+ if (!png.loadStream(*fileStr)) // the fileStr pointer, and thus pFileData will be deleted after this is done
error("Error while reading PNG image");
- Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24);
- Graphics::Surface *pngSurface = png->getSurface(format);
+ const Graphics::Surface *sourceSurface = png.getSurface();
+ Graphics::Surface *pngSurface = sourceSurface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24), png.getPalette());
width = pngSurface->w;
height = pngSurface->h;
@@ -53,7 +54,7 @@ bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize, byte *&un
pngSurface->free();
delete pngSurface;
- delete png;
+ delete fileStr;
// Signal success
return true;
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index b0d4853e5e..27ee4ef182 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -430,7 +430,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
ino += inoStep;
}
- g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY,
+ g_system->copyRectToScreen(_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY,
img->w, img->h);
}
diff --git a/engines/sword25/kernel/inputpersistenceblock.cpp b/engines/sword25/kernel/inputpersistenceblock.cpp
index cdce539c31..0fe5d88b80 100644
--- a/engines/sword25/kernel/inputpersistenceblock.cpp
+++ b/engines/sword25/kernel/inputpersistenceblock.cpp
@@ -86,7 +86,7 @@ void InputPersistenceBlock::read(bool &value) {
if (checkMarker(BOOL_MARKER)) {
uint uintBool = READ_LE_UINT32(_iter);
_iter += 4;
- value = uintBool == 0 ? false : true;
+ value = uintBool != 0;
} else {
value = false;
}
diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk
index 302120c500..e24a221244 100644
--- a/engines/sword25/module.mk
+++ b/engines/sword25/module.mk
@@ -85,11 +85,6 @@ MODULE_OBJS := \
util/pluto/pluto.o \
util/pluto/plzio.o
-ifdef USE_THEORADEC
-MODULE_OBJS += \
- fmv/theora_decoder.o
-endif
-
# This module can be built as a plugin
ifeq ($(ENABLE_SWORD25), DYNAMIC_PLUGIN)
PLUGIN := 1
diff --git a/engines/sword25/script/luabindhelper.cpp b/engines/sword25/script/luabindhelper.cpp
index 8fbbe7e272..6900305f5c 100644
--- a/engines/sword25/script/luabindhelper.cpp
+++ b/engines/sword25/script/luabindhelper.cpp
@@ -412,7 +412,7 @@ Common::String LuaBindhelper::stackDump(lua_State *L) {
oss += "------------------- Stack Dump -------------------\n";
while (i) {
- oss += i + ": " + getLuaValueInfo(L, i) + "\n";
+ oss += Common::String::format("%d: ", i) + getLuaValueInfo(L, i) + "\n";
i--;
}
diff --git a/engines/sword25/script/luabindhelper.h b/engines/sword25/script/luabindhelper.h
index 0cb6d37bdc..5223d4440e 100644
--- a/engines/sword25/script/luabindhelper.h
+++ b/engines/sword25/script/luabindhelper.h
@@ -40,7 +40,7 @@
namespace Sword25 {
#define lua_pushbooleancpp(L, b) (lua_pushboolean(L, b ? 1 : 0))
-#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) == 0 ? false : true)
+#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) != 0)
struct lua_constant_reg {
const char *Name;
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index 78b2db19eb..61d53c89a7 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -239,16 +239,20 @@ void SoundEngine::setSoundVolume(uint handle, float volume) {
debugC(1, kDebugSound, "SoundEngine::setSoundVolume(%d, %f)", handle, volume);
SndHandle* sndHandle = findHandle(handle);
- if (sndHandle != NULL)
+ if (sndHandle != NULL) {
+ sndHandle->volume = volume;
_mixer->setChannelVolume(sndHandle->handle, (byte)(volume * 255));
+ }
}
void SoundEngine::setSoundPanning(uint handle, float pan) {
debugC(1, kDebugSound, "SoundEngine::setSoundPanning(%d, %f)", handle, pan);
SndHandle* sndHandle = findHandle(handle);
- if (sndHandle != NULL)
+ if (sndHandle != NULL) {
+ sndHandle->pan = pan;
_mixer->setChannelBalance(sndHandle->handle, (int8)(pan * 127));
+ }
}
void SoundEngine::pauseSound(uint handle) {
@@ -324,13 +328,16 @@ bool SoundEngine::canLoadResource(const Common::String &fileName) {
return fname.hasSuffix(".ogg");
}
-
- bool SoundEngine::persist(OutputPersistenceBlock &writer) {
+bool SoundEngine::persist(OutputPersistenceBlock &writer) {
writer.write(_maxHandleId);
for (uint i = 0; i < SOUND_HANDLES; i++) {
writer.write(_handles[i].id);
+ // Don't restart sounds which already finished playing.
+ if (_handles[i].type != kFreeHandle && !_mixer->isSoundHandleActive(_handles[i].handle))
+ _handles[i].type = kFreeHandle;
+
writer.writeString(_handles[i].fileName);
writer.write((int)_handles[i].sndType);
writer.write(_handles[i].volume);
@@ -363,7 +370,7 @@ bool SoundEngine::unpersist(InputPersistenceBlock &reader) {
int loopStart;
int loopEnd;
uint layer;
-
+
reader.readString(fileName);
reader.read(sndType);
reader.read(volume);
@@ -374,7 +381,8 @@ bool SoundEngine::unpersist(InputPersistenceBlock &reader) {
reader.read(layer);
if (reader.isGood()) {
- playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i);
+ if (sndType != kFreeHandle)
+ playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i);
} else
return false;
}
diff --git a/engines/sword25/util/lua/luaconf.h b/engines/sword25/util/lua/luaconf.h
index 38ff9e1320..53d0f55290 100644
--- a/engines/sword25/util/lua/luaconf.h
+++ b/engines/sword25/util/lua/luaconf.h
@@ -182,8 +182,7 @@
#define LUAI_FUNC static
#define LUAI_DATA /* empty */
-#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
- defined(__ELF__) && !defined(__PLAYSTATION2__)
+#elif GCC_ATLEAST(3, 2) && defined(__ELF__) && !defined(__PLAYSTATION2__)
/*
** The PS2 gcc compiler doesn't like the visibility attribute, so
** we use the normal "extern" definitions in the block below
diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp
index d645e5ed2a..b7f5e30340 100644
--- a/engines/sword25/util/pluto/pluto.cpp
+++ b/engines/sword25/util/pluto/pluto.cpp
@@ -895,10 +895,10 @@ static void unpersistnumber(UnpersistInfo *upi)
static void unpersiststring(UnpersistInfo *upi)
{
/* perms reftbl sptbl ref */
- int length;
+ size_t length;
char* string;
lua_checkstack(upi->L, 1);
- verify(LIF(Z,read)(&upi->zio, &length, sizeof(int)) == 0);
+ verify(LIF(Z,read)(&upi->zio, &length, sizeof(size_t)) == 0);
string = pdep_newvector(upi->L, length, char);
verify(LIF(Z,read)(&upi->zio, string, length) == 0);
lua_pushlstring(upi->L, string, length);
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index 8882531d27..934727a478 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -2252,7 +2252,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
case 0x78e0:
- processCallback(0x50c5);
+ processCallback(0x505c);
return false;
case 0x78e7:
@@ -2265,7 +2265,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
case 0x78f5:
if (CHECK_FLAG(0xDB95, 1)) {
- displayMessage(0x3575);
+ displayMessage(0x3E75);
return true;
} else
return false;
@@ -3925,7 +3925,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x39ae);
break;
default:
- displayMessage(0x39b7);
+ displayMessage(0x3ab7);
}
return true;
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index dad876dd97..2de6f49c44 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -80,7 +80,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = {
};
enum {
- MAX_SAVES = 20
+ MAX_SAVES = 20
};
class TeenAgentMetaEngine : public AdvancedMetaEngine {
@@ -123,16 +123,15 @@ public:
virtual SaveStateList listSaves(const char *target) const {
Common::String pattern = target;
- pattern += ".*";
+ pattern += ".??";
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
Common::sort(filenames.begin(), filenames.end());
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
- int slot;
- const char *ext = strrchr(file->c_str(), '.');
- if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) {
+ int slot = atoi(file->c_str() + file->size() - 2);
+ if (slot >= 0 && slot < MAX_SAVES) {
Common::ScopedPtr<Common::InSaveFile> in(g_system->getSavefileManager()->openForLoading(*file));
if (!in)
continue;
@@ -174,7 +173,6 @@ public:
return SaveStateDescriptor(slot, desc);
SaveStateDescriptor ssd(slot, desc);
- ssd.setDeletableFlag(true);
//checking for the thumbnail
if (Graphics::Surface *const thumb = Graphics::loadThumbnail(*in))
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 597ca670c0..dff58f98e2 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -22,6 +22,7 @@
#include "teenagent/resources.h"
#include "teenagent/teenagent.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "common/zlib.h"
namespace TeenAgent {
@@ -64,28 +65,47 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
Common::File *dat_file = new Common::File();
if (!dat_file->open("teenagent.dat")) {
delete dat_file;
- Common::String errorMessage = "You're missing the 'teenagent.dat' file. Get it from the ScummVM website";
- GUIErrorMessage(errorMessage);
+ Common::String errorMessage = _("You're missing the 'teenagent.dat' file. Get it from the ScummVM website");
warning("%s", errorMessage.c_str());
+ GUIErrorMessage(errorMessage);
return false;
}
+
+ // teenagent.dat used to be compressed with zlib compression. The usage of
+ // zlib here is no longer needed, and it's maintained only for backwards
+ // compatibility.
Common::SeekableReadStream *dat = Common::wrapCompressedReadStream(dat_file);
+
+#if !defined(USE_ZLIB)
+ uint16 header = dat->readUint16BE();
+ bool isCompressed = (header == 0x1F8B ||
+ ((header & 0x0F00) == 0x0800 &&
+ header % 31 == 0));
+ dat->seek(-2, SEEK_CUR);
+
+ if (isCompressed) {
+ // teenagent.dat is compressed, but zlib hasn't been compiled in
+ delete dat;
+ Common::String errorMessage = _("The teenagent.dat file is compressed and zlib hasn't been included in this executable. Please decompress it");
+ warning("%s", errorMessage.c_str());
+ GUIErrorMessage(errorMessage);
+ return false;
+ }
+#endif
+
cseg.read(dat, 0xb3b0);
dseg.read(dat, 0xe790);
eseg.read(dat, 0x8be2);
-
delete dat;
- {
- FilePack varia;
- varia.open("varia.res");
- font7.load(varia, 7);
- font7.width_pack = 1;
- font7.height = 11;
- font8.load(varia, 8);
- font8.height = 31;
- varia.close();
- }
+ FilePack varia;
+ varia.open("varia.res");
+ font7.load(varia, 7);
+ font7.width_pack = 1;
+ font7.height = 11;
+ font8.load(varia, 8);
+ font8.height = 31;
+ varia.close();
off.open("off.res");
on.open("on.res");
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index e8c2dec4fa..038c8ea05e 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -423,7 +423,7 @@ void Scene::init(int id, const Common::Point &pos) {
if (now_playing != res->dseg.get_byte(0xDB90))
_engine->music->load(res->dseg.get_byte(0xDB90));
- _system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h);
+ _system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
setPalette(0);
}
@@ -654,7 +654,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
if (background.pixels && debug_features.feature[DebugFeatures::kShowBack]) {
- _system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h);
+ _system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
} else
_system->fillScreen(0);
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index fb228ef2fc..57c069fe59 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -389,7 +389,7 @@ bool TeenAgentEngine::showLogo() {
return true;
}
- _system->copyRectToScreen((const byte *)s.pixels, s.w, s.x, s.y, s.w, s.h);
+ _system->copyRectToScreen(s.pixels, s.w, s.x, s.y, s.w, s.h);
_system->updateScreen();
_system->delayMillis(100);
@@ -535,9 +535,8 @@ Common::Error TeenAgentEngine::run() {
syncSoundSettings();
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, false);
setMusic(1);
- music->start();
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, false);
int load_slot = Common::ConfigManager::instance().getInt("save_slot");
if (load_slot >= 0) {
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 36ec726fc7..590e6c6d81 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -935,7 +935,7 @@ TestExitStatus GFXtests::overlayGraphics() {
}
g_system->showOverlay();
- g_system->copyRectToOverlay(buffer, 100, 270, 175, 100, 50);
+ g_system->copyRectToOverlay(buffer, 200, 270, 175, 100, 50);
g_system->updateScreen();
g_system->delayMillis(1000);
@@ -1028,7 +1028,7 @@ TestExitStatus GFXtests::paletteRotation() {
GFXTestSuite::setCustomColor(255, 0, 0);
Testsuite::clearScreen();
- if(Testsuite::handleInteractiveInput("Did you see a rotation in colors of rectangles displayed on screen?", "Yes", "No", kOptionRight)) {
+ if (Testsuite::handleInteractiveInput("Did you see a rotation in colors of rectangles displayed on screen?", "Yes", "No", kOptionRight)) {
return kTestFailed;
}
@@ -1121,7 +1121,7 @@ TestExitStatus GFXtests::pixelFormats() {
g_system->updateScreen();
g_system->delayMillis(500);
- if(Testsuite::handleInteractiveInput("Were you able to notice the colored rectangles on the screen for this format?", "Yes", "No", kOptionLeft)) {
+ if (Testsuite::handleInteractiveInput("Were you able to notice the colored rectangles on the screen for this format?", "Yes", "No", kOptionLeft)) {
numPassed++;
} else {
numFailed++;
diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp
index 655179aa74..39eeca31bd 100644
--- a/engines/testbed/testsuite.cpp
+++ b/engines/testbed/testsuite.cpp
@@ -289,7 +289,7 @@ void Testsuite::execute() {
continue;
}
- if((*i)->isInteractive && !ConfParams.isSessionInteractive()) {
+ if ((*i)->isInteractive && !ConfParams.isSessionInteractive()) {
logPrintf("Info! Skipping Test: %s, non-interactive environment is selected\n", ((*i)->featureName).c_str());
_numTestsSkipped++;
continue;
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index acacd89667..0ba8b7cdba 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -319,8 +319,8 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
_ctx->pic = RestoreInterpretContext(r->pic);
-
- // The newly added check here specially sets the process to RES_NOT when loading a savegame.
+
+ // The newly added check here specially sets the process to RES_NOT when loading a savegame.
// This is needed particularly for the Psychiatrist scene in Discworld 1 - otherwise Rincewind
// can't go upstairs without leaving the building and returning. If this patch causes problems
// in other scenes, an added check for the hCode == 1174490602 could be added.
@@ -340,7 +340,7 @@ void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag) {
if (savegameFlag)
pic->resumeState = RES_SAVEGAME;
- g_scheduler->createProcess(PID_TCODE, ActorRestoredProcess, &r, sizeof(r));
+ CoroScheduler.createProcess(PID_TCODE, ActorRestoredProcess, &r, sizeof(r));
}
/**
@@ -358,7 +358,7 @@ void ActorEvent(int ano, TINSEL_EVENT event, PLR_EVENT be) {
atp.event = event;
atp.bev = be;
atp.pic = NULL;
- g_scheduler->createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp));
+ CoroScheduler.createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp));
}
}
@@ -369,7 +369,7 @@ void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEsca
ATP_INIT atp;
int index;
CORO_BEGIN_CONTEXT;
- PPROCESS pProc;
+ Common::PPROCESS pProc;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -389,7 +389,7 @@ void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEsca
myEscape);
if (atp.pic != NULL) {
- _ctx->pProc = g_scheduler->createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp));
+ _ctx->pProc = CoroScheduler.createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp));
AttachInterpret(atp.pic, _ctx->pProc);
if (bWait)
@@ -474,8 +474,8 @@ void StartTaggedActors(SCNHANDLE ah, int numActors, bool bRunScript) {
// Run actor's script for this scene
if (bRunScript) {
// Send in reverse order - they get swapped round in the scheduler
- ActorEvent(nullContext, taggedActors[i].id, SHOWEVENT, false, 0);
- ActorEvent(nullContext, taggedActors[i].id, STARTUP, false, 0);
+ ActorEvent(Common::nullContext, taggedActors[i].id, SHOWEVENT, false, 0);
+ ActorEvent(Common::nullContext, taggedActors[i].id, STARTUP, false, 0);
}
}
}
diff --git a/engines/tinsel/background.h b/engines/tinsel/background.h
index 34f1bd6dd2..cfa3998eda 100644
--- a/engines/tinsel/background.h
+++ b/engines/tinsel/background.h
@@ -24,9 +24,9 @@
#ifndef TINSEL_BACKGND_H // prevent multiple includes
#define TINSEL_BACKGND_H
+#include "common/coroutines.h"
#include "common/frac.h"
#include "common/rect.h"
-#include "tinsel/coroutine.h"
#include "tinsel/dw.h" // for SCNHANDLE
#include "tinsel/palette.h" // palette definitions
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index 72ba05f0b9..a3e21a8227 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -255,17 +255,17 @@ void StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
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));
+ CoroScheduler.createProcess(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL));
if (TinselV0) {
for (uint i = 1; i < FROM_LE_32(pfilm->numreels); ++i)
- g_scheduler->createProcess(PID_REEL, BGotherProcess, &pfilm->reels[i], sizeof(FREEL));
+ CoroScheduler.createProcess(PID_REEL, BGotherProcess, &pfilm->reels[i], sizeof(FREEL));
}
if (g_pBG[0] == NULL)
ControlStartOff();
- if (TinselV2 && (coroParam != nullContext))
+ if (TinselV2 && (coroParam != Common::nullContext))
CORO_GIVE_WAY;
CORO_END_CODE;
diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp
index 24d47b920f..438fd52a81 100644
--- a/engines/tinsel/bmv.cpp
+++ b/engines/tinsel/bmv.cpp
@@ -529,7 +529,7 @@ int BMVPlayer::MovieCommand(char cmd, int commandOffset) {
if (cmd & CD_PRINT) {
PRINT_CMD *pCmd = (PRINT_CMD *)(bigBuffer + commandOffset);
- MovieText(nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
+ MovieText(Common::nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
(int16)READ_LE_UINT16(&pCmd->x),
(int16)READ_LE_UINT16(&pCmd->y),
pCmd->fontId,
@@ -542,7 +542,7 @@ int BMVPlayer::MovieCommand(char cmd, int commandOffset) {
TALK_CMD *pCmd = (TALK_CMD *)(bigBuffer + commandOffset);
talkColor = TINSEL_RGB(pCmd->r, pCmd->g, pCmd->b);
- MovieText(nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
+ MovieText(Common::nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
(int16)READ_LE_UINT16(&pCmd->x),
(int16)READ_LE_UINT16(&pCmd->y),
0,
diff --git a/engines/tinsel/bmv.h b/engines/tinsel/bmv.h
index eadf65c3aa..fa254ed26d 100644
--- a/engines/tinsel/bmv.h
+++ b/engines/tinsel/bmv.h
@@ -24,12 +24,12 @@
#ifndef TINSEL_BMV_H
#define TINSEL_BMV_H
+#include "common/coroutines.h"
#include "common/file.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
-#include "tinsel/coroutine.h"
#include "tinsel/object.h"
#include "tinsel/palette.h"
diff --git a/engines/tinsel/coroutine.cpp b/engines/tinsel/coroutine.cpp
deleted file mode 100644
index ef0097f043..0000000000
--- a/engines/tinsel/coroutine.cpp
+++ /dev/null
@@ -1,82 +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 "tinsel/coroutine.h"
-#include "common/hashmap.h"
-#include "common/hash-str.h"
-
-namespace Tinsel {
-
-
-CoroContext nullContext = NULL; // FIXME: Avoid non-const global vars
-
-
-#if COROUTINE_DEBUG
-namespace {
-static int s_coroCount = 0;
-
-typedef Common::HashMap<Common::String, int> CoroHashMap;
-static CoroHashMap *s_coroFuncs = 0;
-
-static void changeCoroStats(const char *func, int change) {
- if (!s_coroFuncs)
- s_coroFuncs = new CoroHashMap();
-
- (*s_coroFuncs)[func] += change;
-}
-
-static void displayCoroStats() {
- debug("%d active coros", s_coroCount);
-
- // Loop over s_coroFuncs and print info about active coros
- if (!s_coroFuncs)
- return;
- for (CoroHashMap::const_iterator it = s_coroFuncs->begin();
- it != s_coroFuncs->end(); ++it) {
- if (it->_value != 0)
- debug(" %3d x %s", it->_value, it->_key.c_str());
- }
-}
-
-}
-#endif
-
-CoroBaseContext::CoroBaseContext(const char *func)
- : _line(0), _sleep(0), _subctx(0) {
-#if COROUTINE_DEBUG
- _funcName = func;
- changeCoroStats(_funcName, +1);
- s_coroCount++;
-#endif
-}
-
-CoroBaseContext::~CoroBaseContext() {
-#if COROUTINE_DEBUG
- s_coroCount--;
- changeCoroStats(_funcName, -1);
- debug("Deleting coro in %s at %p (subctx %p)",
- _funcName, (void *)this, (void *)_subctx);
- displayCoroStats();
-#endif
- delete _subctx;
-}
-
-} // End of namespace Tinsel
diff --git a/engines/tinsel/coroutine.h b/engines/tinsel/coroutine.h
deleted file mode 100644
index 5bcf1149d9..0000000000
--- a/engines/tinsel/coroutine.h
+++ /dev/null
@@ -1,282 +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 TINSEL_COROUTINE_H
-#define TINSEL_COROUTINE_H
-
-#include "common/scummsys.h"
-#include "common/util.h" // for SCUMMVM_CURRENT_FUNCTION
-
-namespace Tinsel {
-
-/**
- * @defgroup TinselCoroutines Coroutine support for Tinsel
- *
- * The following is loosely based on an article by Simon Tatham:
- * <http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html>.
- * However, many improvements and tweaks have been made, in particular
- * by taking advantage of C++ features not available in C.
- *
- * Why is this code here? Well, the Tinsel engine apparently used
- * setjmp/longjmp based coroutines as a core tool from the start, and
- * so they are deeply ingrained into the whole code base. When we
- * started to get Tinsel ready for ScummVM, we had to deal with that.
- * It soon got clear that we could not simply rewrite the code to work
- * without some form of coroutines. While possible in principle, it
- * would have meant a major restructuring of the entire code base, a
- * rather daunting task. Also, it would have very likely introduced
- * tons of regressons.
- *
- * So instead of getting rid of the coroutines, we chose to implement
- * them in an alternate way, using Simon Tatham's trick as described
- * above. While the trick is dirty, the result seems to be clear enough,
- * we hope; plus, it allowed us to stay relatively close to the
- * original structure of the code, which made it easier to avoid
- * regressions, and will be helpful in the future when comparing things
- * against the original code base.
- */
-//@{
-
-
-// Enable this macro to enable some debugging support in the coroutine code.
-//#define COROUTINE_DEBUG 1
-
-/**
- * The core of any coroutine context which captures the 'state' of a coroutine.
- * Private use only.
- */
-struct CoroBaseContext {
- int _line;
- int _sleep;
- CoroBaseContext *_subctx;
-#if COROUTINE_DEBUG
- const char *_funcName;
-#endif
- CoroBaseContext(const char *func);
- ~CoroBaseContext();
-};
-
-typedef CoroBaseContext *CoroContext;
-
-
-// FIXME: Document this!
-extern CoroContext nullContext;
-
-/**
- * Wrapper class which holds a pointer to a pointer to a CoroBaseContext.
- * The interesting part is the destructor, which kills the context being held,
- * but ONLY if the _sleep val of that context is zero. This way, a coroutine
- * can just 'return' w/o having to worry about freeing the allocated context
- * (in Simon Tatham's original code, one had to use a special macro to
- * return from a coroutine).
- */
-class CoroContextHolder {
- CoroContext &_ctx;
-public:
- CoroContextHolder(CoroContext &ctx) : _ctx(ctx) {
- assert(ctx);
- assert(ctx->_sleep >= 0);
- ctx->_sleep = 0;
- }
- ~CoroContextHolder() {
- if (_ctx && _ctx->_sleep == 0) {
- delete _ctx;
- _ctx = 0;
- }
- }
-};
-
-
-#define CORO_PARAM CoroContext &coroParam
-
-
-/**
- * Begin the declaration of a coroutine context.
- * This allows declaring variables which are 'persistent' during the
- * lifetime of the coroutine. An example use would be:
- *
- * CORO_BEGIN_CONTEXT;
- * int var;
- * char *foo;
- * CORO_END_CONTEXT(_ctx);
- *
- * It is not possible to initialize variables here, due to the way this
- * macro is implemented. Furthermore, to use the variables declared in
- * the coroutine context, you have to access them via the context variable
- * name that was specified as parameter to CORO_END_CONTEXT, e.g.
- * _ctx->var = 0;
- *
- * @see CORO_END_CONTEXT
- *
- * @note We declare a variable 'DUMMY' to allow the user to specify an 'empty'
- * context, and so compilers won't complain about ";" following the macro.
- */
-#define CORO_BEGIN_CONTEXT \
- struct CoroContextTag : CoroBaseContext { \
- CoroContextTag() : CoroBaseContext(SCUMMVM_CURRENT_FUNCTION) {} \
- int DUMMY
-
-/**
- * End the declaration of a coroutine context.
- * @param x name of the coroutine context
- * @see CORO_BEGIN_CONTEXT
- */
-#define CORO_END_CONTEXT(x) } *x = (CoroContextTag *)coroParam
-
-/**
- * Begin the code section of a coroutine.
- * @param x name of the coroutine context
- * @see CORO_BEGIN_CODE
- */
-#define CORO_BEGIN_CODE(x) \
- if (&coroParam == &nullContext) assert(!nullContext);\
- if (!x) {coroParam = x = new CoroContextTag();}\
- CoroContextHolder tmpHolder(coroParam);\
- switch (coroParam->_line) { case 0:;
-
-/**
- * End the code section of a coroutine.
- * @see CORO_END_CODE
- */
-#define CORO_END_CODE \
- if (&coroParam == &nullContext) { \
- delete nullContext; \
- nullContext = NULL; \
- } \
- }
-
-/**
- * Sleep for the specified number of scheduler cycles.
- */
-#define CORO_SLEEP(delay) do {\
- coroParam->_line = __LINE__;\
- coroParam->_sleep = delay;\
- assert(&coroParam != &nullContext);\
- return; case __LINE__:;\
- } while (0)
-
-#define CORO_GIVE_WAY do { g_scheduler->giveWay(); CORO_SLEEP(1); } while (0)
-#define CORO_RESCHEDULE do { g_scheduler->reschedule(); CORO_SLEEP(1); } while (0)
-
-/**
- * Stop the currently running coroutine and all calling coroutines.
- *
- * This sets _sleep to -1 rather than 0 so that the context doesn't get
- * deleted by CoroContextHolder, since we want CORO_INVOKE_ARGS to
- * propogate the _sleep value and return immediately (the scheduler will
- * then delete the entire coroutine's state, including all subcontexts).
- */
-#define CORO_KILL_SELF() \
- do { if (&coroParam != &nullContext) { coroParam->_sleep = -1; } return; } while (0)
-
-
-/**
- * This macro is to be used in conjunction with CORO_INVOKE_ARGS and
- * similar macros for calling coroutines-enabled subroutines.
- */
-#define CORO_SUBCTX coroParam->_subctx
-
-/**
- * Invoke another coroutine.
- *
- * If the subcontext still exists after the coroutine is invoked, it has
- * either yielded/slept or killed itself, and so we copy the _sleep value
- * to our own context and return (execution will continue at the case
- * statement below, where we loop and call the coroutine again).
- * If the subcontext is null, the coroutine ended normally, and we can
- * simply break out of the loop and continue execution.
- *
- * @param subCoro name of the coroutine-enabled function to invoke
- * @param ARGS list of arguments to pass to subCoro
- *
- * @note ARGS must be surrounded by parentheses, and the first argument
- * in this list must always be CORO_SUBCTX. For example, the
- * regular function call
- * myFunc(a, b);
- * becomes the following:
- * CORO_INVOKE_ARGS(myFunc, (CORO_SUBCTX, a, b));
- */
-#define CORO_INVOKE_ARGS(subCoro, ARGS) \
- do {\
- coroParam->_line = __LINE__;\
- coroParam->_subctx = 0;\
- do {\
- subCoro ARGS;\
- if (!coroParam->_subctx) break;\
- coroParam->_sleep = coroParam->_subctx->_sleep;\
- assert(&coroParam != &nullContext);\
- return; case __LINE__:;\
- } while (1);\
- } while (0)
-
-/**
- * Invoke another coroutine. Similar to CORO_INVOKE_ARGS,
- * but allows specifying a return value which is returned
- * if invoked coroutine yields (thus causing the current
- * coroutine to yield, too).
- */
-#define CORO_INVOKE_ARGS_V(subCoro, RESULT, ARGS) \
- do {\
- coroParam->_line = __LINE__;\
- coroParam->_subctx = 0;\
- do {\
- subCoro ARGS;\
- if (!coroParam->_subctx) break;\
- coroParam->_sleep = coroParam->_subctx->_sleep;\
- assert(&coroParam != &nullContext);\
- return RESULT; case __LINE__:;\
- } while (1);\
- } while (0)
-
-/**
- * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
- * with no parameters.
- */
-#define CORO_INVOKE_0(subCoroutine) \
- CORO_INVOKE_ARGS(subCoroutine,(CORO_SUBCTX))
-
-/**
- * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
- * with one parameter.
- */
-#define CORO_INVOKE_1(subCoroutine, a0) \
- CORO_INVOKE_ARGS(subCoroutine,(CORO_SUBCTX,a0))
-
-/**
- * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
- * with two parameters.
- */
-#define CORO_INVOKE_2(subCoroutine, a0,a1) \
- CORO_INVOKE_ARGS(subCoroutine,(CORO_SUBCTX,a0,a1))
-
-/**
- * Convenience wrapper for CORO_INVOKE_ARGS for invoking a coroutine
- * with three parameters.
- */
-#define CORO_INVOKE_3(subCoroutine, a0,a1,a2) \
- CORO_INVOKE_ARGS(subCoroutine,(CORO_SUBCTX,a0,a1,a2))
-
-//@}
-
-} // End of namespace Tinsel
-
-#endif // TINSEL_COROUTINE_H
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 0f662e22bd..2e4be33e53 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -63,6 +63,14 @@ uint16 TinselEngine::getVersion() const {
return _gameDescription->version;
}
+bool TinselEngine::getIsADGFDemo() const {
+ return (bool)(_gameDescription->desc.flags & ADGF_DEMO);
+}
+
+bool TinselEngine::isCD() const {
+ return (bool)(_gameDescription->desc.flags & ADGF_CD);
+}
+
} // End of namespace Tinsel
static const PlainGameDescriptor tinselGames[] = {
diff --git a/engines/tinsel/detection_tables.h b/engines/tinsel/detection_tables.h
index be44b1c462..631c2dce14 100644
--- a/engines/tinsel/detection_tables.h
+++ b/engines/tinsel/detection_tables.h
@@ -47,7 +47,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_DEMO,
+ 0,
TINSEL_V0,
},
@@ -61,12 +61,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_DEMO,
+ ADGF_DEMO | ADGF_CD,
GUIO0()
},
GID_DW1,
0,
- GF_CD,
+ 0,
TINSEL_V1,
},
#if 0
@@ -81,12 +81,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformMacintosh,
- ADGF_DEMO,
+ ADGF_DEMO | ADGF_CD,
GUIO0()
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_BIG_ENDIAN,
+ GF_SCNFILES,
TINSEL_V1,
},
#endif
@@ -110,7 +110,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -133,7 +133,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -156,7 +156,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -179,7 +179,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -195,7 +195,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_FLOPPY | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -214,7 +214,42 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_ENHANCED_AUDIO_SUPPORT,
+ TINSEL_V1,
+ },
+
+ { // Polish fan translation CD V1 version, with *.gra files (same as the floppy one, with english.smp)
+ {
+ "dw",
+ "CD",
+ {
+ {"dw.gra", 0, "ef05bbd2a754bd11a2e87bcd84ab5ccf", 781864},
+ {"english.smp", 0, NULL, -1},
+ },
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_CD,
+ GUIO_NONE
+ },
+ GID_DW1,
+ 0,
+ GF_ENHANCED_AUDIO_SUPPORT,
+ TINSEL_V1,
+ },
+
+ { // Polish fan translaction floppy V1 version, with *.gra files
+ {
+ "dw",
+ "Floppy",
+ AD_ENTRY1s("dw.gra", "ef05bbd2a754bd11a2e87bcd84ab5ccf", 781864),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO_NOSPEECH
+ },
+ GID_DW1,
+ 0,
+ GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -236,7 +271,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -261,7 +296,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -280,12 +315,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_DROPLANGUAGE | ADGF_CD,
+ ADGF_DROPLANGUAGE,
GUIO0()
},
GID_DW1,
0,
- GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
{
@@ -308,7 +343,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
{
@@ -331,7 +366,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -351,7 +386,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -371,7 +406,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -390,14 +425,14 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
{ // multilanguage PSX demo
{
"dw",
- "CD demo",
+ "CD Demo",
{
{"french.txt", 0, "e7020d35f58d0d187052ac406d86cc87", 273914},
{"german.txt", 0, "52f0a01e0ff0d340b02a36fd5109d705", 263942},
@@ -408,12 +443,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformPSX,
- ADGF_DEMO,
+ ADGF_CD | ADGF_DEMO,
GUIO0()
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V1,
},
@@ -434,7 +469,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
#endif
@@ -456,7 +491,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT | GF_BIG_ENDIAN,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
@@ -475,7 +510,7 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT | GF_ALT_MIDI,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT | GF_ALT_MIDI,
TINSEL_V1,
},
@@ -496,11 +531,32 @@ static const TinselGameDescription gameDescriptions[] = {
},
GID_DW1,
0,
- GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
+ TINSEL_V1,
+ },
+
+ { // Polish fan translaction Discworld 1
+ {
+ "dw",
+ "CD",
+ {
+ {"dw.scn", 0, "fa169d2c98660215ebd84b49c1899eef", 776396},
+ {"english.txt", 0, "c1a53eb7ec812689dab70e2bb22cf2ab", 224151},
+ {"english.smp", 0, NULL, -1},
+ {NULL, 0, NULL, 0}
+ },
+ Common::PL_POL,
+ Common::kPlatformPC,
+ ADGF_CD,
+ GUIO_NONE
+ },
+ GID_DW1,
+ 0,
+ GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT,
TINSEL_V1,
},
- { // English DW2 demo
+ { // English Discworld 2 demo
{
"dw2",
"Demo",
@@ -511,12 +567,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_DEMO,
+ ADGF_DEMO | ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES | GF_DEMO,
+ GF_SCNFILES,
TINSEL_V2,
},
@@ -531,12 +587,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::EN_GRB,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
@@ -551,12 +607,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::EN_USA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
@@ -571,12 +627,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::FR_FRA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
@@ -591,12 +647,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
@@ -612,12 +668,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::IT_ITA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
{
@@ -632,12 +688,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
@@ -653,12 +709,12 @@ static const TinselGameDescription gameDescriptions[] = {
},
Common::RU_RUS,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
+ ADGF_CD,
GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
- GF_CD | GF_SCNFILES,
+ GF_SCNFILES,
TINSEL_V2,
},
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 5396e47566..56ee2ea752 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -753,6 +753,11 @@ static CONFBOX t1RestartBox[] = {
#endif
};
+static CONFBOX t1RestartBoxPSX[] = {
+ { AAGBUT, INITGAME, TM_NONE, NULL, USE_POINTER, 122, 48, 23, 19, NULL, IX1_TICK1 },
+ { AAGBUT, CLOSEWIN, TM_NONE, NULL, USE_POINTER, 82, 48, 23, 19, NULL, IX1_CROSS1 }
+};
+
static CONFBOX t2RestartBox[] = {
{ AAGBUT, INITGAME, TM_NONE, NULL, 0, 140, 78, BW, BH, NULL, IX2_TICK1 },
{ AAGBUT, CLOSEWIN, TM_NONE, NULL, 0, 60, 78, BW, BH, NULL, IX2_CROSS1 }
@@ -763,10 +768,10 @@ static CONFINIT t1ciRestart = { 6, 2, 72, 53, false, t1RestartBox, ARRAYSIZE(t1R
#else
static CONFINIT t1ciRestart = { 4, 2, 98, 53, false, t1RestartBox, ARRAYSIZE(t1RestartBox), SIX_RESTART_HEADING };
#endif
+static CONFINIT t1ciRestartPSX = { 8, 2, 46, 53, false, t1RestartBoxPSX, ARRAYSIZE(t1RestartBoxPSX), SIX_RESTART_HEADING };
static CONFINIT t2ciRestart = { 4, 2, 196, 53, false, t2RestartBox, sizeof(t2RestartBox)/sizeof(CONFBOX), SS_RESTART_HEADING };
-#define ciRestart (TinselV2 ? t2ciRestart : t1ciRestart)
-#define restartBox (TinselV2 ? t2RestartBox : t1RestartBox)
+#define ciRestart (TinselV2 ? t2ciRestart : (TinselV1PSX ? t1ciRestartPSX : t1ciRestart))
/*-------------------------------------------------------------*\
| This is the sound control 'menu'. In Discworld 2, it also |
@@ -1038,18 +1043,20 @@ static bool RePosition();
static bool LanguageChange() {
LANGUAGE nLang = _vm->_config->_language;
- if (_vm->getFeatures() & GF_USE_3FLAGS) {
- // VERY quick dodgy bodge
- if (cd.selBox == 0)
- nLang = TXT_FRENCH; // = 1
- else if (cd.selBox == 1)
- nLang = TXT_GERMAN; // = 2
- else
- nLang = TXT_SPANISH; // = 4
- } else if (_vm->getFeatures() & GF_USE_4FLAGS) {
- nLang = (LANGUAGE)(cd.selBox + 1);
- } else if (_vm->getFeatures() & GF_USE_5FLAGS) {
- nLang = (LANGUAGE)cd.selBox;
+ if ((_vm->getFeatures() & GF_USE_3FLAGS) || (_vm->getFeatures() & GF_USE_4FLAGS) || (_vm->getFeatures() & GF_USE_5FLAGS)) {
+ // Languages: TXT_ENGLISH, TXT_FRENCH, TXT_GERMAN, TXT_ITALIAN, TXT_SPANISH
+ // 5 flag versions include English
+ int selected = (_vm->getFeatures() & GF_USE_5FLAGS) ? cd.selBox : cd.selBox + 1;
+ // Make sure that a language flag has been selected. If the user has
+ // changed the language speed slider and hasn't clicked on a flag, it
+ // won't be selected.
+ if (selected >= 0 && selected <= 4) {
+ nLang = (LANGUAGE)selected;
+
+ // 3 flag versions don't include Italian
+ if (selected >= 3 && (_vm->getFeatures() & GF_USE_3FLAGS))
+ nLang = TXT_SPANISH;
+ }
}
if (nLang != _vm->_config->_language) {
@@ -1075,7 +1082,7 @@ static void PrimeSceneHopper() {
uint32 vSize;
// Open the file (it's on the CD)
- CdCD(nullContext);
+ CdCD(Common::nullContext);
if (!f.open(HOPPER_FILENAME))
error(CANNOT_FIND_FILE, HOPPER_FILENAME);
@@ -1191,13 +1198,13 @@ static void HopAction() {
debugC(DEBUG_BASIC, kTinselDebugAnimations, "Scene hopper chose scene %xh,%d\n", hScene, eNumber);
if (FROM_LE_32(pEntry->flags) & fCall) {
- SaveScene(nullContext);
- NewScene(nullContext, g_pChosenScene->hScene, pEntry->eNumber, TRANS_FADE);
+ SaveScene(Common::nullContext);
+ NewScene(Common::nullContext, g_pChosenScene->hScene, pEntry->eNumber, TRANS_FADE);
}
else if (FROM_LE_32(pEntry->flags) & fHook)
HookScene(hScene, eNumber, TRANS_FADE);
else
- NewScene(nullContext, hScene, eNumber, TRANS_CUT);
+ NewScene(Common::nullContext, hScene, eNumber, TRANS_CUT);
}
/**************************************************************************/
@@ -1256,6 +1263,20 @@ static INV_OBJECT *GetInvObject(int id) {
}
/**
+ * Returns true if the given id represents a valid inventory object
+ */
+bool GetIsInvObject(int id) {
+ INV_OBJECT *pObject = g_invObjects;
+
+ for (int i = 0; i < g_numObjects; i++, pObject++) {
+ if (pObject->id == id)
+ return true;
+ }
+
+ return false;
+}
+
+/**
* Convert item ID number to index.
*/
static int GetObjectIndex(int id) {
@@ -1406,13 +1427,13 @@ static void InvTinselEvent(INV_OBJECT *pinvo, TINSEL_EVENT event, PLR_EVENT be,
return;
g_GlitterIndex = index;
- g_scheduler->createProcess(PID_TCODE, ObjectProcess, &to, sizeof(to));
+ CoroScheduler.createProcess(PID_TCODE, ObjectProcess, &to, sizeof(to));
}
extern void ObjectEvent(CORO_PARAM, int objId, TINSEL_EVENT event, bool bWait, int myEscape, bool *result) {
// COROUTINE
CORO_BEGIN_CONTEXT;
- PROCESS *pProc;
+ Common::PROCESS *pProc;
INV_OBJECT *pInvo;
OP_INIT op;
CORO_END_CONTEXT(_ctx);
@@ -1428,7 +1449,7 @@ extern void ObjectEvent(CORO_PARAM, int objId, TINSEL_EVENT event, bool bWait, i
_ctx->op.event = event;
_ctx->op.myEscape = myEscape;
- g_scheduler->createProcess(PID_TCODE, ObjectProcess, &_ctx->op, sizeof(_ctx->op));
+ CoroScheduler.createProcess(PID_TCODE, ObjectProcess, &_ctx->op, sizeof(_ctx->op));
if (bWait)
CORO_INVOKE_2(WaitInterpret, _ctx->pProc, result);
@@ -3540,9 +3561,9 @@ extern void ConvAction(int index) {
}
if (g_thisConvPoly != NOPOLY)
- PolygonEvent(nullContext, g_thisConvPoly, CONVERSE, 0, false, 0);
+ PolygonEvent(Common::nullContext, g_thisConvPoly, CONVERSE, 0, false, 0);
else
- ActorEvent(nullContext, g_thisConvActor, CONVERSE, false, 0);
+ ActorEvent(Common::nullContext, g_thisConvActor, CONVERSE, false, 0);
}
}
@@ -5128,7 +5149,7 @@ static void InvPickup(int index) {
if (TinselV2)
InvPutDown(index);
else
- g_scheduler->createProcess(PID_TCODE, InvPdProcess, &index, sizeof(index));
+ CoroScheduler.createProcess(PID_TCODE, InvPdProcess, &index, sizeof(index));
}
}
}
diff --git a/engines/tinsel/dialogs.h b/engines/tinsel/dialogs.h
index 8c48eb8b76..ab53ba771c 100644
--- a/engines/tinsel/dialogs.h
+++ b/engines/tinsel/dialogs.h
@@ -152,6 +152,8 @@ void InvSetLimit(int invno, int n);
void InvSetSize(int invno, int MinWidth, int MinHeight,
int StartWidth, int StartHeight, int MaxWidth, int MaxHeight);
+bool GetIsInvObject(int id);
+
int WhichInventoryOpen();
bool IsTopWindow();
diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp
index d815fd165d..3ecef83753 100644
--- a/engines/tinsel/drives.cpp
+++ b/engines/tinsel/drives.cpp
@@ -48,13 +48,13 @@ void CdCD(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx);
while (g_bChangingCD) {
- if (g_scheduler->getCurrentProcess()) {
- // FIXME: CdCD gets passed a nullContext in RegisterGlobals() and
+ if (CoroScheduler.getCurrentProcess()) {
+ // FIXME: CdCD gets passed a Common::nullContext in RegisterGlobals() and
// PrimeSceneHopper(), because I didn't know how to get a proper
// context without converting the whole calling stack to CORO'd
// functions. If these functions really get called while a CD
// change is requested, this needs to be resolved.
- if (coroParam == nullContext)
+ if (coroParam == Common::nullContext)
error("CdCD needs context");
CORO_SLEEP(1);
} else
@@ -149,7 +149,7 @@ bool GotoCD() {
bool TinselFile::_warningShown = false;
-TinselFile::TinselFile() : ReadStreamEndian((_vm->getFeatures() & GF_BIG_ENDIAN) != 0) {
+TinselFile::TinselFile() : ReadStreamEndian(TinselV1Mac) {
_stream = NULL;
}
diff --git a/engines/tinsel/drives.h b/engines/tinsel/drives.h
index 907071d2f8..9e97b92fa5 100644
--- a/engines/tinsel/drives.h
+++ b/engines/tinsel/drives.h
@@ -24,9 +24,9 @@
#ifndef TINSEL_DRIVES_H
#define TINSEL_DRIVES_H
+#include "common/coroutines.h"
#include "common/stream.h"
#include "tinsel/dw.h"
-#include "tinsel/coroutine.h"
namespace Tinsel {
diff --git a/engines/tinsel/effect.cpp b/engines/tinsel/effect.cpp
index 22027b0f02..f5adb63c2b 100644
--- a/engines/tinsel/effect.cpp
+++ b/engines/tinsel/effect.cpp
@@ -108,7 +108,7 @@ static void FettleEffectPolys(int x, int y, int index, PMOVER pActor) {
epi.hEpoly = hPoly;
epi.pMover = pActor;
epi.index = index;
- g_scheduler->createProcess(PID_TCODE, EffectProcess, &epi, sizeof(epi));
+ CoroScheduler.createProcess(PID_TCODE, EffectProcess, &epi, sizeof(epi));
}
}
}
diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp
index 74454c5f2a..1aa4d34227 100644
--- a/engines/tinsel/events.cpp
+++ b/engines/tinsel/events.cpp
@@ -22,10 +22,10 @@
* Also provides a couple of utility functions.
*/
+#include "common/coroutines.h"
#include "tinsel/actors.h"
#include "tinsel/background.h"
#include "tinsel/config.h"
-#include "tinsel/coroutine.h"
#include "tinsel/cursor.h"
#include "tinsel/dw.h"
#include "tinsel/events.h"
@@ -276,7 +276,7 @@ static void WalkProcess(CORO_PARAM, const void *param) {
void WalkTo(int x, int y) {
WP_INIT to = { x, y };
- g_scheduler->createProcess(PID_TCODE, WalkProcess, &to, sizeof(to));
+ CoroScheduler.createProcess(PID_TCODE, WalkProcess, &to, sizeof(to));
}
/**
@@ -295,7 +295,7 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P
if ((actor = GetTaggedActor()) != 0) {
// Event for a tagged actor
if (TinselV2)
- ActorEvent(nullContext, actor, uEvent, false, 0);
+ ActorEvent(Common::nullContext, actor, uEvent, false, 0);
else
ActorEvent(actor, uEvent, be);
} else if ((hPoly = GetTaggedPoly()) != NOPOLY) {
@@ -303,7 +303,7 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P
if (!TinselV2)
RunPolyTinselCode(hPoly, uEvent, be, false);
else if (uEvent != PROV_WALKTO)
- PolygonEvent(nullContext, hPoly, uEvent, 0, false, 0);
+ PolygonEvent(Common::nullContext, hPoly, uEvent, 0, false, 0);
} else {
GetCursorXY(&aniX, &aniY, true);
@@ -312,7 +312,7 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P
if ((hPoly = InPolygon(aniX, aniY, TAG)) != NOPOLY ||
(!TinselV2 && ((hPoly = InPolygon(aniX, aniY, EXIT)) != NOPOLY))) {
if (TinselV2 && (uEvent != PROV_WALKTO))
- PolygonEvent(nullContext, hPoly, uEvent, 0, false, 0);
+ PolygonEvent(Common::nullContext, hPoly, uEvent, 0, false, 0);
else if (!TinselV2)
RunPolyTinselCode(hPoly, uEvent, be, false);
} else if ((uEvent == PROV_WALKTO) || (uEvent == WALKTO)) {
@@ -604,7 +604,7 @@ void PolyTinselProcess(CORO_PARAM, const void *param) {
void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait,
int myEscape, bool *result) {
CORO_BEGIN_CONTEXT;
- PPROCESS pProc;
+ Common::PPROCESS pProc;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -623,7 +623,7 @@ void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bo
NULL, // No Object
myEscape);
if (to.pic != NULL) {
- _ctx->pProc = g_scheduler->createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
+ _ctx->pProc = CoroScheduler.createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
AttachInterpret(to.pic, _ctx->pProc);
if (bWait)
@@ -640,14 +640,14 @@ void RunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, PLR_EVENT be, bool tc
PTP_INIT to = { hPoly, event, be, tc, 0, NULL };
assert(!TinselV2);
- g_scheduler->createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
+ CoroScheduler.createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
}
void effRunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, int actor) {
PTP_INIT to = { hPoly, event, PLR_NOEVENT, false, actor, NULL };
assert(!TinselV2);
- g_scheduler->createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
+ CoroScheduler.createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
}
/**
diff --git a/engines/tinsel/events.h b/engines/tinsel/events.h
index f2b4d7f663..cdf5ae2ae4 100644
--- a/engines/tinsel/events.h
+++ b/engines/tinsel/events.h
@@ -24,9 +24,9 @@
#ifndef TINSEL_EVENTS_H
#define TINSEL_EVENTS_H
-#include "tinsel/dw.h"
-#include "tinsel/coroutine.h"
+#include "common/coroutines.h"
#include "common/rect.h"
+#include "tinsel/dw.h"
namespace Tinsel {
diff --git a/engines/tinsel/faders.cpp b/engines/tinsel/faders.cpp
index 86d117af81..c1574ff963 100644
--- a/engines/tinsel/faders.cpp
+++ b/engines/tinsel/faders.cpp
@@ -145,7 +145,7 @@ static void Fader(const long multTable[], SCNHANDLE noFadeTable[]) {
if (TinselV2) {
// The is only ever one cuncurrent fade
// But this could be a fade out and the fade in is still going!
- g_scheduler->killMatchingProcess(PID_FADER);
+ CoroScheduler.killMatchingProcess(PID_FADER);
NoFadingPalettes();
}
@@ -176,7 +176,7 @@ static void Fader(const long multTable[], SCNHANDLE noFadeTable[]) {
fade.pPalQ = pPal;
// create a fader process for this palette
- g_scheduler->createProcess(PID_FADER, FadeProcess, (void *)&fade, sizeof(FADE));
+ CoroScheduler.createProcess(PID_FADER, FadeProcess, (void *)&fade, sizeof(FADE));
}
}
}
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index e31b2141f5..14d588dcec 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -99,14 +99,16 @@ void SetupHandleTable() {
MEMHANDLE *pH;
TinselFile f;
- if (f.open(TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME)) {
+ const char *indexFileName = TinselV1PSX ? PSX_INDEX_FILENAME : INDEX_FILENAME;
+
+ if (f.open(indexFileName)) {
// get size of index file
len = f.size();
if (len > 0) {
if ((len % RECORD_SIZE) != 0) {
// index file is corrupt
- error(FILE_IS_CORRUPT, TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME);
+ error(FILE_IS_CORRUPT, indexFileName);
}
// calc number of handles
@@ -132,16 +134,16 @@ void SetupHandleTable() {
if (f.eos() || f.err()) {
// index file is corrupt
- error(FILE_IS_CORRUPT, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME));
+ error(FILE_IS_CORRUPT, indexFileName);
}
// close the file
f.close();
} else { // index file is corrupt
- error(FILE_IS_CORRUPT, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME));
+ error(FILE_IS_CORRUPT, indexFileName);
}
} else { // cannot find the index file
- error(CANNOT_FIND_FILE, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME));
+ error(CANNOT_FIND_FILE, indexFileName);
}
// allocate memory nodes and load all permanent graphics
@@ -361,7 +363,7 @@ byte *LockMem(SCNHANDLE offset) {
if (TinselV2) {
SetCD(pH->flags2 & fAllCds);
- CdCD(nullContext);
+ CdCD(Common::nullContext);
}
LoadFile(pH);
}
diff --git a/engines/tinsel/module.mk b/engines/tinsel/module.mk
index 2ab94b830a..3485bac74b 100644
--- a/engines/tinsel/module.mk
+++ b/engines/tinsel/module.mk
@@ -9,7 +9,6 @@ MODULE_OBJS := \
bmv.o \
cliprect.o \
config.o \
- coroutine.o \
cursor.o \
debugger.o \
detection.o \
diff --git a/engines/tinsel/move.cpp b/engines/tinsel/move.cpp
index bb49e59fe7..275b6006f5 100644
--- a/engines/tinsel/move.cpp
+++ b/engines/tinsel/move.cpp
@@ -1299,14 +1299,14 @@ static void SetOffWithinNodePath(PMOVER pMover, HPOLYGON StartPath, HPOLYGON Des
*/
void SSetActorDest(PMOVER pActor) {
if (pActor->UtargetX != -1 && pActor->UtargetY != -1) {
- Stand(nullContext, pActor->actorID, pActor->objX, pActor->objY, 0);
+ Stand(Common::nullContext, pActor->actorID, pActor->objX, pActor->objY, 0);
if (pActor->UtargetX != -1 && pActor->UtargetY != -1) {
SetActorDest(pActor, pActor->UtargetX, pActor->UtargetY,
pActor->bIgPath, 0);
}
} else {
- Stand(nullContext, pActor->actorID, pActor->objX, pActor->objY, 0);
+ Stand(Common::nullContext, pActor->actorID, pActor->objX, pActor->objY, 0);
}
}
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index 781a378f13..b3bfbcc5dc 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -131,21 +131,13 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
g_currentMidi = dwFileOffset;
g_currentLoop = bLoop;
- // Tinsel V1 PSX uses a different music format, so i
- // disable it here.
- // TODO: Maybe this should be moved to a better place...
- if (TinselV1PSX) return false;
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
- if (_vm->_config->_musicVolume != 0) {
- bool mute = false;
- if (ConfMan.hasKey("mute"))
- mute = ConfMan.getBool("mute");
-
- SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume);
- }
+ SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume);
// the index and length of the last tune loaded
- static uint32 dwLastMidiIndex = 0; // FIXME: Avoid non-const global vars
uint32 dwSeqLen = 0; // length of the sequence
// Support for external music from the music enhancement project
@@ -186,61 +178,53 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
if (dwFileOffset == 0)
return true;
- if (dwFileOffset != dwLastMidiIndex) {
- Common::File midiStream;
-
- // open MIDI sequence file in binary mode
- if (!midiStream.open(MIDI_FILE))
- error(CANNOT_FIND_FILE, MIDI_FILE);
-
- // update index of last tune loaded
- dwLastMidiIndex = dwFileOffset;
-
- // move to correct position in the file
- midiStream.seek(dwFileOffset, SEEK_SET);
-
- // read the length of the sequence
- dwSeqLen = midiStream.readUint32LE();
-
- // make sure buffer is large enough for this sequence
- assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size);
-
- // stop any currently playing tune
- _vm->_midiMusic->stop();
-
- // read the sequence
- if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen)
- error(FILE_IS_CORRUPT, MIDI_FILE);
-
- midiStream.close();
-
- // WORKAROUND for bug #2820054 "DW1: No intro music at first start on Wii",
- // which actually affects all ports, since it's specific to the GRA version.
- //
- // The GRA version does not seem to set the channel volume at all for the first
- // intro track, thus we need to do that here. We only initialize the channels
- // used in that sequence. And we are using 127 as default channel volume.
- //
- // Only in the GRA version dwFileOffset can be "38888", just to be sure, we
- // check for the SCN files feature flag not being set though.
- if (_vm->getGameID() == GID_DW1 && dwFileOffset == 38888 && !(_vm->getFeatures() & GF_SCNFILES)) {
- _vm->_midiMusic->send(0x7F07B0 | 3);
- _vm->_midiMusic->send(0x7F07B0 | 5);
- _vm->_midiMusic->send(0x7F07B0 | 8);
- _vm->_midiMusic->send(0x7F07B0 | 10);
- _vm->_midiMusic->send(0x7F07B0 | 13);
- }
+ Common::File midiStream;
- _vm->_midiMusic->playXMIDI(g_midiBuffer.pDat, dwSeqLen, bLoop);
+ // open MIDI sequence file in binary mode
+ if (!midiStream.open(MIDI_FILE))
+ error(CANNOT_FIND_FILE, MIDI_FILE);
- // Store the length
- //dwLastSeqLen = dwSeqLen;
- } else {
- // dwFileOffset == dwLastMidiIndex
- _vm->_midiMusic->stop();
- _vm->_midiMusic->playXMIDI(g_midiBuffer.pDat, dwSeqLen, bLoop);
+ // move to correct position in the file
+ midiStream.seek(dwFileOffset, SEEK_SET);
+
+ // read the length of the sequence
+ dwSeqLen = midiStream.readUint32LE();
+
+ // make sure buffer is large enough for this sequence
+ assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size);
+
+ // stop any currently playing tune
+ _vm->_midiMusic->stop();
+
+ // read the sequence. This needs to be read again before playSEQ() is
+ // called even if the music is restarting, as playSEQ() reads the file
+ // name off the buffer itself. However, that function adds SMF headers
+ // to the buffer, thus if it's read again, the SMF headers will be read
+ // and the filename will always be 'MThd'.
+ if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen)
+ error(FILE_IS_CORRUPT, MIDI_FILE);
+
+ midiStream.close();
+
+ // WORKAROUND for bug #2820054 "DW1: No intro music at first start on Wii",
+ // which actually affects all ports, since it's specific to the GRA version.
+ //
+ // The GRA version does not seem to set the channel volume at all for the first
+ // intro track, thus we need to do that here. We only initialize the channels
+ // used in that sequence. And we are using 127 as default channel volume.
+ //
+ // Only in the GRA version dwFileOffset can be "38888", just to be sure, we
+ // check for the SCN files feature flag not being set though.
+ if (_vm->getGameID() == GID_DW1 && dwFileOffset == 38888 && !(_vm->getFeatures() & GF_SCNFILES)) {
+ _vm->_midiMusic->send(0x7F07B0 | 3);
+ _vm->_midiMusic->send(0x7F07B0 | 5);
+ _vm->_midiMusic->send(0x7F07B0 | 8);
+ _vm->_midiMusic->send(0x7F07B0 | 10);
+ _vm->_midiMusic->send(0x7F07B0 | 13);
}
+ _vm->_midiMusic->playMIDI(dwSeqLen, bLoop);
+
return true;
}
@@ -284,27 +268,7 @@ int GetMidiVolume() {
*/
void SetMidiVolume(int vol) {
assert(vol >= 0 && vol <= Audio::Mixer::kMaxChannelVolume);
-
- static int priorVolMusic = 0; // FIXME: Avoid non-const global vars
-
- if (vol == 0 && priorVolMusic == 0) {
- // Nothing to do
- } else if (vol == 0 && priorVolMusic != 0) {
- // Stop current midi sequence
- StopMidi();
- _vm->_midiMusic->setVolume(vol);
- } else if (vol != 0 && priorVolMusic == 0) {
- // Perhaps restart last midi sequence
- if (g_currentLoop)
- PlayMidiSequence(g_currentMidi, true);
-
- _vm->_midiMusic->setVolume(vol);
- } else if (vol != 0 && priorVolMusic != 0) {
- // Alter current volume
- _vm->_midiMusic->setVolume(vol);
- }
-
- priorVolMusic = vol;
+ _vm->_midiMusic->setVolume(vol);
}
/**
@@ -314,8 +278,7 @@ void OpenMidiFiles() {
Common::File midiStream;
// Demo version has no midi file
- // Also, Discworld PSX uses still unsupported psx SEQ format for music...
- if ((_vm->getFeatures() & GF_DEMO) || (TinselVersion == TINSEL_V2) || TinselV1PSX)
+ if (TinselV0 || TinselV2)
return;
if (g_midiBuffer.pDat)
@@ -412,7 +375,7 @@ void MidiMusicPlayer::send(uint32 b) {
}
}
-void MidiMusicPlayer::playXMIDI(byte *midiData, uint32 size, bool loop) {
+void MidiMusicPlayer::playMIDI(uint32 size, bool loop) {
Common::StackLock lock(_mutex);
if (_isPlaying)
@@ -420,6 +383,13 @@ void MidiMusicPlayer::playXMIDI(byte *midiData, uint32 size, bool loop) {
stop();
+ if (TinselV1PSX)
+ playSEQ(size, loop);
+ else
+ playXMIDI(size, loop);
+}
+
+void MidiMusicPlayer::playXMIDI(uint32 size, bool loop) {
// It seems like not all music (the main menu music, for instance) set
// all the instruments explicitly. That means the music will sound
// different, depending on which music played before it. This appears
@@ -433,7 +403,78 @@ void MidiMusicPlayer::playXMIDI(byte *midiData, uint32 size, bool loop) {
// Load XMID resource data
MidiParser *parser = MidiParser::createParser_XMIDI();
- if (parser->loadMusic(midiData, size)) {
+ if (parser->loadMusic(g_midiBuffer.pDat, size)) {
+ parser->setTrack(0);
+ parser->setMidiDriver(this);
+ parser->setTimerRate(getBaseTempo());
+ parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
+ parser->property(MidiParser::mpSendSustainOffOnNotesOff, 1);
+
+ _parser = parser;
+
+ _isLooping = loop;
+ _isPlaying = true;
+ } else {
+ delete parser;
+ }
+}
+
+void MidiMusicPlayer::playSEQ(uint32 size, bool loop) {
+ // MIDI.DAT holds the file names in DW1 PSX
+ Common::String baseName((char *)g_midiBuffer.pDat, size);
+ Common::String seqName = baseName + ".SEQ";
+
+ // TODO: Load the instrument bank (<baseName>.VB and <baseName>.VH)
+
+ Common::File seqFile;
+ if (!seqFile.open(seqName))
+ error("Failed to open SEQ file '%s'", seqName.c_str());
+
+ if (seqFile.readUint32LE() != MKTAG('S', 'E', 'Q', 'p'))
+ error("Failed to find SEQp tag");
+
+ // Make sure we don't have a SEP file (with multiple SEQ's inside)
+ if (seqFile.readUint32BE() != 1)
+ error("Can only play SEQ files, not SEP");
+
+ uint16 ppqn = seqFile.readUint16BE();
+ uint32 tempo = seqFile.readUint16BE() << 8;
+ tempo |= seqFile.readByte();
+ /* uint16 beat = */ seqFile.readUint16BE();
+
+ // SEQ is directly based on SMF and we'll use that to our advantage here
+ // and convert to SMF and then use the SMF MidiParser.
+
+ // Calculate the SMF size we'll need
+ uint32 dataSize = seqFile.size() - 15;
+ uint32 actualSize = dataSize + 7 + 22;
+
+ // Resize the buffer if necessary
+ if (g_midiBuffer.size < actualSize) {
+ g_midiBuffer.pDat = (byte *)realloc(g_midiBuffer.pDat, actualSize);
+ assert(g_midiBuffer.pDat);
+ }
+
+ // Now construct the header
+ WRITE_BE_UINT32(g_midiBuffer.pDat, MKTAG('M', 'T', 'h', 'd'));
+ WRITE_BE_UINT32(g_midiBuffer.pDat + 4, 6); // header size
+ WRITE_BE_UINT16(g_midiBuffer.pDat + 8, 0); // type 0
+ WRITE_BE_UINT16(g_midiBuffer.pDat + 10, 1); // one track
+ WRITE_BE_UINT16(g_midiBuffer.pDat + 12, ppqn);
+ WRITE_BE_UINT32(g_midiBuffer.pDat + 14, MKTAG('M', 'T', 'r', 'k'));
+ WRITE_BE_UINT32(g_midiBuffer.pDat + 18, dataSize + 7); // SEQ data size + tempo change event size
+
+ // Add in a fake tempo change event
+ WRITE_BE_UINT32(g_midiBuffer.pDat + 22, 0x00FF5103); // no delta, meta event, tempo change, param size = 3
+ WRITE_BE_UINT16(g_midiBuffer.pDat + 26, tempo >> 8);
+ g_midiBuffer.pDat[28] = tempo & 0xFF;
+
+ // Now copy in the rest of the events
+ seqFile.read(g_midiBuffer.pDat + 29, dataSize);
+ seqFile.close();
+
+ MidiParser *parser = MidiParser::createParser_SMF();
+ if (parser->loadMusic(g_midiBuffer.pDat, actualSize)) {
parser->setTrack(0);
parser->setMidiDriver(this);
parser->setTimerRate(getBaseTempo());
@@ -870,14 +911,12 @@ void RestoreMidiFacts(SCNHANDLE Midi, bool Loop) {
g_currentMidi = Midi;
g_currentLoop = Loop;
- if (_vm->_config->_musicVolume != 0 && Loop) {
- bool mute = false;
- if (ConfMan.hasKey("mute"))
- mute = ConfMan.getBool("mute");
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
- PlayMidiSequence(g_currentMidi, true);
- SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume);
- }
+ PlayMidiSequence(g_currentMidi, true);
+ SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume);
}
#if 0
diff --git a/engines/tinsel/music.h b/engines/tinsel/music.h
index d43fed268d..121bf3d79b 100644
--- a/engines/tinsel/music.h
+++ b/engines/tinsel/music.h
@@ -64,7 +64,7 @@ public:
virtual void setVolume(int volume);
- void playXMIDI(byte *midiData, uint32 size, bool loop);
+ void playMIDI(uint32 size, bool loop);
// void stop();
void pause();
@@ -76,6 +76,10 @@ public:
// The original sets the "sequence timing" to 109 Hz, whatever that
// means. The default is 120.
uint32 getBaseTempo() { return _driver ? (109 * _driver->getBaseTempo()) / 120 : 0; }
+
+private:
+ void playXMIDI(uint32 size, bool loop);
+ void playSEQ(uint32 size, bool loop);
};
class PCMMusicPlayer : public Audio::AudioStream {
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index 145a6a8e5d..04bc2856ca 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -122,6 +122,8 @@ static uint32 g_hMasterScript;
struct WorkaroundEntry {
TinselEngineVersion version; ///< Engine version this workaround applies to
bool scnFlag; ///< Only applicable for Tinsel 1 (DW 1)
+ bool isDemo; ///< Flags whether it's for a demo
+ Common::Platform platform; ///< Platform filter
SCNHANDLE hCode; ///< Script to apply fragment to
int ip; ///< Script offset to run this fragment before
int numBytes; ///< Number of bytes in the script
@@ -129,6 +131,7 @@ struct WorkaroundEntry {
};
#define FRAGMENT_WORD(x) (byte)(x & 0xFF), (byte)(x >> 8)
+#define FRAGMENT_DWORD(x) (byte)(x & 0xFF), (byte)(x >> 8), (byte)(x >> 16), (byte)(x >> 24)
static const byte fragment1[] = {OP_ZERO, OP_GSTORE | OPSIZE16, 206, 0};
static const byte fragment2[] = {OP_LIBCALL | OPSIZE8, 110};
@@ -149,6 +152,10 @@ static const byte fragment12[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1491),
OP_IMM | OPSIZE16, FRAGMENT_WORD(322), OP_LIBCALL | OPSIZE8, 46, // Give back the whistle
OP_JUMP | OPSIZE16, FRAGMENT_WORD(1568)};
static const byte fragment13[] = {OP_ZERO, OP_GSTORE | OPSIZE16, FRAGMENT_WORD(306)};
+static const byte fragment14[] = {OP_LIBCALL | OPSIZE8, 58,
+ OP_IMM, FRAGMENT_DWORD((42 << 23)), OP_ONE, OP_ZERO, OP_LIBCALL | OPSIZE8, 44,
+ OP_LIBCALL | OPSIZE8, 97, OP_JUMP | OPSIZE16, FRAGMENT_WORD(2220)
+};
#undef FRAGMENT_WORD
@@ -157,7 +164,7 @@ const WorkaroundEntry workaroundList[] = {
// book back to the present. In the GRA version, it was global 373,
// and was reset when he is returned to the past, but was forgotten
// in the SCN version, so this ensures the flag is properly reset.
- {TINSEL_V1, true, 427942095, 1, sizeof(fragment1), fragment1},
+ {TINSEL_V1, true, false, Common::kPlatformUnknown, 427942095, 1, sizeof(fragment1), fragment1},
// DW1-GRA: Rincewind exiting the Inn is blocked by the luggage.
// Whilst you can then move into walkable areas, saving and
@@ -165,26 +172,26 @@ const WorkaroundEntry workaroundList[] = {
// fragment turns off NPC blocking for the Outside Inn rooms so that
// the luggage won't block Past Outside Inn.
// See bug report #2525010.
- {TINSEL_V1, false, 444622076, 0, sizeof(fragment2), fragment2},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 444622076, 0, sizeof(fragment2), fragment2},
// Present Outside Inn
- {TINSEL_V1, false, 352600876, 0, sizeof(fragment2), fragment2},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 352600876, 0, sizeof(fragment2), fragment2},
// DW1-GRA: Talking to palace guards in Act 2 gives !!!HIGH
// STRING||| - this happens if you initiate dialog with one of the
// guards, but not the other. So these fragments provide the correct
// talk parameters where needed.
// See bug report #2831159.
- {TINSEL_V1, false, 310506872, 463, sizeof(fragment4), fragment4},
- {TINSEL_V1, false, 310506872, 485, sizeof(fragment5), fragment5},
- {TINSEL_V1, false, 310506872, 513, sizeof(fragment6), fragment6},
- {TINSEL_V1, false, 310506872, 613, sizeof(fragment7), fragment7},
- {TINSEL_V1, false, 310506872, 641, sizeof(fragment8), fragment8},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 463, sizeof(fragment4), fragment4},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 485, sizeof(fragment5), fragment5},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 513, sizeof(fragment6), fragment6},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 613, sizeof(fragment7), fragment7},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 641, sizeof(fragment8), fragment8},
// DW1-SCN: The script for the lovable street-Starfish does a
// 'StopSample' after flicking the coin to ensure it's sound is
// stopped, but which also accidentally can stop any active
// conversation with the Amazon.
- {TINSEL_V1, true, 394640351, 121, sizeof(fragment9), fragment9},
+ {TINSEL_V1, true, false, Common::kPlatformUnknown, 394640351, 121, sizeof(fragment9), fragment9},
// DW2: In the garden, global #490 is set when the bees begin their
// 'out of hive' animation, and reset when done. But if the game is
@@ -197,25 +204,29 @@ const WorkaroundEntry workaroundList[] = {
// * Stealing the mallets from the wizards (bug #2820788).
// This fix ensures that the global is reset when the Garden scene
// is loaded (both entering and restoring a game).
- {TINSEL_V2, true, 2888147476U, 0, sizeof(fragment3), fragment3},
+ {TINSEL_V2, true, false, Common::kPlatformUnknown, 2888147476U, 0, sizeof(fragment3), fragment3},
// DW1-GRA: Corrects text being drawn partially off-screen during
// the blackboard description of the Librarian.
- {TINSEL_V1, false, 293831402, 133, sizeof(fragment10), fragment10},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 293831402, 133, sizeof(fragment10), fragment10},
// DW1-GRA/SCN: Corrects the dead-end of being able to give the
// whistle back to the pirate before giving him the parrot.
// See bug report #2934211.
- {TINSEL_V1, true, 352601285, 1569, sizeof(fragment11), fragment11},
- {TINSEL_V1, false, 352602304, 1488, sizeof(fragment12), fragment12},
+ {TINSEL_V1, true, false, Common::kPlatformUnknown, 352601285, 1569, sizeof(fragment11), fragment11},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 352602304, 1488, sizeof(fragment12), fragment12},
// DW2: Corrects a bug with global 306 not being cleared if you leave
// the marketplace scene whilst D'Blah is talking (even if it's not
// actually audible); returning to the scene and clicking on him multiple
// times would cause the game to crash
- {TINSEL_V2, true, 1109294728, 0, sizeof(fragment13), fragment13},
+ {TINSEL_V2, true, false, Common::kPlatformUnknown, 1109294728, 0, sizeof(fragment13), fragment13},
+
+ // DW1 PSX DEMO: Alters a script in the PSX DW1 demo to show the Idle animation scene rather than
+ // quitting the game when no user input happens for a while
+ {TINSEL_V1, true, true, Common::kPlatformPSX, 0, 2186, sizeof(fragment14), fragment14},
- {TINSEL_V0, false, 0, 0, 0, NULL}
+ {TINSEL_V0, false, false, Common::kPlatformUnknown, 0, 0, 0, NULL}
};
//----------------- LOCAL GLOBAL DATA --------------------
@@ -243,13 +254,13 @@ static INT_CONTEXT *AllocateInterpretContext(GSORT gsort) {
for (i = 0, pic = g_icList; i < NUM_INTERPRET; i++, pic++) {
if (pic->GSort == GS_NONE) {
- pic->pProc = g_scheduler->getCurrentProcess();
+ pic->pProc = CoroScheduler.getCurrentProcess();
pic->GSort = gsort;
return pic;
}
#ifdef DEBUG
else {
- if (pic->pProc == g_scheduler->getCurrentProcess())
+ if (pic->pProc == CoroScheduler.getCurrentProcess())
error("Found unreleased interpret context");
}
#endif
@@ -277,7 +288,7 @@ static void FreeWaitCheck(PINT_CONTEXT pic, bool bVoluntary) {
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);
+ CoroScheduler.reschedule((g_icList + i)->pProc);
break;
}
}
@@ -301,7 +312,7 @@ static void FreeInterpretContextPi(INT_CONTEXT *pic) {
* Ensures that interpret contexts don't get lost when an Interpret()
* call doesn't complete.
*/
-void FreeInterpretContextPr(PROCESS *pProc) {
+void FreeInterpretContextPr(Common::PROCESS *pProc) {
INT_CONTEXT *pic;
int i;
@@ -393,7 +404,7 @@ INT_CONTEXT *RestoreInterpretContext(INT_CONTEXT *ric) {
ic = AllocateInterpretContext(GS_NONE); // Sort will soon be overridden
memcpy(ic, ric, sizeof(INT_CONTEXT));
- ic->pProc = g_scheduler->getCurrentProcess();
+ ic->pProc = CoroScheduler.getCurrentProcess();
ic->resumeState = RES_1;
LockCode(ic);
@@ -422,7 +433,7 @@ void RegisterGlobals(int num) {
if (g_icList == NULL) {
error("Cannot allocate memory for interpret contexts");
}
- g_scheduler->setResourceCallback(FreeInterpretContextPr);
+ CoroScheduler.setResourceCallback(FreeInterpretContextPr);
} else {
// Check size is still the same
assert(g_numGlobals == num);
@@ -433,7 +444,7 @@ void RegisterGlobals(int num) {
if (TinselV2) {
// read initial values
- CdCD(nullContext);
+ CdCD(Common::nullContext);
Common::File f;
if (!f.open(GLOBALS_FILENAME))
@@ -582,6 +593,8 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
if ((wkEntry->version == TinselVersion) &&
(wkEntry->hCode == ic->hCode) &&
(wkEntry->ip == ip) &&
+ (wkEntry->isDemo == _vm->getIsADGFDemo()) &&
+ ((wkEntry->platform == Common::kPlatformUnknown) || (wkEntry->platform == _vm->getPlatform())) &&
(!TinselV1 || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) {
// Point to start of workaround fragment
ip = 0;
@@ -839,7 +852,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
* Associates an interpret context with the
* process that will run it.
*/
-void AttachInterpret(INT_CONTEXT *pic, PROCESS *pProc) {
+void AttachInterpret(INT_CONTEXT *pic, Common::PROCESS *pProc) {
// Attach the process which is using this context
pic->pProc = pProc;
}
@@ -869,9 +882,9 @@ static uint32 UniqueWaitNumber() {
/**
* WaitInterpret
*/
-void WaitInterpret(CORO_PARAM, PPROCESS pWaitProc, bool *result) {
+void WaitInterpret(CORO_PARAM, Common::PPROCESS pWaitProc, bool *result) {
int i;
- PPROCESS currentProcess = g_scheduler->getCurrentProcess();
+ Common::PPROCESS currentProcess = CoroScheduler.getCurrentProcess();
assert(currentProcess);
assert(currentProcess != pWaitProc);
if (result) *result = false;
diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h
index 5d16dae432..4980fc6ed9 100644
--- a/engines/tinsel/pcode.h
+++ b/engines/tinsel/pcode.h
@@ -25,7 +25,7 @@
#define TINSEL_PCODE_H
#include "tinsel/events.h" // for TINSEL_EVENT
-#include "tinsel/sched.h" // for PROCESS
+#include "tinsel/sched.h" // for Common::PROCESS
namespace Common {
class Serializer;
@@ -56,7 +56,7 @@ struct WorkaroundEntry;
struct INT_CONTEXT {
// Elements for interpret context management
- PROCESS *pProc; ///< processes owning this context
+ Common::PROCESS *pProc; ///< processes owning this context
GSORT GSort; ///< sort of this context
// Previously parameters to Interpret()
@@ -114,12 +114,12 @@ void SaveInterpretContexts(INT_CONTEXT *sICInfo);
void RegisterGlobals(int num);
void FreeGlobals();
-void AttachInterpret(INT_CONTEXT *pic, PROCESS *pProc);
+void AttachInterpret(INT_CONTEXT *pic, Common::PROCESS *pProc);
-void WaitInterpret(CORO_PARAM, PPROCESS pWaitProc, bool *result);
+void WaitInterpret(CORO_PARAM, Common::PPROCESS pWaitProc, bool *result);
-#define NUM_INTERPRET (NUM_PROCESS - 20)
-#define MAX_INTERPRET (MAX_PROCESSES - 20)
+#define NUM_INTERPRET (CORO_NUM_PROCESS - 20)
+#define MAX_INTERPRET (CORO_MAX_PROCESSES - 20)
/*----------------------------------------------------------------------*\
|* Library Procedure and Function codes parameter enums *|
diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp
index 9a9e6ab00f..b821c5dee2 100644
--- a/engines/tinsel/pdisplay.cpp
+++ b/engines/tinsel/pdisplay.cpp
@@ -23,9 +23,9 @@
* PointProcess()
*/
+#include "common/coroutines.h"
#include "tinsel/actors.h"
#include "tinsel/background.h"
-#include "tinsel/coroutine.h"
#include "tinsel/cursor.h"
#include "tinsel/dw.h"
#include "tinsel/events.h"
@@ -265,7 +265,7 @@ void DisablePointing() {
if (hPoly != NOPOLY && PolyType(hPoly) == TAG && PolyIsPointedTo(hPoly)) {
SetPolyPointedTo(hPoly, false);
SetPolyTagWanted(hPoly, false, false, 0);
- PolygonEvent(nullContext, hPoly, UNPOINT, 0, false, 0);
+ PolygonEvent(Common::nullContext, hPoly, UNPOINT, 0, false, 0);
}
}
@@ -275,7 +275,7 @@ void DisablePointing() {
SetActorPointedTo(i, false);
SetActorTagWanted(i, false, false, 0);
- ActorEvent(nullContext, i, UNPOINT, false, 0);
+ ActorEvent(Common::nullContext, i, UNPOINT, false, 0);
}
}
}
diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index 40729d9f3a..9e0baa749e 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -21,9 +21,9 @@
* Plays films within a scene, takes into account the actor in each 'column'. |
*/
+#include "common/coroutines.h"
#include "tinsel/actors.h"
#include "tinsel/background.h"
-#include "tinsel/coroutine.h"
#include "tinsel/dw.h"
#include "tinsel/film.h"
#include "tinsel/handle.h"
@@ -395,7 +395,7 @@ static void SoundReelWaitCheck() {
if (--g_soundReelWait == 0) {
for (int i = 0; i < MAX_SOUNDREELS; i++) {
if (g_soundReels[i].hFilm) {
- g_scheduler->createProcess(PID_REEL, ResSoundReel, &i, sizeof(i));
+ CoroScheduler.createProcess(PID_REEL, ResSoundReel, &i, sizeof(i));
}
}
}
@@ -1001,7 +1001,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay
NewestFilm(hFilm, &pFilm->reels[i]);
ppi.column = i;
- g_scheduler->createProcess(PID_REEL, PlayProcess, &ppi, sizeof(PPINIT));
+ CoroScheduler.createProcess(PID_REEL, PlayProcess, &ppi, sizeof(PPINIT));
}
if (TinselV2) {
@@ -1011,7 +1011,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay
CORO_GIVE_WAY;
if (myescEvent && myescEvent != GetEscEvents())
- g_scheduler->rescheduleAll();
+ CoroScheduler.rescheduleAll();
}
CORO_END_CODE;
@@ -1063,7 +1063,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla
NewestFilm(hFilm, &pFilm->reels[i]);
_ctx->ppi.column = i;
- g_scheduler->createProcess(PID_REEL, PlayProcess, &_ctx->ppi, sizeof(PPINIT));
+ CoroScheduler.createProcess(PID_REEL, PlayProcess, &_ctx->ppi, sizeof(PPINIT));
}
if (TinselV2) {
@@ -1078,7 +1078,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla
// Wait until film changes or loop count increases
while (GetActorPresFilm(_ctx->i) == hFilm && GetLoopCount(_ctx->i) == _ctx->loopCount) {
if (myescEvent && myescEvent != GetEscEvents()) {
- g_scheduler->rescheduleAll();
+ CoroScheduler.rescheduleAll();
break;
}
@@ -1126,7 +1126,7 @@ void RestoreActorReels(SCNHANDLE hFilm, short reelnum, short z, int x, int y) {
NewestFilm(hFilm, &pfilm->reels[reelnum]);
// Start display process for the reel
- g_scheduler->createProcess(PID_REEL, PlayProcess, &ppi, sizeof(ppi));
+ CoroScheduler.createProcess(PID_REEL, PlayProcess, &ppi, sizeof(ppi));
}
/**
@@ -1160,7 +1160,7 @@ void RestoreActorReels(SCNHANDLE hFilm, int actor, int x, int y) {
NewestFilm(hFilm, &pFilm->reels[i]);
// Start display process for the reel
- g_scheduler->createProcess(PID_REEL, PlayProcess, &ppi, sizeof(ppi));
+ CoroScheduler.createProcess(PID_REEL, PlayProcess, &ppi, sizeof(ppi));
g_soundReelWait++;
}
diff --git a/engines/tinsel/play.h b/engines/tinsel/play.h
index 041b7096a8..fffa8a9329 100644
--- a/engines/tinsel/play.h
+++ b/engines/tinsel/play.h
@@ -24,7 +24,7 @@
#ifndef TINSEL_PLAY_H // prevent multiple includes
#define TINSEL_PLAY_H
-#include "tinsel/coroutine.h"
+#include "common/coroutines.h"
#include "tinsel/dw.h"
#include "tinsel/multiobj.h"
diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp
index 6fc1c65ec5..d8c1cef0b6 100644
--- a/engines/tinsel/polygons.cpp
+++ b/engines/tinsel/polygons.cpp
@@ -1469,7 +1469,7 @@ static void SetExTags(SCNHANDLE ph) {
pts = &TagStates[SceneTags[i].offset];
for (j = 0; j < SceneTags[i].nooftags; j++, pts++) {
if (!pts->enabled)
- DisableTag(nullContext, pts->tid);
+ DisableTag(Common::nullContext, pts->tid);
}
return;
}
@@ -1873,7 +1873,7 @@ void InitPolygons(SCNHANDLE ph, int numPoly, bool bRestart) {
} else {
for (int i = numPoly - 1; i >= 0; i--) {
if (Polys[i]->polyType == TAG) {
- PolygonEvent(nullContext, i, STARTUP, 0, false, 0);
+ PolygonEvent(Common::nullContext, i, STARTUP, 0, false, 0);
}
}
}
diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp
index bb0aeabd2f..ba8f47f9cf 100644
--- a/engines/tinsel/rince.cpp
+++ b/engines/tinsel/rince.cpp
@@ -202,8 +202,8 @@ void KillMover(PMOVER pMover) {
pMover->bActive = false;
MultiDeleteObject(GetPlayfieldList(FIELD_WORLD), pMover->actorObj);
pMover->actorObj = NULL;
- assert(g_scheduler->getCurrentProcess() != pMover->pProc);
- g_scheduler->killProcess(pMover->pProc);
+ assert(CoroScheduler.getCurrentProcess() != pMover->pProc);
+ CoroScheduler.killProcess(pMover->pProc);
}
}
@@ -856,10 +856,10 @@ void MoverProcessCreate(int X, int Y, int id, PMOVER pMover) {
iStruct.Y = Y;
iStruct.pMover = pMover;
- g_scheduler->createProcess(PID_MOVER, T2MoverProcess, &iStruct, sizeof(MAINIT));
+ CoroScheduler.createProcess(PID_MOVER, T2MoverProcess, &iStruct, sizeof(MAINIT));
} else {
MoverProcessHelper(X, Y, id, pMover);
- pMover->pProc = g_scheduler->createProcess(PID_MOVER, T1MoverProcess, &pMover, sizeof(PMOVER));
+ pMover->pProc = CoroScheduler.createProcess(PID_MOVER, T1MoverProcess, &pMover, sizeof(PMOVER));
}
}
diff --git a/engines/tinsel/rince.h b/engines/tinsel/rince.h
index 93fd191172..623f3ee137 100644
--- a/engines/tinsel/rince.h
+++ b/engines/tinsel/rince.h
@@ -31,7 +31,6 @@
namespace Tinsel {
struct OBJECT;
-struct PROCESS;
enum NPS {NOT_IN, GOING_UP, GOING_DOWN, LEAVING, ENTERING};
@@ -110,7 +109,7 @@ struct MOVER {
/* NOTE: If effect polys can overlap, this needs improving */
bool bInEffect;
- PROCESS *pProc;
+ Common::PROCESS *pProc;
// Discworld 2 specific fields
int32 zOverride;
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 0a552c8c2b..2ef92d853f 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -55,8 +55,7 @@ namespace Tinsel {
* only saves/loads those which are valid for the version of the savegame
* which is being loaded/saved currently.
*/
-#define CURRENT_VER 1
-// TODO: Not yet used
+#define CURRENT_VER 2
/**
* An auxillary macro, used to specify savegame versions. We use this instead
@@ -97,12 +96,13 @@ struct SaveGameHeader {
TimeDate dateTime;
bool scnFlag;
byte language;
+ uint16 numInterpreters; // Savegame version 2 or later only
};
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 + 1 + 1
+ SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 1 + 1 + 2
};
#define SAVEGAME_ID (TinselV2 ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID)
@@ -186,6 +186,15 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
}
}
+ // Handle the number of interpreter contexts that will be saved in the savegame
+ if (tmp >= 2) {
+ tmp -= 2;
+ hdr.numInterpreters = NUM_INTERPRET;
+ s.syncAsUint16LE(hdr.numInterpreters);
+ } else {
+ hdr.numInterpreters = (TinselV2 ? 70 : 64) - 20;
+ }
+
// Skip over any extra bytes
s.skip(tmp);
return true;
@@ -262,7 +271,7 @@ static void syncSoundReel(Common::Serializer &s, SOUNDREELS &sr) {
s.syncAsSint32LE(sr.actorCol);
}
-static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd) {
+static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd, int numInterp) {
s.syncAsUint32LE(sd.SavedSceneHandle);
s.syncAsUint32LE(sd.SavedBgroundHandle);
for (int i = 0; i < MAX_MOVERS; ++i)
@@ -273,7 +282,7 @@ static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd) {
s.syncAsSint32LE(sd.NumSavedActors);
s.syncAsSint32LE(sd.SavedLoffset);
s.syncAsSint32LE(sd.SavedToffset);
- for (int i = 0; i < NUM_INTERPRET; ++i)
+ for (int i = 0; i < numInterp; ++i)
sd.SavedICInfo[i].syncWithSerializer(s);
for (int i = 0; i < MAX_POLY; ++i)
s.syncAsUint32LE(sd.SavedDeadPolys[i]);
@@ -422,7 +431,7 @@ char *ListEntry(int i, letype which) {
return NULL;
}
-static void DoSync(Common::Serializer &s) {
+static bool DoSync(Common::Serializer &s, int numInterp) {
int sg = 0;
if (TinselV2) {
@@ -434,7 +443,7 @@ static void DoSync(Common::Serializer &s) {
if (TinselV2 && s.isLoading())
HoldItem(INV_NOICON);
- syncSavedData(s, *g_srsd);
+ syncSavedData(s, *g_srsd, numInterp);
syncGlobInfo(s); // Glitter globals
syncInvInfo(s); // Inventory data
@@ -443,6 +452,10 @@ static void DoSync(Common::Serializer &s) {
sg = WhichItemHeld();
s.syncAsSint32LE(sg);
if (s.isLoading()) {
+ if (sg != -1 && !GetIsInvObject(sg))
+ // Not a valid inventory object, so return false
+ return false;
+
if (TinselV2)
g_thingHeld = sg;
else
@@ -459,7 +472,7 @@ static void DoSync(Common::Serializer &s) {
if (*g_SaveSceneSsCount != 0) {
SAVED_DATA *sdPtr = g_SaveSceneSsData;
for (int i = 0; i < *g_SaveSceneSsCount; ++i, ++sdPtr)
- syncSavedData(s, *sdPtr);
+ syncSavedData(s, *sdPtr, numInterp);
// 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
@@ -469,6 +482,8 @@ static void DoSync(Common::Serializer &s) {
if (!TinselV2)
syncAllActorsAlive(s);
+
+ return true;
}
/**
@@ -488,7 +503,22 @@ static bool DoRestore() {
return false;
}
- DoSync(s);
+ // Load in the data. For older savegame versions, we potentially need to load the data twice, once
+ // for pre 1.5 savegames, and if that fails, a second time for 1.5 savegames
+ int numInterpreters = hdr.numInterpreters;
+ int32 currentPos = f->pos();
+ for (int tryNumber = 0; tryNumber < ((hdr.ver >= 2) ? 1 : 2); ++tryNumber) {
+ // If it's the second loop iteration, try with the 1.5 savegame number of interpreter contexts
+ if (tryNumber == 1) {
+ f->seek(currentPos);
+ numInterpreters = 80;
+ }
+
+ // Load the savegame data
+ if (DoSync(s, numInterpreters))
+ // Data load was successful (or likely), so break out of loop
+ break;
+ }
uint32 id = f->readSint32LE();
if (id != (uint32)0xFEEDFACE)
@@ -575,7 +605,7 @@ static void DoSave() {
return;
}
- DoSync(s);
+ DoSync(s, hdr.numInterpreters);
// Write out the special Id for Discworld savegames
f->writeUint32LE(0xFEEDFACE);
diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp
index 1b06e3929c..0c0cc5c81e 100644
--- a/engines/tinsel/savescn.cpp
+++ b/engines/tinsel/savescn.cpp
@@ -190,7 +190,7 @@ void sortActors(SAVED_DATA *sd) {
RestoreAuxScales(sd->SavedMoverInfo);
for (int i = 0; i < MAX_MOVERS; i++) {
if (sd->SavedMoverInfo[i].bActive)
- Stand(nullContext, sd->SavedMoverInfo[i].actorID, sd->SavedMoverInfo[i].objX,
+ Stand(Common::nullContext, sd->SavedMoverInfo[i].actorID, sd->SavedMoverInfo[i].objX,
sd->SavedMoverInfo[i].objY, sd->SavedMoverInfo[i].hLastfilm);
}
}
@@ -245,7 +245,7 @@ static void SortMAProcess(CORO_PARAM, const void *) {
void ResumeInterprets() {
// Master script only affected on restore game, not restore scene
if (!TinselV2 && (g_rsd == &g_sgData)) {
- g_scheduler->killMatchingProcess(PID_MASTER_SCR, -1);
+ CoroScheduler.killMatchingProcess(PID_MASTER_SCR, -1);
FreeMasterInterpretContext();
}
@@ -314,7 +314,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
// Master script only affected on restore game, not restore scene
if (sd == &g_sgData) {
- g_scheduler->killMatchingProcess(PID_MASTER_SCR);
+ CoroScheduler.killMatchingProcess(PID_MASTER_SCR);
KillGlobalProcesses();
FreeMasterInterpretContext();
}
@@ -340,7 +340,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
SetDoFadeIn(!g_bNoFade);
g_bNoFade = false;
- StartupBackground(nullContext, sd->SavedBgroundHandle);
+ StartupBackground(Common::nullContext, sd->SavedBgroundHandle);
if (TinselV2) {
Offset(EX_USEXY, sd->SavedLoffset, sd->SavedToffset);
@@ -354,7 +354,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);
+ CoroScheduler.createProcess(PID_MOVER, SortMAProcess, NULL, 0);
g_bNotDoneYet = true;
RestoreActorZ(sd->savedActorZ);
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index f635ce13a3..c5444517f1 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -158,7 +158,8 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
// The following myEscape value setting is used for enabling title screen skipping in DW1
if (TinselV1 && (g_sceneCtr == 1)) g_initialMyEscape = GetEscEvents();
- _ctx->myEscape = (TinselV1 && (g_sceneCtr < 4)) ? g_initialMyEscape : 0;
+ // DW1 PSX has its own scene skipping script code for scenes 2 and 3 (bug #3541542).
+ _ctx->myEscape = (TinselV1 && (g_sceneCtr < (TinselV1PSX ? 2 : 4))) ? g_initialMyEscape : 0;
// get the stuff copied to process when it was created
_ctx->pInit = (const TP_INIT *)param;
@@ -193,7 +194,7 @@ void SendSceneTinselProcess(TINSEL_EVENT event) {
init.event = event;
init.hTinselCode = ss->hSceneScript;
- g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
+ CoroScheduler.createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
}
}
}
@@ -271,7 +272,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
init.event = STARTUP;
init.hTinselCode = es->hScript;
- g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
+ CoroScheduler.createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
}
break;
}
@@ -291,7 +292,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
init.event = STARTUP;
init.hTinselCode = ss->hSceneScript;
- g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
+ CoroScheduler.createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
}
}
@@ -344,7 +345,7 @@ void EndScene() {
KillAllObjects();
// kill all destructable process
- g_scheduler->killMatchingProcess(PID_DESTROY, PID_DESTROY);
+ CoroScheduler.killMatchingProcess(PID_DESTROY, PID_DESTROY);
}
/**
@@ -405,16 +406,16 @@ void PrimeScene() {
if (!TinselV2)
EnableTags(); // Next scene with tags enabled
- g_scheduler->createProcess(PID_SCROLL, ScrollProcess, NULL, 0);
- g_scheduler->createProcess(PID_SCROLL, EffectPolyProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_SCROLL, ScrollProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_SCROLL, EffectPolyProcess, NULL, 0);
#ifdef DEBUG
if (g_ShowPosition)
- g_scheduler->createProcess(PID_POSITION, CursorPositionProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_POSITION, CursorPositionProcess, NULL, 0);
#endif
- g_scheduler->createProcess(PID_TAG, TagProcess, NULL, 0);
- g_scheduler->createProcess(PID_TAG, PointProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_TAG, TagProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_TAG, PointProcess, NULL, 0);
// init the current background
PrimeBackground();
@@ -471,7 +472,7 @@ void DoHailScene(SCNHANDLE scene) {
init.event = NOEVENT;
init.hTinselCode = ss->hSceneScript;
- g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
+ CoroScheduler.createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
}
}
diff --git a/engines/tinsel/scene.h b/engines/tinsel/scene.h
index baaff27a3e..06e5c096d9 100644
--- a/engines/tinsel/scene.h
+++ b/engines/tinsel/scene.h
@@ -75,9 +75,9 @@ enum REEL {
typedef enum { TRANS_DEF, TRANS_CUT, TRANS_FADE } TRANSITS;
// amount to shift scene handles by
-#define SCNHANDLE_SHIFT ((TinselV2 && !IsDemo) ? 25 : 23)
-#define OFFSETMASK ((TinselV2 && !IsDemo) ? 0x01ffffffL : 0x007fffffL)
-#define HANDLEMASK ((TinselV2 && !IsDemo) ? 0xFE000000L : 0xFF800000L)
+#define SCNHANDLE_SHIFT ((TinselV2 && !TinselV2Demo) ? 25 : 23)
+#define OFFSETMASK ((TinselV2 && !TinselV2Demo) ? 0x01ffffffL : 0x007fffffL)
+#define HANDLEMASK ((TinselV2 && !TinselV2Demo) ? 0xFE000000L : 0xFF800000L)
void DoHailScene(SCNHANDLE scene);
diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp
index 343758d924..4bf356ba36 100644
--- a/engines/tinsel/sched.cpp
+++ b/engines/tinsel/sched.cpp
@@ -32,8 +32,6 @@
namespace Tinsel {
-Scheduler *g_scheduler = 0;
-
#include "common/pack-start.h" // START STRUCT PACKING
struct PROCESS_STRUC {
@@ -53,471 +51,6 @@ static SCNHANDLE g_hSceneProcess;
static uint32 g_numGlobalProcess;
static PROCESS_STRUC *g_pGlobalProcess;
-//--------------------- FUNCTIONS ------------------------
-
-Scheduler::Scheduler() {
- processList = 0;
- pFreeProcesses = 0;
- pCurrent = 0;
-
-#ifdef DEBUG
- // diagnostic process counters
- numProcs = 0;
- maxProcs = 0;
-#endif
-
- pRCfunction = 0;
-
- active = new PROCESS;
- active->pPrevious = NULL;
- active->pNext = NULL;
-
- g_scheduler = this; // FIXME HACK
-}
-
-Scheduler::~Scheduler() {
- // Kill all running processes (i.e. free memory allocated for their state).
- PROCESS *pProc = active->pNext;
- while (pProc != NULL) {
- delete pProc->state;
- pProc->state = 0;
- pProc = pProc->pNext;
- }
-
- free(processList);
- processList = NULL;
-
- delete active;
- active = 0;
-}
-
-/**
- * Kills all processes and places them on the free list.
- */
-void Scheduler::reset() {
-
-#ifdef DEBUG
- // clear number of process in use
- numProcs = 0;
-#endif
-
- if (processList == NULL) {
- // first time - allocate memory for process list
- processList = (PROCESS *)calloc(MAX_PROCESSES, sizeof(PROCESS));
-
- // make sure memory allocated
- if (processList == NULL) {
- error("Cannot allocate memory for process data");
- }
-
- // fill with garbage
- memset(processList, 'S', MAX_PROCESSES * sizeof(PROCESS));
- }
-
- // Kill all running processes (i.e. free memory allocated for their state).
- PROCESS *pProc = active->pNext;
- while (pProc != NULL) {
- delete pProc->state;
- pProc->state = 0;
- pProc = pProc->pNext;
- }
-
- // no active processes
- pCurrent = active->pNext = NULL;
-
- // place first process on free list
- pFreeProcesses = processList;
-
- // link all other processes after first
- for (int i = 1; i <= NUM_PROCESS; i++) {
- processList[i - 1].pNext = (i == NUM_PROCESS) ? NULL : processList + i;
- processList[i - 1].pPrevious = (i == 1) ? active : processList + (i - 2);
- }
-}
-
-
-#ifdef DEBUG
-/**
- * Shows the maximum number of process used at once.
- */
-void Scheduler::printStats() {
- debug("%i process of %i used", maxProcs, NUM_PROCESS);
-}
-#endif
-
-#ifdef DEBUG
-/**
- * Checks both the active and free process list to insure all the links are valid,
- * and that no processes have been lost
- */
-void Scheduler::CheckStack() {
- Common::List<PROCESS *> pList;
-
- // Check both the active and free process lists
- for (int i = 0; i < 2; ++i) {
- PROCESS *p = (i == 0) ? active : pFreeProcesses;
-
- if (p != NULL) {
- // Make sure the linkages are correct
- while (p->pNext != NULL) {
- assert(p->pNext->pPrevious == p);
- pList.push_back(p);
- p = p->pNext;
- }
- pList.push_back(p);
- }
- }
-
- // Make sure all processes are accounted for
- for (int idx = 0; idx < NUM_PROCESS; idx++) {
- bool found = false;
- for (Common::List<PROCESS *>::iterator i = pList.begin(); i != pList.end(); ++i) {
- PROCESS *pTemp = *i;
- if (*i == &processList[idx]) {
- found = true;
- break;
- }
- }
-
- assert(found);
- }
-}
-#endif
-
-/**
- * Give all active processes a chance to run
- */
-void Scheduler::schedule() {
- // start dispatching active process list
- PROCESS *pNext;
- PROCESS *pProc = active->pNext;
- while (pProc != NULL) {
- pNext = pProc->pNext;
-
- if (--pProc->sleepTime <= 0) {
- // process is ready for dispatch, activate it
- pCurrent = pProc;
- pProc->coroAddr(pProc->state, pProc->param);
-
- if (!pProc->state || pProc->state->_sleep <= 0) {
- // Coroutine finished
- pCurrent = pCurrent->pPrevious;
- killProcess(pProc);
- } else {
- pProc->sleepTime = pProc->state->_sleep;
- }
-
- // pCurrent may have been changed
- pNext = pCurrent->pNext;
- pCurrent = NULL;
- }
-
- pProc = pNext;
- }
-}
-
-/**
- * Reschedules all the processes to run again this query
- */
-void Scheduler::rescheduleAll() {
- assert(pCurrent);
-
- // Unlink current process
- pCurrent->pPrevious->pNext = pCurrent->pNext;
- if (pCurrent->pNext)
- pCurrent->pNext->pPrevious = pCurrent->pPrevious;
-
- // Add process to the start of the active list
- pCurrent->pNext = active->pNext;
- active->pNext->pPrevious = pCurrent;
- active->pNext = pCurrent;
- pCurrent->pPrevious = active;
-}
-
-/**
- * If the specified process has already run on this tick, make it run
- * again on the current tick.
- */
-void Scheduler::reschedule(PPROCESS pReSchedProc) {
- // If not currently processing the schedule list, then no action is needed
- if (!pCurrent)
- return;
-
- if (!pReSchedProc)
- pReSchedProc = pCurrent;
-
- PPROCESS pEnd;
-
- // Find the last process in the list.
- // But if the target process is down the list from here, do nothing
- for (pEnd = pCurrent; pEnd->pNext != NULL; pEnd = pEnd->pNext) {
- if (pEnd->pNext == pReSchedProc)
- return;
- }
-
- assert(pEnd->pNext == NULL);
-
- // Could be in the middle of a KillProc()!
- // Dying process was last and this process was penultimate
- if (pReSchedProc->pNext == NULL)
- return;
-
- // If we're moving the current process, move it back by one, so that the next
- // schedule() iteration moves to the now next one
- if (pCurrent == pReSchedProc)
- pCurrent = pCurrent->pPrevious;
-
- // Unlink the process, and add it at the end
- pReSchedProc->pPrevious->pNext = pReSchedProc->pNext;
- pReSchedProc->pNext->pPrevious = pReSchedProc->pPrevious;
- pEnd->pNext = pReSchedProc;
- pReSchedProc->pPrevious = pEnd;
- pReSchedProc->pNext = NULL;
-}
-
-/**
- * Moves the specified process to the end of the dispatch queue
- * allowing it to run again within the current game cycle.
- * @param pGiveProc Which process
- */
-void Scheduler::giveWay(PPROCESS pReSchedProc) {
- // If not currently processing the schedule list, then no action is needed
- if (!pCurrent)
- return;
-
- if (!pReSchedProc)
- pReSchedProc = pCurrent;
-
- // If the process is already at the end of the queue, nothing has to be done
- if (!pReSchedProc->pNext)
- return;
-
- PPROCESS pEnd;
-
- // Find the last process in the list.
- for (pEnd = pCurrent; pEnd->pNext != NULL; pEnd = pEnd->pNext)
- ;
- assert(pEnd->pNext == NULL);
-
-
- // If we're moving the current process, move it back by one, so that the next
- // schedule() iteration moves to the now next one
- if (pCurrent == pReSchedProc)
- pCurrent = pCurrent->pPrevious;
-
- // Unlink the process, and add it at the end
- pReSchedProc->pPrevious->pNext = pReSchedProc->pNext;
- pReSchedProc->pNext->pPrevious = pReSchedProc->pPrevious;
- pEnd->pNext = pReSchedProc;
- pReSchedProc->pPrevious = pEnd;
- pReSchedProc->pNext = NULL;
-}
-
-/**
- * Creates a new process.
- *
- * @param pid process identifier
- * @param CORO_ADDR coroutine start address
- * @param pParam process specific info
- * @param sizeParam size of process specific info
- */
-PROCESS *Scheduler::createProcess(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam) {
- PROCESS *pProc;
-
- // get a free process
- pProc = pFreeProcesses;
-
- // trap no free process
- assert(pProc != NULL); // Out of processes
-
-#ifdef DEBUG
- // one more process in use
- if (++numProcs > maxProcs)
- maxProcs = numProcs;
-#endif
-
- // get link to next free process
- pFreeProcesses = pProc->pNext;
- if (pFreeProcesses)
- pFreeProcesses->pPrevious = NULL;
-
- if (pCurrent != NULL) {
- // place new process before the next active process
- pProc->pNext = pCurrent->pNext;
- if (pProc->pNext)
- pProc->pNext->pPrevious = pProc;
-
- // make this new process the next active process
- pCurrent->pNext = pProc;
- pProc->pPrevious = pCurrent;
-
- } else { // no active processes, place process at head of list
- pProc->pNext = active->pNext;
- pProc->pPrevious = active;
-
- if (pProc->pNext)
- pProc->pNext->pPrevious = pProc;
- active->pNext = pProc;
-
- }
-
- // set coroutine entry point
- pProc->coroAddr = coroAddr;
-
- // clear coroutine state
- pProc->state = 0;
-
- // wake process up as soon as possible
- pProc->sleepTime = 1;
-
- // set new process id
- pProc->pid = pid;
-
- // set new process specific info
- if (sizeParam) {
- assert(sizeParam > 0 && sizeParam <= PARAM_SIZE);
-
- // set new process specific info
- memcpy(pProc->param, pParam, sizeParam);
- }
-
- // return created process
- return pProc;
-}
-
-/**
- * Kills the specified process.
- *
- * @param pKillProc which process to kill
- */
-void Scheduler::killProcess(PROCESS *pKillProc) {
- // make sure a valid process pointer
- assert(pKillProc >= processList && pKillProc <= processList + NUM_PROCESS - 1);
-
- // can not kill the current process using killProcess !
- assert(pCurrent != pKillProc);
-
-#ifdef DEBUG
- // one less process in use
- --numProcs;
- assert(numProcs >= 0);
-#endif
-
- // Free process' resources
- if (pRCfunction != NULL)
- (pRCfunction)(pKillProc);
-
- delete pKillProc->state;
- pKillProc->state = 0;
-
- // Take the process out of the active chain list
- pKillProc->pPrevious->pNext = pKillProc->pNext;
- if (pKillProc->pNext)
- pKillProc->pNext->pPrevious = pKillProc->pPrevious;
-
- // link first free process after pProc
- pKillProc->pNext = pFreeProcesses;
- if (pFreeProcesses)
- pKillProc->pNext->pPrevious = pKillProc;
- pKillProc->pPrevious = NULL;
-
- // make pKillProc the first free process
- pFreeProcesses = pKillProc;
-}
-
-
-
-/**
- * Returns a pointer to the currently running process.
- */
-PROCESS *Scheduler::getCurrentProcess() {
- return pCurrent;
-}
-
-/**
- * Returns the process identifier of the specified process.
- *
- * @param pProc which process
- */
-int Scheduler::getCurrentPID() const {
- PROCESS *pProc = pCurrent;
-
- // make sure a valid process pointer
- assert(pProc >= processList && pProc <= processList + NUM_PROCESS - 1);
-
- // return processes PID
- return pProc->pid;
-}
-
-/**
- * Kills any process matching the specified PID. The current
- * process cannot be killed.
- *
- * @param pidKill process identifier of process to kill
- * @param pidMask mask to apply to process identifiers before comparison
- * @return The number of processes killed is returned.
- */
-int Scheduler::killMatchingProcess(int pidKill, int pidMask) {
- int numKilled = 0;
- PROCESS *pProc, *pPrev; // process list pointers
-
- for (pProc = active->pNext, pPrev = active; pProc != NULL; pPrev = pProc, pProc = pProc->pNext) {
- if ((pProc->pid & pidMask) == pidKill) {
- // found a matching process
-
- // dont kill the current process
- if (pProc != pCurrent) {
- // kill this process
- numKilled++;
-
- // Free the process' resources
- if (pRCfunction != NULL)
- (pRCfunction)(pProc);
-
- delete pProc->state;
- pProc->state = 0;
-
- // make prev point to next to unlink pProc
- pPrev->pNext = pProc->pNext;
- if (pProc->pNext)
- pPrev->pNext->pPrevious = pPrev;
-
- // link first free process after pProc
- pProc->pNext = pFreeProcesses;
- pProc->pPrevious = NULL;
- pFreeProcesses->pPrevious = pProc;
-
- // make pProc the first free process
- pFreeProcesses = pProc;
-
- // set to a process on the active list
- pProc = pPrev;
- }
- }
- }
-
-#ifdef DEBUG
- // adjust process in use
- numProcs -= numKilled;
- assert(numProcs >= 0);
-#endif
-
- // return number of processes killed
- return numKilled;
-}
-
-/**
- * Set pointer to a function to be called by killProcess().
- *
- * May be called by a resource allocator, the function supplied is
- * called by killProcess() to allow the resource allocator to free
- * resources allocated to the dying process.
- *
- * @param pFunc Function to be called by killProcess()
- */
-void Scheduler::setResourceCallback(VFPTRPP pFunc) {
- pRCfunction = pFunc;
-}
/**************************************************************************\
|*********** Stuff to do with scene and global processes ************|
@@ -537,7 +70,7 @@ static void RestoredProcessProcess(CORO_PARAM, const void *param) {
_ctx->pic = *(const PINT_CONTEXT *)param;
_ctx->pic = RestoreInterpretContext(_ctx->pic);
- AttachInterpret(_ctx->pic, g_scheduler->getCurrentProcess());
+ AttachInterpret(_ctx->pic, CoroScheduler.getCurrentProcess());
CORO_INVOKE_1(Interpret, _ctx->pic);
@@ -577,7 +110,7 @@ void RestoreSceneProcess(INT_CONTEXT *pic) {
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,
+ CoroScheduler.createProcess(PID_PROCESS + i, RestoredProcessProcess,
&pic, sizeof(pic));
break;
}
@@ -596,7 +129,7 @@ void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait
CORO_BEGIN_CONTEXT;
PROCESS_STRUC *pStruc;
- PPROCESS pProc;
+ Common::PPROCESS pProc;
PINT_CONTEXT pic;
CORO_END_CONTEXT(_ctx);
@@ -617,7 +150,7 @@ void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait
if (_ctx->pic == NULL)
return;
- _ctx->pProc = g_scheduler->createProcess(PID_PROCESS + i, ProcessTinselProcess,
+ _ctx->pProc = CoroScheduler.createProcess(PID_PROCESS + i, ProcessTinselProcess,
&_ctx->pic, sizeof(_ctx->pic));
AttachInterpret(_ctx->pic, _ctx->pProc);
break;
@@ -644,7 +177,7 @@ void KillSceneProcess(uint32 procID) {
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);
+ CoroScheduler.killMatchingProcess(PID_PROCESS + i, -1);
break;
}
}
@@ -671,7 +204,7 @@ void RestoreGlobalProcess(INT_CONTEXT *pic) {
for (i = 0; i < g_numGlobalProcess; i++) {
if (g_pGlobalProcess[i].hProcessCode == pic->hCode) {
- g_scheduler->createProcess(PID_GPROCESS + i, RestoredProcessProcess,
+ CoroScheduler.createProcess(PID_GPROCESS + i, RestoredProcessProcess,
&pic, sizeof(pic));
break;
}
@@ -686,7 +219,7 @@ void RestoreGlobalProcess(INT_CONTEXT *pic) {
void KillGlobalProcesses() {
for (uint32 i = 0; i < g_numGlobalProcess; ++i) {
- g_scheduler->killMatchingProcess(PID_GPROCESS + i, -1);
+ CoroScheduler.killMatchingProcess(PID_GPROCESS + i, -1);
}
}
@@ -696,7 +229,7 @@ void KillGlobalProcesses() {
bool GlobalProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, int myEscape) {
CORO_BEGIN_CONTEXT;
PINT_CONTEXT pic;
- PPROCESS pProc;
+ Common::PPROCESS pProc;
CORO_END_CONTEXT(_ctx);
bool result = false;
@@ -720,7 +253,7 @@ bool GlobalProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWai
if (_ctx->pic != NULL) {
- _ctx->pProc = g_scheduler->createProcess(PID_GPROCESS + i, ProcessTinselProcess,
+ _ctx->pProc = CoroScheduler.createProcess(PID_GPROCESS + i, ProcessTinselProcess,
&_ctx->pic, sizeof(_ctx->pic));
AttachInterpret(_ctx->pic, _ctx->pProc);
}
@@ -745,7 +278,7 @@ void xKillGlobalProcess(uint32 procID) {
for (i = 0; i < g_numGlobalProcess; ++i) {
if (g_pGlobalProcess[i].processId == procID) {
- g_scheduler->killMatchingProcess(PID_GPROCESS + i, -1);
+ CoroScheduler.killMatchingProcess(PID_GPROCESS + i, -1);
break;
}
}
diff --git a/engines/tinsel/sched.h b/engines/tinsel/sched.h
index a1eafcdc47..3e791cecd8 100644
--- a/engines/tinsel/sched.h
+++ b/engines/tinsel/sched.h
@@ -24,105 +24,16 @@
#ifndef TINSEL_SCHED_H // prevent multiple includes
#define TINSEL_SCHED_H
+#include "common/coroutines.h"
#include "tinsel/dw.h" // new data types
-#include "tinsel/coroutine.h"
#include "tinsel/events.h"
+#include "tinsel/pcode.h"
#include "tinsel/tinsel.h"
namespace Tinsel {
-// the size of process specific info
-#define PARAM_SIZE 32
-
-// the maximum number of processes
-#define NUM_PROCESS (TinselV2 ? 70 : 64)
-#define MAX_PROCESSES 70
-
-typedef void (*CORO_ADDR)(CoroContext &, const void *);
-
-/** process structure */
-struct PROCESS {
- PROCESS *pNext; ///< pointer to next process in active or free list
- PROCESS *pPrevious; ///< pointer to previous process in active or free list
-
- CoroContext state; ///< the state of the coroutine
- CORO_ADDR coroAddr; ///< the entry point of the coroutine
-
- int sleepTime; ///< number of scheduler cycles to sleep
- int pid; ///< process ID
- char param[PARAM_SIZE]; ///< process specific info
-};
-typedef PROCESS *PPROCESS;
-
struct INT_CONTEXT;
-/**
- * Create and manage "processes" (really coroutines).
- */
-class Scheduler {
-public:
- /** Pointer to a function of the form "void function(PPROCESS)" */
- typedef void (*VFPTRPP)(PROCESS *);
-
-private:
-
- /** list of all processes */
- PROCESS *processList;
-
- /** active process list - also saves scheduler state */
- PROCESS *active;
-
- /** pointer to free process list */
- PROCESS *pFreeProcesses;
-
- /** the currently active process */
- PROCESS *pCurrent;
-
-#ifdef DEBUG
- // diagnostic process counters
- int numProcs;
- int maxProcs;
-
- void CheckStack();
-#endif
-
- /**
- * Called from killProcess() to enable other resources
- * a process may be allocated to be released.
- */
- VFPTRPP pRCfunction;
-
-
-public:
-
- Scheduler();
- ~Scheduler();
-
- void reset();
-
- #ifdef DEBUG
- void printStats();
- #endif
-
- void schedule();
- void rescheduleAll();
- void reschedule(PPROCESS pReSchedProc = NULL);
- void giveWay(PPROCESS pReSchedProc = NULL);
-
- PROCESS *createProcess(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam);
- void killProcess(PROCESS *pKillProc);
-
- PROCESS *getCurrentProcess();
- int getCurrentPID() const;
- int killMatchingProcess(int pidKill, int pidMask = -1);
-
-
- void setResourceCallback(VFPTRPP pFunc);
-
-};
-
-extern Scheduler *g_scheduler; // FIXME: Temporary global var, to be used until everything has been OOifyied
-
//----------------- FUNCTION PROTOTYPES --------------------
void SceneProcesses(uint32 numProcess, SCNHANDLE hProcess);
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index f575b03270..e052302cfd 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -75,7 +75,7 @@ SoundManager::~SoundManager() {
// playSample for DiscWorld 1
bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::SoundHandle *handle) {
// Floppy version has no sample file
- if (_vm->getFeatures() & GF_FLOPPY)
+ if (!_vm->isCD())
return false;
// no sample driver?
@@ -182,7 +182,7 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p
Audio::Mixer::SoundType type, Audio::SoundHandle *handle) {
// Floppy version has no sample file
- if (_vm->getFeatures() & GF_FLOPPY)
+ if (!_vm->isCD())
return false;
// no sample driver?
@@ -471,7 +471,7 @@ void SoundManager::setSFXVolumes(uint8 volume) {
*/
void SoundManager::openSampleFiles() {
// Floppy and demo versions have no sample files, except for the Discworld 2 demo
- if (_vm->getFeatures() & GF_FLOPPY || (IsDemo && !TinselV2))
+ if (!_vm->isCD() || TinselV0)
return;
TinselFile f;
diff --git a/engines/tinsel/text.h b/engines/tinsel/text.h
index 4c80300c46..97e82c7a93 100644
--- a/engines/tinsel/text.h
+++ b/engines/tinsel/text.h
@@ -24,7 +24,7 @@
#ifndef TINSEL_TEXT_H // prevent multiple includes
#define TINSEL_TEXT_H
-#include "tinsel/coroutine.h"
+#include "common/coroutines.h"
#include "tinsel/object.h" // object manager defines
namespace Tinsel {
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index c652abca25..058f8eb6fd 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -28,11 +28,11 @@
#define BODGE
+#include "common/coroutines.h"
#include "tinsel/actors.h"
#include "tinsel/background.h"
#include "tinsel/bmv.h"
#include "tinsel/config.h"
-#include "tinsel/coroutine.h"
#include "tinsel/cursor.h"
#include "tinsel/drives.h"
#include "tinsel/dw.h"
@@ -1468,7 +1468,7 @@ void NewScene(CORO_PARAM, SCNHANDLE scene, int entrance, int transition) {
++g_sceneCtr;
// Prevent code subsequent to this call running before scene changes
- if (g_scheduler->getCurrentPID() != PID_MASTER_SCR)
+ if (CoroScheduler.getCurrentPID() != PID_MASTER_SCR)
CORO_KILL_SELF();
CORO_END_CODE;
}
@@ -1625,10 +1625,6 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, bool bComplete, int
* Play a midi file.
*/
static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) {
- // FIXME: This is a workaround for the FIXME below
- if (GetMidiVolume() == 0 || TinselV1PSX)
- return;
-
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1637,18 +1633,13 @@ static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) {
PlayMidiSequence(hMidi, loop == MIDI_LOOP);
- // FIXME: The following check messes up the script arguments when
- // entering the secret door in the bookshelf in the library,
- // leading to a crash, when the music volume is set to 0 (MidiPlaying()
- // always false then).
- //
- // Why exactly this happens is unclear. An analysis of the involved
- // script(s) might reveal more.
- //
- // Note: This check&sleep was added in DW v2. It was most likely added
- // to ensure that the MIDI song started playing before the next opcode
+ // This check&sleep was added in DW v2. It was most likely added to
+ // ensure that the MIDI song started playing before the next opcode
// is executed.
- if (!MidiPlaying())
+ // In DW1, it messes up the script arguments when entering the secret
+ // door in the bookshelf in the library, leading to a crash, when the
+ // music volume is set to 0.
+ if (!MidiPlaying() && TinselV2)
CORO_SLEEP(1);
if (complete) {
@@ -2594,7 +2585,7 @@ static void Scroll(CORO_PARAM, EXTREME extreme, int xp, int yp, int xIter, int y
sm.y = _ctx->y;
sm.thisScroll = g_scrollNumber;
sm.myEscape = myEscape;
- g_scheduler->createProcess(PID_TCODE, ScrollMonitorProcess, &sm, sizeof(sm));
+ CoroScheduler.createProcess(PID_TCODE, ScrollMonitorProcess, &sm, sizeof(sm));
}
}
CORO_END_CODE;
@@ -2975,12 +2966,12 @@ static void StandTag(int actor, HPOLYGON hp) {
&& hFilm != TF_LEFT && hFilm != TF_RIGHT)
hFilm = 0;
- Stand(nullContext, actor, pnodex, pnodey, hFilm);
+ Stand(Common::nullContext, actor, pnodex, pnodey, hFilm);
} else if (hFilm && (actor == LEAD_ACTOR || actor == GetLeadId()))
- Stand(nullContext, actor, pnodex, pnodey, hFilm);
+ Stand(Common::nullContext, actor, pnodex, pnodey, hFilm);
else
- Stand(nullContext, actor, pnodex, pnodey, 0);
+ Stand(Common::nullContext, actor, pnodex, pnodey, 0);
}
@@ -3412,7 +3403,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
// Kick off the sample now (perhaps with a delay)
if (g_bNoPause)
g_bNoPause = false;
- else if (!IsDemo)
+ else if (!TinselV2Demo)
CORO_SLEEP(SysVar(SV_SPEECHDELAY));
//SamplePlay(VOICE, hText, _ctx->sub, false, -1, -1, PRIORITY_TALK);
@@ -4244,7 +4235,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
int libCode;
if (TinselV0) libCode = DW1DEMO_CODES[operand];
else if (!TinselV2) libCode = DW1_CODES[operand];
- else if (_vm->getFeatures() & GF_DEMO) libCode = DW2DEMO_CODES[operand];
+ else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand];
else libCode = DW2_CODES[operand];
debug(7, "CallLibraryRoutine op %d (escOn %d, myEscape %d)", operand, pic->escOn, pic->myEscape);
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 65900cc7f3..e09e2c1dcf 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -109,8 +109,8 @@ static Scene g_NextScene = { 0, 0, 0 };
static Scene g_HookScene = { 0, 0, 0 };
static Scene g_DelayedScene = { 0, 0, 0 };
-static PROCESS *g_pMouseProcess = 0;
-static PROCESS *g_pKeyboardProcess = 0;
+static Common::PROCESS *g_pMouseProcess = 0;
+static Common::PROCESS *g_pKeyboardProcess = 0;
static SCNHANDLE g_hCdChangeScene;
@@ -324,7 +324,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
if (TinselV2) {
// Kill off the button process and fire off the action command
- g_scheduler->killMatchingProcess(PID_BTN_CLICK, -1);
+ CoroScheduler.killMatchingProcess(PID_BTN_CLICK, -1);
PlayerEvent(PLR_ACTION, _ctx->clickPos);
} else {
// signal left drag start
@@ -368,7 +368,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
// will activate a single button click
if (TinselV2 && ControlIsOn()) {
_ctx->clickPos = mousePos;
- g_scheduler->createProcess(PID_BTN_CLICK, SingleLeftProcess, &_ctx->clickPos, sizeof(Common::Point));
+ CoroScheduler.createProcess(PID_BTN_CLICK, SingleLeftProcess, &_ctx->clickPos, sizeof(Common::Point));
}
} else
_ctx->lastLeftClick -= _vm->_config->_dclickSpeed;
@@ -616,11 +616,11 @@ static void RestoredProcess(CORO_PARAM, const void *param) {
}
void RestoreProcess(INT_CONTEXT *pic) {
- g_scheduler->createProcess(PID_TCODE, RestoredProcess, &pic, sizeof(pic));
+ CoroScheduler.createProcess(PID_TCODE, RestoredProcess, &pic, sizeof(pic));
}
void RestoreMasterProcess(INT_CONTEXT *pic) {
- g_scheduler->createProcess(PID_MASTER_SCR, RestoredProcess, &pic, sizeof(pic));
+ CoroScheduler.createProcess(PID_MASTER_SCR, RestoredProcess, &pic, sizeof(pic));
}
// FIXME: CountOut is used by ChangeScene
@@ -878,7 +878,6 @@ TinselEngine::~TinselEngine() {
FreeObjectList();
FreeGlobalProcesses();
FreeGlobals();
- delete _scheduler;
delete _config;
@@ -905,7 +904,7 @@ Common::Error TinselEngine::run() {
_console = new Console();
- _scheduler = new Scheduler();
+ CoroScheduler.reset();
InitSysVars();
@@ -1022,7 +1021,7 @@ void TinselEngine::NextGameCycle() {
ResetEcount();
// schedule process
- _scheduler->schedule();
+ CoroScheduler.schedule();
if (_bmv->MoviePlaying())
_bmv->CopyMovieToScreen();
@@ -1078,11 +1077,11 @@ bool TinselEngine::pollEvent() {
*/
void TinselEngine::CreateConstProcesses() {
// Process to run the master script
- _scheduler->createProcess(PID_MASTER_SCR, MasterScriptProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_MASTER_SCR, MasterScriptProcess, NULL, 0);
// Processes to run the cursor and inventory,
- _scheduler->createProcess(PID_CURSOR, CursorProcess, NULL, 0);
- _scheduler->createProcess(PID_INVENTORY, InventoryProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_CURSOR, CursorProcess, NULL, 0);
+ CoroScheduler.createProcess(PID_INVENTORY, InventoryProcess, NULL, 0);
}
/**
@@ -1132,11 +1131,11 @@ void TinselEngine::RestartDrivers() {
KillAllObjects();
// init the process scheduler
- _scheduler->reset();
+ CoroScheduler.reset();
// init the event handlers
- g_pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0);
- g_pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);
+ g_pMouseProcess = CoroScheduler.createProcess(PID_MOUSE, MouseProcess, NULL, 0);
+ g_pKeyboardProcess = CoroScheduler.createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);
// open MIDI files
OpenMidiFiles();
@@ -1164,8 +1163,8 @@ void TinselEngine::ChopDrivers() {
DeleteMidiBuffer();
// remove event drivers
- _scheduler->killProcess(g_pMouseProcess);
- _scheduler->killProcess(g_pKeyboardProcess);
+ CoroScheduler.killProcess(g_pMouseProcess);
+ CoroScheduler.killProcess(g_pKeyboardProcess);
}
/**
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 59344c44f4..123249125e 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -53,7 +53,6 @@ class Config;
class MidiDriver;
class MidiMusicPlayer;
class PCMMusicPlayer;
-class Scheduler;
class SoundManager;
typedef Common::List<Common::Rect> RectList;
@@ -64,21 +63,16 @@ enum TinselGameID {
};
enum TinselGameFeatures {
- GF_DEMO = 1 << 0,
- GF_CD = 1 << 1,
- GF_FLOPPY = 1 << 2,
- GF_SCNFILES = 1 << 3,
- GF_ENHANCED_AUDIO_SUPPORT = 1 << 4,
- GF_ALT_MIDI = 1 << 5, // Alternate sequence in midi.dat file
+ GF_SCNFILES = 1 << 0,
+ GF_ENHANCED_AUDIO_SUPPORT = 1 << 1,
+ GF_ALT_MIDI = 1 << 2, // Alternate sequence in midi.dat file
// The GF_USE_?FLAGS values specify how many country flags are displayed
// in the subtitles options dialog.
// None of these defined -> 1 language, in ENGLISH.TXT
- GF_USE_3FLAGS = 1 << 6, // French, German, Spanish
- GF_USE_4FLAGS = 1 << 7, // French, German, Spanish, Italian
- GF_USE_5FLAGS = 1 << 8, // All 5 flags
-
- GF_BIG_ENDIAN = 1 << 9
+ GF_USE_3FLAGS = 1 << 3, // French, German, Spanish
+ GF_USE_4FLAGS = 1 << 4, // French, German, Spanish, Italian
+ GF_USE_5FLAGS = 1 << 5 // All 5 flags
};
/**
@@ -135,13 +129,12 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
#define TinselV0 (TinselVersion == TINSEL_V0)
#define TinselV1 (TinselVersion == TINSEL_V1)
#define TinselV2 (TinselVersion == TINSEL_V2)
+#define TinselV2Demo (TinselVersion == TINSEL_V2 && _vm->getIsADGFDemo())
#define TinselV1PSX (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformPSX)
#define TinselV1Mac (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformMacintosh)
-#define IsDemo (_vm->getFeatures() & GF_DEMO)
-
-#define READ_16(v) ((_vm->getFeatures() & GF_BIG_ENDIAN) ? READ_BE_UINT16(v) : READ_LE_UINT16(v))
-#define READ_32(v) ((_vm->getFeatures() & GF_BIG_ENDIAN) ? READ_BE_UINT32(v) : READ_LE_UINT32(v))
+#define READ_16(v) (TinselV1Mac ? READ_BE_UINT16(v) : READ_LE_UINT16(v))
+#define READ_32(v) (TinselV1Mac ? READ_BE_UINT32(v) : READ_LE_UINT32(v))
// Global reference to the TinselEngine object
extern TinselEngine *_vm;
@@ -154,7 +147,6 @@ class TinselEngine : public Engine {
Common::Point _mousePos;
uint8 _dosPlayerDir;
Console *_console;
- Scheduler *_scheduler;
static const char *const _sampleIndices[][3];
static const char *const _sampleFiles[][3];
@@ -188,6 +180,8 @@ public:
uint16 getVersion() const;
uint32 getFlags() const;
Common::Platform getPlatform() const;
+ bool getIsADGFDemo() const;
+ bool isCD() const;
const char *getSampleIndex(LANGUAGE lang);
const char *getSampleFile(LANGUAGE lang);
diff --git a/engines/tinsel/token.cpp b/engines/tinsel/token.cpp
index c26fa40466..080c005c3c 100644
--- a/engines/tinsel/token.cpp
+++ b/engines/tinsel/token.cpp
@@ -31,7 +31,7 @@ namespace Tinsel {
//----------------- LOCAL GLOBAL DATA --------------------
struct Token {
- PROCESS *proc;
+ Common::PROCESS *proc;
};
static Token g_tokens[NUMTOKENS]; // FIXME: Avoid non-const global vars
@@ -40,7 +40,7 @@ static Token g_tokens[NUMTOKENS]; // FIXME: Avoid non-const global vars
/**
* Release all tokens held by this process, and kill the process.
*/
-static void TerminateProcess(PROCESS *tProc) {
+static void TerminateProcess(Common::PROCESS *tProc) {
// Release tokens held by the process
for (int i = 0; i < NUMTOKENS; i++) {
@@ -50,7 +50,7 @@ static void TerminateProcess(PROCESS *tProc) {
}
// Kill the process
- g_scheduler->killProcess(tProc);
+ CoroScheduler.killProcess(tProc);
}
/**
@@ -60,7 +60,7 @@ void GetControlToken() {
const int which = TOKEN_CONTROL;
if (g_tokens[which].proc == NULL) {
- g_tokens[which].proc = g_scheduler->getCurrentProcess();
+ g_tokens[which].proc = CoroScheduler.getCurrentProcess();
}
}
@@ -85,11 +85,11 @@ void GetToken(int which) {
assert(TOKEN_LEAD <= which && which < NUMTOKENS);
if (g_tokens[which].proc != NULL) {
- assert(g_tokens[which].proc != g_scheduler->getCurrentProcess());
+ assert(g_tokens[which].proc != CoroScheduler.getCurrentProcess());
TerminateProcess(g_tokens[which].proc);
}
- g_tokens[which].proc = g_scheduler->getCurrentProcess();
+ g_tokens[which].proc = CoroScheduler.getCurrentProcess();
}
/**
@@ -99,7 +99,7 @@ void GetToken(int which) {
void FreeToken(int which) {
assert(TOKEN_LEAD <= which && which < NUMTOKENS);
- assert(g_tokens[which].proc == g_scheduler->getCurrentProcess()); // we'd have been killed if some other proc had taken this token
+ assert(g_tokens[which].proc == CoroScheduler.getCurrentProcess()); // we'd have been killed if some other proc had taken this token
g_tokens[which].proc = NULL;
}
diff --git a/engines/toltecs/animation.cpp b/engines/toltecs/animation.cpp
index eef9cef9ed..084332cf83 100644
--- a/engines/toltecs/animation.cpp
+++ b/engines/toltecs/animation.cpp
@@ -53,7 +53,7 @@ void AnimationPlayer::start(uint resIndex) {
_vm->_arc->closeResource();
debug(1, "AnimationPlayer::start() width = %d; height = %d; frameCount = %d", _width, _height, _frameCount);
-
+
_vm->_sceneWidth = _width;
_vm->_sceneHeight = _height;
@@ -63,7 +63,7 @@ void AnimationPlayer::start(uint resIndex) {
_frameNumber = 0;
// TODO mov screenFlag01, 0FFFFh
// TODO mov animDrawFrameFlag, 0FFFFh
-
+
_firstNextFrameOffset = _nextFrameOffset;
_firstCurFrameSize = _curFrameSize;
_firstNextFrameSize = _nextFrameSize;
@@ -81,25 +81,25 @@ void AnimationPlayer::nextFrame() {
} else {
_frameNumber++;
}
-
+
debug(1, "AnimationPlayer::nextFrame() frameNumber = %d", _frameNumber);
if (_keepFrameCounter > 0) {
_keepFrameCounter--;
return;
}
-
+
_vm->_arc->openResource(_resIndex);
_vm->_arc->seek(_nextFrameOffset, SEEK_CUR);
_curFrameSize = _nextFrameSize;
-
+
if (_curFrameSize == 0)
_curFrameSize = 1;
-
+
_vm->_arc->read(_animBuffer, _curFrameSize);
_nextFrameSize = _vm->_arc->readUint32LE();
_nextFrameOffset += _curFrameSize + 4;
-
+
if (_curFrameSize > 1) {
unpackFrame();
// TODO mov animDrawFrameFlag, 0FFFFh
diff --git a/engines/toltecs/animation.h b/engines/toltecs/animation.h
index 22576d7535..54ec5d8afa 100644
--- a/engines/toltecs/animation.h
+++ b/engines/toltecs/animation.h
@@ -54,7 +54,7 @@ public:
uint16 _width, _height;
uint16 _frameNumber, _frameCount;
uint32 _keepFrameCounter;
-
+
uint32 _curFrameSize;
uint32 _nextFrameSize, _nextFrameOffset;
diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp
index c532bbbf09..c1a57638c2 100644
--- a/engines/toltecs/detection.cpp
+++ b/engines/toltecs/detection.cpp
@@ -273,8 +273,6 @@ SaveStateDescriptor ToltecsMetaEngine::querySaveMetaInfos(const char *target, in
if (error == Toltecs::ToltecsEngine::kRSHENoError) {
SaveStateDescriptor desc(slot, header.description);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
desc.setThumbnail(header.thumbnail);
if (header.version > 0) {
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
index 172ec0a565..6e23ff988f 100644
--- a/engines/toltecs/menu.cpp
+++ b/engines/toltecs/menu.cpp
@@ -21,8 +21,11 @@
*
*/
+#include "audio/mixer.h"
#include "common/savefile.h"
+#include "common/config-manager.h"
+
#include "toltecs/toltecs.h"
#include "toltecs/menu.h"
#include "toltecs/palette.h"
@@ -37,7 +40,7 @@ MenuSystem::MenuSystem(ToltecsEngine *vm) : _vm(vm) {
MenuSystem::~MenuSystem() {
}
-int MenuSystem::run() {
+int MenuSystem::run(MenuID menuId) {
//debug("MenuSystem::run()");
@@ -50,18 +53,13 @@ int MenuSystem::run() {
memcpy(backgroundOrig.getBasePtr(0,0), _vm->_screen->_frontScreen, 640 * 400);
_currMenuID = kMenuIdNone;
- _newMenuID = kMenuIdMain;
+ _newMenuID = menuId;
_currItemID = kItemIdNone;
_editingDescription = false;
- _cfgText = true;
- _cfgVoices = true;
- _cfgMasterVolume = 10;
- _cfgVoicesVolume = 10;
- _cfgMusicVolume = 10;
- _cfgSoundFXVolume = 10;
- _cfgBackgroundVolume = 10;
- _running = true;
+
+ _running = true;
_top = 30 - _vm->_guiHeight / 2;
+
_needRedraw = false;
// TODO: buildColorTransTable2
@@ -78,10 +76,10 @@ int MenuSystem::run() {
update();
_vm->_system->updateScreen();
}
-
+
// Restore original background
memcpy(_vm->_screen->_frontScreen, backgroundOrig.getBasePtr(0,0), 640 * 400);
- _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
+ _vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
_vm->_system->updateScreen();
// Cleanup
@@ -89,7 +87,7 @@ int MenuSystem::run() {
_background->free();
delete _background;
- return 0;
+ return 0;
}
void MenuSystem::update() {
@@ -103,8 +101,8 @@ void MenuSystem::update() {
handleEvents();
if (_needRedraw) {
- //_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
- _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
+ //_vm->_system->copyRectToScreen(_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
+ _vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, _top, 640, 400 - _top);
//debug("redraw");
_needRedraw = false;
}
@@ -204,7 +202,7 @@ void MenuSystem::handleKeyDown(const Common::KeyState& kbd) {
ItemID MenuSystem::findItemAt(int x, int y) {
for (Common::Array<Item>::iterator iter = _items.begin(); iter != _items.end(); iter++) {
- if ((*iter).rect.contains(x, y))
+ if ((*iter).rect.contains(x, y - _top))
return (*iter).id;
}
return kItemIdNone;
@@ -241,8 +239,8 @@ void MenuSystem::initMenu(MenuID menuID) {
drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrWhatCanIDoForYou));
addClickTextItem(kItemIdLoad, 0, 115, 320, 0, _vm->getSysString(kStrLoad), 229, 255);
addClickTextItem(kItemIdSave, 0, 135, 320, 0, _vm->getSysString(kStrSave), 229, 255);
- addClickTextItem(kItemIdToggleText, 0, 165, 320, 0, _vm->getSysString(kStrTextOn), 229, 255);
- addClickTextItem(kItemIdToggleVoices, 0, 185, 320, 0, _vm->getSysString(kStrVoicesOn), 229, 255);
+ addClickTextItem(kItemIdToggleText, 0, 165, 320, 0, _vm->getSysString(_vm->_cfgText ? kStrTextOn : kStrTextOff), 229, 255);
+ addClickTextItem(kItemIdToggleVoices, 0, 185, 320, 0, _vm->getSysString(_vm->_cfgVoices ? kStrVoicesOn : kStrVoicesOff), 229, 255);
addClickTextItem(kItemIdVolumesMenu, 0, 215, 320, 0, _vm->getSysString(kStrVolume), 229, 255);
addClickTextItem(kItemIdPlay, 0, 245, 320, 0, _vm->getSysString(kStrPlay), 229, 255);
addClickTextItem(kItemIdQuit, 0, 275, 320, 0, _vm->getSysString(kStrQuit), 229, 255);
@@ -326,13 +324,13 @@ void MenuSystem::clickItem(ItemID id) {
_newMenuID = kMenuIdLoad;
break;
case kItemIdToggleText:
- setCfgText(!_cfgText, true);
- if (!_cfgVoices && !_cfgText)
+ setCfgText(!_vm->_cfgText, true);
+ if (!_vm->_cfgVoices && !_vm->_cfgText)
setCfgVoices(true, false);
break;
case kItemIdToggleVoices:
- setCfgVoices(!_cfgVoices, true);
- if (!_cfgVoices && !_cfgText)
+ setCfgVoices(!_vm->_cfgVoices, true);
+ if (!_vm->_cfgVoices && !_vm->_cfgText)
setCfgText(true, false);
break;
case kItemIdVolumesMenu:
@@ -416,7 +414,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 *)_vm->_screen->_frontScreen + x + y * 640;
for (int xc = 0; xc < w; xc++) {
src[xc] = color2;
src[xc + h * 640] = color1;
@@ -518,49 +516,51 @@ void MenuSystem::clickSavegameItem(ItemID id) {
}
void MenuSystem::setCfgText(bool value, bool active) {
- if (_cfgText != value) {
+ if (_vm->_cfgText != value) {
Item *item = getItem(kItemIdToggleText);
- _cfgText = value;
+ _vm->_cfgText = value;
restoreRect(item->rect.left, item->rect.top, item->rect.width() + 1, item->rect.height() - 2);
- setItemCaption(item, _vm->getSysString(_cfgText ? kStrTextOn : kStrTextOff));
+ setItemCaption(item, _vm->getSysString(_vm->_cfgText ? kStrTextOn : kStrTextOff));
drawItem(kItemIdToggleText, true);
+ ConfMan.setBool("subtitles", value);
}
}
void MenuSystem::setCfgVoices(bool value, bool active) {
- if (_cfgVoices != value) {
+ if (_vm->_cfgVoices != value) {
Item *item = getItem(kItemIdToggleVoices);
- _cfgVoices = value;
+ _vm->_cfgVoices = value;
restoreRect(item->rect.left, item->rect.top, item->rect.width() + 1, item->rect.height() - 2);
- setItemCaption(item, _vm->getSysString(_cfgVoices ? kStrVoicesOn : kStrVoicesOff));
+ setItemCaption(item, _vm->getSysString(_vm->_cfgVoices ? kStrVoicesOn : kStrVoicesOff));
drawItem(kItemIdToggleVoices, true);
+ ConfMan.setBool("speech_mute", !value);
}
}
void MenuSystem::drawVolumeBar(ItemID itemID) {
int w = 440, y, volume;
char text[21];
-
+
switch (itemID) {
- case kItemIdMaster:
+ case kItemIdMaster: // unused in ScummVM, always 20
y = 130 + 25 * 0;
- volume = _cfgMasterVolume;
+ volume = 20;
break;
case kItemIdVoices:
y = 130 + 25 * 1;
- volume = _cfgVoicesVolume;
+ volume = _vm->_cfgVoicesVolume;
break;
case kItemIdMusic:
y = 130 + 25 * 2;
- volume = _cfgMusicVolume;
+ volume = _vm->_cfgMusicVolume;
break;
case kItemIdSoundFX:
y = 130 + 25 * 3;
- volume = _cfgSoundFXVolume;
+ volume = _vm->_cfgSoundFXVolume;
break;
- case kItemIdBackground:
+ case kItemIdBackground: // unused in ScummVM, always 20
y = 130 + 25 * 4;
- volume = _cfgBackgroundVolume;
+ volume = 20;
break;
default:
return;
@@ -568,46 +568,48 @@ void MenuSystem::drawVolumeBar(ItemID itemID) {
Font font(_vm->_res->load(_vm->_screen->getFontResIndex(1))->data);
restoreRect(390, y - font.getHeight(), 100, 25);
-
+
for (int i = 0; i < volume; i++)
text[i] = '|';
text[volume] = 0;
-
+
drawString(0, y, w, 0, 246, text);
-
+
}
void MenuSystem::changeVolumeBar(ItemID itemID, int delta) {
-
- int *volume, newVolume;
+ byte newVolume;
switch (itemID) {
- case kItemIdMaster:
- volume = &_cfgMasterVolume;
- break;
case kItemIdVoices:
- volume = &_cfgVoicesVolume;
+ _vm->_cfgVoicesVolume = CLIP(_vm->_cfgVoicesVolume + delta, 0, 20);
+ // Always round volume up instead of down.
+ newVolume = (_vm->_cfgVoicesVolume * Audio::Mixer::kMaxChannelVolume + 19) / 20;
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, newVolume);
+ ConfMan.setInt("speech_volume", newVolume);
break;
case kItemIdMusic:
- volume = &_cfgMusicVolume;
+ _vm->_cfgMusicVolume = CLIP(_vm->_cfgMusicVolume + delta, 0, 20);
+ newVolume = (_vm->_cfgMusicVolume * Audio::Mixer::kMaxChannelVolume + 19) / 20;
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, newVolume);
+ ConfMan.setInt("music_volume", newVolume);
break;
case kItemIdSoundFX:
- volume = &_cfgSoundFXVolume;
+ _vm->_cfgSoundFXVolume = CLIP(_vm->_cfgSoundFXVolume + delta, 0, 20);
+ newVolume = (_vm->_cfgSoundFXVolume * Audio::Mixer::kMaxChannelVolume + 19) / 20;
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, newVolume);
+ ConfMan.setInt("sfx_volume", newVolume);
break;
+ case kItemIdMaster:
case kItemIdBackground:
- volume = &_cfgBackgroundVolume;
+ // unused in ScummVM
break;
default:
return;
}
- newVolume = CLIP(*volume + delta, 0, 20);
-
- if (newVolume != *volume) {
- *volume = newVolume;
- drawVolumeBar(itemID);
- }
-
+ _vm->syncSoundSettings();
+ drawVolumeBar(itemID);
}
} // End of namespace Toltecs
diff --git a/engines/toltecs/menu.h b/engines/toltecs/menu.h
index 3e2c2da8d9..a72205c2e5 100644
--- a/engines/toltecs/menu.h
+++ b/engines/toltecs/menu.h
@@ -29,14 +29,6 @@
namespace Toltecs {
-enum MenuID {
- kMenuIdNone,
- kMenuIdMain,
- kMenuIdSave,
- kMenuIdLoad,
- kMenuIdVolumes
-};
-
enum ItemID {
kItemIdNone,
// Main menu
@@ -85,10 +77,10 @@ public:
MenuSystem(ToltecsEngine *vm);
~MenuSystem();
- int run();
+ int run(MenuID menuId);
void update();
void handleEvents();
-
+
protected:
struct Item {
@@ -99,7 +91,7 @@ protected:
int x, y, w;
uint fontNum;
};
-
+
struct SavegameItem {
int _slotNum;
Common::String _description;
@@ -124,9 +116,6 @@ protected:
Common::Array<Item> _items;
Common::Array<SavegameItem> _savegames;
-
- bool _cfgText, _cfgVoices;
- int _cfgMasterVolume, _cfgVoicesVolume, _cfgMusicVolume, _cfgSoundFXVolume, _cfgBackgroundVolume;
void addClickTextItem(ItemID id, int x, int y, int w, uint fontNum, const char *caption, byte defaultColor, byte activeColor);
@@ -134,13 +123,13 @@ protected:
void handleMouseMove(int x, int y);
void handleMouseClick(int x, int y);
void handleKeyDown(const Common::KeyState& kbd);
-
+
ItemID findItemAt(int x, int y);
Item *getItem(ItemID id);
void setItemCaption(Item *item, const char *caption);
void initMenu(MenuID menuID);
-
+
void enterItem(ItemID id);
void leaveItem(ItemID id);
void clickItem(ItemID id);
diff --git a/engines/toltecs/microtiles.cpp b/engines/toltecs/microtiles.cpp
index 0b61ac38a5..60e65bdaf3 100644
--- a/engines/toltecs/microtiles.cpp
+++ b/engines/toltecs/microtiles.cpp
@@ -138,7 +138,7 @@ Common::Rect * MicroTileArray::getRectangles(int *num_rects, int min_x, int min_
x0 = CLIP (x0, min_x, max_x);
y0 = CLIP (y0, min_y, max_y);
y1 = CLIP (y1, min_y, max_y);
-
+
// FIXME: Why is the following code in an #if block?
#if 1
start = i;
diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp
index 76d42ebf0a..35accb5d93 100644
--- a/engines/toltecs/movie.cpp
+++ b/engines/toltecs/movie.cpp
@@ -61,7 +61,7 @@ void MoviePlayer::playMovie(uint resIndex) {
int16 savedCameraY = _vm->_cameraY;
int16 savedGuiHeight = _vm->_guiHeight;
byte moviePalette[768];
-
+
_vm->_isSaveAllowed = false;
memset(moviePalette, 0, sizeof(moviePalette));
@@ -78,7 +78,7 @@ void MoviePlayer::playMovie(uint resIndex) {
_vm->_arc->readUint32LE();
_vm->_arc->readUint32LE();
_framesPerSoundChunk = _vm->_arc->readUint32LE();
- _vm->_arc->readUint32LE();
+ int rate = _vm->_arc->readUint32LE();
_vm->_sceneWidth = 640;
_vm->_sceneHeight = 400;
@@ -87,7 +87,7 @@ void MoviePlayer::playMovie(uint resIndex) {
_vm->_cameraY = 0;
_vm->_guiHeight = 0;
- _audioStream = Audio::makeQueuingAudioStream(22050, false);
+ _audioStream = Audio::makeQueuingAudioStream(rate, false);
_vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _audioStream);
@@ -96,49 +96,52 @@ void MoviePlayer::playMovie(uint resIndex) {
fetchAudioChunks();
- uint32 lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
+ byte *chunkBuffer = NULL;
+ uint32 chunkBufferSize = 0;
+ uint32 frame = 0;
while (_chunkCount--) {
-
byte chunkType = _vm->_arc->readByte();
uint32 chunkSize = _vm->_arc->readUint32LE();
- byte *chunkBuffer = NULL;
- uint32 movieOffset;
debug(0, "chunkType = %d; chunkSize = %d", chunkType, chunkSize);
-
+
// Skip audio chunks - we've already queued them in
// fetchAudioChunks() above
if (chunkType == kChunkAudio) {
_vm->_arc->skip(chunkSize);
} else {
- chunkBuffer = new byte[chunkSize];
+ // Only reallocate the chunk buffer if the new chunk is bigger
+ if (chunkSize > chunkBufferSize) {
+ delete[] chunkBuffer;
+ chunkBuffer = new byte[chunkSize];
+ chunkBufferSize = chunkSize;
+ }
+
_vm->_arc->read(chunkBuffer, chunkSize);
}
- movieOffset = _vm->_arc->pos();
-
switch (chunkType) {
case kChunkFirstImage:
case kChunkSubsequentImages:
unpackRle(chunkBuffer, _vm->_screen->_backScreen);
- // TODO: Rework this
- _vm->_screen->updateShakeScreen();
_vm->_screen->_fullRefresh = true;
- _vm->updateInput();
- _vm->drawScreen();
_soundChunkFramesLeft--;
if (_soundChunkFramesLeft <= _framesPerSoundChunk) {
fetchAudioChunks();
}
- while (_vm->_mixer->getSoundElapsedTime(_audioStreamHandle) < lastTime + 111) {
- g_system->delayMillis(10);
+ while (_vm->_mixer->getSoundElapsedTime(_audioStreamHandle) < (1000 * frame) / 9) {
+ if (_vm->_screen->_shakeActive && _vm->_screen->updateShakeScreen()) {
+ _vm->_screen->_fullRefresh = true;
+ }
+ _vm->updateInput();
+ _vm->drawScreen();
+ // Note: drawScreen() calls delayMillis()
}
- lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
-
+ frame++;
break;
case kChunkPalette:
unpackPalette(chunkBuffer, moviePalette, 256, 3);
@@ -150,10 +153,10 @@ void MoviePlayer::playMovie(uint resIndex) {
// Already processed
break;
case kChunkShowSubtitle:
- // TODO: Check if the text is a subtitle (last character == 0xFE).
- // If so, don't show it if text display is disabled.
- memcpy(_vm->_script->getSlotData(subtitleSlot), chunkBuffer, chunkSize);
- _vm->_screen->updateTalkText(subtitleSlot, 0);
+ if (_vm->_cfgText) {
+ memcpy(_vm->_script->getSlotData(subtitleSlot), chunkBuffer, chunkSize);
+ _vm->_screen->updateTalkText(subtitleSlot, 0);
+ }
break;
case kChunkShakeScreen: // start/stop shakescreen effect
if (chunkBuffer[0] == 0xFF)
@@ -176,20 +179,17 @@ void MoviePlayer::playMovie(uint resIndex) {
error("MoviePlayer::playMovie(%04X) Unknown chunk type %d at %08X", resIndex, chunkType, _vm->_arc->pos() - 5 - chunkSize);
}
- delete[] chunkBuffer;
-
- _vm->_arc->seek(movieOffset, SEEK_SET);
-
if (!handleInput())
break;
-
}
+ delete[] chunkBuffer;
+
_audioStream->finish();
_vm->_mixer->stopHandle(_audioStreamHandle);
_vm->_arc->closeResource();
-
+
debug(0, "playMovie() done");
_vm->_sceneWidth = savedSceneWidth;
diff --git a/engines/toltecs/movie.h b/engines/toltecs/movie.h
index aecfac240f..8fa48975d7 100644
--- a/engines/toltecs/movie.h
+++ b/engines/toltecs/movie.h
@@ -36,7 +36,7 @@ public:
~MoviePlayer();
void playMovie(uint resIndex);
-
+
protected:
ToltecsEngine *_vm;
Audio::QueuingAudioStream *_audioStream;
@@ -47,11 +47,11 @@ protected:
void unpackPalette(byte *source, byte *dest, int elemCount, int elemSize);
void unpackRle(byte *source, byte *dest);
-
+
void fetchAudioChunks();
-
+
bool handleInput();
-
+
};
} // End of namespace Toltecs
diff --git a/engines/toltecs/music.cpp b/engines/toltecs/music.cpp
index c322961077..830e4a97da 100644
--- a/engines/toltecs/music.cpp
+++ b/engines/toltecs/music.cpp
@@ -20,15 +20,13 @@
*
*/
-// FIXME: This code is taken from SAGA and needs more work (e.g. setVolume).
+#include "audio/midiparser.h"
+#include "common/textconsole.h"
#include "toltecs/toltecs.h"
#include "toltecs/music.h"
#include "toltecs/resource.h"
-#include "audio/midiparser.h"
-#include "common/textconsole.h"
-
namespace Toltecs {
MusicPlayer::MusicPlayer(bool isGM) : _isGM(isGM), _buffer(NULL) {
@@ -62,7 +60,7 @@ void MusicPlayer::playMIDI(const byte *data, uint32 size, bool loop) {
memcpy(_buffer, data, size);
MidiParser *parser;
-
+
if (!memcmp(data, "FORM", 4))
parser = MidiParser::createParser_XMIDI(NULL);
else
@@ -77,7 +75,7 @@ void MusicPlayer::playMIDI(const byte *data, uint32 size, bool loop) {
_parser = parser;
- setVolume(127);
+ syncVolume();
_isLooping = loop;
_isPlaying = true;
@@ -86,16 +84,6 @@ void MusicPlayer::playMIDI(const byte *data, uint32 size, bool loop) {
}
}
-void MusicPlayer::pause() {
- setVolume(-1);
- _isPlaying = false;
-}
-
-void MusicPlayer::resume() {
- setVolume(127);
- _isPlaying = true;
-}
-
void MusicPlayer::stopAndClear() {
Common::StackLock lock(_mutex);
stop();
diff --git a/engines/toltecs/music.h b/engines/toltecs/music.h
index 79df1ea2f5..8d364dbb9f 100644
--- a/engines/toltecs/music.h
+++ b/engines/toltecs/music.h
@@ -37,8 +37,6 @@ public:
MusicPlayer(bool isGM = true);
void playMIDI(const byte *data, uint32 size, bool loop = false);
- void pause();
- void resume();
void stopAndClear();
// MidiDriver_BASE interface implementation
diff --git a/engines/toltecs/palette.cpp b/engines/toltecs/palette.cpp
index 706218e0ba..74683c6d7a 100644
--- a/engines/toltecs/palette.cpp
+++ b/engines/toltecs/palette.cpp
@@ -31,7 +31,7 @@ namespace Toltecs {
Palette::Palette(ToltecsEngine *vm) : _vm(vm) {
clearFragments();
-
+
memset(_colorTransTable, 0, sizeof(_colorTransTable));
}
@@ -81,7 +81,7 @@ void Palette::setDeltaPalette(byte *palette, byte mask, int8 deltaValue, int16 c
if (mask & 4) colors[index * 3 + 2] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
index++;
}
-
+
debug(0, "startIndex = %d; colorCount = %d", startIndex, colorCount);
_vm->_system->getPaletteManager()->setPalette((const byte *)colors, 0, 256);
@@ -101,9 +101,9 @@ void Palette::addFragment(uint resIndex, int16 id) {
Resource *fragmentResource = _vm->_res->load(resIndex);
byte count = fragmentResource->size / 3;
-
+
memcpy(&_mainPalette[_fragmentIndex * 3], fragmentResource->data, count * 3);
-
+
PaletteFragment fragment;
fragment.id = id;
fragment.index = _fragmentIndex;
@@ -126,7 +126,7 @@ uint16 Palette::findFragment(int16 id) {
break;
}
}
-
+
debug(0, "Palette::findFragment() result = %04X", result);
return result;
@@ -140,9 +140,9 @@ void Palette::clearFragments() {
void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) {
byte r = 0, g = 0, b = 0;
-
+
mask &= 7;
-
+
for (int i = 0; i < 256; i++) {
if (deltaValue < 0) {
@@ -161,7 +161,7 @@ void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) {
b -= deltaValue;
}
}
-
+
int bestIndex = 0;
uint16 bestMatch = 0xFFFF;
@@ -174,7 +174,7 @@ void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) {
bestIndex = j;
}
}
-
+
_colorTransTable[i] = bestIndex;
}
diff --git a/engines/toltecs/palette.h b/engines/toltecs/palette.h
index 7bcf06e027..570f51777e 100644
--- a/engines/toltecs/palette.h
+++ b/engines/toltecs/palette.h
@@ -66,7 +66,7 @@ protected:
int16 id;
byte index, count;
};
-
+
typedef Common::Array<PaletteFragment> PaletteFragmentArray;
ToltecsEngine *_vm;
diff --git a/engines/toltecs/render.cpp b/engines/toltecs/render.cpp
index de5e77fb50..4c41e6ce00 100644
--- a/engines/toltecs/render.cpp
+++ b/engines/toltecs/render.cpp
@@ -114,7 +114,7 @@ void RenderQueue::addMask(SegmapMaskRect &mask) {
void RenderQueue::update() {
bool doFullRefresh = _vm->_screen->_fullRefresh;
-
+
_updateUta->clear();
if (!doFullRefresh) {
@@ -166,7 +166,7 @@ void RenderQueue::update() {
for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {
const RenderQueueItem *item = &(*iter);
-
+
if (item->flags == kRefresh || doFullRefresh) {
switch (item->type) {
@@ -193,14 +193,14 @@ void RenderQueue::update() {
if (doFullRefresh) {
clear();
- _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, _vm->_cameraHeight);
+ _vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, 0, 640, _vm->_cameraHeight);
} else {
updateDirtyRects();
}
SWAP(_currQueue, _prevQueue);
_currQueue->clear();
-
+
}
void RenderQueue::clear() {
@@ -249,16 +249,16 @@ bool RenderQueue::hasItemChanged(const RenderQueueItem &item1, const RenderQueue
if (item1.type != item2.type)
return true;
-
+
if (item1.rect.left != item2.rect.left ||
item1.rect.top != item2.rect.top ||
item1.rect.right != item2.rect.right ||
item1.rect.bottom != item2.rect.bottom)
return true;
-
+
if (item1.type == kText && item1.text.color != item2.text.color)
return true;
-
+
return false;
}
@@ -268,7 +268,7 @@ void RenderQueue::invalidateItemsByRect(const Common::Rect &rect, const RenderQu
if (item != subItem &&
subItem->flags == kUnchanged &&
rect.intersects(subItem->rect)) {
-
+
subItem->flags = kRefresh;
invalidateItemsByRect(subItem->rect, subItem);
}
@@ -301,7 +301,7 @@ void RenderQueue::updateDirtyRects() {
int n_rects = 0;
Common::Rect *rects = _updateUta->getRectangles(&n_rects, 0, 0, 639, _vm->_cameraHeight - 1);
for (int i = 0; i < n_rects; i++) {
- _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + rects[i].left + rects[i].top * 640,
+ _vm->_system->copyRectToScreen(_vm->_screen->_frontScreen + rects[i].left + rects[i].top * 640,
640, rects[i].left, rects[i].top, rects[i].width(), rects[i].height());
}
delete[] rects;
diff --git a/engines/toltecs/render.h b/engines/toltecs/render.h
index bb9ec29959..59d7a3ddb9 100644
--- a/engines/toltecs/render.h
+++ b/engines/toltecs/render.h
@@ -75,7 +75,7 @@ public:
void addMask(SegmapMaskRect &mask);
void update();
void clear();
-
+
protected:
typedef Common::List<RenderQueueItem> RenderQueueArray;
@@ -87,7 +87,7 @@ protected:
RenderQueueItem *findItemInQueue(RenderQueueArray *queue, const RenderQueueItem &item);
bool hasItemChanged(const RenderQueueItem &item1, const RenderQueueItem &item2);
void invalidateItemsByRect(const Common::Rect &rect, const RenderQueueItem *item);
-
+
void addDirtyRect(const Common::Rect &rect);
void restoreDirtyBackground();
void updateDirtyRects();
diff --git a/engines/toltecs/resource.cpp b/engines/toltecs/resource.cpp
index b95e0444b1..0b9f7c8fcd 100644
--- a/engines/toltecs/resource.cpp
+++ b/engines/toltecs/resource.cpp
@@ -66,7 +66,7 @@ void ArchiveReader::dump(uint resIndex, const char *prefix) {
byte *data = new byte[resourceSize];
Common::String fn;
-
+
if (prefix)
fn = Common::String::format("%s_%04X.0", prefix, resIndex);
else
@@ -117,11 +117,11 @@ Resource *ResourceCache::load(uint resIndex) {
resItem->data = new byte[resItem->size];
_vm->_arc->read(resItem->data, resItem->size);
_vm->_arc->closeResource();
-
+
_cache[resIndex] = resItem;
-
+
return resItem;
-
+
}
}
diff --git a/engines/toltecs/saveload.cpp b/engines/toltecs/saveload.cpp
index c24d2149b0..6c195a34c2 100644
--- a/engines/toltecs/saveload.cpp
+++ b/engines/toltecs/saveload.cpp
@@ -36,12 +36,11 @@
namespace Toltecs {
/* TODO:
- - Save with F7; Load with F9
- Saving during an animation (AnimationPlayer) is not working correctly yet
- Maybe switch to SCUMM/Tinsel serialization approach?
*/
-#define TOLTECS_SAVEGAME_VERSION 3
+#define TOLTECS_SAVEGAME_VERSION 4
ToltecsEngine::kReadSaveHeaderError ToltecsEngine::readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header) {
@@ -93,7 +92,7 @@ void ToltecsEngine::savegame(const char *filename, const char *description) {
byte descriptionLen = strlen(description);
out->writeByte(descriptionLen);
out->write(description, descriptionLen);
-
+
Graphics::saveThumbnail(*out);
// Not used yet, reserved for future usage
@@ -141,8 +140,8 @@ void ToltecsEngine::savegame(const char *filename, const char *description) {
}
void ToltecsEngine::loadgame(const char *filename) {
- Common::InSaveFile *in;
- if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
+ if (!in) {
warning("Can't open file '%s', game not loaded", filename);
return;
}
@@ -150,13 +149,13 @@ void ToltecsEngine::loadgame(const char *filename) {
SaveHeader header;
kReadSaveHeaderError errorCode = readSaveHeader(in, false, header);
-
+
if (errorCode != kRSHENoError) {
warning("Error loading savegame '%s'", filename);
delete in;
return;
}
-
+
_sound->stopAll();
_music->stopSequence();
g_engine->setTotalPlayTime(header.playTime * 1000);
@@ -182,7 +181,7 @@ void ToltecsEngine::loadgame(const char *filename) {
_mouseX = in->readUint16LE();
_mouseY = in->readUint16LE();
_mouseDisabled = in->readUint16LE();
-
+
_system->warpMouse(_mouseX, _mouseY);
_system->showMouse(_mouseDisabled == 0);
@@ -191,7 +190,7 @@ void ToltecsEngine::loadgame(const char *filename) {
_anim->loadState(in);
_screen->loadState(in);
if (header.version >= 2)
- _sound->loadState(in);
+ _sound->loadState(in, header.version);
if (header.version >= 3)
_music->loadState(in);
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index b781490b69..c8d6740b02 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -43,9 +43,11 @@ Screen::Screen(ToltecsEngine *vm) : _vm(vm) {
// Screen shaking
_shakeActive = false;
+ _shakeTime = 0;
_shakeCounterInit = 0;
_shakeCounter = 0;
_shakePos = 0;
+ _shakeTime = 0;
// Verb line
_verbLineNum = 0;
@@ -73,7 +75,7 @@ Screen::~Screen() {
delete[] _frontScreen;
delete[] _backScreen;
-
+
delete _renderQueue;
}
@@ -114,7 +116,7 @@ void Screen::loadMouseCursor(uint resIndex) {
}
}
// FIXME: Where's the cursor hotspot? Using 8, 8 seems good enough for now.
- CursorMan.replaceCursor((const byte*)mouseCursor, 16, 16, 8, 8, 0);
+ CursorMan.replaceCursor(mouseCursor, 16, 16, 8, 8, 0);
}
void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {
@@ -129,7 +131,7 @@ void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {
byte *dest = _frontScreen + x + (y + _vm->_cameraHeight) * 640;
//debug(0, "Screen::drawGuiImage() x = %d; y = %d; w = %d; h = %d; resIndex = %d", x, y, width, height, resIndex);
-
+
while (workHeight > 0) {
int count = 1;
byte pixel = *imageData++;
@@ -156,6 +158,7 @@ void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {
void Screen::startShakeScreen(int16 shakeCounter) {
_shakeActive = true;
+ _shakeTime = 0;
_shakeCounterInit = shakeCounter;
_shakeCounter = shakeCounter;
_shakePos = 0;
@@ -166,15 +169,19 @@ void Screen::stopShakeScreen() {
_vm->_system->setShakePos(0);
}
-void Screen::updateShakeScreen() {
- if (_shakeActive) {
+bool Screen::updateShakeScreen() {
+ // Assume shaking happens no more often than 50 times per second
+ if (_shakeActive && _vm->_system->getMillis() - _shakeTime >= 20) {
+ _shakeTime = _vm->_system->getMillis();
_shakeCounter--;
if (_shakeCounter == 0) {
_shakeCounter = _shakeCounterInit;
_shakePos ^= 8;
_vm->_system->setShakePos(_shakePos);
+ return true;
}
}
+ return false;
}
void Screen::addStaticSprite(byte *spriteItem) {
@@ -247,7 +254,7 @@ void Screen::addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, i
} else {
loopNum |= 0x8000;
}
-
+
WRITE_LE_UINT16(spriteItem + 0, loopNum);
WRITE_LE_UINT16(spriteItem + 4, frameNum);
@@ -308,9 +315,9 @@ void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
wrapState.len2 = 0;
y = _verbLineY;
-
+
memset(wrapState.textBuffer, 0, sizeof(wrapState.textBuffer));
-
+
for (int16 i = 0; i <= _verbLineNum; i++) {
wrapState.sourceString = _vm->_script->getSlotData(_verbLineItems[i].slotIndex) + _verbLineItems[i].slotOffset;
len = wrapGuiText(_fontResIndexArray[0], _verbLineWidth, wrapState);
@@ -331,19 +338,19 @@ void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
wrapState.sourceString++;
wrapState.len1 -= len;
wrapState.len2 = len + 1;
-
+
drawGuiText(_verbLineX - 1 - (wrapState.width / 2), y, 0xF9, 0xFF, _fontResIndexArray[0], wrapState);
wrapState.destString = wrapState.textBuffer;
wrapState.width = 0;
len = wrapGuiText(_fontResIndexArray[0], _verbLineWidth, wrapState);
wrapState.len1 += len;
-
+
y += 9;
}
y += 9;
}
-
+
wrapState.len1 -= len;
wrapState.len2 = len;
@@ -463,13 +470,12 @@ void Screen::addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16
textRect->x = CLIP<int16>(x - width / 2, 0, 640);
item->lineCount++;
}
-
+
y += font.getHeight() - 1;
}
void Screen::addTalkTextItemsToRenderQueue() {
-
for (int16 i = 0; i <= _talkTextItemNum; i++) {
TalkTextItem *item = &_talkTextItems[i];
byte *text = _vm->_script->getSlotData(item->slotIndex) + item->slotOffset;
@@ -482,14 +488,15 @@ void Screen::addTalkTextItemsToRenderQueue() {
if (item->duration < 0)
item->duration = 0;
+ if (!_vm->_cfgText)
+ return;
+
for (byte j = 0; j < item->lineCount; j++) {
- _renderQueue->addText(item->lines[j].x, item->lines[j].y, item->color, _fontResIndexArray[item->fontNum],
- text, item->lines[j].length);
+ _renderQueue->addText(item->lines[j].x, item->lines[j].y, item->color,
+ _fontResIndexArray[item->fontNum], text, item->lines[j].length);
text += item->lines[j].length;
}
-
}
-
}
int16 Screen::getTalkTextDuration() {
@@ -559,7 +566,7 @@ int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wra
Font font(_vm->_res->load(fontResIndex)->data);
int16 len = 0;
-
+
while (*wrapState.sourceString >= 0x20 && *wrapState.sourceString < 0xF0) {
byte ch = *wrapState.sourceString;
byte charWidth;
@@ -573,9 +580,9 @@ int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wra
wrapState.width += charWidth;
*wrapState.destString++ = *wrapState.sourceString++;
}
-
+
return len;
-
+
}
void Screen::drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uint fontResIndex, GuiTextWrapState &wrapState) {
@@ -765,7 +772,7 @@ void Screen::loadState(Common::ReadStream *in) {
_verbLineItems[i].slotIndex = in->readUint16LE();
_verbLineItems[i].slotOffset = in->readUint16LE();
}
-
+
// Load talk text items
_talkTextX = in->readUint16LE();
_talkTextY = in->readUint16LE();
@@ -786,7 +793,7 @@ void Screen::loadState(Common::ReadStream *in) {
_talkTextItems[i].lines[j].length = in->readUint16LE();
}
}
-
+
// Load GUI bitmap
{
byte *gui = _frontScreen + _vm->_cameraHeight * 640;
diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h
index 988f59c840..788cde50c6 100644
--- a/engines/toltecs/screen.h
+++ b/engines/toltecs/screen.h
@@ -154,15 +154,15 @@ public:
~Screen();
void unpackRle(byte *source, byte *dest, uint16 width, uint16 height);
-
+
void loadMouseCursor(uint resIndex);
-
+
void drawGuiImage(int16 x, int16 y, uint resIndex);
-
+
void startShakeScreen(int16 shakeCounter);
void stopShakeScreen();
- void updateShakeScreen();
-
+ bool updateShakeScreen();
+
// Sprite list
void addStaticSprite(byte *spriteItem);
void addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, int16 *spriteArray, bool loop, int mode);
@@ -175,7 +175,7 @@ public:
// Verb line
void updateVerbLine(int16 slotIndex, int16 slotOffset);
-
+
// Talk text
void updateTalkText(int16 slotIndex, int16 slotOffset);
void addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item);
@@ -207,7 +207,7 @@ public:
int16 slotIndex;
int16 slotOffset;
};
-
+
struct Rect {
int16 x, y, width, height;
};
@@ -215,12 +215,13 @@ public:
ToltecsEngine *_vm;
byte *_frontScreen, *_backScreen;
-
+
uint _fontResIndexArray[10];
byte _fontColor1, _fontColor2;
// Screen shaking
bool _shakeActive;
+ uint32 _shakeTime;
int16 _shakeCounterInit, _shakeCounter;
int _shakePos;
@@ -229,7 +230,7 @@ public:
VerbLineItem _verbLineItems[8];
int16 _verbLineX, _verbLineY, _verbLineWidth;
int16 _verbLineCount;
-
+
// Talk text
int16 _talkTextX, _talkTextY;
int16 _talkTextMaxWidth;
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index 9683831980..5e8617bc43 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -183,10 +183,7 @@ void ScriptInterpreter::setMainScript(uint slotIndex) {
}
void ScriptInterpreter::runScript() {
- uint32 lastScreenUpdate = 0;
-
while (!_vm->shouldQuit()) {
-
if (_vm->_movieSceneFlag)
_vm->_mouseButton = 0;
@@ -197,7 +194,7 @@ void ScriptInterpreter::runScript() {
_vm->saveGameState(_vm->_saveLoadSlot, _vm->_saveLoadDescription);
_vm->_saveLoadRequested = 0;
}
-
+
if (_switchLocalDataNear) {
_switchLocalDataNear = false;
_localData = getSlotData(_regs.reg4);
@@ -214,20 +211,10 @@ void ScriptInterpreter::runScript() {
_localData = _stack + 2;
_switchLocalDataNear = true;
}
-
+
byte opcode = readByte();
execOpcode(opcode);
-
- // Update the screen at semi-regular intervals, else the mouse
- // cursor will be jerky.
- uint32 now = _vm->_system->getMillis();
- if (now < lastScreenUpdate || now - lastScreenUpdate > 10) {
- _vm->_system->updateScreen();
- lastScreenUpdate = _vm->_system->getMillis();
- }
-
}
-
}
byte ScriptInterpreter::readByte() {
@@ -547,7 +534,7 @@ const char *getVarName(uint variable) {
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;
@@ -579,7 +566,7 @@ int16 ScriptInterpreter::getGameVar(uint variable) {
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;
@@ -718,7 +705,7 @@ void ScriptInterpreter::saveState(Common::WriteStream *out) {
// Save stack
out->write(_stack, kScriptStackSize);
out->writeUint16LE(_savedSp);
-
+
// Save IP
out->writeUint16LE((int16)(_code - getSlotData(_regs.reg4)));
@@ -1046,29 +1033,21 @@ void ScriptInterpreter::sfHandleInput() {
Only scancodes known to be used (so far) are converted
*/
switch (_vm->_keyState.keycode) {
- case Common::KEYCODE_ESCAPE:
+ case Common::KEYCODE_ESCAPE:
keyCode = 1;
break;
case Common::KEYCODE_F10:
keyCode = 68;
break;
default:
- break;
+ break;
}
}
localWrite16(varOfs, keyCode);
}
void ScriptInterpreter::sfRunOptionsScreen() {
- _vm->_screen->loadMouseCursor(12);
- _vm->_palette->loadAddPalette(9, 224);
- _vm->_palette->setDeltaPalette(_vm->_palette->getMainPalette(), 7, 0, 31, 224);
- _vm->_screen->finishTalkTextItems();
- _vm->_screen->clearSprites();
- CursorMan.showMouse(true);
- _vm->_menuSystem->run();
- _vm->_keyState.reset();
- _switchLocalDataNear = true;
+ _vm->showMenu(kMenuIdMain);
}
/* NOTE: The opcodes sfPrecacheSprites, sfPrecacheSounds1, sfPrecacheSounds2 and
@@ -1076,7 +1055,7 @@ void ScriptInterpreter::sfRunOptionsScreen() {
of data so the game doesn't stall while playing (due to the slow speed of
CD-Drives back then). This is not needed in ScummVM since all supported
systems are fast enough to load data in-game. */
-
+
void ScriptInterpreter::sfPrecacheSprites() {
// See note above
}
@@ -1102,7 +1081,9 @@ void ScriptInterpreter::sfSaveStackPtr() {
}
void ScriptInterpreter::sfPlayMovie() {
+ CursorMan.showMouse(false);
_vm->_moviePlayer->playMovie(arg16(3));
+ CursorMan.showMouse(true);
}
} // End of namespace Toltecs
diff --git a/engines/toltecs/script.h b/engines/toltecs/script.h
index 0c1898c525..89dca4598f 100644
--- a/engines/toltecs/script.h
+++ b/engines/toltecs/script.h
@@ -56,6 +56,8 @@ public:
void saveState(Common::WriteStream *out);
void loadState(Common::ReadStream *in);
+ void setSwitchLocalDataNear(bool newValue) { _switchLocalDataNear = newValue; }
+
protected:
struct ScriptRegs {
@@ -88,13 +90,13 @@ protected:
bool _cmpBitTest;
ScriptSlot _slots[kMaxScriptSlots];
-
+
ScriptRegs _regs;
int16 _savedSp;
byte readByte();
int16 readInt16();
-
+
void execOpcode(byte opcode);
void setupScriptFunctions();
diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp
index f7d806c67b..b06c0af675 100644
--- a/engines/toltecs/segmap.cpp
+++ b/engines/toltecs/segmap.cpp
@@ -48,7 +48,7 @@ void SegmentMap::load(byte *source) {
uint16 maskRectCount = READ_LE_UINT16(source);
source += 2;
uint16 maskRectDataSize = maskRectCount * 12 + 2;
-
+
debug(0, "SegmentMap::load() maskRectCount = %d", maskRectCount);
for (uint16 i = 0; i < maskRectCount; i++) {
@@ -74,25 +74,25 @@ void SegmentMap::load(byte *source) {
// Load path rects
source += 2; // skip rects array size
-
+
uint16 pathRectCount = READ_LE_UINT16(source);
source += 2;
-
+
debug(0, "SegmentMap::load() pathRectCount = %d", pathRectCount);
-
+
for (uint16 i = 0; i < pathRectCount; i++) {
SegmapPathRect pathRect;
pathRect.y1 = READ_LE_UINT16(source);
pathRect.x1 = READ_LE_UINT16(source + 2);
pathRect.y2 = pathRect.y1 + READ_LE_UINT16(source + 4);
pathRect.x2 = pathRect.x1 + READ_LE_UINT16(source + 6);
-
+
debug(0, "SegmentMap::load() (%d, %d, %d, %d)", pathRect.x1, pathRect.y1, pathRect.x2, pathRect.y2);
source += 8;
_pathRects.push_back(pathRect);
}
-
+
// Load info rects
source += 2; // skip rects array size
@@ -141,7 +141,7 @@ void SegmentMap::adjustPathPoint(int16 &x, int16 &y) {
uint32 minDistance = 0xFFFFFFFF, distance;
int16 adjustedX = 0, adjustedY = 0, x2, y2;
-
+
for (int16 rectIndex = 0; rectIndex < (int16)_pathRects.size(); rectIndex++) {
if (x >= _pathRects[rectIndex].x1 && x < _pathRects[rectIndex].x2) {
@@ -174,7 +174,7 @@ void SegmentMap::adjustPathPoint(int16 &x, int16 &y) {
}
}
-
+
x = adjustedX;
y = adjustedY;
@@ -318,7 +318,7 @@ void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 so
pointsArray[0] = 0;
pointsArray[1] = TO_LE_16(_pathNodesCount + 1);
}
-
+
debug(0, "SegmentMap::findPath() count = %d", FROM_LE_16(pointsArray[1]));
#if 0 // DEBUG: Draw the path we found
@@ -335,7 +335,7 @@ void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 so
sy = y;
}
#endif
-
+
}
int8 SegmentMap::getScalingAtPoint(int16 x, int16 y) {
diff --git a/engines/toltecs/segmap.h b/engines/toltecs/segmap.h
index 30182a6b71..dda0edeb88 100644
--- a/engines/toltecs/segmap.h
+++ b/engines/toltecs/segmap.h
@@ -61,14 +61,14 @@ public:
void getRgbModifiertAtPoint(int16 x, int16 y, int16 id, byte &r, byte &g, byte &b);
void addMasksToRenderQueue();
-
+
//protected:
public: // for debugging purposes
struct SegmapPathRect {
int16 x1, y1, x2, y2;
};
-
+
struct SegmapInfoRect {
int16 y, x;
int16 height, width;
@@ -78,11 +78,11 @@ public: // for debugging purposes
return py >= y && py <= y + height && px >= x && px <= x + width;
}
};
-
+
struct PathPoint {
int16 y, x;
};
-
+
typedef Common::Array<SegmapMaskRect> SegmapMaskRectArray;
typedef Common::Array<SegmapPathRect> SegmapPathRectArray;
typedef Common::Array<SegmapInfoRect> SegmapInfoRectArray;
diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp
index c9ef00e31b..4b281392e5 100644
--- a/engines/toltecs/sound.cpp
+++ b/engines/toltecs/sound.cpp
@@ -34,48 +34,38 @@ namespace Toltecs {
Sound::Sound(ToltecsEngine *vm) : _vm(vm) {
for (int i = 0; i < kMaxChannels; i++) {
- channels[i].type = kChannelTypeEmpty;
- channels[i].resIndex = -1;
+ clearChannel(i);
}
}
Sound::~Sound() {
}
+void Sound::clearChannel(int channel) {
+ channels[channel].type = kChannelTypeEmpty;
+ channels[channel].resIndex = -1;
+ channels[channel].volume = 0;
+ channels[channel].panning = 0;
+}
+
void Sound::playSpeech(int16 resIndex) {
debug(0, "playSpeech(%d)", resIndex);
- internalPlaySound(resIndex, kChannelTypeSpeech, 50 /*TODO*/, 0);
+
+ if (_vm->_cfgVoices)
+ internalPlaySound(resIndex, kChannelTypeSpeech, 50 /*TODO*/, 0);
}
void Sound::playSound(int16 resIndex, int16 type, int16 volume) {
-
- // TODO: Use the right volumes
-
debug(0, "playSound(%d, %d, %d)", resIndex, type, volume);
-
- if (volume == -1 || type == -2) {
- if (type == kChannelTypeBackground) {
- internalPlaySound(resIndex, type, 50 /*TODO*/, 0);
- } else {
- internalPlaySound(resIndex, type, 100 /*TODO*/, 0);
- }
- } else {
- internalPlaySound(resIndex, type, 100 /*TODO*/, 0);
- }
+ internalPlaySound(resIndex, type, volume, 0);
}
void Sound::playSoundAtPos(int16 resIndex, int16 x, int16 y) {
-
debug(0, "playSoundAtPos(%d, %d, %d)", resIndex, x, y);
- int16 volume, panning = 0, deltaX = 0;
- int8 scaling = _vm->_segmap->getScalingAtPoint(x, y);
-
- if (scaling >= 0)
- volume = 50 + ABS(scaling) / 2;
- else
- volume = 50 - ABS(scaling) / 2;
+ int16 volume = 50 + ABS(_vm->_segmap->getScalingAtPoint(x, y)) / 2;
+ int16 panning = 0, deltaX = 0;
if (_vm->_cameraX > x)
deltaX = _vm->_cameraX - x;
@@ -85,32 +75,31 @@ void Sound::playSoundAtPos(int16 resIndex, int16 x, int16 y) {
deltaX = 600;
volume = ((100 - deltaX / 6) * volume) / 100;
-
+
if (_vm->_cameraX + 320 != x) {
panning = CLIP(x - (_vm->_cameraX + 320), -381, 381) / 3;
}
internalPlaySound(resIndex, 1, volume, panning);
-
}
void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 panning) {
+ // Change the game's sound volume (0 - 100) to Scummvm's scale (0 - 255)
+ volume = (volume == -1) ? 255 : volume * 255 / 100;
if (resIndex == -1) {
// Stop all sounds
_vm->_mixer->stopAll();
_vm->_screen->keepTalkTextItemsAlive();
for (int i = 0; i < kMaxChannels; i++) {
- channels[i].type = kChannelTypeEmpty;
- channels[i].resIndex = -1;
+ clearChannel(i);
}
} else if (type == -2) {
// Stop sounds with specified resIndex
for (int i = 0; i < kMaxChannels; i++) {
if (channels[i].resIndex == resIndex) {
_vm->_mixer->stopHandle(channels[i].handle);
- channels[i].type = kChannelTypeEmpty;
- channels[i].resIndex = -1;
+ clearChannel(i);
}
}
} else {
@@ -119,7 +108,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa
// Stop speech and play new sound
stopSpeech();
}
-
+
// Play new sound in empty channel
int freeChannel = -1;
for (int i = 0; i < kMaxChannels; i++) {
@@ -128,7 +117,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa
break;
}
}
-
+
// If all channels are in use no new sound will be played
if (freeChannel >= 0) {
Resource *soundResource = _vm->_res->load(resIndex);
@@ -141,19 +130,17 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa
channels[freeChannel].type = type;
channels[freeChannel].resIndex = resIndex;
+ channels[freeChannel].volume = volume;
+ channels[freeChannel].panning = panning;
- Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType;
- /*
- switch (type) {
- }
- */
+ Audio::Mixer::SoundType soundType = getScummVMSoundType((SoundChannelType)type);
_vm->_mixer->playStream(soundType, &channels[freeChannel].handle,
- stream, -1, volume, panning);
+ stream, -1, volume, panning);
}
}
-
+
}
void Sound::updateSpeech() {
@@ -170,8 +157,7 @@ void Sound::stopSpeech() {
if (channels[i].type == kChannelTypeSpeech) {
_vm->_mixer->stopHandle(channels[i].handle);
_vm->_screen->keepTalkTextItemsAlive();
- channels[i].type = kChannelTypeEmpty;
- channels[i].resIndex = -1;
+ clearChannel(i);
}
}
}
@@ -180,8 +166,7 @@ void Sound::stopAll() {
for (int i = 0; i < kMaxChannels; i++) {
_vm->_mixer->stopHandle(channels[i].handle);
_vm->_screen->keepTalkTextItemsAlive();
- channels[i].type = kChannelTypeEmpty;
- channels[i].resIndex = -1;
+ clearChannel(i);
}
}
@@ -189,13 +174,22 @@ void Sound::saveState(Common::WriteStream *out) {
for (int i = 0; i < kMaxChannels; i++) {
out->writeSint16LE(channels[i].type);
out->writeSint16LE(channels[i].resIndex);
+ out->writeSint16LE(channels[i].volume);
+ out->writeSint16LE(channels[i].panning);
}
}
-void Sound::loadState(Common::ReadStream *in) {
+void Sound::loadState(Common::ReadStream *in, int version) {
for (int i = 0; i < kMaxChannels; i++) {
channels[i].type = in->readSint16LE();
channels[i].resIndex = in->readSint16LE();
+ if (version < 4) {
+ channels[i].volume = (channels[i].type == kChannelTypeBackground) ? 50 : 100;
+ channels[i].panning = 0;
+ } else {
+ channels[i].volume = in->readSint16LE();
+ channels[i].panning = in->readSint16LE();
+ }
if (channels[i].type != kChannelTypeEmpty) {
Resource *soundResource = _vm->_res->load(channels[i].resIndex);
@@ -206,19 +200,26 @@ void Sound::loadState(Common::ReadStream *in) {
DisposeAfterUse::NO),
channels[i].type == kChannelTypeBackground ? 0 : 1);
- Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType;
- /*
- switch (type) {
- }
- */
-
- // TODO: Volume and panning
- int16 volume = (channels[i].type == kChannelTypeBackground) ? 50 : 100;
+ Audio::Mixer::SoundType soundType = getScummVMSoundType((SoundChannelType)channels[i].type);
_vm->_mixer->playStream(soundType, &channels[i].handle,
- stream, -1, volume, /*panning*/0);
+ stream, -1, channels[i].volume, channels[i].panning);
}
}
}
+Audio::Mixer::SoundType Sound::getScummVMSoundType(SoundChannelType type) const {
+ switch (type) {
+ case kChannelTypeBackground:
+ case kChannelTypeSfx:
+ return Audio::Mixer::kSFXSoundType;
+ case kChannelTypeSpeech:
+ return Audio::Mixer::kSpeechSoundType;
+ break;
+ default:
+ return Audio::Mixer::kSFXSoundType;
+ break;
+ }
+}
+
} // End of namespace Toltecs
diff --git a/engines/toltecs/sound.h b/engines/toltecs/sound.h
index e292d22c0f..48a6cd1318 100644
--- a/engines/toltecs/sound.h
+++ b/engines/toltecs/sound.h
@@ -42,6 +42,8 @@ enum SoundChannelType {
struct SoundChannel {
int16 resIndex;
int16 type;
+ int16 volume;
+ int16 panning;
Audio::SoundHandle handle;
};
@@ -60,15 +62,16 @@ public:
void stopAll();
void saveState(Common::WriteStream *out);
- void loadState(Common::ReadStream *in);
+ void loadState(Common::ReadStream *in, int version);
protected:
ToltecsEngine *_vm;
SoundChannel channels[kMaxChannels];
+ void clearChannel(int channel);
void internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 panning);
-
+ Audio::Mixer::SoundType getScummVMSoundType(SoundChannelType type) const;
};
diff --git a/engines/toltecs/sprite.cpp b/engines/toltecs/sprite.cpp
index 7a02663793..6101eb7d85 100644
--- a/engines/toltecs/sprite.cpp
+++ b/engines/toltecs/sprite.cpp
@@ -199,7 +199,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem
sprite.frameNum = frameNum;
spriteData = _vm->_res->load(drawRequest.resIndex)->data;
-
+
if (drawRequest.flags & 0x1000) {
sprite.flags |= 4;
}
@@ -207,7 +207,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem
if (drawRequest.flags & 0x2000) {
sprite.flags |= 0x10;
}
-
+
if (drawRequest.flags & 0x4000) {
sprite.flags |= 0x40;
}
@@ -218,7 +218,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem
if (spriteFrameEntry.w == 0 || spriteFrameEntry.h == 0)
return false;
-
+
sprite.offset = spriteFrameEntry.offset;
sprite.width = spriteFrameEntry.w;
@@ -263,12 +263,12 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem
xoffs -= (xoffs * scaleValue) / 100;
yoffs -= (yoffs * scaleValue) / 100;
}
-
+
}
-
+
sprite.x -= xoffs;
sprite.y -= yoffs;
-
+
sprite.yerror = sprite.ydelta;
// Now we check if the sprite needs to be clipped
@@ -283,7 +283,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem
sprite.height -= clipHeight;
if (sprite.height <= 0)
return false;
-
+
sprite.y = _vm->_cameraY;
// If the sprite is scaled
@@ -311,7 +311,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem
}
sprite.yerror = chopHeight;
}
-
+
spriteFrameData = spriteData + sprite.offset;
// Now the sprite's offset is adjusted to point to the starting line
if ((sprite.flags & 0x10) == 0) {
@@ -439,7 +439,7 @@ void Screen::drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawIt
SpriteReaderStatus status;
PixelPacket packet;
-
+
byte *destp = dest;
int16 skipX = sprite.skipX;
@@ -459,7 +459,7 @@ void Screen::drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawIt
status = reader.readPacket(packet);
}
}
-
+
if (w - packet.count < 0)
packet.count = w;
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index d403e0499b..9f3a10a03b 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -62,11 +62,6 @@ struct GameSettings {
};
ToltecsEngine::ToltecsEngine(OSystem *syst, const ToltecsGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
-
- // Setup mixer
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
-
_rnd = new Common::RandomSource("toltecs");
}
@@ -85,7 +80,7 @@ Common::Error ToltecsEngine::run() {
_flag01 = 0;
_saveLoadRequested = 0;
-
+
_cameraX = 0;
_cameraY = 0;
_newCameraX = 0;
@@ -96,7 +91,7 @@ Common::Error ToltecsEngine::run() {
_sceneWidth = 0;
_sceneHeight = 0;
-
+
_doSpeech = true;
_doText = true;
@@ -126,17 +121,27 @@ Common::Error ToltecsEngine::run() {
_moviePlayer = new MoviePlayer(this);
_music = new Music(_arc);
_menuSystem = new MenuSystem(this);
-
+
_sound = new Sound(this);
+ _cfgText = ConfMan.getBool("subtitles");
+ _cfgVoices = !ConfMan.getBool("speech_mute");
+
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, mute ? 0 : ConfMan.getInt("speech_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, mute ? 0 : ConfMan.getInt("music_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, mute ? 0 : ConfMan.getInt("sfx_volume"));
syncSoundSettings();
CursorMan.showMouse(true);
setupSysStrings();
-//#define TEST_MENU
-#ifdef TEST_MENU
+#if 0
+ // Menu test
_screen->registerFont(0, 0x0D);
_screen->registerFont(1, 0x0E);
_screen->loadMouseCursor(12);
@@ -181,7 +186,7 @@ Common::Error ToltecsEngine::run() {
delete _music;
delete _moviePlayer;
delete _menuSystem;
-
+
delete _sound;
return Common::kNoError;
@@ -245,7 +250,7 @@ void ToltecsEngine::loadScene(uint resIndex) {
_screen->_fullRefresh = true;
_screen->_renderQueue->clear();
-
+
}
void ToltecsEngine::updateScreen() {
@@ -300,12 +305,13 @@ void ToltecsEngine::drawScreen() {
if (_screen->_guiRefresh && _guiHeight > 0 && _cameraHeight > 0) {
// Update the GUI when needed and it's visible
- _system->copyRectToScreen((const byte *)_screen->_frontScreen + _cameraHeight * 640,
+ _system->copyRectToScreen(_screen->_frontScreen + _cameraHeight * 640,
640, 0, _cameraHeight, 640, _guiHeight);
_screen->_guiRefresh = false;
}
_system->updateScreen();
+ _system->delayMillis(10);
updateCamera();
}
@@ -321,15 +327,14 @@ void ToltecsEngine::updateInput() {
//debug("key: flags = %02X; keycode = %d", _keyState.flags, _keyState.keycode);
- // FIXME: This is just for debugging
switch (event.kbd.keycode) {
- case Common::KEYCODE_F7:
- savegame("toltecs.001", "Quicksave");
+ case Common::KEYCODE_F5:
+ showMenu(kMenuIdSave);
break;
- case Common::KEYCODE_F9:
- loadgame("toltecs.001");
+ case Common::KEYCODE_F7:
+ showMenu(kMenuIdLoad);
break;
- case Common::KEYCODE_ESCAPE:
+ case Common::KEYCODE_SPACE:
// Skip current dialog line, if a dialog is active
if (_screen->getTalkTextDuration() > 0) {
_sound->stopSpeech();
@@ -422,7 +427,7 @@ void ToltecsEngine::setCamera(int16 x, int16 y) {
_screen->finishTalkTextItems();
_screen->clearSprites();
-
+
_cameraX = x;
_newCameraX = x;
@@ -491,9 +496,9 @@ void ToltecsEngine::updateCamera() {
}
void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) {
-
+
byte *scanData = _script->getSlotData(slotIndex) + slotOffset;
-
+
while (*scanData < 0xF0) {
if (*scanData == 0x19) {
scanData++;
@@ -506,7 +511,7 @@ void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) {
}
scanData++;
}
-
+
if (*scanData == 0xFE) {
if (_doSpeech) {
int16 resIndex = READ_LE_UINT16(scanData + 1);
@@ -540,7 +545,7 @@ void ToltecsEngine::walk(byte *walkData) {
walkInfo.xerror = READ_LE_UINT16(walkData + 14);
walkInfo.mulValue = READ_LE_UINT16(walkData + 16);
walkInfo.scaling = READ_LE_UINT16(walkData + 18);
-
+
walkInfo.scaling = -_segmap->getScalingAtPoint(walkInfo.x, walkInfo.y);
if (walkInfo.y1 < walkInfo.y2)
@@ -548,7 +553,7 @@ void ToltecsEngine::walk(byte *walkData) {
else
ystep = 1;
ydelta = ABS(walkInfo.y1 - walkInfo.y2) * _walkSpeedY;
-
+
if (walkInfo.x1 < walkInfo.x2)
xstep = -1;
else
@@ -611,11 +616,11 @@ void ToltecsEngine::walk(byte *walkData) {
}
-int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
+int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
byte *rectDataEnd) {
rectData += index * itemSize;
-
+
while (rectData < rectDataEnd) {
int16 rectY = READ_LE_UINT16(rectData);
if (rectY == -10)
@@ -633,9 +638,32 @@ int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 ind
index++;
rectData += itemSize;
}
-
+
return -1;
+}
+
+void ToltecsEngine::showMenu(MenuID menuId) {
+ _screen->loadMouseCursor(12);
+ _palette->loadAddPalette(9, 224);
+ _palette->setDeltaPalette(_palette->getMainPalette(), 7, 0, 31, 224);
+ _screen->finishTalkTextItems();
+ _screen->clearSprites();
+ CursorMan.showMouse(true);
+ _menuSystem->run(menuId);
+ _keyState.reset();
+ _script->setSwitchLocalDataNear(true);
+}
+
+void ToltecsEngine::syncSoundSettings() {
+ Engine::syncSoundSettings();
+
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+ _cfgVoicesVolume = (mute ? 0 : ConfMan.getInt("speech_volume")) * 20 / Audio::Mixer::kMaxChannelVolume;
+ _cfgMusicVolume = (mute ? 0 : ConfMan.getInt("music_volume")) * 20 / Audio::Mixer::kMaxChannelVolume;
+ _cfgSoundFXVolume = (mute ? 0 : ConfMan.getInt("sfx_volume")) * 20 / Audio::Mixer::kMaxChannelVolume;
}
} // End of namespace Toltecs
diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h
index efa1f9d13a..b95a4f77cb 100644
--- a/engines/toltecs/toltecs.h
+++ b/engines/toltecs/toltecs.h
@@ -81,6 +81,14 @@ enum SysString {
kSysStrCount
};
+enum MenuID {
+ kMenuIdNone,
+ kMenuIdMain,
+ kMenuIdSave,
+ kMenuIdLoad,
+ kMenuIdVolumes
+};
+
class ToltecsEngine : public ::Engine {
Common::KeyState _keyPressed;
@@ -99,6 +107,7 @@ public:
uint32 getFeatures() const;
Common::Language getLanguage() const;
const Common::String& getTargetName() const { return _targetName; }
+ void syncSoundSettings();
void setupSysStrings();
void requestSavegame(int slotNum, Common::String &description);
@@ -119,14 +128,18 @@ public:
void scrollCameraLeft(int16 delta);
void scrollCameraRight(int16 delta);
void updateCamera();
-
+
+ void showMenu(MenuID menuId);
+
void talk(int16 slotIndex, int16 slotOffset);
void walk(byte *walkData);
-
- int16 findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
+
+ int16 findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
byte *rectDataEnd);
+ int _cfgVoicesVolume, _cfgMusicVolume, _cfgSoundFXVolume;
+ bool _cfgText, _cfgVoices;
public:
AnimationPlayer *_anim;
@@ -150,7 +163,7 @@ public:
uint _sceneResIndex;
int16 _sceneWidth, _sceneHeight;
-
+
int _counter01, _counter02;
bool _movieSceneFlag;
byte _flag01;
@@ -161,7 +174,7 @@ public:
int16 _guiHeight;
bool _doSpeech, _doText;
-
+
int16 _walkSpeedY, _walkSpeedX;
Common::KeyState _keyState;
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp
new file mode 100644
index 0000000000..23c655e35a
--- /dev/null
+++ b/engines/tony/custom.cpp
@@ -0,0 +1,2530 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/system.h"
+#include "common/savefile.h"
+#include "tony/mpal/mpal.h"
+#include "tony/mpal/memory.h"
+#include "tony/custom.h"
+#include "tony/font.h"
+#include "tony/game.h"
+#include "tony/gfxcore.h"
+#include "tony/tony.h"
+#include "tony/tonychar.h"
+#include "tony/utils.h"
+
+namespace Tony {
+
+static const char *const kAmbianceFile[] = {
+ "None",
+ "1.ADP", // Grilli.WAV
+ "2.ADP", // Grilli-Ovattati.WAV
+ "3.ADP", // Grilli-Vento.WAV
+ "3.ADP", // Grilli-Vento1.WAV
+ "5.ADP", // Vento1.WAV
+ "4.ADP", // Mare1.WAV
+ "6.ADP" // Mare1.WAV half volume
+};
+
+static const MusicFileEntry kMusicFiles[] = {
+ {"00.ADP", 0}, {"01.ADP", 0}, {"02.ADP", 0}, {"03.ADP", 0},
+ {"04.ADP", 0}, {"05.ADP", 0}, {"06.ADP", 0}, {"07.ADP", 0},
+ {"08.ADP", 2450}, {"09.ADP", 0}, {"10.ADP", 0}, {"11.ADP", 0},
+ {"12.ADP", 0}, {"13.ADP", 0}, {"14.ADP", 0}, {"15.ADP", 0},
+ {"16.ADP", 0}, {"17.ADP", 0}, {"18.ADP", 0}, {"19.ADP", 0},
+ {"20.ADP", 0}, {"21.ADP", 0}, {"22.ADP", 0}, {"23.ADP", 0},
+ {"24.ADP", 0}, {"25.ADP", 0}, {"26.ADP", 0}, {"27.ADP", 0},
+ {"28.ADP", 1670}, {"29.ADP", 0}, {"30.ADP", 0}, {"31.ADP", 0},
+ {"32.ADP", 2900}, {"33.ADP", 0}, {"34.ADP", 0}, {"35.ADP", 0},
+ {"36.ADP", 0}, {"37.ADP", 0}, {"38.ADP", 0}, {"39.ADP", 0},
+ {"40.ADP", 0}, {"41.ADP", 1920}, {"42.ADP", 1560}, {"43.ADP", 1920},
+ {"44.ADP", 1920}, {"45.ADP", 1920}, {"46.ADP", 1920}, {"47.ADP", 1920},
+ {"48.ADP", 1920}, {"49.ADP", 1920}, {"50.ADP", 1920}, {"51.ADP", 1920},
+ {"52.ADP", 1920}, {"53.ADP", 0}, {"54.ADP", 0}, {"55.ADP", 0},
+ {"56.ADP", 0}, {"57.ADP", 0}, {"58.ADP", 0}, {"59.ADP", 0}
+};
+
+
+static const char *const kJingleFileNames[] = {
+ "S00.ADP", "S01.ADP", "S02.ADP", "S03.ADP", "S04.ADP",
+ "S05.ADP", "S06.ADP", "S07.ADP", "S08.ADP", "S09.ADP",
+ "S10.ADP", "S11.ADP", "S12.ADP", "S13.ADP", "S14.ADP",
+ "S15.ADP", "S16.ADP", "S17.ADP", "S18.ADP"
+};
+
+void reapplyChangedHotspot() {
+ for (int i = 0; i < GLOBALS._curChangedHotspot; i++)
+ GLOBALS._loc->getItemFromCode(GLOBALS._changedHotspot[i]._dwCode)->changeHotspot(RMPoint(GLOBALS._changedHotspot[i]._nX, GLOBALS._changedHotspot[i]._nY));
+}
+
+void saveChangedHotspot(Common::OutSaveFile *f) {
+ f->writeByte(GLOBALS._curChangedHotspot);
+ if (GLOBALS._curChangedHotspot > 0) {
+ for (int i = 0; i < GLOBALS._curChangedHotspot; ++i)
+ GLOBALS._changedHotspot[i].save(f);
+ }
+}
+
+void loadChangedHotspot(Common::InSaveFile *f) {
+ GLOBALS._curChangedHotspot = f->readByte();
+
+ if (GLOBALS._curChangedHotspot > 0) {
+ for (int i = 0; i < GLOBALS._curChangedHotspot; ++i)
+ GLOBALS._changedHotspot[i].load(f);
+ }
+}
+
+/**
+ * Classes required for custom functions
+ *
+ * Tony (To Move him) -> You can do MPAL through the animation? I really think so
+ *
+ * SendMessage -> I'd say just theEngine.SendMessage()
+ * ChangeLocation -> theEngine.ChangeLocation()
+ * AddInventory -> theEngine.AddInventory()
+*/
+
+void mCharResetCodes() {
+ for (int i = 0; i < 10; i++)
+ GLOBALS._mCharacter[i]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[i]._code);
+ for (int i = 0; i < 10; i++)
+ GLOBALS._character[i]._item = GLOBALS._loc->getItemFromCode(GLOBALS._character[i]._code);
+}
+
+void charsSaveAll(Common::OutSaveFile *f) {
+ for (int i = 0; i < 10; i++) {
+ f->writeByte(GLOBALS._isMChar[i]);
+ if (GLOBALS._isMChar[i]) {
+ GLOBALS._mCharacter[i].save(f);
+ } else {
+ GLOBALS._character[i].save(f);
+ }
+ }
+}
+
+void charsLoadAll(Common::InSaveFile *f) {
+ for (int i = 0; i < 10; i++) {
+ GLOBALS._isMChar[i] = f->readByte();
+ if (GLOBALS._isMChar[i])
+ GLOBALS._mCharacter[i].load(f);
+ else
+ GLOBALS._character[i].load(f);
+ }
+}
+
+void faceToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDDOWN);
+}
+
+void backToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDUP);
+}
+
+void leftToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDLEFT);
+}
+
+void rightToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDRIGHT);
+}
+
+
+void tonySetPerorate(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
+ g_vm->getEngine()->setPerorate(bStatus);
+}
+
+void mySleep(CORO_PARAM, uint32 dwTime, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_1(CoroScheduler.sleep, dwTime);
+
+ CORO_END_CODE;
+}
+
+void setAlwaysDisplay(CORO_PARAM, uint32 val, uint32, uint32, uint32) {
+ GLOBALS._bAlwaysDisplay = (val != 0);
+}
+
+
+void setPointer(CORO_PARAM, uint32 dwPointer, uint32, uint32, uint32) {
+ switch (dwPointer) {
+ case 1:
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_ARROWUP);
+ break;
+ case 2:
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_ARROWDOWN);
+ break;
+ case 3:
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_ARROWLEFT);
+ break;
+ case 4:
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_ARROWRIGHT);
+ break;
+ case 5:
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_ARROWMAP);
+ break;
+
+ default:
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_NONE);
+ break;
+ }
+}
+
+VoiceHeader *searchVoiceHeader(uint32 codehi, uint32 codelo) {
+ int code = (codehi << 16) | codelo;
+
+ if (g_vm->_voices.size() == 0)
+ return NULL;
+
+ for (uint i = 0; i < g_vm->_voices.size(); i++) {
+ if (g_vm->_voices[i]._code == code)
+ return &g_vm->_voices[i];
+ }
+
+ return NULL;
+}
+
+
+void sendTonyMessage(CORO_PARAM, uint32 dwMessage, uint32 nX, uint32 nY, uint32) {
+ CORO_BEGIN_CONTEXT;
+ RMMessage msg;
+ int i;
+ int curOffset;
+ VoiceHeader *curVoc;
+ FPSfx *voice;
+ RMTextDialog text;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->curOffset = 0;
+
+ if (GLOBALS._bSkipIdle)
+ return;
+
+ _ctx->msg.load(dwMessage);
+ if (!_ctx->msg.isValid())
+ return;
+
+ _ctx->curVoc = searchVoiceHeader(0, dwMessage);
+ _ctx->voice = NULL;
+ if (_ctx->curVoc) {
+ // Is positioned within the database of entries beginning at the first
+ _ctx->curOffset = _ctx->curVoc->_offset;
+
+ // First time allocation
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
+ _ctx->curOffset = g_vm->_vdbFP.pos();
+
+ _ctx->voice->setLoop(false);
+ }
+
+ if (GLOBALS._nTonyNextTalkType != GLOBALS._tony->TALK_NORMAL) {
+ CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._nTonyNextTalkType);
+
+ if (!GLOBALS._bStaticTalk)
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+ } else {
+ if (_ctx->msg.numPeriods() > 1)
+ CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._tony->TALK_HIPS);
+ else
+ CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._tony->TALK_NORMAL);
+ }
+
+ if (GLOBALS._curBackText)
+ CORO_INVOKE_0(GLOBALS._curBackText->hide);
+
+ GLOBALS._bTonyIsSpeaking = true;
+
+ for (_ctx->i = 0; _ctx->i < _ctx->msg.numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) {
+ _ctx->text.setInput(GLOBALS._input);
+
+ // Alignment
+ _ctx->text.setAlignType(RMText::HCENTER, RMText::VBOTTOM);
+
+ // Color
+ _ctx->text.setColor(0, 255, 0);
+
+ // Writes the text
+ _ctx->text.writeText(_ctx->msg[_ctx->i], 0);
+
+ // Set the position
+ if (nX == 0 && nY == 0)
+ _ctx->text.setPosition(GLOBALS._tony->position() - RMPoint(0, 130) - GLOBALS._loc->scrollPosition());
+ else
+ _ctx->text.setPosition(RMPoint(nX, nY) - GLOBALS._loc->scrollPosition());
+
+ // Handling for always display
+ if (GLOBALS._bAlwaysDisplay) {
+ _ctx->text.setAlwaysDisplay();
+ _ctx->text.forceTime();
+ }
+
+ // Record the text
+ g_vm->getEngine()->linkGraphicTask(&_ctx->text);
+
+ if (_ctx->curVoc) {
+ if (_ctx->i == 0) {
+ _ctx->voice->play();
+ _ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
+ } else {
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
+
+ _ctx->curOffset = g_vm->_vdbFP.pos();
+ _ctx->voice->setLoop(false);
+ _ctx->voice->play();
+ _ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
+ }
+ }
+
+ // Wait for the end of the display
+ _ctx->text.setCustomSkipHandle(GLOBALS._hSkipIdle);
+ CORO_INVOKE_0(_ctx->text.waitForEndDisplay);
+
+ if (_ctx->curVoc) {
+ _ctx->voice->stop();
+ _ctx->voice->release();
+ _ctx->voice = NULL;
+ }
+ }
+
+ GLOBALS._bTonyIsSpeaking = false;
+ if (GLOBALS._curBackText)
+ GLOBALS._curBackText->show();
+
+ CORO_INVOKE_0(GLOBALS._tony->endTalk);
+
+ CORO_END_CODE;
+}
+
+void changeBoxStatus(CORO_PARAM, uint32 nLoc, uint32 nBox, uint32 nStatus, uint32) {
+ GLOBALS._boxes->changeBoxStatus(nLoc, nBox, nStatus);
+}
+
+
+void custLoadLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
+ CORO_BEGIN_CONTEXT;
+ uint32 h;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._curChangedHotspot = 0;
+ if (bUseStartPos != 0)
+ g_vm->getEngine()->loadLocation(nLoc, RMPoint(tX, tY), GLOBALS._startLocPos[nLoc]);
+ else
+ g_vm->getEngine()->loadLocation(nLoc, RMPoint(tX, tY), RMPoint(-1, -1));
+
+ _ctx->h = mpalQueryDoAction(0, nLoc, 0);
+
+ // On Enter?
+ if (_ctx->h != CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+
+ CORO_END_CODE;
+}
+
+
+void sendFullscreenMsgStart(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ RMMessage *msg;
+ RMGfxClearTask clear;
+ int i;
+ RMTextDialog text;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->msg = new RMMessage(nMsg);
+
+ GLOBALS._fullScreenMessageLoc = GLOBALS._loc->TEMPGetNumLoc();
+ GLOBALS._fullScreenMessagePt = GLOBALS._tony->position();
+
+ if (GLOBALS._bSkipIdle)
+ return;
+
+ CORO_INVOKE_2(g_vm->getEngine()->unloadLocation, false, NULL);
+ GLOBALS._tony->hide();
+
+ for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) {
+ _ctx->text.setInput(GLOBALS._input);
+
+ // Alignment
+ _ctx->text.setAlignType(RMText::HCENTER, RMText::VCENTER);
+
+ // Forces the text to disappear in time
+ _ctx->text.forceTime();
+
+ // Color
+ _ctx->text.setColor(255, 255, 255);
+
+ // Write the text
+ if (nFont == 0)
+ _ctx->text.writeText((*_ctx->msg)[_ctx->i], 1);
+ else if (nFont == 1)
+ _ctx->text.writeText((*_ctx->msg)[_ctx->i], 0);
+
+ // Set the position
+ _ctx->text.setPosition(RMPoint(320, 240));
+
+ _ctx->text.setAlwaysDisplay();
+ _ctx->text.forceTime();
+
+ // Record the text
+ g_vm->getEngine()->linkGraphicTask(&_ctx->clear);
+ g_vm->getEngine()->linkGraphicTask(&_ctx->text);
+
+ // Wait for the end of display
+ _ctx->text.setCustomSkipHandle(GLOBALS._hSkipIdle);
+ CORO_INVOKE_0(_ctx->text.waitForEndDisplay);
+ }
+
+ delete _ctx->msg;
+
+ CORO_END_CODE;
+}
+
+void clearScreen(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ char buf[256];
+ RMGfxClearTask clear;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ g_vm->getEngine()->linkGraphicTask(&_ctx->clear);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ // WORKAROUND: This fixes a bug in the original source where the linked clear task
+ // didn't have time to be drawn and removed from the draw list before the method
+ // ended, thus remaining in the draw list and causing a later crash
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ CORO_END_CODE;
+}
+
+void sendFullscreenMsgEnd(CORO_PARAM, uint32 bNotEnableTony, uint32, uint32, uint32) {
+ g_vm->getEngine()->loadLocation(GLOBALS._fullScreenMessageLoc, RMPoint(GLOBALS._fullScreenMessagePt._x, GLOBALS._fullScreenMessagePt._y), RMPoint(-1, -1));
+ if (!bNotEnableTony)
+ GLOBALS._tony->show();
+
+ mCharResetCodes();
+ reapplyChangedHotspot();
+}
+
+
+void sendFullscreenMessage(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_4(sendFullscreenMsgStart, nMsg, nFont, 0, 0);
+ CORO_INVOKE_4(sendFullscreenMsgEnd, 0, 0, 0, 0);
+
+ CORO_END_CODE;
+}
+
+void noBullsEye(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._bNoBullsEye = true;
+}
+
+void closeLocation(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (!GLOBALS._bNoBullsEye) {
+ g_vm->getEngine()->initWipe(1);
+ CORO_INVOKE_0(g_vm->getEngine()->waitWipeEnd);
+ }
+
+ g_vm->stopMusic(4);
+
+ // On exit, unload
+ CORO_INVOKE_2(g_vm->getEngine()->unloadLocation, true, NULL);
+
+ CORO_END_CODE;
+}
+
+
+void changeLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
+ CORO_BEGIN_CONTEXT;
+ uint32 h;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (!GLOBALS._bNoBullsEye) {
+ g_vm->getEngine()->initWipe(1);
+ CORO_INVOKE_0(g_vm->getEngine()->waitWipeEnd);
+ }
+
+ if (GLOBALS._lastTappeto != GLOBALS._ambiance[nLoc]) {
+ g_vm->stopMusic(4);
+ }
+
+ // On exit, unfreeze
+ CORO_INVOKE_2(g_vm->getEngine()->unloadLocation, true, NULL);
+
+ GLOBALS._curChangedHotspot = 0;
+ if (bUseStartPos != 0)
+ g_vm->getEngine()->loadLocation(nLoc, RMPoint(tX, tY), GLOBALS._startLocPos[nLoc]);
+ else
+ g_vm->getEngine()->loadLocation(nLoc, RMPoint(tX, tY), RMPoint(-1, -1));
+
+ if (GLOBALS._lastTappeto != GLOBALS._ambiance[nLoc]) {
+ GLOBALS._lastTappeto = GLOBALS._ambiance[nLoc];
+ if (GLOBALS._lastTappeto != 0)
+ g_vm->playMusic(4, kAmbianceFile[GLOBALS._lastTappeto], 0, true, 2000);
+ }
+
+ if (!GLOBALS._bNoBullsEye) {
+ g_vm->getEngine()->initWipe(2);
+ }
+
+ _ctx->h = mpalQueryDoAction(0, nLoc, 0);
+
+ if (!GLOBALS._bNoBullsEye) {
+ CORO_INVOKE_0(g_vm->getEngine()->waitWipeEnd);
+ g_vm->getEngine()->closeWipe();
+ }
+
+ GLOBALS._bNoBullsEye = false;
+
+ // On Enter?
+ if (_ctx->h != CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+
+ CORO_END_CODE;
+}
+
+void setLocStartPosition(CORO_PARAM, uint32 nLoc, uint32 lX, uint32 lY, uint32) {
+ GLOBALS._startLocPos[nLoc].set(lX, lY);
+}
+
+void saveTonyPosition(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._saveTonyPos = GLOBALS._tony->position();
+ GLOBALS._saveTonyLoc = GLOBALS._loc->TEMPGetNumLoc();
+}
+
+void restoreTonyPosition(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_4(changeLocation, GLOBALS._saveTonyLoc, GLOBALS._saveTonyPos._x, GLOBALS._saveTonyPos._y, 0);
+
+ mCharResetCodes();
+
+ CORO_END_CODE;
+}
+
+void disableInput(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->getEngine()->disableInput();
+}
+
+void enableInput(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->getEngine()->enableInput();
+}
+
+void stopTony(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._tony->stopNoAction(coroParam);
+}
+
+void custEnableGUI(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS.EnableGUI();
+}
+
+void custDisableGUI(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS.DisableGUI();
+}
+
+void tonyGenericTake1(CORO_PARAM, uint32 nDirection) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->take(nDirection, 0);
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+
+ CORO_END_CODE;
+}
+
+void tonyGenericTake2(CORO_PARAM, uint32 nDirection) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->take(nDirection, 1);
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+
+ GLOBALS._tony->take(nDirection, 2);
+
+ CORO_END_CODE;
+}
+
+void tonyGenericPut1(CORO_PARAM, uint32 nDirection) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->put(nDirection, 0);
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+
+ CORO_END_CODE;
+}
+
+void tonyGenericPut2(CORO_PARAM, uint32 nDirection) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->put(nDirection, 1);
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+
+ GLOBALS._tony->put(nDirection, 2);
+
+ CORO_END_CODE;
+}
+
+
+void tonyTakeUp1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake1(coroParam, 0);
+}
+
+
+void tonyTakeMid1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake1(coroParam, 1);
+}
+
+void tonyTakeDown1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake1(coroParam, 2);
+}
+
+void tonyTakeUp2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake2(coroParam, 0);
+}
+
+
+void tonyTakeMid2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake2(coroParam, 1);
+}
+
+void tonyTakeDown2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake2(coroParam, 2);
+}
+
+void tonyPutUp1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut1(coroParam, 0);
+}
+
+void tonyPutMid1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut1(coroParam, 1);
+}
+
+void tonyPutDown1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut1(coroParam, 2);
+}
+
+void tonyPutUp2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut2(coroParam, 0);
+}
+
+void tonyPutMid2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut2(coroParam, 1);
+}
+
+void tonyPutDown2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut2(coroParam, 2);
+}
+
+
+void tonyOnTheFloor(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) {
+ if (dwParte == 0)
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_ONTHEFLOORLEFT);
+ else
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_ONTHEFLOORRIGHT);
+}
+
+void tonyGetUp(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (dwParte == 0)
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_GETUPLEFT);
+ else
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_GETUPRIGHT);
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+
+ CORO_END_CODE;
+}
+
+void tonyShepherdess(CORO_PARAM, uint32 bIsPast, uint32, uint32, uint32) {
+ GLOBALS._tony->setShepherdess(bIsPast);
+}
+
+void tonyWhistle(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WHISTLERIGHT);
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDRIGHT);
+
+ CORO_END_CODE;
+}
+
+void tonySetNumTexts(uint32 dwText) {
+ GLOBALS._dwTonyNumTexts = dwText;
+ GLOBALS._bTonyInTexts = false;
+}
+
+void tonyLaugh(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_LAUGH;
+}
+
+void tonyGiggle(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_LAUGH2;
+}
+
+void tonyHips(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_HIPS;
+}
+
+void tonySing(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SING;
+}
+
+void tonyIndicate(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_INDICATE;
+}
+
+void tonyScaredWithHands(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SCARED;
+}
+
+void tonyScaredWithoutHands(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SCARED2;
+}
+
+void tonyWithHammer(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHHAMMER;
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHHAMMER);
+}
+
+void tonyWithGlasses(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHGLASSES;
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHGLASSES);
+}
+
+void tonyWithWorm(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHWORM;
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHWORM);
+}
+
+void tonyWithRope(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHROPE;
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHROPE);
+}
+
+void tonyWithSecretary(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHSECRETARY;
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHSECRETARY);
+}
+
+void tonyWithRabbitANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHRABBIT;
+}
+
+void tonyWithRecipeANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHRECIPE;
+}
+
+void tonyWithCardsANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHCARDS;
+}
+
+void tonyWithSnowmanANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHSNOWMAN;
+}
+
+void tonyWithSnowmanStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHSNOWMANSTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITHSNOWMANSTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyWithSnowmanEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITHSNOWMANSTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyWithRabbitStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHRABBITSTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITHRABBITSTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyWithRabbitEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITHRABBITSTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyWithRecipeStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHRECIPESTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITHRECIPESTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyWithRecipeEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITHRECIPESTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyWithCardsStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHCARDSSTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITHCARDSSTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyWithCardsEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITHCARDSSTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyWithNotebookStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITH_NOTEBOOK;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITH_NOTEBOOK);
+
+ CORO_END_CODE;
+}
+
+void tonyWithNotebookEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITH_NOTEBOOK);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyWithMegaphoneStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHMEGAPHONESTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITHMEGAPHONESTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyWithMegaphoneEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITHMEGAPHONESTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyWithBeardStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHBEARDSTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITHBEARDSTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyWithBeardEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITHBEARDSTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+void tonyScaredStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SCAREDSTATIC;
+ GLOBALS._bStaticTalk = true;
+ CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_SCAREDSTATIC);
+
+ CORO_END_CODE;
+}
+
+void tonyScaredEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_SCAREDSTATIC);
+ GLOBALS._bStaticTalk = false;
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+
+ CORO_END_CODE;
+}
+
+
+void tonyDisgusted(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_DISGUSTED;
+}
+
+void tonySniffLeft(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SNIFF_LEFT);
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+ CORO_INVOKE_4(leftToMe, 0, 0, 0, 0);
+
+ CORO_END_CODE;
+}
+
+void tonySniffRight(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SNIFF_RIGHT);
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
+ CORO_INVOKE_4(rightToMe, 0, 0, 0, 0);
+
+ CORO_END_CODE;
+}
+
+void tonySarcastic(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SARCASTIC;
+}
+
+void tonyMacbeth(CORO_PARAM, uint32 nPos, uint32, uint32, uint32) {
+ switch (nPos) {
+ case 1:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH1;
+ break;
+ case 2:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH2;
+ break;
+ case 3:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH3;
+ break;
+ case 4:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH4;
+ break;
+ case 5:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH5;
+ break;
+ case 6:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH6;
+ break;
+ case 7:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH7;
+ break;
+ case 8:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH8;
+ break;
+ case 9:
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH9;
+ break;
+ }
+}
+
+
+void enableTony(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._tony->show();
+}
+
+void disableTony(CORO_PARAM, uint32 bShowShadow, uint32, uint32, uint32) {
+ GLOBALS._tony->hide(bShowShadow);
+}
+
+void waitForPatternEnd(CORO_PARAM, uint32 nItem, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ RMItem *item;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->item = GLOBALS._loc->getItemFromCode(nItem);
+
+ if (!GLOBALS._bSkipIdle && _ctx->item != NULL)
+ CORO_INVOKE_1(_ctx->item->waitForEndPattern, GLOBALS._hSkipIdle);
+
+ CORO_END_CODE;
+}
+
+
+void setTonyPosition(CORO_PARAM, uint32 nX, uint32 nY, uint32 nLoc, uint32) {
+ GLOBALS._tony->setPosition(RMPoint(nX, nY), nLoc);
+}
+
+void moveTonyAndWait(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // WORKAROUND: Delay for a frame before starting the move to give any previous move time to finish.
+ // This fixes a bug in the first scene where if you immediately 'Use Door', Tony moves to the door,
+ // and then floats to the right rather than properly walking.
+ CORO_SLEEP(1);
+
+ CORO_INVOKE_1(GLOBALS._tony->move, RMPoint(nX, nY));
+
+ if (!GLOBALS._bSkipIdle)
+ CORO_INVOKE_0(GLOBALS._tony->waitForEndMovement);
+
+ CORO_END_CODE;
+}
+
+void moveTony(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) {
+ GLOBALS._tony->move(coroParam, RMPoint(nX, nY));
+}
+
+void scrollLocation(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
+ CORO_BEGIN_CONTEXT;
+ int lx, ly;
+ RMPoint pt;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Take the scroll coordinates
+ _ctx->lx = (int32)nX;
+ _ctx->ly = (int32)nY;
+
+ _ctx->pt = GLOBALS._loc->scrollPosition();
+
+ while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS._bSkipIdle) {
+ if (_ctx->lx > 0) {
+ _ctx->lx -= (int32)sX;
+ if (_ctx->lx < 0)
+ _ctx->lx = 0;
+ _ctx->pt.offset((int32)sX, 0);
+ } else if (_ctx->lx < 0) {
+ _ctx->lx += (int32)sX;
+ if (_ctx->lx > 0)
+ _ctx->lx = 0;
+ _ctx->pt.offset(-(int32)sX, 0);
+ }
+
+ if (_ctx->ly > 0) {
+ _ctx->ly -= sY;
+ if (_ctx->ly < 0)
+ _ctx->ly = 0;
+ _ctx->pt.offset(0, sY);
+ } else if (_ctx->ly < 0) {
+ _ctx->ly += sY;
+ if (_ctx->ly > 0)
+ _ctx->ly = 0;
+ _ctx->pt.offset(0, -(int32)sY);
+ }
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ GLOBALS._loc->setScrollPosition(_ctx->pt);
+ GLOBALS._tony->setScrollPosition(_ctx->pt);
+ }
+
+ CORO_END_CODE;
+}
+
+void syncScrollLocation(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
+ CORO_BEGIN_CONTEXT;
+ int lx, ly;
+ RMPoint pt, startpt;
+ uint32 dwStartTime, dwCurTime, dwTotalTime;
+ uint32 stepX, stepY;
+ int dimx, dimy;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Take the scroll coordinates
+ _ctx->lx = (int32)nX;
+ _ctx->ly = (int32)nY;
+ _ctx->dimx = _ctx->lx;
+ _ctx->dimy = _ctx->ly;
+ if (_ctx->lx < 0)
+ _ctx->dimx = -_ctx->lx;
+
+ if (_ctx->ly < 0)
+ _ctx->dimy = -_ctx->ly;
+
+ _ctx->stepX = sX;
+ _ctx->stepY = sY;
+
+ _ctx->startpt = GLOBALS._loc->scrollPosition();
+
+ _ctx->dwStartTime = g_vm->getTime();
+
+ if (sX)
+ _ctx->dwTotalTime = _ctx->dimx * (1000 / 35) / sX;
+ else
+ _ctx->dwTotalTime = _ctx->dimy * (1000 / 35) / sY;
+
+ while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS._bSkipIdle) {
+ _ctx->dwCurTime = g_vm->getTime() - _ctx->dwStartTime;
+ if (_ctx->dwCurTime > _ctx->dwTotalTime)
+ break;
+
+ _ctx->pt = _ctx->startpt;
+
+ if (sX) {
+ if (_ctx->lx > 0)
+ _ctx->pt._x += (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
+ else
+ _ctx->pt._x -= (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
+ } else {
+ if (_ctx->ly > 0)
+ _ctx->pt._y += (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
+ else
+ _ctx->pt._y -= (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
+
+ }
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ GLOBALS._loc->setScrollPosition(_ctx->pt);
+ GLOBALS._tony->setScrollPosition(_ctx->pt);
+
+ }
+
+
+ // Set the position finale
+ if (sX) {
+ if (_ctx->lx > 0)
+ _ctx->pt._x = _ctx->startpt._x + _ctx->dimx;
+ else
+ _ctx->pt._x = _ctx->startpt._x - _ctx->dimx;
+ } else {
+ if (_ctx->ly > 0)
+ _ctx->pt._y = _ctx->startpt._y + _ctx->dimy;
+ else
+ _ctx->pt._y = _ctx->startpt._y - _ctx->dimy;
+ }
+
+ GLOBALS._loc->setScrollPosition(_ctx->pt);
+ GLOBALS._tony->setScrollPosition(_ctx->pt);
+
+ CORO_END_CODE;
+}
+
+
+void changeHotspot(CORO_PARAM, uint32 dwCode, uint32 nX, uint32 nY, uint32) {
+ int i;
+
+ for (i = 0; i < GLOBALS._curChangedHotspot; i++) {
+ if (GLOBALS._changedHotspot[i]._dwCode == dwCode) {
+ GLOBALS._changedHotspot[i]._nX = nX;
+ GLOBALS._changedHotspot[i]._nY = nY;
+ break;
+ }
+ }
+
+ if (i == GLOBALS._curChangedHotspot) {
+ GLOBALS._changedHotspot[i]._dwCode = dwCode;
+ GLOBALS._changedHotspot[i]._nX = nX;
+ GLOBALS._changedHotspot[i]._nY = nY;
+ GLOBALS._curChangedHotspot++;
+ }
+
+ GLOBALS._loc->getItemFromCode(dwCode)->changeHotspot(RMPoint(nX, nY));
+}
+
+
+void autoSave(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->autoSave(coroParam);
+}
+
+void abortGame(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ error("script called abortGame");
+}
+
+void shakeScreen(CORO_PARAM, uint32 nScosse, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ uint32 i;
+ uint32 curTime;
+ int dirx, diry;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->curTime = g_vm->getTime();
+
+ _ctx->dirx = 1;
+ _ctx->diry = 1;
+
+ while (g_vm->getTime() < _ctx->curTime + nScosse) {
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ GLOBALS._loc->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry));
+ GLOBALS._tony->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry));
+
+ _ctx->i = g_vm->_randomSource.getRandomNumber(2);
+
+ if (_ctx->i == 0 || _ctx->i == 2)
+ _ctx->dirx = -_ctx->dirx;
+ else if (_ctx->i == 1 || _ctx->i == 2)
+ _ctx->diry = -_ctx->diry;
+ }
+
+ GLOBALS._loc->setFixedScroll(RMPoint(0, 0));
+ GLOBALS._tony->setFixedScroll(RMPoint(0, 0));
+
+ CORO_END_CODE;
+}
+
+/*
+ * Characters
+ */
+
+void charSetCode(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
+ assert(nChar < 16);
+ GLOBALS._character[nChar]._code = nCode;
+ GLOBALS._character[nChar]._item = GLOBALS._loc->getItemFromCode(nCode);
+ GLOBALS._character[nChar]._r = 255;
+ GLOBALS._character[nChar]._g = 255;
+ GLOBALS._character[nChar]._b = 255;
+ GLOBALS._character[nChar]._talkPattern = 0;
+ GLOBALS._character[nChar]._startTalkPattern = 0;
+ GLOBALS._character[nChar]._endTalkPattern = 0;
+ GLOBALS._character[nChar]._standPattern = 0;
+
+ GLOBALS._isMChar[nChar] = false;
+}
+
+void charSetColor(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
+ assert(nChar < 16);
+ GLOBALS._character[nChar]._r = r;
+ GLOBALS._character[nChar]._g = g;
+ GLOBALS._character[nChar]._b = b;
+}
+
+void charSetTalkPattern(CORO_PARAM, uint32 nChar, uint32 tp, uint32 sp, uint32) {
+ assert(nChar < 16);
+ GLOBALS._character[nChar]._talkPattern = tp;
+ GLOBALS._character[nChar]._standPattern = sp;
+}
+
+void charSetStartEndTalkPattern(CORO_PARAM, uint32 nChar, uint32 sp, uint32 ep, uint32) {
+ assert(nChar < 16);
+ GLOBALS._character[nChar]._startTalkPattern = sp;
+ GLOBALS._character[nChar]._endTalkPattern = ep;
+}
+
+void charSendMessage(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32) {
+ CORO_BEGIN_CONTEXT;
+ RMMessage *msg;
+ int i;
+ RMPoint pt;
+ RMTextDialog *text;
+ int curOffset;
+ VoiceHeader *curVoc;
+ FPSfx *voice;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->msg = new RMMessage(dwMessage);
+ _ctx->curOffset = 0;
+
+ assert(nChar < 16);
+ _ctx->pt = GLOBALS._character[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition();
+
+ if (GLOBALS._character[nChar]._startTalkPattern != 0) {
+ GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._startTalkPattern);
+
+ CORO_INVOKE_0(GLOBALS._character[nChar]._item->waitForEndPattern);
+ }
+
+ GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._talkPattern);
+
+ _ctx->curVoc = searchVoiceHeader(0, dwMessage);
+ _ctx->voice = NULL;
+ if (_ctx->curVoc) {
+ // Position within the database of entries, beginning at the first
+ g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
+ _ctx->curOffset = _ctx->curVoc->_offset;
+ }
+
+ for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) {
+ if (bIsBack) {
+ GLOBALS._curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS._loc);
+ if (GLOBALS._bTonyIsSpeaking)
+ CORO_INVOKE_0(GLOBALS._curBackText->hide);
+ } else
+ _ctx->text = new RMTextDialog;
+
+ _ctx->text->setInput(GLOBALS._input);
+
+ // Skipping
+ _ctx->text->setSkipStatus(!bIsBack);
+
+ // Alignment
+ _ctx->text->setAlignType(RMText::HCENTER, RMText::VBOTTOM);
+
+ // Color
+ _ctx->text->setColor(GLOBALS._character[nChar]._r, GLOBALS._character[nChar]._g, GLOBALS._character[nChar]._b);
+
+ // Write the text
+ _ctx->text->writeText((*_ctx->msg)[_ctx->i], 0);
+
+ // Set the position
+ _ctx->text->setPosition(_ctx->pt);
+
+ // Set the always display
+ if (GLOBALS._bAlwaysDisplay) {
+ _ctx->text->setAlwaysDisplay();
+ _ctx->text->forceTime();
+ }
+
+ // Record the text
+ g_vm->getEngine()->linkGraphicTask(_ctx->text);
+
+ if (_ctx->curVoc) {
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
+ _ctx->voice->setLoop(false);
+ if (bIsBack)
+ _ctx->voice->setVolume(55);
+ _ctx->voice->play();
+ _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
+ _ctx->curOffset = g_vm->_vdbFP.pos();
+ }
+
+ // Wait for the end of display
+ _ctx->text->setCustomSkipHandle(GLOBALS._hSkipIdle);
+ CORO_INVOKE_0(_ctx->text->waitForEndDisplay);
+
+ if (_ctx->curVoc) {
+ _ctx->voice->stop();
+ _ctx->voice->release();
+ _ctx->voice = NULL;
+ }
+
+
+ GLOBALS._curBackText = NULL;
+ delete _ctx->text;
+ }
+
+ if (GLOBALS._character[nChar]._endTalkPattern != 0) {
+ GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._endTalkPattern);
+ CORO_INVOKE_0(GLOBALS._character[nChar]._item->waitForEndPattern);
+ }
+
+ GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._standPattern);
+ delete _ctx->msg;
+
+ CORO_END_CODE;
+}
+
+void addInventory(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
+ GLOBALS._inventory->addItem(dwCode);
+}
+
+void removeInventory(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
+ GLOBALS._inventory->removeItem(dwCode);
+}
+
+void changeInventoryStatus(CORO_PARAM, uint32 dwCode, uint32 dwStatus, uint32, uint32) {
+ GLOBALS._inventory->changeItemStatus(dwCode, dwStatus);
+}
+
+
+/*
+ * Master Characters
+ */
+
+void mCharSetCode(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
+ assert(nChar < 10);
+ GLOBALS._mCharacter[nChar]._code = nCode;
+ if (nCode == 0)
+ GLOBALS._mCharacter[nChar]._item = NULL;
+ else
+ GLOBALS._mCharacter[nChar]._item = GLOBALS._loc->getItemFromCode(nCode);
+ GLOBALS._mCharacter[nChar]._r = 255;
+ GLOBALS._mCharacter[nChar]._g = 255;
+ GLOBALS._mCharacter[nChar]._b = 255;
+ GLOBALS._mCharacter[nChar]._x = -1;
+ GLOBALS._mCharacter[nChar]._y = -1;
+ GLOBALS._mCharacter[nChar]._bAlwaysBack = 0;
+
+ for (int i = 0; i < 10; i++)
+ GLOBALS._mCharacter[nChar]._numTalks[i] = 1;
+
+ GLOBALS._mCharacter[nChar]._curGroup = 0;
+
+ GLOBALS._isMChar[nChar] = true;
+}
+
+void mCharResetCode(CORO_PARAM, uint32 nChar, uint32, uint32, uint32) {
+ GLOBALS._mCharacter[nChar]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[nChar]._code);
+}
+
+
+void mCharSetPosition(CORO_PARAM, uint32 nChar, uint32 nX, uint32 nY, uint32) {
+ assert(nChar < 10);
+ GLOBALS._mCharacter[nChar]._x = nX;
+ GLOBALS._mCharacter[nChar]._y = nY;
+}
+
+void mCharSetColor(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
+ assert(nChar < 10);
+ GLOBALS._mCharacter[nChar]._r = r;
+ GLOBALS._mCharacter[nChar]._g = g;
+ GLOBALS._mCharacter[nChar]._b = b;
+}
+
+void mCharSetNumTalksInGroup(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32 nTalks, uint32) {
+ assert(nChar < 10);
+ assert(nGroup < 10);
+
+ GLOBALS._mCharacter[nChar]._numTalks[nGroup] = nTalks;
+}
+
+void mCharSetCurrentGroup(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32, uint32) {
+ assert(nChar < 10);
+ assert(nGroup < 10);
+
+ GLOBALS._mCharacter[nChar]._curGroup = nGroup;
+}
+
+void mCharSetNumTexts(CORO_PARAM, uint32 nChar, uint32 nTexts, uint32, uint32) {
+ assert(nChar < 10);
+
+ GLOBALS._mCharacter[nChar]._numTexts = nTexts - 1;
+ GLOBALS._mCharacter[nChar]._bInTexts = false;
+}
+
+void mCharSetAlwaysBack(CORO_PARAM, uint32 nChar, uint32 bAlwaysBack, uint32, uint32) {
+ assert(nChar < 10);
+
+ GLOBALS._mCharacter[nChar]._bAlwaysBack = bAlwaysBack;
+}
+
+void mCharSendMessage(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32 nFont) {
+ CORO_BEGIN_CONTEXT;
+ RMMessage *msg;
+ int i;
+ int parm;
+ RMPoint pt;
+ uint32 h;
+ RMTextDialog *text;
+ int curOffset;
+ VoiceHeader *curVoc;
+ FPSfx *voice;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->msg = new RMMessage(dwMessage);
+ _ctx->curOffset = 0;
+
+ assert(nChar < 10);
+
+ bIsBack |= GLOBALS._mCharacter[nChar]._bAlwaysBack ? 1 : 0;
+
+ // Calculates the position of the text according to the current frame
+ if (GLOBALS._mCharacter[nChar]._x == -1)
+ _ctx->pt = GLOBALS._mCharacter[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition();
+ else
+ _ctx->pt = RMPoint(GLOBALS._mCharacter[nChar]._x, GLOBALS._mCharacter[nChar]._y);
+
+ // Parameter for special actions: random between the spoken
+ _ctx->parm = (GLOBALS._mCharacter[nChar]._curGroup * 10) + g_vm->_randomSource.getRandomNumber(
+ GLOBALS._mCharacter[nChar]._numTalks[GLOBALS._mCharacter[nChar]._curGroup] - 1) + 1;
+
+ // Try to run the custom function to initialize the speech
+ if (GLOBALS._mCharacter[nChar]._item) {
+ _ctx->h = mpalQueryDoAction(30, GLOBALS._mCharacter[nChar]._item->mpalCode(), _ctx->parm);
+ if (_ctx->h != CORO_INVALID_PID_VALUE) {
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+ }
+ }
+
+ _ctx->curVoc = searchVoiceHeader(0, dwMessage);
+ _ctx->voice = NULL;
+ if (_ctx->curVoc) {
+ // Position within the database of entries, beginning at the first
+ g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
+ _ctx->curOffset = _ctx->curVoc->_offset;
+ }
+
+ for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) {
+ // Create a different object depending on whether it's background or not
+ if (bIsBack) {
+ GLOBALS._curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS._loc);
+ if (GLOBALS._bTonyIsSpeaking)
+ CORO_INVOKE_0(GLOBALS._curBackText->hide);
+ } else
+ _ctx->text = new RMTextDialog;
+
+ _ctx->text->setInput(GLOBALS._input);
+
+ // Skipping
+ _ctx->text->setSkipStatus(!bIsBack);
+
+ // Alignment
+ _ctx->text->setAlignType(RMText::HCENTER, RMText::VBOTTOM);
+
+ // Color
+ _ctx->text->setColor(GLOBALS._mCharacter[nChar]._r, GLOBALS._mCharacter[nChar]._g, GLOBALS._mCharacter[nChar]._b);
+
+ // Write the text
+ _ctx->text->writeText((*_ctx->msg)[_ctx->i], nFont);
+
+ // Set the position
+ _ctx->text->setPosition(_ctx->pt);
+
+ // Set the always display
+ if (GLOBALS._bAlwaysDisplay) {
+ _ctx->text->setAlwaysDisplay();
+ _ctx->text->forceTime();
+ }
+
+ // Record the text
+ g_vm->getEngine()->linkGraphicTask(_ctx->text);
+
+ if (_ctx->curVoc) {
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
+ _ctx->voice->setLoop(false);
+ if (bIsBack)
+ _ctx->voice->setVolume(55);
+ _ctx->voice->play();
+ _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
+ _ctx->curOffset = g_vm->_vdbFP.pos();
+ }
+
+ // Wait for the end of display
+ _ctx->text->setCustomSkipHandle(GLOBALS._hSkipIdle);
+ CORO_INVOKE_0(_ctx->text->waitForEndDisplay);
+
+ if (_ctx->curVoc) {
+ _ctx->voice->stop();
+ _ctx->voice->release();
+ _ctx->voice = NULL;
+ }
+
+ GLOBALS._curBackText = NULL;
+ delete _ctx->text;
+ }
+
+ delete _ctx->msg;
+
+ // Try to run the custom function to close the speech
+ if (GLOBALS._mCharacter[nChar]._item) {
+ _ctx->h = mpalQueryDoAction(31, GLOBALS._mCharacter[nChar]._item->mpalCode(), _ctx->parm);
+ if (_ctx->h != CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+ }
+
+ CORO_END_CODE;
+}
+
+/*
+ * Dialogs
+ */
+
+void sendDialogMessage(CORO_PARAM, uint32 nPers, uint32 nMsg, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ char *string;
+ RMTextDialog *text;
+ int parm;
+ uint32 h;
+ bool bIsBack;
+ VoiceHeader *curVoc;
+ FPSfx *voice;
+ RMPoint pt;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->bIsBack = false;
+
+ // The SendDialogMessage can go in the background if it is a character
+ if (nPers != 0 && GLOBALS._isMChar[nPers] && GLOBALS._mCharacter[nPers]._bAlwaysBack)
+ _ctx->bIsBack = true;
+
+ _ctx->curVoc = searchVoiceHeader(GLOBALS._curDialog, nMsg);
+ _ctx->voice = NULL;
+
+ if (_ctx->curVoc) {
+ // Position within the database of entries, beginning at the first
+ g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
+ _ctx->voice->setLoop(false);
+ if (_ctx->bIsBack)
+ _ctx->voice->setVolume(55);
+ }
+
+ _ctx->string = mpalQueryDialogPeriod(nMsg);
+
+ if (nPers == 0) {
+ _ctx->text = new RMTextDialog;
+ _ctx->text->setColor(0, 255, 0);
+ _ctx->text->setPosition(GLOBALS._tony->position() - RMPoint(0, 130) - GLOBALS._loc->scrollPosition());
+ _ctx->text->writeText(_ctx->string, 0);
+
+ if (GLOBALS._dwTonyNumTexts > 0) {
+ if (!GLOBALS._bTonyInTexts) {
+ if (GLOBALS._nTonyNextTalkType != GLOBALS._tony->TALK_NORMAL) {
+ CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._nTonyNextTalkType);
+ if (!GLOBALS._bStaticTalk)
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+ } else
+ CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._tony->TALK_NORMAL);
+
+ GLOBALS._bTonyInTexts = true;
+ }
+ GLOBALS._dwTonyNumTexts--;
+ } else {
+ CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._nTonyNextTalkType);
+ if (!GLOBALS._bStaticTalk)
+ GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL;
+ }
+ } else if (!GLOBALS._isMChar[nPers]) {
+ _ctx->text = new RMTextDialog;
+
+ _ctx->pt = GLOBALS._character[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition();
+
+ if (GLOBALS._character[nPers]._startTalkPattern != 0) {
+ GLOBALS._character[nPers]._item->setPattern(GLOBALS._character[nPers]._startTalkPattern);
+ CORO_INVOKE_0(GLOBALS._character[nPers]._item->waitForEndPattern);
+ }
+
+ GLOBALS._character[nPers]._item->setPattern(GLOBALS._character[nPers]._talkPattern);
+
+ _ctx->text->setColor(GLOBALS._character[nPers]._r, GLOBALS._character[nPers]._g, GLOBALS._character[nPers]._b);
+ _ctx->text->writeText(_ctx->string, 0);
+ _ctx->text->setPosition(_ctx->pt);
+ } else {
+ if (GLOBALS._mCharacter[nPers]._x == -1)
+ _ctx->pt = GLOBALS._mCharacter[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition();
+ else
+ _ctx->pt = RMPoint(GLOBALS._mCharacter[nPers]._x, GLOBALS._mCharacter[nPers]._y);
+
+ // Parameter for special actions. Random between the spoken.
+ _ctx->parm = (GLOBALS._mCharacter[nPers]._curGroup * 10) + g_vm->_randomSource.getRandomNumber(
+ GLOBALS._mCharacter[nPers]._numTalks[GLOBALS._mCharacter[nPers]._curGroup] - 1) + 1;
+
+ if (GLOBALS._mCharacter[nPers]._numTexts != 0 && GLOBALS._mCharacter[nPers]._bInTexts) {
+ GLOBALS._mCharacter[nPers]._numTexts--;
+ } else {
+ // Try to run the custom function to initialize the speech
+ _ctx->h = mpalQueryDoAction(30, GLOBALS._mCharacter[nPers]._item->mpalCode(), _ctx->parm);
+ if (_ctx->h != CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+
+ GLOBALS._mCharacter[nPers]._curTalk = _ctx->parm;
+
+ if (GLOBALS._mCharacter[nPers]._numTexts != 0) {
+ GLOBALS._mCharacter[nPers]._bInTexts = true;
+ GLOBALS._mCharacter[nPers]._numTexts--;
+ }
+ }
+
+ if (GLOBALS._mCharacter[nPers]._bAlwaysBack) {
+ _ctx->text = GLOBALS._curBackText = new RMTextDialogScrolling(GLOBALS._loc);
+ if (GLOBALS._bTonyIsSpeaking)
+ CORO_INVOKE_0(GLOBALS._curBackText->hide);
+
+ _ctx->bIsBack = true;
+ } else
+ _ctx->text = new RMTextDialog;
+
+ _ctx->text->setSkipStatus(!GLOBALS._mCharacter[nPers]._bAlwaysBack);
+ _ctx->text->setColor(GLOBALS._mCharacter[nPers]._r, GLOBALS._mCharacter[nPers]._g, GLOBALS._mCharacter[nPers]._b);
+ _ctx->text->writeText(_ctx->string, 0);
+ _ctx->text->setPosition(_ctx->pt);
+ }
+
+ if (!GLOBALS._bSkipIdle) {
+ _ctx->text->setInput(GLOBALS._input);
+ if (GLOBALS._bAlwaysDisplay) {
+ _ctx->text->setAlwaysDisplay();
+ _ctx->text->forceTime();
+ }
+ _ctx->text->setAlignType(RMText::HCENTER, RMText::VBOTTOM);
+ g_vm->getEngine()->linkGraphicTask(_ctx->text);
+
+ if (_ctx->curVoc) {
+ _ctx->voice->play();
+ _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
+ }
+
+ // Wait for the end of display
+ _ctx->text->setCustomSkipHandle(GLOBALS._hSkipIdle);
+ CORO_INVOKE_0(_ctx->text->waitForEndDisplay);
+ }
+
+ if (_ctx->curVoc) {
+ _ctx->voice->stop();
+ _ctx->voice->release();
+ _ctx->voice = NULL;
+ }
+
+ if (nPers != 0) {
+ if (!GLOBALS._isMChar[nPers]) {
+ if (GLOBALS._character[nPers]._endTalkPattern != 0) {
+ GLOBALS._character[nPers]._item->setPattern(GLOBALS._character[nPers]._endTalkPattern);
+ CORO_INVOKE_0(GLOBALS._character[nPers]._item->waitForEndPattern);
+ }
+
+ GLOBALS._character[nPers]._item->setPattern(GLOBALS._character[nPers]._standPattern);
+ delete _ctx->text;
+ } else {
+ if ((GLOBALS._mCharacter[nPers]._bInTexts && GLOBALS._mCharacter[nPers]._numTexts == 0) || !GLOBALS._mCharacter[nPers]._bInTexts) {
+ // Try to run the custom function to close the speech
+ GLOBALS._mCharacter[nPers]._curTalk = (GLOBALS._mCharacter[nPers]._curTalk % 10) + GLOBALS._mCharacter[nPers]._curGroup * 10;
+ _ctx->h = mpalQueryDoAction(31, GLOBALS._mCharacter[nPers]._item->mpalCode(), GLOBALS._mCharacter[nPers]._curTalk);
+ if (_ctx->h != CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+
+ GLOBALS._mCharacter[nPers]._bInTexts = false;
+ GLOBALS._mCharacter[nPers]._numTexts = 0;
+ }
+
+ GLOBALS._curBackText = NULL;
+ delete _ctx->text;
+ }
+ } else {
+ if ((GLOBALS._dwTonyNumTexts == 0 && GLOBALS._bTonyInTexts) || !GLOBALS._bTonyInTexts) {
+ CORO_INVOKE_0(GLOBALS._tony->endTalk);
+ GLOBALS._dwTonyNumTexts = 0;
+ GLOBALS._bTonyInTexts = false;
+ }
+
+ delete _ctx->text;
+ }
+
+ globalDestroy(_ctx->string);
+
+ CORO_END_CODE;
+}
+
+
+// @@@@ This cannot be skipped!!!!!!!!!!!!!!!!!!!
+
+void startDialog(CORO_PARAM, uint32 nDialog, uint32 nStartGroup, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ uint32 nChoice;
+ uint32 *sl;
+ uint32 i, num;
+ char *string;
+ RMDialogChoice dc;
+ int sel;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ GLOBALS._curDialog = nDialog;
+
+ // Call MPAL to start the dialog
+ mpalQueryDoDialog(nDialog, nStartGroup);
+
+ // Wait until a choice is selected
+ mpalQueryDialogWaitForChoice(&_ctx->nChoice);
+ while (_ctx->nChoice != (uint32) - 1) {
+ // Get the list of options
+ _ctx->sl = mpalQueryDialogSelectList(_ctx->nChoice);
+ for (_ctx->num = 0; _ctx->sl[_ctx->num] != 0; _ctx->num++)
+ ;
+
+ // If there is only one option, do it automatically, and wait for the next choice
+ if (_ctx->num == 1) {
+ mpalQueryDialogSelectionDWORD(_ctx->nChoice, _ctx->sl[0]);
+ globalDestroy(_ctx->sl);
+
+ // Wait for the next choice to be made
+ mpalQueryDialogWaitForChoice(&_ctx->nChoice);
+ continue;
+ }
+
+ // Making a choice for dialog
+ _ctx->dc.init();
+ _ctx->dc.setNumChoices(_ctx->num);
+
+ // Writeall the possible options
+ for (_ctx->i = 0; _ctx->i < _ctx->num; _ctx->i++) {
+ _ctx->string = mpalQueryDialogPeriod(_ctx->sl[_ctx->i]);
+ assert(_ctx->string != NULL);
+ _ctx->dc.addChoice(_ctx->string);
+ globalDestroy(_ctx->string);
+ }
+
+ // Activate the object
+ g_vm->getEngine()->linkGraphicTask(&_ctx->dc);
+ CORO_INVOKE_0(_ctx->dc.show);
+
+ // Draw the pointer
+ GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_NONE);
+ g_vm->getEngine()->enableMouse();
+
+ while (!(GLOBALS._input->mouseLeftClicked() && ((_ctx->sel = _ctx->dc.getSelection()) != -1))) {
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ CORO_INVOKE_1(_ctx->dc.doFrame, GLOBALS._input->mousePos());
+ }
+
+ // Hide the pointer
+ g_vm->getEngine()->disableMouse();
+
+ CORO_INVOKE_0(_ctx->dc.hide);
+ mpalQueryDialogSelectionDWORD(_ctx->nChoice, _ctx->sl[_ctx->sel]);
+
+ // Closes the choice
+ _ctx->dc.close();
+
+ globalDestroy(_ctx->sl);
+
+ // Wait for the next choice to be made
+ mpalQueryDialogWaitForChoice(&_ctx->nChoice);
+ }
+
+ CORO_END_CODE;
+}
+
+
+/*
+ * Sync between idle and mpal
+ */
+
+void takeOwnership(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (GLOBALS._mut[num]._ownerPid != (uint32)CoroScheduler.getCurrentPID()) {
+ // The mutex is currently owned by a different process.
+ // Wait for the event to be signalled, which means the mutex is free.
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._mut[num]._eventId, CORO_INFINITE);
+ GLOBALS._mut[num]._ownerPid = (uint32)CoroScheduler.getCurrentPID();
+ }
+
+ GLOBALS._mut[num]._lockCount++;
+
+ CORO_END_CODE;
+}
+
+void releaseOwnership(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
+ if (!GLOBALS._mut[num]._lockCount) {
+ warning("ReleaseOwnership tried to release mutex %d, which isn't held", num);
+ return;
+ }
+
+ if (GLOBALS._mut[num]._ownerPid != (uint32)CoroScheduler.getCurrentPID()) {
+ warning("ReleaseOwnership tried to release mutex %d, which is held by a different process", num);
+ return;
+ }
+
+ GLOBALS._mut[num]._lockCount--;
+ if (!GLOBALS._mut[num]._lockCount) {
+ GLOBALS._mut[num]._ownerPid = 0;
+
+ // Signal the event, to wake up processes waiting for the lock.
+ CoroScheduler.setEvent(GLOBALS._mut[num]._eventId);
+ }
+}
+
+/*
+ * Music
+ * -----
+ *
+ * Fadeout effects supposed:
+ *
+ * nFX = 0 - The new music replaces the old one
+ * nFX=1 - The new music interfades with the old one
+ * nFX=2 - The new music takes over in time from the old
+ *
+ */
+
+void threadFadeInMusic(CORO_PARAM, const void *nMusic) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ int nChannel = *(const int *)nMusic;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ debugC(DEBUG_INTERMEDIATE, kTonyDebugSound, "Start FadeIn Music");
+
+ for (_ctx->i = 0; _ctx->i < 16; _ctx->i++) {
+ g_vm->setMusicVolume(nChannel, _ctx->i * 4);
+
+ CORO_INVOKE_1(CoroScheduler.sleep, 100);
+ }
+ g_vm->setMusicVolume(nChannel, 64);
+
+ debugC(DEBUG_INTERMEDIATE, kTonyDebugSound, "End FadeIn Music");
+
+ CORO_KILL_SELF();
+
+ CORO_END_CODE;
+}
+
+void threadFadeOutMusic(CORO_PARAM, const void *nMusic) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ int startVolume;
+ CORO_END_CONTEXT(_ctx);
+
+ int nChannel = *(const int *)nMusic;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->startVolume = g_vm->getMusicVolume(nChannel);
+
+ for (_ctx->i = 16; _ctx->i > 0 && !GLOBALS._bFadeOutStop; _ctx->i--) {
+ if (_ctx->i * 4 < _ctx->startVolume)
+ g_vm->setMusicVolume(nChannel, _ctx->i * 4);
+
+ CORO_INVOKE_1(CoroScheduler.sleep, 100);
+ }
+
+ if (!GLOBALS._bFadeOutStop)
+ g_vm->setMusicVolume(nChannel, 0);
+
+ // If a jingle is played, stop it
+ if (nChannel == 2)
+ g_vm->stopMusic(2);
+
+ CORO_KILL_SELF();
+
+ CORO_END_CODE;
+}
+
+void fadeInSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CoroScheduler.createProcess(threadFadeInMusic, &GLOBALS._curSoundEffect, sizeof(int));
+}
+
+void fadeOutSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._bFadeOutStop = false;
+ CoroScheduler.createProcess(threadFadeOutMusic, &GLOBALS._curSoundEffect, sizeof(int));
+}
+
+void fadeOutJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._bFadeOutStop = false;
+ int channel = 2;
+ CoroScheduler.createProcess(threadFadeOutMusic, &channel, sizeof(int));
+}
+
+void fadeInJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ int channel = 2;
+ CoroScheduler.createProcess(threadFadeInMusic, &channel, sizeof(int));
+}
+
+void stopSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->stopMusic(GLOBALS._curSoundEffect);
+}
+
+void stopJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->stopMusic(2);
+}
+
+void muteSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->setMusicVolume(GLOBALS._curSoundEffect, 0);
+}
+
+void demuteSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._bFadeOutStop = true;
+ g_vm->setMusicVolume(GLOBALS._curSoundEffect, 64);
+}
+
+void muteJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->setMusicVolume(2, 0);
+}
+
+void demuteJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ g_vm->setMusicVolume(2, 64);
+}
+
+void custPlayMusic(uint32 nChannel, const char *mFN, uint32 nFX, bool bLoop, int nSync = 0) {
+ if (nSync == 0)
+ nSync = 2000;
+ debugC(DEBUG_INTERMEDIATE, kTonyDebugMusic, "Start CustPlayMusic");
+ g_vm->playMusic(nChannel, mFN, nFX, bLoop, nSync);
+ debugC(DEBUG_INTERMEDIATE, kTonyDebugMusic, "End CustPlayMusic");
+}
+
+void playSoundEffect(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bNoLoop, uint32) {
+ if (nFX == 0 || nFX == 1 || nFX == 2) {
+ debugC(DEBUG_INTERMEDIATE, kTonyDebugSound, "PlaySoundEffect stop fadeout");
+ GLOBALS._bFadeOutStop = true;
+ }
+
+ GLOBALS._lastMusic = nMusic;
+ custPlayMusic(GLOBALS._curSoundEffect, kMusicFiles[nMusic]._name, nFX, bNoLoop ? false : true, kMusicFiles[nMusic]._sync);
+}
+
+void playJingle(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bLoop, uint32) {
+ custPlayMusic(2, kJingleFileNames[nMusic], nFX, bLoop);
+}
+
+void playItemSfx(CORO_PARAM, uint32 nItem, uint32 nSFX, uint32, uint32) {
+ if (nItem == 0) {
+ GLOBALS._tony->playSfx(nSFX);
+ } else {
+ RMItem *item = GLOBALS._loc->getItemFromCode(nItem);
+ if (item)
+ item->playSfx(nSFX);
+ }
+}
+
+void restoreMusic(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_4(playSoundEffect, GLOBALS._lastMusic, 0, 0, 0);
+
+ if (GLOBALS._lastTappeto != 0)
+ custPlayMusic(4, kAmbianceFile[GLOBALS._lastTappeto], 0, true);
+
+ CORO_END_CODE;
+}
+
+void saveMusic(Common::OutSaveFile *f) {
+ f->writeByte(GLOBALS._lastMusic);
+ f->writeByte(GLOBALS._lastTappeto);
+}
+
+void loadMusic(Common::InSaveFile *f) {
+ GLOBALS._lastMusic = f->readByte();
+ GLOBALS._lastTappeto = f->readByte();
+}
+
+void jingleFadeStart(CORO_PARAM, uint32 nJingle, uint32 bLoop, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_4(fadeOutSoundEffect, 0, 0, 0, 0);
+ CORO_INVOKE_4(muteJingle, 0, 0, 0, 0);
+ CORO_INVOKE_4(playJingle, nJingle, 0, bLoop, 0);
+ CORO_INVOKE_4(fadeInJingle, 0, 0, 0, 0);
+
+ CORO_END_CODE;
+}
+
+void jingleFadeEnd(CORO_PARAM, uint32 nJingle, uint32 bLoop, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_4(fadeOutJingle, 0, 0, 0, 0);
+ CORO_INVOKE_4(fadeInSoundEffect, 0, 0, 0, 0);
+
+ CORO_END_CODE;
+}
+
+void mustSkipIdleStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._bSkipIdle = true;
+ CoroScheduler.setEvent(GLOBALS._hSkipIdle);
+}
+
+void mustSkipIdleEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ GLOBALS._bSkipIdle = false;
+ CoroScheduler.resetEvent(GLOBALS._hSkipIdle);
+}
+
+void patIrqFreeze(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
+ // Unused in ScummVM.
+}
+
+void openInitLoadMenu(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_0(g_vm->openInitLoadMenu);
+
+ CORO_END_CODE;
+}
+
+void openInitOptions(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_0(g_vm->openInitOptions);
+
+ CORO_END_CODE;
+}
+
+void doCredits(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint32, uint32) {
+ CORO_BEGIN_CONTEXT;
+ RMMessage *msg;
+ RMTextDialog *text;
+ uint32 hDisable;
+ int i;
+ uint32 startTime;
+
+ ~CoroContextTag() {
+ delete msg;
+ delete[] text;
+ }
+
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->msg = new RMMessage(nMsg);
+ _ctx->hDisable = CoroScheduler.createEvent(true, false);
+
+ _ctx->text = new RMTextDialog[_ctx->msg->numPeriods()];
+
+ for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods(); _ctx->i++) {
+ _ctx->text[_ctx->i].setInput(GLOBALS._input);
+
+ // Alignment
+ if ((*_ctx->msg)[_ctx->i][0] == '@') {
+ _ctx->text[_ctx->i].setAlignType(RMText::HCENTER, RMText::VTOP);
+ _ctx->text[_ctx->i].writeText(&(*_ctx->msg)[_ctx->i][1], 3);
+ _ctx->text[_ctx->i].setPosition(RMPoint(414, 70 + _ctx->i * 26)); // 70
+ } else {
+ _ctx->text[_ctx->i].setAlignType(RMText::HLEFT, RMText::VTOP);
+ _ctx->text[_ctx->i].writeText((*_ctx->msg)[_ctx->i], 3);
+ _ctx->text[_ctx->i].setPosition(RMPoint(260, 70 + _ctx->i * 26));
+ }
+
+
+ // Set the position
+ _ctx->text[_ctx->i].setAlwaysDisplay();
+ _ctx->text[_ctx->i].setForcedTime(dwTime * 1000);
+ _ctx->text[_ctx->i].setNoTab();
+
+ // Wait for the end of display
+ _ctx->text[_ctx->i].setCustomSkipHandle(_ctx->hDisable);
+
+ // Record the text
+ g_vm->getEngine()->linkGraphicTask(&_ctx->text[_ctx->i]);
+ }
+
+ _ctx->startTime = g_vm->getTime();
+
+ while (_ctx->startTime + dwTime * 1000 > g_vm->getTime()) {
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ if (GLOBALS._input->mouseLeftClicked() || GLOBALS._input->mouseRightClicked())
+ break;
+ if (g_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
+ break;
+ }
+
+ CoroScheduler.setEvent(_ctx->hDisable);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ delete[] _ctx->text;
+ delete _ctx->msg;
+ _ctx->text = NULL;
+ _ctx->msg = NULL;
+
+ CORO_END_CODE;
+}
+
+BEGIN_CUSTOM_FUNCTION_MAP()
+
+ASSIGN(1, custLoadLocation)
+ASSIGN(2, mySleep)
+ASSIGN(3, setPointer)
+ASSIGN(5, moveTony)
+ASSIGN(6, faceToMe)
+ASSIGN(7, backToMe)
+ASSIGN(8, leftToMe)
+ASSIGN(9, rightToMe)
+ASSIGN(10, sendTonyMessage)
+ASSIGN(11, changeBoxStatus)
+ASSIGN(12, changeLocation)
+ASSIGN(13, disableTony)
+ASSIGN(14, enableTony)
+ASSIGN(15, waitForPatternEnd)
+ASSIGN(16, setLocStartPosition)
+ASSIGN(17, scrollLocation)
+ASSIGN(18, moveTonyAndWait)
+ASSIGN(19, changeHotspot)
+ASSIGN(20, addInventory)
+ASSIGN(21, removeInventory)
+ASSIGN(22, changeInventoryStatus)
+ASSIGN(23, setTonyPosition)
+ASSIGN(24, sendFullscreenMessage)
+ASSIGN(25, saveTonyPosition)
+ASSIGN(26, restoreTonyPosition)
+ASSIGN(27, disableInput)
+ASSIGN(28, enableInput)
+ASSIGN(29, stopTony)
+
+ASSIGN(30, tonyTakeUp1)
+ASSIGN(31, tonyTakeMid1)
+ASSIGN(32, tonyTakeDown1)
+ASSIGN(33, tonyTakeUp2)
+ASSIGN(34, tonyTakeMid2)
+ASSIGN(35, tonyTakeDown2)
+
+ASSIGN(72, tonyPutUp1)
+ASSIGN(73, tonyPutMid1)
+ASSIGN(74, tonyPutDown1)
+ASSIGN(75, tonyPutUp2)
+ASSIGN(76, tonyPutMid2)
+ASSIGN(77, tonyPutDown2)
+
+ASSIGN(36, tonyOnTheFloor)
+ASSIGN(37, tonyGetUp)
+ASSIGN(38, tonyShepherdess)
+ASSIGN(39, tonyWhistle)
+
+ASSIGN(40, tonyLaugh)
+ASSIGN(41, tonyHips)
+ASSIGN(42, tonySing)
+ASSIGN(43, tonyIndicate)
+ASSIGN(44, tonyScaredWithHands)
+ASSIGN(49, tonyScaredWithoutHands)
+ASSIGN(45, tonyWithGlasses)
+ASSIGN(46, tonyWithWorm)
+ASSIGN(47, tonyWithHammer)
+ASSIGN(48, tonyWithRope)
+ASSIGN(90, tonyWithRabbitANIM)
+ASSIGN(91, tonyWithRecipeANIM)
+ASSIGN(92, tonyWithCardsANIM)
+ASSIGN(93, tonyWithSnowmanANIM)
+ASSIGN(94, tonyWithSnowmanStart)
+ASSIGN(95, tonyWithSnowmanEnd)
+ASSIGN(96, tonyWithRabbitStart)
+ASSIGN(97, tonyWithRabbitEnd)
+ASSIGN(98, tonyWithRecipeStart)
+ASSIGN(99, tonyWithRecipeEnd)
+ASSIGN(100, tonyWithCardsStart)
+ASSIGN(101, tonyWithCardsEnd)
+ASSIGN(102, tonyWithNotebookStart)
+ASSIGN(103, tonyWithNotebookEnd)
+ASSIGN(104, tonyWithMegaphoneStart)
+ASSIGN(105, tonyWithMegaphoneEnd)
+ASSIGN(106, tonyWithBeardStart)
+ASSIGN(107, tonyWithBeardEnd)
+ASSIGN(108, tonyGiggle)
+ASSIGN(109, tonyDisgusted)
+ASSIGN(110, tonySarcastic)
+ASSIGN(111, tonyMacbeth)
+ASSIGN(112, tonySniffLeft)
+ASSIGN(113, tonySniffRight)
+ASSIGN(114, tonyScaredStart)
+ASSIGN(115, tonyScaredEnd)
+ASSIGN(116, tonyWithSecretary)
+
+ASSIGN(50, charSetCode)
+ASSIGN(51, charSetColor)
+ASSIGN(52, charSetTalkPattern)
+ASSIGN(53, charSendMessage)
+ASSIGN(54, charSetStartEndTalkPattern)
+
+ASSIGN(60, mCharSetCode)
+ASSIGN(61, mCharSetColor)
+ASSIGN(62, mCharSetCurrentGroup)
+ASSIGN(63, mCharSetNumTalksInGroup)
+ASSIGN(64, mCharSetNumTexts)
+ASSIGN(65, mCharSendMessage)
+ASSIGN(66, mCharSetPosition)
+ASSIGN(67, mCharSetAlwaysBack)
+ASSIGN(68, mCharResetCode)
+
+ASSIGN(70, startDialog)
+ASSIGN(71, sendDialogMessage)
+
+ASSIGN(80, takeOwnership)
+ASSIGN(81, releaseOwnership)
+
+ASSIGN(86, playSoundEffect)
+ASSIGN(87, playJingle)
+ASSIGN(88, fadeInSoundEffect)
+ASSIGN(89, fadeOutSoundEffect)
+ASSIGN(123, fadeInJingle)
+ASSIGN(124, fadeOutJingle)
+ASSIGN(125, muteSoundEffect)
+ASSIGN(126, demuteSoundEffect)
+ASSIGN(127, muteJingle)
+ASSIGN(128, demuteJingle)
+ASSIGN(84, stopSoundEffect)
+ASSIGN(85, stopJingle)
+ASSIGN(83, playItemSfx)
+ASSIGN(129, jingleFadeStart)
+ASSIGN(130, jingleFadeEnd)
+
+ASSIGN(120, shakeScreen)
+ASSIGN(121, autoSave)
+ASSIGN(122, abortGame)
+ASSIGN(131, noBullsEye)
+ASSIGN(132, sendFullscreenMsgStart)
+ASSIGN(133, sendFullscreenMsgEnd)
+ASSIGN(134, custEnableGUI)
+ASSIGN(135, custDisableGUI)
+ASSIGN(136, clearScreen)
+ASSIGN(137, patIrqFreeze)
+ASSIGN(138, tonySetPerorate)
+ASSIGN(139, openInitLoadMenu)
+ASSIGN(140, openInitOptions)
+ASSIGN(141, syncScrollLocation)
+ASSIGN(142, closeLocation)
+ASSIGN(143, setAlwaysDisplay)
+ASSIGN(144, doCredits)
+
+ASSIGN(200, mustSkipIdleStart);
+ASSIGN(201, mustSkipIdleEnd);
+
+END_CUSTOM_FUNCTION_MAP()
+
+void processKilledCallback(Common::PROCESS *p) {
+ for (uint i = 0; i < 10; i++) {
+ if (GLOBALS._mut[i]._ownerPid == p->pid) {
+ // Handle scripts which don't call ReleaseOwnership, such as
+ // the one in loc37's vEnter when Tony is chasing the mouse.
+ debug(DEBUG_BASIC, "Force-releasing mutex %d after process died", i);
+
+ GLOBALS._mut[i]._ownerPid = 0;
+ GLOBALS._mut[i]._lockCount = 0;
+ CoroScheduler.setEvent(GLOBALS._mut[i]._eventId);
+ }
+ }
+}
+
+void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input) {
+ GLOBALS._tony = tony;
+ GLOBALS._pointer = ptr;
+ GLOBALS._boxes = box;
+ GLOBALS._loc = loc;
+ GLOBALS._inventory = inv;
+ GLOBALS._input = input;
+
+ GLOBALS.DisableGUI = mainDisableGUI;
+ GLOBALS.EnableGUI = mainEnableGUI;
+
+ GLOBALS._bAlwaysDisplay = false;
+
+ CoroScheduler.setResourceCallback(processKilledCallback);
+ for (int i = 0; i < 10; i++)
+ GLOBALS._mut[i]._eventId = CoroScheduler.createEvent(false, true);
+
+ for (int i = 0; i < 200; i++)
+ GLOBALS._ambiance[i] = 0;
+
+ GLOBALS._ambiance[6] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[7] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[8] = AMBIANCE_CRICKETSMUFFLED;
+ GLOBALS._ambiance[10] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[12] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[13] = AMBIANCE_CRICKETSMUFFLED;
+ GLOBALS._ambiance[15] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[16] = AMBIANCE_CRICKETSWIND;
+ GLOBALS._ambiance[18] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[19] = AMBIANCE_CRICKETSWIND;
+ GLOBALS._ambiance[20] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[23] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[26] = AMBIANCE_SEAHALFVOLUME;
+ GLOBALS._ambiance[27] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[28] = AMBIANCE_CRICKETSWIND;
+ GLOBALS._ambiance[31] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[33] = AMBIANCE_SEA;
+ GLOBALS._ambiance[35] = AMBIANCE_SEA;
+ GLOBALS._ambiance[36] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[37] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[40] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[41] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[42] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[45] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[51] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[52] = AMBIANCE_CRICKETSWIND1;
+ GLOBALS._ambiance[53] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[54] = AMBIANCE_CRICKETS;
+ GLOBALS._ambiance[57] = AMBIANCE_WIND;
+ GLOBALS._ambiance[58] = AMBIANCE_WIND;
+ GLOBALS._ambiance[60] = AMBIANCE_WIND;
+
+
+
+ // Create an event for the idle skipping
+ GLOBALS._hSkipIdle = CoroScheduler.createEvent(true, false);
+}
+
+} // end of namespace Tony
diff --git a/engines/tony/custom.h b/engines/tony/custom.h
new file mode 100644
index 0000000000..0f1061e8cd
--- /dev/null
+++ b/engines/tony/custom.h
@@ -0,0 +1,85 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_CUSTOM_H
+#define TONY_CUSTOM_H
+
+#include "common/str.h"
+#include "tony/mpal/mpal.h"
+
+namespace Tony {
+
+using namespace MPAL;
+
+struct MusicFileEntry {
+ const char *_name;
+ int _sync;
+};
+
+#define INIT_CUSTOM_FUNCTION MapCustomFunctions
+
+#define BEGIN_CUSTOM_FUNCTION_MAP() \
+ static void AssignError(int num) { \
+ error("Custom function %u has been already assigned!", num); \
+ } \
+ void INIT_CUSTOM_FUNCTION(LPCUSTOMFUNCTION *lpMap, Common::String *lpStrMap) \
+ {
+
+#define END_CUSTOM_FUNCTION_MAP() \
+ }
+
+#define ASSIGN(num, func) \
+ if (lpMap[num] != NULL) \
+ AssignError(num); \
+ lpMap[num] = func; \
+ lpStrMap[num] = #func;
+
+class RMTony;
+class RMPointer;
+class RMGameBoxes;
+class RMLocation;
+class RMInventory;
+class RMInput;
+
+void charsSaveAll(Common::OutSaveFile *f);
+void charsLoadAll(Common::InSaveFile *f);
+void mCharResetCodes();
+void saveChangedHotspot(Common::OutSaveFile *f);
+void loadChangedHotspot(Common::InSaveFile *f);
+void reapplyChangedHotspot();
+
+void restoreMusic(CORO_PARAM);
+void saveMusic(Common::OutSaveFile *f);
+void loadMusic(Common::InSaveFile *f);
+
+void INIT_CUSTOM_FUNCTION(LPCUSTOMFUNCTION *lpMap, Common::String *lpStrMap);
+void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input);
+
+#endif
+
+} // end of namespace Tony
diff --git a/engines/tony/debugger.cpp b/engines/tony/debugger.cpp
new file mode 100644
index 0000000000..85d9469519
--- /dev/null
+++ b/engines/tony/debugger.cpp
@@ -0,0 +1,130 @@
+/* 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/coroutines.h"
+#include "tony/debugger.h"
+#include "tony/globals.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+Debugger::Debugger() : GUI::Debugger() {
+ DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
+ DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene));
+ DCmd_Register("dirty_rects", WRAP_METHOD(Debugger, Cmd_DirtyRects));
+}
+
+static int strToInt(const char *s) {
+ if (!*s)
+ // No string at all
+ return 0;
+ else if (toupper(s[strlen(s) - 1]) != 'H')
+ // Standard decimal string
+ return atoi(s);
+
+ // Hexadecimal string
+ uint tmp = 0;
+ int read = sscanf(s, "%xh", &tmp);
+ if (read < 1)
+ error("strToInt failed on string \"%s\"", s);
+ return (int)tmp;
+}
+
+/**
+ * Support process for changing the scene
+ */
+struct ChangeSceneDetails {
+ int sceneNumber;
+ int x;
+ int y;
+};
+
+void DebugChangeScene(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ uint32 result;
+ const ChangeSceneDetails *details = (const ChangeSceneDetails *)param;
+ RMPoint scenePos(details->x, details->y);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(g_vm->getEngine()->unloadLocation, false, &result);
+
+ g_vm->getEngine()->loadLocation(details->sceneNumber, scenePos, RMPoint(-1, -1));
+
+ mainEnableGUI();
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * This command loads up the specified new scene number
+ */
+bool Debugger::Cmd_Scene(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("Usage: %s <scene number> [<x> <y>]\n", argv[0]);
+ return true;
+ }
+
+ int sceneNumber = strToInt(argv[1]);
+ if (sceneNumber >= g_vm->_theBoxes.getLocBoxesCount()) {
+ DebugPrintf("Invalid scene\n");
+ return true;
+ }
+
+ RMPoint scenePos;
+ if (argc >= 4) {
+ scenePos._x = strToInt(argv[2]);
+ scenePos._y = strToInt(argv[3]);
+ } else {
+ // Get the box areas for the scene, and choose one so as to have a default
+ // position for Tony that will be in the walkable areas
+ RMBoxLoc *box = g_vm->_theBoxes.getBoxes(sceneNumber);
+ scenePos.set(box->_boxes[0]._hotspot[0]._hotx, box->_boxes[0]._hotspot[0]._hoty);
+ }
+
+ // Set up a process to change the scene
+ ChangeSceneDetails details;
+ details.sceneNumber = sceneNumber;
+ details.x = scenePos._x;
+ details.y = scenePos._y;
+ CoroScheduler.createProcess(DebugChangeScene, &details, sizeof(ChangeSceneDetails));
+
+ return false;
+}
+
+/**
+ * Turns showing dirty rects on or off
+ */
+bool Debugger::Cmd_DirtyRects(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Usage; %s [on | off]\n", argv[0]);
+ return true;
+ } else {
+ g_vm->_window.showDirtyRects(strcmp(argv[1], "on") == 0);
+ return false;
+ }
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/debugger.h b/engines/tony/debugger.h
new file mode 100644
index 0000000000..85ba9d75b6
--- /dev/null
+++ b/engines/tony/debugger.h
@@ -0,0 +1,43 @@
+/* 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 TONY_DEBUGGER_H
+#define TONY_DEBUGGER_H
+
+#include "common/scummsys.h"
+#include "gui/debugger.h"
+
+namespace Tony {
+
+class Debugger : public GUI::Debugger {
+public:
+ Debugger();
+ virtual ~Debugger() {}
+
+protected:
+ bool Cmd_Scene(int argc, const char **argv);
+ bool Cmd_DirtyRects(int argc, const char **argv);
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp
new file mode 100644
index 0000000000..8e6d5a64c3
--- /dev/null
+++ b/engines/tony/detection.cpp
@@ -0,0 +1,194 @@
+/* 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 "base/plugins.h"
+
+#include "common/memstream.h"
+#include "engines/advancedDetector.h"
+#include "common/system.h"
+#include "graphics/colormasks.h"
+#include "graphics/surface.h"
+
+#include "tony/tony.h"
+#include "tony/game.h"
+
+namespace Tony {
+
+enum {
+ GF_COMPRESSED = (1 << 0)
+};
+
+struct TonyGameDescription {
+ ADGameDescription desc;
+};
+
+uint32 TonyEngine::getFeatures() const {
+ return _gameDescription->desc.flags;
+}
+
+Common::Language TonyEngine::getLanguage() const {
+ return _gameDescription->desc.language;
+}
+
+bool TonyEngine::getIsDemo() const {
+ return _gameDescription->desc.flags & ADGF_DEMO;
+}
+
+bool TonyEngine::isCompressed() const {
+ return _gameDescription->desc.flags & GF_COMPRESSED;
+}
+
+} // End of namespace Tony
+
+static const PlainGameDescriptor tonyGames[] = {
+ {"tony", "Tony Tough and the Night of Roasted Moths"},
+ {0, 0}
+};
+
+#include "tony/detection_tables.h"
+
+class TonyMetaEngine : public AdvancedMetaEngine {
+public:
+ TonyMetaEngine() : AdvancedMetaEngine(Tony::gameDescriptions, sizeof(Tony::TonyGameDescription), tonyGames) {
+ }
+
+ virtual const char *getName() const {
+ return "Tony Engine";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Tony Engine (C) Protonic Interactive";
+ }
+
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual SaveStateList listSaves(const char *target) const;
+ virtual int getMaximumSaveSlot() const;
+ virtual void removeSaveState(const char *target, int slot) const;
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+};
+
+bool TonyMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail);
+}
+
+bool Tony::TonyEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime);
+}
+
+bool TonyMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ const Tony::TonyGameDescription *gd = (const Tony::TonyGameDescription *)desc;
+ if (gd) {
+ *engine = new Tony::TonyEngine(syst, gd);
+ }
+ return gd != 0;
+}
+
+SaveStateList TonyMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::StringArray filenames;
+ Common::String saveDesc;
+ Common::String pattern = "tony.0??";
+
+ filenames = saveFileMan->listSavefiles(pattern);
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ SaveStateList saveList;
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+ // Obtain the last 3 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 3);
+
+ if (slotNum >= 0 && slotNum <= 999) {
+ byte thumbnailData[160 * 120 * 2];
+ Common::String saveName;
+ byte difficulty;
+
+ if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slotNum, thumbnailData, saveName, difficulty)) {
+ // Add the save name to the savegame list
+ saveList.push_back(SaveStateDescriptor(slotNum, saveName));
+ }
+ }
+ }
+
+ return saveList;
+}
+
+int TonyMetaEngine::getMaximumSaveSlot() const {
+ return 99;
+}
+
+void TonyMetaEngine::removeSaveState(const char *target, int slot) const {
+ Common::String filename = Tony::TonyEngine::getSaveStateFileName(slot);
+
+ g_system->getSavefileManager()->removeSavefile(filename);
+}
+
+SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String saveName;
+ byte difficulty;
+ byte thumbData[160 * 120 * 2];
+
+ if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, thumbData, saveName, difficulty)) {
+ // Convert the 565 thumbnail data to the needed overlay format
+ Common::MemoryReadStream thumbStream(thumbData, 160 * 120 * 2);
+ Graphics::PixelFormat destFormat = g_system->getOverlayFormat();
+ Graphics::Surface *to = new Graphics::Surface();
+ to->create(160, 120, destFormat);
+
+ OverlayColor *pixels = (OverlayColor *)to->pixels;
+ for (int y = 0; y < to->h; ++y) {
+ for (int x = 0; x < to->w; ++x) {
+ uint8 r, g, b;
+ Graphics::colorToRGB<Graphics::ColorMasks<555> >(thumbStream.readUint16LE(), r, g, b);
+
+ // converting to current OSystem Color
+ *pixels++ = destFormat.RGBToColor(r, g, b);
+ }
+ }
+
+ // Create the return descriptor
+ SaveStateDescriptor desc(slot, saveName);
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+ desc.setThumbnail(to);
+
+ return desc;
+ }
+
+ return SaveStateDescriptor();
+}
+
+
+#if PLUGIN_ENABLED_DYNAMIC(TONY)
+REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
+#endif
diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h
new file mode 100644
index 0000000000..d2bd81f083
--- /dev/null
+++ b/engines/tony/detection_tables.h
@@ -0,0 +1,178 @@
+/* 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.
+ *
+ */
+
+namespace Tony {
+
+static const TonyGameDescription gameDescriptions[] = {
+ {
+ // Tony Tough English
+ {
+ "tony",
+ 0,
+ {
+ // TODO: AdvancedDetector seems to have a problem where it thinks data1.cab is unrecognized.
+ // Is it perhaps because the Agos engine also has detection entries for data1.cab?
+ {"data1.cab", 0, "ce82907242166bfb594d97bdb68f96d2", 4350},
+ /*{"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "57c4a3860cf899443c357e0078ea6f49", 366773},*/
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // Tony Tough English Demo
+ {
+ "tony",
+ "Extracted Demo",
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 14972409},
+ {"roasted.mpc", 0, "1e247922ec869712bfd96625bc4d3c7c", 39211},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DEMO,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // Tony Tough English Demo (Compressed)
+ {
+ "tony",
+ "Demo",
+ {
+ {"data1.cab", 0, "7d8b6d308f96aee3968ad7910fb11e6d", 58660608},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DEMO | GF_COMPRESSED,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough French "Collection Aventure" provided by Strangerke
+ {
+ "tony",
+ 0,
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "e890c6a41238827bdfa9874a65618b69", 374135},
+ AD_LISTEND
+ },
+ Common::FR_FRA,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough German "Shoe Box" provided by Strangerke
+ {
+ "tony",
+ 0,
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "ccf7ab939a34de1b13df538596431684", 389554},
+ AD_LISTEND
+ },
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough Italian provided by Fabio Barzagli
+ {
+ "tony",
+ 0,
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "1dc896cdb945170d7408598f803411c1", 380001},
+ AD_LISTEND
+ },
+ Common::IT_ITA,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough Polish provided by Fabio Barzagli
+ {
+ "tony",
+ 0,
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "89733ea710669acc8e7900b115f4afef", 389625},
+ AD_LISTEND
+ },
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough German "Gamestar" provided in bug #3566035
+ {
+ "tony",
+ 0,
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "187de6f88f4083808cb66342ab55a7fd", 389904},
+ AD_LISTEND
+ },
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough Czech provided in bug #3565765
+ {
+ "tony",
+ 0,
+ {
+ // {"data1.cab", 0, "c6d5dd8f0c1241a6e3f7861b7f27bf7b", 4350},
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "a8283a101878f3ca105f1f83f07e2c40", 386491},
+ AD_LISTEND
+ },
+ Common::CZ_CZE,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ { AD_TABLE_END_MARKER }
+};
+
+} // End of namespace Tony
diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp
new file mode 100644
index 0000000000..fa018b4464
--- /dev/null
+++ b/engines/tony/font.cpp
@@ -0,0 +1,1179 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/textconsole.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/font.h"
+#include "tony/input.h"
+#include "tony/inventory.h"
+#include "tony/loc.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+/****************************************************************************\
+* RMFont Methods
+\****************************************************************************/
+
+RMFont::RMFont() {
+ _letter = NULL;
+ _nLetters = _fontDimx = _fontDimy = _dimx = _dimy = 0;
+}
+
+RMFont::~RMFont() {
+ unload();
+}
+
+void RMFont::load(const byte *buf, int nChars, int dimx, int dimy, uint32 palResID) {
+ _letter = new RMGfxSourceBuffer8RLEByte[nChars];
+
+ // Initialize the fonts
+ for (int i = 0; i < nChars; i++) {
+ // Initialize the buffer with the letters
+ _letter[i].init(buf + i * (dimx * dimy + 8) + 8, dimx, dimy);
+ _letter[i].loadPaletteWA(palResID);
+ }
+
+ _fontDimx = dimx;
+ _fontDimy = dimy;
+
+ _nLetters = nChars;
+}
+
+void RMFont::load(uint32 resID, int nChars, int dimx, int dimy, uint32 palResID) {
+ RMRes res(resID);
+
+ if ((int)res.size() < nChars * (dimy * dimx + 8))
+ nChars = res.size() / (dimy * dimx + 8);
+
+ load(res, nChars, dimx, dimy, palResID);
+}
+
+void RMFont::unload() {
+ if (_letter != NULL) {
+ delete[] _letter;
+ _letter = NULL;
+ }
+}
+
+
+RMGfxPrimitive *RMFont::makeLetterPrimitive(byte bChar, int &nLength) {
+ RMFontPrimitive *prim;
+
+ // Convert from character to glyph index
+ int nLett = convertToLetter(bChar);
+ assert(nLett < _nLetters);
+
+ // Create primitive font
+ prim = new RMFontPrimitive(this);
+ prim->_nChar = nLett;
+
+ // Get the length of the character in pixels
+ nLength = letterLength(bChar);
+
+ return prim;
+}
+
+void RMFont::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim2) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ RMFontPrimitive *prim = (RMFontPrimitive *)prim2;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Call the draw method of the letter assigned to the primitive
+ if (prim->_nChar != -1)
+ CORO_INVOKE_2(_letter[prim->_nChar].draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+void RMFont::close() {
+ unload();
+}
+
+int RMFont::stringLen(const Common::String &text) {
+ if (text.empty())
+ return letterLength('\0');
+
+ uint len = 0;
+ uint i;
+ for (i = 0; i < text.size() - 1; i++)
+ len += letterLength(text[i], text[i + 1]);
+ len += letterLength(text[i]);
+
+ return len;
+}
+
+int RMFont::stringLen(char bChar, char bNext) {
+ return letterLength(bChar, bNext);
+}
+
+/****************************************************************************\
+* RMFontColor Methods
+\****************************************************************************/
+
+RMFontColor::RMFontColor() : RMFont() {
+ _fontR = _fontG = _fontB = 255;
+}
+
+RMFontColor::~RMFontColor() {
+}
+
+void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
+ int r = (int)r1 << 16;
+ int g = (int)g1 << 16;
+ int b = (int)b1 << 16;
+
+ int rstep = r / 14;
+ int gstep = g / 14;
+ int bstep = b / 14;
+
+ byte pal[768 * 3];
+
+ // Check if we are already on the right color
+ if (_fontR == r1 && _fontG == g1 && _fontB == b1)
+ return;
+
+ _fontR = r1;
+ _fontG = g1;
+ _fontB = b1;
+
+ // Constructs a new palette for the font
+ for (int i = 1; i < 16; i++) {
+ pal[i * 3 + 0] = r >> 16;
+ pal[i * 3 + 1] = g >> 16;
+ pal[i * 3 + 2] = b >> 16;
+
+ r -= rstep;
+ g -= gstep;
+ b -= bstep;
+ }
+
+ pal[15 * 3 + 0] += 8;
+ pal[15 * 3 + 1] += 8;
+ pal[15 * 3 + 2] += 8;
+
+ // Puts in all the letters
+ for (int i = 0; i < _nLetters; i++)
+ _letter[i].loadPaletteWA(pal);
+}
+
+/***************************************************************************\
+* RMFontWithTables Methods
+\****************************************************************************/
+int RMFontWithTables::convertToLetter(byte nChar) {
+ return _cTable[nChar];
+}
+
+int RMFontWithTables::letterLength(int nChar, int nNext) {
+ return (nChar != -1 ? _lTable[(byte)nChar] + _l2Table[(byte)nChar][(byte)nNext] : _lDefault);
+}
+
+/***************************************************************************\
+* RMFontDialog Methods
+\****************************************************************************/
+
+void RMFontDialog::init() {
+ // bernie: Number of characters in the font
+ int nchars =
+ 112 // base
+ + 18 // polish
+ + 66 // russian
+ + 30 // czech
+ + 8 // french
+ + 5; // deutsch
+
+ load(RES_F_PARL, nchars, 20, 20);
+
+ // Initialize the font table
+ _lDefault = 13;
+ _hDefault = 18;
+ Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
+
+ for (int i = 0; i < 256; i++) {
+ _cTable[i] = g_vm->_cTableDialog[i];
+ _lTable[i] = g_vm->_lTableDialog[i];
+ }
+}
+
+
+/***************************************************************************\
+* RMFontMacc Methods
+\****************************************************************************/
+
+void RMFontMacc::init() {
+ // bernie: Number of characters in the font
+ int nchars =
+ 102 // base
+ + 18 // polish
+ + 66 // russian
+ + 30 // czech
+ + 8 // francais
+ + 5; // deutsch
+
+ load(RES_F_MACC, nchars, 11, 16);
+
+ // Default
+ _lDefault = 10;
+ _hDefault = 17;
+ Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
+
+ for (int i = 0; i < 256; i++) {
+ _cTable[i] = g_vm->_cTableMacc[i];
+ _lTable[i] = g_vm->_lTableMacc[i];
+ }
+}
+
+/***************************************************************************\
+* RMFontCredits Methods
+\****************************************************************************/
+
+void RMFontCredits::init() {
+ // bernie: Number of characters in the font
+ int nchars =
+ 112 // base
+ + 18 // polish
+ + 66 // russian
+ + 30 // czech
+ + 8 // french
+ + 2; // deutsch
+
+ load(RES_F_CREDITS, nchars, 27, 28, RES_F_CPAL);
+
+ // Default
+ _lDefault = 10;
+ _hDefault = 28;
+ Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
+
+ for (int i = 0; i < 256; i++) {
+ _cTable[i] = g_vm->_cTableCred[i];
+ _lTable[i] = g_vm->_lTableCred[i];
+ }
+}
+
+
+
+/***************************************************************************\
+* RMFontObj Methods
+\****************************************************************************/
+
+#define TOUPPER(a) ((a) >= 'a' && (a) <= 'z' ? (a) + 'A' - 'a' : (a))
+#define TOLOWER(a) ((a) >= 'A' && (a) <= 'Z' ? (a) + 'a' - 'A' : (a))
+
+void RMFontObj::setBothCase(int nChar, int nNext, signed char spiazz) {
+ _l2Table[TOUPPER(nChar)][TOUPPER(nNext)] = spiazz;
+ _l2Table[TOUPPER(nChar)][TOLOWER(nNext)] = spiazz;
+ _l2Table[TOLOWER(nChar)][TOUPPER(nNext)] = spiazz;
+ _l2Table[TOLOWER(nChar)][TOLOWER(nNext)] = spiazz;
+}
+
+void RMFontObj::init() {
+ //bernie: Number of characters in the font (solo maiuscolo)
+ int nchars =
+ 85 // base
+ + 9 // polish
+ + 33 // russian
+ + 15 // czech
+ + 0 // francais (no uppercase chars)
+ + 1; // deutsch
+
+ load(RES_F_OBJ, nchars, 25, 30);
+
+ // Initialize the font table
+ _lDefault = 26;
+ _hDefault = 30;
+ Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
+
+ for (int i = 0; i < 256; i++) {
+ _cTable[i] = g_vm->_cTableObj[i];
+ _lTable[i] = g_vm->_lTableObj[i];
+ }
+
+ // Special case
+ setBothCase('C', 'C', 2);
+ setBothCase('A', 'T', -2);
+ setBothCase('R', 'S', 2);
+ setBothCase('H', 'I', -2);
+ setBothCase('T', 'S', 2);
+ setBothCase('O', 'R', 2);
+ setBothCase('O', 'L', 2);
+ setBothCase('O', 'G', 2);
+ setBothCase('Z', 'A', -1);
+ setBothCase('R', 'R', 1);
+ setBothCase('R', 'U', 3);
+}
+
+/****************************************************************************\
+* RMText Methods
+\****************************************************************************/
+
+RMFontColor *RMText::_fonts[4] = { NULL, NULL, NULL, NULL };
+
+void RMText::initStatics() {
+ Common::fill(&_fonts[0], &_fonts[4], (RMFontColor *)NULL);
+}
+
+RMText::RMText() {
+ // Default color: white
+ _textR = _textG = _textB = 255;
+
+ // Default length
+ _maxLineLength = 350;
+
+ _bTrasp0 = true;
+ _aHorType = HCENTER;
+ _aVerType = VTOP;
+ setPriority(150);
+}
+
+RMText::~RMText() {
+}
+
+void RMText::unload() {
+ if (_fonts[0] != NULL) {
+ delete _fonts[0];
+ delete _fonts[1];
+ delete _fonts[2];
+ delete _fonts[3];
+ _fonts[0] = _fonts[1] = _fonts[2] = _fonts[3] = 0;
+ }
+}
+
+void RMText::setMaxLineLength(int max) {
+ _maxLineLength = max;
+}
+
+void RMText::removeThis(CORO_PARAM, bool &result) {
+ // Here we can do checks on the number of frames, time spent, etc.
+ result = true;
+}
+
+void RMText::writeText(const Common::String &text, int nFont, int *time) {
+ // Initializes the font (only once)
+ if (_fonts[0] == NULL) {
+ _fonts[0] = new RMFontDialog;
+ _fonts[0]->init();
+ _fonts[1] = new RMFontObj;
+ _fonts[1]->init();
+ _fonts[2] = new RMFontMacc;
+ _fonts[2]->init();
+ _fonts[3] = new RMFontCredits;
+ _fonts[3]->init();
+ }
+
+ writeText(text, _fonts[nFont], time);
+}
+
+void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
+ RMGfxPrimitive *prim;
+
+ // Set the base color
+ font->setBaseColor(_textR, _textG, _textB);
+
+ // Destroy the buffer before starting
+ destroy();
+
+ // If the string is empty, do nothing
+ if (text.empty())
+ return;
+
+ // Divide the words into lines. In this cycle, X contains the maximum length reached by a line,
+ // and the number of lines
+ Common::Array<Common::String> lines;
+ uint p = 0;
+ int j = 0;
+ int x = 0;
+ while (p < text.size()) {
+ j += font->stringLen(text[p]);
+ if (j > (((_aHorType == HLEFTPAR) && (lines.size() > 0)) ? _maxLineLength - 25 : _maxLineLength)) {
+ j -= font->stringLen(text[p], (p + 1 == text.size()) ? '\0' : text[p + 1]);
+ if (j > x)
+ x = j;
+
+ // Back to the first usable space
+ //
+ // BERNIE: In the original, sentences containing words that exceed the
+ // width of a line caused discontinuation of the whole sentence.
+ // This workaround has the partial word broken up so it will still display
+ //
+ uint old_p = p;
+ while (text[p] != ' ' && text[p] != '-' && p > 0)
+ p--;
+
+ if (p == 0)
+ p = old_p;
+
+ // Check if there are any blanks to end
+ while ((text[p] == ' ' || text[p] == '-') && p + 1 < text.size())
+ p++;
+ if (p == text.size())
+ break;
+ lines.push_back(Common::String(text.c_str(), p));
+ if (text[p] == ' ')
+ p++;
+ text = text.c_str() + p;
+ p = 0;
+ j = 0;
+ continue;
+ }
+ p++;
+ }
+
+ if (j > x)
+ x = j;
+
+ // Add the last line of text.
+ lines.push_back(text);
+
+ x += 8;
+
+ // Starting position for the surface: X1, Y
+ int width = x;
+ int height = (lines.size() - 1) * font->letterHeight() + font->_fontDimy;
+
+ // Create the surface
+ create(width, height);
+ Common::fill(_buf, _buf + width * height * 2, 0);
+
+ p = 0;
+
+ int y = 0;
+ int numchar = 0;
+ for (uint i = 0; i < lines.size(); ++i) {
+ const Common::String &line = lines[i];
+
+ // Measure the length of the line
+ x = 0;
+ j = font->stringLen(line);
+
+ switch (_aHorType) {
+ case HLEFT:
+ x = 0;
+ break;
+
+ case HLEFTPAR:
+ if (i == 0)
+ x = 0;
+ else
+ x = 25;
+ break;
+
+ case HCENTER:
+ x = width / 2 - j / 2;
+ break;
+
+ case HRIGHT:
+ x = width - j - 1;
+ break;
+ }
+
+ p = 0;
+ while (p < line.size()) {
+ if (line[p] == ' ') {
+ x += font->stringLen(line[p]);
+ p++;
+ continue;
+ }
+
+ int len;
+ prim = font->makeLetterPrimitive(line[p], len);
+ prim->getDst()._x1 = x;
+ prim->getDst()._y1 = y;
+ addPrim(prim);
+
+ numchar++;
+
+ x += font->stringLen(line[p], (p + 1 == line.size()) ? '\0' : line[p + 1]);
+ p++;
+ }
+ p++;
+ y += font->letterHeight();
+ }
+
+ if (time != NULL)
+ *time = 1000 + numchar * (11 - GLOBALS._nCfgTextSpeed) * 14;
+}
+
+void RMText::clipOnScreen(RMGfxPrimitive *prim) {
+ // Don't let it go outside the screen
+ if (prim->getDst()._x1 < 5)
+ prim->getDst()._x1 = 5;
+ if (prim->getDst()._y1 < 5)
+ prim->getDst()._y1 = 5;
+ if (prim->getDst()._x1 + _dimx > 635)
+ prim->getDst()._x1 = 635 - _dimx;
+ if (prim->getDst()._y1 + _dimy > 475)
+ prim->getDst()._y1 = 475 - _dimy;
+}
+
+void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+ // Horizontally
+ if (_aHorType == HCENTER)
+ prim->getDst().topLeft() -= RMPoint(_dimx / 2, 0);
+ else if (_aHorType == HRIGHT)
+ prim->getDst().topLeft() -= RMPoint(_dimx, 0);
+
+
+ // Vertically
+ if (_aVerType == VTOP) {
+
+ } else if (_aVerType == VCENTER) {
+ prim->getDst()._y1 -= _dimy / 2;
+
+ } else if (_aVerType == VBOTTOM) {
+ prim->getDst()._y1 -= _dimy;
+ }
+
+ clipOnScreen(prim);
+
+ CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+/**
+ * Set the alignment type
+ */
+void RMText::setAlignType(HorAlign aHor, VerAlign aVer) {
+ _aHorType = aHor;
+ _aVerType = aVer;
+}
+
+/**
+ * Set the base color
+ */
+void RMText::setColor(byte r, byte g, byte b) {
+ _textR = r;
+ _textG = g;
+ _textB = b;
+}
+
+/****************************************************************************\
+* RMTextDialog Methods
+\****************************************************************************/
+
+RMTextDialog::RMTextDialog() : RMText() {
+ _time = _startTime = 0;
+ _dst = RMPoint(0, 0);
+
+ _bSkipStatus = true;
+ _bShowed = true;
+ _bForceTime = false;
+ _bForceNoTime = false;
+ _bAlwaysDisplay = false;
+ _bNoTab = false;
+ _hCustomSkip = CORO_INVALID_PID_VALUE;
+ _hCustomSkip2 = CORO_INVALID_PID_VALUE;
+ _input = NULL;
+
+ // Create the event for displaying the end
+ _hEndDisplay = CoroScheduler.createEvent(false, false);
+}
+
+RMTextDialog::~RMTextDialog() {
+ CoroScheduler.closeEvent(_hEndDisplay);
+}
+
+void RMTextDialog::show() {
+ _bShowed = true;
+}
+
+void RMTextDialog::hide(CORO_PARAM) {
+ _bShowed = false;
+}
+
+void RMTextDialog::writeText(const Common::String &text, int font, int *time) {
+ RMText::writeText(text, font, &_time);
+
+ if (time != NULL)
+ *time = _time;
+}
+
+void RMTextDialog::writeText(const Common::String &text, RMFontColor *font, int *time) {
+ RMText::writeText(text, font, &_time);
+
+ if (time != NULL)
+ *time = _time;
+}
+
+
+void RMTextDialog::setSkipStatus(bool bEnabled) {
+ _bSkipStatus = bEnabled;
+}
+
+void RMTextDialog::forceTime() {
+ _bForceTime = true;
+}
+
+void RMTextDialog::forceNoTime() {
+ _bForceNoTime = true;
+}
+
+void RMTextDialog::setNoTab() {
+ _bNoTab = true;
+}
+
+void RMTextDialog::setForcedTime(uint32 dwTime) {
+ _time = dwTime;
+}
+
+void RMTextDialog::setAlwaysDisplay() {
+ _bAlwaysDisplay = true;
+}
+
+void RMTextDialog::removeThis(CORO_PARAM, bool &result) {
+ CORO_BEGIN_CONTEXT;
+ bool expired;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Presume successful result
+ result = true;
+
+ // Don't erase the background
+ if (_bSkipStatus) {
+ if (!(GLOBALS._bCfgDubbing && _hCustomSkip2 != CORO_INVALID_PID_VALUE)) {
+ if (GLOBALS._bCfgTimerizedText) {
+ if (!_bForceNoTime) {
+ if (g_vm->getTime() > (uint32)_time + _startTime)
+ return;
+ }
+ }
+ }
+
+ if (!_bNoTab) {
+ if (g_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
+ return;
+ }
+
+ if (!_bNoTab) {
+ if (_input) {
+ if (_input->mouseLeftClicked() || _input->mouseRightClicked())
+ return;
+ }
+ }
+ }
+ // Erase the background
+ else if (!(GLOBALS._bCfgDubbing && _hCustomSkip2 != CORO_INVALID_PID_VALUE)) {
+ if (!_bForceNoTime) {
+ if (g_vm->getTime() > (uint32)_time + _startTime)
+ return;
+ }
+ }
+
+ // If time is forced
+ if (_bForceTime) {
+ if (g_vm->getTime() > (uint32)_time + _startTime)
+ return;
+ }
+
+ if (_hCustomSkip != CORO_INVALID_PID_VALUE) {
+ CORO_INVOKE_3(CoroScheduler.waitForSingleObject, _hCustomSkip, 0, &_ctx->expired);
+ // == WAIT_OBJECT_0
+ if (!_ctx->expired)
+ return;
+ }
+
+ if (GLOBALS._bCfgDubbing && _hCustomSkip2 != CORO_INVALID_PID_VALUE) {
+ CORO_INVOKE_3(CoroScheduler.waitForSingleObject, _hCustomSkip2, 0, &_ctx->expired);
+ // == WAIT_OBJECT_0
+ if (!_ctx->expired)
+ return;
+ }
+
+ result = false;
+
+ CORO_END_CODE;
+}
+
+void RMTextDialog::unregister() {
+ RMGfxTask::unregister();
+ assert(_nInList == 0);
+ CoroScheduler.setEvent(_hEndDisplay);
+}
+
+void RMTextDialog::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_startTime == 0)
+ _startTime = g_vm->getTime();
+
+ if (_bShowed) {
+ if (GLOBALS._bShowSubtitles || _bAlwaysDisplay) {
+ prim->getDst().topLeft() = _dst;
+ CORO_INVOKE_2(RMText::draw, bigBuf, prim);
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMTextDialog::setCustomSkipHandle(uint32 hCustom) {
+ _hCustomSkip = hCustom;
+}
+
+void RMTextDialog::setCustomSkipHandle2(uint32 hCustom) {
+ _hCustomSkip2 = hCustom;
+}
+
+void RMTextDialog::waitForEndDisplay(CORO_PARAM) {
+ CoroScheduler.waitForSingleObject(coroParam, _hEndDisplay, CORO_INFINITE);
+}
+
+void RMTextDialog::setInput(RMInput *input) {
+ _input = input;
+}
+
+/**
+ * Set the position
+ */
+void RMTextDialog::setPosition(const RMPoint &pt) {
+ _dst = pt;
+}
+
+/****************************************************************************\
+* RMTextDialogScrolling Methods
+\****************************************************************************/
+
+RMTextDialogScrolling::RMTextDialogScrolling() {
+ _curLoc = NULL;
+}
+
+RMTextDialogScrolling::RMTextDialogScrolling(RMLocation *loc) {
+ _curLoc = loc;
+ _startScroll = loc->scrollPosition();
+}
+
+RMTextDialogScrolling::~RMTextDialogScrolling() {
+}
+
+void RMTextDialogScrolling::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ RMPoint curDst;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->curDst = _dst;
+
+ if (_curLoc != NULL)
+ _dst -= _curLoc->scrollPosition() - _startScroll;
+
+ CORO_INVOKE_2(RMTextDialog::draw, bigBuf, prim);
+
+ _dst = _ctx->curDst;
+
+ CORO_END_CODE;
+}
+
+void RMTextDialogScrolling::clipOnScreen(RMGfxPrimitive *prim) {
+ // We must not do anything!
+}
+
+
+/****************************************************************************\
+* RMTextItemName Methods
+\****************************************************************************/
+
+RMTextItemName::RMTextItemName() : RMText() {
+ _item = NULL;
+ setPriority(220);
+}
+
+RMTextItemName::~RMTextItemName() {
+}
+
+void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv) {
+ CORO_BEGIN_CONTEXT;
+ RMItem *lastItem;
+ uint32 hThread;
+ CORO_END_CONTEXT(_ctx);
+
+ Common::String itemName;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->lastItem = _item;
+
+ // Adds to the list if there is need
+ if (!_nInList)
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+
+ // Update the scrolling co-ordinates
+ _curscroll = loc.scrollPosition();
+
+ // Check if we are on the inventory
+ if (inv.itemInFocus(_mpos))
+ _item = inv.whichItemIsIn(_mpos);
+ else
+ _item = loc.whichItemIsIn(_mpos);
+
+ // If there an item, get its name
+ if (_item != NULL)
+ _item->getName(itemName);
+
+ // Write it
+ writeText(itemName, 1);
+
+ // Handle the change If the selected item is different from the previous one
+ if (_ctx->lastItem != _item) {
+ if (_item == NULL)
+ ptr.setSpecialPointer(RMPointer::PTR_NONE);
+ else {
+ _ctx->hThread = mpalQueryDoAction(20, _item->mpalCode(), 0);
+ if (_ctx->hThread == CORO_INVALID_PID_VALUE)
+ ptr.setSpecialPointer(RMPointer::PTR_NONE);
+ else
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->hThread, CORO_INFINITE);
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+
+void RMTextItemName::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // If there is no text, it's pointless to continue
+ if (_buf == NULL)
+ return;
+
+ // Set the destination coordinates of the mouse
+ prim->getDst().topLeft() = _mpos - RMPoint(0, 30);
+
+ CORO_INVOKE_2(RMText::draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+RMPoint RMTextItemName::getHotspot() {
+ if (_item == NULL)
+ return _mpos + _curscroll;
+ else
+ return _item->getHotspot();
+}
+
+RMItem *RMTextItemName::getSelectedItem() {
+ return _item;
+}
+
+bool RMTextItemName::isItemSelected() {
+ return _item != NULL;
+}
+
+void RMTextItemName::setMouseCoord(const RMPoint &m) {
+ _mpos = m;
+}
+
+void RMTextItemName::removeThis(CORO_PARAM, bool &result) {
+ result = true;
+}
+
+/****************************************************************************\
+* RMDialogChoice Methods
+\****************************************************************************/
+
+RMDialogChoice::RMDialogChoice() {
+ RMResRaw dlg1(RES_I_DLGTEXT);
+ RMResRaw dlg2(RES_I_DLGTEXTLINE);
+ RMRes dlgpal(RES_I_DLGTEXTPAL);
+
+ _dlgText.init(dlg1, dlg1.width(), dlg1.height());
+ _dlgTextLine.init(dlg2, dlg2.width(), dlg2.height());
+
+ _dlgText.loadPaletteWA(dlgpal);
+ _dlgTextLine.loadPaletteWA(dlgpal);
+
+ _hUnreg = CoroScheduler.createEvent(false, false);
+ _bRemoveFromOT = false;
+
+ _curAdded = 0;
+ _bShow = false;
+}
+
+RMDialogChoice::~RMDialogChoice() {
+ CoroScheduler.closeEvent(_hUnreg);
+}
+
+void RMDialogChoice::unregister() {
+ RMGfxWoodyBuffer::unregister();
+ assert(!_nInList);
+ CoroScheduler.pulseEvent(_hUnreg);
+
+ _bRemoveFromOT = false;
+}
+
+void RMDialogChoice::init() {
+ _numChoices = 0;
+ _drawedStrings = NULL;
+ _ptDrawStrings = NULL;
+ _curSelection = -1;
+
+ create(640, 477);
+ setPriority(140);
+}
+
+
+void RMDialogChoice::close() {
+ if (_drawedStrings != NULL) {
+ delete[] _drawedStrings;
+ _drawedStrings = NULL;
+ }
+
+ if (_ptDrawStrings != NULL) {
+ delete[] _ptDrawStrings;
+ _ptDrawStrings = NULL;
+ }
+
+ destroy();
+}
+
+void RMDialogChoice::setNumChoices(int num) {
+ _numChoices = num;
+ _curAdded = 0;
+
+ // Allocate space for drawn strings
+ _drawedStrings = new RMText[num];
+ _ptDrawStrings = new RMPoint[num];
+
+ // Initialization
+ for (int i = 0; i < _numChoices; i++) {
+ _drawedStrings[i].setColor(0, 255, 0);
+ _drawedStrings[i].setAlignType(RMText::HLEFTPAR, RMText::VTOP);
+ _drawedStrings[i].setMaxLineLength(600);
+ _drawedStrings[i].setPriority(10);
+ }
+}
+
+void RMDialogChoice::addChoice(const Common::String &string) {
+ // Draw the string
+ assert(_curAdded < _numChoices);
+ _drawedStrings[_curAdded++].writeText(string, 0);
+}
+
+void RMDialogChoice::prepare(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ RMPoint ptPos;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ addPrim(new RMGfxPrimitive(&_dlgText, RMPoint(0, 0)));
+ addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155)));
+ addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83)));
+ addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83)));
+ addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83 + 83)));
+
+ _ctx->ptPos.set(20, 90);
+
+ for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
+ addPrim(new RMGfxPrimitive(&_drawedStrings[_ctx->i], _ctx->ptPos));
+ _ptDrawStrings[_ctx->i] = _ctx->ptPos;
+ _ctx->ptPos.offset(0, _drawedStrings[_ctx->i].getDimy() + 15);
+ }
+
+ CORO_INVOKE_0(drawOT);
+ clearOT();
+
+ _ptDrawPos.set(0, 480 - _ctx->ptPos._y);
+
+ CORO_END_CODE;
+}
+
+void RMDialogChoice::setSelected(CORO_PARAM, int pos) {
+ CORO_BEGIN_CONTEXT;
+ RMGfxBox box;
+ RMRect rc;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (pos == _curSelection)
+ return;
+
+ _ctx->box.setPriority(5);
+
+ if (_curSelection != -1) {
+ _ctx->box.setColor(0xCC, 0xCC, 0xFF);
+ _ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection]._y);
+ _ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy());
+ addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
+
+ addPrim(new RMGfxPrimitive(&_drawedStrings[_curSelection], _ptDrawStrings[_curSelection]));
+ CORO_INVOKE_0(drawOT);
+ clearOT();
+ }
+
+ if (pos != -1) {
+ _ctx->box.setColor(100, 100, 100);
+ _ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos]._y);
+ _ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[pos].getDimy());
+ addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
+ addPrim(new RMGfxPrimitive(&_drawedStrings[pos], _ptDrawStrings[pos]));
+ }
+
+ CORO_INVOKE_0(drawOT);
+ clearOT();
+
+ _curSelection = pos;
+
+ CORO_END_CODE;
+}
+
+void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
+ CORO_BEGIN_CONTEXT;
+ RMPoint destpt;
+ int deltay;
+ int starttime;
+ int elaps;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_0(prepare);
+ _bShow = false;
+
+ if (!_nInList && bigBuf != NULL)
+ bigBuf->addPrim(new RMGfxPrimitive(this));
+
+ if (0) {
+ _bShow = true;
+ } else {
+ _ctx->starttime = g_vm->getTime();
+ _ctx->deltay = 480 - _ptDrawPos._y;
+ _ctx->destpt = _ptDrawPos;
+ _ptDrawPos.set(0, 480);
+
+ if (!_nInList && bigBuf != NULL)
+ bigBuf->addPrim(new RMGfxPrimitive(this));
+ _bShow = true;
+
+ _ctx->elaps = 0;
+ while (_ctx->elaps < 700) {
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ _ctx->elaps = g_vm->getTime() - _ctx->starttime;
+ _ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * _ctx->elaps) / 100;
+ }
+
+ _ptDrawPos._y = _ctx->destpt._y;
+ }
+
+ CORO_END_CODE;
+}
+
+void RMDialogChoice::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_bShow == false)
+ return;
+
+ prim->setDst(_ptDrawPos);
+ CORO_INVOKE_2(RMGfxSourceBuffer16::draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+
+void RMDialogChoice::hide(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ int deltay;
+ int starttime;
+ int elaps;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (1) {
+ _ctx->starttime = g_vm->getTime();
+
+ _ctx->deltay = 480 - _ptDrawPos._y;
+ _ctx->elaps = 0;
+ while (_ctx->elaps < 700) {
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ _ctx->elaps = g_vm->getTime() - _ctx->starttime;
+ _ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100;
+ }
+ }
+
+ _bShow = false;
+ _bRemoveFromOT = true;
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _hUnreg, CORO_INFINITE);
+
+ CORO_END_CODE;
+}
+
+
+void RMDialogChoice::removeThis(CORO_PARAM, bool &result) {
+ result = _bRemoveFromOT;
+}
+
+void RMDialogChoice::doFrame(CORO_PARAM, RMPoint ptMousePos) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (ptMousePos._y > _ptDrawPos._y) {
+ for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
+ if ((ptMousePos._y >= _ptDrawPos._y + _ptDrawStrings[_ctx->i]._y) && (ptMousePos._y < _ptDrawPos._y + _ptDrawStrings[_ctx->i]._y + _drawedStrings[_ctx->i].getDimy())) {
+ CORO_INVOKE_1(setSelected, _ctx->i);
+ break;
+ }
+ }
+
+ if (_ctx->i == _numChoices)
+ CORO_INVOKE_1(setSelected, -1);
+ }
+
+ CORO_END_CODE;
+}
+
+int RMDialogChoice::getSelection() {
+ return _curSelection;
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/font.h b/engines/tony/font.h
new file mode 100644
index 0000000000..13c1ddf268
--- /dev/null
+++ b/engines/tony/font.h
@@ -0,0 +1,379 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_FONT_H
+#define TONY_FONT_H
+
+#include "common/system.h"
+#include "common/coroutines.h"
+#include "tony/gfxcore.h"
+#include "tony/resid.h"
+
+namespace Tony {
+
+class RMInput;
+class RMInventory;
+class RMItem;
+class RMLoc;
+class RMLocation;
+class RMPointer;
+
+/**
+ * Manages a font, in which there is a different surface for each letter
+ */
+class RMFont : public RMGfxTaskSetPrior {
+protected:
+ int _nLetters;
+ RMGfxSourceBuffer8RLEByte *_letter;
+public:
+ int _fontDimx, _fontDimy;
+
+private:
+ int _dimx, _dimy;
+
+ class RMFontPrimitive : public RMGfxPrimitive {
+ public:
+ RMFontPrimitive() : RMGfxPrimitive() { _nChar = 0; }
+ RMFontPrimitive(RMGfxTask *task) : RMGfxPrimitive(task) { _nChar = 0; }
+ virtual ~RMFontPrimitive() { }
+ virtual RMGfxPrimitive *duplicate() {
+ return new RMFontPrimitive(*this);
+ }
+
+ int _nChar;
+ };
+
+protected:
+ // Loads the font
+ void load(uint32 resID, int nChars, int dimx, int dimy, uint32 palResID = RES_F_PAL);
+ void load(const byte *buf, int nChars, int dimx, int dimy, uint32 palResID = RES_F_PAL);
+
+ // Remove the font
+ void unload();
+
+protected:
+ // Conversion form character to font index
+ virtual int convertToLetter(byte nChar) = 0;
+
+ // Character width
+ virtual int letterLength(int nChar, int nNext = 0) = 0;
+
+public:
+ virtual int letterHeight() = 0;
+
+public:
+ RMFont();
+ virtual ~RMFont();
+
+ // Initialization and closing
+ virtual void init() = 0;
+ virtual void close();
+
+ // Drawing
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBug, RMGfxPrimitive *prim);
+
+ // Create a primitive for a letter
+ RMGfxPrimitive *makeLetterPrimitive(byte bChar, int &nLength);
+
+ // Length in pixels of a string with the current font
+ int stringLen(const Common::String &text);
+ int stringLen(char bChar, char bNext = 0);
+};
+
+
+class RMFontColor : public virtual RMFont {
+private:
+ byte _fontR, _fontG, _fontB;
+
+public:
+ RMFontColor();
+ virtual ~RMFontColor();
+ virtual void setBaseColor(byte r, byte g, byte b);
+};
+
+
+class RMFontWithTables : public virtual RMFont {
+protected:
+ int _cTable[256];
+ int _lTable[256];
+ int _lDefault;
+ int _hDefault;
+ signed char _l2Table[256][256];
+
+protected:
+ // Overloaded methods
+ int convertToLetter(byte nChar);
+ int letterLength(int nChar, int nNext = 0);
+
+public:
+ int letterHeight() {
+ return _hDefault;
+ }
+ virtual ~RMFontWithTables() {}
+};
+
+
+class RMFontDialog : public RMFontColor, public RMFontWithTables {
+public:
+ void init();
+ virtual ~RMFontDialog() {}
+};
+
+class RMFontObj : public RMFontColor, public RMFontWithTables {
+private:
+ void setBothCase(int nChar, int nNext, signed char spiazz);
+
+public:
+ void init();
+ virtual ~RMFontObj() {}
+};
+
+class RMFontMacc : public RMFontColor, public RMFontWithTables {
+public:
+ void init();
+ virtual ~RMFontMacc() {}
+};
+
+class RMFontCredits : public RMFontColor, public RMFontWithTables {
+public:
+ void init();
+ virtual ~RMFontCredits() {}
+ virtual void setBaseColor(byte r, byte g, byte b) {}
+};
+
+/**
+ * Manages writing text onto9 the screen
+ */
+class RMText : public RMGfxWoodyBuffer {
+private:
+ static RMFontColor *_fonts[4];
+ int _maxLineLength;
+
+public:
+ enum HorAlign {
+ HLEFT,
+ HLEFTPAR,
+ HCENTER,
+ HRIGHT
+ };
+
+ enum VerAlign {
+ VTOP,
+ VCENTER,
+ VBOTTOM
+ };
+
+private:
+ HorAlign _aHorType;
+ VerAlign _aVerType;
+ byte _textR, _textG, _textB;
+
+protected:
+ virtual void clipOnScreen(RMGfxPrimitive *prim);
+
+public:
+ RMText();
+ virtual ~RMText();
+ static void initStatics();
+ static void unload();
+
+ // Set the alignment type
+ void setAlignType(HorAlign aHor, VerAlign aVer);
+
+ // Sets the maximum length of a line in pixels (used to format the text)
+ void setMaxLineLength(int max);
+
+ // Write the text
+ void writeText(const Common::String &text, int font, int *time = NULL);
+ void writeText(Common::String text, RMFontColor *font, int *time = NULL);
+
+ // Overloaded function to decide when you delete the object from the OT list
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ // Overloading of the Draw to center the text, if necessary
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Set the base color
+ void setColor(byte r, byte g, byte b);
+};
+
+/**
+ * Manages text in a dialog
+ */
+class RMTextDialog : public RMText {
+protected:
+ int _startTime;
+ int _time;
+ bool _bSkipStatus;
+ RMPoint _dst;
+ uint32 _hEndDisplay;
+ bool _bShowed;
+ bool _bForceTime;
+ bool _bForceNoTime;
+ uint32 _hCustomSkip;
+ uint32 _hCustomSkip2;
+ RMInput *_input;
+ bool _bAlwaysDisplay;
+ bool _bNoTab;
+
+public:
+ RMTextDialog();
+ virtual ~RMTextDialog();
+
+ // Write the text
+ void writeText(const Common::String &text, int font, int *time = NULL);
+ void writeText(const Common::String &text, RMFontColor *font, int *time = NULL);
+
+ // Overloaded function to decide when you delete the object from the OT list
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ // Overloaded de-registration
+ virtual void unregister();
+
+ // Overloading of the Draw to center the text, if necessary
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Set the position
+ void setPosition(const RMPoint &pt);
+
+ // Waiting
+ void waitForEndDisplay(CORO_PARAM);
+ void setCustomSkipHandle(uint32 hCustomSkip);
+ void setCustomSkipHandle2(uint32 hCustomSkip);
+ void setSkipStatus(bool bEnabled);
+ void setForcedTime(uint32 dwTime);
+ void setNoTab();
+ void forceTime();
+ void forceNoTime();
+ void setAlwaysDisplay();
+
+ // Set the input device, to allow skip from mouse
+ void setInput(RMInput *input);
+
+ void show();
+ void hide(CORO_PARAM);
+};
+
+class RMTextDialogScrolling : public RMTextDialog {
+protected:
+ RMLocation *_curLoc;
+ RMPoint _startScroll;
+
+ virtual void clipOnScreen(RMGfxPrimitive *prim);
+
+public:
+ RMTextDialogScrolling();
+ RMTextDialogScrolling(RMLocation *loc);
+ virtual ~RMTextDialogScrolling();
+
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+
+/**
+ * Manages the name of a selected item on the screen
+ */
+class RMTextItemName : protected RMText {
+protected:
+ RMPoint _mpos;
+ RMPoint _curscroll;
+ RMItem *_item;
+
+public:
+ RMTextItemName();
+ virtual ~RMTextItemName();
+
+ void setMouseCoord(const RMPoint &m);
+
+ void doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ RMPoint getHotspot();
+ RMItem *getSelectedItem();
+ bool isItemSelected();
+
+ virtual void removeThis(CORO_PARAM, bool &result);
+};
+
+
+/**
+ * Manages the selection of screen items in a box
+ */
+class RMDialogChoice : public RMGfxWoodyBuffer {
+private:
+ int _curSelection;
+ int _numChoices;
+ RMText *_drawedStrings;
+ RMPoint *_ptDrawStrings;
+ int _curAdded;
+ bool _bShow;
+ RMGfxSourceBuffer8 _dlgText;
+ RMGfxSourceBuffer8 _dlgTextLine;
+ RMPoint _ptDrawPos;
+ uint32 _hUnreg;
+ bool _bRemoveFromOT;
+
+protected:
+ void prepare(CORO_PARAM);
+ void setSelected(CORO_PARAM, int pos);
+
+public:
+ virtual void removeThis(CORO_PARAM, bool &result);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ void unregister();
+
+public:
+ // Initialization
+ RMDialogChoice();
+ virtual ~RMDialogChoice();
+
+ // Initialization and closure
+ void init();
+ void close();
+
+ // Sets the number of possible sentences, which then be added with AddChoice()
+ void setNumChoices(int num);
+
+ // Adds a string with the choice
+ void addChoice(const Common::String &string);
+
+ // Show and hide the selection, with possible animations.
+ // NOTE: If no parameter is passed to Show(), it is the obligation of
+ // caller to ensure that the class is inserted into OT list
+ void show(CORO_PARAM, RMGfxTargetBuffer *bigBuf = NULL);
+ void hide(CORO_PARAM);
+
+ // Polling Update
+ void doFrame(CORO_PARAM, RMPoint ptMousePos);
+
+ // Returns the currently selected item, or -1 if none is selected
+ int getSelection();
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
new file mode 100644
index 0000000000..1a19f2836c
--- /dev/null
+++ b/engines/tony/game.cpp
@@ -0,0 +1,1604 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/file.h"
+#include "common/savefile.h"
+#include "common/textconsole.h"
+#include "graphics/cursorman.h"
+#include "tony/mpal/lzo.h"
+#include "tony/mpal/memory.h"
+#include "tony/mpal/mpal.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/game.h"
+#include "tony/gfxengine.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+using namespace MPAL;
+
+// Global functions
+void mainEnableGUI() {
+ g_vm->getEngine()->_bGUIInterface = true;
+ g_vm->getEngine()->_bGUIInventory = true;
+ g_vm->getEngine()->_bGUIOption = true;
+}
+
+void mainDisableGUI() {
+ g_vm->getEngine()->_bGUIInterface = false;
+ g_vm->getEngine()->_bGUIInventory = false;
+ g_vm->getEngine()->_bGUIOption = false;
+}
+
+/****************************************************************************\
+* RMOptionButton Methods
+\****************************************************************************/
+
+RMOptionButton::RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState) {
+ RMResRaw raw(dwRes);
+ assert(raw.isValid());
+ _buf = new RMGfxSourceBuffer16(false);
+ _buf->init(raw, raw.width(), raw.height());
+
+ _rect.setRect(pt._x, pt._y, pt._x + raw.width() - 1, pt._y + raw.height() - 1);
+ _bActive = false;
+ _bHasGfx = true;
+ _bDoubleState = bDoubleState;
+}
+
+RMOptionButton::RMOptionButton(const RMRect &pt) {
+ _rect = pt;
+ _bActive = false;
+ _bHasGfx = false;
+ _bDoubleState = false;
+ _buf = NULL;
+}
+
+RMOptionButton::~RMOptionButton() {
+ if (_bHasGfx)
+ delete _buf;
+}
+
+bool RMOptionButton::doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) {
+ if (!_bDoubleState) {
+ if (_rect.ptInRect(mousePos)) {
+ if (!_bActive) {
+ _bActive = true;
+ return true;
+ }
+ } else {
+ if (_bActive) {
+ _bActive = false;
+ return true;
+ }
+ }
+ } else {
+ if (bLeftClick && _rect.ptInRect(mousePos)) {
+ _bActive = !_bActive;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void RMOptionButton::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (!_bActive)
+ return;
+
+ if (_bHasGfx)
+ CORO_INVOKE_2(_buf->draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+void RMOptionButton::addToList(RMGfxTargetBuffer &bigBuf) {
+ if (_bHasGfx)
+ bigBuf.addPrim(new RMGfxPrimitive(this, _rect));
+}
+
+bool RMOptionButton::isActive() {
+ return _bActive;
+}
+
+void RMOptionButton::setActiveState(bool bState) {
+ _bActive = bState;
+}
+
+/****************************************************************************\
+* RMOptionSlide Methods
+\****************************************************************************/
+
+RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int slideSize) {
+ RMResRaw *raw;
+
+ _pos = pt;
+ _nSlideSize = slideSize;
+ _nMax = nRange;
+ _nStep = 100 / _nMax;
+ _nValue = nStartValue;
+
+ _sliderCenter = NULL;
+ _sliderLeft = NULL;
+ _sliderRight = NULL;
+ _sliderSingle = NULL;
+
+ // Sliders
+ INIT_GFX16_FROMRAW(20029, _sliderCenter);
+ INIT_GFX16_FROMRAW(20030, _sliderLeft);
+ INIT_GFX16_FROMRAW(20031, _sliderRight);
+ INIT_GFX16_FROMRAW(20032, _sliderSingle);
+
+ // Buttons
+ _pushLeft = new RMOptionButton(RMRect(pt._x - 23, pt._y, pt._x - 23 + 22, pt._y + 26));
+ _pushRight = new RMOptionButton(RMRect(pt._x + _nSlideSize, pt._y, pt._x + _nSlideSize + 5 + 22, pt._y + 26));
+}
+
+
+RMOptionSlide::~RMOptionSlide() {
+ delete _sliderCenter;
+ _sliderCenter = NULL;
+ delete _sliderLeft;
+ _sliderLeft = NULL;
+ delete _sliderRight;
+ _sliderRight = NULL;
+ delete _sliderSingle;
+ _sliderSingle = NULL;
+
+ delete _pushLeft;
+ _pushLeft = NULL;
+ delete _pushRight;
+ _pushRight = NULL;
+}
+
+bool RMOptionSlide::doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) {
+ bool bRefresh = false;
+
+ // Do the button DoFrame's
+ _pushLeft->doFrame(mousePos, bLeftClick, bRightClick);
+ _pushRight->doFrame(mousePos, bLeftClick, bRightClick);
+
+ if (_pushLeft->isActive()) {
+ if (bLeftClick) {
+ bRefresh = true;
+ _nValue--;
+ } else if (bRightClick) {
+ bRefresh = true;
+ _nValue -= 3;
+ }
+ if (_nValue < 1)
+ _nValue = 1;
+ } else if (_pushRight->isActive()) {
+ bRefresh = true;
+
+ if (bLeftClick) {
+ bRefresh = true;
+ _nValue++;
+ } else if (bRightClick) {
+ bRefresh = true;
+ _nValue += 3;
+ }
+ if (_nValue > _nMax)
+ _nValue = _nMax;
+ }
+
+ return bRefresh;
+}
+
+void RMOptionSlide::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ int val;
+ RMPoint pos;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->pos = _pos;
+ _ctx->pos._x += 4;
+ _ctx->pos._y += 4;
+
+ _ctx->val = _nValue * _nStep;
+ if (_ctx->val < 1)
+ _ctx->val = 1;
+ else if (_ctx->val > 100)
+ _ctx->val = 100;
+
+ if (_ctx->val == 1) {
+ prim->setDst(_ctx->pos);
+ CORO_INVOKE_2(_sliderSingle->draw, bigBuf, prim);
+ } else {
+ prim->setDst(_ctx->pos);
+ CORO_INVOKE_2(_sliderLeft->draw, bigBuf, prim);
+ _ctx->pos._x += 3;
+
+ for (_ctx->i = 1; _ctx->i < _ctx->val - 1; _ctx->i++) {
+ prim->setDst(_ctx->pos);
+ CORO_INVOKE_2(_sliderCenter->draw, bigBuf, prim);
+ _ctx->pos._x += 3;
+ }
+
+ prim->setDst(_ctx->pos);
+ CORO_INVOKE_2(_sliderRight->draw, bigBuf, prim);
+ _ctx->pos._x += 3;
+ }
+
+ CORO_END_CODE;
+}
+
+void RMOptionSlide::addToList(RMGfxTargetBuffer &bigBuf) {
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+}
+
+int RMOptionSlide::getValue() {
+ return _nValue;
+}
+
+/****************************************************************************\
+* RMOptionScreen Methods
+\****************************************************************************/
+
+RMOptionScreen::RMOptionScreen() {
+ _nState = MENUNONE;
+ _menu = NULL;
+ _hideLoadSave = NULL;
+ _quitConfirm = NULL;
+ _bQuitConfirm = false;
+
+ create(RM_SX, RM_SY);
+
+ _buttonExit = NULL;
+ _buttonLoad = NULL;
+ _buttonSave = NULL;
+ _buttonGameMenu = NULL;
+ _buttonGfxMenu = NULL;
+ _buttonSoundMenu = NULL;
+ _buttonSave_ArrowLeft = NULL;
+ _buttonSave_ArrowRight = NULL;
+ _bEditSaveName = false;
+
+ for (int i = 0; i < 6; i++) {
+ _curThumb[i] = NULL;
+ _buttonSave_States[i] = NULL;
+ }
+
+ _statePos = 0;
+ _buttonQuitYes = NULL;
+ _buttonQuitNo = NULL;
+ _buttonQuit = NULL;
+ _saveEasy = NULL;
+ _saveHard = NULL;
+ _buttonGfx_Tips = NULL;
+ _buttonSound_DubbingOn = NULL;
+ _buttonSound_MusicOn = NULL;
+ _buttonSound_SFXOn = NULL;
+ _slideTonySpeed = NULL;
+ _slideTextSpeed = NULL;
+ _buttonGame_Lock = NULL;
+ _buttonGfx_Anni30 = NULL;
+ _sliderSound_Music = NULL;
+ _buttonGame_TimerizedText = NULL;
+ _buttonGfx_AntiAlias = NULL;
+ _sliderSound_SFX = NULL;
+ _buttonGame_Scrolling = NULL;
+ _buttonGfx_Sottotitoli = NULL;
+ _sliderSound_Dubbing = NULL;
+ _buttonGame_InterUp = NULL;
+ _buttonGfx_Trans = NULL;
+
+ _fadeStep = 0;
+ _fadeY = 0;
+ _fadeTime = 0;
+ _nEditPos = 0;
+ _nLastState = MENUGAME;
+}
+
+RMOptionScreen::~RMOptionScreen() {
+ closeState();
+}
+
+void RMOptionScreen::refreshAll(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ RMGfxSourceBuffer16 *thumb;
+ RMText *title;
+ RMText *num[6];
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+ clearOT();
+
+ addPrim(new RMGfxPrimitive(_menu));
+
+ if (_bNoLoadSave)
+ addPrim(new RMGfxPrimitive(_hideLoadSave, RMPoint(0, 401)));
+
+ if (_bQuitConfirm) {
+ addPrim(new RMGfxPrimitive(_quitConfirm, RMPoint(270, 200)));
+ _buttonQuitYes->addToList(*this);
+ _buttonQuitNo->addToList(*this);
+ }
+
+ _buttonExit->addToList(*this);
+
+ if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND) {
+ _buttonQuit->addToList(*this);
+ _buttonLoad->addToList(*this);
+ _buttonSave->addToList(*this);
+ }
+
+ if (_nState == MENUGAME) {
+ _buttonGame_Lock->addToList(*this);
+ _buttonGame_TimerizedText->addToList(*this);
+ _buttonGame_Scrolling->addToList(*this);
+ _buttonGame_InterUp->addToList(*this);
+ _slideTextSpeed->addToList(*this);
+ _slideTonySpeed->addToList(*this);
+ } else if (_nState == MENUGFX) {
+ _buttonGfx_Anni30->addToList(*this);
+ _buttonGfx_AntiAlias->addToList(*this);
+ _buttonGfx_Sottotitoli->addToList(*this);
+ _buttonGfx_Trans->addToList(*this);
+ _buttonGfx_Tips->addToList(*this);
+ } else if (_nState == MENUSOUND) {
+ _sliderSound_Dubbing->addToList(*this);
+ _sliderSound_Music->addToList(*this);
+ _sliderSound_SFX->addToList(*this);
+ _buttonSound_DubbingOn->addToList(*this);
+ _buttonSound_MusicOn->addToList(*this);
+ _buttonSound_SFXOn->addToList(*this);
+ }
+
+ _ctx->thumb = NULL;
+ _ctx->title = NULL;
+ Common::fill(&_ctx->num[0], &_ctx->num[6], (RMText *)NULL);
+
+ if (_nState == MENULOAD || _nState == MENUSAVE) {
+ _ctx->title = new RMText;
+ if (_nState == MENULOAD) {
+ RMMessage msg(10);
+ _ctx->title->writeText(msg[0], 1);
+ } else {
+ RMMessage msg(11);
+ _ctx->title->writeText(msg[0], 1);
+ }
+
+ addPrim(new RMGfxPrimitive(_ctx->title, RMPoint(320, 10)));
+
+ if (_curThumbDiff[0] == 0)
+ addPrim(new RMGfxPrimitive(_saveHard, RMPoint(48, 57)));
+ else if (_curThumbDiff[0] == 1)
+ addPrim(new RMGfxPrimitive(_saveEasy, RMPoint(48, 57)));
+ if (_curThumbDiff[1] == 0)
+ addPrim(new RMGfxPrimitive(_saveHard, RMPoint(240, 57)));
+ else if (_curThumbDiff[1] == 1)
+ addPrim(new RMGfxPrimitive(_saveEasy, RMPoint(240, 57)));
+ if (_curThumbDiff[2] == 0)
+ addPrim(new RMGfxPrimitive(_saveHard, RMPoint(432, 57)));
+ else if (_curThumbDiff[2] == 1)
+ addPrim(new RMGfxPrimitive(_saveEasy, RMPoint(432, 57)));
+ if (_curThumbDiff[3] == 0)
+ addPrim(new RMGfxPrimitive(_saveHard, RMPoint(48, 239)));
+ else if (_curThumbDiff[3] == 1)
+ addPrim(new RMGfxPrimitive(_saveEasy, RMPoint(48, 239)));
+ if (_curThumbDiff[4] == 0)
+ addPrim(new RMGfxPrimitive(_saveHard, RMPoint(240, 239)));
+ else if (_curThumbDiff[4] == 1)
+ addPrim(new RMGfxPrimitive(_saveEasy, RMPoint(240, 239)));
+ if (_curThumbDiff[5] == 0)
+ addPrim(new RMGfxPrimitive(_saveHard, RMPoint(432, 239)));
+ else if (_curThumbDiff[5] == 1)
+ addPrim(new RMGfxPrimitive(_saveEasy, RMPoint(432, 239)));
+
+ if (_curThumb[0] && !(_bEditSaveName && _nEditPos == 0))
+ addPrim(new RMGfxPrimitive(_curThumb[0], RMPoint(48, 57)));
+ if (_curThumb[1] && !(_bEditSaveName && _nEditPos == 1))
+ addPrim(new RMGfxPrimitive(_curThumb[1], RMPoint(240, 57)));
+ if (_curThumb[2] && !(_bEditSaveName && _nEditPos == 2))
+ addPrim(new RMGfxPrimitive(_curThumb[2], RMPoint(432, 57)));
+ if (_curThumb[3] && !(_bEditSaveName && _nEditPos == 3))
+ addPrim(new RMGfxPrimitive(_curThumb[3], RMPoint(48, 239)));
+ if (_curThumb[4] && !(_bEditSaveName && _nEditPos == 4))
+ addPrim(new RMGfxPrimitive(_curThumb[4], RMPoint(240, 239)));
+ if (_curThumb[5] && !(_bEditSaveName && _nEditPos == 5))
+ addPrim(new RMGfxPrimitive(_curThumb[5], RMPoint(432, 239)));
+
+ if (_bEditSaveName) {
+ _ctx->thumb = new RMGfxSourceBuffer16;
+ _ctx->thumb->init((byte *)g_vm->getThumbnail(), 640 / 4, 480 / 4);
+
+ if (_nEditPos == 0)
+ addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 57)));
+ else if (_nEditPos == 1)
+ addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(240, 57)));
+ else if (_nEditPos == 2)
+ addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(432, 57)));
+ else if (_nEditPos == 3)
+ addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 239)));
+ else if (_nEditPos == 4)
+ addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(240, 239)));
+ else if (_nEditPos == 5)
+ addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(432, 239)));
+ }
+
+ for (_ctx->i = 0; _ctx->i < 6; _ctx->i++) {
+ Common::String s;
+
+ if (_bEditSaveName && _nEditPos == _ctx->i)
+ s = Common::String::format("%02d)%s*", _statePos + _ctx->i, _editName);
+ else {
+ if (_statePos == 0 && _ctx->i == 0)
+ s = "Autosave";
+ else
+ s = Common::String::format("%02d)%s", _statePos + _ctx->i, _curThumbName[_ctx->i].c_str());
+ }
+
+ _ctx->num[_ctx->i] = new RMText;
+ _ctx->num[_ctx->i]->setAlignType(RMText::HLEFT, RMText::VTOP);
+ _ctx->num[_ctx->i]->writeText(s, 2);
+ }
+
+ addPrim(new RMGfxPrimitive(_ctx->num[0], RMPoint(55 - 3, 180 + 14)));
+ addPrim(new RMGfxPrimitive(_ctx->num[1], RMPoint(247 - 3, 180 + 14)));
+ addPrim(new RMGfxPrimitive(_ctx->num[2], RMPoint(439 - 3, 180 + 14)));
+ addPrim(new RMGfxPrimitive(_ctx->num[3], RMPoint(55 - 3, 362 + 14)));
+ addPrim(new RMGfxPrimitive(_ctx->num[4], RMPoint(247 - 3, 362 + 14)));
+ addPrim(new RMGfxPrimitive(_ctx->num[5], RMPoint(439 - 3, 362 + 14)));
+
+ _buttonSave_ArrowLeft->addToList(*this);
+ _buttonSave_ArrowRight->addToList(*this);
+ }
+
+ CORO_INVOKE_0(drawOT);
+
+ if (_nState == MENULOAD || _nState == MENUSAVE) {
+ if (_ctx->thumb)
+ delete _ctx->thumb;
+
+ if (_ctx->title)
+ delete _ctx->title;
+
+ for (_ctx->i = 0; _ctx->i < 6; _ctx->i++) {
+ if (_ctx->num[_ctx->i])
+ delete _ctx->num[_ctx->i];
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::refreshThumbnails() {
+ for (int i = 0; i < 6; i++) {
+ if (_curThumb[i])
+ delete _curThumb[i];
+
+ _curThumb[i] = new RMGfxSourceBuffer16;
+ _curThumb[i]->create(640 / 4, 480 / 4);
+ if (!loadThumbnailFromSaveState(_statePos + i, *_curThumb[i], _curThumbName[i], _curThumbDiff[i])) {
+ delete _curThumb[i];
+ _curThumb[i] = NULL;
+ _curThumbName[i].clear();
+ _curThumbDiff[i] = 11;
+ }
+ }
+}
+
+void RMOptionScreen::initState(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ RMResRaw *raw;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND)
+ _ctx->raw = new RMResRaw(20000 + _nState);
+ else if (_nState == MENULOAD || _nState == MENUSAVE) {
+ if (_bAlterGfx)
+ _ctx->raw = new RMResRaw(20024);
+ else
+ _ctx->raw = new RMResRaw(20003);
+ } else {
+ error("Invalid state");
+ }
+
+ assert(_ctx->raw->isValid());
+ assert(_menu == NULL);
+ _menu = new RMGfxSourceBuffer16(false);
+ _menu->init(*_ctx->raw, _ctx->raw->width(), _ctx->raw->height());
+ delete _ctx->raw;
+
+ if (_nState == MENULOAD || _nState == MENUSAVE) {
+ if (_bAlterGfx) {
+ assert(_buttonExit == NULL);
+ _buttonExit = new RMOptionButton(20025, RMPoint(561, 406));
+ } else {
+ assert(_buttonExit == NULL);
+ _buttonExit = new RMOptionButton(20012, RMPoint(560, 404));
+ }
+
+ INIT_GFX8_FROMRAW(_ctx->raw, 20036, _saveEasy);
+ INIT_GFX8_FROMRAW(_ctx->raw, 20037, _saveHard);
+
+ refreshThumbnails();
+
+ assert(_buttonSave_States[0] == NULL);
+ _buttonSave_States[0] = new RMOptionButton(RMRect(48, 57, 48 + 160, 57 + 120));
+ assert(_buttonSave_States[1] == NULL);
+ _buttonSave_States[1] = new RMOptionButton(RMRect(240, 57, 240 + 160, 57 + 120));
+ assert(_buttonSave_States[2] == NULL);
+ _buttonSave_States[2] = new RMOptionButton(RMRect(432, 57, 432 + 160, 57 + 120));
+ assert(_buttonSave_States[3] == NULL);
+ _buttonSave_States[3] = new RMOptionButton(RMRect(48, 239, 48 + 160, 239 + 120));
+ assert(_buttonSave_States[4] == NULL);
+ _buttonSave_States[4] = new RMOptionButton(RMRect(240, 239, 240 + 160, 239 + 120));
+ assert(_buttonSave_States[5] == NULL);
+ _buttonSave_States[5] = new RMOptionButton(RMRect(432, 239, 432 + 160, 239 + 120));
+
+ if (_bAlterGfx) {
+ assert(_buttonSave_ArrowLeft == NULL);
+ _buttonSave_ArrowLeft = new RMOptionButton(20026, RMPoint(3, 196));
+ assert(_buttonSave_ArrowRight == NULL);
+ _buttonSave_ArrowRight = new RMOptionButton(20027, RMPoint(601, 197));
+ } else {
+ assert(_buttonSave_ArrowLeft == NULL);
+ _buttonSave_ArrowLeft = new RMOptionButton(20013, RMPoint(0, 197));
+ assert(_buttonSave_ArrowRight == NULL);
+ _buttonSave_ArrowRight = new RMOptionButton(20014, RMPoint(601, 197));
+ }
+ } else if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND) {
+ assert(_buttonExit == NULL);
+ _buttonExit = new RMOptionButton(20005, RMPoint(560, 405));
+ assert(_buttonQuit == NULL);
+ _buttonQuit = new RMOptionButton(20020, RMPoint(7, 408));
+ assert(_buttonLoad == NULL);
+ _buttonLoad = new RMOptionButton(20006, RMPoint(231, 401));
+ assert(_buttonSave == NULL);
+ _buttonSave = new RMOptionButton(20007, RMPoint(325, 401));
+
+ assert(_buttonGameMenu == NULL);
+ _buttonGameMenu = new RMOptionButton(RMRect(24, 32, 118, 64));
+ assert(_buttonGfxMenu == NULL);
+ _buttonGfxMenu = new RMOptionButton(RMRect(118, 32, 212, 64));
+ assert(_buttonSoundMenu == NULL);
+ _buttonSoundMenu = new RMOptionButton(RMRect(212, 32, 306, 64));
+
+ _ctx->raw = new RMResRaw(20021);
+ assert(_ctx->raw->isValid());
+ assert(_quitConfirm == NULL);
+ _quitConfirm = new RMGfxSourceBuffer16(false);
+ _quitConfirm->init(*_ctx->raw, _ctx->raw->width(), _ctx->raw->height());
+ delete _ctx->raw;
+
+ assert(_buttonQuitYes == NULL);
+ _buttonQuitYes = new RMOptionButton(20022, RMPoint(281, 265));
+ _buttonQuitYes->setPriority(30);
+ assert(_buttonQuitNo == NULL);
+ _buttonQuitNo = new RMOptionButton(20023, RMPoint(337, 264));
+ _buttonQuitNo->setPriority(30);
+
+ if (_bNoLoadSave) {
+ _ctx->raw = new RMResRaw(20028);
+ assert(_ctx->raw->isValid());
+ assert(_hideLoadSave == NULL);
+ _hideLoadSave = new RMGfxSourceBuffer16(false);
+ _hideLoadSave->init(*_ctx->raw, _ctx->raw->width(), _ctx->raw->height());
+ delete _ctx->raw;
+ }
+
+ // Menu GAME
+ if (_nState == MENUGAME) {
+ assert(_buttonGame_Lock == NULL);
+ _buttonGame_Lock = new RMOptionButton(20008, RMPoint(176, 262), true);
+ _buttonGame_Lock->setActiveState(GLOBALS._bCfgInvLocked);
+ assert(_buttonGame_TimerizedText == NULL);
+ _buttonGame_TimerizedText = new RMOptionButton(20009, RMPoint(463, 273), true);
+ _buttonGame_TimerizedText->setActiveState(!GLOBALS._bCfgTimerizedText);
+ assert(_buttonGame_Scrolling == NULL);
+ _buttonGame_Scrolling = new RMOptionButton(20010, RMPoint(315, 263), true);
+ _buttonGame_Scrolling->setActiveState(GLOBALS._bCfgInvNoScroll);
+ assert(_buttonGame_InterUp == NULL);
+ _buttonGame_InterUp = new RMOptionButton(20011, RMPoint(36, 258), true);
+ _buttonGame_InterUp->setActiveState(GLOBALS._bCfgInvUp);
+
+ assert(_slideTextSpeed == NULL);
+ _slideTextSpeed = new RMOptionSlide(RMPoint(165, 122), 10, GLOBALS._nCfgTextSpeed);
+ assert(_slideTonySpeed == NULL);
+ _slideTonySpeed = new RMOptionSlide(RMPoint(165, 226), 5, GLOBALS._nCfgTonySpeed);
+ }
+ // Menu Graphics
+ else if (_nState == MENUGFX) {
+ assert(_buttonGfx_Anni30 == NULL);
+ _buttonGfx_Anni30 = new RMOptionButton(20015, RMPoint(247, 178), true);
+ _buttonGfx_Anni30->setActiveState(GLOBALS._bCfgAnni30);
+ assert(_buttonGfx_AntiAlias == NULL);
+ _buttonGfx_AntiAlias = new RMOptionButton(20016, RMPoint(430, 83), true);
+ _buttonGfx_AntiAlias->setActiveState(!GLOBALS._bCfgAntiAlias);
+ assert(_buttonGfx_Sottotitoli == NULL);
+ _buttonGfx_Sottotitoli = new RMOptionButton(20017, RMPoint(98, 82), true);
+ _buttonGfx_Sottotitoli->setActiveState(!GLOBALS._bShowSubtitles);
+ assert(_buttonGfx_Tips == NULL);
+ _buttonGfx_Tips = new RMOptionButton(20018, RMPoint(431, 246), true);
+ _buttonGfx_Tips->setActiveState(GLOBALS._bCfgInterTips);
+ assert(_buttonGfx_Trans == NULL);
+ _buttonGfx_Trans = new RMOptionButton(20019, RMPoint(126, 271), true);
+ _buttonGfx_Trans->setActiveState(!GLOBALS._bCfgTransparence);
+
+ } else if (_nState == MENUSOUND) {
+ assert(_sliderSound_Dubbing == NULL);
+ _sliderSound_Dubbing = new RMOptionSlide(RMPoint(165, 122), 10, GLOBALS._nCfgDubbingVolume);
+ assert(_sliderSound_Music == NULL);
+ _sliderSound_Music = new RMOptionSlide(RMPoint(165, 226), 10, GLOBALS._nCfgMusicVolume);
+ assert(_sliderSound_SFX == NULL);
+ _sliderSound_SFX = new RMOptionSlide(RMPoint(165, 330), 10, GLOBALS._nCfgSFXVolume);
+
+ assert(_buttonSound_DubbingOn == NULL);
+ _buttonSound_DubbingOn = new RMOptionButton(20033, RMPoint(339, 75), true);
+ _buttonSound_DubbingOn->setActiveState(GLOBALS._bCfgDubbing);
+ assert(_buttonSound_MusicOn == NULL);
+ _buttonSound_MusicOn = new RMOptionButton(20034, RMPoint(338, 179), true);
+ _buttonSound_MusicOn->setActiveState(GLOBALS._bCfgMusic);
+ assert(_buttonSound_SFXOn == NULL);
+ _buttonSound_SFXOn = new RMOptionButton(20035, RMPoint(338, 283), true);
+ _buttonSound_SFXOn->setActiveState(GLOBALS._bCfgSFX);
+ }
+ }
+
+ CORO_INVOKE_0(refreshAll);
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::closeState() {
+ delete _menu;
+ _menu = NULL;
+
+ delete _buttonExit;
+ _buttonExit = NULL;
+
+ if (_nState == MENULOAD || _nState == MENUSAVE) {
+ for (int i = 0; i < 6; i++) {
+ if (_curThumb[i] != NULL) {
+ delete _curThumb[i];
+ _curThumb[i] = NULL;
+ }
+
+ delete _buttonSave_States[i];
+ _buttonSave_States[i] = NULL;
+ }
+
+ delete _buttonSave_ArrowLeft;
+ _buttonSave_ArrowLeft = NULL;
+ delete _buttonSave_ArrowRight;
+ _buttonSave_ArrowRight = NULL;
+
+ delete _saveEasy;
+ _saveEasy = NULL;
+ delete _saveHard;
+ _saveHard = NULL;
+ }
+
+ if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND) {
+ delete _buttonQuit;
+ _buttonQuit = NULL;
+ delete _buttonLoad;
+ _buttonLoad = NULL;
+ delete _buttonSave;
+ _buttonSave = NULL;
+ delete _buttonGameMenu;
+ _buttonGameMenu = NULL;
+ delete _buttonGfxMenu;
+ _buttonGfxMenu = NULL;
+ delete _buttonSoundMenu;
+ _buttonSoundMenu = NULL;
+ delete _quitConfirm;
+ _quitConfirm = NULL;
+ delete _buttonQuitYes;
+ _buttonQuitYes = NULL;
+ delete _buttonQuitNo;
+ _buttonQuitNo = NULL;
+
+ if (_bNoLoadSave) {
+ delete _hideLoadSave;
+ _hideLoadSave = NULL;
+ }
+
+ if (_nState == MENUGAME) {
+ GLOBALS._bCfgInvLocked = _buttonGame_Lock->isActive();
+ delete _buttonGame_Lock;
+ _buttonGame_Lock = NULL;
+
+ GLOBALS._bCfgTimerizedText = !_buttonGame_TimerizedText->isActive();
+ delete _buttonGame_TimerizedText;
+ _buttonGame_TimerizedText = NULL;
+
+ GLOBALS._bCfgInvNoScroll = _buttonGame_Scrolling->isActive();
+ delete _buttonGame_Scrolling;
+ _buttonGame_Scrolling = NULL;
+
+ GLOBALS._bCfgInvUp = _buttonGame_InterUp->isActive();
+ delete _buttonGame_InterUp;
+ _buttonGame_InterUp = NULL;
+
+ GLOBALS._nCfgTextSpeed = _slideTextSpeed->getValue();
+ delete _slideTextSpeed;
+ _slideTextSpeed = NULL;
+
+ GLOBALS._nCfgTonySpeed = _slideTonySpeed->getValue();
+ delete _slideTonySpeed;
+ _slideTonySpeed = NULL;
+ } else if (_nState == MENUGFX) {
+ GLOBALS._bCfgAnni30 = _buttonGfx_Anni30->isActive();
+ delete _buttonGfx_Anni30;
+ _buttonGfx_Anni30 = NULL;
+
+ GLOBALS._bCfgAntiAlias = !_buttonGfx_AntiAlias->isActive();
+ delete _buttonGfx_AntiAlias;
+ _buttonGfx_AntiAlias = NULL;
+
+ GLOBALS._bShowSubtitles = !_buttonGfx_Sottotitoli->isActive();
+ delete _buttonGfx_Sottotitoli;
+ _buttonGfx_Sottotitoli = NULL;
+
+ GLOBALS._bCfgInterTips = _buttonGfx_Tips->isActive();
+ delete _buttonGfx_Tips;
+ _buttonGfx_Tips = NULL;
+
+ GLOBALS._bCfgTransparence = !_buttonGfx_Trans->isActive();
+ delete _buttonGfx_Trans;
+ _buttonGfx_Trans = NULL;
+ } else if (_nState == MENUSOUND) {
+ GLOBALS._nCfgDubbingVolume = _sliderSound_Dubbing->getValue();
+ delete _sliderSound_Dubbing;
+ _sliderSound_Dubbing = NULL;
+
+ GLOBALS._nCfgMusicVolume = _sliderSound_Music->getValue();
+ delete _sliderSound_Music;
+ _sliderSound_Music = NULL;
+
+ GLOBALS._nCfgSFXVolume = _sliderSound_SFX->getValue();
+ delete _sliderSound_SFX;
+ _sliderSound_SFX = NULL;
+
+ GLOBALS._bCfgDubbing = _buttonSound_DubbingOn->isActive();
+ delete _buttonSound_DubbingOn;
+ _buttonSound_DubbingOn = NULL;
+
+ GLOBALS._bCfgMusic = _buttonSound_MusicOn->isActive();
+ delete _buttonSound_MusicOn;
+ _buttonSound_MusicOn = NULL;
+
+ GLOBALS._bCfgSFX = _buttonSound_SFXOn->isActive();
+ delete _buttonSound_SFXOn;
+ _buttonSound_SFXOn = NULL;
+ }
+
+ // Save the new settings to ScummVM
+ g_vm->saveSoundSettings();
+ }
+
+ _nState = MENUNONE;
+}
+
+void RMOptionScreen::reInit(RMGfxTargetBuffer &bigBuf) {
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+}
+
+void RMOptionScreen::init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_fadeStep != 0) {
+ result = false;
+ return;
+ }
+
+ _fadeStep = 1;
+ _fadeY = -20;
+ _fadeTime = -1;
+ _bExit = false;
+ _bLoadMenuOnly = false;
+ _bNoLoadSave = false;
+ _bAlterGfx = false;
+
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+
+ if (_nState == MENULOAD || _nState == MENUSAVE || _nState == MENUNONE)
+ _nState = MENUGAME;
+
+ CORO_INVOKE_0(initState);
+
+ result = true;
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::initLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_fadeStep != 0) {
+ result = false;
+ return;
+ }
+
+ _fadeStep = 1;
+ _fadeY = -20;
+ _fadeTime = -1;
+ _bExit = false;
+ _bLoadMenuOnly = true;
+ _bNoLoadSave = false;
+ _bAlterGfx = bAlternateGfx;
+
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+
+ _nState = MENULOAD;
+ CORO_INVOKE_0(initState);
+
+ result = true;
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::initSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_fadeStep != 0) {
+ result = false;
+ return;
+ }
+
+ _fadeStep = 1;
+ _fadeY = -20;
+ _fadeTime = -1;
+ _bExit = false;
+ _bLoadMenuOnly = true;
+ _bNoLoadSave = false;
+ _bAlterGfx = bAlternateGfx;
+
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+
+ _nState = MENUSAVE;
+ CORO_INVOKE_0(initState);
+
+ result = true;
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::initNoLoadSave(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_fadeStep != 0) {
+ result = false;
+ return;
+ }
+
+ _fadeStep = 1;
+ _fadeY = -20;
+ _fadeTime = -1;
+ _bExit = false;
+ _bLoadMenuOnly = false;
+ _bNoLoadSave = true;
+
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+
+ _nState = MENUGAME;
+ CORO_INVOKE_0(initState);
+
+ result = true;
+
+ CORO_END_CODE;
+}
+
+bool RMOptionScreen::close() {
+ if (_fadeStep != 6)
+ return false;
+
+ // Start fade out
+ _fadeStep++;
+ _fadeTime = g_vm->getTime();
+ return true;
+}
+
+bool RMOptionScreen::isClosing() {
+ return _bExit;
+}
+
+int RMOptionScreen::priority() {
+ // Just below the mouse
+ return 190;
+}
+
+void RMOptionScreen::changeState(CORO_PARAM, OptionScreenState newState) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _nLastState = _nState;
+ closeState();
+ _nState = newState;
+ CORO_INVOKE_0(initState);
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
+ CORO_BEGIN_CONTEXT;
+ bool bLeftClick, bRightClick;
+ RMPoint mousePos;
+ bool bRefresh;
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+
+ // If it is fully open, do nothing
+ if (_fadeStep != 6)
+ return;
+
+ // Reads input
+ _ctx->mousePos = input->mousePos();
+ _ctx->bLeftClick = input->mouseLeftClicked();
+ _ctx->bRightClick = input->mouseRightClicked();
+
+ _ctx->bRefresh = false;
+
+ if (_bQuitConfirm) {
+ _ctx->bRefresh |= _buttonQuitYes->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonQuitNo->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ } else {
+ _ctx->bRefresh |= _buttonExit->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+
+ // Check if you have clicked on the output
+ if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND) {
+ // Buttons without graphics...
+ _buttonGameMenu->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _buttonGfxMenu->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _buttonSoundMenu->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+
+ // Buttons with graphics
+ if (!_bNoLoadSave) {
+ if (!g_vm->getIsDemo()) {
+ _ctx->bRefresh |= _buttonLoad->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonSave->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ }
+
+ _ctx->bRefresh |= _buttonQuit->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ }
+ }
+
+ if (_nState == MENUGAME) {
+ _ctx->bRefresh |= _buttonGame_Lock->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGame_TimerizedText->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGame_Scrolling->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGame_InterUp->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _slideTextSpeed->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _slideTonySpeed->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+
+ } else if (_nState == MENUGFX) {
+ _ctx->bRefresh |= _buttonGfx_Anni30->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGfx_AntiAlias->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGfx_Sottotitoli->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGfx_Tips->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonGfx_Trans->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+
+ } else if (_nState == MENUSOUND) {
+ _ctx->bRefresh |= _sliderSound_Dubbing->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _sliderSound_Music->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _sliderSound_SFX->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonSound_DubbingOn->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonSound_MusicOn->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ _ctx->bRefresh |= _buttonSound_SFXOn->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+
+ } else if (_nState == MENULOAD || _nState == MENUSAVE) {
+ for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
+ _buttonSave_States[_ctx->i]->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+
+ if (_statePos > 0)
+ _ctx->bRefresh |= _buttonSave_ArrowLeft->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ if (_statePos < 90)
+ _ctx->bRefresh |= _buttonSave_ArrowRight->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
+ }
+ }
+
+#define KEYPRESS(c) (g_vm->getEngine()->getInput().getAsyncKeyState(c))
+#define PROCESS_CHAR(cod, c) if (KEYPRESS(cod)) { \
+ _editName[strlen(_editName) + 1] = '\0'; _editName[strlen(_editName)] = c; _ctx->bRefresh = true; }
+
+ // State Buttons
+ if (_bEditSaveName) {
+ if (KEYPRESS(Common::KEYCODE_BACKSPACE)) {
+ if (_editName[0] != '\0') {
+ _editName[strlen(_editName) - 1] = '\0';
+ _ctx->bRefresh = true;
+ }
+ }
+
+ for (_ctx->i = 0; _ctx->i < 26 && strlen(_editName) < 12; _ctx->i++) {
+ if (KEYPRESS(Common::KEYCODE_LSHIFT) ||
+ KEYPRESS(Common::KEYCODE_RSHIFT)) {
+ PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'A');
+ } else {
+ PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'a');
+ }
+ }
+
+ for (_ctx->i = 0; _ctx->i < 10 && strlen(_editName) < 12; _ctx->i++)
+ PROCESS_CHAR((Common::KeyCode)((int)'0' + _ctx->i), _ctx->i + '0');
+
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_SPACE, ' ');
+
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP0, '0');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP1, '1');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP2, '2');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP3, '3');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP4, '4');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP5, '5');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP6, '6');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP7, '7');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP8, '8');
+ if (strlen(_editName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP9, '9');
+
+ // Cancel
+ if (KEYPRESS(Common::KEYCODE_ESCAPE)) {
+ _bEditSaveName = false;
+ _ctx->bRefresh = true;
+ }
+
+ // OK
+ if (KEYPRESS(Common::KEYCODE_RETURN)) {
+ _bEditSaveName = false;
+ g_vm->saveState(_statePos + _nEditPos, _editName);
+ close();
+ }
+
+ } else if (_ctx->bLeftClick) {
+ if (_nState == MENULOAD || _nState == MENUSAVE) {
+ if (_buttonExit->isActive()) {
+ if (_bLoadMenuOnly) {
+ // If only the loading menu, close
+ close();
+ } else {
+ CORO_INVOKE_1(changeState, _nLastState);
+ _ctx->bRefresh = true;
+ }
+ } else if (_buttonSave_ArrowLeft->isActive()) {
+ if (_statePos > 0) {
+ _statePos -= 6;
+ if (_statePos < 0)
+ _statePos = 0;
+ _buttonSave_ArrowLeft->setActiveState(false);
+ _ctx->bRefresh = true;
+ refreshThumbnails();
+ }
+ } else if (_buttonSave_ArrowRight->isActive()) {
+ if (_statePos < 90) {
+ _statePos += 6;
+ if (_statePos > 90)
+ _statePos = 90;
+ _buttonSave_ArrowRight->setActiveState(false);
+ _ctx->bRefresh = true;
+ refreshThumbnails();
+ }
+ } else {
+ for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
+ if (_buttonSave_States[_ctx->i]->isActive()) {
+ // There by saving or loading!!!
+ if (_nState == MENULOAD && _curThumb[_ctx->i] != NULL) {
+ // Loading
+ CORO_INVOKE_1(g_vm->loadState, _statePos + _ctx->i);
+ close();
+ } else if (_nState == MENUSAVE && (_statePos != 0 || _ctx->i != 0)) {
+ // Turn on edit mode
+ _bEditSaveName = true;
+ _nEditPos = _ctx->i;
+ strcpy(_editName, _curThumbName[_ctx->i].c_str());
+ _ctx->bRefresh = true;
+ }
+
+ break;
+ }
+ }
+ }
+
+ if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND) {
+ if (_bQuitConfirm) {
+ if (_buttonQuitNo->isActive()) {
+ _bQuitConfirm = false;
+ _ctx->bRefresh = true;
+ } else if (_buttonQuitYes->isActive()) {
+ _bQuitConfirm = false;
+ _ctx->bRefresh = true;
+
+ g_vm->quitGame();
+ }
+ } else {
+ if (_buttonQuit->isActive()) {
+ _bQuitConfirm = true;
+ _buttonQuitNo->setActiveState(false);
+ _buttonQuitYes->setActiveState(false);
+ _ctx->bRefresh = true;
+ } else if (_buttonExit->isActive())
+ close();
+ else if (_buttonLoad->isActive()) {
+ CORO_INVOKE_1(changeState, MENULOAD);
+ _ctx->bRefresh = true;
+ } else if (_buttonSave->isActive()) {
+ CORO_INVOKE_1(changeState, MENUSAVE);
+ _ctx->bRefresh = true;
+ } else if (_buttonGameMenu->isActive() && _nState != MENUGAME) {
+ CORO_INVOKE_1(changeState, MENUGAME);
+ _ctx->bRefresh = true;
+ } else if (_buttonGfxMenu->isActive() && _nState != MENUGFX) {
+ CORO_INVOKE_1(changeState, MENUGFX);
+ _ctx->bRefresh = true;
+ } else if (_buttonSoundMenu->isActive() && _nState != MENUSOUND) {
+ CORO_INVOKE_1(changeState, MENUSOUND);
+ _ctx->bRefresh = true;
+ }
+
+ if (_nState == MENUGFX) {
+ // These options take effect immediately
+ if (_buttonGfx_Anni30->isActive())
+ GLOBALS._bCfgAnni30 = true;
+ else
+ GLOBALS._bCfgAnni30 = false;
+
+ if (_buttonGfx_AntiAlias->isActive())
+ GLOBALS._bCfgAntiAlias = false;
+ else
+ GLOBALS._bCfgAntiAlias = true;
+
+ if (_buttonGfx_Trans->isActive())
+ GLOBALS._bCfgTransparence = false;
+ else
+ GLOBALS._bCfgTransparence = true;
+ }
+ }
+ }
+ }
+
+ if (_nState == MENUGAME || _nState == MENUGFX || _nState == MENUSOUND) {
+ if (!_bQuitConfirm && KEYPRESS(Common::KEYCODE_ESCAPE))
+ close();
+ }
+
+ if (_ctx->bRefresh)
+ CORO_INVOKE_0(refreshAll);
+
+ CORO_END_CODE;
+}
+
+
+void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ int curTime;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->curTime = g_vm->getTime();
+
+#define FADE_SPEED 20
+#define SYNC (_ctx->curTime - _fadeTime) / 25
+
+ if (_bExit)
+ return;
+
+ if (_fadeStep == 1) {
+ // Downhill fast
+ if (_fadeTime == -1)
+ _fadeY += FADE_SPEED;
+ else
+ _fadeY += FADE_SPEED * SYNC;
+ if (_fadeY > 480) {
+ _fadeY = 480;
+ _fadeStep++;
+ }
+
+ // Set the part to draw the scrolling
+ prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
+
+ } else if (_fadeStep == 2) {
+ // Bounce 1
+ _fadeY -= FADE_SPEED / 2 * SYNC;
+ if (_fadeY < 400) {
+ _fadeY = 400;
+ _fadeStep++;
+ }
+
+ prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
+
+ } else if (_fadeStep == 3) {
+ _fadeY -= FADE_SPEED / 4 * SYNC;
+ if (_fadeY < 380) {
+ _fadeY = 380;
+ _fadeStep++;
+ }
+
+ prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
+
+ } else if (_fadeStep == 4) {
+ // Bounce 1 - 2
+ _fadeY += FADE_SPEED / 3 * SYNC;
+ if (_fadeY > 420) {
+ _fadeY = 420;
+ _fadeStep++;
+ }
+
+ prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
+
+ } else if (_fadeStep == 5) {
+ _fadeY += FADE_SPEED / 2 * SYNC;
+ if (_fadeY > 480) {
+ _fadeY = 480;
+ _fadeStep++;
+ g_vm->hideLocation();
+ }
+
+ prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
+
+ } else if (_fadeStep == 6) {
+ // Menu ON
+
+ } else if (_fadeStep == 7) {
+ // Menu OFF
+ g_vm->showLocation();
+ _fadeStep++;
+
+ } else if (_fadeStep == 8) {
+ _fadeY -= FADE_SPEED * SYNC;
+ if (_fadeY < 0) {
+ _fadeY = 0;
+ _fadeStep++;
+ }
+ prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
+
+ } else if (_fadeStep == 9) {
+ // Hello hello!
+ _bExit = true;
+ _fadeStep = 0;
+
+ // Free memory
+ closeState();
+ return;
+
+ } else {
+ _fadeStep = 0;
+ }
+
+ _fadeTime = _ctx->curTime;
+
+ CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+void RMOptionScreen::removeThis(CORO_PARAM, bool &result) {
+ if (_bExit)
+ result = true;
+ else
+ result = false;
+}
+
+
+bool RMOptionScreen::loadThumbnailFromSaveState(int nState, byte *lpDestBuf, Common::String &name, byte &diff) {
+ char namebuf[256];
+ Common::InSaveFile *f;
+ char id[4];
+
+ // Cleans the destination
+ Common::fill(lpDestBuf, lpDestBuf + 160 * 120 * 2, 0);
+ name = "No name";
+ diff = 10;
+
+ // Get the savegame filename for the given slot
+ Common::String buf = g_vm->getSaveStateFileName(nState);
+
+ // Try and open the savegame
+ f = g_system->getSavefileManager()->openForLoading(buf);
+ if (f == NULL)
+ return false;
+
+ // Check to see if the file has a valid header
+ f->read(id, 4);
+ if (id[0] != 'R' || id[1] != 'M' || id[2] != 'S') {
+ delete f;
+ return false;
+ }
+
+ if (id[3] < 0x3) {
+ // Very old version that doesn't have screenshots
+ delete f;
+ return true;
+ }
+
+ // Load the screenshot
+ if ((id[3] >= 0x5) && (id[3] < 0x8)) {
+ // Read it as an LZO compressed data block
+ byte *cmpbuf;
+ uint32 cmpsize, size;
+
+ cmpbuf = new byte[160 * 120 * 4];
+
+ // Read in the compressed data
+ cmpsize = f->readUint32LE();
+ f->read(cmpbuf, cmpsize);
+
+ lzo1x_decompress(cmpbuf, cmpsize, lpDestBuf, &size);
+
+ delete[] cmpbuf;
+ } else {
+ // Read in the screenshot as an uncompressed data block
+ if (id[3] >= 8)
+ // Recent versions use hardcoded 160x120 uncomrpessed data, so size can be skipped
+ f->skip(4);
+
+ f->read(lpDestBuf, 160 * 120 * 2);
+ }
+
+ if (id[3] >= 0x5) {
+ // Read in the difficulty level
+ diff = f->readByte();
+ }
+
+ if (id[3] < 0x4) {
+ // Savegame version doesn't have a stored name
+ delete f;
+ return true;
+ }
+
+ int bufSize = f->readByte();
+ f->read(namebuf, bufSize);
+ namebuf[bufSize] = '\0';
+ name = namebuf;
+
+ delete f;
+ return true;
+}
+
+/****************************************************************************\
+* RMPointer Methods
+\****************************************************************************/
+
+RMPointer::RMPointer() {
+ Common::fill(_pointer, _pointer + 16, (RMGfxSourceBuffer8 *)NULL);
+ Common::fill(_specialPointer, _specialPointer + 16, (RMItem *)NULL);
+
+ _nCurPointer = _nCurSpecialPointer = 0;
+ _nCurCustomPointer = NULL;
+}
+
+RMPointer::~RMPointer() {
+ close();
+}
+
+void RMPointer::init() {
+ for (int i = 0; i < 5; i++) {
+ RMResRaw res(RES_P_GO + i);
+
+ _pointer[i] = new RMGfxSourceBuffer8RLEByteAA;
+ _pointer[i]->init(res, res.width(), res.height(), false);
+ _pointer[i]->loadPaletteWA(RES_P_PAL);
+ }
+
+ for (int i = 0; i < 5; i++) {
+ RMRes res(RES_P_PAP1 + i);
+ Common::SeekableReadStream *ds = res.getReadStream();
+ _specialPointer[i] = new RMItem;
+ _specialPointer[i]->readFromStream(*ds);
+ delete ds;
+ }
+
+ //m_hotspot[0].set(19,5);
+ _hotspot[0].set(5, 1);
+ _hotspot[1].set(32, 28);
+ _hotspot[2].set(45, 23);
+ _hotspot[3].set(35, 25);
+ _hotspot[4].set(32, 28);
+
+ // Default=GO
+ _nCurPointer = 0;
+ _nCurSpecialPointer = 0;
+}
+
+void RMPointer::close() {
+ for (int i = 0; i < 5; i++) {
+ if (_pointer[i] != NULL) {
+ delete _pointer[i];
+ _pointer[i] = NULL;
+ }
+
+ if (_specialPointer[i] != NULL) {
+ delete _specialPointer[i];
+ _specialPointer[i] = NULL;
+ }
+ }
+}
+
+void RMPointer::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ int n;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Check the pointer
+ _ctx->n = _nCurPointer;
+ if (_ctx->n == TA_COMBINE)
+ _ctx->n = TA_USE;
+
+ _cursorHotspot = _hotspot[_ctx->n];
+
+ // Call the Draw method of the pointer
+ if (_nCurSpecialPointer == 0) {
+ // WORKAROUND: updateCursor gets called too early sometimes (for example, when
+ // the cursor is released over the TA_PERORATE option), via setAction.
+ if (_ctx->n > 4)
+ _ctx->n = 0;
+
+ CORO_INVOKE_2(_pointer[_ctx->n]->draw, bigBuf, prim);
+ } else {
+ if (_nCurSpecialPointer == PTR_CUSTOM)
+ CORO_INVOKE_2(_nCurCustomPointer->draw, bigBuf, prim);
+ else
+ // Call the draw on the special pointer
+ CORO_INVOKE_2(_specialPointer[_nCurSpecialPointer - 1]->draw, bigBuf, prim);
+ }
+
+ CORO_END_CODE;
+}
+
+int RMPointer::curAction() {
+ if (_nCurSpecialPointer != 0)
+ return 0;
+
+ return _nCurPointer;
+}
+
+/**
+ * Show the cursor
+ */
+void RMPointer::showCursor() {
+ if (!CursorMan.isVisible()) {
+ CursorMan.showMouse(true);
+
+ updateCursor();
+ }
+}
+
+/**
+ * Hide the cursor
+ */
+void RMPointer::hideCursor() {
+ if (CursorMan.isVisible()) {
+ CursorMan.showMouse(false);
+ }
+}
+
+void RMPointer::doFrame() {
+ // Update the cursor animation if needed.
+ if (_nCurSpecialPointer == 0 || _nCurSpecialPointer == PTR_CUSTOM)
+ return;
+
+ RMGfxTargetBuffer buf;
+ if (_specialPointer[_nCurSpecialPointer - 1]->doFrame(&buf, false))
+ updateCursor();
+}
+
+void RMPointer::updateCursor() {
+ // Create an intermediate buffer and draw the cursor onto it
+ RMGfxTargetBuffer buf;
+ buf.create(64, 64, 16);
+ RMGfxPrimitive prim;
+
+ draw(Common::nullContext, buf, &prim);
+
+ // Get a pointer to the cursor data
+ byte *cursorData = buf;
+
+ // If in black & white mode, convert the cursor
+ if (GLOBALS._bCfgAnni30) {
+ if (!RMGfxTargetBuffer::_precalcTable) {
+ RMGfxTargetBuffer::createBWPrecalcTable();
+ }
+ uint16 *src = (uint16 *)cursorData;
+ for (int i = 0; i < 64; i++) {
+ uint16 *lineP = src;
+ for (int j = 0; j < 64; j++) {
+ lineP[j] = RMGfxTargetBuffer::_precalcTable[lineP[j] & 0x7FFF];
+ }
+ src += 64;
+ }
+ }
+
+ // Get the raw pixel data and set the cursor to it
+ Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
+ CursorMan.replaceCursor(cursorData, 64, 64, _cursorHotspot._x, _cursorHotspot._y, 0, 1, &pixelFormat);
+}
+
+/**
+ * Sets a new action as current
+ */
+void RMPointer::setAction(RMTonyAction action) {
+ _nCurPointer = action;
+ updateCursor();
+}
+
+/**
+ * Sets a new pointer
+ */
+void RMPointer::setSpecialPointer(PointerType ptr) {
+ _nCurSpecialPointer = ptr;
+ if (_nCurSpecialPointer && _nCurSpecialPointer != PTR_CUSTOM)
+ _specialPointer[ptr - 1]->setPattern(1);
+
+ updateCursor();
+}
+
+RMPointer::PointerType RMPointer::getSpecialPointer() {
+ return (PointerType)_nCurSpecialPointer;
+}
+
+/**
+ * Set the new custom pointer
+ */
+void RMPointer::setCustomPointer(RMGfxSourceBuffer8 *ptr) {
+ _nCurCustomPointer = ptr;
+ updateCursor();
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/game.h b/engines/tony/game.h
new file mode 100644
index 0000000000..83a1ddaea1
--- /dev/null
+++ b/engines/tony/game.h
@@ -0,0 +1,340 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_GAME_H
+#define TONY_GAME_H
+
+#include "tony/gfxcore.h"
+#include "tony/input.h"
+#include "tony/loc.h"
+#include "tony/utils.h"
+
+namespace Tony {
+
+#define INIT_GFX16_FROMRAW(dwRes, buf16) \
+ raw = new RMResRaw(dwRes); \
+ assert(raw->isValid()); \
+ assert((buf16) == NULL); \
+ (buf16) = new RMGfxSourceBuffer16(false); \
+ (buf16)->init(*raw, raw->width(), raw->height()); \
+ delete raw;
+
+#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
+ raw = new RMResRaw(dwRes); \
+ assert(raw->isValid()); \
+ assert((buf8) == NULL); \
+ (buf8) = new RMGfxSourceBuffer8RLEByte(); \
+ (buf8)->init(*raw, raw->width(), raw->height(), true); \
+ delete raw;
+
+// X & Y dimensions of the adventure
+#define RM_SX 640
+#define RM_SY 480
+
+// X & Y dimensions of bigbuf
+#define RM_BBX (RM_SX)
+#define RM_BBY (RM_SY)
+
+// Skipping X & Y
+#define RM_SKIPY ((RM_BBY - RM_SY) / 2)
+#define RM_SKIPX 0
+
+// Tony's actions
+enum RMTonyAction {
+ TA_GOTO = 0,
+ TA_TAKE,
+ TA_USE,
+ TA_EXAMINE,
+ TA_TALK,
+ TA_PERORATE,
+
+ TA_COMBINE = 10,
+ TA_RECEIVECOMBINE,
+ TA_COMBINEGIVE,
+ TA_RECEIVECOMBINEGIVE
+};
+
+// Global Functions
+void mainEnableGUI();
+void mainDisableGUI();
+
+// Classes
+class RMPointer {
+public:
+ enum PointerType {
+ PTR_NONE = 0,
+ PTR_ARROWUP,
+ PTR_ARROWDOWN,
+ PTR_ARROWLEFT,
+ PTR_ARROWRIGHT,
+ PTR_ARROWMAP,
+ PTR_CUSTOM
+ };
+
+private:
+ RMGfxSourceBuffer8 *_pointer[16];
+ RMPoint _hotspot[16];
+ RMPoint _cursorHotspot;
+
+ RMItem *_specialPointer[16];
+
+ int _nCurPointer;
+ int _nCurSpecialPointer;
+
+ RMGfxSourceBuffer8 *_nCurCustomPointer;
+
+public:
+ /**
+ * Constructor & destructor
+ */
+ RMPointer();
+ virtual ~RMPointer();
+
+ /**
+ * Initialization
+ */
+ void init();
+
+ /**
+ * Deinitialization
+ */
+ void close();
+
+ /**
+ * Process a frame
+ */
+ void doFrame();
+
+ /**
+ * draw method
+ */
+ void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ /**
+ * Sets a new action as current
+ */
+ void setAction(RMTonyAction action);
+
+ /**
+ * Sets a new pointer
+ */
+ void setSpecialPointer(PointerType ptr);
+
+ PointerType getSpecialPointer();
+
+ /**
+ * Set the new custom pointer
+ */
+ void setCustomPointer(RMGfxSourceBuffer8 *ptr);
+
+ /**
+ * Return the current action to be applied according to the pointer
+ */
+ int curAction();
+
+ /**
+ * Update the cursor
+ */
+ void updateCursor();
+
+ /**
+ * Show the cursor
+ */
+ void showCursor();
+
+ /**
+ * Hide the cursor
+ */
+ void hideCursor();
+};
+
+class RMOptionButton: public RMGfxTaskSetPrior {
+public:
+ RMRect _rect;
+ RMGfxSourceBuffer16 *_buf;
+ bool _bActive;
+ bool _bHasGfx;
+ bool _bDoubleState;
+
+public:
+ RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState = false);
+ RMOptionButton(const RMRect &pt);
+ virtual ~RMOptionButton();
+
+ bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ void addToList(RMGfxTargetBuffer &bigBuf);
+ bool isActive();
+ void setActiveState(bool bState);
+};
+
+class RMOptionSlide : public RMGfxTaskSetPrior {
+private:
+ RMOptionButton *_pushLeft;
+ RMOptionButton *_pushRight;
+ RMGfxSourceBuffer16 *_sliderCenter;
+ RMGfxSourceBuffer16 *_sliderLeft;
+ RMGfxSourceBuffer16 *_sliderRight;
+ RMGfxSourceBuffer16 *_sliderSingle;
+ int _nSlideSize;
+ RMPoint _pos;
+ int _nValue;
+ int _nMax;
+ int _nStep;
+
+public:
+ RMOptionSlide(const RMPoint &pt, int m_nRange = 100, int m_nStartValue = 0, int slideSize = 300);
+ virtual ~RMOptionSlide();
+
+ bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ void addToList(RMGfxTargetBuffer &bigBuf);
+
+ int getValue();
+};
+
+class RMOptionScreen : public RMGfxWoodyBuffer {
+private:
+ RMGfxSourceBuffer16 *_menu;
+ RMGfxSourceBuffer16 *_quitConfirm;
+ RMGfxSourceBuffer16 *_hideLoadSave;
+ RMOptionButton *_buttonQuitYes;
+ RMOptionButton *_buttonQuitNo;
+ RMOptionButton *_buttonExit;
+ RMOptionButton *_buttonQuit;
+ RMOptionButton *_buttonLoad;
+ RMOptionButton *_buttonSave;
+ RMOptionButton *_buttonGameMenu;
+ RMOptionButton *_buttonGfxMenu;
+ RMOptionButton *_buttonSoundMenu;
+ RMGfxSourceBuffer8 *_saveEasy;
+ RMGfxSourceBuffer8 *_saveHard;
+ RMGfxSourceBuffer16 *_curThumb[6];
+ Common::String _curThumbName[6];
+ byte _curThumbDiff[6];
+ RMOptionButton *_buttonSave_States[6];
+ RMOptionButton *_buttonSave_ArrowLeft;
+ RMOptionButton *_buttonSave_ArrowRight;
+ RMOptionButton *_buttonGfx_Tips;
+
+ RMOptionButton *_buttonSound_DubbingOn;
+ RMOptionButton *_buttonSound_MusicOn;
+ RMOptionButton *_buttonSound_SFXOn;
+
+ RMOptionSlide *_slideTonySpeed;
+ RMOptionSlide *_slideTextSpeed;
+
+
+ int _statePos;
+ bool _bEditSaveName;
+ int _nEditPos;
+ char _editName[256];
+
+ union {
+ RMOptionButton *_buttonGame_Lock;
+ RMOptionButton *_buttonGfx_Anni30;
+ RMOptionSlide *_sliderSound_Music;
+ };
+ union {
+ RMOptionButton *_buttonGame_TimerizedText;
+ RMOptionButton *_buttonGfx_AntiAlias;
+ RMOptionSlide *_sliderSound_SFX;
+ };
+ union {
+ RMOptionButton *_buttonGame_Scrolling;
+ RMOptionButton *_buttonGfx_Sottotitoli;
+ RMOptionSlide *_sliderSound_Dubbing;
+ };
+ union {
+ RMOptionButton *_buttonGame_InterUp;
+ RMOptionButton *_buttonGfx_Trans;
+ };
+
+ int _fadeStep;
+ bool _bExit;
+ bool _bQuitConfirm;
+ int _fadeY;
+ int _fadeTime;
+ bool _bLoadMenuOnly;
+ bool _bNoLoadSave;
+ bool _bAlterGfx;
+
+ enum OptionScreenState {
+ MENUGAME,
+ MENUGFX,
+ MENUSOUND,
+ MENULOAD,
+ MENUSAVE,
+ MENUNONE
+ };
+
+ OptionScreenState _nState;
+ OptionScreenState _nLastState;
+
+public:
+ RMOptionScreen();
+ virtual ~RMOptionScreen();
+
+ void init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result);
+ void initLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result);
+ void initSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result);
+ void initNoLoadSave(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result);
+ void reInit(RMGfxTargetBuffer &bigBuf);
+ bool close();
+ bool isClosing();
+
+ // Overloaded methods
+ virtual int priority();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ /**
+ * Polling for the option screen
+ */
+ void doFrame(CORO_PARAM, RMInput *m_input);
+
+ /**
+ * Retrieves a savegame's thumbnail, description, and difficulty level
+ */
+ static bool loadThumbnailFromSaveState(int numState, byte *lpDestBuf, Common::String &name, byte &diff);
+
+protected:
+
+ // Initialization and state change
+ void initState(CORO_PARAM);
+ void closeState();
+ void changeState(CORO_PARAM, OptionScreenState newState);
+
+ // Repaint the options menu
+ void refreshAll(CORO_PARAM);
+ void refreshThumbnails();
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp
new file mode 100644
index 0000000000..04ce01b0ed
--- /dev/null
+++ b/engines/tony/gfxcore.cpp
@@ -0,0 +1,2192 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "tony/gfxengine.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+/****************************************************************************\
+* RMGfxTask Methods
+\****************************************************************************/
+
+RMGfxTask::RMGfxTask() {
+ _nPrior = 0;
+ _nInList = 0;
+}
+
+int RMGfxTask::priority() {
+ return _nPrior;
+}
+
+void RMGfxTask::removeThis(CORO_PARAM, bool &result) {
+ result = true;
+}
+
+/**
+ * Registration
+ */
+void RMGfxTask::Register() {
+ _nInList++;
+}
+
+void RMGfxTask::unregister() {
+ _nInList--;
+ assert(_nInList >= 0);
+}
+
+/****************************************************************************\
+* RMGfxTaskSetPrior Methods
+\****************************************************************************/
+
+void RMGfxTaskSetPrior::setPriority(int nPrior) {
+ _nPrior = nPrior;
+}
+
+
+/****************************************************************************\
+* RMGfxBuffer Methods
+\****************************************************************************/
+
+RMGfxBuffer::RMGfxBuffer() {
+ _dimx = _dimy = 0;
+ _origBuf = _buf = NULL;
+}
+
+RMGfxBuffer::~RMGfxBuffer() {
+ destroy();
+}
+
+void RMGfxBuffer::create(int dimx, int dimy, int nBpp) {
+ // Destroy the buffer it is already exists
+ if (_buf != NULL)
+ destroy();
+
+ // Copy the parameters in the private members
+ _dimx = dimx;
+ _dimy = dimy;
+
+ // Allocate a buffer
+ _origBuf = _buf = new byte[_dimx * _dimy * nBpp / 8];
+ assert(_buf != NULL);
+ Common::fill(_origBuf, _origBuf + _dimx * _dimy * nBpp / 8, 0);
+}
+
+void RMGfxBuffer::destroy() {
+ if (_origBuf != NULL && _origBuf == _buf) {
+ delete[] _origBuf;
+ _origBuf = _buf = NULL;
+ }
+}
+
+void RMGfxBuffer::offsetY(int nLines, int nBpp) {
+ _buf += nLines * getDimx() * nBpp / 8;
+}
+
+
+RMGfxBuffer::operator byte *() {
+ return _buf;
+}
+
+RMGfxBuffer::operator void *() {
+ return (void *)_buf;
+}
+
+RMGfxBuffer::RMGfxBuffer(int dimx, int dimy, int nBpp) {
+ create(dimx, dimy, nBpp);
+}
+
+int RMGfxBuffer::getDimx() {
+ return _dimx;
+}
+
+int RMGfxBuffer::getDimy() {
+ return _dimy;
+}
+
+
+/****************************************************************************\
+* RMGfxSourceBuffer Methods
+\****************************************************************************/
+
+int RMGfxSourceBuffer::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
+ create(dimx, dimy, getBpp());
+ memcpy(_buf, buf, dimx * dimy * getBpp() / 8);
+
+ // Invokes the method for preparing the surface (inherited)
+ prepareImage();
+
+ return dimx * dimy * getBpp() / 8;
+}
+
+void RMGfxSourceBuffer::init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ create(dimx, dimy, getBpp());
+ ds.read(_buf, dimx * dimy * getBpp() / 8);
+
+ // Invokes the method for preparing the surface (inherited)
+ prepareImage();
+}
+
+RMGfxSourceBuffer::~RMGfxSourceBuffer() {
+}
+
+void RMGfxSourceBuffer::prepareImage() {
+ // Do nothing. Can be overloaded if necessary
+}
+
+bool RMGfxSourceBuffer::clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf) {
+ int destw, desth;
+
+ destw = buf->getDimx();
+ desth = buf->getDimy();
+
+ if (!bUseSrc) {
+ u = v = 0;
+ width = _dimx;
+ height = _dimy;
+ }
+
+ if (x1 > destw - 1)
+ return false;
+
+ if (y1 > desth - 1)
+ return false;
+
+ if (x1 < 0) {
+ width += x1;
+ if (width < 0)
+ return false;
+ u -= x1;
+ x1 = 0;
+ }
+
+ if (y1 < 0) {
+ height += y1;
+ if (height < 0)
+ return false;
+ v -= y1;
+ y1 = 0;
+ }
+
+ if (x1 + width - 1 > destw - 1)
+ width = destw - x1;
+
+ if (y1 + height - 1 > desth - 1)
+ height = desth - y1;
+
+ return (width > 1 && height > 1);
+}
+
+/**
+ * Initializes a surface by resource Id
+ *
+ * @param resID Resource ID
+ * @param dimx Buffer X dimension
+ * @param dimy Buffer Y dimension
+ */
+int RMGfxSourceBuffer::init(uint32 resID, int dimx, int dimy, bool bLoadPalette) {
+ return init(RMRes(resID), dimx, dimy, bLoadPalette);
+}
+
+void RMGfxSourceBuffer::offsetY(int nLines) {
+ RMGfxBuffer::offsetY(nLines, getBpp());
+}
+
+/****************************************************************************\
+* RMGfxWoodyBuffer Methods
+\****************************************************************************/
+
+RMGfxWoodyBuffer::~RMGfxWoodyBuffer() {
+
+}
+
+void RMGfxWoodyBuffer::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Draw the OT list
+ CORO_INVOKE_0(drawOT);
+
+ // Draw itself into the target buffer
+ CORO_INVOKE_2(RMGfxSourceBuffer16::draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+RMGfxWoodyBuffer::RMGfxWoodyBuffer() {
+
+}
+
+RMGfxWoodyBuffer::RMGfxWoodyBuffer(int dimx, int dimy)
+ : RMGfxBuffer(dimx, dimy, 16) {
+}
+
+/****************************************************************************\
+* RMGfxTargetBuffer Methods
+\****************************************************************************/
+
+RMGfxTargetBuffer::RMGfxTargetBuffer() {
+ _otlist = NULL;
+ _otSize = 0;
+ _trackDirtyRects = false;
+}
+
+RMGfxTargetBuffer::~RMGfxTargetBuffer() {
+ clearOT();
+}
+
+void RMGfxTargetBuffer::clearOT() {
+ OTList *cur, *n;
+
+ cur = _otlist;
+
+ while (cur != NULL) {
+ cur->_prim->_task->unregister();
+ delete cur->_prim;
+ n = cur->_next;
+ delete cur;
+ cur = n;
+ }
+
+ _otlist = NULL;
+}
+
+void RMGfxTargetBuffer::drawOT(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ OTList *cur;
+ OTList *prev;
+ OTList *next;
+ RMGfxPrimitive *myprim;
+ bool result;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->prev = NULL;
+ _ctx->cur = _otlist;
+
+ while (_ctx->cur != NULL) {
+ // Call the task Draw method, passing it a copy of the original
+ _ctx->myprim = _ctx->cur->_prim->duplicate();
+ CORO_INVOKE_2(_ctx->cur->_prim->_task->draw, *this, _ctx->myprim);
+ delete _ctx->myprim;
+
+ // Check if it's time to remove the task from the OT list
+ CORO_INVOKE_1(_ctx->cur->_prim->_task->removeThis, _ctx->result);
+ if (_ctx->result) {
+ // De-register the task
+ _ctx->cur->_prim->_task->unregister();
+
+ // Delete task, freeing the memory
+ delete _ctx->cur->_prim;
+ _ctx->next = _ctx->cur->_next;
+ delete _ctx->cur;
+
+ // If it was the first item, update the list head
+ if (_ctx->prev == NULL)
+ _otlist = _ctx->next;
+ // Otherwise update the next pinter of the previous item
+ else
+ _ctx->prev->_next = _ctx->next;
+
+ _ctx->cur = _ctx->next;
+ } else {
+ // Update the pointer to the previous item, and the current to the next
+ _ctx->prev = _ctx->cur;
+ _ctx->cur = _ctx->cur->_next;
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMGfxTargetBuffer::addPrim(RMGfxPrimitive *prim) {
+ int nPrior;
+ OTList *cur, *n;
+
+ // Warn of the OT listing
+ prim->_task->Register();
+
+ // Check the priority
+ nPrior = prim->_task->priority();
+ n = new OTList(prim);
+
+ // Empty list
+ if (_otlist == NULL) {
+ _otlist = n;
+ _otlist->_next = NULL;
+ }
+ // Inclusion in the head
+ else if (nPrior < _otlist->_prim->_task->priority()) {
+ n->_next = _otlist;
+ _otlist = n;
+ } else {
+ cur = _otlist;
+ while (cur->_next != NULL && nPrior > cur->_next->_prim->_task->priority())
+ cur = cur->_next;
+
+ n->_next = cur->_next;
+ cur->_next = n;
+ }
+}
+
+void RMGfxTargetBuffer::addDirtyRect(const Common::Rect &r) {
+ assert(r.isValidRect());
+ if (_trackDirtyRects && r.width() > 0 && r.height() > 0)
+ _currentDirtyRects.push_back(r);
+}
+
+Common::List<Common::Rect> &RMGfxTargetBuffer::getDirtyRects() {
+ // Copy rects from both the current and previous frame into the output dirty rects list
+ Common::List<Common::Rect>::iterator i;
+ _dirtyRects.clear();
+ for (i = _previousDirtyRects.begin(); i != _previousDirtyRects.end(); ++i)
+ _dirtyRects.push_back(*i);
+ for (i = _currentDirtyRects.begin(); i != _currentDirtyRects.end(); ++i)
+ _dirtyRects.push_back(*i);
+
+ mergeDirtyRects();
+ return _dirtyRects;
+}
+
+/**
+ * Move the set of dirty rects from the finished current frame into the previous frame list.
+ */
+void RMGfxTargetBuffer::clearDirtyRects() {
+ Common::List<Common::Rect>::iterator i;
+ _previousDirtyRects.clear();
+ for (i = _currentDirtyRects.begin(); i != _currentDirtyRects.end(); ++i)
+ _previousDirtyRects.push_back(*i);
+
+ _currentDirtyRects.clear();
+}
+
+/**
+ * Merges any clipping rectangles that overlap to try and reduce
+ * the total number of clip rectangles.
+ */
+void RMGfxTargetBuffer::mergeDirtyRects() {
+ if (_dirtyRects.size() <= 1)
+ return;
+
+ Common::List<Common::Rect>::iterator rOuter, rInner;
+
+ for (rOuter = _dirtyRects.begin(); rOuter != _dirtyRects.end(); ++rOuter) {
+ rInner = rOuter;
+ while (++rInner != _dirtyRects.end()) {
+
+ if ((*rOuter).intersects(*rInner)) {
+ // these two rectangles overlap or
+ // are next to each other - merge them
+
+ (*rOuter).extend(*rInner);
+
+ // remove the inner rect from the list
+ _dirtyRects.erase(rInner);
+
+ // move back to beginning of list
+ rInner = rOuter;
+ }
+ }
+ }
+}
+
+uint16 *RMGfxTargetBuffer::_precalcTable = NULL;
+
+/**
+ * Set up the black & white precalculated mapping table. This is only
+ * called if the user selects the black & white option.
+ */
+void RMGfxTargetBuffer::createBWPrecalcTable() {
+ _precalcTable = new uint16[0x8000];
+
+ for (int i = 0; i < 0x8000; i++) {
+ int r = (i >> 10) & 0x1F;
+ int g = (i >> 5) & 0x1F;
+ int b = i & 0x1F;
+
+ int min = MIN(r, MIN(g, b));
+ int max = MAX(r, MAX(g, b));
+
+ min = (min + max) / 2;
+
+ r = CLIP(min + 8 - 8, 0, 31);
+ g = CLIP(min + 5 - 8, 0, 31);
+ b = CLIP(min + 0 - 8, 0, 31);
+
+ _precalcTable[i] = (r << 10) | (g << 5) | b;
+ }
+}
+
+/**
+ * Frees the black & white precalculated mapping table.
+ */
+void RMGfxTargetBuffer::freeBWPrecalcTable() {
+ delete[] _precalcTable;
+ _precalcTable = NULL;
+}
+
+RMGfxTargetBuffer::operator byte *() {
+ return _buf;
+}
+
+RMGfxTargetBuffer::operator void *() {
+ return (void *)_buf;
+}
+
+RMGfxTargetBuffer::operator uint16 *() {
+ // FIXME: This may not be endian safe
+ return (uint16 *)_buf;
+}
+
+/**
+ * Offseting buffer
+ */
+void RMGfxTargetBuffer::offsetY(int nLines) {
+ RMGfxBuffer::offsetY(nLines, 16);
+}
+
+void RMGfxTargetBuffer::setTrackDirtyRects(bool v) {
+ _trackDirtyRects = v;
+}
+
+bool RMGfxTargetBuffer::getTrackDirtyRects() const {
+ return _trackDirtyRects;
+}
+
+/****************************************************************************\
+* RMGfxSourceBufferPal Methods
+\****************************************************************************/
+
+RMGfxSourceBufferPal::~RMGfxSourceBufferPal() {
+
+}
+
+int RMGfxSourceBufferPal::loadPaletteWA(const byte *buf, bool bSwapped) {
+ if (bSwapped) {
+ for (int i = 0; i < (1 << getBpp()); i++) {
+ _pal[i * 3 + 0] = buf[i * 3 + 2];
+ _pal[i * 3 + 1] = buf[i * 3 + 1];
+ _pal[i * 3 + 2] = buf[i * 3 + 0];
+ }
+ } else {
+ memcpy(_pal, buf, (1 << getBpp()) * 3);
+ }
+
+ preparePalette();
+
+ return (1 << getBpp()) * 3;
+}
+
+int RMGfxSourceBufferPal::loadPalette(const byte *buf) {
+ for (int i = 0; i < 256; i++)
+ memcpy(_pal + i * 3, buf + i * 4, 3);
+
+ preparePalette();
+
+ return (1 << getBpp()) * 4;
+}
+
+void RMGfxSourceBufferPal::preparePalette() {
+ for (int i = 0; i < 256; i++) {
+ _palFinal[i] = (((int)_pal[i * 3 + 0] >> 3) << 10) |
+ (((int)_pal[i * 3 + 1] >> 3) << 5) |
+ (((int)_pal[i * 3 + 2] >> 3) << 0);
+ }
+}
+
+int RMGfxSourceBufferPal::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
+ // Load the RAW image
+ int read = RMGfxSourceBuffer::init(buf, dimx, dimy);
+
+ // Load the palette if necessary
+ if (bLoadPalette)
+ read += loadPaletteWA(&buf[read]);
+
+ return read;
+}
+
+void RMGfxSourceBufferPal::init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ // Load the RAW image
+ RMGfxSourceBuffer::init(ds, dimx, dimy);
+
+ // Load the palette if necessary
+ if (bLoadPalette) {
+ byte *suxpal = new byte[256 * 3];
+ ds.read(suxpal, 256 * 3);
+ loadPaletteWA(suxpal);
+ delete[] suxpal;
+ }
+}
+
+int RMGfxSourceBufferPal::loadPalette(uint32 resID) {
+ return loadPalette(RMRes(resID));
+}
+
+int RMGfxSourceBufferPal::loadPaletteWA(uint32 resID, bool bSwapped) {
+ return loadPaletteWA(RMRes(resID), bSwapped);
+}
+
+/****************************************************************************\
+* RMGfxSourceBuffer4 Methods
+\****************************************************************************/
+
+void RMGfxSourceBuffer4::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+}
+
+RMGfxSourceBuffer4::RMGfxSourceBuffer4(int dimx, int dimy)
+ : RMGfxBuffer(dimx, dimy, 4) {
+ setPriority(0);
+}
+
+
+/**
+ * Returns the number of bits per pixel of the surface
+ *
+ * @returns Bit per pixel
+ */
+int RMGfxSourceBuffer4::getBpp() {
+ return 4;
+}
+
+void RMGfxSourceBuffer4::create(int dimx, int dimy) {
+ RMGfxBuffer::create(dimx, dimy, 4);
+}
+
+/****************************************************************************\
+* RMGfxSourceBuffer8 Methods
+\****************************************************************************/
+
+RMGfxSourceBuffer8::~RMGfxSourceBuffer8() {
+
+}
+
+void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ int width, height, u, v;
+ int bufx = bigBuf.getDimx();
+ uint16 *buf = bigBuf;
+ byte *raw = _buf;
+
+ // Destination buffer
+ RMRect dst;
+ if (prim->haveDst())
+ dst = prim->getDst();
+
+ // Clipping
+ if (prim->haveSrc()) {
+ u = prim->getSrc()._x1;
+ v = prim->getSrc()._y1;
+
+ width = prim->getSrc().width();
+ height = prim->getSrc().height();
+ }
+
+ if (!clip2D(dst._x1, dst._y1, u, v, width, height, prim->haveSrc(), &bigBuf))
+ return;
+
+ // Starting offset into the buffer
+ buf += dst._y1 * bufx + dst._x1;
+
+ // Normal step
+ if (_bTrasp0) {
+ for (int y = 0; y < height; y++) {
+ raw = _buf + (y + v) * _dimx + u;
+
+ for (int x = 0; x < width; x++) {
+ if (*raw)
+ *buf = _palFinal[*raw];
+ buf++;
+ raw++;
+ }
+
+ buf += bufx - width;
+ }
+ } else {
+ for (int y = 0; y < height; y++) {
+ raw = _buf + (y + v) * _dimx + u;
+
+ for (int x = 0; x < width; x += 2) {
+ buf[0] = _palFinal[raw[0]];
+ buf[1] = _palFinal[raw[1]];
+
+ buf += 2;
+ raw += 2;
+ }
+
+ buf += bufx - width;
+ }
+ }
+
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(dst._x1, dst._y1, dst._x1 + width, dst._y1 + height));
+}
+
+RMGfxSourceBuffer8::RMGfxSourceBuffer8(int dimx, int dimy)
+ : RMGfxBuffer(dimx, dimy, 8) {
+ setPriority(0);
+ _bTrasp0 = false;
+}
+
+RMGfxSourceBuffer8::RMGfxSourceBuffer8(bool bTrasp0) {
+ _bTrasp0 = bTrasp0;
+}
+
+
+/**
+ * Returns the number of bits per pixel of the surface
+ *
+ * @returns Bit per pixel
+ */
+int RMGfxSourceBuffer8::getBpp() {
+ return 8;
+}
+
+void RMGfxSourceBuffer8::create(int dimx, int dimy) {
+ RMGfxBuffer::create(dimx, dimy, 8);
+}
+
+#define GETRED(x) (((x) >> 10) & 0x1F)
+#define GETGREEN(x) (((x) >> 5) & 0x1F)
+#define GETBLUE(x) ((x) & 0x1F)
+
+
+/****************************************************************************\
+* RMGfxSourceBuffer8AB Methods
+\****************************************************************************/
+
+RMGfxSourceBuffer8AB::~RMGfxSourceBuffer8AB() {
+
+}
+
+int RMGfxSourceBuffer8AB::calcTrasp(int fore, int back) {
+ int r = (GETRED(fore) >> 2) + (GETRED(back) >> 1);
+ int g = (GETGREEN(fore) >> 2) + (GETGREEN(back) >> 1);
+ int b = (GETBLUE(fore) >> 2) + (GETBLUE(back) >> 1);
+
+ if (r > 0x1F)
+ r = 0x1F;
+
+ if (g > 0x1F)
+ g = 0x1F;
+
+ if (b > 0x1F)
+ b = 0x1F;
+
+ return (r << 10) | (g << 5) | b;
+}
+
+
+void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ int width, height, u, v;
+ int bufx = bigBuf.getDimx();
+ uint16 *buf = bigBuf;
+ byte *raw = _buf;
+
+ // Destination buffer
+ RMRect dst;
+ if (prim->haveDst())
+ dst = prim->getDst();
+
+ // Clipping
+ if (prim->haveSrc()) {
+ u = prim->getSrc()._x1;
+ v = prim->getSrc()._y1;
+
+ width = prim->getSrc().width();
+ height = prim->getSrc().height();
+ }
+
+ if (!clip2D(dst._x1, dst._y1, u, v, width, height, prim->haveSrc(), &bigBuf))
+ return;
+
+ // Starting offset into the buffer
+ buf += dst._y1 * bufx + dst._x1;
+
+ // Passaggio normale
+ if (_bTrasp0) {
+ for (int y = 0; y < height; y++) {
+ raw = _buf + (y + v) * _dimx + u;
+
+ for (int x = 0; x < width; x++) {
+ if (*raw)
+ *buf = calcTrasp(_palFinal[*raw], *buf);
+
+ buf++;
+ raw++;
+ }
+
+ buf += bufx - width;
+ }
+ } else {
+ for (int y = 0; y < height; y++) {
+ raw = _buf + (y + v) * _dimx + u;
+
+ for (int x = 0; x < width; x += 2) {
+ buf[0] = calcTrasp(_palFinal[raw[0]], buf[0]);
+ buf[1] = calcTrasp(_palFinal[raw[1]], buf[1]);
+
+ buf += 2;
+ raw += 2;
+ }
+
+ buf += bufx - width;
+ }
+ }
+
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(dst._x1, dst._y1, dst._x1 + width, dst._y1 + height));
+}
+
+
+
+/****************************************************************************\
+* RMGfxSourceBuffer8RLE Methods
+\****************************************************************************/
+
+byte RMGfxSourceBuffer8RLE::_megaRLEBuf[512 * 1024];
+
+void RMGfxSourceBuffer8RLE::setAlphaBlendColor(int color) {
+ _alphaBlendColor = color;
+}
+
+RMGfxSourceBuffer8RLE::RMGfxSourceBuffer8RLE() {
+ _alphaBlendColor = -1;
+ _bNeedRLECompress = true;
+ _buf = NULL;
+
+ _alphaR = _alphaG = _alphaB = 0;
+}
+
+RMGfxSourceBuffer8RLE::~RMGfxSourceBuffer8RLE() {
+ if (_buf != NULL) {
+ delete[] _buf;
+ _buf = NULL;
+ }
+}
+
+
+int RMGfxSourceBuffer8RLE::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
+ return RMGfxSourceBufferPal::init(buf, dimx, dimy, bLoadPalette);
+}
+
+void RMGfxSourceBuffer8RLE::init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ if (_bNeedRLECompress) {
+ RMGfxSourceBufferPal::init(ds, dimx, dimy, bLoadPalette);
+ } else {
+ int size = ds.readSint32LE();
+ _buf = new byte[size];
+ ds.read(_buf, size);
+
+ _dimx = dimx;
+ _dimy = dimy;
+ }
+}
+
+void RMGfxSourceBuffer8RLE::preparePalette() {
+ // Invoke the parent method
+ RMGfxSourceBuffer8::preparePalette();
+
+ // Handle RGB alpha blending
+ if (_alphaBlendColor != -1) {
+ _alphaR = (_palFinal[_alphaBlendColor] >> 10) & 0x1F;
+ _alphaG = (_palFinal[_alphaBlendColor] >> 5) & 0x1F;
+ _alphaB = (_palFinal[_alphaBlendColor]) & 0x1F;
+ }
+}
+
+void RMGfxSourceBuffer8RLE::prepareImage() {
+ // Invoke the parent method
+ RMGfxSourceBuffer::prepareImage();
+
+ // Compress
+ compressRLE();
+}
+
+void RMGfxSourceBuffer8RLE::setAlreadyCompressed() {
+ _bNeedRLECompress = false;
+}
+
+void RMGfxSourceBuffer8RLE::compressRLE() {
+ byte *startline;
+ byte *cur;
+ byte curdata;
+ byte *src;
+ byte *startsrc;
+ int rep;
+
+ // Perform RLE compression for lines
+ cur = _megaRLEBuf;
+ src = _buf;
+ for (int y = 0; y < _dimy; y++) {
+ // Save the beginning of the line
+ startline = cur;
+
+ // Leave space for the length of the line
+ cur += 2;
+
+ // It starts from the empty space
+ curdata = 0;
+ rep = 0;
+ startsrc = src;
+ for (int x = 0; x < _dimx;) {
+ if ((curdata == 0 && *src == 0) || (curdata == 1 && *src == _alphaBlendColor)
+ || (curdata == 2 && (*src != _alphaBlendColor && *src != 0))) {
+ src++;
+ rep++;
+ x++;
+ } else {
+ if (curdata == 0) {
+ rleWriteTrasp(cur, rep);
+ curdata++;
+ } else if (curdata == 1) {
+ rleWriteAlphaBlend(cur, rep);
+ curdata++;
+ } else {
+ rleWriteData(cur, rep, startsrc);
+ curdata = 0;
+ }
+
+ rep = 0;
+ startsrc = src;
+ }
+ }
+
+ // Pending data?
+ if (curdata == 1) {
+ rleWriteAlphaBlend(cur, rep);
+ rleWriteData(cur, 0, NULL);
+ }
+
+ if (curdata == 2) {
+ rleWriteData(cur, rep, startsrc);
+ }
+
+ // End of line
+ rleWriteEOL(cur);
+
+ // Write the length of the line
+ WRITE_LE_UINT16(startline, (uint16)(cur - startline));
+ }
+
+ // Delete the original image
+ delete[] _buf;
+
+ // Copy the compressed image
+ int bufSize = cur - _megaRLEBuf;
+ _buf = new byte[bufSize];
+ Common::copy(_megaRLEBuf, _megaRLEBuf + bufSize, _buf);
+}
+
+void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ byte *src;
+ uint16 *buf = bigBuf;
+ int u, v, width, height;
+
+ // Clipping
+ int x1 = prim->getDst()._x1;
+ int y1 = prim->getDst()._y1;
+ if (!clip2D(x1, y1, u, v, width, height, false, &bigBuf))
+ return;
+
+ // Go forward through the RLE lines
+ src = _buf;
+ for (int y = 0; y < v; y++)
+ src += READ_LE_UINT16(src);
+
+ // Calculate the position in the destination buffer
+ buf += y1 * bigBuf.getDimx();
+
+ // Loop
+ if (prim->isFlipped()) {
+// Eliminate horizontal clipping
+// width = m_dimx;
+// x1=prim->Dst().x1;
+
+ // Clipping
+ u = _dimx - (width + u);
+ x1 = (prim->getDst()._x1 + _dimx - 1) - u;
+
+ if (width > x1)
+ width = x1;
+
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(x1 - width, y1, x1 + 1, y1 + height));
+
+ for (int y = 0; y < height; y++) {
+ // Decompression
+ rleDecompressLineFlipped(buf + x1, src + 2, u, width);
+
+ // Next line
+ src += READ_LE_UINT16(src);
+
+ // Skip to the next line
+ buf += bigBuf.getDimx();
+ }
+ } else {
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(x1, y1, x1 + width, y1 + height));
+
+ for (int y = 0; y < height; y++) {
+ // Decompression
+ rleDecompressLine(buf + x1, src + 2, u, width);
+
+ // Next line
+ src += READ_LE_UINT16(src);
+
+ // Skip to the next line
+ buf += bigBuf.getDimx();
+ }
+ }
+}
+
+
+/****************************************************************************\
+* RMGfxSourceBuffer8RLEByte Methods
+\****************************************************************************/
+
+RMGfxSourceBuffer8RLEByte::~RMGfxSourceBuffer8RLEByte() {
+}
+
+void RMGfxSourceBuffer8RLEByte::rleWriteTrasp(byte *&cur, int rep) {
+ assert(rep < 255);
+ *cur ++ = rep;
+}
+
+void RMGfxSourceBuffer8RLEByte::rleWriteAlphaBlend(byte *&cur, int rep) {
+ assert(rep < 255);
+ *cur ++ = rep;
+}
+
+void RMGfxSourceBuffer8RLEByte::rleWriteData(byte *&cur, int rep, byte *src) {
+ assert(rep < 256);
+
+ *cur ++ = rep;
+ if (rep > 0) {
+ memcpy(cur, src, rep);
+ cur += rep;
+ src += rep;
+ }
+
+ return;
+}
+
+void RMGfxSourceBuffer8RLEByte::rleWriteEOL(byte *&cur) {
+ *cur ++ = 0xFF;
+}
+
+void RMGfxSourceBuffer8RLEByte::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
+
+ if (nStartSkip == 0)
+ goto RLEByteDoTrasp;
+
+ while (1) {
+ assert(nStartSkip > 0);
+
+ // TRASP
+ n = *src++;
+ if (n == 0xFF)
+ return;
+
+ if (n >= nStartSkip) {
+ dst += n - nStartSkip;
+ nLength -= n - nStartSkip;
+ if (nLength > 0)
+ goto RLEByteDoAlpha;
+ else
+ return;
+ }
+ nStartSkip -= n;
+
+
+ assert(nStartSkip > 0);
+
+ // ALPHA
+ n = *src++;
+ if (n >= nStartSkip) {
+ n -= nStartSkip;
+ goto RLEByteDoAlpha2;
+ }
+ nStartSkip -= n;
+
+ assert(nStartSkip > 0);
+
+ // DATA
+ n = *src++;
+ if (n >= nStartSkip) {
+ src += nStartSkip;
+ n -= nStartSkip;
+ goto RLEByteDoCopy2;
+ }
+ nStartSkip -= n;
+ src += n;
+ }
+
+
+ while (1) {
+RLEByteDoTrasp:
+ // Get the trasp of s**t
+ n = *src++;
+
+ // EOL?
+ if (n == 0xFF)
+ return;
+
+ dst += n;
+ nLength -= n;
+ if (nLength <= 0)
+ return;
+
+RLEByteDoAlpha:
+ // Alpha
+ n = *src++;
+
+RLEByteDoAlpha2:
+ if (n > nLength)
+ n = nLength;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
+
+ r = (r >> 2) + (_alphaR >> 1);
+ g = (g >> 2) + (_alphaG >> 1);
+ b = (b >> 2) + (_alphaB >> 1);
+
+ *dst ++ = (r << 10) | (g << 5) | b;
+ }
+
+ nLength -= n;
+ if (!nLength)
+ return;
+ assert(nLength > 0);
+
+//RLEByteDoCopy:
+ // Copy the stuff
+ n = *src++;
+
+RLEByteDoCopy2:
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++)
+ *dst ++ = _palFinal[*src++];
+
+ nLength -= n;
+ if (!nLength)
+ return;
+ assert(nLength > 0);
+ }
+}
+
+void RMGfxSourceBuffer8RLEByte::rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
+
+ if (nStartSkip == 0)
+ goto RLEByteFlippedDoTrasp;
+
+ while (1) {
+ assert(nStartSkip > 0);
+
+ // TRASP
+ n = *src++;
+ if (n == 0xFF)
+ return;
+
+ if (n >= nStartSkip) {
+ dst -= n - nStartSkip;
+ nLength -= n - nStartSkip;
+ if (nLength > 0)
+ goto RLEByteFlippedDoAlpha;
+ else
+ return;
+ }
+ nStartSkip -= n;
+
+
+ assert(nStartSkip > 0);
+
+ // ALPHA
+ n = *src++;
+ if (n >= nStartSkip) {
+ n -= nStartSkip;
+ goto RLEByteFlippedDoAlpha2;
+ }
+ nStartSkip -= n;
+
+ assert(nStartSkip > 0);
+
+ // DATA
+ n = *src++;
+ if (n >= nStartSkip) {
+ src += nStartSkip;
+ n -= nStartSkip;
+ goto RLEByteFlippedDoCopy2;
+ }
+ nStartSkip -= n;
+ src += n;
+ }
+
+
+ while (1) {
+RLEByteFlippedDoTrasp:
+ // Get the trasp of s**t
+ n = *src++;
+
+ // EOL?
+ if (n == 0xFF)
+ return;
+
+ dst -= n;
+ nLength -= n;
+ if (nLength <= 0)
+ return;
+
+RLEByteFlippedDoAlpha:
+ // Alpha
+ n = *src++;
+
+RLEByteFlippedDoAlpha2:
+ if (n > nLength)
+ n = nLength;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
+
+ r = (r >> 2) + (_alphaR >> 1);
+ g = (g >> 2) + (_alphaG >> 1);
+ b = (b >> 2) + (_alphaB >> 1);
+
+ *dst-- = (r << 10) | (g << 5) | b;
+ }
+
+ nLength -= n;
+ if (!nLength)
+ return;
+ assert(nLength > 0);
+
+//RLEByteFlippedDoCopy:
+ // Copy the data
+ n = *src++;
+
+RLEByteFlippedDoCopy2:
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++)
+ *dst-- = _palFinal[*src++];
+
+ nLength -= n;
+ if (!nLength)
+ return;
+ assert(nLength > 0);
+ }
+}
+
+
+/****************************************************************************\
+* RMGfxSourceBuffer8RLEWord Methods
+\****************************************************************************/
+
+RMGfxSourceBuffer8RLEWord::~RMGfxSourceBuffer8RLEWord() {
+
+}
+
+void RMGfxSourceBuffer8RLEWord::rleWriteTrasp(byte *&cur, int rep) {
+ WRITE_LE_UINT16(cur, rep);
+ cur += 2;
+}
+
+void RMGfxSourceBuffer8RLEWord::rleWriteAlphaBlend(byte *&cur, int rep) {
+ WRITE_LE_UINT16(cur, rep);
+ cur += 2;
+}
+
+void RMGfxSourceBuffer8RLEWord::rleWriteData(byte *&cur, int rep, byte *src) {
+ WRITE_LE_UINT16(cur, rep);
+ cur += 2;
+
+ if (rep > 0) {
+ memcpy(cur, src, rep);
+ cur += rep;
+ src += rep;
+ }
+}
+
+void RMGfxSourceBuffer8RLEWord::rleWriteEOL(byte *&cur) {
+ *cur ++ = 0xFF;
+ *cur ++ = 0xFF;
+}
+
+void RMGfxSourceBuffer8RLEWord::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
+
+ if (nStartSkip == 0)
+ goto RLEWordDoTrasp;
+
+ while (1) {
+ assert(nStartSkip > 0);
+
+ // TRASP
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n == 0xFFFF)
+ return;
+
+ if (n >= nStartSkip) {
+ dst += n - nStartSkip;
+ nLength -= n - nStartSkip;
+
+ if (nLength > 0)
+ goto RLEWordDoAlpha;
+ else
+ return;
+ }
+ nStartSkip -= n;
+
+ assert(nStartSkip > 0);
+
+ // ALPHA
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n >= nStartSkip) {
+ n -= nStartSkip;
+ goto RLEWordDoAlpha2;
+ }
+ nStartSkip -= n;
+
+ // DATA
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n >= nStartSkip) {
+ src += nStartSkip;
+ n -= nStartSkip;
+ goto RLEWordDoCopy2;
+ }
+ nStartSkip -= n;
+ src += n;
+ }
+
+
+ while (1) {
+RLEWordDoTrasp:
+ // Get the trasp of s**t
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ // EOL?
+ if (n == 0xFFFF)
+ return;
+
+ dst += n;
+
+ nLength -= n;
+ if (nLength <= 0)
+ return;
+
+RLEWordDoAlpha:
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+RLEWordDoAlpha2:
+
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
+
+ r = (r >> 2) + (_alphaR >> 1);
+ g = (g >> 2) + (_alphaG >> 1);
+ b = (b >> 2) + (_alphaB >> 1);
+
+ *dst++ = (r << 10) | (g << 5) | b;
+ }
+
+ nLength -= n;
+ if (!nLength)
+ return;
+
+ assert(nLength > 0);
+
+//RLEWordDoCopy:
+ // Copy the data
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+RLEWordDoCopy2:
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++)
+ *dst++ = _palFinal[*src++];
+
+ nLength -= n;
+ if (!nLength)
+ return;
+
+ assert(nLength > 0);
+
+ }
+}
+
+void RMGfxSourceBuffer8RLEWord::rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
+
+ if (nStartSkip == 0)
+ goto RLEWordFlippedDoTrasp;
+
+ while (1) {
+ assert(nStartSkip > 0);
+
+ // TRASP
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n == 0xFFFF)
+ return;
+
+ if (n >= nStartSkip) {
+ dst -= n - nStartSkip;
+ nLength -= n - nStartSkip;
+
+ if (nLength > 0)
+ goto RLEWordFlippedDoAlpha;
+ else
+ return;
+ }
+ nStartSkip -= n;
+
+ assert(nStartSkip > 0);
+
+ // ALPHA
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n >= nStartSkip) {
+ n -= nStartSkip;
+ goto RLEWordFlippedDoAlpha2;
+ }
+ nStartSkip -= n;
+
+ // DATA
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n >= nStartSkip) {
+ src += nStartSkip;
+ n -= nStartSkip;
+ goto RLEWordFlippedDoCopy2;
+ }
+ nStartSkip -= n;
+ src += n;
+ }
+
+
+ while (1) {
+RLEWordFlippedDoTrasp:
+ // Get the trasp of s**t
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ // EOL?
+ if (n == 0xFFFF)
+ return;
+
+ dst -= n;
+
+ nLength -= n;
+ if (nLength <= 0)
+ return;
+
+RLEWordFlippedDoAlpha:
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+RLEWordFlippedDoAlpha2:
+
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
+
+ r = (r >> 2) + (_alphaR >> 1);
+ g = (g >> 2) + (_alphaG >> 1);
+ b = (b >> 2) + (_alphaB >> 1);
+
+ *dst-- = (r << 10) | (g << 5) | b;
+ }
+
+ nLength -= n;
+ if (!nLength)
+ return;
+
+ assert(nLength > 0);
+
+//RLEWordFlippedDoCopy:
+ // Copy the data
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+RLEWordFlippedDoCopy2:
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++)
+ *dst-- = _palFinal[*src++];
+
+ nLength -= n;
+ if (!nLength)
+ return;
+
+ assert(nLength > 0);
+ }
+}
+
+/****************************************************************************\
+* Methods for RMGfxSourceBuffer8RLEWord
+\****************************************************************************/
+
+RMGfxSourceBuffer8RLEWordAB::~RMGfxSourceBuffer8RLEWordAB() {
+
+}
+
+void RMGfxSourceBuffer8RLEWordAB::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
+
+ if (!GLOBALS._bCfgTransparence) {
+ RMGfxSourceBuffer8RLEWord::rleDecompressLine(dst, src, nStartSkip, nLength);
+ return;
+ }
+
+ if (nStartSkip == 0)
+ goto RLEWordDoTrasp;
+
+ while (1) {
+ assert(nStartSkip > 0);
+
+ // TRASP
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n == 0xFFFF)
+ return;
+
+ if (n >= nStartSkip) {
+ dst += n - nStartSkip;
+ nLength -= n - nStartSkip;
+
+ if (nLength > 0)
+ goto RLEWordDoAlpha;
+ else
+ return;
+ }
+ nStartSkip -= n;
+
+ assert(nStartSkip > 0);
+
+ // ALPHA
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n >= nStartSkip) {
+ n -= nStartSkip;
+ goto RLEWordDoAlpha2;
+ }
+ nStartSkip -= n;
+
+ // DATA
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ if (n >= nStartSkip) {
+ src += nStartSkip;
+ n -= nStartSkip;
+ goto RLEWordDoCopy2;
+ }
+ nStartSkip -= n;
+ src += n;
+ }
+
+
+ while (1) {
+RLEWordDoTrasp:
+ // Get the trasp of s**t
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+ // EOL?
+ if (n == 0xFFFF)
+ return;
+
+ dst += n;
+
+ nLength -= n;
+ if (nLength <= 0)
+ return;
+
+RLEWordDoAlpha:
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+RLEWordDoAlpha2:
+
+ if (n > nLength)
+ n = nLength;
+
+ // @@@ SHOULD NOT BE THERE !!!!!
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
+
+ r = (r >> 2) + (_alphaR >> 1);
+ g = (g >> 2) + (_alphaG >> 1);
+ b = (b >> 2) + (_alphaB >> 1);
+
+ *dst++ = (r << 10) | (g << 5) | b;
+ }
+
+ nLength -= n;
+ if (!nLength)
+ return;
+
+ assert(nLength > 0);
+
+//RLEWordDoCopy:
+ // Copy the data
+ n = READ_LE_UINT16(src);
+ src += 2;
+
+RLEWordDoCopy2:
+ if (n > nLength)
+ n = nLength;
+
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
+
+ int r2 = (_palFinal[*src] >> 10) & 0x1F;
+ int g2 = (_palFinal[*src] >> 5) & 0x1F;
+ int b2 = _palFinal[*src] & 0x1F;
+
+ r = (r >> 1) + (r2 >> 1);
+ g = (g >> 1) + (g2 >> 1);
+ b = (b >> 1) + (b2 >> 1);
+
+ *dst ++ = (r << 10) | (g << 5) | b;
+ src++;
+ }
+
+ nLength -= n;
+ if (!nLength)
+ return;
+
+ assert(nLength > 0);
+ }
+}
+
+/****************************************************************************\
+* Methods for RMGfxSourceBuffer8AA
+\****************************************************************************/
+
+byte RMGfxSourceBuffer8AA::_megaAABuf[256 * 1024];
+byte RMGfxSourceBuffer8AA::_megaAABuf2[64 * 1024];
+
+void RMGfxSourceBuffer8AA::prepareImage() {
+ // Invoke the parent method
+ RMGfxSourceBuffer::prepareImage();
+
+ // Prepare the buffer for anti-aliasing
+ calculateAA();
+}
+
+void RMGfxSourceBuffer8AA::calculateAA() {
+ byte *src, *srcaa;
+
+ // First pass: fill the edges
+ Common::fill(_megaAABuf, _megaAABuf + _dimx * _dimy, 0);
+
+ src = _buf;
+ srcaa = _megaAABuf;
+ for (int y = 0; y < _dimy; y++) {
+ for (int x = 0; x < _dimx; x++) {
+ if (*src == 0) {
+ if ((y > 0 && src[-_dimx] != 0) ||
+ (y < _dimy - 1 && src[_dimx] != 0) ||
+ (x > 0 && src[-1] != 0) ||
+ (x < _dimx - 1 && src[1] != 0))
+ *srcaa = 1;
+ }
+
+ src++;
+ srcaa++;
+ }
+ }
+
+ src = _buf;
+ srcaa = _megaAABuf;
+ for (int y = 0; y < _dimy; y++) {
+ for (int x = 0; x < _dimx; x++) {
+ if (*src != 0) {
+ if ((y > 0 && srcaa[-_dimx] == 1) ||
+ (y < _dimy - 1 && srcaa[_dimx] == 1) ||
+ (x > 0 && srcaa[-1] == 1) ||
+ (x < _dimx - 1 && srcaa[1] == 1))
+ *srcaa = 2;
+ }
+
+ src++;
+ srcaa++;
+ }
+ }
+
+ if (_aabuf != NULL)
+ delete[] _aabuf;
+
+ _aabuf = new byte[_dimx * _dimy];
+ memcpy(_aabuf, _megaAABuf, _dimx * _dimy);
+}
+
+RMGfxSourceBuffer8AA::RMGfxSourceBuffer8AA() : RMGfxSourceBuffer8() {
+ _aabuf = NULL;
+}
+
+RMGfxSourceBuffer8AA::~RMGfxSourceBuffer8AA() {
+ if (_aabuf != NULL)
+ delete[] _aabuf;
+}
+
+void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ byte *src;
+ uint16 *mybuf;
+ uint16 *buf;
+ int u, v, width, height;
+
+ // Clip the sprite
+ int x1 = prim->getDst()._x1;
+ int y1 = prim->getDst()._y1;
+ if (!clip2D(x1, y1, u, v, width, height, false, &bigBuf))
+ return;
+
+ // Go forward through the RLE lines
+ src = _buf;
+ for (int y = 0; y < v; y++)
+ src += READ_LE_UINT16(src);
+
+ // Eliminate horizontal clipping
+
+ if (prim->isFlipped()) {
+ u = _dimx - (width + u);
+ x1 = (prim->getDst()._x1 + _dimx - 1) - u;
+
+ if (width > x1)
+ width = x1;
+
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(x1 - width, y1, x1 + 1, y1 + height));
+ } else {
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(x1, y1, x1 + width, y1 + height));
+ }
+
+// width = _dimx;
+// x1 = prim->Dst().x1;
+
+
+ // Position into the destination buffer
+ buf = bigBuf;
+ buf += y1 * bigBuf.getDimx();
+
+ int step;
+ if (prim->isFlipped())
+ step = -1;
+ else
+ step = 1;
+
+ // Loop
+ buf += bigBuf.getDimx(); // Skip the first line
+ for (int y = 1; y < height - 1; y++) {
+ // if (prim->IsFlipped())
+ // mybuf=&buf[x1+m_dimx-1];
+ // else
+ mybuf = &buf[x1];
+
+ for (int x = 0; x < width; x++, mybuf += step) {
+ if (_aabuf[(y + v) * _dimx + x + u] == 2 && x != 0 && x != width - 1) {
+ int r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.getDimx()]) + GETRED(mybuf[bigBuf.getDimx()]);
+ int g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.getDimx()]) + GETGREEN(mybuf[bigBuf.getDimx()]);
+ int b = GETBLUE(mybuf[1]) + GETBLUE(mybuf[-1]) + GETBLUE(mybuf[-bigBuf.getDimx()]) + GETBLUE(mybuf[bigBuf.getDimx()]);
+
+ r += GETRED(mybuf[0]);
+ g += GETGREEN(mybuf[0]);
+ b += GETBLUE(mybuf[0]);
+
+ r /= 5;
+ g /= 5;
+ b /= 5;
+
+ if (r > 31)
+ r = 31;
+ if (g > 31)
+ g = 31;
+ if (b > 31)
+ b = 31;
+
+ mybuf[0] = (r << 10) | (g << 5) | b;
+ }
+ }
+
+ // Skip to the next line
+ buf += bigBuf.getDimx();
+ }
+
+ // Position into the destination buffer
+ buf = bigBuf;
+ buf += y1 * bigBuf.getDimx();
+
+ // Looppone
+ buf += bigBuf.getDimx();
+ for (int y = 1; y < height - 1; y++) {
+ // if (prim->IsFlipped())
+ // mybuf=&buf[x1+m_dimx-1];
+ // else
+ mybuf = &buf[x1];
+
+ for (int x = 0; x < width; x++, mybuf += step) {
+ if (_aabuf[(y + v) * _dimx + x + u] == 1 && x != 0 && x != width - 1) {
+ int r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.getDimx()]) + GETRED(mybuf[bigBuf.getDimx()]);
+ int g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.getDimx()]) + GETGREEN(mybuf[bigBuf.getDimx()]);
+ int b = GETBLUE(mybuf[1]) + GETBLUE(mybuf[-1]) + GETBLUE(mybuf[-bigBuf.getDimx()]) + GETBLUE(mybuf[bigBuf.getDimx()]);
+
+ r += GETRED(mybuf[0]) * 2;
+ g += GETGREEN(mybuf[0]) * 2;
+ b += GETBLUE(mybuf[0]) * 2;
+
+ r /= 6;
+ g /= 6;
+ b /= 6;
+
+ if (r > 31)
+ r = 31;
+ if (g > 31)
+ g = 31;
+ if (b > 31)
+ b = 31;
+
+ mybuf[0] = (r << 10) | (g << 5) | b;
+ }
+ }
+
+ // Skip to the next line
+ buf += bigBuf.getDimx();
+ }
+}
+
+
+
+void RMGfxSourceBuffer8AA::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(RMGfxSourceBuffer8::draw, bigBuf, prim);
+ drawAA(bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+/****************************************************************************\
+* RMGfxSourceBuffer8RLEAA Methods
+\****************************************************************************/
+
+RMGfxSourceBuffer8RLEByteAA::~RMGfxSourceBuffer8RLEByteAA() {
+}
+
+void RMGfxSourceBuffer8RLEByteAA::prepareImage() {
+ RMGfxSourceBuffer::prepareImage();
+ calculateAA();
+ compressRLE();
+}
+
+void RMGfxSourceBuffer8RLEByteAA::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(RMGfxSourceBuffer8RLE::draw, bigBuf, prim);
+ if (GLOBALS._bCfgAntiAlias)
+ drawAA(bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+int RMGfxSourceBuffer8RLEByteAA::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
+ return RMGfxSourceBuffer8RLE::init(buf, dimx, dimy, bLoadPalette);
+}
+
+void RMGfxSourceBuffer8RLEByteAA::init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ RMGfxSourceBuffer8RLE::init(ds, dimx, dimy, bLoadPalette);
+
+ if (!_bNeedRLECompress) {
+ // Load the anti-aliasing mask
+ _aabuf = new byte[dimx * dimy];
+ ds.read(_aabuf, dimx * dimy);
+ }
+}
+
+RMGfxSourceBuffer8RLEWordAA::~RMGfxSourceBuffer8RLEWordAA() {
+}
+
+void RMGfxSourceBuffer8RLEWordAA::prepareImage() {
+ RMGfxSourceBuffer::prepareImage();
+ calculateAA();
+ compressRLE();
+}
+
+void RMGfxSourceBuffer8RLEWordAA::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(RMGfxSourceBuffer8RLE::draw, bigBuf, prim);
+ if (GLOBALS._bCfgAntiAlias)
+ drawAA(bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+int RMGfxSourceBuffer8RLEWordAA::init(byte *buf, int dimx, int dimy, bool bLoadPalette) {
+ return RMGfxSourceBuffer8RLE::init(buf, dimx, dimy, bLoadPalette);
+}
+
+void RMGfxSourceBuffer8RLEWordAA::init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ RMGfxSourceBuffer8RLE::init(ds, dimx, dimy, bLoadPalette);
+
+ if (!_bNeedRLECompress) {
+ // Load the anti-aliasing mask
+ _aabuf = new byte[dimx * dimy];
+ ds.read(_aabuf, dimx * dimy);
+ }
+}
+
+
+/****************************************************************************\
+* RMGfxSourceBuffer16 Methods
+\****************************************************************************/
+
+RMGfxSourceBuffer16::RMGfxSourceBuffer16(bool bTrasp0) {
+ _bTrasp0 = bTrasp0;
+}
+
+RMGfxSourceBuffer16::~RMGfxSourceBuffer16() {
+}
+
+void RMGfxSourceBuffer16::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ uint16 *buf = bigBuf;
+ uint16 *raw = (uint16 *)_buf;
+
+ int dimx = _dimx;
+ int dimy = _dimy;
+ int u = 0;
+ int v = 0;
+ int x1 = 0;
+ int y1 = 0;
+
+ if (prim->haveSrc()) {
+ u = prim->getSrc()._x1;
+ v = prim->getSrc()._y1;
+ dimx = prim->getSrc().width();
+ dimy = prim->getSrc().height();
+ }
+
+ if (prim->haveDst()) {
+ x1 = prim->getDst()._x1;
+ y1 = prim->getDst()._y1;
+ }
+
+ if (!clip2D(x1, y1, u, v, dimx, dimy, true, &bigBuf))
+ return;
+
+ raw += v * _dimx + u;
+ buf += y1 * bigBuf.getDimx() + x1;
+
+ if (_bTrasp0) {
+ for (int y = 0; y < dimy; y++) {
+ for (int x = 0; x < dimx;) {
+ while (x < dimx && raw[x] == 0)
+ x++;
+
+ while (x < dimx && raw[x] != 0) {
+ buf[x] = raw[x];
+ x++;
+ }
+ }
+
+ raw += _dimx;
+ buf += bigBuf.getDimx();
+ }
+ } else {
+ for (int y = 0; y < dimy; y++) {
+ Common::copy(raw, raw + dimx, buf);
+ buf += bigBuf.getDimx();
+ raw += _dimx;
+ }
+ }
+
+ // Specify the drawn area
+ bigBuf.addDirtyRect(Common::Rect(x1, y1, x1 + dimx, y1 + dimy));
+}
+
+void RMGfxSourceBuffer16::prepareImage() {
+ // Color space conversion if necessary!
+ uint16 *buf = (uint16 *)_buf;
+
+ for (int i = 0; i < _dimx * _dimy; i++)
+ WRITE_LE_UINT16(&buf[i], FROM_LE_16(buf[i]) & 0x7FFF);
+}
+
+RMGfxSourceBuffer16::RMGfxSourceBuffer16(int dimx, int dimy)
+ : RMGfxBuffer(dimx, dimy, 16) {
+ setPriority(0);
+ _bTrasp0 = false;
+}
+
+/**
+ * Returns the number of bits per pixel of the surface
+ *
+ * @returns Bit per pixel
+ */
+int RMGfxSourceBuffer16::getBpp() {
+ return 16;
+}
+
+void RMGfxSourceBuffer16::create(int dimx, int dimy) {
+ RMGfxBuffer::create(dimx, dimy, 16);
+}
+
+/****************************************************************************\
+* RMGfxBox Methods
+\****************************************************************************/
+
+void RMGfxBox::removeThis(CORO_PARAM, bool &result) {
+ result = true;
+}
+
+void RMGfxBox::setColor(byte r, byte g, byte b) {
+ r >>= 3;
+ g >>= 3;
+ b >>= 3;
+ _wFillColor = (r << 10) | (g << 5) | b;
+}
+
+void RMGfxBox::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ uint16 *buf = bigBuf;
+ RMRect rcDst;
+
+ // It takes the destination rectangle
+ rcDst = prim->getDst();
+ buf += rcDst._y1 * bigBuf.getDimx() + rcDst._x1;
+
+ // Loop through the pixels
+ for (int j = 0; j < rcDst.height(); j++) {
+ for (int i = 0; i < rcDst.width(); i++)
+ *buf++ = _wFillColor;
+
+ buf += bigBuf.getDimx() - rcDst.width();
+ }
+
+ // Specify the drawn area
+ bigBuf.addDirtyRect(rcDst);
+}
+
+
+/****************************************************************************\
+* RMGfxClearTask Methods
+\****************************************************************************/
+
+int RMGfxClearTask::priority() {
+ // Maximum priority (must be done first)
+ return 1;
+}
+
+void RMGfxClearTask::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *) {
+ // Clean the target buffer
+ Common::fill((byte *)bigBuf, (byte *)bigBuf + (bigBuf.getDimx() * bigBuf.getDimy() * 2), 0x0);
+ bigBuf.addDirtyRect(Common::Rect(bigBuf.getDimx(), bigBuf.getDimy()));
+}
+
+void RMGfxClearTask::removeThis(CORO_PARAM, bool &result) {
+ // The task is fine to be removed
+ result = true;
+}
+
+/****************************************************************************\
+* RMGfxPrimitive Methods
+\****************************************************************************/
+
+RMGfxPrimitive::RMGfxPrimitive() {
+ _bFlag = 0;
+ _task = NULL;
+ _src.setEmpty();
+ _dst.setEmpty();
+ _bStretch = false;
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task) {
+ _task = task;
+ _bFlag = 0;
+ _bStretch = false;
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst) {
+ _task = task;
+ _src = src;
+ _dst = dst;
+ _bFlag = 0;
+ _bStretch = (src.width() != dst.width() || src.height() != dst.height());
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst) {
+ _task = task;
+ _src.topLeft() = src;
+ _dst = dst;
+ _bFlag = 0;
+ _bStretch = false;
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) {
+ _task = task;
+ _src.topLeft() = src;
+ _dst.topLeft() = dst;
+ _bFlag = 0;
+ _bStretch = false;
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) {
+ _task = task;
+ _src = src;
+ _dst.topLeft() = dst;
+ _bFlag = 0;
+ _bStretch = false;
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) {
+ _task = task;
+ _dst = dst;
+ _src.setEmpty();
+ _bFlag = 0;
+ _bStretch = false;
+}
+
+RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) {
+ _task = task;
+ _dst.topLeft() = dst;
+ _src.setEmpty();
+ _bFlag = 0;
+ _bStretch = false;
+}
+
+RMGfxPrimitive::~RMGfxPrimitive() {
+}
+
+void RMGfxPrimitive::setFlag(byte bFlag) {
+ _bFlag = bFlag;
+}
+
+void RMGfxPrimitive::setTask(RMGfxTask *task) {
+ _task = task;
+}
+
+void RMGfxPrimitive::setSrc(const RMRect &src) {
+ _src = src;
+}
+
+void RMGfxPrimitive::setSrc(const RMPoint &src) {
+ _src.topLeft() = src;
+}
+
+void RMGfxPrimitive::setDst(const RMRect &dst) {
+ _dst = dst;
+}
+
+void RMGfxPrimitive::setDst(const RMPoint &dst) {
+ _dst.topLeft() = dst;
+}
+
+void RMGfxPrimitive::setStretch(bool bStretch) {
+ _bStretch = bStretch;
+}
+
+bool RMGfxPrimitive::haveDst() {
+ return !_dst.isEmpty();
+}
+
+RMRect &RMGfxPrimitive::getDst() {
+ return _dst;
+}
+
+bool RMGfxPrimitive::haveSrc() {
+ return !_src.isEmpty();
+}
+
+RMRect &RMGfxPrimitive::getSrc() {
+ return _src;
+}
+
+/**
+ * Flags
+ */
+bool RMGfxPrimitive::isFlipped() {
+ return _bFlag & 1;
+}
+
+/**
+ * Duplicate
+ */
+RMGfxPrimitive *RMGfxPrimitive::duplicate() {
+ return new RMGfxPrimitive(*this);
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h
new file mode 100644
index 0000000000..f0deed83ee
--- /dev/null
+++ b/engines/tony/gfxcore.h
@@ -0,0 +1,516 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_GFXCORE_H
+#define TONY_GFXCORE_H
+
+#include "common/system.h"
+#include "common/coroutines.h"
+#include "tony/utils.h"
+
+namespace Tony {
+
+/****************************************************************************\
+* Class prototype
+\****************************************************************************/
+
+// Class Name Family Treee Abstract?
+class RMGfxTask; // Yes
+class RMGfxTaskSetPrior; // Task Yes
+class RMGfxBuffer; //
+class RMGfxSourceBuffer; // TaskP+[Buffer] Yes
+class RMGfxTargetBuffer; // [Buffer]
+class RMGfxSourceBufferPal; // Source Yes
+class RMGfxSourceBuffer4; // SourcePal
+class RMGfxSourceBuffer8; // SourcePal
+class RMGfxSourceBuffer16; // Source
+class RMGfxWoodyBuffer; // Source16+Target
+class RMGfxClearTask; // Task
+
+
+/**
+ * Graphics buffer
+ */
+class RMGfxBuffer {
+protected:
+ int _dimx, _dimy;
+ byte *_buf;
+ byte *_origBuf;
+
+public:
+ RMGfxBuffer();
+ RMGfxBuffer(int dimx, int dimy, int nBpp);
+ virtual ~RMGfxBuffer();
+
+ // Attributes
+ int getDimx();
+ int getDimy();
+
+ // Creation
+ virtual void create(int dimx, int dimy, int nBpp);
+ virtual void destroy();
+
+ // These are valid only if the buffer is locked
+ operator byte *();
+ operator void *();
+
+ // Getting the offset for a given Y position
+ void offsetY(int nLines, int nBpp);
+};
+
+/**
+ * Graphics primitive
+ */
+class RMGfxPrimitive {
+public:
+ RMGfxTask *_task;
+
+protected:
+ RMRect _src;
+ RMRect _dst;
+
+ bool _bStretch;
+ byte _bFlag;
+
+public:
+ RMGfxPrimitive();
+ RMGfxPrimitive(RMGfxTask *task);
+ RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst);
+ RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst);
+ RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst);
+ RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst);
+ RMGfxPrimitive(RMGfxTask *task, const RMRect &dst);
+ RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst);
+ virtual ~RMGfxPrimitive();
+ void setFlag(byte bFlag);
+ void setTask(RMGfxTask *task);
+ void setSrc(const RMRect &src);
+ void setSrc(const RMPoint &src);
+ void setDst(const RMRect &dst);
+ void setDst(const RMPoint &dst);
+ void setStretch(bool bStretch);
+ bool haveDst();
+ RMRect &getDst();
+ bool haveSrc();
+ RMRect &getSrc();
+
+ // Flags
+ bool isFlipped();
+
+ // Duplicate
+ virtual RMGfxPrimitive *duplicate();
+};
+
+
+/**
+ * Graphic drawing task
+ */
+class RMGfxTask {
+protected:
+ int _nPrior;
+ int _nInList;
+
+public:
+ // Standard constructor
+ RMGfxTask();
+ virtual ~RMGfxTask() { }
+
+ virtual int priority();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) = 0;
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ // Registration
+ virtual void Register();
+ virtual void unregister();
+};
+
+
+/**
+ * Graphic drawing with priority
+ */
+class RMGfxTaskSetPrior : public RMGfxTask {
+public:
+ virtual ~RMGfxTaskSetPrior() { }
+ void setPriority(int nPrior);
+};
+
+
+/**
+ * Task that cleans the destination buffer
+ */
+class RMGfxClearTask : public RMGfxTask {
+public:
+ virtual ~RMGfxClearTask() { }
+
+ int priority();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ virtual void removeThis(CORO_PARAM, bool &result);
+};
+
+
+/**
+ * Task that draws a colored box
+ */
+class RMGfxBox : public RMGfxTaskSetPrior {
+protected:
+ uint16 _wFillColor;
+
+public:
+ virtual ~RMGfxBox() { }
+
+ void setColor(byte r, byte g, byte b);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ virtual void removeThis(CORO_PARAM, bool &result);
+};
+
+
+/**
+ * Buffer source for the design, which is a task. This is an abstract base.
+ */
+class RMGfxSourceBuffer : public virtual RMGfxBuffer, public RMGfxTaskSetPrior {
+public:
+ // Load the data for the surface
+ virtual int init(uint32 resID, int dimx, int dimy, bool bLoadPalette = false);
+ virtual int init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+ virtual void init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette = false);
+
+ virtual ~RMGfxSourceBuffer();
+
+protected:
+ virtual void prepareImage();
+ bool clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf);
+ void offsetY(int nLines);
+
+public:
+ virtual int getBpp() = 0;
+};
+
+
+/**
+ * 16-bit color source
+ */
+class RMGfxSourceBuffer16 : public RMGfxSourceBuffer {
+protected:
+ virtual void prepareImage();
+ bool _bTrasp0;
+
+public:
+ RMGfxSourceBuffer16(bool bUseTrasp = false);
+ RMGfxSourceBuffer16(int dimx, int dimy);
+ virtual ~RMGfxSourceBuffer16();
+
+ // Initialization
+ void create(int dimx, int dimy);
+
+ int getBpp();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+
+/**
+ * Buffer source with palette
+ */
+class RMGfxSourceBufferPal : public RMGfxSourceBuffer {
+protected:
+ // The size of the palette is (1 << Bpp()) * 4
+ byte _pal[256 * 3];
+ uint16 _palFinal[256];
+
+ // Post process to prepare the palette for drawing
+ virtual void preparePalette();
+
+public:
+ virtual ~RMGfxSourceBufferPal();
+
+ virtual int init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+ virtual void init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette = false);
+
+ int loadPaletteWA(uint32 resID, bool bSwapped = false);
+ int loadPaletteWA(const byte *buf, bool bSwapped = false);
+ int loadPalette(uint32 resID);
+ int loadPalette(const byte *buf);
+};
+
+
+/**
+ * Buffer source with a 256 color palette
+ */
+class RMGfxSourceBuffer8 : public RMGfxSourceBufferPal {
+protected:
+ bool _bTrasp0;
+
+public:
+ RMGfxSourceBuffer8(bool bTrasp0 = true);
+ RMGfxSourceBuffer8(int dimx, int dimy);
+ virtual ~RMGfxSourceBuffer8();
+
+ // Initialization
+ void create(int dimx, int dimy);
+
+ int getBpp();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+
+/**
+ * Buffer source with a 256 color palette, and alpha blending
+ */
+class RMGfxSourceBuffer8AB : public RMGfxSourceBuffer8 {
+protected:
+ int calcTrasp(int f, int b);
+
+public:
+ virtual ~RMGfxSourceBuffer8AB();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+
+/**
+ * Buffer source with a 256 color palette, RLE compressed
+ */
+
+class RMGfxSourceBuffer8RLE : public virtual RMGfxSourceBuffer8 {
+protected:
+ int _alphaBlendColor;
+ int _alphaR, _alphaB, _alphaG;
+ bool _bNeedRLECompress;
+
+protected:
+ static byte _megaRLEBuf[];
+
+ virtual void rleWriteTrasp(byte *&cur, int rep) = 0;
+ virtual void rleWriteData(byte *&cur, int rep, byte *src) = 0;
+ virtual void rleWriteEOL(byte *&cur) = 0;
+ virtual void rleWriteAlphaBlend(byte *&cur, int rep) = 0;
+ virtual void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) = 0;
+ virtual void rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) = 0;
+
+ // Perform image compression in RLE
+ void compressRLE();
+
+protected:
+ // Overriding initialization methods
+ virtual void prepareImage();
+ virtual void preparePalette();
+
+public:
+ RMGfxSourceBuffer8RLE();
+ virtual ~RMGfxSourceBuffer8RLE();
+
+ // Overload of the initialization method
+ virtual void init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette = false);
+ virtual int init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+
+ // Draw image with RLE decompression
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Sets the color that will be alpha blended
+ void setAlphaBlendColor(int color);
+
+ // Warn if the data is already compressed
+ void setAlreadyCompressed();
+};
+
+class RMGfxSourceBuffer8RLEByte : public RMGfxSourceBuffer8RLE {
+protected:
+ void rleWriteTrasp(byte * &cur, int rep);
+ void rleWriteAlphaBlend(byte * &cur, int rep);
+ void rleWriteData(byte * &cur, int rep, byte *src);
+ void rleWriteEOL(byte * &cur);
+ void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ void rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength);
+
+public:
+ virtual ~RMGfxSourceBuffer8RLEByte();
+};
+
+class RMGfxSourceBuffer8RLEWord : public RMGfxSourceBuffer8RLE {
+protected:
+ void rleWriteTrasp(byte * &cur, int rep);
+ void rleWriteAlphaBlend(byte * &cur, int rep);
+ void rleWriteData(byte * &cur, int rep, byte *src);
+ void rleWriteEOL(byte * &cur);
+ virtual void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ virtual void rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength);
+
+public:
+ virtual ~RMGfxSourceBuffer8RLEWord();
+};
+
+class RMGfxSourceBuffer8RLEWordAB : public RMGfxSourceBuffer8RLEWord {
+protected:
+ virtual void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
+
+public:
+ virtual ~RMGfxSourceBuffer8RLEWordAB();
+};
+
+
+/**
+ * Buffer source with a 256 color palette, with anti-aliasing
+ */
+class RMGfxSourceBuffer8AA : public virtual RMGfxSourceBuffer8 {
+protected:
+ static byte _megaAABuf[];
+ static byte _megaAABuf2[];
+ byte *_aabuf;
+
+ // Calculate the buffer for the anti-aliasing
+ void calculateAA();
+
+ // Draw the AA
+ void drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+protected:
+ void prepareImage();
+
+public:
+ RMGfxSourceBuffer8AA();
+ virtual ~RMGfxSourceBuffer8AA();
+
+ // Draw with anti-aliasing
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+
+class RMGfxSourceBuffer8RLEByteAA : public RMGfxSourceBuffer8RLEByte, public RMGfxSourceBuffer8AA {
+protected:
+ void prepareImage();
+
+public:
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Overloaded initialization methods
+ virtual void init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette = false);
+ virtual int init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+
+ virtual ~RMGfxSourceBuffer8RLEByteAA();
+};
+
+class RMGfxSourceBuffer8RLEWordAA : public RMGfxSourceBuffer8RLEWord, public RMGfxSourceBuffer8AA {
+protected:
+ void prepareImage();
+
+public:
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Overloaded initialization methods
+ virtual void init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette = false);
+ virtual int init(byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+
+ virtual ~RMGfxSourceBuffer8RLEWordAA();
+};
+
+
+/**
+ * Source buffer with 16 colors
+ */
+class RMGfxSourceBuffer4 : public RMGfxSourceBufferPal {
+public:
+ RMGfxSourceBuffer4();
+ RMGfxSourceBuffer4(int dimx, int dimy);
+
+ // Initialization
+ void create(int dimx, int dimy);
+
+ int getBpp();
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+
+/**
+ * Destination buffer which manages its own internal list of tasks
+ */
+class RMGfxTargetBuffer : public virtual RMGfxBuffer {
+private:
+ struct OTList {
+ RMGfxPrimitive *_prim;
+ OTList *_next;
+
+ OTList();
+ OTList(RMGfxPrimitive *pr) {
+ _prim = pr;
+ }
+ };
+
+ bool _trackDirtyRects;
+ Common::List<Common::Rect> _currentDirtyRects, _previousDirtyRects, _dirtyRects;
+
+ void mergeDirtyRects();
+
+private:
+// OSystem::MutexRef csModifyingOT;
+
+protected:
+ OTList *_otlist;
+ int _otSize;
+
+public:
+ RMGfxTargetBuffer();
+ virtual ~RMGfxTargetBuffer();
+
+ static uint16 *_precalcTable;
+ static void createBWPrecalcTable();
+ static void freeBWPrecalcTable();
+
+ // management of the OT list
+ void clearOT();
+ void drawOT(CORO_PARAM);
+ void addPrim(RMGfxPrimitive *prim); // The pointer must be delted
+
+ operator byte *();
+ operator void *();
+ operator uint16 *();
+
+ // Offseting buffer
+ void offsetY(int nLines);
+
+ // Dirty rect methods
+ void addDirtyRect(const Common::Rect &r);
+ Common::List<Common::Rect> &getDirtyRects();
+ void clearDirtyRects();
+ void setTrackDirtyRects(bool v);
+ bool getTrackDirtyRects() const;
+};
+
+
+/**
+ * Ring buffer, which is both source and by destination
+ */
+class RMGfxWoodyBuffer: public RMGfxSourceBuffer16, public RMGfxTargetBuffer {
+public:
+ RMGfxWoodyBuffer();
+ RMGfxWoodyBuffer(int dimx, int dimy);
+ virtual ~RMGfxWoodyBuffer();
+
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
new file mode 100644
index 0000000000..59fb024622
--- /dev/null
+++ b/engines/tony/gfxengine.cpp
@@ -0,0 +1,843 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/savefile.h"
+#include "tony/mpal/lzo.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/custom.h"
+#include "tony/gfxengine.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+
+/****************************************************************************\
+* RMGfxEngine Methods
+\****************************************************************************/
+
+void exitAllIdles(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ int nCurLoc = *(const int *)param;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Closes idle
+ GLOBALS._bSkipSfxNoLoop = true;
+
+ CORO_INVOKE_2(mpalEndIdlePoll, nCurLoc, NULL);
+
+ GLOBALS._bIdleExited = true;
+ GLOBALS._bSkipSfxNoLoop = false;
+
+ CORO_END_CODE;
+}
+
+RMGfxEngine::RMGfxEngine() {
+ // Create big buffer where the frame will be rendered
+ _bigBuf.create(RM_BBX, RM_BBY, 16);
+ _bigBuf.offsetY(RM_SKIPY);
+ _bigBuf.setTrackDirtyRects(true);
+
+ _nCurLoc = 0;
+ _curAction = TA_GOTO;
+ _curActionObj = 0;
+ _nWipeType = 0;
+ _hWipeEvent = 0;
+ _nWipeStep = 0;
+ _bMustEnterMenu = false;
+ _bWiping = false;
+ _bGUIOption = false;
+ _bGUIInterface = false;
+ _bGUIInventory = false;
+ _bAlwaysDrawMouse = false;
+ _bOption = false;
+ _bLocationLoaded = false;
+ _bInput = false;
+}
+
+RMGfxEngine::~RMGfxEngine() {
+ // Close the buffer
+ _bigBuf.destroy();
+}
+
+void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) {
+ CORO_BEGIN_CONTEXT;
+ bool bRes;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->bRes = false;
+
+ if (type == 0)
+ CORO_INVOKE_2(_opt.init, _bigBuf, _ctx->bRes);
+ else if (type == 1)
+ CORO_INVOKE_3(_opt.initLoadMenuOnly, _bigBuf, true, _ctx->bRes);
+ else if (type == 2)
+ CORO_INVOKE_2(_opt.initNoLoadSave, _bigBuf, _ctx->bRes);
+ else if (type == 3)
+ CORO_INVOKE_3(_opt.initLoadMenuOnly, _bigBuf, false, _ctx->bRes);
+ else if (type == 4)
+ CORO_INVOKE_3(_opt.initSaveMenuOnly, _bigBuf, false, _ctx->bRes);
+
+ if (_ctx->bRes) {
+ g_vm->pauseSound(true);
+
+ disableInput();
+ _inv.endCombine();
+ _curActionObj = 0;
+ _curAction = TA_GOTO;
+ _point.setAction(_curAction);
+ _point.setSpecialPointer(RMPointer::PTR_NONE);
+ _point.setCustomPointer(NULL);
+ enableMouse();
+ g_vm->grabThumbnail();
+
+ // Exists the IDLE to avoid premature death in loading
+ _bMustEnterMenu = true;
+ if (type == 1 || type == 2) {
+ GLOBALS._bIdleExited = true;
+ } else {
+ CORO_INVOKE_0(_tony.stopNoAction);
+
+ GLOBALS._bIdleExited = false;
+
+ CoroScheduler.createProcess(exitAllIdles, &_nCurLoc, sizeof(int));
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Poll of input devices
+ _input.poll();
+
+ if (_bMustEnterMenu && GLOBALS._bIdleExited) {
+ _bOption = true;
+ _bMustEnterMenu = false;
+ GLOBALS._bIdleExited = false;
+ }
+
+ if (_bOption) {
+ CORO_INVOKE_1(_opt.doFrame, &_input);
+ _bOption = !_opt.isClosing();
+ if (!_bOption) {
+ disableMouse();
+ enableInput();
+ mpalStartIdlePoll(_nCurLoc);
+ g_vm->pauseSound(false);
+ }
+ }
+
+ if (bDrawLocation && _bLocationLoaded) {
+ // Location and objects
+ _loc.doFrame(&_bigBuf);
+
+ // Check the mouse input
+ if (_bInput && !_tony.inAction()) {
+ // If we are on the inventory, it is it who controls all input
+ if (_inv.haveFocus(_input.mousePos()) && !_inter.active()) {
+ // Left Click
+ // **********
+ if (_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) {
+ // Left click activates the combine, if we are on an object
+ if (_inv.leftClick(_input.mousePos(), _curActionObj)) {
+ _curAction = TA_COMBINE;
+ _point.setAction(_curAction);
+ }
+ } else
+
+ // Right Click
+ // ***********
+ if (_input.mouseRightClicked()) {
+ if (_itemName.isItemSelected()) {
+ _curActionObj = 0;
+ _inv.rightClick(_input.mousePos());
+ } else
+ _inv.rightClick(_input.mousePos());
+ } else
+
+ // Right Release
+ // *************
+ if (_input.mouseRightReleased()) {
+ if (_inv.rightRelease(_input.mousePos(), _curAction)) {
+ CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction);
+
+ _curAction = TA_GOTO;
+ _point.setAction(_curAction);
+ }
+ }
+ } else {
+ // Options Menu
+ // ************
+ if (_bGUIOption) {
+ if (!_tony.inAction() && _bInput) {
+ if ((_input.mouseLeftClicked() && _input.mousePos()._x < 3 && _input.mousePos()._y < 3)) {
+ CORO_INVOKE_1(openOptionScreen, 0);
+ goto SKIPCLICKSINISTRO;
+ } else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE))
+ CORO_INVOKE_1(openOptionScreen, 0);
+ else if (!g_vm->getIsDemo()) {
+ if (_input.getAsyncKeyState(Common::KEYCODE_F3) || _input.getAsyncKeyState(Common::KEYCODE_F5))
+ // Save game screen
+ CORO_INVOKE_1(openOptionScreen, 4);
+ else if (_input.getAsyncKeyState(Common::KEYCODE_F2) || _input.getAsyncKeyState(Common::KEYCODE_F7))
+ // Load game screen
+ CORO_INVOKE_1(openOptionScreen, 3);
+ }
+ }
+ }
+
+ // Left Click
+ // **************
+ if (_input.mouseLeftClicked() && !_inter.active()) {
+
+ if (_curAction != TA_COMBINE)
+ CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _point.curAction());
+ else if (_itemName.getSelectedItem() != NULL)
+ CORO_INVOKE_4(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), TA_COMBINE, _curActionObj);
+
+ if (_curAction == TA_COMBINE) {
+ _inv.endCombine();
+ _point.setSpecialPointer(RMPointer::PTR_NONE);
+ }
+
+ _curAction = TA_GOTO;
+ _point.setAction(_curAction);
+ }
+
+SKIPCLICKSINISTRO:
+ // Right Click
+ // ************
+ if (_curAction == TA_COMBINE) {
+ // During a combine, it cancels it
+ if (_input.mouseRightClicked()) {
+ _inv.endCombine();
+ _curActionObj = 0;
+ _curAction = TA_GOTO;
+ _point.setAction(_curAction);
+ _point.setSpecialPointer(RMPointer::PTR_NONE);
+ }
+ } else if (_input.mouseRightClicked() && _itemName.isItemSelected() && _point.getSpecialPointer() == RMPointer::PTR_NONE) {
+ if (_bGUIInterface) {
+ // Before opening the interface, replaces GOTO
+ _curAction = TA_GOTO;
+ _curActionObj = 0;
+ _point.setAction(_curAction);
+ _inter.clicked(_input.mousePos());
+ }
+ }
+
+
+ // Right Release
+ // *************
+ if (_input.mouseRightReleased()) {
+ if (_bGUIInterface) {
+ if (_inter.released(_input.mousePos(), _curAction)) {
+ _point.setAction(_curAction);
+ CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction);
+
+ _curAction = TA_GOTO;
+ _point.setAction(_curAction);
+ }
+ }
+ }
+ }
+
+ // Update the name under the mouse pointer
+ _itemName.setMouseCoord(_input.mousePos());
+ if (!_inter.active() && !_inv.miniActive())
+ CORO_INVOKE_4(_itemName.doFrame, _bigBuf, _loc, _point, _inv);
+ }
+
+ // Interface & Inventory
+ _inter.doFrame(_bigBuf, _input.mousePos());
+ _inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.inAction() && !_inter.active() && _bGUIInventory));
+ }
+
+ // Animate Tony
+ CORO_INVOKE_2(_tony.doFrame, &_bigBuf, _nCurLoc);
+
+ // Update screen scrolling to keep Tony in focus
+ if (_tony.mustUpdateScrolling() && _bLocationLoaded) {
+ RMPoint showThis = _tony.position();
+ showThis._y -= 60;
+ _loc.updateScrolling(showThis);
+ }
+
+ if (_bLocationLoaded)
+ _tony.setScrollPosition(_loc.scrollPosition());
+
+ if ((!_tony.inAction() && _bInput) || _bAlwaysDrawMouse) {
+ _point.showCursor();
+ } else {
+ _point.hideCursor();
+ }
+ _point.doFrame();
+
+ // **********************
+ // Draw the list in the OT
+ // **********************
+ CORO_INVOKE_0(_bigBuf.drawOT);
+
+#define FSTEP (480/32)
+
+ // Wipe
+ if (_bWiping) {
+ switch (_nWipeType) {
+ case 1:
+ if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top >= FSTEP * 2)) {
+ CoroScheduler.setEvent(_hWipeEvent);
+ _nWipeType = 3;
+ break;
+ }
+
+ _rcWipeEllipse.top += FSTEP;
+ _rcWipeEllipse.left += FSTEP;
+ _rcWipeEllipse.right -= FSTEP;
+ _rcWipeEllipse.bottom -= FSTEP;
+ break;
+
+ case 2:
+ if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top < 480 - FSTEP)) {
+ CoroScheduler.setEvent(_hWipeEvent);
+ _nWipeType = 3;
+ break;
+ }
+
+ _rcWipeEllipse.top -= FSTEP;
+ _rcWipeEllipse.left -= FSTEP;
+ _rcWipeEllipse.right += FSTEP;
+ _rcWipeEllipse.bottom += FSTEP;
+ break;
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMGfxEngine::initCustomDll() {
+ setupGlobalVars(&_tony, &_point, &g_vm->_theBoxes, &_loc, &_inv, &_input);
+}
+
+void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) {
+ RMItem *item;
+ assert(GLOBALS._gfxEngine);
+
+ if (GLOBALS._gfxEngine->_bLocationLoaded) {
+ item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem);
+ if (item != NULL) {
+ if (nPattern != -1) {
+ item->setPattern(nPattern, true);
+ }
+ if (nStatus != -1)
+ item->setStatus(nStatus);
+ }
+ }
+}
+
+void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
+ if (start._x == -1 || start._y == -1) {
+ start._x = ptTonyStart._x - RM_SX / 2;
+ start._y = ptTonyStart._y - RM_SY / 2;
+ }
+
+ _loc.setScrollPosition(start);
+
+ if (ptTonyStart._x == 0 && ptTonyStart._y == 0) {
+ } else {
+ _tony.setPosition(ptTonyStart, nLoc);
+ _tony.setScrollPosition(start);
+ }
+
+ _curAction = TA_GOTO;
+ _point.setCustomPointer(NULL);
+ _point.setSpecialPointer(RMPointer::PTR_NONE);
+ _point.setAction(_curAction);
+ _inter.reset();
+ _inv.reset();
+
+ mpalStartIdlePoll(_nCurLoc);
+}
+
+uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
+ _nCurLoc = nLoc;
+
+ bool bLoaded = false;
+ for (int i = 0; i < 5; i++) {
+ // Try the loading of the location
+ RMRes res(_nCurLoc);
+ if (!res.isValid())
+ continue;
+
+ Common::SeekableReadStream *ds = res.getReadStream();
+ _loc.load(*ds);
+ delete ds;
+
+ initForNewLocation(nLoc, ptTonyStart, start);
+ bLoaded = true;
+ break;
+ }
+
+ if (!bLoaded)
+ error("Location was not loaded");
+
+ if (_bOption)
+ _opt.reInit(_bigBuf);
+
+ _bLocationLoaded = true;
+
+ // On entering the location
+ return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0, m_nCurLoc, 0);
+}
+
+void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
+ CORO_BEGIN_CONTEXT;
+ uint32 h;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Release the location
+ CORO_INVOKE_2(mpalEndIdlePoll, _nCurLoc, NULL);
+
+ // On Exit?
+ if (bDoOnExit) {
+ _ctx->h = mpalQueryDoAction(1, _nCurLoc, 0);
+ if (_ctx->h != CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
+ }
+
+ _bLocationLoaded = false;
+
+ _bigBuf.clearOT();
+ _loc.unload();
+
+ if (result != NULL)
+ *result = CORO_INVALID_PID_VALUE;
+
+ CORO_END_CODE;
+}
+
+void RMGfxEngine::init() {
+ // Screen loading
+ RMResRaw *raw;
+ RMGfxSourceBuffer16 *load = NULL;
+ INIT_GFX16_FROMRAW(20038, load);
+ _bigBuf.addPrim(new RMGfxPrimitive(load));
+ _bigBuf.drawOT(Common::nullContext);
+ _bigBuf.clearOT();
+ delete load;
+
+ // Display 'Loading' screen
+ _bigBuf.addDirtyRect(Common::Rect(0, 0, RM_SX, RM_SY));
+ g_vm->_window.getNewFrame(*this, NULL);
+ g_vm->_window.repaint();
+
+ // Activate GUI
+ _bGUIOption = true;
+ _bGUIInterface = true;
+ _bGUIInventory = true;
+
+ GLOBALS._bSkipSfxNoLoop = false;
+ _bMustEnterMenu = false;
+ GLOBALS._bIdleExited = false;
+ _bOption = false;
+ _bWiping = false;
+ _hWipeEvent = CoroScheduler.createEvent(false, false);
+
+ // Initialize the IRQ function for items for MPAL
+ GLOBALS._gfxEngine = this;
+ mpalInstallItemIrq(itemIrq);
+
+ // Initialize the mouse pointer
+ _point.init();
+
+ // Initialize Tony
+ _tony.init();
+ _tony.linkToBoxes(&g_vm->_theBoxes);
+
+ // Initialize the inventory and the interface
+ _inv.init();
+ _inter.init();
+
+ // Download the location and set priorities @@@@@
+ _bLocationLoaded = false;
+
+ enableInput();
+
+ // Starting the game
+ _tony.executeAction(20, 1, 0);
+}
+
+void RMGfxEngine::close() {
+ _bigBuf.clearOT();
+
+ _inter.close();
+ _inv.close();
+ _tony.close();
+ _point.close();
+}
+
+void RMGfxEngine::enableInput() {
+ _bInput = true;
+}
+
+void RMGfxEngine::disableInput() {
+ _bInput = false;
+ _inter.reset();
+}
+
+void RMGfxEngine::enableMouse() {
+ _bAlwaysDrawMouse = true;
+}
+
+void RMGfxEngine::disableMouse() {
+ _bAlwaysDrawMouse = false;
+}
+
+#define TONY_SAVEGAME_VERSION 8
+
+void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) {
+ Common::OutSaveFile *f;
+ byte *state;
+ char buf[4];
+ RMPoint tp = _tony.position();
+
+ // Saving: MPAL variables, current location, and Tony inventory position
+
+ // For now, we only save the MPAL state
+ uint size = mpalGetSaveStateSize();
+ state = new byte[size];
+ mpalSaveState(state);
+
+ uint thumbsize = 160 * 120 * 2;
+
+ buf[0] = 'R';
+ buf[1] = 'M';
+ buf[2] = 'S';
+ buf[3] = TONY_SAVEGAME_VERSION;
+
+ f = g_system->getSavefileManager()->openForSaving(fn);
+ if (f == NULL)
+ return;
+
+ f->write(buf, 4);
+ f->writeUint32LE(thumbsize);
+ f->write(curThumb, thumbsize);
+
+ // Difficulty level
+ int i = mpalQueryGlobalVar("VERSIONEFACILE");
+ f->writeByte(i);
+
+ i = strlen(name.c_str());
+ f->writeByte(i);
+ f->write(name.c_str(), i);
+ f->writeUint32LE(_nCurLoc);
+ f->writeUint32LE(tp._x);
+ f->writeUint32LE(tp._y);
+
+ f->writeUint32LE(size);
+ f->write(state, size);
+ delete[] state;
+
+ // Inventory
+ size = _inv.getSaveStateSize();
+ state = new byte[size];
+ _inv.saveState(state);
+ f->writeUint32LE(size);
+ f->write(state, size);
+ delete[] state;
+
+ // boxes
+ size = g_vm->_theBoxes.getSaveStateSize();
+ state = new byte[size];
+ g_vm->_theBoxes.saveState(state);
+ f->writeUint32LE(size);
+ f->write(state, size);
+ delete[] state;
+
+ // New Ver5
+ // Saves the state of the shepherdess and show yourself
+ bool bStat = _tony.getShepherdess();
+ f->writeByte(bStat);
+ bStat = _inter.getPerorate();
+ f->writeByte(bStat);
+
+ // Save the chars
+ charsSaveAll(f);
+
+ // Save the options
+ f->writeByte(GLOBALS._bCfgInvLocked);
+ f->writeByte(GLOBALS._bCfgInvNoScroll);
+ f->writeByte(GLOBALS._bCfgTimerizedText);
+ f->writeByte(GLOBALS._bCfgInvUp);
+ f->writeByte(GLOBALS._bCfgAnni30);
+ f->writeByte(GLOBALS._bCfgAntiAlias);
+ f->writeByte(GLOBALS._bShowSubtitles);
+ f->writeByte(GLOBALS._bCfgTransparence);
+ f->writeByte(GLOBALS._bCfgInterTips);
+ f->writeByte(GLOBALS._bCfgDubbing);
+ f->writeByte(GLOBALS._bCfgMusic);
+ f->writeByte(GLOBALS._bCfgSFX);
+ f->writeByte(GLOBALS._nCfgTonySpeed);
+ f->writeByte(GLOBALS._nCfgTextSpeed);
+ f->writeByte(GLOBALS._nCfgDubbingVolume);
+ f->writeByte(GLOBALS._nCfgMusicVolume);
+ f->writeByte(GLOBALS._nCfgSFXVolume);
+
+ // Save the hotspots
+ saveChangedHotspot(f);
+
+ // Save the music
+ saveMusic(f);
+
+ f->finalize();
+ delete f;
+}
+
+void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
+ // PROBLEM: You should change the location in a separate process to do the OnEnter
+ CORO_BEGIN_CONTEXT;
+ Common::InSaveFile *f;
+ byte *state, *statecmp;
+ uint size, sizecmp;
+ char buf[4];
+ RMPoint tp;
+ int loc;
+ int ver;
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->f = g_system->getSavefileManager()->openForLoading(fn);
+ if (_ctx->f == NULL)
+ return;
+ _ctx->f->read(_ctx->buf, 4);
+
+ if (_ctx->buf[0] != 'R' || _ctx->buf[1] != 'M' || _ctx->buf[2] != 'S') {
+ delete _ctx->f;
+ return;
+ }
+
+ _ctx->ver = _ctx->buf[3];
+
+ if (_ctx->ver == 0 || _ctx->ver > TONY_SAVEGAME_VERSION) {
+ delete _ctx->f;
+ return;
+ }
+
+ if (_ctx->ver >= 0x3) {
+ // There is a thumbnail. If the version is between 5 and 7, it's compressed
+ if ((_ctx->ver >= 0x5) && (_ctx->ver <= 0x7)) {
+ _ctx->i = 0;
+ _ctx->i = _ctx->f->readUint32LE();
+ _ctx->f->seek(_ctx->i);
+ } else {
+ if (_ctx->ver >= 8)
+ // Skip thumbnail size
+ _ctx->f->skip(4);
+
+ _ctx->f->seek(160 * 120 * 2, SEEK_CUR);
+ }
+ }
+
+ if (_ctx->ver >= 0x5) {
+ // Skip the difficulty level
+ _ctx->f->seek(1, SEEK_CUR);
+ }
+
+ if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose
+ _ctx->i = _ctx->f->readByte();
+ _ctx->f->seek(_ctx->i, SEEK_CUR);
+ }
+
+ _ctx->loc = _ctx->f->readUint32LE();
+ _ctx->tp._x = _ctx->f->readUint32LE();
+ _ctx->tp._y = _ctx->f->readUint32LE();
+ _ctx->size = _ctx->f->readUint32LE();
+
+ if ((_ctx->ver >= 0x5) && (_ctx->ver <= 7)) {
+ // MPAL was packed!
+ _ctx->sizecmp = _ctx->f->readUint32LE();
+ _ctx->state = new byte[_ctx->size];
+ _ctx->statecmp = new byte[_ctx->sizecmp];
+ _ctx->f->read(_ctx->statecmp, _ctx->sizecmp);
+ lzo1x_decompress(_ctx->statecmp, _ctx->sizecmp, _ctx->state, &_ctx->size);
+ delete[] _ctx->statecmp;
+ } else {
+ // Read uncompressed MPAL data
+ _ctx->state = new byte[_ctx->size];
+ _ctx->f->read(_ctx->state, _ctx->size);
+ }
+
+ mpalLoadState(_ctx->state);
+ delete[] _ctx->state;
+
+ // Inventory
+ _ctx->size = _ctx->f->readUint32LE();
+ _ctx->state = new byte[_ctx->size];
+ _ctx->f->read(_ctx->state, _ctx->size);
+ _inv.loadState(_ctx->state);
+ delete[] _ctx->state;
+
+ if (_ctx->ver >= 0x2) { // Version 2: box please
+ _ctx->size = _ctx->f->readUint32LE();
+ _ctx->state = new byte[_ctx->size];
+ _ctx->f->read(_ctx->state, _ctx->size);
+ g_vm->_theBoxes.loadState(_ctx->state);
+ delete[] _ctx->state;
+ }
+
+ if (_ctx->ver >= 5) {
+ // Version 5
+ bool bStat = false;
+
+ bStat = _ctx->f->readByte();
+ _tony.setShepherdess(bStat);
+ bStat = _ctx->f->readByte();
+ _inter.setPerorate(bStat);
+
+ charsLoadAll(_ctx->f);
+ }
+
+ if (_ctx->ver >= 6) {
+ // Load options
+ GLOBALS._bCfgInvLocked = _ctx->f->readByte();
+ GLOBALS._bCfgInvNoScroll = _ctx->f->readByte();
+ GLOBALS._bCfgTimerizedText = _ctx->f->readByte();
+ GLOBALS._bCfgInvUp = _ctx->f->readByte();
+ GLOBALS._bCfgAnni30 = _ctx->f->readByte();
+ GLOBALS._bCfgAntiAlias = _ctx->f->readByte();
+ GLOBALS._bShowSubtitles = _ctx->f->readByte();
+ GLOBALS._bCfgTransparence = _ctx->f->readByte();
+ GLOBALS._bCfgInterTips = _ctx->f->readByte();
+ GLOBALS._bCfgDubbing = _ctx->f->readByte();
+ GLOBALS._bCfgMusic = _ctx->f->readByte();
+ GLOBALS._bCfgSFX = _ctx->f->readByte();
+ GLOBALS._nCfgTonySpeed = _ctx->f->readByte();
+ GLOBALS._nCfgTextSpeed = _ctx->f->readByte();
+ GLOBALS._nCfgDubbingVolume = _ctx->f->readByte();
+ GLOBALS._nCfgMusicVolume = _ctx->f->readByte();
+ GLOBALS._nCfgSFXVolume = _ctx->f->readByte();
+
+ // Load hotspots
+ loadChangedHotspot(_ctx->f);
+ }
+
+ if (_ctx->ver >= 7) {
+ loadMusic(_ctx->f);
+ }
+
+ delete _ctx->f;
+
+ CORO_INVOKE_2(unloadLocation, false, NULL);
+ loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1));
+ _tony.setPattern(RMTony::PAT_STANDRIGHT);
+
+ // On older versions, need to an enter action
+ if (_ctx->ver < 5)
+ mpalQueryDoAction(0, _ctx->loc, 0);
+ else {
+ // In the new ones, we just reset the mcode
+ mCharResetCodes();
+ }
+
+ if (_ctx->ver >= 6)
+ reapplyChangedHotspot();
+
+ CORO_INVOKE_0(restoreMusic);
+
+ _bGUIInterface = true;
+ _bGUIInventory = true;
+ _bGUIOption = true;
+
+ CORO_END_CODE;
+}
+
+void RMGfxEngine::pauseSound(bool bPause) {
+ if (_bLocationLoaded)
+ _loc.pauseSound(bPause);
+}
+
+void RMGfxEngine::initWipe(int type) {
+ _bWiping = true;
+ _nWipeType = type;
+ _nWipeStep = 0;
+
+ if (_nWipeType == 1)
+ _rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480);
+ else if (_nWipeType == 2)
+ _rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP);
+}
+
+void RMGfxEngine::closeWipe() {
+ _bWiping = false;
+}
+
+void RMGfxEngine::waitWipeEnd(CORO_PARAM) {
+ CoroScheduler.waitForSingleObject(coroParam, _hWipeEvent, CORO_INFINITE);
+}
+
+bool RMGfxEngine::canLoadSave() {
+ return _bInput && !_tony.inAction() && !g_vm->getIsDemo();
+}
+
+RMGfxEngine::operator RMGfxTargetBuffer &() {
+ return _bigBuf;
+}
+
+RMInput &RMGfxEngine::getInput() {
+ return _input;
+}
+
+RMPointer &RMGfxEngine::getPointer() {
+ return _point;
+}
+
+/**
+ * Link to graphic task
+ */
+void RMGfxEngine::linkGraphicTask(RMGfxTask *task) {
+ _bigBuf.addPrim(new RMGfxPrimitive(task));
+}
+
+void RMGfxEngine::setPerorate(bool bpal) {
+ _inter.setPerorate(bpal);
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/gfxengine.h b/engines/tony/gfxengine.h
new file mode 100644
index 0000000000..ab32a01972
--- /dev/null
+++ b/engines/tony/gfxengine.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.
+ *
+ */
+
+/*
+ * This code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_GFXENGINE_H
+#define TONY_GFXENGINE_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/rect.h"
+#include "tony/mpal/memory.h"
+#include "tony/game.h"
+#include "tony/gfxcore.h"
+#include "tony/input.h"
+#include "tony/inventory.h"
+#include "tony/tonychar.h"
+#include "tony/utils.h"
+
+namespace Tony {
+
+class RMGfxEngine {
+private:
+ RMGfxTargetBuffer _bigBuf;
+ RMInput _input;
+ RMPointer _point;
+ RMLocation _loc;
+ RMOptionScreen _opt;
+ RMTony _tony;
+ RMInventory _inv;
+ RMInterface _inter;
+ RMTextItemName _itemName;
+
+ bool _bOption;
+ bool _bLocationLoaded;
+
+ bool _bInput;
+ bool _bAlwaysDrawMouse;
+
+ int _nCurLoc;
+ RMTonyAction _curAction;
+ int _curActionObj;
+
+ int _nWipeType;
+ uint32 _hWipeEvent;
+ int _nWipeStep;
+
+ bool _bMustEnterMenu;
+protected:
+ static void itemIrq(uint32 dwItem, int nPattern, int nStatus);
+ void initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
+public:
+ bool _bWiping;
+ Common::Rect _rcWipeEllipse;
+ bool _bGUIOption;
+ bool _bGUIInterface;
+ bool _bGUIInventory;
+public:
+ RMGfxEngine();
+ virtual ~RMGfxEngine();
+
+ // Draw the next frame
+ void doFrame(CORO_PARAM, bool bDrawLocation);
+
+ // Initializes the graphics engine
+ void init();
+
+ // Closes the graphics engine
+ void close();
+
+ // Warns when entering or exits the options menu
+ void openOptionScreen(CORO_PARAM, int type);
+
+ // Enables or disables mouse input
+ void enableInput();
+ void disableInput();
+
+ // Enables and disables mouse draw
+ void enableMouse();
+ void disableMouse();
+
+ operator RMGfxTargetBuffer &();
+ RMInput &getInput();
+ RMPointer &getPointer();
+
+ // Link to the custom function list
+ void initCustomDll();
+
+ // Link to graphic task
+ void linkGraphicTask(RMGfxTask *task);
+
+ // Manage a location
+ uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
+ void unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result);
+ int getCurrentLocation() const { return _nCurLoc; }
+
+ // State management
+ void saveState(const Common::String &fn, byte *curThumb, const Common::String &name);
+ void loadState(CORO_PARAM, const Common::String &fn);
+
+ // Pauses sound
+ void pauseSound(bool bPause);
+
+ // Wipe
+ void initWipe(int type);
+ void closeWipe();
+ void waitWipeEnd(CORO_PARAM);
+
+ void setPerorate(bool bpal);
+
+ bool canLoadSave();
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp
new file mode 100644
index 0000000000..8e4ae240a0
--- /dev/null
+++ b/engines/tony/globals.cpp
@@ -0,0 +1,135 @@
+/* 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/algorithm.h"
+#include "tony/globals.h"
+
+namespace Tony {
+
+Globals::Globals() {
+ _nextLoop = false;
+ _nextChannel = 0;
+ _nextSync = 0;
+ _curChannel = 0;
+ _flipflop = 0;
+ _curBackText = NULL;
+ _bTonyIsSpeaking = false;
+ _curChangedHotspot = 0;
+ _tony = NULL;
+ _pointer = NULL;
+ _boxes = NULL;
+ _loc = NULL;
+ _inventory = NULL;
+ _input = NULL;
+ _gfxEngine = NULL;
+ EnableGUI = NULL;
+ DisableGUI = NULL;
+
+ _dwTonyNumTexts = 0;
+ _bTonyInTexts = false;
+ _bStaticTalk = false;
+ _bAlwaysDisplay = false;
+ _bIdleExited = false;
+ _bSkipSfxNoLoop = false;
+ _bNoBullsEye = false;
+ _curDialog = 0;
+ _curSoundEffect = 0;
+ _bFadeOutStop = false;
+
+ _bSkipIdle = false;
+ _hSkipIdle = 0;
+ _lastMusic = 0;
+ _lastTappeto = 0;
+ Common::fill(&_ambiance[0], &_ambiance[200], 0);
+ _fullScreenMessageLoc = 0;
+
+ // MPAL global variables
+ _mpalError = 0;
+ _lpiifCustom = NULL;
+ _lplpFunctions = NULL;
+ _lplpFunctionStrings = NULL;
+ _nObjs = 0;
+ _nVars = 0;
+ _hVars = NULL;
+ _lpmvVars = NULL;
+ _nMsgs = 0;
+ _hMsgs = NULL;
+ _lpmmMsgs = NULL;
+ _nDialogs = 0;
+ _hDialogs = NULL;
+ _lpmdDialogs = NULL;
+ _nItems = 0;
+ _hItems = NULL;
+ _lpmiItems = NULL;
+ _nLocations = 0;
+ _hLocations = NULL;
+ _lpmlLocations = NULL;
+ _nScripts = 0;
+ _hScripts = NULL;
+ _lpmsScripts = NULL;
+ _nResources = 0;
+ _lpResources = NULL;
+ _bExecutingAction = false;
+ _bExecutingDialog = false;
+ Common::fill(&_nPollingLocations[0], &_nPollingLocations[MAXPOLLINGLOCATIONS], 0);
+ Common::fill(&_hEndPollingLocations[0], &_hEndPollingLocations[MAXPOLLINGLOCATIONS], 0);
+ Common::fill(&_pollingThreads[0], &_pollingThreads[MAXPOLLINGLOCATIONS], 0);
+ _hAskChoice = 0;
+ _hDoneChoice = 0;
+ _nExecutingAction = 0;
+ _nExecutingDialog = 0;
+ _nExecutingChoice = 0;
+ _nSelectedChoice = 0;
+ _nTonyNextTalkType = RMTony::TALK_NORMAL;
+ _saveTonyLoc = 0;
+
+ for (int i = 0; i < 16; ++i) {
+ Common::fill((byte *)&_character[i], (byte *)&_character[i] + sizeof(CharacterStruct), 0);
+ _isMChar[i] = false;
+ }
+
+ for (int i = 0; i < 10; ++i)
+ Common::fill((byte *)&_mCharacter[i], (byte *)&_mCharacter[i] + sizeof(MCharacterStruct), 0);
+ for (int i = 0; i < 256; ++i)
+ Common::fill((byte *)&_changedHotspot[i], (byte *)&_changedHotspot[i] + sizeof(ChangedHotspotStruct), 0);
+
+ // Set up globals that have explicit initial values
+ _bCfgInvLocked = false;
+ _bCfgInvNoScroll = false;
+ _bCfgTimerizedText = true;
+ _bCfgInvUp = false;
+ _bCfgAnni30 = false;
+ _bCfgAntiAlias = false;
+ _bCfgTransparence = true;
+ _bCfgInterTips = true;
+ _bShowSubtitles = true;
+ _nCfgTonySpeed = 3;
+ _nCfgTextSpeed = 5;
+ _bCfgDubbing = true;
+ _bCfgMusic = true;
+ _bCfgSFX = true;
+ _nCfgDubbingVolume = 10;
+ _nCfgMusicVolume = 7;
+ _nCfgSFXVolume = 10;
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/globals.h b/engines/tony/globals.h
new file mode 100644
index 0000000000..d8d8d3eba5
--- /dev/null
+++ b/engines/tony/globals.h
@@ -0,0 +1,286 @@
+/* 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 TONY_GLOBALS
+#define TONY_GLOBALS
+
+#include "common/savefile.h"
+#include "tony/gfxengine.h"
+#include "tony/input.h"
+#include "tony/inventory.h"
+#include "tony/loc.h"
+#include "tony/tonychar.h"
+#include "tony/mpal/mpal.h"
+#include "tony/mpal/mpaldll.h"
+
+namespace Tony {
+
+#define AMBIANCE_CRICKETS 1
+#define AMBIANCE_CRICKETSMUFFLED 2
+#define AMBIANCE_CRICKETSWIND 3
+#define AMBIANCE_CRICKETSWIND1 4
+#define AMBIANCE_WIND 5
+#define AMBIANCE_SEA 6
+#define AMBIANCE_SEAHALFVOLUME 7
+
+struct CharacterStruct {
+ uint32 _code;
+ RMItem *_item;
+ byte _r, _g, _b;
+ int _talkPattern;
+ int _standPattern;
+ int _startTalkPattern, _endTalkPattern;
+ int _numTexts;
+
+ void save(Common::OutSaveFile *f) {
+ f->writeUint32LE(_code);
+ f->writeUint32LE(0);
+ f->writeByte(_r);
+ f->writeByte(_g);
+ f->writeByte(_b);
+ f->writeUint32LE(_talkPattern);
+ f->writeUint32LE(_standPattern);
+ f->writeUint32LE(_startTalkPattern);
+ f->writeUint32LE(_endTalkPattern);
+ f->writeUint32LE(_numTexts);
+ }
+ void load(Common::InSaveFile *f) {
+ _code = f->readUint32LE();
+ f->readUint32LE();
+ _item = NULL;
+ _r = f->readByte();
+ _g = f->readByte();
+ _b = f->readByte();
+ _talkPattern = f->readUint32LE();
+ _standPattern = f->readUint32LE();
+ _startTalkPattern = f->readUint32LE();
+ _endTalkPattern = f->readUint32LE();
+ _numTexts = f->readUint32LE();
+ }
+};
+
+struct MCharacterStruct {
+ uint32 _code;
+ RMItem *_item;
+ byte _r, _g, _b;
+ int _x, _y;
+ int _numTalks[10];
+ int _curGroup;
+ int _numTexts;
+ bool _bInTexts;
+ int _curTalk;
+ bool _bAlwaysBack;
+
+ void save(Common::OutSaveFile *f) {
+ f->writeUint32LE(_code);
+ f->writeUint32LE(0);
+ f->writeByte(_r);
+ f->writeByte(_g);
+ f->writeByte(_b);
+ f->writeUint32LE(_x);
+ f->writeUint32LE(_y);
+ for (int i = 0; i < 10; ++i)
+ f->writeUint32LE(_numTalks[i]);
+ f->writeUint32LE(_curGroup);
+ f->writeUint32LE(_numTexts);
+ f->writeByte(_bInTexts);
+ f->writeUint32LE(_curTalk);
+ f->writeByte(_bAlwaysBack);
+ }
+ void load(Common::InSaveFile *f) {
+ _code = f->readUint32LE();
+ f->readUint32LE();
+ _item = NULL;
+ _r = f->readByte();
+ _g = f->readByte();
+ _b = f->readByte();
+ _x = f->readUint32LE();
+ _y = f->readUint32LE();
+ for (int i = 0; i < 10; ++i)
+ _numTalks[i] = f->readUint32LE();
+ _curGroup = f->readUint32LE();
+ _numTexts = f->readUint32LE();
+ _bInTexts = f->readByte();
+ _curTalk = f->readUint32LE();
+ _bAlwaysBack = f->readByte();
+ }
+};
+
+struct ChangedHotspotStruct {
+ uint32 _dwCode;
+ uint32 _nX, _nY;
+
+ void save(Common::OutSaveFile *f) {
+ f->writeUint32LE(_dwCode);
+ f->writeUint32LE(_nX);
+ f->writeUint32LE(_nY);
+ }
+ void load(Common::InSaveFile *f) {
+ _dwCode = f->readUint32LE();
+ _nX = f->readUint32LE();
+ _nY = f->readUint32LE();
+ }
+};
+
+
+/**
+ * Description of a call to a custom function.
+ */
+typedef struct {
+ int _nCf;
+ int _arg1, _arg2, _arg3, _arg4;
+} CfCall;
+
+typedef CfCall *LpCfCall;
+
+struct CoroutineMutex {
+ CoroutineMutex() : _eventId(0), _ownerPid(0), _lockCount(0) { }
+
+ uint32 _eventId;
+ uint32 _ownerPid;
+ uint32 _lockCount;
+};
+
+/****************************************************************************\
+* Global variables
+\****************************************************************************/
+
+/**
+ * Globals class
+ */
+class Globals {
+public:
+ Globals();
+
+ Common::String _nextMusic;
+ bool _nextLoop;
+ int _nextChannel;
+ int _nextSync;
+ int _curChannel;
+ int _flipflop;
+ CharacterStruct _character[16];
+ MCharacterStruct _mCharacter[10];
+ ChangedHotspotStruct _changedHotspot[256];
+ bool _isMChar[16];
+ bool _bAlwaysDisplay;
+ RMPoint _saveTonyPos;
+ int _saveTonyLoc;
+ RMTextDialog *_curBackText;
+ bool _bTonyIsSpeaking;
+ int _curChangedHotspot;
+ bool _bCfgInvLocked;
+ bool _bCfgInvNoScroll;
+ bool _bCfgTimerizedText;
+ bool _bCfgInvUp;
+ bool _bCfgAnni30;
+ bool _bCfgAntiAlias;
+ bool _bShowSubtitles;
+ bool _bCfgTransparence;
+ bool _bCfgInterTips;
+ bool _bCfgDubbing;
+ bool _bCfgMusic;
+ bool _bCfgSFX;
+ int _nCfgTonySpeed;
+ int _nCfgTextSpeed;
+ int _nCfgDubbingVolume;
+ int _nCfgMusicVolume;
+ int _nCfgSFXVolume;
+ bool _bSkipSfxNoLoop;
+ bool _bIdleExited;
+ bool _bNoBullsEye;
+ int _curDialog;
+ int _curSoundEffect;
+ bool _bFadeOutStop;
+
+ RMTony *_tony;
+ RMPointer *_pointer;
+ RMGameBoxes *_boxes;
+ RMLocation *_loc;
+ RMInventory *_inventory;
+ RMInput *_input;
+ RMGfxEngine *_gfxEngine;
+
+ void (*EnableGUI)();
+ void (*DisableGUI)();
+
+ uint32 _dwTonyNumTexts;
+ bool _bTonyInTexts;
+ bool _bStaticTalk;
+ RMTony::CharacterTalkType _nTonyNextTalkType;
+
+ RMPoint _startLocPos[256];
+ CoroutineMutex _mut[10];
+
+ bool _bSkipIdle;
+ uint32 _hSkipIdle;
+
+ int _lastMusic, _lastTappeto;
+
+ int _ambiance[200];
+ RMPoint _fullScreenMessagePt;
+ int _fullScreenMessageLoc;
+
+ /**
+ * @defgroup MPAL variables
+ */
+ uint32 _mpalError;
+ LPITEMIRQFUNCTION _lpiifCustom;
+ LPLPCUSTOMFUNCTION _lplpFunctions;
+ Common::String *_lplpFunctionStrings;
+ uint16 _nObjs;
+ uint16 _nVars;
+ MpalHandle _hVars;
+ LpMpalVar _lpmvVars;
+ uint16 _nMsgs;
+ MpalHandle _hMsgs;
+ LpMpalMsg _lpmmMsgs;
+ uint16 _nDialogs;
+ MpalHandle _hDialogs;
+ LpMpalDialog _lpmdDialogs;
+ uint16 _nItems;
+ MpalHandle _hItems;
+ LpMpalItem _lpmiItems;
+ uint16 _nLocations;
+ MpalHandle _hLocations;
+ LpMpalLocation _lpmlLocations;
+ uint16 _nScripts;
+ MpalHandle _hScripts;
+ LpMpalScript _lpmsScripts;
+ Common::File _hMpr;
+ uint16 _nResources;
+ uint32 *_lpResources;
+ bool _bExecutingAction;
+ bool _bExecutingDialog;
+ uint32 _nPollingLocations[MAXPOLLINGLOCATIONS];
+ uint32 _hEndPollingLocations[MAXPOLLINGLOCATIONS];
+ uint32 _pollingThreads[MAXPOLLINGLOCATIONS];
+ uint32 _hAskChoice;
+ uint32 _hDoneChoice;
+ uint32 _nExecutingAction;
+ uint32 _nExecutingDialog;
+ uint32 _nExecutingChoice;
+ uint32 _nSelectedChoice;
+};
+
+} // End of namespace Tony
+
+#endif // TONY_GLOBALS
diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp
new file mode 100644
index 0000000000..b96ccaf842
--- /dev/null
+++ b/engines/tony/input.cpp
@@ -0,0 +1,157 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "tony/gfxengine.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+RMInput::RMInput() {
+ // Setup mouse fields
+ _clampMouse = false;
+ _mousePos.set(0, 0);
+ _leftButton = _rightButton = false;
+ _leftClickMouse = _leftReleaseMouse = false;
+ _rightClickMouse = _rightReleaseMouse = false;
+
+ Common::fill((byte *)&_event, (byte *)&_event + sizeof(Common::Event), 0);
+
+ // Setup keyboard fields
+ Common::fill(&_keyDown[0], &_keyDown[350], 0);
+}
+
+RMInput::~RMInput() {
+}
+
+void RMInput::poll() {
+ _leftClickMouse = _leftReleaseMouse = _rightClickMouse = _rightReleaseMouse = false;
+
+ // Get pending events
+ while (g_system->getEventManager()->pollEvent(_event) && !g_vm->shouldQuit()) {
+ switch (_event.type) {
+ case Common::EVENT_MOUSEMOVE:
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ case Common::EVENT_RBUTTONUP:
+ _mousePos.set(_event.mouse.x, _event.mouse.y);
+
+ if (_event.type == Common::EVENT_LBUTTONDOWN) {
+ _leftButton = true;
+ _leftClickMouse = true;
+ } else if (_event.type == Common::EVENT_LBUTTONUP) {
+ _leftButton = false;
+ _leftReleaseMouse = true;
+ } else if (_event.type == Common::EVENT_RBUTTONDOWN) {
+ _rightButton = true;
+ _rightClickMouse = true;
+ } else if (_event.type == Common::EVENT_RBUTTONUP) {
+ _rightButton = false;
+ _rightReleaseMouse = true;
+ } else
+ continue;
+
+ // Since a mouse button has changed, don't do any further event processing this frame
+ return;
+
+ case Common::EVENT_KEYDOWN:
+ // Check for debugger
+ if ((_event.kbd.keycode == Common::KEYCODE_d) && (_event.kbd.flags & Common::KBD_CTRL)) {
+ // Attach to the debugger
+ g_vm->_debugger->attach();
+ g_vm->_debugger->onFrame();
+ } else {
+ // Flag the given key as being down
+ _keyDown[(int)_event.kbd.keycode] = true;
+ }
+ return;
+
+ case Common::EVENT_KEYUP:
+ _keyDown[(int)_event.kbd.keycode] = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+bool RMInput::mouseLeft() {
+ return _leftButton;
+}
+
+bool RMInput::mouseRight() {
+ return _rightButton;
+}
+
+/**
+ * Return true if a key has been pressed
+ */
+bool RMInput::getAsyncKeyState(Common::KeyCode kc) {
+ // The act of testing for a particular key automatically clears the state, to prevent
+ // the same key being registered in multiple different frames
+ bool result = _keyDown[(int)kc];
+ _keyDown[(int)kc] = false;
+ return result;
+}
+
+/**
+ * Reading of the mouse
+ */
+RMPoint RMInput::mousePos() {
+ return _mousePos;
+}
+
+/**
+ * Events of mouse clicks
+ */
+bool RMInput::mouseLeftClicked() {
+ return _leftClickMouse;
+}
+
+bool RMInput::mouseRightClicked() {
+ return _rightClickMouse;
+}
+
+bool RMInput::mouseBothClicked() {
+ return _leftClickMouse && _rightClickMouse;
+}
+
+bool RMInput::mouseLeftReleased() {
+ return _leftReleaseMouse;
+}
+
+bool RMInput::mouseRightReleased() {
+ return _rightReleaseMouse;
+}
+
+bool RMInput::mouseBothReleased() {
+ return _leftReleaseMouse && _rightReleaseMouse;
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/input.h b/engines/tony/input.h
new file mode 100644
index 0000000000..d07eaefe34
--- /dev/null
+++ b/engines/tony/input.h
@@ -0,0 +1,88 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_INPUT_H
+#define TONY_INPUT_H
+
+#include "common/events.h"
+#include "tony/utils.h"
+
+namespace Tony {
+
+class RMInput {
+private:
+ Common::Event _event;
+
+ // Mouse related fields
+ RMPoint _mousePos;
+ bool _clampMouse;
+ bool _leftButton, _rightButton;
+ bool _leftClickMouse, _leftReleaseMouse, _rightClickMouse, _rightReleaseMouse;
+
+ // Keyboard related fields
+ bool _keyDown[350];
+
+public:
+ RMInput();
+ ~RMInput();
+
+ /**
+ * Polling (must be performed once per frame)
+ */
+ void poll();
+
+ /**
+ * Reading of the mouse
+ */
+ RMPoint mousePos();
+
+ /**
+ * Current status of the mouse buttons
+ */
+ bool mouseLeft();
+ bool mouseRight();
+
+ /**
+ * Events of mouse clicks
+ */
+ bool mouseLeftClicked();
+ bool mouseRightClicked();
+ bool mouseBothClicked();
+ bool mouseLeftReleased();
+ bool mouseRightReleased();
+ bool mouseBothReleased();
+
+ /**
+ * Returns true if the given key is pressed
+ */
+ bool getAsyncKeyState(Common::KeyCode kc);
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
new file mode 100644
index 0000000000..12540e5b7f
--- /dev/null
+++ b/engines/tony/inventory.cpp
@@ -0,0 +1,938 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/textconsole.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/inventory.h"
+#include "tony/game.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+
+/****************************************************************************\
+* RMInventory Methods
+\****************************************************************************/
+
+RMInventory::RMInventory() {
+ _items = NULL;
+ _state = CLOSED;
+ _bCombining = false;
+ _csModifyInterface = g_system->createMutex();
+ _nItems = 0;
+
+ Common::fill(_inv, _inv + 256, 0);
+ _nInv = 0;
+ _curPutY = 0;
+ _curPutTime = 0;
+ _curPos = 0;
+ _bHasFocus = false;
+ _nSelectObj = 0;
+ _nCombine = 0;
+ _bBlinkingRight = false;
+ _bBlinkingLeft = false;
+ _miniAction = 0;
+}
+
+RMInventory::~RMInventory() {
+ close();
+ g_system->deleteMutex(_csModifyInterface);
+}
+
+bool RMInventory::checkPointInside(const RMPoint &pt) {
+ if (!GLOBALS._bCfgInvUp)
+ return pt._y > RM_SY - 70;
+ else
+ return pt._y < 70;
+}
+
+
+void RMInventory::init() {
+ // Create the main buffer
+ create(RM_SX, 68);
+ setPriority(185);
+
+ // Setup the inventory
+ _nInv = 0;
+ _curPos = 0;
+ _bCombining = false;
+
+ // New items
+ _nItems = 78; // @@@ Number of takeable items
+ _items = new RMInventoryItem[_nItems + 1];
+
+ int curres = 10500;
+
+ // Loop through the items
+ for (int i = 0; i <= _nItems; i++) {
+ // Load the items from the resource
+ RMRes res(curres);
+ assert(res.isValid());
+ Common::SeekableReadStream *ds = res.getReadStream();
+
+ // Initialize the MPAL inventory item by reading it in.
+ _items[i]._icon.setInitCurPattern(false);
+ _items[i]._icon.readFromStream(*ds);
+ delete ds;
+
+ // Puts in the default pattern 1
+ _items[i]._pointer = NULL;
+ _items[i]._status = 1;
+ _items[i]._icon.setPattern(1);
+ _items[i]._icon.doFrame(this, false);
+
+ curres++;
+ if (i == 0 || i == 28 || i == 29)
+ continue;
+
+ _items[i]._pointer = new RMGfxSourceBuffer8RLEByteAA[_items[i]._icon.numPattern()];
+
+ for (int j = 0; j < _items[i]._icon.numPattern(); j++) {
+ RMResRaw raw(curres);
+
+ assert(raw.isValid());
+
+ _items[i]._pointer[j].init((const byte *)raw, raw.width(), raw.height(), true);
+ curres++;
+ }
+ }
+
+ _items[28]._icon.setPattern(1);
+ _items[29]._icon.setPattern(1);
+
+ // Download interface
+ RMRes res(RES_I_MINIINTER);
+ assert(res.isValid());
+ Common::SeekableReadStream *ds = res.getReadStream();
+ _miniInterface.readFromStream(*ds);
+ _miniInterface.setPattern(1);
+ delete ds;
+
+ // Create the text for hints on the mini interface
+ _hints[0].setAlignType(RMText::HCENTER, RMText::VTOP);
+ _hints[1].setAlignType(RMText::HCENTER, RMText::VTOP);
+ _hints[2].setAlignType(RMText::HCENTER, RMText::VTOP);
+
+ // The text is taken from MPAL for translation
+ RMMessage msg1(15);
+ RMMessage msg2(13);
+ RMMessage msg3(14);
+
+ _hints[0].writeText(msg1[0], 1); // Examine
+ _hints[1].writeText(msg2[0], 1); // Take
+ _hints[2].writeText(msg3[0], 1); // Use
+
+
+ // Prepare initial inventory
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+}
+
+void RMInventory::close() {
+ // Has memory
+ if (_items != NULL) {
+ // Delete the item pointers
+ for (int i = 0; i <= _nItems; i++)
+ delete[] _items[i]._pointer;
+
+ // Delete the items array
+ delete[] _items;
+ _items = NULL;
+ }
+
+ destroy();
+}
+
+void RMInventory::reset() {
+ _state = CLOSED;
+ endCombine();
+}
+
+void RMInventory::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ RMPoint pos;
+ RMPoint pos2;
+ RMGfxPrimitive *p;
+ RMGfxPrimitive *p2;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ prim->setDst(RMPoint(0, _curPutY));
+ g_system->lockMutex(_csModifyInterface);
+ CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim);
+ g_system->unlockMutex(_csModifyInterface);
+
+ if (_state == SELECTING) {
+
+ if (!GLOBALS._bCfgInvUp) {
+ _ctx->pos.set((_nSelectObj + 1) * 64 - 20, RM_SY - 113);
+ _ctx->pos2.set((_nSelectObj + 1) * 64 + 34, RM_SY - 150);
+ } else {
+ _ctx->pos.set((_nSelectObj + 1) * 64 - 20, 72 - 4); // The brown part is at the top :(
+ _ctx->pos2.set((_nSelectObj + 1) * 64 + 34, 119 - 4);
+ }
+
+ _ctx->p = new RMGfxPrimitive(prim->_task, _ctx->pos);
+ _ctx->p2 = new RMGfxPrimitive(prim->_task, _ctx->pos2);
+
+ // Draw the mini interface
+ CORO_INVOKE_2(_miniInterface.draw, bigBuf, _ctx->p);
+
+ if (GLOBALS._bCfgInterTips) {
+ if (_miniAction == 1) // Examine
+ CORO_INVOKE_2(_hints[0].draw, bigBuf, _ctx->p2);
+ else if (_miniAction == 2) // Talk
+ CORO_INVOKE_2(_hints[1].draw, bigBuf, _ctx->p2);
+ else if (_miniAction == 3) // Use
+ CORO_INVOKE_2(_hints[2].draw, bigBuf, _ctx->p2);
+ }
+
+ delete _ctx->p;
+ delete _ctx->p2;
+ }
+
+ CORO_END_CODE;
+}
+
+void RMInventory::removeThis(CORO_PARAM, bool &result) {
+ if (_state == CLOSED)
+ result = true;
+ else
+ result = false;
+}
+
+void RMInventory::removeItem(int code) {
+ for (int i = 0; i < _nInv; i++) {
+ if (_inv[i] == code - 10000) {
+ g_system->lockMutex(_csModifyInterface);
+
+ Common::copy(&_inv[i + 1], &_inv[i + 1] + (_nInv - i), &_inv[i]);
+ _nInv--;
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ return;
+ }
+ }
+}
+
+void RMInventory::addItem(int code) {
+ if (code <= 10000 || code >= 10101) {
+ // If we are here, it means that we are adding an item that should not be in the inventory
+ warning("RMInventory::addItem(%d) - Cannot find a valid icon for this item, and then it will not be added to the inventory", code);
+ } else {
+ g_system->lockMutex(_csModifyInterface);
+ if (_curPos + 8 == _nInv) {
+ // Break through the inventory! On the flashing pattern
+ _items[28]._icon.setPattern(2);
+ }
+
+ _inv[_nInv++] = code - 10000;
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ }
+}
+
+void RMInventory::changeItemStatus(uint32 code, uint32 dwStatus) {
+ if (code <= 10000 || code >= 10101) {
+ error("RMInventory::changeItemStatus(%d) - Specified object code is not valid", code);
+ } else {
+ g_system->lockMutex(_csModifyInterface);
+ _items[code - 10000]._icon.setPattern(dwStatus);
+ _items[code - 10000]._status = dwStatus;
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ }
+}
+
+
+void RMInventory::prepare() {
+ for (int i = 1; i < RM_SX / 64 - 1; i++) {
+ if (i - 1 + _curPos < _nInv)
+ addPrim(new RMGfxPrimitive(&_items[_inv[i - 1 + _curPos]]._icon, RMPoint(i * 64, 0)));
+ else
+ addPrim(new RMGfxPrimitive(&_items[0]._icon, RMPoint(i * 64, 0)));
+ }
+
+ // Frecce
+ addPrim(new RMGfxPrimitive(&_items[29]._icon, RMPoint(0, 0)));
+ addPrim(new RMGfxPrimitive(&_items[28]._icon, RMPoint(640 - 64, 0)));
+}
+
+bool RMInventory::miniActive() {
+ return _state == SELECTING;
+}
+
+bool RMInventory::haveFocus(const RMPoint &mpos) {
+ // When we combine, have the focus only if we are on an arrow (to scroll)
+ if (_state == OPENED && _bCombining && checkPointInside(mpos) && (mpos._x < 64 || mpos._x > RM_SX - 64))
+ return true;
+
+ // If the inventory is open, focus we we go over it
+ if (_state == OPENED && !_bCombining && checkPointInside(mpos))
+ return true;
+
+ // If we are selecting a verb (and then right down), we always focus
+ if (_state == SELECTING)
+ return true;
+
+ return false;
+}
+
+void RMInventory::endCombine() {
+ _bCombining = false;
+}
+
+bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) {
+ // The left click picks an item from your inventory to use it with the background
+ int n = mpos._x / 64;
+
+ if (_state == OPENED) {
+ if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0) {
+ _bCombining = true; //m_state = COMBINING;
+ _nCombine = _inv[n - 1 + _curPos];
+ nCombineObj = _nCombine + 10000;
+
+ g_vm->playUtilSFX(1);
+ return true;
+ }
+ }
+
+ // Click the right arrow
+ if ((_state == OPENED) && _bBlinkingRight) {
+ g_system->lockMutex(_csModifyInterface);
+ _curPos++;
+
+ if (_curPos + 8 >= _nInv) {
+ _bBlinkingRight = false;
+ _items[28]._icon.setPattern(1);
+ }
+
+ if (_curPos > 0) {
+ _bBlinkingLeft = true;
+ _items[29]._icon.setPattern(2);
+ }
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ }
+ // Click the left arrow
+ else if ((_state == OPENED) && _bBlinkingLeft) {
+ assert(_curPos > 0);
+ g_system->lockMutex(_csModifyInterface);
+ _curPos--;
+
+ if (_curPos == 0) {
+ _bBlinkingLeft = false;
+ _items[29]._icon.setPattern(1);
+ }
+
+ if (_curPos + 8 < _nInv) {
+ _bBlinkingRight = true;
+ _items[28]._icon.setPattern(2);
+ }
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ }
+
+
+ return false;
+}
+
+void RMInventory::rightClick(const RMPoint &mpos) {
+ assert(checkPointInside(mpos));
+
+ if (_state == OPENED && !_bCombining) {
+ // Open the context interface
+ int n = mpos._x / 64;
+
+ if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0) {
+ _state = SELECTING;
+ _miniAction = 0;
+ _nSelectObj = n - 1;
+
+ g_vm->playUtilSFX(0);
+ }
+ }
+
+ if ((_state == OPENED) && _bBlinkingRight) {
+ g_system->lockMutex(_csModifyInterface);
+ _curPos += 7;
+ if (_curPos + 8 > _nInv)
+ _curPos = _nInv - 8;
+
+ if (_curPos + 8 <= _nInv) {
+ _bBlinkingRight = false;
+ _items[28]._icon.setPattern(1);
+ }
+
+ if (_curPos > 0) {
+ _bBlinkingLeft = true;
+ _items[29]._icon.setPattern(2);
+ }
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ } else if ((_state == OPENED) && _bBlinkingLeft) {
+ assert(_curPos > 0);
+ g_system->lockMutex(_csModifyInterface);
+ _curPos -= 7;
+ if (_curPos < 0)
+ _curPos = 0;
+
+ if (_curPos == 0) {
+ _bBlinkingLeft = false;
+ _items[29]._icon.setPattern(1);
+ }
+
+ if (_curPos + 8 < _nInv) {
+ _bBlinkingRight = true;
+ _items[28]._icon.setPattern(2);
+ }
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+ g_system->unlockMutex(_csModifyInterface);
+ }
+}
+
+bool RMInventory::rightRelease(const RMPoint &mpos, RMTonyAction &curAction) {
+ if (_state == SELECTING) {
+ _state = OPENED;
+
+ if (_miniAction == 1) { // Examine
+ curAction = TA_EXAMINE;
+ return true;
+ } else if (_miniAction == 2) { // Talk
+ curAction = TA_TALK;
+ return true;
+ } else if (_miniAction == 3) { // Use
+ curAction = TA_USE;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+#define INVSPEED 20
+
+void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen) {
+ bool bNeedRedraw = false;
+
+ if (_state != CLOSED) {
+ // Clean up the OT list
+ g_system->lockMutex(_csModifyInterface);
+ clearOT();
+
+ // DoFrame makes all the objects currently in the inventory be displayed
+ // @@@ Maybe we should do all takeable objects? Please does not help
+ for (int i = 0; i < _nInv; i++) {
+ if (_items[_inv[i]]._icon.doFrame(this, false) && (i >= _curPos && i <= _curPos + 7))
+ bNeedRedraw = true;
+ }
+
+ if ((_state == CLOSING || _state == OPENING || _state == OPENED) && checkPointInside(mpos)) {
+ if (mpos._x > RM_SX - 64) {
+ if (_curPos + 8 < _nInv && !_bBlinkingRight) {
+ _items[28]._icon.setPattern(3);
+ _bBlinkingRight = true;
+ bNeedRedraw = true;
+ }
+ } else if (_bBlinkingRight) {
+ _items[28]._icon.setPattern(2);
+ _bBlinkingRight = false;
+ bNeedRedraw = true;
+ }
+
+ if (mpos._x < 64) {
+ if (_curPos > 0 && !_bBlinkingLeft) {
+ _items[29]._icon.setPattern(3);
+ _bBlinkingLeft = true;
+ bNeedRedraw = true;
+ }
+ } else if (_bBlinkingLeft) {
+ _items[29]._icon.setPattern(2);
+ _bBlinkingLeft = false;
+ bNeedRedraw = true;
+ }
+ }
+
+ if (_items[28]._icon.doFrame(this, false))
+ bNeedRedraw = true;
+
+ if (_items[29]._icon.doFrame(this, false))
+ bNeedRedraw = true;
+
+ if (bNeedRedraw)
+ prepare();
+
+ g_system->unlockMutex(_csModifyInterface);
+ }
+
+ if (g_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_i)) {
+ GLOBALS._bCfgInvLocked = !GLOBALS._bCfgInvLocked;
+ }
+
+ if (_bCombining) {//m_state == COMBINING)
+ ptr.setCustomPointer(&_items[_nCombine]._pointer[_items[_nCombine]._status - 1]);
+ ptr.setSpecialPointer(RMPointer::PTR_CUSTOM);
+ }
+
+ if (!GLOBALS._bCfgInvUp) {
+ if ((_state == CLOSED) && (mpos._y > RM_SY - 10 || GLOBALS._bCfgInvLocked) && bCanOpen) {
+ if (!GLOBALS._bCfgInvNoScroll) {
+ _state = OPENING;
+ _curPutY = RM_SY - 1;
+ _curPutTime = g_vm->getTime();
+ } else {
+ _state = OPENED;
+ _curPutY = RM_SY - 68;
+ }
+ } else if (_state == OPENED) {
+ if ((mpos._y < RM_SY - 70 && !GLOBALS._bCfgInvLocked) || !bCanOpen) {
+ if (!GLOBALS._bCfgInvNoScroll) {
+ _state = CLOSING;
+ _curPutY = RM_SY - 68;
+ _curPutTime = g_vm->getTime();
+ } else {
+ _state = CLOSED;
+ }
+ }
+ } else if (_state == OPENING) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
+ _curPutY -= 3;
+ _curPutTime += INVSPEED;
+ }
+
+ if (_curPutY <= RM_SY - 68) {
+ _state = OPENED;
+ _curPutY = RM_SY - 68;
+ }
+
+ } else if (_state == CLOSING) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
+ _curPutY += 3;
+ _curPutTime += INVSPEED;
+ }
+
+ if (_curPutY > 480)
+ _state = CLOSED;
+ }
+ } else {
+ if ((_state == CLOSED) && (mpos._y < 10 || GLOBALS._bCfgInvLocked) && bCanOpen) {
+ if (!GLOBALS._bCfgInvNoScroll) {
+ _state = OPENING;
+ _curPutY = - 68;
+ _curPutTime = g_vm->getTime();
+ } else {
+ _state = OPENED;
+ _curPutY = 0;
+ }
+ } else if (_state == OPENED) {
+ if ((mpos._y > 70 && !GLOBALS._bCfgInvLocked) || !bCanOpen) {
+ if (!GLOBALS._bCfgInvNoScroll) {
+ _state = CLOSING;
+ _curPutY = -2;
+ _curPutTime = g_vm->getTime();
+ } else {
+ _state = CLOSED;
+ }
+ }
+ } else if (_state == OPENING) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
+ _curPutY += 3;
+ _curPutTime += INVSPEED;
+ }
+
+ if (_curPutY >= 0) {
+ _state = OPENED;
+ _curPutY = 0;
+ }
+ } else if (_state == CLOSING) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
+ _curPutY -= 3;
+ _curPutTime += INVSPEED;
+ }
+
+ if (_curPutY < -68)
+ _state = CLOSED;
+ }
+ }
+
+ if (_state == SELECTING) {
+ int startx = (_nSelectObj + 1) * 64 - 20;
+ int starty;
+
+ if (!GLOBALS._bCfgInvUp)
+ starty = RM_SY - 109;
+ else
+ starty = 70;
+
+ // Make sure it is on one of the verbs
+ if (mpos._y > starty && mpos._y < starty + 45) {
+ if (mpos._x > startx && mpos._x < startx + 40) {
+ if (_miniAction != 1) {
+ _miniInterface.setPattern(2);
+ _miniAction = 1;
+ g_vm->playUtilSFX(1);
+ }
+ } else if (mpos._x >= startx + 40 && mpos._x < startx + 80) {
+ if (_miniAction != 2) {
+ _miniInterface.setPattern(3);
+ _miniAction = 2;
+ g_vm->playUtilSFX(1);
+ }
+ } else if (mpos._x >= startx + 80 && mpos._x < startx + 108) {
+ if (_miniAction != 3) {
+ _miniInterface.setPattern(4);
+ _miniAction = 3;
+ g_vm->playUtilSFX(1);
+ }
+ } else {
+ _miniInterface.setPattern(1);
+ _miniAction = 0;
+ }
+ } else {
+ _miniInterface.setPattern(1);
+ _miniAction = 0;
+ }
+
+ // Update the mini-interface
+ _miniInterface.doFrame(&bigBuf, false);
+ }
+
+ if ((_state != CLOSED) && !_nInList) {
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+ }
+}
+
+bool RMInventory::itemInFocus(const RMPoint &mpt) {
+ if ((_state == OPENED || _state == OPENING) && checkPointInside(mpt))
+ return true;
+ else
+ return false;
+}
+
+RMItem *RMInventory::whichItemIsIn(const RMPoint &mpt) {
+ if (_state == OPENED) {
+ if (checkPointInside(mpt)) {
+ int n = mpt._x / 64;
+ if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0 && (!_bCombining || _inv[n - 1 + _curPos] != _nCombine))
+ return &_items[_inv[n - 1 + _curPos]]._icon;
+ }
+ }
+
+ return NULL;
+}
+
+int RMInventory::getSaveStateSize() {
+ // m_inv pattern m_nInv
+ return 256 * 4 + 256 * 4 + 4;
+}
+
+void RMInventory::saveState(byte *state) {
+ WRITE_LE_UINT32(state, _nInv);
+ state += 4;
+ Common::copy(_inv, _inv + 256, (uint32 *)state);
+ state += 256 * 4;
+
+ int x;
+ for (int i = 0; i < 256; i++) {
+ if (i < _nItems)
+ x = _items[i]._status;
+ else
+ x = 0;
+
+ WRITE_LE_UINT32(state, x);
+ state += 4;
+ }
+}
+
+int RMInventory::loadState(byte *state) {
+ _nInv = READ_LE_UINT32(state);
+ state += 4;
+ Common::copy((uint32 *)state, (uint32 *)state + 256, _inv);
+ state += 256 * 4;
+
+ int x;
+ for (int i = 0; i < 256; i++) {
+ x = READ_LE_UINT32(state);
+ state += 4;
+
+ if (i < _nItems) {
+ _items[i]._status = x;
+ _items[i]._icon.setPattern(x);
+ }
+ }
+
+ _curPos = 0;
+ _bCombining = false;
+
+ _items[29]._icon.setPattern(1);
+
+ if (_nInv > 8)
+ _items[28]._icon.setPattern(2);
+ else
+ _items[28]._icon.setPattern(1);
+
+ prepare();
+ drawOT(Common::nullContext);
+ clearOT();
+
+ return getSaveStateSize();
+}
+
+RMInventory &RMInventory::operator+=(RMItem *item) {
+ addItem(item->mpalCode());
+ return *this;
+}
+
+RMInventory &RMInventory::operator+=(RMItem &item) {
+ addItem(item.mpalCode());
+ return *this;
+}
+
+RMInventory &RMInventory::operator+=(int code) {
+ addItem(code);
+ return *this;
+}
+
+/****************************************************************************\
+* RMInterface methods
+\****************************************************************************/
+
+RMInterface::RMInterface() : RMGfxSourceBuffer8RLEByte() {
+ _bActive = _bPerorate = false;
+ _lastHotZone = -1;
+}
+
+RMInterface::~RMInterface() {
+}
+
+bool RMInterface::active() {
+ return _bActive;
+}
+
+int RMInterface::onWhichBox(RMPoint pt) {
+ pt -= _openStart;
+
+ // Check how many verbs you have to consider
+ int max = 4;
+ if (_bPerorate)
+ max = 5;
+
+ // Find the verb
+ for (int i = 0; i < max; i++) {
+ if (_hotbbox[i].ptInRect(pt))
+ return i;
+ }
+
+ // Found no verb
+ return -1;
+}
+
+void RMInterface::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ int h;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ prim->getDst().topLeft() = _openStart;
+ CORO_INVOKE_2(RMGfxSourceBuffer8RLEByte::draw, bigBuf, prim);
+
+ // Check if there is a draw hot zone
+ _ctx->h = onWhichBox(_mpos);
+ if (_ctx->h != -1) {
+ prim->getDst().topLeft() = _openStart;
+ CORO_INVOKE_2(_hotzone[_ctx->h].draw, bigBuf, prim);
+
+ if (_lastHotZone != _ctx->h) {
+ _lastHotZone = _ctx->h;
+ g_vm->playUtilSFX(1);
+ }
+
+ if (GLOBALS._bCfgInterTips) {
+ prim->getDst().topLeft() = _openStart + RMPoint(70, 177);
+ CORO_INVOKE_2(_hints[_ctx->h].draw, bigBuf, prim);
+ }
+ } else
+ _lastHotZone = -1;
+
+ CORO_END_CODE;
+}
+
+void RMInterface::doFrame(RMGfxTargetBuffer &bigBuf, RMPoint mousepos) {
+ // If needed, add to the OT schedule list
+ if (!_nInList && _bActive)
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+
+ _mpos = mousepos;
+}
+
+void RMInterface::clicked(const RMPoint &mousepos) {
+ _bActive = true;
+ _openPos = mousepos;
+
+ // Calculate the top left corner of the interface
+ _openStart = _openPos - RMPoint(_dimx / 2, _dimy / 2);
+ _lastHotZone = -1;
+
+ // Keep it inside the screen
+ if (_openStart._x < 0)
+ _openStart._x = 0;
+ if (_openStart._y < 0)
+ _openStart._y = 0;
+ if (_openStart._x + _dimx > RM_SX)
+ _openStart._x = RM_SX - _dimx;
+ if (_openStart._y + _dimy > RM_SY)
+ _openStart._y = RM_SY - _dimy;
+
+ // Play the sound effect
+ g_vm->playUtilSFX(0);
+}
+
+bool RMInterface::released(const RMPoint &mousepos, RMTonyAction &action) {
+ if (!_bActive)
+ return false;
+
+ _bActive = false;
+
+ switch (onWhichBox(mousepos)) {
+ case 0:
+ action = TA_TAKE;
+ break;
+
+ case 1:
+ action = TA_TALK;
+ break;
+
+ case 2:
+ action = TA_USE;
+ break;
+
+ case 3:
+ action = TA_EXAMINE;
+ break;
+
+ case 4:
+ action = TA_PERORATE;
+ break;
+
+ default: // No verb
+ return false;
+ }
+
+ return true;
+}
+
+void RMInterface::reset() {
+ _bActive = false;
+}
+
+void RMInterface::setPerorate(bool bOn) {
+ _bPerorate = bOn;
+}
+
+bool RMInterface::getPerorate() {
+ return _bPerorate;
+}
+
+void RMInterface::init() {
+ RMResRaw inter(RES_I_INTERFACE);
+ RMRes pal(RES_I_INTERPPAL);
+
+ setPriority(191);
+
+ RMGfxSourceBuffer::init(inter, inter.width(), inter.height());
+ loadPaletteWA(RES_I_INTERPAL);
+
+ for (int i = 0; i < 5; i++) {
+ RMResRaw part(RES_I_INTERP1 + i);
+
+ _hotzone[i].init(part, part.width(), part.height());
+ _hotzone[i].loadPaletteWA(pal);
+ }
+
+ _hotbbox[0].setRect(126, 123, 159, 208); // Take
+ _hotbbox[1].setRect(90, 130, 125, 186); // About
+ _hotbbox[2].setRect(110, 60, 152, 125);
+ _hotbbox[3].setRect(56, 51, 93, 99);
+ _hotbbox[4].setRect(51, 105, 82, 172);
+
+ _hints[0].setAlignType(RMText::HRIGHT, RMText::VTOP);
+ _hints[1].setAlignType(RMText::HRIGHT, RMText::VTOP);
+ _hints[2].setAlignType(RMText::HRIGHT, RMText::VTOP);
+ _hints[3].setAlignType(RMText::HRIGHT, RMText::VTOP);
+ _hints[4].setAlignType(RMText::HRIGHT, RMText::VTOP);
+
+ // The text is taken from MPAL for translation
+ RMMessage msg0(12);
+ RMMessage msg1(13);
+ RMMessage msg2(14);
+ RMMessage msg3(15);
+ RMMessage msg4(16);
+
+ _hints[0].writeText(msg0[0], 1); // Take
+ _hints[1].writeText(msg1[0], 1); // Talk
+ _hints[2].writeText(msg2[0], 1); // Use
+ _hints[3].writeText(msg3[0], 1); // Examine
+ _hints[4].writeText(msg4[0], 1); // Show Yourself
+
+ _bActive = false;
+ _bPerorate = false;
+ _lastHotZone = 0;
+}
+
+void RMInterface::close() {
+ destroy();
+
+ for (int i = 0; i < 5; i++)
+ _hotzone[i].destroy();
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/inventory.h b/engines/tony/inventory.h
new file mode 100644
index 0000000000..ce94c86c1b
--- /dev/null
+++ b/engines/tony/inventory.h
@@ -0,0 +1,241 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_INVENTORY_H
+#define TONY_INVENTORY_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "tony/font.h"
+#include "tony/game.h"
+#include "tony/gfxcore.h"
+#include "tony/loc.h"
+
+namespace Tony {
+
+struct RMInventoryItem {
+ RMItem _icon;
+ RMGfxSourceBuffer8RLEByteAA *_pointer;
+ int _status;
+};
+
+class RMInventory : public RMGfxWoodyBuffer {
+private:
+ enum InventoryState {
+ CLOSED,
+ OPENING,
+ OPENED,
+ CLOSING,
+ SELECTING
+ };
+
+protected:
+ int _nItems;
+ RMInventoryItem *_items;
+
+ int _inv[256];
+ int _nInv;
+ int _curPutY;
+ uint32 _curPutTime;
+
+ int _curPos;
+ InventoryState _state;
+ bool _bHasFocus;
+ int _nSelectObj;
+ int _nCombine;
+ bool _bCombining;
+
+ bool _bBlinkingRight, _bBlinkingLeft;
+
+ int _miniAction;
+ RMItem _miniInterface;
+ RMText _hints[3];
+
+ OSystem::MutexRef _csModifyInterface;
+
+protected:
+ /**
+ * Prepare the image inventory. It should be recalled whenever the inventory changes
+ */
+ void prepare();
+
+ /**
+ * Check if the mouse Y position is conrrect, even under the inventory portion of the screen
+ */
+ bool checkPointInside(const RMPoint &pt);
+
+public:
+ RMInventory();
+ virtual ~RMInventory();
+
+ /**
+ * Prepare a frame
+ */
+ void doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen);
+
+ /**
+ * Initialization and closing
+ */
+ void init();
+ void close();
+ void reset();
+
+ /**
+ * Overload test for removal from OT list
+ */
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ /**
+ * Overload the drawing of the inventory
+ */
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ /**
+ * Method for determining whether the inventory currently has the focus
+ */
+ bool haveFocus(const RMPoint &mpos);
+
+ /**
+ * Method for determining if the mini interface is active
+ */
+ bool miniActive();
+
+ /**
+ * Handle the left mouse click (only when the inventory has the focus)
+ */
+ bool leftClick(const RMPoint &mpos, int &nCombineObj);
+
+ /**
+ * Handle the right mouse button (only when the inventory has the focus)
+ */
+ void rightClick(const RMPoint &mpos);
+ bool rightRelease(const RMPoint &mpos, RMTonyAction &curAction);
+
+ /**
+ * Warn that an item combine is over
+ */
+ void endCombine();
+
+public:
+ /**
+ * Add an item to the inventory
+ */
+ void addItem(int code);
+ RMInventory &operator+=(RMItem *item);
+ RMInventory &operator+=(RMItem &item);
+ RMInventory &operator+=(int code);
+
+ /**
+ * Removes an item
+ */
+ void removeItem(int code);
+
+ /**
+ * We are on an object?
+ */
+ RMItem *whichItemIsIn(const RMPoint &mpt);
+ bool itemInFocus(const RMPoint &mpt);
+
+ /**
+ * Change the icon of an item
+ */
+ void changeItemStatus(uint32 dwCode, uint32 dwStatus);
+
+ /**
+ * Save methods
+ */
+ int getSaveStateSize();
+ void saveState(byte *state);
+ int loadState(byte *state);
+};
+
+
+class RMInterface : public RMGfxSourceBuffer8RLEByte {
+private:
+ bool _bActive;
+ RMPoint _mpos;
+ RMPoint _openPos;
+ RMPoint _openStart;
+ RMText _hints[5];
+ RMGfxSourceBuffer8RLEByte _hotzone[5];
+ RMRect _hotbbox[5];
+ bool _bPerorate;
+ int _lastHotZone;
+
+protected:
+ /**
+ * Return which box a given point is in
+ */
+ int onWhichBox(RMPoint pt);
+
+public:
+ RMInterface();
+ virtual ~RMInterface();
+
+ /**
+ * The usual DoFrame (poll the graphics engine)
+ */
+ void doFrame(RMGfxTargetBuffer &bigBuf, RMPoint mousepos);
+
+ /**
+ * TRUE if it is active (you can select items)
+ */
+ bool active();
+
+ /**
+ * Initialization
+ */
+ void init();
+ void close();
+
+ /**
+ * Reset the interface
+ */
+ void reset();
+
+ /**
+ * Warns of mouse clicks and releases
+ */
+ void clicked(const RMPoint &mousepos);
+ bool released(const RMPoint &mousepos, RMTonyAction &action);
+
+ /**
+ * Enables or disables the fifth verb
+ */
+ void setPerorate(bool bOn);
+ bool getPerorate();
+
+ /**
+ * Overloaded Draw
+ */
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp
new file mode 100644
index 0000000000..18470aa6fc
--- /dev/null
+++ b/engines/tony/loc.cpp
@@ -0,0 +1,2280 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/memstream.h"
+#include "common/scummsys.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/game.h"
+#include "tony/loc.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+using namespace ::Tony::MPAL;
+
+
+/****************************************************************************\
+* RMPalette Methods
+\****************************************************************************/
+
+void RMPalette::readFromStream(Common::ReadStream &ds) {
+ ds.read(_data, 1024);
+}
+
+/****************************************************************************\
+* RMSlot Methods
+\****************************************************************************/
+
+void RMPattern::RMSlot::readFromStream(Common::ReadStream &ds, bool bLOX) {
+ // Type
+ byte type = ds.readByte();
+ _type = (RMPattern::RMSlotType)type;
+
+ // Data
+ _data = ds.readSint32LE();
+
+ // Position
+ _pos.readFromStream(ds);
+
+ // Generic flag
+ _flag = ds.readByte();
+}
+
+
+/****************************************************************************\
+* RMPattern Methods
+\****************************************************************************/
+
+void RMPattern::readFromStream(Common::ReadStream &ds, bool bLOX) {
+ // Pattern name
+ if (!bLOX)
+ _name = readString(ds);
+
+ // Velocity
+ _speed = ds.readSint32LE();
+
+ // Position
+ _pos.readFromStream(ds);
+
+ // Flag for pattern looping
+ _bLoop = ds.readSint32LE();
+
+ // Number of slots
+ _nSlots = ds.readSint32LE();
+
+ // Create and read the slots
+ _slots = new RMSlot[_nSlots];
+
+ for (int i = 0; i < _nSlots && !ds.err(); i++) {
+ if (bLOX)
+ _slots[i].readFromStream(ds, true);
+ else
+ _slots[i].readFromStream(ds, false);
+ }
+}
+
+void RMPattern::updateCoord() {
+ _curPos = _pos + _slots[_nCurSlot].pos();
+}
+
+void RMPattern::stopSfx(RMSfx *sfx) {
+ for (int i = 0; i < _nSlots; i++) {
+ if (_slots[i]._type == SOUND) {
+ if (!sfx[_slots[i]._data]._name.empty() && sfx[_slots[i]._data]._name[0] == '_')
+ sfx[_slots[i]._data].stop();
+ else if (GLOBALS._bSkipSfxNoLoop)
+ sfx[_slots[i]._data].stop();
+ }
+ }
+}
+
+int RMPattern::init(RMSfx *sfx, bool bPlayP0, byte *bFlag) {
+ // Read the current time
+ _nStartTime = g_vm->getTime();
+ _nCurSlot = 0;
+
+ // Find the first frame of the pattern
+ int i = 0;
+ while (_slots[i]._type != SPRITE) {
+ assert(i + 1 < _nSlots);
+ i++;
+ }
+
+ _nCurSlot = i;
+ _nCurSprite = _slots[i]._data;
+ if (bFlag)
+ *bFlag = _slots[i]._flag;
+
+ // Calculate the current coordinates
+ updateCoord();
+
+ // Check for sound:
+ // If the slot is 0, play
+ // If speed == 0, must play unless it goes into loop '_', or if specified by the parameter
+ // If speed != 0, play only the loop
+ for (i = 0; i < _nSlots; i++) {
+ if (_slots[i]._type == SOUND) {
+ if (i == 0) {
+ if (!sfx[_slots[i]._data]._name.empty() && sfx[_slots[i]._data]._name[0] == '_') {
+ sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
+ sfx[_slots[i]._data].play(true);
+ } else {
+ sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
+ sfx[_slots[i]._data].play();
+ }
+ } else if (_speed == 0) {
+ if (bPlayP0) {
+ sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
+ sfx[_slots[i]._data].play();
+ } else if (!sfx[_slots[i]._data]._name.empty() && sfx[_slots[i]._data]._name[0] == '_') {
+ sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
+ sfx[_slots[i]._data].play(true);
+ }
+ } else {
+ if (_bLoop && !sfx[_slots[i]._data]._name.empty() && sfx[_slots[i]._data]._name[0] == '_') {
+ sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
+ sfx[_slots[i]._data].play(true);
+ }
+ }
+ }
+ }
+
+ return _nCurSprite;
+}
+
+int RMPattern::update(uint32 hEndPattern, byte &bFlag, RMSfx *sfx) {
+ int CurTime = g_vm->getTime();
+
+ // If the speed is 0, then the pattern never advances
+ if (_speed == 0) {
+ CoroScheduler.pulseEvent(hEndPattern);
+ bFlag = _slots[_nCurSlot]._flag;
+ return _nCurSprite;
+ }
+
+ // Is it time to change the slots?
+ while (_nStartTime + _speed <= (uint32)CurTime) {
+ _nStartTime += _speed;
+ if (_slots[_nCurSlot]._type == SPRITE)
+ _nCurSlot++;
+ if (_nCurSlot == _nSlots) {
+ _nCurSlot = 0;
+ bFlag = _slots[_nCurSlot]._flag;
+
+ CoroScheduler.pulseEvent(hEndPattern);
+
+ // @@@ If there is no loop pattern, and there's a warning that it's the final
+ // frame, then remain on the last frame
+ if (!_bLoop) {
+ _nCurSlot = _nSlots - 1;
+ bFlag = _slots[_nCurSlot]._flag;
+ return _nCurSprite;
+ }
+ }
+
+ for (;;) {
+ switch (_slots[_nCurSlot]._type) {
+ case SPRITE:
+ // Read the next sprite
+ _nCurSprite = _slots[_nCurSlot]._data;
+
+ // Update the parent & child coordinates
+ updateCoord();
+ break;
+
+ case SOUND:
+ if (sfx != NULL) {
+ sfx[_slots[_nCurSlot]._data].setVolume(_slots[_nCurSlot].pos()._x);
+
+ if (sfx[_slots[_nCurSlot]._data]._name.empty() || sfx[_slots[_nCurSlot]._data]._name[0] != '_')
+ sfx[_slots[_nCurSlot]._data].play(false);
+ else
+ sfx[_slots[_nCurSlot]._data].play(true);
+ }
+ break;
+
+ case COMMAND:
+ assert(0);
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+
+ if (_slots[_nCurSlot]._type == SPRITE)
+ break;
+ _nCurSlot++;
+ }
+ }
+
+ // Return the current sprite
+ bFlag = _slots[_nCurSlot]._flag;
+ return _nCurSprite;
+}
+
+RMPattern::RMPattern() {
+ _slots = NULL;
+ _speed = 0;
+ _bLoop = 0;
+ _nSlots = 0;
+ _nCurSlot = 0;
+ _nCurSprite = 0;
+ _nStartTime = 0;
+ _slots = NULL;
+}
+
+/**
+ * Reads the position of the pattern
+ */
+RMPoint RMPattern::pos() {
+ return _curPos;
+}
+
+RMPattern::~RMPattern() {
+ if (_slots != NULL) {
+ delete[] _slots;
+ _slots = NULL;
+ }
+}
+
+/****************************************************************************\
+* RMSprite Methods
+\****************************************************************************/
+
+void RMSprite::init(RMGfxSourceBuffer *buf) {
+ _buf = buf;
+}
+
+void RMSprite::LOXGetSizeFromStream(Common::SeekableReadStream &ds, int *dimx, int *dimy) {
+ uint32 pos = ds.pos();
+
+ *dimx = ds.readSint32LE();
+ *dimy = ds.readSint32LE();
+
+ ds.seek(pos);
+}
+
+void RMSprite::getSizeFromStream(Common::SeekableReadStream &ds, int *dimx, int *dimy) {
+ uint32 pos = ds.pos();
+
+ _name = readString(ds);
+ *dimx = ds.readSint32LE();
+ *dimy = ds.readSint32LE();
+
+ ds.seek(pos);
+}
+
+void RMSprite::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
+ // Sprite name
+ if (!bLOX)
+ _name = readString(ds);
+
+ // Dimensions
+ int dimx = ds.readSint32LE();
+ int dimy = ds.readSint32LE();
+
+ // Bounding box
+ _rcBox.readFromStream(ds);
+
+ // Unused space
+ if (!bLOX)
+ ds.skip(32);
+
+ // Create buffer and read
+ _buf->init(ds, dimx, dimy);
+}
+
+void RMSprite::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ _buf->draw(coroParam, bigBuf, prim);
+}
+
+void RMSprite::setPalette(byte *buf) {
+ ((RMGfxSourceBufferPal *)_buf)->loadPalette(buf);
+}
+
+RMSprite::RMSprite() {
+ _buf = NULL;
+}
+
+RMSprite::~RMSprite() {
+ if (_buf) {
+ delete _buf;
+ _buf = NULL;
+ }
+}
+
+
+/****************************************************************************\
+* RMSfx Methods
+\****************************************************************************/
+
+void RMSfx::readFromStream(Common::ReadStream &ds, bool bLOX) {
+ // sfx name
+ _name = readString(ds);
+
+ int size = ds.readSint32LE();
+
+ // Read the entire buffer into a MemoryReadStream
+ byte *buffer = (byte *)malloc(size);
+ ds.read(buffer, size);
+ Common::SeekableReadStream *stream = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
+
+ // Create the sound effect
+ _fx = g_vm->createSFX(stream);
+ _fx->setLoop(false);
+}
+
+RMSfx::RMSfx() {
+ _fx = NULL;
+ _bPlayingLoop = false;
+}
+
+RMSfx::~RMSfx() {
+ if (_fx) {
+ _fx->release();
+ _fx = NULL;
+ }
+}
+
+void RMSfx::play(bool bLoop) {
+ if (_fx && !_bPlayingLoop) {
+ _fx->setLoop(bLoop);
+ _fx->play();
+
+ if (bLoop)
+ _bPlayingLoop = true;
+ }
+}
+
+void RMSfx::setVolume(int vol) {
+ if (_fx) {
+ _fx->setVolume(vol);
+ }
+}
+
+void RMSfx::pause(bool bPause) {
+ if (_fx) {
+ _fx->setPause(bPause);
+ }
+}
+
+void RMSfx::stop() {
+ if (_fx) {
+ _fx->stop();
+ _bPlayingLoop = false;
+ }
+}
+
+
+
+/****************************************************************************\
+* RMItem Methods
+\****************************************************************************/
+
+int RMItem::getCurPattern() {
+ return _nCurPattern;
+}
+
+RMGfxSourceBuffer *RMItem::newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE) {
+ if (_cm == CM_256) {
+ RMGfxSourceBuffer8RLE *spr;
+
+ if (_FX == 2) { // AB
+ spr = new RMGfxSourceBuffer8RLEWordAB;
+ } else if (_FX == 1) { // OMBRA+AA
+ if (dimx == -1 || dimx > 255)
+ spr = new RMGfxSourceBuffer8RLEWordAA;
+ else
+ spr = new RMGfxSourceBuffer8RLEByteAA;
+
+ spr->setAlphaBlendColor(_FXparm);
+ if (bPreRLE)
+ spr->setAlreadyCompressed();
+ } else {
+ if (dimx == -1 || dimx > 255)
+ spr = new RMGfxSourceBuffer8RLEWord;
+ else
+ spr = new RMGfxSourceBuffer8RLEByte;
+
+ if (bPreRLE)
+ spr->setAlreadyCompressed();
+ }
+
+ return spr;
+ } else
+ return new RMGfxSourceBuffer16;
+}
+
+bool RMItem::isIn(const RMPoint &pt, int *size) {
+ RMRect rc;
+
+ if (!_bIsActive)
+ return false;
+
+ // Search for the right bounding box to use - use the sprite's if it has one, otherwise use the generic one
+ if (_nCurPattern != 0 && !_sprites[_nCurSprite]._rcBox.isEmpty())
+ rc = _sprites[_nCurSprite]._rcBox + calculatePos();
+ else if (!_rcBox.isEmpty())
+ rc = _rcBox;
+ // If no box, return immediately
+ else
+ return false;
+
+ if (size != NULL)
+ *size = rc.size();
+
+ return rc.ptInRect(pt + _curScroll);
+}
+
+void RMItem::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
+ // MPAL code
+ _mpalCode = ds.readSint32LE();
+
+ // Object name
+ _name = readString(ds);
+
+ // Z (signed)
+ _z = ds.readSint32LE();
+
+ // Parent position
+ _pos.readFromStream(ds);
+
+ // Hotspot
+ _hot.readFromStream(ds);
+
+ // Bounding box
+ _rcBox.readFromStream(ds);
+
+ // Number of sprites, sound effects, and patterns
+ _nSprites = ds.readSint32LE();
+ _nSfx = ds.readSint32LE();
+ _nPatterns = ds.readSint32LE();
+
+ // Color mode
+ byte cm = ds.readByte();
+ _cm = (RMColorMode)cm;
+
+ // Flag for the presence of custom palette differences
+ _bPal = ds.readByte();
+
+ if (_cm == CM_256) {
+ // If there is a palette, read it in
+ if (_bPal)
+ _pal.readFromStream(ds);
+ }
+
+ // MPAL data
+ if (!bLOX)
+ ds.skip(20);
+
+ _FX = ds.readByte();
+ _FXparm = ds.readByte();
+
+ if (!bLOX)
+ ds.skip(106);
+
+ // Create sub-classes
+ if (_nSprites > 0)
+ _sprites = new RMSprite[_nSprites];
+ if (_nSfx > 0)
+ _sfx = new RMSfx[_nSfx];
+ _patterns = new RMPattern[_nPatterns + 1];
+
+ int dimx, dimy;
+ // Read in class data
+ if (!ds.err()) {
+ for (int i = 0; i < _nSprites && !ds.err(); i++) {
+ // Download the sprites
+ if (bLOX) {
+ _sprites[i].LOXGetSizeFromStream(ds, &dimx, &dimy);
+ _sprites[i].init(newItemSpriteBuffer(dimx, dimy, true));
+ _sprites[i].readFromStream(ds, true);
+ } else {
+ _sprites[i].getSizeFromStream(ds, &dimx, &dimy);
+ _sprites[i].init(newItemSpriteBuffer(dimx, dimy, false));
+ _sprites[i].readFromStream(ds, false);
+ }
+
+ if (_cm == CM_256 && _bPal)
+ _sprites[i].setPalette(_pal._data);
+ }
+ }
+
+ if (!ds.err()) {
+ for (int i = 0; i < _nSfx && !ds.err(); i++) {
+ if (bLOX)
+ _sfx[i].readFromStream(ds, true);
+ else
+ _sfx[i].readFromStream(ds, false);
+ }
+ }
+
+ // Read the pattern from pattern 1
+ if (!ds.err()) {
+ for (int i = 1; i <= _nPatterns && !ds.err(); i++) {
+ if (bLOX)
+ _patterns[i].readFromStream(ds, true);
+ else
+ _patterns[i].readFromStream(ds, false);
+ }
+ }
+
+ // Initialize the current pattern
+ if (_bInitCurPattern)
+ setPattern(mpalQueryItemPattern(_mpalCode));
+
+ // Initialize the current activation state
+ _bIsActive = mpalQueryItemIsActive(_mpalCode);
+}
+
+
+RMGfxPrimitive *RMItem::newItemPrimitive() {
+ return new RMGfxPrimitive(this);
+}
+
+void RMItem::setScrollPosition(const RMPoint &scroll) {
+ _curScroll = scroll;
+}
+
+bool RMItem::doFrame(RMGfxTargetBuffer *bigBuf, bool bAddToList) {
+ int oldSprite = _nCurSprite;
+
+ // Pattern 0 = Do not draw anything!
+ if (_nCurPattern == 0)
+ return false;
+
+ // We do an update of the pattern, which also returns the current frame
+ if (_nCurPattern != 0) {
+ _nCurSprite = _patterns[_nCurPattern].update(_hEndPattern, _bCurFlag, _sfx);
+
+ // WORKAROUND: Currently, m_nCurSprite = -1 is used to flag that an item should be removed.
+ // However, this seems to be done inside a process waiting on an event pulsed inside the pattern
+ // Update method. So the value of m_nCurSprite = -1 is being destroyed with the return value
+ // replacing it. It may be that the current coroutine PulseEvent implementation is wrong somehow.
+ // In any case, a special check here is done for items that have ended
+ if (_nCurPattern == 0)
+ _nCurSprite = -1;
+ }
+
+ // If the function returned -1, it means that the pattern has finished
+ if (_nCurSprite == -1) {
+ // We have pattern 0, so leave. The class will self de-register from the OT list
+ _nCurPattern = 0;
+ return false;
+ }
+
+ // If we are not in the OT list, add ourselves
+ if (!_nInList && bAddToList)
+ bigBuf->addPrim(newItemPrimitive());
+
+ return oldSprite != _nCurSprite;
+}
+
+RMPoint RMItem::calculatePos() {
+ return _pos + _patterns[_nCurPattern].pos();
+}
+
+void RMItem::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // If CurSprite == -1, then the pattern is finished
+ if (_nCurSprite == -1)
+ return;
+
+ // Set the flag
+ prim->setFlag(_bCurFlag);
+
+ // Offset direction for scrolling
+ prim->getDst().offset(-_curScroll);
+
+ // We must offset the cordinates of the item inside the primitive
+ // It is estimated as nonno + (babbo + figlio)
+ prim->getDst().offset(calculatePos());
+
+ // No stretching, please
+ prim->setStretch(false);
+
+ // Now we turn to the generic surface drawing routines
+ CORO_INVOKE_2(_sprites[_nCurSprite].draw, bigBuf, prim);
+
+ CORO_END_CODE;
+}
+
+/**
+ * Overloaded priority: it's based on Z ordering
+ */
+int RMItem::priority() {
+ return _z;
+}
+
+/**
+ * Pattern number
+ */
+int RMItem::numPattern() {
+ return _nPatterns;
+}
+
+void RMItem::removeThis(CORO_PARAM, bool &result) {
+ // Remove from the OT list if the current frame is -1 (pattern over)
+ result = (_nCurSprite == -1);
+}
+
+
+void RMItem::setStatus(int nStatus) {
+ _bIsActive = (nStatus > 0);
+}
+
+RMPoint RMItem::getHotspot() {
+ return _hot;
+}
+
+int RMItem::mpalCode() {
+ return _mpalCode;
+}
+
+void RMItem::setPattern(int nPattern, bool bPlayP0) {
+ assert(nPattern >= 0 && nPattern <= _nPatterns);
+
+ if (_sfx) {
+ if (_nCurPattern > 0)
+ _patterns[_nCurPattern].stopSfx(_sfx);
+ }
+
+ // Remember the current pattern
+ _nCurPattern = nPattern;
+
+ // Start the pattern to start the animation
+ if (_nCurPattern != 0)
+ _nCurSprite = _patterns[_nCurPattern].init(_sfx, bPlayP0, &_bCurFlag);
+ else {
+ _nCurSprite = -1;
+
+ // Look for the sound effect for pattern 0
+ if (bPlayP0) {
+ for (int i = 0; i < _nSfx; i++) {
+ if (_sfx[i]._name == "p0")
+ _sfx[i].play();
+ }
+ }
+ }
+}
+
+bool RMItem::getName(Common::String &name) {
+ char buf[256];
+
+ mpalQueryItemName(_mpalCode, buf);
+ name = buf;
+ if (buf[0] == '\0')
+ return false;
+ return true;
+}
+
+void RMItem::unload() {
+ if (_patterns != NULL) {
+ delete[] _patterns;
+ _patterns = NULL;
+ }
+
+ if (_sprites != NULL) {
+ delete[] _sprites;
+ _sprites = NULL;
+ }
+
+ if (_sfx != NULL) {
+ delete[] _sfx;
+ _sfx = NULL;
+ }
+}
+
+RMItem::RMItem() {
+ _bCurFlag = 0;
+ _patterns = NULL;
+ _sprites = NULL;
+ _sfx = NULL;
+ _curScroll.set(0, 0);
+ _bInitCurPattern = true;
+ _nCurPattern = 0;
+ _z = 0;
+ _cm = CM_256;
+ _FX = 0;
+ _FXparm = 0;
+ _mpalCode = 0;
+ _nSprites = 0;
+ _nSfx = 0;
+ _nPatterns = 0;
+ _bPal = 0;
+ _nCurSprite = 0;
+
+ _bIsActive = false;
+ memset(_pal._data, 0, sizeof(_pal._data));
+
+ _hEndPattern = CoroScheduler.createEvent(false, false);
+}
+
+RMItem::~RMItem() {
+ unload();
+ CoroScheduler.closeEvent(_hEndPattern);
+}
+
+
+void RMItem::waitForEndPattern(CORO_PARAM, uint32 hCustomSkip) {
+ CORO_BEGIN_CONTEXT;
+ uint32 h[2];
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_nCurPattern != 0) {
+ if (hCustomSkip == CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _hEndPattern, CORO_INFINITE);
+ else {
+ _ctx->h[0] = hCustomSkip;
+ _ctx->h[1] = _hEndPattern;
+ CORO_INVOKE_4(CoroScheduler.waitForMultipleObjects, 2, &_ctx->h[0], false, CORO_INFINITE);
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMItem::changeHotspot(const RMPoint &pt) {
+ _hot = pt;
+}
+
+void RMItem::setInitCurPattern(bool status) {
+ _bInitCurPattern = status;
+}
+
+void RMItem::playSfx(int nSfx) {
+ if (nSfx < _nSfx)
+ _sfx[nSfx].play();
+}
+
+void RMItem::pauseSound(bool bPause) {
+ for (int i = 0; i < _nSfx; i++)
+ _sfx[i].pause(bPause);
+}
+
+
+/****************************************************************************\
+* RMWipe Methods
+\****************************************************************************/
+
+
+RMWipe::RMWipe() {
+ _hUnregistered = CoroScheduler.createEvent(false, false);
+ _hEndOfFade = CoroScheduler.createEvent(false, false);
+
+ _bMustRegister = false;
+ _bUnregister = false;
+ _bEndFade = false;
+ _bFading = false;
+ _nFadeStep = 0;
+
+}
+
+RMWipe::~RMWipe() {
+ CoroScheduler.closeEvent(_hUnregistered);
+ CoroScheduler.closeEvent(_hEndOfFade);
+}
+
+int RMWipe::priority() {
+ return 200;
+}
+
+void RMWipe::unregister() {
+ RMGfxTask::unregister();
+ assert(_nInList == 0);
+ CoroScheduler.setEvent(_hUnregistered);
+}
+
+void RMWipe::removeThis(CORO_PARAM, bool &result) {
+ result = _bUnregister;
+}
+
+void RMWipe::waitForFadeEnd(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _hEndOfFade, CORO_INFINITE);
+
+ _bEndFade = true;
+ _bFading = false;
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+
+ CORO_END_CODE;
+}
+
+void RMWipe::closeFade() {
+ _wip0r.unload();
+}
+
+void RMWipe::initFade(int type) {
+ // Activate the fade
+ _bUnregister = false;
+ _bEndFade = false;
+
+ _nFadeStep = 0;
+
+ _bMustRegister = true;
+
+ RMRes res(RES_W_CIRCLE);
+ Common::SeekableReadStream *ds = res.getReadStream();
+ _wip0r.readFromStream(*ds);
+ delete ds;
+
+ _wip0r.setPattern(1);
+
+ _bFading = true;
+}
+
+void RMWipe::doFrame(RMGfxTargetBuffer &bigBuf) {
+ if (_bMustRegister) {
+ bigBuf.addPrim(new RMGfxPrimitive(this));
+ _bMustRegister = false;
+ }
+
+ if (_bFading) {
+ _wip0r.doFrame(&bigBuf, false);
+
+ _nFadeStep++;
+
+ if (_nFadeStep == 10) {
+ CoroScheduler.setEvent(_hEndOfFade);
+ }
+ }
+}
+
+void RMWipe::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_bFading) {
+ CORO_INVOKE_2(_wip0r.draw, bigBuf, prim);
+ }
+
+ if (_bEndFade)
+ Common::fill((byte *)bigBuf, (byte *)bigBuf + bigBuf.getDimx() * bigBuf.getDimy() * 2, 0x0);
+
+ CORO_END_CODE;
+}
+
+/****************************************************************************\
+* RMCharacter Methods
+\****************************************************************************/
+
+/****************************************************************************/
+/* Find the shortest path between two nodes of the graph connecting the BOX */
+/* Returns path along the vector path path[] */
+/****************************************************************************/
+
+short RMCharacter::findPath(short source, short destination) {
+ static RMBox box[MAXBOXES]; // Matrix of adjacent boxes
+ static short nodeCost[MAXBOXES]; // Cost per node
+ static short valid[MAXBOXES]; // 0:Invalid 1:Valid 2:Saturated
+ static short nextNode[MAXBOXES]; // Next node
+ short minCost, error = 0;
+ RMBoxLoc *cur;
+
+ g_system->lockMutex(_csMove);
+
+ if (source == -1 || destination == -1) {
+ g_system->unlockMutex(_csMove);
+ return 0;
+ }
+
+ // Get the boxes
+ cur = _theBoxes->getBoxes(_curLocation);
+
+ // Make a backup copy to work on
+ for (int i = 0; i < cur->_numbBox; i++)
+ memcpy(&box[i], &cur->_boxes[i], sizeof(RMBox));
+
+ // Invalidate all nodes
+ for (int i = 0; i < cur->_numbBox; i++)
+ valid[i] = 0;
+
+ // Prepare source and variables for the procedure
+ nodeCost[source] = 0;
+ valid[source] = 1;
+ bool finish = false;
+
+ // Find the shortest path
+ while (!finish) {
+ minCost = 32000; // Reset the minimum cost
+ error = 1; // Possible error
+
+ // 1st cycle: explore possible new nodes
+ for (int i = 0; i < cur->_numbBox; i++) {
+ if (valid[i] == 1) {
+ error = 0; // Failure de-bunked
+ int j = 0;
+ while (((box[i]._adj[j]) != 1) && (j < cur->_numbBox))
+ j++;
+
+ if (j >= cur->_numbBox)
+ valid[i] = 2; // nodo saturated?
+ else {
+ nextNode[i] = j;
+ if (nodeCost[i] + 1 < minCost)
+ minCost = nodeCost[i] + 1;
+ }
+ }
+ }
+
+ if (error)
+ finish = true; // All nodes saturated
+
+ // 2nd cycle: adding new nodes that were found, saturate old nodes
+ for (int i = 0; i < cur->_numbBox; i++) {
+ if ((valid[i] == 1) && ((nodeCost[i] + 1) == minCost)) {
+ box[i]._adj[nextNode[i]] = 2;
+ nodeCost[nextNode[i]] = minCost;
+ valid[nextNode[i]] = 1;
+ for (int j = 0; j < cur->_numbBox; j++)
+ if (box[j]._adj[nextNode[i]] == 1)
+ box[j]._adj[nextNode[i]] = 0;
+
+ if (nextNode[i] == destination)
+ finish = true;
+ }
+ }
+ }
+
+ // Remove the path from the adjacent modified matrixes
+ if (!error) {
+ _pathLength = nodeCost[destination];
+ short k = _pathLength;
+ _path[k] = destination;
+
+ while (_path[k] != source) {
+ int i = 0;
+ while (box[i]._adj[_path[k]] != 2)
+ i++;
+ k--;
+ _path[k] = i;
+ }
+
+ _pathLength++;
+ }
+
+ g_system->unlockMutex(_csMove);
+
+ return !error;
+}
+
+
+void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_pos == destcoord) {
+ if (_minPath == 0) {
+ CORO_INVOKE_0(stop);
+ CoroScheduler.pulseEvent(_hEndOfPath);
+ return;
+ }
+ }
+
+ _status = WALK;
+ _lineStart = _pos;
+ _lineEnd = destcoord;
+ _dx = _lineStart._x - _lineEnd._x;
+ _dy = _lineStart._y - _lineEnd._y;
+ _fx = _dx;
+ _fy = _dy;
+ _dx = ABS(_dx);
+ _dy = ABS(_dy);
+ _walkSpeed = _curSpeed;
+ _walkCount = 0;
+
+ if (bReversed) {
+ while (0) ;
+ }
+
+ int nPatt = getCurPattern();
+
+ if (_dx > _dy) {
+ _slope = _fy / _fx;
+ if (_lineEnd._x < _lineStart._x)
+ _walkSpeed = -_walkSpeed;
+ _walkStatus = 1;
+
+ // Change the pattern for the new direction
+ _bNeedToStop = true;
+ if ((_walkSpeed < 0 && !bReversed) || (_walkSpeed >= 0 && bReversed)) {
+ if (nPatt != PAT_WALKLEFT)
+ setPattern(PAT_WALKLEFT);
+ } else {
+ if (nPatt != PAT_WALKRIGHT)
+ setPattern(PAT_WALKRIGHT);
+ }
+ } else {
+ _slope = _fx / _fy;
+ if (_lineEnd._y < _lineStart._y)
+ _walkSpeed = -_walkSpeed;
+ _walkStatus = 0;
+
+ _bNeedToStop = true;
+ if ((_walkSpeed < 0 && !bReversed) || (_walkSpeed >= 0 && bReversed)) {
+ if (nPatt != PAT_WALKUP)
+ setPattern(PAT_WALKUP);
+ } else {
+ if (nPatt != PAT_WALKDOWN)
+ setPattern(PAT_WALKDOWN);
+ }
+ }
+
+ _olddx = _dx;
+ _olddy = _dy;
+
+ CORO_END_CODE;
+}
+
+
+RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point) {
+ short steps;
+ RMPoint newPt, foundPt;
+ short minStep = 32000;
+
+ if (UP) {
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._y >= 0)) {
+ newPt._y--;
+ steps++;
+ }
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._y--; // to avoid error?
+ foundPt = newPt;
+ }
+ }
+
+ if (DOWN) {
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._y < 480)) {
+ newPt._y++;
+ steps++;
+ }
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._y++; // to avoid error?
+ foundPt = newPt;
+ }
+ }
+
+ if (RIGHT) {
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._x < 640)) {
+ newPt._x++;
+ steps++;
+ }
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._x++; // to avoid error?
+ foundPt = newPt;
+ }
+ }
+
+ if (LEFT) {
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._x >= 0)) {
+ newPt._x--;
+ steps++;
+ }
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._x--; // to avoid error?
+ foundPt = newPt;
+ }
+ }
+
+ if (minStep == 32000)
+ foundPt = point;
+
+ return foundPt;
+}
+
+
+RMPoint RMCharacter::nearestPoint(const RMPoint &point) {
+ return searching(1, 1, 1, 1, point);
+}
+
+
+short RMCharacter::scanLine(const RMPoint &point) {
+ int Ldx, Ldy, Lcount;
+ float Lfx, Lfy, Lslope;
+ RMPoint Lstart, Lend, Lscan;
+ signed char Lspeed, Lstatus;
+
+ Lstart = _pos;
+ Lend = point;
+ Ldx = Lstart._x - Lend._x;
+ Ldy = Lstart._y - Lend._y;
+ Lfx = Ldx;
+ Lfy = Ldy;
+ Ldx = ABS(Ldx);
+ Ldy = ABS(Ldy);
+ Lspeed = 1;
+ Lcount = 0;
+
+ if (Ldx > Ldy) {
+ Lslope = Lfy / Lfx;
+ if (Lend._x < Lstart._x)
+ Lspeed = -Lspeed;
+ Lstatus = 1;
+ } else {
+ Lslope = Lfx / Lfy;
+ if (Lend._y < Lstart._y)
+ Lspeed = - Lspeed;
+ Lstatus = 0;
+ }
+
+ Lscan = Lstart; // Start scanning
+ while (inWhichBox(Lscan) != -1) {
+ Lcount++;
+ if (Lstatus) {
+ Ldx = Lspeed * Lcount;
+ Ldy = (int)(Lslope * Ldx);
+ } else {
+ Ldy = Lspeed * Lcount;
+ Ldx = (int)(Lslope * Ldy);
+ }
+
+ Lscan._x = Lstart._x + Ldx;
+ Lscan._y = Lstart._y + Ldy;
+
+ if ((ABS(Lscan._x - Lend._x) <= 1) && (ABS(Lscan._y - Lend._y) <= 1))
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * Calculates intersections between the straight line and the closest BBOX
+ */
+RMPoint RMCharacter::invScanLine(const RMPoint &point) {
+ RMPoint lStart = point; // Exchange!
+ RMPoint lEnd = _pos; // :-)
+ int lDx = lStart._x - lEnd._x;
+ int lDy = lStart._y - lEnd._y;
+ float lFx = lDx;
+ float lFy = lDy;
+ lDx = ABS(lDx);
+ lDy = ABS(lDy);
+ signed char lSpeed = 1;
+ int lCount = 0;
+
+ signed char lStatus;
+ float lSlope;
+
+ if (lDx > lDy) {
+ lSlope = lFy / lFx;
+ if (lEnd._x < lStart._x)
+ lSpeed = -lSpeed;
+ lStatus = 1;
+ } else {
+ lSlope = lFx / lFy;
+ if (lEnd._y < lStart._y)
+ lSpeed = -lSpeed;
+ lStatus = 0;
+ }
+
+ RMPoint lScan = lStart;
+ signed char lBox = -1;
+
+ for (;;) {
+ if (inWhichBox(lScan) != -1) {
+ if (inWhichBox(lScan) != lBox) {
+ if (inWhichBox(_pos) == inWhichBox(lScan) || findPath(inWhichBox(_pos), inWhichBox(lScan)))
+ return lScan;
+ else
+ lBox = inWhichBox(lScan);
+ }
+ }
+
+ lCount++;
+ if (lStatus) {
+ lDx = lSpeed * lCount;
+ lDy = (int)(lSlope * lDx);
+ } else {
+ lDy = lSpeed * lCount;
+ lDx = (int)(lSlope * lDy);
+ }
+ lScan._x = lStart._x + lDx;
+ lScan._y = lStart._y + lDy;
+
+ // WORKAROUND: Handles cases where the points never fall inside a bounding box
+ if (lScan._x < -100 || lScan._y < -100 || lScan._x >= 1000 || lScan._y >= 1000)
+ return point;
+ }
+}
+
+
+/**
+ * Returns the HotSpot coordinate closest to the player
+ */
+
+RMPoint RMCharacter::nearestHotSpot(int sourcebox, int destbox) {
+ RMPoint hotspot;
+ int x, y;
+ int minDist = 10000000;
+ RMBoxLoc *cur = _theBoxes->getBoxes(_curLocation);
+
+ for (short cc = 0; cc < cur->_boxes[sourcebox]._numHotspot; cc++)
+ if ((cur->_boxes[sourcebox]._hotspot[cc]._destination) == destbox) {
+ x = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hotx - _pos._x);
+ y = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hoty - _pos._y);
+
+ if ((x * x + y * y) < minDist) {
+ minDist = x * x + y * y;
+ hotspot._x = cur->_boxes[sourcebox]._hotspot[cc]._hotx;
+ hotspot._y = cur->_boxes[sourcebox]._hotspot[cc]._hoty;
+ }
+ }
+
+ return hotspot;
+}
+
+void RMCharacter::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_bDrawNow) {
+ prim->getDst() += _fixedScroll;
+
+ CORO_INVOKE_2(RMItem::draw, bigBuf, prim);
+ }
+
+ CORO_END_CODE;
+}
+
+void RMCharacter::newBoxEntered(int nBox) {
+ RMBoxLoc *cur;
+
+ // Recall on ExitBox
+ mpalQueryDoAction(3, _curLocation, _curBox);
+
+ cur = _theBoxes->getBoxes(_curLocation);
+ bool bOldReverse = cur->_boxes[_curBox]._bReversed;
+ _curBox = nBox;
+
+ // If Z is changed, we must remove it from the OT
+ if (cur->_boxes[_curBox]._destZ != _z) {
+ _bRemoveFromOT = true;
+ _z = cur->_boxes[_curBox]._destZ;
+ }
+
+ // Movement management is reversed, only if we are not in the shortest path. If we are in the shortest
+ // path, directly do the DoFrame
+ if (_bMovingWithoutMinpath) {
+ if ((cur->_boxes[_curBox]._bReversed && !bOldReverse) || (!cur->_boxes[_curBox]._bReversed && bOldReverse)) {
+ switch (getCurPattern()) {
+ case PAT_WALKUP:
+ setPattern(PAT_WALKDOWN);
+ break;
+ case PAT_WALKDOWN:
+ setPattern(PAT_WALKUP);
+ break;
+ case PAT_WALKRIGHT:
+ setPattern(PAT_WALKLEFT);
+ break;
+ case PAT_WALKLEFT:
+ setPattern(PAT_WALKRIGHT);
+ break;
+ }
+ }
+ }
+
+ // Recall On EnterBox
+ mpalQueryDoAction(2, _curLocation, _curBox);
+}
+
+void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
+ CORO_BEGIN_CONTEXT;
+ bool bEndNow;
+ RMBoxLoc *cur;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->bEndNow = false;
+ _bEndOfPath = false;
+ _bDrawNow = (_curLocation == loc);
+
+ g_system->lockMutex(_csMove);
+
+ // If we're walking..
+ if (_status != STAND) {
+ // If we are going horizontally
+ if (_walkStatus == 1) {
+ _dx = _walkSpeed * _walkCount;
+ _dy = (int)(_slope * _dx);
+ _pos._x = _lineStart._x + _dx;
+ _pos._y = _lineStart._y + _dy;
+
+ // Right
+ if (((_walkSpeed > 0) && (_pos._x > _lineEnd._x)) || ((_walkSpeed < 0) && (_pos._x < _lineEnd._x))) {
+ _pos = _lineEnd;
+ _status = STAND;
+ _ctx->bEndNow = true;
+ }
+ }
+
+ // If we are going vertical
+ if (_walkStatus == 0) {
+ _dy = _walkSpeed * _walkCount;
+ _dx = (int)(_slope * _dy);
+ _pos._x = _lineStart._x + _dx;
+ _pos._y = _lineStart._y + _dy;
+
+ // Down
+ if (((_walkSpeed > 0) && (_pos._y > _lineEnd._y)) || ((_walkSpeed < 0) && (_pos._y < _lineEnd._y))) {
+ _pos = _lineEnd;
+ _status = STAND;
+ _ctx->bEndNow = true;
+ }
+ }
+
+ // Check if the character came out of the BOX in error, in which case he returns immediately
+ if (inWhichBox(_pos) == -1) {
+ _pos._x = _lineStart._x + _olddx;
+ _pos._y = _lineStart._y + _olddy;
+ }
+
+ // If we have just moved to a temporary location, and is over the shortest path, we stop permanently
+ if (_ctx->bEndNow && _minPath == 0) {
+ if (!_bEndOfPath)
+ CORO_INVOKE_0(stop);
+ _bEndOfPath = true;
+ CoroScheduler.pulseEvent(_hEndOfPath);
+ }
+
+ _walkCount++;
+
+ // Update the character Z. @@@ Should remove only if the Z was changed
+
+ // Check if the box was changed
+ if (!_theBoxes->isInBox(_curLocation, _curBox, _pos))
+ newBoxEntered(inWhichBox(_pos));
+
+ // Update the old coordinates
+ _olddx = _dx;
+ _olddy = _dy;
+ }
+
+ // If we stop
+ if (_status == STAND) {
+ // Check if there is still the shortest path to calculate
+ if (_minPath == 1) {
+ _ctx->cur = _theBoxes->getBoxes(_curLocation);
+
+ // If we still have to go through a box
+ if (_pathCount < _pathLength) {
+ // Check if the box we're going into is active
+ if (_ctx->cur->_boxes[_path[_pathCount - 1]]._bActive) {
+ // Move in a straight line towards the nearest hotspot, taking into account the reversing
+ // NEWBOX = path[pathcount-1]
+ CORO_INVOKE_2(goTo, nearestHotSpot(_path[_pathCount - 1], _path[_pathCount]), _ctx->cur->_boxes[_path[_pathCount - 1]]._bReversed);
+ _pathCount++;
+ } else {
+ // If the box is off, we can only block all
+ // @@@ Whilst this should not happen, because have improved
+ // the search for the minimum path
+ _minPath = 0;
+ if (!_bEndOfPath)
+ CORO_INVOKE_0(stop);
+ _bEndOfPath = true;
+ CoroScheduler.pulseEvent(_hEndOfPath);
+ }
+ } else {
+ // If we have already entered the last box, we just have to move in a straight line towards the
+ // point of arrival
+ // NEWBOX = InWhichBox(pathend)
+ _minPath = 0;
+ CORO_INVOKE_2(goTo, _pathEnd, _ctx->cur->_boxes[inWhichBox(_pathEnd)]._bReversed);
+ }
+ }
+ }
+
+ g_system->unlockMutex(_csMove);
+
+ // Invoke the DoFrame of the item
+ RMItem::doFrame(bigBuf);
+
+ CORO_END_CODE;
+}
+
+bool RMCharacter::endOfPath() {
+ return _bEndOfPath;
+}
+
+void RMCharacter::stop(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _bMoving = false;
+
+ // You never know..
+ _status = STAND;
+ _minPath = 0;
+
+ if (!_bNeedToStop)
+ return;
+
+ _bNeedToStop = false;
+
+ switch (getCurPattern()) {
+ case PAT_WALKUP:
+ setPattern(PAT_STANDUP);
+ break;
+
+ case PAT_WALKDOWN:
+ setPattern(PAT_STANDDOWN);
+ break;
+
+ case PAT_WALKLEFT:
+ setPattern(PAT_STANDLEFT);
+ break;
+
+ case PAT_WALKRIGHT:
+ setPattern(PAT_STANDRIGHT);
+ break;
+
+ default:
+ setPattern(PAT_STANDDOWN);
+ break;
+ }
+
+ CORO_END_CODE;
+}
+
+/**
+ * Check if the character is moving
+ */
+bool RMCharacter::isMoving() {
+ return _bMoving;
+}
+
+inline int RMCharacter::inWhichBox(const RMPoint &pt) {
+ return _theBoxes->whichBox(_curLocation, pt);
+}
+
+
+void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) {
+ CORO_BEGIN_CONTEXT;
+ RMPoint dest;
+ int numbox;
+ RMBoxLoc *cur;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _bMoving = true;
+
+ // 0, 0 does not do anything, just stops the character
+ if (pt._x == 0 && pt._y == 0) {
+ _minPath = 0;
+ _status = STAND;
+ CORO_INVOKE_0(stop);
+ if (result)
+ *result = true;
+ return;
+ }
+
+ // If clicked outside the box
+ _ctx->numbox = inWhichBox(pt);
+ if (_ctx->numbox == -1) {
+ // Find neareste point inside the box
+ _ctx->dest = nearestPoint(pt);
+
+ // ???!??
+ if (_ctx->dest == pt)
+ _ctx->dest = invScanLine(pt);
+
+ pt = _ctx->dest;
+ _ctx->numbox = inWhichBox(pt);
+ }
+
+ _ctx->cur = _theBoxes->getBoxes(_curLocation);
+
+ _minPath = 0;
+ _status = STAND;
+ _bMovingWithoutMinpath = true;
+ if (scanLine(pt))
+ CORO_INVOKE_2(goTo, pt, _ctx->cur->_boxes[_ctx->numbox]._bReversed);
+ else if (findPath(inWhichBox(_pos), inWhichBox(pt))) {
+ _bMovingWithoutMinpath = false;
+ _minPath = 1;
+ _pathCount = 1;
+ _pathEnd = pt;
+ } else {
+ // @@@ This case is whether a hotspot is inside a box, but there is
+ // a path to get there. We use the InvScanLine to search around a point
+ _ctx->dest = invScanLine(pt);
+ pt = _ctx->dest;
+
+ if (scanLine(pt))
+ CORO_INVOKE_2(goTo, pt, _ctx->cur->_boxes[_ctx->numbox]._bReversed);
+ else if (findPath(inWhichBox(_pos), inWhichBox(pt))) {
+ _bMovingWithoutMinpath = false;
+ _minPath = 1;
+ _pathCount = 1;
+ _pathEnd = pt;
+ if (result)
+ *result = true;
+ } else {
+ if (result)
+ *result = false;
+ }
+
+ return;
+ }
+
+ if (result)
+ *result = true;
+
+ CORO_END_CODE;
+}
+
+void RMCharacter::setPosition(const RMPoint &pt, int newloc) {
+ RMBoxLoc *box;
+
+ _minPath = 0;
+ _status = STAND;
+ _pos = pt;
+
+ if (newloc != -1)
+ _curLocation = newloc;
+
+ // Update the character's Z value
+ box = _theBoxes->getBoxes(_curLocation);
+ _curBox = inWhichBox(_pos);
+ assert(_curBox != -1);
+ _z = box->_boxes[_curBox]._destZ;
+ _bRemoveFromOT = true;
+}
+
+void RMCharacter::waitForEndMovement(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_bMoving)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _hEndOfPath, CORO_INFINITE);
+
+ CORO_END_CODE;
+}
+
+void RMCharacter::setFixedScroll(const RMPoint &fix) {
+ _fixedScroll = fix;
+}
+
+void RMCharacter::setSpeed(int speed) {
+ _curSpeed = speed;
+}
+
+void RMCharacter::removeThis(CORO_PARAM, bool &result) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_bRemoveFromOT)
+ result = true;
+ else
+ CORO_INVOKE_1(RMItem::removeThis, result);
+
+ CORO_END_CODE;
+}
+
+RMCharacter::RMCharacter() {
+ _csMove = g_system->createMutex();
+ _hEndOfPath = CoroScheduler.createEvent(false, false);
+ _minPath = 0;
+ _curSpeed = 3;
+ _bRemoveFromOT = false;
+ _bMoving = false;
+ _curLocation = 0;
+ _curBox = 0;
+ _dx = _dy = 0;
+ _olddx = _olddy = 0;
+ _fx = _fy = _slope = 0;
+ _walkSpeed = _walkStatus = 0;
+ _nextBox = 0;
+ _pathLength = _pathCount = 0;
+ _status = STAND;
+ _theBoxes = NULL;
+ _walkCount = 0;
+ _bEndOfPath = false;
+ _bMovingWithoutMinpath = false;
+ _bDrawNow = false;
+ _bNeedToStop = false;
+
+ memset(_path, 0, sizeof(_path));
+
+ _pos.set(0, 0);
+}
+
+RMCharacter::~RMCharacter() {
+ g_system->deleteMutex(_csMove);
+ CoroScheduler.closeEvent(_hEndOfPath);
+}
+
+void RMCharacter::linkToBoxes(RMGameBoxes *boxes) {
+ _theBoxes = boxes;
+}
+
+/****************************************************************************\
+* RMBox Methods
+\****************************************************************************/
+
+void RMBox::readFromStream(Common::ReadStream &ds) {
+ // Bbox
+ _left = ds.readSint32LE();
+ _top = ds.readSint32LE();
+ _right = ds.readSint32LE();
+ _bottom = ds.readSint32LE();
+
+ // Adjacency
+ for (int i = 0; i < MAXBOXES; i++) {
+ _adj[i] = ds.readSint32LE();
+ }
+
+ // Misc
+ _numHotspot = ds.readSint32LE();
+ _destZ = ds.readByte();
+ byte b = ds.readByte();
+ _bActive = b;
+ b = ds.readByte();
+ _bReversed = b;
+
+ // Reversed expansion space
+ for (int i = 0; i < 30; i++)
+ ds.readByte();
+
+ uint16 w;
+ // Hotspots
+ for (int i = 0; i < _numHotspot; i++) {
+ w = ds.readUint16LE();
+ _hotspot[i]._hotx = w;
+ w = ds.readUint16LE();
+ _hotspot[i]._hoty = w;
+ w = ds.readUint16LE();
+ _hotspot[i]._destination = w;
+ }
+}
+
+/****************************************************************************\
+* RMBoxLoc Methods
+\****************************************************************************/
+
+RMBoxLoc::RMBoxLoc() {
+ _boxes = NULL;
+ _numbBox = 0;
+}
+
+RMBoxLoc::~RMBoxLoc() {
+ delete[] _boxes;
+}
+
+void RMBoxLoc::readFromStream(Common::ReadStream &ds) {
+ char buf[2];
+
+ // ID and version
+ buf[0] = ds.readByte();
+ buf[1] = ds.readByte();
+ byte ver = ds.readByte();
+ assert(buf[0] == 'B' && buf[1] == 'X');
+ assert(ver == 3);
+
+ // Number of boxes
+ _numbBox = ds.readSint32LE();
+
+ // Allocate memory for the boxes
+ _boxes = new RMBox[_numbBox];
+
+ // Read in boxes
+ for (int i = 0; i < _numbBox; i++)
+ _boxes[i].readFromStream(ds);
+}
+
+void RMBoxLoc::recalcAllAdj() {
+ for (int i = 0; i < _numbBox; i++) {
+ Common::fill(_boxes[i]._adj, _boxes[i]._adj + MAXBOXES, 0);
+
+ for (int j = 0; j < _boxes[i]._numHotspot; j++) {
+ if (_boxes[_boxes[i]._hotspot[j]._destination]._bActive)
+ _boxes[i]._adj[_boxes[i]._hotspot[j]._destination] = 1;
+ }
+ }
+}
+
+/****************************************************************************\
+* RMGameBoxes methods
+\****************************************************************************/
+
+RMGameBoxes::RMGameBoxes() {
+ _nLocBoxes = 0;
+ Common::fill(_allBoxes, _allBoxes + GAME_BOXES_SIZE, (RMBoxLoc *)NULL);
+}
+
+RMGameBoxes::~RMGameBoxes() {
+ for (int i = 1; i <= _nLocBoxes; ++i)
+ delete _allBoxes[i];
+}
+
+void RMGameBoxes::init() {
+ // Load boxes from disk
+ _nLocBoxes = 130;
+ for (int i = 1; i <= _nLocBoxes; i++) {
+ RMRes res(10000 + i);
+
+ Common::SeekableReadStream *ds = res.getReadStream();
+
+ _allBoxes[i] = new RMBoxLoc();
+ _allBoxes[i]->readFromStream(*ds);
+
+ _allBoxes[i]->recalcAllAdj();
+
+ delete ds;
+ }
+}
+
+void RMGameBoxes::close() {
+}
+
+RMBoxLoc *RMGameBoxes::getBoxes(int nLoc) {
+ return _allBoxes[nLoc];
+}
+
+int RMGameBoxes::getLocBoxesCount() const {
+ return _nLocBoxes;
+}
+
+bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) {
+ RMBoxLoc *cur = getBoxes(nLoc);
+
+ if ((pt._x >= cur->_boxes[nBox]._left) && (pt._x <= cur->_boxes[nBox]._right) &&
+ (pt._y >= cur->_boxes[nBox]._top) && (pt._y <= cur->_boxes[nBox]._bottom))
+ return true;
+ else
+ return false;
+}
+
+int RMGameBoxes::whichBox(int nLoc, const RMPoint &punto) {
+ RMBoxLoc *cur = getBoxes(nLoc);
+
+ if (!cur)
+ return -1;
+
+ for (int i = 0; i < cur->_numbBox; i++) {
+ if (cur->_boxes[i]._bActive) {
+ if ((punto._x >= cur->_boxes[i]._left) && (punto._x <= cur->_boxes[i]._right) &&
+ (punto._y >= cur->_boxes[i]._top) && (punto._y <= cur->_boxes[i]._bottom))
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+void RMGameBoxes::changeBoxStatus(int nLoc, int nBox, int status) {
+ _allBoxes[nLoc]->_boxes[nBox]._bActive = status;
+ _allBoxes[nLoc]->recalcAllAdj();
+}
+
+int RMGameBoxes::getSaveStateSize() {
+ int size = 4;
+
+ for (int i = 1; i <= _nLocBoxes; i++) {
+ size += 4;
+ size += _allBoxes[i]->_numbBox;
+ }
+
+ return size;
+}
+
+void RMGameBoxes::saveState(byte *state) {
+ // Save the number of locations with boxes
+ WRITE_LE_UINT32(state, _nLocBoxes);
+ state += 4;
+
+ // For each location, write out the number of boxes and their status
+ for (int i = 1; i <= _nLocBoxes; i++) {
+ WRITE_LE_UINT32(state, _allBoxes[i]->_numbBox);
+ state += 4;
+
+ for (int j = 0; j < _allBoxes[i]->_numbBox; j++)
+ *state++ = _allBoxes[i]->_boxes[j]._bActive;
+ }
+}
+
+void RMGameBoxes::loadState(byte *state) {
+ // Load number of items
+ int nloc = READ_LE_UINT32(state);
+ state += 4;
+
+ assert(nloc <= _nLocBoxes);
+
+ int nbox;
+ // For each location, read the number of boxes and their status
+ for (int i = 1; i <= nloc; i++) {
+ nbox = READ_LE_UINT32(state);
+ state += 4;
+
+ for (int j = 0; j < nbox ; j++) {
+ if (j < _allBoxes[i]->_numbBox)
+ _allBoxes[i]->_boxes[j]._bActive = *state;
+
+ state++;
+ }
+
+ _allBoxes[i]->recalcAllAdj();
+ }
+}
+
+/****************************************************************************\
+* RMLocation Methods
+\****************************************************************************/
+
+/**
+ * Standard constructor
+ */
+RMLocation::RMLocation() {
+ _nItems = 0;
+ _items = NULL;
+ _buf = NULL;
+ TEMPNumLoc = 0;
+ _cmode = CM_256;
+}
+
+RMPoint RMLocation::TEMPGetTonyStart() {
+ return TEMPTonyStart;
+}
+
+int RMLocation::TEMPGetNumLoc() {
+ return TEMPNumLoc;
+}
+
+/**
+ * Load a location (.LOC) from a given data stream
+ *
+ * @param ds Data stream
+ * @returns True if succeeded OK, false in case of error.
+ */
+bool RMLocation::load(Common::SeekableReadStream &ds) {
+ char id[3];
+
+ // Reset dirty rectangling
+ _prevScroll.set(-1, -1);
+ _prevFixedScroll.set(-1, -1);
+
+ // Check the ID
+ ds.read(id, 3);
+
+ // Check if we are in a LOX
+ if (id[0] == 'L' && id[1] == 'O' && id[2] == 'X')
+ return loadLOX(ds);
+
+ // Otherwise, check that it is a normal LOC
+ if (id[0] != 'L' || id[1] != 'O' || id[2] != 'C')
+ return false;
+
+ // Version
+ byte ver = ds.readByte();
+ assert(ver == 6);
+
+ // Location name
+ _name = readString(ds);
+
+ // Skip the MPAL bailouts (64 bytes)
+ TEMPNumLoc = ds.readSint32LE();
+ TEMPTonyStart._x = ds.readSint32LE();
+ TEMPTonyStart._y = ds.readSint32LE();
+ ds.skip(64 - 4 * 3);
+
+ // Skip flag associated with the background (?)
+ ds.skip(1);
+
+ // Location dimensions
+ int dimx = ds.readSint32LE();
+ int dimy = ds.readSint32LE();
+ _curScroll.set(0, 0);
+
+ // Read the color mode
+ byte cm = ds.readByte();
+ _cmode = (RMColorMode)cm;
+
+ // Initialize the source buffer and read the location
+ switch (_cmode) {
+ case CM_256:
+ _buf = new RMGfxSourceBuffer8;
+ break;
+
+ case CM_65K:
+ _buf = new RMGfxSourceBuffer16;
+ break;
+
+ default:
+ assert(0);
+ break;
+ };
+
+ // Initialize the surface, loading the palette if necessary
+ _buf->init(ds, dimx, dimy, true);
+
+ // Check the size of the location
+// assert(dimy!=512);
+
+ // Number of objects
+ _nItems = ds.readSint32LE();
+
+ // Create and read in the objects
+ if (_nItems > 0)
+ _items = new RMItem[_nItems];
+
+
+ g_vm->freezeTime();
+ for (int i = 0; i < _nItems && !ds.err(); i++)
+ _items[i].readFromStream(ds);
+ g_vm->unfreezeTime();
+
+ return ds.err();
+}
+
+
+bool RMLocation::loadLOX(Common::SeekableReadStream &ds) {
+ // Version
+ byte ver = ds.readByte();
+ assert(ver == 1);
+
+ // Location name
+ _name = readString(ds);
+
+ // Location number
+ TEMPNumLoc = ds.readSint32LE();
+ TEMPTonyStart._x = ds.readSint32LE();
+ TEMPTonyStart._y = ds.readSint32LE();
+
+ // Dimensions
+ int dimx = ds.readSint32LE();
+ int dimy = ds.readSint32LE();
+ _curScroll.set(0, 0);
+
+ // It's always 65K (16-bit) mode
+ _cmode = CM_65K;
+ _buf = new RMGfxSourceBuffer16;
+
+ // Initialize the surface, loading in the palette if necessary
+ _buf->init(ds, dimx, dimy, true);
+
+ // Number of items
+ _nItems = ds.readSint32LE();
+
+ // Create and read objects
+ if (_nItems > 0)
+ _items = new RMItem[_nItems];
+
+ for (int i = 0; i < _nItems && !ds.err(); i++)
+ _items[i].readFromStream(ds, true);
+
+ return ds.err();
+}
+
+
+/**
+ * Draw method overloaded from RMGfxSourceBUffer8
+ */
+void RMLocation::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ bool priorTracking;
+ bool hasChanges;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Set the position of the source scrolling
+ if (_buf->getDimy() > RM_SY || _buf->getDimx() > RM_SX) {
+ prim->setSrc(RMRect(_curScroll, _curScroll + RMPoint(640, 480)));
+ }
+
+ prim->setDst(_fixedScroll);
+
+ // Check whether dirty rects are being tracked, and if there are changes, leave tracking
+ // turned on so a dirty rect will be added for the entire background
+ _ctx->priorTracking = bigBuf.getTrackDirtyRects();
+ _ctx->hasChanges = (_prevScroll != _curScroll) || (_prevFixedScroll != _fixedScroll);
+ bigBuf.setTrackDirtyRects(_ctx->priorTracking && _ctx->hasChanges);
+
+ // Invoke the drawing method fo the image class, which will draw the location background
+ CORO_INVOKE_2(_buf->draw, bigBuf, prim);
+
+ if (_ctx->hasChanges) {
+ _prevScroll = _curScroll;
+ _prevFixedScroll = _fixedScroll;
+ }
+ bigBuf.setTrackDirtyRects(_ctx->priorTracking);
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Prepare a frame, adding the location to the OT list, and all the items that have changed animation frame.
+ */
+void RMLocation::doFrame(RMGfxTargetBuffer *bigBuf) {
+ // If the location is not in the OT list, add it in
+ if (!_nInList)
+ bigBuf->addPrim(new RMGfxPrimitive(this));
+
+ // Process all the location items
+ for (int i = 0; i < _nItems; i++)
+ _items[i].doFrame(bigBuf);
+}
+
+
+RMItem *RMLocation::getItemFromCode(uint32 dwCode) {
+ for (int i = 0; i < _nItems; i++) {
+ if (_items[i].mpalCode() == (int)dwCode)
+ return &_items[i];
+ }
+
+ return NULL;
+}
+
+RMItem *RMLocation::whichItemIsIn(const RMPoint &pt) {
+ int found = -1;
+ int foundSize = 0;
+ int size;
+
+ for (int i = 0; i < _nItems; i++) {
+ size = 0;
+ if (_items[i].isIn(pt, &size)) {
+ if (found == -1 || size < foundSize) {
+ foundSize = size;
+ found = i;
+ }
+ }
+ }
+
+ if (found == -1)
+ return NULL;
+ else
+ return &_items[found];
+}
+
+RMLocation::~RMLocation() {
+ unload();
+}
+
+void RMLocation::unload() {
+ // Clear memory
+ if (_items) {
+ delete[] _items;
+ _items = NULL;
+ }
+
+ // Destroy the buffer
+ if (_buf) {
+ delete _buf;
+ _buf = NULL;
+ }
+}
+
+void RMLocation::updateScrolling(const RMPoint &ptShowThis) {
+ RMPoint oldScroll = _curScroll;
+
+ if (_curScroll._x + 250 > ptShowThis._x) {
+ _curScroll._x = ptShowThis._x - 250;
+ } else if (_curScroll._x + RM_SX - 250 < ptShowThis._x) {
+ _curScroll._x = ptShowThis._x + 250 - RM_SX;
+ } else if (ABS(_curScroll._x + RM_SX / 2 - ptShowThis._x) > 32 && _buf->getDimx() > RM_SX) {
+ if (_curScroll._x + RM_SX / 2 < ptShowThis._x)
+ _curScroll._x++;
+ else
+ _curScroll._x--;
+ }
+
+ if (_curScroll._y + 180 > ptShowThis._y) {
+ _curScroll._y = ptShowThis._y - 180;
+ } else if (_curScroll._y + RM_SY - 180 < ptShowThis._y) {
+ _curScroll._y = ptShowThis._y + 180 - RM_SY;
+ } else if (ABS(_curScroll._y + RM_SY / 2 - ptShowThis._y) > 16 && _buf->getDimy() > RM_SY) {
+ if (_curScroll._y + RM_SY / 2 < ptShowThis._y)
+ _curScroll._y++;
+ else
+ _curScroll._y--;
+ }
+
+ if (_curScroll._x < 0)
+ _curScroll._x = 0;
+ if (_curScroll._y < 0)
+ _curScroll._y = 0;
+ if (_curScroll._x + RM_SX > _buf->getDimx())
+ _curScroll._x = _buf->getDimx() - RM_SX;
+ if (_curScroll._y + RM_SY > _buf->getDimy())
+ _curScroll._y = _buf->getDimy() - RM_SY;
+
+ if (oldScroll != _curScroll) {
+ for (int i = 0; i < _nItems; i++)
+ _items[i].setScrollPosition(_curScroll);
+ }
+}
+
+void RMLocation::setFixedScroll(const RMPoint &scroll) {
+ _fixedScroll = scroll;
+
+ for (int i = 0; i < _nItems; i++)
+ _items[i].setScrollPosition(_curScroll - _fixedScroll);
+}
+
+void RMLocation::setScrollPosition(const RMPoint &scroll) {
+ RMPoint pt = scroll;
+ if (pt._x < 0)
+ pt._x = 0;
+ if (pt._y < 0)
+ pt._y = 0;
+ if (pt._x + RM_SX > _buf->getDimx())
+ pt._x = _buf->getDimx() - RM_SX;
+ if (pt._y + RM_SY > _buf->getDimy())
+ pt._y = _buf->getDimy() - RM_SY;
+
+ _curScroll = pt;
+
+ for (int i = 0; i < _nItems; i++)
+ _items[i].setScrollPosition(_curScroll);
+}
+
+
+void RMLocation::pauseSound(bool bPause) {
+ for (int i = 0; i < _nItems; i++)
+ _items[i].pauseSound(bPause);
+}
+
+/**
+ * Read the current scroll position
+ */
+RMPoint RMLocation::scrollPosition() {
+ return _curScroll;
+}
+
+/****************************************************************************\
+* RMMessage Methods
+\****************************************************************************/
+
+RMMessage::RMMessage(uint32 dwId) {
+ load(dwId);
+}
+
+RMMessage::RMMessage() {
+ _lpMessage = NULL;
+ _nPeriods = 0;
+ for (int i = 0; i < 256; i++)
+ _lpPeriods[i] = 0;
+}
+
+RMMessage::~RMMessage() {
+ if (_lpMessage)
+ globalDestroy(_lpMessage);
+}
+
+void RMMessage::load(uint32 dwId) {
+ _lpMessage = mpalQueryMessage(dwId);
+ assert(_lpMessage != NULL);
+
+ if (_lpMessage)
+ parseMessage();
+}
+
+void RMMessage::parseMessage() {
+ char *p;
+
+ assert(_lpMessage != NULL);
+
+ _nPeriods = 1;
+ p = _lpPeriods[0] = _lpMessage;
+
+ for (;;) {
+ // Find the end of the current period
+ while (*p != '\0')
+ p++;
+
+ // If there is another '0' at the end of the string, the end has been found
+ p++;
+ if (*p == '\0')
+ break;
+
+ // Otherwise there is another line, and remember it's start
+ _lpPeriods[_nPeriods++] = p;
+ }
+}
+
+bool RMMessage::isValid() {
+ return _lpMessage != NULL;
+}
+
+int RMMessage::numPeriods() {
+ return _nPeriods;
+}
+
+char *RMMessage::period(int num) {
+ return _lpPeriods[num];
+}
+
+char *RMMessage::operator[](int num) {
+ return _lpPeriods[num];
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/loc.h b/engines/tony/loc.h
new file mode 100644
index 0000000000..04ba772458
--- /dev/null
+++ b/engines/tony/loc.h
@@ -0,0 +1,582 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_LOC_H
+#define TONY_LOC_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/file.h"
+#include "tony/sound.h"
+#include "tony/utils.h"
+
+namespace Tony {
+
+/****************************************************************************\
+* Various defines
+\****************************************************************************/
+
+/**
+ * Valid color modes
+ */
+typedef enum {
+ CM_256,
+ CM_65K
+} RMColorMode;
+
+
+/****************************************************************************\
+* Class declarations
+\****************************************************************************/
+
+/**
+ * Generic palette
+ */
+class RMPalette {
+public:
+ byte _data[1024];
+
+public:
+ void readFromStream(Common::ReadStream &ds);
+};
+
+
+/**
+ * Sound effect of an object
+ */
+class RMSfx {
+public:
+ Common::String _name;
+ FPSfx *_fx;
+ bool _bPlayingLoop;
+
+public:
+ RMSfx();
+ virtual ~RMSfx();
+
+ void play(bool bLoop = false);
+ void setVolume(int vol);
+ void pause(bool bPause);
+ void stop();
+
+ void readFromStream(Common::ReadStream &ds, bool bLOX = false);
+};
+
+
+/**
+ * Object pattern
+ */
+class RMPattern {
+public:
+ // Type of slot
+ enum RMSlotType {
+ DUMMY1 = 0,
+ DUMMY2,
+ SPRITE,
+ SOUND,
+ COMMAND,
+ SPECIAL
+ };
+
+ // Class slot
+ class RMSlot {
+ private:
+ RMPoint _pos; // Child co-ordinates
+
+ public:
+ RMSlotType _type;
+ int _data;
+ byte _flag;
+
+ public:
+ RMPoint pos() {
+ return _pos;
+ }
+
+ void readFromStream(Common::ReadStream &ds, bool bLOX = false);
+ };
+
+public:
+ Common::String _name;
+
+private:
+ int _speed;
+ RMPoint _pos; // Parent coordinates
+ RMPoint _curPos; // Parent + child coordinates
+ int _bLoop;
+ int _nSlots;
+ int _nCurSlot;
+ int _nCurSprite;
+
+ RMSlot *_slots;
+
+ uint32 _nStartTime;
+
+public:
+ RMPattern();
+ virtual ~RMPattern();
+
+ // A warning that the pattern now and the current
+ int init(RMSfx *sfx, bool bPlayP0 = false, byte *bFlag = NULL);
+
+ // Update the pattern, checking to see if it's time to change slot and executing
+ // any associated commands
+ int update(uint32 hEndPattern, byte &bFlag, RMSfx *sfx);
+
+ // Stop a sound effect
+ void stopSfx(RMSfx *sfx);
+
+ // Reads the position of the pattern
+ RMPoint pos();
+
+ void readFromStream(Common::ReadStream &ds, bool bLOX = false);
+
+private:
+ void updateCoord();
+};
+
+
+/**
+ * Sprite (frame) animation of an item
+ */
+class RMSprite : public RMGfxTask {
+public:
+ Common::String _name;
+ RMRect _rcBox;
+
+protected:
+ RMGfxSourceBuffer *_buf;
+
+public:
+ RMSprite();
+ virtual ~RMSprite();
+
+ void init(RMGfxSourceBuffer *buf);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ void setPalette(byte *lpBuf);
+ void getSizeFromStream(Common::SeekableReadStream &ds, int *dimx, int *dimy);
+ void LOXGetSizeFromStream(Common::SeekableReadStream &ds, int *dimx, int *dimy);
+
+ void readFromStream(Common::SeekableReadStream &ds, bool bLOX = false);
+};
+
+
+/**
+ * Data on an item
+ */
+class RMItem : public RMGfxTask {
+public:
+ Common::String _name;
+
+protected:
+ int _z;
+ RMPoint _pos; // Coordinate ancestor
+ RMColorMode _cm;
+ RMPoint _curScroll;
+
+ byte _FX;
+ byte _FXparm;
+
+ virtual int getCurPattern();
+
+private:
+ int _nCurPattern;
+ int _mpalCode;
+ RMPoint _hot;
+ RMRect _rcBox;
+ int _nSprites, _nSfx, _nPatterns;
+ byte _bPal;
+ RMPalette _pal;
+
+ RMSprite *_sprites;
+ RMSfx *_sfx;
+ RMPattern *_patterns;
+
+ byte _bCurFlag;
+ int _nCurSprite;
+ bool _bIsActive;
+ uint32 _hEndPattern;
+ bool _bInitCurPattern;
+
+public:
+ RMPoint calculatePos();
+
+public:
+ RMItem();
+ virtual ~RMItem();
+
+ // Process to make the object move on any animations.
+ // Returns TRUE if it should be redrawn on the next frame
+ bool doFrame(RMGfxTargetBuffer *bigBuf, bool bAddToList = true);
+
+ // Sets the current scrolling position
+ void setScrollPosition(const RMPoint &scroll);
+
+ // Overloading of check whether to remove from active list
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ // Overloaded Draw
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Overloaded priority: it's based on Z ordering
+ virtual int priority();
+
+ // Pattern number
+ int numPattern();
+
+ // Set anew animation pattern, changing abruptly from the current
+ virtual void setPattern(int nPattern, bool bPlayP0 = false);
+
+ // Set a new status
+ void setStatus(int nStatus);
+
+ bool isIn(const RMPoint &pt, int *size = NULL);
+ RMPoint getHotspot();
+ bool getName(Common::String &name);
+ int mpalCode();
+
+ // Unload
+ void unload();
+
+ // Wait for the end of the current pattern
+ void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE);
+
+ // Sets a new hotspot fro the object
+ void changeHotspot(const RMPoint &pt);
+
+ void setInitCurPattern(bool status);
+
+ void playSfx(int nSfx);
+
+ void readFromStream(Common::SeekableReadStream &ds, bool bLOX = false);
+
+ void pauseSound(bool bPause);
+
+protected:
+ // Create a primitive that has as it's task this item
+ virtual RMGfxPrimitive *newItemPrimitive();
+
+ // Allocate memory for the sprites
+ virtual RMGfxSourceBuffer *newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE);
+};
+
+
+#define MAXBOXES 50 // Maximum number of allowed boxes
+#define MAXHOTSPOT 20 // Maximum nimber of allowed hotspots
+
+class RMBox {
+public:
+ struct Hotspot {
+ int _hotx, _hoty; // Hotspot coordinates
+ int _destination; // Hotspot destination
+ };
+
+public:
+ int _left, _top, _right, _bottom; // Vertici bounding boxes
+ int _adj[MAXBOXES]; // List of adjacent bounding boxes
+ int _numHotspot; // Hotspot number
+ uint8 _destZ; // Z value for the bounding box
+ Hotspot _hotspot[MAXHOTSPOT]; // List of hotspots
+
+ bool _bActive;
+ bool _bReversed;
+
+ void readFromStream(Common::ReadStream &ds);
+};
+
+
+class RMBoxLoc {
+public:
+ int _numbBox;
+ RMBox *_boxes;
+
+ void readFromStream(Common::ReadStream &ds);
+
+public:
+ RMBoxLoc();
+ virtual ~RMBoxLoc();
+
+ void recalcAllAdj();
+};
+
+#define GAME_BOXES_SIZE 200
+
+class RMGameBoxes {
+protected:
+ RMBoxLoc *_allBoxes[GAME_BOXES_SIZE];
+ int _nLocBoxes;
+
+public:
+ RMGameBoxes();
+ ~RMGameBoxes();
+
+ void init();
+ void close();
+
+ // Get binding boxes for a given location
+ RMBoxLoc *getBoxes(int nLoc);
+ int getLocBoxesCount() const;
+
+ // Return the box which contains a given point
+ int whichBox(int nLoc, const RMPoint &pt);
+
+ // Check whether a point is inside a given box
+ bool isInBox(int nLoc, int nBox, const RMPoint &pt);
+
+ // Change the status of a box
+ void changeBoxStatus(int nLoc, int nBox, int status);
+
+ // Save state handling
+ int getSaveStateSize();
+ void saveState(byte *buf);
+ void loadState(byte *buf);
+};
+
+class RMCharacter : protected RMItem {
+public:
+ enum Patterns {
+ PAT_STANDUP = 1,
+ PAT_STANDDOWN,
+ PAT_STANDLEFT,
+ PAT_STANDRIGHT,
+ PAT_WALKUP,
+ PAT_WALKDOWN,
+ PAT_WALKLEFT,
+ PAT_WALKRIGHT
+ };
+
+private:
+ enum CharacterStatus {
+ STAND,
+ WALK
+ };
+
+ signed short _walkCount;
+ int _dx, _dy, _olddx, _olddy;
+ float _fx, _fy, _slope;
+ RMPoint _lineStart, _lineEnd, _pathEnd;
+ signed char _walkSpeed, _walkStatus;
+ char _minPath;
+ short _nextBox;
+ short _path[MAXBOXES];
+ short _pathLength, _pathCount;
+ int _curBox;
+
+ CharacterStatus _status;
+ int _curSpeed;
+ bool _bEndOfPath;
+ uint32 _hEndOfPath;
+ OSystem::MutexRef _csMove;
+ int _curLocation;
+ bool _bRemoveFromOT;
+ bool _bMovingWithoutMinpath;
+ RMGameBoxes *_theBoxes;
+
+ RMPoint _fixedScroll;
+
+private:
+ int inWhichBox(const RMPoint &pt);
+
+ short findPath(short source, short destination);
+ RMPoint searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point);
+ RMPoint nearestPoint(const RMPoint &punto);
+
+ void goTo(CORO_PARAM, RMPoint destcoord, bool bReversed = false);
+ short scanLine(const RMPoint &point);
+ RMPoint invScanLine(const RMPoint &point);
+ RMPoint nearestHotSpot(int sourcebox, int destbox);
+
+ void newBoxEntered(int nBox);
+
+protected:
+ bool _bMoving;
+ bool _bDrawNow;
+ bool _bNeedToStop;
+
+public:
+ RMCharacter();
+ virtual ~RMCharacter();
+
+ void linkToBoxes(RMGameBoxes *theBoxes);
+
+ virtual void removeThis(CORO_PARAM, bool &result);
+
+ // Update the position of a character
+ void doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc);
+
+ // Overloaded draw
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // TRUE if you just stopped
+ bool endOfPath();
+
+ // Change the pattern of a character to STOP
+ virtual void stop(CORO_PARAM);
+
+ // Check if the character is moving
+ bool isMoving();
+
+ // Move the character to a certain position
+ void move(CORO_PARAM, RMPoint pt, bool *result = NULL);
+
+ // Place the character in a certain position WITHOUT moving
+ void setPosition(const RMPoint &pt, int newloc = -1);
+
+ // Wait for the end of movement
+ void waitForEndMovement(CORO_PARAM);
+
+ void setFixedScroll(const RMPoint &fix);
+ void setSpeed(int speed);
+};
+
+
+class RMWipe : public RMGfxTask {
+private:
+ bool _bFading;
+ bool _bEndFade;
+ bool _bUnregister;
+ uint32 _hUnregistered;
+ int _nFadeStep;
+ uint32 _hEndOfFade;
+ bool _bMustRegister;
+
+ RMItem _wip0r;
+
+public:
+ RMWipe();
+ virtual ~RMWipe();
+
+ void doFrame(RMGfxTargetBuffer &bigBuf);
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ void initFade(int type);
+ void closeFade();
+ void waitForFadeEnd(CORO_PARAM);
+
+ virtual void unregister();
+ virtual void removeThis(CORO_PARAM, bool &result);
+ virtual int priority();
+};
+
+
+/**
+ * Location
+ */
+class RMLocation : public RMGfxTaskSetPrior {
+public:
+ Common::String _name; // Name
+
+private:
+ RMColorMode _cmode; // Color mode
+ RMGfxSourceBuffer *_buf; // Location picture
+
+ int _nItems; // Number of objects
+ RMItem *_items; // Objects
+
+ RMPoint _curScroll; // Current scroll position
+ RMPoint _fixedScroll;
+
+ RMPoint _prevScroll; // Previous scroll position
+ RMPoint _prevFixedScroll;
+
+public:
+ // @@@@@@@@@@@@@@@@@@@@@@@
+
+ RMPoint TEMPTonyStart;
+ RMPoint TEMPGetTonyStart();
+
+ int TEMPNumLoc;
+ int TEMPGetNumLoc();
+
+public:
+ RMLocation();
+ virtual ~RMLocation();
+
+ // Load variations
+ bool load(Common::SeekableReadStream &ds);
+ bool loadLOX(Common::SeekableReadStream &ds);
+
+ // Unload
+ void unload();
+
+ // Overloaded draw
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Prepare a frame by drawing the location and all it's items
+ void doFrame(RMGfxTargetBuffer *bigBuf);
+
+ // Return the item at a given point
+ RMItem *whichItemIsIn(const RMPoint &pt);
+
+ // Return the item based on it's MPAL code
+ RMItem *getItemFromCode(uint32 dwCode);
+
+ // Set the current scroll position
+ void setScrollPosition(const RMPoint &scroll);
+
+ // Sets an additinal offset for scrolling
+ void setFixedScroll(const RMPoint &scroll);
+
+ // Update the scrolling coordinates to display the specified point
+ void updateScrolling(const RMPoint &ptShowThis);
+
+ // Read the current scroll position
+ RMPoint scrollPosition();
+
+ // Pause sound
+ void pauseSound(bool bPause);
+};
+
+
+/**
+ * MPAL message, composed of more ASCIIZ
+ */
+class RMMessage {
+private:
+ char *_lpMessage;
+ char *_lpPeriods[256];
+ int _nPeriods;
+
+private:
+ void parseMessage();
+
+public:
+ RMMessage();
+ RMMessage(uint32 dwId);
+ virtual ~RMMessage();
+
+ void load(uint32 dwId);
+ bool isValid();
+ int numPeriods();
+ char *period(int num);
+ char *operator[](int num);
+};
+
+} // End of namespace Tony
+
+#endif /* TONY_H */
diff --git a/engines/tony/module.mk b/engines/tony/module.mk
new file mode 100644
index 0000000000..d66cf6f065
--- /dev/null
+++ b/engines/tony/module.mk
@@ -0,0 +1,33 @@
+MODULE := engines/tony
+
+MODULE_OBJS := \
+ custom.o \
+ debugger.o \
+ detection.o \
+ font.o \
+ game.o \
+ gfxcore.o \
+ gfxengine.o \
+ globals.o \
+ input.o \
+ inventory.o \
+ loc.o \
+ sound.o \
+ tony.o \
+ tonychar.o \
+ utils.o \
+ window.o \
+ mpal/expr.o \
+ mpal/loadmpc.o \
+ mpal/memory.o \
+ mpal/mpal.o \
+ mpal/mpalutils.o \
+ mpal/lzo.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_TONY), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp
new file mode 100644
index 0000000000..824cd91651
--- /dev/null
+++ b/engines/tony/mpal/expr.cpp
@@ -0,0 +1,365 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "tony/mpal/mpal.h"
+#include "tony/mpal/memory.h"
+#include "tony/mpal/mpaldll.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+
+/**
+ * Duplicate a mathematical expression.
+ *
+ * @param h Handle to the original expression
+ * @retruns Pointer to the cloned expression
+ */
+static byte *duplicateExpression(MpalHandle h) {
+ byte *orig, *clone;
+
+ orig = (byte *)globalLock(h);
+
+ int num = *(byte *)orig;
+ LpExpression one = (LpExpression)(orig+1);
+
+ clone = (byte *)globalAlloc(GMEM_FIXED, sizeof(Expression) * num + 1);
+ LpExpression two = (LpExpression)(clone + 1);
+
+ memcpy(clone, orig, sizeof(Expression) * num + 1);
+
+ for (int i = 0; i < num; i++) {
+ if (one->_type == ELT_PARENTH) {
+ two->_type = ELT_PARENTH2;
+ two->_val._pson = duplicateExpression(two->_val._son);
+ }
+
+ ++one;
+ ++two;
+ }
+
+ globalUnlock(h);
+ return clone;
+}
+
+static int Compute(int a, int b, byte symbol) {
+ switch (symbol) {
+ case OP_MUL:
+ return a * b;
+ case OP_DIV:
+ return a / b;
+ case OP_MODULE:
+ return a % b;
+ case OP_ADD:
+ return a + b;
+ case OP_SUB:
+ return a - b;
+ case OP_SHL:
+ return a << b;
+ case OP_SHR:
+ return a >> b;
+ case OP_MINOR:
+ return a < b;
+ case OP_MAJOR:
+ return a > b;
+ case OP_MINEQ:
+ return a <= b;
+ case OP_MAJEQ:
+ return a >= b;
+ case OP_EQUAL:
+ return a == b;
+ case OP_NOEQUAL:
+ return a != b;
+ case OP_BITAND:
+ return a & b;
+ case OP_BITXOR:
+ return a ^ b;
+ case OP_BITOR:
+ return a | b;
+ case OP_AND:
+ return a && b;
+ case OP_OR:
+ return a || b;
+ default:
+ GLOBALS._mpalError = 1;
+ break;
+ }
+
+ return 0;
+}
+
+static void solve(LpExpression one, int num) {
+ LpExpression two, three;
+
+ while (num > 1) {
+ two = one + 1;
+ if ((two->_symbol == 0) || (one->_symbol & 0xF0) <= (two->_symbol & 0xF0)) {
+ two->_val._num = Compute(one->_val._num, two->_val._num, one->_symbol);
+ memmove(one, two, (num - 1) * sizeof(Expression));
+ --num;
+ } else {
+ int j = 1;
+ three = two + 1;
+ while ((three->_symbol != 0) && (two->_symbol & 0xF0) > (three->_symbol & 0xF0)) {
+ ++two;
+ ++three;
+ ++j;
+ }
+
+ three->_val._num = Compute(two->_val._num, three->_val._num, two->_symbol);
+ memmove(two, three, (num - j - 1) * sizeof(Expression));
+ --num;
+ }
+ }
+}
+
+
+/**
+ * Calculates the result of a mathematical expression, replacing the current
+ * value of any variable.
+ *
+ * @param expr Pointer to an expression duplicated by DuplicateExpression
+ * @returns Value
+ */
+static int evaluateAndFreeExpression(byte *expr) {
+ int num = *expr;
+ LpExpression one = (LpExpression)(expr + 1);
+
+ // 1) Substitutions of variables
+ LpExpression cur = one;
+ for (int i = 0; i < num; i++, cur++) {
+ if (cur->_type == ELT_VAR) {
+ cur->_type = ELT_NUMBER;
+ cur->_val._num = varGetValue(cur->_val._name);
+ }
+ }
+
+ // 2) Replacement of brackets (using recursive calls)
+ cur = one;
+ for (int i = 0; i < num; i++, cur++) {
+ if (cur->_type == ELT_PARENTH2) {
+ cur->_type = ELT_NUMBER;
+ cur->_val._num = evaluateAndFreeExpression(cur->_val._pson);
+ }
+ }
+
+ // 3) algebraic resolution
+ solve(one, num);
+ int val = one->_val._num;
+ globalDestroy(expr);
+
+ return val;
+}
+
+
+/**
+ * Parses a mathematical expression from the MPC file
+ *
+ * @param buf Buffer containing the expression to evaluate
+ * @param h Pointer to a handle that, at the end of execution,
+ * will point to the area of memory containing the parsed expression
+ * @returns Pointer to the buffer immediately after the expression, or NULL if error.
+ */
+const byte *parseExpression(const byte *lpBuf, MpalHandle *h) {
+ byte *start;
+
+ uint32 num = *lpBuf;
+ lpBuf++;
+
+ if (num == 0)
+ return NULL;
+
+ *h = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, num * sizeof(Expression) + 1);
+ if (*h == NULL)
+ return NULL;
+
+ start = (byte *)globalLock(*h);
+ *start = (byte)num;
+
+ LpExpression cur = (LpExpression)(start + 1);
+
+ for (uint32 i = 0;i < num; i++) {
+ cur->_type = *(lpBuf);
+
+ // *(lpBuf + 1) contains the unary operator, unused => skipped
+ lpBuf += 2;
+
+ switch (cur->_type) {
+ case ELT_NUMBER:
+ cur->_val._num = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ break;
+
+ case ELT_VAR:
+ cur->_val._name = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, (*lpBuf) + 1);
+ if (cur->_val._name == NULL)
+ return NULL;
+ memcpy(cur->_val._name, lpBuf + 1, *lpBuf);
+ lpBuf += *lpBuf + 1;
+ break;
+
+ case ELT_PARENTH:
+ lpBuf = parseExpression(lpBuf, &cur->_val._son);
+ if (lpBuf == NULL)
+ return NULL;
+ break;
+
+ default:
+ return NULL;
+ }
+
+ cur->_symbol = *lpBuf;
+ lpBuf++;
+
+ cur++;
+ }
+
+ if (*lpBuf != 0)
+ return NULL;
+
+ lpBuf++;
+
+ return lpBuf;
+}
+
+
+/**
+ * Calculate the value of a mathamatical expression
+ *
+ * @param h Handle to the expression
+ * @returns Numeric value
+ */
+int evaluateExpression(MpalHandle h) {
+ lockVar();
+ int ret = evaluateAndFreeExpression(duplicateExpression(h));
+ unlockVar();
+
+ return ret;
+}
+
+/**
+ * Compare two mathematical expressions together
+ *
+ * @param h1 Expression to be compared
+ * @param h2 Expression to be compared
+ */
+bool compareExpressions(MpalHandle h1, MpalHandle h2) {
+ byte *e1, *e2;
+
+ e1 = (byte *)globalLock(h1);
+ e2 = (byte *)globalLock(h2);
+
+ int num1 = *(byte *)e1;
+ int num2 = *(byte *)e2;
+
+ if (num1 != num2) {
+ globalUnlock(h1);
+ globalUnlock(h2);
+ return false;
+ }
+
+ LpExpression one = (LpExpression)(e1 + 1);
+ LpExpression two = (LpExpression)(e2 + 1);
+
+ for (int i = 0; i < num1; i++) {
+ if (one->_type != two->_type || (i != num1 - 1 && one->_symbol != two->_symbol)) {
+ globalUnlock(h1);
+ globalUnlock(h2);
+ return false;
+ }
+
+ switch (one->_type) {
+ case ELT_NUMBER:
+ if (one->_val._num != two->_val._num) {
+ globalUnlock(h1);
+ globalUnlock(h2);
+ return false;
+ }
+ break;
+
+ case ELT_VAR:
+ if (strcmp(one->_val._name, two->_val._name) != 0) {
+ globalUnlock(h1);
+ globalUnlock(h2);
+ return false;
+ }
+ break;
+
+ case ELT_PARENTH:
+ if (!compareExpressions(one->_val._son, two->_val._son)) {
+ globalUnlock(h1);
+ globalUnlock(h2);
+ return false;
+ }
+ break;
+ }
+
+ ++one;
+ ++two;
+ }
+
+ globalUnlock(h1);
+ globalUnlock(h2);
+
+ return true;
+}
+
+/**
+ * Frees an expression that was previously parsed
+ *
+ * @param h Handle for the expression
+ */
+void freeExpression(MpalHandle h) {
+ byte *data = (byte *)globalLock(h);
+ int num = *data;
+ LpExpression cur = (LpExpression)(data + 1);
+
+ for (int i = 0; i < num; ++i, ++cur) {
+ switch (cur->_type) {
+ case ELT_VAR:
+ globalDestroy(cur->_val._name);
+ break;
+
+ case ELT_PARENTH:
+ freeExpression(cur->_val._son);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ globalUnlock(h);
+ globalFree(h);
+}
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h
new file mode 100644
index 0000000000..405624b4fe
--- /dev/null
+++ b/engines/tony/mpal/expr.h
@@ -0,0 +1,140 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef MPAL_EXPR_H
+#define MPAL_EXPR_H
+
+#include "tony/mpal/memory.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/**
+ * @defgroup Mathamatical operations
+ */
+//@{
+
+#define OP_MUL ((1 << 4) | 0)
+#define OP_DIV ((1 << 4) | 1)
+#define OP_MODULE ((1 << 4) | 2)
+#define OP_ADD ((2 << 4) | 0)
+#define OP_SUB ((2 << 4) | 1)
+#define OP_SHL ((3 << 4) | 0)
+#define OP_SHR ((3 << 4) | 1)
+#define OP_MINOR ((4 << 4) | 0)
+#define OP_MAJOR ((4 << 4) | 1)
+#define OP_MINEQ ((4 << 4) | 2)
+#define OP_MAJEQ ((4 << 4) | 3)
+#define OP_EQUAL ((5 << 4) | 0)
+#define OP_NOEQUAL ((5 << 4) | 1)
+#define OP_BITAND ((6 << 4) | 0)
+#define OP_BITXOR ((7 << 4) | 0)
+#define OP_BITOR ((8 << 4) | 0)
+#define OP_AND ((9 << 4) | 0)
+#define OP_OR ((10 << 4) | 0)
+
+//@}
+
+/**
+ * @defgroup Structures
+ */
+
+//@{
+/**
+ * Mathamatical framework to manage operations
+ */
+typedef struct {
+ byte _type; // Object Type (see enum ExprListTypes)
+
+ union {
+ int _num; // Identifier (if type == ELT_NUMBER)
+ char *_name; // Variable name (if type == ELT_VAR)
+ MpalHandle _son; // Handle expressions (if type == ELT_PARENTH)
+ byte *_pson; // Handle lockato (if type == ELT_PARENTH2)
+ } _val;
+
+ byte _symbol; // Mathematic symbols (see #define OP_*)
+
+} Expression;
+typedef Expression *LpExpression;
+
+//@}
+
+/**
+ * Object types that can be contained in an EXPRESSION structure
+ */
+enum ExprListTypes {
+ ELT_NUMBER = 1,
+ ELT_VAR = 2,
+ ELT_PARENTH = 3,
+ ELT_PARENTH2 = 4
+};
+
+/****************************************************************************\
+* Function Prototypes
+\****************************************************************************/
+
+/**
+ * Parses a mathematical expression from the MPC file
+ *
+ * @param buf Buffer containing the expression to evaluate
+ * @param h Pointer to a handle that, at the end of execution,
+ * will point to the area of memory containing the parsed expression
+ * @returns Pointer to the buffer immediately after the expression, or NULL if error.
+ */
+const byte *parseExpression(const byte *lpBuf, MpalHandle *h);
+
+/**
+ * Calculate the value of a mathamatical expression
+ *
+ * @param h Handle to the expression
+ * @returns Numeric value
+ */
+int evaluateExpression(MpalHandle h);
+
+/**
+ * Compare two mathematical expressions together
+ *
+ * @param h1 Expression to be compared
+ * @param h2 Expression to be compared
+ */
+bool compareExpressions(MpalHandle h1, MpalHandle h2);
+
+/**
+ * Frees an expression that was previously parsed
+ *
+ * @param h Handle for the expression
+ */
+void freeExpression(MpalHandle h);
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp
new file mode 100644
index 0000000000..9c45cdf982
--- /dev/null
+++ b/engines/tony/mpal/loadmpc.cpp
@@ -0,0 +1,788 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "mpal.h"
+#include "mpaldll.h"
+#include "memory.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* Static functions
+\****************************************************************************/
+
+static bool compareCommands(struct Command *cmd1, struct Command *cmd2) {
+ if (cmd1->_type == 2 && cmd2->_type == 2) {
+ if (strcmp(cmd1->_lpszVarName, cmd2->_lpszVarName) == 0 &&
+ compareExpressions(cmd1->_expr, cmd2->_expr))
+ return true;
+ else
+ return false;
+ } else
+ return (memcmp(cmd1, cmd2, sizeof(struct Command)) == 0);
+}
+
+/**
+ * Parses a script from the MPC file, and inserts its data into a structure
+ *
+ * @param lpBuf Buffer containing the compiled script.
+ * @param lpmsScript Pointer to a structure that will be filled with the
+ * data of the script.
+ * @returns Pointer to the buffer after the item, or NULL on failure.
+ */
+static const byte *ParseScript(const byte *lpBuf, LpMpalScript lpmsScript) {
+ lpmsScript->_nObj = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ lpmsScript->_nMoments = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ int curCmd = 0;
+
+ for (uint i = 0; i < lpmsScript->_nMoments; i++) {
+ lpmsScript->_moment[i]._dwTime = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmsScript->_moment[i]._nCmds = *lpBuf;
+ lpBuf++;
+
+ for (int j = 0; j < lpmsScript->_moment[i]._nCmds; j++) {
+ lpmsScript->_command[curCmd]._type = *lpBuf;
+ lpBuf++;
+ switch (lpmsScript->_command[curCmd]._type) {
+ case 1:
+ lpmsScript->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmsScript->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmsScript->_command[curCmd]._arg2 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmsScript->_command[curCmd]._arg3 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmsScript->_command[curCmd]._arg4 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ break;
+
+ case 2: { // Variable assign
+ int len = *lpBuf;
+ lpBuf++;
+ lpmsScript->_command[curCmd]._lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
+ if (lpmsScript->_command[curCmd]._lpszVarName == NULL)
+ return NULL;
+ memcpy(lpmsScript->_command[curCmd]._lpszVarName, lpBuf, len);
+ lpBuf += len;
+
+ lpBuf = parseExpression(lpBuf, &lpmsScript->_command[curCmd]._expr);
+ if (lpBuf == NULL)
+ return NULL;
+ break;
+ }
+ default:
+ return NULL;
+ }
+
+ lpmsScript->_moment[i]._cmdNum[j] = curCmd;
+ curCmd++;
+ }
+ }
+ return lpBuf;
+}
+
+/**
+ * Frees a script allocated via a previous call to ParseScript
+ *
+ * @param lpmsScript Pointer to a script structure
+ */
+static void FreeScript(LpMpalScript lpmsScript) {
+ for (int i = 0; i < MAX_COMMANDS_PER_SCRIPT && (lpmsScript->_command[i]._type); ++i, ++lpmsScript) {
+ if (lpmsScript->_command[i]._type == 2) {
+ // Variable Assign
+ globalDestroy(lpmsScript->_command[i]._lpszVarName);
+ freeExpression(lpmsScript->_command[i]._expr);
+ }
+ }
+}
+
+/**
+ * Parses a dialog from the MPC file, and inserts its data into a structure
+ *
+ * @param lpBuf Buffer containing the compiled dialog.
+ * @param lpmdDialog Pointer to a structure that will be filled with the
+ * data of the dialog.
+ * @returns Pointer to the buffer after the item, or NULL on failure.
+ */
+static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
+ byte *lpLock;
+
+ lpmdDialog->_nObj = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ // Periods
+ uint32 num = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ if (num >= MAX_PERIODS_PER_DIALOG - 1)
+ error("Too much periods in dialog #%d", lpmdDialog->_nObj);
+
+ uint32 i;
+ for (i = 0; i < num; i++) {
+ lpmdDialog->_periodNums[i] = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmdDialog->_periods[i] = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, *lpBuf + 1);
+ lpLock = (byte *)globalLock(lpmdDialog->_periods[i]);
+ Common::copy(lpBuf + 1, lpBuf + 1 + *lpBuf, lpLock);
+ globalUnlock(lpmdDialog->_periods[i]);
+ lpBuf += (*lpBuf) + 1;
+ }
+
+ lpmdDialog->_periodNums[i] = 0;
+ lpmdDialog->_periods[i] = NULL;
+
+ // Groups
+ num = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ uint32 curCmd = 0;
+
+ if (num >= MAX_GROUPS_PER_DIALOG)
+ error("Too much groups in dialog #%d", lpmdDialog->_nObj);
+
+ for (i = 0; i < num; i++) {
+ lpmdDialog->_group[i]._num = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmdDialog->_group[i]._nCmds = *lpBuf; lpBuf++;
+
+ if (lpmdDialog->_group[i]._nCmds >= MAX_COMMANDS_PER_GROUP)
+ error("Too much commands in group #%d in dialog #%d", lpmdDialog->_group[i]._num, lpmdDialog->_nObj);
+
+ for (uint32 j = 0; j < lpmdDialog->_group[i]._nCmds; j++) {
+ lpmdDialog->_command[curCmd]._type = *lpBuf;
+ lpBuf++;
+
+ switch (lpmdDialog->_command[curCmd]._type) {
+ // Call custom function
+ case 1:
+ lpmdDialog->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmdDialog->_command[curCmd]._arg1 = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmdDialog->_command[curCmd]._arg2 = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmdDialog->_command[curCmd]._arg3 = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmdDialog->_command[curCmd]._arg4 = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ break;
+
+ // Variable assign
+ case 2: {
+ uint32 len = *lpBuf;
+ lpBuf++;
+ lpmdDialog->_command[curCmd]._lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
+ if (lpmdDialog->_command[curCmd]._lpszVarName == NULL)
+ return NULL;
+
+ Common::copy(lpBuf, lpBuf + len, lpmdDialog->_command[curCmd]._lpszVarName);
+ lpBuf += len;
+
+ lpBuf = parseExpression(lpBuf, &lpmdDialog->_command[curCmd]._expr);
+ if (lpBuf == NULL)
+ return NULL;
+ break;
+ }
+ // Do Choice
+ case 3:
+ lpmdDialog->_command[curCmd]._nChoice = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ break;
+
+ default:
+ return NULL;
+ }
+
+ uint32 kk;
+ for (kk = 0;kk < curCmd; kk++) {
+ if (compareCommands(&lpmdDialog->_command[kk], &lpmdDialog->_command[curCmd])) {
+ lpmdDialog->_group[i]._cmdNum[j] = kk;
+
+ // Free any data allocated for the duplictaed command
+ if (lpmdDialog->_command[curCmd]._type == 2) {
+ globalDestroy(lpmdDialog->_command[curCmd]._lpszVarName);
+ freeExpression(lpmdDialog->_command[curCmd]._expr);
+
+ lpmdDialog->_command[curCmd]._lpszVarName = NULL;
+ lpmdDialog->_command[curCmd]._expr = 0;
+ lpmdDialog->_command[curCmd]._type = 0;
+ }
+ break;
+ }
+ }
+
+ if (kk == curCmd) {
+ lpmdDialog->_group[i]._cmdNum[j] = curCmd;
+ curCmd++;
+ }
+ }
+ }
+
+ if (curCmd >= MAX_COMMANDS_PER_DIALOG)
+ error("Too much commands in dialog #%d", lpmdDialog->_nObj);
+
+ // Choices
+ num = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ if (num >= MAX_CHOICES_PER_DIALOG)
+ error("Too much choices in dialog #%d", lpmdDialog->_nObj);
+
+ for (i = 0; i < num; i++) {
+ lpmdDialog->_choice[i]._nChoice = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ uint32 num2 = *lpBuf++;
+
+ if (num2 >= MAX_SELECTS_PER_CHOICE)
+ error("Too much selects in choice #%d in dialog #%d", lpmdDialog->_choice[i]._nChoice, lpmdDialog->_nObj);
+
+ for (uint32 j = 0; j < num2; j++) {
+ // When
+ switch (*lpBuf++) {
+ case 0:
+ lpmdDialog->_choice[i]._select[j]._when = NULL;
+ break;
+
+ case 1:
+ lpBuf = parseExpression(lpBuf, &lpmdDialog->_choice[i]._select[j]._when);
+ if (lpBuf == NULL)
+ return NULL;
+ break;
+
+ case 2:
+ return NULL;
+ }
+
+ // Attrib
+ lpmdDialog->_choice[i]._select[j]._attr = *lpBuf++;
+
+ // Data
+ lpmdDialog->_choice[i]._select[j]._dwData = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ // PlayGroup
+ uint32 num3 = *lpBuf++;
+
+ if (num3 >= MAX_PLAYGROUPS_PER_SELECT)
+ error("Too much playgroups in select #%d in choice #%d in dialog #%d", j, lpmdDialog->_choice[i]._nChoice, lpmdDialog->_nObj);
+
+ for (uint32 z = 0; z < num3; z++) {
+ lpmdDialog->_choice[i]._select[j]._wPlayGroup[z] = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ }
+
+ lpmdDialog->_choice[i]._select[j]._wPlayGroup[num3] = 0;
+ }
+
+ // Mark the last selection
+ lpmdDialog->_choice[i]._select[num2]._dwData = 0;
+ }
+
+ lpmdDialog->_choice[num]._nChoice = 0;
+
+ return lpBuf;
+}
+
+
+/**
+ * Parses an item from the MPC file, and inserts its data into a structure
+ *
+ * @param lpBuf Buffer containing the compiled dialog.
+ * @param lpmiItem Pointer to a structure that will be filled with the
+ * data of the item.
+ * @returns Pointer to the buffer after the item, or NULL on failure.
+ * @remarks It's necessary that the structure that is passed has been
+ * completely initialized to 0 beforehand.
+ */
+static const byte *parseItem(const byte *lpBuf, LpMpalItem lpmiItem) {
+ lpmiItem->_nObj = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ byte len = *lpBuf;
+ lpBuf++;
+ memcpy(lpmiItem->_lpszDescribe, lpBuf, MIN((byte)127, len));
+ lpBuf += len;
+
+ if (len >= MAX_DESCRIBE_SIZE)
+ error("Describe too long in item #%d", lpmiItem->_nObj);
+
+ lpmiItem->_nActions=*lpBuf;
+ lpBuf++;
+
+ // Allocation action
+ if (lpmiItem->_nActions > 0)
+ lpmiItem->_action = (ItemAction *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(struct ItemAction) * (int)lpmiItem->_nActions);
+
+ uint32 curCmd = 0;
+
+ for (uint32 i = 0; i < lpmiItem->_nActions; i++) {
+ lpmiItem->_action[i]._num = *lpBuf;
+ lpBuf++;
+
+ lpmiItem->_action[i]._wParm = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ if (lpmiItem->_action[i]._num == 0xFF) {
+ lpmiItem->_action[i]._wTime = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ lpmiItem->_action[i]._perc = *lpBuf;
+ lpBuf++;
+ }
+
+ if (*lpBuf == 0) {
+ lpBuf++;
+ lpmiItem->_action[i]._when = NULL;
+ } else {
+ lpBuf++;
+ lpBuf = parseExpression(lpBuf,&lpmiItem->_action[i]._when);
+ if (lpBuf == NULL)
+ return NULL;
+ }
+
+ lpmiItem->_action[i]._nCmds=*lpBuf;
+ lpBuf++;
+
+ if (lpmiItem->_action[i]._nCmds >= MAX_COMMANDS_PER_ACTION)
+ error("Too much commands in action #%d in item #%d", lpmiItem->_action[i]._num, lpmiItem->_nObj);
+
+ for (uint32 j = 0; j < lpmiItem->_action[i]._nCmds; j++) {
+ lpmiItem->_command[curCmd]._type = *lpBuf;
+ lpBuf++;
+ switch (lpmiItem->_command[curCmd]._type) {
+ case 1: // Call custom function
+ lpmiItem->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmiItem->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmiItem->_command[curCmd]._arg2 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmiItem->_command[curCmd]._arg3 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmiItem->_command[curCmd]._arg4 = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ break;
+
+ case 2: // Variable assign
+ len = *lpBuf;
+ lpBuf++;
+ lpmiItem->_command[curCmd]._lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
+ if (lpmiItem->_command[curCmd]._lpszVarName == NULL)
+ return NULL;
+ memcpy(lpmiItem->_command[curCmd]._lpszVarName, lpBuf, len);
+ lpBuf += len;
+
+ lpBuf = parseExpression(lpBuf, &lpmiItem->_command[curCmd]._expr);
+ if (lpBuf == NULL)
+ return NULL;
+ break;
+
+ default:
+ return NULL;
+ }
+
+ uint32 kk;
+ for (kk = 0; kk < curCmd; kk++) {
+ if (compareCommands(&lpmiItem->_command[kk], &lpmiItem->_command[curCmd])) {
+ lpmiItem->_action[i]._cmdNum[j] = kk;
+
+ // Free any data allocated for the duplictaed command
+ if (lpmiItem->_command[curCmd]._type == 2) {
+ globalDestroy(lpmiItem->_command[curCmd]._lpszVarName);
+ freeExpression(lpmiItem->_command[curCmd]._expr);
+
+ lpmiItem->_command[curCmd]._lpszVarName = NULL;
+ lpmiItem->_command[curCmd]._expr = 0;
+ lpmiItem->_command[curCmd]._type = 0;
+ }
+ break;
+ }
+ }
+
+ if (kk == curCmd) {
+ lpmiItem->_action[i]._cmdNum[j] = curCmd;
+ curCmd++;
+
+ if (curCmd >= MAX_COMMANDS_PER_ITEM) {
+ error("Too much commands in item #%d", lpmiItem->_nObj);
+ //curCmd=0;
+ }
+ }
+ }
+ }
+
+ lpmiItem->_dwRes = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ return lpBuf;
+}
+
+/**
+ * Frees an item parsed from a prior call to ParseItem
+ *
+ * @param lpmiItem Pointer to an item structure
+ */
+static void freeItem(LpMpalItem lpmiItem) {
+ // Free the actions
+ if (lpmiItem->_action) {
+ for (int i = 0; i < lpmiItem->_nActions; ++i) {
+ if (lpmiItem->_action[i]._when != 0)
+ freeExpression(lpmiItem->_action[i]._when);
+ }
+
+ globalDestroy(lpmiItem->_action);
+ }
+
+ // Free the commands
+ for (int i = 0; i < MAX_COMMANDS_PER_ITEM && (lpmiItem->_command[i]._type); ++i) {
+ if (lpmiItem->_command[i]._type == 2) {
+ // Variable Assign
+ globalDestroy(lpmiItem->_command[i]._lpszVarName);
+ freeExpression(lpmiItem->_command[i]._expr);
+ }
+ }
+}
+
+/**
+ * Parses a location from the MPC file, and inserts its data into a structure
+ *
+ * @param lpBuf Buffer containing the compiled location.
+ * @param lpmiLocation Pointer to a structure that will be filled with the
+ * data of the location.
+ * @returns Pointer to the buffer after the location, or NULL on failure.
+ */
+static const byte *ParseLocation(const byte *lpBuf, LpMpalLocation lpmlLocation) {
+ lpmlLocation->_nObj = (int32)READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+ lpmlLocation->_dwXlen = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmlLocation->_dwYlen = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+ lpmlLocation->_dwPicRes = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ return lpBuf;
+}
+
+
+/****************************************************************************\
+* Exported functions
+\****************************************************************************/
+/**
+ * @defgroup Exported functions
+ */
+//@{
+
+/**
+ * Reads and interprets the MPC file, and create structures for various directives
+ * in the global variables
+ *
+ * @param lpBuf Buffer containing the MPC file data, excluding the header.
+ * @returns True if succeeded OK, false if failure.
+ */
+bool parseMpc(const byte *lpBuf) {
+ byte *lpTemp;
+
+ // 1. Variables
+ if (lpBuf[0] != 'V' || lpBuf[1] != 'A' || lpBuf[2] != 'R' || lpBuf[3] != 'S')
+ return false;
+
+ lpBuf += 4;
+ GLOBALS._nVars = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ GLOBALS._hVars = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MpalVar) * (uint32)GLOBALS._nVars);
+ if (GLOBALS._hVars == NULL)
+ return false;
+
+ GLOBALS._lpmvVars = (LpMpalVar)globalLock(GLOBALS._hVars);
+
+ for (uint16 i = 0; i < GLOBALS._nVars; i++) {
+ uint16 wLen = *(const byte *)lpBuf;
+ lpBuf++;
+ memcpy(GLOBALS._lpmvVars->_lpszVarName, lpBuf, MIN(wLen, (uint16)32));
+ lpBuf += wLen;
+ GLOBALS._lpmvVars->_dwVal = READ_LE_UINT32(lpBuf);
+ lpBuf += 4;
+
+ lpBuf++; // Skip 'ext'
+ GLOBALS._lpmvVars++;
+ }
+
+ globalUnlock(GLOBALS._hVars);
+
+ // 2. Messages
+ if (lpBuf[0] != 'M' || lpBuf[1] != 'S' || lpBuf[2] != 'G' || lpBuf[3] != 'S')
+ return false;
+
+ lpBuf += 4;
+ GLOBALS._nMsgs = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+#ifdef NEED_LOCK_MSGS
+ GLOBALS._hMsgs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MpalMsg) * (uint32)GLOBALS._nMsgs);
+ if (GLOBALS._hMsgs == NULL)
+ return false;
+
+ GLOBALS._lpmmMsgs = (LpMpalMsg)globalLock(GLOBALS._hMsgs);
+#else
+ GLOBALS._lpmmMsgs=(LPMPALMSG)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS._nMsgs);
+ if (GLOBALS._lpmmMsgs==NULL)
+ return false;
+#endif
+
+ for (uint16 i = 0; i < GLOBALS._nMsgs; i++) {
+ GLOBALS._lpmmMsgs->_wNum = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ uint16 j;
+ for (j = 0; lpBuf[j] != 0;)
+ j += lpBuf[j] + 1;
+
+ GLOBALS._lpmmMsgs->_hText = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1);
+ lpTemp = (byte *)globalLock(GLOBALS._lpmmMsgs->_hText);
+
+ for (j = 0; lpBuf[j] != 0;) {
+ memcpy(lpTemp, &lpBuf[j + 1], lpBuf[j]);
+ lpTemp += lpBuf[j];
+ *lpTemp ++= '\0';
+ j += lpBuf[j] + 1;
+ }
+
+ lpBuf += j + 1;
+ *lpTemp = '\0';
+
+ globalUnlock(GLOBALS._lpmmMsgs->_hText);
+ GLOBALS._lpmmMsgs++;
+ }
+
+#ifdef NEED_LOCK_MSGS
+ globalUnlock(GLOBALS._hMsgs);
+#endif
+
+ // 3. Objects
+ if (lpBuf[0] != 'O' || lpBuf[1] != 'B' || lpBuf[2] != 'J' || lpBuf[3] != 'S')
+ return false;
+
+ lpBuf += 4;
+ GLOBALS._nObjs = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ // Check out the dialogs
+ GLOBALS._nDialogs = 0;
+ GLOBALS._hDialogs = GLOBALS._lpmdDialogs = NULL;
+ if (*((const byte *)lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Dialog", 6) == 0) {
+ GLOBALS._nDialogs = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ GLOBALS._hDialogs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nDialogs * sizeof(MpalDialog));
+ if (GLOBALS._hDialogs == NULL)
+ return false;
+
+ GLOBALS._lpmdDialogs = (LpMpalDialog)globalLock(GLOBALS._hDialogs);
+
+ for (uint16 i = 0; i < GLOBALS._nDialogs; i++) {
+ if ((lpBuf = parseDialog(lpBuf + 7, &GLOBALS._lpmdDialogs[i])) == NULL)
+ return false;
+ }
+
+ globalUnlock(GLOBALS._hDialogs);
+ }
+
+ // Check the items
+ GLOBALS._nItems = 0;
+ GLOBALS._hItems = GLOBALS._lpmiItems = NULL;
+ if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4) == 0) {
+ GLOBALS._nItems = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ // Allocate memory and read them in
+ GLOBALS._hItems = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nItems * sizeof(MpalItem));
+ if (GLOBALS._hItems == NULL)
+ return false;
+
+ GLOBALS._lpmiItems = (LpMpalItem)globalLock(GLOBALS._hItems);
+
+ for (uint16 i = 0; i < GLOBALS._nItems; i++) {
+ if ((lpBuf = parseItem(lpBuf + 5, &GLOBALS._lpmiItems[i])) == NULL)
+ return false;
+ }
+
+ globalUnlock(GLOBALS._hItems);
+ }
+
+ // Check the locations
+ GLOBALS._nLocations = 0;
+ GLOBALS._hLocations = GLOBALS._lpmlLocations = NULL;
+ if (*(lpBuf + 2) == 8 && strncmp((const char *)lpBuf + 3, "Location", 8) == 0) {
+ GLOBALS._nLocations = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ // Allocate memory and read them in
+ GLOBALS._hLocations = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nLocations * sizeof(MpalLocation));
+ if (GLOBALS._hLocations == NULL)
+ return false;
+
+ GLOBALS._lpmlLocations = (LpMpalLocation)globalLock(GLOBALS._hLocations);
+
+ for (uint16 i = 0; i < GLOBALS._nLocations; i++) {
+ if ((lpBuf = ParseLocation(lpBuf + 9, &GLOBALS._lpmlLocations[i])) == NULL)
+ return false;
+ }
+
+ globalUnlock(GLOBALS._hLocations);
+ }
+
+ // Check the scripts
+ GLOBALS._nScripts = 0;
+ GLOBALS._hScripts = GLOBALS._lpmsScripts = NULL;
+ if (*(lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Script", 6) == 0) {
+ GLOBALS._nScripts = READ_LE_UINT16(lpBuf);
+ lpBuf += 2;
+
+ // Allocate memory
+ GLOBALS._hScripts = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nScripts * sizeof(MpalScript));
+ if (GLOBALS._hScripts == NULL)
+ return false;
+
+ GLOBALS._lpmsScripts = (LpMpalScript)globalLock(GLOBALS._hScripts);
+
+ for (uint16 i = 0; i < GLOBALS._nScripts; i++) {
+ if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS._lpmsScripts[i])) == NULL)
+ return false;
+
+ // Sort the various moments of the script
+ //qsort(
+ //GLOBALS.lpmsScripts[i].Moment,
+ //GLOBALS.lpmsScripts[i].nMoments,
+ //sizeof(GLOBALS.lpmsScripts[i].Moment[0]),
+ //(int (*)(const void *, const void *))CompareMoments
+ //);
+ }
+
+ globalUnlock(GLOBALS._hScripts);
+ }
+
+ if (lpBuf[0] != 'E' || lpBuf[1] != 'N' || lpBuf[2] != 'D' || lpBuf[3] != '0')
+ return false;
+
+ return true;
+}
+
+/**
+ * Free the given dialog
+ */
+static void freeDialog(LpMpalDialog lpmdDialog) {
+ // Free the periods
+ for (int i = 0; i < MAX_PERIODS_PER_DIALOG && (lpmdDialog->_periods[i]); ++i)
+ globalFree(lpmdDialog->_periods[i]);
+
+ for (int i = 0; i < MAX_COMMANDS_PER_DIALOG && (lpmdDialog->_command[i]._type); i++) {
+ if (lpmdDialog->_command[i]._type == 2) {
+ // Variable assign
+ globalDestroy(lpmdDialog->_command[i]._lpszVarName);
+ freeExpression(lpmdDialog->_command[i]._expr);
+ }
+ }
+
+ // Free the choices
+ for (int i = 0; i < MAX_CHOICES_PER_DIALOG; ++i) {
+ for (int j = 0; j < MAX_SELECTS_PER_CHOICE; j++) {
+ if (lpmdDialog->_choice[i]._select[j]._when)
+ freeExpression(lpmdDialog->_choice[i]._select[j]._when);
+ }
+ }
+}
+
+/**
+ * Frees any data allocated from the parsing of the MPC file
+ */
+void freeMpc() {
+ // Free variables
+ globalFree(GLOBALS._hVars);
+
+ // Free messages
+ LpMpalMsg lpmmMsgs = (LpMpalMsg)globalLock(GLOBALS._hMsgs);
+ for (int i = 0; i < GLOBALS._nMsgs; i++, ++lpmmMsgs)
+ globalFree(lpmmMsgs->_hText);
+
+ globalUnlock(GLOBALS._hMsgs);
+ globalFree(GLOBALS._hMsgs);
+
+ // Free objects
+ if (GLOBALS._hDialogs) {
+ LpMpalDialog lpmdDialogs = (LpMpalDialog)globalLock(GLOBALS._hDialogs);
+
+ for (int i = 0; i < GLOBALS._nDialogs; i++, ++lpmdDialogs)
+ freeDialog(lpmdDialogs);
+
+ globalFree(GLOBALS._hDialogs);
+ }
+
+ // Free items
+ if (GLOBALS._hItems) {
+ LpMpalItem lpmiItems = (LpMpalItem)globalLock(GLOBALS._hItems);
+
+ for (int i = 0; i < GLOBALS._nItems; ++i, ++lpmiItems)
+ freeItem(lpmiItems);
+
+ globalUnlock(GLOBALS._hItems);
+ globalFree(GLOBALS._hItems);
+ }
+
+ // Free the locations
+ if (GLOBALS._hLocations) {
+ globalFree(GLOBALS._hLocations);
+ }
+
+ // Free the scripts
+ if (GLOBALS._hScripts) {
+ LpMpalScript lpmsScripts = (LpMpalScript)globalLock(GLOBALS._hScripts);
+
+ for (int i = 0; i < GLOBALS._nScripts; ++i, ++lpmsScripts) {
+ FreeScript(lpmsScripts);
+ }
+
+ globalUnlock(GLOBALS._hScripts);
+ }
+}
+
+//@}
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
diff --git a/engines/tony/mpal/loadmpc.h b/engines/tony/mpal/loadmpc.h
new file mode 100644
index 0000000000..20956288aa
--- /dev/null
+++ b/engines/tony/mpal/loadmpc.h
@@ -0,0 +1,59 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef __LOADMPC_H
+#define __LOADMPC_H
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* Function prototypes
+\****************************************************************************/
+
+/**
+ * Reads and interprets the MPC file, and create structures for various directives
+ * in the global variables
+ *
+ * @param lpBuf Buffer containing the MPC file data, excluding the header.
+ * @returns True if succeeded OK, false if failure.
+ */
+bool parseMpc(const byte *lpBuf);
+
+/**
+ * Frees any data allocated from the parsing of the MPC file
+ */
+void freeMpc();
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif
+
diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp
new file mode 100644
index 0000000000..3d0751a5ca
--- /dev/null
+++ b/engines/tony/mpal/lzo.cpp
@@ -0,0 +1,511 @@
+/* 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.
+ *
+ *
+ */
+/* minilzo.c -- mini subset of the LZO real-time data compression library
+
+ This file is part of the LZO real-time data compression library.
+
+ Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ All Rights Reserved.
+
+ The LZO library 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.
+
+ The LZO library 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 the LZO library; see the file COPYING.
+ If not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Markus F.X.J. Oberhumer
+ <markus@oberhumer.com>
+ http://www.oberhumer.com/opensource/lzo/
+ */
+
+#include "lzo.h"
+#include "common/textconsole.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+#define pd(a, b) ((uint32) ((a) - (b)))
+
+#define TEST_IP (ip < ip_end)
+#define TEST_OP 1
+#define NEED_IP(x) ((void) 0)
+#define NEED_OP(x) ((void) 0)
+#define TEST_LB(m_pos) ((void) 0)
+
+#define M2_MAX_OFFSET 0x0800
+#define LZO1X
+
+/**
+ * Decompresses an LZO compressed resource
+ */
+int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) {
+ register byte *op;
+ register const byte *ip;
+ register uint32 t = 0;
+#if defined(COPY_DICT)
+ uint32 m_off;
+ const byte *dict_end;
+#else
+ register const byte *m_pos;
+#endif
+
+ const byte * const ip_end = in + in_len;
+#if defined(HAVE_ANY_OP)
+ byte * const op_end = out + *out_len;
+#endif
+#if defined(LZO1Z)
+ uint32 last_m_off = 0;
+#endif
+
+#if defined(COPY_DICT)
+ if (dict)
+ {
+ if (dict_len > M4_MAX_OFFSET)
+ {
+ dict += dict_len - M4_MAX_OFFSET;
+ dict_len = M4_MAX_OFFSET;
+ }
+ dict_end = dict + dict_len;
+ }
+ else
+ {
+ dict_len = 0;
+ dict_end = NULL;
+ }
+#endif
+
+ *out_len = 0;
+
+ op = out;
+ ip = in;
+
+ if (*ip > 17)
+ {
+ t = *ip++ - 17;
+ if (t < 4)
+ goto match_next;
+ assert(t > 0); NEED_OP(t); NEED_IP(t+1);
+ do *op++ = *ip++; while (--t > 0);
+ goto first_literal_run;
+ }
+
+ while (TEST_IP && TEST_OP)
+ {
+ t = *ip++;
+ if (t >= 16)
+ goto match;
+ if (t == 0)
+ {
+ NEED_IP(1);
+ while (*ip == 0)
+ {
+ t += 255;
+ ip++;
+ NEED_IP(1);
+ }
+ t += 15 + *ip++;
+ }
+ assert(t > 0); NEED_OP(t+3); NEED_IP(t+4);
+#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4)
+ t += 3;
+ if (t >= 8) do
+ {
+ UA_COPY64(op, ip);
+ op += 8; ip += 8; t -= 8;
+ } while (t >= 8);
+ if (t >= 4)
+ {
+ UA_COPY32(op, ip);
+ op += 4; ip += 4; t -= 4;
+ }
+ if (t > 0)
+ {
+ *op++ = *ip++;
+ if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
+ }
+#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4)
+#if !defined(LZO_UNALIGNED_OK_4)
+ if (PTR_ALIGNED2_4(op, ip))
+ {
+#endif
+ UA_COPY32(op, ip);
+ op += 4; ip += 4;
+ if (--t > 0)
+ {
+ if (t >= 4)
+ {
+ do {
+ UA_COPY32(op, ip);
+ op += 4; ip += 4; t -= 4;
+ } while (t >= 4);
+ if (t > 0) do *op++ = *ip++; while (--t > 0);
+ }
+ else
+ do *op++ = *ip++; while (--t > 0);
+ }
+#if !defined(LZO_UNALIGNED_OK_4)
+ }
+ else
+#endif
+#endif
+#if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8)
+ {
+ *op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
+ do *op++ = *ip++; while (--t > 0);
+ }
+#endif
+
+first_literal_run:
+
+ t = *ip++;
+ if (t >= 16)
+ goto match;
+#if defined(COPY_DICT)
+#if defined(LZO1Z)
+ m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
+ last_m_off = m_off;
+#else
+ m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
+#endif
+ NEED_OP(3);
+ t = 3; COPY_DICT(t, m_off)
+#else
+#if defined(LZO1Z)
+ t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
+ m_pos = op - t;
+ last_m_off = t;
+#else
+ m_pos = op - (1 + M2_MAX_OFFSET);
+ m_pos -= t >> 2;
+ m_pos -= *ip++ << 2;
+#endif
+ TEST_LB(m_pos); NEED_OP(3);
+ *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
+#endif
+ goto match_done;
+
+ do {
+match:
+ if (t >= 64)
+ {
+#if defined(COPY_DICT)
+#if defined(LZO1X)
+ m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3);
+ t = (t >> 5) - 1;
+#elif defined(LZO1Y)
+ m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2);
+ t = (t >> 4) - 3;
+#elif defined(LZO1Z)
+ m_off = t & 0x1f;
+ if (m_off >= 0x1c)
+ m_off = last_m_off;
+ else
+ {
+ m_off = 1 + (m_off << 6) + (*ip++ >> 2);
+ last_m_off = m_off;
+ }
+ t = (t >> 5) - 1;
+#endif
+#else
+#if defined(LZO1X)
+ m_pos = op - 1;
+ m_pos -= (t >> 2) & 7;
+ m_pos -= *ip++ << 3;
+ t = (t >> 5) - 1;
+#elif defined(LZO1Y)
+ m_pos = op - 1;
+ m_pos -= (t >> 2) & 3;
+ m_pos -= *ip++ << 2;
+ t = (t >> 4) - 3;
+#elif defined(LZO1Z)
+ {
+ uint32 off = t & 0x1f;
+ m_pos = op;
+ if (off >= 0x1c)
+ {
+ assert(last_m_off > 0);
+ m_pos -= last_m_off;
+ }
+ else
+ {
+ off = 1 + (off << 6) + (*ip++ >> 2);
+ m_pos -= off;
+ last_m_off = off;
+ }
+ }
+ t = (t >> 5) - 1;
+#endif
+ TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
+ goto copy_match;
+#endif
+ }
+ else if (t >= 32)
+ {
+ t &= 31;
+ if (t == 0)
+ {
+ NEED_IP(1);
+ while (*ip == 0)
+ {
+ t += 255;
+ ip++;
+ NEED_IP(1);
+ }
+ t += 31 + *ip++;
+ }
+#if defined(COPY_DICT)
+#if defined(LZO1Z)
+ m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
+ last_m_off = m_off;
+#else
+ m_off = 1 + (ip[0] >> 2) + (ip[1] << 6);
+#endif
+#else
+#if defined(LZO1Z)
+ {
+ uint32 off = 1 + (ip[0] << 6) + (ip[1] >> 2);
+ m_pos = op - off;
+ last_m_off = off;
+ }
+#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN)
+ m_pos = op - 1;
+ m_pos -= UA_GET16(ip) >> 2;
+#else
+ m_pos = op - 1;
+ m_pos -= (ip[0] >> 2) + (ip[1] << 6);
+#endif
+#endif
+ ip += 2;
+ }
+ else if (t >= 16)
+ {
+#if defined(COPY_DICT)
+ m_off = (t & 8) << 11;
+#else
+ m_pos = op;
+ m_pos -= (t & 8) << 11;
+#endif
+ t &= 7;
+ if (t == 0)
+ {
+ NEED_IP(1);
+ while (*ip == 0)
+ {
+ t += 255;
+ ip++;
+ NEED_IP(1);
+ }
+ t += 7 + *ip++;
+ }
+#if defined(COPY_DICT)
+#if defined(LZO1Z)
+ m_off += (ip[0] << 6) + (ip[1] >> 2);
+#else
+ m_off += (ip[0] >> 2) + (ip[1] << 6);
+#endif
+ ip += 2;
+ if (m_off == 0)
+ goto eof_found;
+ m_off += 0x4000;
+#if defined(LZO1Z)
+ last_m_off = m_off;
+#endif
+#else
+#if defined(LZO1Z)
+ m_pos -= (ip[0] << 6) + (ip[1] >> 2);
+#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN)
+ m_pos -= UA_GET16(ip) >> 2;
+#else
+ m_pos -= (ip[0] >> 2) + (ip[1] << 6);
+#endif
+ ip += 2;
+ if (m_pos == op)
+ goto eof_found;
+ m_pos -= 0x4000;
+#if defined(LZO1Z)
+ last_m_off = pd((const byte *)op, m_pos);
+#endif
+#endif
+ }
+ else
+ {
+#if defined(COPY_DICT)
+#if defined(LZO1Z)
+ m_off = 1 + (t << 6) + (*ip++ >> 2);
+ last_m_off = m_off;
+#else
+ m_off = 1 + (t >> 2) + (*ip++ << 2);
+#endif
+ NEED_OP(2);
+ t = 2; COPY_DICT(t, m_off)
+#else
+#if defined(LZO1Z)
+ t = 1 + (t << 6) + (*ip++ >> 2);
+ m_pos = op - t;
+ last_m_off = t;
+#else
+ m_pos = op - 1;
+ m_pos -= t >> 2;
+ m_pos -= *ip++ << 2;
+#endif
+ TEST_LB(m_pos); NEED_OP(2);
+ *op++ = *m_pos++; *op++ = *m_pos;
+#endif
+ goto match_done;
+ }
+
+#if defined(COPY_DICT)
+
+ NEED_OP(t+3-1);
+ t += 3-1; COPY_DICT(t, m_off)
+
+#else
+
+ TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
+#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4)
+ if (op - m_pos >= 8)
+ {
+ t += (3 - 1);
+ if (t >= 8) do
+ {
+ UA_COPY64(op, m_pos);
+ op += 8; m_pos += 8; t -= 8;
+ } while (t >= 8);
+ if (t >= 4)
+ {
+ UA_COPY32(op, m_pos);
+ op += 4; m_pos += 4; t -= 4;
+ }
+ if (t > 0)
+ {
+ *op++ = m_pos[0];
+ if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } }
+ }
+ }
+ else
+#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4)
+#if !defined(LZO_UNALIGNED_OK_4)
+ if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op, m_pos))
+ {
+ assert((op - m_pos) >= 4);
+#else
+ if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
+ {
+#endif
+ UA_COPY32(op, m_pos);
+ op += 4; m_pos += 4; t -= 4 - (3 - 1);
+ do {
+ UA_COPY32(op, m_pos);
+ op += 4; m_pos += 4; t -= 4;
+ } while (t >= 4);
+ if (t > 0) do *op++ = *m_pos++; while (--t > 0);
+ }
+ else
+#endif
+ {
+copy_match:
+ *op++ = *m_pos++; *op++ = *m_pos++;
+ do *op++ = *m_pos++; while (--t > 0);
+ }
+
+#endif
+
+match_done:
+#if defined(LZO1Z)
+ t = ip[-1] & 3;
+#else
+ t = ip[-2] & 3;
+#endif
+ if (t == 0)
+ break;
+
+match_next:
+ assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1);
+#if 0
+ do *op++ = *ip++; while (--t > 0);
+#else
+ *op++ = *ip++;
+ if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
+#endif
+ t = *ip++;
+ } while (TEST_IP && TEST_OP);
+ }
+
+#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP)
+ *out_len = pd(op, out);
+ return LZO_E_EOF_NOT_FOUND;
+#endif
+
+eof_found:
+ assert(t == 1);
+ *out_len = pd(op, out);
+ return (ip == ip_end ? LZO_E_OK :
+ (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
+
+#if defined(HAVE_NEED_IP)
+input_overrun:
+ *out_len = pd(op, out);
+ return LZO_E_INPUT_OVERRUN;
+#endif
+
+#if defined(HAVE_NEED_OP)
+output_overrun:
+ *out_len = pd(op, out);
+ return LZO_E_OUTPUT_OVERRUN;
+#endif
+
+#if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
+lookbehind_overrun:
+ *out_len = pd(op, out);
+ return LZO_E_LOOKBEHIND_OVERRUN;
+#endif
+}
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
diff --git a/engines/tony/mpal/lzo.h b/engines/tony/mpal/lzo.h
new file mode 100644
index 0000000000..ebb1c4b516
--- /dev/null
+++ b/engines/tony/mpal/lzo.h
@@ -0,0 +1,111 @@
+/* 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.
+ *
+ *
+ */
+/* minilzo.c -- mini subset of the LZO real-time data compression library
+
+ This file is part of the LZO real-time data compression library.
+
+ Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ All Rights Reserved.
+
+ The LZO library 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.
+
+ The LZO library 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 the LZO library; see the file COPYING.
+ If not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Markus F.X.J. Oberhumer
+ <markus@oberhumer.com>
+ http://www.oberhumer.com/opensource/lzo/
+ */
+
+#ifndef TONY_MPAL_LZO_H
+#define TONY_MPAL_LZO_H
+
+#include "common/scummsys.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/* Error codes for the compression/decompression functions. Negative
+ * values are errors, positive values will be used for special but
+ * normal events.
+ */
+#define LZO_E_OK 0
+#define LZO_E_ERROR (-1)
+#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */
+#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
+#define LZO_E_INPUT_OVERRUN (-4)
+#define LZO_E_OUTPUT_OVERRUN (-5)
+#define LZO_E_LOOKBEHIND_OVERRUN (-6)
+#define LZO_E_EOF_NOT_FOUND (-7)
+#define LZO_E_INPUT_NOT_CONSUMED (-8)
+#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
+#define LZO_E_INVALID_ARGUMENT (-10)
+
+#define LZO1X_999_MEM_COMPRESS ((uint32) (14 * 16384L * sizeof(uint16)))
+
+/**
+ * Decompresses an LZO compressed resource
+ */
+int lzo1x_decompress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len);
+
+/**
+ * Comrpess a data block into an LZO stream
+ */
+int lzo1x_1_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem);
+
+/**
+ * better compression ratio at the cost of more memory and time
+ */
+int lzo1x_999_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem);
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif /* already included */
diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp
new file mode 100644
index 0000000000..dfbf16e789
--- /dev/null
+++ b/engines/tony/mpal/memory.cpp
@@ -0,0 +1,127 @@
+/* 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/algorithm.h"
+#include "common/textconsole.h"
+#include "tony/mpal/memory.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* MemoryManager methods
+\****************************************************************************/
+
+/**
+ * Allocates a new memory block
+ * @return Returns a MemoryItem instance for the new block
+ */
+MpalHandle MemoryManager::allocate(uint32 size, uint flags) {
+ MemoryItem *newItem = (MemoryItem *)malloc(sizeof(MemoryItem) + size);
+ newItem->_id = BLOCK_ID;
+ newItem->_size = size;
+ newItem->_lockCount = 0;
+
+ // If requested, clear the allocated data block
+ if ((flags & GMEM_ZEROINIT) != 0) {
+ byte *dataP = newItem->_data;
+ Common::fill(dataP, dataP + size, 0);
+ }
+
+ return (MpalHandle)newItem;
+}
+
+/**
+ * Allocates a new memory block and returns its data pointer
+ * @return Data pointer to allocated block
+ */
+void *MemoryManager::alloc(uint32 size, uint flags) {
+ MemoryItem *item = (MemoryItem *)allocate(size, flags);
+ ++item->_lockCount;
+ return &item->_data[0];
+}
+
+#define OFFSETOF(type, field) ((size_t) &(((type *) 0)->field))
+
+/**
+ * Returns a reference to the MemoryItem for a gien byte pointer
+ * @param block Byte pointer
+ */
+MemoryItem *MemoryManager::getItem(MpalHandle handle) {
+ MemoryItem *rec = (MemoryItem *)((byte *)handle - OFFSETOF(MemoryItem, _data));
+ assert(rec->_id == BLOCK_ID);
+ return rec;
+}
+
+/**
+ * Returns a size of a memory block given its pointer
+ */
+uint32 MemoryManager::getSize(MpalHandle handle) {
+ MemoryItem *item = (MemoryItem *)handle;
+ assert(item->_id == BLOCK_ID);
+ return item->_size;
+}
+
+/**
+ * Erases a given item
+ */
+void MemoryManager::freeBlock(MpalHandle handle) {
+ MemoryItem *item = (MemoryItem *)handle;
+ assert(item->_id == BLOCK_ID);
+ free(item);
+}
+
+/**
+ * Erases a given item
+ */
+void MemoryManager::destroyItem(MpalHandle handle) {
+ MemoryItem *item = getItem(handle);
+ assert(item->_id == BLOCK_ID);
+ free(item);
+}
+
+/**
+ * Locks an item for access
+ */
+byte *MemoryManager::lockItem(MpalHandle handle) {
+ MemoryItem *item = (MemoryItem *)handle;
+ assert(item->_id == BLOCK_ID);
+ ++item->_lockCount;
+ return &item->_data[0];
+}
+
+/**
+ * Unlocks a locked item
+ */
+void MemoryManager::unlockItem(MpalHandle handle) {
+ MemoryItem *item = (MemoryItem *)handle;
+ assert(item->_id == BLOCK_ID);
+ assert(item->_lockCount > 0);
+ --item->_lockCount;
+}
+
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h
new file mode 100644
index 0000000000..9c21cc20e6
--- /dev/null
+++ b/engines/tony/mpal/memory.h
@@ -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.
+ *
+ *
+ */
+
+#ifndef TONY_MPAL_MEMORY
+#define TONY_MPAL_MEMORY
+
+#include "common/scummsys.h"
+#include "common/list.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+typedef void *MpalHandle;
+
+struct MemoryItem {
+ uint32 _id;
+ uint32 _size;
+ int _lockCount;
+ byte _data[1];
+
+ // Casting for access to data
+ operator void *() { return &_data[0]; }
+};
+
+class MemoryManager {
+private:
+ static MemoryItem *getItem(MpalHandle handle);
+public:
+ static MpalHandle allocate(uint32 size, uint flags);
+ static void *alloc(uint32 size, uint flags);
+ static void freeBlock(MpalHandle handle);
+ static void destroyItem(MpalHandle handle);
+ static uint32 getSize(MpalHandle handle);
+ static byte *lockItem(MpalHandle handle);
+ static void unlockItem(MpalHandle handle);
+};
+
+// defines
+#define globalAlloc(flags, size) MemoryManager::alloc(size, flags)
+#define globalAllocate(flags, size) MemoryManager::allocate(size, flags)
+#define globalFree(handle) MemoryManager::freeBlock(handle)
+#define globalDestroy(handle) MemoryManager::destroyItem(handle)
+#define globalLock(handle) MemoryManager::lockItem(handle)
+#define globalUnlock(handle) MemoryManager::unlockItem(handle)
+#define globalSize(handle) MemoryManager::getSize(handle)
+
+#define GMEM_FIXED 1
+#define GMEM_MOVEABLE 2
+#define GMEM_ZEROINIT 4
+
+const uint32 BLOCK_ID = 0x12345678;
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
new file mode 100644
index 0000000000..8d83363c24
--- /dev/null
+++ b/engines/tony/mpal/mpal.cpp
@@ -0,0 +1,2089 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/scummsys.h"
+#include "common/file.h"
+#include "common/savefile.h"
+#include "common/system.h"
+#include "tony/tony.h"
+#include "tony/mpal/lzo.h"
+#include "tony/mpal/mpal.h"
+#include "tony/mpal/mpaldll.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* Internal functions
+\****************************************************************************/
+
+/**
+ * Locks the variables for access
+ */
+void lockVar() {
+ GLOBALS._lpmvVars = (LpMpalVar)globalLock(GLOBALS._hVars);
+}
+
+/**
+ * Unlocks variables after use
+ */
+void unlockVar() {
+ globalUnlock(GLOBALS._hVars);
+}
+
+/**
+ * Locks the messages for access
+ */
+static void LockMsg() {
+#ifdef NEED_LOCK_MSGS
+ GLOBALS._lpmmMsgs = (LpMpalMsg)globalLock(GLOBALS._hMsgs);
+#endif
+}
+
+/**
+ * Unlocks the messages after use
+ */
+static void UnlockMsg() {
+#ifdef NEED_LOCK_MSGS
+ globalUnlock(GLOBALS._hMsgs);
+#endif
+}
+
+/**
+ * Locks the dialogs for access
+ */
+static void lockDialogs() {
+ GLOBALS._lpmdDialogs = (LpMpalDialog)globalLock(GLOBALS._hDialogs);
+}
+
+/**
+ * Unlocks the dialogs after use
+ */
+static void unlockDialogs() {
+ globalUnlock(GLOBALS._hDialogs);
+}
+
+/**
+ * Locks the location data structures for access
+ */
+static void lockLocations() {
+ GLOBALS._lpmlLocations = (LpMpalLocation)globalLock(GLOBALS._hLocations);
+}
+
+/**
+ * Unlocks the location structures after use
+ */
+static void unlockLocations() {
+ globalUnlock(GLOBALS._hLocations);
+}
+
+/**
+ * Locks the items structures for use
+ */
+static void lockItems() {
+ GLOBALS._lpmiItems = (LpMpalItem)globalLock(GLOBALS._hItems);
+}
+
+/**
+ * Unlocks the items structures after use
+ */
+static void unlockItems() {
+ globalUnlock(GLOBALS._hItems);
+}
+
+/**
+ * Locks the script data structures for use
+ */
+static void LockScripts() {
+ GLOBALS._lpmsScripts = (LpMpalScript)globalLock(GLOBALS._hScripts);
+}
+
+/**
+ * Unlocks the script data structures after use
+ */
+static void unlockScripts() {
+ globalUnlock(GLOBALS._hScripts);
+}
+
+/**
+ * Returns the current value of a global variable
+ *
+ * @param lpszVarName Name of the variable
+ * @returns Current value
+ * @remarks Before using this method, you must call lockVar() to
+ * lock the global variablves for use. Then afterwards, you will
+ * need to remember to call UnlockVar()
+ */
+int32 varGetValue(const char *lpszVarName) {
+ LpMpalVar v = GLOBALS._lpmvVars;
+
+ for (int i = 0; i < GLOBALS._nVars; v++, i++)
+ if (strcmp(lpszVarName, v->_lpszVarName) == 0)
+ return v->_dwVal;
+
+ GLOBALS._mpalError = 1;
+ return 0;
+}
+
+/**
+ * Sets the value of a MPAL global variable
+ * @param lpszVarName Name of the variable
+ * @param val Value to set
+ */
+void varSetValue(const char *lpszVarName, int32 val) {
+ LpMpalVar v = GLOBALS._lpmvVars;
+
+ for (uint i = 0; i < GLOBALS._nVars; v++, i++)
+ if (strcmp(lpszVarName, v->_lpszVarName) == 0) {
+ v->_dwVal = val;
+ if (GLOBALS._lpiifCustom != NULL && strncmp(v->_lpszVarName, "Pattern.", 8) == 0) {
+ i = 0;
+ sscanf(v->_lpszVarName, "Pattern.%u", &i);
+ GLOBALS._lpiifCustom(i, val, -1);
+ } else if (GLOBALS._lpiifCustom != NULL && strncmp(v->_lpszVarName, "Status.", 7) == 0) {
+ i = 0;
+ sscanf(v->_lpszVarName,"Status.%u", &i);
+ GLOBALS._lpiifCustom(i, -1, val);
+ }
+ return;
+ }
+
+ GLOBALS._mpalError = 1;
+ return;
+}
+
+/**
+ * Find the index of a location within the location array. Remember to call LockLoc() beforehand.
+ *
+ * @param nLoc Location number to search for
+ * @returns Index, or -1 if the location is not present
+ * @remarks This function requires the location list to have
+ * first been locked with a call to LockLoc().
+ */
+static int locGetOrderFromNum(uint32 nLoc) {
+ LpMpalLocation loc = GLOBALS._lpmlLocations;
+
+ for (int i = 0; i < GLOBALS._nLocations; i++, loc++)
+ if (loc->_nObj == nLoc)
+ return i;
+
+ return -1;
+}
+
+
+/**
+ * Find the index of a message within the messages array
+ * @param nMsg Message number to search for
+ * @returns Index, or -1 if the message is not present
+ * @remarks This function requires the message list to have
+ * first been locked with a call to LockMsg()
+ */
+static int msgGetOrderFromNum(uint32 nMsg) {
+ LpMpalMsg msg = GLOBALS._lpmmMsgs;
+
+ for (int i = 0; i < GLOBALS._nMsgs; i++, msg++) {
+ if (msg->_wNum == nMsg)
+ return i;
+ }
+
+ return -1;
+}
+
+/**
+ * Find the index of an item within the items array
+ * @param nItem Item number to search for
+ * @returns Index, or -1 if the item is not present
+ * @remarks This function requires the item list to have
+ * first been locked with a call to LockItems()
+ */
+static int itemGetOrderFromNum(uint32 nItem) {
+ LpMpalItem item = GLOBALS._lpmiItems;
+
+ for (int i = 0; i < GLOBALS._nItems; i++, item++) {
+ if (item->_nObj == nItem)
+ return i;
+ }
+
+ return -1;
+}
+
+
+/**
+ * Find the index of a script within the scripts array
+ * @param nScript Script number to search for
+ * @returns Index, or -1 if the script is not present
+ * @remarks This function requires the script list to have
+ * first been locked with a call to LockScripts()
+ */
+static int scriptGetOrderFromNum(uint32 nScript) {
+ LpMpalScript script = GLOBALS._lpmsScripts;
+
+ for (int i = 0; i < GLOBALS._nScripts; i++, script++) {
+ if (script->_nObj == nScript)
+ return i;
+ }
+
+ return -1;
+}
+
+
+/**
+ * Find the index of a dialog within the dialogs array
+ * @param nDialog Dialog number to search for
+ * @returns Index, or -1 if the dialog is not present
+ * @remarks This function requires the dialog list to have
+ * first been locked with a call to LockDialogs()
+ */
+static int dialogGetOrderFromNum(uint32 nDialog) {
+ LpMpalDialog dialog = GLOBALS._lpmdDialogs;
+
+ for (int i = 0; i < GLOBALS._nDialogs; i++, dialog++) {
+ if (dialog->_nObj == nDialog)
+ return i;
+ }
+
+ return -1;
+}
+
+
+/**
+ * Duplicates a message
+ * @param nMsgOrd Index of the message inside the messages array
+ * @returns Pointer to the duplicated message.
+ * @remarks Remember to free the duplicated message when done with it.
+ */
+static char *DuplicateMessage(uint32 nMsgOrd) {
+ const char *origmsg;
+ char *clonemsg;
+
+ if (nMsgOrd == (uint32)-1)
+ return NULL;
+
+ origmsg = (const char *)globalLock(GLOBALS._lpmmMsgs[nMsgOrd]._hText);
+
+ int j = 0;
+ while (origmsg[j] != '\0' || origmsg[j + 1] != '\0')
+ j++;
+ j += 2;
+
+ clonemsg = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, j);
+ if (clonemsg == NULL)
+ return NULL;
+
+ memcpy(clonemsg, origmsg, j);
+ globalUnlock(GLOBALS._lpmmMsgs[nMsgOrd]._hText);
+
+ return clonemsg;
+}
+
+
+/**
+ * Duplicate a sentence of a dialog
+ * @param nDlgOrd Index of the dialog in the dialogs array
+ * @param nPeriod Sentence number to be duplicated.
+ * @returns Pointer to the duplicated phrase. Remember to free it
+ * when done with it.
+ */
+static char *duplicateDialogPeriod(uint32 nPeriod) {
+ const char *origmsg;
+ char *clonemsg;
+ LpMpalDialog dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog;
+
+ for (int j = 0; dialog->_periods[j] != NULL; j++) {
+ if (dialog->_periodNums[j] == nPeriod) {
+ // Found the phrase, it should be duplicated
+ origmsg = (const char *)globalLock(dialog->_periods[j]);
+
+ // Calculate the length and allocate memory
+ int i = 0;
+ while (origmsg[i] != '\0')
+ i++;
+
+ clonemsg = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, i + 1);
+ if (clonemsg == NULL)
+ return NULL;
+
+ memcpy(clonemsg, origmsg, i);
+
+ globalUnlock(dialog->_periods[j]);
+
+ return clonemsg;
+ }
+ }
+
+ return NULL;
+}
+
+
+/**
+ * Load a resource from the MPR file
+ *
+ * @param dwId ID of the resource to load
+ * @returns Handle to the loaded resource
+ */
+MpalHandle resLoad(uint32 dwId) {
+ MpalHandle h;
+ char head[4];
+ byte *temp, *buf;
+
+ for (int i = 0; i < GLOBALS._nResources; i++)
+ if (GLOBALS._lpResources[i * 2] == dwId) {
+ GLOBALS._hMpr.seek(GLOBALS._lpResources[i * 2 + 1]);
+ uint32 nBytesRead = GLOBALS._hMpr.read(head, 4);
+ if (nBytesRead != 4)
+ return NULL;
+ if (head[0] != 'R' || head[1] != 'E' || head[2] != 'S' || head[3] != 'D')
+ return NULL;
+
+ uint32 nSizeDecomp = GLOBALS._hMpr.readUint32LE();
+ if (GLOBALS._hMpr.err())
+ return NULL;
+
+ uint32 nSizeComp = GLOBALS._hMpr.readUint32LE();
+ if (GLOBALS._hMpr.err())
+ return NULL;
+
+ h = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, nSizeDecomp + (nSizeDecomp / 1024) * 16);
+ buf = (byte *)globalLock(h);
+ temp = (byte *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, nSizeComp);
+
+ nBytesRead = GLOBALS._hMpr.read(temp, nSizeComp);
+ if (nBytesRead != nSizeComp)
+ return NULL;
+
+ lzo1x_decompress(temp, nSizeComp, buf, &nBytesRead);
+ if (nBytesRead != nSizeDecomp)
+ return NULL;
+
+ globalDestroy(temp);
+ globalUnlock(h);
+ return h;
+ }
+
+ return NULL;
+}
+
+static uint32 *getSelectList(uint32 i) {
+ uint32 *sl;
+ LpMpalDialog dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog;
+
+ // Count how many are active selects
+ int num = 0;
+ for (int j = 0; dialog->_choice[i]._select[j]._dwData != 0; j++) {
+ if (dialog->_choice[i]._select[j]._curActive)
+ num++;
+ }
+
+ // If there are 0, it's a mistake
+ if (num == 0)
+ return NULL;
+
+ sl = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(uint32) * (num + 1));
+ if (sl == NULL)
+ return NULL;
+
+ // Copy all the data inside the active select list
+ int k = 0;
+ for (int j = 0; dialog->_choice[i]._select[j]._dwData != 0; j++) {
+ if (dialog->_choice[i]._select[j]._curActive)
+ sl[k++] = dialog->_choice[i]._select[j]._dwData;
+ }
+
+ sl[k] = (uint32)NULL;
+ return sl;
+}
+
+static uint32 *GetItemList(uint32 nLoc) {
+ uint32 *il;
+ LpMpalVar v = GLOBALS._lpmvVars;
+
+ uint32 num = 0;
+ for (uint32 i = 0; i < GLOBALS._nVars; i++, v++) {
+ if (strncmp(v->_lpszVarName, "Location", 8) == 0 && v->_dwVal == nLoc)
+ num++;
+ }
+
+ il = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(uint32) * (num + 1));
+ if (il == NULL)
+ return NULL;
+
+ v = GLOBALS._lpmvVars;
+ uint32 j = 0;
+ for (uint32 i = 0; i < GLOBALS._nVars; i++, v++) {
+ if (strncmp(v->_lpszVarName, "Location", 8) == 0 && v->_dwVal == nLoc) {
+ sscanf(v->_lpszVarName, "Location.%u", &il[j]);
+ j++;
+ }
+ }
+
+ il[j] = (uint32)NULL;
+ return il;
+}
+
+static LpItem getItemData(uint32 nOrdItem) {
+ LpMpalItem curitem = GLOBALS._lpmiItems + nOrdItem;
+ char *dat;
+ char *patlength;
+
+ // Zeroing out the allocated memory is required!!!
+ LpItem ret = (LpItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(Item));
+ if (ret == NULL)
+ return NULL;
+ ret->_speed = 150;
+
+ MpalHandle hDat = resLoad(curitem->_dwRes);
+ dat = (char *)globalLock(hDat);
+
+ if (dat[0] == 'D' && dat[1] == 'A' && dat[2] == 'T') {
+ int i = dat[3]; // For version 1.0!!
+ dat += 4;
+
+ if (i >= 0x10) { // From 1.0, there's a destination point for each object
+ ret->_destX = (int16)READ_LE_UINT16(dat);
+ ret->_destY = (int16)READ_LE_UINT16(dat + 2);
+ dat += 4;
+ }
+
+ if (i >= 0x11) { // From 1.1, there's animation speed
+ ret->_speed = READ_LE_UINT16(dat);
+ dat += 2;
+ } else
+ ret->_speed = 150;
+ }
+
+ ret->_numframe = *dat++;
+ ret->_numpattern = *dat++;
+ ret->_destZ = *dat++;
+
+ // Upload the left & top co-ordinates of each frame
+ for (int i = 0; i < ret->_numframe; i++) {
+ ret->_frameslocations[i].left = (int16)READ_LE_UINT16(dat);
+ ret->_frameslocations[i].top = (int16)READ_LE_UINT16(dat + 2);
+ dat += 4;
+ }
+
+ // Upload the size of each frame and calculate the right & bottom
+ for (int i = 0; i < ret->_numframe; i++) {
+ ret->_frameslocations[i].right = (int16)READ_LE_UINT16(dat) + ret->_frameslocations[i].left;
+ ret->_frameslocations[i].bottom = (int16)READ_LE_UINT16(dat + 2) + ret->_frameslocations[i].top;
+ dat += 4;
+ }
+
+ // Upload the bounding boxes of each frame
+ for (int i = 0; i < ret->_numframe; i++) {
+ ret->_bbox[i].left = (int16)READ_LE_UINT16(dat);
+ ret->_bbox[i].top = (int16)READ_LE_UINT16(dat + 2);
+ ret->_bbox[i].right = (int16)READ_LE_UINT16(dat + 4);
+ ret->_bbox[i].bottom = (int16)READ_LE_UINT16(dat + 6);
+ dat += 8;
+ }
+
+ // Load the animation pattern
+ patlength = dat;
+ dat += ret->_numpattern;
+
+ for (int i = 1; i < ret->_numpattern; i++) {
+ for (int j = 0; j < patlength[i]; j++)
+ ret->_pattern[i][j] = dat[j];
+ ret->_pattern[i][(int)patlength[i]] = 255; // Terminate pattern
+ dat += patlength[i];
+ }
+
+ // Upload the individual frames of animations
+ for (int i = 1; i < ret->_numframe; i++) {
+ uint32 dim = (uint32)(ret->_frameslocations[i].right - ret->_frameslocations[i].left) *
+ (uint32)(ret->_frameslocations[i].bottom - ret->_frameslocations[i].top);
+ ret->_frames[i] = (char *)globalAlloc(GMEM_FIXED, dim);
+
+ if (ret->_frames[i] == NULL)
+ return NULL;
+ memcpy(ret->_frames[i], dat, dim);
+ dat += dim;
+ }
+
+ // Check if we've got to the end of the file
+ int i = READ_LE_UINT16(dat);
+ if (i != 0xABCD)
+ return NULL;
+
+ globalUnlock(hDat);
+ globalFree(hDat);
+
+ return ret;
+}
+
+
+/**
+ * Thread that calls a custom function. It is used in scripts, so that each script
+ * function is executed without delaying the others.
+ *
+ * @param param pointer to a pointer to the structure that defines the call.
+ * @remarks The passed structure is freed when the process finishes.
+ */
+void CustomThread(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ LpCfCall p;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->p = *(const LpCfCall *)param;
+
+ CORO_INVOKE_4(GLOBALS._lplpFunctions[_ctx->p->_nCf], _ctx->p->_arg1, _ctx->p->_arg2, _ctx->p->_arg3, _ctx->p->_arg4);
+
+ globalFree(_ctx->p);
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Main process for running a script.
+ *
+ * @param param Pointer to a pointer to a structure containing the script data.
+ * @remarks The passed structure is freed when the process finishes.
+ */
+void ScriptThread(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ uint i, j, k;
+ uint32 dwStartTime;
+ uint32 dwCurTime;
+ uint32 dwId;
+ int numHandles;
+ LpCfCall p;
+ CORO_END_CONTEXT(_ctx);
+
+ static uint32 cfHandles[MAX_COMMANDS_PER_MOMENT];
+ LpMpalScript s = *(const LpMpalScript *)param;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->dwStartTime = g_vm->getTime();
+ _ctx->numHandles = 0;
+
+// debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Moments: %u\n", s->_nMoments);
+ for (_ctx->i = 0; _ctx->i < s->_nMoments; _ctx->i++) {
+ // Sleep for the required time
+ if (s->_moment[_ctx->i]._dwTime == -1) {
+ CORO_INVOKE_4(CoroScheduler.waitForMultipleObjects, _ctx->numHandles, cfHandles, true, CORO_INFINITE);
+ _ctx->dwStartTime = g_vm->getTime();
+ } else {
+ _ctx->dwCurTime = g_vm->getTime();
+ if (_ctx->dwCurTime < _ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime * 100)) {
+ // debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Sleeping %lums\n",_ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime*100) - _ctx->dwCurTime);
+ CORO_INVOKE_1(CoroScheduler.sleep, _ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime * 100) - _ctx->dwCurTime);
+ }
+ }
+
+ _ctx->numHandles = 0;
+ for (_ctx->j = 0; _ctx->j < s->_moment[_ctx->i]._nCmds; _ctx->j++) {
+ _ctx->k = s->_moment[_ctx->i]._cmdNum[_ctx->j];
+
+ if (s->_command[_ctx->k]._type == 1) {
+ _ctx->p = (LpCfCall)globalAlloc(GMEM_FIXED, sizeof(CfCall));
+ if (_ctx->p == NULL) {
+ GLOBALS._mpalError = 1;
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ _ctx->p->_nCf = s->_command[_ctx->k]._nCf;
+ _ctx->p->_arg1 = s->_command[_ctx->k]._arg1;
+ _ctx->p->_arg2 = s->_command[_ctx->k]._arg2;
+ _ctx->p->_arg3 = s->_command[_ctx->k]._arg3;
+ _ctx->p->_arg4 = s->_command[_ctx->k]._arg4;
+
+ // !!! New process management
+ if ((cfHandles[_ctx->numHandles++] = CoroScheduler.createProcess(CustomThread, &_ctx->p, sizeof(LpCfCall))) == 0) {
+ GLOBALS._mpalError = 1;
+
+ CORO_KILL_SELF();
+ return;
+ }
+ } else if (s->_command[_ctx->k]._type == 2) {
+ lockVar();
+ varSetValue(
+ s->_command[_ctx->k]._lpszVarName,
+ evaluateExpression(s->_command[_ctx->k]._expr)
+ );
+ unlockVar();
+
+ } else {
+ GLOBALS._mpalError = 1;
+ globalFree(s);
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ // WORKAROUND: Wait for events to pulse.
+ CORO_SLEEP(1);
+ }
+ }
+
+ globalFree(s);
+
+ CORO_KILL_SELF();
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Thread that performs an action on an item. the thread always executes the action,
+ * so it should create a new item in which the action is the one required.
+ * Furthermore, the expression is not checked, but it is always performed the action.
+ *
+ * @param param Pointer to a pointer to a structure containing the action.
+ */
+void ActionThread(CORO_PARAM, const void *param) {
+ // COROUTINE
+ CORO_BEGIN_CONTEXT;
+ int j, k;
+ LpMpalItem item;
+
+ ~CoroContextTag() {
+ if (item)
+ globalDestroy(item);
+ }
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // The ActionThread owns the data block pointed to, so we need to make sure it's
+ // freed when the process exits
+ _ctx->item = *(const LpMpalItem *)param;
+
+ GLOBALS._mpalError = 0;
+ for (_ctx->j = 0; _ctx->j < _ctx->item->_action[_ctx->item->_dwRes]._nCmds; _ctx->j++) {
+ _ctx->k = _ctx->item->_action[_ctx->item->_dwRes]._cmdNum[_ctx->j];
+
+ if (_ctx->item->_command[_ctx->k]._type == 1) {
+ // Custom function
+ debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d Call=%s params=%d,%d,%d,%d",
+ CoroScheduler.getCurrentPID(), GLOBALS._lplpFunctionStrings[_ctx->item->_command[_ctx->k]._nCf].c_str(),
+ _ctx->item->_command[_ctx->k]._arg1, _ctx->item->_command[_ctx->k]._arg2,
+ _ctx->item->_command[_ctx->k]._arg3, _ctx->item->_command[_ctx->k]._arg4
+ );
+
+ CORO_INVOKE_4(GLOBALS._lplpFunctions[_ctx->item->_command[_ctx->k]._nCf],
+ _ctx->item->_command[_ctx->k]._arg1,
+ _ctx->item->_command[_ctx->k]._arg2,
+ _ctx->item->_command[_ctx->k]._arg3,
+ _ctx->item->_command[_ctx->k]._arg4
+
+ );
+ } else if (_ctx->item->_command[_ctx->k]._type == 2) {
+ // Variable assign
+ debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d Variable=%s",
+ CoroScheduler.getCurrentPID(), _ctx->item->_command[_ctx->k]._lpszVarName);
+
+ lockVar();
+ varSetValue(_ctx->item->_command[_ctx->k]._lpszVarName, evaluateExpression(_ctx->item->_command[_ctx->k]._expr));
+ unlockVar();
+
+ } else {
+ GLOBALS._mpalError = 1;
+ break;
+ }
+
+ // WORKAROUND: Wait for events to pulse.
+ CORO_SLEEP(1);
+ }
+
+ globalDestroy(_ctx->item);
+ _ctx->item = NULL;
+
+ debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d ended", CoroScheduler.getCurrentPID());
+
+ CORO_END_CODE;
+}
+
+/**
+ * This thread monitors a created action to detect when it ends.
+ * @remarks Since actions can spawn sub-actions, this needs to be a
+ * separate thread to determine when the outer action is done
+ */
+void ShutUpActionThread(CORO_PARAM, const void *param) {
+ // COROUTINE
+ CORO_BEGIN_CONTEXT;
+ int slotNumber;
+ CORO_END_CONTEXT(_ctx);
+
+ uint32 pid = *(const uint32 *)param;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, pid, CORO_INFINITE);
+
+ GLOBALS._bExecutingAction = false;
+
+ if (g_vm->_initialLoadSlotNumber != -1) {
+ _ctx->slotNumber = g_vm->_initialLoadSlotNumber;
+ g_vm->_initialLoadSlotNumber = -1;
+
+ CORO_INVOKE_1(g_vm->loadState, _ctx->slotNumber);
+ }
+
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Polls one location (starting point of a process)
+ *
+ * @param param Pointer to an index in the array of polling locations.
+ */
+void LocationPollThread(CORO_PARAM, const void *param) {
+ typedef struct {
+ uint32 _nItem, _nAction;
+
+ uint16 _wTime;
+ byte _perc;
+ MpalHandle _when;
+ byte _nCmds;
+ uint16 _cmdNum[MAX_COMMANDS_PER_ACTION];
+ uint32 _dwLastTime;
+ } MYACTION;
+
+ typedef struct {
+ uint32 _nItem;
+ uint32 _hThread;
+ } MYTHREAD;
+
+ CORO_BEGIN_CONTEXT;
+ uint32 *il;
+ int i, j, k;
+ int numitems;
+ int nRealItems;
+ LpMpalItem curItem, newItem;
+ int nIdleActions;
+ uint32 curTime;
+ uint32 dwSleepTime;
+ uint32 dwId;
+ int ord;
+ bool delayExpired;
+ bool expired;
+
+ MYACTION *myActions;
+ MYTHREAD *myThreads;
+
+ ~CoroContextTag() {
+ // Free data blocks
+ if (myThreads)
+ globalDestroy(myThreads);
+ if (myActions)
+ globalDestroy(myActions);
+ }
+ CORO_END_CONTEXT(_ctx);
+
+ uint32 id = *((const uint32 *)param);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Initialize data pointers
+ _ctx->myActions = NULL;
+ _ctx->myThreads = NULL;
+
+ // To begin with, we need to request the item list from the location
+ _ctx->il = mpalQueryItemList(GLOBALS._nPollingLocations[id]);
+
+ // Count the items
+ for (_ctx->numitems = 0; _ctx->il[_ctx->numitems] != 0; _ctx->numitems++)
+ ;
+
+ // We look for items without idle actions, and eliminate them from the list
+ lockItems();
+ _ctx->nIdleActions = 0;
+ _ctx->nRealItems = 0;
+ for (_ctx->i = 0; _ctx->i < _ctx->numitems; _ctx->i++) {
+ _ctx->ord = itemGetOrderFromNum(_ctx->il[_ctx->i]);
+
+ if (_ctx->ord == -1)
+ continue;
+
+ _ctx->curItem = GLOBALS._lpmiItems + _ctx->ord;
+
+ _ctx->k = 0;
+ for (_ctx->j = 0; _ctx->j < _ctx->curItem->_nActions; _ctx->j++) {
+ if (_ctx->curItem->_action[_ctx->j]._num == 0xFF)
+ _ctx->k++;
+ }
+
+ _ctx->nIdleActions += _ctx->k;
+
+ if (_ctx->k == 0)
+ // We can remove this item from the list
+ _ctx->il[_ctx->i] = (uint32)NULL;
+ else
+ _ctx->nRealItems++;
+ }
+ unlockItems();
+
+ // If there is nothing left, we can exit
+ if (_ctx->nRealItems == 0) {
+ globalDestroy(_ctx->il);
+ CORO_KILL_SELF();
+ return;
+ }
+
+ _ctx->myThreads = (MYTHREAD *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nRealItems * sizeof(MYTHREAD));
+ if (_ctx->myThreads == NULL) {
+ globalDestroy(_ctx->il);
+ CORO_KILL_SELF();
+ return;
+ }
+
+
+ // We have established that there is at least one item that contains idle actions.
+ // Now we created the mirrored copies of the idle actions.
+ _ctx->myActions = (MYACTION *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nIdleActions * sizeof(MYACTION));
+ if (_ctx->myActions == NULL) {
+ globalDestroy(_ctx->myThreads);
+ globalDestroy(_ctx->il);
+ CORO_KILL_SELF();
+ return;
+ }
+
+ lockItems();
+ _ctx->k = 0;
+
+ for (_ctx->i = 0; _ctx->i < _ctx->numitems; _ctx->i++) {
+ if (_ctx->il[_ctx->i] == 0)
+ continue;
+
+ _ctx->curItem = GLOBALS._lpmiItems + itemGetOrderFromNum(_ctx->il[_ctx->i]);
+
+ for (_ctx->j = 0; _ctx->j < _ctx->curItem->_nActions; _ctx->j++) {
+ if (_ctx->curItem->_action[_ctx->j]._num == 0xFF) {
+ _ctx->myActions[_ctx->k]._nItem = _ctx->il[_ctx->i];
+ _ctx->myActions[_ctx->k]._nAction = _ctx->j;
+
+ _ctx->myActions[_ctx->k]._wTime = _ctx->curItem->_action[_ctx->j]._wTime;
+ _ctx->myActions[_ctx->k]._perc = _ctx->curItem->_action[_ctx->j]._perc;
+ _ctx->myActions[_ctx->k]._when = _ctx->curItem->_action[_ctx->j]._when;
+ _ctx->myActions[_ctx->k]._nCmds = _ctx->curItem->_action[_ctx->j]._nCmds;
+ memcpy(_ctx->myActions[_ctx->k]._cmdNum, _ctx->curItem->_action[_ctx->j]._cmdNum,
+ MAX_COMMANDS_PER_ACTION * sizeof(uint16));
+
+ _ctx->myActions[_ctx->k]._dwLastTime = g_vm->getTime();
+ _ctx->k++;
+ }
+ }
+ }
+
+ unlockItems();
+
+ // We don't need the item list anymore
+ globalDestroy(_ctx->il);
+
+
+ // Here's the main loop
+ while (1) {
+ // Searching for idle actions requiring time to execute
+ _ctx->curTime = g_vm->getTime();
+ _ctx->dwSleepTime = (uint32)-1L;
+
+ for (_ctx->k = 0;_ctx->k<_ctx->nIdleActions;_ctx->k++) {
+ if (_ctx->curTime >= _ctx->myActions[_ctx->k]._dwLastTime + _ctx->myActions[_ctx->k]._wTime) {
+ _ctx->dwSleepTime = 0;
+ break;
+ } else
+ _ctx->dwSleepTime = MIN(_ctx->dwSleepTime, _ctx->myActions[_ctx->k]._dwLastTime + _ctx->myActions[_ctx->k]._wTime - _ctx->curTime);
+ }
+
+ // We fall alseep, but always checking that the event is set when prompted for closure
+ CORO_INVOKE_3(CoroScheduler.waitForSingleObject, GLOBALS._hEndPollingLocations[id], _ctx->dwSleepTime, &_ctx->expired);
+
+ //if (_ctx->k == WAIT_OBJECT_0)
+ if (!_ctx->expired)
+ break;
+
+ for (_ctx->i = 0; _ctx->i < _ctx->nRealItems; _ctx->i++) {
+ if (_ctx->myThreads[_ctx->i]._nItem != 0) {
+ CORO_INVOKE_3(CoroScheduler.waitForSingleObject, _ctx->myThreads[_ctx->i]._hThread, 0, &_ctx->delayExpired);
+
+ // if result == WAIT_OBJECT_0)
+ if (!_ctx->delayExpired)
+ _ctx->myThreads[_ctx->i]._nItem = 0;
+ }
+ }
+
+ _ctx->curTime = g_vm->getTime();
+
+ // Loop through all the necessary idle actions
+ for (_ctx->k = 0; _ctx->k < _ctx->nIdleActions; _ctx->k++) {
+ if (_ctx->curTime >= _ctx->myActions[_ctx->k]._dwLastTime + _ctx->myActions[_ctx->k]._wTime) {
+ _ctx->myActions[_ctx->k]._dwLastTime += _ctx->myActions[_ctx->k]._wTime;
+
+ // It's time to check to see if fortune is on the side of the idle action
+ byte randomVal = (byte)g_vm->_randomSource.getRandomNumber(99);
+ if (randomVal < _ctx->myActions[_ctx->k]._perc) {
+ // Check if there is an action running on the item
+ if ((GLOBALS._bExecutingAction) && (GLOBALS._nExecutingAction == _ctx->myActions[_ctx->k]._nItem))
+ continue;
+
+ // Check to see if there already another idle funning running on the item
+ for (_ctx->i = 0; _ctx->i < _ctx->nRealItems; _ctx->i++) {
+ if (_ctx->myThreads[_ctx->i]._nItem == _ctx->myActions[_ctx->k]._nItem)
+ break;
+ }
+
+ if (_ctx->i < _ctx->nRealItems)
+ continue;
+
+ // Ok, we are the only ones :)
+ lockItems();
+ _ctx->curItem = GLOBALS._lpmiItems + itemGetOrderFromNum(_ctx->myActions[_ctx->k]._nItem);
+
+ // Check if there is a WhenExecute expression
+ _ctx->j=_ctx->myActions[_ctx->k]._nAction;
+ if (_ctx->curItem->_action[_ctx->j]._when != NULL) {
+ if (!evaluateExpression(_ctx->curItem->_action[_ctx->j]._when)) {
+ unlockItems();
+ continue;
+ }
+ }
+
+ // Ok, we can perform the action. For convenience, we do it in a new process
+ _ctx->newItem = (LpMpalItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalItem));
+ if (_ctx->newItem == false) {
+ globalDestroy(_ctx->myThreads);
+ globalDestroy(_ctx->myActions);
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ memcpy(_ctx->newItem,_ctx->curItem, sizeof(MpalItem));
+ unlockItems();
+
+ // We copy the action in #0
+ //_ctx->newItem->Action[0].nCmds = _ctx->curItem->Action[_ctx->j].nCmds;
+ //memcpy(_ctx->newItem->Action[0].CmdNum,_ctx->curItem->Action[_ctx->j].CmdNum,_ctx->newItem->Action[0].nCmds*sizeof(_ctx->newItem->Action[0].CmdNum[0]));
+ _ctx->newItem->_dwRes = _ctx->j;
+
+ // We will create an action, and will provide the necessary details
+ for (_ctx->i = 0; _ctx->i < _ctx->nRealItems; _ctx->i++) {
+ if (_ctx->myThreads[_ctx->i]._nItem == 0)
+ break;
+ }
+
+ _ctx->myThreads[_ctx->i]._nItem = _ctx->myActions[_ctx->k]._nItem;
+
+ // Create the process
+ if ((_ctx->myThreads[_ctx->i]._hThread = CoroScheduler.createProcess(ActionThread, &_ctx->newItem, sizeof(LpMpalItem))) == CORO_INVALID_PID_VALUE) {
+ //if ((_ctx->myThreads[_ctx->i]._hThread = (void*)_beginthread(ActionThread, 10240, (void *)_ctx->newItem)) == (void*)-1)
+ globalDestroy(_ctx->newItem);
+ globalDestroy(_ctx->myThreads);
+ globalDestroy(_ctx->myActions);
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ // Skip all idle actions of the same item
+ }
+ }
+ }
+ }
+
+
+ // Set idle skip on
+ CORO_INVOKE_4(GLOBALS._lplpFunctions[200], 0, 0, 0, 0);
+
+ for (_ctx->i = 0; _ctx->i < _ctx->nRealItems; _ctx->i++) {
+ if (_ctx->myThreads[_ctx->i]._nItem != 0) {
+ CORO_INVOKE_3(CoroScheduler.waitForSingleObject, _ctx->myThreads[_ctx->i]._hThread, 5000, &_ctx->delayExpired);
+
+ //if (result != WAIT_OBJECT_0)
+ //if (_ctx->delayExpired)
+ // TerminateThread(_ctx->MyThreads[_ctx->i].hThread, 0);
+
+ CoroScheduler.killMatchingProcess(_ctx->myThreads[_ctx->i]._hThread);
+ }
+ }
+
+ // Set idle skip off
+ CORO_INVOKE_4(GLOBALS._lplpFunctions[201], 0, 0, 0, 0);
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Wait for the end of the dialog execution thread, and then restore global
+ * variables indicating that the dialogue has finished.
+ *
+ * @param param Pointer to a handle to the dialog
+ * @remarks This additional process is used, instead of clearing variables
+ * within the same dialog thread, because due to the recursive nature of a dialog,
+ * it would be difficult to know within it when the dialog is actually ending.
+ */
+void ShutUpDialogThread(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ uint32 pid = *(const uint32 *)param;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, pid, CORO_INFINITE);
+
+ GLOBALS._bExecutingDialog = false;
+ GLOBALS._nExecutingDialog = 0;
+ GLOBALS._nExecutingChoice = 0;
+
+ CoroScheduler.setEvent(GLOBALS._hAskChoice);
+
+ CORO_KILL_SELF();
+
+ CORO_END_CODE;
+}
+
+void doChoice(CORO_PARAM, uint32 nChoice);
+
+
+/**
+ * Executes a group of the current dialog. Can 'be the Starting point of a process.
+ * @parm nGroup Number of the group to perform
+ */
+void GroupThread(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ LpMpalDialog dialog;
+ int i, j, k;
+ int type;
+ CORO_END_CONTEXT(_ctx);
+
+ uint32 nGroup = *(const uint32 *)param;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Lock the _ctx->dialog
+ lockDialogs();
+
+ // Find the pointer to the current _ctx->dialog
+ _ctx->dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog;
+
+ // Search inside the group requesting the _ctx->dialog
+ for (_ctx->i = 0; _ctx->dialog->_group[_ctx->i]._num != 0; _ctx->i++) {
+ if (_ctx->dialog->_group[_ctx->i]._num == nGroup) {
+ // Cycle through executing the commands of the group
+ for (_ctx->j = 0; _ctx->j < _ctx->dialog->_group[_ctx->i]._nCmds; _ctx->j++) {
+ _ctx->k = _ctx->dialog->_group[_ctx->i]._cmdNum[_ctx->j];
+
+ _ctx->type = _ctx->dialog->_command[_ctx->k]._type;
+ if (_ctx->type == 1) {
+ // Call custom function
+ CORO_INVOKE_4(GLOBALS._lplpFunctions[_ctx->dialog->_command[_ctx->k]._nCf],
+ _ctx->dialog->_command[_ctx->k]._arg1,
+ _ctx->dialog->_command[_ctx->k]._arg2,
+ _ctx->dialog->_command[_ctx->k]._arg3,
+ _ctx->dialog->_command[_ctx->k]._arg4
+ );
+
+ } else if (_ctx->type == 2) {
+ // Set a variable
+ lockVar();
+ varSetValue(_ctx->dialog->_command[_ctx->k]._lpszVarName, evaluateExpression(_ctx->dialog->_command[_ctx->k]._expr));
+ unlockVar();
+
+ } else if (_ctx->type == 3) {
+ // DoChoice: call the chosen function
+ CORO_INVOKE_1(doChoice, (uint32)_ctx->dialog->_command[_ctx->k]._nChoice);
+
+ } else {
+ GLOBALS._mpalError = 1;
+ unlockDialogs();
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ // WORKAROUND: Wait for events to pulse.
+ CORO_SLEEP(1);
+ }
+
+ // The gruop is finished, so we can return to the calling function.
+ // If the group was the first called, then the process will automatically
+ // end. Otherwise it returns to the caller method
+
+ return;
+ }
+ }
+
+ // If we are here, it means that we have not found the requested group
+ GLOBALS._mpalError = 1;
+ unlockDialogs();
+
+ CORO_KILL_SELF();
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Make a choice in the current dialog.
+ *
+ * @param nChoice Number of choice to perform
+ */
+void doChoice(CORO_PARAM, uint32 nChoice) {
+ CORO_BEGIN_CONTEXT;
+ LpMpalDialog dialog;
+ int i, j, k;
+ uint32 nGroup;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Lock the dialogs
+ lockDialogs();
+
+ // Get a pointer to the current dialog
+ _ctx->dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog;
+
+ // Search the choice between those required in the dialog
+ for (_ctx->i = 0; _ctx->dialog->_choice[_ctx->i]._nChoice != 0; _ctx->i++) {
+ if (_ctx->dialog->_choice[_ctx->i]._nChoice == nChoice)
+ break;
+ }
+
+ // If nothing has been found, exit with an error
+ if (_ctx->dialog->_choice[_ctx->i]._nChoice == 0) {
+ // If we're here, we did not find the required choice
+ GLOBALS._mpalError = 1;
+ unlockDialogs();
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ // We've found the requested choice. Remember what in global variables
+ GLOBALS._nExecutingChoice = _ctx->i;
+
+ while (1) {
+ GLOBALS._nExecutingChoice = _ctx->i;
+
+ _ctx->k = 0;
+ // Calculate the expression of each selection, to see if they're active or inactive
+ for (_ctx->j = 0; _ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._dwData != 0; _ctx->j++) {
+ if (_ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._when == NULL) {
+ _ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._curActive = 1;
+ _ctx->k++;
+ } else if (evaluateExpression(_ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._when)) {
+ _ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._curActive = 1;
+ _ctx->k++;
+ } else
+ _ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._curActive = 0;
+ }
+
+ // If there are no choices activated, then the dialog is finished.
+ if (_ctx->k == 0) {
+ unlockDialogs();
+ break;
+ }
+
+ // There are choices available to the user, so wait for them to make one
+ CoroScheduler.resetEvent(GLOBALS._hDoneChoice);
+ CoroScheduler.setEvent(GLOBALS._hAskChoice);
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._hDoneChoice, CORO_INFINITE);
+
+ // Now that the choice has been made, we can run the groups associated with the choice tbontbtitq
+ _ctx->j = GLOBALS._nSelectedChoice;
+ for (_ctx->k = 0; _ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._wPlayGroup[_ctx->k] != 0; _ctx->k++) {
+ _ctx->nGroup = _ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._wPlayGroup[_ctx->k];
+ CORO_INVOKE_1(GroupThread, &_ctx->nGroup);
+ }
+
+ // Control attribute
+ if (_ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._attr & (1 << 0)) {
+ // Bit 0 set: the end of the choice
+ unlockDialogs();
+ break;
+ }
+
+ if (_ctx->dialog->_choice[_ctx->i]._select[_ctx->j]._attr & (1 << 1)) {
+ // Bit 1 set: the end of the dialog
+ unlockDialogs();
+
+ CORO_KILL_SELF();
+ return;
+ }
+
+ // End of choic ewithout attributes. We must do it again
+ }
+
+ // If we're here, we found an end choice. Return to the caller group
+ return;
+
+ CORO_END_CODE;
+}
+
+
+/**
+ * Perform an action on a certain item.
+ *
+ * @param nAction Action number
+ * @param ordItem Index of the item in the items list
+ * @param dwParam Any parameter for the action.
+ * @returns Id of the process that was launched to perform the action, or
+ * CORO_INVALID_PID_VALUE if the action was not defined, or the item was inactive.
+ * @remarks You can get the index of an item from its number by using
+ * the itemGetOrderFromNum() function. The items list must first be locked
+ * by calling LockItem().
+ */
+static uint32 doAction(uint32 nAction, uint32 ordItem, uint32 dwParam) {
+ LpMpalItem item = GLOBALS._lpmiItems;
+ LpMpalItem newitem;
+
+ item+=ordItem;
+ Common::String buf = Common::String::format("Status.%u", item->_nObj);
+ if (varGetValue(buf.c_str()) <= 0)
+ return CORO_INVALID_PID_VALUE;
+
+ for (int i = 0; i < item->_nActions; i++) {
+ if (item->_action[i]._num != nAction)
+ continue;
+
+ if (item->_action[i]._wParm != dwParam)
+ continue;
+
+ if (item->_action[i]._when != NULL) {
+ if (!evaluateExpression(item->_action[i]._when))
+ continue;
+ }
+
+ // Now we find the right action to be performed
+ // Duplicate the item and copy the current action in #i into #0
+ newitem = (LpMpalItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalItem));
+ if (newitem == NULL)
+ return CORO_INVALID_PID_VALUE;
+
+ // In the new version number of the action in writing dwRes
+ Common::copy((byte *)item, (byte *)item + sizeof(MpalItem), (byte *)newitem);
+
+ //newitem->_action[0]._nCmds=item->_action[i]._nCmds;
+ //memcpy(newitem->_action[0]._cmdNum, item->_action[i]._cmdNum, newitem->Action[0].nCmds * sizeof(newitem->_action[0]._cmdNum[0]));
+
+ newitem->_dwRes = i;
+
+ // And finally we can laucnh the process that will execute the action,
+ // and a second process to free up the memory when the action is finished.
+
+ // !!! New process management
+ uint32 h;
+ if ((h = CoroScheduler.createProcess(ActionThread, &newitem, sizeof(LpMpalItem))) == CORO_INVALID_PID_VALUE)
+ return CORO_INVALID_PID_VALUE;
+
+ if (CoroScheduler.createProcess(ShutUpActionThread, &h, sizeof(uint32)) == CORO_INVALID_PID_VALUE)
+ return CORO_INVALID_PID_VALUE;
+
+ GLOBALS._nExecutingAction = item->_nObj;
+ GLOBALS._bExecutingAction = true;
+
+ return h;
+ }
+
+ return CORO_INVALID_PID_VALUE;
+}
+
+/**
+ * Shows a dialog in a separate process.
+ *
+ * @param nDlgOrd The index of the dialog in the dialog list
+ * @param nGroup Number of the group to perform
+ * @returns The process Id of the process running the dialog
+ * or CORO_INVALID_PID_VALUE on error
+ * @remarks The dialogue runs in a thread created on purpose,
+ * so that must inform through an event and when 'necessary to you make a choice.
+ * The data on the choices may be obtained through various queries.
+ */
+static uint32 doDialog(uint32 nDlgOrd, uint32 nGroup) {
+ // Store the running dialog in a global variable
+ GLOBALS._nExecutingDialog = nDlgOrd;
+
+ // Enables the flag to indicate that there is' a running dialogue
+ GLOBALS._bExecutingDialog = true;
+
+ CoroScheduler.resetEvent(GLOBALS._hAskChoice);
+ CoroScheduler.resetEvent(GLOBALS._hDoneChoice);
+
+ // Create a thread that performs the dialogue group
+
+ // Create the process
+ uint32 h;
+ if ((h = CoroScheduler.createProcess(GroupThread, &nGroup, sizeof(uint32))) == CORO_INVALID_PID_VALUE)
+ return CORO_INVALID_PID_VALUE;
+
+ // Create a thread that waits until the end of the dialog process, and will restore the global variables
+ if (CoroScheduler.createProcess(ShutUpDialogThread, &h, sizeof(uint32)) == CORO_INVALID_PID_VALUE) {
+ // Something went wrong, so kill the previously started dialog process
+ CoroScheduler.killMatchingProcess(h);
+ return CORO_INVALID_PID_VALUE;
+ }
+
+ return h;
+}
+
+
+/**
+ * Takes note of the selection chosen by the user, and warns the process that was running
+ * the box that it can continue.
+ *
+ * @param nChoice Number of choice that was in progress
+ * @param dwData Since combined with select selection
+ * @returns True if everything is OK, false on failure
+ */
+bool doSelection(uint32 i, uint32 dwData) {
+ LpMpalDialog dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog;
+ int j;
+
+ for (j = 0; dialog->_choice[i]._select[j]._dwData != 0; j++) {
+ if (dialog->_choice[i]._select[j]._dwData == dwData && dialog->_choice[i]._select[j]._curActive != 0)
+ break;
+ }
+
+ if (dialog->_choice[i]._select[j]._dwData == 0)
+ return false;
+
+ GLOBALS._nSelectedChoice = j;
+ CoroScheduler.setEvent(GLOBALS._hDoneChoice);
+ return true;
+}
+
+
+/**
+ * @defgroup Exported functions
+ */
+//@{
+
+/**
+ * Initializes the MPAL library and opens the .MPC file, which will be used for all queries.
+ *
+ * @param lpszMpcFileName Name of the MPC file
+ * @param lpszMprFileName Name of the MPR file
+ * @param lplpcfArray Array of pointers to custom functions.
+ * @returns True if everything is OK, false on failure
+ */
+bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
+ LPLPCUSTOMFUNCTION lplpcfArray, Common::String *lpcfStrings) {
+ byte buf[5];
+ byte *cmpbuf;
+
+ // Save the array of custom functions
+ GLOBALS._lplpFunctions = lplpcfArray;
+ GLOBALS._lplpFunctionStrings = lpcfStrings;
+
+ // OPen the MPC file for reading
+ Common::File hMpc;
+ if (!hMpc.open(lpszMpcFileName))
+ return false;
+
+ // Read and check the header
+ uint32 nBytesRead = hMpc.read(buf, 5);
+ if (nBytesRead != 5)
+ return false;
+
+ if (buf[0] != 'M' || buf[1] != 'P' || buf[2] != 'C' || buf[3] != 0x20)
+ return false;
+
+ bool bCompress = buf[4];
+
+ // Reads the size of the uncompressed file, and allocate memory
+ uint32 dwSizeDecomp = hMpc.readUint32LE();
+ if (hMpc.err())
+ return false;
+
+ byte *lpMpcImage = (byte *)globalAlloc(GMEM_FIXED, dwSizeDecomp + 16);
+ if (lpMpcImage == NULL)
+ return false;
+
+ if (bCompress) {
+ // Get the compressed size and read the data in
+ uint32 dwSizeComp = hMpc.readUint32LE();
+ if (hMpc.err())
+ return false;
+
+ cmpbuf = (byte *)globalAlloc(GMEM_FIXED, dwSizeComp);
+ if (cmpbuf == NULL)
+ return false;
+
+ nBytesRead = hMpc.read(cmpbuf, dwSizeComp);
+ if (nBytesRead != dwSizeComp)
+ return false;
+
+ // Decompress the data
+ lzo1x_decompress(cmpbuf, dwSizeComp, lpMpcImage, &nBytesRead);
+ if (nBytesRead != dwSizeDecomp)
+ return false;
+
+ globalDestroy(cmpbuf);
+ } else {
+ // If the file is not compressed, we directly read in the data
+ nBytesRead = hMpc.read(lpMpcImage, dwSizeDecomp);
+ if (nBytesRead != dwSizeDecomp)
+ return false;
+ }
+
+ // Close the file
+ hMpc.close();
+
+ // Process the data
+ if (parseMpc(lpMpcImage) == false)
+ return false;
+
+ globalDestroy(lpMpcImage);
+
+ // Open the MPR file
+ if (!GLOBALS._hMpr.open(lpszMprFileName))
+ return false;
+
+ // Seek to the end of the file to read overall information
+ GLOBALS._hMpr.seek(-12, SEEK_END);
+
+ uint32 dwSizeComp = GLOBALS._hMpr.readUint32LE();
+ if (GLOBALS._hMpr.err())
+ return false;
+
+ GLOBALS._nResources = GLOBALS._hMpr.readUint32LE();
+ if (GLOBALS._hMpr.err())
+ return false;
+
+ nBytesRead = GLOBALS._hMpr.read(buf, 4);
+ if (GLOBALS._hMpr.err())
+ return false;
+
+ if (buf[0] !='E' || buf[1] != 'N' || buf[2] != 'D' || buf[3] != '0')
+ return false;
+
+ // Move to the start of the resources header
+ GLOBALS._hMpr.seek(-(12 + (int)dwSizeComp), SEEK_END);
+
+ GLOBALS._lpResources = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, GLOBALS._nResources * 8);
+ if (GLOBALS._lpResources == NULL)
+ return false;
+
+ cmpbuf = (byte *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, dwSizeComp);
+ if (cmpbuf == NULL)
+ return false;
+
+ nBytesRead = GLOBALS._hMpr.read(cmpbuf, dwSizeComp);
+ if (nBytesRead != dwSizeComp)
+ return false;
+
+ lzo1x_decompress((const byte *)cmpbuf, dwSizeComp, (byte *)GLOBALS._lpResources, (uint32 *)&nBytesRead);
+ if (nBytesRead != (uint32)GLOBALS._nResources * 8)
+ return false;
+
+ globalDestroy(cmpbuf);
+
+ // Reset back to the start of the file, leaving it open
+ GLOBALS._hMpr.seek(0, SEEK_SET);
+
+ // There is no action or dialog running by default
+ GLOBALS._bExecutingAction = false;
+ GLOBALS._bExecutingDialog = false;
+
+ // There's no polling location
+ Common::fill(GLOBALS._nPollingLocations, GLOBALS._nPollingLocations + MAXPOLLINGLOCATIONS, 0);
+
+ // Create the event that will be used to co-ordinate making choices and choices finishing
+ GLOBALS._hAskChoice = CoroScheduler.createEvent(true, false);
+ GLOBALS._hDoneChoice = CoroScheduler.createEvent(true, false);
+
+ return true;
+}
+
+/**
+ * Frees resources allocated by the MPAL subsystem
+ */
+void mpalFree() {
+ // Free the resource list
+ globalDestroy(GLOBALS._lpResources);
+}
+
+/**
+ * This is a general function to communicate with the library, to request information
+ * about what is in the .MPC file
+ *
+ * @param wQueryType Type of query. The list is in the QueryTypes enum.
+ * @returns 4 bytes depending on the type of query
+ * @remarks This is the specialised version of the original single mpalQuery
+ * method that returns numeric results.
+ */
+uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
+ Common::String buf;
+ uint32 dwRet = 0;
+ char *n;
+
+ va_list v;
+ va_start(v, wQueryType);
+
+ GLOBALS._mpalError = OK;
+
+ if (wQueryType == MPQ_VERSION) {
+
+ /*
+ * uint32 mpalQuery(MPQ_VERSION);
+ */
+ dwRet = HEX_VERSION;
+
+ } else if (wQueryType == MPQ_GLOBAL_VAR) {
+ /*
+ * uint32 mpalQuery(MPQ_GLOBAL_VAR, char * lpszVarName);
+ */
+ lockVar();
+ dwRet = (uint32)varGetValue(GETARG(char *));
+ unlockVar();
+
+ } else if (wQueryType == MPQ_MESSAGE) {
+ /*
+ * char * mpalQuery(MPQ_MESSAGE, uint32 nMsg);
+ */
+ error("mpalQuery(MPQ_MESSAGE, uint32 nMsg) used incorrect method variant");
+
+
+ } else if (wQueryType == MPQ_ITEM_PATTERN) {
+ /*
+ * uint32 mpalQuery(MPQ_ITEM_PATTERN, uint32 nItem);
+ */
+ lockVar();
+ buf = Common::String::format("Pattern.%u", GETARG(uint32));
+ dwRet = (uint32)varGetValue(buf.c_str());
+ unlockVar();
+
+ } else if (wQueryType == MPQ_LOCATION_SIZE) {
+ /*
+ * uint32 mpalQuery(MPQ_LOCATION_SIZE, uint32 nLoc, uint32 dwCoord);
+ */
+ lockLocations();
+ int x = locGetOrderFromNum(GETARG(uint32));
+ int y = GETARG(uint32);
+ if (x != -1) {
+ if (y == MPQ_X)
+ dwRet = GLOBALS._lpmlLocations[x]._dwXlen;
+ else if (y == MPQ_Y)
+ dwRet = GLOBALS._lpmlLocations[x]._dwYlen;
+ else
+ GLOBALS._mpalError = 1;
+ } else
+ GLOBALS._mpalError = 1;
+
+ unlockLocations();
+
+ } else if (wQueryType == MPQ_LOCATION_IMAGE) {
+ /*
+ * HGLOBAL mpalQuery(MPQ_LOCATION_IMAGE, uint32 nLoc);
+ */
+ error("mpalQuery(MPQ_LOCATION_IMAGE, uint32 nLoc) used incorrect variant");
+
+ } else if (wQueryType == MPQ_RESOURCE) {
+ /*
+ * HGLOBAL mpalQuery(MPQ_RESOURCE, uint32 dwRes);
+ */
+ error("mpalQuery(MPQ_RESOURCE, uint32 dwRes) used incorrect variant");
+
+ } else if (wQueryType == MPQ_ITEM_LIST) {
+ /*
+ * uint32 mpalQuery(MPQ_ITEM_LIST, uint32 nLoc);
+ */
+ error("mpalQuery(MPQ_ITEM_LIST, uint32 nLoc) used incorrect variant");
+
+ } else if (wQueryType == MPQ_ITEM_DATA) {
+ /*
+ * LpItem mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
+ */
+ error("mpalQuery(MPQ_ITEM_DATA, uint32 nItem) used incorrect variant");
+
+ } else if (wQueryType == MPQ_ITEM_IS_ACTIVE) {
+ /*
+ * bool mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem);
+ */
+ lockVar();
+ int x = GETARG(uint32);
+ buf = Common::String::format("Status.%u", x);
+ if (varGetValue(buf.c_str()) <= 0)
+ dwRet = (uint32)false;
+ else
+ dwRet = (uint32)true;
+
+ unlockVar();
+
+ } else if (wQueryType == MPQ_ITEM_NAME) {
+ /*
+ * uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char * lpszName);
+ */
+ lockVar();
+ int x = GETARG(uint32);
+ n = GETARG(char *);
+ buf = Common::String::format("Status.%u", x);
+ if (varGetValue(buf.c_str()) <= 0)
+ n[0]='\0';
+ else {
+ lockItems();
+ int y = itemGetOrderFromNum(x);
+ memcpy(n, (char *)(GLOBALS._lpmiItems + y)->_lpszDescribe, MAX_DESCRIBE_SIZE);
+ unlockItems();
+ }
+
+ unlockVar();
+
+ } else if (wQueryType == MPQ_DIALOG_PERIOD) {
+ /*
+ * char *mpalQuery(MPQ_DIALOG_PERIOD, uint32 nDialog, uint32 nPeriod);
+ */
+ error("mpalQuery(MPQ_DIALOG_PERIOD, uint32 nDialog, uint32 nPeriod) used incorrect variant");
+
+ } else if (wQueryType == MPQ_DIALOG_WAITFORCHOICE) {
+ /*
+ * void mpalQuery(MPQ_DIALOG_WAITFORCHOICE);
+ */
+ error("mpalQuery(MPQ_DIALOG_WAITFORCHOICE) used incorrect variant");
+
+ } else if (wQueryType == MPQ_DIALOG_SELECTLIST) {
+ /*
+ * uint32 *mpalQuery(MPQ_DIALOG_SELECTLIST, uint32 nChoice);
+ */
+ error("mpalQuery(MPQ_DIALOG_SELECTLIST, uint32 nChoice) used incorrect variant");
+
+ } else if (wQueryType == MPQ_DIALOG_SELECTION) {
+ /*
+ * bool mpalQuery(MPQ_DIALOG_SELECTION, uint32 nChoice, uint32 dwData);
+ */
+ lockDialogs();
+ int x = GETARG(uint32);
+ int y = GETARG(uint32);
+ dwRet = (uint32)doSelection(x, y);
+
+ unlockDialogs();
+
+ } else if (wQueryType == MPQ_DO_ACTION) {
+ /*
+ * int mpalQuery(MPQ_DO_ACTION, uint32 nAction, uint32 nItem, uint32 dwParam);
+ */
+ lockItems();
+ lockVar();
+ int x = GETARG(uint32);
+ int z = GETARG(uint32);
+ int y = itemGetOrderFromNum(z);
+ if (y != -1) {
+ dwRet = doAction(x, y, GETARG(uint32));
+ } else {
+ dwRet = CORO_INVALID_PID_VALUE;
+ GLOBALS._mpalError = 1;
+ }
+
+ unlockVar();
+ unlockItems();
+
+ } else if (wQueryType == MPQ_DO_DIALOG) {
+ /*
+ * int mpalQuery(MPQ_DO_DIALOG, uint32 nDialog, uint32 nGroup);
+ */
+ if (!GLOBALS._bExecutingDialog) {
+ lockDialogs();
+
+ int x = dialogGetOrderFromNum(GETARG(uint32));
+ int y = GETARG(uint32);
+ dwRet = doDialog(x, y);
+ unlockDialogs();
+ }
+ } else {
+ /*
+ * DEFAULT -> ERROR
+ */
+ GLOBALS._mpalError = 1;
+ }
+
+ va_end(v);
+ return dwRet;
+}
+
+/**
+ * This is a general function to communicate with the library, to request information
+ * about what is in the .MPC file
+ *
+ * @param wQueryType Type of query. The list is in the QueryTypes enum.
+ * @returns 4 bytes depending on the type of query
+ * @remarks This is the specialised version of the original single mpalQuery
+ * method that returns a pointer or handle.
+ */
+MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) {
+ char *n;
+ Common::String buf;
+ va_list v;
+ va_start(v, wQueryType);
+ void *hRet = NULL;
+
+ GLOBALS._mpalError = OK;
+
+ if (wQueryType == MPQ_VERSION) {
+ /*
+ * uint32 mpalQuery(MPQ_VERSION);
+ */
+ error("mpalQuery(MPQ_VERSION) used incorrect variant");
+
+ } else if (wQueryType == MPQ_GLOBAL_VAR) {
+ /*
+ * uint32 mpalQuery(MPQ_GLOBAL_VAR, char * lpszVarName);
+ */
+ error("mpalQuery(MPQ_GLOBAL_VAR, char * lpszVarName) used incorrect variant");
+
+ } else if (wQueryType == MPQ_MESSAGE) {
+ /*
+ * char * mpalQuery(MPQ_MESSAGE, uint32 nMsg);
+ */
+ LockMsg();
+ hRet = DuplicateMessage(msgGetOrderFromNum(GETARG(uint32)));
+ UnlockMsg();
+
+ } else if (wQueryType == MPQ_ITEM_PATTERN) {
+ /*
+ * uint32 mpalQuery(MPQ_ITEM_PATTERN, uint32 nItem);
+ */
+ error("mpalQuery(MPQ_ITEM_PATTERN, uint32 nItem) used incorrect variant");
+
+ } else if (wQueryType == MPQ_LOCATION_SIZE) {
+ /*
+ * uint32 mpalQuery(MPQ_LOCATION_SIZE, uint32 nLoc, uint32 dwCoord);
+ */
+ error("mpalQuery(MPQ_LOCATION_SIZE, uint32 nLoc, uint32 dwCoord) used incorrect variant");
+
+ } else if (wQueryType == MPQ_LOCATION_IMAGE) {
+ /*
+ * HGLOBAL mpalQuery(MPQ_LOCATION_IMAGE, uint32 nLoc);
+ */
+ lockLocations();
+ int x = locGetOrderFromNum(GETARG(uint32));
+ hRet = resLoad(GLOBALS._lpmlLocations[x]._dwPicRes);
+ unlockLocations();
+
+ } else if (wQueryType == MPQ_RESOURCE) {
+ /*
+ * HGLOBAL mpalQuery(MPQ_RESOURCE, uint32 dwRes);
+ */
+ hRet = resLoad(GETARG(uint32));
+
+ } else if (wQueryType == MPQ_ITEM_LIST) {
+ /*
+ * uint32 mpalQuery(MPQ_ITEM_LIST, uint32 nLoc);
+ */
+ lockVar();
+ hRet = GetItemList(GETARG(uint32));
+ lockVar();
+
+ } else if (wQueryType == MPQ_ITEM_DATA) {
+ /*
+ * LpItem mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
+ */
+ lockItems();
+ hRet = getItemData(itemGetOrderFromNum(GETARG(uint32)));
+ unlockItems();
+
+ } else if (wQueryType == MPQ_ITEM_IS_ACTIVE) {
+ /*
+ * bool mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem);
+ */
+ error("mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem) used incorrect variant");
+
+ } else if (wQueryType == MPQ_ITEM_NAME) {
+ /*
+ * uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char *lpszName);
+ */
+ lockVar();
+ int x = GETARG(uint32);
+ n = GETARG(char *);
+ buf = Common::String::format("Status.%u", x);
+ if (varGetValue(buf.c_str()) <= 0)
+ n[0] = '\0';
+ else {
+ lockItems();
+ int y = itemGetOrderFromNum(x);
+ memcpy(n, (char *)(GLOBALS._lpmiItems + y)->_lpszDescribe, MAX_DESCRIBE_SIZE);
+ unlockItems();
+ }
+
+ unlockVar();
+
+ } else if (wQueryType == MPQ_DIALOG_PERIOD) {
+ /*
+ * char * mpalQuery(MPQ_DIALOG_PERIOD, uint32 nDialog, uint32 nPeriod);
+ */
+ lockDialogs();
+ int y = GETARG(uint32);
+ hRet = duplicateDialogPeriod(y);
+ unlockDialogs();
+
+ } else if (wQueryType == MPQ_DIALOG_WAITFORCHOICE) {
+ /*
+ * void mpalQuery(MPQ_DIALOG_WAITFORCHOICE);
+ */
+ error("mpalQuery(MPQ_DIALOG_WAITFORCHOICE) used incorrect variant");
+
+ } else if (wQueryType == MPQ_DIALOG_SELECTLIST) {
+ /*
+ * uint32 *mpalQuery(MPQ_DIALOG_SELECTLIST, uint32 nChoice);
+ */
+ lockDialogs();
+ hRet = getSelectList(GETARG(uint32));
+ unlockDialogs();
+
+ } else if (wQueryType == MPQ_DIALOG_SELECTION) {
+ /*
+ * bool mpalQuery(MPQ_DIALOG_SELECTION, uint32 nChoice, uint32 dwData);
+ */
+ error("mpalQuery(MPQ_DIALOG_SELECTION, uint32 nChoice, uint32 dwData) used incorrect variant");
+
+ } else if (wQueryType == MPQ_DO_ACTION) {
+ /*
+ * int mpalQuery(MPQ_DO_ACTION, uint32 nAction, uint32 nItem, uint32 dwParam);
+ */
+ error("mpalQuery(MPQ_DO_ACTION, uint32 nAction, uint32 nItem, uint32 dwParam) used incorrect variant");
+
+ } else if (wQueryType == MPQ_DO_DIALOG) {
+ /*
+ * int mpalQuery(MPQ_DO_DIALOG, uint32 nDialog, uint32 nGroup);
+ */
+ error("mpalQuery(MPQ_DO_DIALOG, uint32 nDialog, uint32 nGroup) used incorrect variant");
+ } else {
+ /*
+ * DEFAULT -> ERROR
+ */
+ GLOBALS._mpalError = 1;
+ }
+
+ va_end(v);
+ return hRet;
+}
+
+
+/**
+ * This is a general function to communicate with the library, to request information
+ * about what is in the .MPC file
+ *
+ * @param wQueryType Type of query. The list is in the QueryTypes enum.
+ * @returns 4 bytes depending on the type of query
+ * @remarks This is the specialised version of the original single mpalQuery
+ * method that needs to run within a co-routine context.
+ */
+void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...) {
+ CORO_BEGIN_CONTEXT;
+ uint32 dwRet;
+ CORO_END_CONTEXT(_ctx);
+
+ va_list v;
+ va_start(v, dwRet);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (wQueryType == MPQ_DIALOG_WAITFORCHOICE) {
+ /*
+ * void mpalQuery(MPQ_DIALOG_WAITFORCHOICE);
+ */
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._hAskChoice, CORO_INFINITE);
+
+ // WORKAROUND: Introduce a single frame delay so that if there are multiple actions running,
+ // they all have time to be signalled before resetting the event. This fixes a problem where
+ // if you try to use the 'shrimp' on the parrot a second time after trying to first use it
+ // whilst the parrot was talking, the cursor wouldn't be re-enabled afterwards
+ CORO_SLEEP(1);
+
+ CoroScheduler.resetEvent(GLOBALS._hAskChoice);
+
+ if (GLOBALS._bExecutingDialog)
+ *dwRet = (uint32)GLOBALS._nExecutingChoice;
+ else
+ *dwRet = (uint32)((int)-1);
+ } else {
+ error("mpalQueryCORO called with unsupported query type");
+ }
+
+ CORO_END_CODE;
+
+ va_end(v);
+}
+
+/**
+ * Returns the current MPAL error code
+ *
+ * @returns Error code
+ */
+uint32 mpalGetError() {
+ return GLOBALS._mpalError;
+}
+
+/**
+ * Execute a script. The script runs on multitasking by a thread.
+ *
+ * @param nScript Script number to run
+ * @returns TRUE if the script 'was launched, FALSE on failure
+ */
+bool mpalExecuteScript(int nScript) {
+ LockScripts();
+ int n = scriptGetOrderFromNum(nScript);
+ LpMpalScript s = (LpMpalScript)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalScript));
+ if (s == NULL)
+ return false;
+
+ memcpy(s, GLOBALS._lpmsScripts + n, sizeof(MpalScript));
+ unlockScripts();
+
+ // !!! New process management
+ if (CoroScheduler.createProcess(ScriptThread, &s, sizeof(LpMpalScript)) == CORO_INVALID_PID_VALUE)
+ return false;
+
+ return true;
+}
+
+/**
+ * Install a custom routine That will be called by MPAL every time the pattern
+ * of an item has been changed.
+ *
+ * @param lpiifCustom Custom function to install
+ */
+void mpalInstallItemIrq(LPITEMIRQFUNCTION lpiifCus) {
+ GLOBALS._lpiifCustom = lpiifCus;
+}
+
+/**
+ * Process the idle actions of the items on one location.
+ *
+ * @param nLoc Number of the location whose items must be processed
+ * for idle actions.
+ * @returns TRUE if all OK, and FALSE if it exceeded the maximum limit.
+ * @remarks The maximum number of locations that can be polled
+ * simultaneously is defined defined by MAXPOLLINGFUNCIONS
+ */
+bool mpalStartIdlePoll(int nLoc) {
+ for (uint32 i = 0; i < MAXPOLLINGLOCATIONS; i++) {
+ if (GLOBALS._nPollingLocations[i] == (uint32)nLoc)
+ return false;
+ }
+
+ for (uint32 i = 0; i < MAXPOLLINGLOCATIONS; i++) {
+ if (GLOBALS._nPollingLocations[i] == 0) {
+ GLOBALS._nPollingLocations[i] = nLoc;
+
+ GLOBALS._hEndPollingLocations[i] = CoroScheduler.createEvent(true, false);
+// !!! New process management
+ if ((GLOBALS._pollingThreads[i] = CoroScheduler.createProcess(LocationPollThread, &i, sizeof(uint32))) == CORO_INVALID_PID_VALUE)
+// if ((GLOBALS.hEndPollingLocations[i] = (void*)_beginthread(LocationPollThread, 10240, (void *)i))= = (void*)-1)
+ return false;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+/**
+ * Stop processing the idle actions of the items on one location.
+ *
+ * @param nLo Number of the location
+ * @returns TRUE if all OK, FALSE if the specified location was not
+ * in the process of polling
+ */
+void mpalEndIdlePoll(CORO_PARAM, int nLoc, bool *result) {
+ CORO_BEGIN_CONTEXT;
+ int i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ for (_ctx->i = 0; _ctx->i < MAXPOLLINGLOCATIONS; _ctx->i++) {
+ if (GLOBALS._nPollingLocations[_ctx->i] == (uint32)nLoc) {
+ CoroScheduler.setEvent(GLOBALS._hEndPollingLocations[_ctx->i]);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._pollingThreads[_ctx->i], CORO_INFINITE);
+
+ CoroScheduler.closeEvent(GLOBALS._hEndPollingLocations[_ctx->i]);
+ GLOBALS._nPollingLocations[_ctx->i] = 0;
+
+ if (result)
+ *result = true;
+ return;
+ }
+ }
+
+ if (result)
+ *result = false;
+
+ CORO_END_CODE;
+}
+
+/**
+ * Retrieve the length of a save state
+ *
+ * @returns Length in bytes
+ */
+int mpalGetSaveStateSize() {
+ return GLOBALS._nVars * sizeof(MpalVar) + 4;
+}
+
+/**
+ * Store the save state into a buffer. The buffer must be
+ * length at least the size specified with mpalGetSaveStateSize
+ *
+ * @param buf Buffer where to store the state
+ */
+void mpalSaveState(byte *buf) {
+ lockVar();
+ WRITE_LE_UINT32(buf, GLOBALS._nVars);
+ memcpy(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MpalVar));
+ unlockVar();
+}
+
+
+/**
+ * Load a save state from a buffer.
+ *
+ * @param buf Buffer where to store the state
+ * @returns Length of the state buffer in bytes
+ */
+int mpalLoadState(byte *buf) {
+ // We must destroy and recreate all the variables
+ globalFree(GLOBALS._hVars);
+
+ GLOBALS._nVars = READ_LE_UINT32(buf);
+
+ GLOBALS._hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS._nVars * sizeof(MpalVar));
+ lockVar();
+ memcpy((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MpalVar));
+ unlockVar();
+
+ return GLOBALS._nVars * sizeof(MpalVar) + 4;
+}
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h
new file mode 100644
index 0000000000..5e1b02b3fc
--- /dev/null
+++ b/engines/tony/mpal/mpal.h
@@ -0,0 +1,518 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+
+/****************************************************************************\
+* General Introduction
+\****************************************************************************/
+
+/*
+ * MPAL (MultiPurpose Adventure Language) is a high level language
+ * for the definition of adventure. Through the use of MPAL you can describe
+ * storyboard the adventure, and then use it with any user interface.
+ * In fact, unlike many other similar products, MPAL is not programmed through
+ * the whole adventure, but are defined only the locations, objects, as they may
+ * interact with each other, etc.. thus making MPAL useful for any type of adventure.
+ */
+
+/****************************************************************************\
+* Structure
+\****************************************************************************/
+
+/*
+ * MPAL consists of two main files: MPAL.DLL and MPAL.H
+ * The first is the DLL that contains the code to interface with MPAL
+ * adventures, the second is the header that defines the prototypes
+ * functions. MPAL is compiled for Win32, and it can therefore be used with
+ * any compiler that supports Win32 DLL (Watcom C++, Visual C++,
+ * Delphi, etc.), and therefore compatible with both Windows 95 and Windows NT.
+ *
+ * To use the DLL, and 'obviously need to create a library for symbols to export.
+ *
+ */
+
+
+/****************************************************************************\
+* Custom Functions
+\****************************************************************************/
+
+/*
+ * A custom function and a function specified by the program that uses the
+ * library, to perform the particular code. The custom functions are
+ * retrieved from the library as specified in the source MPAL, and in particular
+ * in defining the behavior of an item with some action.
+ *
+ * To use the custom functions, you need to prepare an array of
+ * pointers to functions (such as using the type casting LPCUSTOMFUNCTION,
+ * (defined below), and pass it as second parameter to mpalInit (). Note you
+ * must specify the size of the array, as elements of pointers and which do not
+ * contain the same: the library will call it only those functions specified in
+ * the source MPAL. It can be useful, for debugging reasons, do not bet
+ * the shares of arrays used to debugging function, to avoid unpleasant crash,
+ * if it has been made an error in source and / or some oversight in the code.
+ *
+ */
+
+#ifndef TONY_MPAL_H
+#define TONY_MPAL_H
+
+#include "common/scummsys.h"
+#include "common/coroutines.h"
+#include "common/rect.h"
+#include "common/str.h"
+#include "tony/mpal/memory.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* Macro definitions and structures
+\****************************************************************************/
+
+// OK value for the error codes
+#define OK 0
+
+#define MAXFRAMES 400 // frame animation of an object
+#define MAXPATTERN 40 // pattern of animation of an object
+#define MAXPOLLINGLOCATIONS 64
+
+#define GETARG(type) va_arg(v, type)
+
+/**
+ * Macro for use with queries that may refer to X and Y co-ordinates
+ */
+enum QueryCoordinates {
+ MPQ_X,
+ MPQ_Y
+};
+
+/**
+ * Query can be used with mpalQuery methods. In practice corresponds all claims
+ * that can do at the library
+ */
+enum QueryTypes {
+ // General Query
+ MPQ_VERSION = 10,
+
+ MPQ_GLOBAL_VAR = 50,
+ MPQ_RESOURCE,
+ MPQ_MESSAGE,
+
+ // Query on leases
+ MPQ_LOCATION_IMAGE = 100,
+ MPQ_LOCATION_SIZE,
+
+ // Queries about items
+ MPQ_ITEM_LIST = 200,
+ MPQ_ITEM_DATA,
+ MPQ_ITEM_PATTERN,
+ MPQ_ITEM_NAME,
+ MPQ_ITEM_IS_ACTIVE,
+
+ // Query dialog
+ MPQ_DIALOG_PERIOD = 300,
+ MPQ_DIALOG_WAITFORCHOICE,
+ MPQ_DIALOG_SELECTLIST,
+ MPQ_DIALOG_SELECTION,
+
+ // Query execution
+ MPQ_DO_ACTION = 400,
+ MPQ_DO_DIALOG
+};
+
+/**
+ * Framework to manage the animation of an item
+ */
+typedef struct {
+ char *_frames[MAXFRAMES];
+ Common::Rect _frameslocations[MAXFRAMES];
+ Common::Rect _bbox[MAXFRAMES];
+ short _pattern[MAXPATTERN][MAXFRAMES];
+ short _speed;
+ char _numframe;
+ char _numpattern;
+ char _curframe;
+ char _curpattern;
+ short _destX, _destY;
+ signed char _destZ;
+ short _objectID;
+} Item;
+typedef Item *LpItem;
+
+
+/**
+ * Define a custom function, to use the language MPAL to perform various controls as a result of an action
+ */
+typedef void (*LPCUSTOMFUNCTION)(CORO_PARAM, uint32, uint32, uint32, uint32);
+typedef LPCUSTOMFUNCTION *LPLPCUSTOMFUNCTION;
+
+/**
+ *
+ * Define an IRQ of an item that is called when the pattern changes or the status of an item
+ */
+typedef void (*LPITEMIRQFUNCTION)(uint32, int, int);
+typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
+
+/**
+ * @defgroup Macrofunctions query
+ *
+ * The following are defines used for simplifying calling the mpalQuery variants
+ */
+//@{
+
+/**
+ * Gets the current version of MPAL
+ *
+ * @returns Version number (0x1232 = 1.2.3b)
+ */
+#define mpalQueryVersion() \
+ (uint16)mpalQueryDWORD(MPQ_VERSION)
+
+/**
+ * Gets the numerical value of a global variable
+ *
+ * @param lpszVarName Variable name (ASCIIZ)
+ * @returns Global variable value
+ * @remarks This query was implemented for debugging. The program,
+ * if well designed, should not need to access variables from
+ * within the library.
+ */
+#define mpalQueryGlobalVar(lpszVarName) \
+ mpalQueryDWORD(MPQ_GLOBAL_VAR, (const char *)(lpszVarName))
+
+
+/**
+ * Provides access to a resource inside the .MPC file
+ *
+ * @param dwResId Resource Id
+ * @returns Handle to a memory area containing the resource, ready for use.
+ */
+#define mpalQueryResource(dwResId) \
+ mpalQueryHANDLE(MPQ_RESOURCE, (uint32)(dwResId))
+
+
+/**
+ * Returns a message.
+ *
+ * @param nMsg Message number
+ * @returns ASCIIZ message
+ * @remarks The returned pointer must be freed via the memory manager
+* after use. The message will be in ASCIIZ format.
+*/
+#define mpalQueryMessage(nMsg) \
+ (char *)mpalQueryHANDLE(MPQ_MESSAGE, (uint32)(nMsg))
+
+
+/**
+ * Provides a location image
+ * @return Returns a picture handle
+ */
+#define mpalQueryLocationImage(nLoc) \
+ mpalQueryHANDLE(MPQ_LOCATION_IMAGE, (uint32)(nLoc))
+
+
+/**
+ * Request the x or y size of a location in pixels
+ *
+ * @param nLoc Location number
+ * @param dwCoord MPQ_X or MPQ_Y coordinate to retrieve
+ * @returns Size
+ */
+#define mpalQueryLocationSize(nLoc, dwCoord) \
+ mpalQueryDWORD(MPQ_LOCATION_SIZE, (uint32)(nLoc), (uint32)(dwCoord))
+
+
+/**
+ * Provides the list of objects in a location.
+ *
+ * @param nLoc Location number
+ * @returns List of objects (accessible by Item [0], Item [1], etc.)
+ */
+// TODO: Determine if this is endian safe
+#define mpalQueryItemList(nLoc) \
+ (uint32 *)mpalQueryHANDLE(MPQ_ITEM_LIST, (uint32)(nLoc))
+
+
+/**
+ * Provides information on an item
+ *
+ * @param nItem Item number
+ * @returns Structure filled with requested information
+ */
+#define mpalQueryItemData(nItem) \
+ (LpItem)mpalQueryHANDLE(MPQ_ITEM_DATA, (uint32)(nItem))
+
+
+/**
+ * Provides the current pattern of an item
+ *
+ * @param nItem Item number
+ * @returns Number of animation patterns to be executed.
+ * @remarks By default, the pattern of 0 indicates that we should do nothing.
+ */
+#define mpalQueryItemPattern(nItem) \
+ mpalQueryDWORD(MPQ_ITEM_PATTERN, (uint32)(nItem))
+
+
+/**
+ * Returns true if an item is active
+ *
+ * @param nItem Item number
+ * @returns TRUE if the item is active, FALSE otherwise
+ */
+#define mpalQueryItemIsActive(nItem) \
+ (bool)mpalQueryDWORD(MPQ_ITEM_IS_ACTIVE, (uint32)(nItem))
+
+
+/**
+ * Returns the name of an item
+ *
+ * @param nItem Item number
+ * @param lpszName Pointer to a buffer of at least 33 bytes
+ * that will be filled with the name
+ * @remarks If the item is not active (ie. if its status or number
+ * is less than or equal to 0), the string will be empty.
+ */
+#define mpalQueryItemName(nItem, lpszName) \
+ mpalQueryHANDLE(MPQ_ITEM_NAME, (uint32)(nItem), (char *)(lpszName))
+
+
+/**
+ * Returns a sentence of dialog.
+ *
+ * @param nDialog Dialog number
+ * @param nPeriod Number of words
+ * @returns A pointer to the string of words, or NULL on failure.
+ * @remarks The string must be freed after use using the memory manager.
+ * Unlike normal messages, the sentences of dialogue are formed by a single
+ * string terminated with 0.
+ */
+#define mpalQueryDialogPeriod(nPeriod) \
+ (char *)mpalQueryHANDLE(MPQ_DIALOG_PERIOD, (uint32)(nPeriod))
+
+
+/**
+ * Wait until the moment in which the need is signaled to make a choice by the user.
+ * @returns Number of choice to be made, or -1 if the dialogue is finished.
+ */
+#define mpalQueryDialogWaitForChoice(dwRet) \
+ CORO_INVOKE_2(mpalQueryCORO, MPQ_DIALOG_WAITFORCHOICE, dwRet)
+
+/**
+ * Requires a list of various options for some choice within the current dialog.
+ *
+ * @param nChoice Choice number
+ * @returns A pointer to an array containing the data matched to each option.
+ * @remarks The figure 'a uint32 specified in the source to which MPAL
+ * You can assign meaning that the more' suits.
+ * The pointer msut be freed after use using the memory memory.
+ */
+#define mpalQueryDialogSelectList(nChoice) \
+ (uint32 *)mpalQueryHANDLE(MPQ_DIALOG_SELECTLIST, (uint32)(nChoice))
+
+/**
+ * Warns the library that the user has selected, in a certain choice of the current dialog,
+ * corresponding option at a certain given.
+ *
+ * @param nChoice Choice number of the choice that was in progress
+ * @param dwData Option that was selected by the user.
+ * @returns TRUE if all OK, FALSE on failure.
+ * @remarks After execution of this query, MPAL continue
+ * Groups according to the execution of the dialogue. And necessary so the game
+ * remains on hold again for another chosen by mpalQueryDialogWaitForChoice ().
+ */
+#define mpalQueryDialogSelection(nChoice, dwData) \
+ (bool)mpalQueryDWORD(MPQ_DIALOG_SELECTION, (uint32)(nChoice), (uint32)(dwData))
+
+#define mpalQueryDialogSelectionDWORD(nChoice, dwData) \
+ mpalQueryDWORD(MPQ_DIALOG_SELECTION, (uint32)(nChoice), (uint32)(dwData))
+
+/**
+ * Warns the library an action was performed on a Object.
+ * The library will call custom functions, if necessary.
+ *
+ * @param nAction Action number
+ * @param nItem Item number
+ * @param dwParam Action parameter
+ * @returns Handle to the thread that is performing the action, or CORO_INVALID_PID_VALUE
+ * if the action is not defined for the item, or the item is inactive.
+ * @remarks The parameter is used primarily to implement actions
+ * as "U.S." involving two objects together. The action will be executed only
+ * if the item is active, ie if its status is a positive number greater than 0.
+ */
+#define mpalQueryDoAction(nAction, nItem, dwParam) \
+ mpalQueryDWORD(MPQ_DO_ACTION, (uint32)(nAction), (uint32)(nItem), (uint32)(dwParam))
+
+/**
+ * Warns the library a dialogue was required.
+ *
+ * @param nDialog Dialog number
+ * @param nGroup Group number to use
+ * @returns Handle to the thread that is running the box, or
+ * CORO_INVALID_PID_VALUE if the dialogue does not exist.
+ */
+#define mpalQueryDoDialog(nDialog, nGroup) \
+ mpalQueryDWORD(MPQ_DO_DIALOG, (uint32)(nDialog), (uint32)(nGroup))
+
+/**
+ * @defgroup Functions exported to the main game
+ */
+//@{
+
+/**
+ * Initializes the MPAL library, and opens an .MPC file, which will be 'used for all queries
+ * @param lpszMpcFileName Name of the .MPC file, including extension
+ * @param lpszMprFileName Name of the .MPR file, including extension
+ * @param lplpcfArray Array of pointers to custom functions
+ * @returns TRUE if all OK, FALSE on failure
+ */
+bool mpalInit(const char *lpszFileName, const char *lpszMprFileName,
+ LPLPCUSTOMFUNCTION lplpcfArray, Common::String *lpcfStrings);
+
+/**
+ * Frees resources allocated by the MPAL subsystem
+ */
+void mpalFree();
+
+/**
+ * This is a general function to communicate with the library, to request information
+ * about what is in the .MPC file
+ *
+ * @param wQueryType Type of query. The list is in the QueryTypes enum.
+ * @returns 4 bytes depending on the type of query
+ * @remarks This is the specialised version of the original single mpalQuery
+ * method that returns numeric results.
+ */
+uint32 mpalQueryDWORD(uint16 wQueryType, ...);
+
+/**
+ * This is a general function to communicate with the library, to request information
+ * about what is in the .MPC file
+ *
+ * @param wQueryType Type of query. The list is in the QueryTypes enum.
+ * @returns 4 bytes depending on the type of query
+ * @remarks This is the specialised version of the original single mpalQuery
+ * method that returns a pointer or handle.
+ */
+MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...);
+
+/**
+ * This is a general function to communicate with the library, to request information
+ * about what is in the .MPC file
+ *
+ * @param wQueryType Type of query. The list is in the QueryTypes enum.
+ * @returns 4 bytes depending on the type of query
+ * @remarks This is the specialised version of the original single mpalQuery
+ * method that needs to run within a co-routine context.
+ */
+void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...);
+
+/**
+ * Execute a script. The script runs on multitasking by a thread.
+ *
+ * @param nScript Script number to run
+ * @returns TRUE if the script 'was launched, FALSE on failure
+ */
+bool mpalExecuteScript(int nScript);
+
+/**
+ * Returns the current MPAL error code
+ *
+ * @returns Error code
+ */
+uint32 mpalGetError();
+
+/**
+ * Install a custom routine That will be called by MPAL every time the pattern
+ * of an item has been changed.
+ *
+ * @param lpiifCustom Custom function to install
+ */
+void mpalInstallItemIrq(LPITEMIRQFUNCTION lpiifCustom);
+
+/**
+ * Process the idle actions of the items on one location.
+ *
+ * @param nLoc Number of the location whose items must be processed
+ * for idle actions.
+ * @returns TRUE if all OK, and FALSE if it exceeded the maximum limit.
+ * @remarks The maximum number of locations that can be polled
+ * simultaneously is defined defined by MAXPOLLINGFUNCIONS
+ */
+bool mpalStartIdlePoll(int nLoc);
+
+/**
+ * Stop processing the idle actions of the items on one location.
+ *
+ * @param nLo Number of the location
+ * @returns TRUE if all OK, FALSE if the specified location was not
+ * in the process of polling
+ */
+void mpalEndIdlePoll(CORO_PARAM, int nLoc, bool *result);
+
+
+/**
+ * Load a save state from a buffer.
+ *
+ * @param buf Buffer where to store the state
+ * @returns Length of the state buffer in bytes
+ */
+int mpalLoadState(byte *buf);
+
+/**
+ * Store the save state into a buffer. The buffer must be
+ * length at least the size specified with mpalGetSaveStateSize
+ *
+ * @param buf Buffer where to store the state
+ */
+void mpalSaveState(byte *buf);
+
+/**
+ * Retrieve the length of a save state
+ *
+ * @returns Length in bytes
+ */
+int mpalGetSaveStateSize();
+
+/**
+ * Locks the variables for access
+ */
+void lockVar();
+
+/**
+ * Unlocks variables after use
+ */
+void unlockVar();
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif
+
diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h
new file mode 100644
index 0000000000..8897096f51
--- /dev/null
+++ b/engines/tony/mpal/mpaldll.h
@@ -0,0 +1,251 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef __MPALDLL_H
+#define __MPALDLL_H
+
+#include "common/file.h"
+#include "tony/mpal/memory.h"
+#include "tony/mpal/loadmpc.h"
+#include "tony/mpal/expr.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* Defines
+\****************************************************************************/
+
+#define HEX_VERSION 0x0170
+
+#define MAX_ACTIONS_PER_ITEM 40
+#define MAX_COMMANDS_PER_ITEM 128
+#define MAX_COMMANDS_PER_ACTION 128
+#define MAX_DESCRIBE_SIZE 64
+
+#define MAX_MOMENTS_PER_SCRIPT 256
+#define MAX_COMMANDS_PER_SCRIPT 256
+#define MAX_COMMANDS_PER_MOMENT 32
+
+#define MAX_GROUPS_PER_DIALOG 128
+#define MAX_COMMANDS_PER_DIALOG 480
+#define MAX_COMMANDS_PER_GROUP 64
+#define MAX_CHOICES_PER_DIALOG 64
+#define MAX_SELECTS_PER_CHOICE 64
+#define MAX_PLAYGROUPS_PER_SELECT 9
+#define MAX_PERIODS_PER_DIALOG 400
+
+#define NEED_LOCK_MSGS
+
+/****************************************************************************\
+* Structures
+\****************************************************************************/
+
+#include "common/pack-start.h"
+
+/**
+ * MPAL global variables
+ */
+struct MpalVar {
+ uint32 _dwVal; // Variable value
+ char _lpszVarName[33]; // Variable name
+} PACKED_STRUCT;
+typedef MpalVar *LpMpalVar;
+
+/**
+ * MPAL Messages
+ */
+struct MpalMsg {
+ MpalHandle _hText; // Handle to the message text
+ uint16 _wNum; // Message number
+} PACKED_STRUCT;
+typedef MpalMsg *LpMpalMsg;
+
+/**
+ * MPAL Locations
+ */
+struct MpalLocation {
+ uint32 _nObj; // Location number
+ uint32 _dwXlen, _dwYlen; // Dimensions
+ uint32 _dwPicRes; // Resource that contains the image
+} PACKED_STRUCT;
+typedef MpalLocation *LpMpalLocation;
+
+/**
+ * All the data for a command, ie. tags used by OnAction in the item, the time
+ * in the script, and in the group dialog.
+ */
+struct Command {
+ /*
+ * Types of commands that are recognized
+ *
+ * #1 -> Custom function call (ITEM, SCRIPT, DIALOG)
+ * #2 -> Variable assignment (ITEM, SCRIPT, DIALOG)
+ * #3 -> Making a choice (DIALOG)
+ *
+ */
+ byte _type; // Type of control
+
+ union {
+ int32 _nCf; // Custom function call [#1]
+ char *_lpszVarName; // Variable name [#2]
+ int32 _nChoice; // Number of choice you make [#3]
+ };
+
+ union {
+ int32 _arg1; // Argument for custom function [#1]
+ MpalHandle _expr; // Expression to assign to a variable [#2]
+ };
+
+ int32 _arg2, _arg3, _arg4; // Arguments for custom function [#1]
+} PACKED_STRUCT;
+
+
+/**
+ * MPAL dialog
+ */
+struct MpalDialog {
+ uint32 _nObj; // Dialog number
+
+ struct Command _command[MAX_COMMANDS_PER_DIALOG];
+
+ struct {
+ uint16 _num;
+ byte _nCmds;
+ uint16 _cmdNum[MAX_COMMANDS_PER_GROUP];
+
+ } _group[MAX_GROUPS_PER_DIALOG];
+
+ struct {
+ // The last choice has nChoice == 0
+ uint16 _nChoice;
+
+ // The select number (we're pretty stingy with RAM). The last select has dwData == 0
+ struct {
+ MpalHandle _when;
+ uint32 _dwData;
+ uint16 _wPlayGroup[MAX_PLAYGROUPS_PER_SELECT];
+
+ // Bit 0=endchoice Bit 1=enddialog
+ byte _attr;
+
+ // Modified at run-time: 0 if the select is currently disabled,
+ // and 1 if currently active
+ byte _curActive;
+ } _select[MAX_SELECTS_PER_CHOICE];
+
+ } _choice[MAX_CHOICES_PER_DIALOG];
+
+ uint16 _periodNums[MAX_PERIODS_PER_DIALOG];
+ MpalHandle _periods[MAX_PERIODS_PER_DIALOG];
+
+} PACKED_STRUCT;
+typedef MpalDialog *LpMpalDialog;
+
+/**
+ * MPAL Item
+ */
+struct ItemAction {
+ byte _num; // Action number
+ uint16 _wTime; // If idle, the time which must pass
+ byte _perc; // Percentage of the idle run
+ MpalHandle _when; // Expression to compute. If != 0, then
+ // action can be done
+ uint16 _wParm; // Parameter for action
+
+ byte _nCmds; // Number of commands to be executed
+ uint32 _cmdNum[MAX_COMMANDS_PER_ACTION]; // Commands to execute
+} PACKED_STRUCT;
+
+struct MpalItem {
+ uint32 _nObj; // Item number
+
+ byte _lpszDescribe[MAX_DESCRIBE_SIZE]; // Name
+ byte _nActions; // Number of managed actions
+ uint32 _dwRes; // Resource that contains frames and patterns
+
+ struct Command _command[MAX_COMMANDS_PER_ITEM];
+
+ // Pointer to array of structures containing various managed activities. In practice, of
+ // every action we know what commands to run, including those defined in structures above
+ struct ItemAction *_action;
+
+} PACKED_STRUCT;
+typedef MpalItem *LpMpalItem;
+
+/**
+ * MPAL Script
+ */
+struct MpalScript {
+ uint32 _nObj;
+ uint32 _nMoments;
+
+ struct Command _command[MAX_COMMANDS_PER_SCRIPT];
+
+ struct {
+ int32 _dwTime;
+ byte _nCmds;
+ uint32 _cmdNum[MAX_COMMANDS_PER_MOMENT];
+
+ } _moment[MAX_MOMENTS_PER_SCRIPT];
+
+} PACKED_STRUCT;
+typedef MpalScript *LpMpalScript;
+
+#include "common/pack-end.h"
+
+/****************************************************************************\
+* Function prototypes
+\****************************************************************************/
+
+/**
+ * Returns the current value of a global variable
+ *
+ * @param lpszVarName Name of the variable
+ * @returns Current value
+ * @remarks Before using this method, you must call LockVar() to
+ * lock the global variablves for use. Then afterwards, you will
+ * need to remember to call UnlockVar()
+ */
+extern int32 varGetValue(const char *lpszVarName);
+
+
+/**
+ * Sets the value of a MPAL global variable
+ * @param lpszVarName Name of the variable
+ * @param val Value to set
+ */
+extern void varSetValue(const char *lpszVarName, int32 val);
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif
+
diff --git a/engines/tony/mpal/mpalutils.cpp b/engines/tony/mpal/mpalutils.cpp
new file mode 100644
index 0000000000..0919aed5ac
--- /dev/null
+++ b/engines/tony/mpal/mpalutils.cpp
@@ -0,0 +1,115 @@
+/* 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 "tony/mpal/mpalutils.h"
+#include "tony/tony.h"
+#include "common/memstream.h"
+
+namespace Tony {
+
+namespace MPAL {
+
+/****************************************************************************\
+* RMRes methods
+\****************************************************************************/
+
+/**
+ * Constructor
+ * @param resId MPAL resource to open
+ */
+RMRes::RMRes(uint32 resID) {
+ _h = g_vm->_resUpdate.queryResource(resID);
+ if (_h == NULL)
+ _h = mpalQueryResource(resID);
+ if (_h != NULL)
+ _buf = (byte *)globalLock(_h);
+}
+
+/**
+ * Destructor
+ */
+RMRes::~RMRes() {
+ if (_h != NULL) {
+ globalUnlock(_h);
+ globalFree(_h);
+ }
+}
+
+/**
+ * Returns a pointer to the resource
+ */
+const byte *RMRes::dataPointer() {
+ return _buf;
+}
+
+/**
+ * Returns a pointer to the resource
+ */
+RMRes::operator const byte *() {
+ return dataPointer();
+}
+
+/**
+ * Returns the size of the resource
+ */
+unsigned int RMRes::size() {
+ return globalSize(_h);
+}
+
+Common::SeekableReadStream *RMRes::getReadStream() {
+ return new Common::MemoryReadStream(_buf, size());
+}
+
+bool RMRes::isValid() {
+ return _h != NULL;
+}
+
+/****************************************************************************\
+* RMResRaw methods
+\****************************************************************************/
+
+RMResRaw::RMResRaw(uint32 resID) : RMRes(resID) {
+}
+
+RMResRaw::~RMResRaw() {
+}
+
+const byte *RMResRaw::dataPointer() {
+ return _buf + 8;
+}
+
+RMResRaw::operator const byte *() {
+ return dataPointer();
+}
+
+int RMResRaw::width() {
+ return READ_LE_UINT16(_buf + 4);
+}
+
+int RMResRaw::height() {
+ return READ_LE_UINT16(_buf + 6);
+}
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
diff --git a/engines/tony/mpal/mpalutils.h b/engines/tony/mpal/mpalutils.h
new file mode 100644
index 0000000000..d92bb6f9a2
--- /dev/null
+++ b/engines/tony/mpal/mpalutils.h
@@ -0,0 +1,74 @@
+/* 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 TONY_MPAL_MPALUTILS
+#define TONY_MPAL_MPALUTILS
+
+#include "common/scummsys.h"
+#include "tony/mpal/memory.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Tony {
+
+namespace MPAL {
+
+class RMRes {
+protected:
+ MpalHandle _h;
+ byte *_buf;
+
+public:
+ RMRes(uint32 resID);
+ virtual ~RMRes();
+
+ // Attributes
+ unsigned int size();
+ const byte *dataPointer();
+ bool isValid();
+
+ // Casting for access to data
+ operator const byte*();
+
+ Common::SeekableReadStream *getReadStream();
+};
+
+class RMResRaw : public RMRes {
+public:
+ RMResRaw(uint32 resID);
+ virtual ~RMResRaw();
+
+ const byte *dataPointer();
+ operator const byte*();
+
+ int width();
+ int height();
+};
+
+} // end of namespace MPAL
+
+} // end of namespace Tony
+
+#endif
diff --git a/engines/tony/resid.h b/engines/tony/resid.h
new file mode 100644
index 0000000000..f4d2c9a4fa
--- /dev/null
+++ b/engines/tony/resid.h
@@ -0,0 +1,71 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+// From 10500 onwards there are .OGG for inventory and scrap
+#ifndef TONY_RESID_H
+#define TONY_RESID_H
+
+
+#define RES_I_INTERFACE 10300
+#define RES_I_INTERPAL 10301
+#define RES_I_INTERPPAL 10302
+#define RES_I_INTERP1 10303
+#define RES_I_INTERP2 10304
+#define RES_I_INTERP3 10305
+#define RES_I_INTERP4 10306
+#define RES_I_INTERP5 10307
+
+#define RES_I_DLGTEXT 10350
+#define RES_I_DLGTEXTLINE 10351
+#define RES_I_DLGTEXTPAL 10352
+
+#define RES_I_MINIINTER 10360
+
+#define RES_P_PAL 10410
+#define RES_P_GO 10400
+#define RES_P_TAKE 10401
+#define RES_P_USE 10402
+#define RES_P_EXAM 10403
+#define RES_P_TALK 10404
+
+#define RES_P_PAP1 10420
+#define RES_P_PAP2 10421
+#define RES_P_PAP3 10422
+#define RES_P_PAP4 10423
+#define RES_P_FRMAP 10424
+
+#define RES_F_PAL 10700
+#define RES_F_PARL 10701
+#define RES_F_OBJ 10702
+#define RES_F_MACC 10703
+#define RES_F_CREDITS 10704
+#define RES_F_CPAL 10705
+
+#define RES_W_CIRCLE 10800
+
+#endif
diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp
new file mode 100644
index 0000000000..2844e0d925
--- /dev/null
+++ b/engines/tony/sound.cpp
@@ -0,0 +1,688 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "audio/audiostream.h"
+#include "audio/decoders/adpcm.h"
+#include "audio/decoders/raw.h"
+#include "audio/decoders/wave.h"
+#include "common/textconsole.h"
+#include "tony/game.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+/****************************************************************************\
+* FPSOUND Methods
+\****************************************************************************/
+
+/**
+ * Default constructor. Initializes the attributes.
+ *
+ */
+FPSound::FPSound() {
+ _soundSupported = false;
+}
+
+/**
+ * Initializes the object, and prepare everything you need to create streams and sound effects.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+bool FPSound::init() {
+ _soundSupported = g_system->getMixer()->isReady();
+ return _soundSupported;
+}
+
+/**
+ * Destroy the object and free the memory
+ *
+ */
+
+FPSound::~FPSound() {
+}
+
+/**
+ * Allocates an object of type FPStream, and return its pointer
+ *
+ * @param streamPtr Will contain a pointer to the object you just created.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+bool FPSound::createStream(FPStream **streamPtr) {
+ (*streamPtr) = new FPStream(_soundSupported);
+
+ return (*streamPtr != NULL);
+}
+
+/**
+ * Allocates an object of type FpSfx, and return its pointer
+ *
+ * @param soundPtr Will contain a pointer to the object you just created.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+bool FPSound::createSfx(FPSfx **sfxPtr) {
+ (*sfxPtr) = new FPSfx(_soundSupported);
+
+ return (*sfxPtr != NULL);
+}
+
+/**
+ * Set the general volume
+ *
+ * @param volume Volume to set (0-63)
+ */
+
+void FPSound::setMasterVolume(int volume) {
+ if (!_soundSupported)
+ return;
+
+ g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, CLIP<int>(volume, 0, 63) * Audio::Mixer::kMaxChannelVolume / 63);
+}
+
+/**
+ * Get the general volume
+ *
+ * @param volumePtr Variable that will contain the volume (0-63)
+ */
+
+void FPSound::getMasterVolume(int *volumePtr) {
+ if (!_soundSupported)
+ return;
+
+ *volumePtr = g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) * 63 / Audio::Mixer::kMaxChannelVolume;
+}
+
+/**
+ * Default constructor.
+ *
+ * @remarks Do *NOT* declare an object directly, but rather
+ * create it using FPSound::CreateSfx()
+ *
+ */
+
+FPSfx::FPSfx(bool soundOn) {
+ _soundSupported = soundOn;
+ _fileLoaded = false;
+ _lastVolume = 63;
+ _hEndOfBuffer = CoroScheduler.createEvent(true, false);
+ _isVoice = false;
+ _loopStream = 0;
+ _rewindableStream = 0;
+ _paused = false;
+
+ g_vm->_activeSfx.push_back(this);
+}
+
+/**
+ * Default Destructor.
+ *
+ * @remarks It is also stops the sound effect that may be
+ * currently played, and free the memory it uses.
+ *
+ */
+
+FPSfx::~FPSfx() {
+ if (!_soundSupported)
+ return;
+
+ g_system->getMixer()->stopHandle(_handle);
+ g_vm->_activeSfx.remove(this);
+
+ if (_loopStream)
+ delete _loopStream; // _rewindableStream is deleted by deleting _loopStream
+ else
+ delete _rewindableStream;
+
+ // Free the buffer end event
+ CoroScheduler.closeEvent(_hEndOfBuffer);
+}
+
+/**
+ * Releases the memory used by the object.
+ *
+ * @remarks Must be called when the object is no longer used and
+ * **ONLY** if the object was created by
+ * FPSound::CreateStream().
+ * Object pointers are no longer valid after this call.
+ */
+
+void FPSfx::release() {
+ delete this;
+}
+
+bool FPSfx::loadWave(Common::SeekableReadStream *stream) {
+ if (!stream)
+ return false;
+
+ _rewindableStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
+
+ if (!_rewindableStream)
+ return false;
+
+ _fileLoaded = true;
+ setVolume(_lastVolume);
+ return true;
+}
+
+bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) {
+ if (!_soundSupported)
+ return true;
+
+ uint32 size = vdbFP.readUint32LE();
+ uint32 rate = vdbFP.readUint32LE();
+ _isVoice = true;
+
+ _rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1);
+
+ _fileLoaded = true;
+ setVolume(62);
+ return true;
+}
+
+/**
+ * Opens a file and loads a sound effect.
+ *
+ * @param fileName Sfx filename
+ * @param codec CODEC used to uncompress the samples
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+bool FPSfx::loadFile(const char *fileName, uint32 codec) {
+ if (!_soundSupported)
+ return true;
+
+ Common::File file;
+ if (!file.open(fileName)) {
+ warning("FPSfx::LoadFile(): Cannot open sfx file!");
+ return false;
+ }
+
+ if (file.readUint32BE() != MKTAG('A', 'D', 'P', 0x10)) {
+ warning("FPSfx::LoadFile(): Invalid ADP header!");
+ return false;
+ }
+
+ uint32 rate = file.readUint32LE();
+ uint32 channels = file.readUint32LE();
+
+ Common::SeekableReadStream *buffer = file.readStream(file.size() - file.pos());
+
+ if (codec == FPCODEC_ADPCM) {
+ _rewindableStream = Audio::makeADPCMStream(buffer, DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, channels);
+ } else {
+ byte flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
+
+ if (channels == 2)
+ flags |= Audio::FLAG_STEREO;
+
+ _rewindableStream = Audio::makeRawStream(buffer, rate, flags, DisposeAfterUse::YES);
+ }
+
+ _fileLoaded = true;
+ return true;
+}
+
+/**
+ * Play the Sfx in memory.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+bool FPSfx::play() {
+ stop(); // sanity check
+
+ if (_fileLoaded) {
+ CoroScheduler.resetEvent(_hEndOfBuffer);
+
+ _rewindableStream->rewind();
+
+ Audio::AudioStream *stream = _rewindableStream;
+
+ if (_loop) {
+ if (!_loopStream)
+ _loopStream = Audio::makeLoopingAudioStream(_rewindableStream, 0);
+
+ stream = _loopStream;
+ }
+
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, stream, -1,
+ Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+
+ setVolume(_lastVolume);
+
+ if (_paused)
+ g_system->getMixer()->pauseHandle(_handle, true);
+ }
+
+ return true;
+}
+
+/**
+ * Stops a Sfx.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+bool FPSfx::stop() {
+ if (_fileLoaded) {
+ g_system->getMixer()->stopHandle(_handle);
+ _paused = false;
+ }
+
+ return true;
+}
+
+/**
+ * Enables or disables the Sfx loop.
+ *
+ * @param loop True to enable the loop, False to disable
+ *
+ * @remarks The loop must be activated BEFORE the sfx starts
+ * playing. Any changes made during the play will have
+ * no effect until the sfx is stopped then played again.
+ */
+
+void FPSfx::setLoop(bool loop) {
+ _loop = loop;
+}
+
+/**
+ * Pauses a Sfx.
+ *
+ */
+
+void FPSfx::setPause(bool pause) {
+ if (_fileLoaded) {
+ if (g_system->getMixer()->isSoundHandleActive(_handle) && (pause ^ _paused))
+ g_system->getMixer()->pauseHandle(_handle, pause);
+
+ _paused = pause;
+ }
+}
+
+/**
+ * Change the volume of Sfx
+ *
+ * @param volume Volume to be set (0-63)
+ *
+ */
+
+void FPSfx::setVolume(int volume) {
+ if (volume > 63)
+ volume = 63;
+
+ if (volume < 0)
+ volume = 0;
+
+ _lastVolume = volume;
+
+ if (_isVoice) {
+ if (!GLOBALS._bCfgDubbing)
+ volume = 0;
+ else {
+ volume -= (10 - GLOBALS._nCfgDubbingVolume) * 2;
+ if (volume < 0)
+ volume = 0;
+ }
+ } else {
+ if (!GLOBALS._bCfgSFX)
+ volume = 0;
+ else {
+ volume -= (10 - GLOBALS._nCfgSFXVolume) * 2;
+ if (volume < 0)
+ volume = 0;
+ }
+ }
+
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ g_system->getMixer()->setChannelVolume(_handle, volume * Audio::Mixer::kMaxChannelVolume / 63);
+}
+
+/**
+ * Gets the Sfx volume
+ *
+ * @param volumePtr Will contain the current Sfx volume
+ *
+ */
+
+void FPSfx::getVolume(int *volumePtr) {
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ *volumePtr = g_system->getMixer()->getChannelVolume(_handle) * 63 / Audio::Mixer::kMaxChannelVolume;
+ else
+ *volumePtr = 0;
+}
+
+/**
+ * Returns true if the underlying sound has ended
+ */
+
+bool FPSfx::endOfBuffer() const {
+ return !g_system->getMixer()->isSoundHandleActive(_handle) && (!_rewindableStream || _rewindableStream->endOfData());
+}
+
+/**
+ * Continually checks to see if active sounds have finished playing
+ * Sets the event signalling the sound has ended
+ */
+void FPSfx::soundCheckProcess(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ Common::List<FPSfx *>::iterator i;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ for (;;) {
+ // Check each active sound
+ for (_ctx->i = g_vm->_activeSfx.begin(); _ctx->i != g_vm->_activeSfx.end(); ++_ctx->i) {
+ FPSfx *sfx = *_ctx->i;
+ if (sfx->endOfBuffer())
+ CoroScheduler.setEvent(sfx->_hEndOfBuffer);
+ }
+
+ // Delay until the next check is done
+ CORO_INVOKE_1(CoroScheduler.sleep, 50);
+ }
+
+ CORO_END_CODE;
+}
+
+/**
+ * Default constructor.
+ *
+ * @remarks Do *NOT* declare an object directly, but rather
+ * create it using FPSound::CreateStream()
+ */
+FPStream::FPStream(bool soundOn) {
+ _soundSupported = soundOn;
+ _fileLoaded = false;
+ _paused = false;
+ _loop = false;
+ _doFadeOut = false;
+ _syncExit = false;
+ _bufferSize = _size = 0;
+ _lastVolume = 0;
+ _syncToPlay = NULL;
+ _loopStream = NULL;
+ _rewindableStream = NULL;
+}
+
+/**
+ * Default destructor.
+ *
+ * @remarks It calls CloseFile() if needed.
+ */
+
+FPStream::~FPStream() {
+ if (!_soundSupported)
+ return;
+
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ stop();
+
+ if (_fileLoaded)
+ unloadFile();
+
+ _syncToPlay = NULL;
+}
+
+/**
+ * Releases the memory object.
+ *
+ * @remarks Must be called when the object is no longer used
+ * and **ONLY** if the object was created by
+ * FPSound::CreateStream().
+ * Object pointers are no longer valid after this call.
+ */
+void FPStream::release() {
+ delete this;
+}
+
+/**
+ * Opens a file stream
+ *
+ * @param fileName Filename to be opened
+ * @param codec CODEC to be used to uncompress samples
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSize) {
+ if (!_soundSupported)
+ return true;
+
+ if (_fileLoaded)
+ unloadFile();
+
+ // Save the codec type
+ _codec = codec;
+
+ // Open the file stream for reading
+ if (!_file.open(fileName)) {
+ // Fallback: try with an extra '0' prefix
+ if (!_file.open("0" + fileName))
+ return false;
+ }
+
+ // Save the size of the stream
+ _size = _file.size();
+
+ switch (_codec) {
+ case FPCODEC_RAW:
+ _rewindableStream = Audio::makeRawStream(&_file, 44100, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO, DisposeAfterUse::NO);
+ break;
+
+ case FPCODEC_ADPCM:
+ _rewindableStream = Audio::makeADPCMStream(&_file, DisposeAfterUse::NO, 0, Audio::kADPCMDVI, 44100, 2);
+ break;
+
+ default:
+ _file.close();
+ return false;
+ }
+
+ // All done
+ _fileLoaded = true;
+ _paused = false;
+
+ setVolume(63);
+
+ return true;
+}
+
+/**
+ * Closes a file stream (opened or not).
+ *
+ * @returns For safety, the destructor calls unloadFile() if it has not
+ * been mentioned explicitly.
+ *
+ * @remarks It is necessary to call this function to free the
+ * memory used by the stream.
+ */
+bool FPStream::unloadFile() {
+ if (!_soundSupported || !_fileLoaded)
+ return true;
+
+ assert(!g_system->getMixer()->isSoundHandleActive(_handle));
+
+ // Closes the file handle stream
+ delete _loopStream;
+ delete _rewindableStream;
+ _loopStream = NULL;
+ _rewindableStream = NULL;
+ _file.close();
+
+ // Flag that the file is no longer in memory
+ _fileLoaded = false;
+
+ return true;
+}
+
+/**
+ * Play the stream.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+bool FPStream::play() {
+ if (!_soundSupported || !_fileLoaded)
+ return false;
+
+ stop();
+
+ _rewindableStream->rewind();
+
+ Audio::AudioStream *stream = _rewindableStream;
+
+ if (_loop) {
+ if (!_loopStream)
+ _loopStream = new Audio::LoopingAudioStream(_rewindableStream, 0, DisposeAfterUse::NO);
+
+ stream = _loopStream;
+ }
+
+ // FIXME: Should this be kMusicSoundType or KPlainSoundType?
+ g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_handle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ setVolume(_lastVolume);
+ _paused = false;
+
+ return true;
+}
+
+/**
+ * Closes the stream.
+ *
+ * @returns True is everything is OK, False otherwise
+ *
+ */
+
+bool FPStream::stop() {
+ if (!_soundSupported)
+ return true;
+
+ if (!_fileLoaded)
+ return false;
+
+ if (!g_system->getMixer()->isSoundHandleActive(_handle))
+ return false;
+
+ g_system->getMixer()->stopHandle(_handle);
+
+ _paused = false;
+
+ return true;
+}
+
+void FPStream::waitForSync(FPStream *toPlay) {
+ // FIXME: The idea here is that you wait for this stream to reach
+ // a buffer which is a multiple of nBufSize/nSync, and then the
+ // thread stops it and immediately starts the 'toplay' stream.
+
+ stop();
+ toPlay->play();
+}
+
+/**
+ * Unables or disables stream loop.
+ *
+ * @param loop True enable loop, False disables it
+ *
+ * @remarks The loop must be activated BEFORE the stream starts
+ * playing. Any changes made during the play will have no
+ * effect until the stream is stopped then played again.
+ */
+void FPStream::setLoop(bool loop) {
+ _loop = loop;
+}
+
+/**
+ * Pause sound effect
+ *
+ * @param pause True enables pause, False disables it
+ */
+void FPStream::setPause(bool pause) {
+ if (!_fileLoaded)
+ return;
+
+ if (pause == _paused)
+ return;
+
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ g_system->getMixer()->pauseHandle(_handle, pause);
+
+ _paused = pause;
+
+ // Trick to reset the volume after a possible new sound configuration
+ setVolume(_lastVolume);
+}
+
+/**
+ * Change the volume of the stream
+ *
+ * @param volume Volume to be set (0-63)
+ *
+ */
+
+void FPStream::setVolume(int volume) {
+ if (volume > 63)
+ volume = 63;
+
+ if (volume < 0)
+ volume = 0;
+
+ _lastVolume = volume;
+
+ if (!GLOBALS._bCfgMusic)
+ volume = 0;
+ else {
+ volume -= (10 - GLOBALS._nCfgMusicVolume) * 2;
+ if (volume < 0)
+ volume = 0;
+ }
+
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ g_system->getMixer()->setChannelVolume(_handle, volume * Audio::Mixer::kMaxChannelVolume / 63);
+}
+
+/**
+ * Gets the volume of the stream
+ *
+ * @param volumePtr Variable that will contain the current volume
+ *
+ */
+
+void FPStream::getVolume(int *volumePtr) {
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ *volumePtr = g_system->getMixer()->getChannelVolume(_handle) * 63 / Audio::Mixer::kMaxChannelVolume;
+ else
+ *volumePtr = 0;
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/sound.h b/engines/tony/sound.h
new file mode 100644
index 0000000000..7422de02b3
--- /dev/null
+++ b/engines/tony/sound.h
@@ -0,0 +1,377 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_SOUND_H
+#define TONY_SOUND_H
+
+#include "audio/mixer.h"
+#include "common/file.h"
+#include "tony/gfxcore.h"
+#include "tony/loc.h"
+#include "tony/utils.h"
+
+namespace Audio {
+class RewindableAudioStream;
+}
+
+namespace Tony {
+
+class FPStream;
+class FPSfx;
+
+enum SoundCodecs {
+ FPCODEC_RAW,
+ FPCODEC_ADPCM
+};
+
+/**
+ * Sound driver For Tony Tough
+ */
+
+class FPSound {
+private:
+ bool _soundSupported;
+
+public:
+ /**
+ * Default constructor. Initializes the attributes.
+ *
+ */
+
+ FPSound();
+
+ /**
+ * Destroy the object and free the memory
+ *
+ */
+
+ ~FPSound();
+
+ /**
+ * Initializes the object, and prepare everything you need to create streams and sound effects.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool init();
+
+ /**
+ * Allocates an object of type FPStream, and return its pointer
+ *
+ * @param streamPtr Will contain a pointer to the object you just created.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool createStream(FPStream **streamPtr);
+
+ /**
+ * Allocates an object of type FpSfx, and return its pointer
+ *
+ * @param sfxPtr Will contain a pointer to the object you just created.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool createSfx(FPSfx **sfxPtr);
+
+ /**
+ * Set the general volume
+ *
+ * @param volume Volume to set (0-63)
+ */
+
+ void setMasterVolume(int volume);
+
+ /**
+ * Get the general volume
+ *
+ * @param volume Variable that will contain the volume (0-63)
+ */
+
+ void getMasterVolume(int *volume);
+};
+
+class FPSfx {
+private:
+ bool _soundSupported; // True if the sound is active
+ bool _fileLoaded; // True is a file is opened
+ bool _loop; // True is sound effect should loop
+ int _lastVolume;
+
+ bool _isVoice;
+ bool _paused;
+
+ Audio::AudioStream *_loopStream;
+ Audio::RewindableAudioStream *_rewindableStream;
+ Audio::SoundHandle _handle;
+
+public:
+ uint32 _hEndOfBuffer;
+
+ /**
+ * Check process for whether sounds have finished playing
+ */
+ static void soundCheckProcess(CORO_PARAM, const void *param);
+
+ /**
+ * Default constructor.
+ *
+ * @remarks Do *NOT* declare an object directly, but rather
+ * create it using FPSound::CreateSfx()
+ *
+ */
+
+ FPSfx(bool soundOn);
+
+ /**
+ * Default Destructor.
+ *
+ * @remarks It is also stops the sound effect that may be
+ * currently played, and free the memory it uses.
+ *
+ */
+
+ ~FPSfx();
+
+ /**
+ * Releases the memory used by the object.
+ *
+ * @remarks Must be called when the object is no longer used and
+ * **ONLY** if the object was created by
+ * FPSound::CreateStream().
+ * Object pointers are no longer valid after this call.
+ */
+
+ void release();
+
+ /**
+ * Opens a file and loads a sound effect.
+ *
+ * @param fileName Sfx filename
+ * @param codec CODEC used to uncompress the samples
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool loadFile(const char *fileName, uint32 codec = FPCODEC_RAW);
+ bool loadWave(Common::SeekableReadStream *stream);
+ bool loadVoiceFromVDB(Common::File &vdbFP);
+
+ /**
+ * Play the Sfx in memory.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool play();
+
+ /**
+ * Stops a Sfx.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool stop();
+
+ /**
+ * Pauses a Sfx.
+ *
+ */
+
+ void setPause(bool pause);
+
+ /**
+ * Enables or disables the Sfx loop.
+ *
+ * @param loop True to enable the loop, False to disable
+ *
+ * @remarks The loop must be activated BEFORE the sfx starts
+ * playing. Any changes made during the play will have
+ * no effect until the sfx is stopped then played again.
+ */
+
+ void setLoop(bool loop);
+
+ /**
+ * Change the volume of Sfx
+ *
+ * @param volume Volume to be set (0-63)
+ *
+ */
+
+ void setVolume(int volume);
+
+ /**
+ * Gets the Sfx volume
+ *
+ * @param volumePtr Will contain the current Sfx volume
+ *
+ */
+
+ void getVolume(int *volumePtr);
+
+ /**
+ * Returns true if the underlying sound has ended
+ */
+ bool endOfBuffer() const;
+};
+
+class FPStream {
+private:
+ uint32 _bufferSize; // Buffer size (bytes)
+ uint32 _size; // Stream size (bytes)
+ uint32 _codec; // CODEC used
+
+ Common::File _file; // File handle used for the stream
+
+ bool _soundSupported; // True if the sound is active
+ bool _fileLoaded; // True if the file is open
+ bool _loop; // True if the stream should loop
+ bool _doFadeOut; // True if fade out is required
+ bool _syncExit;
+ bool _paused;
+ int _lastVolume;
+ FPStream *_syncToPlay;
+
+ Audio::AudioStream *_loopStream;
+ Audio::RewindableAudioStream *_rewindableStream;
+ Audio::SoundHandle _handle;
+
+public:
+
+ /**
+ * Default constructor.
+ *
+ * @remarks Do *NOT* declare an object directly, but rather
+ * create it using FPSound::CreateStream()
+ */
+
+ FPStream(bool soundOn);
+
+ /**
+ * Default destructor.
+ *
+ * @remarks It calls CloseFile() if needed.
+ */
+
+ ~FPStream();
+
+ /**
+ * Releases the memory object.
+ *
+ * @remarks Must be called when the object is no longer used
+ * and **ONLY** if the object was created by
+ * FPSound::CreateStream().
+ * Object pointers are no longer valid after this call.
+ */
+
+ void release();
+
+ /**
+ * Opens a file stream
+ *
+ * @param fileName Filename to be opened
+ * @param codec CODEC to be used to uncompress samples
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool loadFile(const Common::String &fileName, uint32 codec = FPCODEC_RAW, int sync = 2000);
+
+ /**
+ * Closes a file stream (opened or not).
+ *
+ * @returns For safety, the destructor calls unloadFile() if it has not
+ * been mentioned explicitly.
+ *
+ * @remarks It is necessary to call this function to free the
+ * memory used by the stream.
+ */
+
+ bool unloadFile();
+
+ /**
+ * Play the stream.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool play();
+ void playFast();
+
+ /**
+ * Closes the stream.
+ *
+ * @returns True is everything is OK, False otherwise
+ */
+
+ bool stop();
+ void waitForSync(FPStream *toPlay);
+
+ /**
+ * Pause sound effect
+ *
+ * @param pause True enables pause, False disables it
+ */
+
+ void setPause(bool pause);
+
+ /**
+ * Unables or disables stream loop.
+ *
+ * @param loop True enable loop, False disables it
+ *
+ * @remarks The loop must be activated BEFORE the stream starts
+ * playing. Any changes made during the play will have no
+ * effect until the stream is stopped then played again.
+ */
+
+ void setLoop(bool loop);
+
+ /**
+ * Change the volume of the stream
+ *
+ * @param volume Volume to be set (0-63)
+ */
+
+ void setVolume(int volume);
+
+ /**
+ * Gets the volume of the stream
+ *
+ * @param volumePtr Variable that will contain the current volume
+ *
+ */
+
+ void getVolume(int *volumePtr);
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
new file mode 100644
index 0000000000..1c63096e92
--- /dev/null
+++ b/engines/tony/tony.cpp
@@ -0,0 +1,791 @@
+/* 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 "common/algorithm.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "common/installshield_cab.h"
+#include "tony/tony.h"
+#include "tony/custom.h"
+#include "tony/debugger.h"
+#include "tony/game.h"
+#include "tony/mpal/mpal.h"
+
+namespace Tony {
+
+TonyEngine *g_vm;
+
+TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Engine(syst),
+ _gameDescription(gameDesc), _randomSource("tony") {
+ g_vm = this;
+ _loadSlotNumber = -1;
+
+ // Set the up the debugger
+ _debugger = new Debugger();
+ DebugMan.addDebugChannel(kTonyDebugAnimations, "animations", "Animations debugging");
+ DebugMan.addDebugChannel(kTonyDebugActions, "actions", "Actions debugging");
+ DebugMan.addDebugChannel(kTonyDebugSound, "sound", "Sound debugging");
+ DebugMan.addDebugChannel(kTonyDebugMusic, "music", "Music debugging");
+
+ // Add folders to the search directory list
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "Voices");
+ SearchMan.addSubDirectoryMatching(gameDataDir, "Roasted");
+ SearchMan.addSubDirectoryMatching(gameDataDir, "Music");
+ SearchMan.addSubDirectoryMatching(gameDataDir, "Music/utilsfx");
+
+ // Set up load slot number
+ _initialLoadSlotNumber = -1;
+ if (ConfMan.hasKey("save_slot")) {
+ int slotNumber = ConfMan.getInt("save_slot");
+ if (slotNumber >= 0 && slotNumber <= 99)
+ _initialLoadSlotNumber = slotNumber;
+ }
+
+ // Load the ScummVM sound settings
+ syncSoundSettings();
+
+ _hEndOfFrame = 0;
+ for (int i = 0; i < 6; i++)
+ _stream[i] = NULL;
+ for (int i = 0; i < MAX_SFX_CHANNELS; i++) {
+ _sfx[i] = NULL;
+ _utilSfx[i] = NULL;
+ }
+ _bPaused = false;
+ _bDrawLocation = false;
+ _startTime = 0;
+ _curThumbnail = NULL;
+ _bQuitNow = false;
+ _bTimeFreezed = false;
+ _nTimeFreezed = 0;
+}
+
+TonyEngine::~TonyEngine() {
+ // Close the voice database
+ closeVoiceDatabase();
+
+ // Reset the coroutine scheduler
+ CoroScheduler.reset();
+ CoroScheduler.setResourceCallback(NULL);
+
+ delete _debugger;
+}
+
+/**
+ * Run the game
+ */
+Common::Error TonyEngine::run() {
+ Common::ErrorCode result = init();
+ if (result != Common::kNoError)
+ return result;
+
+ play();
+ close();
+
+ return Common::kNoError;
+}
+
+/**
+ * Initialize the game
+ */
+Common::ErrorCode TonyEngine::init() {
+ // Load DAT file (used by font manager)
+ if (!loadTonyDat())
+ return Common::kUnknownError;
+
+ if (isCompressed()) {
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember("data1.cab");
+ if (!stream)
+ error("Failed to open data1.cab");
+
+ Common::Archive *cabinet = Common::makeInstallShieldArchive(stream);
+ if (!cabinet)
+ error("Failed to parse data1.cab");
+
+ SearchMan.add("data1.cab", cabinet);
+ }
+
+ _hEndOfFrame = CoroScheduler.createEvent(false, false);
+
+ _bPaused = false;
+ _bDrawLocation = true;
+ _startTime = g_system->getMillis();
+
+ // Init static class fields
+ RMText::initStatics();
+ RMTony::initStatics();
+
+ // Reset the scheduler
+ CoroScheduler.reset();
+
+ // Initialize the graphics window
+ _window.init();
+
+ // Initialize the function list
+ Common::fill(_funcList, _funcList + 300, (LPCUSTOMFUNCTION)NULL);
+ initCustomFunctionMap();
+
+ // Initializes MPAL system, passing the custom functions list
+ Common::File f;
+ if (!f.open("ROASTED.MPC"))
+ return Common::kReadingFailed;
+ f.close();
+
+ if (!mpalInit("ROASTED.MPC", "ROASTED.MPR", _funcList, _funcListStrings))
+ return Common::kUnknownError;
+
+ // Initialize the update resources
+ _resUpdate.init("ROASTED.MPU");
+
+ // Initialize the music
+ initMusic();
+
+ // Initialize the voices database
+ if (!openVoiceDatabase())
+ return Common::kReadingFailed;
+
+ // Initialize the boxes
+ _theBoxes.init();
+
+ // Link to the custom graphics engine
+ _theEngine.initCustomDll();
+ _theEngine.init();
+
+ // Allocate space for thumbnails when saving the game
+ _curThumbnail = new uint16[160 * 120];
+
+ _bQuitNow = false;
+
+ return Common::kNoError;
+}
+
+bool TonyEngine::loadTonyDat() {
+ Common::String msg;
+ Common::File in;
+
+ in.open("tony.dat");
+
+ if (!in.isOpen()) {
+ msg = "You're missing the 'tony.dat' file. Get it from the ScummVM website";
+ GUIErrorMessage(msg);
+ warning("%s", msg.c_str());
+ return false;
+ }
+
+ // Read header
+ char buf[4+1];
+ in.read(buf, 4);
+ buf[4] = '\0';
+
+ if (strcmp(buf, "TONY")) {
+ msg = "File 'tony.dat' is corrupt. Get it from the ScummVM website";
+ GUIErrorMessage(msg);
+ warning("%s", msg.c_str());
+ return false;
+ }
+
+ int majVer = in.readByte();
+ int minVer = in.readByte();
+
+ if ((majVer != TONY_DAT_VER_MAJ) || (minVer != TONY_DAT_VER_MIN)) {
+ msg = Common::String::format("File 'tony.dat' is wrong version. Expected %d.%d but got %d.%d. Get it from the ScummVM website", TONY_DAT_VER_MAJ, TONY_DAT_VER_MIN, majVer, minVer);
+ GUIErrorMessage(msg);
+ warning("%s", msg.c_str());
+
+ return false;
+ }
+
+ int expectedLangVariant = -1;
+ switch (g_vm->getLanguage()) {
+ case Common::IT_ITA:
+ case Common::EN_ANY:
+ expectedLangVariant = 0;
+ break;
+ case Common::PL_POL:
+ expectedLangVariant = 1;
+ break;
+ case Common::RU_RUS:
+ expectedLangVariant = 2;
+ break;
+ case Common::CZ_CZE:
+ expectedLangVariant = 3;
+ break;
+ case Common::FR_FRA:
+ expectedLangVariant = 4;
+ break;
+ case Common::DE_DEU:
+ expectedLangVariant = 5;
+ break;
+ default:
+ warning("Unhandled language, falling back to English/Italian fonts.");
+ expectedLangVariant = 0;
+ break;
+ }
+
+ int numVariant = in.readUint16BE();
+ if (expectedLangVariant > numVariant - 1) {
+ msg = Common::String::format("Font variant not present in 'tony.dat'. Get it from the ScummVM website");
+ GUIErrorMessage(msg);
+ warning("%s", msg.c_str());
+
+ return false;
+ }
+
+ in.seek(in.pos() + (2 * 256 * 8 * expectedLangVariant));
+ for (int i = 0; i < 256; i++) {
+ _cTableDialog[i] = in.readSint16BE();
+ _lTableDialog[i] = in.readSint16BE();
+ _cTableMacc[i] = in.readSint16BE();
+ _lTableMacc[i] = in.readSint16BE();
+ _cTableCred[i] = in.readSint16BE();
+ _lTableCred[i] = in.readSint16BE();
+ _cTableObj[i] = in.readSint16BE();
+ _lTableObj[i] = in.readSint16BE();
+ }
+
+ return true;
+}
+
+void TonyEngine::initCustomFunctionMap() {
+ INIT_CUSTOM_FUNCTION(_funcList, _funcListStrings);
+}
+
+/**
+ * Display an error message
+ */
+void TonyEngine::GUIError(const Common::String &msg) {
+ GUIErrorMessage(msg);
+}
+
+void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, bool bLoop, int nSync) {
+ if (nChannel < 4) {
+ if (GLOBALS._flipflop)
+ nChannel = nChannel + 1;
+ }
+
+ switch (nFX) {
+ case 0:
+ case 1:
+ case 2:
+ _stream[nChannel]->stop();
+ _stream[nChannel]->unloadFile();
+ break;
+
+ case 22:
+ break;
+ }
+
+ if (nFX == 22) { // Sync a tempo
+ GLOBALS._curChannel = nChannel;
+ GLOBALS._nextLoop = bLoop;
+ GLOBALS._nextSync = nSync;
+ GLOBALS._nextMusic = fname;
+
+ if (GLOBALS._flipflop)
+ GLOBALS._nextChannel = nChannel - 1;
+ else
+ GLOBALS._nextChannel = nChannel + 1;
+
+ uint32 hThread = CoroScheduler.createProcess(doNextMusic, NULL, 0);
+ assert(hThread != CORO_INVALID_PID_VALUE);
+
+ } else if (nFX == 44) { // Change the channel and let the first finish
+ if (GLOBALS._flipflop)
+ GLOBALS._nextChannel = nChannel - 1;
+ else
+ GLOBALS._nextChannel = nChannel + 1;
+
+ _stream[GLOBALS._nextChannel]->stop();
+ _stream[GLOBALS._nextChannel]->unloadFile();
+
+ if (!getIsDemo()) {
+ if (!_stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync))
+ error("failed to open music file '%s'", fname.c_str());
+ } else {
+ _stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync);
+ }
+
+ _stream[GLOBALS._nextChannel]->setLoop(bLoop);
+ _stream[GLOBALS._nextChannel]->play();
+
+ GLOBALS._flipflop = 1 - GLOBALS._flipflop;
+ } else {
+ if (!getIsDemo()) {
+ if (!_stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync))
+ error("failed to open music file '%s'", fname.c_str());
+ } else {
+ _stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync);
+ }
+
+ _stream[nChannel]->setLoop(bLoop);
+ _stream[nChannel]->play();
+ }
+}
+
+void TonyEngine::doNextMusic(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ Common::String fn;
+ CORO_END_CONTEXT(_ctx);
+
+ FPStream **streams = g_vm->_stream;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (!g_vm->getIsDemo()) {
+ if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync))
+ error("failed to open next music file '%s'", GLOBALS._nextMusic.c_str());
+ } else {
+ streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync);
+ }
+
+ streams[GLOBALS._nextChannel]->setLoop(GLOBALS._nextLoop);
+ //streams[GLOBALS._nextChannel]->prefetch();
+
+ streams[GLOBALS._curChannel]->waitForSync(streams[GLOBALS._nextChannel]);
+
+ streams[GLOBALS._curChannel]->unloadFile();
+
+ GLOBALS._flipflop = 1 - GLOBALS._flipflop;
+
+ CORO_END_CODE;
+}
+
+void TonyEngine::playSFX(int nChannel, int nFX) {
+ if (_sfx[nChannel] == NULL)
+ return;
+
+ switch (nFX) {
+ case 0:
+ _sfx[nChannel]->setLoop(false);
+ break;
+
+ case 1:
+ _sfx[nChannel]->setLoop(true);
+ break;
+ }
+
+ _sfx[nChannel]->play();
+}
+
+void TonyEngine::stopMusic(int nChannel) {
+ if (nChannel < 4)
+ _stream[nChannel + GLOBALS._flipflop]->stop();
+ else
+ _stream[nChannel]->stop();
+}
+
+void TonyEngine::stopSFX(int nChannel) {
+ _sfx[nChannel]->stop();
+}
+
+void TonyEngine::playUtilSFX(int nChannel, int nFX) {
+ if (_utilSfx[nChannel] == NULL)
+ return;
+
+ switch (nFX) {
+ case 0:
+ _utilSfx[nChannel]->setLoop(false);
+ break;
+
+ case 1:
+ _utilSfx[nChannel]->setLoop(true);
+ break;
+ }
+
+ _utilSfx[nChannel]->setVolume(52);
+ _utilSfx[nChannel]->play();
+}
+
+void TonyEngine::stopUtilSFX(int nChannel) {
+ _utilSfx[nChannel]->stop();
+}
+
+void TonyEngine::preloadSFX(int nChannel, const char *fn) {
+ if (_sfx[nChannel] != NULL) {
+ _sfx[nChannel]->stop();
+ _sfx[nChannel]->release();
+ _sfx[nChannel] = NULL;
+ }
+
+ _theSound.createSfx(&_sfx[nChannel]);
+
+ _sfx[nChannel]->loadFile(fn, FPCODEC_ADPCM);
+}
+
+FPSfx *TonyEngine::createSFX(Common::SeekableReadStream *stream) {
+ FPSfx *sfx;
+
+ _theSound.createSfx(&sfx);
+ sfx->loadWave(stream);
+ return sfx;
+}
+
+void TonyEngine::preloadUtilSFX(int nChannel, const char *fn) {
+ if (_utilSfx[nChannel] != NULL) {
+ _utilSfx[nChannel]->stop();
+ _utilSfx[nChannel]->release();
+ _utilSfx[nChannel] = NULL;
+ }
+
+ _theSound.createSfx(&_utilSfx[nChannel]);
+
+ _utilSfx[nChannel]->loadFile(fn, FPCODEC_ADPCM);
+ _utilSfx[nChannel]->setVolume(63);
+}
+
+void TonyEngine::unloadAllSFX() {
+ for (int i = 0; i < MAX_SFX_CHANNELS; i++) {
+ if (_sfx[i] != NULL) {
+ _sfx[i]->stop();
+ _sfx[i]->release();
+ _sfx[i] = NULL;
+ }
+ }
+}
+
+void TonyEngine::unloadAllUtilSFX() {
+ for (int i = 0; i < MAX_SFX_CHANNELS; i++) {
+ if (_utilSfx[i] != NULL) {
+ _utilSfx[i]->stop();
+ _utilSfx[i]->release();
+ _utilSfx[i] = NULL;
+ }
+ }
+}
+
+void TonyEngine::initMusic() {
+ int i;
+
+ _theSound.init();
+ _theSound.setMasterVolume(63);
+
+ for (i = 0; i < 6; i++)
+ _theSound.createStream(&_stream[i]);
+
+ for (i = 0; i < MAX_SFX_CHANNELS; i++) {
+ _sfx[i] = _utilSfx[i] = NULL;
+ }
+
+ // Preload sound effects
+ preloadUtilSFX(0, "U01.ADP"); // Reversed!!
+ preloadUtilSFX(1, "U02.ADP");
+
+ // Start check processes for sound
+ CoroScheduler.createProcess(FPSfx::soundCheckProcess, NULL);
+}
+
+void TonyEngine::closeMusic() {
+ for (int i = 0; i < 6; i++) {
+ _stream[i]->stop();
+ _stream[i]->unloadFile();
+ _stream[i]->release();
+ }
+
+ unloadAllSFX();
+ unloadAllUtilSFX();
+}
+
+void TonyEngine::pauseSound(bool bPause) {
+ _theEngine.pauseSound(bPause);
+
+ for (uint i = 0; i < 6; i++)
+ if (_stream[i])
+ _stream[i]->setPause(bPause);
+
+ for (uint i = 0; i < MAX_SFX_CHANNELS; i++) {
+ if (_sfx[i])
+ _sfx[i]->setPause(bPause);
+ if (_utilSfx[i])
+ _utilSfx[i]->setPause(bPause);
+ }
+}
+
+void TonyEngine::setMusicVolume(int nChannel, int volume) {
+ _stream[nChannel + GLOBALS._flipflop]->setVolume(volume);
+}
+
+int TonyEngine::getMusicVolume(int nChannel) {
+ int volume;
+ _stream[nChannel + GLOBALS._flipflop]->getVolume(&volume);
+ return volume;
+}
+
+Common::String TonyEngine::getSaveStateFileName(int n) {
+ return Common::String::format("tony.%03d", n);
+}
+
+void TonyEngine::autoSave(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ Common::String buf;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ grabThumbnail();
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE);
+ _ctx->buf = getSaveStateFileName(0);
+ _theEngine.saveState(_ctx->buf, (byte *)_curThumbnail, "Autosave");
+
+ CORO_END_CODE;
+}
+
+void TonyEngine::saveState(int n, const char *name) {
+ Common::String buf = getSaveStateFileName(n);
+ _theEngine.saveState(buf.c_str(), (byte *)_curThumbnail, name);
+}
+
+void TonyEngine::loadState(CORO_PARAM, int n) {
+ CORO_BEGIN_CONTEXT;
+ Common::String buf;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->buf = getSaveStateFileName(n);
+ CORO_INVOKE_1(_theEngine.loadState, _ctx->buf.c_str());
+
+ CORO_END_CODE;
+}
+
+bool TonyEngine::openVoiceDatabase() {
+ char id[4];
+ uint32 numfiles;
+
+ // Open the voices database
+ if (!_vdbFP.open("voices.vdb"))
+ return false;
+
+ _vdbFP.seek(-8, SEEK_END);
+ numfiles = _vdbFP.readUint32LE();
+ _vdbFP.read(id, 4);
+
+ if (id[0] != 'V' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ _vdbFP.close();
+ return false;
+ }
+
+ // Read in the index
+ _vdbFP.seek(-8 - (numfiles * VOICE_HEADER_SIZE), SEEK_END);
+
+ for (uint32 i = 0; i < numfiles; ++i) {
+ VoiceHeader vh;
+ vh._offset = _vdbFP.readUint32LE();
+ vh._code = _vdbFP.readUint32LE();
+ vh._parts = _vdbFP.readUint32LE();
+
+ _voices.push_back(vh);
+ }
+
+ return true;
+}
+
+void TonyEngine::closeVoiceDatabase() {
+ if (_vdbFP.isOpen())
+ _vdbFP.close();
+
+ if (_voices.size() > 0)
+ _voices.clear();
+}
+
+void TonyEngine::grabThumbnail() {
+ _window.grabThumbnail(_curThumbnail);
+}
+
+uint16 *TonyEngine::getThumbnail() {
+ return _curThumbnail;
+}
+
+void TonyEngine::quitGame() {
+ _bQuitNow = true;
+}
+
+void TonyEngine::openInitLoadMenu(CORO_PARAM) {
+ _theEngine.openOptionScreen(coroParam, 1);
+}
+
+void TonyEngine::openInitOptions(CORO_PARAM) {
+ _theEngine.openOptionScreen(coroParam, 2);
+}
+
+/**
+ * Main process for playing the game.
+ *
+ * @remarks This needs to be in a separate process, since there are some things that can briefly
+ * block the execution of process. For now, all ScummVm event handling is dispatched to within the context of this
+ * process. If it ever proves a problem, we may have to look into whether it's feasible to have it still remain
+ * in the outer 'main' process.
+ */
+void TonyEngine::playProcess(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ Common::String fn;
+ CORO_END_CONTEXT(_ctx);
+
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Game loop. We rely on the outer main process to detect if a shutdown is required,
+ // and kill the scheudler and all the processes, including this one
+ for (;;) {
+ // If a savegame needs to be loaded, then do so
+ if (g_vm->_loadSlotNumber != -1 && GLOBALS._gfxEngine != NULL) {
+ _ctx->fn = getSaveStateFileName(g_vm->_loadSlotNumber);
+ CORO_INVOKE_1(GLOBALS._gfxEngine->loadState, _ctx->fn);
+ g_vm->_loadSlotNumber = -1;
+ }
+
+ // Wait for the next frame
+ CORO_INVOKE_1(CoroScheduler.sleep, 50);
+
+ // Call the engine to handle the next frame
+ CORO_INVOKE_1(g_vm->_theEngine.doFrame, g_vm->_bDrawLocation);
+
+ // Warns that a frame is finished
+ CoroScheduler.pulseEvent(g_vm->_hEndOfFrame);
+
+ // Handle drawing the frame
+ if (!g_vm->_bPaused) {
+ if (!g_vm->_theEngine._bWiping)
+ g_vm->_window.getNewFrame(g_vm->_theEngine, NULL);
+ else
+ g_vm->_window.getNewFrame(g_vm->_theEngine, &g_vm->_theEngine._rcWipeEllipse);
+ }
+
+ // Paint the frame onto the screen
+ g_vm->_window.repaint();
+
+ // Signal the ScummVM debugger
+ g_vm->_debugger->onFrame();
+ }
+
+ CORO_END_CODE;
+}
+
+/**
+ * Play the game
+ */
+void TonyEngine::play() {
+ // Create the game player process
+ CoroScheduler.createProcess(playProcess, NULL);
+
+ // Loop through calling the scheduler until it's time for the game to quit
+ while (!shouldQuit() && !_bQuitNow) {
+ // Delay for a brief amount
+ g_system->delayMillis(10);
+
+ // Call any scheduled processes
+ CoroScheduler.schedule();
+ }
+}
+
+void TonyEngine::close() {
+ closeMusic();
+ CoroScheduler.closeEvent(_hEndOfFrame);
+ _theBoxes.close();
+ _theEngine.close();
+ _window.close();
+ mpalFree();
+ freeMpc();
+ delete[] _curThumbnail;
+}
+
+void TonyEngine::freezeTime() {
+ _bTimeFreezed = true;
+ _nTimeFreezed = getTime() - _startTime;
+}
+
+void TonyEngine::unfreezeTime() {
+ _bTimeFreezed = false;
+}
+
+/**
+ * Returns the millisecond timer
+ */
+uint32 TonyEngine::getTime() {
+ return g_system->getMillis();
+}
+
+bool TonyEngine::canLoadGameStateCurrently() {
+ return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave();
+}
+bool TonyEngine::canSaveGameStateCurrently() {
+ return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave();
+}
+
+Common::Error TonyEngine::loadGameState(int slot) {
+ _loadSlotNumber = slot;
+ return Common::kNoError;
+}
+
+Common::Error TonyEngine::saveGameState(int slot, const Common::String &desc) {
+ if (!GLOBALS._gfxEngine)
+ return Common::kUnknownError;
+
+ RMGfxTargetBuffer &bigBuf = *GLOBALS._gfxEngine;
+ RMSnapshot s;
+ s.grabScreenshot(bigBuf, 4, _curThumbnail);
+
+ GLOBALS._gfxEngine->saveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc);
+ return Common::kNoError;
+}
+
+void TonyEngine::syncSoundSettings() {
+ Engine::syncSoundSettings();
+
+ GLOBALS._bCfgDubbing = !ConfMan.getBool("mute") && !ConfMan.getBool("speech_mute");
+ GLOBALS._bCfgSFX = !ConfMan.getBool("mute") && !ConfMan.getBool("sfx_mute");
+ GLOBALS._bCfgMusic = !ConfMan.getBool("mute") && !ConfMan.getBool("music_mute");
+
+ GLOBALS._nCfgDubbingVolume = ConfMan.getInt("speech_volume") * 10 / 256;
+ GLOBALS._nCfgSFXVolume = ConfMan.getInt("sfx_volume") * 10 / 256;
+ GLOBALS._nCfgMusicVolume = ConfMan.getInt("music_volume") * 10 / 256;
+
+ GLOBALS._bShowSubtitles = ConfMan.getBool("subtitles");
+ GLOBALS._nCfgTextSpeed = ConfMan.getInt("talkspeed") * 10 / 256;
+}
+
+void TonyEngine::saveSoundSettings() {
+ ConfMan.setBool("speech_mute", !GLOBALS._bCfgDubbing);
+ ConfMan.setBool("sfx_mute", !GLOBALS._bCfgSFX);
+ ConfMan.setBool("music_mute", !GLOBALS._bCfgMusic);
+
+ ConfMan.setInt("speech_volume", GLOBALS._nCfgDubbingVolume * 256 / 10);
+ ConfMan.setInt("sfx_volume", GLOBALS._nCfgSFXVolume * 256 / 10);
+ ConfMan.setInt("music_volume", GLOBALS._nCfgMusicVolume * 256 / 10);
+
+ ConfMan.setBool("subtitles", GLOBALS._bShowSubtitles);
+ ConfMan.setInt("talkspeed", GLOBALS._nCfgTextSpeed * 256 / 10);
+}
+
+void TonyEngine::showLocation() {
+ _bDrawLocation = true;
+}
+
+void TonyEngine::hideLocation() {
+ _bDrawLocation = false;
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/tony.h b/engines/tony/tony.h
new file mode 100644
index 0000000000..332b122923
--- /dev/null
+++ b/engines/tony/tony.h
@@ -0,0 +1,242 @@
+/* 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 TONY_H
+#define TONY_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/array.h"
+#include "common/coroutines.h"
+#include "common/error.h"
+#include "common/random.h"
+#include "common/util.h"
+#include "engines/engine.h"
+
+#include "tony/mpal/mpal.h"
+#include "tony/mpal/memory.h"
+#include "tony/debugger.h"
+#include "tony/gfxengine.h"
+#include "tony/loc.h"
+#include "tony/utils.h"
+#include "tony/window.h"
+#include "tony/globals.h"
+
+/**
+ * This is the namespace of the Tony engine.
+ *
+ * Status of this engine: In Development
+ *
+ * Games using this engine:
+ * - Tony Tough
+ */
+namespace Tony {
+
+using namespace MPAL;
+
+class Globals;
+
+enum {
+ kTonyDebugAnimations = 1 << 0,
+ kTonyDebugActions = 1 << 1,
+ kTonyDebugSound = 1 << 2,
+ kTonyDebugMusic = 1 << 3,
+ kTonyDebugMPAL = 1 << 4
+};
+
+#define DEBUG_BASIC 1
+#define DEBUG_INTERMEDIATE 2
+#define DEBUG_DETAILED 3
+
+struct TonyGameDescription;
+
+#define MAX_SFX_CHANNELS 32
+#define TONY_DAT_VER_MAJ 0
+#define TONY_DAT_VER_MIN 3
+
+struct VoiceHeader {
+ int _offset;
+ int _code;
+ int _parts;
+};
+#define VOICE_HEADER_SIZE 12
+
+class TonyEngine : public Engine {
+private:
+ Common::ErrorCode init();
+ bool loadTonyDat();
+ void initMusic();
+ void closeMusic();
+ bool openVoiceDatabase();
+ void closeVoiceDatabase();
+ void initCustomFunctionMap();
+ static void playProcess(CORO_PARAM, const void *param);
+ static void doNextMusic(CORO_PARAM, const void *param);
+
+protected:
+ // Engine APIs
+ virtual Common::Error run();
+ virtual bool hasFeature(EngineFeature f) const;
+public:
+ LPCUSTOMFUNCTION _funcList[300];
+ Common::String _funcListStrings[300];
+ Common::RandomSource _randomSource;
+ RMResUpdate _resUpdate;
+ uint32 _hEndOfFrame;
+ Common::File _vdbFP;
+ Common::Array<VoiceHeader> _voices;
+ FPSound _theSound;
+ Common::List<FPSfx *> _activeSfx;
+ Globals _globals;
+ Debugger *_debugger;
+
+ int16 _cTableDialog[256];
+ int16 _lTableDialog[256];
+ int16 _cTableMacc[256];
+ int16 _lTableMacc[256];
+ int16 _cTableCred[256];
+ int16 _lTableCred[256];
+ int16 _cTableObj[256];
+ int16 _lTableObj[256];
+
+ enum DataDir {
+ DD_BASE = 1,
+ DD_SAVE,
+ DD_SHOTS,
+ DD_MUSIC,
+ DD_LAYER,
+ DD_UTILSFX,
+ DD_VOICES,
+ DD_BASE2
+ };
+
+ FPStream *_stream[6];
+ FPSfx *_sfx[MAX_SFX_CHANNELS];
+ FPSfx *_utilSfx[MAX_SFX_CHANNELS];
+ bool _bPaused;
+ bool _bDrawLocation;
+ int _startTime;
+ uint16 *_curThumbnail;
+ int _initialLoadSlotNumber;
+ int _loadSlotNumber;
+
+ // Bounding box list manager
+ RMGameBoxes _theBoxes;
+ RMWindow _window;
+ RMGfxEngine _theEngine;
+
+ bool _bQuitNow;
+ bool _bTimeFreezed;
+ int _nTimeFreezed;
+public:
+ TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc);
+ virtual ~TonyEngine();
+
+ const TonyGameDescription *_gameDescription;
+ uint32 getFeatures() const;
+ Common::Language getLanguage() const;
+ uint16 getVersion() const;
+ bool getIsDemo() const;
+ bool isCompressed() const;
+ RMGfxEngine *getEngine() {
+ return &_theEngine;
+ }
+ void GUIError(const Common::String &msg);
+
+ virtual bool canLoadGameStateCurrently();
+ virtual bool canSaveGameStateCurrently();
+ Common::Error loadGameState(int slot);
+ Common::Error saveGameState(int slot, const Common::String &desc);
+
+ void play();
+ void close();
+
+ void getDataDirectory(DataDir dir, char *path);
+
+ void showLocation();
+ void hideLocation();
+
+ /**
+ * Reads the time
+ */
+ uint32 getTime();
+ void freezeTime();
+ void unfreezeTime();
+
+ // Music
+ // ******
+ void playMusic(int nChannel, const Common::String &fn, int nFX, bool bLoop, int nSync);
+ void stopMusic(int nChannel);
+
+ void playSFX(int nSfx, int nFX = 0);
+ void stopSFX(int nSfx);
+
+ void playUtilSFX(int nSfx, int nFX = 0);
+ void stopUtilSFX(int nSfx);
+
+ FPSfx *createSFX(Common::SeekableReadStream *stream);
+
+ void preloadSFX(int nSfx, const char *fn);
+ void unloadAllSFX();
+
+ void preloadUtilSFX(int nSfx, const char *fn);
+ void unloadAllUtilSFX();
+
+ /**
+ * Stop all the audio
+ */
+ void pauseSound(bool bPause);
+
+ void setMusicVolume(int nChannel, int volume);
+ int getMusicVolume(int nChannel);
+
+ /**
+ * Handle saving
+ */
+ void autoSave(CORO_PARAM);
+ void saveState(int n, const char *name);
+ void loadState(CORO_PARAM, int n);
+ static Common::String getSaveStateFileName(int n);
+
+ /**
+ * Get a thumbnail
+ */
+ void grabThumbnail();
+ uint16 *getThumbnail();
+
+ void quitGame();
+
+ void openInitLoadMenu(CORO_PARAM);
+ void openInitOptions(CORO_PARAM);
+
+ virtual void syncSoundSettings();
+ void saveSoundSettings();
+};
+
+// Global reference to the TonyEngine object
+extern TonyEngine *g_vm;
+
+#define GLOBALS g_vm->_globals
+
+} // End of namespace Tony
+
+#endif /* TONY_H */
diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp
new file mode 100644
index 0000000000..c7fa1e4a7b
--- /dev/null
+++ b/engines/tony/tonychar.cpp
@@ -0,0 +1,1945 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "tony/mpal/memory.h"
+#include "tony/mpal/mpalutils.h"
+#include "tony/game.h"
+#include "tony/tonychar.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+bool RMTony::_bAction = false;
+
+void RMTony::initStatics() {
+ _bAction = false;
+}
+
+RMTony::RMTony() {
+ _bShow = false;
+ _bShowShadow = false;
+ _bBodyFront = false;
+ _bActionPending = false;
+ _actionItem = NULL;
+ _action = 0;
+ _actionParm = 0;
+ _bShepherdess = false;
+ _bIsStaticTalk = false;
+ _bIsTalking = false;
+ _nPatB4Talking = 0;
+ _nTalkType = TALK_NORMAL;
+ _talkDirection = UP;
+ _nTimeLastStep = 0;
+ _hActionThread = CORO_INVALID_PID_VALUE;
+}
+
+void RMTony::waitEndOfAction(CORO_PARAM, const void *param) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ uint32 pid = *(const uint32 *)param;
+
+ CORO_BEGIN_CODE(_ctx);
+
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, pid, CORO_INFINITE);
+
+ _bAction = false;
+
+ CORO_END_CODE;
+}
+
+RMGfxSourceBuffer *RMTony::newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE) {
+ RMGfxSourceBuffer8RLE *spr;
+
+ assert(_cm == CM_256);
+ spr = new RMGfxSourceBuffer8RLEByteAA;
+ spr->setAlphaBlendColor(1);
+ if (bPreRLE)
+ spr->setAlreadyCompressed();
+ return spr;
+}
+
+void RMTony::init() {
+ RMRes tony(0);
+ RMRes body(9999);
+
+ // Tony is shown by default
+ _bShow = _bShowShadow = true;
+
+ // No action pending
+ _bActionPending = false;
+ _bAction = false;
+
+ _bShepherdess = false;
+ _bIsTalking = false;
+ _bIsStaticTalk = false;
+
+ // Opens the buffer
+ Common::SeekableReadStream *ds = tony.getReadStream();
+
+ // Reads his details from the stream
+ readFromStream(*ds, true);
+
+ // Closes the buffer
+ delete ds;
+
+ // Reads Tony's body
+ ds = body.getReadStream();
+ _body.readFromStream(*ds, true);
+ delete ds;
+ _body.setPattern(0);
+
+ _nTimeLastStep = g_vm->getTime();
+}
+
+
+void RMTony::close() {
+ // Deallocation of missing item
+// _shadow.destroy();
+}
+
+void RMTony::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int curLoc) {
+ CORO_BEGIN_CONTEXT;
+ int time;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (!_nInList && _bShow)
+ bigBuf->addPrim(new RMGfxPrimitive(this));
+
+ setSpeed(GLOBALS._nCfgTonySpeed);
+
+ // Runs the normal character movement
+ _ctx->time = g_vm->getTime();
+
+ do {
+ _nTimeLastStep += (1000 / 40);
+ CORO_INVOKE_2(RMCharacter::doFrame, bigBuf, curLoc);
+ } while (_ctx->time > _nTimeLastStep + (1000 / 40));
+
+ // Check if we are at the end of a path
+ if (endOfPath() && _bActionPending) {
+ // Must perform the action on which we clicked
+ _bActionPending = false;
+ }
+
+ if (_bIsTalking || _bIsStaticTalk)
+ _body.doFrame(bigBuf, false);
+
+ CORO_END_CODE;
+}
+
+void RMTony::show() {
+ _bShow = true;
+ _bShowShadow = true;
+}
+
+void RMTony::hide(bool bShowShadow) {
+ _bShow = false;
+ _bShowShadow = bShowShadow;
+}
+
+
+void RMTony::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Call the Draw() of the parent class if Tony is visible
+ if (_bShow && _bDrawNow) {
+ if (_bBodyFront) {
+ prim->getDst().setEmpty();
+ prim->getDst().offset(-44, -134);
+ if (_bShepherdess)
+ prim->getDst().offset(1, 4);
+ CORO_INVOKE_2(RMCharacter::draw, bigBuf, prim);
+ }
+
+ if (_bIsTalking || _bIsStaticTalk) {
+ // Offest direction from scrolling
+ prim->getDst().setEmpty();
+ prim->getDst().offset(-_curScroll);
+ prim->getDst().offset(_pos);
+ prim->getDst().offset(-44, -134);
+ prim->getDst() += _nBodyOffset;
+ CORO_INVOKE_2(_body.draw, bigBuf, prim);
+ }
+
+ if (!_bBodyFront) {
+ prim->getDst().setEmpty();
+ prim->getDst().offset(-44, -134);
+ if (_bShepherdess)
+ prim->getDst().offset(0, 3);
+ CORO_INVOKE_2(RMCharacter::draw, bigBuf, prim);
+ }
+ }
+
+ CORO_END_CODE;
+}
+
+void RMTony::moveAndDoAction(CORO_PARAM, RMPoint dst, RMItem *item, int nAction, int nActionParm) {
+ CORO_BEGIN_CONTEXT;
+ bool result;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // Makes normal movement, but remember if you must then perform an action
+ if (item == NULL) {
+ _bActionPending = false;
+ _actionItem = NULL;
+ } else {
+ _actionItem = item;
+ _action = nAction;
+ _actionParm = nActionParm;
+ _bActionPending = true;
+ }
+
+ CORO_INVOKE_2(RMCharacter::move, dst, &_ctx->result);
+ if (!_ctx->result) {
+ _bActionPending = false;
+ _actionItem = NULL;
+ }
+
+ CORO_END_CODE;
+}
+
+
+void RMTony::executeAction(int nAction, int nActionItem, int nParm) {
+ uint32 pid;
+
+ if (nAction == TA_COMBINE) {
+ pid = mpalQueryDoAction(TA_COMBINE, nParm, nActionItem);
+
+ // If you failed the combine, we have RECEIVECOMBINE as a fallback
+ if (pid == CORO_INVALID_PID_VALUE) {
+ pid = mpalQueryDoAction(TA_RECEIVECOMBINE, nActionItem, nParm);
+
+ // If you failed with that, go with the generic
+ // @@@ CombineGive!
+ if (pid == CORO_INVALID_PID_VALUE) {
+ pid = mpalQueryDoAction(TA_COMBINE, nParm, 0);
+
+ if (pid == CORO_INVALID_PID_VALUE) {
+ pid = mpalQueryDoAction(TA_RECEIVECOMBINE, nActionItem, 0);
+ }
+ }
+ }
+ } else {
+ // Perform the action
+ pid = mpalQueryDoAction(nAction, nActionItem, 0);
+ }
+
+ if (pid != CORO_INVALID_PID_VALUE) {
+ _bAction = true;
+ CoroScheduler.createProcess(waitEndOfAction, &pid, sizeof(uint32));
+ _hActionThread = pid;
+ } else if (nAction != TA_GOTO) {
+ if (nAction == TA_TALK) {
+ pid = mpalQueryDoAction(6, 1, 0);
+ _bAction = true;
+ CoroScheduler.createProcess(waitEndOfAction, &pid, sizeof(uint32));
+ _hActionThread = pid;
+ } else if (nAction == TA_PERORATE) {
+ pid = mpalQueryDoAction(7, 1, 0);
+ _bAction = true;
+ CoroScheduler.createProcess(waitEndOfAction, &pid, sizeof(uint32));
+ _hActionThread = pid;
+ } else {
+ pid = mpalQueryDoAction(5, 1, 0);
+ _bAction = true;
+ CoroScheduler.createProcess(waitEndOfAction, &pid, sizeof(uint32));
+ _hActionThread = pid;
+ }
+ }
+}
+
+
+void RMTony::stopNoAction(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_bAction)
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _hActionThread, CORO_INFINITE);
+
+ _bActionPending = false;
+ _actionItem = NULL;
+ CORO_INVOKE_0(stop);
+
+ CORO_END_CODE;
+}
+
+void RMTony::stop(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ uint32 pid;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ if (_actionItem != NULL) {
+ // Call MPAL to choose the direction
+ _ctx->pid = mpalQueryDoAction(21, _actionItem->mpalCode(), 0);
+
+ if (_ctx->pid == CORO_INVALID_PID_VALUE)
+ CORO_INVOKE_0(RMCharacter::stop);
+ else {
+ _bNeedToStop = false; // If we make the OnWhichDirection, we don't need at least after the Stop().
+ _bMoving = false;
+ CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->pid, CORO_INFINITE); // @@@ Put an assert after 10 seconds
+ }
+ } else {
+ CORO_INVOKE_0(RMCharacter::stop);
+ }
+
+ if (!_bActionPending)
+ return;
+
+ _bActionPending = false;
+
+ executeAction(_action, _actionItem->mpalCode(), _actionParm);
+
+ _actionItem = NULL;
+
+ CORO_END_CODE;
+}
+
+
+int RMTony::getCurPattern() {
+ int nPatt = RMCharacter::getCurPattern();
+
+ if (!_bShepherdess)
+ return nPatt;
+
+ switch (nPatt) {
+ case PAT_PAST_STANDUP:
+ return PAT_STANDUP;
+ case PAT_PAST_STANDDOWN:
+ return PAT_STANDDOWN;
+ case PAT_PAST_STANDLEFT:
+ return PAT_STANDLEFT;
+ case PAT_PAST_STANDRIGHT:
+ return PAT_STANDRIGHT;
+ case PAT_PAST_WALKUP:
+ return PAT_WALKUP;
+ case PAT_PAST_WALKDOWN:
+ return PAT_WALKDOWN;
+ case PAT_PAST_WALKLEFT:
+ return PAT_WALKLEFT;
+ case PAT_PAST_WALKRIGHT:
+ return PAT_WALKRIGHT;
+ }
+
+ return nPatt;
+}
+
+void RMTony::setPattern(int nPatt, bool bPlayP0) {
+ if (_bShepherdess) {
+ switch (nPatt) {
+ case PAT_STANDUP:
+ nPatt = PAT_PAST_STANDUP;
+ break;
+ case PAT_STANDDOWN:
+ nPatt = PAT_PAST_STANDDOWN;
+ break;
+ case PAT_STANDLEFT:
+ nPatt = PAT_PAST_STANDLEFT;
+ break;
+ case PAT_STANDRIGHT:
+ nPatt = PAT_PAST_STANDRIGHT;
+ break;
+ case PAT_WALKUP:
+ nPatt = PAT_PAST_WALKUP;
+ break;
+ case PAT_WALKDOWN:
+ nPatt = PAT_PAST_WALKDOWN;
+ break;
+ case PAT_WALKLEFT:
+ nPatt = PAT_PAST_WALKLEFT;
+ break;
+ case PAT_WALKRIGHT:
+ nPatt = PAT_PAST_WALKRIGHT;
+ break;
+ }
+ }
+
+ RMCharacter::setPattern(nPatt, bPlayP0);
+}
+
+
+void RMTony::take(int nWhere, int nPart) {
+ if (nPart == 0) {
+ switch (getCurPattern()) {
+ case PAT_STANDDOWN:
+ assert(0); // Not while you're doing a StandDown
+ break;
+
+ case PAT_STANDUP:
+ switch (nWhere) {
+ case 0:
+ setPattern(PAT_TAKEUP_UP1);
+ break;
+ case 1:
+ setPattern(PAT_TAKEUP_MID1);
+ break;
+ case 2:
+ setPattern(PAT_TAKEUP_DOWN1);
+ break;
+ }
+ break;
+
+ case PAT_STANDRIGHT:
+ switch (nWhere) {
+ case 0:
+ setPattern(PAT_TAKERIGHT_UP1);
+ break;
+ case 1:
+ setPattern(PAT_TAKERIGHT_MID1);
+ break;
+ case 2:
+ setPattern(PAT_TAKERIGHT_DOWN1);
+ break;
+ }
+ break;
+
+ case PAT_STANDLEFT:
+ switch (nWhere) {
+ case 0:
+ setPattern(PAT_TAKELEFT_UP1);
+ break;
+ case 1:
+ setPattern(PAT_TAKELEFT_MID1);
+ break;
+ case 2:
+ setPattern(PAT_TAKELEFT_DOWN1);
+ break;
+ }
+ break;
+ }
+ } else if (nPart == 1) {
+ setPattern(getCurPattern() + 1);
+ } else if (nPart == 2) {
+ switch (getCurPattern()) {
+ case PAT_TAKEUP_UP2:
+ case PAT_TAKEUP_MID2:
+ case PAT_TAKEUP_DOWN2:
+ setPattern(PAT_STANDUP);
+ break;
+
+ case PAT_TAKELEFT_UP2:
+ case PAT_TAKELEFT_MID2:
+ case PAT_TAKELEFT_DOWN2:
+ setPattern(PAT_STANDLEFT);
+ break;
+
+ case PAT_TAKERIGHT_UP2:
+ case PAT_TAKERIGHT_MID2:
+ case PAT_TAKERIGHT_DOWN2:
+ setPattern(PAT_STANDRIGHT);
+ break;
+ }
+ }
+}
+
+
+void RMTony::put(int nWhere, int nPart) {
+ if (nPart == 0) {
+ switch (getCurPattern()) {
+ case PAT_STANDDOWN:
+ break;
+
+ case PAT_STANDUP:
+ switch (nWhere) {
+ case 0:
+ setPattern(PAT_PUTUP_UP1);
+ break;
+ case 1:
+ setPattern(PAT_PUTUP_MID1);
+ break;
+ case 2:
+ setPattern(PAT_PUTUP_DOWN1);
+ break;
+ }
+ break;
+
+ case PAT_STANDRIGHT:
+ switch (nWhere) {
+ case 0:
+ setPattern(PAT_PUTRIGHT_UP1);
+ break;
+ case 1:
+ setPattern(PAT_PUTRIGHT_MID1);
+ break;
+ case 2:
+ setPattern(PAT_PUTRIGHT_DOWN1);
+ break;
+ }
+ break;
+
+ case PAT_STANDLEFT:
+ switch (nWhere) {
+ case 0:
+ setPattern(PAT_PUTLEFT_UP1);
+ break;
+ case 1:
+ setPattern(PAT_PUTLEFT_MID1);
+ break;
+ case 2:
+ setPattern(PAT_PUTLEFT_DOWN1);
+ break;
+ }
+ break;
+ }
+ } else if (nPart == 1) {
+ setPattern(getCurPattern() + 1);
+ } else if (nPart == 2) {
+ switch (getCurPattern()) {
+ case PAT_PUTUP_UP2:
+ case PAT_PUTUP_MID2:
+ case PAT_PUTUP_DOWN2:
+ setPattern(PAT_STANDUP);
+ break;
+
+ case PAT_PUTLEFT_UP2:
+ case PAT_PUTLEFT_MID2:
+ case PAT_PUTLEFT_DOWN2:
+ setPattern(PAT_STANDLEFT);
+ break;
+
+ case PAT_PUTRIGHT_UP2:
+ case PAT_PUTRIGHT_MID2:
+ case PAT_PUTRIGHT_DOWN2:
+ setPattern(PAT_STANDRIGHT);
+ break;
+ }
+ }
+}
+
+
+bool RMTony::startTalkCalculate(CharacterTalkType nTalkType, int &headStartPat, int &bodyStartPat,
+ int &headLoopPat, int &bodyLoopPat) {
+ assert(!_bIsTalking);
+
+ _bIsTalking = true;
+ _nPatB4Talking = getCurPattern();
+ _nTalkType = nTalkType;
+
+ // Set the direction of speech ONLY if we are not in a static animation (since it would have already been done)
+ if (!_bIsStaticTalk) {
+ switch (_nPatB4Talking) {
+ case PAT_STANDDOWN:
+ _talkDirection = DOWN;
+ break;
+
+ case PAT_TAKELEFT_UP2:
+ case PAT_TAKELEFT_MID2:
+ case PAT_TAKELEFT_DOWN2:
+ case PAT_GETUPLEFT:
+ case PAT_STANDLEFT:
+ _talkDirection = LEFT;
+ break;
+
+ case PAT_TAKERIGHT_UP2:
+ case PAT_TAKERIGHT_MID2:
+ case PAT_TAKERIGHT_DOWN2:
+ case PAT_GETUPRIGHT:
+ case PAT_STANDRIGHT:
+ _talkDirection = RIGHT;
+ break;
+
+ case PAT_TAKEUP_UP2:
+ case PAT_TAKEUP_MID2:
+ case PAT_TAKEUP_DOWN2:
+ case PAT_STANDUP:
+ _talkDirection = UP;
+ break;
+ }
+
+ // Puts the body in front by default
+ _bBodyFront = true;
+ }
+
+ if (_bShepherdess) {
+ // Talking whilst a shepherdess
+ switch (_talkDirection) {
+ case UP:
+ setPattern(PAT_PAST_TALKUP);
+ break;
+
+ case DOWN:
+ setPattern(PAT_PAST_TALKDOWN);
+ break;
+
+ case LEFT:
+ setPattern(PAT_PAST_TALKLEFT);
+ break;
+
+ case RIGHT:
+ setPattern(PAT_PAST_TALKRIGHT);
+ break;
+ }
+ return false;
+ }
+
+ headStartPat = bodyStartPat = 0;
+ bodyLoopPat = 0;
+
+ switch (nTalkType) {
+ case TALK_NORMAL:
+ _bBodyFront = false;
+ headStartPat = 0;
+ bodyStartPat = 0;
+
+ switch (_talkDirection) {
+ case DOWN:
+ headLoopPat = PAT_TALK_DOWN;
+ bodyLoopPat = BPAT_STANDDOWN;
+ _nBodyOffset.set(4, 53);
+ break;
+
+ case LEFT:
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_STANDLEFT;
+ _nBodyOffset.set(6, 56);
+ break;
+
+ case RIGHT:
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_STANDRIGHT;
+ _nBodyOffset.set(6, 56);
+ break;
+
+ case UP:
+ headLoopPat = PAT_TALK_UP;
+ bodyLoopPat = BPAT_STANDUP;
+ _nBodyOffset.set(6, 53);
+ break;
+ }
+ break;
+
+ case TALK_HIPS:
+ _bBodyFront = false;
+ switch (_talkDirection) {
+ case UP:
+ _nBodyOffset.set(2, 42);
+ headStartPat = PAT_HEAD_UP;
+ bodyStartPat = BPAT_HIPSUP_START;
+ headLoopPat = PAT_TALK_UP;
+ bodyLoopPat = BPAT_HIPSUP_LOOP;
+ break;
+
+ case DOWN:
+ _nBodyOffset.set(2, 48);
+ headStartPat = PAT_HEAD_DOWN;
+ bodyStartPat = BPAT_HIPSDOWN_START;
+ headLoopPat = PAT_TALK_DOWN;
+ bodyLoopPat = BPAT_HIPSDOWN_LOOP;
+ break;
+
+ case LEFT:
+ _nBodyOffset.set(-3, 53);
+ headStartPat = PAT_HEAD_LEFT;
+ bodyStartPat = BPAT_HIPSLEFT_START;
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_HIPSLEFT_LOOP;
+ break;
+
+ case RIGHT:
+ _nBodyOffset.set(2, 53);
+ headStartPat = PAT_HEAD_RIGHT;
+ bodyStartPat = BPAT_HIPSRIGHT_START;
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_HIPSRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_SING:
+ _nBodyOffset.set(-10, 25);
+ headStartPat = PAT_HEAD_LEFT;
+ bodyStartPat = BPAT_SINGLEFT_START;
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_SINGLEFT_LOOP;
+ break;
+
+ case TALK_LAUGH:
+ _bBodyFront = false;
+ switch (_talkDirection) {
+ case UP:
+ case DOWN:
+ case LEFT:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_LAUGHLEFT_START;
+ bodyStartPat = BPAT_STANDLEFT;
+ headLoopPat = PAT_LAUGHLEFT_LOOP;
+ bodyLoopPat = BPAT_LAUGHLEFT;
+ break;
+
+ case RIGHT:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_LAUGHRIGHT_START;
+ bodyStartPat = BPAT_STANDRIGHT;
+ headLoopPat = PAT_LAUGHRIGHT_LOOP;
+ bodyLoopPat = BPAT_LAUGHRIGHT;
+ break;
+ }
+ break;
+
+ case TALK_LAUGH2:
+ _bBodyFront = false;
+ switch (_talkDirection) {
+ case UP:
+ case DOWN:
+ case LEFT:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_LAUGHLEFT_START;
+ bodyStartPat = BPAT_STANDLEFT;
+ headLoopPat = PAT_LAUGHLEFT_LOOP;
+ break;
+
+ case RIGHT:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_LAUGHRIGHT_START;
+ bodyStartPat = BPAT_STANDRIGHT;
+ headLoopPat = PAT_LAUGHRIGHT_LOOP;
+ bodyLoopPat = BPAT_LAUGHRIGHT;
+ break;
+ }
+ break;
+
+ case TALK_INDICATE:
+ switch (_talkDirection) {
+ case UP:
+ case DOWN:
+ case LEFT:
+ _nBodyOffset.set(-4, 40);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_INDICATELEFT;
+ break;
+
+ case RIGHT:
+ _nBodyOffset.set(5, 40);
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_INDICATERIGHT;
+ break;
+ }
+ break;
+
+ case TALK_SCARED:
+ switch (_talkDirection) {
+ case UP:
+ _nBodyOffset.set(-4, -11);
+ headStartPat = PAT_HEAD_UP;
+ bodyStartPat = BPAT_SCAREDUP_START;
+ headLoopPat = PAT_TALK_UP;
+ bodyLoopPat = BPAT_SCAREDUP_LOOP;
+ break;
+
+ case DOWN:
+ _nBodyOffset.set(-5, 45);
+ headStartPat = PAT_SCAREDDOWN_START;
+ bodyStartPat = BPAT_SCAREDDOWN_START;
+ headLoopPat = PAT_SCAREDDOWN_LOOP;
+ bodyLoopPat = BPAT_SCAREDDOWN_LOOP;
+ break;
+
+ case RIGHT:
+ _nBodyOffset.set(-4, 41);
+ headStartPat = PAT_SCAREDRIGHT_START;
+ bodyStartPat = BPAT_SCAREDRIGHT_START;
+ headLoopPat = PAT_SCAREDRIGHT_LOOP;
+ bodyLoopPat = BPAT_SCAREDRIGHT_LOOP;
+ break;
+
+ case LEFT:
+ _nBodyOffset.set(-10, 41);
+ headStartPat = PAT_SCAREDLEFT_START;
+ bodyStartPat = BPAT_SCAREDLEFT_START;
+ headLoopPat = PAT_SCAREDLEFT_LOOP;
+ bodyLoopPat = BPAT_SCAREDLEFT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_SCARED2:
+ _bBodyFront = false;
+ switch (_talkDirection) {
+ case UP:
+ bodyStartPat = BPAT_STANDUP;
+ bodyLoopPat = BPAT_STANDUP;
+ _nBodyOffset.set(6, 53);
+
+ headStartPat = PAT_HEAD_UP;
+ headLoopPat = PAT_TALK_UP;
+ break;
+
+ case DOWN:
+ bodyStartPat = BPAT_STANDDOWN;
+ bodyLoopPat = BPAT_STANDDOWN;
+ _nBodyOffset.set(4, 53);
+
+ headStartPat = PAT_SCAREDDOWN_START;
+ headLoopPat = PAT_SCAREDDOWN_LOOP;
+ break;
+
+ case RIGHT:
+ bodyStartPat = BPAT_STANDRIGHT;
+ bodyLoopPat = BPAT_STANDRIGHT;
+ _nBodyOffset.set(6, 56);
+
+ headStartPat = PAT_SCAREDRIGHT_START;
+ headLoopPat = PAT_SCAREDRIGHT_LOOP;
+ break;
+
+ case LEFT:
+ bodyStartPat = BPAT_STANDLEFT;
+ bodyLoopPat = BPAT_STANDLEFT;
+ _nBodyOffset.set(6, 56);
+
+ headStartPat = PAT_SCAREDLEFT_START;
+ headLoopPat = PAT_SCAREDLEFT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHGLASSES:
+ _nBodyOffset.set(4, 53);
+ headLoopPat = PAT_TALK_DOWN;
+ bodyLoopPat = BPAT_GLASS;
+ break;
+ case TALK_WITHWORM:
+ _nBodyOffset.set(9, 56);
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_WORM;
+ break;
+ case TALK_WITHHAMMER:
+ _nBodyOffset.set(6, 56);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_HAMMER;
+ break;
+ case TALK_WITHROPE:
+ _nBodyOffset.set(-3, 38);
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_ROPE;
+ break;
+ case TALK_WITHSECRETARY:
+ _nBodyOffset.set(-17, 12);
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_WITHSECRETARY;
+ break;
+
+ case TALK_WITHRABBIT:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ _nBodyOffset.set(-21, -5);
+ bodyStartPat = BPAT_WITHRABBITLEFT_START;
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_WITHRABBITLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-4, -5);
+ bodyStartPat = BPAT_WITHRABBITRIGHT_START;
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_WITHRABBITRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHRECIPE:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ _nBodyOffset.set(-61, -7);
+ bodyStartPat = BPAT_WITHRECIPELEFT_START;
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_WITHRECIPELEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-5, -7);
+ bodyStartPat = BPAT_WITHRECIPERIGHT_START;
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_WITHRECIPERIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHCARDS:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ _nBodyOffset.set(-34, -2);
+ bodyStartPat = BPAT_WITHCARDSLEFT_START;
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_WITHCARDSLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-4, -2);
+ bodyStartPat = BPAT_WITHCARDSRIGHT_START;
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_WITHCARDSRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHSNOWMAN:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ _nBodyOffset.set(-35, 2);
+ bodyStartPat = BPAT_WITHSNOWMANLEFT_START;
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_WITHSNOWMANLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-14, 2);
+ bodyStartPat = BPAT_WITHSNOWMANRIGHT_START;
+ headLoopPat = PAT_TALK_RIGHT;
+ bodyLoopPat = BPAT_WITHSNOWMANRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHSNOWMANSTATIC:
+ case TALK_WITHRECIPESTATIC:
+ case TALK_WITHRABBITSTATIC:
+ case TALK_WITHCARDSSTATIC:
+ case TALK_WITH_NOTEBOOK:
+ case TALK_WITHMEGAPHONESTATIC:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ headLoopPat = PAT_TALK_LEFT;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ headLoopPat = PAT_TALK_RIGHT;
+ break;
+ }
+ break;
+
+ // The beard is the only case in which the head is animated separately while the body is the standard
+ case TALK_WITHBEARDSTATIC:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ headLoopPat = PAT_TALKBEARD_LEFT;
+ bodyLoopPat = BPAT_STANDLEFT;
+ _nBodyOffset.set(6, 56);
+ break;
+
+ case DOWN:
+ case RIGHT:
+ headLoopPat = PAT_TALKBEARD_RIGHT;
+ bodyLoopPat = BPAT_STANDRIGHT;
+ _nBodyOffset.set(6, 56);
+ break;
+ }
+ break;
+
+ case TALK_DISGUSTED:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_DISGUSTEDLEFT_START;
+ bodyStartPat = BPAT_STANDLEFT;
+ headLoopPat = PAT_DISGUSTEDLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_DISGUSTEDRIGHT_START;
+ bodyStartPat = BPAT_STANDRIGHT;
+ headLoopPat = PAT_DISGUSTEDRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_SARCASTIC:
+ switch (_talkDirection) {
+ case LEFT:
+ case UP:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_SARCASTICLEFT_START;
+ bodyStartPat = BPAT_STANDLEFT;
+ headLoopPat = PAT_SARCASTICLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(6, 56);
+ headStartPat = PAT_SARCASTICRIGHT_START;
+ bodyStartPat = BPAT_STANDRIGHT;
+ headLoopPat = PAT_SARCASTICRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_MACBETH1:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH1;
+ break;
+ case TALK_MACBETH2:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH2;
+ break;
+ case TALK_MACBETH3:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH3;
+ break;
+ case TALK_MACBETH4:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH4;
+ break;
+ case TALK_MACBETH5:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH5;
+ break;
+ case TALK_MACBETH6:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH6;
+ break;
+ case TALK_MACBETH7:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH7;
+ break;
+ case TALK_MACBETH8:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH8;
+ break;
+ case TALK_MACBETH9:
+ _nBodyOffset.set(-33, -1);
+ headLoopPat = PAT_TALK_LEFT;
+ bodyLoopPat = BPAT_MACBETH9;
+ break;
+
+ case TALK_SCAREDSTATIC:
+ _bBodyFront = false;
+ switch (_talkDirection) {
+ case DOWN:
+ bodyStartPat = BPAT_STANDDOWN;
+ bodyLoopPat = BPAT_STANDDOWN;
+ _nBodyOffset.set(4, 53);
+
+ headStartPat = PAT_SCAREDDOWN_STAND;
+ headLoopPat = PAT_SCAREDDOWN_LOOP;
+ break;
+
+ case RIGHT:
+ bodyStartPat = BPAT_STANDRIGHT;
+ bodyLoopPat = BPAT_STANDRIGHT;
+ _nBodyOffset.set(6, 56);
+
+ headStartPat = PAT_SCAREDRIGHT_STAND;
+ headLoopPat = PAT_SCAREDRIGHT_LOOP;
+ break;
+
+ case LEFT:
+ bodyStartPat = BPAT_STANDLEFT;
+ bodyLoopPat = BPAT_STANDLEFT;
+ _nBodyOffset.set(6, 56);
+
+ headStartPat = PAT_SCAREDLEFT_STAND;
+ headLoopPat = PAT_SCAREDLEFT_LOOP;
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+
+ return true;
+}
+
+void RMTony::startTalk(CORO_PARAM, CharacterTalkType nTalkType) {
+ CORO_BEGIN_CONTEXT;
+ int headStartPat, bodyStartPat;
+ int headLoopPat, bodyLoopPat;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->headStartPat = _ctx->bodyStartPat = 0;
+ _ctx->headLoopPat = _ctx->bodyLoopPat = 0;
+
+ if (!startTalkCalculate(nTalkType, _ctx->headStartPat, _ctx->bodyStartPat,
+ _ctx->headLoopPat, _ctx->bodyLoopPat))
+ return;
+
+ // Perform the set pattern
+ if (_ctx->headStartPat != 0 || _ctx->bodyStartPat != 0) {
+ setPattern(_ctx->headStartPat);
+ _body.setPattern(_ctx->bodyStartPat);
+
+ if (_ctx->bodyStartPat != 0)
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ if (_ctx->headStartPat != 0)
+ CORO_INVOKE_0(waitForEndPattern);
+ }
+
+ setPattern(_ctx->headLoopPat);
+ if (_ctx->bodyLoopPat)
+ _body.setPattern(_ctx->bodyLoopPat);
+
+ CORO_END_CODE;
+}
+
+
+bool RMTony::endTalkCalculate(int &headStandPat, int &headEndPat, int &bodyEndPat, int &finalPat, bool &bStatic) {
+ bodyEndPat = 0;
+ headEndPat = 0;
+
+ switch (_talkDirection) {
+ case UP:
+ finalPat = PAT_STANDUP;
+ headStandPat = PAT_HEAD_UP;
+ break;
+
+ case DOWN:
+ finalPat = PAT_STANDDOWN;
+ headStandPat = PAT_HEAD_DOWN;
+ break;
+
+ case LEFT:
+ finalPat = PAT_STANDLEFT;
+ headStandPat = PAT_HEAD_LEFT;
+ break;
+
+ case RIGHT:
+ finalPat = PAT_STANDRIGHT;
+ headStandPat = PAT_HEAD_RIGHT;
+ break;
+ }
+
+ if (_bShepherdess) {
+ setPattern(finalPat);
+ _bIsTalking = false;
+ return false;
+ }
+
+ bStatic = false;
+ switch (_nTalkType) {
+ case TALK_NORMAL:
+ bodyEndPat = 0;
+ break;
+
+ case TALK_HIPS:
+ switch (_talkDirection) {
+ case UP:
+ bodyEndPat = BPAT_HIPSUP_END;
+ break;
+
+ case DOWN:
+ bodyEndPat = BPAT_HIPSDOWN_END;
+ break;
+
+ case LEFT:
+ bodyEndPat = BPAT_HIPSLEFT_END;
+ break;
+
+ case RIGHT:
+ bodyEndPat = BPAT_HIPSRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_SING:
+ bodyEndPat = BPAT_SINGLEFT_END;
+ break;
+
+ case TALK_LAUGH:
+ case TALK_LAUGH2:
+ if (_talkDirection == LEFT)
+ headEndPat = PAT_LAUGHLEFT_END;
+ else if (_talkDirection == RIGHT)
+ headEndPat = PAT_LAUGHRIGHT_END;
+
+ bodyEndPat = 0;
+ break;
+
+ case TALK_DISGUSTED:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ headEndPat = PAT_DISGUSTEDLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ headEndPat = PAT_DISGUSTEDRIGHT_END;
+ break;
+ }
+
+ bodyEndPat = 0;
+ break;
+
+ case TALK_SARCASTIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ headEndPat = PAT_SARCASTICLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ headEndPat = PAT_SARCASTICRIGHT_END;
+ break;
+ }
+
+ bodyEndPat = 0;
+ break;
+
+ case TALK_INDICATE:
+ break;
+
+ case TALK_SCARED:
+ switch (_talkDirection) {
+ case UP:
+ bodyEndPat = BPAT_SCAREDUP_END;
+ break;
+
+ case DOWN:
+ headEndPat = PAT_SCAREDDOWN_END;
+ bodyEndPat = BPAT_SCAREDDOWN_END;
+ break;
+
+ case RIGHT:
+ headEndPat = PAT_SCAREDRIGHT_END;
+ bodyEndPat = BPAT_SCAREDRIGHT_END;
+ break;
+
+ case LEFT:
+ headEndPat = PAT_SCAREDLEFT_END;
+ bodyEndPat = BPAT_SCAREDLEFT_END;
+ break;
+ }
+ break;
+
+ case TALK_SCARED2:
+ switch (_talkDirection) {
+ case UP:
+ bodyEndPat = 0;
+ break;
+
+ case DOWN:
+ headEndPat = PAT_SCAREDDOWN_END;
+ bodyEndPat = 0;
+ break;
+
+ case RIGHT:
+ headEndPat = PAT_SCAREDRIGHT_END;
+ bodyEndPat = 0;
+ break;
+
+ case LEFT:
+ headEndPat = PAT_SCAREDLEFT_END;
+ bodyEndPat = 0;
+ break;
+ }
+ break;
+
+ case TALK_WITHRABBIT:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ finalPat = PAT_STANDLEFT;
+ bodyEndPat = BPAT_WITHRABBITLEFT_END;
+ break;
+
+ case RIGHT:
+ case DOWN:
+ finalPat = PAT_STANDRIGHT;
+ bodyEndPat = BPAT_WITHRABBITRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHRECIPE:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ finalPat = PAT_STANDLEFT;
+ bodyEndPat = BPAT_WITHRECIPELEFT_END;
+ break;
+
+ case RIGHT:
+ case DOWN:
+ finalPat = PAT_STANDRIGHT;
+ bodyEndPat = BPAT_WITHRECIPERIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHCARDS:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ finalPat = PAT_STANDLEFT;
+ bodyEndPat = BPAT_WITHCARDSLEFT_END;
+ break;
+
+ case RIGHT:
+ case DOWN:
+ finalPat = PAT_STANDRIGHT;
+ bodyEndPat = BPAT_WITHCARDSRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHSNOWMAN:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ finalPat = PAT_STANDLEFT;
+ bodyEndPat = BPAT_WITHSNOWMANLEFT_END;
+ break;
+
+ case RIGHT:
+ case DOWN:
+ finalPat = PAT_STANDRIGHT;
+ bodyEndPat = BPAT_WITHSNOWMANRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHWORM:
+ finalPat = PAT_WITHWORM;
+ break;
+ case TALK_WITHROPE:
+ finalPat = PAT_WITHROPE;
+ break;
+ case TALK_WITHSECRETARY:
+ finalPat = PAT_WITHSECRETARY;
+ break;
+ case TALK_WITHHAMMER:
+ finalPat = PAT_WITHHAMMER;
+ break;
+ case TALK_WITHGLASSES:
+ finalPat = PAT_WITHGLASSES;
+ break;
+
+ case TALK_MACBETH1:
+ case TALK_MACBETH2:
+ case TALK_MACBETH3:
+ case TALK_MACBETH4:
+ case TALK_MACBETH5:
+ case TALK_MACBETH6:
+ case TALK_MACBETH7:
+ case TALK_MACBETH8:
+ finalPat = 0;
+ break;
+
+ case TALK_SCAREDSTATIC:
+ switch (_talkDirection) {
+ case DOWN:
+ headStandPat = PAT_SCAREDDOWN_STAND;
+ bodyEndPat = 0;
+ break;
+
+ case RIGHT:
+ headStandPat = PAT_SCAREDRIGHT_STAND;
+ bodyEndPat = 0;
+ break;
+
+ case LEFT:
+ headStandPat = PAT_SCAREDLEFT_STAND;
+ bodyEndPat = 0;
+ break;
+
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+void RMTony::endTalk(CORO_PARAM) {
+ CORO_BEGIN_CONTEXT;
+ int headStandPat, headEndPat;
+ int bodyEndPat, finalPat;
+ bool bStatic;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->headStandPat = _ctx->headEndPat = 0;
+ _ctx->bodyEndPat = _ctx->finalPat = 0;
+ _ctx->bStatic = false;
+
+ _ctx->bodyEndPat = 0;
+ _ctx->headEndPat = 0;
+
+ if (!endTalkCalculate(_ctx->headStandPat, _ctx->headEndPat, _ctx->bodyEndPat, _ctx->finalPat, _ctx->bStatic))
+ return;
+
+ // Handles the end of an animated and static, leaving everything unchanged
+ if (_bIsStaticTalk) {
+ if (_nTalkType == TALK_WITHBEARDSTATIC) {
+ setPattern(0);
+ if (_talkDirection == UP || _talkDirection == LEFT) {
+ _body.setPattern(BPAT_WITHBEARDLEFT_STATIC);
+ _nBodyOffset.set(-41, -14);
+ } else if (_talkDirection == DOWN || _talkDirection == RIGHT) {
+ _body.setPattern(BPAT_WITHBEARDRIGHT_STATIC);
+ _nBodyOffset.set(-26, -14);
+ }
+ } else {
+ setPattern(_ctx->headStandPat);
+
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ }
+
+ _bIsTalking = false;
+ return;
+ }
+
+ // Set the pattern
+ if (_ctx->headEndPat != 0 && _ctx->bodyEndPat != 0) {
+ setPattern(_ctx->headEndPat);
+
+ CORO_INVOKE_0(_body.waitForEndPattern);
+
+ _body.setPattern(_ctx->bodyEndPat);
+
+ CORO_INVOKE_0(waitForEndPattern);
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ } else if (_ctx->bodyEndPat != 0) {
+ setPattern(_ctx->headStandPat);
+
+ CORO_INVOKE_0(_body.waitForEndPattern);
+
+ _body.setPattern(_ctx->bodyEndPat);
+
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ } else if (_ctx->headEndPat != 0) {
+ CORO_INVOKE_0(_body.waitForEndPattern);
+
+ setPattern(_ctx->headEndPat);
+
+ CORO_INVOKE_0(waitForEndPattern);
+ } else {
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ }
+
+ if (_ctx->finalPat != 0) {
+ _body.setPattern(0);
+ setPattern(_ctx->finalPat);
+ }
+
+ _bIsTalking = false;
+
+ CORO_END_CODE;
+}
+
+void RMTony::startStaticCalculate(CharacterTalkType nTalk, int &headPat, int &headLoopPat,
+ int &bodyStartPat, int &bodyLoopPat) {
+ int nPat = getCurPattern();
+
+ headLoopPat = -1;
+
+ switch (nPat) {
+ case PAT_STANDDOWN:
+ _talkDirection = DOWN;
+ headPat = PAT_HEAD_RIGHT;
+ break;
+
+ case PAT_TAKELEFT_UP2:
+ case PAT_TAKELEFT_MID2:
+ case PAT_TAKELEFT_DOWN2:
+ case PAT_GETUPLEFT:
+ case PAT_STANDLEFT:
+ _talkDirection = LEFT;
+ headPat = PAT_HEAD_LEFT;
+ break;
+
+ case PAT_TAKERIGHT_UP2:
+ case PAT_TAKERIGHT_MID2:
+ case PAT_TAKERIGHT_DOWN2:
+ case PAT_GETUPRIGHT:
+ case PAT_STANDRIGHT:
+ _talkDirection = RIGHT;
+ headPat = PAT_HEAD_RIGHT;
+ break;
+
+ case PAT_TAKEUP_UP2:
+ case PAT_TAKEUP_MID2:
+ case PAT_TAKEUP_DOWN2:
+ case PAT_STANDUP:
+ _talkDirection = UP;
+ headPat = PAT_HEAD_LEFT;
+ break;
+ }
+
+ _bBodyFront = true;
+
+ switch (nTalk) {
+ case TALK_WITHRABBITSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-21, -5);
+ bodyStartPat = BPAT_WITHRABBITLEFT_START;
+ bodyLoopPat = BPAT_WITHRABBITLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-4, -5);
+ bodyStartPat = BPAT_WITHRABBITRIGHT_START;
+ bodyLoopPat = BPAT_WITHRABBITRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHCARDSSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-34, -2);
+ bodyStartPat = BPAT_WITHCARDSLEFT_START;
+ bodyLoopPat = BPAT_WITHCARDSLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-4, -2);
+ bodyStartPat = BPAT_WITHCARDSRIGHT_START;
+ bodyLoopPat = BPAT_WITHCARDSRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHRECIPESTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-61, -7);
+ bodyStartPat = BPAT_WITHRECIPELEFT_START;
+ bodyLoopPat = BPAT_WITHRECIPELEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-5, -7);
+ bodyStartPat = BPAT_WITHRECIPERIGHT_START;
+ bodyLoopPat = BPAT_WITHRECIPERIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHSNOWMANSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-35, 2);
+ bodyStartPat = BPAT_WITHSNOWMANLEFT_START;
+ bodyLoopPat = BPAT_WITHSNOWMANLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-14, 2);
+ bodyStartPat = BPAT_WITHSNOWMANRIGHT_START;
+ bodyLoopPat = BPAT_WITHSNOWMANRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITH_NOTEBOOK:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-16, -9);
+ bodyStartPat = BPAT_WITHNOTEBOOKLEFT_START;
+ bodyLoopPat = BPAT_WITHNOTEBOOKLEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-6, -9);
+ bodyStartPat = BPAT_WITHNOTEBOOKRIGHT_START;
+ bodyLoopPat = BPAT_WITHNOTEBOOKRIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHMEGAPHONESTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-41, -8);
+ bodyStartPat = BPAT_WITHMEGAPHONELEFT_START;
+ bodyLoopPat = BPAT_WITHMEGAPHONELEFT_LOOP;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-14, -8);
+ bodyStartPat = BPAT_WITHMEGAPHONERIGHT_START;
+ bodyLoopPat = BPAT_WITHMEGAPHONERIGHT_LOOP;
+ break;
+ }
+ break;
+
+ case TALK_WITHBEARDSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ _nBodyOffset.set(-41, -14);
+ bodyStartPat = BPAT_WITHBEARDLEFT_START;
+ bodyLoopPat = BPAT_STANDLEFT;
+ headLoopPat = PAT_TALKBEARD_LEFT;
+ headPat = 0;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ _nBodyOffset.set(-26, -14);
+ bodyStartPat = BPAT_WITHBEARDRIGHT_START;
+ bodyLoopPat = BPAT_STANDRIGHT;
+ headLoopPat = PAT_TALKBEARD_RIGHT;
+ headPat = 0;
+ break;
+ }
+ break;
+
+ case TALK_SCAREDSTATIC:
+ switch (_talkDirection) {
+ case DOWN:
+ headPat = PAT_SCAREDDOWN_START;
+ bodyLoopPat = BPAT_STANDDOWN;
+ bodyStartPat = BPAT_STANDDOWN;
+ headLoopPat = PAT_SCAREDDOWN_STAND;
+ _nBodyOffset.set(4, 53);
+ break;
+
+ case LEFT:
+ headPat = PAT_SCAREDLEFT_START;
+ bodyLoopPat = BPAT_STANDLEFT;
+ bodyStartPat = BPAT_STANDLEFT;
+ headLoopPat = PAT_SCAREDLEFT_STAND;
+ _nBodyOffset.set(6, 56);
+ break;
+
+ case RIGHT:
+ headPat = PAT_SCAREDRIGHT_START;
+ bodyLoopPat = BPAT_STANDRIGHT;
+ bodyStartPat = BPAT_STANDRIGHT;
+ headLoopPat = PAT_SCAREDRIGHT_STAND;
+ _nBodyOffset.set(6, 56);
+ break;
+
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+void RMTony::startStatic(CORO_PARAM, CharacterTalkType nTalk) {
+ CORO_BEGIN_CONTEXT;
+ int headPat, headLoopPat;
+ int bodyStartPat, bodyLoopPat;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->headPat = _ctx->headLoopPat = 0;
+ _ctx->bodyStartPat = _ctx->bodyLoopPat = 0;
+
+ startStaticCalculate(nTalk, _ctx->headPat, _ctx->headLoopPat,
+ _ctx->bodyStartPat, _ctx->bodyLoopPat);
+
+ // e vai con i pattern
+ _bIsStaticTalk = true;
+
+ setPattern(_ctx->headPat);
+ _body.setPattern(_ctx->bodyStartPat);
+
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ CORO_INVOKE_0(waitForEndPattern);
+
+ if (_ctx->headLoopPat != -1)
+ setPattern(_ctx->headLoopPat);
+ _body.setPattern(_ctx->bodyLoopPat);
+
+ CORO_END_CODE;
+}
+
+void RMTony::endStaticCalculate(CharacterTalkType nTalk, int &bodyEndPat, int &finalPat, int &headEndPat) {
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ finalPat = PAT_STANDLEFT;
+ break;
+
+ case RIGHT:
+ case DOWN:
+ finalPat = PAT_STANDRIGHT;
+ break;
+ }
+
+ switch (nTalk) {
+ case TALK_WITHSNOWMANSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHSNOWMANLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHSNOWMANRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHRECIPESTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHRECIPELEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHRECIPERIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHRABBITSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHRABBITLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHRABBITRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHCARDSSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHCARDSLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHCARDSRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITH_NOTEBOOK:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHNOTEBOOKLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHNOTEBOOKRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHMEGAPHONESTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHMEGAPHONELEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHMEGAPHONERIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_WITHBEARDSTATIC:
+ switch (_talkDirection) {
+ case UP:
+ case LEFT:
+ bodyEndPat = BPAT_WITHBEARDLEFT_END;
+ break;
+
+ case DOWN:
+ case RIGHT:
+ bodyEndPat = BPAT_WITHBEARDRIGHT_END;
+ break;
+ }
+ break;
+
+ case TALK_SCAREDSTATIC:
+ switch (_talkDirection) {
+ case LEFT:
+ headEndPat = PAT_SCAREDLEFT_END;
+ break;
+
+ case DOWN:
+ headEndPat = PAT_SCAREDDOWN_END;
+ break;
+
+ case RIGHT:
+ headEndPat = PAT_SCAREDRIGHT_END;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void RMTony::endStatic(CORO_PARAM, CharacterTalkType nTalk) {
+ CORO_BEGIN_CONTEXT;
+ int bodyEndPat;
+ int finalPat;
+ int headEndPat;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ _ctx->bodyEndPat = 0;
+ _ctx->finalPat = 0;
+ _ctx->headEndPat = 0;
+
+ endStaticCalculate(nTalk, _ctx->bodyEndPat, _ctx->finalPat, _ctx->headEndPat);
+
+ if (_ctx->headEndPat != 0) {
+ setPattern(_ctx->headEndPat);
+
+ CORO_INVOKE_0(waitForEndPattern);
+ } else {
+ // Play please
+ _body.setPattern(_ctx->bodyEndPat);
+
+ CORO_INVOKE_0(_body.waitForEndPattern);
+ }
+
+ setPattern(_ctx->finalPat);
+ _body.setPattern(0);
+
+ _bIsStaticTalk = false;
+
+ CORO_END_CODE;
+}
+
+/**
+ * Waits until the end of a pattern
+ */
+void RMTony::waitForEndPattern(CORO_PARAM, uint32 hCustomSkip) {
+ RMCharacter::waitForEndPattern(coroParam, hCustomSkip);
+}
+
+/**
+ * Check if currently in an action
+ */
+bool RMTony::inAction() {
+ return (_bActionPending && _action != 0) | _bAction;
+}
+
+/**
+ * Check if there needs to be an update for scrolling movement
+ */
+bool RMTony::mustUpdateScrolling() {
+ return ((!inAction()) || (isMoving()));
+}
+
+/**
+ * Returns Tony's position
+ */
+RMPoint RMTony::position() {
+ return _pos;
+}
+
+/**
+ * Set the scrolling position
+ */
+void RMTony::setScrollPosition(const RMPoint &pt) {
+ RMCharacter::setScrollPosition(pt);
+}
+
+/**
+ * Tony disguises himself!
+ */
+void RMTony::setShepherdess(bool bIsPast) {
+ _bShepherdess = bIsPast;
+}
+
+int RMTony::getShepherdess() {
+ return _bShepherdess;
+}
+
+void RMTony::playSfx(int nSfx) {
+ RMItem::playSfx(nSfx);
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/tonychar.h b/engines/tony/tonychar.h
new file mode 100644
index 0000000000..d9f18f61ec
--- /dev/null
+++ b/engines/tony/tonychar.h
@@ -0,0 +1,482 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_TONYCHAR_H
+#define TONY_TONYCHAR_H
+
+#include "common/coroutines.h"
+#include "tony/loc.h"
+
+namespace Tony {
+
+class RMTony : public RMCharacter {
+private:
+ enum CharacterDirection {
+ UP, DOWN, LEFT, RIGHT
+ };
+
+public:
+ enum CharacterTalkType {
+ TALK_NORMAL,
+ TALK_HIPS,
+ TALK_SING,
+ TALK_LAUGH,
+ TALK_INDICATE,
+ TALK_SCARED,
+ TALK_SCARED2,
+ TALK_WITHGLASSES,
+ TALK_WITHHAMMER,
+ TALK_WITHWORM,
+ TALK_WITHROPE,
+ TALK_WITHRABBIT,
+ TALK_WITHRECIPE,
+ TALK_WITHCARDS,
+ TALK_WITHSNOWMAN,
+ TALK_WITHSNOWMANSTATIC,
+ TALK_WITHRABBITSTATIC,
+ TALK_WITHRECIPESTATIC,
+ TALK_WITHCARDSSTATIC,
+ TALK_WITH_NOTEBOOK,
+ TALK_WITHMEGAPHONESTATIC,
+ TALK_WITHBEARDSTATIC,
+ TALK_LAUGH2,
+ TALK_DISGUSTED,
+ TALK_SARCASTIC,
+ TALK_MACBETH1,
+ TALK_MACBETH2,
+ TALK_MACBETH3,
+ TALK_MACBETH4,
+ TALK_MACBETH5,
+ TALK_MACBETH6,
+ TALK_MACBETH7,
+ TALK_MACBETH8,
+ TALK_MACBETH9,
+ TALK_SCAREDSTATIC,
+ TALK_WITHSECRETARY
+ };
+
+private:
+ bool _bShow;
+ bool _bShowShadow;
+ bool _bBodyFront;
+ // Useless variable?
+ // RMGfxSourceBuffer8AB _shadow;
+ bool _bActionPending;
+ RMItem *_actionItem;
+ int _action;
+ int _actionParm;
+ static bool _bAction;
+
+ bool _bShepherdess;
+
+ bool _bIsStaticTalk;
+ bool _bIsTalking;
+ int _nPatB4Talking;
+ CharacterTalkType _nTalkType;
+ CharacterDirection _talkDirection;
+ RMPoint _nBodyOffset;
+
+ int _nTimeLastStep;
+
+ RMItem _body;
+ uint32 _hActionThread;
+
+protected:
+ /**
+ * Overload of the allocation allocation of sprites
+ */
+ virtual RMGfxSourceBuffer *newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE);
+
+ /**
+ * Watch thread which waits for the end of an action
+ */
+ static void waitEndOfAction(CORO_PARAM, const void *param);
+
+public:
+ enum CharacterPatterns {
+ PAT_TAKEUP_UP1 = 9,
+ PAT_TAKEUP_UP2,
+ PAT_TAKEUP_MID1,
+ PAT_TAKEUP_MID2,
+ PAT_TAKEUP_DOWN1,
+ PAT_TAKEUP_DOWN2,
+
+ PAT_TAKELEFT_UP1,
+ PAT_TAKELEFT_UP2,
+ PAT_TAKELEFT_MID1,
+ PAT_TAKELEFT_MID2,
+ PAT_TAKELEFT_DOWN1,
+ PAT_TAKELEFT_DOWN2,
+
+ PAT_TAKERIGHT_UP1,
+ PAT_TAKERIGHT_UP2,
+ PAT_TAKERIGHT_MID1,
+ PAT_TAKERIGHT_MID2,
+ PAT_TAKERIGHT_DOWN1,
+ PAT_TAKERIGHT_DOWN2,
+
+ PAT_GETUPLEFT,
+ PAT_ONTHEFLOORLEFT,
+ PAT_GETUPRIGHT,
+ PAT_ONTHEFLOORRIGHT,
+
+ // Sheperdess!
+ PAT_PAST_WALKUP,
+ PAT_PAST_WALKDOWN,
+ PAT_PAST_WALKLEFT,
+ PAT_PAST_WALKRIGHT,
+
+ PAT_PAST_STANDUP,
+ PAT_PAST_STANDDOWN,
+ PAT_PAST_STANDLEFT,
+ PAT_PAST_STANDRIGHT,
+
+ // Speech
+ PAT_TALK_UP,
+ PAT_TALK_DOWN,
+ PAT_TALK_LEFT,
+ PAT_TALK_RIGHT,
+
+ // Static head
+ PAT_HEAD_UP,
+ PAT_HEAD_DOWN,
+ PAT_HEAD_LEFT,
+ PAT_HEAD_RIGHT,
+
+ // Laugh
+ PAT_LAUGHLEFT_START,
+ PAT_LAUGHLEFT_LOOP,
+ PAT_LAUGHLEFT_END,
+ PAT_LAUGHRIGHT_START,
+ PAT_LAUGHRIGHT_LOOP,
+ PAT_LAUGHRIGHT_END,
+
+ // Speaking as a shepherdess
+ PAT_PAST_TALKUP,
+ PAT_PAST_TALKDOWN,
+ PAT_PAST_TALKLEFT,
+ PAT_PAST_TALKRIGHT,
+
+ // Fear
+ PAT_SCAREDLEFT_START,
+ PAT_SCAREDLEFT_LOOP,
+ PAT_SCAREDLEFT_END,
+ PAT_SCAREDRIGHT_START,
+ PAT_SCAREDRIGHT_LOOP,
+ PAT_SCAREDRIGHT_END,
+ PAT_SCAREDDOWN_START,
+ PAT_SCAREDDOWN_LOOP,
+ PAT_SCAREDDOWN_END,
+
+ // With objects: full body
+ PAT_WITHGLASSES,
+ PAT_WITHROPE,
+ PAT_WITHWORM,
+ PAT_WITHHAMMER,
+
+ // Sound the whistle
+ PAT_WHISTLERIGHT,
+
+ // Head with beard
+ PAT_TALKBEARD_LEFT,
+ PAT_TALKBEARD_RIGHT,
+
+ // Sniff
+ PAT_SNIFF_LEFT,
+ PAT_SNIFF_RIGHT,
+
+ // Disgusted
+ PAT_DISGUSTEDLEFT_START,
+ PAT_DISGUSTEDLEFT_LOOP,
+ PAT_DISGUSTEDLEFT_END,
+ PAT_DISGUSTEDRIGHT_START,
+ PAT_DISGUSTEDRIGHT_LOOP,
+ PAT_DISGUSTEDRIGHT_END,
+ PAT_SARCASTICLEFT_START,
+ PAT_SARCASTICLEFT_LOOP,
+ PAT_SARCASTICLEFT_END,
+ PAT_SARCASTICRIGHT_START,
+ PAT_SARCASTICRIGHT_LOOP,
+ PAT_SARCASTICRIGHT_END,
+
+ // Stand scared
+ PAT_SCAREDLEFT_STAND,
+ PAT_SCAREDRIGHT_STAND,
+ PAT_SCAREDDOWN_STAND,
+
+ PAT_PUTLEFT_UP1,
+ PAT_PUTLEFT_UP2,
+ PAT_PUTRIGHT_UP1,
+ PAT_PUTRIGHT_UP2,
+ PAT_PUTLEFT_MID1,
+ PAT_PUTLEFT_MID2,
+ PAT_PUTRIGHT_MID1,
+ PAT_PUTRIGHT_MID2,
+ PAT_PUTLEFT_DOWN1,
+ PAT_PUTLEFT_DOWN2,
+ PAT_PUTRIGHT_DOWN1,
+ PAT_PUTRIGHT_DOWN2,
+ PAT_PUTUP_UP1,
+ PAT_PUTUP_UP2,
+ PAT_PUTUP_MID1,
+ PAT_PUTUP_MID2,
+ PAT_PUTUP_DOWN1,
+ PAT_PUTUP_DOWN2,
+
+ PAT_WITHSECRETARY
+ };
+
+ enum CharacterBodyPatterns {
+ BPAT_STANDUP = 1,
+ BPAT_STANDDOWN,
+ BPAT_STANDLEFT,
+ BPAT_STANDRIGHT,
+
+ BPAT_HAMMER,
+ BPAT_SNOWMAN,
+ BPAT_WORM,
+ BPAT_GLASS,
+
+ BPAT_SINGLEFT_START,
+ BPAT_SINGLEFT_LOOP,
+ BPAT_SINGLEFT_END,
+
+ BPAT_HIPSLEFT_START,
+ BPAT_HIPSLEFT_LOOP,
+ BPAT_HIPSLEFT_END,
+ BPAT_HIPSRIGHT_START,
+ BPAT_HIPSRIGHT_LOOP,
+ BPAT_HIPSRIGHT_END,
+ BPAT_HIPSUP_START,
+ BPAT_HIPSUP_LOOP,
+ BPAT_HIPSUP_END,
+ BPAT_HIPSDOWN_START,
+ BPAT_HIPSDOWN_LOOP,
+ BPAT_HIPSDOWN_END,
+
+ BPAT_LAUGHLEFT,
+ BPAT_LAUGHRIGHT,
+
+ BPAT_INDICATELEFT,
+ BPAT_INDICATERIGHT,
+
+ BPAT_SCAREDDOWN_START,
+ BPAT_SCAREDDOWN_LOOP,
+ BPAT_SCAREDDOWN_END,
+ BPAT_SCAREDLEFT_START,
+ BPAT_SCAREDLEFT_LOOP,
+ BPAT_SCAREDLEFT_END,
+ BPAT_SCAREDRIGHT_START,
+ BPAT_SCAREDRIGHT_LOOP,
+ BPAT_SCAREDRIGHT_END,
+ BPAT_SCAREDUP_START,
+ BPAT_SCAREDUP_LOOP,
+ BPAT_SCAREDUP_END,
+
+ BPAT_ROPE,
+
+ BPAT_WITHRABBITLEFT_START,
+ BPAT_WITHRABBITLEFT_LOOP,
+ BPAT_WITHRABBITLEFT_END,
+ BPAT_WITHRABBITRIGHT_START,
+ BPAT_WITHRABBITRIGHT_LOOP,
+ BPAT_WITHRABBITRIGHT_END,
+
+ BPAT_WITHRECIPELEFT_START,
+ BPAT_WITHRECIPELEFT_LOOP,
+ BPAT_WITHRECIPELEFT_END,
+ BPAT_WITHRECIPERIGHT_START,
+ BPAT_WITHRECIPERIGHT_LOOP,
+ BPAT_WITHRECIPERIGHT_END,
+
+ BPAT_WITHCARDSLEFT_START,
+ BPAT_WITHCARDSLEFT_LOOP,
+ BPAT_WITHCARDSLEFT_END,
+ BPAT_WITHCARDSRIGHT_START,
+ BPAT_WITHCARDSRIGHT_LOOP,
+ BPAT_WITHCARDSRIGHT_END,
+
+ BPAT_WITHSNOWMANLEFT_START,
+ BPAT_WITHSNOWMANLEFT_LOOP,
+ BPAT_WITHSNOWMANLEFT_END,
+ BPAT_WITHSNOWMANRIGHT_START,
+ BPAT_WITHSNOWMANRIGHT_LOOP,
+ BPAT_WITHSNOWMANRIGHT_END,
+
+ BPAT_WITHNOTEBOOKLEFT_START,
+ BPAT_WITHNOTEBOOKLEFT_LOOP,
+ BPAT_WITHNOTEBOOKLEFT_END,
+ BPAT_WITHNOTEBOOKRIGHT_START,
+ BPAT_WITHNOTEBOOKRIGHT_LOOP,
+ BPAT_WITHNOTEBOOKRIGHT_END,
+
+ BPAT_WITHMEGAPHONELEFT_START,
+ BPAT_WITHMEGAPHONELEFT_LOOP,
+ BPAT_WITHMEGAPHONELEFT_END,
+ BPAT_WITHMEGAPHONERIGHT_START,
+ BPAT_WITHMEGAPHONERIGHT_LOOP,
+ BPAT_WITHMEGAPHONERIGHT_END,
+
+ BPAT_WITHBEARDLEFT_START,
+ BPAT_WITHBEARDLEFT_END,
+ BPAT_WITHBEARDRIGHT_START,
+ BPAT_WITHBEARDRIGHT_END,
+ BPAT_WITHBEARDLEFT_STATIC,
+ BPAT_WITHBEARDRIGHT_STATIC,
+
+ BPAT_MACBETH1,
+ BPAT_MACBETH2,
+ BPAT_MACBETH3,
+ BPAT_MACBETH4,
+ BPAT_MACBETH5,
+ BPAT_MACBETH6,
+ BPAT_MACBETH7,
+ BPAT_MACBETH8,
+ BPAT_MACBETH9,
+
+ BPAT_WITHSECRETARY
+ };
+
+public:
+ static void initStatics();
+ RMTony();
+
+ /**
+ * Initialize Tony
+ */
+ void init();
+
+ /**
+ * Free all memory
+ */
+ void close();
+
+ /**
+ * Tony makes a frame, updating the movement, etc.
+ */
+ void doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int curLoc);
+
+ /**
+ * Draw method, which controls chararacter display
+ */
+ virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ /**
+ * Show or hide
+ */
+ void show();
+ void hide(bool bShowShadow = false);
+
+ /**
+ * Move and make an action, if necessary
+ */
+ void moveAndDoAction(CORO_PARAM, RMPoint dst, RMItem *item, int nAction, int nActionParm = 0);
+
+ /**
+ * Tony stops (on the right side with respect to any subject)
+ */
+ virtual void stop(CORO_PARAM);
+ void stopNoAction(CORO_PARAM);
+
+ /**
+ * Set a pattern
+ */
+ void setPattern(int npatt, bool bPlayP0 = false);
+
+ /**
+ * Reads the current pattern
+ */
+ int getCurPattern();
+
+ /**
+ * Waits until the end of a pattern
+ */
+ void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE);
+
+ /**
+ * Check if currently in an action
+ */
+ bool inAction();
+
+ /**
+ * Check if there needs to be an update for scrolling movement
+ */
+ bool mustUpdateScrolling();
+
+ /**
+ * Returns Tony's position
+ */
+ RMPoint position();
+
+ /**
+ * Set the scrolling position
+ */
+ void setScrollPosition(const RMPoint &pt);
+
+ /**
+ * Set the take animation
+ */
+ void take(int nWhere, int nPart);
+ void put(int nWhere, int nPart);
+
+ /**
+ * Start or End Talk
+ */
+ bool startTalkCalculate(CharacterTalkType nTalkType, int &headStartPat, int &bodyStartPat,
+ int &headLoopPat, int &bodyLoopPat);
+ void startTalk(CORO_PARAM, CharacterTalkType nTalkType);
+ bool endTalkCalculate(int &headStandPat, int &headEndPat, int &bodyEndPat, int &finalPat, bool &bStatic);
+ void endTalk(CORO_PARAM);
+
+ /**
+ * Start or End Static
+ */
+ void startStaticCalculate(CharacterTalkType nTalk, int &headPat, int &headLoopPat,
+ int &bodyStartPat, int &bodyLoopPat);
+ void startStatic(CORO_PARAM, CharacterTalkType nTalkType);
+ void endStaticCalculate(CharacterTalkType nTalk, int &bodyEndPat, int &finalPat, int &headEndPat);
+ void endStatic(CORO_PARAM, CharacterTalkType nTalkType);
+
+ /**
+ * Tony disguises himself!
+ */
+ void setShepherdess(bool bIsPast);
+
+ int getShepherdess();
+
+ /**
+ * Perform an action
+ */
+ void executeAction(int nAction, int nActionItem, int nParm);
+
+ void playSfx(int nSfx);
+};
+
+} // End of namespace Tony
+
+#endif
diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp
new file mode 100644
index 0000000000..81060146b7
--- /dev/null
+++ b/engines/tony/utils.cpp
@@ -0,0 +1,448 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "tony/utils.h"
+#include "tony/tony.h"
+#include "tony/mpal/lzo.h"
+
+namespace Tony {
+
+/**
+ * Extracts a string from a data stream
+ * @param df data stream
+ */
+Common::String readString(Common::ReadStream &df) {
+ Common::String var;
+ uint8 len = df.readByte();
+
+ for (int i = 0; i < len; i++) {
+ char c;
+ c = df.readByte();
+ var += c;
+ }
+
+ return var;
+}
+
+/****************************************************************************\
+* RMPoint methods
+\****************************************************************************/
+
+/**
+ * Constructor
+ */
+RMPoint::RMPoint() {
+ _x = _y = 0;
+}
+
+/**
+ * Copy constructor
+ */
+RMPoint::RMPoint(const RMPoint &p) {
+ _x = p._x;
+ _y = p._y;
+}
+
+/**
+ * Constructor with integer parameters
+ */
+RMPoint::RMPoint(int x1, int y1) {
+ _x = x1;
+ _y = y1;
+}
+
+/**
+ * Copy operator
+ */
+RMPoint &RMPoint::operator=(RMPoint p) {
+ _x = p._x;
+ _y = p._y;
+
+ return *this;
+}
+
+/**
+ * Set a point
+ */
+void RMPoint::set(int x1, int y1) {
+ _x = x1;
+ _y = y1;
+}
+
+/**
+ * Offsets the point by another point
+ */
+void RMPoint::offset(const RMPoint &p) {
+ _x += p._x;
+ _y += p._y;
+}
+
+/**
+ * Offsets the point by a specified offset
+ */
+void RMPoint::offset(int xOff, int yOff) {
+ _x += xOff;
+ _y += yOff;
+}
+
+/**
+ * Sums together two points
+ */
+RMPoint operator+(RMPoint p1, RMPoint p2) {
+ RMPoint p(p1);
+
+ return (p += p2);
+}
+
+/**
+ * Subtracts two points
+ */
+RMPoint operator-(RMPoint p1, RMPoint p2) {
+ RMPoint p(p1);
+
+ return (p -= p2);
+}
+
+/**
+ * Sum (offset) of a point
+ */
+RMPoint &RMPoint::operator+=(RMPoint p) {
+ offset(p);
+ return *this;
+}
+
+/**
+ * Subtract (offset) of a point
+ */
+RMPoint &RMPoint::operator-=(RMPoint p) {
+ offset(-p);
+ return *this;
+}
+
+/**
+ * Inverts a point
+ */
+RMPoint RMPoint::operator-() {
+ RMPoint p;
+
+ p._x = -_x;
+ p._y = -_y;
+
+ return p;
+}
+
+/**
+ * Equality operator
+ */
+bool RMPoint::operator==(RMPoint p) {
+ return ((_x == p._x) && (_y == p._y));
+}
+
+/**
+ * Not equal operator
+ */
+bool RMPoint::operator!=(RMPoint p) {
+ return ((_x != p._x) || (_y != p._y));
+}
+
+/**
+ * Reads a point from a stream
+ */
+void RMPoint::readFromStream(Common::ReadStream &ds) {
+ _x = ds.readSint32LE();
+ _y = ds.readSint32LE();
+}
+
+/****************************************************************************\
+* RMPointReference methods
+\****************************************************************************/
+
+RMPointReference::RMPointReference(int &x, int &y): _x(x), _y(y) {
+}
+
+RMPointReference &RMPointReference::operator=(const RMPoint &p) {
+ _x = p._x; _y = p._y;
+ return *this;
+}
+
+RMPointReference &RMPointReference::operator-=(const RMPoint &p) {
+ _x -= p._x; _y -= p._y;
+ return *this;
+}
+
+RMPointReference::operator RMPoint() const {
+ return RMPoint(_x, _y);
+}
+
+/****************************************************************************\
+* RMRect methods
+\****************************************************************************/
+
+RMRect::RMRect(): _topLeft(_x1, _y1), _bottomRight(_x2, _y2) {
+ setEmpty();
+}
+
+void RMRect::setEmpty() {
+ _x1 = _y1 = _x2 = _y2 = 0;
+}
+
+RMRect::RMRect(const RMPoint &p1, const RMPoint &p2): _topLeft(_x1, _y1), _bottomRight(_x2, _y2) {
+ setRect(p1, p2);
+}
+
+RMRect::RMRect(int X1, int Y1, int X2, int Y2): _topLeft(_x1, _y1), _bottomRight(_x2, _y2) {
+ setRect(X1, Y1, X2, Y2);
+}
+
+RMRect::RMRect(const RMRect &rc): _topLeft(_x1, _y1), _bottomRight(_x2, _y2) {
+ copyRect(rc);
+}
+
+void RMRect::setRect(const RMPoint &p1, const RMPoint &p2) {
+ _x1 = p1._x;
+ _y1 = p1._y;
+ _x2 = p2._x;
+ _y2 = p2._y;
+}
+
+void RMRect::setRect(int X1, int Y1, int X2, int Y2) {
+ _x1 = X1;
+ _y1 = Y1;
+ _x2 = X2;
+ _y2 = Y2;
+}
+
+void RMRect::setRect(const RMRect &rc) {
+ copyRect(rc);
+}
+
+void RMRect::copyRect(const RMRect &rc) {
+ _x1 = rc._x1;
+ _y1 = rc._y1;
+ _x2 = rc._x2;
+ _y2 = rc._y2;
+}
+
+RMPointReference &RMRect::topLeft() {
+ return _topLeft;
+}
+
+RMPointReference &RMRect::bottomRight() {
+ return _bottomRight;
+}
+
+RMPoint RMRect::center() {
+ return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2);
+}
+
+int RMRect::width() const {
+ return _x2 - _x1;
+}
+
+int RMRect::height() const {
+ return _y2 - _y1;
+}
+
+int RMRect::size() const {
+ return width() * height();
+}
+
+RMRect::operator Common::Rect() const {
+ return Common::Rect(_x1, _y1, _x2, _y2);
+}
+
+bool RMRect::isEmpty() const {
+ return (_x1 == 0 && _y1 == 0 && _x2 == 0 && _y2 == 0);
+}
+
+const RMRect &RMRect::operator=(const RMRect &rc) {
+ copyRect(rc);
+ return *this;
+}
+
+void RMRect::offset(int xOff, int yOff) {
+ _x1 += xOff;
+ _y1 += yOff;
+ _x2 += xOff;
+ _y2 += yOff;
+}
+
+void RMRect::offset(const RMPoint &p) {
+ _x1 += p._x;
+ _y1 += p._y;
+ _x2 += p._x;
+ _y2 += p._y;
+}
+
+const RMRect &RMRect::operator+=(RMPoint p) {
+ offset(p);
+ return *this;
+}
+
+const RMRect &RMRect::operator-=(RMPoint p) {
+ offset(-p);
+ return *this;
+}
+
+RMRect operator+(const RMRect &rc, RMPoint p) {
+ RMRect r(rc);
+ return (r += p);
+}
+
+RMRect operator-(const RMRect &rc, RMPoint p) {
+ RMRect r(rc);
+
+ return (r -= p);
+}
+
+RMRect operator+(RMPoint p, const RMRect &rc) {
+ RMRect r(rc);
+
+ return (r += p);
+}
+
+RMRect operator-(RMPoint p, const RMRect &rc) {
+ RMRect r(rc);
+
+ return (r += p);
+}
+
+bool RMRect::operator==(const RMRect &rc) {
+ return ((_x1 == rc._x1) && (_y1 == rc._y1) && (_x2 == rc._x2) && (_y2 == rc._y2));
+}
+
+bool RMRect::operator!=(const RMRect &rc) {
+ return ((_x1 != rc._x1) || (_y1 != rc._y1) || (_x2 != rc._x2) || (_y2 != rc._y2));
+}
+
+void RMRect::normalizeRect() {
+ setRect(MIN(_x1, _x2), MIN(_y1, _y2), MAX(_x1, _x2), MAX(_y1, _y2));
+}
+
+void RMRect::readFromStream(Common::ReadStream &ds) {
+ _x1 = ds.readSint32LE();
+ _y1 = ds.readSint32LE();
+ _x2 = ds.readSint32LE();
+ _y2 = ds.readSint32LE();
+}
+
+/**
+ * Check if RMPoint is in RMRect
+ */
+bool RMRect::ptInRect(const RMPoint &pt) {
+ return (pt._x >= _x1 && pt._x <= _x2 && pt._y >= _y1 && pt._y <= _y2);
+}
+
+/****************************************************************************\
+* Resource Update
+\****************************************************************************/
+
+RMResUpdate::RMResUpdate() {
+ _infos = NULL;
+ _numUpd = 0;
+}
+
+RMResUpdate::~RMResUpdate() {
+ if (_infos) {
+ delete[] _infos;
+ _infos = NULL;
+ }
+
+ if (_hFile.isOpen())
+ _hFile.close();
+}
+
+void RMResUpdate::init(const Common::String &fileName) {
+ // Open the resource update file
+ if (!_hFile.open(fileName))
+ // It doesn't exist, so exit immediately
+ return;
+
+ _hFile.readByte(); // Version, unused
+
+ _numUpd = _hFile.readUint32LE();
+
+ _infos = new ResUpdInfo[_numUpd];
+
+ // Load the index of the resources in the file
+ for (uint32 i = 0; i < _numUpd; ++i) {
+ ResUpdInfo &info = _infos[i];
+
+ info._dwRes = _hFile.readUint32LE();
+ info._offset = _hFile.readUint32LE();
+ info._size = _hFile.readUint32LE();
+ info._cmpSize = _hFile.readUint32LE();
+ }
+}
+
+MpalHandle RMResUpdate::queryResource(uint32 dwRes) {
+ // If there isn't an update file, return NULL
+ if (!_hFile.isOpen())
+ return NULL;
+
+ uint32 i;
+ for (i = 0; i < _numUpd; ++i)
+ if (_infos[i]._dwRes == dwRes)
+ // Found the index
+ break;
+
+ if (i == _numUpd)
+ // Couldn't find a matching resource, so return NULL
+ return NULL;
+
+ const ResUpdInfo &info = _infos[i];
+ byte *cmpBuf = new byte[info._cmpSize];
+ uint32 dwRead;
+
+ // Move to the correct offset and read in the compressed data
+ _hFile.seek(info._offset);
+ dwRead = _hFile.read(cmpBuf, info._cmpSize);
+
+ if (info._cmpSize > dwRead) {
+ // Error occurred reading data, so return NULL
+ delete[] cmpBuf;
+ return NULL;
+ }
+
+ // Allocate space for the output resource
+ MpalHandle destBuf = globalAllocate(0, info._size);
+ byte *lpDestBuf = (byte *)globalLock(destBuf);
+ uint32 dwSize;
+
+ // Decompress the data
+ lzo1x_decompress(cmpBuf, info._cmpSize, lpDestBuf, &dwSize);
+
+ // Delete buffer for compressed data
+ delete [] cmpBuf;
+
+ // Return the resource
+ globalUnlock(destBuf);
+ return destBuf;
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/utils.h b/engines/tony/utils.h
new file mode 100644
index 0000000000..9f13e5f19b
--- /dev/null
+++ b/engines/tony/utils.h
@@ -0,0 +1,176 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_UTILS_H
+#define TONY_UTILS_H
+
+#include "common/scummsys.h"
+#include "common/file.h"
+#include "common/rect.h"
+#include "common/str.h"
+#include "tony/mpal/memory.h"
+
+namespace Tony {
+
+using namespace ::Tony::MPAL;
+
+Common::String readString(Common::ReadStream &ds);
+
+/**
+ * Point class
+ */
+class RMPoint {
+public:
+ int _x, _y;
+
+public:
+ // Constructor
+ RMPoint();
+ RMPoint(const RMPoint &p);
+ RMPoint(int x1, int y1);
+
+ // Copy
+ RMPoint &operator=(RMPoint p);
+
+ // Set
+ void set(int x1, int y1);
+
+ // Offset
+ void offset(int xOff, int yOff);
+ void offset(const RMPoint &p);
+ friend RMPoint operator+(RMPoint p1, RMPoint p2);
+ friend RMPoint operator-(RMPoint p1, RMPoint p2);
+ RMPoint &operator+=(RMPoint p);
+ RMPoint &operator-=(RMPoint p);
+ RMPoint operator-();
+
+ // Comparison
+ bool operator==(RMPoint p);
+ bool operator!=(RMPoint p);
+
+ // Casting a POINT
+ operator Common::Point() const;
+
+ // Extraction from data streams
+ void readFromStream(Common::ReadStream &ds);
+};
+
+class RMPointReference {
+public:
+ int &_x;
+ int &_y;
+
+ RMPointReference(int &x, int &y);
+ RMPointReference &operator=(const RMPoint &p);
+ RMPointReference &operator-=(const RMPoint &p);
+ operator RMPoint() const;
+};
+
+class RMRect {
+public:
+ int _x1, _y1;
+ int _x2, _y2;
+ RMPointReference _topLeft;
+ RMPointReference _bottomRight;
+
+public:
+ RMRect();
+ RMRect(int x1, int y1, int x2, int y2);
+ RMRect(const RMPoint &p1, const RMPoint &p2);
+ RMRect(const RMRect &rc);
+
+ // Attributes
+ RMPointReference &topLeft();
+ RMPointReference &bottomRight();
+ RMPoint center();
+ int width() const;
+ int height() const;
+ bool isEmpty() const;
+ int size() const;
+ operator Common::Rect() const;
+
+ // Set
+ void setRect(int x1, int y1, int x2, int y2);
+ void setRect(const RMPoint &p1, const RMPoint &p2);
+ void setEmpty();
+
+ // Copiers
+ void setRect(const RMRect &rc);
+ void copyRect(const RMRect &rc);
+ const RMRect &operator=(const RMRect &rc);
+
+ // Offset
+ void offset(int xOff, int yOff);
+ void offset(const RMPoint &p);
+ friend RMRect operator+(const RMRect &rc, RMPoint p);
+ friend RMRect operator-(const RMRect &rc, RMPoint p);
+ friend RMRect operator+(RMPoint p, const RMRect &rc);
+ friend RMRect operator-(RMPoint p, const RMRect &rc);
+ const RMRect &operator+=(RMPoint p);
+ const RMRect &operator-=(RMPoint p);
+
+ // Comparison
+ bool operator==(const RMRect &rc);
+ bool operator!=(const RMRect &rc);
+
+ // Normalize
+ void normalizeRect();
+
+ // Point in rect
+ bool ptInRect(const RMPoint &pt);
+
+ // Extract from data stream
+ void readFromStream(Common::ReadStream &ds);
+};
+
+/**
+ * Resource update manager
+ */
+class RMResUpdate {
+ struct ResUpdInfo {
+ uint32 _dwRes;
+ uint32 _offset;
+ uint32 _size;
+ uint32 _cmpSize;
+ };
+
+ uint32 _numUpd;
+ ResUpdInfo *_infos;
+ Common::File _hFile;
+
+public:
+ RMResUpdate();
+ ~RMResUpdate();
+
+ void init(const Common::String &fileName);
+ MpalHandle queryResource(uint32 dwRes);
+};
+
+} // End of namespace Tony
+
+#endif /* TONY_H */
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
new file mode 100644
index 0000000000..c9c450424f
--- /dev/null
+++ b/engines/tony/window.cpp
@@ -0,0 +1,336 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#include "common/scummsys.h"
+#include "graphics/surface.h"
+#include "util.h"
+#include "tony/window.h"
+#include "tony/game.h"
+#include "tony/tony.h"
+
+namespace Tony {
+
+
+/****************************************************************************\
+* RMWindow Methods
+\****************************************************************************/
+
+RMWindow::RMWindow() {
+ _showDirtyRects = false;
+}
+
+RMWindow::~RMWindow() {
+ close();
+ RMText::unload();
+ RMGfxTargetBuffer::freeBWPrecalcTable();
+}
+
+/**
+ * Initializes the graphics window
+ */
+void RMWindow::init() {
+ Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
+ initGraphics(RM_SX, RM_SY, true, &pixelFormat);
+
+ _bGrabScreenshot = false;
+ _bGrabThumbnail = false;
+ _bGrabMovie = false;
+ _wiping = false;
+}
+
+void RMWindow::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+ if (GLOBALS._bCfgAnni30) {
+ if (!RMGfxTargetBuffer::_precalcTable) {
+ RMGfxTargetBuffer::createBWPrecalcTable();
+ g_vm->getEngine()->getPointer().updateCursor();
+ }
+ Graphics::Surface *screen = g_system->lockScreen();
+ const uint16 *src = (const uint16 *)buf;
+ for (int i = 0; i < h; i++) {
+ uint16 *dst = (uint16 *)screen->getBasePtr(x, y + i);
+ for (int j = 0; j < w; j++) {
+ dst[j] = RMGfxTargetBuffer::_precalcTable[src[j] & 0x7FFF];
+ }
+ src += (pitch / 2);
+ }
+ g_system->unlockScreen();
+ } else {
+ if (RMGfxTargetBuffer::_precalcTable) {
+ RMGfxTargetBuffer::freeBWPrecalcTable();
+ g_vm->getEngine()->getPointer().updateCursor();
+ }
+ g_system->copyRectToScreen(buf, pitch, x, y, w, h);
+ }
+ }
+
+/**
+ * Close the window
+ */
+void RMWindow::close() {
+}
+
+void RMWindow::grabThumbnail(uint16 *thumbmem) {
+ _bGrabThumbnail = true;
+ _wThumbBuf = thumbmem;
+}
+
+/**
+ * Repaint the screen
+ */
+void RMWindow::repaint() {
+ g_system->updateScreen();
+}
+
+/**
+ * Wipes an area of the screen
+ */
+void RMWindow::wipeEffect(Common::Rect &rcBoundEllipse) {
+ if ((rcBoundEllipse.left == 0) && (rcBoundEllipse.top == 0) &&
+ (rcBoundEllipse.right == RM_SX) && (rcBoundEllipse.bottom == RM_SY)) {
+ // Full screen clear wanted, so use shortcut method
+ g_system->fillScreen(0);
+ } else {
+ // Clear the designated area a line at a time
+ uint16 line[RM_SX];
+ Common::fill(line, line + RM_SX, 0);
+
+ // Loop through each line
+ for (int yp = rcBoundEllipse.top; yp < rcBoundEllipse.bottom; ++yp) {
+ copyRectToScreen((const byte *)&line[0], RM_SX * 2, rcBoundEllipse.left, yp, rcBoundEllipse.width(), 1);
+ }
+ }
+}
+
+void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllipse) {
+ // Get a pointer to the bytes of the source buffer
+ byte *lpBuf = bigBuf;
+
+ if (rcBoundEllipse != NULL) {
+ // Circular wipe effect
+ getNewFrameWipe(lpBuf, *rcBoundEllipse);
+ _wiping = true;
+ } else if (_wiping) {
+ // Just finished a wiping effect, so copy the full screen
+ copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
+ _wiping = false;
+
+ } else {
+ // Standard screen copy - iterate through the dirty rects
+ Common::List<Common::Rect> dirtyRects = bigBuf.getDirtyRects();
+ Common::List<Common::Rect>::iterator i;
+
+ // If showing dirty rects, copy the entire screen background and set up a surface pointer
+ Graphics::Surface *s = NULL;
+ if (_showDirtyRects) {
+ copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
+ s = g_system->lockScreen();
+ }
+
+ for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
+ Common::Rect &r = *i;
+ const byte *lpSrc = lpBuf + (RM_SX * 2) * r.top + (r.left * 2);
+ copyRectToScreen(lpSrc, RM_SX * 2, r.left, r.top, r.width(), r.height());
+ }
+
+ if (_showDirtyRects) {
+ for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
+ // Frame the copied area with a rectangle
+ s->frameRect(*i, 0xffffff);
+ }
+
+ g_system->unlockScreen();
+ }
+ }
+
+ if (_bGrabThumbnail) {
+ // Need to generate a thumbnail
+ RMSnapshot s;
+
+ s.grabScreenshot(lpBuf, 4, _wThumbBuf);
+ _bGrabThumbnail = false;
+ }
+
+ // Clear the dirty rect list
+ bigBuf.clearDirtyRects();
+}
+
+/**
+ * Copies a section of the game frame in a circle bounded by the specified rectangle
+ */
+void RMWindow::getNewFrameWipe(byte *lpBuf, Common::Rect &rcBoundEllipse) {
+ // Clear the screen
+ g_system->fillScreen(0);
+
+ if (!rcBoundEllipse.isValidRect())
+ return;
+
+ Common::Point center(rcBoundEllipse.left + rcBoundEllipse.width() / 2,
+ rcBoundEllipse.top + rcBoundEllipse.height() / 2);
+
+ // The rectangle technically defines the area inside the ellipse, with the corners touching
+ // the ellipse boundary. Since we're currently simulating the ellipse using a plain circle,
+ // we need to calculate a necessary width using the hypotenuse of X/2 & Y/2
+ int x2y2 = (rcBoundEllipse.width() / 2) * (rcBoundEllipse.width() / 2) +
+ (rcBoundEllipse.height() / 2) * (rcBoundEllipse.height() / 2);
+ int radius = 0;
+ while ((radius * radius) < x2y2)
+ ++radius;
+
+ // Proceed copying a circular area of the frame with the calculated radius onto the screen
+ int error = -radius;
+ int x = radius;
+ int y = 0;
+
+ while (x >= y) {
+ plotSplices(lpBuf, center, x, y);
+
+ error += y;
+ ++y;
+ error += y;
+
+ if (error >= 0) {
+ error -= x;
+ --x;
+ error -= x;
+ }
+ }
+}
+
+/**
+ * Handles drawing the line splices for the circle of viewable area
+ */
+void RMWindow::plotSplices(const byte *lpBuf, const Common::Point &center, int x, int y) {
+ plotLines(lpBuf, center, x, y);
+ if (x != y)
+ plotLines(lpBuf, center, y, x);
+}
+
+/**
+ * Handles drawing the line splices for the circle of viewable area
+ */
+void RMWindow::plotLines(const byte *lpBuf, const Common::Point &center, int x, int y) {
+ // Skips lines that have no width (i.e. at the top of the circle)
+ if ((x == 0) || (y > center.y))
+ return;
+
+ const byte *pSrc;
+ int xs = MAX(center.x - x, 0);
+ int width = MIN(RM_SX - xs, x * 2);
+
+ if ((center.y - y) >= 0) {
+ // Draw line in top half of circle
+ pSrc = lpBuf + ((center.y - y) * RM_SX * 2) + xs * 2;
+ copyRectToScreen(pSrc, RM_SX * 2, xs, center.y - y, width, 1);
+ }
+
+ if ((center.y + y) < RM_SY) {
+ // Draw line in bottom half of circle
+ pSrc = lpBuf + ((center.y + y) * RM_SX * 2) + xs * 2;
+ copyRectToScreen(pSrc, RM_SX * 2, xs, center.y + y, width, 1);
+ }
+}
+
+void RMWindow::showDirtyRects(bool v) {
+ _showDirtyRects = v;
+}
+
+/****************************************************************************\
+* RMSnapshot Methods
+\****************************************************************************/
+
+void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) {
+ uint16 *src = (uint16 *)lpBuf;
+
+ int dimx = RM_SX / dezoom;
+ int dimy = RM_SY / dezoom;
+
+ uint16 *cursrc;
+
+ if (lpDestBuf == NULL)
+ src += (RM_SY - 1) * RM_BBX;
+
+ if (dezoom == 1 && 0) {
+ byte *curOut = _rgb;
+
+ for (int y = 0; y < dimy; y++) {
+ for (int x = 0; x < dimx; x++) {
+ cursrc = &src[RM_SKIPX + x];
+
+ *curOut++ = ((*cursrc) & 0x1F) << 3;
+ *curOut++ = (((*cursrc) >> 5) & 0x1F) << 3;
+ *curOut++ = (((*cursrc) >> 10) & 0x1F) << 3;
+
+ if (lpDestBuf)
+ *lpDestBuf++ = *cursrc;
+ }
+
+ if (lpDestBuf == NULL)
+ src -= RM_BBX;
+ else
+ src += RM_BBX;
+ }
+ } else {
+ uint32 k = 0;
+ for (int y = 0; y < dimy; y++) {
+ for (int x = 0; x < dimx; x++) {
+ cursrc = &src[RM_SKIPX + x * dezoom];
+ int sommar, sommab, sommag, curv;
+ sommar = sommab = sommag = 0;
+
+ for (int v = 0; v < dezoom; v++) {
+ for (int u = 0; u < dezoom; u++) {
+ if (lpDestBuf == NULL)
+ curv = -v;
+ else
+ curv = v;
+
+ sommab += cursrc[curv * RM_BBX + u] & 0x1F;
+ sommag += (cursrc[curv * RM_BBX + u] >> 5) & 0x1F;
+ sommar += (cursrc[curv * RM_BBX + u] >> 10) & 0x1F;
+ }
+ }
+ _rgb[k + 0] = (byte)(sommab * 8 / (dezoom * dezoom));
+ _rgb[k + 1] = (byte)(sommag * 8 / (dezoom * dezoom));
+ _rgb[k + 2] = (byte)(sommar * 8 / (dezoom * dezoom));
+
+ if (lpDestBuf != NULL)
+ lpDestBuf[k / 3] = ((int)_rgb[k + 0] >> 3) | (((int)_rgb[k + 1] >> 3) << 5) |
+ (((int)_rgb[k + 2] >> 3) << 10);
+
+ k += 3;
+ }
+
+ if (lpDestBuf == NULL)
+ src -= RM_BBX * dezoom;
+ else
+ src += RM_BBX * dezoom;
+ }
+ }
+}
+
+} // End of namespace Tony
diff --git a/engines/tony/window.h b/engines/tony/window.h
new file mode 100644
index 0000000000..2e8769707f
--- /dev/null
+++ b/engines/tony/window.h
@@ -0,0 +1,98 @@
+/* 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 code is based on original Tony Tough source code
+ *
+ * Copyright (c) 1997-2003 Nayma Software
+ */
+
+#ifndef TONY_WINDOW_H
+#define TONY_WINDOW_H
+
+#include "common/scummsys.h"
+#include "common/rect.h"
+#include "tony/game.h"
+
+namespace Tony {
+
+class RMSnapshot {
+private:
+ // Buffer used to convert to RGB
+ byte _rgb[RM_SX *RM_SY * 3];
+public:
+ /**
+ * Take a screenshot
+ */
+ void grabScreenshot(byte *lpBuf, int dezoom = 1, uint16 *lpDestBuf = NULL);
+};
+
+
+class RMWindow {
+private:
+ void plotSplices(const byte *lpBuf, const Common::Point &center, int x, int y);
+ void plotLines(const byte *lpBuf, const Common::Point &center, int x, int y);
+
+protected:
+ bool _wiping;
+ bool _showDirtyRects;
+
+ bool _bGrabScreenshot;
+ bool _bGrabThumbnail;
+ bool _bGrabMovie;
+ uint16 *_wThumbBuf;
+
+ void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ void wipeEffect(Common::Rect &rcBoundEllipse);
+ void getNewFrameWipe(byte *lpBuf, Common::Rect &rcBoundEllipse);
+
+public:
+ RMWindow();
+ ~RMWindow();
+
+ /**
+ * Initialization
+ */
+ void init();
+ void close();
+
+ /**
+ * Drawing
+ */
+ void repaint();
+
+ /**
+ * Reads the next frame
+ */
+ void getNewFrame(RMGfxTargetBuffer &lpBuf, Common::Rect *rcBoundEllipse);
+
+ /**
+ * Request a thumbnail be grabbed during the next frame
+ */
+ void grabThumbnail(uint16 *buf);
+
+ void showDirtyRects(bool v);
+};
+
+} // End of namespace Tony
+
+#endif /* TONY_WINDOW_H */
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 98c667c303..1c85a8d798 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -132,7 +132,7 @@ Common::Rect Animation::getRect() {
return Common::Rect(_x1, _y1, _x2, _y2);
}
-void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy) {
+void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy) {
debugC(3, kDebugAnim, "drawFrame(surface, %d, %d, %d)", frame, xx, yy);
if (frame < 0)
frame = 0;
@@ -146,10 +146,13 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int
if (_frames[frame]._ref != -1)
frame = _frames[frame]._ref;
- int32 rectX = _frames[frame]._x2 - _frames[frame]._x1;
- int32 rectY = _frames[frame]._y2 - _frames[frame]._y1;
- int32 offsX = 0;
- int32 offsY = 0;
+ if (!_frames[frame]._data)
+ return;
+
+ int16 rectX = _frames[frame]._x2 - _frames[frame]._x1;
+ int16 rectY = _frames[frame]._y2 - _frames[frame]._y1;
+ int16 offsX = 0;
+ int16 offsY = 0;
_vm->addDirtyRect(xx + _x1 + _frames[frame]._x1, yy + _y1 + _frames[frame]._y1, xx + rectX + _x1 + _frames[frame]._x1 , yy + rectY + _y1 + _frames[frame]._y1);
@@ -186,10 +189,10 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int
int32 destPitch = surface.pitch;
uint8 *srcRow = _frames[frame]._data + offsX + (_frames[frame]._x2 - _frames[frame]._x1) * offsY;
uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1 + offsY) * destPitch + (xx + _x1 + _frames[frame]._x1 + offsX);
- for (int32 y = 0; y < rectY; y++) {
+ for (int16 y = 0; y < rectY; y++) {
uint8 *cur = curRow;
uint8 *c = srcRow + y * (_frames[frame]._x2 - _frames[frame]._x1);
- for (int32 x = 0; x < rectX; x++) {
+ for (int16 x = 0; x < rectX; x++) {
if (*c)
*cur = *c;
c++;
@@ -199,27 +202,27 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int
}
}
-void Animation::drawFrameWithMask(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask) {
+void Animation::drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask) {
debugC(1, kDebugAnim, "drawFrameWithMask(surface, %d, %d, %d, %d, mask)", frame, xx, yy, zz);
warning("STUB: drawFrameWithMask()");
}
-void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask, int32 scale) {
+void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale) {
debugC(5, kDebugAnim, "drawFrameWithMaskAndScale(surface, %d, %d, %d, %d, mask, %d)", frame, xx, yy, zz, scale);
if (_frames[frame]._ref != -1)
frame = _frames[frame]._ref;
- int32 rectX = _frames[frame]._x2 - _frames[frame]._x1;
- int32 rectY = _frames[frame]._y2 - _frames[frame]._y1;
+ int16 rectX = _frames[frame]._x2 - _frames[frame]._x1;
+ int16 rectY = _frames[frame]._y2 - _frames[frame]._y1;
- int32 finalWidth = rectX * scale / 1024;
- int32 finalHeight = rectY * scale / 1024;
+ int16 finalWidth = rectX * scale / 1024;
+ int16 finalHeight = rectY * scale / 1024;
// compute final x1, y1, x2, y2
- int32 xx1 = xx + _x1 + _frames[frame]._x1 * scale / 1024;
- int32 yy1 = yy + _y1 + _frames[frame]._y1 * scale / 1024;
- int32 xx2 = xx1 + finalWidth;
- int32 yy2 = yy1 + finalHeight;
- int32 w = _frames[frame]._x2 - _frames[frame]._x1;
+ int16 xx1 = xx + _x1 + _frames[frame]._x1 * scale / 1024;
+ int16 yy1 = yy + _y1 + _frames[frame]._y1 * scale / 1024;
+ int16 xx2 = xx1 + finalWidth;
+ int16 yy2 = yy1 + finalHeight;
+ int16 w = _frames[frame]._x2 - _frames[frame]._x1;
_vm->addDirtyRect(xx1, yy1, xx2, yy2);
@@ -229,37 +232,26 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram
uint8 *curRow = (uint8 *)surface.pixels;
uint8 *curRowMask = mask->getDataPtr();
- if (strstr(_name, "SHADOW")) {
- for (int y = yy1; y < yy2; y++) {
- for (int x = xx1; x < xx2; x++) {
- if (x < 0 || x >= 1280 || y < 0 || y >= 400)
- continue;
+ bool shadowFlag = false;
+ if (strstr(_name, "SHADOW"))
+ shadowFlag = true;
+
+ for (int16 y = yy1; y < yy2; y++) {
+ for (int16 x = xx1; x < xx2; x++) {
+ if (x < 0 || x >= 1280 || y < 0 || y >= 400)
+ continue;
- uint8 *cur = curRow + x + y * destPitch;
- uint8 *curMask = curRowMask + x + y * destPitchMask;
+ uint8 *cur = curRow + x + y * destPitch;
+ uint8 *curMask = curRowMask + x + y * destPitchMask;
- // find the good c
- int32 xs = (x - xx1) * 1024 / scale;
- int32 ys = (y - yy1) * 1024 / scale;
- uint8 *cc = &c[ys * w + xs];
- if (*cc && ((*curMask) >= zz))
+ // find the good c
+ int16 xs = (x - xx1) * 1024 / scale;
+ int16 ys = (y - yy1) * 1024 / scale;
+ uint8 *cc = &c[ys * w + xs];
+ if (*cc && ((*curMask) >= zz)) {
+ if (shadowFlag)
*cur = _vm->getShadowLUT()[*cur];
- }
- }
- } else {
- for (int y = yy1; y < yy2; y++) {
- for (int x = xx1; x < xx2; x++) {
- if (x < 0 || x >= 1280 || y < 0 || y >= 400)
- continue;
-
- uint8 *cur = curRow + x + y * destPitch;
- uint8 *curMask = curRowMask + x + y * destPitchMask;
-
- // find the good c
- int32 xs = (x - xx1) * 1024 / scale;
- int32 ys = (y - yy1) * 1024 / scale;
- uint8 *cc = &c[ys * w + xs];
- if (*cc && ((*curMask) >= zz))
+ else
*cur = *cc;
}
}
@@ -283,7 +275,7 @@ Common::Rect Animation::getFrameRect(int32 frame) {
return Common::Rect(_frames[frame]._x1, _frames[frame]._y1, _frames[frame]._x2, _frames[frame]._y2);
}
-int32 Animation::getFrameWidth(int32 frame) {
+int16 Animation::getFrameWidth(int32 frame) {
debugC(4, kDebugAnim, "getFrameWidth(%d)", frame);
if ((frame < 0) || (frame >= _numFrames))
return 0;
@@ -294,7 +286,7 @@ int32 Animation::getFrameWidth(int32 frame) {
return _frames[frame]._x2 - _frames[frame]._x1;
}
-int32 Animation::getFrameHeight(int32 frame) {
+int16 Animation::getFrameHeight(int32 frame) {
debugC(4, kDebugAnim, "getFrameHeight(%d)", frame);
if (frame < 0 || frame >= _numFrames)
return 0;
@@ -305,15 +297,15 @@ int32 Animation::getFrameHeight(int32 frame) {
return _frames[frame]._y2 - _frames[frame]._y1;
}
-int32 Animation::getWidth() const {
+int16 Animation::getWidth() const {
return _x2 - _x1;
}
-int32 Animation::getHeight() const {
+int16 Animation::getHeight() const {
return _y2 - _y1;
}
-void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, byte *colorMap) {
+void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, byte *colorMap) {
debugC(4, kDebugAnim, "drawFontFrame(surface, %d, %d, %d, colorMap)", frame, xx, yy);
if (frame < 0)
frame = 0;
@@ -327,8 +319,8 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx,
if (_frames[frame]._ref != -1)
frame = _frames[frame]._ref;
- int32 rectX = _frames[frame]._x2 - _frames[frame]._x1;
- int32 rectY = _frames[frame]._y2 - _frames[frame]._y1;
+ int16 rectX = _frames[frame]._x2 - _frames[frame]._x1;
+ int16 rectY = _frames[frame]._y2 - _frames[frame]._y1;
if ((xx + _x1 + _frames[frame]._x1 < 0) || (yy + _y1 + _frames[frame]._y1 < 0))
return;
@@ -348,9 +340,9 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx,
int32 destPitch = surface.pitch;
uint8 *c = _frames[frame]._data;
uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1) * destPitch + (xx + _x1 + _frames[frame]._x1);
- for (int32 y = 0; y < rectY; y++) {
+ for (int16 y = 0; y < rectY; y++) {
unsigned char *cur = curRow;
- for (int32 x = 0; x < rectX; x++) {
+ for (int16 x = 0; x < rectX; x++) {
if (*c && *c < 4)
*cur = colorMap[*c];
c++;
@@ -360,7 +352,7 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx,
}
}
-void Animation::drawFrameOnPicture(int32 frame, int32 xx, int32 yy) {
+void Animation::drawFrameOnPicture(int32 frame, int16 xx, int16 yy) {
debugC(1, kDebugAnim, "drawFrameOnPicture(%d, %d, %d)", frame, xx, yy);
if (frame < 0)
frame = 0;
@@ -374,8 +366,8 @@ void Animation::drawFrameOnPicture(int32 frame, int32 xx, int32 yy) {
if (_frames[frame]._ref != -1)
frame = _frames[frame]._ref;
- int32 rectX = _frames[frame]._x2 - _frames[frame]._x1;
- int32 rectY = _frames[frame]._y2 - _frames[frame]._y1;
+ int16 rectX = _frames[frame]._x2 - _frames[frame]._x1;
+ int16 rectY = _frames[frame]._y2 - _frames[frame]._y1;
Picture *pic = _vm->getPicture();
@@ -397,9 +389,9 @@ void Animation::drawFrameOnPicture(int32 frame, int32 xx, int32 yy) {
int32 destPitch = pic->getWidth();
uint8 *c = _frames[frame]._data;
uint8 *curRow = (uint8 *)pic->getDataPtr() + (yy + _frames[frame]._y1 + _y1) * destPitch + (xx + _x1 + _frames[frame]._x1);
- for (int32 y = 0; y < rectY; y++) {
+ for (int16 y = 0; y < rectY; y++) {
unsigned char *cur = curRow;
- for (int32 x = 0; x < rectX; x++) {
+ for (int16 x = 0; x < rectX; x++) {
if (*c)
*cur = *c;
c++;
@@ -466,8 +458,8 @@ void AnimationInstance::render() {
if (frame >= _animation->_numFrames)
frame = _animation->_numFrames - 1;
- int32 x = _x;
- int32 y = _y;
+ int16 x = _x;
+ int16 y = _y;
if (_alignBottom) {
int32 offsetX = (_animation->_x2 - _animation->_x1) / 2 * (_scale - 1024);
@@ -509,7 +501,7 @@ void AnimationInstance::setAnimation(Animation *animation, bool setRange) {
}
}
-void AnimationInstance::setAnimationRange(int32 rangeStart, int rangeEnd) {
+void AnimationInstance::setAnimationRange(int32 rangeStart, int32 rangeEnd) {
debugC(5, kDebugAnim, "setAnimationRange(%d, %d)", rangeStart, rangeEnd);
_rangeStart = rangeStart;
_rangeEnd = rangeEnd;
@@ -521,7 +513,7 @@ void AnimationInstance::setAnimationRange(int32 rangeStart, int rangeEnd) {
_currentFrame = _rangeEnd;
}
-void AnimationInstance::setPosition(int32 x, int32 y, int32 z, bool relative) {
+void AnimationInstance::setPosition(int16 x, int16 y, int32 z, bool relative) {
debugC(5, kDebugAnim, "setPosition(%d, %d, %d, %d)", x, y, z, (relative) ? 1 : 0);
if (relative || !_animation) {
_x = x;
@@ -534,7 +526,7 @@ void AnimationInstance::setPosition(int32 x, int32 y, int32 z, bool relative) {
}
}
-void AnimationInstance::moveRelative(int32 dx, int32 dy, int32 dz) {
+void AnimationInstance::moveRelative(int16 dx, int16 dy, int32 dz) {
debugC(1, kDebugAnim, "moveRelative(%d, %d, %d)", dx, dy, dz);
_x += dx;
_y += dy;
@@ -579,13 +571,13 @@ void AnimationInstance::setUseMask(bool useMask) {
_useMask = useMask;
}
-void AnimationInstance::getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) const {
+void AnimationInstance::getRect(int16 *x1, int16 *y1, int16 *x2, int16 *y2) const {
debugC(5, kDebugAnim, "getRect(%d, %d, %d, %d)", *x1, *y1, *x2, *y2);
- int32 rectX = _animation->_frames[_currentFrame]._x2 - _animation->_frames[_currentFrame]._x1;
- int32 rectY = _animation->_frames[_currentFrame]._y2 - _animation->_frames[_currentFrame]._y1;
+ int16 rectX = _animation->_frames[_currentFrame]._x2 - _animation->_frames[_currentFrame]._x1;
+ int16 rectY = _animation->_frames[_currentFrame]._y2 - _animation->_frames[_currentFrame]._y1;
- int32 finalWidth = rectX * _scale / 1024;
- int32 finalHeight = rectY * _scale / 1024;
+ int16 finalWidth = rectX * _scale / 1024;
+ int16 finalHeight = rectY * _scale / 1024;
// compute final x1, y1, x2, y2
*x1 = _x + _animation->_x1 + _animation->_frames[_currentFrame]._x1 * _scale / 1024;
@@ -594,7 +586,7 @@ void AnimationInstance::getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) cons
*y2 = *y1 + finalHeight;
}
-void AnimationInstance::setX(int32 x, bool relative) {
+void AnimationInstance::setX(int16 x, bool relative) {
debugC(1, kDebugAnim, "setX(%d, %d)", x, (relative) ? 1 : 0);
if (relative || !_animation)
_x = x;
@@ -602,7 +594,7 @@ void AnimationInstance::setX(int32 x, bool relative) {
_x = x - _animation->_x1;
}
-void AnimationInstance::setY(int32 y, bool relative) {
+void AnimationInstance::setY(int16 y, bool relative) {
debugC(1, kDebugAnim, "setY(%d, %d)", y, (relative) ? 1 : 0);
if (relative || !_animation)
_y = y;
@@ -625,11 +617,11 @@ int32 AnimationInstance::getLayerZ() const {
return _layerZ;
}
-int32 AnimationInstance::getX2() const {
+int16 AnimationInstance::getX2() const {
return _x + _animation->_x1;
}
-int32 AnimationInstance::getY2() const {
+int16 AnimationInstance::getY2() const {
return _y + _animation->_y1;
}
@@ -658,6 +650,7 @@ void AnimationInstance::save(Common::WriteStream *stream) {
stream->writeSint32LE(_visible);
stream->writeSint32LE(_useMask);
}
+
void AnimationInstance::load(Common::ReadStream *stream) {
_currentFrame = stream->readSint32LE();
_currentTime = stream->readSint32LE();
@@ -706,14 +699,13 @@ void AnimationManager::updateInstance(AnimationInstance* instance) {
}
void AnimationManager::addInstance(AnimationInstance *instance) {
-
// if the instance already exists, we skip the add
for (uint32 i = 0; i < _instances.size(); i++) {
if (_instances[i] == instance)
return;
}
- int found = -1;
+ int32 found = -1;
// here we now do an ordered insert (closer to the original game)
for (uint32 i = 0; i < _instances.size(); i++) {
@@ -723,11 +715,10 @@ void AnimationManager::addInstance(AnimationInstance *instance) {
}
}
- if ( found == -1 ) {
+ if (found == -1)
_instances.push_back(instance);
- } else {
+ else
_instances.insert_at(found, instance);
- }
}
void AnimationManager::removeInstance(AnimationInstance *instance) {
diff --git a/engines/toon/anim.h b/engines/toon/anim.h
index eb8dcbd600..cd550b2621 100644
--- a/engines/toon/anim.h
+++ b/engines/toon/anim.h
@@ -36,10 +36,10 @@ class Picture;
class ToonEngine;
struct AnimationFrame {
- int32 _x1;
- int32 _y1;
- int32 _x2;
- int32 _y2;
+ int16 _x1;
+ int16 _y1;
+ int16 _x2;
+ int16 _y2;
int32 _ref;
uint8 *_data;
};
@@ -49,10 +49,10 @@ public:
Animation(ToonEngine *vm);
~Animation();
- int32 _x1;
- int32 _y1;
- int32 _x2;
- int32 _y2;
+ int16 _x1;
+ int16 _y1;
+ int16 _x2;
+ int16 _y2;
int32 _numFrames;
int32 _fps;
AnimationFrame *_frames;
@@ -61,18 +61,18 @@ public:
char _name[32];
bool loadAnimation(const Common::String &file);
- void drawFrame(Graphics::Surface &surface, int32 frame, int32 x, int32 y);
- void drawFontFrame(Graphics::Surface &surface, int32 frame, int32 x, int32 y, byte *colorMap);
- void drawFrameOnPicture(int32 frame, int32 x, int32 y);
- void drawFrameWithMask(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask);
- void drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask, int32 scale);
+ void drawFrame(Graphics::Surface &surface, int32 frame, int16 x, int16 y);
+ void drawFontFrame(Graphics::Surface &surface, int32 frame, int16 x, int16 y, byte *colorMap);
+ void drawFrameOnPicture(int32 frame, int16 x, int16 y);
+ void drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask);
+ void drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale);
void drawStrip(int32 offset = 0);
void applyPalette(int32 offset, int32 srcOffset, int32 numEntries);
Common::Rect getFrameRect(int32 frame);
- int32 getFrameWidth(int32 frame);
- int32 getFrameHeight(int32 frame);
- int32 getWidth() const;
- int32 getHeight() const;
+ int16 getFrameWidth(int32 frame);
+ int16 getFrameHeight(int32 frame);
+ int16 getWidth() const;
+ int16 getHeight() const;
Common::Rect getRect();
protected:
ToonEngine *_vm;
@@ -92,25 +92,25 @@ public:
void renderOnPicture();
void setAnimation(Animation *animation, bool setRange = true);
void playAnimation();
- void setAnimationRange(int32 rangeStart, int rangeEnd);
+ void setAnimationRange(int32 rangeStart, int32 rangeEnd);
void setFps(int32 fps);
void setLooping(bool enable);
void stopAnimation();
void setFrame(int32 position);
void forceFrame(int32 position);
- void setPosition(int32 x, int32 y, int32 z, bool relative = false);
+ void setPosition(int16 x, int16 y, int32 z, bool relative = false);
Animation *getAnimation() const { return _animation; }
void setScale(int32 scale, bool align = false);
void setVisible(bool visible);
bool getVisible() const { return _visible; }
void setUseMask(bool useMask);
- void moveRelative(int32 dx, int32 dy, int32 dz);
- void getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) const;
- int32 getX() const { return _x; }
- int32 getY() const { return _y; }
+ void moveRelative(int16 dx, int16 dy, int32 dz);
+ void getRect(int16 *x1, int16 *y1, int16 *x2, int16 *y2) const;
+ int16 getX() const { return _x; }
+ int16 getY() const { return _y; }
int32 getZ() const { return _z; }
- int32 getX2() const;
- int32 getY2() const;
+ int16 getX2() const;
+ int16 getY2() const;
int32 getZ2() const;
int32 getFrame() const { return _currentFrame; }
void reset();
@@ -120,8 +120,8 @@ public:
void setId(int32 id) { _id = id; }
int32 getId() const { return _id; }
- void setX(int32 x, bool relative = false);
- void setY(int32 y, bool relative = false);
+ void setX(int16 x, bool relative = false);
+ void setY(int16 y, bool relative = false);
void setZ(int32 z, bool relative = false);
void setLayerZ(int32 layer);
int32 getLayerZ() const;
@@ -133,8 +133,8 @@ protected:
int32 _currentTime;
int32 _fps;
Animation *_animation;
- int32 _x;
- int32 _y;
+ int16 _x;
+ int16 _y;
int32 _z;
int32 _layerZ;
int32 _rangeStart;
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 77822ab078..bc0e051057 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -326,7 +326,7 @@ bool AudioStreamInstance::readPacket() {
}
if (numDecompressedBytes > _bufferMaxSize) {
- delete [] _buffer;
+ delete[] _buffer;
_bufferMaxSize = numDecompressedBytes;
_buffer = new int16[numDecompressedBytes];
}
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 0e5189957b..479f4965f3 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -56,14 +56,13 @@ Character::Character(ToonEngine *vm) : _vm(vm) {
_animScriptId = -1;
_animSpecialId = -1;
_animSpecialDefaultId = 0;
- _currentPathNodeCount = 0;
_currentPathNode = 0;
_currentWalkStamp = 0;
_visible = true;
_speed = 150; // 150 = nominal drew speed
_lastWalkTime = 0;
_numPixelToWalk = 0;
- _nextIdleTime = _vm->getSystem()->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength();
+ _nextIdleTime = _vm->_system->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength();
_lineToSayId = 0;
}
@@ -81,7 +80,7 @@ Character::~Character(void) {
void Character::init() {
}
-void Character::forceFacing( int32 facing ) {
+void Character::forceFacing(int32 facing) {
debugC(4, kDebugCharacter, "forceFacing(%d)", facing);
_facing = facing;
}
@@ -102,7 +101,7 @@ void Character::setFacing(int32 facing) {
int32 dir = 0;
- _lastWalkTime = _vm->getSystem()->getMillis();
+ _lastWalkTime = _vm->_system->getMillis();
if ((_facing - facing + 8) % 8 > (facing - _facing + 8) % 8)
dir = 1;
else
@@ -123,7 +122,7 @@ void Character::setFacing(int32 facing) {
_lastWalkTime = _vm->getOldMilli();
}
- if (_currentPathNode == 0)
+ if (_currentPathNode == 0)
playStandingAnim();
else
playWalkAnim(0, 0);
@@ -136,8 +135,7 @@ void Character::setFacing(int32 facing) {
_facing = facing;
}
-void Character::forcePosition(int32 x, int32 y) {
-
+void Character::forcePosition(int16 x, int16 y) {
debugC(5, kDebugCharacter, "forcePosition(%d, %d)", x, y);
setPosition(x, y);
@@ -145,7 +143,7 @@ void Character::forcePosition(int32 x, int32 y) {
_finalY = y;
}
-void Character::setPosition(int32 x, int32 y) {
+void Character::setPosition(int16 x, int16 y) {
debugC(5, kDebugCharacter, "setPosition(%d, %d)", x, y);
_x = x;
@@ -155,7 +153,7 @@ void Character::setPosition(int32 x, int32 y) {
return;
}
-bool Character::walkTo(int32 newPosX, int32 newPosY) {
+bool Character::walkTo(int16 newPosX, int16 newPosY) {
debugC(1, kDebugCharacter, "walkTo(%d, %d)", newPosX, newPosY);
if (!_visible)
@@ -167,9 +165,9 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
_vm->getPathFinding()->resetBlockingRects();
// don't allow flux to go at the same position as drew
- if (_id == 1 ) {
- int32 sizeX = MAX<int32>(5, 30 * _vm->getDrew()->getScale() / 1024);
- int32 sizeY = MAX<int32>(2, 20 * _vm->getDrew()->getScale() / 1024);
+ if (_id == 1) {
+ int16 sizeX = MAX<int16>(5, 30 * _vm->getDrew()->getScale() / 1024);
+ int16 sizeY = MAX<int16>(2, 20 * _vm->getDrew()->getScale() / 1024);
_vm->getPathFinding()->addBlockingEllipse(_vm->getDrew()->getFinalX(), _vm->getDrew()->getFinalY(), sizeX, sizeY);
}
@@ -179,20 +177,18 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
if (_vm->getPathFinding()->findPath(_x, _y, _finalX, _finalY)) {
- int32 localFinalX = _finalX;
- int32 localFinalY = _finalY;
+ int16 localFinalX = _finalX;
+ int16 localFinalY = _finalY;
int32 smoothDx = 0;
int32 smoothDy = 0;
- for (int32 a = 0; a < _vm->getPathFinding()->getPathNodeCount(); a++) {
- _currentPathX[a] = _vm->getPathFinding()->getPathNodeX(a);
- _currentPathY[a] = _vm->getPathFinding()->getPathNodeY(a);
- }
- _currentPathNodeCount = _vm->getPathFinding()->getPathNodeCount();
+ _currentPath.clear();
+ for (uint32 a = 0; a < _vm->getPathFinding()->getPathNodeCount(); a++)
+ _currentPath.push_back(Common::Point(_vm->getPathFinding()->getPathNodeX(a), _vm->getPathFinding()->getPathNodeY(a)));
_currentPathNode = 0;
stopSpecialAnim();
- _lastWalkTime = _vm->getSystem()->getMillis();
+ _lastWalkTime = _vm->_system->getMillis();
_numPixelToWalk = 0;
@@ -203,12 +199,12 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
int32 localWalkStamp = _currentWalkStamp;
if (_blockingWalk) {
- while ((_x != newPosX || _y != newPosY) && _currentPathNode < _currentPathNodeCount && !_vm->shouldQuitGame()) {
- if (_currentPathNode < _currentPathNodeCount - 4) {
- int32 delta = MIN<int32>(4, _currentPathNodeCount - _currentPathNode);
+ while ((_x != newPosX || _y != newPosY) && _currentPathNode < _currentPath.size() && !_vm->shouldQuitGame()) {
+ if (_currentPathNode < _currentPath.size() - 4) {
+ int32 delta = MIN<int32>(4, _currentPath.size() - 1 - _currentPathNode);
- int32 dx = _currentPathX[_currentPathNode+delta] - _x;
- int32 dy = _currentPathY[_currentPathNode+delta] - _y;
+ int16 dx = _currentPath[_currentPathNode+delta].x - _x;
+ int16 dy = _currentPath[_currentPathNode+delta].y - _y;
// smooth the facing computation. It prevents some ugly flickering from happening
if (!smoothDx && !smoothDy) {
@@ -224,12 +220,12 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
}
// in 1/1000 pixels
- _numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024;
- _lastWalkTime = _vm->getSystem()->getMillis();
+ _numPixelToWalk += _speed * (_vm->_system->getMillis() - _lastWalkTime) * _scale / 1024;
+ _lastWalkTime = _vm->_system->getMillis();
- while (_numPixelToWalk >= 1000 && _currentPathNode < _currentPathNodeCount) {
- _x = _currentPathX[_currentPathNode];
- _y = _currentPathY[_currentPathNode];
+ while (_numPixelToWalk >= 1000 && _currentPathNode < _currentPath.size()) {
+ _x = _currentPath[_currentPathNode].x;
+ _y = _currentPath[_currentPathNode].y;
_currentPathNode += 1;
_numPixelToWalk -= 1000;
}
@@ -245,7 +241,7 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
playStandingAnim();
_flags &= ~0x1;
_currentPathNode = 0;
- _currentPathNodeCount = 0;
+ _currentPath.clear();
if (_x != localFinalX || _y != localFinalY) {
return false;
@@ -264,10 +260,11 @@ int32 Character::getFlag() {
return _flags;
}
-int32 Character::getX() {
+int16 Character::getX() {
return _x;
}
-int32 Character::getY() {
+
+int16 Character::getY() {
return _y;
}
@@ -348,23 +345,23 @@ void Character::stopSpecialAnim() {
void Character::update(int32 timeIncrement) {
debugC(5, kDebugCharacter, "update(%d)", timeIncrement);
- if ((_flags & 0x1) && _currentPathNodeCount > 0) {
- if (_currentPathNode < _currentPathNodeCount) {
- if (_currentPathNode < _currentPathNodeCount - 10) {
- int32 delta = MIN<int32>(10, _currentPathNodeCount - _currentPathNode);
- int32 dx = _currentPathX[_currentPathNode+delta] - _x;
- int32 dy = _currentPathY[_currentPathNode+delta] - _y;
+ if ((_flags & 0x1) && _currentPath.size() > 0) {
+ if (_currentPathNode < _currentPath.size()) {
+ if (_currentPathNode < _currentPath.size() - 10) {
+ int32 delta = MIN<int32>(10, _currentPath.size() - 1 - _currentPathNode);
+ int16 dx = _currentPath[_currentPathNode+delta].x - _x;
+ int16 dy = _currentPath[_currentPathNode+delta].y - _y;
setFacing(getFacingFromDirection(dx, dy));
playWalkAnim(0, 0);
}
// in 1/1000 pixels
- _numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024;
- _lastWalkTime = _vm->getSystem()->getMillis();
+ _numPixelToWalk += _speed * (_vm->_system->getMillis() - _lastWalkTime) * _scale / 1024;
+ _lastWalkTime = _vm->_system->getMillis();
- while (_numPixelToWalk > 1000 && _currentPathNode < _currentPathNodeCount) {
- _x = _currentPathX[_currentPathNode];
- _y = _currentPathY[_currentPathNode];
+ while (_numPixelToWalk > 1000 && _currentPathNode < _currentPath.size()) {
+ _x = _currentPath[_currentPathNode].x;
+ _y = _currentPath[_currentPathNode].y;
_currentPathNode += 1;
_numPixelToWalk -= 1000;
}
@@ -372,7 +369,7 @@ void Character::update(int32 timeIncrement) {
} else {
playStandingAnim();
_flags &= ~0x1;
- _currentPathNodeCount = 0;
+ _currentPath.clear();
}
}
@@ -527,7 +524,7 @@ void Character::update(int32 timeIncrement) {
}
// adapted from Kyra
-int32 Character::getFacingFromDirection(int32 dx, int32 dy) {
+int32 Character::getFacingFromDirection(int16 dx, int16 dy) {
debugC(4, kDebugCharacter, "getFacingFromDirection(%d, %d)", dx, dy);
static const int facingTable[] = {
@@ -537,35 +534,33 @@ int32 Character::getFacingFromDirection(int32 dx, int32 dy) {
dx = -dx;
int32 facingEntry = 0;
- int32 ydiff = dy;
+ int16 ydiff = dy;
if (ydiff < 0) {
++facingEntry;
ydiff = -ydiff;
}
- facingEntry <<= 1;
+ facingEntry *= 2;
- int32 xdiff = dx;
+ int16 xdiff = dx;
if (xdiff < 0) {
++facingEntry;
xdiff = -xdiff;
}
- facingEntry <<= 1;
+ facingEntry *= 2;
if (xdiff >= ydiff) {
- int32 temp = ydiff;
+ // Swap xdiff and ydiff
+ int16 temp = ydiff;
ydiff = xdiff;
xdiff = temp;
- } else {
- facingEntry += 1;
- }
-
- facingEntry <<= 1;
+ } else
+ facingEntry++;
- int32 temp = (ydiff + 1) >> 1;
+ facingEntry *= 2;
- if (xdiff < temp)
- facingEntry += 1;
+ if (xdiff < ((ydiff + 1) / 2))
+ facingEntry++;
return facingTable[facingEntry];
}
@@ -638,7 +633,7 @@ void Character::load(Common::ReadStream *stream) {
// "not visible" flag.
if (_flags & 0x100) {
_flags &= ~0x100;
- setVisible(false);
+ setVisible(false);
}
}
@@ -664,7 +659,7 @@ void Character::stopWalk() {
_finalY = _y;
_flags &= ~0x1;
_currentPathNode = 0;
- _currentPathNodeCount = 0;
+ _currentPath.clear();
}
const SpecialCharacterAnimation *Character::getSpecialAnimation(int32 characterId, int32 animationId) {
@@ -996,8 +991,8 @@ 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);
+ for (uint32 i = 0; i < _currentPath.size(); i++) {
+ *(byte *)surface.getBasePtr(_currentPath[i].x, _currentPath[i].y) = (i < _currentPathNode);
}
}
@@ -1078,11 +1073,11 @@ void Character::setDefaultSpecialAnimationId(int32 defaultAnimationId) {
_animSpecialDefaultId = defaultAnimationId;
}
-int32 Character::getFinalX() {
+int16 Character::getFinalX() {
return _finalX;
}
-int32 Character::getFinalY() {
+int16 Character::getFinalY() {
return _finalY;
}
diff --git a/engines/toon/character.h b/engines/toon/character.h
index d06a6c060c..d33c314bf7 100644
--- a/engines/toon/character.h
+++ b/engines/toon/character.h
@@ -23,6 +23,9 @@
#ifndef TOON_CHARACTER_H
#define TOON_CHARACTER_H
+#include "common/array.h"
+#include "common/rect.h"
+
#include "toon/toon.h"
namespace Toon {
@@ -65,13 +68,13 @@ public:
virtual int32 getFlag();
virtual int32 getAnimFlag();
virtual void setAnimFlag(int32 flag);
- virtual void setPosition(int32 x, int32 y);
- virtual void forcePosition(int32 x, int32 y);
- virtual int32 getX();
- virtual int32 getY();
- virtual int32 getFinalX();
- virtual int32 getFinalY();
- virtual bool walkTo(int32 newPosX, int32 newPosY);
+ virtual void setPosition(int16 x, int16 y);
+ virtual void forcePosition(int16 x, int16 y);
+ virtual int16 getX();
+ virtual int16 getY();
+ virtual int16 getFinalX();
+ virtual int16 getFinalY();
+ virtual bool walkTo(int16 newPosX, int16 newPosY);
virtual bool getVisible();
virtual void setVisible(bool visible);
virtual bool loadWalkAnimation(const Common::String &animName);
@@ -99,7 +102,7 @@ public:
virtual void resetScale() {}
virtual void plotPath(Graphics::Surface& surface);
- int32 getFacingFromDirection(int32 dx, int32 dy);
+ int32 getFacingFromDirection(int16 dx, int16 dy);
static const SpecialCharacterAnimation *getSpecialAnimation(int32 characterId, int32 animationId);
protected:
@@ -112,11 +115,11 @@ protected:
int32 _sceneAnimationId;
int32 _lineToSayId;
int32 _time;
- int32 _x;
- int32 _y;
+ int16 _x;
+ int16 _y;
int32 _z;
- int32 _finalX;
- int32 _finalY;
+ int16 _finalX;
+ int16 _finalY;
int32 _facing;
int32 _flags;
int32 _animFlags;
@@ -137,10 +140,8 @@ protected:
Animation *_shadowAnim;
Animation *_specialAnim;
- int32 _currentPathX[4096];
- int32 _currentPathY[4096];
- int32 _currentPathNodeCount;
- int32 _currentPathNode;
+ Common::Array<Common::Point> _currentPath;
+ uint32 _currentPathNode;
int32 _currentWalkStamp;
};
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index 8234934972..38b1f4f6e1 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -84,7 +84,7 @@ static const ADGameDescription gameDescriptions[] = {
{"study.svl", 0, "d4aff126ee27be3c3d25e2996369d7cb", 2324368},
},
Common::RU_RUS, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
- },
+ },
{
"toon", "",
{
@@ -133,7 +133,7 @@ public:
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
- return detectGameFilebased(allFiles, Toon::fileBasedFallback);
+ return detectGameFilebased(allFiles, fslist, Toon::fileBasedFallback);
}
virtual const char *getName() const {
@@ -234,9 +234,6 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s
Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
-
uint32 saveDate = file->readUint32BE();
uint16 saveTime = file->readUint16BE();
diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp
index df5cfcfa03..dfd3f515fa 100644
--- a/engines/toon/drew.cpp
+++ b/engines/toon/drew.cpp
@@ -48,7 +48,7 @@ bool CharacterDrew::setupPalette() {
return false;
}
-void CharacterDrew::setPosition(int32 x, int32 y) {
+void CharacterDrew::setPosition(int16 x, int16 y) {
debugC(5, kDebugCharacter, "setPosition(%d, %d)", x, y);
_z = _vm->getLayerAtPoint(x, y);
diff --git a/engines/toon/drew.h b/engines/toon/drew.h
index 3357b99846..ff1b619125 100644
--- a/engines/toon/drew.h
+++ b/engines/toon/drew.h
@@ -35,7 +35,7 @@ public:
virtual ~CharacterDrew();
bool setupPalette();
void playStandingAnim();
- void setPosition(int32 x, int32 y);
+ void setPosition(int16 x, int16 y);
void resetScale();
void update(int32 timeIncrement);
void playWalkAnim(int32 start, int32 end);
diff --git a/engines/toon/flux.cpp b/engines/toon/flux.cpp
index b752e65c82..70aa40fb36 100644
--- a/engines/toon/flux.cpp
+++ b/engines/toon/flux.cpp
@@ -45,7 +45,7 @@ void CharacterFlux::playStandingAnim() {
_animationInstance->stopAnimation();
_animationInstance->setLooping(true);
- //s/etVisible(true);
+ //setVisible(true);
}
void CharacterFlux::setVisible(bool visible) {
@@ -99,7 +99,7 @@ int32 CharacterFlux::fixFacingForAnimation(int32 originalFacing, int32 animation
return finalFacing;
}
-void CharacterFlux::setPosition(int32 x, int32 y) {
+void CharacterFlux::setPosition(int16 x, int16 y) {
debugC(5, kDebugCharacter, "setPosition(%d, %d)", x, y);
_z = _vm->getLayerAtPoint(x, y);
diff --git a/engines/toon/flux.h b/engines/toon/flux.h
index c208bc5bda..1dc0d9c55f 100644
--- a/engines/toon/flux.h
+++ b/engines/toon/flux.h
@@ -34,7 +34,7 @@ public:
CharacterFlux(ToonEngine *vm);
virtual ~CharacterFlux();
- void setPosition(int32 x, int32 y);
+ void setPosition(int16 x, int16 y);
void playStandingAnim();
void playWalkAnim(int32 start, int32 end);
void update(int32 timeIncrement);
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index d58663a00c..1e851ff4ae 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -65,10 +65,10 @@ byte FontRenderer::textToFont(byte c) {
return map_textToFont[c - 0x80];
}
-void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText, int32 mode) {
+void FontRenderer::renderText(int16 x, int16 y, const Common::String &origText, int32 mode) {
debugC(5, kDebugFont, "renderText(%d, %d, %s, %d)", x, y, origText.c_str(), mode);
- int32 xx, yy;
+ int16 xx, yy;
computeSize(origText, &xx, &yy);
if (mode & 2) {
@@ -83,8 +83,8 @@ void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText,
_vm->addDirtyRect(x, y, x + xx, y + yy);
- int32 curX = x;
- int32 curY = y;
+ int16 curX = x;
+ int16 curY = y;
int32 height = 0;
const byte *text = (const byte *)origText.c_str();
@@ -98,20 +98,20 @@ void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText,
curChar = textToFont(curChar);
_currentFont->drawFontFrame(_vm->getMainSurface(), curChar, curX, curY, _currentFontColor);
curX = curX + _currentFont->getFrameWidth(curChar) - 1;
- height = MAX(height, _currentFont->getFrameHeight(curChar));
+ height = MAX<int32>(height, _currentFont->getFrameHeight(curChar));
}
text++;
}
}
-void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int32 *retY) {
+void FontRenderer::computeSize(const Common::String &origText, int16 *retX, int16 *retY) {
debugC(4, kDebugFont, "computeSize(%s, retX, retY)", origText.c_str());
- int32 lineWidth = 0;
- int32 lineHeight = 0;
- int32 totalHeight = 0;
- int32 totalWidth = 0;
- int32 lastLineHeight = 0;
+ int16 lineWidth = 0;
+ int16 lineHeight = 0;
+ int16 totalHeight = 0;
+ int16 totalWidth = 0;
+ int16 lastLineHeight = 0;
const byte *text = (const byte *)origText.c_str();
while (*text) {
@@ -127,8 +127,8 @@ void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int3
lastLineHeight = 0;
} else {
curChar = textToFont(curChar);
- int32 charWidth = _currentFont->getFrameWidth(curChar) - 1;
- int32 charHeight = _currentFont->getFrameHeight(curChar);
+ int16 charWidth = _currentFont->getFrameWidth(curChar) - 1;
+ int16 charHeight = _currentFont->getFrameHeight(curChar);
lineWidth += charWidth;
lineHeight = MAX(lineHeight, charHeight);
@@ -137,7 +137,7 @@ void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int3
// assume we only need to take the lower bound into
// consideration.
Common::Rect charRect = _currentFont->getFrameRect(curChar);
- lastLineHeight = MAX<int32>(lastLineHeight, charRect.bottom);
+ lastLineHeight = MAX(lastLineHeight, charRect.bottom);
}
text++;
}
@@ -189,7 +189,7 @@ void FontRenderer::setFontColor(int32 fontColor1, int32 fontColor2, int32 fontCo
_currentFontColor[3] = fontColor3;
}
-void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &origText, int32 mode) {
+void FontRenderer::renderMultiLineText(int16 x, int16 y, const Common::String &origText, int32 mode) {
debugC(5, kDebugFont, "renderMultiLineText(%d, %d, %s, %d)", x, y, origText.c_str(), mode);
// divide the text in several lines
@@ -204,10 +204,10 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o
byte *it = text;
- int32 maxWidth = 0;
- int32 curWidth = 0;
+ int16 maxWidth = 0;
+ int16 curWidth = 0;
- while (1) {
+ while (true) {
byte *lastLine = it;
byte *lastSpace = it;
int32 lastSpaceX = 0;
@@ -223,7 +223,7 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o
curChar = textToFont(curChar);
int width = _currentFont->getFrameWidth(curChar);
- curWidth += MAX<int32>(width - 2, 0);
+ curWidth += MAX(width - 2, 0);
it++;
curLetterNr++;
}
@@ -260,8 +260,8 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o
//numLines++;
// get font height (assumed to be constant)
- int32 height = _currentFont->getHeight();
- int textSize = (height - 2) * numLines;
+ int16 height = _currentFont->getHeight();
+ int32 textSize = (height - 2) * numLines;
y = y - textSize;
if (y < 30)
y = 30;
@@ -278,8 +278,8 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o
x = TOON_SCREEN_WIDTH - (maxWidth / 2) - 30;
// we have good coordinates now, we can render the multi line
- int32 curX = x;
- int32 curY = y;
+ int16 curX = x;
+ int16 curY = y;
for (int32 i = 0; i < numLines; i++) {
const byte *line = lines[i];
diff --git a/engines/toon/font.h b/engines/toon/font.h
index 349d9d1ee7..2a46ad3559 100644
--- a/engines/toon/font.h
+++ b/engines/toon/font.h
@@ -33,9 +33,9 @@ public:
~FontRenderer();
void setFont(Animation *font);
- void computeSize(const Common::String &origText, int32 *retX, int32 *retY);
- void renderText(int32 x, int32 y, const Common::String &origText, int32 mode);
- void renderMultiLineText(int32 x, int32 y, const Common::String &origText, int32 mode);
+ void computeSize(const Common::String &origText, int16 *retX, int16 *retY);
+ void renderText(int16 x, int16 y, const Common::String &origText, int32 mode);
+ void renderMultiLineText(int16 x, int16 y, const Common::String &origText, int32 mode);
void setFontColorByCharacter(int32 characterId);
void setFontColor(int32 fontColor1, int32 fontColor2, int32 fontColor3);
protected:
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index ce2cdf1bb9..8b8f0ab577 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -57,7 +57,7 @@ void Hotspots::save(Common::WriteStream *Stream) {
}
}
-int32 Hotspots::FindBasedOnCorner(int32 x, int32 y) {
+int32 Hotspots::FindBasedOnCorner(int16 x, int16 y) {
debugC(1, kDebugHotspot, "FindBasedOnCorner(%d, %d)", x, y);
for (int32 i = 0; i < _numItems; i++) {
@@ -73,7 +73,7 @@ int32 Hotspots::FindBasedOnCorner(int32 x, int32 y) {
return -1;
}
-int32 Hotspots::Find(int32 x, int32 y) {
+int32 Hotspots::Find(int16 x, int16 y) {
debugC(6, kDebugHotspot, "Find(%d, %d)", x, y);
int32 priority = -1;
diff --git a/engines/toon/hotspot.h b/engines/toon/hotspot.h
index 70e80046e1..3852e2e42e 100644
--- a/engines/toon/hotspot.h
+++ b/engines/toon/hotspot.h
@@ -51,8 +51,8 @@ public:
~Hotspots();
bool LoadRif(const Common::String &rifName, const Common::String &additionalRifName);
- int32 Find(int32 x, int32 y);
- int32 FindBasedOnCorner(int32 x, int32 y);
+ int32 Find(int16 x, int16 y);
+ int32 FindBasedOnCorner(int16 x, int16 y);
HotspotData *Get(int32 id);
int32 getCount() const { return _numItems; }
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 59ad8484d5..8c85e20f7c 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -25,6 +25,7 @@
#include "common/keyboard.h"
#include "common/stream.h"
#include "common/system.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "toon/audio.h"
@@ -33,6 +34,10 @@
namespace Toon {
+ToonstruckSmackerDecoder::ToonstruckSmackerDecoder() : Video::SmackerDecoder() {
+ _lowRes = false;
+}
+
void ToonstruckSmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) {
debugC(6, kDebugMovie, "handleAudioTrack(%d, %d, %d)", track, chunkSize, unpackedSize);
@@ -40,33 +45,21 @@ void ToonstruckSmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, ui
/* uint16 width = */ _fileStream->readUint16LE();
uint16 height = _fileStream->readUint16LE();
_lowRes = (height == getHeight() / 2);
- } else
+ } else {
Video::SmackerDecoder::handleAudioTrack(track, chunkSize, unpackedSize);
+ }
}
-bool ToonstruckSmackerDecoder::loadFile(const Common::String &filename) {
- debugC(1, kDebugMovie, "loadFile(%s)", filename.c_str());
+bool ToonstruckSmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
+ if (!Video::SmackerDecoder::loadStream(stream))
+ return false;
_lowRes = false;
-
- if (Video::SmackerDecoder::loadFile(filename)) {
- if (_surface->h == 200) {
- if (_surface) {
- _surface->free();
- delete _surface;
- }
- _surface = new Graphics::Surface();
- _surface->create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
- _header.flags = 4;
- }
-
- return true;
- }
- return false;
+ return true;
}
-ToonstruckSmackerDecoder::ToonstruckSmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : Video::SmackerDecoder(mixer, soundType) {
- _lowRes = false;
+Video::SmackerDecoder::SmackerVideoTrack *ToonstruckSmackerDecoder::createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const {
+ return Video::SmackerDecoder::createVideoTrack(width, height, frameCount, frameRate, (height == 200) ? 4 : flags, signature);
}
// decoder is deallocated with Movie destruction i.e. new ToonstruckSmackerDecoder is needed
@@ -103,46 +96,49 @@ void Movie::play(const Common::String &video, int32 flags) {
bool Movie::playVideo(bool isFirstIntroVideo) {
debugC(1, kDebugMovie, "playVideo(isFirstIntroVideo: %d)", isFirstIntroVideo);
+
+ _decoder->start();
+
while (!_vm->shouldQuit() && !_decoder->endOfVideo()) {
if (_decoder->needsUpdate()) {
const Graphics::Surface *frame = _decoder->decodeNextFrame();
if (frame) {
if (_decoder->isLowRes()) {
// handle manually 2x scaling here
- Graphics::Surface* surf = _vm->getSystem()->lockScreen();
+ Graphics::Surface* surf = _vm->_system->lockScreen();
for (int y = 0; y < frame->h / 2; y++) {
memcpy(surf->getBasePtr(0, y * 2 + 0), frame->getBasePtr(0, y), frame->pitch);
memcpy(surf->getBasePtr(0, y * 2 + 1), frame->getBasePtr(0, y), frame->pitch);
}
- _vm->getSystem()->unlockScreen();
+ _vm->_system->unlockScreen();
} else {
- _vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
+ _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
// WORKAROUND: There is an encoding glitch in the first intro video. This hides this using the adjacent pixels.
if (isFirstIntroVideo) {
int32 currentFrame = _decoder->getCurFrame();
if (currentFrame >= 956 && currentFrame <= 1038) {
debugC(1, kDebugMovie, "Triggered workaround for glitch in first intro video...");
- _vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1);
- _vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1);
- _vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1);
- _vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1);
+ _vm->_system->copyRectToScreen(frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1);
+ _vm->_system->copyRectToScreen(frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1);
+ _vm->_system->copyRectToScreen(frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1);
+ _vm->_system->copyRectToScreen(frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1);
}
}
}
}
- _decoder->setSystemPalette();
- _vm->getSystem()->updateScreen();
+ _vm->_system->getPaletteManager()->setPalette(_decoder->getPalette(), 0, 256);
+ _vm->_system->updateScreen();
}
Common::Event event;
- while (_vm->getSystem()->getEventManager()->pollEvent(event))
+ while (_vm->_system->getEventManager()->pollEvent(event))
if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
_vm->dirtyAllScreen();
return false;
}
- _vm->getSystem()->delayMillis(10);
+ _vm->_system->delayMillis(10);
}
_vm->dirtyAllScreen();
return !_vm->shouldQuit();
diff --git a/engines/toon/movie.h b/engines/toon/movie.h
index 2cd33302f2..4dd6583bf6 100644
--- a/engines/toon/movie.h
+++ b/engines/toon/movie.h
@@ -30,12 +30,16 @@ namespace Toon {
class ToonstruckSmackerDecoder : public Video::SmackerDecoder {
public:
- ToonstruckSmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
- virtual ~ToonstruckSmackerDecoder() {}
- void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
- bool loadFile(const Common::String &filename);
+ ToonstruckSmackerDecoder();
+
+ bool loadStream(Common::SeekableReadStream *stream);
bool isLowRes() { return _lowRes; }
+
protected:
+ void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
+ SmackerVideoTrack *createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const;
+
+private:
bool _lowRes;
};
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index 2dd5fc45e2..7914aed595 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -60,12 +60,12 @@ void PathFindingHeap::clear() {
memset(_data, 0, sizeof(HeapDataGrid) * _size);
}
-void PathFindingHeap::push(int32 x, int32 y, int32 weight) {
+void PathFindingHeap::push(int16 x, int16 y, uint16 weight) {
debugC(2, kDebugPath, "push(%d, %d, %d)", x, y, weight);
if (_count == _size) {
// Increase size by 50%
- int newSize = _size + (_size >> 1) + 1;
+ uint32 newSize = _size + (_size / 2) + 1;
HeapDataGrid *newData;
newData = (HeapDataGrid *)realloc(_data, sizeof(HeapDataGrid) * newSize);
@@ -84,13 +84,13 @@ void PathFindingHeap::push(int32 x, int32 y, int32 weight) {
_data[_count]._weight = weight;
_count++;
- int32 lMax = _count-1;
- int32 lT = 0;
+ uint32 lMax = _count - 1;
+ uint32 lT = 0;
- while (1) {
+ while (true) {
if (lMax <= 0)
break;
- lT = (lMax-1) / 2;
+ lT = (lMax - 1) / 2;
if (_data[lT]._weight > _data[lMax]._weight) {
HeapDataGrid temp;
@@ -104,7 +104,7 @@ void PathFindingHeap::push(int32 x, int32 y, int32 weight) {
}
}
-void PathFindingHeap::pop(int32 *x, int32 *y, int32 *weight) {
+void PathFindingHeap::pop(int16 *x, int16 *y, uint16 *weight) {
debugC(2, kDebugPath, "pop(x, y, weight)");
if (!_count) {
@@ -120,13 +120,13 @@ void PathFindingHeap::pop(int32 *x, int32 *y, int32 *weight) {
if (!_count)
return;
- int32 lMin = 0;
- int32 lT = 0;
+ uint32 lMin = 0;
+ uint32 lT = 0;
- while (1) {
- lT = (lMin << 1) + 1;
+ while (true) {
+ lT = (lMin * 2) + 1;
if (lT < _count) {
- if (lT < _count-1) {
+ if (lT < _count - 1) {
if (_data[lT + 1]._weight < _data[lT]._weight)
lT++;
}
@@ -146,11 +146,11 @@ void PathFindingHeap::pop(int32 *x, int32 *y, int32 *weight) {
}
}
-PathFinding::PathFinding(ToonEngine *vm) : _vm(vm) {
+PathFinding::PathFinding() {
_width = 0;
_height = 0;
_heap = new PathFindingHeap();
- _gridTemp = NULL;
+ _sq = NULL;
_numBlockingRects = 0;
}
@@ -158,17 +158,29 @@ PathFinding::~PathFinding(void) {
if (_heap)
_heap->unload();
delete _heap;
- delete[] _gridTemp;
+ delete[] _sq;
}
-bool PathFinding::isLikelyWalkable(int32 x, int32 y) {
- for (int32 i = 0; i < _numBlockingRects; i++) {
+void PathFinding::init(Picture *mask) {
+ debugC(1, kDebugPath, "init(mask)");
+
+ _width = mask->getWidth();
+ _height = mask->getHeight();
+ _currentMask = mask;
+ _heap->unload();
+ _heap->init(500);
+ delete[] _sq;
+ _sq = new uint16[_width * _height];
+}
+
+bool PathFinding::isLikelyWalkable(int16 x, int16 y) {
+ for (uint8 i = 0; i < _numBlockingRects; i++) {
if (_blockingRects[i][4] == 0) {
if (x >= _blockingRects[i][0] && x <= _blockingRects[i][2] && y >= _blockingRects[i][1] && y < _blockingRects[i][3])
return false;
} else {
- int32 dx = abs(_blockingRects[i][0] - x);
- int32 dy = abs(_blockingRects[i][1] - y);
+ int16 dx = abs(_blockingRects[i][0] - x);
+ int16 dy = abs(_blockingRects[i][1] - y);
if ((dx << 8) / _blockingRects[i][2] < (1 << 8) && (dy << 8) / _blockingRects[i][3] < (1 << 8)) {
return false;
}
@@ -177,15 +189,13 @@ bool PathFinding::isLikelyWalkable(int32 x, int32 y) {
return true;
}
-bool PathFinding::isWalkable(int32 x, int32 y) {
+bool PathFinding::isWalkable(int16 x, int16 y) {
debugC(2, kDebugPath, "isWalkable(%d, %d)", x, y);
- bool maskWalk = (_currentMask->getData(x, y) & 0x1f) > 0;
-
- return maskWalk;
+ return (_currentMask->getData(x, y) & 0x1f) > 0;
}
-int32 PathFinding::findClosestWalkingPoint(int32 xx, int32 yy, int32 *fxx, int32 *fyy, int origX, int origY) {
+bool PathFinding::findClosestWalkingPoint(int16 xx, int16 yy, int16 *fxx, int16 *fyy, int16 origX, int16 origY) {
debugC(1, kDebugPath, "findClosestWalkingPoint(%d, %d, fxx, fyy, %d, %d)", xx, yy, origX, origY);
int32 currentFound = -1;
@@ -197,8 +207,8 @@ int32 PathFinding::findClosestWalkingPoint(int32 xx, int32 yy, int32 *fxx, int32
if (origY == -1)
origY = yy;
- for (int y = 0; y < _height; y++) {
- for (int x = 0; x < _width; x++) {
+ for (int16 y = 0; y < _height; y++) {
+ for (int16 x = 0; x < _width; x++) {
if (isWalkable(x, y) && isLikelyWalkable(x, y)) {
int32 ndist = (x - xx) * (x - xx) + (y - yy) * (y - yy);
int32 ndist2 = (x - origX) * (x - origX) + (y - origY) * (y - origY);
@@ -214,15 +224,15 @@ int32 PathFinding::findClosestWalkingPoint(int32 xx, int32 yy, int32 *fxx, int32
if (currentFound != -1) {
*fxx = currentFound % _width;
*fyy = currentFound / _width;
- return 1;
+ return true;
} else {
*fxx = 0;
*fyy = 0;
- return 0;
+ return false;
}
}
-bool PathFinding::walkLine(int32 x, int32 y, int32 x2, int32 y2) {
+void PathFinding::walkLine(int16 x, int16 y, int16 x2, int16 y2) {
uint32 bx = x << 16;
int32 dx = x2 - x;
uint32 by = y << 16;
@@ -238,24 +248,17 @@ bool PathFinding::walkLine(int32 x, int32 y, int32 x2, int32 y2) {
int32 cdx = (dx << 16) / t;
int32 cdy = (dy << 16) / t;
- int32 i = t;
- _gridPathCount = 0;
- while (i) {
- _tempPathX[i] = bx >> 16;
- _tempPathY[i] = by >> 16;
- _gridPathCount++;
+ _tempPath.clear();
+ for (int32 i = t; i > 0; i--) {
+ _tempPath.insert_at(0, Common::Point(bx >> 16, by >> 16));
bx += cdx;
by += cdy;
- i--;
}
- _tempPathX[0] = x2;
- _tempPathY[0] = y2;
-
- return true;
+ _tempPath.insert_at(0, Common::Point(x2, y2));
}
-bool PathFinding::lineIsWalkable(int32 x, int32 y, int32 x2, int32 y2) {
+bool PathFinding::lineIsWalkable(int16 x, int16 y, int16 x2, int16 y2) {
uint32 bx = x << 16;
int32 dx = x2 - x;
uint32 by = y << 16;
@@ -271,27 +274,26 @@ bool PathFinding::lineIsWalkable(int32 x, int32 y, int32 x2, int32 y2) {
int32 cdx = (dx << 16) / t;
int32 cdy = (dy << 16) / t;
- int32 i = t;
- while (i) {
+ for (int32 i = t; i > 0; i--) {
if (!isWalkable(bx >> 16, by >> 16))
return false;
bx += cdx;
by += cdy;
- i--;
}
return true;
}
-int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) {
+
+bool PathFinding::findPath(int16 x, int16 y, int16 destx, int16 desty) {
debugC(1, kDebugPath, "findPath(%d, %d, %d, %d)", x, y, destx, desty);
if (x == destx && y == desty) {
- _gridPathCount = 0;
+ _tempPath.clear();
return true;
}
// ignore path finding if the character is outside the screen
if (x < 0 || x > 1280 || y < 0 || y > 400 || destx < 0 || destx > 1280 || desty < 0 || desty > 400) {
- _gridPathCount = 0;
+ _tempPath.clear();
return true;
}
@@ -302,40 +304,45 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) {
}
// no direct line, we use the standard A* algorithm
- memset(_gridTemp , 0, _width * _height * sizeof(int32));
+ memset(_sq , 0, _width * _height * sizeof(uint16));
_heap->clear();
- int32 curX = x;
- int32 curY = y;
- int32 curWeight = 0;
- int32 *sq = _gridTemp;
+ int16 curX = x;
+ int16 curY = y;
+ uint16 curWeight = 0;
- sq[curX + curY *_width] = 1;
+ _sq[curX + curY *_width] = 1;
_heap->push(curX, curY, abs(destx - x) + abs(desty - y));
- int wei = 0;
while (_heap->getCount()) {
- wei = 0;
_heap->pop(&curX, &curY, &curWeight);
- int curNode = curX + curY * _width;
+ int32 curNode = curX + curY * _width;
- int32 endX = MIN<int32>(curX + 1, _width - 1);
- int32 endY = MIN<int32>(curY + 1, _height - 1);
- int32 startX = MAX<int32>(curX - 1, 0);
- int32 startY = MAX<int32>(curY - 1, 0);
+ int16 endX = MIN<int16>(curX + 1, _width - 1);
+ int16 endY = MIN<int16>(curY + 1, _height - 1);
+ int16 startX = MAX<int16>(curX - 1, 0);
+ int16 startY = MAX<int16>(curY - 1, 0);
bool next = false;
- for (int32 px = startX; px <= endX && !next; px++) {
- for (int py = startY; py <= endY && !next; py++) {
+ for (int16 px = startX; px <= endX && !next; px++) {
+ for (int16 py = startY; py <= endY && !next; py++) {
if (px != curX || py != curY) {
- wei = ((abs(px - curX) + abs(py - curY)));
+ uint16 wei = abs(px - curX) + abs(py - curY);
- int32 curPNode = px + py * _width;
if (isWalkable(px, py)) { // walkable ?
- int sum = sq[curNode] + wei * (1 + (isLikelyWalkable(px, py) ? 5 : 0));
- if (sq[curPNode] > sum || !sq[curPNode]) {
- int newWeight = abs(destx - px) + abs(desty - py);
- sq[curPNode] = sum;
- _heap->push(px, py, sq[curPNode] + newWeight);
+ int32 curPNode = px + py * _width;
+ uint32 sum = _sq[curNode] + wei * (1 + (isLikelyWalkable(px, py) ? 5 : 0));
+ if (sum > (uint32)0xFFFF) {
+ warning("PathFinding::findPath sum exceeds maximum representable!");
+ sum = (uint32)0xFFFF;
+ }
+ if (_sq[curPNode] > sum || !_sq[curPNode]) {
+ _sq[curPNode] = sum;
+ uint32 newWeight = _sq[curPNode] + abs(destx - px) + abs(desty - py);
+ if (newWeight > (uint32)0xFFFF) {
+ warning("PathFinding::findPath newWeight exceeds maximum representable!");
+ newWeight = (uint16)0xFFFF;
+ }
+ _heap->push(px, py, newWeight);
if (!newWeight)
next = true; // we found it !
}
@@ -346,49 +353,37 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) {
}
// let's see if we found a result !
- if (!_gridTemp[destx + desty * _width]) {
+ if (!_sq[destx + desty * _width]) {
// didn't find anything
- _gridPathCount = 0;
+ _tempPath.clear();
return false;
}
curX = destx;
curY = desty;
- int32 *retPathX = (int32 *)malloc(4096 * sizeof(int32));
- int32 *retPathY = (int32 *)malloc(4096 * sizeof(int32));
- if (!retPathX || !retPathY) {
- free(retPathX);
- free(retPathY);
-
- error("[PathFinding::findPath] Cannot allocate pathfinding buffers");
- }
-
- int32 numpath = 0;
+ Common::Array<Common::Point> retPath;
+ retPath.push_back(Common::Point(curX, curY));
- retPathX[numpath] = curX;
- retPathY[numpath] = curY;
- numpath++;
- int32 bestscore = sq[destx + desty * _width];
+ uint16 bestscore = _sq[destx + desty * _width];
- while (1) {
- int32 bestX = -1;
- int32 bestY = -1;
+ bool retVal = false;
+ while (true) {
+ int16 bestX = -1;
+ int16 bestY = -1;
- int32 endX = MIN<int32>(curX + 1, _width - 1);
- int32 endY = MIN<int32>(curY + 1, _height - 1);
- int32 startX = MAX<int32>(curX - 1, 0);
- int32 startY = MAX<int32>(curY - 1, 0);
+ int16 endX = MIN<int16>(curX + 1, _width - 1);
+ int16 endY = MIN<int16>(curY + 1, _height - 1);
+ int16 startX = MAX<int16>(curX - 1, 0);
+ int16 startY = MAX<int16>(curY - 1, 0);
- for (int32 px = startX; px <= endX; px++) {
- for (int32 py = startY; py <= endY; py++) {
+ for (int16 px = startX; px <= endX; px++) {
+ for (int16 py = startY; py <= endY; py++) {
if (px != curX || py != curY) {
- wei = abs(px - curX) + abs(py - curY);
-
- int PNode = px + py * _width;
- if (sq[PNode] && (isWalkable(px, py))) {
- if (sq[PNode] < bestscore) {
- bestscore = sq[PNode];
+ int32 PNode = px + py * _width;
+ if (_sq[PNode] && (isWalkable(px, py))) {
+ if (_sq[PNode] < bestscore) {
+ bestscore = _sq[PNode];
bestX = px;
bestY = py;
}
@@ -397,57 +392,33 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) {
}
}
- if (bestX < 0 || bestY < 0) {
- free(retPathX);
- free(retPathY);
-
- return 0;
- }
+ if (bestX < 0 || bestY < 0)
+ break;
- retPathX[numpath] = bestX;
- retPathY[numpath] = bestY;
- numpath++;
+ retPath.push_back(Common::Point(bestX, bestY));
if ((bestX == x && bestY == y)) {
- _gridPathCount = numpath;
-
- memcpy(_tempPathX, retPathX, sizeof(int32) * numpath);
- memcpy(_tempPathY, retPathY, sizeof(int32) * numpath);
-
- free(retPathX);
- free(retPathY);
+ _tempPath.clear();
+ for (uint32 i = 0; i < retPath.size(); i++)
+ _tempPath.push_back(retPath[i]);
- return true;
+ retVal = true;
+ break;
}
curX = bestX;
curY = bestY;
}
- free(retPathX);
- free(retPathY);
-
- return false;
+ return retVal;
}
-void PathFinding::init(Picture *mask) {
- debugC(1, kDebugPath, "init(mask)");
-
- _width = mask->getWidth();
- _height = mask->getHeight();
- _currentMask = mask;
- _heap->unload();
- _heap->init(500);
- delete[] _gridTemp;
- _gridTemp = new int32[_width*_height];
-}
-
-void PathFinding::resetBlockingRects() {
- _numBlockingRects = 0;
-}
-
-void PathFinding::addBlockingRect(int32 x1, int32 y1, int32 x2, int32 y2) {
+void PathFinding::addBlockingRect(int16 x1, int16 y1, int16 x2, int16 y2) {
debugC(1, kDebugPath, "addBlockingRect(%d, %d, %d, %d)", x1, y1, x2, y2);
+ if (_numBlockingRects >= kMaxBlockingRects) {
+ warning("Maximum number of %d Blocking Rects reached!", kMaxBlockingRects);
+ return;
+ }
_blockingRects[_numBlockingRects][0] = x1;
_blockingRects[_numBlockingRects][1] = y1;
@@ -457,8 +428,12 @@ void PathFinding::addBlockingRect(int32 x1, int32 y1, int32 x2, int32 y2) {
_numBlockingRects++;
}
-void PathFinding::addBlockingEllipse(int32 x1, int32 y1, int32 w, int32 h) {
- debugC(1, kDebugPath, "addBlockingRect(%d, %d, %d, %d)", x1, y1, w, h);
+void PathFinding::addBlockingEllipse(int16 x1, int16 y1, int16 w, int16 h) {
+ debugC(1, kDebugPath, "addBlockingEllipse(%d, %d, %d, %d)", x1, y1, w, h);
+ if (_numBlockingRects >= kMaxBlockingRects) {
+ warning("Maximum number of %d Blocking Rects reached!", kMaxBlockingRects);
+ return;
+ }
_blockingRects[_numBlockingRects][0] = x1;
_blockingRects[_numBlockingRects][1] = y1;
@@ -468,16 +443,4 @@ void PathFinding::addBlockingEllipse(int32 x1, int32 y1, int32 w, int32 h) {
_numBlockingRects++;
}
-int32 PathFinding::getPathNodeCount() const {
- return _gridPathCount;
-}
-
-int32 PathFinding::getPathNodeX(int32 nodeId) const {
- return _tempPathX[ _gridPathCount - nodeId - 1];
-}
-
-int32 PathFinding::getPathNodeY(int32 nodeId) const {
- return _tempPathY[ _gridPathCount - nodeId - 1];
-}
-
} // End of namespace Toon
diff --git a/engines/toon/path.h b/engines/toon/path.h
index 2de58064f0..59f74ef286 100644
--- a/engines/toon/path.h
+++ b/engines/toon/path.h
@@ -23,72 +23,75 @@
#ifndef TOON_PATH_H
#define TOON_PATH_H
+#include "common/array.h"
+#include "common/rect.h"
+
#include "toon/toon.h"
namespace Toon {
// binary heap system for fast A*
-struct HeapDataGrid {
- int16 _x, _y;
- int16 _weight;
-};
-
class PathFindingHeap {
public:
PathFindingHeap();
~PathFindingHeap();
- void push(int32 x, int32 y, int32 weight);
- void pop(int32 *x, int32 *y, int32 *weight);
+ void push(int16 x, int16 y, uint16 weight);
+ void pop(int16 *x, int16 *y, uint16 *weight);
void init(int32 size);
void clear();
void unload();
- int32 getCount() { return _count; }
+ uint32 getCount() { return _count; }
private:
+ struct HeapDataGrid {
+ int16 _x, _y;
+ uint16 _weight;
+ };
+
HeapDataGrid *_data;
- int32 _size;
- int32 _count;
+ uint32 _size;
+ uint32 _count;
};
class PathFinding {
public:
- PathFinding(ToonEngine *vm);
+ PathFinding();
~PathFinding();
- int32 findPath(int32 x, int32 y, int32 destX, int32 destY);
- int32 findClosestWalkingPoint(int32 xx, int32 yy, int32 *fxx, int32 *fyy, int origX = -1, int origY = -1);
- bool isWalkable(int32 x, int32 y);
- bool isLikelyWalkable(int32 x, int32 y);
- bool lineIsWalkable(int32 x, int32 y, int32 x2, int32 y2);
- bool walkLine(int32 x, int32 y, int32 x2, int32 y2);
void init(Picture *mask);
- void resetBlockingRects();
- void addBlockingRect(int32 x1, int32 y1, int32 x2, int32 y2);
- void addBlockingEllipse(int32 x1, int32 y1, int32 w, int32 h);
+ bool findPath(int16 x, int16 y, int16 destX, int16 destY);
+ bool findClosestWalkingPoint(int16 xx, int16 yy, int16 *fxx, int16 *fyy, int16 origX = -1, int16 origY = -1);
+ bool isWalkable(int16 x, int16 y);
+ bool isLikelyWalkable(int16 x, int16 y);
+ bool lineIsWalkable(int16 x, int16 y, int16 x2, int16 y2);
+ void walkLine(int16 x, int16 y, int16 x2, int16 y2);
+
+ void resetBlockingRects() { _numBlockingRects = 0; }
+ void addBlockingRect(int16 x1, int16 y1, int16 x2, int16 y2);
+ void addBlockingEllipse(int16 x1, int16 y1, int16 w, int16 h);
+
+ uint32 getPathNodeCount() const { return _tempPath.size(); }
+ int16 getPathNodeX(uint32 nodeId) const { return _tempPath[(_tempPath.size() - 1) - nodeId].x; }
+ int16 getPathNodeY(uint32 nodeId) const { return _tempPath[(_tempPath.size() - 1) - nodeId].y; }
+
+private:
+ static const uint8 kMaxBlockingRects = 16;
- int32 getPathNodeCount() const;
- int32 getPathNodeX(int32 nodeId) const;
- int32 getPathNodeY(int32 nodeId) const;
-protected:
Picture *_currentMask;
PathFindingHeap *_heap;
- int32 *_gridTemp;
- int32 _width;
- int32 _height;
+ uint16 *_sq;
+ int16 _width;
+ int16 _height;
- int32 _tempPathX[4096];
- int32 _tempPathY[4096];
- int32 _blockingRects[16][5];
- int32 _numBlockingRects;
- int32 _allocatedGridPathCount;
- int32 _gridPathCount;
+ Common::Array<Common::Point> _tempPath;
- ToonEngine *_vm;
+ int16 _blockingRects[kMaxBlockingRects][5];
+ uint8 _numBlockingRects;
};
} // End of namespace Toon
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index ff136e5acb..f59cdca064 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -71,7 +71,7 @@ bool Picture::loadPicture(const Common::String &file) {
_data = new uint8[decSize + 100];
_paletteEntries = READ_LE_UINT16(fileData + 14) / 3;
_useFullPalette = (_paletteEntries == 256);
-
+
if (_paletteEntries) {
_palette = new uint8[_paletteEntries * 3];
memcpy(_palette, fileData + 16, _paletteEntries * 3);
@@ -150,7 +150,7 @@ void Picture::setupPalette() {
_vm->setPaletteEntries(_palette, 1, 128);
}
-void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy) {
+void Picture::drawMask(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy) {
debugC(1, kDebugPicture, "drawMask(surface, %d, %d, %d, %d)", x, y, dx, dy);
for (int32 i = 0; i < 128; i++) {
@@ -161,8 +161,8 @@ void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, i
_vm->setPaletteEntries(color, i, 1);
}
- int32 rx = MIN(_width, surface.w - x);
- int32 ry = MIN(_height, surface.h - y);
+ int16 rx = MIN<int16>(_width, surface.w - x);
+ int16 ry = MIN<int16>(_height, surface.h - y);
if (rx < 0 || ry < 0)
return;
@@ -172,10 +172,10 @@ void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, i
uint8 *c = _data + _width * dy + dx;
uint8 *curRow = (uint8 *)surface.pixels + y * destPitch + x;
- for (int32 yy = 0; yy < ry; yy++) {
+ for (int16 yy = 0; yy < ry; yy++) {
uint8 *curSrc = c;
uint8 *cur = curRow;
- for (int32 xx = 0; xx < rx; xx++) {
+ for (int16 xx = 0; xx < rx; xx++) {
//*cur = (*curSrc >> 5) * 8; // & 0x1f;
*cur = (*curSrc & 0x1f) ? 127 : 0;
@@ -187,10 +187,9 @@ void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, i
}
}
-void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int32 dx, int32 dy, Common::Array<Common::Rect>& rectArray) {
-
- int32 rx = MIN(_width, surface.w - x);
- int32 ry = MIN(_height, surface.h - y);
+void Picture::drawWithRectList(Graphics::Surface& surface, int16 x, int16 y, int16 dx, int16 dy, Common::Array<Common::Rect>& rectArray) {
+ int16 rx = MIN<int16>(_width, surface.w - x);
+ int16 ry = MIN<int16>(_height, surface.h - y);
if (rx < 0 || ry < 0)
return;
@@ -202,16 +201,16 @@ void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int
Common::Rect rect = rectArray[i];
- int32 fillRx = MIN<int32>(rx, rect.right - rect.left);
- int32 fillRy = MIN<int32>(ry, rect.bottom - rect.top);
+ int16 fillRx = MIN<int32>(rx, rect.right - rect.left);
+ int16 fillRy = MIN<int32>(ry, rect.bottom - rect.top);
uint8 *c = _data + _width * (dy + rect.top) + (dx + rect.left);
uint8 *curRow = (uint8 *)surface.pixels + (y + rect.top) * destPitch + (x + rect.left);
- for (int32 yy = 0; yy < fillRy; yy++) {
+ for (int16 yy = 0; yy < fillRy; yy++) {
uint8 *curSrc = c;
uint8 *cur = curRow;
- for (int32 xx = 0; xx < fillRx; xx++) {
+ for (int16 xx = 0; xx < fillRx; xx++) {
*cur = *curSrc;
curSrc++;
cur++;
@@ -222,11 +221,11 @@ void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int
}
}
-void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy) {
+void Picture::draw(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy) {
debugC(6, kDebugPicture, "draw(surface, %d, %d, %d, %d)", x, y, dx, dy);
- int32 rx = MIN(_width, surface.w - x);
- int32 ry = MIN(_height, surface.h - y);
+ int16 rx = MIN<int16>(_width, surface.w - x);
+ int16 ry = MIN<int16>(_height, surface.h - y);
if (rx < 0 || ry < 0)
return;
@@ -236,10 +235,10 @@ void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32
uint8 *c = _data + _width * dy + dx;
uint8 *curRow = (uint8 *)surface.pixels + y * destPitch + x;
- for (int32 yy = 0; yy < ry; yy++) {
+ for (int16 yy = 0; yy < ry; yy++) {
uint8 *curSrc = c;
uint8 *cur = curRow;
- for (int32 xx = 0; xx < rx; xx++) {
+ for (int16 xx = 0; xx < rx; xx++) {
*cur = *curSrc;
curSrc++;
cur++;
@@ -249,7 +248,7 @@ void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32
}
}
-uint8 Picture::getData(int32 x, int32 y) {
+uint8 Picture::getData(int16 x, int16 y) {
debugC(6, kDebugPicture, "getData(%d, %d)", x, y);
if (!_data)
@@ -259,7 +258,7 @@ uint8 Picture::getData(int32 x, int32 y) {
}
// use original work from johndoe
-void Picture::floodFillNotWalkableOnMask(int32 x, int32 y) {
+void Picture::floodFillNotWalkableOnMask(int16 x, int16 y) {
debugC(1, kDebugPicture, "floodFillNotWalkableOnMask(%d, %d)", x, y);
// Stack-based floodFill algorithm based on
// http://student.kuleuven.be/~m0216922/CG/files/floodfill.cpp
@@ -292,10 +291,10 @@ void Picture::floodFillNotWalkableOnMask(int32 x, int32 y) {
}
}
-void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable) {
+void Picture::drawLineOnMask(int16 x, int16 y, int16 x2, int16 y2, bool walkable) {
debugC(1, kDebugPicture, "drawLineOnMask(%d, %d, %d, %d, %d)", x, y, x2, y2, (walkable) ? 1 : 0);
- static int32 lastX = 0;
- static int32 lastY = 0;
+ static int16 lastX = 0;
+ static int16 lastY = 0;
if (x == -1) {
x = lastX;
@@ -303,12 +302,12 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable
}
uint32 bx = x << 16;
- int32 dx = x2 - x;
+ int16 dx = x2 - x;
uint32 by = y << 16;
- int32 dy = y2 - y;
- uint32 adx = abs(dx);
- uint32 ady = abs(dy);
- int32 t = 0;
+ int16 dy = y2 - y;
+ uint16 adx = abs(dx);
+ uint16 ady = abs(dy);
+ int16 t = 0;
if (adx <= ady)
t = ady;
else
@@ -317,9 +316,7 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable
int32 cdx = (dx << 16) / t;
int32 cdy = (dy << 16) / t;
- int32 i = t;
- while (i) {
-
+ for (int16 i = t; i > 0; i--) {
int32 rx = bx >> 16;
int32 ry = by >> 16;
@@ -337,7 +334,6 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable
bx += cdx;
by += cdy;
- i--;
}
}
} // End of namespace Toon
diff --git a/engines/toon/picture.h b/engines/toon/picture.h
index 460c5b58a2..5e79612a39 100644
--- a/engines/toon/picture.h
+++ b/engines/toon/picture.h
@@ -33,25 +33,27 @@
namespace Toon {
class ToonEngine;
-class Picture {
+class Picture {
public:
Picture(ToonEngine *vm);
~Picture();
+
bool loadPicture(const Common::String &file);
void setupPalette();
- void draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy);
- void drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int32 dx, int32 dy, Common::Array<Common::Rect>& rectArray);
- void drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy);
- void drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable);
- void floodFillNotWalkableOnMask(int32 x, int32 y);
- uint8 getData(int32 x, int32 y);
+ void draw(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy);
+ void drawWithRectList(Graphics::Surface& surface, int16 x, int16 y, int16 dx, int16 dy, Common::Array<Common::Rect>& rectArray);
+ void drawMask(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy);
+ void drawLineOnMask(int16 x, int16 y, int16 x2, int16 y2, bool walkable);
+ void floodFillNotWalkableOnMask(int16 x, int16 y);
+ uint8 getData(int16 x, int16 y);
uint8 *getDataPtr() { return _data; }
- int32 getWidth() const { return _width; }
- int32 getHeight() const { return _height; }
+ int16 getWidth() const { return _width; }
+ int16 getHeight() const { return _height; }
+
protected:
- int32 _width;
- int32 _height;
+ int16 _width;
+ int16 _height;
uint8 *_data;
uint8 *_palette; // need to be copied at 3-387
int32 _paletteEntries;
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index e9b7534198..1fa4058114 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -564,9 +564,9 @@ int32 ScriptFunc::sys_Cmd_Exit_Conversation(EMCState *state) {
int32 ScriptFunc::sys_Cmd_Set_Mouse_Pos(EMCState *state) {
if (_vm->state()->_inCloseUp) {
- _vm->getSystem()->warpMouse(stackPos(0), stackPos(1));
+ _vm->_system->warpMouse(stackPos(0), stackPos(1));
} else {
- _vm->getSystem()->warpMouse(stackPos(0) - _vm->state()->_currentScrollValue, stackPos(1));
+ _vm->_system->warpMouse(stackPos(0) - _vm->state()->_currentScrollValue, stackPos(1));
}
return 0;
}
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 657e18635f..9fd8415676 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -51,7 +51,7 @@ void ToonEngine::init() {
_currentScriptRegion = 0;
_resources = new Resources(this);
_animationManager = new AnimationManager(this);
- _moviePlayer = new Movie(this, new ToonstruckSmackerDecoder(_mixer));
+ _moviePlayer = new Movie(this, new ToonstruckSmackerDecoder());
_hotspots = new Hotspots(this);
_mainSurface = new Graphics::Surface();
@@ -100,7 +100,7 @@ void ToonEngine::init() {
syncSoundSettings();
- _pathFinding = new PathFinding(this);
+ _pathFinding = new PathFinding();
resources()->openPackage("LOCAL.PAK");
resources()->openPackage("ONETIME.PAK");
@@ -168,7 +168,7 @@ void ToonEngine::waitForScriptStep() {
// Wait after a specified number of script steps when executing a script
// to lower CPU usage
if (++_scriptStep >= 40) {
- g_system->delayMillis(1);
+ _system->delayMillis(1);
_scriptStep = 0;
}
}
@@ -820,7 +820,6 @@ Common::Error ToonEngine::run() {
ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
: Engine(syst), _gameDescription(gameDescription),
_language(gameDescription->language), _rnd("toon") {
- _system = syst;
_tickLength = 16;
_currentPicture = NULL;
_inventoryPicture = NULL;
@@ -1224,7 +1223,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
_script->init(&_sceneAnimationScripts[i]._state, _sceneAnimationScripts[i]._data);
if (!forGameLoad) {
_script->start(&_sceneAnimationScripts[i]._state, 9 + i);
- _sceneAnimationScripts[i]._lastTimer = getSystem()->getMillis();
+ _sceneAnimationScripts[i]._lastTimer = _system->getMillis();
_sceneAnimationScripts[i]._frozen = false;
_sceneAnimationScripts[i]._frozenForConversation = false;
}
@@ -1488,7 +1487,7 @@ void ToonEngine::clickEvent() {
}
if (!currentHot) {
- int32 xx, yy;
+ int16 xx, yy;
if (_gameState->_inCutaway || _gameState->_inInventory || _gameState->_inCloseUp)
return;
@@ -1588,12 +1587,12 @@ void ToonEngine::clickEvent() {
}
void ToonEngine::selectHotspot() {
- int32 x1 = 0;
- int32 x2 = 0;
- int32 y1 = 0;
- int32 y2 = 0;
+ int16 x1 = 0;
+ int16 x2 = 0;
+ int16 y1 = 0;
+ int16 y2 = 0;
- int32 mouseX = _mouseX;
+ int16 mouseX = _mouseX;
if (_gameState->_inCutaway)
mouseX += TOON_BACKBUFFER_WIDTH;
@@ -1693,7 +1692,6 @@ void ToonEngine::selectHotspot() {
}
void ToonEngine::exitScene() {
-
fadeOut(5);
// disable all scene animation
@@ -2831,7 +2829,6 @@ void ToonEngine::playSoundWrong() {
}
void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) {
-
if (characterId < 0)
characterId = 0;
@@ -2852,8 +2849,8 @@ void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) {
}
} else if (characterId == 1) {
// flux
- int32 x = _flux->getX();
- int32 y = _flux->getY();
+ int16 x = _flux->getX();
+ int16 y = _flux->getY();
if (x >= _gameState->_currentScrollValue && x <= _gameState->_currentScrollValue + TOON_SCREEN_WIDTH) {
if (!_gameState->_inCutaway) {
*retX = x;
@@ -2885,7 +2882,7 @@ void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) {
if (character && !_gameState->_inCutaway) {
if (character->getAnimationInstance()) {
if (character->getX() >= _gameState->_currentScrollValue && character->getX() <= _gameState->_currentScrollValue + TOON_SCREEN_WIDTH) {
- int32 x1, y1, x2, y2;
+ int16 x1, y1, x2, y2;
character->getAnimationInstance()->getRect(&x1, &y1, &x2, &y2);
*retX = (x1 + x2) / 2;
*retY = y1;
@@ -2896,7 +2893,6 @@ void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) {
}
Character *ToonEngine::getCharacterById(int32 charId) {
-
for (int32 i = 0; i < 8; i++) {
if (_characters[i] && _characters[i]->getId() == charId)
return _characters[i];
@@ -2955,15 +2951,12 @@ Common::String ToonEngine::getSavegameName(int nr) {
}
bool ToonEngine::saveGame(int32 slot, const Common::String &saveGameDesc) {
- const EnginePlugin *plugin = NULL;
int16 savegameId;
Common::String savegameDescription;
- EngineMan.findGame(_gameDescription->gameid, &plugin);
if (slot == -1) {
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
- dialog->setSaveMode(true);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true);
+ savegameId = dialog->runModalWithCurrentTarget();
savegameDescription = dialog->getResultString();
delete dialog;
} else {
@@ -2979,8 +2972,7 @@ bool ToonEngine::saveGame(int32 slot, const Common::String &saveGameDesc) {
return false; // dialog aborted
Common::String savegameFile = getSavegameName(savegameId);
- Common::SaveFileManager *saveMan = g_system->getSavefileManager();
- Common::OutSaveFile *saveFile = saveMan->openForSaving(savegameFile);
+ Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(savegameFile);
if (!saveFile)
return false;
@@ -3052,14 +3044,11 @@ bool ToonEngine::saveGame(int32 slot, const Common::String &saveGameDesc) {
}
bool ToonEngine::loadGame(int32 slot) {
- const EnginePlugin *plugin = NULL;
int16 savegameId;
- EngineMan.findGame(_gameDescription->gameid, &plugin);
if (slot == -1) {
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
- dialog->setSaveMode(false);
- savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false);
+ savegameId = dialog->runModalWithCurrentTarget();
delete dialog;
} else {
savegameId = slot;
@@ -3068,8 +3057,7 @@ bool ToonEngine::loadGame(int32 slot) {
return false; // dialog aborted
Common::String savegameFile = getSavegameName(savegameId);
- Common::SaveFileManager *saveMan = g_system->getSavefileManager();
- Common::InSaveFile *loadFile = saveMan->openForLoading(savegameFile);
+ Common::InSaveFile *loadFile = _saveFileMan->openForLoading(savegameFile);
if (!loadFile)
return false;
diff --git a/engines/toon/toon.h b/engines/toon/toon.h
index 540f3e403b..d40c489011 100644
--- a/engines/toon/toon.h
+++ b/engines/toon/toon.h
@@ -289,10 +289,6 @@ public:
return _oldTimer2;
}
- OSystem *getSystem() {
- return _system;
- }
-
AudioManager *getAudioManager() {
return _audioManager;
}
@@ -340,7 +336,6 @@ public:
void clearDirtyRects();
protected:
- OSystem *_system;
int32 _tickLength;
Resources *_resources;
TextResource *_genericTexts;
diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp
index 35dd54776f..e4bbe0c4c1 100644
--- a/engines/touche/detection.cpp
+++ b/engines/touche/detection.cpp
@@ -135,19 +135,13 @@ public:
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
- const ADGameDescription *matchedDesc = detectGameFilebased(allFiles, Touche::fileBasedFallback);
-
- if (matchedDesc) { // We got a match
- Common::String report = Common::String::format(_("Your game version has been detected using "
- "filename matching as a variant of %s."), matchedDesc->gameid);
- report += "\n";
- report += _("If this is an original and unmodified version, please report any");
- report += "\n";
- report += _("information previously printed by ScummVM to the team.");
- report += "\n";
- g_system->logMessage(LogMessageType::kInfo, report.c_str());
- }
+ ADFilePropertiesMap filesProps;
+
+ const ADGameDescription *matchedDesc = detectGameFilebased(allFiles, fslist, Touche::fileBasedFallback, &filesProps);
+ if (!matchedDesc)
+ return 0;
+ reportUnknown(fslist.begin()->getParent(), filesProps);
return matchedDesc;
}
diff --git a/engines/touche/staticres.cpp b/engines/touche/staticres.cpp
index c18a947358..23b76558e4 100644
--- a/engines/touche/staticres.cpp
+++ b/engines/touche/staticres.cpp
@@ -471,7 +471,10 @@ const uint16 Graphics::_freGerFontOffs[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x1920
+ 0x0000, 0x0000, 0x0000, 0x1920, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000
};
const int Graphics::_freGerFontSize = ARRAYSIZE(Graphics::_freGerFontOffs);
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
index a76d5839a9..23701c9e5b 100644
--- a/engines/tsage/blue_force/blueforce_dialogs.cpp
+++ b/engines/tsage/blue_force/blueforce_dialogs.cpp
@@ -88,7 +88,7 @@ RightClickDialog::~RightClickDialog() {
void RightClickDialog::draw() {
// Save the covered background area
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
// Draw the dialog image
g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
@@ -323,7 +323,7 @@ void AmmoBeltDialog::draw() {
if (!_savedArea) {
// Save the covered background area
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
} else {
bounds.moveTo(0, 0);
}
diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp
index 22c831f531..81e4af6e97 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes3.cpp
@@ -346,6 +346,14 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
break;
}
+ if (BF_GLOBALS.getFlag(onBike) && !BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._sound1.play(30);
+ } else if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne)) {
+ BF_GLOBALS._sound1.changeSound(49);
+ } else if (BF_GLOBALS._sceneManager._previousScene != 190) {
+ BF_GLOBALS._sound1.changeSound(33);
+ }
+
_item10.setDetails(4, 300, 7, 13, 16, 1);
_item11.setDetails(2, 300, 9, 13, 18, 1);
_item12.setDetails(5, 300, 10, 13, 19, 1);
diff --git a/engines/tsage/blue_force/blueforce_scenes7.cpp b/engines/tsage/blue_force/blueforce_scenes7.cpp
index bb29ad1f34..4cdd2f3f15 100644
--- a/engines/tsage/blue_force/blueforce_scenes7.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes7.cpp
@@ -159,7 +159,7 @@ void Scene710::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_skipSpeaker);
_stripManager.addSpeaker(&_lauraSpeaker);
_stripManager.addSpeaker(&_gameTextSpeaker);
-
+
_kid.postInit();
_kid._moveDiff = Common::Point(4, 2);
_laura.postInit();
diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp
index 2178f31b30..1cb8191640 100644
--- a/engines/tsage/blue_force/blueforce_scenes9.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes9.cpp
@@ -794,12 +794,12 @@ bool Scene910::Lyle::startAction(CursorType action, Event &event) {
Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
if (action == CURSOR_USE) {
- if (BF_GLOBALS._v4CEE2 == 0)
+ if (BF_GLOBALS._nico910State == 0)
return NamedObject::startAction(action, event);
else
return false;
} else if (action == CURSOR_TALK) {
- if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._v4CEE2 != 0)) {
+ if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._nico910State != 0)) {
scene->_stripManager.start(9100 + _field90, &BF_GLOBALS._stripProxy);
if (_field90 < 1)
_field90++;
@@ -833,7 +833,7 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
return true;
break;
case CURSOR_TALK:
- if (BF_GLOBALS._v4CEE2 >= 4)
+ if (BF_GLOBALS._nico910State >= 4)
return NamedObject::startAction(action, event);
if (BF_GLOBALS._v4CEE6 < 4)
@@ -847,8 +847,8 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
return true;
break;
case INV_COLT45:
- if (BF_GLOBALS._v4CEE2 > 1) {
- if (BF_GLOBALS._v4CEE2 != 4) {
+ if (BF_GLOBALS._nico910State > 1) {
+ if (BF_GLOBALS._nico910State != 4) {
if ((BF_GLOBALS.getFlag(gunDrawn)) && (BF_GLOBALS.getFlag(fGunLoaded)) && (BF_GLOBALS.getHasBullets())) {
if (scene->_field2DE0 == 0) {
BF_GLOBALS._player.disableControl();
@@ -880,7 +880,7 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
break;
case INV_BADGE:
case INV_ID:
- if (BF_GLOBALS._v4CEE2 >= 4)
+ if (BF_GLOBALS._nico910State >= 4)
return NamedObject::startAction(action, event);
if (BF_GLOBALS._v4CEE6 < 4)
@@ -895,11 +895,12 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
return true;
break;
case INV_YELLOW_CORD:
- if (BF_GLOBALS._v4CEE2 < 4) {
+ if (BF_GLOBALS._nico910State < 4) {
BF_GLOBALS._player.disableControl();
scene->_yellowCord.fixPriority(121);
scene->_sceneSubMode = 10;
scene->_sceneMode = 9123;
+ BF_GLOBALS._nico910State = 3;
if (BF_GLOBALS._player._visage == 1911)
scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
else
@@ -995,7 +996,7 @@ bool Scene910::Stuart::startAction(CursorType action, Event &event) {
return true;
} else {
BF_GLOBALS._player.disableControl();
- if (BF_GLOBALS._v4CEE2 == 4) {
+ if (BF_GLOBALS._nico910State == 4) {
scene->_sceneSubMode = 11;
scene->_sceneMode = 9123;
if (BF_GLOBALS._player._visage == 1911)
@@ -1136,7 +1137,7 @@ bool Scene910::BreakerBox::startAction(CursorType action, Event &event) {
SceneItem::display2(910, 62);
return true;
} else if (scene->_sceneMode != 9120) {
- if (BF_GLOBALS._v4CEE2 == 1) {
+ if (BF_GLOBALS._nico910State == 1) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9118;
scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL);
@@ -1291,7 +1292,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) {
switch (_state) {
case 1:
- if (BF_GLOBALS._v4CEE2 < 1) {
+ if (BF_GLOBALS._nico910State < 1) {
if (_frame == 2) {
if (!BF_GLOBALS.getFlag(fGotPointsForClosingDoor)) {
T2_GLOBALS._uiElements.addScore(30);
@@ -1299,7 +1300,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) {
}
scene->_sceneMode = 0;
if (BF_GLOBALS._dayNumber == 5) {
- if (BF_GLOBALS._v4CEE2 == 0) {
+ if (BF_GLOBALS._nico910State == 0) {
scene->_breakerBoxInset.remove();
// _objectList.draw();
BF_GLOBALS._player.disableControl();
@@ -1309,7 +1310,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) {
scene->_nico.postInit();
scene->_sceneMode = 9129;
scene->setAction(&scene->_sequenceManager1, scene, 9129, &BF_GLOBALS._player, &scene->_nico, NULL);
- } else if (BF_GLOBALS._v4CEE2 == 2) {
+ } else if (BF_GLOBALS._nico910State == 2) {
scene->_breakerBoxInset.remove();
// _objectList.draw();
BF_GLOBALS._player.disableControl();
@@ -1612,7 +1613,7 @@ bool Scene910::BlackPlug::startAction(CursorType action, Event &event) {
SET_EXT_FGCOLOR, 13, LIST_END);
return true;
}
- if (BF_GLOBALS._v4CEE2 == 3) {
+ if (BF_GLOBALS._nico910State == 3) {
SceneItem::display(910, 84, SET_WIDTH, 312,
SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
@@ -1830,7 +1831,7 @@ bool Scene910::Generator::startAction(CursorType action, Event &event) {
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
SET_EXT_FGCOLOR, 13, LIST_END);
- else if (BF_GLOBALS._v4CEE2 == 1) {
+ else if (BF_GLOBALS._nico910State == 1) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9118;
scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL);
@@ -1869,7 +1870,7 @@ bool Scene910::Item2::startAction(CursorType action, Event &event) {
bool Scene910::Item3::startAction(CursorType action, Event &event) {
Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
- if ((action == CURSOR_TALK) && (BF_GLOBALS._v4CEE2 == 4) && (BF_GLOBALS._v4CEE4 == 0)) {
+ if ((action == CURSOR_TALK) && (BF_GLOBALS._nico910State == 4) && (BF_GLOBALS._v4CEE4 == 0)) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 15;
scene->_stripManager.start(9102, scene);
@@ -1907,7 +1908,7 @@ bool Scene910::Item15::startAction(CursorType action, Event &event) {
bool Scene910::Item16::startAction(CursorType action, Event &event) {
Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
- if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0))
+ if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._nico910State != 0))
return false;
if (BF_GLOBALS._player._visage == 1911) {
@@ -2016,7 +2017,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
if (BF_GLOBALS._dayNumber < 5)
_item17.setDetails(Rect(0, 149, 29, 167), 910, -1, -1, -1, 1, NULL);
- if (BF_GLOBALS._v4CEE2 == 0)
+ if (BF_GLOBALS._nico910State == 0)
_item16.setDetails(Rect(265, 18, 319, 102), 910, -1, -1, -1, 1, NULL);
_breakerBox.setDetails(910, 6, -1, -1, 1, (SceneItem *)NULL);
@@ -2048,7 +2049,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
|| (BF_GLOBALS._sceneManager._previousScene == 190)
|| (BF_GLOBALS._sceneManager._previousScene == 300)) {
BF_GLOBALS._sceneManager._previousScene = 900;
- BF_GLOBALS._v4CEE2 = 0;
+ BF_GLOBALS._nico910State = 0;
BF_GLOBALS._v4CEE4 = 0;
}
@@ -2142,7 +2143,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
_nico.setPosition(Common::Point(262, 124));
_nico.setStrip(6);
BF_GLOBALS._v4CEE6 = 0;
- BF_GLOBALS._v4CEE2 = 1;
+ BF_GLOBALS._nico910State = 1;
_nico.setDetails(910, 63, 64, 67, 5, &_item4);
BF_GLOBALS._v4CECA = 2;
if (BF_GLOBALS._v4CECC == 0)
@@ -2157,7 +2158,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.disableControl();
}
- if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)){
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)){
_shadow.postInit();
_shadow.setAction(&_action2);
}
@@ -2297,7 +2298,7 @@ void Scene910::signal() {
case 13:
BF_GLOBALS._player.disableControl();
BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 9117, &_nico, NULL);
- BF_GLOBALS._v4CEE2 = 2;
+ BF_GLOBALS._nico910State = 2;
// No break on purpose
case 15:
_stuart.postInit();
@@ -2314,7 +2315,7 @@ void Scene910::signal() {
_lyle._field90 = 1;
_sceneMode = 10;
addFader((const byte *)&black, 2, this);
- BF_GLOBALS._v4CEE2 = 1;
+ BF_GLOBALS._nico910State = 1;
BF_GLOBALS._walkRegions.disableRegion(16);
BF_GLOBALS._walkRegions.disableRegion(14);
BF_GLOBALS._sceneItems.remove(&_item16);
@@ -2324,7 +2325,7 @@ void Scene910::signal() {
BF_GLOBALS._player._frame = 1;
if (_field2DE2 == 0) {
_field2DE2 = 1;
- if (BF_GLOBALS._v4CEE2 == 4) {
+ if (BF_GLOBALS._nico910State == 4) {
_sceneMode = 9149;
setAction(&_sequenceManager1, this, 9149, &BF_GLOBALS._player, NULL);
} else {
@@ -2452,7 +2453,7 @@ void Scene910::signal() {
break;
case 9114:
_fakeWall.hide();
- if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) {
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)) {
BF_GLOBALS._player.disableControl();
_nico.postInit();
_nico.setDetails(910, 63, 64, 65, 5, &_item4);
@@ -2496,7 +2497,7 @@ void Scene910::signal() {
case 9121:
_item3.setDetails(7, 910, 96, 60, 61, 3);
BF_GLOBALS._v4CEE4 = 2;
- if (BF_GLOBALS._v4CEE2 == 4) {
+ if (BF_GLOBALS._nico910State == 4) {
_sceneMode = 20;
_stripManager.start(9115, this);
} else {
@@ -2527,7 +2528,7 @@ void Scene910::signal() {
setAction(&_sequenceManager1, this, 9111, &BF_GLOBALS._player, &_blackCord, NULL);
break;
case 5:
- switch (BF_GLOBALS._v4CEE2 - 1) {
+ switch (BF_GLOBALS._nico910State - 1) {
case 0:
_sceneMode = 9118;
setAction(&_sequenceManager1, this, 9118, &BF_GLOBALS._player, &_nico, NULL);
@@ -2598,7 +2599,7 @@ void Scene910::signal() {
break;
case 9125:
BF_GLOBALS.setFlag(fBackupAt340);
- BF_GLOBALS._v4CEE2 = 4;
+ BF_GLOBALS._nico910State = 4;
_stuart.postInit();
_nico.setDetails(910, 72, 73, 74, 3, (SceneItem *)NULL);
_stuart.setDetails(910, 66, 67, 68, 5, &_nico);
@@ -2645,7 +2646,7 @@ void Scene910::signal() {
}
_lyle.setAction(&_sequenceManager2, NULL, 9131, &_lyle, NULL);
BF_GLOBALS._walkRegions.enableRegion(16);
- if (BF_GLOBALS._v4CEE2 == 4)
+ if (BF_GLOBALS._nico910State == 4)
BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 0);
else
BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 910);
@@ -2679,7 +2680,7 @@ void Scene910::signal() {
}
break;
case 9143:
- if (BF_GLOBALS._v4CEE2 == 0) {
+ if (BF_GLOBALS._nico910State == 0) {
BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(920);
} else {
@@ -2730,7 +2731,7 @@ void Scene910::process(Event &event) {
if (_item17._bounds.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
BF_GLOBALS._events.setCursor(surface);
- } else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0)) {
+ } else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._nico910State != 0)) {
CursorType cursorId = BF_GLOBALS._events.getCursor();
BF_GLOBALS._events.setCursor(cursorId);
} else if (!_item16._bounds.contains(event.mousePos)) {
@@ -2755,7 +2756,7 @@ void Scene910::process(Event &event) {
_sceneMode = 9123;
setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
event.handled = true;
- } else if (BF_GLOBALS._v4CEE2 <= 1) {
+ } else if (BF_GLOBALS._nico910State <= 1) {
if (BF_GLOBALS.getFlag(fCanDrawGun)) {
BF_GLOBALS._player.addMover(NULL);
BF_GLOBALS._player.disableControl();
@@ -2776,7 +2777,7 @@ void Scene910::process(Event &event) {
event.handled = true;
break;
case CURSOR_WALK:
- if (BF_GLOBALS._v4CEE2 == 1) {
+ if (BF_GLOBALS._nico910State == 1) {
BF_GLOBALS._player.disableControl();
if (BF_GLOBALS._player._visage == 1911) {
BF_GLOBALS._player.disableControl();
@@ -2826,7 +2827,7 @@ void Scene910::dispatch() {
_sceneSubMode = 3;
_sceneMode = 9123;
setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
- } else if (BF_GLOBALS._v4CEE2 == 0) {
+ } else if (BF_GLOBALS._nico910State == 0) {
_sceneMode = 9143;
setAction(&_sequenceManager1, this, 9143, &BF_GLOBALS._player, NULL);
} else {
@@ -2840,7 +2841,7 @@ void Scene910::dispatch() {
}
}
- if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._v4CEE2 == 0)) {
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._nico910State == 0)) {
BF_GLOBALS._player.disableControl();
_shadow.remove();
_nico.remove();
@@ -2853,7 +2854,7 @@ void Scene910::dispatch() {
}
void Scene910::checkGun() {
- if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0) && (BF_GLOBALS._hiddenDoorStatus != 0))
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0) && (BF_GLOBALS._hiddenDoorStatus != 0))
SceneItem::display(910, 70, SET_WIDTH, 312,
SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
@@ -2900,7 +2901,7 @@ void Scene910::closeHiddenDoor() {
setAction(&_sequenceManager1, this, 9115, &_fakeWall, &_object5, NULL);
}
- if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) {
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)) {
// _objectList.draw();
if (BF_GLOBALS._sceneObjects->contains(&_breakerBoxInset))
_breakerBoxInset.remove();
diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp
index 8af18b43b8..2a57616640 100644
--- a/engines/tsage/blue_force/blueforce_speakers.cpp
+++ b/engines/tsage/blue_force/blueforce_speakers.cpp
@@ -809,7 +809,7 @@ void SpeakerGiggles::setText(const Common::String &msg) {
SpeakerFBI::SpeakerFBI(): VisualSpeaker() {
_color1 = 27;
_color2 = 89;
-
+
_speakerName = "FBI";
}
@@ -832,7 +832,7 @@ void SpeakerFBI::setText(const Common::String &msg) {
SpeakerNico::SpeakerNico(): VisualSpeaker() {
_color1 = 105;
_color2 = 102;
-
+
_speakerName = "NICO";
}
@@ -845,7 +845,7 @@ void SpeakerNico::setText(const Common::String &msg) {
_object1.fixPriority(254);
_object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 262,
BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
-
+
_object2.postInit();
_object2.setVisage(905);
_object2.setStrip2(1);
@@ -862,7 +862,7 @@ void SpeakerNico::setText(const Common::String &msg) {
SpeakerDA::SpeakerDA(): VisualSpeaker() {
_color1 = 82;
_color2 = 80;
-
+
_speakerName = "DA";
}
@@ -875,7 +875,7 @@ void SpeakerDA::setText(const Common::String &msg) {
_object1.fixPriority(254);
_object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 84,
BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
-
+
_object2.postInit();
_object2.setVisage(915);
_object2.setStrip2(1);
@@ -892,7 +892,7 @@ void SpeakerDA::setText(const Common::String &msg) {
SpeakerGrandma::SpeakerGrandma(): VisualSpeaker() {
_color1 = 20;
_color2 = 23;
-
+
_speakerName = "GRANDMA";
}
@@ -905,7 +905,7 @@ void SpeakerGrandma::setText(const Common::String &msg) {
_object1.fixPriority(254);
_object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 43,
BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
-
+
_object2.postInit();
_object2.setVisage(274);
_object2.setStrip2(3);
@@ -922,7 +922,7 @@ void SpeakerGrandma::setText(const Common::String &msg) {
SpeakerLyle::SpeakerLyle(): VisualSpeaker() {
_color1 = 29;
_color2 = 89;
-
+
_speakerName = "LYLE";
}
@@ -935,7 +935,7 @@ void SpeakerLyle::setText(const Common::String &msg) {
_object1.fixPriority(254);
_object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 75,
BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
-
+
_object2.postInit();
_object2.setVisage(278);
_object2.setStrip2(1);
@@ -952,7 +952,7 @@ void SpeakerLyle::setText(const Common::String &msg) {
SpeakerGranText::SpeakerGranText(): VisualSpeaker() {
_color1 = 20;
_color2 = 23;
-
+
_speakerName = "GRANTEXT";
}
@@ -961,7 +961,7 @@ SpeakerGranText::SpeakerGranText(): VisualSpeaker() {
SpeakerLyleText::SpeakerLyleText(): VisualSpeaker() {
_color1 = 29;
_color2 = 89;
-
+
_speakerName = "LYLETEXT";
}
@@ -969,7 +969,7 @@ SpeakerLyleText::SpeakerLyleText(): VisualSpeaker() {
SpeakerKate::SpeakerKate(): VisualSpeaker() {
_color1 = 108;
-
+
_speakerName = "KATE";
}
@@ -982,7 +982,7 @@ void SpeakerKate::setText(const Common::String &msg) {
_object1.fixPriority(254);
_object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 270,
BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
-
+
_object2.postInit();
_object2.setVisage(122);
_object2.setStrip2(1);
@@ -1000,7 +1000,7 @@ void SpeakerKate::setText(const Common::String &msg) {
SpeakerTony::SpeakerTony(): VisualSpeaker() {
_color1 = 108;
_color2 = 8;
-
+
_speakerName = "TONY";
}
diff --git a/engines/tsage/blue_force/blueforce_speakers.h b/engines/tsage/blue_force/blueforce_speakers.h
index 508279a929..e406a50fbe 100644
--- a/engines/tsage/blue_force/blueforce_speakers.h
+++ b/engines/tsage/blue_force/blueforce_speakers.h
@@ -290,7 +290,7 @@ public:
virtual Common::String getClassName() { return "FBI"; }
virtual void setText(const Common::String &msg);
};
-
+
class SpeakerNico: public VisualSpeaker {
public:
SpeakerNico();
@@ -340,7 +340,7 @@ public:
class SpeakerKate: public VisualSpeaker {
public:
SpeakerKate();
-
+
virtual Common::String getClassName() { return "SpeakerKate"; }
virtual void setText(const Common::String &msg);
};
@@ -348,7 +348,7 @@ public:
class SpeakerTony: public VisualSpeaker {
public:
SpeakerTony();
-
+
virtual Common::String getClassName() { return "SpeakerTony"; }
virtual void setText(const Common::String &msg);
};
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index 06fbffb751..ba27db9104 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -505,7 +505,7 @@ void ConversationChoiceDialog::draw() {
// Make a backup copy of the area the dialog will occupy
Rect tempRect = _bounds;
tempRect.collapse(-10, -10);
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
// Fill in the contents of the entire dialog
_gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index 0c458f5c35..a35d663b93 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -156,7 +156,7 @@ public:
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
generateGameStateFileName(target, slot));
-
+
if (f) {
TsAGE::tSageSavegameHeader header;
TsAGE::Saver::readSavegameHeader(f, header);
@@ -164,8 +164,6 @@ public:
// Create the return descriptor
SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
desc.setThumbnail(header.thumbnail);
desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay);
desc.setSaveTime(header.saveHour, header.saveMinutes);
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index d538cbacbf..a84ee5662f 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -105,7 +105,7 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("blue.rlb", "17c3993415e8a2cf93040eef7e88ec93", 1156508),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_TESTING,
+ ADGF_UNSTABLE,
GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
@@ -120,7 +120,7 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("blue.rlb", "17eabb456cb1546c66baf1aff387ba6a", 10032614),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
@@ -134,7 +134,7 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("blue.rlb", "99983f48cb218f1f3760cf2f9a7ef11d", 63863322),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_CD | ADGF_TESTING,
+ ADGF_CD,
GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
@@ -150,7 +150,7 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("blue.rlb", "5b2b35c51b62e82d82b0791540bfae2d", 10082565),
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_CD | ADGF_TESTING,
+ ADGF_CD | ADGF_UNSTABLE,
GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index 972d591c34..77ac0a25d7 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -116,7 +116,7 @@ void ModalDialog::draw() {
// Make a backup copy of the area the dialog will occupy
Rect tempRect = _bounds;
tempRect.collapse(-10, -10);
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
_gfxManager.activate();
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 59eb59b194..4589a926c9 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -205,7 +205,7 @@ void Globals::dispatchSounds() {
void TsAGE2Globals::reset() {
Globals::reset();
-
+
// Reset the inventory
T2_GLOBALS._uiElements.updateInventory();
T2_GLOBALS._uiElements._scoreValue = 0;
@@ -247,7 +247,7 @@ void BlueForceGlobals::synchronize(Serializer &s) {
for (int i = 0; i < 18; i++)
s.syncAsByte(_breakerBoxStatusArr[i]);
s.syncAsSint16LE(_hiddenDoorStatus);
- s.syncAsSint16LE(_v4CEE2);
+ s.syncAsSint16LE(_nico910State);
s.syncAsSint16LE(_v4CEE4);
s.syncAsSint16LE(_v4CEE6);
s.syncAsSint16LE(_v4CEE8);
@@ -277,7 +277,7 @@ void BlueForceGlobals::synchronize(Serializer &s) {
void BlueForceGlobals::reset() {
TsAGE2Globals::reset();
_scenePalette.clearListeners();
-
+
_scrollFollower = &_player;
_bookmark = bNone;
@@ -320,7 +320,7 @@ void BlueForceGlobals::reset() {
_breakerBoxStatusArr[16] = 3;
_breakerBoxStatusArr[17] = 0;
_hiddenDoorStatus = 0;
- _v4CEE2 = 0;
+ _nico910State = 0;
_v4CEE4 = 0;
_v4CEE6 = 0;
_v4CEE8 = 0;
@@ -368,7 +368,7 @@ namespace Ringworld2 {
void Ringworld2Globals::reset() {
Globals::reset();
-
+
// Reset the inventory
R2_INVENTORY.reset();
T2_GLOBALS._uiElements.updateInventory();
@@ -526,7 +526,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
for (i = 0; i < MAX_CHARACTERS; ++i)
s.syncAsByte(_v565F1[i]);
-
+
s.syncAsByte(_v565AE);
s.syncAsByte(_v566A4);
s.syncAsByte(_v566A5);
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index 45226c921b..d190b6a2a4 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -200,7 +200,7 @@ public:
int _v4CECC;
int8 _breakerBoxStatusArr[18];
int _hiddenDoorStatus;
- int _v4CEE2;
+ int _nico910State;
int _v4CEE4;
int _v4CEE6;
int _v4CEE8;
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index b3dceba292..fb0b0b0cbb 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -38,7 +38,7 @@ namespace TsAGE {
* @src Source surface
* @bounds Area to backup
*/
-GfxSurface *Surface_getArea(GfxSurface &src, const Rect &bounds) {
+GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds) {
assert(bounds.isValidRect());
GfxSurface *dest = new GfxSurface();
dest->create(bounds.width(), bounds.height());
@@ -230,7 +230,7 @@ GfxSurface::GfxSurface(const GfxSurface &s) {
_lockSurfaceCtr = 0;
_customSurface = NULL;
_trackDirtyRects = false;
- this->operator =(s);
+ *this = s;
}
GfxSurface::~GfxSurface() {
@@ -437,7 +437,7 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
// Make a backup copy of the area the text will occupy
Rect saveRect = textRect;
saveRect.collapse(-20, -8);
- GfxSurface *savedArea = Surface_getArea(gfxManager.getSurface(), saveRect);
+ GfxSurface *savedArea = surfaceGetArea(gfxManager.getSurface(), saveRect);
// Display the text
gfxManager._font.writeLines(msg.c_str(), textRect, ALIGN_LEFT);
@@ -1073,7 +1073,7 @@ void GfxDialog::draw() {
Rect tempRect(_bounds);
// Make a backup copy of the area the dialog will occupy
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
// Set the palette for use in the dialog
setPalette();
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 9c6f13e407..9175b1050a 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -339,7 +339,7 @@ public:
static void setPalette();
};
-GfxSurface *Surface_getArea(GfxSurface &src, const Rect &bounds);
+GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds);
GfxSurface surfaceFromRes(const byte *imgData);
GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum);
diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp
index 0e451b8429..4728e66cd9 100644
--- a/engines/tsage/ringworld/ringworld_dialogs.cpp
+++ b/engines/tsage/ringworld/ringworld_dialogs.cpp
@@ -59,7 +59,7 @@ void RightClickButton::highlight() {
_savedButton = NULL;
} else {
// Highlight button by getting the needed highlighted image resource
- _savedButton = Surface_getArea(g_globals->gfxManager().getSurface(), _bounds);
+ _savedButton = surfaceGetArea(g_globals->gfxManager().getSurface(), _bounds);
uint size;
byte *imgData = g_resourceManager->getSubResource(7, 2, _buttonIndex, &size);
@@ -122,7 +122,7 @@ RightClickButton *RightClickDialog::findButton(const Common::Point &pt) {
void RightClickDialog::draw() {
// Save the covered background area
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
// Draw the dialog image
g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp
index 00c219f2ee..0584570ac2 100644
--- a/engines/tsage/ringworld/ringworld_logic.cpp
+++ b/engines/tsage/ringworld/ringworld_logic.cpp
@@ -295,7 +295,7 @@ void SceneArea::display() {
_bounds.setWidth(_surface.getBounds().width());
_bounds.setHeight(_surface.getBounds().height());
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
draw2();
}
@@ -610,7 +610,7 @@ void NamedHotspot::doAction(int action) {
case CURSOR_USE:
if (_useLineNum == -1)
break;
-
+
SceneItem::display(_resNum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
return;
case CURSOR_TALK:
diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp
index 3b415bdb6a..004ccbbb6d 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes5.cpp
@@ -1893,7 +1893,7 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_olloFace.setStrip(4);
_olloFace.fixPriority(152);
- if(g_globals->_sceneManager._previousScene == 4050) {
+ if (g_globals->_sceneManager._previousScene == 4050) {
g_globals->_soundHandler.play(155);
g_globals->_player.setPosition(Common::Point(72, 128));
g_globals->_player.enableControl();
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
index 30ae6be7b1..478fdcf5a5 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
@@ -85,7 +85,7 @@ RightClickDialog::~RightClickDialog() {
void RightClickDialog::draw() {
// Save the covered background area
- _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
// Draw the dialog image
g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index a06899fe5a..97042cb621 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -1695,7 +1695,7 @@ bool AnimationPlayer::load(int animId, Action *endAction) {
_playbackTickPrior = -1;
_playbackTick = 0;
- // The final multiplication is used to deliberately slow down playback, since the original
+ // The final multiplication is used to deliberately slow down playback, since the original
// was slowed down by the amount of time spent to decode and display the frames
_frameDelay = (60 / _subData._frameRate) * 8;
_gameFrame = R2_GLOBALS._events.getFrameNumber();
@@ -1706,7 +1706,7 @@ bool AnimationPlayer::load(int animId, Action *endAction) {
int v = (_subData._sliceSize + 2) * _subData._ySlices * _subData._framesPerSlices;
_dataNeeded = (_subData._field16 / _subData._framesPerSlices) + v + 96;
}
-
+
debugC(1, ktSageDebugGraphics, "Data needed %d", _dataNeeded);
// Set up animation data objects
@@ -1760,7 +1760,7 @@ bool AnimationPlayer::load(int animId, Action *endAction) {
byte r = _subData._palData[idx * 3];
byte g = _subData._palData[idx * 3 + 1];
byte b = _subData._palData[idx * 3 + 2];
-
+
int palIndex = R2_GLOBALS._scenePalette.indexOf(r, g, b);
_palIndexes[idx] = palIndex;
}
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 304d3a4298..216444e722 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -5571,7 +5571,7 @@ void Scene1337::subCF979() {
tmpVal = subC26CB(0, i);
if (tmpVal != -1) {
- bool flag = false;;
+ bool flag = false;
for (int j = 0; j <= 7; j++) {
if (_arrunkObj1337[0]._arr2[j]._field34 == _arrunkObj1337[0]._arr1[tmpVal]._field34) {
flag = true;
@@ -11068,7 +11068,7 @@ bool Scene1850::Actor5::startAction(CursorType action, Event &event) {
case R2_REBREATHER_TANK:
if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) {
if (R2_GLOBALS.getFlag(30))
- return SceneActor::startAction(action, event);;
+ return SceneActor::startAction(action, event);
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 1878;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
index 3dd566c900..61711d0a4f 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -3294,7 +3294,7 @@ void Scene3500::Action1::signal() {
NpcMover *mover = new NpcMover();
scene->_actor8.addMover(mover, &pt, this);
- scene->_actor9.setPosition(Common::Point(160 + ((_field1E * 2) * 160), 73));;
+ 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);
diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h
index e336564c5f..fa2946d56c 100644
--- a/engines/tsage/ringworld2/ringworld2_speakers.h
+++ b/engines/tsage/ringworld2/ringworld2_speakers.h
@@ -504,14 +504,14 @@ public:
class SpeakerSoldier300 : public SpeakerSoldier {
public:
- SpeakerSoldier300() : SpeakerSoldier(60) {};
+ SpeakerSoldier300() : SpeakerSoldier(60) {}
virtual Common::String getClassName() { return "SpeakerSoldier300"; }
virtual void proc15();
};
class SpeakerSoldier1625 : public SpeakerSoldier {
public:
- SpeakerSoldier1625() : SpeakerSoldier(5) {};
+ SpeakerSoldier1625() : SpeakerSoldier(5) {}
virtual Common::String getClassName() { return "SpeakerSoldier1625"; }
};
@@ -585,7 +585,7 @@ public:
class SpeakerWebbster3240 : public SpeakerWebbster {
public:
- SpeakerWebbster3240() : SpeakerWebbster(10) {};
+ SpeakerWebbster3240() : SpeakerWebbster(10) {}
virtual Common::String getClassName() { return "SpeakerWebbster3240"; }
virtual void proc15();
@@ -593,7 +593,7 @@ public:
class SpeakerWebbster3375 : public SpeakerWebbster {
public:
- SpeakerWebbster3375() : SpeakerWebbster(60) {};
+ SpeakerWebbster3375() : SpeakerWebbster(60) {}
virtual Common::String getClassName() { return "SpeakerWebbster3375"; }
virtual void proc15();
@@ -601,7 +601,7 @@ public:
class SpeakerWebbster3385 : public SpeakerWebbster {
public:
- SpeakerWebbster3385() : SpeakerWebbster(60) {};
+ SpeakerWebbster3385() : SpeakerWebbster(60) {}
virtual Common::String getClassName() { return "SpeakerWebbster3385"; }
virtual void proc15();
@@ -609,7 +609,7 @@ public:
class SpeakerWebbster3395 : public SpeakerWebbster {
public:
- SpeakerWebbster3395() : SpeakerWebbster(60) {};
+ SpeakerWebbster3395() : SpeakerWebbster(60) {}
virtual Common::String getClassName() { return "SpeakerWebbster3395"; }
virtual void proc15();
@@ -617,7 +617,7 @@ public:
class SpeakerWebbster3400 : public SpeakerWebbster {
public:
- SpeakerWebbster3400() : SpeakerWebbster(27) {};
+ SpeakerWebbster3400() : SpeakerWebbster(27) {}
virtual Common::String getClassName() { return "SpeakerWebbster3400"; }
virtual void proc15();
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 0756d71d4c..774a5277dc 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -569,17 +569,13 @@ void Game::quitGame() {
}
void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(g_vm->getGameId(), &plugin);
GUI::SaveLoadChooser *dialog;
if (saveFlag)
- dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
+ dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), saveFlag);
else
- dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
+ dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), saveFlag);
- dialog->setSaveMode(saveFlag);
-
- saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ saveSlot = dialog->runModalWithCurrentTarget();
saveName = dialog->getResultString();
delete dialog;
diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h
index 2daa71ba98..d5ac88c692 100644
--- a/engines/tsage/scenes.h
+++ b/engines/tsage/scenes.h
@@ -67,7 +67,7 @@ public:
void setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent);
void loadBackground(int xAmount, int yAmount);
-
+
void loadSceneData(int sceneNum);
};
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 9df5a6666b..69a9975ef4 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -66,7 +66,7 @@ SoundManager::~SoundManager() {
++i;
delete driver;
}
- _sfTerminate();
+ sfTerminate();
// g_system->getTimerManager()->removeTimerProc(_sfUpdateCallback);
}
@@ -132,7 +132,7 @@ void SoundManager::syncSounds() {
}
void SoundManager::update() {
- _sfSoundServer();
+ sfSoundServer();
}
Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
@@ -144,22 +144,22 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
// Adlib driver
SoundDriverEntry sd;
- sd.driverNum = ADLIB_DRIVER_NUM;
- sd.status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
- sd.field2 = 0;
- sd.field6 = 15000;
- sd.shortDescription = "Adlib or SoundBlaster";
- sd.longDescription = "3812fm";
+ sd._driverNum = ADLIB_DRIVER_NUM;
+ sd._status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
+ sd._field2 = 0;
+ sd._field6 = 15000;
+ sd._shortDescription = "Adlib or SoundBlaster";
+ sd._longDescription = "3812fm";
_availableDrivers.push_back(sd);
// SoundBlaster entry
SoundDriverEntry sdFx;
- sdFx.driverNum = SBLASTER_DRIVER_NUM;
- sdFx.status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
- sdFx.field2 = 0;
- sdFx.field6 = 15000;
- sdFx.shortDescription = "SndBlast";
- sdFx.longDescription = "SoundBlaster";
+ sdFx._driverNum = SBLASTER_DRIVER_NUM;
+ sdFx._status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
+ sdFx._field2 = 0;
+ sdFx._field6 = 15000;
+ sdFx._shortDescription = "SndBlast";
+ sdFx._longDescription = "SoundBlaster";
_availableDrivers.push_back(sdFx);
_driversDetected = true;
@@ -204,7 +204,7 @@ void SoundManager::installDriver(int driverNum) {
(*i)->mute(true);
// Install the driver
- if (!_sfInstallDriver(driver))
+ if (!sfInstallDriver(driver))
error("Sound driver initialization failed");
switch (driverNum) {
@@ -214,11 +214,11 @@ void SoundManager::installDriver(int driverNum) {
byte *bankData = g_resourceManager->getResource(RES_BANK, driverNum, 0, true);
if (bankData) {
// Install the patch bank data
- _sfInstallPatchBank(driver, bankData);
+ sfInstallPatchBank(driver, bankData);
DEALLOCATE(bankData);
} else {
// Could not locate patch bank data, so unload the driver
- _sfUnInstallDriver(driver);
+ sfUnInstallDriver(driver);
// Unmute currently active sounds
for (Common::List<Sound *>::iterator i = _playList.begin(); i != _playList.end(); ++i)
@@ -260,7 +260,7 @@ void SoundManager::unInstallDriver(int driverNum) {
(*j)->mute(true);
// Uninstall the driver
- _sfUnInstallDriver(*i);
+ sfUnInstallDriver(*i);
// Re-orient all the loaded sounds
for (j = _soundList.begin(); j != _soundList.end(); ++j)
@@ -303,7 +303,7 @@ void SoundManager::unloadSound(int soundNum) {
}
int SoundManager::determineGroup(const byte *soundData) {
- return _sfDetermineGroup(soundData);
+ return sfDetermineGroup(soundData);
}
void SoundManager::checkResVersion(const byte *soundData) {
@@ -325,7 +325,7 @@ int SoundManager::extractLoop(const byte *soundData) {
}
void SoundManager::extractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum) {
- _sfExtractTrackInfo(trackInfo, soundData, groupNum);
+ sfExtractTrackInfo(trackInfo, soundData, groupNum);
}
void SoundManager::addToSoundList(Sound *sound) {
@@ -338,46 +338,46 @@ void SoundManager::removeFromSoundList(Sound *sound) {
}
void SoundManager::addToPlayList(Sound *sound) {
- _sfAddToPlayList(sound);
+ sfAddToPlayList(sound);
}
void SoundManager::removeFromPlayList(Sound *sound) {
if (_soundManager)
- _sfRemoveFromPlayList(sound);
+ sfRemoveFromPlayList(sound);
}
bool SoundManager::isOnPlayList(Sound *sound) {
- return _sfIsOnPlayList(sound);
+ return sfIsOnPlayList(sound);
}
void SoundManager::updateSoundVol(Sound *sound) {
- _sfUpdateVolume(sound);
+ sfUpdateVolume(sound);
}
void SoundManager::updateSoundPri(Sound *sound) {
- _sfUpdatePriority(sound);
+ sfUpdatePriority(sound);
}
void SoundManager::updateSoundLoop(Sound *sound) {
- _sfUpdateLoop(sound);
+ sfUpdateLoop(sound);
}
void SoundManager::rethinkVoiceTypes() {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
- _sfRethinkVoiceTypes();
+ sfRethinkVoiceTypes();
}
-void SoundManager::_sfSoundServer() {
+void SoundManager::sfSoundServer() {
if (sfManager()._needToRethink) {
- _sfRethinkVoiceTypes();
+ sfRethinkVoiceTypes();
sfManager()._needToRethink = false;
} else {
- _sfDereferenceAll();
+ sfDereferenceAll();
}
// If the master volume has changed, update it
if (sfManager()._newVolume != sfManager()._masterVol)
- _sfSetMasterVol(sfManager()._newVolume);
+ sfSetMasterVol(sfManager()._newVolume);
// If a time index has been set for any sound, fast forward to it
SynchronizedList<Sound *>::iterator i;
@@ -385,14 +385,14 @@ void SoundManager::_sfSoundServer() {
Sound *s = *i;
if (s->_newTimeIndex != 0) {
s->mute(true);
- s->_soSetTimeIndex(s->_newTimeIndex);
+ s->soSetTimeIndex(s->_newTimeIndex);
s->mute(false);
s->_newTimeIndex = 0;
}
}
// Handle any fading if necessary
- _sfProcessFading();
+ sfProcessFading();
// Poll all sound drivers in case they need it
for (Common::List<SoundDriver *>::iterator j = sfManager()._installedDrivers.begin();
@@ -401,7 +401,7 @@ void SoundManager::_sfSoundServer() {
}
}
-void SoundManager::_sfProcessFading() {
+void SoundManager::sfProcessFading() {
// Loop through processing active sounds
bool removeFlag = false;
Common::List<Sound *>::iterator i = sfManager()._playList.begin();
@@ -410,9 +410,9 @@ void SoundManager::_sfProcessFading() {
++i;
if (!s->_pausedCount)
- removeFlag = s->_soServiceTracks();
+ removeFlag = s->soServiceTracks();
if (removeFlag) {
- _sfDoRemoveFromPlayList(s);
+ sfDoRemoveFromPlayList(s);
s->_stoppedAsynchronously = true;
sfManager()._needToRethink = true;
}
@@ -429,13 +429,13 @@ void SoundManager::_sfProcessFading() {
s->_volume + s->_fadeSteps : s->_fadeDest;
}
- _sfDoUpdateVolume(s);
+ sfDoUpdateVolume(s);
if (s->_volume != s->_fadeDest)
s->_fadeCounter = s->_fadeTicks;
else {
s->_fadeDest = -1;
if (s->_stopAfterFadeFlag) {
- _sfDoRemoveFromPlayList(s);
+ sfDoRemoveFromPlayList(s);
s->_stoppedAsynchronously = true;
sfManager()._needToRethink = true;
}
@@ -475,7 +475,7 @@ bool SoundManager::isFading() {
return false;
}
-void SoundManager::_sfUpdateVoiceStructs() {
+void SoundManager::sfUpdateVoiceStructs() {
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
VoiceTypeStruct *vs = sfManager()._voiceTypeStructPtrs[voiceIndex];
if (!vs)
@@ -504,7 +504,7 @@ void SoundManager::_sfUpdateVoiceStructs() {
}
}
-void SoundManager::_sfUpdateVoiceStructs2() {
+void SoundManager::sfUpdateVoiceStructs2() {
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
VoiceTypeStruct *vtStruct = sfManager()._voiceTypeStructPtrs[voiceIndex];
if (!vtStruct)
@@ -528,7 +528,7 @@ void SoundManager::_sfUpdateVoiceStructs2() {
}
}
-void SoundManager::_sfUpdateCallback(void *ref) {
+void SoundManager::sfUpdateCallback(void *ref) {
((SoundManager *)ref)->update();
}
@@ -587,7 +587,7 @@ SoundManager &SoundManager::sfManager() {
return *_soundManager;
}
-int SoundManager::_sfDetermineGroup(const byte *soundData) {
+int SoundManager::sfDetermineGroup(const byte *soundData) {
const byte *p = soundData + READ_LE_UINT16(soundData + 8);
uint32 v;
while ((v = READ_LE_UINT32(p)) != 0) {
@@ -600,22 +600,22 @@ int SoundManager::_sfDetermineGroup(const byte *soundData) {
return 0;
}
-void SoundManager::_sfAddToPlayList(Sound *sound) {
+void SoundManager::sfAddToPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
- _sfDoAddToPlayList(sound);
+ sfDoAddToPlayList(sound);
sound->_stoppedAsynchronously = false;
- _sfRethinkVoiceTypes();
+ sfRethinkVoiceTypes();
}
-void SoundManager::_sfRemoveFromPlayList(Sound *sound) {
+void SoundManager::sfRemoveFromPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
- if (_sfDoRemoveFromPlayList(sound))
- _sfRethinkVoiceTypes();
+ if (sfDoRemoveFromPlayList(sound))
+ sfRethinkVoiceTypes();
}
-bool SoundManager::_sfIsOnPlayList(Sound *sound) {
+bool SoundManager::sfIsOnPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
bool result = contains(_soundManager->_playList, sound);
@@ -623,7 +623,7 @@ bool SoundManager::_sfIsOnPlayList(Sound *sound) {
return result;
}
-void SoundManager::_sfRethinkSoundDrivers() {
+void SoundManager::sfRethinkSoundDrivers() {
// Free any existing entries
int idx;
@@ -643,7 +643,7 @@ void SoundManager::_sfRethinkSoundDrivers() {
i != sfManager()._installedDrivers.end(); ++i) {
// Process the group data for each sound driver
SoundDriver *driver = *i;
- const byte *groupData = driver->_groupOffset->pData;
+ const byte *groupData = driver->_groupOffset->_pData;
while (*groupData != 0xff) {
byte byteVal = *groupData++;
@@ -690,7 +690,7 @@ void SoundManager::_sfRethinkSoundDrivers() {
i != sfManager()._installedDrivers.end(); ++i) {
// Process the group data for each sound driver
SoundDriver *driver = *i;
- const byte *groupData = driver->_groupOffset->pData;
+ const byte *groupData = driver->_groupOffset->_pData;
while (*groupData != 0xff) {
byte byteVal = *groupData++;
@@ -746,8 +746,8 @@ void SoundManager::_sfRethinkSoundDrivers() {
}
}
-void SoundManager::_sfRethinkVoiceTypes() {
- _sfDereferenceAll();
+void SoundManager::sfRethinkVoiceTypes() {
+ sfDereferenceAll();
// Pre-processing
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
@@ -797,7 +797,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if ((sound->_mutedCount != 0) || (sound->_pausedCount != 0))
continue;
- _sfUpdateVoiceStructs();
+ sfUpdateVoiceStructs();
Common::fill(sound->_chWork, sound->_chWork + SOUND_ARR_SIZE, false);
for (;;) {
@@ -831,7 +831,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if (foundPriority)
continue;
- _sfUpdateVoiceStructs2();
+ sfUpdateVoiceStructs2();
break;
}
@@ -860,7 +860,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
maxPriority = MAX(maxPriority, vtStruct->_entries[idx]._type1._priority2);
if (!maxPriority) {
- _sfUpdateVoiceStructs2();
+ sfUpdateVoiceStructs2();
break;
}
@@ -944,7 +944,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
continue;
}
- _sfUpdateVoiceStructs2();
+ sfUpdateVoiceStructs2();
break;
} else {
// Channel mode 1 handling (loc_23FAC)
@@ -973,7 +973,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if (foundPriority)
continue;
if (entryIndex == -1) {
- _sfUpdateVoiceStructs2();
+ sfUpdateVoiceStructs2();
break;
}
}
@@ -1008,7 +1008,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
continue;
}
- _sfUpdateVoiceStructs2();
+ sfUpdateVoiceStructs2();
break;
}
@@ -1051,7 +1051,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if (!foundPriority)
continue;
if (priorityIndex == -1) {
- _sfUpdateVoiceStructs2();
+ sfUpdateVoiceStructs2();
break;
}
@@ -1271,38 +1271,38 @@ void SoundManager::_sfRethinkVoiceTypes() {
}
}
-void SoundManager::_sfUpdateVolume(Sound *sound) {
- _sfDereferenceAll();
- _sfDoUpdateVolume(sound);
+void SoundManager::sfUpdateVolume(Sound *sound) {
+ sfDereferenceAll();
+ sfDoUpdateVolume(sound);
}
-void SoundManager::_sfDereferenceAll() {
+void SoundManager::sfDereferenceAll() {
// Orignal used handles for both the driver list and voiceTypeStructPtrs list. This method then refreshed
// pointer lists based on the handles. Since in ScummVM we're just using pointers directly, this
// method doesn't need any implementation
}
-void SoundManager::_sfUpdatePriority(Sound *sound) {
+void SoundManager::sfUpdatePriority(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
int tempPriority = (sound->_fixedPriority == 255) ? sound->_sndResPriority : sound->_priority;
if (sound->_priority != tempPriority) {
sound->_priority = tempPriority;
- if (_sfDoRemoveFromPlayList(sound)) {
- _sfDoAddToPlayList(sound);
- _sfRethinkVoiceTypes();
+ if (sfDoRemoveFromPlayList(sound)) {
+ sfDoAddToPlayList(sound);
+ sfRethinkVoiceTypes();
}
}
}
-void SoundManager::_sfUpdateLoop(Sound *sound) {
+void SoundManager::sfUpdateLoop(Sound *sound) {
if (sound->_fixedLoop)
sound->_loop = sound->_sndResLoop;
else
sound->_loop = sound->_fixedLoop;
}
-void SoundManager::_sfSetMasterVol(int volume) {
+void SoundManager::sfSetMasterVol(int volume) {
if (volume > 127)
volume = 127;
@@ -1316,7 +1316,7 @@ void SoundManager::_sfSetMasterVol(int volume) {
}
}
-void SoundManager::_sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum) {
+void SoundManager::sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum) {
trackInfo->_numTracks = 0;
const byte *p = soundData + READ_LE_UINT16(soundData + 8);
@@ -1345,11 +1345,11 @@ void SoundManager::_sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *s
}
}
-void SoundManager::_sfTerminate() {
+void SoundManager::sfTerminate() {
}
-void SoundManager::_sfExtractGroupMask() {
+void SoundManager::sfExtractGroupMask() {
uint32 mask = 0;
for (Common::List<SoundDriver *>::iterator i = sfManager()._installedDrivers.begin();
@@ -1359,37 +1359,37 @@ void SoundManager::_sfExtractGroupMask() {
_soundManager->_groupsAvail = mask;
}
-bool SoundManager::_sfInstallDriver(SoundDriver *driver) {
+bool SoundManager::sfInstallDriver(SoundDriver *driver) {
if (!driver->open())
return false;
sfManager()._installedDrivers.push_back(driver);
driver->_groupOffset = driver->getGroupData();
- driver->_groupMask = driver->_groupOffset->groupMask;
+ driver->_groupMask = driver->_groupOffset->_groupMask;
- _sfExtractGroupMask();
- _sfRethinkSoundDrivers();
+ sfExtractGroupMask();
+ sfRethinkSoundDrivers();
driver->setMasterVolume(sfManager()._masterVol);
return true;
}
-void SoundManager::_sfUnInstallDriver(SoundDriver *driver) {
+void SoundManager::sfUnInstallDriver(SoundDriver *driver) {
sfManager()._installedDrivers.remove(driver);
delete driver;
- _sfExtractGroupMask();
- _sfRethinkSoundDrivers();
+ sfExtractGroupMask();
+ sfRethinkSoundDrivers();
}
-void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
+void SoundManager::sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
driver->installPatch(bankData, g_vm->_memoryManager.getSize(bankData));
}
/**
* Adds the specified sound in the playing sound list, inserting in order of priority
*/
-void SoundManager::_sfDoAddToPlayList(Sound *sound) {
+void SoundManager::sfDoAddToPlayList(Sound *sound) {
Common::StackLock slock2(sfManager()._serverSuspendedMutex);
Common::List<Sound *>::iterator i = sfManager()._playList.begin();
@@ -1402,7 +1402,7 @@ void SoundManager::_sfDoAddToPlayList(Sound *sound) {
/**
* Removes the specified sound from the play list
*/
-bool SoundManager::_sfDoRemoveFromPlayList(Sound *sound) {
+bool SoundManager::sfDoRemoveFromPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
bool result = false;
@@ -1417,7 +1417,7 @@ bool SoundManager::_sfDoRemoveFromPlayList(Sound *sound) {
return result;
}
-void SoundManager::_sfDoUpdateVolume(Sound *sound) {
+void SoundManager::sfDoUpdateVolume(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
@@ -1583,7 +1583,7 @@ void Sound::_prime(int soundResID, bool dontQueue) {
_remoteReceiver = ALLOCATE(200);
}
- _soPrimeSound(dontQueue);
+ soPrimeSound(dontQueue);
if (!dontQueue)
_soundManager->addToSoundList(this);
@@ -1767,7 +1767,7 @@ void Sound::release() {
_hold = -1;
}
-void Sound::_soPrimeSound(bool dontQueue) {
+void Sound::soPrimeSound(bool dontQueue) {
if (!dontQueue) {
_priority = (_fixedPriority != -1) ? _fixedPriority : _sndResPriority;
_loop = !_fixedLoop ? _fixedLoop : _sndResLoop;
@@ -1785,21 +1785,21 @@ void Sound::_soPrimeSound(bool dontQueue) {
_timer = 0;
_newTimeIndex = 0;
_loopTimer = 0;
- _soPrimeChannelData();
+ soPrimeChannelData();
}
-void Sound::_soSetTimeIndex(uint timeIndex) {
+void Sound::soSetTimeIndex(uint timeIndex) {
Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
if (timeIndex != _timer) {
_soundManager->_soTimeIndexFlag = true;
_timer = 0;
_loopTimer = 0;
- _soPrimeChannelData();
+ soPrimeChannelData();
while (timeIndex > 0) {
- if (_soServiceTracks()) {
- SoundManager::_sfDoRemoveFromPlayList(this);
+ if (soServiceTracks()) {
+ SoundManager::sfDoRemoveFromPlayList(this);
_stoppedAsynchronously = true;
_soundManager->_needToRethink = true;
break;
@@ -1812,9 +1812,9 @@ void Sound::_soSetTimeIndex(uint timeIndex) {
}
}
-bool Sound::_soServiceTracks() {
+bool Sound::soServiceTracks() {
if (_isEmpty) {
- _soRemoteReceive();
+ soRemoteReceive();
return false;
}
@@ -1823,9 +1823,9 @@ bool Sound::_soServiceTracks() {
int mode = *_channelData[trackCtr];
if (mode == 0) {
- _soServiceTrackType0(trackCtr, _channelData[trackCtr]);
+ soServiceTrackType0(trackCtr, _channelData[trackCtr]);
} else if (mode == 1) {
- _soServiceTrackType1(trackCtr, _channelData[trackCtr]);
+ soServiceTrackType1(trackCtr, _channelData[trackCtr]);
} else {
error("Unknown sound mode encountered");
}
@@ -1851,7 +1851,7 @@ bool Sound::_soServiceTracks() {
}
}
-void Sound::_soPrimeChannelData() {
+void Sound::soPrimeChannelData() {
if (_isEmpty) {
for (int idx = 0; idx < 16; ++idx) {
_chProgram[idx] = 0;
@@ -1917,11 +1917,11 @@ void Sound::_soPrimeChannelData() {
}
}
-void Sound::_soRemoteReceive() {
- error("_soRemoteReceive not implemented");
+void Sound::soRemoteReceive() {
+ error("soRemoteReceive not implemented");
}
-void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
+void Sound::soServiceTrackType0(int trackIndex, const byte *channelData) {
if (_trkRest[trackIndex]) {
--_trkRest[trackIndex];
return;
@@ -1970,7 +1970,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
// Only do processing if fast forwarding to a given time index
if (channelNum != -1) {
if (voiceType == VOICETYPE_1) {
- _soUpdateDamper(vtStruct, channelNum, chVoiceType, v);
+ soUpdateDamper(vtStruct, channelNum, chVoiceType, v);
} else if (voiceNum != -1) {
assert(driver);
driver->proc18(voiceNum, chVoiceType);
@@ -1991,9 +1991,9 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
if (channelNum != -1) {
if (voiceType != VOICETYPE_0) {
if (chFlags & 0x10)
- _soPlaySound2(vtStruct, channelData, channelNum, chVoiceType, v);
+ soPlaySound2(vtStruct, channelData, channelNum, chVoiceType, v);
else
- _soPlaySound(vtStruct, channelData, channelNum, chVoiceType, v, b);
+ soPlaySound(vtStruct, channelData, channelNum, chVoiceType, v, b);
} else if (voiceNum != -1) {
assert(driver);
driver->proc20(voiceNum, chVoiceType);
@@ -2030,17 +2030,17 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
int cmdVal = cmdList[v];
if (channelNum == -1) {
- if (_soDoUpdateTracks(cmdVal, b))
+ if (soDoUpdateTracks(cmdVal, b))
return;
} else {
- _soDoTrackCommand(_trkChannel[trackIndex], cmdVal, b);
+ soDoTrackCommand(_trkChannel[trackIndex], cmdVal, b);
if (!_soundManager->_soTimeIndexFlag) {
if (cmdVal == 7)
b = static_cast<byte>(_volume * (int)b / 127);
if (voiceType != VOICETYPE_0) {
- _soProc38(vtStruct, channelNum, chVoiceType, cmdVal, b);
+ soProc38(vtStruct, channelNum, chVoiceType, cmdVal, b);
} else if (voiceNum != -1) {
assert(driver);
driver->proc24(voiceNum, chVoiceType, this, cmdVal, b);
@@ -2067,17 +2067,17 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
int value = *pData++;
if (channelNum != -1) {
- _soDoTrackCommand(_trkChannel[trackIndex], cmd, value);
+ soDoTrackCommand(_trkChannel[trackIndex], cmd, value);
if (!_soundManager->_soTimeIndexFlag) {
if (voiceType != VOICETYPE_0) {
- _soProc38(vtStruct, channelNum, chVoiceType, cmd, value);
+ soProc38(vtStruct, channelNum, chVoiceType, cmd, value);
} else if (voiceNum != -1) {
assert(driver);
driver->proc24(voiceNum, chVoiceType, this, cmd, value);
}
}
- } else if (_soDoUpdateTracks(cmd, value)) {
+ } else if (soDoUpdateTracks(cmd, value)) {
return;
}
} else if (!(v & 0x2)) {
@@ -2091,7 +2091,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
_chPitchBlend[channel] = pitchBlend;
if (voiceType != VOICETYPE_0) {
- _soProc40(vtStruct, channelNum, pitchBlend);
+ soProc40(vtStruct, channelNum, pitchBlend);
} else if (voiceNum != -1) {
assert(driver);
driver->setPitchBlend(channel, pitchBlend);
@@ -2115,7 +2115,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
}
}
} else {
- _soSetTrackPos(trackIndex, pData - channelData, program);
+ soSetTrackPos(trackIndex, pData - channelData, program);
}
} else {
@@ -2139,7 +2139,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
}
}
-void Sound::_soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0) {
+void Sound::soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0) {
bool hasDamper = _chDamper[channelNum] != 0;
for (uint idx = 0; idx < voiceType->_entries.size(); ++idx) {
@@ -2161,8 +2161,8 @@ void Sound::_soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceTyp
}
}
-void Sound::_soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1) {
- int entryIndex = _soFindSound(vtStruct, channelNum);
+void Sound::soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1) {
+ int entryIndex = soFindSound(vtStruct, channelNum);
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
@@ -2175,11 +2175,11 @@ void Sound::_soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int
}
}
-void Sound::_soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0) {
+void Sound::soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0) {
for (int trackCtr = 0; trackCtr < _trackInfo._numTracks; ++trackCtr) {
const byte *instrument = _channelData[trackCtr];
if ((*(instrument + 13) == v0) && (*instrument == 1)) {
- int entryIndex = _soFindSound(vtStruct, channelNum);
+ int entryIndex = soFindSound(vtStruct, channelNum);
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
@@ -2199,7 +2199,7 @@ void Sound::_soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, in
}
}
-void Sound::_soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value) {
+void Sound::soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value) {
if (cmd == 64) {
if (value == 0) {
for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
@@ -2231,7 +2231,7 @@ void Sound::_soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voice
}
}
-void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend) {
+void Sound::soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend) {
for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
VoiceStructEntryType1 &vte = vtStruct->_entries[entryIndex]._type1;
@@ -2244,7 +2244,7 @@ void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend)
}
}
-void Sound::_soDoTrackCommand(int channelNum, int command, int value) {
+void Sound::soDoTrackCommand(int channelNum, int command, int value) {
switch (command) {
case 1:
_chModulation[channelNum] = value;
@@ -2264,7 +2264,7 @@ void Sound::_soDoTrackCommand(int channelNum, int command, int value) {
}
}
-bool Sound::_soDoUpdateTracks(int command, int value) {
+bool Sound::soDoUpdateTracks(int command, int value) {
if ((command == 76) || (_hold != value))
return false;
@@ -2278,7 +2278,7 @@ bool Sound::_soDoUpdateTracks(int command, int value) {
return true;
}
-void Sound::_soSetTrackPos(int trackIndex, int trackPos, int cueValue) {
+void Sound::soSetTrackPos(int trackIndex, int trackPos, int cueValue) {
_trkIndex[trackIndex] = trackPos;
if (cueValue == 127) {
if (!_soundManager->_soTimeIndexFlag)
@@ -2294,7 +2294,7 @@ void Sound::_soSetTrackPos(int trackIndex, int trackPos, int cueValue) {
}
}
-void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
+void Sound::soServiceTrackType1(int trackIndex, const byte *channelData) {
if (_soundManager->_soTimeIndexFlag || !_trkState[trackIndex])
return;
@@ -2310,7 +2310,7 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
else {
if (vtStruct->_voiceType != VOICETYPE_0) {
if (_trkState[trackIndex] == 1) {
- int entryIndex = _soFindSound(vtStruct, *(channelData + 1));
+ int entryIndex = soFindSound(vtStruct, *(channelData + 1));
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
@@ -2352,7 +2352,7 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
}
}
-int Sound::_soFindSound(VoiceTypeStruct *vtStruct, int channelNum) {
+int Sound::soFindSound(VoiceTypeStruct *vtStruct, int channelNum) {
int entryIndex = -1, entry2Index = -1;
int v6 = 0, v8 = 0;
@@ -2539,10 +2539,10 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
_maxVersion = 0x10A;
_masterVolume = 0;
- _groupData.groupMask = 9;
- _groupData.v1 = 0x46;
- _groupData.v2 = 0;
- _groupData.pData = &adlib_group_data[0];
+ _groupData._groupMask = 9;
+ _groupData._v1 = 0x46;
+ _groupData._v2 = 0;
+ _groupData._pData = &adlib_group_data[0];
_mixer = g_vm->_mixer;
_sampleRate = _mixer->getOutputRate();
@@ -2823,7 +2823,7 @@ int AdlibSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
memset(buffer, 0, sizeof(int16) * numSamples);
while (samplesLeft) {
if (!_samplesTillCallback) {
- SoundManager::_sfUpdateCallback(NULL);
+ SoundManager::sfUpdateCallback(NULL);
flush();
_samplesTillCallback = _samplesPerCallback;
@@ -2852,11 +2852,11 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() {
_maxVersion = 0x10A;
_masterVolume = 0;
- _groupData.groupMask = 1;
- _groupData.v1 = 0x3E;
- _groupData.v2 = 0;
+ _groupData._groupMask = 1;
+ _groupData._v1 = 0x3E;
+ _groupData._v2 = 0;
static byte const group_data[] = { 3, 1, 1, 0, 0xff };
- _groupData.pData = group_data;
+ _groupData._pData = group_data;
_mixer = g_vm->_mixer;
_sampleRate = _mixer->getOutputRate();
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 77d1f3d3ac..2f59afb49b 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -54,18 +54,18 @@ enum VoiceType {VOICETYPE_0 = 0, VOICETYPE_1 = 1};
class SoundDriverEntry {
public:
- int driverNum;
- SoundDriverStatus status;
- int field2, field6;
- Common::String shortDescription;
- Common::String longDescription;
+ int _driverNum;
+ SoundDriverStatus _status;
+ int _field2, _field6;
+ Common::String _shortDescription;
+ Common::String _longDescription;
};
struct GroupData {
- uint32 groupMask;
- byte v1;
- byte v2;
- const byte *pData;
+ uint32 _groupMask;
+ byte _v1;
+ byte _v2;
+ const byte *_pData;
};
struct RegisterValue {
@@ -229,31 +229,31 @@ public:
// _sf methods
static SoundManager &sfManager();
- static void _sfTerminate();
- static int _sfDetermineGroup(const byte *soundData);
- static void _sfAddToPlayList(Sound *sound);
- static void _sfRemoveFromPlayList(Sound *sound);
- static bool _sfIsOnPlayList(Sound *sound);
- static void _sfRethinkSoundDrivers();
- static void _sfRethinkVoiceTypes();
- static void _sfUpdateVolume(Sound *sound);
- static void _sfDereferenceAll();
- static void _sfUpdatePriority(Sound *sound);
- static void _sfUpdateLoop(Sound *sound);
- static void _sfSetMasterVol(int volume);
- static void _sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum);
- static void _sfExtractGroupMask();
- static bool _sfInstallDriver(SoundDriver *driver);
- static void _sfUnInstallDriver(SoundDriver *driver);
- static void _sfInstallPatchBank(SoundDriver *driver, const byte *bankData);
- static void _sfDoAddToPlayList(Sound *sound);
- static bool _sfDoRemoveFromPlayList(Sound *sound);
- static void _sfDoUpdateVolume(Sound *sound);
- static void _sfSoundServer();
- static void _sfProcessFading();
- static void _sfUpdateVoiceStructs();
- static void _sfUpdateVoiceStructs2();
- static void _sfUpdateCallback(void *ref);
+ static void sfTerminate();
+ static int sfDetermineGroup(const byte *soundData);
+ static void sfAddToPlayList(Sound *sound);
+ static void sfRemoveFromPlayList(Sound *sound);
+ static bool sfIsOnPlayList(Sound *sound);
+ static void sfRethinkSoundDrivers();
+ static void sfRethinkVoiceTypes();
+ static void sfUpdateVolume(Sound *sound);
+ static void sfDereferenceAll();
+ static void sfUpdatePriority(Sound *sound);
+ static void sfUpdateLoop(Sound *sound);
+ static void sfSetMasterVol(int volume);
+ static void sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum);
+ static void sfExtractGroupMask();
+ static bool sfInstallDriver(SoundDriver *driver);
+ static void sfUnInstallDriver(SoundDriver *driver);
+ static void sfInstallPatchBank(SoundDriver *driver, const byte *bankData);
+ static void sfDoAddToPlayList(Sound *sound);
+ static bool sfDoRemoveFromPlayList(Sound *sound);
+ static void sfDoUpdateVolume(Sound *sound);
+ static void sfSoundServer();
+ static void sfProcessFading();
+ static void sfUpdateVoiceStructs();
+ static void sfUpdateVoiceStructs2();
+ static void sfUpdateCallback(void *ref);
};
class Sound: public EventHandler {
@@ -343,23 +343,23 @@ public:
void orientAfterDriverChange();
// _so methods
- void _soPrimeSound(bool dontQueue);
- void _soSetTimeIndex(uint timeIndex);
- bool _soServiceTracks();
- void _soPrimeChannelData();
- void _soRemoteReceive();
- void _soServiceTrackType0(int trackIndex, const byte *channelData);
- void _soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0);
- void _soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1);
- void _soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0);
- void _soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value);
- void _soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend);
- void _soDoTrackCommand(int channelNum, int command, int value);
- bool _soDoUpdateTracks(int command, int value);
- void _soSetTrackPos(int trackIndex, int trackPos, int cueValue);
-
- void _soServiceTrackType1(int trackIndex, const byte *channelData);
- int _soFindSound(VoiceTypeStruct *vtStruct, int channelNum);
+ void soPrimeSound(bool dontQueue);
+ void soSetTimeIndex(uint timeIndex);
+ bool soServiceTracks();
+ void soPrimeChannelData();
+ void soRemoteReceive();
+ void soServiceTrackType0(int trackIndex, const byte *channelData);
+ void soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0);
+ void soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1);
+ void soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0);
+ void soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value);
+ void soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend);
+ void soDoTrackCommand(int channelNum, int command, int value);
+ bool soDoUpdateTracks(int command, int value);
+ void soSetTrackPos(int trackIndex, int trackPos, int cueValue);
+
+ void soServiceTrackType1(int trackIndex, const byte *channelData);
+ int soFindSound(VoiceTypeStruct *vtStruct, int channelNum);
};
class ASound: public EventHandler {
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 40f4dfcfd2..87697f950b 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -45,7 +45,7 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc)
else if (g_vm->getGameID() == GType_BlueForce)
_debugger = new BlueForceDebugger();
else if (g_vm->getGameID() == GType_Ringworld2)
- _debugger = new Ringworld2Debugger();
+ _debugger = new Ringworld2Debugger();
}
Common::Error TSageEngine::init() {
@@ -92,7 +92,7 @@ void TSageEngine::initialize() {
g_resourceManager->addLib("TSAGE.RLB");
}
g_globals = new BlueForce::BlueForceGlobals();
-
+
// Setup the user interface
T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y - 2));
@@ -107,7 +107,7 @@ void TSageEngine::initialize() {
// Reset all global variables
R2_GLOBALS.reset();
- }
+ }
g_globals->gfxManager().setDefaults();
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp
index 10cb6961dc..4bd9e49875 100644
--- a/engines/tsage/user_interface.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -112,7 +112,7 @@ void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) {
imgRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
// Save the area behind where the image will be displayed
- GfxSurface *savedArea = Surface_getArea(GLOBALS.gfxManager().getSurface(), imgRect);
+ GfxSurface *savedArea = surfaceGetArea(GLOBALS.gfxManager().getSurface(), imgRect);
// Draw the image
GLOBALS.gfxManager().copyFrom(objImage, imgRect);
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index bee09f7391..1b04f3fae9 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -29,6 +29,9 @@
#include "audio/decoders/vorbis.h"
#include "audio/decoders/wave.h"
+#include "graphics/surface.h"
+#include "graphics/decoders/pcx.h"
+
#include "tucker/tucker.h"
#include "tucker/graphics.h"
@@ -298,23 +301,21 @@ void TuckerEngine::loadImage(const char *fname, uint8 *dst, int type) {
return;
}
}
- f.seek(128, SEEK_SET);
- int size = 0;
- while (size < 64000) {
- int code = f.readByte();
- if (code >= 0xC0) {
- const int sz = code - 0xC0;
- code = f.readByte();
- memset(dst + size, code, sz);
- size += sz;
- } else {
- dst[size++] = code;
- }
- }
+
+ ::Graphics::PCXDecoder pcx;
+ if (!pcx.loadStream(f))
+ error("Error while reading PCX image");
+
+ const ::Graphics::Surface *pcxSurface = pcx.getSurface();
+ if (pcxSurface->format.bytesPerPixel != 1)
+ error("Invalid bytes per pixel in PCX surface (%d)", pcxSurface->format.bytesPerPixel);
+ if (pcxSurface->w != 320 || pcxSurface->h != 200)
+ error("Invalid PCX surface size (%d x %d)", pcxSurface->w, pcxSurface->h);
+ for (uint16 y = 0; y < pcxSurface->h; y++)
+ memcpy(dst + y * 320, pcxSurface->getBasePtr(0, y), pcxSurface->w);
+
if (type != 0) {
- if (f.readByte() != 12)
- return;
- f.read(_currentPalette, 768);
+ memcpy(_currentPalette, pcx.getPalette(), 3 * 256);
setBlackPalette();
}
}
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 775fd6f1a0..16c4f4f6f0 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -28,6 +28,7 @@
#include "audio/decoders/wave.h"
#include "graphics/palette.h"
+#include "graphics/surface.h"
#include "tucker/tucker.h"
#include "tucker/graphics.h"
@@ -749,6 +750,7 @@ void AnimationSequencePlayer::openAnimation(int index, const char *fileName) {
_seqNum = 1;
return;
}
+ _flicPlayer[index].start();
_flicPlayer[index].decodeNextFrame();
if (index == 0) {
getRGBPalette(index);
@@ -801,7 +803,7 @@ void AnimationSequencePlayer::playIntroSeq19_20() {
if (_flicPlayer[0].getCurFrame() >= 115) {
surface = _flicPlayer[1].decodeNextFrame();
if (_flicPlayer[1].endOfVideo())
- _flicPlayer[1].reset();
+ _flicPlayer[1].rewind();
}
bool framesLeft = decodeNextAnimationFrame(0, false);
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
new file mode 100644
index 0000000000..d175855d1e
--- /dev/null
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -0,0 +1,1460 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_actor.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/ad/ad_sprite_set.h"
+#include "engines/wintermute/ad/ad_waypoint_group.h"
+#include "engines/wintermute/ad/ad_path.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/base_engine.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdActor, false)
+
+
+//////////////////////////////////////////////////////////////////////////
+AdActor::AdActor(BaseGame *inGame) : AdTalkHolder(inGame) {
+ _path = new AdPath(_gameRef);
+
+ _type = OBJECT_ACTOR;
+ _dir = DI_LEFT;
+
+ _walkSprite = NULL;
+ _standSprite = NULL;
+ _turnLeftSprite = NULL;
+ _turnRightSprite = NULL;
+
+ _targetPoint = new BasePoint;
+ _afterWalkDir = DI_NONE;
+
+ _animSprite2 = NULL;
+
+ setDefaultAnimNames();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::setDefaultAnimNames() {
+ _talkAnimName = "talk";
+ _idleAnimName = "idle";
+ _walkAnimName = "walk";
+ _turnLeftAnimName = "turnleft";
+ _turnRightAnimName = "turnright";
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AdActor::~AdActor() {
+ delete _path;
+ delete _targetPoint;
+ _path = NULL;
+ _targetPoint = NULL;
+
+ delete _walkSprite;
+ delete _standSprite;
+ delete _turnLeftSprite;
+ delete _turnRightSprite;
+ _walkSprite = NULL;
+ _standSprite = NULL;
+ _turnLeftSprite = NULL;
+ _turnRightSprite = NULL;
+
+ _animSprite2 = NULL; // ref only
+
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ delete _talkSprites[i];
+ }
+ _talkSprites.clear();
+
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ delete _talkSpritesEx[i];
+ }
+ _talkSpritesEx.clear();
+
+ for (uint32 i = 0; i < _anims.size(); i++) {
+ delete _anims[i];
+ _anims[i] = NULL;
+ }
+ _anims.clear();
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdActor::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing ACTOR file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(ACTOR)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(SCALABLE)
+TOKEN_DEF(REGISTRABLE)
+TOKEN_DEF(INTERACTIVE)
+TOKEN_DEF(SHADOWABLE)
+TOKEN_DEF(COLORABLE)
+TOKEN_DEF(ACTIVE)
+TOKEN_DEF(WALK)
+TOKEN_DEF(STAND)
+TOKEN_DEF(TALK_SPECIAL)
+TOKEN_DEF(TALK)
+TOKEN_DEF(TURN_LEFT)
+TOKEN_DEF(TURN_RIGHT)
+TOKEN_DEF(EVENTS)
+TOKEN_DEF(FONT)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(SOUND_VOLUME)
+TOKEN_DEF(SOUND_PANNING)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(BLOCKED_REGION)
+TOKEN_DEF(WAYPOINTS)
+TOKEN_DEF(IGNORE_ITEMS)
+TOKEN_DEF(ROTABLE)
+TOKEN_DEF(ROTATABLE)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(SCALE)
+TOKEN_DEF(RELATIVE_SCALE)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(ANIMATION)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ACTOR)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(SCALABLE)
+ TOKEN_TABLE(REGISTRABLE)
+ TOKEN_TABLE(INTERACTIVE)
+ TOKEN_TABLE(SHADOWABLE)
+ TOKEN_TABLE(COLORABLE)
+ TOKEN_TABLE(ACTIVE)
+ TOKEN_TABLE(WALK)
+ TOKEN_TABLE(STAND)
+ TOKEN_TABLE(TALK_SPECIAL)
+ TOKEN_TABLE(TALK)
+ TOKEN_TABLE(TURN_LEFT)
+ TOKEN_TABLE(TURN_RIGHT)
+ TOKEN_TABLE(EVENTS)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(SOUND_VOLUME)
+ TOKEN_TABLE(SOUND_PANNING)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(BLOCKED_REGION)
+ TOKEN_TABLE(WAYPOINTS)
+ TOKEN_TABLE(IGNORE_ITEMS)
+ TOKEN_TABLE(ROTABLE)
+ TOKEN_TABLE(ROTATABLE)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(SCALE)
+ TOKEN_TABLE(RELATIVE_SCALE)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(ANIMATION)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTOR) {
+ _gameRef->LOG(0, "'ACTOR' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ AdGame *adGame = (AdGame *)_gameRef;
+ AdSpriteSet *spr = NULL;
+ int ar = 0, ag = 0, ab = 0, alpha = 0;
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_FONT:
+ setFont((char *)params);
+ break;
+
+ case TOKEN_SCALABLE:
+ parser.scanStr((char *)params, "%b", &_zoomable);
+ break;
+
+ case TOKEN_ROTABLE:
+ case TOKEN_ROTATABLE:
+ parser.scanStr((char *)params, "%b", &_rotatable);
+ break;
+
+ case TOKEN_REGISTRABLE:
+ case TOKEN_INTERACTIVE:
+ parser.scanStr((char *)params, "%b", &_registrable);
+ break;
+
+ case TOKEN_SHADOWABLE:
+ case TOKEN_COLORABLE:
+ parser.scanStr((char *)params, "%b", &_shadowable);
+ break;
+
+ case TOKEN_ACTIVE:
+ parser.scanStr((char *)params, "%b", &_active);
+ break;
+
+ case TOKEN_WALK:
+ delete _walkSprite;
+ _walkSprite = NULL;
+ spr = new AdSpriteSet(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texWalkLifeTime, CACHE_HALF))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _walkSprite = spr;
+ }
+ break;
+
+ case TOKEN_TALK:
+ spr = new AdSpriteSet(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _talkSprites.add(spr);
+ }
+ break;
+
+ case TOKEN_TALK_SPECIAL:
+ spr = new AdSpriteSet(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _talkSpritesEx.add(spr);
+ }
+ break;
+
+ case TOKEN_STAND:
+ delete _standSprite;
+ _standSprite = NULL;
+ spr = new AdSpriteSet(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texStandLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _standSprite = spr;
+ }
+ break;
+
+ case TOKEN_TURN_LEFT:
+ delete _turnLeftSprite;
+ _turnLeftSprite = NULL;
+ spr = new AdSpriteSet(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _turnLeftSprite = spr;
+ }
+ break;
+
+ case TOKEN_TURN_RIGHT:
+ delete _turnRightSprite;
+ _turnRightSprite = NULL;
+ spr = new AdSpriteSet(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _turnRightSprite = spr;
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_SOUND_VOLUME:
+ parser.scanStr((char *)params, "%d", &_sFXVolume);
+ break;
+
+ case TOKEN_SCALE: {
+ int s;
+ parser.scanStr((char *)params, "%d", &s);
+ _scale = (float)s;
+
+ }
+ break;
+
+ case TOKEN_RELATIVE_SCALE: {
+ int s;
+ parser.scanStr((char *)params, "%d", &s);
+ _relativeScale = (float)s;
+
+ }
+ break;
+
+ case TOKEN_SOUND_PANNING:
+ parser.scanStr((char *)params, "%b", &_autoSoundPanning);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_BLOCKED_REGION: {
+ delete _blockRegion;
+ delete _currentBlockRegion;
+ _blockRegion = NULL;
+ _currentBlockRegion = NULL;
+ BaseRegion *rgn = new BaseRegion(_gameRef);
+ BaseRegion *crgn = new BaseRegion(_gameRef);
+ if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) {
+ delete _blockRegion;
+ delete _currentBlockRegion;
+ _blockRegion = NULL;
+ _currentBlockRegion = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ _blockRegion = rgn;
+ _currentBlockRegion = crgn;
+ _currentBlockRegion->mimic(_blockRegion);
+ }
+ }
+ break;
+
+ case TOKEN_WAYPOINTS: {
+ delete _wptGroup;
+ delete _currentWptGroup;
+ _wptGroup = NULL;
+ _currentWptGroup = NULL;
+ AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef);
+ AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef);
+ if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) {
+ delete _wptGroup;
+ delete _currentWptGroup;
+ _wptGroup = NULL;
+ _currentWptGroup = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ _wptGroup = wpt;
+ _currentWptGroup = cwpt;
+ _currentWptGroup->mimic(_wptGroup);
+ }
+ }
+ break;
+
+ case TOKEN_IGNORE_ITEMS:
+ parser.scanStr((char *)params, "%b", &_ignoreItems);
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr((char *)params, "%d", &alpha);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+
+ case TOKEN_ANIMATION: {
+ AdSpriteSet *anim = new AdSpriteSet(_gameRef, this);
+ if (!anim || DID_FAIL(anim->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _anims.add(anim);
+ }
+ }
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ACTOR definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ if (spr) {
+ delete spr;
+ }
+ _gameRef->LOG(0, "Error loading ACTOR definition");
+ return STATUS_FAILED;
+ }
+
+ if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
+ ar = ag = ab = 255;
+ }
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
+ _state = _nextState = STATE_READY;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdActor::turnTo(TDirection dir) {
+ int delta1, delta2, delta3, delta;
+
+ delta1 = dir - _dir;
+ delta2 = dir + NUM_DIRECTIONS - _dir;
+ delta3 = dir - NUM_DIRECTIONS - _dir;
+
+ delta1 = (abs(delta1) <= abs(delta2)) ? delta1 : delta2;
+ delta = (abs(delta1) <= abs(delta3)) ? delta1 : delta3;
+
+ // already there?
+ if (abs(delta) < 2) {
+ _dir = dir;
+ _state = _nextState;
+ _nextState = STATE_READY;
+ return;
+ }
+
+ _targetDir = dir;
+ _state = delta < 0 ? STATE_TURNING_LEFT : STATE_TURNING_RIGHT;
+
+ _tempSprite2 = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdActor::goTo(int x, int y, TDirection afterWalkDir) {
+ _afterWalkDir = afterWalkDir;
+ if (x == _targetPoint->x && y == _targetPoint->y && _state == STATE_FOLLOWING_PATH) {
+ return;
+ }
+
+ _path->reset();
+ _path->setReady(false);
+
+ _targetPoint->x = x;
+ _targetPoint->y = y;
+
+ ((AdGame *)_gameRef)->_scene->correctTargetPoint(_posX, _posY, &_targetPoint->x, &_targetPoint->y, true, this);
+
+ _state = STATE_SEARCHING_PATH;
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::display() {
+ if (_active) {
+ updateSounds();
+ }
+
+ uint32 alpha;
+ if (_alphaColor != 0) {
+ alpha = _alphaColor;
+ } else {
+ alpha = _shadowable ? ((AdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY, true) : 0xFFFFFFFF;
+ }
+
+ float scaleX, scaleY;
+ getScale(&scaleX, &scaleY);
+
+
+ float rotate;
+ if (_rotatable) {
+ if (_rotateValid) {
+ rotate = _rotate;
+ } else {
+ rotate = ((AdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate;
+ }
+ } else {
+ rotate = 0.0f;
+ }
+
+ if (_active) {
+ displaySpriteAttachments(true);
+ }
+
+ if (_currentSprite && _active) {
+ bool reg = _registrable;
+ if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) {
+ reg = false;
+ }
+
+ _currentSprite->display(_posX,
+ _posY,
+ reg ? _registerAlias : NULL,
+ scaleX,
+ scaleY,
+ alpha,
+ rotate,
+ _blendMode);
+
+ }
+
+ if (_active) {
+ displaySpriteAttachments(false);
+ }
+ if (_active && _partEmitter) {
+ _partEmitter->display();
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::update() {
+ _currentSprite = NULL;
+
+ if (_state == STATE_READY) {
+ if (_animSprite) {
+ delete _animSprite;
+ _animSprite = NULL;
+ }
+ if (_animSprite2) {
+ _animSprite2 = NULL;
+ }
+ }
+
+ // finished playing animation?
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) {
+ _state = _nextState;
+ _nextState = STATE_READY;
+ _currentSprite = _animSprite;
+ }
+
+ if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != NULL && _animSprite2->isFinished()) {
+ _state = _nextState;
+ _nextState = STATE_READY;
+ _currentSprite = _animSprite2;
+ }
+
+ if (_sentence && _state != STATE_TALKING) {
+ _sentence->finish();
+ }
+
+ // default: stand animation
+ if (!_currentSprite) {
+ if (_sprite) {
+ _currentSprite = _sprite;
+ } else {
+ if (_standSprite) {
+ _currentSprite = _standSprite->getSprite(_dir);
+ } else {
+ AdSpriteSet *anim = getAnimByName(_idleAnimName);
+ if (anim) {
+ _currentSprite = anim->getSprite(_dir);
+ }
+ }
+ }
+ }
+
+ bool already_moved = false;
+
+ switch (_state) {
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_PLAYING_ANIM:
+ _currentSprite = _animSprite;
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_PLAYING_ANIM_SET:
+ _currentSprite = _animSprite2;
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_TURNING_LEFT:
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished()) {
+ if (_dir > 0) {
+ _dir = (TDirection)(_dir - 1);
+ } else {
+ _dir = (TDirection)(NUM_DIRECTIONS - 1);
+ }
+
+ if (_dir == _targetDir) {
+ _tempSprite2 = NULL;
+ _state = _nextState;
+ _nextState = STATE_READY;
+ } else {
+ if (_turnLeftSprite) {
+ _tempSprite2 = _turnLeftSprite->getSprite(_dir);
+ } else {
+ AdSpriteSet *anim = getAnimByName(_turnLeftAnimName);
+ if (anim) {
+ _tempSprite2 = anim->getSprite(_dir);
+ }
+ }
+
+ if (_tempSprite2) {
+ _tempSprite2->reset();
+ if (_tempSprite2->_looping) {
+ _tempSprite2->_looping = false;
+ }
+ }
+ _currentSprite = _tempSprite2;
+ }
+ } else {
+ _currentSprite = _tempSprite2;
+ }
+ break;
+
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_TURNING_RIGHT:
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished()) {
+ _dir = (TDirection)(_dir + 1);
+
+ if ((int)_dir >= (int)NUM_DIRECTIONS) {
+ _dir = (TDirection)(0);
+ }
+
+ if (_dir == _targetDir) {
+ _tempSprite2 = NULL;
+ _state = _nextState;
+ _nextState = STATE_READY;
+ } else {
+ if (_turnRightSprite) {
+ _tempSprite2 = _turnRightSprite->getSprite(_dir);
+ } else {
+ AdSpriteSet *anim = getAnimByName(_turnRightAnimName);
+ if (anim) {
+ _tempSprite2 = anim->getSprite(_dir);
+ }
+ }
+
+ if (_tempSprite2) {
+ _tempSprite2->reset();
+ if (_tempSprite2->_looping) {
+ _tempSprite2->_looping = false;
+ }
+ }
+ _currentSprite = _tempSprite2;
+ }
+ } else {
+ _currentSprite = _tempSprite2;
+ }
+ break;
+
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_SEARCHING_PATH:
+ // keep asking scene for the path
+ if (((AdGame *)_gameRef)->_scene->getPath(BasePoint(_posX, _posY), *_targetPoint, _path, this)) {
+ _state = STATE_WAITING_PATH;
+ }
+ break;
+
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_WAITING_PATH:
+ // wait until the scene finished the path
+ if (_path->_ready) {
+ followPath();
+ }
+ break;
+
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_FOLLOWING_PATH:
+ getNextStep();
+ already_moved = true;
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_TALKING: {
+ _sentence->update(_dir);
+ if (_sentence->_currentSprite) {
+ _tempSprite2 = _sentence->_currentSprite;
+ }
+
+ bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (timeIsUp) {
+ _sentence->finish();
+ _tempSprite2 = NULL;
+ _state = _nextState;
+ _nextState = STATE_READY;
+ } else {
+ _tempSprite2 = getTalkStance(_sentence->getNextStance());
+ if (_tempSprite2) {
+ _tempSprite2->reset();
+ _currentSprite = _tempSprite2;
+ ((AdGame *)_gameRef)->addSentence(_sentence);
+ }
+ }
+ } else {
+ _currentSprite = _tempSprite2;
+ ((AdGame *)_gameRef)->addSentence(_sentence);
+ }
+ }
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_READY:
+ if (!_animSprite && !_animSprite2) {
+ if (_sprite) {
+ _currentSprite = _sprite;
+ } else {
+ if (_standSprite) {
+ _currentSprite = _standSprite->getSprite(_dir);
+ } else {
+ AdSpriteSet *anim = getAnimByName(_idleAnimName);
+ if (anim) {
+ _currentSprite = anim->getSprite(_dir);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ error("AdActor::Update - Unhandled enum");
+ }
+
+
+ if (_currentSprite && !already_moved) {
+ _currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
+ if (_currentSprite->isChanged()) {
+ _posX += _currentSprite->_moveX;
+ _posY += _currentSprite->_moveY;
+ afterMove();
+ }
+ }
+
+ //_gameRef->QuickMessageForm("%s", _currentSprite->_filename);
+
+ updateBlockRegion();
+ _ready = (_state == STATE_READY);
+
+ updatePartEmitter();
+ updateSpriteAttachments();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdActor::followPath() {
+ // skip current position
+ _path->getFirst();
+ while (_path->getCurrent() != NULL) {
+ if (_path->getCurrent()->x != _posX || _path->getCurrent()->y != _posY) {
+ break;
+ }
+ _path->getNext();
+ }
+
+ // are there points to follow?
+ if (_path->getCurrent() != NULL) {
+ _state = STATE_FOLLOWING_PATH;
+ initLine(BasePoint(_posX, _posY), *_path->getCurrent());
+ } else {
+ if (_afterWalkDir != DI_NONE) {
+ turnTo(_afterWalkDir);
+ } else {
+ _state = STATE_READY;
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdActor::getNextStep() {
+ if (_walkSprite) {
+ _currentSprite = _walkSprite->getSprite(_dir);
+ } else {
+ AdSpriteSet *anim = getAnimByName(_walkAnimName);
+ if (anim) {
+ _currentSprite = anim->getSprite(_dir);
+ }
+ }
+
+ if (!_currentSprite) {
+ return;
+ }
+
+ _currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
+ if (!_currentSprite->isChanged()) {
+ return;
+ }
+
+
+ int maxStepX, maxStepY;
+ maxStepX = abs(_currentSprite->_moveX);
+ maxStepY = abs(_currentSprite->_moveY);
+
+ maxStepX = MAX(maxStepX, maxStepY);
+ maxStepX = MAX(maxStepX, 1);
+
+ while (_pFCount > 0 && maxStepX >= 0) {
+ _pFX += _pFStepX;
+ _pFY += _pFStepY;
+
+ _pFCount--;
+ maxStepX--;
+ }
+
+ if (((AdGame *)_gameRef)->_scene->isBlockedAt((int)_pFX, (int) _pFY, true, this)) {
+ if (_pFCount == 0) {
+ _state = _nextState;
+ _nextState = STATE_READY;
+ return;
+ }
+ goTo(_targetPoint->x, _targetPoint->y);
+ return;
+ }
+
+
+ _posX = (int)_pFX;
+ _posY = (int)_pFY;
+
+ afterMove();
+
+
+ if (_pFCount == 0) {
+ if (_path->getNext() == NULL) {
+ _posX = _targetPoint->x;
+ _posY = _targetPoint->y;
+
+ _path->reset();
+ if (_afterWalkDir != DI_NONE) {
+ turnTo(_afterWalkDir);
+ } else {
+ _state = _nextState;
+ _nextState = STATE_READY;
+ }
+ } else {
+ initLine(BasePoint(_posX, _posY), *_path->getCurrent());
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdActor::initLine(BasePoint startPt, BasePoint endPt) {
+ _pFCount = MAX((abs(endPt.x - startPt.x)) , (abs(endPt.y - startPt.y)));
+
+ _pFStepX = (double)(endPt.x - startPt.x) / _pFCount;
+ _pFStepY = (double)(endPt.y - startPt.y) / _pFCount;
+
+ _pFX = startPt.x;
+ _pFY = startPt.y;
+
+ int angle = (int)(atan2((double)(endPt.y - startPt.y), (double)(endPt.x - startPt.x)) * (180 / 3.14));
+
+ _nextState = STATE_FOLLOWING_PATH;
+
+ turnTo(angleToDirection(angle));
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // GoTo / GoToAsync
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GoTo") == 0 || strcmp(name, "GoToAsync") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ goTo(x, y);
+ if (strcmp(name, "GoToAsync") != 0) {
+ script->waitForExclusive(this);
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GoToObject / GoToObjectAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GoToObject") == 0 || strcmp(name, "GoToObjectAsync") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ if (!val->isNative()) {
+ script->runtimeError("actor.%s method accepts an entity refrence only", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ AdObject *obj = (AdObject *)val->getNative();
+ if (!obj || obj->_type != OBJECT_ENTITY) {
+ script->runtimeError("actor.%s method accepts an entity refrence only", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ AdEntity *ent = (AdEntity *)obj;
+ if (ent->_walkToX == 0 && ent->_walkToY == 0) {
+ goTo(ent->_posX, ent->_posY);
+ } else {
+ goTo(ent->_walkToX, ent->_walkToY, ent->_walkToDir);
+ }
+ if (strcmp(name, "GoToObjectAsync") != 0) {
+ script->waitForExclusive(this);
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TurnTo / TurnToAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TurnTo") == 0 || strcmp(name, "TurnToAsync") == 0) {
+ stack->correctParams(1);
+ int dir;
+ ScValue *val = stack->pop();
+
+ // turn to object?
+ if (val->isNative() && _gameRef->validObject((BaseObject *)val->getNative())) {
+ BaseObject *obj = (BaseObject *)val->getNative();
+ int angle = (int)(atan2((double)(obj->_posY - _posY), (double)(obj->_posX - _posX)) * (180 / 3.14));
+ dir = (int)angleToDirection(angle);
+ }
+ // otherwise turn to direction
+ else {
+ dir = val->getInt();
+ }
+
+ if (dir >= 0 && dir < NUM_DIRECTIONS) {
+ turnTo((TDirection)dir);
+ if (strcmp(name, "TurnToAsync") != 0) {
+ script->waitForExclusive(this);
+ }
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsWalking
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsWalking") == 0) {
+ stack->correctParams(0);
+ stack->pushBool(_state == STATE_FOLLOWING_PATH);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MergeAnims
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MergeAnims") == 0) {
+ stack->correctParams(1);
+ stack->pushBool(DID_SUCCEED(mergeAnims(stack->pop()->getString())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // UnloadAnim
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "UnloadAnim") == 0) {
+ stack->correctParams(1);
+ const char *animName = stack->pop()->getString();
+
+ bool found = false;
+ for (uint32 i = 0; i < _anims.size(); i++) {
+ if (scumm_stricmp(_anims[i]->getName(), animName) == 0) {
+ // invalidate sprites in use
+ if (_anims[i]->containsSprite(_tempSprite2)) {
+ _tempSprite2 = NULL;
+ }
+ if (_anims[i]->containsSprite(_currentSprite)) {
+ _currentSprite = NULL;
+ }
+ if (_anims[i]->containsSprite(_animSprite2)) {
+ _animSprite2 = NULL;
+ }
+
+ delete _anims[i];
+ _anims[i] = NULL;
+ _anims.remove_at(i);
+ i--;
+ found = true;
+ }
+ }
+ stack->pushBool(found);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HasAnim
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HasAnim") == 0) {
+ stack->correctParams(1);
+ const char *animName = stack->pop()->getString();
+ stack->pushBool(getAnimByName(animName) != NULL);
+ return STATUS_OK;
+ } else {
+ return AdTalkHolder::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdActor::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Direction
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Direction") {
+ _scValue->setInt(_dir);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Type") {
+ _scValue->setString("actor");
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // TalkAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TalkAnimName") {
+ _scValue->setString(_talkAnimName);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "WalkAnimName") {
+ _scValue->setString(_walkAnimName);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IdleAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "IdleAnimName") {
+ _scValue->setString(_idleAnimName);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TurnLeftAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TurnLeftAnimName") {
+ _scValue->setString(_turnLeftAnimName);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TurnRightAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TurnRightAnimName") {
+ _scValue->setString(_turnRightAnimName);
+ return _scValue;
+ } else {
+ return AdTalkHolder::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Direction
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Direction") == 0) {
+ int dir = value->getInt();
+ if (dir >= 0 && dir < NUM_DIRECTIONS) {
+ _dir = (TDirection)dir;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TalkAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TalkAnimName") == 0) {
+ if (value->isNULL()) {
+ _talkAnimName = "talk";
+ } else {
+ _talkAnimName = value->getString();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WalkAnimName") == 0) {
+ if (value->isNULL()) {
+ _walkAnimName = "walk";
+ } else {
+ _walkAnimName = value->getString();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IdleAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IdleAnimName") == 0) {
+ if (value->isNULL()) {
+ _idleAnimName = "idle";
+ } else {
+ _idleAnimName = value->getString();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TurnLeftAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TurnLeftAnimName") == 0) {
+ if (value->isNULL()) {
+ _turnLeftAnimName = "turnleft";
+ } else {
+ _turnLeftAnimName = value->getString();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TurnRightAnimName
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TurnRightAnimName") == 0) {
+ if (value->isNULL()) {
+ _turnRightAnimName = "turnright";
+ } else {
+ _turnRightAnimName = value->getString();
+ }
+ return STATUS_OK;
+ } else {
+ return AdTalkHolder::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdActor::scToString() {
+ return "[actor object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSprite *AdActor::getTalkStance(const char *stance) {
+ // forced stance?
+ if (_forcedTalkAnimName && !_forcedTalkAnimUsed) {
+ _forcedTalkAnimUsed = true;
+ delete _animSprite;
+ _animSprite = new BaseSprite(_gameRef, this);
+ if (_animSprite) {
+ bool res = _animSprite->loadFile(_forcedTalkAnimName);
+ if (DID_FAIL(res)) {
+ _gameRef->LOG(res, "AdActor::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", getName(), _forcedTalkAnimName);
+ delete _animSprite;
+ _animSprite = NULL;
+ } else {
+ return _animSprite;
+ }
+ }
+ }
+
+ // old way
+ if (_talkSprites.size() > 0 || _talkSpritesEx.size() > 0) {
+ return getTalkStanceOld(stance);
+ }
+
+ // new way
+ BaseSprite *ret = NULL;
+
+ // do we have an animation with this name?
+ AdSpriteSet *anim = getAnimByName(stance);
+ if (anim) {
+ ret = anim->getSprite(_dir);
+ }
+
+ // not - get a random talk
+ if (!ret) {
+ BaseArray<AdSpriteSet *> talkAnims;
+ for (uint32 i = 0; i < _anims.size(); i++) {
+ if (_talkAnimName.compareToIgnoreCase(_anims[i]->getName()) == 0) {
+ talkAnims.add(_anims[i]);
+ }
+ }
+
+ if (talkAnims.size() > 0) {
+ int rnd = BaseEngine::instance().randInt(0, talkAnims.size() - 1);
+ ret = talkAnims[rnd]->getSprite(_dir);
+ } else {
+ if (_standSprite) {
+ ret = _standSprite->getSprite(_dir);
+ } else {
+ anim = getAnimByName(_idleAnimName);
+ if (anim) {
+ ret = anim->getSprite(_dir);
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSprite *AdActor::getTalkStanceOld(const char *stance) {
+ BaseSprite *ret = NULL;
+
+ if (stance != NULL) {
+ // search special stances
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ if (scumm_stricmp(_talkSpritesEx[i]->getName(), stance) == 0) {
+ ret = _talkSpritesEx[i]->getSprite(_dir);
+ break;
+ }
+ }
+ if (ret == NULL) {
+ // search generic stances
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ if (scumm_stricmp(_talkSprites[i]->getName(), stance) == 0) {
+ ret = _talkSprites[i]->getSprite(_dir);
+ break;
+ }
+ }
+ }
+ }
+
+ // not a valid stance? get a random one
+ if (ret == NULL) {
+ if (_talkSprites.size() < 1) {
+ ret = _standSprite->getSprite(_dir);
+ } else {
+ // TODO: remember last
+ int rnd = BaseEngine::instance().randInt(0, _talkSprites.size() - 1);
+ ret = _talkSprites[rnd]->getSprite(_dir);
+ }
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::persist(BasePersistenceManager *persistMgr) {
+ AdTalkHolder::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER_INT(_dir));
+ persistMgr->transfer(TMEMBER(_path));
+ persistMgr->transfer(TMEMBER(_pFCount));
+ persistMgr->transfer(TMEMBER(_pFStepX));
+ persistMgr->transfer(TMEMBER(_pFStepY));
+ persistMgr->transfer(TMEMBER(_pFX));
+ persistMgr->transfer(TMEMBER(_pFY));
+ persistMgr->transfer(TMEMBER(_standSprite));
+ _talkSprites.persist(persistMgr);
+ _talkSpritesEx.persist(persistMgr);
+ persistMgr->transfer(TMEMBER_INT(_targetDir));
+ persistMgr->transfer(TMEMBER_INT(_afterWalkDir));
+ persistMgr->transfer(TMEMBER(_targetPoint));
+ persistMgr->transfer(TMEMBER(_turnLeftSprite));
+ persistMgr->transfer(TMEMBER(_turnRightSprite));
+ persistMgr->transfer(TMEMBER(_walkSprite));
+
+ persistMgr->transfer(TMEMBER(_animSprite2));
+ persistMgr->transfer(TMEMBER(_talkAnimName));
+ persistMgr->transfer(TMEMBER(_idleAnimName));
+ persistMgr->transfer(TMEMBER(_walkAnimName));
+ persistMgr->transfer(TMEMBER(_turnLeftAnimName));
+ persistMgr->transfer(TMEMBER(_turnRightAnimName));
+
+ _anims.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+TDirection AdActor::angleToDirection(int angle) {
+ TDirection ret = DI_DOWN;
+
+ if (angle > -112 && angle <= -67) {
+ ret = DI_UP;
+ } else if (angle > -67 && angle <= -22) {
+ ret = DI_UPRIGHT;
+ } else if (angle > -22 && angle <= 22) {
+ ret = DI_RIGHT;
+ } else if (angle > 22 && angle <= 67) {
+ ret = DI_DOWNRIGHT;
+ } else if (angle > 67 && angle <= 112) {
+ ret = DI_DOWN;
+ } else if (angle > 112 && angle <= 157) {
+ ret = DI_DOWNLEFT;
+ } else if ((angle > 157 && angle <= 180) || (angle >= -180 && angle <= -157)) {
+ ret = DI_LEFT;
+ } else if (angle > -157 && angle <= -112) {
+ ret = DI_UPLEFT;
+ }
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int AdActor::getHeight() {
+ // if no current sprite is set, set some
+ if (_currentSprite == NULL) {
+ if (_standSprite) {
+ _currentSprite = _standSprite->getSprite(_dir);
+ } else {
+ AdSpriteSet *anim = getAnimByName(_idleAnimName);
+ if (anim) {
+ _currentSprite = anim->getSprite(_dir);
+ }
+ }
+ }
+ // and get height
+ return AdTalkHolder::getHeight();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdSpriteSet *AdActor::getAnimByName(const Common::String &animName) {
+ for (uint32 i = 0; i < _anims.size(); i++) {
+ if (animName.compareToIgnoreCase(_anims[i]->getName()) == 0) {
+ return _anims[i];
+ }
+ }
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::mergeAnims(const char *animsFilename) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ANIMATION)
+ TOKEN_TABLE_END
+
+
+ byte *fileBuffer = BaseFileManager::getEngineInstance()->readWholeFile(animsFilename);
+ if (fileBuffer == NULL) {
+ _gameRef->LOG(0, "AdActor::MergeAnims failed for file '%s'", animsFilename);
+ return STATUS_FAILED;
+ }
+
+ byte *buffer = fileBuffer;
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ bool ret = STATUS_OK;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_ANIMATION: {
+ AdSpriteSet *anim = new AdSpriteSet(_gameRef, this);
+ if (!anim || DID_FAIL(anim->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ ret = STATUS_FAILED;
+ } else {
+ _anims.add(anim);
+ }
+ }
+ break;
+ }
+ }
+ delete[] fileBuffer;
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdActor::playAnim(const char *filename) {
+ // if we have an anim with this name, use it
+ AdSpriteSet *anim = getAnimByName(filename);
+ if (anim) {
+ _animSprite2 = anim->getSprite(_dir);
+ if (_animSprite2) {
+ _animSprite2->reset();
+ _state = STATE_PLAYING_ANIM_SET;
+ return STATUS_OK;
+ }
+ }
+ // otherwise call the standard handler
+ return AdTalkHolder::playAnim(filename);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h
new file mode 100644
index 0000000000..543c9d063a
--- /dev/null
+++ b/engines/wintermute/ad/ad_actor.h
@@ -0,0 +1,108 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADACTOR_H
+#define WINTERMUTE_ADACTOR_H
+
+
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+#include "engines/wintermute/ad/ad_types.h" // Added by ClassView
+#include "engines/wintermute/ad/ad_talk_holder.h"
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base_point.h" // Added by ClassView
+#include "engines/wintermute/persistent.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+class AdSpriteSet;
+class AdPath;
+class BaseSprite;
+class AdActor : public AdTalkHolder {
+public:
+ TDirection angleToDirection(int angle);
+ DECLARE_PERSISTENT(AdActor, AdTalkHolder)
+ virtual int getHeight();
+ BaseSprite *getTalkStance(const char *stance);
+ virtual void goTo(int x, int y, TDirection afterWalkDir = DI_NONE);
+ BasePoint *_targetPoint;
+ virtual bool update();
+ virtual bool display();
+ virtual void turnTo(TDirection dir);
+ AdActor(BaseGame *inGame/*=NULL*/);
+ virtual ~AdActor();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+
+
+private:
+ TDirection _targetDir;
+ TDirection _afterWalkDir;
+
+ AdPath *_path;
+ AdSpriteSet *_walkSprite;
+ AdSpriteSet *_standSprite;
+ AdSpriteSet *_turnLeftSprite;
+ AdSpriteSet *_turnRightSprite;
+ BaseArray<AdSpriteSet *> _talkSprites;
+ BaseArray<AdSpriteSet *> _talkSpritesEx;
+ TDirection _dir;
+ // new anim system
+ Common::String _talkAnimName;
+ Common::String _idleAnimName;
+ Common::String _walkAnimName;
+ Common::String _turnLeftAnimName;
+ Common::String _turnRightAnimName;
+ BaseArray<AdSpriteSet *> _anims;
+ virtual bool playAnim(const char *filename);
+ AdSpriteSet *getAnimByName(const Common::String &animName);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+ bool setDefaultAnimNames();
+ BaseSprite *getTalkStanceOld(const char *stance);
+ bool mergeAnims(const char *animsFilename);
+ BaseSprite *_animSprite2;
+
+ void initLine(BasePoint startPt, BasePoint endPt);
+ void getNextStep();
+ void followPath();
+ double _pFStepX;
+ double _pFStepY;
+ double _pFX;
+ double _pFY;
+ int _pFCount;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp
new file mode 100644
index 0000000000..9af7e034ca
--- /dev/null
+++ b/engines/wintermute/ad/ad_entity.cpp
@@ -0,0 +1,1122 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_waypoint_group.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/video/video_theora_player.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdEntity, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdEntity::AdEntity(BaseGame *inGame) : AdTalkHolder(inGame) {
+ _type = OBJECT_ENTITY;
+ _subtype = ENTITY_NORMAL;
+ _region = NULL;
+ _item = NULL;
+
+ _walkToX = _walkToY = 0;
+ _walkToDir = DI_NONE;
+
+ _theora = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdEntity::~AdEntity() {
+ _gameRef->unregisterObject(_region);
+
+ delete _theora;
+ _theora = NULL;
+
+ delete[] _item;
+ _item = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdEntity::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing ENTITY file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(ENTITY)
+TOKEN_DEF(SPRITE)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(SCALABLE)
+TOKEN_DEF(REGISTRABLE)
+TOKEN_DEF(INTERACTIVE)
+TOKEN_DEF(SHADOWABLE)
+TOKEN_DEF(COLORABLE)
+TOKEN_DEF(ACTIVE)
+TOKEN_DEF(EVENTS)
+TOKEN_DEF(FONT)
+TOKEN_DEF(TALK_SPECIAL)
+TOKEN_DEF(TALK)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(REGION)
+TOKEN_DEF(BLOCKED_REGION)
+TOKEN_DEF(EDITOR_SELECTED)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(SOUND_START_TIME)
+TOKEN_DEF(SOUND_VOLUME)
+TOKEN_DEF(SOUND_PANNING)
+TOKEN_DEF(SOUND)
+TOKEN_DEF(SUBTYPE)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(WAYPOINTS)
+TOKEN_DEF(IGNORE_ITEMS)
+TOKEN_DEF(ROTABLE)
+TOKEN_DEF(ROTATABLE)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(SCALE)
+TOKEN_DEF(RELATIVE_SCALE)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(ITEM)
+TOKEN_DEF(WALK_TO_X)
+TOKEN_DEF(WALK_TO_Y)
+TOKEN_DEF(WALK_TO_DIR)
+TOKEN_DEF(SAVE_STATE)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ENTITY)
+ TOKEN_TABLE(SPRITE)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(SCALABLE)
+ TOKEN_TABLE(REGISTRABLE)
+ TOKEN_TABLE(INTERACTIVE)
+ TOKEN_TABLE(SHADOWABLE)
+ TOKEN_TABLE(COLORABLE)
+ TOKEN_TABLE(ACTIVE)
+ TOKEN_TABLE(EVENTS)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(TALK_SPECIAL)
+ TOKEN_TABLE(TALK)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(REGION)
+ TOKEN_TABLE(BLOCKED_REGION)
+ TOKEN_TABLE(EDITOR_SELECTED)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(SOUND_START_TIME)
+ TOKEN_TABLE(SOUND_VOLUME)
+ TOKEN_TABLE(SOUND_PANNING)
+ TOKEN_TABLE(SOUND)
+ TOKEN_TABLE(SUBTYPE)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(WAYPOINTS)
+ TOKEN_TABLE(IGNORE_ITEMS)
+ TOKEN_TABLE(ROTABLE)
+ TOKEN_TABLE(ROTATABLE)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(SCALE)
+ TOKEN_TABLE(RELATIVE_SCALE)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(ITEM)
+ TOKEN_TABLE(WALK_TO_X)
+ TOKEN_TABLE(WALK_TO_Y)
+ TOKEN_TABLE(WALK_TO_DIR)
+ TOKEN_TABLE(SAVE_STATE)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY) {
+ _gameRef->LOG(0, "'ENTITY' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ AdGame *adGame = (AdGame *)_gameRef;
+ BaseSprite *spr = NULL;
+ int ar = 0, ag = 0, ab = 0, alpha = 0;
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_SPRITE: {
+ delete _sprite;
+ _sprite = NULL;
+ spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprite = spr;
+ }
+ }
+ break;
+
+ case TOKEN_TALK: {
+ spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _talkSprites.add(spr);
+ }
+ }
+ break;
+
+ case TOKEN_TALK_SPECIAL: {
+ spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _talkSpritesEx.add(spr);
+ }
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_ITEM:
+ setItem((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_FONT:
+ setFont((char *)params);
+ break;
+
+ case TOKEN_SCALABLE:
+ parser.scanStr((char *)params, "%b", &_zoomable);
+ break;
+
+ case TOKEN_SCALE: {
+ int s;
+ parser.scanStr((char *)params, "%d", &s);
+ _scale = (float)s;
+
+ }
+ break;
+
+ case TOKEN_RELATIVE_SCALE: {
+ int s;
+ parser.scanStr((char *)params, "%d", &s);
+ _relativeScale = (float)s;
+
+ }
+ break;
+
+ case TOKEN_ROTABLE:
+ case TOKEN_ROTATABLE:
+ parser.scanStr((char *)params, "%b", &_rotatable);
+ break;
+
+ case TOKEN_REGISTRABLE:
+ case TOKEN_INTERACTIVE:
+ parser.scanStr((char *)params, "%b", &_registrable);
+ break;
+
+ case TOKEN_SHADOWABLE:
+ case TOKEN_COLORABLE:
+ parser.scanStr((char *)params, "%b", &_shadowable);
+ break;
+
+ case TOKEN_ACTIVE:
+ parser.scanStr((char *)params, "%b", &_active);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_EDITOR_SELECTED:
+ parser.scanStr((char *)params, "%b", &_editorSelected);
+ break;
+
+ case TOKEN_REGION: {
+ if (_region) {
+ _gameRef->unregisterObject(_region);
+ }
+ _region = NULL;
+ BaseRegion *rgn = new BaseRegion(_gameRef);
+ if (!rgn || DID_FAIL(rgn->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _region = rgn;
+ _gameRef->registerObject(_region);
+ }
+ }
+ break;
+
+ case TOKEN_BLOCKED_REGION: {
+ delete _blockRegion;
+ _blockRegion = NULL;
+ delete _currentBlockRegion;
+ _currentBlockRegion = NULL;
+ BaseRegion *rgn = new BaseRegion(_gameRef);
+ BaseRegion *crgn = new BaseRegion(_gameRef);
+ if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) {
+ delete _blockRegion;
+ _blockRegion = NULL;
+ delete _currentBlockRegion;
+ _currentBlockRegion = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ _blockRegion = rgn;
+ _currentBlockRegion = crgn;
+ _currentBlockRegion->mimic(_blockRegion);
+ }
+ }
+ break;
+
+ case TOKEN_WAYPOINTS: {
+ delete _wptGroup;
+ _wptGroup = NULL;
+ delete _currentWptGroup;
+ _currentWptGroup = NULL;
+ AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef);
+ AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef);
+ if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) {
+ delete _wptGroup;
+ _wptGroup = NULL;
+ delete _currentWptGroup;
+ _currentWptGroup = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ _wptGroup = wpt;
+ _currentWptGroup = cwpt;
+ _currentWptGroup->mimic(_wptGroup);
+ }
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_SUBTYPE: {
+ if (scumm_stricmp((char *)params, "sound") == 0) {
+ delete _sprite;
+ _sprite = NULL;
+ if (_gameRef->_editorMode) {
+ spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile("entity_sound.sprite"))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprite = spr;
+ }
+ }
+ if (_gameRef->_editorMode) {
+ _editorOnly = true;
+ }
+ _zoomable = false;
+ _rotatable = false;
+ _registrable = _gameRef->_editorMode;
+ _shadowable = false;
+ _subtype = ENTITY_SOUND;
+ }
+ }
+ break;
+
+ case TOKEN_SOUND:
+ playSFX((char *)params, false, false);
+ break;
+
+ case TOKEN_SOUND_START_TIME:
+ parser.scanStr((char *)params, "%d", &_sFXStart);
+ break;
+
+ case TOKEN_SOUND_VOLUME:
+ parser.scanStr((char *)params, "%d", &_sFXVolume);
+ break;
+
+ case TOKEN_SOUND_PANNING:
+ parser.scanStr((char *)params, "%b", &_autoSoundPanning);
+ break;
+
+ case TOKEN_SAVE_STATE:
+ parser.scanStr((char *)params, "%b", &_saveState);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_IGNORE_ITEMS:
+ parser.scanStr((char *)params, "%b", &_ignoreItems);
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr((char *)params, "%d", &alpha);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+
+ case TOKEN_WALK_TO_X:
+ parser.scanStr((char *)params, "%d", &_walkToX);
+ break;
+
+ case TOKEN_WALK_TO_Y:
+ parser.scanStr((char *)params, "%d", &_walkToY);
+ break;
+
+ case TOKEN_WALK_TO_DIR: {
+ int i;
+ parser.scanStr((char *)params, "%d", &i);
+ if (i < 0) {
+ i = 0;
+ }
+ if (i >= NUM_DIRECTIONS) {
+ i = DI_NONE;
+ }
+ _walkToDir = (TDirection)i;
+ }
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ENTITY definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading ENTITY definition");
+ if (spr) {
+ delete spr;
+ }
+ return STATUS_FAILED;
+ }
+
+ if (_region && _sprite) {
+ _gameRef->LOG(0, "Warning: Entity '%s' has both sprite and region.", getName());
+ }
+
+ updatePosition();
+
+ if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
+ ar = ag = ab = 255;
+ }
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
+ _state = STATE_READY;
+
+ if (_item && ((AdGame *)_gameRef)->isItemTaken(_item)) {
+ _active = false;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::display() {
+ if (_active) {
+ updateSounds();
+
+ uint32 alpha;
+ if (_alphaColor != 0) {
+ alpha = _alphaColor;
+ } else {
+ alpha = _shadowable ? ((AdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY) : 0xFFFFFFFF;
+ }
+
+ float scaleX, scaleY;
+ getScale(&scaleX, &scaleY);
+
+ float rotate;
+ if (_rotatable) {
+ if (_rotateValid) {
+ rotate = _rotate;
+ } else {
+ rotate = ((AdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate;
+ }
+ } else {
+ rotate = 0.0f;
+ }
+
+
+ bool reg = _registrable;
+ if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) {
+ reg = false;
+ }
+
+ if (_region && (reg || _editorAlwaysRegister)) {
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, _registerAlias, _region, _gameRef->_offsetX, _gameRef->_offsetY));
+ }
+
+ displaySpriteAttachments(true);
+ if (_theora && (_theora->isPlaying() || _theora->isPaused())) {
+ _theora->display(alpha);
+ } else if (_currentSprite) {
+ _currentSprite->display(_posX,
+ _posY,
+ (reg || _editorAlwaysRegister) ? _registerAlias : NULL,
+ scaleX,
+ scaleY,
+ alpha,
+ rotate,
+ _blendMode);
+ }
+ displaySpriteAttachments(false);
+
+ if (_partEmitter) {
+ _partEmitter->display(_region);
+ }
+
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::update() {
+ _currentSprite = NULL;
+
+ if (_state == STATE_READY && _animSprite) {
+ delete _animSprite;
+ _animSprite = NULL;
+ }
+
+ // finished playing animation?
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) {
+ _state = STATE_READY;
+ _currentSprite = _animSprite;
+ }
+
+ if (_sentence && _state != STATE_TALKING) {
+ _sentence->finish();
+ }
+
+ // default: stand animation
+ if (!_currentSprite) {
+ _currentSprite = _sprite;
+ }
+
+ switch (_state) {
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_PLAYING_ANIM:
+ _currentSprite = _animSprite;
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_READY:
+ if (!_animSprite) {
+ _currentSprite = _sprite;
+ }
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_TALKING: {
+ _sentence->update();
+ if (_sentence->_currentSprite) {
+ _tempSprite2 = _sentence->_currentSprite;
+ }
+
+ bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (timeIsUp) {
+ _sentence->finish();
+ _tempSprite2 = NULL;
+ _state = STATE_READY;
+ } else {
+ _tempSprite2 = getTalkStance(_sentence->getNextStance());
+ if (_tempSprite2) {
+ _tempSprite2->reset();
+ _currentSprite = _tempSprite2;
+ }
+ ((AdGame *)_gameRef)->addSentence(_sentence);
+ }
+ } else {
+ _currentSprite = _tempSprite2;
+ ((AdGame *)_gameRef)->addSentence(_sentence);
+ }
+ }
+ break;
+ default: // Silence unhandled enum-warning
+ break;
+ }
+
+
+ if (_currentSprite) {
+ _currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
+ if (_currentSprite->isChanged()) {
+ _posX += _currentSprite->_moveX;
+ _posY += _currentSprite->_moveY;
+ }
+ }
+
+ updateBlockRegion();
+ _ready = (_state == STATE_READY);
+
+ if (_theora) {
+ int offsetX, offsetY;
+ _gameRef->getOffset(&offsetX, &offsetY);
+ _theora->_posX = _posX - offsetX;
+ _theora->_posY = _posY - offsetY;
+
+ _theora->update();
+ if (_theora->isFinished()) {
+ _theora->stop();
+ delete _theora;
+ _theora = NULL;
+ }
+ }
+
+ updatePartEmitter();
+ updateSpriteAttachments();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // StopSound
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "StopSound") == 0 && _subtype == ENTITY_SOUND) {
+ stack->correctParams(0);
+
+ if (DID_FAIL(stopSFX(false))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlayTheora
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PlayTheora") == 0) {
+ stack->correctParams(4);
+ const char *filename = stack->pop()->getString();
+ bool looping = stack->pop()->getBool(false);
+ ScValue *valAlpha = stack->pop();
+ int startTime = stack->pop()->getInt();
+
+ delete _theora;
+ _theora = new VideoTheoraPlayer(_gameRef);
+ if (_theora && DID_SUCCEED(_theora->initialize(filename))) {
+ if (!valAlpha->isNULL()) {
+ _theora->setAlphaImage(valAlpha->getString());
+ }
+ _theora->play(VID_PLAY_POS, 0, 0, false, false, looping, startTime, _scale >= 0.0f ? _scale : -1.0f, _sFXVolume);
+ //if (_scale>=0) _theora->_playZoom = _scale;
+ stack->pushBool(true);
+ } else {
+ script->runtimeError("Entity.PlayTheora - error playing video '%s'", filename);
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StopTheora
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StopTheora") == 0) {
+ stack->correctParams(0);
+ if (_theora) {
+ _theora->stop();
+ delete _theora;
+ _theora = NULL;
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsTheoraPlaying
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsTheoraPlaying") == 0) {
+ stack->correctParams(0);
+ if (_theora && _theora->isPlaying()) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PauseTheora
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PauseTheora") == 0) {
+ stack->correctParams(0);
+ if (_theora && _theora->isPlaying()) {
+ _theora->pause();
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ResumeTheora
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ResumeTheora") == 0) {
+ stack->correctParams(0);
+ if (_theora && _theora->isPaused()) {
+ _theora->resume();
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsTheoraPaused
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsTheoraPaused") == 0) {
+ stack->correctParams(0);
+ if (_theora && _theora->isPaused()) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateRegion
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateRegion") == 0) {
+ stack->correctParams(0);
+ if (!_region) {
+ _region = new BaseRegion(_gameRef);
+ _gameRef->registerObject(_region);
+ }
+ if (_region) {
+ stack->pushNative(_region, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteRegion
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteRegion") == 0) {
+ stack->correctParams(0);
+ if (_region) {
+ _gameRef->unregisterObject(_region);
+ _region = NULL;
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ } else {
+ return AdTalkHolder::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdEntity::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("entity");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Item
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Item") {
+ if (_item) {
+ _scValue->setString(_item);
+ } else {
+ _scValue->setNULL();
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Subtype (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Subtype") {
+ if (_subtype == ENTITY_SOUND) {
+ _scValue->setString("sound");
+ } else {
+ _scValue->setString("normal");
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkToX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "WalkToX") {
+ _scValue->setInt(_walkToX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkToY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "WalkToY") {
+ _scValue->setInt(_walkToY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkToDirection
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "WalkToDirection") {
+ _scValue->setInt((int)_walkToDir);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Region (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Region") {
+ if (_region) {
+ _scValue->setNative(_region, true);
+ } else {
+ _scValue->setNULL();
+ }
+ return _scValue;
+ } else {
+ return AdTalkHolder::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::scSetProperty(const char *name, ScValue *value) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // Item
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Item") == 0) {
+ setItem(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkToX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WalkToX") == 0) {
+ _walkToX = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkToY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WalkToY") == 0) {
+ _walkToY = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WalkToDirection
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WalkToDirection") == 0) {
+ int dir = value->getInt();
+ if (dir >= 0 && dir < NUM_DIRECTIONS) {
+ _walkToDir = (TDirection)dir;
+ }
+ return STATUS_OK;
+ } else {
+ return AdTalkHolder::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdEntity::scToString() {
+ return "[entity object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "ENTITY {\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ if (_subtype == ENTITY_SOUND) {
+ buffer->putTextIndent(indent + 2, "SUBTYPE=\"SOUND\"\n");
+ }
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+ buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+ buffer->putTextIndent(indent + 2, "SCALABLE=%s\n", _zoomable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "INTERACTIVE=%s\n", _registrable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "COLORABLE=%s\n", _shadowable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
+ if (_ignoreItems) {
+ buffer->putTextIndent(indent + 2, "IGNORE_ITEMS=%s\n", _ignoreItems ? "TRUE" : "FALSE");
+ }
+ if (_rotatable) {
+ buffer->putTextIndent(indent + 2, "ROTATABLE=%s\n", _rotatable ? "TRUE" : "FALSE");
+ }
+
+ if (!_autoSoundPanning) {
+ buffer->putTextIndent(indent + 2, "SOUND_PANNING=%s\n", _autoSoundPanning ? "TRUE" : "FALSE");
+ }
+
+ if (!_saveState) {
+ buffer->putTextIndent(indent + 2, "SAVE_STATE=%s\n", _saveState ? "TRUE" : "FALSE");
+ }
+
+ if (_item && _item[0] != '\0') {
+ buffer->putTextIndent(indent + 2, "ITEM=\"%s\"\n", _item);
+ }
+
+ buffer->putTextIndent(indent + 2, "WALK_TO_X=%d\n", _walkToX);
+ buffer->putTextIndent(indent + 2, "WALK_TO_Y=%d\n", _walkToY);
+ if (_walkToDir != DI_NONE) {
+ buffer->putTextIndent(indent + 2, "WALK_TO_DIR=%d\n", (int)_walkToDir);
+ }
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ if (_subtype == ENTITY_NORMAL && _sprite && _sprite->getFilename()) {
+ buffer->putTextIndent(indent + 2, "SPRITE=\"%s\"\n", _sprite->getFilename());
+ }
+
+ if (_subtype == ENTITY_SOUND && _sFX && _sFX->getFilename()) {
+ buffer->putTextIndent(indent + 2, "SOUND=\"%s\"\n", _sFX->getFilename());
+ buffer->putTextIndent(indent + 2, "SOUND_START_TIME=%d\n", _sFXStart);
+ buffer->putTextIndent(indent + 2, "SOUND_VOLUME=%d\n", _sFXVolume);
+ }
+
+
+ if (RGBCOLGetR(_alphaColor) != 0 || RGBCOLGetG(_alphaColor) != 0 || RGBCOLGetB(_alphaColor) != 0) {
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alphaColor), RGBCOLGetG(_alphaColor), RGBCOLGetB(_alphaColor));
+ }
+
+ if (RGBCOLGetA(_alphaColor) != 0) {
+ buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alphaColor));
+ }
+
+ if (_scale >= 0) {
+ buffer->putTextIndent(indent + 2, "SCALE = %d\n", (int)_scale);
+ }
+
+ if (_relativeScale != 0) {
+ buffer->putTextIndent(indent + 2, "RELATIVE_SCALE = %d\n", (int)_relativeScale);
+ }
+
+ if (_font && _font->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
+
+ if (_cursor && _cursor->getFilename()) {
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
+
+ AdTalkHolder::saveAsText(buffer, indent + 2);
+
+ if (_region) {
+ _region->saveAsText(buffer, indent + 2);
+ }
+
+ if (_scProp) {
+ _scProp->saveAsText(buffer, indent + 2);
+ }
+
+ AdObject::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int AdEntity::getHeight() {
+ if (_region && !_sprite) {
+ return _region->_rect.bottom - _region->_rect.top;
+ } else {
+ if (_currentSprite == NULL) {
+ _currentSprite = _sprite;
+ }
+ return AdObject::getHeight();
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdEntity::updatePosition() {
+ if (_region && !_sprite) {
+ _posX = _region->_rect.left + (_region->_rect.right - _region->_rect.left) / 2;
+ _posY = _region->_rect.bottom;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::persist(BasePersistenceManager *persistMgr) {
+ AdTalkHolder::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_item));
+ persistMgr->transfer(TMEMBER(_region));
+ //persistMgr->transfer(TMEMBER(_sprite));
+ persistMgr->transfer(TMEMBER_INT(_subtype));
+ _talkSprites.persist(persistMgr);
+ _talkSpritesEx.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_walkToX));
+ persistMgr->transfer(TMEMBER(_walkToY));
+ persistMgr->transfer(TMEMBER_INT(_walkToDir));
+
+ persistMgr->transfer(TMEMBER(_theora));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdEntity::setItem(const char *itemName) {
+ BaseUtils::setString(&_item, itemName);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdEntity::setSprite(const char *filename) {
+ if (_currentSprite == _sprite) {
+ _currentSprite = NULL;
+ }
+
+ delete _sprite;
+ _sprite = NULL;
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ delete _sprite;
+ _sprite = NULL;
+ return STATUS_FAILED;
+ } else {
+ _sprite = spr;
+ _currentSprite = _sprite;
+ return STATUS_OK;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h
new file mode 100644
index 0000000000..415987e50a
--- /dev/null
+++ b/engines/wintermute/ad/ad_entity.h
@@ -0,0 +1,68 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADENTITY_H
+#define WINTERMUTE_ADENTITY_H
+
+#include "engines/wintermute/ad/ad_talk_holder.h"
+
+namespace Wintermute {
+class VideoTheoraPlayer;
+class AdEntity : public AdTalkHolder {
+public:
+ VideoTheoraPlayer *_theora;
+ bool setSprite(const char *filename);
+ int _walkToX;
+ int _walkToY;
+ TDirection _walkToDir;
+ void setItem(const char *itemName);
+ char *_item;
+ DECLARE_PERSISTENT(AdEntity, AdTalkHolder)
+ void updatePosition();
+ virtual int getHeight();
+ BaseRegion *_region;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ virtual bool update();
+ virtual bool display();
+ AdEntity(BaseGame *inGame);
+ virtual ~AdEntity();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ TEntityType _subtype;
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp
new file mode 100644
index 0000000000..4481b774c1
--- /dev/null
+++ b/engines/wintermute/ad/ad_game.cpp
@@ -0,0 +1,2281 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_actor.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/ad/ad_inventory.h"
+#include "engines/wintermute/ad/ad_inventory_box.h"
+#include "engines/wintermute/ad/ad_item.h"
+#include "engines/wintermute/ad/ad_response.h"
+#include "engines/wintermute/ad/ad_response_box.h"
+#include "engines/wintermute/ad/ad_response_context.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_scene_state.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/base_transition_manager.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/saveload.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/ui/ui_entity.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/video/video_player.h"
+#include "engines/wintermute/video/video_theora_player.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdGame, true)
+
+//////////////////////////////////////////////////////////////////////////
+AdGame::AdGame(const Common::String &gameId) : BaseGame(gameId) {
+ _responseBox = NULL;
+ _inventoryBox = NULL;
+
+ _scene = new AdScene(_gameRef);
+ _scene->setName("");
+ registerObject(_scene);
+
+ _prevSceneName = NULL;
+ _prevSceneFilename = NULL;
+ _scheduledScene = NULL;
+ _scheduledFadeIn = false;
+
+
+ _stateEx = GAME_NORMAL;
+
+ _selectedItem = NULL;
+
+
+ _texItemLifeTime = 10000;
+ _texWalkLifeTime = 10000;
+ _texStandLifeTime = 10000;
+ _texTalkLifeTime = 10000;
+
+ _talkSkipButton = TALK_SKIP_LEFT;
+
+ _sceneViewport = NULL;
+
+ _initialScene = true;
+ _debugStartupScene = NULL;
+ _startupScene = NULL;
+
+ _invObject = new AdObject(this);
+ _inventoryOwner = _invObject;
+
+ _tempDisableSaveState = false;
+ _itemsFile = NULL;
+
+ _smartItemCursor = false;
+
+ addSpeechDir("speech");
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdGame::~AdGame() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::cleanup() {
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ unregisterObject(_objects[i]);
+ _objects[i] = NULL;
+ }
+ _objects.clear();
+
+
+ for (uint32 i = 0; i < _dlgPendingBranches.size(); i++) {
+ delete[] _dlgPendingBranches[i];
+ }
+ _dlgPendingBranches.clear();
+
+ for (uint32 i = 0; i < _speechDirs.size(); i++) {
+ delete[] _speechDirs[i];
+ }
+ _speechDirs.clear();
+
+
+ unregisterObject(_scene);
+ _scene = NULL;
+
+ // remove items
+ for (uint32 i = 0; i < _items.size(); i++) {
+ _gameRef->unregisterObject(_items[i]);
+ }
+ _items.clear();
+
+
+ // clear remaining inventories
+ delete _invObject;
+ _invObject = NULL;
+
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ delete _inventories[i];
+ }
+ _inventories.clear();
+
+
+ if (_responseBox) {
+ _gameRef->unregisterObject(_responseBox);
+ _responseBox = NULL;
+ }
+
+ if (_inventoryBox) {
+ _gameRef->unregisterObject(_inventoryBox);
+ _inventoryBox = NULL;
+ }
+
+ delete[] _prevSceneName;
+ delete[] _prevSceneFilename;
+ delete[] _scheduledScene;
+ delete[] _debugStartupScene;
+ delete[] _itemsFile;
+ _prevSceneName = NULL;
+ _prevSceneFilename = NULL;
+ _scheduledScene = NULL;
+ _debugStartupScene = NULL;
+ _startupScene = NULL;
+ _itemsFile = NULL;
+
+ delete _sceneViewport;
+ _sceneViewport = NULL;
+
+ for (uint32 i = 0; i < _sceneStates.size(); i++) {
+ delete _sceneStates[i];
+ }
+ _sceneStates.clear();
+
+ for (uint32 i = 0; i < _responsesBranch.size(); i++) {
+ delete _responsesBranch[i];
+ }
+ _responsesBranch.clear();
+
+ for (uint32 i = 0; i < _responsesGame.size(); i++) {
+ delete _responsesGame[i];
+ }
+ _responsesGame.clear();
+
+ return BaseGame::cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::initLoop() {
+ if (_scheduledScene && _transMgr->isReady()) {
+ changeScene(_scheduledScene, _scheduledFadeIn);
+ delete[] _scheduledScene;
+ _scheduledScene = NULL;
+
+ _gameRef->_activeObject = NULL;
+ }
+
+
+ bool res;
+ res = BaseGame::initLoop();
+ if (DID_FAIL(res)) {
+ return res;
+ }
+
+ if (_scene) {
+ res = _scene->initLoop();
+ }
+
+ _sentences.clear();
+
+ return res;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::addObject(AdObject *object) {
+ _objects.add(object);
+ return registerObject(object);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::removeObject(AdObject *object) {
+ // in case the user called Scene.CreateXXX() and Game.DeleteXXX()
+ if (_scene) {
+ bool res = _scene->removeObject(object);
+ if (DID_SUCCEED(res)) {
+ return res;
+ }
+ }
+
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i] == object) {
+ _objects.remove_at(i);
+ break;
+ }
+ }
+ return unregisterObject(object);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::changeScene(const char *filename, bool fadeIn) {
+ if (_scene == NULL) {
+ _scene = new AdScene(_gameRef);
+ registerObject(_scene);
+ } else {
+ _scene->applyEvent("SceneShutdown", true);
+
+ setPrevSceneName(_scene->getName());
+ setPrevSceneFilename(_scene->getFilename());
+
+ if (!_tempDisableSaveState) {
+ _scene->saveState();
+ }
+ _tempDisableSaveState = false;
+ }
+
+ if (_scene) {
+ // reset objects
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ _objects[i]->reset();
+ }
+
+ // reset scene properties
+ _scene->_sFXVolume = 100;
+ if (_scene->_scProp) {
+ _scene->_scProp->cleanup();
+ }
+
+ bool ret;
+ if (_initialScene && _debugDebugMode && _debugStartupScene) {
+ _initialScene = false;
+ ret = _scene->loadFile(_debugStartupScene);
+ } else {
+ ret = _scene->loadFile(filename);
+ }
+
+ if (DID_SUCCEED(ret)) {
+ // invalidate references to the original scene
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ _objects[i]->invalidateCurrRegions();
+ _objects[i]->_stickRegion = NULL;
+ }
+
+ _scene->loadState();
+ }
+ if (fadeIn) {
+ _gameRef->_transMgr->start(TRANSITION_FADE_IN);
+ }
+ return ret;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdGame::addSentence(AdSentence *sentence) {
+ _sentences.add(sentence);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::displaySentences(bool frozen) {
+ for (uint32 i = 0; i < _sentences.size(); i++) {
+ if (frozen && _sentences[i]->_freezable) {
+ continue;
+ } else {
+ _sentences[i]->display();
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdGame::finishSentences() {
+ for (uint32 i = 0; i < _sentences.size(); i++) {
+ if (_sentences[i]->canSkip()) {
+ _sentences[i]->_duration = 0;
+ if (_sentences[i]->_sound) {
+ _sentences[i]->_sound->stop();
+ }
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // ChangeScene
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "ChangeScene") == 0) {
+ stack->correctParams(3);
+ const char *filename = stack->pop()->getString();
+ ScValue *valFadeOut = stack->pop();
+ ScValue *valFadeIn = stack->pop();
+
+ bool transOut = valFadeOut->isNULL() ? true : valFadeOut->getBool();
+ bool transIn = valFadeIn->isNULL() ? true : valFadeIn->getBool();
+
+ scheduleChangeScene(filename, transIn);
+ if (transOut) {
+ _transMgr->start(TRANSITION_FADE_OUT, true);
+ }
+ stack->pushNULL();
+
+
+ //bool ret = ChangeScene(stack->pop()->getString());
+ //if (DID_FAIL(ret)) stack->pushBool(false);
+ //else stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadActor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadActor") == 0) {
+ stack->correctParams(1);
+ AdActor *act = new AdActor(_gameRef);
+ if (act && DID_SUCCEED(act->loadFile(stack->pop()->getString()))) {
+ addObject(act);
+ stack->pushNative(act, true);
+ } else {
+ delete act;
+ act = NULL;
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadEntity") == 0) {
+ stack->correctParams(1);
+ AdEntity *ent = new AdEntity(_gameRef);
+ if (ent && DID_SUCCEED(ent->loadFile(stack->pop()->getString()))) {
+ addObject(ent);
+ stack->pushNative(ent, true);
+ } else {
+ delete ent;
+ ent = NULL;
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // UnloadObject / UnloadActor / UnloadEntity / DeleteEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "UnloadObject") == 0 || strcmp(name, "UnloadActor") == 0 || strcmp(name, "UnloadEntity") == 0 || strcmp(name, "DeleteEntity") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ AdObject *obj = (AdObject *)val->getNative();
+ removeObject(obj);
+ if (val->getType() == VAL_VARIABLE_REF) {
+ val->setNULL();
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateEntity") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdEntity *ent = new AdEntity(_gameRef);
+ addObject(ent);
+ if (!val->isNULL()) {
+ ent->setName(val->getString());
+ }
+ stack->pushNative(ent, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateItem") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdItem *item = new AdItem(_gameRef);
+ addItem(item);
+ if (!val->isNULL()) {
+ item->setName(val->getString());
+ }
+ stack->pushNative(item, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteItem") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdItem *item = NULL;
+ if (val->isNative()) {
+ item = (AdItem *)val->getNative();
+ } else {
+ item = getItemByName(val->getString());
+ }
+
+ if (item) {
+ deleteItem(item);
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // QueryItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "QueryItem") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdItem *item = NULL;
+ if (val->isInt()) {
+ int index = val->getInt();
+ if (index >= 0 && index < (int32)_items.size()) {
+ item = _items[index];
+ }
+ } else {
+ item = getItemByName(val->getString());
+ }
+
+ if (item) {
+ stack->pushNative(item, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddResponse/AddResponseOnce/AddResponseOnceGame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddResponse") == 0 || strcmp(name, "AddResponseOnce") == 0 || strcmp(name, "AddResponseOnceGame") == 0) {
+ stack->correctParams(6);
+ int id = stack->pop()->getInt();
+ const char *text = stack->pop()->getString();
+ ScValue *val1 = stack->pop();
+ ScValue *val2 = stack->pop();
+ ScValue *val3 = stack->pop();
+ ScValue *val4 = stack->pop();
+
+ if (_responseBox) {
+ AdResponse *res = new AdResponse(_gameRef);
+ if (res) {
+ res->_iD = id;
+ res->setText(text);
+ _stringTable->expand(&res->_text);
+ if (!val1->isNULL()) {
+ res->setIcon(val1->getString());
+ }
+ if (!val2->isNULL()) {
+ res->setIconHover(val2->getString());
+ }
+ if (!val3->isNULL()) {
+ res->setIconPressed(val3->getString());
+ }
+ if (!val4->isNULL()) {
+ res->setFont(val4->getString());
+ }
+
+ if (strcmp(name, "AddResponseOnce") == 0) {
+ res->_responseType = RESPONSE_ONCE;
+ } else if (strcmp(name, "AddResponseOnceGame") == 0) {
+ res->_responseType = RESPONSE_ONCE_GAME;
+ }
+
+ _responseBox->_responses.add(res);
+ }
+ } else {
+ script->runtimeError("Game.AddResponse: response box is not defined");
+ }
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ResetResponse
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ResetResponse") == 0) {
+ stack->correctParams(1);
+ int id = stack->pop()->getInt(-1);
+ resetResponse(id);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ClearResponses
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ClearResponses") == 0) {
+ stack->correctParams(0);
+ _responseBox->clearResponses();
+ _responseBox->clearButtons();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetResponse
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetResponse") == 0) {
+ stack->correctParams(1);
+ bool autoSelectLast = stack->pop()->getBool();
+
+ if (_responseBox) {
+ _responseBox->weedResponses();
+
+ if (_responseBox->_responses.size() == 0) {
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+
+ if (_responseBox->_responses.size() == 1 && autoSelectLast) {
+ stack->pushInt(_responseBox->_responses[0]->_iD);
+ _responseBox->handleResponse(_responseBox->_responses[0]);
+ _responseBox->clearResponses();
+ return STATUS_OK;
+ }
+
+ _responseBox->createButtons();
+ _responseBox->_waitingScript = script;
+ script->waitForExclusive(_responseBox);
+ _state = GAME_SEMI_FROZEN;
+ _stateEx = GAME_WAITING_RESPONSE;
+ } else {
+ script->runtimeError("Game.GetResponse: response box is not defined");
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetNumResponses
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetNumResponses") == 0) {
+ stack->correctParams(0);
+ if (_responseBox) {
+ _responseBox->weedResponses();
+ stack->pushInt(_responseBox->_responses.size());
+ } else {
+ script->runtimeError("Game.GetNumResponses: response box is not defined");
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // StartDlgBranch
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StartDlgBranch") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ Common::String branchName;
+ if (val->isNULL()) {
+ branchName.format("line%d", script->_currentLine);
+ } else {
+ branchName = val->getString();
+ }
+
+ startDlgBranch(branchName.c_str(), script->_filename == NULL ? "" : script->_filename, script->_threadEvent == NULL ? "" : script->_threadEvent);
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // EndDlgBranch
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "EndDlgBranch") == 0) {
+ stack->correctParams(1);
+
+ const char *branchName = NULL;
+ ScValue *val = stack->pop();
+ if (!val->isNULL()) {
+ branchName = val->getString();
+ }
+ endDlgBranch(branchName, script->_filename == NULL ? "" : script->_filename, script->_threadEvent == NULL ? "" : script->_threadEvent);
+
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetCurrentDlgBranch
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetCurrentDlgBranch") == 0) {
+ stack->correctParams(0);
+
+ if (_dlgPendingBranches.size() > 0) {
+ stack->pushString(_dlgPendingBranches[_dlgPendingBranches.size() - 1]);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TakeItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TakeItem") == 0) {
+ return _invObject->scCallMethod(script, stack, thisStack, name);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DropItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DropItem") == 0) {
+ return _invObject->scCallMethod(script, stack, thisStack, name);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetItem") == 0) {
+ return _invObject->scCallMethod(script, stack, thisStack, name);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HasItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HasItem") == 0) {
+ return _invObject->scCallMethod(script, stack, thisStack, name);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsItemTaken
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsItemTaken") == 0) {
+ stack->correctParams(1);
+
+ ScValue *val = stack->pop();
+ if (!val->isNULL()) {
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ AdInventory *inv = _inventories[i];
+
+ for (uint32 j = 0; j < inv->_takenItems.size(); j++) {
+ if (val->getNative() == inv->_takenItems[j]) {
+ stack->pushBool(true);
+ return STATUS_OK;
+ } else if (scumm_stricmp(val->getString(), inv->_takenItems[j]->getName()) == 0) {
+ stack->pushBool(true);
+ return STATUS_OK;
+ }
+ }
+ }
+ } else {
+ script->runtimeError("Game.IsItemTaken: item name expected");
+ }
+
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetInventoryWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetInventoryWindow") == 0) {
+ stack->correctParams(0);
+ if (_inventoryBox && _inventoryBox->_window) {
+ stack->pushNative(_inventoryBox->_window, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetResponsesWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetResponsesWindow") == 0 || strcmp(name, "GetResponseWindow") == 0) {
+ stack->correctParams(0);
+ if (_responseBox && _responseBox->_window) {
+ stack->pushNative(_responseBox->_window, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadResponseBox
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadResponseBox") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+
+ _gameRef->unregisterObject(_responseBox);
+ _responseBox = new AdResponseBox(_gameRef);
+ if (_responseBox && !DID_FAIL(_responseBox->loadFile(filename))) {
+ registerObject(_responseBox);
+ stack->pushBool(true);
+ } else {
+ delete _responseBox;
+ _responseBox = NULL;
+ stack->pushBool(false);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadInventoryBox
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadInventoryBox") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+
+ _gameRef->unregisterObject(_inventoryBox);
+ _inventoryBox = new AdInventoryBox(_gameRef);
+ if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile(filename))) {
+ registerObject(_inventoryBox);
+ stack->pushBool(true);
+ } else {
+ delete _inventoryBox;
+ _inventoryBox = NULL;
+ stack->pushBool(false);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadItems
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadItems") == 0) {
+ stack->correctParams(2);
+ const char *filename = stack->pop()->getString();
+ bool merge = stack->pop()->getBool(false);
+
+ bool ret = loadItemsFile(filename, merge);
+ stack->pushBool(DID_SUCCEED(ret));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddSpeechDir
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddSpeechDir") == 0) {
+ stack->correctParams(1);
+ const char *dir = stack->pop()->getString();
+ stack->pushBool(DID_SUCCEED(addSpeechDir(dir)));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveSpeechDir
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveSpeechDir") == 0) {
+ stack->correctParams(1);
+ const char *dir = stack->pop()->getString();
+ stack->pushBool(DID_SUCCEED(removeSpeechDir(dir)));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetSceneViewport
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetSceneViewport") == 0) {
+ stack->correctParams(4);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ int width = stack->pop()->getInt();
+ int height = stack->pop()->getInt();
+
+ if (width <= 0) {
+ width = _renderer->_width;
+ }
+ if (height <= 0) {
+ height = _renderer->_height;
+ }
+
+ if (!_sceneViewport) {
+ _sceneViewport = new BaseViewport(_gameRef);
+ }
+ if (_sceneViewport) {
+ _sceneViewport->setRect(x, y, x + width, y + height);
+ }
+
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+
+ else {
+ return BaseGame::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdGame::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("game");
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Scene
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Scene") {
+ if (_scene) {
+ _scValue->setNative(_scene, true);
+ } else {
+ _scValue->setNULL();
+ }
+
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SelectedItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SelectedItem") {
+ //if (_selectedItem) _scValue->setString(_selectedItem->_name);
+ if (_selectedItem) {
+ _scValue->setNative(_selectedItem, true);
+ } else {
+ _scValue->setNULL();
+ }
+
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // NumItems
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumItems") {
+ return _invObject->scGetProperty(name);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SmartItemCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SmartItemCursor") {
+ _scValue->setBool(_smartItemCursor);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InventoryVisible
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "InventoryVisible") {
+ _scValue->setBool(_inventoryBox && _inventoryBox->_visible);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InventoryScrollOffset
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "InventoryScrollOffset") {
+ if (_inventoryBox) {
+ _scValue->setInt(_inventoryBox->_scrollOffset);
+ } else {
+ _scValue->setInt(0);
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ResponsesVisible (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ResponsesVisible") {
+ _scValue->setBool(_stateEx == GAME_WAITING_RESPONSE);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PrevScene / PreviousScene (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PrevScene" || name == "PreviousScene") {
+ if (!_prevSceneName) {
+ _scValue->setString("");
+ } else {
+ _scValue->setString(_prevSceneName);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PrevSceneFilename / PreviousSceneFilename (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PrevSceneFilename" || name == "PreviousSceneFilename") {
+ if (!_prevSceneFilename) {
+ _scValue->setString("");
+ } else {
+ _scValue->setString(_prevSceneFilename);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LastResponse (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "LastResponse") {
+ if (!_responseBox || !_responseBox->_lastResponseText) {
+ _scValue->setString("");
+ } else {
+ _scValue->setString(_responseBox->_lastResponseText);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LastResponseOrig (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "LastResponseOrig") {
+ if (!_responseBox || !_responseBox->_lastResponseTextOrig) {
+ _scValue->setString("");
+ } else {
+ _scValue->setString(_responseBox->_lastResponseTextOrig);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InventoryObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "InventoryObject") {
+ if (_inventoryOwner == _invObject) {
+ _scValue->setNative(this, true);
+ } else {
+ _scValue->setNative(_inventoryOwner, true);
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TotalNumItems
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TotalNumItems") {
+ _scValue->setInt(_items.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TalkSkipButton
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TalkSkipButton") {
+ _scValue->setInt(_talkSkipButton);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ChangingScene
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ChangingScene") {
+ _scValue->setBool(_scheduledScene != NULL);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StartupScene
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "StartupScene") {
+ if (!_startupScene) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setString(_startupScene);
+ }
+ return _scValue;
+ }
+
+ else {
+ return BaseGame::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::scSetProperty(const char *name, ScValue *value) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // SelectedItem
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SelectedItem") == 0) {
+ if (value->isNULL()) {
+ _selectedItem = NULL;
+ } else {
+ if (value->isNative()) {
+ _selectedItem = NULL;
+ for (uint32 i = 0; i < _items.size(); i++) {
+ if (_items[i] == value->getNative()) {
+ _selectedItem = (AdItem *)value->getNative();
+ break;
+ }
+ }
+ } else {
+ // try to get by name
+ _selectedItem = getItemByName(value->getString());
+ }
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SmartItemCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SmartItemCursor") == 0) {
+ _smartItemCursor = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InventoryVisible
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InventoryVisible") == 0) {
+ if (_inventoryBox) {
+ _inventoryBox->_visible = value->getBool();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InventoryObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InventoryObject") == 0) {
+ if (_inventoryOwner && _inventoryBox) {
+ _inventoryOwner->getInventory()->_scrollOffset = _inventoryBox->_scrollOffset;
+ }
+
+ if (value->isNULL()) {
+ _inventoryOwner = _invObject;
+ } else {
+ BaseObject *obj = (BaseObject *)value->getNative();
+ if (obj == this) {
+ _inventoryOwner = _invObject;
+ } else if (_gameRef->validObject(obj)) {
+ _inventoryOwner = (AdObject *)obj;
+ }
+ }
+
+ if (_inventoryOwner && _inventoryBox) {
+ _inventoryBox->_scrollOffset = _inventoryOwner->getInventory()->_scrollOffset;
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InventoryScrollOffset
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InventoryScrollOffset") == 0) {
+ if (_inventoryBox) {
+ _inventoryBox->_scrollOffset = value->getInt();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TalkSkipButton
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TalkSkipButton") == 0) {
+ int val = value->getInt();
+ if (val < 0) {
+ val = 0;
+ }
+ if (val > TALK_SKIP_NONE) {
+ val = TALK_SKIP_NONE;
+ }
+ _talkSkipButton = (TTalkSkipButton)val;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StartupScene
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StartupScene") == 0) {
+ if (value == NULL) {
+ delete[] _startupScene;
+ _startupScene = NULL;
+ } else {
+ BaseUtils::setString(&_startupScene, value->getString());
+ }
+
+ return STATUS_OK;
+ }
+
+ else {
+ return BaseGame::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) {
+ ScValue *thisObj;
+
+ //////////////////////////////////////////////////////////////////////////
+ // Actor
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Actor") == 0) {
+ stack->correctParams(0);
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(new AdActor(_gameRef));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Entity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Entity") == 0) {
+ stack->correctParams(0);
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(new AdEntity(_gameRef));
+ stack->pushNULL();
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // call parent
+ else {
+ return BaseGame::externalCall(script, stack, thisStack, name);
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::showCursor() {
+ if (_cursorHidden) {
+ return STATUS_OK;
+ }
+
+ if (_selectedItem && _gameRef->_state == GAME_RUNNING && _stateEx == GAME_NORMAL && _interactive) {
+ if (_selectedItem->_cursorCombined) {
+ BaseSprite *origLastCursor = _lastCursor;
+ BaseGame::showCursor();
+ _lastCursor = origLastCursor;
+ }
+ if (_activeObject && _selectedItem->_cursorHover && _activeObject->getExtendedFlag("usable")) {
+ if (!_smartItemCursor || _activeObject->canHandleEvent(_selectedItem->getName())) {
+ return drawCursor(_selectedItem->_cursorHover);
+ } else {
+ return drawCursor(_selectedItem->_cursorNormal);
+ }
+ } else {
+ return drawCursor(_selectedItem->_cursorNormal);
+ }
+ } else {
+ return BaseGame::showCursor();
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdGame::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing GAME file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(GAME)
+TOKEN_DEF(AD_GAME)
+TOKEN_DEF(RESPONSE_BOX)
+TOKEN_DEF(INVENTORY_BOX)
+TOKEN_DEF(ITEMS)
+TOKEN_DEF(ITEM)
+TOKEN_DEF(TALK_SKIP_BUTTON)
+TOKEN_DEF(SCENE_VIEWPORT)
+TOKEN_DEF(ENTITY_CONTAINER)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(STARTUP_SCENE)
+TOKEN_DEF(DEBUG_STARTUP_SCENE)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(GAME)
+ TOKEN_TABLE(AD_GAME)
+ TOKEN_TABLE(RESPONSE_BOX)
+ TOKEN_TABLE(INVENTORY_BOX)
+ TOKEN_TABLE(ITEMS)
+ TOKEN_TABLE(TALK_SKIP_BUTTON)
+ TOKEN_TABLE(SCENE_VIEWPORT)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(STARTUP_SCENE)
+ TOKEN_TABLE(DEBUG_STARTUP_SCENE)
+ TOKEN_TABLE_END
+
+ byte *params;
+ byte *params2;
+ int cmd = 1;
+ BaseParser parser;
+
+ bool itemFound = false, itemsFound = false;
+
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_GAME:
+ if (DID_FAIL(BaseGame::loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_AD_GAME:
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&params, commands, (char **)&params2)) > 0) {
+ switch (cmd) {
+ case TOKEN_RESPONSE_BOX:
+ delete _responseBox;
+ _responseBox = new AdResponseBox(_gameRef);
+ if (_responseBox && !DID_FAIL(_responseBox->loadFile((char *)params2))) {
+ registerObject(_responseBox);
+ } else {
+ delete _responseBox;
+ _responseBox = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_INVENTORY_BOX:
+ delete _inventoryBox;
+ _inventoryBox = new AdInventoryBox(_gameRef);
+ if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile((char *)params2))) {
+ registerObject(_inventoryBox);
+ } else {
+ delete _inventoryBox;
+ _inventoryBox = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_ITEMS:
+ itemsFound = true;
+ BaseUtils::setString(&_itemsFile, (char *)params2);
+ if (DID_FAIL(loadItemsFile(_itemsFile))) {
+ delete[] _itemsFile;
+ _itemsFile = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_TALK_SKIP_BUTTON:
+ if (scumm_stricmp((char *)params2, "right") == 0) {
+ _talkSkipButton = TALK_SKIP_RIGHT;
+ } else if (scumm_stricmp((char *)params2, "both") == 0) {
+ _talkSkipButton = TALK_SKIP_BOTH;
+ } else {
+ _talkSkipButton = TALK_SKIP_LEFT;
+ }
+ break;
+
+ case TOKEN_SCENE_VIEWPORT: {
+ Rect32 rc;
+ parser.scanStr((char *)params2, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom);
+ if (!_sceneViewport) {
+ _sceneViewport = new BaseViewport(_gameRef);
+ }
+ if (_sceneViewport) {
+ _sceneViewport->setRect(rc.left, rc.top, rc.right, rc.bottom);
+ }
+ }
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params2, false);
+ break;
+
+ case TOKEN_STARTUP_SCENE:
+ BaseUtils::setString(&_startupScene, (char *)params2);
+ break;
+
+ case TOKEN_DEBUG_STARTUP_SCENE:
+ BaseUtils::setString(&_debugStartupScene, (char *)params2);
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in GAME definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading GAME definition");
+ return STATUS_FAILED;
+ }
+
+ if (itemFound && !itemsFound) {
+ _gameRef->LOG(0, "**Warning** Please put the items definition to a separate file.");
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::persist(BasePersistenceManager *persistMgr) {
+ if (!persistMgr->getIsSaving()) {
+ cleanup();
+ }
+ BaseGame::persist(persistMgr);
+
+ _dlgPendingBranches.persist(persistMgr);
+
+ _inventories.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_inventoryBox));
+
+ _objects.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_prevSceneName));
+ persistMgr->transfer(TMEMBER(_prevSceneFilename));
+
+ persistMgr->transfer(TMEMBER(_responseBox));
+ _responsesBranch.persist(persistMgr);
+ _responsesGame.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_scene));
+ _sceneStates.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_scheduledFadeIn));
+ persistMgr->transfer(TMEMBER(_scheduledScene));
+ persistMgr->transfer(TMEMBER(_selectedItem));
+ persistMgr->transfer(TMEMBER_INT(_talkSkipButton));
+
+ _sentences.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_sceneViewport));
+ persistMgr->transfer(TMEMBER_INT(_stateEx));
+ persistMgr->transfer(TMEMBER(_initialScene));
+ persistMgr->transfer(TMEMBER(_debugStartupScene));
+
+ persistMgr->transfer(TMEMBER(_invObject));
+ persistMgr->transfer(TMEMBER(_inventoryOwner));
+ persistMgr->transfer(TMEMBER(_tempDisableSaveState));
+ _items.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_itemsFile));
+
+ _speechDirs.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_smartItemCursor));
+
+ if (!persistMgr->getIsSaving()) {
+ _initialScene = false;
+ }
+
+ persistMgr->transfer(TMEMBER(_startupScene));
+
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void AdGame::setPrevSceneName(const char *name) {
+ delete[] _prevSceneName;
+ _prevSceneName = NULL;
+ if (name) {
+ _prevSceneName = new char[strlen(name) + 1];
+ if (_prevSceneName) {
+ strcpy(_prevSceneName, name);
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdGame::setPrevSceneFilename(const char *name) {
+ delete[] _prevSceneFilename;
+ _prevSceneFilename = NULL;
+ if (name) {
+ _prevSceneFilename = new char[strlen(name) + 1];
+ if (_prevSceneFilename) {
+ strcpy(_prevSceneFilename, name);
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::scheduleChangeScene(const char *filename, bool fadeIn) {
+ delete[] _scheduledScene;
+ _scheduledScene = NULL;
+
+ if (_scene && !_scene->_initialized) {
+ return changeScene(filename, fadeIn);
+ } else {
+ _scheduledScene = new char [strlen(filename) + 1];
+ strcpy(_scheduledScene, filename);
+
+ _scheduledFadeIn = fadeIn;
+
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
+ BaseGame::getVersion(verMajor, verMinor, NULL, NULL);
+
+ if (extMajor) {
+ *extMajor = 0;
+ }
+ if (extMinor) {
+ *extMinor = 0;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::loadItemsFile(const char *filename, bool merge) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdGame::LoadItemsFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ //_filename = new char [strlen(filename)+1];
+ //strcpy(_filename, filename);
+
+ if (DID_FAIL(ret = loadItemsBuffer(buffer, merge))) {
+ _gameRef->LOG(0, "Error parsing ITEMS file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::loadItemsBuffer(byte *buffer, bool merge) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ITEM)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (!merge) {
+ while (_items.size() > 0) {
+ deleteItem(_items[0]);
+ }
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_ITEM: {
+ AdItem *item = new AdItem(_gameRef);
+ if (item && !DID_FAIL(item->loadBuffer(params, false))) {
+ // delete item with the same name, if exists
+ if (merge) {
+ AdItem *prevItem = getItemByName(item->getName());
+ if (prevItem) {
+ deleteItem(prevItem);
+ }
+ }
+ addItem(item);
+ } else {
+ delete item;
+ item = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ }
+ break;
+ }
+ }
+
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ITEMS definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading ITEMS definition");
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdSceneState *AdGame::getSceneState(const char *filename, bool saving) {
+ char *filenameCor = new char[strlen(filename) + 1];
+ strcpy(filenameCor, filename);
+ for (uint32 i = 0; i < strlen(filenameCor); i++) {
+ if (filenameCor[i] == '/') {
+ filenameCor[i] = '\\';
+ }
+ }
+
+ for (uint32 i = 0; i < _sceneStates.size(); i++) {
+ if (scumm_stricmp(_sceneStates[i]->_filename, filenameCor) == 0) {
+ delete[] filenameCor;
+ return _sceneStates[i];
+ }
+ }
+
+ if (saving) {
+ AdSceneState *ret = new AdSceneState(_gameRef);
+ ret->setFilename(filenameCor);
+
+ _sceneStates.add(ret);
+
+ delete[] filenameCor;
+ return ret;
+ } else {
+ delete[] filenameCor;
+ return NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::windowLoadHook(UIWindow *win, char **buffer, char **params) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ENTITY_CONTAINER)
+ TOKEN_TABLE_END
+
+ int cmd = PARSERR_GENERIC;
+ BaseParser parser;
+
+ cmd = parser.getCommand(buffer, commands, params);
+ switch (cmd) {
+ case TOKEN_ENTITY_CONTAINER: {
+ UIEntity *ent = new UIEntity(_gameRef);
+ if (!ent || DID_FAIL(ent->loadBuffer((byte *)*params, false))) {
+ delete ent;
+ ent = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ ent->_parent = win;
+ win->_widgets.add(ent);
+ }
+ }
+ break;
+ }
+
+ if (cmd == PARSERR_TOKENNOTFOUND || cmd == PARSERR_GENERIC) {
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) {
+ if (strcmp(name, "CreateEntityContainer") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ UIEntity *ent = new UIEntity(_gameRef);
+ if (!val->isNULL()) {
+ ent->setName(val->getString());
+ }
+ stack->pushNative(ent, true);
+
+ ent->_parent = win;
+ win->_widgets.add(ent);
+
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::startDlgBranch(const char *branchName, const char *scriptName, const char *eventName) {
+ char *name = new char[strlen(branchName) + 1 + strlen(scriptName) + 1 + strlen(eventName) + 1];
+ if (name) {
+ sprintf(name, "%s.%s.%s", branchName, scriptName, eventName);
+ _dlgPendingBranches.add(name);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) {
+ char *name = NULL;
+ bool deleteName = false;
+ if (branchName == NULL && _dlgPendingBranches.size() > 0) {
+ name = _dlgPendingBranches[_dlgPendingBranches.size() - 1];
+ } else {
+ if (branchName != NULL) {
+ name = new char[strlen(branchName) + 1 + strlen(scriptName) + 1 + strlen(eventName) + 1];
+ if (name) {
+ sprintf(name, "%s.%s.%s", branchName, scriptName, eventName);
+ deleteName = true;
+ }
+ }
+ }
+
+ if (name == NULL) {
+ return STATUS_OK;
+ }
+
+
+ int startIndex = -1;
+ for (int i = _dlgPendingBranches.size() - 1; i >= 0; i--) {
+ if (scumm_stricmp(name, _dlgPendingBranches[i]) == 0) {
+ startIndex = i;
+ break;
+ }
+ }
+ if (startIndex >= 0) {
+ for (uint32 i = startIndex; i < _dlgPendingBranches.size(); i++) {
+ //ClearBranchResponses(_dlgPendingBranches[i]);
+ delete[] _dlgPendingBranches[i];
+ _dlgPendingBranches[i] = NULL;
+ }
+ _dlgPendingBranches.remove_at(startIndex, _dlgPendingBranches.size() - startIndex);
+ }
+
+ // dialogue is over, forget selected responses
+ if (_dlgPendingBranches.size() == 0) {
+ for (uint32 i = 0; i < _responsesBranch.size(); i++) {
+ delete _responsesBranch[i];
+ }
+ _responsesBranch.clear();
+ }
+
+ if (deleteName) {
+ delete[] name;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::clearBranchResponses(char *name) {
+ for (uint32 i = 0; i < _responsesBranch.size(); i++) {
+ if (scumm_stricmp(name, _responsesBranch[i]->_context) == 0) {
+ delete _responsesBranch[i];
+ _responsesBranch.remove_at(i);
+ i--;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::addBranchResponse(int id) {
+ if (branchResponseUsed(id)) {
+ return STATUS_OK;
+ }
+ AdResponseContext *r = new AdResponseContext(_gameRef);
+ r->_id = id;
+ r->setContext(_dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL);
+ _responsesBranch.add(r);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::branchResponseUsed(int id) {
+ char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL;
+ for (uint32 i = 0; i < _responsesBranch.size(); i++) {
+ if (_responsesBranch[i]->_id == id) {
+ if ((context == NULL && _responsesBranch[i]->_context == NULL) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::addGameResponse(int id) {
+ if (gameResponseUsed(id)) {
+ return STATUS_OK;
+ }
+ AdResponseContext *r = new AdResponseContext(_gameRef);
+ r->_id = id;
+ r->setContext(_dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL);
+ _responsesGame.add(r);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::gameResponseUsed(int id) {
+ char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL;
+ for (uint32 i = 0; i < _responsesGame.size(); i++) {
+ AdResponseContext *respContext = _responsesGame[i];
+ if (respContext->_id == id) {
+ if ((context == NULL && respContext->_context == NULL) || ((context != NULL && respContext->_context != NULL) && scumm_stricmp(context, respContext->_context) == 0)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::resetResponse(int id) {
+ char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL;
+
+ for (uint32 i = 0; i < _responsesGame.size(); i++) {
+ if (_responsesGame[i]->_id == id) {
+ if ((context == NULL && _responsesGame[i]->_context == NULL) || scumm_stricmp(context, _responsesGame[i]->_context) == 0) {
+ delete _responsesGame[i];
+ _responsesGame.remove_at(i);
+ break;
+ }
+ }
+ }
+
+ for (uint32 i = 0; i < _responsesBranch.size(); i++) {
+ if (_responsesBranch[i]->_id == id) {
+ if ((context == NULL && _responsesBranch[i]->_context == NULL) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) {
+ delete _responsesBranch[i];
+ _responsesBranch.remove_at(i);
+ break;
+ }
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::displayContent(bool doUpdate, bool displayAll) {
+ // init
+ if (doUpdate) {
+ initLoop();
+ }
+
+ // fill black
+ _renderer->fill(0, 0, 0);
+ if (!_editorMode) {
+ _renderer->setScreenViewport();
+ }
+
+ // playing exclusive video?
+ if (_videoPlayer->isPlaying()) {
+ if (doUpdate) {
+ _videoPlayer->update();
+ }
+ _videoPlayer->display();
+ } else if (_theoraPlayer) {
+ if (_theoraPlayer->isPlaying()) {
+ if (doUpdate) {
+ _theoraPlayer->update();
+ }
+ _theoraPlayer->display();
+ }
+ if (_theoraPlayer->isFinished()) {
+ delete _theoraPlayer;
+ _theoraPlayer = NULL;
+ }
+ } else {
+
+ // process scripts
+ if (doUpdate) {
+ _scEngine->tick();
+ }
+
+ Point32 p;
+ getMousePos(&p);
+
+ _scene->update();
+ _scene->display();
+
+
+ // display in-game windows
+ displayWindows(true);
+ if (_inventoryBox) {
+ _inventoryBox->display();
+ }
+ if (_stateEx == GAME_WAITING_RESPONSE) {
+ _responseBox->display();
+ }
+ _renderer->displayIndicator();
+
+
+ if (doUpdate || displayAll) {
+ // display normal windows
+ displayWindows(false);
+
+ setActiveObject(_gameRef->_renderer->getObjectAt(p.x, p.y));
+
+ // textual info
+ displaySentences(_state == GAME_FROZEN);
+
+ showCursor();
+
+ if (_fader) {
+ _fader->display();
+ }
+ _transMgr->update();
+ }
+
+ }
+ if (_loadingIcon) {
+ _loadingIcon->display(_loadingIconX, _loadingIconY);
+ if (!_loadingIconPersistent) {
+ delete _loadingIcon;
+ _loadingIcon = NULL;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::registerInventory(AdInventory *inv) {
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ if (_inventories[i] == inv) {
+ return STATUS_OK;
+ }
+ }
+ registerObject(inv);
+ _inventories.add(inv);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::unregisterInventory(AdInventory *inv) {
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ if (_inventories[i] == inv) {
+ unregisterObject(_inventories[i]);
+ _inventories.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::isItemTaken(char *itemName) {
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ AdInventory *inv = _inventories[i];
+
+ for (uint32 j = 0; j < inv->_takenItems.size(); j++) {
+ if (scumm_stricmp(itemName, inv->_takenItems[j]->getName()) == 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AdItem *AdGame::getItemByName(const char *name) {
+ for (uint32 i = 0; i < _items.size(); i++) {
+ if (scumm_stricmp(_items[i]->getName(), name) == 0) {
+ return _items[i];
+ }
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::addItem(AdItem *item) {
+ _items.add(item);
+ return _gameRef->registerObject(item);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::resetContent() {
+ // clear pending dialogs
+ for (uint32 i = 0; i < _dlgPendingBranches.size(); i++) {
+ delete[] _dlgPendingBranches[i];
+ }
+ _dlgPendingBranches.clear();
+
+
+ // clear inventories
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ _inventories[i]->_takenItems.clear();
+ }
+
+ // clear scene states
+ for (uint32 i = 0; i < _sceneStates.size(); i++) {
+ delete _sceneStates[i];
+ }
+ _sceneStates.clear();
+
+ // clear once responses
+ for (uint32 i = 0; i < _responsesBranch.size(); i++) {
+ delete _responsesBranch[i];
+ }
+ _responsesBranch.clear();
+
+ // clear once game responses
+ for (uint32 i = 0; i < _responsesGame.size(); i++) {
+ delete _responsesGame[i];
+ }
+ _responsesGame.clear();
+
+ // reload inventory items
+ if (_itemsFile) {
+ loadItemsFile(_itemsFile);
+ }
+
+ _tempDisableSaveState = true;
+
+ return BaseGame::resetContent();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::deleteItem(AdItem *item) {
+ if (!item) {
+ return STATUS_FAILED;
+ }
+
+ if (_selectedItem == item) {
+ _selectedItem = NULL;
+ }
+ _scene->handleItemAssociations(item->getName(), false);
+
+ // remove from all inventories
+ for (uint32 i = 0; i < _inventories.size(); i++) {
+ _inventories[i]->removeItem(item);
+ }
+
+ // remove object
+ for (uint32 i = 0; i < _items.size(); i++) {
+ if (_items[i] == item) {
+ unregisterObject(_items[i]);
+ _items.remove_at(i);
+ break;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::addSpeechDir(const char *dir) {
+ if (!dir || dir[0] == '\0') {
+ return STATUS_FAILED;
+ }
+
+ char *temp = new char[strlen(dir) + 2];
+ strcpy(temp, dir);
+ if (temp[strlen(temp) - 1] != '\\' && temp[strlen(temp) - 1] != '/') {
+ strcat(temp, "\\");
+ }
+
+ for (uint32 i = 0; i < _speechDirs.size(); i++) {
+ if (scumm_stricmp(_speechDirs[i], temp) == 0) {
+ delete[] temp;
+ return STATUS_OK;
+ }
+ }
+ _speechDirs.add(temp);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::removeSpeechDir(const char *dir) {
+ if (!dir || dir[0] == '\0') {
+ return STATUS_FAILED;
+ }
+
+ char *temp = new char[strlen(dir) + 2];
+ strcpy(temp, dir);
+ if (temp[strlen(temp) - 1] != '\\' && temp[strlen(temp) - 1] != '/') {
+ strcat(temp, "\\");
+ }
+
+ bool found = false;
+ for (uint32 i = 0; i < _speechDirs.size(); i++) {
+ if (scumm_stricmp(_speechDirs[i], temp) == 0) {
+ delete[] _speechDirs[i];
+ _speechDirs.remove_at(i);
+ found = true;
+ break;
+ }
+ }
+ delete[] temp;
+
+ return found;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *AdGame::findSpeechFile(char *stringID) {
+ char *ret = new char[MAX_PATH_LENGTH];
+
+ for (uint32 i = 0; i < _speechDirs.size(); i++) {
+ sprintf(ret, "%s%s.ogg", _speechDirs[i], stringID);
+ if (BaseFileManager::getEngineInstance()->hasFile(ret)) {
+ return ret;
+ }
+
+ sprintf(ret, "%s%s.wav", _speechDirs[i], stringID);
+ if (BaseFileManager::getEngineInstance()->hasFile(ret)) {
+ return ret;
+ }
+ }
+ delete[] ret;
+ return NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::validMouse() {
+ Point32 pos;
+ BasePlatform::getCursorPos(&pos);
+
+ return _renderer->pointInViewport(&pos);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::onMouseLeftDown() {
+ if (!validMouse()) {
+ return STATUS_OK;
+ }
+ if (_state == GAME_RUNNING && !_interactive) {
+ if (_talkSkipButton == TALK_SKIP_LEFT || _talkSkipButton == TALK_SKIP_BOTH) {
+ finishSentences();
+ }
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_LEFT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("LeftClick");
+ } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) {
+ _scene->applyEvent("LeftClick");
+ }
+ }
+
+ if (_activeObject != NULL) {
+ _gameRef->_capturedObject = _gameRef->_activeObject;
+ }
+ _mouseLeftDown = true;
+ BasePlatform::setCapture(/*_renderer->_window*/);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::onMouseLeftUp() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
+ }
+
+ BasePlatform::releaseCapture();
+ _capturedObject = NULL;
+ _mouseLeftDown = false;
+
+ bool handled = /*_state==GAME_RUNNING &&*/ DID_SUCCEED(applyEvent("LeftRelease"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("LeftRelease");
+ } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) {
+ _scene->applyEvent("LeftRelease");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::onMouseLeftDblClick() {
+ if (!validMouse()) {
+ return STATUS_OK;
+ }
+
+ if (_state == GAME_RUNNING && !_interactive) {
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_LEFT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftDoubleClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("LeftDoubleClick");
+ } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) {
+ _scene->applyEvent("LeftDoubleClick");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::onMouseRightDown() {
+ if (!validMouse()) {
+ return STATUS_OK;
+ }
+ if (_state == GAME_RUNNING && !_interactive) {
+ if (_talkSkipButton == TALK_SKIP_RIGHT || _talkSkipButton == TALK_SKIP_BOTH) {
+ finishSentences();
+ }
+ return STATUS_OK;
+ }
+
+ if ((_state == GAME_RUNNING && !_interactive) || _stateEx == GAME_WAITING_RESPONSE) {
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_RIGHT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("RightClick");
+ } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) {
+ _scene->applyEvent("RightClick");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::onMouseRightUp() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("RightRelease");
+ } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) {
+ _scene->applyEvent("RightRelease");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::displayDebugInfo() {
+ char str[100];
+ if (_gameRef->_debugDebugMode) {
+ sprintf(str, "Mouse: %d, %d (scene: %d, %d)", _mousePos.x, _mousePos.y, _mousePos.x + _scene->getOffsetLeft(), _mousePos.y + _scene->getOffsetTop());
+ _systemFont->drawText((byte *)str, 0, 90, _renderer->_width, TAL_RIGHT);
+
+ sprintf(str, "Scene: %s (prev: %s)", (_scene && _scene->getName()) ? _scene->getName() : "???", _prevSceneName ? _prevSceneName : "???");
+ _systemFont->drawText((byte *)str, 0, 110, _renderer->_width, TAL_RIGHT);
+ }
+ return BaseGame::displayDebugInfo();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdGame::onScriptShutdown(ScScript *script) {
+ if (_responseBox && _responseBox->_waitingScript == script) {
+ _responseBox->_waitingScript = NULL;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h
new file mode 100644
index 0000000000..81c79a3da8
--- /dev/null
+++ b/engines/wintermute/ad/ad_game.h
@@ -0,0 +1,163 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+#ifndef WINTERMUTE_ADGAME_H
+#define WINTERMUTE_ADGAME_H
+
+#include "engines/wintermute/ad/ad_types.h"
+#include "engines/wintermute/base/base_game.h"
+
+namespace Wintermute {
+class AdItem;
+class AdInventory;
+class AdSceneState;
+class AdScene;
+class AdItem;
+class AdObject;
+class AdSentence;
+class AdInventoryBox;
+class AdResponseContext;
+class AdResponseBox;
+class AdGame : public BaseGame {
+public:
+ virtual bool onScriptShutdown(ScScript *script);
+
+ virtual bool onMouseLeftDown();
+ virtual bool onMouseLeftUp();
+ virtual bool onMouseLeftDblClick();
+ virtual bool onMouseRightDown();
+ virtual bool onMouseRightUp();
+
+ virtual bool displayDebugInfo();
+
+ bool addSpeechDir(const char *dir);
+ bool removeSpeechDir(const char *dir);
+ char *findSpeechFile(char *StringID);
+
+ bool deleteItem(AdItem *Item);
+ char *_itemsFile;
+ bool _tempDisableSaveState;
+ virtual bool resetContent();
+ bool addItem(AdItem *item);
+ AdItem *getItemByName(const char *name);
+
+ AdObject *_inventoryOwner;
+ bool isItemTaken(char *itemName);
+ bool registerInventory(AdInventory *inv);
+ bool unregisterInventory(AdInventory *inv);
+ virtual bool displayContent(bool update = true, bool displayAll = false);
+
+ bool gameResponseUsed(int ID);
+ bool addGameResponse(int ID);
+ bool resetResponse(int ID);
+
+ bool branchResponseUsed(int ID);
+ bool addBranchResponse(int ID);
+ bool clearBranchResponses(char *name);
+ bool startDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
+ bool endDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
+ virtual bool windowLoadHook(UIWindow *win, char **buf, char **params);
+ virtual bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name);
+
+ AdSceneState *getSceneState(const char *filename, bool saving);
+ BaseViewport *_sceneViewport;
+
+ int _texItemLifeTime;
+ int _texWalkLifeTime;
+ int _texStandLifeTime;
+ int _texTalkLifeTime;
+
+ TTalkSkipButton _talkSkipButton;
+
+ virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
+ bool scheduleChangeScene(const char *filename, bool fadeIn);
+ void setPrevSceneName(const char *name);
+ void setPrevSceneFilename(const char *name);
+
+ AdItem *_selectedItem;
+ bool cleanup();
+ DECLARE_PERSISTENT(AdGame, BaseGame)
+
+ void finishSentences();
+ bool showCursor();
+
+ TGameStateEx _stateEx;
+
+ bool displaySentences(bool frozen);
+ void addSentence(AdSentence *sentence);
+ bool changeScene(const char *filename, bool fadeIn);
+ bool removeObject(AdObject *object);
+ bool addObject(AdObject *object);
+ AdScene *_scene;
+ bool initLoop();
+ AdGame(const Common::String &gameId);
+ virtual ~AdGame();
+
+ BaseArray<AdObject *> _objects;
+
+ virtual bool loadFile(const char *filename);
+ virtual bool loadBuffer(byte *buffer, bool complete = true);
+
+ bool loadItemsFile(const char *filename, bool merge = false);
+ bool loadItemsBuffer(byte *buffer, bool merge = false);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ bool validMouse();
+private:
+ virtual bool externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name);
+
+ AdObject *_invObject;
+ BaseArray<AdInventory *> _inventories;
+ char *_scheduledScene;
+ bool _scheduledFadeIn;
+ char *_prevSceneName;
+ char *_prevSceneFilename;
+ char *_debugStartupScene;
+ char *_startupScene;
+ bool _initialScene;
+ bool _smartItemCursor;
+ BaseArray<char *> _speechDirs;
+ BaseArray<AdItem *> _items;
+
+ BaseArray<AdSentence *> _sentences;
+
+ BaseArray<AdSceneState *> _sceneStates;
+ BaseArray<char *> _dlgPendingBranches;
+
+ BaseArray<AdResponseContext *> _responsesBranch;
+ BaseArray<AdResponseContext *> _responsesGame;
+
+ AdResponseBox *_responseBox;
+ AdInventoryBox *_inventoryBox;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_inventory.cpp b/engines/wintermute/ad/ad_inventory.cpp
new file mode 100644
index 0000000000..72f8fa0fb4
--- /dev/null
+++ b/engines/wintermute/ad/ad_inventory.cpp
@@ -0,0 +1,136 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_inventory.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_item.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdInventory, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdInventory::AdInventory(BaseGame *inGame) : BaseObject(inGame) {
+ _scrollOffset = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdInventory::~AdInventory() {
+ _takenItems.clear(); // ref only
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventory::insertItem(const char *name, const char *insertAfter) {
+ if (name == NULL) {
+ return STATUS_FAILED;
+ }
+
+ AdItem *item = ((AdGame *)_gameRef)->getItemByName(name);
+ if (item == NULL) {
+ return STATUS_FAILED;
+ }
+
+ int insertIndex = -1;
+ for (uint32 i = 0; i < _takenItems.size(); i++) {
+ if (scumm_stricmp(_takenItems[i]->getName(), name) == 0) {
+ _takenItems.remove_at(i);
+ i--;
+ continue;
+ }
+ if (insertAfter && scumm_stricmp(_takenItems[i]->getName(), insertAfter) == 0) {
+ insertIndex = i + 1;
+ }
+ }
+
+
+ if (insertIndex == -1) {
+ _takenItems.add(item);
+ } else {
+ _takenItems.insert_at(insertIndex, item);
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventory::removeItem(const char *name) {
+ if (name == NULL) {
+ return STATUS_FAILED;
+ }
+
+ for (uint32 i = 0; i < _takenItems.size(); i++) {
+ if (scumm_stricmp(_takenItems[i]->getName(), name) == 0) {
+ if (((AdGame *)_gameRef)->_selectedItem == _takenItems[i]) {
+ ((AdGame *)_gameRef)->_selectedItem = NULL;
+ }
+ _takenItems.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_FAILED;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventory::removeItem(AdItem *item) {
+ if (item == NULL) {
+ return STATUS_FAILED;
+ }
+
+ for (uint32 i = 0; i < _takenItems.size(); i++) {
+ if (_takenItems[i] == item) {
+ if (((AdGame *)_gameRef)->_selectedItem == _takenItems[i]) {
+ ((AdGame *)_gameRef)->_selectedItem = NULL;
+ }
+ _takenItems.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventory::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ _takenItems.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_scrollOffset));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_inventory.h b/engines/wintermute/ad/ad_inventory.h
new file mode 100644
index 0000000000..4017d914bc
--- /dev/null
+++ b/engines/wintermute/ad/ad_inventory.h
@@ -0,0 +1,52 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADINVENTORY_H
+#define WINTERMUTE_ADINVENTORY_H
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class AdItem;
+
+class AdInventory : public BaseObject {
+public:
+ DECLARE_PERSISTENT(AdInventory, BaseObject)
+ bool removeItem(const char *name);
+ bool removeItem(AdItem *Item);
+ bool insertItem(const char *name, const char *insertAfter = NULL);
+ AdInventory(BaseGame *inGame);
+ virtual ~AdInventory();
+ BaseArray<AdItem *> _takenItems;
+ int _scrollOffset;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp
new file mode 100644
index 0000000000..7ae8ff8d69
--- /dev/null
+++ b/engines/wintermute/ad/ad_inventory_box.cpp
@@ -0,0 +1,389 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_inventory_box.h"
+#include "engines/wintermute/ad/ad_inventory.h"
+#include "engines/wintermute/ad/ad_item.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/ui/ui_button.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+#include "common/rect.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdInventoryBox, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdInventoryBox::AdInventoryBox(BaseGame *inGame) : BaseObject(inGame) {
+ _itemsArea.setEmpty();
+ _scrollOffset = 0;
+ _spacing = 0;
+ _itemWidth = _itemHeight = 50;
+ _scrollBy = 1;
+
+ _window = NULL;
+ _closeButton = NULL;
+
+ _hideSelected = false;
+
+ _visible = false;
+ _exclusive = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdInventoryBox::~AdInventoryBox() {
+ _gameRef->unregisterObject(_window);
+ _window = NULL;
+
+ delete _closeButton;
+ _closeButton = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventoryBox::listen(BaseScriptHolder *param1, uint32 param2) {
+ UIObject *obj = (UIObject *)param1;
+
+ switch (obj->_type) {
+ case UI_BUTTON:
+ if (scumm_stricmp(obj->getName(), "close") == 0) {
+ _visible = false;
+ } else if (scumm_stricmp(obj->getName(), "prev") == 0) {
+ _scrollOffset -= _scrollBy;
+ _scrollOffset = MAX(_scrollOffset, 0);
+ } else if (scumm_stricmp(obj->getName(), "next") == 0) {
+ _scrollOffset += _scrollBy;
+ } else {
+ return BaseObject::listen(param1, param2);
+ }
+ break;
+ default:
+ error("AdInventoryBox::Listen - Unhandled enum");
+ break;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventoryBox::display() {
+ AdGame *adGame = (AdGame *)_gameRef;
+
+ if (!_visible) {
+ return STATUS_OK;
+ }
+
+ int itemsX, itemsY;
+ itemsX = (int)floor((float)((_itemsArea.right - _itemsArea.left + _spacing) / (_itemWidth + _spacing)));
+ itemsY = (int)floor((float)((_itemsArea.bottom - _itemsArea.top + _spacing) / (_itemHeight + _spacing)));
+
+ if (_window) {
+ _window->enableWidget("prev", _scrollOffset > 0);
+ _window->enableWidget("next", _scrollOffset + itemsX * itemsY < (int32)adGame->_inventoryOwner->getInventory()->_takenItems.size());
+ }
+
+
+ if (_closeButton) {
+ _closeButton->_posX = _closeButton->_posY = 0;
+ _closeButton->_width = _gameRef->_renderer->_width;
+ _closeButton->_height = _gameRef->_renderer->_height;
+
+ _closeButton->display();
+ }
+
+
+ // display window
+ Rect32 rect = _itemsArea;
+ if (_window) {
+ rect.offsetRect(_window->_posX, _window->_posY);
+ _window->display();
+ }
+
+ // display items
+ if (_window && _window->_alphaColor != 0) {
+ _gameRef->_renderer->_forceAlphaColor = _window->_alphaColor;
+ }
+ int yyy = rect.top;
+ for (int j = 0; j < itemsY; j++) {
+ int xxx = rect.left;
+ for (int i = 0; i < itemsX; i++) {
+ int itemIndex = _scrollOffset + j * itemsX + i;
+ if (itemIndex >= 0 && itemIndex < (int32)adGame->_inventoryOwner->getInventory()->_takenItems.size()) {
+ AdItem *item = adGame->_inventoryOwner->getInventory()->_takenItems[itemIndex];
+ if (item != ((AdGame *)_gameRef)->_selectedItem || !_hideSelected) {
+ item->update();
+ item->display(xxx, yyy);
+ }
+ }
+
+ xxx += (_itemWidth + _spacing);
+ }
+ yyy += (_itemHeight + _spacing);
+ }
+ if (_window && _window->_alphaColor != 0) {
+ _gameRef->_renderer->_forceAlphaColor = 0;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventoryBox::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdInventoryBox::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing INVENTORY_BOX file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(INVENTORY_BOX)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(WINDOW)
+TOKEN_DEF(EXCLUSIVE)
+TOKEN_DEF(ALWAYS_VISIBLE)
+TOKEN_DEF(AREA)
+TOKEN_DEF(SPACING)
+TOKEN_DEF(ITEM_WIDTH)
+TOKEN_DEF(ITEM_HEIGHT)
+TOKEN_DEF(SCROLL_BY)
+TOKEN_DEF(NAME)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(HIDE_SELECTED)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(INVENTORY_BOX)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(WINDOW)
+ TOKEN_TABLE(EXCLUSIVE)
+ TOKEN_TABLE(ALWAYS_VISIBLE)
+ TOKEN_TABLE(AREA)
+ TOKEN_TABLE(SPACING)
+ TOKEN_TABLE(ITEM_WIDTH)
+ TOKEN_TABLE(ITEM_HEIGHT)
+ TOKEN_TABLE(SCROLL_BY)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(HIDE_SELECTED)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+ bool alwaysVisible = false;
+
+ _exclusive = false;
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_INVENTORY_BOX) {
+ _gameRef->LOG(0, "'INVENTORY_BOX' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_WINDOW:
+ delete _window;
+ _window = new UIWindow(_gameRef);
+ if (!_window || DID_FAIL(_window->loadBuffer(params, false))) {
+ delete _window;
+ _window = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ _gameRef->registerObject(_window);
+ }
+ break;
+
+ case TOKEN_AREA:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_itemsArea.left, &_itemsArea.top, &_itemsArea.right, &_itemsArea.bottom);
+ break;
+
+ case TOKEN_EXCLUSIVE:
+ parser.scanStr((char *)params, "%b", &_exclusive);
+ break;
+
+ case TOKEN_HIDE_SELECTED:
+ parser.scanStr((char *)params, "%b", &_hideSelected);
+ break;
+
+ case TOKEN_ALWAYS_VISIBLE:
+ parser.scanStr((char *)params, "%b", &alwaysVisible);
+ break;
+
+ case TOKEN_SPACING:
+ parser.scanStr((char *)params, "%d", &_spacing);
+ break;
+
+ case TOKEN_ITEM_WIDTH:
+ parser.scanStr((char *)params, "%d", &_itemWidth);
+ break;
+
+ case TOKEN_ITEM_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_itemHeight);
+ break;
+
+ case TOKEN_SCROLL_BY:
+ parser.scanStr((char *)params, "%d", &_scrollBy);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in INVENTORY_BOX definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading INVENTORY_BOX definition");
+ return STATUS_FAILED;
+ }
+
+ if (_exclusive) {
+ delete _closeButton;
+ _closeButton = new UIButton(_gameRef);
+ if (_closeButton) {
+ _closeButton->setName("close");
+ _closeButton->setListener(this, _closeButton, 0);
+ _closeButton->_parent = _window;
+ }
+ }
+
+ _visible = alwaysVisible;
+
+ if (_window) {
+ for (uint32 i = 0; i < _window->_widgets.size(); i++) {
+ if (!_window->_widgets[i]->_listenerObject) {
+ _window->_widgets[i]->setListener(this, _window->_widgets[i], 0);
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventoryBox::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "INVENTORY_BOX\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+
+ buffer->putTextIndent(indent + 2, "AREA { %d, %d, %d, %d }\n", _itemsArea.left, _itemsArea.top, _itemsArea.right, _itemsArea.bottom);
+
+ buffer->putTextIndent(indent + 2, "EXCLUSIVE=%s\n", _exclusive ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "HIDE_SELECTED=%s\n", _hideSelected ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "ALWAYS_VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "SPACING=%d\n", _spacing);
+ buffer->putTextIndent(indent + 2, "ITEM_WIDTH=%d\n", _itemWidth);
+ buffer->putTextIndent(indent + 2, "ITEM_HEIGHT=%d\n", _itemHeight);
+ buffer->putTextIndent(indent + 2, "SCROLL_BY=%d\n", _scrollBy);
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // window
+ if (_window) {
+ _window->saveAsText(buffer, indent + 2);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_closeButton));
+ persistMgr->transfer(TMEMBER(_hideSelected));
+ persistMgr->transfer(TMEMBER(_itemHeight));
+ persistMgr->transfer(TMEMBER(_itemsArea));
+ persistMgr->transfer(TMEMBER(_itemWidth));
+ persistMgr->transfer(TMEMBER(_scrollBy));
+ persistMgr->transfer(TMEMBER(_scrollOffset));
+ persistMgr->transfer(TMEMBER(_spacing));
+ persistMgr->transfer(TMEMBER(_visible));
+ persistMgr->transfer(TMEMBER(_window));
+ persistMgr->transfer(TMEMBER(_exclusive));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_inventory_box.h b/engines/wintermute/ad/ad_inventory_box.h
new file mode 100644
index 0000000000..cb6d084562
--- /dev/null
+++ b/engines/wintermute/ad/ad_inventory_box.h
@@ -0,0 +1,65 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADINVENTORYBOX_H
+#define WINTERMUTE_ADINVENTORYBOX_H
+
+#include "engines/wintermute/base/base_object.h"
+#include "common/rect.h"
+
+namespace Wintermute {
+class UIButton;
+class UIWindow;
+
+class AdInventoryBox : public BaseObject {
+public:
+ bool _hideSelected;
+ DECLARE_PERSISTENT(AdInventoryBox, BaseObject)
+ bool _visible;
+ virtual bool display();
+ UIButton *_closeButton;
+ int _spacing;
+ int _scrollOffset;
+ Rect32 _itemsArea;
+ bool listen(BaseScriptHolder *param1, uint32 param2);
+ UIWindow *_window;
+ AdInventoryBox(BaseGame *inGame);
+ virtual ~AdInventoryBox();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+private:
+ bool _exclusive;
+ int _scrollBy;
+ int _itemHeight;
+ int _itemWidth;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp
new file mode 100644
index 0000000000..427b1c7db4
--- /dev/null
+++ b/engines/wintermute/ad/ad_item.cpp
@@ -0,0 +1,813 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_item.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdItem, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdItem::AdItem(BaseGame *inGame) : AdTalkHolder(inGame) {
+ _spriteHover = NULL;
+ _cursorNormal = _cursorHover = NULL;
+
+ _cursorCombined = true;
+ _inInventory = false;
+
+ _displayAmount = false;
+ _amount = 0;
+ _amountOffsetX = 0;
+ _amountOffsetY = 0;
+ _amountAlign = TAL_RIGHT;
+ _amountString = NULL;
+
+ _state = STATE_READY;
+
+ _movable = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdItem::~AdItem() {
+ delete _spriteHover;
+ delete _cursorNormal;
+ delete _cursorHover;
+ _spriteHover = NULL;
+ _cursorNormal = NULL;
+ _cursorHover = NULL;
+
+ delete[] _amountString;
+ _amountString = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdItem::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing ITEM file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(ITEM)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(CURSOR_HOVER)
+TOKEN_DEF(CURSOR_COMBINED)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(NAME)
+TOKEN_DEF(IMAGE_HOVER)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(EVENTS)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(FONT)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(TALK_SPECIAL)
+TOKEN_DEF(TALK)
+TOKEN_DEF(SPRITE_HOVER)
+TOKEN_DEF(SPRITE)
+TOKEN_DEF(DISPLAY_AMOUNT)
+TOKEN_DEF(AMOUNT_OFFSET_X)
+TOKEN_DEF(AMOUNT_OFFSET_Y)
+TOKEN_DEF(AMOUNT_ALIGN)
+TOKEN_DEF(AMOUNT_STRING)
+TOKEN_DEF(AMOUNT)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ITEM)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(CURSOR_HOVER)
+ TOKEN_TABLE(CURSOR_COMBINED)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(IMAGE_HOVER)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(EVENTS)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(TALK_SPECIAL)
+ TOKEN_TABLE(TALK)
+ TOKEN_TABLE(SPRITE_HOVER)
+ TOKEN_TABLE(SPRITE)
+ TOKEN_TABLE(DISPLAY_AMOUNT)
+ TOKEN_TABLE(AMOUNT_OFFSET_X)
+ TOKEN_TABLE(AMOUNT_OFFSET_Y)
+ TOKEN_TABLE(AMOUNT_ALIGN)
+ TOKEN_TABLE(AMOUNT_STRING)
+ TOKEN_TABLE(AMOUNT)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ITEM) {
+ _gameRef->LOG(0, "'ITEM' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ int ar = 0, ag = 0, ab = 0, alpha = 255;
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_FONT:
+ setFont((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_IMAGE:
+ case TOKEN_SPRITE:
+ delete _sprite;
+ _sprite = new BaseSprite(_gameRef, this);
+ if (!_sprite || DID_FAIL(_sprite->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
+ delete _sprite;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE_HOVER:
+ case TOKEN_SPRITE_HOVER:
+ delete _spriteHover;
+ _spriteHover = new BaseSprite(_gameRef, this);
+ if (!_spriteHover || DID_FAIL(_spriteHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
+ delete _spriteHover;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_AMOUNT:
+ parser.scanStr((char *)params, "%d", &_amount);
+ break;
+
+ case TOKEN_DISPLAY_AMOUNT:
+ parser.scanStr((char *)params, "%b", &_displayAmount);
+ break;
+
+ case TOKEN_AMOUNT_OFFSET_X:
+ parser.scanStr((char *)params, "%d", &_amountOffsetX);
+ break;
+
+ case TOKEN_AMOUNT_OFFSET_Y:
+ parser.scanStr((char *)params, "%d", &_amountOffsetY);
+ break;
+
+ case TOKEN_AMOUNT_ALIGN:
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _amountAlign = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _amountAlign = TAL_RIGHT;
+ } else {
+ _amountAlign = TAL_CENTER;
+ }
+ break;
+
+ case TOKEN_AMOUNT_STRING:
+ BaseUtils::setString(&_amountString, (char *)params);
+ break;
+
+ case TOKEN_TALK: {
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, ((AdGame *)_gameRef)->_texTalkLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _talkSprites.add(spr);
+ }
+ }
+ break;
+
+ case TOKEN_TALK_SPECIAL: {
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, ((AdGame *)_gameRef)->_texTalkLifeTime))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _talkSpritesEx.add(spr);
+ }
+ }
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursorNormal;
+ _cursorNormal = new BaseSprite(_gameRef);
+ if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
+ delete _cursorNormal;
+ _cursorNormal = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_CURSOR_HOVER:
+ delete _cursorHover;
+ _cursorHover = new BaseSprite(_gameRef);
+ if (!_cursorHover || DID_FAIL(_cursorHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
+ delete _cursorHover;
+ _cursorHover = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_CURSOR_COMBINED:
+ parser.scanStr((char *)params, "%b", &_cursorCombined);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr((char *)params, "%d", &alpha);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ITEM definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading ITEM definition");
+ return STATUS_FAILED;
+ }
+
+ if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
+ ar = ag = ab = 255;
+ }
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::update() {
+ _currentSprite = NULL;
+
+ if (_state == STATE_READY && _animSprite) {
+ delete _animSprite;
+ _animSprite = NULL;
+ }
+
+ // finished playing animation?
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) {
+ _state = STATE_READY;
+ _currentSprite = _animSprite;
+ }
+
+ if (_sentence && _state != STATE_TALKING) {
+ _sentence->finish();
+ }
+
+ // default: stand animation
+ if (!_currentSprite) {
+ _currentSprite = _sprite;
+ }
+
+ switch (_state) {
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_PLAYING_ANIM:
+ _currentSprite = _animSprite;
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_READY:
+ if (!_animSprite) {
+ if (_gameRef->_activeObject == this && _spriteHover) {
+ _currentSprite = _spriteHover;
+ } else {
+ _currentSprite = _sprite;
+ }
+ }
+ break;
+
+ //////////////////////////////////////////////////////////////////////////
+ case STATE_TALKING: {
+ _sentence->update();
+ if (_sentence->_currentSprite) {
+ _tempSprite2 = _sentence->_currentSprite;
+ }
+
+ bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (timeIsUp) {
+ _sentence->finish();
+ _tempSprite2 = NULL;
+ _state = STATE_READY;
+ } else {
+ _tempSprite2 = getTalkStance(_sentence->getNextStance());
+ if (_tempSprite2) {
+ _tempSprite2->reset();
+ _currentSprite = _tempSprite2;
+ }
+ ((AdGame *)_gameRef)->addSentence(_sentence);
+ }
+ } else {
+ _currentSprite = _tempSprite2;
+ ((AdGame *)_gameRef)->addSentence(_sentence);
+ }
+ }
+ default:
+ break;
+ }
+ _ready = (_state == STATE_READY);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::display(int x, int y) {
+ int width = 0;
+ if (_currentSprite) {
+ Rect32 rc;
+ _currentSprite->getBoundingRect(&rc, 0, 0);
+ width = rc.width();
+ }
+
+ _posX = x + width / 2;
+ _posY = y;
+
+ bool ret;
+ if (_currentSprite) {
+ ret = _currentSprite->draw(x, y, this, 100, 100, _alphaColor);
+ } else {
+ ret = STATUS_OK;
+ }
+
+ if (_displayAmount) {
+ int amountX = x;
+ int amountY = y + _amountOffsetY;
+
+ if (_amountAlign == TAL_RIGHT) {
+ width -= _amountOffsetX;
+ amountX -= _amountOffsetX;
+ }
+ amountX += _amountOffsetX;
+
+ BaseFont *font = _font ? _font : _gameRef->_systemFont;
+ if (font) {
+ if (_amountString) {
+ font->drawText((byte *)_amountString, amountX, amountY, width, _amountAlign);
+ } else {
+ char str[256];
+ sprintf(str, "%d", _amount);
+ font->drawText((byte *)str, amountX, amountY, width, _amountAlign);
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetHoverSprite
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetHoverSprite") == 0) {
+ stack->correctParams(1);
+
+ bool setCurrent = false;
+ if (_currentSprite && _currentSprite == _spriteHover) {
+ setCurrent = true;
+ }
+
+ const char *filename = stack->pop()->getString();
+
+ delete _spriteHover;
+ _spriteHover = NULL;
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ stack->pushBool(false);
+ script->runtimeError("Item.SetHoverSprite failed for file '%s'", filename);
+ } else {
+ _spriteHover = spr;
+ if (setCurrent) {
+ _currentSprite = _spriteHover;
+ }
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHoverSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHoverSprite") == 0) {
+ stack->correctParams(0);
+
+ if (!_spriteHover || !_spriteHover->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_spriteHover->getFilename());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHoverSpriteObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHoverSpriteObject") == 0) {
+ stack->correctParams(0);
+ if (!_spriteHover) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_spriteHover, true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetNormalCursor
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetNormalCursor") == 0) {
+ stack->correctParams(1);
+
+ const char *filename = stack->pop()->getString();
+
+ delete _cursorNormal;
+ _cursorNormal = NULL;
+ BaseSprite *spr = new BaseSprite(_gameRef);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ stack->pushBool(false);
+ script->runtimeError("Item.SetNormalCursor failed for file '%s'", filename);
+ } else {
+ _cursorNormal = spr;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetNormalCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetNormalCursor") == 0) {
+ stack->correctParams(0);
+
+ if (!_cursorNormal || !_cursorNormal->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_cursorNormal->getFilename());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetNormalCursorObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetNormalCursorObject") == 0) {
+ stack->correctParams(0);
+
+ if (!_cursorNormal) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_cursorNormal, true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetHoverCursor
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetHoverCursor") == 0) {
+ stack->correctParams(1);
+
+ const char *filename = stack->pop()->getString();
+
+ delete _cursorHover;
+ _cursorHover = NULL;
+ BaseSprite *spr = new BaseSprite(_gameRef);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ stack->pushBool(false);
+ script->runtimeError("Item.SetHoverCursor failed for file '%s'", filename);
+ } else {
+ _cursorHover = spr;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHoverCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHoverCursor") == 0) {
+ stack->correctParams(0);
+
+ if (!_cursorHover || !_cursorHover->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_cursorHover->getFilename());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHoverCursorObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHoverCursorObject") == 0) {
+ stack->correctParams(0);
+
+ if (!_cursorHover) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_cursorHover, true);
+ }
+ return STATUS_OK;
+ } else {
+ return AdTalkHolder::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdItem::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("item");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Name") {
+ _scValue->setString(getName());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DisplayAmount
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "DisplayAmount") {
+ _scValue->setBool(_displayAmount);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Amount
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Amount") {
+ _scValue->setInt(_amount);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountOffsetX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AmountOffsetX") {
+ _scValue->setInt(_amountOffsetX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountOffsetY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AmountOffsetY") {
+ _scValue->setInt(_amountOffsetY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountAlign
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AmountAlign") {
+ _scValue->setInt(_amountAlign);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountString
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AmountString") {
+ if (!_amountString) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setString(_amountString);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorCombined
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CursorCombined") {
+ _scValue->setBool(_cursorCombined);
+ return _scValue;
+ } else {
+ return AdTalkHolder::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DisplayAmount
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DisplayAmount") == 0) {
+ _displayAmount = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Amount
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Amount") == 0) {
+ _amount = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountOffsetX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AmountOffsetX") == 0) {
+ _amountOffsetX = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountOffsetY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AmountOffsetY") == 0) {
+ _amountOffsetY = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountAlign
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AmountAlign") == 0) {
+ _amountAlign = (TTextAlign)value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AmountString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AmountString") == 0) {
+ if (value->isNULL()) {
+ delete[] _amountString;
+ _amountString = NULL;
+ } else {
+ BaseUtils::setString(&_amountString, value->getString());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorCombined
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CursorCombined") == 0) {
+ _cursorCombined = value->getBool();
+ return STATUS_OK;
+ } else {
+ return AdTalkHolder::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdItem::scToString() {
+ return "[item]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::persist(BasePersistenceManager *persistMgr) {
+
+ AdTalkHolder::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_cursorCombined));
+ persistMgr->transfer(TMEMBER(_cursorHover));
+ persistMgr->transfer(TMEMBER(_cursorNormal));
+ persistMgr->transfer(TMEMBER(_spriteHover));
+ persistMgr->transfer(TMEMBER(_inInventory));
+ persistMgr->transfer(TMEMBER(_displayAmount));
+ persistMgr->transfer(TMEMBER(_amount));
+ persistMgr->transfer(TMEMBER(_amountOffsetX));
+ persistMgr->transfer(TMEMBER(_amountOffsetY));
+ persistMgr->transfer(TMEMBER_INT(_amountAlign));
+ persistMgr->transfer(TMEMBER(_amountString));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdItem::getExtendedFlag(const char *flagName) {
+ if (!flagName) {
+ return false;
+ } else if (strcmp(flagName, "usable") == 0) {
+ return true;
+ } else {
+ return AdObject::getExtendedFlag(flagName);
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h
new file mode 100644
index 0000000000..79978f9f72
--- /dev/null
+++ b/engines/wintermute/ad/ad_item.h
@@ -0,0 +1,69 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADITEM_H
+#define WINTERMUTE_ADITEM_H
+
+
+#include "engines/wintermute/ad/ad_talk_holder.h"
+
+namespace Wintermute {
+
+class AdItem : public AdTalkHolder {
+public:
+ bool update();
+ DECLARE_PERSISTENT(AdItem, AdTalkHolder)
+ bool display(int x, int y);
+ bool getExtendedFlag(const char *flagName);
+ bool _inInventory;
+ bool _cursorCombined;
+ BaseSprite *_spriteHover;
+ BaseSprite *_cursorNormal;
+ BaseSprite *_cursorHover;
+ AdItem(BaseGame *inGame);
+ virtual ~AdItem();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+private:
+ bool _displayAmount;
+ int _amount;
+ int _amountOffsetX;
+ int _amountOffsetY;
+ TTextAlign _amountAlign;
+ char *_amountString;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp
new file mode 100644
index 0000000000..209c12b7a2
--- /dev/null
+++ b/engines/wintermute/ad/ad_layer.cpp
@@ -0,0 +1,564 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/ad/ad_layer.h"
+#include "engines/wintermute/ad/ad_scene_node.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdLayer, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdLayer::AdLayer(BaseGame *inGame) : BaseObject(inGame) {
+ _main = false;
+ _width = _height = 0;
+ _active = true;
+ _closeUp = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdLayer::~AdLayer() {
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ delete _nodes[i];
+ }
+ _nodes.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdLayer::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdLayer::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing LAYER file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(LAYER)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(WIDTH)
+TOKEN_DEF(HEIGHT)
+TOKEN_DEF(MAIN)
+TOKEN_DEF(ENTITY)
+TOKEN_DEF(REGION)
+TOKEN_DEF(ACTIVE)
+TOKEN_DEF(EDITOR_SELECTED)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(CLOSE_UP)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdLayer::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(LAYER)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(WIDTH)
+ TOKEN_TABLE(HEIGHT)
+ TOKEN_TABLE(MAIN)
+ TOKEN_TABLE(ENTITY)
+ TOKEN_TABLE(REGION)
+ TOKEN_TABLE(ACTIVE)
+ TOKEN_TABLE(EDITOR_SELECTED)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(CLOSE_UP)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_LAYER) {
+ _gameRef->LOG(0, "'LAYER' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_MAIN:
+ parser.scanStr((char *)params, "%b", &_main);
+ break;
+
+ case TOKEN_CLOSE_UP:
+ parser.scanStr((char *)params, "%b", &_closeUp);
+ break;
+
+ case TOKEN_WIDTH:
+ parser.scanStr((char *)params, "%d", &_width);
+ break;
+
+ case TOKEN_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_height);
+ break;
+
+ case TOKEN_ACTIVE:
+ parser.scanStr((char *)params, "%b", &_active);
+ break;
+
+ case TOKEN_REGION: {
+ AdRegion *region = new AdRegion(_gameRef);
+ AdSceneNode *node = new AdSceneNode(_gameRef);
+ if (!region || !node || DID_FAIL(region->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete region;
+ delete node;
+ region = NULL;
+ node = NULL;
+ } else {
+ node->setRegion(region);
+ _nodes.add(node);
+ }
+ }
+ break;
+
+ case TOKEN_ENTITY: {
+ AdEntity *entity = new AdEntity(_gameRef);
+ AdSceneNode *node = new AdSceneNode(_gameRef);
+ if (entity) {
+ entity->_zoomable = false; // scene entites default to NOT zoom
+ }
+ if (!entity || !node || DID_FAIL(entity->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete entity;
+ delete node;
+ entity = NULL;
+ node = NULL;
+ } else {
+ node->setEntity(entity);
+ _nodes.add(node);
+ }
+ }
+ break;
+
+ case TOKEN_EDITOR_SELECTED:
+ parser.scanStr((char *)params, "%b", &_editorSelected);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in LAYER definition");
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdLayer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // GetNode
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetNode") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ int node = -1;
+
+ if (val->_type == VAL_INT) {
+ node = val->getInt();
+ } else { // get by name
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ if ((_nodes[i]->_type == OBJECT_ENTITY && scumm_stricmp(_nodes[i]->_entity->getName(), val->getString()) == 0) ||
+ (_nodes[i]->_type == OBJECT_REGION && scumm_stricmp(_nodes[i]->_region->getName(), val->getString()) == 0)) {
+ node = i;
+ break;
+ }
+ }
+ }
+
+ if (node < 0 || node >= (int32)_nodes.size()) {
+ stack->pushNULL();
+ } else {
+ switch (_nodes[node]->_type) {
+ case OBJECT_ENTITY:
+ stack->pushNative(_nodes[node]->_entity, true);
+ break;
+ case OBJECT_REGION:
+ stack->pushNative(_nodes[node]->_region, true);
+ break;
+ default:
+ stack->pushNULL();
+ }
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddRegion / AddEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddRegion") == 0 || strcmp(name, "AddEntity") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdSceneNode *node = new AdSceneNode(_gameRef);
+ if (strcmp(name, "AddRegion") == 0) {
+ AdRegion *region = new AdRegion(_gameRef);
+ if (!val->isNULL()) {
+ region->setName(val->getString());
+ }
+ node->setRegion(region);
+ stack->pushNative(region, true);
+ } else {
+ AdEntity *entity = new AdEntity(_gameRef);
+ if (!val->isNULL()) {
+ entity->setName(val->getString());
+ }
+ node->setEntity(entity);
+ stack->pushNative(entity, true);
+ }
+ _nodes.add(node);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InsertRegion / InsertEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InsertRegion") == 0 || strcmp(name, "InsertEntity") == 0) {
+ stack->correctParams(2);
+ int index = stack->pop()->getInt();
+ ScValue *val = stack->pop();
+
+ AdSceneNode *node = new AdSceneNode(_gameRef);
+ if (strcmp(name, "InsertRegion") == 0) {
+ AdRegion *region = new AdRegion(_gameRef);
+ if (!val->isNULL()) {
+ region->setName(val->getString());
+ }
+ node->setRegion(region);
+ stack->pushNative(region, true);
+ } else {
+ AdEntity *entity = new AdEntity(_gameRef);
+ if (!val->isNULL()) {
+ entity->setName(val->getString());
+ }
+ node->setEntity(entity);
+ stack->pushNative(entity, true);
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ if (index <= (int32)_nodes.size() - 1) {
+ _nodes.insert_at(index, node);
+ } else {
+ _nodes.add(node);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteNode
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteNode") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdSceneNode *toDelete = NULL;
+ if (val->isNative()) {
+ BaseScriptable *temp = val->getNative();
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ if (_nodes[i]->_region == temp || _nodes[i]->_entity == temp) {
+ toDelete = _nodes[i];
+ break;
+ }
+ }
+ } else {
+ int index = val->getInt();
+ if (index >= 0 && index < (int32)_nodes.size()) {
+ toDelete = _nodes[index];
+ }
+ }
+ if (toDelete == NULL) {
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ if (_nodes[i] == toDelete) {
+ delete _nodes[i];
+ _nodes[i] = NULL;
+ _nodes.remove_at(i);
+ break;
+ }
+ }
+ stack->pushBool(true);
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdLayer::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("layer");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumNodes (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumNodes") {
+ _scValue->setInt(_nodes.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Width
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Width") {
+ _scValue->setInt(_width);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Height
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Height") {
+ _scValue->setInt(_height);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Main (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Main") {
+ _scValue->setBool(_main);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CloseUp
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CloseUp") {
+ _scValue->setBool(_closeUp);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Active") {
+ _scValue->setBool(_active);
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdLayer::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CloseUp
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CloseUp") == 0) {
+ _closeUp = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Width
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Width") == 0) {
+ _width = value->getInt();
+ if (_width < 0) {
+ _width = 0;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Height
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Height") == 0) {
+ _height = value->getInt();
+ if (_height < 0) {
+ _height = 0;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Active") == 0) {
+ bool b = value->getBool();
+ if (b == false && _main) {
+ _gameRef->LOG(0, "Warning: cannot deactivate scene's main layer");
+ } else {
+ _active = b;
+ }
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdLayer::scToString() {
+ return "[layer]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdLayer::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "LAYER {\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+ buffer->putTextIndent(indent + 2, "MAIN=%s\n", _main ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "WIDTH=%d\n", _width);
+ buffer->putTextIndent(indent + 2, "HEIGHT=%d\n", _height);
+ buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
+ if (_closeUp) {
+ buffer->putTextIndent(indent + 2, "CLOSE_UP=%s\n", _closeUp ? "TRUE" : "FALSE");
+ }
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ if (_scProp) {
+ _scProp->saveAsText(buffer, indent + 2);
+ }
+
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ switch (_nodes[i]->_type) {
+ case OBJECT_ENTITY:
+ _nodes[i]->_entity->saveAsText(buffer, indent + 2);
+ break;
+ case OBJECT_REGION:
+ _nodes[i]->_region->saveAsText(buffer, indent + 2);
+ break;
+ default:
+ error("AdLayer::SaveAsText - Unhandled enum");
+ break;
+ }
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdLayer::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transfer(TMEMBER(_closeUp));
+ persistMgr->transfer(TMEMBER(_height));
+ persistMgr->transfer(TMEMBER(_main));
+ _nodes.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_width));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_layer.h b/engines/wintermute/ad/ad_layer.h
new file mode 100644
index 0000000000..de65e2822f
--- /dev/null
+++ b/engines/wintermute/ad/ad_layer.h
@@ -0,0 +1,58 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADLAYER_H
+#define WINTERMUTE_ADLAYER_H
+
+namespace Wintermute {
+class AdSceneNode;
+class AdLayer : public BaseObject {
+public:
+ bool _closeUp;
+ DECLARE_PERSISTENT(AdLayer, BaseObject)
+ bool _active;
+ int _height;
+ int _width;
+ bool _main;
+ AdLayer(BaseGame *inGame);
+ virtual ~AdLayer();
+ BaseArray<AdSceneNode *> _nodes;
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp
new file mode 100644
index 0000000000..493156c750
--- /dev/null
+++ b/engines/wintermute/ad/ad_node_state.cpp
@@ -0,0 +1,196 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/ad/ad_node_state.h"
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdNodeState, false)
+
+
+//////////////////////////////////////////////////////////////////////////
+AdNodeState::AdNodeState(BaseGame *inGame) : BaseClass(inGame) {
+ _name = NULL;
+ _active = false;
+ for (int i = 0; i < 7; i++) {
+ _caption[i] = NULL;
+ }
+ _alphaColor = 0;
+ _filename = NULL;
+ _cursor = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdNodeState::~AdNodeState() {
+ delete[] _name;
+ delete[] _filename;
+ delete[] _cursor;
+ _name = NULL;
+ _filename = NULL;
+ _cursor = NULL;
+ for (int i = 0; i < 7; i++) {
+ delete[] _caption[i];
+ _caption[i] = NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdNodeState::setName(const char *name) {
+ delete[] _name;
+ _name = NULL;
+ BaseUtils::setString(&_name, name);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdNodeState::setFilename(const char *filename) {
+ delete[] _filename;
+ _filename = NULL;
+ BaseUtils::setString(&_filename, filename);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdNodeState::setCursor(const char *filename) {
+ delete[] _cursor;
+ _cursor = NULL;
+ BaseUtils::setString(&_cursor, filename);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdNodeState::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transfer(TMEMBER(_name));
+ persistMgr->transfer(TMEMBER(_filename));
+ persistMgr->transfer(TMEMBER(_cursor));
+ persistMgr->transfer(TMEMBER(_alphaColor));
+ for (int i = 0; i < 7; i++) {
+ persistMgr->transfer(TMEMBER(_caption[i]));
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdNodeState::setCaption(const char *caption, int caseVal) {
+ if (caseVal == 0) {
+ caseVal = 1;
+ }
+ if (caseVal < 1 || caseVal > 7) {
+ return;
+ }
+
+ delete[] _caption[caseVal - 1];
+ _caption[caseVal - 1] = new char[strlen(caption) + 1];
+ if (_caption[caseVal - 1]) {
+ strcpy(_caption[caseVal - 1], caption);
+ _gameRef->_stringTable->expand(&_caption[caseVal - 1]);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdNodeState::getCaption(int caseVal) {
+ if (caseVal == 0) {
+ caseVal = 1;
+ }
+ if (caseVal < 1 || caseVal > 7 || _caption[caseVal - 1] == NULL) {
+ return "";
+ } else {
+ return _caption[caseVal - 1];
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool saving) {
+ if (!entity) {
+ return STATUS_FAILED;
+ }
+
+ // HACK!
+ if (this->_gameRef != entity->_gameRef) {
+ this->_gameRef = entity->_gameRef;
+ }
+
+ if (saving) {
+ for (int i = 0; i < 7; i++) {
+ if (entity->_caption[i]) {
+ setCaption(entity->_caption[i], i);
+ }
+ }
+ if (!entity->_region && entity->_sprite && entity->_sprite->getFilename()) {
+ if (includingSprites) {
+ setFilename(entity->_sprite->getFilename());
+ } else {
+ setFilename("");
+ }
+ }
+ if (entity->_cursor && entity->_cursor->getFilename()) {
+ setCursor(entity->_cursor->getFilename());
+ }
+ _alphaColor = entity->_alphaColor;
+ _active = entity->_active;
+ } else {
+ for (int i = 0; i < 7; i++) {
+ if (_caption[i]) {
+ entity->setCaption(_caption[i], i);
+ }
+ }
+ if (_filename && !entity->_region && includingSprites && strcmp(_filename, "") != 0) {
+ if (!entity->_sprite || !entity->_sprite->getFilename() || scumm_stricmp(entity->_sprite->getFilename(), _filename) != 0) {
+ entity->setSprite(_filename);
+ }
+ }
+ if (_cursor) {
+ if (!entity->_cursor || !entity->_cursor->getFilename() || scumm_stricmp(entity->_cursor->getFilename(), _cursor) != 0) {
+ entity->setCursor(_cursor);
+ }
+ }
+
+ entity->_active = _active;
+ entity->_alphaColor = _alphaColor;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_node_state.h b/engines/wintermute/ad/ad_node_state.h
new file mode 100644
index 0000000000..e2050815a7
--- /dev/null
+++ b/engines/wintermute/ad/ad_node_state.h
@@ -0,0 +1,60 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADNODESTATE_H
+#define WINTERMUTE_ADNODESTATE_H
+
+namespace Wintermute {
+
+class AdEntity;
+
+class AdNodeState : public BaseClass {
+public:
+ bool _active;
+ bool transferEntity(AdEntity *entity, bool includingSprites, bool saving);
+ void setName(const char *name);
+ void setFilename(const char *filename);
+ void setCursor(const char *filename);
+ DECLARE_PERSISTENT(AdNodeState, BaseClass)
+ AdNodeState(BaseGame *inGame);
+ virtual ~AdNodeState();
+ const char *getName() const { return _name; }
+private:
+ char *_name;
+ char *_caption[7];
+ void setCaption(const char *caption, int caseVal);
+ const char *getCaption(int caseVal);
+ uint32 _alphaColor;
+ char *_filename;
+ char *_cursor;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp
new file mode 100644
index 0000000000..7b91daab2e
--- /dev/null
+++ b/engines/wintermute/ad/ad_object.cpp
@@ -0,0 +1,1300 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_item.h"
+#include "engines/wintermute/ad/ad_object.h"
+#include "engines/wintermute/ad/ad_inventory.h"
+#include "engines/wintermute/ad/ad_layer.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_scene_node.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/ad/ad_waypoint_group.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_frame.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "common/str.h"
+#include "common/util.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdObject, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdObject::AdObject(BaseGame *inGame) : BaseObject(inGame) {
+ _type = OBJECT_NONE;
+ _state = _nextState = STATE_NONE;
+
+ _active = true;
+ _drawn = false;
+
+ _currentSprite = NULL;
+ _animSprite = NULL;
+ _tempSprite2 = NULL;
+
+ _font = NULL;
+
+ _sentence = NULL;
+
+ _forcedTalkAnimName = NULL;
+ _forcedTalkAnimUsed = false;
+
+ _blockRegion = NULL;
+ _wptGroup = NULL;
+
+ _currentBlockRegion = NULL;
+ _currentWptGroup = NULL;
+
+ _ignoreItems = false;
+ _sceneIndependent = false;
+
+ _stickRegion = NULL;
+
+ _subtitlesModRelative = true;
+ _subtitlesModX = 0;
+ _subtitlesModY = 0;
+ _subtitlesWidth = 0;
+ _subtitlesModXCenter = true;
+
+ _inventory = NULL;
+
+ for (int i = 0; i < MAX_NUM_REGIONS; i++) {
+ _currentRegions[i] = NULL;
+ }
+
+ _partEmitter = NULL;
+ _partFollowParent = false;
+ _partOffsetX = _partOffsetY = 0;
+
+ _registerAlias = this;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdObject::~AdObject() {
+ _currentSprite = NULL; // reference only, don't delete
+ delete _animSprite;
+ _animSprite = NULL;
+ delete _sentence;
+ _sentence = NULL;
+ delete[] _forcedTalkAnimName;
+ _forcedTalkAnimName = NULL;
+
+ delete _blockRegion;
+ _blockRegion = NULL;
+ delete _wptGroup;
+ _wptGroup = NULL;
+
+ delete _currentBlockRegion;
+ _currentBlockRegion = NULL;
+ delete _currentWptGroup;
+ _currentWptGroup = NULL;
+
+ _tempSprite2 = NULL; // reference only
+ _stickRegion = NULL;
+
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+
+ if (_inventory) {
+ ((AdGame *)_gameRef)->unregisterInventory(_inventory);
+ _inventory = NULL;
+ }
+
+ if (_partEmitter) {
+ _gameRef->unregisterObject(_partEmitter);
+ }
+
+
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ _gameRef->unregisterObject(_attachmentsPre[i]);
+ }
+ _attachmentsPre.clear();
+
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ _gameRef->unregisterObject(_attachmentsPost[i]);
+ }
+ _attachmentsPost.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::playAnim(const char *filename) {
+ delete _animSprite;
+ _animSprite = NULL;
+ _animSprite = new BaseSprite(_gameRef, this);
+ if (!_animSprite) {
+ _gameRef->LOG(0, "AdObject::PlayAnim: error creating temp sprite (object:\"%s\" sprite:\"%s\")", getName(), filename);
+ return STATUS_FAILED;
+ }
+ bool res = _animSprite->loadFile(filename);
+ if (DID_FAIL(res)) {
+ _gameRef->LOG(res, "AdObject::PlayAnim: error loading temp sprite (object:\"%s\" sprite:\"%s\")", getName(), filename);
+ delete _animSprite;
+ _animSprite = NULL;
+ return res;
+ }
+ _state = STATE_PLAYING_ANIM;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::display() {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::update() {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlayAnim / PlayAnimAsync
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "PlayAnim") == 0 || strcmp(name, "PlayAnimAsync") == 0) {
+ stack->correctParams(1);
+ if (DID_FAIL(playAnim(stack->pop()->getString()))) {
+ stack->pushBool(false);
+ } else {
+ if (strcmp(name, "PlayAnimAsync") != 0) {
+ script->waitFor(this);
+ }
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Reset
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Reset") == 0) {
+ stack->correctParams(0);
+ reset();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsTalking
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsTalking") == 0) {
+ stack->correctParams(0);
+ stack->pushBool(_state == STATE_TALKING);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StopTalk / StopTalking
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StopTalk") == 0 || strcmp(name, "StopTalking") == 0) {
+ stack->correctParams(0);
+ if (_sentence) {
+ _sentence->finish();
+ }
+ if (_state == STATE_TALKING) {
+ _state = _nextState;
+ _nextState = STATE_READY;
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ForceTalkAnim
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ForceTalkAnim") == 0) {
+ stack->correctParams(1);
+ const char *animName = stack->pop()->getString();
+ delete[] _forcedTalkAnimName;
+ _forcedTalkAnimName = new char[strlen(animName) + 1];
+ strcpy(_forcedTalkAnimName, animName);
+ _forcedTalkAnimUsed = false;
+ stack->pushBool(true);
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // Talk / TalkAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Talk") == 0 || strcmp(name, "TalkAsync") == 0) {
+ stack->correctParams(5);
+
+ const char *text = stack->pop()->getString();
+ ScValue *soundVal = stack->pop();
+ int duration = stack->pop()->getInt();
+ ScValue *valStances = stack->pop();
+
+ const char *stances = valStances->isNULL() ? NULL : valStances->getString();
+
+ int align = 0;
+ ScValue *val = stack->pop();
+ if (val->isNULL()) {
+ align = TAL_CENTER;
+ } else {
+ align = val->getInt();
+ }
+
+ align = MIN(MAX(0, align), NUM_TEXT_ALIGN - 1);
+
+ const char *sound = soundVal->isNULL() ? NULL : soundVal->getString();
+
+ talk(text, sound, duration, stances, (TTextAlign)align);
+ if (strcmp(name, "TalkAsync") != 0) {
+ script->waitForExclusive(this);
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StickToRegion
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StickToRegion") == 0) {
+ stack->correctParams(1);
+
+ AdLayer *main = ((AdGame *)_gameRef)->_scene->_mainLayer;
+ bool regFound = false;
+
+ uint32 i;
+ ScValue *val = stack->pop();
+ if (val->isNULL() || !main) {
+ _stickRegion = NULL;
+ regFound = true;
+ } else if (val->isString()) {
+ const char *regionName = val->getString();
+ for (i = 0; i < main->_nodes.size(); i++) {
+ if (main->_nodes[i]->_type == OBJECT_REGION && main->_nodes[i]->_region->getName() && scumm_stricmp(main->_nodes[i]->_region->getName(), regionName) == 0) {
+ _stickRegion = main->_nodes[i]->_region;
+ regFound = true;
+ break;
+ }
+ }
+ } else if (val->isNative()) {
+ BaseScriptable *obj = val->getNative();
+
+ for (i = 0; i < main->_nodes.size(); i++) {
+ if (main->_nodes[i]->_type == OBJECT_REGION && main->_nodes[i]->_region == obj) {
+ _stickRegion = main->_nodes[i]->_region;
+ regFound = true;
+ break;
+ }
+ }
+
+ }
+
+ if (!regFound) {
+ _stickRegion = NULL;
+ }
+ stack->pushBool(regFound);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetFont
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetFont") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (val->isNULL()) {
+ setFont(NULL);
+ } else {
+ setFont(val->getString());
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFont
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFont") == 0) {
+ stack->correctParams(0);
+ if (_font && _font->getFilename()) {
+ stack->pushString(_font->getFilename());
+ } else {
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TakeItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TakeItem") == 0) {
+ stack->correctParams(2);
+
+ if (!_inventory) {
+ _inventory = new AdInventory(_gameRef);
+ ((AdGame *)_gameRef)->registerInventory(_inventory);
+ }
+
+ ScValue *val = stack->pop();
+ if (!val->isNULL()) {
+ const char *itemName = val->getString();
+ val = stack->pop();
+ const char *insertAfter = val->isNULL() ? NULL : val->getString();
+ if (DID_FAIL(_inventory->insertItem(itemName, insertAfter))) {
+ script->runtimeError("Cannot add item '%s' to inventory", itemName);
+ } else {
+ // hide associated entities
+ ((AdGame *)_gameRef)->_scene->handleItemAssociations(itemName, false);
+ }
+
+ } else {
+ script->runtimeError("TakeItem: item name expected");
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DropItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DropItem") == 0) {
+ stack->correctParams(1);
+
+ if (!_inventory) {
+ _inventory = new AdInventory(_gameRef);
+ ((AdGame *)_gameRef)->registerInventory(_inventory);
+ }
+
+ ScValue *val = stack->pop();
+ if (!val->isNULL()) {
+ if (DID_FAIL(_inventory->removeItem(val->getString()))) {
+ script->runtimeError("Cannot remove item '%s' from inventory", val->getString());
+ } else {
+ // show associated entities
+ ((AdGame *)_gameRef)->_scene->handleItemAssociations(val->getString(), true);
+ }
+ } else {
+ script->runtimeError("DropItem: item name expected");
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetItem") == 0) {
+ stack->correctParams(1);
+
+ if (!_inventory) {
+ _inventory = new AdInventory(_gameRef);
+ ((AdGame *)_gameRef)->registerInventory(_inventory);
+ }
+
+ ScValue *val = stack->pop();
+ if (val->_type == VAL_STRING) {
+ AdItem *item = ((AdGame *)_gameRef)->getItemByName(val->getString());
+ if (item) {
+ stack->pushNative(item, true);
+ } else {
+ stack->pushNULL();
+ }
+ } else if (val->isNULL() || val->getInt() < 0 || val->getInt() >= (int32)_inventory->_takenItems.size()) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_inventory->_takenItems[val->getInt()], true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HasItem
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HasItem") == 0) {
+ stack->correctParams(1);
+
+ if (!_inventory) {
+ _inventory = new AdInventory(_gameRef);
+ ((AdGame *)_gameRef)->registerInventory(_inventory);
+ }
+
+ ScValue *val = stack->pop();
+ if (!val->isNULL()) {
+ for (uint32 i = 0; i < _inventory->_takenItems.size(); i++) {
+ if (val->getNative() == _inventory->_takenItems[i]) {
+ stack->pushBool(true);
+ return STATUS_OK;
+ } else if (scumm_stricmp(val->getString(), _inventory->_takenItems[i]->getName()) == 0) {
+ stack->pushBool(true);
+ return STATUS_OK;
+ }
+ }
+ } else {
+ script->runtimeError("HasItem: item name expected");
+ }
+
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateParticleEmitter
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateParticleEmitter") == 0) {
+ stack->correctParams(3);
+ bool followParent = stack->pop()->getBool();
+ int offsetX = stack->pop()->getInt();
+ int offsetY = stack->pop()->getInt();
+
+ PartEmitter *emitter = createParticleEmitter(followParent, offsetX, offsetY);
+ if (emitter) {
+ stack->pushNative(_partEmitter, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteParticleEmitter
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteParticleEmitter") == 0) {
+ stack->correctParams(0);
+ if (_partEmitter) {
+ _gameRef->unregisterObject(_partEmitter);
+ _partEmitter = NULL;
+ }
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddAttachment
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddAttachment") == 0) {
+ stack->correctParams(4);
+ const char *filename = stack->pop()->getString();
+ bool preDisplay = stack->pop()->getBool(true);
+ int offsetX = stack->pop()->getInt();
+ int offsetY = stack->pop()->getInt();
+
+ bool res;
+ AdEntity *ent = new AdEntity(_gameRef);
+ if (DID_FAIL(res = ent->loadFile(filename))) {
+ delete ent;
+ ent = NULL;
+ script->runtimeError("AddAttachment() failed loading entity '%s'", filename);
+ stack->pushBool(false);
+ } else {
+ _gameRef->registerObject(ent);
+
+ ent->_posX = offsetX;
+ ent->_posY = offsetY;
+ ent->_active = true;
+
+ if (preDisplay) {
+ _attachmentsPre.add(ent);
+ } else {
+ _attachmentsPost.add(ent);
+ }
+
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveAttachment
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveAttachment") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ bool found = false;
+ if (val->isNative()) {
+ BaseScriptable *obj = val->getNative();
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ if (_attachmentsPre[i] == obj) {
+ found = true;
+ _gameRef->unregisterObject(_attachmentsPre[i]);
+ _attachmentsPre.remove_at(i);
+ i--;
+ }
+ }
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ if (_attachmentsPost[i] == obj) {
+ found = true;
+ _gameRef->unregisterObject(_attachmentsPost[i]);
+ _attachmentsPost.remove_at(i);
+ i--;
+ }
+ }
+ } else {
+ const char *attachmentName = val->getString();
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ if (_attachmentsPre[i]->getName() && scumm_stricmp(_attachmentsPre[i]->getName(), attachmentName) == 0) {
+ found = true;
+ _gameRef->unregisterObject(_attachmentsPre[i]);
+ _attachmentsPre.remove_at(i);
+ i--;
+ }
+ }
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ if (_attachmentsPost[i]->getName() && scumm_stricmp(_attachmentsPost[i]->getName(), attachmentName) == 0) {
+ found = true;
+ _gameRef->unregisterObject(_attachmentsPost[i]);
+ _attachmentsPost.remove_at(i);
+ i--;
+ }
+ }
+ }
+ stack->pushBool(found);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetAttachment
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetAttachment") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdObject *ret = NULL;
+ if (val->isInt()) {
+ int index = val->getInt();
+ int currIndex = 0;
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ if (currIndex == index) {
+ ret = _attachmentsPre[i];
+ }
+ currIndex++;
+ }
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ if (currIndex == index) {
+ ret = _attachmentsPost[i];
+ }
+ currIndex++;
+ }
+ } else {
+ const char *attachmentName = val->getString();
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ if (_attachmentsPre[i]->getName() && scumm_stricmp(_attachmentsPre[i]->getName(), attachmentName) == 0) {
+ ret = _attachmentsPre[i];
+ break;
+ }
+ }
+ if (!ret) {
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ if (_attachmentsPost[i]->getName() && scumm_stricmp(_attachmentsPost[i]->getName(), attachmentName) == 0) {
+ ret = _attachmentsPre[i];
+ break;
+ }
+ }
+ }
+ }
+
+ if (ret != NULL) {
+ stack->pushNative(ret, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdObject::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("object");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Active") {
+ _scValue->setBool(_active);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IgnoreItems
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "IgnoreItems") {
+ _scValue->setBool(_ignoreItems);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SceneIndependent
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SceneIndependent") {
+ _scValue->setBool(_sceneIndependent);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesWidth
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SubtitlesWidth") {
+ _scValue->setInt(_subtitlesWidth);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosRelative
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SubtitlesPosRelative") {
+ _scValue->setBool(_subtitlesModRelative);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SubtitlesPosX") {
+ _scValue->setInt(_subtitlesModX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SubtitlesPosY") {
+ _scValue->setInt(_subtitlesModY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosXCenter
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SubtitlesPosXCenter") {
+ _scValue->setBool(_subtitlesModXCenter);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumItems (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumItems") {
+ _scValue->setInt(getInventory()->_takenItems.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ParticleEmitter (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ParticleEmitter") {
+ if (_partEmitter) {
+ _scValue->setNative(_partEmitter, true);
+ } else {
+ _scValue->setNULL();
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumAttachments (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumAttachments") {
+ _scValue->setInt(_attachmentsPre.size() + _attachmentsPost.size());
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::scSetProperty(const char *name, ScValue *value) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Active") == 0) {
+ _active = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IgnoreItems
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IgnoreItems") == 0) {
+ _ignoreItems = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SceneIndependent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SceneIndependent") == 0) {
+ _sceneIndependent = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesWidth
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SubtitlesWidth") == 0) {
+ _subtitlesWidth = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosRelative
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SubtitlesPosRelative") == 0) {
+ _subtitlesModRelative = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SubtitlesPosX") == 0) {
+ _subtitlesModX = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SubtitlesPosY") == 0) {
+ _subtitlesModY = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesPosXCenter
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SubtitlesPosXCenter") == 0) {
+ _subtitlesModXCenter = value->getBool();
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdObject::scToString() {
+ return "[ad object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::setFont(const char *filename) {
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ if (filename) {
+ _font = _gameRef->_fontStorage->addFont(filename);
+ return _font == NULL ? STATUS_FAILED : STATUS_OK;
+ } else {
+ _font = NULL;
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int AdObject::getHeight() {
+ if (!_currentSprite) {
+ return 0;
+ } else {
+ BaseFrame *frame = _currentSprite->_frames[_currentSprite->_currentFrame];
+ int ret = 0;
+ for (uint32 i = 0; i < frame->_subframes.size(); i++) {
+ ret = MAX(ret, frame->_subframes[i]->_hotspotY);
+ }
+
+ if (_zoomable) {
+ float zoom = ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY);
+ ret = (int)(ret * zoom / 100);
+ }
+ return ret;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdObject::talk(const char *text, const char *sound, uint32 duration, const char *stances, TTextAlign Align) {
+ if (!_sentence) {
+ _sentence = new AdSentence(_gameRef);
+ }
+ if (!_sentence) {
+ return;
+ }
+
+ if (_forcedTalkAnimName && _forcedTalkAnimUsed) {
+ delete[] _forcedTalkAnimName;
+ _forcedTalkAnimName = NULL;
+ _forcedTalkAnimUsed = false;
+ }
+
+ delete(_sentence->_sound);
+ _sentence->_sound = NULL;
+
+ _sentence->setText(text);
+ _gameRef->_stringTable->expand(&_sentence->_text);
+ _sentence->setStances(stances);
+ _sentence->_duration = duration;
+ _sentence->_align = Align;
+ _sentence->_startTime = _gameRef->_timer;
+ _sentence->_currentStance = -1;
+ _sentence->_font = _font == NULL ? _gameRef->_systemFont : _font;
+ _sentence->_freezable = _freezable;
+
+ // try to locate speech file automatically
+ bool deleteSound = false;
+ if (!sound) {
+ char *key = _gameRef->_stringTable->getKey(text);
+ if (key) {
+ sound = ((AdGame *)_gameRef)->findSpeechFile(key);
+ delete[] key;
+
+ if (sound) {
+ deleteSound = true;
+ }
+ }
+ }
+
+ // load sound and set duration appropriately
+ if (sound) {
+ BaseSound *snd = new BaseSound(_gameRef);
+ if (snd && DID_SUCCEED(snd->setSound(sound, Audio::Mixer::kSpeechSoundType, true))) {
+ _sentence->setSound(snd);
+ if (_sentence->_duration <= 0) {
+ uint32 length = snd->getLength();
+ if (length != 0) {
+ _sentence->_duration = length;
+ }
+ }
+ } else {
+ delete snd;
+ }
+ }
+
+ // set duration by text length
+ if (_sentence->_duration <= 0) {// TODO: Avoid longs.
+ _sentence->_duration = MAX((size_t)1000, _gameRef->_subtitlesSpeed * strlen(_sentence->_text));
+ }
+
+
+ int x, y, width, height;
+
+ x = _posX;
+ y = _posY;
+
+ if (!_sceneIndependent && _subtitlesModRelative) {
+ x -= ((AdGame *)_gameRef)->_scene->getOffsetLeft();
+ y -= ((AdGame *)_gameRef)->_scene->getOffsetTop();
+ }
+
+
+ if (_subtitlesWidth > 0) {
+ width = _subtitlesWidth;
+ } else {
+ if ((x < _gameRef->_renderer->_width / 4 || x > _gameRef->_renderer->_width * 0.75) && !_gameRef->_touchInterface) {
+ width = MAX(_gameRef->_renderer->_width / 4, MIN(x * 2, (_gameRef->_renderer->_width - x) * 2));
+ } else {
+ width = _gameRef->_renderer->_width / 2;
+ }
+ }
+
+ height = _sentence->_font->getTextHeight((byte *)_sentence->_text, width);
+
+ y = y - height - getHeight() - 5;
+ if (_subtitlesModRelative) {
+ x += _subtitlesModX;
+ y += _subtitlesModY;
+ } else {
+ x = _subtitlesModX;
+ y = _subtitlesModY;
+ }
+ if (_subtitlesModXCenter) {
+ x = x - width / 2;
+ }
+
+
+ x = MIN(MAX(0, x), _gameRef->_renderer->_width - width);
+ y = MIN(MAX(0, y), _gameRef->_renderer->_height - height);
+
+ _sentence->_width = width;
+
+
+ _sentence->_pos.x = x;
+ _sentence->_pos.y = y;
+
+
+ if (_subtitlesModRelative) {
+ _sentence->_pos.x += ((AdGame *)_gameRef)->_scene->getOffsetLeft();
+ _sentence->_pos.y += ((AdGame *)_gameRef)->_scene->getOffsetTop();
+ }
+
+ _sentence->_fixedPos = !_subtitlesModRelative;
+
+
+ _sentence->setupTalkFile(sound);
+
+ _state = STATE_TALKING;
+
+ if (deleteSound) {
+ delete[] sound;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::reset() {
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL) {
+ delete _animSprite;
+ _animSprite = NULL;
+ } else if (_state == STATE_TALKING && _sentence) {
+ _sentence->finish();
+ }
+
+ _state = _nextState = STATE_READY;
+
+ _gameRef->_scEngine->resetObject(this);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transfer(TMEMBER(_blockRegion));
+ persistMgr->transfer(TMEMBER(_currentBlockRegion));
+ persistMgr->transfer(TMEMBER(_currentWptGroup));
+ persistMgr->transfer(TMEMBER(_currentSprite));
+ persistMgr->transfer(TMEMBER(_drawn));
+ persistMgr->transfer(TMEMBER(_font));
+ persistMgr->transfer(TMEMBER(_ignoreItems));
+ persistMgr->transfer(TMEMBER_INT(_nextState));
+ persistMgr->transfer(TMEMBER(_sentence));
+ persistMgr->transfer(TMEMBER_INT(_state));
+ persistMgr->transfer(TMEMBER(_animSprite));
+ persistMgr->transfer(TMEMBER(_sceneIndependent));
+ persistMgr->transfer(TMEMBER(_forcedTalkAnimName));
+ persistMgr->transfer(TMEMBER(_forcedTalkAnimUsed));
+ persistMgr->transfer(TMEMBER(_tempSprite2));
+ persistMgr->transfer(TMEMBER_INT(_type));
+ persistMgr->transfer(TMEMBER(_wptGroup));
+ persistMgr->transfer(TMEMBER(_stickRegion));
+ persistMgr->transfer(TMEMBER(_subtitlesModRelative));
+ persistMgr->transfer(TMEMBER(_subtitlesModX));
+ persistMgr->transfer(TMEMBER(_subtitlesModY));
+ persistMgr->transfer(TMEMBER(_subtitlesModXCenter));
+ persistMgr->transfer(TMEMBER(_subtitlesWidth));
+ persistMgr->transfer(TMEMBER(_inventory));
+ persistMgr->transfer(TMEMBER(_partEmitter));
+
+ for (int i = 0; i < MAX_NUM_REGIONS; i++) {
+ persistMgr->transfer(TMEMBER(_currentRegions[i]));
+ }
+
+ _attachmentsPre.persist(persistMgr);
+ _attachmentsPost.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_registerAlias));
+
+ persistMgr->transfer(TMEMBER(_partFollowParent));
+ persistMgr->transfer(TMEMBER(_partOffsetX));
+ persistMgr->transfer(TMEMBER(_partOffsetY));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::updateSounds() {
+ if (_sentence && _sentence->_sound) {
+ updateOneSound(_sentence->_sound);
+ }
+
+ return BaseObject::updateSounds();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::resetSoundPan() {
+ if (_sentence && _sentence->_sound) {
+ _sentence->_sound->setPan(0.0f);
+ }
+ return BaseObject::resetSoundPan();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::getExtendedFlag(const char *flagName) {
+ if (!flagName) {
+ return false;
+ } else if (strcmp(flagName, "usable") == 0) {
+ return true;
+ } else {
+ return BaseObject::getExtendedFlag(flagName);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ if (_blockRegion) {
+ _blockRegion->saveAsText(buffer, indent + 2, "BLOCKED_REGION");
+ }
+ if (_wptGroup) {
+ _wptGroup->saveAsText(buffer, indent + 2);
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::updateBlockRegion() {
+ AdGame *adGame = (AdGame *)_gameRef;
+ if (adGame->_scene) {
+ if (_blockRegion && _currentBlockRegion) {
+ _currentBlockRegion->mimic(_blockRegion, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY);
+ }
+
+ if (_wptGroup && _currentWptGroup) {
+ _currentWptGroup->mimic(_wptGroup, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY);
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AdInventory *AdObject::getInventory() {
+ if (!_inventory) {
+ _inventory = new AdInventory(_gameRef);
+ ((AdGame *)_gameRef)->registerInventory(_inventory);
+ }
+ return _inventory;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::afterMove() {
+ AdRegion *newRegions[MAX_NUM_REGIONS];
+
+ ((AdGame *)_gameRef)->_scene->getRegionsAt(_posX, _posY, newRegions, MAX_NUM_REGIONS);
+ for (int i = 0; i < MAX_NUM_REGIONS; i++) {
+ if (!newRegions[i]) {
+ break;
+ }
+ bool regFound = false;
+ for (int j = 0; j < MAX_NUM_REGIONS; j++) {
+ if (_currentRegions[j] == newRegions[i]) {
+ _currentRegions[j] = NULL;
+ regFound = true;
+ break;
+ }
+ }
+ if (!regFound) {
+ newRegions[i]->applyEvent("ActorEntry");
+ }
+ }
+
+ for (int i = 0; i < MAX_NUM_REGIONS; i++) {
+ if (_currentRegions[i] && _gameRef->validObject(_currentRegions[i])) {
+ _currentRegions[i]->applyEvent("ActorLeave");
+ }
+ _currentRegions[i] = newRegions[i];
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::invalidateCurrRegions() {
+ for (int i = 0; i < MAX_NUM_REGIONS; i++) {
+ _currentRegions[i] = NULL;
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::getScale(float *scaleX, float *scaleY) {
+ if (_zoomable) {
+ if (_scaleX >= 0 || _scaleY >= 0) {
+ *scaleX = _scaleX < 0 ? 100 : _scaleX;
+ *scaleY = _scaleY < 0 ? 100 : _scaleY;
+ } else if (_scale >= 0) {
+ *scaleX = *scaleY = _scale;
+ } else {
+ *scaleX = *scaleY = ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) + _relativeScale;
+ }
+ } else {
+ *scaleX = *scaleY = 100;
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::updateSpriteAttachments() {
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ _attachmentsPre[i]->update();
+ }
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ _attachmentsPost[i]->update();
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::displaySpriteAttachments(bool preDisplay) {
+ if (preDisplay) {
+ for (uint32 i = 0; i < _attachmentsPre.size(); i++) {
+ displaySpriteAttachment(_attachmentsPre[i]);
+ }
+ } else {
+ for (uint32 i = 0; i < _attachmentsPost.size(); i++) {
+ displaySpriteAttachment(_attachmentsPost[i]);
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::displaySpriteAttachment(AdObject *attachment) {
+ if (!attachment->_active) {
+ return STATUS_OK;
+ }
+
+ float scaleX, scaleY;
+ getScale(&scaleX, &scaleY);
+
+ int origX = attachment->_posX;
+ int origY = attachment->_posY;
+
+ // inherit position from owner
+ attachment->_posX = (int)(this->_posX + attachment->_posX * scaleX / 100.0f);
+ attachment->_posY = (int)(this->_posY + attachment->_posY * scaleY / 100.0f);
+
+ // inherit other props
+ attachment->_alphaColor = this->_alphaColor;
+ attachment->_blendMode = this->_blendMode;
+
+ attachment->_scale = this->_scale;
+ attachment->_relativeScale = this->_relativeScale;
+ attachment->_scaleX = this->_scaleX;
+ attachment->_scaleY = this->_scaleY;
+
+ attachment->_rotate = this->_rotate;
+ attachment->_relativeRotate = this->_relativeRotate;
+ attachment->_rotateValid = this->_rotateValid;
+
+ attachment->_registerAlias = this;
+ attachment->_registrable = this->_registrable;
+
+ bool ret = attachment->display();
+
+ attachment->_posX = origX;
+ attachment->_posY = origY;
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+PartEmitter *AdObject::createParticleEmitter(bool followParent, int offsetX, int offsetY) {
+ _partFollowParent = followParent;
+ _partOffsetX = offsetX;
+ _partOffsetY = offsetY;
+
+ if (!_partEmitter) {
+ _partEmitter = new PartEmitter(_gameRef, this);
+ if (_partEmitter) {
+ _gameRef->registerObject(_partEmitter);
+ }
+ }
+ updatePartEmitter();
+ return _partEmitter;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdObject::updatePartEmitter() {
+ if (!_partEmitter) {
+ return STATUS_FAILED;
+ }
+
+ if (_partFollowParent) {
+ float scaleX, scaleY;
+ getScale(&scaleX, &scaleY);
+
+ _partEmitter->_posX = (int)(_posX + (scaleX / 100.0f) * _partOffsetX);
+ _partEmitter->_posY = (int)(_posY + (scaleY / 100.0f) * _partOffsetY);
+ }
+ return _partEmitter->update();
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h
new file mode 100644
index 0000000000..d1a20908e1
--- /dev/null
+++ b/engines/wintermute/ad/ad_object.h
@@ -0,0 +1,124 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADOBJECT_H
+#define WINTERMUTE_ADOBJECT_H
+
+#include "engines/wintermute/ad/ad_types.h"
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class AdWaypointGroup;
+class AdRegion;
+class AdSentence;
+class BaseFont;
+class BaseRegion;
+class AdInventory;
+class PartEmitter;
+
+#define MAX_NUM_REGIONS 10
+
+class AdObject : public BaseObject {
+public:
+ PartEmitter *_partEmitter;
+ virtual PartEmitter *createParticleEmitter(bool followParent = false, int offsetX = 0, int offsetY = 0);
+ virtual bool updatePartEmitter();
+ bool _partFollowParent;
+ int _partOffsetX;
+ int _partOffsetY;
+
+ bool invalidateCurrRegions();
+ bool _subtitlesModRelative;
+ bool _subtitlesModXCenter;
+ int _subtitlesModX;
+ int _subtitlesModY;
+ int _subtitlesWidth;
+ AdRegion *_stickRegion;
+ bool _sceneIndependent;
+ bool _ignoreItems;
+ bool updateBlockRegion();
+ bool _forcedTalkAnimUsed;
+ char *_forcedTalkAnimName;
+ virtual bool getExtendedFlag(const char *flagName);
+ virtual bool resetSoundPan();
+ virtual bool updateSounds();
+ bool reset();
+ DECLARE_PERSISTENT(AdObject, BaseObject)
+ virtual void talk(const char *text, const char *sound = NULL, uint32 duration = 0, const char *stances = NULL, TTextAlign align = TAL_CENTER);
+ virtual int getHeight();
+ AdSentence *_sentence;
+ bool setFont(const char *filename);
+ virtual bool update();
+ virtual bool display();
+ bool _drawn;
+ bool _active;
+ virtual bool playAnim(const char *filename);
+ BaseSprite *_animSprite;
+ BaseSprite *_currentSprite;
+ TObjectState _state;
+ TObjectState _nextState;
+ TObjectType _type;
+ AdObject(BaseGame *inGame);
+ virtual ~AdObject();
+ BaseFont *_font;
+ BaseSprite *_tempSprite2;
+ BaseRegion *_blockRegion;
+ AdWaypointGroup *_wptGroup;
+ BaseRegion *_currentBlockRegion;
+ AdWaypointGroup *_currentWptGroup;
+ AdInventory *getInventory();
+
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ virtual bool afterMove();
+ AdRegion *_currentRegions[MAX_NUM_REGIONS];
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+ BaseArray<AdObject *> _attachmentsPre;
+ BaseArray<AdObject *> _attachmentsPost;
+
+ bool updateSpriteAttachments();
+ bool displaySpriteAttachments(bool preDisplay);
+ AdObject *_registerAlias;
+private:
+ bool displaySpriteAttachment(AdObject *attachment);
+ AdInventory *_inventory;
+
+protected:
+ bool getScale(float *scaleX, float *scaleY);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp
new file mode 100644
index 0000000000..c931213456
--- /dev/null
+++ b/engines/wintermute/ad/ad_path.cpp
@@ -0,0 +1,120 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_path.h"
+#include "engines/wintermute/base/base_point.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdPath, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdPath::AdPath(BaseGame *inGame) : BaseClass(inGame) {
+ _currIndex = -1;
+ _ready = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdPath::~AdPath() {
+ reset();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdPath::reset() {
+ for (uint32 i = 0; i < _points.size(); i++) {
+ delete _points[i];
+ }
+
+ _points.clear();
+ _currIndex = -1;
+ _ready = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BasePoint *AdPath::getFirst() {
+ if (_points.size() > 0) {
+ _currIndex = 0;
+ return _points[_currIndex];
+ } else {
+ return NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BasePoint *AdPath::getNext() {
+ _currIndex++;
+ if (_currIndex < (int32)_points.size()) {
+ return _points[_currIndex];
+ } else {
+ return NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BasePoint *AdPath::getCurrent() {
+ if (_currIndex >= 0 && _currIndex < (int32)_points.size()) {
+ return _points[_currIndex];
+ } else {
+ return NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdPath::addPoint(BasePoint *point) {
+ _points.add(point);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdPath::setReady(bool ready) {
+ bool orig = _ready;
+ _ready = ready;
+
+ return orig;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdPath::persist(BasePersistenceManager *persistMgr) {
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_currIndex));
+ _points.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_ready));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_path.h b/engines/wintermute/ad/ad_path.h
new file mode 100644
index 0000000000..6b043197aa
--- /dev/null
+++ b/engines/wintermute/ad/ad_path.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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADPATH_H
+#define WINTERMUTE_ADPATH_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+class BasePoint;
+class AdPath : public BaseClass {
+public:
+ DECLARE_PERSISTENT(AdPath, BaseClass)
+ BasePoint *getCurrent();
+ bool setReady(bool ready = true);
+ void addPoint(BasePoint *point);
+ BasePoint *getNext();
+ BasePoint *getFirst();
+ void reset();
+ AdPath(BaseGame *inGame);
+ virtual ~AdPath();
+ BaseArray<BasePoint *> _points;
+ int _currIndex;
+ bool _ready;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp
new file mode 100644
index 0000000000..a36648eb69
--- /dev/null
+++ b/engines/wintermute/ad/ad_path_point.cpp
@@ -0,0 +1,75 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_path_point.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdPathPoint, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdPathPoint::AdPathPoint() {
+ x = y = 0;
+ _distance = 0;
+
+ _marked = false;
+ _origin = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdPathPoint::AdPathPoint(int initX, int initY, int initDistance) {
+ x = initX;
+ y = initY;
+ _distance = initDistance;
+
+ _marked = false;
+ _origin = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdPathPoint::~AdPathPoint() {
+ _origin = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdPathPoint::persist(BasePersistenceManager *persistMgr) {
+
+ BasePoint::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_distance));
+ persistMgr->transfer(TMEMBER(_marked));
+ persistMgr->transfer(TMEMBER(_origin));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_path_point.h b/engines/wintermute/ad/ad_path_point.h
new file mode 100644
index 0000000000..58457976c8
--- /dev/null
+++ b/engines/wintermute/ad/ad_path_point.h
@@ -0,0 +1,50 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADPATHPOINT_H
+#define WINTERMUTE_ADPATHPOINT_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/base_point.h"
+
+namespace Wintermute {
+
+class AdPathPoint : public BasePoint {
+public:
+ DECLARE_PERSISTENT(AdPathPoint, BasePoint)
+ AdPathPoint(int initX, int initY, int initDistance);
+ AdPathPoint();
+ virtual ~AdPathPoint();
+ AdPathPoint *_origin;
+ bool _marked;
+ int _distance;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp
new file mode 100644
index 0000000000..c9f1553c9a
--- /dev/null
+++ b/engines/wintermute/ad/ad_region.cpp
@@ -0,0 +1,397 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_region.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdRegion, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdRegion::AdRegion(BaseGame *inGame) : BaseRegion(inGame) {
+ _blocked = false;
+ _decoration = false;
+ _zoom = 0;
+ _alpha = 0xFFFFFFFF;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdRegion::~AdRegion() {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRegion::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdRegion::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing REGION file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(REGION)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(ACTIVE)
+TOKEN_DEF(ZOOM)
+TOKEN_DEF(SCALE)
+TOKEN_DEF(BLOCKED)
+TOKEN_DEF(DECORATION)
+TOKEN_DEF(POINT)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(EDITOR_SELECTED_POINT)
+TOKEN_DEF(EDITOR_SELECTED)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdRegion::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(REGION)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(ACTIVE)
+ TOKEN_TABLE(ZOOM)
+ TOKEN_TABLE(SCALE)
+ TOKEN_TABLE(BLOCKED)
+ TOKEN_TABLE(DECORATION)
+ TOKEN_TABLE(POINT)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(EDITOR_SELECTED_POINT)
+ TOKEN_TABLE(EDITOR_SELECTED)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_REGION) {
+ _gameRef->LOG(0, "'REGION' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ for (uint32 i = 0; i < _points.size(); i++) {
+ delete _points[i];
+ }
+ _points.clear();
+
+ int ar = 255, ag = 255, ab = 255, alpha = 255;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_ACTIVE:
+ parser.scanStr((char *)params, "%b", &_active);
+ break;
+
+ case TOKEN_BLOCKED:
+ parser.scanStr((char *)params, "%b", &_blocked);
+ break;
+
+ case TOKEN_DECORATION:
+ parser.scanStr((char *)params, "%b", &_decoration);
+ break;
+
+ case TOKEN_ZOOM:
+ case TOKEN_SCALE: {
+ int j;
+ parser.scanStr((char *)params, "%d", &j);
+ _zoom = (float)j;
+ }
+ break;
+
+ case TOKEN_POINT: {
+ int x, y;
+ parser.scanStr((char *)params, "%d,%d", &x, &y);
+ _points.add(new BasePoint(x, y));
+ }
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr((char *)params, "%d", &alpha);
+ break;
+
+ case TOKEN_EDITOR_SELECTED:
+ parser.scanStr((char *)params, "%b", &_editorSelected);
+ break;
+
+ case TOKEN_EDITOR_SELECTED_POINT:
+ parser.scanStr((char *)params, "%d", &_editorSelectedPoint);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in REGION definition");
+ return STATUS_FAILED;
+ }
+
+ createRegion();
+
+ _alpha = BYTETORGBA(ar, ag, ab, alpha);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ /*
+ //////////////////////////////////////////////////////////////////////////
+ // SkipTo
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SkipTo")==0) {
+ stack->correctParams(2);
+ _posX = stack->pop()->getInt();
+ _posY = stack->pop()->getInt();
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ else*/ return BaseRegion::scCallMethod(script, stack, thisStack, name);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdRegion::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("ad region");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Name") {
+ _scValue->setString(getName());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Blocked
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Blocked") {
+ _scValue->setBool(_blocked);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Decoration
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Decoration") {
+ _scValue->setBool(_decoration);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Scale
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Scale") {
+ _scValue->setFloat(_zoom);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AlphaColor") {
+ _scValue->setInt((int)_alpha);
+ return _scValue;
+ } else {
+ return BaseRegion::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRegion::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Blocked
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Blocked") == 0) {
+ _blocked = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Decoration
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Decoration") == 0) {
+ _decoration = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Scale
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Scale") == 0) {
+ _zoom = value->getFloat();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AlphaColor") == 0) {
+ _alpha = (uint32)value->getInt();
+ return STATUS_OK;
+ } else {
+ return BaseRegion::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdRegion::scToString() {
+ return "[ad region]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRegion::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "REGION {\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+ buffer->putTextIndent(indent + 2, "BLOCKED=%s\n", _blocked ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "DECORATION=%s\n", _decoration ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "SCALE=%d\n", (int)_zoom);
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alpha), RGBCOLGetG(_alpha), RGBCOLGetB(_alpha));
+ buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alpha));
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ if (_scProp) {
+ _scProp->saveAsText(buffer, indent + 2);
+ }
+
+ for (uint32 i = 0; i < _points.size(); i++) {
+ buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y);
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRegion::persist(BasePersistenceManager *persistMgr) {
+ BaseRegion::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_alpha));
+ persistMgr->transfer(TMEMBER(_blocked));
+ persistMgr->transfer(TMEMBER(_decoration));
+ persistMgr->transfer(TMEMBER(_zoom));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h
new file mode 100644
index 0000000000..6112900361
--- /dev/null
+++ b/engines/wintermute/ad/ad_region.h
@@ -0,0 +1,58 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADREGION_H
+#define WINTERMUTE_ADREGION_H
+
+#include "engines/wintermute/base/base_region.h"
+
+namespace Wintermute {
+
+class AdRegion : public BaseRegion {
+public:
+ DECLARE_PERSISTENT(AdRegion, BaseRegion)
+ uint32 _alpha;
+ float _zoom;
+ bool _blocked;
+ bool _decoration;
+ AdRegion(BaseGame *inGame);
+ virtual ~AdRegion();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp
new file mode 100644
index 0000000000..a2225f2632
--- /dev/null
+++ b/engines/wintermute/ad/ad_response.cpp
@@ -0,0 +1,146 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_response.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/utils/utils.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdResponse, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdResponse::AdResponse(BaseGame *inGame) : BaseObject(inGame) {
+ _text = NULL;
+ _textOrig = NULL;
+ _icon = _iconHover = _iconPressed = NULL;
+ _font = NULL;
+ _iD = 0;
+ _responseType = RESPONSE_ALWAYS;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdResponse::~AdResponse() {
+ delete[] _text;
+ delete[] _textOrig;
+ delete _icon;
+ delete _iconHover;
+ delete _iconPressed;
+ _text = NULL;
+ _textOrig = NULL;
+ _icon = NULL;
+ _iconHover = NULL;
+ _iconPressed = NULL;
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdResponse::setText(const char *text) {
+ BaseUtils::setString(&_text, text);
+ BaseUtils::setString(&_textOrig, text);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponse::setIcon(const char *filename) {
+ delete _icon;
+ _icon = new BaseSprite(_gameRef);
+ if (!_icon || DID_FAIL(_icon->loadFile(filename))) {
+ _gameRef->LOG(0, "AdResponse::setIcon failed for file '%s'", filename);
+ delete _icon;
+ _icon = NULL;
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponse::setFont(const char *filename) {
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ _font = _gameRef->_fontStorage->addFont(filename);
+ if (!_font) {
+ _gameRef->LOG(0, "AdResponse::setFont failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponse::setIconHover(const char *filename) {
+ delete _iconHover;
+ _iconHover = new BaseSprite(_gameRef);
+ if (!_iconHover || DID_FAIL(_iconHover->loadFile(filename))) {
+ _gameRef->LOG(0, "AdResponse::setIconHover failed for file '%s'", filename);
+ delete _iconHover;
+ _iconHover = NULL;
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponse::setIconPressed(const char *filename) {
+ delete _iconPressed;
+ _iconPressed = new BaseSprite(_gameRef);
+ if (!_iconPressed || DID_FAIL(_iconPressed->loadFile(filename))) {
+ _gameRef->LOG(0, "AdResponse::setIconPressed failed for file '%s'", filename);
+ delete _iconPressed;
+ _iconPressed = NULL;
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponse::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_icon));
+ persistMgr->transfer(TMEMBER(_iconHover));
+ persistMgr->transfer(TMEMBER(_iconPressed));
+ persistMgr->transfer(TMEMBER(_iD));
+ persistMgr->transfer(TMEMBER(_text));
+ persistMgr->transfer(TMEMBER(_textOrig));
+ persistMgr->transfer(TMEMBER_INT(_responseType));
+ persistMgr->transfer(TMEMBER(_font));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_response.h b/engines/wintermute/ad/ad_response.h
new file mode 100644
index 0000000000..0ba88cf2e8
--- /dev/null
+++ b/engines/wintermute/ad/ad_response.h
@@ -0,0 +1,61 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADRESPONSE_H
+#define WINTERMUTE_ADRESPONSE_H
+
+
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/ad/ad_types.h"
+
+namespace Wintermute {
+class BaseFont;
+class AdResponse : public BaseObject {
+public:
+ DECLARE_PERSISTENT(AdResponse, BaseObject)
+ bool setIcon(const char *filename);
+ bool setFont(const char *filename);
+ bool setIconHover(const char *filename);
+ bool setIconPressed(const char *filename);
+ void setText(const char *text);
+ int _iD;
+ BaseSprite *_icon;
+ BaseSprite *_iconHover;
+ BaseSprite *_iconPressed;
+ BaseFont *_font;
+ char *_text;
+ char *_textOrig;
+ AdResponse(BaseGame *inGame);
+ virtual ~AdResponse();
+ TResponseType _responseType;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
new file mode 100644
index 0000000000..fb31aa0bb8
--- /dev/null
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -0,0 +1,713 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_response.h"
+#include "engines/wintermute/ad/ad_response_box.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/ui/ui_button.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdResponseBox, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdResponseBox::AdResponseBox(BaseGame *inGame) : BaseObject(inGame) {
+ _font = _fontHover = NULL;
+
+ _window = NULL;
+ _shieldWindow = new UIWindow(_gameRef);
+
+ _horizontal = false;
+ BasePlatform::setRectEmpty(&_responseArea);
+ _scrollOffset = 0;
+ _spacing = 0;
+
+ _waitingScript = NULL;
+ _lastResponseText = NULL;
+ _lastResponseTextOrig = NULL;
+
+ _verticalAlign = VAL_BOTTOM;
+ _align = TAL_LEFT;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdResponseBox::~AdResponseBox() {
+
+ delete _window;
+ _window = NULL;
+ delete _shieldWindow;
+ _shieldWindow = NULL;
+ delete[] _lastResponseText;
+ _lastResponseText = NULL;
+ delete[] _lastResponseTextOrig;
+ _lastResponseTextOrig = NULL;
+
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
+
+ clearResponses();
+ clearButtons();
+
+ _waitingScript = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdResponseBox::clearResponses() {
+ for (uint32 i = 0; i < _responses.size(); i++) {
+ delete _responses[i];
+ }
+ _responses.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdResponseBox::clearButtons() {
+ for (uint32 i = 0; i < _respButtons.size(); i++) {
+ delete _respButtons[i];
+ }
+ _respButtons.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::invalidateButtons() {
+ for (uint32 i = 0; i < _respButtons.size(); i++) {
+ _respButtons[i]->_image = NULL;
+ _respButtons[i]->_cursor = NULL;
+ _respButtons[i]->_font = NULL;
+ _respButtons[i]->_fontHover = NULL;
+ _respButtons[i]->_fontPress = NULL;
+ _respButtons[i]->setText("");
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::createButtons() {
+ clearButtons();
+
+ _scrollOffset = 0;
+ for (uint32 i = 0; i < _responses.size(); i++) {
+ UIButton *btn = new UIButton(_gameRef);
+ if (btn) {
+ btn->_parent = _window;
+ btn->_sharedFonts = btn->_sharedImages = true;
+ btn->_sharedCursors = true;
+ // iconic
+ if (_responses[i]->_icon) {
+ btn->_image = _responses[i]->_icon;
+ if (_responses[i]->_iconHover) {
+ btn->_imageHover = _responses[i]->_iconHover;
+ }
+ if (_responses[i]->_iconPressed) {
+ btn->_imagePress = _responses[i]->_iconPressed;
+ }
+
+ btn->setCaption(_responses[i]->_text);
+ if (_cursor) {
+ btn->_cursor = _cursor;
+ } else if (_gameRef->_activeCursor) {
+ btn->_cursor = _gameRef->_activeCursor;
+ }
+ }
+ // textual
+ else {
+ btn->setText(_responses[i]->_text);
+ btn->_font = (_font == NULL) ? _gameRef->_systemFont : _font;
+ btn->_fontHover = (_fontHover == NULL) ? _gameRef->_systemFont : _fontHover;
+ btn->_fontPress = btn->_fontHover;
+ btn->_align = _align;
+
+ if (_gameRef->_touchInterface) {
+ btn->_fontHover = btn->_font;
+ }
+
+
+ if (_responses[i]->_font) {
+ btn->_font = _responses[i]->_font;
+ }
+
+ btn->_width = _responseArea.right - _responseArea.left;
+ if (btn->_width <= 0) {
+ btn->_width = _gameRef->_renderer->_width;
+ }
+ }
+ btn->setName("response");
+ btn->correctSize();
+
+ // make the responses touchable
+ if (_gameRef->_touchInterface) {
+ btn->_height = MAX(btn->_height, 50);
+ }
+
+ //btn->SetListener(this, btn, _responses[i]->_iD);
+ btn->setListener(this, btn, i);
+ btn->_visible = false;
+ _respButtons.add(btn);
+
+ if (_responseArea.bottom - _responseArea.top < btn->_height) {
+ _gameRef->LOG(0, "Warning: Response '%s' is too high to be displayed within response box. Correcting.", _responses[i]->_text);
+ _responseArea.bottom += (btn->_height - (_responseArea.bottom - _responseArea.top));
+ }
+ }
+ }
+ _ready = false;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdResponseBox::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing RESPONSE_BOX file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(RESPONSE_BOX)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(FONT_HOVER)
+TOKEN_DEF(FONT)
+TOKEN_DEF(AREA)
+TOKEN_DEF(HORIZONTAL)
+TOKEN_DEF(SPACING)
+TOKEN_DEF(WINDOW)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(TEXT_ALIGN)
+TOKEN_DEF(VERTICAL_ALIGN)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(RESPONSE_BOX)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(FONT_HOVER)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(AREA)
+ TOKEN_TABLE(HORIZONTAL)
+ TOKEN_TABLE(SPACING)
+ TOKEN_TABLE(WINDOW)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(TEXT_ALIGN)
+ TOKEN_TABLE(VERTICAL_ALIGN)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_RESPONSE_BOX) {
+ _gameRef->LOG(0, "'RESPONSE_BOX' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_WINDOW:
+ delete _window;
+ _window = new UIWindow(_gameRef);
+ if (!_window || DID_FAIL(_window->loadBuffer(params, false))) {
+ delete _window;
+ _window = NULL;
+ cmd = PARSERR_GENERIC;
+ } else if (_shieldWindow) {
+ _shieldWindow->_parent = _window;
+ }
+ break;
+
+ case TOKEN_FONT:
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ _font = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_HOVER:
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
+ _fontHover = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontHover) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_AREA:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_responseArea.left, &_responseArea.top, &_responseArea.right, &_responseArea.bottom);
+ break;
+
+ case TOKEN_HORIZONTAL:
+ parser.scanStr((char *)params, "%b", &_horizontal);
+ break;
+
+ case TOKEN_TEXT_ALIGN:
+ if (scumm_stricmp((char *)params, "center") == 0) {
+ _align = TAL_CENTER;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _align = TAL_RIGHT;
+ } else {
+ _align = TAL_LEFT;
+ }
+ break;
+
+ case TOKEN_VERTICAL_ALIGN:
+ if (scumm_stricmp((char *)params, "top") == 0) {
+ _verticalAlign = VAL_TOP;
+ } else if (scumm_stricmp((char *)params, "center") == 0) {
+ _verticalAlign = VAL_CENTER;
+ } else {
+ _verticalAlign = VAL_BOTTOM;
+ }
+ break;
+
+ case TOKEN_SPACING:
+ parser.scanStr((char *)params, "%d", &_spacing);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in RESPONSE_BOX definition");
+ return STATUS_FAILED;
+ }
+
+ if (_window) {
+ for (uint32 i = 0; i < _window->_widgets.size(); i++) {
+ if (!_window->_widgets[i]->_listenerObject) {
+ _window->_widgets[i]->setListener(this, _window->_widgets[i], 0);
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "RESPONSE_BOX\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "AREA { %d, %d, %d, %d }\n", _responseArea.left, _responseArea.top, _responseArea.right, _responseArea.bottom);
+
+ if (_font && _font->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
+ if (_fontHover && _fontHover->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->getFilename());
+ }
+
+ if (_cursor && _cursor->getFilename()) {
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
+
+ buffer->putTextIndent(indent + 2, "HORIZONTAL=%s\n", _horizontal ? "TRUE" : "FALSE");
+
+ switch (_align) {
+ case TAL_LEFT:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "left");
+ break;
+ case TAL_RIGHT:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "right");
+ break;
+ case TAL_CENTER:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
+ break;
+ default:
+ error("AdResponseBox::SaveAsText - Unhandled enum");
+ break;
+ }
+
+ switch (_verticalAlign) {
+ case VAL_TOP:
+ buffer->putTextIndent(indent + 2, "VERTICAL_ALIGN=\"%s\"\n", "top");
+ break;
+ case VAL_BOTTOM:
+ buffer->putTextIndent(indent + 2, "VERTICAL_ALIGN=\"%s\"\n", "bottom");
+ break;
+ case VAL_CENTER:
+ buffer->putTextIndent(indent + 2, "VERTICAL_ALIGN=\"%s\"\n", "center");
+ break;
+ }
+
+ buffer->putTextIndent(indent + 2, "SPACING=%d\n", _spacing);
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // window
+ if (_window) {
+ _window->saveAsText(buffer, indent + 2);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::display() {
+ Rect32 rect = _responseArea;
+ if (_window) {
+ rect.offsetRect(_window->_posX, _window->_posY);
+ //_window->display();
+ }
+
+ int xxx, yyy;
+ uint32 i;
+
+ xxx = rect.left;
+ yyy = rect.top;
+
+ // shift down if needed
+ if (!_horizontal) {
+ int totalHeight = 0;
+ for (i = 0; i < _respButtons.size(); i++) {
+ totalHeight += (_respButtons[i]->_height + _spacing);
+ }
+ totalHeight -= _spacing;
+
+ switch (_verticalAlign) {
+ case VAL_BOTTOM:
+ if (yyy + totalHeight < rect.bottom) {
+ yyy = rect.bottom - totalHeight;
+ }
+ break;
+
+ case VAL_CENTER:
+ if (yyy + totalHeight < rect.bottom) {
+ yyy += ((rect.bottom - rect.top) - totalHeight) / 2;
+ }
+ break;
+
+ case VAL_TOP:
+ // do nothing
+ break;
+ }
+ }
+
+ // prepare response buttons
+ bool scrollNeeded = false;
+ for (i = _scrollOffset; i < _respButtons.size(); i++) {
+ if ((_horizontal && xxx + _respButtons[i]->_width > rect.right)
+ || (!_horizontal && yyy + _respButtons[i]->_height > rect.bottom)) {
+
+ scrollNeeded = true;
+ _respButtons[i]->_visible = false;
+ break;
+ }
+
+ _respButtons[i]->_visible = true;
+ _respButtons[i]->_posX = xxx;
+ _respButtons[i]->_posY = yyy;
+
+ if (_horizontal) {
+ xxx += (_respButtons[i]->_width + _spacing);
+ } else {
+ yyy += (_respButtons[i]->_height + _spacing);
+ }
+ }
+
+ // show appropriate scroll buttons
+ if (_window) {
+ _window->showWidget("prev", _scrollOffset > 0);
+ _window->showWidget("next", scrollNeeded);
+ }
+
+ // go exclusive
+ if (_shieldWindow) {
+ _shieldWindow->_posX = _shieldWindow->_posY = 0;
+ _shieldWindow->_width = _gameRef->_renderer->_width;
+ _shieldWindow->_height = _gameRef->_renderer->_height;
+
+ _shieldWindow->display();
+ }
+
+ // display window
+ if (_window) {
+ _window->display();
+ }
+
+
+ // display response buttons
+ for (i = _scrollOffset; i < _respButtons.size(); i++) {
+ _respButtons[i]->display();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::listen(BaseScriptHolder *param1, uint32 param2) {
+ UIObject *obj = (UIObject *)param1;
+
+ switch (obj->_type) {
+ case UI_BUTTON:
+ if (scumm_stricmp(obj->getName(), "prev") == 0) {
+ _scrollOffset--;
+ } else if (scumm_stricmp(obj->getName(), "next") == 0) {
+ _scrollOffset++;
+ } else if (scumm_stricmp(obj->getName(), "response") == 0) {
+ if (_waitingScript) {
+ _waitingScript->_stack->pushInt(_responses[param2]->_iD);
+ }
+ handleResponse(_responses[param2]);
+ _waitingScript = NULL;
+ _gameRef->_state = GAME_RUNNING;
+ ((AdGame *)_gameRef)->_stateEx = GAME_NORMAL;
+ _ready = true;
+ invalidateButtons();
+ clearResponses();
+ } else {
+ return BaseObject::listen(param1, param2);
+ }
+ break;
+ default:
+ error("AdResponseBox::Listen - Unhandled enum");
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_font));
+ persistMgr->transfer(TMEMBER(_fontHover));
+ persistMgr->transfer(TMEMBER(_horizontal));
+ persistMgr->transfer(TMEMBER(_lastResponseText));
+ persistMgr->transfer(TMEMBER(_lastResponseTextOrig));
+ _respButtons.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_responseArea));
+ _responses.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_scrollOffset));
+ persistMgr->transfer(TMEMBER(_shieldWindow));
+ persistMgr->transfer(TMEMBER(_spacing));
+ persistMgr->transfer(TMEMBER(_waitingScript));
+ persistMgr->transfer(TMEMBER(_window));
+
+ persistMgr->transfer(TMEMBER_INT(_verticalAlign));
+ persistMgr->transfer(TMEMBER_INT(_align));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::weedResponses() {
+ AdGame *adGame = (AdGame *)_gameRef;
+
+ for (uint32 i = 0; i < _responses.size(); i++) {
+ switch (_responses[i]->_responseType) {
+ case RESPONSE_ONCE:
+ if (adGame->branchResponseUsed(_responses[i]->_iD)) {
+ delete _responses[i];
+ _responses.remove_at(i);
+ i--;
+ }
+ break;
+
+ case RESPONSE_ONCE_GAME:
+ if (adGame->gameResponseUsed(_responses[i]->_iD)) {
+ delete _responses[i];
+ _responses.remove_at(i);
+ i--;
+ }
+ break;
+ default:
+ debugC(kWintermuteDebugGeneral, "AdResponseBox::WeedResponses - Unhandled enum");
+ break;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdResponseBox::setLastResponseText(const char *text, const char *textOrig) {
+ BaseUtils::setString(&_lastResponseText, text);
+ BaseUtils::setString(&_lastResponseTextOrig, textOrig);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::handleResponse(AdResponse *response) {
+ setLastResponseText(response->_text, response->_textOrig);
+
+ AdGame *adGame = (AdGame *)_gameRef;
+
+ switch (response->_responseType) {
+ case RESPONSE_ONCE:
+ adGame->addBranchResponse(response->_iD);
+ break;
+
+ case RESPONSE_ONCE_GAME:
+ adGame->addGameResponse(response->_iD);
+ break;
+ default:
+ debugC(kWintermuteDebugGeneral, "AdResponseBox::HandleResponse - Unhandled enum");
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseObject *AdResponseBox::getNextAccessObject(BaseObject *currObject) {
+ BaseArray<UIObject *> objects;
+ getObjects(objects, true);
+
+ if (objects.size() == 0) {
+ return NULL;
+ } else {
+ if (currObject != NULL) {
+ for (uint32 i = 0; i < objects.size(); i++) {
+ if (objects[i] == currObject) {
+ if (i < objects.size() - 1) {
+ return objects[i + 1];
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return objects[0];
+ }
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseObject *AdResponseBox::getPrevAccessObject(BaseObject *currObject) {
+ BaseArray<UIObject *> objects;
+ getObjects(objects, true);
+
+ if (objects.size() == 0) {
+ return NULL;
+ } else {
+ if (currObject != NULL) {
+ for (int i = objects.size() - 1; i >= 0; i--) {
+ if (objects[i] == currObject) {
+ if (i > 0) {
+ return objects[i - 1];
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return objects[objects.size() - 1];
+ }
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseBox::getObjects(BaseArray<UIObject *> &objects, bool interactiveOnly) {
+ for (uint32 i = 0; i < _respButtons.size(); i++) {
+ objects.add(_respButtons[i]);
+ }
+ if (_window) {
+ _window->getWindowObjects(objects, interactiveOnly);
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_response_box.h b/engines/wintermute/ad/ad_response_box.h
new file mode 100644
index 0000000000..35f8cb6347
--- /dev/null
+++ b/engines/wintermute/ad/ad_response_box.h
@@ -0,0 +1,87 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADRESPONSEBOX_H
+#define WINTERMUTE_ADRESPONSEBOX_H
+
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class UIButton;
+class UIWindow;
+class UIObject;
+class AdResponse;
+class AdResponseBox : public BaseObject {
+public:
+ BaseObject *getNextAccessObject(BaseObject *CurrObject);
+ BaseObject *getPrevAccessObject(BaseObject *CurrObject);
+ bool getObjects(BaseArray<UIObject *> &objects, bool interactiveOnly);
+
+ bool handleResponse(AdResponse *response);
+ void setLastResponseText(const char *text, const char *textOrig);
+ char *_lastResponseText;
+ char *_lastResponseTextOrig;
+ DECLARE_PERSISTENT(AdResponseBox, BaseObject)
+ ScScript *_waitingScript;
+ virtual bool listen(BaseScriptHolder *param1, uint32 param2);
+ typedef enum {
+ EVENT_PREV,
+ EVENT_NEXT,
+ EVENT_RESPONSE
+ } TResponseEvent;
+
+ bool weedResponses();
+ bool display();
+ int _spacing;
+ int _scrollOffset;
+ BaseFont *_fontHover;
+ BaseFont *_font;
+ bool createButtons();
+ bool invalidateButtons();
+ void clearButtons();
+ void clearResponses();
+ AdResponseBox(BaseGame *inGame);
+ virtual ~AdResponseBox();
+ BaseArray<AdResponse *> _responses;
+ BaseArray<UIButton *> _respButtons;
+ UIWindow *_window;
+ UIWindow *_shieldWindow;
+ bool _horizontal;
+ Rect32 _responseArea;
+ int _verticalAlign;
+ TTextAlign _align;
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_response_context.cpp b/engines/wintermute/ad/ad_response_context.cpp
new file mode 100644
index 0000000000..ebfa03feea
--- /dev/null
+++ b/engines/wintermute/ad/ad_response_context.cpp
@@ -0,0 +1,71 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_response_context.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdResponseContext, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdResponseContext::AdResponseContext(BaseGame *inGame) : BaseClass(inGame) {
+ _id = 0;
+ _context = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdResponseContext::~AdResponseContext() {
+ delete[] _context;
+ _context = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdResponseContext::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_gameRef));
+ persistMgr->transfer(TMEMBER(_context));
+ persistMgr->transfer(TMEMBER(_id));
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void AdResponseContext::setContext(const char *context) {
+ delete[] _context;
+ _context = NULL;
+ if (context) {
+ _context = new char [strlen(context) + 1];
+ if (_context) {
+ strcpy(_context, context);
+ }
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_response_context.h b/engines/wintermute/ad/ad_response_context.h
new file mode 100644
index 0000000000..14bc1abd93
--- /dev/null
+++ b/engines/wintermute/ad/ad_response_context.h
@@ -0,0 +1,50 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADRESPONSECONTEXT_H
+#define WINTERMUTE_ADRESPONSECONTEXT_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class AdResponseContext : public BaseClass {
+public:
+ void setContext(const char *context);
+ int _id;
+ char *_context;
+ DECLARE_PERSISTENT(AdResponseContext, BaseClass)
+ AdResponseContext(BaseGame *inGame);
+ virtual ~AdResponseContext();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp
new file mode 100644
index 0000000000..fb9a4a47b9
--- /dev/null
+++ b/engines/wintermute/ad/ad_rot_level.cpp
@@ -0,0 +1,161 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_rot_level.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_sprite.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdRotLevel, false)
+
+
+//////////////////////////////////////////////////////////////////////////
+AdRotLevel::AdRotLevel(BaseGame *inGame) : BaseObject(inGame) {
+ _posX = 0;
+ _rotation = 0.0f;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdRotLevel::~AdRotLevel() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRotLevel::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdRotLevel::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing ROTATION_LEVEL file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(ROTATION_LEVEL)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(X)
+TOKEN_DEF(ROTATION)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdRotLevel::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ROTATION_LEVEL)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(ROTATION)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ROTATION_LEVEL) {
+ _gameRef->LOG(0, "'ROTATION_LEVEL' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_ROTATION: {
+ int i;
+ parser.scanStr((char *)params, "%d", &i);
+ _rotation = (float)i;
+ }
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ROTATION_LEVEL definition");
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRotLevel::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "ROTATION_LEVEL {\n");
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "ROTATION=%d\n", (int)_rotation);
+ BaseClass::saveAsText(buffer, indent + 2);
+ buffer->putTextIndent(indent, "}\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdRotLevel::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_rotation));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_rot_level.h b/engines/wintermute/ad/ad_rot_level.h
new file mode 100644
index 0000000000..d7f5f8edf0
--- /dev/null
+++ b/engines/wintermute/ad/ad_rot_level.h
@@ -0,0 +1,49 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADROTLEVEL_H
+#define WINTERMUTE_ADROTLEVEL_H
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class AdRotLevel : public BaseObject {
+public:
+ DECLARE_PERSISTENT(AdRotLevel, BaseObject)
+ AdRotLevel(BaseGame *inGame);
+ virtual ~AdRotLevel();
+ float _rotation;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp
new file mode 100644
index 0000000000..4e9293d875
--- /dev/null
+++ b/engines/wintermute/ad/ad_scale_level.cpp
@@ -0,0 +1,159 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_scale_level.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdScaleLevel, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdScaleLevel::AdScaleLevel(BaseGame *inGame) : BaseObject(inGame) {
+ _posY = 0;
+ _scale = 100;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdScaleLevel::~AdScaleLevel() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScaleLevel::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdScaleLevel::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing SCALE_LEVEL file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(SCALE_LEVEL)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(Y)
+TOKEN_DEF(SCALE)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdScaleLevel::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(SCALE_LEVEL)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(SCALE)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SCALE_LEVEL) {
+ _gameRef->LOG(0, "'SCALE_LEVEL' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_SCALE: {
+ int i;
+ parser.scanStr((char *)params, "%d", &i);
+ _scale = (float)i;
+ }
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in SCALE_LEVEL definition");
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScaleLevel::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "SCALE_LEVEL {\n");
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+ buffer->putTextIndent(indent + 2, "SCALE=%d\n", (int)_scale);
+ BaseClass::saveAsText(buffer, indent + 2);
+ buffer->putTextIndent(indent, "}\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScaleLevel::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_scale));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_scale_level.h b/engines/wintermute/ad/ad_scale_level.h
new file mode 100644
index 0000000000..628a385eb4
--- /dev/null
+++ b/engines/wintermute/ad/ad_scale_level.h
@@ -0,0 +1,50 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADSCALELEVEL_H
+#define WINTERMUTE_ADSCALELEVEL_H
+
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class AdScaleLevel : public BaseObject {
+public:
+ DECLARE_PERSISTENT(AdScaleLevel, BaseObject)
+ float _scale;
+ AdScaleLevel(BaseGame *inGame);
+ virtual ~AdScaleLevel();
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp
new file mode 100644
index 0000000000..8e9beca0c0
--- /dev/null
+++ b/engines/wintermute/ad/ad_scene.cpp
@@ -0,0 +1,2987 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_actor.h"
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_layer.h"
+#include "engines/wintermute/ad/ad_node_state.h"
+#include "engines/wintermute/ad/ad_object.h"
+#include "engines/wintermute/ad/ad_path.h"
+#include "engines/wintermute/ad/ad_path_point.h"
+#include "engines/wintermute/ad/ad_rot_level.h"
+#include "engines/wintermute/ad/ad_scale_level.h"
+#include "engines/wintermute/ad/ad_scene_node.h"
+#include "engines/wintermute/ad/ad_scene_state.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/ad/ad_waypoint_group.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_point.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_scriptable.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/wintermute.h"
+#include <limits.h>
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdScene, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdScene::AdScene(BaseGame *inGame) : BaseObject(inGame) {
+ _pfTarget = new BasePoint;
+ setDefaults();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdScene::~AdScene() {
+ cleanup();
+ _gameRef->unregisterObject(_fader);
+ delete _pfTarget;
+ _pfTarget = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::setDefaults() {
+ _initialized = false;
+ _pfReady = true;
+ _pfTargetPath = NULL;
+ _pfRequester = NULL;
+ _mainLayer = NULL;
+
+ _pfPointsNum = 0;
+ _persistentState = false;
+ _persistentStateSprites = true;
+
+ _autoScroll = true;
+ _offsetLeft = _offsetTop = 0;
+ _targetOffsetLeft = _targetOffsetTop = 0;
+
+ _lastTimeH = _lastTimeV = 0;
+ _scrollTimeH = _scrollTimeV = 10;
+ _scrollPixelsH = _scrollPixelsV = 1;
+
+ _pfMaxTime = 15;
+
+ _paralaxScrolling = true;
+
+ // editor settings
+ _editorMarginH = _editorMarginV = 100;
+
+ _editorColFrame = 0xE0888888;
+ _editorColEntity = 0xFF008000;
+ _editorColRegion = 0xFF0000FF;
+ _editorColBlocked = 0xFF800080;
+ _editorColWaypoints = 0xFF0000FF;
+ _editorColEntitySel = 0xFFFF0000;
+ _editorColRegionSel = 0xFFFF0000;
+ _editorColBlockedSel = 0xFFFF0000;
+ _editorColWaypointsSel = 0xFFFF0000;
+ _editorColScale = 0xFF00FF00;
+ _editorColDecor = 0xFF00FFFF;
+ _editorColDecorSel = 0xFFFF0000;
+
+ _editorShowRegions = true;
+ _editorShowBlocked = true;
+ _editorShowDecor = true;
+ _editorShowEntities = true;
+ _editorShowScale = true;
+
+ _shieldWindow = NULL;
+
+ _fader = new BaseFader(_gameRef);
+ _gameRef->registerObject(_fader);
+
+ _viewport = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::cleanup() {
+ BaseObject::cleanup();
+
+ _mainLayer = NULL; // reference only
+
+ delete _shieldWindow;
+ _shieldWindow = NULL;
+
+ _gameRef->unregisterObject(_fader);
+ _fader = NULL;
+
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ _gameRef->unregisterObject(_layers[i]);
+ }
+ _layers.clear();
+
+
+ for (uint32 i = 0; i < _waypointGroups.size(); i++) {
+ _gameRef->unregisterObject(_waypointGroups[i]);
+ }
+ _waypointGroups.clear();
+
+ for (uint32 i = 0; i < _scaleLevels.size(); i++) {
+ _gameRef->unregisterObject(_scaleLevels[i]);
+ }
+ _scaleLevels.clear();
+
+ for (uint32 i = 0; i < _rotLevels.size(); i++) {
+ _gameRef->unregisterObject(_rotLevels[i]);
+ }
+ _rotLevels.clear();
+
+
+ for (uint32 i = 0; i < _pfPath.size(); i++) {
+ delete _pfPath[i];
+ }
+ _pfPath.clear();
+ _pfPointsNum = 0;
+
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ _gameRef->unregisterObject(_objects[i]);
+ }
+ _objects.clear();
+
+ delete _viewport;
+ _viewport = NULL;
+
+ setDefaults();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::getPath(BasePoint source, BasePoint target, AdPath *path, BaseObject *requester) {
+ if (!_pfReady) {
+ return false;
+ } else {
+ _pfReady = false;
+ *_pfTarget = target;
+ _pfTargetPath = path;
+ _pfRequester = requester;
+
+ _pfTargetPath->reset();
+ _pfTargetPath->setReady(false);
+
+ // prepare working path
+ pfPointsStart();
+
+ // first point
+ //_pfPath.add(new AdPathPoint(source.x, source.y, 0));
+
+ // if we're one pixel stuck, get unstuck
+ int startX = source.x;
+ int startY = source.y;
+ int bestDistance = 1000;
+ if (isBlockedAt(startX, startY, true, requester)) {
+ int tolerance = 2;
+ for (int xxx = startX - tolerance; xxx <= startX + tolerance; xxx++) {
+ for (int yyy = startY - tolerance; yyy <= startY + tolerance; yyy++) {
+ if (isWalkableAt(xxx, yyy, true, requester)) {
+ int distance = abs(xxx - source.x) + abs(yyy - source.y);
+ if (distance < bestDistance) {
+ startX = xxx;
+ startY = yyy;
+
+ bestDistance = distance;
+ }
+ }
+ }
+ }
+ }
+
+ pfPointsAdd(startX, startY, 0);
+
+ //CorrectTargetPoint(&target.x, &target.y);
+
+ // last point
+ //_pfPath.add(new AdPathPoint(target.x, target.y, INT_MAX));
+ pfPointsAdd(target.x, target.y, INT_MAX);
+
+ // active waypoints
+ for (uint32 i = 0; i < _waypointGroups.size(); i++) {
+ if (_waypointGroups[i]->_active) {
+ pfAddWaypointGroup(_waypointGroups[i], requester);
+ }
+ }
+
+
+ // free waypoints
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_active && _objects[i] != requester && _objects[i]->_currentWptGroup) {
+ pfAddWaypointGroup(_objects[i]->_currentWptGroup, requester);
+ }
+ }
+ AdGame *adGame = (AdGame *)_gameRef;
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ if (adGame->_objects[i]->_active && adGame->_objects[i] != requester && adGame->_objects[i]->_currentWptGroup) {
+ pfAddWaypointGroup(adGame->_objects[i]->_currentWptGroup, requester);
+ }
+ }
+
+ return true;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::pfAddWaypointGroup(AdWaypointGroup *wpt, BaseObject *requester) {
+ if (!wpt->_active) {
+ return;
+ }
+
+ for (uint32 i = 0; i < wpt->_points.size(); i++) {
+ if (isBlockedAt(wpt->_points[i]->x, wpt->_points[i]->y, true, requester)) {
+ continue;
+ }
+
+ //_pfPath.add(new AdPathPoint(Wpt->_points[i]->x, Wpt->_points[i]->y, INT_MAX));
+ pfPointsAdd(wpt->_points[i]->x, wpt->_points[i]->y, INT_MAX);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float AdScene::getZoomAt(int x, int y) {
+ float ret = 100;
+
+ bool found = false;
+ if (_mainLayer) {
+ for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) {
+ AdSceneNode *node = _mainLayer->_nodes[i];
+ if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_blocked && node->_region->pointInRegion(x, y)) {
+ if (node->_region->_zoom != 0) {
+ ret = node->_region->_zoom;
+ found = true;
+ break;
+ }
+ }
+ }
+ }
+ if (!found) {
+ ret = getScaleAt(y);
+ }
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 AdScene::getAlphaAt(int x, int y, bool colorCheck) {
+ if (!_gameRef->_debugDebugMode) {
+ colorCheck = false;
+ }
+
+ uint32 ret;
+ if (colorCheck) {
+ ret = 0xFFFF0000;
+ } else {
+ ret = 0xFFFFFFFF;
+ }
+
+ if (_mainLayer) {
+ for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) {
+ AdSceneNode *node = _mainLayer->_nodes[i];
+ if (node->_type == OBJECT_REGION && node->_region->_active && (colorCheck || !node->_region->_blocked) && node->_region->pointInRegion(x, y)) {
+ if (!node->_region->_blocked) {
+ ret = node->_region->_alpha;
+ }
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::isBlockedAt(int x, int y, bool checkFreeObjects, BaseObject *requester) {
+ bool ret = true;
+
+ if (checkFreeObjects) {
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_active && _objects[i] != requester && _objects[i]->_currentBlockRegion) {
+ if (_objects[i]->_currentBlockRegion->pointInRegion(x, y)) {
+ return true;
+ }
+ }
+ }
+ AdGame *adGame = (AdGame *)_gameRef;
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ if (adGame->_objects[i]->_active && adGame->_objects[i] != requester && adGame->_objects[i]->_currentBlockRegion) {
+ if (adGame->_objects[i]->_currentBlockRegion->pointInRegion(x, y)) {
+ return true;
+ }
+ }
+ }
+ }
+
+
+ if (_mainLayer) {
+ for (uint32 i = 0; i < _mainLayer->_nodes.size(); i++) {
+ AdSceneNode *node = _mainLayer->_nodes[i];
+ /*
+ if (Node->_type == OBJECT_REGION && Node->_region->_active && Node->_region->_blocked && Node->_region->PointInRegion(X, Y))
+ {
+ ret = true;
+ break;
+ }
+ */
+ if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_decoration && node->_region->pointInRegion(x, y)) {
+ if (node->_region->_blocked) {
+ ret = true;
+ break;
+ } else {
+ ret = false;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::isWalkableAt(int x, int y, bool checkFreeObjects, BaseObject *requester) {
+ bool ret = false;
+
+ if (checkFreeObjects) {
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_active && _objects[i] != requester && _objects[i]->_currentBlockRegion) {
+ if (_objects[i]->_currentBlockRegion->pointInRegion(x, y)) {
+ return false;
+ }
+ }
+ }
+ AdGame *adGame = (AdGame *)_gameRef;
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ if (adGame->_objects[i]->_active && adGame->_objects[i] != requester && adGame->_objects[i]->_currentBlockRegion) {
+ if (adGame->_objects[i]->_currentBlockRegion->pointInRegion(x, y)) {
+ return false;
+ }
+ }
+ }
+ }
+
+
+ if (_mainLayer) {
+ for (uint32 i = 0; i < _mainLayer->_nodes.size(); i++) {
+ AdSceneNode *node = _mainLayer->_nodes[i];
+ if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_decoration && node->_region->pointInRegion(x, y)) {
+ if (node->_region->_blocked) {
+ ret = false;
+ break;
+ } else {
+ ret = true;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int AdScene::getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester) {
+ double xStep, yStep, x, y;
+ int xLength, yLength, xCount, yCount;
+ int x1, y1, x2, y2;
+
+ x1 = p1.x;
+ y1 = p1.y;
+ x2 = p2.x;
+ y2 = p2.y;
+
+ xLength = abs(x2 - x1);
+ yLength = abs(y2 - y1);
+
+ if (xLength > yLength) {
+ if (x1 > x2) {
+ BaseUtils::swap(&x1, &x2);
+ BaseUtils::swap(&y1, &y2);
+ }
+
+ yStep = (double)(y2 - y1) / (double)(x2 - x1);
+ y = y1;
+
+ for (xCount = x1; xCount < x2; xCount++) {
+ if (isBlockedAt(xCount, (int)y, true, requester)) {
+ return -1;
+ }
+ y += yStep;
+ }
+ } else {
+ if (y1 > y2) {
+ BaseUtils::swap(&x1, &x2);
+ BaseUtils::swap(&y1, &y2);
+ }
+
+ xStep = (double)(x2 - x1) / (double)(y2 - y1);
+ x = x1;
+
+ for (yCount = y1; yCount < y2; yCount++) {
+ if (isBlockedAt((int)x, yCount, true, requester)) {
+ return -1;
+ }
+ x += xStep;
+ }
+ }
+ return MAX(xLength, yLength);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::pathFinderStep() {
+ int i;
+ // get lowest unmarked
+ int lowestDist = INT_MAX;
+ AdPathPoint *lowestPt = NULL;
+
+ for (i = 0; i < _pfPointsNum; i++)
+ if (!_pfPath[i]->_marked && _pfPath[i]->_distance < lowestDist) {
+ lowestDist = _pfPath[i]->_distance;
+ lowestPt = _pfPath[i];
+ }
+
+ if (lowestPt == NULL) { // no path -> terminate PathFinder
+ _pfReady = true;
+ _pfTargetPath->setReady(true);
+ return;
+ }
+
+ lowestPt->_marked = true;
+
+ // target point marked, generate path and terminate
+ if (lowestPt->x == _pfTarget->x && lowestPt->y == _pfTarget->y) {
+ while (lowestPt != NULL) {
+ _pfTargetPath->_points.insert_at(0, new BasePoint(lowestPt->x, lowestPt->y));
+ lowestPt = lowestPt->_origin;
+ }
+
+ _pfReady = true;
+ _pfTargetPath->setReady(true);
+ return;
+ }
+
+ // otherwise keep on searching
+ for (i = 0; i < _pfPointsNum; i++)
+ if (!_pfPath[i]->_marked) {
+ int j = getPointsDist(*lowestPt, *_pfPath[i], _pfRequester);
+ if (j != -1 && lowestPt->_distance + j < _pfPath[i]->_distance) {
+ _pfPath[i]->_distance = lowestPt->_distance + j;
+ _pfPath[i]->_origin = lowestPt;
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::initLoop() {
+#ifdef _DEBUGxxxx
+ int nu_steps = 0;
+ uint32 start = _gameRef->_currentTime;
+ while (!_pfReady && g_system->getMillis() - start <= _pfMaxTime) {
+ PathFinderStep();
+ nu_steps++;
+ }
+ if (nu_steps > 0) {
+ _gameRef->LOG(0, "STAT: PathFinder iterations in one loop: %d (%s) _pfMaxTime=%d", nu_steps, _pfReady ? "finished" : "not yet done", _pfMaxTime);
+ }
+#else
+ uint32 start = _gameRef->_currentTime;
+ while (!_pfReady && g_system->getMillis() - start <= _pfMaxTime) {
+ pathFinderStep();
+ }
+#endif
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdScene::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing SCENE file '%s'", filename);
+ }
+
+ setFilename(filename);
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(SCENE)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(LAYER)
+TOKEN_DEF(WAYPOINTS)
+TOKEN_DEF(EVENTS)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(CAMERA)
+TOKEN_DEF(ENTITY)
+TOKEN_DEF(SCALE_LEVEL)
+TOKEN_DEF(ROTATION_LEVEL)
+TOKEN_DEF(EDITOR_MARGIN_H)
+TOKEN_DEF(EDITOR_MARGIN_V)
+TOKEN_DEF(EDITOR_COLOR_FRAME)
+TOKEN_DEF(EDITOR_COLOR_ENTITY_SEL)
+TOKEN_DEF(EDITOR_COLOR_REGION_SEL)
+TOKEN_DEF(EDITOR_COLOR_DECORATION_SEL)
+TOKEN_DEF(EDITOR_COLOR_BLOCKED_SEL)
+TOKEN_DEF(EDITOR_COLOR_WAYPOINTS_SEL)
+TOKEN_DEF(EDITOR_COLOR_REGION)
+TOKEN_DEF(EDITOR_COLOR_DECORATION)
+TOKEN_DEF(EDITOR_COLOR_BLOCKED)
+TOKEN_DEF(EDITOR_COLOR_ENTITY)
+TOKEN_DEF(EDITOR_COLOR_WAYPOINTS)
+TOKEN_DEF(EDITOR_COLOR_SCALE)
+TOKEN_DEF(EDITOR_SHOW_REGIONS)
+TOKEN_DEF(EDITOR_SHOW_BLOCKED)
+TOKEN_DEF(EDITOR_SHOW_DECORATION)
+TOKEN_DEF(EDITOR_SHOW_ENTITIES)
+TOKEN_DEF(EDITOR_SHOW_SCALE)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(VIEWPORT)
+TOKEN_DEF(PERSISTENT_STATE_SPRITES)
+TOKEN_DEF(PERSISTENT_STATE)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(SCENE)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(LAYER)
+ TOKEN_TABLE(WAYPOINTS)
+ TOKEN_TABLE(EVENTS)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(CAMERA)
+ TOKEN_TABLE(ENTITY)
+ TOKEN_TABLE(SCALE_LEVEL)
+ TOKEN_TABLE(ROTATION_LEVEL)
+ TOKEN_TABLE(EDITOR_MARGIN_H)
+ TOKEN_TABLE(EDITOR_MARGIN_V)
+ TOKEN_TABLE(EDITOR_COLOR_FRAME)
+ TOKEN_TABLE(EDITOR_COLOR_ENTITY_SEL)
+ TOKEN_TABLE(EDITOR_COLOR_REGION_SEL)
+ TOKEN_TABLE(EDITOR_COLOR_DECORATION_SEL)
+ TOKEN_TABLE(EDITOR_COLOR_BLOCKED_SEL)
+ TOKEN_TABLE(EDITOR_COLOR_WAYPOINTS_SEL)
+ TOKEN_TABLE(EDITOR_COLOR_REGION)
+ TOKEN_TABLE(EDITOR_COLOR_DECORATION)
+ TOKEN_TABLE(EDITOR_COLOR_BLOCKED)
+ TOKEN_TABLE(EDITOR_COLOR_ENTITY)
+ TOKEN_TABLE(EDITOR_COLOR_WAYPOINTS)
+ TOKEN_TABLE(EDITOR_COLOR_SCALE)
+ TOKEN_TABLE(EDITOR_SHOW_REGIONS)
+ TOKEN_TABLE(EDITOR_SHOW_DECORATION)
+ TOKEN_TABLE(EDITOR_SHOW_BLOCKED)
+ TOKEN_TABLE(EDITOR_SHOW_ENTITIES)
+ TOKEN_TABLE(EDITOR_SHOW_SCALE)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(VIEWPORT)
+ TOKEN_TABLE(PERSISTENT_STATE_SPRITES)
+ TOKEN_TABLE(PERSISTENT_STATE)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ cleanup();
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SCENE) {
+ _gameRef->LOG(0, "'SCENE' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ int ar, ag, ab, aa;
+ char camera[MAX_PATH_LENGTH] = "";
+ /* float waypointHeight = -1.0f; */
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_LAYER: {
+ AdLayer *layer = new AdLayer(_gameRef);
+ if (!layer || DID_FAIL(layer->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete layer;
+ layer = NULL;
+ } else {
+ _gameRef->registerObject(layer);
+ _layers.add(layer);
+ if (layer->_main) {
+ _mainLayer = layer;
+ _width = layer->_width;
+ _height = layer->_height;
+ }
+ }
+ }
+ break;
+
+ case TOKEN_WAYPOINTS: {
+ AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef);
+ if (!wpt || DID_FAIL(wpt->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete wpt;
+ wpt = NULL;
+ } else {
+ _gameRef->registerObject(wpt);
+ _waypointGroups.add(wpt);
+ }
+ }
+ break;
+
+ case TOKEN_SCALE_LEVEL: {
+ AdScaleLevel *sl = new AdScaleLevel(_gameRef);
+ if (!sl || DID_FAIL(sl->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete sl;
+ sl = NULL;
+ } else {
+ _gameRef->registerObject(sl);
+ _scaleLevels.add(sl);
+ }
+ }
+ break;
+
+ case TOKEN_ROTATION_LEVEL: {
+ AdRotLevel *rl = new AdRotLevel(_gameRef);
+ if (!rl || DID_FAIL(rl->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete rl;
+ rl = NULL;
+ } else {
+ _gameRef->registerObject(rl);
+ _rotLevels.add(rl);
+ }
+ }
+ break;
+
+ case TOKEN_ENTITY: {
+ AdEntity *entity = new AdEntity(_gameRef);
+ if (!entity || DID_FAIL(entity->loadBuffer(params, false))) {
+ cmd = PARSERR_GENERIC;
+ delete entity;
+ entity = NULL;
+ } else {
+ addObject(entity);
+ }
+ }
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_CAMERA:
+ strcpy(camera, (char *)params);
+ break;
+
+ case TOKEN_EDITOR_MARGIN_H:
+ parser.scanStr((char *)params, "%d", &_editorMarginH);
+ break;
+
+ case TOKEN_EDITOR_MARGIN_V:
+ parser.scanStr((char *)params, "%d", &_editorMarginV);
+ break;
+
+ case TOKEN_EDITOR_COLOR_FRAME:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColFrame = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_ENTITY:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColEntity = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_ENTITY_SEL:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColEntitySel = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_REGION_SEL:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColRegionSel = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_DECORATION_SEL:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColDecorSel = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_BLOCKED_SEL:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColBlockedSel = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_WAYPOINTS_SEL:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColWaypointsSel = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_REGION:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColRegion = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_DECORATION:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColDecor = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_BLOCKED:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColBlocked = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_WAYPOINTS:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColWaypoints = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_COLOR_SCALE:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
+ _editorColScale = BYTETORGBA(ar, ag, ab, aa);
+ break;
+
+ case TOKEN_EDITOR_SHOW_REGIONS:
+ parser.scanStr((char *)params, "%b", &_editorShowRegions);
+ break;
+
+ case TOKEN_EDITOR_SHOW_BLOCKED:
+ parser.scanStr((char *)params, "%b", &_editorShowBlocked);
+ break;
+
+ case TOKEN_EDITOR_SHOW_DECORATION:
+ parser.scanStr((char *)params, "%b", &_editorShowDecor);
+ break;
+
+ case TOKEN_EDITOR_SHOW_ENTITIES:
+ parser.scanStr((char *)params, "%b", &_editorShowEntities);
+ break;
+
+ case TOKEN_EDITOR_SHOW_SCALE:
+ parser.scanStr((char *)params, "%b", &_editorShowScale);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_VIEWPORT: {
+ Rect32 rc;
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom);
+ if (!_viewport) {
+ _viewport = new BaseViewport(_gameRef);
+ }
+ if (_viewport) {
+ _viewport->setRect(rc.left, rc.top, rc.right, rc.bottom, true);
+ }
+ }
+
+ case TOKEN_PERSISTENT_STATE:
+ parser.scanStr((char *)params, "%b", &_persistentState);
+ break;
+
+ case TOKEN_PERSISTENT_STATE_SPRITES:
+ parser.scanStr((char *)params, "%b", &_persistentStateSprites);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in SCENE definition");
+ return STATUS_FAILED;
+ }
+
+ if (_mainLayer == NULL) {
+ _gameRef->LOG(0, "Warning: scene '%s' has no main layer.", getFilename());
+ }
+
+
+ sortScaleLevels();
+ sortRotLevels();
+
+ _initialized = true;
+
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::traverseNodes(bool doUpdate) {
+ if (!_initialized) {
+ return STATUS_OK;
+ }
+
+ AdGame *adGame = (AdGame *)_gameRef;
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // prepare viewport
+ bool popViewport = false;
+ if (_viewport && !_gameRef->_editorMode) {
+ _gameRef->pushViewport(_viewport);
+ popViewport = true;
+ } else if (adGame->_sceneViewport && !_gameRef->_editorMode) {
+ _gameRef->pushViewport(adGame->_sceneViewport);
+ popViewport = true;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // *** adjust scroll offset
+ if (doUpdate) {
+ /*
+ if (_autoScroll && _gameRef->_mainObject != NULL)
+ {
+ ScrollToObject(_gameRef->_mainObject);
+ }
+ */
+
+ if (_autoScroll) {
+ // adjust horizontal scroll
+ if (_gameRef->_timer - _lastTimeH >= _scrollTimeH) {
+ _lastTimeH = _gameRef->_timer;
+ if (_offsetLeft < _targetOffsetLeft) {
+ _offsetLeft += _scrollPixelsH;
+ _offsetLeft = MIN(_offsetLeft, _targetOffsetLeft);
+ } else if (_offsetLeft > _targetOffsetLeft) {
+ _offsetLeft -= _scrollPixelsH;
+ _offsetLeft = MAX(_offsetLeft, _targetOffsetLeft);
+ }
+ }
+
+ // adjust vertical scroll
+ if (_gameRef->_timer - _lastTimeV >= _scrollTimeV) {
+ _lastTimeV = _gameRef->_timer;
+ if (_offsetTop < _targetOffsetTop) {
+ _offsetTop += _scrollPixelsV;
+ _offsetTop = MIN(_offsetTop, _targetOffsetTop);
+ } else if (_offsetTop > _targetOffsetTop) {
+ _offsetTop -= _scrollPixelsV;
+ _offsetTop = MAX(_offsetTop, _targetOffsetTop);
+ }
+ }
+
+ if (_offsetTop == _targetOffsetTop && _offsetLeft == _targetOffsetLeft) {
+ _ready = true;
+ }
+ } else {
+ _ready = true; // not scrolling, i.e. always ready
+ }
+ }
+
+
+
+
+ //////////////////////////////////////////////////////////////////////////
+ int viewportWidth, viewportHeight;
+ getViewportSize(&viewportWidth, &viewportHeight);
+
+ int viewportX, viewportY;
+ getViewportOffset(&viewportX, &viewportY);
+
+ int scrollableX = _width - viewportWidth;
+ int scrollableY = _height - viewportHeight;
+
+ double widthRatio = scrollableX <= 0 ? 0 : ((double)(_offsetLeft) / (double)scrollableX);
+ double heightRatio = scrollableY <= 0 ? 0 : ((double)(_offsetTop) / (double)scrollableY);
+
+ int origX, origY;
+ _gameRef->getOffset(&origX, &origY);
+
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // *** display/update everything
+ _gameRef->_renderer->setup2D();
+
+ // for each layer
+ /* int mainOffsetX = 0; */
+ /* int mainOffsetY = 0; */
+
+ for (uint32 j = 0; j < _layers.size(); j++) {
+ if (!_layers[j]->_active) {
+ continue;
+ }
+
+ // make layer exclusive
+ if (!doUpdate) {
+ if (_layers[j]->_closeUp && !_gameRef->_editorMode) {
+ if (!_shieldWindow) {
+ _shieldWindow = new UIWindow(_gameRef);
+ }
+ if (_shieldWindow) {
+ _shieldWindow->_posX = _shieldWindow->_posY = 0;
+ _shieldWindow->_width = _gameRef->_renderer->_width;
+ _shieldWindow->_height = _gameRef->_renderer->_height;
+ _shieldWindow->display();
+ }
+ }
+ }
+
+ if (_paralaxScrolling) {
+ int offsetX = (int)(widthRatio * (_layers[j]->_width - viewportWidth) - viewportX);
+ int offsetY = (int)(heightRatio * (_layers[j]->_height - viewportHeight) - viewportY);
+ _gameRef->setOffset(offsetX, offsetY);
+
+ _gameRef->_offsetPercentX = (float)offsetX / ((float)_layers[j]->_width - viewportWidth) * 100.0f;
+ _gameRef->_offsetPercentY = (float)offsetY / ((float)_layers[j]->_height - viewportHeight) * 100.0f;
+
+ //_gameRef->QuickMessageForm("%d %f", OffsetX+ViewportX, _gameRef->_offsetPercentX);
+ } else {
+ _gameRef->setOffset(_offsetLeft - viewportX, _offsetTop - viewportY);
+
+ _gameRef->_offsetPercentX = (float)(_offsetLeft - viewportX) / ((float)_layers[j]->_width - viewportWidth) * 100.0f;
+ _gameRef->_offsetPercentY = (float)(_offsetTop - viewportY) / ((float)_layers[j]->_height - viewportHeight) * 100.0f;
+ }
+
+
+ // for each node
+ for (uint32 k = 0; k < _layers[j]->_nodes.size(); k++) {
+ AdSceneNode *node = _layers[j]->_nodes[k];
+ switch (node->_type) {
+ case OBJECT_ENTITY:
+ if (node->_entity->_active && (_gameRef->_editorMode || !node->_entity->_editorOnly)) {
+ _gameRef->_renderer->setup2D();
+
+ if (doUpdate) {
+ node->_entity->update();
+ } else {
+ node->_entity->display();
+ }
+ }
+ break;
+
+ case OBJECT_REGION: {
+ if (node->_region->_blocked) {
+ break;
+ }
+ if (node->_region->_decoration) {
+ break;
+ }
+
+ if (!doUpdate) {
+ displayRegionContent(node->_region);
+ }
+ }
+ break;
+ default:
+ error("AdScene::TraverseNodes - Unhandled enum");
+ break;
+ } // switch
+ } // each node
+
+ // display/update all objects which are off-regions
+ if (_layers[j]->_main) {
+ if (doUpdate) {
+ updateFreeObjects();
+ } else {
+ displayRegionContent(NULL);
+ }
+ }
+ } // each layer
+
+
+ // restore state
+ _gameRef->setOffset(origX, origY);
+ _gameRef->_renderer->setup2D();
+
+ // display/update fader
+ if (_fader) {
+ if (doUpdate) {
+ _fader->update();
+ } else {
+ _fader->display();
+ }
+ }
+
+ if (popViewport) {
+ _gameRef->popViewport();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::display() {
+ return traverseNodes(false);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::updateFreeObjects() {
+ AdGame *adGame = (AdGame *)_gameRef;
+ // 3D-code removed
+ // bool is3DSet;
+
+ // *** update all active objects
+ // is3DSet = false;
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ if (!adGame->_objects[i]->_active) {
+ continue;
+ }
+ // 3D-code removed
+ adGame->_objects[i]->update();
+ adGame->_objects[i]->_drawn = false;
+ }
+
+
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (!_objects[i]->_active) {
+ continue;
+ }
+
+ _objects[i]->update();
+ _objects[i]->_drawn = false;
+ }
+
+
+ if (_autoScroll && _gameRef->_mainObject != NULL) {
+ scrollToObject(_gameRef->_mainObject);
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::displayRegionContent(AdRegion *region, bool display3DOnly) {
+ AdGame *adGame = (AdGame *)_gameRef;
+ BaseArray<AdObject *> objects;
+ AdObject *obj;
+
+ // global objects
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ obj = adGame->_objects[i];
+ if (obj->_active && !obj->_drawn && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) {
+ objects.add(obj);
+ }
+ }
+
+ // scene objects
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ obj = _objects[i];
+ if (obj->_active && !obj->_editorOnly && !obj->_drawn && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) {
+ objects.add(obj);
+ }
+ }
+
+ // sort by _posY
+ Common::sort(objects.begin(), objects.end(), AdScene::compareObjs);
+
+ // display them
+ for (uint32 i = 0; i < objects.size(); i++) {
+ obj = objects[i];
+
+ if (display3DOnly && !obj->_is3D) {
+ continue;
+ }
+
+ _gameRef->_renderer->setup2D();
+
+ if (_gameRef->_editorMode || !obj->_editorOnly) {
+ obj->display();
+ }
+ obj->_drawn = true;
+ }
+
+
+ // display design only objects
+ if (!display3DOnly) {
+ if (_gameRef->_editorMode && region == NULL) {
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_active && _objects[i]->_editorOnly) {
+ _objects[i]->display();
+ _objects[i]->_drawn = true;
+ }
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int AdScene::compareObjs(const void *obj1, const void *obj2) {
+ const AdObject *object1 = *(const AdObject *const *)obj1;
+ const AdObject *object2 = *(const AdObject *const *)obj2;
+
+ if (object1->_posY < object2->_posY) {
+ return -1;
+ } else if (object1->_posY > object2->_posY) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::displayRegionContentOld(AdRegion *region) {
+ AdGame *adGame = (AdGame *)_gameRef;
+ AdObject *obj;
+
+ // display all objects in region sorted by _posY
+ do {
+ obj = NULL;
+ int minY = INT_MAX;
+
+ // global objects
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ if (adGame->_objects[i]->_active && !adGame->_objects[i]->_drawn && adGame->_objects[i]->_posY < minY && (adGame->_objects[i]->_stickRegion == region || region == NULL || (adGame->_objects[i]->_stickRegion == NULL && region->pointInRegion(adGame->_objects[i]->_posX, adGame->_objects[i]->_posY)))) {
+ obj = adGame->_objects[i];
+ minY = adGame->_objects[i]->_posY;
+ }
+ }
+
+ // scene objects
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_active && !_objects[i]->_editorOnly && !_objects[i]->_drawn && _objects[i]->_posY < minY && (_objects[i]->_stickRegion == region || region == NULL || (_objects[i]->_stickRegion == NULL && region->pointInRegion(_objects[i]->_posX, _objects[i]->_posY)))) {
+ obj = _objects[i];
+ minY = _objects[i]->_posY;
+ }
+ }
+
+
+ if (obj != NULL) {
+ _gameRef->_renderer->setup2D();
+
+ if (_gameRef->_editorMode || !obj->_editorOnly) {
+ obj->display();
+ }
+ obj->_drawn = true;
+ }
+ } while (obj != NULL);
+
+
+ // design only objects
+ if (_gameRef->_editorMode && region == NULL) {
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_active && _objects[i]->_editorOnly) {
+ _objects[i]->display();
+ _objects[i]->_drawn = true;
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::update() {
+ return traverseNodes(true);
+}
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::scrollTo(int offsetX, int offsetY) {
+ int viewportWidth, viewportHeight;
+ getViewportSize(&viewportWidth, &viewportHeight);
+
+ int origOffsetLeft = _targetOffsetLeft;
+ int origOffsetTop = _targetOffsetTop;
+
+ _targetOffsetLeft = MAX(0, offsetX - viewportWidth / 2);
+ _targetOffsetLeft = MIN(_targetOffsetLeft, _width - viewportWidth);
+
+ _targetOffsetTop = MAX(0, offsetY - viewportHeight / 2);
+ _targetOffsetTop = MIN(_targetOffsetTop, _height - viewportHeight);
+
+
+ if (_gameRef->_mainObject && _gameRef->_mainObject->_is3D) {
+ if (abs(origOffsetLeft - _targetOffsetLeft) < 5) {
+ _targetOffsetLeft = origOffsetLeft;
+ }
+ if (abs(origOffsetTop - _targetOffsetTop) < 5) {
+ _targetOffsetTop = origOffsetTop;
+ }
+ //_targetOffsetTop = 0;
+ }
+
+ _ready = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::scrollToObject(BaseObject *object) {
+ if (object) {
+ scrollTo(object->_posX, object->_posY - object->getHeight() / 2);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::skipToObject(BaseObject *object) {
+ if (object) {
+ skipTo(object->_posX, object->_posY - object->getHeight() / 2);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::skipTo(int offsetX, int offsetY) {
+ int viewportWidth, viewportHeight;
+ getViewportSize(&viewportWidth, &viewportHeight);
+
+ _offsetLeft = MAX(0, offsetX - viewportWidth / 2);
+ _offsetLeft = MIN(_offsetLeft, _width - viewportWidth);
+
+ _offsetTop = MAX(0, offsetY - viewportHeight / 2);
+ _offsetTop = MIN(_offsetTop, _height - viewportHeight);
+
+ _targetOffsetLeft = _offsetLeft;
+ _targetOffsetTop = _offsetTop;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // LoadActor
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "LoadActor") == 0) {
+ stack->correctParams(1);
+ AdActor *act = new AdActor(_gameRef);
+ if (act && DID_SUCCEED(act->loadFile(stack->pop()->getString()))) {
+ addObject(act);
+ stack->pushNative(act, true);
+ } else {
+ delete act;
+ act = NULL;
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadEntity") == 0) {
+ stack->correctParams(1);
+ AdEntity *ent = new AdEntity(_gameRef);
+ if (ent && DID_SUCCEED(ent->loadFile(stack->pop()->getString()))) {
+ addObject(ent);
+ stack->pushNative(ent, true);
+ } else {
+ delete ent;
+ ent = NULL;
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateEntity") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdEntity *ent = new AdEntity(_gameRef);
+ addObject(ent);
+ if (!val->isNULL()) {
+ ent->setName(val->getString());
+ }
+ stack->pushNative(ent, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // UnloadObject / UnloadActor / UnloadEntity / UnloadActor3D / DeleteEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "UnloadObject") == 0 || strcmp(name, "UnloadActor") == 0 || strcmp(name, "UnloadEntity") == 0 || strcmp(name, "UnloadActor3D") == 0 || strcmp(name, "DeleteEntity") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ AdObject *obj = (AdObject *)val->getNative();
+ removeObject(obj);
+ if (val->getType() == VAL_VARIABLE_REF) {
+ val->setNULL();
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SkipTo
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SkipTo") == 0) {
+ stack->correctParams(2);
+ ScValue *val1 = stack->pop();
+ ScValue *val2 = stack->pop();
+ if (val1->isNative()) {
+ skipToObject((BaseObject *)val1->getNative());
+ } else {
+ skipTo(val1->getInt(), val2->getInt());
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollTo / ScrollToAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScrollTo") == 0 || strcmp(name, "ScrollToAsync") == 0) {
+ stack->correctParams(2);
+ ScValue *val1 = stack->pop();
+ ScValue *val2 = stack->pop();
+ if (val1->isNative()) {
+ scrollToObject((BaseObject *)val1->getNative());
+ } else {
+ scrollTo(val1->getInt(), val2->getInt());
+ }
+ if (strcmp(name, "ScrollTo") == 0) {
+ script->waitForExclusive(this);
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetLayer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetLayer") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ if (val->isInt()) {
+ int layer = val->getInt();
+ if (layer < 0 || layer >= (int32)_layers.size()) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_layers[layer], true);
+ }
+ } else {
+ const char *layerName = val->getString();
+ bool layerFound = false;
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ if (scumm_stricmp(layerName, _layers[i]->getName()) == 0) {
+ stack->pushNative(_layers[i], true);
+ layerFound = true;
+ break;
+ }
+ }
+ if (!layerFound) {
+ stack->pushNULL();
+ }
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetWaypointGroup
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetWaypointGroup") == 0) {
+ stack->correctParams(1);
+ int group = stack->pop()->getInt();
+ if (group < 0 || group >= (int32)_waypointGroups.size()) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_waypointGroups[group], true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetNode
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetNode") == 0) {
+ stack->correctParams(1);
+ const char *nodeName = stack->pop()->getString();
+
+ BaseObject *node = getNodeByName(nodeName);
+ if (node) {
+ stack->pushNative((BaseScriptable *)node, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFreeNode
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFreeNode") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdObject *ret = NULL;
+ if (val->isInt()) {
+ int index = val->getInt();
+ if (index >= 0 && index < (int32)_objects.size()) {
+ ret = _objects[index];
+ }
+ } else {
+ const char *nodeName = val->getString();
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i] && _objects[i]->getName() && scumm_stricmp(_objects[i]->getName(), nodeName) == 0) {
+ ret = _objects[i];
+ break;
+ }
+ }
+ }
+ if (ret) {
+ stack->pushNative(ret, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetRegionAt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetRegionAt") == 0) {
+ stack->correctParams(3);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ ScValue *val = stack->pop();
+
+ bool includeDecors = false;
+ if (!val->isNULL()) {
+ includeDecors = val->getBool();
+ }
+
+ if (_mainLayer) {
+ for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) {
+ AdSceneNode *node = _mainLayer->_nodes[i];
+ if (node->_type == OBJECT_REGION && node->_region->_active && node->_region->pointInRegion(x, y)) {
+ if (node->_region->_decoration && !includeDecors) {
+ continue;
+ }
+
+ stack->pushNative(node->_region, true);
+ return STATUS_OK;
+ }
+ }
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsBlockedAt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsBlockedAt") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ stack->pushBool(isBlockedAt(x, y));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsWalkableAt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsWalkableAt") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ stack->pushBool(isWalkableAt(x, y));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetScaleAt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetScaleAt") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ stack->pushFloat(getZoomAt(x, y));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetRotationAt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetRotationAt") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ stack->pushFloat(getRotationAt(x, y));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsScrolling
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsScrolling") == 0) {
+ stack->correctParams(0);
+ bool ret = false;
+ if (_autoScroll) {
+ if (_targetOffsetLeft != _offsetLeft || _targetOffsetTop != _offsetTop) {
+ ret = true;
+ }
+ }
+
+ stack->pushBool(ret);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeOut / FadeOutAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeOut") == 0 || strcmp(name, "FadeOutAsync") == 0) {
+ stack->correctParams(5);
+ uint32 duration = stack->pop()->getInt(500);
+ byte red = stack->pop()->getInt(0);
+ byte green = stack->pop()->getInt(0);
+ byte blue = stack->pop()->getInt(0);
+ byte alpha = stack->pop()->getInt(0xFF);
+
+ _fader->fadeOut(BYTETORGBA(red, green, blue, alpha), duration);
+ if (strcmp(name, "FadeOutAsync") != 0) {
+ script->waitFor(_fader);
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeIn / FadeInAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeIn") == 0 || strcmp(name, "FadeInAsync") == 0) {
+ stack->correctParams(5);
+ uint32 duration = stack->pop()->getInt(500);
+ byte red = stack->pop()->getInt(0);
+ byte green = stack->pop()->getInt(0);
+ byte blue = stack->pop()->getInt(0);
+ byte alpha = stack->pop()->getInt(0xFF);
+
+ _fader->fadeIn(BYTETORGBA(red, green, blue, alpha), duration);
+ if (strcmp(name, "FadeInAsync") != 0) {
+ script->waitFor(_fader);
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFadeColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFadeColor") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_fader->getCurrentColor());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsPointInViewport
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsPointInViewport") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ stack->pushBool(pointInViewport(x, y));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetViewport
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetViewport") == 0) {
+ stack->correctParams(4);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ int width = stack->pop()->getInt();
+ int height = stack->pop()->getInt();
+
+ if (width <= 0) {
+ width = _gameRef->_renderer->_width;
+ }
+ if (height <= 0) {
+ height = _gameRef->_renderer->_height;
+ }
+
+ if (!_viewport) {
+ _viewport = new BaseViewport(_gameRef);
+ }
+ if (_viewport) {
+ _viewport->setRect(x, y, x + width, y + height);
+ }
+
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddLayer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddLayer") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdLayer *layer = new AdLayer(_gameRef);
+ if (!val->isNULL()) {
+ layer->setName(val->getString());
+ }
+ if (_mainLayer) {
+ layer->_width = _mainLayer->_width;
+ layer->_height = _mainLayer->_height;
+ }
+ _layers.add(layer);
+ _gameRef->registerObject(layer);
+
+ stack->pushNative(layer, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InsertLayer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InsertLayer") == 0) {
+ stack->correctParams(2);
+ int index = stack->pop()->getInt();
+ ScValue *val = stack->pop();
+
+ AdLayer *layer = new AdLayer(_gameRef);
+ if (!val->isNULL()) {
+ layer->setName(val->getString());
+ }
+ if (_mainLayer) {
+ layer->_width = _mainLayer->_width;
+ layer->_height = _mainLayer->_height;
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ if (index <= (int32)_layers.size() - 1) {
+ _layers.insert_at(index, layer);
+ } else {
+ _layers.add(layer);
+ }
+
+ _gameRef->registerObject(layer);
+
+ stack->pushNative(layer, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteLayer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteLayer") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ AdLayer *toDelete = NULL;
+ if (val->isNative()) {
+ BaseScriptable *temp = val->getNative();
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ if (_layers[i] == temp) {
+ toDelete = _layers[i];
+ break;
+ }
+ }
+ } else {
+ int index = val->getInt();
+ if (index >= 0 && index < (int32)_layers.size()) {
+ toDelete = _layers[index];
+ }
+ }
+ if (toDelete == NULL) {
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ if (toDelete->_main) {
+ script->runtimeError("Scene.DeleteLayer - cannot delete main scene layer");
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ if (_layers[i] == toDelete) {
+ _layers.remove_at(i);
+ _gameRef->unregisterObject(toDelete);
+ break;
+ }
+ }
+ stack->pushBool(true);
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdScene::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("scene");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumLayers (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumLayers") {
+ _scValue->setInt(_layers.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumWaypointGroups (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumWaypointGroups") {
+ _scValue->setInt(_waypointGroups.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MainLayer (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MainLayer") {
+ if (_mainLayer) {
+ _scValue->setNative(_mainLayer, true);
+ } else {
+ _scValue->setNULL();
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumFreeNodes (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumFreeNodes") {
+ _scValue->setInt(_objects.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MouseX (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MouseX") {
+ int viewportX;
+ getViewportOffset(&viewportX);
+
+ _scValue->setInt(_gameRef->_mousePos.x + _offsetLeft - viewportX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MouseY (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MouseY") {
+ int viewportY;
+ getViewportOffset(NULL, &viewportY);
+
+ _scValue->setInt(_gameRef->_mousePos.y + _offsetTop - viewportY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutoScroll
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AutoScroll") {
+ _scValue->setBool(_autoScroll);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PersistentState
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PersistentState") {
+ _scValue->setBool(_persistentState);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PersistentStateSprites
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PersistentStateSprites") {
+ _scValue->setBool(_persistentStateSprites);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollPixelsX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScrollPixelsX") {
+ _scValue->setInt(_scrollPixelsH);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollPixelsY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScrollPixelsY") {
+ _scValue->setInt(_scrollPixelsV);
+ return _scValue;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollSpeedX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScrollSpeedX") {
+ _scValue->setInt(_scrollTimeH);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollSpeedY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScrollSpeedY") {
+ _scValue->setInt(_scrollTimeV);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // OffsetX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "OffsetX") {
+ _scValue->setInt(_offsetLeft);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // OffsetY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "OffsetY") {
+ _scValue->setInt(_offsetTop);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Width (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Width") {
+ if (_mainLayer) {
+ _scValue->setInt(_mainLayer->_width);
+ } else {
+ _scValue->setInt(0);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Height (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Height") {
+ if (_mainLayer) {
+ _scValue->setInt(_mainLayer->_height);
+ } else {
+ _scValue->setInt(0);
+ }
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutoScroll
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AutoScroll") == 0) {
+ _autoScroll = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PersistentState
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PersistentState") == 0) {
+ _persistentState = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PersistentStateSprites
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PersistentStateSprites") == 0) {
+ _persistentStateSprites = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollPixelsX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScrollPixelsX") == 0) {
+ _scrollPixelsH = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollPixelsY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScrollPixelsY") == 0) {
+ _scrollPixelsV = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollSpeedX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScrollSpeedX") == 0) {
+ _scrollTimeH = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScrollSpeedY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScrollSpeedY") == 0) {
+ _scrollTimeV = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // OffsetX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "OffsetX") == 0) {
+ _offsetLeft = value->getInt();
+
+ int viewportWidth, viewportHeight;
+ getViewportSize(&viewportWidth, &viewportHeight);
+
+ _offsetLeft = MAX(0, _offsetLeft - viewportWidth / 2);
+ _offsetLeft = MIN(_offsetLeft, _width - viewportWidth);
+ _targetOffsetLeft = _offsetLeft;
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // OffsetY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "OffsetY") == 0) {
+ _offsetTop = value->getInt();
+
+ int viewportWidth, viewportHeight;
+ getViewportSize(&viewportWidth, &viewportHeight);
+
+ _offsetTop = MAX(0, _offsetTop - viewportHeight / 2);
+ _offsetTop = MIN(_offsetTop, _height - viewportHeight);
+ _targetOffsetTop = _offsetTop;
+
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdScene::scToString() {
+ return "[scene object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::addObject(AdObject *object) {
+ _objects.add(object);
+ return _gameRef->registerObject(object);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::removeObject(AdObject *object) {
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i] == object) {
+ _objects.remove_at(i);
+ return _gameRef->unregisterObject(object);
+ }
+ }
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "SCENE {\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+
+ if (_persistentState) {
+ buffer->putTextIndent(indent + 2, "PERSISTENT_STATE=%s\n", _persistentState ? "TRUE" : "FALSE");
+ }
+
+ if (!_persistentStateSprites) {
+ buffer->putTextIndent(indent + 2, "PERSISTENT_STATE_SPRITES=%s\n", _persistentStateSprites ? "TRUE" : "FALSE");
+ }
+
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // properties
+ if (_scProp) {
+ _scProp->saveAsText(buffer, indent + 2);
+ }
+
+ // viewport
+ if (_viewport) {
+ Rect32 *rc = _viewport->getRect();
+ buffer->putTextIndent(indent + 2, "VIEWPORT { %d, %d, %d, %d }\n", rc->left, rc->top, rc->right, rc->bottom);
+ }
+
+
+
+ // editor settings
+ buffer->putTextIndent(indent + 2, "; ----- editor settings\n");
+ buffer->putTextIndent(indent + 2, "EDITOR_MARGIN_H=%d\n", _editorMarginH);
+ buffer->putTextIndent(indent + 2, "EDITOR_MARGIN_V=%d\n", _editorMarginV);
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_FRAME { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColFrame), RGBCOLGetG(_editorColFrame), RGBCOLGetB(_editorColFrame), RGBCOLGetA(_editorColFrame));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_ENTITY_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColEntitySel), RGBCOLGetG(_editorColEntitySel), RGBCOLGetB(_editorColEntitySel), RGBCOLGetA(_editorColEntitySel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_REGION_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColRegionSel), RGBCOLGetG(_editorColRegionSel), RGBCOLGetB(_editorColRegionSel), RGBCOLGetA(_editorColRegionSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_BLOCKED_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColBlockedSel), RGBCOLGetG(_editorColBlockedSel), RGBCOLGetB(_editorColBlockedSel), RGBCOLGetA(_editorColBlockedSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_DECORATION_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColDecorSel), RGBCOLGetG(_editorColDecorSel), RGBCOLGetB(_editorColDecorSel), RGBCOLGetA(_editorColDecorSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_WAYPOINTS_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColWaypointsSel), RGBCOLGetG(_editorColWaypointsSel), RGBCOLGetB(_editorColWaypointsSel), RGBCOLGetA(_editorColWaypointsSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_ENTITY { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColEntity), RGBCOLGetG(_editorColEntity), RGBCOLGetB(_editorColEntity), RGBCOLGetA(_editorColEntity));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_REGION { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColRegion), RGBCOLGetG(_editorColRegion), RGBCOLGetB(_editorColRegion), RGBCOLGetA(_editorColRegion));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_DECORATION { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColDecor), RGBCOLGetG(_editorColDecor), RGBCOLGetB(_editorColDecor), RGBCOLGetA(_editorColDecor));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_BLOCKED { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColBlocked), RGBCOLGetG(_editorColBlocked), RGBCOLGetB(_editorColBlocked), RGBCOLGetA(_editorColBlocked));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_WAYPOINTS { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColWaypoints), RGBCOLGetG(_editorColWaypoints), RGBCOLGetB(_editorColWaypoints), RGBCOLGetA(_editorColWaypoints));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_SCALE { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColScale), RGBCOLGetG(_editorColScale), RGBCOLGetB(_editorColScale), RGBCOLGetA(_editorColScale));
+
+ buffer->putTextIndent(indent + 2, "EDITOR_SHOW_REGIONS=%s\n", _editorShowRegions ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SHOW_BLOCKED=%s\n", _editorShowBlocked ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SHOW_DECORATION=%s\n", _editorShowDecor ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SHOW_ENTITIES=%s\n", _editorShowEntities ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SHOW_SCALE=%s\n", _editorShowScale ? "TRUE" : "FALSE");
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ // waypoints
+ buffer->putTextIndent(indent + 2, "; ----- waypoints\n");
+ for (uint32 i = 0; i < _waypointGroups.size(); i++) {
+ _waypointGroups[i]->saveAsText(buffer, indent + 2);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // layers
+ buffer->putTextIndent(indent + 2, "; ----- layers\n");
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ _layers[i]->saveAsText(buffer, indent + 2);
+ }
+
+ // scale levels
+ buffer->putTextIndent(indent + 2, "; ----- scale levels\n");
+ for (uint32 i = 0; i < _scaleLevels.size(); i++) {
+ _scaleLevels[i]->saveAsText(buffer, indent + 2);
+ }
+
+ // rotation levels
+ buffer->putTextIndent(indent + 2, "; ----- rotation levels\n");
+ for (uint32 i = 0; i < _rotLevels.size(); i++) {
+ _rotLevels[i]->saveAsText(buffer, indent + 2);
+ }
+
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // free entities
+ buffer->putTextIndent(indent + 2, "; ----- free entities\n");
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_type == OBJECT_ENTITY) {
+ _objects[i]->saveAsText(buffer, indent + 2);
+
+ }
+ }
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::sortScaleLevels() {
+ if (_scaleLevels.size() == 0) {
+ return STATUS_OK;
+ }
+ bool changed;
+ do {
+ changed = false;
+ for (uint32 i = 0; i < _scaleLevels.size() - 1; i++) {
+ if (_scaleLevels[i]->_posY > _scaleLevels[i + 1]->_posY) {
+ AdScaleLevel *sl = _scaleLevels[i];
+ _scaleLevels[i] = _scaleLevels[i + 1];
+ _scaleLevels[i + 1] = sl;
+
+ changed = true;
+ }
+ }
+
+ } while (changed);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::sortRotLevels() {
+ if (_rotLevels.size() == 0) {
+ return STATUS_OK;
+ }
+ bool changed;
+ do {
+ changed = false;
+ for (uint32 i = 0; i < _rotLevels.size() - 1; i++) {
+ if (_rotLevels[i]->_posX > _rotLevels[i + 1]->_posX) {
+ AdRotLevel *rl = _rotLevels[i];
+ _rotLevels[i] = _rotLevels[i + 1];
+ _rotLevels[i + 1] = rl;
+
+ changed = true;
+ }
+ }
+
+ } while (changed);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float AdScene::getScaleAt(int Y) {
+ AdScaleLevel *prev = NULL;
+ AdScaleLevel *next = NULL;
+
+ for (uint32 i = 0; i < _scaleLevels.size(); i++) {
+ /* AdScaleLevel *xxx = _scaleLevels[i];*/
+ /* int j = _scaleLevels.size(); */
+ if (_scaleLevels[i]->_posY < Y) {
+ prev = _scaleLevels[i];
+ } else {
+ next = _scaleLevels[i];
+ break;
+ }
+ }
+
+ if (prev == NULL || next == NULL) {
+ return 100;
+ }
+
+ int delta_y = next->_posY - prev->_posY;
+ float delta_scale = next->_scale - prev->_scale;
+ Y -= prev->_posY;
+
+ float percent = (float)Y / ((float)delta_y / 100.0f);
+ return prev->_scale + delta_scale / 100 * percent;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_autoScroll));
+ persistMgr->transfer(TMEMBER(_editorColBlocked));
+ persistMgr->transfer(TMEMBER(_editorColBlockedSel));
+ persistMgr->transfer(TMEMBER(_editorColDecor));
+ persistMgr->transfer(TMEMBER(_editorColDecorSel));
+ persistMgr->transfer(TMEMBER(_editorColEntity));
+ persistMgr->transfer(TMEMBER(_editorColEntitySel));
+ persistMgr->transfer(TMEMBER(_editorColFrame));
+ persistMgr->transfer(TMEMBER(_editorColRegion));
+ persistMgr->transfer(TMEMBER(_editorColRegionSel));
+ persistMgr->transfer(TMEMBER(_editorColScale));
+ persistMgr->transfer(TMEMBER(_editorColWaypoints));
+ persistMgr->transfer(TMEMBER(_editorColWaypointsSel));
+ persistMgr->transfer(TMEMBER(_editorMarginH));
+ persistMgr->transfer(TMEMBER(_editorMarginV));
+ persistMgr->transfer(TMEMBER(_editorShowBlocked));
+ persistMgr->transfer(TMEMBER(_editorShowDecor));
+ persistMgr->transfer(TMEMBER(_editorShowEntities));
+ persistMgr->transfer(TMEMBER(_editorShowRegions));
+ persistMgr->transfer(TMEMBER(_editorShowScale));
+ persistMgr->transfer(TMEMBER(_fader));
+ persistMgr->transfer(TMEMBER(_height));
+ persistMgr->transfer(TMEMBER(_initialized));
+ persistMgr->transfer(TMEMBER(_lastTimeH));
+ persistMgr->transfer(TMEMBER(_lastTimeV));
+ _layers.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_mainLayer));
+ _objects.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_offsetLeft));
+ persistMgr->transfer(TMEMBER(_offsetTop));
+ persistMgr->transfer(TMEMBER(_paralaxScrolling));
+ persistMgr->transfer(TMEMBER(_persistentState));
+ persistMgr->transfer(TMEMBER(_persistentStateSprites));
+ persistMgr->transfer(TMEMBER(_pfMaxTime));
+ _pfPath.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_pfPointsNum));
+ persistMgr->transfer(TMEMBER(_pfReady));
+ persistMgr->transfer(TMEMBER(_pfRequester));
+ persistMgr->transfer(TMEMBER(_pfTarget));
+ persistMgr->transfer(TMEMBER(_pfTargetPath));
+ _rotLevels.persist(persistMgr);
+ _scaleLevels.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_scrollPixelsH));
+ persistMgr->transfer(TMEMBER(_scrollPixelsV));
+ persistMgr->transfer(TMEMBER(_scrollTimeH));
+ persistMgr->transfer(TMEMBER(_scrollTimeV));
+ persistMgr->transfer(TMEMBER(_shieldWindow));
+ persistMgr->transfer(TMEMBER(_targetOffsetLeft));
+ persistMgr->transfer(TMEMBER(_targetOffsetTop));
+ _waypointGroups.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_viewport));
+ persistMgr->transfer(TMEMBER(_width));
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::afterLoad() {
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, BaseObject *requester) {
+ double xStep, yStep, x, y;
+ int xLength, yLength, xCount, yCount;
+ int x1, y1, x2, y2;
+
+ x1 = *targetX;
+ y1 = *targetY;
+ x2 = startX;
+ y2 = startY;
+
+
+ xLength = abs(x2 - x1);
+ yLength = abs(y2 - y1);
+
+ if (xLength > yLength) {
+
+ yStep = fabs((double)(y2 - y1) / (double)(x2 - x1));
+ y = y1;
+
+ for (xCount = x1; xCount < x2; xCount++) {
+ if (isWalkableAt(xCount, (int)y, checkFreeObjects, requester)) {
+ *targetX = xCount;
+ *targetY = (int)y;
+ return STATUS_OK;
+ }
+ y += yStep;
+ }
+ } else {
+
+ xStep = fabs((double)(x2 - x1) / (double)(y2 - y1));
+ x = x1;
+
+ for (yCount = y1; yCount < y2; yCount++) {
+ if (isWalkableAt((int)x, yCount, checkFreeObjects, requester)) {
+ *targetX = (int)x;
+ *targetY = yCount;
+ return STATUS_OK;
+ }
+ x += xStep;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, BaseObject *requester) {
+ int x = *argX;
+ int y = *argY;
+
+ if (isWalkableAt(x, y, checkFreeObjects, requester) || !_mainLayer) {
+ return STATUS_OK;
+ }
+
+ // right
+ int lengthRight = 0;
+ bool foundRight = false;
+ for (x = *argX, y = *argY; x < _mainLayer->_width; x++, lengthRight++) {
+ if (isWalkableAt(x, y, checkFreeObjects, requester) && isWalkableAt(x - 5, y, checkFreeObjects, requester)) {
+ foundRight = true;
+ break;
+ }
+ }
+
+ // left
+ int lengthLeft = 0;
+ bool foundLeft = false;
+ for (x = *argX, y = *argY; x >= 0; x--, lengthLeft--) {
+ if (isWalkableAt(x, y, checkFreeObjects, requester) && isWalkableAt(x + 5, y, checkFreeObjects, requester)) {
+ foundLeft = true;
+ break;
+ }
+ }
+
+ // up
+ int lengthUp = 0;
+ bool foundUp = false;
+ for (x = *argX, y = *argY; y >= 0; y--, lengthUp--) {
+ if (isWalkableAt(x, y, checkFreeObjects, requester) && isWalkableAt(x, y + 5, checkFreeObjects, requester)) {
+ foundUp = true;
+ break;
+ }
+ }
+
+ // down
+ int lengthDown = 0;
+ bool foundDown = false;
+ for (x = *argX, y = *argY; y < _mainLayer->_height; y++, lengthDown++) {
+ if (isWalkableAt(x, y, checkFreeObjects, requester) && isWalkableAt(x, y - 5, checkFreeObjects, requester)) {
+ foundDown = true;
+ break;
+ }
+ }
+
+ if (!foundLeft && !foundRight && !foundUp && !foundDown) {
+ return STATUS_OK;
+ }
+
+ int offsetX = INT_MAX, offsetY = INT_MAX;
+
+ if (foundLeft && foundRight) {
+ if (abs(lengthLeft) < abs(lengthRight)) {
+ offsetX = lengthLeft;
+ } else {
+ offsetX = lengthRight;
+ }
+ } else if (foundLeft) {
+ offsetX = lengthLeft;
+ } else if (foundRight) {
+ offsetX = lengthRight;
+ }
+
+ if (foundUp && foundDown) {
+ if (abs(lengthUp) < abs(lengthDown)) {
+ offsetY = lengthUp;
+ } else {
+ offsetY = lengthDown;
+ }
+ } else if (foundUp) {
+ offsetY = lengthUp;
+ } else if (foundDown) {
+ offsetY = lengthDown;
+ }
+
+ if (abs(offsetX) < abs(offsetY)) {
+ *argX = *argX + offsetX;
+ } else {
+ *argY = *argY + offsetY;
+ }
+
+ if (!isWalkableAt(*argX, *argY)) {
+ return correctTargetPoint2(startX, startY, argX, argY, checkFreeObjects, requester);
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::pfPointsStart() {
+ _pfPointsNum = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::pfPointsAdd(int x, int y, int distance) {
+ if (_pfPointsNum >= (int32)_pfPath.size()) {
+ _pfPath.add(new AdPathPoint(x, y, distance));
+ } else {
+ _pfPath[_pfPointsNum]->x = x;
+ _pfPath[_pfPointsNum]->y = y;
+ _pfPath[_pfPointsNum]->_distance = distance;
+ _pfPath[_pfPointsNum]->_marked = false;
+ _pfPath[_pfPointsNum]->_origin = NULL;
+ }
+
+ _pfPointsNum++;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::getViewportOffset(int *offsetX, int *offsetY) {
+ AdGame *adGame = (AdGame *)_gameRef;
+ if (_viewport && !_gameRef->_editorMode) {
+ if (offsetX) {
+ *offsetX = _viewport->_offsetX;
+ }
+ if (offsetY) {
+ *offsetY = _viewport->_offsetY;
+ }
+ } else if (adGame->_sceneViewport && !_gameRef->_editorMode) {
+ if (offsetX) {
+ *offsetX = adGame->_sceneViewport->_offsetX;
+ }
+ if (offsetY) {
+ *offsetY = adGame->_sceneViewport->_offsetY;
+ }
+ } else {
+ if (offsetX) {
+ *offsetX = 0;
+ }
+ if (offsetY) {
+ *offsetY = 0;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::getViewportSize(int *width, int *height) {
+ AdGame *adGame = (AdGame *)_gameRef;
+ if (_viewport && !_gameRef->_editorMode) {
+ if (width) {
+ *width = _viewport->getWidth();
+ }
+ if (height) {
+ *height = _viewport->getHeight();
+ }
+ } else if (adGame->_sceneViewport && !_gameRef->_editorMode) {
+ if (width) {
+ *width = adGame->_sceneViewport->getWidth();
+ }
+ if (height) {
+ *height = adGame->_sceneViewport->getHeight();
+ }
+ } else {
+ if (width) {
+ *width = _gameRef->_renderer->_width;
+ }
+ if (height) {
+ *height = _gameRef->_renderer->_height;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int AdScene::getOffsetLeft() {
+ int viewportX;
+ getViewportOffset(&viewportX);
+
+ return _offsetLeft - viewportX;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int AdScene::getOffsetTop() {
+ int viewportY;
+ getViewportOffset(NULL, &viewportY);
+
+ return _offsetTop - viewportY;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::pointInViewport(int x, int y) {
+ int left, top, width, height;
+
+ getViewportOffset(&left, &top);
+ getViewportSize(&width, &height);
+
+ return x >= left && x <= left + width && y >= top && y <= top + height;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdScene::setOffset(int offsetLeft, int offsetTop) {
+ _offsetLeft = offsetLeft;
+ _offsetTop = offsetTop;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseObject *AdScene::getNodeByName(const char *name) {
+ BaseObject *ret = NULL;
+
+ // dependent objects
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ AdLayer *layer = _layers[i];
+ for (uint32 j = 0; j < layer->_nodes.size(); j++) {
+ AdSceneNode *node = layer->_nodes[j];
+ if ((node->_type == OBJECT_ENTITY && !scumm_stricmp(name, node->_entity->getName())) ||
+ (node->_type == OBJECT_REGION && !scumm_stricmp(name, node->_region->getName()))) {
+ switch (node->_type) {
+ case OBJECT_ENTITY:
+ ret = node->_entity;
+ break;
+ case OBJECT_REGION:
+ ret = node->_region;
+ break;
+ default:
+ ret = NULL;
+ }
+ return ret;
+ }
+ }
+ }
+
+ // free entities
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_type == OBJECT_ENTITY && !scumm_stricmp(name, _objects[i]->getName())) {
+ return _objects[i];
+ }
+ }
+
+ // waypoint groups
+ for (uint32 i = 0; i < _waypointGroups.size(); i++) {
+ if (!scumm_stricmp(name, _waypointGroups[i]->getName())) {
+ return _waypointGroups[i];
+ }
+ }
+
+ return NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::saveState() {
+ return persistState(true);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::loadState() {
+ return persistState(false);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::persistState(bool saving) {
+ if (!_persistentState) {
+ return STATUS_OK;
+ }
+
+ AdGame *adGame = (AdGame *)_gameRef;
+ AdSceneState *state = adGame->getSceneState(getFilename(), saving);
+ if (!state) {
+ return STATUS_OK;
+ }
+
+ AdNodeState *nodeState;
+
+ // dependent objects
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ AdLayer *layer = _layers[i];
+ for (uint32 j = 0; j < layer->_nodes.size(); j++) {
+ AdSceneNode *node = layer->_nodes[j];
+ switch (node->_type) {
+ case OBJECT_ENTITY:
+ if (!node->_entity->_saveState) {
+ continue;
+ }
+ nodeState = state->getNodeState(node->_entity->getName(), saving);
+ if (nodeState) {
+ nodeState->transferEntity(node->_entity, _persistentStateSprites, saving);
+ //if (Saving) NodeState->_active = node->_entity->_active;
+ //else node->_entity->_active = NodeState->_active;
+ }
+ break;
+ case OBJECT_REGION:
+ if (!node->_region->_saveState) {
+ continue;
+ }
+ nodeState = state->getNodeState(node->_region->getName(), saving);
+ if (nodeState) {
+ if (saving) {
+ nodeState->_active = node->_region->_active;
+ } else {
+ node->_region->_active = nodeState->_active;
+ }
+ }
+ break;
+ default:
+ warning("AdScene::PersistState - unhandled enum");
+ break;
+ }
+ }
+ }
+
+ // free entities
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (!_objects[i]->_saveState) {
+ continue;
+ }
+ if (_objects[i]->_type == OBJECT_ENTITY) {
+ nodeState = state->getNodeState(_objects[i]->getName(), saving);
+ if (nodeState) {
+ nodeState->transferEntity((AdEntity *)_objects[i], _persistentStateSprites, saving);
+ //if (Saving) NodeState->_active = _objects[i]->_active;
+ //else _objects[i]->_active = NodeState->_active;
+ }
+ }
+ }
+
+ // waypoint groups
+ for (uint32 i = 0; i < _waypointGroups.size(); i++) {
+ nodeState = state->getNodeState(_waypointGroups[i]->getName(), saving);
+ if (nodeState) {
+ if (saving) {
+ nodeState->_active = _waypointGroups[i]->_active;
+ } else {
+ _waypointGroups[i]->_active = nodeState->_active;
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float AdScene::getRotationAt(int x, int y) {
+ AdRotLevel *prev = NULL;
+ AdRotLevel *next = NULL;
+
+ for (uint32 i = 0; i < _rotLevels.size(); i++) {
+ /* AdRotLevel *xxx = _rotLevels[i];
+ int j = _rotLevels.size();*/
+ if (_rotLevels[i]->_posX < x) {
+ prev = _rotLevels[i];
+ } else {
+ next = _rotLevels[i];
+ break;
+ }
+ }
+
+ if (prev == NULL || next == NULL) {
+ return 0;
+ }
+
+ int delta_x = next->_posX - prev->_posX;
+ float delta_rot = next->_rotation - prev->_rotation;
+ x -= prev->_posX;
+
+ float percent = (float)x / ((float)delta_x / 100.0f);
+ return prev->_rotation + delta_rot / 100 * percent;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::handleItemAssociations(const char *itemName, bool show) {
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ AdLayer *layer = _layers[i];
+ for (uint32 j = 0; j < layer->_nodes.size(); j++) {
+ if (layer->_nodes[j]->_type == OBJECT_ENTITY) {
+ AdEntity *ent = layer->_nodes[j]->_entity;
+
+ if (ent->_item && strcmp(ent->_item, itemName) == 0) {
+ ent->_active = show;
+ }
+ }
+ }
+ }
+
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ if (_objects[i]->_type == OBJECT_ENTITY) {
+ AdEntity *ent = (AdEntity *)_objects[i];
+ if (ent->_item && strcmp(ent->_item, itemName) == 0) {
+ ent->_active = show;
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::getRegionsAt(int x, int y, AdRegion **regionList, int numRegions) {
+ int numUsed = 0;
+ if (_mainLayer) {
+ for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) {
+ AdSceneNode *node = _mainLayer->_nodes[i];
+ if (node->_type == OBJECT_REGION && node->_region->_active && node->_region->pointInRegion(x, y)) {
+ if (numUsed < numRegions - 1) {
+ regionList[numUsed] = node->_region;
+ numUsed++;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ for (int i = numUsed; i < numRegions; i++) {
+ regionList[i] = NULL;
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::restoreDeviceObjects() {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseObject *AdScene::getNextAccessObject(BaseObject *currObject) {
+ BaseArray<AdObject *> objects;
+ getSceneObjects(objects, true);
+
+ if (objects.size() == 0) {
+ return NULL;
+ } else {
+ if (currObject != NULL) {
+ for (uint32 i = 0; i < objects.size(); i++) {
+ if (objects[i] == currObject) {
+ if (i < objects.size() - 1) {
+ return objects[i + 1];
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return objects[0];
+ }
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseObject *AdScene::getPrevAccessObject(BaseObject *currObject) {
+ BaseArray<AdObject *> objects;
+ getSceneObjects(objects, true);
+
+ if (objects.size() == 0) {
+ return NULL;
+ } else {
+ if (currObject != NULL) {
+ for (int i = objects.size() - 1; i >= 0; i--) {
+ if (objects[i] == currObject) {
+ if (i > 0) {
+ return objects[i - 1];
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return objects[objects.size() - 1];
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::getSceneObjects(BaseArray<AdObject *> &objects, bool interactiveOnly) {
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ // close-up layer -> remove everything below it
+ if (interactiveOnly && _layers[i]->_closeUp) {
+ objects.clear();
+ }
+
+
+ for (uint32 j = 0; j < _layers[i]->_nodes.size(); j++) {
+ AdSceneNode *node = _layers[i]->_nodes[j];
+ switch (node->_type) {
+ case OBJECT_ENTITY: {
+ AdEntity *ent = node->_entity;
+ if (ent->_active && (ent->_registrable || !interactiveOnly)) {
+ objects.add(ent);
+ }
+ }
+ break;
+
+ case OBJECT_REGION: {
+ BaseArray<AdObject *> regionObj;
+ getRegionObjects(node->_region, regionObj, interactiveOnly);
+ for (uint32 newIndex = 0; newIndex < regionObj.size(); newIndex++) {
+ bool found = false;
+ for (uint32 old = 0; old < objects.size(); old++) {
+ if (objects[old] == regionObj[newIndex]) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ objects.add(regionObj[newIndex]);
+ }
+ }
+ //if (regionObj.size() > 0) Objects.Append(RegionObj);
+ }
+ break;
+ default:
+ debugC(kWintermuteDebugGeneral, "AdScene::GetSceneObjects - Unhandled enum");
+ break;
+ }
+ }
+ }
+
+ // objects outside any region
+ BaseArray<AdObject *> regionObj;
+ getRegionObjects(NULL, regionObj, interactiveOnly);
+ for (uint32 newIndex = 0; newIndex < regionObj.size(); newIndex++) {
+ bool found = false;
+ for (uint32 old = 0; old < objects.size(); old++) {
+ if (objects[old] == regionObj[newIndex]) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ objects.add(regionObj[newIndex]);
+ }
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdScene::getRegionObjects(AdRegion *region, BaseArray<AdObject *> &objects, bool interactiveOnly) {
+ AdGame *adGame = (AdGame *)_gameRef;
+ AdObject *obj;
+
+ // global objects
+ for (uint32 i = 0; i < adGame->_objects.size(); i++) {
+ obj = adGame->_objects[i];
+ if (obj->_active && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) {
+ if (interactiveOnly && !obj->_registrable) {
+ continue;
+ }
+
+ objects.add(obj);
+ }
+ }
+
+ // scene objects
+ for (uint32 i = 0; i < _objects.size(); i++) {
+ obj = _objects[i];
+ if (obj->_active && !obj->_editorOnly && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) {
+ if (interactiveOnly && !obj->_registrable) {
+ continue;
+ }
+
+ objects.add(obj);
+ }
+ }
+
+ // sort by _posY
+ Common::sort(objects.begin(), objects.end(), AdScene::compareObjs);
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h
new file mode 100644
index 0000000000..3b482403b5
--- /dev/null
+++ b/engines/wintermute/ad/ad_scene.h
@@ -0,0 +1,181 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADSCENE_H
+#define WINTERMUTE_ADSCENE_H
+
+#include "engines/wintermute/base/base_fader.h"
+
+namespace Wintermute {
+
+class UIWindow;
+class AdObject;
+class AdRegion;
+class BaseViewport;
+class AdLayer;
+class BasePoint;
+class AdWaypointGroup;
+class AdPath;
+class AdScaleLevel;
+class AdRotLevel;
+class AdPathPoint;
+class AdScene : public BaseObject {
+public:
+
+ BaseObject *getNextAccessObject(BaseObject *currObject);
+ BaseObject *getPrevAccessObject(BaseObject *currObject);
+ bool getSceneObjects(BaseArray<AdObject *> &objects, bool interactiveOnly);
+ bool getRegionObjects(AdRegion *region, BaseArray<AdObject *> &objects, bool interactiveOnly);
+
+ bool afterLoad();
+
+ bool getRegionsAt(int x, int y, AdRegion **regionList, int numRegions);
+ bool handleItemAssociations(const char *itemName, bool show);
+ UIWindow *_shieldWindow;
+ float getRotationAt(int x, int y);
+ bool loadState();
+ bool saveState();
+ bool _persistentState;
+ bool _persistentStateSprites;
+ BaseObject *getNodeByName(const char *name);
+ void setOffset(int offsetLeft, int offsetTop);
+ bool pointInViewport(int x, int y);
+ int getOffsetTop();
+ int getOffsetLeft();
+ bool getViewportSize(int *width = NULL, int *height = NULL);
+ bool getViewportOffset(int *offsetX = NULL, int *offsetY = NULL);
+ BaseViewport *_viewport;
+ BaseFader *_fader;
+ int _pfPointsNum;
+ void pfPointsAdd(int x, int y, int distance);
+ void pfPointsStart();
+ bool _initialized;
+ bool correctTargetPoint(int startX, int startY, int *x, int *y, bool checkFreeObjects = false, BaseObject *requester = NULL);
+ bool correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, BaseObject *requester);
+ DECLARE_PERSISTENT(AdScene, BaseObject)
+ bool displayRegionContent(AdRegion *region = NULL, bool display3DOnly = false);
+ bool displayRegionContentOld(AdRegion *region = NULL);
+ static int compareObjs(const void *obj1, const void *obj2);
+
+ bool updateFreeObjects();
+ bool traverseNodes(bool update = false);
+ float getScaleAt(int y);
+ bool sortScaleLevels();
+ bool sortRotLevels();
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ uint32 getAlphaAt(int x, int y, bool colorCheck = false);
+ bool _paralaxScrolling;
+ void skipTo(int offsetX, int offsetY);
+ void setDefaults();
+ void cleanup();
+ void skipToObject(BaseObject *object);
+ void scrollToObject(BaseObject *object);
+ void scrollTo(int offsetX, int offsetY);
+ virtual bool update();
+ bool _autoScroll;
+ int _targetOffsetTop;
+ int _targetOffsetLeft;
+
+ int _scrollPixelsV;
+ uint32 _scrollTimeV;
+ uint32 _lastTimeV;
+
+ int _scrollPixelsH;
+ uint32 _scrollTimeH;
+ uint32 _lastTimeH;
+
+ virtual bool display();
+ uint32 _pfMaxTime;
+ bool initLoop();
+ void pathFinderStep();
+ bool isBlockedAt(int x, int y, bool checkFreeObjects = false, BaseObject *requester = NULL);
+ bool isWalkableAt(int x, int y, bool checkFreeObjects = false, BaseObject *requester = NULL);
+ AdLayer *_mainLayer;
+ float getZoomAt(int x, int y);
+ bool getPath(BasePoint source, BasePoint target, AdPath *path, BaseObject *requester = NULL);
+ AdScene(BaseGame *inGame);
+ virtual ~AdScene();
+ BaseArray<AdLayer *> _layers;
+ BaseArray<AdObject *> _objects;
+ BaseArray<AdWaypointGroup *> _waypointGroups;
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ int _width;
+ int _height;
+ bool addObject(AdObject *Object);
+ bool removeObject(AdObject *Object);
+ int _editorMarginH;
+ int _editorMarginV;
+ uint32 _editorColFrame;
+ uint32 _editorColEntity;
+ uint32 _editorColRegion;
+ uint32 _editorColBlocked;
+ uint32 _editorColWaypoints;
+ uint32 _editorColEntitySel;
+ uint32 _editorColRegionSel;
+ uint32 _editorColBlockedSel;
+ uint32 _editorColWaypointsSel;
+ uint32 _editorColScale;
+ uint32 _editorColDecor;
+ uint32 _editorColDecorSel;
+
+ bool _editorShowRegions;
+ bool _editorShowBlocked;
+ bool _editorShowDecor;
+ bool _editorShowEntities;
+ bool _editorShowScale;
+ BaseArray<AdScaleLevel *> _scaleLevels;
+ BaseArray<AdRotLevel *> _rotLevels;
+
+ virtual bool restoreDeviceObjects();
+ int getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester = NULL);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+
+private:
+ bool persistState(bool saving = true);
+ void pfAddWaypointGroup(AdWaypointGroup *Wpt, BaseObject *requester = NULL);
+ bool _pfReady;
+ BasePoint *_pfTarget;
+ AdPath *_pfTargetPath;
+ BaseObject *_pfRequester;
+ BaseArray<AdPathPoint *> _pfPath;
+
+ int _offsetTop;
+ int _offsetLeft;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_scene_node.cpp b/engines/wintermute/ad/ad_scene_node.cpp
new file mode 100644
index 0000000000..d0202236fd
--- /dev/null
+++ b/engines/wintermute/ad/ad_scene_node.cpp
@@ -0,0 +1,82 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_scene_node.h"
+#include "engines/wintermute/base/base_game.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdSceneNode, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdSceneNode::AdSceneNode(BaseGame *inGame) : BaseObject(inGame) {
+ _type = OBJECT_NONE;
+ _region = NULL;
+ _entity = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdSceneNode::~AdSceneNode() {
+ _gameRef->unregisterObject(_region);
+ _region = NULL;
+
+ _gameRef->unregisterObject(_entity);
+ _entity = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSceneNode::setEntity(AdEntity *entity) {
+ _type = OBJECT_ENTITY;
+ _entity = entity;
+ return _gameRef->registerObject(entity);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSceneNode::setRegion(AdRegion *region) {
+ _type = OBJECT_REGION;
+ _region = region;
+ return _gameRef->registerObject(region);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSceneNode::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_entity));
+ persistMgr->transfer(TMEMBER(_region));
+ persistMgr->transfer(TMEMBER_INT(_type));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_scene_node.h b/engines/wintermute/ad/ad_scene_node.h
new file mode 100644
index 0000000000..5bb1606d0e
--- /dev/null
+++ b/engines/wintermute/ad/ad_scene_node.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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADSCENENODE_H
+#define WINTERMUTE_ADSCENENODE_H
+
+
+#include "engines/wintermute/ad/ad_types.h" // Added by ClassView
+#include "engines/wintermute/ad/ad_region.h" // Added by ClassView
+#include "engines/wintermute/ad/ad_entity.h"
+
+namespace Wintermute {
+
+class AdSceneNode : public BaseObject {
+public:
+ DECLARE_PERSISTENT(AdSceneNode, BaseObject)
+ bool setRegion(AdRegion *region);
+ bool setEntity(AdEntity *entity);
+ AdEntity *_entity;
+ AdRegion *_region;
+ TObjectType _type;
+ AdSceneNode(BaseGame *inGame);
+ virtual ~AdSceneNode();
+
+};
+
+}
+
+#endif
diff --git a/engines/wintermute/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp
new file mode 100644
index 0000000000..6b34f1af53
--- /dev/null
+++ b/engines/wintermute/ad/ad_scene_state.cpp
@@ -0,0 +1,95 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_scene_state.h"
+#include "engines/wintermute/ad/ad_node_state.h"
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdSceneState, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdSceneState::AdSceneState(BaseGame *inGame) : BaseClass(inGame) {
+ _filename = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdSceneState::~AdSceneState() {
+ delete[] _filename;
+ _filename = NULL;
+
+ for (uint32 i = 0; i < _nodeStates.size(); i++) {
+ delete _nodeStates[i];
+ }
+ _nodeStates.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSceneState::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_filename));
+ _nodeStates.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdSceneState::setFilename(const char *filename) {
+ delete[] _filename;
+ _filename = new char [strlen(filename) + 1];
+ if (_filename) {
+ strcpy(_filename, filename);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdNodeState *AdSceneState::getNodeState(const char *name, bool saving) {
+ for (uint32 i = 0; i < _nodeStates.size(); i++) {
+ if (scumm_stricmp(_nodeStates[i]->getName(), name) == 0) {
+ return _nodeStates[i];
+ }
+ }
+
+ if (saving) {
+ AdNodeState *ret = new AdNodeState(_gameRef);
+ ret->setName(name);
+ _nodeStates.add(ret);
+
+ return ret;
+ } else {
+ return NULL;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_scene_state.h b/engines/wintermute/ad/ad_scene_state.h
new file mode 100644
index 0000000000..2b25393c5a
--- /dev/null
+++ b/engines/wintermute/ad/ad_scene_state.h
@@ -0,0 +1,51 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADSCENESTATE_H
+#define WINTERMUTE_ADSCENESTATE_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/coll_templ.h"
+
+namespace Wintermute {
+class AdNodeState;
+class AdSceneState : public BaseClass {
+public:
+ AdNodeState *getNodeState(const char *name, bool saving);
+ void setFilename(const char *filename);
+ DECLARE_PERSISTENT(AdSceneState, BaseClass)
+ AdSceneState(BaseGame *inGame);
+ virtual ~AdSceneState();
+ char *_filename;
+ BaseArray<AdNodeState *> _nodeStates;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp
new file mode 100644
index 0000000000..cfe4191b07
--- /dev/null
+++ b/engines/wintermute/ad/ad_sentence.cpp
@@ -0,0 +1,361 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/ad/ad_talk_def.h"
+#include "engines/wintermute/ad/ad_talk_node.h"
+#include "engines/wintermute/utils/path_util.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdSentence, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdSentence::AdSentence(BaseGame *inGame) : BaseClass(inGame) {
+ _text = NULL;
+ _stances = NULL;
+ _tempStance = NULL;
+
+ _duration = 0;
+ _startTime = 0;
+ _currentStance = 0;
+
+ _font = NULL;
+
+ _pos.x = _pos.y = 0;
+ _width = _gameRef->_renderer->_width;
+
+ _align = (TTextAlign)TAL_CENTER;
+
+ _sound = NULL;
+ _soundStarted = false;
+
+ _talkDef = NULL;
+ _currentSprite = NULL;
+ _currentSkelAnim = NULL;
+ _fixedPos = false;
+ _freezable = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdSentence::~AdSentence() {
+ delete _sound;
+ delete[] _text;
+ delete[] _stances;
+ delete[] _tempStance;
+ delete _talkDef;
+ _sound = NULL;
+ _text = NULL;
+ _stances = NULL;
+ _tempStance = NULL;
+ _talkDef = NULL;
+
+ _currentSprite = NULL; // ref only
+ _currentSkelAnim = NULL;
+ _font = NULL; // ref only
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdSentence::setText(const char *text) {
+ if (_text) {
+ delete[] _text;
+ }
+ _text = new char[strlen(text) + 1];
+ if (_text) {
+ strcpy(_text, text);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdSentence::setStances(const char *stances) {
+ if (_stances) {
+ delete[] _stances;
+ }
+ if (stances) {
+ _stances = new char[strlen(stances) + 1];
+ if (_stances) {
+ strcpy(_stances, stances);
+ }
+ } else {
+ _stances = NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *AdSentence::getCurrentStance() {
+ return getStance(_currentStance);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *AdSentence::getNextStance() {
+ _currentStance++;
+ return getStance(_currentStance);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *AdSentence::getStance(int stance) {
+ if (_stances == NULL) {
+ return NULL;
+ }
+
+ if (_tempStance) {
+ delete[] _tempStance;
+ }
+ _tempStance = NULL;
+
+ char *start;
+ char *curr;
+ int pos;
+
+ if (stance == 0) {
+ start = _stances;
+ } else {
+ pos = 0;
+ start = NULL;
+ curr = _stances;
+ while (pos < stance) {
+ if (*curr == '\0') {
+ break;
+ }
+ if (*curr == ',') {
+ pos++;
+ }
+ curr++;
+ }
+ if (pos == stance) {
+ start = curr;
+ }
+ }
+
+ if (start == NULL) {
+ return NULL;
+ }
+
+ while (*start == ' ' && *start != ',' && *start != '\0') {
+ start++;
+ }
+
+ curr = start;
+ while (*curr != '\0' && *curr != ',') {
+ curr++;
+ }
+
+ while (curr > start && *(curr - 1) == ' ') {
+ curr--;
+ }
+
+ _tempStance = new char [curr - start + 1];
+ if (_tempStance) {
+ Common::strlcpy(_tempStance, start, curr - start + 1);
+ }
+
+ return _tempStance;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSentence::display() {
+ if (!_font || !_text) {
+ return STATUS_FAILED;
+ }
+
+ if (_sound && !_soundStarted) {
+ _sound->play();
+ _soundStarted = true;
+ }
+
+ if (_gameRef->_subtitles) {
+ int x = _pos.x;
+ int y = _pos.y;
+
+ if (!_fixedPos) {
+ x = x - ((AdGame *)_gameRef)->_scene->getOffsetLeft();
+ y = y - ((AdGame *)_gameRef)->_scene->getOffsetTop();
+ }
+
+
+ x = MAX(x, 0);
+ x = MIN(x, _gameRef->_renderer->_width - _width);
+ y = MAX(y, 0);
+
+ _font->drawText((byte *)_text, x, y, _width, _align);
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdSentence::setSound(BaseSound *sound) {
+ if (!sound) {
+ return;
+ }
+ delete _sound;
+ _sound = sound;
+ _soundStarted = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSentence::finish() {
+ if (_sound) {
+ _sound->stop();
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSentence::persist(BasePersistenceManager *persistMgr) {
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER_INT(_align));
+ persistMgr->transfer(TMEMBER(_currentStance));
+ persistMgr->transfer(TMEMBER(_currentSprite));
+ persistMgr->transfer(TMEMBER(_currentSkelAnim));
+ persistMgr->transfer(TMEMBER(_duration));
+ persistMgr->transfer(TMEMBER(_font));
+ persistMgr->transfer(TMEMBER(_pos));
+ persistMgr->transfer(TMEMBER(_sound));
+ persistMgr->transfer(TMEMBER(_soundStarted));
+ persistMgr->transfer(TMEMBER(_stances));
+ persistMgr->transfer(TMEMBER(_startTime));
+ persistMgr->transfer(TMEMBER(_talkDef));
+ persistMgr->transfer(TMEMBER(_tempStance));
+ persistMgr->transfer(TMEMBER(_text));
+ persistMgr->transfer(TMEMBER(_width));
+ persistMgr->transfer(TMEMBER(_fixedPos));
+ persistMgr->transfer(TMEMBER(_freezable));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSentence::setupTalkFile(const char *soundFilename) {
+ delete _talkDef;
+ _talkDef = NULL;
+ _currentSprite = NULL;
+
+ if (!soundFilename) {
+ return STATUS_OK;
+ }
+
+
+ AnsiString path = PathUtil::getDirectoryName(soundFilename);
+ AnsiString name = PathUtil::getFileNameWithoutExtension(soundFilename);
+
+ AnsiString talkDefFileName = PathUtil::combine(path, name + ".talk");
+
+ if (!BaseFileManager::getEngineInstance()->hasFile(talkDefFileName)) {
+ return STATUS_OK; // no talk def file found
+ }
+
+ _talkDef = new AdTalkDef(_gameRef);
+ if (!_talkDef || DID_FAIL(_talkDef->loadFile(talkDefFileName.c_str()))) {
+ delete _talkDef;
+ _talkDef = NULL;
+ return STATUS_FAILED;
+ }
+ //_gameRef->LOG(0, "Using .talk file: %s", TalkDefFile);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSentence::update(TDirection dir) {
+ if (!_talkDef) {
+ return STATUS_OK;
+ }
+
+ uint32 currentTime;
+ // if sound is available, synchronize with sound, otherwise use timer
+
+ /*
+ if (_sound) CurrentTime = _sound->GetPositionTime();
+ else CurrentTime = _gameRef->_timer - _startTime;
+ */
+ currentTime = _gameRef->_timer - _startTime;
+
+ bool talkNodeFound = false;
+ for (uint32 i = 0; i < _talkDef->_nodes.size(); i++) {
+ if (_talkDef->_nodes[i]->isInTimeInterval(currentTime, dir)) {
+ talkNodeFound = true;
+
+ BaseSprite *newSprite = _talkDef->_nodes[i]->getSprite(dir);
+ if (newSprite != _currentSprite) {
+ newSprite->reset();
+ }
+ _currentSprite = newSprite;
+
+ if (!_talkDef->_nodes[i]->_playToEnd) {
+ break;
+ }
+ }
+ }
+
+
+ // no talk node, try to use default sprite instead (if any)
+ if (!talkNodeFound) {
+ BaseSprite *newSprite = _talkDef->getDefaultSprite(dir);
+ if (newSprite) {
+ if (newSprite != _currentSprite) {
+ newSprite->reset();
+ }
+ _currentSprite = newSprite;
+ } else {
+ _currentSprite = NULL;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSentence::canSkip() {
+ // prevent accidental sentence skipping (TODO make configurable)
+ return (_gameRef->_timer - _startTime) > 300;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_sentence.h b/engines/wintermute/ad/ad_sentence.h
new file mode 100644
index 0000000000..e7c94030b9
--- /dev/null
+++ b/engines/wintermute/ad/ad_sentence.h
@@ -0,0 +1,85 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADSENTENCE_H
+#define WINTERMUTE_ADSENTENCE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/math/rect32.h"
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+#include "common/rect.h"
+
+namespace Wintermute {
+class AdTalkDef;
+class BaseFont;
+class BaseSprite;
+class BaseSound;
+class AdSentence : public BaseClass {
+public:
+ bool _freezable;
+ bool _fixedPos;
+ BaseSprite *_currentSprite;
+ char *_currentSkelAnim;
+ bool update(TDirection dir = DI_DOWN);
+ bool setupTalkFile(const char *soundFilename);
+ DECLARE_PERSISTENT(AdSentence, BaseClass)
+ bool finish();
+ void setSound(BaseSound *Sound);
+ bool _soundStarted;
+ BaseSound *_sound;
+ TTextAlign _align;
+ bool display();
+ int _width;
+ Point32 _pos;
+ BaseFont *_font;
+ char *getNextStance();
+ char *getCurrentStance();
+ void setStances(const char *stances);
+ void setText(const char *text);
+ int _currentStance;
+ uint32 _startTime;
+ char *_stances;
+ char *_text;
+ uint32 _duration;
+ AdSentence(BaseGame *inGame);
+ virtual ~AdSentence();
+ AdTalkDef *_talkDef;
+
+ bool canSkip();
+
+private:
+ char *_tempStance;
+ char *getStance(int stance);
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp
new file mode 100644
index 0000000000..345b483a8f
--- /dev/null
+++ b/engines/wintermute/ad/ad_sprite_set.cpp
@@ -0,0 +1,356 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_sprite_set.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_sprite.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdSpriteSet, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdSpriteSet::AdSpriteSet(BaseGame *inGame, BaseObject *owner) : BaseObject(inGame) {
+ _owner = owner;
+
+ for (int i = 0; i < NUM_DIRECTIONS; i++) {
+ _sprites[i] = NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdSpriteSet::~AdSpriteSet() {
+ for (int i = 0; i < NUM_DIRECTIONS; i++) {
+ delete _sprites[i];
+ _sprites[i] = NULL;
+ }
+
+ _owner = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdSpriteSet::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing SPRITESET file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(SPRITESET)
+TOKEN_DEF(NAME)
+TOKEN_DEF(UP_LEFT)
+TOKEN_DEF(DOWN_LEFT)
+TOKEN_DEF(LEFT)
+TOKEN_DEF(UP_RIGHT)
+TOKEN_DEF(DOWN_RIGHT)
+TOKEN_DEF(RIGHT)
+TOKEN_DEF(UP)
+TOKEN_DEF(DOWN)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(SPRITESET)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(UP_LEFT)
+ TOKEN_TABLE(DOWN_LEFT)
+ TOKEN_TABLE(LEFT)
+ TOKEN_TABLE(UP_RIGHT)
+ TOKEN_TABLE(DOWN_RIGHT)
+ TOKEN_TABLE(RIGHT)
+ TOKEN_TABLE(UP)
+ TOKEN_TABLE(DOWN)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SPRITESET) {
+ _gameRef->LOG(0, "'SPRITESET' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ BaseSprite *spr = NULL;
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_LEFT:
+ delete _sprites[DI_LEFT];
+ _sprites[DI_LEFT] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_LEFT] = spr;
+ }
+ break;
+
+ case TOKEN_RIGHT:
+ delete _sprites[DI_RIGHT];
+ _sprites[DI_RIGHT] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_RIGHT] = spr;
+ }
+ break;
+
+ case TOKEN_UP:
+ delete _sprites[DI_UP];
+ _sprites[DI_UP] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_UP] = spr;
+ }
+ break;
+
+ case TOKEN_DOWN:
+ delete _sprites[DI_DOWN];
+ _sprites[DI_DOWN] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_DOWN] = spr;
+ }
+ break;
+
+ case TOKEN_UP_LEFT:
+ delete _sprites[DI_UPLEFT];
+ _sprites[DI_UPLEFT] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_UPLEFT] = spr;
+ }
+ break;
+
+ case TOKEN_UP_RIGHT:
+ delete _sprites[DI_UPRIGHT];
+ _sprites[DI_UPRIGHT] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_UPRIGHT] = spr;
+ }
+ break;
+
+ case TOKEN_DOWN_LEFT:
+ delete _sprites[DI_DOWNLEFT];
+ _sprites[DI_DOWNLEFT] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_DOWNLEFT] = spr;
+ }
+ break;
+
+ case TOKEN_DOWN_RIGHT:
+ delete _sprites[DI_DOWNRIGHT];
+ _sprites[DI_DOWNRIGHT] = NULL;
+ spr = new BaseSprite(_gameRef, _owner);
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
+ cmd = PARSERR_GENERIC;
+ } else {
+ _sprites[DI_DOWNRIGHT] = spr;
+ }
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in SPRITESET definition");
+ return STATUS_FAILED;
+ }
+
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading SPRITESET definition");
+ if (spr) {
+ delete spr;
+ }
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSpriteSet::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_owner));
+ for (int i = 0; i < NUM_DIRECTIONS; i++) {
+ persistMgr->transfer("", &_sprites[i]);
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSprite *AdSpriteSet::getSprite(TDirection direction) {
+ int dir = (int)direction;
+ if (dir < 0) {
+ dir = 0;
+ }
+ if (dir >= NUM_DIRECTIONS) {
+ dir = NUM_DIRECTIONS - 1;
+ }
+
+ BaseSprite *ret = NULL;
+
+ // find nearest set sprite
+ int numSteps = 0;
+ for (int i = dir; i >= 0; i--) {
+ if (_sprites[i] != NULL) {
+ ret = _sprites[i];
+ numSteps = dir - i;
+ break;
+ }
+ }
+
+ for (int i = dir; i < NUM_DIRECTIONS; i++) {
+ if (_sprites[i] != NULL) {
+ if (ret == NULL || numSteps > i - dir) {
+ return _sprites[i];
+ } else {
+ return ret;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSpriteSet::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "SPRITESET {\n");
+ if (getName()) {
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ }
+ for (int i = 0; i < NUM_DIRECTIONS; i++) {
+ if (_sprites[i]) {
+ switch (i) {
+ case DI_UP:
+ buffer->putTextIndent(indent + 2, "UP=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_UPRIGHT:
+ buffer->putTextIndent(indent + 2, "UP_RIGHT=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_RIGHT:
+ buffer->putTextIndent(indent + 2, "RIGHT=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_DOWNRIGHT:
+ buffer->putTextIndent(indent + 2, "DOWN_RIGHT=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_DOWN:
+ buffer->putTextIndent(indent + 2, "DOWN=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_DOWNLEFT:
+ buffer->putTextIndent(indent + 2, "DOWN_LEFT=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_LEFT:
+ buffer->putTextIndent(indent + 2, "LEFT=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ case DI_UPLEFT:
+ buffer->putTextIndent(indent + 2, "UP_LEFT=\"%s\"\n", _sprites[i]->getFilename());
+ break;
+ }
+ }
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool AdSpriteSet::containsSprite(BaseSprite *sprite) {
+ if (!sprite) {
+ return false;
+ }
+
+ for (int i = 0; i < NUM_DIRECTIONS; i++) {
+ if (_sprites[i] == sprite) {
+ return true;
+ }
+ }
+ return false;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_sprite_set.h b/engines/wintermute/ad/ad_sprite_set.h
new file mode 100644
index 0000000000..ba5da0ff2e
--- /dev/null
+++ b/engines/wintermute/ad/ad_sprite_set.h
@@ -0,0 +1,53 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADSPRITESET_H
+#define WINTERMUTE_ADSPRITESET_H
+
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+class BaseSprite;
+class AdSpriteSet : public BaseObject {
+public:
+ bool containsSprite(BaseSprite *sprite);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
+ BaseSprite *getSprite(TDirection direction);
+ DECLARE_PERSISTENT(AdSpriteSet, BaseObject)
+ BaseObject *_owner;
+ AdSpriteSet(BaseGame *inGame, BaseObject *owner = NULL);
+ virtual ~AdSpriteSet();
+ bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ bool loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ BaseSprite *_sprites[NUM_DIRECTIONS];
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp
new file mode 100644
index 0000000000..a85cd7f986
--- /dev/null
+++ b/engines/wintermute/ad/ad_talk_def.cpp
@@ -0,0 +1,285 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_sprite_set.h"
+#include "engines/wintermute/ad/ad_talk_def.h"
+#include "engines/wintermute/ad/ad_talk_node.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/utils/utils.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdTalkDef, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdTalkDef::AdTalkDef(BaseGame *inGame) : BaseObject(inGame) {
+ _defaultSpriteFilename = NULL;
+ _defaultSprite = NULL;
+
+ _defaultSpriteSetFilename = NULL;
+ _defaultSpriteSet = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdTalkDef::~AdTalkDef() {
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ delete _nodes[i];
+ }
+ _nodes.clear();
+
+ delete[] _defaultSpriteFilename;
+ delete _defaultSprite;
+ _defaultSpriteFilename = NULL;
+ _defaultSprite = NULL;
+
+ delete[] _defaultSpriteSetFilename;
+ delete _defaultSpriteSet;
+ _defaultSpriteSetFilename = NULL;
+ _defaultSpriteSet = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkDef::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdTalkDef::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing TALK file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(TALK)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(ACTION)
+TOKEN_DEF(DEFAULT_SPRITESET_FILE)
+TOKEN_DEF(DEFAULT_SPRITESET)
+TOKEN_DEF(DEFAULT_SPRITE)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkDef::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(TALK)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(ACTION)
+ TOKEN_TABLE(DEFAULT_SPRITESET_FILE)
+ TOKEN_TABLE(DEFAULT_SPRITESET)
+ TOKEN_TABLE(DEFAULT_SPRITE)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TALK) {
+ _gameRef->LOG(0, "'TALK' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_ACTION: {
+ AdTalkNode *node = new AdTalkNode(_gameRef);
+ if (node && DID_SUCCEED(node->loadBuffer(params, false))) {
+ _nodes.add(node);
+ } else {
+ delete node;
+ node = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ }
+ break;
+
+ case TOKEN_DEFAULT_SPRITE:
+ BaseUtils::setString(&_defaultSpriteFilename, (char *)params);
+ break;
+
+ case TOKEN_DEFAULT_SPRITESET_FILE:
+ BaseUtils::setString(&_defaultSpriteSetFilename, (char *)params);
+ break;
+
+ case TOKEN_DEFAULT_SPRITESET: {
+ delete _defaultSpriteSet;
+ _defaultSpriteSet = new AdSpriteSet(_gameRef);
+ if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadBuffer(params, false))) {
+ delete _defaultSpriteSet;
+ _defaultSpriteSet = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ }
+ break;
+
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in TALK definition");
+ return STATUS_FAILED;
+ }
+
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading TALK definition");
+ return STATUS_FAILED;
+ }
+
+ delete _defaultSprite;
+ delete _defaultSpriteSet;
+ _defaultSprite = NULL;
+ _defaultSpriteSet = NULL;
+
+ if (_defaultSpriteFilename) {
+ _defaultSprite = new BaseSprite(_gameRef);
+ if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) {
+ return STATUS_FAILED;
+ }
+ }
+
+ if (_defaultSpriteSetFilename) {
+ _defaultSpriteSet = new AdSpriteSet(_gameRef);
+ if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) {
+ return STATUS_FAILED;
+ }
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkDef::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_defaultSprite));
+ persistMgr->transfer(TMEMBER(_defaultSpriteFilename));
+ persistMgr->transfer(TMEMBER(_defaultSpriteSet));
+ persistMgr->transfer(TMEMBER(_defaultSpriteSetFilename));
+
+ _nodes.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkDef::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "TALK {\n");
+ if (_defaultSpriteFilename) {
+ buffer->putTextIndent(indent + 2, "DEFAULT_SPRITE=\"%s\"\n", _defaultSpriteFilename);
+ }
+
+ if (_defaultSpriteSetFilename) {
+ buffer->putTextIndent(indent + 2, "DEFAULT_SPRITESET_FILE=\"%s\"\n", _defaultSpriteSetFilename);
+ } else if (_defaultSpriteSet) {
+ _defaultSpriteSet->saveAsText(buffer, indent + 2);
+ }
+
+ for (uint32 i = 0; i < _nodes.size(); i++) {
+ _nodes[i]->saveAsText(buffer, indent + 2);
+ buffer->putTextIndent(indent, "\n");
+ }
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkDef::loadDefaultSprite() {
+ if (_defaultSpriteFilename && !_defaultSprite) {
+ _defaultSprite = new BaseSprite(_gameRef);
+ if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) {
+ delete _defaultSprite;
+ _defaultSprite = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+ } else if (_defaultSpriteSetFilename && !_defaultSpriteSet) {
+ _defaultSpriteSet = new AdSpriteSet(_gameRef);
+ if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) {
+ delete _defaultSpriteSet;
+ _defaultSpriteSet = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSprite *AdTalkDef::getDefaultSprite(TDirection dir) {
+ loadDefaultSprite();
+ if (_defaultSprite) {
+ return _defaultSprite;
+ } else if (_defaultSpriteSet) {
+ return _defaultSpriteSet->getSprite(dir);
+ } else {
+ return NULL;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_talk_def.h b/engines/wintermute/ad/ad_talk_def.h
new file mode 100644
index 0000000000..d147212775
--- /dev/null
+++ b/engines/wintermute/ad/ad_talk_def.h
@@ -0,0 +1,58 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADTALKDEF_H
+#define WINTERMUTE_ADTALKDEF_H
+
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+class AdTalkNode;
+class AdSpriteSet;
+class AdTalkDef : public BaseObject {
+public:
+ char *_defaultSpriteSetFilename;
+ AdSpriteSet *_defaultSpriteSet;
+ BaseSprite *getDefaultSprite(TDirection Dir);
+ bool loadDefaultSprite();
+ DECLARE_PERSISTENT(AdTalkDef, BaseObject)
+
+ AdTalkDef(BaseGame *inGame);
+ virtual ~AdTalkDef();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ BaseArray<AdTalkNode *> _nodes;
+ char *_defaultSpriteFilename;
+ BaseSprite *_defaultSprite;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp
new file mode 100644
index 0000000000..cca4fdc2cb
--- /dev/null
+++ b/engines/wintermute/ad/ad_talk_holder.cpp
@@ -0,0 +1,402 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_talk_holder.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdTalkHolder, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdTalkHolder::AdTalkHolder(BaseGame *inGame) : AdObject(inGame) {
+ _sprite = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdTalkHolder::~AdTalkHolder() {
+ delete _sprite;
+ _sprite = NULL;
+
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ delete _talkSprites[i];
+ }
+ _talkSprites.clear();
+
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ delete _talkSpritesEx[i];
+ }
+ _talkSpritesEx.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSprite *AdTalkHolder::getTalkStance(const char *stance) {
+ BaseSprite *ret = NULL;
+
+
+ // forced stance?
+ if (_forcedTalkAnimName && !_forcedTalkAnimUsed) {
+ _forcedTalkAnimUsed = true;
+ delete _animSprite;
+ _animSprite = new BaseSprite(_gameRef, this);
+ if (_animSprite) {
+ bool res = _animSprite->loadFile(_forcedTalkAnimName);
+ if (DID_FAIL(res)) {
+ _gameRef->LOG(res, "AdTalkHolder::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", getName(), _forcedTalkAnimName);
+ delete _animSprite;
+ _animSprite = NULL;
+ } else {
+ return _animSprite;
+ }
+ }
+ }
+
+
+ if (stance != NULL) {
+ // search special talk stances
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ if (scumm_stricmp(_talkSpritesEx[i]->getName(), stance) == 0) {
+ ret = _talkSpritesEx[i];
+ break;
+ }
+ }
+ if (ret == NULL) {
+ // serach generic talk stances
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ if (scumm_stricmp(_talkSprites[i]->getName(), stance) == 0) {
+ ret = _talkSprites[i];
+ break;
+ }
+ }
+ }
+ }
+
+ // not a valid stance? get a random one
+ if (ret == NULL) {
+ if (_talkSprites.size() < 1) {
+ ret = _sprite;
+ } else {
+ // TODO: remember last
+ int rnd = BaseEngine::instance().randInt(0, _talkSprites.size() - 1);
+ ret = _talkSprites[rnd];
+ }
+ }
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetSprite
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetSprite") == 0) {
+ stack->correctParams(1);
+
+ ScValue *val = stack->pop();
+
+ bool setCurrent = false;
+ if (_currentSprite && _currentSprite == _sprite) {
+ setCurrent = true;
+ }
+
+ delete _sprite;
+ _sprite = NULL;
+
+ if (val->isNULL()) {
+ _sprite = NULL;
+ if (setCurrent) {
+ _currentSprite = NULL;
+ }
+ stack->pushBool(true);
+ } else {
+ const char *filename = val->getString();
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ script->runtimeError("SetSprite method failed for file '%s'", filename);
+ stack->pushBool(false);
+ } else {
+ _sprite = spr;
+ if (setCurrent) {
+ _currentSprite = _sprite;
+ }
+ stack->pushBool(true);
+ }
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSprite") == 0) {
+ stack->correctParams(0);
+
+ if (!_sprite || !_sprite->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_sprite->getFilename());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSpriteObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSpriteObject") == 0) {
+ stack->correctParams(0);
+
+ if (!_sprite) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_sprite, true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddTalkSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddTalkSprite") == 0) {
+ stack->correctParams(2);
+
+ const char *filename = stack->pop()->getString();
+ bool ex = stack->pop()->getBool();
+
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ stack->pushBool(false);
+ script->runtimeError("AddTalkSprite method failed for file '%s'", filename);
+ } else {
+ if (ex) {
+ _talkSpritesEx.add(spr);
+ } else {
+ _talkSprites.add(spr);
+ }
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveTalkSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveTalkSprite") == 0) {
+ stack->correctParams(2);
+
+ const char *filename = stack->pop()->getString();
+ bool ex = stack->pop()->getBool();
+
+ bool setCurrent = false;
+ bool setTemp2 = false;
+
+ if (ex) {
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ if (scumm_stricmp(_talkSpritesEx[i]->getFilename(), filename) == 0) {
+ if (_currentSprite == _talkSpritesEx[i]) {
+ setCurrent = true;
+ }
+ if (_tempSprite2 == _talkSpritesEx[i]) {
+ setTemp2 = true;
+ }
+ delete _talkSpritesEx[i];
+ _talkSpritesEx.remove_at(i);
+ break;
+ }
+ }
+ } else {
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ if (scumm_stricmp(_talkSprites[i]->getFilename(), filename) == 0) {
+ if (_currentSprite == _talkSprites[i]) {
+ setCurrent = true;
+ }
+ if (_tempSprite2 == _talkSprites[i]) {
+ setTemp2 = true;
+ }
+ delete _talkSprites[i];
+ _talkSprites.remove_at(i);
+ break;
+ }
+ }
+
+ }
+
+ stack->pushBool(true);
+ if (setCurrent) {
+ _currentSprite = _sprite;
+ }
+ if (setTemp2) {
+ _tempSprite2 = _sprite;
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetTalkSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetTalkSprite") == 0) {
+ stack->correctParams(2);
+
+ const char *filename = stack->pop()->getString();
+ bool ex = stack->pop()->getBool();
+ bool setCurrent = false;
+ bool setTemp2 = false;
+
+ BaseSprite *spr = new BaseSprite(_gameRef, this);
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
+ stack->pushBool(false);
+ script->runtimeError("SetTalkSprite method failed for file '%s'", filename);
+ } else {
+
+ // delete current
+ if (ex) {
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ if (_talkSpritesEx[i] == _currentSprite) {
+ setCurrent = true;
+ }
+ if (_talkSpritesEx[i] == _tempSprite2) {
+ setTemp2 = true;
+ }
+ delete _talkSpritesEx[i];
+ }
+ _talkSpritesEx.clear();
+ } else {
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ if (_talkSprites[i] == _currentSprite) {
+ setCurrent = true;
+ }
+ if (_talkSprites[i] == _tempSprite2) {
+ setTemp2 = true;
+ }
+ delete _talkSprites[i];
+ }
+ _talkSprites.clear();
+ }
+
+ // set new
+ if (ex) {
+ _talkSpritesEx.add(spr);
+ } else {
+ _talkSprites.add(spr);
+ }
+ stack->pushBool(true);
+
+ if (setCurrent) {
+ _currentSprite = spr;
+ }
+ if (setTemp2) {
+ _tempSprite2 = spr;
+ }
+ }
+ return STATUS_OK;
+ } else {
+ return AdObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdTalkHolder::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("talk-holder");
+ return _scValue;
+ } else {
+ return AdObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkHolder::scSetProperty(const char *name, ScValue *value) {
+ /*
+ //////////////////////////////////////////////////////////////////////////
+ // Item
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Item")==0){
+ SetItem(value->getString());
+ return STATUS_OK;
+ }
+
+ else*/ return AdObject::scSetProperty(name, value);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *AdTalkHolder::scToString() {
+ return "[talk-holder object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkHolder::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ for (uint32 i = 0; i < _talkSprites.size(); i++) {
+ if (_talkSprites[i]->getFilename()) {
+ buffer->putTextIndent(indent + 2, "TALK=\"%s\"\n", _talkSprites[i]->getFilename());
+ }
+ }
+
+ for (uint32 i = 0; i < _talkSpritesEx.size(); i++) {
+ if (_talkSpritesEx[i]->getFilename()) {
+ buffer->putTextIndent(indent + 2, "TALK_SPECIAL=\"%s\"\n", _talkSpritesEx[i]->getFilename());
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkHolder::persist(BasePersistenceManager *persistMgr) {
+ AdObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_sprite));
+ _talkSprites.persist(persistMgr);
+ _talkSpritesEx.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_talk_holder.h b/engines/wintermute/ad/ad_talk_holder.h
new file mode 100644
index 0000000000..d52ebf63c0
--- /dev/null
+++ b/engines/wintermute/ad/ad_talk_holder.h
@@ -0,0 +1,57 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADTALKHOLDER_H
+#define WINTERMUTE_ADTALKHOLDER_H
+
+#include "engines/wintermute/ad/ad_object.h"
+
+namespace Wintermute {
+
+class AdTalkHolder : public AdObject {
+public:
+ DECLARE_PERSISTENT(AdTalkHolder, AdObject)
+ virtual BaseSprite *getTalkStance(const char *stance);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ BaseSprite *_sprite;
+ BaseArray<BaseSprite *> _talkSprites;
+ BaseArray<BaseSprite *> _talkSpritesEx;
+ AdTalkHolder(BaseGame *inGame);
+ virtual ~AdTalkHolder();
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp
new file mode 100644
index 0000000000..c909ee27ff
--- /dev/null
+++ b/engines/wintermute/ad/ad_talk_node.cpp
@@ -0,0 +1,295 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_sprite_set.h"
+#include "engines/wintermute/ad/ad_talk_node.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/utils/utils.h"
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdTalkNode, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdTalkNode::AdTalkNode(BaseGame *inGame) : BaseClass(inGame) {
+ _sprite = NULL;
+ _spriteFilename = NULL;
+ _spriteSet = NULL;
+ _spriteSetFilename = NULL;
+ _comment = NULL;
+
+ _startTime = _endTime = 0;
+ _playToEnd = false;
+ _preCache = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdTalkNode::~AdTalkNode() {
+ delete[] _spriteFilename;
+ delete _sprite;
+ delete[] _spriteSetFilename;
+ delete _spriteSet;
+ delete _comment;
+ _spriteFilename = NULL;
+ _sprite = NULL;
+ _spriteSetFilename = NULL;
+ _spriteSet = NULL;
+ _comment = NULL;
+}
+
+
+
+TOKEN_DEF_START
+TOKEN_DEF(ACTION)
+TOKEN_DEF(SPRITESET_FILE)
+TOKEN_DEF(SPRITESET)
+TOKEN_DEF(SPRITE)
+TOKEN_DEF(START_TIME)
+TOKEN_DEF(END_TIME)
+TOKEN_DEF(COMMENT)
+TOKEN_DEF(PRECACHE)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkNode::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ACTION)
+ TOKEN_TABLE(SPRITESET_FILE)
+ TOKEN_TABLE(SPRITESET)
+ TOKEN_TABLE(SPRITE)
+ TOKEN_TABLE(START_TIME)
+ TOKEN_TABLE(END_TIME)
+ TOKEN_TABLE(COMMENT)
+ TOKEN_TABLE(PRECACHE)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTION) {
+ _gameRef->LOG(0, "'ACTION' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ _endTime = 0;
+ _playToEnd = false;
+ _preCache = false;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_SPRITE:
+ BaseUtils::setString(&_spriteFilename, (char *)params);
+ break;
+
+ case TOKEN_SPRITESET_FILE:
+ BaseUtils::setString(&_spriteSetFilename, (char *)params);
+ break;
+
+ case TOKEN_SPRITESET: {
+ delete _spriteSet;
+ _spriteSet = new AdSpriteSet(_gameRef);
+ if (!_spriteSet || DID_FAIL(_spriteSet->loadBuffer(params, false))) {
+ delete _spriteSet;
+ _spriteSet = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ }
+ break;
+
+ case TOKEN_START_TIME:
+ parser.scanStr((char *)params, "%d", &_startTime);
+ break;
+
+ case TOKEN_END_TIME:
+ parser.scanStr((char *)params, "%d", &_endTime);
+ break;
+
+ case TOKEN_PRECACHE:
+ parser.scanStr((char *)params, "%b", &_preCache);
+ break;
+
+ case TOKEN_COMMENT:
+ if (_gameRef->_editorMode) {
+ BaseUtils::setString(&_comment, (char *)params);
+ }
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ACTION definition");
+ return STATUS_FAILED;
+ }
+
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading ACTION definition");
+ return STATUS_FAILED;
+ }
+
+ if (_endTime == 0) {
+ _playToEnd = true;
+ } else {
+ _playToEnd = false;
+ }
+
+ if (_preCache && _spriteFilename) {
+ delete _sprite;
+ _sprite = new BaseSprite(_gameRef);
+ if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) {
+ return STATUS_FAILED;
+ }
+ }
+
+ if (_preCache && _spriteSetFilename) {
+ delete _spriteSet;
+ _spriteSet = new AdSpriteSet(_gameRef);
+ if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename))) {
+ return STATUS_FAILED;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkNode::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_comment));
+ persistMgr->transfer(TMEMBER(_startTime));
+ persistMgr->transfer(TMEMBER(_endTime));
+ persistMgr->transfer(TMEMBER(_playToEnd));
+ persistMgr->transfer(TMEMBER(_sprite));
+ persistMgr->transfer(TMEMBER(_spriteFilename));
+ persistMgr->transfer(TMEMBER(_spriteSet));
+ persistMgr->transfer(TMEMBER(_spriteSetFilename));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkNode::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "ACTION {\n");
+ if (_comment) {
+ buffer->putTextIndent(indent + 2, "COMMENT=\"%s\"\n", _comment);
+ }
+ buffer->putTextIndent(indent + 2, "START_TIME=%d\n", _startTime);
+ if (!_playToEnd) {
+ buffer->putTextIndent(indent + 2, "END_TIME=%d\n", _endTime);
+ }
+ if (_spriteFilename) {
+ buffer->putTextIndent(indent + 2, "SPRITE=\"%s\"\n", _spriteFilename);
+ }
+ if (_spriteSetFilename) {
+ buffer->putTextIndent(indent + 2, "SPRITESET_FILE=\"%s\"\n", _spriteSetFilename);
+ } else if (_spriteSet) {
+ _spriteSet->saveAsText(buffer, indent + 2);
+ }
+ if (_preCache) {
+ buffer->putTextIndent(indent + 2, "PRECACHE=\"%s\"\n", _preCache ? "TRUE" : "FALSE");
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkNode::loadSprite() {
+ if (_spriteFilename && !_sprite) {
+ _sprite = new BaseSprite(_gameRef);
+ if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) {
+ delete _sprite;
+ _sprite = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+ } else if (_spriteSetFilename && !_spriteSet) {
+ _spriteSet = new AdSpriteSet(_gameRef);
+ if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename))) {
+ delete _spriteSet;
+ _spriteSet = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdTalkNode::isInTimeInterval(uint32 time, TDirection dir) {
+ if (time >= _startTime) {
+ if (_playToEnd) {
+ if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->isFinished() == false)) {
+ return true;
+ } else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->isFinished() == false)) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return _endTime >= time;
+ }
+ } else {
+ return false;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSprite *AdTalkNode::getSprite(TDirection dir) {
+ loadSprite();
+ if (_sprite) {
+ return _sprite;
+ } else if (_spriteSet) {
+ return _spriteSet->getSprite(dir);
+ } else {
+ return NULL;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_talk_node.h b/engines/wintermute/ad/ad_talk_node.h
new file mode 100644
index 0000000000..7dfd861f85
--- /dev/null
+++ b/engines/wintermute/ad/ad_talk_node.h
@@ -0,0 +1,63 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADTALKNODE_H
+#define WINTERMUTE_ADTALKNODE_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+class AdSpriteSet;
+class BaseSprite;
+class AdTalkNode : public BaseClass {
+public:
+ char *_spriteSetFilename;
+ AdSpriteSet *_spriteSet;
+ BaseSprite *getSprite(TDirection dir);
+ bool isInTimeInterval(uint32 time, TDirection dir);
+ bool loadSprite();
+ DECLARE_PERSISTENT(AdTalkNode, BaseClass)
+
+ AdTalkNode(BaseGame *inGame);
+ virtual ~AdTalkNode();
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
+ char *_spriteFilename;
+ BaseSprite *_sprite;
+ uint32 _startTime;
+ uint32 _endTime;
+ bool _playToEnd;
+ bool _preCache;
+ char *_comment;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_types.h b/engines/wintermute/ad/ad_types.h
new file mode 100644
index 0000000000..ae5882f4ee
--- /dev/null
+++ b/engines/wintermute/ad/ad_types.h
@@ -0,0 +1,107 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADTYPES_H
+#define WINTERMUTE_ADTYPES_H
+
+namespace Wintermute {
+
+typedef enum {
+ GAME_NORMAL,
+ GAME_WAITING_RESPONSE
+} TGameStateEx;
+
+typedef enum {
+ OBJECT_ENTITY,
+ OBJECT_REGION,
+ OBJECT_ACTOR,
+ OBJECT_NONE
+} TObjectType;
+
+typedef enum {
+ ENTITY_NORMAL,
+ ENTITY_SOUND
+} TEntityType;
+
+typedef enum {
+ STATE_NONE,
+ STATE_IDLE,
+ STATE_PLAYING_ANIM,
+ STATE_READY,
+ STATE_FOLLOWING_PATH,
+ STATE_SEARCHING_PATH,
+ STATE_WAITING_PATH,
+ STATE_TURNING_LEFT,
+ STATE_TURNING_RIGHT,
+ STATE_TURNING,
+ STATE_TALKING,
+ STATE_DIRECT_CONTROL,
+ STATE_PLAYING_ANIM_SET
+} TObjectState;
+
+typedef enum {
+ DIRECT_WALK_NONE,
+ DIRECT_WALK_FW,
+ DIRECT_WALK_BK
+} TDirectWalkMode;
+
+typedef enum {
+ DIRECT_TURN_NONE,
+ DIRECT_TURN_CW,
+ DIRECT_TURN_CCW
+} TDirectTurnMode;
+
+typedef enum {
+ RESPONSE_TEXT,
+ RESPONSE_ICON
+} TResponseStyle;
+
+typedef enum {
+ RESPONSE_ALWAYS,
+ RESPONSE_ONCE,
+ RESPONSE_ONCE_GAME
+} TResponseType;
+
+
+typedef enum {
+ TALK_SKIP_LEFT = 0,
+ TALK_SKIP_RIGHT = 1,
+ TALK_SKIP_BOTH = 2,
+ TALK_SKIP_NONE = 3
+} TTalkSkipButton;
+
+typedef enum {
+ GEOM_WAYPOINT,
+ GEOM_WALKPLANE,
+ GEOM_BLOCKED,
+ GEOM_GENERIC
+} TGeomNodeType;
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp
new file mode 100644
index 0000000000..81493ce769
--- /dev/null
+++ b/engines/wintermute/ad/ad_waypoint_group.cpp
@@ -0,0 +1,270 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_waypoint_group.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include <limits.h>
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(AdWaypointGroup, false)
+
+//////////////////////////////////////////////////////////////////////////
+AdWaypointGroup::AdWaypointGroup(BaseGame *inGame) : BaseObject(inGame) {
+ _active = true;
+ _editorSelectedPoint = -1;
+ _lastMimicScale = -1;
+ _lastMimicX = _lastMimicY = INT_MIN;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AdWaypointGroup::~AdWaypointGroup() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void AdWaypointGroup::cleanup() {
+ for (uint32 i = 0; i < _points.size(); i++) {
+ delete _points[i];
+ }
+ _points.clear();
+ _editorSelectedPoint = -1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdWaypointGroup::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "AdWaypointGroup::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing WAYPOINTS file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(WAYPOINTS)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(POINT)
+TOKEN_DEF(EDITOR_SELECTED_POINT)
+TOKEN_DEF(EDITOR_SELECTED)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool AdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(WAYPOINTS)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(POINT)
+ TOKEN_TABLE(EDITOR_SELECTED_POINT)
+ TOKEN_TABLE(EDITOR_SELECTED)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_WAYPOINTS) {
+ _gameRef->LOG(0, "'WAYPOINTS' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_POINT: {
+ int x, y;
+ parser.scanStr((char *)params, "%d,%d", &x, &y);
+ _points.add(new BasePoint(x, y));
+ }
+ break;
+
+ case TOKEN_EDITOR_SELECTED:
+ parser.scanStr((char *)params, "%b", &_editorSelected);
+ break;
+
+ case TOKEN_EDITOR_SELECTED_POINT:
+ parser.scanStr((char *)params, "%d", &_editorSelectedPoint);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in WAYPOINTS definition");
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdWaypointGroup::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "WAYPOINTS {\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED_POINT=%d\n", _editorSelectedPoint);
+
+ if (_scProp) {
+ _scProp->saveAsText(buffer, indent + 2);
+ }
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ for (uint32 i = 0; i < _points.size(); i++) {
+ buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y);
+ }
+
+ buffer->putTextIndent(indent, "}\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdWaypointGroup::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transfer(TMEMBER(_editorSelectedPoint));
+ persistMgr->transfer(TMEMBER(_lastMimicScale));
+ persistMgr->transfer(TMEMBER(_lastMimicX));
+ persistMgr->transfer(TMEMBER(_lastMimicY));
+ _points.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *AdWaypointGroup::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("waypoint-group");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Active") {
+ _scValue->setBool(_active);
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdWaypointGroup::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Active") == 0) {
+ _active = value->getBool();
+ return STATUS_OK;
+ }
+
+ else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool AdWaypointGroup::mimic(AdWaypointGroup *wpt, float scale, int argX, int argY) {
+ if (scale == _lastMimicScale && argX == _lastMimicX && argY == _lastMimicY) {
+ return STATUS_OK;
+ }
+
+ cleanup();
+
+ for (uint32 i = 0; i < wpt->_points.size(); i++) {
+ int x = (int)((float)wpt->_points[i]->x * scale / 100.0f);
+ int y = (int)((float)wpt->_points[i]->y * scale / 100.0f);
+
+ _points.add(new BasePoint(x + argX, y + argY));
+ }
+
+ _lastMimicScale = scale;
+ _lastMimicX = argX;
+ _lastMimicY = argY;
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ad/ad_waypoint_group.h b/engines/wintermute/ad/ad_waypoint_group.h
new file mode 100644
index 0000000000..13d6bbadd7
--- /dev/null
+++ b/engines/wintermute/ad/ad_waypoint_group.h
@@ -0,0 +1,58 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_ADWAYPOINTGROUP_H
+#define WINTERMUTE_ADWAYPOINTGROUP_H
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+class BasePoint;
+class AdWaypointGroup : public BaseObject {
+public:
+ float _lastMimicScale;
+ int _lastMimicX;
+ int _lastMimicY;
+ void cleanup();
+ bool mimic(AdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0);
+ DECLARE_PERSISTENT(AdWaypointGroup, BaseObject)
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ bool _active;
+ AdWaypointGroup(BaseGame *inGame);
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual ~AdWaypointGroup();
+ BaseArray<BasePoint *> _points;
+ int _editorSelectedPoint;
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp
new file mode 100644
index 0000000000..e351792e61
--- /dev/null
+++ b/engines/wintermute/base/base.cpp
@@ -0,0 +1,185 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+BaseClass::BaseClass(BaseGame *gameOwner) {
+ _gameRef = gameOwner;
+ _persistable = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseClass::BaseClass() {
+ _gameRef = NULL;
+ _persistable = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseClass::~BaseClass() {
+ _editorProps.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+Common::String BaseClass::getEditorProp(const Common::String &propName, const Common::String &initVal) {
+ _editorPropsIter = _editorProps.find(propName);
+ if (_editorPropsIter != _editorProps.end()) {
+ return _editorPropsIter->_value.c_str();
+ } else {
+ return initVal;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseClass::setEditorProp(const Common::String &propName, const Common::String &propValue) {
+ if (propName.size() == 0) {
+ return STATUS_FAILED;
+ }
+
+ if (propValue.size() == 0) {
+ _editorProps.erase(propName);
+ } else {
+ _editorProps[propName] = propValue;
+ }
+ return STATUS_OK;
+}
+
+
+
+TOKEN_DEF_START
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(NAME)
+TOKEN_DEF(VALUE)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool BaseClass::parseEditorProperty(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(VALUE)
+ TOKEN_TABLE_END
+
+
+ if (!_gameRef->_editorMode) {
+ return STATUS_OK;
+ }
+
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_EDITOR_PROPERTY) {
+ _gameRef->LOG(0, "'EDITOR_PROPERTY' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ char *propName = NULL;
+ char *propValue = NULL;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_NAME:
+ delete[] propName;
+ propName = new char[strlen((char *)params) + 1];
+ if (propName) {
+ strcpy(propName, (char *)params);
+ } else {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_VALUE:
+ delete[] propValue;
+ propValue = new char[strlen((char *)params) + 1];
+ if (propValue) {
+ strcpy(propValue, (char *)params);
+ } else {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+ }
+
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ delete[] propName;
+ delete[] propValue;
+ propName = NULL;
+ propValue = NULL;
+ _gameRef->LOG(0, "Syntax error in EDITOR_PROPERTY definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC || propName == NULL || propValue == NULL) {
+ delete[] propName;
+ delete[] propValue;
+ propName = NULL;
+ propValue = NULL;
+ _gameRef->LOG(0, "Error loading EDITOR_PROPERTY definition");
+ return STATUS_FAILED;
+ }
+
+
+ setEditorProp(propName, propValue);
+
+ delete[] propName;
+ delete[] propValue;
+ propName = NULL;
+ propValue = NULL;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseClass::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ _editorPropsIter = _editorProps.begin();
+ while (_editorPropsIter != _editorProps.end()) {
+ buffer->putTextIndent(indent, "EDITOR_PROPERTY\n");
+ buffer->putTextIndent(indent, "{\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _editorPropsIter->_key.c_str());
+ buffer->putTextIndent(indent + 2, "VALUE=\"%s\"\n", _editorPropsIter->_value.c_str());
+ buffer->putTextIndent(indent, "}\n\n");
+
+ _editorPropsIter++;
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h
new file mode 100644
index 0000000000..24820c748a
--- /dev/null
+++ b/engines/wintermute/base/base.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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_BASE_H
+#define WINTERMUTE_BASE_BASE_H
+
+#include "engines/wintermute/wintypes.h"
+#include "engines/wintermute/dctypes.h"
+#include "common/str.h"
+#include "common/hashmap.h"
+#include "common/hash-str.h"
+
+namespace Wintermute {
+
+class BaseGame;
+class BaseDynamicBuffer;
+
+class BaseClass {
+public:
+ bool _persistable;
+ bool setEditorProp(const Common::String &propName, const Common::String &propValue);
+ Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = NULL);
+ BaseClass(TDynamicConstructor, TDynamicConstructor) {}
+ bool parseEditorProperty(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
+ BaseClass();
+ BaseClass(BaseGame *GameOwner);
+ virtual ~BaseClass();
+ BaseGame *_gameRef;
+protected:
+ Common::HashMap<Common::String, Common::String> _editorProps;
+ Common::HashMap<Common::String, Common::String>::iterator _editorPropsIter;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp
new file mode 100644
index 0000000000..4addf15be8
--- /dev/null
+++ b/engines/wintermute/base/base_active_rect.cpp
@@ -0,0 +1,111 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/platform_osystem.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) {
+ BasePlatform::setRectEmpty(&_rect);
+ _owner = NULL;
+ _frame = NULL;
+ _region = NULL;
+ _zoomX = 100;
+ _zoomY = 100;
+ _offsetX = _offsetY = 0;
+ clipRect();
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX, float zoomY, bool precise) : BaseClass(inGame) {
+ _owner = owner;
+ _frame = frame;
+ BasePlatform::setRect(&_rect, x, y, x + width, y + height);
+ _zoomX = zoomX;
+ _zoomY = zoomY;
+ _precise = precise;
+ _region = NULL;
+ _offsetX = _offsetY = 0;
+ clipRect();
+}
+
+//////////////////////////////////////////////////////////////////////
+BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *region, int offsetX, int offsetY) : BaseClass(inGame) {
+ _owner = owner;
+ _region = region;
+ BasePlatform::copyRect(&_rect, &region->_rect);
+ _rect.offsetRect(-offsetX, -offsetY);
+ _zoomX = 100;
+ _zoomY = 100;
+ _precise = true;
+ _frame = NULL;
+ clipRect();
+ _offsetX = offsetX;
+ _offsetY = offsetY;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseActiveRect::~BaseActiveRect() {
+ _owner = NULL;
+ _frame = NULL;
+ _region = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseActiveRect::clipRect() {
+ Rect32 rc;
+ bool customViewport;
+ _gameRef->getCurrentViewportRect(&rc, &customViewport);
+ BaseRenderer *Rend = _gameRef->_renderer;
+
+ if (!customViewport) {
+ rc.left -= Rend->_drawOffsetX;
+ rc.right -= Rend->_drawOffsetX;
+ rc.top -= Rend->_drawOffsetY;
+ rc.bottom -= Rend->_drawOffsetY;
+ }
+
+ if (rc.left > _rect.left) {
+ _offsetX = rc.left - _rect.left;
+ }
+ if (rc.top > _rect.top) {
+ _offsetY = rc.top - _rect.top;
+ }
+
+ BasePlatform::intersectRect(&_rect, &_rect, &rc);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h
new file mode 100644
index 0000000000..fcd2619b03
--- /dev/null
+++ b/engines/wintermute/base/base_active_rect.h
@@ -0,0 +1,60 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_ACTIVE_RECT_H
+#define WINTERMUTE_BASE_ACTIVE_RECT_H
+
+#include "engines/wintermute/math/rect32.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+class BaseRegion;
+class BaseSubFrame;
+class BaseObject;
+class BaseActiveRect: BaseClass {
+public:
+ void clipRect();
+ bool _precise;
+ float _zoomX;
+ float _zoomY;
+ BaseSubFrame *_frame;
+ BaseObject *_owner;
+ BaseRegion *_region;
+ int _offsetX;
+ int _offsetY;
+ Rect32 _rect;
+ BaseActiveRect(BaseGame *inGameOwner = NULL);
+ BaseActiveRect(BaseGame *inGameOwner, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX = 100, float zoomY = 100, bool precise = true);
+ BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *region, int offsetX, int offsetY);
+ virtual ~BaseActiveRect();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp
new file mode 100644
index 0000000000..fc48e93c2b
--- /dev/null
+++ b/engines/wintermute/base/base_dynamic_buffer.cpp
@@ -0,0 +1,204 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseDynamicBuffer::BaseDynamicBuffer(BaseGame *inGame, uint32 initSize, uint32 growBy) {
+ _buffer = NULL;
+ _size = 0;
+ _realSize = 0;
+
+ _offset = 0;
+ _initSize = initSize;
+ _growBy = growBy;
+
+ _initialized = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseDynamicBuffer::~BaseDynamicBuffer() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseDynamicBuffer::cleanup() {
+ if (_buffer) {
+ free(_buffer);
+ }
+ _buffer = NULL;
+ _size = 0;
+ _realSize = 0;
+ _offset = 0;
+ _initialized = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseDynamicBuffer::getSize() {
+ return _size;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseDynamicBuffer::init(uint32 initSize) {
+ cleanup();
+
+ if (initSize == 0) {
+ initSize = _initSize;
+ }
+
+ _buffer = (byte *)malloc(initSize);
+ if (!_buffer) {
+ BaseEngine::LOG(0, "BaseDynamicBuffer::Init - Error allocating %d bytes", initSize);
+ return STATUS_FAILED;
+ }
+
+ _realSize = initSize;
+ _initialized = true;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseDynamicBuffer::putBytes(const byte *buffer, uint32 size) {
+ if (!_initialized) {
+ init();
+ }
+
+ while (_offset + size > _realSize) {
+ _realSize += _growBy;
+ _buffer = (byte *)realloc(_buffer, _realSize);
+ if (!_buffer) {
+ BaseEngine::LOG(0, "BaseDynamicBuffer::PutBytes - Error reallocating buffer to %d bytes", _realSize);
+ return STATUS_FAILED;
+ }
+ }
+
+ memcpy(_buffer + _offset, buffer, size);
+ _offset += size;
+ _size += size;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseDynamicBuffer::getBytes(byte *buffer, uint32 size) {
+ if (!_initialized) {
+ init();
+ }
+
+ if (_offset + size > _size) {
+ BaseEngine::LOG(0, "BaseDynamicBuffer::GetBytes - Buffer underflow");
+ return STATUS_FAILED;
+ }
+
+ memcpy(buffer, _buffer + _offset, size);
+ _offset += size;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseDynamicBuffer::putDWORD(uint32 val) {
+ putBytes((byte *)&val, sizeof(uint32));
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseDynamicBuffer::getDWORD() {
+ uint32 ret;
+ getBytes((byte *)&ret, sizeof(uint32));
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseDynamicBuffer::putString(const char *val) {
+ if (!val) {
+ putString("(null)");
+ } else {
+ putDWORD(strlen(val) + 1);
+ putBytes((const byte *)val, strlen(val) + 1);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *BaseDynamicBuffer::getString() {
+ uint32 len = getDWORD();
+ char *ret = (char *)(_buffer + _offset);
+ _offset += len;
+
+ if (!strcmp(ret, "(null)")) {
+ return NULL;
+ } else {
+ return ret;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseDynamicBuffer::putText(const char *fmt, ...) {
+ va_list va;
+
+ va_start(va, fmt);
+ putTextForm(fmt, va);
+ va_end(va);
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseDynamicBuffer::putTextIndent(int indent, const char *fmt, ...) {
+ va_list va;
+
+ putText("%*s", indent, "");
+
+ va_start(va, fmt);
+ putTextForm(fmt, va);
+ va_end(va);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseDynamicBuffer::putTextForm(const char *format, va_list argptr) {
+ char buff[32768];
+ vsprintf(buff, format, argptr);
+ putBytes((byte *)buff, strlen(buff));
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h
new file mode 100644
index 0000000000..2d1a7fbe48
--- /dev/null
+++ b/engines/wintermute/base/base_dynamic_buffer.h
@@ -0,0 +1,65 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_DYNAMIC_BUFFER_H
+#define WINTERMUTE_BASE_DYNAMIC_BUFFER_H
+
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BaseDynamicBuffer {
+public:
+ void putText(const char *fmt, ...);
+ void putTextIndent(int indent, const char *fmt, ...);
+ uint32 getDWORD();
+ void putDWORD(uint32 val);
+ char *getString();
+ void putString(const char *val);
+ bool getBytes(byte *buffer, uint32 size);
+ bool putBytes(const byte *buffer, uint32 size);
+ uint32 getSize();
+ bool init(uint32 initSize = 0);
+ void cleanup();
+ BaseDynamicBuffer(BaseGame *inGame, uint32 initSize = 1000, uint32 growBy = 1000);
+ virtual ~BaseDynamicBuffer();
+
+private:
+ uint32 _size;
+ byte *_buffer;
+ bool _initialized;
+ uint32 _realSize;
+ uint32 _growBy;
+ uint32 _initSize;
+ uint32 _offset;
+ void putTextForm(const char *format, va_list argptr);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp
new file mode 100644
index 0000000000..8146d14beb
--- /dev/null
+++ b/engines/wintermute/base/base_engine.cpp
@@ -0,0 +1,93 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/system/sys_class_registry.h"
+#include "common/system.h"
+namespace Common {
+DECLARE_SINGLETON(Wintermute::BaseEngine);
+}
+
+namespace Wintermute {
+
+BaseEngine::BaseEngine() {
+ _fileManager = NULL;
+ _gameRef = NULL;
+ _classReg = NULL;
+ _rnd = NULL;
+ _gameId = "";
+}
+
+void BaseEngine::init(Common::Language lang) {
+ _fileManager = new BaseFileManager(lang);
+ // Don't forget to register your random source
+ _rnd = new Common::RandomSource("Wintermute");
+ _classReg = new SystemClassRegistry();
+ _classReg->registerClasses();
+}
+
+BaseEngine::~BaseEngine() {
+ delete _fileManager;
+ delete _rnd;
+ delete _classReg;
+}
+
+void BaseEngine::createInstance(const Common::String &gameid, Common::Language lang) {
+ instance()._gameId = gameid;
+ instance().init(lang);
+}
+
+void BaseEngine::LOG(bool res, const char *fmt, ...) {
+ uint32 secs = g_system->getMillis() / 1000;
+ uint32 hours = secs / 3600;
+ secs = secs % 3600;
+ uint32 mins = secs / 60;
+ secs = secs % 60;
+
+ char buff[512];
+ va_list va;
+
+ va_start(va, fmt);
+ vsprintf(buff, fmt, va);
+ va_end(va);
+
+ if (instance()._gameRef) {
+ instance()._gameRef->LOG("%s", buff);
+ } else {
+ debugCN(kWintermuteDebugLog, "%02d:%02d:%02d: %s\n", hours, mins, secs, buff);
+ }
+}
+
+uint32 BaseEngine::randInt(int from, int to) {
+ return _rnd->getRandomNumberRng(from, to);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h
new file mode 100644
index 0000000000..1ed0e3ab01
--- /dev/null
+++ b/engines/wintermute/base/base_engine.h
@@ -0,0 +1,69 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_ENGINE_H
+#define WINTERMUTE_BASE_ENGINE_H
+
+#include "common/str.h"
+#include "common/singleton.h"
+#include "common/random.h"
+#include "common/language.h"
+
+namespace Wintermute {
+
+class BaseFileManager;
+class BaseRegistry;
+class BaseGame;
+class SystemClassRegistry;
+class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
+ void init(Common::Language lang);
+ BaseFileManager *_fileManager;
+ Common::String _gameId;
+ BaseGame *_gameRef;
+ // We need random numbers
+ Common::RandomSource *_rnd;
+ SystemClassRegistry *_classReg;
+public:
+ BaseEngine();
+ ~BaseEngine();
+ static void createInstance(const Common::String &gameid, Common::Language lang);
+ void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; }
+
+ Common::RandomSource *getRandomSource() { return _rnd; }
+ uint32 randInt(int from, int to);
+
+ SystemClassRegistry *getClassRegistry(){ return _classReg; }
+ BaseGame *getGameRef() { return _gameRef; }
+ BaseFileManager *getFileManager() { return _fileManager; }
+ static void LOG(bool res, const char *fmt, ...);
+ const char *getGameId() { return _gameId.c_str(); }
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp
new file mode 100644
index 0000000000..985718fcab
--- /dev/null
+++ b/engines/wintermute/base/base_fader.cpp
@@ -0,0 +1,195 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_fader.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "common/util.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(BaseFader, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseFader::BaseFader(BaseGame *inGame) : BaseObject(inGame) {
+ _active = false;
+ _red = _green = _blue = 0;
+ _currentAlpha = 0x00;
+ _sourceAlpha = 0;
+ _targetAlpha = 0;
+ _duration = 1000;
+ _startTime = 0;
+ _system = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseFader::~BaseFader() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFader::update() {
+ if (!_active) {
+ return STATUS_OK;
+ }
+
+ int alphaDelta = _targetAlpha - _sourceAlpha;
+
+ uint32 time;
+
+ if (_system) {
+ time = g_system->getMillis() - _startTime;
+ } else {
+ time = _gameRef->_timer - _startTime;
+ }
+
+ if (time >= _duration) {
+ _currentAlpha = _targetAlpha;
+ } else {
+ _currentAlpha = (byte)(_sourceAlpha + (float)time / (float)_duration * alphaDelta);
+ }
+ _currentAlpha = MIN((unsigned char)255, MAX(_currentAlpha, (byte)0)); // TODO: clean
+
+ _ready = time >= _duration;
+ if (_ready && _currentAlpha == 0x00) {
+ _active = false;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFader::display() {
+ if (!_active) {
+ return STATUS_OK;
+ }
+
+ if (_currentAlpha > 0x00) {
+ _gameRef->_renderer->fadeToColor(_red, _green, _blue, _currentAlpha);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFader::deactivate() {
+ _active = false;
+ _ready = true;
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) {
+ _ready = false;
+ _active = true;
+
+ _red = RGBCOLGetR(sourceColor);
+ _green = RGBCOLGetG(sourceColor);
+ _blue = RGBCOLGetB(sourceColor);
+
+ _sourceAlpha = RGBCOLGetA(sourceColor);
+ _targetAlpha = 0;
+
+ _duration = duration;
+ _system = system;
+
+ if (_system) {
+ _startTime = g_system->getMillis();
+ } else {
+ _startTime = _gameRef->_timer;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFader::fadeOut(uint32 targetColor, uint32 duration, bool system) {
+ _ready = false;
+ _active = true;
+
+ _red = RGBCOLGetR(targetColor);
+ _green = RGBCOLGetG(targetColor);
+ _blue = RGBCOLGetB(targetColor);
+
+ //_sourceAlpha = 0;
+ _sourceAlpha = _currentAlpha;
+ _targetAlpha = RGBCOLGetA(targetColor);
+
+ _duration = duration;
+ _system = system;
+
+ if (_system) {
+ _startTime = g_system->getMillis();
+ } else {
+ _startTime = _gameRef->_timer;
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseFader::getCurrentColor() {
+ return BYTETORGBA(_red, _green, _blue, _currentAlpha);
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFader::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transfer(TMEMBER(_blue));
+ persistMgr->transfer(TMEMBER(_currentAlpha));
+ persistMgr->transfer(TMEMBER(_duration));
+ persistMgr->transfer(TMEMBER(_green));
+ persistMgr->transfer(TMEMBER(_red));
+ persistMgr->transfer(TMEMBER(_sourceAlpha));
+ persistMgr->transfer(TMEMBER(_startTime));
+ persistMgr->transfer(TMEMBER(_targetAlpha));
+ persistMgr->transfer(TMEMBER(_system));
+
+ if (_system && !persistMgr->getIsSaving()) {
+ _startTime = 0;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h
new file mode 100644
index 0000000000..116c8c963d
--- /dev/null
+++ b/engines/wintermute/base/base_fader.h
@@ -0,0 +1,63 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FADER_H
+#define WINTERMUTE_BASE_FADER_H
+
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class BaseFader : public BaseObject {
+public:
+ uint32 getCurrentColor();
+ bool fadeOut(uint32 targetColor, uint32 duration, bool system = false);
+ bool fadeIn(uint32 sourceColor, uint32 duration, bool system = false);
+ bool deactivate();
+ bool display();
+ bool update();
+ DECLARE_PERSISTENT(BaseFader, BaseObject)
+ BaseFader(BaseGame *inGame);
+ virtual ~BaseFader();
+private:
+ bool _system;
+ bool _active;
+ byte _red;
+ byte _green;
+ byte _blue;
+ byte _currentAlpha;
+ byte _targetAlpha;
+ byte _sourceAlpha;
+ uint32 _duration;
+ uint32 _startTime;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
new file mode 100644
index 0000000000..b726c0c66f
--- /dev/null
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -0,0 +1,340 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+#include "engines/wintermute/base/file/base_disk_file.h"
+#include "engines/wintermute/base/file/base_save_thumb_file.h"
+#include "engines/wintermute/base/file/base_package.h"
+#include "engines/wintermute/base/file/base_resources.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/debug.h"
+#include "common/str.h"
+#include "common/tokenizer.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "common/config-manager.h"
+#include "common/system.h"
+#include "common/fs.h"
+#include "common/file.h"
+#include "common/savefile.h"
+#include "common/fs.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+BaseFileManager::BaseFileManager(Common::Language lang) {
+ _language = lang;
+ initPaths();
+ registerPackages();
+}
+
+//////////////////////////////////////////////////////////////////////
+BaseFileManager::~BaseFileManager() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFileManager::cleanup() {
+ // delete registered paths
+ _packagePaths.clear();
+
+ // close open files
+ for (uint32 i = 0; i < _openFiles.size(); i++) {
+ delete _openFiles[i];
+ }
+ _openFiles.clear();
+
+ // delete packages
+ _packages.clear();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+byte *BaseFileManager::readWholeFile(const Common::String &filename, uint32 *size, bool mustExist) {
+ byte *buffer = NULL;
+
+ Common::SeekableReadStream *file = openFile(filename);
+ if (!file) {
+ if (mustExist) {
+ debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error opening file '%s'", filename.c_str());
+ }
+ return NULL;
+ }
+
+ buffer = new byte[file->size() + 1];
+ if (buffer == NULL) {
+ debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error allocating buffer for file '%s' (%d bytes)", filename.c_str(), file->size() + 1);
+ closeFile(file);
+ return NULL;
+ }
+
+ if (file->read(buffer, (uint32)file->size()) != (uint32)file->size()) {
+ debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error reading file '%s'", filename.c_str());
+ closeFile(file);
+ delete[] buffer;
+ return NULL;
+ };
+
+ buffer[file->size()] = '\0';
+ if (size != NULL) {
+ *size = file->size();
+ }
+ closeFile(file);
+
+ return buffer;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFileManager::addPath(TPathType type, const Common::FSNode &path) {
+ if (!path.exists()) {
+ return STATUS_FAILED;
+ }
+
+ switch (type) {
+ case PATH_SINGLE:
+ // _singlePaths.push_back(path);
+ error("TODO: Allow adding single-paths");
+ break;
+ case PATH_PACKAGE:
+ _packagePaths.push_back(path);
+ break;
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFileManager::reloadPaths() {
+ // delete registered paths
+ //_singlePaths.clear();
+ _packagePaths.clear();
+
+ return initPaths();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFileManager::initPaths() {
+ // Removed: Config-based file-path choice.
+
+ // package files paths
+ const Common::FSNode gameData(ConfMan.get("path"));
+ addPath(PATH_PACKAGE, gameData);
+
+ Common::FSNode dataSubFolder = gameData.getChild("data");
+ if (dataSubFolder.exists()) {
+ addPath(PATH_PACKAGE, dataSubFolder);
+ }
+ Common::FSNode languageSubFolder = gameData.getChild("language");
+ if (languageSubFolder.exists()) {
+ addPath(PATH_PACKAGE, languageSubFolder);
+ }
+ return STATUS_OK;
+}
+
+bool BaseFileManager::registerPackages(const Common::FSList &fslist) {
+ for (Common::FSList::const_iterator it = fslist.begin(); it != fslist.end(); ++it) {
+ debugC(kWintermuteDebugFileAccess, "Adding %s", (*it).getName().c_str());
+ if ((*it).getName().contains(".dcp")) {
+ if (registerPackage((*it))) {
+ addPath(PATH_PACKAGE, (*it));
+ }
+ }
+ }
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFileManager::registerPackages() {
+ debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Scanning packages");
+
+ // Register without using SearchMan, as otherwise the FSNode-based lookup in openPackage will fail
+ // and that has to be like that to support the detection-scheme.
+ Common::FSList files;
+ for (Common::FSList::iterator it = _packagePaths.begin(); it != _packagePaths.end(); ++it) {
+ debugC(kWintermuteDebugFileAccess, "Should register folder: %s %s", (*it).getPath().c_str(), (*it).getName().c_str());
+ (*it).getChildren(files, Common::FSNode::kListFilesOnly);
+ for (Common::FSList::iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
+ if (!fileIt->getName().hasSuffix(".dcp")) {
+ continue;
+ }
+ // Avoid registering all the language files
+ // TODO: Select based on the gameDesc.
+ if (_language != Common::UNK_LANG && fileIt->getParent().getName() == "language") {
+ Common::String parentName = fileIt->getParent().getName();
+ Common::String dcpName = fileIt->getName();
+ if (_language == Common::EN_ANY && fileIt->getName() != "english.dcp") {
+ continue;
+ } else if (_language == Common::CZ_CZE && fileIt->getName() != "czech.dcp") {
+ continue;
+ } else if (_language == Common::IT_ITA && fileIt->getName() != "italian.dcp") {
+ continue;
+ } else if (_language == Common::PL_POL && fileIt->getName() != "polish.dcp") {
+ continue;
+ } else if (_language == Common::RU_RUS && fileIt->getName() != "russian.dcp") {
+ continue;
+ }
+ }
+ debugC(kWintermuteDebugFileAccess, "Registering %s %s", (*fileIt).getPath().c_str(), (*fileIt).getName().c_str());
+ registerPackage((*fileIt));
+ }
+ }
+
+// debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, " Registered %d files in %d package(s)", _files.size(), _packages.size());
+
+ return STATUS_OK;
+}
+
+bool BaseFileManager::registerPackage(Common::FSNode file, const Common::String &filename, bool searchSignature) {
+ PackageSet *pack = new PackageSet(file, filename, searchSignature);
+ _packages.add(file.getName(), pack, pack->getPriority() , true);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &filename) {
+ Common::String upcName = filename;
+ upcName.toUppercase();
+ Common::SeekableReadStream *file = NULL;
+ char fileName[MAX_PATH_LENGTH];
+ strcpy(fileName, upcName.c_str());
+
+ // correct slashes
+ for (uint32 i = 0; i < upcName.size(); i++) {
+ if (upcName[(int32)i] == '/') {
+ upcName.setChar('\\', (uint32)i);
+ }
+ }
+ Common::ArchiveMemberPtr entry = _packages.getMember(upcName);
+ if (!entry) {
+ return NULL;
+ }
+ file = entry->createReadStream();
+ return file;
+}
+
+bool BaseFileManager::hasFile(const Common::String &filename) {
+ if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
+ BasePersistenceManager pm(BaseEngine::instance().getGameId());
+ if (filename.size() <= 9) {
+ return false;
+ }
+ int slot = atoi(filename.c_str() + 9);
+ return pm.getSaveExists(slot);
+ }
+ if (diskFileExists(filename)) {
+ return true;
+ }
+ if (_packages.hasFile(filename)) {
+ return true; // We don't bother checking if the file can actually be opened, something bigger is wrong if that is the case.
+ }
+ if (BaseResources::hasFile(filename)) {
+ return true;
+ }
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+Common::SeekableReadStream *BaseFileManager::openFile(const Common::String &filename, bool absPathWarning, bool keepTrackOf) {
+ if (strcmp(filename.c_str(), "") == 0) {
+ return NULL;
+ }
+ debugC(kWintermuteDebugFileAccess, "Open file %s", filename.c_str());
+
+ Common::SeekableReadStream *file = openFileRaw(filename);
+ if (file && keepTrackOf) {
+ _openFiles.push_back(file);
+ }
+ return file;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFileManager::closeFile(Common::SeekableReadStream *File) {
+ for (uint32 i = 0; i < _openFiles.size(); i++) {
+ if (_openFiles[i] == File) {
+ delete _openFiles[i];
+ _openFiles.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &filename) {
+ Common::SeekableReadStream *ret = NULL;
+
+ if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
+ if (!BaseEngine::instance().getGameRef()) {
+ error("Attempt to load filename: %s without BaseEngine-object, this is unsupported", filename.c_str());
+ }
+ BaseSaveThumbFile *saveThumbFile = new BaseSaveThumbFile();
+ if (DID_SUCCEED(saveThumbFile->open(filename))) {
+ ret = saveThumbFile->getMemStream();
+ }
+ delete saveThumbFile;
+ return ret;
+ }
+
+ ret = openDiskFile(filename);
+ if (ret) {
+ return ret;
+ }
+
+ ret = openPkgFile(filename);
+ if (ret) {
+ return ret;
+ }
+
+ ret = BaseResources::getFile(filename);
+ if (ret) {
+ return ret;
+ }
+
+ debugC(kWintermuteDebugFileAccess ,"BFileManager::OpenFileRaw - Failed to open %s", filename.c_str());
+ return NULL;
+}
+
+BaseFileManager *BaseFileManager::getEngineInstance() {
+ if (BaseEngine::instance().getFileManager()) {
+ return BaseEngine::instance().getFileManager();
+ }
+ return NULL;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h
new file mode 100644
index 0000000000..70aff49bbb
--- /dev/null
+++ b/engines/wintermute/base/base_file_manager.h
@@ -0,0 +1,76 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FILE_MANAGER_H
+#define WINTERMUTE_BASE_FILE_MANAGER_H
+
+#include "common/archive.h"
+#include "common/str.h"
+#include "common/fs.h"
+#include "common/file.h"
+#include "common/language.h"
+
+namespace Wintermute {
+class BaseFileManager {
+public:
+ bool cleanup();
+
+ bool closeFile(Common::SeekableReadStream *File);
+ bool hasFile(const Common::String &filename);
+ Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true);
+ byte *readWholeFile(const Common::String &filename, uint32 *size = NULL, bool mustExist = true);
+
+ BaseFileManager(Common::Language lang);
+ virtual ~BaseFileManager();
+ // Used only for detection
+ bool registerPackages(const Common::FSList &fslist);
+ static BaseFileManager *getEngineInstance();
+private:
+ typedef enum {
+ PATH_PACKAGE,
+ PATH_SINGLE
+ } TPathType;
+ bool reloadPaths();
+ bool initPaths();
+ bool addPath(TPathType type, const Common::FSNode &path);
+ bool registerPackages();
+ Common::SeekableReadStream *openFileRaw(const Common::String &filename);
+ Common::SeekableReadStream *openPkgFile(const Common::String &filename);
+ Common::FSList _packagePaths;
+ bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset);
+ bool registerPackage(Common::FSNode package, const Common::String &filename = "", bool searchSignature = false);
+ Common::SearchSet _packages;
+ Common::Array<Common::SeekableReadStream *> _openFiles;
+ Common::Language _language;
+ // This class is intentionally not a subclass of Base, as it needs to be used by
+ // the detector too, without launching the entire engine:
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp
new file mode 100644
index 0000000000..7c64144480
--- /dev/null
+++ b/engines/wintermute/base/base_frame.cpp
@@ -0,0 +1,766 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_frame.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseFrame, false)
+
+//////////////////////////////////////////////////////////////////////
+BaseFrame::BaseFrame(BaseGame *inGame) : BaseScriptable(inGame, true) {
+ _delay = 0;
+ _moveX = _moveY = 0;
+
+ _sound = NULL;
+ _killSound = false;
+
+ _editorExpanded = false;
+ _keyframe = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseFrame::~BaseFrame() {
+ delete _sound;
+ _sound = NULL;
+
+ for (uint32 i = 0; i < _subframes.size(); i++) {
+ delete _subframes[i];
+ }
+ _subframes.clear();
+
+ for (uint32 i = 0; i < _applyEvent.size(); i++) {
+ delete[] _applyEvent[i];
+ _applyEvent[i] = NULL;
+ }
+ _applyEvent.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, bool allFrames, float rotate, TSpriteBlendMode blendMode) {
+ bool res;
+
+ for (uint32 i = 0; i < _subframes.size(); i++) {
+ res = _subframes[i]->draw(x, y, registerOwner, zoomX, zoomY, precise, alpha, rotate, blendMode);
+ if (DID_FAIL(res)) {
+ return res;
+ }
+ }
+ return STATUS_OK;
+}
+
+void BaseFrame::stopSound() {
+ if (_sound) {
+ _sound->stop();
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFrame::oneTimeDisplay(BaseObject *owner, bool muted) {
+ if (_sound && !muted) {
+ if (owner) {
+ owner->updateOneSound(_sound);
+ }
+ _sound->play();
+ /*
+ if (_gameRef->_state == GAME_FROZEN) {
+ _sound->Pause(true);
+ }
+ */
+ }
+ if (owner) {
+ for (uint32 i = 0; i < _applyEvent.size(); i++) {
+ owner->applyEvent(_applyEvent[i]);
+ }
+ }
+ return STATUS_OK;
+}
+
+
+
+TOKEN_DEF_START
+TOKEN_DEF(DELAY)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(TRANSPARENT)
+TOKEN_DEF(RECT)
+TOKEN_DEF(HOTSPOT)
+TOKEN_DEF(2D_ONLY)
+TOKEN_DEF(3D_ONLY)
+TOKEN_DEF(MIRROR_X)
+TOKEN_DEF(MIRROR_Y)
+TOKEN_DEF(MOVE)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(SUBFRAME)
+TOKEN_DEF(SOUND)
+TOKEN_DEF(KEYFRAME)
+TOKEN_DEF(DECORATION)
+TOKEN_DEF(APPLY_EVENT)
+TOKEN_DEF(EDITOR_SELECTED)
+TOKEN_DEF(EDITOR_EXPANDED)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(KILL_SOUND)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////
+bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(DELAY)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(TRANSPARENT)
+ TOKEN_TABLE(RECT)
+ TOKEN_TABLE(HOTSPOT)
+ TOKEN_TABLE(2D_ONLY)
+ TOKEN_TABLE(3D_ONLY)
+ TOKEN_TABLE(MIRROR_X)
+ TOKEN_TABLE(MIRROR_Y)
+ TOKEN_TABLE(MOVE)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(SUBFRAME)
+ TOKEN_TABLE(SOUND)
+ TOKEN_TABLE(KEYFRAME)
+ TOKEN_TABLE(DECORATION)
+ TOKEN_TABLE(APPLY_EVENT)
+ TOKEN_TABLE(EDITOR_SELECTED)
+ TOKEN_TABLE(EDITOR_EXPANDED)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(KILL_SOUND)
+ TOKEN_TABLE_END
+
+ char *params;
+ int cmd;
+ BaseParser parser;
+ Rect32 rect;
+ int r = 255, g = 255, b = 255;
+ int ar = 255, ag = 255, ab = 255, alpha = 255;
+ int hotspotX = 0, hotspotY = 0;
+ bool custoTrans = false;
+ bool editorSelected = false;
+ bool is2DOnly = false;
+ bool is3DOnly = false;
+ bool decoration = false;
+ bool mirrorX = false;
+ bool mirrorY = false;
+ BasePlatform::setRectEmpty(&rect);
+ char *surface_file = NULL;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, &params)) > 0) {
+ switch (cmd) {
+ case TOKEN_DELAY:
+ parser.scanStr(params, "%d", &_delay);
+ break;
+
+ case TOKEN_IMAGE:
+ surface_file = params;
+ break;
+
+ case TOKEN_TRANSPARENT:
+ parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
+ custoTrans = true;
+ break;
+
+ case TOKEN_RECT:
+ parser.scanStr(params, "%d,%d,%d,%d", &rect.left, &rect.top, &rect.right, &rect.bottom);
+ break;
+
+ case TOKEN_HOTSPOT:
+ parser.scanStr(params, "%d,%d", &hotspotX, &hotspotY);
+ break;
+
+ case TOKEN_MOVE:
+ parser.scanStr(params, "%d,%d", &_moveX, &_moveY);
+ break;
+
+ case TOKEN_2D_ONLY:
+ parser.scanStr(params, "%b", &is2DOnly);
+ break;
+
+ case TOKEN_3D_ONLY:
+ parser.scanStr(params, "%b", &is3DOnly);
+ break;
+
+ case TOKEN_MIRROR_X:
+ parser.scanStr(params, "%b", &mirrorX);
+ break;
+
+ case TOKEN_MIRROR_Y:
+ parser.scanStr(params, "%b", &mirrorY);
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr(params, "%d", &alpha);
+ break;
+
+ case TOKEN_EDITOR_SELECTED:
+ parser.scanStr(params, "%b", &editorSelected);
+ break;
+
+ case TOKEN_EDITOR_EXPANDED:
+ parser.scanStr(params, "%b", &_editorExpanded);
+ break;
+
+ case TOKEN_KILL_SOUND:
+ parser.scanStr(params, "%b", &_killSound);
+ break;
+
+ case TOKEN_SUBFRAME: {
+ BaseSubFrame *subframe = new BaseSubFrame(_gameRef);
+ if (!subframe || DID_FAIL(subframe->loadBuffer((byte *)params, lifeTime, keepLoaded))) {
+ delete subframe;
+ cmd = PARSERR_GENERIC;
+ } else {
+ _subframes.add(subframe);
+ }
+ }
+ break;
+
+ case TOKEN_SOUND: {
+ if (_sound) {
+ delete _sound;
+ _sound = NULL;
+ }
+ _sound = new BaseSound(_gameRef);
+ if (!_sound || DID_FAIL(_sound->setSound(params, Audio::Mixer::kSFXSoundType, false))) {
+ if (_gameRef->_soundMgr->_soundAvailable) {
+ _gameRef->LOG(0, "Error loading sound '%s'.", params);
+ }
+ delete _sound;
+ _sound = NULL;
+ }
+ }
+ break;
+
+ case TOKEN_APPLY_EVENT: {
+ char *event = new char[strlen(params) + 1];
+ strcpy(event, params);
+ _applyEvent.add(event);
+ }
+ break;
+
+ case TOKEN_KEYFRAME:
+ parser.scanStr(params, "%b", &_keyframe);
+ break;
+
+ case TOKEN_DECORATION:
+ parser.scanStr(params, "%b", &decoration);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty((byte *)params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in FRAME definition");
+ return STATUS_FAILED;
+ }
+
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading FRAME definition");
+ return STATUS_FAILED;
+ }
+
+
+ BaseSubFrame *sub = new BaseSubFrame(_gameRef);
+ if (surface_file != NULL) {
+ if (custoTrans) {
+ sub->setSurface(surface_file, false, r, g, b, lifeTime, keepLoaded);
+ } else {
+ sub->setSurface(surface_file, true, 0, 0, 0, lifeTime, keepLoaded);
+ }
+
+ if (!sub->_surface) {
+ delete sub;
+ _gameRef->LOG(0, "Error loading SUBFRAME");
+ return STATUS_FAILED;
+ }
+
+ sub->_alpha = BYTETORGBA(ar, ag, ab, alpha);
+ if (custoTrans) {
+ sub->_transparent = BYTETORGBA(r, g, b, 0xFF);
+ }
+ }
+
+ if (BasePlatform::isRectEmpty(&rect)) {
+ sub->setDefaultRect();
+ } else {
+ sub->setRect(rect);
+ }
+
+ sub->_hotspotX = hotspotX;
+ sub->_hotspotY = hotspotY;
+ sub->_2DOnly = is2DOnly;
+ sub->_3DOnly = is3DOnly;
+ sub->_decoration = decoration;
+ sub->_mirrorX = mirrorX;
+ sub->_mirrorY = mirrorY;
+
+
+ sub->_editorSelected = editorSelected;
+ _subframes.insert_at(0, sub);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) {
+ if (!rect) {
+ return false;
+ }
+ BasePlatform::setRectEmpty(rect);
+
+ Rect32 subRect;
+
+ for (uint32 i = 0; i < _subframes.size(); i++) {
+ _subframes[i]->getBoundingRect(&subRect, x, y, scaleX, scaleY);
+ BasePlatform::unionRect(rect, rect, &subRect);
+ }
+ return true;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFrame::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "FRAME {\n");
+ buffer->putTextIndent(indent + 2, "DELAY = %d\n", _delay);
+
+ if (_moveX != 0 || _moveY != 0) {
+ buffer->putTextIndent(indent + 2, "MOVE {%d, %d}\n", _moveX, _moveY);
+ }
+
+ if (_sound && _sound->getFilename()) {
+ buffer->putTextIndent(indent + 2, "SOUND=\"%s\"\n", _sound->getFilename());
+ }
+
+ buffer->putTextIndent(indent + 2, "KEYFRAME=%s\n", _keyframe ? "TRUE" : "FALSE");
+
+ if (_killSound) {
+ buffer->putTextIndent(indent + 2, "KILL_SOUND=%s\n", _killSound ? "TRUE" : "FALSE");
+ }
+
+ if (_editorExpanded) {
+ buffer->putTextIndent(indent + 2, "EDITOR_EXPANDED=%s\n", _editorExpanded ? "TRUE" : "FALSE");
+ }
+
+ if (_subframes.size() > 0) {
+ _subframes[0]->saveAsText(buffer, indent, false);
+ }
+
+ for (uint32 i = 1; i < _subframes.size(); i++) {
+ _subframes[i]->saveAsText(buffer, indent + 2);
+ }
+
+ for (uint32 i = 0; i < _applyEvent.size(); i++) {
+ buffer->putTextIndent(indent + 2, "APPLY_EVENT=\"%s\"\n", _applyEvent[i]);
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+
+ buffer->putTextIndent(indent, "}\n\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFrame::persist(BasePersistenceManager *persistMgr) {
+ BaseScriptable::persist(persistMgr);
+
+ _applyEvent.persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_delay));
+ persistMgr->transfer(TMEMBER(_editorExpanded));
+ persistMgr->transfer(TMEMBER(_keyframe));
+ persistMgr->transfer(TMEMBER(_killSound));
+ persistMgr->transfer(TMEMBER(_moveX));
+ persistMgr->transfer(TMEMBER(_moveY));
+ persistMgr->transfer(TMEMBER(_sound));
+ _subframes.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSound
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetSound") == 0) {
+ stack->correctParams(0);
+
+ if (_sound && _sound->getFilename()) {
+ stack->pushString(_sound->getFilename());
+ } else {
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetSound
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetSound") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ delete _sound;
+ _sound = NULL;
+
+ if (!val->isNULL()) {
+ _sound = new BaseSound(_gameRef);
+ if (!_sound || DID_FAIL(_sound->setSound(val->getString(), Audio::Mixer::kSFXSoundType, false))) {
+ stack->pushBool(false);
+ delete _sound;
+ _sound = NULL;
+ } else {
+ stack->pushBool(true);
+ }
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSubframe
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetSubframe") == 0) {
+ stack->correctParams(1);
+ int index = stack->pop()->getInt(-1);
+ if (index < 0 || index >= (int32)_subframes.size()) {
+ script->runtimeError("Frame.GetSubframe: Subframe index %d is out of range.", index);
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_subframes[index], true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteSubframe
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteSubframe") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ if (val->isInt()) {
+ int index = val->getInt(-1);
+ if (index < 0 || index >= (int32)_subframes.size()) {
+ script->runtimeError("Frame.DeleteSubframe: Subframe index %d is out of range.", index);
+ }
+ } else {
+ BaseSubFrame *sub = (BaseSubFrame *)val->getNative();
+ for (uint32 i = 0; i < _subframes.size(); i++) {
+ if (_subframes[i] == sub) {
+ delete _subframes[i];
+ _subframes.remove_at(i);
+ break;
+ }
+ }
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddSubframe
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddSubframe") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ const char *filename = NULL;
+ if (!val->isNULL()) {
+ filename = val->getString();
+ }
+
+ BaseSubFrame *sub = new BaseSubFrame(_gameRef);
+ if (filename != NULL) {
+ sub->setSurface(filename);
+ sub->setDefaultRect();
+ }
+ _subframes.add(sub);
+
+ stack->pushNative(sub, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InsertSubframe
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InsertSubframe") == 0) {
+ stack->correctParams(2);
+ int index = stack->pop()->getInt();
+ if (index < 0) {
+ index = 0;
+ }
+
+ ScValue *val = stack->pop();
+ const char *filename = NULL;
+ if (!val->isNULL()) {
+ filename = val->getString();
+ }
+
+ BaseSubFrame *sub = new BaseSubFrame(_gameRef);
+ if (filename != NULL) {
+ sub->setSurface(filename);
+ }
+
+ if (index >= (int32)_subframes.size()) {
+ _subframes.add(sub);
+ } else {
+ _subframes.insert_at(index, sub);
+ }
+
+ stack->pushNative(sub, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSubframe") == 0) {
+ stack->correctParams(1);
+ int index = stack->pop()->getInt(-1);
+ if (index < 0 || index >= (int32)_applyEvent.size()) {
+ script->runtimeError("Frame.GetEvent: Event index %d is out of range.", index);
+ stack->pushNULL();
+ } else {
+ stack->pushString(_applyEvent[index]);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddEvent") == 0) {
+ stack->correctParams(1);
+ const char *event = stack->pop()->getString();
+ for (uint32 i = 0; i < _applyEvent.size(); i++) {
+ if (scumm_stricmp(_applyEvent[i], event) == 0) {
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ }
+ _applyEvent.add(event);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteEvent") == 0) {
+ stack->correctParams(1);
+ const char *event = stack->pop()->getString();
+ for (uint32 i = 0; i < _applyEvent.size(); i++) {
+ if (scumm_stricmp(_applyEvent[i], event) == 0) {
+ delete[] _applyEvent[i];
+ _applyEvent.remove_at(i);
+ break;
+ }
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ else {
+ if (_subframes.size() == 1) {
+ return _subframes[0]->scCallMethod(script, stack, thisStack, name);
+ } else {
+ return BaseScriptable::scCallMethod(script, stack, thisStack, name);
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseFrame::scGetProperty(const Common::String &name) {
+ if (!_scValue) {
+ _scValue = new ScValue(_gameRef);
+ }
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("frame");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Delay
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Delay") {
+ _scValue->setInt(_delay);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Keyframe
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Keyframe") {
+ _scValue->setBool(_keyframe);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // KillSounds
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "KillSounds") {
+ _scValue->setBool(_killSound);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MoveX") {
+ _scValue->setInt(_moveX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MoveY") {
+ _scValue->setInt(_moveY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumSubframes (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumSubframes") {
+ _scValue->setInt(_subframes.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumEvents (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumEvents") {
+ _scValue->setInt(_applyEvent.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ else {
+ if (_subframes.size() == 1) {
+ return _subframes[0]->scGetProperty(name);
+ } else {
+ return BaseScriptable::scGetProperty(name);
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFrame::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Delay
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Delay") == 0) {
+ _delay = MAX(0, value->getInt());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Keyframe
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Keyframe") == 0) {
+ _keyframe = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // KillSounds
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "KillSounds") == 0) {
+ _killSound = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MoveX") == 0) {
+ _moveX = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MoveY") == 0) {
+ _moveY = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ else {
+ if (_subframes.size() == 1) {
+ return _subframes[0]->scSetProperty(name, value);
+ } else {
+ return BaseScriptable::scSetProperty(name, value);
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseFrame::scToString() {
+ return "[frame]";
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h
new file mode 100644
index 0000000000..7c5d893e70
--- /dev/null
+++ b/engines/wintermute/base/base_frame.h
@@ -0,0 +1,75 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FRAME_H
+#define WINTERMUTE_BASE_FRAME_H
+
+#include "engines/wintermute/base/base_scriptable.h"
+#include "engines/wintermute/coll_templ.h"
+
+namespace Wintermute {
+class BaseSound;
+class BaseSubFrame;
+class BaseObject;
+class ScScript;
+class ScStack;
+class BaseFrame: public BaseScriptable {
+public:
+ bool _killSound;
+ void stopSound();
+ bool oneTimeDisplay(BaseObject *owner, bool muted = false);
+ DECLARE_PERSISTENT(BaseFrame, BaseScriptable)
+
+ bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
+ bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ int _moveY;
+ int _moveX;
+ uint32 _delay;
+ BaseArray<BaseSubFrame *> _subframes;
+ bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
+
+ BaseFrame(BaseGame *inGame);
+ virtual ~BaseFrame();
+
+ BaseArray<const char *> _applyEvent;
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+private:
+ bool _keyframe;
+ bool _editorExpanded;
+ BaseSound *_sound;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
new file mode 100644
index 0000000000..f0b1171ca4
--- /dev/null
+++ b/engines/wintermute/base/base_game.cpp
@@ -0,0 +1,4483 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/dcgf.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_fader.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/base_keyboard_state.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_quick_msg.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_transition_manager.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_save_thumb_helper.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/saveload.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_ext_math.h"
+#include "engines/wintermute/video/video_player.h"
+#include "engines/wintermute/video/video_theora_player.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/utils/crc.h"
+#include "engines/wintermute/utils/path_util.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/config-manager.h"
+#include "common/savefile.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "common/keyboard.h"
+#include "common/system.h"
+#include "common/file.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(BaseGame, true)
+
+
+//////////////////////////////////////////////////////////////////////
+BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gameId) {
+ _shuttingDown = false;
+
+ _state = GAME_RUNNING;
+ _origState = GAME_RUNNING;
+ _freezeLevel = 0;
+
+ _interactive = true;
+ _origInteractive = false;
+
+ _surfaceStorage = NULL;
+ _fontStorage = NULL;
+ _renderer = NULL;
+ _soundMgr = NULL;
+ _transMgr = NULL;
+ _scEngine = NULL;
+ _keyboardState = NULL;
+
+ _mathClass = NULL;
+
+ _debugLogFile = NULL;
+ _debugDebugMode = false;
+ _debugShowFPS = false;
+
+ _systemFont = NULL;
+ _videoFont = NULL;
+
+ _videoPlayer = NULL;
+ _theoraPlayer = NULL;
+
+ _mainObject = NULL;
+ _activeObject = NULL;
+
+ _fader = NULL;
+
+ _offsetX = _offsetY = 0;
+ _offsetPercentX = _offsetPercentY = 0.0f;
+
+ _subtitles = true;
+ _videoSubtitles = true;
+
+ _timer = 0;
+ _timerDelta = 0;
+ _timerLast = 0;
+
+ _liveTimer = 0;
+ _liveTimerDelta = 0;
+ _liveTimerLast = 0;
+
+ _sequence = 0;
+
+ _mousePos.x = _mousePos.y = 0;
+ _mouseLeftDown = _mouseRightDown = _mouseMidlleDown = false;
+ _capturedObject = NULL;
+
+ // FPS counters
+ _lastTime = _fpsTime = _deltaTime = _framesRendered = _fps = 0;
+
+ _cursorNoninteractive = NULL;
+
+ _useD3D = false;
+
+ _stringTable = new BaseStringTable(this);
+
+ for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) {
+ _music[i] = NULL;
+ _musicStartTime[i] = 0;
+ }
+
+ _settingsResWidth = 800;
+ _settingsResHeight = 600;
+ _settingsRequireAcceleration = false;
+ _settingsRequireSound = false;
+ _settingsTLMode = 0;
+ _settingsAllowWindowed = true;
+ _settingsGameFile = NULL;
+ _settingsAllowAdvanced = false;
+ _settingsAllowAccessTab = true;
+ _settingsAllowAboutTab = true;
+ _settingsAllowDesktopRes = false;
+
+ _editorForceScripts = false;
+ _editorAlwaysRegister = false;
+
+ _focusedWindow = NULL;
+
+ _loadInProgress = false;
+
+ _quitting = false;
+ _loading = false;
+ _scheduledLoadSlot = -1;
+
+ _personalizedSave = false;
+ _compressedSavegames = true;
+
+ _editorMode = false;
+ //_doNotExpandStrings = false;
+
+ _engineLogCallback = NULL;
+ _engineLogCallbackData = NULL;
+
+ _smartCache = false;
+ _surfaceGCCycleTime = 10000;
+
+ _reportTextureFormat = false;
+
+ _viewportSP = -1;
+
+ _subtitlesSpeed = 70;
+
+ _forceNonStreamedSounds = false;
+
+ _thumbnailWidth = _thumbnailHeight = 0;
+
+ _richSavedGames = false;
+ _savedGameExt = NULL;
+ BaseUtils::setString(&_savedGameExt, "dsv");
+
+ _musicCrossfadeRunning = false;
+ _musicCrossfadeStartTime = 0;
+ _musicCrossfadeLength = 0;
+ _musicCrossfadeChannel1 = -1;
+ _musicCrossfadeChannel2 = -1;
+ _musicCrossfadeSwap = false;
+
+ _localSaveDir = NULL;
+ BaseUtils::setString(&_localSaveDir, "saves");
+ _saveDirChecked = false;
+
+ _loadingIcon = NULL;
+ _loadingIconX = _loadingIconY = 0;
+ _loadingIconPersistent = false;
+
+ _textEncoding = TEXT_ANSI;
+ _textRTL = false;
+
+ _soundBufferSizeSec = 3;
+ _suspendedRendering = false;
+
+ _lastCursor = NULL;
+
+
+ BasePlatform::setRectEmpty(&_mouseLockRect);
+
+ _suppressScriptErrors = false;
+ _lastMiniUpdate = 0;
+ _miniUpdateEnabled = false;
+
+ _cachedThumbnail = NULL;
+
+ _autorunDisabled = false;
+
+ // compatibility bits
+ _compatKillMethodThreads = false;
+
+ _usedMem = 0;
+
+
+ _autoSaveOnExit = true;
+ _autoSaveSlot = 999;
+ _cursorHidden = false;
+
+ // Block kept as a reminder that the engine CAN run in constrained/touch-mode
+ /*#ifdef __IPHONEOS__
+ _touchInterface = true;
+ _constrainedMemory = true; // TODO differentiate old and new iOS devices
+ #else*/
+ _touchInterface = false;
+ _constrainedMemory = false;
+//#endif
+
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseGame::~BaseGame() {
+ _shuttingDown = true;
+
+ LOG(0, "");
+ LOG(0, "Shutting down...");
+
+ ConfMan.setBool("last_run", true);
+
+ cleanup();
+
+ delete[] _localSaveDir;
+ delete[] _settingsGameFile;
+ delete[] _savedGameExt;
+
+ delete _cachedThumbnail;
+
+ delete _mathClass;
+
+ delete _transMgr;
+ delete _scEngine;
+ delete _fontStorage;
+ delete _surfaceStorage;
+ delete _videoPlayer;
+ delete _theoraPlayer;
+ delete _soundMgr;
+ //SAFE_DELETE(_keyboardState);
+
+ delete _renderer;
+ delete _stringTable;
+
+ _localSaveDir = NULL;
+ _settingsGameFile = NULL;
+ _savedGameExt = NULL;
+
+ _cachedThumbnail = NULL;
+
+ _mathClass = NULL;
+
+ _transMgr = NULL;
+ _scEngine = NULL;
+ _fontStorage = NULL;
+ _surfaceStorage = NULL;
+ _videoPlayer = NULL;
+ _theoraPlayer = NULL;
+ _soundMgr = NULL;
+
+ _renderer = NULL;
+ _stringTable = NULL;
+
+ DEBUG_DebugDisable();
+ debugC(kWintermuteDebugLog, "--- shutting down normally ---\n");
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::cleanup() {
+ delete _loadingIcon;
+ _loadingIcon = NULL;
+
+ _engineLogCallback = NULL;
+ _engineLogCallbackData = NULL;
+
+ for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) {
+ delete _music[i];
+ _music[i] = NULL;
+ _musicStartTime[i] = 0;
+ }
+
+ unregisterObject(_fader);
+ _fader = NULL;
+
+ for (uint32 i = 0; i < _regObjects.size(); i++) {
+ delete _regObjects[i];
+ _regObjects[i] = NULL;
+ }
+ _regObjects.clear();
+
+ _windows.clear(); // refs only
+ _focusedWindow = NULL; // ref only
+
+ delete _cursorNoninteractive;
+ delete _cursor;
+ delete _activeCursor;
+ _cursorNoninteractive = NULL;
+ _cursor = NULL;
+ _activeCursor = NULL;
+
+ delete _scValue;
+ delete _sFX;
+ _scValue = NULL;
+ _sFX = NULL;
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ _scripts[i]->_owner = NULL;
+ _scripts[i]->finish();
+ }
+ _scripts.clear();
+
+ _fontStorage->removeFont(_systemFont);
+ _systemFont = NULL;
+
+ _fontStorage->removeFont(_videoFont);
+ _videoFont = NULL;
+
+ for (uint32 i = 0; i < _quickMessages.size(); i++) {
+ delete _quickMessages[i];
+ }
+ _quickMessages.clear();
+
+ _viewportStack.clear();
+ _viewportSP = -1;
+
+ setName(NULL);
+ setFilename(NULL);
+ for (int i = 0; i < 7; i++) {
+ delete[] _caption[i];
+ _caption[i] = NULL;
+ }
+
+ _lastCursor = NULL;
+
+ delete _keyboardState;
+ _keyboardState = NULL;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseGame::initialize1() {
+ bool loaded = false; // Not really a loop, but a goto-replacement.
+ while (!loaded) {
+ _surfaceStorage = new BaseSurfaceStorage(this);
+ if (_surfaceStorage == NULL) {
+ break;
+ }
+
+ _fontStorage = new BaseFontStorage(this);
+ if (_fontStorage == NULL) {
+ break;
+ }
+
+ _soundMgr = new BaseSoundMgr(this);
+ if (_soundMgr == NULL) {
+ break;
+ }
+
+ _mathClass = new SXMath(this);
+ if (_mathClass == NULL) {
+ break;
+ }
+
+ _scEngine = new ScEngine(this);
+ if (_scEngine == NULL) {
+ break;
+ }
+
+ _videoPlayer = new VideoPlayer(this);
+ if (_videoPlayer == NULL) {
+ break;
+ }
+
+ _transMgr = new BaseTransitionMgr(this);
+ if (_transMgr == NULL) {
+ break;
+ }
+
+ _keyboardState = new BaseKeyboardState(this);
+ if (_keyboardState == NULL) {
+ break;
+ }
+
+ _fader = new BaseFader(this);
+ if (_fader == NULL) {
+ break;
+ }
+ registerObject(_fader);
+
+ loaded = true;
+ }
+ if (loaded == true) {
+ return STATUS_OK;
+ } else {
+ delete _mathClass;
+ delete _keyboardState;
+ delete _transMgr;
+ delete _surfaceStorage;
+ delete _fontStorage;
+ delete _soundMgr;
+ delete _scEngine;
+ delete _videoPlayer;
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseGame::initialize2() { // we know whether we are going to be accelerated
+ _renderer = makeOSystemRenderer(this);
+ if (_renderer == NULL) {
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseGame::initialize3() { // renderer is initialized
+ _posX = _renderer->_width / 2;
+ _posY = _renderer->_height / 2;
+ _renderer->initIndicator();
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseGame::DEBUG_DebugEnable(const char *filename) {
+ _debugDebugMode = true;
+
+ int secs = g_system->getMillis() / 1000;
+ int hours = secs / 3600;
+ secs = secs % 3600;
+ int mins = secs / 60;
+ secs = secs % 60;
+
+#ifdef _DEBUG
+ LOG(0, "********** DEBUG LOG OPENED %02d-%02d-%02d (Debug Build) *******************", hours, mins, secs);
+#else
+ LOG(0, "********** DEBUG LOG OPENED %02d-%02d-%02d (Release Build) *****************", hours, mins, secs);
+#endif
+
+ LOG(0, "%s ver %d.%d.%d%s, Compiled on " __DATE__ ", " __TIME__, DCGF_NAME, DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, DCGF_VER_SUFFIX);
+
+ AnsiString platform = BasePlatform::getPlatformName();
+ LOG(0, "Platform: %s", platform.c_str());
+ LOG(0, "");
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseGame::DEBUG_DebugDisable() {
+ if (_debugLogFile != NULL) {
+ LOG(0, "********** DEBUG LOG CLOSED ********************************************");
+ //fclose((FILE *)_debugLogFile);
+ _debugLogFile = NULL;
+ }
+ _debugDebugMode = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseGame::LOG(bool res, const char *fmt, ...) {
+ uint32 secs = g_system->getMillis() / 1000;
+ uint32 hours = secs / 3600;
+ secs = secs % 3600;
+ uint32 mins = secs / 60;
+ secs = secs % 60;
+
+ char buff[512];
+ va_list va;
+
+ va_start(va, fmt);
+ vsprintf(buff, fmt, va);
+ va_end(va);
+
+ // redirect to an engine's own callback
+ if (_engineLogCallback) {
+ _engineLogCallback(buff, res, _engineLogCallbackData);
+ }
+
+ debugCN(kWintermuteDebugLog, "%02d:%02d:%02d: %s\n", hours, mins, secs, buff);
+
+ //fprintf((FILE *)_debugLogFile, "%02d:%02d:%02d: %s\n", hours, mins, secs, buff);
+ //fflush((FILE *)_debugLogFile);
+
+ //QuickMessage(buff);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::setEngineLogCallback(ENGINE_LOG_CALLBACK callback, void *data) {
+ _engineLogCallback = callback;
+ _engineLogCallbackData = data;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseGame::initLoop() {
+ _viewportSP = -1;
+
+ _currentTime = g_system->getMillis();
+
+ _renderer->initLoop();
+ updateMusicCrossfade();
+
+ _surfaceStorage->initLoop();
+ _fontStorage->initLoop();
+
+
+ //_activeObject = NULL;
+
+ // count FPS
+ _deltaTime = _currentTime - _lastTime;
+ _lastTime = _currentTime;
+ _fpsTime += _deltaTime;
+
+ _liveTimerDelta = _liveTimer - _liveTimerLast;
+ _liveTimerLast = _liveTimer;
+ _liveTimer += MIN((uint32)1000, _deltaTime);
+
+ if (_state != GAME_FROZEN) {
+ _timerDelta = _timer - _timerLast;
+ _timerLast = _timer;
+ _timer += MIN((uint32)1000, _deltaTime);
+ } else {
+ _timerDelta = 0;
+ }
+
+ _framesRendered++;
+ if (_fpsTime > 1000) {
+ _fps = _framesRendered;
+ _framesRendered = 0;
+ _fpsTime = 0;
+ }
+ //_gameRef->LOG(0, "%d", _fps);
+
+ getMousePos(&_mousePos);
+
+ _focusedWindow = NULL;
+ for (int i = _windows.size() - 1; i >= 0; i--) {
+ if (_windows[i]->_visible) {
+ _focusedWindow = _windows[i];
+ break;
+ }
+ }
+
+ updateSounds();
+
+ if (_fader) {
+ _fader->update();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseGame::initInput() {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseGame::getSequence() {
+ return ++_sequence;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::setOffset(int offsetX, int offsetY) {
+ _offsetX = offsetX;
+ _offsetY = offsetY;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::getOffset(int *offsetX, int *offsetY) {
+ if (offsetX != NULL) {
+ *offsetX = _offsetX;
+ }
+ if (offsetY != NULL) {
+ *offsetY = _offsetY;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "BaseGame::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing GAME file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(GAME)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(SYSTEM_FONT)
+TOKEN_DEF(VIDEO_FONT)
+TOKEN_DEF(EVENTS)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(ACTIVE_CURSOR)
+TOKEN_DEF(NONINTERACTIVE_CURSOR)
+TOKEN_DEF(STRING_TABLE)
+TOKEN_DEF(RESOLUTION)
+TOKEN_DEF(SETTINGS)
+TOKEN_DEF(REQUIRE_3D_ACCELERATION)
+TOKEN_DEF(REQUIRE_SOUND)
+TOKEN_DEF(HWTL_MODE)
+TOKEN_DEF(ALLOW_WINDOWED_MODE)
+TOKEN_DEF(ALLOW_ACCESSIBILITY_TAB)
+TOKEN_DEF(ALLOW_ABOUT_TAB)
+TOKEN_DEF(ALLOW_ADVANCED)
+TOKEN_DEF(ALLOW_DESKTOP_RES)
+TOKEN_DEF(REGISTRY_PATH)
+TOKEN_DEF(PERSONAL_SAVEGAMES)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(SUBTITLES_SPEED)
+TOKEN_DEF(SUBTITLES)
+TOKEN_DEF(VIDEO_SUBTITLES)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(THUMBNAIL_WIDTH)
+TOKEN_DEF(THUMBNAIL_HEIGHT)
+TOKEN_DEF(INDICATOR_X)
+TOKEN_DEF(INDICATOR_Y)
+TOKEN_DEF(INDICATOR_WIDTH)
+TOKEN_DEF(INDICATOR_HEIGHT)
+TOKEN_DEF(INDICATOR_COLOR)
+TOKEN_DEF(SAVE_IMAGE_X)
+TOKEN_DEF(SAVE_IMAGE_Y)
+TOKEN_DEF(SAVE_IMAGE)
+TOKEN_DEF(LOAD_IMAGE_X)
+TOKEN_DEF(LOAD_IMAGE_Y)
+TOKEN_DEF(LOAD_IMAGE)
+TOKEN_DEF(LOCAL_SAVE_DIR)
+TOKEN_DEF(RICH_SAVED_GAMES)
+TOKEN_DEF(SAVED_GAME_EXT)
+TOKEN_DEF(GUID)
+TOKEN_DEF(COMPAT_KILL_METHOD_THREADS)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(GAME)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(SYSTEM_FONT)
+ TOKEN_TABLE(VIDEO_FONT)
+ TOKEN_TABLE(EVENTS)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(ACTIVE_CURSOR)
+ TOKEN_TABLE(NONINTERACTIVE_CURSOR)
+ TOKEN_TABLE(PERSONAL_SAVEGAMES)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(SUBTITLES_SPEED)
+ TOKEN_TABLE(SUBTITLES)
+ TOKEN_TABLE(VIDEO_SUBTITLES)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(THUMBNAIL_WIDTH)
+ TOKEN_TABLE(THUMBNAIL_HEIGHT)
+ TOKEN_TABLE(INDICATOR_X)
+ TOKEN_TABLE(INDICATOR_Y)
+ TOKEN_TABLE(INDICATOR_WIDTH)
+ TOKEN_TABLE(INDICATOR_HEIGHT)
+ TOKEN_TABLE(INDICATOR_COLOR)
+ TOKEN_TABLE(SAVE_IMAGE_X)
+ TOKEN_TABLE(SAVE_IMAGE_Y)
+ TOKEN_TABLE(SAVE_IMAGE)
+ TOKEN_TABLE(LOAD_IMAGE_X)
+ TOKEN_TABLE(LOAD_IMAGE_Y)
+ TOKEN_TABLE(LOAD_IMAGE)
+ TOKEN_TABLE(LOCAL_SAVE_DIR)
+ TOKEN_TABLE(COMPAT_KILL_METHOD_THREADS)
+ TOKEN_TABLE_END
+
+ // Declare a few variables necessary for moving data from these settings over to the renderer:
+ // The values are the same as the defaults set in BaseRenderer.
+ int loadImageX = 0;
+ int loadImageY = 0;
+ int saveImageX = 0;
+ int saveImageY = 0;
+ int indicatorX = -1;
+ int indicatorY = -1;
+ int indicatorWidth = -1;
+ int indicatorHeight = 8;
+ uint32 indicatorColor = BYTETORGBA(255, 0, 0, 128);
+ Common::String loadImageName = "";
+ Common::String saveImageName = "";
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_GAME) {
+ _gameRef->LOG(0, "'GAME' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_SYSTEM_FONT:
+ if (_systemFont) {
+ _fontStorage->removeFont(_systemFont);
+ }
+ _systemFont = NULL;
+
+ _systemFont = _gameRef->_fontStorage->addFont((char *)params);
+ break;
+
+ case TOKEN_VIDEO_FONT:
+ if (_videoFont) {
+ _fontStorage->removeFont(_videoFont);
+ }
+ _videoFont = NULL;
+
+ _videoFont = _gameRef->_fontStorage->addFont((char *)params);
+ break;
+
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_ACTIVE_CURSOR:
+ delete _activeCursor;
+ _activeCursor = NULL;
+ _activeCursor = new BaseSprite(_gameRef);
+ if (!_activeCursor || DID_FAIL(_activeCursor->loadFile((char *)params))) {
+ delete _activeCursor;
+ _activeCursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NONINTERACTIVE_CURSOR:
+ delete _cursorNoninteractive;
+ _cursorNoninteractive = new BaseSprite(_gameRef);
+ if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile((char *)params))) {
+ delete _cursorNoninteractive;
+ _cursorNoninteractive = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PERSONAL_SAVEGAMES:
+ parser.scanStr((char *)params, "%b", &_personalizedSave);
+ break;
+
+ case TOKEN_SUBTITLES:
+ parser.scanStr((char *)params, "%b", &_subtitles);
+ break;
+
+ case TOKEN_SUBTITLES_SPEED:
+ parser.scanStr((char *)params, "%d", &_subtitlesSpeed);
+ break;
+
+ case TOKEN_VIDEO_SUBTITLES:
+ parser.scanStr((char *)params, "%b", &_videoSubtitles);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+
+ case TOKEN_THUMBNAIL_WIDTH:
+ parser.scanStr((char *)params, "%d", &_thumbnailWidth);
+ break;
+
+ case TOKEN_THUMBNAIL_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_thumbnailHeight);
+ break;
+
+ case TOKEN_INDICATOR_X:
+ parser.scanStr((char *)params, "%d", &indicatorX);
+ break;
+
+ case TOKEN_INDICATOR_Y:
+ parser.scanStr((char *)params, "%d", &indicatorY);
+ break;
+
+ case TOKEN_INDICATOR_COLOR: {
+ int r, g, b, a;
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &r, &g, &b, &a);
+ indicatorColor = BYTETORGBA(r, g, b, a);
+ }
+ break;
+
+ case TOKEN_INDICATOR_WIDTH:
+ parser.scanStr((char *)params, "%d", &indicatorWidth);
+ break;
+
+ case TOKEN_INDICATOR_HEIGHT:
+ parser.scanStr((char *)params, "%d", &indicatorHeight);
+ break;
+
+ case TOKEN_SAVE_IMAGE:
+ saveImageName = (char *) params;
+ break;
+
+ case TOKEN_SAVE_IMAGE_X:
+ parser.scanStr((char *)params, "%d", &saveImageX);
+ break;
+
+ case TOKEN_SAVE_IMAGE_Y:
+ parser.scanStr((char *)params, "%d", &saveImageY);
+ break;
+
+ case TOKEN_LOAD_IMAGE:
+ loadImageName = (char *) params;
+ break;
+
+ case TOKEN_LOAD_IMAGE_X:
+ parser.scanStr((char *)params, "%d", &loadImageX);
+ break;
+
+ case TOKEN_LOAD_IMAGE_Y:
+ parser.scanStr((char *)params, "%d", &loadImageY);
+ break;
+
+ case TOKEN_LOCAL_SAVE_DIR:
+ BaseUtils::setString(&_localSaveDir, (char *)params);
+ break;
+
+ case TOKEN_COMPAT_KILL_METHOD_THREADS:
+ parser.scanStr((char *)params, "%b", &_compatKillMethodThreads);
+ break;
+ }
+ }
+
+ _renderer->setIndicator(indicatorWidth, indicatorHeight, indicatorX, indicatorY, indicatorColor);
+ _renderer->initIndicator(); // In case we just reset the values.
+ _renderer->setSaveImage(saveImageName.c_str(), saveImageX, saveImageY);
+ _renderer->setLoadingScreen(loadImageName.c_str(), loadImageX, loadImageY);
+
+ if (!_systemFont) {
+ _systemFont = _gameRef->_fontStorage->addFont("system_font.fnt");
+ }
+
+
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in GAME definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading GAME definition");
+ return STATUS_FAILED;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // LOG
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "LOG") == 0) {
+ stack->correctParams(1);
+ LOG(0, stack->pop()->getString());
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Caption
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Caption") == 0) {
+ bool res = BaseObject::scCallMethod(script, stack, thisStack, name);
+ setWindowTitle();
+ return res;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Msg
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Msg") == 0) {
+ stack->correctParams(1);
+ quickMessage(stack->pop()->getString());
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RunScript
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RunScript") == 0) {
+ _gameRef->LOG(0, "**Warning** The 'RunScript' method is now obsolete. Use 'AttachScript' instead (same syntax)");
+ stack->correctParams(1);
+ if (DID_FAIL(addScript(stack->pop()->getString()))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadStringTable
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadStringTable") == 0) {
+ stack->correctParams(2);
+ const char *filename = stack->pop()->getString();
+ ScValue *val = stack->pop();
+
+ bool clearOld;
+ if (val->isNULL()) {
+ clearOld = true;
+ } else {
+ clearOld = val->getBool();
+ }
+
+ if (DID_FAIL(_stringTable->loadFile(filename, clearOld))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ValidObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ValidObject") == 0) {
+ stack->correctParams(1);
+ BaseScriptable *obj = stack->pop()->getNative();
+ if (validObject((BaseObject *) obj)) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Reset
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Reset") == 0) {
+ stack->correctParams(0);
+ resetContent();
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // UnloadObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "UnloadObject") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ BaseObject *obj = (BaseObject *)val->getNative();
+ unregisterObject(obj);
+ if (val->getType() == VAL_VARIABLE_REF) {
+ val->setNULL();
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadWindow") == 0) {
+ stack->correctParams(1);
+ UIWindow *win = new UIWindow(_gameRef);
+ if (win && DID_SUCCEED(win->loadFile(stack->pop()->getString()))) {
+ _windows.add(win);
+ registerObject(win);
+ stack->pushNative(win, true);
+ } else {
+ delete win;
+ win = NULL;
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ExpandString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ExpandString") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ char *str = new char[strlen(val->getString()) + 1];
+ strcpy(str, val->getString());
+ _stringTable->expand(&str);
+ stack->pushString(str);
+ delete[] str;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlayMusic / PlayMusicChannel
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PlayMusic") == 0 || strcmp(name, "PlayMusicChannel") == 0) {
+ int channel = 0;
+ if (strcmp(name, "PlayMusic") == 0) {
+ stack->correctParams(3);
+ } else {
+ stack->correctParams(4);
+ channel = stack->pop()->getInt();
+ }
+
+ const char *filename = stack->pop()->getString();
+ ScValue *valLooping = stack->pop();
+ bool looping = valLooping->isNULL() ? true : valLooping->getBool();
+
+ ScValue *valLoopStart = stack->pop();
+ uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt());
+
+
+ if (DID_FAIL(playMusic(channel, filename, looping, loopStart))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StopMusic / StopMusicChannel
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StopMusic") == 0 || strcmp(name, "StopMusicChannel") == 0) {
+ int channel = 0;
+
+ if (strcmp(name, "StopMusic") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+
+ if (DID_FAIL(stopMusic(channel))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PauseMusic / PauseMusicChannel
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PauseMusic") == 0 || strcmp(name, "PauseMusicChannel") == 0) {
+ int channel = 0;
+
+ if (strcmp(name, "PauseMusic") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+
+ if (DID_FAIL(pauseMusic(channel))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ResumeMusic / ResumeMusicChannel
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ResumeMusic") == 0 || strcmp(name, "ResumeMusicChannel") == 0) {
+ int channel = 0;
+ if (strcmp(name, "ResumeMusic") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+
+ if (DID_FAIL(resumeMusic(channel))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetMusic / GetMusicChannel
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetMusic") == 0 || strcmp(name, "GetMusicChannel") == 0) {
+ int channel = 0;
+ if (strcmp(name, "GetMusic") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS) {
+ stack->pushNULL();
+ } else {
+ if (!_music[channel] || !_music[channel]->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_music[channel]->getFilename());
+ }
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetMusicPosition / SetMusicChannelPosition
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetMusicPosition") == 0 || strcmp(name, "SetMusicChannelPosition") == 0 || strcmp(name, "SetMusicPositionChannel") == 0) {
+ int channel = 0;
+ if (strcmp(name, "SetMusicPosition") == 0) {
+ stack->correctParams(1);
+ } else {
+ stack->correctParams(2);
+ channel = stack->pop()->getInt();
+ }
+
+ uint32 time = stack->pop()->getInt();
+
+ if (DID_FAIL(setMusicStartTime(channel, time))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetMusicPosition / GetMusicChannelPosition
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetMusicPosition") == 0 || strcmp(name, "GetMusicChannelPosition") == 0) {
+ int channel = 0;
+ if (strcmp(name, "GetMusicPosition") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
+ stack->pushInt(0);
+ } else {
+ stack->pushInt(_music[channel]->getPositionTime());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsMusicPlaying / IsMusicChannelPlaying
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsMusicPlaying") == 0 || strcmp(name, "IsMusicChannelPlaying") == 0) {
+ int channel = 0;
+ if (strcmp(name, "IsMusicPlaying") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(_music[channel]->isPlaying());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetMusicVolume / SetMusicChannelVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetMusicVolume") == 0 || strcmp(name, "SetMusicChannelVolume") == 0) {
+ int channel = 0;
+ if (strcmp(name, "SetMusicVolume") == 0) {
+ stack->correctParams(1);
+ } else {
+ stack->correctParams(2);
+ channel = stack->pop()->getInt();
+ }
+
+ int volume = stack->pop()->getInt();
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
+ stack->pushBool(false);
+ } else {
+ if (DID_FAIL(_music[channel]->setVolumePercent(volume))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetMusicVolume / GetMusicChannelVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetMusicVolume") == 0 || strcmp(name, "GetMusicChannelVolume") == 0) {
+ int channel = 0;
+ if (strcmp(name, "GetMusicVolume") == 0) {
+ stack->correctParams(0);
+ } else {
+ stack->correctParams(1);
+ channel = stack->pop()->getInt();
+ }
+
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
+ stack->pushInt(0);
+ } else {
+ stack->pushInt(_music[channel]->getVolumePercent());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MusicCrossfade
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MusicCrossfade") == 0) {
+ stack->correctParams(4);
+ int channel1 = stack->pop()->getInt(0);
+ int channel2 = stack->pop()->getInt(0);
+ uint32 fadeLength = (uint32)stack->pop()->getInt(0);
+ bool swap = stack->pop()->getBool(true);
+
+ if (_musicCrossfadeRunning) {
+ script->runtimeError("Game.MusicCrossfade: Music crossfade is already in progress.");
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ _musicCrossfadeStartTime = _liveTimer;
+ _musicCrossfadeChannel1 = channel1;
+ _musicCrossfadeChannel2 = channel2;
+ _musicCrossfadeLength = fadeLength;
+ _musicCrossfadeSwap = swap;
+
+ _musicCrossfadeRunning = true;
+
+ stack->pushBool(true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSoundLength
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSoundLength") == 0) {
+ stack->correctParams(1);
+
+ int length = 0;
+ const char *filename = stack->pop()->getString();
+
+ BaseSound *sound = new BaseSound(_gameRef);
+ if (sound && DID_SUCCEED(sound->setSound(filename, Audio::Mixer::kMusicSoundType, true))) {
+ length = sound->getLength();
+ delete sound;
+ sound = NULL;
+ }
+ stack->pushInt(length);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetMousePos
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetMousePos") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ x = MAX(x, 0);
+ x = MIN(x, _renderer->_width);
+ y = MAX(y, 0);
+ y = MIN(y, _renderer->_height);
+ Point32 p;
+ p.x = x + _renderer->_drawOffsetX;
+ p.y = y + _renderer->_drawOffsetY;
+
+ BasePlatform::setCursorPos(p.x, p.y);
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LockMouseRect
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LockMouseRect") == 0) {
+ stack->correctParams(4);
+ int left = stack->pop()->getInt();
+ int top = stack->pop()->getInt();
+ int right = stack->pop()->getInt();
+ int bottom = stack->pop()->getInt();
+
+ if (right < left) {
+ BaseUtils::swap(&left, &right);
+ }
+ if (bottom < top) {
+ BaseUtils::swap(&top, &bottom);
+ }
+
+ BasePlatform::setRect(&_mouseLockRect, left, top, right, bottom);
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlayVideo
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PlayVideo") == 0) {
+ _gameRef->LOG(0, "Warning: Game.PlayVideo() is now deprecated. Use Game.PlayTheora() instead.");
+
+ stack->correctParams(6);
+ const char *filename = stack->pop()->getString();
+ warning("PlayVideo: %s - not implemented yet", filename);
+ ScValue *valType = stack->pop();
+ int type;
+ if (valType->isNULL()) {
+ type = (int)VID_PLAY_STRETCH;
+ } else {
+ type = valType->getInt();
+ }
+
+ int xVal = stack->pop()->getInt();
+ int yVal = stack->pop()->getInt();
+ bool freezeMusic = stack->pop()->getBool(true);
+
+ ScValue *valSub = stack->pop();
+ const char *subtitleFile = valSub->isNULL() ? NULL : valSub->getString();
+
+ if (type < (int)VID_PLAY_POS || type > (int)VID_PLAY_CENTER) {
+ type = (int)VID_PLAY_STRETCH;
+ }
+
+ if (DID_SUCCEED(_gameRef->_videoPlayer->initialize(filename, subtitleFile))) {
+ if (DID_SUCCEED(_gameRef->_videoPlayer->play((TVideoPlayback)type, xVal, yVal, freezeMusic))) {
+ stack->pushBool(true);
+ script->sleep(0);
+ } else {
+ stack->pushBool(false);
+ }
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlayTheora
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PlayTheora") == 0) {
+ stack->correctParams(7);
+ const char *filename = stack->pop()->getString();
+ ScValue *valType = stack->pop();
+ int type;
+ if (valType->isNULL()) {
+ type = (int)VID_PLAY_STRETCH;
+ } else {
+ type = valType->getInt();
+ }
+
+ int xVal = stack->pop()->getInt();
+ int yVal = stack->pop()->getInt();
+ bool freezeMusic = stack->pop()->getBool(true);
+ bool dropFrames = stack->pop()->getBool(true);
+
+ ScValue *valSub = stack->pop();
+ const char *subtitleFile = valSub->isNULL() ? NULL : valSub->getString();
+
+ if (type < (int)VID_PLAY_POS || type > (int)VID_PLAY_CENTER) {
+ type = (int)VID_PLAY_STRETCH;
+ }
+
+ delete _theoraPlayer;
+ _theoraPlayer = new VideoTheoraPlayer(this);
+ if (_theoraPlayer && DID_SUCCEED(_theoraPlayer->initialize(filename, subtitleFile))) {
+ _theoraPlayer->_dontDropFrames = !dropFrames;
+ if (DID_SUCCEED(_theoraPlayer->play((TVideoPlayback)type, xVal, yVal, true, freezeMusic))) {
+ stack->pushBool(true);
+ script->sleep(0);
+ } else {
+ stack->pushBool(false);
+ }
+ } else {
+ stack->pushBool(false);
+ delete _theoraPlayer;
+ _theoraPlayer = NULL;
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // QuitGame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "QuitGame") == 0) {
+ stack->correctParams(0);
+ stack->pushNULL();
+ _quitting = true;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RegWriteNumber
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RegWriteNumber") == 0) {
+ stack->correctParams(2);
+ const char *key = stack->pop()->getString();
+ int val = stack->pop()->getInt();
+ Common::String privKey = "priv_" + StringUtil::encodeSetting(key);
+ ConfMan.setInt(privKey, val);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RegReadNumber
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RegReadNumber") == 0) {
+ stack->correctParams(2);
+ const char *key = stack->pop()->getString();
+ int initVal = stack->pop()->getInt();
+ Common::String privKey = "priv_" + StringUtil::encodeSetting(key);
+ int result = initVal;
+ if (ConfMan.hasKey(privKey)) {
+ result = ConfMan.getInt(privKey);
+ }
+ stack->pushInt(result);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RegWriteString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RegWriteString") == 0) {
+ stack->correctParams(2);
+ const char *key = stack->pop()->getString();
+ const char *val = stack->pop()->getString();
+ Common::String privKey = "priv_" + StringUtil::encodeSetting(key);
+ Common::String privVal = StringUtil::encodeSetting(val);
+ ConfMan.set(privKey, privVal);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RegReadString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RegReadString") == 0) {
+ stack->correctParams(2);
+ const char *key = stack->pop()->getString();
+ const char *initVal = stack->pop()->getString();
+ Common::String privKey = "priv_" + StringUtil::encodeSetting(key);
+ Common::String result = initVal;
+ if (ConfMan.hasKey(privKey)) {
+ result = StringUtil::decodeSetting(ConfMan.get(key));
+ }
+ stack->pushString(result.c_str());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SaveGame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SaveGame") == 0) {
+ stack->correctParams(3);
+ int slot = stack->pop()->getInt();
+ const char *xdesc = stack->pop()->getString();
+ bool quick = stack->pop()->getBool(false);
+
+ char *desc = new char[strlen(xdesc) + 1];
+ strcpy(desc, xdesc);
+ stack->pushBool(true);
+ if (DID_FAIL(saveGame(slot, desc, quick))) {
+ stack->pop();
+ stack->pushBool(false);
+ }
+ delete[] desc;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadGame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadGame") == 0) {
+ stack->correctParams(1);
+ _scheduledLoadSlot = stack->pop()->getInt();
+ _loading = true;
+ stack->pushBool(false);
+ script->sleep(0);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsSaveSlotUsed
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsSaveSlotUsed") == 0) {
+ stack->correctParams(1);
+ int slot = stack->pop()->getInt();
+ stack->pushBool(SaveLoad::isSaveSlotUsed(slot));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSaveSlotDescription
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSaveSlotDescription") == 0) {
+ stack->correctParams(1);
+ int slot = stack->pop()->getInt();
+ char desc[512];
+ desc[0] = '\0';
+ SaveLoad::getSaveSlotDescription(slot, desc);
+ stack->pushString(desc);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // EmptySaveSlot
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "EmptySaveSlot") == 0) {
+ stack->correctParams(1);
+ int slot = stack->pop()->getInt();
+ SaveLoad::emptySaveSlot(slot);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetGlobalSFXVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetGlobalSFXVolume") == 0) {
+ stack->correctParams(1);
+ _gameRef->_soundMgr->setVolumePercent(Audio::Mixer::kSFXSoundType, (byte)stack->pop()->getInt());
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetGlobalSpeechVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetGlobalSpeechVolume") == 0) {
+ stack->correctParams(1);
+ _gameRef->_soundMgr->setVolumePercent(Audio::Mixer::kSpeechSoundType, (byte)stack->pop()->getInt());
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetGlobalMusicVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetGlobalMusicVolume") == 0) {
+ stack->correctParams(1);
+ _gameRef->_soundMgr->setVolumePercent(Audio::Mixer::kMusicSoundType, (byte)stack->pop()->getInt());
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetGlobalMasterVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetGlobalMasterVolume") == 0) {
+ stack->correctParams(1);
+ _gameRef->_soundMgr->setMasterVolumePercent((byte)stack->pop()->getInt());
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetGlobalSFXVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetGlobalSFXVolume") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getVolumePercent(Audio::Mixer::kSFXSoundType));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetGlobalSpeechVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetGlobalSpeechVolume") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getVolumePercent(Audio::Mixer::kSpeechSoundType));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetGlobalMusicVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetGlobalMusicVolume") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getVolumePercent(Audio::Mixer::kMusicSoundType));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetGlobalMasterVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetGlobalMasterVolume") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getMasterVolumePercent());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetActiveCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetActiveCursor") == 0) {
+ stack->correctParams(1);
+ if (DID_SUCCEED(setActiveCursor(stack->pop()->getString()))) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetActiveCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetActiveCursor") == 0) {
+ stack->correctParams(0);
+ if (!_activeCursor || !_activeCursor->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_activeCursor->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetActiveCursorObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetActiveCursorObject") == 0) {
+ stack->correctParams(0);
+ if (!_activeCursor) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_activeCursor, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveActiveCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveActiveCursor") == 0) {
+ stack->correctParams(0);
+ delete _activeCursor;
+ _activeCursor = NULL;
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HasActiveCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HasActiveCursor") == 0) {
+ stack->correctParams(0);
+
+ if (_activeCursor) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FileExists
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FileExists") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+
+ bool exists = BaseFileManager::getEngineInstance()->hasFile(filename); // Had absPathWarning = false
+ stack->pushBool(exists);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeOut / FadeOutAsync / SystemFadeOut / SystemFadeOutAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeOut") == 0 || strcmp(name, "FadeOutAsync") == 0 || strcmp(name, "SystemFadeOut") == 0 || strcmp(name, "SystemFadeOutAsync") == 0) {
+ stack->correctParams(5);
+ uint32 duration = stack->pop()->getInt(500);
+ byte red = stack->pop()->getInt(0);
+ byte green = stack->pop()->getInt(0);
+ byte blue = stack->pop()->getInt(0);
+ byte alpha = stack->pop()->getInt(0xFF);
+
+ bool system = (strcmp(name, "SystemFadeOut") == 0 || strcmp(name, "SystemFadeOutAsync") == 0);
+
+ _fader->fadeOut(BYTETORGBA(red, green, blue, alpha), duration, system);
+ if (strcmp(name, "FadeOutAsync") != 0 && strcmp(name, "SystemFadeOutAsync") != 0) {
+ script->waitFor(_fader);
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeIn / FadeInAsync / SystemFadeIn / SystemFadeInAsync
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeIn") == 0 || strcmp(name, "FadeInAsync") == 0 || strcmp(name, "SystemFadeIn") == 0 || strcmp(name, "SystemFadeInAsync") == 0) {
+ stack->correctParams(5);
+ uint32 duration = stack->pop()->getInt(500);
+ byte red = stack->pop()->getInt(0);
+ byte green = stack->pop()->getInt(0);
+ byte blue = stack->pop()->getInt(0);
+ byte alpha = stack->pop()->getInt(0xFF);
+
+ bool system = (strcmp(name, "SystemFadeIn") == 0 || strcmp(name, "SystemFadeInAsync") == 0);
+
+ _fader->fadeIn(BYTETORGBA(red, green, blue, alpha), duration, system);
+ if (strcmp(name, "FadeInAsync") != 0 && strcmp(name, "SystemFadeInAsync") != 0) {
+ script->waitFor(_fader);
+ }
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFadeColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFadeColor") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_fader->getCurrentColor());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Screenshot
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Screenshot") == 0) {
+ stack->correctParams(1);
+ char filename[MAX_PATH_LENGTH];
+
+ ScValue *val = stack->pop();
+
+ warning("BGame::ScCallMethod - Screenshot not reimplemented"); //TODO
+ int fileNum = 0;
+
+ while (true) {
+ sprintf(filename, "%s%03d.bmp", val->isNULL() ? getName() : val->getString(), fileNum);
+ if (!Common::File::exists(filename)) {
+ break;
+ }
+ fileNum++;
+ }
+
+ bool ret = false;
+ BaseImage *image = _gameRef->_renderer->takeScreenshot();
+ if (image) {
+ ret = DID_SUCCEED(image->saveBMPFile(filename));
+ delete image;
+ } else {
+ ret = false;
+ }
+
+ stack->pushBool(ret);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScreenshotEx
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScreenshotEx") == 0) {
+ stack->correctParams(3);
+ const char *filename = stack->pop()->getString();
+ int sizeX = stack->pop()->getInt(_renderer->_width);
+ int sizeY = stack->pop()->getInt(_renderer->_height);
+
+ bool ret = false;
+ BaseImage *image = _gameRef->_renderer->takeScreenshot();
+ if (image) {
+ ret = DID_SUCCEED(image->resize(sizeX, sizeY));
+ if (ret) {
+ ret = DID_SUCCEED(image->saveBMPFile(filename));
+ }
+ delete image;
+ } else {
+ ret = false;
+ }
+
+ stack->pushBool(ret);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateWindow") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ UIWindow *win = new UIWindow(_gameRef);
+ _windows.add(win);
+ registerObject(win);
+ if (!val->isNULL()) {
+ win->setName(val->getString());
+ }
+ stack->pushNative(win, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteWindow") == 0) {
+ stack->correctParams(1);
+ BaseObject *obj = (BaseObject *)stack->pop()->getNative();
+ for (uint32 i = 0; i < _windows.size(); i++) {
+ if (_windows[i] == obj) {
+ unregisterObject(_windows[i]);
+ stack->pushBool(true);
+ return STATUS_OK;
+ }
+ }
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // OpenDocument
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "OpenDocument") == 0) {
+ stack->correctParams(0);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DEBUG_DumpClassRegistry
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DEBUG_DumpClassRegistry") == 0) {
+ stack->correctParams(0);
+ DEBUG_DumpClassRegistry();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetLoadingScreen
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetLoadingScreen") == 0) {
+ stack->correctParams(3);
+ ScValue *val = stack->pop();
+ int loadImageX = stack->pop()->getInt();
+ int loadImageY = stack->pop()->getInt();
+
+ if (val->isNULL()) {
+ _renderer->setLoadingScreen(NULL, loadImageX, loadImageY);
+ } else {
+ _renderer->setLoadingScreen(val->getString(), loadImageX, loadImageY);
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetSavingScreen
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetSavingScreen") == 0) {
+ stack->correctParams(3);
+ ScValue *val = stack->pop();
+ int saveImageX = stack->pop()->getInt();
+ int saveImageY = stack->pop()->getInt();
+
+ if (val->isNULL()) {
+ _renderer->setSaveImage(NULL, saveImageX, saveImageY);
+ } else {
+ _renderer->setSaveImage(NULL, saveImageX, saveImageY);
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetWaitCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetWaitCursor") == 0) {
+ stack->correctParams(1);
+ if (DID_SUCCEED(setWaitCursor(stack->pop()->getString()))) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveWaitCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveWaitCursor") == 0) {
+ stack->correctParams(0);
+ delete _cursorNoninteractive;
+ _cursorNoninteractive = NULL;
+
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetWaitCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetWaitCursor") == 0) {
+ stack->correctParams(0);
+ if (!_cursorNoninteractive || !_cursorNoninteractive->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_cursorNoninteractive->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetWaitCursorObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetWaitCursorObject") == 0) {
+ stack->correctParams(0);
+ if (!_cursorNoninteractive) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_cursorNoninteractive, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ClearScriptCache
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ClearScriptCache") == 0) {
+ stack->correctParams(0);
+ stack->pushBool(DID_SUCCEED(_scEngine->emptyScriptCache()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DisplayLoadingIcon
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DisplayLoadingIcon") == 0) {
+ stack->correctParams(4);
+
+ const char *filename = stack->pop()->getString();
+ _loadingIconX = stack->pop()->getInt();
+ _loadingIconY = stack->pop()->getInt();
+ _loadingIconPersistent = stack->pop()->getBool();
+
+ delete _loadingIcon;
+ _loadingIcon = new BaseSprite(this);
+ if (!_loadingIcon || DID_FAIL(_loadingIcon->loadFile(filename))) {
+ delete _loadingIcon;
+ _loadingIcon = NULL;
+ } else {
+ displayContent(false, true);
+ _gameRef->_renderer->flip();
+ _gameRef->_renderer->initLoop();
+ }
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HideLoadingIcon
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HideLoadingIcon") == 0) {
+ stack->correctParams(0);
+ delete _loadingIcon;
+ _loadingIcon = NULL;
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DumpTextureStats
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DumpTextureStats") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+
+ _renderer->dumpData(filename);
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccOutputText
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AccOutputText") == 0) {
+ stack->correctParams(2);
+ /* const char *str = */ stack->pop()->getString();
+ /* int type = */ stack->pop()->getInt();
+ // do nothing
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StoreSaveThumbnail
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StoreSaveThumbnail") == 0) {
+ stack->correctParams(0);
+ delete _cachedThumbnail;
+ _cachedThumbnail = new BaseSaveThumbHelper(this);
+ if (DID_FAIL(_cachedThumbnail->storeThumbnail())) {
+ delete _cachedThumbnail;
+ _cachedThumbnail = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteSaveThumbnail
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteSaveThumbnail") == 0) {
+ stack->correctParams(0);
+ delete _cachedThumbnail;
+ _cachedThumbnail = NULL;
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFileChecksum
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFileChecksum") == 0) {
+ stack->correctParams(2);
+ const char *filename = stack->pop()->getString();
+ bool asHex = stack->pop()->getBool(false);
+
+ Common::SeekableReadStream *file = BaseFileManager::getEngineInstance()->openFile(filename, false);
+ if (file) {
+ crc remainder = crc_initialize();
+ byte buf[1024];
+ int bytesRead = 0;
+
+ while (bytesRead < file->size()) {
+ int bufSize = MIN((uint32)1024, (uint32)(file->size() - bytesRead));
+ bytesRead += file->read(buf, bufSize);
+
+ for (int i = 0; i < bufSize; i++) {
+ remainder = crc_process_byte(buf[i], remainder);
+ }
+ }
+ crc checksum = crc_finalize(remainder);
+
+ if (asHex) {
+ char hex[100];
+ sprintf(hex, "%x", checksum);
+ stack->pushString(hex);
+ } else {
+ stack->pushInt(checksum);
+ }
+
+ BaseFileManager::getEngineInstance()->closeFile(file);
+ file = NULL;
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // EnableScriptProfiling
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "EnableScriptProfiling") == 0) {
+ stack->correctParams(0);
+ _scEngine->enableProfiling();
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DisableScriptProfiling
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DisableScriptProfiling") == 0) {
+ stack->correctParams(0);
+ _scEngine->disableProfiling();
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ShowStatusLine
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ShowStatusLine") == 0) {
+ stack->correctParams(0);
+ // Block kept to show intention of opcode.
+ /*#ifdef __IPHONEOS__
+ IOS_ShowStatusLine(TRUE);
+ #endif*/
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HideStatusLine
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HideStatusLine") == 0) {
+ stack->correctParams(0);
+ // Block kept to show intention of opcode.
+ /*#ifdef __IPHONEOS__
+ IOS_ShowStatusLine(FALSE);
+ #endif*/
+ stack->pushNULL();
+
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseGame::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("game");
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Name") {
+ _scValue->setString(getName());
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Hwnd (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Hwnd") {
+ _scValue->setInt((int)_renderer->_window);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CurrentTime (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CurrentTime") {
+ _scValue->setInt((int)_timer);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WindowsTime (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "WindowsTime") {
+ _scValue->setInt((int)g_system->getMillis());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WindowedMode (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "WindowedMode") {
+ _scValue->setBool(_renderer->_windowed);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MouseX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MouseX") {
+ _scValue->setInt(_mousePos.x);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MouseY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MouseY") {
+ _scValue->setInt(_mousePos.y);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MainObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MainObject") {
+ _scValue->setNative(_mainObject, true);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ActiveObject (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ActiveObject") {
+ _scValue->setNative(_activeObject, true);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScreenWidth (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScreenWidth") {
+ _scValue->setInt(_renderer->_width);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScreenHeight (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScreenHeight") {
+ _scValue->setInt(_renderer->_height);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Interactive
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Interactive") {
+ _scValue->setBool(_interactive);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DebugMode (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "DebugMode") {
+ _scValue->setBool(_debugDebugMode);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundAvailable (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SoundAvailable") {
+ _scValue->setBool(_soundMgr->_soundAvailable);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SFXVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SFXVolume") {
+ _gameRef->LOG(0, "**Warning** The SFXVolume attribute is obsolete");
+ _scValue->setInt(_soundMgr->getVolumePercent(Audio::Mixer::kSFXSoundType));
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SpeechVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SpeechVolume") {
+ _gameRef->LOG(0, "**Warning** The SpeechVolume attribute is obsolete");
+ _scValue->setInt(_soundMgr->getVolumePercent(Audio::Mixer::kSpeechSoundType));
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MusicVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MusicVolume") {
+ _gameRef->LOG(0, "**Warning** The MusicVolume attribute is obsolete");
+ _scValue->setInt(_soundMgr->getVolumePercent(Audio::Mixer::kMusicSoundType));
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MasterVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MasterVolume") {
+ _gameRef->LOG(0, "**Warning** The MasterVolume attribute is obsolete");
+ _scValue->setInt(_soundMgr->getMasterVolumePercent());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Keyboard (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Keyboard") {
+ if (_keyboardState) {
+ _scValue->setNative(_keyboardState, true);
+ } else {
+ _scValue->setNULL();
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Subtitles
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Subtitles") {
+ _scValue->setBool(_subtitles);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesSpeed
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SubtitlesSpeed") {
+ _scValue->setInt(_subtitlesSpeed);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // VideoSubtitles
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "VideoSubtitles") {
+ _scValue->setBool(_videoSubtitles);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FPS (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "FPS") {
+ _scValue->setInt(_fps);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AcceleratedMode / Accelerated (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AcceleratedMode" || name == "Accelerated") {
+ _scValue->setBool(_useD3D);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextEncoding
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TextEncoding") {
+ _scValue->setInt(_textEncoding);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextRTL
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TextRTL") {
+ _scValue->setBool(_textRTL);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundBufferSize
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SoundBufferSize") {
+ _scValue->setInt(_soundBufferSizeSec);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SuspendedRendering
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SuspendedRendering") {
+ _scValue->setBool(_suspendedRendering);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SuppressScriptErrors
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SuppressScriptErrors") {
+ _scValue->setBool(_suppressScriptErrors);
+ return _scValue;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // Frozen
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Frozen") {
+ _scValue->setBool(_state == GAME_FROZEN);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccTTSEnabled
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccTTSEnabled") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccTTSTalk
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccTTSTalk") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccTTSCaptions
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccTTSCaptions") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccTTSKeypress
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccTTSKeypress") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccKeyboardEnabled
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccKeyboardEnabled") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccKeyboardCursorSkip
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccKeyboardCursorSkip") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccKeyboardPause
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccKeyboardPause") {
+ _scValue->setBool(false);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutorunDisabled
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AutorunDisabled") {
+ _scValue->setBool(_autorunDisabled);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SaveDirectory (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SaveDirectory") {
+ AnsiString dataDir = "saves/"; // TODO: This is just to avoid telling the engine actual paths.
+ _scValue->setString(dataDir.c_str());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutoSaveOnExit
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AutoSaveOnExit") {
+ _scValue->setBool(_autoSaveOnExit);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutoSaveSlot
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AutoSaveSlot") {
+ _scValue->setInt(_autoSaveSlot);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorHidden
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CursorHidden") {
+ _scValue->setBool(_cursorHidden);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Platform (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Platform") {
+ _scValue->setString(BasePlatform::getPlatformName().c_str());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeviceType (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "DeviceType") {
+ _scValue->setString(getDeviceType().c_str());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MostRecentSaveSlot (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MostRecentSaveSlot") {
+ if (!ConfMan.hasKey("most_recent_saveslot")) {
+ _scValue->setInt(-1);
+ } else {
+ _scValue->setInt(ConfMan.getInt("most_recent_saveslot"));
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Store (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Store") {
+ _scValue->setNULL();
+ error("Request for a SXStore-object, which is not supported by ScummVM");
+
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MouseX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MouseX") == 0) {
+ _mousePos.x = value->getInt();
+ resetMousePos();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MouseY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MouseY") == 0) {
+ _mousePos.y = value->getInt();
+ resetMousePos();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Caption
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Name") == 0) {
+ bool res = BaseObject::scSetProperty(name, value);
+ setWindowTitle();
+ return res;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MainObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MainObject") == 0) {
+ BaseScriptable *obj = value->getNative();
+ if (obj == NULL || validObject((BaseObject *)obj)) {
+ _mainObject = (BaseObject *)obj;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Interactive
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Interactive") == 0) {
+ setInteractive(value->getBool());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SFXVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SFXVolume") == 0) {
+ _gameRef->LOG(0, "**Warning** The SFXVolume attribute is obsolete");
+ _gameRef->_soundMgr->setVolumePercent(Audio::Mixer::kSFXSoundType, (byte)value->getInt());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SpeechVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SpeechVolume") == 0) {
+ _gameRef->LOG(0, "**Warning** The SpeechVolume attribute is obsolete");
+ _gameRef->_soundMgr->setVolumePercent(Audio::Mixer::kSpeechSoundType, (byte)value->getInt());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MusicVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MusicVolume") == 0) {
+ _gameRef->LOG(0, "**Warning** The MusicVolume attribute is obsolete");
+ _gameRef->_soundMgr->setVolumePercent(Audio::Mixer::kMusicSoundType, (byte)value->getInt());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MasterVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MasterVolume") == 0) {
+ _gameRef->LOG(0, "**Warning** The MasterVolume attribute is obsolete");
+ _gameRef->_soundMgr->setMasterVolumePercent((byte)value->getInt());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Subtitles
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Subtitles") == 0) {
+ _subtitles = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SubtitlesSpeed
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SubtitlesSpeed") == 0) {
+ _subtitlesSpeed = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // VideoSubtitles
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "VideoSubtitles") == 0) {
+ _videoSubtitles = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextEncoding
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TextEncoding") == 0) {
+ int enc = value->getInt();
+ if (enc < 0) {
+ enc = 0;
+ }
+ if (enc >= NUM_TEXT_ENCODINGS) {
+ enc = NUM_TEXT_ENCODINGS - 1;
+ }
+ _textEncoding = (TTextEncoding)enc;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextRTL
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "TextRTL") == 0) {
+ _textRTL = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundBufferSize
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SoundBufferSize") == 0) {
+ _soundBufferSizeSec = value->getInt();
+ _soundBufferSizeSec = MAX(3, _soundBufferSizeSec);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SuspendedRendering
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SuspendedRendering") == 0) {
+ _suspendedRendering = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SuppressScriptErrors
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SuppressScriptErrors") == 0) {
+ _suppressScriptErrors = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutorunDisabled
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AutorunDisabled") == 0) {
+ _autorunDisabled = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutoSaveOnExit
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AutoSaveOnExit") == 0) {
+ _autoSaveOnExit = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AutoSaveSlot
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AutoSaveSlot") == 0) {
+ _autoSaveSlot = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorHidden
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CursorHidden") == 0) {
+ _cursorHidden = value->getBool();
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseGame::scToString() {
+ return "[game object]";
+}
+
+
+
+#define QUICK_MSG_DURATION 3000
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::displayQuickMsg() {
+ if (_quickMessages.size() == 0 || !_systemFont) {
+ return STATUS_OK;
+ }
+
+ // update
+ for (uint32 i = 0; i < _quickMessages.size(); i++) {
+ if (_currentTime - _quickMessages[i]->_startTime >= QUICK_MSG_DURATION) {
+ delete _quickMessages[i];
+ _quickMessages.remove_at(i);
+ i--;
+ }
+ }
+
+ int posY = 20;
+
+ // display
+ for (uint32 i = 0; i < _quickMessages.size(); i++) {
+ _systemFont->drawText((byte *)_quickMessages[i]->getText(), 0, posY, _renderer->_width);
+ posY += _systemFont->getTextHeight((byte *)_quickMessages[i]->getText(), _renderer->_width);
+ }
+ return STATUS_OK;
+}
+
+
+#define MAX_QUICK_MSG 5
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::quickMessage(const char *text) {
+ if (_quickMessages.size() >= MAX_QUICK_MSG) {
+ delete _quickMessages[0];
+ _quickMessages.remove_at(0);
+ }
+ _quickMessages.add(new BaseQuickMsg(_gameRef, text));
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::quickMessageForm(char *fmt, ...) {
+ char buff[256];
+ va_list va;
+
+ va_start(va, fmt);
+ vsprintf(buff, fmt, va);
+ va_end(va);
+
+ quickMessage(buff);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::registerObject(BaseObject *object) {
+ _regObjects.add(object);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::unregisterObject(BaseObject *object) {
+ if (!object) {
+ return STATUS_OK;
+ }
+
+ // is it a window?
+ for (uint32 i = 0; i < _windows.size(); i++) {
+ if ((BaseObject *)_windows[i] == object) {
+ _windows.remove_at(i);
+
+ // get new focused window
+ if (_focusedWindow == object) {
+ _focusedWindow = NULL;
+ }
+
+ break;
+ }
+ }
+
+ // is it active object?
+ if (_activeObject == object) {
+ _activeObject = NULL;
+ }
+
+ // is it main object?
+ if (_mainObject == object) {
+ _mainObject = NULL;
+ }
+
+ // destroy object
+ for (uint32 i = 0; i < _regObjects.size(); i++) {
+ if (_regObjects[i] == object) {
+ _regObjects.remove_at(i);
+ if (!_loadInProgress) {
+ SystemClassRegistry::getInstance()->enumInstances(invalidateValues, "ScValue", (void *)object);
+ }
+ delete object;
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::invalidateValues(void *value, void *data) {
+ ScValue *val = (ScValue *)value;
+ if (val->isNative() && val->getNative() == data) {
+ if (!val->_persistent && ((BaseScriptable *)data)->_refCount == 1) {
+ ((BaseScriptable *)data)->_refCount++;
+ }
+ val->setNative(NULL);
+ val->setNULL();
+ }
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::validObject(BaseObject *object) {
+ if (!object) {
+ return false;
+ }
+ if (object == this) {
+ return true;
+ }
+
+ for (uint32 i = 0; i < _regObjects.size(); i++) {
+ if (_regObjects[i] == object) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) {
+ ScValue *thisObj;
+
+ //////////////////////////////////////////////////////////////////////////
+ // LOG
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "LOG") == 0) {
+ stack->correctParams(1);
+ _gameRef->LOG(0, "sc: %s", stack->pop()->getString());
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // String
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "String") == 0) {
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(makeSXString(_gameRef, stack));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MemBuffer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MemBuffer") == 0) {
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(makeSXMemBuffer(_gameRef, stack));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // File
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "File") == 0) {
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(makeSXFile(_gameRef, stack));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Date
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Date") == 0) {
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(makeSXDate(_gameRef, stack));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Array
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Array") == 0) {
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(makeSXArray(_gameRef, stack));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Object
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Object") == 0) {
+ thisObj = thisStack->getTop();
+
+ thisObj->setNative(makeSXObject(_gameRef, stack));
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Sleep
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Sleep") == 0) {
+ stack->correctParams(1);
+
+ script->sleep((uint32)stack->pop()->getInt());
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WaitFor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WaitFor") == 0) {
+ stack->correctParams(1);
+
+ BaseScriptable *obj = stack->pop()->getNative();
+ if (validObject((BaseObject *)obj)) {
+ script->waitForExclusive((BaseObject *)obj);
+ }
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Random
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Random") == 0) {
+ stack->correctParams(2);
+
+ int from = stack->pop()->getInt();
+ int to = stack->pop()->getInt();
+
+ stack->pushInt(BaseUtils::randomInt(from, to));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetScriptTimeSlice
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetScriptTimeSlice") == 0) {
+ stack->correctParams(1);
+
+ script->_timeSlice = (uint32)stack->pop()->getInt();
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MakeRGBA / MakeRGB / RGB
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MakeRGBA") == 0 || strcmp(name, "MakeRGB") == 0 || strcmp(name, "RGB") == 0) {
+ stack->correctParams(4);
+ int r = stack->pop()->getInt();
+ int g = stack->pop()->getInt();
+ int b = stack->pop()->getInt();
+ int a;
+ ScValue *val = stack->pop();
+ if (val->isNULL()) {
+ a = 255;
+ } else {
+ a = val->getInt();
+ }
+
+ stack->pushInt(BYTETORGBA(r, g, b, a));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MakeHSL
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MakeHSL") == 0) {
+ stack->correctParams(3);
+ int h = stack->pop()->getInt();
+ int s = stack->pop()->getInt();
+ int l = stack->pop()->getInt();
+
+ stack->pushInt(BaseUtils::HSLtoRGB(h, s, l));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetRValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetRValue") == 0) {
+ stack->correctParams(1);
+
+ uint32 rgba = (uint32)stack->pop()->getInt();
+ stack->pushInt(RGBCOLGetR(rgba));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetGValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetGValue") == 0) {
+ stack->correctParams(1);
+
+ uint32 rgba = (uint32)stack->pop()->getInt();
+ stack->pushInt(RGBCOLGetG(rgba));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetBValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetBValue") == 0) {
+ stack->correctParams(1);
+
+ uint32 rgba = (uint32)stack->pop()->getInt();
+ stack->pushInt(RGBCOLGetB(rgba));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetAValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetAValue") == 0) {
+ stack->correctParams(1);
+
+ uint32 rgba = (uint32)stack->pop()->getInt();
+ stack->pushInt(RGBCOLGetA(rgba));
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHValue") == 0) {
+ stack->correctParams(1);
+ uint32 rgb = (uint32)stack->pop()->getInt();
+
+ byte H, S, L;
+ BaseUtils::RGBtoHSL(rgb, &H, &S, &L);
+ stack->pushInt(H);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSValue") == 0) {
+ stack->correctParams(1);
+ uint32 rgb = (uint32)stack->pop()->getInt();
+
+ byte H, S, L;
+ BaseUtils::RGBtoHSL(rgb, &H, &S, &L);
+ stack->pushInt(S);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetLValue
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetLValue") == 0) {
+ stack->correctParams(1);
+ uint32 rgb = (uint32)stack->pop()->getInt();
+
+ byte H, S, L;
+ BaseUtils::RGBtoHSL(rgb, &H, &S, &L);
+ stack->pushInt(L);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Debug
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Debug") == 0) {
+ stack->correctParams(0);
+ stack->pushNULL();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ToString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ToString") == 0) {
+ stack->correctParams(1);
+ const char *str = stack->pop()->getString();
+ char *str2 = new char[strlen(str) + 1];
+ strcpy(str2, str);
+ stack->pushString(str2);
+ delete[] str2;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ToInt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ToInt") == 0) {
+ stack->correctParams(1);
+ int val = stack->pop()->getInt();
+ stack->pushInt(val);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ToFloat
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ToFloat") == 0) {
+ stack->correctParams(1);
+ double val = stack->pop()->getFloat();
+ stack->pushFloat(val);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ToBool
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ToBool") == 0) {
+ stack->correctParams(1);
+ bool val = stack->pop()->getBool();
+ stack->pushBool(val);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // failure
+ else {
+ script->runtimeError("Call to undefined function '%s'. Ignored.", name);
+ stack->correctParams(0);
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::showCursor() {
+ if (_cursorHidden) {
+ return STATUS_OK;
+ }
+
+ if (!_interactive && _gameRef->_state == GAME_RUNNING) {
+ if (_cursorNoninteractive) {
+ return drawCursor(_cursorNoninteractive);
+ }
+ } else {
+ if (_activeObject && !DID_FAIL(_activeObject->showCursor())) {
+ return STATUS_OK;
+ } else {
+ if (_activeObject && _activeCursor && _activeObject->getExtendedFlag("usable")) {
+ return drawCursor(_activeCursor);
+ } else if (_cursor) {
+ return drawCursor(_cursor);
+ }
+ }
+ }
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::saveGame(int slot, const char *desc, bool quickSave) {
+ return SaveLoad::saveGame(slot, desc, quickSave, _gameRef);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::loadGame(int slot) {
+ //_gameRef->LOG(0, "Load start %d", BaseUtils::GetUsedMemMB());
+
+ _loading = false;
+ _scheduledLoadSlot = -1;
+
+ Common::String filename = SaveLoad::getSaveSlotFilename(slot);
+
+ return loadGame(filename.c_str());
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::loadGame(const char *filename) {
+ return SaveLoad::loadGame(filename, _gameRef);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::displayWindows(bool inGame) {
+ bool res;
+
+ // did we lose focus? focus topmost window
+ if (_focusedWindow == NULL || !_focusedWindow->_visible || _focusedWindow->_disable) {
+ _focusedWindow = NULL;
+ for (int i = _windows.size() - 1; i >= 0; i--) {
+ if (_windows[i]->_visible && !_windows[i]->_disable) {
+ _focusedWindow = _windows[i];
+ break;
+ }
+ }
+ }
+
+ // display all windows
+ for (uint32 i = 0; i < _windows.size(); i++) {
+ if (_windows[i]->_visible && _windows[i]->_inGame == inGame) {
+
+ res = _windows[i]->display();
+ if (DID_FAIL(res)) {
+ return res;
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) {
+ if (channel >= NUM_MUSIC_CHANNELS) {
+ _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+ return STATUS_FAILED;
+ }
+
+ delete _music[channel];
+ _music[channel] = NULL;
+
+ _music[channel] = new BaseSound(_gameRef);
+ if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, Audio::Mixer::kMusicSoundType, true))) {
+ if (_musicStartTime[channel]) {
+ _music[channel]->setPositionTime(_musicStartTime[channel]);
+ _musicStartTime[channel] = 0;
+ }
+ if (loopStart) {
+ _music[channel]->setLoopStart(loopStart);
+ }
+ return _music[channel]->play(looping);
+ } else {
+ delete _music[channel];
+ _music[channel] = NULL;
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::stopMusic(int channel) {
+ if (channel >= NUM_MUSIC_CHANNELS) {
+ _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+ return STATUS_FAILED;
+ }
+
+ if (_music[channel]) {
+ _music[channel]->stop();
+ delete _music[channel];
+ _music[channel] = NULL;
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::pauseMusic(int channel) {
+ if (channel >= NUM_MUSIC_CHANNELS) {
+ _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+ return STATUS_FAILED;
+ }
+
+ if (_music[channel]) {
+ return _music[channel]->pause();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::resumeMusic(int channel) {
+ if (channel >= NUM_MUSIC_CHANNELS) {
+ _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+ return STATUS_FAILED;
+ }
+
+ if (_music[channel]) {
+ return _music[channel]->resume();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::setMusicStartTime(int channel, uint32 time) {
+ if (channel >= NUM_MUSIC_CHANNELS) {
+ _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+ return STATUS_FAILED;
+ }
+
+ _musicStartTime[channel] = time;
+ if (_music[channel] && _music[channel]->isPlaying()) {
+ return _music[channel]->setPositionTime(time);
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::loadSettings(const char *filename) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(SETTINGS)
+ TOKEN_TABLE(GAME)
+ TOKEN_TABLE(STRING_TABLE)
+ TOKEN_TABLE(RESOLUTION)
+ TOKEN_TABLE(REQUIRE_3D_ACCELERATION)
+ TOKEN_TABLE(REQUIRE_SOUND)
+ TOKEN_TABLE(HWTL_MODE)
+ TOKEN_TABLE(ALLOW_WINDOWED_MODE)
+ TOKEN_TABLE(ALLOW_ACCESSIBILITY_TAB)
+ TOKEN_TABLE(ALLOW_ABOUT_TAB)
+ TOKEN_TABLE(ALLOW_ADVANCED)
+ TOKEN_TABLE(ALLOW_DESKTOP_RES)
+ TOKEN_TABLE(REGISTRY_PATH)
+ TOKEN_TABLE(RICH_SAVED_GAMES)
+ TOKEN_TABLE(SAVED_GAME_EXT)
+ TOKEN_TABLE(GUID)
+ TOKEN_TABLE_END
+
+
+ byte *origBuffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (origBuffer == NULL) {
+ _gameRef->LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret = STATUS_OK;
+
+ byte *buffer = origBuffer;
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SETTINGS) {
+ _gameRef->LOG(0, "'SETTINGS' keyword expected in game settings file.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_GAME:
+ delete[] _settingsGameFile;
+ _settingsGameFile = new char[strlen((char *)params) + 1];
+ if (_settingsGameFile) {
+ strcpy(_settingsGameFile, (char *)params);
+ }
+ break;
+
+ case TOKEN_STRING_TABLE:
+ if (DID_FAIL(_stringTable->loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_RESOLUTION:
+ parser.scanStr((char *)params, "%d,%d", &_settingsResWidth, &_settingsResHeight);
+ break;
+
+ case TOKEN_REQUIRE_3D_ACCELERATION:
+ parser.scanStr((char *)params, "%b", &_settingsRequireAcceleration);
+ break;
+
+ case TOKEN_REQUIRE_SOUND:
+ parser.scanStr((char *)params, "%b", &_settingsRequireSound);
+ break;
+
+ case TOKEN_HWTL_MODE:
+ parser.scanStr((char *)params, "%d", &_settingsTLMode);
+ break;
+
+ case TOKEN_ALLOW_WINDOWED_MODE:
+ parser.scanStr((char *)params, "%b", &_settingsAllowWindowed);
+ break;
+
+ case TOKEN_ALLOW_DESKTOP_RES:
+ parser.scanStr((char *)params, "%b", &_settingsAllowDesktopRes);
+ break;
+
+ case TOKEN_ALLOW_ADVANCED:
+ parser.scanStr((char *)params, "%b", &_settingsAllowAdvanced);
+ break;
+
+ case TOKEN_ALLOW_ACCESSIBILITY_TAB:
+ parser.scanStr((char *)params, "%b", &_settingsAllowAccessTab);
+ break;
+
+ case TOKEN_ALLOW_ABOUT_TAB:
+ parser.scanStr((char *)params, "%b", &_settingsAllowAboutTab);
+ break;
+
+ case TOKEN_REGISTRY_PATH:
+ //BaseEngine::instance().getRegistry()->setBasePath((char *)params);
+ break;
+
+ case TOKEN_RICH_SAVED_GAMES:
+ parser.scanStr((char *)params, "%b", &_richSavedGames);
+ break;
+
+ case TOKEN_SAVED_GAME_EXT:
+ BaseUtils::setString(&_savedGameExt, (char *)params);
+ break;
+
+ case TOKEN_GUID:
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in game settings '%s'", filename);
+ ret = STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading game settings '%s'", filename);
+ ret = STATUS_FAILED;
+ }
+
+ _settingsAllowWindowed = true; // TODO: These two settings should probably be cleaned out altogether.
+ _compressedSavegames = true;
+
+ delete[] origBuffer;
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::persist(BasePersistenceManager *persistMgr) {
+ if (!persistMgr->getIsSaving()) {
+ cleanup();
+ }
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_activeObject));
+ persistMgr->transfer(TMEMBER(_capturedObject));
+ persistMgr->transfer(TMEMBER(_cursorNoninteractive));
+ persistMgr->transfer(TMEMBER(_editorMode));
+ persistMgr->transfer(TMEMBER(_fader));
+ persistMgr->transfer(TMEMBER(_freezeLevel));
+ persistMgr->transfer(TMEMBER(_focusedWindow));
+ persistMgr->transfer(TMEMBER(_fontStorage));
+ persistMgr->transfer(TMEMBER(_interactive));
+ persistMgr->transfer(TMEMBER(_keyboardState));
+ persistMgr->transfer(TMEMBER(_lastTime));
+ persistMgr->transfer(TMEMBER(_mainObject));
+ for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) {
+ persistMgr->transfer(TMEMBER(_music[i]));
+ persistMgr->transfer(TMEMBER(_musicStartTime[i]));
+ }
+
+ persistMgr->transfer(TMEMBER(_offsetX));
+ persistMgr->transfer(TMEMBER(_offsetY));
+ persistMgr->transfer(TMEMBER(_offsetPercentX));
+ persistMgr->transfer(TMEMBER(_offsetPercentY));
+
+ persistMgr->transfer(TMEMBER(_origInteractive));
+ persistMgr->transfer(TMEMBER_INT(_origState));
+ persistMgr->transfer(TMEMBER(_personalizedSave));
+ persistMgr->transfer(TMEMBER(_quitting));
+
+ _regObjects.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_scEngine));
+ //persistMgr->transfer(TMEMBER(_soundMgr));
+ persistMgr->transfer(TMEMBER_INT(_state));
+ //persistMgr->transfer(TMEMBER(_surfaceStorage));
+ persistMgr->transfer(TMEMBER(_subtitles));
+ persistMgr->transfer(TMEMBER(_subtitlesSpeed));
+ persistMgr->transfer(TMEMBER(_systemFont));
+ persistMgr->transfer(TMEMBER(_videoFont));
+ persistMgr->transfer(TMEMBER(_videoSubtitles));
+
+ persistMgr->transfer(TMEMBER(_timer));
+ persistMgr->transfer(TMEMBER(_timerDelta));
+ persistMgr->transfer(TMEMBER(_timerLast));
+
+ persistMgr->transfer(TMEMBER(_liveTimer));
+ persistMgr->transfer(TMEMBER(_liveTimerDelta));
+ persistMgr->transfer(TMEMBER(_liveTimerLast));
+
+ persistMgr->transfer(TMEMBER(_musicCrossfadeRunning));
+ persistMgr->transfer(TMEMBER(_musicCrossfadeStartTime));
+ persistMgr->transfer(TMEMBER(_musicCrossfadeLength));
+ persistMgr->transfer(TMEMBER(_musicCrossfadeChannel1));
+ persistMgr->transfer(TMEMBER(_musicCrossfadeChannel2));
+ persistMgr->transfer(TMEMBER(_musicCrossfadeSwap));
+
+ _renderer->persistSaveLoadImages(persistMgr);
+
+ persistMgr->transfer(TMEMBER_INT(_textEncoding));
+ persistMgr->transfer(TMEMBER(_textRTL));
+
+ persistMgr->transfer(TMEMBER(_soundBufferSizeSec));
+ persistMgr->transfer(TMEMBER(_suspendedRendering));
+
+ persistMgr->transfer(TMEMBER(_mouseLockRect));
+
+ _windows.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_suppressScriptErrors));
+ persistMgr->transfer(TMEMBER(_autorunDisabled));
+
+ persistMgr->transfer(TMEMBER(_autoSaveOnExit));
+ persistMgr->transfer(TMEMBER(_autoSaveSlot));
+ persistMgr->transfer(TMEMBER(_cursorHidden));
+
+ if (!persistMgr->getIsSaving()) {
+ _quitting = false;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::focusWindow(UIWindow *window) {
+ UIWindow *prev = _focusedWindow;
+
+ for (uint32 i = 0; i < _windows.size(); i++) {
+ if (_windows[i] == window) {
+ if (i < _windows.size() - 1) {
+ _windows.remove_at(i);
+ _windows.add(window);
+
+ _gameRef->_focusedWindow = window;
+ }
+
+ if (window->_mode == WINDOW_NORMAL && prev != window && _gameRef->validObject(prev) && (prev->_mode == WINDOW_EXCLUSIVE || prev->_mode == WINDOW_SYSTEM_EXCLUSIVE)) {
+ return focusWindow(prev);
+ } else {
+ return STATUS_OK;
+ }
+ }
+ }
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::freeze(bool includingMusic) {
+ if (_freezeLevel == 0) {
+ _scEngine->pauseAll();
+ _soundMgr->pauseAll(includingMusic);
+ _origState = _state;
+ _origInteractive = _interactive;
+ _interactive = true;
+ }
+ _state = GAME_FROZEN;
+ _freezeLevel++;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::unfreeze() {
+ if (_freezeLevel == 0) {
+ return STATUS_OK;
+ }
+
+ _freezeLevel--;
+ if (_freezeLevel == 0) {
+ _state = _origState;
+ _interactive = _origInteractive;
+ _scEngine->resumeAll();
+ _soundMgr->resumeAll();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::handleKeypress(Common::Event *event, bool printable) {
+ if (isVideoPlaying()) {
+ if (event->kbd.keycode == Common::KEYCODE_ESCAPE) {
+ stopVideo();
+ }
+ return true;
+ }
+
+ if (event->type == Common::EVENT_QUIT) {
+ onWindowClose();
+ return true;
+ }
+
+ _keyboardState->handleKeyPress(event);
+ _keyboardState->readKey(event);
+// TODO
+
+ if (_focusedWindow) {
+ if (!_gameRef->_focusedWindow->handleKeypress(event, _keyboardState->_currentPrintable)) {
+ /*if (event->type != SDL_TEXTINPUT) {*/
+ if (_gameRef->_focusedWindow->canHandleEvent("Keypress")) {
+ _gameRef->_focusedWindow->applyEvent("Keypress");
+ } else {
+ applyEvent("Keypress");
+ }
+ /*}*/
+ }
+ return true;
+ } else { /*if (event->type != SDL_TEXTINPUT)*/
+ applyEvent("Keypress");
+ return true;
+ }
+
+ return false;
+}
+
+void BaseGame::handleKeyRelease(Common::Event *event) {
+ _keyboardState->handleKeyRelease(event);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::handleMouseWheel(int delta) {
+ bool handled = false;
+ if (_focusedWindow) {
+ handled = _gameRef->_focusedWindow->handleMouseWheel(delta);
+
+ if (!handled) {
+ if (delta < 0 && _gameRef->_focusedWindow->canHandleEvent("MouseWheelDown")) {
+ _gameRef->_focusedWindow->applyEvent("MouseWheelDown");
+ handled = true;
+ } else if (_gameRef->_focusedWindow->canHandleEvent("MouseWheelUp")) {
+ _gameRef->_focusedWindow->applyEvent("MouseWheelUp");
+ handled = true;
+ }
+
+ }
+ }
+
+ if (!handled) {
+ if (delta < 0) {
+ applyEvent("MouseWheelDown");
+ } else {
+ applyEvent("MouseWheelUp");
+ }
+ }
+
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
+ if (verMajor) {
+ *verMajor = DCGF_VER_MAJOR;
+ }
+ if (verMinor) {
+ *verMinor = DCGF_VER_MINOR;
+ }
+
+ if (extMajor) {
+ *extMajor = 0;
+ }
+ if (extMinor) {
+ *extMinor = 0;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::setWindowTitle() {
+ if (_renderer) {
+ char title[512];
+ strcpy(title, _caption[0]);
+ if (title[0] != '\0') {
+ strcat(title, " - ");
+ }
+ strcat(title, "WME Lite");
+
+
+ Utf8String utf8Title;
+ if (_textEncoding == TEXT_UTF8) {
+ utf8Title = Utf8String(title);
+ } else {
+ warning("BaseGame::SetWindowTitle - Ignoring textencoding");
+ utf8Title = Utf8String(title);
+ /* WideString wstr = StringUtil::AnsiToWide(Title);
+ title = StringUtil::WideToUtf8(wstr);*/
+ }
+ warning("BaseGame::SetWindowTitle: Ignoring value: %s", utf8Title.c_str());
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::setActiveObject(BaseObject *obj) {
+ // not-active when game is frozen
+ if (obj && !_gameRef->_interactive && !obj->_nonIntMouseEvents) {
+ obj = NULL;
+ }
+
+ if (obj == _activeObject) {
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->applyEvent("MouseLeave");
+ }
+ //if (ValidObject(_activeObject)) _activeObject->applyEvent("MouseLeave");
+ _activeObject = obj;
+ if (_activeObject) {
+ _activeObject->applyEvent("MouseEntry");
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::pushViewport(BaseViewport *viewport) {
+ _viewportSP++;
+ if (_viewportSP >= (int32)_viewportStack.size()) {
+ _viewportStack.add(viewport);
+ } else {
+ _viewportStack[_viewportSP] = viewport;
+ }
+
+ _renderer->setViewport(viewport->getRect());
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::popViewport() {
+ _viewportSP--;
+ if (_viewportSP < -1) {
+ _gameRef->LOG(0, "Fatal: Viewport stack underflow!");
+ }
+
+ if (_viewportSP >= 0 && _viewportSP < (int32)_viewportStack.size()) {
+ _renderer->setViewport(_viewportStack[_viewportSP]->getRect());
+ } else _renderer->setViewport(_renderer->_drawOffsetX,
+ _renderer->_drawOffsetY,
+ _renderer->_width + _renderer->_drawOffsetX,
+ _renderer->_height + _renderer->_drawOffsetY);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::getCurrentViewportRect(Rect32 *rect, bool *custom) {
+ if (rect == NULL) {
+ return STATUS_FAILED;
+ } else {
+ if (_viewportSP >= 0) {
+ BasePlatform::copyRect(rect, _viewportStack[_viewportSP]->getRect());
+ if (custom) {
+ *custom = true;
+ }
+ } else {
+ BasePlatform::setRect(rect, _renderer->_drawOffsetX,
+ _renderer->_drawOffsetY,
+ _renderer->_width + _renderer->_drawOffsetX,
+ _renderer->_height + _renderer->_drawOffsetY);
+ if (custom) {
+ *custom = false;
+ }
+ }
+
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::getCurrentViewportOffset(int *offsetX, int *offsetY) {
+ if (_viewportSP >= 0) {
+ if (offsetX) {
+ *offsetX = _viewportStack[_viewportSP]->_offsetX;
+ }
+ if (offsetY) {
+ *offsetY = _viewportStack[_viewportSP]->_offsetY;
+ }
+ } else {
+ if (offsetX) {
+ *offsetX = 0;
+ }
+ if (offsetY) {
+ *offsetY = 0;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::windowLoadHook(UIWindow *win, char **buf, char **params) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::setInteractive(bool state) {
+ _interactive = state;
+ if (_transMgr) {
+ _transMgr->_origInteractive = state;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::resetMousePos() {
+ Common::Point p;
+ p.x = _mousePos.x + _renderer->_drawOffsetX;
+ p.y = _mousePos.y + _renderer->_drawOffsetY;
+
+ BasePlatform::setCursorPos(p.x, p.y);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::displayContent(bool doUpdate, bool displayAll) {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::displayContentSimple() {
+ // fill black
+ _renderer->fill(0, 0, 0);
+ _renderer->displayIndicator();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::updateMusicCrossfade() {
+ /* byte globMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */
+
+ if (!_musicCrossfadeRunning) {
+ return STATUS_OK;
+ }
+ if (_state == GAME_FROZEN) {
+ return STATUS_OK;
+ }
+
+ if (_musicCrossfadeChannel1 < 0 || _musicCrossfadeChannel1 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel1]) {
+ _musicCrossfadeRunning = false;
+ return STATUS_OK;
+ }
+ if (_musicCrossfadeChannel2 < 0 || _musicCrossfadeChannel2 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel2]) {
+ _musicCrossfadeRunning = false;
+ return STATUS_OK;
+ }
+
+ if (!_music[_musicCrossfadeChannel1]->isPlaying()) {
+ _music[_musicCrossfadeChannel1]->play();
+ }
+ if (!_music[_musicCrossfadeChannel2]->isPlaying()) {
+ _music[_musicCrossfadeChannel2]->play();
+ }
+
+ uint32 currentTime = _gameRef->_liveTimer - _musicCrossfadeStartTime;
+
+ if (currentTime >= _musicCrossfadeLength) {
+ _musicCrossfadeRunning = false;
+ //_music[_musicCrossfadeChannel2]->setVolume(GlobMusicVol);
+ _music[_musicCrossfadeChannel2]->setVolumePercent(100);
+
+ _music[_musicCrossfadeChannel1]->stop();
+ //_music[_musicCrossfadeChannel1]->setVolume(GlobMusicVol);
+ _music[_musicCrossfadeChannel1]->setVolumePercent(100);
+
+
+ if (_musicCrossfadeSwap) {
+ // swap channels
+ BaseSound *dummy = _music[_musicCrossfadeChannel1];
+ int dummyInt = _musicStartTime[_musicCrossfadeChannel1];
+
+ _music[_musicCrossfadeChannel1] = _music[_musicCrossfadeChannel2];
+ _musicStartTime[_musicCrossfadeChannel1] = _musicStartTime[_musicCrossfadeChannel2];
+
+ _music[_musicCrossfadeChannel2] = dummy;
+ _musicStartTime[_musicCrossfadeChannel2] = dummyInt;
+ }
+ } else {
+ //_music[_musicCrossfadeChannel1]->setVolume(GlobMusicVol - (float)CurrentTime / (float)_musicCrossfadeLength * GlobMusicVol);
+ //_music[_musicCrossfadeChannel2]->setVolume((float)CurrentTime / (float)_musicCrossfadeLength * GlobMusicVol);
+ _music[_musicCrossfadeChannel1]->setVolumePercent((int)(100.0f - (float)currentTime / (float)_musicCrossfadeLength * 100.0f));
+ _music[_musicCrossfadeChannel2]->setVolumePercent((int)((float)currentTime / (float)_musicCrossfadeLength * 100.0f));
+
+ //_gameRef->QuickMessageForm("%d %d", _music[_musicCrossfadeChannel1]->GetVolume(), _music[_musicCrossfadeChannel2]->GetVolume());
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::resetContent() {
+ _scEngine->clearGlobals();
+ //_timer = 0;
+ //_liveTimer = 0;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::DEBUG_DumpClassRegistry() {
+ warning("DEBUG_DumpClassRegistry - untested");
+ Common::DumpFile *f = new Common::DumpFile;
+ f->open("zz_class_reg_dump.log");
+
+ SystemClassRegistry::getInstance()->dumpClasses(f);
+
+ f->close();
+ delete f;
+ _gameRef->quickMessage("Classes dump completed.");
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::invalidateDeviceObjects() {
+ for (uint32 i = 0; i < _regObjects.size(); i++) {
+ _regObjects[i]->invalidateDeviceObjects();
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::restoreDeviceObjects() {
+ for (uint32 i = 0; i < _regObjects.size(); i++) {
+ _regObjects[i]->restoreDeviceObjects();
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::setWaitCursor(const char *filename) {
+ delete _cursorNoninteractive;
+ _cursorNoninteractive = NULL;
+
+ _cursorNoninteractive = new BaseSprite(_gameRef);
+ if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile(filename))) {
+ delete _cursorNoninteractive;
+ _cursorNoninteractive = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::isVideoPlaying() {
+ if (_videoPlayer->isPlaying()) {
+ return true;
+ }
+ if (_theoraPlayer && _theoraPlayer->isPlaying()) {
+ return true;
+ }
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::stopVideo() {
+ if (_videoPlayer->isPlaying()) {
+ _videoPlayer->stop();
+ }
+ if (_theoraPlayer && _theoraPlayer->isPlaying()) {
+ _theoraPlayer->stop();
+ delete _theoraPlayer;
+ _theoraPlayer = NULL;
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::drawCursor(BaseSprite *cursor) {
+ if (!cursor) {
+ return STATUS_FAILED;
+ }
+ if (cursor != _lastCursor) {
+ cursor->reset();
+ _lastCursor = cursor;
+ }
+ return cursor->draw(_mousePos.x, _mousePos.y);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onActivate(bool activate, bool refreshMouse) {
+ if (_shuttingDown || !_renderer) {
+ return STATUS_OK;
+ }
+
+ _renderer->_active = activate;
+
+ if (refreshMouse) {
+ Point32 p;
+ getMousePos(&p);
+ setActiveObject(_renderer->getObjectAt(p.x, p.y));
+ }
+
+ if (activate) {
+ _soundMgr->resumeAll();
+ } else {
+ _soundMgr->pauseAll();
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseLeftDown() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_LEFT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("LeftClick");
+ }
+ }
+
+ if (_activeObject != NULL) {
+ _capturedObject = _activeObject;
+ }
+ _mouseLeftDown = true;
+ BasePlatform::setCapture(/*_renderer->_window*/);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseLeftUp() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
+ }
+
+ BasePlatform::releaseCapture();
+ _capturedObject = NULL;
+ _mouseLeftDown = false;
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftRelease"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("LeftRelease");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseLeftDblClick() {
+ if (_state == GAME_RUNNING && !_interactive) {
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_LEFT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftDoubleClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("LeftDoubleClick");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseRightDblClick() {
+ if (_state == GAME_RUNNING && !_interactive) {
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_RIGHT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightDoubleClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("RightDoubleClick");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseRightDown() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_RIGHT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("RightClick");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseRightUp() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("RightRelease");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseMiddleDown() {
+ if (_state == GAME_RUNNING && !_interactive) {
+ return STATUS_OK;
+ }
+
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_MIDDLE);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleClick"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("MiddleClick");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onMouseMiddleUp() {
+ if (_activeObject) {
+ _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_MIDDLE);
+ }
+
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleRelease"));
+ if (!handled) {
+ if (_activeObject != NULL) {
+ _activeObject->applyEvent("MiddleRelease");
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onPaint() {
+ if (_renderer && _renderer->_windowed && _renderer->_ready) {
+ _renderer->initLoop();
+ displayContent(false, true);
+ displayDebugInfo();
+ _renderer->windowedBlt();
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onWindowClose() {
+ if (canHandleEvent("QuitGame")) {
+ if (_state != GAME_FROZEN) {
+ _gameRef->applyEvent("QuitGame");
+ }
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::displayDebugInfo() {
+ char str[100];
+
+ if (_debugShowFPS) {
+ sprintf(str, "FPS: %d", _gameRef->_fps);
+ _systemFont->drawText((byte *)str, 0, 0, 100, TAL_LEFT);
+ }
+
+ if (_gameRef->_debugDebugMode) {
+ if (!_gameRef->_renderer->_windowed) {
+ sprintf(str, "Mode: %dx%dx%d", _renderer->_width, _renderer->_height, _renderer->_bPP);
+ } else {
+ sprintf(str, "Mode: %dx%d windowed", _renderer->_width, _renderer->_height);
+ }
+
+ strcat(str, " (");
+ strcat(str, _renderer->getName().c_str());
+ strcat(str, ")");
+ _systemFont->drawText((byte *)str, 0, 0, _renderer->_width, TAL_RIGHT);
+
+ _renderer->displayDebugInfo();
+
+ int scrTotal, scrRunning, scrWaiting, scrPersistent;
+ scrTotal = _scEngine->getNumScripts(&scrRunning, &scrWaiting, &scrPersistent);
+ sprintf(str, "Running scripts: %d (r:%d w:%d p:%d)", scrTotal, scrRunning, scrWaiting, scrPersistent);
+ _systemFont->drawText((byte *)str, 0, 70, _renderer->_width, TAL_RIGHT);
+
+
+ sprintf(str, "Timer: %d", _timer);
+ _gameRef->_systemFont->drawText((byte *)str, 0, 130, _renderer->_width, TAL_RIGHT);
+
+ if (_activeObject != NULL) {
+ _systemFont->drawText((const byte *)_activeObject->getName(), 0, 150, _renderer->_width, TAL_RIGHT);
+ }
+
+ sprintf(str, "GfxMem: %dMB", _usedMem / (1024 * 1024));
+ _systemFont->drawText((byte *)str, 0, 170, _renderer->_width, TAL_RIGHT);
+
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::getMousePos(Point32 *pos) {
+ BasePlatform::getCursorPos(pos);
+
+ pos->x -= _renderer->_drawOffsetX;
+ pos->y -= _renderer->_drawOffsetY;
+
+ /*
+ // Windows can squish maximized window if it's larger than desktop
+ // so we need to modify mouse position appropriately (tnx mRax)
+ if (_renderer->_windowed && ::IsZoomed(_renderer->_window)) {
+ Common::Rect rc;
+ ::GetClientRect(_renderer->_window, &rc);
+ Pos->x *= _gameRef->_renderer->_realWidth;
+ Pos->x /= (rc.right - rc.left);
+ Pos->y *= _gameRef->_renderer->_realHeight;
+ Pos->y /= (rc.bottom - rc.top);
+ }
+ */
+
+ if (_mouseLockRect.left != 0 && _mouseLockRect.right != 0 && _mouseLockRect.top != 0 && _mouseLockRect.bottom != 0) {
+ if (!BasePlatform::ptInRect(&_mouseLockRect, *pos)) {
+ pos->x = MAX(_mouseLockRect.left, pos->x);
+ pos->y = MAX(_mouseLockRect.top, pos->y);
+
+ pos->x = MIN(_mouseLockRect.right, pos->x);
+ pos->y = MIN(_mouseLockRect.bottom, pos->y);
+
+ Point32 newPos = *pos;
+
+ newPos.x += _renderer->_drawOffsetX;
+ newPos.y += _renderer->_drawOffsetY;
+
+ BasePlatform::setCursorPos(newPos.x, newPos.y);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::miniUpdate() { // TODO: Is this really necessary, it used to update sound, but the mixer does that now.
+ if (!_miniUpdateEnabled) {
+ return;
+ }
+
+ if (g_system->getMillis() - _lastMiniUpdate > 200) {
+ _lastMiniUpdate = g_system->getMillis();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::onScriptShutdown(ScScript *script) {
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::isLeftDoubleClick() {
+ return isDoubleClick(0);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::isRightDoubleClick() {
+ return isDoubleClick(1);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::isDoubleClick(int buttonIndex) {
+ uint32 maxDoubleCLickTime = 500;
+ int maxMoveX = 4;
+ int maxMoveY = 4;
+
+ Point32 pos;
+ BasePlatform::getCursorPos(&pos);
+
+ int moveX = abs(pos.x - _lastClick[buttonIndex].posX);
+ int moveY = abs(pos.y - _lastClick[buttonIndex].posY);
+
+
+ if (_lastClick[buttonIndex].time == 0 || g_system->getMillis() - _lastClick[buttonIndex].time > maxDoubleCLickTime || moveX > maxMoveX || moveY > maxMoveY) {
+ _lastClick[buttonIndex].time = g_system->getMillis();
+ _lastClick[buttonIndex].posX = pos.x;
+ _lastClick[buttonIndex].posY = pos.y;
+ return false;
+ } else {
+ _lastClick[buttonIndex].time = 0;
+ return true;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::autoSaveOnExit() {
+ _soundMgr->saveSettings();
+ ConfMan.flushToDisk();
+
+ if (!_autoSaveOnExit) {
+ return;
+ }
+ if (_state == GAME_FROZEN) {
+ return;
+ }
+
+ saveGame(_autoSaveSlot, "autosave", true);
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::addMem(int bytes) {
+ _usedMem += bytes;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString BaseGame::getDeviceType() const {
+ return "computer";
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
new file mode 100644
index 0000000000..0f764b3d03
--- /dev/null
+++ b/engines/wintermute/base/base_game.h
@@ -0,0 +1,361 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_GAME_H
+#define WINTERMUTE_BASE_GAME_H
+
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/math/rect32.h"
+#include "common/events.h"
+
+namespace Wintermute {
+
+typedef void (*ENGINE_LOG_CALLBACK)(char *text, bool result, void *data);
+
+class BaseSoundMgr;
+class BaseFader;
+class BaseFont;
+class BaseFileManager;
+class BaseTransitionMgr;
+class ScEngine;
+class BaseFontStorage;
+class BaseStringTable;
+class BaseQuickMsg;
+class UIWindow;
+class BaseViewport;
+class BaseRenderer;
+class BaseRegistry;
+class BaseSaveThumbHelper;
+class BaseSurfaceStorage;
+class SXMath;
+class BaseKeyboardState;
+class VideoPlayer;
+class VideoTheoraPlayer;
+
+#define NUM_MUSIC_CHANNELS 5
+
+class BaseGame: public BaseObject {
+public:
+ DECLARE_PERSISTENT(BaseGame, BaseObject)
+
+ virtual bool onScriptShutdown(ScScript *script);
+
+ virtual bool onActivate(bool activate, bool refreshMouse);
+ virtual bool onMouseLeftDown();
+ virtual bool onMouseLeftUp();
+ virtual bool onMouseLeftDblClick();
+ virtual bool onMouseRightDblClick();
+ virtual bool onMouseRightDown();
+ virtual bool onMouseRightUp();
+ virtual bool onMouseMiddleDown();
+ virtual bool onMouseMiddleUp();
+ virtual bool onPaint();
+ virtual bool onWindowClose();
+
+ bool isLeftDoubleClick();
+ bool isRightDoubleClick();
+
+ bool _autorunDisabled;
+
+ uint32 _lastMiniUpdate;
+ bool _miniUpdateEnabled;
+
+ virtual void miniUpdate();
+
+ void getMousePos(Point32 *Pos);
+ Rect32 _mouseLockRect;
+
+ bool _shuttingDown;
+
+ virtual bool displayDebugInfo();
+ bool _debugShowFPS;
+
+ bool _suspendedRendering;
+ int _soundBufferSizeSec;
+
+ TTextEncoding _textEncoding;
+ bool _textRTL;
+
+ virtual bool resetContent();
+
+ void DEBUG_DumpClassRegistry();
+ bool setWaitCursor(const char *filename);
+
+ int _thumbnailWidth;
+ int _thumbnailHeight;
+
+ bool _editorMode;
+ void getOffset(int *offsetX, int *offsetY);
+ void setOffset(int offsetX, int offsetY);
+ int getSequence();
+
+ int _offsetY;
+ int _offsetX;
+ float _offsetPercentX;
+ float _offsetPercentY;
+ BaseObject *_mainObject;
+
+ bool initInput();
+ bool initLoop();
+ uint32 _currentTime;
+ uint32 _deltaTime;
+ BaseFont *_systemFont;
+ BaseFont *_videoFont;
+ bool initialize1();
+ bool initialize2();
+ bool initialize3();
+ BaseTransitionMgr *_transMgr;
+
+ void LOG(bool res, const char *fmt, ...);
+
+ BaseRenderer *_renderer;
+ BaseSoundMgr *_soundMgr;
+ ScEngine *_scEngine;
+ SXMath *_mathClass;
+ BaseSurfaceStorage *_surfaceStorage;
+ BaseFontStorage *_fontStorage;
+ BaseGame(const Common::String &gameId);
+ virtual ~BaseGame();
+
+ void DEBUG_DebugDisable();
+ void DEBUG_DebugEnable(const char *filename = NULL);
+ bool _debugDebugMode;
+
+ void *_debugLogFile;
+ int _sequence;
+ virtual bool loadFile(const char *filename);
+ virtual bool loadBuffer(byte *buffer, bool complete = true);
+
+ int _viewportSP;
+
+ BaseStringTable *_stringTable;
+ int _settingsResWidth;
+ int _settingsResHeight;
+ char *_settingsGameFile;
+ bool _suppressScriptErrors;
+ bool _mouseLeftDown; // TODO: Hide
+
+ virtual bool externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name);
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+ // compatibility bits
+ bool _compatKillMethodThreads;
+
+ const char* getGameId() { return _gameId.c_str(); }
+ void setGameId(const Common::String& gameId) { _gameId = gameId; }
+ uint32 _surfaceGCCycleTime;
+ bool _smartCache; // RO
+ bool _subtitles; // RO
+
+ int _scheduledLoadSlot;
+ bool _loading;
+
+ virtual bool handleMouseWheel(int delta);
+ bool _quitting;
+ virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
+
+ virtual bool handleKeypress(Common::Event *event, bool printable = false);
+ virtual void handleKeyRelease(Common::Event *event);
+
+ bool unfreeze();
+ bool freeze(bool includingMusic = true);
+ bool focusWindow(UIWindow *window);
+ bool _loadInProgress;
+ UIWindow *_focusedWindow;
+ bool _editorForceScripts;
+
+ static void invalidateValues(void *value, void *data);
+
+ bool loadSettings(const char *filename);
+
+ bool displayWindows(bool inGame = false);
+ bool _useD3D;
+ virtual bool cleanup();
+ bool loadGame(int slot);
+ bool loadGame(const char *filename);
+ bool saveGame(int slot, const char *desc, bool quickSave = false);
+ virtual bool showCursor();
+
+ BaseObject *_activeObject;
+
+ bool _interactive;
+ TGameState _state;
+ TGameState _origState;
+ bool _origInteractive;
+ uint32 _timer;
+ uint32 _timerDelta;
+ uint32 _timerLast;
+
+ uint32 _liveTimer;
+ uint32 _liveTimerDelta;
+ uint32 _liveTimerLast;
+
+ BaseObject *_capturedObject;
+ Point32 _mousePos;
+ bool validObject(BaseObject *object);
+ bool unregisterObject(BaseObject *object);
+ bool registerObject(BaseObject *object);
+ void quickMessage(const char *text);
+ void quickMessageForm(char *fmt, ...);
+ bool displayQuickMsg();
+
+ virtual bool displayContent(bool update = true, bool displayAll = false);
+ virtual bool displayContentSimple();
+ bool _forceNonStreamedSounds;
+ void resetMousePos();
+ int _subtitlesSpeed;
+ void setInteractive(bool state);
+ virtual bool windowLoadHook(UIWindow *win, char **buf, char **params);
+ virtual bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name);
+ bool getCurrentViewportOffset(int *offsetX = NULL, int *offsetY = NULL);
+ bool getCurrentViewportRect(Rect32 *rect, bool *custom = NULL);
+ bool popViewport();
+ bool pushViewport(BaseViewport *Viewport);
+ bool setActiveObject(BaseObject *Obj);
+ BaseSprite *_lastCursor;
+ bool drawCursor(BaseSprite *Cursor);
+
+ BaseSaveThumbHelper *_cachedThumbnail;
+ void addMem(int bytes);
+ bool _touchInterface;
+ bool _constrainedMemory;
+protected:
+ BaseSprite *_loadingIcon;
+ int _loadingIconX;
+ int _loadingIconY;
+ int _loadingIconPersistent;
+
+ BaseFader *_fader;
+
+ int _freezeLevel;
+ VideoPlayer *_videoPlayer;
+ VideoTheoraPlayer *_theoraPlayer;
+private:
+ bool _mouseRightDown;
+ bool _mouseMidlleDown;
+ bool _settingsRequireAcceleration;
+ bool _settingsAllowWindowed;
+ bool _settingsAllowAdvanced;
+ bool _settingsAllowAccessTab;
+ bool _settingsAllowAboutTab;
+ bool _settingsRequireSound;
+ bool _settingsAllowDesktopRes;
+ int _settingsTLMode;
+ virtual bool invalidateDeviceObjects();
+ virtual bool restoreDeviceObjects();
+
+ char *_localSaveDir;
+ bool _saveDirChecked;
+ bool _richSavedGames;
+ char *_savedGameExt;
+
+ bool _reportTextureFormat;
+
+ // FPS stuff
+ uint32 _lastTime;
+ uint32 _fpsTime;
+ uint32 _framesRendered;
+ Common::String _gameId;
+
+ void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = NULL, void *data = NULL);
+ ENGINE_LOG_CALLBACK _engineLogCallback;
+ void *_engineLogCallbackData;
+
+ bool _videoSubtitles;
+ uint32 _musicStartTime[NUM_MUSIC_CHANNELS];
+ bool _compressedSavegames;
+
+ bool _personalizedSave;
+
+ void setWindowTitle();
+
+ bool resumeMusic(int channel);
+ bool setMusicStartTime(int channel, uint32 time);
+ bool pauseMusic(int channel);
+ bool stopMusic(int channel);
+ bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0);
+ BaseSound *_music[NUM_MUSIC_CHANNELS];
+ bool _musicCrossfadeRunning;
+ bool _musicCrossfadeSwap;
+ uint32 _musicCrossfadeStartTime;
+ uint32 _musicCrossfadeLength;
+ int _musicCrossfadeChannel1;
+ int _musicCrossfadeChannel2;
+
+ BaseSprite *_cursorNoninteractive;
+ BaseKeyboardState *_keyboardState;
+
+ uint32 _fps;
+ bool updateMusicCrossfade();
+
+ bool isVideoPlaying();
+ bool stopVideo();
+
+ BaseArray<BaseQuickMsg *> _quickMessages;
+ BaseArray<UIWindow *> _windows;
+ BaseArray<BaseViewport *> _viewportStack;
+ BaseArray<BaseObject *> _regObjects;
+
+ AnsiString getDeviceType() const;
+
+ struct LastClickInfo {
+ LastClickInfo() {
+ posX = posY = 0;
+ time = 0;
+ }
+
+ int posX;
+ int posY;
+ uint32 time;
+ };
+
+ LastClickInfo _lastClick[2];
+ bool isDoubleClick(int buttonIndex);
+ uint32 _usedMem;
+
+
+
+protected:
+ // WME Lite specific
+ bool _autoSaveOnExit;
+ int _autoSaveSlot;
+ bool _cursorHidden;
+
+public:
+ void autoSaveOnExit();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp
new file mode 100644
index 0000000000..da7baafd2d
--- /dev/null
+++ b/engines/wintermute/base/base_keyboard_state.cpp
@@ -0,0 +1,309 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_keyboard_state.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "common/system.h"
+#include "common/keyboard.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseKeyboardState, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseKeyboardState::BaseKeyboardState(BaseGame *inGame) : BaseScriptable(inGame) {
+ _currentPrintable = false;
+ _currentCharCode = 0;
+ _currentKeyData = 0;
+
+ _currentShift = false;
+ _currentAlt = false;
+ _currentControl = false;
+
+ _keyStates = new uint8[323]; // Hardcoded size for the common/keyboard.h enum
+ for (int i = 0; i < 323; i++) {
+ _keyStates[i] = false;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseKeyboardState::~BaseKeyboardState() {
+ delete[] _keyStates;
+}
+
+void BaseKeyboardState::handleKeyPress(Common::Event *event) {
+ if (event->type == Common::EVENT_KEYDOWN) {
+ _keyStates[event->kbd.keycode] = true;
+ }
+}
+
+void BaseKeyboardState::handleKeyRelease(Common::Event *event) {
+ if (event->type == Common::EVENT_KEYUP) {
+ _keyStates[event->kbd.keycode] = false;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // IsKeyDown
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "IsKeyDown") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ int vKey;
+
+ if (val->_type == VAL_STRING && strlen(val->getString()) > 0) {
+ const char *str = val->getString();
+ char temp = str[0];
+ if (temp >= 'A' && temp <= 'Z') {
+ temp += ('a' - 'A');
+ }
+ vKey = (int)temp;
+ } else {
+ vKey = val->getInt();
+ }
+
+ bool isDown = _keyStates[vKeyToKeyCode(vKey)];
+
+ stack->pushBool(isDown);
+ return STATUS_OK;
+ } else {
+ return BaseScriptable::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseKeyboardState::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("keyboard");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Key
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Key") {
+ if (_currentPrintable) {
+ char key[2];
+ key[0] = (char)_currentCharCode;
+ key[1] = '\0';
+ _scValue->setString(key);
+ } else {
+ _scValue->setString("");
+ }
+
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Printable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Printable") {
+ _scValue->setBool(_currentPrintable);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // KeyCode
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "KeyCode") {
+ _scValue->setInt(_currentCharCode);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsShift
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "IsShift") {
+ _scValue->setBool(_currentShift);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsAlt
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "IsAlt") {
+ _scValue->setBool(_currentAlt);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsControl
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "IsControl") {
+ _scValue->setBool(_currentControl);
+ return _scValue;
+ } else {
+ return BaseScriptable::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::scSetProperty(const char *name, ScValue *value) {
+ /*
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ if (_renderer) SetWindowText(_renderer->_window, _name);
+ return STATUS_OK;
+ }
+
+ else*/ return BaseScriptable::scSetProperty(name, value);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseKeyboardState::scToString() {
+ return "[keyboard state]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::readKey(Common::Event *event) {
+ //_currentPrintable = (event->type == SDL_TEXTINPUT); // TODO
+ _currentCharCode = keyCodeToVKey(event);
+ if ((_currentCharCode <= Common::KEYCODE_z && _currentCharCode >= Common::KEYCODE_a) ||
+ (_currentCharCode <= Common::KEYCODE_9 && _currentCharCode >= Common::KEYCODE_0) ||
+ (_currentCharCode == Common::KEYCODE_SPACE)) {
+ _currentPrintable = true;
+ } else {
+ _currentPrintable = false;
+ }
+ //_currentKeyData = KeyData;
+
+ _currentControl = isControlDown();
+ _currentAlt = isAltDown();
+ _currentShift = isShiftDown();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::persist(BasePersistenceManager *persistMgr) {
+ //if (!persistMgr->getIsSaving()) cleanup();
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_currentAlt));
+ persistMgr->transfer(TMEMBER(_currentCharCode));
+ persistMgr->transfer(TMEMBER(_currentControl));
+ persistMgr->transfer(TMEMBER(_currentKeyData));
+ persistMgr->transfer(TMEMBER(_currentPrintable));
+ persistMgr->transfer(TMEMBER(_currentShift));
+
+ if (!persistMgr->getIsSaving()) {
+ _keyStates = new uint8[323]; // Hardcoded size for the common/keyboard.h enum
+ for (int i = 0; i < 323; i++) {
+ _keyStates[i] = false;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::isShiftDown() {
+ int mod = g_system->getEventManager()->getModifierState();
+ return (mod & Common::KBD_SHIFT);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::isControlDown() {
+ int mod = g_system->getEventManager()->getModifierState();
+ return (mod & Common::KBD_CTRL);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseKeyboardState::isAltDown() {
+ int mod = g_system->getEventManager()->getModifierState();
+ return (mod & Common::KBD_ALT);
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseKeyboardState::keyCodeToVKey(Common::Event *event) {
+ if (event->type != Common::EVENT_KEYDOWN) {
+ return 0;
+ }
+
+ switch (event->kbd.keycode) {
+ case Common::KEYCODE_KP_ENTER:
+ return Common::KEYCODE_RETURN;
+ default:
+ return (uint32)event->kbd.keycode;
+ }
+}
+
+enum VKeyCodes {
+ kVkSpace = 32,
+ kVkLeft = 37,
+ kVkUp = 38,
+ kVkRight = 39,
+ kVkDown = 40
+};
+
+//////////////////////////////////////////////////////////////////////////
+Common::KeyCode BaseKeyboardState::vKeyToKeyCode(uint32 vkey) {
+ // todo
+ switch (vkey) {
+ case kVkSpace:
+ return Common::KEYCODE_SPACE;
+ break;
+ case kVkLeft:
+ return Common::KEYCODE_LEFT;
+ break;
+ case kVkRight:
+ return Common::KEYCODE_RIGHT;
+ break;
+ case kVkUp:
+ return Common::KEYCODE_UP;
+ break;
+ case kVkDown:
+ return Common::KEYCODE_DOWN;
+ break;
+ default:
+ warning("Unknown VKEY: %d", vkey);
+ return (Common::KeyCode)vkey;
+ break;
+ }
+
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h
new file mode 100644
index 0000000000..dfd0efdec0
--- /dev/null
+++ b/engines/wintermute/base/base_keyboard_state.h
@@ -0,0 +1,75 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_KEYBOARD_STATE_H
+#define WINTERMUTE_BASE_KEYBOARD_STATE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/base/base_scriptable.h"
+#include "common/keyboard.h"
+#include "common/events.h"
+
+namespace Wintermute {
+
+class BaseKeyboardState : public BaseScriptable {
+public:
+ uint32 _currentKeyData;
+ uint32 _currentCharCode;
+ bool _currentPrintable;
+
+ bool _currentShift;
+ bool _currentAlt;
+ bool _currentControl;
+
+ DECLARE_PERSISTENT(BaseKeyboardState, BaseScriptable)
+ BaseKeyboardState(BaseGame *inGame);
+ virtual ~BaseKeyboardState();
+ bool readKey(Common::Event *event);
+
+ void handleKeyPress(Common::Event *event);
+ void handleKeyRelease(Common::Event *event);
+ static bool isShiftDown();
+ static bool isControlDown();
+ static bool isAltDown();
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+private:
+ uint8 *_keyStates;
+ uint32 keyCodeToVKey(Common::Event *event);
+ Common::KeyCode vKeyToKeyCode(uint32 vkey); //TODO, reimplement using ScummVM-backend
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp
new file mode 100644
index 0000000000..915bf24d7f
--- /dev/null
+++ b/engines/wintermute/base/base_named_object.cpp
@@ -0,0 +1,71 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_named_object.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseNamedObject::BaseNamedObject(BaseGame *inGame) : BaseClass(inGame) {
+ _name = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseNamedObject::BaseNamedObject() : BaseClass() {
+ _name = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseNamedObject::BaseNamedObject(TDynamicConstructor, TDynamicConstructor) {
+ _name = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseNamedObject::~BaseNamedObject(void) {
+ delete[] _name;
+ _name = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseNamedObject::setName(const char *name) {
+ delete[] _name;
+ _name = NULL;
+
+ if (name == NULL) {
+ return;
+ }
+
+ _name = new char [strlen(name) + 1];
+ if (_name != NULL) {
+ strcpy(_name, name);
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_named_object.h b/engines/wintermute/base/base_named_object.h
new file mode 100644
index 0000000000..77a00cee45
--- /dev/null
+++ b/engines/wintermute/base/base_named_object.h
@@ -0,0 +1,51 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_NAMED_OBJECT_H
+#define WINTERMUTE_BASE_NAMED_OBJECT_H
+
+
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BaseNamedObject : public BaseClass {
+ char *_name;
+public:
+ BaseNamedObject(BaseGame *inGame);
+ BaseNamedObject();
+ virtual ~BaseNamedObject(void);
+ BaseNamedObject(TDynamicConstructor, TDynamicConstructor);
+
+ const char *getName() { return _name; }
+ void setName(const char *name);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp
new file mode 100644
index 0000000000..eba8416485
--- /dev/null
+++ b/engines/wintermute/base/base_object.cpp
@@ -0,0 +1,1246 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/platform_osystem.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseObject, false)
+
+//////////////////////////////////////////////////////////////////////
+BaseObject::BaseObject(BaseGame *inGame) : BaseScriptHolder(inGame) {
+ _posX = _posY = 0;
+ _movable = true;
+ _zoomable = true;
+ _registrable = true;
+ _shadowable = true;
+ _rotatable = false;
+ _is3D = false;
+
+ _alphaColor = 0;
+ _scale = -1;
+ _relativeScale = 0;
+
+ _scaleX = -1;
+ _scaleY = -1;
+
+ _ready = true;
+
+ _soundEvent = NULL;
+
+ _iD = _gameRef->getSequence();
+
+ BasePlatform::setRectEmpty(&_rect);
+ _rectSet = false;
+
+ _cursor = NULL;
+ _activeCursor = NULL;
+ _sharedCursors = false;
+
+ _sFX = NULL;
+ _sFXStart = 0;
+ _sFXVolume = 100;
+ _autoSoundPanning = true;
+
+ _editorAlwaysRegister = false;
+ _editorSelected = false;
+
+ _editorOnly = false;
+
+ _rotate = 0.0f;
+ _rotateValid = false;
+ _relativeRotate = 0.0f;
+
+ for (int i = 0; i < 7; i++) {
+ _caption[i] = NULL;
+ }
+ _saveState = true;
+
+ _nonIntMouseEvents = false;
+
+ // sound FX
+ _sFXType = SFX_NONE;
+ _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
+
+ _blendMode = BLEND_NORMAL;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseObject::~BaseObject() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::cleanup() {
+ if (_gameRef && _gameRef->_activeObject == this) {
+ _gameRef->_activeObject = NULL;
+ }
+
+ BaseScriptHolder::cleanup();
+ delete[] _soundEvent;
+ _soundEvent = NULL;
+
+ if (!_sharedCursors) {
+ delete _cursor;
+ delete _activeCursor;
+ _cursor = NULL;
+ _activeCursor = NULL;
+ }
+ delete _sFX;
+ _sFX = NULL;
+
+ for (int i = 0; i < 7; i++) {
+ delete[] _caption[i];
+ _caption[i] = NULL;
+ }
+
+ _sFXType = SFX_NONE;
+ _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseObject::setCaption(const char *caption, int caseVal) {
+ if (caseVal == 0) {
+ caseVal = 1;
+ }
+ if (caseVal < 1 || caseVal > 7) {
+ return;
+ }
+
+ delete[] _caption[caseVal - 1];
+ _caption[caseVal - 1] = new char[strlen(caption) + 1];
+ if (_caption[caseVal - 1]) {
+ strcpy(_caption[caseVal - 1], caption);
+ _gameRef->_stringTable->expand(&_caption[caseVal - 1]);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseObject::getCaption(int caseVal) {
+ if (caseVal == 0) {
+ caseVal = 1;
+ }
+ if (caseVal < 1 || caseVal > 7 || _caption[caseVal - 1] == NULL) {
+ return "";
+ } else {
+ return _caption[caseVal - 1];
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::listen(BaseScriptHolder *param1, uint32 param2) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // SkipTo
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SkipTo") == 0) {
+ stack->correctParams(2);
+ _posX = stack->pop()->getInt();
+ _posY = stack->pop()->getInt();
+ afterMove();
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Caption
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Caption") == 0) {
+ stack->correctParams(1);
+ stack->pushString(getCaption(stack->pop()->getInt()));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetCursor") == 0) {
+ stack->correctParams(1);
+ if (DID_SUCCEED(setCursor(stack->pop()->getString()))) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveCursor") == 0) {
+ stack->correctParams(0);
+ if (!_sharedCursors) {
+ delete _cursor;
+ _cursor = NULL;
+ } else {
+ _cursor = NULL;
+
+ }
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetCursor") == 0) {
+ stack->correctParams(0);
+ if (!_cursor || !_cursor->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_cursor->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetCursorObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetCursorObject") == 0) {
+ stack->correctParams(0);
+ if (!_cursor) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_cursor, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HasCursor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HasCursor") == 0) {
+ stack->correctParams(0);
+
+ if (_cursor) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetCaption
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetCaption") == 0) {
+ stack->correctParams(2);
+ setCaption(stack->pop()->getString(), stack->pop()->getInt());
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadSound
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadSound") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+ if (DID_SUCCEED(playSFX(filename, false, false))) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlaySound
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PlaySound") == 0) {
+ stack->correctParams(3);
+
+ const char *filename;
+ bool looping;
+ uint32 loopStart;
+
+ ScValue *val1 = stack->pop();
+ ScValue *val2 = stack->pop();
+ ScValue *val3 = stack->pop();
+
+ if (val1->_type == VAL_BOOL) {
+ filename = NULL;
+ looping = val1->getBool();
+ loopStart = val2->getInt();
+ } else {
+ if (val1->isNULL()) {
+ filename = NULL;
+ } else {
+ filename = val1->getString();
+ }
+ looping = val2->isNULL() ? false : val2->getBool();
+ loopStart = val3->getInt();
+ }
+
+ if (DID_FAIL(playSFX(filename, looping, true, NULL, loopStart))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PlaySoundEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PlaySoundEvent") == 0) {
+ stack->correctParams(2);
+
+ const char *filename;
+ const char *eventName;
+
+ ScValue *val1 = stack->pop();
+ ScValue *val2 = stack->pop();
+
+ if (val2->isNULL()) {
+ filename = NULL;
+ eventName = val1->getString();
+ } else {
+ filename = val1->getString();
+ eventName = val2->getString();
+ }
+
+ if (DID_FAIL(playSFX(filename, false, true, eventName))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // StopSound
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "StopSound") == 0) {
+ stack->correctParams(0);
+
+ if (DID_FAIL(stopSFX())) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PauseSound
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PauseSound") == 0) {
+ stack->correctParams(0);
+
+ if (DID_FAIL(pauseSFX())) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ResumeSound
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ResumeSound") == 0) {
+ stack->correctParams(0);
+
+ if (DID_FAIL(resumeSFX())) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsSoundPlaying
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsSoundPlaying") == 0) {
+ stack->correctParams(0);
+
+ if (_sFX && _sFX->isPlaying()) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetSoundPosition
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetSoundPosition") == 0) {
+ stack->correctParams(1);
+
+ uint32 time = stack->pop()->getInt();
+ if (DID_FAIL(setSFXTime(time))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSoundPosition
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSoundPosition") == 0) {
+ stack->correctParams(0);
+
+ if (!_sFX) {
+ stack->pushInt(0);
+ } else {
+ stack->pushInt(_sFX->getPositionTime());
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetSoundVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetSoundVolume") == 0) {
+ stack->correctParams(1);
+
+ int volume = stack->pop()->getInt();
+ if (DID_FAIL(setSFXVolume(volume))) {
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetSoundVolume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSoundVolume") == 0) {
+ stack->correctParams(0);
+
+ if (!_sFX) {
+ stack->pushInt(_sFXVolume);
+ } else {
+ stack->pushInt(_sFX->getVolumePercent());
+ }
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundFXNone
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SoundFXNone") == 0) {
+ stack->correctParams(0);
+ _sFXType = SFX_NONE;
+ _sFXParam1 = 0;
+ _sFXParam2 = 0;
+ _sFXParam3 = 0;
+ _sFXParam4 = 0;
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundFXEcho
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SoundFXEcho") == 0) {
+ stack->correctParams(4);
+ _sFXType = SFX_ECHO;
+ _sFXParam1 = (float)stack->pop()->getFloat(0); // Wet/Dry Mix [%] (0-100)
+ _sFXParam2 = (float)stack->pop()->getFloat(0); // Feedback [%] (0-100)
+ _sFXParam3 = (float)stack->pop()->getFloat(333.0f); // Left Delay [ms] (1-2000)
+ _sFXParam4 = (float)stack->pop()->getFloat(333.0f); // Right Delay [ms] (1-2000)
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundFXReverb
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SoundFXReverb") == 0) {
+ stack->correctParams(4);
+ _sFXType = SFX_REVERB;
+ _sFXParam1 = (float)stack->pop()->getFloat(0); // In Gain [dB] (-96 - 0)
+ _sFXParam2 = (float)stack->pop()->getFloat(0); // Reverb Mix [dB] (-96 - 0)
+ _sFXParam3 = (float)stack->pop()->getFloat(1000.0f); // Reverb Time [ms] (0.001 - 3000)
+ _sFXParam4 = (float)stack->pop()->getFloat(0.001f); // HighFreq RT Ratio (0.001 - 0.999)
+ stack->pushNULL();
+
+ return STATUS_OK;
+ } else {
+ return BaseScriptHolder::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseObject::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("object");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Caption
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Caption") {
+ _scValue->setString(getCaption(1));
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // X
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "X") {
+ _scValue->setInt(_posX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Y
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Y") {
+ _scValue->setInt(_posY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Height (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Height") {
+ _scValue->setInt(getHeight());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Ready (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Ready") {
+ _scValue->setBool(_ready);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Movable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Movable") {
+ _scValue->setBool(_movable);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Registrable/Interactive
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Registrable" || name == "Interactive") {
+ _scValue->setBool(_registrable);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Zoomable/Scalable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Zoomable" || name == "Scalable") {
+ _scValue->setBool(_zoomable);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Rotatable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Rotatable") {
+ _scValue->setBool(_rotatable);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AlphaColor") {
+ _scValue->setInt((int)_alphaColor);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // BlendMode
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "BlendMode") {
+ _scValue->setInt((int)_blendMode);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Scale
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Scale") {
+ if (_scale < 0) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setFloat((double)_scale);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScaleX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScaleX") {
+ if (_scaleX < 0) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setFloat((double)_scaleX);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScaleY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScaleY") {
+ if (_scaleY < 0) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setFloat((double)_scaleY);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RelativeScale
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "RelativeScale") {
+ _scValue->setFloat((double)_relativeScale);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Rotate
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Rotate") {
+ if (!_rotateValid) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setFloat((double)_rotate);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RelativeRotate
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "RelativeRotate") {
+ _scValue->setFloat((double)_relativeRotate);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Colorable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Colorable") {
+ _scValue->setBool(_shadowable);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SoundPanning
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SoundPanning") {
+ _scValue->setBool(_autoSoundPanning);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SaveState
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SaveState") {
+ _scValue->setBool(_saveState);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NonIntMouseEvents
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NonIntMouseEvents") {
+ _scValue->setBool(_nonIntMouseEvents);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccCaption
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccCaption") {
+ _scValue->setNULL();
+ return _scValue;
+ } else {
+ return BaseScriptHolder::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Caption
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Caption") == 0) {
+ setCaption(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // X
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "X") == 0) {
+ _posX = value->getInt();
+ afterMove();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Y
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Y") == 0) {
+ _posY = value->getInt();
+ afterMove();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Movable
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Movable") == 0) {
+ _movable = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Registrable/Interactive
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Registrable") == 0 || strcmp(name, "Interactive") == 0) {
+ _registrable = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Zoomable/Scalable
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Zoomable") == 0 || strcmp(name, "Scalable") == 0) {
+ _zoomable = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Rotatable
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Rotatable") == 0) {
+ _rotatable = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AlphaColor") == 0) {
+ _alphaColor = (uint32)value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // BlendMode
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "BlendMode") == 0) {
+ int i = value->getInt();
+ if (i < BLEND_NORMAL || i >= NUM_BLEND_MODES) {
+ i = BLEND_NORMAL;
+ }
+ _blendMode = (TSpriteBlendMode)i;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Scale
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Scale") == 0) {
+ if (value->isNULL()) {
+ _scale = -1;
+ } else {
+ _scale = (float)value->getFloat();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScaleX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScaleX") == 0) {
+ if (value->isNULL()) {
+ _scaleX = -1;
+ } else {
+ _scaleX = (float)value->getFloat();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ScaleY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScaleY") == 0) {
+ if (value->isNULL()) {
+ _scaleY = -1;
+ } else {
+ _scaleY = (float)value->getFloat();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RelativeScale
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RelativeScale") == 0) {
+ _relativeScale = (float)value->getFloat();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Rotate
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Rotate") == 0) {
+ if (value->isNULL()) {
+ _rotate = 0.0f;
+ _rotateValid = false;
+ } else {
+ _rotate = (float)value->getFloat();
+ _rotateValid = true;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RelativeRotate
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RelativeRotate") == 0) {
+ _relativeRotate = (float)value->getFloat();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Colorable
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Colorable") == 0) {
+ _shadowable = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SoundPanning
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SoundPanning") == 0) {
+ _autoSoundPanning = value->getBool();
+ if (!_autoSoundPanning) {
+ resetSoundPan();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SaveState
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SaveState") == 0) {
+ _saveState = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NonIntMouseEvents
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "NonIntMouseEvents") == 0) {
+ _nonIntMouseEvents = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccCaption
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AccCaption") == 0) {
+ return STATUS_OK;
+ } else {
+ return BaseScriptHolder::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseObject::scToString() {
+ return "[object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::showCursor() {
+ if (_cursor) {
+ return _gameRef->drawCursor(_cursor);
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::persist(BasePersistenceManager *persistMgr) {
+ BaseScriptHolder::persist(persistMgr);
+
+ for (int i = 0; i < 7; i++) {
+ persistMgr->transfer(TMEMBER(_caption[i]));
+ }
+ persistMgr->transfer(TMEMBER(_activeCursor));
+ persistMgr->transfer(TMEMBER(_alphaColor));
+ persistMgr->transfer(TMEMBER(_autoSoundPanning));
+ persistMgr->transfer(TMEMBER(_cursor));
+ persistMgr->transfer(TMEMBER(_sharedCursors));
+ persistMgr->transfer(TMEMBER(_editorAlwaysRegister));
+ persistMgr->transfer(TMEMBER(_editorOnly));
+ persistMgr->transfer(TMEMBER(_editorSelected));
+ persistMgr->transfer(TMEMBER(_iD));
+ persistMgr->transfer(TMEMBER(_is3D));
+ persistMgr->transfer(TMEMBER(_movable));
+ persistMgr->transfer(TMEMBER(_posX));
+ persistMgr->transfer(TMEMBER(_posY));
+ persistMgr->transfer(TMEMBER(_relativeScale));
+ persistMgr->transfer(TMEMBER(_rotatable));
+ persistMgr->transfer(TMEMBER(_scale));
+ persistMgr->transfer(TMEMBER(_sFX));
+ persistMgr->transfer(TMEMBER(_sFXStart));
+ persistMgr->transfer(TMEMBER(_sFXVolume));
+ persistMgr->transfer(TMEMBER(_ready));
+ persistMgr->transfer(TMEMBER(_rect));
+ persistMgr->transfer(TMEMBER(_rectSet));
+ persistMgr->transfer(TMEMBER(_registrable));
+ persistMgr->transfer(TMEMBER(_shadowable));
+ persistMgr->transfer(TMEMBER(_soundEvent));
+ persistMgr->transfer(TMEMBER(_zoomable));
+
+ persistMgr->transfer(TMEMBER(_scaleX));
+ persistMgr->transfer(TMEMBER(_scaleY));
+
+ persistMgr->transfer(TMEMBER(_rotate));
+ persistMgr->transfer(TMEMBER(_rotateValid));
+ persistMgr->transfer(TMEMBER(_relativeRotate));
+
+ persistMgr->transfer(TMEMBER(_saveState));
+ persistMgr->transfer(TMEMBER(_nonIntMouseEvents));
+
+ persistMgr->transfer(TMEMBER_INT(_sFXType));
+ persistMgr->transfer(TMEMBER(_sFXParam1));
+ persistMgr->transfer(TMEMBER(_sFXParam2));
+ persistMgr->transfer(TMEMBER(_sFXParam3));
+ persistMgr->transfer(TMEMBER(_sFXParam4));
+
+
+ persistMgr->transfer(TMEMBER_INT(_blendMode));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::setCursor(const char *filename) {
+ if (!_sharedCursors) {
+ delete _cursor;
+ _cursor = NULL;
+ }
+
+ _sharedCursors = false;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile(filename))) {
+ delete _cursor;
+ _cursor = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::setActiveCursor(const char *filename) {
+ delete _activeCursor;
+ _activeCursor = new BaseSprite(_gameRef);
+ if (!_activeCursor || DID_FAIL(_activeCursor->loadFile(filename))) {
+ delete _activeCursor;
+ _activeCursor = NULL;
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseObject::getHeight() {
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::handleMouse(TMouseEvent event, TMouseButton button) {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::handleKeypress(Common::Event *event, bool printable) {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::handleMouseWheel(int delta) {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) {
+ // just play loaded sound
+ if (filename == NULL && _sFX) {
+ if (_gameRef->_editorMode || _sFXStart) {
+ _sFX->setVolumePercent(_sFXVolume);
+ _sFX->setPositionTime(_sFXStart);
+ if (!_gameRef->_editorMode) {
+ _sFXStart = 0;
+ }
+ }
+ if (playNow) {
+ setSoundEvent(eventName);
+ if (loopStart) {
+ _sFX->setLoopStart(loopStart);
+ }
+ return _sFX->play(looping);
+ } else {
+ return STATUS_OK;
+ }
+ }
+
+ if (filename == NULL) {
+ return STATUS_FAILED;
+ }
+
+ // create new sound
+ delete _sFX;
+
+ _sFX = new BaseSound(_gameRef);
+ if (_sFX && DID_SUCCEED(_sFX->setSound(filename, Audio::Mixer::kSFXSoundType, true))) {
+ _sFX->setVolumePercent(_sFXVolume);
+ if (_sFXStart) {
+ _sFX->setPositionTime(_sFXStart);
+ _sFXStart = 0;
+ }
+ _sFX->applyFX(_sFXType, _sFXParam1, _sFXParam2, _sFXParam3, _sFXParam4);
+ if (playNow) {
+ setSoundEvent(eventName);
+ if (loopStart) {
+ _sFX->setLoopStart(loopStart);
+ }
+ return _sFX->play(looping);
+ } else {
+ return STATUS_OK;
+ }
+ } else {
+ delete _sFX;
+ _sFX = NULL;
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::stopSFX(bool deleteSound) {
+ if (_sFX) {
+ _sFX->stop();
+ if (deleteSound) {
+ delete _sFX;
+ _sFX = NULL;
+ }
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::pauseSFX() {
+ if (_sFX) {
+ return _sFX->pause();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::resumeSFX() {
+ if (_sFX) {
+ return _sFX->resume();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::setSFXTime(uint32 time) {
+ _sFXStart = time;
+ if (_sFX && _sFX->isPlaying()) {
+ return _sFX->setPositionTime(time);
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::setSFXVolume(int volume) {
+ _sFXVolume = volume;
+ if (_sFX) {
+ return _sFX->setVolumePercent(volume);
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::updateSounds() {
+ if (_soundEvent) {
+ if (_sFX && !_sFX->isPlaying()) {
+ applyEvent(_soundEvent);
+ setSoundEvent(NULL);
+ }
+ }
+
+ if (_sFX) {
+ updateOneSound(_sFX);
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::updateOneSound(BaseSound *sound) {
+ bool ret = STATUS_OK;
+
+ if (sound) {
+ if (_autoSoundPanning) {
+ ret = sound->setPan(_gameRef->_soundMgr->posToPan(_posX - _gameRef->_offsetX, _posY - _gameRef->_offsetY));
+ }
+
+ ret = sound->applyFX(_sFXType, _sFXParam1, _sFXParam2, _sFXParam3, _sFXParam4);
+ }
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::resetSoundPan() {
+ if (!_sFX) {
+ return STATUS_OK;
+ } else {
+ return _sFX->setPan(0.0f);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::getExtendedFlag(const char *flagName) {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::isReady() {
+ return _ready;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseObject::setSoundEvent(const char *eventName) {
+ delete[] _soundEvent;
+ _soundEvent = NULL;
+ if (eventName) {
+ _soundEvent = new char[strlen(eventName) + 1];
+ if (_soundEvent) {
+ strcpy(_soundEvent, eventName);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseObject::afterMove() {
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h
new file mode 100644
index 0000000000..d7d91a25f6
--- /dev/null
+++ b/engines/wintermute/base/base_object.h
@@ -0,0 +1,147 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_OBJECT_H
+#define WINTERMUTE_BASE_OBJECT_H
+
+
+#include "engines/wintermute/base/base_script_holder.h"
+#include "engines/wintermute/persistent.h"
+#include "common/events.h"
+
+namespace Wintermute {
+
+class BaseSprite;
+class BaseSound;
+class BaseSurface;
+class BaseScriptHolder;
+class ScValue;
+class ScStack;
+class ScScript;
+class BaseObject : public BaseScriptHolder {
+protected:
+ bool _autoSoundPanning;
+ uint32 _sFXStart;
+ bool setSFXTime(uint32 time);
+ bool setSFXVolume(int volume);
+ bool resumeSFX();
+ bool pauseSFX();
+ bool stopSFX(bool deleteSound = true);
+ bool playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = NULL, uint32 loopStart = 0);
+ BaseSound *_sFX;
+ TSFXType _sFXType;
+ float _sFXParam1;
+ float _sFXParam2;
+ float _sFXParam3;
+ float _sFXParam4;
+ float _relativeRotate;
+ bool _rotateValid;
+ float _rotate;
+ void setSoundEvent(const char *eventName);
+ bool _rotatable;
+ float _scaleX;
+ float _scaleY;
+ float _relativeScale;
+ bool _editorSelected;
+ bool _editorAlwaysRegister;
+ bool _ready;
+ Rect32 _rect;
+ bool _rectSet;
+ int _iD;
+ char *_soundEvent;
+public:
+ TSpriteBlendMode _blendMode;
+ virtual bool afterMove();
+ float _scale;
+ uint32 _alphaColor;
+ virtual bool isReady();
+ virtual bool getExtendedFlag(const char *flagName);
+ virtual bool resetSoundPan();
+ virtual bool updateSounds();
+ bool updateOneSound(BaseSound *sound);
+ int _sFXVolume;
+
+ virtual bool handleMouseWheel(int delta);
+ virtual bool handleMouse(TMouseEvent event, TMouseButton button);
+ virtual bool handleKeypress(Common::Event *event, bool printable = false);
+ virtual int getHeight();
+ bool setCursor(const char *filename);
+ bool setActiveCursor(const char *filename);
+ bool cleanup();
+ const char *getCaption(int caseVal = 1);
+ void setCaption(const char *caption, int caseVal = 1);
+
+ bool _editorOnly;
+ bool _is3D;
+
+ DECLARE_PERSISTENT(BaseObject, BaseScriptHolder)
+ virtual bool showCursor();
+ BaseSprite *_cursor;
+ bool _sharedCursors;
+ BaseSprite *_activeCursor;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ virtual bool listen(BaseScriptHolder *param1, uint32 param2);
+
+ bool _movable;
+ bool _zoomable;
+ bool _shadowable;
+ int _posY;
+ int _posX;
+ bool _registrable;
+ char *_caption[7];
+ bool _saveState;
+
+ BaseObject(BaseGame *inGame);
+ virtual ~BaseObject();
+ // base
+ virtual bool update() {
+ return STATUS_FAILED;
+ };
+ virtual bool display() {
+ return STATUS_FAILED;
+ };
+ virtual bool invalidateDeviceObjects() {
+ return STATUS_OK;
+ };
+ virtual bool restoreDeviceObjects() {
+ return STATUS_OK;
+ };
+ bool _nonIntMouseEvents;
+
+
+public:
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp
new file mode 100644
index 0000000000..9a0e9e3ad9
--- /dev/null
+++ b/engines/wintermute/base/base_parser.cpp
@@ -0,0 +1,467 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+#include "common/util.h"
+
+#define WHITESPACE " \t\n\r"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////
+BaseParser::BaseParser() {
+ _whiteSpace = new char [strlen(WHITESPACE) + 1];
+ strcpy(_whiteSpace, WHITESPACE);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseParser::~BaseParser() {
+ if (_whiteSpace != NULL) {
+ delete[] _whiteSpace;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+char *BaseParser::getLastOffender() {
+ return _lastOffender;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int32 BaseParser::getObject(char **buf, const TokenDesc *tokens, char **name, char **data) {
+ skipCharacters(buf, _whiteSpace);
+
+ // skip comment lines.
+ while (**buf == ';') {
+ *buf = strchr(*buf, '\n');
+ _parserLine++;
+ skipCharacters(buf, _whiteSpace);
+ }
+
+ if (! **buf) { // at end of file
+ return PARSERR_EOF;
+ }
+
+ // find the token.
+ // TODO: for now just use brute force. Improve later.
+ while (tokens->id != 0) {
+ if (!scumm_strnicmp(tokens->token, *buf, strlen(tokens->token))) {
+ // here we could be matching PART of a string
+ // we could detect this here or the token list
+ // could just have the longer tokens first in the list
+ break;
+ }
+ ++tokens;
+ }
+ if (tokens->id == 0) {
+ char *p = strchr(*buf, '\n');
+ if (p && p > *buf) {
+ strncpy(_lastOffender, *buf, MIN((uint32)255, (uint32)(p - *buf))); // TODO, clean
+ } else {
+ strcpy(_lastOffender, "");
+ }
+
+ return PARSERR_TOKENNOTFOUND;
+ }
+ // skip the token
+ *buf += strlen(tokens->token);
+ skipCharacters(buf, _whiteSpace);
+
+ // get optional name
+ *name = getSubText(buf, '\'', '\''); // single quotes
+ skipCharacters(buf, _whiteSpace);
+
+ // get optional data
+ if (**buf == '=') { // An assignment rather than a command/object.
+ *data = getAssignmentText(buf);
+ } else {
+ *data = getSubText(buf, '{', '}');
+ }
+
+ return tokens->id;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int32 BaseParser::getCommand(char **buf, const TokenDesc *tokens, char **params) {
+ if (!*buf) {
+ return PARSERR_TOKENNOTFOUND;
+ }
+ BaseEngine::instance().getGameRef()->miniUpdate();
+ char *name;
+ return getObject(buf, tokens, &name, params);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseParser::skipCharacters(char **buf, const char *toSkip) {
+ char ch;
+ while ((ch = **buf) != 0) {
+ if (ch == '\n') {
+ _parserLine++;
+ }
+ if (strchr(toSkip, ch) == NULL) {
+ return;
+ }
+ ++*buf; // skip this character
+ }
+ // we must be at the end of the buffer if we get here
+}
+
+
+//////////////////////////////////////////////////////////////////////
+char *BaseParser::getSubText(char **buf, char open, char close) {
+ if (**buf == 0 || **buf != open) {
+ return 0;
+ }
+ ++*buf; // skip opening delimiter
+ char *result = *buf;
+
+ // now find the closing delimiter
+ char theChar;
+ long skip = 1;
+
+ if (open == close) { // we cant nest identical delimiters
+ open = 0;
+ }
+ while ((theChar = **buf) != 0) {
+ if (theChar == open) {
+ ++skip;
+ }
+ if (theChar == close) {
+ if (--skip == 0) {
+ **buf = 0; // null terminate the result string
+ ++*buf; // move past the closing delimiter
+ break;
+ }
+ }
+ ++*buf; // try next character
+ }
+ return result;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+char *BaseParser::getAssignmentText(char **buf) {
+ ++*buf; // skip the '='
+ skipCharacters(buf, _whiteSpace);
+ char *result = *buf;
+
+
+ if (*result == '"') {
+ result = getSubText(buf, '"', '"');
+ } else {
+ // now, we need to find the next whitespace to end the data
+ char theChar;
+
+ while ((theChar = **buf) != 0) {
+ if (theChar <= 0x20) { // space and control chars
+ break;
+ }
+ ++*buf;
+ }
+ **buf = 0; // null terminate it
+ if (theChar) { // skip the terminator
+ ++*buf;
+ }
+ }
+
+ return result;
+}
+
+//////////////////////////////////////////////////////////////////////
+Common::String BaseParser::getToken(char **buf) {
+ char token[100]; // TODO: Remove static
+ char *b = *buf, *t = token;
+ while (true) {
+ while (*b && (*b == ' ' || *b == '\n' || *b == 13 || *b == 10 || *b == '\t')) {
+ b++;
+ }
+ if (*b == ';')
+ while (*b && *b != '\n' && *b != 13 && *b != 10) {
+ b++;
+ }
+ else {
+ break;
+ }
+ }
+
+ if (*b == '\'') {
+ b++;
+ while (*b && *b != '\'') {
+ *t++ = *b++;
+ }
+ *t++ = 0;
+ if (*b == '\'') {
+ b++;
+ }
+ } else if (*b == '(' || *b == ')' || *b == '=' || *b == ',' || *b == '[' || *b == ']' ||
+ *b == '%' || *b == ':' || *b == '{' || *b == '}') {
+ *t++ = *b++;
+ *t++ = 0;
+ } else if (*b == '.' && (*(b + 1) < '0' || *(b + 1) > '9')) {
+ *t++ = *b++;
+ *t++ = 0;
+ } else if ((*b >= '0' && *b <= '9') || *b == '.' || *b == '-') {
+ while (*b && ((*b >= '0' && *b <= '9') || *b == '.' || *b == '-')) {
+ *t++ = *b++;
+ }
+ *t++ = 0;
+ } else if ((*b >= 'A' && *b <= 'Z') || (*b >= 'a' && *b <= 'z') || *b == '_') {
+ while (*b && ((*b >= 'A' && *b <= 'Z') || (*b >= 'a' && *b <= 'z') || *b == '_')) {
+ *t++ = *b++;
+ }
+ *t++ = 0;
+ } else if (*b == 0) {
+ *buf = b;
+ return NULL;
+ } else {
+ // Error.
+ return NULL;
+ }
+
+ *buf = b;
+ return token;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+float BaseParser::getTokenFloat(char **buf) {
+ Common::String token = getToken(buf);
+ const char *t = token.c_str();
+ if (!((*t >= '0' && *t <= '9') || *t == '-' || *t == '.')) {
+ // Error situation. We handle this by return 0.
+ return 0.;
+ }
+ float rc = (float)atof(t);
+ return rc;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseParser::getTokenInt(char **buf) {
+ Common::String token = getToken(buf);
+ const char *t = token.c_str();
+ if (!((*t >= '0' && *t <= '9') || *t == '-')) {
+ // Error situation. We handle this by return 0.
+ return 0;
+ }
+ int rc = atoi(t);
+ return rc;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseParser::skipToken(char **buf, char *tok, char * /*msg*/) {
+ Common::String token = getToken(buf);
+ const char *t = token.c_str();
+ if (strcmp(t, tok)) {
+ return; // Error
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseParser::scanStr(const char *in, const char *format, ...) {
+ va_list arg;
+ va_start(arg, format);
+
+ int num = 0;
+ in += strspn(in, " \t\n\f");
+
+ while (*format && *in) {
+ if (*format == '%') {
+ format++;
+ switch (*format) {
+ case 'd': {
+ int *a = va_arg(arg, int *);
+ in += strspn(in, " \t\n\f");
+ *a = atoi(in);
+ in += strspn(in, "0123456789+- \t\n\f");
+ num++;
+ break;
+ }
+ case 'D': {
+ int i;
+ int *list = va_arg(arg, int *);
+ int *nr = va_arg(arg, int *);
+ in += strspn(in, " \t\n\f");
+ i = 0;
+ while ((*in >= '0' && *in <= '9') || *in == '+' || *in == '-') {
+ list[i++] = atoi(in);
+ in += strspn(in, "0123456789+-");
+ in += strspn(in, " \t\n\f");
+ if (*in != ',') {
+ break;
+ }
+ in++;
+ in += strspn(in, " \t\n\f");
+ }
+ *nr = i;
+ num++;
+ break;
+ }
+ case 'b': {
+ bool *a = va_arg(arg, bool *);
+ in += strspn(in, " \t\n\f");
+ const char *in2 = in + strspn(in, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ int l = (int)(in2 - in);
+
+ *a = (bool)(!scumm_strnicmp(in, "yes", l) || !scumm_strnicmp(in, "true", l) || !scumm_strnicmp(in, "on", l) ||
+ !scumm_strnicmp(in, "1", l));
+
+
+ in = in2 + strspn(in2, " \t\n\f");
+ num++;
+ break;
+ }
+ case 'f': {
+ float *a = va_arg(arg, float *);
+ in += strspn(in, " \t\n\f");
+ *a = (float)atof(in);
+ in += strspn(in, "0123456789.eE+- \t\n\f");
+ num++;
+ break;
+ }
+ case 'F': {
+ int i;
+ float *list = va_arg(arg, float *);
+ int *nr = va_arg(arg, int *);
+ in += strspn(in, " \t\n\f");
+ i = 0;
+ while ((*in >= '0' && *in <= '9') || *in == '.' || *in == '+' || *in == '-' || *in == 'e' || *in == 'E') {
+ list[i++] = (float)atof(in);
+ in += strspn(in, "0123456789.eE+-");
+ in += strspn(in, " \t\n\f");
+ if (*in != ',') {
+ break;
+ }
+ in++;
+ in += strspn(in, " \t\n\f");
+ }
+ *nr = i;
+ num++;
+ break;
+ }
+ case 's': {
+ char *a = va_arg(arg, char *);
+ in += strspn(in, " \t\n\f");
+ if (*in == '\'') {
+ in++;
+ const char *in2 = strchr(in, '\'');
+ if (in2) {
+ Common::strlcpy(a, in, (int)(in2 - in) + 1);
+ in = in2 + 1;
+ } else {
+ strcpy(a, in);
+ in = strchr(in, 0);
+ }
+ } else {
+ const char *in2 = in + strspn(in, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.");
+ Common::strlcpy(a, in, (int)(in2 - in) + 1);
+ in = in2;
+ }
+ in += strspn(in, " \t\n\f");
+ num++;
+ break;
+ }
+ case 'S': {
+ char *a = va_arg(arg, char *);
+ in += strspn(in, " \t\n\f");
+ if (*in == '\"') {
+ in++;
+ while (*in != '\"') {
+ if (*in == '\\') {
+ in++;
+ switch (*in) {
+ case '\\':
+ *a++ = '\\';
+ break;
+ case 'n':
+ *a++ = '\n';
+ break;
+ case 'r':
+ *a++ = '\r';
+ break;
+ case 't':
+ *a++ = '\t';
+ break;
+ case '"':
+ *a++ = '"';
+ break;
+ default:
+ *a++ = '\\';
+ *a++ = *in;
+ break;
+ } //switch
+ in++;
+ } else {
+ *a++ = *in++;
+ }
+ } //while in string
+ in++;
+ num++;
+ } //if string started
+
+ //terminate string
+ *a = '\0';
+ break;
+ }
+ }
+ if (*format) {
+ format++;
+ }
+ } else if (*format == ' ') {
+ format++;
+ in += strspn(in, " \t\n\f");
+ } else if (*in == *format) {
+ in++;
+ format++;
+ } else {
+ num = -1;
+ break;
+ }
+ }
+
+ va_end(arg);
+
+ return num;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h
new file mode 100644
index 0000000000..76ca8ea856
--- /dev/null
+++ b/engines/wintermute/base/base_parser.h
@@ -0,0 +1,88 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_PARSER_H
+#define WINTERMUTE_BASE_PARSER_H
+
+
+#define TOKEN_DEF_START \
+ enum \
+ { \
+ TOKEN_NONE = 0,
+#define TOKEN_DEF(name) \
+ TOKEN_ ## name,
+#define TOKEN_DEF_END \
+ TOKEN_TOTAL_COUNT \
+ };
+#define TOKEN_TABLE_START(name) \
+ static const BaseParser::TokenDesc name [] = \
+ {
+#define TOKEN_TABLE(name) \
+ { TOKEN_ ## name, #name },
+#define TOKEN_TABLE_END \
+ { 0, 0 } \
+ };
+
+#define PARSERR_GENERIC -3
+#define PARSERR_EOF -2
+#define PARSERR_TOKENNOTFOUND -1
+
+#include "engines/wintermute/coll_templ.h"
+
+namespace Wintermute {
+
+class BaseParser {
+public:
+ struct TokenDesc {
+ int32 id;
+ const char *token;
+ };
+
+public:
+ int scanStr(const char *in, const char *format, ...);
+ int32 getCommand(char **buf, const TokenDesc *tokens, char **params);
+ BaseParser();
+ virtual ~BaseParser();
+private:
+ char *getLastOffender();
+ void skipToken(char **buf, char *tok, char *msg = NULL);
+ int getTokenInt(char **buf);
+ float getTokenFloat(char **buf);
+ Common::String getToken(char **buf);
+ char *getAssignmentText(char **buf);
+ char *getSubText(char **buf, char open, char close);
+ void skipCharacters(char **buf, const char *toSkip);
+ int32 getObject(char **buf, const TokenDesc *tokens, char **name, char **data);
+ int _parserLine;
+ char _lastOffender[255];
+ char *_whiteSpace;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp
new file mode 100644
index 0000000000..4cb67b87e1
--- /dev/null
+++ b/engines/wintermute/base/base_persistence_manager.cpp
@@ -0,0 +1,828 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/dcgf.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+#include "engines/wintermute/base/base_save_thumb_helper.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/math/vector2.h"
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/wintermute.h"
+#include "graphics/decoders/bmp.h"
+#include "common/memstream.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/savefile.h"
+
+namespace Wintermute {
+
+#define SAVE_BUFFER_INIT_SIZE 100000
+#define SAVE_BUFFER_GROW_BY 50000
+
+#define SAVE_MAGIC 0x45564153
+#define SAVE_MAGIC_2 0x32564153
+
+//////////////////////////////////////////////////////////////////////////
+BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool deleteSingleton) {
+ _saving = false;
+// _buffer = NULL;
+// _bufferSize = 0;
+ _offset = 0;
+ _saveStream = NULL;
+ _loadStream = NULL;
+ _deleteSingleton = deleteSingleton;
+ if (BaseEngine::instance().getGameRef()) {
+ _gameRef = BaseEngine::instance().getGameRef();
+ } else {
+ _gameRef = NULL;
+ }
+
+ _richBuffer = NULL;
+ _richBufferSize = 0;
+
+ _savedDescription = NULL;
+// _savedTimestamp = 0;
+ _savedVerMajor = _savedVerMinor = _savedVerBuild = 0;
+ _savedExtMajor = _savedExtMinor = 0;
+
+ _thumbnailDataSize = 0;
+ _thumbnailData = NULL;
+ if (savePrefix) {
+ _savePrefix = savePrefix;
+ } else if (_gameRef) {
+ _savePrefix = _gameRef->getGameId();
+ } else {
+ _savePrefix = "wmesav";
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BasePersistenceManager::~BasePersistenceManager() {
+ cleanup();
+ if (_deleteSingleton && BaseEngine::instance().getGameRef() == NULL)
+ BaseEngine::destroy();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BasePersistenceManager::cleanup() {
+ /* if (_buffer) {
+ if (_saving) free(_buffer);
+ else delete[] _buffer; // allocated by file manager
+ }
+ _buffer = NULL;
+
+ _bufferSize = 0;*/
+ _offset = 0;
+
+ delete[] _richBuffer;
+ _richBuffer = NULL;
+ _richBufferSize = 0;
+
+ delete[] _savedDescription;
+ _savedDescription = NULL; // ref to buffer
+// _savedTimestamp = 0;
+ _savedVerMajor = _savedVerMinor = _savedVerBuild = 0;
+ _savedExtMajor = _savedExtMinor = 0;
+
+ _thumbnailDataSize = 0;
+ if (_thumbnailData) {
+ delete[] _thumbnailData;
+ _thumbnailData = NULL;
+ }
+
+ delete _loadStream;
+ delete _saveStream;
+ _loadStream = NULL;
+ _saveStream = NULL;
+}
+
+Common::String BasePersistenceManager::getFilenameForSlot(int slot) const {
+ // 3 Digits, to allow for one save-slot for autosave + slot 1 - 100 (which will be numbered 0-99 filename-wise)
+ return Common::String::format("%s-save%03d.wsv", _savePrefix.c_str(), slot);
+}
+
+void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &desc) {
+ Common::String filename = getFilenameForSlot(slot);
+ debugC(kWintermuteDebugSaveGame, "Trying to list savegame %s in slot %d", filename.c_str(), slot);
+ if (DID_FAIL(readHeader(filename))) {
+ warning("getSavedDesc(%d) - Failed for %s", slot, filename.c_str());
+ return;
+ }
+ desc.setSaveSlot(slot);
+ desc.setDescription(_savedDescription);
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+
+ if (_thumbnailDataSize > 0) {
+ Common::MemoryReadStream thumbStream(_thumbnailData, _thumbnailDataSize);
+ Graphics::BitmapDecoder bmpDecoder;
+ if (bmpDecoder.loadStream(thumbStream)) {
+ Graphics::Surface *surf = new Graphics::Surface;
+ surf = bmpDecoder.getSurface()->convertTo(g_system->getOverlayFormat());
+ desc.setThumbnail(surf);
+ }
+ }
+
+ desc.setSaveDate(_savedTimestamp.tm_year, _savedTimestamp.tm_mon, _savedTimestamp.tm_mday);
+ desc.setSaveTime(_savedTimestamp.tm_hour, _savedTimestamp.tm_min);
+ desc.setPlayTime(0);
+}
+
+void BasePersistenceManager::deleteSaveSlot(int slot) {
+ Common::String filename = getFilenameForSlot(slot);
+ g_system->getSavefileManager()->removeSavefile(filename);
+}
+
+uint32 BasePersistenceManager::getMaxUsedSlot() {
+ Common::String saveMask = Common::String::format("%s-save???.wsv", _savePrefix.c_str());
+ Common::StringArray saves = g_system->getSavefileManager()->listSavefiles(saveMask);
+ Common::StringArray::iterator it = saves.begin();
+ int ret = -1;
+ for (; it != saves.end(); ++it) {
+ int num = -1;
+ sscanf(it->c_str(), "save%d", &num);
+ ret = MAX(ret, num);
+ }
+ return ret;
+}
+
+bool BasePersistenceManager::getSaveExists(int slot) {
+ Common::String filename = getFilenameForSlot(slot);
+ if (DID_FAIL(readHeader(filename))) {
+ return false;
+ }
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::initSave(const char *desc) {
+ if (!desc) {
+ return STATUS_FAILED;
+ }
+
+ cleanup();
+ _saving = true;
+
+ _saveStream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
+
+ if (_saveStream) {
+ // get thumbnails
+ if (!_gameRef->_cachedThumbnail) {
+ _gameRef->_cachedThumbnail = new BaseSaveThumbHelper(_gameRef);
+ if (DID_FAIL(_gameRef->_cachedThumbnail->storeThumbnail(true))) {
+ delete _gameRef->_cachedThumbnail;
+ _gameRef->_cachedThumbnail = NULL;
+ }
+ }
+
+ uint32 magic = DCGF_MAGIC;
+ putDWORD(magic);
+
+ magic = SAVE_MAGIC_2;
+ putDWORD(magic);
+
+ byte verMajor, verMinor, extMajor, extMinor;
+ _gameRef->getVersion(&verMajor, &verMinor, &extMajor, &extMinor);
+ //uint32 version = MAKELONG(MAKEWORD(VerMajor, VerMinor), MAKEWORD(ExtMajor, ExtMinor));
+ _saveStream->writeByte(verMajor);
+ _saveStream->writeByte(verMinor);
+ _saveStream->writeByte(extMajor);
+ _saveStream->writeByte(extMinor);
+
+ // new in ver 2
+ putDWORD((uint32)DCGF_VER_BUILD);
+ putString(_gameRef->getName());
+
+ // thumbnail data size
+ bool thumbnailOK = false;
+
+ if (_gameRef->_cachedThumbnail) {
+ if (_gameRef->_cachedThumbnail->_thumbnail) {
+ Common::MemoryWriteStreamDynamic thumbStream(DisposeAfterUse::YES);
+ if (_gameRef->_cachedThumbnail->_thumbnail->writeBMPToStream(&thumbStream)) {
+ _saveStream->writeUint32LE(thumbStream.size());
+ _saveStream->write(thumbStream.getData(), thumbStream.size());
+ } else {
+ _saveStream->writeUint32LE(0);
+ }
+
+ thumbnailOK = true;
+ }
+ }
+ if (!thumbnailOK) {
+ putDWORD(0);
+ }
+
+ // in any case, destroy the cached thumbnail once used
+ delete _gameRef->_cachedThumbnail;
+ _gameRef->_cachedThumbnail = NULL;
+
+ uint32 dataOffset = _offset +
+ sizeof(uint32) + // data offset
+ sizeof(uint32) + strlen(desc) + 1 + // description
+ sizeof(uint32); // timestamp
+
+ putDWORD(dataOffset);
+ putString(desc);
+
+ g_system->getTimeAndDate(_savedTimestamp);
+ putTimeDate(_savedTimestamp);
+ _savedPlayTime = g_system->getMillis();
+ _saveStream->writeUint32LE(_savedPlayTime);
+ }
+ return STATUS_OK;
+}
+
+bool BasePersistenceManager::readHeader(const Common::String &filename) {
+ cleanup();
+
+ _saving = false;
+
+ _loadStream = g_system->getSavefileManager()->openForLoading(filename);
+ //_buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename, &_bufferSize);
+ if (_loadStream) {
+ uint32 magic;
+ magic = getDWORD();
+
+ if (magic != DCGF_MAGIC) {
+ cleanup();
+ return STATUS_FAILED;
+ }
+
+ magic = getDWORD();
+
+ if (magic == SAVE_MAGIC || magic == SAVE_MAGIC_2) {
+ _savedVerMajor = _loadStream->readByte();
+ _savedVerMinor = _loadStream->readByte();
+ _savedExtMajor = _loadStream->readByte();
+ _savedExtMinor = _loadStream->readByte();
+
+ if (magic == SAVE_MAGIC_2) {
+ _savedVerBuild = (byte)getDWORD();
+ _savedName = getStringObj();
+
+ // load thumbnail
+ _thumbnailDataSize = getDWORD();
+ if (_thumbnailDataSize > 0) {
+ _thumbnailData = new byte[_thumbnailDataSize];
+ if (_thumbnailData) {
+ getBytes(_thumbnailData, _thumbnailDataSize);
+ } else {
+ _thumbnailDataSize = 0;
+ }
+ }
+ } else {
+ _savedVerBuild = 35; // last build with ver1 savegames
+ }
+
+ uint32 dataOffset = getDWORD();
+
+ _savedDescription = getString();
+ _savedTimestamp = getTimeDate();
+ _savedPlayTime = _loadStream->readUint32LE();
+
+ _offset = dataOffset;
+
+ return STATUS_OK;
+ }
+ }
+
+ cleanup();
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::initLoad(const Common::String &filename) {
+ if (DID_FAIL(readHeader(filename))) {
+ cleanup();
+ return STATUS_FAILED;
+ }
+ _saving = false;
+
+ if (_savedName == "" || scumm_stricmp(_savedName.c_str(), _gameRef->getName()) != 0) {
+ debugC(kWintermuteDebugSaveGame, "ERROR: Saved game name doesn't match current game");
+ cleanup();
+ return STATUS_FAILED;
+ }
+
+ // if save is newer version than we are, fail
+ if (_savedVerMajor > DCGF_VER_MAJOR ||
+ (_savedVerMajor == DCGF_VER_MAJOR && _savedVerMinor > DCGF_VER_MINOR) ||
+ (_savedVerMajor == DCGF_VER_MAJOR && _savedVerMinor == DCGF_VER_MINOR && _savedVerBuild > DCGF_VER_BUILD)
+ ) {
+
+ debugC(kWintermuteDebugSaveGame, "ERROR: Saved game version is newer than current game");
+ debugC(kWintermuteDebugSaveGame, "ERROR: Expected %d.%d.%d got %d.%d.%d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, _savedVerMajor, _savedVerMinor, _savedVerBuild);
+ cleanup();
+ return STATUS_FAILED;
+ }
+
+ // if save is older than the minimal version we support
+ if (_savedVerMajor < SAVEGAME_VER_MAJOR ||
+ (_savedVerMajor == SAVEGAME_VER_MAJOR && _savedVerMinor < SAVEGAME_VER_MINOR) ||
+ (_savedVerMajor == SAVEGAME_VER_MAJOR && _savedVerMinor == SAVEGAME_VER_MINOR && _savedVerBuild < SAVEGAME_VER_BUILD)
+ ) {
+ debugC(kWintermuteDebugSaveGame, "ERROR: Saved game is too old and cannot be used by this version of game engine");
+ debugC(kWintermuteDebugSaveGame, "ERROR: Expected %d.%d.%d got %d.%d.%d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, _savedVerMajor, _savedVerMinor, _savedVerBuild);
+ cleanup();
+ return STATUS_FAILED;
+
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::saveFile(const Common::String &filename) {
+ byte *prefixBuffer = _richBuffer;
+ uint32 prefixSize = _richBufferSize;
+ byte *buffer = ((Common::MemoryWriteStreamDynamic *)_saveStream)->getData();
+ uint32 bufferSize = ((Common::MemoryWriteStreamDynamic *)_saveStream)->size();
+
+ Common::SaveFileManager *saveMan = ((WintermuteEngine *)g_engine)->getSaveFileMan();
+ Common::OutSaveFile *file = saveMan->openForSaving(filename);
+ file->write(prefixBuffer, prefixSize);
+ file->write(buffer, bufferSize);
+ bool retVal = !file->err();
+ file->finalize();
+ delete file;
+ return retVal;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::putBytes(byte *buffer, uint32 size) {
+ _saveStream->write(buffer, size);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::getBytes(byte *buffer, uint32 size) {
+ _loadStream->read(buffer, size);
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BasePersistenceManager::putDWORD(uint32 val) {
+ _saveStream->writeUint32LE(val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BasePersistenceManager::getDWORD() {
+ uint32 ret = _loadStream->readUint32LE();
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BasePersistenceManager::putString(const Common::String &val) {
+ if (!val.size()) {
+ putString("(null)");
+ } else {
+ _saveStream->writeUint32LE(val.size());
+ _saveStream->writeString(val);
+ }
+}
+
+Common::String BasePersistenceManager::getStringObj() {
+ uint32 len = _loadStream->readUint32LE();
+ char *ret = new char[len + 1];
+ _loadStream->read(ret, len);
+ ret[len] = '\0';
+
+ Common::String retString = ret;
+ delete[] ret;
+
+ if (retString == "(null)") {
+ retString = "";
+ }
+
+ return retString;
+}
+
+//////////////////////////////////////////////////////////////////////////
+char *BasePersistenceManager::getString() {
+ uint32 len = _loadStream->readUint32LE();
+ char *ret = new char[len + 1];
+ _loadStream->read(ret, len);
+ ret[len] = '\0';
+
+ if (!strcmp(ret, "(null)")) {
+ delete[] ret;
+ return NULL;
+ } else {
+ return ret;
+ }
+}
+
+bool BasePersistenceManager::putTimeDate(const TimeDate &t) {
+ _saveStream->writeSint32LE(t.tm_sec);
+ _saveStream->writeSint32LE(t.tm_min);
+ _saveStream->writeSint32LE(t.tm_hour);
+ _saveStream->writeSint32LE(t.tm_mday);
+ _saveStream->writeSint32LE(t.tm_mon);
+ _saveStream->writeSint32LE(t.tm_year);
+ // _saveStream->writeSint32LE(t.tm_wday); //TODO: Add this in when merging next
+
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+}
+
+TimeDate BasePersistenceManager::getTimeDate() {
+ TimeDate t;
+ t.tm_sec = _loadStream->readSint32LE();
+ t.tm_min = _loadStream->readSint32LE();
+ t.tm_hour = _loadStream->readSint32LE();
+ t.tm_mday = _loadStream->readSint32LE();
+ t.tm_mon = _loadStream->readSint32LE();
+ t.tm_year = _loadStream->readSint32LE();
+ // t.tm_wday = _loadStream->readSint32LE(); //TODO: Add this in when merging next
+ return t;
+}
+
+void BasePersistenceManager::putFloat(float val) {
+ Common::String str = Common::String::format("F%f", val);
+ _saveStream->writeUint32LE(str.size());
+ _saveStream->writeString(str);
+}
+
+float BasePersistenceManager::getFloat() {
+ char *str = getString();
+ float value = 0.0f;
+ int ret = sscanf(str, "F%f", &value);
+ if (ret != 1) {
+ warning("%s not parsed as float", str);
+ }
+ delete[] str;
+ return value;
+}
+
+void BasePersistenceManager::putDouble(double val) {
+ Common::String str = Common::String::format("D%f", val);
+ str.format("D%f", val);
+ _saveStream->writeUint32LE(str.size());
+ _saveStream->writeString(str);
+}
+
+double BasePersistenceManager::getDouble() {
+ char *str = getString();
+ float value = 0.0f; // TODO: Do we ever really need to carry a full double-precision number?
+ int ret = sscanf(str, "D%f", &value);
+ if (ret != 1) {
+ warning("%s not parsed as double", str);
+ }
+ delete[] str;
+ return value;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// bool
+bool BasePersistenceManager::transfer(const char *name, bool *val) {
+ if (_saving) {
+ _saveStream->writeByte(*val);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ *val = _loadStream->readByte();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// int
+bool BasePersistenceManager::transfer(const char *name, int *val) {
+ if (_saving) {
+ _saveStream->writeSint32LE(*val);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ *val = _loadStream->readSint32LE();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// DWORD
+bool BasePersistenceManager::transfer(const char *name, uint32 *val) {
+ if (_saving) {
+ _saveStream->writeUint32LE(*val);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ *val = _loadStream->readUint32LE();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// float
+bool BasePersistenceManager::transfer(const char *name, float *val) {
+ if (_saving) {
+ putFloat(*val);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ *val = getFloat();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// double
+bool BasePersistenceManager::transfer(const char *name, double *val) {
+ if (_saving) {
+ putDouble(*val);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ *val = getDouble();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// char*
+bool BasePersistenceManager::transfer(const char *name, char **val) {
+ if (_saving) {
+ putString(*val);
+ return STATUS_OK;
+ } else {
+ char *str = getString();
+ if (_loadStream->err()) {
+ delete[] str;
+ return STATUS_FAILED;
+ }
+ *val = str;
+ return STATUS_OK;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// const char*
+bool BasePersistenceManager::transfer(const char *name, const char **val) {
+ if (_saving) {
+ putString(*val);
+ return STATUS_OK;
+ } else {
+ char *str = getString();
+ if (_loadStream->err()) {
+ delete[] str;
+ return STATUS_FAILED;
+ }
+ *val = str;
+ return STATUS_OK;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Common::String
+bool BasePersistenceManager::transfer(const char *name, Common::String *val) {
+ if (_saving) {
+ putString(*val);
+ return STATUS_OK;
+ } else {
+ char *str = getString();
+ if (_loadStream->err()) {
+ delete[] str;
+ return STATUS_FAILED;
+ }
+ if (str) {
+ *val = str;
+ delete[] str;
+ } else {
+ *val = "";
+ }
+ return STATUS_OK;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::transfer(const char *name, AnsiStringArray &val) {
+ size_t size;
+
+ if (_saving) {
+ size = val.size();
+ _saveStream->writeUint32LE(size);
+
+ for (AnsiStringArray::iterator it = val.begin(); it != val.end(); ++it) {
+ putString((*it).c_str());
+ }
+ } else {
+ val.clear();
+ size = _loadStream->readUint32LE();
+
+ for (size_t i = 0; i < size; i++) {
+ char *str = getString();
+ if (_loadStream->err()) {
+ delete[] str;
+ return STATUS_FAILED;
+ }
+ if (str) {
+ val.push_back(str);
+ }
+ delete[] str;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// BYTE
+bool BasePersistenceManager::transfer(const char *name, byte *val) {
+ if (_saving) {
+ _saveStream->writeByte(*val);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ *val = _loadStream->readByte();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// RECT
+bool BasePersistenceManager::transfer(const char *name, Rect32 *val) {
+ if (_saving) {
+ _saveStream->writeSint32LE(val->left);
+ _saveStream->writeSint32LE(val->top);
+ _saveStream->writeSint32LE(val->right);
+ _saveStream->writeSint32LE(val->bottom);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ val->left = _loadStream->readSint32LE();
+ val->top = _loadStream->readSint32LE();
+ val->right = _loadStream->readSint32LE();
+ val->bottom = _loadStream->readSint32LE();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// POINT
+bool BasePersistenceManager::transfer(const char *name, Point32 *val) {
+ if (_saving) {
+ _saveStream->writeSint32LE(val->x);
+ _saveStream->writeSint32LE(val->y);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ val->x = _loadStream->readSint32LE();
+ val->y = _loadStream->readSint32LE();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Vector2
+bool BasePersistenceManager::transfer(const char *name, Vector2 *val) {
+ if (_saving) {
+ putFloat(val->x);
+ putFloat(val->y);
+ if (_saveStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ } else {
+ val->x = getFloat();
+ val->y = getFloat();
+ if (_loadStream->err()) {
+ return STATUS_FAILED;
+ }
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// generic pointer
+bool BasePersistenceManager::transfer(const char *name, void *val) {
+ int classID = -1, instanceID = -1;
+
+ if (_saving) {
+ SystemClassRegistry::getInstance()->getPointerID(*(void **)val, &classID, &instanceID);
+ if (*(void **)val != NULL && (classID == -1 || instanceID == -1)) {
+ debugC(kWintermuteDebugSaveGame, "Warning: invalid instance '%s'", name);
+ }
+
+ _saveStream->writeUint32LE(classID);
+ _saveStream->writeUint32LE(instanceID);
+ } else {
+ classID = _loadStream->readUint32LE();
+ instanceID = _loadStream->readUint32LE();
+
+ *(void **)val = SystemClassRegistry::getInstance()->idToPointer(classID, instanceID);
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePersistenceManager::checkVersion(byte verMajor, byte verMinor, byte verBuild) {
+ if (_saving) {
+ return true;
+ }
+
+ // it's ok if we are same or newer than the saved game
+ if (verMajor > _savedVerMajor ||
+ (verMajor == _savedVerMajor && verMinor > _savedVerMinor) ||
+ (verMajor == _savedVerMajor && verMinor == _savedVerMinor && verBuild > _savedVerBuild)
+ ) {
+ return false;
+ }
+
+ return true;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h
new file mode 100644
index 0000000000..a262c92a0b
--- /dev/null
+++ b/engines/wintermute/base/base_persistence_manager.h
@@ -0,0 +1,118 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_PERSISTENCE_MANAGER_H
+#define WINTERMUTE_BASE_PERSISTENCE_MANAGER_H
+
+
+#include "engines/wintermute/dctypes.h"
+#include "engines/wintermute/math/rect32.h"
+#include "engines/savestate.h"
+#include "common/stream.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/rect.h"
+
+namespace Wintermute {
+
+class Vector2;
+class BaseGame;
+class BasePersistenceManager {
+public:
+ char *_savedDescription;
+ Common::String _savePrefix;
+ Common::String _savedName;
+ bool saveFile(const Common::String &filename);
+ uint32 getDWORD();
+ void putDWORD(uint32 val);
+ char *getString();
+ Common::String getStringObj();
+ void putString(const Common::String &val);
+ float getFloat();
+ void putFloat(float val);
+ double getDouble();
+ void putDouble(double val);
+ void cleanup();
+ void getSaveStateDesc(int slot, SaveStateDescriptor &desc);
+ void deleteSaveSlot(int slot);
+ uint32 getMaxUsedSlot();
+ bool getSaveExists(int slot);
+ bool initLoad(const Common::String &filename);
+ bool initSave(const char *desc);
+ bool getBytes(byte *buffer, uint32 size);
+ bool putBytes(byte *buffer, uint32 size);
+ uint32 _offset;
+
+ bool getIsSaving() { return _saving; }
+
+ uint32 _richBufferSize;
+ byte *_richBuffer;
+
+ bool transfer(const char *name, void *val);
+ bool transfer(const char *name, int *val);
+ bool transfer(const char *name, uint32 *val);
+ bool transfer(const char *name, float *val);
+ bool transfer(const char *name, double *val);
+ bool transfer(const char *name, bool *val);
+ bool transfer(const char *name, byte *val);
+ bool transfer(const char *name, Rect32 *val);
+ bool transfer(const char *name, Point32 *val);
+ bool transfer(const char *name, const char **val);
+ bool transfer(const char *name, char **val);
+ bool transfer(const char *name, Common::String *val);
+ bool transfer(const char *name, Vector2 *val);
+ bool transfer(const char *name, AnsiStringArray &Val);
+ BasePersistenceManager(const char *savePrefix = NULL, bool deleteSingleton = false);
+ virtual ~BasePersistenceManager();
+ bool checkVersion(byte verMajor, byte verMinor, byte verBuild);
+
+ uint32 _thumbnailDataSize;
+ byte *_thumbnailData;
+ Common::String getFilenameForSlot(int slot) const;
+private:
+ bool _deleteSingleton;
+ bool readHeader(const Common::String &filename);
+ TimeDate getTimeDate();
+ bool putTimeDate(const TimeDate &t);
+ Common::WriteStream *_saveStream;
+ Common::SeekableReadStream *_loadStream;
+ TimeDate _savedTimestamp;
+ uint32 _savedPlayTime;
+ byte _savedVerMajor;
+ byte _savedVerMinor;
+ byte _savedVerBuild;
+ byte _savedExtMajor;
+ byte _savedExtMinor;
+ bool _saving;
+ // Separate from Base, as this class can do SOME operations without a _gameRef.
+ BaseGame *_gameRef;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_point.cpp b/engines/wintermute/base/base_point.cpp
new file mode 100644
index 0000000000..fbd8960894
--- /dev/null
+++ b/engines/wintermute/base/base_point.cpp
@@ -0,0 +1,63 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_point.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BasePoint, false)
+
+//////////////////////////////////////////////////////////////////////////
+BasePoint::BasePoint() {
+ x = y = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BasePoint::~BasePoint() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BasePoint::BasePoint(int initX, int initY) {
+ x = initX;
+ y = initY;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePoint::persist(BasePersistenceManager *persistMgr) {
+
+ persistMgr->transfer(TMEMBER(x));
+ persistMgr->transfer(TMEMBER(y));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_point.h b/engines/wintermute/base/base_point.h
new file mode 100644
index 0000000000..c0bbd3102e
--- /dev/null
+++ b/engines/wintermute/base/base_point.h
@@ -0,0 +1,50 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_POINT_H
+#define WINTERMUTE_BASE_POINT_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BasePoint: public BaseClass {
+public:
+ DECLARE_PERSISTENT(BasePoint, BaseClass)
+ BasePoint();
+ BasePoint(int initX, int initY);
+ int y;
+ int x;
+ virtual ~BasePoint();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp
new file mode 100644
index 0000000000..0a9907ac6b
--- /dev/null
+++ b/engines/wintermute/base/base_quick_msg.cpp
@@ -0,0 +1,57 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_quick_msg.h"
+#include "engines/wintermute/base/base_game.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseQuickMsg::BaseQuickMsg(BaseGame *inGame, const char *text) : BaseClass(inGame) {
+ _text = new char [strlen(text) + 1];
+ if (_text) {
+ strcpy(_text, text);
+ }
+ _startTime = _gameRef->_currentTime;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseQuickMsg::~BaseQuickMsg() {
+ if (_text) {
+ delete[] _text;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *BaseQuickMsg::getText() {
+ return _text;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h
new file mode 100644
index 0000000000..67f9613461
--- /dev/null
+++ b/engines/wintermute/base/base_quick_msg.h
@@ -0,0 +1,48 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_QUICKMSG_H
+#define WINTERMUTE_BASE_QUICKMSG_H
+
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BaseQuickMsg : public BaseClass {
+public:
+ char *getText();
+ uint32 _startTime;
+ BaseQuickMsg(BaseGame *inGame, const char *text);
+ virtual ~BaseQuickMsg();
+private:
+ char *_text;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp
new file mode 100644
index 0000000000..0bc5975e51
--- /dev/null
+++ b/engines/wintermute/base/base_region.cpp
@@ -0,0 +1,535 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+#include <limits.h>
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseRegion, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseRegion::BaseRegion(BaseGame *inGame) : BaseObject(inGame) {
+ _active = true;
+ _editorSelectedPoint = -1;
+ _lastMimicScale = -1;
+ _lastMimicX = _lastMimicY = INT_MIN;
+
+ BasePlatform::setRectEmpty(&_rect);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseRegion::~BaseRegion() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRegion::cleanup() {
+ for (uint32 i = 0; i < _points.size(); i++) {
+ delete _points[i];
+ }
+ _points.clear();
+
+ BasePlatform::setRectEmpty(&_rect);
+ _editorSelectedPoint = -1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::createRegion() {
+ return DID_SUCCEED(getBoundingRect(&_rect));
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::pointInRegion(int x, int y) {
+ if (_points.size() < 3) {
+ return false;
+ }
+
+ Point32 pt;
+ pt.x = x;
+ pt.y = y;
+
+ Rect32 rect;
+ rect.left = x - 1;
+ rect.right = x + 2;
+ rect.top = y - 1;
+ rect.bottom = y + 2;
+
+ if (BasePlatform::ptInRect(&_rect, pt)) {
+ return ptInPolygon(x, y);
+ } else {
+ return false;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "BaseRegion::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing REGION file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(REGION)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(NAME)
+TOKEN_DEF(ACTIVE)
+TOKEN_DEF(POINT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(EDITOR_SELECTED_POINT)
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(REGION)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(ACTIVE)
+ TOKEN_TABLE(POINT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(EDITOR_SELECTED_POINT)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_REGION) {
+ _gameRef->LOG(0, "'REGION' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ for (uint32 i = 0; i < _points.size(); i++) {
+ delete _points[i];
+ }
+ _points.clear();
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_ACTIVE:
+ parser.scanStr((char *)params, "%b", &_active);
+ break;
+
+ case TOKEN_POINT: {
+ int x, y;
+ parser.scanStr((char *)params, "%d,%d", &x, &y);
+ _points.add(new BasePoint(x, y));
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_EDITOR_SELECTED_POINT:
+ parser.scanStr((char *)params, "%d", &_editorSelectedPoint);
+ break;
+
+ case TOKEN_PROPERTY:
+ parseProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in REGION definition");
+ return STATUS_FAILED;
+ }
+
+ createRegion();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddPoint
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "AddPoint") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ _points.add(new BasePoint(x, y));
+ createRegion();
+
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InsertPoint
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InsertPoint") == 0) {
+ stack->correctParams(3);
+ int index = stack->pop()->getInt();
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ if (index >= 0 && index < (int32)_points.size()) {
+ _points.insert_at(index, new BasePoint(x, y));
+ createRegion();
+
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetPoint
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetPoint") == 0) {
+ stack->correctParams(3);
+ int index = stack->pop()->getInt();
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+
+ if (index >= 0 && index < (int32)_points.size()) {
+ _points[index]->x = x;
+ _points[index]->y = y;
+ createRegion();
+
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemovePoint
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemovePoint") == 0) {
+ stack->correctParams(1);
+ int index = stack->pop()->getInt();
+
+ if (index >= 0 && index < (int32)_points.size()) {
+ delete _points[index];
+ _points[index] = NULL;
+
+ _points.remove_at(index);
+ createRegion();
+
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetPoint
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetPoint") == 0) {
+ stack->correctParams(1);
+ int index = stack->pop()->getInt();
+
+ if (index >= 0 && index < (int32)_points.size()) {
+ ScValue *val = stack->getPushValue();
+ if (val) {
+ val->setProperty("X", _points[index]->x);
+ val->setProperty("Y", _points[index]->y);
+ }
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseRegion::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("region");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Name") {
+ _scValue->setString(getName());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Active") {
+ _scValue->setBool(_active);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumPoints
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumPoints") {
+ _scValue->setInt(_points.size());
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Active
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Active") == 0) {
+ _active = value->getBool();
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseRegion::scToString() {
+ return "[region]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride) {
+ if (!nameOverride) {
+ buffer->putTextIndent(indent, "REGION {\n");
+ } else {
+ buffer->putTextIndent(indent, "%s {\n", nameOverride);
+ }
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+ buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED_POINT=%d\n", _editorSelectedPoint);
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ for (uint32 i = 0; i < _points.size(); i++) {
+ buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y);
+ }
+
+ if (_scProp) {
+ _scProp->saveAsText(buffer, indent + 2);
+ }
+
+ buffer->putTextIndent(indent, "}\n\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transfer(TMEMBER(_editorSelectedPoint));
+ persistMgr->transfer(TMEMBER(_lastMimicScale));
+ persistMgr->transfer(TMEMBER(_lastMimicX));
+ persistMgr->transfer(TMEMBER(_lastMimicY));
+ _points.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+typedef struct {
+ double x, y;
+} dPoint;
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::ptInPolygon(int x, int y) {
+ if (_points.size() < 3) {
+ return false;
+ }
+
+ int counter = 0;
+ double xinters;
+ dPoint p, p1, p2;
+
+ p.x = (double)x;
+ p.y = (double)y;
+
+ p1.x = (double)_points[0]->x;
+ p1.y = (double)_points[0]->y;
+
+ for (uint32 i = 1; i <= _points.size(); i++) {
+ p2.x = (double)_points[i % _points.size()]->x;
+ p2.y = (double)_points[i % _points.size()]->y;
+
+ if (p.y > MIN(p1.y, p2.y)) {
+ if (p.y <= MAX(p1.y, p2.y)) {
+ if (p.x <= MAX(p1.x, p2.x)) {
+ if (p1.y != p2.y) {
+ xinters = (p.y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y) + p1.x;
+ if (p1.x == p2.x || p.x <= xinters) {
+ counter++;
+ }
+ }
+ }
+ }
+ }
+ p1 = p2;
+ }
+
+ if (counter % 2 == 0) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::getBoundingRect(Rect32 *rect) {
+ if (_points.size() == 0) {
+ BasePlatform::setRectEmpty(rect);
+ } else {
+ int minX = INT_MAX, minY = INT_MAX, maxX = INT_MIN, maxY = INT_MIN;
+
+ for (uint32 i = 0; i < _points.size(); i++) {
+ minX = MIN(minX, _points[i]->x);
+ minY = MIN(minY, _points[i]->y);
+
+ maxX = MAX(maxX, _points[i]->x);
+ maxY = MAX(maxY, _points[i]->y);
+ }
+ BasePlatform::setRect(rect, minX, minY, maxX, maxY);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRegion::mimic(BaseRegion *region, float scale, int x, int y) {
+ if (scale == _lastMimicScale && x == _lastMimicX && y == _lastMimicY) {
+ return STATUS_OK;
+ }
+
+ cleanup();
+
+ for (uint32 i = 0; i < region->_points.size(); i++) {
+ int xVal, yVal;
+
+ xVal = (int)((float)region->_points[i]->x * scale / 100.0f);
+ yVal = (int)((float)region->_points[i]->y * scale / 100.0f);
+
+ _points.add(new BasePoint(xVal + x, yVal + y));
+ }
+
+ _lastMimicScale = scale;
+ _lastMimicX = x;
+ _lastMimicY = y;
+
+ return createRegion() ? STATUS_OK : STATUS_FAILED;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h
new file mode 100644
index 0000000000..464f25be2f
--- /dev/null
+++ b/engines/wintermute/base/base_region.h
@@ -0,0 +1,70 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_REGION_H
+#define WINTERMUTE_BASE_REGION_H
+
+#include "engines/wintermute/base/base_point.h"
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class BaseRegion : public BaseObject {
+public:
+ void cleanup();
+ bool mimic(BaseRegion *region, float scale = 100.0f, int x = 0, int y = 0);
+ bool getBoundingRect(Rect32 *rect);
+ bool ptInPolygon(int x, int y);
+ DECLARE_PERSISTENT(BaseRegion, BaseObject)
+ bool _active;
+ int _editorSelectedPoint;
+ BaseRegion(BaseGame *inGame);
+ virtual ~BaseRegion();
+ bool pointInRegion(int x, int y);
+ bool createRegion();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ Rect32 _rect;
+ BaseArray<BasePoint *> _points;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) { return saveAsText(buffer, indent, NULL); }
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+private:
+ float _lastMimicScale;
+ int _lastMimicX;
+ int _lastMimicY;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_save_thumb_helper.cpp b/engines/wintermute/base/base_save_thumb_helper.cpp
new file mode 100644
index 0000000000..b4205c21c4
--- /dev/null
+++ b/engines/wintermute/base/base_save_thumb_helper.cpp
@@ -0,0 +1,81 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_save_thumb_helper.h"
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/base_game.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseSaveThumbHelper::BaseSaveThumbHelper(BaseGame *inGame) : BaseClass(inGame) {
+ _thumbnail = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSaveThumbHelper::~BaseSaveThumbHelper(void) {
+ delete _thumbnail;
+ _thumbnail = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSaveThumbHelper::storeThumbnail(bool doFlip) {
+ delete _thumbnail;
+ _thumbnail = NULL;
+
+ if (_gameRef->_thumbnailWidth > 0 && _gameRef->_thumbnailHeight > 0) {
+ if (doFlip) {
+ // when using opengl on windows it seems to be necessary to do this twice
+ // works normally for direct3d
+ _gameRef->displayContent(false);
+ _gameRef->_renderer->flip();
+
+ _gameRef->displayContent(false);
+ _gameRef->_renderer->flip();
+ }
+
+ BaseImage *screenshot = _gameRef->_renderer->takeScreenshot();
+ if (!screenshot) {
+ return STATUS_FAILED;
+ }
+
+ // normal thumbnail
+ if (_gameRef->_thumbnailWidth > 0 && _gameRef->_thumbnailHeight > 0) {
+ _thumbnail = new BaseImage();
+ _thumbnail->copyFrom(screenshot, _gameRef->_thumbnailWidth, _gameRef->_thumbnailHeight);
+ }
+
+
+ delete screenshot;
+ screenshot = NULL;
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_save_thumb_helper.h b/engines/wintermute/base/base_save_thumb_helper.h
new file mode 100644
index 0000000000..8863508ac9
--- /dev/null
+++ b/engines/wintermute/base/base_save_thumb_helper.h
@@ -0,0 +1,51 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+#ifndef WINTERMUTE_BASE_SAVE_THUMB_HELPER_H
+#define WINTERMUTE_BASE_SAVE_THUMB_HELPER_H
+
+
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BaseImage;
+
+class BaseSaveThumbHelper : public BaseClass {
+public:
+ BaseSaveThumbHelper(BaseGame *inGame);
+ virtual ~BaseSaveThumbHelper(void);
+ bool storeThumbnail(bool doFlip = false);
+
+ BaseImage *_thumbnail;
+private:
+ BaseImage *_richThumbnail;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp
new file mode 100644
index 0000000000..c5d5e82f76
--- /dev/null
+++ b/engines/wintermute/base/base_script_holder.cpp
@@ -0,0 +1,502 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/base/base_script_holder.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseScriptHolder, false)
+
+//////////////////////////////////////////////////////////////////////
+BaseScriptHolder::BaseScriptHolder(BaseGame *inGame) : BaseScriptable(inGame) {
+ setName("<unnamed>");
+
+ _freezable = true;
+ _filename = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseScriptHolder::~BaseScriptHolder() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::cleanup() {
+ delete[] _filename;
+ _filename = NULL;
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ _scripts[i]->finish(true);
+ _scripts[i]->_owner = NULL;
+ }
+ _scripts.clear();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+void BaseScriptHolder::setFilename(const char *filename) {
+ if (_filename != NULL) {
+ delete[] _filename;
+ _filename = NULL;
+ }
+ if (filename == NULL) {
+ return;
+ }
+ _filename = new char [strlen(filename) + 1];
+ if (_filename != NULL) {
+ strcpy(_filename, filename);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::applyEvent(const char *eventName, bool unbreakable) {
+ int numHandlers = 0;
+
+ bool ret = STATUS_FAILED;
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (!_scripts[i]->_thread) {
+ ScScript *handler = _scripts[i]->invokeEventHandler(eventName, unbreakable);
+ if (handler) {
+ //_scripts.add(handler);
+ numHandlers++;
+ ret = STATUS_OK;
+ }
+ }
+ }
+ if (numHandlers > 0 && unbreakable) {
+ _gameRef->_scEngine->tickUnbreakable();
+ }
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::listen(BaseScriptHolder *param1, uint32 param2) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // DEBUG_CrashMe
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "DEBUG_CrashMe") == 0) {
+ stack->correctParams(0);
+ byte *p = 0;
+ *p = 10;
+ stack->pushNULL();
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ApplyEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ApplyEvent") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ bool ret;
+ ret = applyEvent(val->getString());
+
+ if (DID_SUCCEED(ret)) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CanHandleEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CanHandleEvent") == 0) {
+ stack->correctParams(1);
+ stack->pushBool(canHandleEvent(stack->pop()->getString()));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CanHandleMethod
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CanHandleMethod") == 0) {
+ stack->correctParams(1);
+ stack->pushBool(canHandleMethod(stack->pop()->getString()));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AttachScript
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AttachScript") == 0) {
+ stack->correctParams(1);
+ stack->pushBool(DID_SUCCEED(addScript(stack->pop()->getString())));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DetachScript
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DetachScript") == 0) {
+ stack->correctParams(2);
+ const char *filename = stack->pop()->getString();
+ bool killThreads = stack->pop()->getBool(false);
+ bool ret = false;
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (scumm_stricmp(_scripts[i]->_filename, filename) == 0) {
+ _scripts[i]->finish(killThreads);
+ ret = true;
+ break;
+ }
+ }
+ stack->pushBool(ret);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IsScriptRunning
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IsScriptRunning") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+ bool ret = false;
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (scumm_stricmp(_scripts[i]->_filename, filename) == 0 && _scripts[i]->_state != SCRIPT_FINISHED && _scripts[i]->_state != SCRIPT_ERROR) {
+ ret = true;
+ break;
+ }
+ }
+ stack->pushBool(ret);
+
+ return STATUS_OK;
+ } else {
+ return BaseScriptable::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseScriptHolder::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("script_holder");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Name") {
+ _scValue->setString(getName());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Filename (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Filename") {
+ _scValue->setString(_filename);
+ return _scValue;
+ } else {
+ return BaseScriptable::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ } else {
+ return BaseScriptable::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseScriptHolder::scToString() {
+ return "[script_holder]";
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ return BaseClass::saveAsText(buffer, indent);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::persist(BasePersistenceManager *persistMgr) {
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_filename));
+ persistMgr->transfer(TMEMBER(_freezable));
+ if (persistMgr->getIsSaving()) {
+ const char *name = getName();
+ persistMgr->transfer(TMEMBER(name));
+ } else {
+ char *name;
+ persistMgr->transfer(TMEMBER(name));
+ setName(name);
+ delete[] name;
+ }
+ _scripts.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::addScript(const char *filename) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (scumm_stricmp(_scripts[i]->_filename, filename) == 0) {
+ if (_scripts[i]->_state != SCRIPT_FINISHED) {
+ _gameRef->LOG(0, "BaseScriptHolder::AddScript - trying to add script '%s' mutiple times (obj: '%s')", filename, getName());
+ return STATUS_OK;
+ }
+ }
+ }
+
+ ScScript *scr = _gameRef->_scEngine->runScript(filename, this);
+ if (!scr) {
+ if (_gameRef->_editorForceScripts) {
+ // editor hack
+ scr = new ScScript(_gameRef, _gameRef->_scEngine);
+ scr->_filename = new char[strlen(filename) + 1];
+ strcpy(scr->_filename, filename);
+ scr->_state = SCRIPT_ERROR;
+ scr->_owner = this;
+ _scripts.add(scr);
+ _gameRef->_scEngine->_scripts.add(scr);
+
+ return STATUS_OK;
+ }
+ return STATUS_FAILED;
+ } else {
+ scr->_freezable = _freezable;
+ _scripts.add(scr);
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::removeScript(ScScript *script) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i] == script) {
+ _scripts.remove_at(i);
+ break;
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::canHandleEvent(const char *EventName) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (!_scripts[i]->_thread && _scripts[i]->canHandleEvent(EventName)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::canHandleMethod(const char *MethodName) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (!_scripts[i]->_thread && _scripts[i]->canHandleMethod(MethodName)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(PROPERTY)
+TOKEN_DEF(NAME)
+TOKEN_DEF(VALUE)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(PROPERTY)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(VALUE)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_PROPERTY) {
+ _gameRef->LOG(0, "'PROPERTY' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ char *propName = NULL;
+ char *propValue = NULL;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_NAME:
+ delete[] propName;
+ propName = new char[strlen((char *)params) + 1];
+ if (propName) {
+ strcpy(propName, (char *)params);
+ } else {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_VALUE:
+ delete[] propValue;
+ propValue = new char[strlen((char *)params) + 1];
+ if (propValue) {
+ strcpy(propValue, (char *)params);
+ } else {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+ }
+
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ delete[] propName;
+ delete[] propValue;
+ propName = NULL;
+ propValue = NULL;
+ _gameRef->LOG(0, "Syntax error in PROPERTY definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC || propName == NULL || propValue == NULL) {
+ delete[] propName;
+ delete[] propValue;
+ propName = NULL;
+ propValue = NULL;
+ _gameRef->LOG(0, "Error loading PROPERTY definition");
+ return STATUS_FAILED;
+ }
+
+
+ ScValue *val = new ScValue(_gameRef);
+ val->setString(propValue);
+ scSetProperty(propName, val);
+
+ delete val;
+ delete[] propName;
+ delete[] propValue;
+ propName = NULL;
+ propValue = NULL;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptHolder::makeFreezable(bool freezable) {
+ _freezable = freezable;
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ _scripts[i]->_freezable = freezable;
+ }
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScScript *BaseScriptHolder::invokeMethodThread(const char *methodName) {
+ for (int i = _scripts.size() - 1; i >= 0; i--) {
+ if (_scripts[i]->canHandleMethod(methodName)) {
+
+ ScScript *thread = new ScScript(_gameRef, _scripts[i]->_engine);
+ if (thread) {
+ bool ret = thread->createMethodThread(_scripts[i], methodName);
+ if (DID_SUCCEED(ret)) {
+ _scripts[i]->_engine->_scripts.add(thread);
+ return thread;
+ } else {
+ delete thread;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptHolder::scDebuggerDesc(char *buf, int bufSize) {
+ strcpy(buf, scToString());
+ if (getName() && strcmp(getName(), "<unnamed>") != 0) {
+ strcat(buf, " Name: ");
+ strcat(buf, getName());
+ }
+ if (_filename) {
+ strcat(buf, " File: ");
+ strcat(buf, _filename);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// IWmeObject
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptHolder::sendEvent(const char *eventName) {
+ return DID_SUCCEED(applyEvent(eventName));
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h
new file mode 100644
index 0000000000..5fd0dbec9c
--- /dev/null
+++ b/engines/wintermute/base/base_script_holder.h
@@ -0,0 +1,76 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SCRIPTHOLDER_H
+#define WINTERMUTE_BASE_SCRIPTHOLDER_H
+
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+class BaseScriptHolder : public BaseScriptable {
+public:
+ DECLARE_PERSISTENT(BaseScriptHolder, BaseScriptable)
+
+ BaseScriptHolder(BaseGame *inGame);
+ virtual ~BaseScriptHolder();
+ virtual ScScript *invokeMethodThread(const char *methodName);
+ virtual void makeFreezable(bool freezable);
+ bool canHandleEvent(const char *eventName);
+ virtual bool canHandleMethod(const char *eventMethod);
+ bool cleanup();
+ bool removeScript(ScScript *script);
+ bool addScript(const char *filename);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ virtual bool listen(BaseScriptHolder *param1, uint32 param2);
+ bool applyEvent(const char *eventName, bool unbreakable = false);
+ void setFilename(const char *filename);
+ const char *getFilename() { return _filename; }
+ bool parseProperty(byte *buffer, bool complete = true);
+ bool _freezable;
+ bool _ready;
+
+ BaseArray<ScScript *> _scripts;
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+ virtual void scDebuggerDesc(char *buf, int bufSize);
+ // IWmeObject
+private:
+ char *_filename;
+public:
+ virtual bool sendEvent(const char *eventName);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp
new file mode 100644
index 0000000000..a2dd8b00e7
--- /dev/null
+++ b/engines/wintermute/base/base_scriptable.cpp
@@ -0,0 +1,191 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_scriptable.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseScriptable, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseScriptable::BaseScriptable(BaseGame *inGame, bool noValue, bool persistable) : BaseNamedObject(inGame) {
+ _refCount = 0;
+
+ if (noValue) {
+ _scValue = NULL;
+ } else {
+ _scValue = new ScValue(_gameRef);
+ }
+
+ _persistable = persistable;
+
+ _scProp = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseScriptable::~BaseScriptable() {
+ //if (_refCount>0) _gameRef->LOG(0, "Warning: Destroying object, _refCount=%d", _refCount);
+ delete _scValue;
+ delete _scProp;
+ _scValue = NULL;
+ _scProp = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptable::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ /*
+ stack->correctParams(0);
+ stack->pushNULL();
+ script->runtimeError("Call to undefined method '%s'.", name);
+
+ return STATUS_OK;
+ */
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseScriptable::scGetProperty(const Common::String &name) {
+ if (!_scProp) {
+ _scProp = new ScValue(_gameRef);
+ }
+ if (_scProp) {
+ return _scProp->getProp(name.c_str()); // TODO: Change to Common::String
+ } else {
+ return NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptable::scSetProperty(const char *name, ScValue *value) {
+ if (!_scProp) {
+ _scProp = new ScValue(_gameRef);
+ }
+ if (_scProp) {
+ return _scProp->setProp(name, value);
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseScriptable::scToString() {
+ return "[native object]";
+}
+
+//////////////////////////////////////////////////////////////////////////
+void *BaseScriptable::scToMemBuffer() {
+ return (void *)NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseScriptable::scToInt() {
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+double BaseScriptable::scToFloat() {
+ return 0.0f;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptable::scToBool() {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptable::scSetString(const char *val) {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptable::scSetInt(int val) {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptable::scSetFloat(double val) {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptable::scSetBool(bool val) {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptable::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_gameRef));
+ persistMgr->transfer(TMEMBER(_refCount));
+ persistMgr->transfer(TMEMBER(_scProp));
+ persistMgr->transfer(TMEMBER(_scValue));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseScriptable::scCompare(BaseScriptable *val) {
+ if (this < val) {
+ return -1;
+ } else if (this > val) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseScriptable::scDebuggerDesc(char *buf, int bufSize) {
+ strcpy(buf, scToString());
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseScriptable::canHandleMethod(const char *eventMethod) {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScScript *BaseScriptable::invokeMethodThread(const char *methodName) {
+ return NULL;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h
new file mode 100644
index 0000000000..fbe14fc299
--- /dev/null
+++ b/engines/wintermute/base/base_scriptable.h
@@ -0,0 +1,83 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SCRIPTABLE_H
+#define WINTERMUTE_BASE_SCRIPTABLE_H
+
+
+#include "engines/wintermute/base/base_named_object.h"
+#include "engines/wintermute/persistent.h"
+
+namespace Wintermute {
+
+class ScValue;
+class ScStack;
+class ScScript;
+
+class BaseScriptable : public BaseNamedObject {
+public:
+ virtual ScScript *invokeMethodThread(const char *methodName);
+ DECLARE_PERSISTENT(BaseScriptable, BaseNamedObject)
+
+ BaseScriptable(BaseGame *inGame, bool noValue = false, bool persistable = true);
+ virtual ~BaseScriptable();
+
+ // high level scripting interface
+ virtual bool canHandleMethod(const char *eventMethod);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+ virtual void *scToMemBuffer();
+ virtual int scToInt();
+ virtual double scToFloat();
+ virtual bool scToBool();
+ virtual void scSetString(const char *val);
+ virtual void scSetInt(int val);
+ virtual void scSetFloat(double val);
+ virtual void scSetBool(bool val);
+ virtual int scCompare(BaseScriptable *val);
+ virtual void scDebuggerDesc(char *buf, int bufSize);
+ int _refCount;
+ ScValue *_scValue;
+ ScValue *_scProp;
+};
+
+// Implemented in their respective .cpp-files
+BaseScriptable *makeSXArray(BaseGame *inGame, ScStack *stack);
+BaseScriptable *makeSXDate(BaseGame *inGame, ScStack *stack);
+BaseScriptable *makeSXFile(BaseGame *inGame, ScStack *stack);
+BaseScriptable *makeSXMath(BaseGame *inGame);
+BaseScriptable *makeSXMemBuffer(BaseGame *inGame, ScStack *stack);
+BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack);
+BaseScriptable *makeSXStore(BaseGame *inGame);
+BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack);
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
new file mode 100644
index 0000000000..468af1bd75
--- /dev/null
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -0,0 +1,819 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/utils/path_util.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_frame.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseSprite, false)
+
+//////////////////////////////////////////////////////////////////////
+BaseSprite::BaseSprite(BaseGame *inGame, BaseObject *Owner) : BaseScriptHolder(inGame) {
+ _editorAllFrames = false;
+ _owner = Owner;
+ setDefaults();
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseSprite::~BaseSprite() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSprite::setDefaults() {
+ _currentFrame = -1;
+ _looping = false;
+ _lastFrameTime = 0;
+ setFilename(NULL);
+ _finished = false;
+ _changed = false;
+ _paused = false;
+ _continuous = false;
+ _moveX = _moveY = 0;
+
+ _editorMuted = false;
+ _editorBgFile = NULL;
+ _editorBgOffsetX = _editorBgOffsetY = 0;
+ _editorBgAlpha = 0xFF;
+ _streamed = false;
+ _streamedKeepLoaded = false;
+
+ setName("");
+
+ _precise = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSprite::cleanup() {
+ BaseScriptHolder::cleanup();
+
+ for (uint32 i = 0; i < _frames.size(); i++) {
+ delete _frames[i];
+ }
+ _frames.clear();
+
+ delete[] _editorBgFile;
+ _editorBgFile = NULL;
+
+ setDefaults();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, uint32 alpha) {
+ getCurrentFrame(zoomX, zoomY);
+ if (_currentFrame < 0 || _currentFrame >= (int32)_frames.size()) {
+ return STATUS_OK;
+ }
+
+ // move owner if allowed to
+ if (_changed && _owner && _owner->_movable) {
+ _owner->_posX += _moveX;
+ _owner->_posY += _moveY;
+ _owner->afterMove();
+
+ x = _owner->_posX;
+ y = _owner->_posY;
+ }
+
+ // draw frame
+ return display(x, y, registerOwner, zoomX, zoomY, alpha);
+}
+
+bool BaseSprite::isChanged() {
+ return _changed;
+}
+
+bool BaseSprite::isFinished() {
+ return _finished;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteCacheType cacheType) {
+ Common::SeekableReadStream *file = BaseFileManager::getEngineInstance()->openFile(filename);
+ if (!file) {
+ _gameRef->LOG(0, "BaseSprite::LoadFile failed for file '%s'", filename.c_str());
+ if (_gameRef->_debugDebugMode) {
+ return loadFile("invalid_debug.bmp", lifeTime, cacheType);
+ } else {
+ return loadFile("invalid.bmp", lifeTime, cacheType);
+ }
+ } else {
+ BaseFileManager::getEngineInstance()->closeFile(file);
+ file = NULL;
+ }
+
+ bool ret = STATUS_FAILED;
+
+ AnsiString filePrefix = filename;
+ AnsiString ext = PathUtil::getExtension(filename);
+ ext.toLowercase();
+ filePrefix.toLowercase();
+ if (filePrefix.hasPrefix("savegame:") || (ext == "bmp") || (ext == "tga") || (ext == "png") || (ext == "jpg")) {
+ BaseFrame *frame = new BaseFrame(_gameRef);
+ BaseSubFrame *subframe = new BaseSubFrame(_gameRef);
+ subframe->setSurface(filename, true, 0, 0, 0, lifeTime, true);
+ if (subframe->_surface == NULL) {
+ _gameRef->LOG(0, "Error loading simple sprite '%s'", filename.c_str());
+ ret = STATUS_FAILED;
+ delete frame;
+ delete subframe;
+ } else {
+ subframe->setDefaultRect();
+ frame->_subframes.add(subframe);
+ _frames.add(frame);
+ _currentFrame = 0;
+ ret = STATUS_OK;
+ }
+ } else {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer) {
+ if (DID_FAIL(ret = loadBuffer(buffer, true, lifeTime, cacheType))) {
+ _gameRef->LOG(0, "Error parsing SPRITE file '%s'", filename.c_str());
+ } else {
+ ret = STATUS_OK;
+ }
+ delete[] buffer;
+ }
+ }
+
+ setFilename(filename.c_str());
+
+ return ret;
+}
+
+
+
+TOKEN_DEF_START
+TOKEN_DEF(CONTINUOUS)
+TOKEN_DEF(SPRITE)
+TOKEN_DEF(LOOPING)
+TOKEN_DEF(FRAME)
+TOKEN_DEF(NAME)
+TOKEN_DEF(PRECISE)
+TOKEN_DEF(EDITOR_MUTED)
+TOKEN_DEF(STREAMED_KEEP_LOADED)
+TOKEN_DEF(STREAMED)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(EDITOR_BG_FILE)
+TOKEN_DEF(EDITOR_BG_OFFSET_X)
+TOKEN_DEF(EDITOR_BG_OFFSET_Y)
+TOKEN_DEF(EDITOR_BG_ALPHA)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////
+bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(CONTINUOUS)
+ TOKEN_TABLE(SPRITE)
+ TOKEN_TABLE(LOOPING)
+ TOKEN_TABLE(FRAME)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(PRECISE)
+ TOKEN_TABLE(EDITOR_MUTED)
+ TOKEN_TABLE(STREAMED_KEEP_LOADED)
+ TOKEN_TABLE(STREAMED)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(EDITOR_BG_FILE)
+ TOKEN_TABLE(EDITOR_BG_OFFSET_X)
+ TOKEN_TABLE(EDITOR_BG_OFFSET_Y)
+ TOKEN_TABLE(EDITOR_BG_ALPHA)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+
+ cleanup();
+
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SPRITE) {
+ _gameRef->LOG(0, "'SPRITE' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ int frameCount = 1;
+ BaseFrame *frame;
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_CONTINUOUS:
+ parser.scanStr((char *)params, "%b", &_continuous);
+ break;
+
+ case TOKEN_EDITOR_MUTED:
+ parser.scanStr((char *)params, "%b", &_editorMuted);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_LOOPING:
+ parser.scanStr((char *)params, "%b", &_looping);
+ break;
+
+ case TOKEN_PRECISE:
+ parser.scanStr((char *)params, "%b", &_precise);
+ break;
+
+ case TOKEN_STREAMED:
+ parser.scanStr((char *)params, "%b", &_streamed);
+ if (_streamed && lifeTime == -1) {
+ lifeTime = 500;
+ cacheType = CACHE_ALL;
+ }
+ break;
+
+ case TOKEN_STREAMED_KEEP_LOADED:
+ parser.scanStr((char *)params, "%b", &_streamedKeepLoaded);
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_EDITOR_BG_FILE:
+ if (_gameRef->_editorMode) {
+ delete[] _editorBgFile;
+ _editorBgFile = new char[strlen((char *)params) + 1];
+ if (_editorBgFile) {
+ strcpy(_editorBgFile, (char *)params);
+ }
+ }
+ break;
+
+ case TOKEN_EDITOR_BG_OFFSET_X:
+ parser.scanStr((char *)params, "%d", &_editorBgOffsetX);
+ break;
+
+ case TOKEN_EDITOR_BG_OFFSET_Y:
+ parser.scanStr((char *)params, "%d", &_editorBgOffsetY);
+ break;
+
+ case TOKEN_EDITOR_BG_ALPHA:
+ parser.scanStr((char *)params, "%d", &_editorBgAlpha);
+ _editorBgAlpha = MIN(_editorBgAlpha, 255);
+ _editorBgAlpha = MAX(_editorBgAlpha, 0);
+ break;
+
+ case TOKEN_FRAME: {
+ int frameLifeTime = lifeTime;
+ if (cacheType == CACHE_HALF && frameCount % 2 != 1) {
+ frameLifeTime = -1;
+ }
+
+ frame = new BaseFrame(_gameRef);
+
+ if (DID_FAIL(frame->loadBuffer(params, frameLifeTime, _streamedKeepLoaded))) {
+ delete frame;
+ _gameRef->LOG(0, "Error parsing frame %d", frameCount);
+ return STATUS_FAILED;
+ }
+
+ _frames.add(frame);
+ frameCount++;
+ if (_currentFrame == -1) {
+ _currentFrame = 0;
+ }
+ }
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in SPRITE definition");
+ return STATUS_FAILED;
+ }
+ _canBreak = !_continuous;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseSprite::reset() {
+ if (_frames.size() > 0) {
+ _currentFrame = 0;
+ } else {
+ _currentFrame = -1;
+ }
+
+ killAllSounds();
+
+ _lastFrameTime = 0;
+ _finished = false;
+ _moveX = _moveY = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSprite::getCurrentFrame(float zoomX, float zoomY) {
+ //if (_owner && _owner->_freezable && _gameRef->_state == GAME_FROZEN) return true;
+
+ if (_currentFrame == -1) {
+ return false;
+ }
+
+ uint32 timer;
+ if (_owner && _owner->_freezable) {
+ timer = _gameRef->_timer;
+ } else {
+ timer = _gameRef->_liveTimer;
+ }
+
+ int lastFrame = _currentFrame;
+
+ // get current frame
+ if (!_paused && !_finished && timer >= _lastFrameTime + _frames[_currentFrame]->_delay && _lastFrameTime != 0) {
+ if (_currentFrame < (int32)_frames.size() - 1) {
+ _currentFrame++;
+ if (_continuous) {
+ _canBreak = (_currentFrame == (int32)_frames.size() - 1);
+ }
+ } else {
+ if (_looping) {
+ _currentFrame = 0;
+ _canBreak = true;
+ } else {
+ _finished = true;
+ _canBreak = true;
+ }
+ }
+
+ _lastFrameTime = timer;
+ }
+
+ _changed = (lastFrame != _currentFrame || (_looping && (int32)_frames.size() == 1));
+
+ if (_lastFrameTime == 0) {
+ _lastFrameTime = timer;
+ _changed = true;
+ if (_continuous) {
+ _canBreak = (_currentFrame == (int32)_frames.size() - 1);
+ }
+ }
+
+ if (_changed) {
+ _moveX = _frames[_currentFrame]->_moveX;
+ _moveY = _frames[_currentFrame]->_moveY;
+
+ if (zoomX != 100 || zoomY != 100) {
+ _moveX = (int)((float)_moveX * (float)(zoomX / 100.0f));
+ _moveY = (int)((float)_moveY * (float)(zoomY / 100.0f));
+ }
+ }
+
+ return _changed;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSprite::display(int x, int y, BaseObject *registerVal, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode) {
+ if (_currentFrame < 0 || _currentFrame >= (int32)_frames.size()) {
+ return STATUS_OK;
+ }
+
+ // on change...
+ if (_changed) {
+ if (_frames[_currentFrame]->_killSound) {
+ killAllSounds();
+ }
+ applyEvent("FrameChanged");
+ _frames[_currentFrame]->oneTimeDisplay(_owner, _gameRef->_editorMode && _editorMuted);
+ }
+
+ // draw frame
+ return _frames[_currentFrame]->draw(x - _gameRef->_offsetX, y - _gameRef->_offsetY, registerVal, zoomX, zoomY, _precise, alpha, _editorAllFrames, rotate, blendMode);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSurface *BaseSprite::getSurface() {
+ // only used for animated textures for 3D models
+ if (_currentFrame < 0 || _currentFrame >= (int32)_frames.size()) {
+ return NULL;
+ }
+ BaseFrame *frame = _frames[_currentFrame];
+ if (frame && frame->_subframes.size() > 0) {
+ BaseSubFrame *subframe = frame->_subframes[0];
+ if (subframe) {
+ return subframe->_surface;
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) {
+ if (!rect) {
+ return false;
+ }
+
+ BasePlatform::setRectEmpty(rect);
+ for (uint32 i = 0; i < _frames.size(); i++) {
+ Rect32 frame;
+ Rect32 temp;
+ BasePlatform::copyRect(&temp, rect);
+ _frames[i]->getBoundingRect(&frame, x, y, scaleX, scaleY);
+ BasePlatform::unionRect(rect, &temp, &frame);
+ }
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "SPRITE {\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "LOOPING=%s\n", _looping ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "CONTINUOUS=%s\n", _continuous ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PRECISE=%s\n", _precise ? "TRUE" : "FALSE");
+ if (_streamed) {
+ buffer->putTextIndent(indent + 2, "STREAMED=%s\n", _streamed ? "TRUE" : "FALSE");
+
+ if (_streamedKeepLoaded) {
+ buffer->putTextIndent(indent + 2, "STREAMED_KEEP_LOADED=%s\n", _streamedKeepLoaded ? "TRUE" : "FALSE");
+ }
+ }
+
+ if (_editorMuted) {
+ buffer->putTextIndent(indent + 2, "EDITOR_MUTED=%s\n", _editorMuted ? "TRUE" : "FALSE");
+ }
+
+ if (_editorBgFile) {
+ buffer->putTextIndent(indent + 2, "EDITOR_BG_FILE=\"%s\"\n", _editorBgFile);
+ buffer->putTextIndent(indent + 2, "EDITOR_BG_OFFSET_X=%d\n", _editorBgOffsetX);
+ buffer->putTextIndent(indent + 2, "EDITOR_BG_OFFSET_Y=%d\n", _editorBgOffsetY);
+ buffer->putTextIndent(indent + 2, "EDITOR_BG_ALPHA=%d\n", _editorBgAlpha);
+ }
+
+ BaseScriptHolder::saveAsText(buffer, indent + 2);
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ for (uint32 i = 0; i < _frames.size(); i++) {
+ _frames[i]->saveAsText(buffer, indent + 2);
+ }
+
+ buffer->putTextIndent(indent, "}\n\n");
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::persist(BasePersistenceManager *persistMgr) {
+ BaseScriptHolder::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_canBreak));
+ persistMgr->transfer(TMEMBER(_changed));
+ persistMgr->transfer(TMEMBER(_paused));
+ persistMgr->transfer(TMEMBER(_continuous));
+ persistMgr->transfer(TMEMBER(_currentFrame));
+ persistMgr->transfer(TMEMBER(_editorAllFrames));
+ persistMgr->transfer(TMEMBER(_editorBgAlpha));
+ persistMgr->transfer(TMEMBER(_editorBgFile));
+ persistMgr->transfer(TMEMBER(_editorBgOffsetX));
+ persistMgr->transfer(TMEMBER(_editorBgOffsetY));
+ persistMgr->transfer(TMEMBER(_editorMuted));
+ persistMgr->transfer(TMEMBER(_finished));
+
+ _frames.persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_lastFrameTime));
+ persistMgr->transfer(TMEMBER(_looping));
+ persistMgr->transfer(TMEMBER(_moveX));
+ persistMgr->transfer(TMEMBER(_moveY));
+ persistMgr->transfer(TMEMBER(_owner));
+ persistMgr->transfer(TMEMBER(_precise));
+ persistMgr->transfer(TMEMBER(_streamed));
+ persistMgr->transfer(TMEMBER(_streamedKeepLoaded));
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // GetFrame
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetFrame") == 0) {
+ stack->correctParams(1);
+ int index = stack->pop()->getInt(-1);
+ if (index < 0 || index >= (int32)_frames.size()) {
+ script->runtimeError("Sprite.GetFrame: Frame index %d is out of range.", index);
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_frames[index], true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteFrame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteFrame") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ if (val->isInt()) {
+ int index = val->getInt(-1);
+ if (index < 0 || index >= (int32)_frames.size()) {
+ script->runtimeError("Sprite.DeleteFrame: Frame index %d is out of range.", index);
+ }
+ } else {
+ BaseFrame *frame = (BaseFrame *)val->getNative();
+ for (uint32 i = 0; i < _frames.size(); i++) {
+ if (_frames[i] == frame) {
+ if (i == (uint32)_currentFrame) {
+ _lastFrameTime = 0;
+ }
+ delete _frames[i];
+ _frames.remove_at(i);
+ break;
+ }
+ }
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Reset
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Reset") == 0) {
+ stack->correctParams(0);
+ reset();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddFrame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddFrame") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ const char *filename = NULL;
+ if (!val->isNULL()) {
+ filename = val->getString();
+ }
+
+ BaseFrame *frame = new BaseFrame(_gameRef);
+ if (filename != NULL) {
+ BaseSubFrame *sub = new BaseSubFrame(_gameRef);
+ if (DID_SUCCEED(sub->setSurface(filename))) {
+ sub->setDefaultRect();
+ frame->_subframes.add(sub);
+ } else {
+ delete sub;
+ }
+ }
+ _frames.add(frame);
+
+ stack->pushNative(frame, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InsertFrame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InsertFrame") == 0) {
+ stack->correctParams(2);
+ int index = stack->pop()->getInt();
+ if (index < 0) {
+ index = 0;
+ }
+
+ ScValue *val = stack->pop();
+ const char *filename = NULL;
+ if (!val->isNULL()) {
+ filename = val->getString();
+ }
+
+ BaseFrame *frame = new BaseFrame(_gameRef);
+ if (filename != NULL) {
+ BaseSubFrame *sub = new BaseSubFrame(_gameRef);
+ if (DID_SUCCEED(sub->setSurface(filename))) {
+ frame->_subframes.add(sub);
+ } else {
+ delete sub;
+ }
+ }
+
+ if (index >= (int32)_frames.size()) {
+ _frames.add(frame);
+ } else {
+ _frames.insert_at(index, frame);
+ }
+
+ stack->pushNative(frame, true);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Pause
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Pause") == 0) {
+ stack->correctParams(0);
+ _paused = true;
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Play
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Play") == 0) {
+ stack->correctParams(0);
+ _paused = false;
+ stack->pushNULL();
+ return STATUS_OK;
+ } else {
+ return BaseScriptHolder::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseSprite::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("sprite");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumFrames (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumFrames") {
+ _scValue->setInt(_frames.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CurrentFrame
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CurrentFrame") {
+ _scValue->setInt(_currentFrame);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PixelPerfect
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PixelPerfect") {
+ _scValue->setBool(_precise);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Looping
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Looping") {
+ _scValue->setBool(_looping);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Owner (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Owner") {
+ if (_owner == NULL) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setNative(_owner, true);
+ }
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Finished (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Finished") {
+ _scValue->setBool(_finished);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Paused (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Paused") {
+ _scValue->setBool(_paused);
+ return _scValue;
+ } else {
+ return BaseScriptHolder::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // CurrentFrame
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "CurrentFrame") == 0) {
+ _currentFrame = value->getInt(0);
+ if (_currentFrame >= (int32)_frames.size() || _currentFrame < 0) {
+ _currentFrame = -1;
+ }
+ _lastFrameTime = 0;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PixelPerfect
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PixelPerfect") == 0) {
+ _precise = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Looping
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Looping") == 0) {
+ _looping = value->getBool();
+ return STATUS_OK;
+ } else {
+ return BaseScriptHolder::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseSprite::scToString() {
+ return "[sprite]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSprite::killAllSounds() {
+ for (uint32 i = 0; i < _frames.size(); i++) {
+ _frames[i]->stopSound();
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h
new file mode 100644
index 0000000000..1d244c3a52
--- /dev/null
+++ b/engines/wintermute/base/base_sprite.h
@@ -0,0 +1,93 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SPRITE_H
+#define WINTERMUTE_BASE_SPRITE_H
+
+
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base_script_holder.h"
+
+namespace Wintermute {
+class BaseFrame;
+class BaseSurface;
+class BaseObject;
+class BaseSprite: public BaseScriptHolder {
+public:
+ BaseSurface *getSurface();
+ void cleanup();
+ void setDefaults();
+ DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder)
+
+ bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
+ int _moveY;
+ int _moveX;
+ bool display(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ bool getCurrentFrame(float zoomX = 100, float zoomY = 100);
+ void reset();
+ bool isChanged();
+ bool isFinished();
+ bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ bool draw(int x, int y, BaseObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
+ bool _looping;
+ int _currentFrame;
+ bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = NULL);
+ BaseSprite(BaseGame *inGame, BaseObject *owner = NULL);
+ virtual ~BaseSprite();
+ BaseArray<BaseFrame *> _frames;
+ bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+private:
+ BaseObject *_owner;
+ bool _canBreak;
+ bool _changed;
+ bool _editorAllFrames;
+ char *_editorBgFile;
+ int _editorBgOffsetX;
+ int _editorBgOffsetY;
+ int _editorBgAlpha;
+ bool _editorMuted;
+ bool _finished;
+ bool _continuous;
+ uint32 _lastFrameTime;
+ bool _precise;
+ bool _paused;
+ bool _streamed;
+ bool _streamedKeepLoaded;
+ bool killAllSounds();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp
new file mode 100644
index 0000000000..2f890beea1
--- /dev/null
+++ b/engines/wintermute/base/base_string_table.cpp
@@ -0,0 +1,255 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseStringTable::BaseStringTable(BaseGame *inGame) : BaseClass(inGame) {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseStringTable::~BaseStringTable() {
+ // delete strings
+ _strings.clear();
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseStringTable::addString(const char *key, const char *val, bool reportDuplicities) {
+ if (key == NULL || val == NULL) {
+ return STATUS_FAILED;
+ }
+
+ if (scumm_stricmp(key, "@right-to-left") == 0) {
+ _gameRef->_textRTL = true;
+ return STATUS_OK;
+ }
+
+ Common::String finalKey = key;
+ finalKey.toLowercase();
+
+ StringsIter it = _strings.find(finalKey);
+ if (it != _strings.end() && reportDuplicities) {
+ _gameRef->LOG(0, " Warning: Duplicate definition of string '%s'.", finalKey.c_str());
+ }
+
+ _strings[finalKey] = val;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+char *BaseStringTable::getKey(const char *str) const {
+ if (str == NULL || str[0] != '/') {
+ return NULL;
+ }
+
+ const char *value = strchr(str + 1, '/');
+ if (value == NULL) {
+ return NULL;
+ }
+
+ char *key = new char[value - str];
+ Common::strlcpy(key, str + 1, (size_t)(value - str));
+
+ BasePlatform::strlwr(key);
+
+ char *newStr;
+
+ StringsIter it = _strings.find(key);
+ if (it != _strings.end()) {
+ newStr = new char[it->_value.size() + 1];
+ strcpy(newStr, it->_value.c_str());
+ if (strlen(newStr) > 0 && newStr[0] == '/' && strchr(newStr + 1, '/')) {
+ delete[] key;
+ char *ret = getKey(newStr);
+ delete[] newStr;
+ return ret;
+ } else {
+ delete[] newStr;
+ return key;
+ }
+ } else {
+ return key;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseStringTable::expand(char **str) const {
+ if (str == NULL || *str == NULL || *str[0] != '/') {
+ return;
+ }
+
+ char *value = strchr(*str + 1, '/');
+ if (value == NULL) {
+ return;
+ }
+
+ char *key = new char[value - *str];
+ Common::strlcpy(key, *str + 1, (size_t)(value - *str));
+
+ BasePlatform::strlwr(key);
+
+ value++;
+
+ char *newStr;
+
+ StringsIter it = _strings.find(key);
+ if (it != _strings.end()) {
+ newStr = new char[it->_value.size() + 1];
+ strcpy(newStr, it->_value.c_str());
+ } else {
+ newStr = new char[strlen(value) + 1];
+ strcpy(newStr, value);
+ }
+
+ delete[] key;
+ delete[] *str;
+ *str = newStr;
+
+ if (strlen(*str) > 0 && *str[0] == '/') {
+ expand(str);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseStringTable::expandStatic(const char *string) const {
+ if (string == NULL || string[0] == '\0' || string[0] != '/') {
+ return string;
+ }
+
+ const char *value = strchr(string + 1, '/');
+ if (value == NULL) {
+ return string;
+ }
+
+ char *key = new char[value - string];
+ Common::strlcpy(key, string + 1, (size_t)(value - string - 1));
+ BasePlatform::strlwr(key);
+
+ value++;
+
+ const char *newStr;
+
+ StringsIter it = _strings.find(key);
+ if (it != _strings.end()) {
+ newStr = it->_value.c_str();
+ } else {
+ newStr = value;
+ }
+
+ delete[] key;
+
+ if (strlen(newStr) > 0 && newStr[0] == '/') {
+ return expandStatic(newStr);
+ } else {
+ return newStr;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseStringTable::loadFile(const char *filename, bool clearOld) {
+ _gameRef->LOG(0, "Loading string table...");
+
+ if (clearOld) {
+ _strings.clear();
+ }
+
+ uint32 size;
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename, &size);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "BaseStringTable::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ uint32 pos = 0;
+
+ if (size > 3 && buffer[0] == 0xEF && buffer[1] == 0xBB && buffer[2] == 0xBF) {
+ pos += 3;
+ if (_gameRef->_textEncoding != TEXT_UTF8) {
+ _gameRef->_textEncoding = TEXT_UTF8;
+ //_gameRef->_textEncoding = TEXT_ANSI;
+ _gameRef->LOG(0, " UTF8 file detected, switching to UTF8 text encoding");
+ }
+ } else {
+ _gameRef->_textEncoding = TEXT_ANSI;
+ }
+
+ uint32 lineLength = 0;
+ while (pos < size) {
+ lineLength = 0;
+ while (pos + lineLength < size && buffer[pos + lineLength] != '\n' && buffer[pos + lineLength] != '\0') {
+ lineLength++;
+ }
+
+ uint32 realLength = lineLength - (pos + lineLength >= size ? 0 : 1);
+ char *line = new char[realLength + 1];
+ Common::strlcpy(line, (char *)&buffer[pos], realLength + 1);
+ char *value = strchr(line, '\t');
+ if (value == NULL) {
+ value = strchr(line, ' ');
+ }
+
+ if (line[0] != ';') {
+ if (value != NULL) {
+ value[0] = '\0';
+ value++;
+ for (uint32 i = 0; i < strlen(value); i++) {
+ if (value[i] == '|') {
+ value[i] = '\n';
+ }
+ }
+ addString(line, value, clearOld);
+ } else if (line[0] != '\0') {
+ addString(line, "", clearOld);
+ }
+ }
+
+ delete[] line;
+ pos += lineLength + 1;
+ }
+
+ delete[] buffer;
+
+ _gameRef->LOG(0, " %d strings loaded", _strings.size());
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h
new file mode 100644
index 0000000000..128807bd1a
--- /dev/null
+++ b/engines/wintermute/base/base_string_table.h
@@ -0,0 +1,55 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_STRING_TABLE_H
+#define WINTERMUTE_BASE_STRING_TABLE_H
+
+
+#include "common/hashmap.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BaseStringTable : public BaseClass {
+public:
+ bool loadFile(const char *filename, bool deleteAll = true);
+ void expand(char **str) const;
+ const char *expandStatic(const char *string) const;
+ bool addString(const char *key, const char *val, bool reportDuplicities = true);
+ BaseStringTable(BaseGame *inGame);
+ virtual ~BaseStringTable();
+ char *getKey(const char *str) const;
+private:
+ Common::HashMap<Common::String, Common::String> _strings;
+ typedef Common::HashMap<Common::String, Common::String>::const_iterator StringsIter;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
new file mode 100644
index 0000000000..77cc522ae7
--- /dev/null
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -0,0 +1,659 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseSubFrame, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) {
+ _surface = NULL;
+ _hotspotX = _hotspotY = 0;
+ _alpha = 0xFFFFFFFF;
+ _transparent = 0xFFFF00FF;
+
+ _wantsDefaultRect = false;
+ BasePlatform::setRectEmpty(&_rect);
+
+ _editorSelected = false;
+
+ _surfaceFilename = NULL;
+ _cKDefault = true;
+ _cKRed = _cKBlue = _cKGreen = 0;
+ _lifeTime = -1;
+ _keepLoaded = false;
+
+ _2DOnly = _3DOnly = false;
+ _decoration = false;
+
+ _mirrorX = _mirrorY = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSubFrame::~BaseSubFrame() {
+ if (_surface) {
+ _gameRef->_surfaceStorage->removeSurface(_surface);
+ }
+ delete[] _surfaceFilename;
+ _surfaceFilename = NULL;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(TRANSPARENT)
+TOKEN_DEF(RECT)
+TOKEN_DEF(HOTSPOT)
+TOKEN_DEF(2D_ONLY)
+TOKEN_DEF(3D_ONLY)
+TOKEN_DEF(DECORATION)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(MIRROR_X)
+TOKEN_DEF(MIRROR_Y)
+TOKEN_DEF(EDITOR_SELECTED)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(TRANSPARENT)
+ TOKEN_TABLE(RECT)
+ TOKEN_TABLE(HOTSPOT)
+ TOKEN_TABLE(2D_ONLY)
+ TOKEN_TABLE(3D_ONLY)
+ TOKEN_TABLE(DECORATION)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(MIRROR_X)
+ TOKEN_TABLE(MIRROR_Y)
+ TOKEN_TABLE(EDITOR_SELECTED)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ char *params;
+ int cmd;
+ BaseParser parser;
+ Rect32 rect;
+ int r = 255, g = 255, b = 255;
+ int ar = 255, ag = 255, ab = 255, alpha = 255;
+ bool custoTrans = false;
+ BasePlatform::setRectEmpty(&rect);
+ char *surfaceFile = NULL;
+
+ delete _surface;
+ _surface = NULL;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, &params)) > 0) {
+ switch (cmd) {
+ case TOKEN_IMAGE:
+ surfaceFile = params;
+ break;
+
+ case TOKEN_TRANSPARENT:
+ parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
+ custoTrans = true;
+ break;
+
+ case TOKEN_RECT:
+ parser.scanStr(params, "%d,%d,%d,%d", &rect.left, &rect.top, &rect.right, &rect.bottom);
+ break;
+
+ case TOKEN_HOTSPOT:
+ parser.scanStr(params, "%d,%d", &_hotspotX, &_hotspotY);
+ break;
+
+ case TOKEN_2D_ONLY:
+ parser.scanStr(params, "%b", &_2DOnly);
+ break;
+
+ case TOKEN_3D_ONLY:
+ parser.scanStr(params, "%b", &_3DOnly);
+ break;
+
+ case TOKEN_MIRROR_X:
+ parser.scanStr(params, "%b", &_mirrorX);
+ break;
+
+ case TOKEN_MIRROR_Y:
+ parser.scanStr(params, "%b", &_mirrorY);
+ break;
+
+ case TOKEN_DECORATION:
+ parser.scanStr(params, "%b", &_decoration);
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr(params, "%d", &alpha);
+ break;
+
+ case TOKEN_EDITOR_SELECTED:
+ parser.scanStr(params, "%b", &_editorSelected);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty((byte *)params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in SUBFRAME definition");
+ return STATUS_FAILED;
+ }
+
+ if (surfaceFile != NULL) {
+ if (custoTrans) {
+ setSurface(surfaceFile, false, r, g, b, lifeTime, keepLoaded);
+ } else {
+ setSurface(surfaceFile, true, 0, 0, 0, lifeTime, keepLoaded);
+ }
+ }
+
+ _alpha = BYTETORGBA(ar, ag, ab, alpha);
+ if (custoTrans) {
+ _transparent = BYTETORGBA(r, g, b, 0xFF);
+ }
+
+ /*
+ if (_surface == NULL)
+ {
+ _gameRef->LOG(0, "Error parsing sub-frame. Image not set.");
+ return STATUS_FAILED;
+ }
+ */
+ if (BasePlatform::isRectEmpty(&rect)) {
+ setDefaultRect();
+ } else {
+ setRect(rect);
+ }
+
+ return STATUS_OK;
+}
+
+Rect32 BaseSubFrame::getRect() {
+ if (_wantsDefaultRect && _surface) {
+ BasePlatform::setRect(&_rect, 0, 0, _surface->getWidth(), _surface->getHeight());
+ _wantsDefaultRect = false;
+ }
+ return _rect;
+}
+
+void BaseSubFrame::setRect(Rect32 rect) {
+ _wantsDefaultRect = false;
+ _rect = rect;
+}
+
+const char* BaseSubFrame::getSurfaceFilename() {
+ return _surfaceFilename;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) {
+ if (!_surface) {
+ return STATUS_OK;
+ }
+
+ if (registerOwner != NULL && !_decoration) {
+ if (zoomX == 100 && zoomY == 100) {
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise));
+ } else {
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + getRect().left) * (zoomX / 100)), (int)(y - (_hotspotY + getRect().top) * (zoomY / 100)), (int)((getRect().right - getRect().left) * (zoomX / 100)), (int)((getRect().bottom - getRect().top) * (zoomY / 100)), zoomX, zoomY, precise));
+ }
+ }
+ if (_gameRef->_suspendedRendering) {
+ return STATUS_OK;
+ }
+
+ bool res;
+
+ //if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha)
+ if (_alpha != 0xFFFFFFFF) {
+ alpha = _alpha;
+ }
+
+ if (rotate != 0.0f) {
+ res = _surface->displayTransform((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), _hotspotX, _hotspotY, getRect(), zoomX, zoomY, alpha, rotate, blendMode, _mirrorX, _mirrorY);
+ } else {
+ if (zoomX == 100 && zoomY == 100) {
+ res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY);
+ } else {
+ res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY);
+ }
+ }
+
+ return res;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) {
+ if (!rect) {
+ return false;
+ }
+
+ float ratioX = scaleX / 100.0f;
+ float ratioY = scaleY / 100.0f;
+
+ BasePlatform::setRect(rect,
+ (int)(x - _hotspotX * ratioX),
+ (int)(y - _hotspotY * ratioY),
+ (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX),
+ (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY));
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool complete) {
+ if (complete) {
+ buffer->putTextIndent(indent, "SUBFRAME {\n");
+ }
+
+ if (_surface && _surface->getFileNameStr() != "") {
+ buffer->putTextIndent(indent + 2, "IMAGE = \"%s\"\n", _surface->getFileName());
+ }
+
+ if (_transparent != 0xFFFF00FF) {
+ buffer->putTextIndent(indent + 2, "TRANSPARENT { %d,%d,%d }\n", RGBCOLGetR(_transparent), RGBCOLGetG(_transparent), RGBCOLGetB(_transparent));
+ }
+
+ Rect32 rect;
+ BasePlatform::setRectEmpty(&rect);
+ if (_surface) {
+ BasePlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight());
+ }
+ if (!(rect == getRect())) {
+ buffer->putTextIndent(indent + 2, "RECT { %d,%d,%d,%d }\n", getRect().left, getRect().top, getRect().right, getRect().bottom);
+ }
+
+ if (_hotspotX != 0 || _hotspotY != 0) {
+ buffer->putTextIndent(indent + 2, "HOTSPOT {%d, %d}\n", _hotspotX, _hotspotY);
+ }
+
+ if (_alpha != 0xFFFFFFFF) {
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alpha), RGBCOLGetG(_alpha), RGBCOLGetB(_alpha));
+ buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alpha));
+ }
+
+ if (_mirrorX) {
+ buffer->putTextIndent(indent + 2, "MIRROR_X=%s\n", _mirrorX ? "TRUE" : "FALSE");
+ }
+
+ if (_mirrorY) {
+ buffer->putTextIndent(indent + 2, "MIRROR_Y=%s\n", _mirrorY ? "TRUE" : "FALSE");
+ }
+
+ if (_2DOnly) {
+ buffer->putTextIndent(indent + 2, "2D_ONLY=%s\n", _2DOnly ? "TRUE" : "FALSE");
+ }
+
+ if (_3DOnly) {
+ buffer->putTextIndent(indent + 2, "3D_ONLY=%s\n", _3DOnly ? "TRUE" : "FALSE");
+ }
+
+ if (_decoration) {
+ buffer->putTextIndent(indent + 2, "DECORATION=%s\n", _decoration ? "TRUE" : "FALSE");
+ }
+
+ if (_editorSelected) {
+ buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
+ }
+
+ BaseClass::saveAsText(buffer, indent + 2);
+
+
+ if (complete) {
+ buffer->putTextIndent(indent, "}\n\n");
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSubFrame::setDefaultRect() {
+ if (_surface) {
+ _wantsDefaultRect = true;
+ } else {
+ _wantsDefaultRect = false;
+ BasePlatform::setRectEmpty(&_rect);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::persist(BasePersistenceManager *persistMgr) {
+
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_2DOnly));
+ persistMgr->transfer(TMEMBER(_3DOnly));
+ persistMgr->transfer(TMEMBER(_alpha));
+ persistMgr->transfer(TMEMBER(_decoration));
+ persistMgr->transfer(TMEMBER(_editorSelected));
+ persistMgr->transfer(TMEMBER(_hotspotX));
+ persistMgr->transfer(TMEMBER(_hotspotY));
+ persistMgr->transfer(TMEMBER(_rect));
+ persistMgr->transfer(TMEMBER(_wantsDefaultRect));
+
+ persistMgr->transfer(TMEMBER(_surfaceFilename));
+ persistMgr->transfer(TMEMBER(_cKDefault));
+ persistMgr->transfer(TMEMBER(_cKRed));
+ persistMgr->transfer(TMEMBER(_cKGreen));
+ persistMgr->transfer(TMEMBER(_cKBlue));
+ persistMgr->transfer(TMEMBER(_lifeTime));
+
+ persistMgr->transfer(TMEMBER(_keepLoaded));
+ persistMgr->transfer(TMEMBER(_mirrorX));
+ persistMgr->transfer(TMEMBER(_mirrorY));
+ persistMgr->transfer(TMEMBER(_transparent));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetImage
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetImage") == 0) {
+ stack->correctParams(0);
+
+ if (!_surfaceFilename) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_surfaceFilename);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetImage") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (val->isNULL()) {
+ if (_surface) {
+ _gameRef->_surfaceStorage->removeSurface(_surface);
+ }
+ delete[] _surfaceFilename;
+ _surfaceFilename = NULL;
+ stack->pushBool(true);
+ } else {
+ const char *filename = val->getString();
+ if (DID_SUCCEED(setSurface(filename))) {
+ setDefaultRect();
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+ }
+
+ return STATUS_OK;
+ } else {
+ return BaseScriptable::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *BaseSubFrame::scGetProperty(const Common::String &name) {
+ if (!_scValue) {
+ _scValue = new ScValue(_gameRef);
+ }
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("subframe");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AlphaColor") {
+
+ _scValue->setInt((int)_alpha);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TransparentColor (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TransparentColor") {
+ _scValue->setInt((int)_transparent);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Is2DOnly
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Is2DOnly") {
+ _scValue->setBool(_2DOnly);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Is3DOnly
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Is3DOnly") {
+ _scValue->setBool(_3DOnly);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MirrorX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MirrorX") {
+ _scValue->setBool(_mirrorX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MirrorY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MirrorY") {
+ _scValue->setBool(_mirrorY);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Decoration
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Decoration") {
+ _scValue->setBool(_decoration);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HotspotX
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "HotspotX") {
+ _scValue->setInt(_hotspotX);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HotspotY
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "HotspotY") {
+ _scValue->setInt(_hotspotY);
+ return _scValue;
+ } else {
+ return BaseScriptable::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaColor
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "AlphaColor") == 0) {
+ _alpha = (uint32)value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Is2DOnly
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Is2DOnly") == 0) {
+ _2DOnly = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Is3DOnly
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Is3DOnly") == 0) {
+ _3DOnly = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MirrorX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MirrorX") == 0) {
+ _mirrorX = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MirrorY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MirrorY") == 0) {
+ _mirrorY = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Decoration
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Decoration") == 0) {
+ _decoration = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HotspotX
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HotspotX") == 0) {
+ _hotspotX = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HotspotY
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HotspotY") == 0) {
+ _hotspotY = value->getInt();
+ return STATUS_OK;
+ } else {
+ return BaseScriptable::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *BaseSubFrame::scToString() {
+ return "[subframe]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::setSurface(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+ if (_surface) {
+ _gameRef->_surfaceStorage->removeSurface(_surface);
+ _surface = NULL;
+ }
+
+ delete[] _surfaceFilename;
+ _surfaceFilename = NULL;
+
+ _surface = _gameRef->_surfaceStorage->addSurface(filename, defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded);
+ if (_surface) {
+ _surfaceFilename = new char[filename.size() + 1];
+ strcpy(_surfaceFilename, filename.c_str());
+
+ _cKDefault = defaultCK;
+ _cKRed = ckRed;
+ _cKGreen = ckGreen;
+ _cKBlue = ckBlue;
+ _lifeTime = lifeTime;
+ _keepLoaded = keepLoaded;
+
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSubFrame::setSurfaceSimple() {
+ if (!_surfaceFilename) {
+ _surface = NULL;
+ return STATUS_OK;
+ }
+ _surface = _gameRef->_surfaceStorage->addSurface(_surfaceFilename, _cKDefault, _cKRed, _cKGreen, _cKBlue, _lifeTime, _keepLoaded);
+ if (_surface) {
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h
new file mode 100644
index 0000000000..c173ae69d1
--- /dev/null
+++ b/engines/wintermute/base/base_sub_frame.h
@@ -0,0 +1,93 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SUBFRAME_H
+#define WINTERMUTE_BASE_SUBFRAME_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+class BaseObject;
+class BaseSurface;
+class BaseSubFrame : public BaseScriptable {
+public:
+ bool _mirrorX;
+ bool _mirrorY;
+ bool _decoration;
+ bool setSurface(const Common::String &filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false);
+ bool setSurfaceSimple();
+ DECLARE_PERSISTENT(BaseSubFrame, BaseScriptable)
+ void setDefaultRect();
+ uint32 _transparent;
+ bool saveAsText(BaseDynamicBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); }
+ bool saveAsText(BaseDynamicBuffer *buffer, int indent, bool complete);
+ bool _editorSelected;
+ BaseSubFrame(BaseGame *inGame);
+ virtual ~BaseSubFrame();
+ bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
+ bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
+ const char* getSurfaceFilename();
+
+ int _hotspotX;
+ int _hotspotY;
+ uint32 _alpha;
+ // These two setters and getters are rather usefull, as they allow _rect to be lazily defined
+ // Thus we don't need to load the actual graphics before the rect is actually needed.
+ Rect32 getRect();
+ void setRect(Rect32 rect);
+private:
+ bool _wantsDefaultRect;
+ Rect32 _rect;
+ char *_surfaceFilename;
+public:
+ bool _cKDefault;
+ byte _cKRed;
+ byte _cKGreen;
+ byte _cKBlue;
+ int _lifeTime;
+ bool _keepLoaded;
+
+ bool _2DOnly;
+ bool _3DOnly;
+
+ BaseSurface *_surface;
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp
new file mode 100644
index 0000000000..4e795ca813
--- /dev/null
+++ b/engines/wintermute/base/base_surface_storage.cpp
@@ -0,0 +1,208 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+//IMPLEMENT_PERSISTENT(BaseSurfaceStorage, true);
+
+//////////////////////////////////////////////////////////////////////
+BaseSurfaceStorage::BaseSurfaceStorage(BaseGame *inGame) : BaseClass(inGame) {
+ _lastCleanupTime = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseSurfaceStorage::~BaseSurfaceStorage() {
+ cleanup(true);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceStorage::cleanup(bool warn) {
+ for (uint32 i = 0; i < _surfaces.size(); i++) {
+ if (warn) {
+ _gameRef->LOG(0, "BaseSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->getFileName(), _surfaces[i]->_referenceCount);
+ }
+ delete _surfaces[i];
+ }
+ _surfaces.clear();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceStorage::initLoop() {
+ if (_gameRef->_smartCache && _gameRef->_liveTimer - _lastCleanupTime >= _gameRef->_surfaceGCCycleTime) {
+ _lastCleanupTime = _gameRef->_liveTimer;
+ sortSurfaces();
+ for (uint32 i = 0; i < _surfaces.size(); i++) {
+ if (_surfaces[i]->_lifeTime <= 0) {
+ break;
+ }
+
+ if (_surfaces[i]->_lifeTime > 0 && _surfaces[i]->_valid && (int)(_gameRef->_liveTimer - _surfaces[i]->_lastUsedTime) >= _surfaces[i]->_lifeTime) {
+ //_gameRef->QuickMessageForm("Invalidating: %s", _surfaces[i]->_filename);
+ _surfaces[i]->invalidate();
+ }
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSurfaceStorage::removeSurface(BaseSurface *surface) {
+ for (uint32 i = 0; i < _surfaces.size(); i++) {
+ if (_surfaces[i] == surface) {
+ _surfaces[i]->_referenceCount--;
+ if (_surfaces[i]->_referenceCount <= 0) {
+ delete _surfaces[i];
+ _surfaces.remove_at(i);
+ }
+ break;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseSurface *BaseSurfaceStorage::addSurface(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+ for (uint32 i = 0; i < _surfaces.size(); i++) {
+ if (scumm_stricmp(_surfaces[i]->getFileName(), filename.c_str()) == 0) {
+ _surfaces[i]->_referenceCount++;
+ return _surfaces[i];
+ }
+ }
+
+ if (!BaseFileManager::getEngineInstance()->hasFile(filename)) {
+ if (filename.size()) {
+ _gameRef->LOG(0, "Missing image: '%s'", filename.c_str());
+ }
+ if (_gameRef->_debugDebugMode) {
+ return addSurface("invalid_debug.bmp", defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded);
+ } else {
+ return addSurface("invalid.bmp", defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded);
+ }
+ }
+
+ BaseSurface *surface;
+ surface = _gameRef->_renderer->createSurface();
+
+ if (!surface) {
+ return NULL;
+ }
+
+ if (DID_FAIL(surface->create(filename, defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded))) {
+ delete surface;
+ return NULL;
+ } else {
+ surface->_referenceCount = 1;
+ _surfaces.push_back(surface);
+ return surface;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSurfaceStorage::restoreAll() {
+ bool ret;
+ for (uint32 i = 0; i < _surfaces.size(); i++) {
+ ret = _surfaces[i]->restore();
+ if (ret != STATUS_OK) {
+ _gameRef->LOG(0, "BaseSurfaceStorage::RestoreAll failed");
+ return ret;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+/*
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceStorage::persist(BasePersistenceManager *persistMgr)
+{
+
+ if (!persistMgr->getIsSaving()) cleanup(false);
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ //_surfaces.persist(persistMgr);
+
+ return STATUS_OK;
+}
+*/
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceStorage::sortSurfaces() {
+ Common::sort(_surfaces.begin(), _surfaces.end(), surfaceSortCB);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseSurfaceStorage::surfaceSortCB(const void *arg1, const void *arg2) {
+ const BaseSurface *s1 = *((const BaseSurface *const *)arg1);
+ const BaseSurface *s2 = *((const BaseSurface *const *)arg2);
+
+ // sort by life time
+ if (s1->_lifeTime <= 0 && s2->_lifeTime > 0) {
+ return 1;
+ } else if (s1->_lifeTime > 0 && s2->_lifeTime <= 0) {
+ return -1;
+ }
+
+
+ // sort by validity
+ if (s1->_valid && !s2->_valid) {
+ return -1;
+ } else if (!s1->_valid && s2->_valid) {
+ return 1;
+ }
+
+ // sort by time
+ else if (s1->_lastUsedTime > s2->_lastUsedTime) {
+ return 1;
+ } else if (s1->_lastUsedTime < s2->_lastUsedTime) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h
new file mode 100644
index 0000000000..aef8ad23f9
--- /dev/null
+++ b/engines/wintermute/base/base_surface_storage.h
@@ -0,0 +1,57 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SURFACE_STORAGE_H
+#define WINTERMUTE_BASE_SURFACE_STORAGE_H
+
+#include "engines/wintermute/base/base.h"
+#include "common/array.h"
+
+namespace Wintermute {
+class BaseSurface;
+class BaseSurfaceStorage : public BaseClass {
+public:
+ uint32 _lastCleanupTime;
+ bool initLoop();
+ bool sortSurfaces();
+ static int surfaceSortCB(const void *arg1, const void *arg2);
+ bool cleanup(bool warn = false);
+ //DECLARE_PERSISTENT(BaseSurfaceStorage, BaseClass);
+
+ bool restoreAll();
+ BaseSurface *addSurface(const Common::String &filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false);
+ bool removeSurface(BaseSurface *surface);
+ BaseSurfaceStorage(BaseGame *inGame);
+ virtual ~BaseSurfaceStorage();
+
+ Common::Array<BaseSurface *> _surfaces;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp
new file mode 100644
index 0000000000..7785f3d5af
--- /dev/null
+++ b/engines/wintermute/base/base_transition_manager.cpp
@@ -0,0 +1,137 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_transition_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseTransitionMgr::BaseTransitionMgr(BaseGame *inGame) : BaseClass(inGame) {
+ _state = TRANS_MGR_READY;
+ _type = TRANSITION_NONE;
+ _origInteractive = false;
+ _preserveInteractive = false;
+ _lastTime = 0;
+ _started = false;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseTransitionMgr::~BaseTransitionMgr() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseTransitionMgr::isReady() {
+ return (_state == TRANS_MGR_READY);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseTransitionMgr::start(TTransitionType type, bool nonInteractive) {
+ if (_state != TRANS_MGR_READY) {
+ return STATUS_OK;
+ }
+
+ if (type == TRANSITION_NONE || type >= NUM_TRANSITION_TYPES) {
+ _state = TRANS_MGR_READY;
+ return STATUS_OK;
+ }
+
+ if (nonInteractive) {
+ _preserveInteractive = true;
+ _origInteractive = _gameRef->_interactive;
+ _gameRef->_interactive = false;
+ } /*else _preserveInteractive */;
+
+
+ _type = type;
+ _state = TRANS_MGR_RUNNING;
+ _started = false;
+
+ return STATUS_OK;
+}
+
+#define FADE_DURATION 200
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseTransitionMgr::update() {
+ if (isReady()) {
+ return STATUS_OK;
+ }
+
+ if (!_started) {
+ _started = true;
+ _lastTime = g_system->getMillis();
+ }
+
+ switch (_type) {
+ case TRANSITION_NONE:
+ _state = TRANS_MGR_READY;
+ break;
+
+ case TRANSITION_FADE_OUT: {
+ uint32 time = g_system->getMillis() - _lastTime;
+ int alpha = (int)(255 - (float)time / (float)FADE_DURATION * 255);
+ alpha = MIN(255, MAX(alpha, 0));
+ _gameRef->_renderer->fade((uint16)alpha);
+
+ if (time > FADE_DURATION) {
+ _state = TRANS_MGR_READY;
+ }
+ }
+ break;
+
+ case TRANSITION_FADE_IN: {
+ uint32 time = g_system->getMillis() - _lastTime;
+ int alpha = (int)((float)time / (float)FADE_DURATION * 255);
+ alpha = MIN(255, MAX(alpha, 0));
+ _gameRef->_renderer->fade((uint16)alpha);
+
+ if (time > FADE_DURATION) {
+ _state = TRANS_MGR_READY;
+ }
+ }
+ break;
+ default:
+ error("BaseTransitionMgr::Update - unhandled enum NUM_TRANSITION_TYPES");
+ }
+
+ if (isReady()) {
+ if (_preserveInteractive) {
+ _gameRef->_interactive = _origInteractive;
+ }
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h
new file mode 100644
index 0000000000..d16a44c88e
--- /dev/null
+++ b/engines/wintermute/base/base_transition_manager.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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_TRANSITION_MANAGER_H
+#define WINTERMUTE_BASE_TRANSITION_MANAGER_H
+
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+class BaseTransitionMgr : public BaseClass {
+public:
+ bool _started;
+ uint32 _lastTime;
+ bool _origInteractive;
+ bool _preserveInteractive;
+ bool update();
+ bool start(TTransitionType type, bool nonInteractive = false);
+ bool isReady();
+ TTransMgrState _state;
+ BaseTransitionMgr(BaseGame *inGame);
+ virtual ~BaseTransitionMgr();
+ TTransitionType _type;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp
new file mode 100644
index 0000000000..7ec995449f
--- /dev/null
+++ b/engines/wintermute/base/base_viewport.cpp
@@ -0,0 +1,99 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseViewport, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseViewport::BaseViewport(BaseGame *inGame) : BaseClass(inGame) {
+ BasePlatform::setRectEmpty(&_rect);
+ _mainObject = NULL;
+ _offsetX = _offsetY = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseViewport::~BaseViewport() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseViewport::persist(BasePersistenceManager *persistMgr) {
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_mainObject));
+ persistMgr->transfer(TMEMBER(_offsetX));
+ persistMgr->transfer(TMEMBER(_offsetY));
+ persistMgr->transfer(TMEMBER(_rect));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseViewport::setRect(int left, int top, int right, int bottom, bool noCheck) {
+ if (!noCheck) {
+ left = MAX(left, 0);
+ top = MAX(top, 0);
+ right = MIN(right, _gameRef->_renderer->_width);
+ bottom = MIN(bottom, _gameRef->_renderer->_height);
+ }
+
+ BasePlatform::setRect(&_rect, left, top, right, bottom);
+ _offsetX = left;
+ _offsetY = top;
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+Rect32 *BaseViewport::getRect() {
+ return &_rect;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseViewport::getWidth() {
+ return _rect.right - _rect.left;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseViewport::getHeight() {
+ return _rect.bottom - _rect.top;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h
new file mode 100644
index 0000000000..98ad1c1e14
--- /dev/null
+++ b/engines/wintermute/base/base_viewport.h
@@ -0,0 +1,55 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_VIEWPORT_H
+#define WINTERMUTE_BASE_VIEWPORT_H
+
+
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+class BaseObject;
+class BaseViewport : public BaseClass {
+public:
+ int getHeight();
+ int getWidth();
+ Rect32 *getRect();
+ bool setRect(int left, int top, int right, int bottom, bool noCheck = false);
+ DECLARE_PERSISTENT(BaseViewport, BaseClass)
+ int _offsetY;
+ int _offsetX;
+ BaseObject *_mainObject;
+ BaseViewport(BaseGame *inGame = NULL);
+ virtual ~BaseViewport();
+private:
+ Rect32 _rect;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
new file mode 100644
index 0000000000..25be3dad2d
--- /dev/null
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -0,0 +1,194 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/dcgf.h"
+#include "engines/wintermute/base/file/base_disk_file.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "common/stream.h"
+#include "common/memstream.h"
+#include "common/file.h"
+#include "common/zlib.h"
+#include "common/archive.h"
+#include "common/tokenizer.h"
+#include "common/config-manager.h"
+
+namespace Wintermute {
+
+void correctSlashes(char *fileName) {
+ for (size_t i = 0; i < strlen(fileName); i++) {
+ if (fileName[i] == '\\') {
+ fileName[i] = '/';
+ }
+ }
+}
+
+// Parse a relative path in the game-folder, and if it exists, return a FSNode to it.
+static Common::FSNode getNodeForRelativePath(const Common::String &filename) {
+ // The filename can be an explicit path, thus we need to chop it up, expecting the path the game
+ // specifies to follow the Windows-convention of folder\subfolder\file (absolute paths should not happen)
+
+ // Absolute path: These should have been handled in openDiskFile.
+ if (filename.contains(':')) {
+ // So just return an invalid node.
+ return Common::FSNode();
+ }
+
+ // Relative path:
+ if (filename.contains('\\')) {
+ Common::StringTokenizer path(filename, "\\");
+
+ // Start traversing relative to the game-data-dir
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ Common::FSNode curNode = gameDataDir;
+
+ // Parse all path-elements
+ while (!path.empty()) {
+ // Get the next path-component by slicing on '\\'
+ Common::String pathPart = path.nextToken();
+ // Get the next FSNode in the chain, if it exists as a child from the previous.
+ curNode = curNode.getChild(pathPart);
+ if (!curNode.isReadable()) {
+ // Return an invalid FSNode.
+ return Common::FSNode();
+ }
+ // Following the comments in common/fs.h, anything not a directory is a file.
+ if (!curNode.isDirectory()) {
+ if (!path.empty()) {
+ error("Relative path %s reached a file before the end of the path", filename.c_str());
+ }
+ return curNode;
+ }
+ }
+ }
+ // Return an invalid FSNode to mark that we didn't find the requested file.
+ return Common::FSNode();
+}
+
+bool diskFileExists(const Common::String &filename) {
+ // Try directly from SearchMan first
+ Common::ArchiveMemberList files;
+ SearchMan.listMatchingMembers(files, filename);
+
+ for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); ++it) {
+ if ((*it)->getName() == filename) {
+ return true;
+ }
+ }
+ // File wasn't found in SearchMan, try to parse the path as a relative path.
+ Common::FSNode searchNode = getNodeForRelativePath(filename);
+ if (searchNode.exists() && !searchNode.isDirectory() && searchNode.isReadable()) {
+ return true;
+ }
+ return false;
+}
+
+Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
+ uint32 prefixSize = 0;
+ Common::SeekableReadStream *file = NULL;
+ Common::String fixedFilename = filename;
+
+ // Absolute path: TODO: Add specific fallbacks here.
+ if (filename.contains(':')) {
+ if (filename.hasPrefix("c:\\windows\\fonts\\")) { // East Side Story refers to "c:\windows\fonts\framd.ttf"
+ fixedFilename = filename.c_str() + 17;
+ } else {
+ error("openDiskFile::Absolute path or invalid filename used in %s", filename.c_str());
+ }
+ }
+ // Try directly from SearchMan first
+ Common::ArchiveMemberList files;
+ SearchMan.listMatchingMembers(files, fixedFilename);
+
+ for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); ++it) {
+ if ((*it)->getName() == filename) {
+ file = (*it)->createReadStream();
+ break;
+ }
+ }
+ // File wasn't found in SearchMan, try to parse the path as a relative path.
+ if (!file) {
+ Common::FSNode searchNode = getNodeForRelativePath(filename);
+ if (searchNode.exists() && !searchNode.isDirectory() && searchNode.isReadable()) {
+ file = searchNode.createReadStream();
+ }
+ }
+ if (file) {
+ uint32 magic1, magic2;
+ magic1 = file->readUint32LE();
+ magic2 = file->readUint32LE();
+
+ bool compressed = false;
+ if (magic1 == DCGF_MAGIC && magic2 == COMPRESSED_FILE_MAGIC) {
+ compressed = true;
+ }
+
+ if (compressed) {
+ uint32 dataOffset, compSize, uncompSize;
+ dataOffset = file->readUint32LE();
+ compSize = file->readUint32LE();
+ uncompSize = file->readUint32LE();
+
+ byte *compBuffer = new byte[compSize];
+ if (!compBuffer) {
+ error("Error allocating memory for compressed file '%s'", filename.c_str());
+ delete file;
+ return NULL;
+ }
+
+ byte *data = new byte[uncompSize];
+ if (!data) {
+ error("Error allocating buffer for file '%s'", filename.c_str());
+ delete[] compBuffer;
+ delete file;
+ return NULL;
+ }
+ file->seek(dataOffset + prefixSize, SEEK_SET);
+ file->read(compBuffer, compSize);
+
+ if (Common::uncompress(data, (unsigned long *)&uncompSize, compBuffer, compSize) != true) {
+ error("Error uncompressing file '%s'", filename.c_str());
+ delete[] compBuffer;
+ delete file;
+ return NULL;
+ }
+
+ delete[] compBuffer;
+ delete file;
+ return new Common::MemoryReadStream(data, uncompSize, DisposeAfterUse::YES);
+ } else {
+ file->seek(0, SEEK_SET);
+ return file;
+ }
+
+ return file;
+
+ }
+ return NULL;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h
new file mode 100644
index 0000000000..c9f93b80d9
--- /dev/null
+++ b/engines/wintermute/base/file/base_disk_file.h
@@ -0,0 +1,41 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_DISKFILE_H
+#define WINTERMUTE_BASE_DISKFILE_H
+
+#include "common/stream.h"
+
+namespace Wintermute {
+
+Common::SeekableReadStream *openDiskFile(const Common::String &filename);
+bool diskFileExists(const Common::String &filename);
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/base_file.cpp b/engines/wintermute/base/file/base_file.cpp
new file mode 100644
index 0000000000..f52a13211e
--- /dev/null
+++ b/engines/wintermute/base/file/base_file.cpp
@@ -0,0 +1,68 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/file/base_file.h"
+#include "common/memstream.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseFile::BaseFile() {
+ _pos = 0;
+ _size = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseFile::~BaseFile() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFile::isEOF() {
+ return _pos == _size;
+}
+
+Common::SeekableReadStream *BaseFile::getMemStream() {
+ uint32 oldPos = getPos();
+ seek(0);
+ byte *data = new byte[getSize()];
+ read(data, getSize());
+ seek(oldPos);
+ Common::MemoryReadStream *memStream = new Common::MemoryReadStream(data, getSize(), DisposeAfterUse::YES);
+ return memStream;
+}
+
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_file.h b/engines/wintermute/base/file/base_file.h
new file mode 100644
index 0000000000..82f6ce3554
--- /dev/null
+++ b/engines/wintermute/base/file/base_file.h
@@ -0,0 +1,67 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FILE_H
+#define WINTERMUTE_BASE_FILE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "common/str.h"
+#include "common/stream.h"
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Wintermute {
+
+class BaseFile {
+protected:
+ uint32 _pos;
+ uint32 _size;
+public:
+ virtual uint32 getSize() {
+ return _size;
+ };
+ virtual uint32 getPos() {
+ return _pos;
+ };
+ virtual bool seek(uint32 pos, int whence = SEEK_SET) = 0;
+ virtual bool read(void *buffer, uint32 size) = 0;
+ virtual bool close() = 0;
+ virtual bool open(const Common::String &filename) = 0;
+ virtual bool isEOF();
+ BaseFile();
+ virtual ~BaseFile();
+ // Temporary solution to allow usage in ScummVM-code:
+ virtual Common::SeekableReadStream *getMemStream();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp
new file mode 100644
index 0000000000..b9805d78dd
--- /dev/null
+++ b/engines/wintermute/base/file/base_file_entry.cpp
@@ -0,0 +1,73 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/file/base_file_entry.h"
+#include "engines/wintermute/base/file/base_package.h"
+#include "common/stream.h"
+#include "common/substream.h"
+#include "common/zlib.h"
+
+namespace Wintermute {
+
+Common::SeekableReadStream *BaseFileEntry::createReadStream() const {
+ Common::SeekableReadStream *file = _package->getFilePointer();
+ if (!file) {
+ return NULL;
+ }
+
+ bool compressed = (_compressedLength != 0);
+
+ if (compressed) {
+ file = Common::wrapCompressedReadStream(new Common::SeekableSubReadStream(file, _offset, _offset + _length, DisposeAfterUse::YES), _length); //
+ } else {
+ file = new Common::SeekableSubReadStream(file, _offset, _offset + _length, DisposeAfterUse::YES);
+ }
+
+ file->seek(0);
+
+ return file;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseFileEntry::BaseFileEntry() {
+ _package = NULL;
+ _length = _compressedLength = _offset = _flags = 0;
+ _filename = "";
+
+ _timeDate1 = _timeDate2 = 0;
+
+ _journalTime = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseFileEntry::~BaseFileEntry() {
+ _package = NULL; // ref only
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_file_entry.h b/engines/wintermute/base/file/base_file_entry.h
new file mode 100644
index 0000000000..6e4823d994
--- /dev/null
+++ b/engines/wintermute/base/file/base_file_entry.h
@@ -0,0 +1,60 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FILEENTRY_H
+#define WINTERMUTE_BASE_FILEENTRY_H
+
+#include "common/archive.h"
+#include "common/str.h"
+#include "common/stream.h"
+
+namespace Wintermute {
+
+class BasePackage;
+
+class BaseFileEntry : public Common::ArchiveMember {
+public:
+ virtual Common::SeekableReadStream *createReadStream() const;
+ virtual Common::String getName() const { return _filename; }
+ uint32 _timeDate2;
+ uint32 _timeDate1;
+ uint32 _flags;
+ uint32 _journalTime;
+ Common::String _filename;
+ uint32 _compressedLength;
+ uint32 _length;
+ uint32 _offset;
+ BasePackage *_package;
+ BaseFileEntry();
+ virtual ~BaseFileEntry();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp
new file mode 100644
index 0000000000..51a1558a7c
--- /dev/null
+++ b/engines/wintermute/base/file/base_package.cpp
@@ -0,0 +1,276 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/file/base_package.h"
+#include "engines/wintermute/base/file/base_file_entry.h"
+#include "engines/wintermute/base/file/dcpackage.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/file.h"
+#include "common/stream.h"
+#include "common/debug.h"
+
+namespace Wintermute {
+
+BasePackage::BasePackage() {
+ _name = "";
+ _cd = 0;
+ _priority = 0;
+ _boundToExe = false;
+}
+
+Common::SeekableReadStream *BasePackage::getFilePointer() {
+ Common::SeekableReadStream *stream = _fsnode.createReadStream();
+
+ return stream;
+}
+
+static bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset) {
+ byte buf[32768];
+
+ byte signature[8];
+ ((uint32 *)signature)[0] = PACKAGE_MAGIC_1;
+ ((uint32 *)signature)[1] = PACKAGE_MAGIC_2;
+
+ uint32 fileSize = (uint32)f->size();
+ uint32 startPos = 1024 * 1024;
+ uint32 bytesRead = startPos;
+
+ while (bytesRead < fileSize - 16) {
+ uint32 toRead = MIN((unsigned int)32768, fileSize - bytesRead);
+ f->seek((int32)startPos, SEEK_SET);
+ uint32 actuallyRead = f->read(buf, toRead);
+ if (actuallyRead != toRead) {
+ return false;
+ }
+
+ for (uint32 i = 0; i < toRead - 8; i++)
+ if (!memcmp(buf + i, signature, 8)) {
+ *offset = startPos + i;
+ return true;
+ }
+
+ bytesRead = bytesRead + toRead - 16;
+ startPos = startPos + toRead - 16;
+
+ }
+ return false;
+
+}
+
+void TPackageHeader::readFromStream(Common::ReadStream *stream) {
+ _magic1 = stream->readUint32LE();
+ _magic2 = stream->readUint32LE();
+ _packageVersion = stream->readUint32LE();
+
+ _gameVersion = stream->readUint32LE();
+
+ _priority = stream->readByte();
+ _cd = stream->readByte();
+ _masterIndex = stream->readByte();
+ stream->readByte(); // To align the next byte...
+
+ _creationTime = stream->readUint32LE();
+
+ stream->read(_desc, 100);
+ _numDirs = stream->readUint32LE();
+}
+
+PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool searchSignature) {
+ uint32 absoluteOffset = 0;
+ _priority = 0;
+ bool boundToExe = false;
+ Common::SeekableReadStream *stream = file.createReadStream();
+ if (!stream) {
+ return;
+ }
+ if (searchSignature) {
+ uint32 offset;
+ if (!findPackageSignature(stream, &offset)) {
+ delete stream;
+ return;
+ } else {
+ stream->seek(offset, SEEK_SET);
+ absoluteOffset = offset;
+ boundToExe = true;
+ }
+ }
+
+ TPackageHeader hdr;
+ hdr.readFromStream(stream);
+ if (hdr._magic1 != PACKAGE_MAGIC_1 || hdr._magic2 != PACKAGE_MAGIC_2 || hdr._packageVersion > PACKAGE_VERSION) {
+ debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, " Invalid header in package file '%s'. Ignoring.", filename.c_str());
+ delete stream;
+ return;
+ }
+
+ if (hdr._packageVersion != PACKAGE_VERSION) {
+ debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, " Warning: package file '%s' is outdated.", filename.c_str());
+ }
+ _priority = hdr._priority;
+ // new in v2
+ if (hdr._packageVersion == PACKAGE_VERSION) {
+ uint32 dirOffset;
+ dirOffset = stream->readUint32LE();
+ dirOffset += absoluteOffset;
+ stream->seek(dirOffset, SEEK_SET);
+ }
+ assert(hdr._numDirs == 1);
+ for (uint32 i = 0; i < hdr._numDirs; i++) {
+ BasePackage *pkg = new BasePackage();
+ if (!pkg) {
+ return;
+ }
+ pkg->_fsnode = file;
+
+ pkg->_boundToExe = boundToExe;
+
+ // read package info
+ byte nameLength = stream->readByte();
+ char *pkgName = new char[nameLength];
+ stream->read(pkgName, nameLength);
+ pkg->_name = pkgName;
+ pkg->_cd = stream->readByte();
+ pkg->_priority = hdr._priority;
+ delete[] pkgName;
+ pkgName = NULL;
+
+ if (!hdr._masterIndex) {
+ pkg->_cd = 0; // override CD to fixed disk
+ }
+ _packages.push_back(pkg);
+
+ // read file entries
+ uint32 numFiles = stream->readUint32LE();
+
+ for (uint32 j = 0; j < numFiles; j++) {
+ char *name;
+ uint32 offset, length, compLength, flags;/*, timeDate1, timeDate2;*/
+
+ nameLength = stream->readByte();
+ name = new char[nameLength];
+ stream->read(name, nameLength);
+
+ // v2 - xor name
+ if (hdr._packageVersion == PACKAGE_VERSION) {
+ for (int k = 0; k < nameLength; k++) {
+ ((byte *)name)[k] ^= 'D';
+ }
+ }
+ debugC(kWintermuteDebugFileAccess, "Package contains %s", name);
+
+ Common::String upcName = name;
+ upcName.toUppercase();
+ delete[] name;
+ name = NULL;
+
+ offset = stream->readUint32LE();
+ offset += absoluteOffset;
+ length = stream->readUint32LE();
+ compLength = stream->readUint32LE();
+ flags = stream->readUint32LE();
+
+ if (hdr._packageVersion == PACKAGE_VERSION) {
+ /* timeDate1 = */ stream->readUint32LE();
+ /* timeDate2 = */ stream->readUint32LE();
+ }
+ _filesIter = _files.find(upcName);
+ if (_filesIter == _files.end()) {
+ BaseFileEntry *fileEntry = new BaseFileEntry();
+ fileEntry->_package = pkg;
+ fileEntry->_offset = offset;
+ fileEntry->_length = length;
+ fileEntry->_compressedLength = compLength;
+ fileEntry->_flags = flags;
+
+ _files[upcName] = Common::ArchiveMemberPtr(fileEntry);
+ } else {
+ // current package has higher priority than the registered
+ // TODO: This cast might be a bit ugly.
+ BaseFileEntry *filePtr = (BaseFileEntry *) &*(_filesIter->_value);
+ if (pkg->_priority > filePtr->_package->_priority) {
+ filePtr->_package = pkg;
+ filePtr->_offset = offset;
+ filePtr->_length = length;
+ filePtr->_compressedLength = compLength;
+ filePtr->_flags = flags;
+ }
+ }
+ }
+ }
+ debugC(kWintermuteDebugFileAccess, " Registered %d files in %d package(s)", _files.size(), _packages.size());
+
+ delete stream;
+}
+
+PackageSet::~PackageSet() {
+ for (Common::Array<BasePackage *>::iterator it = _packages.begin(); it != _packages.end(); ++it) {
+ delete *it;
+ }
+ _packages.clear();
+}
+
+bool PackageSet::hasFile(const Common::String &name) const {
+ Common::String upcName = name;
+ upcName.toUppercase();
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it;
+ it = _files.find(upcName.c_str());
+ return (it != _files.end());
+}
+
+int PackageSet::listMembers(Common::ArchiveMemberList &list) const {
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it = _files.begin();
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator end = _files.end();
+ int count = 0;
+ for (; it != end; ++it) {
+ const Common::ArchiveMemberPtr ptr(it->_value);
+ list.push_back(ptr);
+ count++;
+ }
+ return count;
+}
+
+const Common::ArchiveMemberPtr PackageSet::getMember(const Common::String &name) const {
+ Common::String upcName = name;
+ upcName.toUppercase();
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it;
+ it = _files.find(upcName.c_str());
+ return Common::ArchiveMemberPtr(it->_value);
+}
+
+Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common::String &name) const {
+ Common::String upcName = name;
+ upcName.toUppercase();
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it;
+ it = _files.find(upcName.c_str());
+ if (it != _files.end()) {
+ return it->_value->createReadStream();
+ }
+ return NULL;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h
new file mode 100644
index 0000000000..2882eb03b7
--- /dev/null
+++ b/engines/wintermute/base/file/base_package.h
@@ -0,0 +1,90 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_PACKAGE_H
+#define WINTERMUTE_BASE_PACKAGE_H
+
+#include "common/archive.h"
+#include "common/stream.h"
+#include "common/fs.h"
+
+namespace Wintermute {
+class BasePackage {
+public:
+ Common::SeekableReadStream *getFilePointer();
+ Common::FSNode _fsnode;
+ bool _boundToExe;
+ byte _priority;
+ Common::String _name;
+ int _cd;
+ BasePackage();
+};
+
+class PackageSet : public Common::Archive {
+public:
+ virtual ~PackageSet();
+
+ PackageSet(Common::FSNode package, const Common::String &filename = "", bool searchSignature = false);
+ /**
+ * Check if a member with the given name is present in the Archive.
+ * Patterns are not allowed, as this is meant to be a quick File::exists()
+ * replacement.
+ */
+ virtual bool hasFile(const Common::String &name) const;
+
+ /**
+ * Add all members of the Archive to list.
+ * Must only append to list, and not remove elements from it.
+ *
+ * @return the number of names added to list
+ */
+ virtual int listMembers(Common::ArchiveMemberList &list) const;
+
+ /**
+ * Returns a ArchiveMember representation of the given file.
+ */
+ virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
+
+ /**
+ * Create a stream bound to a member with the specified name in the
+ * archive. If no member with this name exists, 0 is returned.
+ * @return the newly created input stream
+ */
+ virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
+
+ int getPriority() const { return _priority; }
+private:
+ byte _priority;
+ Common::Array<BasePackage *> _packages;
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr> _files;
+ Common::HashMap<Common::String, Common::ArchiveMemberPtr>::iterator _filesIter;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/base_resources.cpp b/engines/wintermute/base/file/base_resources.cpp
new file mode 100644
index 0000000000..0b32cb0c4f
--- /dev/null
+++ b/engines/wintermute/base/file/base_resources.cpp
@@ -0,0 +1,2830 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/file/base_resources.h"
+#include "common/str.h"
+#include "common/memstream.h"
+
+namespace Wintermute {
+
+unsigned char invalid[] = {
+ 0x42, 0x4d, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x04, 0x00, 0x00, 0x28, 0x00,
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x4e, 0x00, 0x00, 0x20, 0x4e, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+} ;
+
+unsigned char invaliddebug[] = {
+ 0x42, 0x4d, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x04, 0x00, 0x00, 0x28, 0x00,
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80,
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80,
+ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0x00, 0xc0, 0xdc, 0xc0, 0x00, 0xf0, 0xca, 0xa6, 0x00, 0x00, 0x20,
+ 0x40, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00, 0x20, 0x80, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x00, 0x20,
+ 0xc0, 0x00, 0x00, 0x20, 0xe0, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x40,
+ 0x40, 0x00, 0x00, 0x40, 0x60, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x40,
+ 0xc0, 0x00, 0x00, 0x40, 0xe0, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x60,
+ 0x40, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x80, 0x00, 0x00, 0x60, 0xa0, 0x00, 0x00, 0x60,
+ 0xc0, 0x00, 0x00, 0x60, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0x80,
+ 0x40, 0x00, 0x00, 0x80, 0x60, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0xa0, 0x00, 0x00, 0x80,
+ 0xc0, 0x00, 0x00, 0x80, 0xe0, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x20, 0x00, 0x00, 0xa0,
+ 0x40, 0x00, 0x00, 0xa0, 0x60, 0x00, 0x00, 0xa0, 0x80, 0x00, 0x00, 0xa0, 0xa0, 0x00, 0x00, 0xa0,
+ 0xc0, 0x00, 0x00, 0xa0, 0xe0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0xc0,
+ 0x40, 0x00, 0x00, 0xc0, 0x60, 0x00, 0x00, 0xc0, 0x80, 0x00, 0x00, 0xc0, 0xa0, 0x00, 0x00, 0xc0,
+ 0xc0, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x20, 0x00, 0x00, 0xe0,
+ 0x40, 0x00, 0x00, 0xe0, 0x60, 0x00, 0x00, 0xe0, 0x80, 0x00, 0x00, 0xe0, 0xa0, 0x00, 0x00, 0xe0,
+ 0xc0, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x40, 0x00,
+ 0x40, 0x00, 0x40, 0x00, 0x60, 0x00, 0x40, 0x00, 0x80, 0x00, 0x40, 0x00, 0xa0, 0x00, 0x40, 0x00,
+ 0xc0, 0x00, 0x40, 0x00, 0xe0, 0x00, 0x40, 0x20, 0x00, 0x00, 0x40, 0x20, 0x20, 0x00, 0x40, 0x20,
+ 0x40, 0x00, 0x40, 0x20, 0x60, 0x00, 0x40, 0x20, 0x80, 0x00, 0x40, 0x20, 0xa0, 0x00, 0x40, 0x20,
+ 0xc0, 0x00, 0x40, 0x20, 0xe0, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x20, 0x00, 0x40, 0x40,
+ 0x40, 0x00, 0x40, 0x40, 0x60, 0x00, 0x40, 0x40, 0x80, 0x00, 0x40, 0x40, 0xa0, 0x00, 0x40, 0x40,
+ 0xc0, 0x00, 0x40, 0x40, 0xe0, 0x00, 0x40, 0x60, 0x00, 0x00, 0x40, 0x60, 0x20, 0x00, 0x40, 0x60,
+ 0x40, 0x00, 0x40, 0x60, 0x60, 0x00, 0x40, 0x60, 0x80, 0x00, 0x40, 0x60, 0xa0, 0x00, 0x40, 0x60,
+ 0xc0, 0x00, 0x40, 0x60, 0xe0, 0x00, 0x40, 0x80, 0x00, 0x00, 0x40, 0x80, 0x20, 0x00, 0x40, 0x80,
+ 0x40, 0x00, 0x40, 0x80, 0x60, 0x00, 0x40, 0x80, 0x80, 0x00, 0x40, 0x80, 0xa0, 0x00, 0x40, 0x80,
+ 0xc0, 0x00, 0x40, 0x80, 0xe0, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x40, 0xa0, 0x20, 0x00, 0x40, 0xa0,
+ 0x40, 0x00, 0x40, 0xa0, 0x60, 0x00, 0x40, 0xa0, 0x80, 0x00, 0x40, 0xa0, 0xa0, 0x00, 0x40, 0xa0,
+ 0xc0, 0x00, 0x40, 0xa0, 0xe0, 0x00, 0x40, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x20, 0x00, 0x40, 0xc0,
+ 0x40, 0x00, 0x40, 0xc0, 0x60, 0x00, 0x40, 0xc0, 0x80, 0x00, 0x40, 0xc0, 0xa0, 0x00, 0x40, 0xc0,
+ 0xc0, 0x00, 0x40, 0xc0, 0xe0, 0x00, 0x40, 0xe0, 0x00, 0x00, 0x40, 0xe0, 0x20, 0x00, 0x40, 0xe0,
+ 0x40, 0x00, 0x40, 0xe0, 0x60, 0x00, 0x40, 0xe0, 0x80, 0x00, 0x40, 0xe0, 0xa0, 0x00, 0x40, 0xe0,
+ 0xc0, 0x00, 0x40, 0xe0, 0xe0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00, 0x80, 0x00,
+ 0x40, 0x00, 0x80, 0x00, 0x60, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xa0, 0x00, 0x80, 0x00,
+ 0xc0, 0x00, 0x80, 0x00, 0xe0, 0x00, 0x80, 0x20, 0x00, 0x00, 0x80, 0x20, 0x20, 0x00, 0x80, 0x20,
+ 0x40, 0x00, 0x80, 0x20, 0x60, 0x00, 0x80, 0x20, 0x80, 0x00, 0x80, 0x20, 0xa0, 0x00, 0x80, 0x20,
+ 0xc0, 0x00, 0x80, 0x20, 0xe0, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x20, 0x00, 0x80, 0x40,
+ 0x40, 0x00, 0x80, 0x40, 0x60, 0x00, 0x80, 0x40, 0x80, 0x00, 0x80, 0x40, 0xa0, 0x00, 0x80, 0x40,
+ 0xc0, 0x00, 0x80, 0x40, 0xe0, 0x00, 0x80, 0x60, 0x00, 0x00, 0x80, 0x60, 0x20, 0x00, 0x80, 0x60,
+ 0x40, 0x00, 0x80, 0x60, 0x60, 0x00, 0x80, 0x60, 0x80, 0x00, 0x80, 0x60, 0xa0, 0x00, 0x80, 0x60,
+ 0xc0, 0x00, 0x80, 0x60, 0xe0, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x20, 0x00, 0x80, 0x80,
+ 0x40, 0x00, 0x80, 0x80, 0x60, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0xa0, 0x00, 0x80, 0x80,
+ 0xc0, 0x00, 0x80, 0x80, 0xe0, 0x00, 0x80, 0xa0, 0x00, 0x00, 0x80, 0xa0, 0x20, 0x00, 0x80, 0xa0,
+ 0x40, 0x00, 0x80, 0xa0, 0x60, 0x00, 0x80, 0xa0, 0x80, 0x00, 0x80, 0xa0, 0xa0, 0x00, 0x80, 0xa0,
+ 0xc0, 0x00, 0x80, 0xa0, 0xe0, 0x00, 0x80, 0xc0, 0x00, 0x00, 0x80, 0xc0, 0x20, 0x00, 0x80, 0xc0,
+ 0x40, 0x00, 0x80, 0xc0, 0x60, 0x00, 0x80, 0xc0, 0x80, 0x00, 0x80, 0xc0, 0xa0, 0x00, 0x80, 0xc0,
+ 0xc0, 0x00, 0x80, 0xc0, 0xe0, 0x00, 0x80, 0xe0, 0x00, 0x00, 0x80, 0xe0, 0x20, 0x00, 0x80, 0xe0,
+ 0x40, 0x00, 0x80, 0xe0, 0x60, 0x00, 0x80, 0xe0, 0x80, 0x00, 0x80, 0xe0, 0xa0, 0x00, 0x80, 0xe0,
+ 0xc0, 0x00, 0x80, 0xe0, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x20, 0x00, 0xc0, 0x00,
+ 0x40, 0x00, 0xc0, 0x00, 0x60, 0x00, 0xc0, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xa0, 0x00, 0xc0, 0x00,
+ 0xc0, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xc0, 0x20, 0x00, 0x00, 0xc0, 0x20, 0x20, 0x00, 0xc0, 0x20,
+ 0x40, 0x00, 0xc0, 0x20, 0x60, 0x00, 0xc0, 0x20, 0x80, 0x00, 0xc0, 0x20, 0xa0, 0x00, 0xc0, 0x20,
+ 0xc0, 0x00, 0xc0, 0x20, 0xe0, 0x00, 0xc0, 0x40, 0x00, 0x00, 0xc0, 0x40, 0x20, 0x00, 0xc0, 0x40,
+ 0x40, 0x00, 0xc0, 0x40, 0x60, 0x00, 0xc0, 0x40, 0x80, 0x00, 0xc0, 0x40, 0xa0, 0x00, 0xc0, 0x40,
+ 0xc0, 0x00, 0xc0, 0x40, 0xe0, 0x00, 0xc0, 0x60, 0x00, 0x00, 0xc0, 0x60, 0x20, 0x00, 0xc0, 0x60,
+ 0x40, 0x00, 0xc0, 0x60, 0x60, 0x00, 0xc0, 0x60, 0x80, 0x00, 0xc0, 0x60, 0xa0, 0x00, 0xc0, 0x60,
+ 0xc0, 0x00, 0xc0, 0x60, 0xe0, 0x00, 0xc0, 0x80, 0x00, 0x00, 0xc0, 0x80, 0x20, 0x00, 0xc0, 0x80,
+ 0x40, 0x00, 0xc0, 0x80, 0x60, 0x00, 0xc0, 0x80, 0x80, 0x00, 0xc0, 0x80, 0xa0, 0x00, 0xc0, 0x80,
+ 0xc0, 0x00, 0xc0, 0x80, 0xe0, 0x00, 0xc0, 0xa0, 0x00, 0x00, 0xc0, 0xa0, 0x20, 0x00, 0xc0, 0xa0,
+ 0x40, 0x00, 0xc0, 0xa0, 0x60, 0x00, 0xc0, 0xa0, 0x80, 0x00, 0xc0, 0xa0, 0xa0, 0x00, 0xc0, 0xa0,
+ 0xc0, 0x00, 0xc0, 0xa0, 0xe0, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0x20, 0x00, 0xc0, 0xc0,
+ 0x40, 0x00, 0xc0, 0xc0, 0x60, 0x00, 0xc0, 0xc0, 0x80, 0x00, 0xc0, 0xc0, 0xa0, 0x00, 0xf0, 0xfb,
+ 0xff, 0x00, 0xa4, 0xa0, 0xa0, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xff,
+ 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0xf9,
+ 0xf9, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0xf9, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0xf9, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
+ 0xf9, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0xf9, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xf9,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9
+} ;
+
+unsigned char systemfont[] = {
+ 0x42, 0x4d, 0x36, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x04, 0x00, 0x00, 0x28, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x70, 0x0b, 0x00, 0x00, 0x70, 0x0b, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x80, 0x80,
+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x01, 0x00, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x01, 0x00, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00,
+ 0x01, 0x02, 0x02, 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00,
+ 0x02, 0x00, 0x01, 0x02, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x00, 0x02, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0x00, 0x01, 0x02, 0x00, 0x02, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00,
+ 0x02, 0x01, 0x00, 0x02, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x01, 0x02, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00,
+ 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x01, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x00,
+ 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02,
+ 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x01, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x00, 0x01, 0x02, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x01,
+ 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x00, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x02, 0x00, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02,
+ 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
+} ;
+
+Common::SeekableReadStream *BaseResources::getFile(const Common::String &filename) {
+ if (scumm_stricmp(filename.c_str(), "invalid.bmp") == 0) {
+ return new Common::MemoryReadStream(invalid, sizeof(invalid), DisposeAfterUse::NO);
+ } else if (scumm_stricmp(filename.c_str(), "invalid_debug.bmp") == 0) {
+ return new Common::MemoryReadStream(invaliddebug, sizeof(invalid), DisposeAfterUse::NO);
+ } else if (scumm_stricmp(filename.c_str(), "syste_font.bmp") == 0) {
+ return new Common::MemoryReadStream(systemfont, sizeof(invalid), DisposeAfterUse::NO);
+ }
+ return NULL;
+}
+
+bool BaseResources::hasFile(const Common::String &filename) {
+ if (scumm_stricmp(filename.c_str(), "invalid.bmp") == 0) {
+ return true;
+ } else if (scumm_stricmp(filename.c_str(), "invalid_debug.bmp") == 0) {
+ return true;
+ } else if (scumm_stricmp(filename.c_str(), "syste_font.bmp") == 0) {
+ return true;
+ }
+ return false;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_resources.h b/engines/wintermute/base/file/base_resources.h
new file mode 100644
index 0000000000..91c30bcfa7
--- /dev/null
+++ b/engines/wintermute/base/file/base_resources.h
@@ -0,0 +1,45 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_RESOURCES_H
+#define WINTERMUTE_BASE_RESOURCES_H
+
+#include "common/stream.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+class BaseResources {
+public:
+ static Common::SeekableReadStream *getFile(const Common::String &filename);
+ static bool hasFile(const Common::String &filename);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp
new file mode 100644
index 0000000000..94d3e5a94e
--- /dev/null
+++ b/engines/wintermute/base/file/base_save_thumb_file.cpp
@@ -0,0 +1,153 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_persistence_manager.h"
+#include "engines/wintermute/base/file/base_save_thumb_file.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSaveThumbFile::BaseSaveThumbFile() {
+ _data = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSaveThumbFile::~BaseSaveThumbFile() {
+ close();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSaveThumbFile::open(const Common::String &filename) {
+ close();
+
+ if (scumm_strnicmp(filename.c_str(), "savegame:", 9) != 0) {
+ return STATUS_FAILED;
+ }
+
+ char *tempFilename = new char[strlen(filename.c_str()) - 8];
+ strcpy(tempFilename, filename.c_str() + 9);
+ for (uint32 i = 0; i < strlen(tempFilename); i++) {
+ if (tempFilename[i] < '0' || tempFilename[i] > '9') {
+ tempFilename[i] = '\0';
+ break;
+ }
+ }
+
+ // get slot number from name
+ int slot = atoi(tempFilename);
+ delete[] tempFilename;
+
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ Common::String slotFilename = pm->getFilenameForSlot(slot);
+ if (!pm) {
+ return STATUS_FAILED;
+ }
+
+ if (DID_FAIL(pm->initLoad(slotFilename))) {
+ delete pm;
+ return STATUS_FAILED;
+ }
+
+ bool res;
+
+ if (pm->_thumbnailDataSize != 0) {
+ _data = new byte[pm->_thumbnailDataSize];
+ memcpy(_data, pm->_thumbnailData, pm->_thumbnailDataSize);
+ _size = pm->_thumbnailDataSize;
+ res = STATUS_OK;
+ } else {
+ res = STATUS_FAILED;
+ }
+ delete pm;
+
+ return res;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSaveThumbFile::close() {
+ delete[] _data;
+ _data = NULL;
+
+ _pos = 0;
+ _size = 0;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSaveThumbFile::read(void *buffer, uint32 size) {
+ if (!_data || _pos + size > _size) {
+ return STATUS_FAILED;
+ }
+
+ memcpy(buffer, (byte *)_data + _pos, size);
+ _pos += size;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSaveThumbFile::seek(uint32 pos, int whence) {
+ if (!_data) {
+ return STATUS_FAILED;
+ }
+
+ uint32 newPos = 0;
+
+ switch (whence) {
+ case SEEK_SET:
+ newPos = pos;
+ break;
+ case SEEK_END:
+ newPos = _size + pos;
+ break;
+ case SEEK_CUR:
+ newPos = _pos + pos;
+ break;
+ }
+
+ if (newPos > _size) {
+ return STATUS_FAILED;
+ } else {
+ _pos = newPos;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_save_thumb_file.h b/engines/wintermute/base/file/base_save_thumb_file.h
new file mode 100644
index 0000000000..3b217525fd
--- /dev/null
+++ b/engines/wintermute/base/file/base_save_thumb_file.h
@@ -0,0 +1,52 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SAVETHUMBFILE_H
+#define WINTERMUTE_BASE_SAVETHUMBFILE_H
+
+
+#include "engines/wintermute/base/file/base_file.h"
+
+namespace Wintermute {
+
+//TODO: Get rid of this
+class BaseSaveThumbFile : public BaseFile {
+public:
+ BaseSaveThumbFile();
+ virtual ~BaseSaveThumbFile();
+ virtual bool seek(uint32 pos, int whence = SEEK_SET);
+ virtual bool read(void *buffer, uint32 size);
+ virtual bool close();
+ virtual bool open(const Common::String &filename);
+private:
+ byte *_data;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/file/dcpackage.h b/engines/wintermute/base/file/dcpackage.h
new file mode 100644
index 0000000000..2234139408
--- /dev/null
+++ b/engines/wintermute/base/file/dcpackage.h
@@ -0,0 +1,80 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef _DCPACKAGE_H_
+#define _DCPACKAGE_H_
+
+
+#define PACKAGE_MAGIC_1 0xDEC0ADDE
+#define PACKAGE_MAGIC_2 0x4B4E554A // "JUNK"
+#define PACKAGE_VERSION 0x00000200
+#define PACKAGE_EXTENSION "dcp"
+
+#include "common/stream.h"
+
+namespace Wintermute {
+
+struct TPackageHeader {
+ uint32 _magic1;
+ uint32 _magic2;
+ uint32 _packageVersion;
+ uint32 _gameVersion;
+ byte _priority;
+ byte _cd;
+ bool _masterIndex;
+ uint32 _creationTime;
+ char _desc[100];
+ uint32 _numDirs;
+ // base_package.cpp:
+ void readFromStream(Common::ReadStream *stream);
+};
+
+/*
+v2: uint32 DirOffset
+
+
+Dir: byte NameLength
+ char Name [NameLength]
+ byte CD;
+ uint32 NumEntries
+
+
+Entry: byte NameLength
+ char Name [NameLength]
+ uint32 Offset
+ uint32 Length
+ uint32 CompLength
+ uint32 Flags
+v2: uint32 TimeDate1
+ uint32 TimeDate2 // not used
+
+*/
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp
new file mode 100644
index 0000000000..87dd3da5a3
--- /dev/null
+++ b/engines/wintermute/base/font/base_font.cpp
@@ -0,0 +1,140 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/font/base_font_bitmap.h"
+#include "engines/wintermute/base/font/base_font_truetype.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_file_manager.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(BaseFont, false)
+
+//////////////////////////////////////////////////////////////////////
+BaseFont::BaseFont(BaseGame *inGame) : BaseObject(inGame) {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseFont::~BaseFont() {
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseFont::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseFont::getTextHeight(byte *text, int width) {
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseFont::getTextWidth(byte *text, int maxLength) {
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseFont::getLetterHeight() {
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFont::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseFont *BaseFont::createFromFile(BaseGame *gameRef, const Common::String &filename) {
+ if (isTrueType(gameRef, filename)) {
+ BaseFontTT *font = new BaseFontTT(gameRef);
+ if (font) {
+ if (DID_FAIL(font->loadFile(filename))) {
+ delete font;
+ return NULL;
+ }
+ }
+ return font;
+ } else {
+ BaseFontBitmap *font = new BaseFontBitmap(gameRef);
+ if (font) {
+ if (DID_FAIL(font->loadFile(filename))) {
+ delete font;
+ return NULL;
+ }
+ }
+ return font;
+ }
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(FONT)
+TOKEN_DEF(TTFONT)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool BaseFont::isTrueType(BaseGame *gameRef, const Common::String &filename) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(TTFONT)
+ TOKEN_TABLE_END
+
+
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ return false;
+ }
+
+ byte *workBuffer = buffer;
+
+ char *params;
+ BaseParser parser;
+
+ bool ret = false;
+ if (parser.getCommand((char **)&workBuffer, commands, (char **)&params) == TOKEN_TTFONT) {
+ ret = true;
+ }
+
+ delete[] buffer;
+ return ret;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font.h b/engines/wintermute/base/font/base_font.h
new file mode 100644
index 0000000000..0abe62ab98
--- /dev/null
+++ b/engines/wintermute/base/font/base_font.h
@@ -0,0 +1,61 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FONT_H
+#define WINTERMUTE_BASE_FONT_H
+
+#include "engines/wintermute/base/base_object.h"
+
+#define NUM_CHARACTERS 256
+
+namespace Wintermute {
+
+class BaseFont: public BaseObject {
+public:
+ DECLARE_PERSISTENT(BaseFont, BaseObject)
+ virtual int getTextWidth(byte *text, int maxLength = -1);
+ virtual int getTextHeight(byte *text, int width);
+ virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
+ virtual int getLetterHeight();
+
+ virtual void initLoop() {}
+ virtual void afterLoad() {}
+ BaseFont(BaseGame *inGame);
+ virtual ~BaseFont();
+
+ static BaseFont *createFromFile(BaseGame *game, const Common::String &filename);
+
+private:
+ //bool loadBuffer(byte * Buffer);
+ //bool loadFile(const char* Filename);
+ static bool isTrueType(BaseGame *game, const Common::String &filename);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp
new file mode 100644
index 0000000000..55f46c476b
--- /dev/null
+++ b/engines/wintermute/base/font/base_font_bitmap.cpp
@@ -0,0 +1,590 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/font/base_font_bitmap.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_frame.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_frame.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(BaseFontBitmap, false)
+
+//////////////////////////////////////////////////////////////////////
+BaseFontBitmap::BaseFontBitmap(BaseGame *inGame) : BaseFont(inGame) {
+ _subframe = NULL;
+ _sprite = NULL;
+ _widthsFrame = 0;
+ memset(_widths, 0, NUM_CHARACTERS);
+ _tileWidth = _tileHeight = _numColumns = 0;
+ _fontextFix = false;
+ _freezable = false;
+ _wholeCell = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseFontBitmap::~BaseFontBitmap() {
+ delete _subframe;
+ delete _sprite;
+ _subframe = NULL;
+ _sprite = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseFontBitmap::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
+ textHeightDraw(text, x, y, width, align, true, maxHeight, maxLength);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseFontBitmap::getTextHeight(byte *text, int width) {
+ return textHeightDraw(text, 0, 0, width, TAL_LEFT, false);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseFontBitmap::getTextWidth(byte *text, int maxLength) {
+ AnsiString str;
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ WideString wstr = StringUtil::utf8ToWide(Utf8String((char *)text));
+ str = StringUtil::wideToAnsi(wstr);
+ } else {
+ str = AnsiString((char *)text);
+ }
+
+ if (maxLength >= 0 && str.size() > (uint32)maxLength) {
+ str = Common::String(str.c_str(), (uint32)maxLength);
+ }
+ //str.substr(0, maxLength); // TODO: Remove
+
+ int textWidth = 0;
+ for (int i = 0; (uint32)i < str.size(); i++) {
+ textWidth += getCharWidth((byte)str[i]);
+ }
+
+ return textWidth;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+int BaseFontBitmap::textHeightDraw(const byte *text, int x, int y, int width, TTextAlign align, bool draw, int maxHeight, int maxLength) {
+ if (maxLength == 0) {
+ return 0;
+ }
+
+ if (text == NULL || text[0] == '\0') {
+ return _tileHeight;
+ }
+
+ AnsiString str;
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ WideString wstr = StringUtil::utf8ToWide(Utf8String((const char *)text));
+ str = StringUtil::wideToAnsi(wstr);
+ } else {
+ str = AnsiString((const char *)text);
+ }
+ if (str.empty()) {
+ return 0;
+ }
+
+ int lineLength = 0;
+ int realLength = 0;
+ int numLines = 0;
+
+ int i;
+
+ int index = -1;
+ int start = 0;
+ int end = 0;
+ int last_end = 0;
+
+ bool done = false;
+ bool newLine = false;
+ bool longLine = false;
+
+ if (draw) {
+ _gameRef->_renderer->startSpriteBatch();
+ }
+
+ while (!done) {
+ if (maxHeight > 0 && (numLines + 1)*_tileHeight > maxHeight) {
+ if (draw) {
+ _gameRef->_renderer->endSpriteBatch();
+ }
+ return numLines * _tileHeight;
+ }
+
+ index++;
+
+ if (str[index] == ' ' && (maxHeight < 0 || maxHeight / _tileHeight > 1)) {
+ end = index - 1;
+ realLength = lineLength;
+ }
+
+ if (str[index] == '\n') {
+ end = index - 1;
+ realLength = lineLength;
+ newLine = true;
+ }
+
+ if (lineLength + getCharWidth(str[index]) > width && last_end == end) {
+ end = index - 1;
+ realLength = lineLength;
+ newLine = true;
+ longLine = true;
+ }
+
+ if ((int)str.size() == (index + 1) || (maxLength >= 0 && index == maxLength - 1)) {
+ done = true;
+ if (!newLine) {
+ end = index;
+ lineLength += getCharWidth(str[index]);
+ realLength = lineLength;
+ }
+ } else {
+ lineLength += getCharWidth(str[index]);
+ }
+
+ if ((lineLength > width) || done || newLine) {
+ if (end < 0) {
+ done = true;
+ }
+ int startX;
+ switch (align) {
+ case TAL_CENTER:
+ startX = x + (width - realLength) / 2;
+ break;
+ case TAL_RIGHT:
+ startX = x + width - realLength;
+ break;
+ case TAL_LEFT:
+ startX = x;
+ break;
+ default:
+ error("BaseFontBitmap::TextHeightDraw - Unhandled enum");
+ break;
+ }
+ for (i = start; i < end + 1; i++) {
+ if (draw) {
+ drawChar(str[i], startX, y);
+ }
+ startX += getCharWidth(str[i]);
+ }
+ y += _tileHeight;
+ last_end = end;
+ if (longLine) {
+ end--;
+ }
+ start = end + 2;
+ index = end + 1;
+ lineLength = 0;
+ newLine = false;
+ longLine = false;
+ numLines++;
+ }
+ }
+
+ if (draw) {
+ _gameRef->_renderer->endSpriteBatch();
+ }
+
+ return numLines * _tileHeight;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseFontBitmap::drawChar(byte c, int x, int y) {
+ if (_fontextFix) {
+ c--;
+ }
+
+ int row, col;
+
+ row = c / _numColumns;
+ col = c % _numColumns;
+
+ Rect32 rect;
+ /* l t r b */
+ int tileWidth;
+ if (_wholeCell) {
+ tileWidth = _tileWidth;
+ } else {
+ tileWidth = _widths[c];
+ }
+
+ BasePlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight);
+ bool handled = false;
+ if (_sprite) {
+ _sprite->getCurrentFrame();
+ if (_sprite->_currentFrame >= 0 && _sprite->_currentFrame < (int32)_sprite->_frames.size() && _sprite->_frames[_sprite->_currentFrame]) {
+ if (_sprite->_frames[_sprite->_currentFrame]->_subframes.size() > 0) {
+ _sprite->_frames[_sprite->_currentFrame]->_subframes[0]->_surface->displayTrans(x, y, rect);
+ }
+ handled = true;
+ }
+ }
+ if (!handled && _subframe) {
+ _subframe->_surface->displayTrans(x, y, rect);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseFontBitmap::loadFile(const Common::String &filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "BaseFontBitmap::LoadFile failed for file '%s'", filename.c_str());
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename.c_str());
+
+ if (DID_FAIL(ret = loadBuffer(buffer))) {
+ _gameRef->LOG(0, "Error parsing FONT file '%s'", filename.c_str());
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(FONTEXT_FIX)
+TOKEN_DEF(FONT)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(TRANSPARENT)
+TOKEN_DEF(COLUMNS)
+TOKEN_DEF(TILE_WIDTH)
+TOKEN_DEF(TILE_HEIGHT)
+TOKEN_DEF(DEFAULT_WIDTH)
+TOKEN_DEF(WIDTHS)
+TOKEN_DEF(AUTO_WIDTH)
+TOKEN_DEF(SPACE_WIDTH)
+TOKEN_DEF(EXPAND_WIDTH)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(SPRITE)
+TOKEN_DEF(WIDTHS_FRAME)
+TOKEN_DEF(PAINT_WHOLE_CELL)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////
+bool BaseFontBitmap::loadBuffer(byte *buffer) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(FONTEXT_FIX)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(TRANSPARENT)
+ TOKEN_TABLE(COLUMNS)
+ TOKEN_TABLE(TILE_WIDTH)
+ TOKEN_TABLE(TILE_HEIGHT)
+ TOKEN_TABLE(DEFAULT_WIDTH)
+ TOKEN_TABLE(WIDTHS)
+ TOKEN_TABLE(AUTO_WIDTH)
+ TOKEN_TABLE(SPACE_WIDTH)
+ TOKEN_TABLE(EXPAND_WIDTH)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(SPRITE)
+ TOKEN_TABLE(WIDTHS_FRAME)
+ TOKEN_TABLE(PAINT_WHOLE_CELL)
+ TOKEN_TABLE_END
+
+ char *params;
+ int cmd;
+ BaseParser parser;
+
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_FONT) {
+ _gameRef->LOG(0, "'FONT' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = (byte *)params;
+
+ int widths[300];
+ int num = 0, defaultWidth = 8;
+ int lastWidth = 0;
+ int i;
+ int r = 255, g = 255, b = 255;
+ bool custoTrans = false;
+ char *surfaceFile = NULL;
+ char *spriteFile = NULL;
+
+ bool autoWidth = false;
+ int spaceWidth = 0;
+ int expandWidth = 0;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+
+ switch (cmd) {
+ case TOKEN_IMAGE:
+ surfaceFile = (char *)params;
+ break;
+
+ case TOKEN_SPRITE:
+ spriteFile = (char *)params;
+ break;
+
+ case TOKEN_TRANSPARENT:
+ parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
+ custoTrans = true;
+ break;
+
+ case TOKEN_WIDTHS:
+ parser.scanStr(params, "%D", widths, &num);
+ for (i = 0; lastWidth < NUM_CHARACTERS && num > 0; lastWidth++, num--, i++) {
+ _widths[lastWidth] = (byte)widths[i];
+ }
+ break;
+
+ case TOKEN_DEFAULT_WIDTH:
+ parser.scanStr(params, "%d", &defaultWidth);
+ break;
+
+ case TOKEN_WIDTHS_FRAME:
+ parser.scanStr(params, "%d", &_widthsFrame);
+ break;
+
+ case TOKEN_COLUMNS:
+ parser.scanStr(params, "%d", &_numColumns);
+ break;
+
+ case TOKEN_TILE_WIDTH:
+ parser.scanStr(params, "%d", &_tileWidth);
+ break;
+
+ case TOKEN_TILE_HEIGHT:
+ parser.scanStr(params, "%d", &_tileHeight);
+ break;
+
+ case TOKEN_AUTO_WIDTH:
+ parser.scanStr(params, "%b", &autoWidth);
+ break;
+
+ case TOKEN_FONTEXT_FIX:
+ parser.scanStr(params, "%b", &_fontextFix);
+ break;
+
+ case TOKEN_PAINT_WHOLE_CELL:
+ parser.scanStr(params, "%b", &_wholeCell);
+ break;
+
+ case TOKEN_SPACE_WIDTH:
+ parser.scanStr(params, "%d", &spaceWidth);
+ break;
+
+ case TOKEN_EXPAND_WIDTH:
+ parser.scanStr(params, "%d", &expandWidth);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty((byte *)params, false);
+ break;
+ }
+
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in FONT definition");
+ return STATUS_FAILED;
+ }
+
+ if (spriteFile != NULL) {
+ delete _sprite;
+ _sprite = new BaseSprite(_gameRef, this);
+ if (!_sprite || DID_FAIL(_sprite->loadFile(spriteFile))) {
+ delete _sprite;
+ _sprite = NULL;
+ }
+ }
+
+ if (surfaceFile != NULL && !_sprite) {
+ _subframe = new BaseSubFrame(_gameRef);
+ if (custoTrans) {
+ _subframe->setSurface(surfaceFile, false, r, g, b);
+ } else {
+ _subframe->setSurface(surfaceFile);
+ }
+ }
+
+
+ if (((_subframe == NULL || _subframe->_surface == NULL) && _sprite == NULL) || _numColumns == 0 || _tileWidth == 0 || _tileHeight == 0) {
+ _gameRef->LOG(0, "Incomplete font definition");
+ return STATUS_FAILED;
+ }
+
+ if (autoWidth) {
+ // calculate characters width
+ getWidths();
+
+ // do we need to modify widths?
+ if (expandWidth != 0) {
+ for (i = 0; i < NUM_CHARACTERS; i++) {
+ int newWidth = (int)_widths[i] + expandWidth;
+ if (newWidth < 0) {
+ newWidth = 0;
+ }
+
+ _widths[i] = (byte)newWidth;
+ }
+ }
+
+ // handle space character
+ uint32 spaceChar = ' ';
+ if (_fontextFix) {
+ spaceChar--;
+ }
+
+ if (spaceWidth != 0) {
+ _widths[spaceChar] = spaceWidth;
+ } else {
+ if (_widths[spaceChar] == expandWidth || _widths[spaceChar] == 0) {
+ _widths[spaceChar] = (_widths['m'] + _widths['i']) / 2;
+ }
+ }
+ } else {
+ for (i = lastWidth; i < NUM_CHARACTERS; i++) {
+ _widths[i] = defaultWidth;
+ }
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
+
+ BaseFont::persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_numColumns));
+
+ persistMgr->transfer(TMEMBER(_subframe));
+ persistMgr->transfer(TMEMBER(_tileHeight));
+ persistMgr->transfer(TMEMBER(_tileWidth));
+ persistMgr->transfer(TMEMBER(_sprite));
+ persistMgr->transfer(TMEMBER(_widthsFrame));
+
+ if (persistMgr->getIsSaving()) {
+ persistMgr->putBytes(_widths, sizeof(_widths));
+ } else {
+ persistMgr->getBytes(_widths, sizeof(_widths));
+ }
+
+
+ persistMgr->transfer(TMEMBER(_fontextFix));
+ persistMgr->transfer(TMEMBER(_wholeCell));
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseFontBitmap::getCharWidth(byte index) {
+ if (_fontextFix) {
+ index--;
+ }
+ return _widths[index];
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontBitmap::getWidths() {
+ BaseSurface *surf = NULL;
+
+ if (_sprite) {
+ if (_widthsFrame >= 0 && _widthsFrame < (int32)_sprite->_frames.size()) {
+ if (_sprite->_frames[_widthsFrame] && (int32)_sprite->_frames[_widthsFrame]->_subframes.size() > 0) {
+ surf = _sprite->_frames[_widthsFrame]->_subframes[0]->_surface;
+ }
+ }
+ }
+ if (surf == NULL && _subframe) {
+ surf = _subframe->_surface;
+ }
+ if (!surf || DID_FAIL(surf->startPixelOp())) {
+ return STATUS_FAILED;
+ }
+
+
+ for (int i = 0; i < NUM_CHARACTERS; i++) {
+ int xxx = (i % _numColumns) * _tileWidth;
+ int yyy = (i / _numColumns) * _tileHeight;
+
+
+ int minCol = -1;
+ for (int row = 0; row < _tileHeight; row++) {
+ for (int col = _tileWidth - 1; col >= minCol + 1; col--) {
+ if (xxx + col < 0 || xxx + col >= surf->getWidth() || yyy + row < 0 || yyy + row >= surf->getHeight()) {
+ continue;
+ }
+ if (!surf->isTransparentAtLite(xxx + col, yyy + row)) {
+ //min_col = col;
+ minCol = MAX(col, minCol);
+ break;
+ }
+ }
+ if (minCol == _tileWidth - 1) {
+ break;
+ }
+ }
+
+ _widths[i] = minCol + 1;
+ }
+ surf->endPixelOp();
+ /*
+ _gameRef->LOG(0, "----- %s ------", _filename);
+ for(int j=0; j<16; j++)
+ {
+ _gameRef->LOG(0, "%02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d", _widths[j*16+0], _widths[j*16+1], _widths[j*16+2], _widths[j*16+3], _widths[j*16+4], _widths[j*16+5], _widths[j*16+6], _widths[j*16+7], _widths[j*16+8], _widths[j*16+9], _widths[j*16+10], _widths[j*16+11], _widths[j*16+12], _widths[j*16+13], _widths[j*16+14], _widths[j*16+15]);
+ }
+ */
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int BaseFontBitmap::getLetterHeight() {
+ return _tileHeight;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h
new file mode 100644
index 0000000000..2f3a69d097
--- /dev/null
+++ b/engines/wintermute/base/font/base_font_bitmap.h
@@ -0,0 +1,71 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FONTBITMAP_H
+#define WINTERMUTE_BASE_FONTBITMAP_H
+
+
+#include "engines/wintermute/base/font/base_font.h"
+
+namespace Wintermute {
+class BaseSubFrame;
+class BaseFontBitmap : public BaseFont {
+public:
+ DECLARE_PERSISTENT(BaseFontBitmap, BaseFont)
+ bool loadBuffer(byte *Buffer);
+ bool loadFile(const Common::String &filename);
+ virtual int getTextWidth(byte *text, int maxLength = -1);
+ virtual int getTextHeight(byte *text, int width);
+ virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
+ virtual int getLetterHeight();
+
+ BaseFontBitmap(BaseGame *inGame);
+ virtual ~BaseFontBitmap();
+
+private:
+ bool getWidths();
+ BaseSprite *_sprite;
+ int _widthsFrame;
+ bool _fontextFix;
+ int _numColumns;
+ int _tileHeight;
+ int _tileWidth;
+ byte _widths[NUM_CHARACTERS];
+ BaseSubFrame *_subframe;
+ bool _wholeCell;
+
+ int getCharWidth(byte index);
+ void drawChar(byte c, int x, int y);
+
+ int textHeightDraw(const byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height = -1, int maxLength = -1);
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp
new file mode 100644
index 0000000000..8128ffe897
--- /dev/null
+++ b/engines/wintermute/base/font/base_font_storage.cpp
@@ -0,0 +1,141 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/base_game.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(BaseFontStorage, true)
+
+//////////////////////////////////////////////////////////////////////////
+BaseFontStorage::BaseFontStorage(BaseGame *inGame) : BaseClass(inGame) {
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseFontStorage::~BaseFontStorage() {
+ cleanup(true);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontStorage::cleanup(bool warn) {
+ for (uint32 i = 0; i < _fonts.size(); i++) {
+ if (warn) {
+ _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->getFilename());
+ }
+ delete _fonts[i];
+ }
+ _fonts.clear();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontStorage::initLoop() {
+ for (uint32 i = 0; i < _fonts.size(); i++) {
+ _fonts[i]->initLoop();
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseFont *BaseFontStorage::addFont(const Common::String &filename) {
+ if (!filename.size()) {
+ return NULL;
+ }
+
+ for (uint32 i = 0; i < _fonts.size(); i++) {
+ if (scumm_stricmp(_fonts[i]->getFilename(), filename.c_str()) == 0) {
+ _fonts[i]->_refCount++;
+ return _fonts[i];
+ }
+ }
+
+ /*
+ BaseFont* font = new BaseFont(_gameRef);
+ if (!font) return NULL;
+
+ if (DID_FAIL(font->loadFile(filename))) {
+ delete font;
+ return NULL;
+ }
+ else {
+ font->_refCount = 1;
+ _fonts.add(font);
+ return font;
+ }
+ */
+ BaseFont *font = BaseFont::createFromFile(_gameRef, filename);
+ if (font) {
+ font->_refCount = 1;
+ _fonts.add(font);
+ }
+ return font;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontStorage::removeFont(BaseFont *font) {
+ if (!font) {
+ return STATUS_FAILED;
+ }
+
+ for (uint32 i = 0; i < _fonts.size(); i++) {
+ if (_fonts[i] == font) {
+ _fonts[i]->_refCount--;
+ if (_fonts[i]->_refCount <= 0) {
+ delete _fonts[i];
+ _fonts.remove_at(i);
+ }
+ break;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontStorage::persist(BasePersistenceManager *persistMgr) {
+
+ if (!persistMgr->getIsSaving()) {
+ cleanup(false);
+ }
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+ _fonts.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font_storage.h b/engines/wintermute/base/font/base_font_storage.h
new file mode 100644
index 0000000000..60874167e7
--- /dev/null
+++ b/engines/wintermute/base/font/base_font_storage.h
@@ -0,0 +1,55 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FONTSTORAGE_H
+#define WINTERMUTE_BASE_FONTSTORAGE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/coll_templ.h"
+
+namespace Wintermute {
+
+class BaseFont;
+
+class BaseFontStorage : public BaseClass {
+public:
+ DECLARE_PERSISTENT(BaseFontStorage, BaseClass)
+ bool cleanup(bool warn = false);
+ bool removeFont(BaseFont *font);
+ BaseFont *addFont(const Common::String &filename);
+ BaseFontStorage(BaseGame *inGame);
+ virtual ~BaseFontStorage();
+ BaseArray<BaseFont *> _fonts;
+ bool initLoop();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
new file mode 100644
index 0000000000..3219918e6d
--- /dev/null
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -0,0 +1,602 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/font/base_font_truetype.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/wintermute.h"
+#include "graphics/fonts/ttf.h"
+#include "graphics/fontman.h"
+#include <limits.h>
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseFontTT, false)
+
+//////////////////////////////////////////////////////////////////////////
+BaseFontTT::BaseFontTT(BaseGame *inGame) : BaseFont(inGame) {
+ _fontHeight = 12;
+ _isBold = _isItalic = _isUnderline = _isStriked = false;
+
+ _fontFile = NULL;
+ _font = NULL;
+ _fallbackFont = NULL;
+ _deletableFont = NULL;
+
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ _cachedTexts[i] = NULL;
+ }
+
+ _lineHeight = 0;
+ _maxCharWidth = _maxCharHeight = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseFontTT::~BaseFontTT(void) {
+ clearCache();
+
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ delete _layers[i];
+ }
+ _layers.clear();
+
+ delete[] _fontFile;
+ _fontFile = NULL;
+
+ delete _deletableFont;
+ _font = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseFontTT::clearCache() {
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ if (_cachedTexts[i]) {
+ delete _cachedTexts[i];
+ }
+ _cachedTexts[i] = NULL;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseFontTT::initLoop() {
+ // we need more aggressive cache management on iOS not to waste too much memory on fonts
+ if (_gameRef->_constrainedMemory) {
+ // purge all cached images not used in the last frame
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ if (_cachedTexts[i] == NULL) {
+ continue;
+ }
+
+ if (!_cachedTexts[i]->_marked) {
+ delete _cachedTexts[i];
+ _cachedTexts[i] = NULL;
+ } else {
+ _cachedTexts[i]->_marked = false;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+int BaseFontTT::getTextWidth(byte *text, int maxLength) {
+ WideString textStr;
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ textStr = StringUtil::utf8ToWide((char *)text);
+ } else {
+ textStr = StringUtil::ansiToWide((char *)text);
+ }
+
+ if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
+ textStr = Common::String(textStr.c_str(), (uint32)maxLength);
+ }
+ //text = text.substr(0, MaxLength); // TODO: Remove
+
+ int textWidth, textHeight;
+ measureText(textStr, -1, -1, textWidth, textHeight);
+
+ return textWidth;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int BaseFontTT::getTextHeight(byte *text, int width) {
+ WideString textStr;
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ textStr = StringUtil::utf8ToWide((char *)text);
+ } else {
+ textStr = StringUtil::ansiToWide((char *)text);
+ }
+
+
+ int textWidth, textHeight;
+ measureText(textStr, width, -1, textWidth, textHeight);
+
+ return textHeight;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
+ if (text == NULL || strcmp((const char *)text, "") == 0) {
+ return;
+ }
+
+ WideString textStr = (const char *)text;
+
+ // TODO: Why do we still insist on Widestrings everywhere?
+ /* if (_gameRef->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
+ else text = StringUtil::AnsiToWide((char *)Text);*/
+
+ if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
+ textStr = Common::String(textStr.c_str(), (uint32)maxLength);
+ }
+ //text = text.substr(0, MaxLength); // TODO: Remove
+
+ BaseRenderer *renderer = _gameRef->_renderer;
+
+ // find cached surface, if exists
+ int minPriority = INT_MAX;
+ int minIndex = -1;
+ BaseSurface *surface = NULL;
+ int textOffset = 0;
+
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ if (_cachedTexts[i] == NULL) {
+ minPriority = 0;
+ minIndex = i;
+ } else {
+ if (_cachedTexts[i]->_text == textStr && _cachedTexts[i]->_align == align && _cachedTexts[i]->_width == width && _cachedTexts[i]->_maxHeight == maxHeight && _cachedTexts[i]->_maxLength == maxLength) {
+ surface = _cachedTexts[i]->_surface;
+ textOffset = _cachedTexts[i]->_textOffset;
+ _cachedTexts[i]->_priority++;
+ _cachedTexts[i]->_marked = true;
+ break;
+ } else {
+ if (_cachedTexts[i]->_priority < minPriority) {
+ minPriority = _cachedTexts[i]->_priority;
+ minIndex = i;
+ }
+ }
+ }
+ }
+
+ // not found, create one
+ if (!surface) {
+ debugC(kWintermuteDebugFont, "Draw text: %s", text);
+ surface = renderTextToTexture(textStr, width, align, maxHeight, textOffset);
+ if (surface) {
+ // write surface to cache
+ if (_cachedTexts[minIndex] != NULL) {
+ delete _cachedTexts[minIndex];
+ }
+ _cachedTexts[minIndex] = new BaseCachedTTFontText;
+
+ _cachedTexts[minIndex]->_surface = surface;
+ _cachedTexts[minIndex]->_align = align;
+ _cachedTexts[minIndex]->_width = width;
+ _cachedTexts[minIndex]->_maxHeight = maxHeight;
+ _cachedTexts[minIndex]->_maxLength = maxLength;
+ _cachedTexts[minIndex]->_priority = 1;
+ _cachedTexts[minIndex]->_text = textStr;
+ _cachedTexts[minIndex]->_textOffset = textOffset;
+ _cachedTexts[minIndex]->_marked = true;
+ }
+ }
+
+
+ // and paint it
+ if (surface) {
+ Rect32 rc;
+ BasePlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight());
+ for (uint32 i = 0; i < _layers.size(); i++) {
+ uint32 color = _layers[i]->_color;
+ uint32 origForceAlpha = renderer->_forceAlphaColor;
+ if (renderer->_forceAlphaColor != 0) {
+ color = BYTETORGBA(RGBCOLGetR(color), RGBCOLGetG(color), RGBCOLGetB(color), RGBCOLGetA(renderer->_forceAlphaColor));
+ renderer->_forceAlphaColor = 0;
+ }
+ surface->displayTransOffset(x, y - textOffset, rc, color, BLEND_NORMAL, false, false, _layers[i]->_offsetX, _layers[i]->_offsetY);
+
+ renderer->_forceAlphaColor = origForceAlpha;
+ }
+ }
+
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset) {
+ //TextLineList lines;
+ // TODO: Use WideString-conversion here.
+ //WrapText(text, width, maxHeight, lines);
+ Common::Array<Common::String> lines;
+ _font->wordWrapText(text, width, lines);
+
+ while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) {
+ lines.pop_back();
+ }
+ if (lines.size() == 0) {
+ return NULL;
+ }
+
+ Graphics::TextAlign alignment = Graphics::kTextAlignInvalid;
+ if (align == TAL_LEFT) {
+ alignment = Graphics::kTextAlignLeft;
+ } else if (align == TAL_CENTER) {
+ alignment = Graphics::kTextAlignCenter;
+ } else if (align == TAL_RIGHT) {
+ alignment = Graphics::kTextAlignRight;
+ }
+
+ debugC(kWintermuteDebugFont, "%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color));
+// void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
+ Graphics::Surface *surface = new Graphics::Surface();
+ if (_deletableFont) { // We actually have a TTF
+ surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24));
+ } else { // We are using a fallback, they can't do 32bpp
+ surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
+ }
+ uint32 useColor = 0xffffffff;
+ Common::Array<Common::String>::iterator it;
+ int heightOffset = 0;
+ for (it = lines.begin(); it != lines.end(); ++it) {
+ _font->drawString(surface, *it, 0, heightOffset, width, useColor, alignment);
+ heightOffset += (int)_lineHeight;
+ }
+
+ BaseSurface *retSurface = _gameRef->_renderer->createSurface();
+ Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24));
+ retSurface->putSurface(*convertedSurface, true);
+ convertedSurface->free();
+ surface->free();
+ delete surface;
+ delete convertedSurface;
+ return retSurface;
+ // TODO: _isUnderline, _isBold, _isItalic, _isStriked
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int BaseFontTT::getLetterHeight() {
+ return (int)getLineHeight();
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseFontTT::loadFile(const Common::String &filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "BaseFontTT::LoadFile failed for file '%s'", filename.c_str());
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename.c_str());
+
+ if (DID_FAIL(ret = loadBuffer(buffer))) {
+ _gameRef->LOG(0, "Error parsing TTFONT file '%s'", filename.c_str());
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(TTFONT)
+TOKEN_DEF(SIZE)
+TOKEN_DEF(FACE)
+TOKEN_DEF(FILENAME)
+TOKEN_DEF(BOLD)
+TOKEN_DEF(ITALIC)
+TOKEN_DEF(UNDERLINE)
+TOKEN_DEF(STRIKE)
+TOKEN_DEF(CHARSET)
+TOKEN_DEF(COLOR)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(LAYER)
+TOKEN_DEF(OFFSET_X)
+TOKEN_DEF(OFFSET_Y)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////
+bool BaseFontTT::loadBuffer(byte *buffer) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(TTFONT)
+ TOKEN_TABLE(SIZE)
+ TOKEN_TABLE(FACE)
+ TOKEN_TABLE(FILENAME)
+ TOKEN_TABLE(BOLD)
+ TOKEN_TABLE(ITALIC)
+ TOKEN_TABLE(UNDERLINE)
+ TOKEN_TABLE(STRIKE)
+ TOKEN_TABLE(CHARSET)
+ TOKEN_TABLE(COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(LAYER)
+ TOKEN_TABLE_END
+
+ char *params;
+ int cmd;
+ BaseParser parser;
+
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TTFONT) {
+ _gameRef->LOG(0, "'TTFONT' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = (byte *)params;
+
+ uint32 baseColor = 0x00000000;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_SIZE:
+ parser.scanStr(params, "%d", &_fontHeight);
+ break;
+
+ case TOKEN_FACE:
+ // we don't need this anymore
+ break;
+
+ case TOKEN_FILENAME:
+ BaseUtils::setString(&_fontFile, params);
+ break;
+
+ case TOKEN_BOLD:
+ parser.scanStr(params, "%b", &_isBold);
+ break;
+
+ case TOKEN_ITALIC:
+ parser.scanStr(params, "%b", &_isItalic);
+ break;
+
+ case TOKEN_UNDERLINE:
+ parser.scanStr(params, "%b", &_isUnderline);
+ break;
+
+ case TOKEN_STRIKE:
+ parser.scanStr(params, "%b", &_isStriked);
+ break;
+
+ case TOKEN_CHARSET:
+ // we don't need this anymore
+ break;
+
+ case TOKEN_COLOR: {
+ int r, g, b;
+ parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
+ baseColor = BYTETORGBA(r, g, b, RGBCOLGetA(baseColor));
+ }
+ break;
+
+ case TOKEN_ALPHA: {
+ int a;
+ parser.scanStr(params, "%d", &a);
+ baseColor = BYTETORGBA(RGBCOLGetR(baseColor), RGBCOLGetG(baseColor), RGBCOLGetB(baseColor), a);
+ }
+ break;
+
+ case TOKEN_LAYER: {
+ BaseTTFontLayer *layer = new BaseTTFontLayer;
+ if (layer && DID_SUCCEED(parseLayer(layer, (byte *)params))) {
+ _layers.add(layer);
+ } else {
+ delete layer;
+ layer = NULL;
+ cmd = PARSERR_TOKENNOTFOUND;
+ }
+ }
+ break;
+
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in TTFONT definition");
+ return STATUS_FAILED;
+ }
+
+ // create at least one layer
+ if (_layers.size() == 0) {
+ BaseTTFontLayer *layer = new BaseTTFontLayer;
+ layer->_color = baseColor;
+ _layers.add(layer);
+ }
+
+ if (!_fontFile) {
+ BaseUtils::setString(&_fontFile, "arial.ttf");
+ }
+
+ return initFont();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, byte *buffer) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(OFFSET_X)
+ TOKEN_TABLE(OFFSET_Y)
+ TOKEN_TABLE(COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE_END
+
+ char *params;
+ int cmd;
+ BaseParser parser;
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_OFFSET_X:
+ parser.scanStr(params, "%d", &layer->_offsetX);
+ break;
+
+ case TOKEN_OFFSET_Y:
+ parser.scanStr(params, "%d", &layer->_offsetY);
+ break;
+
+ case TOKEN_COLOR: {
+ int r, g, b;
+ parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
+ layer->_color = BYTETORGBA(r, g, b, RGBCOLGetA(layer->_color));
+ }
+ break;
+
+ case TOKEN_ALPHA: {
+ int a;
+ parser.scanStr(params, "%d", &a);
+ layer->_color = BYTETORGBA(RGBCOLGetR(layer->_color), RGBCOLGetG(layer->_color), RGBCOLGetB(layer->_color), a);
+ }
+ break;
+ }
+ }
+ if (cmd != PARSERR_EOF) {
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontTT::persist(BasePersistenceManager *persistMgr) {
+ BaseFont::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_isBold));
+ persistMgr->transfer(TMEMBER(_isItalic));
+ persistMgr->transfer(TMEMBER(_isUnderline));
+ persistMgr->transfer(TMEMBER(_isStriked));
+ persistMgr->transfer(TMEMBER(_fontHeight));
+ persistMgr->transfer(TMEMBER(_fontFile));
+
+
+ // persist layers
+ int numLayers;
+ if (persistMgr->getIsSaving()) {
+ numLayers = _layers.size();
+ persistMgr->transfer(TMEMBER(numLayers));
+ for (int i = 0; i < numLayers; i++) {
+ _layers[i]->persist(persistMgr);
+ }
+ } else {
+ numLayers = _layers.size();
+ persistMgr->transfer(TMEMBER(numLayers));
+ for (int i = 0; i < numLayers; i++) {
+ BaseTTFontLayer *layer = new BaseTTFontLayer;
+ layer->persist(persistMgr);
+ _layers.add(layer);
+ }
+ }
+
+ if (!persistMgr->getIsSaving()) {
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ _cachedTexts[i] = NULL;
+ }
+ _fallbackFont = _font = _deletableFont = NULL;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseFontTT::afterLoad() {
+ initFont();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseFontTT::initFont() {
+ if (!_fontFile) {
+ return STATUS_FAILED;
+ }
+
+ Common::SeekableReadStream *file = BaseFileManager::getEngineInstance()->openFile(_fontFile);
+ if (!file) {
+ //TODO: Try to fallback from Arial to FreeSans
+ /*
+ // the requested font file is not in wme file space; try loading a system font
+ AnsiString fontFileName = PathUtil::combine(BasePlatform::getSystemFontPath(), PathUtil::getFileName(_fontFile));
+ file = BaseFileManager::getEngineInstance()->openFile(fontFileName.c_str(), false);
+ if (!file) {
+ _gameRef->LOG(0, "Error loading TrueType font '%s'", _fontFile);
+ //return STATUS_FAILED;
+ }*/
+ }
+
+ if (file) {
+#ifdef USE_FREETYPE2
+ _deletableFont = Graphics::loadTTFFont(*file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72).
+ _font = _deletableFont;
+#endif
+ }
+ if (!_font) {
+ _font = _fallbackFont = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ warning("BaseFontTT::InitFont - Couldn't load font: %s", _fontFile);
+ }
+ _lineHeight = _font->getFontHeight();
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) {
+ //TextLineList lines;
+
+ if (maxWidth >= 0) {
+ Common::Array<Common::String> lines;
+ _font->wordWrapText(text, maxWidth, lines);
+ Common::Array<Common::String>::iterator it;
+ textWidth = 0;
+ for (it = lines.begin(); it != lines.end(); ++it) {
+ textWidth = MAX(textWidth, _font->getStringWidth(*it));
+ }
+
+ //WrapText(text, maxWidth, maxHeight, lines);
+
+ textHeight = (int)(lines.size() * getLineHeight());
+ } else {
+ textWidth = _font->getStringWidth(text);
+ textHeight = _fontHeight;
+ }
+ /*
+ TextLineList::iterator it;
+ for (it = lines.begin(); it != lines.end(); ++it) {
+ TextLine *line = (*it);
+ textWidth = MAX(textWidth, line->GetWidth());
+ delete line;
+ line = NULL;
+ }*/
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h
new file mode 100644
index 0000000000..02dca7439f
--- /dev/null
+++ b/engines/wintermute/base/font/base_font_truetype.h
@@ -0,0 +1,152 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_FONTTT_H
+#define WINTERMUTE_BASE_FONTTT_H
+
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "common/rect.h"
+#include "graphics/surface.h"
+#include "graphics/font.h"
+
+#define NUM_CACHED_TEXTS 30
+
+namespace Wintermute {
+
+class BaseFontTT : public BaseFont {
+private:
+ //////////////////////////////////////////////////////////////////////////
+ class BaseCachedTTFontText {
+ public:
+ WideString _text;
+ int _width;
+ TTextAlign _align;
+ int _maxHeight;
+ int _maxLength;
+ BaseSurface *_surface;
+ int _priority;
+ int _textOffset;
+ bool _marked;
+
+ BaseCachedTTFontText() {
+ //_text = L"";
+ _text = "";
+ _width = _maxHeight = _maxLength = -1;
+ _align = TAL_LEFT;
+ _surface = NULL;
+ _priority = -1;
+ _textOffset = 0;
+ _marked = false;
+ }
+
+ virtual ~BaseCachedTTFontText() {
+ if (_surface) {
+ delete _surface;
+ }
+ }
+ };
+
+public:
+ //////////////////////////////////////////////////////////////////////////
+ class BaseTTFontLayer {
+ public:
+ BaseTTFontLayer() {
+ _offsetX = _offsetY = 0;
+ _color = 0x00000000;
+ }
+
+ bool persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_offsetX));
+ persistMgr->transfer(TMEMBER(_offsetY));
+ persistMgr->transfer(TMEMBER(_color));
+ return STATUS_OK;
+ }
+
+ int _offsetX;
+ int _offsetY;
+ uint32 _color;
+ };
+
+public:
+ DECLARE_PERSISTENT(BaseFontTT, BaseFont)
+ BaseFontTT(BaseGame *inGame);
+ virtual ~BaseFontTT(void);
+
+ virtual int getTextWidth(byte *text, int maxLength = -1);
+ virtual int getTextHeight(byte *text, int width);
+ virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
+ virtual int getLetterHeight();
+
+ bool loadBuffer(byte *buffer);
+ bool loadFile(const Common::String &filename);
+
+ float getLineHeight() const {
+ return _lineHeight;
+ }
+
+ void afterLoad();
+ void initLoop();
+
+private:
+ bool parseLayer(BaseTTFontLayer *layer, byte *buffer);
+
+ void measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight);
+
+ BaseSurface *renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset);
+
+ BaseCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS];
+
+ bool initFont();
+
+ Graphics::Font *_deletableFont;
+ const Graphics::Font *_font;
+ const Graphics::Font *_fallbackFont;
+
+ float _lineHeight;
+
+ size_t _maxCharWidth;
+ size_t _maxCharHeight;
+
+public:
+ bool _isBold;
+ bool _isItalic;
+ bool _isUnderline;
+ bool _isStriked;
+ int _fontHeight;
+ char *_fontFile;
+
+ BaseArray<BaseTTFontLayer *> _layers;
+ void clearCache();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp
new file mode 100644
index 0000000000..4b15d563ed
--- /dev/null
+++ b/engines/wintermute/base/gfx/base_image.cpp
@@ -0,0 +1,231 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/graphics/transparent_surface.h"
+#include "graphics/decoders/png.h"
+#include "graphics/decoders/jpeg.h"
+#include "graphics/decoders/bmp.h"
+#include "graphics/decoders/tga.h"
+#include "graphics/surface.h"
+#include "common/textconsole.h"
+#include "common/stream.h"
+#include "common/system.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+BaseImage::BaseImage() {
+ _fileManager = BaseFileManager::getEngineInstance();
+ _palette = NULL;
+ _surface = NULL;
+ _decoder = NULL;
+ _deletableSurface = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseImage::~BaseImage() {
+ delete _decoder;
+ if (_deletableSurface) {
+ _deletableSurface->free();
+ }
+ delete _deletableSurface;
+}
+
+bool BaseImage::loadFile(const Common::String &filename) {
+ _filename = filename;
+ _filename.toLowercase();
+ if (filename.hasPrefix("savegame:")) {
+ _decoder = new Graphics::BitmapDecoder();
+ } else if (_filename.hasSuffix(".png")) {
+ _decoder = new Graphics::PNGDecoder();
+ } else if (_filename.hasSuffix(".bmp")) {
+ _decoder = new Graphics::BitmapDecoder();
+ } else if (_filename.hasSuffix(".tga")) {
+ _decoder = new Graphics::TGADecoder();
+ } else if (_filename.hasSuffix(".jpg")) {
+ _decoder = new Graphics::JPEGDecoder();
+ } else {
+ error("BaseImage::loadFile : Unsupported fileformat %s", filename.c_str());
+ }
+ _filename = filename;
+ Common::SeekableReadStream *file = _fileManager->openFile(filename.c_str());
+ if (!file) {
+ return false;
+ }
+
+ _decoder->loadStream(*file);
+ _surface = _decoder->getSurface();
+ _palette = _decoder->getPalette();
+ _fileManager->closeFile(file);
+
+ return true;
+}
+
+byte BaseImage::getAlphaAt(int x, int y) const {
+ if (!_surface) {
+ return 0xFF;
+ }
+ uint32 color = *(const uint32 *)_surface->getBasePtr(x, y);
+ byte r, g, b, a;
+ _surface->format.colorToARGB(color, a, r, g, b);
+ return a;
+}
+
+void BaseImage::copyFrom(const Graphics::Surface *surface) {
+ _surface = _deletableSurface = new Graphics::Surface();
+ _deletableSurface->copyFrom(*surface);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseImage::saveBMPFile(const char *filename) const {
+ warning("BaseImage::saveBMPFile - stubbed"); // TODO
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseImage::resize(int newWidth, int newHeight) {
+ // WME Lite used FILTER_BILINEAR with FreeImage_Rescale here.
+ TransparentSurface temp(*_surface, true);
+ if (_deletableSurface) {
+ _deletableSurface->free();
+ delete _deletableSurface;
+ _deletableSurface = NULL;
+ }
+ _surface = _deletableSurface = temp.scale((uint16)newWidth, (uint16)newHeight);
+ temp.free();
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseImage::writeBMPToStream(Common::WriteStream *stream) const {
+ if (!_surface) {
+ return false;
+ }
+
+ /* The following is just copied over and inverted to write-ops from the BMP-decoder */
+ stream->writeByte('B');
+ stream->writeByte('M');
+
+ /* Since we don't care during reads, we don't care during writes: */
+ /* uint32 fileSize = */
+ stream->writeUint32LE(54 + _surface->h * _surface->pitch);
+ /* uint16 res1 = */
+ stream->writeUint16LE(0);
+ /* uint16 res2 = */
+ stream->writeUint16LE(0);
+ const uint32 imageOffset = 54;
+ stream->writeUint32LE(imageOffset);
+
+ const uint32 infoSize = 40; /* Windows v3 BMP */
+ stream->writeUint32LE(infoSize);
+
+ uint32 width = _surface->w;
+ int32 height = _surface->h;
+ stream->writeUint32LE(width);
+ stream->writeUint32LE((uint32)height);
+
+ if (width == 0 || height == 0) {
+ return false;
+ }
+
+ if (height < 0) {
+ warning("Right-side up bitmaps not supported");
+ return false;
+ }
+
+ /* uint16 planes = */ stream->writeUint16LE(1);
+ const uint16 bitsPerPixel = 24;
+ stream->writeUint16LE(bitsPerPixel);
+
+ const uint32 compression = 0;
+ stream->writeUint32LE(compression);
+
+ /* uint32 imageSize = */
+ stream->writeUint32LE(_surface->h * _surface->pitch);
+ /* uint32 pixelsPerMeterX = */
+ stream->writeUint32LE(0);
+ /* uint32 pixelsPerMeterY = */
+ stream->writeUint32LE(0);
+ const uint32 paletteColorCount = 0;
+ stream->writeUint32LE(paletteColorCount);
+ /* uint32 colorsImportant = */
+ stream->writeUint32LE(0);
+
+ // Start us at the beginning of the image (54 bytes in)
+ Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
+
+ // BGRA for 24bpp
+ if (bitsPerPixel == 24) {
+ format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0);
+ }
+
+ Graphics::Surface *surface = _surface->convertTo(format);
+
+ int srcPitch = width * (bitsPerPixel >> 3);
+ const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0;
+
+ for (int32 i = height - 1; i >= 0; i--) {
+ for (uint32 j = 0; j < width; j++) {
+ byte b, g, r;
+ uint32 color = *(uint32 *)surface->getBasePtr(j, i);
+ surface->format.colorToRGB(color, r, g, b);
+ stream->writeByte(b);
+ stream->writeByte(g);
+ stream->writeByte(r);
+ }
+
+ for (int k = 0; k < extraDataLength; k++) {
+ stream->writeByte(0);
+ }
+ }
+ surface->free();
+ delete surface;
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) {
+ // WME Lite used FILTER_BILINEAR with FreeImage_Rescale here.
+
+ TransparentSurface temp(*origImage->_surface, false);
+ if (_deletableSurface) {
+ _deletableSurface->free();
+ delete _deletableSurface;
+ _deletableSurface = NULL;
+ }
+ _surface = _deletableSurface = temp.scale((uint16)newWidth, (uint16)newHeight);
+ return true;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h
new file mode 100644
index 0000000000..6d01b84184
--- /dev/null
+++ b/engines/wintermute/base/gfx/base_image.h
@@ -0,0 +1,72 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_IMAGE_H
+#define WINTERMUTE_BASE_IMAGE_H
+
+#include "graphics/surface.h"
+#include "graphics/pixelformat.h"
+#include "graphics/decoders/image_decoder.h"
+#include "common/endian.h"
+#include "common/str.h"
+#include "common/stream.h"
+
+namespace Wintermute {
+class BaseSurface;
+class BaseFileManager;
+class BaseImage {
+
+public:
+ BaseImage();
+ ~BaseImage();
+
+ bool loadFile(const Common::String &filename);
+ const Graphics::Surface *getSurface() const {
+ return _surface;
+ };
+ const byte *getPalette() const {
+ return _palette;
+ }
+ byte getAlphaAt(int x, int y) const;
+ bool writeBMPToStream(Common::WriteStream *stream) const;
+ bool resize(int newWidth, int newHeight);
+ bool saveBMPFile(const char *filename) const;
+ bool copyFrom(BaseImage *origImage, int newWidth = 0, int newHeight = 0);
+ void copyFrom(const Graphics::Surface *surface);
+private:
+ Common::String _filename;
+ Graphics::ImageDecoder *_decoder;
+ const Graphics::Surface *_surface;
+ Graphics::Surface *_deletableSurface;
+ const byte *_palette;
+ BaseFileManager *_fileManager;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp
new file mode 100644
index 0000000000..e7ffc14c25
--- /dev/null
+++ b/engines/wintermute/base/gfx/base_renderer.cpp
@@ -0,0 +1,381 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) {
+ _window = 0;
+ _clipperWindow = 0;
+ _active = false;
+ _ready = false;
+ _windowed = true;
+ _forceAlphaColor = 0x00;
+
+ _indicatorDisplay = false;
+ _indicatorColor = BYTETORGBA(255, 0, 0, 128);
+ _indicatorProgress = 0;
+ _indicatorX = -1;
+ _indicatorY = -1;
+ _indicatorWidth = -1;
+ _indicatorHeight = 8;
+ _indicatorWidthDrawn = 0;
+
+ _loadImageName = "";
+ _saveImageName = "";
+ _saveLoadImage = NULL;
+ _loadInProgress = false;
+ _hasDrawnSaveLoadImage = false;
+
+ _saveImageX = _saveImageY = 0;
+ _loadImageX = _loadImageY = 0;
+
+ _width = _height = _bPP = 0;
+ BasePlatform::setRectEmpty(&_monitorRect);
+
+ _realWidth = _realHeight = 0;
+ _drawOffsetX = _drawOffsetY = 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseRenderer::~BaseRenderer() {
+ deleteRectList();
+ unclipCursor();
+ delete _saveLoadImage;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseRenderer::initLoop() {
+ deleteRectList();
+}
+
+void BaseRenderer::initIndicator() {
+ if (_indicatorY == -1) {
+ _indicatorY = _height - _indicatorHeight;
+ }
+ if (_indicatorX == -1) {
+ _indicatorX = 0;
+ }
+ if (_indicatorWidth == -1) {
+ _indicatorWidth = _width;
+ }
+}
+
+void BaseRenderer::setIndicator(int width, int height, int x, int y, uint32 color) {
+ _indicatorWidth = width;
+ _indicatorHeight = height;
+ _indicatorX = x;
+ _indicatorY = y;
+ _indicatorColor = color;
+}
+
+void BaseRenderer::setIndicatorVal(int value) {
+ bool redisplay = (_indicatorProgress != value);
+ _indicatorProgress = value;
+ if (redisplay)
+ displayIndicator();
+}
+
+void BaseRenderer::setLoadingScreen(const char *filename, int x, int y) {
+ // TODO: Handle NULL
+ _loadImageName = filename;
+ _loadImageX = x;
+ _loadImageY = y;
+}
+
+void BaseRenderer::setSaveImage(const char *filename, int x, int y) {
+ // TODO: Handle NULL
+ _saveImageName = filename;
+ _saveImageX = x;
+ _saveImageY = y;
+}
+
+void BaseRenderer::initSaveLoad(bool isSaving, bool quickSave) {
+ _indicatorDisplay = true;
+ _indicatorProgress = 0;
+ _hasDrawnSaveLoadImage = false;
+
+ if (isSaving && !quickSave) {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ if (_saveImageName.size()) {
+ _saveLoadImage = createSurface();
+
+ if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ }
+ }
+ } else {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ if (_loadImageName.size()) {
+ _saveLoadImage = createSurface();
+
+ if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ }
+ }
+ _loadInProgress = true;
+ }
+}
+
+void BaseRenderer::endSaveLoad() {
+ _loadInProgress = false;
+ _indicatorDisplay = false;
+ _indicatorWidthDrawn = 0;
+
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+}
+
+void BaseRenderer::persistSaveLoadImages(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_loadImageName));
+ persistMgr->transfer(TMEMBER(_saveImageName));
+ persistMgr->transfer(TMEMBER(_saveImageX));
+ persistMgr->transfer(TMEMBER(_saveImageY));
+ persistMgr->transfer(TMEMBER(_loadImageX));
+ persistMgr->transfer(TMEMBER(_loadImageY));
+}
+
+//////////////////////////////////////////////////////////////////////
+BaseObject *BaseRenderer::getObjectAt(int x, int y) {
+ Point32 point;
+ point.x = x;
+ point.y = y;
+
+ for (int i = _rectList.size() - 1; i >= 0; i--) {
+ if (BasePlatform::ptInRect(&_rectList[i]->_rect, point)) {
+ if (_rectList[i]->_precise) {
+ // frame
+ if (_rectList[i]->_frame) {
+ int xx = (int)((_rectList[i]->_frame->getRect().left + x - _rectList[i]->_rect.left + _rectList[i]->_offsetX) / (float)((float)_rectList[i]->_zoomX / (float)100));
+ int yy = (int)((_rectList[i]->_frame->getRect().top + y - _rectList[i]->_rect.top + _rectList[i]->_offsetY) / (float)((float)_rectList[i]->_zoomY / (float)100));
+
+ if (_rectList[i]->_frame->_mirrorX) {
+ int width = _rectList[i]->_frame->getRect().right - _rectList[i]->_frame->getRect().left;
+ xx = width - xx;
+ }
+
+ if (_rectList[i]->_frame->_mirrorY) {
+ int height = _rectList[i]->_frame->getRect().bottom - _rectList[i]->_frame->getRect().top;
+ yy = height - yy;
+ }
+
+ if (!_rectList[i]->_frame->_surface->isTransparentAt(xx, yy)) {
+ return _rectList[i]->_owner;
+ }
+ }
+ // region
+ else if (_rectList[i]->_region) {
+ if (_rectList[i]->_region->pointInRegion(x + _rectList[i]->_offsetX, y + _rectList[i]->_offsetY)) {
+ return _rectList[i]->_owner;
+ }
+ }
+ } else {
+ return _rectList[i]->_owner;
+ }
+ }
+ }
+
+ return (BaseObject *)NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderer::deleteRectList() {
+ for (uint32 i = 0; i < _rectList.size(); i++) {
+ delete _rectList[i];
+ }
+ _rectList.clear();
+}
+
+//////////////////////////////////////////////////////////////////////
+bool BaseRenderer::initRenderer(int width, int height, bool windowed) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void BaseRenderer::onWindowChange() {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::windowedBlt() {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::setup2D(bool Force) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::setupLines() {
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) {
+ for (int i = 0; i < width; i++) {
+ drawLine(x1 + i, y1 + i, x2 - i, y1 + i, color); // up
+ drawLine(x1 + i, y2 - i, x2 - i + 1, y2 - i, color); // down
+
+ drawLine(x1 + i, y1 + i, x1 + i, y2 - i, color); // left
+ drawLine(x2 - i, y1 + i, x2 - i, y2 - i + 1, color); // right
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::setViewport(int left, int top, int right, int bottom) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::setScreenViewport() {
+ return setViewport(_drawOffsetX, _drawOffsetY, _width + _drawOffsetX, _height + _drawOffsetY);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::setViewport(Rect32 *rect) {
+ return setViewport(rect->left + _drawOffsetX,
+ rect->top + _drawOffsetY,
+ rect->right + _drawOffsetX,
+ rect->bottom + _drawOffsetY);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::clipCursor() {
+ // TODO: Reimplement this. (Currently aspect-indpendence isn't quite finished)
+ /*
+ if (!_windowed) {
+ Rect32 rc;
+ GetWindowRect(_window, &rc);
+
+ // if "maintain aspect ratio" is in effect, lock mouse to visible area
+ rc.left = _drawOffsetX;
+ rc.top = _drawOffsetY;
+ rc.right = rc.left + _width;
+ rc.bottom = rc.top + _height;
+
+ ::ClipCursor(&rc);
+ }
+ */
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::unclipCursor() {
+ /*
+ if (!_windowed) ::ClipCursor(NULL);
+ */
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::pointInViewport(Point32 *p) {
+ if (p->x < _drawOffsetX) {
+ return false;
+ }
+ if (p->y < _drawOffsetY) {
+ return false;
+ }
+ if (p->x > _drawOffsetX + _width) {
+ return false;
+ }
+ if (p->y > _drawOffsetY + _height) {
+ return false;
+ }
+
+ return true;
+}
+
+void BaseRenderer::addRectToList(BaseActiveRect *rect) {
+ _rectList.push_back(rect);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::displayIndicator() {
+ if (!_indicatorDisplay || !_indicatorProgress) {
+ return STATUS_OK;
+ }
+ if (_saveLoadImage && !_hasDrawnSaveLoadImage) {
+ Rect32 rc;
+ BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
+ if (_loadInProgress) {
+ _saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc);
+ } else {
+ _saveLoadImage->displayTrans(_saveImageX, _saveImageY, rc);
+ }
+ flip();
+ _hasDrawnSaveLoadImage = true;
+ }
+
+ if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) {
+ return STATUS_OK;
+ }
+ setupLines();
+ int curWidth = (int)(_indicatorWidth * (float)((float)_indicatorProgress / 100.0f));
+ for (int i = 0; i < _indicatorHeight; i++) {
+ drawLine(_indicatorX, _indicatorY + i, _indicatorX + curWidth, _indicatorY + i, _indicatorColor);
+ }
+
+ setup2D();
+ _indicatorWidthDrawn = curWidth;
+ if (_indicatorWidthDrawn) {
+ indicatorFlip();
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h
new file mode 100644
index 0000000000..0475824464
--- /dev/null
+++ b/engines/wintermute/base/gfx/base_renderer.h
@@ -0,0 +1,221 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_RENDERER_H
+#define WINTERMUTE_BASE_RENDERER_H
+
+#include "engines/wintermute/math/rect32.h"
+#include "engines/wintermute/base/base.h"
+#include "common/rect.h"
+#include "common/array.h"
+
+namespace Wintermute {
+
+class BaseImage;
+class BaseActiveRect;
+class BaseObject;
+class BaseSurface;
+class BasePersistenceManager;
+
+/**
+ * @class BaseRenderer a common interface for the rendering portion of WME
+ * this interface is mainly intended to wrap away any differencies between
+ * software-rendering/hardware-rendering.
+ */
+class BaseRenderer: public BaseClass {
+public:
+ int _realWidth;
+ int _realHeight;
+ int _drawOffsetX;
+ int _drawOffsetY;
+
+ virtual void dumpData(const char *filename) {}
+ /**
+ * Take a screenshot of the current screenstate
+ *
+ * @return a BaseImage containing the current screen-buffer.
+ */
+ virtual BaseImage *takeScreenshot() = 0;
+ virtual bool setViewport(int left, int top, int right, int bottom);
+ virtual bool setViewport(Rect32 *rect);
+ virtual Rect32 getViewPort() = 0;
+ virtual bool setScreenViewport();
+
+ virtual Graphics::PixelFormat getPixelFormat() const = 0;
+ /**
+ * Fade the screen to black
+ *
+ * @param alpha amount to fade by (alpha value of black)
+ * @return
+ */
+ virtual void fade(uint16 alpha) = 0;
+ /**
+ * Fade a portion of the screen to a specific color
+ *
+ * @param r the red component to fade too.
+ * @param g the green component to fade too.
+ * @param b the blue component to fade too.
+ * @param a the alpha component to fade too.
+ * @param rect the portion of the screen to fade (if NULL, the entire screen will be faded).
+ */
+ virtual void fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect = NULL) = 0;
+ virtual bool drawLine(int x1, int y1, int x2, int y2, uint32 color);
+ virtual bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1);
+ BaseRenderer(BaseGame *inGame = NULL);
+ virtual ~BaseRenderer();
+ virtual bool setProjection() {
+ return STATUS_OK;
+ };
+
+ virtual bool windowedBlt();
+ /**
+ * Fill a portion of the screen with a specified color
+ *
+ * @param r the red component to fill with.
+ * @param g the green component to fill with.
+ * @param b the blue component to fill with.
+ */
+ virtual bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL) = 0;
+ virtual void onWindowChange();
+ virtual bool initRenderer(int width, int height, bool windowed);
+ /**
+ * Flip the backbuffer onto the screen-buffer
+ * The screen will NOT be updated before calling this function.
+ *
+ * @return true if successfull, false on error.
+ */
+ virtual bool flip() = 0;
+ /**
+ * Special flip for the indicator drawn during save/load
+ * essentially, just copies the region defined by the _indicator-variables.
+ */
+ virtual bool indicatorFlip() = 0;
+ virtual void initLoop();
+ virtual bool setup2D(bool force = false);
+ virtual bool setupLines();
+
+ /**
+ * Get the name of the current renderer
+ *
+ * @return the name of the renderer.
+ */
+ virtual Common::String getName() const = 0;
+ virtual bool displayDebugInfo() {
+ return STATUS_FAILED;
+ };
+ virtual bool drawShaderQuad() {
+ return STATUS_FAILED;
+ }
+
+ virtual float getScaleRatioX() const {
+ return 1.0f;
+ }
+ virtual float getScaleRatioY() const {
+ return 1.0f;
+ }
+
+ /**
+ * Create a Surface fit for use with the renderer.
+ * As diverse implementations of BaseRenderer might have different solutions for storing surfaces
+ * this allows for a common interface for creating surface-handles. (Mostly usefull to ease future
+ * implementation of hw-accelerated rendering, or readding 3D-support at some point).
+ *
+ * @return a surface that can be used with this renderer
+ */
+ virtual BaseSurface *createSurface() = 0;
+
+ bool clipCursor();
+ bool unclipCursor();
+
+ BaseObject *getObjectAt(int x, int y);
+ void deleteRectList();
+
+ virtual bool startSpriteBatch() {
+ return STATUS_OK;
+ };
+ virtual bool endSpriteBatch() {
+ return STATUS_OK;
+ };
+ bool pointInViewport(Point32 *P);
+ bool _active;
+ bool _ready;
+ bool _windowed;
+ int _bPP;
+ int _height;
+ int _width;
+ uint32 _window;
+ uint32 _forceAlphaColor;
+
+ void addRectToList(BaseActiveRect *rect);
+
+ // Indicator & Save/Load-related functions
+ void initIndicator();
+ void setIndicatorVal(int value);
+ void setIndicator(int width, int height, int x, int y, uint32 color);
+ void persistSaveLoadImages(BasePersistenceManager *persistMgr);
+ void initSaveLoad(bool isSaving, bool quickSave = false);
+ void endSaveLoad();
+ void setLoadingScreen(const char *filename, int x, int y);
+ void setSaveImage(const char *filename, int x, int y);
+
+ bool displayIndicator();
+protected:
+ Common::String _loadImageName;
+ Common::String _saveImageName;
+ int _saveImageX;
+ int _saveImageY;
+ int _loadImageX;
+ int _loadImageY;
+ BaseSurface *_saveLoadImage;
+ bool _hasDrawnSaveLoadImage;
+
+ int _indicatorWidthDrawn;
+ uint32 _indicatorColor;
+ int _indicatorX;
+ int _indicatorY;
+ int _indicatorWidth;
+ int _indicatorHeight;
+ bool _loadInProgress;
+ bool _indicatorDisplay;
+ int _indicatorProgress;
+protected:
+ uint32 _clipperWindow;
+
+ Rect32 _windowRect;
+ Rect32 _viewportRect;
+ Rect32 _screenRect;
+ Rect32 _monitorRect;
+private:
+ Common::Array<BaseActiveRect *> _rectList;
+};
+
+BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp
new file mode 100644
index 0000000000..d882adf5ad
--- /dev/null
+++ b/engines/wintermute/base/gfx/base_surface.cpp
@@ -0,0 +1,149 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/wintypes.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+BaseSurface::BaseSurface(BaseGame *inGame) : BaseClass(inGame) {
+ _referenceCount = 0;
+
+ _width = _height = 0;
+
+ _filename = "";
+
+ _pixelOpReady = false;
+
+ _ckDefault = true;
+ _ckRed = _ckGreen = _ckBlue = 0;
+ _lifeTime = 0;
+ _keepLoaded = false;
+
+ _lastUsedTime = 0;
+ _valid = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+BaseSurface::~BaseSurface() {
+ if (_pixelOpReady) {
+ endPixelOp();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSurface::restore() {
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSurface::isTransparentAt(int x, int y) {
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSurface::displayHalfTrans(int x, int y, Rect32 rect) {
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ return displayTransZoom(x, y, rect, zoomX, zoomY, alpha, blendMode, mirrorX, mirrorY);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::create(int width, int height) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::startPixelOp() {
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::endPixelOp() {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) {
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::comparePixel(int x, int y, byte r, byte g, byte b, int a) {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+bool BaseSurface::isTransparentAtLite(int x, int y) {
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::invalidate() {
+ return STATUS_FAILED;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurface::prepareToDraw() {
+ _lastUsedTime = _gameRef->_liveTimer;
+
+ if (!_valid) {
+ //_gameRef->LOG(0, "Reviving: %s", _filename);
+ return create(_filename.c_str(), _ckDefault, _ckRed, _ckGreen, _ckBlue, _lifeTime, _keepLoaded);
+ } else {
+ return STATUS_OK;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSurface::setSize(int width, int height) {
+ _width = width;
+ _height = height;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h
new file mode 100644
index 0000000000..ee53c03e77
--- /dev/null
+++ b/engines/wintermute/base/gfx/base_surface.h
@@ -0,0 +1,99 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SURFACE_H
+#define WINTERMUTE_BASE_SURFACE_H
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/math/rect32.h"
+#include "graphics/surface.h"
+
+namespace Wintermute {
+
+class BaseSurface: public BaseClass {
+public:
+ virtual bool invalidate();
+ virtual bool prepareToDraw();
+ uint32 _lastUsedTime;
+ bool _valid;
+ int _lifeTime;
+
+ bool _pixelOpReady;
+ BaseSurface(BaseGame *inGame);
+ virtual ~BaseSurface();
+
+ virtual bool displayHalfTrans(int x, int y, Rect32 rect);
+ virtual bool isTransparentAt(int x, int y);
+ virtual bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0;
+ virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool restore();
+ virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
+ virtual bool create(int width, int height);
+ virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) {
+ return STATUS_FAILED;
+ }
+ virtual bool putPixel(int x, int y, byte r, byte g, byte b, int a = -1);
+ virtual bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = NULL);
+ virtual bool comparePixel(int x, int y, byte r, byte g, byte b, int a = -1);
+ virtual bool startPixelOp();
+ virtual bool endPixelOp();
+ virtual bool isTransparentAtLite(int x, int y);
+ void setSize(int width, int height);
+
+ int _referenceCount;
+
+ virtual int getWidth() {
+ return _width;
+ }
+ virtual int getHeight() {
+ return _height;
+ }
+ Common::String getFileNameStr() { return _filename; }
+ const char* getFileName() { return _filename.c_str(); }
+ //void SetWidth(int Width){ _width = Width; }
+ //void SetHeight(int Height){ _height = Height; }
+protected:
+ bool _ckDefault;
+ byte _ckRed;
+ byte _ckGreen;
+ byte _ckBlue;
+
+ bool _keepLoaded;
+ Common::String _filename;
+ int _height;
+ int _width;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
new file mode 100644
index 0000000000..7970a25300
--- /dev/null
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -0,0 +1,609 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/gfx/osystem/base_render_osystem.h"
+#include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h"
+#include "engines/wintermute/base/base_surface_storage.h"
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/math/math_util.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "common/system.h"
+#include "engines/wintermute/graphics/transparent_surface.h"
+#include "common/queue.h"
+#include "common/config-manager.h"
+
+namespace Wintermute {
+
+RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) : _owner(owner),
+ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(true), _hasAlpha(!disableAlpha) {
+ _colorMod = 0;
+ _mirror = TransparentSurface::FLIP_NONE;
+ if (mirrorX) {
+ _mirror |= TransparentSurface::FLIP_V;
+ }
+ if (mirrorY) {
+ _mirror |= TransparentSurface::FLIP_H;
+ }
+ if (surf) {
+ _surface = new Graphics::Surface();
+ _surface->create((uint16)srcRect->width(), (uint16)srcRect->height(), surf->format);
+ assert(_surface->format.bytesPerPixel == 4);
+ // Get a clipped copy of the surface
+ for (int i = 0; i < _surface->h; i++) {
+ memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel);
+ }
+ // Then scale it if necessary
+ if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) {
+ TransparentSurface src(*_surface, false);
+ Graphics::Surface *temp = src.scale(dstRect->width(), dstRect->height());
+ _surface->free();
+ delete _surface;
+ _surface = temp;
+ }
+ } else {
+ _surface = NULL;
+ }
+}
+
+RenderTicket::~RenderTicket() {
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ }
+}
+
+bool RenderTicket::operator==(RenderTicket &t) {
+ if ((t._srcRect != _srcRect) ||
+ (t._dstRect != _dstRect) ||
+ (t._mirror != _mirror) ||
+ (t._owner != _owner) ||
+ (t._hasAlpha != _hasAlpha) ||
+ (t._colorMod != _colorMod)) {
+ return false;
+ }
+ return true;
+}
+
+BaseRenderer *makeOSystemRenderer(BaseGame *inGame) {
+ return new BaseRenderOSystem(inGame);
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) {
+ _renderSurface = new Graphics::Surface();
+ _blankSurface = new Graphics::Surface();
+ _drawNum = 1;
+ _needsFlip = true;
+
+ _borderLeft = _borderRight = _borderTop = _borderBottom = 0;
+ _ratioX = _ratioY = 1.0f;
+ setAlphaMod(255);
+ setColorMod(255, 255, 255);
+ _dirtyRect = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseRenderOSystem::~BaseRenderOSystem() {
+ _renderSurface->free();
+ delete _renderSurface;
+ _blankSurface->free();
+ delete _blankSurface;
+ TransparentSurface::destroyLookup();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
+ _width = width;
+ _height = height;
+ _renderRect.setWidth(_width);
+ _renderRect.setHeight(_height);
+
+ _realWidth = width;
+ _realHeight = height;
+
+ //TODO: Tiny resolution-displays might want to do some resolution-selection logic here
+
+ //_realWidth = BaseEngine::instance().getRegistry()->readInt("Debug", "ForceResWidth", _width);
+ //_realHeight = BaseEngine::instance().getRegistry()->readInt("Debug", "ForceResHeight", _height);
+
+ float origAspect = (float)_width / (float)_height;
+ float realAspect = (float)_realWidth / (float)_realHeight;
+
+ float ratio;
+ if (origAspect < realAspect) {
+ // normal to wide
+ ratio = (float)_realHeight / (float)_height;
+ } else {
+ // wide to normal
+ ratio = (float)_realWidth / (float)_width;
+ }
+
+ _borderLeft = (int)((_realWidth - (_width * ratio)) / 2);
+ _borderRight = (int)(_realWidth - (_width * ratio) - _borderLeft);
+
+ _borderTop = (int)((_realHeight - (_height * ratio)) / 2);
+ _borderBottom = (int)(_realHeight - (_height * ratio) - _borderTop);
+
+
+
+ _ratioX = (float)(_realWidth - _borderLeft - _borderRight) / (float)_width;
+ _ratioY = (float)(_realHeight - _borderTop - _borderBottom) / (float)_height;
+
+ _windowed = !ConfMan.getBool("fullscreen");
+
+ Graphics::PixelFormat format(4, 8, 8, 8, 8, 16, 8, 0, 24);
+ g_system->beginGFXTransaction();
+ g_system->initSize(_width, _height, &format);
+ OSystem::TransactionError gfxError = g_system->endGFXTransaction();
+
+ if (gfxError != OSystem::kTransactionSuccess) {
+ warning("Couldn't setup GFX-backend for %dx%dx%d", _width, _height, format.bytesPerPixel * 8);
+ return STATUS_FAILED;
+ }
+
+ g_system->showMouse(false);
+
+ _renderSurface->create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat());
+ _blankSurface->create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat());
+ _blankSurface->fillRect(Common::Rect(0, 0, _blankSurface->h, _blankSurface->w), _blankSurface->format.ARGBToColor(255, 0, 0, 0));
+ _active = true;
+
+ _clearColor = _renderSurface->format.ARGBToColor(255, 0, 0, 0);
+
+ return STATUS_OK;
+}
+
+void BaseRenderOSystem::setAlphaMod(byte alpha) {
+ byte r = RGBCOLGetR(_colorMod);
+ byte g = RGBCOLGetB(_colorMod);
+ byte b = RGBCOLGetB(_colorMod);
+ _colorMod = BS_ARGB(alpha, r, g, b);
+}
+
+void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) {
+ byte alpha = RGBCOLGetA(_colorMod);
+ _colorMod = BS_ARGB(alpha, r, g, b);
+}
+
+bool BaseRenderOSystem::indicatorFlip() {
+ g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight);
+ g_system->updateScreen();
+ return STATUS_OK;
+}
+
+bool BaseRenderOSystem::flip() {
+ if (!_disableDirtyRects) {
+ drawTickets();
+ } else {
+ // Clear the scale-buffered tickets that wasn't reused.
+ RenderQueueIterator it = _renderQueue.begin();
+ while (it != _renderQueue.end()) {
+ if ((*it)->_wantsDraw == false) {
+ RenderTicket *ticket = *it;
+ it = _renderQueue.erase(it);
+ delete ticket;
+ } else {
+ (*it)->_wantsDraw = false;
+ ++it;
+ }
+ }
+ }
+ if (_needsFlip || _disableDirtyRects) {
+ if (_disableDirtyRects) {
+ g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
+ }
+ // g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height());
+ delete _dirtyRect;
+ _dirtyRect = NULL;
+ g_system->updateScreen();
+ _needsFlip = false;
+ }
+ _drawNum = 1;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderOSystem::fill(byte r, byte g, byte b, Common::Rect *rect) {
+ _clearColor = _renderSurface->format.ARGBToColor(0xFF, r, g, b);
+ if (!_disableDirtyRects) {
+ return STATUS_OK;
+ }
+ if (!rect) {
+// TODO: This should speed things up, but for some reason it misses the size by quite a bit.
+/* if (r == 0 && g == 0 && b == 0) {
+ // Simply memcpy from the buffered black-surface, way faster than Surface::fillRect.
+ memcpy(_renderSurface->pixels, _blankSurface->pixels, _renderSurface->pitch * _renderSurface->h);
+ return STATUS_OK;
+ }*/
+ rect = &_renderRect;
+ }
+ // TODO: This doesn't work with dirty rects
+ _renderSurface->fillRect(*rect, _clearColor);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderOSystem::fade(uint16 alpha) {
+ byte dwAlpha = (byte)(255 - alpha);
+ return fadeToColor(0, 0, 0, dwAlpha);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect) {
+ // This particular warning is rather messy, as this function is called a ton,
+ // thus we avoid printing it more than once.
+
+ // TODO: Add fading with dirty rects.
+ if (!_disableDirtyRects) {
+ warning("BaseRenderOSystem::FadeToColor - Breaks when using dirty rects");
+ }
+
+ Common::Rect fillRect;
+
+ if (rect) {
+ fillRect.left = rect->left;
+ fillRect.top = rect->top;
+ fillRect.setWidth(rect->width());
+ fillRect.setHeight(rect->height());
+ } else {
+ Rect32 rc;
+ _gameRef->getCurrentViewportRect(&rc);
+ fillRect.left = (int16)rc.left;
+ fillRect.top = (int16)rc.top;
+ fillRect.setWidth((int16)(rc.right - rc.left));
+ fillRect.setHeight((int16)(rc.bottom - rc.top));
+ }
+ modTargetRect(&fillRect);
+
+ //TODO: This is only here until I'm sure about the final pixelformat
+ uint32 col = _renderSurface->format.ARGBToColor(a, r, g, b);
+
+ setAlphaMod(255);
+ setColorMod(255, 255, 255);
+ Graphics::Surface surf;
+ surf.create((uint16)fillRect.width(), (uint16)fillRect.height(), _renderSurface->format);
+ Common::Rect sizeRect(fillRect);
+ sizeRect.translate(-fillRect.top, -fillRect.left);
+ surf.fillRect(fillRect, col);
+ drawSurface(NULL, &surf, &sizeRect, &fillRect, false, false);
+ surf.free();
+
+ //SDL_SetRenderDrawColor(_renderer, r, g, b, a);
+ //SDL_SetRenderDrawBlendMode(_renderer, SDL_BLENDMODE_BLEND);
+ //SDL_RenderFillRect(_renderer, &fillRect);
+}
+
+Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const {
+ return _renderSurface->format;
+}
+
+void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) {
+ // Skip rects that are completely outside the screen:
+ if ((dstRect->left < 0 && dstRect->right < 0) || (dstRect->top < 0 && dstRect->bottom < 0)) {
+ return;
+ }
+
+ if (owner) { // Fade-tickets are owner-less
+ RenderTicket compare(owner, NULL, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
+ compare._colorMod = _colorMod;
+ RenderQueueIterator it;
+ for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) {
+ if ((*it)->_owner == owner && *(*it) == compare && (*it)->_isValid) {
+ (*it)->_colorMod = _colorMod;
+ if (_disableDirtyRects) {
+ drawFromSurface(*it, NULL);
+ } else {
+ drawFromTicket(*it);
+ }
+ return;
+ }
+ }
+ }
+ RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
+ ticket->_colorMod = _colorMod;
+ if (!_disableDirtyRects) {
+ drawFromTicket(ticket);
+ } else {
+ ticket->_wantsDraw = true;
+ _renderQueue.push_back(ticket);
+ drawFromSurface(ticket, NULL);
+ }
+}
+
+void BaseRenderOSystem::invalidateTicket(RenderTicket *renderTicket) {
+ addDirtyRect(renderTicket->_dstRect);
+ renderTicket->_isValid = false;
+// renderTicket->_canDelete = true; // TODO: Maybe readd this, to avoid even more duplicates.
+}
+
+void BaseRenderOSystem::invalidateTicketsFromSurface(BaseSurfaceOSystem *surf) {
+ RenderQueueIterator it;
+ for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) {
+ if ((*it)->_owner == surf) {
+ invalidateTicket(*it);
+ }
+ }
+}
+
+void BaseRenderOSystem::drawFromTicket(RenderTicket *renderTicket) {
+ renderTicket->_wantsDraw = true;
+ // A new item always has _drawNum == 0
+ if (renderTicket->_drawNum == 0) {
+ // In-order
+ if (_renderQueue.empty() || _drawNum > (_renderQueue.back())->_drawNum) {
+ renderTicket->_drawNum = _drawNum++;
+ _renderQueue.push_back(renderTicket);
+ addDirtyRect(renderTicket->_dstRect);
+ } else {
+ // Before something
+ Common::List<RenderTicket *>::iterator pos;
+ for (pos = _renderQueue.begin(); pos != _renderQueue.end(); pos++) {
+ if ((*pos)->_drawNum >= _drawNum) {
+ break;
+ }
+ }
+ _renderQueue.insert(pos, renderTicket);
+ Common::List<RenderTicket *>::iterator it;
+ renderTicket->_drawNum = _drawNum++;
+ // Increment the following tickets, so they still are in line
+ for (it = pos; it != _renderQueue.end(); ++it) {
+ (*it)->_drawNum++;
+ (*it)->_wantsDraw = false;
+ }
+ addDirtyRect(renderTicket->_dstRect);
+ }
+ } else {
+ // Was drawn last round, still in the same order
+ if (_drawNum == renderTicket->_drawNum) {
+ _drawNum++;
+ } else {
+ // Remove the ticket from the list
+ RenderQueueIterator it = _renderQueue.begin();
+ while (it != _renderQueue.end()) {
+ if ((*it) == renderTicket) {
+ it = _renderQueue.erase(it);
+ break;
+ } else {
+ ++it;
+ }
+ }
+ if (it != _renderQueue.end()) {
+ // Decreement the following tickets.
+ for (; it != _renderQueue.end(); ++it) {
+ (*it)->_drawNum--;
+ }
+ }
+ // Is not in order, so readd it as if it was a new ticket
+ renderTicket->_drawNum = 0;
+ drawFromTicket(renderTicket);
+ }
+ }
+}
+
+void BaseRenderOSystem::addDirtyRect(const Common::Rect &rect) {
+ if (!_dirtyRect) {
+ _dirtyRect = new Common::Rect(rect);
+ } else {
+ _dirtyRect->extend(rect);
+ }
+ _dirtyRect->clip(_renderRect);
+}
+
+void BaseRenderOSystem::drawTickets() {
+ RenderQueueIterator it = _renderQueue.begin();
+ // Clean out the old tickets
+ int decrement = 0;
+ while (it != _renderQueue.end()) {
+ if ((*it)->_wantsDraw == false || (*it)->_isValid == false) {
+ RenderTicket *ticket = *it;
+ addDirtyRect((*it)->_dstRect);
+ it = _renderQueue.erase(it);
+ delete ticket;
+ decrement++;
+ } else {
+ (*it)->_drawNum -= decrement;
+ ++it;
+ }
+ }
+ if (!_dirtyRect || _dirtyRect->width() == 0 || _dirtyRect->height() == 0) {
+ return;
+ }
+ // The color-mods are stored in the RenderTickets on add, since we set that state again during
+ // draw, we need to keep track of what it was prior to draw.
+ uint32 oldColorMod = _colorMod;
+
+ // Apply the clear-color to the dirty rect.
+ _renderSurface->fillRect(*_dirtyRect, _clearColor);
+ _drawNum = 1;
+ for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) {
+ RenderTicket *ticket = *it;
+ assert(ticket->_drawNum == _drawNum++);
+ if (ticket->_isValid && ticket->_dstRect.intersects(*_dirtyRect)) {
+ // dstClip is the area we want redrawn.
+ Common::Rect dstClip(ticket->_dstRect);
+ // reduce it to the dirty rect
+ dstClip.clip(*_dirtyRect);
+ // we need to keep track of the position to redraw the dirty rect
+ Common::Rect pos(dstClip);
+ int16 offsetX = ticket->_dstRect.left;
+ int16 offsetY = ticket->_dstRect.top;
+ // convert from screen-coords to surface-coords.
+ dstClip.translate(-offsetX, -offsetY);
+
+ _colorMod = ticket->_colorMod;
+ drawFromSurface(ticket->getSurface(), &ticket->_srcRect, &pos, &dstClip, ticket->_mirror);
+ _needsFlip = true;
+ }
+ // Some tickets want redraw but don't actually clip the dirty area (typically the ones that shouldnt become clear-color)
+ ticket->_wantsDraw = false;
+ }
+ g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_dirtyRect->left, _dirtyRect->top), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height());
+
+ // Revert the colorMod-state.
+ _colorMod = oldColorMod;
+}
+
+// Replacement for SDL2's SDL_RenderCopy
+void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *clipRect) {
+ TransparentSurface src(*ticket->getSurface(), false);
+ bool doDelete = false;
+ if (!clipRect) {
+ doDelete = true;
+ clipRect = new Common::Rect();
+ clipRect->setWidth(ticket->getSurface()->w);
+ clipRect->setHeight(ticket->getSurface()->h);
+ }
+
+ src._enableAlphaBlit = ticket->_hasAlpha;
+ src.blit(*_renderSurface, ticket->_dstRect.left, ticket->_dstRect.top, ticket->_mirror, clipRect, _colorMod, clipRect->width(), clipRect->height());
+ if (doDelete) {
+ delete clipRect;
+ }
+}
+void BaseRenderOSystem::drawFromSurface(const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect, uint32 mirror) {
+ TransparentSurface src(*surf, false);
+ bool doDelete = false;
+ if (!clipRect) {
+ doDelete = true;
+ clipRect = new Common::Rect();
+ clipRect->setWidth(surf->w);
+ clipRect->setHeight(surf->h);
+ }
+
+ src.blit(*_renderSurface, dstRect->left, dstRect->top, mirror, clipRect, _colorMod, clipRect->width(), clipRect->height());
+ if (doDelete) {
+ delete clipRect;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderOSystem::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
+
+ if (!_disableDirtyRects) {
+ warning("BaseRenderOSystem::DrawLine - doesn't work for dirty rects yet");
+ }
+
+ byte r = RGBCOLGetR(color);
+ byte g = RGBCOLGetG(color);
+ byte b = RGBCOLGetB(color);
+ byte a = RGBCOLGetA(color);
+
+ //SDL_SetRenderDrawColor(_renderer, r, g, b, a);
+ //SDL_SetRenderDrawBlendMode(_renderer, SDL_BLENDMODE_BLEND);
+
+ Point32 point1, point2;
+ point1.x = x1;
+ point1.y = y1;
+ pointToScreen(&point1);
+
+ point2.x = x2;
+ point2.y = y2;
+ pointToScreen(&point2);
+
+ // TODO: This thing is mostly here until I'm sure about the final color-format.
+ uint32 colorVal = _renderSurface->format.ARGBToColor(a, r, g, b);
+ _renderSurface->drawLine(point1.x, point1.y, point2.x, point2.y, colorVal);
+ //SDL_RenderDrawLine(_renderer, point1.x, point1.y, point2.x, point2.y);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseImage *BaseRenderOSystem::takeScreenshot() {
+// TODO: Clip by viewport.
+ BaseImage *screenshot = new BaseImage();
+ screenshot->copyFrom(_renderSurface);
+ return screenshot;
+}
+
+//////////////////////////////////////////////////////////////////////////
+Common::String BaseRenderOSystem::getName() const {
+ return "ScummVM-OSystem-renderer";
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderOSystem::setViewport(int left, int top, int right, int bottom) {
+ Common::Rect rect;
+ // TODO: Hopefully this is the same logic that ScummVM uses.
+ rect.left = (int16)(left + _borderLeft);
+ rect.top = (int16)(top + _borderTop);
+ rect.right = (int16)((right - left) * _ratioX);
+ rect.bottom = (int16)((bottom - top) * _ratioY);
+
+ _renderRect = rect;
+ return STATUS_OK;
+}
+
+Rect32 BaseRenderOSystem::getViewPort() {
+ Rect32 ret;
+ ret.top = _renderRect.top;
+ ret.bottom = _renderRect.bottom;
+ ret.left = _renderRect.left;
+ ret.right = _renderRect.right;
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderOSystem::modTargetRect(Common::Rect *rect) {
+ // FIXME: This is wrong in quite a few ways right now, and ends up
+ // breaking the notebook in Dirty Split, so we disable the correction
+ // for now, this will need fixing when a game with odd aspect-ratios
+ // show up.
+ return;
+ rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft - _renderRect.left);
+ rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop - _renderRect.top);
+ rect->setWidth((int16)MathUtil::roundUp(rect->width() * _ratioX));
+ rect->setHeight((int16)MathUtil::roundUp(rect->height() * _ratioY));
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderOSystem::pointFromScreen(Point32 *point) {
+ point->x = (int16)(point->x / _ratioX - _borderLeft / _ratioX + _renderRect.left);
+ point->y = (int16)(point->y / _ratioY - _borderTop / _ratioY + _renderRect.top);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderOSystem::pointToScreen(Point32 *point) {
+ point->x = (int16)MathUtil::roundUp(point->x * _ratioX) + _borderLeft - _renderRect.left;
+ point->y = (int16)MathUtil::roundUp(point->y * _ratioY) + _borderTop - _renderRect.top;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseRenderOSystem::dumpData(const char *filename) {
+ warning("BaseRenderOSystem::DumpData(%s) - stubbed", filename); // TODO
+}
+
+BaseSurface *BaseRenderOSystem::createSurface() {
+ return new BaseSurfaceOSystem(_gameRef);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
new file mode 100644
index 0000000000..1e72508cd0
--- /dev/null
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
@@ -0,0 +1,131 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_RENDERER_SDL_H
+#define WINTERMUTE_BASE_RENDERER_SDL_H
+
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "common/rect.h"
+#include "graphics/surface.h"
+#include "common/list.h"
+
+namespace Wintermute {
+class BaseSurfaceOSystem;
+class RenderTicket {
+ Graphics::Surface *_surface;
+public:
+ RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false, bool disableAlpha = false);
+ RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {}
+ ~RenderTicket();
+ const Graphics::Surface *getSurface() { return _surface; }
+ Common::Rect _srcRect;
+ Common::Rect _dstRect;
+ uint32 _mirror;
+ bool _hasAlpha;
+
+ bool _isValid;
+ bool _wantsDraw;
+ uint32 _drawNum;
+ uint32 _colorMod;
+
+ BaseSurfaceOSystem *_owner;
+ bool operator==(RenderTicket &a);
+};
+
+class BaseRenderOSystem : public BaseRenderer {
+public:
+ BaseRenderOSystem(BaseGame *inGame);
+ ~BaseRenderOSystem();
+
+ Common::String getName() const;
+
+ bool initRenderer(int width, int height, bool windowed);
+ bool flip();
+ virtual bool indicatorFlip();
+ bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL);
+ Graphics::PixelFormat getPixelFormat() const;
+ void fade(uint16 alpha);
+ void fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect = NULL);
+
+ bool drawLine(int x1, int y1, int x2, int y2, uint32 color);
+
+ BaseImage *takeScreenshot();
+
+ void setAlphaMod(byte alpha);
+ void setColorMod(byte r, byte g, byte b);
+ void invalidateTicket(RenderTicket *renderTicket);
+ void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf);
+ void drawFromTicket(RenderTicket *renderTicket);
+
+ bool setViewport(int left, int top, int right, int bottom);
+ bool setViewport(Rect32 *rect) { return BaseRenderer::setViewport(rect); }
+ Rect32 getViewPort();
+ void modTargetRect(Common::Rect *rect);
+ void pointFromScreen(Point32 *point);
+ void pointToScreen(Point32 *point);
+
+ void dumpData(const char *filename);
+
+ float getScaleRatioX() const {
+ return _ratioX;
+ }
+ float getScaleRatioY() const {
+ return _ratioY;
+ }
+
+ void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha = false);
+ BaseSurface *createSurface();
+private:
+ void addDirtyRect(const Common::Rect &rect);
+ void drawTickets();
+ void drawFromSurface(RenderTicket *ticket, Common::Rect *clipRect);
+ void drawFromSurface(const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect, uint32 mirror);
+ typedef Common::List<RenderTicket *>::iterator RenderQueueIterator;
+ Common::Rect *_dirtyRect;
+ Common::List<RenderTicket *> _renderQueue;
+ bool _needsFlip;
+ uint32 _drawNum;
+ Common::Rect _renderRect;
+ Graphics::Surface *_renderSurface;
+ Graphics::Surface *_blankSurface;
+
+ int _borderLeft;
+ int _borderTop;
+ int _borderRight;
+ int _borderBottom;
+
+ static const bool _disableDirtyRects = true;
+ float _ratioX;
+ float _ratioY;
+ uint32 _colorMod;
+ uint32 _clearColor;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
new file mode 100644
index 0000000000..bee876bb65
--- /dev/null
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -0,0 +1,428 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h"
+#include "engines/wintermute/base/gfx/osystem/base_render_osystem.h"
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "graphics/decoders/png.h"
+#include "graphics/decoders/bmp.h"
+#include "graphics/decoders/jpeg.h"
+#include "graphics/decoders/tga.h"
+#include "engines/wintermute/graphics/transparent_surface.h"
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "common/stream.h"
+#include "common/system.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) {
+ _surface = new Graphics::Surface();
+ _alphaMask = NULL;
+ _hasAlpha = true;
+ _lockPixels = NULL;
+ _lockPitch = 0;
+ _loaded = false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSurfaceOSystem::~BaseSurfaceOSystem() {
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ _surface = NULL;
+ }
+
+ delete[] _alphaMask;
+ _alphaMask = NULL;
+
+ _gameRef->addMem(-_width * _height * 4);
+ BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
+ renderer->invalidateTicketsFromSurface(this);
+}
+
+bool hasTransparency(Graphics::Surface *surf) {
+ if (surf->format.bytesPerPixel != 4) {
+ warning("hasTransparency:: non 32 bpp surface passed as argument");
+ return false;
+ }
+ uint8 r, g, b, a;
+ for (int i = 0; i < surf->h; i++) {
+ for (int j = 0; j < surf->w; j++) {
+ uint32 pix = *(uint32 *)surf->getBasePtr(j, i);
+ surf->format.colorToARGB(pix, a, r, g, b);
+ if (a != 255) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+ /* BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer); */
+ _filename = filename;
+// const Graphics::Surface *surface = image->getSurface();
+
+ if (defaultCK) {
+ ckRed = 255;
+ ckGreen = 0;
+ ckBlue = 255;
+ }
+
+ _ckDefault = defaultCK;
+ _ckRed = ckRed;
+ _ckGreen = ckGreen;
+ _ckBlue = ckBlue;
+
+ if (_lifeTime == 0 || lifeTime == -1 || lifeTime > _lifeTime) {
+ _lifeTime = lifeTime;
+ }
+
+ _keepLoaded = keepLoaded;
+ if (_keepLoaded) {
+ _lifeTime = -1;
+ }
+
+ return STATUS_OK;
+}
+
+bool BaseSurfaceOSystem::finishLoad() {
+ BaseImage *image = new BaseImage();
+ if (!image->loadFile(_filename)) {
+ return false;
+ }
+
+ _width = image->getSurface()->w;
+ _height = image->getSurface()->h;
+
+ bool isSaveGameGrayscale = scumm_strnicmp(_filename.c_str(), "savegame:", 9) == 0 && (_filename.c_str()[_filename.size() - 1] == 'g' || _filename.c_str()[_filename.size() - 1] == 'G');
+ if (isSaveGameGrayscale) {
+ warning("grayscaleConversion not yet implemented");
+ // FIBITMAP *newImg = FreeImage_ConvertToGreyscale(img); TODO
+ }
+
+ // no alpha, set color key
+ /* if (surface->format.bytesPerPixel != 4)
+ SDL_SetColorKey(surf, SDL_TRUE, SDL_MapRGB(surf->format, ck_red, ck_green, ck_blue));*/
+
+ // convert 32-bit BMPs to 24-bit or they appear totally transparent (does any app actually write alpha in BMP properly?)
+ // Well, actually, we don't convert via 24-bit as the color-key application overwrites the Alpha-channel anyhow.
+ _surface->free();
+ delete _surface;
+ if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
+ _surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
+ TransparentSurface trans(*_surface);
+ trans.applyColorKey(_ckRed, _ckGreen, _ckBlue);
+ } else if (image->getSurface()->format.bytesPerPixel == 1 && image->getPalette()) {
+ _surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
+ TransparentSurface trans(*_surface);
+ trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, true);
+ } else if (image->getSurface()->format.bytesPerPixel >= 3 && image->getSurface()->format != g_system->getScreenFormat()) {
+ _surface = image->getSurface()->convertTo(g_system->getScreenFormat());
+ if (image->getSurface()->format.bytesPerPixel == 3) {
+ TransparentSurface trans(*_surface);
+ trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, true);
+ }
+ } else {
+ _surface = new Graphics::Surface();
+ _surface->copyFrom(*image->getSurface());
+ }
+
+ _hasAlpha = hasTransparency(_surface);
+ _valid = true;
+
+ _gameRef->addMem(_width * _height * 4);
+
+ delete image;
+
+ _loaded = true;
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) {
+ warning("BaseSurfaceOSystem::GenAlphaMask - Not ported yet");
+ return;
+ // TODO: Reimplement this
+ delete[] _alphaMask;
+ _alphaMask = NULL;
+ if (!surface) {
+ return;
+ }
+
+ bool hasColorKey;
+ /* uint32 colorKey; */
+ uint8 ckRed, ckGreen, ckBlue;
+ /* if (SDL_GetColorKey(surface, &colorKey) == 0) {
+ hasColorKey = true;
+ SDL_GetRGB(colorKey, surface->format, &ckRed, &ckGreen, &ckBlue);
+ } else hasColorKey = false;
+ */
+ _alphaMask = new byte[surface->w * surface->h];
+
+ bool hasTransparency = false;
+ for (int y = 0; y < surface->h; y++) {
+ for (int x = 0; x < surface->w; x++) {
+ uint32 pixel = getPixelAt(surface, x, y);
+
+ uint8 r, g, b, a;
+ surface->format.colorToARGB(pixel, a, r, g, b);
+ //SDL_GetRGBA(pixel, surface->format, &r, &g, &b, &a);
+
+ if (hasColorKey && r == ckRed && g == ckGreen && b == ckBlue) {
+ a = 0;
+ }
+
+ _alphaMask[y * surface->w + x] = a;
+ if (a < 255) {
+ hasTransparency = true;
+ }
+ }
+ }
+
+ if (!hasTransparency) {
+ delete[] _alphaMask;
+ _alphaMask = NULL;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseSurfaceOSystem::getPixelAt(Graphics::Surface *surface, int x, int y) {
+ warning("BaseSurfaceOSystem::GetPixel - Not ported yet");
+ int bpp = surface->format.bytesPerPixel;
+ /* Here p is the address to the pixel we want to retrieve */
+ uint8 *p = (uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+
+ switch (bpp) {
+ case 1:
+ return *p;
+ break;
+
+ case 2:
+ return *(uint16 *)p;
+ break;
+
+ case 3:
+#ifdef SCUMM_BIG_ENDIAN
+ // if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ return p[0] << 16 | p[1] << 8 | p[2];
+#else
+ //else
+ return p[0] | p[1] << 8 | p[2] << 16;
+#endif
+ break;
+
+ case 4:
+ return *(uint32 *)p;
+ break;
+
+ default:
+ return 0; /* shouldn't happen, but avoids warnings */
+ }
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::create(int width, int height) {
+ _width = width;
+ _height = height;
+
+ _gameRef->addMem(_width * _height * 4);
+
+ _valid = true;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::isTransparentAt(int x, int y) {
+ return isTransparentAtLite(x, y);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::isTransparentAtLite(int x, int y) {
+ if (x < 0 || x >= _surface->w || y < 0 || y >= _surface->h) {
+ return true;
+ }
+
+ if (_surface->format.bytesPerPixel == 4) {
+ uint32 pixel = *(uint32 *)_surface->getBasePtr(x, y);
+ uint8 r, g, b, a;
+ _surface->format.colorToARGB(pixel, a, r, g, b);
+ if (a <= 128) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::startPixelOp() {
+ //SDL_LockTexture(_texture, NULL, &_lockPixels, &_lockPitch);
+ // Any pixel-op makes the caching useless:
+ BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
+ renderer->invalidateTicketsFromSurface(this);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::endPixelOp() {
+ //SDL_UnlockTexture(_texture);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
+ return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY, offsetX, offsetY);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ return drawSprite(x, y, &rect, zoomX, zoomY, alpha, !transparent, blendMode, mirrorX, mirrorY);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
+ BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
+
+ if (!_loaded) {
+ finishLoad();
+ }
+
+ if (renderer->_forceAlphaColor != 0) {
+ alpha = renderer->_forceAlphaColor;
+ }
+
+ byte r = RGBCOLGetR(alpha);
+ byte g = RGBCOLGetG(alpha);
+ byte b = RGBCOLGetB(alpha);
+ byte a = RGBCOLGetA(alpha);
+
+ renderer->setAlphaMod(a);
+ renderer->setColorMod(r, g, b);
+
+#if 0 // These are kept for reference if BlendMode is reimplemented at some point.
+ if (alphaDisable) {
+ SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_NONE);
+ } else {
+ SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_BLEND);
+ }
+#endif
+ // TODO: This _might_ miss the intended behaviour by 1 in each direction
+ // But I think it fits the model used in Wintermute.
+ Common::Rect srcRect;
+ srcRect.left = rect->left;
+ srcRect.top = rect->top;
+ srcRect.setWidth(rect->right - rect->left);
+ srcRect.setHeight(rect->bottom - rect->top);
+
+ Common::Rect position;
+ position.left = x + offsetX;
+ position.top = y + offsetY;
+
+ // Crop off-by-ones:
+ if (position.left == -1) {
+ position.left = 0; // TODO: Something is wrong
+ }
+ if (position.top == -1) {
+ position.top = 0; // TODO: Something is wrong
+ }
+
+ position.setWidth((int16)((float)srcRect.width() * zoomX / 100.f));
+ position.setHeight((int16)((float)srcRect.height() * zoomX / 100.f));
+
+ renderer->modTargetRect(&position);
+
+ /* position.left += offsetX;
+ position.top += offsetY;*/
+
+ // TODO: This actually requires us to have the SAME source-offsets every time,
+ // But no checking is in place for that yet.
+
+ // TODO: Optimize by not doing alpha-blits if we lack or disable alpha
+ bool hasAlpha;
+ if (_hasAlpha && !alphaDisable) {
+ hasAlpha = true;
+ } else {
+ hasAlpha = false;
+ }
+ if (alphaDisable) {
+ warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored");
+ }
+
+ renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, !hasAlpha);
+
+ return STATUS_OK;
+}
+
+bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) {
+ _loaded = true;
+ _surface->free();
+ _surface->copyFrom(surface);
+ _hasAlpha = hasAlpha;
+ BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
+ renderer->invalidateTicketsFromSurface(this);
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
new file mode 100644
index 0000000000..43422ef4e7
--- /dev/null
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -0,0 +1,99 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SURFACESDL_H
+#define WINTERMUTE_BASE_SURFACESDL_H
+
+#include "graphics/surface.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "common/list.h"
+
+namespace Wintermute {
+struct TransparentSurface;
+class BaseImage;
+class BaseSurfaceOSystem : public BaseSurface {
+public:
+ BaseSurfaceOSystem(BaseGame *inGame);
+ ~BaseSurfaceOSystem();
+
+ bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false);
+ bool create(int width, int height);
+
+ bool isTransparentAt(int x, int y);
+ bool isTransparentAtLite(int x, int y);
+
+ bool startPixelOp();
+ bool endPixelOp();
+
+
+ bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0);
+ bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ bool displayTransform(int x, int y, int hotX, int hotY, Rect32 Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false);
+ /* static unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
+ static int DLL_CALLCONV SeekProc(fi_handle handle, long offset, int origin);
+ static long DLL_CALLCONV TellProc(fi_handle handle);*/
+ virtual int getWidth() {
+ if (!_loaded) {
+ finishLoad();
+ }
+ if (_surface) {
+ return _surface->w;
+ }
+ return _width;
+ }
+ virtual int getHeight() {
+ if (!_loaded) {
+ finishLoad();
+ }
+ if (_surface) {
+ return _surface->h;
+ }
+ return _height;
+ }
+
+private:
+ Graphics::Surface *_surface;
+ bool _loaded;
+ bool finishLoad();
+ bool drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0);
+ void genAlphaMask(Graphics::Surface *surface);
+ uint32 getPixelAt(Graphics::Surface *surface, int x, int y);
+
+ bool _hasAlpha;
+ void *_lockPixels;
+ int _lockPitch;
+ byte *_alphaMask;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp
new file mode 100644
index 0000000000..bab4d4609e
--- /dev/null
+++ b/engines/wintermute/base/particles/part_emitter.cpp
@@ -0,0 +1,1257 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/particles/part_particle.h"
+#include "engines/wintermute/math/vector2.h"
+#include "engines/wintermute/math/matrix4.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+#include "common/math.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(PartEmitter, false)
+
+//////////////////////////////////////////////////////////////////////////
+PartEmitter::PartEmitter(BaseGame *inGame, BaseScriptHolder *owner) : BaseObject(inGame) {
+ _width = _height = 0;
+
+ BasePlatform::setRectEmpty(&_border);
+ _borderThicknessLeft = _borderThicknessRight = _borderThicknessTop = _borderThicknessBottom = 0;
+
+ _angle1 = _angle2 = 0;
+
+ _velocity1 = _velocity2 = 0.0f;
+ _velocityZBased = false;
+
+ _scale1 = _scale2 = 100.0f;
+ _scaleZBased = false;
+
+ _maxParticles = 100;
+
+ _lifeTime1 = _lifeTime2 = 1000;
+ _lifeTimeZBased = false;
+
+ _lastGenTime = 0;
+ _genInterval = 0;
+ _genAmount = 1;
+
+ _overheadTime = 0;
+ _running = false;
+
+ _maxBatches = 0;
+ _batchesGenerated = 0;
+
+ _fadeInTime = _fadeOutTime = 0;
+
+ _alpha1 = _alpha2 = 255;
+ _alphaTimeBased = false;
+
+ _rotation1 = _rotation2 = 0.0f;
+ _angVelocity1 = _angVelocity2 = 0.0f;
+
+ _growthRate1 = _growthRate2 = 0.0f;
+ _exponentialGrowth = false;
+
+ _useRegion = false;
+
+ _emitEvent = NULL;
+ _owner = owner;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+PartEmitter::~PartEmitter(void) {
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ delete _particles[i];
+ }
+ _particles.clear();
+
+ for (uint32 i = 0; i < _forces.size(); i++) {
+ delete _forces[i];
+ }
+ _forces.clear();
+
+
+ for (uint32 i = 0; i < _sprites.size(); i++) {
+ delete[] _sprites[i];
+ }
+ _sprites.clear();
+
+ delete[] _emitEvent;
+ _emitEvent = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::addSprite(const char *filename) {
+ if (!filename) {
+ return STATUS_FAILED;
+ }
+
+ // do we already have the file?
+ for (uint32 i = 0; i < _sprites.size(); i++) {
+ if (scumm_stricmp(filename, _sprites[i]) == 0) {
+ return STATUS_OK;
+ }
+ }
+
+ // check if file exists
+ Common::SeekableReadStream *File = BaseFileManager::getEngineInstance()->openFile(filename);
+ if (!File) {
+ _gameRef->LOG(0, "Sprite '%s' not found", filename);
+ return STATUS_FAILED;
+ } else {
+ BaseFileManager::getEngineInstance()->closeFile(File);
+ }
+
+ char *str = new char[strlen(filename) + 1];
+ strcpy(str, filename);
+ _sprites.add(str);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::removeSprite(const char *filename) {
+ for (uint32 i = 0; i < _sprites.size(); i++) {
+ if (scumm_stricmp(filename, _sprites[i]) == 0) {
+ delete[] _sprites[i];
+ _sprites.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta) {
+ if (!particle) {
+ return STATUS_FAILED;
+ }
+ if (_sprites.size() == 0) {
+ return STATUS_FAILED;
+ }
+
+ int posX = BaseUtils::randomInt(_posX, _posX + _width);
+ int posY = BaseUtils::randomInt(_posY, _posY + _height);
+ float posZ = BaseUtils::randomFloat(0.0f, 100.0f);
+
+ float velocity;
+ if (_velocityZBased) {
+ velocity = _velocity1 + posZ * (_velocity2 - _velocity1) / 100;
+ } else {
+ velocity = BaseUtils::randomFloat(_velocity1, _velocity2);
+ }
+
+ float scale;
+ if (_scaleZBased) {
+ scale = _scale1 + posZ * (_scale2 - _scale1) / 100;
+ } else {
+ scale = BaseUtils::randomFloat(_scale1, _scale2);
+ }
+
+ int lifeTime;
+ if (_lifeTimeZBased) {
+ lifeTime = (int)(_lifeTime2 - posZ * (_lifeTime2 - _lifeTime1) / 100);
+ } else {
+ lifeTime = BaseUtils::randomInt(_lifeTime1, _lifeTime2);
+ }
+
+ float angle = BaseUtils::randomAngle(_angle1, _angle2);
+ int spriteIndex = BaseUtils::randomInt(0, _sprites.size() - 1);
+
+ float rotation = BaseUtils::randomAngle(_rotation1, _rotation2);
+ float angVelocity = BaseUtils::randomFloat(_angVelocity1, _angVelocity2);
+ float growthRate = BaseUtils::randomFloat(_growthRate1, _growthRate2);
+
+ if (!BasePlatform::isRectEmpty(&_border)) {
+ int thicknessLeft = (int)(_borderThicknessLeft - (float)_borderThicknessLeft * posZ / 100.0f);
+ int thicknessRight = (int)(_borderThicknessRight - (float)_borderThicknessRight * posZ / 100.0f);
+ int thicknessTop = (int)(_borderThicknessTop - (float)_borderThicknessTop * posZ / 100.0f);
+ int thicknessBottom = (int)(_borderThicknessBottom - (float)_borderThicknessBottom * posZ / 100.0f);
+
+ particle->_border = _border;
+ particle->_border.left += thicknessLeft;
+ particle->_border.right -= thicknessRight;
+ particle->_border.top += thicknessTop;
+ particle->_border.bottom -= thicknessBottom;
+ }
+
+ Vector2 vecPos((float)posX, (float)posY);
+ Vector2 vecVel(0, velocity);
+
+ Matrix4 matRot;
+ matRot.rotationZ(Common::deg2rad(BaseUtils::normalizeAngle(angle - 180)));
+ matRot.transformVector2(vecVel);
+
+ if (_alphaTimeBased) {
+ particle->_alpha1 = _alpha1;
+ particle->_alpha2 = _alpha2;
+ } else {
+ int alpha = BaseUtils::randomInt(_alpha1, _alpha2);
+ particle->_alpha1 = alpha;
+ particle->_alpha2 = alpha;
+ }
+
+ particle->_creationTime = currentTime;
+ particle->_pos = vecPos;
+ particle->_posZ = posZ;
+ particle->_velocity = vecVel;
+ particle->_scale = scale;
+ particle->_lifeTime = lifeTime;
+ particle->_rotation = rotation;
+ particle->_angVelocity = angVelocity;
+ particle->_growthRate = growthRate;
+ particle->_exponentialGrowth = _exponentialGrowth;
+ particle->_isDead = DID_FAIL(particle->setSprite(_sprites[spriteIndex]));
+ particle->fadeIn(currentTime, _fadeInTime);
+
+
+ if (particle->_isDead) {
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::update() {
+ if (!_running) {
+ return STATUS_OK;
+ } else {
+ return updateInternal(_gameRef->_timer, _gameRef->_timerDelta);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) {
+ int numLive = 0;
+
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ _particles[i]->update(this, currentTime, timerDelta);
+
+ if (!_particles[i]->_isDead) {
+ numLive++;
+ }
+ }
+
+
+ // we're understaffed
+ if (numLive < _maxParticles) {
+ bool needsSort = false;
+ if ((int)(currentTime - _lastGenTime) > _genInterval) {
+ _lastGenTime = currentTime;
+ _batchesGenerated++;
+
+ if (_maxBatches > 0 && _batchesGenerated > _maxBatches) {
+ return STATUS_OK;
+ }
+
+ int toGen = MIN(_genAmount, _maxParticles - numLive);
+ while (toGen > 0) {
+ int firstDeadIndex = -1;
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ if (_particles[i]->_isDead) {
+ firstDeadIndex = i;
+ break;
+ }
+ }
+
+ PartParticle *particle;
+ if (firstDeadIndex >= 0) {
+ particle = _particles[firstDeadIndex];
+ } else {
+ particle = new PartParticle(_gameRef);
+ _particles.add(particle);
+ }
+ initParticle(particle, currentTime, timerDelta);
+ needsSort = true;
+
+ toGen--;
+ }
+ }
+ if (needsSort && (_scaleZBased || _velocityZBased || _lifeTimeZBased)) {
+ sortParticlesByZ();
+ }
+
+ // we actually generated some particles and we're not in fast-forward mode
+ if (needsSort && _overheadTime == 0) {
+ if (_owner && _emitEvent) {
+ _owner->applyEvent(_emitEvent);
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::display(BaseRegion *region) {
+ if (_sprites.size() <= 1) {
+ _gameRef->_renderer->startSpriteBatch();
+ }
+
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ if (region != NULL && _useRegion) {
+ if (!region->pointInRegion((int)_particles[i]->_pos.x, (int)_particles[i]->_pos.y)) {
+ continue;
+ }
+ }
+
+ _particles[i]->display(this);
+ }
+
+ if (_sprites.size() <= 1) {
+ _gameRef->_renderer->endSpriteBatch();
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::start() {
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ _particles[i]->_isDead = true;
+ }
+ _running = true;
+ _batchesGenerated = 0;
+
+
+ if (_overheadTime > 0) {
+ uint32 delta = 500;
+ int steps = _overheadTime / delta;
+ uint32 currentTime = _gameRef->_timer - _overheadTime;
+
+ for (int i = 0; i < steps; i++) {
+ updateInternal(currentTime, delta);
+ currentTime += delta;
+ }
+ _overheadTime = 0;
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::sortParticlesByZ() {
+ // sort particles by _posY
+ Common::sort(_particles.begin(), _particles.end(), PartEmitter::compareZ);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int PartEmitter::compareZ(const void *obj1, const void *obj2) {
+ const PartParticle *p1 = *(const PartParticle *const *)obj1;
+ const PartParticle *p2 = *(const PartParticle *const *)obj2;
+
+ if (p1->_posZ < p2->_posZ) {
+ return -1;
+ } else if (p1->_posZ > p2->_posZ) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::setBorder(int x, int y, int width, int height) {
+ BasePlatform::setRect(&_border, x, y, x + width, y + height);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) {
+ _borderThicknessLeft = thicknessLeft;
+ _borderThicknessRight = thicknessRight;
+ _borderThicknessTop = thicknessTop;
+ _borderThicknessBottom = thicknessBottom;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+PartForce *PartEmitter::addForceByName(const Common::String &name) {
+ PartForce *force = NULL;
+
+ for (uint32 i = 0; i < _forces.size(); i++) {
+ if (scumm_stricmp(name.c_str(), _forces[i]->getName()) == 0) {
+ force = _forces[i];
+ break;
+ }
+ }
+ if (!force) {
+ force = new PartForce(_gameRef);
+ if (force) {
+ force->setName(name.c_str());
+ _forces.add(force);
+ }
+ }
+ return force;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::addForce(const Common::String &name, PartForce::TForceType type, int posX, int posY, float angle, float strength) {
+ PartForce *force = addForceByName(name);
+ if (!force) {
+ return STATUS_FAILED;
+ }
+
+ force->_type = type;
+ force->_pos = Vector2(posX, posY);
+
+ force->_direction = Vector2(0, strength);
+ Matrix4 matRot;
+ matRot.rotationZ(Common::deg2rad(BaseUtils::normalizeAngle(angle - 180)));
+ matRot.transformVector2(force->_direction);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::removeForce(const Common::String &name) {
+ for (uint32 i = 0; i < _forces.size(); i++) {
+ if (scumm_stricmp(name.c_str(), _forces[i]->getName()) == 0) {
+ delete _forces[i];
+ _forces.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetBorder
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetBorder") == 0) {
+ stack->correctParams(4);
+ int borderX = stack->pop()->getInt();
+ int borderY = stack->pop()->getInt();
+ int borderWidth = stack->pop()->getInt();
+ int borderHeight = stack->pop()->getInt();
+
+ stack->pushBool(DID_SUCCEED(setBorder(borderX, borderY, borderWidth, borderHeight)));
+
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SetBorderThickness
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetBorderThickness") == 0) {
+ stack->correctParams(4);
+ int left = stack->pop()->getInt();
+ int right = stack->pop()->getInt();
+ int top = stack->pop()->getInt();
+ int bottom = stack->pop()->getInt();
+
+ stack->pushBool(DID_SUCCEED(setBorderThickness(left, right, top, bottom)));
+
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // AddSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddSprite") == 0) {
+ stack->correctParams(1);
+ const char *spriteFile = stack->pop()->getString();
+ stack->pushBool(DID_SUCCEED(addSprite(spriteFile)));
+
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveSprite
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveSprite") == 0) {
+ stack->correctParams(1);
+ const char *spriteFile = stack->pop()->getString();
+ stack->pushBool(DID_SUCCEED(removeSprite(spriteFile)));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Start
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Start") == 0) {
+ stack->correctParams(1);
+ _overheadTime = stack->pop()->getInt();
+ stack->pushBool(DID_SUCCEED(start()));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Stop
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Stop") == 0) {
+ stack->correctParams(0);
+
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ delete _particles[i];
+ }
+ _particles.clear();
+
+ _running = false;
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Pause
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Pause") == 0) {
+ stack->correctParams(0);
+ _running = false;
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Resume
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Resume") == 0) {
+ stack->correctParams(0);
+ _running = true;
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddGlobalForce
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddGlobalForce") == 0) {
+ stack->correctParams(3);
+ const char *forceName = stack->pop()->getString();
+ float angle = stack->pop()->getFloat();
+ float strength = stack->pop()->getFloat();
+
+ stack->pushBool(DID_SUCCEED(addForce(forceName, PartForce::FORCE_GLOBAL, 0, 0, angle, strength)));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AddPointForce
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AddPointForce") == 0) {
+ stack->correctParams(5);
+ const char *forceName = stack->pop()->getString();
+ int posX = stack->pop()->getInt();
+ int posY = stack->pop()->getInt();
+ float angle = stack->pop()->getFloat();
+ float strength = stack->pop()->getFloat();
+
+ stack->pushBool(DID_SUCCEED(addForce(forceName, PartForce::FORCE_GLOBAL, posX, posY, angle, strength)));
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveForce
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RemoveForce") == 0) {
+ stack->correctParams(1);
+ const char *forceName = stack->pop()->getString();
+
+ stack->pushBool(DID_SUCCEED(removeForce(forceName)));
+
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *PartEmitter::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("particle-emitter");
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // X
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "X") {
+ _scValue->setInt(_posX);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Y
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Y") {
+ _scValue->setInt(_posY);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Width
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Width") {
+ _scValue->setInt(_width);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Height
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Height") {
+ _scValue->setInt(_height);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Scale1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Scale1") {
+ _scValue->setFloat(_scale1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Scale2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Scale2") {
+ _scValue->setFloat(_scale2);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // ScaleZBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ScaleZBased") {
+ _scValue->setBool(_scaleZBased);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Velocity1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Velocity1") {
+ _scValue->setFloat(_velocity1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Velocity2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Velocity2") {
+ _scValue->setFloat(_velocity2);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // VelocityZBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "VelocityZBased") {
+ _scValue->setBool(_velocityZBased);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LifeTime1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "LifeTime1") {
+ _scValue->setInt(_lifeTime1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // LifeTime2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "LifeTime2") {
+ _scValue->setInt(_lifeTime2);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // LifeTimeZBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "LifeTimeZBased") {
+ _scValue->setBool(_lifeTimeZBased);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Angle1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Angle1") {
+ _scValue->setInt(_angle1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Angle2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Angle2") {
+ _scValue->setInt(_angle2);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AngVelocity1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AngVelocity1") {
+ _scValue->setFloat(_angVelocity1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // AngVelocity2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AngVelocity2") {
+ _scValue->setFloat(_angVelocity2);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Rotation1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Rotation1") {
+ _scValue->setFloat(_rotation1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Rotation2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Rotation2") {
+ _scValue->setFloat(_rotation2);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Alpha1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Alpha1") {
+ _scValue->setInt(_alpha1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Alpha2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Alpha2") {
+ _scValue->setInt(_alpha2);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaTimeBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AlphaTimeBased") {
+ _scValue->setBool(_alphaTimeBased);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MaxParticles
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MaxParticles") {
+ _scValue->setInt(_maxParticles);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // NumLiveParticles (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumLiveParticles") {
+ int numAlive = 0;
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ if (_particles[i] && !_particles[i]->_isDead) {
+ numAlive++;
+ }
+ }
+ _scValue->setInt(numAlive);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GenerationInterval
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "GenerationInterval") {
+ _scValue->setInt(_genInterval);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GenerationAmount
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "GenerationAmount") {
+ _scValue->setInt(_genAmount);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // MaxBatches
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MaxBatches") {
+ _scValue->setInt(_maxBatches);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeInTime
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "FadeInTime") {
+ _scValue->setInt(_fadeInTime);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // FadeOutTime
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "FadeOutTime") {
+ _scValue->setInt(_fadeOutTime);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GrowthRate1
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "GrowthRate1") {
+ _scValue->setFloat(_growthRate1);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GrowthRate2
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "GrowthRate2") {
+ _scValue->setFloat(_growthRate2);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // ExponentialGrowth
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ExponentialGrowth") {
+ _scValue->setBool(_exponentialGrowth);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // UseRegion
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "UseRegion") {
+ _scValue->setBool(_useRegion);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // EmitEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "EmitEvent") {
+ if (!_emitEvent) {
+ _scValue->setNULL();
+ } else {
+ _scValue->setString(_emitEvent);
+ }
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // X
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "X") == 0) {
+ _posX = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Y
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Y") == 0) {
+ _posY = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Width
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Width") == 0) {
+ _width = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Height
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Height") == 0) {
+ _height = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Scale1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Scale1") == 0) {
+ _scale1 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Scale2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Scale2") == 0) {
+ _scale2 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // ScaleZBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ScaleZBased") == 0) {
+ _scaleZBased = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Velocity1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Velocity1") == 0) {
+ _velocity1 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Velocity2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Velocity2") == 0) {
+ _velocity2 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // VelocityZBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "VelocityZBased") == 0) {
+ _velocityZBased = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LifeTime1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LifeTime1") == 0) {
+ _lifeTime1 = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // LifeTime2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LifeTime2") == 0) {
+ _lifeTime2 = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // LifeTimeZBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LifeTimeZBased") == 0) {
+ _lifeTimeZBased = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Angle1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Angle1") == 0) {
+ _angle1 = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Angle2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Angle2") == 0) {
+ _angle2 = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AngVelocity1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AngVelocity1") == 0) {
+ _angVelocity1 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // AngVelocity2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AngVelocity2") == 0) {
+ _angVelocity2 = value->getFloat();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Rotation1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Rotation1") == 0) {
+ _rotation1 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Rotation2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Rotation2") == 0) {
+ _rotation2 = value->getFloat();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Alpha1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Alpha1") == 0) {
+ _alpha1 = value->getInt();
+ if (_alpha1 < 0) {
+ _alpha1 = 0;
+ }
+ if (_alpha1 > 255) {
+ _alpha1 = 255;
+ }
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Alpha2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Alpha2") == 0) {
+ _alpha2 = value->getInt();
+ if (_alpha2 < 0) {
+ _alpha2 = 0;
+ }
+ if (_alpha2 > 255) {
+ _alpha2 = 255;
+ }
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // AlphaTimeBased
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "AlphaTimeBased") == 0) {
+ _alphaTimeBased = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MaxParticles
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MaxParticles") == 0) {
+ _maxParticles = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GenerationInterval
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GenerationInterval") == 0) {
+ _genInterval = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GenerationAmount
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GenerationAmount") == 0) {
+ _genAmount = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // MaxBatches
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MaxBatches") == 0) {
+ _maxBatches = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeInTime
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeInTime") == 0) {
+ _fadeInTime = value->getInt();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // FadeOutTime
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeOutTime") == 0) {
+ _fadeOutTime = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GrowthRate1
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GrowthRate1") == 0) {
+ _growthRate1 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GrowthRate2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GrowthRate2") == 0) {
+ _growthRate2 = value->getFloat();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // ExponentialGrowth
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ExponentialGrowth") == 0) {
+ _exponentialGrowth = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // UseRegion
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "UseRegion") == 0) {
+ _useRegion = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // EmitEvent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "EmitEvent") == 0) {
+ delete[] _emitEvent;
+ _emitEvent = NULL;
+ if (!value->isNULL()) {
+ BaseUtils::setString(&_emitEvent, value->getString());
+ }
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *PartEmitter::scToString() {
+ return "[particle emitter]";
+}
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_width));
+ persistMgr->transfer(TMEMBER(_height));
+
+ persistMgr->transfer(TMEMBER(_angle1));
+ persistMgr->transfer(TMEMBER(_angle2));
+
+ persistMgr->transfer(TMEMBER(_velocity1));
+ persistMgr->transfer(TMEMBER(_velocity2));
+ persistMgr->transfer(TMEMBER(_velocityZBased));
+
+ persistMgr->transfer(TMEMBER(_scale1));
+ persistMgr->transfer(TMEMBER(_scale2));
+ persistMgr->transfer(TMEMBER(_scaleZBased));
+
+ persistMgr->transfer(TMEMBER(_maxParticles));
+
+ persistMgr->transfer(TMEMBER(_lifeTime1));
+ persistMgr->transfer(TMEMBER(_lifeTime2));
+ persistMgr->transfer(TMEMBER(_lifeTimeZBased));
+
+ persistMgr->transfer(TMEMBER(_genInterval));
+ persistMgr->transfer(TMEMBER(_genAmount));
+
+ persistMgr->transfer(TMEMBER(_running));
+ persistMgr->transfer(TMEMBER(_overheadTime));
+
+ persistMgr->transfer(TMEMBER(_border));
+ persistMgr->transfer(TMEMBER(_borderThicknessLeft));
+ persistMgr->transfer(TMEMBER(_borderThicknessRight));
+ persistMgr->transfer(TMEMBER(_borderThicknessTop));
+ persistMgr->transfer(TMEMBER(_borderThicknessBottom));
+
+ persistMgr->transfer(TMEMBER(_fadeInTime));
+ persistMgr->transfer(TMEMBER(_fadeOutTime));
+
+ persistMgr->transfer(TMEMBER(_alpha1));
+ persistMgr->transfer(TMEMBER(_alpha2));
+ persistMgr->transfer(TMEMBER(_alphaTimeBased));
+
+ persistMgr->transfer(TMEMBER(_angVelocity1));
+ persistMgr->transfer(TMEMBER(_angVelocity2));
+
+ persistMgr->transfer(TMEMBER(_rotation1));
+ persistMgr->transfer(TMEMBER(_rotation2));
+
+ persistMgr->transfer(TMEMBER(_growthRate1));
+ persistMgr->transfer(TMEMBER(_growthRate2));
+ persistMgr->transfer(TMEMBER(_exponentialGrowth));
+
+ persistMgr->transfer(TMEMBER(_useRegion));
+
+ persistMgr->transfer(TMEMBER_INT(_maxBatches));
+ persistMgr->transfer(TMEMBER_INT(_batchesGenerated));
+
+ persistMgr->transfer(TMEMBER(_emitEvent));
+ persistMgr->transfer(TMEMBER(_owner));
+
+
+ _sprites.persist(persistMgr);
+
+ uint32 numForces;
+ if (persistMgr->getIsSaving()) {
+ numForces = _forces.size();
+ persistMgr->transfer(TMEMBER(numForces));
+ for (uint32 i = 0; i < _forces.size(); i++) {
+ _forces[i]->persist(persistMgr);
+ }
+ } else {
+ persistMgr->transfer(TMEMBER(numForces));
+ for (uint32 i = 0; i < numForces; i++) {
+ PartForce *force = new PartForce(_gameRef);
+ force->persist(persistMgr);
+ _forces.add(force);
+ }
+ }
+
+ uint32 numParticles;
+ if (persistMgr->getIsSaving()) {
+ numParticles = _particles.size();
+ persistMgr->transfer(TMEMBER(numParticles));
+ for (uint32 i = 0; i < _particles.size(); i++) {
+ _particles[i]->persist(persistMgr);
+ }
+ } else {
+ persistMgr->transfer(TMEMBER(numParticles));
+ for (uint32 i = 0; i < numParticles; i++) {
+ PartParticle *particle = new PartParticle(_gameRef);
+ particle->persist(persistMgr);
+ _particles.add(particle);
+ }
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h
new file mode 100644
index 0000000000..f2c8f139f1
--- /dev/null
+++ b/engines/wintermute/base/particles/part_emitter.h
@@ -0,0 +1,140 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_PARTEMITTER_H
+#define WINTERMUTE_PARTEMITTER_H
+
+
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/base/particles/part_force.h"
+
+namespace Wintermute {
+class BaseRegion;
+class PartParticle;
+class PartEmitter : public BaseObject {
+public:
+ DECLARE_PERSISTENT(PartEmitter, BaseObject)
+
+ PartEmitter(BaseGame *inGame, BaseScriptHolder *Owner);
+ virtual ~PartEmitter(void);
+
+ int _fadeOutTime;
+
+ bool start();
+
+ bool update();
+ bool display() { return display(NULL); } // To avoid shadowing the inherited display-function.
+ bool display(BaseRegion *region);
+
+ bool sortParticlesByZ();
+ bool addSprite(const char *filename);
+ bool removeSprite(const char *filename);
+ bool setBorder(int x, int y, int width, int height);
+ bool setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom);
+
+ bool addForce(const Common::String &name, PartForce::TForceType type, int posX, int posY, float angle, float strength);
+ bool removeForce(const Common::String &name);
+
+ BaseArray<PartForce *> _forces;
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+
+
+private:
+ int _width;
+ int _height;
+
+ int _angle1;
+ int _angle2;
+
+ float _rotation1;
+ float _rotation2;
+
+ float _angVelocity1;
+ float _angVelocity2;
+
+ float _growthRate1;
+ float _growthRate2;
+ bool _exponentialGrowth;
+
+ float _velocity1;
+ float _velocity2;
+ bool _velocityZBased;
+
+ float _scale1;
+ float _scale2;
+ bool _scaleZBased;
+
+ int _maxParticles;
+
+ int _lifeTime1;
+ int _lifeTime2;
+ bool _lifeTimeZBased;
+
+ int _genInterval;
+ int _genAmount;
+
+ bool _running;
+ int _overheadTime;
+
+ int _maxBatches;
+ int _batchesGenerated;
+
+ Rect32 _border;
+ int _borderThicknessLeft;
+ int _borderThicknessRight;
+ int _borderThicknessTop;
+ int _borderThicknessBottom;
+
+ int _fadeInTime;
+
+ int _alpha1;
+ int _alpha2;
+ bool _alphaTimeBased;
+
+ bool _useRegion;
+
+ char *_emitEvent;
+ BaseScriptHolder *_owner;
+
+ PartForce *addForceByName(const Common::String &name);
+ int static compareZ(const void *obj1, const void *obj2);
+ bool initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta);
+ bool updateInternal(uint32 currentTime, uint32 timerDelta);
+ uint32 _lastGenTime;
+ BaseArray<PartParticle *> _particles;
+ BaseArray<char *> _sprites;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp
new file mode 100644
index 0000000000..df84162504
--- /dev/null
+++ b/engines/wintermute/base/particles/part_force.cpp
@@ -0,0 +1,65 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/particles/part_force.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+PartForce::PartForce(BaseGame *inGame) : BaseNamedObject(inGame) {
+ _pos = Vector2(0.0f, 0.0f);
+ _direction = Vector2(0.0f, 0.0f);
+ _type = FORCE_POINT;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+PartForce::~PartForce(void) {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool PartForce::persist(BasePersistenceManager *persistMgr) {
+ if (persistMgr->getIsSaving()) {
+ const char *name = getName();
+ persistMgr->transfer(TMEMBER(name));
+ } else {
+ const char *name;
+ persistMgr->transfer(TMEMBER(name));
+ setName(name);
+ }
+ persistMgr->transfer(TMEMBER(_pos));
+ persistMgr->transfer(TMEMBER(_direction));
+ persistMgr->transfer(TMEMBER_INT(_type));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/particles/part_force.h b/engines/wintermute/base/particles/part_force.h
new file mode 100644
index 0000000000..27f4cb7d90
--- /dev/null
+++ b/engines/wintermute/base/particles/part_force.h
@@ -0,0 +1,57 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_PARTFORCE_H
+#define WINTERMUTE_PARTFORCE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/base/base_named_object.h"
+#include "engines/wintermute/math/vector2.h"
+
+namespace Wintermute {
+
+class PartForce : public BaseNamedObject {
+public:
+ enum TForceType {
+ FORCE_POINT, FORCE_GLOBAL
+ };
+
+ PartForce(BaseGame *inGame);
+ virtual ~PartForce(void);
+
+ Vector2 _pos;
+ Vector2 _direction;
+ TForceType _type;
+
+ bool persist(BasePersistenceManager *PersistMgr);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp
new file mode 100644
index 0000000000..0b850d9618
--- /dev/null
+++ b/engines/wintermute/base/particles/part_particle.cpp
@@ -0,0 +1,269 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/particles/part_particle.h"
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+PartParticle::PartParticle(BaseGame *inGame) : BaseClass(inGame) {
+ _pos = Vector2(0.0f, 0.0f);
+ _posZ = 0.0f;
+ _velocity = Vector2(0.0f, 0.0f);
+ _scale = 100.0f;
+ _sprite = NULL;
+ _creationTime = 0;
+ _lifeTime = 0;
+ _isDead = true;
+ BasePlatform::setRectEmpty(&_border);
+
+ _state = PARTICLE_NORMAL;
+ _fadeStart = 0;
+ _fadeTime = 0;
+ _currentAlpha = 255;
+
+ _alpha1 = _alpha2 = 255;
+
+ _rotation = 0.0f;
+ _angVelocity = 0.0f;
+
+ _growthRate = 0.0f;
+ _exponentialGrowth = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+PartParticle::~PartParticle(void) {
+ delete _sprite;
+ _sprite = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartParticle::setSprite(const Common::String &filename) {
+ if (_sprite && _sprite->getFilename() && scumm_stricmp(filename.c_str(), _sprite->getFilename()) == 0) {
+ _sprite->reset();
+ return STATUS_OK;
+ }
+
+ delete _sprite;
+ _sprite = NULL;
+
+ SystemClassRegistry::getInstance()->_disabled = true;
+ _sprite = new BaseSprite(_gameRef, (BaseObject*)_gameRef);
+ if (_sprite && DID_SUCCEED(_sprite->loadFile(filename))) {
+ SystemClassRegistry::getInstance()->_disabled = false;
+ return STATUS_OK;
+ } else {
+ delete _sprite;
+ _sprite = NULL;
+ SystemClassRegistry::getInstance()->_disabled = false;
+ return STATUS_FAILED;
+ }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timerDelta) {
+ if (_state == PARTICLE_FADEIN) {
+ if (currentTime - _fadeStart >= (uint32)_fadeTime) {
+ _state = PARTICLE_NORMAL;
+ _currentAlpha = _alpha1;
+ } else {
+ _currentAlpha = (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _alpha1);
+ }
+
+ return STATUS_OK;
+ } else if (_state == PARTICLE_FADEOUT) {
+ if (currentTime - _fadeStart >= (uint32)_fadeTime) {
+ _isDead = true;
+ return STATUS_OK;
+ } else {
+ _currentAlpha = _fadeStartAlpha - (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _fadeStartAlpha);
+ }
+
+ return STATUS_OK;
+ } else {
+ // time is up
+ if (_lifeTime > 0) {
+ if (currentTime - _creationTime >= (uint32)_lifeTime) {
+ if (emitter->_fadeOutTime > 0) {
+ fadeOut(currentTime, emitter->_fadeOutTime);
+ } else {
+ _isDead = true;
+ }
+ }
+ }
+
+ // particle hit the border
+ if (!_isDead && !BasePlatform::isRectEmpty(&_border)) {
+ Point32 p;
+ p.x = (int32)_pos.x;
+ p.y = (int32)_pos.y;
+ if (!BasePlatform::ptInRect(&_border, p)) {
+ fadeOut(currentTime, emitter->_fadeOutTime);
+ }
+ }
+ if (_state != PARTICLE_NORMAL) {
+ return STATUS_OK;
+ }
+
+ // update alpha
+ if (_lifeTime > 0) {
+ int age = (int)(currentTime - _creationTime);
+ int alphaDelta = (int)(_alpha2 - _alpha1);
+
+ _currentAlpha = _alpha1 + (int)(((float)alphaDelta / (float)_lifeTime * (float)age));
+ }
+
+ // update position
+ float elapsedTime = (float)timerDelta / 1000.f;
+
+ for (uint32 i = 0; i < emitter->_forces.size(); i++) {
+ PartForce *force = emitter->_forces[i];
+ switch (force->_type) {
+ case PartForce::FORCE_GLOBAL:
+ _velocity += force->_direction * elapsedTime;
+ break;
+
+ case PartForce::FORCE_POINT: {
+ Vector2 vecDist = force->_pos - _pos;
+ float dist = fabs(vecDist.length());
+
+ dist = 100.0f / dist;
+
+ _velocity += force->_direction * dist * elapsedTime;
+ }
+ break;
+ }
+ }
+ _pos += _velocity * elapsedTime;
+
+ // update rotation
+ _rotation += _angVelocity * elapsedTime;
+ _rotation = BaseUtils::normalizeAngle(_rotation);
+
+ // update scale
+ if (_exponentialGrowth) {
+ _scale += _scale / 100.0f * _growthRate * elapsedTime;
+ } else {
+ _scale += _growthRate * elapsedTime;
+ }
+
+ if (_scale <= 0.0f) {
+ _isDead = true;
+ }
+
+
+ return STATUS_OK;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartParticle::display(PartEmitter *emitter) {
+ if (!_sprite) {
+ return STATUS_FAILED;
+ }
+ if (_isDead) {
+ return STATUS_OK;
+ }
+
+ _sprite->getCurrentFrame();
+ return _sprite->display((int)_pos.x, (int)_pos.y,
+ NULL,
+ _scale, _scale,
+ BYTETORGBA(255, 255, 255, _currentAlpha),
+ _rotation,
+ emitter->_blendMode);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool PartParticle::fadeIn(uint32 currentTime, int fadeTime) {
+ _currentAlpha = 0;
+ _fadeStart = currentTime;
+ _fadeTime = fadeTime;
+ _state = PARTICLE_FADEIN;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartParticle::fadeOut(uint32 currentTime, int fadeTime) {
+ //_currentAlpha = 255;
+ _fadeStartAlpha = _currentAlpha;
+ _fadeStart = currentTime;
+ _fadeTime = fadeTime;
+ _state = PARTICLE_FADEOUT;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool PartParticle::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_alpha1));
+ persistMgr->transfer(TMEMBER(_alpha2));
+ persistMgr->transfer(TMEMBER(_border));
+ persistMgr->transfer(TMEMBER(_pos));
+ persistMgr->transfer(TMEMBER(_posZ));
+ persistMgr->transfer(TMEMBER(_velocity));
+ persistMgr->transfer(TMEMBER(_scale));
+ persistMgr->transfer(TMEMBER(_creationTime));
+ persistMgr->transfer(TMEMBER(_lifeTime));
+ persistMgr->transfer(TMEMBER(_isDead));
+ persistMgr->transfer(TMEMBER_INT(_state));
+ persistMgr->transfer(TMEMBER(_fadeStart));
+ persistMgr->transfer(TMEMBER(_fadeTime));
+ persistMgr->transfer(TMEMBER(_currentAlpha));
+ persistMgr->transfer(TMEMBER(_angVelocity));
+ persistMgr->transfer(TMEMBER(_rotation));
+ persistMgr->transfer(TMEMBER(_growthRate));
+ persistMgr->transfer(TMEMBER(_exponentialGrowth));
+ persistMgr->transfer(TMEMBER(_fadeStartAlpha));
+
+ if (persistMgr->getIsSaving()) {
+ const char *filename = _sprite->getFilename();
+ persistMgr->transfer(TMEMBER(filename));
+ } else {
+ char *filename;
+ persistMgr->transfer(TMEMBER(filename));
+ SystemClassRegistry::getInstance()->_disabled = true;
+ setSprite(filename);
+ SystemClassRegistry::getInstance()->_disabled = false;
+ delete[] filename;
+ filename = NULL;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/particles/part_particle.h b/engines/wintermute/base/particles/part_particle.h
new file mode 100644
index 0000000000..4b8c2f131e
--- /dev/null
+++ b/engines/wintermute/base/particles/part_particle.h
@@ -0,0 +1,90 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_PARTPARTICLE_H
+#define WINTERMUTE_PARTPARTICLE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/math/rect32.h"
+#include "engines/wintermute/math/vector2.h"
+
+namespace Wintermute {
+
+class PartEmitter;
+class BaseSprite;
+class BasePersistenceManager;
+
+class PartParticle : public BaseClass {
+public:
+ enum TParticleState {
+ PARTICLE_NORMAL, PARTICLE_FADEIN, PARTICLE_FADEOUT
+ };
+
+ PartParticle(BaseGame *inGame);
+ virtual ~PartParticle(void);
+
+ float _growthRate;
+ bool _exponentialGrowth;
+
+ float _rotation;
+ float _angVelocity;
+
+ int _alpha1;
+ int _alpha2;
+
+ Rect32 _border;
+ Vector2 _pos;
+ float _posZ;
+ Vector2 _velocity;
+ float _scale;
+ BaseSprite *_sprite;
+ uint32 _creationTime;
+ int _lifeTime;
+ bool _isDead;
+ TParticleState _state;
+
+ bool update(PartEmitter *emitter, uint32 currentTime, uint32 timerDelta);
+ bool display(PartEmitter *emitter);
+
+ bool setSprite(const Common::String &filename);
+
+ bool fadeIn(uint32 currentTime, int fadeTime);
+ bool fadeOut(uint32 currentTime, int fadeTime);
+
+ bool persist(BasePersistenceManager *PersistMgr);
+private:
+ uint32 _fadeStart;
+ int _fadeTime;
+ int _currentAlpha;
+ int _fadeStartAlpha;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp
new file mode 100644
index 0000000000..12204e1b35
--- /dev/null
+++ b/engines/wintermute/base/saveload.cpp
@@ -0,0 +1,204 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_persistence_manager.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/base/saveload.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_game.h" // Temporary
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "common/savefile.h"
+#include "common/config-manager.h"
+
+namespace Wintermute {
+
+bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) {
+ gameRef->LOG(0, "Loading game '%s'...", filename.c_str());
+
+ bool ret;
+
+ gameRef->_renderer->initSaveLoad(false);
+
+ gameRef->_loadInProgress = true;
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ if (DID_SUCCEED(ret = pm->initLoad(filename))) {
+ //if (DID_SUCCEED(ret = cleanup())) {
+ if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->loadTable(gameRef, pm))) {
+ if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->loadInstances(gameRef, pm))) {
+ // Restore random-seed:
+ BaseEngine::instance().getRandomSource()->setSeed(pm->getDWORD());
+
+ // data initialization after load
+ SaveLoad::initAfterLoad();
+
+ gameRef->applyEvent("AfterLoad", true);
+
+ gameRef->displayContent(true, false);
+ //_renderer->flip();
+ }
+ }
+ }
+
+ delete pm;
+ gameRef->_loadInProgress = false;
+
+ gameRef->_renderer->endSaveLoad();
+
+ //_gameRef->LOG(0, "Load end %d", BaseUtils::GetUsedMemMB());
+ // AdGame:
+ if (DID_SUCCEED(ret)) {
+ SystemClassRegistry::getInstance()->enumInstances(SaveLoad::afterLoadRegion, "AdRegion", NULL);
+ }
+ return ret;
+}
+
+bool SaveLoad::saveGame(int slot, const char *desc, bool quickSave, BaseGame *gameRef) {
+ Common::String filename = SaveLoad::getSaveSlotFilename(slot);
+
+ gameRef->LOG(0, "Saving game '%s'...", filename.c_str());
+
+ gameRef->applyEvent("BeforeSave", true);
+
+ bool ret;
+
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ if (DID_SUCCEED(ret = pm->initSave(desc))) {
+ gameRef->_renderer->initSaveLoad(true, quickSave); // TODO: The original code inited the indicator before the conditionals
+ if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveTable(gameRef, pm, quickSave))) {
+ if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveInstances(gameRef, pm, quickSave))) {
+ pm->putDWORD(BaseEngine::instance().getRandomSource()->getSeed());
+ if (DID_SUCCEED(ret = pm->saveFile(filename))) {
+ ConfMan.setInt("most_recent_saveslot", slot);
+ }
+ }
+ }
+ }
+
+ delete pm;
+
+ gameRef->_renderer->endSaveLoad();
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SaveLoad::initAfterLoad() {
+ SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "BaseRegion", NULL);
+ SystemClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "BaseSubFrame", NULL);
+ SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", NULL);
+ SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", NULL);
+ SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", NULL);
+ // AdGame:
+ SystemClassRegistry::getInstance()->enumInstances(afterLoadScene, "AdScene", NULL);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SaveLoad::afterLoadScene(void *scene, void *data) {
+ ((AdScene *)scene)->afterLoad();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SaveLoad::afterLoadRegion(void *region, void *data) {
+ ((BaseRegion *)region)->createRegion();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SaveLoad::afterLoadSubFrame(void *subframe, void *data) {
+ ((BaseSubFrame *)subframe)->setSurfaceSimple();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SaveLoad::afterLoadSound(void *sound, void *data) {
+ ((BaseSound *)sound)->setSoundSimple();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SaveLoad::afterLoadFont(void *font, void *data) {
+ ((BaseFont *)font)->afterLoad();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SaveLoad::afterLoadScript(void *script, void *data) {
+ ((ScScript *)script)->afterLoad();
+}
+
+Common::String SaveLoad::getSaveSlotFilename(int slot) {
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ Common::String filename = pm->getFilenameForSlot(slot);
+ delete pm;
+ debugC(kWintermuteDebugSaveGame, "getSaveSlotFileName(%d) = %s", slot, filename.c_str());
+ return filename;
+}
+
+bool SaveLoad::getSaveSlotDescription(int slot, char *buffer) {
+ buffer[0] = '\0';
+
+ Common::String filename = getSaveSlotFilename(slot);
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ if (!pm) {
+ return false;
+ }
+
+ if (!(pm->initLoad(filename))) {
+ delete pm;
+ return false;
+ }
+
+ strcpy(buffer, pm->_savedDescription);
+ delete pm;
+
+ return true;
+}
+
+bool SaveLoad::isSaveSlotUsed(int slot) {
+ Common::String filename = getSaveSlotFilename(slot);
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ bool ret = pm->getSaveExists(slot);
+ delete pm;
+ return ret;
+}
+
+bool SaveLoad::emptySaveSlot(int slot) {
+ Common::String filename = getSaveSlotFilename(slot);
+ BasePersistenceManager *pm = new BasePersistenceManager();
+ ((WintermuteEngine *)g_engine)->getSaveFileMan()->removeSavefile(pm->getFilenameForSlot(slot));
+ delete pm;
+ return true;
+}
+
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h
new file mode 100644
index 0000000000..722f7a89b6
--- /dev/null
+++ b/engines/wintermute/base/saveload.h
@@ -0,0 +1,57 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SAVEGAME_H
+#define WINTERMUTE_SAVEGAME_H
+
+#include "common/str.h"
+
+namespace Wintermute {
+class BaseGame;
+class SaveLoad {
+public:
+ static bool emptySaveSlot(int slot);
+ static bool isSaveSlotUsed(int slot);
+ static bool getSaveSlotDescription(int slot, char *buffer);
+ static Common::String getSaveSlotFilename(int slot);
+
+ static bool loadGame(const Common::String &filename, BaseGame *gameRef);
+ static bool saveGame(int slot, const char *desc, bool quickSave, BaseGame *gameRef);
+ static bool initAfterLoad();
+ static void afterLoadScene(void *scene, void *data);
+ static void afterLoadRegion(void *region, void *data);
+private:
+ static void afterLoadSubFrame(void *subframe, void *data);
+ static void afterLoadSound(void *sound, void *data);
+ static void afterLoadFont(void *font, void *data);
+ static void afterLoadScript(void *script, void *data);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h
new file mode 100644
index 0000000000..4aae897dc2
--- /dev/null
+++ b/engines/wintermute/base/scriptables/dcscript.h
@@ -0,0 +1,141 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_DCSCRIPT_H
+#define WINTERMUTE_DCSCRIPT_H
+
+namespace Wintermute {
+
+#define SCRIPT_MAGIC 0xDEC0ADDE
+#define SCRIPT_VERSION 0x0102
+
+// value types
+typedef enum {
+ VAL_NULL,
+ VAL_STRING,
+ VAL_INT,
+ VAL_BOOL,
+ VAL_FLOAT,
+ VAL_OBJECT,
+ VAL_NATIVE,
+ VAL_VARIABLE_REF
+} TValType;
+
+
+// script states
+typedef enum {
+ SCRIPT_RUNNING,
+ SCRIPT_WAITING,
+ SCRIPT_SLEEPING,
+ SCRIPT_FINISHED,
+ SCRIPT_PERSISTENT,
+ SCRIPT_ERROR,
+ SCRIPT_PAUSED,
+ SCRIPT_WAITING_SCRIPT,
+ SCRIPT_THREAD_FINISHED
+} TScriptState;
+
+// opcodes
+typedef enum {
+ II_DEF_VAR = 0,
+ II_DEF_GLOB_VAR,
+ II_RET,
+ II_RET_EVENT,
+ II_CALL,
+ II_CALL_BY_EXP,
+ II_EXTERNAL_CALL,
+ II_SCOPE,
+ II_CORRECT_STACK,
+ II_CREATE_OBJECT,
+ II_POP_EMPTY,
+ II_PUSH_VAR,
+ II_PUSH_VAR_REF,
+ II_POP_VAR,
+ II_PUSH_VAR_THIS, // push current this on stack
+ II_PUSH_INT,
+ II_PUSH_BOOL,
+ II_PUSH_FLOAT,
+ II_PUSH_STRING,
+ II_PUSH_NULL,
+ II_PUSH_THIS_FROM_STACK,
+ II_PUSH_THIS,
+ II_POP_THIS,
+ II_PUSH_BY_EXP,
+ II_POP_BY_EXP,
+ II_JMP,
+ II_JMP_FALSE,
+ II_ADD,
+ II_SUB,
+ II_MUL,
+ II_DIV,
+ II_MODULO,
+ II_NOT,
+ II_AND,
+ II_OR,
+ II_CMP_EQ,
+ II_CMP_NE,
+ II_CMP_L,
+ II_CMP_G,
+ II_CMP_LE,
+ II_CMP_GE,
+ II_CMP_STRICT_EQ,
+ II_CMP_STRICT_NE,
+ II_DBG_LINE,
+ II_POP_REG1,
+ II_PUSH_REG1,
+ II_DEF_CONST_VAR
+} TInstruction;
+
+// external data types
+typedef enum {
+ TYPE_VOID = 0,
+ TYPE_BOOL,
+ TYPE_LONG,
+ TYPE_BYTE,
+ TYPE_STRING,
+ TYPE_FLOAT,
+ TYPE_DOUBLE,
+ TYPE_MEMBUFFER
+} TExternalType;
+
+
+// call types
+typedef enum {
+ CALL_STDCALL = 0,
+ CALL_CDECL,
+ CALL_THISCALL
+} TCallType;
+
+// element types
+typedef enum {
+ ELEMENT_STRING = 0
+} TElementType;
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
new file mode 100644
index 0000000000..9469bd46a7
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -0,0 +1,1467 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "common/memstream.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(ScScript, false)
+
+//////////////////////////////////////////////////////////////////////////
+ScScript::ScScript(BaseGame *inGame, ScEngine *engine) : BaseClass(inGame) {
+ _buffer = NULL;
+ _bufferSize = _iP = 0;
+ _scriptStream = NULL;
+ _filename = NULL;
+ _currentLine = 0;
+
+ _symbols = NULL;
+ _numSymbols = 0;
+
+ _engine = engine;
+
+ _globals = NULL;
+
+ _scopeStack = NULL;
+ _callStack = NULL;
+ _thisStack = NULL;
+ _stack = NULL;
+
+ _operand = NULL;
+ _reg1 = NULL;
+
+ _functions = NULL;
+ _numFunctions = 0;
+
+ _methods = NULL;
+ _numMethods = 0;
+
+ _events = NULL;
+ _numEvents = 0;
+
+ _externals = NULL;
+ _numExternals = 0;
+
+ _state = SCRIPT_FINISHED;
+ _origState = SCRIPT_FINISHED;
+
+ _waitObject = NULL;
+ _waitTime = 0;
+ _waitFrozen = false;
+ _waitScript = NULL;
+
+ _timeSlice = 0;
+
+ _thread = false;
+ _methodThread = false;
+ _threadEvent = NULL;
+
+ _freezable = true;
+ _owner = NULL;
+
+ _unbreakable = false;
+ _parentScript = NULL;
+
+ _tracingMode = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScScript::~ScScript() {
+ cleanup();
+}
+
+void ScScript::readHeader() {
+ uint32 oldPos = _scriptStream->pos();
+ _scriptStream->seek(0);
+ _header.magic = _scriptStream->readUint32LE();
+ _header.version = _scriptStream->readUint32LE();
+ _header.codeStart = _scriptStream->readUint32LE();
+ _header.funcTable = _scriptStream->readUint32LE();
+ _header.symbolTable = _scriptStream->readUint32LE();
+ _header.eventTable = _scriptStream->readUint32LE();
+ _header.externalsTable = _scriptStream->readUint32LE();
+ _header.methodTable = _scriptStream->readUint32LE();
+ _scriptStream->seek(oldPos);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::initScript() {
+ if (!_scriptStream) {
+ _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
+ }
+ readHeader();
+
+ if (_header.magic != SCRIPT_MAGIC) {
+ _gameRef->LOG(0, "File '%s' is not a valid compiled script", _filename);
+ cleanup();
+ return STATUS_FAILED;
+ }
+
+ if (_header.version > SCRIPT_VERSION) {
+ _gameRef->LOG(0, "Script '%s' has a wrong version %d.%d (expected %d.%d)", _filename, _header.version / 256, _header.version % 256, SCRIPT_VERSION / 256, SCRIPT_VERSION % 256);
+ cleanup();
+ return STATUS_FAILED;
+ }
+
+ initTables();
+
+ // init stacks
+ _scopeStack = new ScStack(_gameRef);
+ _callStack = new ScStack(_gameRef);
+ _thisStack = new ScStack(_gameRef);
+ _stack = new ScStack(_gameRef);
+
+ _operand = new ScValue(_gameRef);
+ _reg1 = new ScValue(_gameRef);
+
+
+ // skip to the beginning
+ _iP = _header.codeStart;
+ _scriptStream->seek(_iP);
+ _currentLine = 0;
+
+ // ready to rumble...
+ _state = SCRIPT_RUNNING;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::initTables() {
+ uint32 origIP = _iP;
+
+ readHeader();
+ // load symbol table
+ _iP = _header.symbolTable;
+
+ _numSymbols = getDWORD();
+ _symbols = new char*[_numSymbols];
+ for (uint32 i = 0; i < _numSymbols; i++) {
+ uint32 index = getDWORD();
+ _symbols[index] = getString();
+ }
+
+ // load functions table
+ _iP = _header.funcTable;
+
+ _numFunctions = getDWORD();
+ _functions = new TFunctionPos[_numFunctions];
+ for (uint32 i = 0; i < _numFunctions; i++) {
+ _functions[i].pos = getDWORD();
+ _functions[i].name = getString();
+ }
+
+
+ // load events table
+ _iP = _header.eventTable;
+
+ _numEvents = getDWORD();
+ _events = new TEventPos[_numEvents];
+ for (uint32 i = 0; i < _numEvents; i++) {
+ _events[i].pos = getDWORD();
+ _events[i].name = getString();
+ }
+
+
+ // load externals
+ if (_header.version >= 0x0101) {
+ _iP = _header.externalsTable;
+
+ _numExternals = getDWORD();
+ _externals = new TExternalFunction[_numExternals];
+ for (uint32 i = 0; i < _numExternals; i++) {
+ _externals[i].dll_name = getString();
+ _externals[i].name = getString();
+ _externals[i].call_type = (TCallType)getDWORD();
+ _externals[i].returns = (TExternalType)getDWORD();
+ _externals[i].nu_params = getDWORD();
+ if (_externals[i].nu_params > 0) {
+ _externals[i].params = new TExternalType[_externals[i].nu_params];
+ for (int j = 0; j < _externals[i].nu_params; j++) {
+ _externals[i].params[j] = (TExternalType)getDWORD();
+ }
+ }
+ }
+ }
+
+ // load method table
+ _iP = _header.methodTable;
+
+ _numMethods = getDWORD();
+ _methods = new TMethodPos[_numMethods];
+ for (uint32 i = 0; i < _numMethods; i++) {
+ _methods[i].pos = getDWORD();
+ _methods[i].name = getString();
+ }
+
+
+ _iP = origIP;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::create(const char *filename, byte *buffer, uint32 size, BaseScriptHolder *owner) {
+ cleanup();
+
+ _thread = false;
+ _methodThread = false;
+
+ delete[] _threadEvent;
+ _threadEvent = NULL;
+
+ _filename = new char[strlen(filename) + 1];
+ if (_filename) {
+ strcpy(_filename, filename);
+ }
+
+ _buffer = new byte [size];
+ if (!_buffer) {
+ return STATUS_FAILED;
+ }
+
+ memcpy(_buffer, buffer, size);
+
+ _bufferSize = size;
+
+ bool res = initScript();
+ if (DID_FAIL(res)) {
+ return res;
+ }
+
+ // establish global variables table
+ _globals = new ScValue(_gameRef);
+
+ _owner = owner;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::createThread(ScScript *original, uint32 initIP, const Common::String &eventName) {
+ cleanup();
+
+ _thread = true;
+ _methodThread = false;
+ _threadEvent = new char[eventName.size() + 1];
+ if (_threadEvent) {
+ strcpy(_threadEvent, eventName.c_str());
+ }
+
+ // copy filename
+ _filename = new char[strlen(original->_filename) + 1];
+ if (_filename) {
+ strcpy(_filename, original->_filename);
+ }
+
+ // copy buffer
+ _buffer = new byte [original->_bufferSize];
+ if (!_buffer) {
+ return STATUS_FAILED;
+ }
+
+ memcpy(_buffer, original->_buffer, original->_bufferSize);
+ _bufferSize = original->_bufferSize;
+
+ // initialize
+ bool res = initScript();
+ if (DID_FAIL(res)) {
+ return res;
+ }
+
+ // copy globals
+ _globals = original->_globals;
+
+ // skip to the beginning of the event
+ _iP = initIP;
+ _scriptStream->seek(_iP);
+
+ _timeSlice = original->_timeSlice;
+ _freezable = original->_freezable;
+ _owner = original->_owner;
+
+ _engine = original->_engine;
+ _parentScript = original;
+
+ return STATUS_OK;
+}
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::createMethodThread(ScScript *original, const Common::String &methodName) {
+ uint32 ip = original->getMethodPos(methodName);
+ if (ip == 0) {
+ return STATUS_FAILED;
+ }
+
+ cleanup();
+
+ _thread = true;
+ _methodThread = true;
+ _threadEvent = new char[methodName.size() + 1];
+ if (_threadEvent) {
+ strcpy(_threadEvent, methodName.c_str());
+ }
+
+ // copy filename
+ _filename = new char[strlen(original->_filename) + 1];
+ if (_filename) {
+ strcpy(_filename, original->_filename);
+ }
+
+ // copy buffer
+ _buffer = new byte [original->_bufferSize];
+ if (!_buffer) {
+ return STATUS_FAILED;
+ }
+
+ memcpy(_buffer, original->_buffer, original->_bufferSize);
+ _bufferSize = original->_bufferSize;
+
+ // initialize
+ bool res = initScript();
+ if (DID_FAIL(res)) {
+ return res;
+ }
+
+ // copy globals
+ _globals = original->_globals;
+
+ // skip to the beginning of the event
+ _iP = ip;
+
+ _timeSlice = original->_timeSlice;
+ _freezable = original->_freezable;
+ _owner = original->_owner;
+
+ _engine = original->_engine;
+ _parentScript = original;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScScript::cleanup() {
+ if (_buffer) {
+ delete[] _buffer;
+ }
+ _buffer = NULL;
+
+ if (_filename) {
+ delete[] _filename;
+ }
+ _filename = NULL;
+
+ if (_symbols) {
+ delete[] _symbols;
+ }
+ _symbols = NULL;
+ _numSymbols = 0;
+
+ if (_globals && !_thread) {
+ delete _globals;
+ }
+ _globals = NULL;
+
+ delete _scopeStack;
+ _scopeStack = NULL;
+
+ delete _callStack;
+ _callStack = NULL;
+
+ delete _thisStack;
+ _thisStack = NULL;
+
+ delete _stack;
+ _stack = NULL;
+
+ if (_functions) {
+ delete[] _functions;
+ }
+ _functions = NULL;
+ _numFunctions = 0;
+
+ if (_methods) {
+ delete[] _methods;
+ }
+ _methods = NULL;
+ _numMethods = 0;
+
+ if (_events) {
+ delete[] _events;
+ }
+ _events = NULL;
+ _numEvents = 0;
+
+
+ if (_externals) {
+ for (uint32 i = 0; i < _numExternals; i++) {
+ if (_externals[i].nu_params > 0) {
+ delete[] _externals[i].params;
+ }
+ }
+ delete[] _externals;
+ }
+ _externals = NULL;
+ _numExternals = 0;
+
+ delete _operand;
+ delete _reg1;
+ _operand = NULL;
+ _reg1 = NULL;
+
+ delete[] _threadEvent;
+ _threadEvent = NULL;
+
+ _state = SCRIPT_FINISHED;
+
+ _waitObject = NULL;
+ _waitTime = 0;
+ _waitFrozen = false;
+ _waitScript = NULL;
+
+ _parentScript = NULL; // ref only
+
+ delete _scriptStream;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 ScScript::getDWORD() {
+ _scriptStream->seek((int32)_iP);
+ uint32 ret = _scriptStream->readUint32LE();
+ _iP += sizeof(uint32);
+// assert(oldRet == ret);
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+double ScScript::getFloat() {
+ _scriptStream->seek((int32)_iP);
+ byte buffer[8];
+ _scriptStream->read(buffer, 8);
+
+#ifdef SCUMM_BIG_ENDIAN
+ // TODO: For lack of a READ_LE_UINT64
+ SWAP(buffer[0], buffer[7]);
+ SWAP(buffer[1], buffer[6]);
+ SWAP(buffer[2], buffer[5]);
+ SWAP(buffer[3], buffer[4]);
+#endif
+
+ double ret = *(double *)(buffer);
+ _iP += 8; // Hardcode the double-size used originally.
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *ScScript::getString() {
+ char *ret = (char *)(_buffer + _iP);
+ while (*(char *)(_buffer + _iP) != '\0') {
+ _iP++;
+ }
+ _iP++; // string terminator
+ _scriptStream->seek(_iP);
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::executeInstruction() {
+ bool ret = STATUS_OK;
+
+ uint32 dw;
+ const char *str = NULL;
+
+ //ScValue* op = new ScValue(_gameRef);
+ _operand->cleanup();
+
+ ScValue *op1;
+ ScValue *op2;
+
+ uint32 inst = getDWORD();
+ switch (inst) {
+
+ case II_DEF_VAR:
+ _operand->setNULL();
+ dw = getDWORD();
+ if (_scopeStack->_sP < 0) {
+ _globals->setProp(_symbols[dw], _operand);
+ } else {
+ _scopeStack->getTop()->setProp(_symbols[dw], _operand);
+ }
+
+ break;
+
+ case II_DEF_GLOB_VAR:
+ case II_DEF_CONST_VAR: {
+ dw = getDWORD();
+ /* char *temp = _symbols[dw]; // TODO delete */
+ // only create global var if it doesn't exist
+ if (!_engine->_globals->propExists(_symbols[dw])) {
+ _operand->setNULL();
+ _engine->_globals->setProp(_symbols[dw], _operand, false, inst == II_DEF_CONST_VAR);
+ }
+ break;
+ }
+
+ case II_RET:
+ if (_scopeStack->_sP >= 0 && _callStack->_sP >= 0) {
+ _scopeStack->pop();
+ _iP = (uint32)_callStack->pop()->getInt();
+ } else {
+ if (_thread) {
+ _state = SCRIPT_THREAD_FINISHED;
+ } else {
+ if (_numEvents == 0 && _numMethods == 0) {
+ _state = SCRIPT_FINISHED;
+ } else {
+ _state = SCRIPT_PERSISTENT;
+ }
+ }
+ }
+
+ break;
+
+ case II_RET_EVENT:
+ _state = SCRIPT_FINISHED;
+ break;
+
+
+ case II_CALL:
+ dw = getDWORD();
+
+ _operand->setInt(_iP);
+ _callStack->push(_operand);
+
+ _iP = dw;
+
+ break;
+
+ case II_CALL_BY_EXP: {
+ // push var
+ // push string
+ str = _stack->pop()->getString();
+ char *methodName = new char[strlen(str) + 1];
+ strcpy(methodName, str);
+
+ ScValue *var = _stack->pop();
+ if (var->_type == VAL_VARIABLE_REF) {
+ var = var->_valRef;
+ }
+
+ bool res = STATUS_FAILED;
+ bool triedNative = false;
+
+ // we are already calling this method, try native
+ if (_thread && _methodThread && strcmp(methodName, _threadEvent) == 0 && var->_type == VAL_NATIVE && _owner == var->getNative()) {
+ triedNative = true;
+ res = var->_valNative->scCallMethod(this, _stack, _thisStack, methodName);
+ }
+
+ if (DID_FAIL(res)) {
+ if (var->isNative() && var->getNative()->canHandleMethod(methodName)) {
+ if (!_unbreakable) {
+ _waitScript = var->getNative()->invokeMethodThread(methodName);
+ if (!_waitScript) {
+ _stack->correctParams(0);
+ runtimeError("Error invoking method '%s'.", methodName);
+ _stack->pushNULL();
+ } else {
+ _state = SCRIPT_WAITING_SCRIPT;
+ _waitScript->copyParameters(_stack);
+ }
+ } else {
+ // can call methods in unbreakable mode
+ _stack->correctParams(0);
+ runtimeError("Cannot call method '%s'. Ignored.", methodName);
+ _stack->pushNULL();
+ }
+ delete[] methodName;
+ break;
+ }
+ /*
+ ScValue* val = var->getProp(MethodName);
+ if (val){
+ dw = GetFuncPos(val->getString());
+ if (dw==0){
+ TExternalFunction* f = GetExternal(val->getString());
+ if (f){
+ ExternalCall(_stack, _thisStack, f);
+ }
+ else{
+ // not an internal nor external, try for native function
+ _gameRef->ExternalCall(this, _stack, _thisStack, val->getString());
+ }
+ }
+ else{
+ _operand->setInt(_iP);
+ _callStack->Push(_operand);
+ _iP = dw;
+ }
+ }
+ */
+ else {
+ res = STATUS_FAILED;
+ if (var->_type == VAL_NATIVE && !triedNative) {
+ res = var->_valNative->scCallMethod(this, _stack, _thisStack, methodName);
+ }
+
+ if (DID_FAIL(res)) {
+ _stack->correctParams(0);
+ runtimeError("Call to undefined method '%s'. Ignored.", methodName);
+ _stack->pushNULL();
+ }
+ }
+ }
+ delete[] methodName;
+ }
+ break;
+
+ case II_EXTERNAL_CALL: {
+ uint32 symbolIndex = getDWORD();
+
+ TExternalFunction *f = getExternal(_symbols[symbolIndex]);
+ if (f) {
+ externalCall(_stack, _thisStack, f);
+ } else {
+ _gameRef->externalCall(this, _stack, _thisStack, _symbols[symbolIndex]);
+ }
+
+ break;
+ }
+ case II_SCOPE:
+ _operand->setNULL();
+ _scopeStack->push(_operand);
+ break;
+
+ case II_CORRECT_STACK:
+ dw = getDWORD(); // params expected
+ _stack->correctParams(dw);
+ break;
+
+ case II_CREATE_OBJECT:
+ _operand->setObject();
+ _stack->push(_operand);
+ break;
+
+ case II_POP_EMPTY:
+ _stack->pop();
+ break;
+
+ case II_PUSH_VAR: {
+ ScValue *var = getVar(_symbols[getDWORD()]);
+ if (false && /*var->_type==VAL_OBJECT ||*/ var->_type == VAL_NATIVE) {
+ _operand->setReference(var);
+ _stack->push(_operand);
+ } else {
+ _stack->push(var);
+ }
+ break;
+ }
+
+ case II_PUSH_VAR_REF: {
+ ScValue *var = getVar(_symbols[getDWORD()]);
+ _operand->setReference(var);
+ _stack->push(_operand);
+ break;
+ }
+
+ case II_POP_VAR: {
+ char *varName = _symbols[getDWORD()];
+ ScValue *var = getVar(varName);
+ if (var) {
+ ScValue *val = _stack->pop();
+ if (!val) {
+ runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
+ var->setNULL();
+ } else {
+ if (val->getType() == VAL_VARIABLE_REF) {
+ val = val->_valRef;
+ }
+ if (val->_type == VAL_NATIVE) {
+ var->setValue(val);
+ } else {
+ var->copy(val);
+ }
+ }
+ }
+
+ break;
+ }
+
+ case II_PUSH_VAR_THIS:
+ _stack->push(_thisStack->getTop());
+ break;
+
+ case II_PUSH_INT:
+ _stack->pushInt((int)getDWORD());
+ break;
+
+ case II_PUSH_FLOAT:
+ _stack->pushFloat(getFloat());
+ break;
+
+
+ case II_PUSH_BOOL:
+ _stack->pushBool(getDWORD() != 0);
+
+ break;
+
+ case II_PUSH_STRING:
+ _stack->pushString(getString());
+ break;
+
+ case II_PUSH_NULL:
+ _stack->pushNULL();
+ break;
+
+ case II_PUSH_THIS_FROM_STACK:
+ _operand->setReference(_stack->getTop());
+ _thisStack->push(_operand);
+ break;
+
+ case II_PUSH_THIS:
+ _operand->setReference(getVar(_symbols[getDWORD()]));
+ _thisStack->push(_operand);
+ break;
+
+ case II_POP_THIS:
+ _thisStack->pop();
+ break;
+
+ case II_PUSH_BY_EXP: {
+ str = _stack->pop()->getString();
+ ScValue *val = _stack->pop()->getProp(str);
+ if (val) {
+ _stack->push(val);
+ } else {
+ _stack->pushNULL();
+ }
+
+ break;
+ }
+
+ case II_POP_BY_EXP: {
+ str = _stack->pop()->getString();
+ ScValue *var = _stack->pop();
+ ScValue *val = _stack->pop();
+
+ if (val == NULL) {
+ runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
+ var->setNULL();
+ } else {
+ var->setProp(str, val);
+ }
+
+ break;
+ }
+
+ case II_PUSH_REG1:
+ _stack->push(_reg1);
+ break;
+
+ case II_POP_REG1:
+ _reg1->copy(_stack->pop());
+ break;
+
+ case II_JMP:
+ _iP = getDWORD();
+ break;
+
+ case II_JMP_FALSE: {
+ dw = getDWORD();
+ //if (!_stack->pop()->getBool()) _iP = dw;
+ ScValue *val = _stack->pop();
+ if (!val) {
+ runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
+ } else {
+ if (!val->getBool()) {
+ _iP = dw;
+ }
+ }
+ break;
+ }
+
+ case II_ADD:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ if (op1->isNULL() || op2->isNULL()) {
+ _operand->setNULL();
+ } else if (op1->getType() == VAL_STRING || op2->getType() == VAL_STRING) {
+ char *tempStr = new char [strlen(op1->getString()) + strlen(op2->getString()) + 1];
+ strcpy(tempStr, op1->getString());
+ strcat(tempStr, op2->getString());
+ _operand->setString(tempStr);
+ delete[] tempStr;
+ } else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
+ _operand->setInt(op1->getInt() + op2->getInt());
+ } else {
+ _operand->setFloat(op1->getFloat() + op2->getFloat());
+ }
+
+ _stack->push(_operand);
+
+ break;
+
+ case II_SUB:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ if (op1->isNULL() || op2->isNULL()) {
+ _operand->setNULL();
+ } else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
+ _operand->setInt(op1->getInt() - op2->getInt());
+ } else {
+ _operand->setFloat(op1->getFloat() - op2->getFloat());
+ }
+
+ _stack->push(_operand);
+
+ break;
+
+ case II_MUL:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ if (op1->isNULL() || op2->isNULL()) {
+ _operand->setNULL();
+ } else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
+ _operand->setInt(op1->getInt() * op2->getInt());
+ } else {
+ _operand->setFloat(op1->getFloat() * op2->getFloat());
+ }
+
+ _stack->push(_operand);
+
+ break;
+
+ case II_DIV:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ if (op2->getFloat() == 0.0f) {
+ runtimeError("Division by zero.");
+ }
+
+ if (op1->isNULL() || op2->isNULL() || op2->getFloat() == 0.0f) {
+ _operand->setNULL();
+ } else {
+ _operand->setFloat(op1->getFloat() / op2->getFloat());
+ }
+
+ _stack->push(_operand);
+
+ break;
+
+ case II_MODULO:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ if (op2->getInt() == 0) {
+ runtimeError("Division by zero.");
+ }
+
+ if (op1->isNULL() || op2->isNULL() || op2->getInt() == 0) {
+ _operand->setNULL();
+ } else {
+ _operand->setInt(op1->getInt() % op2->getInt());
+ }
+
+ _stack->push(_operand);
+
+ break;
+
+ case II_NOT:
+ op1 = _stack->pop();
+ //if (op1->isNULL()) _operand->setNULL();
+ if (op1->isNULL()) {
+ _operand->setBool(true);
+ } else {
+ _operand->setBool(!op1->getBool());
+ }
+ _stack->push(_operand);
+
+ break;
+
+ case II_AND:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+ if (op1 == NULL || op2 == NULL) {
+ runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
+ _operand->setBool(false);
+ } else {
+ _operand->setBool(op1->getBool() && op2->getBool());
+ }
+ _stack->push(_operand);
+ break;
+
+ case II_OR:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+ if (op1 == NULL || op2 == NULL) {
+ runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
+ _operand->setBool(false);
+ } else {
+ _operand->setBool(op1->getBool() || op2->getBool());
+ }
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_EQ:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ /*
+ if ((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(false);
+ else if (op1->isNative() && op2->isNative()){
+ _operand->setBool(op1->getNative() == op2->getNative());
+ }
+ else if (op1->getType()==VAL_STRING || op2->getType()==VAL_STRING){
+ _operand->setBool(scumm_stricmp(op1->getString(), op2->getString())==0);
+ }
+ else if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
+ _operand->setBool(op1->getFloat() == op2->getFloat());
+ }
+ else{
+ _operand->setBool(op1->getInt() == op2->getInt());
+ }
+ */
+
+ _operand->setBool(ScValue::compare(op1, op2) == 0);
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_NE:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ /*
+ if ((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(true);
+ else if (op1->isNative() && op2->isNative()){
+ _operand->setBool(op1->getNative() != op2->getNative());
+ }
+ else if (op1->getType()==VAL_STRING || op2->getType()==VAL_STRING){
+ _operand->setBool(scumm_stricmp(op1->getString(), op2->getString())!=0);
+ }
+ else if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
+ _operand->setBool(op1->getFloat() != op2->getFloat());
+ }
+ else{
+ _operand->setBool(op1->getInt() != op2->getInt());
+ }
+ */
+
+ _operand->setBool(ScValue::compare(op1, op2) != 0);
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_L:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ /*
+ if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
+ _operand->setBool(op1->getFloat() < op2->getFloat());
+ }
+ else _operand->setBool(op1->getInt() < op2->getInt());
+ */
+
+ _operand->setBool(ScValue::compare(op1, op2) < 0);
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_G:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ /*
+ if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
+ _operand->setBool(op1->getFloat() > op2->getFloat());
+ }
+ else _operand->setBool(op1->getInt() > op2->getInt());
+ */
+
+ _operand->setBool(ScValue::compare(op1, op2) > 0);
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_LE:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ /*
+ if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
+ _operand->setBool(op1->getFloat() <= op2->getFloat());
+ }
+ else _operand->setBool(op1->getInt() <= op2->getInt());
+ */
+
+ _operand->setBool(ScValue::compare(op1, op2) <= 0);
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_GE:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ /*
+ if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
+ _operand->setBool(op1->getFloat() >= op2->getFloat());
+ }
+ else _operand->setBool(op1->getInt() >= op2->getInt());
+ */
+
+ _operand->setBool(ScValue::compare(op1, op2) >= 0);
+ _stack->push(_operand);
+ break;
+
+ case II_CMP_STRICT_EQ:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ //_operand->setBool(op1->getType()==op2->getType() && op1->getFloat()==op2->getFloat());
+ _operand->setBool(ScValue::compareStrict(op1, op2) == 0);
+ _stack->push(_operand);
+
+ break;
+
+ case II_CMP_STRICT_NE:
+ op2 = _stack->pop();
+ op1 = _stack->pop();
+
+ //_operand->setBool(op1->getType()!=op2->getType() || op1->getFloat()!=op2->getFloat());
+ _operand->setBool(ScValue::compareStrict(op1, op2) != 0);
+ _stack->push(_operand);
+ break;
+
+ case II_DBG_LINE: {
+ int newLine = getDWORD();
+ if (newLine != _currentLine) {
+ _currentLine = newLine;
+ }
+ break;
+
+ }
+ default:
+ _gameRef->LOG(0, "Fatal: Invalid instruction %d ('%s', line %d, IP:0x%x)\n", inst, _filename, _currentLine, _iP - sizeof(uint32));
+ _state = SCRIPT_FINISHED;
+ ret = STATUS_FAILED;
+ } // switch(instruction)
+
+ //delete op;
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 ScScript::getFuncPos(const Common::String &name) {
+ for (uint32 i = 0; i < _numFunctions; i++) {
+ if (name == _functions[i].name) {
+ return _functions[i].pos;
+ }
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 ScScript::getMethodPos(const Common::String &name) {
+ for (uint32 i = 0; i < _numMethods; i++) {
+ if (name == _methods[i].name) {
+ return _methods[i].pos;
+ }
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *ScScript::getVar(char *name) {
+ ScValue *ret = NULL;
+
+ // scope locals
+ if (_scopeStack->_sP >= 0) {
+ if (_scopeStack->getTop()->propExists(name)) {
+ ret = _scopeStack->getTop()->getProp(name);
+ }
+ }
+
+ // script globals
+ if (ret == NULL) {
+ if (_globals->propExists(name)) {
+ ret = _globals->getProp(name);
+ }
+ }
+
+ // engine globals
+ if (ret == NULL) {
+ if (_engine->_globals->propExists(name)) {
+ ret = _engine->_globals->getProp(name);
+ }
+ }
+
+ if (ret == NULL) {
+ //RuntimeError("Variable '%s' is inaccessible in the current block. Consider changing the script.", name);
+ _gameRef->LOG(0, "Warning: variable '%s' is inaccessible in the current block. Consider changing the script (script:%s, line:%d)", name, _filename, _currentLine);
+ ScValue *val = new ScValue(_gameRef);
+ ScValue *scope = _scopeStack->getTop();
+ if (scope) {
+ scope->setProp(name, val);
+ ret = _scopeStack->getTop()->getProp(name);
+ } else {
+ _globals->setProp(name, val);
+ ret = _globals->getProp(name);
+ }
+ delete val;
+ }
+
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::waitFor(BaseObject *object) {
+ if (_unbreakable) {
+ runtimeError("Script cannot be interrupted.");
+ return STATUS_OK;
+ }
+
+ _state = SCRIPT_WAITING;
+ _waitObject = object;
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::waitForExclusive(BaseObject *object) {
+ _engine->resetObject(object);
+ return waitFor(object);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::sleep(uint32 duration) {
+ if (_unbreakable) {
+ runtimeError("Script cannot be interrupted.");
+ return STATUS_OK;
+ }
+
+ _state = SCRIPT_SLEEPING;
+ if (_gameRef->_state == GAME_FROZEN) {
+ _waitTime = g_system->getMillis() + duration;
+ _waitFrozen = true;
+ } else {
+ _waitTime = _gameRef->_timer + duration;
+ _waitFrozen = false;
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::finish(bool includingThreads) {
+ if (_state != SCRIPT_FINISHED && includingThreads) {
+ _state = SCRIPT_FINISHED;
+ finishThreads();
+ } else {
+ _state = SCRIPT_FINISHED;
+ }
+
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::run() {
+ _state = SCRIPT_RUNNING;
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+void ScScript::runtimeError(const char *fmt, ...) {
+ char buff[256];
+ va_list va;
+
+ va_start(va, fmt);
+ vsprintf(buff, fmt, va);
+ va_end(va);
+
+ _gameRef->LOG(0, "Runtime error. Script '%s', line %d", _filename, _currentLine);
+ _gameRef->LOG(0, " %s", buff);
+
+ if (!_gameRef->_suppressScriptErrors) {
+ _gameRef->quickMessage("Script runtime error. View log for details.");
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::persist(BasePersistenceManager *persistMgr) {
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ // buffer
+ if (persistMgr->getIsSaving()) {
+ if (_state != SCRIPT_PERSISTENT && _state != SCRIPT_FINISHED && _state != SCRIPT_THREAD_FINISHED) {
+ persistMgr->transfer(TMEMBER(_bufferSize));
+ persistMgr->putBytes(_buffer, _bufferSize);
+ } else {
+ // don't save idle/finished scripts
+ int bufferSize = 0;
+ persistMgr->transfer(TMEMBER(bufferSize));
+ }
+ } else {
+ persistMgr->transfer(TMEMBER(_bufferSize));
+ if (_bufferSize > 0) {
+ _buffer = new byte[_bufferSize];
+ persistMgr->getBytes(_buffer, _bufferSize);
+ _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
+ initTables();
+ } else {
+ _buffer = NULL;
+ _scriptStream = NULL;
+ }
+ }
+
+ persistMgr->transfer(TMEMBER(_callStack));
+ persistMgr->transfer(TMEMBER(_currentLine));
+ persistMgr->transfer(TMEMBER(_engine));
+ persistMgr->transfer(TMEMBER(_filename));
+ persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transfer(TMEMBER(_globals));
+ persistMgr->transfer(TMEMBER(_iP));
+ persistMgr->transfer(TMEMBER(_scopeStack));
+ persistMgr->transfer(TMEMBER(_stack));
+ persistMgr->transfer(TMEMBER_INT(_state));
+ persistMgr->transfer(TMEMBER(_operand));
+ persistMgr->transfer(TMEMBER_INT(_origState));
+ persistMgr->transfer(TMEMBER(_owner));
+ persistMgr->transfer(TMEMBER(_reg1));
+ persistMgr->transfer(TMEMBER(_thread));
+ persistMgr->transfer(TMEMBER(_threadEvent));
+ persistMgr->transfer(TMEMBER(_thisStack));
+ persistMgr->transfer(TMEMBER(_timeSlice));
+ persistMgr->transfer(TMEMBER(_waitObject));
+ persistMgr->transfer(TMEMBER(_waitScript));
+ persistMgr->transfer(TMEMBER(_waitTime));
+ persistMgr->transfer(TMEMBER(_waitFrozen));
+
+ persistMgr->transfer(TMEMBER(_methodThread));
+ persistMgr->transfer(TMEMBER(_methodThread));
+ persistMgr->transfer(TMEMBER(_unbreakable));
+ persistMgr->transfer(TMEMBER(_parentScript));
+
+ if (!persistMgr->getIsSaving()) {
+ _tracingMode = false;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unbreakable) {
+ //if (_state!=SCRIPT_PERSISTENT) return NULL;
+
+ uint32 pos = getEventPos(eventName);
+ if (!pos) {
+ return NULL;
+ }
+
+ ScScript *thread = new ScScript(_gameRef, _engine);
+ if (thread) {
+ bool ret = thread->createThread(this, pos, eventName);
+ if (DID_SUCCEED(ret)) {
+ thread->_unbreakable = unbreakable;
+ _engine->_scripts.add(thread);
+ return thread;
+ } else {
+ delete thread;
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 ScScript::getEventPos(const Common::String &name) {
+ for (int i = _numEvents - 1; i >= 0; i--) {
+ if (scumm_stricmp(name.c_str(), _events[i].name) == 0) {
+ return _events[i].pos;
+ }
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::canHandleEvent(const Common::String &eventName) {
+ return getEventPos(eventName) != 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::canHandleMethod(const Common::String &methodName) {
+ return getMethodPos(methodName) != 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::pause() {
+ if (_state == SCRIPT_PAUSED) {
+ _gameRef->LOG(0, "Attempting to pause a paused script ('%s', line %d)", _filename, _currentLine);
+ return STATUS_FAILED;
+ }
+
+ if (!_freezable || _state == SCRIPT_PERSISTENT) {
+ return STATUS_OK;
+ }
+
+ _origState = _state;
+ _state = SCRIPT_PAUSED;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::resume() {
+ if (_state != SCRIPT_PAUSED) {
+ return STATUS_OK;
+ }
+
+ _state = _origState;
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScScript::TExternalFunction *ScScript::getExternal(char *name) {
+ for (uint32 i = 0; i < _numExternals; i++) {
+ if (strcmp(name, _externals[i].name) == 0) {
+ return &_externals[i];
+ }
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::externalCall(ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) {
+
+ _gameRef->LOG(0, "External functions are not supported on this platform.");
+ stack->correctParams(0);
+ stack->pushNULL();
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::copyParameters(ScStack *stack) {
+ int i;
+ int numParams = stack->pop()->getInt();
+ for (i = numParams - 1; i >= 0; i--) {
+ _stack->push(stack->getAt(i));
+ }
+ _stack->pushInt(numParams);
+
+ for (i = 0; i < numParams; i++) {
+ stack->pop();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScScript::finishThreads() {
+ for (uint32 i = 0; i < _engine->_scripts.size(); i++) {
+ ScScript *scr = _engine->_scripts[i];
+ if (scr->_thread && scr->_state != SCRIPT_FINISHED && scr->_owner == _owner && scumm_stricmp(scr->_filename, _filename) == 0) {
+ scr->finish(true);
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// IWmeDebugScript interface implementation
+int ScScript::dbgGetLine() {
+ return _currentLine;
+}
+
+//////////////////////////////////////////////////////////////////////////
+const char *ScScript::dbgGetFilename() {
+ return _filename;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void ScScript::afterLoad() {
+ if (_buffer == NULL) {
+ byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize);
+ if (!buffer) {
+ _gameRef->LOG(0, "Error reinitializing script '%s' after load. Script will be terminated.", _filename);
+ _state = SCRIPT_ERROR;
+ return;
+ }
+
+ _buffer = new byte [_bufferSize];
+ memcpy(_buffer, buffer, _bufferSize);
+
+ delete _scriptStream;
+ _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
+
+ initTables();
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h
new file mode 100644
index 0000000000..0616bce58a
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script.h
@@ -0,0 +1,174 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SCSCRIPT_H
+#define WINTERMUTE_SCSCRIPT_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/base/scriptables/dcscript.h" // Added by ClassView
+#include "engines/wintermute/coll_templ.h"
+
+namespace Wintermute {
+class BaseScriptHolder;
+class BaseObject;
+class ScEngine;
+class ScStack;
+class ScScript : public BaseClass {
+public:
+ BaseArray<int> _breakpoints;
+ bool _tracingMode;
+
+ ScScript *_parentScript;
+ bool _unbreakable;
+ bool finishThreads();
+ bool copyParameters(ScStack *stack);
+
+ void afterLoad();
+private:
+ ScValue *_operand;
+ ScValue *_reg1;
+public:
+ bool _freezable;
+ bool resume();
+ bool pause();
+ bool canHandleEvent(const Common::String &eventName);
+ bool canHandleMethod(const Common::String &methodName);
+ bool createThread(ScScript *original, uint32 initIP, const Common::String &eventName);
+ bool createMethodThread(ScScript *original, const Common::String &methodName);
+ ScScript *invokeEventHandler(const Common::String &eventName, bool unbreakable = false);
+ uint32 _timeSlice;
+ DECLARE_PERSISTENT(ScScript, BaseClass)
+ void runtimeError(const char *fmt, ...);
+ bool run();
+ bool finish(bool includingThreads = false);
+ bool sleep(uint32 duration);
+ bool waitForExclusive(BaseObject *object);
+ bool waitFor(BaseObject *object);
+ uint32 _waitTime;
+ bool _waitFrozen;
+ BaseObject *_waitObject;
+ ScScript *_waitScript;
+ TScriptState _state;
+ TScriptState _origState;
+ ScValue *getVar(char *name);
+ uint32 getFuncPos(const Common::String &name);
+ uint32 getEventPos(const Common::String &name);
+ uint32 getMethodPos(const Common::String &name);
+ typedef struct {
+ uint32 magic;
+ uint32 version;
+ uint32 codeStart;
+ uint32 funcTable;
+ uint32 symbolTable;
+ uint32 eventTable;
+ uint32 externalsTable;
+ uint32 methodTable;
+ } TScriptHeader;
+
+ TScriptHeader _header;
+
+ typedef struct {
+ char *name;
+ uint32 pos;
+ } TFunctionPos;
+
+ typedef struct {
+ char *name;
+ uint32 pos;
+ } TMethodPos;
+
+ typedef struct {
+ char *name;
+ uint32 pos;
+ } TEventPos;
+
+ typedef struct {
+ char *name;
+ char *dll_name;
+ TCallType call_type;
+ TExternalType returns;
+ int nu_params;
+ TExternalType *params;
+ } TExternalFunction;
+
+
+ ScStack *_callStack;
+ ScStack *_thisStack;
+ ScStack *_scopeStack;
+ ScStack *_stack;
+ ScValue *_globals;
+ ScEngine *_engine;
+ int _currentLine;
+ bool executeInstruction();
+ char *getString();
+ uint32 getDWORD();
+ double getFloat();
+ void cleanup();
+ bool create(const char *filename, byte *buffer, uint32 size, BaseScriptHolder *owner);
+ uint32 _iP;
+private:
+ void readHeader();
+ uint32 _bufferSize;
+ byte *_buffer;
+public:
+ Common::SeekableReadStream *_scriptStream;
+ ScScript(BaseGame *inGame, ScEngine *engine);
+ virtual ~ScScript();
+ char *_filename;
+ bool _thread;
+ bool _methodThread;
+ char *_threadEvent;
+ BaseScriptHolder *_owner;
+ ScScript::TExternalFunction *getExternal(char *name);
+ bool externalCall(ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function);
+private:
+ char **_symbols;
+ uint32 _numSymbols;
+ TFunctionPos *_functions;
+ TMethodPos *_methods;
+ TEventPos *_events;
+ uint32 _numExternals;
+ TExternalFunction *_externals;
+ uint32 _numFunctions;
+ uint32 _numMethods;
+ uint32 _numEvents;
+
+ bool initScript();
+ bool initTables();
+
+
+// IWmeDebugScript interface implementation
+public:
+ virtual int dbgGetLine();
+ virtual const char *dbgGetFilename();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
new file mode 100644
index 0000000000..3d1863946e
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -0,0 +1,609 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_ext_math.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/utils/utils.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(ScEngine, true)
+
+#define COMPILER_DLL "dcscomp.dll"
+//////////////////////////////////////////////////////////////////////////
+ScEngine::ScEngine(BaseGame *inGame) : BaseClass(inGame) {
+ _gameRef->LOG(0, "Initializing scripting engine...");
+
+ if (_compilerAvailable) {
+ _gameRef->LOG(0, " Script compiler bound successfuly");
+ } else {
+ _gameRef->LOG(0, " Script compiler is NOT available");
+ }
+
+ _globals = new ScValue(_gameRef);
+
+
+ // register 'Game' as global variable
+ if (!_globals->propExists("Game")) {
+ ScValue val(_gameRef);
+ val.setNative(_gameRef, true);
+ _globals->setProp("Game", &val);
+ }
+
+ // register 'Math' as global variable
+ if (!_globals->propExists("Math")) {
+ ScValue val(_gameRef);
+ val.setNative(_gameRef->_mathClass, true);
+ _globals->setProp("Math", &val);
+ }
+
+ // prepare script cache
+ for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
+ _cachedScripts[i] = NULL;
+ }
+
+ _currentScript = NULL;
+
+ _isProfiling = false;
+ _profilingStartTime = 0;
+
+ //EnableProfiling();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScEngine::~ScEngine() {
+ _gameRef->LOG(0, "Shutting down scripting engine");
+
+ disableProfiling();
+
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::cleanup() {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (!_scripts[i]->_thread && _scripts[i]->_owner) {
+ _scripts[i]->_owner->removeScript(_scripts[i]);
+ }
+ delete _scripts[i];
+ _scripts.remove_at(i);
+ i--;
+ }
+
+ _scripts.clear();
+
+ delete _globals;
+ _globals = NULL;
+
+ emptyScriptCache();
+
+ _currentScript = NULL; // ref only
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+byte *ScEngine::loadFile(void *data, char *filename, uint32 *size) {
+ return BaseFileManager::getEngineInstance()->readWholeFile(filename, size);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::closeFile(void *data, byte *buffer) {
+ delete[] buffer;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::parseElement(void *data, int line, int type, void *elementData) {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) {
+ byte *compBuffer;
+ uint32 compSize;
+
+ // get script from cache
+ compBuffer = getCompiledScript(filename, &compSize);
+ if (!compBuffer) {
+ return NULL;
+ }
+
+ // add new script
+ ScScript *script = new ScScript(_gameRef, this);
+ bool ret = script->create(filename, compBuffer, compSize, owner);
+ if (DID_FAIL(ret)) {
+ _gameRef->LOG(ret, "Error running script '%s'...", filename);
+ delete script;
+ return NULL;
+ } else {
+ // publish the "self" pseudo-variable
+ ScValue val(_gameRef);
+ if (owner) {
+ val.setNative(owner, true);
+ } else {
+ val.setNULL();
+ }
+
+ script->_globals->setProp("self", &val);
+ script->_globals->setProp("this", &val);
+
+ _scripts.add(script);
+
+ return script;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache) {
+ // is script in cache?
+ if (!ignoreCache) {
+ for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
+ if (_cachedScripts[i] && scumm_stricmp(_cachedScripts[i]->_filename.c_str(), filename) == 0) {
+ _cachedScripts[i]->_timestamp = g_system->getMillis();
+ *outSize = _cachedScripts[i]->_size;
+ return _cachedScripts[i]->_buffer;
+ }
+ }
+ }
+
+ // nope, load it
+ byte *compBuffer;
+ uint32 compSize;
+
+ uint32 size;
+
+ byte *buffer = BaseEngine::instance().getFileManager()->readWholeFile(filename, &size);
+ if (!buffer) {
+ _gameRef->LOG(0, "ScEngine::GetCompiledScript - error opening script '%s'", filename);
+ return NULL;
+ }
+
+ // needs to be compiled?
+ if (FROM_LE_32(*(uint32 *)buffer) == SCRIPT_MAGIC) {
+ compBuffer = buffer;
+ compSize = size;
+ } else {
+ if (!_compilerAvailable) {
+ _gameRef->LOG(0, "ScEngine::GetCompiledScript - script '%s' needs to be compiled but compiler is not available", filename);
+ delete[] buffer;
+ return NULL;
+ }
+ // This code will never be called, since _compilerAvailable is const false.
+ // It's only here in the event someone would want to reinclude the compiler.
+ error("Script needs compilation, ScummVM does not contain a WME compiler");
+ }
+
+ byte *ret = NULL;
+
+ // add script to cache
+ CScCachedScript *cachedScript = new CScCachedScript(filename, compBuffer, compSize);
+ if (cachedScript) {
+ int index = 0;
+ uint32 minTime = g_system->getMillis();
+ for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
+ if (_cachedScripts[i] == NULL) {
+ index = i;
+ break;
+ } else if (_cachedScripts[i]->_timestamp <= minTime) {
+ minTime = _cachedScripts[i]->_timestamp;
+ index = i;
+ }
+ }
+
+ if (_cachedScripts[index] != NULL) {
+ delete _cachedScripts[index];
+ }
+ _cachedScripts[index] = cachedScript;
+
+ ret = cachedScript->_buffer;
+ *outSize = cachedScript->_size;
+ }
+
+
+ // cleanup
+ delete[] buffer;
+
+ return ret;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::tick() {
+ if (_scripts.size() == 0) {
+ return STATUS_OK;
+ }
+
+
+ // resolve waiting scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+
+ switch (_scripts[i]->_state) {
+ case SCRIPT_WAITING: {
+ /*
+ bool obj_found=false;
+ for(int j=0; j<_gameRef->_regObjects.size(); j++)
+ {
+ if (_gameRef->_regObjects[j] == _scripts[i]->_waitObject)
+ {
+ if (_gameRef->_regObjects[j]->IsReady()) _scripts[i]->Run();
+ obj_found = true;
+ break;
+ }
+ }
+ if (!obj_found) _scripts[i]->finish(); // _waitObject no longer exists
+ */
+ if (_gameRef->validObject(_scripts[i]->_waitObject)) {
+ if (_scripts[i]->_waitObject->isReady()) {
+ _scripts[i]->run();
+ }
+ } else {
+ _scripts[i]->finish();
+ }
+ break;
+ }
+
+ case SCRIPT_SLEEPING: {
+ if (_scripts[i]->_waitFrozen) {
+ if (_scripts[i]->_waitTime <= g_system->getMillis()) {
+ _scripts[i]->run();
+ }
+ } else {
+ if (_scripts[i]->_waitTime <= _gameRef->_timer) {
+ _scripts[i]->run();
+ }
+ }
+ break;
+ }
+
+ case SCRIPT_WAITING_SCRIPT: {
+ if (!isValidScript(_scripts[i]->_waitScript) || _scripts[i]->_waitScript->_state == SCRIPT_ERROR) {
+ // fake return value
+ _scripts[i]->_stack->pushNULL();
+ _scripts[i]->_waitScript = NULL;
+ _scripts[i]->run();
+ } else {
+ if (_scripts[i]->_waitScript->_state == SCRIPT_THREAD_FINISHED) {
+ // copy return value
+ _scripts[i]->_stack->push(_scripts[i]->_waitScript->_stack->pop());
+ _scripts[i]->run();
+ _scripts[i]->_waitScript->finish();
+ _scripts[i]->_waitScript = NULL;
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ } // switch
+ } // for each script
+
+
+ // execute scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+
+ // skip paused scripts
+ if (_scripts[i]->_state == SCRIPT_PAUSED) {
+ continue;
+ }
+
+ // time sliced script
+ if (_scripts[i]->_timeSlice > 0) {
+ uint32 startTime = g_system->getMillis();
+ while (_scripts[i]->_state == SCRIPT_RUNNING && g_system->getMillis() - startTime < _scripts[i]->_timeSlice) {
+ _currentScript = _scripts[i];
+ _scripts[i]->executeInstruction();
+ }
+ if (_isProfiling && _scripts[i]->_filename) {
+ addScriptTime(_scripts[i]->_filename, g_system->getMillis() - startTime);
+ }
+ }
+
+ // normal script
+ else {
+ uint32 startTime = 0;
+ bool isProfiling = _isProfiling;
+ if (isProfiling) {
+ startTime = g_system->getMillis();
+ }
+
+ while (_scripts[i]->_state == SCRIPT_RUNNING) {
+ _currentScript = _scripts[i];
+ _scripts[i]->executeInstruction();
+ }
+ if (isProfiling && _scripts[i]->_filename) {
+ addScriptTime(_scripts[i]->_filename, g_system->getMillis() - startTime);
+ }
+ }
+ _currentScript = NULL;
+ }
+
+ removeFinishedScripts();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::tickUnbreakable() {
+ // execute unbreakable scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (!_scripts[i]->_unbreakable) {
+ continue;
+ }
+
+ while (_scripts[i]->_state == SCRIPT_RUNNING) {
+ _currentScript = _scripts[i];
+ _scripts[i]->executeInstruction();
+ }
+ _scripts[i]->finish();
+ _currentScript = NULL;
+ }
+ removeFinishedScripts();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::removeFinishedScripts() {
+ // remove finished scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR) {
+ if (!_scripts[i]->_thread && _scripts[i]->_owner) {
+ _scripts[i]->_owner->removeScript(_scripts[i]);
+ }
+
+ delete _scripts[i];
+ _scripts.remove_at(i);
+ i--;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int ScEngine::getNumScripts(int *running, int *waiting, int *persistent) {
+ int numRunning = 0, numWaiting = 0, numPersistent = 0, numTotal = 0;
+
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i]->_state == SCRIPT_FINISHED) {
+ continue;
+ }
+ switch (_scripts[i]->_state) {
+ case SCRIPT_RUNNING:
+ case SCRIPT_SLEEPING:
+ case SCRIPT_PAUSED:
+ numRunning++;
+ break;
+ case SCRIPT_WAITING:
+ numWaiting++;
+ break;
+ case SCRIPT_PERSISTENT:
+ numPersistent++;
+ break;
+ default:
+ warning("ScEngine::GetNumScripts - unhandled enum");
+ break;
+ }
+ numTotal++;
+ }
+ if (running) {
+ *running = numRunning;
+ }
+ if (waiting) {
+ *waiting = numWaiting;
+ }
+ if (persistent) {
+ *persistent = numPersistent;
+ }
+
+ return numTotal;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::emptyScriptCache() {
+ for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
+ if (_cachedScripts[i]) {
+ delete _cachedScripts[i];
+ _cachedScripts[i] = NULL;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::resetObject(BaseObject *Object) {
+ // terminate all scripts waiting for this object
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i]->_state == SCRIPT_WAITING && _scripts[i]->_waitObject == Object) {
+ if (!_gameRef->_compatKillMethodThreads) {
+ resetScript(_scripts[i]);
+ }
+
+ bool isThread = _scripts[i]->_methodThread || _scripts[i]->_thread;
+ _scripts[i]->finish(!isThread); // 1.9b1 - top-level script kills its threads as well
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::resetScript(ScScript *script) {
+ // terminate all scripts waiting for this script
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i]->_state == SCRIPT_WAITING_SCRIPT && _scripts[i]->_waitScript == script) {
+ _scripts[i]->finish();
+ }
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::persist(BasePersistenceManager *persistMgr) {
+ if (!persistMgr->getIsSaving()) {
+ cleanup();
+ }
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+ persistMgr->transfer(TMEMBER(_currentScript));
+ persistMgr->transfer(TMEMBER(_globals));
+ _scripts.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::editorCleanup() {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i]->_owner == NULL && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) {
+ delete _scripts[i];
+ _scripts.remove_at(i);
+ i--;
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::pauseAll() {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i] != _currentScript) {
+ _scripts[i]->pause();
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::resumeAll() {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ _scripts[i]->resume();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::isValidScript(ScScript *script) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ if (_scripts[i] == script) {
+ return true;
+ }
+ }
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::clearGlobals(bool includingNatives) {
+ _globals->CleanProps(includingNatives);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::addScriptTime(const char *filename, uint32 time) {
+ if (!_isProfiling) {
+ return;
+ }
+
+ AnsiString fileName = filename;
+ fileName.toLowercase();
+ _scriptTimes[fileName] += time;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::enableProfiling() {
+ if (_isProfiling) {
+ return;
+ }
+
+ // destroy old data, if any
+ _scriptTimes.clear();
+
+ _profilingStartTime = g_system->getMillis();
+ _isProfiling = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::disableProfiling() {
+ if (!_isProfiling) {
+ return;
+ }
+
+ dumpStats();
+ _isProfiling = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScEngine::dumpStats() {
+ error("DumpStats not ported to ScummVM yet");
+ /* uint32 totalTime = g_system->getMillis() - _profilingStartTime;
+
+ typedef std::vector <std::pair<uint32, std::string> > TimeVector;
+ TimeVector times;
+
+ ScriptTimes::iterator it;
+ for (it = _scriptTimes.begin(); it != _scriptTimes.end(); ++it) {
+ times.push_back(std::pair<uint32, std::string> (it->_value, it->_key));
+ }
+ std::sort(times.begin(), times.end());
+
+
+ TimeVector::reverse_iterator tit;
+
+ _gameRef->LOG(0, "***** Script profiling information: *****");
+ _gameRef->LOG(0, " %-40s %fs", "Total execution time", (float)totalTime / 1000);
+
+ for (tit = times.rbegin(); tit != times.rend(); ++tit) {
+ _gameRef->LOG(0, " %-40s %fs (%f%%)", tit->second.c_str(), (float)tit->first / 1000, (float)tit->first / (float)totalTime * 100);
+ }*/
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
new file mode 100644
index 0000000000..1a023326eb
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -0,0 +1,135 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SCENGINE_H
+#define WINTERMUTE_SCENGINE_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base.h"
+
+namespace Wintermute {
+
+#define MAX_CACHED_SCRIPTS 20
+class ScScript;
+class ScValue;
+class BaseObject;
+class BaseScriptHolder;
+class ScEngine : public BaseClass {
+public:
+ class CScCachedScript {
+ public:
+ CScCachedScript(const char *filename, byte *buffer, uint32 size) {
+ _timestamp = g_system->getMillis();
+ _buffer = new byte[size];
+ if (_buffer) {
+ memcpy(_buffer, buffer, size);
+ }
+ _size = size;
+ _filename = filename;
+ };
+
+ ~CScCachedScript() {
+ if (_buffer) {
+ delete[] _buffer;
+ }
+ };
+
+ uint32 _timestamp;
+ byte *_buffer;
+ uint32 _size;
+ Common::String _filename;
+ };
+
+ class CScBreakpoint {
+ public:
+ CScBreakpoint(const char *filename) {
+ _filename = filename;
+ }
+
+ ~CScBreakpoint() {
+ _lines.clear();
+ }
+
+ Common::String _filename;
+ BaseArray<int> _lines;
+ };
+
+public:
+ bool clearGlobals(bool includingNatives = false);
+ bool tickUnbreakable();
+ bool removeFinishedScripts();
+ bool isValidScript(ScScript *script);
+
+ ScScript *_currentScript;
+ bool resumeAll();
+ bool pauseAll();
+ void editorCleanup();
+ bool resetObject(BaseObject *Object);
+ bool resetScript(ScScript *script);
+ bool emptyScriptCache();
+ byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false);
+ DECLARE_PERSISTENT(ScEngine, BaseClass)
+ bool cleanup();
+ int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL);
+ bool tick();
+ ScValue *_globals;
+ ScScript *runScript(const char *filename, BaseScriptHolder *owner = NULL);
+ static const bool _compilerAvailable = false;
+
+ ScEngine(BaseGame *inGame);
+ virtual ~ScEngine();
+ static byte *loadFile(void *data, char *filename, uint32 *size);
+ static void closeFile(void *data, byte *buffer);
+ static void parseElement(void *data, int line, int type, void *elementData);
+
+ BaseArray<ScScript *> _scripts;
+
+ void enableProfiling();
+ void disableProfiling();
+ bool getIsProfiling() {
+ return _isProfiling;
+ }
+
+ void addScriptTime(const char *filename, uint32 Time);
+ void dumpStats();
+
+private:
+
+ CScCachedScript *_cachedScripts[MAX_CACHED_SCRIPTS];
+ bool _isProfiling;
+ uint32 _profilingStartTime;
+
+ typedef Common::HashMap<Common::String, uint32> ScriptTimes;
+ ScriptTimes _scriptTimes;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp
new file mode 100644
index 0000000000..613cbd0758
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_array.cpp
@@ -0,0 +1,252 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/system/sys_instance.h"
+#include "engines/wintermute/base/scriptables/script_ext_array.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(SXArray, false)
+
+BaseScriptable *makeSXArray(BaseGame *inGame, ScStack *stack) {
+ return new SXArray(inGame, stack);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXArray::SXArray(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
+ _length = 0;
+ _values = new ScValue(_gameRef);
+
+ int numParams = stack->pop()->getInt(0);
+
+ if (numParams == 1) {
+ _length = stack->pop()->getInt(0);
+ } else if (numParams > 1) {
+ _length = numParams;
+ char paramName[20];
+ for (int i = 0; i < numParams; i++) {
+ sprintf(paramName, "%d", i);
+ _values->setProp(paramName, stack->pop());
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXArray::SXArray(BaseGame *inGame) : BaseScriptable(inGame) {
+ _length = 0;
+ _values = new ScValue(_gameRef);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXArray::~SXArray() {
+ delete _values;
+ _values = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *SXArray::scToString() {
+ char dummy[32768];
+ strcpy(dummy, "");
+ char propName[20];
+ for (int i = 0; i < _length; i++) {
+ sprintf(propName, "%d", i);
+ ScValue *val = _values->getProp(propName);
+ if (val) {
+ if (strlen(dummy) + strlen(val->getString()) < 32768) {
+ strcat(dummy, val->getString());
+ }
+ }
+
+ if (i < _length - 1 && strlen(dummy) + 1 < 32768) {
+ strcat(dummy, ",");
+ }
+ }
+ _strRep = dummy;
+ return _strRep.c_str();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXArray::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // Push
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Push") == 0) {
+ int numParams = stack->pop()->getInt(0);
+ char paramName[20];
+
+ for (int i = 0; i < numParams; i++) {
+ _length++;
+ sprintf(paramName, "%d", _length - 1);
+ _values->setProp(paramName, stack->pop(), true);
+ }
+ stack->pushInt(_length);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Pop
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Pop") == 0) {
+
+ stack->correctParams(0);
+
+ if (_length > 0) {
+ char paramName[20];
+ sprintf(paramName, "%d", _length - 1);
+ stack->push(_values->getProp(paramName));
+ _values->deleteProp(paramName);
+ _length--;
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *SXArray::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("array");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Length
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Length") {
+ _scValue->setInt(_length);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // [number]
+ //////////////////////////////////////////////////////////////////////////
+ else {
+ char paramName[20];
+ if (validNumber(name.c_str(), paramName)) { // TODO: Change to Common::String
+ return _values->getProp(paramName);
+ } else {
+ return _scValue;
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXArray::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Length
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Length") == 0) {
+ int origLength = _length;
+ _length = MAX(value->getInt(0), 0);
+
+ char propName[20];
+ if (_length < origLength) {
+ for (int i = _length; i < origLength; i++) {
+ sprintf(propName, "%d", i);
+ _values->deleteProp(propName);
+ }
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // [number]
+ //////////////////////////////////////////////////////////////////////////
+ else {
+ char paramName[20];
+ if (validNumber(name, paramName)) {
+ int index = atoi(paramName);
+ if (index >= _length) {
+ _length = index + 1;
+ }
+ return _values->setProp(paramName, value);
+ } else {
+ return STATUS_FAILED;
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXArray::persist(BasePersistenceManager *persistMgr) {
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_length));
+ persistMgr->transfer(TMEMBER(_values));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXArray::validNumber(const char *origStr, char *outStr) {
+ bool isNumber = true;
+ for (uint32 i = 0; i < strlen(origStr); i++) {
+ if (!(origStr[i] >= '0' && origStr[i] <= '9')) {
+ isNumber = false;
+ break;
+ }
+ }
+
+ if (isNumber) {
+ int index = atoi(origStr);
+ sprintf(outStr, "%d", index);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SXArray::push(ScValue *val) {
+ char paramName[20];
+ _length++;
+ sprintf(paramName, "%d", _length - 1);
+ _values->setProp(paramName, val, true);
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h
new file mode 100644
index 0000000000..284c547a27
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_array.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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SXARRAY_H
+#define WINTERMUTE_SXARRAY_H
+
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+class SXArray : public BaseScriptable {
+public:
+ bool push(ScValue *val);
+ bool validNumber(const char *origStr, char *outStr);
+ DECLARE_PERSISTENT(SXArray, BaseScriptable)
+ SXArray(BaseGame *inGame, ScStack *stack);
+ SXArray(BaseGame *inGame);
+ virtual ~SXArray();
+ ScValue *scGetProperty(const Common::String &name);
+ bool scSetProperty(const char *name, ScValue *value);
+ bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ const char *scToString();
+private:
+ int _length;
+ ScValue *_values;
+ Common::String _strRep;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp
new file mode 100644
index 0000000000..5aa069d0b2
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_date.cpp
@@ -0,0 +1,293 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_ext_date.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(SXDate, false)
+
+BaseScriptable *makeSXDate(BaseGame *inGame, ScStack *stack) {
+ return new SXDate(inGame, stack);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXDate::SXDate(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
+ stack->correctParams(6);
+
+ memset(&_tm, 0, sizeof(_tm));
+
+ ScValue *valYear = stack->pop();
+ _tm.tm_year = valYear->getInt() - 1900;
+ _tm.tm_mon = stack->pop()->getInt() - 1;
+ _tm.tm_mday = stack->pop()->getInt();
+ _tm.tm_hour = stack->pop()->getInt();
+ _tm.tm_min = stack->pop()->getInt();
+ _tm.tm_sec = stack->pop()->getInt();
+
+ if (valYear->isNULL()) {
+ g_system->getTimeAndDate(_tm);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXDate::~SXDate() {
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+const char *SXDate::scToString() {
+ // TODO: Make this more stringy, and less ISO 8601-like
+ _strRep.format("%04d-%02d-%02d - %02d:%02d:%02d", _tm.tm_year, _tm.tm_mon, _tm.tm_mday, _tm.tm_hour, _tm.tm_min, _tm.tm_sec);
+ return _strRep.c_str();
+ //return asctime(&_tm);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXDate::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // GetYear
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetYear") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_year + 1900);
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GetMonth
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetMonth") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_mon + 1);
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GetDate
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetDate") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_mday);
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GetHours
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHours") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_hour);
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GetMinutes
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetMinutes") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_min);
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GetSeconds
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetSeconds") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_sec);
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // GetWeekday
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetWeekday") == 0) {
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_wday);
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetYear
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetYear") == 0) {
+ stack->correctParams(1);
+ _tm.tm_year = stack->pop()->getInt() - 1900;
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SetMonth
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetMonth") == 0) {
+ stack->correctParams(1);
+ _tm.tm_mon = stack->pop()->getInt() - 1;
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SetDate
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetDate") == 0) {
+ stack->correctParams(1);
+ _tm.tm_mday = stack->pop()->getInt();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SetHours
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetHours") == 0) {
+ stack->correctParams(1);
+ _tm.tm_hour = stack->pop()->getInt();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SetMinutes
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetMinutes") == 0) {
+ stack->correctParams(1);
+ _tm.tm_min = stack->pop()->getInt();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // SetSeconds
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetSeconds") == 0) {
+ stack->correctParams(1);
+ _tm.tm_sec = stack->pop()->getInt();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetCurrentTime
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetCurrentTime") == 0) {
+ stack->correctParams(0);
+ g_system->getTimeAndDate(_tm);
+ stack->pushNULL();
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *SXDate::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("date");
+ return _scValue;
+ } else {
+ return _scValue;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXDate::scSetProperty(const char *name, ScValue *value) {
+ /*
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Name")==0){
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ else*/ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXDate::persist(BasePersistenceManager *persistMgr) {
+
+ BaseScriptable::persist(persistMgr);
+ persistMgr->transfer(TMEMBER(_tm.tm_year));
+ persistMgr->transfer(TMEMBER(_tm.tm_mon));
+ persistMgr->transfer(TMEMBER(_tm.tm_mday));
+ persistMgr->transfer(TMEMBER(_tm.tm_hour));
+ persistMgr->transfer(TMEMBER(_tm.tm_min));
+ persistMgr->transfer(TMEMBER(_tm.tm_sec));
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int SXDate::scCompare(BaseScriptable *Value) {
+ TimeDate time1 = _tm;
+ TimeDate time2 = ((SXDate *)Value)->_tm;
+
+ if (time1.tm_year < time2.tm_year) {
+ return -1;
+ } else if (time1.tm_year == time2.tm_year) {
+ if (time1.tm_mon < time2.tm_mon) {
+ return -1;
+ } else if (time1.tm_mon == time2.tm_mon) {
+ if (time1.tm_mday < time2.tm_mday) {
+ return -1;
+ } else if (time1.tm_mday == time2.tm_mday) {
+ if (time1.tm_hour < time2.tm_hour) {
+ return -1;
+ } else if (time1.tm_hour == time2.tm_hour) {
+ if (time1.tm_min < time2.tm_min) {
+ return -1;
+ } else if (time1.tm_min == time2.tm_min) {
+ if (time1.tm_sec < time2.tm_sec) {
+ return -1;
+ } else if (time1.tm_sec == time2.tm_sec) {
+ return 0; // Equal
+ } else {
+ return 1; // Sec
+ }
+ } else {
+ return 1; // Minute
+ }
+ } else {
+ return 1; // Hour
+ }
+ } else {
+ return 1; // Day
+ }
+ } else {
+ return 1; // Month
+ }
+ } else {
+ return 1; // Year
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h
new file mode 100644
index 0000000000..062b7c55c7
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_date.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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SXDATE_H
+#define WINTERMUTE_SXDATE_H
+
+#include "common/system.h"
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+class SXDate : public BaseScriptable {
+public:
+ int scCompare(BaseScriptable *Value);
+ DECLARE_PERSISTENT(SXDate, BaseScriptable)
+ SXDate(BaseGame *inGame, ScStack *Stack);
+ virtual ~SXDate();
+ ScValue *scGetProperty(const Common::String &name);
+ bool scSetProperty(const char *name, ScValue *value);
+ bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ const char *scToString();
+private:
+ TimeDate _tm;
+ Common::String _strRep;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
new file mode 100644
index 0000000000..a1d39c5d0a
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -0,0 +1,828 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/system/sys_class_registry.h"
+#include "engines/wintermute/system/sys_class.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/scriptables/script_ext_file.h"
+
+// Note: This code is completely untested, as I have yet to find a game that uses SXFile.
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(SXFile, false)
+
+BaseScriptable *makeSXFile(BaseGame *inGame, ScStack *stack) {
+ return new SXFile(inGame, stack);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXFile::SXFile(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ _filename = NULL;
+ if (!val->isNULL()) {
+ BaseUtils::setString(&_filename, val->getString());
+ }
+
+ _readFile = NULL;
+ _writeFile = NULL;
+
+ _mode = 0;
+ _textMode = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXFile::~SXFile() {
+ cleanup();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SXFile::cleanup() {
+ delete[] _filename;
+ _filename = NULL;
+ close();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SXFile::close() {
+ if (_readFile) {
+ BaseFileManager::getEngineInstance()->closeFile(_readFile);
+ _readFile = NULL;
+ }
+ if (_writeFile) {
+ _writeFile->finalize();
+ delete _writeFile;
+ _writeFile = NULL;
+ }
+ _mode = 0;
+ _textMode = false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+const char *SXFile::scToString() {
+ if (_filename) {
+ return _filename;
+ } else {
+ return "[file object]";
+ }
+}
+
+#define FILE_BUFFER_SIZE 32768
+//////////////////////////////////////////////////////////////////////////
+bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetFilename
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetFilename") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+ cleanup();
+ BaseUtils::setString(&_filename, filename);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // OpenAsText / OpenAsBinary
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "OpenAsText") == 0 || strcmp(name, "OpenAsBinary") == 0) {
+ stack->correctParams(1);
+ close();
+ _mode = stack->pop()->getInt(1);
+ if (_mode < 1 || _mode > 3) {
+ script->runtimeError("File.%s: invalid access mode. Setting read mode.", name);
+ _mode = 1;
+ }
+ if (_mode == 1) {
+ _readFile = BaseFileManager::getEngineInstance()->openFile(_filename);
+ if (!_readFile) {
+ //script->runtimeError("File.%s: Error opening file '%s' for reading.", Name, _filename);
+ close();
+ } else {
+ _textMode = strcmp(name, "OpenAsText") == 0;
+ }
+ } else {
+ if (strcmp(name, "OpenAsText") == 0) {
+ if (_mode == 2) {
+ _writeFile = openForWrite(_filename, false);
+ } else {
+ _writeFile = openForAppend(_filename, false);
+ }
+ } else {
+ if (_mode == 2) {
+ _writeFile = openForWrite(_filename, true);
+ } else {
+ _writeFile = openForAppend(_filename, true);
+ }
+ }
+
+ if (!_writeFile) {
+ //script->runtimeError("File.%s: Error opening file '%s' for writing.", Name, _filename);
+ close();
+ } else {
+ _textMode = strcmp(name, "OpenAsText") == 0;
+ }
+ }
+
+ if (_readFile || _writeFile) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Close
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Close") == 0) {
+ stack->correctParams(0);
+ close();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetPosition
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetPosition") == 0) {
+ stack->correctParams(1);
+ if (_mode == 0) {
+ script->runtimeError("File.%s: File is not open", name);
+ stack->pushBool(false);
+ } else {
+ int pos = stack->pop()->getInt();
+ stack->pushBool(setPos(pos));
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Delete
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Delete") == 0) {
+ stack->correctParams(0);
+ close();
+ error("SXFile-Method: \"Delete\" not supported");
+ //stack->pushBool(BasePlatform::deleteFile(_filename) != false);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Copy
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Copy") == 0) {
+ stack->correctParams(2);
+ /* const char *dest = */ stack->pop()->getString();
+ /* bool overwrite = */ stack->pop()->getBool(true);
+
+ close();
+ error("SXFile-Method: Copy not supported");
+ //stack->pushBool(BasePlatform::copyFile(_filename, Dest, !Overwrite) != false);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadLine
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadLine") == 0) {
+ stack->correctParams(0);
+ if (!_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open in text mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ uint32 bufSize = FILE_BUFFER_SIZE;
+ byte *buf = (byte *)malloc(bufSize);
+ uint32 counter = 0;
+ byte b;
+ bool foundNewLine = false;
+ bool ret = STATUS_FAILED;
+ do {
+ ret = _readFile->read(&b, 1);
+ if (ret != 1) {
+ break;
+ }
+
+ if (counter > bufSize) {
+ buf = (byte *)realloc(buf, bufSize + FILE_BUFFER_SIZE);
+ bufSize += FILE_BUFFER_SIZE;
+ }
+ if (b == '\n') {
+ buf[counter] = '\0';
+ foundNewLine = true;
+ break;
+ } else if (b == 0x0D) {
+ continue;
+ } else {
+ buf[counter] = b;
+ counter++;
+ }
+ } while (DID_SUCCEED(ret));
+
+ if (counter > bufSize) {
+ buf = (byte *)realloc(buf, bufSize + FILE_BUFFER_SIZE);
+ bufSize += FILE_BUFFER_SIZE;
+ }
+ buf[counter] = '\0';
+
+ if (!foundNewLine && counter == 0) {
+ stack->pushNULL();
+ } else {
+ stack->pushString((char *)buf);
+ }
+
+ free(buf);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadText
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadText") == 0) {
+ stack->correctParams(1);
+ int textLen = stack->pop()->getInt();
+
+ if (!_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open in text mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ uint32 bufSize = FILE_BUFFER_SIZE;
+ byte *buf = (byte *)malloc(bufSize);
+ uint32 counter = 0;
+ byte b;
+
+ bool ret = STATUS_FAILED;
+ while (counter < (uint32)textLen) {
+ ret = _readFile->read(&b, 1);
+ if (ret != 1) {
+ break;
+ }
+
+ if (counter > bufSize) {
+ buf = (byte *)realloc(buf, bufSize + FILE_BUFFER_SIZE);
+ bufSize += FILE_BUFFER_SIZE;
+ }
+ if (b == 0x0D) {
+ continue;
+ } else {
+ buf[counter] = b;
+ counter++;
+ }
+ }
+
+ if (counter > bufSize) {
+ buf = (byte *)realloc(buf, bufSize + FILE_BUFFER_SIZE);
+ bufSize += FILE_BUFFER_SIZE;
+ }
+ buf[counter] = '\0';
+
+ if (textLen > 0 && counter == 0) {
+ stack->pushNULL();
+ } else {
+ stack->pushString((char *)buf);
+ }
+
+ free(buf);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteLine / WriteText
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteLine") == 0 || strcmp(name, "WriteText") == 0) {
+ stack->correctParams(1);
+ const char *line = stack->pop()->getString();
+ if (!_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in text mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ Common::String writeLine;
+ if (strcmp(name, "WriteLine") == 0) {
+ writeLine = Common::String::format("%s\n", line);
+ } else {
+ writeLine = Common::String::format("%s", line);
+ }
+ _writeFile->writeString(writeLine);
+ _writeFile->writeByte(0);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////
+ // ReadBool
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadBool") == 0) {
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ bool val;
+ if (_readFile->read(&val, sizeof(bool)) == sizeof(bool)) {
+ stack->pushBool(val);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadByte
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadByte") == 0) {
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ byte val = _readFile->readByte();
+ if (!_readFile->err()) {
+ stack->pushInt(val);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadShort
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadShort") == 0) {
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ int16 val = _readFile->readSint16LE();
+ if (!_readFile->err()) {
+ stack->pushInt(65536 + val);
+ } else {
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadInt / ReadLong
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadInt") == 0 || strcmp(name, "ReadLong") == 0) {
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ int32 val = _readFile->readSint32LE();
+ if (!_readFile->err()) {
+ stack->pushInt(val);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadFloat
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadFloat") == 0) {
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ float val;
+ (*(uint32 *)&val) = _readFile->readUint32LE();
+ if (!_readFile->err()) {
+ stack->pushFloat(val);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadDouble
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadDouble") == 0) { // TODO: Solve reading a 8 byte double.
+ error("SXFile::ReadDouble - Not endian safe yet");
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ double val;
+ if (_readFile->read(&val, sizeof(double)) == sizeof(double)) {
+ stack->pushFloat(val);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ReadString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ReadString") == 0) {
+ stack->correctParams(0);
+ if (_textMode || !_readFile) {
+ script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+ uint32 size = _readFile->readUint32LE();
+ if (!_readFile->err()) {
+ byte *str = new byte[size + 1];
+ if (str) {
+ if (_readFile->read(str, size) == size) {
+ str[size] = '\0';
+ stack->pushString((char *)str);
+ }
+ delete[] str;
+ } else {
+ stack->pushNULL();
+ }
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteBool
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteBool") == 0) {
+ stack->correctParams(1);
+ bool val = stack->pop()->getBool();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ _writeFile->writeByte(val);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteByte
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteByte") == 0) {
+ stack->correctParams(1);
+ byte val = stack->pop()->getInt();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ _writeFile->writeByte(val);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteShort
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteShort") == 0) {
+ stack->correctParams(1);
+ int16 val = stack->pop()->getInt();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ _writeFile->writeSint16LE(val);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteInt / WriteLong
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteInt") == 0 || strcmp(name, "WriteLong") == 0) {
+ stack->correctParams(1);
+ int32 val = stack->pop()->getInt();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ _writeFile->writeSint32LE(val);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteFloat
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteFloat") == 0) {
+ stack->correctParams(1);
+ float val = stack->pop()->getFloat();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ uint32 *ptr = (uint32 *)&val;
+ _writeFile->writeUint32LE(*ptr);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteDouble
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteDouble") == 0) {
+ error("SXFile::WriteDouble - Not endian safe yet");
+ stack->correctParams(1);
+ /* double val = */ stack->pop()->getFloat();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+ //fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // WriteString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "WriteString") == 0) {
+ stack->correctParams(1);
+ const char *val = stack->pop()->getString();
+
+ if (_textMode || !_writeFile) {
+ script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
+ stack->pushBool(false);
+ return STATUS_OK;
+ }
+
+ uint32 size = strlen(val);
+ _writeFile->writeUint32LE(size);
+ _writeFile->writeString(val);
+
+ stack->pushBool(true);
+
+ return STATUS_OK;
+ } else {
+ return BaseScriptable::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *SXFile::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("file");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Filename (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Filename") {
+ _scValue->setString(_filename);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Position (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Position") {
+ _scValue->setInt(getPos());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Length (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Length") {
+ _scValue->setInt(getLength());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextMode (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TextMode") {
+ _scValue->setBool(_textMode);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // AccessMode (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "AccessMode") {
+ _scValue->setInt(_mode);
+ return _scValue;
+ } else {
+ return BaseScriptable::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXFile::scSetProperty(const char *name, ScValue *value) {
+ /*
+ //////////////////////////////////////////////////////////////////////////
+ // Length
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Length")==0){
+ int origLength = _length;
+ _length = max(value->getInt(0), 0);
+
+ char propName[20];
+ if (_length < OrigLength){
+ for(int i=_length; i<OrigLength; i++){
+ sprintf(PropName, "%d", i);
+ _values->DeleteProp(PropName);
+ }
+ }
+ return STATUS_OK;
+ }
+ else*/ return BaseScriptable::scSetProperty(name, value);
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 SXFile::getPos() {
+ if (_mode == 1 && _readFile) {
+ return _readFile->pos();
+ } else if ((_mode == 2 || _mode == 3) && _writeFile) {
+ error("SXFile - getPos for WriteFile not supported");
+ return 0;
+// return ftell((FILE *)_writeFile);
+ } else {
+ return 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SXFile::setPos(uint32 pos, int whence) {
+ if (_mode == 1 && _readFile) {
+ return _readFile->seek(pos, whence);
+ } else if ((_mode == 2 || _mode == 3) && _writeFile) {
+ error("SXFile - seeking in WriteFile not supported");
+ return false;
+// return fseek((FILE *)_writeFile, pos, (int)origin) == 0;
+ } else {
+ return false;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 SXFile::getLength() {
+ if (_mode == 1 && _readFile) {
+ return _readFile->size();
+ } else if ((_mode == 2 || _mode == 3) && _writeFile) {
+ error("SXFile - reading length for WriteFile not supported");
+ return 0;
+ /*
+ uint32 currentPos = ftell((FILE *)_writeFile);
+ fseek((FILE *)_writeFile, 0, SEEK_END);
+ int ret = ftell((FILE *)_writeFile);
+ fseek((FILE *)_writeFile, CurrentPos, SEEK_SET);
+ return Ret;*/
+ } else {
+ return 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SXFile::persist(BasePersistenceManager *persistMgr) {
+
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_filename));
+ persistMgr->transfer(TMEMBER(_mode));
+ persistMgr->transfer(TMEMBER(_textMode));
+
+ uint32 pos = 0;
+ if (persistMgr->getIsSaving()) {
+ pos = getPos();
+ persistMgr->transfer(TMEMBER(pos));
+ } else {
+ persistMgr->transfer(TMEMBER(pos));
+
+ // try to re-open file if needed
+ _writeFile = NULL;
+ _readFile = NULL;
+
+ if (_mode != 0) {
+ // open for reading
+ if (_mode == 1) {
+ _readFile = BaseFileManager::getEngineInstance()->openFile(_filename);
+ if (!_readFile) {
+ close();
+ }
+ }
+ // open for writing / appending
+ else {
+ if (_textMode) {
+ if (_mode == 2) {
+ _writeFile = openForWrite(_filename, false);
+ } else {
+ _writeFile = openForAppend(_filename, false);
+ }
+ } else {
+ if (_mode == 2) {
+ _writeFile = openForWrite(_filename, true);
+ } else {
+ _writeFile = openForAppend(_filename, true);
+ }
+ }
+ if (_writeFile) {
+ close();
+ }
+ }
+ setPos(pos);
+ }
+ }
+
+ return STATUS_OK;
+}
+
+// Should replace fopen(..., "wb+") and fopen(..., "w+")
+Common::WriteStream *SXFile::openForWrite(const Common::String &filename, bool binary) {
+ error("SXFile::openForWrite - WriteFiles not supported");
+}
+
+// Should replace fopen(..., "ab+") and fopen(..., "a+")
+Common::WriteStream *SXFile::openForAppend(const Common::String &filename, bool binary) {
+ error("SXFile::openForAppend - WriteFiles not supported");
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h
new file mode 100644
index 0000000000..f7c72fcfb3
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_file.h
@@ -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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTES_SXFILE_H
+#define WINTERMUTES_SXFILE_H
+
+
+#include "engines/wintermute/base/base_scriptable.h"
+#include "common/stream.h"
+
+namespace Wintermute {
+
+class BaseFile;
+
+class SXFile : public BaseScriptable {
+public:
+ DECLARE_PERSISTENT(SXFile, BaseScriptable)
+ ScValue *scGetProperty(const Common::String &name);
+ bool scSetProperty(const char *name, ScValue *value);
+ bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ const char *scToString();
+ SXFile(BaseGame *inGame, ScStack *Stack);
+ virtual ~SXFile();
+private:
+ Common::SeekableReadStream *_readFile;
+ Common::WriteStream *_writeFile;
+ int _mode; // 0..none, 1..read, 2..write, 3..append
+ bool _textMode;
+ void close();
+ void cleanup();
+ uint32 getPos();
+ uint32 getLength();
+ bool setPos(uint32 pos, int whence = SEEK_SET);
+ char *_filename;
+ Common::WriteStream *openForWrite(const Common::String &filename, bool binary);
+ Common::WriteStream *openForAppend(const Common::String &filename, bool binary);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp
new file mode 100644
index 0000000000..d816fbec65
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_math.cpp
@@ -0,0 +1,295 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/scriptables/script_ext_math.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/persistent.h"
+#include "common/math.h"
+#include <math.h>
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+IMPLEMENT_PERSISTENT(SXMath, true)
+
+BaseScriptable *makeSXMath(BaseGame *inGame) {
+ return new SXMath(inGame);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXMath::SXMath(BaseGame *inGame) : BaseScriptable(inGame) {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXMath::~SXMath() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // Abs
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Abs") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(fabs(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Acos
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Acos") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(acos(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Asin
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Asin") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(asin(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Atan
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Atan") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(atan(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Atan2
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Atan2") == 0) {
+ stack->correctParams(2);
+ double y = stack->pop()->getFloat();
+ double x = stack->pop()->getFloat();
+ stack->pushFloat(atan2(y, x));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Ceil
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Ceil") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(ceil(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Cos
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Cos") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(cos(degreeToRadian(stack->pop()->getFloat())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Cosh
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Cosh") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(cosh(degreeToRadian(stack->pop()->getFloat())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Exp
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Exp") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(exp(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Floor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Floor") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(floor(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Log
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Log") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(log(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Log10
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Log10") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(log10(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Pow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Pow") == 0) {
+ stack->correctParams(2);
+ double x = stack->pop()->getFloat();
+ double y = stack->pop()->getFloat();
+
+ stack->pushFloat(pow(x, y));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Sin
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Sin") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(sin(degreeToRadian(stack->pop()->getFloat())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Sinh
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Sinh") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(sinh(degreeToRadian(stack->pop()->getFloat())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Tan
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Tan") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(tan(degreeToRadian(stack->pop()->getFloat())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Tanh
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Tanh") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(tanh(degreeToRadian(stack->pop()->getFloat())));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Sqrt
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Sqrt") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(sqrt(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DegToRad
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DegToRad") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(degreeToRadian(stack->pop()->getFloat()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RadToDeg
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "RadToDeg") == 0) {
+ stack->correctParams(1);
+ stack->pushFloat(radianToDegree(stack->pop()->getFloat()));
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *SXMath::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("math");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PI
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PI") {
+ _scValue->setFloat(M_PI);
+ return _scValue;
+ } else {
+ return _scValue;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+double SXMath::degreeToRadian(double value) {
+ return value * (M_PI / 180.0f);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+double SXMath::radianToDegree(double value) {
+ return value * (180.0f / M_PI);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMath::persist(BasePersistenceManager *persistMgr) {
+
+ BaseScriptable::persist(persistMgr);
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h
new file mode 100644
index 0000000000..48c43ea7e8
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_math.h
@@ -0,0 +1,53 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SXMATH_H
+#define WINTERMUTE_SXMATH_H
+
+
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+class SXMath : public BaseScriptable {
+public:
+ DECLARE_PERSISTENT(SXMath, BaseScriptable)
+ SXMath(BaseGame *inGame);
+ virtual ~SXMath();
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+
+private:
+ double degreeToRadian(double value);
+ double radianToDegree(double value);
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
new file mode 100644
index 0000000000..8f05b7bff6
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
@@ -0,0 +1,529 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_scriptable.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_ext_mem_buffer.h"
+#include "common/file.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(SXMemBuffer, false)
+
+BaseScriptable *makeSXMemBuffer(BaseGame *inGame, ScStack *stack) {
+ return new SXMemBuffer(inGame, stack);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXMemBuffer::SXMemBuffer(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
+ stack->correctParams(1);
+ _buffer = NULL;
+ _size = 0;
+
+ int newSize = stack->pop()->getInt();
+ resize(MAX(0, newSize));
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXMemBuffer::SXMemBuffer(BaseGame *inGame, void *buffer) : BaseScriptable(inGame) {
+ _size = 0;
+ _buffer = buffer;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXMemBuffer::~SXMemBuffer() {
+ cleanup();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void *SXMemBuffer::scToMemBuffer() {
+ return _buffer;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SXMemBuffer::cleanup() {
+ if (_size) {
+ free(_buffer);
+ }
+ _buffer = NULL;
+ _size = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMemBuffer::resize(int newSize) {
+ int oldSize = _size;
+
+ if (_size == 0) {
+ _buffer = malloc(newSize);
+ if (_buffer) {
+ _size = newSize;
+ }
+ } else {
+ void *newBuf = realloc(_buffer, newSize);
+ if (!newBuf) {
+ if (newSize == 0) {
+ _buffer = newBuf;
+ _size = newSize;
+ } else {
+ return STATUS_FAILED;
+ }
+ } else {
+ _buffer = newBuf;
+ _size = newSize;
+ }
+ }
+
+ if (_buffer && _size > oldSize) {
+ memset((byte *)_buffer + oldSize, 0, _size - oldSize);
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMemBuffer::checkBounds(ScScript *script, int start, int length) {
+ if (_buffer == NULL) {
+ script->runtimeError("Cannot use Set/Get methods on an uninitialized memory buffer");
+ return false;
+ }
+ if (_size == 0) {
+ return true;
+ }
+
+ if (start < 0 || length == 0 || start + length > _size) {
+ script->runtimeError("Set/Get method call is out of bounds");
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+const char *SXMemBuffer::scToString() {
+ return "[membuffer object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMemBuffer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetSize
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetSize") == 0) {
+ stack->correctParams(1);
+ int newSize = stack->pop()->getInt();
+ newSize = MAX(0, newSize);
+ if (DID_SUCCEED(resize(newSize))) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetBool
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetBool") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(bool))) {
+ stack->pushNULL();
+ } else {
+ stack->pushBool(*(bool *)((byte *)_buffer + start));
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetByte
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetByte") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(byte))) {
+ stack->pushNULL();
+ } else {
+ stack->pushInt(*(byte *)((byte *)_buffer + start));
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetShort
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetShort") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(short))) {
+ stack->pushNULL();
+ } else {
+ stack->pushInt(65536 + * (short *)((byte *)_buffer + start));
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetInt / GetLong
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetInt") == 0 || strcmp(name, "GetLong") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(int))) {
+ stack->pushNULL();
+ } else {
+ stack->pushInt(*(int *)((byte *)_buffer + start));
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFloat
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFloat") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(float))) {
+ stack->pushNULL();
+ } else {
+ stack->pushFloat(*(float *)((byte *)_buffer + start));
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetDouble
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetDouble") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(double))) {
+ stack->pushNULL();
+ } else {
+ stack->pushFloat(*(double *)((byte *)_buffer + start));
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetString") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ int length = stack->pop()->getInt();
+
+ // find end of string
+ if (length == 0 && start >= 0 && start < _size) {
+ for (int i = start; i < _size; i++) {
+ if (((char *)_buffer)[i] == '\0') {
+ length = i - start;
+ break;
+ }
+ }
+ }
+
+ if (!checkBounds(script, start, length)) {
+ stack->pushNULL();
+ } else {
+ char *str = new char[length + 1];
+ Common::strlcpy(str, (const char *)_buffer + start, length + 1);
+ stack->pushString(str);
+ delete[] str;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetPointer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetPointer") == 0) {
+ stack->correctParams(1);
+ int start = stack->pop()->getInt();
+ if (!checkBounds(script, start, sizeof(void *))) {
+ stack->pushNULL();
+ } else {
+ void *pointer = *(void **)((byte *)_buffer + start);
+ SXMemBuffer *buf = new SXMemBuffer(_gameRef, pointer);
+ stack->pushNative(buf, false);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetBool
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetBool") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ bool val = stack->pop()->getBool();
+
+ if (!checkBounds(script, start, sizeof(bool))) {
+ stack->pushBool(false);
+ } else {
+ *(bool *)((byte *)_buffer + start) = val;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetByte
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetByte") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ byte val = (byte)stack->pop()->getInt();
+
+ if (!checkBounds(script, start, sizeof(byte))) {
+ stack->pushBool(false);
+ } else {
+ *(byte *)((byte *)_buffer + start) = val;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetShort
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetShort") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ short val = (short)stack->pop()->getInt();
+
+ if (!checkBounds(script, start, sizeof(short))) {
+ stack->pushBool(false);
+ } else {
+ *(short *)((byte *)_buffer + start) = val;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetInt / SetLong
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetInt") == 0 || strcmp(name, "SetLong") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ int val = stack->pop()->getInt();
+
+ if (!checkBounds(script, start, sizeof(int))) {
+ stack->pushBool(false);
+ } else {
+ *(int *)((byte *)_buffer + start) = val;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetFloat
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetFloat") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ float val = (float)stack->pop()->getFloat();
+
+ if (!checkBounds(script, start, sizeof(float))) {
+ stack->pushBool(false);
+ } else {
+ *(float *)((byte *)_buffer + start) = val;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetDouble
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetDouble") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ double val = stack->pop()->getFloat();
+
+ if (!checkBounds(script, start, sizeof(double))) {
+ stack->pushBool(false);
+ } else {
+ *(double *)((byte *)_buffer + start) = val;
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetString
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetString") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ const char *val = stack->pop()->getString();
+
+ if (!checkBounds(script, start, strlen(val) + 1)) {
+ stack->pushBool(false);
+ } else {
+ memcpy((byte *)_buffer + start, val, strlen(val) + 1);
+ stack->pushBool(true);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetPointer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetPointer") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ /* ScValue *val = */ stack->pop();
+
+ if (!checkBounds(script, start, sizeof(void *))) {
+ stack->pushBool(false);
+ } else {
+ /*
+ int pointer = (int)Val->getMemBuffer();
+ memcpy((byte *)_buffer+Start, &Pointer, sizeof(void*));
+ stack->pushBool(true);
+ */
+ // TODO fix
+ stack->pushBool(false);
+
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DEBUG_Dump
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DEBUG_Dump") == 0) {
+ stack->correctParams(0);
+ if (_buffer && _size) {
+ warning("SXMemBuffer::ScCallMethod - DEBUG_Dump");
+ Common::DumpFile f;
+ f.open("buffer.bin");
+ f.write(_buffer, _size);
+ f.close();
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *SXMemBuffer::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("membuffer");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Size (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Size") {
+ _scValue->setInt(_size);
+ return _scValue;
+ } else {
+ return BaseScriptable::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMemBuffer::scSetProperty(const char *name, ScValue *value) {
+ /*
+ //////////////////////////////////////////////////////////////////////////
+ // Length
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Length")==0){
+ int origLength = _length;
+ _length = max(value->getInt(0), 0);
+
+ char propName[20];
+ if (_length < OrigLength){
+ for(int i=_length; i<OrigLength; i++){
+ sprintf(PropName, "%d", i);
+ _values->DeleteProp(PropName);
+ }
+ }
+ return STATUS_OK;
+ }
+ else*/ return BaseScriptable::scSetProperty(name, value);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXMemBuffer::persist(BasePersistenceManager *persistMgr) {
+
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_size));
+
+ if (persistMgr->getIsSaving()) {
+ if (_size > 0) {
+ persistMgr->putBytes((byte *)_buffer, _size);
+ }
+ } else {
+ if (_size > 0) {
+ _buffer = malloc(_size);
+ persistMgr->getBytes((byte *)_buffer, _size);
+ } else {
+ _buffer = NULL;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int SXMemBuffer::scCompare(BaseScriptable *val) {
+ if (_buffer == val->scToMemBuffer()) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
new file mode 100644
index 0000000000..1527a323dc
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
@@ -0,0 +1,60 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SXMEMBUFFER_H
+#define WINTERMUTE_SXMEMBUFFER_H
+
+
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+class SXMemBuffer : public BaseScriptable {
+public:
+ virtual int scCompare(BaseScriptable *Val);
+ DECLARE_PERSISTENT(SXMemBuffer, BaseScriptable)
+ ScValue *scGetProperty(const Common::String &name);
+ bool scSetProperty(const char *name, ScValue *value);
+ bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ const char *scToString();
+ SXMemBuffer(BaseGame *inGame, ScStack *stack);
+ SXMemBuffer(BaseGame *inGame, void *buffer);
+ virtual ~SXMemBuffer();
+ virtual void *scToMemBuffer();
+private:
+ int _size;
+
+ bool resize(int newSize);
+ void *_buffer;
+ void cleanup();
+ bool checkBounds(ScScript *script, int start, int length);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp
new file mode 100644
index 0000000000..b87aac81f9
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_object.cpp
@@ -0,0 +1,67 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/scriptables/script_ext_object.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(SXObject, false)
+
+BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack) {
+ return new SXObject(inGame, stack);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXObject::SXObject(BaseGame *inGame, ScStack *stack) : BaseObject(inGame) {
+ int numParams = stack->pop()->getInt(0);
+ for (int i = 0; i < numParams; i++) {
+ addScript(stack->pop()->getString());
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXObject::~SXObject() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXObject::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h
new file mode 100644
index 0000000000..c85d16d44e
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_object.h
@@ -0,0 +1,46 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SXOBJECT_H
+#define WINTERMUTE_SXOBJECT_H
+
+
+#include "engines/wintermute/base/base_object.h"
+
+namespace Wintermute {
+
+class SXObject : public BaseObject {
+public:
+ DECLARE_PERSISTENT(SXObject, BaseObject)
+ SXObject(BaseGame *inGame, ScStack *Stack);
+ virtual ~SXObject();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp
new file mode 100644
index 0000000000..5f7da1c2dd
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_string.cpp
@@ -0,0 +1,436 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/base/scriptables/script_ext_string.h"
+#include "engines/wintermute/base/scriptables/script_ext_array.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "common/tokenizer.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(SXString, false)
+
+BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack) {
+ return new SXString(inGame, stack);
+}
+
+//////////////////////////////////////////////////////////////////////////
+SXString::SXString(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
+ _string = NULL;
+ _capacity = 0;
+
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (val->isInt()) {
+ _capacity = MAX(0, val->getInt());
+ if (_capacity > 0) {
+ _string = new char[_capacity];
+ memset(_string, 0, _capacity);
+ }
+ } else {
+ setStringVal(val->getString());
+ }
+
+ if (_capacity == 0) {
+ setStringVal("");
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SXString::~SXString() {
+ if (_string) {
+ delete[] _string;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SXString::setStringVal(const char *val) {
+ int len = strlen(val);
+ if (len >= _capacity) {
+ _capacity = len + 1;
+ delete[] _string;
+ _string = NULL;
+ _string = new char[_capacity];
+ memset(_string, 0, _capacity);
+ }
+ strcpy(_string, val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *SXString::scToString() {
+ if (_string) {
+ return _string;
+ } else {
+ return "[null string]";
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SXString::scSetString(const char *val) {
+ setStringVal(val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // Substring
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Substring") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+ int end = stack->pop()->getInt();
+
+ if (end < start) {
+ BaseUtils::swap(&start, &end);
+ }
+
+ //try {
+ WideString str;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ str = StringUtil::utf8ToWide(_string);
+ } else {
+ str = StringUtil::ansiToWide(_string);
+ }
+
+ //WideString subStr = str.substr(start, end - start + 1);
+ WideString subStr(str.c_str() + start, end - start + 1);
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ stack->pushString(StringUtil::wideToUtf8(subStr).c_str());
+ } else {
+ stack->pushString(StringUtil::wideToAnsi(subStr).c_str());
+ }
+ // } catch (std::exception &) {
+ // stack->pushNULL();
+ // }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Substr
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Substr") == 0) {
+ stack->correctParams(2);
+ int start = stack->pop()->getInt();
+
+ ScValue *val = stack->pop();
+ int len = val->getInt();
+
+ if (!val->isNULL() && len <= 0) {
+ stack->pushString("");
+ return STATUS_OK;
+ }
+
+ if (val->isNULL()) {
+ len = strlen(_string) - start;
+ }
+
+// try {
+ WideString str;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ str = StringUtil::utf8ToWide(_string);
+ } else {
+ str = StringUtil::ansiToWide(_string);
+ }
+
+// WideString subStr = str.substr(start, len);
+ WideString subStr(str.c_str() + start, len);
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ stack->pushString(StringUtil::wideToUtf8(subStr).c_str());
+ } else {
+ stack->pushString(StringUtil::wideToAnsi(subStr).c_str());
+ }
+// } catch (std::exception &) {
+// stack->pushNULL();
+// }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ToUpperCase
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ToUpperCase") == 0) {
+ stack->correctParams(0);
+
+ WideString str;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ str = StringUtil::utf8ToWide(_string);
+ } else {
+ str = StringUtil::ansiToWide(_string);
+ }
+
+ str.toUppercase();
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ stack->pushString(StringUtil::wideToUtf8(str).c_str());
+ } else {
+ stack->pushString(StringUtil::wideToAnsi(str).c_str());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ToLowerCase
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ToLowerCase") == 0) {
+ stack->correctParams(0);
+
+ WideString str;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ str = StringUtil::utf8ToWide(_string);
+ } else {
+ str = StringUtil::ansiToWide(_string);
+ }
+
+ str.toLowercase();
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ stack->pushString(StringUtil::wideToUtf8(str).c_str());
+ } else {
+ stack->pushString(StringUtil::wideToAnsi(str).c_str());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // IndexOf
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "IndexOf") == 0) {
+ stack->correctParams(2);
+
+ const char *strToFind = stack->pop()->getString();
+ int index = stack->pop()->getInt();
+
+ WideString str;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ str = StringUtil::utf8ToWide(_string);
+ } else {
+ str = StringUtil::ansiToWide(_string);
+ }
+
+ WideString toFind;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ toFind = StringUtil::utf8ToWide(strToFind);
+ } else {
+ toFind = StringUtil::ansiToWide(strToFind);
+ }
+
+ int indexOf = StringUtil::indexOf(str, toFind, index);
+ stack->pushInt(indexOf);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Split
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Split") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ char separators[MAX_PATH_LENGTH] = ",";
+ if (!val->isNULL()) {
+ strcpy(separators, val->getString());
+ }
+
+ SXArray *array = new SXArray(_gameRef);
+ if (!array) {
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+
+ WideString str;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ str = StringUtil::utf8ToWide(_string);
+ } else {
+ str = StringUtil::ansiToWide(_string);
+ }
+
+ WideString delims;
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ delims = StringUtil::utf8ToWide(separators);
+ } else {
+ delims = StringUtil::ansiToWide(separators);
+ }
+
+ Common::Array<WideString> parts;
+
+
+
+ Common::StringTokenizer tokenizer(str, delims);
+ while (!tokenizer.empty()) {
+ Common::String str2 = tokenizer.nextToken();
+ parts.push_back(str2);
+ }
+ // TODO: Clean this up
+ /*do {
+ pos = StringUtil::IndexOf(Common::String(str.c_str() + start), delims, start);
+ //pos = str.find_first_of(delims, start);
+ if (pos == start) {
+ start = pos + 1;
+ } else if (pos == str.size()) {
+ parts.push_back(Common::String(str.c_str() + start));
+ break;
+ } else {
+ parts.push_back(Common::String(str.c_str() + start, pos - start));
+ start = pos + 1;
+ }
+ //start = str.find_first_not_of(delims, start);
+ start = StringUtil::LastIndexOf(Common::String(str.c_str() + start), delims, start) + 1;
+
+ } while (pos != str.size());*/
+
+ for (Common::Array<WideString>::iterator it = parts.begin(); it != parts.end(); ++it) {
+ WideString &part = (*it);
+
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ val = new ScValue(_gameRef, StringUtil::wideToUtf8(part).c_str());
+ } else {
+ val = new ScValue(_gameRef, StringUtil::wideToAnsi(part).c_str());
+ }
+
+ array->push(val);
+ delete val;
+ val = NULL;
+ }
+
+ stack->pushNative(array, false);
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *SXString::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type (RO)
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("string");
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Length (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Length") {
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ WideString wstr = StringUtil::utf8ToWide(_string);
+ _scValue->setInt(wstr.size());
+ } else {
+ _scValue->setInt(strlen(_string));
+ }
+
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Capacity
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Capacity") {
+ _scValue->setInt(_capacity);
+ return _scValue;
+ } else {
+ return _scValue;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXString::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Capacity
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Capacity") == 0) {
+ int32 newCap = (uint32)value->getInt();
+ if (newCap < (int32)(strlen(_string) + 1)) {
+ _gameRef->LOG(0, "Warning: cannot lower string capacity");
+ } else if (newCap != _capacity) {
+ char *newStr = new char[newCap];
+ if (newStr) {
+ memset(newStr, 0, newCap);
+ strcpy(newStr, _string);
+ delete[] _string;
+ _string = newStr;
+ _capacity = newCap;
+ }
+ }
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SXString::persist(BasePersistenceManager *persistMgr) {
+
+ BaseScriptable::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_capacity));
+
+ if (persistMgr->getIsSaving()) {
+ if (_capacity > 0) {
+ persistMgr->putBytes((byte *)_string, _capacity);
+ }
+ } else {
+ if (_capacity > 0) {
+ _string = new char[_capacity];
+ persistMgr->getBytes((byte *)_string, _capacity);
+ } else {
+ _string = NULL;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int SXString::scCompare(BaseScriptable *val) {
+ return strcmp(_string, ((SXString *)val)->_string);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h
new file mode 100644
index 0000000000..00bffab3a9
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_ext_string.h
@@ -0,0 +1,58 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SXSTRING_H
+#define WINTERMUTE_SXSTRING_H
+
+
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+class SXString : public BaseScriptable {
+public:
+ virtual int scCompare(BaseScriptable *Val);
+ DECLARE_PERSISTENT(SXString, BaseScriptable)
+ ScValue *scGetProperty(const Common::String &name);
+ bool scSetProperty(const char *name, ScValue *value);
+ bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ void scSetString(const char *val);
+ const char *scToString();
+ void setStringVal(const char *val);
+
+ SXString(BaseGame *inGame, ScStack *Stack);
+ virtual ~SXString();
+
+private:
+ char *_string;
+ int _capacity;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp
new file mode 100644
index 0000000000..77367045c2
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_stack.cpp
@@ -0,0 +1,232 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/base_game.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(ScStack, false)
+
+//////////////////////////////////////////////////////////////////////////
+ScStack::ScStack(BaseGame *inGame) : BaseClass(inGame) {
+ _sP = -1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScStack::~ScStack() {
+
+#if _DEBUG
+ //_gameRef->LOG(0, "STAT: Stack size: %d, SP=%d", _values.size(), _sP);
+#endif
+
+ for (uint32 i = 0; i < _values.size(); i++) {
+ delete _values[i];
+ }
+ _values.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *ScStack::pop() {
+ if (_sP < 0) {
+ _gameRef->LOG(0, "Fatal: Stack underflow");
+ return NULL;
+ }
+
+ return _values[_sP--];
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::push(ScValue *val) {
+ _sP++;
+
+ if (_sP < (int32)_values.size()) {
+ _values[_sP]->cleanup();
+ _values[_sP]->copy(val);
+ } else {
+ ScValue *copyVal = new ScValue(_gameRef);
+ copyVal->copy(val);
+ _values.add(copyVal);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *ScStack::getPushValue() {
+ _sP++;
+
+ if (_sP >= (int32)_values.size()) {
+ ScValue *val = new ScValue(_gameRef);
+ _values.add(val);
+ }
+ _values[_sP]->cleanup();
+ return _values[_sP];
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *ScStack::getTop() {
+ if (_sP < 0 || _sP >= (int32)_values.size()) {
+ return NULL;
+ } else {
+ return _values[_sP];
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *ScStack::getAt(int index) {
+ index = _sP - index;
+ if (index < 0 || index >= (int32)_values.size()) {
+ return NULL;
+ } else {
+ return _values[index];
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::correctParams(uint32 expectedParams) {
+ uint32 nuParams = (uint32)pop()->getInt();
+
+ if (expectedParams < nuParams) { // too many params
+ while (expectedParams < nuParams) {
+ //Pop();
+ delete _values[_sP - expectedParams];
+ _values.remove_at(_sP - expectedParams);
+ nuParams--;
+ _sP--;
+ }
+ } else if (expectedParams > nuParams) { // need more params
+ while (expectedParams > nuParams) {
+ //Push(null_val);
+ ScValue *nullVal = new ScValue(_gameRef);
+ nullVal->setNULL();
+ _values.insert_at(_sP - nuParams + 1, nullVal);
+ nuParams++;
+ _sP++;
+
+ if ((int32)_values.size() > _sP + 1) {
+ delete _values[_values.size() - 1];
+ _values.remove_at(_values.size() - 1);
+ }
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::pushNULL() {
+ /*
+ ScValue* val = new ScValue(_gameRef);
+ val->setNULL();
+ Push(val);
+ delete val;
+ */
+ getPushValue()->setNULL();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::pushInt(int val) {
+ /*
+ ScValue* val = new ScValue(_gameRef);
+ val->setInt(Val);
+ Push(val);
+ delete val;
+ */
+ getPushValue()->setInt(val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::pushFloat(double val) {
+ /*
+ ScValue* val = new ScValue(_gameRef);
+ val->setFloat(Val);
+ Push(val);
+ delete val;
+ */
+ getPushValue()->setFloat(val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::pushBool(bool val) {
+ /*
+ ScValue* val = new ScValue(_gameRef);
+ val->setBool(Val);
+ Push(val);
+ delete val;
+ */
+ getPushValue()->setBool(val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::pushString(const char *val) {
+ /*
+ ScValue* val = new ScValue(_gameRef);
+ val->setString(Val);
+ Push(val);
+ delete val;
+ */
+ getPushValue()->setString(val);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScStack::pushNative(BaseScriptable *val, bool persistent) {
+ /*
+ ScValue* val = new ScValue(_gameRef);
+ val->setNative(Val, Persistent);
+ Push(val);
+ delete val;
+ */
+
+ getPushValue()->setNative(val, persistent);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScStack::persist(BasePersistenceManager *persistMgr) {
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_sP));
+ _values.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h
new file mode 100644
index 0000000000..86d246cf34
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_stack.h
@@ -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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SCSTACK_H
+#define WINTERMUTE_SCSTACK_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/persistent.h"
+
+namespace Wintermute {
+
+class ScValue;
+class BaseScriptable;
+
+class ScStack : public BaseClass {
+public:
+ ScValue *getAt(int Index);
+ ScValue *getPushValue();
+ DECLARE_PERSISTENT(ScStack, BaseClass)
+ void pushNative(BaseScriptable *val, bool persistent);
+ void pushString(const char *val);
+ void pushBool(bool val);
+ void pushInt(int val);
+ void pushFloat(double val);
+ void pushNULL();
+ void correctParams(uint32 expectedParams);
+ ScValue *getTop();
+ void push(ScValue *val);
+ ScValue *pop();
+ ScStack(BaseGame *inGame);
+ virtual ~ScStack();
+ BaseArray<ScValue *> _values;
+ int _sP;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp
new file mode 100644
index 0000000000..0bc7ab5807
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_value.cpp
@@ -0,0 +1,995 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/base/base_scriptable.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_PERSISTENT(ScValue, false)
+
+//////////////////////////////////////////////////////////////////////////
+ScValue::ScValue(BaseGame *inGame) : BaseClass(inGame) {
+ _type = VAL_NULL;
+
+ _valBool = false;
+ _valInt = 0;
+ _valFloat = 0.0f;
+ _valNative = NULL;
+ _valString = NULL;
+ _valRef = NULL;
+ _persistent = false;
+ _isConstVar = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue::ScValue(BaseGame *inGame, bool val) : BaseClass(inGame) {
+ _type = VAL_BOOL;
+ _valBool = val;
+
+ _valInt = 0;
+ _valFloat = 0.0f;
+ _valNative = NULL;
+ _valString = NULL;
+ _valRef = NULL;
+ _persistent = false;
+ _isConstVar = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue::ScValue(BaseGame *inGame, int val) : BaseClass(inGame) {
+ _type = VAL_INT;
+ _valInt = val;
+
+ _valFloat = 0.0f;
+ _valBool = false;
+ _valNative = NULL;
+ _valString = NULL;
+ _valRef = NULL;
+ _persistent = false;
+ _isConstVar = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue::ScValue(BaseGame *inGame, double val) : BaseClass(inGame) {
+ _type = VAL_FLOAT;
+ _valFloat = val;
+
+ _valInt = 0;
+ _valBool = false;
+ _valNative = NULL;
+ _valString = NULL;
+ _valRef = NULL;
+ _persistent = false;
+ _isConstVar = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue::ScValue(BaseGame *inGame, const char *val) : BaseClass(inGame) {
+ _type = VAL_STRING;
+ _valString = NULL;
+ setStringVal(val);
+
+ _valBool = false;
+ _valInt = 0;
+ _valFloat = 0.0f;
+ _valNative = NULL;
+ _valRef = NULL;
+ _persistent = false;
+ _isConstVar = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::cleanup(bool ignoreNatives) {
+ deleteProps();
+
+ if (_valString) {
+ delete[] _valString;
+ }
+
+ if (!ignoreNatives) {
+ if (_valNative && !_persistent) {
+ _valNative->_refCount--;
+ if (_valNative->_refCount <= 0) {
+ delete _valNative;
+ _valNative = NULL;
+ }
+ }
+ }
+
+
+ _type = VAL_NULL;
+
+ _valBool = false;
+ _valInt = 0;
+ _valFloat = 0.0f;
+ _valNative = NULL;
+ _valString = NULL;
+ _valRef = NULL;
+ _persistent = false;
+ _isConstVar = false;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue::~ScValue() {
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *ScValue::getProp(const char *name) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getProp(name);
+ }
+
+ if (_type == VAL_STRING && strcmp(name, "Length") == 0) {
+ _gameRef->_scValue->_type = VAL_INT;
+
+ if (_gameRef->_textEncoding == TEXT_ANSI) {
+ _gameRef->_scValue->setInt(strlen(_valString));
+ } else {
+ WideString wstr = StringUtil::utf8ToWide(_valString);
+ _gameRef->_scValue->setInt(wstr.size());
+ }
+
+ return _gameRef->_scValue;
+ }
+
+ ScValue *ret = NULL;
+
+ if (_type == VAL_NATIVE && _valNative) {
+ ret = _valNative->scGetProperty(name);
+ }
+
+ if (ret == NULL) {
+ _valIter = _valObject.find(name);
+ if (_valIter != _valObject.end()) {
+ ret = _valIter->_value;
+ }
+ }
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::deleteProp(const char *name) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->deleteProp(name);
+ }
+
+ _valIter = _valObject.find(name);
+ if (_valIter != _valObject.end()) {
+ delete _valIter->_value;
+ _valIter->_value = NULL;
+ }
+
+ return STATUS_OK;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAsConst) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->setProp(name, val);
+ }
+
+ bool ret = STATUS_FAILED;
+ if (_type == VAL_NATIVE && _valNative) {
+ ret = _valNative->scSetProperty(name, val);
+ }
+
+ if (DID_FAIL(ret)) {
+ ScValue *newVal = NULL;
+
+ _valIter = _valObject.find(name);
+ if (_valIter != _valObject.end()) {
+ newVal = _valIter->_value;
+ }
+ if (!newVal) {
+ newVal = new ScValue(_gameRef);
+ } else {
+ newVal->cleanup();
+ }
+
+ newVal->copy(val, copyWhole);
+ newVal->_isConstVar = setAsConst;
+ _valObject[name] = newVal;
+
+ if (_type != VAL_NATIVE) {
+ _type = VAL_OBJECT;
+ }
+
+ /*
+ _valIter = _valObject.find(Name);
+ if (_valIter != _valObject.end()){
+ delete _valIter->_value;
+ _valIter->_value = NULL;
+ }
+ ScValue* val = new ScValue(_gameRef);
+ val->Copy(Val, CopyWhole);
+ val->_isConstVar = SetAsConst;
+ _valObject[Name] = val;
+
+ if (_type!=VAL_NATIVE) _type = VAL_OBJECT;
+ */
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::propExists(const char *name) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->propExists(name);
+ }
+ _valIter = _valObject.find(name);
+
+ return (_valIter != _valObject.end());
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::deleteProps() {
+ _valIter = _valObject.begin();
+ while (_valIter != _valObject.end()) {
+ delete(ScValue *)_valIter->_value;
+ _valIter++;
+ }
+ _valObject.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::CleanProps(bool includingNatives) {
+ _valIter = _valObject.begin();
+ while (_valIter != _valObject.end()) {
+ if (!_valIter->_value->_isConstVar && (!_valIter->_value->isNative() || includingNatives)) {
+ _valIter->_value->setNULL();
+ }
+ _valIter++;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isNULL() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isNULL();
+ }
+
+ return (_type == VAL_NULL);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isNative() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isNative();
+ }
+
+ return (_type == VAL_NATIVE);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isString() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isString();
+ }
+
+ return (_type == VAL_STRING);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isFloat() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isFloat();
+ }
+
+ return (_type == VAL_FLOAT);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isInt() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isInt();
+ }
+
+ return (_type == VAL_INT);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isBool() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isBool();
+ }
+
+ return (_type == VAL_BOOL);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::isObject() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->isObject();
+ }
+
+ return (_type == VAL_OBJECT);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+TValType ScValue::getTypeTolerant() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getType();
+ }
+
+ return _type;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setBool(bool val) {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setBool(val);
+ return;
+ }
+
+ if (_type == VAL_NATIVE) {
+ _valNative->scSetBool(val);
+ return;
+ }
+
+ _valBool = val;
+ _type = VAL_BOOL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setInt(int val) {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setInt(val);
+ return;
+ }
+
+ if (_type == VAL_NATIVE) {
+ _valNative->scSetInt(val);
+ return;
+ }
+
+ _valInt = val;
+ _type = VAL_INT;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setFloat(double val) {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setFloat(val);
+ return;
+ }
+
+ if (_type == VAL_NATIVE) {
+ _valNative->scSetFloat(val);
+ return;
+ }
+
+ _valFloat = val;
+ _type = VAL_FLOAT;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setString(const char *val) {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setString(val);
+ return;
+ }
+
+ if (_type == VAL_NATIVE) {
+ _valNative->scSetString(val);
+ return;
+ }
+
+ setStringVal(val);
+ if (_valString) {
+ _type = VAL_STRING;
+ } else {
+ _type = VAL_NULL;
+ }
+}
+
+void ScValue::setString(const Common::String &val) {
+ setString(val.c_str());
+}
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setStringVal(const char *val) {
+ if (_valString) {
+ delete[] _valString;
+ _valString = NULL;
+ }
+
+ if (val == NULL) {
+ _valString = NULL;
+ return;
+ }
+
+ _valString = new char [strlen(val) + 1];
+ if (_valString) {
+ strcpy(_valString, val);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setNULL() {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setNULL();
+ return;
+ }
+
+ if (_valNative && !_persistent) {
+ _valNative->_refCount--;
+ if (_valNative->_refCount <= 0) {
+ delete _valNative;
+ }
+ }
+ _valNative = NULL;
+ deleteProps();
+
+ _type = VAL_NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setNative(BaseScriptable *val, bool persistent) {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setNative(val, persistent);
+ return;
+ }
+
+ if (val == NULL) {
+ setNULL();
+ } else {
+ if (_valNative && !_persistent) {
+ _valNative->_refCount--;
+ if (_valNative->_refCount <= 0) {
+ if (_valNative != val) {
+ delete _valNative;
+ }
+ _valNative = NULL;
+ }
+ }
+
+ _type = VAL_NATIVE;
+ _persistent = persistent;
+
+ _valNative = val;
+ if (_valNative && !_persistent) {
+ _valNative->_refCount++;
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setObject() {
+ if (_type == VAL_VARIABLE_REF) {
+ _valRef->setObject();
+ return;
+ }
+
+ deleteProps();
+ _type = VAL_OBJECT;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setReference(ScValue *val) {
+ _valRef = val;
+ _type = VAL_VARIABLE_REF;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::getBool(bool defaultVal) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getBool();
+ }
+
+ switch (_type) {
+ case VAL_BOOL:
+ return _valBool;
+
+ case VAL_NATIVE:
+ return _valNative->scToBool();
+
+ case VAL_INT:
+ return (_valInt != 0);
+
+ case VAL_FLOAT:
+ return (_valFloat != 0.0f);
+
+ case VAL_STRING:
+ return (scumm_stricmp(_valString, "1") == 0 || scumm_stricmp(_valString, "yes") == 0 || scumm_stricmp(_valString, "true") == 0);
+
+ default:
+ return defaultVal;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int ScValue::getInt(int defaultVal) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getInt();
+ }
+
+ switch (_type) {
+ case VAL_BOOL:
+ return _valBool ? 1 : 0;
+
+ case VAL_NATIVE:
+ return _valNative->scToInt();
+
+ case VAL_INT:
+ return _valInt;
+
+ case VAL_FLOAT:
+ return (int)_valFloat;
+
+ case VAL_STRING:
+ return atoi(_valString);
+
+ default:
+ return defaultVal;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+double ScValue::getFloat(double defaultVal) {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getFloat();
+ }
+
+ switch (_type) {
+ case VAL_BOOL:
+ return _valBool ? 1.0f : 0.0f;
+
+ case VAL_NATIVE:
+ return _valNative->scToFloat();
+
+ case VAL_INT:
+ return (double)_valInt;
+
+ case VAL_FLOAT:
+ return _valFloat;
+
+ case VAL_STRING:
+ return atof(_valString);
+
+ default:
+ return defaultVal;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void *ScValue::getMemBuffer() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getMemBuffer();
+ }
+
+ if (_type == VAL_NATIVE) {
+ return _valNative->scToMemBuffer();
+ } else {
+ return (void *)NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *ScValue::getString() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getString();
+ }
+
+ switch (_type) {
+ case VAL_OBJECT:
+ setStringVal("[object]");
+ break;
+
+ case VAL_NULL:
+ setStringVal("[null]");
+ break;
+
+ case VAL_NATIVE: {
+ const char *strVal = _valNative->scToString();
+ setStringVal(strVal);
+ return strVal;
+ break;
+ }
+
+ case VAL_BOOL:
+ setStringVal(_valBool ? "yes" : "no");
+ break;
+
+ case VAL_INT: {
+ char dummy[50];
+ sprintf(dummy, "%d", _valInt);
+ setStringVal(dummy);
+ break;
+ }
+
+ case VAL_FLOAT: {
+ char dummy[50];
+ sprintf(dummy, "%f", _valFloat);
+ setStringVal(dummy);
+ break;
+ }
+
+ case VAL_STRING:
+ break;
+
+ default:
+ setStringVal("");
+ }
+
+ return _valString;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseScriptable *ScValue::getNative() {
+ if (_type == VAL_VARIABLE_REF) {
+ return _valRef->getNative();
+ }
+
+ if (_type == VAL_NATIVE) {
+ return _valNative;
+ } else {
+ return NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+TValType ScValue::getType() {
+ return _type;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::copy(ScValue *orig, bool copyWhole) {
+ _gameRef = orig->_gameRef;
+
+ if (_valNative && !_persistent) {
+ _valNative->_refCount--;
+ if (_valNative->_refCount <= 0) {
+ if (_valNative != orig->_valNative) {
+ delete _valNative;
+ }
+ _valNative = NULL;
+ }
+ }
+
+ if (orig->_type == VAL_VARIABLE_REF && orig->_valRef && copyWhole) {
+ orig = orig->_valRef;
+ }
+
+ cleanup(true);
+
+ _type = orig->_type;
+ _valBool = orig->_valBool;
+ _valInt = orig->_valInt;
+ _valFloat = orig->_valFloat;
+ setStringVal(orig->_valString);
+
+ _valRef = orig->_valRef;
+ _persistent = orig->_persistent;
+
+ _valNative = orig->_valNative;
+ if (_valNative && !_persistent) {
+ _valNative->_refCount++;
+ }
+//!!!! ref->native++
+
+ // copy properties
+ if (orig->_type == VAL_OBJECT && orig->_valObject.size() > 0) {
+ orig->_valIter = orig->_valObject.begin();
+ while (orig->_valIter != orig->_valObject.end()) {
+ _valObject[orig->_valIter->_key] = new ScValue(_gameRef);
+ _valObject[orig->_valIter->_key]->copy(orig->_valIter->_value);
+ orig->_valIter++;
+ }
+ } else {
+ _valObject.clear();
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void ScValue::setValue(ScValue *val) {
+ if (val->_type == VAL_VARIABLE_REF) {
+ setValue(val->_valRef);
+ return;
+ }
+
+ // if being assigned a simple type, preserve native state
+ if (_type == VAL_NATIVE && (val->_type == VAL_INT || val->_type == VAL_STRING || val->_type == VAL_BOOL)) {
+ switch (val->_type) {
+ case VAL_INT:
+ _valNative->scSetInt(val->getInt());
+ break;
+ case VAL_FLOAT:
+ _valNative->scSetFloat(val->getFloat());
+ break;
+ case VAL_BOOL:
+ _valNative->scSetBool(val->getBool());
+ break;
+ case VAL_STRING:
+ _valNative->scSetString(val->getString());
+ break;
+ default:
+ warning("ScValue::setValue - unhandled enum");
+ break;
+ }
+ }
+ // otherwise just copy everything
+ else {
+ copy(val);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::persist(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_persistent));
+ persistMgr->transfer(TMEMBER(_isConstVar));
+ persistMgr->transfer(TMEMBER_INT(_type));
+ persistMgr->transfer(TMEMBER(_valBool));
+ persistMgr->transfer(TMEMBER(_valFloat));
+ persistMgr->transfer(TMEMBER(_valInt));
+ persistMgr->transfer(TMEMBER(_valNative));
+
+ int size;
+ const char *str;
+ if (persistMgr->getIsSaving()) {
+ size = _valObject.size();
+ persistMgr->transfer("", &size);
+ _valIter = _valObject.begin();
+ while (_valIter != _valObject.end()) {
+ str = _valIter->_key.c_str();
+ persistMgr->transfer("", &str);
+ persistMgr->transfer("", &_valIter->_value);
+
+ _valIter++;
+ }
+ } else {
+ ScValue *val;
+ persistMgr->transfer("", &size);
+ for (int i = 0; i < size; i++) {
+ persistMgr->transfer("", &str);
+ persistMgr->transfer("", &val);
+
+ _valObject[str] = val;
+ delete[] str;
+ }
+ }
+
+ persistMgr->transfer(TMEMBER(_valRef));
+ persistMgr->transfer(TMEMBER(_valString));
+
+ /*
+ FILE* f = fopen("c:\\val.log", "a+");
+ switch(_type)
+ {
+ case VAL_STRING:
+ fprintf(f, "str %s\n", _valString);
+ break;
+
+ case VAL_INT:
+ fprintf(f, "int %d\n", _valInt);
+ break;
+
+ case VAL_BOOL:
+ fprintf(f, "bool %d\n", _valBool);
+ break;
+
+ case VAL_NULL:
+ fprintf(f, "null\n");
+ break;
+
+ case VAL_NATIVE:
+ fprintf(f, "native\n");
+ break;
+
+ case VAL_VARIABLE_REF:
+ fprintf(f, "ref\n");
+ break;
+
+ case VAL_OBJECT:
+ fprintf(f, "obj\n");
+ break;
+
+ case VAL_FLOAT:
+ fprintf(f, "float\n");
+ break;
+
+ }
+ fclose(f);
+ */
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ _valIter = _valObject.begin();
+ while (_valIter != _valObject.end()) {
+ buffer->putTextIndent(indent, "PROPERTY {\n");
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _valIter->_key.c_str());
+ buffer->putTextIndent(indent + 2, "VALUE=\"%s\"\n", _valIter->_value->getString());
+ buffer->putTextIndent(indent, "}\n\n");
+
+ _valIter++;
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// -1 ... left is less, 0 ... equals, 1 ... left is greater
+int ScValue::compare(ScValue *val1, ScValue *val2) {
+ // both natives?
+ if (val1->isNative() && val2->isNative()) {
+ // same class?
+ if (strcmp(val1->getNative()->getClassName(), val2->getNative()->getClassName()) == 0) {
+ return val1->getNative()->scCompare(val2->getNative());
+ } else {
+ return strcmp(val1->getString(), val2->getString());
+ }
+ }
+
+ // both objects?
+ if (val1->isObject() && val2->isObject()) {
+ return -1;
+ }
+
+
+ // null states
+ if (val1->isNULL() && !val2->isNULL()) {
+ return -1;
+ } else if (!val1->isNULL() && val2->isNULL()) {
+ return 1;
+ } else if (val1->isNULL() && val2->isNULL()) {
+ return 0;
+ }
+
+ // one of them is string? convert both to string
+ if (val1->isString() || val2->isString()) {
+ return strcmp(val1->getString(), val2->getString());
+ }
+
+ // one of them is float?
+ if (val1->isFloat() || val2->isFloat()) {
+ if (val1->getFloat() < val2->getFloat()) {
+ return -1;
+ } else if (val1->getFloat() > val2->getFloat()) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ // otherwise compare as int's
+ if (val1->getInt() < val2->getInt()) {
+ return -1;
+ } else if (val1->getInt() > val2->getInt()) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int ScValue::compareStrict(ScValue *val1, ScValue *val2) {
+ if (val1->getTypeTolerant() != val2->getTypeTolerant()) {
+ return -1;
+ } else {
+ return ScValue::compare(val1, val2);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::setProperty(const char *propName, int value) {
+ ScValue *val = new ScValue(_gameRef, value);
+ bool ret = DID_SUCCEED(setProp(propName, val));
+ delete val;
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::setProperty(const char *propName, const char *value) {
+ ScValue *val = new ScValue(_gameRef, value);
+ bool ret = DID_SUCCEED(setProp(propName, val));
+ delete val;
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::setProperty(const char *propName, double value) {
+ ScValue *val = new ScValue(_gameRef, value);
+ bool ret = DID_SUCCEED(setProp(propName, val));
+ delete val;
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::setProperty(const char *propName, bool value) {
+ ScValue *val = new ScValue(_gameRef, value);
+ bool ret = DID_SUCCEED(setProp(propName, val));
+ delete val;
+ return ret;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool ScValue::setProperty(const char *propName) {
+ ScValue *val = new ScValue(_gameRef);
+ bool ret = DID_SUCCEED(setProp(propName, val));
+ delete val;
+ return ret;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h
new file mode 100644
index 0000000000..bf7d9cd8a1
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_value.h
@@ -0,0 +1,113 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SCVALUE_H
+#define WINTERMUTE_SCVALUE_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/base/scriptables/dcscript.h" // Added by ClassView
+#include "common/str.h"
+
+namespace Wintermute {
+
+class ScScript;
+class BaseScriptable;
+
+class ScValue : public BaseClass {
+public:
+ static int compare(ScValue *val1, ScValue *val2);
+ static int compareStrict(ScValue *val1, ScValue *val2);
+ TValType getTypeTolerant();
+ void cleanup(bool ignoreNatives = false);
+ DECLARE_PERSISTENT(ScValue, BaseClass)
+
+ bool _isConstVar;
+ bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+ void setValue(ScValue *val);
+ bool _persistent;
+ bool propExists(const char *name);
+ void copy(ScValue *orig, bool copyWhole = false);
+ void setStringVal(const char *val);
+ TValType getType();
+ bool getBool(bool defaultVal = false);
+ int getInt(int defaultVal = 0);
+ double getFloat(double defaultVal = 0.0f);
+ const char *getString();
+ void *getMemBuffer();
+ BaseScriptable *getNative();
+ bool deleteProp(const char *name);
+ void deleteProps();
+ void CleanProps(bool includingNatives);
+ void setBool(bool val);
+ void setInt(int val);
+ void setFloat(double val);
+ void setString(const char *val);
+ void setString(const Common::String &val);
+ void setNULL();
+ void setNative(BaseScriptable *val, bool persistent = false);
+ void setObject();
+ void setReference(ScValue *val);
+ bool isNULL();
+ bool isNative();
+ bool isString();
+ bool isBool();
+ bool isFloat();
+ bool isInt();
+ bool isObject();
+ bool setProp(const char *name, ScValue *val, bool copyWhole = false, bool setAsConst = false);
+ ScValue *getProp(const char *name);
+ BaseScriptable *_valNative;
+ ScValue *_valRef;
+private:
+ bool _valBool;
+ int _valInt;
+ double _valFloat;
+ char *_valString;
+public:
+ TValType _type;
+ ScValue(BaseGame *inGame);
+ ScValue(BaseGame *inGame, bool Val);
+ ScValue(BaseGame *inGame, int Val);
+ ScValue(BaseGame *inGame, double Val);
+ ScValue(BaseGame *inGame, const char *Val);
+ virtual ~ScValue();
+ Common::HashMap<Common::String, ScValue *> _valObject;
+ Common::HashMap<Common::String, ScValue *>::iterator _valIter;
+
+ bool setProperty(const char *propName, int value);
+ bool setProperty(const char *propName, const char *value);
+ bool setProperty(const char *propName, double value);
+ bool setProperty(const char *propName, bool value);
+ bool setProperty(const char *propName);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
new file mode 100644
index 0000000000..00d07cd3c2
--- /dev/null
+++ b/engines/wintermute/base/sound/base_sound.cpp
@@ -0,0 +1,292 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/sound/base_sound_buffer.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseSound, false)
+
+BaseSound::BaseSound(BaseGame *inGame) : BaseClass(inGame) {
+ _sound = NULL;
+ _soundFilename = "";
+
+ _soundType = Audio::Mixer::kSFXSoundType;
+ _soundStreamed = false;
+ _soundLooping = false;
+ _soundPlaying = false;
+ _soundPaused = false;
+ _soundFreezePaused = false;
+ _soundPosition = 0;
+ _soundPrivateVolume = 0;
+ _soundLoopStart = 0;
+
+ _sFXType = SFX_NONE;
+ _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
+}
+
+BaseSound::~BaseSound() {
+ if (_sound) {
+ _gameRef->_soundMgr->removeSound(_sound);
+ }
+ _sound = NULL;
+}
+
+bool BaseSound::setSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) {
+ if (_sound) {
+ _gameRef->_soundMgr->removeSound(_sound);
+ _sound = NULL;
+ }
+ _soundFilename = Common::String(); // Set empty
+
+ _sound = _gameRef->_soundMgr->addSound(filename, type, streamed);
+ if (_sound) {
+ _soundFilename = filename;
+
+ _soundType = type;
+ _soundStreamed = streamed;
+
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::setSoundSimple() {
+ _sound = _gameRef->_soundMgr->addSound(_soundFilename, _soundType, _soundStreamed);
+ if (_sound) {
+ if (_soundPosition) {
+ _sound->setPosition(_soundPosition);
+ }
+ _sound->setLooping(_soundLooping);
+ _sound->setPrivateVolume(_soundPrivateVolume);
+ _sound->setLoopStart(_soundLoopStart);
+ _sound->_freezePaused = _soundFreezePaused;
+ if (_soundPlaying) {
+ return _sound->resume();
+ } else {
+ return STATUS_OK;
+ }
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+uint32 BaseSound::getLength() {
+ if (_sound) {
+ return _sound->getLength();
+ } else {
+ return 0;
+ }
+}
+
+bool BaseSound::play(bool looping) {
+ if (_sound) {
+ _soundPaused = false;
+ return _sound->play(looping, _soundPosition);
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::stop() {
+ if (_sound) {
+ _soundPaused = false;
+ return _sound->stop();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::pause(bool freezePaused) {
+ if (_sound) {
+ _soundPaused = true;
+ if (freezePaused) {
+ _sound->_freezePaused = true;
+ }
+ return _sound->pause();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::resume() {
+ if (_sound && _soundPaused) {
+ _soundPaused = false;
+ return _sound->resume();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::persist(BasePersistenceManager *persistMgr) {
+ if (persistMgr->getIsSaving() && _sound) {
+ _soundPlaying = _sound->isPlaying();
+ _soundLooping = _sound->_looping;
+ _soundPrivateVolume = _sound->_privateVolume;
+ if (_soundPlaying) {
+ _soundPosition = _sound->getPosition();
+ }
+ _soundLoopStart = _sound->_loopStart;
+ _soundFreezePaused = _sound->_freezePaused;
+ }
+
+ if (persistMgr->getIsSaving()) {
+ _sFXType = SFX_NONE;
+ _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
+ }
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_soundFilename));
+ persistMgr->transfer(TMEMBER(_soundLooping));
+ persistMgr->transfer(TMEMBER(_soundPaused));
+ persistMgr->transfer(TMEMBER(_soundFreezePaused));
+ persistMgr->transfer(TMEMBER(_soundPlaying));
+ persistMgr->transfer(TMEMBER(_soundPosition));
+ persistMgr->transfer(TMEMBER(_soundPrivateVolume));
+ persistMgr->transfer(TMEMBER(_soundStreamed));
+ persistMgr->transfer(TMEMBER_INT(_soundType));
+ persistMgr->transfer(TMEMBER(_soundLoopStart));
+
+ return STATUS_OK;
+}
+
+bool BaseSound::isPlaying() {
+ return _sound && _sound->isPlaying();
+}
+
+bool BaseSound::isPaused() {
+ return _sound && _soundPaused;
+}
+
+bool BaseSound::setPositionTime(uint32 time) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ }
+ _soundPosition = time;
+ bool ret = _sound->setPosition(_soundPosition);
+ if (_sound->isPlaying()) {
+ _soundPosition = 0;
+ }
+ return ret;
+}
+
+uint32 BaseSound::getPositionTime() {
+ if (!_sound) {
+ return 0;
+ }
+
+ if (!_sound->isPlaying()) {
+ return 0;
+ } else {
+ return _sound->getPosition();
+ }
+}
+
+bool BaseSound::setVolumePercent(int percent) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ return _sound->setPrivateVolume(percent * 255 / 100);
+ }
+}
+
+bool BaseSound::setVolume(int volume) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ return _sound->setPrivateVolume(volume);
+ }
+}
+
+bool BaseSound::setPrivateVolume(int volume) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ _sound->_privateVolume = volume;
+ return STATUS_OK;
+ }
+}
+
+int BaseSound::getVolumePercent() {
+ if (!_sound) {
+ return 0;
+ } else {
+ return _sound->_privateVolume * 100 / 255;
+ }
+}
+
+int BaseSound::getVolume() {
+ if (!_sound) {
+ return 0;
+ } else {
+ return _sound->_privateVolume;
+ }
+}
+
+bool BaseSound::setLoopStart(uint32 pos) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ _sound->setLoopStart(pos);
+ return STATUS_OK;
+ }
+}
+
+bool BaseSound::setPan(float pan) {
+ if (_sound) {
+ return _sound->setPan(pan);
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
+ if (!_sound) {
+ return STATUS_OK;
+ }
+
+ if (type != _sFXType || param1 != _sFXParam1 || param2 != _sFXParam2 || param3 != _sFXParam3 || param4 != _sFXParam4) {
+ bool ret = _sound->applyFX(type, param1, param2, param3, param4);
+
+ _sFXType = type;
+ _sFXParam1 = param1;
+ _sFXParam2 = param2;
+ _sFXParam3 = param3;
+ _sFXParam4 = param4;
+
+ return ret;
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h
new file mode 100644
index 0000000000..637061b7cc
--- /dev/null
+++ b/engines/wintermute/base/sound/base_sound.h
@@ -0,0 +1,87 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SOUND_H
+#define WINTERMUTE_BASE_SOUND_H
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+#include "engines/wintermute/persistent.h"
+#include "audio/mixer.h"
+
+namespace Wintermute {
+
+class BaseSoundBuffer;
+class BaseSound : public BaseClass {
+public:
+ bool setPan(float pan);
+ int getVolume();
+ int getVolumePercent();
+ bool setVolumePercent(int percent);
+ bool setVolume(int volume);
+ bool setPrivateVolume(int volume);
+ bool setLoopStart(uint32 pos);
+ uint32 getPositionTime();
+ bool setPositionTime(uint32 time);
+ bool isPlaying();
+ bool isPaused();
+ DECLARE_PERSISTENT(BaseSound, BaseClass)
+ bool resume();
+ bool pause(bool freezePaused = false);
+ bool stop();
+ bool play(bool looping = false);
+ uint32 getLength();
+ const char *getFilename() { return _soundFilename.c_str(); }
+ bool setSoundSimple();
+ bool setSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
+ BaseSound(BaseGame *inGame);
+ virtual ~BaseSound();
+
+ bool applyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0);
+private:
+ Common::String _soundFilename;
+ bool _soundStreamed;
+ Audio::Mixer::SoundType _soundType;
+ int _soundPrivateVolume;
+ uint32 _soundLoopStart;
+ uint32 _soundPosition;
+ bool _soundPlaying;
+ bool _soundLooping;
+ bool _soundPaused;
+ bool _soundFreezePaused;
+ TSFXType _sFXType;
+ float _sFXParam1;
+ float _sFXParam2;
+ float _sFXParam3;
+ float _sFXParam4;
+ BaseSoundBuffer *_sound;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp
new file mode 100644
index 0000000000..250570f2b8
--- /dev/null
+++ b/engines/wintermute/base/sound/base_sound_buffer.cpp
@@ -0,0 +1,295 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/sound/base_sound_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/wintermute.h"
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
+#include "audio/decoders/vorbis.h"
+#include "audio/decoders/wave.h"
+#include "audio/decoders/raw.h"
+#include "common/system.h"
+#include "common/substream.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+#define MAX_NONSTREAMED_FILE_SIZE 1024*1024
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame) : BaseClass(inGame) {
+ _stream = NULL;
+ _handle = NULL;
+// _sync = NULL;
+
+ _streamed = false;
+ _filename = "";
+ _file = NULL;
+ _privateVolume = 255;
+ _volume = 255;
+
+ _looping = false;
+ _loopStart = 0;
+ _startPos = 0;
+
+ _type = Audio::Mixer::kSFXSoundType;
+
+ _freezePaused = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundBuffer::~BaseSoundBuffer() {
+ stop();
+
+ if (_handle) {
+ g_system->getMixer()->stopHandle(*_handle);
+ delete _handle;
+ _handle = NULL;
+ }
+ delete _stream;
+ _stream = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::setStreaming(bool streamed, uint32 numBlocks, uint32 blockSize) {
+ _streamed = streamed;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::loadFromFile(const Common::String &filename, bool forceReload) {
+ debugC(kWintermuteDebugAudio, "BSoundBuffer::LoadFromFile(%s,%d)", filename.c_str(), forceReload);
+
+ // Load a file, but avoid having the File-manager handle the disposal of it.
+ _file = BaseFileManager::getEngineInstance()->openFile(filename, true, false);
+ if (!_file) {
+ _gameRef->LOG(0, "Error opening sound file '%s'", filename.c_str());
+ return STATUS_FAILED;
+ }
+ Common::String strFilename(filename);
+ strFilename.toLowercase();
+ if (strFilename.hasSuffix(".ogg")) {
+ _stream = Audio::makeVorbisStream(_file, DisposeAfterUse::YES);
+ } else if (strFilename.hasSuffix(".wav")) {
+ int waveSize, waveRate;
+ byte waveFlags;
+ uint16 waveType;
+
+ if (Audio::loadWAVFromStream(*_file, waveSize, waveRate, waveFlags, &waveType)) {
+ if (waveType == 1) {
+ // We need to wrap the file in a substream to make sure the size is right.
+ _file = new Common::SeekableSubReadStream(_file, 0, waveSize);
+ _stream = Audio::makeRawStream(_file, waveRate, waveFlags, DisposeAfterUse::YES);
+ } else {
+ error("BSoundBuffer::LoadFromFile - WAVE not supported yet for %s with type %d", filename.c_str(), waveType);
+ }
+ }
+ } else {
+ error("BSoundBuffer::LoadFromFile - Unknown filetype for %s", filename.c_str());
+ }
+ if (!_stream) {
+ return STATUS_FAILED;
+ }
+ _filename = filename;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::play(bool looping, uint32 startSample) {
+ if (_handle) {
+ g_system->getMixer()->stopHandle(*_handle);
+ delete _handle;
+ _handle = NULL;
+ }
+ // Store the loop-value for save-games.
+ setLooping(looping);
+ if (_stream) {
+ _stream->seek(startSample);
+ _handle = new Audio::SoundHandle;
+ if (_looping) {
+ Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
+ g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, 0, DisposeAfterUse::YES);
+ } else {
+ g_system->getMixer()->playStream(_type, _handle, _stream, -1, _volume, 0, DisposeAfterUse::NO);
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::setLooping(bool looping) {
+ if (isPlaying()) {
+ // This warning is here, to see if this is ever the case.
+ warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); // TODO
+ }
+ _looping = looping;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::resume() {
+ // If the sound was paused while active:
+ if (_stream && _handle) {
+ g_system->getMixer()->pauseHandle(*_handle, false);
+ } else if (_stream) { // Otherwise we come from a savegame, and thus have no handle
+ play(_looping, _startPos);
+ } else {
+ warning("BaseSoundBuffer::resume - Called without a handle or a stream");
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::stop() {
+ if (_stream && _handle) {
+ g_system->getMixer()->stopHandle(*_handle);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::pause() {
+ if (_stream && _handle) {
+ g_system->getMixer()->pauseHandle(*_handle, true);
+ }
+ return STATUS_OK;
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseSoundBuffer::getLength() {
+ if (_stream) {
+ uint32 len = _stream->getLength().msecs();
+ return len * 1000;
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::setType(Audio::Mixer::SoundType type) {
+ _type = type;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::updateVolume() {
+ setVolume(_privateVolume);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setVolume(int volume) {
+ _volume = volume * _gameRef->_soundMgr->getMasterVolume() / 255;
+ if (_stream && _handle) {
+ byte vol = (byte)(_volume);
+ g_system->getMixer()->setChannelVolume(*_handle, vol);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setPrivateVolume(int volume) {
+ _privateVolume = volume;
+ return setVolume(_privateVolume);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::isPlaying() {
+ if (_stream && _handle) {
+ return _freezePaused || g_system->getMixer()->isSoundHandleActive(*_handle);
+ } else {
+ return false;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseSoundBuffer::getPosition() {
+ if (_stream && _handle) {
+ uint32 pos = g_system->getMixer()->getSoundElapsedTime(*_handle);
+ return pos;
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setPosition(uint32 pos) {
+ if (isPlaying()) {
+ warning("BaseSoundBuffer::SetPosition - not implemented for playing sounds yet.");
+ }
+ _startPos = pos;
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setLoopStart(uint32 pos) {
+ _loopStart = pos;
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setPan(float pan) {
+ if (_handle) {
+ g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127));
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
+ // This function was already stubbed out in WME Lite, and thus isn't reimplemented here either.
+ switch (type) {
+ case SFX_ECHO:
+ //warning("BaseSoundBuffer::ApplyFX(SFX_ECHO, %f, %f, %f, %f) - not implemented yet", param1, param2, param3, param4);
+ break;
+
+ case SFX_REVERB:
+ //warning("BaseSoundBuffer::ApplyFX(SFX_REVERB, %f, %f, %f, %f) - not implemented yet", param1, param2, param3, param4);
+ break;
+
+ default:
+ break;
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h
new file mode 100644
index 0000000000..9c39f4c34b
--- /dev/null
+++ b/engines/wintermute/base/sound/base_sound_buffer.h
@@ -0,0 +1,100 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SOUNDBUFFER_H
+#define WINTERMUTE_BASE_SOUNDBUFFER_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "audio/mixer.h"
+#include "common/stream.h"
+
+namespace Audio {
+class SeekableAudioStream;
+class SoundHandle;
+}
+
+namespace Wintermute {
+
+class BaseFile;
+class BaseSoundBuffer : public BaseClass {
+public:
+
+ BaseSoundBuffer(BaseGame *inGame);
+ virtual ~BaseSoundBuffer();
+
+ bool pause();
+ bool play(bool looping = false, uint32 startSample = 0);
+ bool resume();
+ bool stop();
+ bool isPlaying();
+
+ void setLooping(bool looping);
+
+ uint32 getPosition();
+ bool setPosition(uint32 pos);
+ uint32 getLength();
+
+ bool setLoopStart(uint32 pos);
+ uint32 getLoopStart() const {
+ return _loopStart;
+ }
+
+ bool setPan(float pan);
+ bool setPrivateVolume(int colume);
+ bool setVolume(int colume);
+ void updateVolume();
+
+ void setType(Audio::Mixer::SoundType Type);
+
+ bool loadFromFile(const Common::String &filename, bool forceReload = false);
+ void setStreaming(bool streamed, uint32 numBlocks = 0, uint32 blockSize = 0);
+ bool applyFX(TSFXType type, float param1, float param2, float param3, float param4);
+
+ //HSTREAM _stream;
+ //HSYNC _sync;
+ Audio::SeekableAudioStream *_stream;
+ Audio::SoundHandle *_handle;
+
+ bool _freezePaused;
+ uint32 _loopStart;
+ Audio::Mixer::SoundType _type;
+ bool _looping;
+
+ int _privateVolume;
+private:
+ uint32 _startPos;
+ Common::String _filename;
+ bool _streamed;
+ Common::SeekableReadStream *_file;
+ int _volume;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
new file mode 100644
index 0000000000..441793144d
--- /dev/null
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -0,0 +1,283 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/utils/path_util.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/sound/base_sound_buffer.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/config-manager.h"
+#include "audio/mixer.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+//IMPLEMENT_PERSISTENT(BaseSoundMgr, true);
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundMgr::BaseSoundMgr(BaseGame *inGame) : BaseClass(inGame) {
+ _soundAvailable = false;
+ _volumeMaster = 255;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundMgr::~BaseSoundMgr() {
+ saveSettings();
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::cleanup() {
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ delete _sounds[i];
+ }
+ _sounds.clear();
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundMgr::saveSettings() {
+ if (_soundAvailable) {
+ ConfMan.setInt("master_volume", _volumeMaster);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::initialize() {
+ _soundAvailable = false;
+
+ if (!g_system->getMixer()->isReady()) {
+ return STATUS_FAILED;
+ }
+ _volumeMaster = (ConfMan.hasKey("master_volume") ? ConfMan.getInt("master_volume") : 255);
+ _soundAvailable = true;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) {
+ if (!_soundAvailable) {
+ return NULL;
+ }
+
+ BaseSoundBuffer *sound;
+
+ Common::String useFilename = filename;
+ // try to switch WAV to OGG file (if available)
+ AnsiString ext = PathUtil::getExtension(filename);
+ if (StringUtil::compareNoCase(ext, "wav")) {
+ AnsiString path = PathUtil::getDirectoryName(filename);
+ AnsiString name = PathUtil::getFileNameWithoutExtension(filename);
+
+ AnsiString newFile = PathUtil::combine(path, name + "ogg");
+ if (BaseFileManager::getEngineInstance()->hasFile(newFile)) {
+ useFilename = newFile;
+ }
+ }
+
+ sound = new BaseSoundBuffer(_gameRef);
+ if (!sound) {
+ return NULL;
+ }
+
+ sound->setStreaming(streamed);
+ sound->setType(type);
+
+
+ bool res = sound->loadFromFile(useFilename);
+ if (DID_FAIL(res)) {
+ _gameRef->LOG(res, "Error loading sound '%s'", useFilename.c_str());
+ delete sound;
+ return NULL;
+ }
+
+ // Make sure the master-volume is applied to the sound.
+ sound->updateVolume();
+
+ // register sound
+ _sounds.push_back(sound);
+
+ return sound;
+
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type) {
+ if (!sound) {
+ return STATUS_FAILED;
+ }
+
+ // Make sure the master-volume is applied to the sound.
+ sound->updateVolume();
+
+ // register sound
+ _sounds.push_back(sound);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::removeSound(BaseSoundBuffer *sound) {
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ if (_sounds[i] == sound) {
+ delete _sounds[i];
+ _sounds.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) {
+ if (!_soundAvailable) {
+ return STATUS_OK;
+ }
+
+ switch (type) {
+ case Audio::Mixer::kSFXSoundType:
+ ConfMan.setInt("sfx_volume", volume);
+ break;
+ case Audio::Mixer::kSpeechSoundType:
+ ConfMan.setInt("speech_volume", volume);
+ break;
+ case Audio::Mixer::kMusicSoundType:
+ ConfMan.setInt("music_volume", volume);
+ break;
+ case Audio::Mixer::kPlainSoundType:
+ error("Plain sound type shouldn't be used in WME");
+ }
+ g_engine->syncSoundSettings();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) {
+ return setVolume(type, percent * 255 / 100);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+byte BaseSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) {
+ int volume = 0;
+
+ switch (type) {
+ case Audio::Mixer::kSFXSoundType:
+ case Audio::Mixer::kSpeechSoundType:
+ case Audio::Mixer::kMusicSoundType:
+ volume = g_system->getMixer()->getVolumeForSoundType(type);
+ break;
+ default:
+ error("Sound-type not set");
+ break;
+ }
+
+ return (byte)(volume * 100 / 255);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setMasterVolume(byte value) {
+ _volumeMaster = value;
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ _sounds[i]->updateVolume();
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setMasterVolumePercent(byte percent) {
+ setMasterVolume(percent * 255 / 100);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+byte BaseSoundMgr::getMasterVolumePercent() {
+ return getMasterVolume() * 100 / 255;
+}
+
+//////////////////////////////////////////////////////////////////////////
+byte BaseSoundMgr::getMasterVolume() {
+ return (byte)_volumeMaster;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::pauseAll(bool includingMusic) {
+
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ if (_sounds[i]->isPlaying() && (_sounds[i]->_type != Audio::Mixer::kMusicSoundType || includingMusic)) {
+ _sounds[i]->pause();
+ _sounds[i]->_freezePaused = true;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::resumeAll() {
+
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ if (_sounds[i]->_freezePaused) {
+ _sounds[i]->resume();
+ _sounds[i]->_freezePaused = false;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float BaseSoundMgr::posToPan(int x, int y) {
+ float relPos = (float)x / ((float)_gameRef->_renderer->_width);
+
+ float minPan = -0.7f;
+ float maxPan = 0.7f;
+
+ return minPan + relPos * (maxPan - minPan);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h
new file mode 100644
index 0000000000..36a729b5ae
--- /dev/null
+++ b/engines/wintermute/base/sound/base_sound_manager.h
@@ -0,0 +1,68 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SOUNDMGR_H
+#define WINTERMUTE_BASE_SOUNDMGR_H
+
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base.h"
+#include "audio/mixer.h"
+#include "common/array.h"
+
+namespace Wintermute {
+class BaseSoundBuffer;
+class BaseSoundMgr : public BaseClass {
+public:
+ float posToPan(int x, int y);
+ bool resumeAll();
+ bool pauseAll(bool includingMusic = true);
+ bool cleanup();
+ //DECLARE_PERSISTENT(BaseSoundMgr, BaseClass);
+ byte getMasterVolumePercent();
+ byte getMasterVolume();
+ bool setMasterVolume(byte percent);
+ bool setMasterVolumePercent(byte percent);
+ byte getVolumePercent(Audio::Mixer::SoundType type);
+ bool setVolumePercent(Audio::Mixer::SoundType type, byte percent);
+ bool setVolume(Audio::Mixer::SoundType type, int volume);
+ uint32 _volumeOriginal;
+ int _volumeMaster;
+ bool removeSound(BaseSoundBuffer *sound);
+ BaseSoundBuffer *addSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
+ bool addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType);
+ bool initialize();
+ bool _soundAvailable;
+ BaseSoundMgr(BaseGame *inGame);
+ virtual ~BaseSoundMgr();
+ Common::Array<BaseSoundBuffer *> _sounds;
+ void saveSettings();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h
new file mode 100644
index 0000000000..493ea07015
--- /dev/null
+++ b/engines/wintermute/coll_templ.h
@@ -0,0 +1,86 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_COLL_TEMPL_H
+#define WINTERMUTE_COLL_TEMPL_H
+
+#include "common/array.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+// Basically Common::Array with peristence-support.
+template<typename TYPE>
+class BaseArray : public Common::Array<TYPE> {
+public:
+// TODO: Might want to make sure that destructors are called when replacing/deleting/getting destructed
+ bool persist(BasePersistenceManager *persistMgr) {
+ int j;
+ if (persistMgr->getIsSaving()) {
+ j = Common::Array<TYPE>::size();
+ persistMgr->transfer("ArraySize", &j);
+ typename Common::Array<TYPE>::const_iterator it = Common::Array<TYPE>::begin();
+ for (; it != Common::Array<TYPE>::end(); ++it) {
+ TYPE obj = *it;
+ persistMgr->transfer("", &obj);
+ }
+ } else {
+ Common::Array<TYPE>::clear();
+ persistMgr->transfer("ArraySize", &j);
+ for (int i = 0; i < j; i++) {
+ TYPE obj;
+ persistMgr->transfer("", &obj);
+ add(obj);
+ }
+ }
+ return true;
+ }
+ int add(TYPE newElement) {
+ Common::Array<TYPE>::push_back(newElement);
+ return Common::Array<TYPE>::size() - 1;
+ }
+ void remove_at(uint32 idx) {
+ Common::Array<TYPE>::remove_at(idx);
+ }
+ void remove_at(uint32 idx, uint32 num) {
+ while (num) {
+ if (idx >= Common::Array<TYPE>::size()) {
+ break;
+ }
+ Common::Array<TYPE>::remove_at(idx);
+ }
+ }
+ template<typename T2>
+ void copy(const BaseArray<T2> &src) {
+ Common::Array<TYPE>::insert_at(0, src);
+ }
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/dcgf.h b/engines/wintermute/dcgf.h
new file mode 100644
index 0000000000..fc4174094b
--- /dev/null
+++ b/engines/wintermute/dcgf.h
@@ -0,0 +1,51 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_DCGF_H
+#define WINTERMUTE_DCGF_H
+
+
+//////////////////////////////////////////////////////////////////////////
+#define DCGF_VER_MAJOR 1
+#define DCGF_VER_MINOR 1
+#define DCGF_VER_BUILD 1
+#define DCGF_VER_SUFFIX "beta"
+#define DCGF_VER_BETA true
+
+#define DCGF_NAME "WME Lite"
+#define DCGF_MAGIC 0xDEC0ADDE
+
+// minimal saved game version we support
+#define SAVEGAME_VER_MAJOR 1
+#define SAVEGAME_VER_MINOR 1
+#define SAVEGAME_VER_BUILD 1
+//////////////////////////////////////////////////////////////////////////
+
+#define COMPRESSED_FILE_MAGIC 0x504D435A // ZCMP
+
+#endif
diff --git a/engines/wintermute/dctypes.h b/engines/wintermute/dctypes.h
new file mode 100644
index 0000000000..bd4966eb6b
--- /dev/null
+++ b/engines/wintermute/dctypes.h
@@ -0,0 +1,225 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_DCTYPES_H
+#define WINTERMUTE_DCTYPES_H
+
+
+#include "common/str.h"
+#include "common/list.h"
+#include "common/array.h"
+
+namespace Wintermute {
+
+//typedef std::string AnsiString;
+//typedef std::string Utf8String;
+//typedef std::wstring WideString;
+typedef Common::String AnsiString;
+typedef Common::String Utf8String;
+typedef Common::String WideString; // NB: Not actually true I presume.
+
+typedef Common::List<WideString> WideStringList;
+typedef Common::List<AnsiString> AnsiStringList;
+
+typedef Common::Array<WideString> WideStringArray;
+typedef Common::Array<AnsiString> AnsiStringArray;
+
+
+enum TGameState {
+ GAME_RUNNING,
+ GAME_FROZEN,
+ GAME_SEMI_FROZEN
+};
+
+
+enum TImageType {
+ IMG_PALETTED8,
+ IMG_TRUECOLOR
+};
+
+
+enum TTextAlign {
+ TAL_LEFT = 0,
+ TAL_RIGHT,
+ TAL_CENTER,
+ NUM_TEXT_ALIGN
+};
+
+
+enum TVerticalAlign {
+ VAL_TOP = 0,
+ VAL_CENTER,
+ VAL_BOTTOM,
+ NUM_VERTICAL_ALIGN
+};
+
+
+enum TDirection {
+ DI_UP = 0,
+ DI_UPRIGHT = 1,
+ DI_RIGHT = 2,
+ DI_DOWNRIGHT = 3,
+ DI_DOWN = 4,
+ DI_DOWNLEFT = 5,
+ DI_LEFT = 6,
+ DI_UPLEFT = 7,
+ NUM_DIRECTIONS = 8,
+ DI_NONE = 9
+};
+
+enum TEventType {
+ EVENT_NONE = 0,
+ EVENT_INIT = 1,
+ EVENT_SHUTDOWN = 2,
+ EVENT_LEFT_CLICK = 3,
+ EVENT_RIGHT_CLICK = 4,
+ EVENT_MIDDLE_CLICK = 5,
+ EVENT_LEFT_DBLCLICK = 6,
+ EVENT_PRESS = 7,
+ EVENT_IDLE = 8,
+ EVENT_MOUSE_OVER = 9,
+ EVENT_LEFT_RELEASE = 10,
+ EVENT_RIGHT_RELEASE = 11,
+ EVENT_MIDDLE_RELEASE = 12,
+ NUM_EVENTS
+};
+
+enum TUIObjectType {
+ UI_UNKNOWN,
+ UI_BUTTON,
+ UI_WINDOW,
+ UI_STATIC,
+ UI_EDIT,
+ UI_HTML,
+ UI_CUSTOM
+};
+
+
+enum TRendererState {
+ RSTATE_3D,
+ RSTATE_2D,
+ RSTATE_LINES,
+ RSTATE_NONE
+};
+
+
+enum TDynamicConstructor {
+ DYNAMIC_CONSTRUCTOR
+};
+
+
+enum TVideoMode {
+ VIDEO_WINDOW,
+ VIDEO_FULLSCREEN,
+ VIDEO_ANY
+};
+
+
+enum TVideoPlayback {
+ VID_PLAY_POS = 0,
+ VID_PLAY_STRETCH = 1,
+ VID_PLAY_CENTER = 2
+};
+
+
+enum TMouseEvent {
+ MOUSE_CLICK,
+ MOUSE_RELEASE,
+ MOUSE_DBLCLICK
+};
+
+
+enum TMouseButton {
+ MOUSE_BUTTON_LEFT,
+ MOUSE_BUTTON_RIGHT,
+ MOUSE_BUTTON_MIDDLE
+};
+
+
+enum TTransMgrState {
+ TRANS_MGR_RUNNING,
+ TRANS_MGR_READY
+};
+
+
+enum TTransitionType {
+ TRANSITION_NONE = 0,
+ TRANSITION_FADE_OUT = 1,
+ TRANSITION_FADE_IN = 2,
+ NUM_TRANSITION_TYPES
+};
+
+
+enum TWindowMode {
+ WINDOW_NORMAL,
+ WINDOW_EXCLUSIVE,
+ WINDOW_SYSTEM_EXCLUSIVE
+};
+
+enum TSFXType {
+ SFX_NONE,
+ SFX_ECHO,
+ SFX_REVERB
+};
+
+
+enum TSpriteCacheType {
+ CACHE_ALL,
+ CACHE_HALF
+};
+
+enum TTextEncoding {
+ TEXT_ANSI = 0,
+ TEXT_UTF8 = 1,
+ NUM_TEXT_ENCODINGS
+};
+
+enum TSpriteBlendMode {
+ BLEND_UNKNOWN = -1,
+ BLEND_NORMAL = 0,
+ BLEND_ADDITIVE = 1,
+ BLEND_SUBTRACTIVE = 2,
+ NUM_BLEND_MODES
+};
+
+enum TTTSType {
+ TTS_CAPTION = 0,
+ TTS_TALK,
+ TTS_KEYPRESS
+};
+
+enum TShadowType {
+ SHADOW_NONE = 0,
+ SHADOW_SIMPLE = 1,
+ SHADOW_FLAT = 2,
+ SHADOW_STENCIL = 3
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
new file mode 100644
index 0000000000..04f7f3b112
--- /dev/null
+++ b/engines/wintermute/detection.cpp
@@ -0,0 +1,174 @@
+/* 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 "engines/advancedDetector.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/util.h"
+
+#include "engines/metaengine.h"
+
+#include "engines/wintermute/detection_tables.h"
+
+namespace Wintermute {
+
+/**
+ * The fallback game descriptor used by the Wintermute engine's fallbackDetector.
+ * Contents of this struct are overwritten by the fallbackDetector. (logic copied partially
+ * from the SCI-engine).
+ */
+static ADGameDescription s_fallbackDesc = {
+ "",
+ "",
+ AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
+ Common::UNK_LANG,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+};
+static char s_fallbackGameIdBuf[256];
+
+static const char *directoryGlobs[] = {
+ "language", // To detect the various languages
+ 0
+};
+
+class WintermuteMetaEngine : public AdvancedMetaEngine {
+public:
+ WintermuteMetaEngine() : AdvancedMetaEngine(Wintermute::gameDescriptions, sizeof(ADGameDescription), Wintermute::wintermuteGames) {
+ _singleid = "wintermute";
+ _maxScanDepth = 2;
+ _directoryGlobs = directoryGlobs;
+ }
+ virtual const char *getName() const {
+ return "Wintermute";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Copyright (c) 2011 Jan Nedoma";
+ }
+
+ virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
+ // Set some defaults
+ s_fallbackDesc.extra = "";
+ s_fallbackDesc.language = Common::UNK_LANG;
+ s_fallbackDesc.flags = ADGF_UNSTABLE;
+ s_fallbackDesc.platform = Common::kPlatformWindows; // default to Windows
+ s_fallbackDesc.gameid = "wintermute";
+ s_fallbackDesc.guioptions = GUIO0();
+
+ if (allFiles.contains("data.dcp")) {
+ Common::String name, caption;
+ if (WintermuteEngine::getGameInfo(fslist, name, caption)) {
+ for (uint32 i = 0; i < name.size(); i++) {
+ // Replace spaces (and other non-alphanumerics) with underscores
+ if (!Common::isAlnum(name[(int32)i])) {
+ name.setChar('_', (uint32)i);
+ }
+ }
+ // Prefix to avoid collisions with actually known games
+ name = "wmefan-" + name;
+ Common::strlcpy(s_fallbackGameIdBuf, name.c_str(), sizeof(s_fallbackGameIdBuf) - 1);
+ s_fallbackDesc.gameid = s_fallbackGameIdBuf;
+ if (caption != name) {
+ caption += " (fangame) ";
+ char *offset = s_fallbackGameIdBuf + name.size() + 1;
+ uint32 remainingLength = (sizeof(s_fallbackGameIdBuf) - 1) - (name.size() + 1);
+ Common::strlcpy(offset, caption.c_str(), remainingLength);
+ s_fallbackDesc.extra = offset;
+ s_fallbackDesc.flags |= ADGF_USEEXTRAASTITLE;
+ }
+ return &s_fallbackDesc;
+ } // Fall through to return 0;
+ }
+ return 0;
+ }
+
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ assert(syst);
+ assert(engine);
+
+ *engine = new Wintermute::WintermuteEngine(syst, desc);
+ return true;
+ }
+
+ bool hasFeature(MetaEngineFeature f) const {
+ switch (f) {
+ case MetaEngine::kSupportsListSaves:
+ return true;
+ case MetaEngine::kSupportsLoadingDuringStartup:
+ return true;
+ case MetaEngine::kSupportsDeleteSave:
+ return true;
+ case MetaEngine::kSavesSupportCreationDate:
+ return true;
+ case MetaEngine::kSavesSupportMetaInfo:
+ return true;
+ case MetaEngine::kSavesSupportThumbnail:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ SaveStateList listSaves(const char *target) const {
+ SaveStateList saves;
+ Wintermute::BasePersistenceManager pm(target, true);
+ for (int i = 0; i < getMaximumSaveSlot(); i++) {
+ if (pm.getSaveExists(i)) {
+ SaveStateDescriptor desc;
+ pm.getSaveStateDesc(i, desc);
+ saves.push_back(desc);
+ }
+ }
+ return saves;
+ }
+
+ int getMaximumSaveSlot() const {
+ return 100;
+ }
+
+ void removeSaveState(const char *target, int slot) const {
+ Wintermute::BasePersistenceManager pm(target, true);
+ pm.deleteSaveSlot(slot);
+ }
+
+ virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
+ Wintermute::BasePersistenceManager pm(target, true);
+ SaveStateDescriptor retVal;
+ retVal.setDescription("Invalid savegame");
+ pm.getSaveStateDesc(slot, retVal);
+ return retVal;
+ }
+};
+
+} // end of namespace Wintermute
+
+#if PLUGIN_ENABLED_DYNAMIC(WINTERMUTE)
+REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine);
+#endif
diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h
new file mode 100644
index 0000000000..4f8a962591
--- /dev/null
+++ b/engines/wintermute/detection_tables.h
@@ -0,0 +1,265 @@
+/* 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.
+ *
+ */
+
+namespace Wintermute {
+
+static const PlainGameDescriptor wintermuteGames[] = {
+ {"5ld", "Five Lethal Demons"},
+ {"5ma", "Five Magical Amulets"},
+ {"actualdest", "Actual Destination"},
+ {"chivalry", "Chivalry is Not Dead"},
+ {"deadcity", "Dead City"},
+ {"dirtysplit", "Dirty Split"},
+ {"eastside", "East Side Story"},
+ {"ghostsheet", "Ghost in the Sheet"},
+ {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"},
+ {"julia", "J.U.L.I.A."},
+ {"mirage", "Mirage"},
+ {"pigeons", "Pigeons in the Park"},
+ {"reversion", "Reversion"},
+ {"rosemary", "Rosemary"},
+ {"thebox", "The Box"},
+ {"twc", "the white chamber"},
+ {"wintermute", "Wintermute engine game"},
+ {0, 0}
+};
+
+static const ADGameDescription gameDescriptions[] = {
+ // Five Lethal Demons
+ {
+ "5ld",
+ "",
+ AD_ENTRY1s("data.dcp", "1037a77cbd001e0644898addc022322c", 15407750),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Five Magical Amulets
+ {
+ "5ma",
+ "",
+ AD_ENTRY1s("data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Actual Destination
+ {
+ "actualdest",
+ "",
+ AD_ENTRY1s("data.dcp", "6926f44b26f21ceb1d840eaab9aeb510", 9081740),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Chivalry is Not Dead
+ {
+ "chivalry",
+ "",
+ AD_ENTRY1s("data.dcp", "ebd0915d9a12df5224be22f53bb23eb6", 7278306),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Dead City (English)
+ {
+ "deadcity",
+ "",
+ {
+ {"english.dcp", 0, "c591046d6de7e381d76f70e0787b2b1f", 415935},
+ {"data.dcp", 0, "7ebfd50d1a22370ed7b079bcaa631d62", 9070205},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Dead City (Italian)
+ {
+ "deadcity",
+ "",
+ {
+ {"italian.dcp", 0, "92d8efb94436bec7bd1b7fe0b548192e", 454037},
+ {"data.dcp", 0, "7ebfd50d1a22370ed7b079bcaa631d62", 9070205},
+ AD_LISTEND
+ },
+ Common::IT_ITA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Dead City (Russian)
+ {
+ "deadcity",
+ "",
+ {
+ {"russian.dcp", 0, "a0ae71e9e1185596fffb07ad2c951eb9", 653317},
+ {"data.dcp", 0, "7ebfd50d1a22370ed7b079bcaa631d62", 9070205},
+ AD_LISTEND
+ },
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Dirty Split (English)
+ {
+ "dirtysplit",
+ "",
+ AD_ENTRY1s("data.dcp", "8f3dae199361ece0f59fb20cfff6eed3", 88577621),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Dirty Split (German)
+ {
+ "dirtysplit",
+ "",
+ AD_ENTRY1s("data.dcp", "139d8a25579e969f8b37d20e6e3de5f9", 92668291),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // East Side Story (Demo)
+ {
+ "eastside",
+ "Demo",
+ AD_ENTRY1s("data.dcp", "b3f8b09bb4b05ee3e9d14697525257f9", 59296246),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE |
+ ADGF_DEMO,
+ GUIO0()
+ },
+ // Ghosts in the Sheet
+ {
+ "ghostsheet",
+ "Demo",
+ AD_ENTRY1s("data.dcp", "dc1f6595f412ac25a52eaf47dad4ab81", 169083),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE |
+ ADGF_DEMO,
+ GUIO0()
+ },
+ // Hamlet or the last game without MMORPS features, shaders and product placement
+ {
+ "hamlet",
+ "",
+ AD_ENTRY1s("data.dcp", "f624add957a77c9930529fb28cc2450f", 88183022),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // J.U.L.I.A. (English)
+ {
+ "julia",
+ "",
+ AD_ENTRY1s("data.dcp", "c2264b4f8fcd132d2913ff5b6076a24f", 10109741),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // J.U.L.I.A. (English) (Demo)
+ {
+ "julia",
+ "Demo",
+ AD_ENTRY1s("data.dcp", "f0bbc3394555a9811f6050dae428cab6", 7655237),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE |
+ ADGF_DEMO,
+ GUIO0()
+ },
+ // Mirage
+ {
+ "mirage",
+ "",
+ AD_ENTRY1s("data.dcp", "d230b0b99c0aa77b9ecd094d8ee5573b", 17844056),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Pigeons in the Park
+ {
+ "pigeons",
+ "",
+ AD_ENTRY1s("data.dcp", "9143a5b6ff8206aefe3c4c643add3ec7", 2611100),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion
+ {
+ "reversion",
+ "",
+ AD_ENTRY1s("data.dcp", "cd616f98ebfd047e0c540b50b4b70761", 254384531),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Rosemary
+ {
+ "rosemary",
+ "",
+ AD_ENTRY1s("data.dcp", "4f2631138bd4d27587d9043f8aeff3df", 29483643),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // The Box
+ {
+ "thebox",
+ "",
+ AD_ENTRY1s("data.dcp", "ec5f0c7e8174e307701447b53afe7e2f", 108372483),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // the white chamber (multi-language)
+ {
+ "twc",
+ "",
+ AD_ENTRY1s("data.dcp", "0011d01142547c61e51ba24dc42b579e", 186451273),
+ Common::UNK_LANG,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Wintermute
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
new file mode 100644
index 0000000000..9319899495
--- /dev/null
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -0,0 +1,440 @@
+/* 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/algorithm.h"
+#include "common/endian.h"
+#include "common/util.h"
+#include "common/rect.h"
+#include "common/textconsole.h"
+#include "graphics/primitives.h"
+#include "engines/wintermute/graphics/transparent_surface.h"
+
+namespace Wintermute {
+
+byte *TransparentSurface::_lookup = NULL;
+
+void TransparentSurface::destroyLookup() {
+ delete _lookup;
+ _lookup = NULL;
+}
+
+TransparentSurface::TransparentSurface() : Surface(), _enableAlphaBlit(true) {}
+
+TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Surface(), _enableAlphaBlit(true) {
+ if (copyData) {
+ copyFrom(surf);
+ } else {
+ w = surf.w;
+ h = surf.h;
+ pitch = surf.pitch;
+ format = surf.format;
+ pixels = surf.pixels;
+ }
+}
+
+void doBlitOpaque(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
+ byte *in, *out;
+
+#ifdef SCUMM_LITTLE_ENDIAN
+ const int aIndex = 3;
+#else
+ const int aIndex = 0;
+#endif
+
+ for (uint32 i = 0; i < height; i++) {
+ out = outo;
+ in = ino;
+ memcpy(out, in, width * 4);
+ for (uint32 j = 0; j < width; j++) {
+ out[aIndex] = 0xFF;
+ out += 4;
+ }
+ outo += pitch;
+ ino += inoStep;
+ }
+}
+
+void TransparentSurface::generateLookup() {
+ _lookup = new byte[256 * 256];
+ for (int i = 0; i < 256; i++) {
+ for (int j = 0; j < 256; j++) {
+ _lookup[(i << 8) + j] = (i * j) >> 8;
+ }
+ }
+}
+
+void TransparentSurface::doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
+ byte *in, *out;
+
+ if (!_lookup) {
+ generateLookup();
+ }
+
+#ifdef SCUMM_LITTLE_ENDIAN
+ const int aIndex = 3;
+ const int bIndex = 0;
+ const int gIndex = 1;
+ const int rIndex = 2;
+#else
+ const int aIndex = 0;
+ const int bIndex = 3;
+ const int gIndex = 2;
+ const int rIndex = 1;
+#endif
+
+ const int bShift = 0;//img->format.bShift;
+ const int gShift = 8;//img->format.gShift;
+ const int rShift = 16;//img->format.rShift;
+ const int aShift = 24;//img->format.aShift;
+
+ const int bShiftTarget = 0;//target.format.bShift;
+ const int gShiftTarget = 8;//target.format.gShift;
+ const int rShiftTarget = 16;//target.format.rShift;
+
+ for (uint32 i = 0; i < height; i++) {
+ out = outo;
+ in = ino;
+ for (uint32 j = 0; j < width; j++) {
+ uint32 pix = *(uint32 *)in;
+ uint32 oPix = *(uint32 *) out;
+ int b = (pix >> bShift) & 0xff;
+ int g = (pix >> gShift) & 0xff;
+ int r = (pix >> rShift) & 0xff;
+ int a = (pix >> aShift) & 0xff;
+ int outb, outg, outr, outa;
+ in += inStep;
+
+ switch (a) {
+ case 0: // Full transparency
+ out += 4;
+ break;
+ case 255: // Full opacity
+ outb = b;
+ outg = g;
+ outr = r;
+ outa = a;
+
+ out[aIndex] = outa;
+ out[bIndex] = outb;
+ out[gIndex] = outg;
+ out[rIndex] = outr;
+ out += 4;
+ break;
+
+ default: // alpha blending
+ outa = 255;
+
+ outb = _lookup[(((oPix >> bShiftTarget) & 0xff)) + ((255 - a) << 8)];
+ outg = _lookup[(((oPix >> gShiftTarget) & 0xff)) + ((255 - a) << 8)];
+ outr = _lookup[(((oPix >> rShiftTarget) & 0xff)) + ((255 - a) << 8)];
+ outb += _lookup[b + (a << 8)];
+ outg += _lookup[g + (a << 8)];
+ outr += _lookup[r + (a << 8)];
+
+ out[aIndex] = outa;
+ out[bIndex] = outb;
+ out[gIndex] = outg;
+ out[rIndex] = outr;
+ out += 4;
+ }
+ }
+ outo += pitch;
+ ino += inoStep;
+ }
+}
+
+
+Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int posY, int flipping, Common::Rect *pPartRect, uint color, int width, int height) {
+ int ca = (color >> 24) & 0xff;
+
+ Common::Rect retSize;
+ retSize.top = 0;
+ retSize.left = 0;
+ retSize.setWidth(0);
+ retSize.setHeight(0);
+ // Check if we need to draw anything at all
+ if (ca == 0)
+ return retSize;
+
+ int cr = (color >> 16) & 0xff;
+ int cg = (color >> 8) & 0xff;
+ int cb = (color >> 0) & 0xff;
+
+ // Compensate for transparency. Since we're coming
+ // down to 255 alpha, we just compensate for the colors here
+ if (ca != 255) {
+ cr = cr * ca >> 8;
+ cg = cg * ca >> 8;
+ cb = cb * ca >> 8;
+ }
+
+ // Create an encapsulating surface for the data
+ TransparentSurface srcImage(*this, false);
+ // TODO: Is the data really in the screen format?
+ if (format.bytesPerPixel != 4) {
+ warning("TransparentSurface can only blit 32 bpp images");
+ return retSize;
+ }
+
+ if (pPartRect) {
+ srcImage.pixels = &((char *)pixels)[pPartRect->top * srcImage.pitch + pPartRect->left * 4];
+ srcImage.w = pPartRect->width();
+ srcImage.h = pPartRect->height();
+
+ debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping,
+ pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height);
+ } else {
+
+ debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0,
+ srcImage.w, srcImage.h, color, width, height);
+ }
+
+ if (width == -1)
+ width = srcImage.w;
+ if (height == -1)
+ height = srcImage.h;
+
+#ifdef SCALING_TESTING
+ // Hardcode scaling to 66% to test scaling
+ width = width * 2 / 3;
+ height = height * 2 / 3;
+#endif
+
+ Graphics::Surface *img;
+ Graphics::Surface *imgScaled = NULL;
+ byte *savedPixels = NULL;
+ if ((width != srcImage.w) || (height != srcImage.h)) {
+ // Scale the image
+ img = imgScaled = srcImage.scale(width, height);
+ savedPixels = (byte *)img->pixels;
+ } else {
+ img = &srcImage;
+ }
+
+ // Handle off-screen clipping
+ if (posY < 0) {
+ img->h = MAX(0, (int)img->h - -posY);
+ img->pixels = (byte *)img->pixels + img->pitch * -posY;
+ posY = 0;
+ }
+
+ if (posX < 0) {
+ img->w = MAX(0, (int)img->w - -posX);
+ img->pixels = (byte *)img->pixels + (-posX * 4);
+ posX = 0;
+ }
+
+ img->w = CLIP((int)img->w, 0, (int)MAX((int)target.w - posX, 0));
+ img->h = CLIP((int)img->h, 0, (int)MAX((int)target.h - posY, 0));
+
+ if ((img->w > 0) && (img->h > 0)) {
+ int xp = 0, yp = 0;
+
+ int inStep = 4;
+ int inoStep = img->pitch;
+ if (flipping & TransparentSurface::FLIP_V) {
+ inStep = -inStep;
+ xp = img->w - 1;
+ }
+
+ if (flipping & TransparentSurface::FLIP_H) {
+ inoStep = -inoStep;
+ yp = img->h - 1;
+ }
+
+ byte *ino = (byte *)img->getBasePtr(xp, yp);
+ byte *outo = (byte *)target.getBasePtr(posX, posY);
+ byte *in, *out;
+
+#ifdef SCUMM_LITTLE_ENDIAN
+ const int aIndex = 3;
+ const int bIndex = 0;
+ const int gIndex = 1;
+ const int rIndex = 2;
+#else
+ const int aIndex = 0;
+ const int bIndex = 3;
+ const int gIndex = 2;
+ const int rIndex = 1;
+#endif
+ const int bShift = 0;//img->format.bShift;
+ const int gShift = 8;//img->format.gShift;
+ const int rShift = 16;//img->format.rShift;
+ const int aShift = 24;//img->format.aShift;
+
+ const int bShiftTarget = 0;//target.format.bShift;
+ const int gShiftTarget = 8;//target.format.gShift;
+ const int rShiftTarget = 16;//target.format.rShift;
+
+ if (ca == 255 && cb == 255 && cg == 255 && cr == 255) {
+ if (_enableAlphaBlit) {
+ doBlitAlpha(ino, outo, img->w, img->h, target.pitch, inStep, inoStep);
+ } else {
+ doBlitOpaque(ino, outo, img->w, img->h, target.pitch, inStep, inoStep);
+ }
+ } else {
+ for (int i = 0; i < img->h; i++) {
+ out = outo;
+ in = ino;
+ for (int j = 0; j < img->w; j++) {
+ uint32 pix = *(uint32 *)in;
+ uint32 o_pix = *(uint32 *) out;
+ int b = (pix >> bShift) & 0xff;
+ int g = (pix >> gShift) & 0xff;
+ int r = (pix >> rShift) & 0xff;
+ int a = (pix >> aShift) & 0xff;
+ int outb, outg, outr, outa;
+ in += inStep;
+
+ if (ca != 255) {
+ a = a * ca >> 8;
+ }
+
+ switch (a) {
+ case 0: // Full transparency
+ out += 4;
+ break;
+ case 255: // Full opacity
+ if (cb != 255)
+ outb = (b * cb) >> 8;
+ else
+ outb = b;
+
+ if (cg != 255)
+ outg = (g * cg) >> 8;
+ else
+ outg = g;
+
+ if (cr != 255)
+ outr = (r * cr) >> 8;
+ else
+ outr = r;
+ outa = a;
+ out[aIndex] = outa;
+ out[bIndex] = outb;
+ out[gIndex] = outg;
+ out[rIndex] = outr;
+ out += 4;
+ break;
+
+ default: // alpha blending
+ outa = 255;
+ outb = (o_pix >> bShiftTarget) & 0xff;
+ outg = (o_pix >> gShiftTarget) & 0xff;
+ outr = (o_pix >> rShiftTarget) & 0xff;
+ if (cb == 0)
+ outb = 0;
+ else if (cb != 255)
+ outb += ((b - outb) * a * cb) >> 16;
+ else
+ outb += ((b - outb) * a) >> 8;
+ if (cg == 0)
+ outg = 0;
+ else if (cg != 255)
+ outg += ((g - outg) * a * cg) >> 16;
+ else
+ outg += ((g - outg) * a) >> 8;
+ if (cr == 0)
+ outr = 0;
+ else if (cr != 255)
+ outr += ((r - outr) * a * cr) >> 16;
+ else
+ outr += ((r - outr) * a) >> 8;
+ out[aIndex] = outa;
+ out[bIndex] = outb;
+ out[gIndex] = outg;
+ out[rIndex] = outr;
+ out += 4;
+ }
+ }
+ outo += target.pitch;
+ ino += inoStep;
+ }
+ }
+ }
+
+ if (imgScaled) {
+ imgScaled->pixels = savedPixels;
+ imgScaled->free();
+ delete imgScaled;
+ }
+
+ retSize.setWidth(img->w);
+ retSize.setHeight(img->h);
+ return retSize;
+}
+
+TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const {
+ Common::Rect srcRect(0, 0, (int16)w, (int16)h);
+ Common::Rect dstRect(0, 0, (int16)newWidth, (int16)newHeight);
+ return scale(srcRect, dstRect);
+}
+
+// Copied from clone2727's https://github.com/clone2727/scummvm/blob/pegasus/engines/pegasus/surface.cpp#L247
+TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
+ // I'm doing simple linear scaling here
+ // dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH);
+ TransparentSurface *target = new TransparentSurface();
+
+ int srcW = srcRect.width();
+ int srcH = srcRect.height();
+ int dstW = dstRect.width();
+ int dstH = dstRect.height();
+
+ target->create((uint16)dstW, (uint16)dstH, this->format);
+
+ for (int y = 0; y < dstH; y++) {
+ for (int x = 0; x < dstW; x++) {
+ uint32 color = READ_UINT32((const byte *)getBasePtr(x * srcW / dstW + srcRect.left,
+ y * srcH / dstH + srcRect.top));
+ WRITE_UINT32((byte *)target->getBasePtr(x + dstRect.left, y + dstRect.top), color);
+ }
+ }
+ return target;
+
+}
+
+/**
+ * Writes a color key to the alpha channel of the surface
+ * @param rKey the red component of the color key
+ * @param gKey the green component of the color key
+ * @param bKey the blue component of the color key
+ * @param overwriteAlpha if true, all other alpha will be set fully opaque
+ */
+void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool overwriteAlpha) {
+ assert(format.bytesPerPixel == 4);
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ uint32 pix = ((uint32 *)pixels)[i * w + j];
+ uint8 r, g, b, a;
+ format.colorToARGB(pix, a, r, g, b);
+ if (r == rKey && g == gKey && b == bKey) {
+ a = 0;
+ ((uint32 *)pixels)[i * w + j] = format.ARGBToColor(a, r, g, b);
+ } else if (overwriteAlpha) {
+ a = 255;
+ ((uint32 *)pixels)[i * w + j] = format.ARGBToColor(a, r, g, b);
+ }
+ }
+ }
+}
+
+} // End of namespace Graphics
diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h
new file mode 100644
index 0000000000..8b00dccbd9
--- /dev/null
+++ b/engines/wintermute/graphics/transparent_surface.h
@@ -0,0 +1,131 @@
+/* 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 GRAPHICS_TRANSPARENTSURFACE_H
+#define GRAPHICS_TRANSPARENTSURFACE_H
+
+#include "graphics/surface.h"
+
+/*
+ * This code is based on Broken Sword 2.5 engine
+ *
+ * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
+ *
+ * Licensed under GNU GPL v2
+ *
+ */
+
+// TODO: Find a better solution for this.
+#define BS_RGB(R,G,B) (0xFF000000 | ((R) << 16) | ((G) << 8) | (B))
+#define BS_ARGB(A,R,G,B) (((A) << 24) | ((R) << 16) | ((G) << 8) | (B))
+
+namespace Wintermute {
+
+/**
+ * A transparent graphics surface, which implements alpha blitting.
+ */
+struct TransparentSurface : public Graphics::Surface {
+ TransparentSurface();
+ TransparentSurface(const Graphics::Surface &surf, bool copyData = false);
+
+ void setColorKey(char r, char g, char b);
+ void disableColorKey();
+
+ // Enums
+ /**
+ @brief The possible flipping parameters for the blit methode.
+ */
+ enum FLIP_FLAGS {
+ /// The image will not be flipped.
+ FLIP_NONE = 0,
+ /// The image will be flipped at the horizontal axis.
+ FLIP_H = 1,
+ /// The image will be flipped at the vertical axis.
+ FLIP_V = 2,
+ /// The image will be flipped at the horizontal and vertical axis.
+ FLIP_HV = FLIP_H | FLIP_V,
+ /// The image will be flipped at the horizontal and vertical axis.
+ FLIP_VH = FLIP_H | FLIP_V
+ };
+
+ bool _enableAlphaBlit;
+
+ /**
+ @brief renders the surface to another surface
+ @param pDest a pointer to the target image. In most cases this is the framebuffer.
+ @param PosX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br>
+ The default value is 0.
+ @param PosY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br>
+ The default value is 0.
+ @param Flipping how the the image should be flipped.<br>
+ The default value is BS_Image::FLIP_NONE (no flipping)
+ @param pSrcPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br>
+ This referes to the unflipped and unscaled image.<br>
+ The default value is NULL.
+ @param Color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br>
+ The alpha component of the color determines the alpha blending parameter (0 = no covering, 255 = full covering).<br>
+ The color components determines the color for color modulation.<br>
+ The default value is BS_ARGB(255, 255, 255, 255) (full covering, no color modulation).
+ The macros BS_RGB and BS_ARGB can be used for the creation of the color value.
+ @param Width the output width of the screen section.
+ The images will be scaled if the output width of the screen section differs from the image section.<br>
+ The value -1 determines that the image should not be scaled.<br>
+ The default value is -1.
+ @param Width the output height of the screen section.
+ The images will be scaled if the output width of the screen section differs from the image section.<br>
+ The value -1 determines that the image should not be scaled.<br>
+ The default value is -1.
+ @return returns false if the rendering failed.
+ */
+
+ Common::Rect blit(Graphics::Surface &target, int posX = 0, int posY = 0,
+ int flipping = FLIP_NONE,
+ Common::Rect *pPartRect = NULL,
+ uint color = BS_ARGB(255, 255, 255, 255),
+ int width = -1, int height = -1);
+ void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false);
+ // The following scale-code supports arbitrary scaling (i.e. no repeats of column 0 at the end of lines)
+ TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
+ TransparentSurface *scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const;
+ static byte *_lookup;
+ static void destroyLookup();
+private:
+ static void doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep);
+ static void generateLookup();
+};
+
+/**
+ * A deleter for Surface objects which can be used with SharedPtr.
+ *
+ * This deleter assures Surface::free is called on deletion.
+ */
+/*struct SharedPtrTransparentSurfaceDeleter {
+ void operator()(TransparentSurface *ptr) {
+ ptr->free();
+ delete ptr;
+ }
+};*/
+
+
+} // End of namespace Graphics
+
+
+#endif
diff --git a/engines/wintermute/math/math_util.cpp b/engines/wintermute/math/math_util.cpp
new file mode 100644
index 0000000000..31af77538a
--- /dev/null
+++ b/engines/wintermute/math/math_util.cpp
@@ -0,0 +1,52 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/math/math_util.h"
+#include <math.h>
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+float MathUtil::round(float val) {
+ float result = floor(val);
+ if (val - result >= 0.5f) {
+ result += 1.0;
+ }
+ return result;
+}
+
+//////////////////////////////////////////////////////////////////////////
+float MathUtil::roundUp(float val) {
+ float result = floor(val);
+ if (val - result > 0) {
+ result += 1.0;
+ }
+ return result;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/math/math_util.h b/engines/wintermute/math/math_util.h
new file mode 100644
index 0000000000..38b6d9abf9
--- /dev/null
+++ b/engines/wintermute/math/math_util.h
@@ -0,0 +1,42 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_MATHUTIL_H
+#define WINTERMUTE_MATHUTIL_H
+
+namespace Wintermute {
+
+class MathUtil {
+public:
+ static float round(float val);
+ static float roundUp(float val);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/math/matrix4.cpp b/engines/wintermute/math/matrix4.cpp
new file mode 100644
index 0000000000..ca1eae8813
--- /dev/null
+++ b/engines/wintermute/math/matrix4.cpp
@@ -0,0 +1,86 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/math/matrix4.h"
+#include "engines/wintermute/math/vector2.h"
+#include <math.h>
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+Matrix4::Matrix4() {
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ m[i][j] = 0.0f;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+Matrix4::~Matrix4() {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void Matrix4::identity() {
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ m[i][j] = 0.0f;
+ }
+ }
+ m[0][0] = 1.0f;
+ m[1][1] = 1.0f;
+ m[2][2] = 1.0f;
+ m[3][3] = 1.0f;
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+void Matrix4::rotationZ(float angle) {
+ identity();
+
+ m[0][0] = cos(angle);
+ m[1][1] = cos(angle);
+ m[0][1] = sin(angle);
+ m[1][0] = -sin(angle);
+}
+
+//////////////////////////////////////////////////////////////////////////
+void Matrix4::transformVector2(Vector2 &vec) {
+ float norm;
+
+ norm = m[0][3] * vec.x + m[1][3] * vec.y + m[3][3];
+
+ float x = (m[0][0] * vec.x + m[1][0] * vec.y + m[3][0]) / norm;
+ float y = (m[0][1] * vec.x + m[1][1] * vec.y + m[3][1]) / norm;
+
+ vec.x = x;
+ vec.y = y;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/math/matrix4.h b/engines/wintermute/math/matrix4.h
new file mode 100644
index 0000000000..273633f723
--- /dev/null
+++ b/engines/wintermute/math/matrix4.h
@@ -0,0 +1,50 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_MATRIX4_H
+#define WINTERMUTE_MATRIX4_H
+
+namespace Wintermute {
+
+class Vector2;
+
+class Matrix4 {
+public:
+ Matrix4();
+ ~Matrix4();
+
+ void identity();
+ void rotationZ(float angle);
+ void transformVector2(Vector2 &vec);
+
+ float m[4][4];
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h
new file mode 100644
index 0000000000..190c1135cf
--- /dev/null
+++ b/engines/wintermute/math/rect32.h
@@ -0,0 +1,94 @@
+/* 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 WINTERMUTE_RECT32_H
+#define WINTERMUTE_RECT32_H
+
+#include "common/system.h"
+
+namespace Wintermute {
+
+struct Point32 {
+ int32 x;
+ int32 y;
+};
+
+struct Rect32 {
+ int32 top, left; ///< The point at the top left of the rectangle (part of the rect).
+ int32 bottom, right; ///< The point at the bottom right of the rectangle (not part of the rect).
+
+ Rect32() : top(0), left(0), bottom(0), right(0) {}
+ Rect32(int32 w, int32 h) : top(0), left(0), bottom(h), right(w) {}
+ Rect32(int32 x1, int32 y1, int32 x2, int32 y2) : top(y1), left(x1), bottom(y2), right(x2) {
+ assert(isValidRect());
+ }
+ bool operator==(const Rect32 &rhs) const {
+ return equals(rhs);
+ }
+ bool operator!=(const Rect32 &rhs) const {
+ return !equals(rhs);
+ }
+
+ int32 width() const {
+ return right - left;
+ }
+ int32 height() const {
+ return bottom - top;
+ }
+
+ void setWidth(int32 aWidth) {
+ right = left + aWidth;
+ }
+
+ void setHeight(int32 aHeight) {
+ bottom = top + aHeight;
+ }
+
+ void setEmpty() {
+ left = right = top = bottom = 0;
+ }
+
+ void offsetRect(int dx, int dy) {
+ left += dx;
+ top += dy;
+ right += dx;
+ bottom += dy;
+ }
+ /**
+ * Check if the given rect is equal to this one.
+ *
+ * @param r The rectangle to check
+ *
+ * @return true if the given rect is equal, false otherwise
+ */
+ bool equals(const Rect32 &r) const {
+ return (left == r.left) && (right == r.right) && (top == r.top) && (bottom == r.bottom);
+ }
+
+ bool isValidRect() const {
+ return (left <= right && top <= bottom);
+ }
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/math/vector2.cpp b/engines/wintermute/math/vector2.cpp
new file mode 100644
index 0000000000..74c5586d62
--- /dev/null
+++ b/engines/wintermute/math/vector2.cpp
@@ -0,0 +1,55 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/math/vector2.h"
+#include <math.h>
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+Vector2::Vector2() {
+ x = y = 0.0f;
+}
+
+//////////////////////////////////////////////////////////////////////////
+Vector2::Vector2(float xVal, float yVal) {
+ this->x = xVal;
+ this->y = yVal;
+}
+
+//////////////////////////////////////////////////////////////////////////
+Vector2::~Vector2() {
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float Vector2::length() const {
+ return (float)sqrt(x * x + y * y);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/math/vector2.h b/engines/wintermute/math/vector2.h
new file mode 100644
index 0000000000..31f31daaa0
--- /dev/null
+++ b/engines/wintermute/math/vector2.h
@@ -0,0 +1,75 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_VECTOR2_H
+#define WINTERMUTE_VECTOR2_H
+
+namespace Wintermute {
+
+class Vector2 {
+public:
+ Vector2();
+ Vector2(float x, float y);
+ ~Vector2();
+
+ float length() const;
+
+ inline Vector2 &operator= (const Vector2 &other) {
+ x = other.x;
+ y = other.y;
+
+ return *this;
+ }
+
+ inline Vector2 operator+ (const Vector2 &other) const {
+ return Vector2(x + other.x, y + other.y);
+ }
+
+ inline Vector2 operator- (const Vector2 &other) const {
+ return Vector2(x - other.x, y - other.y);
+ }
+
+ inline Vector2 operator* (const float scalar) const {
+ return Vector2(x * scalar, y * scalar);
+ }
+
+ inline Vector2 &operator+= (const Vector2 &other) {
+ x += other.x;
+ y += other.y;
+
+ return *this;
+ }
+
+
+ float x;
+ float y;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk
new file mode 100644
index 0000000000..7b5b1b1a3a
--- /dev/null
+++ b/engines/wintermute/module.mk
@@ -0,0 +1,123 @@
+MODULE := engines/wintermute
+
+MODULE_OBJS := \
+ ad/ad_actor.o \
+ ad/ad_entity.o \
+ ad/ad_game.o \
+ ad/ad_inventory.o \
+ ad/ad_inventory_box.o \
+ ad/ad_item.o \
+ ad/ad_layer.o \
+ ad/ad_node_state.o \
+ ad/ad_object.o \
+ ad/ad_path.o \
+ ad/ad_path_point.o \
+ ad/ad_region.o \
+ ad/ad_response.o \
+ ad/ad_response_box.o \
+ ad/ad_response_context.o \
+ ad/ad_rot_level.o \
+ ad/ad_scale_level.o \
+ ad/ad_scene.o \
+ ad/ad_scene_node.o \
+ ad/ad_scene_state.o \
+ ad/ad_sentence.o \
+ ad/ad_sprite_set.o \
+ ad/ad_talk_def.o \
+ ad/ad_talk_holder.o \
+ ad/ad_talk_node.o \
+ ad/ad_waypoint_group.o \
+ base/scriptables/script.o \
+ base/scriptables/script_engine.o \
+ base/scriptables/script_stack.o \
+ base/scriptables/script_value.o \
+ base/scriptables/script_ext_array.o \
+ base/scriptables/script_ext_date.o \
+ base/scriptables/script_ext_file.o \
+ base/scriptables/script_ext_math.o \
+ base/scriptables/script_ext_object.o \
+ base/scriptables/script_ext_mem_buffer.o \
+ base/scriptables/script_ext_string.o \
+ base/file/base_disk_file.o \
+ base/file/base_file.o \
+ base/file/base_file_entry.o \
+ base/file/base_package.o \
+ base/file/base_resources.o \
+ base/file/base_save_thumb_file.o \
+ base/font/base_font_bitmap.o \
+ base/font/base_font_truetype.o \
+ base/font/base_font.o \
+ base/font/base_font_storage.o \
+ base/gfx/base_image.o \
+ base/gfx/base_renderer.o \
+ base/gfx/base_surface.o \
+ base/gfx/osystem/base_surface_osystem.o \
+ base/gfx/osystem/base_render_osystem.o \
+ base/particles/part_particle.o \
+ base/particles/part_emitter.o \
+ base/particles/part_force.o \
+ base/sound/base_sound.o \
+ base/sound/base_sound_buffer.o \
+ base/sound/base_sound_manager.o \
+ base/base_active_rect.o \
+ base/base.o \
+ base/base_dynamic_buffer.o \
+ base/base_engine.o \
+ base/base_fader.o \
+ base/base_file_manager.o \
+ base/base_frame.o \
+ base/base_game.o \
+ base/base_keyboard_state.o \
+ base/base_named_object.o \
+ base/base_object.o \
+ base/base_parser.o \
+ base/base_persistence_manager.o \
+ base/base_point.o \
+ base/base_quick_msg.o \
+ base/base_region.o \
+ base/base_save_thumb_helper.o \
+ base/base_scriptable.o \
+ base/base_script_holder.o \
+ base/base_sprite.o \
+ base/base_string_table.o \
+ base/base_sub_frame.o \
+ base/base_surface_storage.o \
+ base/base_transition_manager.o \
+ base/base_viewport.o \
+ base/saveload.o \
+ detection.o \
+ graphics/transparent_surface.o \
+ math/math_util.o \
+ math/matrix4.o \
+ math/vector2.o \
+ platform_osystem.o \
+ system/sys_class.o \
+ system/sys_class_registry.o \
+ system/sys_instance.o \
+ ui/ui_button.o \
+ ui/ui_edit.o \
+ ui/ui_entity.o \
+ ui/ui_object.o \
+ ui/ui_text.o \
+ ui/ui_tiled_image.o \
+ ui/ui_window.o \
+ utils/convert_utf.o \
+ utils/crc.o \
+ utils/path_util.o \
+ utils/string_util.o \
+ utils/utils.o \
+ video/video_player.o \
+ video/video_theora_player.o \
+ wintermute.o \
+ persistent.o
+
+MODULE_DIRS += \
+ engines/wintermute
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_WINTERMUTE), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp
new file mode 100644
index 0000000000..514fd61d34
--- /dev/null
+++ b/engines/wintermute/persistent.cpp
@@ -0,0 +1,168 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_actor.h"
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/ad/ad_inventory.h"
+#include "engines/wintermute/ad/ad_inventory_box.h"
+#include "engines/wintermute/ad/ad_item.h"
+#include "engines/wintermute/ad/ad_layer.h"
+#include "engines/wintermute/ad/ad_node_state.h"
+#include "engines/wintermute/ad/ad_object.h"
+#include "engines/wintermute/ad/ad_path.h"
+#include "engines/wintermute/ad/ad_path_point.h"
+#include "engines/wintermute/ad/ad_region.h"
+#include "engines/wintermute/ad/ad_response.h"
+#include "engines/wintermute/ad/ad_response_box.h"
+#include "engines/wintermute/ad/ad_response_context.h"
+#include "engines/wintermute/ad/ad_rot_level.h"
+#include "engines/wintermute/ad/ad_scale_level.h"
+#include "engines/wintermute/ad/ad_scene.h"
+#include "engines/wintermute/ad/ad_scene_node.h"
+#include "engines/wintermute/ad/ad_scene_state.h"
+#include "engines/wintermute/ad/ad_sentence.h"
+#include "engines/wintermute/ad/ad_sprite_set.h"
+#include "engines/wintermute/ad/ad_talk_def.h"
+#include "engines/wintermute/ad/ad_talk_holder.h"
+#include "engines/wintermute/ad/ad_talk_node.h"
+#include "engines/wintermute/ad/ad_waypoint_group.h"
+#include "engines/wintermute/base/base_fader.h"
+#include "engines/wintermute/base/font/base_font_bitmap.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font_truetype.h"
+#include "engines/wintermute/base/base_frame.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_keyboard_state.h"
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/base/base_point.h"
+#include "engines/wintermute/base/base_region.h"
+#include "engines/wintermute/base/base_scriptable.h"
+#include "engines/wintermute/base/base_script_holder.h"
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_ext_array.h"
+#include "engines/wintermute/base/scriptables/script_ext_date.h"
+#include "engines/wintermute/base/scriptables/script_ext_file.h"
+#include "engines/wintermute/base/scriptables/script_ext_math.h"
+#include "engines/wintermute/base/scriptables/script_ext_mem_buffer.h"
+#include "engines/wintermute/base/scriptables/script_ext_object.h"
+#include "engines/wintermute/base/scriptables/script_ext_string.h"
+#include "engines/wintermute/ui/ui_button.h"
+#include "engines/wintermute/ui/ui_edit.h"
+#include "engines/wintermute/ui/ui_entity.h"
+#include "engines/wintermute/ui/ui_text.h"
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/video/video_theora_player.h"
+#include "engines/wintermute/system/sys_class.h"
+
+// SystemClass adds these objects to the registry, thus they aren't as leaked as they look
+#define REGISTER_CLASS(class_name, persistent_class)\
+ new Wintermute::SystemClass(class_name::_className, class_name::persistBuild, class_name::persistLoad, persistent_class);
+
+namespace Wintermute {
+
+// This is done in a separate file, to avoid including the kitchensink in SystemClassRegistry.
+void SystemClassRegistry::registerClasses() {
+ REGISTER_CLASS(AdActor, false)
+ REGISTER_CLASS(AdEntity, false)
+ REGISTER_CLASS(AdGame, true)
+ REGISTER_CLASS(AdInventory, false)
+ REGISTER_CLASS(AdInventoryBox, false)
+ REGISTER_CLASS(AdItem, false)
+ REGISTER_CLASS(AdLayer, false)
+ REGISTER_CLASS(AdNodeState, false)
+ REGISTER_CLASS(AdObject, false)
+ REGISTER_CLASS(AdPath, false)
+ REGISTER_CLASS(AdPathPoint, false)
+ REGISTER_CLASS(AdRegion, false)
+ REGISTER_CLASS(AdResponse, false)
+ REGISTER_CLASS(AdResponseBox, false)
+ REGISTER_CLASS(AdResponseContext, false)
+ REGISTER_CLASS(AdRotLevel, false)
+ REGISTER_CLASS(AdScaleLevel, false)
+ REGISTER_CLASS(AdScene, false)
+ REGISTER_CLASS(AdSceneNode, false)
+ REGISTER_CLASS(AdSceneState, false)
+ REGISTER_CLASS(AdSentence, false)
+ REGISTER_CLASS(AdSpriteSet, false)
+ REGISTER_CLASS(AdTalkDef, false)
+ REGISTER_CLASS(AdTalkHolder, false)
+ REGISTER_CLASS(AdTalkNode, false)
+ REGISTER_CLASS(AdWaypointGroup, false)
+
+ REGISTER_CLASS(BaseFader, false)
+ REGISTER_CLASS(BaseFont, false)
+ REGISTER_CLASS(BaseFontBitmap, false)
+ REGISTER_CLASS(BaseFontStorage, true)
+ REGISTER_CLASS(BaseFontTT, false)
+ REGISTER_CLASS(BaseFrame, false)
+ REGISTER_CLASS(BaseGame, true)
+ REGISTER_CLASS(BaseKeyboardState, false)
+ REGISTER_CLASS(BaseObject, false)
+ REGISTER_CLASS(BasePoint, false)
+ REGISTER_CLASS(BaseRegion, false)
+ REGISTER_CLASS(BaseScriptable, false)
+ REGISTER_CLASS(BaseScriptHolder, false)
+ REGISTER_CLASS(BaseSound, false)
+ REGISTER_CLASS(BaseSprite, false)
+ REGISTER_CLASS(BaseSubFrame, false)
+
+ REGISTER_CLASS(BaseViewport, false)
+ REGISTER_CLASS(PartEmitter, false)
+ REGISTER_CLASS(ScEngine, true)
+ REGISTER_CLASS(ScScript, false)
+ REGISTER_CLASS(ScStack, false)
+ REGISTER_CLASS(ScValue, false)
+ REGISTER_CLASS(SXArray, false)
+ REGISTER_CLASS(SXDate, false)
+ REGISTER_CLASS(SXFile, false)
+ REGISTER_CLASS(SXMath, true)
+ REGISTER_CLASS(SXMemBuffer, false)
+ REGISTER_CLASS(SXObject, false)
+ REGISTER_CLASS(SXString, false)
+
+ REGISTER_CLASS(UIButton, false)
+ REGISTER_CLASS(UIEdit, false)
+ REGISTER_CLASS(UIEntity, false)
+ REGISTER_CLASS(UIObject, false)
+ REGISTER_CLASS(UIText, false)
+ REGISTER_CLASS(UITiledImage, false)
+ REGISTER_CLASS(UIWindow, false)
+ REGISTER_CLASS(VideoTheoraPlayer, false)
+}
+
+}
diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h
new file mode 100644
index 0000000000..c862df5d6b
--- /dev/null
+++ b/engines/wintermute/persistent.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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_PERSISTENT_H
+#define WINTERMUTE_PERSISTENT_H
+
+namespace Wintermute {
+
+class BasePersistenceManager;
+
+// persistence support
+typedef void *(*PERSISTBUILD)(void);
+typedef bool(*PERSISTLOAD)(void *, BasePersistenceManager *);
+typedef void (*SYS_INSTANCE_CALLBACK)(void *Instance, void *Data);
+} // end of namespace Wintermute
+
+#include "engines/wintermute/system/sys_class_registry.h"
+namespace Wintermute {
+
+
+#define DECLARE_PERSISTENT(class_name, parent_class)\
+ static const char _className[];\
+ static void* persistBuild(void);\
+ virtual const char* getClassName();\
+ static bool persistLoad(void* Instance, BasePersistenceManager* PersistMgr);\
+ class_name(TDynamicConstructor p1, TDynamicConstructor p2) :parent_class(p1, p2){ /*memset(this, 0, sizeof(class_name));*/ };\
+ virtual bool persist(BasePersistenceManager* PersistMgr);\
+ void* operator new (size_t size);\
+ void operator delete(void* p);\
+
+
+#define IMPLEMENT_PERSISTENT(class_name, persistent_class)\
+ const char class_name::_className[] = #class_name;\
+ void* class_name::persistBuild(){\
+ return ::new class_name(DYNAMIC_CONSTRUCTOR, DYNAMIC_CONSTRUCTOR);\
+ }\
+ \
+ bool class_name::persistLoad(void* Instance, BasePersistenceManager* PersistMgr){\
+ return ((class_name*)Instance)->persist(PersistMgr);\
+ }\
+ \
+ const char* class_name::getClassName(){\
+ return #class_name;\
+ }\
+ \
+ /*SystemClass Register##class_name(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class);*/\
+ \
+ void* class_name::operator new (size_t size){\
+ void* ret = ::operator new(size);\
+ SystemClassRegistry::getInstance()->registerInstance(#class_name, ret);\
+ return ret;\
+ }\
+ \
+ void class_name::operator delete (void* p){\
+ SystemClassRegistry::getInstance()->unregisterInstance(#class_name, p);\
+ ::operator delete(p);\
+ }\
+
+#define TMEMBER(member_name) #member_name, &member_name
+#define TMEMBER_INT(member_name) #member_name, (int*)&member_name
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp
new file mode 100644
index 0000000000..0bd99b11cd
--- /dev/null
+++ b/engines/wintermute/platform_osystem.cpp
@@ -0,0 +1,262 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/osystem/base_render_osystem.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "common/str.h"
+#include "common/textconsole.h"
+#include "common/system.h"
+
+namespace Wintermute {
+
+BaseGame *BasePlatform::_gameRef = NULL;
+
+#define CLASS_NAME "GF_FRAME"
+int BasePlatform::initialize(BaseGame *inGame, int argc, char *argv[]) {
+ _gameRef = inGame;
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BasePlatform::handleEvent(Common::Event *event) {
+ switch (event->type) {
+
+ case Common::EVENT_LBUTTONDOWN:
+ if (_gameRef) {
+ if (_gameRef->isLeftDoubleClick()) {
+ _gameRef->onMouseLeftDblClick();
+ } else {
+ _gameRef->onMouseLeftDown();
+ }
+ }
+ break;
+ case Common::EVENT_RBUTTONDOWN:
+ if (_gameRef) {
+ if (_gameRef->isRightDoubleClick()) {
+ _gameRef->onMouseRightDblClick();
+ } else {
+ _gameRef->onMouseRightDown();
+ }
+ }
+ break;
+ case Common::EVENT_MBUTTONDOWN:
+ if (_gameRef) {
+ _gameRef->onMouseMiddleDown();
+ }
+ break;
+ case Common::EVENT_LBUTTONUP:
+ if (_gameRef) {
+ _gameRef->onMouseLeftUp();
+ }
+ break;
+ case Common::EVENT_RBUTTONUP:
+ if (_gameRef) {
+ _gameRef->onMouseRightUp();
+ }
+ break;
+ case Common::EVENT_MBUTTONUP:
+ if (_gameRef) {
+ _gameRef->onMouseMiddleUp();
+ }
+ break;
+ case Common::EVENT_KEYDOWN:
+ if (_gameRef) {
+ _gameRef->handleKeypress(event);
+ }
+ break;
+ case Common::EVENT_KEYUP:
+ if (_gameRef) {
+ _gameRef->handleKeyRelease(event);
+ }
+ break;
+ case Common::EVENT_WHEELUP:
+ case Common::EVENT_WHEELDOWN:
+ if (_gameRef) {
+ _gameRef->handleMouseWheel(event->mouse.y);
+ }
+ break;
+// Focus-events have been removed (_gameRef->onActivate originally)
+ case Common::EVENT_RTL:
+ _gameRef->_quitting = true;
+ break;
+ case Common::EVENT_QUIT:
+// Block kept in case we want to support autoSaveOnExit.
+// Originally this was the behaviour for WME Lite on iOS:
+// if (_gameRef) {
+// _gameRef->AutoSaveOnExit();
+// _gameRef->_quitting = true;
+// }
+ if (_gameRef) {
+ _gameRef->onWindowClose();
+ }
+ break;
+ default:
+ // TODO: Do we care about any other events?
+ break;
+
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Win32 API bindings
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::getCursorPos(Point32 *lpPoint) {
+ BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
+
+ Common::Point p = g_system->getEventManager()->getMousePos();
+ lpPoint->x = p.x;
+ lpPoint->y = p.y;
+
+ renderer->pointFromScreen(lpPoint);
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::setCursorPos(int x, int y) {
+ BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
+
+ Point32 p;
+ p.x = x;
+ p.y = y;
+ renderer->pointToScreen(&p);
+
+ g_system->warpMouse(x, y);
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::showWindow(int nCmdShow) {
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BasePlatform::setCapture() {
+ return;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::releaseCapture() {
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::setRectEmpty(Rect32 *lprc) {
+ lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::isRectEmpty(const Rect32 *lprc) {
+ return (lprc->left >= lprc->right) || (lprc->top >= lprc->bottom);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::ptInRect(Rect32 *lprc, Point32 p) {
+ return (p.x >= lprc->left) && (p.x < lprc->right) && (p.y >= lprc->top) && (p.y < lprc->bottom);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) {
+ lprc->left = left;
+ lprc->top = top;
+ lprc->right = right;
+ lprc->bottom = bottom;
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2) {
+ if (isRectEmpty(lprcSrc1) || isRectEmpty(lprcSrc2) ||
+ lprcSrc1->left >= lprcSrc2->right || lprcSrc2->left >= lprcSrc1->right ||
+ lprcSrc1->top >= lprcSrc2->bottom || lprcSrc2->top >= lprcSrc1->bottom) {
+ setRectEmpty(lprcDst);
+ return false;
+ }
+ lprcDst->left = MAX(lprcSrc1->left, lprcSrc2->left);
+ lprcDst->right = MIN(lprcSrc1->right, lprcSrc2->right);
+ lprcDst->top = MAX(lprcSrc1->top, lprcSrc2->top);
+ lprcDst->bottom = MIN(lprcSrc1->bottom, lprcSrc2->bottom);
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2) {
+ if (isRectEmpty(lprcSrc1)) {
+ if (isRectEmpty(lprcSrc2)) {
+ setRectEmpty(lprcDst);
+ return false;
+ } else {
+ *lprcDst = *lprcSrc2;
+ }
+ } else {
+ if (isRectEmpty(lprcSrc2)) {
+ *lprcDst = *lprcSrc1;
+ } else {
+ lprcDst->left = MIN(lprcSrc1->left, lprcSrc2->left);
+ lprcDst->top = MIN(lprcSrc1->top, lprcSrc2->top);
+ lprcDst->right = MAX(lprcSrc1->right, lprcSrc2->right);
+ lprcDst->bottom = MAX(lprcSrc1->bottom, lprcSrc2->bottom);
+ }
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BasePlatform::copyRect(Rect32 *lprcDst, Rect32 *lprcSrc) {
+ if (lprcDst == NULL || lprcSrc == NULL) {
+ return false;
+ }
+
+ *lprcDst = *lprcSrc;
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString BasePlatform::getPlatformName() {
+ // TODO: Should conform to the WME-spec.
+ //return AnsiString(SDL_GetPlatform());
+ return AnsiString("ScummVM");
+}
+
+//////////////////////////////////////////////////////////////////////////
+char *BasePlatform::strlwr(char *string) {
+ if (string) {
+ for (size_t i = 0; i < strlen(string); ++i) {
+ string[i] = tolower(string[i]);
+ }
+ }
+ return string;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h
new file mode 100644
index 0000000000..21a77e0a0e
--- /dev/null
+++ b/engines/wintermute/platform_osystem.h
@@ -0,0 +1,73 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_PLATFORMSDL_H
+#define WINTERMUTE_PLATFORMSDL_H
+
+#include "engines/wintermute/dctypes.h"
+#include "engines/wintermute/math/rect32.h"
+#include "common/events.h"
+
+namespace Wintermute {
+
+class BaseGame;
+
+//////////////////////////////////////////////////////////////////////////
+class BasePlatform {
+public:
+ static int initialize(BaseGame *inGame, int argc, char *argv[]);
+ static void handleEvent(Common::Event *event);
+ static AnsiString getPlatformName();
+
+ // Win32 API bindings
+ static bool getCursorPos(Point32 *lpPoint);
+ static bool setCursorPos(int x, int y);
+ static bool showWindow(int nCmdShow);
+
+ static void setCapture();
+ static bool releaseCapture();
+
+ static bool setRectEmpty(Rect32 *lprc);
+ static bool isRectEmpty(const Rect32 *lprc);
+ static bool ptInRect(Rect32 *lprc, Point32 p);
+ static bool setRect(Rect32 *lprc, int left, int top, int right, int bottom);
+ static bool intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2);
+ static bool unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2);
+ static bool copyRect(Rect32 *lprcDst, Rect32 *lprcSrc);
+
+ // string functions
+ static char *strlwr(char *string);
+
+private:
+ // Set by initialize on game-startup, the object referred to is also deleted by deinit in WintermuteEngine
+ static BaseGame *_gameRef;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/system/sys_class.cpp b/engines/wintermute/system/sys_class.cpp
new file mode 100644
index 0000000000..06b36b84de
--- /dev/null
+++ b/engines/wintermute/system/sys_class.cpp
@@ -0,0 +1,220 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/system/sys_instance.h"
+#include "engines/wintermute/system/sys_class.h"
+#include "engines/wintermute/system/sys_class_registry.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+SystemClass::SystemClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD load, bool persistentClass) {
+ _name = name;
+
+ _build = build;
+ _load = load;
+ _next = NULL;
+ _savedID = -1;
+ _persistent = persistentClass;
+ _numInst = 0;
+
+ SystemClassRegistry::getInstance()->registerClass(this);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SystemClass::~SystemClass() {
+ SystemClassRegistry::getInstance()->unregisterClass(this);
+ removeAllInstances();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClass::removeAllInstances() {
+ Instances::iterator it;
+ for (it = _instances.begin(); it != _instances.end(); ++it) {
+ delete(it->_value);
+ }
+ _instances.clear();
+ _instanceMap.clear();
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+SystemInstance *SystemClass::addInstance(void *instance, int id, int savedId) {
+ SystemInstance *inst = new SystemInstance(instance, id, this);
+ inst->setSavedID(savedId);
+ _instances[inst] = (inst);
+
+ _instanceMap[instance] = inst;
+
+ SystemClassRegistry::getInstance()->addInstanceToTable(inst, instance);
+
+ return inst;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClass::removeInstance(void *instance) {
+ InstanceMap::iterator mapIt = _instanceMap.find(instance);
+ if (mapIt == _instanceMap.end()) {
+ return false;
+ }
+
+ Instances::iterator it = _instances.find((mapIt->_value));
+ if (it != _instances.end()) {
+ delete(it->_value);
+ _instances.erase(it);
+ }
+
+ _instanceMap.erase(mapIt);
+
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int SystemClass::getInstanceID(void *pointer) {
+ InstanceMap::iterator mapIt = _instanceMap.find(pointer);
+ if (mapIt == _instanceMap.end()) {
+ return -1;
+ } else {
+ return (mapIt->_value)->getID();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void *SystemClass::idToPointer(int savedID) {
+ //slow
+ Instances::iterator it;
+ for (it = _instances.begin(); it != _instances.end(); ++it) {
+ if ((it->_value)->getSavedID() == savedID) {
+ return (it->_value)->getInstance();
+ }
+ }
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int SystemClass::getNumInstances() {
+ return _instances.size();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::dump(Common::WriteStream *stream) {
+ Common::String str;
+ str = Common::String::format("%03d %c %-20s instances: %d\n", _iD, _persistent ? 'p' : ' ', _name.c_str(), getNumInstances());
+ stream->write(str.c_str(), str.size());
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::saveTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) {
+ persistMgr->putString(_name.c_str());
+ persistMgr->putDWORD(_iD);
+ persistMgr->putDWORD(_instances.size());
+
+ Instances::iterator it;
+ for (it = _instances.begin(); it != _instances.end(); ++it) {
+ persistMgr->putDWORD((it->_value)->getID());
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::loadTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) {
+ _savedID = persistMgr->getDWORD();
+ int numInstances = persistMgr->getDWORD();
+
+ for (int i = 0; i < numInstances; i++) {
+ int instID = persistMgr->getDWORD();
+ if (_persistent) {
+
+ if (i > 0) {
+ gameRef->LOG(0, "Warning: attempting to load multiple instances of persistent class %s (%d)", _name.c_str(), numInstances);
+ continue;
+ }
+
+ Instances::iterator it = _instances.begin();
+ if (it != _instances.end()) {
+ (it->_value)->setSavedID(instID);
+ SystemClassRegistry::getInstance()->addInstanceToTable((it->_value), (it->_value)->getInstance());
+ } else {
+ gameRef->LOG(0, "Warning: instance %d of persistent class %s not found", i, _name.c_str());
+ }
+ }
+ // normal instances, create empty objects
+ else {
+ void *emptyObject = _build();
+ if (!emptyObject) {
+ warning("HALT");
+ }
+
+ addInstance(emptyObject, SystemClassRegistry::getInstance()->getNextID(), instID);
+ }
+
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::saveInstances(BaseGame *Game, BasePersistenceManager *persistMgr) {
+ Instances::iterator it;
+ for (it = _instances.begin(); it != _instances.end(); ++it) {
+ // write instace header
+ persistMgr->putString("<INSTANCE_HEAD>");
+ persistMgr->putDWORD(_iD);
+ persistMgr->putDWORD((it->_value)->getID());
+ persistMgr->putString("</INSTANCE_HEAD>");
+ _load((it->_value)->getInstance(), persistMgr);
+ persistMgr->putString("</INSTANCE>");
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::loadInstance(void *instance, BasePersistenceManager *persistMgr) {
+ _load(instance, persistMgr);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::resetSavedIDs() {
+ Instances::iterator it;
+ for (it = _instances.begin(); it != _instances.end(); ++it) {
+ (it->_value)->setSavedID(-1);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClass::instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData) {
+ Instances::iterator it;
+ for (it = _instances.begin(); it != _instances.end(); ++it) {
+ lpCallback((it->_value)->getInstance(), lpData);
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/system/sys_class.h b/engines/wintermute/system/sys_class.h
new file mode 100644
index 0000000000..3f91723ed8
--- /dev/null
+++ b/engines/wintermute/system/sys_class.h
@@ -0,0 +1,130 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SYSCLASS_H
+#define WINTERMUTE_SYSCLASS_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/dctypes.h"
+#include "common/hashmap.h"
+#include "common/func.h"
+#include "common/stream.h"
+
+namespace Wintermute {
+class SystemInstance;
+class BaseGame;
+class BasePersistenceManager;
+class SystemClass;
+
+}
+
+namespace Common {
+template<typename T> struct Hash;
+
+template<> struct Hash<void *> : public UnaryFunction<void *, uint> {
+ uint operator()(void *val) const {
+ return (uint)((size_t)val);
+ }
+};
+
+template<> struct Hash<Wintermute::SystemInstance *> : public UnaryFunction<Wintermute::SystemInstance *, uint> {
+ uint operator()(Wintermute::SystemInstance *val) const {
+ return (uint)((size_t)val);
+ }
+};
+
+
+}
+
+namespace Wintermute {
+
+class SystemClass {
+public:
+ SystemClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD load, bool persistentClass);
+ ~SystemClass();
+
+ int getNumInstances();
+ bool removeInstance(void *instance);
+ SystemInstance *addInstance(void *instance, int id, int savedId = -1);
+ bool removeAllInstances();
+
+ int getInstanceID(void *pointer);
+ void *idToPointer(int savedID);
+
+ void setID(int id) {
+ _iD = id;
+ }
+ int getID() const {
+ return _iD;
+ }
+
+ int getSavedID() const {
+ return _savedID;
+ }
+
+ bool isPersistent() const {
+ return _persistent;
+ }
+
+ AnsiString getName() const {
+ return _name;
+ }
+
+ void saveTable(BaseGame *Game, BasePersistenceManager *PersistMgr);
+ void loadTable(BaseGame *Game, BasePersistenceManager *PersistMgr);
+
+ void saveInstances(BaseGame *Game, BasePersistenceManager *PersistMgr);
+ void loadInstance(void *instance, BasePersistenceManager *PersistMgr);
+
+ void instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData);
+
+ void resetSavedIDs();
+
+ void dump(Common::WriteStream *stream);
+
+private:
+ int _numInst;
+ bool _persistent;
+ SystemClass *_next;
+ int _iD;
+ int _savedID;
+ AnsiString _name;
+ PERSISTBUILD _build;
+ PERSISTLOAD _load;
+
+ //typedef std::set<SystemInstance *> Instances;
+ typedef Common::HashMap<SystemInstance *, SystemInstance *> Instances;
+ Instances _instances;
+
+ typedef Common::HashMap<void *, SystemInstance *> InstanceMap;
+ InstanceMap _instanceMap;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp
new file mode 100644
index 0000000000..7c1911c2bf
--- /dev/null
+++ b/engines/wintermute/system/sys_class_registry.cpp
@@ -0,0 +1,336 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/system/sys_instance.h"
+#include "engines/wintermute/system/sys_class_registry.h"
+#include "engines/wintermute/system/sys_class.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/stream.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+SystemClassRegistry::SystemClassRegistry() {
+ _count = 0;
+ _disabled = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+SystemClassRegistry::~SystemClassRegistry() {
+ unregisterClasses();
+}
+
+//////////////////////////////////////////////////////////////////////////
+SystemClassRegistry *SystemClassRegistry::getInstance() {
+ return BaseEngine::instance().getClassRegistry();
+}
+
+void SystemClassRegistry::unregisterClasses() {
+ // SystemClass calls UnregisterClass upon destruction.
+ while (_classes.size() > 0) {
+ delete _classes.begin()->_value;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::registerClass(SystemClass *classObj) {
+ classObj->setID(_count++);
+ //_classes.insert(classObj);
+ _classes[classObj] = classObj;
+
+ _nameMap[classObj->getName()] = classObj;
+ _idMap[classObj->getID()] = classObj;
+
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::unregisterClass(SystemClass *classObj) {
+
+ Classes::iterator it = _classes.find(classObj);
+ if (it == _classes.end()) {
+ return false;
+ }
+
+ if (classObj->getNumInstances() != 0) {
+ debugC(Wintermute::kWintermuteDebugSaveGame, "Memory leak@class %-20s: %d instance(s) left\n", classObj->getName().c_str(), classObj->getNumInstances());
+ }
+ _classes.erase(it);
+
+ NameMap::iterator mapIt = _nameMap.find(classObj->getName());
+ if (mapIt != _nameMap.end()) {
+ _nameMap.erase(mapIt);
+ }
+
+ IdMap::iterator idIt = _idMap.find(classObj->getID());
+ if (idIt != _idMap.end()) {
+ _idMap.erase(idIt);
+ }
+
+
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::registerInstance(const char *className, void *instance) {
+ if (_disabled) {
+ return true;
+ }
+
+ NameMap::iterator mapIt = _nameMap.find(className);
+ if (mapIt == _nameMap.end()) {
+ return false;
+ }
+
+ SystemInstance *inst = (*mapIt)._value->addInstance(instance, _count++);
+ return (inst != NULL);
+}
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClassRegistry::addInstanceToTable(SystemInstance *instance, void *pointer) {
+ _instanceMap[pointer] = instance;
+
+ if (instance->getSavedID() >= 0) {
+ _savedInstanceMap[instance->getSavedID()] = instance;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+int SystemClassRegistry::getNextID() {
+ return _count++;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::unregisterInstance(const char *className, void *instance) {
+ NameMap::iterator mapIt = _nameMap.find(className);
+ if (mapIt == _nameMap.end()) {
+ return false;
+ }
+ (*mapIt)._value->removeInstance(instance);
+
+ InstanceMap::iterator instIt = _instanceMap.find(instance);
+ if (instIt != _instanceMap.end()) {
+ _instanceMap.erase(instIt);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::getPointerID(void *pointer, int *classID, int *instanceID) {
+ if (pointer == NULL) {
+ return true;
+ }
+
+ InstanceMap::iterator it = _instanceMap.find(pointer);
+ if (it == _instanceMap.end()) {
+ return false;
+ }
+
+
+ SystemInstance *inst = (*it)._value;
+ *instanceID = inst->getID();
+ *classID = inst->getClass()->getID();
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void *SystemClassRegistry::idToPointer(int classID, int instanceID) {
+ SavedInstanceMap::iterator it = _savedInstanceMap.find(instanceID);
+ if (it == _savedInstanceMap.end()) {
+ return NULL;
+ } else {
+ return (*it)._value->getInstance();
+ }
+}
+
+bool checkHeader(const char *tag, BasePersistenceManager *pm) {
+ char *test = pm->getString();
+ Common::String verify = test;
+ delete[] test;
+ bool retVal = (verify == tag);
+ if (!retVal) {
+ error("Expected %s in Save-file not found", tag);
+ }
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::saveTable(BaseGame *gameRef, BasePersistenceManager *persistMgr, bool quickSave) {
+ persistMgr->putString("<CLASS_REGISTRY_TABLE>");
+ persistMgr->putDWORD(_classes.size());
+
+ int counter = 0;
+
+ Classes::iterator it;
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ counter++;
+
+ if (!quickSave) {
+ gameRef->_renderer->setIndicatorVal((int)(50.0f / (float)((float)_classes.size() / (float)counter)));
+ }
+
+ (it->_value)->saveTable(gameRef, persistMgr);
+ }
+ persistMgr->putString("</CLASS_REGISTRY_TABLE>");
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::loadTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) {
+ checkHeader("<CLASS_REGISTRY_TABLE>", persistMgr);
+
+ // reset SavedID of current instances
+ Classes::iterator it;
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ (it->_value)->resetSavedIDs();
+ }
+
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ if ((it->_value)->isPersistent()) {
+ continue;
+ }
+ (it->_value)->removeAllInstances();
+ }
+
+ _instanceMap.clear();
+
+ uint32 numClasses = persistMgr->getDWORD();
+
+ for (uint32 i = 0; i < numClasses; i++) {
+ gameRef->_renderer->setIndicatorVal((int)(50.0f / (float)((float)numClasses / (float)i)));
+
+ Common::String className = persistMgr->getStringObj();
+ NameMap::iterator mapIt = _nameMap.find(className);
+ if (mapIt != _nameMap.end()) {
+ (*mapIt)._value->loadTable(gameRef, persistMgr);
+ }
+ }
+
+ checkHeader("</CLASS_REGISTRY_TABLE>", persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::saveInstances(BaseGame *gameRef, BasePersistenceManager *persistMgr, bool quickSave) {
+
+ Classes::iterator it;
+
+ // count total instances
+ int numInstances = 0;
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ numInstances += (it->_value)->getNumInstances();
+ }
+
+ persistMgr->putDWORD(numInstances);
+
+ int counter = 0;
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ counter++;
+
+ if (!quickSave) {
+ if (counter % 20 == 0) {
+ gameRef->_renderer->setIndicatorVal((int)(50.0f + 50.0f / (float)((float)_classes.size() / (float)counter)));
+ }
+ }
+ gameRef->miniUpdate();
+
+ (it->_value)->saveInstances(gameRef, persistMgr);
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::loadInstances(BaseGame *gameRef, BasePersistenceManager *persistMgr) {
+ // get total instances
+ int numInstances = persistMgr->getDWORD();
+
+ for (int i = 0; i < numInstances; i++) {
+ if (i % 20 == 0) {
+ gameRef->_renderer->setIndicatorVal((int)(50.0f + 50.0f / (float)((float)numInstances / (float)i)));
+ }
+
+ checkHeader("<INSTANCE_HEAD>", persistMgr);
+
+ int classID = persistMgr->getDWORD();
+ int instanceID = persistMgr->getDWORD();
+ void *instance = idToPointer(classID, instanceID);
+
+ checkHeader("</INSTANCE_HEAD>", persistMgr);
+
+ Classes::iterator it;
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ if ((it->_value)->getSavedID() == classID) {
+ (it->_value)->loadInstance(instance, persistMgr);
+ break;
+ }
+ }
+ checkHeader("</INSTANCE>", persistMgr);
+ }
+
+ _savedInstanceMap.clear();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool SystemClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) {
+ NameMap::iterator mapIt = _nameMap.find(className);
+ if (mapIt == _nameMap.end()) {
+ return STATUS_FAILED;
+ }
+
+ (*mapIt)._value->instanceCallback(lpCallback, lpData);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void SystemClassRegistry::dumpClasses(Common::WriteStream *stream) {
+ Classes::iterator it;
+ for (it = _classes.begin(); it != _classes.end(); ++it) {
+ (it->_value)->dump(stream);
+ }
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/system/sys_class_registry.h b/engines/wintermute/system/sys_class_registry.h
new file mode 100644
index 0000000000..ef7218c7c1
--- /dev/null
+++ b/engines/wintermute/system/sys_class_registry.h
@@ -0,0 +1,106 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SYSCLASSREGISTRY_H
+#define WINTERMUTE_SYSCLASSREGISTRY_H
+
+#include "engines/wintermute/wintypes.h"
+#include "engines/wintermute/dctypes.h"
+#include "engines/wintermute/system/sys_class.h"
+#include "common/hashmap.h"
+#include "common/hash-str.h"
+#include "common/func.h"
+#include "common/stream.h"
+
+namespace Wintermute {
+class SystemClass;
+}
+
+namespace Common {
+template<typename T> struct Hash;
+template<> struct Hash<Wintermute::SystemClass *> : public UnaryFunction<Wintermute::SystemClass *, uint> {
+ uint operator()(Wintermute::SystemClass *val) const {
+ return (uint)((size_t)val);
+ }
+};
+
+}
+
+namespace Wintermute {
+
+class BaseGame;
+class BasePersistenceManager;
+class SystemInstance;
+
+class SystemClassRegistry {
+ void unregisterClasses();
+public:
+ void registerClasses(); // persistent.cpp
+ static SystemClassRegistry *getInstance();
+
+ SystemClassRegistry();
+ virtual ~SystemClassRegistry();
+
+ bool enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData);
+ bool loadTable(BaseGame *Game, BasePersistenceManager *PersistMgr);
+ bool saveTable(BaseGame *Game, BasePersistenceManager *PersistMgr, bool quickSave);
+ bool loadInstances(BaseGame *Game, BasePersistenceManager *PersistMgr);
+ bool saveInstances(BaseGame *Game, BasePersistenceManager *PersistMgr, bool quickSave);
+ void *idToPointer(int classID, int instanceID);
+ bool getPointerID(void *pointer, int *classID, int *instanceID);
+ bool registerClass(SystemClass *classObj);
+ bool unregisterClass(SystemClass *classObj);
+ bool registerInstance(const char *className, void *instance);
+ bool unregisterInstance(const char *className, void *instance);
+ void dumpClasses(Common::WriteStream *stream);
+ int getNextID();
+ void addInstanceToTable(SystemInstance *instance, void *pointer);
+
+ bool _disabled;
+ int _count;
+
+ typedef Common::HashMap<SystemClass *, SystemClass *> Classes;
+ Classes _classes;
+
+ typedef Common::HashMap<AnsiString, SystemClass *> NameMap;
+ NameMap _nameMap;
+
+ typedef Common::HashMap<int, SystemClass *> IdMap;
+ IdMap _idMap;
+
+ typedef Common::HashMap<void *, SystemInstance *> InstanceMap;
+ InstanceMap _instanceMap;
+
+ typedef Common::HashMap<int, SystemInstance *> SavedInstanceMap;
+ SavedInstanceMap _savedInstanceMap;
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/system/sys_instance.cpp b/engines/wintermute/system/sys_instance.cpp
new file mode 100644
index 0000000000..d106119dba
--- /dev/null
+++ b/engines/wintermute/system/sys_instance.cpp
@@ -0,0 +1,49 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/system/sys_instance.h"
+#include "engines/wintermute/system/sys_class_registry.h"
+#include "engines/wintermute/system/sys_class.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+SystemInstance::SystemInstance(void *instance, int id, SystemClass *sysClass) {
+ _instance = instance;
+ _id = id;
+ _savedID = -1;
+ _class = sysClass;
+
+ _used = false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+SystemInstance::~SystemInstance() {
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/system/sys_instance.h b/engines/wintermute/system/sys_instance.h
new file mode 100644
index 0000000000..215a6d1437
--- /dev/null
+++ b/engines/wintermute/system/sys_instance.h
@@ -0,0 +1,68 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SYSINSTANCE_H
+#define WINTERMUTE_SYSINSTANCE_H
+
+namespace Wintermute {
+
+class SystemClass;
+
+class SystemInstance {
+public:
+ SystemInstance(void *instance, int id, SystemClass *sysClass);
+ virtual ~SystemInstance();
+
+ int getID() const {
+ return _id;
+ }
+ int getSavedID() const {
+ return _savedID;
+ }
+ void *getInstance() const {
+ return _instance;
+ }
+ SystemClass *getClass() const {
+ return _class;
+ }
+
+ void setSavedID(int id) {
+ _savedID = id;
+ }
+
+private:
+ bool _used;
+ int _id;
+ int _savedID;
+ void *_instance;
+ SystemClass *_class;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
new file mode 100644
index 0000000000..7967d566f9
--- /dev/null
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -0,0 +1,1209 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/ui/ui_button.h"
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UIButton, false)
+
+//////////////////////////////////////////////////////////////////////////
+UIButton::UIButton(BaseGame *inGame) : UIObject(inGame) {
+ _backPress = _backHover = _backDisable = _backFocus = NULL;
+
+ _fontHover = _fontPress = _fontDisable = _fontFocus = NULL;
+
+ _imageDisable = _imagePress = _imageHover = _imageFocus = NULL;
+
+ _align = TAL_CENTER;
+
+ _hover = _press = false;
+
+ _type = UI_BUTTON;
+
+ _canFocus = false;
+ _stayPressed = false;
+
+ _oneTimePress = false;
+ _centerImage = false;
+
+ _pixelPerfect = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UIButton::~UIButton() {
+ delete _backPress;
+ delete _backHover;
+ delete _backDisable;
+ delete _backFocus;
+
+ if (!_sharedFonts) {
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
+ if (_fontPress) {
+ _gameRef->_fontStorage->removeFont(_fontPress);
+ }
+ if (_fontDisable) {
+ _gameRef->_fontStorage->removeFont(_fontDisable);
+ }
+ if (_fontFocus) {
+ _gameRef->_fontStorage->removeFont(_fontFocus);
+ }
+ }
+
+ if (!_sharedImages) {
+ delete _imageHover;
+ delete _imagePress;
+ delete _imageDisable;
+ delete _imageFocus;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "UIButton::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing BUTTON file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(BUTTON)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(DISABLED)
+TOKEN_DEF(VISIBLE)
+TOKEN_DEF(FOCUSABLE)
+TOKEN_DEF(BACK_HOVER)
+TOKEN_DEF(BACK_PRESS)
+TOKEN_DEF(BACK_DISABLE)
+TOKEN_DEF(BACK_FOCUS)
+TOKEN_DEF(BACK)
+TOKEN_DEF(CENTER_IMAGE)
+TOKEN_DEF(IMAGE_HOVER)
+TOKEN_DEF(IMAGE_PRESS)
+TOKEN_DEF(IMAGE_DISABLE)
+TOKEN_DEF(IMAGE_FOCUS)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(FONT_HOVER)
+TOKEN_DEF(FONT_PRESS)
+TOKEN_DEF(FONT_DISABLE)
+TOKEN_DEF(FONT_FOCUS)
+TOKEN_DEF(FONT)
+TOKEN_DEF(TEXT_ALIGN)
+TOKEN_DEF(TEXT)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(WIDTH)
+TOKEN_DEF(HEIGHT)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(NAME)
+TOKEN_DEF(EVENTS)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PARENT_NOTIFY)
+TOKEN_DEF(PRESSED)
+TOKEN_DEF(PIXEL_PERFECT)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(BUTTON)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(DISABLED)
+ TOKEN_TABLE(VISIBLE)
+ TOKEN_TABLE(FOCUSABLE)
+ TOKEN_TABLE(BACK_HOVER)
+ TOKEN_TABLE(BACK_PRESS)
+ TOKEN_TABLE(BACK_DISABLE)
+ TOKEN_TABLE(BACK_FOCUS)
+ TOKEN_TABLE(BACK)
+ TOKEN_TABLE(CENTER_IMAGE)
+ TOKEN_TABLE(IMAGE_HOVER)
+ TOKEN_TABLE(IMAGE_PRESS)
+ TOKEN_TABLE(IMAGE_DISABLE)
+ TOKEN_TABLE(IMAGE_FOCUS)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(FONT_HOVER)
+ TOKEN_TABLE(FONT_PRESS)
+ TOKEN_TABLE(FONT_DISABLE)
+ TOKEN_TABLE(FONT_FOCUS)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(TEXT_ALIGN)
+ TOKEN_TABLE(TEXT)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(WIDTH)
+ TOKEN_TABLE(HEIGHT)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(EVENTS)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PARENT_NOTIFY)
+ TOKEN_TABLE(PRESSED)
+ TOKEN_TABLE(PIXEL_PERFECT)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_BUTTON) {
+ _gameRef->LOG(0, "'BUTTON' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_BACK:
+ delete _back;
+ _back = new UITiledImage(_gameRef);
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
+ delete _back;
+ _back = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_BACK_HOVER:
+ delete _backHover;
+ _backHover = new UITiledImage(_gameRef);
+ if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) {
+ delete _backHover;
+ _backHover = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_BACK_PRESS:
+ delete _backPress;
+ _backPress = new UITiledImage(_gameRef);
+ if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) {
+ delete _backPress;
+ _backPress = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_BACK_DISABLE:
+ delete _backDisable;
+ _backDisable = new UITiledImage(_gameRef);
+ if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) {
+ delete _backDisable;
+ _backDisable = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_BACK_FOCUS:
+ delete _backFocus;
+ _backFocus = new UITiledImage(_gameRef);
+ if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) {
+ delete _backFocus;
+ _backFocus = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE:
+ delete _image;
+ _image = new BaseSprite(_gameRef);
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
+ delete _image;
+ _image = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE_HOVER:
+ delete _imageHover;
+ _imageHover = new BaseSprite(_gameRef);
+ if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) {
+ delete _imageHover;
+ _imageHover = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE_PRESS:
+ delete _imagePress;
+ _imagePress = new BaseSprite(_gameRef);
+ if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) {
+ delete _imagePress;
+ _imagePress = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE_DISABLE:
+ delete _imageDisable;
+ _imageDisable = new BaseSprite(_gameRef);
+ if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) {
+ delete _imageDisable;
+ _imageDisable = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE_FOCUS:
+ delete _imageFocus;
+ _imageFocus = new BaseSprite(_gameRef);
+ if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) {
+ delete _imageFocus;
+ _imageFocus = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT:
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ _font = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_HOVER:
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
+ _fontHover = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontHover) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_PRESS:
+ if (_fontPress) {
+ _gameRef->_fontStorage->removeFont(_fontPress);
+ }
+ _fontPress = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontPress) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_DISABLE:
+ if (_fontDisable) {
+ _gameRef->_fontStorage->removeFont(_fontDisable);
+ }
+ _fontDisable = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontDisable) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_FOCUS:
+ if (_fontFocus) {
+ _gameRef->_fontStorage->removeFont(_fontFocus);
+ }
+ _fontFocus = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontFocus) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_TEXT:
+ setText((char *)params);
+ _gameRef->_stringTable->expand(&_text);
+ break;
+
+ case TOKEN_TEXT_ALIGN:
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _align = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _align = TAL_RIGHT;
+ } else {
+ _align = TAL_CENTER;
+ }
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_WIDTH:
+ parser.scanStr((char *)params, "%d", &_width);
+ break;
+
+ case TOKEN_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_height);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PARENT_NOTIFY:
+ parser.scanStr((char *)params, "%b", &_parentNotify);
+ break;
+
+ case TOKEN_DISABLED:
+ parser.scanStr((char *)params, "%b", &_disable);
+ break;
+
+ case TOKEN_VISIBLE:
+ parser.scanStr((char *)params, "%b", &_visible);
+ break;
+
+ case TOKEN_FOCUSABLE:
+ parser.scanStr((char *)params, "%b", &_canFocus);
+ break;
+
+ case TOKEN_CENTER_IMAGE:
+ parser.scanStr((char *)params, "%b", &_centerImage);
+ break;
+
+ case TOKEN_PRESSED:
+ parser.scanStr((char *)params, "%b", &_stayPressed);
+ break;
+
+ case TOKEN_PIXEL_PERFECT:
+ parser.scanStr((char *)params, "%b", &_pixelPerfect);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in BUTTON definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading BUTTON definition");
+ return STATUS_FAILED;
+ }
+
+ correctSize();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "BUTTON\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_back && _back->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ }
+ if (_backHover && _backHover->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK_HOVER=\"%s\"\n", _backHover->getFilename());
+ }
+ if (_backPress && _backPress->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK_PRESS=\"%s\"\n", _backPress->getFilename());
+ }
+ if (_backDisable && _backDisable->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK_DISABLE=\"%s\"\n", _backDisable->getFilename());
+ }
+ if (_backFocus && _backFocus->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK_FOCUS=\"%s\"\n", _backFocus->getFilename());
+ }
+
+ if (_image && _image->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ }
+ if (_imageHover && _imageHover->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE_HOVER=\"%s\"\n", _imageHover->getFilename());
+ }
+ if (_imagePress && _imagePress->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE_PRESS=\"%s\"\n", _imagePress->getFilename());
+ }
+ if (_imageDisable && _imageDisable->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE_DISABLE=\"%s\"\n", _imageDisable->getFilename());
+ }
+ if (_imageFocus && _imageFocus->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE_FOCUS=\"%s\"\n", _imageFocus->getFilename());
+ }
+
+ if (_font && _font->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
+ if (_fontHover && _fontHover->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->getFilename());
+ }
+ if (_fontPress && _fontPress->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_PRESS=\"%s\"\n", _fontPress->getFilename());
+ }
+ if (_fontDisable && _fontDisable->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_DISABLE=\"%s\"\n", _fontDisable->getFilename());
+ }
+ if (_fontFocus && _fontFocus->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_FOCUS=\"%s\"\n", _fontFocus->getFilename());
+ }
+
+ if (_cursor && _cursor->getFilename()) {
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
+
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_text) {
+ buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
+ }
+
+ switch (_align) {
+ case TAL_LEFT:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "left");
+ break;
+ case TAL_RIGHT:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "right");
+ break;
+ case TAL_CENTER:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
+ break;
+ default:
+ warning("UIButton::SaveAsText - unhandled enum");
+ break;
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+ buffer->putTextIndent(indent + 2, "WIDTH=%d\n", _width);
+ buffer->putTextIndent(indent + 2, "HEIGHT=%d\n", _height);
+
+
+ buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PARENT_NOTIFY=%s\n", _parentNotify ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "FOCUSABLE=%s\n", _canFocus ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "CENTER_IMAGE=%s\n", _centerImage ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PRESSED=%s\n", _stayPressed ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PIXEL_PERFECT=%s\n", _pixelPerfect ? "TRUE" : "FALSE");
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void UIButton::correctSize() {
+ Rect32 rect;
+
+ BaseSprite *img = NULL;
+ if (_image) {
+ img = _image;
+ } else if (_imageDisable) {
+ img = _imageDisable;
+ } else if (_imageHover) {
+ img = _imageHover;
+ } else if (_imagePress) {
+ img = _imagePress;
+ } else if (_imageFocus) {
+ img = _imageFocus;
+ }
+
+ if (_width <= 0) {
+ if (img) {
+ img->getBoundingRect(&rect, 0, 0);
+ _width = rect.right - rect.left;
+ } else {
+ _width = 100;
+ }
+ }
+
+ if (_height <= 0) {
+ if (img) {
+ img->getBoundingRect(&rect, 0, 0);
+ _height = rect.bottom - rect.top;
+ }
+ }
+
+ if (_text) {
+ int text_height;
+ if (_font) {
+ text_height = _font->getTextHeight((byte *)_text, _width);
+ } else {
+ text_height = _gameRef->_systemFont->getTextHeight((byte *)_text, _width);
+ }
+
+ if (text_height > _height) {
+ _height = text_height;
+ }
+ }
+
+ if (_height <= 0) {
+ _height = 100;
+ }
+
+ if (_back) {
+ _back->correctSize(&_width, &_height);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::display(int offsetX, int offsetY) {
+ if (!_visible) {
+ return STATUS_OK;
+ }
+
+ UITiledImage *back = NULL;
+ BaseSprite *image = NULL;
+ BaseFont *font = 0;
+
+ //RECT rect;
+ //BasePlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height);
+ //_hover = (!_disable && BasePlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE);
+ _hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN));
+
+ if ((_press && _hover && !_gameRef->_mouseLeftDown) ||
+ (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) {
+ press();
+ }
+
+
+ if (_disable) {
+ if (_backDisable) {
+ back = _backDisable;
+ }
+ if (_imageDisable) {
+ image = _imageDisable;
+ }
+ if (_text && _fontDisable) {
+ font = _fontDisable;
+ }
+ } else if (_press || _oneTimePress || _stayPressed) {
+ if (_backPress) {
+ back = _backPress;
+ }
+ if (_imagePress) {
+ image = _imagePress;
+ }
+ if (_text && _fontPress) {
+ font = _fontPress;
+ }
+ } else if (_hover) {
+ if (_backHover) {
+ back = _backHover;
+ }
+ if (_imageHover) {
+ image = _imageHover;
+ }
+ if (_text && _fontHover) {
+ font = _fontHover;
+ }
+ } else if (_canFocus && isFocused()) {
+ if (_backFocus) {
+ back = _backFocus;
+ }
+ if (_imageFocus) {
+ image = _imageFocus;
+ }
+ if (_text && _fontFocus) {
+ font = _fontFocus;
+ }
+ }
+
+ if (!back && _back) {
+ back = _back;
+ }
+ if (!image && _image) {
+ image = _image;
+ }
+ if (_text && !font) {
+ if (_font) {
+ font = _font;
+ } else {
+ font = _gameRef->_systemFont;
+ }
+ }
+
+ int imageX = offsetX + _posX;
+ int imageY = offsetY + _posY;
+
+ if (image && _centerImage) {
+ Rect32 rc;
+ image->getBoundingRect(&rc, 0, 0);
+ imageX += (_width - (rc.right - rc.left)) / 2;
+ imageY += (_height - (rc.bottom - rc.top)) / 2;
+ }
+
+ if (back) {
+ back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ }
+ //if (image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), NULL);
+ if (image) {
+ image->draw(imageX + ((_press || _oneTimePress) && back ? 1 : 0), imageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
+ }
+
+ if (font && _text) {
+ int text_offset = (_height - font->getTextHeight((byte *)_text, _width)) / 2;
+ font->drawText((byte *)_text, offsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), offsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align);
+ }
+
+ if (!_pixelPerfect || !_image) {
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ }
+
+ // reset unused sprites
+ if (_image && _image != image) {
+ _image->reset();
+ }
+ if (_imageDisable && _imageDisable != image) {
+ _imageDisable->reset();
+ }
+ if (_imageFocus && _imageFocus != image) {
+ _imageFocus->reset();
+ }
+ if (_imagePress && _imagePress != image) {
+ _imagePress->reset();
+ }
+ if (_imageHover && _imageHover != image) {
+ _imageHover->reset();
+ }
+
+ _press = _hover && _gameRef->_mouseLeftDown && _gameRef->_capturedObject == this;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIButton::press() {
+ applyEvent("Press");
+ if (_listenerObject) {
+ _listenerObject->listen(_listenerParamObject, _listenerParamDWORD);
+ }
+ if (_parentNotify && _parent) {
+ _parent->applyEvent(getName());
+ }
+
+ _oneTimePress = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetDisabledFont
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetDisabledFont") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (_fontDisable) {
+ _gameRef->_fontStorage->removeFont(_fontDisable);
+ }
+ if (val->isNULL()) {
+ _fontDisable = NULL;
+ stack->pushBool(true);
+ } else {
+ _fontDisable = _gameRef->_fontStorage->addFont(val->getString());
+ stack->pushBool(_fontDisable != NULL);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetHoverFont
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetHoverFont") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
+ if (val->isNULL()) {
+ _fontHover = NULL;
+ stack->pushBool(true);
+ } else {
+ _fontHover = _gameRef->_fontStorage->addFont(val->getString());
+ stack->pushBool(_fontHover != NULL);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetPressedFont
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetPressedFont") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (_fontPress) {
+ _gameRef->_fontStorage->removeFont(_fontPress);
+ }
+ if (val->isNULL()) {
+ _fontPress = NULL;
+ stack->pushBool(true);
+ } else {
+ _fontPress = _gameRef->_fontStorage->addFont(val->getString());
+ stack->pushBool(_fontPress != NULL);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetFocusedFont
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetFocusedFont") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (_fontFocus) {
+ _gameRef->_fontStorage->removeFont(_fontFocus);
+ }
+ if (val->isNULL()) {
+ _fontFocus = NULL;
+ stack->pushBool(true);
+ } else {
+ _fontFocus = _gameRef->_fontStorage->addFont(val->getString());
+ stack->pushBool(_fontFocus != NULL);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetDisabledImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetDisabledImage") == 0) {
+ stack->correctParams(1);
+
+ delete _imageDisable;
+ _imageDisable = new BaseSprite(_gameRef);
+ const char *filename = stack->pop()->getString();
+ if (!_imageDisable || DID_FAIL(_imageDisable->loadFile(filename))) {
+ delete _imageDisable;
+ _imageDisable = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetDisabledImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetDisabledImage") == 0) {
+ stack->correctParams(0);
+ if (!_imageDisable || !_imageDisable->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageDisable->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetDisabledImageObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetDisabledImageObject") == 0) {
+ stack->correctParams(0);
+ if (!_imageDisable) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageDisable, true);
+ }
+
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetHoverImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetHoverImage") == 0) {
+ stack->correctParams(1);
+
+ delete _imageHover;
+ _imageHover = new BaseSprite(_gameRef);
+ const char *filename = stack->pop()->getString();
+ if (!_imageHover || DID_FAIL(_imageHover->loadFile(filename))) {
+ delete _imageHover;
+ _imageHover = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHoverImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHoverImage") == 0) {
+ stack->correctParams(0);
+ if (!_imageHover || !_imageHover->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageHover->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetHoverImageObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHoverImageObject") == 0) {
+ stack->correctParams(0);
+ if (!_imageHover) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageHover, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetPressedImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetPressedImage") == 0) {
+ stack->correctParams(1);
+
+ delete _imagePress;
+ _imagePress = new BaseSprite(_gameRef);
+ const char *filename = stack->pop()->getString();
+ if (!_imagePress || DID_FAIL(_imagePress->loadFile(filename))) {
+ delete _imagePress;
+ _imagePress = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetPressedImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetPressedImage") == 0) {
+ stack->correctParams(0);
+ if (!_imagePress || !_imagePress->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imagePress->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetPressedImageObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetPressedImageObject") == 0) {
+ stack->correctParams(0);
+ if (!_imagePress) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imagePress, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetFocusedImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetFocusedImage") == 0) {
+ stack->correctParams(1);
+
+ delete _imageFocus;
+ _imageFocus = new BaseSprite(_gameRef);
+ const char *filename = stack->pop()->getString();
+ if (!_imageFocus || DID_FAIL(_imageFocus->loadFile(filename))) {
+ delete _imageFocus;
+ _imageFocus = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFocusedImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFocusedImage") == 0) {
+ stack->correctParams(0);
+ if (!_imageFocus || !_imageFocus->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageFocus->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetFocusedImageObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetFocusedImageObject") == 0) {
+ stack->correctParams(0);
+ if (!_imageFocus) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageFocus, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Press
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Press") == 0) {
+ stack->correctParams(0);
+
+ if (_visible && !_disable) {
+ _oneTimePress = true;
+ _oneTimePressTime = g_system->getMillis();
+ }
+ stack->pushNULL();
+
+ return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *UIButton::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("button");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextAlign
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TextAlign") {
+ _scValue->setInt(_align);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Focusable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Focusable") {
+ _scValue->setBool(_canFocus);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Pressed
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Pressed") {
+ _scValue->setBool(_stayPressed);
+ return _scValue;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // PixelPerfect
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PixelPerfect") {
+ _scValue->setBool(_pixelPerfect);
+ return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // TextAlign
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "TextAlign") == 0) {
+ int i = value->getInt();
+ if (i < 0 || i >= NUM_TEXT_ALIGN) {
+ i = 0;
+ }
+ _align = (TTextAlign)i;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Focusable
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Focusable") == 0) {
+ _canFocus = value->getBool();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Pressed
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Pressed") == 0) {
+ _stayPressed = value->getBool();
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // PixelPerfect
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PixelPerfect") == 0) {
+ _pixelPerfect = value->getBool();
+ return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *UIButton::scToString() {
+ return "[button]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIButton::persist(BasePersistenceManager *persistMgr) {
+
+ UIObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER_INT(_align));
+ persistMgr->transfer(TMEMBER(_backDisable));
+ persistMgr->transfer(TMEMBER(_backFocus));
+ persistMgr->transfer(TMEMBER(_backHover));
+ persistMgr->transfer(TMEMBER(_backPress));
+ persistMgr->transfer(TMEMBER(_centerImage));
+ persistMgr->transfer(TMEMBER(_fontDisable));
+ persistMgr->transfer(TMEMBER(_fontFocus));
+ persistMgr->transfer(TMEMBER(_fontHover));
+ persistMgr->transfer(TMEMBER(_fontPress));
+ persistMgr->transfer(TMEMBER(_hover));
+ persistMgr->transfer(TMEMBER(_image));
+ persistMgr->transfer(TMEMBER(_imageDisable));
+ persistMgr->transfer(TMEMBER(_imageFocus));
+ persistMgr->transfer(TMEMBER(_imageHover));
+ persistMgr->transfer(TMEMBER(_imagePress));
+ persistMgr->transfer(TMEMBER(_pixelPerfect));
+ persistMgr->transfer(TMEMBER(_press));
+ persistMgr->transfer(TMEMBER(_stayPressed));
+
+ if (!persistMgr->getIsSaving()) {
+ _oneTimePress = false;
+ _oneTimePressTime = 0;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
new file mode 100644
index 0000000000..93333a2534
--- /dev/null
+++ b/engines/wintermute/ui/ui_button.h
@@ -0,0 +1,80 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UIBUTTON_H
+#define WINTERMUTE_UIBUTTON_H
+
+
+#include "engines/wintermute/ui/ui_object.h"
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+
+namespace Wintermute {
+
+class UIButton : public UIObject {
+public:
+ bool _pixelPerfect;
+ bool _stayPressed;
+ bool _centerImage;
+ bool _oneTimePress;
+ uint32 _oneTimePressTime;
+ DECLARE_PERSISTENT(UIButton, UIObject)
+ void press();
+ virtual bool display() { return display(0, 0); }
+ virtual bool display(int offsetX, int offsetY);
+ bool _press;
+ bool _hover;
+ void correctSize();
+ TTextAlign _align;
+ BaseSprite *_imageHover;
+ BaseSprite *_imagePress;
+ BaseSprite *_imageDisable;
+ BaseSprite *_imageFocus;
+ BaseFont *_fontDisable;
+ BaseFont *_fontPress;
+ BaseFont *_fontHover;
+ BaseFont *_fontFocus;
+ UITiledImage *_backPress;
+ UITiledImage *_backHover;
+ UITiledImage *_backDisable;
+ UITiledImage *_backFocus;
+ UIButton(BaseGame *inGame = NULL);
+ virtual ~UIButton();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp
new file mode 100644
index 0000000000..a3283d5a01
--- /dev/null
+++ b/engines/wintermute/ui/ui_edit.cpp
@@ -0,0 +1,952 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ui/ui_edit.h"
+#include "engines/wintermute/ui/ui_object.h"
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/base_keyboard_state.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/utils/utils.h"
+#include "common/util.h"
+#include "common/keyboard.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UIEdit, false)
+
+//////////////////////////////////////////////////////////////////////////
+UIEdit::UIEdit(BaseGame *inGame) : UIObject(inGame) {
+ _type = UI_EDIT;
+
+ _fontSelected = NULL;
+
+ _selStart = _selEnd = 10000;
+ _scrollOffset = 0;
+
+ _cursorChar = NULL;
+ setCursorChar("|");
+
+ _cursorBlinkRate = 600;
+
+ _frameWidth = 0;
+
+ setText("");
+
+ _lastBlinkTime = 0;
+ _cursorVisible = true;
+
+ _maxLength = -1;
+
+ _canFocus = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UIEdit::~UIEdit() {
+ if (!_sharedFonts) {
+ if (_fontSelected) {
+ _gameRef->_fontStorage->removeFont(_fontSelected);
+ }
+ }
+
+ delete[] _cursorChar;
+ _cursorChar = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "UIEdit::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing EDIT file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(DISABLED)
+TOKEN_DEF(VISIBLE)
+TOKEN_DEF(BACK)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(FONT_SELECTED)
+TOKEN_DEF(FONT)
+TOKEN_DEF(TEXT)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(WIDTH)
+TOKEN_DEF(HEIGHT)
+TOKEN_DEF(CURSOR_BLINK_RATE)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(FRAME_WIDTH)
+TOKEN_DEF(NAME)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(PARENT_NOTIFY)
+TOKEN_DEF(MAX_LENGTH)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(EDIT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(DISABLED)
+ TOKEN_TABLE(VISIBLE)
+ TOKEN_TABLE(BACK)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(FONT_SELECTED)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(TEXT)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(WIDTH)
+ TOKEN_TABLE(HEIGHT)
+ TOKEN_TABLE(CURSOR_BLINK_RATE)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(FRAME_WIDTH)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(PARENT_NOTIFY)
+ TOKEN_TABLE(MAX_LENGTH)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(EDIT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_EDIT) {
+ _gameRef->LOG(0, "'EDIT' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_BACK:
+ delete _back;
+ _back = new UITiledImage(_gameRef);
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
+ delete _back;
+ _back = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE:
+ delete _image;
+ _image = new BaseSprite(_gameRef);
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
+ delete _image;
+ _image = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT:
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ _font = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_SELECTED:
+ if (_fontSelected) {
+ _gameRef->_fontStorage->removeFont(_fontSelected);
+ }
+ _fontSelected = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontSelected) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_TEXT:
+ setText((char *)params);
+ _gameRef->_stringTable->expand(&_text);
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_WIDTH:
+ parser.scanStr((char *)params, "%d", &_width);
+ break;
+
+ case TOKEN_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_height);
+ break;
+
+ case TOKEN_MAX_LENGTH:
+ parser.scanStr((char *)params, "%d", &_maxLength);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_CURSOR_BLINK_RATE:
+ parser.scanStr((char *)params, "%d", &_cursorBlinkRate);
+ break;
+
+ case TOKEN_FRAME_WIDTH:
+ parser.scanStr((char *)params, "%d", &_frameWidth);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PARENT_NOTIFY:
+ parser.scanStr((char *)params, "%b", &_parentNotify);
+ break;
+
+ case TOKEN_DISABLED:
+ parser.scanStr((char *)params, "%b", &_disable);
+ break;
+
+ case TOKEN_VISIBLE:
+ parser.scanStr((char *)params, "%b", &_visible);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in EDIT definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading EDIT definition");
+ return STATUS_FAILED;
+ }
+
+ correctSize();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "EDIT\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_back && _back->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ }
+
+ if (_image && _image->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ }
+
+ if (_font && _font->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
+ if (_fontSelected && _fontSelected->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_SELECTED=\"%s\"\n", _fontSelected->getFilename());
+ }
+
+ if (_cursor && _cursor->getFilename()) {
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_text) {
+ buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+ buffer->putTextIndent(indent + 2, "WIDTH=%d\n", _width);
+ buffer->putTextIndent(indent + 2, "HEIGHT=%d\n", _height);
+ buffer->putTextIndent(indent + 2, "MAX_LENGTH=%d\n", _maxLength);
+ buffer->putTextIndent(indent + 2, "CURSOR_BLINK_RATE=%d\n", _cursorBlinkRate);
+ buffer->putTextIndent(indent + 2, "FRAME_WIDTH=%d\n", _frameWidth);
+
+ buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PARENT_NOTIFY=%s\n", _parentNotify ? "TRUE" : "FALSE");
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetSelectedFont
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetSelectedFont") == 0) {
+ stack->correctParams(1);
+
+ if (_fontSelected) {
+ _gameRef->_fontStorage->removeFont(_fontSelected);
+ }
+ _fontSelected = _gameRef->_fontStorage->addFont(stack->pop()->getString());
+ stack->pushBool(_fontSelected != NULL);
+
+ return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *UIEdit::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("editor");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SelStart
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SelStart") {
+ _scValue->setInt(_selStart);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SelEnd
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SelEnd") {
+ _scValue->setInt(_selEnd);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorBlinkRate
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CursorBlinkRate") {
+ _scValue->setInt(_cursorBlinkRate);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorChar
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "CursorChar") {
+ _scValue->setString(_cursorChar);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FrameWidth
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "FrameWidth") {
+ _scValue->setInt(_frameWidth);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MaxLength
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "MaxLength") {
+ _scValue->setInt(_maxLength);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Text
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Text") {
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ WideString wstr = StringUtil::ansiToWide(_text);
+ _scValue->setString(StringUtil::wideToUtf8(wstr).c_str());
+ } else {
+ _scValue->setString(_text);
+ }
+ return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // SelStart
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SelStart") == 0) {
+ _selStart = value->getInt();
+ _selStart = MAX(_selStart, 0);
+ _selStart = (int)MIN((size_t)_selStart, strlen(_text));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SelEnd
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SelEnd") == 0) {
+ _selEnd = value->getInt();
+ _selEnd = MAX(_selEnd, 0);
+ _selEnd = (int)MIN((size_t)_selEnd, strlen(_text));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorBlinkRate
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CursorBlinkRate") == 0) {
+ _cursorBlinkRate = (uint32)value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CursorChar
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CursorChar") == 0) {
+ setCursorChar(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FrameWidth
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FrameWidth") == 0) {
+ _frameWidth = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MaxLength
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MaxLength") == 0) {
+ _maxLength = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Text
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Text") == 0) {
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ WideString wstr = StringUtil::utf8ToWide(value->getString());
+ setText(StringUtil::wideToAnsi(wstr).c_str());
+ } else {
+ setText(value->getString());
+ }
+ return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *UIEdit::scToString() {
+ return "[edit]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIEdit::setCursorChar(const char *character) {
+ if (!character) {
+ return;
+ }
+ delete[] _cursorChar;
+ _cursorChar = new char [strlen(character) + 1];
+ if (_cursorChar) {
+ strcpy(_cursorChar, character);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::display(int offsetX, int offsetY) {
+ if (!_visible) {
+ return STATUS_OK;
+ }
+
+
+ // hack!
+ TTextEncoding OrigEncoding = _gameRef->_textEncoding;
+ _gameRef->_textEncoding = TEXT_ANSI;
+
+ if (_back) {
+ _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ }
+ if (_image) {
+ _image->draw(offsetX + _posX, offsetY + _posY, NULL);
+ }
+
+ // prepare fonts
+ BaseFont *font;
+ BaseFont *sfont;
+
+ if (_font) {
+ font = _font;
+ } else {
+ font = _gameRef->_systemFont;
+ }
+
+ if (_fontSelected) {
+ sfont = _fontSelected;
+ } else {
+ sfont = font;
+ }
+
+ bool focused = isFocused();
+
+ _selStart = MAX(_selStart, 0);
+ _selEnd = MAX(_selEnd, 0);
+
+ _selStart = (int)MIN((size_t)_selStart, strlen(_text));
+ _selEnd = (int)MIN((size_t)_selEnd, strlen(_text));
+
+ //int CursorWidth = font->GetCharWidth(_cursorChar[0]);
+ int cursorWidth = font->getTextWidth((byte *)_cursorChar);
+
+ int s1, s2;
+ bool curFirst;
+ // modify scroll offset
+ if (_selStart >= _selEnd) {
+ while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selEnd - _scrollOffset)) > _width - cursorWidth - 2 * _frameWidth) {
+ _scrollOffset++;
+ if (_scrollOffset >= (int)strlen(_text)) {
+ break;
+ }
+ }
+
+ _scrollOffset = MIN(_scrollOffset, _selEnd);
+
+ s1 = _selEnd;
+ s2 = _selStart;
+ curFirst = true;
+ } else {
+ while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selStart - _scrollOffset)) +
+ sfont->getTextWidth((byte *)(_text + MAX(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart))
+
+ > _width - cursorWidth - 2 * _frameWidth) {
+ _scrollOffset++;
+ if (_scrollOffset >= (int)strlen(_text)) {
+ break;
+ }
+ }
+
+ _scrollOffset = MIN(_scrollOffset, _selEnd);
+
+ s1 = _selStart;
+ s2 = _selEnd;
+ curFirst = false;
+ }
+
+
+ int alignOffset = 0;
+
+ for (int count = 0; count < 2; count++) {
+ // draw text
+ int xxx, yyy, width, height;
+
+ xxx = _posX + _frameWidth + offsetX;
+ yyy = _posY + _frameWidth + offsetY;
+
+ width = _posX + _width + offsetX - _frameWidth;
+ height = MAX(font->getLetterHeight(), sfont->getLetterHeight());
+
+ if (_gameRef->_textRTL) {
+ xxx += alignOffset;
+ }
+
+ TTextAlign align = TAL_LEFT;
+
+
+ // unselected 1
+ if (s1 > _scrollOffset) {
+ if (count) {
+ font->drawText((byte *)_text + _scrollOffset, xxx, yyy, width - xxx, align, height, s1 - _scrollOffset);
+ }
+ xxx += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
+ alignOffset += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
+ }
+
+ // cursor
+ if (focused && curFirst) {
+ if (count) {
+ if (g_system->getMillis() - _lastBlinkTime >= _cursorBlinkRate) {
+ _lastBlinkTime = g_system->getMillis();
+ _cursorVisible = !_cursorVisible;
+ }
+ if (_cursorVisible) {
+ font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, align, height, 1);
+ }
+ }
+ xxx += cursorWidth;
+ alignOffset += cursorWidth;
+ }
+
+ // selected
+ int s3 = MAX(s1, _scrollOffset);
+
+ if (s2 - s3 > 0) {
+ if (count) {
+ sfont->drawText((byte *)_text + s3, xxx, yyy, width - xxx, align, height, s2 - s3);
+ }
+ xxx += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
+ alignOffset += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
+ }
+
+ // cursor
+ if (focused && !curFirst) {
+ if (count) {
+ if (g_system->getMillis() - _lastBlinkTime >= _cursorBlinkRate) {
+ _lastBlinkTime = g_system->getMillis();
+ _cursorVisible = !_cursorVisible;
+ }
+ if (_cursorVisible) {
+ font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, align, height, 1);
+ }
+ }
+ xxx += cursorWidth;
+ alignOffset += cursorWidth;
+ }
+
+ // unselected 2
+ if (count) {
+ font->drawText((byte *)_text + s2, xxx, yyy, width - xxx, align, height);
+ }
+ alignOffset += font->getTextWidth((byte *)_text + s2);
+
+ alignOffset = (_width - 2 * _frameWidth) - alignOffset;
+ if (alignOffset < 0) {
+ alignOffset = 0;
+ }
+ }
+
+
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+
+
+ _gameRef->_textEncoding = OrigEncoding;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
+ bool handled = false;
+
+ if (event->type == Common::EVENT_KEYDOWN && !printable) {
+ switch (event->kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ case Common::KEYCODE_TAB:
+ case Common::KEYCODE_RETURN:
+ return false;
+
+ // ctrl+A
+ case Common::KEYCODE_a:
+ if (BaseKeyboardState::isControlDown()) {
+ _selStart = 0;
+ _selEnd = strlen(_text);
+ handled = true;
+ }
+ break;
+
+ case Common::KEYCODE_BACKSPACE:
+ if (_selStart == _selEnd) {
+ if (_gameRef->_textRTL) {
+ deleteChars(_selStart, _selStart + 1);
+ } else {
+ deleteChars(_selStart - 1, _selStart);
+ }
+ } else {
+ deleteChars(_selStart, _selEnd);
+ }
+ if (_selEnd >= _selStart) {
+ _selEnd -= MAX(1, _selEnd - _selStart);
+ }
+ _selStart = _selEnd;
+
+ handled = true;
+ break;
+
+ case Common::KEYCODE_LEFT:
+ case Common::KEYCODE_UP:
+ _selEnd--;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
+ handled = true;
+ break;
+
+ case Common::KEYCODE_RIGHT:
+ case Common::KEYCODE_DOWN:
+ _selEnd++;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
+ handled = true;
+ break;
+
+ case Common::KEYCODE_HOME:
+ if (_gameRef->_textRTL) {
+ _selEnd = strlen(_text);
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
+ } else {
+ _selEnd = 0;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
+ }
+ handled = true;
+ break;
+
+ case Common::KEYCODE_END:
+ if (_gameRef->_textRTL) {
+ _selEnd = 0;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
+ } else {
+ _selEnd = strlen(_text);
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
+ }
+ handled = true;
+ break;
+
+ case Common::KEYCODE_DELETE:
+ if (_selStart == _selEnd) {
+ if (_gameRef->_textRTL) {
+ deleteChars(_selStart - 1, _selStart);
+ _selEnd--;
+ if (_selEnd < 0) {
+ _selEnd = 0;
+ }
+ } else {
+ deleteChars(_selStart, _selStart + 1);
+ }
+ } else {
+ deleteChars(_selStart, _selEnd);
+ }
+ if (_selEnd > _selStart) {
+ _selEnd -= (_selEnd - _selStart);
+ }
+
+ _selStart = _selEnd;
+ handled = true;
+ break;
+ default:
+ break;
+ }
+ return handled;
+ } else if (event->type == Common::EVENT_KEYDOWN && printable) {
+ if (_selStart != _selEnd) {
+ deleteChars(_selStart, _selEnd);
+ }
+
+ //WideString wstr = StringUtil::Utf8ToWide(event->kbd.ascii);
+ WideString wstr;
+ wstr += (char)event->kbd.ascii;
+ _selEnd += insertChars(_selEnd, (const byte *)StringUtil::wideToAnsi(wstr).c_str(), 1);
+
+ if (_gameRef->_textRTL) {
+ _selEnd = _selStart;
+ } else {
+ _selStart = _selEnd;
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+int UIEdit::deleteChars(int start, int end) {
+ if (start > end) {
+ BaseUtils::swap(&start, &end);
+ }
+
+ start = MAX(start, (int)0);
+ end = MIN((size_t)end, strlen(_text));
+
+ char *str = new char[strlen(_text) - (end - start) + 1];
+ if (str) {
+ if (start > 0) {
+ memcpy(str, _text, start);
+ }
+ memcpy(str + MAX(0, start), _text + end, strlen(_text) - end + 1);
+
+ delete[] _text;
+ _text = str;
+ }
+ if (_parentNotify && _parent) {
+ _parent->applyEvent(getName());
+ }
+
+ return end - start;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int UIEdit::insertChars(int pos, const byte *chars, int num) {
+ if ((int)strlen(_text) + num > _maxLength) {
+ num -= (strlen(_text) + num - _maxLength);
+ }
+
+ pos = MAX(pos, (int)0);
+ pos = MIN((size_t)pos, strlen(_text));
+
+ char *str = new char[strlen(_text) + num + 1];
+ if (str) {
+ if (pos > 0) {
+ memcpy(str, _text, pos);
+ }
+ memcpy(str + pos + num, _text + pos, strlen(_text) - pos + 1);
+
+ memcpy(str + pos, chars, num);
+
+ delete[] _text;
+ _text = str;
+ }
+ if (_parentNotify && _parent) {
+ _parent->applyEvent(getName());
+ }
+
+ return num;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEdit::persist(BasePersistenceManager *persistMgr) {
+
+ UIObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_cursorBlinkRate));
+ persistMgr->transfer(TMEMBER(_cursorChar));
+ persistMgr->transfer(TMEMBER(_fontSelected));
+ persistMgr->transfer(TMEMBER(_frameWidth));
+ persistMgr->transfer(TMEMBER(_maxLength));
+ persistMgr->transfer(TMEMBER(_scrollOffset));
+ persistMgr->transfer(TMEMBER(_selEnd));
+ persistMgr->transfer(TMEMBER(_selStart));
+
+ if (!persistMgr->getIsSaving()) {
+ _cursorVisible = false;
+ _lastBlinkTime = 0;
+ }
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h
new file mode 100644
index 0000000000..5bb31422b6
--- /dev/null
+++ b/engines/wintermute/ui/ui_edit.h
@@ -0,0 +1,72 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UIEDIT_H
+#define WINTERMUTE_UIEDIT_H
+
+#include "engines/wintermute/persistent.h"
+#include "engines/wintermute/ui/ui_object.h"
+#include "common/events.h"
+
+namespace Wintermute {
+class BaseFont;
+class UIEdit : public UIObject {
+public:
+ DECLARE_PERSISTENT(UIEdit, UIObject)
+ int _maxLength;
+ int insertChars(int pos, const byte *chars, int num);
+ int deleteChars(int start, int end);
+ bool _cursorVisible;
+ uint32 _lastBlinkTime;
+ virtual bool display(int offsetX, int offsetY);
+ virtual bool handleKeypress(Common::Event *event, bool printable = false);
+ int _scrollOffset;
+ int _frameWidth;
+ uint32 _cursorBlinkRate;
+ void setCursorChar(const char *character);
+ char *_cursorChar;
+ int _selEnd;
+ int _selStart;
+ BaseFont *_fontSelected;
+ UIEdit(BaseGame *inGame);
+ virtual ~UIEdit();
+
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp
new file mode 100644
index 0000000000..1cb4e0926b
--- /dev/null
+++ b/engines/wintermute/ui/ui_entity.cpp
@@ -0,0 +1,366 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ad/ad_entity.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/ui/ui_entity.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UIEntity, false)
+
+//////////////////////////////////////////////////////////////////////////
+UIEntity::UIEntity(BaseGame *inGame) : UIObject(inGame) {
+ _type = UI_CUSTOM;
+ _entity = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UIEntity::~UIEntity() {
+ if (_entity) {
+ _gameRef->unregisterObject(_entity);
+ }
+ _entity = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "UIEntity::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing ENTITY container file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(ENTITY_CONTAINER)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(DISABLED)
+TOKEN_DEF(VISIBLE)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(NAME)
+TOKEN_DEF(ENTITY)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(ENTITY_CONTAINER)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(DISABLED)
+ TOKEN_TABLE(VISIBLE)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(ENTITY)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY_CONTAINER) {
+ _gameRef->LOG(0, "'ENTITY_CONTAINER' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_DISABLED:
+ parser.scanStr((char *)params, "%b", &_disable);
+ break;
+
+ case TOKEN_VISIBLE:
+ parser.scanStr((char *)params, "%b", &_visible);
+ break;
+
+ case TOKEN_ENTITY:
+ if (DID_FAIL(setEntity((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in ENTITY_CONTAINER definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading ENTITY_CONTAINER definition");
+ return STATUS_FAILED;
+ }
+
+ correctSize();
+
+ if (_gameRef->_editorMode) {
+ _width = 50;
+ _height = 50;
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "ENTITY_CONTAINER\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+
+ buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
+
+ if (_entity && _entity->getFilename()) {
+ buffer->putTextIndent(indent + 2, "ENTITY=\"%s\"\n", _entity->getFilename());
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::setEntity(const char *filename) {
+ if (_entity) {
+ _gameRef->unregisterObject(_entity);
+ }
+ _entity = new AdEntity(_gameRef);
+ if (!_entity || DID_FAIL(_entity->loadFile(filename))) {
+ delete _entity;
+ _entity = NULL;
+ return STATUS_FAILED;
+ } else {
+ _entity->_nonIntMouseEvents = true;
+ _entity->_sceneIndependent = true;
+ _entity->makeFreezable(false);
+ _gameRef->registerObject(_entity);
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::display(int offsetX, int offsetY) {
+ if (!_visible) {
+ return STATUS_OK;
+ }
+
+ if (_entity) {
+ _entity->_posX = offsetX + _posX;
+ _entity->_posY = offsetY + _posY;
+ if (_entity->_scale < 0) {
+ _entity->_zoomable = false;
+ }
+ _entity->_shadowable = false;
+
+ _entity->update();
+
+ bool origReg = _entity->_registrable;
+
+ if (_entity->_registrable && _disable) {
+ _entity->_registrable = false;
+ }
+
+ _entity->display();
+ _entity->_registrable = origReg;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // GetEntity
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetEntity") == 0) {
+ stack->correctParams(0);
+
+ if (_entity) {
+ stack->pushNative(_entity, true);
+ } else {
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetEntity
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetEntity") == 0) {
+ stack->correctParams(1);
+
+ const char *filename = stack->pop()->getString();
+
+ if (DID_SUCCEED(setEntity(filename))) {
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *UIEntity::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("entity container");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Freezable
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Freezable") {
+ if (_entity) {
+ _scValue->setBool(_entity->_freezable);
+ } else {
+ _scValue->setBool(false);
+ }
+ return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Freezable
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Freezable") == 0) {
+ if (_entity) {
+ _entity->makeFreezable(value->getBool());
+ }
+ return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *UIEntity::scToString() {
+ return "[entity container]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIEntity::persist(BasePersistenceManager *persistMgr) {
+
+ UIObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_entity));
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h
new file mode 100644
index 0000000000..b5f4450071
--- /dev/null
+++ b/engines/wintermute/ui/ui_entity.h
@@ -0,0 +1,59 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UIENTITY_H
+#define WINTERMUTE_UIENTITY_H
+
+#include "engines/wintermute/ui/ui_object.h"
+
+namespace Wintermute {
+class AdEntity;
+class UIEntity : public UIObject {
+public:
+ DECLARE_PERSISTENT(UIEntity, UIObject)
+ UIEntity(BaseGame *inGame);
+ virtual ~UIEntity();
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ virtual bool display() { return display(0, 0); }
+ virtual bool display(int offsetX, int offsetY);
+ AdEntity *_entity;
+ bool setEntity(const char *filename);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
new file mode 100644
index 0000000000..8e5bae993c
--- /dev/null
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -0,0 +1,651 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/ui/ui_object.h"
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UIObject, false)
+
+//////////////////////////////////////////////////////////////////////////
+UIObject::UIObject(BaseGame *inGame) : BaseObject(inGame) {
+ _back = NULL;
+ _image = NULL;
+ _font = NULL;
+ _text = NULL;
+ _sharedFonts = _sharedImages = false;
+
+ _width = _height = 0;
+
+ _listenerObject = NULL;
+ _listenerParamObject = NULL;
+ _listenerParamDWORD = 0;
+
+ _disable = false;
+ _visible = true;
+
+ _type = UI_UNKNOWN;
+ _parent = NULL;
+
+ _parentNotify = false;
+
+ _focusedWidget = NULL;
+
+ _canFocus = false;
+ _nonIntMouseEvents = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UIObject::~UIObject() {
+ if (!_gameRef->_loadInProgress) {
+ SystemClassRegistry::getInstance()->enumInstances(BaseGame::invalidateValues, "ScValue", (void *)this);
+ }
+
+ if (_back) {
+ delete _back;
+ }
+ if (_font && !_sharedFonts) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+
+ if (_image && !_sharedImages) {
+ delete _image;
+ }
+
+ if (_text) {
+ delete[] _text;
+ }
+
+ _focusedWidget = NULL; // ref only
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIObject::setText(const char *text) {
+ if (_text) {
+ delete[] _text;
+ }
+ _text = new char [strlen(text) + 1];
+ if (_text) {
+ strcpy(_text, text);
+ for (uint32 i = 0; i < strlen(_text); i++) {
+ if (_text[i] == '|') {
+ _text[i] = '\n';
+ }
+ }
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::display(int offsetX, int offsetY) {
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIObject::setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam) {
+ _listenerObject = object;
+ _listenerParamObject = listenerObject;
+ _listenerParamDWORD = listenerParam;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIObject::correctSize() {
+ Rect32 rect;
+
+ if (_width <= 0) {
+ if (_image) {
+ _image->getBoundingRect(&rect, 0, 0);
+ _width = rect.right - rect.left;
+ } else {
+ _width = 100;
+ }
+ }
+
+ if (_height <= 0) {
+ if (_image) {
+ _image->getBoundingRect(&rect, 0, 0);
+ _height = rect.bottom - rect.top;
+ }
+ }
+
+ if (_back) {
+ _back->correctSize(&_width, &_height);
+ }
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SetFont
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SetFont") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ if (val->isNULL()) {
+ _font = NULL;
+ stack->pushBool(true);
+ } else {
+ _font = _gameRef->_fontStorage->addFont(val->getString());
+ stack->pushBool(_font != NULL);
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetImage") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ /* const char *filename = */ val->getString();
+
+ delete _image;
+ _image = NULL;
+ if (val->isNULL()) {
+ stack->pushBool(true);
+ return STATUS_OK;
+ }
+
+ _image = new BaseSprite(_gameRef);
+ if (!_image || DID_FAIL(_image->loadFile(val->getString()))) {
+ delete _image;
+ _image = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetImage") == 0) {
+ stack->correctParams(0);
+ if (!_image || !_image->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_image->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetImageObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetImageObject") == 0) {
+ stack->correctParams(0);
+ if (!_image) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_image, true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Focus
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Focus") == 0) {
+ stack->correctParams(0);
+ focus();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveAfter / MoveBefore
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MoveAfter") == 0 || strcmp(name, "MoveBefore") == 0) {
+ stack->correctParams(1);
+
+ if (_parent && _parent->_type == UI_WINDOW) {
+ UIWindow *win = (UIWindow *)_parent;
+
+ uint32 i;
+ bool found = false;
+ ScValue *val = stack->pop();
+ // find directly
+ if (val->isNative()) {
+ UIObject *widget = (UIObject *)val->getNative();
+ for (i = 0; i < win->_widgets.size(); i++) {
+ if (win->_widgets[i] == widget) {
+ found = true;
+ break;
+ }
+ }
+ }
+ // find by name
+ else {
+ const char *findName = val->getString();
+ for (i = 0; i < win->_widgets.size(); i++) {
+ if (scumm_stricmp(win->_widgets[i]->getName(), findName) == 0) {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if (found) {
+ bool done = false;
+ for (uint32 j = 0; j < win->_widgets.size(); j++) {
+ if (win->_widgets[j] == this) {
+ if (strcmp(name, "MoveAfter") == 0) {
+ i++;
+ }
+ if (j >= i) {
+ j++;
+ }
+
+ win->_widgets.insert_at(i, this);
+ win->_widgets.remove_at(j);
+
+ done = true;
+ stack->pushBool(true);
+ break;
+ }
+ }
+ if (!done) {
+ stack->pushBool(false);
+ }
+ } else {
+ stack->pushBool(false);
+ }
+
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveToBottom
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MoveToBottom") == 0) {
+ stack->correctParams(0);
+
+ if (_parent && _parent->_type == UI_WINDOW) {
+ UIWindow *win = (UIWindow *)_parent;
+ for (uint32 i = 0; i < win->_widgets.size(); i++) {
+ if (win->_widgets[i] == this) {
+ win->_widgets.remove_at(i);
+ win->_widgets.insert_at(0, this);
+ break;
+ }
+ }
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // MoveToTop
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "MoveToTop") == 0) {
+ stack->correctParams(0);
+
+ if (_parent && _parent->_type == UI_WINDOW) {
+ UIWindow *win = (UIWindow *)_parent;
+ for (uint32 i = 0; i < win->_widgets.size(); i++) {
+ if (win->_widgets[i] == this) {
+ win->_widgets.remove_at(i);
+ win->_widgets.add(this);
+ break;
+ }
+ }
+ stack->pushBool(true);
+ } else {
+ stack->pushBool(false);
+ }
+
+ return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *UIObject::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("ui_object");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Name") {
+ _scValue->setString(getName());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Parent (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Parent") {
+ _scValue->setNative(_parent, true);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ParentNotify
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ParentNotify") {
+ _scValue->setBool(_parentNotify);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Width
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Width") {
+ _scValue->setInt(_width);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Height
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Height") {
+ _scValue->setInt(_height);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Visible
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Visible") {
+ _scValue->setBool(_visible);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Disabled
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Disabled") {
+ _scValue->setBool(_disable);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Text
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Text") {
+ _scValue->setString(_text);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NextSibling (RO) / PrevSibling (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NextSibling" || name == "PrevSibling") {
+ _scValue->setNULL();
+ if (_parent && _parent->_type == UI_WINDOW) {
+ UIWindow *win = (UIWindow *)_parent;
+ for (uint32 i = 0; i < win->_widgets.size(); i++) {
+ if (win->_widgets[i] == this) {
+ if (name == "NextSibling") {
+ if (i < win->_widgets.size() - 1) {
+ _scValue->setNative(win->_widgets[i + 1], true);
+ }
+ } else {
+ if (i > 0) {
+ _scValue->setNative(win->_widgets[i - 1], true);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ParentNotify
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ParentNotify") == 0) {
+ _parentNotify = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Width
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Width") == 0) {
+ _width = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Height
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Height") == 0) {
+ _height = value->getInt();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Visible
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Visible") == 0) {
+ _visible = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Disabled
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Disabled") == 0) {
+ _disable = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Text
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Text") == 0) {
+ setText(value->getString());
+ return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *UIObject::scToString() {
+ return "[ui_object]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::isFocused() {
+ if (!_gameRef->_focusedWindow) {
+ return false;
+ }
+ if (_gameRef->_focusedWindow == this) {
+ return true;
+ }
+
+ UIObject *obj = _gameRef->_focusedWindow;
+ while (obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ obj = obj->_focusedWidget;
+ }
+ }
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::handleMouse(TMouseEvent event, TMouseButton button) {
+ // handle focus change
+ if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) {
+ focus();
+ }
+ return BaseObject::handleMouse(event, button);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::focus() {
+ UIObject *obj = this;
+ bool disabled = false;
+ while (obj) {
+ if (obj->_disable && obj->_type == UI_WINDOW) {
+ disabled = true;
+ break;
+ }
+ obj = obj->_parent;
+ }
+ if (!disabled) {
+ obj = this;
+ while (obj) {
+ if (obj->_parent) {
+ if (!obj->_disable && obj->_canFocus) {
+ obj->_parent->_focusedWidget = obj;
+ }
+ } else {
+ if (obj->_type == UI_WINDOW) {
+ _gameRef->focusWindow((UIWindow *)obj);
+ }
+ }
+
+ obj = obj->_parent;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::getTotalOffset(int *offsetX, int *offsetY) {
+ int offX = 0, offY = 0;
+
+ UIObject *obj = _parent;
+ while (obj) {
+ offX += obj->_posX;
+ offY += obj->_posY;
+
+ obj = obj->_parent;
+ }
+ if (offsetX) {
+ *offsetX = offX;
+ }
+ if (offsetY) {
+ *offsetY = offY;
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::persist(BasePersistenceManager *persistMgr) {
+
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_back));
+ persistMgr->transfer(TMEMBER(_canFocus));
+ persistMgr->transfer(TMEMBER(_disable));
+ persistMgr->transfer(TMEMBER(_focusedWidget));
+ persistMgr->transfer(TMEMBER(_font));
+ persistMgr->transfer(TMEMBER(_height));
+ persistMgr->transfer(TMEMBER(_image));
+ persistMgr->transfer(TMEMBER(_listenerObject));
+ persistMgr->transfer(TMEMBER(_listenerParamObject));
+ persistMgr->transfer(TMEMBER(_listenerParamDWORD));
+ persistMgr->transfer(TMEMBER(_parent));
+ persistMgr->transfer(TMEMBER(_parentNotify));
+ persistMgr->transfer(TMEMBER(_sharedFonts));
+ persistMgr->transfer(TMEMBER(_sharedImages));
+ persistMgr->transfer(TMEMBER(_text));
+ persistMgr->transfer(TMEMBER_INT(_type));
+ persistMgr->transfer(TMEMBER(_visible));
+ persistMgr->transfer(TMEMBER(_width));
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ return STATUS_FAILED;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
new file mode 100644
index 0000000000..ec2ea33de1
--- /dev/null
+++ b/engines/wintermute/ui/ui_object.h
@@ -0,0 +1,85 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UIOBJECT_H
+#define WINTERMUTE_UIOBJECT_H
+
+
+#include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+
+namespace Wintermute {
+
+class UITiledImage;
+class BaseFont;
+class UIObject : public BaseObject {
+public:
+
+ bool getTotalOffset(int *offsetX, int *offsetY);
+ bool _canFocus;
+ bool focus();
+ virtual bool handleMouse(TMouseEvent event, TMouseButton button);
+ bool isFocused();
+ bool _parentNotify;
+ DECLARE_PERSISTENT(UIObject, BaseObject)
+ UIObject *_parent;
+ virtual bool display() { return display(0, 0); }
+ virtual bool display(int offsetX) { return display(offsetX, 0); }
+ virtual bool display(int offsetX, int offsetY);
+ virtual void correctSize();
+ bool _sharedFonts;
+ bool _sharedImages;
+ void setText(const char *text);
+ char *_text;
+ BaseFont *_font;
+ bool _visible;
+ UITiledImage *_back;
+ bool _disable;
+ UIObject(BaseGame *inGame = NULL);
+ virtual ~UIObject();
+ int _width;
+ int _height;
+ TUIObjectType _type;
+ BaseSprite *_image;
+ void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
+ BaseScriptHolder *_listenerParamObject;
+ uint32 _listenerParamDWORD;
+ BaseScriptHolder *_listenerObject;
+ UIObject *_focusedWidget;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp
new file mode 100644
index 0000000000..2c10f176c7
--- /dev/null
+++ b/engines/wintermute/ui/ui_text.cpp
@@ -0,0 +1,522 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/ui/ui_text.h"
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UIText, false)
+
+//////////////////////////////////////////////////////////////////////////
+UIText::UIText(BaseGame *inGame) : UIObject(inGame) {
+ _textAlign = TAL_LEFT;
+ _verticalAlign = VAL_CENTER;
+ _type = UI_STATIC;
+ _canFocus = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UIText::~UIText() {
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIText::display(int offsetX, int offsetY) {
+ if (!_visible) {
+ return STATUS_OK;
+ }
+
+
+ BaseFont *font = _font;
+ if (!font) {
+ font = _gameRef->_systemFont;
+ }
+
+ if (_back) {
+ _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ }
+ if (_image) {
+ _image->draw(offsetX + _posX, offsetY + _posY, NULL);
+ }
+
+ if (font && _text) {
+ int textOffset;
+ switch (_verticalAlign) {
+ case VAL_TOP:
+ textOffset = 0;
+ break;
+ case VAL_BOTTOM:
+ textOffset = _height - font->getTextHeight((byte *)_text, _width);
+ break;
+ default:
+ textOffset = (_height - font->getTextHeight((byte *)_text, _width)) / 2;
+ }
+ font->drawText((byte *)_text, offsetX + _posX, offsetY + _posY + textOffset, _width, _textAlign, _height);
+ }
+
+ //_gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
+
+ return STATUS_OK;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIText::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "UIText::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing STATIC file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(STATIC)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(DISABLED)
+TOKEN_DEF(VISIBLE)
+TOKEN_DEF(BACK)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(FONT)
+TOKEN_DEF(TEXT_ALIGN)
+TOKEN_DEF(VERTICAL_ALIGN)
+TOKEN_DEF(TEXT)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(WIDTH)
+TOKEN_DEF(HEIGHT)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(NAME)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PARENT_NOTIFY)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool UIText::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(STATIC)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(DISABLED)
+ TOKEN_TABLE(VISIBLE)
+ TOKEN_TABLE(BACK)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(TEXT_ALIGN)
+ TOKEN_TABLE(VERTICAL_ALIGN)
+ TOKEN_TABLE(TEXT)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(WIDTH)
+ TOKEN_TABLE(HEIGHT)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PARENT_NOTIFY)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_STATIC) {
+ _gameRef->LOG(0, "'STATIC' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_BACK:
+ delete _back;
+ _back = new UITiledImage(_gameRef);
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
+ delete _back;
+ _back = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE:
+ delete _image;
+ _image = new BaseSprite(_gameRef);
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
+ delete _image;
+ _image = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT:
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ _font = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_TEXT:
+ setText((char *)params);
+ _gameRef->_stringTable->expand(&_text);
+ break;
+
+ case TOKEN_TEXT_ALIGN:
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _textAlign = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _textAlign = TAL_RIGHT;
+ } else {
+ _textAlign = TAL_CENTER;
+ }
+ break;
+
+ case TOKEN_VERTICAL_ALIGN:
+ if (scumm_stricmp((char *)params, "top") == 0) {
+ _verticalAlign = VAL_TOP;
+ } else if (scumm_stricmp((char *)params, "bottom") == 0) {
+ _verticalAlign = VAL_BOTTOM;
+ } else {
+ _verticalAlign = VAL_CENTER;
+ }
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_WIDTH:
+ parser.scanStr((char *)params, "%d", &_width);
+ break;
+
+ case TOKEN_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_height);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PARENT_NOTIFY:
+ parser.scanStr((char *)params, "%b", &_parentNotify);
+ break;
+
+ case TOKEN_DISABLED:
+ parser.scanStr((char *)params, "%b", &_disable);
+ break;
+
+ case TOKEN_VISIBLE:
+ parser.scanStr((char *)params, "%b", &_visible);
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in STATIC definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading STATIC definition");
+ return STATUS_FAILED;
+ }
+
+ correctSize();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIText::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "STATIC\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_back && _back->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ }
+
+ if (_image && _image->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ }
+
+ if (_font && _font->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
+
+ if (_cursor && _cursor->getFilename()) {
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
+
+ if (_text) {
+ buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
+ }
+
+ switch (_textAlign) {
+ case TAL_LEFT:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "left");
+ break;
+ case TAL_RIGHT:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "right");
+ break;
+ case TAL_CENTER:
+ buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
+ break;
+ default:
+ error("UIText::SaveAsText - Unhandled enum");
+ break;
+ }
+
+ switch (_verticalAlign) {
+ case VAL_TOP:
+ buffer->putTextIndent(indent + 2, "VERTICAL_ALIGN=\"%s\"\n", "top");
+ break;
+ case VAL_BOTTOM:
+ buffer->putTextIndent(indent + 2, "VERTICAL_ALIGN=\"%s\"\n", "bottom");
+ break;
+ case VAL_CENTER:
+ buffer->putTextIndent(indent + 2, "VERTICAL_ALIGN=\"%s\"\n", "center");
+ break;
+ default:
+ error("UIText::SaveAsText - Unhandled enum value: NUM_VERTICAL_ALIGN");
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+ buffer->putTextIndent(indent + 2, "WIDTH=%d\n", _width);
+ buffer->putTextIndent(indent + 2, "HEIGHT=%d\n", _height);
+
+ buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PARENT_NOTIFY=%s\n", _parentNotify ? "TRUE" : "FALSE");
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool UIText::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // SizeToFit
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "SizeToFit") == 0) {
+ stack->correctParams(0);
+ sizeToFit();
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // HeightToFit
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "HeightToFit") == 0) {
+ stack->correctParams(0);
+ if (_font && _text) {
+ _height = _font->getTextHeight((byte *)_text, _width);
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *UIText::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("static");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // TextAlign
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "TextAlign") {
+ _scValue->setInt(_textAlign);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // VerticalAlign
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "VerticalAlign") {
+ _scValue->setInt(_verticalAlign);
+ return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIText::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // TextAlign
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "TextAlign") == 0) {
+ int i = value->getInt();
+ if (i < 0 || i >= NUM_TEXT_ALIGN) {
+ i = 0;
+ }
+ _textAlign = (TTextAlign)i;
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // VerticalAlign
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "VerticalAlign") == 0) {
+ int i = value->getInt();
+ if (i < 0 || i >= NUM_VERTICAL_ALIGN) {
+ i = 0;
+ }
+ _verticalAlign = (TVerticalAlign)i;
+ return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *UIText::scToString() {
+ return "[static]";
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIText::persist(BasePersistenceManager *persistMgr) {
+
+ UIObject::persist(persistMgr);
+ persistMgr->transfer(TMEMBER_INT(_textAlign));
+ persistMgr->transfer(TMEMBER_INT(_verticalAlign));
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIText::sizeToFit() {
+ if (_font && _text) {
+ _width = _font->getTextWidth((byte *)_text);
+ _height = _font->getTextHeight((byte *)_text, _width);
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h
new file mode 100644
index 0000000000..da4d113500
--- /dev/null
+++ b/engines/wintermute/ui/ui_text.h
@@ -0,0 +1,60 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UITEXT_H
+#define WINTERMUTE_UITEXT_H
+
+
+#include "engines/wintermute/ui/ui_object.h"
+
+namespace Wintermute {
+
+class UIText : public UIObject {
+private:
+ bool sizeToFit();
+public:
+ virtual bool display(int offsetX, int offsetY);
+ DECLARE_PERSISTENT(UIText, UIObject)
+ UIText(BaseGame *inGame = NULL);
+ virtual ~UIText();
+ TTextAlign _textAlign;
+ TVerticalAlign _verticalAlign;
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp
new file mode 100644
index 0000000000..2b337330c7
--- /dev/null
+++ b/engines/wintermute/ui/ui_tiled_image.cpp
@@ -0,0 +1,394 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_sub_frame.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/platform_osystem.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UITiledImage, false)
+
+//////////////////////////////////////////////////////////////////////////
+UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) {
+ _image = NULL;
+
+ BasePlatform::setRectEmpty(&_upLeft);
+ BasePlatform::setRectEmpty(&_upMiddle);
+ BasePlatform::setRectEmpty(&_upRight);
+ BasePlatform::setRectEmpty(&_middleLeft);
+ BasePlatform::setRectEmpty(&_middleMiddle);
+ BasePlatform::setRectEmpty(&_middleRight);
+ BasePlatform::setRectEmpty(&_downLeft);
+ BasePlatform::setRectEmpty(&_downMiddle);
+ BasePlatform::setRectEmpty(&_downRight);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UITiledImage::~UITiledImage() {
+ delete _image;
+ _image = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UITiledImage::display(int x, int y, int width, int height) {
+ if (!_image) {
+ return STATUS_FAILED;
+ }
+
+ int tileWidth = _middleMiddle.right - _middleMiddle.left;
+ int tileHeight = _middleMiddle.bottom - _middleMiddle.top;
+
+ int nuColumns = (width - (_middleLeft.right - _middleLeft.left) - (_middleRight.right - _middleRight.left)) / tileWidth;
+ int nuRows = (height - (_upMiddle.bottom - _upMiddle.top) - (_downMiddle.bottom - _downMiddle.top)) / tileHeight;
+
+ int col, row;
+
+ _gameRef->_renderer->startSpriteBatch();
+
+ // top left/right
+ _image->_surface->displayTrans(x, y, _upLeft);
+ _image->_surface->displayTrans(x + (_upLeft.right - _upLeft.left) + nuColumns * tileWidth, y, _upRight);
+
+ // bottom left/right
+ _image->_surface->displayTrans(x, y + (_upMiddle.bottom - _upMiddle.top) + nuRows * tileHeight, _downLeft);
+ _image->_surface->displayTrans(x + (_upLeft.right - _upLeft.left) + nuColumns * tileWidth, y + (_upMiddle.bottom - _upMiddle.top) + nuRows * tileHeight, _downRight);
+
+ // left/right
+ int yyy = y + (_upMiddle.bottom - _upMiddle.top);
+ for (row = 0; row < nuRows; row++) {
+ _image->_surface->displayTrans(x, yyy, _middleLeft);
+ _image->_surface->displayTrans(x + (_middleLeft.right - _middleLeft.left) + nuColumns * tileWidth, yyy, _middleRight);
+ yyy += tileWidth;
+ }
+
+ // top/bottom
+ int xxx = x + (_upLeft.right - _upLeft.left);
+ for (col = 0; col < nuColumns; col++) {
+ _image->_surface->displayTrans(xxx, y, _upMiddle);
+ _image->_surface->displayTrans(xxx, y + (_upMiddle.bottom - _upMiddle.top) + nuRows * tileHeight, _downMiddle);
+ xxx += tileWidth;
+ }
+
+ // tiles
+ yyy = y + (_upMiddle.bottom - _upMiddle.top);
+ for (row = 0; row < nuRows; row++) {
+ xxx = x + (_upLeft.right - _upLeft.left);
+ for (col = 0; col < nuColumns; col++) {
+ _image->_surface->displayTrans(xxx, yyy, _middleMiddle);
+ xxx += tileWidth;
+ }
+ yyy += tileWidth;
+ }
+
+ _gameRef->_renderer->endSpriteBatch();
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UITiledImage::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "UITiledImage::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
+ }
+
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(TILED_IMAGE)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(UP_LEFT)
+TOKEN_DEF(UP_RIGHT)
+TOKEN_DEF(UP_MIDDLE)
+TOKEN_DEF(DOWN_LEFT)
+TOKEN_DEF(DOWN_RIGHT)
+TOKEN_DEF(DOWN_MIDDLE)
+TOKEN_DEF(MIDDLE_LEFT)
+TOKEN_DEF(MIDDLE_RIGHT)
+TOKEN_DEF(MIDDLE_MIDDLE)
+TOKEN_DEF(VERTICAL_TILES)
+TOKEN_DEF(HORIZONTAL_TILES)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(TILED_IMAGE)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(UP_LEFT)
+ TOKEN_TABLE(UP_RIGHT)
+ TOKEN_TABLE(UP_MIDDLE)
+ TOKEN_TABLE(DOWN_LEFT)
+ TOKEN_TABLE(DOWN_RIGHT)
+ TOKEN_TABLE(DOWN_MIDDLE)
+ TOKEN_TABLE(MIDDLE_LEFT)
+ TOKEN_TABLE(MIDDLE_RIGHT)
+ TOKEN_TABLE(MIDDLE_MIDDLE)
+ TOKEN_TABLE(VERTICAL_TILES)
+ TOKEN_TABLE(HORIZONTAL_TILES)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd;
+ BaseParser parser;
+ bool hTiles = false, vTiles = false;
+ int h1 = 0, h2 = 0, h3 = 0;
+ int v1 = 0, v2 = 0, v3 = 0;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TILED_IMAGE) {
+ _gameRef->LOG(0, "'TILED_IMAGE' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE:
+ delete _image;
+ _image = new BaseSubFrame(_gameRef);
+ if (!_image || DID_FAIL(_image->setSurface((char *)params))) {
+ delete _image;
+ _image = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_UP_LEFT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_upLeft.left, &_upLeft.top, &_upLeft.right, &_upLeft.bottom);
+ break;
+
+ case TOKEN_UP_RIGHT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_upRight.left, &_upRight.top, &_upRight.right, &_upRight.bottom);
+ break;
+
+ case TOKEN_UP_MIDDLE:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_upMiddle.left, &_upMiddle.top, &_upMiddle.right, &_upMiddle.bottom);
+ break;
+
+ case TOKEN_DOWN_LEFT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_downLeft.left, &_downLeft.top, &_downLeft.right, &_downLeft.bottom);
+ break;
+
+ case TOKEN_DOWN_RIGHT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_downRight.left, &_downRight.top, &_downRight.right, &_downRight.bottom);
+ break;
+
+ case TOKEN_DOWN_MIDDLE:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_downMiddle.left, &_downMiddle.top, &_downMiddle.right, &_downMiddle.bottom);
+ break;
+
+ case TOKEN_MIDDLE_LEFT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_middleLeft.left, &_middleLeft.top, &_middleLeft.right, &_middleLeft.bottom);
+ break;
+
+ case TOKEN_MIDDLE_RIGHT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_middleRight.left, &_middleRight.top, &_middleRight.right, &_middleRight.bottom);
+ break;
+
+ case TOKEN_MIDDLE_MIDDLE:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_middleMiddle.left, &_middleMiddle.top, &_middleMiddle.right, &_middleMiddle.bottom);
+ break;
+
+ case TOKEN_HORIZONTAL_TILES:
+ parser.scanStr((char *)params, "%d,%d,%d", &h1, &h2, &h3);
+ hTiles = true;
+ break;
+
+ case TOKEN_VERTICAL_TILES:
+ parser.scanStr((char *)params, "%d,%d,%d", &v1, &v2, &v3);
+ vTiles = true;
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in TILED_IMAGE definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading TILED_IMAGE definition");
+ return STATUS_FAILED;
+ }
+
+ if (vTiles && hTiles) {
+ // up row
+ BasePlatform::setRect(&_upLeft, 0, 0, h1, v1);
+ BasePlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1);
+ BasePlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1);
+
+ // middle row
+ BasePlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2);
+ BasePlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2);
+ BasePlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2);
+
+ // down row
+ BasePlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3);
+ BasePlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3);
+ BasePlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3);
+ }
+
+ // default
+ if (_image && _image->_surface) {
+ int width = _image->_surface->getWidth() / 3;
+ int height = _image->_surface->getHeight() / 3;
+
+ if (BasePlatform::isRectEmpty(&_upLeft)) {
+ BasePlatform::setRect(&_upLeft, 0, 0, width, height);
+ }
+ if (BasePlatform::isRectEmpty(&_upMiddle)) {
+ BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height);
+ }
+ if (BasePlatform::isRectEmpty(&_upRight)) {
+ BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height);
+ }
+
+ if (BasePlatform::isRectEmpty(&_middleLeft)) {
+ BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_middleMiddle)) {
+ BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_middleRight)) {
+ BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height);
+ }
+
+ if (BasePlatform::isRectEmpty(&_downLeft)) {
+ BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_downMiddle)) {
+ BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_downRight)) {
+ BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UITiledImage::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "TILED_IMAGE\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ if (_image && _image->getSurfaceFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getSurfaceFilename());
+ }
+
+ int h1, h2, h3;
+ int v1, v2, v3;
+
+ h1 = _upLeft.right;
+ h2 = _upMiddle.right - _upMiddle.left;
+ h3 = _upRight.right - _upRight.left;
+
+ v1 = _upLeft.bottom;
+ v2 = _middleLeft.bottom - _middleLeft.top;
+ v3 = _downLeft.bottom - _downLeft.top;
+
+
+ buffer->putTextIndent(indent + 2, "VERTICAL_TILES { %d, %d, %d }\n", v1, v2, v3);
+ buffer->putTextIndent(indent + 2, "HORIZONTAL_TILES { %d, %d, %d }\n", h1, h2, h3);
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void UITiledImage::correctSize(int *width, int *height) {
+ int tileWidth = _middleMiddle.right - _middleMiddle.left;
+ int tileHeight = _middleMiddle.bottom - _middleMiddle.top;
+
+ int nuColumns = (*width - (_middleLeft.right - _middleLeft.left) - (_middleRight.right - _middleRight.left)) / tileWidth;
+ int nuRows = (*height - (_upMiddle.bottom - _upMiddle.top) - (_downMiddle.bottom - _downMiddle.top)) / tileHeight;
+
+ *width = (_middleLeft.right - _middleLeft.left) + (_middleRight.right - _middleRight.left) + nuColumns * tileWidth;
+ *height = (_upMiddle.bottom - _upMiddle.top) + (_downMiddle.bottom - _downMiddle.top) + nuRows * tileHeight;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UITiledImage::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_downLeft));
+ persistMgr->transfer(TMEMBER(_downMiddle));
+ persistMgr->transfer(TMEMBER(_downRight));
+ persistMgr->transfer(TMEMBER(_image));
+ persistMgr->transfer(TMEMBER(_middleLeft));
+ persistMgr->transfer(TMEMBER(_middleMiddle));
+ persistMgr->transfer(TMEMBER(_middleRight));
+ persistMgr->transfer(TMEMBER(_upLeft));
+ persistMgr->transfer(TMEMBER(_upMiddle));
+ persistMgr->transfer(TMEMBER(_upRight));
+
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h
new file mode 100644
index 0000000000..c413e7f129
--- /dev/null
+++ b/engines/wintermute/ui/ui_tiled_image.h
@@ -0,0 +1,63 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UITILEDIMAGE_H
+#define WINTERMUTE_UITILEDIMAGE_H
+
+
+#include "engines/wintermute/ui/ui_object.h"
+#include "common/rect.h"
+
+namespace Wintermute {
+class BaseSubFrame;
+class UITiledImage : public BaseObject {
+public:
+ DECLARE_PERSISTENT(UITiledImage, BaseObject)
+ void correctSize(int *width, int *height);
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ bool display(int x, int y, int width, int height);
+ UITiledImage(BaseGame *inGame = NULL);
+ virtual ~UITiledImage();
+ BaseSubFrame *_image;
+ Rect32 _upLeft;
+ Rect32 _upMiddle;
+ Rect32 _upRight;
+ Rect32 _middleLeft;
+ Rect32 _middleMiddle;
+ Rect32 _middleRight;
+ Rect32 _downLeft;
+ Rect32 _downMiddle;
+ Rect32 _downRight;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
new file mode 100644
index 0000000000..9606486efb
--- /dev/null
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -0,0 +1,1445 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_parser.h"
+#include "engines/wintermute/base/base_active_rect.h"
+#include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_keyboard_state.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/ui/ui_button.h"
+#include "engines/wintermute/ui/ui_edit.h"
+#include "engines/wintermute/ui/ui_text.h"
+#include "engines/wintermute/ui/ui_tiled_image.h"
+#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/font/base_font_storage.h"
+#include "engines/wintermute/base/font/base_font.h"
+#include "engines/wintermute/base/base_string_table.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/base/base_sprite.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(UIWindow, false)
+
+//////////////////////////////////////////////////////////////////////////
+UIWindow::UIWindow(BaseGame *inGame) : UIObject(inGame) {
+ BasePlatform::setRectEmpty(&_titleRect);
+ BasePlatform::setRectEmpty(&_dragRect);
+ _titleAlign = TAL_LEFT;
+ _transparent = false;
+
+ _backInactive = NULL;
+ _fontInactive = NULL;
+ _imageInactive = NULL;
+
+ _type = UI_WINDOW;
+ _canFocus = true;
+
+ _dragging = false;
+ _dragFrom.x = _dragFrom.y = 0;
+
+ _mode = WINDOW_NORMAL;
+ _shieldWindow = NULL;
+ _shieldButton = NULL;
+
+ _fadeColor = 0x00000000;
+ _fadeBackground = false;
+
+ _ready = true;
+ _isMenu = false;
+ _inGame = false;
+
+ _clipContents = false;
+ _viewport = NULL;
+
+ _pauseMusic = true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+UIWindow::~UIWindow() {
+ close();
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIWindow::cleanup() {
+ delete _shieldWindow;
+ delete _shieldButton;
+ delete _viewport;
+ _shieldWindow = NULL;
+ _shieldButton = NULL;
+ _viewport = NULL;
+
+ delete _backInactive;
+ if (!_sharedFonts && _fontInactive) {
+ _gameRef->_fontStorage->removeFont(_fontInactive);
+ }
+ if (!_sharedImages && _imageInactive) {
+ delete _imageInactive;
+ }
+
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ delete _widgets[i];
+ }
+ _widgets.clear();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::display(int offsetX, int offsetY) {
+ // go exclusive
+ if (_mode == WINDOW_EXCLUSIVE || _mode == WINDOW_SYSTEM_EXCLUSIVE) {
+ if (!_shieldWindow) {
+ _shieldWindow = new UIWindow(_gameRef);
+ }
+ if (_shieldWindow) {
+ _shieldWindow->_posX = _shieldWindow->_posY = 0;
+ _shieldWindow->_width = _gameRef->_renderer->_width;
+ _shieldWindow->_height = _gameRef->_renderer->_height;
+
+ _shieldWindow->display();
+ }
+ } else if (_isMenu) {
+ if (!_shieldButton) {
+ _shieldButton = new UIButton(_gameRef);
+ _shieldButton->setName("close");
+ _shieldButton->setListener(this, _shieldButton, 0);
+ _shieldButton->_parent = this;
+ }
+ if (_shieldButton) {
+ _shieldButton->_posX = _shieldButton->_posY = 0;
+ _shieldButton->_width = _gameRef->_renderer->_width;
+ _shieldButton->_height = _gameRef->_renderer->_height;
+
+ _shieldButton->display();
+ }
+ }
+
+ if (!_visible) {
+ return STATUS_OK;
+ }
+
+ if (_fadeBackground) {
+ Graphics::PixelFormat format = _gameRef->_renderer->getPixelFormat();
+ byte fadeR, fadeG, fadeB, fadeA;
+ // First convert from the internal format to the screen-format
+ uint32 fadeColor = format.ARGBToColor(RGBCOLGetA(_fadeColor), RGBCOLGetR(_fadeColor), RGBCOLGetG(_fadeColor), RGBCOLGetB(_fadeColor));
+ // Then get components
+ format.colorToARGB(fadeColor, fadeA, fadeR, fadeG, fadeB);
+ _gameRef->_renderer->fadeToColor(fadeR, fadeG, fadeB, fadeA);
+ }
+
+ if (_dragging) {
+ _posX += (_gameRef->_mousePos.x - _dragFrom.x);
+ _posY += (_gameRef->_mousePos.y - _dragFrom.y);
+
+ _dragFrom.x = _gameRef->_mousePos.x;
+ _dragFrom.y = _gameRef->_mousePos.y;
+ }
+
+ if (!_focusedWidget || (!_focusedWidget->_canFocus || _focusedWidget->_disable || !_focusedWidget->_visible)) {
+ moveFocus();
+ }
+
+ bool popViewport = false;
+ if (_clipContents) {
+ if (!_viewport) {
+ _viewport = new BaseViewport(_gameRef);
+ }
+ if (_viewport) {
+ _viewport->setRect(_posX + offsetX, _posY + offsetY, _posX + _width + offsetX, _posY + _height + offsetY);
+ _gameRef->pushViewport(_viewport);
+ popViewport = true;
+ }
+ }
+
+
+ UITiledImage *back = _back;
+ BaseSprite *image = _image;
+ BaseFont *font = _font;
+
+ if (!isFocused()) {
+ if (_backInactive) {
+ back = _backInactive;
+ }
+ if (_imageInactive) {
+ image = _imageInactive;
+ }
+ if (_fontInactive) {
+ font = _fontInactive;
+ }
+ }
+
+ if (_alphaColor != 0) {
+ _gameRef->_renderer->_forceAlphaColor = _alphaColor;
+ }
+ if (back) {
+ back->display(_posX + offsetX, _posY + offsetY, _width, _height);
+ }
+ if (image) {
+ image->draw(_posX + offsetX, _posY + offsetY, _transparent ? NULL : this);
+ }
+
+ if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) {
+ font->drawText((byte *)_text, _posX + offsetX + _titleRect.left, _posY + offsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);
+ }
+
+ if (!_transparent && !image) {
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false));
+ }
+
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ _widgets[i]->display(_posX + offsetX, _posY + offsetY);
+ }
+
+ if (_alphaColor != 0) {
+ _gameRef->_renderer->_forceAlphaColor = 0;
+ }
+
+ if (popViewport) {
+ _gameRef->popViewport();
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::loadFile(const char *filename) {
+ byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
+ if (buffer == NULL) {
+ _gameRef->LOG(0, "UIWindow::LoadFile failed for file '%s'", filename);
+ return STATUS_FAILED;
+ }
+
+ bool ret;
+
+ setFilename(filename);
+
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing WINDOW file '%s'", filename);
+ }
+
+ delete[] buffer;
+
+ return ret;
+}
+
+
+TOKEN_DEF_START
+TOKEN_DEF(WINDOW)
+TOKEN_DEF(ALPHA_COLOR)
+TOKEN_DEF(ALPHA)
+TOKEN_DEF(TEMPLATE)
+TOKEN_DEF(DISABLED)
+TOKEN_DEF(VISIBLE)
+TOKEN_DEF(BACK_INACTIVE)
+TOKEN_DEF(BACK)
+TOKEN_DEF(IMAGE_INACTIVE)
+TOKEN_DEF(IMAGE)
+TOKEN_DEF(FONT_INACTIVE)
+TOKEN_DEF(FONT)
+TOKEN_DEF(TITLE_ALIGN)
+TOKEN_DEF(TITLE_RECT)
+TOKEN_DEF(TITLE)
+TOKEN_DEF(DRAG_RECT)
+TOKEN_DEF(X)
+TOKEN_DEF(Y)
+TOKEN_DEF(WIDTH)
+TOKEN_DEF(HEIGHT)
+TOKEN_DEF(FADE_ALPHA)
+TOKEN_DEF(FADE_COLOR)
+TOKEN_DEF(CURSOR)
+TOKEN_DEF(NAME)
+TOKEN_DEF(BUTTON)
+TOKEN_DEF(STATIC)
+TOKEN_DEF(TRANSPARENT)
+TOKEN_DEF(SCRIPT)
+TOKEN_DEF(CAPTION)
+TOKEN_DEF(PARENT_NOTIFY)
+TOKEN_DEF(MENU)
+TOKEN_DEF(IN_GAME)
+TOKEN_DEF(CLIP_CONTENTS)
+TOKEN_DEF(PAUSE_MUSIC)
+TOKEN_DEF(EDITOR_PROPERTY)
+TOKEN_DEF(EDIT)
+TOKEN_DEF_END
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::loadBuffer(byte *buffer, bool complete) {
+ TOKEN_TABLE_START(commands)
+ TOKEN_TABLE(WINDOW)
+ TOKEN_TABLE(ALPHA_COLOR)
+ TOKEN_TABLE(ALPHA)
+ TOKEN_TABLE(TEMPLATE)
+ TOKEN_TABLE(DISABLED)
+ TOKEN_TABLE(VISIBLE)
+ TOKEN_TABLE(BACK_INACTIVE)
+ TOKEN_TABLE(BACK)
+ TOKEN_TABLE(IMAGE_INACTIVE)
+ TOKEN_TABLE(IMAGE)
+ TOKEN_TABLE(FONT_INACTIVE)
+ TOKEN_TABLE(FONT)
+ TOKEN_TABLE(TITLE_ALIGN)
+ TOKEN_TABLE(TITLE_RECT)
+ TOKEN_TABLE(TITLE)
+ TOKEN_TABLE(DRAG_RECT)
+ TOKEN_TABLE(X)
+ TOKEN_TABLE(Y)
+ TOKEN_TABLE(WIDTH)
+ TOKEN_TABLE(HEIGHT)
+ TOKEN_TABLE(FADE_ALPHA)
+ TOKEN_TABLE(FADE_COLOR)
+ TOKEN_TABLE(CURSOR)
+ TOKEN_TABLE(NAME)
+ TOKEN_TABLE(BUTTON)
+ TOKEN_TABLE(STATIC)
+ TOKEN_TABLE(TRANSPARENT)
+ TOKEN_TABLE(SCRIPT)
+ TOKEN_TABLE(CAPTION)
+ TOKEN_TABLE(PARENT_NOTIFY)
+ TOKEN_TABLE(MENU)
+ TOKEN_TABLE(IN_GAME)
+ TOKEN_TABLE(CLIP_CONTENTS)
+ TOKEN_TABLE(PAUSE_MUSIC)
+ TOKEN_TABLE(EDITOR_PROPERTY)
+ TOKEN_TABLE(EDIT)
+ TOKEN_TABLE_END
+
+ byte *params;
+ int cmd = 2;
+ BaseParser parser;
+
+ int fadeR = 0, fadeG = 0, fadeB = 0, fadeA = 0;
+ int ar = 0, ag = 0, ab = 0, alpha = 0;
+
+ if (complete) {
+ if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_WINDOW) {
+ _gameRef->LOG(0, "'WINDOW' keyword expected.");
+ return STATUS_FAILED;
+ }
+ buffer = params;
+ }
+
+ while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) >= PARSERR_TOKENNOTFOUND) {
+ switch (cmd) {
+ case TOKEN_TEMPLATE:
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_NAME:
+ setName((char *)params);
+ break;
+
+ case TOKEN_CAPTION:
+ setCaption((char *)params);
+ break;
+
+ case TOKEN_BACK:
+ delete _back;
+ _back = new UITiledImage(_gameRef);
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
+ delete _back;
+ _back = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_BACK_INACTIVE:
+ delete _backInactive;
+ _backInactive = new UITiledImage(_gameRef);
+ if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) {
+ delete _backInactive;
+ _backInactive = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE:
+ delete _image;
+ _image = new BaseSprite(_gameRef);
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
+ delete _image;
+ _image = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_IMAGE_INACTIVE:
+ delete _imageInactive,
+ _imageInactive = new BaseSprite(_gameRef);
+ if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) {
+ delete _imageInactive;
+ _imageInactive = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT:
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ _font = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_FONT_INACTIVE:
+ if (_fontInactive) {
+ _gameRef->_fontStorage->removeFont(_fontInactive);
+ }
+ _fontInactive = _gameRef->_fontStorage->addFont((char *)params);
+ if (!_fontInactive) {
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_TITLE:
+ setText((char *)params);
+ _gameRef->_stringTable->expand(&_text);
+ break;
+
+ case TOKEN_TITLE_ALIGN:
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _titleAlign = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _titleAlign = TAL_RIGHT;
+ } else {
+ _titleAlign = TAL_CENTER;
+ }
+ break;
+
+ case TOKEN_TITLE_RECT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_titleRect.left, &_titleRect.top, &_titleRect.right, &_titleRect.bottom);
+ break;
+
+ case TOKEN_DRAG_RECT:
+ parser.scanStr((char *)params, "%d,%d,%d,%d", &_dragRect.left, &_dragRect.top, &_dragRect.right, &_dragRect.bottom);
+ break;
+
+ case TOKEN_X:
+ parser.scanStr((char *)params, "%d", &_posX);
+ break;
+
+ case TOKEN_Y:
+ parser.scanStr((char *)params, "%d", &_posY);
+ break;
+
+ case TOKEN_WIDTH:
+ parser.scanStr((char *)params, "%d", &_width);
+ break;
+
+ case TOKEN_HEIGHT:
+ parser.scanStr((char *)params, "%d", &_height);
+ break;
+
+ case TOKEN_CURSOR:
+ delete _cursor;
+ _cursor = new BaseSprite(_gameRef);
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
+ delete _cursor;
+ _cursor = NULL;
+ cmd = PARSERR_GENERIC;
+ }
+ break;
+
+ case TOKEN_BUTTON: {
+ UIButton *btn = new UIButton(_gameRef);
+ if (!btn || DID_FAIL(btn->loadBuffer(params, false))) {
+ delete btn;
+ btn = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ btn->_parent = this;
+ _widgets.add(btn);
+ }
+ }
+ break;
+
+ case TOKEN_STATIC: {
+ UIText *text = new UIText(_gameRef);
+ if (!text || DID_FAIL(text->loadBuffer(params, false))) {
+ delete text;
+ text = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ text->_parent = this;
+ _widgets.add(text);
+ }
+ }
+ break;
+
+ case TOKEN_EDIT: {
+ UIEdit *edit = new UIEdit(_gameRef);
+ if (!edit || DID_FAIL(edit->loadBuffer(params, false))) {
+ delete edit;
+ edit = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ edit->_parent = this;
+ _widgets.add(edit);
+ }
+ }
+ break;
+
+ case TOKEN_WINDOW: {
+ UIWindow *win = new UIWindow(_gameRef);
+ if (!win || DID_FAIL(win->loadBuffer(params, false))) {
+ delete win;
+ win = NULL;
+ cmd = PARSERR_GENERIC;
+ } else {
+ win->_parent = this;
+ _widgets.add(win);
+ }
+ }
+ break;
+
+
+ case TOKEN_TRANSPARENT:
+ parser.scanStr((char *)params, "%b", &_transparent);
+ break;
+
+ case TOKEN_SCRIPT:
+ addScript((char *)params);
+ break;
+
+ case TOKEN_PARENT_NOTIFY:
+ parser.scanStr((char *)params, "%b", &_parentNotify);
+ break;
+
+ case TOKEN_PAUSE_MUSIC:
+ parser.scanStr((char *)params, "%b", &_pauseMusic);
+ break;
+
+ case TOKEN_DISABLED:
+ parser.scanStr((char *)params, "%b", &_disable);
+ break;
+
+ case TOKEN_VISIBLE:
+ parser.scanStr((char *)params, "%b", &_visible);
+ break;
+
+ case TOKEN_MENU:
+ parser.scanStr((char *)params, "%b", &_isMenu);
+ break;
+
+ case TOKEN_IN_GAME:
+ parser.scanStr((char *)params, "%b", &_inGame);
+ break;
+
+ case TOKEN_CLIP_CONTENTS:
+ parser.scanStr((char *)params, "%b", &_clipContents);
+ break;
+
+ case TOKEN_FADE_COLOR:
+ parser.scanStr((char *)params, "%d,%d,%d", &fadeR, &fadeG, &fadeB);
+ _fadeBackground = true;
+ break;
+
+ case TOKEN_FADE_ALPHA:
+ parser.scanStr((char *)params, "%d", &fadeA);
+ _fadeBackground = true;
+ break;
+
+ case TOKEN_EDITOR_PROPERTY:
+ parseEditorProperty(params, false);
+ break;
+
+ case TOKEN_ALPHA_COLOR:
+ parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
+ break;
+
+ case TOKEN_ALPHA:
+ parser.scanStr((char *)params, "%d", &alpha);
+ break;
+
+
+ default:
+ if (DID_FAIL(_gameRef->windowLoadHook(this, (char **)&buffer, (char **)params))) {
+ cmd = PARSERR_GENERIC;
+ }
+ }
+ }
+ if (cmd == PARSERR_TOKENNOTFOUND) {
+ _gameRef->LOG(0, "Syntax error in WINDOW definition");
+ return STATUS_FAILED;
+ }
+ if (cmd == PARSERR_GENERIC) {
+ _gameRef->LOG(0, "Error loading WINDOW definition");
+ return STATUS_FAILED;
+ }
+
+ correctSize();
+
+ if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
+ ar = ag = ab = 255;
+ }
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
+
+ if (_fadeBackground) {
+ _fadeColor = BYTETORGBA(fadeR, fadeG, fadeB, fadeA);
+ }
+
+ _focusedWidget = NULL;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
+ buffer->putTextIndent(indent, "WINDOW\n");
+ buffer->putTextIndent(indent, "{\n");
+
+ buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
+ buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_back && _back->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ }
+ if (_backInactive && _backInactive->getFilename()) {
+ buffer->putTextIndent(indent + 2, "BACK_INACTIVE=\"%s\"\n", _backInactive->getFilename());
+ }
+
+ if (_image && _image->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ }
+ if (_imageInactive && _imageInactive->getFilename()) {
+ buffer->putTextIndent(indent + 2, "IMAGE_INACTIVE=\"%s\"\n", _imageInactive->getFilename());
+ }
+
+ if (_font && _font->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
+ if (_fontInactive && _fontInactive->getFilename()) {
+ buffer->putTextIndent(indent + 2, "FONT_INACTIVE=\"%s\"\n", _fontInactive->getFilename());
+ }
+
+ if (_cursor && _cursor->getFilename()) {
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_text) {
+ buffer->putTextIndent(indent + 2, "TITLE=\"%s\"\n", _text);
+ }
+
+ switch (_titleAlign) {
+ case TAL_LEFT:
+ buffer->putTextIndent(indent + 2, "TITLE_ALIGN=\"%s\"\n", "left");
+ break;
+ case TAL_RIGHT:
+ buffer->putTextIndent(indent + 2, "TITLE_ALIGN=\"%s\"\n", "right");
+ break;
+ case TAL_CENTER:
+ buffer->putTextIndent(indent + 2, "TITLE_ALIGN=\"%s\"\n", "center");
+ break;
+ default:
+ error("UIWindow::SaveAsText - Unhandled enum-value NUM_TEXT_ALIGN");
+ }
+
+ if (!BasePlatform::isRectEmpty(&_titleRect)) {
+ buffer->putTextIndent(indent + 2, "TITLE_RECT { %d, %d, %d, %d }\n", _titleRect.left, _titleRect.top, _titleRect.right, _titleRect.bottom);
+ }
+
+ if (!BasePlatform::isRectEmpty(&_dragRect)) {
+ buffer->putTextIndent(indent + 2, "DRAG_RECT { %d, %d, %d, %d }\n", _dragRect.left, _dragRect.top, _dragRect.right, _dragRect.bottom);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
+ buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
+ buffer->putTextIndent(indent + 2, "WIDTH=%d\n", _width);
+ buffer->putTextIndent(indent + 2, "HEIGHT=%d\n", _height);
+
+ buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PARENT_NOTIFY=%s\n", _parentNotify ? "TRUE" : "FALSE");
+
+ buffer->putTextIndent(indent + 2, "TRANSPARENT=%s\n", _transparent ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "PAUSE_MUSIC=%s\n", _pauseMusic ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "MENU=%s\n", _isMenu ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "IN_GAME=%s\n", _inGame ? "TRUE" : "FALSE");
+ buffer->putTextIndent(indent + 2, "CLIP_CONTENTS=%s\n", _clipContents ? "TRUE" : "FALSE");
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ if (_fadeBackground) {
+ buffer->putTextIndent(indent + 2, "FADE_COLOR { %d, %d, %d }\n", RGBCOLGetR(_fadeColor), RGBCOLGetG(_fadeColor), RGBCOLGetB(_fadeColor));
+ buffer->putTextIndent(indent + 2, "FADE_ALPHA=%d\n", RGBCOLGetA(_fadeColor));
+ }
+
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d, %d, %d }\n", RGBCOLGetR(_alphaColor), RGBCOLGetG(_alphaColor), RGBCOLGetB(_alphaColor));
+ buffer->putTextIndent(indent + 2, "ALPHA=%d\n", RGBCOLGetA(_alphaColor));
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // scripts
+ for (uint32 i = 0; i < _scripts.size(); i++) {
+ buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
+ }
+
+ buffer->putTextIndent(indent + 2, "\n");
+
+ // editor properties
+ BaseClass::saveAsText(buffer, indent + 2);
+
+ // controls
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ _widgets[i]->saveAsText(buffer, indent + 2);
+ }
+
+
+ buffer->putTextIndent(indent, "}\n");
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::enableWidget(const char *name, bool enable) {
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ if (scumm_stricmp(_widgets[i]->getName(), name) == 0) {
+ _widgets[i]->_disable = !enable;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::showWidget(const char *name, bool visible) {
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ if (scumm_stricmp(_widgets[i]->getName(), name) == 0) {
+ _widgets[i]->_visible = visible;
+ }
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// high level scripting interface
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
+ //////////////////////////////////////////////////////////////////////////
+ // GetWidget / GetControl
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "GetWidget") == 0 || strcmp(name, "GetControl") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ if (val->getType() == VAL_INT) {
+ int widget = val->getInt();
+ if (widget < 0 || widget >= (int32)_widgets.size()) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_widgets[widget], true);
+ }
+ } else {
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ if (scumm_stricmp(_widgets[i]->getName(), val->getString()) == 0) {
+ stack->pushNative(_widgets[i], true);
+ return STATUS_OK;
+ }
+ }
+ stack->pushNULL();
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetInactiveFont
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetInactiveFont") == 0) {
+ stack->correctParams(1);
+
+ if (_fontInactive) {
+ _gameRef->_fontStorage->removeFont(_fontInactive);
+ }
+ _fontInactive = _gameRef->_fontStorage->addFont(stack->pop()->getString());
+ stack->pushBool(_fontInactive != NULL);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetInactiveImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SetInactiveImage") == 0) {
+ stack->correctParams(1);
+
+ delete _imageInactive;
+ _imageInactive = new BaseSprite(_gameRef);
+ const char *filename = stack->pop()->getString();
+ if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(filename))) {
+ delete _imageInactive;
+ _imageInactive = NULL;
+ stack->pushBool(false);
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetInactiveImage
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetInactiveImage") == 0) {
+ stack->correctParams(0);
+ if (!_imageInactive || !_imageInactive->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageInactive->getFilename());
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetInactiveImageObject
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetInactiveImageObject") == 0) {
+ stack->correctParams(0);
+ if (!_imageInactive) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageInactive, true);
+ }
+
+ return STATUS_OK;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // Close
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Close") == 0) {
+ stack->correctParams(0);
+ stack->pushBool(DID_SUCCEED(close()));
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GoExclusive
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GoExclusive") == 0) {
+ stack->correctParams(0);
+ goExclusive();
+ script->waitFor(this);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GoSystemExclusive
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GoSystemExclusive") == 0) {
+ stack->correctParams(0);
+ goSystemExclusive();
+ script->waitFor(this);
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Center
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Center") == 0) {
+ stack->correctParams(0);
+ _posX = (_gameRef->_renderer->_width - _width) / 2;
+ _posY = (_gameRef->_renderer->_height - _height) / 2;
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // LoadFromFile
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "LoadFromFile") == 0) {
+ stack->correctParams(1);
+
+ ScValue *val = stack->pop();
+ cleanup();
+ if (!val->isNULL()) {
+ stack->pushBool(DID_SUCCEED(loadFile(val->getString())));
+ } else {
+ stack->pushBool(true);
+ }
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateButton
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateButton") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ UIButton *btn = new UIButton(_gameRef);
+ if (!val->isNULL()) {
+ btn->setName(val->getString());
+ }
+ stack->pushNative(btn, true);
+
+ btn->_parent = this;
+ _widgets.add(btn);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateStatic
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateStatic") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ UIText *sta = new UIText(_gameRef);
+ if (!val->isNULL()) {
+ sta->setName(val->getString());
+ }
+ stack->pushNative(sta, true);
+
+ sta->_parent = this;
+ _widgets.add(sta);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateEditor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateEditor") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ UIEdit *edi = new UIEdit(_gameRef);
+ if (!val->isNULL()) {
+ edi->setName(val->getString());
+ }
+ stack->pushNative(edi, true);
+
+ edi->_parent = this;
+ _widgets.add(edi);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // CreateWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "CreateWindow") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+
+ UIWindow *win = new UIWindow(_gameRef);
+ if (!val->isNULL()) {
+ win->setName(val->getString());
+ }
+ stack->pushNative(win, true);
+
+ win->_parent = this;
+ _widgets.add(win);
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // DeleteControl / DeleteButton / DeleteStatic / DeleteEditor / DeleteWindow
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "DeleteControl") == 0 || strcmp(name, "DeleteButton") == 0 || strcmp(name, "DeleteStatic") == 0 || strcmp(name, "DeleteEditor") == 0 || strcmp(name, "DeleteWindow") == 0) {
+ stack->correctParams(1);
+ ScValue *val = stack->pop();
+ UIObject *obj = (UIObject *)val->getNative();
+
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ if (_widgets[i] == obj) {
+ delete _widgets[i];
+ _widgets.remove_at(i);
+ if (val->getType() == VAL_VARIABLE_REF) {
+ val->setNULL();
+ }
+ }
+ }
+ stack->pushNULL();
+ return STATUS_OK;
+ } else if DID_SUCCEED(_gameRef->windowScriptMethodHook(this, script, stack, name)) {
+ return STATUS_OK;
+ }
+
+ else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+ScValue *UIWindow::scGetProperty(const Common::String &name) {
+ _scValue->setNULL();
+
+ //////////////////////////////////////////////////////////////////////////
+ // Type
+ //////////////////////////////////////////////////////////////////////////
+ if (name == "Type") {
+ _scValue->setString("window");
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // NumWidgets / NumControls (RO)
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "NumWidgets" || name == "NumControls") {
+ _scValue->setInt(_widgets.size());
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Exclusive
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Exclusive") {
+ _scValue->setBool(_mode == WINDOW_EXCLUSIVE);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SystemExclusive
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "SystemExclusive") {
+ _scValue->setBool(_mode == WINDOW_SYSTEM_EXCLUSIVE);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Menu
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Menu") {
+ _scValue->setBool(_isMenu);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InGame
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "InGame") {
+ _scValue->setBool(_inGame);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PauseMusic
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "PauseMusic") {
+ _scValue->setBool(_pauseMusic);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ClipContents
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "ClipContents") {
+ _scValue->setBool(_clipContents);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Transparent
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "Transparent") {
+ _scValue->setBool(_transparent);
+ return _scValue;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (name == "FadeColor") {
+ _scValue->setInt((int)_fadeColor);
+ return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::scSetProperty(const char *name, ScValue *value) {
+ //////////////////////////////////////////////////////////////////////////
+ // Name
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(name, "Name") == 0) {
+ setName(value->getString());
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Menu
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Menu") == 0) {
+ _isMenu = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // InGame
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "InGame") == 0) {
+ _inGame = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PauseMusic
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "PauseMusic") == 0) {
+ _pauseMusic = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // ClipContents
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "ClipContents") == 0) {
+ _clipContents = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Transparent
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Transparent") == 0) {
+ _transparent = value->getBool();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // FadeColor
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "FadeColor") == 0) {
+ _fadeColor = (uint32)value->getInt();
+ _fadeBackground = (_fadeColor != 0);
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Exclusive
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "Exclusive") == 0) {
+ if (value->getBool()) {
+ goExclusive();
+ } else {
+ close();
+ _visible = true;
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SystemExclusive
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "SystemExclusive") == 0) {
+ if (value->getBool()) {
+ goSystemExclusive();
+ } else {
+ close();
+ _visible = true;
+ }
+ return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+const char *UIWindow::scToString() {
+ return "[window]";
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::handleKeypress(Common::Event *event, bool printable) {
+//TODO
+ if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_TAB) {
+ return DID_SUCCEED(moveFocus(!BaseKeyboardState::isShiftDown()));
+ } else {
+ if (_focusedWidget) {
+ return _focusedWidget->handleKeypress(event, printable);
+ } else {
+ return false;
+ }
+ }
+ return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::handleMouseWheel(int Delta) {
+ if (_focusedWidget) {
+ return _focusedWidget->handleMouseWheel(Delta);
+ } else {
+ return false;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
+ bool res = UIObject::handleMouse(event, button);
+
+ // handle window dragging
+ if (!BasePlatform::isRectEmpty(&_dragRect)) {
+ // start drag
+ if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) {
+ Rect32 dragRect = _dragRect;
+ int offsetX, offsetY;
+ getTotalOffset(&offsetX, &offsetY);
+ dragRect.offsetRect(_posX + offsetX, _posY + offsetY);
+
+ if (BasePlatform::ptInRect(&dragRect, _gameRef->_mousePos)) {
+ _dragFrom.x = _gameRef->_mousePos.x;
+ _dragFrom.y = _gameRef->_mousePos.y;
+ _dragging = true;
+ }
+ }
+ // end drag
+ else if (_dragging && event == MOUSE_RELEASE && button == MOUSE_BUTTON_LEFT) {
+ _dragging = false;
+ }
+ }
+
+ return res;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::persist(BasePersistenceManager *persistMgr) {
+
+ UIObject::persist(persistMgr);
+
+ persistMgr->transfer(TMEMBER(_backInactive));
+ persistMgr->transfer(TMEMBER(_clipContents));
+ persistMgr->transfer(TMEMBER(_dragFrom));
+ persistMgr->transfer(TMEMBER(_dragging));
+ persistMgr->transfer(TMEMBER(_dragRect));
+ persistMgr->transfer(TMEMBER(_fadeBackground));
+ persistMgr->transfer(TMEMBER(_fadeColor));
+ persistMgr->transfer(TMEMBER(_fontInactive));
+ persistMgr->transfer(TMEMBER(_imageInactive));
+ persistMgr->transfer(TMEMBER(_inGame));
+ persistMgr->transfer(TMEMBER(_isMenu));
+ persistMgr->transfer(TMEMBER_INT(_mode));
+ persistMgr->transfer(TMEMBER(_shieldButton));
+ persistMgr->transfer(TMEMBER(_shieldWindow));
+ persistMgr->transfer(TMEMBER_INT(_titleAlign));
+ persistMgr->transfer(TMEMBER(_titleRect));
+ persistMgr->transfer(TMEMBER(_transparent));
+ persistMgr->transfer(TMEMBER(_viewport));
+ persistMgr->transfer(TMEMBER(_pauseMusic));
+
+ _widgets.persist(persistMgr);
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::moveFocus(bool forward) {
+ int i;
+ bool found = false;
+ for (i = 0; i < (int32)_widgets.size(); i++) {
+ if (_widgets[i] == _focusedWidget) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ _focusedWidget = NULL;
+ }
+
+ if (!_focusedWidget) {
+ if (_widgets.size() > 0) {
+ i = 0;
+ } else {
+ return STATUS_OK;
+ }
+ }
+
+ int numTries = 0;
+ bool done = false;
+
+ while (numTries <= (int32)_widgets.size()) {
+ if (_widgets[i] != _focusedWidget && _widgets[i]->_canFocus && _widgets[i]->_visible && !_widgets[i]->_disable) {
+ _focusedWidget = _widgets[i];
+ done = true;
+ break;
+ }
+
+ if (forward) {
+ i++;
+ if (i >= (int32)_widgets.size()) {
+ i = 0;
+ }
+ } else {
+ i--;
+ if (i < 0) {
+ i = _widgets.size() - 1;
+ }
+ }
+ numTries++;
+ }
+
+ return done ? STATUS_OK : STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::goExclusive() {
+ if (_mode == WINDOW_EXCLUSIVE) {
+ return STATUS_OK;
+ }
+
+ if (_mode == WINDOW_NORMAL) {
+ _ready = false;
+ _mode = WINDOW_EXCLUSIVE;
+ _visible = true;
+ _disable = false;
+ _gameRef->focusWindow(this);
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::goSystemExclusive() {
+ if (_mode == WINDOW_SYSTEM_EXCLUSIVE) {
+ return STATUS_OK;
+ }
+
+ makeFreezable(false);
+
+ _mode = WINDOW_SYSTEM_EXCLUSIVE;
+ _ready = false;
+ _visible = true;
+ _disable = false;
+ _gameRef->focusWindow(this);
+
+ _gameRef->freeze(_pauseMusic);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::close() {
+ if (_mode == WINDOW_SYSTEM_EXCLUSIVE) {
+ _gameRef->unfreeze();
+ }
+
+ _mode = WINDOW_NORMAL;
+ _visible = false;
+ _ready = true;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::listen(BaseScriptHolder *param1, uint32 param2) {
+ UIObject *obj = (UIObject *)param1;
+
+ switch (obj->_type) {
+ case UI_BUTTON:
+ if (scumm_stricmp(obj->getName(), "close") == 0) {
+ close();
+ } else {
+ return BaseObject::listen(param1, param2);
+ }
+ break;
+ default:
+ return BaseObject::listen(param1, param2);
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void UIWindow::makeFreezable(bool freezable) {
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ _widgets[i]->makeFreezable(freezable);
+ }
+
+ BaseObject::makeFreezable(freezable);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactiveOnly) {
+ for (uint32 i = 0; i < _widgets.size(); i++) {
+ UIObject *control = _widgets[i];
+ if (control->_disable && interactiveOnly) {
+ continue;
+ }
+
+ switch (control->_type) {
+ case UI_WINDOW:
+ ((UIWindow *)control)->getWindowObjects(objects, interactiveOnly);
+ break;
+
+ case UI_BUTTON:
+ case UI_EDIT:
+ objects.add(control);
+ break;
+
+ default:
+ if (!interactiveOnly) {
+ objects.add(control);
+ }
+ }
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h
new file mode 100644
index 0000000000..ae035c65c7
--- /dev/null
+++ b/engines/wintermute/ui/ui_window.h
@@ -0,0 +1,94 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UIWINDOW_H
+#define WINTERMUTE_UIWINDOW_H
+
+
+#include "engines/wintermute/ui/ui_object.h"
+#include "common/events.h"
+
+namespace Wintermute {
+
+class UIButton;
+class BaseViewport;
+class UIWindow : public UIObject {
+ uint32 _fadeColor;
+public:
+ bool getWindowObjects(BaseArray<UIObject *> &Objects, bool InteractiveOnly);
+
+ bool _pauseMusic;
+ void cleanup();
+ virtual void makeFreezable(bool freezable);
+ BaseViewport *_viewport;
+ bool _clipContents;
+ bool _inGame;
+ bool _isMenu;
+ bool _fadeBackground;
+
+ virtual bool handleMouseWheel(int delta);
+ UIWindow *_shieldWindow;
+ UIButton *_shieldButton;
+ bool close();
+ bool goSystemExclusive();
+ bool goExclusive();
+ TWindowMode _mode;
+ bool moveFocus(bool forward = true);
+ virtual bool handleMouse(TMouseEvent Event, TMouseButton Button);
+ Point32 _dragFrom;
+ bool _dragging;
+ DECLARE_PERSISTENT(UIWindow, UIObject)
+ bool _transparent;
+ bool showWidget(const char *name, bool visible = true);
+ bool enableWidget(const char *name, bool enable = true);
+ Rect32 _titleRect;
+ Rect32 _dragRect;
+ virtual bool display(int offsetX = 0, int offsetY = 0);
+ UIWindow(BaseGame *inGame);
+ virtual ~UIWindow();
+ virtual bool handleKeypress(Common::Event *event, bool printable = false);
+ BaseArray<UIObject *> _widgets;
+ TTextAlign _titleAlign;
+ bool loadFile(const char *filename);
+ bool loadBuffer(byte *buffer, bool complete = true);
+ UITiledImage *_backInactive;
+ BaseFont *_fontInactive;
+ BaseSprite *_imageInactive;
+ virtual bool listen(BaseScriptHolder *param1, uint32 param2);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
+
+ // scripting interface
+ virtual ScValue *scGetProperty(const Common::String &name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
+ virtual const char *scToString();
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/utils/convert_utf.cpp b/engines/wintermute/utils/convert_utf.cpp
new file mode 100644
index 0000000000..7ebc011d01
--- /dev/null
+++ b/engines/wintermute/utils/convert_utf.cpp
@@ -0,0 +1,615 @@
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ *
+ * Disclaimer
+ *
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ *
+ * Limitations on Rights to Redistribute This Code
+ *
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+/* ---------------------------------------------------------------------
+
+ Conversions between UTF32, UTF-16, and UTF-8. Source code file.
+ Author: Mark E. Davis, 1994.
+ Rev History: Rick McGowan, fixes & updates May 2001.
+ Sept 2001: fixed const & error conditions per
+ mods suggested by S. Parent & A. Lillich.
+ June 2002: Tim Dodd added detection and handling of incomplete
+ source sequences, enhanced error detection, added casts
+ to eliminate compiler warnings.
+ July 2003: slight mods to back out aggressive FFFE detection.
+ Jan 2004: updated switches in from-UTF8 conversions.
+ Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
+
+ See the header file "ConvertUTF.h" for complete documentation.
+
+------------------------------------------------------------------------ */
+
+
+#include "engines/wintermute/utils/convert_utf.h"
+#ifdef CVTUTF_DEBUG
+#include "common/textconsole.h"
+#endif
+
+namespace Wintermute {
+
+static const int halfShift = 10; /* used for shifting by 10 bits */
+
+static const UTF32 halfBase = 0x0010000UL;
+static const UTF32 halfMask = 0x3FFUL;
+
+#define UNI_SUR_HIGH_START (UTF32)0xD800
+#define UNI_SUR_HIGH_END (UTF32)0xDBFF
+#define UNI_SUR_LOW_START (UTF32)0xDC00
+#define UNI_SUR_LOW_END (UTF32)0xDFFF
+#define false 0
+#define true 1
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF32toUTF16(
+ const UTF32 **sourceStart, const UTF32 *sourceEnd,
+ UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF32 *source = *sourceStart;
+ UTF16 *target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch;
+ if (target >= targetEnd) {
+ result = targetExhausted;
+ break;
+ }
+ ch = *source++;
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_LEGAL_UTF32) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ --source; /* Back up source pointer! */
+ result = targetExhausted;
+ break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF16toUTF32(
+ const UTF16 **sourceStart, const UTF16 *sourceEnd,
+ UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF16 *source = *sourceStart;
+ UTF32 *target = *targetStart;
+ UTF32 ch, ch2;
+ while (source < sourceEnd) {
+ const UTF16 *oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ if (target >= targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ result = targetExhausted;
+ break;
+ }
+ *target++ = ch;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+#ifdef CVTUTF_DEBUG
+ if (result == sourceIllegal) {
+ warning("ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
+ }
+#endif
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Index into the table below with the first byte of a UTF-8 sequence to
+ * get the number of trailing bytes that are supposed to follow it.
+ * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
+ * left as-is for anyone who may want to do such conversion, which was
+ * allowed in earlier algorithms.
+ */
+static const char trailingBytesForUTF8[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 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, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
+};
+
+/*
+ * Magic values subtracted from a buffer value during UTF8 conversion.
+ * This table contains as many values as there might be trailing bytes
+ * in a UTF-8 sequence.
+ */
+static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL
+ };
+
+/*
+ * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
+ * into the first byte, depending on how many bytes follow. There are
+ * as many entries in this table as there are UTF-8 sequence types.
+ * (I.e., one byte sequence, two byte... etc.). Remember that sequencs
+ * for *legal* UTF-8 will be 4 or fewer bytes total.
+ */
+static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+/* --------------------------------------------------------------------- */
+
+/* The interface converts a whole buffer to avoid function-call overhead.
+ * Constants have been gathered. Loops & conditionals have been removed as
+ * much as possible for efficiency, in favor of drop-through switches.
+ * (See "Note A" at the bottom of the file for equivalent code.)
+ * If your compiler supports it, the "isLegalUTF8" call can be turned
+ * into an inline function.
+ */
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF16toUTF8(
+ const UTF16 **sourceStart, const UTF16 *sourceEnd,
+ UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF16 *source = *sourceStart;
+ UTF8 *target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ const UTF16 *oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ UTF32 ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /* Figure out how many bytes the result will require */
+ if (ch < (UTF32)0x80) {
+ bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) {
+ bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) {
+ bytesToWrite = 3;
+ } else if (ch < (UTF32)0x110000) {
+ bytesToWrite = 4;
+ } else {
+ bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ target -= bytesToWrite;
+ result = targetExhausted;
+ break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4:
+ *--target = (UTF8)((ch | byteMark) & byteMask);
+ ch >>= 6;
+ case 3:
+ *--target = (UTF8)((ch | byteMark) & byteMask);
+ ch >>= 6;
+ case 2:
+ *--target = (UTF8)((ch | byteMark) & byteMask);
+ ch >>= 6;
+ case 1:
+ *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Utility routine to tell whether a sequence of bytes is legal UTF-8.
+ * This must be called with the length pre-determined by the first byte.
+ * If not calling this from ConvertUTF8to*, then the length can be set by:
+ * length = trailingBytesForUTF8[*source]+1;
+ * and the sequence is illegal right away if there aren't that many bytes
+ * available.
+ * If presented with a length > 4, this returns false. The Unicode
+ * definition of UTF-8 goes up to 4-byte sequences.
+ */
+
+static Boolean isLegalUTF8(const UTF8 *source, int length) {
+ UTF8 a;
+ const UTF8 *srcptr = source + length;
+ switch (length) {
+ default:
+ return false;
+ /* Everything else falls through when "true"... */
+ case 4:
+ if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 3:
+ if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 2:
+ if ((a = (*--srcptr)) > 0xBF) return false;
+
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0:
+ if (a < 0xA0) return false;
+ break;
+ case 0xED:
+ if (a > 0x9F) return false;
+ break;
+ case 0xF0:
+ if (a < 0x90) return false;
+ break;
+ case 0xF4:
+ if (a > 0x8F) return false;
+ break;
+ default:
+ if (a < 0x80) return false;
+ }
+
+ case 1:
+ if (*source >= 0x80 && *source < 0xC2) return false;
+ }
+ if (*source > 0xF4) return false;
+ return true;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Exported function to return whether a UTF-8 sequence is legal or not.
+ * This is not used here; it's just exported.
+ */
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
+ int length = trailingBytesForUTF8[*source] + 1;
+ if (source + length > sourceEnd) {
+ return false;
+ }
+ return isLegalUTF8(source, length);
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF8toUTF16(
+ const UTF8 **sourceStart, const UTF8 *sourceEnd,
+ UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF8 *source = *sourceStart;
+ UTF16 *target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted;
+ break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead + 1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5:
+ ch += *source++;
+ ch <<= 6; /* remember, illegal UTF-8 */
+ case 4:
+ ch += *source++;
+ ch <<= 6; /* remember, illegal UTF-8 */
+ case 3:
+ ch += *source++;
+ ch <<= 6;
+ case 2:
+ ch += *source++;
+ ch <<= 6;
+ case 1:
+ ch += *source++;
+ ch <<= 6;
+ case 0:
+ ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead + 1); /* Back up source pointer! */
+ result = targetExhausted;
+ break;
+ }
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead + 1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_UTF16) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ source -= (extraBytesToRead + 1); /* return to the start */
+ break; /* Bail out; shouldn't continue */
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ source -= (extraBytesToRead + 1); /* Back up source pointer! */
+ result = targetExhausted;
+ break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF32toUTF8(
+ const UTF32 **sourceStart, const UTF32 *sourceEnd,
+ UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF32 *source = *sourceStart;
+ UTF8 *target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ ch = *source++;
+ if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /*
+ * Figure out how many bytes the result will require. Turn any
+ * illegally large UTF32 things (> Plane 17) into replacement chars.
+ */
+ if (ch < (UTF32)0x80) {
+ bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) {
+ bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) {
+ bytesToWrite = 3;
+ } else if (ch <= UNI_MAX_LEGAL_UTF32) {
+ bytesToWrite = 4;
+ } else {
+ bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ result = sourceIllegal;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ --source; /* Back up source pointer! */
+ target -= bytesToWrite;
+ result = targetExhausted;
+ break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4:
+ *--target = (UTF8)((ch | byteMark) & byteMask);
+ ch >>= 6;
+ case 3:
+ *--target = (UTF8)((ch | byteMark) & byteMask);
+ ch >>= 6;
+ case 2:
+ *--target = (UTF8)((ch | byteMark) & byteMask);
+ ch >>= 6;
+ case 1:
+ *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF8toUTF32(
+ const UTF8 **sourceStart, const UTF8 *sourceEnd,
+ UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF8 *source = *sourceStart;
+ UTF32 *target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted;
+ break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead + 1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5:
+ ch += *source++;
+ ch <<= 6;
+ case 4:
+ ch += *source++;
+ ch <<= 6;
+ case 3:
+ ch += *source++;
+ ch <<= 6;
+ case 2:
+ ch += *source++;
+ ch <<= 6;
+ case 1:
+ ch += *source++;
+ ch <<= 6;
+ case 0:
+ ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead + 1); /* Back up the source pointer! */
+ result = targetExhausted;
+ break;
+ }
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ /*
+ * UTF-16 surrogate values are illegal in UTF-32, and anything
+ * over Plane 17 (> 0x10FFFF) is illegal.
+ */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead + 1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = ch;
+ }
+ } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+ result = sourceIllegal;
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* ---------------------------------------------------------------------
+
+ Note A.
+ The fall-through switches in UTF-8 reading code save a
+ temp variable, some decrements & conditionals. The switches
+ are equivalent to the following loop:
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
+ In UTF-8 writing code, the switches on "bytesToWrite" are
+ similarly unrolled loops.
+
+ --------------------------------------------------------------------- */
+
+} // End of namespace Wintermute
diff --git a/engines/wintermute/utils/convert_utf.h b/engines/wintermute/utils/convert_utf.h
new file mode 100644
index 0000000000..a5f34456f5
--- /dev/null
+++ b/engines/wintermute/utils/convert_utf.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ *
+ * Disclaimer
+ *
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ *
+ * Limitations on Rights to Redistribute This Code
+ *
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+// NOTE: Modifications have been made to the code for inclusion
+// into ScummVM.
+
+/* ---------------------------------------------------------------------
+
+ Conversions between UTF32, UTF-16, and UTF-8. Header file.
+
+ Several funtions are included here, forming a complete set of
+ conversions between the three formats. UTF-7 is not included
+ here, but is handled in a separate source file.
+
+ Each of these routines takes pointers to input buffers and output
+ buffers. The input buffers are const.
+
+ Each routine converts the text between *sourceStart and sourceEnd,
+ putting the result into the buffer between *targetStart and
+ targetEnd. Note: the end pointers are *after* the last item: e.g.
+ *(sourceEnd - 1) is the last item.
+
+ The return result indicates whether the conversion was successful,
+ and if not, whether the problem was in the source or target buffers.
+ (Only the first encountered problem is indicated.)
+
+ After the conversion, *sourceStart and *targetStart are both
+ updated to point to the end of last text successfully converted in
+ the respective buffers.
+
+ Input parameters:
+ sourceStart - pointer to a pointer to the source buffer.
+ The contents of this are modified on return so that
+ it points at the next thing to be converted.
+ targetStart - similarly, pointer to pointer to the target buffer.
+ sourceEnd, targetEnd - respectively pointers to the ends of the
+ two buffers, for overflow checking only.
+
+ These conversion functions take a ConversionFlags argument. When this
+ flag is set to strict, both irregular sequences and isolated surrogates
+ will cause an error. When the flag is set to lenient, both irregular
+ sequences and isolated surrogates are converted.
+
+ Whether the flag is strict or lenient, all illegal sequences will cause
+ an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
+ or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
+ must check for illegal sequences.
+
+ When the flag is set to lenient, characters over 0x10FFFF are converted
+ to the replacement character; otherwise (when the flag is set to strict)
+ they constitute an error.
+
+ Output parameters:
+ The value "sourceIllegal" is returned from some routines if the input
+ sequence is malformed. When "sourceIllegal" is returned, the source
+ value will point to the illegal value that caused the problem. E.g.,
+ in UTF-8 when a sequence is malformed, it points to the start of the
+ malformed sequence.
+
+ Author: Mark E. Davis, 1994.
+ Rev History: Rick McGowan, fixes & updates May 2001.
+ Fixes & updates, Sept 2001.
+
+------------------------------------------------------------------------ */
+
+/* ---------------------------------------------------------------------
+ The following 4 definitions are compiler-specific.
+ The C standard does not guarantee that wchar_t has at least
+ 16 bits, so wchar_t is no less portable than unsigned short!
+ All should be unsigned values to avoid sign extension during
+ bit mask & shift operations.
+------------------------------------------------------------------------ */
+#include "common/system.h"
+
+namespace Wintermute {
+
+typedef uint32 UTF32; /* at least 32 bits */
+typedef uint16 UTF16; /* at least 16 bits */
+typedef uint8 UTF8; /* typically 8 bits */
+typedef uint8 Boolean; /* 0 or 1 */
+
+/* Some fundamental constants */
+#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
+#define UNI_MAX_BMP (UTF32)0x0000FFFF
+#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
+#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
+#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
+
+typedef enum {
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
+} ConversionResult;
+
+typedef enum {
+ strictConversion = 0,
+ lenientConversion
+} ConversionFlags;
+
+ConversionResult ConvertUTF8toUTF16(
+ const UTF8 **sourceStart, const UTF8 *sourceEnd,
+ UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF8(
+ const UTF16 **sourceStart, const UTF16 *sourceEnd,
+ UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF8toUTF32(
+ const UTF8 **sourceStart, const UTF8 *sourceEnd,
+ UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF8(
+ const UTF32 **sourceStart, const UTF32 *sourceEnd,
+ UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF32(
+ const UTF16 **sourceStart, const UTF16 *sourceEnd,
+ UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF16(
+ const UTF32 **sourceStart, const UTF32 *sourceEnd,
+ UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags);
+
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
+
+} // End of namespace Wintermute
+
+/* --------------------------------------------------------------------- */
diff --git a/engines/wintermute/utils/crc.cpp b/engines/wintermute/utils/crc.cpp
new file mode 100644
index 0000000000..e7ec45511b
--- /dev/null
+++ b/engines/wintermute/utils/crc.cpp
@@ -0,0 +1,237 @@
+/**********************************************************************
+ *
+ * Filename: crc.c
+ *
+ * Description: Slow and fast implementations of the CRC standards.
+ *
+ * Notes: The parameters for each supported CRC standard are
+ * defined in the header file crc.h. The implementations
+ * here should stand up to further additions to that list.
+ *
+ *
+ * Copyright (c) 2000 by Michael Barr. This software is placed into
+ * the public domain and may be used for any purpose. However, this
+ * notice must not be changed or removed and no warranty is either
+ * expressed or implied by its publication or distribution.
+ **********************************************************************/
+
+#include "engines/wintermute/utils/crc.h"
+
+namespace Wintermute {
+
+/*
+ * Derive parameters from the standard-specific parameters in crc.h.
+ */
+#define WIDTH (8 * sizeof(crc))
+#define TOPBIT (1 << (WIDTH - 1))
+
+#if (REFLECT_DATA == TRUE)
+#undef REFLECT_DATA
+#define REFLECT_DATA(X) ((unsigned char) reflect((X), 8))
+#else
+#undef REFLECT_DATA
+#define REFLECT_DATA(X) (X)
+#endif
+
+#if (REFLECT_REMAINDER == TRUE)
+#undef REFLECT_REMAINDER
+#define REFLECT_REMAINDER(X) ((crc) reflect((X), WIDTH))
+#else
+#undef REFLECT_REMAINDER
+#define REFLECT_REMAINDER(X) (X)
+#endif
+
+
+/*********************************************************************
+ *
+ * Function: reflect()
+ *
+ * Description: Reorder the bits of a binary sequence, by reflecting
+ * them about the middle position.
+ *
+ * Notes: No checking is done that nBits <= 32.
+ *
+ * Returns: The reflection of the original data.
+ *
+ *********************************************************************/
+static unsigned long
+reflect(unsigned long data, unsigned char nBits) {
+ unsigned long reflection = 0x00000000;
+ unsigned char bit;
+
+ /*
+ * Reflect the data about the center bit.
+ */
+ for (bit = 0; bit < nBits; ++bit) {
+ /*
+ * If the LSB bit is set, set the reflection of it.
+ */
+ if (data & 0x01) {
+ reflection |= (1 << ((nBits - 1) - bit));
+ }
+
+ data = (data >> 1);
+ }
+
+ return (reflection);
+
+} /* reflect() */
+
+
+/*********************************************************************
+ *
+ * Function: crcSlow()
+ *
+ * Description: Compute the CRC of a given message.
+ *
+ * Notes:
+ *
+ * Returns: The CRC of the message.
+ *
+ *********************************************************************/
+crc
+crcSlow(unsigned char const message[], int nBytes) {
+ crc remainder = INITIAL_REMAINDER;
+ int byte;
+ unsigned char bit;
+
+
+ /*
+ * Perform modulo-2 division, a byte at a time.
+ */
+ for (byte = 0; byte < nBytes; ++byte) {
+ /*
+ * Bring the next byte into the remainder.
+ */
+ remainder ^= (REFLECT_DATA(message[byte]) << (WIDTH - 8));
+
+ /*
+ * Perform modulo-2 division, a bit at a time.
+ */
+ for (bit = 8; bit > 0; --bit) {
+ /*
+ * Try to divide the current data bit.
+ */
+ if (remainder & TOPBIT) {
+ remainder = (remainder << 1) ^ POLYNOMIAL;
+ } else {
+ remainder = (remainder << 1);
+ }
+ }
+ }
+
+ /*
+ * The final remainder is the CRC result.
+ */
+ return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);
+
+} /* crcSlow() */
+
+
+crc crcTable[256];
+
+
+/*********************************************************************
+ *
+ * Function: crcInit()
+ *
+ * Description: Populate the partial CRC lookup table.
+ *
+ * Notes: This function must be rerun any time the CRC standard
+ * is changed. If desired, it can be run "offline" and
+ * the table results stored in an embedded system's ROM.
+ *
+ * Returns: None defined.
+ *
+ *********************************************************************/
+void
+crcInit(void) {
+ crc remainder;
+ int dividend;
+ unsigned char bit;
+
+
+ /*
+ * Compute the remainder of each possible dividend.
+ */
+ for (dividend = 0; dividend < 256; ++dividend) {
+ /*
+ * Start with the dividend followed by zeros.
+ */
+ remainder = dividend << (WIDTH - 8);
+
+ /*
+ * Perform modulo-2 division, a bit at a time.
+ */
+ for (bit = 8; bit > 0; --bit) {
+ /*
+ * Try to divide the current data bit.
+ */
+ if (remainder & TOPBIT) {
+ remainder = (remainder << 1) ^ POLYNOMIAL;
+ } else {
+ remainder = (remainder << 1);
+ }
+ }
+
+ /*
+ * Store the result into the table.
+ */
+ crcTable[dividend] = remainder;
+ }
+
+} /* crcInit() */
+
+
+/*********************************************************************
+ *
+ * Function: crcFast()
+ *
+ * Description: Compute the CRC of a given message.
+ *
+ * Notes: crcInit() must be called first.
+ *
+ * Returns: The CRC of the message.
+ *
+ *********************************************************************/
+crc
+crcFast(unsigned char const message[], int nBytes) {
+ crc remainder = INITIAL_REMAINDER;
+ unsigned char data;
+ int byte;
+
+
+ /*
+ * Divide the message by the polynomial, a byte at a time.
+ */
+ for (byte = 0; byte < nBytes; ++byte) {
+ data = (unsigned char)(REFLECT_DATA(message[byte]) ^ (remainder >> (WIDTH - 8)));
+ remainder = crcTable[data] ^ (remainder << 8);
+ }
+
+ /*
+ * The final remainder is the CRC.
+ */
+ return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);
+
+} /* crcFast() */
+
+
+
+crc crc_initialize(void) {
+ crcInit();
+ return INITIAL_REMAINDER;
+}
+
+crc crc_process_byte(unsigned char byteVal, crc remainder) {
+ unsigned char data;
+ data = (unsigned char)(REFLECT_DATA(byteVal) ^ (remainder >> (WIDTH - 8)));
+ remainder = crcTable[data] ^ (remainder << 8);
+ return remainder;
+}
+
+crc crc_finalize(crc remainder) {
+ return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/utils/crc.h b/engines/wintermute/utils/crc.h
new file mode 100644
index 0000000000..77c2ea267f
--- /dev/null
+++ b/engines/wintermute/utils/crc.h
@@ -0,0 +1,85 @@
+/**********************************************************************
+ *
+ * Filename: crc.h
+ *
+ * Description: A header file describing the various CRC standards.
+ *
+ * Notes:
+ *
+ *
+ * Copyright (c) 2000 by Michael Barr. This software is placed into
+ * the public domain and may be used for any purpose. However, this
+ * notice must not be changed or removed and no warranty is either
+ * expressed or implied by its publication or distribution.
+ **********************************************************************/
+
+#ifndef _crc_h
+#define _crc_h
+
+#include "common/system.h" // For types.
+
+namespace Wintermute {
+
+#ifndef TRUE
+#define FALSE 0
+#define TRUE !FALSE
+#endif
+
+/*
+ * Select the CRC standard from the list that follows.
+ */
+#define CRC32
+
+#if defined(CRC_CCITT)
+
+typedef uint16 crc;
+
+#define CRC_NAME "CRC-CCITT"
+#define POLYNOMIAL 0x1021
+#define INITIAL_REMAINDER 0xFFFF
+#define FINAL_XOR_VALUE 0x0000
+#define REFLECT_DATA FALSE
+#define REFLECT_REMAINDER FALSE
+#define CHECK_VALUE 0x29B1
+
+#elif defined(CRC16)
+
+typedef uint16 crc;
+
+#define CRC_NAME "CRC-16"
+#define POLYNOMIAL 0x8005
+#define INITIAL_REMAINDER 0x0000
+#define FINAL_XOR_VALUE 0x0000
+#define REFLECT_DATA TRUE
+#define REFLECT_REMAINDER TRUE
+#define CHECK_VALUE 0xBB3D
+
+#elif defined(CRC32)
+
+typedef uint32 crc;
+
+#define CRC_NAME "CRC-32"
+#define POLYNOMIAL 0x04C11DB7
+#define INITIAL_REMAINDER 0xFFFFFFFF
+#define FINAL_XOR_VALUE 0xFFFFFFFF
+#define REFLECT_DATA TRUE
+#define REFLECT_REMAINDER TRUE
+#define CHECK_VALUE 0xCBF43926
+
+#else
+
+#error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd."
+
+#endif
+
+void crcInit(void);
+crc crcSlow(unsigned char const message[], int nBytes);
+crc crcFast(unsigned char const message[], int nBytes);
+
+extern "C" crc crc_initialize(void);
+extern "C" crc crc_process_byte(unsigned char byteVal, crc remainder);
+extern "C" crc crc_finalize(crc remainder);
+
+} // End of namespace Wintermute
+
+#endif /* _crc_h */
diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp
new file mode 100644
index 0000000000..298f0c268f
--- /dev/null
+++ b/engines/wintermute/utils/path_util.cpp
@@ -0,0 +1,101 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "common/file.h"
+#include "engines/wintermute/utils/path_util.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::unifySeparators(const AnsiString &path) {
+ AnsiString newPath = path;
+
+ for (uint32 i = 0; i < newPath.size(); i++) {
+ if (newPath[i] == '\\') {
+ newPath.setChar('/', i);
+ }
+ }
+
+ return newPath;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::normalizeFileName(const AnsiString &path) {
+ AnsiString newPath = unifySeparators(path);
+ newPath.toLowercase();
+ return newPath;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) {
+ AnsiString newPath1 = unifySeparators(path1);
+ AnsiString newPath2 = unifySeparators(path2);
+
+ if (!newPath1.hasSuffix("/") && !newPath2.hasPrefix("/")) {
+ newPath1 += "/";
+ }
+
+ return newPath1 + newPath2;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::getDirectoryName(const AnsiString &path) {
+ AnsiString newPath = unifySeparators(path);
+ Common::String filename = getFileName(path);
+ return Common::String(path.c_str(), path.size() - filename.size());
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::getFileName(const AnsiString &path) {
+ AnsiString newPath = unifySeparators(path);
+ Common::String lastPart = Common::lastPathComponent(newPath, '/');
+ if (lastPart[lastPart.size() - 1 ] != '/') {
+ return lastPart;
+ } else {
+ return path;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::getFileNameWithoutExtension(const AnsiString &path) {
+ AnsiString fileName = getFileName(path);
+ // TODO: Prettify this.
+ AnsiString extension = Common::lastPathComponent(fileName, '.');
+ for (uint32 i = 0; i < extension.size() + 1; i++) {
+ fileName.deleteLastChar();
+ }
+ return fileName;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString PathUtil::getExtension(const AnsiString &path) {
+ AnsiString fileName = getFileName(path);
+ return Common::lastPathComponent(path, '.');
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h
new file mode 100644
index 0000000000..7358c2aba0
--- /dev/null
+++ b/engines/wintermute/utils/path_util.h
@@ -0,0 +1,49 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_PATHUTILS_H
+#define WINTERMUTE_PATHUTILS_H
+
+#include "engines/wintermute/dctypes.h"
+
+namespace Wintermute {
+
+class PathUtil {
+public:
+ static AnsiString unifySeparators(const AnsiString &path);
+ static AnsiString normalizeFileName(const AnsiString &path);
+ static AnsiString combine(const AnsiString &path1, const AnsiString &path2);
+ static AnsiString getDirectoryName(const AnsiString &path);
+ static AnsiString getFileName(const AnsiString &path);
+ static AnsiString getFileNameWithoutExtension(const AnsiString &path);
+ static AnsiString getExtension(const AnsiString &path);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp
new file mode 100644
index 0000000000..2c3be8c2f5
--- /dev/null
+++ b/engines/wintermute/utils/string_util.cpp
@@ -0,0 +1,232 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "common/tokenizer.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/utils/convert_utf.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////////
+bool StringUtil::compareNoCase(const AnsiString &str1, const AnsiString &str2) {
+ return (str1.compareToIgnoreCase(str2) == 0);
+}
+
+//////////////////////////////////////////////////////////////////////////
+/*bool StringUtil::CompareNoCase(const WideString &str1, const WideString &str2) {
+ WideString str1lc = str1;
+ WideString str2lc = str2;
+
+ ToLowerCase(str1lc);
+ ToLowerCase(str2lc);
+
+ return (str1lc == str2lc);
+}*/
+
+//////////////////////////////////////////////////////////////////////////
+WideString StringUtil::utf8ToWide(const Utf8String &Utf8Str) {
+ error("StringUtil::Utf8ToWide - WideString not supported yet");
+ /* size_t WideSize = Utf8Str.size();
+
+ if (sizeof(wchar_t) == 2) {
+ wchar_t *WideStringNative = new wchar_t[WideSize + 1];
+
+ const UTF8 *SourceStart = reinterpret_cast<const UTF8 *>(Utf8Str.c_str());
+ const UTF8 *SourceEnd = SourceStart + WideSize;
+
+ UTF16 *TargetStart = reinterpret_cast<UTF16 *>(WideStringNative);
+ UTF16 *TargetEnd = TargetStart + WideSize + 1;
+
+ ConversionResult res = ConvertUTF8toUTF16(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion);
+ if (res != conversionOK) {
+ delete[] WideStringNative;
+ return L"";
+ }
+ *TargetStart = 0;
+ WideString ResultString(WideStringNative);
+ delete[] WideStringNative;
+
+ return ResultString;
+ } else if (sizeof(wchar_t) == 4) {
+ wchar_t *WideStringNative = new wchar_t[WideSize + 1];
+
+ const UTF8 *SourceStart = reinterpret_cast<const UTF8 *>(Utf8Str.c_str());
+ const UTF8 *SourceEnd = SourceStart + WideSize;
+
+ UTF32 *TargetStart = reinterpret_cast<UTF32 *>(WideStringNative);
+ UTF32 *TargetEnd = TargetStart + WideSize;
+
+ ConversionResult res = ConvertUTF8toUTF32(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion);
+ if (res != conversionOK) {
+ delete[] WideStringNative;
+ return L"";
+ }
+ *TargetStart = 0;
+ WideString ResultString(WideStringNative);
+ delete[] WideStringNative;
+
+ return ResultString;
+ } else {
+ return L"";
+ }*/
+ return "";
+}
+
+//////////////////////////////////////////////////////////////////////////
+Utf8String StringUtil::wideToUtf8(const WideString &WideStr) {
+ error("StringUtil::wideToUtf8 - Widestring not supported yet");
+ /* size_t WideSize = WideStr.length();
+
+ if (sizeof(wchar_t) == 2) {
+ size_t utf8Size = 3 * WideSize + 1;
+ char *utf8StringNative = new char[Utf8Size];
+
+ const UTF16 *SourceStart = reinterpret_cast<const UTF16 *>(WideStr.c_str());
+ const UTF16 *SourceEnd = SourceStart + WideSize;
+
+ UTF8 *TargetStart = reinterpret_cast<UTF8 *>(Utf8StringNative);
+ UTF8 *TargetEnd = TargetStart + Utf8Size;
+
+ ConversionResult res = ConvertUTF16toUTF8(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion);
+ if (res != conversionOK) {
+ delete[] Utf8StringNative;
+ return (Utf8String)"";
+ }
+ *TargetStart = 0;
+ Utf8String ResultString(Utf8StringNative);
+ delete[] Utf8StringNative;
+ return ResultString;
+ } else if (sizeof(wchar_t) == 4) {
+ size_t utf8Size = 4 * WideSize + 1;
+ char *utf8StringNative = new char[Utf8Size];
+
+ const UTF32 *SourceStart = reinterpret_cast<const UTF32 *>(WideStr.c_str());
+ const UTF32 *SourceEnd = SourceStart + WideSize;
+
+ UTF8 *TargetStart = reinterpret_cast<UTF8 *>(Utf8StringNative);
+ UTF8 *TargetEnd = TargetStart + Utf8Size;
+
+ ConversionResult res = ConvertUTF32toUTF8(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion);
+ if (res != conversionOK) {
+ delete[] Utf8StringNative;
+ return (Utf8String)"";
+ }
+ *TargetStart = 0;
+ Utf8String ResultString(Utf8StringNative);
+ delete[] Utf8StringNative;
+ return ResultString;
+ } else {
+ return (Utf8String)"";
+ }*/
+ return "";
+}
+
+// Currently this only does Ansi->ISO 8859, and only for carets.
+char simpleAnsiToWide(const AnsiString &str, uint32 &offset) {
+ char c = str[offset];
+
+ if (c == 92) {
+ offset++;
+ return '\'';
+ } else {
+ offset++;
+ return c;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+WideString StringUtil::ansiToWide(const AnsiString &str) {
+ // TODO: This function gets called a lot, so warnings like these drown out the usefull information
+ /*Common::String converted = "";
+ uint32 index = 0;
+ while (index != str.size()) {
+ converted += simpleAnsiToWide(str, index);
+ }*/
+ // using default os locale!
+
+ /* setlocale(LC_CTYPE, "");
+ size_t wideSize = mbstowcs(NULL, str.c_str(), 0) + 1;
+ wchar_t *wstr = new wchar_t[WideSize];
+ mbstowcs(wstr, str.c_str(), WideSize);
+ WideString ResultString(wstr);
+ delete[] wstr;
+ return ResultString;*/
+ return WideString(str);
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString StringUtil::wideToAnsi(const WideString &wstr) {
+ // using default os locale!
+ // TODO: This function gets called a lot, so warnings like these drown out the usefull information
+ /* setlocale(LC_CTYPE, "");
+ size_t wideSize = wcstombs(NULL, wstr.c_str(), 0) + 1;
+ char *str = new char[WideSize];
+ wcstombs(str, wstr.c_str(), WideSize);
+ AnsiString ResultString(str);
+ delete[] str;
+ return ResultString;*/
+ return AnsiString(wstr);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool StringUtil::isUtf8BOM(const byte *buffer, uint32 bufferSize) {
+ if (bufferSize > 3 && buffer[0] == 0xEF && buffer[1] == 0xBB && buffer[2] == 0xBF) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
+ const char *index = strstr(str.c_str(), toFind.c_str());
+ if (index == NULL) {
+ return -1;
+ } else {
+ return index - str.c_str();
+ }
+}
+
+Common::String StringUtil::encodeSetting(const Common::String &str) {
+ if (str.contains('=')) {
+ error("Setting contains '='");
+ }
+ return str;
+}
+
+Common::String StringUtil::decodeSetting(const Common::String &str) {
+ return str;
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString StringUtil::toString(int val) {
+ return Common::String::format("%d", val);
+}
+
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/utils/string_util.h b/engines/wintermute/utils/string_util.h
new file mode 100644
index 0000000000..e419e2bca8
--- /dev/null
+++ b/engines/wintermute/utils/string_util.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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_STRINGUTIL_H
+#define WINTERMUTE_STRINGUTIL_H
+
+#include "engines/wintermute/dctypes.h"
+
+namespace Wintermute {
+
+class StringUtil {
+public:
+ static bool compareNoCase(const AnsiString &str1, const AnsiString &str2);
+ //static bool compareNoCase(const WideString &str1, const WideString &str2);
+ static WideString utf8ToWide(const Utf8String &Utf8Str);
+ static Utf8String wideToUtf8(const WideString &WideStr);
+ static WideString ansiToWide(const AnsiString &str);
+ static AnsiString wideToAnsi(const WideString &str);
+
+ static bool isUtf8BOM(const byte *buffer, uint32 bufferSize);
+ static int indexOf(const WideString &str, const WideString &toFind, size_t startFrom);
+
+ static Common::String encodeSetting(const Common::String &str);
+ static Common::String decodeSetting(const Common::String &str);
+
+ static AnsiString toString(int val);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp
new file mode 100644
index 0000000000..824b16ccdb
--- /dev/null
+++ b/engines/wintermute/utils/utils.cpp
@@ -0,0 +1,261 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/base/base_engine.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+static inline unsigned Sqr(int x) {
+ return (x * x);
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+// Swap - swaps two integers
+//////////////////////////////////////////////////////////////////////////////////
+void BaseUtils::swap(int *a, int *b) {
+ int temp = *a;
+ *a = *b;
+ *b = temp;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float BaseUtils::normalizeAngle(float angle) {
+ while (angle > 360) {
+ angle -= 360;
+ }
+ while (angle < 0) {
+ angle += 360;
+ }
+
+ return angle;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+void BaseUtils::createPath(const char *path, bool pathOnly) {
+ /* AnsiString pathStr;
+
+ if (!pathOnly) pathStr = PathUtil::getDirectoryName(path);
+ else pathStr = path;
+ */
+// try {
+ warning("BaseUtils::CreatePath - not implemented: %s", path);
+// boost::filesystem::create_directories(path);
+// } catch (...) {
+ return;
+// }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseUtils::debugMessage(const char *text) {
+ //MessageBox(hWnd, Text, "WME", MB_OK|MB_ICONINFORMATION);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *BaseUtils::setString(char **string, const char *value) {
+ delete[] *string;
+ *string = new char[strlen(value) + 1];
+ if (*string) {
+ strcpy(*string, value);
+ }
+ return *string;
+}
+
+//////////////////////////////////////////////////////////////////////////
+char *BaseUtils::strEntry(int entry, const char *str, const char delim) {
+ int numEntries = 0;
+
+ const char *start = NULL;
+ int len = 0;
+
+ for (uint32 i = 0; i <= strlen(str); i++) {
+ if (numEntries == entry) {
+ if (!start) {
+ start = str + i;
+ } else {
+ len++;
+ }
+ }
+ if (str[i] == delim || str[i] == '\0') {
+ numEntries++;
+ if (start) {
+ char *ret = new char[len + 1];
+ memset(ret, 0, len + 1);
+ Common::strlcpy(ret, start, len + 1);
+ return ret;
+ }
+ }
+ }
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int BaseUtils::randomInt(int from, int to) {
+ if (to < from) {
+ int i = to;
+ to = from;
+ from = i;
+ }
+ return BaseEngine::instance().randInt(from, to);
+// return (rand() % (to - from + 1)) + from;
+}
+
+//////////////////////////////////////////////////////////////////////////
+float BaseUtils::randomFloat(float from, float to) {
+ const uint32 randMax = RAND_MAX;
+ float randNum = (float)BaseEngine::instance().randInt(0, randMax) / (float)randMax;
+ return from + (to - from) * randNum;
+}
+
+//////////////////////////////////////////////////////////////////////////
+float BaseUtils::randomAngle(float from, float to) {
+ while (to < from) {
+ to += 360;
+ }
+ return normalizeAngle(randomFloat(from, to));
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseUtils::RGBtoHSL(uint32 rgbColor, byte *outH, byte *outS, byte *outL) {
+ float varR = (RGBCOLGetR(rgbColor) / 255.0f);
+ float varG = (RGBCOLGetG(rgbColor) / 255.0f);
+ float varB = (RGBCOLGetB(rgbColor) / 255.0f);
+
+ //Min. value of RGB
+ float varMin = MIN(varR, varG);
+ varMin = MIN(varMin, varB);
+
+ //Max. value of RGB
+ float varMax = MAX(varR, varG);
+ varMax = MAX(varMax, varB);
+
+ //Delta RGB value
+ float delMax = varMax - varMin;
+
+ float H = 0.0f, S = 0.0f, L = 0.0f;
+
+ L = (varMax + varMin) / 2.0f;
+
+ //This is a gray, no chroma...
+ if (delMax == 0) {
+ H = 0;
+ S = 0;
+ }
+ //Chromatic data...
+ else {
+ if (L < 0.5f) {
+ S = delMax / (varMax + varMin);
+ } else {
+ S = delMax / (2.0f - varMax - varMin);
+ }
+
+ float delR = (((varMax - varR) / 6.0f) + (delMax / 2.0f)) / delMax;
+ float delG = (((varMax - varG) / 6.0f) + (delMax / 2.0f)) / delMax;
+ float delB = (((varMax - varB) / 6.0f) + (delMax / 2.0f)) / delMax;
+
+ if (varR == varMax) {
+ H = delB - delG;
+ } else if (varG == varMax) {
+ H = (1.0f / 3.0f) + delR - delB;
+ } else if (varB == varMax) {
+ H = (2.0f / 3.0f) + delG - delR;
+ }
+
+ if (H < 0) {
+ H += 1;
+ }
+ if (H > 1) {
+ H -= 1;
+ }
+ }
+
+ *outH = (byte)(H * 255);
+ *outS = (byte)(S * 255);
+ *outL = (byte)(L * 255);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseUtils::HSLtoRGB(byte InH, byte InS, byte InL) {
+ float H = InH / 255.0f;
+ float S = InS / 255.0f;
+ float L = InL / 255.0f;
+
+ byte R, G, B;
+
+
+ if (S == 0) {
+ R = (byte)(L * 255);
+ G = (byte)(L * 255);
+ B = (byte)(L * 255);
+ } else {
+ float var1, var2;
+
+ if (L < 0.5) {
+ var2 = L * (1.0 + S);
+ } else {
+ var2 = (L + S) - (S * L);
+ }
+
+ var1 = 2.0f * L - var2;
+
+ R = (byte)(255 * Hue2RGB(var1, var2, H + (1.0f / 3.0f)));
+ G = (byte)(255 * Hue2RGB(var1, var2, H));
+ B = (byte)(255 * Hue2RGB(var1, var2, H - (1.0f / 3.0f)));
+ }
+ return BYTETORGBA(255, R, G, B);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float BaseUtils::Hue2RGB(float v1, float v2, float vH) {
+ if (vH < 0.0f) {
+ vH += 1.0f;
+ }
+ if (vH > 1.0f) {
+ vH -= 1.0f;
+ }
+ if ((6.0f * vH) < 1.0f) {
+ return (v1 + (v2 - v1) * 6.0f * vH);
+ }
+ if ((2.0f * vH) < 1.0f) {
+ return (v2);
+ }
+ if ((3.0f * vH) < 2.0f) {
+ return (v1 + (v2 - v1) * ((2.0f / 3.0f) - vH) * 6.0f);
+ }
+ return (v1);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/utils/utils.h b/engines/wintermute/utils/utils.h
new file mode 100644
index 0000000000..d6a603ec72
--- /dev/null
+++ b/engines/wintermute/utils/utils.h
@@ -0,0 +1,64 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_UTILS_H
+#define WINTERMUTE_UTILS_H
+
+#include "engines/wintermute/wintypes.h"
+#include "engines/wintermute/math/rect32.h"
+
+namespace Wintermute {
+
+class BaseGame;
+
+class BaseUtils {
+public:
+ static void swap(int *a, int *b);
+ static float normalizeAngle(float angle);
+
+ static void createPath(const char *path, bool pathOnly = false);
+
+ static void debugMessage(const char *text);
+ static char *setString(char **string, const char *value);
+
+ static char *strEntry(int entry, const char *str, const char delim = ',');
+
+ static int randomInt(int from, int to);
+ static float randomFloat(float from, float to);
+ static float randomAngle(float from, float to);
+
+ static void RGBtoHSL(uint32 rgbColor, byte *outH, byte *outS, byte *outL);
+ static uint32 HSLtoRGB(byte H, byte S, byte L);
+
+private:
+ static float Hue2RGB(float v1, float v2, float vH);
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/video/video_player.cpp b/engines/wintermute/video/video_player.cpp
new file mode 100644
index 0000000000..2577b8aedc
--- /dev/null
+++ b/engines/wintermute/video/video_player.cpp
@@ -0,0 +1,109 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+
+#include "engines/wintermute/video/video_player.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+VideoPlayer::VideoPlayer(BaseGame *inGame) : BaseClass(inGame) {
+ setDefaults();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::setDefaults() {
+ _playing = false;
+ _videoEndTime = 0;
+ _soundAvailable = false;
+ _startTime = 0;
+ _totalVideoTime = 0;
+ _playPosX = _playPosY = 0;
+ _playZoom = 0.0f;
+
+ _filename = NULL;
+
+ _slowRendering = false;
+
+ _currentSubtitle = 0;
+ _showSubtitle = false;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+VideoPlayer::~VideoPlayer() {
+ cleanup();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::cleanup() {
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::initialize(const char *inFilename, const char *subtitleFile) {
+ warning("VideoPlayer: %s %s - Not implemented yet", inFilename, subtitleFile);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::update() {
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::display() {
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::play(TVideoPlayback type, int x, int y, bool freezeMusic) {
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::stop() {
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::isPlaying() {
+ return _playing;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoPlayer::loadSubtitles(const char *filename, const char *subtitleFile) {
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/video/video_player.h b/engines/wintermute/video/video_player.h
new file mode 100644
index 0000000000..d5466da679
--- /dev/null
+++ b/engines/wintermute/video/video_player.h
@@ -0,0 +1,90 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_VIDPLAYER_H
+#define WINTERMUTE_VIDPLAYER_H
+
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+#include "engines/wintermute/base/base.h"
+
+#define MAX_AUDIO_STREAMS 5
+#define MAX_VIDEO_STREAMS 5
+
+
+namespace Wintermute {
+
+// AVI-Video-player, currently fully stubbed
+class VideoPlayer : public BaseClass {
+public:
+ bool _showSubtitle;
+ int _currentSubtitle;
+ bool loadSubtitles(const char *filename, const char *subtitleFile);
+ bool _slowRendering;
+ bool isPlaying();
+ char *_filename;
+ bool stop();
+ bool play(TVideoPlayback Type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeMusic = true);
+ uint32 _totalVideoTime;
+ uint32 _startTime;
+ //CVidRenderer *_vidRenderer;
+ //BaseSoundAVI *_sound;
+ bool _soundAvailable;
+ bool setDefaults();
+ bool _playing;
+ bool display();
+ bool update();
+ bool initialize(const char *inFilename, const char *subtitleFile = NULL);
+ bool cleanup();
+ VideoPlayer(BaseGame *inGame);
+ virtual ~VideoPlayer();
+
+ /*PAVIFILE _aviFile;
+
+ LONG _lastSample;
+
+ PAVISTREAM _audioStream;
+ PAVISTREAM _videoStream;
+
+ LPWAVEFORMAT _audioFormat;
+
+ LPBITMAPINFO _videoFormat;
+ PGETFRAME _videoPGF;*/
+ uint32 _videoEndTime;
+
+ int _playPosX;
+ int _playPosY;
+ float _playZoom;
+
+ /* LPBITMAPV4HEADER _targetFormat;
+
+ BaseArray<CVidSubtitle *, CVidSubtitle *> _subtitles;*/
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
new file mode 100644
index 0000000000..0f8bc018ea
--- /dev/null
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -0,0 +1,505 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+
+#include "engines/wintermute/video/video_theora_player.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h"
+#include "engines/wintermute/base/gfx/base_image.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "video/theora_decoder.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/system.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(VideoTheoraPlayer, false)
+
+//////////////////////////////////////////////////////////////////////////
+VideoTheoraPlayer::VideoTheoraPlayer(BaseGame *inGame) : BaseClass(inGame) {
+ SetDefaults();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void VideoTheoraPlayer::SetDefaults() {
+
+ _file = NULL;
+ _filename = "";
+ _startTime = 0;
+ _looping = false;
+
+ _freezeGame = false;
+ _currentTime = 0;
+
+ _state = THEORA_STATE_NONE;
+
+ _videoFrameReady = false;
+ _audioFrameReady = false;
+ _videobufTime = 0;
+
+ _playbackStarted = false;
+ _dontDropFrames = false;
+
+ _texture = NULL;
+ _alphaImage = NULL;
+ _alphaFilename = "";
+
+ _frameRendered = false;
+
+ _seekingKeyframe = false;
+ _timeOffset = 0.0f;
+
+ _posX = _posY = 0;
+ _playbackType = VID_PLAY_CENTER;
+ _playZoom = 0.0f;
+
+ _savedState = THEORA_STATE_NONE;
+ _savedPos = 0;
+ _volume = 100;
+ _theoraDecoder = NULL;
+
+ // TODO: Add subtitles-support
+ //_subtitler = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+VideoTheoraPlayer::~VideoTheoraPlayer(void) {
+ cleanup();
+// SAFE_DELETE(_subtitler);
+}
+
+//////////////////////////////////////////////////////////////////////////
+void VideoTheoraPlayer::cleanup() {
+ if (_file) {
+ BaseFileManager::getEngineInstance()->closeFile(_file);
+ _file = NULL;
+ }
+
+ _surface.free();
+ if (_theoraDecoder) {
+ _theoraDecoder->close();
+ }
+ delete _theoraDecoder;
+ _theoraDecoder = NULL;
+ delete _alphaImage;
+ _alphaImage = NULL;
+ delete _texture;
+ _texture = NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) {
+ cleanup();
+
+ _filename = filename;
+ _file = BaseFileManager::getEngineInstance()->openFile(filename, true, false);
+ if (!_file) {
+ return STATUS_FAILED;
+ }
+
+#if defined (USE_THEORADEC)
+ _theoraDecoder = new Video::TheoraDecoder();
+#else
+ return STATUS_FAILED;
+#endif
+ _theoraDecoder->loadStream(_file);
+
+ if (!_theoraDecoder->isVideoLoaded()) {
+ return STATUS_FAILED;
+ }
+
+ _state = THEORA_STATE_PAUSED;
+
+ // Additional setup.
+ _surface.create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight(), _theoraDecoder->getPixelFormat());
+ _texture = new BaseSurfaceOSystem(_gameRef);
+ _texture->create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight());
+ _state = THEORA_STATE_PLAYING;
+ _playZoom = 100;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::resetStream() {
+ warning("VidTheoraPlayer::resetStream - stubbed");
+#if 0 // Stubbed for now, as theora isn't seekable
+ if (_sound) {
+ _sound->Stop();
+ }
+
+ m_TimeOffset = 0.0f;
+ Initialize(m_Filename);
+ Play(m_PlaybackType, m_PosX, m_PosY, false, false, m_Looping, 0, m_PlayZoom);
+#endif
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) {
+ if (forceZoom < 0.0f) {
+ forceZoom = 100.0f;
+ }
+ if (volume < 0) {
+ _volume = _gameRef->_soundMgr->getVolumePercent(Audio::Mixer::kSFXSoundType);
+ } else {
+ _volume = volume;
+ }
+
+ _freezeGame = freezeGame;
+
+ if (!_playbackStarted && _freezeGame) {
+ _gameRef->freeze(freezeMusic);
+ }
+
+ _playbackStarted = false;
+ float width, height;
+ if (_theoraDecoder) {
+ _surface.free();
+ _surface.copyFrom(*_theoraDecoder->decodeNextFrame());
+ _state = THEORA_STATE_PLAYING;
+ _looping = looping;
+ _playbackType = type;
+
+ _startTime = startTime;
+ _volume = volume;
+ _posX = x;
+ _posY = y;
+ _playZoom = forceZoom;
+
+ width = (float)_theoraDecoder->getWidth();
+ height = (float)_theoraDecoder->getHeight();
+ } else {
+ width = (float)_gameRef->_renderer->_width;
+ height = (float)_gameRef->_renderer->_height;
+ }
+
+ switch (type) {
+ case VID_PLAY_POS:
+ _playZoom = forceZoom;
+ _posX = x;
+ _posY = y;
+ break;
+
+ case VID_PLAY_STRETCH: {
+ float zoomX = (float)((float)_gameRef->_renderer->_width / width * 100);
+ float zoomY = (float)((float)_gameRef->_renderer->_height / height * 100);
+ _playZoom = MIN(zoomX, zoomY);
+ _posX = (int)((_gameRef->_renderer->_width - width * (_playZoom / 100)) / 2);
+ _posY = (int)((_gameRef->_renderer->_height - height * (_playZoom / 100)) / 2);
+ }
+ break;
+
+ case VID_PLAY_CENTER:
+ _playZoom = 100.0f;
+ _posX = (int)((_gameRef->_renderer->_width - width) / 2);
+ _posY = (int)((_gameRef->_renderer->_height - height) / 2);
+ break;
+ }
+ _theoraDecoder->start();
+
+ return STATUS_OK;
+#if 0 // Stubbed for now as theora isn't seekable
+ if (StartTime) SeekToTime(StartTime);
+
+ Update();
+#endif
+ return STATUS_FAILED;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::stop() {
+ _theoraDecoder->close();
+ _state = THEORA_STATE_FINISHED;
+ if (_freezeGame) {
+ _gameRef->unfreeze();
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::update() {
+ _currentTime = _freezeGame ? _gameRef->_liveTimer : _gameRef->_timer;
+
+ if (!isPlaying()) {
+ return STATUS_OK;
+ }
+
+ if (_playbackStarted /*&& m_Sound && !m_Sound->IsPlaying()*/) {
+ return STATUS_OK;
+ }
+
+ if (_playbackStarted && !_freezeGame && _gameRef->_state == GAME_FROZEN) {
+ return STATUS_OK;
+ }
+
+ if (_theoraDecoder) {
+ if (_theoraDecoder->endOfVideo() && _looping) {
+ warning("Should loop movie %s", _filename.c_str());
+ _theoraDecoder->rewind();
+ } else if (_theoraDecoder->endOfVideo() && !_looping) {
+ debugC(kWintermuteDebugLog, "Finished movie %s", _filename.c_str());
+ _state = THEORA_STATE_FINISHED;
+ _playbackStarted = false;
+ if (_freezeGame) {
+ _gameRef->unfreeze();
+ }
+ }
+ if (_state == THEORA_STATE_PLAYING) {
+ if (!_theoraDecoder->endOfVideo() && _theoraDecoder->getTimeToNextFrame() == 0) {
+ const Graphics::Surface *decodedFrame = _theoraDecoder->decodeNextFrame();
+ if (decodedFrame) {
+ _surface.free();
+ _surface.copyFrom(*decodedFrame);
+ if (_texture) {
+ writeVideo();
+ }
+ }
+ }
+ return STATUS_OK;
+ }
+ }
+ // Skip the busy-loop?
+ if ((!_texture || !_videoFrameReady) && !_theoraDecoder->endOfVideo()) {
+ // end playback
+ if (!_looping) {
+ _state = THEORA_STATE_FINISHED;
+ if (_freezeGame) {
+ _gameRef->unfreeze();
+ }
+ return STATUS_OK;
+ } else {
+ resetStream();
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 VideoTheoraPlayer::getMovieTime() {
+ if (!_playbackStarted) {
+ return 0;
+ } else {
+ return _theoraDecoder->getTime();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::writeVideo() {
+ if (!_texture) {
+ return STATUS_FAILED;
+ }
+
+ _texture->startPixelOp();
+
+ writeAlpha();
+ if (_alphaImage) {
+ _texture->putSurface(_surface, true);
+ } else {
+ _texture->putSurface(_surface, false);
+ }
+
+ //RenderFrame(_texture, &yuv);
+
+ _texture->endPixelOp();
+ _videoFrameReady = true;
+ return STATUS_OK;
+}
+
+void VideoTheoraPlayer::writeAlpha() {
+ if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) {
+ assert(_alphaImage->getSurface()->format.bytesPerPixel == 4);
+ assert(_surface.format.bytesPerPixel == 4);
+ const byte *alphaData = (const byte *)_alphaImage->getSurface()->getBasePtr(0, 0);
+#ifdef SCUMM_LITTLE_ENDIAN
+ int alphaPlace = (_alphaImage->getSurface()->format.aShift / 8);
+#else
+ int alphaPlace = 3 - (_alphaImage->getSurface()->format.aShift / 8);
+#endif
+ alphaData += alphaPlace;
+ byte *imgData = (byte *)_surface.getBasePtr(0, 0);
+#ifdef SCUMM_LITTLE_ENDIAN
+ imgData += (_surface.format.aShift / 8);
+#else
+ imgData += 3 - (_surface.format.aShift / 8);
+#endif
+ for (int i = 0; i < _surface.w * _surface.h; i++) {
+ *imgData = *alphaData;
+ alphaData += 4;
+ imgData += 4;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::display(uint32 alpha) {
+ Rect32 rc;
+ bool res;
+
+ if (_texture && _videoFrameReady) {
+ BasePlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight());
+ if (_playZoom == 100.0f) {
+ res = _texture->displayTrans(_posX, _posY, rc, alpha);
+ } else {
+ res = _texture->displayTransZoom(_posX, _posY, rc, _playZoom, _playZoom, alpha);
+ }
+ } else {
+ res = STATUS_FAILED;
+ }
+ // TODO: Add subtitles-support
+/* if (m_Subtitler && _gameRef->m_VideoSubtitles) {
+ m_Subtitler->display();
+ }*/
+
+ return res;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) {
+ delete _alphaImage;
+ _alphaImage = new BaseImage();
+ if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) {
+ delete _alphaImage;
+ _alphaImage = NULL;
+ _alphaFilename = "";
+ return STATUS_FAILED;
+ }
+
+ if (_alphaFilename != filename) {
+ _alphaFilename = filename;
+ }
+ //TODO: Conversion.
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+byte VideoTheoraPlayer::getAlphaAt(int x, int y) {
+ if (_alphaImage) {
+ return _alphaImage->getAlphaAt(x, y);
+ } else {
+ return 0xFF;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+inline int intlog(int num) {
+ int r = 0;
+ while (num > 0) {
+ num = num / 2;
+ r = r + 1;
+ }
+
+ return r;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::seekToTime(uint32 time) {
+ warning("VideoTheoraPlayer::SeekToTime(%d) - not supported", time);
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::pause() {
+ if (_state == THEORA_STATE_PLAYING) {
+ _state = THEORA_STATE_PAUSED;
+ _theoraDecoder->pauseVideo(true);
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::resume() {
+ if (_state == THEORA_STATE_PAUSED) {
+ _state = THEORA_STATE_PLAYING;
+ _theoraDecoder->pauseVideo(false);
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) {
+ //BaseClass::persist(persistMgr);
+
+ if (persistMgr->getIsSaving()) {
+ _savedPos = getMovieTime() * 1000;
+ _savedState = _state;
+ } else {
+ SetDefaults();
+ }
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+ persistMgr->transfer(TMEMBER(_savedPos));
+ persistMgr->transfer(TMEMBER(_savedState));
+ persistMgr->transfer(TMEMBER(_filename));
+ persistMgr->transfer(TMEMBER(_alphaFilename));
+ persistMgr->transfer(TMEMBER(_posX));
+ persistMgr->transfer(TMEMBER(_posY));
+ persistMgr->transfer(TMEMBER(_playZoom));
+ persistMgr->transfer(TMEMBER_INT(_playbackType));
+ persistMgr->transfer(TMEMBER(_looping));
+ persistMgr->transfer(TMEMBER(_volume));
+
+ if (!persistMgr->getIsSaving() && (_savedState != THEORA_STATE_NONE)) {
+ initializeSimple();
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool VideoTheoraPlayer::initializeSimple() {
+ if (DID_SUCCEED(initialize(_filename))) {
+ if (_alphaFilename != "") {
+ setAlphaImage(_alphaFilename);
+ }
+ play(_playbackType, _posX, _posY, false, false, _looping, _savedPos, _playZoom);
+ } else {
+ _state = THEORA_STATE_FINISHED;
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSurface *VideoTheoraPlayer::getTexture() {
+ return _texture;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h
new file mode 100644
index 0000000000..593c1b9666
--- /dev/null
+++ b/engines/wintermute/video/video_theora_player.h
@@ -0,0 +1,148 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_VIDTHEORAPLAYER_H
+#define WINTERMUTE_VIDTHEORAPLAYER_H
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/persistent.h"
+#include "video/video_decoder.h"
+#include "common/stream.h"
+#include "graphics/surface.h"
+
+namespace Wintermute {
+class BaseSurface;
+class BaseImage;
+class VideoTheoraPlayer : public BaseClass {
+private:
+ enum {
+ THEORA_STATE_NONE = 0,
+ THEORA_STATE_PLAYING = 1,
+ THEORA_STATE_PAUSED = 2,
+ THEORA_STATE_FINISHED = 3
+ };
+ Video::VideoDecoder *_theoraDecoder;
+ Graphics::Surface _surface;
+public:
+ DECLARE_PERSISTENT(VideoTheoraPlayer, BaseClass)
+
+ VideoTheoraPlayer(BaseGame *inGame);
+ virtual ~VideoTheoraPlayer(void);
+
+ // external objects
+ Common::SeekableReadStream *_file;
+ Common::String _filename;
+
+ BaseSurface *_texture;
+ //CVidSubtitler *_subtitler;
+
+ // control methods
+ bool initialize(const Common::String &filename, const Common::String &subtitleFile = NULL);
+ bool initializeSimple();
+ bool update();
+ bool play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1);
+ bool stop();
+ bool display(uint32 alpha = 0xFFFFFFFF);
+
+ bool pause();
+ bool resume();
+
+ bool isPlaying() {
+ return _state == THEORA_STATE_PLAYING;
+ };
+ bool isFinished() {
+ return _state == THEORA_STATE_FINISHED;
+ };
+ bool isPaused() {
+ return _state == THEORA_STATE_PAUSED;
+ };
+
+ uint32 getMovieTime();
+
+ BaseSurface *getTexture();
+
+ int _state;
+ uint32 _startTime;
+
+ int _savedState;
+ uint32 _savedPos;
+
+
+ // alpha related
+ BaseImage *_alphaImage;
+ Common::String _alphaFilename;
+ bool setAlphaImage(const Common::String &filename);
+ __inline byte getAlphaAt(int x, int y);
+ void writeAlpha();
+
+ bool seekToTime(uint32 Time);
+
+
+ void cleanup();
+ bool resetStream();
+
+ // video properties
+ TVideoPlayback _playbackType;
+ int _posX;
+ int _posY;
+ float _playZoom;
+ int _volume;
+
+ bool _looping;
+ bool _dontDropFrames;
+ bool _freezeGame;
+ uint32 _currentTime;
+
+
+private:
+ // seeking support
+ bool _seekingKeyframe;
+ float _timeOffset;
+
+ bool _frameRendered;
+
+ bool getIsFrameReady() {
+ return _videoFrameReady;
+ }
+private:
+ bool _audioFrameReady;
+ bool _videoFrameReady;
+ float _videobufTime;
+
+ bool writeVideo();
+
+ bool _playbackStarted;
+
+ // helpers
+ void SetDefaults();
+
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
new file mode 100644
index 0000000000..c9726e150a
--- /dev/null
+++ b/engines/wintermute/wintermute.cpp
@@ -0,0 +1,383 @@
+/* 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 "common/config-manager.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "common/EventRecorder.h"
+#include "common/file.h"
+#include "common/fs.h"
+#include "common/tokenizer.h"
+
+#include "engines/util.h"
+#include "engines/wintermute/ad/ad_game.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_engine.h"
+
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/gfx/base_renderer.h"
+#include "engines/wintermute/base/scriptables/script_engine.h"
+
+namespace Wintermute {
+
+// Simple constructor for detection - we need to setup the persistence to avoid special-casing in-engine
+// This might not be the prettiest solution
+WintermuteEngine::WintermuteEngine() : Engine(g_system) {
+ _game = new AdGame("");
+}
+
+WintermuteEngine::WintermuteEngine(OSystem *syst, const ADGameDescription *desc)
+ : Engine(syst), _gameDescription(desc) {
+ // Put your engine in a sane state, but do nothing big yet;
+ // in particular, do not load data from files; rather, if you
+ // need to do such things, do them from init().
+
+ // Do not initialize graphics here
+
+ // However this is the place to specify all default directories
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ //SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
+
+ // Here is the right place to set up the engine specific debug channels
+ DebugMan.addDebugChannel(kWintermuteDebugLog, "enginelog", "Covers the same output as the log-file in WME");
+ DebugMan.addDebugChannel(kWintermuteDebugSaveGame, "savegame", "Savegames");
+ DebugMan.addDebugChannel(kWintermuteDebugFont, "font", "Text-drawing-related messages");
+ DebugMan.addDebugChannel(kWintermuteDebugFileAccess, "file-access", "Non-critical problems like missing files");
+ DebugMan.addDebugChannel(kWintermuteDebugAudio, "audio", "audio-playback-related issues");
+ DebugMan.addDebugChannel(kWintermuteDebugGeneral, "general", "various issues not covered by any of the above");
+
+ _game = NULL;
+}
+
+WintermuteEngine::~WintermuteEngine() {
+ // Dispose your resources here
+ deinit();
+ delete _game;
+ delete _console;
+
+ // Remove all of our debug levels here
+ DebugMan.clearAllDebugChannels();
+}
+
+bool WintermuteEngine::hasFeature(EngineFeature f) const {
+ switch (f) {
+ case kSupportsRTL:
+ return true;
+ case kSupportsLoadingDuringRuntime:
+ return true;
+ case kSupportsSavingDuringRuntime:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}
+
+Common::Error WintermuteEngine::run() {
+ // Initialize graphics using following:
+ Graphics::PixelFormat format(4, 8, 8, 8, 8, 16, 8, 0, 24);
+ initGraphics(800, 600, true, &format);
+ if (g_system->getScreenFormat() != format) {
+ error("Wintermute currently REQUIRES 32bpp");
+ }
+
+ // Create debugger console. It requires GFX to be initialized
+ _console = new Console(this);
+
+// DebugMan.enableDebugChannel("enginelog");
+ debugC(1, kWintermuteDebugLog, "Engine Debug-LOG enabled");
+ debugC(2, kWintermuteDebugSaveGame , "Savegame debugging-enabled");
+
+ int ret = 1;
+
+ // Additional setup.
+ debugC(kWintermuteDebugLog, "WintermuteEngine::init");
+ ret = init();
+
+ debugC(kWintermuteDebugLog, "WintermuteEngine::messageLoop");
+ if (ret == 0) {
+ ret = messageLoop();
+ }
+ deinit();
+ return Common::kNoError;
+}
+
+int WintermuteEngine::init() {
+ BaseEngine::createInstance(_targetName, _gameDescription->language);
+ _game = new AdGame(_targetName);
+ if (!_game) {
+ return 1;
+ }
+ BaseEngine::instance().setGameRef(_game);
+ BasePlatform::initialize(_game, 0, NULL);
+
+ bool windowedMode = !ConfMan.getBool("fullscreen");
+
+ if (ConfMan.hasKey("debug_mode")) {
+ if (ConfMan.getBool("debug_mode")) {
+ _game->DEBUG_DebugEnable("./wme.log");
+ }
+ }
+
+ if (ConfMan.hasKey("show_fps")) {
+ _game->_debugShowFPS = ConfMan.getBool("show_fps");
+ } else {
+ _game->_debugShowFPS = false;
+ }
+
+ if (ConfMan.hasKey("disable_smartcache")) {
+ _game->_smartCache = ConfMan.getBool("disable_smartcache");
+ } else {
+ _game->_smartCache = true;
+ }
+
+ if (!_game->_smartCache) {
+ _game->LOG(0, "Smart cache is DISABLED");
+ }
+
+ // load general game settings
+ _game->initialize1();
+
+ // set gameId, for savegame-naming:
+ _game->setGameId(_targetName);
+
+ if (DID_FAIL(_game->loadSettings("startup.settings"))) {
+ _game->LOG(0, "Error loading game settings.");
+ delete _game;
+ _game = NULL;
+
+ warning("Some of the essential files are missing. Please reinstall.");
+ return 2;
+ }
+
+ _game->initialize2();
+
+ bool ret;
+
+ // initialize the renderer
+ ret = _game->_renderer->initRenderer(_game->_settingsResWidth, _game->_settingsResHeight, windowedMode);
+ if (DID_FAIL(ret)) {
+ _game->LOG(ret, "Error initializing renderer. Exiting.");
+
+ delete _game;
+ _game = NULL;
+ return 3;
+ }
+
+ _game->initialize3();
+
+ // initialize sound manager (non-fatal if we fail)
+ ret = _game->_soundMgr->initialize();
+ if (DID_FAIL(ret)) {
+ _game->LOG(ret, "Sound is NOT available.");
+ }
+
+
+ // load game
+ uint32 dataInitStart = g_system->getMillis();
+
+ if (DID_FAIL(_game->loadFile(_game->_settingsGameFile ? _game->_settingsGameFile : "default.game"))) {
+ _game->LOG(ret, "Error loading game file. Exiting.");
+ delete _game;
+ _game = NULL;
+ return false;
+ }
+
+ _game->_renderer->_ready = true;
+ _game->_miniUpdateEnabled = true;
+
+ _game->LOG(0, "Engine initialized in %d ms", g_system->getMillis() - dataInitStart);
+ _game->LOG(0, "");
+
+ if (ConfMan.hasKey("save_slot")) {
+ int slot = ConfMan.getInt("save_slot");
+ _game->loadGame(slot);
+ }
+
+ // all set, ready to go
+ return 0;
+}
+
+int WintermuteEngine::messageLoop() {
+ bool done = false;
+
+ uint32 prevTime = _system->getMillis();
+ uint32 time = _system->getMillis();
+ uint32 diff = 0;
+
+ const uint32 maxFPS = 60;
+ const uint32 frameTime = (uint32)((1.0 / maxFPS) * 1000);
+ while (!done) {
+ Common::Event event;
+ while (_system->getEventManager()->pollEvent(event)) {
+ BasePlatform::handleEvent(&event);
+ }
+
+ if (_game && _game->_renderer->_active && _game->_renderer->_ready) {
+ _game->displayContent();
+ _game->displayQuickMsg();
+
+ _game->displayDebugInfo();
+
+ time = _system->getMillis();
+ diff = time - prevTime;
+ if (frameTime > diff) { // Avoid overflows
+ _system->delayMillis(frameTime - diff);
+ }
+
+ // ***** flip
+ if (!_game->_suspendedRendering) {
+ _game->_renderer->flip();
+ }
+ if (_game->_loading) {
+ _game->loadGame(_game->_scheduledLoadSlot);
+ }
+ prevTime = time;
+ }
+ if (_game->_quitting) {
+ break;
+ }
+ }
+
+ if (_game) {
+ delete _game;
+ _game = NULL;
+ }
+ return 0;
+}
+
+void WintermuteEngine::deinit() {
+ BaseEngine::destroy();
+}
+
+Common::Error WintermuteEngine::loadGameState(int slot) {
+ BaseEngine::instance().getGameRef()->loadGame(slot);
+ return Common::kNoError;
+}
+
+Common::Error WintermuteEngine::saveGameState(int slot, const Common::String &desc) {
+ BaseEngine::instance().getGameRef()->saveGame(slot, desc.c_str(), false);
+ return Common::kNoError;
+}
+
+bool WintermuteEngine::canSaveGameStateCurrently() {
+ return true;
+}
+
+bool WintermuteEngine::canLoadGameStateCurrently() {
+ return true;
+}
+
+bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String &name, Common::String &caption) {
+ bool retVal = false;
+ caption = name = "(invalid)";
+ Common::SeekableReadStream *stream = NULL;
+ // Quick-fix, instead of possibly breaking the persistence-system, let's just roll with it
+ BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG);
+ fileMan->registerPackages(fslist);
+ stream = fileMan->openFile("startup.settings", false, false);
+
+ // The process is as follows: Check the "GAME=" tag in startup.settings, to decide where the
+ // game-settings are (usually "default.game"), then look into the game-settings to find
+ // the NAME = and CAPTION = tags, to use them to generate a gameid and extras-field
+
+ Common::String settingsGameFile = "default.game";
+ // If the stream-open failed, lets at least attempt to open the default game file afterwards
+ // so, we don't call it a failure yet.
+ if (stream) {
+ while (!stream->eos() && !stream->err()) {
+ Common::String line = stream->readLine();
+ line.trim(); // Get rid of indentation
+ // Expect "SETTINGS {" or comment, or empty line
+ if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) {
+ continue;
+ } else {
+ // We are looking for "GAME ="
+ Common::StringTokenizer token(line, "=");
+ Common::String key = token.nextToken();
+ Common::String value = token.nextToken();
+ if (value.size() == 0) {
+ continue;
+ }
+ if (value[0] == '\"') {
+ value.deleteChar(0);
+ } else {
+ continue;
+ }
+ if (value.lastChar() == '\"') {
+ value.deleteLastChar();
+ }
+ if (key == "GAME") {
+ settingsGameFile = value;
+ break;
+ }
+ }
+ }
+ }
+
+ delete stream;
+ stream = fileMan->openFile(settingsGameFile, false, false);
+ if (stream) {
+ // We do some manual parsing here, as the engine needs gfx to be initalized to do that.
+ while (!stream->eos() && !stream->err()) {
+ Common::String line = stream->readLine();
+ line.trim(); // Get rid of indentation
+ // Expect "GAME {" or comment, or empty line
+ if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) {
+ continue;
+ } else {
+ Common::StringTokenizer token(line, "=");
+ Common::String key = token.nextToken();
+ Common::String value = token.nextToken();
+ if (value.size() == 0) {
+ continue;
+ }
+ if (value[0] == '\"') {
+ value.deleteChar(0);
+ } else {
+ continue; // not a string
+ }
+ if (value.lastChar() == '\"') {
+ value.deleteLastChar();
+ }
+ if (key == "NAME") {
+ retVal = true;
+ name = value;
+ } else if (key == "CAPTION") {
+ retVal = true;
+ caption = value;
+ }
+ }
+ }
+ delete stream;
+ }
+ delete fileMan;
+ BaseEngine::destroy();
+ return retVal;
+}
+
+} // End of namespace Wintermute
diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h
new file mode 100644
index 0000000000..d24b120658
--- /dev/null
+++ b/engines/wintermute/wintermute.h
@@ -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.
+ *
+ */
+
+#ifndef WINTERMUTE_H
+#define WINTERMUTE_H
+
+#include "engines/engine.h"
+#include "engines/advancedDetector.h"
+#include "gui/debugger.h"
+
+namespace Wintermute {
+
+class Console;
+class BaseGame;
+class SystemClassRegistry;
+// our engine debug channels
+enum {
+ kWintermuteDebugLog = 1 << 0, // The debug-logs from the original engine
+ kWintermuteDebugSaveGame = 1 << 1,
+ kWintermuteDebugFont = 1 << 2, // next new channel must be 1 << 2 (4)
+ kWintermuteDebugFileAccess = 1 << 3, // the current limitation is 32 debug channels (1 << 31 is the last one)
+ kWintermuteDebugAudio = 1 << 4,
+ kWintermuteDebugGeneral = 1 << 5
+};
+
+class WintermuteEngine : public Engine {
+public:
+ WintermuteEngine(OSystem *syst, const ADGameDescription *desc);
+ WintermuteEngine();
+ ~WintermuteEngine();
+
+ virtual Common::Error run();
+ virtual bool hasFeature(EngineFeature f) const;
+ Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
+ virtual Common::Error loadGameState(int slot);
+ virtual bool canLoadGameStateCurrently();
+ virtual Common::Error saveGameState(int slot, const Common::String &desc);
+ virtual bool canSaveGameStateCurrently();
+ // For detection-purposes:
+ static bool getGameInfo(const Common::FSList &fslist, Common::String &name, Common::String &caption);
+private:
+ int init();
+ void deinit();
+ int messageLoop();
+ Console *_console;
+ BaseGame *_game;
+ const ADGameDescription *_gameDescription;
+};
+
+// Example console class
+class Console : public GUI::Debugger {
+public:
+ Console(WintermuteEngine *vm) {}
+ virtual ~Console(void) {}
+};
+
+} // End of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h
new file mode 100644
index 0000000000..c7723808ea
--- /dev/null
+++ b/engines/wintermute/wintypes.h
@@ -0,0 +1,53 @@
+/* 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 file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_WINTYPES_H
+#define WINTERMUTE_WINTYPES_H
+
+#include "common/scummsys.h"
+
+namespace Wintermute {
+
+#define BYTETORGBA(r,g,b,a) ((uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
+
+#define RGBCOLGetB(rgb) ((byte )(rgb))
+#define RGBCOLGetG(rgb) ((byte )(((uint16)(rgb)) >> 8))
+#define RGBCOLGetR(rgb) ((byte )((rgb)>>16))
+#define RGBCOLGetA(rgb) ((byte )((rgb)>>24))
+
+#define DID_SUCCEED(hr) ((bool)(hr))
+#define DID_FAIL(hr) (!((bool)(hr)))
+
+#define STATUS_OK (true)
+#define STATUS_FAILED (false)
+
+#define MAX_PATH_LENGTH 512
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index 30ef9eeeeb..f426dd8c41 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -80,7 +80,7 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &
case Graphics::DrawStep::kVectorAlignManual:
if (step.x >= 0)
in_x = area.left + step.x + step.padding.left;
- else
+ else
in_x = area.left + area.width() + step.x + step.padding.left; // value relative to the opposite corner.
break;
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index e98f4aa761..0467cac946 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -55,7 +55,7 @@ struct DrawStep {
bool autoWidth, autoHeight;
int16 x, y, w, h; /**< width, height and position, if not measured automatically.
negative values mean counting from the opposite direction */
-
+
Common::Rect padding;
enum VectorAlignment {
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 7817725664..6a3ee306a5 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -369,12 +369,12 @@ gradientFill(PixelType *ptr, int width, int x, int y) {
int grad = (((y - _gradIndexes[curGrad]) % stripSize) << 2) / stripSize;
// Dithering:
- // +--+ +--+ +--+ +--+
- // | | | | | *| | *|
- // | | | *| |* | |**|
- // +--+ +--+ +--+ +--+
+ // +--+ +--+ +--+ +--+
+ // | | | | | *| | *|
+ // | | | *| |* | |**|
+ // +--+ +--+ +--+ +--+
// 0 1 2 3
- if (grad == 0 ||
+ if (grad == 0 ||
_gradCache[curGrad] == _gradCache[curGrad + 1] || // no color change
stripSize < 2) { // the stip is small
colorFill<PixelType>(ptr, ptr + width, _gradCache[curGrad]);
@@ -422,8 +422,8 @@ void VectorRendererSpec<PixelType>::
copyFrame(OSystem *sys, const Common::Rect &r) {
sys->copyRectToOverlay(
- (const OverlayColor *)_activeSurface->getBasePtr(r.left, r.top),
- _activeSurface->pitch / _activeSurface->format.bytesPerPixel,
+ _activeSurface->getBasePtr(r.left, r.top),
+ _activeSurface->pitch,
r.left, r.top, r.width(), r.height()
);
}
@@ -873,7 +873,7 @@ drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) {
case kTriangleDown:
drawTriangleVertAlg(x, y, newW, newH, (orient == kTriangleDown), color, Base::_fillMode);
break;
-
+
case kTriangleLeft:
case kTriangleRight:
case kTriangleAuto:
@@ -1206,14 +1206,14 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
pitch = -pitch;
y1 += h;
}
-
+
PixelType *ptr_right = (PixelType *)_activeSurface->getBasePtr(x1, y1);
PixelType *floor = ptr_right - 1;
PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x1 + w, y1);
int x2 = x1 + w / 2;
int y2 = y1 + h;
-
+
#if FIXED_POINT
int dx = (x2 - x1) << 8;
int dy = (y2 - y1) << 8;
@@ -1227,7 +1227,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
#endif
while (floor++ != ptr_left)
blendPixelPtr(floor, color, 50);
-
+
#if FIXED_POINT
int gradient = (dy << 8) / dx;
int intery = (y1 << 8) + gradient;
@@ -1250,7 +1250,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
ptr_right += pitch;
intery += gradient;
-
+
switch (fill_m) {
case kFillDisabled:
*ptr_left = *ptr_right = color;
@@ -1262,16 +1262,16 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
blendPixelPtr(ptr_left, color, rfpart(intery));
break;
case kFillGradient:
- colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h));
+ colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h));
blendPixelPtr(ptr_right, color, rfpart(intery));
blendPixelPtr(ptr_left, color, rfpart(intery));
break;
}
}
-
+
return;
}
-
+
#if FIXED_POINT
if (abs(dx) < abs(dy)) {
#else
@@ -1280,7 +1280,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
ptr_left--;
while (floor++ != ptr_left)
blendPixelPtr(floor, color, 50);
-
+
#if FIXED_POINT
int gradient = (dx << 8) / (dy + 0x100);
int interx = (x1 << 8) + gradient;
@@ -1303,7 +1303,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
ptr_right += pitch;
interx += gradient;
-
+
switch (fill_m) {
case kFillDisabled:
*ptr_left = *ptr_right = color;
@@ -1315,18 +1315,18 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
blendPixelPtr(ptr_left, color, rfpart(interx));
break;
case kFillGradient:
- colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h));
+ colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h));
blendPixelPtr(ptr_right, color, rfpart(interx));
blendPixelPtr(ptr_left, color, rfpart(interx));
break;
}
}
-
+
return;
}
-
+
ptr_left--;
-
+
while (floor++ != ptr_left)
blendPixelPtr(floor, color, 50);
@@ -1341,12 +1341,12 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
for (int y = y1 + 1; y < y2; y++) {
ptr_right++;
ptr_left--;
-
+
ptr_left += pitch;
ptr_right += pitch;
interx += gradient;
-
+
switch (fill_m) {
case kFillDisabled:
*ptr_left = *ptr_right = color;
@@ -1358,13 +1358,13 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
blendPixelPtr(ptr_left, color, rfpart(interx));
break;
case kFillGradient:
- colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h));
+ colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h));
blendPixelPtr(ptr_right, color, rfpart(interx));
blendPixelPtr(ptr_left, color, rfpart(interx));
break;
}
}
-
+
}
/** VERTICAL TRIANGLE DRAWING - FAST VERSION FOR SQUARED TRIANGLES */
@@ -1372,12 +1372,12 @@ template<typename PixelType>
void VectorRendererSpec<PixelType>::
drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, VectorRenderer::FillMode fill_m) {
int pitch = _activeSurface->pitch / _activeSurface->format.bytesPerPixel;
-
+
if (!inverted) {
pitch = -pitch;
y1 += size;
}
-
+
int gradient_h = 0;
PixelType *ptr_right = (PixelType *)_activeSurface->getBasePtr(x1, y1);
PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x1 + size, y1);
@@ -1388,9 +1388,9 @@ drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, Vecto
int signX = x1 < x2 ? 1 : -1;
int signY = y1 < y2 ? 1 : -1;
int error = deltaX - deltaY;
-
+
colorFill<PixelType>(ptr_right, ptr_left, color);
-
+
while (1) {
switch (fill_m) {
case kFillDisabled:
@@ -1401,22 +1401,22 @@ drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, Vecto
colorFill<PixelType>(ptr_right, ptr_left, color);
break;
case kFillGradient:
- colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, size));
+ colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, size));
break;
}
-
+
if (x1 == x2 && y1 == y2)
break;
-
+
int error2 = error * 2;
-
+
if (error2 > -deltaY) {
error -= deltaY;
x1 += signX;
ptr_right += signX;
ptr_left += -signX;
}
-
+
if (error2 < deltaX) {
error += deltaX;
y1 += signY;
diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp
index 713a06ea74..2da8b6f0ce 100644
--- a/graphics/conversion.cpp
+++ b/graphics/conversion.cpp
@@ -22,123 +22,143 @@
#include "graphics/conversion.h"
#include "graphics/pixelformat.h"
+#include "common/endian.h"
+
namespace Graphics {
// TODO: YUV to RGB conversion function
+namespace {
+
+template<typename SrcColor, typename DstColor, bool backward>
+inline void crossBlitLogic(byte *dst, const byte *src, const uint w, const uint h,
+ const PixelFormat &srcFmt, const PixelFormat &dstFmt,
+ const uint srcDelta, const uint dstDelta) {
+ for (uint y = 0; y < h; ++y) {
+ for (uint x = 0; x < w; ++x) {
+ const uint32 color = *(const SrcColor *)src;
+ byte a, r, g, b;
+ srcFmt.colorToARGB(color, a, r, g, b);
+ *(DstColor *)dst = dstFmt.ARGBToColor(a, r, g, b);
+
+ if (backward) {
+ src -= sizeof(SrcColor);
+ dst -= sizeof(DstColor);
+ } else {
+ src += sizeof(SrcColor);
+ dst += sizeof(DstColor);
+ }
+ }
+
+ if (backward) {
+ src -= srcDelta;
+ dst -= dstDelta;
+ } else {
+ src += srcDelta;
+ dst += dstDelta;
+ }
+ }
+}
+
+template<typename DstColor, bool backward>
+inline void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint w, const uint h,
+ const PixelFormat &srcFmt, const PixelFormat &dstFmt,
+ const uint srcDelta, const uint dstDelta) {
+ uint32 color;
+ byte r, g, b, a;
+ uint8 *col = (uint8 *)&color;
+#ifdef SCUMM_BIG_ENDIAN
+ col++;
+#endif
+ for (uint y = 0; y < h; ++y) {
+ for (uint x = 0; x < w; ++x) {
+ memcpy(col, src, 3);
+ srcFmt.colorToARGB(color, a, r, g, b);
+ *(DstColor *)dst = dstFmt.ARGBToColor(a, r, g, b);
+
+ if (backward) {
+ src -= 3;
+ dst -= sizeof(DstColor);
+ } else {
+ src += 3;
+ dst += sizeof(DstColor);
+ }
+ }
+
+ if (backward) {
+ src -= srcDelta;
+ dst -= dstDelta;
+ } else {
+ src += srcDelta;
+ dst += dstDelta;
+ }
+ }
+}
+
+} // End of anonymous namespace
+
// Function to blit a rect from one color format to another
-bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch,
- int w, int h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt) {
+bool crossBlit(byte *dst, const byte *src,
+ const uint dstPitch, const uint srcPitch,
+ const uint w, const uint h,
+ const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt) {
// Error out if conversion is impossible
if ((srcFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 1)
- || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel)
- || (srcFmt.bytesPerPixel > dstFmt.bytesPerPixel))
+ || (dstFmt.bytesPerPixel == 3)
+ || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel))
return false;
// Don't perform unnecessary conversion
if (srcFmt == dstFmt) {
- if (dst == src)
- return true;
- if (dstpitch == srcpitch && ((w * dstFmt.bytesPerPixel) == dstpitch)) {
- memcpy(dst,src,dstpitch * h);
- return true;
- } else {
- for (int i = 0; i < h; i++) {
- memcpy(dst,src,w * dstFmt.bytesPerPixel);
- dst += dstpitch;
- src += srcpitch;
+ if (dst != src) {
+ if (dstPitch == srcPitch && ((w * dstFmt.bytesPerPixel) == dstPitch)) {
+ memcpy(dst, src, dstPitch * h);
+ } else {
+ for (uint i = 0; i < h; ++i) {
+ memcpy(dst, src, w * dstFmt.bytesPerPixel);
+ dst += dstPitch;
+ src += srcPitch;
+ }
}
- return true;
}
+
+ return true;
}
// Faster, but larger, to provide optimized handling for each case.
- int srcDelta, dstDelta;
- srcDelta = (srcpitch - w * srcFmt.bytesPerPixel);
- dstDelta = (dstpitch - w * dstFmt.bytesPerPixel);
+ const uint srcDelta = (srcPitch - w * srcFmt.bytesPerPixel);
+ const uint dstDelta = (dstPitch - w * dstFmt.bytesPerPixel);
// TODO: optimized cases for dstDelta of 0
- uint8 r, g, b, a;
if (dstFmt.bytesPerPixel == 2) {
- uint16 color;
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++, src += 2, dst += 2) {
- color = *(const uint16 *)src;
- srcFmt.colorToARGB(color, a, r, g, b);
- color = dstFmt.ARGBToColor(a, r, g, b);
- *(uint16 *)dst = color;
- }
- src += srcDelta;
- dst += dstDelta;
- }
- } else if (dstFmt.bytesPerPixel == 3) {
- uint32 color;
- uint8 *col = (uint8 *) &color;
-#ifdef SCUMM_BIG_ENDIAN
- col++;
-#endif
if (srcFmt.bytesPerPixel == 2) {
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++, src += 2, dst += 3) {
- color = *(const uint16 *)src;
- srcFmt.colorToARGB(color, a, r, g, b);
- color = dstFmt.ARGBToColor(a, r, g, b);
- memcpy(dst, col, 3);
- }
- src += srcDelta;
- dst += dstDelta;
- }
+ crossBlitLogic<uint16, uint16, false>(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta);
+ } else if (srcFmt.bytesPerPixel == 3) {
+ crossBlitLogic3BppSource<uint16, false>(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta);
} else {
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++, src += 3, dst += 3) {
- memcpy(col, src, 3);
- srcFmt.colorToARGB(color, a, r, g, b);
- color = dstFmt.ARGBToColor(a, r, g, b);
- memcpy(dst, col, 3);
- }
- src += srcDelta;
- dst += dstDelta;
- }
+ crossBlitLogic<uint32, uint16, false>(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta);
}
} else if (dstFmt.bytesPerPixel == 4) {
- uint32 color;
if (srcFmt.bytesPerPixel == 2) {
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++, src += 2, dst += 4) {
- color = *(const uint16 *)src;
- srcFmt.colorToARGB(color, a, r, g, b);
- color = dstFmt.ARGBToColor(a, r, g, b);
- *(uint32 *)dst = color;
- }
- src += srcDelta;
- dst += dstDelta;
- }
+ // We need to blit the surface from bottom right to top left here.
+ // This is neeeded, because when we convert to the same memory
+ // buffer copying the surface from top left to bottom right would
+ // overwrite the source, since we have more bits per destination
+ // color than per source color.
+ dst += h * dstPitch - dstDelta - dstFmt.bytesPerPixel;
+ src += h * srcPitch - srcDelta - srcFmt.bytesPerPixel;
+ crossBlitLogic<uint16, uint32, true>(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta);
} else if (srcFmt.bytesPerPixel == 3) {
- uint8 *col = (uint8 *)&color;
-#ifdef SCUMM_BIG_ENDIAN
- col++;
-#endif
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++, src += 2, dst += 4) {
- memcpy(col, src, 3);
- srcFmt.colorToARGB(color, a, r, g, b);
- color = dstFmt.ARGBToColor(a, r, g, b);
- *(uint32 *)dst = color;
- }
- src += srcDelta;
- dst += dstDelta;
- }
+ // We need to blit the surface from bottom right to top left here.
+ // This is neeeded, because when we convert to the same memory
+ // buffer copying the surface from top left to bottom right would
+ // overwrite the source, since we have more bits per destination
+ // color than per source color.
+ dst += h * dstPitch - dstDelta - dstFmt.bytesPerPixel;
+ src += h * srcPitch - srcDelta - srcFmt.bytesPerPixel;
+ crossBlitLogic3BppSource<uint32, true>(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta);
} else {
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++, src += 4, dst += 4) {
- color = *(const uint32 *)src;
- srcFmt.colorToARGB(color, a, r, g, b);
- color = dstFmt.ARGBToColor(a, r, g, b);
- *(uint32 *)dst = color;
- }
- src += srcDelta;
- dst += dstDelta;
- }
+ crossBlitLogic<uint32, uint32, false>(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta);
}
} else {
return false;
diff --git a/graphics/conversion.h b/graphics/conversion.h
index 6babc763e2..28e64a94fb 100644
--- a/graphics/conversion.h
+++ b/graphics/conversion.h
@@ -59,15 +59,18 @@ inline static void RGB2YUV(byte r, byte g, byte b, byte &y, byte &u, byte &v) {
* @return true if conversion completes successfully,
* false if there is an error.
*
- * @note This implementation currently arbitrarily requires that the
- * destination's format have at least as high a bytedepth as
- * the source's.
- * @note This can convert a rectangle in place, if the source and
- * destination format have the same bytedepth.
- *
+ * @note Blitting to a 3Bpp destination is not supported
+ * @note This can convert a surface in place, regardless of the
+ * source and destination format, as long as there is enough
+ * space for the destination. The dstPitch / srcPitch ratio
+ * must at least equal the dstBpp / srcBpp ratio for
+ * dstPitch >= srcPitch and at most dstBpp / srcBpp for
+ * dstPitch < srcPitch though.
*/
-bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch,
- int w, int h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt);
+bool crossBlit(byte *dst, const byte *src,
+ const uint dstPitch, const uint srcPitch,
+ const uint w, const uint h,
+ const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt);
} // End of namespace Graphics
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 425714ea34..c818101645 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -55,14 +55,14 @@ bool CursorManager::showMouse(bool visible) {
return g_system->showMouse(visible);
}
-void CursorManager::pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) {
- Cursor *cur = new Cursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
+void CursorManager::pushCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+ Cursor *cur = new Cursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
cur->_visible = isVisible();
_cursorStack.push(cur);
if (buf) {
- g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
+ g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
}
}
@@ -75,7 +75,7 @@ void CursorManager::popCursor() {
if (!_cursorStack.empty()) {
cur = _cursorStack.top();
- g_system->setMouseCursor(cur->_data, cur->_width, cur->_height, cur->_hotspotX, cur->_hotspotY, cur->_keycolor, cur->_targetScale, &cur->_format);
+ g_system->setMouseCursor(cur->_data, cur->_width, cur->_height, cur->_hotspotX, cur->_hotspotY, cur->_keycolor, cur->_dontScale, &cur->_format);
}
g_system->showMouse(isVisible());
@@ -98,10 +98,10 @@ void CursorManager::popAllCursors() {
g_system->showMouse(isVisible());
}
-void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) {
+void CursorManager::replaceCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
if (_cursorStack.empty()) {
- pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
+ pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
return;
}
@@ -131,7 +131,7 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX,
cur->_hotspotX = hotspotX;
cur->_hotspotY = hotspotY;
cur->_keycolor = keycolor;
- cur->_targetScale = targetScale;
+ cur->_dontScale = dontScale;
#ifdef USE_RGB_COLOR
if (format)
cur->_format = *format;
@@ -139,7 +139,7 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX,
cur->_format = Graphics::PixelFormat::createFormatCLUT8();
#endif
- g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
+ g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
}
bool CursorManager::supportsCursorPalettes() {
@@ -225,7 +225,7 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu
}
}
-CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) {
+CursorManager::Cursor::Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
#ifdef USE_RGB_COLOR
if (!format)
_format = Graphics::PixelFormat::createFormatCLUT8();
@@ -245,7 +245,7 @@ CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, in
_height = h;
_hotspotX = hotspotX;
_hotspotY = hotspotY;
- _targetScale = targetScale;
+ _dontScale = dontScale;
}
CursorManager::Cursor::~Cursor() {
diff --git a/graphics/cursorman.h b/graphics/cursorman.h
index 543a5d0a5c..66e8d1ba56 100644
--- a/graphics/cursorman.h
+++ b/graphics/cursorman.h
@@ -63,14 +63,15 @@ public:
* @param hotspotY the hotspot Y coordinate
* @param keycolor the color value for the transparent color. This may not exceed
* the maximum color value as defined by format.
- * @param targetScale the scale for which the cursor is designed
+ * @param dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor
+ * would be too small to notice otherwise, these are allowed to scale the cursor anyway.
* @param format a pointer to the pixel format which the cursor graphic uses,
* CLUT8 will be used if this is NULL or not specified.
* @note It is ok for the buffer to be a NULL pointer. It is sometimes
* useful to push a "dummy" cursor and modify it later. The
* cursor will be added to the stack, but not to the backend.
*/
- void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale = 1, const Graphics::PixelFormat *format = NULL);
+ void pushCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
/**
* Pop a cursor from the stack, and restore the previous one to the
@@ -90,11 +91,12 @@ public:
* @param hotspotY the hotspot Y coordinate
* @param keycolor the color value for the transparent color. This may not exceed
* the maximum color value as defined by format.
- * @param targetScale the scale for which the cursor is designed
+ * @param dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor
+ * would be too small to notice otherwise, these are allowed to scale the cursor anyway.
* @param format a pointer to the pixel format which the cursor graphic uses,
* CLUT8 will be used if this is NULL or not specified.
*/
- void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale = 1, const Graphics::PixelFormat *format = NULL);
+ void replaceCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
/**
* Pop all of the cursors and cursor palettes from their respective stacks.
@@ -175,11 +177,11 @@ private:
int _hotspotY;
uint32 _keycolor;
Graphics::PixelFormat _format;
- int _targetScale;
+ bool _dontScale;
uint _size;
- Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale = 1, const Graphics::PixelFormat *format = NULL);
+ Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
~Cursor();
};
diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp
new file mode 100644
index 0000000000..bcfd0abbda
--- /dev/null
+++ b/graphics/decoders/bmp.cpp
@@ -0,0 +1,182 @@
+/* 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/stream.h"
+#include "common/textconsole.h"
+
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "graphics/decoders/bmp.h"
+
+namespace Graphics {
+
+BitmapDecoder::BitmapDecoder() {
+ _surface = 0;
+ _palette = 0;
+ _paletteColorCount = 0;
+}
+
+BitmapDecoder::~BitmapDecoder() {
+ destroy();
+}
+
+void BitmapDecoder::destroy() {
+ if (_surface) {
+ _surface->free();
+ delete _surface; _surface = 0;
+ }
+
+ delete[] _palette; _palette = 0;
+ _paletteColorCount = 0;
+}
+
+bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
+ destroy();
+
+ if (stream.readByte() != 'B')
+ return false;
+
+ if (stream.readByte() != 'M')
+ return false;
+
+ /* uint32 fileSize = */ stream.readUint32LE();
+ /* uint16 res1 = */ stream.readUint16LE();
+ /* uint16 res2 = */ stream.readUint16LE();
+ uint32 imageOffset = stream.readUint32LE();
+
+ uint32 infoSize = stream.readUint32LE();
+ if (infoSize != 40) {
+ warning("Only Windows v3 bitmaps are supported");
+ return false;
+ }
+
+ uint32 width = stream.readUint32LE();
+ int32 height = stream.readSint32LE();
+
+ if (width == 0 || height == 0)
+ return false;
+
+ if (height < 0) {
+ warning("Right-side up bitmaps not supported");
+ return false;
+ }
+
+ /* uint16 planes = */ stream.readUint16LE();
+ uint16 bitsPerPixel = stream.readUint16LE();
+
+ if (bitsPerPixel != 8 && bitsPerPixel != 24 && bitsPerPixel != 32) {
+ warning("%dbpp bitmaps not supported", bitsPerPixel);
+ return false;
+ }
+
+ uint32 compression = stream.readUint32LE();
+
+ if (compression != 0) {
+ warning("Compressed bitmaps not supported");
+ return false;
+ }
+
+ /* uint32 imageSize = */ stream.readUint32LE();
+ /* uint32 pixelsPerMeterX = */ stream.readUint32LE();
+ /* uint32 pixelsPerMeterY = */ stream.readUint32LE();
+ _paletteColorCount = stream.readUint32LE();
+ /* uint32 colorsImportant = */ stream.readUint32LE();
+
+ if (bitsPerPixel == 8) {
+ if (_paletteColorCount == 0)
+ _paletteColorCount = 256;
+
+ // Read the palette
+ _palette = new byte[_paletteColorCount * 3];
+ for (uint16 i = 0; i < _paletteColorCount; i++) {
+ _palette[i * 3 + 2] = stream.readByte();
+ _palette[i * 3 + 1] = stream.readByte();
+ _palette[i * 3 + 0] = stream.readByte();
+ stream.readByte();
+ }
+ }
+
+ // Start us at the beginning of the image
+ stream.seek(imageOffset);
+
+ Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
+
+ // BGRA for 24bpp and 32 bpp
+ if (bitsPerPixel == 24 || bitsPerPixel == 32)
+ format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0);
+
+ _surface = new Graphics::Surface();
+ _surface->create(width, height, format);
+
+ int srcPitch = width * (bitsPerPixel >> 3);
+ const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0;
+
+ if (bitsPerPixel == 8) {
+ byte *dst = (byte *)_surface->pixels;
+
+ for (int32 i = 0; i < height; i++) {
+ stream.read(dst + (height - i - 1) * width, width);
+ stream.skip(extraDataLength);
+ }
+ } else if (bitsPerPixel == 24) {
+ byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch;
+
+ for (int32 i = 0; i < height; i++) {
+ for (uint32 j = 0; j < width; j++) {
+ byte b = stream.readByte();
+ byte g = stream.readByte();
+ byte r = stream.readByte();
+ uint32 color = format.RGBToColor(r, g, b);
+
+ *((uint32 *)dst) = color;
+ dst += format.bytesPerPixel;
+ }
+
+ stream.skip(extraDataLength);
+ dst -= _surface->pitch * 2;
+ }
+ } else { // 32 bpp
+ byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch;
+
+ for (int32 i = 0; i < height; i++) {
+ for (uint32 j = 0; j < width; j++) {
+ byte b = stream.readByte();
+ byte g = stream.readByte();
+ byte r = stream.readByte();
+ // Ignore the last byte, as in v3 it is unused
+ // and should thus NOT be used as alpha.
+ // ref: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
+ stream.readByte();
+ uint32 color = format.RGBToColor(r, g, b);
+
+ *((uint32 *)dst) = color;
+ dst += format.bytesPerPixel;
+ }
+
+ stream.skip(extraDataLength);
+ dst -= _surface->pitch * 2;
+ }
+ }
+
+ return true;
+}
+
+} // End of namespace Graphics
diff --git a/graphics/imagedec.h b/graphics/decoders/bmp.h
index e839d097b2..59da682e4d 100644
--- a/graphics/imagedec.h
+++ b/graphics/decoders/bmp.h
@@ -19,11 +19,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef GRAPHICS_IMAGEDEC_H
-#define GRAPHICS_IMAGEDEC_H
+/**
+ * @file
+ * Image decoder used in engines:
+ * - hugo
+ * - mohawk
+ */
+
+#ifndef GRAPHICS_DECODERS_BMP_H
+#define GRAPHICS_DECODERS_BMP_H
#include "common/scummsys.h"
#include "common/str.h"
+#include "graphics/decoders/image_decoder.h"
namespace Common{
class SeekableReadStream;
@@ -34,33 +42,24 @@ namespace Graphics {
struct PixelFormat;
struct Surface;
-class ImageDecoder {
+class BitmapDecoder : public ImageDecoder {
public:
- ImageDecoder() {}
- virtual ~ImageDecoder() {}
+ BitmapDecoder();
+ virtual ~BitmapDecoder();
- static Surface *loadFile(const Common::String &name, const PixelFormat &format);
- static Surface *loadFile(Common::SeekableReadStream &stream, const PixelFormat &format);
+ // ImageDecoder API
+ void destroy();
+ virtual bool loadStream(Common::SeekableReadStream &stream);
+ virtual const Surface *getSurface() const { return _surface; }
+ const byte *getPalette() const { return _palette; }
+ uint16 getPaletteColorCount() const { return _paletteColorCount; }
- /**
- * checks if the data can be decoded by this decoder
- *
- * @param stream memory read stream
- * @return true if it can be decoded, otherwise false
- */
- virtual bool decodeable(Common::SeekableReadStream &stream) = 0;
-
- /**
- * decodes the data and returns an pointer to the resulting surface.
- * Surface::free() must be called by the user also it must be deleted
- * with delete;
- *
- * @param stream the memory stream which should be decoded
- * @param format the pixel format used to generate the surface
- * @return returns a new surface if the image could be decoded, otherwise 0
- */
- virtual Surface *decodeImage(Common::SeekableReadStream &stream, const PixelFormat &format) = 0;
+private:
+ Surface *_surface;
+ byte *_palette;
+ uint16 _paletteColorCount;
};
+
} // End of namespace Graphics
#endif
diff --git a/graphics/decoders/image_decoder.h b/graphics/decoders/image_decoder.h
new file mode 100644
index 0000000000..49e31c6e3a
--- /dev/null
+++ b/graphics/decoders/image_decoder.h
@@ -0,0 +1,98 @@
+/* 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 GRAPHICS_DECODERS_IMAGEDECODER_H
+#define GRAPHICS_DECODERS_IMAGEDECODER_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+
+namespace Common{
+class SeekableReadStream;
+}
+
+namespace Graphics {
+
+struct PixelFormat;
+struct Surface;
+
+/**
+ * A representation of an image decoder that maintains ownership of the surface
+ * and palette it decodes to.
+ */
+class ImageDecoder {
+public:
+ virtual ~ImageDecoder() {}
+
+ /**
+ * Load an image from the specified stream
+ *
+ * @param stream the input stream
+ * @return whether loading the file succeeded
+ * @see getSurface
+ * @see getPalette
+ */
+ virtual bool loadStream(Common::SeekableReadStream &stream) = 0;
+
+ /**
+ * Destroy this decoder's surface and palette
+ */
+ virtual void destroy() = 0;
+
+ /**
+ * Get the decoded surface
+ *
+ * This surface is owned by this ImageDecoder and will remain valid
+ * until destroy() or loadStream() is called, or until this ImageDecoder's
+ * destructor is called.
+ *
+ * @return the decoded surface, or 0 if no surface is present
+ */
+ virtual const Surface *getSurface() const = 0;
+
+ /**
+ * Get the decoded palette
+ *
+ * This palette is owned by this ImageDecoder and will remain valid
+ * until destroy() or loadStream() is called, or until this ImageDecoder's
+ * destructor is called.
+ *
+ * The palette's format is the same as PaletteManager's palette
+ * (interleaved RGB values).
+ *
+ * @return the decoded palette, or undefined if no palette is present
+ */
+ virtual const byte *getPalette() const { return 0; }
+
+ /**
+ * Query if the decoded image has a palette.
+ */
+ virtual bool hasPalette() const { return getPaletteColorCount() != 0; }
+
+ /** Return the starting index of the palette. */
+ virtual byte getPaletteStartIndex() const { return 0; }
+ /** Return the number of colors in the palette. */
+ virtual uint16 getPaletteColorCount() const { return 0; }
+};
+
+} // End of namespace Graphics
+
+#endif
diff --git a/graphics/jpeg.cpp b/graphics/decoders/jpeg.cpp
index 53e693a045..08bc1f7a3d 100644
--- a/graphics/jpeg.cpp
+++ b/graphics/decoders/jpeg.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "graphics/conversion.h"
-#include "graphics/jpeg.h"
#include "graphics/pixelformat.h"
+#include "graphics/yuv_to_rgb.h"
+#include "graphics/decoders/jpeg.h"
#include "common/debug.h"
#include "common/endian.h"
@@ -43,9 +43,9 @@ static const uint8 _zigZagOrder[64] = {
53, 60, 61, 54, 47, 55, 62, 63
};
-JPEG::JPEG() :
+JPEGDecoder::JPEGDecoder() : ImageDecoder(),
_stream(NULL), _w(0), _h(0), _numComp(0), _components(NULL), _numScanComp(0),
- _scanComp(NULL), _currentComp(NULL) {
+ _scanComp(NULL), _currentComp(NULL), _rgbSurface(0) {
// Initialize the quantization tables
for (int i = 0; i < JPEG_MAX_QUANT_TABLES; i++)
@@ -60,42 +60,33 @@ JPEG::JPEG() :
}
}
-JPEG::~JPEG() {
- reset();
+JPEGDecoder::~JPEGDecoder() {
+ destroy();
}
-Surface *JPEG::getSurface(const PixelFormat &format) {
+const Surface *JPEGDecoder::getSurface() const {
// Make sure we have loaded data
if (!isLoaded())
return 0;
- // Only accept >8bpp surfaces
- if (format.bytesPerPixel == 1)
- return 0;
+ if (_rgbSurface)
+ return _rgbSurface;
+
+ // Create an RGBA8888 surface
+ _rgbSurface = new Graphics::Surface();
+ _rgbSurface->create(_w, _h, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
// Get our component surfaces
- Graphics::Surface *yComponent = getComponent(1);
- Graphics::Surface *uComponent = getComponent(2);
- Graphics::Surface *vComponent = getComponent(3);
-
- Graphics::Surface *output = new Graphics::Surface();
- output->create(yComponent->w, yComponent->h, format);
-
- for (uint16 i = 0; i < output->h; i++) {
- for (uint16 j = 0; j < output->w; j++) {
- byte r = 0, g = 0, b = 0;
- YUV2RGB(*((byte *)yComponent->getBasePtr(j, i)), *((byte *)uComponent->getBasePtr(j, i)), *((byte *)vComponent->getBasePtr(j, i)), r, g, b);
- if (format.bytesPerPixel == 2)
- *((uint16 *)output->getBasePtr(j, i)) = format.RGBToColor(r, g, b);
- else
- *((uint32 *)output->getBasePtr(j, i)) = format.RGBToColor(r, g, b);
- }
- }
+ const Graphics::Surface *yComponent = getComponent(1);
+ const Graphics::Surface *uComponent = getComponent(2);
+ const Graphics::Surface *vComponent = getComponent(3);
+
+ YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (byte *)yComponent->pixels, (byte *)uComponent->pixels, (byte *)vComponent->pixels, yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch);
- return output;
+ return _rgbSurface;
}
-void JPEG::reset() {
+void JPEGDecoder::destroy() {
// Reset member variables
_stream = NULL;
_w = _h = 0;
@@ -125,14 +116,19 @@ void JPEG::reset() {
delete[] _huff[i].sizes; _huff[i].sizes = NULL;
delete[] _huff[i].codes; _huff[i].codes = NULL;
}
+
+ if (_rgbSurface) {
+ _rgbSurface->free();
+ delete _rgbSurface;
+ }
}
-bool JPEG::read(Common::SeekableReadStream *stream) {
+bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
// Reset member variables and tables from previous reads
- reset();
+ destroy();
// Save the input stream
- _stream = stream;
+ _stream = &stream;
bool ok = true;
bool done = false;
@@ -211,41 +207,41 @@ bool JPEG::read(Common::SeekableReadStream *stream) {
}
}
}
+
+ _stream = 0;
return ok;
}
-bool JPEG::readJFIF() {
+bool JPEGDecoder::readJFIF() {
uint16 length = _stream->readUint16BE();
uint32 tag = _stream->readUint32BE();
if (tag != MKTAG('J', 'F', 'I', 'F')) {
- warning("JPEG::readJFIF() tag mismatch");
+ warning("JPEGDecoder::readJFIF() tag mismatch");
return false;
}
if (_stream->readByte() != 0) { // NULL
- warning("JPEG::readJFIF() NULL mismatch");
+ warning("JPEGDecoder::readJFIF() NULL mismatch");
return false;
}
byte majorVersion = _stream->readByte();
byte minorVersion = _stream->readByte();
-
- 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();
+ if (majorVersion != 1 || minorVersion != 1)
+ warning("JPEGDecoder::readJFIF() Non-v1.1 JPEGs may not be handled correctly");
+ /* byte densityUnits = */_stream->readByte();
+ /* uint16 xDensity = */_stream->readUint16BE();
+ /* uint16 yDensity = */_stream->readUint16BE();
byte thumbW = _stream->readByte();
byte thumbH = _stream->readByte();
_stream->seek(thumbW * thumbH * 3, SEEK_CUR); // Ignore thumbnail
if (length != (thumbW * thumbH * 3) + 16) {
- warning("JPEG::readJFIF() length mismatch");
+ warning("JPEGDecoder::readJFIF() length mismatch");
return false;
}
return true;
}
// Marker 0xC0 (Start Of Frame, Baseline DCT)
-bool JPEG::readSOF0() {
+bool JPEGDecoder::readSOF0() {
debug(5, "JPEG: readSOF0");
uint16 size = _stream->readUint16BE();
@@ -284,7 +280,7 @@ bool JPEG::readSOF0() {
}
// Marker 0xC4 (Define Huffman Tables)
-bool JPEG::readDHT() {
+bool JPEGDecoder::readDHT() {
debug(5, "JPEG: readDHT");
uint16 size = _stream->readUint16BE() - 2;
uint32 pos = _stream->pos();
@@ -346,7 +342,7 @@ bool JPEG::readDHT() {
}
// Marker 0xDA (Start Of Scan)
-bool JPEG::readSOS() {
+bool JPEGDecoder::readSOS() {
debug(5, "JPEG: readSOS");
uint16 size = _stream->readUint16BE();
@@ -456,7 +452,7 @@ bool JPEG::readSOS() {
_bitsNumber = 0;
for (byte i = 0; i < _numScanComp; i++)
- _scanComp[i]->DCpredictor = 0;
+ _scanComp[i]->DCpredictor = 0;
}
}
}
@@ -473,7 +469,7 @@ bool JPEG::readSOS() {
}
// Marker 0xDB (Define Quantization Tables)
-bool JPEG::readDQT() {
+bool JPEGDecoder::readDQT() {
debug(5, "JPEG: readDQT");
uint16 size = _stream->readUint16BE() - 2;
uint32 pos = _stream->pos();
@@ -503,7 +499,7 @@ bool JPEG::readDQT() {
}
// Marker 0xDD (Define Restart Interval)
-bool JPEG::readDRI() {
+bool JPEGDecoder::readDRI() {
debug(5, "JPEG: readDRI");
uint16 size = _stream->readUint16BE() - 2;
@@ -517,7 +513,7 @@ bool JPEG::readDRI() {
return true;
}
-bool JPEG::readMCU(uint16 xMCU, uint16 yMCU) {
+bool JPEGDecoder::readMCU(uint16 xMCU, uint16 yMCU) {
bool ok = true;
for (int c = 0; ok && (c < _numComp); c++) {
// Set the current component
@@ -549,7 +545,7 @@ bool JPEG::readMCU(uint16 xMCU, uint16 yMCU) {
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) {
+void JPEGDecoder::idct1D8x8(int32 src[8], int32 dest[64], int32 ps, int32 half) {
int p, n;
src[0] <<= 9;
@@ -578,7 +574,7 @@ void JPEG::idct1D8x8(int32 src[8], int32 dest[64], int32 ps, int32 half) {
dest[7 * 8] = (src[0] - src[1]) >> ps;
}
-void JPEG::idct2D8x8(int32 block[64]) {
+void JPEGDecoder::idct2D8x8(int32 block[64]) {
int32 tmp[64];
// Apply 1D IDCT to rows
@@ -590,7 +586,7 @@ void JPEG::idct2D8x8(int32 block[64]) {
idct1D8x8(&tmp[i * 8], &block[i], 12, 1 << 11);
}
-bool JPEG::readDataUnit(uint16 x, uint16 y) {
+bool JPEGDecoder::readDataUnit(uint16 x, uint16 y) {
// Prepare an empty data array
int16 readData[64];
for (int i = 1; i < 64; i++)
@@ -654,7 +650,7 @@ bool JPEG::readDataUnit(uint16 x, uint16 y) {
return true;
}
-int16 JPEG::readDC() {
+int16 JPEGDecoder::readDC() {
// DC is type 0
uint8 tableNum = _currentComp->DCentropyTableSelector << 1;
@@ -665,7 +661,7 @@ int16 JPEG::readDC() {
return readSignedBits(numBits);
}
-void JPEG::readAC(int16 *out) {
+void JPEGDecoder::readAC(int16 *out) {
// AC is type 1
uint8 tableNum = (_currentComp->ACentropyTableSelector << 1) + 1;
@@ -695,7 +691,7 @@ void JPEG::readAC(int16 *out) {
}
}
-int16 JPEG::readSignedBits(uint8 numBits) {
+int16 JPEGDecoder::readSignedBits(uint8 numBits) {
uint16 ret = 0;
if (numBits > 16)
error("requested %d bits", numBits); //XXX
@@ -713,7 +709,7 @@ int16 JPEG::readSignedBits(uint8 numBits) {
}
// TODO: optimize?
-uint8 JPEG::readHuff(uint8 table) {
+uint8 JPEGDecoder::readHuff(uint8 table) {
bool foundCode = false;
uint8 val = 0;
@@ -743,7 +739,7 @@ uint8 JPEG::readHuff(uint8 table) {
return val;
}
-uint8 JPEG::readBit() {
+uint8 JPEGDecoder::readBit() {
// Read a whole byte if necessary
if (_bitsNumber == 0) {
_bitsData = _stream->readByte();
@@ -773,12 +769,12 @@ uint8 JPEG::readBit() {
return (_bitsData & (1 << _bitsNumber)) ? 1 : 0;
}
-Surface *JPEG::getComponent(uint c) {
+const Surface *JPEGDecoder::getComponent(uint c) const {
for (int i = 0; i < _numComp; i++)
if (_components[i].id == c) // We found the desired component
return &_components[i].surface;
- error("JPEG::getComponent: No component %d present", c);
+ error("JPEGDecoder::getComponent: No component %d present", c);
return NULL;
}
diff --git a/graphics/jpeg.h b/graphics/decoders/jpeg.h
index b87791470f..c74aa57ca1 100644
--- a/graphics/jpeg.h
+++ b/graphics/decoders/jpeg.h
@@ -20,10 +20,18 @@
*
*/
+/**
+ * @file
+ * Image decoder used in engines:
+ * - groovie
+ * - mohawk
+ */
+
#ifndef GRAPHICS_JPEG_H
#define GRAPHICS_JPEG_H
#include "graphics/surface.h"
+#include "graphics/decoders/image_decoder.h"
namespace Common {
class SeekableReadStream;
@@ -36,26 +44,31 @@ struct PixelFormat;
#define JPEG_MAX_QUANT_TABLES 4
#define JPEG_MAX_HUFF_TABLES 2
-class JPEG {
+class JPEGDecoder : public ImageDecoder {
public:
- JPEG();
- ~JPEG();
+ JPEGDecoder();
+ ~JPEGDecoder();
+
+ // ImageDecoder API
+ void destroy();
+ bool loadStream(Common::SeekableReadStream &str);
+ const Surface *getSurface() const;
- bool read(Common::SeekableReadStream *str);
bool isLoaded() const { return _numComp && _w && _h; }
uint16 getWidth() const { return _w; }
uint16 getHeight() const { return _h; }
-
- Surface *getComponent(uint c);
- Surface *getSurface(const PixelFormat &format);
+ const Surface *getComponent(uint c) const;
private:
- void reset();
-
Common::SeekableReadStream *_stream;
uint16 _w, _h;
uint16 _restartInterval;
+ // mutable so that we can convert to RGB only during
+ // a getSurface() call while still upholding the
+ // const requirement in other ImageDecoders
+ mutable Graphics::Surface *_rgbSurface;
+
// Image components
uint8 _numComp;
struct Component {
diff --git a/graphics/decoders/pcx.cpp b/graphics/decoders/pcx.cpp
new file mode 100644
index 0000000000..1250398c73
--- /dev/null
+++ b/graphics/decoders/pcx.cpp
@@ -0,0 +1,213 @@
+/* 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/stream.h"
+#include "common/textconsole.h"
+
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "graphics/decoders/pcx.h"
+
+/**
+ * Based on the PCX specs:
+ * http://www.fileformat.info/format/pcx/spec/a10e75307b3a4cc49c3bbe6db4c41fa2/view.htm
+ * and the PCX decoder of FFmpeg (libavcodec/pcx.c):
+ * http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/pcx.c
+ */
+
+namespace Graphics {
+
+PCXDecoder::PCXDecoder() {
+ _surface = 0;
+ _palette = 0;
+ _paletteColorCount = 0;
+}
+
+PCXDecoder::~PCXDecoder() {
+ destroy();
+}
+
+void PCXDecoder::destroy() {
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ _surface = 0;
+ }
+
+ delete[] _palette;
+ _palette = 0;
+ _paletteColorCount = 0;
+}
+
+bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) {
+ destroy();
+
+ if (stream.readByte() != 0x0a) // ZSoft PCX
+ return false;
+
+ byte version = stream.readByte(); // 0 - 5
+ if (version > 5)
+ return false;
+
+ bool compressed = stream.readByte(); // encoding, 1 = run length encoding
+ byte bitsPerPixel = stream.readByte(); // 1, 2, 4 or 8
+
+ // Window
+ uint16 xMin = stream.readUint16LE();
+ uint16 yMin = stream.readUint16LE();
+ uint16 xMax = stream.readUint16LE();
+ uint16 yMax = stream.readUint16LE();
+
+ uint16 width = xMax - xMin + 1;
+ uint16 height = yMax - yMin + 1;
+
+ if (xMax < xMin || yMax < yMin) {
+ warning("Invalid PCX image dimensions");
+ return false;
+ }
+
+ stream.skip(4); // HDpi, VDpi
+
+ // Read the EGA palette (colormap)
+ _palette = new byte[16 * 3];
+ for (uint16 i = 0; i < 16; i++) {
+ _palette[i * 3 + 0] = stream.readByte();
+ _palette[i * 3 + 1] = stream.readByte();
+ _palette[i * 3 + 2] = stream.readByte();
+ }
+
+ if (stream.readByte() != 0) // reserved, should be set to 0
+ return false;
+
+ byte nPlanes = stream.readByte();
+ uint16 bytesPerLine = stream.readUint16LE();
+ uint16 bytesPerscanLine = nPlanes * bytesPerLine;
+
+ if (bytesPerscanLine < width * bitsPerPixel * nPlanes / 8) {
+ warning("PCX data is corrupted");
+ return false;
+ }
+
+ stream.skip(60); // PaletteInfo, HscreenSize, VscreenSize, Filler
+
+ _surface = new Graphics::Surface();
+
+ byte *scanLine = new byte[bytesPerscanLine];
+ byte *dst;
+ int x, y;
+
+ if (nPlanes == 3 && bitsPerPixel == 8) { // 24bpp
+ Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ _surface->create(width, height, format);
+ dst = (byte *)_surface->pixels;
+ _paletteColorCount = 0;
+
+ for (y = 0; y < height; y++) {
+ decodeRLE(stream, scanLine, bytesPerscanLine, compressed);
+
+ for (x = 0; x < width; x++) {
+ byte b = scanLine[x];
+ byte g = scanLine[x + bytesPerLine];
+ byte r = scanLine[x + (bytesPerLine << 1)];
+ uint32 color = format.RGBToColor(r, g, b);
+
+ *((uint32 *)dst) = color;
+ dst += format.bytesPerPixel;
+ }
+ }
+ } else if (nPlanes == 1 && bitsPerPixel == 8) { // 8bpp indexed
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ dst = (byte *)_surface->pixels;
+ _paletteColorCount = 16;
+
+ for (y = 0; y < height; y++, dst += _surface->pitch) {
+ decodeRLE(stream, scanLine, bytesPerscanLine, compressed);
+ memcpy(dst, scanLine, width);
+ }
+
+ if (version == 5) {
+ if (stream.readByte() != 12) {
+ warning("Expected a palette after the PCX image data");
+ delete[] scanLine;
+ return false;
+ }
+
+ // Read the VGA palette
+ delete[] _palette;
+ _palette = new byte[256 * 3];
+ for (uint16 i = 0; i < 256; i++) {
+ _palette[i * 3 + 0] = stream.readByte();
+ _palette[i * 3 + 1] = stream.readByte();
+ _palette[i * 3 + 2] = stream.readByte();
+ }
+
+ _paletteColorCount = 256;
+ }
+ } else if ((nPlanes == 2 || nPlanes == 3 || nPlanes == 4) && bitsPerPixel == 1) { // planar, 4, 8 or 16 colors
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ dst = (byte *)_surface->pixels;
+ _paletteColorCount = 16;
+
+ for (y = 0; y < height; y++, dst += _surface->pitch) {
+ decodeRLE(stream, scanLine, bytesPerscanLine, compressed);
+
+ for (x = 0; x < width; x++) {
+ int m = 0x80 >> (x & 7), v = 0;
+ for (int i = nPlanes - 1; i >= 0; i--) {
+ v <<= 1;
+ v += (scanLine[i * bytesPerLine + (x >> 3)] & m) == 0 ? 0 : 1;
+ }
+ dst[x] = v;
+ }
+ }
+ } else {
+ // Known unsupported case: 1 plane and bpp < 8 (1, 2 or 4)
+ warning("Invalid PCX file (%d planes, %d bpp)", nPlanes, bitsPerPixel);
+ delete[] scanLine;
+ return false;
+ }
+
+ delete[] scanLine;
+
+ return true;
+}
+
+void PCXDecoder::decodeRLE(Common::SeekableReadStream &stream, byte *dst, uint32 bytesPerscanLine, bool compressed) {
+ uint32 i = 0;
+ byte run, value;
+
+ if (compressed) {
+ while (i < bytesPerscanLine) {
+ run = 1;
+ value = stream.readByte();
+ if (value >= 0xc0) {
+ run = value & 0x3f;
+ value = stream.readByte();
+ }
+ while (i < bytesPerscanLine && run--)
+ dst[i++] = value;
+ }
+ } else {
+ stream.read(dst, bytesPerscanLine);
+ }
+}
+
+} // End of namespace Graphics
diff --git a/graphics/decoders/pcx.h b/graphics/decoders/pcx.h
new file mode 100644
index 0000000000..b25166b3d9
--- /dev/null
+++ b/graphics/decoders/pcx.h
@@ -0,0 +1,68 @@
+/* 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.
+ */
+
+/**
+ * PCX decoder used in engines:
+ * - dreamweb
+ * - hugo
+ * - queen
+ * - tucker
+ */
+
+#ifndef GRAPHICS_DECODERS_PCX_H
+#define GRAPHICS_DECODERS_PCX_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "graphics/decoders/image_decoder.h"
+
+namespace Common{
+class SeekableReadStream;
+}
+
+namespace Graphics {
+
+struct PixelFormat;
+struct Surface;
+
+class PCXDecoder : public ImageDecoder {
+public:
+ PCXDecoder();
+ virtual ~PCXDecoder();
+
+ // ImageDecoder API
+ void destroy();
+ virtual bool loadStream(Common::SeekableReadStream &stream);
+ virtual const Surface *getSurface() const { return _surface; }
+ const byte *getPalette() const { return _palette; }
+ uint16 getPaletteColorCount() const { return _paletteColorCount; }
+
+private:
+ void decodeRLE(Common::SeekableReadStream &stream, byte *dst, uint32 bytesPerScanline, bool compressed);
+
+ Surface *_surface;
+ byte *_palette;
+ uint16 _paletteColorCount;
+};
+
+} // End of namespace Graphics
+
+#endif
diff --git a/graphics/pict.cpp b/graphics/decoders/pict.cpp
index 872f2f224a..d35e5c3064 100644
--- a/graphics/pict.cpp
+++ b/graphics/decoders/pict.cpp
@@ -26,9 +26,9 @@
#include "common/substream.h"
#include "common/textconsole.h"
-#include "graphics/jpeg.h"
-#include "graphics/pict.h"
#include "graphics/surface.h"
+#include "graphics/decoders/jpeg.h"
+#include "graphics/decoders/pict.h"
namespace Graphics {
@@ -36,18 +36,28 @@ namespace Graphics {
// http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-461.html
// http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-269.html
-PictDecoder::PictDecoder(PixelFormat pixelFormat) {
- _jpeg = new JPEG();
- _pixelFormat = pixelFormat;
+PICTDecoder::PICTDecoder() {
+ _outputSurface = 0;
+ _paletteColorCount = 0;
+}
+
+PICTDecoder::~PICTDecoder() {
+ destroy();
}
-PictDecoder::~PictDecoder() {
- delete _jpeg;
+void PICTDecoder::destroy() {
+ if (_outputSurface) {
+ _outputSurface->free();
+ delete _outputSurface;
+ _outputSurface = 0;
+ }
+
+ _paletteColorCount = 0;
}
-#define OPCODE(a, b, c) _opcodes.push_back(PICTOpcode(a, &PictDecoder::b, c))
+#define OPCODE(a, b, c) _opcodes.push_back(PICTOpcode(a, &PICTDecoder::b, c))
-void PictDecoder::setupOpcodesCommon() {
+void PICTDecoder::setupOpcodesCommon() {
OPCODE(0x0000, o_nop, "NOP");
OPCODE(0x0001, o_clip, "Clip");
OPCODE(0x0003, o_txFont, "TxFont");
@@ -63,14 +73,14 @@ void PictDecoder::setupOpcodesCommon() {
OPCODE(0x0C00, o_headerOp, "HeaderOp");
}
-void PictDecoder::setupOpcodesNormal() {
+void PICTDecoder::setupOpcodesNormal() {
setupOpcodesCommon();
OPCODE(0x0098, on_packBitsRect, "PackBitsRect");
OPCODE(0x009A, on_directBitsRect, "DirectBitsRect");
OPCODE(0x8200, on_compressedQuickTime, "CompressedQuickTime");
}
-void PictDecoder::setupOpcodesQuickTime() {
+void PICTDecoder::setupOpcodesQuickTime() {
setupOpcodesCommon();
OPCODE(0x0098, oq_packBitsRect, "PackBitsRect");
OPCODE(0x009A, oq_directBitsRect, "DirectBitsRect");
@@ -79,93 +89,93 @@ void PictDecoder::setupOpcodesQuickTime() {
#undef OPCODE
-void PictDecoder::o_nop(Common::SeekableReadStream *) {
+void PICTDecoder::o_nop(Common::SeekableReadStream &) {
// Nothing to do
}
-void PictDecoder::o_clip(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_clip(Common::SeekableReadStream &stream) {
// Ignore
- stream->skip(stream->readUint16BE() - 2);
+ stream.skip(stream.readUint16BE() - 2);
}
-void PictDecoder::o_txFont(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_txFont(Common::SeekableReadStream &stream) {
// Ignore
- stream->readUint16BE();
+ stream.readUint16BE();
}
-void PictDecoder::o_txFace(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_txFace(Common::SeekableReadStream &stream) {
// Ignore
- stream->readByte();
+ stream.readByte();
}
-void PictDecoder::o_pnSize(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_pnSize(Common::SeekableReadStream &stream) {
// Ignore
- stream->readUint16BE();
- stream->readUint16BE();
+ stream.readUint16BE();
+ stream.readUint16BE();
}
-void PictDecoder::o_txSize(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_txSize(Common::SeekableReadStream &stream) {
// Ignore
- stream->readUint16BE();
+ stream.readUint16BE();
}
-void PictDecoder::o_txRatio(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_txRatio(Common::SeekableReadStream &stream) {
// Ignore
- stream->readUint16BE();
- stream->readUint16BE();
- stream->readUint16BE();
- stream->readUint16BE();
+ stream.readUint16BE();
+ stream.readUint16BE();
+ stream.readUint16BE();
+ stream.readUint16BE();
}
-void PictDecoder::o_versionOp(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_versionOp(Common::SeekableReadStream &stream) {
// We only support v2 extended
- if (stream->readUint16BE() != 0x02FF)
+ if (stream.readUint16BE() != 0x02FF)
error("Unknown PICT version");
}
-void PictDecoder::o_longText(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_longText(Common::SeekableReadStream &stream) {
// Ignore
- stream->readUint16BE();
- stream->readUint16BE();
- stream->skip(stream->readByte());
+ stream.readUint16BE();
+ stream.readUint16BE();
+ stream.skip(stream.readByte());
}
-void PictDecoder::o_longComment(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_longComment(Common::SeekableReadStream &stream) {
// Ignore
- stream->readUint16BE();
- stream->skip(stream->readUint16BE());
+ stream.readUint16BE();
+ stream.skip(stream.readUint16BE());
}
-void PictDecoder::o_opEndPic(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_opEndPic(Common::SeekableReadStream &stream) {
// We've reached the end of the picture
_continueParsing = false;
}
-void PictDecoder::o_headerOp(Common::SeekableReadStream *stream) {
+void PICTDecoder::o_headerOp(Common::SeekableReadStream &stream) {
// Read the basic header, but we don't really have to do anything with it
- /* uint16 version = */ stream->readUint16BE();
- stream->readUint16BE(); // Reserved
- /* uint32 hRes = */ stream->readUint32BE();
- /* uint32 vRes = */ stream->readUint32BE();
+ /* uint16 version = */ stream.readUint16BE();
+ stream.readUint16BE(); // Reserved
+ /* uint32 hRes = */ stream.readUint32BE();
+ /* uint32 vRes = */ stream.readUint32BE();
Common::Rect origResRect;
- origResRect.top = stream->readUint16BE();
- origResRect.left = stream->readUint16BE();
- origResRect.bottom = stream->readUint16BE();
- origResRect.right = stream->readUint16BE();
- stream->readUint32BE(); // Reserved
+ origResRect.top = stream.readUint16BE();
+ origResRect.left = stream.readUint16BE();
+ origResRect.bottom = stream.readUint16BE();
+ origResRect.right = stream.readUint16BE();
+ stream.readUint32BE(); // Reserved
}
-void PictDecoder::on_packBitsRect(Common::SeekableReadStream *stream) {
+void PICTDecoder::on_packBitsRect(Common::SeekableReadStream &stream) {
// Unpack data (8bpp or lower)
unpackBitsRect(stream, true);
}
-void PictDecoder::on_directBitsRect(Common::SeekableReadStream *stream) {
+void PICTDecoder::on_directBitsRect(Common::SeekableReadStream &stream) {
// Unpack data (16bpp or higher)
unpackBitsRect(stream, false);
}
-void PictDecoder::on_compressedQuickTime(Common::SeekableReadStream *stream) {
+void PICTDecoder::on_compressedQuickTime(Common::SeekableReadStream &stream) {
// OK, here's the fun. We get to completely change how QuickDraw draws
// the data in PICT files.
@@ -173,63 +183,57 @@ void PictDecoder::on_compressedQuickTime(Common::SeekableReadStream *stream) {
_opcodes.clear();
setupOpcodesQuickTime();
- // We set up the surface for JPEG here too
- if (!_outputSurface)
- _outputSurface = new Graphics::Surface();
- _outputSurface->create(_imageRect.width(), _imageRect.height(), _pixelFormat);
-
// We'll decode the first QuickTime data from here, but the QuickTime-specific
// opcodes will take over from here on out. Normal opcodes, signing off.
decodeCompressedQuickTime(stream);
}
-void PictDecoder::oq_packBitsRect(Common::SeekableReadStream *stream) {
+void PICTDecoder::oq_packBitsRect(Common::SeekableReadStream &stream) {
// Skip any data here (8bpp or lower)
skipBitsRect(stream, true);
}
-void PictDecoder::oq_directBitsRect(Common::SeekableReadStream *stream) {
+void PICTDecoder::oq_directBitsRect(Common::SeekableReadStream &stream) {
// Skip any data here (16bpp or higher)
skipBitsRect(stream, false);
}
-void PictDecoder::oq_compressedQuickTime(Common::SeekableReadStream *stream) {
+void PICTDecoder::oq_compressedQuickTime(Common::SeekableReadStream &stream) {
// Just pass the data along
decodeCompressedQuickTime(stream);
}
-Surface *PictDecoder::decodeImage(Common::SeekableReadStream *stream, byte *palette) {
- assert(stream);
+bool PICTDecoder::loadStream(Common::SeekableReadStream &stream) {
+ destroy();
// Initialize opcodes to their normal state
_opcodes.clear();
setupOpcodesNormal();
- _outputSurface = 0;
_continueParsing = true;
memset(_palette, 0, sizeof(_palette));
- uint16 fileSize = stream->readUint16BE();
+ uint16 fileSize = stream.readUint16BE();
// If we have no file size here, we probably have a PICT from a file
// and not a resource. The other two bytes are the fileSize which we
// don't actually need (and already read if from a resource).
if (!fileSize)
- stream->seek(512 + 2);
+ stream.seek(512 + 2);
- _imageRect.top = stream->readUint16BE();
- _imageRect.left = stream->readUint16BE();
- _imageRect.bottom = stream->readUint16BE();
- _imageRect.right = stream->readUint16BE();
+ _imageRect.top = stream.readUint16BE();
+ _imageRect.left = stream.readUint16BE();
+ _imageRect.bottom = stream.readUint16BE();
+ _imageRect.right = stream.readUint16BE();
_imageRect.debugPrint(0, "PICT Rect:");
// NOTE: This is only a subset of the full PICT format.
// - Only V2 (Extended) Images Supported
// - CompressedQuickTime (JPEG) compressed data is supported
// - DirectBitsRect/PackBitsRect compressed data is supported
- for (uint32 opNum = 0; !stream->eos() && !stream->err() && stream->pos() < stream->size() && _continueParsing; opNum++) {
+ for (uint32 opNum = 0; !stream.eos() && !stream.err() && stream.pos() < stream.size() && _continueParsing; opNum++) {
// PICT v2 opcodes are two bytes
- uint16 opcode = stream->readUint16BE();
+ uint16 opcode = stream.readUint16BE();
if (opNum == 0 && opcode != 0x0011)
error("Cannot find PICT version opcode");
@@ -238,7 +242,7 @@ Surface *PictDecoder::decodeImage(Common::SeekableReadStream *stream, byte *pale
// Since opcodes are word-aligned, we need to mark our starting
// position here.
- uint32 startPos = stream->pos();
+ uint32 startPos = stream.pos();
for (uint32 i = 0; i < _opcodes.size(); i++) {
if (_opcodes[i].op == opcode) {
@@ -252,76 +256,70 @@ Surface *PictDecoder::decodeImage(Common::SeekableReadStream *stream, byte *pale
}
// Align
- stream->skip((stream->pos() - startPos) & 1);
+ stream.skip((stream.pos() - startPos) & 1);
}
- // If we got a palette throughout this nonsense, go and grab it
- if (palette)
- memcpy(palette, _palette, 256 * 3);
-
return _outputSurface;
}
-PictDecoder::PixMap PictDecoder::readPixMap(Common::SeekableReadStream *stream, bool hasBaseAddr) {
+PICTDecoder::PixMap PICTDecoder::readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr) {
PixMap pixMap;
- pixMap.baseAddr = hasBaseAddr ? stream->readUint32BE() : 0;
- pixMap.rowBytes = stream->readUint16BE() & 0x3fff;
- pixMap.bounds.top = stream->readUint16BE();
- pixMap.bounds.left = stream->readUint16BE();
- pixMap.bounds.bottom = stream->readUint16BE();
- pixMap.bounds.right = stream->readUint16BE();
- pixMap.pmVersion = stream->readUint16BE();
- pixMap.packType = stream->readUint16BE();
- pixMap.packSize = stream->readUint32BE();
- pixMap.hRes = stream->readUint32BE();
- pixMap.vRes = stream->readUint32BE();
- pixMap.pixelType = stream->readUint16BE();
- pixMap.pixelSize = stream->readUint16BE();
- pixMap.cmpCount = stream->readUint16BE();
- pixMap.cmpSize = stream->readUint16BE();
- pixMap.planeBytes = stream->readUint32BE();
- pixMap.pmTable = stream->readUint32BE();
- pixMap.pmReserved = stream->readUint32BE();
+ pixMap.baseAddr = hasBaseAddr ? stream.readUint32BE() : 0;
+ pixMap.rowBytes = stream.readUint16BE() & 0x3fff;
+ pixMap.bounds.top = stream.readUint16BE();
+ pixMap.bounds.left = stream.readUint16BE();
+ pixMap.bounds.bottom = stream.readUint16BE();
+ pixMap.bounds.right = stream.readUint16BE();
+ pixMap.pmVersion = stream.readUint16BE();
+ pixMap.packType = stream.readUint16BE();
+ pixMap.packSize = stream.readUint32BE();
+ pixMap.hRes = stream.readUint32BE();
+ pixMap.vRes = stream.readUint32BE();
+ pixMap.pixelType = stream.readUint16BE();
+ pixMap.pixelSize = stream.readUint16BE();
+ pixMap.cmpCount = stream.readUint16BE();
+ pixMap.cmpSize = stream.readUint16BE();
+ pixMap.planeBytes = stream.readUint32BE();
+ pixMap.pmTable = stream.readUint32BE();
+ pixMap.pmReserved = stream.readUint32BE();
return pixMap;
}
struct PackBitsRectData {
- PictDecoder::PixMap pixMap;
+ PICTDecoder::PixMap pixMap;
Common::Rect srcRect;
Common::Rect dstRect;
uint16 mode;
};
-void PictDecoder::unpackBitsRect(Common::SeekableReadStream *stream, bool hasPalette) {
- static const PixelFormat directBitsFormat16 = PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
-
+void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPalette) {
PackBitsRectData packBitsData;
- packBitsData.pixMap = readPixMap(stream, !hasPalette);
+ packBitsData.pixMap = readPixMap(stream, !withPalette);
// Read in the palette if there is one present
- if (hasPalette) {
+ if (withPalette) {
// See http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-267.html
- stream->readUint32BE(); // seed
- stream->readUint16BE(); // flags
- uint16 colorCount = stream->readUint16BE() + 1;
-
- for (uint32 i = 0; i < colorCount; i++) {
- stream->readUint16BE();
- _palette[i * 3] = stream->readUint16BE() >> 8;
- _palette[i * 3 + 1] = stream->readUint16BE() >> 8;
- _palette[i * 3 + 2] = stream->readUint16BE() >> 8;
+ stream.readUint32BE(); // seed
+ stream.readUint16BE(); // flags
+ _paletteColorCount = stream.readUint16BE() + 1;
+
+ for (uint32 i = 0; i < _paletteColorCount; i++) {
+ stream.readUint16BE();
+ _palette[i * 3] = stream.readUint16BE() >> 8;
+ _palette[i * 3 + 1] = stream.readUint16BE() >> 8;
+ _palette[i * 3 + 2] = stream.readUint16BE() >> 8;
}
}
- packBitsData.srcRect.top = stream->readUint16BE();
- packBitsData.srcRect.left = stream->readUint16BE();
- packBitsData.srcRect.bottom = stream->readUint16BE();
- packBitsData.srcRect.right = stream->readUint16BE();
- packBitsData.dstRect.top = stream->readUint16BE();
- packBitsData.dstRect.left = stream->readUint16BE();
- packBitsData.dstRect.bottom = stream->readUint16BE();
- packBitsData.dstRect.right = stream->readUint16BE();
- packBitsData.mode = stream->readUint16BE();
+ packBitsData.srcRect.top = stream.readUint16BE();
+ packBitsData.srcRect.left = stream.readUint16BE();
+ packBitsData.srcRect.bottom = stream.readUint16BE();
+ packBitsData.srcRect.right = stream.readUint16BE();
+ packBitsData.dstRect.top = stream.readUint16BE();
+ packBitsData.dstRect.left = stream.readUint16BE();
+ packBitsData.dstRect.bottom = stream.readUint16BE();
+ packBitsData.dstRect.right = stream.readUint16BE();
+ packBitsData.mode = stream.readUint16BE();
uint16 width = packBitsData.srcRect.width();
uint16 height = packBitsData.srcRect.height();
@@ -335,9 +333,6 @@ void PictDecoder::unpackBitsRect(Common::SeekableReadStream *stream, bool hasPal
else
bytesPerPixel = packBitsData.pixMap.pixelSize / 8;
- _outputSurface = new Graphics::Surface();
- _outputSurface->create(width, height, (bytesPerPixel == 1) ? PixelFormat::createFormatCLUT8() : _pixelFormat);
-
// Ensure we have enough space in the buffer to hold an entire line's worth of pixels
uint32 lineSize = MAX<int>(width * bytesPerPixel + (8 * 2 / packBitsData.pixMap.pixelSize), packBitsData.pixMap.rowBytes);
byte *buffer = new byte[lineSize * height];
@@ -355,56 +350,51 @@ void PictDecoder::unpackBitsRect(Common::SeekableReadStream *stream, bool hasPal
// TODO: Finish this. Hasn't been needed (yet).
error("Unpacked DirectBitsRect data (not padded)");
} else if (packBitsData.pixMap.packType == 0 || packBitsData.pixMap.packType > 2) { // Packed
- uint16 byteCount = (packBitsData.pixMap.rowBytes > 250) ? stream->readUint16BE() : stream->readByte();
- unpackBitsLine(buffer + i * _outputSurface->w * bytesPerPixel, packBitsData.pixMap.rowBytes, stream->readStream(byteCount), packBitsData.pixMap.pixelSize, bytesPerPixel);
+ uint16 byteCount = (packBitsData.pixMap.rowBytes > 250) ? stream.readUint16BE() : stream.readByte();
+ unpackBitsLine(buffer + i * width * bytesPerPixel, packBitsData.pixMap.rowBytes, stream.readStream(byteCount), packBitsData.pixMap.pixelSize, bytesPerPixel);
}
}
+ _outputSurface = new Graphics::Surface();
+
switch (bytesPerPixel) {
case 1:
// Just copy to the image
+ _outputSurface->create(width, height, PixelFormat::createFormatCLUT8());
memcpy(_outputSurface->pixels, buffer, _outputSurface->w * _outputSurface->h);
break;
case 2:
- // Convert from 16-bit to whatever surface we need
- for (uint16 y = 0; y < _outputSurface->h; y++) {
- for (uint16 x = 0; x < _outputSurface->w; x++) {
- byte r = 0, g = 0, b = 0;
- uint32 color = READ_BE_UINT16(buffer + (y * _outputSurface->w + x) * bytesPerPixel);
- directBitsFormat16.colorToRGB(color, r, g, b);
- if (_pixelFormat.bytesPerPixel == 2)
- *((uint16 *)_outputSurface->getBasePtr(x, y)) = _pixelFormat.RGBToColor(r, g, b);
- else
- *((uint32 *)_outputSurface->getBasePtr(x, y)) = _pixelFormat.RGBToColor(r, g, b);
- }
- }
+ // We have a 16-bit surface
+ _outputSurface->create(width, height, PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
+ for (uint16 y = 0; y < _outputSurface->h; y++)
+ for (uint16 x = 0; x < _outputSurface->w; x++)
+ WRITE_UINT16(_outputSurface->getBasePtr(x, y), READ_UINT16(buffer + (y * _outputSurface->w + x) * 2));
break;
case 3:
- // Convert from 24-bit (planar!) to whatever surface we need
+ // We have a planar 24-bit surface
+ _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
for (uint16 y = 0; y < _outputSurface->h; y++) {
for (uint16 x = 0; x < _outputSurface->w; x++) {
byte r = *(buffer + y * _outputSurface->w * 3 + x);
byte g = *(buffer + y * _outputSurface->w * 3 + _outputSurface->w + x);
byte b = *(buffer + y * _outputSurface->w * 3 + _outputSurface->w * 2 + x);
- if (_pixelFormat.bytesPerPixel == 2)
- *((uint16 *)_outputSurface->getBasePtr(x, y)) = _pixelFormat.RGBToColor(r, g, b);
- else
- *((uint32 *)_outputSurface->getBasePtr(x, y)) = _pixelFormat.RGBToColor(r, g, b);
+ *((uint32 *)_outputSurface->getBasePtr(x, y)) = _outputSurface->format.RGBToColor(r, g, b);
}
}
break;
case 4:
- // Convert from 32-bit (planar!) to whatever surface we need
+ // We have a planar 32-bit surface
+ // Note that we ignore the alpha channel since it seems to not be correct
+ // Mac OS X does not ignore it, but then displays it incorrectly. Photoshop
+ // does ignore it and displays it correctly.
+ _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
for (uint16 y = 0; y < _outputSurface->h; y++) {
for (uint16 x = 0; x < _outputSurface->w; x++) {
- byte r = *(buffer + y * _outputSurface->w * 4 + x);
- byte g = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w + x);
- byte b = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 2 + x);
- byte a = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 3 + x);
- if (_pixelFormat.bytesPerPixel == 2)
- *((uint16 *)_outputSurface->getBasePtr(x, y)) = _pixelFormat.ARGBToColor(r, g, b, a);
- else
- *((uint32 *)_outputSurface->getBasePtr(x, y)) = _pixelFormat.ARGBToColor(r, g, b, a);
+ byte a = 0xFF;
+ byte r = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w + x);
+ byte g = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 2 + x);
+ byte b = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 3 + x);
+ *((uint32 *)_outputSurface->getBasePtr(x, y)) = _outputSurface->format.ARGBToColor(a, r, g, b);
}
}
break;
@@ -413,7 +403,7 @@ void PictDecoder::unpackBitsRect(Common::SeekableReadStream *stream, bool hasPal
delete[] buffer;
}
-void PictDecoder::unpackBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel) {
+void PICTDecoder::unpackBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel) {
uint32 dataDecoded = 0;
byte bytesPerDecode = (bytesPerPixel == 2) ? 2 : 1;
@@ -426,7 +416,7 @@ void PictDecoder::unpackBitsLine(byte *out, uint32 length, Common::SeekableReadS
for (uint32 i = 0; i < runSize; i++) {
if (bytesPerDecode == 2) {
- WRITE_BE_UINT16(out, value);
+ WRITE_UINT16(out, value);
out += 2;
} else {
outputPixelBuffer(out, value, bitsPerPixel);
@@ -434,12 +424,19 @@ void PictDecoder::unpackBitsLine(byte *out, uint32 length, Common::SeekableReadS
}
dataDecoded += runSize * bytesPerDecode;
} else {
- uint32 runSize = (op + 1) * bytesPerDecode;
-
- for (uint32 i = 0; i < runSize; i++)
- outputPixelBuffer(out, data->readByte(), bitsPerPixel);
+ uint32 runSize = op + 1;
+
+ if (bytesPerDecode == 1) {
+ for (uint32 i = 0; i < runSize; i++)
+ outputPixelBuffer(out, data->readByte(), bitsPerPixel);
+ } else {
+ for (uint32 i = 0; i < runSize; i++) {
+ WRITE_UINT16(out, data->readUint16BE());
+ out += 2;
+ }
+ }
- dataDecoded += runSize;
+ dataDecoded += runSize * bytesPerDecode;
}
}
@@ -453,33 +450,52 @@ void PictDecoder::unpackBitsLine(byte *out, uint32 length, Common::SeekableReadS
delete data;
}
-void PictDecoder::skipBitsRect(Common::SeekableReadStream *stream, bool hasPalette) {
+void PICTDecoder::outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel) {
+ switch (bitsPerPixel) {
+ case 1:
+ for (int i = 7; i >= 0; i--)
+ *out++ = (value >> i) & 1;
+ break;
+ case 2:
+ for (int i = 6; i >= 0; i -= 2)
+ *out++ = (value >> i) & 3;
+ break;
+ case 4:
+ *out++ = (value >> 4) & 0xf;
+ *out++ = value & 0xf;
+ break;
+ default:
+ *out++ = value;
+ }
+}
+
+void PICTDecoder::skipBitsRect(Common::SeekableReadStream &stream, bool withPalette) {
// Step through a PackBitsRect/DirectBitsRect function
- if (!hasPalette)
- stream->readUint32BE();
+ if (!withPalette)
+ stream.readUint32BE();
- uint16 rowBytes = stream->readUint16BE();
- uint16 height = stream->readUint16BE();
- stream->readUint16BE();
- height = stream->readUint16BE() - height;
- stream->readUint16BE();
+ uint16 rowBytes = stream.readUint16BE();
+ uint16 height = stream.readUint16BE();
+ stream.readUint16BE();
+ height = stream.readUint16BE() - height;
+ stream.readUint16BE();
uint16 packType;
// Top two bits signify PixMap vs BitMap
if (rowBytes & 0xC000) {
// PixMap
- stream->readUint16BE();
- packType = stream->readUint16BE();
- stream->skip(14);
- stream->readUint16BE(); // pixelSize
- stream->skip(16);
-
- if (hasPalette) {
- stream->readUint32BE();
- stream->readUint16BE();
- stream->skip((stream->readUint16BE() + 1) * 8);
+ stream.readUint16BE();
+ packType = stream.readUint16BE();
+ stream.skip(14);
+ stream.readUint16BE(); // pixelSize
+ stream.skip(16);
+
+ if (withPalette) {
+ stream.readUint32BE();
+ stream.readUint16BE();
+ stream.skip((stream.readUint16BE() + 1) * 8);
}
rowBytes &= 0x3FFF;
@@ -488,85 +504,74 @@ void PictDecoder::skipBitsRect(Common::SeekableReadStream *stream, bool hasPalet
packType = 0;
}
- stream->skip(18);
+ stream.skip(18);
for (uint16 i = 0; i < height; i++) {
if (packType == 1 || packType == 2 || rowBytes < 8)
error("Unpacked PackBitsRect data");
else if (packType == 0 || packType > 2)
- stream->skip((rowBytes > 250) ? stream->readUint16BE() : stream->readByte());
- }
-}
-
-void PictDecoder::outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel) {
- switch (bitsPerPixel) {
- case 1:
- for (int i = 7; i >= 0; i--)
- *out++ = (value >> i) & 1;
- break;
- case 2:
- for (int i = 6; i >= 0; i -= 2)
- *out++ = (value >> i) & 3;
- break;
- case 4:
- *out++ = (value >> 4) & 0xf;
- *out++ = value & 0xf;
- break;
- default:
- *out++ = value;
+ stream.skip((rowBytes > 250) ? stream.readUint16BE() : stream.readByte());
}
}
// Compressed QuickTime details can be found here:
// http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/B-Chapter/2TheImageCompression.html
// http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/F-Chapter/6WorkingwiththeImage.html
-
-void PictDecoder::decodeCompressedQuickTime(Common::SeekableReadStream *stream) {
+void PICTDecoder::decodeCompressedQuickTime(Common::SeekableReadStream &stream) {
// First, read all the fields from the opcode
- uint32 dataSize = stream->readUint32BE();
- uint32 startPos = stream->pos();
+ uint32 dataSize = stream.readUint32BE();
+ uint32 startPos = stream.pos();
- /* uint16 version = */ stream->readUint16BE();
+ /* uint16 version = */ stream.readUint16BE();
// Read in the display matrix
uint32 matrix[3][3];
for (uint32 i = 0; i < 3; i++)
for (uint32 j = 0; j < 3; j++)
- matrix[i][j] = stream->readUint32BE();
+ matrix[i][j] = stream.readUint32BE();
// We currently only support offseting images vertically from the matrix
uint16 xOffset = 0;
uint16 yOffset = matrix[2][1] >> 16;
- uint32 matteSize = stream->readUint32BE();
- stream->skip(8); // matte rect
- /* uint16 transferMode = */ stream->readUint16BE();
- stream->skip(8); // src rect
- /* uint32 accuracy = */ stream->readUint32BE();
- uint32 maskSize = stream->readUint32BE();
+ uint32 matteSize = stream.readUint32BE();
+ stream.skip(8); // matte rect
+ /* uint16 transferMode = */ stream.readUint16BE();
+ stream.skip(8); // src rect
+ /* uint32 accuracy = */ stream.readUint32BE();
+ uint32 maskSize = stream.readUint32BE();
// Skip the matte and mask
- stream->skip(matteSize + maskSize);
-
+ stream.skip(matteSize + maskSize);
+
// Now we've reached the image descriptor, so read the relevant data from that
- uint32 idStart = stream->pos();
- uint32 idSize = stream->readUint32BE();
- stream->skip(40); // miscellaneous stuff
- uint32 jpegSize = stream->readUint32BE();
- stream->skip(idSize - (stream->pos() - idStart)); // more useless stuff
+ uint32 idStart = stream.pos();
+ uint32 idSize = stream.readUint32BE();
+ uint32 codec = stream.readUint32BE();
+ stream.skip(36); // miscellaneous stuff
+ uint32 jpegSize = stream.readUint32BE();
+ stream.skip(idSize - (stream.pos() - idStart)); // more useless stuff
- Common::SeekableReadStream *jpegStream = new Common::SeekableSubReadStream(stream, stream->pos(), stream->pos() + jpegSize);
+ if (codec != MKTAG('j', 'p', 'e', 'g'))
+ error("Unhandled CompressedQuickTime format '%s'", tag2str(codec));
- if (!_jpeg->read(jpegStream))
- error("PictDecoder::decodeCompressedQuickTime(): Could not decode JPEG data");
+ Common::SeekableSubReadStream jpegStream(&stream, stream.pos(), stream.pos() + jpegSize);
- Graphics::Surface *jpegSurface = _jpeg->getSurface(_pixelFormat);
+ JPEGDecoder jpeg;
+ if (!jpeg.loadStream(jpegStream))
+ error("PICTDecoder::decodeCompressedQuickTime(): Could not decode JPEG data");
+
+ const Graphics::Surface *jpegSurface = jpeg.getSurface();
+
+ if (!_outputSurface) {
+ _outputSurface = new Graphics::Surface();
+ _outputSurface->create(_imageRect.width(), _imageRect.height(), jpegSurface->format);
+ }
for (uint16 y = 0; y < jpegSurface->h; y++)
- memcpy(_outputSurface->getBasePtr(0 + xOffset, y + yOffset), jpegSurface->getBasePtr(0, y), jpegSurface->w * _pixelFormat.bytesPerPixel);
+ memcpy(_outputSurface->getBasePtr(0 + xOffset, y + yOffset), jpegSurface->getBasePtr(0, y), jpegSurface->w * jpegSurface->format.bytesPerPixel);
- stream->seek(startPos + dataSize);
- delete jpegStream;
+ stream.seek(startPos + dataSize);
}
} // End of namespace Graphics
diff --git a/graphics/pict.h b/graphics/decoders/pict.h
index b426c6ee35..6f0d86c7a1 100644
--- a/graphics/pict.h
+++ b/graphics/decoders/pict.h
@@ -20,6 +20,14 @@
*
*/
+/**
+ * @file
+ * Image decoder used in engines:
+ * - mohawk
+ * - pegasus
+ * - sci
+ */
+
#ifndef GRAPHICS_PICT_H
#define GRAPHICS_PICT_H
@@ -27,6 +35,7 @@
#include "common/rect.h"
#include "common/scummsys.h"
+#include "graphics/decoders/image_decoder.h"
#include "graphics/pixelformat.h"
namespace Common {
@@ -35,16 +44,21 @@ class SeekableReadStream;
namespace Graphics {
-class JPEG;
struct Surface;
-#define DECLARE_OPCODE(x) void x(Common::SeekableReadStream *stream)
+#define DECLARE_OPCODE(x) void x(Common::SeekableReadStream &stream)
-class PictDecoder {
+class PICTDecoder : public ImageDecoder {
public:
- PictDecoder(Graphics::PixelFormat pixelFormat);
- ~PictDecoder();
- Surface *decodeImage(Common::SeekableReadStream *stream, byte *palette = 0);
+ PICTDecoder();
+ ~PICTDecoder();
+
+ // ImageDecoder API
+ bool loadStream(Common::SeekableReadStream &stream);
+ void destroy();
+ const Surface *getSurface() const { return _outputSurface; }
+ const byte *getPalette() const { return _palette; }
+ uint16 getPaletteColorCount() const { return _paletteColorCount; }
struct PixMap {
uint32 baseAddr;
@@ -64,26 +78,24 @@ public:
uint32 pmReserved;
};
- static PixMap readPixMap(Common::SeekableReadStream *stream, bool hasBaseAddr = true);
+ static PixMap readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr = true);
private:
Common::Rect _imageRect;
- PixelFormat _pixelFormat;
- JPEG *_jpeg;
byte _palette[256 * 3];
- bool _isPaletted;
+ uint16 _paletteColorCount;
Graphics::Surface *_outputSurface;
bool _continueParsing;
// Utility Functions
- void unpackBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
- void unpackBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel);
- void skipBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
- void decodeCompressedQuickTime(Common::SeekableReadStream *stream);
+ void unpackBitsRect(Common::SeekableReadStream &stream, bool withPalette);
+ void unpackBitsLine(byte *out, uint32 length, Common::SeekableReadStream *stream, byte bitsPerPixel, byte bytesPerPixel);
+ void skipBitsRect(Common::SeekableReadStream &stream, bool withPalette);
+ void decodeCompressedQuickTime(Common::SeekableReadStream &stream);
void outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel);
// Opcodes
- typedef void (PictDecoder::*OpcodeProcPICT)(Common::SeekableReadStream *stream);
+ typedef void (PICTDecoder::*OpcodeProcPICT)(Common::SeekableReadStream &stream);
struct PICTOpcode {
PICTOpcode() { op = 0; proc = 0; desc = 0; }
PICTOpcode(uint16 o, OpcodeProcPICT p, const char *d) { op = o; proc = p; desc = d; }
diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp
new file mode 100644
index 0000000000..4f917b44b1
--- /dev/null
+++ b/graphics/decoders/png.cpp
@@ -0,0 +1,241 @@
+/* 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 we need to work with libpng here, we need to allow all symbols
+// to avoid compilation issues.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "common/scummsys.h"
+
+#ifdef USE_PNG
+#include <png.h>
+#endif
+
+#include "graphics/decoders/png.h"
+
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+
+#include "common/stream.h"
+
+namespace Graphics {
+
+PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0) {
+}
+
+PNGDecoder::~PNGDecoder() {
+ destroy();
+}
+
+void PNGDecoder::destroy() {
+ if (_outputSurface) {
+ _outputSurface->free();
+ delete _outputSurface;
+ _outputSurface = 0;
+ }
+ delete[] _palette;
+ _palette = NULL;
+}
+
+#ifdef USE_PNG
+// libpng-error-handling:
+void pngError(png_structp pngptr, png_const_charp errorMsg) {
+ error("%s", errorMsg);
+}
+
+void pngWarning(png_structp pngptr, png_const_charp warningMsg) {
+ warning("%s", warningMsg);
+}
+
+// libpng-I/O-helper:
+void pngReadFromStream(png_structp pngPtr, png_bytep data, png_size_t length) {
+ void *readIOptr = png_get_io_ptr(pngPtr);
+ Common::SeekableReadStream *stream = (Common::SeekableReadStream *)readIOptr;
+ stream->read(data, length);
+}
+#endif
+
+/*
+ * This code is based on Broken Sword 2.5 engine
+ *
+ * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
+ *
+ * Licensed under GNU GPL v2
+ *
+ */
+
+bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
+#ifdef USE_PNG
+ destroy();
+
+ _stream = &stream;
+
+ // First, check the PNG signature
+ if (_stream->readUint32BE() != MKTAG(0x89, 'P', 'N', 'G')) {
+ delete _stream;
+ return false;
+ }
+ if (_stream->readUint32BE() != MKTAG(0x0d, 0x0a, 0x1a, 0x0a)) {
+ delete _stream;
+ return false;
+ }
+
+ // The following is based on the guide provided in:
+ //http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-3
+ //http://www.libpng.org/pub/png/libpng-1.4.0-manual.pdf
+ // along with the png-loading code used in the sword25-engine.
+ png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (!pngPtr) {
+ delete _stream;
+ return false;
+ }
+ png_infop infoPtr = png_create_info_struct(pngPtr);
+ if (!infoPtr) {
+ png_destroy_read_struct(&pngPtr, NULL, NULL);
+ delete _stream;
+ return false;
+ }
+ png_infop endInfo = png_create_info_struct(pngPtr);
+ if (!endInfo) {
+ png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
+ delete _stream;
+ return false;
+ }
+
+ png_set_error_fn(pngPtr, NULL, pngError, pngWarning);
+ // TODO: The manual says errors should be handled via setjmp
+
+ png_set_read_fn(pngPtr, _stream, pngReadFromStream);
+ png_set_crc_action(pngPtr, PNG_CRC_DEFAULT, PNG_CRC_WARN_USE);
+ // We already verified the PNG-header
+ png_set_sig_bytes(pngPtr, 8);
+
+ // Read PNG header
+ png_read_info(pngPtr, infoPtr);
+
+ // No handling for unknown chunks yet.
+ int bitDepth, colorType, width, height, interlaceType;
+ png_uint_32 w, h;
+ png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, &interlaceType, NULL, NULL);
+ width = w;
+ height = h;
+
+ // Allocate memory for the final image data.
+ // To keep memory framentation low this happens before allocating memory for temporary image data.
+ _outputSurface = new Graphics::Surface();
+
+ // Images of all color formats except PNG_COLOR_TYPE_PALETTE
+ // will be transformed into ARGB images
+ if (colorType == PNG_COLOR_TYPE_PALETTE && !png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) {
+ int numPalette = 0;
+ png_colorp palette = NULL;
+ uint32 success = png_get_PLTE(pngPtr, infoPtr, &palette, &numPalette);
+ if (success != PNG_INFO_PLTE) {
+ png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
+ return false;
+ }
+ _paletteColorCount = numPalette;
+ _palette = new byte[_paletteColorCount * 3];
+ for (int i = 0; i < _paletteColorCount; i++) {
+ _palette[(i * 3)] = palette[i].red;
+ _palette[(i * 3) + 1] = palette[i].green;
+ _palette[(i * 3) + 2] = palette[i].blue;
+
+ }
+ _outputSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ png_set_packing(pngPtr);
+ } else {
+ _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+ if (!_outputSurface->pixels) {
+ error("Could not allocate memory for output image.");
+ }
+ if (bitDepth == 16)
+ png_set_strip_16(pngPtr);
+ if (bitDepth < 8)
+ png_set_expand(pngPtr);
+ if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS))
+ png_set_expand(pngPtr);
+ if (colorType == PNG_COLOR_TYPE_GRAY ||
+ colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
+ png_set_gray_to_rgb(pngPtr);
+
+ // PNGs are Big-Endian:
+#ifdef SCUMM_LITTLE_ENDIAN
+ png_set_bgr(pngPtr);
+ png_set_swap_alpha(pngPtr);
+ if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
+ png_set_filler(pngPtr, 0xff, PNG_FILLER_BEFORE);
+#else
+ if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
+ png_set_filler(pngPtr, 0xff, PNG_FILLER_AFTER);
+#endif
+
+ }
+
+ // After the transformations have been registered, the image data is read again.
+ png_set_interlace_handling(pngPtr);
+ png_read_update_info(pngPtr, infoPtr);
+ png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, NULL, NULL, NULL);
+ width = w;
+ height = h;
+
+ if (interlaceType == PNG_INTERLACE_NONE) {
+ // PNGs without interlacing can simply be read row by row.
+ for (int i = 0; i < height; i++) {
+ png_read_row(pngPtr, (png_bytep)_outputSurface->getBasePtr(0, i), NULL);
+ }
+ } else {
+ // PNGs with interlacing require us to allocate an auxillary
+ // buffer with pointers to all row starts.
+
+ // Allocate row pointer buffer
+ png_bytep *rowPtr = new png_bytep[height];
+ if (!rowPtr) {
+ error("Could not allocate memory for row pointers.");
+ }
+
+ // Initialize row pointers
+ for (int i = 0; i < height; i++)
+ rowPtr[i] = (png_bytep)_outputSurface->getBasePtr(0, i);
+
+ // Read image data
+ png_read_image(pngPtr, rowPtr);
+
+ // Free row pointer buffer
+ delete[] rowPtr;
+ }
+
+ // Read additional data at the end.
+ png_read_end(pngPtr, NULL);
+
+ // Destroy libpng structures
+ png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
+
+ // We no longer need the file stream, thus close it here
+ _stream = 0;
+
+ return true;
+#else
+ return false;
+#endif
+}
+
+} // End of Graphics namespace
diff --git a/graphics/decoders/png.h b/graphics/decoders/png.h
new file mode 100644
index 0000000000..e52ddabd7d
--- /dev/null
+++ b/graphics/decoders/png.h
@@ -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.
+ *
+ */
+
+/*
+ * PNG decoder used in engines:
+ * - sword25
+ * Dependencies:
+ * - libpng
+ */
+
+#ifndef GRAPHICS_PNG_H
+#define GRAPHICS_PNG_H
+
+#include "common/scummsys.h"
+#include "common/textconsole.h"
+#include "graphics/decoders/image_decoder.h"
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Graphics {
+
+struct Surface;
+struct PixelFormat;
+
+class PNGDecoder : public ImageDecoder {
+public:
+ PNGDecoder();
+ ~PNGDecoder();
+
+ bool loadStream(Common::SeekableReadStream &stream);
+ void destroy();
+ const Graphics::Surface *getSurface() const { return _outputSurface; }
+ const byte *getPalette() const { return _palette; }
+ uint16 getPaletteColorCount() const { return _paletteColorCount; }
+private:
+ Common::SeekableReadStream *_stream;
+ byte *_palette;
+ uint16 _paletteColorCount;
+
+ Graphics::Surface *_outputSurface;
+};
+
+} // End of namespace Graphics
+
+#endif // GRAPHICS_PNG_H
diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp
new file mode 100644
index 0000000000..c3b9d84055
--- /dev/null
+++ b/graphics/decoders/tga.cpp
@@ -0,0 +1,427 @@
+/* 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.
+ */
+
+/* Based on code from xoreos https://github.com/DrMcCoy/xoreos/
+ * relicensed under GPLv2+ with permission from DrMcCoy and clone2727
+ */
+
+#include "common/util.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+#include "common/error.h"
+
+#include "graphics/decoders/tga.h"
+
+namespace Graphics {
+
+TGADecoder::TGADecoder() {
+ _colorMapSize = 0;
+ _colorMapOrigin = 0;
+ _colorMapLength = 0;
+ _colorMapEntryLength = 0;
+ _colorMap = NULL;
+}
+
+TGADecoder::~TGADecoder() {
+ destroy();
+}
+
+void TGADecoder::destroy() {
+ _surface.free();
+ delete[] _colorMap;
+}
+
+bool TGADecoder::loadStream(Common::SeekableReadStream &tga) {
+ byte imageType, pixelDepth;
+ bool success;
+ success = readHeader(tga, imageType, pixelDepth);
+ if (success) {
+ switch (imageType) {
+ case TYPE_BW:
+ case TYPE_TRUECOLOR:
+ success = readData(tga, imageType, pixelDepth);
+ break;
+ case TYPE_RLE_BW:
+ case TYPE_RLE_TRUECOLOR:
+ case TYPE_RLE_CMAP:
+ success = readDataRLE(tga, imageType, pixelDepth);
+ break;
+ case TYPE_CMAP:
+ success = readDataColorMapped(tga, imageType, pixelDepth);
+ break;
+ default:
+ success = false;
+ break;
+ }
+ }
+ if (tga.err() || !success) {
+ warning("Failed reading TGA-file");
+ return false;
+ }
+ return success;
+}
+
+bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte &imageType, byte &pixelDepth) {
+ if (!tga.seek(0)) {
+ warning("Failed reading TGA-file");
+ return false;
+ }
+
+ // TGAs have an optional "id" string in the header
+ uint32 idLength = tga.readByte();
+
+ // Number of colors in the color map / palette
+ int hasColorMap = tga.readByte();
+
+ // Image type. See header for numeric constants
+ imageType = tga.readByte();
+
+ switch (imageType) {
+ case TYPE_CMAP:
+ case TYPE_TRUECOLOR:
+ case TYPE_BW:
+ case TYPE_RLE_CMAP:
+ case TYPE_RLE_TRUECOLOR:
+ case TYPE_RLE_BW:
+ break;
+ default:
+ warning("Unsupported image type: %d", imageType);
+ return false;
+ }
+
+ // Color map specifications
+ if (hasColorMap == 0) {
+ tga.skip(5);
+ } else {
+ _colorMapOrigin = tga.readUint16LE();
+ _colorMapLength = tga.readUint16LE();
+ _colorMapEntryLength = tga.readByte();
+ }
+ // Origin-defintions
+ tga.skip(2 + 2);
+
+ // Image dimensions
+ _surface.w = tga.readUint16LE();
+ _surface.h = tga.readUint16LE();
+
+ // Bits per pixel
+ pixelDepth = tga.readByte();
+ _surface.format.bytesPerPixel = pixelDepth / 8;
+
+ // Image descriptor
+ byte imgDesc = tga.readByte();
+ int attributeBits = imgDesc & 0x0F;
+ assert((imgDesc & 0x10) == 0);
+ _originTop = (imgDesc & 0x20);
+
+ // Interleaving is not handled at this point
+ //int interleave = (imgDesc & 0xC);
+ if (imageType == TYPE_CMAP || imageType == TYPE_RLE_CMAP) {
+ if (pixelDepth == 8) {
+ _format = PixelFormat::createFormatCLUT8();
+ } else {
+ warning("Unsupported index-depth: %d", pixelDepth);
+ return false;
+ }
+ } else if (imageType == TYPE_TRUECOLOR || imageType == TYPE_RLE_TRUECOLOR) {
+ if (pixelDepth == 24) {
+ _format = PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0);
+ } else if (pixelDepth == 32) {
+ // HACK: According to the spec, attributeBits should determine the amount
+ // of alpha-bits, however, as the game files that use this decoder seems
+ // to ignore that fact, we force the amount to 8 for 32bpp files for now.
+ _format = PixelFormat(4, 8, 8, 8, /* attributeBits */ 8, 16, 8, 0, 24);
+ } else if (pixelDepth == 16 && imageType == TYPE_TRUECOLOR) {
+ // 16bpp TGA is ARGB1555
+ _format = PixelFormat(2, 5, 5, 5, attributeBits, 10, 5, 0, 15);
+ } else {
+ warning("Unsupported pixel depth: %d, %d", imageType, pixelDepth);
+ return false;
+ }
+ } else if (imageType == TYPE_BW || TYPE_RLE_BW) {
+ if (pixelDepth == 8) {
+ _format = PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
+ } else {
+ warning("Unsupported pixel depth: %d, %d", imageType, pixelDepth);
+ return false;
+ }
+
+ } else {
+ warning("Unsupported image type: %d", imageType);
+ return false;
+ }
+
+ // Skip the id string
+ tga.skip(idLength);
+
+ if (hasColorMap) {
+ return readColorMap(tga, imageType, pixelDepth);
+ }
+ return true;
+}
+
+bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth) {
+ _colorMap = new byte[3 * _colorMapLength];
+ for (int i = 0; i < _colorMapLength * 3; i += 3) {
+ byte r, g, b;
+ if (_colorMapEntryLength == 32) {
+ byte a;
+ PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24);
+ uint32 color = tga.readUint32LE();
+ format.colorToARGB(color, a, r, g, b);
+ } else if (_colorMapEntryLength == 24) {
+ r = tga.readByte();
+ g = tga.readByte();
+ b = tga.readByte();
+ } else if (_colorMapEntryLength == 16) {
+ byte a;
+ PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
+ uint16 color = tga.readUint16LE();
+ format.colorToARGB(color, a, r, g, b);
+ } else {
+ warning("Unsupported image type: %d", imageType);
+ r = g = b = 0;
+ }
+#ifdef SCUMM_LITTLE_ENDIAN
+ _colorMap[i] = r;
+ _colorMap[i + 1] = g;
+ _colorMap[i + 2] = b;
+#else
+ _colorMap[i] = b;
+ _colorMap[i + 1] = g;
+ _colorMap[i + 2] = r;
+#endif
+ }
+ return true;
+}
+
+// Additional information found from http://paulbourke.net/dataformats/tga/
+// With some details from the link referenced in the header.
+bool TGADecoder::readData(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth) {
+ // TrueColor
+ if (imageType == TYPE_TRUECOLOR) {
+ _surface.create(_surface.w, _surface.h, _format);
+
+ if (pixelDepth == 16) {
+ for (int i = 0; i < _surface.h; i++) {
+ uint16 *dst;
+ if (!_originTop) {
+ dst = (uint16 *)_surface.getBasePtr(0, _surface.h - i - 1);
+ } else {
+ dst = (uint16 *)_surface.getBasePtr(0, i);
+ }
+ for (int j = 0; j < _surface.w; j++) {
+ *dst++ = tga.readUint16LE();
+ }
+ }
+ } else if (pixelDepth == 32) {
+ for (int i = 0; i < _surface.h; i++) {
+ uint32 *dst;
+ if (!_originTop) {
+ dst = (uint32 *)_surface.getBasePtr(0, _surface.h - i - 1);
+ } else {
+ dst = (uint32 *)_surface.getBasePtr(0, i);
+ }
+ for (int j = 0; j < _surface.w; j++) {
+ *dst++ = tga.readUint32LE();
+ }
+ }
+ } else if (pixelDepth == 24) {
+ for (int i = 0; i < _surface.h; i++) {
+ byte *dst;
+ if (!_originTop) {
+ dst = (byte *)_surface.getBasePtr(0, _surface.h - i - 1);
+ } else {
+ dst = (byte *)_surface.getBasePtr(0, i);
+ }
+ for (int j = 0; j < _surface.w; j++) {
+ byte r = tga.readByte();
+ byte g = tga.readByte();
+ byte b = tga.readByte();
+#ifdef SCUMM_LITTLE_ENDIAN
+ *dst++ = r;
+ *dst++ = g;
+ *dst++ = b;
+#else
+ *dst++ = b;
+ *dst++ = g;
+ *dst++ = r;
+#endif
+ }
+ }
+ }
+ // Black/White
+ } else if (imageType == TYPE_BW) {
+ _surface.create(_surface.w, _surface.h, _format);
+
+ byte *data = (byte *)_surface.pixels;
+ uint32 count = _surface.w * _surface.h;
+
+ while (count-- > 0) {
+ byte g = tga.readByte();
+ *data++ = g;
+ *data++ = g;
+ *data++ = g;
+ *data++ = g;
+ }
+ }
+ return true;
+}
+
+bool TGADecoder::readDataColorMapped(Common::SeekableReadStream &tga, byte imageType, byte indexDepth) {
+ // Color-mapped
+ if (imageType == TYPE_CMAP) {
+ _surface.create(_surface.w, _surface.h, _format);
+ if (indexDepth == 8) {
+ for (int i = 0; i < _surface.h; i++) {
+ byte *dst;
+ if (!_originTop) {
+ dst = (byte *)_surface.getBasePtr(0, _surface.h - i - 1);
+ } else {
+ dst = (byte *)_surface.getBasePtr(0, i);
+ }
+ for (int j = 0; j < _surface.w; j++) {
+ byte index = tga.readByte();
+ *dst++ = index;
+ }
+ }
+ } else if (indexDepth == 16) {
+ warning("16 bit indexes not supported");
+ return false;
+ }
+ } else {
+ return false;
+ }
+ return true;
+}
+
+bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth) {
+ // RLE-TrueColor / RLE-Black/White
+ if (imageType == TYPE_RLE_TRUECOLOR || imageType == TYPE_RLE_BW || imageType == TYPE_RLE_CMAP) {
+ _surface.create(_surface.w, _surface.h, _format);
+ uint32 count = _surface.w * _surface.h;
+ byte *data = (byte *)_surface.pixels;
+
+ while (count > 0) {
+ uint32 header = tga.readByte();
+ byte type = (header & 0x80) >> 7;
+ uint32 rleCount = (header & 0x7F) + 1;
+
+ // RLE-packet
+ if (type == 1) {
+ if (pixelDepth == 32 && imageType == TYPE_RLE_TRUECOLOR) {
+ uint32 color = tga.readUint32LE();
+ while (rleCount-- > 0) {
+ *((uint32 *)data) = color;
+ data += 4;
+ count--;
+ }
+ } else if (pixelDepth == 24 && imageType == TYPE_RLE_TRUECOLOR) {
+ byte r = tga.readByte();
+ byte g = tga.readByte();
+ byte b = tga.readByte();
+ while (rleCount-- > 0) {
+#ifdef SCUMM_LITTLE_ENDIAN
+ *data++ = r;
+ *data++ = g;
+ *data++ = b;
+#else
+ *data++ = b;
+ *data++ = g;
+ *data++ = r;
+#endif
+ count--;
+ }
+ } else if (pixelDepth == 8 && imageType == TYPE_RLE_BW) {
+ byte color = tga.readByte();
+ while (rleCount-- > 0) {
+ *data++ = color;
+ *data++ = color;
+ *data++ = color;
+ *data++ = color;
+ count--;
+ }
+ } else if (pixelDepth == 8 && imageType == TYPE_RLE_CMAP) {
+ byte index = tga.readByte();
+ while (rleCount-- > 0) {
+ *data++ = index;
+ count--;
+ }
+ } else {
+ warning("Unhandled pixel-depth for image-type 10");
+ return false;
+ }
+ // Raw-packet
+ } else if (type == 0) {
+ if (pixelDepth == 32 && imageType == TYPE_RLE_TRUECOLOR) {
+ while (rleCount-- > 0) {
+ uint32 color = tga.readUint32LE();
+ *((uint32 *)data) = color;
+ data += 4;
+ count--;
+ }
+ } else if (pixelDepth == 24 && imageType == TYPE_RLE_TRUECOLOR) {
+ while (rleCount-- > 0) {
+ byte r = tga.readByte();
+ byte g = tga.readByte();
+ byte b = tga.readByte();
+#ifdef SCUMM_LITTLE_ENDIAN
+ *data++ = r;
+ *data++ = g;
+ *data++ = b;
+#else
+ *data++ = b;
+ *data++ = g;
+ *data++ = r;
+#endif
+ count--;
+ }
+ } else if (pixelDepth == 8 && imageType == TYPE_RLE_BW) {
+ while (rleCount-- > 0) {
+ byte color = tga.readByte();
+ *data++ = color;
+ *data++ = color;
+ *data++ = color;
+ *data++ = color;
+ count--;
+ }
+ } else if (pixelDepth == 8 && imageType == TYPE_RLE_CMAP) {
+ while (rleCount-- > 0) {
+ byte index = tga.readByte();
+ *data++ = index;
+ count--;
+ }
+ } else {
+ warning("Unhandled pixel-depth for image-type 10");
+ return false;
+ }
+ } else {
+ warning("Unknown header for RLE-packet %d", type);
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ return true;
+}
+
+} // End of namespace Graphics
diff --git a/graphics/decoders/tga.h b/graphics/decoders/tga.h
new file mode 100644
index 0000000000..dfdc5a4da9
--- /dev/null
+++ b/graphics/decoders/tga.h
@@ -0,0 +1,98 @@
+/* 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.
+ */
+
+/* Based on code from eos https://github.com/DrMcCoy/xoreos/
+ * relicensed under GPLv2+ with permission from DrMcCoy and clone2727
+ */
+
+/*
+ * TGA decoder used in engines:
+ * - none
+ */
+
+#ifndef GRAPHICS_DECODERS_TGA_H
+#define GRAPHICS_DECODERS_TGA_H
+
+#include "graphics/surface.h"
+#include "graphics/decoders/image_decoder.h"
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Graphics {
+
+/** TarGa image-decoder
+ * The following variations of TGA are supported:
+ * - Type 1 - Color-mapped images in 16/24/32 bpp with 8 bit indexes
+ * - Type 2 - 16/24/32 bpp Top AND Bottom origined.
+ * - Type 3 - Black/White images, 8bpp.
+ * - Type 9 - RLE-encoded color-mapped images. (8 bit indexes only)
+ * - Type 10 - RLE-encoded TrueColor, 24/32bpp.
+ * - Type 11 - RLE-encoded Black/White, 8bpp.
+ *
+ * No images are returned with a palette, instead they are converted
+ * to 16 bpp for Type 1, or 32 bpp for Black/White-images.
+ */
+class TGADecoder : public ImageDecoder {
+public:
+ TGADecoder();
+ virtual ~TGADecoder();
+ virtual void destroy();
+ virtual const Surface *getSurface() const { return &_surface; }
+ virtual const byte *getPalette() const { return _colorMap; }
+ virtual uint16 getPaletteColorCount() const { return _colorMapLength; }
+ virtual bool loadStream(Common::SeekableReadStream &stream);
+private:
+ // Format-spec from:
+ //http://www.ludorg.net/amnesia/TGA_File_Format_Spec.html
+ enum {
+ TYPE_CMAP = 1,
+ TYPE_TRUECOLOR = 2,
+ TYPE_BW = 3,
+ TYPE_RLE_CMAP = 9,
+ TYPE_RLE_TRUECOLOR = 10,
+ TYPE_RLE_BW = 11
+ };
+
+ // Color-map:
+ bool _colorMapSize;
+ byte *_colorMap;
+ int16 _colorMapOrigin;
+ int16 _colorMapLength;
+ byte _colorMapEntryLength;
+
+ // Origin may be at the top, or bottom
+ bool _originTop;
+
+ PixelFormat _format;
+ Surface _surface;
+ // Loading helpers
+ bool readHeader(Common::SeekableReadStream &tga, byte &imageType, byte &pixelDepth);
+ bool readData(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth);
+ bool readDataColorMapped(Common::SeekableReadStream &tga, byte imageType, byte indexDepth);
+ bool readDataRLE(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth);
+ bool readColorMap(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth);
+};
+
+} // End of namespace Graphics
+
+#endif // GRAPHICS_DECODERS_TGA_H
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index 8d967d595f..99dd3d664f 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -47,6 +47,13 @@ FontManager::FontManager() {
}
FontManager::~FontManager() {
+ for (uint i = 0; i < _ownedFonts.size(); ++i) {
+ const Font *font = _ownedFonts[i];
+ if (font == g_sysfont || font == g_sysfont_big || font == g_consolefont)
+ continue;
+ delete font;
+ }
+
delete g_sysfont;
g_sysfont = 0;
delete g_sysfont_big;
@@ -90,6 +97,8 @@ bool FontManager::assignFontToName(const Common::String &name, const Font *font)
Common::String lowercaseName = name;
lowercaseName.toLowercase();
_fontMap[lowercaseName] = font;
+ if (Common::find(_ownedFonts.begin(), _ownedFonts.end(), font) == _ownedFonts.end())
+ _ownedFonts.push_back(font);
return true;
}
@@ -116,8 +125,35 @@ bool FontManager::setFont(FontUsage usage, const BdfFont *font) {
void FontManager::removeFontName(const Common::String &name) {
Common::String lowercaseName = name;
lowercaseName.toLowercase();
+ if (!_fontMap.contains(lowercaseName))
+ return;
+
+ const Font *font = _fontMap[lowercaseName];
_fontMap.erase(lowercaseName);
+ // Check if we still have a copy of this font in the map.
+ bool stillHasFont = false;
+ for (Common::HashMap<Common::String, const Font *>::iterator i = _fontMap.begin(); i != _fontMap.end(); ++i) {
+ if (i->_value != font)
+ continue;
+ stillHasFont = true;
+ break;
+ }
+
+ if (!stillHasFont) {
+ // We don't have a copy of the font, so remove it from our list and delete it.
+ stillHasFont = true;
+ for (uint i = 0; i < _ownedFonts.size(); ++i) {
+ if (_ownedFonts[i] != font)
+ continue;
+ stillHasFont = false;
+ _ownedFonts.remove_at(i);
+ break;
+ }
+ assert(!stillHasFont);
+ delete font;
+ }
+
// In case the current localized font is removed, we fall back to the
// default font again.
if (_localizedFontName == lowercaseName)
diff --git a/graphics/fontman.h b/graphics/fontman.h
index 42f7d856fa..b06ddea860 100644
--- a/graphics/fontman.h
+++ b/graphics/fontman.h
@@ -60,7 +60,9 @@ public:
const Font *getFontByName(const Common::String &name) const;
/**
- * Associates a font object with an 'name'
+ * Associates a font object with an 'name'.
+ * The FontManager takes ownership of the provided font object
+ * and will delete it when necesssary.
*
* @param name the name of the font
* @param font the font object
@@ -111,6 +113,7 @@ private:
~FontManager();
Common::HashMap<Common::String, const Font *> _fontMap;
+ Common::Array<const Font *> _ownedFonts;
Common::String _localizedFontName;
};
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index 5b615cc043..b0166a2095 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -77,7 +77,7 @@ private:
#define DEFINE_FONT(n) \
const BdfFont *n = 0; \
void create_##n() { \
- n = new BdfFont(desc, DisposeAfterUse::YES); \
+ n = new BdfFont(desc, DisposeAfterUse::NO); \
}
#define FORWARD_DECLARE_FONT(n) \
diff --git a/graphics/fonts/consolefont.cpp b/graphics/fonts/consolefont.cpp
index 8244d75fc2..748aa08a5c 100644
--- a/graphics/fonts/consolefont.cpp
+++ b/graphics/fonts/consolefont.cpp
@@ -1,7 +1,7 @@
// Generated by convbdf on Fri Jan 6 14:32:21 2012
#include "graphics/fonts/bdf.h"
-// Font information:
+// Font information:
// Name: -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-1
// Size: 5x8
// Box: 5 8 0 -1
diff --git a/graphics/fonts/newfont.cpp b/graphics/fonts/newfont.cpp
index 10af1efb0c..4922e24676 100644
--- a/graphics/fonts/newfont.cpp
+++ b/graphics/fonts/newfont.cpp
@@ -1,7 +1,7 @@
// Generated by convbdf on Fri Jan 6 14:33:07 2012
#include "graphics/fonts/bdf.h"
-// Font information:
+// Font information:
// Name: -Schumacher-Clean-Medium-R-Normal--12-120-75-75-C-60-ISO8859-1
// Size: 6x12
// Box: 6 12 0 -3
diff --git a/graphics/fonts/newfont_big.cpp b/graphics/fonts/newfont_big.cpp
index 0e61068ade..550d6dbfa9 100644
--- a/graphics/fonts/newfont_big.cpp
+++ b/graphics/fonts/newfont_big.cpp
@@ -1,7 +1,7 @@
// Generated by convbdf on Fri Jan 6 14:33:14 2012
#include "graphics/fonts/bdf.h"
-// Font information:
+// Font information:
// Name: -Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO8859-1
// Size: 13x14
// Box: 13 15 -1 -3
diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp
index 06231799ce..2b1dca1eae 100644
--- a/graphics/fonts/ttf.cpp
+++ b/graphics/fonts/ttf.cpp
@@ -43,10 +43,6 @@ namespace Graphics {
namespace {
-inline int ftFloor26_6(FT_Pos x) {
- return x / 64;
-}
-
inline int ftCeil26_6(FT_Pos x) {
return (x + 63) / 64;
}
@@ -70,6 +66,10 @@ private:
bool _initialized;
};
+void shutdownTTF() {
+ TTFLibrary::destroy();
+}
+
#define g_ttf ::Graphics::TTFLibrary::instance()
TTFLibrary::TTFLibrary() : _library(), _initialized(false) {
@@ -101,7 +101,7 @@ public:
TTFFont();
virtual ~TTFFont();
- bool load(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping);
+ bool load(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping);
virtual int getFontHeight() const;
@@ -157,7 +157,7 @@ TTFFont::~TTFFont() {
}
}
-bool TTFFont::load(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping) {
+bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) {
if (!g_ttf.isInitialized())
return false;
@@ -195,7 +195,7 @@ bool TTFFont::load(Common::SeekableReadStream &stream, int size, bool monochrome
// Check whether we have kerning support
_hasKerning = (FT_HAS_KERNING(_face) != 0);
- if (FT_Set_Char_Size(_face, 0, size * 64, 0, 0)) {
+ if (FT_Set_Char_Size(_face, 0, size * 64, dpi, dpi)) {
delete[] _ttfFile;
_ttfFile = 0;
@@ -338,7 +338,7 @@ void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const
return;
if (y < 0) {
- srcPos += y * glyph.image.pitch;
+ srcPos -= y * glyph.image.pitch;
h += y;
y = 0;
}
@@ -395,11 +395,11 @@ bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) {
FT_Glyph_Metrics &metrics = _face->glyph->metrics;
- glyph.xOffset = ftFloor26_6(metrics.horiBearingX);
+ glyph.xOffset = _face->glyph->bitmap_left;
int xMax = glyph.xOffset + ftCeil26_6(metrics.width);
- glyph.yOffset = _ascent - ftFloor26_6(metrics.horiBearingY);
+ glyph.yOffset = _ascent - _face->glyph->bitmap_top;
- glyph.advance = ftCeil26_6(metrics.horiAdvance);
+ glyph.advance = ftCeil26_6(_face->glyph->advance.x);
// 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
@@ -462,10 +462,10 @@ bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) {
return true;
}
-Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping) {
+Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) {
TTFFont *font = new TTFFont();
- if (!font->load(stream, size, monochrome, mapping)) {
+ if (!font->load(stream, size, dpi, monochrome, mapping)) {
delete font;
return 0;
}
diff --git a/graphics/fonts/ttf.h b/graphics/fonts/ttf.h
index 7222d6e112..e1464b1f45 100644
--- a/graphics/fonts/ttf.h
+++ b/graphics/fonts/ttf.h
@@ -32,7 +32,9 @@
namespace Graphics {
class Font;
-Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome = false, const uint32 *mapping = 0);
+Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, bool monochrome = false, const uint32 *mapping = 0);
+
+void shutdownTTF();
} // End of namespace Graphics
diff --git a/graphics/iff.cpp b/graphics/iff.cpp
index 7434a6bebc..4011126bd3 100644
--- a/graphics/iff.cpp
+++ b/graphics/iff.cpp
@@ -68,7 +68,7 @@ void ILBMDecoder::loadBitmap(uint32 mode, byte *buffer, Common::ReadStream *stre
Graphics::PackBitsReadStream packStream(*stream);
// setup a buffer to hold enough data to build a line in the output
- uint32 scanlineWidth = ((_header.width + 15)/16) << 1;
+ uint32 scanlineWidth = ((_header.width + 15) / 16) << 1;
byte *scanline = new byte[scanlineWidth * _header.depth];
for (uint i = 0; i < _header.height; ++i) {
@@ -82,7 +82,7 @@ void ILBMDecoder::loadBitmap(uint32 mode, byte *buffer, Common::ReadStream *stre
out += outPitch;
}
- delete []scanline;
+ delete[] scanline;
break;
}
@@ -121,15 +121,12 @@ void ILBMDecoder::planarToChunky(byte *out, uint32 outPitch, byte *in, uint32 in
// then output the pixel according to the requested packing
if (!packPlanes) {
out[x] = pix;
- } else
- if (nPlanes == 1) {
- out[x/8] |= (pix << (x & 7));
- } else
- if (nPlanes == 2) {
- out[x/4] |= (pix << ((x & 3) << 1));
- } else
- if (nPlanes == 4) {
- out[x/2] |= (pix << ((x & 1) << 2));
+ } else if (nPlanes == 1) {
+ out[x / 8] |= (pix << (x & 7));
+ } else if (nPlanes == 2) {
+ out[x / 4] |= (pix << ((x & 3) << 1));
+ } else if (nPlanes == 4) {
+ out[x / 2] |= (pix << ((x & 1) << 2));
}
}
@@ -187,7 +184,7 @@ struct PBMLoader {
_surface = &surface;
_colors = colors;
Common::IFFParser parser(&input);
- Common::Functor1Mem< Common::IFFChunk&, bool, PBMLoader > c(this, &PBMLoader::callback);
+ Common::Functor1Mem<Common::IFFChunk &, bool, PBMLoader> c(this, &PBMLoader::callback);
parser.parse(c);
}
@@ -251,7 +248,7 @@ uint32 PackBitsReadStream::read(void *dataPtr, uint32 dataSize) {
for (uint32 j = 0; j < lenW; j++) {
*out++ = _input->readByte();
}
- for ( ; lenR > lenW; lenR--) {
+ for (; lenR > lenW; lenR--) {
_input->readByte();
}
} else { // len > 128
diff --git a/graphics/imagedec.cpp b/graphics/imagedec.cpp
deleted file mode 100644
index 9552f095fa..0000000000
--- a/graphics/imagedec.cpp
+++ /dev/null
@@ -1,176 +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 "graphics/imagedec.h"
-#include "graphics/pixelformat.h"
-#include "graphics/surface.h"
-
-#include "common/file.h"
-
-namespace Graphics {
-//
-// BMP Decoder
-//
-class BMPDecoder : public ImageDecoder {
-public:
- BMPDecoder() {}
- virtual ~BMPDecoder() {}
-
- bool decodeable(Common::SeekableReadStream &stream);
- Surface *decodeImage(Common::SeekableReadStream &stream, const PixelFormat &format);
-
- struct BitmapHeader {
- uint16 type;
- uint32 size;
- uint16 res1;
- uint16 res2;
- uint32 imageOffset;
- };
-
- struct InfoHeader {
- uint32 size;
- uint32 width;
- uint32 height;
- uint16 planes;
- uint16 bitsPerPixel;
- uint32 compression;
- uint32 imageSize;
- uint32 pixelsPerMeterX;
- uint32 pixelsPerMeterY;
- uint32 colorsUsed;
- uint32 colorsImportant;
- };
-};
-
-bool BMPDecoder::decodeable(Common::SeekableReadStream &stream) {
- BitmapHeader header;
- stream.seek(0);
- header.type = stream.readUint16BE();
- header.size = stream.readUint32LE();
-
- // TODO: maybe improve this detection
- if (header.size == 0 || header.type != 'BM')
- return false;
-
- return true;
-}
-
-Surface *BMPDecoder::decodeImage(Common::SeekableReadStream &stream, const PixelFormat &format) {
- if (!decodeable(stream)) {
- return 0;
- }
-
- BitmapHeader header;
- InfoHeader info;
-
- stream.seek(0);
- header.type = stream.readUint16BE();
- header.size = stream.readUint32LE();
- header.res1 = stream.readUint16LE();
- header.res2 = stream.readUint16LE();
- header.imageOffset = stream.readUint32LE();
-
- if (header.size == 0 || header.type != 'BM') {
- stream.seek(0);
- return 0;
- }
-
- info.size = stream.readUint32LE();
- info.width = stream.readUint32LE();
- info.height = stream.readUint32LE();
- info.planes = stream.readUint16LE();
- info.bitsPerPixel = stream.readUint16LE();
- info.compression = stream.readUint32LE();
- info.imageSize = stream.readUint32LE();
- info.pixelsPerMeterX = stream.readUint32LE();
- info.pixelsPerMeterY = stream.readUint32LE();
- info.colorsUsed = stream.readUint32LE();
- info.colorsImportant = stream.readUint32LE();
-
- stream.seek(header.imageOffset);
-
- if (info.bitsPerPixel != 24) {
- stream.seek(0);
- return 0;
- }
-
- uint8 r = 0, g = 0, b = 0;
- Surface *newSurf = new Surface;
- assert(newSurf);
- newSurf->create(info.width, info.height, format);
- assert(newSurf->pixels);
- 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) {
- b = stream.readByte();
- g = stream.readByte();
- r = stream.readByte();
- *curPixel = format.RGBToColor(r, g, b);
- ++curPixel;
- }
- stream.seek(pitchAdd, SEEK_CUR);
- curPixel -= newSurf->w*2;
- }
-
- stream.seek(0);
- return newSurf;
-}
-
-#pragma mark -
-
-Surface *ImageDecoder::loadFile(const Common::String &name, const PixelFormat &format) {
- Surface *newSurf = 0;
-
- Common::File imageFile;
- if (imageFile.open(name)) {
- newSurf = loadFile(imageFile, format);
- }
-
- return newSurf;
-}
-
-Surface *ImageDecoder::loadFile(Common::SeekableReadStream &stream, const PixelFormat &format) {
- // TODO: implement support for bzipped memory
-
- // FIXME: this is not a very nice solution but it should work
- // for the moment, we should use a different way to get all
- // decoders
- static BMPDecoder bmpDecoder;
- static ImageDecoder *decoderList[] = {
- &bmpDecoder, // for uncompressed .BMP files
- 0
- };
-
- ImageDecoder *decoder = 0;
- for (int i = 0; decoderList[i] != 0; ++i) {
- if (decoderList[i]->decodeable(stream)) {
- decoder = decoderList[i];
- break;
- }
- }
-
- if (!decoder)
- return 0;
-
- return decoder->decodeImage(stream, format);
-}
-} // End of namespace Graphics
diff --git a/graphics/module.mk b/graphics/module.mk
index 1e84b2425d..f560d9dc97 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -12,11 +12,7 @@ MODULE_OBJS := \
fonts/ttf.o \
fonts/winfont.o \
iff.o \
- imagedec.o \
- jpeg.o \
maccursor.o \
- pict.o \
- png.o \
primitives.o \
scaler.o \
scaler/thumbnail_intern.o \
@@ -26,7 +22,13 @@ MODULE_OBJS := \
VectorRenderer.o \
VectorRendererSpec.o \
wincursor.o \
- yuv_to_rgb.o
+ yuv_to_rgb.o \
+ decoders/bmp.o \
+ decoders/jpeg.o \
+ decoders/pcx.o \
+ decoders/pict.o \
+ decoders/png.o \
+ decoders/tga.o
ifdef USE_SCALERS
MODULE_OBJS += \
diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index e0cf6ce401..ca4ef11c17 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -97,7 +97,7 @@ struct PixelFormat {
}
inline void colorToARGB(uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const {
- a = ((color >> aShift) << aLoss) & 0xFF;
+ a = (aBits() == 0) ? 0xFF : (((color >> aShift) << aLoss) & 0xFF);
r = ((color >> rShift) << rLoss) & 0xFF;
g = ((color >> gShift) << gLoss) & 0xFF;
b = ((color >> bShift) << bLoss) & 0xFF;
diff --git a/graphics/png.cpp b/graphics/png.cpp
deleted file mode 100644
index cea8b575ad..0000000000
--- a/graphics/png.cpp
+++ /dev/null
@@ -1,487 +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 "graphics/png.h"
-
-#include "graphics/pixelformat.h"
-#include "graphics/surface.h"
-
-#include "common/endian.h"
-#include "common/memstream.h"
-#include "common/stream.h"
-#include "common/types.h"
-#include "common/util.h"
-#include "common/zlib.h"
-
-// PNG decoder, based on the W3C specs:
-// http://www.w3.org/TR/PNG/
-// Parts of the code have been adapted from LodePNG, by Lode Vandevenne:
-// http://members.gamedev.net/lode/projects/LodePNG/
-
-/*
-LodePNG version 20101211
-
-Copyright (c) 2005-2010 Lode Vandevenne
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-*/
-
-namespace Graphics {
-
-enum PNGChunks {
- // == Critical chunks =====================================================
- kChunkIHDR = MKTAG('I','H','D','R'), // Image header
- kChunkIDAT = MKTAG('I','D','A','T'), // Image data
- kChunkPLTE = MKTAG('P','L','T','E'), // Palette
- kChunkIEND = MKTAG('I','E','N','D'), // Image trailer
- // == Ancillary chunks ====================================================
- kChunktRNS = MKTAG('t','R','N','S') // Transparency
- // All of the other ancillary chunks are ignored. They're added here for
- // reference only.
- // cHRM - Primary chromacities and white point
- // gAMA - Image gamma
- // iCCP - Embedded ICC profile
- // sBIT - Significant bits
- // sRGB - Standard RGB color space
- // tEXT - Textual data
- // sTXt - Compressed textual data
- // iTXt - International textual data
- // bKGD - Background color
- // hIST - Image histogram
- // pHYs - Physical pixel dimensions
- // sPLT - Suggested palette
- // tIME - Image last-modification time
-};
-
-// Refer to http://www.w3.org/TR/PNG/#9Filters
-enum PNGFilters {
- kFilterNone = 0,
- kFilterSub = 1,
- kFilterUp = 2,
- kFilterAverage = 3,
- kFilterPaeth = 4
-};
-
-PNG::PNG() : _compressedBuffer(0), _compressedBufferSize(0),
- _unfilteredSurface(0), _transparentColorSpecified(false) {
-}
-
-PNG::~PNG() {
- if (_unfilteredSurface) {
- _unfilteredSurface->free();
- delete _unfilteredSurface;
- }
-}
-
-Graphics::Surface *PNG::getSurface(const PixelFormat &format) {
- Graphics::Surface *output = new Graphics::Surface();
- output->create(_unfilteredSurface->w, _unfilteredSurface->h, format);
- byte *src = (byte *)_unfilteredSurface->pixels;
- byte a = 0xFF;
- byte bpp = _unfilteredSurface->format.bytesPerPixel;
-
- if (_header.colorType != kIndexed) {
- if (_header.colorType == kTrueColor ||
- _header.colorType == kTrueColorWithAlpha) {
- if (bpp != 3 && bpp != 4)
- error("Unsupported truecolor PNG format");
- } else if (_header.colorType == kGrayScale ||
- _header.colorType == kGrayScaleWithAlpha) {
- if (bpp != 1 && bpp != 2)
- error("Unsupported grayscale PNG format");
- }
-
- for (uint16 i = 0; i < output->h; i++) {
- for (uint16 j = 0; j < output->w; j++) {
- uint32 result = 0;
-
- switch (bpp) {
- case 1: // Grayscale
- if (_transparentColorSpecified)
- a = (src[0] == _transparentColor[0]) ? 0 : 0xFF;
- result = format.ARGBToColor( a, src[0], src[0], src[0]);
- break;
- case 2: // Grayscale + alpha
- result = format.ARGBToColor(src[1], src[0], src[0], src[0]);
- break;
- case 3: // RGB
- if (_transparentColorSpecified) {
- bool isTransparentColor = (src[0] == _transparentColor[0] &&
- src[1] == _transparentColor[1] &&
- src[2] == _transparentColor[2]);
- a = isTransparentColor ? 0 : 0xFF;
- }
- result = format.ARGBToColor( a, src[0], src[1], src[2]);
- break;
- case 4: // RGBA
- result = format.ARGBToColor(src[3], src[0], src[1], src[2]);
- break;
- }
-
- if (format.bytesPerPixel == 2) // 2bpp
- *((uint16 *)output->getBasePtr(j, i)) = (uint16)result;
- else // 4bpp
- *((uint32 *)output->getBasePtr(j, i)) = result;
-
- src += bpp;
- }
- }
- } else {
- byte index, r, g, b;
- uint32 mask = (0xff >> (8 - _header.bitDepth)) << (8 - _header.bitDepth);
-
- // Convert the indexed surface to the target pixel format
- for (uint16 i = 0; i < output->h; i++) {
- int data = 0;
- int bitCount = 8;
- byte *src1 = src;
-
- for (uint16 j = 0; j < output->w; j++) {
- if (bitCount == 8) {
- data = *src;
- src++;
- }
-
- index = (data & mask) >> (8 - _header.bitDepth);
- data = (data << _header.bitDepth) & 0xff;
- bitCount -= _header.bitDepth;
-
- if (bitCount == 0)
- bitCount = 8;
-
- r = _palette[index * 4 + 0];
- g = _palette[index * 4 + 1];
- b = _palette[index * 4 + 2];
- a = _palette[index * 4 + 3];
-
- if (format.bytesPerPixel == 2)
- *((uint16 *)output->getBasePtr(j, i)) = format.ARGBToColor(a, r, g, b);
- else
- *((uint32 *)output->getBasePtr(j, i)) = format.ARGBToColor(a, r, g, b);
- }
- src = src1 + output->w;
- }
- }
-
- return output;
-}
-
-bool PNG::read(Common::SeekableReadStream *str) {
- uint32 chunkLength = 0, chunkType = 0;
- _stream = str;
-
- // First, check the PNG signature
- if (_stream->readUint32BE() != MKTAG(0x89, 0x50, 0x4e, 0x47)) {
- delete _stream;
- return false;
- }
- if (_stream->readUint32BE() != MKTAG(0x0d, 0x0a, 0x1a, 0x0a)) {
- delete _stream;
- return false;
- }
-
- // Start reading chunks till we reach an IEND chunk
- while (chunkType != kChunkIEND) {
- // The chunk length does not include the type or CRC bytes
- chunkLength = _stream->readUint32BE();
- chunkType = _stream->readUint32BE();
-
- switch (chunkType) {
- case kChunkIHDR:
- readHeaderChunk();
- break;
- case kChunkIDAT:
- if (_compressedBufferSize == 0) {
- _compressedBufferSize += chunkLength;
- _compressedBuffer = (byte *)malloc(_compressedBufferSize);
- _stream->read(_compressedBuffer, chunkLength);
- } else {
- // Expand the buffer
- uint32 prevSize = _compressedBufferSize;
- _compressedBufferSize += chunkLength;
- byte *tmp = new byte[prevSize];
- memcpy(tmp, _compressedBuffer, prevSize);
- free(_compressedBuffer);
- _compressedBuffer = (byte *)malloc(_compressedBufferSize);
- memcpy(_compressedBuffer, tmp, prevSize);
- delete[] tmp;
- _stream->read(_compressedBuffer + prevSize, chunkLength);
- }
- break;
- case kChunkPLTE: // only available in indexed PNGs
- if (_header.colorType != kIndexed)
- error("A palette chunk has been found in a non-indexed PNG file");
- if (chunkLength % 3 != 0)
- error("Palette chunk not divisible by 3");
- _paletteEntries = chunkLength / 3;
- readPaletteChunk();
- break;
- case kChunkIEND:
- // End of stream
- break;
- case kChunktRNS:
- readTransparencyChunk(chunkLength);
- break;
- default:
- // Skip the chunk content
- _stream->skip(chunkLength);
- break;
- }
-
- if (chunkType != kChunkIEND)
- _stream->skip(4); // skip the chunk CRC checksum
- }
-
- // We no longer need the file stream, thus close it here
- delete _stream;
- _stream = 0;
-
- // Unpack the compressed buffer
- Common::MemoryReadStream *compData = new Common::MemoryReadStream(_compressedBuffer, _compressedBufferSize, DisposeAfterUse::YES);
- _imageData = Common::wrapCompressedReadStream(compData);
-
- // Construct the final image
- constructImage();
-
- // Close the uncompressed stream, which will also delete the memory stream,
- // and thus the original compressed buffer
- delete _imageData;
-
- return true;
-}
-
-/**
- * Paeth predictor, used by PNG filter type 4
- * The parameters are of signed 16-bit integers, but should come
- * from unsigned chars. The integers are only needed to make
- * the paeth calculation correct.
- *
- * Taken from lodePNG, with a slight patch:
- * http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/02/23/libpng-you-re-doing-it-wrong.aspx
- */
-byte PNG::paethPredictor(int16 a, int16 b, int16 c) {
- int16 pa = ABS<int16>(b - c);
- int16 pb = ABS<int16>(a - c);
- int16 pc = ABS<int16>(a + b - c - c);
-
- if (pa <= MIN<int16>(pb, pc))
- return (byte)a;
- else if (pb <= pc)
- return (byte)b;
- else
- return (byte)c;
-}
-
-/**
- * Unfilters a filtered PNG scan line.
- * PNG filters are defined in: http://www.w3.org/TR/PNG/#9Filters
- * Note that filters are always applied to bytes
- *
- * Taken from lodePNG
- */
-void PNG::unfilterScanLine(byte *dest, const byte *scanLine, const byte *prevLine, uint16 byteWidth, byte filterType, uint16 length) {
- uint16 i;
-
- switch (filterType) {
- case kFilterNone: // no change
- for (i = 0; i < length; i++)
- dest[i] = scanLine[i];
- break;
- case kFilterSub: // add the bytes to the left
- for (i = 0; i < byteWidth; i++)
- dest[i] = scanLine[i];
- for (i = byteWidth; i < length; i++)
- dest[i] = scanLine[i] + dest[i - byteWidth];
- break;
- case kFilterUp: // add the bytes of the above scanline
- if (prevLine) {
- for (i = 0; i < length; i++)
- dest[i] = scanLine[i] + prevLine[i];
- } else {
- for (i = 0; i < length; i++)
- dest[i] = scanLine[i];
- }
- break;
- case kFilterAverage: // average value of the left and top left
- if (prevLine) {
- for (i = 0; i < byteWidth; i++)
- dest[i] = scanLine[i] + prevLine[i] / 2;
- for (i = byteWidth; i < length; i++)
- dest[i] = scanLine[i] + ((dest[i - byteWidth] + prevLine[i]) / 2);
- } else {
- for (i = 0; i < byteWidth; i++)
- dest[i] = scanLine[i];
- for (i = byteWidth; i < length; i++)
- dest[i] = scanLine[i] + dest[i - byteWidth] / 2;
- }
- break;
- case kFilterPaeth: // Paeth filter: http://www.w3.org/TR/PNG/#9Filter-type-4-Paeth
- if (prevLine) {
- for(i = 0; i < byteWidth; i++)
- dest[i] = (scanLine[i] + prevLine[i]); // paethPredictor(0, prevLine[i], 0) is always prevLine[i]
- for(i = byteWidth; i < length; i++)
- dest[i] = (scanLine[i] + paethPredictor(dest[i - byteWidth], prevLine[i], prevLine[i - byteWidth]));
- } else {
- for(i = 0; i < byteWidth; i++)
- dest[i] = scanLine[i];
- for(i = byteWidth; i < length; i++)
- dest[i] = (scanLine[i] + dest[i - byteWidth]); // paethPredictor(dest[i - byteWidth], 0, 0) is always dest[i - byteWidth]
- }
- break;
- default:
- error("Unknown line filter");
- }
-
-}
-
-void PNG::constructImage() {
- assert (_header.bitDepth != 0);
-
- byte *dest;
- byte *scanLine;
- byte *prevLine = 0;
- byte filterType;
- uint16 scanLineWidth = (_header.width * getNumColorChannels() * _header.bitDepth + 7) / 8;
-
- if (_unfilteredSurface) {
- _unfilteredSurface->free();
- delete _unfilteredSurface;
- }
- _unfilteredSurface = new Graphics::Surface();
- // TODO/FIXME: It seems we can not properly determine the format here. But maybe there is a way...
- _unfilteredSurface->create(_header.width, _header.height, PixelFormat((getNumColorChannels() * _header.bitDepth + 7) / 8, 0, 0, 0, 0, 0, 0, 0, 0));
- scanLine = new byte[_unfilteredSurface->pitch];
- dest = (byte *)_unfilteredSurface->getBasePtr(0, 0);
-
- switch(_header.interlaceType) {
- case kNonInterlaced:
- for (uint16 y = 0; y < _unfilteredSurface->h; y++) {
- filterType = _imageData->readByte();
- _imageData->read(scanLine, scanLineWidth);
- unfilterScanLine(dest, scanLine, prevLine, _unfilteredSurface->format.bytesPerPixel, filterType, scanLineWidth);
- prevLine = dest;
- dest += _unfilteredSurface->pitch;
- }
- break;
- case kInterlaced:
- // Theoretically, this shouldn't be needed, as interlacing is only
- // useful for web images. Interlaced PNG images require more complex
- // handling, so unless having support for such images is needed, there
- // is no reason to add support for them.
- error("TODO: Support for interlaced PNG images");
- break;
- }
-
- delete[] scanLine;
-}
-
-void PNG::readHeaderChunk() {
- _header.width = _stream->readUint32BE();
- _header.height = _stream->readUint32BE();
- _header.bitDepth = _stream->readByte();
- if (_header.bitDepth > 8)
- error("Only PNGs with a bit depth of 1-8 bits are supported (i.e. PNG24)");
- _header.colorType = (PNGColorType)_stream->readByte();
- _header.compressionMethod = _stream->readByte();
- // Compression methods: http://www.w3.org/TR/PNG/#10Compression
- // Only compression method 0 (deflate) is documented and supported
- if (_header.compressionMethod != 0)
- error("Unknown PNG compression method: %d", _header.compressionMethod);
- _header.filterMethod = _stream->readByte();
- // Filter methods: http://www.w3.org/TR/PNG/#9Filters
- // Only filter method 0 is documented and supported
- if (_header.filterMethod != 0)
- error("Unknown PNG filter method: %d", _header.filterMethod);
- _header.interlaceType = (PNGInterlaceType)_stream->readByte();
-}
-
-byte PNG::getNumColorChannels() {
- switch (_header.colorType) {
- case kGrayScale:
- return 1; // Gray
- case kTrueColor:
- return 3; // RGB
- case kIndexed:
- return 1; // Indexed
- case kGrayScaleWithAlpha:
- return 2; // Gray + Alpha
- case kTrueColorWithAlpha:
- return 4; // RGBA
- default:
- error("Unknown color type");
- }
-}
-
-void PNG::readPaletteChunk() {
- for (uint16 i = 0; i < _paletteEntries; i++) {
- _palette[i * 4 + 0] = _stream->readByte(); // R
- _palette[i * 4 + 1] = _stream->readByte(); // G
- _palette[i * 4 + 2] = _stream->readByte(); // B
- _palette[i * 4 + 3] = 0xFF; // Alpha, set in the tRNS chunk
- }
-}
-
-void PNG::readTransparencyChunk(uint32 chunkLength) {
- _transparentColorSpecified = true;
-
- switch(_header.colorType) {
- case kGrayScale:
- _transparentColor[0] = _stream->readUint16BE();
- _transparentColor[1] = _transparentColor[0];
- _transparentColor[2] = _transparentColor[0];
- break;
- case kTrueColor:
- _transparentColor[0] = _stream->readUint16BE();
- _transparentColor[1] = _stream->readUint16BE();
- _transparentColor[2] = _stream->readUint16BE();
- break;
- case kIndexed:
- for (uint32 i = 0; i < chunkLength; i++)
- _palette[i * 4 + 3] = _stream->readByte();
- // A transparency chunk may have less entries
- // than the palette entries. The remaining ones
- // are unmodified (set to 255). Check here:
- // http://www.w3.org/TR/PNG/#11tRNS
- break;
- default:
- error("Transparency chunk found in a PNG that has a separate transparency channel");
- }
-}
-
-} // End of Graphics namespace
diff --git a/graphics/png.h b/graphics/png.h
deleted file mode 100644
index 078c76fc6b..0000000000
--- a/graphics/png.h
+++ /dev/null
@@ -1,168 +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.
- *
- */
-
-/*
- * PNG decoder used in engines:
- * - sword25
- * Dependencies:
- * - zlib
- */
-
-#ifndef GRAPHICS_PNG_H
-#define GRAPHICS_PNG_H
-
-// PNG decoder, based on the W3C specs:
-// http://www.w3.org/TR/PNG/
-// Parts of the code have been adapted from LodePNG, by Lode Vandevenne:
-// http://members.gamedev.net/lode/projects/LodePNG/
-
-// All the numbers are BE: http://www.w3.org/TR/PNG/#7Integers-and-byte-order
-
-// Note: At the moment, this decoder only supports non-interlaced images, and
-// does not support truecolor/grayscale images with 16bit depth.
-//
-// Theoretically, interlaced images shouldn't be needed for games, as
-// interlacing is only useful for images in websites.
-//
-// PNG images with 16bit depth (i.e. 48bit images) are quite rare, and can
-// theoretically contain more than 16.7 millions of colors (the so-called "deep
-// color" representation). In essence, each of the R, G, B and A components in
-// them is specified with 2 bytes, instead of 1. However, the PNG specification
-// always refers to color components with 1 byte each, so this part of the spec
-// is a bit unclear. For now, these won't be supported, until a suitable sample
-// is found.
-
-#include "common/scummsys.h"
-#include "common/textconsole.h"
-
-namespace Common {
-class SeekableReadStream;
-}
-
-namespace Graphics {
-
-struct Surface;
-
-enum PNGColorType {
- kGrayScale = 0, // bit depths: 1, 2, 4, 8, 16
- kTrueColor = 2, // bit depths: 8, 16
- kIndexed = 3, // bit depths: 1, 2, 4, 8
- kGrayScaleWithAlpha = 4, // bit depths: 8, 16
- kTrueColorWithAlpha = 6 // bit depths: 8, 16
-};
-
-enum PNGInterlaceType {
- kNonInterlaced = 0,
- kInterlaced = 1
-};
-
-struct PNGHeader {
- uint32 width;
- uint32 height;
- byte bitDepth;
- PNGColorType colorType;
- byte compressionMethod;
- byte filterMethod;
- PNGInterlaceType interlaceType;
-};
-
-struct PixelFormat;
-
-class PNG {
-public:
- PNG();
- ~PNG();
-
- /**
- * Reads a PNG image from the specified stream
- */
- bool read(Common::SeekableReadStream *str);
-
- /**
- * Returns the information obtained from the PNG header.
- */
- PNGHeader getHeader() const { return _header; }
-
- /**
- * Returns the PNG image, formatted for the specified pixel format.
- */
- Graphics::Surface *getSurface(const PixelFormat &format);
-
- /**
- * Returns the indexed PNG8 image. Used for PNGs with an indexed 256 color
- * palette, when they're shown on an 8-bit color screen, as no translation
- * is taking place.
- */
- Graphics::Surface *getIndexedSurface() {
- if (_header.colorType != kIndexed)
- error("Indexed surface requested for a non-indexed PNG");
- return _unfilteredSurface;
- }
-
- /**
- * Returns the palette of the specified PNG8 image, given a pointer to
- * an RGBA palette array (4 x 256).
- */
- void getPalette(byte *palette, uint16 &entries) {
- if (_header.colorType != kIndexed)
- error("Palette requested for a non-indexed PNG");
- for (int i = 0; i < 256; i++) {
- palette[0 + i * 4] = _palette[0 + i * 4]; // R
- palette[1 + i * 4] = _palette[1 + i * 4]; // G
- palette[2 + i * 4] = _palette[2 + i * 4]; // B
- palette[3 + i * 4] = _palette[3 + i * 4]; // A
- }
- entries = _paletteEntries;
- }
-
-private:
- void readHeaderChunk();
- byte getNumColorChannels();
-
- void readPaletteChunk();
- void readTransparencyChunk(uint32 chunkLength);
-
- void constructImage();
- void unfilterScanLine(byte *dest, const byte *scanLine, const byte *prevLine, uint16 byteWidth, byte filterType, uint16 length);
- byte paethPredictor(int16 a, int16 b, int16 c);
-
- // The original file stream
- Common::SeekableReadStream *_stream;
- // The unzipped image data stream
- Common::SeekableReadStream *_imageData;
-
- PNGHeader _header;
-
- byte _palette[256 * 4]; // RGBA
- uint16 _paletteEntries;
- uint16 _transparentColor[3];
- bool _transparentColorSpecified;
-
- byte *_compressedBuffer;
- uint32 _compressedBufferSize;
-
- Graphics::Surface *_unfilteredSurface;
-};
-
-} // End of Graphics namespace
-
-#endif // GRAPHICS_PNG_H
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index 9834af65ba..b88db39f36 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -61,59 +61,21 @@ void drawLine(int x0, int y0, int x1, int y1, int color, void (*plotProc)(int, i
}
}
+void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, int color, void (*plotProc)(int, int, int, void *), void *data) {
+ assert(penX > 0 && penY > 0);
-// FIXME: This is a limited version of thick line drawing
-// it draws striped lines at some angles. Better algorithm could
-// be found here:
-//
-// http://homepages.enterprise.net/murphy/thickline/index.html
-//
-// Feel free to replace it with better implementation
-void drawThickLine(int x0, int y0, int x1, int y1, int thickness, int color, void (*plotProc)(int, int, int, void *), void *data) {
- const bool steep = ABS(y1 - y0) > ABS(x1 - x0);
-
- if (steep) {
- SWAP(x0, y0);
- SWAP(x1, y1);
- }
-
- float dx = x1 - x0;
- float dy = y1 - y0;
- float d = (float)sqrt(dx * dx + dy * dy);
-
- if (!d)
+ // Shortcut
+ if (penX == 1 && penY == 1) {
+ drawLine(x0, y0, x1, y1, color, plotProc, data);
return;
-
- int thickX = (int)((float)thickness * dy / d / 2);
- int thickY = (int)((float)thickness * dx / d / 2);
-
- const int delta_x = ABS(x1 - x0);
- const int delta_y = ABS(y1 - y0);
- const int delta_err = delta_y;
- int x = x0;
- int y = y0;
- int err = 0;
-
- const int x_step = (x0 < x1) ? 1 : -1;
- const int y_step = (y0 < y1) ? 1 : -1;
-
- if (steep)
- drawLine(y - thickY, x + thickX, y + thickY, x - thickX, color, plotProc, data);
- else
- drawLine(x - thickX, y + thickY, x + thickX, y - thickY, color, plotProc, data);
-
- while (x != x1) {
- x += x_step;
- err += delta_err;
- if (2 * err > delta_x) {
- y += y_step;
- err -= delta_x;
- }
- if (steep)
- drawLine(y - thickY, x + thickX, y + thickY, x - thickX, color, plotProc, data);
- else
- drawLine(x - thickX, y + thickY, x + thickX, y - thickY, color, plotProc, data);
}
+
+ // TODO: Optimize this. It currently is a very naive way of handling
+ // thick lines since quite often it will be drawing to the same pixel
+ // multiple times.
+ for (int x = 0; x < penX; x++)
+ for (int y = 0; y < penY; y++)
+ drawLine(x0 + x, y0 + y, x1 + x, y1 + y, color, plotProc, data);
}
} // End of namespace Graphics
diff --git a/graphics/primitives.h b/graphics/primitives.h
index 0ab2dabcd8..f0780afc2e 100644
--- a/graphics/primitives.h
+++ b/graphics/primitives.h
@@ -25,7 +25,7 @@
namespace Graphics {
void drawLine(int x0, int y0, int x1, int y1, int color, void (*plotProc)(int, int, int, void *), void *data);
-void drawThickLine(int x0, int y0, int x1, int y1, int thickness, int color, void (*plotProc)(int, int, int, void *), void *data);
+void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, int color, void (*plotProc)(int, int, int, void *), void *data);
} // End of namespace Graphics
diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp
index 9ade0e6c57..b81e8937a8 100644
--- a/graphics/scaler.cpp
+++ b/graphics/scaler.cpp
@@ -167,12 +167,12 @@ void DestroyScalers(){
void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
// Spot the case when it can all be done in 1 hit
- if ((srcPitch == sizeof(OverlayColor) * (uint)width) && (dstPitch == sizeof(OverlayColor) * (uint)width)) {
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width * height);
+ if ((srcPitch == sizeof(uint16) * (uint)width) && (dstPitch == sizeof(uint16) * (uint)width)) {
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width * height);
return;
}
while (height--) {
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
srcPtr += srcPitch;
dstPtr += dstPitch;
}
@@ -207,11 +207,10 @@ void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
uint8 *r;
assert(IS_ALIGNED(dstPtr, 4));
- assert(sizeof(OverlayColor) == 2);
while (height--) {
r = dstPtr;
for (int i = 0; i < width; ++i, r += 4) {
- uint32 color = *(((const OverlayColor *)srcPtr) + i);
+ uint32 color = *(((const uint16 *)srcPtr) + i);
color |= color << 16;
diff --git a/graphics/scaler/aspect.cpp b/graphics/scaler/aspect.cpp
index 7ad37b1ba8..327e7c5e89 100644
--- a/graphics/scaler/aspect.cpp
+++ b/graphics/scaler/aspect.cpp
@@ -23,6 +23,13 @@
#include "graphics/scaler/intern.h"
#include "graphics/scaler/aspect.h"
+#ifdef OPENPANDORA
+#define NEON_ASPECT_CORRECTOR
+#endif
+
+#ifdef NEON_ASPECT_CORRECTOR
+#include <arm_neon.h>
+#endif
#define kSuperFastAndUglyAspectMode 0 // No interpolation at all, but super-fast
#define kVeryFastAndGoodAspectMode 1 // Good quality with very good speed
@@ -55,13 +62,66 @@ static inline void interpolate5Line(uint16 *dst, const uint16 *srcA, const uint1
#if ASPECT_MODE == kVeryFastAndGoodAspectMode
+#ifdef NEON_ASPECT_CORRECTOR
+
+template<typename ColorMask>
+static void interpolate5LineNeon(uint16 *dst, const uint16 *srcA, const uint16 *srcB, int width, int k1, int k2) {
+ uint16x4_t kRedBlueMask_4 = vdup_n_u16(ColorMask::kRedBlueMask);
+ uint16x4_t kGreenMask_4 = vdup_n_u16(ColorMask::kGreenMask);
+ uint16x4_t k1_4 = vdup_n_u16(k1);
+ uint16x4_t k2_4 = vdup_n_u16(k2);
+ while (width >= 4) {
+ uint16x4_t srcA_4 = vld1_u16(srcA);
+ uint16x4_t srcB_4 = vld1_u16(srcB);
+ uint16x4_t p1_4 = srcB_4;
+ uint16x4_t p2_4 = srcA_4;
+
+ uint16x4_t p1_rb_4 = vand_u16(p1_4, kRedBlueMask_4);
+ uint16x4_t p1_g_4 = vand_u16(p1_4, kGreenMask_4);
+ uint16x4_t p2_rb_4 = vand_u16(p2_4, kRedBlueMask_4);
+ uint16x4_t p2_g_4 = vand_u16(p2_4, kGreenMask_4);
+
+ uint32x4_t tmp_rb_4 = vshrq_n_u32(vmlal_u16(vmull_u16(p2_rb_4, k2_4), p1_rb_4, k1_4), 3);
+ uint32x4_t tmp_g_4 = vshrq_n_u32(vmlal_u16(vmull_u16(p2_g_4, k2_4), p1_g_4, k1_4), 3);
+ uint16x4_t p_rb_4 = vmovn_u32(tmp_rb_4);
+ p_rb_4 = vand_u16(p_rb_4, kRedBlueMask_4);
+ uint16x4_t p_g_4 = vmovn_u32(tmp_g_4);
+ p_g_4 = vand_u16(p_g_4, kGreenMask_4);
+
+ uint16x4_t result_4 = p_rb_4 | p_g_4;
+ vst1_u16(dst, result_4);
+
+ dst += 4;
+ srcA += 4;
+ srcB += 4;
+ width -= 4;
+ }
+}
+#endif
+
template<typename ColorMask, int scale>
-static inline void interpolate5Line(uint16 *dst, const uint16 *srcA, const uint16 *srcB, int width) {
+static void interpolate5Line(uint16 *dst, const uint16 *srcA, const uint16 *srcB, int width) {
if (scale == 1) {
+#ifdef NEON_ASPECT_CORRECTOR
+ int width4 = width & ~3;
+ interpolate5LineNeon<ColorMask>(dst, srcA, srcB, width4, 7, 1);
+ srcA += width4;
+ srcB += width4;
+ dst += width4;
+ width -= width4;
+#endif
while (width--) {
*dst++ = interpolate16_7_1<ColorMask>(*srcB++, *srcA++);
}
} else {
+#ifdef NEON_ASPECT_CORRECTOR
+ int width4 = width & ~3;
+ interpolate5LineNeon<ColorMask>(dst, srcA, srcB, width4, 5, 3);
+ srcA += width4;
+ srcB += width4;
+ dst += width4;
+ width -= width4;
+#endif
while (width--) {
*dst++ = interpolate16_5_3<ColorMask>(*srcB++, *srcA++);
}
@@ -160,14 +220,14 @@ int stretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, i
#if ASPECT_MODE == kSuperFastAndUglyAspectMode
if (srcPtr == dstPtr)
break;
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
#else
// Bilinear filter
switch (y % 6) {
case 0:
case 5:
if (srcPtr != dstPtr)
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
break;
case 1:
interpolate5Line<ColorMask, 1>((uint16 *)dstPtr, (const uint16 *)(srcPtr - pitch), (const uint16 *)srcPtr, width);
@@ -206,13 +266,13 @@ void Normal1xAspectTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
#if ASPECT_MODE == kSuperFastAndUglyAspectMode
if ((y % 6) == 5)
srcPtr -= srcPitch;
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
#else
// Bilinear filter five input lines onto six output lines
switch (y % 6) {
case 0:
// First output line is copied from first input line
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
break;
case 1:
// Second output line is mixed from first and second input line
@@ -233,7 +293,7 @@ void Normal1xAspectTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
case 5:
// Sixth (and last) output line is copied from fifth (and last) input line
srcPtr -= srcPitch;
- memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+ memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
break;
}
#endif
diff --git a/graphics/sjis.h b/graphics/sjis.h
index 2d05005fc3..928332f712 100644
--- a/graphics/sjis.h
+++ b/graphics/sjis.h
@@ -169,7 +169,7 @@ protected:
bool _flippedMode;
int _fontWidth, _fontHeight;
uint8 _bitPosNewLineMask;
-
+
bool isASCII(uint16 ch) const;
virtual const uint8 *getCharData(uint16 c) const = 0;
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 79a7821feb..41ae8dcebb 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -20,11 +20,13 @@
*/
#include "common/algorithm.h"
+#include "common/endian.h"
#include "common/util.h"
#include "common/rect.h"
#include "common/textconsole.h"
#include "graphics/primitives.h"
#include "graphics/surface.h"
+#include "graphics/conversion.h"
namespace Graphics {
@@ -48,6 +50,17 @@ void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {
error("Surface::drawLine: bytesPerPixel must be 1, 2, or 4");
}
+void Surface::drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color) {
+ if (format.bytesPerPixel == 1)
+ Graphics::drawThickLine(x0, y0, x1, y1, penX, penY, color, plotPoint<byte>, this);
+ else if (format.bytesPerPixel == 2)
+ Graphics::drawThickLine(x0, y0, x1, y1, penX, penY, color, plotPoint<uint16>, this);
+ else if (format.bytesPerPixel == 4)
+ Graphics::drawThickLine(x0, y0, x1, y1, penX, penY, color, plotPoint<uint32>, this);
+ else
+ error("Surface::drawThickLine: bytesPerPixel must be 1, 2, or 4");
+}
+
void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
free();
@@ -270,4 +283,148 @@ void Surface::move(int dx, int dy, int height) {
}
}
+void Surface::convertToInPlace(const PixelFormat &dstFormat, const byte *palette) {
+ // Do not convert to the same format and ignore empty surfaces.
+ if (format == dstFormat || pixels == 0) {
+ return;
+ }
+
+ if (format.bytesPerPixel == 0 || format.bytesPerPixel > 4)
+ error("Surface::convertToInPlace(): Can only convert from 1Bpp, 2Bpp, 3Bpp, and 4Bpp");
+
+ if (dstFormat.bytesPerPixel != 2 && dstFormat.bytesPerPixel != 4)
+ error("Surface::convertToInPlace(): Can only convert to 2Bpp and 4Bpp");
+
+ // In case the surface data needs more space allocate it.
+ if (dstFormat.bytesPerPixel > format.bytesPerPixel) {
+ void *const newPixels = realloc(pixels, w * h * dstFormat.bytesPerPixel);
+ if (!newPixels) {
+ error("Surface::convertToInPlace(): Out of memory");
+ }
+ pixels = newPixels;
+ }
+
+ // We take advantage of the fact that pitch is always w * format.bytesPerPixel.
+ // This is assured by the logic of Surface::create.
+
+ // We need to handle 1 Bpp surfaces special here.
+ if (format.bytesPerPixel == 1) {
+ assert(palette);
+
+ for (int y = h; y > 0; --y) {
+ const byte *srcRow = (const byte *)pixels + y * pitch - 1;
+ byte *dstRow = (byte *)pixels + y * w * dstFormat.bytesPerPixel - dstFormat.bytesPerPixel;
+
+ for (int x = 0; x < w; x++) {
+ byte index = *srcRow--;
+ byte r = palette[index * 3];
+ byte g = palette[index * 3 + 1];
+ byte b = palette[index * 3 + 2];
+
+ uint32 color = dstFormat.RGBToColor(r, g, b);
+
+ if (dstFormat.bytesPerPixel == 2)
+ *((uint16 *)dstRow) = color;
+ else
+ *((uint32 *)dstRow) = color;
+
+ dstRow -= dstFormat.bytesPerPixel;
+ }
+ }
+ } else {
+ crossBlit((byte *)pixels, (const byte *)pixels, w * dstFormat.bytesPerPixel, pitch, w, h, dstFormat, format);
+ }
+
+ // In case the surface data got smaller, free up some memory.
+ if (dstFormat.bytesPerPixel < format.bytesPerPixel) {
+ void *const newPixels = realloc(pixels, w * h * dstFormat.bytesPerPixel);
+ if (!newPixels) {
+ error("Surface::convertToInPlace(): Freeing memory failed");
+ }
+ pixels = newPixels;
+ }
+
+ // Update the surface specific data.
+ format = dstFormat;
+ pitch = w * dstFormat.bytesPerPixel;
+}
+
+Graphics::Surface *Surface::convertTo(const PixelFormat &dstFormat, const byte *palette) const {
+ assert(pixels);
+
+ Graphics::Surface *surface = new Graphics::Surface();
+
+ // If the target format is the same, just copy
+ if (format == dstFormat) {
+ surface->copyFrom(*this);
+ return surface;
+ }
+
+ if (format.bytesPerPixel == 0 || format.bytesPerPixel > 4)
+ error("Surface::convertTo(): Can only convert from 1Bpp, 2Bpp, 3Bpp, and 4Bpp");
+
+ if (dstFormat.bytesPerPixel != 2 && dstFormat.bytesPerPixel != 4)
+ error("Surface::convertTo(): Can only convert to 2Bpp and 4Bpp");
+
+ surface->create(w, h, dstFormat);
+
+ if (format.bytesPerPixel == 1) {
+ // Converting from paletted to high color
+ assert(palette);
+
+ for (int y = 0; y < h; y++) {
+ const byte *srcRow = (const byte *)getBasePtr(0, y);
+ byte *dstRow = (byte *)surface->getBasePtr(0, y);
+
+ for (int x = 0; x < w; x++) {
+ byte index = *srcRow++;
+ byte r = palette[index * 3];
+ byte g = palette[index * 3 + 1];
+ byte b = palette[index * 3 + 2];
+
+ uint32 color = dstFormat.RGBToColor(r, g, b);
+
+ if (dstFormat.bytesPerPixel == 2)
+ *((uint16 *)dstRow) = color;
+ else
+ *((uint32 *)dstRow) = color;
+
+ dstRow += dstFormat.bytesPerPixel;
+ }
+ }
+ } else {
+ // Converting from high color to high color
+ for (int y = 0; y < h; y++) {
+ const byte *srcRow = (const byte *)getBasePtr(0, y);
+ byte *dstRow = (byte *)surface->getBasePtr(0, y);
+
+ for (int x = 0; x < w; x++) {
+ uint32 srcColor;
+ if (format.bytesPerPixel == 2)
+ srcColor = READ_UINT16(srcRow);
+ else if (format.bytesPerPixel == 3)
+ srcColor = READ_UINT24(srcRow);
+ else
+ srcColor = READ_UINT32(srcRow);
+
+ srcRow += format.bytesPerPixel;
+
+ // Convert that color to the new format
+ byte r, g, b, a;
+ format.colorToARGB(srcColor, a, r, g, b);
+ uint32 color = dstFormat.ARGBToColor(a, r, g, b);
+
+ if (dstFormat.bytesPerPixel == 2)
+ *((uint16 *)dstRow) = color;
+ else
+ *((uint32 *)dstRow) = color;
+
+ dstRow += dstFormat.bytesPerPixel;
+ }
+ }
+ }
+
+ return surface;
+}
+
} // End of namespace Graphics
diff --git a/graphics/surface.h b/graphics/surface.h
index 018a283aad..6c9e464657 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -135,6 +135,31 @@ struct Surface {
void copyFrom(const Surface &surf);
/**
+ * Convert the data to another pixel format.
+ *
+ * This works in-place. This means it will not create an additional buffer
+ * for the conversion process. The value of pixels might change though.
+ *
+ * Note that you should only use this, when you created the Surface data via
+ * create! Otherwise this function has undefined behavior.
+ *
+ * @param dstFormat The desired format
+ * @param palette The palette (in RGB888), if the source format has a Bpp of 1
+ */
+ void convertToInPlace(const PixelFormat &dstFormat, const byte *palette = 0);
+
+ /**
+ * Convert the data to another pixel format.
+ *
+ * The calling code must call free on the returned surface and then delete
+ * it.
+ *
+ * @param dstFormat The desired format
+ * @param palette The palette (in RGB888), if the source format has a Bpp of 1
+ */
+ Graphics::Surface *convertTo(const PixelFormat &dstFormat, const byte *palette = 0) const;
+
+ /**
* Draw a line.
*
* @param x0 The x coordinate of the start point.
@@ -142,10 +167,26 @@ struct Surface {
* @param x1 The x coordinate of the end point.
* @param y1 The y coordinate of the end point.
* @param color The color of the line.
+ * @note This is just a wrapper around Graphics::drawLine
*/
void drawLine(int x0, int y0, int x1, int y1, uint32 color);
/**
+ * Draw a thick line.
+ *
+ * @param x0 The x coordinate of the start point.
+ * @param y0 The y coordiante of the start point.
+ * @param x1 The x coordinate of the end point.
+ * @param y1 The y coordinate of the end point.
+ * @param penX The width of the pen (thickness in the x direction)
+ * @param penY The height of the pen (thickness in the y direction)
+ * @param color The color of the line.
+ * @note This is just a wrapper around Graphics::drawThickLine
+ * @note The x/y coordinates of the start and end points are the upper-left most part of the pen
+ */
+ void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color);
+
+ /**
* Draw a horizontal line.
*
* @param x The start x coordinate of the line.
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index 2db72a2874..1d599f7130 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -30,6 +30,46 @@
namespace Graphics {
+/** A Windows cursor. */
+class WinCursor : public Cursor {
+public:
+ WinCursor();
+ ~WinCursor();
+
+ /** Return the cursor's width. */
+ uint16 getWidth() const;
+ /** Return the cursor's height. */
+ uint16 getHeight() const;
+ /** Return the cursor's hotspot's x coordinate. */
+ uint16 getHotspotX() const;
+ /** Return the cursor's hotspot's y coordinate. */
+ uint16 getHotspotY() const;
+ /** Return the cursor's transparent key. */
+ byte getKeyColor() const;
+
+ const byte *getSurface() const { return _surface; }
+
+ const byte *getPalette() const { return _palette; }
+ byte getPaletteStartIndex() const { return 0; }
+ uint16 getPaletteCount() const { return 256; }
+
+ /** Read the cursor's data out of a stream. */
+ bool readFromStream(Common::SeekableReadStream &stream);
+
+private:
+ byte *_surface;
+ byte _palette[256 * 3];
+
+ uint16 _width; ///< The cursor's width.
+ uint16 _height; ///< The cursor's height.
+ uint16 _hotspotX; ///< The cursor's hotspot's x coordinate.
+ uint16 _hotspotY; ///< The cursor's hotspot's y coordinate.
+ byte _keyColor; ///< The cursor's transparent key
+
+ /** Clear the cursor. */
+ void clear();
+};
+
WinCursor::WinCursor() {
_width = 0;
_height = 0;
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index e6b35dc80c..9e73e3a12f 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -36,46 +36,6 @@ class SeekableReadStream;
namespace Graphics {
-/** A Windows cursor. */
-class WinCursor : public Cursor {
-public:
- WinCursor();
- ~WinCursor();
-
- /** Return the cursor's width. */
- uint16 getWidth() const;
- /** Return the cursor's height. */
- uint16 getHeight() const;
- /** Return the cursor's hotspot's x coordinate. */
- uint16 getHotspotX() const;
- /** Return the cursor's hotspot's y coordinate. */
- uint16 getHotspotY() const;
- /** Return the cursor's transparent key. */
- byte getKeyColor() const;
-
- const byte *getSurface() const { return _surface; }
-
- const byte *getPalette() const { return _palette; }
- byte getPaletteStartIndex() const { return 0; }
- uint16 getPaletteCount() const { return 256; }
-
- /** Read the cursor's data out of a stream. */
- bool readFromStream(Common::SeekableReadStream &stream);
-
-private:
- byte *_surface;
- byte _palette[256 * 3];
-
- uint16 _width; ///< The cursor's width.
- uint16 _height; ///< The cursor's height.
- uint16 _hotspotX; ///< The cursor's hotspot's x coordinate.
- uint16 _hotspotY; ///< The cursor's hotspot's y coordinate.
- byte _keyColor; ///< The cursor's transparent key
-
- /** Clear the cursor. */
- void clear();
-};
-
/**
* A structure holding an array of cursors from a single Windows Executable cursor group.
*
@@ -91,7 +51,7 @@ struct WinCursorGroup {
struct CursorItem {
Common::WinResourceID id;
- WinCursor *cursor;
+ Cursor *cursor;
};
Common::Array<CursorItem> cursors;
diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp
index feda48bf6d..6043315a13 100644
--- a/graphics/yuv_to_rgb.cpp
+++ b/graphics/yuv_to_rgb.cpp
@@ -83,132 +83,176 @@
// BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
// SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#include "common/scummsys.h"
-#include "common/singleton.h"
-
#include "graphics/surface.h"
+#include "graphics/yuv_to_rgb.h"
+
+namespace Common {
+DECLARE_SINGLETON(Graphics::YUVToRGBManager);
+}
namespace Graphics {
class YUVToRGBLookup {
public:
- YUVToRGBLookup(Graphics::PixelFormat format);
- ~YUVToRGBLookup();
-
- int16 *_colorTab;
- uint32 *_rgbToPix;
-};
+ YUVToRGBLookup(Graphics::PixelFormat format, YUVToRGBManager::LuminanceScale scale);
-YUVToRGBLookup::YUVToRGBLookup(Graphics::PixelFormat format) {
- _colorTab = new int16[4 * 256]; // 2048 bytes
+ Graphics::PixelFormat getFormat() const { return _format; }
+ YUVToRGBManager::LuminanceScale getScale() const { return _scale; }
+ const uint32 *getRGBToPix() const { return _rgbToPix; }
- int16 *Cr_r_tab = &_colorTab[0 * 256];
- int16 *Cr_g_tab = &_colorTab[1 * 256];
- int16 *Cb_g_tab = &_colorTab[2 * 256];
- int16 *Cb_b_tab = &_colorTab[3 * 256];
+private:
+ Graphics::PixelFormat _format;
+ YUVToRGBManager::LuminanceScale _scale;
+ uint32 _rgbToPix[3 * 768]; // 9216 bytes
+};
- _rgbToPix = new uint32[3 * 768]; // 9216 bytes
+YUVToRGBLookup::YUVToRGBLookup(Graphics::PixelFormat format, YUVToRGBManager::LuminanceScale scale) {
+ _format = format;
+ _scale = scale;
uint32 *r_2_pix_alloc = &_rgbToPix[0 * 768];
uint32 *g_2_pix_alloc = &_rgbToPix[1 * 768];
uint32 *b_2_pix_alloc = &_rgbToPix[2 * 768];
- int16 CR, CB;
- int i;
+ if (scale == YUVToRGBManager::kScaleFull) {
+ // Set up entries 0-255 in rgb-to-pixel value tables.
+ for (int i = 0; i < 256; i++) {
+ r_2_pix_alloc[i + 256] = format.RGBToColor(i, 0, 0);
+ g_2_pix_alloc[i + 256] = format.RGBToColor(0, i, 0);
+ b_2_pix_alloc[i + 256] = format.RGBToColor(0, 0, i);
+ }
+
+ // Spread out the values we have to the rest of the array so that we do
+ // not need to check for overflow.
+ for (int i = 0; i < 256; i++) {
+ r_2_pix_alloc[i] = r_2_pix_alloc[256];
+ r_2_pix_alloc[i + 512] = r_2_pix_alloc[511];
+ g_2_pix_alloc[i] = g_2_pix_alloc[256];
+ g_2_pix_alloc[i + 512] = g_2_pix_alloc[511];
+ b_2_pix_alloc[i] = b_2_pix_alloc[256];
+ b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
+ }
+ } else {
+ // Set up entries 16-235 in rgb-to-pixel value tables
+ for (int i = 16; i < 236; i++) {
+ int scaledValue = (i - 16) * 255 / 219;
+ r_2_pix_alloc[i + 256] = format.RGBToColor(scaledValue, 0, 0);
+ g_2_pix_alloc[i + 256] = format.RGBToColor(0, scaledValue, 0);
+ b_2_pix_alloc[i + 256] = format.RGBToColor(0, 0, scaledValue);
+ }
+
+ // Spread out the values we have to the rest of the array so that we do
+ // not need to check for overflow. We have to do it here in two steps.
+ for (int i = 0; i < 256 + 16; i++) {
+ r_2_pix_alloc[i] = r_2_pix_alloc[256 + 16];
+ g_2_pix_alloc[i] = g_2_pix_alloc[256 + 16];
+ b_2_pix_alloc[i] = b_2_pix_alloc[256 + 16];
+ }
+
+ for (int i = 256 + 236; i < 768; i++) {
+ r_2_pix_alloc[i] = r_2_pix_alloc[256 + 236 - 1];
+ g_2_pix_alloc[i] = g_2_pix_alloc[256 + 236 - 1];
+ b_2_pix_alloc[i] = b_2_pix_alloc[256 + 236 - 1];
+ }
+ }
+}
+
+YUVToRGBManager::YUVToRGBManager() {
+ _lookup = 0;
+
+ int16 *Cr_r_tab = &_colorTab[0 * 256];
+ int16 *Cr_g_tab = &_colorTab[1 * 256];
+ int16 *Cb_g_tab = &_colorTab[2 * 256];
+ int16 *Cb_b_tab = &_colorTab[3 * 256];
// Generate the tables for the display surface
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
// Gamma correction (luminescence table) and chroma correction
// would be done here. See the Berkeley mpeg_play sources.
- CR = CB = (i - 128);
+ int16 CR = (i - 128), CB = CR;
Cr_r_tab[i] = (int16) ( (0.419 / 0.299) * CR) + 0 * 768 + 256;
Cr_g_tab[i] = (int16) (-(0.299 / 0.419) * CR) + 1 * 768 + 256;
Cb_g_tab[i] = (int16) (-(0.114 / 0.331) * CB);
Cb_b_tab[i] = (int16) ( (0.587 / 0.331) * CB) + 2 * 768 + 256;
}
-
- // Set up entries 0-255 in rgb-to-pixel value tables.
- for (i = 0; i < 256; i++) {
- r_2_pix_alloc[i + 256] = format.RGBToColor(i, 0, 0);
- g_2_pix_alloc[i + 256] = format.RGBToColor(0, i, 0);
- b_2_pix_alloc[i + 256] = format.RGBToColor(0, 0, i);
- }
-
- // Spread out the values we have to the rest of the array so that we do
- // not need to check for overflow.
- for (i = 0; i < 256; i++) {
- r_2_pix_alloc[i] = r_2_pix_alloc[256];
- r_2_pix_alloc[i + 512] = r_2_pix_alloc[511];
- g_2_pix_alloc[i] = g_2_pix_alloc[256];
- g_2_pix_alloc[i + 512] = g_2_pix_alloc[511];
- b_2_pix_alloc[i] = b_2_pix_alloc[256];
- b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
- }
-}
-
-YUVToRGBLookup::~YUVToRGBLookup() {
- delete[] _rgbToPix;
- delete[] _colorTab;
-}
-
-class YUVToRGBManager : public Common::Singleton<YUVToRGBManager> {
-public:
- const YUVToRGBLookup *getLookup(Graphics::PixelFormat format);
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
- YUVToRGBManager();
- ~YUVToRGBManager();
-
- Graphics::PixelFormat _lastFormat;
- YUVToRGBLookup *_lookup;
-};
-
-YUVToRGBManager::YUVToRGBManager() {
- _lookup = 0;
}
YUVToRGBManager::~YUVToRGBManager() {
delete _lookup;
}
-const YUVToRGBLookup *YUVToRGBManager::getLookup(Graphics::PixelFormat format) {
- if (_lastFormat == format)
+const YUVToRGBLookup *YUVToRGBManager::getLookup(Graphics::PixelFormat format, YUVToRGBManager::LuminanceScale scale) {
+ if (_lookup && _lookup->getFormat() == format && _lookup->getScale() == scale)
return _lookup;
delete _lookup;
- _lookup = new YUVToRGBLookup(format);
- _lastFormat = format;
+ _lookup = new YUVToRGBLookup(format, scale);
return _lookup;
}
-} // End of namespace Graphics
+#define PUT_PIXEL(s, d) \
+ L = &rgbToPix[(s)]; \
+ *((PixelInt *)(d)) = (L[cr_r] | L[crb_g] | L[cb_b])
-namespace Common {
-DECLARE_SINGLETON(Graphics::YUVToRGBManager);
+template<typename PixelInt>
+void convertYUV444ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup, int16 *colorTab, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+ // Keep the tables in pointers here to avoid a dereference on each pixel
+ const int16 *Cr_r_tab = colorTab;
+ const int16 *Cr_g_tab = Cr_r_tab + 256;
+ const int16 *Cb_g_tab = Cr_g_tab + 256;
+ const int16 *Cb_b_tab = Cb_g_tab + 256;
+ const uint32 *rgbToPix = lookup->getRGBToPix();
+
+ for (int h = 0; h < yHeight; h++) {
+ for (int w = 0; w < yWidth; w++) {
+ register const uint32 *L;
+
+ int16 cr_r = Cr_r_tab[*vSrc];
+ int16 crb_g = Cr_g_tab[*vSrc] + Cb_g_tab[*uSrc];
+ int16 cb_b = Cb_b_tab[*uSrc];
+ ++uSrc;
+ ++vSrc;
+
+ PUT_PIXEL(*ySrc, dstPtr);
+ ySrc++;
+ dstPtr += sizeof(PixelInt);
+ }
+
+ dstPtr += dstPitch - yWidth * sizeof(PixelInt);
+ ySrc += yPitch - yWidth;
+ uSrc += uvPitch - yWidth;
+ vSrc += uvPitch - yWidth;
+ }
}
-#define YUVToRGBMan (Graphics::YUVToRGBManager::instance())
+void YUVToRGBManager::convert444(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+ // Sanity checks
+ assert(dst && dst->pixels);
+ assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4);
+ assert(ySrc && uSrc && vSrc);
-namespace Graphics {
+ const YUVToRGBLookup *lookup = getLookup(dst->format, scale);
-#define PUT_PIXEL(s, d) \
- L = &rgbToPix[(s)]; \
- *((PixelInt *)(d)) = (L[cr_r] | L[crb_g] | L[cb_b])
+ // Use a templated function to avoid an if check on every pixel
+ if (dst->format.bytesPerPixel == 2)
+ convertYUV444ToRGB<uint16>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
+ else
+ convertYUV444ToRGB<uint32>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
+}
template<typename PixelInt>
-void convertYUV420ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+void convertYUV420ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup, int16 *colorTab, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
int halfHeight = yHeight >> 1;
int halfWidth = yWidth >> 1;
// Keep the tables in pointers here to avoid a dereference on each pixel
- const int16 *Cr_r_tab = lookup->_colorTab;
+ const int16 *Cr_r_tab = colorTab;
const int16 *Cr_g_tab = Cr_r_tab + 256;
const int16 *Cb_g_tab = Cr_g_tab + 256;
const int16 *Cb_b_tab = Cb_g_tab + 256;
- const uint32 *rgbToPix = lookup->_rgbToPix;
+ const uint32 *rgbToPix = lookup->getRGBToPix();
for (int h = 0; h < halfHeight; h++) {
for (int w = 0; w < halfWidth; w++) {
@@ -237,7 +281,7 @@ void convertYUV420ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup
}
}
-void convertYUV420ToRGB(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+void YUVToRGBManager::convert420(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
// Sanity checks
assert(dst && dst->pixels);
assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4);
@@ -245,13 +289,98 @@ void convertYUV420ToRGB(Graphics::Surface *dst, const byte *ySrc, const byte *uS
assert((yWidth & 1) == 0);
assert((yHeight & 1) == 0);
- const YUVToRGBLookup *lookup = YUVToRGBMan.getLookup(dst->format);
+ const YUVToRGBLookup *lookup = getLookup(dst->format, scale);
+
+ // Use a templated function to avoid an if check on every pixel
+ if (dst->format.bytesPerPixel == 2)
+ convertYUV420ToRGB<uint16>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
+ else
+ convertYUV420ToRGB<uint32>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
+}
+
+#define READ_QUAD(ptr, prefix) \
+ byte prefix##A = ptr[index]; \
+ byte prefix##B = ptr[index + 1]; \
+ byte prefix##C = ptr[index + uvPitch]; \
+ byte prefix##D = ptr[index + uvPitch + 1]
+
+#define DO_INTERPOLATION(out) \
+ out = (out##A * (4 - xDiff) * (4 - yDiff) + out##B * xDiff * (4 - yDiff) + \
+ out##C * yDiff * (4 - xDiff) + out##D * xDiff * yDiff) >> 4
+
+#define DO_YUV410_PIXEL() \
+ DO_INTERPOLATION(u); \
+ DO_INTERPOLATION(v); \
+ \
+ cr_r = Cr_r_tab[v]; \
+ crb_g = Cr_g_tab[v] + Cb_g_tab[u]; \
+ cb_b = Cb_b_tab[u]; \
+ \
+ PUT_PIXEL(*ySrc, dstPtr); \
+ dstPtr += sizeof(PixelInt); \
+ \
+ ySrc++; \
+ xDiff++
+
+template<typename PixelInt>
+void convertYUV410ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup, int16 *colorTab, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+ // Keep the tables in pointers here to avoid a dereference on each pixel
+ const int16 *Cr_r_tab = colorTab;
+ const int16 *Cr_g_tab = Cr_r_tab + 256;
+ const int16 *Cb_g_tab = Cr_g_tab + 256;
+ const int16 *Cb_b_tab = Cb_g_tab + 256;
+ const uint32 *rgbToPix = lookup->getRGBToPix();
+
+ int quarterWidth = yWidth >> 2;
+
+ for (int y = 0; y < yHeight; y++) {
+ for (int x = 0; x < quarterWidth; x++) {
+ // Perform bilinear interpolation on the the chroma values
+ // Based on the algorithm found here: http://tech-algorithm.com/articles/bilinear-image-scaling/
+ // Feel free to optimize further
+ int targetY = y >> 2;
+ int xDiff = 0;
+ int yDiff = y & 3;
+ int index = targetY * uvPitch + x;
+
+ // Declare some variables for the following macros
+ byte u, v;
+ int16 cr_r, crb_g, cb_b;
+ register const uint32 *L;
+
+ READ_QUAD(uSrc, u);
+ READ_QUAD(vSrc, v);
+
+ DO_YUV410_PIXEL();
+ DO_YUV410_PIXEL();
+ DO_YUV410_PIXEL();
+ DO_YUV410_PIXEL();
+ }
+
+ dstPtr += dstPitch - yWidth * sizeof(PixelInt);
+ ySrc += yPitch - yWidth;
+ }
+}
+
+#undef READ_QUAD
+#undef DO_INTERPOLATION
+#undef DO_YUV410_PIXEL
+
+void YUVToRGBManager::convert410(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+ // Sanity checks
+ assert(dst && dst->pixels);
+ assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4);
+ assert(ySrc && uSrc && vSrc);
+ assert((yWidth & 3) == 0);
+ assert((yHeight & 3) == 0);
+
+ const YUVToRGBLookup *lookup = getLookup(dst->format, scale);
// Use a templated function to avoid an if check on every pixel
if (dst->format.bytesPerPixel == 2)
- convertYUV420ToRGB<uint16>((byte *)dst->pixels, dst->pitch, lookup, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
+ convertYUV410ToRGB<uint16>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
else
- convertYUV420ToRGB<uint32>((byte *)dst->pixels, dst->pitch, lookup, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
+ convertYUV410ToRGB<uint32>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
}
} // End of namespace Graphics
diff --git a/graphics/yuv_to_rgb.h b/graphics/yuv_to_rgb.h
index 259ba09810..f785422c5a 100644
--- a/graphics/yuv_to_rgb.h
+++ b/graphics/yuv_to_rgb.h
@@ -23,6 +23,7 @@
/**
* @file
* YUV to RGB conversion used in engines:
+ * - mohawk
* - scumm (he)
* - sword25
*/
@@ -31,24 +32,85 @@
#define GRAPHICS_YUV_TO_RGB_H
#include "common/scummsys.h"
+#include "common/singleton.h"
#include "graphics/surface.h"
namespace Graphics {
-/**
- * Convert a YUV420 image to an RGB surface
- *
- * @param dst the destination surface
- * @param ySrc the source of the y component
- * @param uSrc the source of the u component
- * @param vSrc the source of the v component
- * @param yWidth the width of the y surface (must be divisible by 2)
- * @param yHeight the height of the y surface (must be divisible by 2)
- * @param yPitch the pitch of the y surface
- * @param uvPitch the pitch of the u and v surfaces
- */
-void convertYUV420ToRGB(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch);
+class YUVToRGBLookup;
+
+class YUVToRGBManager : public Common::Singleton<YUVToRGBManager> {
+public:
+ /** The scale of the luminance values */
+ enum LuminanceScale {
+ kScaleFull, /** Luminance values range from [0, 255] */
+ kScaleITU /** Luminance values range from [16, 235], the range from ITU-R BT.601 */
+ };
+
+ /**
+ * Convert a YUV444 image to an RGB surface
+ *
+ * @param dst the destination surface
+ * @param scale the scale of the luminance values
+ * @param ySrc the source of the y component
+ * @param uSrc the source of the u component
+ * @param vSrc the source of the v component
+ * @param yWidth the width of the y surface
+ * @param yHeight the height of the y surface
+ * @param yPitch the pitch of the y surface
+ * @param uvPitch the pitch of the u and v surfaces
+ */
+ void convert444(Graphics::Surface *dst, LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch);
+
+ /**
+ * Convert a YUV420 image to an RGB surface
+ *
+ * @param dst the destination surface
+ * @param scale the scale of the luminance values
+ * @param ySrc the source of the y component
+ * @param uSrc the source of the u component
+ * @param vSrc the source of the v component
+ * @param yWidth the width of the y surface (must be divisible by 2)
+ * @param yHeight the height of the y surface (must be divisible by 2)
+ * @param yPitch the pitch of the y surface
+ * @param uvPitch the pitch of the u and v surfaces
+ */
+ void convert420(Graphics::Surface *dst, LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch);
+
+ /**
+ * Convert a YUV410 image to an RGB surface
+ *
+ * Since the chroma has a very low resolution in 410, we perform bilinear scaling
+ * on the two chroma planes to produce the image. The chroma planes must have
+ * at least one extra row and one extra column that can be read from in order to
+ * produce a proper image. It is suggested that you fill these in with the previous
+ * row and column's data. This is required in order to speed up this function.
+ *
+ * @param dst the destination surface
+ * @param scale the scale of the luminance values
+ * @param ySrc the source of the y component
+ * @param uSrc the source of the u component
+ * @param vSrc the source of the v component
+ * @param yWidth the width of the y surface (must be divisible by 4)
+ * @param yHeight the height of the y surface (must be divisible by 4)
+ * @param yPitch the pitch of the y surface
+ * @param uvPitch the pitch of the u and v surfaces
+ */
+ void convert410(Graphics::Surface *dst, LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch);
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+ YUVToRGBManager();
+ ~YUVToRGBManager();
+
+ const YUVToRGBLookup *getLookup(Graphics::PixelFormat format, LuminanceScale scale);
+
+ YUVToRGBLookup *_lookup;
+ int16 _colorTab[4 * 256]; // 2048 bytes
+};
} // End of namespace Graphics
+#define YUVToRGBMan (::Graphics::YUVToRGBManager::instance())
+
#endif
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 2cb1635e20..e2fa2580f5 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -30,11 +30,11 @@
#include "graphics/cursorman.h"
#include "graphics/fontman.h"
-#include "graphics/imagedec.h"
#include "graphics/surface.h"
#include "graphics/VectorRenderer.h"
#include "graphics/fonts/bdf.h"
#include "graphics/fonts/ttf.h"
+#include "graphics/decoders/bmp.h"
#include "gui/widget.h"
#include "gui/ThemeEngine.h"
@@ -47,6 +47,9 @@ const char * const ThemeEngine::kImageLogo = "logo.bmp";
const char * const ThemeEngine::kImageLogoSmall = "logo_small.bmp";
const char * const ThemeEngine::kImageSearch = "search.bmp";
const char * const ThemeEngine::kImageEraser = "eraser.bmp";
+const char * const ThemeEngine::kImageDelbtn = "delbtn.bmp";
+const char * const ThemeEngine::kImageList = "list.bmp";
+const char * const ThemeEngine::kImageGrid = "grid.bmp";
struct TextDrawData {
const Graphics::Font *_fontPtr;
@@ -174,6 +177,7 @@ static const DrawDataInfo kDrawDataDefaults[] = {
{kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider},
{kDDButtonHover, "button_hover", false, kDDButtonIdle},
{kDDButtonDisabled, "button_disabled", true, kDDNone},
+ {kDDButtonPressed, "button_pressed", false, kDDButtonIdle},
{kDDSliderFull, "slider_full", false, kDDNone},
{kDDSliderHover, "slider_hover", false, kDDNone},
@@ -427,7 +431,7 @@ bool ThemeEngine::init() {
void ThemeEngine::clearAll() {
if (_initOk) {
_system->clearOverlay();
- _system->grabOverlay((OverlayColor *)_screen.pixels, _screen.w);
+ _system->grabOverlay(_screen.pixels, _screen.pitch);
}
}
@@ -452,7 +456,7 @@ void ThemeEngine::refresh() {
if (_useCursor) {
CursorMan.replaceCursorPalette(_cursorPal, 0, _cursorPalSize);
- CursorMan.replaceCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale);
+ CursorMan.replaceCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true);
}
}
}
@@ -463,7 +467,7 @@ void ThemeEngine::enable() {
if (_useCursor) {
CursorMan.pushCursorPalette(_cursorPal, 0, _cursorPalSize);
- CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale);
+ CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true);
CursorMan.showMouse(true);
}
@@ -620,20 +624,25 @@ bool ThemeEngine::addBitmap(const Common::String &filename) {
if (surf)
return true;
- // If not, try to load the bitmap via the ImageDecoder class.
+ // If not, try to load the bitmap via the BitmapDecoder class.
+ Graphics::BitmapDecoder bitmapDecoder;
+ const Graphics::Surface *srcSurface = 0;
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) {
- surf = Graphics::ImageDecoder::loadFile(*stream, _overlayFormat);
+ bitmapDecoder.loadStream(*stream);
+ srcSurface = bitmapDecoder.getSurface();
delete stream;
-
- if (surf)
+ if (srcSurface)
break;
}
}
+ if (srcSurface && srcSurface->format.bytesPerPixel != 1)
+ surf = srcSurface->convertTo(_overlayFormat);
+
// Store the surface into our hashmap (attention, may store NULL entries!)
_bitmaps[filename] = surf;
@@ -871,6 +880,8 @@ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, W
dd = kDDButtonHover;
else if (state == kStateDisabled)
dd = kDDButtonDisabled;
+ else if (state == kStatePressed)
+ dd = kDDButtonPressed;
queueDD(dd, r, 0, hints & WIDGET_CLEARBG);
queueDDText(getTextData(dd), getTextColor(dd), r, str, false, true, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV);
@@ -1119,6 +1130,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid
break;
case kStateEnabled:
+ case kStatePressed:
colorId = kTextColorNormal;
break;
}
@@ -1139,6 +1151,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid
break;
case kStateEnabled:
+ case kStatePressed:
colorId = kTextColorAlternative;
break;
}
@@ -1276,7 +1289,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) {
_vectorRenderer->setSurface(&_screen);
}
-bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale) {
+bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY) {
if (!_system->hasFeature(OSystem::kFeatureCursorPalette))
return true;
@@ -1294,7 +1307,6 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
// Set up the cursor parameters
_cursorHotspotX = hotspotX;
_cursorHotspotY = hotspotY;
- _cursorTargetScale = scale;
_cursorWidth = cursor->w;
_cursorHeight = cursor->h;
@@ -1412,7 +1424,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena
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,
+ font = Graphics::loadTTFFont(*stream, pointsize, 0, false,
#ifdef USE_TRANSLATION
TransMan.getCharsetMapping()
#else
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index f041f85ab9..6fb93d3b46 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.8"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.16"
class OSystem;
@@ -81,6 +81,7 @@ enum DrawData {
kDDButtonIdle,
kDDButtonHover,
kDDButtonDisabled,
+ kDDButtonPressed,
kDDSliderFull,
kDDSliderHover,
@@ -178,7 +179,8 @@ public:
enum State {
kStateDisabled, ///< Indicates that the widget is disabled, that does NOT include that it is invisible
kStateEnabled, ///< Indicates that the widget is enabled
- kStateHighlight ///< Indicates that the widget is highlighted by the user
+ kStateHighlight, ///< Indicates that the widget is highlighted by the user
+ kStatePressed ///< Indicates that the widget is pressed, currently works for buttons
};
typedef State WidgetStateInfo;
@@ -229,6 +231,9 @@ public:
static const char *const kImageLogoSmall; ///< ScummVM logo used in the GMM
static const char *const kImageSearch; ///< Search tool image used in the launcher
static const char *const kImageEraser; ///< Clear input image used in the launcher
+ static const char *const kImageDelbtn; ///< Delete characters in the predictive dialog
+ static const char *const kImageList; ///< List image used in save/load chooser selection
+ static const char *const kImageGrid; ///< Grid image used in save/load chooser selection
/**
* Graphics mode enumeration.
@@ -273,6 +278,11 @@ public:
void disable();
/**
+ * Query the set up pixel format.
+ */
+ const Graphics::PixelFormat getPixelFormat() const { return _overlayFormat; }
+
+ /**
* Implementation of the GUI::Theme API. Called when a
* new dialog is opened. Note that the boolean parameter
* meaning has been changed.
@@ -492,9 +502,8 @@ public:
* @param filename File name of the bitmap to load.
* @param hotspotX X Coordinate of the bitmap which does the cursor click.
* @param hotspotY Y Coordinate of the bitmap which does the cursor click.
- * @param scale Scale at which the bitmap is supposed to be used.
*/
- bool createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale);
+ bool createCursor(const Common::String &filename, int hotspotX, int hotspotY);
/**
* Wrapper for restoring data from the Back Buffer to the screen.
@@ -666,7 +675,6 @@ protected:
bool _useCursor;
int _cursorHotspotX, _cursorHotspotY;
- int _cursorTargetScale;
enum {
MAX_CURS_COLORS = 255
};
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 9ccdedd564..8285aff7ca 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -218,15 +218,12 @@ bool ThemeParser::parserCallback_cursor(ParserNode *node) {
return true;
}
- int spotx, spoty, scale;
+ int spotx, spoty;
if (!parseIntegerKey(node->values["hotspot"], 2, &spotx, &spoty))
return parserError("Error parsing cursor Hot Spot coordinates.");
- if (!parseIntegerKey(node->values["scale"], 1, &scale))
- return parserError("Error parsing cursor scale.");
-
- if (!_theme->createCursor(node->values["file"], spotx, spoty, scale))
+ if (!_theme->createCursor(node->values["file"], spotx, spoty))
return parserError("Error creating Bitmap Cursor.");
return true;
@@ -551,11 +548,11 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst
else
return parserError("'" + stepNode->values["fill"] + "' is not a valid fill mode for a shape.");
}
-
+
if (stepNode->values.contains("padding")) {
val = stepNode->values["padding"];
int pr, pt, pl, pb;
- if (parseIntegerKey(val, 4, &pl, &pt, &pr, &pb))
+ if (parseIntegerKey(val, 4, &pl, &pt, &pr, &pb))
drawstep->padding.left = pl,
drawstep->padding.top = pt,
drawstep->padding.right = pr,
diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h
index 4b7e88cbf3..360e3da009 100644
--- a/gui/ThemeParser.h
+++ b/gui/ThemeParser.h
@@ -85,7 +85,6 @@ protected:
XML_KEY(cursor)
XML_PROP(file, true)
XML_PROP(hotspot, true)
- XML_PROP(scale, true)
XML_PROP(resolution, false)
KEY_END()
@@ -140,7 +139,7 @@ protected:
XML_PROP(height, false)
XML_PROP(xpos, false)
XML_PROP(ypos, false)
- XML_PROP(padding, false)
+ XML_PROP(padding, false)
XML_PROP(orientation, false)
XML_PROP(file, false)
KEY_END()
diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 85e5856cff..88124e782b 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -37,7 +37,7 @@ Tooltip::Tooltip() :
}
void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) {
- assert(widget->getTooltip());
+ assert(widget->hasTooltip());
_maxWidth = g_gui.xmlEval()->getVar("Globals.Tooltip.MaxWidth", 100);
_xdelta = g_gui.xmlEval()->getVar("Globals.Tooltip.XDelta", 0);
diff --git a/gui/credits.h b/gui/credits.h
index 154f577fba..37c5a7bd95 100644
--- a/gui/credits.h
+++ b/gui/credits.h
@@ -106,8 +106,10 @@ static const char *credits[] = {
"C1""DreamWeb",
"C0""Torbj\366rn Andersson",
"C0""Bertrand Augereau",
+"C0""Filippos Karapetis",
"C0""Vladimir Menshakov",
"C2""(retired)",
+"C0""Willem Jan Palenstijn",
"",
"C1""Gob",
"C0""Torbj\366rn Andersson",
@@ -157,6 +159,9 @@ static const char *credits[] = {
"C1""Parallaction",
"C0""peres",
"",
+"C1""Pegasus",
+"C0""Matthew Hoops",
+"",
"C1""Queen",
"C0""David Eriksson",
"C2""(retired)",
@@ -232,6 +237,11 @@ static const char *credits[] = {
"C0""Filippos Karapetis",
"C0""Joost Peters",
"",
+"C1""Tony",
+"C0""Arnaud Boutonn\351",
+"C0""Paul Gilbert",
+"C0""Alyssa Milburn",
+"",
"C1""Toon",
"C0""Sylvain Dupont",
"",
@@ -247,6 +257,9 @@ static const char *credits[] = {
"C0""Gregory Montoir",
"C2""(retired)",
"",
+"C1""Wintermute",
+"C0""Einar Johan T. S\370m\345en",
+"",
"",
"C1""Backend Teams",
"C1""Android",
@@ -459,6 +472,9 @@ static const char *credits[] = {
"C1""Translations",
"C0""Thierry Crozat",
"C2""Translation Lead",
+"C1""Basque",
+"C0""Mikel Iturbe Urretxa",
+"",
"C1""Catalan",
"C0""Jordi Vilalta Prat",
"",
@@ -471,9 +487,13 @@ static const char *credits[] = {
"C1""French",
"C0""Thierry Crozat",
"",
+"C1""Galician",
+"C0""Santiago G. Sanz",
+"",
"C1""German",
"C0""Simon Sawatzki",
"C0""Lothar Serra Mari",
+"C2""(retired)",
"",
"C1""Hungarian",
"C0""Alex Bevilacqua",
@@ -483,10 +503,10 @@ static const char *credits[] = {
"C0""Matteo Angelino",
"",
"C1""Norwegian (Bokm\345l)",
-"C0""Einar Johan T. S\370m\345en",
+"C0""Einar Johan S\370m\345en",
"",
"C1""Norwegian (Nynorsk)",
-"C0""Einar Johan T. S\370m\345en",
+"C0""Einar Johan S\370m\345en",
"",
"C1""Polish",
"C0""GrajPoPolsku.pl Team",
@@ -671,6 +691,8 @@ static const char *credits[] = {
"C2""For generously providing hosting for our buildbot, SVN repository, planet and doxygen sites as well as tons of HD space",
"C0""DOSBox Team",
"C2""For their awesome OPL2 and OPL3 emulator",
+"C0""Yusuke Kamiyamane",
+"C2""For contributing some GUI icons ",
"C0""Till Kresslein",
"C2""For design of modern ScummVM GUI",
"C0""Jezar",
@@ -687,8 +709,6 @@ static const char *credits[] = {
"C2""For additional work on the original MT-32 emulator",
"C0""James Woodcock",
"C2""Soundtrack enhancements",
-"C0""Some icons by Yusuke Kamiyamane",
-"C0""",
"C0""Tony Warriner and everyone at Revolution Software Ltd. for sharing with us the source of some of their brilliant games, allowing us to release Beneath a Steel Sky as freeware... and generally being supportive above and beyond the call of duty.",
"C0""",
"C0""John Passfield and Steve Stamatiadis for sharing the source of their classic title, Flight of the Amazon Queen and also being incredibly supportive.",
@@ -707,5 +727,13 @@ static const char *credits[] = {
"C0""",
"C0""Broken Sword 2.5 team for providing sources of their engine and their great support.",
"C0""",
+"C0""Neil Dodwell and David Dew from Creative Reality for providing the source of Dreamweb and for their tremendous support.",
+"C0""",
+"C0""Janusz Wisniewski and Miroslaw Liminowicz from Laboratorium Komputerowe Avalon for providing full source code for Soltys and letting us redistribute the game.",
+"C0""",
+"C0""Jan Nedoma for providing the sources to the Wintermute-engine, and for his support while porting the engine to ScummVM.",
+"C0""",
+"C0""Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for providing the source code of The Journeyman Project: Pegasus Prime.",
+"C0""",
"",
};
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 26e62dc1d9..972163df6f 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -200,9 +200,8 @@ void Debugger::enter() {
bool Debugger::handleCommand(int argc, const char **argv, bool &result) {
if (_cmds.contains(argv[0])) {
- Debuglet *debuglet = _cmds[argv[0]].get();
- assert(debuglet);
- result = (*debuglet)(argc, argv);
+ assert(_cmds[argv[0]]);
+ result = (*_cmds[argv[0]])(argc, argv);
return true;
}
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index fd15ba5e09..ffca15bbc8 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -21,6 +21,10 @@
#include "common/rect.h"
+#ifdef ENABLE_KEYMAPPER
+#include "common/events.h"
+#endif
+
#include "gui/gui-manager.h"
#include "gui/dialog.h"
#include "gui/widget.h"
@@ -38,7 +42,7 @@ namespace GUI {
Dialog::Dialog(int x, int y, int w, int h)
: GuiObject(x, y, w, h),
- _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false),
+ _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _tickleWidget(0), _visible(false),
_backgroundType(GUI::ThemeEngine::kDialogBackgroundDefault) {
// Some dialogs like LauncherDialog use internally a fixed size, even though
// their widgets rely on the layout to be initialized correctly by the theme.
@@ -50,7 +54,7 @@ Dialog::Dialog(int x, int y, int w, int h)
Dialog::Dialog(const Common::String &name)
: GuiObject(name),
- _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false),
+ _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _tickleWidget(0), _visible(false),
_backgroundType(GUI::ThemeEngine::kDialogBackgroundDefault) {
// It may happen that we have 3x scaler in launcher (960xY) and then 640x480
@@ -113,6 +117,12 @@ void Dialog::reflowLayout() {
GuiObject::reflowLayout();
}
+void Dialog::lostFocus() {
+ if (_tickleWidget) {
+ _tickleWidget->lostFocus();
+ }
+}
+
void Dialog::setFocusWidget(Widget *widget) {
// The focus will change. Tell the old focused widget (if any)
// that it lost the focus.
@@ -304,6 +314,9 @@ void Dialog::handleTickle() {
// Focused widget receives tickle notifications
if (_focusedWidget && _focusedWidget->getFlags() & WIDGET_WANT_TICKLE)
_focusedWidget->handleTickle();
+
+ if (_tickleWidget && _tickleWidget->getFlags() & WIDGET_WANT_TICKLE)
+ _tickleWidget->handleTickle();
}
void Dialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
@@ -314,6 +327,9 @@ void Dialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
}
}
+#ifdef ENABLE_KEYMAPPER
+void Dialog::handleOtherEvent(Common::Event evt) { }
+#endif
/*
* Determine the widget at location (x,y) if any. Assumes the coordinates are
* in the local coordinate system, i.e. relative to the top left of the dialog.
diff --git a/gui/dialog.h b/gui/dialog.h
index a324450996..1773c6633e 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -29,6 +29,12 @@
#include "gui/object.h"
#include "gui/ThemeEngine.h"
+#ifdef ENABLE_KEYMAPPER
+namespace Common {
+struct Event;
+}
+#endif
+
namespace GUI {
class Widget;
@@ -46,6 +52,7 @@ protected:
Widget *_mouseWidget;
Widget *_focusedWidget;
Widget *_dragWidget;
+ Widget *_tickleWidget;
bool _visible;
ThemeEngine::DialogBackground _backgroundType;
@@ -65,7 +72,13 @@ public:
void setFocusWidget(Widget *widget);
Widget *getFocusWidget() { return _focusedWidget; }
+ void setTickleWidget(Widget *widget) { _tickleWidget = widget; }
+ void unSetTickleWidget() { _tickleWidget = NULL; }
+ Widget *getTickleWidget() { return _tickleWidget; }
+
virtual void reflowLayout();
+ virtual void lostFocus();
+ virtual void receivedFocus() {}
protected:
virtual void open();
@@ -82,6 +95,9 @@ protected:
virtual void handleKeyUp(Common::KeyState state);
virtual void handleMouseMoved(int x, int y, int button);
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+#ifdef ENABLE_KEYMAPPER
+ virtual void handleOtherEvent(Common::Event evt);
+#endif
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
Widget *findWidget(const char *name);
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 4fa60bfe07..a0ef4216aa 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -366,6 +366,9 @@ void GuiManager::runLoop() {
screenChange();
break;
default:
+#ifdef ENABLE_KEYMAPPER
+ activeDialog->handleOtherEvent(event);
+#endif
break;
}
@@ -378,7 +381,7 @@ void GuiManager::runLoop() {
if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis()) {
Widget *wdg = activeDialog->findWidget(_lastMousePosition.x, _lastMousePosition.y);
- if (wdg && wdg->getTooltip()) {
+ if (wdg && wdg->hasTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) {
Tooltip *tooltip = new Tooltip();
tooltip->setup(activeDialog, wdg, _lastMousePosition.x, _lastMousePosition.y);
tooltip->runModal();
@@ -438,6 +441,11 @@ void GuiManager::restoreState() {
}
void GuiManager::openDialog(Dialog *dialog) {
+ dialog->receivedFocus();
+
+ if (!_dialogStack.empty())
+ getTopDialog()->lostFocus();
+
_dialogStack.push(dialog);
if (_redrawStatus != kRedrawFull)
_redrawStatus = kRedrawOpenDialog;
@@ -455,7 +463,11 @@ void GuiManager::closeTopDialog() {
return;
// Remove the dialog from the stack
- _dialogStack.pop();
+ _dialogStack.pop()->lostFocus();
+
+ if (!_dialogStack.empty())
+ getTopDialog()->receivedFocus();
+
if (_redrawStatus != kRedrawFull)
_redrawStatus = kRedrawCloseDialog;
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index a3e4925848..0f4867ced5 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -145,10 +145,27 @@ protected:
CheckboxWidget *_globalMIDIOverride;
CheckboxWidget *_globalMT32Override;
CheckboxWidget *_globalVolumeOverride;
+
+ ExtraGuiOptions _engineOptions;
};
EditGameDialog::EditGameDialog(const String &domain, const String &desc)
: OptionsDialog(domain, "GameOptions") {
+ // Retrieve all game specific options.
+ const EnginePlugin *plugin = 0;
+ // To allow for game domains without a gameid.
+ // TODO: Is it intentional that this is still supported?
+ String gameId(ConfMan.get("gameid", domain));
+ if (gameId.empty())
+ gameId = domain;
+ // Retrieve the plugin, since we need to access the engine's MetaEngine
+ // implementation.
+ EngineMan.findGame(gameId, &plugin);
+ if (plugin) {
+ _engineOptions = (*plugin)->getExtraGuiOptions(domain);
+ } else {
+ warning("Plugin for target \"%s\" not found! Game specific settings might be missing", domain.c_str());
+ }
// GAME: Path to game data (r/o), extra data (r/o), and save data (r/w)
String gamePath(ConfMan.get("path", _domain));
@@ -208,7 +225,16 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
}
//
- // 2) The graphics tab
+ // 2) The engine tab (shown only if there are custom engine options)
+ //
+ if (_engineOptions.size() > 0) {
+ tab->addTab(_("Engine"));
+
+ addEngineControls(tab, "GameOptions_Engine.", _engineOptions);
+ }
+
+ //
+ // 3) The graphics tab
//
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
@@ -220,7 +246,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
addGraphicControls(tab, "GameOptions_Graphics.");
//
- // 3) The audio tab
+ // 4) The audio tab
//
tab->addTab(_("Audio"));
@@ -233,7 +259,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
addSubtitleControls(tab, "GameOptions_Audio.");
//
- // 4) The volume tab
+ // 5) The volume tab
//
if (g_system->getOverlayWidth() > 320)
tab->addTab(_("Volume"));
@@ -248,7 +274,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
addVolumeControls(tab, "GameOptions_Volume.");
//
- // 5) The MIDI tab
+ // 6) The MIDI tab
//
if (!_guioptions.contains(GUIO_NOMIDI)) {
tab->addTab(_("MIDI"));
@@ -262,7 +288,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
}
//
- // 6) The MT-32 tab
+ // 7) The MT-32 tab
//
if (!_guioptions.contains(GUIO_NOMIDI)) {
tab->addTab(_("MT-32"));
@@ -276,7 +302,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
}
//
- // 7) The Paths tab
+ // 8) The Paths tab
//
if (g_system->getOverlayWidth() > 320)
tab->addTab(_("Paths"));
@@ -311,7 +337,6 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
_savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear);
-
// Activate the first tab
tab->setActiveTab(0);
_tabWidget = tab;
@@ -342,8 +367,7 @@ void EditGameDialog::open() {
e = ConfMan.hasKey("gfx_mode", _domain) ||
ConfMan.hasKey("render_mode", _domain) ||
ConfMan.hasKey("fullscreen", _domain) ||
- ConfMan.hasKey("aspect_ratio", _domain) ||
- ConfMan.hasKey("disable_dithering", _domain);
+ ConfMan.hasKey("aspect_ratio", _domain);
_globalGraphicsOverride->setState(e);
e = ConfMan.hasKey("music_driver", _domain) ||
@@ -386,6 +410,19 @@ void EditGameDialog::open() {
_langPopUp->setEnabled(false);
}
+ // Set the state of engine-specific checkboxes
+ for (uint j = 0; j < _engineOptions.size(); ++j) {
+ // The default values for engine-specific checkboxes are not set when
+ // ScummVM starts, as this would require us to load and poll all of the
+ // engine plugins on startup. Thus, we set the state of each custom
+ // option checkbox to what is specified by the engine plugin, and
+ // update it only if a value has been set in the configuration of the
+ // currently selected game.
+ bool isChecked = _engineOptions[j].defaultState;
+ if (ConfMan.hasKey(_engineOptions[j].configOption, _domain))
+ isChecked = ConfMan.getBool(_engineOptions[j].configOption, _domain);
+ _engineCheckboxes[j]->setState(isChecked);
+ }
const Common::PlatformDescription *p = Common::g_platforms;
const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", _domain));
@@ -429,6 +466,11 @@ void EditGameDialog::close() {
ConfMan.removeKey("platform", _domain);
else
ConfMan.set("platform", Common::getPlatformCode(platform), _domain);
+
+ // Set the state of engine-specific checkboxes
+ for (uint i = 0; i < _engineOptions.size(); i++) {
+ ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain);
+ }
}
OptionsDialog::close();
}
@@ -621,7 +663,6 @@ LauncherDialog::LauncherDialog()
_list->setEditable(false);
_list->setNumberingMode(kListNumberingOff);
-
// Populate the list
updateListing();
@@ -636,7 +677,7 @@ LauncherDialog::LauncherDialog()
_browser = new BrowserDialog(_("Select directory with game data"), true);
// Create Load dialog
- _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"));
+ _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"), false);
}
void LauncherDialog::selectTarget(const String &target) {
diff --git a/gui/module.mk b/gui/module.mk
index df6b76172a..a435d8cca7 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -13,7 +13,9 @@ MODULE_OBJS := \
message.o \
object.o \
options.o \
+ predictivedialog.o \
saveload.o \
+ saveload-dialog.o \
themebrowser.o \
ThemeEngine.o \
ThemeEval.o \
diff --git a/gui/options.cpp b/gui/options.cpp
index 5085f9cdd9..4868f1876d 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -102,7 +102,6 @@ void OptionsDialog::init() {
_renderModePopUpDesc = 0;
_fullscreenCheckbox = 0;
_aspectCheckbox = 0;
- _disableDitheringCheckbox = 0;
_enableAudioSettings = false;
_midiPopUp = 0;
_midiPopUpDesc = 0;
@@ -217,14 +216,6 @@ void OptionsDialog::open() {
}
#endif // SMALL_SCREEN_DEVICE
- // EGA undithering setting
- if (_guioptions.contains(GUIO_EGAUNDITHER) || _domain == Common::ConfigManager::kApplicationDomain) {
- _disableDitheringCheckbox->setEnabled(true);
- _disableDitheringCheckbox->setState(ConfMan.getBool("disable_dithering", _domain));
- } else {
- _disableDitheringCheckbox->setState(false);
- _disableDitheringCheckbox->setEnabled(false);
- }
}
// Audio options
@@ -333,7 +324,6 @@ void OptionsDialog::close() {
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
- ConfMan.setBool("disable_dithering", _disableDitheringCheckbox->getState(), _domain);
bool isSet = false;
@@ -359,7 +349,6 @@ void OptionsDialog::close() {
} else {
ConfMan.removeKey("fullscreen", _domain);
ConfMan.removeKey("aspect_ratio", _domain);
- ConfMan.removeKey("disable_dithering", _domain);
ConfMan.removeKey("gfx_mode", _domain);
ConfMan.removeKey("render_mode", _domain);
}
@@ -617,10 +606,6 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
else
_aspectCheckbox->setEnabled(enabled);
#endif
- if (_guioptions.contains(GUIO_EGAUNDITHER) && enabled)
- _disableDitheringCheckbox->setEnabled(true);
- else
- _disableDitheringCheckbox->setEnabled(false);
}
void OptionsDialog::setAudioSettingsState(bool enabled) {
@@ -750,7 +735,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
}
// RenderMode popup
- const Common::String allFlags = renderType2GUIO((uint32)-1);
+ const Common::String allFlags = Common::allRenderModesGUIOs();
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"));
@@ -759,7 +744,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
_renderModePopUp->appendEntry("");
const Common::RenderModeDescription *rm = Common::g_renderModes;
for (; rm->code; ++rm) {
- Common::String renderGuiOption = renderType2GUIO(rm->id);
+ Common::String renderGuiOption = Common::renderMode2GUIO(rm->id);
if ((_domain == Common::ConfigManager::kApplicationDomain) || (_domain != Common::ConfigManager::kApplicationDomain && !renderingTypeDefined) || (_guioptions.contains(renderGuiOption)))
_renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
}
@@ -769,7 +754,6 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
// Aspect ratio checkbox
_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), _("Correct aspect ratio for 320x200 games"));
- _disableDitheringCheckbox = new CheckboxWidget(boss, prefix + "grDisableDitheringCheckbox", _("EGA undithering"), _("Enable undithering in EGA games that support it"));
_enableGraphicSettings = true;
}
@@ -997,6 +981,22 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre
_enableVolumeSettings = true;
}
+void OptionsDialog::addEngineControls(GuiObject *boss, const Common::String &prefix, const ExtraGuiOptions &engineOptions) {
+ // Note: up to 7 engine options can currently fit on screen (the most that
+ // can fit in a 320x200 screen with the classic theme).
+ // TODO: Increase this number by including the checkboxes inside a scroll
+ // widget. The appropriate number of checkboxes will need to be added to
+ // the theme files.
+
+ uint i = 1;
+ ExtraGuiOptions::const_iterator iter;
+ for (iter = engineOptions.begin(); iter != engineOptions.end(); ++iter, ++i) {
+ Common::String id = Common::String::format("%d", i);
+ _engineCheckboxes.push_back(new CheckboxWidget(boss,
+ prefix + "customOption" + id + "Checkbox", _(iter->label), _(iter->tooltip)));
+ }
+}
+
bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicType preferredType) {
if (!popup || !popup->isEnabled())
return true;
@@ -1010,7 +1010,7 @@ bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String se
for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
if (setting.empty() ? (preferredType == d->getMusicType()) : (drv == d->getCompleteId())) {
popup->setSelectedTag(d->getHandle());
- return popup->getSelected() == -1 ? false : true;
+ return popup->getSelected() != -1;
}
}
}
@@ -1040,31 +1040,6 @@ 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::kRenderPC9821, GUIO_RENDERPC9821 },
- { Common::kRenderPC9801, GUIO_RENDERPC9801 }
- };
- 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 83c9d60d59..def56cfa35 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -22,6 +22,8 @@
#ifndef OPTIONS_DIALOG_H
#define OPTIONS_DIALOG_H
+#include "engines/metaengine.h"
+
#include "gui/dialog.h"
#include "common/str.h"
#include "audio/mididrv.h"
@@ -44,6 +46,8 @@ class RadiobuttonGroup;
class RadiobuttonWidget;
class OptionsDialog : public Dialog {
+ typedef Common::Array<CheckboxWidget *> CheckboxWidgetList;
+
public:
OptionsDialog(const Common::String &domain, int x, int y, int w, int h);
OptionsDialog(const Common::String &domain, const Common::String &name);
@@ -74,6 +78,7 @@ protected:
// The default value is the launcher's non-scaled talkspeed value. When SCUMM uses the widget,
// it uses its own scale
void addSubtitleControls(GuiObject *boss, const Common::String &prefix, int maxSliderVal = 255);
+ void addEngineControls(GuiObject *boss, const Common::String &prefix, const ExtraGuiOptions &engineOptions);
void setGraphicSettingsState(bool enabled);
void setAudioSettingsState(bool enabled);
@@ -85,8 +90,6 @@ 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;
int _midiTabId;
@@ -101,7 +104,6 @@ private:
PopUpWidget *_gfxPopUp;
CheckboxWidget *_fullscreenCheckbox;
CheckboxWidget *_aspectCheckbox;
- CheckboxWidget *_disableDitheringCheckbox;
StaticTextWidget *_renderModePopUpDesc;
PopUpWidget *_renderModePopUp;
@@ -183,6 +185,11 @@ protected:
//Theme Options
//
Common::String _oldTheme;
+
+ //
+ // Engine-specific controls
+ //
+ CheckboxWidgetList _engineCheckboxes;
};
diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp
new file mode 100644
index 0000000000..ed18847a40
--- /dev/null
+++ b/gui/predictivedialog.cpp
@@ -0,0 +1,998 @@
+/* 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/predictivedialog.h"
+#include "gui/widget.h"
+#include "gui/widgets/edittext.h"
+#include "gui/gui-manager.h"
+
+#include "common/config-manager.h"
+#include "common/translation.h"
+#include "common/events.h"
+#include "common/debug.h"
+#include "common/system.h"
+#include "common/keyboard.h"
+#include "common/file.h"
+#include "common/savefile.h"
+
+#ifdef __DS__
+#include "backends/platform/ds/arm9/source/wordcompletion.h"
+#endif
+
+namespace GUI {
+
+enum {
+ kCancelCmd = 'CNCL',
+ kOkCmd = '__OK',
+ kBut1Cmd = 'BUT1',
+ kBut2Cmd = 'BUT2',
+ kBut3Cmd = 'BUT3',
+ kBut4Cmd = 'BUT4',
+ kBut5Cmd = 'BUT5',
+ kBut6Cmd = 'BUT6',
+ kBut7Cmd = 'BUT7',
+ kBut8Cmd = 'BUT8',
+ kBut9Cmd = 'BUT9',
+ kBut0Cmd = 'BUT0',
+ kNextCmd = 'NEXT',
+ kAddCmd = '_ADD',
+ kModeCmd = 'MODE',
+ kDelCmd = '_DEL',
+ kTestCmd = 'TEST'
+};
+
+enum {
+ kModePre = 0,
+ kModeNum = 1,
+ kModeAbc = 2
+};
+
+PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
+ new StaticTextWidget(this, "Predictive.Headline", "Enter Text");
+
+ _btns = (ButtonWidget **)calloc(1, sizeof(ButtonWidget *) * 16);
+
+ _btns[kCancelAct] = new ButtonWidget(this, "Predictive.Cancel", _("Cancel") , 0, kCancelCmd);
+ _btns[kOkAct] = new ButtonWidget(this, "Predictive.OK", _("Ok") , 0, kOkCmd);
+ _btns[kBtn1Act] = new ButtonWidget(this, "Predictive.Button1", "1 `-.&" , 0, kBut1Cmd);
+ _btns[kBtn2Act] = new ButtonWidget(this, "Predictive.Button2", "2 abc" , 0, kBut2Cmd);
+ _btns[kBtn3Act] = new ButtonWidget(this, "Predictive.Button3", "3 def" , 0, kBut3Cmd);
+ _btns[kBtn4Act] = new ButtonWidget(this, "Predictive.Button4", "4 ghi" , 0, kBut4Cmd);
+ _btns[kBtn5Act] = new ButtonWidget(this, "Predictive.Button5", "5 jkl" , 0, kBut5Cmd);
+ _btns[kBtn6Act] = new ButtonWidget(this, "Predictive.Button6", "6 mno" , 0, kBut6Cmd);
+ _btns[kBtn7Act] = new ButtonWidget(this, "Predictive.Button7", "7 pqrs" , 0, kBut7Cmd);
+ _btns[kBtn8Act] = new ButtonWidget(this, "Predictive.Button8", "8 tuv" , 0, kBut8Cmd);
+ _btns[kBtn9Act] = new ButtonWidget(this, "Predictive.Button9", "9 wxyz" , 0, kBut9Cmd);
+ _btns[kBtn0Act] = new ButtonWidget(this, "Predictive.Button0", "0" , 0, kBut0Cmd);
+ // I18N: You must leave "#" as is, only word 'next' is translatable
+ _btns[kNextAct] = new ButtonWidget(this, "Predictive.Next", _("# next") , 0, kNextCmd);
+ _btns[kAddAct] = new ButtonWidget(this, "Predictive.Add", _("add") , 0, kAddCmd);
+ _btns[kAddAct]->setEnabled(false);
+
+ #ifndef DISABLE_FANCY_THEMES
+ _btns[kDelAct] = new PicButtonWidget(this, "Predictive.Delete", _("Delete char"), kDelCmd);
+ ((PicButtonWidget *)_btns[kDelAct])->useThemeTransparency(true);
+ ((PicButtonWidget *)_btns[kDelAct])->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelbtn));
+ #endif
+ _btns[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd);
+ // I18N: Pre means 'Predictive', leave '*' as is
+ _btns[kModeAct] = new ButtonWidget(this, "Predictive.Pre", _("* Pre"), 0, kModeCmd);
+ _edittext = new EditTextWidget(this, "Predictive.Word", _search, 0, 0, 0);
+
+ _userDictHasChanged = false;
+
+ _predictiveDict.nameDict = "predictive_dictionary";
+ _predictiveDict.fnameDict = "pred.dic";
+ _predictiveDict.dictActLine = NULL;
+
+ _userDict.nameDict = "user_dictionary";
+ _userDict.fnameDict = "user.dic";
+ _userDict.dictActLine = NULL;
+
+ _unitedDict.nameDict = "";
+ _unitedDict.fnameDict = "";
+
+ _predictiveDict.dictLine = NULL;
+ _predictiveDict.dictText = NULL;
+ _predictiveDict.dictLineCount = 0;
+
+ if (!_predictiveDict.dictText) {
+ loadAllDictionary(_predictiveDict);
+ if (!_predictiveDict.dictText)
+ debug("Predictive Dialog: pred.dic not loaded");
+ }
+
+ _userDict.dictLine = NULL;
+ _userDict.dictText = NULL;
+ _userDict.dictTextSize = 0;
+ _userDict.dictLineCount = 0;
+
+ if (!_userDict.dictText) {
+ loadAllDictionary(_userDict);
+ if (!_userDict.dictText)
+ debug("Predictive Dialog: user.dic not loaded");
+ }
+
+ mergeDicts();
+
+ _unitedDict.dictActLine = NULL;
+ _unitedDict.dictText = NULL;
+
+ memset(_repeatcount, 0, sizeof(_repeatcount));
+
+ _prefix.clear();
+ _currentCode.clear();
+ _currentWord.clear();
+ _wordNumber = 0;
+ _numMatchingWords = 0;
+
+ _lastbutton = kNoAct;
+ _mode = kModePre;
+
+ _lastTime = 0;
+ _curTime = 0;
+ _lastPressBtn = kNoAct;
+
+ _memoryList[0] = _predictiveDict.dictText;
+ _memoryList[1] = _userDict.dictText;
+ _numMemory = 0;
+
+ _navigationwithkeys = false;
+}
+
+PredictiveDialog::~PredictiveDialog() {
+ for (int i = 0; i < _numMemory; i++) {
+ free(_memoryList[i]);
+ }
+ free(_userDict.dictLine);
+ free(_predictiveDict.dictLine);
+ free(_unitedDict.dictLine);
+
+ free(_btns);
+}
+
+void PredictiveDialog::saveUserDictToFile() {
+ if (_userDictHasChanged) {
+ ConfMan.registerDefault("user_dictionary", "user.dic");
+
+ Common::OutSaveFile *file = g_system->getSavefileManager()->openForSaving(ConfMan.get("user_dictionary"));
+
+ for (int i = 0; i < _userDict.dictLineCount; i++) {
+ file->writeString(_userDict.dictLine[i]);
+ file->writeString("\n");
+ }
+
+ file->finalize();
+ delete file;
+ }
+}
+
+void PredictiveDialog::handleKeyUp(Common::KeyState state) {
+ if (_currBtn != kNoAct && !_needRefresh) {
+ _btns[_currBtn]->startAnimatePressedState();
+ processBtnActive(_currBtn);
+ }
+}
+
+void PredictiveDialog::handleKeyDown(Common::KeyState state) {
+ _currBtn = kNoAct;
+ _needRefresh = false;
+
+ if (getFocusWidget() == _edittext) {
+ setFocusWidget(_btns[kAddAct]);
+ }
+
+ if (_lastbutton == kNoAct) {
+ _lastbutton = kBtn5Act;
+ }
+
+ switch (state.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ saveUserDictToFile();
+ close();
+ return;
+ case Common::KEYCODE_LEFT:
+ _navigationwithkeys = true;
+ if (_lastbutton == kBtn1Act || _lastbutton == kBtn4Act || _lastbutton == kBtn7Act)
+ _currBtn = ButtonId(_lastbutton + 2);
+ else if (_lastbutton == kDelAct)
+ _currBtn = kBtn1Act;
+ else if (_lastbutton == kModeAct)
+ _currBtn = kNextAct;
+ else if (_lastbutton == kNextAct)
+ _currBtn = kBtn0Act;
+ else if (_lastbutton == kAddAct)
+ _currBtn = kOkAct;
+ else if (_lastbutton == kCancelAct)
+ _currBtn = kAddAct;
+ else
+ _currBtn = ButtonId(_lastbutton - 1);
+
+
+ if (_mode != kModeAbc && _lastbutton == kCancelAct)
+ _currBtn = kOkAct;
+
+ _needRefresh = true;
+ break;
+ case Common::KEYCODE_RIGHT:
+ _navigationwithkeys = true;
+ if (_lastbutton == kBtn3Act || _lastbutton == kBtn6Act || _lastbutton == kBtn9Act || _lastbutton == kOkAct)
+ _currBtn = ButtonId(_lastbutton - 2);
+ else if (_lastbutton == kDelAct)
+ _currBtn = kBtn3Act;
+ else if (_lastbutton == kBtn0Act)
+ _currBtn = kNextAct;
+ else if (_lastbutton == kNextAct)
+ _currBtn = kModeAct;
+ else if (_lastbutton == kAddAct)
+ _currBtn = kCancelAct;
+ else if (_lastbutton == kOkAct)
+ _currBtn = kAddAct;
+ else
+ _currBtn = ButtonId(_lastbutton + 1);
+
+ if (_mode != kModeAbc && _lastbutton == kOkAct)
+ _currBtn = kCancelAct;
+ _needRefresh = true;
+ break;
+ case Common::KEYCODE_UP:
+ _navigationwithkeys = true;
+ if (_lastbutton <= kBtn3Act)
+ _currBtn = kDelAct;
+ else if (_lastbutton == kDelAct)
+ _currBtn = kOkAct;
+ else if (_lastbutton == kModeAct)
+ _currBtn = kBtn7Act;
+ else if (_lastbutton == kBtn0Act)
+ _currBtn = kBtn8Act;
+ else if (_lastbutton == kNextAct)
+ _currBtn = kBtn9Act;
+ else if (_lastbutton == kAddAct)
+ _currBtn = kModeAct;
+ else if (_lastbutton == kCancelAct)
+ _currBtn = kBtn0Act;
+ else if (_lastbutton == kOkAct)
+ _currBtn = kNextAct;
+ else
+ _currBtn = ButtonId(_lastbutton - 3);
+ _needRefresh = true;
+ break;
+ case Common::KEYCODE_DOWN:
+ _navigationwithkeys = true;
+ if (_lastbutton == kDelAct)
+ _currBtn = kBtn3Act;
+ else if (_lastbutton == kBtn7Act)
+ _currBtn = kModeAct;
+ else if (_lastbutton == kBtn8Act)
+ _currBtn = kBtn0Act;
+ else if (_lastbutton == kBtn9Act)
+ _currBtn = kNextAct;
+ else if (_lastbutton == kModeAct)
+ _currBtn = kAddAct;
+ else if (_lastbutton == kBtn0Act)
+ _currBtn = kCancelAct;
+ else if (_lastbutton == kNextAct)
+ _currBtn = kOkAct;
+ else if (_lastbutton == kAddAct || _lastbutton == kCancelAct || _lastbutton == kOkAct)
+ _currBtn = kDelAct;
+ else
+ _currBtn = ButtonId(_lastbutton + 3);
+
+ if (_mode != kModeAbc && _lastbutton == kModeAct)
+ _currBtn = kCancelAct;
+
+ _needRefresh = true;
+ break;
+ case Common::KEYCODE_KP_ENTER:
+ case Common::KEYCODE_RETURN:
+ if (state.flags & Common::KBD_CTRL) {
+ _currBtn = kOkAct;
+ break;
+ }
+ if (_navigationwithkeys) {
+ // when the user has utilized arrow key navigation,
+ // interpret enter as 'click' on the _currBtn button
+ _currBtn = _lastbutton;
+ _needRefresh = false;
+ } else {
+ // else it is a shortcut for 'Ok'
+ _currBtn = kOkAct;
+ }
+ break;
+ case Common::KEYCODE_KP_PLUS:
+ _currBtn = kAddAct;
+ break;
+ case Common::KEYCODE_BACKSPACE:
+ case Common::KEYCODE_KP_MINUS:
+ _currBtn = kDelAct;
+ break;
+ case Common::KEYCODE_KP_DIVIDE:
+ _currBtn = kNextAct;
+ break;
+ case Common::KEYCODE_KP_MULTIPLY:
+ _currBtn = kModeAct;
+ break;
+ case Common::KEYCODE_KP0:
+ _currBtn = kBtn0Act;
+ break;
+ case Common::KEYCODE_KP1:
+ case Common::KEYCODE_KP2:
+ case Common::KEYCODE_KP3:
+ case Common::KEYCODE_KP4:
+ case Common::KEYCODE_KP5:
+ case Common::KEYCODE_KP6:
+ case Common::KEYCODE_KP7:
+ case Common::KEYCODE_KP8:
+ case Common::KEYCODE_KP9:
+ _currBtn = ButtonId(state.keycode - Common::KEYCODE_KP1);
+ break;
+ default:
+ Dialog::handleKeyDown(state);
+ }
+
+ if (_lastbutton != _currBtn)
+ _btns[_lastbutton]->stopAnimatePressedState();
+
+ if (_currBtn != kNoAct && !_needRefresh)
+ _btns[_currBtn]->setPressedState();
+ else
+ updateHighLightedButton(_currBtn);
+}
+
+void PredictiveDialog::updateHighLightedButton(ButtonId act) {
+ if (_currBtn != kNoAct) {
+ _btns[_lastbutton]->setHighLighted(false);
+ _lastbutton = act;
+ _btns[_lastbutton]->setHighLighted(true);
+ }
+}
+
+void PredictiveDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ _currBtn = kNoAct;
+
+ _navigationwithkeys = false;
+
+ if (_lastbutton != kNoAct)
+ _btns[_lastbutton]->setHighLighted(false);
+
+ switch (cmd) {
+ case kDelCmd:
+ _currBtn = kDelAct;
+ break;
+ case kNextCmd:
+ _currBtn = kNextAct;
+ break;
+ case kAddCmd:
+ _currBtn = kAddAct;
+ break;
+ case kModeCmd:
+ _currBtn = kModeAct;
+ break;
+ case kBut1Cmd:
+ _currBtn = kBtn1Act;
+ break;
+ case kBut2Cmd:
+ _currBtn = kBtn2Act;
+ break;
+ case kBut3Cmd:
+ _currBtn = kBtn3Act;
+ break;
+ case kBut4Cmd:
+ _currBtn = kBtn4Act;
+ break;
+ case kBut5Cmd:
+ _currBtn = kBtn5Act;
+ break;
+ case kBut6Cmd:
+ _currBtn = kBtn6Act;
+ break;
+ case kBut7Cmd:
+ _currBtn = kBtn7Act;
+ break;
+ case kBut8Cmd:
+ _currBtn = kBtn8Act;
+ break;
+ case kBut9Cmd:
+ _currBtn = kBtn9Act;
+ break;
+ case kBut0Cmd:
+ _currBtn = kBtn0Act;
+ break;
+ case kCancelCmd:
+ saveUserDictToFile();
+ close();
+ return;
+ case kOkCmd:
+ _currBtn = kOkAct;
+ break;
+ default:
+ Dialog::handleCommand(sender, cmd, data);
+ }
+
+ if (_currBtn != kNoAct) {
+ processBtnActive(_currBtn);
+ }
+}
+
+void PredictiveDialog::processBtnActive(ButtonId button) {
+ uint8 x;
+ static const char *const buttonStr[] = {
+ "1", "2", "3",
+ "4", "5", "6",
+ "7", "8", "9",
+ "0"
+ };
+
+ static const char *const buttons[] = {
+ "'-.&", "abc", "def",
+ "ghi", "jkl", "mno",
+ "pqrs", "tuv", "wxyz",
+ "next", "add",
+ "<",
+ "Cancel", "OK",
+ "Pre", "(0) ", NULL
+ };
+
+ if (_mode == kModeAbc) {
+ if (button >= kBtn1Act && button <= kBtn9Act) {
+ if (!_lastTime)
+ _lastTime = g_system->getMillis();
+ if (_lastPressBtn == button) {
+ _curTime = g_system->getMillis();
+ if ((_curTime - _lastTime) < kRepeatDelay) {
+ button = kNextAct;
+ _lastTime = _curTime;
+ } else {
+ _lastTime = 0;
+ }
+ } else {
+ _lastPressBtn = button;
+ _lastTime = g_system->getMillis();
+ }
+ }
+ }
+
+ if (button >= kBtn1Act) {
+ _lastbutton = button;
+ if (button == kBtn0Act && _mode != kModeNum) { // Space
+ // bring MRU word at the top of the list when changing words
+ if (_mode == kModePre && _unitedDict.dictActLine && _numMatchingWords > 1 && _wordNumber != 0)
+ bringWordtoTop(_unitedDict.dictActLine, _wordNumber);
+
+ strncpy(_temp, _currentWord.c_str(), _currentCode.size());
+ _temp[_currentCode.size()] = 0;
+ _prefix += _temp;
+ _prefix += " ";
+ _currentCode.clear();
+ _currentWord.clear();
+ _numMatchingWords = 0;
+ memset(_repeatcount, 0, sizeof(_repeatcount));
+ _lastTime = 0;
+ _lastPressBtn = kNoAct;
+ _curTime = 0;
+ } else if (button < kNextAct || button == kDelAct || button == kBtn0Act) { // number or backspace
+ if (button == kDelAct) { // backspace
+ if (_currentCode.size()) {
+ _repeatcount[_currentCode.size() - 1] = 0;
+ _currentCode.deleteLastChar();
+ if (_currentCode.empty())
+ _currentWord.clear();
+ } else {
+ if (_prefix.size())
+ _prefix.deleteLastChar();
+ }
+ } else if (_prefix.size() + _currentCode.size() < kMaxWordLen - 1) { // don't overflow the dialog line
+ if (button == kBtn0Act) { // zero
+ _currentCode += buttonStr[9];
+ } else {
+ _currentCode += buttonStr[button];
+ }
+ }
+
+ switch (_mode) {
+ case kModeNum:
+ _currentWord = _currentCode;
+ break;
+ case kModePre:
+ if (!matchWord() && _currentCode.size()) {
+ _currentCode.deleteLastChar();
+ matchWord();
+ }
+ _numMatchingWords = countWordsInString(_unitedDict.dictActLine);
+ break;
+ case kModeAbc:
+ for (x = 0; x < _currentCode.size(); x++)
+ if (_currentCode[x] >= '1')
+ _temp[x] = buttons[_currentCode[x] - '1'][_repeatcount[x]];
+ _temp[_currentCode.size()] = 0;
+ _currentWord = _temp;
+ }
+ } else if (button == kNextAct) { // next
+ if (_mode == kModePre) {
+ if (_unitedDict.dictActLine && _numMatchingWords > 1) {
+ _wordNumber = (_wordNumber + 1) % _numMatchingWords;
+ char tmp[kMaxLineLen];
+ strncpy(tmp, _unitedDict.dictActLine, kMaxLineLen);
+ tmp[kMaxLineLen - 1] = 0;
+ char *tok = strtok(tmp, " ");
+ for (uint8 i = 0; i <= _wordNumber; i++)
+ tok = strtok(NULL, " ");
+ _currentWord = Common::String(tok, _currentCode.size());
+ }
+ } else if (_mode == kModeAbc) {
+ x = _currentCode.size();
+ if (x) {
+ if (_currentCode.lastChar() == '1' || _currentCode.lastChar() == '7' || _currentCode.lastChar() == '9')
+ _repeatcount[x - 1] = (_repeatcount[x - 1] + 1) % 4;
+ else
+ _repeatcount[x - 1] = (_repeatcount[x - 1] + 1) % 3;
+
+ if (_currentCode.lastChar() >= '1')
+ _currentWord.setChar(buttons[_currentCode[x - 1] - '1'][_repeatcount[x - 1]], x - 1);
+ }
+ }
+ } else if (button == kAddAct) { // add
+ if (_mode == kModeAbc)
+ addWordToDict();
+ else
+ debug("Predictive Dialog: button Add doesn't work in this mode");
+ } else if (button == kOkAct) { // Ok
+ // bring MRU word at the top of the list when ok'ed out of the dialog
+ if (_mode == kModePre && _unitedDict.dictActLine && _numMatchingWords > 1 && _wordNumber != 0)
+ bringWordtoTop(_unitedDict.dictActLine, _wordNumber);
+ } else if (button == kModeAct) { // Mode
+ _mode++;
+ _btns[kAddAct]->setEnabled(false);
+ if (_mode > kModeAbc) {
+ _mode = kModePre;
+ // I18N: Pre means 'Predictive', leave '*' as is
+ _btns[kModeAct]->setLabel("* Pre");
+ } else if (_mode == kModeNum) {
+ // I18N: 'Num' means Numbers
+ _btns[kModeAct]->setLabel("* Num");
+ } else {
+ // I18N: 'Abc' means Latin alphabet input
+ _btns[kModeAct]->setLabel("* Abc");
+ _btns[kAddAct]->setEnabled(true);
+ }
+
+ // truncate current input at mode change
+ strncpy(_temp, _currentWord.c_str(), _currentCode.size());
+ _temp[_currentCode.size()] = 0;
+ _prefix += _temp;
+ _currentCode.clear();
+ _currentWord.clear();
+ memset(_repeatcount, 0, sizeof(_repeatcount));
+
+ _lastTime = 0;
+ _lastPressBtn = kNoAct;
+ _curTime = 0;
+ }
+ }
+
+ pressEditText();
+
+ if (button == kOkAct)
+ close();
+
+ if (button == kCancelAct) {
+ saveUserDictToFile();
+ close();
+ }
+}
+
+void PredictiveDialog::handleTickle() {
+ if (_lastTime) {
+ if ((_curTime - _lastTime) > kRepeatDelay) {
+ _lastTime = 0;
+ }
+ }
+
+ if (getTickleWidget()) {
+ getTickleWidget()->handleTickle();
+ }
+}
+
+void PredictiveDialog::mergeDicts() {
+ _unitedDict.dictLineCount = _predictiveDict.dictLineCount + _userDict.dictLineCount;
+ _unitedDict.dictLine = (char **)calloc(1, sizeof(char *) * _unitedDict.dictLineCount);
+
+ if (!_unitedDict.dictLine) {
+ debug("Predictive Dialog: cannot allocate memory for united dic");
+ return;
+ }
+
+ int lenUserDictCode, lenPredictiveDictCode, lenCode;
+ int i, j, k;
+ i = j = k = 0;
+
+ while ((i < _userDict.dictLineCount) && (j < _predictiveDict.dictLineCount)) {
+ lenUserDictCode = strchr(_userDict.dictLine[i], ' ') - _userDict.dictLine[i];
+ lenPredictiveDictCode = strchr(_predictiveDict.dictLine[j], ' ') - _predictiveDict.dictLine[j];
+ lenCode = (lenUserDictCode >= lenPredictiveDictCode) ? lenUserDictCode : lenPredictiveDictCode;
+ if (strncmp(_userDict.dictLine[i], _predictiveDict.dictLine[j], lenCode) >= 0) {
+ _unitedDict.dictLine[k++] = _predictiveDict.dictLine[j++];
+ } else {
+ _unitedDict.dictLine[k++] = _userDict.dictLine[i++];
+ }
+ }
+
+ while (i < _userDict.dictLineCount) {
+ _unitedDict.dictLine[k++] = _userDict.dictLine[i++];
+ }
+
+ while (j < _predictiveDict.dictLineCount) {
+ _unitedDict.dictLine[k++] = _predictiveDict.dictLine[j++];
+ }
+}
+
+uint8 PredictiveDialog::countWordsInString(const char *const str) {
+ // Count the number of (space separated) words in the given string.
+ const char *ptr;
+
+ if (!str)
+ return 0;
+
+ ptr = strchr(str, ' ');
+ if (!ptr) {
+ debug("Predictive Dialog: Invalid dictionary line");
+ return 0;
+ }
+
+ uint8 num = 1;
+ ptr++;
+ while ((ptr = strchr(ptr, ' '))) {
+ ptr++;
+ num++;
+ }
+ return num;
+}
+
+void PredictiveDialog::bringWordtoTop(char *str, int wordnum) {
+ // This function reorders the words on the given pred.dic line
+ // by moving the word at position 'wordnum' to the front (that is, right behind
+ // right behind the numerical code word at the start of the line).
+ Common::Array<Common::String> words;
+ char buf[kMaxLineLen];
+
+ if (!str)
+ return;
+ strncpy(buf, str, kMaxLineLen);
+ buf[kMaxLineLen - 1] = 0;
+ char *word = strtok(buf, " ");
+ if (!word) {
+ debug("Predictive Dialog: Invalid dictionary line");
+ return;
+ }
+
+ words.push_back(word);
+ while ((word = strtok(NULL, " ")) != NULL)
+ words.push_back(word);
+ words.insert_at(1, words.remove_at(wordnum + 1));
+
+ Common::String tmp;
+ for (uint8 i = 0; i < words.size(); i++)
+ tmp += words[i] + " ";
+ tmp.deleteLastChar();
+ memcpy(str, tmp.c_str(), strlen(str));
+}
+
+int PredictiveDialog::binarySearch(const char *const *const dictLine, const Common::String &code, const int dictLineCount) {
+ int hi = dictLineCount - 1;
+ int lo = 0;
+ int line = 0;
+ while (lo <= hi) {
+ line = (lo + hi) / 2;
+ int cmpVal = strncmp(dictLine[line], code.c_str(), code.size());
+ if (cmpVal > 0)
+ hi = line - 1;
+ else if (cmpVal < 0)
+ lo = line + 1;
+ else {
+ break;
+ }
+ }
+
+ if (hi < lo) {
+ return -(lo + 1);
+ } else {
+ return line;
+ }
+}
+
+bool PredictiveDialog::matchWord() {
+ // If no text has been entered, then there is no match.
+ if (_currentCode.empty())
+ return false;
+
+ // If the currently entered text is too long, it cannot match anything.
+ if (_currentCode.size() > kMaxWordLen)
+ return false;
+
+ // The entries in the dictionary consist of a code, a space, and then
+ // a space-separated list of words matching this code.
+ // To ex_currBtnly match a code, we therefore match the code plus the trailing
+ // space in the dictionary.
+ Common::String code = _currentCode + " ";
+
+ int line = binarySearch(_unitedDict.dictLine, code, _unitedDict.dictLineCount);
+ if (line < 0) {
+ line = -(line + 1);
+ _unitedDict.dictActLine = NULL;
+ } else {
+ _unitedDict.dictActLine = _unitedDict.dictLine[line];
+ }
+
+ _currentWord.clear();
+ _wordNumber = 0;
+ if (0 == strncmp(_unitedDict.dictLine[line], _currentCode.c_str(), _currentCode.size())) {
+ char tmp[kMaxLineLen];
+ strncpy(tmp, _unitedDict.dictLine[line], kMaxLineLen);
+ tmp[kMaxLineLen - 1] = 0;
+ char *tok = strtok(tmp, " ");
+ tok = strtok(NULL, " ");
+ _currentWord = Common::String(tok, _currentCode.size());
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool PredictiveDialog::searchWord(const char *const where, const Common::String &whatCode) {
+ const char *ptr = where;
+ ptr += whatCode.size();
+
+ const char *newPtr;
+ bool is = false;
+ while ((newPtr = strchr(ptr, ' '))) {
+ if (0 == strncmp(ptr, _currentWord.c_str(), newPtr - ptr)) {
+ is = true;
+ break;
+ }
+ ptr = newPtr + 1;
+ }
+ if (!is) {
+ if (0 == strcmp(ptr, _currentWord.c_str())) {
+ is = true;
+ }
+ }
+ return is;
+}
+
+void PredictiveDialog::addWord(Dict &dict, const Common::String &word, const Common::String &code) {
+ char *newLine;
+ Common::String tmpCode = code + ' ';
+ int line = binarySearch(dict.dictLine, tmpCode, dict.dictLineCount);
+ if (line >= 0) {
+ if (searchWord(dict.dictLine[line], tmpCode)) {
+ // if we found code and word, we should not insert/expands any word
+ return;
+ } else {
+ // if we found the code, but did not find a word, we must
+ // EXPANDS the currnent line with new word
+ int oldLineSize = strlen(dict.dictLine[line]);
+ int newLineSize = oldLineSize + word.size() + 1;
+
+ newLine = (char *)malloc(newLineSize + 1);
+
+ char *ptr = newLine;
+ strncpy(ptr, dict.dictLine[line], oldLineSize);
+ ptr += oldLineSize;
+ Common::String tmp = ' ' + word + '\0';
+ strncpy(ptr, tmp.c_str(), tmp.size());
+
+ dict.dictLine[line] = newLine;
+ _memoryList[_numMemory++] = newLine;
+
+ if (dict.nameDict == "user_dictionary")
+ _userDictHasChanged = true;
+
+ return;
+ }
+ } else { // if we didn't find the code, we need to INSERT new line with code and word
+ if (dict.nameDict == "user_dictionary") {
+ // if we must INSERT new line(code and word) to user_dictionary, we need to
+ // check if there is a line that we want to INSERT in predictive dictionay
+ int predictLine = binarySearch(_predictiveDict.dictLine, tmpCode, _predictiveDict.dictLineCount);
+ if (predictLine >= 0) {
+ if (searchWord(_predictiveDict.dictLine[predictLine], tmpCode)) {
+ // if code and word is in predictive dictionary, we need to copy
+ // this line to user dictionary
+ int len = (predictLine == _predictiveDict.dictLineCount - 1) ? &_predictiveDict.dictText[_predictiveDict.dictTextSize] - _predictiveDict.dictLine[predictLine] :
+ _predictiveDict.dictLine[predictLine + 1] - _predictiveDict.dictLine[predictLine];
+ newLine = (char *)malloc(len);
+ strncpy(newLine, _predictiveDict.dictLine[predictLine], len);
+ } else {
+ // if there is no word in predictive dictionary, we need to copy to
+ // user dictionary mathed line + new word.
+ int len = (predictLine == _predictiveDict.dictLineCount - 1) ? &_predictiveDict.dictText[_predictiveDict.dictTextSize] - _predictiveDict.dictLine[predictLine] :
+ _predictiveDict.dictLine[predictLine + 1] - _predictiveDict.dictLine[predictLine];
+ newLine = (char *)malloc(len + word.size() + 1);
+ char *ptr = newLine;
+ strncpy(ptr, _predictiveDict.dictLine[predictLine], len);
+ ptr[len - 1] = ' ';
+ ptr += len;
+ strncpy(ptr, word.c_str(), word.size());
+ ptr[len + word.size()] = '\0';
+ }
+ } else {
+ // if we didnt find line in predictive dialog, we should copy to user dictionary
+ // code + word
+ Common::String tmp;
+ tmp = tmpCode + word + '\0';
+ newLine = (char *)malloc(tmp.size());
+ strncpy(newLine, tmp.c_str(), tmp.size());
+ }
+ } else {
+ // if want to insert line to different from user dictionary, we should copy to this
+ // dictionary code + word
+ Common::String tmp;
+ tmp = tmpCode + word + '\0';
+ newLine = (char *)malloc(tmp.size());
+ strncpy(newLine, tmp.c_str(), tmp.size());
+ }
+ }
+
+ // start from here are INSERTING new line to dictionaty ( dict )
+ char **newDictLine = (char **)calloc(1, sizeof(char *) * (dict.dictLineCount + 1));
+ if (!newDictLine) {
+ warning("Predictive Dialog: cannot allocate memory for index buffer");
+ return;
+ }
+ newDictLine[dict.dictLineCount] = '\0';
+
+ int k = 0;
+ bool inserted = false;
+ for (int i = 0; i < dict.dictLineCount; i++) {
+ uint lenPredictiveDictCode = strchr(dict.dictLine[i], ' ') - dict.dictLine[i];
+ uint lenCode = (lenPredictiveDictCode >= (code.size() - 1)) ? lenPredictiveDictCode : code.size() - 1;
+ if ((strncmp(dict.dictLine[i], code.c_str(), lenCode) > 0) && !inserted) {
+ newDictLine[k++] = newLine;
+ inserted = true;
+ }
+ if (k != (dict.dictLineCount + 1)) {
+ newDictLine[k++] = dict.dictLine[i];
+ }
+ }
+ if (!inserted)
+ newDictLine[k] = newLine;
+
+ _memoryList[_numMemory++] = newLine;
+
+ free(dict.dictLine);
+ dict.dictLineCount += 1;
+ dict.dictLine = (char **)calloc(1, sizeof(char *) * dict.dictLineCount);
+ if (!dict.dictLine) {
+ warning("Predictive Dialog: cannot allocate memory for index buffer");
+ free(newDictLine);
+ return;
+ }
+
+ for (int i = 0; i < dict.dictLineCount; i++) {
+ dict.dictLine[i] = newDictLine[i];
+ }
+
+ if (dict.nameDict == "user_dictionary")
+ _userDictHasChanged = true;
+
+ free(newDictLine);
+}
+
+void PredictiveDialog::addWordToDict() {
+ if (_numMemory < kMaxWord) {
+ addWord(_unitedDict, _currentWord, _currentCode);
+ addWord(_userDict, _currentWord, _currentCode);
+ } else {
+ warning("Predictive Dialog: You cannot add word to user dictionary...");
+ }
+}
+
+void PredictiveDialog::loadDictionary(Common::SeekableReadStream *in, Dict &dict) {
+ int lines = 0;
+
+ uint32 time1 = g_system->getMillis();
+
+ dict.dictTextSize = in->size();
+ dict.dictText = (char *)malloc(dict.dictTextSize + 1);
+
+ if (!dict.dictText) {
+ warning("Predictive Dialog: Not enough memory to load the file user.dic");
+ return;
+ }
+
+ in->read(dict.dictText, dict.dictTextSize);
+ dict.dictText[dict.dictTextSize] = 0;
+ uint32 time2 = g_system->getMillis();
+ debug("Predictive Dialog: Time to read %s: %d bytes, %d ms", ConfMan.get(dict.nameDict).c_str(), dict.dictTextSize, time2 - time1);
+ delete in;
+
+ char *ptr = dict.dictText;
+ lines = 1;
+ while ((ptr = strchr(ptr, '\n'))) {
+ lines++;
+ ptr++;
+ }
+
+ dict.dictLine = (char **)calloc(1, sizeof(char *) * lines);
+ if (dict.dictLine == NULL) {
+ warning("Predictive Dialog: Cannot allocate memory for line index buffer");
+ return;
+ }
+ dict.dictLine[0] = dict.dictText;
+ ptr = dict.dictText;
+ int i = 1;
+ while ((ptr = strchr(ptr, '\n'))) {
+ *ptr = 0;
+ ptr++;
+#ifdef __DS__
+ // Pass the line on to the DS word list
+ DS::addAutoCompleteLine(dict.dictLine[i - 1]);
+#endif
+ dict.dictLine[i++] = ptr;
+ }
+ if (dict.dictLine[lines - 1][0] == 0)
+ lines--;
+
+ dict.dictLineCount = lines;
+ debug("Predictive Dialog: Loaded %d lines", dict.dictLineCount);
+
+ // FIXME: We use binary search on _predictiveDict.dictLine, yet we make no at_tempt
+ // to ever sort this array (except for the DS port). That seems risky, doesn't it?
+
+#ifdef __DS__
+ // Sort the DS word completion list, to allow for a binary chop later (in the ds backend)
+ DS::sortAutoCompleteWordList();
+#endif
+
+ uint32 time3 = g_system->getMillis();
+ debug("Predictive Dialog: Time to parse %s: %d, total: %d", ConfMan.get(dict.nameDict).c_str(), time3 - time2, time3 - time1);
+}
+
+void PredictiveDialog::loadAllDictionary(Dict &dict) {
+ ConfMan.registerDefault(dict.nameDict, dict.fnameDict);
+
+ if (dict.nameDict == "predictive_dictionary") {
+ Common::File *inFile = new Common::File();
+ if (!inFile->open(ConfMan.get(dict.nameDict))) {
+ warning("Predictive Dialog: cannot read file: %s", dict.fnameDict.c_str());
+ return;
+ }
+ loadDictionary(inFile, dict);
+ } else {
+ Common::InSaveFile *inFile = g_system->getSavefileManager()->openForLoading(ConfMan.get(dict.nameDict));
+ if (!inFile) {
+ warning("Predictive Dialog: cannot read file: %s", dict.fnameDict.c_str());
+ return;
+ }
+ loadDictionary(inFile, dict);
+ }
+}
+
+void PredictiveDialog::pressEditText() {
+ Common::strlcpy(_predictiveResult, _prefix.c_str(), sizeof(_predictiveResult));
+ Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult));
+ _edittext->setEditString(_predictiveResult);
+ //_edittext->setCaretPos(_prefix.size() + _currentWord.size());
+ _edittext->draw();
+}
+
+} // namespace GUI
diff --git a/gui/predictivedialog.h b/gui/predictivedialog.h
new file mode 100644
index 0000000000..0e3d2967c0
--- /dev/null
+++ b/gui/predictivedialog.h
@@ -0,0 +1,143 @@
+/* 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 GLOBAL_DIALOGS_H
+#define GLOBAL_DIALOGS_H
+
+#include "gui/dialog.h"
+#include "common/str.h"
+#include "common/stream.h"
+
+namespace GUI {
+
+class EditTextWidget;
+class ButtonWidget;
+class PicButtonWidget;
+
+enum ButtonId {
+ kBtn1Act = 0,
+ kBtn2Act = 1,
+ kBtn3Act = 2,
+ kBtn4Act = 3,
+ kBtn5Act = 4,
+ kBtn6Act = 5,
+ kBtn7Act = 6,
+ kBtn8Act = 7,
+ kBtn9Act = 8,
+ kNextAct = 9,
+ kAddAct = 10,
+ kDelAct = 11,
+ kCancelAct = 12,
+ kOkAct = 13,
+ kModeAct = 14,
+ kBtn0Act = 15,
+ kNoAct = -1
+};
+
+enum {
+ kRepeatDelay = 500
+};
+
+enum {
+ kMaxLineLen = 80,
+ kMaxWordLen = 24,
+ kMaxWord = 50
+};
+
+class PredictiveDialog : public GUI::Dialog {
+public:
+ PredictiveDialog();
+ ~PredictiveDialog();
+
+ virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
+ virtual void handleKeyUp(Common::KeyState state);
+ virtual void handleKeyDown(Common::KeyState state);
+ virtual void handleTickle();
+
+ const char *getResult() const { return _predictiveResult; }
+private:
+ struct Dict {
+ char **dictLine;
+ char *dictText;
+ char *dictActLine; // using only for united dict...
+ int32 dictLineCount;
+ int32 dictTextSize;
+ Common::String nameDict;
+ Common::String fnameDict;
+ };
+
+ uint8 countWordsInString(const char *const str);
+ void bringWordtoTop(char *str, int wordnum);
+ void loadDictionary(Common::SeekableReadStream *in, Dict &dict);
+ void loadAllDictionary(Dict &dict);
+ void addWordToDict();
+ void addWord(Dict &dict, const Common::String &word, const Common::String &code);
+ bool searchWord(const char *const where, const Common::String &whatCode);
+ int binarySearch(const char *const *const dictLine, const Common::String &code, const int dictLineCount);
+ bool matchWord();
+ void processBtnActive(ButtonId active);
+ void pressEditText();
+
+ void saveUserDictToFile();
+
+ void mergeDicts();
+
+ void updateHighLightedButton(ButtonId active);
+private:
+ Dict _unitedDict;
+ Dict _predictiveDict;
+ Dict _userDict;
+
+ int _mode;
+ ButtonId _lastbutton;
+
+ bool _userDictHasChanged;
+
+ int _wordNumber;
+ uint8 _numMatchingWords;
+ char _predictiveResult[40];
+
+ Common::String _currentCode;
+ Common::String _currentWord;
+ Common::String _prefix;
+
+ uint32 _curTime, _lastTime;
+ ButtonId _lastPressBtn;
+ ButtonId _currBtn;
+
+ char _temp[kMaxWordLen + 1];
+ int _repeatcount[kMaxWordLen];
+
+ char *_memoryList[kMaxWord];
+ int _numMemory;
+
+ Common::String _search;
+
+ bool _navigationwithkeys;
+ bool _needRefresh;
+private:
+ EditTextWidget *_edittext;
+ ButtonWidget **_btns;
+};
+
+} // namespace GUI
+
+#endif
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
new file mode 100644
index 0000000000..df8dda7470
--- /dev/null
+++ b/gui/saveload-dialog.cpp
@@ -0,0 +1,946 @@
+/* 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/saveload-dialog.h"
+#include "common/translation.h"
+#include "common/config-manager.h"
+
+#include "gui/message.h"
+#include "gui/gui-manager.h"
+#include "gui/ThemeEval.h"
+#include "gui/widgets/edittext.h"
+
+#include "graphics/scaler.h"
+
+namespace GUI {
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) {
+ const Common::String &userConfig = ConfMan.get("gui_saveload_chooser", Common::ConfigManager::kApplicationDomain);
+ if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400
+ && metaEngine.hasFeature(MetaEngine::kSavesSupportMetaInfo)
+ && metaEngine.hasFeature(MetaEngine::kSavesSupportThumbnail)
+ && userConfig.equalsIgnoreCase("grid")) {
+ // In case we are 640x400 or higher, this dialog is not in save mode,
+ // the user requested the grid dialog and the engines supports it we
+ // try to set it up.
+ return kSaveLoadDialogGrid;
+ } else {
+ // In all other cases we want to use the list dialog.
+ return kSaveLoadDialogList;
+ }
+}
+
+enum {
+ kListSwitchCmd = 'LIST',
+ kGridSwitchCmd = 'GRID'
+};
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+SaveLoadChooserDialog::SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode)
+ : Dialog(dialogName), _metaEngine(0), _delSupport(false), _metaInfoSupport(false),
+ _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode)
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ , _listButton(0), _gridButton(0)
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+ {
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ addChooserButtons();
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+}
+
+SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode)
+ : Dialog(x, y, w, h), _metaEngine(0), _delSupport(false), _metaInfoSupport(false),
+ _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode)
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ , _listButton(0), _gridButton(0)
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+ {
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ addChooserButtons();
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+}
+
+void SaveLoadChooserDialog::open() {
+ Dialog::open();
+
+ // So that quitting ScummVM will not cause the dialog result to say a
+ // savegame was selected.
+ setResult(-1);
+}
+
+int SaveLoadChooserDialog::run(const Common::String &target, const MetaEngine *metaEngine) {
+ _metaEngine = metaEngine;
+ _target = target;
+ _delSupport = _metaEngine->hasFeature(MetaEngine::kSupportsDeleteSave);
+ _metaInfoSupport = _metaEngine->hasFeature(MetaEngine::kSavesSupportMetaInfo);
+ _thumbnailSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportThumbnail);
+ _saveDateSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportCreationDate);
+ _playTimeSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportPlayTime);
+
+ return runIntern();
+}
+
+void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ switch (cmd) {
+ case kListSwitchCmd:
+ setResult(kSwitchSaveLoadDialog);
+ // We save the requested dialog type here to avoid the setting to be
+ // overwritten when our reflowLayout logic selects a different dialog
+ // type.
+ ConfMan.set("gui_saveload_chooser", "list", Common::ConfigManager::kApplicationDomain);
+ close();
+ break;
+
+ case kGridSwitchCmd:
+ setResult(kSwitchSaveLoadDialog);
+ // See above.
+ ConfMan.set("gui_saveload_chooser", "grid", Common::ConfigManager::kApplicationDomain);
+ close();
+ break;
+
+ default:
+ break;
+ }
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+ return Dialog::handleCommand(sender, cmd, data);
+}
+
+void SaveLoadChooserDialog::reflowLayout() {
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ addChooserButtons();
+
+ const SaveLoadChooserType currentType = getType();
+ const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(*_metaEngine);
+
+ // Change the dialog type if there is any need for it.
+ if (requestedType != currentType) {
+ setResult(kSwitchSaveLoadDialog);
+ close();
+ }
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+ Dialog::reflowLayout();
+}
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+void SaveLoadChooserDialog::addChooserButtons() {
+ if (_listButton) {
+ removeWidget(_listButton);
+ delete _listButton;
+ }
+
+ if (_gridButton) {
+ removeWidget(_gridButton);
+ delete _gridButton;
+ }
+
+ _listButton = createSwitchButton("SaveLoadChooser.ListSwitch", "L", _("List view"), ThemeEngine::kImageList, kListSwitchCmd);
+ _gridButton = createSwitchButton("SaveLoadChooser.GridSwitch", "G", _("Grid view"), ThemeEngine::kImageGrid, kGridSwitchCmd);
+ if (!_metaInfoSupport || !_thumbnailSupport || !(g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400)) {
+ _gridButton->setEnabled(false);
+ _listButton->setEnabled(false);
+ }
+}
+
+ButtonWidget *SaveLoadChooserDialog::createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd) {
+ ButtonWidget *button;
+
+#ifndef DISABLE_FANCY_THEMES
+ if (g_gui.xmlEval()->getVar("Globals.ShowChooserPics") == 1 && g_gui.theme()->supportsImages()) {
+ button = new PicButtonWidget(this, name, tooltip, cmd);
+ ((PicButtonWidget *)button)->useThemeTransparency(true);
+ ((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(image));
+ } else
+#endif
+ button = new ButtonWidget(this, name, desc, tooltip, cmd);
+
+ return button;
+}
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+// SaveLoadChooserSimple implementation
+
+enum {
+ kChooseCmd = 'CHOS',
+ kDelCmd = 'DEL '
+};
+
+SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode)
+ : SaveLoadChooserDialog("SaveLoadChooser", saveMode), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) {
+ _backgroundType = ThemeEngine::kDialogBackgroundSpecial;
+
+ new StaticTextWidget(this, "SaveLoadChooser.Title", title);
+
+ // Add choice list
+ _list = new ListWidget(this, "SaveLoadChooser.List");
+ _list->setNumberingMode(kListNumberingZero);
+ _list->setEditable(saveMode);
+
+ _gfxWidget = new GraphicsWidget(this, 0, 0, 10, 10);
+
+ _date = new StaticTextWidget(this, 0, 0, 10, 10, _("No date saved"), Graphics::kTextAlignCenter);
+ _time = new StaticTextWidget(this, 0, 0, 10, 10, _("No time saved"), Graphics::kTextAlignCenter);
+ _playtime = new StaticTextWidget(this, 0, 0, 10, 10, _("No playtime saved"), Graphics::kTextAlignCenter);
+
+ // Buttons
+ new ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), 0, kCloseCmd);
+ _chooseButton = new ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, 0, kChooseCmd);
+ _chooseButton->setEnabled(false);
+
+ _deleteButton = new ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), 0, kDelCmd);
+ _deleteButton->setEnabled(false);
+
+ _delSupport = _metaInfoSupport = _thumbnailSupport = false;
+
+ _container = new ContainerWidget(this, 0, 0, 10, 10);
+// _container->setHints(THEME_HINT_USE_SHADOW);
+}
+
+int SaveLoadChooserSimple::runIntern() {
+ if (_gfxWidget)
+ _gfxWidget->setGfx(0);
+
+ _resultString.clear();
+ reflowLayout();
+ updateSaveList();
+
+ return Dialog::runModal();
+}
+
+const Common::String &SaveLoadChooserSimple::getResultString() const {
+ int selItem = _list->getSelected();
+ return (selItem >= 0) ? _list->getSelectedString() : _resultString;
+}
+
+void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ int selItem = _list->getSelected();
+
+ switch (cmd) {
+ case kListItemActivatedCmd:
+ case kListItemDoubleClickedCmd:
+ if (selItem >= 0 && _chooseButton->isEnabled()) {
+ if (_list->isEditable() || !_list->getSelectedString().empty()) {
+ _list->endEditMode();
+ if (!_saveList.empty()) {
+ setResult(_saveList[selItem].getSaveSlot());
+ _resultString = _list->getSelectedString();
+ }
+ close();
+ }
+ }
+ break;
+ case kChooseCmd:
+ _list->endEditMode();
+ if (!_saveList.empty()) {
+ setResult(_saveList[selItem].getSaveSlot());
+ _resultString = _list->getSelectedString();
+ }
+ close();
+ break;
+ case kListSelectionChangedCmd:
+ updateSelection(true);
+ break;
+ case kDelCmd:
+ if (selItem >= 0 && _delSupport) {
+ MessageDialog alert(_("Do you really want to delete this savegame?"),
+ _("Delete"), _("Cancel"));
+ if (alert.runModal() == kMessageOK) {
+ _metaEngine->removeSaveState(_target.c_str(), _saveList[selItem].getSaveSlot());
+
+ setResult(-1);
+ _list->setSelected(-1);
+
+ updateSaveList();
+ updateSelection(true);
+ }
+ }
+ break;
+ case kCloseCmd:
+ setResult(-1);
+ default:
+ SaveLoadChooserDialog::handleCommand(sender, cmd, data);
+ }
+}
+
+void SaveLoadChooserSimple::reflowLayout() {
+ if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) {
+ int16 x, y;
+ uint16 w, h;
+
+ if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h))
+ error("Error when loading position data for Save/Load Thumbnails");
+
+ int thumbW = kThumbnailWidth;
+ int thumbH = kThumbnailHeight2;
+ int thumbX = x + (w >> 1) - (thumbW >> 1);
+ int thumbY = y + kLineHeight;
+
+ int textLines = 0;
+ if (!_saveDateSupport)
+ textLines++;
+ if (!_playTimeSupport)
+ textLines++;
+
+ _container->resize(x, y, w, h - (kLineHeight * textLines));
+ _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH);
+
+ int height = thumbY + thumbH + kLineHeight;
+
+ if (_saveDateSupport) {
+ _date->resize(thumbX, height, kThumbnailWidth, kLineHeight);
+ height += kLineHeight;
+ _time->resize(thumbX, height, kThumbnailWidth, kLineHeight);
+ height += kLineHeight;
+ }
+
+ if (_playTimeSupport)
+ _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight);
+
+ _container->setVisible(true);
+ _gfxWidget->setVisible(true);
+
+ _date->setVisible(_saveDateSupport);
+ _time->setVisible(_saveDateSupport);
+
+ _playtime->setVisible(_playTimeSupport);
+
+ updateSelection(false);
+ } else {
+ _container->setVisible(false);
+ _gfxWidget->setVisible(false);
+ _date->setVisible(false);
+ _time->setVisible(false);
+ _playtime->setVisible(false);
+ }
+
+ SaveLoadChooserDialog::reflowLayout();
+}
+
+void SaveLoadChooserSimple::updateSelection(bool redraw) {
+ int selItem = _list->getSelected();
+
+ bool isDeletable = _delSupport;
+ bool isWriteProtected = false;
+ bool startEditMode = _list->isEditable();
+
+ // We used to support letting the themes specify the fill color with our
+ // initial theme based GUI. But this support was dropped.
+ _gfxWidget->setGfx(-1, -1, 0, 0, 0);
+ _date->setLabel(_("No date saved"));
+ _time->setLabel(_("No time saved"));
+ _playtime->setLabel(_("No playtime saved"));
+
+ if (selItem >= 0 && _metaInfoSupport) {
+ SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), _saveList[selItem].getSaveSlot());
+
+ isDeletable = desc.getDeletableFlag() && _delSupport;
+ isWriteProtected = desc.getWriteProtectedFlag();
+
+ // Don't allow the user to change the description of write protected games
+ if (isWriteProtected)
+ startEditMode = false;
+
+ if (_thumbnailSupport) {
+ const Graphics::Surface *thumb = desc.getThumbnail();
+ if (thumb) {
+ _gfxWidget->setGfx(thumb);
+ _gfxWidget->useAlpha(256);
+ }
+ }
+
+ if (_saveDateSupport) {
+ const Common::String &saveDate = desc.getSaveDate();
+ if (!saveDate.empty())
+ _date->setLabel(_("Date: ") + saveDate);
+
+ const Common::String &saveTime = desc.getSaveTime();
+ if (!saveTime.empty())
+ _time->setLabel(_("Time: ") + saveTime);
+ }
+
+ if (_playTimeSupport) {
+ const Common::String &playTime = desc.getPlayTime();
+ if (!playTime.empty())
+ _playtime->setLabel(_("Playtime: ") + playTime);
+ }
+ }
+
+
+ if (_list->isEditable()) {
+ // Disable the save button if nothing is selected, or if the selected
+ // game is write protected
+ _chooseButton->setEnabled(selItem >= 0 && !isWriteProtected);
+
+ if (startEditMode) {
+ _list->startEditMode();
+
+ if (_chooseButton->isEnabled() && _list->getSelectedString() == _("Untitled savestate") &&
+ _list->getSelectionColor() == ThemeEngine::kFontColorAlternate) {
+ _list->setEditString("");
+ _list->setEditColor(ThemeEngine::kFontColorNormal);
+ }
+ }
+ } else {
+ // Disable the load button if nothing is selected, or if an empty
+ // list item is selected.
+ _chooseButton->setEnabled(selItem >= 0 && !_list->getSelectedString().empty());
+ }
+
+ // Delete will always be disabled if the engine doesn't support it.
+ _deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty()));
+
+ if (redraw) {
+ _gfxWidget->draw();
+ _date->draw();
+ _time->draw();
+ _playtime->draw();
+ _chooseButton->draw();
+ _deleteButton->draw();
+
+ draw();
+ }
+}
+
+void SaveLoadChooserSimple::open() {
+ SaveLoadChooserDialog::open();
+
+ // Scroll the list to the last used entry.
+ _list->scrollTo(ConfMan.getInt("gui_saveload_last_pos"));
+}
+
+void SaveLoadChooserSimple::close() {
+ // Save the current scroll position/used entry.
+ const int result = getResult();
+ if (result >= 0) {
+ ConfMan.setInt("gui_saveload_last_pos", result);
+ } else {
+ // Use the current scroll position here.
+ // TODO: This means we canceled the dialog (or switch to the grid). Do
+ // we want to save this position here? Does the user want that?
+ // TODO: Do we want to save the current scroll position or the
+ // currently selected item here? The scroll position is what the user
+ // currently sees and seems to make more sense.
+ ConfMan.setInt("gui_saveload_last_pos", _list->getCurrentScrollPos());
+ }
+
+ _metaEngine = 0;
+ _target.clear();
+ _saveList.clear();
+ _list->setList(StringArray());
+
+ SaveLoadChooserDialog::close();
+}
+
+void SaveLoadChooserSimple::updateSaveList() {
+ _saveList = _metaEngine->listSaves(_target.c_str());
+
+ int curSlot = 0;
+ int saveSlot = 0;
+ StringArray saveNames;
+ ListWidget::ColorList colors;
+ for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
+ // Handle gaps in the list of save games
+ saveSlot = x->getSaveSlot();
+ if (curSlot < saveSlot) {
+ while (curSlot < saveSlot) {
+ SaveStateDescriptor dummySave(curSlot, "");
+ _saveList.insert_at(curSlot, dummySave);
+ saveNames.push_back(dummySave.getDescription());
+ colors.push_back(ThemeEngine::kFontColorNormal);
+ curSlot++;
+ }
+
+ // Sync the save list iterator
+ for (x = _saveList.begin(); x != _saveList.end(); ++x) {
+ if (x->getSaveSlot() == saveSlot)
+ break;
+ }
+ }
+
+ // Show "Untitled savestate" for empty/whitespace savegame descriptions
+ Common::String description = x->getDescription();
+ Common::String trimmedDescription = description;
+ trimmedDescription.trim();
+ if (trimmedDescription.empty()) {
+ description = _("Untitled savestate");
+ colors.push_back(ThemeEngine::kFontColorAlternate);
+ } else {
+ colors.push_back(ThemeEngine::kFontColorNormal);
+ }
+
+ saveNames.push_back(description);
+ curSlot++;
+ }
+
+ // Fill the rest of the save slots with empty saves
+
+ int maximumSaveSlots = _metaEngine->getMaximumSaveSlot();
+
+#ifdef __DS__
+ // Low memory on the DS means too many save slots are impractical, so limit
+ // the maximum here.
+ if (maximumSaveSlots > 99) {
+ maximumSaveSlots = 99;
+ }
+#endif
+
+ Common::String emptyDesc;
+ for (int i = curSlot; i <= maximumSaveSlots; i++) {
+ saveNames.push_back(emptyDesc);
+ SaveStateDescriptor dummySave(i, "");
+ _saveList.push_back(dummySave);
+ colors.push_back(ThemeEngine::kFontColorNormal);
+ }
+
+ _list->setList(saveNames, &colors);
+}
+
+// SaveLoadChooserGrid implementation
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+
+enum {
+ kNextCmd = 'NEXT',
+ kPrevCmd = 'PREV',
+ kNewSaveCmd = 'SAVE'
+};
+
+SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveMode)
+ : SaveLoadChooserDialog("SaveLoadChooser", saveMode), _lines(0), _columns(0), _entriesPerPage(0),
+ _curPage(0), _newSaveContainer(0), _nextFreeSaveSlot(0), _buttons() {
+ _backgroundType = ThemeEngine::kDialogBackgroundSpecial;
+
+ new StaticTextWidget(this, "SaveLoadChooser.Title", title);
+
+ // Buttons
+ new ButtonWidget(this, "SaveLoadChooser.Delete", _("Cancel"), 0, kCloseCmd);
+ _nextButton = new ButtonWidget(this, "SaveLoadChooser.Choose", _("Next"), 0, kNextCmd);
+ _nextButton->setEnabled(false);
+
+ _prevButton = new ButtonWidget(this, "SaveLoadChooser.Cancel", _("Prev"), 0, kPrevCmd);
+ _prevButton->setEnabled(false);
+
+ // Page display
+ _pageDisplay = new StaticTextWidget(this, "SaveLoadChooser.PageDisplay", Common::String());
+ _pageDisplay->setAlign(Graphics::kTextAlignRight);
+}
+
+SaveLoadChooserGrid::~SaveLoadChooserGrid() {
+ removeWidget(_pageDisplay);
+ delete _pageDisplay;
+}
+
+const Common::String &SaveLoadChooserGrid::getResultString() const {
+ return _resultString;
+}
+
+void SaveLoadChooserGrid::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ if (cmd <= _entriesPerPage && cmd + _curPage * _entriesPerPage <= _saveList.size()) {
+ const SaveStateDescriptor &desc = _saveList[cmd - 1 + _curPage * _entriesPerPage];
+
+ if (_saveMode) {
+ _resultString = desc.getDescription();
+ }
+
+ setResult(desc.getSaveSlot());
+ close();
+ }
+
+ switch (cmd) {
+ case kNextCmd:
+ ++_curPage;
+ updateSaves();
+ draw();
+ break;
+
+ case kPrevCmd:
+ --_curPage;
+ updateSaves();
+ draw();
+ break;
+
+ case kNewSaveCmd:
+ setResult(_nextFreeSaveSlot);
+ close();
+ break;
+
+ case kCloseCmd:
+ setResult(-1);
+ default:
+ SaveLoadChooserDialog::handleCommand(sender, cmd, data);
+ }
+}
+
+void SaveLoadChooserGrid::handleMouseWheel(int x, int y, int direction) {
+ if (direction > 0) {
+ if (_nextButton->isEnabled()) {
+ ++_curPage;
+ updateSaves();
+ draw();
+ }
+ } else {
+ if (_prevButton->isEnabled()) {
+ --_curPage;
+ updateSaves();
+ draw();
+ }
+ }
+}
+
+void SaveLoadChooserGrid::open() {
+ SaveLoadChooserDialog::open();
+
+ _saveList = _metaEngine->listSaves(_target.c_str());
+ _resultString.clear();
+
+ // Load information to restore the last page the user had open.
+ assert(_entriesPerPage != 0);
+ const uint lastPos = ConfMan.getInt("gui_saveload_last_pos");
+ const uint listSize = _saveList.size();
+ uint bestMatch = 0;
+ uint diff = 0xFFFFFFFF;
+
+ // We look for the nearest available slot, since a slot might be missing
+ // due to the user deleting it via the list based chooser, by deleting
+ // it by hand, etc.
+ for (uint i = 0; i < listSize; ++i) {
+ uint curDiff = ABS(_saveList[i].getSaveSlot() - (int)lastPos);
+ if (curDiff < diff) {
+ diff = curDiff;
+ bestMatch = i;
+ }
+ }
+
+ _curPage = bestMatch / _entriesPerPage;
+
+ // Determine the next free save slot for save mode
+ if (_saveMode) {
+ int lastSlot = -1;
+ _nextFreeSaveSlot = -1;
+ for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
+ const int curSlot = x->getSaveSlot();
+
+ // In case there was a gap found use the slot.
+ if (lastSlot + 1 < curSlot) {
+ _nextFreeSaveSlot = lastSlot + 1;
+ break;
+ }
+
+ lastSlot = curSlot;
+ }
+
+ // Use the next available slot otherwise.
+ if (_nextFreeSaveSlot == -1 && lastSlot + 1 < _metaEngine->getMaximumSaveSlot()) {
+ _nextFreeSaveSlot = lastSlot + 1;
+ }
+ }
+
+ updateSaves();
+}
+
+void SaveLoadChooserGrid::reflowLayout() {
+ // HACK: The page display is not available in low resolution layout. We
+ // remove and readd the widget here to avoid our GUI from erroring out.
+ removeWidget(_pageDisplay);
+ if (g_gui.xmlEval()->getVar("Globals.ShowChooserPageDisplay") == 1) {
+ _pageDisplay->init();
+ }
+
+ SaveLoadChooserDialog::reflowLayout();
+ destroyButtons();
+
+ // HACK: The whole code below really works around the fact, that we have
+ // no easy way to dynamically layout widgets.
+ const uint16 availableWidth = getWidth() - 20;
+ uint16 availableHeight;
+
+ int16 x, y;
+ uint16 w;
+ g_gui.xmlEval()->getWidgetData("SaveLoadChooser.List", x, y, w, availableHeight);
+
+ const int16 buttonWidth = kThumbnailWidth + 6;
+ const int16 buttonHeight = kThumbnailHeight2 + 6;
+
+ const int16 containerFrameWidthAdd = 10;
+ const int16 containerFrameHeightAdd = 0;
+ const int16 containerWidth = buttonWidth + containerFrameWidthAdd;
+ const int16 containerHeight = buttonHeight + kLineHeight + containerFrameHeightAdd;
+
+ const int16 defaultSpacingHorizontal = 4;
+ const int16 defaultSpacingVertical = 8;
+ const int16 slotAreaWidth = containerWidth + defaultSpacingHorizontal;
+ const int16 slotAreaHeight = containerHeight + defaultSpacingVertical;
+
+ const uint oldEntriesPerPage = _entriesPerPage;
+ _columns = MAX<uint>(1, availableWidth / slotAreaWidth);
+ _lines = MAX<uint>(1, availableHeight / slotAreaHeight);
+ _entriesPerPage = _columns * _lines;
+
+ // In save mode the first button is always "New Save", thus we need to
+ // adjust the entries per page here.
+ if (_saveMode) {
+ --_entriesPerPage;
+ }
+
+ // Recalculate the page number
+ if (!_saveList.empty() && oldEntriesPerPage != 0) {
+ if (_entriesPerPage != 0) {
+ _curPage = (_curPage * oldEntriesPerPage) / _entriesPerPage;
+ } else {
+ _curPage = 0;
+ }
+ }
+
+ const uint addX = _columns > 1 ? (availableWidth % slotAreaWidth) / (_columns - 1) : 0;
+ //const uint addY = _lines > 1 ? (availableHeight % slotAreaHeight) / (_lines - 1) : 0;
+
+ _buttons.reserve(_lines * _columns);
+ y += defaultSpacingVertical / 2;
+ for (uint curLine = 0; curLine < _lines; ++curLine, y += slotAreaHeight/* + addY*/) {
+ for (uint curColumn = 0, curX = x + defaultSpacingHorizontal / 2; curColumn < _columns; ++curColumn, curX += slotAreaWidth + addX) {
+ int dstY = containerFrameHeightAdd / 2;
+ int dstX = containerFrameWidthAdd / 2;
+
+ // In the save mode we will always create a new save button as the first button.
+ if (_saveMode && curLine == 0 && curColumn == 0) {
+ _newSaveContainer = new ContainerWidget(this, curX, y, containerWidth, containerHeight);
+ ButtonWidget *newSave = new ButtonWidget(_newSaveContainer, dstX, dstY, buttonWidth, buttonHeight, _("New Save"), _("Create a new save game"), kNewSaveCmd);
+ // In case no more slots are free, we will disable the new save button
+ if (_nextFreeSaveSlot == -1) {
+ newSave->setEnabled(false);
+ }
+ continue;
+ }
+
+ ContainerWidget *container = new ContainerWidget(this, curX, y, containerWidth, containerHeight);
+ container->setVisible(false);
+
+ // Command 0 cannot be used, since it won't be send. Thus we will adjust
+ // command number here, if required. This is only the case for load mode
+ // since for save mode, the first button used is index 1 anyway.
+ uint buttonCmd = curLine * _columns + curColumn;
+ if (!_saveMode) {
+ buttonCmd += 1;
+ }
+
+ PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, 0, buttonCmd);
+ dstY += buttonHeight;
+
+ StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), Graphics::kTextAlignLeft);
+
+ _buttons.push_back(SlotButton(container, button, description));
+ }
+ }
+
+ if (!_target.empty())
+ updateSaves();
+}
+
+void SaveLoadChooserGrid::close() {
+ // Save the current page.
+ const int result = getResult();
+ if (result >= 0 && result != _nextFreeSaveSlot) {
+ // If the user selected a slot we use that one. We ignore new slots
+ // here, since otherwise the dialog would reset to page 0 when the
+ // user cancels the savename dialog.
+ ConfMan.setInt("gui_saveload_last_pos", result);
+ } else {
+ // Otherwise save the first entry on the current page.
+ // This is less precise than the solution above, since the number of
+ // entries shown differs between save and load version of the dialog,
+ // thus it might wrap to a different page than expected.
+ // Similar things happen on resolution changes.
+ // TODO: Should we ignore this here? Is the user likely to be
+ // interested in having this page restored when he canceled?
+ ConfMan.setInt("gui_saveload_last_pos", !_saveList.empty() ? _saveList[_curPage * _entriesPerPage].getSaveSlot() : 0);
+ }
+
+ SaveLoadChooserDialog::close();
+ hideButtons();
+}
+
+int SaveLoadChooserGrid::runIntern() {
+ int slot;
+ do {
+ const SaveLoadChooserType currentType = getType();
+ const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(*_metaEngine);
+
+ // Catch resolution changes when the save name dialog was open.
+ if (currentType != requestedType) {
+ setResult(kSwitchSaveLoadDialog);
+ return kSwitchSaveLoadDialog;
+ }
+
+ slot = runModal();
+ } while (_saveMode && slot >= 0 && !selectDescription());
+
+ // Special case for new save games. We need to handle this here, since
+ // we cannot handle it in close() without problems.
+ if (slot == _nextFreeSaveSlot) {
+ ConfMan.setInt("gui_saveload_last_pos", slot);
+ }
+
+ return slot;
+}
+
+bool SaveLoadChooserGrid::selectDescription() {
+ _savenameDialog.setDescription(_resultString);
+ _savenameDialog.setTargetSlot(getResult());
+ if (_savenameDialog.runModal() == 0) {
+ _resultString = _savenameDialog.getDescription();
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void SaveLoadChooserGrid::destroyButtons() {
+ if (_newSaveContainer) {
+ removeWidget(_newSaveContainer);
+ delete _newSaveContainer;
+ _newSaveContainer = 0;
+ }
+
+ for (ButtonArray::iterator i = _buttons.begin(), end = _buttons.end(); i != end; ++i) {
+ removeWidget(i->container);
+ delete i->container;
+ }
+
+ _buttons.clear();
+}
+
+void SaveLoadChooserGrid::hideButtons() {
+ for (ButtonArray::iterator i = _buttons.begin(), end = _buttons.end(); i != end; ++i) {
+ i->button->setGfx(0);
+ i->setVisible(false);
+ }
+}
+
+void SaveLoadChooserGrid::updateSaves() {
+ hideButtons();
+
+ for (uint i = _curPage * _entriesPerPage, curNum = 0; i < _saveList.size() && curNum < _entriesPerPage; ++i, ++curNum) {
+ const uint saveSlot = _saveList[i].getSaveSlot();
+
+ SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), saveSlot);
+ SlotButton &curButton = _buttons[curNum];
+ curButton.setVisible(true);
+ const Graphics::Surface *thumbnail = desc.getThumbnail();
+ if (thumbnail) {
+ curButton.button->setGfx(desc.getThumbnail());
+ } else {
+ curButton.button->setGfx(kThumbnailWidth, kThumbnailHeight2, 0, 0, 0);
+ }
+ curButton.description->setLabel(Common::String::format("%d. %s", saveSlot, desc.getDescription().c_str()));
+
+ Common::String tooltip(_("Name: "));
+ tooltip += desc.getDescription();
+
+ if (_saveDateSupport) {
+ const Common::String &saveDate = desc.getSaveDate();
+ if (!saveDate.empty()) {
+ tooltip += "\n";
+ tooltip += _("Date: ") + saveDate;
+ }
+
+ const Common::String &saveTime = desc.getSaveTime();
+ if (!saveTime.empty()) {
+ tooltip += "\n";
+ tooltip += _("Time: ") + saveTime;
+ }
+ }
+
+ if (_playTimeSupport) {
+ const Common::String &playTime = desc.getPlayTime();
+ if (!playTime.empty()) {
+ tooltip += "\n";
+ tooltip += _("Playtime: ") + playTime;
+ }
+ }
+
+ curButton.button->setTooltip(tooltip);
+
+ // In save mode we disable the button, when it's write protected.
+ // TODO: Maybe we should not display it at all then?
+ if (_saveMode && desc.getWriteProtectedFlag()) {
+ curButton.button->setEnabled(false);
+ } else {
+ curButton.button->setEnabled(true);
+ }
+ }
+
+ const uint numPages = (_entriesPerPage != 0 && !_saveList.empty()) ? ((_saveList.size() + _entriesPerPage - 1) / _entriesPerPage) : 1;
+ _pageDisplay->setLabel(Common::String::format("%u/%u", _curPage + 1, numPages));
+
+ if (_curPage > 0)
+ _prevButton->setEnabled(true);
+ else
+ _prevButton->setEnabled(false);
+
+ if ((_curPage + 1) * _entriesPerPage < _saveList.size())
+ _nextButton->setEnabled(true);
+ else
+ _nextButton->setEnabled(false);
+}
+
+SavenameDialog::SavenameDialog()
+ : Dialog("SavenameDialog") {
+ _title = new StaticTextWidget(this, "SavenameDialog.DescriptionText", Common::String());
+
+ new ButtonWidget(this, "SavenameDialog.Cancel", _("Cancel"), 0, kCloseCmd);
+ new ButtonWidget(this, "SavenameDialog.Ok", _("OK"), 0, kOKCmd);
+
+ _description = new EditTextWidget(this, "SavenameDialog.Description", Common::String(), 0, 0, kOKCmd);
+}
+
+void SavenameDialog::setDescription(const Common::String &desc) {
+ _description->setEditString(desc);
+}
+
+const Common::String &SavenameDialog::getDescription() {
+ return _description->getEditString();
+}
+
+void SavenameDialog::open() {
+ Dialog::open();
+ setResult(-1);
+
+ _title->setLabel(Common::String::format(_("Enter a description for slot %d:"), _targetSlot));
+}
+
+void SavenameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ switch (cmd) {
+ case kOKCmd:
+ setResult(0);
+ close();
+ break;
+
+ default:
+ Dialog::handleCommand(sender, cmd, data);
+ }
+}
+
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+} // End of namespace GUI
diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h
new file mode 100644
index 0000000000..6f7d95f73f
--- /dev/null
+++ b/gui/saveload-dialog.h
@@ -0,0 +1,209 @@
+/* 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 GUI_SAVELOAD_DIALOG_H
+#define GUI_SAVELOAD_DIALOG_H
+
+#include "gui/dialog.h"
+#include "gui/widgets/list.h"
+
+#include "engines/metaengine.h"
+
+namespace GUI {
+
+#define kSwitchSaveLoadDialog -2
+
+// TODO: We might want to disable the grid based save/load chooser for more
+// platforms, than those which define DISABLE_FANCY_THEMES. But those are
+// probably not able to handle the grid chooser anyway, so disabling it
+// for them is a good start.
+#ifdef DISABLE_FANCY_THEMES
+#define DISABLE_SAVELOADCHOOSER_GRID
+#endif // DISABLE_FANCY_THEMES
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+enum SaveLoadChooserType {
+ kSaveLoadDialogList = 0,
+ kSaveLoadDialogGrid = 1
+};
+
+SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine);
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+class SaveLoadChooserDialog : protected Dialog {
+public:
+ SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode);
+ SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode);
+
+ virtual void open();
+
+ virtual void reflowLayout();
+
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ virtual SaveLoadChooserType getType() const = 0;
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+ int run(const Common::String &target, const MetaEngine *metaEngine);
+ virtual const Common::String &getResultString() const = 0;
+
+protected:
+ virtual int runIntern() = 0;
+
+ const bool _saveMode;
+ const MetaEngine *_metaEngine;
+ bool _delSupport;
+ bool _metaInfoSupport;
+ bool _thumbnailSupport;
+ bool _saveDateSupport;
+ bool _playTimeSupport;
+ Common::String _target;
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ ButtonWidget *_listButton;
+ ButtonWidget *_gridButton;
+
+ void addChooserButtons();
+ ButtonWidget *createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd = 0);
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+};
+
+class SaveLoadChooserSimple : public SaveLoadChooserDialog {
+ typedef Common::String String;
+ typedef Common::Array<Common::String> StringArray;
+public:
+ SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode);
+
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+ virtual const Common::String &getResultString() const;
+
+ virtual void reflowLayout();
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ virtual SaveLoadChooserType getType() const { return kSaveLoadDialogList; }
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+ virtual void open();
+ virtual void close();
+private:
+ virtual int runIntern();
+
+ ListWidget *_list;
+ ButtonWidget *_chooseButton;
+ ButtonWidget *_deleteButton;
+ GraphicsWidget *_gfxWidget;
+ ContainerWidget *_container;
+ StaticTextWidget *_date;
+ StaticTextWidget *_time;
+ StaticTextWidget *_playtime;
+
+ SaveStateList _saveList;
+ String _resultString;
+
+ void updateSaveList();
+ void updateSelection(bool redraw);
+};
+
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+
+class EditTextWidget;
+
+class SavenameDialog : public Dialog {
+public:
+ SavenameDialog();
+
+ void setDescription(const Common::String &desc);
+ const Common::String &getDescription();
+
+ void setTargetSlot(int slot) { _targetSlot = slot; }
+
+ virtual void open();
+protected:
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+private:
+ int _targetSlot;
+ StaticTextWidget *_title;
+ EditTextWidget *_description;
+};
+
+class SaveLoadChooserGrid : public SaveLoadChooserDialog {
+public:
+ SaveLoadChooserGrid(const Common::String &title, bool saveMode);
+ ~SaveLoadChooserGrid();
+
+ virtual const Common::String &getResultString() const;
+
+ virtual void open();
+
+ virtual void reflowLayout();
+
+ virtual SaveLoadChooserType getType() const { return kSaveLoadDialogGrid; }
+
+ virtual void close();
+protected:
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+ virtual void handleMouseWheel(int x, int y, int direction);
+private:
+ virtual int runIntern();
+
+ uint _columns, _lines;
+ uint _entriesPerPage;
+ uint _curPage;
+ SaveStateList _saveList;
+
+ ButtonWidget *_nextButton;
+ ButtonWidget *_prevButton;
+
+ StaticTextWidget *_pageDisplay;
+
+ ContainerWidget *_newSaveContainer;
+ int _nextFreeSaveSlot;
+ Common::String _resultString;
+
+ SavenameDialog _savenameDialog;
+ bool selectDescription();
+
+ struct SlotButton {
+ SlotButton() : container(0), button(0), description(0) {}
+ SlotButton(ContainerWidget *c, PicButtonWidget *b, StaticTextWidget *d) : container(c), button(b), description(d) {}
+
+ ContainerWidget *container;
+ PicButtonWidget *button;
+ StaticTextWidget *description;
+
+ void setVisible(bool state) {
+ container->setVisible(state);
+ }
+ };
+ typedef Common::Array<SlotButton> ButtonArray;
+ ButtonArray _buttons;
+ void destroyButtons();
+ void hideButtons();
+ void updateSaves();
+};
+
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+
+} // End of namespace GUI
+
+#endif
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index 3dc9961906..c2bbcd9bec 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -20,83 +20,87 @@
*/
#include "common/config-manager.h"
-#include "common/translation.h"
+#include "common/system.h"
-#include "gui/widgets/list.h"
-#include "gui/message.h"
#include "gui/saveload.h"
-#include "gui/ThemeEval.h"
+#include "gui/saveload-dialog.h"
#include "gui/gui-manager.h"
-#include "graphics/scaler.h"
-
#include "engines/metaengine.h"
namespace GUI {
-enum {
- kChooseCmd = 'CHOS',
- kDelCmd = 'DEL '
-
-};
-
-SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel)
- : Dialog("SaveLoadChooser"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) {
- _delSupport = _metaInfoSupport = _thumbnailSupport = _saveDateSupport = _playTimeSupport = false;
-
- _backgroundType = ThemeEngine::kDialogBackgroundSpecial;
-
- new StaticTextWidget(this, "SaveLoadChooser.Title", title);
-
- // Add choice list
- _list = new GUI::ListWidget(this, "SaveLoadChooser.List");
- _list->setNumberingMode(GUI::kListNumberingZero);
- setSaveMode(false);
-
- _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10);
+SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode)
+ : _impl(0), _title(title), _buttonLabel(buttonLabel), _saveMode(saveMode) {
+}
- _date = new StaticTextWidget(this, 0, 0, 10, 10, _("No date saved"), Graphics::kTextAlignCenter);
- _time = new StaticTextWidget(this, 0, 0, 10, 10, _("No time saved"), Graphics::kTextAlignCenter);
- _playtime = new StaticTextWidget(this, 0, 0, 10, 10, _("No playtime saved"), Graphics::kTextAlignCenter);
+SaveLoadChooser::~SaveLoadChooser() {
+ delete _impl;
+ _impl = 0;
+}
- // Buttons
- new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), 0, kCloseCmd);
- _chooseButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, 0, kChooseCmd);
- _chooseButton->setEnabled(false);
+void SaveLoadChooser::selectChooser(const MetaEngine &engine) {
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(engine);
+ if (!_impl || _impl->getType() != requestedType) {
+ delete _impl;
+ _impl = 0;
+
+ switch (requestedType) {
+ case kSaveLoadDialogGrid:
+ _impl = new SaveLoadChooserGrid(_title, _saveMode);
+ break;
+
+ case kSaveLoadDialogList:
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+ _impl = new SaveLoadChooserSimple(_title, _buttonLabel, _saveMode);
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ break;
+ }
+ }
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+}
- _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), 0, kDelCmd);
- _deleteButton->setEnabled(false);
+Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) const {
+#if defined(USE_SAVEGAME_TIMESTAMP)
+ TimeDate curTime;
+ g_system->getTimeAndDate(curTime);
+ curTime.tm_year += 1900; // fixup year
+ curTime.tm_mon++; // fixup month
+ return 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
+ return Common::String::format("Save %d", slot + 1);
+#endif
+}
- _delSupport = _metaInfoSupport = _thumbnailSupport = false;
+int SaveLoadChooser::runModalWithCurrentTarget() {
+ const Common::String gameId = ConfMan.get("gameid");
- _container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
-// _container->setHints(GUI::THEME_HINT_USE_SHADOW);
-}
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(gameId, &plugin);
-SaveLoadChooser::~SaveLoadChooser() {
+ return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
}
int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) {
- if (_gfxWidget)
- _gfxWidget->setGfx(0);
+ selectChooser(**plugin);
+ if (!_impl)
+ return -1;
// Set up the game domain as newly active domain, so
// target specific savepath will be checked
String oldDomain = ConfMan.getActiveDomainName();
ConfMan.setActiveDomain(target);
- _plugin = plugin;
- _target = target;
- _delSupport = (*_plugin)->hasFeature(MetaEngine::kSupportsDeleteSave);
- _metaInfoSupport = (*_plugin)->hasFeature(MetaEngine::kSavesSupportMetaInfo);
- _thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportThumbnail);
- _saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportCreationDate);
- _playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportPlayTime);
- _resultString.clear();
- reflowLayout();
- updateSaveList();
-
- int ret = Dialog::runModal();
+ int ret;
+ do {
+ ret = _impl->run(target, &(**plugin));
+#ifndef DISABLE_SAVELOADCHOOSER_GRID
+ if (ret == kSwitchSaveLoadDialog) {
+ selectChooser(**plugin);
+ }
+#endif // !DISABLE_SAVELOADCHOOSER_GRID
+ } while (ret < -1);
// Revert to the old active domain
ConfMan.setActiveDomain(oldDomain);
@@ -104,284 +108,9 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con
return ret;
}
-void SaveLoadChooser::open() {
- Dialog::open();
-
- // So that quitting ScummVM will not cause the dialog result to say a
- // savegame was selected.
- setResult(-1);
-}
-
const Common::String &SaveLoadChooser::getResultString() const {
- int selItem = _list->getSelected();
- return (selItem >= 0) ? _list->getSelectedString() : _resultString;
-}
-
-void SaveLoadChooser::setSaveMode(bool saveMode) {
- _list->setEditable(saveMode);
-}
-
-void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
- int selItem = _list->getSelected();
-
- switch (cmd) {
- case GUI::kListItemActivatedCmd:
- case GUI::kListItemDoubleClickedCmd:
- if (selItem >= 0 && _chooseButton->isEnabled()) {
- if (_list->isEditable() || !_list->getSelectedString().empty()) {
- _list->endEditMode();
- if (!_saveList.empty()) {
- setResult(_saveList[selItem].getSaveSlot());
- _resultString = _list->getSelectedString();
- }
- close();
- }
- }
- break;
- case kChooseCmd:
- _list->endEditMode();
- if (!_saveList.empty()) {
- setResult(_saveList[selItem].getSaveSlot());
- _resultString = _list->getSelectedString();
- }
- close();
- break;
- case GUI::kListSelectionChangedCmd:
- updateSelection(true);
- break;
- case kDelCmd:
- if (selItem >= 0 && _delSupport) {
- MessageDialog alert(_("Do you really want to delete this savegame?"),
- _("Delete"), _("Cancel"));
- if (alert.runModal() == GUI::kMessageOK) {
- (*_plugin)->removeSaveState(_target.c_str(), _saveList[selItem].getSaveSlot());
-
- setResult(-1);
- _list->setSelected(-1);
-
- updateSaveList();
- updateSelection(true);
- }
- }
- break;
- case kCloseCmd:
- setResult(-1);
- default:
- Dialog::handleCommand(sender, cmd, data);
- }
-}
-
-void SaveLoadChooser::reflowLayout() {
- if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) {
- int16 x, y;
- uint16 w, h;
-
- if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h))
- error("Error when loading position data for Save/Load Thumbnails");
-
- int thumbW = kThumbnailWidth;
- int thumbH = kThumbnailHeight2;
- int thumbX = x + (w >> 1) - (thumbW >> 1);
- int thumbY = y + kLineHeight;
-
- int textLines = 0;
- if (!_saveDateSupport)
- textLines++;
- if (!_playTimeSupport)
- textLines++;
-
- _container->resize(x, y, w, h - (kLineHeight * textLines));
- _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH);
-
- int height = thumbY + thumbH + kLineHeight;
-
- if (_saveDateSupport) {
- _date->resize(thumbX, height, kThumbnailWidth, kLineHeight);
- height += kLineHeight;
- _time->resize(thumbX, height, kThumbnailWidth, kLineHeight);
- height += kLineHeight;
- }
-
- if (_playTimeSupport)
- _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight);
-
- _container->setVisible(true);
- _gfxWidget->setVisible(true);
-
- _date->setVisible(_saveDateSupport);
- _time->setVisible(_saveDateSupport);
-
- _playtime->setVisible(_playTimeSupport);
-
- _fillR = 0;
- _fillG = 0;
- _fillB = 0;
- updateSelection(false);
- } else {
- _container->setVisible(false);
- _gfxWidget->setVisible(false);
- _date->setVisible(false);
- _time->setVisible(false);
- _playtime->setVisible(false);
- }
-
- Dialog::reflowLayout();
-}
-
-void SaveLoadChooser::updateSelection(bool redraw) {
- int selItem = _list->getSelected();
-
- bool isDeletable = _delSupport;
- bool isWriteProtected = false;
- bool startEditMode = _list->isEditable();
-
- _gfxWidget->setGfx(-1, -1, _fillR, _fillG, _fillB);
- _date->setLabel(_("No date saved"));
- _time->setLabel(_("No time saved"));
- _playtime->setLabel(_("No playtime saved"));
-
- if (selItem >= 0 && _metaInfoSupport) {
- SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), _saveList[selItem].getSaveSlot());
-
- isDeletable = desc.getDeletableFlag() && _delSupport;
- isWriteProtected = desc.getWriteProtectedFlag();
-
- // Don't allow the user to change the description of write protected games
- if (isWriteProtected)
- startEditMode = false;
-
- if (_thumbnailSupport) {
- const Graphics::Surface *thumb = desc.getThumbnail();
- if (thumb) {
- _gfxWidget->setGfx(thumb);
- _gfxWidget->useAlpha(256);
- }
- }
-
- if (_saveDateSupport) {
- const Common::String &saveDate = desc.getSaveDate();
- if (!saveDate.empty())
- _date->setLabel(_("Date: ") + saveDate);
-
- const Common::String &saveTime = desc.getSaveTime();
- if (!saveTime.empty())
- _time->setLabel(_("Time: ") + saveTime);
- }
-
- if (_playTimeSupport) {
- const Common::String &playTime = desc.getPlayTime();
- if (!playTime.empty())
- _playtime->setLabel(_("Playtime: ") + playTime);
- }
- }
-
-
- if (_list->isEditable()) {
- // Disable the save button if nothing is selected, or if the selected
- // game is write protected
- _chooseButton->setEnabled(selItem >= 0 && !isWriteProtected);
-
- if (startEditMode) {
- _list->startEditMode();
-
- if (_chooseButton->isEnabled() && _list->getSelectedString() == _("Untitled savestate") &&
- _list->getSelectionColor() == ThemeEngine::kFontColorAlternate) {
- _list->setEditString("");
- _list->setEditColor(ThemeEngine::kFontColorNormal);
- }
- }
- } else {
- // Disable the load button if nothing is selected, or if an empty
- // list item is selected.
- _chooseButton->setEnabled(selItem >= 0 && !_list->getSelectedString().empty());
- }
-
- // Delete will always be disabled if the engine doesn't support it.
- _deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty()));
-
- if (redraw) {
- _gfxWidget->draw();
- _date->draw();
- _time->draw();
- _playtime->draw();
- _chooseButton->draw();
- _deleteButton->draw();
-
- draw();
- }
-}
-
-void SaveLoadChooser::close() {
- _plugin = 0;
- _target.clear();
- _saveList.clear();
- _list->setList(StringArray());
-
- Dialog::close();
-}
-
-void SaveLoadChooser::updateSaveList() {
- _saveList = (*_plugin)->listSaves(_target.c_str());
-
- int curSlot = 0;
- int saveSlot = 0;
- StringArray saveNames;
- ListWidget::ColorList colors;
- for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
- // Handle gaps in the list of save games
- saveSlot = x->getSaveSlot();
- if (curSlot < saveSlot) {
- while (curSlot < saveSlot) {
- SaveStateDescriptor dummySave(curSlot, "");
- _saveList.insert_at(curSlot, dummySave);
- saveNames.push_back(dummySave.getDescription());
- colors.push_back(ThemeEngine::kFontColorNormal);
- curSlot++;
- }
-
- // Sync the save list iterator
- for (x = _saveList.begin(); x != _saveList.end(); ++x) {
- if (x->getSaveSlot() == saveSlot)
- break;
- }
- }
-
- // Show "Untitled savestate" for empty/whitespace savegame descriptions
- Common::String description = x->getDescription();
- Common::String trimmedDescription = description;
- trimmedDescription.trim();
- if (trimmedDescription.empty()) {
- description = _("Untitled savestate");
- colors.push_back(ThemeEngine::kFontColorAlternate);
- } else {
- colors.push_back(ThemeEngine::kFontColorNormal);
- }
-
- saveNames.push_back(description);
- curSlot++;
- }
-
- // Fill the rest of the save slots with empty saves
-
- int maximumSaveSlots = (*_plugin)->getMaximumSaveSlot();
-
-#ifdef __DS__
- // Low memory on the DS means too many save slots are impractical, so limit
- // the maximum here.
- if (maximumSaveSlots > 99) {
- maximumSaveSlots = 99;
- }
-#endif
-
- Common::String emptyDesc;
- for (int i = curSlot; i <= maximumSaveSlots; i++) {
- saveNames.push_back(emptyDesc);
- SaveStateDescriptor dummySave(i, "");
- _saveList.push_back(dummySave);
- colors.push_back(ThemeEngine::kFontColorNormal);
- }
-
- _list->setList(saveNames, &colors);
+ assert(_impl);
+ return _impl->getResultString();
}
} // End of namespace GUI
diff --git a/gui/saveload.h b/gui/saveload.h
index adaf311fd2..17fd99a31d 100644
--- a/gui/saveload.h
+++ b/gui/saveload.h
@@ -19,63 +19,55 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef GUI_SAVELOAD_DIALOG_H
-#define GUI_SAVELOAD_DIALOG_H
+#ifndef GUI_SAVELOAD_H
+#define GUI_SAVELOAD_H
#include "gui/dialog.h"
#include "engines/metaengine.h"
namespace GUI {
-class ListWidget;
-class GraphicsWidget;
-class ButtonWidget;
-class CommandSender;
-class ContainerWidget;
-class StaticTextWidget;
+class SaveLoadChooserDialog;
-class SaveLoadChooser : GUI::Dialog {
+class SaveLoadChooser {
typedef Common::String String;
- typedef Common::Array<Common::String> StringArray;
protected:
- GUI::ListWidget *_list;
- GUI::ButtonWidget *_chooseButton;
- GUI::ButtonWidget *_deleteButton;
- GUI::GraphicsWidget *_gfxWidget;
- GUI::ContainerWidget *_container;
- GUI::StaticTextWidget *_date;
- GUI::StaticTextWidget *_time;
- GUI::StaticTextWidget *_playtime;
+ SaveLoadChooserDialog *_impl;
- const EnginePlugin *_plugin;
- bool _delSupport;
- bool _metaInfoSupport;
- bool _thumbnailSupport;
- bool _saveDateSupport;
- bool _playTimeSupport;
- String _target;
- SaveStateList _saveList;
- String _resultString;
+ const String _title;
+ const String _buttonLabel;
+ const bool _saveMode;
- uint8 _fillR, _fillG, _fillB;
-
- void updateSaveList();
- void updateSelection(bool redraw);
+ void selectChooser(const MetaEngine &engine);
public:
- SaveLoadChooser(const String &title, const String &buttonLabel);
+ SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode);
~SaveLoadChooser();
- virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
- void setList(const StringArray& list);
+ /**
+ * Runs the save/load chooser with the currently active config manager
+ * domain as target.
+ *
+ * @return The selcted save slot. -1 in case none is selected.
+ */
+ int runModalWithCurrentTarget();
int runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target);
- void open();
const Common::String &getResultString() const;
- void setSaveMode(bool saveMode);
-
- virtual void reflowLayout();
- virtual void close();
+ /**
+ * Creates a default save description for the specified slot. Depending
+ * on the ScummVM configuration this might be a simple "Slot #" description
+ * or the current date and time.
+ *
+ * TODO: This might not be the best place to put this, since engines not
+ * using this class might want to mimic the same behavior. Check whether
+ * moving this to a better place makes sense and find what this place would
+ * be.
+ *
+ * @param slot The slot number (must be >= 0).
+ * @return The slot description.
+ */
+ Common::String createDefaultSaveDescription(const int slot) const;
};
} // End of namespace GUI
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index bd28c2e85d..7f565eb05d 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -460,6 +460,17 @@
"bevel='2' "
"/> "
"</drawdata> "
+"<drawdata id='button_pressed' cache='false'> "
+"<text font='text_button' "
+"text_color='color_alternative_inverted' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"/> "
+"</drawdata> "
"<drawdata id='button_idle' cache='false'> "
"<text font='text_button' "
"text_color='color_button' "
@@ -608,6 +619,8 @@
"<def var='ShowLauncherLogo' value='0'/> "
"<def var='ShowGlobalMenuLogo' value='0'/> "
"<def var='ShowSearchPic' value='0'/> "
+"<def var='ShowChooserPics' value='0'/> "
+"<def var='ShowChooserPageDisplay' value='0'/> "
"<def var='SaveLoadChooser.ExtInfo.Visible' value='0'/> "
"<def var='KeyMapper.Spacing' value='5'/> "
"<def var='KeyMapper.LabelWidth' value='80'/> "
@@ -615,6 +628,8 @@
"<def var='Tooltip.MaxWidth' value='70'/> "
"<def var='Tooltip.XDelta' value='8'/> "
"<def var='Tooltip.YDelta' value='8'/> "
+"<def var='Predictive.Button.Width' value='45' /> "
+"<def var='Predictive.Button.Height' value='15' /> "
"<widget name='Button' "
"size='72,16' "
"/> "
@@ -777,9 +792,6 @@
"<widget name='grFullscreenCheckbox' "
"type='Checkbox' "
"/> "
-"<widget name='grDisableDitheringCheckbox' "
-"type='Checkbox' "
-"/> "
"</layout> "
"</dialog> "
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
@@ -1187,6 +1199,31 @@
"</layout> "
"</layout> "
"</dialog> "
+"<dialog name='GameOptions_Engine' overlays='Dialog.GameOptions.TabWidget' shading='dim'> "
+"<layout type='vertical' padding='8,8,8,8'> "
+"<widget name='customOption1Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption2Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption3Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption4Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption5Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption6Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption7Checkbox' "
+"type='Checkbox' "
+"/> "
+"</layout> "
+"</dialog> "
"<dialog name='GlobalMenu' overlays='screen_center'> "
"<layout type='vertical' padding='2,2,4,6' center='true' spacing='6'> "
"<widget name='Title' "
@@ -1327,6 +1364,14 @@
"<widget name='Title' height='Globals.Line.Height'/> "
"<widget name='List' /> "
"<layout type='horizontal' padding='0,0,16,0'> "
+"<widget name='ListSwitch' "
+"height='Globals.Line.Height' "
+"width='Globals.Line.Height' "
+"/> "
+"<widget name='GridSwitch' "
+"height='Globals.Line.Height' "
+"width='Globals.Line.Height' "
+"/> "
"<space/> "
"<widget name='Delete' "
"type='Button' "
@@ -1341,6 +1386,25 @@
"</layout> "
"</layout> "
"</dialog> "
+"<dialog name='SavenameDialog' overlays='screen_center'> "
+"<layout type='vertical' padding='8,8,8,8'> "
+"<widget name='DescriptionText' "
+"width='180' "
+"height='Globals.Line.Height' "
+"/> "
+"<widget name='Description' "
+"height='19' "
+"/> "
+"<layout type='horizontal' padding='0,0,16,0'> "
+"<widget name='Cancel' "
+"type='Button' "
+"/> "
+"<widget name='Ok' "
+"type='Button' "
+"/> "
+"</layout> "
+"</layout> "
+"</dialog> "
"<dialog name='ScummHelp' overlays='screen'> "
"<layout type='vertical' padding='8,8,8,8'> "
"<widget name='Title' "
@@ -1429,6 +1493,96 @@
"/> "
"</layout> "
"</dialog> "
+"<dialog name='Predictive' overlays='screen_center'> "
+"<layout type='vertical' padding='1,1,1,1' center='true'> "
+"<widget name='Headline' "
+"height='Globals.Line.Height' "
+"width='150' "
+"textalign='center' "
+"/> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Word' "
+"width='120' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Delete' "
+"width='20' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Button1' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button2' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button3' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Button4' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button5' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button6' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Button7' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button8' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button9' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,0'> "
+"<widget name='Pre' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Button0' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Next' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"</layout> "
+"<space size='3' /> "
+"<layout type='horizontal' padding='3,3,0,3'> "
+"<widget name='Add' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='Cancel' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"<widget name='OK' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Predictive.Button.Height' "
+"/> "
+"</layout> "
+"</layout> "
+"</dialog> "
"</layout_info> "
"<layout_info resolution='y>399'> "
"<globals> "
@@ -1439,6 +1593,8 @@
"<def var='ShowLauncherLogo' value='0'/> "
"<def var='ShowGlobalMenuLogo' value='0'/> "
"<def var='ShowSearchPic' value='0'/> "
+"<def var='ShowChooserPics' value='0'/> "
+"<def var='ShowChooserPageDisplay' value='1'/> "
"<def var='SaveLoadChooser.ExtInfo.Visible' value='1'/> "
"<def var='KeyMapper.Spacing' value='10'/> "
"<def var='KeyMapper.LabelWidth' value='100'/> "
@@ -1446,6 +1602,7 @@
"<def var='Tooltip.MaxWidth' value='200'/> "
"<def var='Tooltip.XDelta' value='16'/> "
"<def var='Tooltip.YDelta' value='16'/> "
+"<def var='Predictive.Button.Width' value='60' /> "
"<widget name='OptionsLabel' "
"size='110,Globals.Line.Height' "
"textalign='right' "
@@ -1612,9 +1769,6 @@
"<widget name='grFullscreenCheckbox' "
"type='Checkbox' "
"/> "
-"<widget name='grDisableDitheringCheckbox' "
-"type='Checkbox' "
-"/> "
"</layout> "
"</dialog> "
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
@@ -2008,6 +2162,31 @@
"</layout> "
"</layout> "
"</dialog> "
+"<dialog name='GameOptions_Engine' overlays='Dialog.GameOptions.TabWidget' shading='dim'> "
+"<layout type='vertical' padding='16,16,16,16'> "
+"<widget name='customOption1Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption2Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption3Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption4Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption5Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption6Checkbox' "
+"type='Checkbox' "
+"/> "
+"<widget name='customOption7Checkbox' "
+"type='Checkbox' "
+"/> "
+"</layout> "
+"</dialog> "
"<dialog name='GlobalMenu' overlays='screen_center'> "
"<layout type='vertical' padding='16,16,16,16' center='true'> "
"<widget name='Title' "
@@ -2146,9 +2325,16 @@
"</dialog> "
"<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> "
"<layout type='vertical' padding='8,8,8,32' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<widget name='Title' "
"height='Globals.Line.Height' "
"/> "
+"<space/> "
+"<widget name='PageDisplay' "
+"width='200' "
+"height='Globals.Line.Height' "
+"/> "
+"</layout> "
"<layout type='horizontal' padding='0,0,0,16' spacing='16'> "
"<widget name='List' /> "
"<widget name='Thumbnail' "
@@ -2157,6 +2343,14 @@
"/> "
"</layout> "
"<layout type='horizontal' padding='0,0,0,0'> "
+"<widget name='ListSwitch' "
+"height='Globals.Line.Height' "
+"width='Globals.Line.Height' "
+"/> "
+"<widget name='GridSwitch' "
+"height='Globals.Line.Height' "
+"width='Globals.Line.Height' "
+"/> "
"<space/> "
"<widget name='Delete' "
"type='Button' "
@@ -2171,6 +2365,26 @@
"</layout> "
"</layout> "
"</dialog> "
+"<dialog name='SavenameDialog' overlays='screen_center'> "
+"<layout type='vertical' padding='8,8,8,8'> "
+"<widget name='DescriptionText' "
+"width='320' "
+"height='Globals.Line.Height' "
+"/> "
+"<widget name='Description' "
+"height='19' "
+"/> "
+"<layout type='horizontal' padding='0,0,16,0'> "
+"<widget name='Cancel' "
+"type='Button' "
+"/> "
+"<space size='96'/> "
+"<widget name='Ok' "
+"type='Button' "
+"/> "
+"</layout> "
+"</layout> "
+"</dialog> "
"<dialog name='ScummHelp' overlays='screen_center'> "
"<layout type='vertical' padding='8,8,8,8' center='true'> "
"<widget name='Title' "
@@ -2259,4 +2473,96 @@
"/> "
"</layout> "
"</dialog> "
+"<dialog name='Predictive' overlays='screen_center'> "
+"<layout type='vertical' padding='5,5,5,5' center='true'> "
+"<widget name='Headline' "
+"height='Globals.Line.Height' "
+"width='210' "
+"textalign='center' "
+"/> "
+"<layout type='horizontal' padding='5,5,5,5'> "
+"<widget name='Word' "
+"width='190' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Delete' "
+"width='20' "
+"height='Globals.Button.Height' "
+"/> "
+"</layout> "
+"<space size='5' /> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Button1' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button2' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button3' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Button4' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button5' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button6' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Button7' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button8' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button9' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Pre' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Button0' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='Next' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"</layout> "
+"<space size='5' /> "
+"<layout type='horizontal' padding='3,3,3,3'> "
+"<widget name='Add' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<space size='22'/> "
+"<widget name='Cancel' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"<widget name='OK' "
+"width='Globals.Predictive.Button.Width' "
+"height='Globals.Button.Height' "
+"/> "
+"</layout> "
+"</layout> "
+"</dialog> "
"</layout_info> "
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index d4cfd0cba3..62eae0cd43 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 f3904cbb6d..b8937adcb2 100644
--- a/gui/themes/scummclassic/THEMERC
+++ b/gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.8:ScummVM Classic Theme:No Author]
+[SCUMMVM_STX0.8.16:ScummVM Classic Theme:No Author]
diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx
index f07499ce79..49ecea2e11 100644
--- a/gui/themes/scummclassic/classic_gfx.stx
+++ b/gui/themes/scummclassic/classic_gfx.stx
@@ -541,6 +541,19 @@
/>
</drawdata>
+ <!-- Pressed button -->
+ <drawdata id = 'button_pressed' cache = 'false'>
+ <text font = 'text_button'
+ text_color = 'color_alternative_inverted'
+ vertical_align = 'center'
+ horizontal_align = 'center'
+ />
+ <drawstep func = 'square'
+ fill = 'foreground'
+ fg_color = 'green'
+ />
+ </drawdata>
+
<drawdata id = 'button_idle' cache = 'false'>
<text font = 'text_button'
text_color = 'color_button'
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 9da42635a7..4a6aae00bc 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -32,6 +32,9 @@
<def var = 'ShowGlobalMenuLogo' value = '0'/>
<def var = 'ShowSearchPic' value = '0'/>
+ <def var = 'ShowChooserPics' value = '0'/>
+ <def var = 'ShowChooserPageDisplay' value = '1'/>
+
<def var = 'SaveLoadChooser.ExtInfo.Visible' value = '1'/>
<def var = 'KeyMapper.Spacing' value = '10'/>
@@ -42,6 +45,8 @@
<def var = 'Tooltip.XDelta' value = '16'/> <!-- basically cursor size -->
<def var = 'Tooltip.YDelta' value = '16'/>
+ <def var = 'Predictive.Button.Width' value = '60' />
+
<widget name = 'OptionsLabel'
size = '110, Globals.Line.Height'
textalign = 'right'
@@ -215,9 +220,6 @@
<widget name = 'grFullscreenCheckbox'
type = 'Checkbox'
/>
- <widget name = 'grDisableDitheringCheckbox'
- type = 'Checkbox'
- />
</layout>
</dialog>
@@ -627,6 +629,32 @@
</layout>
</dialog>
+ <dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget' shading = 'dim'>
+ <layout type = 'vertical' padding = '16, 16, 16, 16'>
+ <widget name = 'customOption1Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption2Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption3Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption4Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption5Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption6Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption7Checkbox'
+ type = 'Checkbox'
+ />
+ </layout>
+ </dialog>
+
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
<layout type = 'vertical' padding = '16, 16, 16, 16' center = 'true'>
<widget name = 'Title'
@@ -768,9 +796,16 @@
<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, 0'>
+ <widget name = 'Title'
+ height = 'Globals.Line.Height'
+ />
+ <space/>
+ <widget name = 'PageDisplay'
+ width = '200'
+ height = 'Globals.Line.Height'
+ />
+ </layout>
<layout type = 'horizontal' padding = '0, 0, 0, 16' spacing = '16'>
<widget name = 'List' />
<widget name = 'Thumbnail'
@@ -779,6 +814,14 @@
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
+ <widget name = 'ListSwitch'
+ height = 'Globals.Line.Height'
+ width = 'Globals.Line.Height'
+ />
+ <widget name = 'GridSwitch'
+ height = 'Globals.Line.Height'
+ width = 'Globals.Line.Height'
+ />
<space/>
<widget name = 'Delete'
type = 'Button'
@@ -794,6 +837,27 @@
</layout>
</dialog>
+ <dialog name = 'SavenameDialog' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '8, 8, 8, 8'>
+ <widget name = 'DescriptionText'
+ width = '320'
+ height = 'Globals.Line.Height'
+ />
+ <widget name = 'Description'
+ height = '19'
+ />
+ <layout type = 'horizontal' padding = '0, 0, 16, 0'>
+ <widget name = 'Cancel'
+ type = 'Button'
+ />
+ <space size = '96'/>
+ <widget name = 'Ok'
+ type = 'Button'
+ />
+ </layout>
+ </layout>
+ </dialog>
+
<dialog name = 'ScummHelp' overlays = 'screen_center'>
<layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true'>
<widget name = 'Title'
@@ -885,4 +949,98 @@
/>
</layout>
</dialog>
+
+ <dialog name = 'Predictive' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '5, 5, 5, 5' center = 'true'>
+ <widget name = 'Headline'
+ height = 'Globals.Line.Height'
+ width = '210'
+ textalign = 'center'
+ />
+
+ <layout type = 'horizontal' padding = '5, 5, 5, 5'>
+ <widget name = 'Word'
+ width = '190'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Delete'
+ width = '20'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <space size = '5' />
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button1'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button2'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button3'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button4'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button5'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button6'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button7'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button8'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button9'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Pre'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button0'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Next'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <space size = '5' />
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Add'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <space size = '22'/>
+ <widget name = 'Cancel'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'OK'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ </layout>
+ </dialog>
</layout_info>
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index dc528a4c00..57e149b570 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -33,6 +33,9 @@
<def var = 'ShowGlobalMenuLogo' value = '0'/>
<def var = 'ShowSearchPic' value = '0'/>
+ <def var = 'ShowChooserPics' value = '0'/>
+ <def var = 'ShowChooserPageDisplay' value = '0'/>
+
<def var = 'SaveLoadChooser.ExtInfo.Visible' value = '0'/>
<def var = 'KeyMapper.Spacing' value = '5'/>
@@ -43,6 +46,9 @@
<def var = 'Tooltip.XDelta' value = '8'/> <!-- basically cursor size -->
<def var = 'Tooltip.YDelta' value = '8'/>
+ <def var = 'Predictive.Button.Width' value = '45' />
+ <def var = 'Predictive.Button.Height' value = '15' />
+
<widget name = 'Button'
size = '72, 16'
/>
@@ -213,9 +219,6 @@
<widget name = 'grFullscreenCheckbox'
type = 'Checkbox'
/>
- <widget name = 'grDisableDitheringCheckbox'
- type = 'Checkbox'
- />
</layout>
</dialog>
@@ -639,6 +642,32 @@
</layout>
</dialog>
+ <dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget' shading = 'dim'>
+ <layout type = 'vertical' padding = '8, 8, 8, 8'>
+ <widget name = 'customOption1Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption2Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption3Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption4Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption5Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption6Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption7Checkbox'
+ type = 'Checkbox'
+ />
+ </layout>
+ </dialog>
+
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
<layout type = 'vertical' padding = '2, 2, 4, 6' center = 'true' spacing='6'>
<widget name = 'Title'
@@ -781,6 +810,14 @@
<widget name = 'Title' height = 'Globals.Line.Height'/>
<widget name = 'List' />
<layout type = 'horizontal' padding = '0, 0, 16, 0'>
+ <widget name = 'ListSwitch'
+ height = 'Globals.Line.Height'
+ width = 'Globals.Line.Height'
+ />
+ <widget name = 'GridSwitch'
+ height = 'Globals.Line.Height'
+ width = 'Globals.Line.Height'
+ />
<space/>
<widget name = 'Delete'
type = 'Button'
@@ -796,6 +833,26 @@
</layout>
</dialog>
+ <dialog name = 'SavenameDialog' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '8, 8, 8, 8'>
+ <widget name = 'DescriptionText'
+ width = '180'
+ height = 'Globals.Line.Height'
+ />
+ <widget name = 'Description'
+ height = '19'
+ />
+ <layout type = 'horizontal' padding = '0, 0, 16, 0'>
+ <widget name = 'Cancel'
+ type = 'Button'
+ />
+ <widget name = 'Ok'
+ type = 'Button'
+ />
+ </layout>
+ </layout>
+ </dialog>
+
<dialog name = 'ScummHelp' overlays = 'screen'>
<layout type = 'vertical' padding = '8, 8, 8, 8'>
<widget name = 'Title'
@@ -887,4 +944,97 @@
/>
</layout>
</dialog>
+
+ <dialog name = 'Predictive' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '1, 1, 1, 1' center = 'true'>
+ <widget name = 'Headline'
+ height = 'Globals.Line.Height'
+ width = '150'
+ textalign = 'center'
+ />
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Word'
+ width = '120'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Delete'
+ width = '20'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <!-- <space size = '3' /> -->
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button1'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button2'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button3'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button4'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button5'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button6'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button7'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button8'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button9'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 0'>
+ <widget name = 'Pre'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button0'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Next'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <space size = '3' />
+ <layout type = 'horizontal' padding = '3, 3, 0, 3'>
+ <widget name = 'Add'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <!-- <space size = '22'/> -->
+ <widget name = 'Cancel'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'OK'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ </layout>
+ </dialog>
</layout_info>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index fc4c89cbcc..38352bcc2f 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index 32bd36241e..52eb683ebd 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.8:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.8.16:ScummVM Modern Theme:No Author]
diff --git a/gui/themes/scummmodern/delbtn.bmp b/gui/themes/scummmodern/delbtn.bmp
new file mode 100644
index 0000000000..7eb2f409f5
--- /dev/null
+++ b/gui/themes/scummmodern/delbtn.bmp
Binary files differ
diff --git a/gui/themes/scummmodern/grid.bmp b/gui/themes/scummmodern/grid.bmp
new file mode 100644
index 0000000000..adeb209380
--- /dev/null
+++ b/gui/themes/scummmodern/grid.bmp
Binary files differ
diff --git a/gui/themes/scummmodern/list.bmp b/gui/themes/scummmodern/list.bmp
new file mode 100644
index 0000000000..2f54a40bcd
--- /dev/null
+++ b/gui/themes/scummmodern/list.bmp
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index 5f7cc69acd..4d449f50ec 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -100,6 +100,9 @@
<bitmap filename = 'logo_small.bmp'/>
<bitmap filename = 'search.bmp'/>
<bitmap filename = 'eraser.bmp'/>
+ <bitmap filename = 'delbtn.bmp'/>
+ <bitmap filename = 'list.bmp'/>
+ <bitmap filename = 'grid.bmp'/>
</bitmaps>
<fonts>
@@ -152,7 +155,7 @@
/>
<text_color id = 'color_normal_disabled'
- color = '192, 192, 192'
+ color = '96, 96, 96'
/>
<text_color id = 'color_alternative'
@@ -186,8 +189,8 @@
<!-- <defaults fill = 'gradient' fg_color = 'white'/> -->
- <cursor file = 'cursor.bmp' hotspot = '0, 0' scale = '3'/>
- <cursor resolution = 'y<400' file = 'cursor_small.bmp' hotspot = '0, 0' scale = '3'/>
+ <cursor file = 'cursor.bmp' hotspot = '0, 0'/>
+ <cursor resolution = 'y<400' file = 'cursor_small.bmp' hotspot = '0, 0'/>
<!-- Selection (text or list items) -->
<drawdata id = 'text_selection' cache = 'false'>
@@ -335,9 +338,13 @@
<drawdata id = 'scrollbar_button_hover' cache = 'false' resolution = 'y<400'>
<drawstep func = 'roundedsq'
radius = '10'
- fill = 'none'
- fg_color = 'darkgray'
+ fill = 'gradient'
+ gradient_start = 'brightpink'
+ gradient_end = 'darkpink'
stroke = '1'
+ fg_color = 'darkred'
+ bevel = '1'
+ bevel_color = 'brightred'
/>
<drawstep func = 'triangle'
fg_color = 'shadowcolor'
@@ -346,7 +353,7 @@
height = '5'
xpos = 'right'
ypos = 'center'
- padding = '0,0,2,0'
+ padding = '0,0,1,0'
orientation = 'top'
/>
</drawdata>
@@ -735,6 +742,27 @@
/>
</drawdata>
+ <!-- Pressed button -->
+ <drawdata id = 'button_pressed' cache = 'false'>
+ <text font = 'text_button'
+ text_color = 'color_button'
+ vertical_align = 'center'
+ horizontal_align = 'center'
+ />
+ <drawstep func = 'roundedsq'
+ radius = '5'
+ stroke = '1'
+ fill = 'foreground'
+ shadow = '0'
+ factor = '0'
+ fg_color = '120, 40, 16'
+ gradient_start = '255, 0, 0'
+ gradient_end = '255, 0, 0'
+ bevel = '1'
+ bevel_color = 'black'
+ />
+ </drawdata>
+
<!-- Idle button -->
<drawdata id = 'button_idle' cache = 'false'>
<text font = 'text_button'
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 69ad9c79fa..d99d7416c2 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -39,6 +39,9 @@
<def var = 'ShowGlobalMenuLogo' value = '1'/>
<def var = 'ShowSearchPic' value = '1'/>
+ <def var = 'ShowChooserPics' value = '1'/>
+ <def var = 'ShowChooserPageDisplay' value = '1'/>
+
<def var = 'SaveLoadChooser.ExtInfo.Visible' value = '1'/>
<def var = 'KeyMapper.Spacing' value = '10'/>
@@ -49,6 +52,8 @@
<def var = 'Tooltip.XDelta' value = '16'/> <!-- basically cursor size -->
<def var = 'Tooltip.YDelta' value = '32'/>
+ <def var = 'Predictive.Button.Width' value = '60' />
+
<widget name = 'OptionsLabel'
size = '115, Globals.Line.Height'
textalign = 'right'
@@ -59,8 +64,7 @@
<widget name = 'Button'
size = '108, 24'
- />
-
+ />
<widget name = 'Slider'
size = '128, 18'
@@ -230,9 +234,6 @@
<widget name = 'grFullscreenCheckbox'
type = 'Checkbox'
/>
- <widget name = 'grDisableDitheringCheckbox'
- type = 'Checkbox'
- />
</layout>
</dialog>
@@ -642,6 +643,32 @@
</layout>
</dialog>
+ <dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget' shading = 'dim'>
+ <layout type = 'vertical' padding = '16, 16, 16, 16'>
+ <widget name = 'customOption1Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption2Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption3Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption4Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption5Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption6Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption7Checkbox'
+ type = 'Checkbox'
+ />
+ </layout>
+ </dialog>
+
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
<layout type = 'vertical' padding = '16, 16, 16, 16' center = 'true'>
<widget name = 'Logo'
@@ -783,9 +810,16 @@
<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, 0'>
+ <widget name = 'Title'
+ height = 'Globals.Line.Height'
+ />
+ <space/>
+ <widget name = 'PageDisplay'
+ width = '200'
+ height = 'Globals.Line.Height'
+ />
+ </layout>
<layout type = 'horizontal' padding = '0, 0, 0, 16' spacing = '16'>
<widget name = 'List' />
<widget name = 'Thumbnail'
@@ -794,6 +828,14 @@
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
+ <widget name = 'ListSwitch'
+ height = '20'
+ width = '20'
+ />
+ <widget name = 'GridSwitch'
+ height = '20'
+ width = '20'
+ />
<space/>
<widget name = 'Delete'
type = 'Button'
@@ -809,6 +851,27 @@
</layout>
</dialog>
+ <dialog name = 'SavenameDialog' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '8, 8, 8, 8'>
+ <widget name = 'DescriptionText'
+ width = '320'
+ height = 'Globals.Line.Height'
+ />
+ <widget name = 'Description'
+ height = '19'
+ />
+ <layout type = 'horizontal' padding = '0, 0, 16, 0'>
+ <widget name = 'Cancel'
+ type = 'Button'
+ />
+ <space size = '96'/>
+ <widget name = 'Ok'
+ type = 'Button'
+ />
+ </layout>
+ </layout>
+ </dialog>
+
<dialog name = 'ScummHelp' overlays = 'screen_center'>
<layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true'>
<widget name = 'Title'
@@ -899,5 +962,99 @@
type = 'Button'
/>
</layout>
+ </dialog>
+ <dialog name = 'Predictive' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '5, 5, 5, 5' center = 'true'>
+ <widget name = 'Headline'
+ height = 'Globals.Line.Height'
+ width = '210'
+ textalign = 'center'
+ />
+
+ <layout type = 'horizontal' padding = '5, 5, 5, 5'>
+ <widget name = 'Word'
+ width = '190'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Delete'
+ width = '20'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <space size = '5' />
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button1'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button2'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button3'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button4'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button5'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button6'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Button7'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button8'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button9'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Pre'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Button0'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Next'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ <space size = '5' />
+ <layout type = 'horizontal' padding = '3, 3, 3, 3'>
+ <widget name = 'Add'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <space size = '22'/>
+ <widget name = 'Cancel'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'OK'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Button.Height'
+ />
+ </layout>
+ </layout>
</dialog>
+
</layout_info>
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 0bfd16c1d9..4fd5bdcf40 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -31,8 +31,14 @@
<def var = 'ShowGlobalMenuLogo' value = '0'/>
<def var = 'ShowSearchPic' value = '0'/>
+ <def var = 'ShowChooserPics' value = '0'/>
+ <def var = 'ShowChooserPageDisplay' value = '0'/>
+
<def var = 'SaveLoadChooser.ExtInfo.Visible' value = '0'/>
+ <def var = 'Predictive.Button.Width' value = '45' />
+ <def var = 'Predictive.Button.Height' value = '15' />
+
<widget name = 'Button'
size = '72, 16'
/>
@@ -211,9 +217,6 @@
<widget name = 'grFullscreenCheckbox'
type = 'Checkbox'
/>
- <widget name = 'grDisableDitheringCheckbox'
- type = 'Checkbox'
- />
</layout>
</dialog>
@@ -637,6 +640,32 @@
</layout>
</dialog>
+ <dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget' shading = 'dim'>
+ <layout type = 'vertical' padding = '8, 8, 8, 8'>
+ <widget name = 'customOption1Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption2Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption3Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption4Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption5Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption6Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption7Checkbox'
+ type = 'Checkbox'
+ />
+ </layout>
+ </dialog>
+
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
<layout type = 'vertical' padding = '4, 4, 4, 4' center = 'true' spacing='2'>
<widget name = 'Title'
@@ -780,6 +809,14 @@
<widget name = 'Title' height = 'Globals.Line.Height'/>
<widget name = 'List' />
<layout type = 'horizontal' padding = '0, 0, 16, 0'>
+ <widget name = 'ListSwitch'
+ height = 'Globals.Line.Height'
+ width = 'Globals.Line.Height'
+ />
+ <widget name = 'GridSwitch'
+ height = 'Globals.Line.Height'
+ width = 'Globals.Line.Height'
+ />
<space/>
<widget name = 'Delete'
type = 'Button'
@@ -795,6 +832,26 @@
</layout>
</dialog>
+ <dialog name = 'SavenameDialog' overlays = 'screen_center'>
+ <layout type = 'vertical' padding = '8, 8, 8, 8'>
+ <widget name = 'DescriptionText'
+ width = '180'
+ height = 'Globals.Line.Height'
+ />
+ <widget name = 'Description'
+ height = '19'
+ />
+ <layout type = 'horizontal' padding = '0, 0, 16, 0'>
+ <widget name = 'Cancel'
+ type = 'Button'
+ />
+ <widget name = 'Ok'
+ type = 'Button'
+ />
+ </layout>
+ </layout>
+ </dialog>
+
<dialog name = 'ScummHelp' overlays = 'screen' inset = '8'>
<layout type = 'vertical' padding = '8, 8, 8, 8'>
<widget name = 'Title'
@@ -885,4 +942,96 @@
/>
</layout>
</dialog>
+ <dialog name = 'Predictive' overlays = 'screen_center'>
+ <layout type = 'vertical' center = 'true'>
+ <widget name = 'Headline'
+ height = 'Globals.Line.Height'
+ width = '150'
+ textalign = 'center'
+ />
+ <layout type = 'horizontal' padding = '0, 0, 2, 2'>
+ <widget name = 'Word'
+ width = '120'
+ height = 'Globals.Button.Height'
+ />
+ <widget name = 'Delete'
+ width = '20'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <!-- <space size = '3' /> -->
+ <layout type = 'horizontal' padding = '0, 0, 2, 2'>
+ <widget name = 'Button1'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button2'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button3'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '0, 0, 2, 2'>
+ <widget name = 'Button4'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button5'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button6'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '0, 0, 2, 2'>
+ <widget name = 'Button7'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button8'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button9'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '0, 0, 2, 2'>
+ <widget name = 'Pre'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Button0'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'Next'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ <space size = '2' />
+ <layout type = 'horizontal' padding = '0, 0, 2, 2'>
+ <widget name = 'Add'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <!-- <space size = '22'/> -->
+ <widget name = 'Cancel'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ <widget name = 'OK'
+ width = 'Globals.Predictive.Button.Width'
+ height = 'Globals.Predictive.Button.Height'
+ />
+ </layout>
+ </layout>
+ </dialog>
</layout_info>
diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat
index 65ca204393..1c3abf84a8 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 0e2fd248b1..4ffb63e945 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -30,6 +30,8 @@
#include "gui/ThemeEval.h"
+#include "gui/dialog.h"
+
namespace GUI {
Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip)
@@ -77,6 +79,8 @@ void Widget::updateState(int oldFlags, int newFlags) {
_state = ThemeEngine::kStateEnabled;
if (newFlags & WIDGET_HILITED)
_state = ThemeEngine::kStateHighlight;
+ if (newFlags & WIDGET_PRESSED)
+ _state = ThemeEngine::kStatePressed;
} else {
_state = ThemeEngine::kStateDisabled;
}
@@ -272,7 +276,7 @@ void StaticTextWidget::drawWidget() {
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &label, const char *tooltip, uint32 cmd, uint8 hotkey)
: StaticTextWidget(boss, x, y, w, h, cleanupHotkey(label), Graphics::kTextAlignCenter, tooltip), CommandSender(boss),
- _cmd(cmd), _hotkey(hotkey) {
+ _cmd(cmd), _hotkey(hotkey), _lastTime(0) {
if (hotkey == 0)
_hotkey = parseHotkey(label);
@@ -283,7 +287,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Co
ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Common::String &label, const char *tooltip, uint32 cmd, uint8 hotkey)
: StaticTextWidget(boss, name, cleanupHotkey(label), tooltip), CommandSender(boss),
- _cmd(cmd) {
+ _cmd(cmd), _lastTime(0) {
if (hotkey == 0)
_hotkey = parseHotkey(label);
setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
@@ -291,8 +295,14 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Co
}
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
- if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
+ if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) {
+ startAnimatePressedState();
sendCommand(_cmd, 0);
+ }
+}
+
+void ButtonWidget::handleMouseDown(int x, int y, int button, int clickCount) {
+ setPressedState();
}
void ButtonWidget::drawWidget() {
@@ -324,6 +334,44 @@ ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32
return button;
}
+void ButtonWidget::setHighLighted(bool enable) {
+ (enable) ? setFlags(WIDGET_HILITED) : clearFlags(WIDGET_HILITED);
+ draw();
+}
+
+void ButtonWidget::handleTickle() {
+ if (_lastTime) {
+ uint32 curTime = g_system->getMillis();
+ if (curTime - _lastTime > kPressedButtonTime) {
+ stopAnimatePressedState();
+ }
+ }
+}
+
+void ButtonWidget::setPressedState() {
+ wantTickle(true);
+ setFlags(WIDGET_PRESSED);
+ draw();
+}
+
+void ButtonWidget::stopAnimatePressedState() {
+ wantTickle(false);
+ _lastTime = 0;
+ clearFlags(WIDGET_PRESSED);
+ draw();
+}
+
+void ButtonWidget::startAnimatePressedState() {
+ _lastTime = g_system->getMillis();
+}
+
+void ButtonWidget::wantTickle(bool tickled) {
+ if (tickled)
+ ((GUI::Dialog *)_boss)->setTickleWidget(this);
+ else
+ ((GUI::Dialog *)_boss)->unSetTickleWidget();
+}
+
#pragma mark -
PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd, uint8 hotkey)
@@ -336,7 +384,7 @@ PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, co
PicButtonWidget::PicButtonWidget(GuiObject *boss, const Common::String &name, const char *tooltip, uint32 cmd, uint8 hotkey)
: ButtonWidget(boss, name, "", tooltip, cmd, hotkey),
- _alpha(256), _transparency(false) {
+ _gfx(), _alpha(256), _transparency(false) {
setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
_type = kButtonWidget;
}
@@ -351,19 +399,44 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) {
if (!gfx || !gfx->pixels)
return;
+ if (gfx->format.bytesPerPixel == 1) {
+ warning("PicButtonWidget::setGfx got paletted surface passed");
+ return;
+ }
+
+
if (gfx->w > _w || gfx->h > _h) {
warning("PicButtonWidget has size %dx%d, but a surface with %dx%d is to be set", _w, _h, gfx->w, gfx->h);
return;
}
- // TODO: add conversion to OverlayColor
_gfx.copyFrom(*gfx);
}
+void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) {
+ if (w == -1)
+ w = _w;
+ if (h == -1)
+ h = _h;
+
+ const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
+
+ _gfx.free();
+ _gfx.create(w, h, requiredFormat);
+ _gfx.fillRect(Common::Rect(0, 0, w, h), _gfx.format.RGBToColor(r, g, b));
+}
+
void PicButtonWidget::drawWidget() {
g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags());
- if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) {
+ if (_gfx.pixels) {
+ // Check whether the set up surface needs to be converted to the GUI
+ // color format.
+ const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
+ if (_gfx.format != requiredFormat) {
+ _gfx.convertToInPlace(requiredFormat);
+ }
+
const int x = _x + (_w - _gfx.w) / 2;
const int y = _y + (_h - _gfx.h) / 2;
@@ -576,12 +649,16 @@ void GraphicsWidget::setGfx(const Graphics::Surface *gfx) {
if (!gfx || !gfx->pixels)
return;
+ if (gfx->format.bytesPerPixel == 1) {
+ warning("GraphicsWidget::setGfx got paletted surface passed");
+ return;
+ }
+
if (gfx->w > _w || gfx->h > _h) {
warning("GraphicsWidget has size %dx%d, but a surface with %dx%d is to be set", _w, _h, gfx->w, gfx->h);
return;
}
- // TODO: add conversion to OverlayColor
_gfx.copyFrom(*gfx);
}
@@ -591,22 +668,22 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
if (h == -1)
h = _h;
- Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
+ const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
_gfx.free();
- _gfx.create(w, h, overlayFormat);
-
- OverlayColor *dst = (OverlayColor *)_gfx.pixels;
- OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b);
- while (h--) {
- for (int i = 0; i < w; ++i) {
- *dst++ = fillCol;
- }
- }
+ _gfx.create(w, h, requiredFormat);
+ _gfx.fillRect(Common::Rect(0, 0, w, h), _gfx.format.RGBToColor(r, g, b));
}
void GraphicsWidget::drawWidget() {
- if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) {
+ if (_gfx.pixels) {
+ // Check whether the set up surface needs to be converted to the GUI
+ // color format.
+ const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
+ if (_gfx.format != requiredFormat) {
+ _gfx.convertToInPlace(requiredFormat);
+ }
+
const int x = _x + (_w - _gfx.w) / 2;
const int y = _y + (_h - _gfx.h) / 2;
@@ -626,6 +703,26 @@ ContainerWidget::ContainerWidget(GuiObject *boss, const Common::String &name) :
_type = kContainerWidget;
}
+ContainerWidget::~ContainerWidget() {
+ // We also remove the widget from the boss to avoid segfaults, when the
+ // deleted widget is an active widget in the boss.
+ for (Widget *w = _firstWidget; w; w = w->next()) {
+ _boss->removeWidget(w);
+ }
+}
+
+Widget *ContainerWidget::findWidget(int x, int y) {
+ return findWidgetInChain(_firstWidget, x, y);
+}
+
+void ContainerWidget::removeWidget(Widget *widget) {
+ // We also remove the widget from the boss to avoid a reference to a
+ // widget not in the widget chain anymore.
+ _boss->removeWidget(widget);
+
+ Widget::removeWidget(widget);
+}
+
void ContainerWidget::drawWidget() {
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, ThemeEngine::kWidgetBackgroundBorder);
}
diff --git a/gui/widget.h b/gui/widget.h
index 789fc09231..e3f712564f 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -38,6 +38,7 @@ enum {
WIDGET_INVISIBLE = 1 << 1,
WIDGET_HILITED = 1 << 2,
WIDGET_BORDER = 1 << 3,
+ WIDGET_PRESSED = 1 << 4,
//WIDGET_INV_BORDER = 1 << 4,
WIDGET_CLEARBG = 1 << 5,
WIDGET_WANT_TICKLE = 1 << 7,
@@ -73,6 +74,10 @@ enum {
kCaretBlinkTime = 300
};
+enum {
+ kPressedButtonTime = 200
+};
+
/* Widget */
class Widget : public GuiObject {
friend class Dialog;
@@ -83,7 +88,7 @@ protected:
uint16 _id;
bool _hasFocus;
ThemeEngine::WidgetStateInfo _state;
- const char *_tooltip;
+ Common::String _tooltip;
private:
uint16 _flags;
@@ -137,7 +142,9 @@ public:
uint8 parseHotkey(const Common::String &label);
Common::String cleanupHotkey(const Common::String &label);
- const char *getTooltip() const { return _tooltip; }
+ bool hasTooltip() const { return !_tooltip.empty(); }
+ const Common::String &getTooltip() const { return _tooltip; }
+ void setTooltip(const Common::String &tooltip) { _tooltip = tooltip; }
protected:
void updateState(int oldFlags, int newFlags);
@@ -189,11 +196,22 @@ public:
void setLabel(const Common::String &label);
void handleMouseUp(int x, int y, int button, int clickCount);
+ void handleMouseDown(int x, int y, int button, int clickCount);
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
- void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); }
+ void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED | WIDGET_PRESSED); draw(); }
+ void handleTickle();
+
+ void setHighLighted(bool enable);
+ void setPressedState();
+ void startAnimatePressedState();
+ void stopAnimatePressedState();
+ void lostFocusWidget() { stopAnimatePressedState(); }
protected:
void drawWidget();
+ void wantTickle(bool tickled);
+private:
+ uint32 _lastTime;
};
/* PicButtonWidget */
@@ -204,6 +222,7 @@ public:
~PicButtonWidget();
void setGfx(const Graphics::Surface *gfx);
+ void setGfx(int w, int h, int r, int g, int b);
void useAlpha(int alpha) { _alpha = alpha; }
void useThemeTransparency(bool enable) { _transparency = enable; }
@@ -349,7 +368,10 @@ class ContainerWidget : public Widget {
public:
ContainerWidget(GuiObject *boss, int x, int y, int w, int h);
ContainerWidget(GuiObject *boss, const Common::String &name);
+ ~ContainerWidget();
+ virtual Widget *findWidget(int x, int y);
+ virtual void removeWidget(Widget *widget);
protected:
void drawWidget();
};
diff --git a/gui/widgets/editable.h b/gui/widgets/editable.h
index 4b51ac9145..4a18d5e689 100644
--- a/gui/widgets/editable.h
+++ b/gui/widgets/editable.h
@@ -70,18 +70,17 @@ public:
virtual void handleTickle();
virtual bool handleKeyDown(Common::KeyState state);
-
virtual void reflowLayout();
+ bool setCaretPos(int newPos);
+
protected:
virtual void startEditMode() = 0;
virtual void endEditMode() = 0;
virtual void abortEditMode() = 0;
-
virtual Common::Rect getEditRect() const = 0;
virtual int getCaretOffset() const;
void drawCaret(bool erase);
- bool setCaretPos(int newPos);
bool adjustOffset();
void makeCaretVisible();
diff --git a/gui/widgets/list.h b/gui/widgets/list.h
index 41fae37a71..47613b79f3 100644
--- a/gui/widgets/list.h
+++ b/gui/widgets/list.h
@@ -105,6 +105,7 @@ public:
void scrollTo(int item);
void scrollToEnd();
+ int getCurrentScrollPos() const { return _currentPos; }
void enableQuickSelect(bool enable) { _quickSelect = enable; }
String getQuickSelectString() const { return _quickSelectStr; }
diff --git a/po/POTFILES b/po/POTFILES
index 33492c0c6f..72c6fb1d18 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -10,7 +10,7 @@ gui/KeysDialog.cpp
gui/launcher.cpp
gui/massadd.cpp
gui/options.cpp
-gui/saveload.cpp
+gui/saveload-dialog.cpp
gui/themebrowser.cpp
gui/ThemeEngine.cpp
gui/widget.cpp
@@ -23,6 +23,10 @@ common/util.cpp
engines/advancedDetector.cpp
engines/dialogs.cpp
engines/engine.cpp
+engines/agi/detection.cpp
+engines/agi/saveload.cpp
+engines/dreamweb/detection.cpp
+engines/sci/detection.cpp
engines/scumm/dialogs.cpp
engines/scumm/help.cpp
engines/scumm/scumm.cpp
@@ -37,14 +41,19 @@ engines/gob/inter_playtoons.cpp
engines/gob/inter_v2.cpp
engines/gob/inter_v5.cpp
engines/groovie/script.cpp
+engines/kyra/detection.cpp
engines/kyra/lol.cpp
engines/kyra/sound_midi.cpp
+engines/queen/queen.cpp
engines/sky/compact.cpp
+engines/sky/detection.cpp
engines/sword1/animation.cpp
engines/sword1/control.cpp
engines/sword1/logic.cpp
engines/sword1/sword1.cpp
engines/sword2/animation.cpp
+engines/sword2/sword2.cpp
+engines/teenagent/resources.cpp
engines/tinsel/saveload.cpp
engines/parallaction/saveload.cpp
diff --git a/po/ca_ES.po b/po/ca_ES.po
index 4c0ad8bbbe..da2586a2af 100644
--- a/po/ca_ES.po
+++ b/po/ca_ES.po
@@ -5,16 +5,16 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: ScummVM 1.3.0svn\n"
+"Project-Id-Version: ScummVM 1.6.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-10-04 20:51+0100\n"
+"POT-Creation-Date: 2012-08-27 15:46+0200\n"
+"PO-Revision-Date: 2012-08-26 20:32+0100\n"
"Last-Translator: Jordi Vilalta Prat <jvprat@jvprat.com>\n"
"Language-Team: Catalan <scummvm-devel@lists.sf.net>\n"
+"Language: Catalan\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Catalan\n"
#: gui/about.cpp:91
#, c-format
@@ -43,11 +43,12 @@ msgid "Go up"
msgstr "Amunt"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:847
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -68,16 +69,15 @@ msgstr "Tanca"
msgid "Mouse click"
msgstr "Clic del ratolí"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Mostra el teclat"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Assigna les tecles"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Commuta la pantalla completa"
@@ -89,18 +89,18 @@ msgstr "Sel·leccioneu una acció a assignar"
msgid "Map"
msgstr "Assigna"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:848 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:558 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:519 engines/sword1/animation.cpp:540
+#: engines/sword1/animation.cpp:550 engines/sword1/animation.cpp:557
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:419 engines/sword2/animation.cpp:439
+#: engines/sword2/animation.cpp:449 engines/sword2/animation.cpp:458
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "D'acord"
@@ -127,15 +127,15 @@ msgstr "Seleccioneu una acció"
msgid "Press the key to associate"
msgstr "Premeu la tecla a associar"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Joc"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "Identificador:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -143,29 +143,29 @@ msgstr ""
"Identificador de joc curt utilitzat per referir-se a les partides i per "
"executar el joc des de la línia de comandes"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Nom:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Títol complet del joc"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Nom:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Idioma:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -173,283 +173,287 @@ msgstr ""
"Idioma del joc. Això no convertirà la vostra versió Espanyola del joc a "
"Anglès"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<per defecte>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plataforma:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plataforma per la que el joc es va dissenyar originalment"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Platafor.:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Gràfics"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Fer canvis sobre les opcions globals de gràfics"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Canviar les opcions de gràfics"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Àudio"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Fer canvis sobre les opcions globals d'àudio"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Canviar les opcions d'àudio"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volum"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volum"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Fer canvis sobre les opcions globals de volum"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Canviar les opcions de volum"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Fer canvis sobre les opcions globals de MIDI"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Canviar les opcions de MIDI"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Fer canvis sobre les opcions globals de MT-32"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Canviar les opcions de MT-32"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Camins"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Camins"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Camí del joc:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Camí joc:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Camí extra:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Especifica el camí de dades addicionals utilitzades pel joc"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Camí extra:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Camí de partides:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Especifica on es desaran les partides"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Partides:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Cap"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Per defecte"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Seleccioneu el fitxer SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Seleccioneu el directori amb les dades del joc"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Seleccioneu el directori addicional del joc"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Seleccioneu el directori de les partides desades"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr ""
"Aquest identificador de joc ja està en ús. Si us plau, trieu-ne un altre."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~T~anca"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Surt de ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "~Q~uant a..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Quant a ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~pcions..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Canvia les opcions globals de ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~I~nicia"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Iniciant el joc seleccionat"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~C~arrega..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Carrega una partida pel joc seleccionat"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~A~fegeix Joc..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Mantingueu premut Shift per a l'Addició Massiva"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~E~dita Joc..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Canvia les opcions del joc"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~S~uprimeix Joc"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr ""
"Elimina un joc de la llista. Els fitxers de dades del joc es mantenen "
"intactes"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~A~fegeix Joc..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~E~dita Joc..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~S~uprimeix"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Cerca a la llista de jocs"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Cerca:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Carrega partida:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Carrega"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -457,7 +461,7 @@ msgstr ""
"Esteu segur que voleu executar el detector massiu de jocs? Això pot afegir "
"una gran quantitat de jocs."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -465,7 +469,7 @@ msgstr ""
msgid "Yes"
msgstr "Sí"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -473,37 +477,37 @@ msgstr "Sí"
msgid "No"
msgstr "No"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM no ha pogut obrir el directori especificat!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM no ha pogut trobar cap joc al directori especificat!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Seleccioneu el joc:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Realment voleu suprimir la configuració d'aquest joc?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Aquest joc no suporta la càrrega de partides des del llançador."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM no ha pogut trobar cap motor capaç d'executar el joc seleccionat!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Afegeix Jocs"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Addició Massiva..."
@@ -571,101 +575,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Cap"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "No s'han pogut aplicar alguns canvis de les opcions gràfiques:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "no s'ha pogut canviar el mode de vídeo"
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "no s'ha pogut canviar l'ajust de pantalla completa"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "no s'ha pogut canviar l'ajust de la correcció d'aspecte"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Mode gràfic:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Mode de pintat:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Modes de tramat especials suportats per alguns jocs"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Mode pantalla completa"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Correcció de la relació d'aspecte"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Corregeix la relació d'aspecte per jocs de 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Elimina el tramat d'EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Activa l'eliminació del tramat en els jocs EGA que ho suportin"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Disp. preferit:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Disp. de música:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Especifica el dispositiu de so o l'emulador de tarja de so preferit"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Especifica el dispositiu de so o l'emulador de tarja de so de sortida"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Disp. preferit:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Disp. de música:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "Emulador AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib s'utilitza per la música de molts jocs"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Freq. sortida:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -673,63 +669,63 @@ msgstr ""
"Valors més alts especifiquen millor qualitat de so però pot ser que la "
"vostra tarja de so no ho suporti"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "Dispositiu GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr ""
"Especifica el dispositiu de so per defecte per a la sortida General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "No utilitzis música General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Utilitza el primer dispositiu disponible"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "Fitxer SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "Algunes targes de so, Fluidsynth i Timidity suporten SoundFont"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Mode combinat AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Utilitza MIDI i la generació de so AdLib alhora"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Guany MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Disposit. MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Especifica el dispositiu de so per defecte per a la sortida de Roland MT-32/"
"LAPC1/CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Roland MT-32 real (desactiva l'emulació GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -737,196 +733,196 @@ msgstr ""
"Marqueu si voleu utilitzar el vostre dispositiu hardware real de so "
"compatible amb Roland connectat al vostre ordinador"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Roland MT-32 real (sense emulació GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Activa el Mode Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"Desactiva la conversió General MIDI pels jocs que tenen banda sonora per a "
"Roland MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "No utilitzis música de Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Text i Veus:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Veus"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Subtítols"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Ambdós"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Velocitat de subt.:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Text i Veus:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Veus"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Subt"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Ambdós"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Mostra els subtítols i reprodueix la veu"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Veloc. de subt.:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Volum de música:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Volum de música:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Silenciar tot"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Volum d'efectes:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volum dels sons d'efectes especials"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Volum d'efectes:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Volum de veus:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Volum de veus:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Camí dels temes:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Camí temes:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"Especifica el camí de les dades addicionals utilitzades per tots els jocs o "
"pel ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Camí dels connectors:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Camí de connectors:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Misc"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Misc"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "Pintat GUI:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Desat automàtic:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Auto-desat:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Tecles"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Idioma GUI:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Idioma de la interfície d'usuari de ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Heu de reiniciar ScummVM perquè tots els canvis tinguin efecte."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Seleccioneu el directori de les partides desades"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr ""
"No es pot escriure al directori seleccionat. Si us plau, escolliu-ne un "
"altre."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Seleccioneu el directori dels temes"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Seleccioneu el directori dels fitxers extra"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Seleccioneu el directori dels connectors"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -934,104 +930,137 @@ msgstr ""
"El tema que heu seleccionat no suporta l'idioma actual. Si voleu utilitzar "
"aquest tema primer haureu de canviar a un altre idioma."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr "Vista de llistat"
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr "Vista de quadrícula"
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "No hi ha data desada"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "No hi ha hora desada"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "No hi ha temps de joc desat"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Suprimeix"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Realment voleu suprimir aquesta partida?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:800
msgid "Date: "
msgstr "Data: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:806
msgid "Time: "
msgstr "Hora: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:814
msgid "Playtime: "
msgstr "Temps de joc: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Partida sense títol"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr "Següent"
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr "Anterior"
+
+#: gui/saveload-dialog.cpp:688
+msgid "New Save"
+msgstr "Nova partida desada"
+
+#: gui/saveload-dialog.cpp:688
+msgid "Create a new save game"
+msgstr "Crea una nova partida desada"
+
+#: gui/saveload-dialog.cpp:793
+msgid "Name: "
+msgstr "Nom: "
+
+#: gui/saveload-dialog.cpp:865
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr "Entreu la descripció per l'espai %d:"
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Seleccioneu un Tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX desactivats"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX desactivats"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Pintat estàndard (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Estàndard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Pintat amb antialias (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Amb antialias (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Neteja el valor"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "El motor no suporta el nivell de depuració '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menú"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausa"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Salta la línia"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Error al executar el joc:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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"
@@ -1099,17 +1128,17 @@ msgstr "Cancel·lat per l'usuari"
msgid "Unknown error"
msgstr "Error desconegut"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "El joc a '%s' sembla ser desconegut."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
"Informeu de la següent informació a l'equip de ScummVM juntament amb el"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "nom del joc que heu provat d'afegir i la seva versió/llengua/etc.:"
@@ -1137,22 +1166,23 @@ msgstr "~A~juda"
msgid "~A~bout"
msgstr "~Q~uant a"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~R~etorna al Llançador"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~R~etorna al Llançador"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Desa la partida:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1161,7 +1191,7 @@ msgstr "Desa la partida:"
msgid "Save"
msgstr "Desa"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1170,26 +1200,26 @@ msgstr ""
"Aquest motor no ofereix ajuda dins el joc. Consulteu el fitxer README per a "
"la informació bàsica i les instruccions sobre com obtenir més assistència."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Aquest motor no ofereix ajuda dins el joc. Consulteu el fitxer README per a "
-"la informació bàsica i les instruccions sobre com obtenir més assistència."
+"No s'ha pogut desar la partida (%s)! Consulteu el fitxer README per a la "
+"informació bàsica i les instruccions sobre com obtenir més assistència."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~D~'acord"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~C~ancel·la"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~ecles"
@@ -1238,13 +1268,13 @@ msgstr ""
"Consulteu el fitxer README per a més detalls."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Aquest motor no ofereix ajuda dins el joc. Consulteu el fitxer README per a "
-"la informació bàsica i les instruccions sobre com obtenir més assistència."
+"No s'ha pogut carregar la partida (%s)! Consulteu el fitxer README per a la "
+"informació bàsica i les instruccions sobre com obtenir més assistència."
#: engines/engine.cpp:439
msgid ""
@@ -1260,6 +1290,92 @@ msgstr ""
msgid "Start anyway"
msgstr "Inicia de totes maneres"
+#: engines/agi/detection.cpp:142 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Utilitza les pantalles originals de desat/càrrega"
+
+#: engines/agi/detection.cpp:143 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"Utilitza les pantalles originals de desat/càrrega, en lloc de les de ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Recupera la partida:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Restaura"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Utilitza el mode de paleta brillant"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Mostra els gràfics utilitzant la paleta brillant del joc"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Elimina el tramat d'EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Activa l'eliminació del tramat en els jocs EGA"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Prefereix efectes de so digitals"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Prefereix els efectes de so digitals en lloc dels sintetitzats"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Utilitza IMF/Yamaha FB-01 per la sortida MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Utilitza una tarja IBM Music Feature o un mòdul sintetitzador Yamaha FB-01 "
+"FM per la sortida MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Utilitza l'àudio del CD"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+"Utilitza l'àudio del CD en lloc de l'àudio intern del joc, si està disponible"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Utilitza els cursors de Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Utilitza els cursors de Windows (més petits i en blanc i negre) en lloc dels "
+"de DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Utilitza cursors platejats"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Utilitza el conjunt alternatiu de cursors platejats, en lloc dels normals "
+"daurats"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1376,24 +1492,23 @@ msgstr "Veus i sub."
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Seleccioneu el nivell de competència."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Consulteu el manual de Loom(TM) per ajuda."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Estàndard (16bpp)"
+msgstr "Estàndard"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Pràctica"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Expert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1917,7 +2032,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:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1928,7 +2043,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1939,7 +2054,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1950,7 +2065,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1986,25 +2101,17 @@ msgstr "~M~enú Principal"
msgid "~W~ater Effect Enabled"
msgstr "~E~fecte de l'aigua activat"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Recupera la partida:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Restaura"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:557
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "No s'ha pogut desar l'estat del joc al fitxer."
@@ -2016,67 +2123,119 @@ msgstr "No s'ha pogut esborrar el fitxer."
msgid "Failed to save game"
msgstr "No s'ha pogut desar l'estat del joc"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Públic"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Activa el públic"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Suport per saltar text i escenes"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Permet que se saltin textos i escenes"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Mode heli"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Activa el mode heli"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Desplaçament suau"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Activa el desplaçament suau al caminar"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Cursor flotant"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Activa els cursors flotants"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Barra gràfica de PI"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Activa la barra gràfica dels punts d'impacte"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Atac 1"
#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Atac 2"
#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Atac 3"
#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Mou endavant"
#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Mou enrere"
#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Mou a l'esquerra"
#: engines/kyra/lol.cpp:484
-#, fuzzy
msgid "Slide Right"
-msgstr "Dreta"
+msgstr "Mou a la dreta"
#: engines/kyra/lol.cpp:485
-#, fuzzy
msgid "Turn Left"
-msgstr "Apaga"
+msgstr "Gira a l'esquerra"
#: engines/kyra/lol.cpp:486
-#, fuzzy
msgid "Turn Right"
-msgstr "Cursor Dreta"
+msgstr "Gira a la dreta"
#: engines/kyra/lol.cpp:487
-#, fuzzy
msgid "Rest"
-msgstr "Restaura"
+msgstr "Descansa"
#: engines/kyra/lol.cpp:488
-#, fuzzy
msgid "Options"
-msgstr "~O~pcions"
+msgstr "Opcions"
#: engines/kyra/lol.cpp:489
-#, fuzzy
msgid "Choose Spell"
-msgstr "Escull"
+msgstr "Escull l'encanteri"
#: engines/kyra/sound_midi.cpp:475
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Sembla que esteu utilitzant un dispositiu General\n"
"MIDI, però el joc només suporta MIDI de Roland\n"
@@ -2084,6 +2243,14 @@ msgstr ""
"Roland MT32 als de General MIDI. És possible\n"
"que algunes pistes no es reprodueixin correctament."
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr "Introducció alternativa"
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Utilitza una introducció del joc alternativa (només per la versió CD)"
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
@@ -2100,22 +2267,31 @@ msgstr ""
"El fitxer \"sky.cpt\" té una mida incorrecta.\n"
"Torneu a baixar-lo de www.scummvm.org"
-#: engines/sword1/animation.cpp:539
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Introducció de disquets"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr ""
+"Utilitza la introducció de la versió de disquets (només per a la versió CD)"
+
+#: engines/sword1/animation.cpp:519
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "L'escena '%s' de PSX no es pot reproduir en mode paleta"
-#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
+#: engines/sword1/animation.cpp:540 engines/sword2/animation.cpp:439
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:570 engines/sword2/animation.cpp:465
+#: engines/sword1/animation.cpp:550 engines/sword2/animation.cpp:449
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Les escenes MPEG2 ja no estan suportades"
-#: engines/sword1/animation.cpp:576 engines/sword2/animation.cpp:473
+#: engines/sword1/animation.cpp:556 engines/sword2/animation.cpp:457
#, c-format
msgid "Cutscene '%s' not found"
msgstr "No s'ha trobat l'escena '%s'"
@@ -2159,13 +2335,33 @@ msgstr "Mantingues el nou"
msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Aquest és el final de la Demo del Broken Sword 1"
-#: engines/sword2/animation.cpp:435
-#, fuzzy
+#: engines/sword2/animation.cpp:419
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"S'han trobat escenes en DXA, però s'ha compilat el ScummVM sense suport de "
-"zlib"
+"S'han trobat escenes de PSX, però s'ha compilat el ScummVM sense suport de "
+"color RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Mostra les etiquetes dels objectes"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Mostra etiquetes al posar el ratolí sobre els objectes"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr "Us falta el fitxer 'teenagent.dat'. Obteniu-lo a la pàgina de ScummVM"
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+"El fitxer teenagent.dat està comprimit però aquest executable no conté zlib. "
+"Descomprimiu-lo, si us plau."
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2176,15 +2372,15 @@ msgstr ""
"No s'ha pogut desar a l'espai %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Carregant la partida..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Desant la partida..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2201,11 +2397,11 @@ msgstr ""
"Premeu D'Acord per convertir-les ara, en cas contrari se us tornarà a "
"demanar la propera vegada.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM ha convertit satisfactòriament totes les partides desades."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2307,9 +2503,8 @@ msgid "Keymap:"
msgstr "Assignacions de teclat:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
-msgstr " (Actiu)"
+msgstr " (Efectiu)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
@@ -2317,7 +2512,7 @@ msgstr " (Actiu)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Bloquejat)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2403,27 +2598,27 @@ msgstr "Alta qualitat d'àudio (més lent) (reiniciar)"
msgid "Disable power off"
msgstr "Desactiva l'apagat automàtic"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "S'ha activat el mode de clic-i-arrossega."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "S'ha desactivat el mode clic-i-arrossega."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Mode Touchpad activat."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Mode Touchpad desactivat."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Mode clic"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2431,12 +2626,11 @@ msgstr ""
msgid "Left Click"
msgstr "Clic esquerre"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Element mig esquerre"
+msgstr "Clic central"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2473,34 +2667,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal (no escalat)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "S'ha desactivat la correcció de la relació d'aspecte"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Filtre de gràfics actiu:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Mode de finestra"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Conserva"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
@@ -2840,37 +3034,37 @@ msgstr "Llançador"
msgid "Do you really want to quit?"
msgstr "Estàs segur de voler sortir?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "'Mode Toc' de pantalla tàctil - Clic esquerre"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "'Mode Toc' de pantalla tàctil - Clic dret"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "'Mode Toc' de pantalla tàctil - Flotant (sense clic)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Volum màxim"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Pujant el volum"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Volum mínim"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Baixant el volum"
@@ -2909,20 +3103,3 @@ msgstr "Clicat activat"
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Clicat desactivat"
-
-#~ msgid "Hercules Green"
-#~ msgstr "Hercules Verd"
-
-#~ msgid "Hercules Amber"
-#~ msgstr "Hercules Àmbar"
-
-#~ msgctxt "lowres"
-#~ msgid "Hercules Green"
-#~ msgstr "Hercules Verd"
-
-#~ msgctxt "lowres"
-#~ msgid "Hercules Amber"
-#~ msgstr "Hercules Àmbar"
-
-#~ msgid "Save game failed!"
-#~ msgstr "No s'ha pogut desar la partida!"
diff --git a/po/cs_CZ.po b/po/cs_CZ.po
index feca25ee9c..107be45398 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: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2012-02-17 16:28+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-08 18:03+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"
@@ -27,7 +27,7 @@ msgstr "(sestaveno %s)"
#: gui/about.cpp:98
msgid "Features compiled in:"
-msgstr "Zakompilované Funkce:"
+msgstr "Zakompilované funkce:"
#: gui/about.cpp:107
msgid "Available engines:"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "Jít nahoru"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,15 +73,15 @@ msgstr "Zavøít"
msgid "Mouse click"
msgstr "Kliknutí my¹í"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Zobrazit klávesnici"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Pøemapovat klávesy"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Pøepnout celou obrazovku"
@@ -92,18 +93,18 @@ msgstr "Zvolte èinnost k mapování"
msgid "Map"
msgstr "Mapovat"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -130,15 +131,15 @@ msgstr "Prosím vyberte èinnost"
msgid "Press the key to associate"
msgstr "Zmáèknìte klávesu pro pøiøazení"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Hra"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -146,308 +147,312 @@ msgstr ""
"Krátký identifikátor her, pou¾ívaný jako odkaz k ulo¾eným hrám a spu¹tìní "
"hry z pøíkazového øádku"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Jméno"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Úplný název hry"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Jméno:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Jazyk:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr "Jazyk hry. Toto z Va¹í ©panìlské verze neudìlá Anglickou"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<výchozí>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Platforma:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Platforma, pro kterou byla hra pùvodnì vytvoøena"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Platforma:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Jádro"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Obraz"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Potlaèit globální nastavení obrazu"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Potlaèit globální nastavení obrazu"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Zvuk"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Potlaèit globální nastavení zvuku"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Potlaèit globální nastavení zvuku"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Hlasitost"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Hlasitost"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Potlaèit globální nastavení hlasitosti"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Potlaèit globální nastavení hlasitosti"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Potlaèit globální nastavení MIDI"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Potlaèit globální nastavení MIDI"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Potlaèit globální nastavení MT-32"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Potlaèit globální nastavení MT-32"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Cesty"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Cesty"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Cesta Hry:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Cesta Hry:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Dodateèná Cesta:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Stanoví cestu pro dodateèná data pou¾itá ve høe"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Dodateèná Cesta:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Cesta pro ulo¾ení:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
-msgstr "Stanovuje, kam jsou umístìny Va¹e ulo¾ené hry"
+msgstr "Stanovuje, kam jsou umístìny va¹e ulo¾ené hry"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Cesta pro ulo¾ení:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "®ádné"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Výchozí"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Vybrat SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Vyberte adresáø s daty hry"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Vyberte dodateèný adresáø hry"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Vyberte adresáø pro ulo¾ené hry"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Toto ID hry je u¾ zabrané. Vyberte si, prosím, jiné."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~U~konèit"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Ukonèit ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "~O~ Programu..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "O ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~V~olby..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Zmìnit globální volby ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~pustit"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Spustit zvolenou hru"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~N~ahrát..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Nahrát ulo¾enou pozici pro zvolenou hru"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~P~øidat hru..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Podr¾te Shift pro Hromadné Pøidání"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~U~pravit Hru..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Zmìnit volby hry"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~O~dstranit Hru"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Odstranit hru ze seznamu. Herní data zùstanou zachována"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~P~øidat hru..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~U~pravit hru..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~O~dstranit hru"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Hledat v seznamu her"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Hledat:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Nahrát hru:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Nahrát"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -455,7 +460,7 @@ msgstr ""
"Opravdu chcete spustit hromadnou detekci her? Toto by mohlo potenciálnì "
"pøidat velkou spoustu her. "
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -463,7 +468,7 @@ msgstr ""
msgid "Yes"
msgstr "Ano"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -471,36 +476,36 @@ msgstr "Ano"
msgid "No"
msgstr "Ne"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM nemohl tento adresáø otevøít!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM nemohl v zadaném adresáøi najít ¾ádnou hru!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Vybrat hru:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Opravdu chcete odstranit nastavení této hry?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Tato hra nepodporuje spou¹tìní her ze spou¹tìèe"
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr "ScummVM nemohl najít ¾ádné jádro schopné vybranou hru spustit!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Hromadné Pøidání..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Hromadné Pøidání..."
@@ -567,101 +572,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "®ádné"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Nelze pou¾ít nìkteré zmìny mo¾ností grafiky:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "re¾im obrazu nemohl být zmìnìn."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "nastavení celé obrazovky nemohlo být zmìnìno"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "nastavení pomìru stran nemohlo být zmìnìno"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Re¾im obrazu:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Re¾im vykreslení:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Speciální re¾imy chvìní podporované nìkterými hrami"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Re¾im celé obrazovky"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Korekce pomìru stran"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Korigovat pomìr stran pro hry 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Nerozkládání EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Povolit nerozkládání v EGA hrách, které to podporují"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Prioritní Zaøízení:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Hudební zaøízení"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Stanoví prioritní zvukové zaøízení nebo emulátor zvukové karty"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Stanoví výstupní zvukové zaøízení nebo emulátor zvukové karty"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Prioritní Zaø.:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Hudební zaøízení"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib emulátor"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib se pou¾ívá pro hudbu v mnoha hrách"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Výstup. frekvence:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -669,253 +666,253 @@ msgstr ""
"Vy¹¹í hodnota zpùsobí lep¹í kvalitu zvuku, ale nemusí být podporována Va¹i "
"zvukovou kartou"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "GM Zaøízení:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Stanoví výchozí zvukové zaøízení pro výstup General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Nepou¾ívat hudbu General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Pou¾ít první dostupné zaøízení"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
"SoundFont je podporován nìkterými zvukovými kartami, Fluidsynth a Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Smí¹ený re¾im AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Pou¾ít obì zvukové generace MIDI a AdLib"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Zesílení MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Zaøízení MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Stanoví výchozí zvukové výstupní zaøízení pro Roland MT-32/LAPC1/CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Opravdový Roland MT-32 (vypne GM emulaci)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
msgstr ""
"Za¹krtnìte, pokud chcete pou¾ít pravé hardwarové zaøízení kompatibilní s "
-"Roland, pøipojené k Va¹emu poèítaèi"
+"Roland, pøipojené k va¹emu poèítaèi"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Opravdový Roland MT-32 (¾ádná GM emulace)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Zapnout re¾im Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr "Vypne mapování General MIDI pro hry s Roland MT-32 zvukovým doprovodem"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Nepou¾ívat hudbu Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Text a Øeè"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Øeè"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Titulky"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Oba"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Rychlost titulkù:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Text a Øeè:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Øeè"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Titl"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Oba"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Zobrazit titulky a pøehrávat øeè"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Rychlost titulkù"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Hlasitost hudby"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Hlasitost hudby"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Ztlumit V¹e"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Hlasitost zvukù"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Hlasitost speciálních zvukových efektù"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Hlasitost zvukù"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Hlasitost øeèi"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Hlasitost øeèi"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Cesta ke Vzhledu:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Cesta ke Vzhledu:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Stanoví cestu k dodateèným datùm pou¾ívaná v¹emi hrami nebo ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Cesta k Pluginùm:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Cesta k Pluginùm:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Rùzné"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Rùzné"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Vzhled:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI Vykreslovaè:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autoukládání:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autoukládání:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Klávesy"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Jazyk GUI"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Jazyk GUI ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Pro pou¾ití tìchto nastavení musíte restartovat ScummVM."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Vybrat adresáø pro ulo¾ené hry"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "Do zvoleného adresáøe nelze zapisovat. Vyberte, prosím, jiný."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Vyberte adresáø pro vhledy GUI"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Vyberte adresáø pro dodateèné soubory"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Vyberte adresáø pro zásuvné moduly"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -923,104 +920,140 @@ msgstr ""
"Vzhled, který jste zvolili, nepodporuje Vá¹ souèasný jazyk. Pokud chcete "
"tento vzhled pou¾ít, musíte nejdøíve pøepnout na jiný jazyk."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Neulo¾ena ¾ádná data"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "®ádný ulo¾ený èas"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "®ádná ulo¾ená doba hraní"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Smazat"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Opravdu chcete tuto ulo¾enou hru vymazat"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Datum:"
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Èas:"
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Doba hraní:"
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Bezejmenný ulo¾ený stav"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Ulo¾it"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Nelze ulo¾it hru."
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Jméno"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Vyberte Vzhled"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX zakázáno"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX zakázáno"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standardní Vykreslovaè (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standardní (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Vykreslovaè s vyhlazenými hranami (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "S vyhlazenými hranami (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Vyèistit hodnotu"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Jádro nepodporuje úroveò ladìní '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pauza"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Pøeskoèit øádek"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Chyba pøi spu¹tìní hry:"
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr "Nelze nalézt ¾ádné jádro schopné vybranou hru spustit"
@@ -1088,16 +1121,16 @@ msgstr "Zru¹eno u¾ivatelem"
msgid "Unknown error"
msgstr "Neznámá chyba"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "Hra v '%s' se zdá být neznámá."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr "Prosím nahlaste následující data týmu ScummVM spolu se jménem"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "hry, kterou jste se pokusili pøidat a její verzi/jazyk/atd.:"
@@ -1125,22 +1158,23 @@ msgstr "~N~ápovìda"
msgid "~A~bout"
msgstr "~O~ programu"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~N~ávrat do Spou¹tìèe"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~N~ávrat do Spou¹tìèe"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Ulo¾it hru:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1149,7 +1183,7 @@ msgstr "Ulo¾it hru:"
msgid "Save"
msgstr "Ulo¾it"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1159,27 +1193,26 @@ msgstr ""
"prohlédnìte si README pro základní informace a pro instrukce jak získat "
"dal¹í pomoc."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Je nám líto, ale toto jádro v souèasnosti nepodporuje herní nápovìdu. Prosím "
-"prohlédnìte si README pro základní informace a pro instrukce jak získat "
-"dal¹í pomoc."
+"Ulo¾ení stavu hry selhalo (%s)! Prosím pøeètìte si dokumentaci pro základní "
+"informace a pokyny k získání dal¹í podpory."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~Z~ru¹it"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~K~lávesy"
@@ -1228,14 +1261,13 @@ msgstr ""
"Pro podrobnosti si pøeètìte README."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Je nám líto, ale toto jádro v souèasnosti nepodporuje herní nápovìdu. Prosím "
-"prohlédnìte si README pro základní informace a pro instrukce jak získat "
-"dal¹í pomoc."
+"Naètení stavu hry selhalo (%s)! Prosím pøeètìte si dokumentaci pro základní "
+"informace a pokyny k získání dal¹í podpory."
#: engines/engine.cpp:439
msgid ""
@@ -1251,15 +1283,95 @@ msgstr ""
msgid "Start anyway"
msgstr "Pøesto spustit"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Pou¾ít pùvodní obrazovky naètení/ulo¾ení"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr "Pou¾ít pùvodní obrazovky naètení/ulo¾ení místo ze ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Obnovit hru"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Obnovit"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Pou¾ít re¾im jasné palety"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Zobrazit grafiku pomocí jasné palety hry"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Nerozkládání EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Povolit nerozkládání v EGA hrách"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Upøednostòovat digitální zvukové efekty"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Upøednostòovat digitální zvukové efekty pøed syntetizovanými"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Pou¾ít IMF/Yamaha FB-01 pro výstup MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Pou¾ít kartu IBM Music Feature nebo modul syntetizátoru Yamaha FB-01 FM pro "
+"výstup MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Pou¾ít zvuky na CD"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Pou¾ít zvuky na CD místo ve høe, pokud je dostupné"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Pou¾ít kurzory Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr "Pou¾ít kurzory Windows (men¹í a èernobílé) místo kurzorù z DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Pou¾ít støíbrné kurzory"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr "Pou¾ít alternativní sadu støíbrných kurzorù místo standardních zlatých"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
-msgstr "Vlo¾te Disk %c a Stisknìte Tlaèítko Pro Poraèování."
+msgstr "Vlo¾te Disk %c a Stisknìte Tlaèítko Pro Pokraèování."
#: engines/scumm/dialogs.cpp:176
#, c-format
msgid "Unable to Find %s, (%c%d) Press Button."
-msgstr "Nelze Najít %s, (%c%d) Stsikìte Tlaèítko."
+msgstr "Nelze Najít %s, (%c%d) Stisknìte Tlaèítko."
#: engines/scumm/dialogs.cpp:177
#, c-format
@@ -1907,7 +2019,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:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1918,7 +2030,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1929,7 +2041,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1940,7 +2052,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1976,25 +2088,17 @@ msgstr "~H~lavní Menu"
msgid "~W~ater Effect Enabled"
msgstr "~E~fekt Vody Zapnut"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Obnovit hru"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Obnovit"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Nelze ulo¾it stav hry do souboru."
@@ -2006,6 +2110,64 @@ msgstr "Nelze smazat soubor."
msgid "Failed to save game"
msgstr "Nelze ulo¾it hru."
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Publikum ve studiu"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Povolit publikum ve studiu"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Podpora pøeskoèení"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Umo¾nit, aby text a videa mohly být pøeskoèeny"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Héliový re¾im"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Zapnout héliový re¾im"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Plynulé posunování"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Povolit plynulé posunování pøi chùzi"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Plovoucí kurzory"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Povolit plovoucí kurzory"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Sloupcový indikátor zdraví"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Povolit sloupcový indikátor zdraví"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Útok 1"
@@ -2059,14 +2221,23 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Zdá se, ¾e pou¾íváte zaøízení General MIDI,\n"
-"ale Va¹e hra podporuje pouze Roland MT32 MIDI.\n"
+"ale va¹e hra podporuje pouze Roland MT32 MIDI.\n"
"Sna¾íme se mapovat nástroje Roland MT32 na\n"
-"ty od General MIDI. Po tomto se mù¾e stát,\n"
-"¾e pár stop nebude správnì pøehráno."
+"ty od General MIDI. Je stále mo¾né, ¾e\n"
+"nìkteré stopy nebudou znít správnì."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Pou¾ít verzi úvodu z diskety (Pouze verze CD)"
#: engines/sky/compact.cpp:130
msgid ""
@@ -2084,10 +2255,18 @@ msgstr ""
"Soubor \"sky.cpt\" má nesprávnou velikost.\n"
"Stáhnìte si ho, prosím, (znovu) z www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Úvod z diskety"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Pou¾ít verzi úvodu z diskety (Pouze verze CD)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "Proud videa PSX '%s' nemù¾e být pøehrán v re¾imu palety"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2115,7 +2294,7 @@ msgstr ""
"ScummVM zjistil, ¾e máte staré ulo¾ené pozice pro Broken Sword 1, které by "
"mìly být pøevedeny.\n"
"Starý formát ulo¾ených her ji¾ není podporován, tak¾e pokud je nepøevedete, "
-"nebudete moci Va¹e hry naèíst.\n"
+"nebudete moci va¹e hry naèíst.\n"
"\n"
"Stisknìte OK, abyste je pøevedli teï, jinak budete po¾ádáni znovu, pøi "
"spu¹tìní této hry.\n"
@@ -2142,10 +2321,28 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Toto je konec Dema Broken Sword 1"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
-msgstr "Videa DXA nalezena, ale ScummVM byl sestaven bez podpory zlib"
+msgstr "Videa PSX nalezena, ale ScummVM byl sestaven bez podpory barev RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Zobrazit jmenovky objektù"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Zobrazit jmenovky objektù pøi najetí my¹i"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2156,15 +2353,15 @@ msgstr ""
"Nelze ulo¾it hru do pozice %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Nahrávání hry..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Ukládání hry..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2176,23 +2373,23 @@ msgstr ""
"ScummVM zjistil, ¾e máte staré ulo¾ené pozice pro Nippon Safes, které by "
"mìly být pøejmenovány.\n"
"Staré názvy ji¾ nejsou podporovány, tak¾e pokud je nepøevedete, nebudete "
-"moci Va¹e hry naèíst.\n"
+"moci va¹e hry naèíst.\n"
"\n"
"Stisknìte OK, abyste je pøevedli teï, jinak budete po¾ádáni pøí¹tì.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
-msgstr "ScummVM úspì¹nì pøevedl v¹echny Va¹e ulo¾ené pozice. "
+msgstr "ScummVM úspì¹nì pøevedl v¹echny va¹e ulo¾ené pozice. "
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
"\n"
"Please report to the team."
msgstr ""
-"ScummVM vytiskl nìkterá varování ve Va¹em oknì konzole a nemù¾e zaruèit, ¾e "
-"v¹echny Va¹e soubory byly pøevedeny.\n"
+"ScummVM vytiskl nìkterá varování ve va¹em oknì konzole a nemù¾e zaruèit, ¾e "
+"v¹echny va¹e soubory byly pøevedeny.\n"
"\n"
"Prosím nahlaste to týmu"
@@ -2295,7 +2492,7 @@ msgstr "(Aktivní)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Blokováno)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2381,27 +2578,27 @@ msgstr "Vysoká kvalita zvuku (pomalej¹í) (restart) "
msgid "Disable power off"
msgstr "Zakázat vypnutí"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Re¾im pøetáhnutí my¹i zapnut."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Re¾im pøetáhnutí my¹i vypnut."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Touchpad re¾im zapnut"
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Touchpad re¾im vypnut"
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr "Re¾im kliknutí"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2409,11 +2606,11 @@ msgstr "Re¾im kliknutí"
msgid "Left Click"
msgstr "Levé Kliknutí"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
msgstr "Kliknutí prostøedním tlaèítkem"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2450,34 +2647,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normální (bez zmìny velikosti)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Zakázána korekce pomìru stran"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Aktivní grafický filtr:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Re¾im do okna"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normální"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Zachovávající"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Pùvodní"
@@ -2819,37 +3016,37 @@ msgstr "Spou¹tìè"
msgid "Do you really want to quit?"
msgstr "Opravdu chcete skonèit?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "'Re¾im «uknutí' Dotykové Obrazovky - Levé Kliknutí"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "'Re¾im «uknutí' Dotykové Obrazovky - Pravé Kliknutí"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "'Re¾im «uknutí' Dotykové Obrazovky - Najetí (Bez Kliknutí)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Maximální Hlasitost"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Zvy¹uji Hlasitost"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Minimální Hlasitost"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Sni¾uji Hlasitost"
diff --git a/po/da_DA.po b/po/da_DA.po
index 59f7ae63a7..b30ef1bf02 100644
--- a/po/da_DA.po
+++ b/po/da_DA.po
@@ -6,15 +6,17 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-01-08 22:53+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-09 20:27+0100\n"
"Last-Translator: Steffen Nyeland <steffen@nyeland.dk>\n"
"Language-Team: Steffen Nyeland <steffen@nyeland.dk>\n"
+"Language: Dansk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Dansk\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-Language: Danish\n"
+"X-Poedit-Country: DENMARK\n"
#: gui/about.cpp:91
#, c-format
@@ -43,11 +45,12 @@ msgid "Go up"
msgstr "Gå op"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -68,16 +71,15 @@ msgstr "Luk"
msgid "Mouse click"
msgstr "Muse klik"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Vis tastatur"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Kortlæg taster"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Skift fuldskærm"
@@ -89,18 +91,18 @@ msgstr "Vælg en handling at kortlægge"
msgid "Map"
msgstr "Kortlæg"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -127,15 +129,15 @@ msgstr "Vælg venligst en handling"
msgid "Press the key to associate"
msgstr "Tryk tasten for at tilknytte"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Spil"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -143,29 +145,29 @@ msgstr ""
"Kort spil identifikator til brug for gemmer, og for at køre spillet fra "
"kommandolinien"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Navn:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Fuld titel på spillet"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Navn:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Sprog:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -173,280 +175,284 @@ msgstr ""
"Spillets sprog. Dette vil ikke ændre din spanske version af spillet til "
"engelsk"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<standard>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Platform:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Platform som spillet oprindeligt var designet til"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Platform:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafik"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Overstyr globale grafik indstillinger"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Overstyr globale grafik indstillinger"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Lyd"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Overstyr globale lyd indstillinger"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Overstyr globale lyd indstillinger"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Lydstyrke"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Lydstyrke"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Overstyr globale lydstyrke indstillinger"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Overstyr globale lydstyrke indstillinger"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Overstyr globale MIDI indstillinger"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Overstyr globale MIDI indstillinger"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Overstyr globale MT-32 indstillinger"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Overstyr globale MT-32 indstillinger"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Stier"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Stier"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Spil sti:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Spil sti:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Ekstra sti:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Angiver sti til ekstra data der bruges i spillet"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Ekstra sti:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Gemme sti:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Angiver hvor dine gemmer bliver lagt"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Gemme sti:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Ingen"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Standard"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Vælg SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Vælg bibliotek med spil data"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Vælg ekstra spil bibliotek"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Vælg bibliotek til spil gemmer"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Dette spil ID er allerede i brug. Vælg venligst et andet."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~A~fslut"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Slut ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "~O~m..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~I~ndstillinger..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Ændre globale ScummVM indstillinger"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~tart"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Start det valgte spil"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
-msgstr "~H~ent..."
+msgstr "Ind~l~æs..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
-msgstr "Hent gemmer for det valgte spil"
+msgstr "Indlæs gemmer for det valgte spil"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~T~ilføj spil..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Hold Skift for at tilføje flere"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~R~ediger spil..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Ændre spil indstillinger"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~F~jern spil"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Fjerner spil fra listen. Spillets data filer forbliver uberørt"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~T~ilføj spil..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~R~ediger spil..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~F~jern spil"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Søg i spil liste"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Søg:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Indlæs spil:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Indlæs"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -454,7 +460,7 @@ msgstr ""
"Vil du virkelig køre fler spils detektoren? Dette kunne potentielt tilføje "
"et stort antal spil."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -462,7 +468,7 @@ msgstr ""
msgid "Yes"
msgstr "Ja"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -470,37 +476,37 @@ msgstr "Ja"
msgid "No"
msgstr "Nej"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM kunne ikke åbne det angivne bibliotek!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM kunne ikke finde noget spil i det angivne bibliotek!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Vælg spillet:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Vil du virkelig fjerne denne spil konfiguration?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
-msgstr "Dette spil understøtter ikke hentning af spil fra spiloversigten."
+msgstr "Dette spil understøtter ikke indlæsning af spil fra spiloversigten."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM kunne ikke finde en motor, istand til at afvikle det valgte spil!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Tilføj flere..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Tilføj flere..."
@@ -515,7 +521,7 @@ msgstr "Skan gennemført!"
#: gui/massadd.cpp:261
#, c-format
msgid "Discovered %d new games, ignored %d previously added games."
-msgstr ""
+msgstr "Opdaget %d nye spil, ignorerede %d tidligere tilføjede spil."
#: gui/massadd.cpp:265
#, c-format
@@ -523,9 +529,9 @@ msgid "Scanned %d directories ..."
msgstr "Gennemset %d biblioteker ..."
#: gui/massadd.cpp:268
-#, fuzzy, c-format
+#, c-format
msgid "Discovered %d new games, ignored %d previously added games ..."
-msgstr "Fundet %d nye spil ..."
+msgstr "Fundet %d nye spil, ignorer %d tidligere tilføjede spil ..."
#: gui/options.cpp:78
msgid "Never"
@@ -567,101 +573,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Ingen"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
-msgstr ""
+msgstr "Anvendelse af ændringer for grafiske indstillinger fejlede:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
-msgstr ""
+msgstr "videotilstanden kunne ikke ændres."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
-msgstr ""
+msgstr "fuld skærm indstillingen kunne ikke ændres"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
-msgstr ""
+msgstr "billedformat indstillingen ikke kunne ændres"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Grafik tilstand:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Rendere tilstand:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Speciel farvereduceringstilstand understøttet a nogle spil"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fuldskærms tilstand"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Billedformat korrektion"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Korrekt billedformat til 320x200 spil"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA farveforøgelse"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Aktiver farveforøgelse i EGA spil der understøtter det"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Foretruk. enhed:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Musik enhed:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Angiver foretukket lyd enhed eller lydkort emulator"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Angiver lyd udgangsenhed eller lydkorts emulator"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Foretruk. enh.:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Musik enhed:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib emulator:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib bliver brugt til musik i mange spil"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Udgangsfrekvens:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -669,60 +667,60 @@ msgstr ""
"Højere værdi angiver bedre lyd kvalitet, men understøttes måske ikke af dit "
"lydkort"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "GM enhed:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
-msgstr "Angiver standard lyd enhed for General MIDI udgang"
+msgstr "Angiver standard lyd enhed for Generel MIDI-udgang"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
-msgstr "Brug ikke General MIDI musik"
+msgstr "Brug ikke Generel MIDI musik"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Brug første tilgængelig enhed"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "SoundFont er understøttet af nogle lydkort, Fluidsynth og Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Blandet AdLib/MIDI tilstand"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Brug både MIDI og AdLib lyd generering"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "MIDI lydstyrke:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "MT-32 enhed:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr "Angiver standard lyd enhed for Roland MT-32/LAPC1/CM32I/CM64 udgang"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Ægte Roland MT-32 (undlad GM emulering)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -730,191 +728,190 @@ msgstr ""
"Kontroller om du vil bruge din rigtige hardware Roland-kompatible lyd enhed "
"tilsluttet til din computer"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Ægte Roland MT-32 (ingen GM emulering)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Aktivér Roland GS tilstand"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
-msgstr "Sluk for General MIDI kortlægning for spil med Roland MT-32 lydspor"
+msgstr "Sluk for Generel MIDI kortlægning for spil med Roland MT-32 lydspor"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Brug ikke Roland MT-32 musik"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Tekst og tale:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Tale"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Undertekster"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Begge"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Tekst hastighed:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Tekst og tale:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Tale"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Tekst"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Begge"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Vis undertekster og afspil tale"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Tekst hastighed:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Musik lydstyrke:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Musik lydstyrke:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Mute alle"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "SFX lydstyrke:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Lydstyrke for specielle lydeffekter"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "SFX lydstyrke:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Tale lydstyrke:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Tale lydstyrke:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Tema sti:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Tema sti:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Angiver sti til ekstra data brugt af alle spil eller ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Plugin sti:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Plugin sti:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Andet"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Andet"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI renderer:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Auto gemme:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Auto gemme:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Taster"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Sprog:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Sprog for brugerfladen i ScummVM"
-#: gui/options.cpp:1372
-#, fuzzy
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
-msgstr "Du skal genstarte ScummVM for at ændringer vises."
+msgstr "Du skal genstarte ScummVM før dine ændringer har effekt."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Vælg bibliotek til gemmer"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "Der kan ikke skrives til det valgte bibliotek. Vælg venligst et andet."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Vælg bibliotek for GUI temaer"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Vælg bibliotek for ekstra filer"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Vælg bibliotek for plugins"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -922,123 +919,156 @@ msgstr ""
"Temaet du valgte understøtter ikke dit aktuelle sprog. Hvis du ønsker at "
"bruge dette tema, skal du skifte til et andet sprog først."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Ingen dato gemt"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Intet tidspunkt gemt"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Ingen spilletid gemt"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Slet"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Vil du virkelig slette denne gemmer?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Dato:"
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Tid:"
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Spilletid:"
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Unavngivet gemmetilstand"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Gem"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Mislykkedes at gemme spil"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Navn:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Vælg et tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "Deaktiveret GFX"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Deaktiveret GFX"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standard renderer (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialias renderer (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Antialias (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Slet værdi"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Motor understøtter ikke fejlfindingsniveau '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Spring linje over"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Fejl ved kørsel af spil:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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"
#: common/error.cpp:38
msgid "No error"
-msgstr ""
+msgstr "Ingen fejl"
#: common/error.cpp:40
-#, fuzzy
msgid "Game data not found"
msgstr "Spil data ikke fundet"
#: common/error.cpp:42
-#, fuzzy
msgid "Game id not supported"
msgstr "Spil id ikke understøttet"
#: common/error.cpp:44
-#, fuzzy
msgid "Unsupported color mode"
msgstr "Ikke understøttet farve tilstand"
@@ -1051,7 +1081,6 @@ msgid "Write permission denied"
msgstr "Skrive rettighed nægtet"
#: common/error.cpp:52
-#, fuzzy
msgid "Path does not exist"
msgstr "Sti eksistere ikke"
@@ -1068,9 +1097,8 @@ msgid "Cannot create file"
msgstr "Kan ikke oprette fil"
#: common/error.cpp:61
-#, fuzzy
msgid "Reading data failed"
-msgstr "Læsning fejlet"
+msgstr "Læsning af data fejlet"
#: common/error.cpp:63
msgid "Writing data failed"
@@ -1078,34 +1106,33 @@ msgstr "Skrivning af data fejlet"
#: common/error.cpp:66
msgid "Could not find suitable engine plugin"
-msgstr ""
+msgstr "Kunne ikke finde passende motor udvidelse"
#: common/error.cpp:68
-#, fuzzy
msgid "Engine plugin does not support save states"
-msgstr "Motor understøtter ikke fejlfindingsniveau '%s'"
+msgstr "Motor udvidelse understøtter ikke gemmetilstande"
#: common/error.cpp:71
msgid "User canceled"
-msgstr ""
+msgstr "Bruger annullerede"
#: common/error.cpp:75
-#, fuzzy
msgid "Unknown error"
msgstr "Ukendt fejl"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
-msgstr ""
+msgstr "Spillet i '%s' ser ud til at være ukendt."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
+"Venligst, rapportere følgende data til ScummVM holdet sammen med navnet"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
-msgstr ""
+msgstr "på det spil, du forsøgte at tilføje og dets version/sprog/ etc.:"
#: engines/dialogs.cpp:84
msgid "~R~esume"
@@ -1131,22 +1158,23 @@ msgstr "H~j~ælp"
msgid "~A~bout"
msgstr "~O~m"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~R~etur til spiloversigt"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~R~etur til oversigt"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Gemmer:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1155,51 +1183,54 @@ msgstr "Gemmer:"
msgid "Save"
msgstr "Gem"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
"further assistance."
msgstr ""
+"Beklager, denne motor leverer i øjeblikket ikke spil hjælp. Se venligst "
+"README for grundlæggende oplysninger, og for at få instruktioner om, hvordan "
+"man får yderligere hjælp."
-#: engines/dialogs.cpp:243
+#: engines/dialogs.cpp:228
#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
+"Gem af spiltilstand fejlede (%s)! Se venligst README for grundlæggende "
+"oplysninger, og for at få instruktioner om, hvordan man får yderligere hjælp."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~F~ortryd"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~aster"
#: engines/engine.cpp:235
msgid "Could not initialize color format."
-msgstr ""
+msgstr "Kunne ikke initialisere farveformat."
#: engines/engine.cpp:243
-#, fuzzy
msgid "Could not switch to video mode: '"
-msgstr "Aktuel videotilstand:"
+msgstr "Kunne ikke skifte til videotilstand: '"
#: engines/engine.cpp:252
-#, fuzzy
msgid "Could not apply aspect ratio setting."
-msgstr "Skift billedformat korrektion"
+msgstr "Kunne ikke anvende billedformat korrektion indstilling."
#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
-msgstr ""
+msgstr "Kunne ikke anvende fuldskærm indstilling."
#: engines/engine.cpp:357
msgid ""
@@ -1209,6 +1240,11 @@ msgid ""
"the data files to your hard disk instead.\n"
"See the README file for details."
msgstr ""
+"Det lader til at du spiller dette spil direkte\n"
+"fra cd'en. Dette er kendt for at forårsage problemer,\n"
+"og det anbefales derfor, at du kopierer\n"
+"datafiler til din harddisk i stedet.\n"
+"Se README fil for detaljer."
#: engines/engine.cpp:368
msgid ""
@@ -1218,6 +1254,11 @@ msgid ""
"order to listen to the game's music.\n"
"See the README file for details."
msgstr ""
+"Dette spil har lydspor på sin disk. Disse\n"
+"spor skal rippes fra disken ved hjælp af\n"
+"en passende CD audio udvindingsværktøj\n"
+"for at lytte til spillets musik.\n"
+"Se README fil for detaljer."
#: engines/engine.cpp:426
#, c-format
@@ -1225,6 +1266,9 @@ msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
+"Indlæsning af spiltilstand fejlede (%s)! Se venligst README for "
+"grundlæggende oplysninger, og for at få instruktioner om, hvordan man får "
+"yderligere hjælp."
#: engines/engine.cpp:439
msgid ""
@@ -1232,47 +1276,129 @@ msgid ""
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
"not work in future versions of ScummVM."
msgstr ""
+"ADVARSEL: Spillet du er ved at starte endnu ikke er fuldt understøttet af "
+"ScummVM. Således, er det sandsynligt, at det er ustabilt, og alle gemmer du "
+"foretager fungerer muligvis ikke i fremtidige versioner af ScummVM."
#: engines/engine.cpp:442
msgid "Start anyway"
+msgstr "Start alligevel"
+
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Brug original gem/indlæs skærme"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr "Brug de originale gem/indlæs skærme, istedet for dem fra ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Gendan spil:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Gendan"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Brug lys palet tilstand"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Vis grafik ved hjælp af spillets lyse palette"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA farveforøgelse"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Aktiver farveforøgelse i EGA spil"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Foretræk digitale lydeffekter"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Foretræk digitale lydeffekter i stedet for syntetiserede"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Brug IMF/Yamaha FB-01 til MIDI-udgang"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
msgstr ""
+"Bruge et IBM Musik Feature-kort eller et Yamaha FB-01 FM synth modul til "
+"MIDI-udgang"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Brug CD lyd"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Brug cd-lyd i stedet for lyd fra spillet, hvis tilgængelige"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Brug Windows markør"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr "Brug Windows-markører (mindre og monokrome) i stedet for dem fra DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Brug sølv markør"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Brug det alternative sæt af sølv markører, i stedet for de normale gyldne"
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
-msgstr ""
+msgstr "Indsæt Disk %c og Tryk på knappen for at fortsætte."
#: engines/scumm/dialogs.cpp:176
#, c-format
msgid "Unable to Find %s, (%c%d) Press Button."
-msgstr ""
+msgstr "Kunne ikke finde %s, (%c%d) Tryk på knappen."
#: engines/scumm/dialogs.cpp:177
#, c-format
msgid "Error reading disk %c, (%c%d) Press Button."
-msgstr ""
+msgstr "Fejl ved læsning af disk %c, (%c%d) Tryk på knappen."
#: engines/scumm/dialogs.cpp:178
msgid "Game Paused. Press SPACE to Continue."
-msgstr ""
+msgstr "Spil sat på pause. Tryk MELLEMRUM for at fortsætte."
#. I18N: You may specify 'Yes' symbol at the end of the line, like this:
#. "Moechten Sie wirklich neu starten? (J/N)J"
#. Will react to J as 'Yes'
#: engines/scumm/dialogs.cpp:182
-#, fuzzy
msgid "Are you sure you want to restart? (Y/N)"
-msgstr " Er du sikker på at du vil afslutte ? "
+msgstr "Er du sikker på at du vil genstarte? (J/N) "
#. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
#: engines/scumm/dialogs.cpp:184
-#, fuzzy
msgid "Are you sure you want to quit? (Y/N)"
-msgstr " Er du sikker på at du vil afslutte ? "
+msgstr "Er du sikker på at du vil afslutte? (J/N) "
#: engines/scumm/dialogs.cpp:189
msgid "Play"
-msgstr ""
+msgstr "Spil"
#: engines/scumm/dialogs.cpp:191 engines/scumm/help.cpp:82
#: engines/scumm/help.cpp:84
@@ -1285,42 +1411,41 @@ msgstr "Afslut"
#: engines/scumm/dialogs.cpp:193
msgid "Insert save/load game disk"
-msgstr ""
+msgstr "Indsæt gem/indlæs spil disk"
#: engines/scumm/dialogs.cpp:194
msgid "You must enter a name"
-msgstr ""
+msgstr "Du skal indtaste et name"
#: engines/scumm/dialogs.cpp:195
msgid "The game was NOT saved (disk full?)"
-msgstr ""
+msgstr "Spillet blev ikke gemt (disk fuld?)"
#: engines/scumm/dialogs.cpp:196
msgid "The game was NOT loaded"
-msgstr ""
+msgstr "Spillet blev IKKE indlæst"
#: engines/scumm/dialogs.cpp:197
#, c-format
msgid "Saving '%s'"
-msgstr ""
+msgstr "Gemmer '%s'"
#: engines/scumm/dialogs.cpp:198
#, c-format
msgid "Loading '%s'"
-msgstr ""
+msgstr "Indlæser '%s'"
#: engines/scumm/dialogs.cpp:199
msgid "Name your SAVE game"
-msgstr ""
+msgstr "Navngiv din GEMMER"
#: engines/scumm/dialogs.cpp:200
-#, fuzzy
msgid "Select a game to LOAD"
-msgstr "Vælg et tema"
+msgstr "Vælg et spil at indlæse"
#: engines/scumm/dialogs.cpp:201
msgid "Game title)"
-msgstr ""
+msgstr "Spil titel)"
#. I18N: Previous page button
#: engines/scumm/dialogs.cpp:287
@@ -1338,46 +1463,41 @@ msgid "~C~lose"
msgstr "~L~uk"
#: engines/scumm/dialogs.cpp:597
-#, fuzzy
msgid "Speech Only"
-msgstr "Tale"
+msgstr "Kun tale"
#: engines/scumm/dialogs.cpp:598
-#, fuzzy
msgid "Speech and Subtitles"
-msgstr "Undertekster"
+msgstr "Tale og Undertekster"
#: engines/scumm/dialogs.cpp:599
-#, fuzzy
msgid "Subtitles Only"
-msgstr "Undertekster"
+msgstr "Kun undertekster"
#: engines/scumm/dialogs.cpp:607
-#, fuzzy
msgctxt "lowres"
msgid "Speech & Subs"
-msgstr "Tale"
+msgstr "Tale & Tekst"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Vælg et Færdighedsniveau."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Se din Loom(TM) manual for hjælp."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standard (16bpp)"
+msgstr "Standard"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Træning"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Ekspert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1385,7 +1505,7 @@ msgstr "Almindelige tastatur kommandoer:"
#: engines/scumm/help.cpp:74
msgid "Save / Load dialog"
-msgstr "Gem / Hent dialog"
+msgstr "Gem / Indlæs dialog"
#: engines/scumm/help.cpp:76
msgid "Skip line of text"
@@ -1417,7 +1537,7 @@ msgstr "Ctrl"
#: engines/scumm/help.cpp:79
msgid "Load game state 1-10"
-msgstr "Hent spil tilstand 1-10"
+msgstr "Indlæs spil tilstand 1-10"
#: engines/scumm/help.cpp:80 engines/scumm/help.cpp:84
#: engines/scumm/help.cpp:86 engines/scumm/help.cpp:100
@@ -1510,7 +1630,6 @@ msgid " since they may cause crashes"
msgstr " siden de kan skabe nedbrud"
#: engines/scumm/help.cpp:110
-#, fuzzy
msgid " or incorrect game behavior."
msgstr " eller ukorrekt opførsel af spil."
@@ -1750,7 +1869,7 @@ msgstr "Komm"
#: engines/scumm/help.cpp:246
msgid "Save / Load / Options"
-msgstr "Gem / Hent / Indstillinger"
+msgstr "Gem / Indlæs / Indstillinger"
#: engines/scumm/help.cpp:255
msgid "Other game controls:"
@@ -1899,8 +2018,10 @@ msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."
msgstr ""
+"Indbygget MIDI understøttelse kræver Roland opgradering fra LucasArts,\n"
+"men %s mangler. Bruger AdLib i stedet."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1911,18 +2032,18 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
"\n"
"%s"
msgstr ""
-"Mislykkedes at hente spil tilstand fra fil:\n"
+"Mislykkedes at indlæse spil tilstand fra fil:\n"
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1933,12 +2054,15 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
"directory inside the Tentacle game directory."
msgstr ""
+"Normalt ville Maniac Mansion begynde nu. Men ScummVM kan ikke gøre det "
+"endnu. For at spille det, gå til 'Tilføj spil' i ScummVM start-menuen og "
+"vælg 'Maniac' mappen inde i Tentacle spillets mappe."
#. I18N: Option for fast scene switching
#: engines/mohawk/dialogs.cpp:92 engines/mohawk/dialogs.cpp:171
@@ -1952,159 +2076,213 @@ msgstr "~O~vergange aktiveret"
#. I18N: Drop book page
#: engines/mohawk/dialogs.cpp:95
msgid "~D~rop Page"
-msgstr ""
+msgstr "Smi~d~ side"
#: engines/mohawk/dialogs.cpp:99
msgid "~S~how Map"
-msgstr ""
+msgstr "Vi~s~ kort"
#: engines/mohawk/dialogs.cpp:105
-#, fuzzy
msgid "~M~ain Menu"
-msgstr "ScummVM Hovedmenu"
+msgstr "Hoved~m~enu"
#: engines/mohawk/dialogs.cpp:172
msgid "~W~ater Effect Enabled"
msgstr "~V~andeffekter aktiveret"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Gendan spil:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Gendan"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
msgid "Cutscene file '%s' not found!"
-msgstr ""
+msgstr "Filmsekvens fil '%s' ikke fundet!"
-#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:502
-#, fuzzy
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
-msgstr ""
-"Mislykkedes at hente spil tilstand fra fil:\n"
-"\n"
-"%s"
+msgstr "Mislykkedes at indlæse spil tilstand fra fil."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515
-#, fuzzy
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
-msgstr ""
-"Mislykkedes at gemme spil tilstand til fil:\n"
-"\n"
-"%s"
+msgstr "Mislykkedes at gemme spil tilstand til fil."
#: engines/gob/inter_v5.cpp:107
-#, fuzzy
msgid "Failed to delete file."
-msgstr ""
-"Mislykkedes at gemme spil tilstand til fil:\n"
-"\n"
-"%s"
+msgstr "Mislykkedes at slette fil."
#: engines/groovie/script.cpp:420
-#, fuzzy
msgid "Failed to save game"
-msgstr ""
-"Mislykkedes at gemme spil tilstand til fil:\n"
-"\n"
-"%s"
+msgstr "Mislykkedes at gemme spil"
+
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Studio publikum"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Aktivér studio publikum"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Spring over støtte"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Tillad at tekst og filmsekvenser kan springes over"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Helium tilstand"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Aktivér helium tilstand"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Jævn bevægelse"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Aktivér jævn bevægelse når du går"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Flydende markør"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Aktivér flydende markør"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "HP søjlegrafer"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Aktivér træfpoint (HP) søjlediagrammer"
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Angreb 1"
#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Angreb 2"
#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Angreb 3"
#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Flyt fremad"
#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Flyt bagud"
#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Flyt til venstre"
#: engines/kyra/lol.cpp:484
-#, fuzzy
msgid "Slide Right"
-msgstr "Højre"
+msgstr "Flyt til højre"
#: engines/kyra/lol.cpp:485
-#, fuzzy
msgid "Turn Left"
-msgstr "Sluk"
+msgstr "Drej til venstre"
#: engines/kyra/lol.cpp:486
-#, fuzzy
msgid "Turn Right"
-msgstr "Pil til højre"
+msgstr "Drej til højre"
#: engines/kyra/lol.cpp:487
-#, fuzzy
msgid "Rest"
-msgstr "Gendan"
+msgstr "Hvil"
#: engines/kyra/lol.cpp:488
-#, fuzzy
msgid "Options"
-msgstr "~I~ndstillinger"
+msgstr "Indstillinger"
#: engines/kyra/lol.cpp:489
-#, fuzzy
msgid "Choose Spell"
-msgstr "Vælg"
+msgstr "Vælg magi"
#: engines/kyra/sound_midi.cpp:475
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
+"Det lader til at du bruger en Generel MIDI-enhed,\n"
+"men dit spil kun understøtter Roland MT32 MIDI.\n"
+"Vi forsøger at kortlægge Roland MT32 instrumenterne til\n"
+"dem i Generel MIDI. Trods det kan det ske\n"
+"at nogle stykker ikke lyder korrekt."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Brug diskette versionens intro (kun CD version)"
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
"Please download it from www.scummvm.org"
msgstr ""
+"Kunne ikke finde \"sky.cpt\" filen!\n"
+"Venligst download den fra www.scummvm.org"
#: engines/sky/compact.cpp:141
msgid ""
"The \"sky.cpt\" file has an incorrect size.\n"
"Please (re)download it from www.scummvm.org"
msgstr ""
+"\"sky.cpt\" filen har en forkert størrelse.\n"
+"Venligst (gen)hent den fra www.scummvm.org"
+
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Diskette intro"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Brug diskette versionens intro (kun CD version)"
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "PSX stream filmsekvens '%s' kan ikke afspilles i palette tilstand"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
+"DXA filmsekvenser fundet, men ScummVM er bygget uden zlib understøttelse"
#: engines/sword1/animation.cpp:570 engines/sword2/animation.cpp:465
msgid "MPEG2 cutscenes are no longer supported"
-msgstr ""
+msgstr "MPEG2 filmsekvenser understøttes ikke længere"
#: engines/sword1/animation.cpp:576 engines/sword2/animation.cpp:473
#, c-format
msgid "Cutscene '%s' not found"
-msgstr ""
+msgstr "Filmsekvens '%s' ikke fundet"
#: engines/sword1/control.cpp:863
msgid ""
@@ -2116,6 +2294,13 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked again the next "
"time you start the game.\n"
msgstr ""
+"ScummVM har konstateret, at du har gamle gemmer for Broken Sword 1, der skal "
+"konverteres.\n"
+"Det gamle gemte spil format understøttes ikke længere, så vil du ikke være i "
+"stand til at indlæse dine spil, hvis du ikke konvertere dem.\n"
+"\n"
+"Tryk på OK for at konvertere dem nu, ellers vil du blive spurgt igen, næste "
+"gang du starter spillet.\n"
#: engines/sword1/control.cpp:1232
#, c-format
@@ -2123,23 +2308,45 @@ msgid ""
"Target new save game already exists!\n"
"Would you like to keep the old save game (%s) or the new one (%s)?\n"
msgstr ""
+"Nyt gemt spil findes allerede!\n"
+"Vil du gerne beholde det gamle gemte spil (%s) eller det nye (%s)?\n"
#: engines/sword1/control.cpp:1235
msgid "Keep the old one"
-msgstr ""
+msgstr "Behold den gamle"
#: engines/sword1/control.cpp:1235
msgid "Keep the new one"
-msgstr ""
+msgstr "Behold den nye"
#: engines/sword1/logic.cpp:1633
msgid "This is the end of the Broken Sword 1 Demo"
-msgstr ""
+msgstr "Dette er slutningen af Broken Sword 1 demoen"
#: engines/sword2/animation.cpp:435
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
+"PSX filmsekvenser fundet, men ScummVM er bygget uden RGB farve understøttelse"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Vis labels på genstande"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Vis labels for genstande musen er henover"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2147,18 +2354,18 @@ msgid ""
"Can't save game in slot %i\n"
"\n"
msgstr ""
+"Kan ikke gemme spil på plads %i\n"
+"\n"
-#: engines/parallaction/saveload.cpp:211
-#, fuzzy
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
-msgstr "Indlæs spil:"
+msgstr "Indlæser spil..."
-#: engines/parallaction/saveload.cpp:226
-#, fuzzy
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
-msgstr "Gemmer:"
+msgstr "Gemmer spil..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2167,18 +2374,28 @@ msgid ""
"\n"
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
+"ScummVM har konstateret, at du har gamle gemmer for Nippon Safes, der skal "
+"omdøbes.\n"
+"De gamle navne er ikke længere understøttet, så du vil ikke være i stand til "
+"at indlæse dine spil, hvis du ikke konvertere dem.\n"
+"\n"
+"Tryk på OK for at konvertere dem nu, ellers vil du blive spurgt næste gang.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
-msgstr ""
+msgstr "ScummVM konverterede med succes alle dine gemmer."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
"\n"
"Please report to the team."
msgstr ""
+"ScummVM udskrev nogle advarsler i dit konsol vindue, og kan ikke garantere "
+"at alle dine filer er blevet konverteret.\n"
+"\n"
+"Venligst rapportér til holdet."
#: audio/fmopl.cpp:49
msgid "MAME OPL emulator"
@@ -2194,11 +2411,13 @@ msgid ""
"The selected audio device '%s' was not found (e.g. might be turned off or "
"disconnected)."
msgstr ""
+"Den valgte lydenhed '%s' blev ikke fundet (kan f.eks være slukket eller "
+"afbrudt)."
#: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257
#: audio/mididrv.cpp:272
msgid "Attempting to fall back to the next available device..."
-msgstr ""
+msgstr "Forsøger at falde tilbage til den næste tilgængelig enhed..."
#: audio/mididrv.cpp:221
#, c-format
@@ -2206,6 +2425,7 @@ msgid ""
"The selected audio device '%s' cannot be used. See log file for more "
"information."
msgstr ""
+"Den valgte lydenhed '%s' kan ikke bruges. Se log filen for mere information."
#: audio/mididrv.cpp:257
#, c-format
@@ -2213,6 +2433,8 @@ msgid ""
"The preferred audio device '%s' was not found (e.g. might be turned off or "
"disconnected)."
msgstr ""
+"Den foretrukne lydenhed '%s' blev ikke fundet (kan f.eks være slukket eller "
+"afbrudt)."
#: audio/mididrv.cpp:272
#, c-format
@@ -2220,6 +2442,8 @@ msgid ""
"The preferred audio device '%s' cannot be used. See log file for more "
"information."
msgstr ""
+"Den foretrukne lydenhed '%s' kan ikke bruges. Se log filen for mere "
+"information."
#: audio/null.h:43
msgid "No music"
@@ -2242,7 +2466,6 @@ msgid "C64 Audio Emulator"
msgstr "C64 lyd emulator"
#: audio/softsynth/mt32.cpp:293
-#, fuzzy
msgid "Initializing MT-32 Emulator"
msgstr "Initialisere MT-32 emulator"
@@ -2263,7 +2486,6 @@ msgid "Keymap:"
msgstr "Tasteoversigt:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
msgstr " (Aktiv)"
@@ -2273,7 +2495,7 @@ msgstr " (Aktiv)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr "(Blokeret)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2359,29 +2581,27 @@ msgstr "Høj lydkvalitet (langsommere) (genstart)"
msgid "Disable power off"
msgstr "Deaktiver slukning"
-#: backends/platform/iphone/osys_events.cpp:301
-#, fuzzy
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
-msgstr "Pegeplade tilstand aktiveret."
+msgstr "Muse-klik-og-træk tilstand aktiveret."
-#: backends/platform/iphone/osys_events.cpp:303
-#, fuzzy
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
-msgstr "Pegeplade tilstand deaktiveret."
+msgstr "Muse-klik-og-træk tilstand deaktiveret."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Pegeplade tilstand aktiveret."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Pegeplade tilstand deaktiveret."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Klik tilstand"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2389,12 +2609,11 @@ msgstr ""
msgid "Left Click"
msgstr "Venstre klik"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Midterste højre punkt"
+msgstr "Miderste klik"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2402,7 +2621,6 @@ msgid "Right Click"
msgstr "Højre klik"
#: backends/platform/sdl/macosx/appmenu_osx.mm:78
-#, fuzzy
msgid "Hide ScummVM"
msgstr "Skjul ScummVM"
@@ -2432,57 +2650,52 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal (ingen skalering)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
-#, fuzzy
msgid "Enabled aspect ratio correction"
-msgstr "Skift billedformat korrektion"
+msgstr "Aktivér billedformat korrektion"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
-#, fuzzy
msgid "Disabled aspect ratio correction"
-msgstr "Skift billedformat korrektion"
+msgstr "Deaktivér billedformat korrektion"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
-#, fuzzy
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
-msgstr "Skift mellem grafik filtre"
+msgstr "Aktive grafik filtre:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
-#, fuzzy
msgid "Windowed mode"
-msgstr "Rendere tilstand:"
+msgstr "Vindue tilstand"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Bevar"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:415
-#, fuzzy
msgid "Current display mode"
-msgstr "Aktuel videotilstand:"
+msgstr "Aktuel videotilstand"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:428
msgid "Current scale"
-msgstr ""
+msgstr "Aktuel skalering"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
-msgstr ""
+msgstr "Aktiv filter tilstand: Linær"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
-msgstr ""
+msgstr "Aktiv filter tilstand: Nærmest"
#: backends/platform/symbian/src/SymbianActions.cpp:38
#: backends/platform/wince/CEActionsSmartphone.cpp:39
@@ -2664,17 +2877,15 @@ msgid "Network down"
msgstr "Netværk nede"
#: backends/platform/wii/options.cpp:178
-#, fuzzy
msgid "Initializing network"
msgstr "Initialisere netværk"
#: backends/platform/wii/options.cpp:182
-#, fuzzy
msgid "Timeout while initializing network"
msgstr "Tidsgrænse nået ved initialisering af netværk"
#: backends/platform/wii/options.cpp:186
-#, fuzzy, c-format
+#, c-format
msgid "Network not initialized (%d)"
msgstr "Netværk ikke initialiseret (%d)"
@@ -2734,12 +2945,12 @@ msgstr "Pil til højre"
#: backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Do you want to load or save the game?"
-msgstr "Vil du hente eller gemme spillet?"
+msgstr "Vil du indlæse eller gemme spillet?"
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
msgid " Are you sure you want to quit ? "
-msgstr " Er du sikker på at du vil afslutte ? "
+msgstr " Er du sikker på at du vil afslutte? "
#: backends/platform/wince/CEActionsSmartphone.cpp:50
msgid "Keyboard"
@@ -2796,95 +3007,86 @@ msgstr ""
"hele oversigten"
#: backends/events/default/default-events.cpp:191
-#, fuzzy
msgid "Do you really want to return to the Launcher?"
-msgstr "Vil du virkelig slette denne gemmer?"
+msgstr "Vil du virkelig gå tilbage til oversigten?"
#: backends/events/default/default-events.cpp:191
-#, fuzzy
msgid "Launcher"
-msgstr "Slag"
+msgstr "Oversigt"
#: backends/events/default/default-events.cpp:213
-#, fuzzy
msgid "Do you really want to quit?"
-msgstr "Vil du afslutte?"
+msgstr "Vil du virkelig afslutte?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
-msgstr ""
+msgstr "Touchscreen 'Tap Mode' - Venstre Klik"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
-msgstr ""
+msgstr "Touchscreen 'Tap Mode' - Højre Klik"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
-msgstr ""
+msgstr "Touchscreen 'Tap Mode' - Henover (Ingen Klik)"
-#: backends/events/gph/gph-events.cpp:362
-#, fuzzy
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
-msgstr "Lydstyrke"
+msgstr "Maximal lydstyrke"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
-msgstr ""
+msgstr "Hæver lydstyrke"
-#: backends/events/gph/gph-events.cpp:370
-#, fuzzy
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
-msgstr "Lydstyrke"
+msgstr "Minimal lydstyrke"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
-msgstr ""
+msgstr "Sænker lydstyrke"
#: backends/updates/macosx/macosx-updates.mm:65
msgid "Check for Updates..."
-msgstr ""
+msgstr "Søg efter opdateringer..."
#: backends/platform/bada/form.cpp:269
-#, fuzzy
msgid "Right Click Once"
-msgstr "Højre klik"
+msgstr "Enkelt højre klik"
#: backends/platform/bada/form.cpp:277
-#, fuzzy
msgid "Move Only"
-msgstr "Tale"
+msgstr "Flyt kun"
#: backends/platform/bada/form.cpp:291
msgid "Escape Key"
-msgstr ""
+msgstr "Escape tast"
#: backends/platform/bada/form.cpp:296
-#, fuzzy
msgid "Game Menu"
-msgstr "Spil"
+msgstr "Spil menu"
#: backends/platform/bada/form.cpp:301
-#, fuzzy
msgid "Show Keypad"
msgstr "Vis tastatur"
#: backends/platform/bada/form.cpp:309
msgid "Control Mouse"
-msgstr ""
+msgstr "Kontrollér mus"
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
-msgstr ""
+msgstr "Klik aktiveret"
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
-msgstr ""
+msgstr "Klik deaktiveret"
#~ msgid "Hercules Green"
#~ msgstr "Hercules grøn"
diff --git a/po/de_DE.po b/po/de_DE.po
index fd60d11d4a..a18bfb7ca6 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -5,17 +5,17 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: ScummVM 1.4.0git\n"
+"Project-Id-Version: ScummVM 1.5.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2012-01-29 21:11+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-14 22:49+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"
+"(Contributor)\n"
+"Language: Deutsch\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Deutsch\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
#: gui/about.cpp:91
@@ -45,11 +45,12 @@ msgid "Go up"
msgstr "Pfad hoch"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -70,18 +71,17 @@ msgstr "Schließen"
msgid "Mouse click"
msgstr "Mausklick"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Tastatur anzeigen"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Tasten neu zuweisen"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
-msgstr "Vollbild-/Fenster-Modus"
+msgstr "Vollbild EIN/AUS"
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
@@ -91,18 +91,18 @@ msgstr "Eine Aktion zum Zuweisen auswählen"
msgid "Map"
msgstr "Zuweisen"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -129,15 +129,15 @@ msgstr "Bitte eine Aktion auswählen"
msgid "Press the key to associate"
msgstr "Taste drücken, um sie zuzuweisen"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Spiel"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "Kennung:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -145,29 +145,29 @@ msgstr ""
"Kurzer Spielname, um die Spielstände zuzuordnen und das Spiel von der "
"Kommandozeile aus starten zu können"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Name:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Voller Name des Spiels"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Name:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Sprache:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -175,282 +175,286 @@ msgstr ""
"Sprache des Spiels. Diese Funktion wird nicht eine spanische Version des "
"Spiels in eine deutsche verwandeln."
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<Standard>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plattform, für die das Spiel ursprünglich erstellt wurde"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Engine"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafik"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Globale Grafikeinstellungen übergehen"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Globale Grafikeinstellungen übergehen"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Audio"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Globale Audioeinstellungen übergehen"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Globale Audioeinstellungen übergehen"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Lautstärke"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Lautst."
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Globale Lautstärke-Einstellungen übergehen"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Globale Lautstärkeeinstellungen übergehen"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Globale MIDI-Einstellungen übergehen"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Globale MIDI-Einstellungen übergehen"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Globale MT-32-Einstellungen übergehen"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Globale MT-32-Einstellungen übergehen"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Pfade"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Pfade"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Spielpfad:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Spielpfad:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Extrapfad:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Legt das Verzeichnis für zusätzliche Spieldateien fest."
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Extrapfad:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Spielstände:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Legt fest, wo die Spielstände abgelegt werden."
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Speichern:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Keiner"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Standard"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "SoundFont auswählen"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Verzeichnis mit Spieldateien auswählen"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Verzeichnis mit zusätzlichen Dateien auswählen"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Verzeichnis für Spielstände auswählen"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Diese Spielkennung ist schon vergeben. Bitte eine andere wählen."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~B~eenden"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "ScummVM beenden"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "Übe~r~"
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Über ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~ptionen"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Globale ScummVM-Einstellungen bearbeiten"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~tarten"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Ausgewähltes Spiel starten"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~L~aden..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Spielstand für ausgewähltes Spiel laden"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "Spiel ~h~inzufügen"
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr ""
"Umschalttaste (Shift) gedrückt halten, um Verzeichnisse nach Spielen zu "
"durchsuchen"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "Spielo~p~tionen"
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Spieloptionen ändern"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "Spiel ~e~ntfernen"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Spiel aus der Liste entfernen. Die Spieldateien bleiben erhalten."
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~H~inzufügen"
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "Spielo~p~tion"
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~E~ntfernen"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "In Spieleliste suchen"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Suchen:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Spiel laden:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Laden"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -458,7 +462,7 @@ msgstr ""
"Möchten Sie wirklich den PC nach Spielen durchsuchen? Möglicherweise wird "
"dabei eine größere Menge an Spielen hinzugefügt."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -466,7 +470,7 @@ msgstr ""
msgid "Yes"
msgstr "Ja"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -474,37 +478,37 @@ msgstr "Ja"
msgid "No"
msgstr "Nein"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM konnte das gewählte Verzeichnis nicht öffnen!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM konnte im gewählten Verzeichnis kein Spiel finden!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Spiel auswählen:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Möchten Sie wirklich diese Spielkonfiguration entfernen?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr ""
"Für dieses Spiel wird das Laden aus der Spieleliste heraus nicht unterstützt."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr "ScummVM konnte keine Engine finden, um das Spiel zu starten!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Durchsuchen"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Durchsuchen"
@@ -571,106 +575,96 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "-"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Fehler bei einigen Änderungen in Grafikoptionen:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "Grafikmodus konnte nicht geändert werden."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "Vollbildeinstellung konnte nicht geändert werden."
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr ""
"Einstellung für Seitenverhältniskorrektur konnte nicht geändert werden."
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Grafikmodus:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Render-Modus:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr ""
"Spezielle Farbmischungsmethoden werden von manchen Spielen unterstützt."
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Vollbildmodus"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Seitenverhältnis korrigieren"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Seitenverhältnis für Spiele mit der Auflösung 320x200 korrigieren"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Antifehlerdiffusion für EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr ""
-"Aktiviert die Aufhebung der Fehlerdiffusion in EGA-Spielen, die dies "
-"unterstützen."
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Standard-Gerät:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Musikgerät:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
"Legt das bevorzugte Tonwiedergabe-Gerät oder den Soundkarten-Emulator fest."
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Legt das Musikwiedergabe-Gerät oder den Soundkarten-Emulator fest."
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Standard-Gerät:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Musikgerät:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib-Emulator"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib wird für die Musik in vielen Spielen verwendet."
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Ausgabefrequenz:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -678,64 +672,64 @@ msgstr ""
"Höhere Werte bewirken eine bessere Soundqualität, werden aber möglicherweise "
"nicht von jeder Soundkarte unterstützt."
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "GM-Gerät:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr ""
"Legt das standardmäßige Musikwiedergabe-Gerät für General-MIDI-Ausgabe fest."
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Keine General-MIDI-Musik"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Erstes verfügbares Gerät"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
"SoundFont wird von einigen Soundkarten, Fluidsynth und Timidity unterstützt."
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "AdLib-/MIDI-Modus"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Benutzt MIDI und AdLib zur Sounderzeugung."
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "MIDI-Lautstärke:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "MT-32-Gerät:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Legt das standardmäßige Tonwiedergabe-Gerät für die Ausgabe von Roland MT-32/"
"LAPC1/CM32l/CM64 fest."
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Echte Roland-MT-32-Emulation (GM-Emulation deaktiviert)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -743,300 +737,339 @@ msgstr ""
"Wählen Sie dies aus, wenn Sie Ihre echte Hardware, die mit einer Roland-"
"kompatiblen Soundkarte verbunden ist, verwenden möchten."
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Echte Roland-MT-32-Emulation (kein GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Roland-GS-Modus"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"Schaltet die General-MIDI-Zuweisung für Spiele mit Roland-MT-32-Audiospur "
"aus."
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Keine Roland-MT-32-Musik"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Sprache und Text:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Sprache"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Untertitel"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Beides"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Untertitel-Tempo:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Sprache + Text:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Spr."
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
-msgstr "TXT"
+msgstr "Text"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "S+T"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Untertitel anzeigen und Sprachausgabe aktivieren"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Text-Tempo:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Musiklautstärke:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Musiklautstärke:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Alles aus"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Effektlautstärke:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Lautstärke spezieller Soundeffekte"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Effektlautst.:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Sprachlautstärke:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Sprachlautst.:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Themenpfad:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Themenpfad:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"Legt das Verzeichnis für zusätzliche Spieldateien für alle Spiele in ScummVM "
"fest."
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Plugin-Pfad:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Plugin-Pfad:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Sonstiges"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Andere"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Thema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI-Renderer:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autom. Speichern:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Speich.(auto)"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Tasten"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Sprache:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Sprache der ScummVM-Oberfläche"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Sie müssen ScummVM neu starten, damit die Änderungen wirksam werden."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Verzeichnis für Spielstände auswählen"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr ""
"In das gewählte Verzeichnis kann nicht geschrieben werden. Bitte ein anderes "
"auswählen."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Verzeichnis für Oberflächen-Themen"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Verzeichnis für zusätzliche Dateien auswählen"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Verzeichnis für Erweiterungen auswählen"
# Nicht übersetzen, da diese Nachricht nur für nicht-lateinische Sprachen relevant ist.
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
msgstr ""
+"Das ausgewählte Thema unterstützt nicht die aktuelle Sprache. Wenn Sie "
+"dieses Thema benutzen wollen, müssen Sie erst zu einer anderen Sprache "
+"wechseln."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Kein Datum gespeichert"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Keine Zeit gespeichert"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Keine Spielzeit gespeichert"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Löschen"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Diesen Spielstand wirklich löschen?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Datum: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Zeit: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Spieldauer: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Unbenannt"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Speichern"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Konnte Spielstand nicht speichern."
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Name:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Thema auswählen"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX ausgeschaltet"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX ausgeschaltet"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standard-Renderer (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Kantenglättung (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Kantenglättung (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Wert löschen"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Engine unterstützt den Debug-Level \"%s\" nicht."
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menü"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Zeile überspringen"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Fehler beim Ausführen des Spiels:"
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr "Konnte keine Spiel-Engine finden, die dieses Spiel starten kann."
@@ -1104,18 +1137,18 @@ msgstr "Abbruch durch Benutzer"
msgid "Unknown error"
msgstr "Unbekannter Fehler"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "Das Spiel im Verzeichnis \"%s\" scheint nicht bekannt zu sein."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
"Bitte geben Sie die folgenden Daten auf Englisch an das ScummVM-Team weiter "
"sowie"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr ""
"den Namen des Spiels, das Sie hinzufügen wollten, als auch die Version/"
@@ -1145,22 +1178,23 @@ msgstr "~H~ilfe"
msgid "~A~bout"
msgstr "Übe~r~"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "Zur Spiele~l~iste zurück"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "Zur Spiele~l~iste"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Speichern:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1169,37 +1203,35 @@ msgstr "Speichern:"
msgid "Save"
msgstr "Speichern"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
"further assistance."
msgstr ""
"Leider bietet diese Engine keine Spielhilfe. Bitte lesen Sie die Liesmich-"
-"Datei für grundlegende Informationen und Anweisungen dazu, wie man an "
-"weitere Hilfe gelangt."
+"Datei für grundlegende Informationen und Anweisungen zu weiterer Hilfe."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Leider bietet diese Engine keine Spielhilfe. Bitte lesen Sie die Liesmich-"
-"Datei für grundlegende Informationen und Anweisungen dazu, wie man an "
-"weitere Hilfe gelangt."
+"Speichern des Spielstands %s fehlgeschlagen! Bitte lesen Sie die Liesmich-"
+"Datei für grundlegende Informationen und Anweisungen zu weiterer Hilfe."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~A~bbrechen"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~asten"
@@ -1251,14 +1283,13 @@ msgstr ""
"Liesmich-Datei für weitere Informationen."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Leider bietet diese Engine keine Spielhilfe. Bitte lesen Sie die Liesmich-"
-"Datei für grundlegende Informationen und Anweisungen dazu, wie man an "
-"weitere Hilfe gelangt."
+"Laden des Spielstands %s fehlgeschlagen! Bitte lesen Sie die Liesmich-Datei "
+"für grundlegende Informationen und Anweisungen zu weiterer Hilfe."
#: engines/engine.cpp:439
msgid ""
@@ -1275,6 +1306,91 @@ msgstr ""
msgid "Start anyway"
msgstr "Trotzdem starten"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Originale Spielstand-Menüs"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"Verwendet die originalen Menüs zum Speichern und Laden statt der von ScummVM."
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Spiel laden:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Laden"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Modus für helle Palette verwenden"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Zeigt Grafiken über helle Spielpalette an."
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Antifehlerdiffusion für EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Aktiviert die Aufhebung der Fehlerdiffusion in EGA-Spielen."
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Digitale Sound-Effekte bevorzugen"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Bevorzugt digitale Sound-Effekte statt synthethisierter."
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "IMF/Yamaha FB-01 für MIDI-Ausgabe verwenden"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Verwendet eine Music-Feature-Karte von IBM oder ein Yamaha-FB-01-FM-"
+"Synthetisierungsmodul für die MIDI-Ausgabe."
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "CD-Ton verwenden"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Verwendet CD-Ton anstatt des Tons im Spiel, sofern verfügbar."
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Windows-Mauszeiger verwenden"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Verwendet die Windows-Mauszeiger (kleiner und schwarz-weiß) anstatt der von "
+"DOS."
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Silberne Mauszeiger verwenden"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Verwendet alternativen Satz silberner Mauszeiger anstatt der normalen "
+"goldenen."
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1928,10 +2044,11 @@ msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."
msgstr ""
-"Systemeigene MIDI-Ünterstützung erfordert das Roland-Upgrade von LucasArts,\n"
-"aber %s fehlt. Stattdessen wird AdLib verwendet."
+"Systemeigene MIDI-Ünterstützung erfordert das\n"
+"Roland-Upgrade von LucasArts, aber %s\n"
+"fehlt. Stattdessen wird AdLib verwendet."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1942,7 +2059,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1953,7 +2070,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1964,7 +2081,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -2001,25 +2118,17 @@ msgstr "Haupt~m~enü"
msgid "~W~ater Effect Enabled"
msgstr "~W~assereffekt aktiviert"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Spiel laden:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Laden"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Konnte Spielstand nicht in Datei speichern."
@@ -2031,6 +2140,64 @@ msgstr "Konnte Datei nicht löschen."
msgid "Failed to save game"
msgstr "Konnte Spielstand nicht speichern."
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Studio-Publikum"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Aktiviert Studio-Publikum."
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Überspring-Unterstützung"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Erlaubt das Überspringen von Textteilen und Zwischensequenzen."
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Helium-Modus"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Aktiviert Helium-Modus."
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Gleichmäßiges Scrollen"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Aktiviert gleichmäßiges Scrollen beim Gehen."
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Richtungspfeil-Mauszeiger"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Aktiviert Richtungspfeil-Mauszeiger."
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Trefferpunkte-Balken"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Aktiviert grafische Trefferpunkte-Balken."
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Attacke 1"
@@ -2084,15 +2251,25 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Sie scheinen ein General-MIDI-Gerät zu\n"
"verwenden, aber das Spiel unterstützt nur\n"
-"Roland MT-32 MIDI. Es wird versucht, die\n"
-"Roland-MT-32-Instrumente denen von General MIDI\n"
-"zuzuordnen. Es kann jedoch vorkommen, dass ein\n"
-"paar Musikstücke nicht richtig abgespielt werden."
+"Roland MT32 MIDI. Es wird versucht, die\n"
+"Roland-MT32-Instrumente denen von\n"
+"General MIDI zuzuordnen. Es ist dennoch\n"
+"möglich, dass ein paar Musikstücke nicht\n"
+"richtig abgespielt werden."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Verwendet den Vorspann der Diskettenversion (nur bei CD-Version)."
#: engines/sky/compact.cpp:130
msgid ""
@@ -2112,10 +2289,19 @@ msgstr ""
"Bitte laden Sie diese Datei (erneut) von\n"
"www.scummvm.org herunter."
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Disketten-Vorspann"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Verwendet den Vorspann der Diskettenversion (nur bei CD-Version)."
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
msgstr ""
+"PSX-Zwischensequenz \"%s\" kann in Palettenmodus nicht wiedergegeben werden."
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2142,13 +2328,13 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked again the next "
"time you start the game.\n"
msgstr ""
-"ScummVM hat erkannt, dass Sie alte Speicherstände von Baphomets Fluch 1 "
-"haben, die umgewandelt werden sollten.\n"
-"Das alte Spielstandsformat wird nicht mehr unterstützt, also können Sie "
-"diese Speicherstände nicht laden, wenn Sie diese nicht konvertieren.\n"
+"ScummVM hat erkannt, dass Sie alte Spielstände von Baphomets Fluch 1 haben, "
+"die umgewandelt werden sollten.\n"
+"Das alte Speicherformat wird nicht mehr unterstützt, also können Sie diese "
+"Spielstände unkonvertiert nicht laden.\n"
"\n"
-"Klicken Sie auf OK, um diese jetzt umzuwandeln, ansonsten werden Sie erneut "
-"gefragt, wenn Sie das nächste Mal dieses Spiel starten.\n"
+"Klicken Sie auf OK, um diese jetzt umzuwandeln, sonst werden Sie erneut "
+"gefragt, wenn Sie nächstes Mal dieses Spiel starten.\n"
#: engines/sword1/control.cpp:1232
#, c-format
@@ -2172,12 +2358,30 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Das ist das Ende der Demo von Broken Sword 1 (Baphomets Fluch 1)."
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"DXA-Zwischensequenzen gefunden, aber ScummVM wurde ohne Zlib-Unterstützung "
-"erstellt."
+"PSX-Zwischensequenzen gefunden, aber ScummVM wurde ohne Unterstützung für "
+"RGB-Farben erstellt."
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Objektnamen zeigen"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Zeigt Objektbeschriftungen bei Mausberührung an."
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2188,15 +2392,15 @@ msgstr ""
"Kann Spiel nicht speichern auf Speicherplatz %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Spiel wird geladen..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Spiel wird gespeichert..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2205,19 +2409,19 @@ msgid ""
"\n"
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
-"ScummVM hat erkannt, dass Sie alte Speicherstände von Nippon Safes haben, "
-"die umbenannt werden sollten.\n"
+"ScummVM hat erkannt, dass Sie alte Spielstände von Nippon Safes haben, die "
+"umbenannt werden sollten.\n"
"Die alten Dateinamen werden nicht mehr unterstützt, also können Sie diese "
-"Speicherstände nicht laden, wenn Sie diese nicht konvertieren.\n"
+"Spielstände unkonvertiert nicht laden.\n"
"\n"
-"Klicken Sie auf OK, um diese jetzt umzuwandeln, ansonsten werden Sie erneut "
-"gefragt, wenn Sie das nächste Mal dieses Spiel starten.\n"
+"Klicken Sie auf OK, um diese jetzt umzuwandeln, sonst werden Sie erneut "
+"gefragt, wenn Sie nächstes Mal dieses Spiel starten.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM hat alle Speicherstände erfolgreich umgewandelt."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2319,9 +2523,8 @@ msgid "Keymap:"
msgstr "Tasten-Layout:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
-msgstr " (Aktiv)"
+msgstr " (Aktuell)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
@@ -2329,7 +2532,7 @@ msgstr " (Aktiv)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Blockiert)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2415,27 +2618,27 @@ msgstr "Hohe Audioqualität (lansamer) (erfordert Neustart)"
msgid "Disable power off"
msgstr "Stromsparmodus abschalten"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Maus-klick-und-zieh-Modus aktiviert."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Maus-klick-und-zieh-Modus ausgeschaltet."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Touchpad-Modus aktiviert."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Touchpad-Modus ausgeschaltet."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Klickmodus"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2443,12 +2646,11 @@ msgstr ""
msgid "Left Click"
msgstr "Linksklick"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Mittlerer linker Gegenstand"
+msgstr "Mittelklick"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2485,34 +2687,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal ohn.Skalieren"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Seitenverhältniskorrektur aus"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Aktiver Grafikfilter:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Fenstermodus"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL: normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL: beibehalten"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL: original"
@@ -2854,37 +3056,37 @@ msgstr "Spieleliste"
msgid "Do you really want to quit?"
msgstr "Möchten Sie wirklich beenden?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Berührungsbildschirm-Tipp-Modus - Linksklick"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Berührungsbildschirm-Tipp-Modus - Rechtsklick"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Berührungsbildschirm-Tipp-Modus - schweben (kein Klick)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Höchste Lautstärke"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Lautstärke höher"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Niedrigste Lautstärke"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Lautstärke niedriger"
diff --git a/po/es_ES.po b/po/es_ES.po
index c825e9de4f..9f767dacfa 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.4.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-10-23 21:53+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-08 18:19+0100\n"
"Last-Translator: Tomás Maidagan\n"
"Language-Team: \n"
+"Language: Espanol\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Espanol\n"
#: gui/about.cpp:91
#, c-format
@@ -43,11 +43,12 @@ msgid "Go up"
msgstr "Arriba"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -68,16 +69,15 @@ msgstr "Cerrar"
msgid "Mouse click"
msgstr "Clic de ratón"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Mostrar el teclado"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Asignar teclas"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Activar pantalla completa"
@@ -89,18 +89,18 @@ msgstr "Elige la acción a asociar"
msgid "Map"
msgstr "Asignar"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "Aceptar"
@@ -127,15 +127,15 @@ msgstr "Por favor, selecciona una acción"
msgid "Press the key to associate"
msgstr "Pulsa la tecla a asignar"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Juego"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -143,29 +143,29 @@ msgstr ""
"Identificador usado para las partidas guardadas y para ejecutar el juego "
"desde la línea de comando"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Nombre:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Título completo del juego"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Nom.:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Idioma:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -173,280 +173,284 @@ msgstr ""
"Idioma del juego. No sirve para pasar al inglés la versión española de un "
"juego"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<por defecto>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plataforma:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plataforma para la que se diseñó el juego"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Plat.:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Gráficos"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Ignorar opciones gráficas generales"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Opciones gráficas específicas"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Sonido"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Ignorar opciones de sonido generales"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Opciones de sonido específicas"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volumen"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volumen"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Ignorar opciones de volumen generales"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Opciones de volumen específicas"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Ignorar opciones de MIDI generales"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Opciones de MIDI específicas"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Ignorar opciones de MT-32 generales"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Opciones de MT-32 específicas"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Rutas"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Rutas"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Juego:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Juego:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Adicional:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Especifica un directorio para datos adicionales del juego"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Adicional:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Partidas:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Especifica dónde guardar tus partidas"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Partidas:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Ninguna"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Por defecto"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Selecciona un SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Selecciona el directorio del juego"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Selecciona el directorio adicional"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Selecciona el directorio para partidas guardadas"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Esta ID ya está siendo usada. Por favor, elige otra."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~S~alir"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Salir de ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "Acerca ~d~e"
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Acerca de ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~pciones..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Cambiar opciones generales de ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~J~ugar"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Jugar al juego seleccionado"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~C~argar..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Cargar partida del juego seleccionado"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~A~ñadir juego..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Mantener pulsado Mayús para añadir varios juegos"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~E~ditar juego..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Cambiar opciones de juego"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "E~l~iminar juego"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Eliminar el juego de la lista. Los archivos no se borran"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~A~ñadir..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~E~ditar..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "E~l~iminar"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Buscar en la lista de juegos"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Buscar:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Cargar juego:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Cargar"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -454,7 +458,7 @@ msgstr ""
"¿Seguro que quieres ejecutar la detección masiva? Puede que se añada un gran "
"número de juegos."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -462,7 +466,7 @@ msgstr ""
msgid "Yes"
msgstr "Sí"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -470,37 +474,37 @@ msgstr "Sí"
msgid "No"
msgstr "No"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "¡ScummVM no ha podido abrir el directorio!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "¡ScummVM no ha encontrado ningún juego en el directorio!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Elige el juego:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "¿Seguro que quieres eliminar la configuración de este juego?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Este juego no permite cargar partidas desde el lanzador."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"¡ScummVM no ha podido encontrar ningún motor capaz de ejecutar el juego!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Añad. varios"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Añadir varios..."
@@ -567,104 +571,96 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Ninguno"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Fallo al aplicar algunos cambios en las opciones gráficas:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "no se ha podido cambiar el modo de vídeo."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "no se ha podido cambiar el ajuste de pantalla completa"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "no se ha podido cambiar el ajuste de corrección de aspecto"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Modo gráfico:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Renderizado:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
-msgstr "Modos especiales de expansión soportados por algunos juegos"
+msgstr "Modos especiales de expansión compatibles con algunos juegos"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Pantalla completa"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Corrección de aspecto"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Corregir relación de aspecto en juegos 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Difuminado EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Activar difuminado en los juegos EGA compatibles"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Disp. preferido:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Disp. de música:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
"Especifica qué dispositivo de sonido o emulador de tarjeta de sonido "
"prefieres"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr ""
"Especifica el dispositivo de sonido o emulador de tarjeta de sonido de salida"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Disp. preferido:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Disp. de música:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "Emul. de AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib se usa para la música en muchos juegos"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Frec. de salida:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -672,64 +668,64 @@ msgstr ""
"Los valores más altos ofrecen mayor calidad, pero puede que tu tarjeta de "
"sonido no sea compatible"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "Dispositivo GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Especifica el dispositivo de salida General MIDI por defecto"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "No usar música General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Utilizar el primer dispositivo disponible"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
-"SoundFont está soportado por algunas tarjetas de sonido, además de "
-"Fluidsynth y Timidity"
+"SoundFont es compatible con algunas tarjetas de sonido, con Fluidsynth y con "
+"Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Modo AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Usar tanto MIDI como AdLib en la generación de sonido"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Ganancia MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Disp. MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Especifica el dispositivo de sonido para la salida Roland MT-32/LAPC1/CM32l/"
"CM64 por defecto"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Roland MT-32 auténtica (desactivar emulación GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -737,191 +733,191 @@ msgstr ""
"Marcar si se quiere usar un dispositivo de sonido real conectado al "
"ordenador y compatible con Roland"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Roland MT-32 real (sin emulación GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Activar modo Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr "Desactiva la conversión General MIDI en juegos con sonido Roland MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "No usar música Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Texto y voces:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Voces"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Subtítulos"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Ambos"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Vel. de subtítulos:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Texto y voces:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Voz"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Subt"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "V&S"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Reproducir voces y subtítulos"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Vel. de subt.:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Música:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Música:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Silenciar"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Efectos:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volumen de los efectos de sonido"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Efectos:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Voces:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Voces:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Temas:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Temas:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Especifica el directorio adicional usado por los juegos y ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Plugins:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Plugins:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Otras"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Otras"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "Interfaz:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autoguardado:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autoguardado:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Teclas"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Idioma:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Idioma de la interfaz de ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
-msgstr "Tienes que reiniciar ScummVM para que los cambios surjan efecto."
+msgstr "Tienes que reiniciar ScummVM para aplicar los cambios."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Selecciona el directorio de guardado"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr ""
"No se puede escribir en el directorio elegido. Por favor, selecciona otro."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Selecciona el directorio de temas"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Selecciona el directorio adicional"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Selecciona el directorio de plugins"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -929,104 +925,140 @@ msgstr ""
"El tema seleccionado no es compatible con el idioma actual. Si quieres usar "
"este tema debes cambiar a otro idioma primero."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "No hay fecha guardada"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "No hay hora guardada"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "No hay tiempo guardado"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Borrar"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "¿Seguro que quieres borrar esta partida?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Fecha: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Hora: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Tiempo: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Partida sin nombre"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Guardar"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Fallo al guardar la partida"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Nombre:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Selecciona un tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX desactivados"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX desactivados"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Estándar (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Estándar (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Suavizado (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Suavizado (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Eliminar valor"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
-msgstr "El motor no soporta el nivel de debug '%s'"
+msgstr "El motor no es compatible con el nivel de debug '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menú"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausar"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Saltar frase"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Error al ejecutar el juego:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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"
@@ -1040,11 +1072,11 @@ msgstr "No se han encontrado datos de juego"
#: common/error.cpp:42
msgid "Game id not supported"
-msgstr "ID del juego no soportada"
+msgstr "ID del juego no compatible"
#: common/error.cpp:44
msgid "Unsupported color mode"
-msgstr "Modo de color no soportado"
+msgstr "Modo de color no compatible"
#: common/error.cpp:47
msgid "Read permission denied"
@@ -1094,16 +1126,16 @@ msgstr "Cancel·lat per l'usuari"
msgid "Unknown error"
msgstr "Error desconocido"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "El juego en '%s' parece ser desconocido."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr "Por favor, envía al equipo de ScummVM esta información junto al nombre"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "del juego que has intentado añadir y su versión/idioma/etc.:"
@@ -1131,22 +1163,23 @@ msgstr "~A~yuda"
msgid "~A~bout"
msgstr "Acerca ~d~e"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~V~olver al lanzador"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~V~olver al lanzador"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Guardar partida"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1155,7 +1188,7 @@ msgstr "Guardar partida"
msgid "Save"
msgstr "Guardar"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1165,27 +1198,27 @@ msgstr ""
"consulta el archivo README para encontrar información básica e instrucciones "
"para obtener más ayuda."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Lo sentimos, aún no hay ayuda disponible para este juego. Por favor, "
-"consulta el archivo README para encontrar información básica e instrucciones "
-"para obtener más ayuda."
+"Ha habido un fallo al guardar la partida (%s). Por favor, consulta el "
+"archivo README para encontrar información básica e instrucciones sobre cómo "
+"obtener más ayuda."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~S~í"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~C~ancelar"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~eclas"
@@ -1234,14 +1267,14 @@ msgstr ""
"Consulta el archivo README para más detalles."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Lo sentimos, aún no hay ayuda disponible para este juego. Por favor, "
-"consulta el archivo README para encontrar información básica e instrucciones "
-"para obtener más ayuda."
+"Ha habido un fallo al cargar la partida (%s). Por favor, consulta el archivo "
+"README para encontrar información básica e instrucciones sobre cómo obtener "
+"más ayuda."
#: engines/engine.cpp:439
msgid ""
@@ -1255,7 +1288,90 @@ msgstr ""
#: engines/engine.cpp:442
msgid "Start anyway"
-msgstr "Jugar de todos modos"
+msgstr "Jugar aun así"
+
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Usar pantallas de guardar/cargar originales"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"Utilizar las pantallas de guardar/cargar originales, en vez de las de ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Cargar partida:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Cargar"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Usar paleta original"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Utilizar los niveles de brillo originales del juego"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Difuminado EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Activar difuminado en los juegos EGA"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Preferir efectos de sonido digitales"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Preferir efectos de sonido digitales en vez de los sintetizados"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Usar IMF/Yamaha FB-01 para la salida MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Usa una tarjeta IBM Music o un módulo sintetizador Yamaha FB-01 FM para la "
+"salida MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Usar CD audio"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Usa CD audio en vez del sonido interno del juego, si está disponible"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Usar cursores de Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Usar los cursores de Windows (más pequeños y monocromos) en vez de los de DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Usar cursores plateados"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Usar los cursores plateados alternativos, en vez de los dorados normales"
#: engines/scumm/dialogs.cpp:175
#, c-format
@@ -1373,24 +1489,23 @@ msgstr "Voces y sub."
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Selecciona un nivel de dificultad."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Consulta el manual para obtener más información."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Estándar (16bpp)"
+msgstr "Estándar"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Práctica"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Experto"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1914,7 +2029,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:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1925,7 +2040,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1936,7 +2051,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1947,7 +2062,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1983,25 +2098,17 @@ msgstr "~M~enú principal"
msgid "~W~ater Effect Enabled"
msgstr "Efecto ag~u~a activado"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Cargar partida:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Cargar"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Fallo al guardar el estado del juego en el archivo."
@@ -2013,73 +2120,135 @@ msgstr "Fallo al borrar el archivo."
msgid "Failed to save game"
msgstr "Fallo al guardar la partida"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Risas del público"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Activa las risas del público"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Permitir omisiones"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Permite saltarse frases y vídeos"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Modo helio"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Activa el modo helio"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Desplazamiento suave"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Activa el desplazamiento de pantalla suave al caminar"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Cursores flotantes"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Activar cursores flotantes"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Barras de energía"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Activa las barras de energía"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Ataque 1"
#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Ataque 2"
#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Ataque 3"
#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Avanzar"
#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Retroceder"
#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Deslizarse a la izquierda"
#: engines/kyra/lol.cpp:484
-#, fuzzy
msgid "Slide Right"
-msgstr "Derecha"
+msgstr "Deslizarse a la derecha"
#: engines/kyra/lol.cpp:485
-#, fuzzy
msgid "Turn Left"
-msgstr "Apagar"
+msgstr "Girar a la izquierda"
#: engines/kyra/lol.cpp:486
-#, fuzzy
msgid "Turn Right"
-msgstr "Derecha"
+msgstr "Girar a la derecha"
#: engines/kyra/lol.cpp:487
-#, fuzzy
msgid "Rest"
-msgstr "Cargar"
+msgstr "Descansar"
#: engines/kyra/lol.cpp:488
-#, fuzzy
msgid "Options"
-msgstr "~O~pciones"
+msgstr "Opciones"
#: engines/kyra/lol.cpp:489
-#, fuzzy
msgid "Choose Spell"
-msgstr "Aceptar"
+msgstr "Elegir hechizo"
#: engines/kyra/sound_midi.cpp:475
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
-"Estás usando un dispositivo General Midi,\n"
-"pero el juego solo soporta MIDI Roland MT32.\n"
+"Estás usando un dispositivo General MIDI, pero el\n"
+"juego solo es compatible con MIDI Roland MT32.\n"
"Intentamos adaptar los instrumentos Roland MT32\n"
"a los de General MIDI, pero es posible que algunas\n"
-"de las pistas no se reproduzcan correctamente."
+"de las pistas no suenen correctamente."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr ""
+"Usa la introducción de la versión en disquete (solo para la versión CD)"
#: engines/sky/compact.cpp:130
msgid ""
@@ -2097,10 +2266,19 @@ msgstr ""
"El archivo \"sky.cpt\" tiene un tamaño incorrecto.\n"
"Por favor, vuelve a bajarlo de www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Intro de disquete"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr ""
+"Usa la introducción de la versión en disquete (solo para la versión CD)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "El vídeo de PSX '%s' no se puede reproducir en modo paleta"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2156,11 +2334,30 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Este es el final de la demo de Broken Sword 1"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"Se han encontrado vídeos DXA, pero se ha compilado ScummVM sin soporte zlib"
+"Se han encontrado vídeos PSX, pero se ha compilado ScummVM sin soporte de "
+"color RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Mostrar etiquetas de objetos"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Muestra las etiquetas de los objetos al pasar el ratón"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2171,15 +2368,15 @@ msgstr ""
"No se puede guardar en la ranura %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Cargando partida..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Guardando partida..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2196,11 +2393,11 @@ msgstr ""
"Pulsa Aceptar para actualizarlos, si no lo haces este mensaje volverá a "
"aparecer la próxima vez.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM ha convertido todas las partidas guardadas correctamente."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2302,7 +2499,6 @@ msgid "Keymap:"
msgstr "Asignación de teclas:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
msgstr "(Activa)"
@@ -2312,7 +2508,7 @@ msgstr "(Activa)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr "(Bloqueado)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2398,27 +2594,27 @@ msgstr "Sonido de alta calidad (más lento) (reinicio)"
msgid "Disable power off"
msgstr "Desactivar apagado"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Modo clic-de-ratón-y-arrastrar activado."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Modo clic-de-ratón-y-arrastrar desactivado."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Modo Touchpad activado."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Modo Touchpad desactivado."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Modo clic"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2426,12 +2622,11 @@ msgstr ""
msgid "Left Click"
msgstr "Clic izquierdo"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Objeto izquierdo del medio"
+msgstr "Clic central"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2468,34 +2663,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Desactivar la corrección de aspecto"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Filtro de gráficos activo:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Modo ventana"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Conservar"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
@@ -2836,43 +3031,43 @@ msgstr "Lanzador"
msgid "Do you really want to quit?"
msgstr "¿Realmente quieres salir?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "'Modo toque' de pantalla táctil - Clic izquierdo"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "'Modo toque' de pantalla táctil - Clic derecho"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "'Modo toque' de pantalla táctil - Flotante (sin clic)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Volumen máximo"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Aumentando el volumen"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Volumen mínimo"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Bajando el volumen"
#: backends/updates/macosx/macosx-updates.mm:65
msgid "Check for Updates..."
-msgstr "Comprobando las actualizaciones..."
+msgstr "Buscar actualizaciones..."
#: backends/platform/bada/form.cpp:269
msgid "Right Click Once"
diff --git a/po/eu.po b/po/eu.po
new file mode 100644
index 0000000000..b0fd177575
--- /dev/null
+++ b/po/eu.po
@@ -0,0 +1,3116 @@
+# Basque translation for ScummVM.
+# Copyright (C) 2011 ScummVM Team
+# This file is distributed under the same license as the ScummVM package.
+# Mikel Iturbe Urretxa <mikel@hamahiru.org>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: ScummVM 1.5.0git\n"
+"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2011-12-15 14:53+0100\n"
+"Last-Translator: Mikel Iturbe Urretxa <mikel@hamahiru.org>\n"
+"Language-Team: Librezale <librezale@librezale.org>\n"
+"Language: Euskara\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: gui/about.cpp:91
+#, c-format
+msgid "(built on %s)"
+msgstr "(%s-(e)an konpilatua)"
+
+#: gui/about.cpp:98
+msgid "Features compiled in:"
+msgstr "Ezaugarri erantsiak:"
+
+#: gui/about.cpp:107
+msgid "Available engines:"
+msgstr "Motore erabilgarriak:"
+
+#: gui/browser.cpp:66
+msgid "Go up"
+msgstr "Joan gora"
+
+#: gui/browser.cpp:66 gui/browser.cpp:68
+msgid "Go to previous directory level"
+msgstr "Igo aurreko direktorio-mailara"
+
+#: gui/browser.cpp:68
+msgctxt "lowres"
+msgid "Go up"
+msgstr "Joan gora"
+
+#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
+#: backends/events/default/default-events.cpp:191
+#: backends/events/default/default-events.cpp:213
+msgid "Cancel"
+msgstr "Utzi"
+
+#: gui/browser.cpp:70 gui/chooser.cpp:46 gui/themebrowser.cpp:55
+msgid "Choose"
+msgstr "Aukeratu"
+
+#: 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 "Itxi"
+
+#: gui/gui-manager.cpp:118
+msgid "Mouse click"
+msgstr "Sagu-klika"
+
+#: gui/gui-manager.cpp:122 base/main.cpp:300
+msgid "Display keyboard"
+msgstr "Teklatua erakutsi"
+
+#: gui/gui-manager.cpp:126 base/main.cpp:304
+msgid "Remap keys"
+msgstr "Teklak esleitu"
+
+#: gui/gui-manager.cpp:129 base/main.cpp:307
+msgid "Toggle FullScreen"
+msgstr "Txandakatu pantaila osoa"
+
+#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
+msgid "Choose an action to map"
+msgstr "Aukeratu esleituko den ekintza"
+
+#: gui/KeysDialog.cpp:41
+msgid "Map"
+msgstr "Esleitu"
+
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
+#: backends/platform/wince/CELauncherDialog.cpp:54
+msgid "OK"
+msgstr "Ados"
+
+#: gui/KeysDialog.cpp:49
+msgid "Select an action and click 'Map'"
+msgstr "Aukeratu ekintza eta sakatu \"Esleitu\""
+
+#: gui/KeysDialog.cpp:80 gui/KeysDialog.cpp:102 gui/KeysDialog.cpp:141
+#, c-format
+msgid "Associated key : %s"
+msgstr "Esleituriko tekla: %s"
+
+#: gui/KeysDialog.cpp:82 gui/KeysDialog.cpp:104 gui/KeysDialog.cpp:143
+#, c-format
+msgid "Associated key : none"
+msgstr "Esleituriko tekla: bat ere ez"
+
+#: gui/KeysDialog.cpp:90
+msgid "Please select an action"
+msgstr "Mesedez, aukeratu ekintza bat"
+
+#: gui/KeysDialog.cpp:106
+msgid "Press the key to associate"
+msgstr "Sakatu esleituko den tekla"
+
+#: gui/launcher.cpp:187
+msgid "Game"
+msgstr "Jokoa"
+
+#: gui/launcher.cpp:191
+msgid "ID:"
+msgstr "ID:"
+
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
+msgid ""
+"Short game identifier used for referring to savegames and running the game "
+"from the command line"
+msgstr ""
+"Partida gordeak identifikatzeko eta jokoa komando lerrotik abiarazteko "
+"erabiltzen den identifikatzailea"
+
+#: gui/launcher.cpp:193
+msgctxt "lowres"
+msgid "ID:"
+msgstr "ID:"
+
+#: gui/launcher.cpp:198
+msgid "Name:"
+msgstr "Izena:"
+
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
+msgid "Full title of the game"
+msgstr "Jokoaren izen osoa"
+
+#: gui/launcher.cpp:200
+msgctxt "lowres"
+msgid "Name:"
+msgstr "Izena:"
+
+#: gui/launcher.cpp:204
+msgid "Language:"
+msgstr "Hizkuntza:"
+
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
+msgid ""
+"Language of the game. This will not turn your Spanish game version into "
+"English"
+msgstr ""
+"Jokoaren hizkuntza. Honek ez du zure ingelesezko bertsioa frantsesera pasako"
+
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
+#: audio/null.cpp:40
+msgid "<default>"
+msgstr "<lehenetsia>"
+
+#: gui/launcher.cpp:216
+msgid "Platform:"
+msgstr "Plataforma:"
+
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
+msgid "Platform the game was originally designed for"
+msgstr "Jatorriz, jokoa diseinatua izan zen plataforma"
+
+#: gui/launcher.cpp:218
+msgctxt "lowres"
+msgid "Platform:"
+msgstr "Plataforma:"
+
+#: gui/launcher.cpp:231
+#, fuzzy
+msgid "Engine"
+msgstr "Aztertu"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
+msgid "Graphics"
+msgstr "Grafikoak"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
+msgid "GFX"
+msgstr "GFX"
+
+#: gui/launcher.cpp:242
+msgid "Override global graphic settings"
+msgstr "Ezarpen grafiko globalak baliogabetu"
+
+#: gui/launcher.cpp:244
+msgctxt "lowres"
+msgid "Override global graphic settings"
+msgstr "Ezarpen grafiko globalak baliogabetu"
+
+#: gui/launcher.cpp:251 gui/options.cpp:1085
+msgid "Audio"
+msgstr "Soinua"
+
+#: gui/launcher.cpp:254
+msgid "Override global audio settings"
+msgstr "Soinu ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:256
+msgctxt "lowres"
+msgid "Override global audio settings"
+msgstr "Soinu ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:265 gui/options.cpp:1090
+msgid "Volume"
+msgstr "Bolumena"
+
+#: gui/launcher.cpp:267 gui/options.cpp:1092
+msgctxt "lowres"
+msgid "Volume"
+msgstr "Bolumena"
+
+#: gui/launcher.cpp:270
+msgid "Override global volume settings"
+msgstr "Bolumen ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:272
+msgctxt "lowres"
+msgid "Override global volume settings"
+msgstr "Bolumen ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:280 gui/options.cpp:1100
+msgid "MIDI"
+msgstr "MIDI"
+
+#: gui/launcher.cpp:283
+msgid "Override global MIDI settings"
+msgstr "MIDI ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:285
+msgctxt "lowres"
+msgid "Override global MIDI settings"
+msgstr "MIDI ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:294 gui/options.cpp:1106
+msgid "MT-32"
+msgstr "MT-32"
+
+#: gui/launcher.cpp:297
+msgid "Override global MT-32 settings"
+msgstr "MT-32 ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:299
+msgctxt "lowres"
+msgid "Override global MT-32 settings"
+msgstr "MT-32 ezarpen globalak baliogabetu"
+
+#: gui/launcher.cpp:308 gui/options.cpp:1113
+msgid "Paths"
+msgstr "Bide-izenak"
+
+#: gui/launcher.cpp:310 gui/options.cpp:1115
+msgctxt "lowres"
+msgid "Paths"
+msgstr "Bideak"
+
+#: gui/launcher.cpp:317
+msgid "Game Path:"
+msgstr "Jokoa:"
+
+#: gui/launcher.cpp:319
+msgctxt "lowres"
+msgid "Game Path:"
+msgstr "Jokoa:"
+
+#: gui/launcher.cpp:324 gui/options.cpp:1139
+msgid "Extra Path:"
+msgstr "Gehigarriak:"
+
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
+msgid "Specifies path to additional data used the game"
+msgstr "Jokoak erabiltzen duen datu gehigarrien bide-izena"
+
+#: gui/launcher.cpp:326 gui/options.cpp:1141
+msgctxt "lowres"
+msgid "Extra Path:"
+msgstr "Gehigarria:"
+
+#: gui/launcher.cpp:333 gui/options.cpp:1123
+msgid "Save Path:"
+msgstr "Partida gordeak:"
+
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
+msgid "Specifies where your savegames are put"
+msgstr "Zure gordetako partidak non gordeko diren zehazten du"
+
+#: gui/launcher.cpp:335 gui/options.cpp:1125
+msgctxt "lowres"
+msgid "Save Path:"
+msgstr "Partida gordeak:"
+
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
+msgctxt "path"
+msgid "None"
+msgstr "Bat ere ez"
+
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
+#: backends/platform/wii/options.cpp:56
+msgid "Default"
+msgstr "Lehenetsia"
+
+#: gui/launcher.cpp:504 gui/options.cpp:1417
+msgid "Select SoundFont"
+msgstr "SoundFont-a aukeratu"
+
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
+msgid "Select directory with game data"
+msgstr "Jokoaren direktorioa aukeratu"
+
+#: gui/launcher.cpp:541
+msgid "Select additional game directory"
+msgstr "Direktorio gehigarria aukeratu"
+
+#: gui/launcher.cpp:553
+msgid "Select directory for saved games"
+msgstr "Partida gordeen direktorioa aukeratu"
+
+#: gui/launcher.cpp:580
+msgid "This game ID is already taken. Please choose another one."
+msgstr "ID hau jada erabilia izaten ari da. Mesedez, aukeratu beste bat."
+
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
+msgid "~Q~uit"
+msgstr "~I~rten"
+
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
+msgid "Quit ScummVM"
+msgstr "Irten ScummVM-tik"
+
+#: gui/launcher.cpp:622
+msgid "A~b~out..."
+msgstr "Ho~n~i buruz..."
+
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
+msgid "About ScummVM"
+msgstr "ScummVM-i buruz"
+
+#: gui/launcher.cpp:623
+msgid "~O~ptions..."
+msgstr "~A~ukerak"
+
+#: gui/launcher.cpp:623
+msgid "Change global ScummVM options"
+msgstr "ScummVM-ren aukera globalak aldatu"
+
+#: gui/launcher.cpp:625
+msgid "~S~tart"
+msgstr "~H~asi"
+
+#: gui/launcher.cpp:625
+msgid "Start selected game"
+msgstr "Aukeraturiko jokora jolastu"
+
+#: gui/launcher.cpp:628
+msgid "~L~oad..."
+msgstr "~K~argatu"
+
+#: gui/launcher.cpp:628
+msgid "Load savegame for selected game"
+msgstr "Aukeraturiko jokorako partida gordea kargatu"
+
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
+msgid "~A~dd Game..."
+msgstr "~G~ehitu..."
+
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
+msgid "Hold Shift for Mass Add"
+msgstr "Shift mantendu sakaturik hainbat joko gehitzeko"
+
+#: gui/launcher.cpp:635
+msgid "~E~dit Game..."
+msgstr "~E~ditatu..."
+
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
+msgid "Change game options"
+msgstr "Aldatu jokoaren aukerak"
+
+#: gui/launcher.cpp:637
+msgid "~R~emove Game"
+msgstr "~K~endu jokoa"
+
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
+msgid "Remove game from the list. The game data files stay intact"
+msgstr "Jokoa zerrendatik kendu. Jokoaren fitxategiak ez dira ezabatzen"
+
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
+msgctxt "lowres"
+msgid "~A~dd Game..."
+msgstr "~G~ehitu..."
+
+#: gui/launcher.cpp:642
+msgctxt "lowres"
+msgid "~E~dit Game..."
+msgstr "~E~ditatu..."
+
+#: gui/launcher.cpp:644
+msgctxt "lowres"
+msgid "~R~emove Game"
+msgstr "~K~endu"
+
+#: gui/launcher.cpp:652
+msgid "Search in game list"
+msgstr "Bilatu joko-zerrendan"
+
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
+msgid "Search:"
+msgstr "Bilatu:"
+
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
+msgid "Load game:"
+msgstr "Jokoa kargatu:"
+
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
+#: backends/platform/wince/CEActionsSmartphone.cpp:231
+msgid "Load"
+msgstr "Kargatu"
+
+#: gui/launcher.cpp:788
+msgid ""
+"Do you really want to run the mass game detector? This could potentially add "
+"a huge number of games."
+msgstr ""
+"Joko detektatzaile masiboa exekutatu nahi al duzu? Honek joko kantitate "
+"handia gehitu dezake."
+
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
+#: backends/events/symbiansdl/symbiansdl-events.cpp:184
+#: backends/platform/wince/CEActionsPocket.cpp:326
+#: backends/platform/wince/CEActionsSmartphone.cpp:287
+#: backends/platform/wince/CELauncherDialog.cpp:83
+msgid "Yes"
+msgstr "Bai"
+
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
+#: backends/events/symbiansdl/symbiansdl-events.cpp:184
+#: backends/platform/wince/CEActionsPocket.cpp:326
+#: backends/platform/wince/CEActionsSmartphone.cpp:287
+#: backends/platform/wince/CELauncherDialog.cpp:83
+msgid "No"
+msgstr "Ez"
+
+#: gui/launcher.cpp:837
+msgid "ScummVM couldn't open the specified directory!"
+msgstr "ScummVM-k ezin izan du zehazturiko direktorioa ireki!"
+
+#: gui/launcher.cpp:849
+msgid "ScummVM could not find any game in the specified directory!"
+msgstr "ScummVM-k ezin izan du jokorik aurkitu zehazturiko direktorioan!"
+
+#: gui/launcher.cpp:863
+msgid "Pick the game:"
+msgstr "Jokoa aukeratu:"
+
+#: gui/launcher.cpp:937
+msgid "Do you really want to remove this game configuration?"
+msgstr "Benetan ezabatu nahi duzu joko-konfigurazio hau?"
+
+#: gui/launcher.cpp:1001
+msgid "This game does not support loading games from the launcher."
+msgstr "Joko honek ez du uzten partidak abiarazletik kargatzen."
+
+#: gui/launcher.cpp:1005
+msgid "ScummVM could not find any engine capable of running the selected game!"
+msgstr ""
+"ScummVM-k ezin izan du aukeraturiko jokoa exekutatzeko gai den motorerik "
+"aurkitu!"
+
+#: gui/launcher.cpp:1119
+msgctxt "lowres"
+msgid "Mass Add..."
+msgstr "Hainbat gehitu..."
+
+#: gui/launcher.cpp:1119
+msgid "Mass Add..."
+msgstr "Hainbat gehitu..."
+
+#: gui/massadd.cpp:78 gui/massadd.cpp:81
+msgid "... progress ..."
+msgstr "... aurrerapena ..."
+
+#: gui/massadd.cpp:258
+msgid "Scan complete!"
+msgstr "Bilaketa amaitua!"
+
+#: gui/massadd.cpp:261
+#, c-format
+msgid "Discovered %d new games, ignored %d previously added games."
+msgstr ""
+"%d joko berri aurkitu dira, aurretik gehituriko %d ez dira kontuan hartu"
+
+#: gui/massadd.cpp:265
+#, c-format
+msgid "Scanned %d directories ..."
+msgstr "%d direktorio eskaneatu dira ..."
+
+#: gui/massadd.cpp:268
+#, c-format
+msgid "Discovered %d new games, ignored %d previously added games ..."
+msgstr ""
+"%d joko berri aurkitu dira, aurretik gehituriko %d ez dira kontuan hartu"
+
+#: gui/options.cpp:78
+msgid "Never"
+msgstr "Inoiz ez"
+
+#: gui/options.cpp:78
+msgid "every 5 mins"
+msgstr "5 minuturo"
+
+#: gui/options.cpp:78
+msgid "every 10 mins"
+msgstr "10 minuturo"
+
+#: gui/options.cpp:78
+msgid "every 15 mins"
+msgstr "15 minuturo"
+
+#: gui/options.cpp:78
+msgid "every 30 mins"
+msgstr "30 minuturo"
+
+#: gui/options.cpp:80
+msgid "8 kHz"
+msgstr "8 kHz"
+
+#: gui/options.cpp:80
+msgid "11kHz"
+msgstr "11kHz"
+
+#: gui/options.cpp:80
+msgid "22 kHz"
+msgstr "22 kHz"
+
+#: gui/options.cpp:80
+msgid "44 kHz"
+msgstr "44 kHz"
+
+#: gui/options.cpp:80
+msgid "48 kHz"
+msgstr "48 kHz"
+
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
+msgctxt "soundfont"
+msgid "None"
+msgstr "Bat ere ez"
+
+#: gui/options.cpp:382
+msgid "Failed to apply some of the graphic options changes:"
+msgstr "Ezin izan da grafikoen aukeretako batzuk aplikatu:"
+
+#: gui/options.cpp:394
+msgid "the video mode could not be changed."
+msgstr "ezin izan da bideo-modua aldatu."
+
+#: gui/options.cpp:400
+msgid "the fullscreen setting could not be changed"
+msgstr "ezin izan da pantaila-osoaren ezarpena aldatu"
+
+#: gui/options.cpp:406
+msgid "the aspect ratio setting could not be changed"
+msgstr "formatu-ratioaren ezarpena ezin izan da aldatu"
+
+#: gui/options.cpp:727
+msgid "Graphics mode:"
+msgstr "Modu grafikoa:"
+
+#: gui/options.cpp:741
+msgid "Render mode:"
+msgstr "Renderizazioa:"
+
+#: gui/options.cpp:741 gui/options.cpp:742
+msgid "Special dithering modes supported by some games"
+msgstr "Joko batzuk onarturiko lausotze-modu bereziak"
+
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
+msgid "Fullscreen mode"
+msgstr "Pantaila osoa"
+
+#: gui/options.cpp:756
+msgid "Aspect ratio correction"
+msgstr "Formatu-ratioaren zuzenketa"
+
+#: gui/options.cpp:756
+msgid "Correct aspect ratio for 320x200 games"
+msgstr "320x200 jokoentzako formatu-ratioa zuzendu"
+
+#: gui/options.cpp:764
+msgid "Preferred Device:"
+msgstr "Gogoko gailua:"
+
+#: gui/options.cpp:764
+msgid "Music Device:"
+msgstr "Musika gailua:"
+
+#: gui/options.cpp:764 gui/options.cpp:766
+msgid "Specifies preferred sound device or sound card emulator"
+msgstr "Gogoko soinu txartel edo emuladorea zein den ezartzen du"
+
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
+msgid "Specifies output sound device or sound card emulator"
+msgstr "Irteerako soinu txartel edo emuladorea ezartzen du"
+
+#: gui/options.cpp:766
+msgctxt "lowres"
+msgid "Preferred Dev.:"
+msgstr "Gail. gogokoa:"
+
+#: gui/options.cpp:766
+msgctxt "lowres"
+msgid "Music Device:"
+msgstr "Musika gailua:"
+
+#: gui/options.cpp:793
+msgid "AdLib emulator:"
+msgstr "AdLib emuladorea:"
+
+#: gui/options.cpp:793 gui/options.cpp:794
+msgid "AdLib is used for music in many games"
+msgstr "AdLib musikarako hainbat jokotan erabiltzen da"
+
+#: gui/options.cpp:804
+msgid "Output rate:"
+msgstr "Irteera maizt.:"
+
+#: gui/options.cpp:804 gui/options.cpp:805
+msgid ""
+"Higher value specifies better sound quality but may be not supported by your "
+"soundcard"
+msgstr ""
+"Balio altuagoek soinu kalitate hobea ezartzen dute, baina baliteke zure "
+"soinu-txartela bateragarria ez izatea"
+
+#: gui/options.cpp:815
+msgid "GM Device:"
+msgstr "GM gailua:"
+
+#: gui/options.cpp:815
+msgid "Specifies default sound device for General MIDI output"
+msgstr "Defektuzko soinu txartela ezartzen du General MIDI irteerarako"
+
+#: gui/options.cpp:826
+msgid "Don't use General MIDI music"
+msgstr "Ez erabili General MIDI musika"
+
+#: gui/options.cpp:837 gui/options.cpp:899
+msgid "Use first available device"
+msgstr "Erabilgarri dagoen lehen gailua erabili"
+
+#: gui/options.cpp:849
+msgid "SoundFont:"
+msgstr "SoundFont:"
+
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
+msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
+msgstr ""
+"Zenbait soinu txartel bateragarriak dira SoundFont-ekin, Fluidsynth eta "
+"Timidity besteak beste"
+
+#: gui/options.cpp:851
+msgctxt "lowres"
+msgid "SoundFont:"
+msgstr "SoundFont:"
+
+#: gui/options.cpp:857
+msgid "Mixed AdLib/MIDI mode"
+msgstr "AdLib/MIDI modua"
+
+#: gui/options.cpp:857
+msgid "Use both MIDI and AdLib sound generation"
+msgstr "Soinua sortzerakoan MIDI eta AdLib erabili"
+
+#: gui/options.cpp:860
+msgid "MIDI gain:"
+msgstr "MIDI irabazia:"
+
+#: gui/options.cpp:870
+msgid "MT-32 Device:"
+msgstr "MT-32 gailua:"
+
+#: gui/options.cpp:870
+msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
+msgstr ""
+"Roland MT-32/LAPC1/CM32l/CM64 irteerarako defektuzko soinu txartela ezartzen "
+"du"
+
+#: gui/options.cpp:875
+msgid "True Roland MT-32 (disable GM emulation)"
+msgstr "Benetako Roland MT-32 (GM emulazio gabe)"
+
+#: gui/options.cpp:875 gui/options.cpp:877
+msgid ""
+"Check if you want to use your real hardware Roland-compatible sound device "
+"connected to your computer"
+msgstr ""
+"Markatu ordenagailura konektaturiko Roland-ekin bateragarria den soinu-"
+"gailua erabiltzeko"
+
+#: gui/options.cpp:877
+msgctxt "lowres"
+msgid "True Roland MT-32 (no GM emulation)"
+msgstr "Benetako Roland MT-32 (GM emulazio gabe)"
+
+#: gui/options.cpp:880
+msgid "Enable Roland GS Mode"
+msgstr "Roland GS modua gaitu"
+
+#: gui/options.cpp:880
+msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
+msgstr ""
+"Roland MT-32 soinua duten jokoetan General MIDI bihurtzea desgaitzen du"
+
+#: gui/options.cpp:889
+msgid "Don't use Roland MT-32 music"
+msgstr "Ez erabili Roland MT-32 musika"
+
+#: gui/options.cpp:916
+msgid "Text and Speech:"
+msgstr "Testu eta ahotsa:"
+
+#: gui/options.cpp:920 gui/options.cpp:930
+msgid "Speech"
+msgstr "Ahotsa"
+
+#: gui/options.cpp:921 gui/options.cpp:931
+msgid "Subtitles"
+msgstr "Azpitituluak"
+
+#: gui/options.cpp:922
+msgid "Both"
+msgstr "Biak"
+
+#: gui/options.cpp:924
+msgid "Subtitle speed:"
+msgstr "Azpitit. abiadura:"
+
+#: gui/options.cpp:926
+msgctxt "lowres"
+msgid "Text and Speech:"
+msgstr "Testu eta ahotsa:"
+
+#: gui/options.cpp:930
+msgid "Spch"
+msgstr "Ahots."
+
+#: gui/options.cpp:931
+msgid "Subs"
+msgstr "Azp."
+
+#: gui/options.cpp:932
+msgctxt "lowres"
+msgid "Both"
+msgstr "Biak"
+
+#: gui/options.cpp:932
+msgid "Show subtitles and play speech"
+msgstr "Ahotsak erreproduzitu eta azpitituluak erakutsi"
+
+#: gui/options.cpp:934
+msgctxt "lowres"
+msgid "Subtitle speed:"
+msgstr "Azpit. abiadura:"
+
+#: gui/options.cpp:950
+msgid "Music volume:"
+msgstr "Musika:"
+
+#: gui/options.cpp:952
+msgctxt "lowres"
+msgid "Music volume:"
+msgstr "Musika:"
+
+#: gui/options.cpp:959
+msgid "Mute All"
+msgstr "Mututu dena"
+
+#: gui/options.cpp:962
+msgid "SFX volume:"
+msgstr "Efektuak:"
+
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
+msgid "Special sound effects volume"
+msgstr "Soinu efektu berezien bolumena"
+
+#: gui/options.cpp:964
+msgctxt "lowres"
+msgid "SFX volume:"
+msgstr "Efektuak:"
+
+#: gui/options.cpp:972
+msgid "Speech volume:"
+msgstr "Ahotsak:"
+
+#: gui/options.cpp:974
+msgctxt "lowres"
+msgid "Speech volume:"
+msgstr "Ahotsak:"
+
+#: gui/options.cpp:1131
+msgid "Theme Path:"
+msgstr "Gaiak:"
+
+#: gui/options.cpp:1133
+msgctxt "lowres"
+msgid "Theme Path:"
+msgstr "Gaiak:"
+
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
+msgid "Specifies path to additional data used by all games or ScummVM"
+msgstr ""
+"Joko guztiek edo ScummVM-k darabilten datu gehigarrien bide-izena ezartzen du"
+
+#: gui/options.cpp:1148
+msgid "Plugins Path:"
+msgstr "Pluginak:"
+
+#: gui/options.cpp:1150
+msgctxt "lowres"
+msgid "Plugins Path:"
+msgstr "Pluginak:"
+
+#: gui/options.cpp:1159
+msgid "Misc"
+msgstr "Beste"
+
+#: gui/options.cpp:1161
+msgctxt "lowres"
+msgid "Misc"
+msgstr "Beste"
+
+#: gui/options.cpp:1163
+msgid "Theme:"
+msgstr "Gaia:"
+
+#: gui/options.cpp:1167
+msgid "GUI Renderer:"
+msgstr "Interfazea:"
+
+#: gui/options.cpp:1179
+msgid "Autosave:"
+msgstr "Autogordetzea:"
+
+#: gui/options.cpp:1181
+msgctxt "lowres"
+msgid "Autosave:"
+msgstr "Autogordetzea:"
+
+#: gui/options.cpp:1189
+msgid "Keys"
+msgstr "Teklak"
+
+#: gui/options.cpp:1196
+msgid "GUI Language:"
+msgstr "Hizkuntza"
+
+#: gui/options.cpp:1196
+msgid "Language of ScummVM GUI"
+msgstr "ScummVM interfazearen hizkuntza"
+
+#: gui/options.cpp:1347
+msgid "You have to restart ScummVM before your changes will take effect."
+msgstr "ScummVM berrabiarazi behar duzu aldaketak indarrean jartzeko"
+
+#: gui/options.cpp:1360
+msgid "Select directory for savegames"
+msgstr "Gordetako partiden direktorioa aukeratu"
+
+#: gui/options.cpp:1367
+msgid "The chosen directory cannot be written to. Please select another one."
+msgstr "Aukeraturiko direktorioan ezin da idatzi. Mesedez, aukeratu beste bat."
+
+#: gui/options.cpp:1376
+msgid "Select directory for GUI themes"
+msgstr "Gaien direktorioa aukeratu"
+
+#: gui/options.cpp:1386
+msgid "Select directory for extra files"
+msgstr "Fitxategi gehigarrien direktorioa aukeratu"
+
+#: gui/options.cpp:1397
+msgid "Select directory for plugins"
+msgstr "Pluginen direktorioa aukeratu"
+
+#: gui/options.cpp:1450
+msgid ""
+"The theme you selected does not support your current language. If you want "
+"to use this theme you need to switch to another language first."
+msgstr ""
+"Aukeraturiko gaia ez da zure hizkuntzarekin bateragarria. Gai hau erabili "
+"nahi baduzu, aurretik beste hizkuntza batera pasa behar duzu."
+
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
+msgid "No date saved"
+msgstr "Ez dago datarik gordeta"
+
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
+msgid "No time saved"
+msgstr "Ez dago ordurik gordeta"
+
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
+msgid "No playtime saved"
+msgstr "Ez dago denborarik gordeta"
+
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
+msgid "Delete"
+msgstr "Ezabatu"
+
+#: gui/saveload-dialog.cpp:266
+msgid "Do you really want to delete this savegame?"
+msgstr "Ezabatu partida gorde hau?"
+
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
+msgid "Date: "
+msgstr "Data:"
+
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
+msgid "Time: "
+msgstr "Ordua"
+
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
+msgid "Playtime: "
+msgstr "Denbora:"
+
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
+msgid "Untitled savestate"
+msgstr "Titulurik gabeko partida"
+
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Gorde"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Ezin izan da jokoa gorde"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Izena:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
+#: gui/themebrowser.cpp:44
+msgid "Select a Theme"
+msgstr "Gaia aukeratu"
+
+#: gui/ThemeEngine.cpp:337
+msgid "Disabled GFX"
+msgstr "GFX desgaituta"
+
+#: gui/ThemeEngine.cpp:337
+msgctxt "lowres"
+msgid "Disabled GFX"
+msgstr "GFX desgaituta"
+
+#: gui/ThemeEngine.cpp:338
+msgid "Standard Renderer (16bpp)"
+msgstr "Estandarra (16bpp)"
+
+#: gui/ThemeEngine.cpp:338
+msgid "Standard (16bpp)"
+msgstr "Estandarra (16bpp)"
+
+#: gui/ThemeEngine.cpp:340
+msgid "Antialiased Renderer (16bpp)"
+msgstr "Lausotua (16bpp)"
+
+#: gui/ThemeEngine.cpp:340
+msgid "Antialiased (16bpp)"
+msgstr "Lausotua (16bpp)"
+
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
+msgid "Clear value"
+msgstr "Balioa kendu:"
+
+#: base/main.cpp:209
+#, c-format
+msgid "Engine does not support debug level '%s'"
+msgstr "Motoreak ez da '%s' debug mailarekin bateragarria"
+
+#: base/main.cpp:287
+msgid "Menu"
+msgstr "Menua"
+
+#: base/main.cpp:290 backends/platform/symbian/src/SymbianActions.cpp:45
+#: backends/platform/wince/CEActionsPocket.cpp:45
+#: backends/platform/wince/CEActionsSmartphone.cpp:46
+msgid "Skip"
+msgstr "Saltatu"
+
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
+#: backends/platform/wince/CEActionsPocket.cpp:42
+msgid "Pause"
+msgstr "Gelditu"
+
+#: base/main.cpp:296
+msgid "Skip line"
+msgstr "Lerroa saltatu"
+
+#: base/main.cpp:467
+msgid "Error running game:"
+msgstr "Jokoa exekutatzean errorea:"
+
+#: base/main.cpp:491
+msgid "Could not find any engine capable of running the selected game"
+msgstr "Ezin izan da aukeraturiko jokoa exekutatzeko gai den motorerik aurkitu"
+
+#: common/error.cpp:38
+msgid "No error"
+msgstr "Errorerik ez"
+
+#: common/error.cpp:40
+msgid "Game data not found"
+msgstr "Jokoaren datuak ez dira aurkitu"
+
+#: common/error.cpp:42
+msgid "Game id not supported"
+msgstr "Jokoaren ID ez-onartua"
+
+#: common/error.cpp:44
+msgid "Unsupported color mode"
+msgstr "Kolore modu ez-onartua"
+
+#: common/error.cpp:47
+msgid "Read permission denied"
+msgstr "Irakurketa baimena ukatua"
+
+#: common/error.cpp:49
+msgid "Write permission denied"
+msgstr "Idazketa baimena ukatua"
+
+#: common/error.cpp:52
+msgid "Path does not exist"
+msgstr "Bide-izena ez da existitzen"
+
+#: common/error.cpp:54
+msgid "Path not a directory"
+msgstr "Bide-izena ez da direktorioa"
+
+#: common/error.cpp:56
+msgid "Path not a file"
+msgstr "Bide-izena ez da fitxategia"
+
+#: common/error.cpp:59
+msgid "Cannot create file"
+msgstr "Fitxategia ezin da sortu"
+
+#: common/error.cpp:61
+msgid "Reading data failed"
+msgstr "Errorea irakurtzean"
+
+#: common/error.cpp:63
+msgid "Writing data failed"
+msgstr "Errorea idaztean"
+
+#: common/error.cpp:66
+msgid "Could not find suitable engine plugin"
+msgstr "Ezin izan da motore-plugin egokirik aurkitu"
+
+#: common/error.cpp:68
+msgid "Engine plugin does not support save states"
+msgstr "Motore-pluginak ez ditu gordetako partidak onartzen"
+
+#: common/error.cpp:71
+msgid "User canceled"
+msgstr "Erabiltzaileak utzia"
+
+#: common/error.cpp:75
+msgid "Unknown error"
+msgstr "Errore ezezaguna"
+
+#: engines/advancedDetector.cpp:316
+#, c-format
+msgid "The game in '%s' seems to be unknown."
+msgstr "'%s'-(e)ko jokoa ezezaguna dela dirudi"
+
+#: engines/advancedDetector.cpp:317
+msgid "Please, report the following data to the ScummVM team along with name"
+msgstr "Mesedez, bidali hurrengo datuak ScummVM taldeari gehitzen saiatu zaren"
+
+#: engines/advancedDetector.cpp:319
+msgid "of the game you tried to add and its version/language/etc.:"
+msgstr "jokoaren izen, bertsio/hizkuntza/e.a.-ekin batera:"
+
+#: engines/dialogs.cpp:84
+msgid "~R~esume"
+msgstr "~J~arraitu"
+
+#: engines/dialogs.cpp:86
+msgid "~L~oad"
+msgstr "Ka~r~gatu"
+
+#: engines/dialogs.cpp:90
+msgid "~S~ave"
+msgstr "~G~orde"
+
+#: engines/dialogs.cpp:94
+msgid "~O~ptions"
+msgstr "~A~ukerak"
+
+#: engines/dialogs.cpp:99
+msgid "~H~elp"
+msgstr "~L~aguntza"
+
+#: engines/dialogs.cpp:101
+msgid "~A~bout"
+msgstr "Ho~n~i buruz"
+
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
+msgid "~R~eturn to Launcher"
+msgstr "It~z~uli abiarazlera"
+
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
+msgctxt "lowres"
+msgid "~R~eturn to Launcher"
+msgstr "It~z~uli abiarazlera"
+
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
+msgid "Save game:"
+msgstr "Gorde jokoa:"
+
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
+#: backends/platform/symbian/src/SymbianActions.cpp:44
+#: backends/platform/wince/CEActionsPocket.cpp:43
+#: backends/platform/wince/CEActionsPocket.cpp:267
+#: backends/platform/wince/CEActionsSmartphone.cpp:45
+#: backends/platform/wince/CEActionsSmartphone.cpp:231
+msgid "Save"
+msgstr "Gorde"
+
+#: engines/dialogs.cpp:144
+msgid ""
+"Sorry, this engine does not currently provide in-game help. Please consult "
+"the README for basic information, and for instructions on how to obtain "
+"further assistance."
+msgstr ""
+"Barkatu, motore honek ez du joko barruan laguntzarik eskaintzen. Jo ezazu "
+"README-ra oinarrizko informaziorako eta laguntza gehiago nola jaso jakiteko."
+
+#: engines/dialogs.cpp:228
+#, c-format
+msgid ""
+"Gamestate save failed (%s)! Please consult the README for basic information, "
+"and for instructions on how to obtain further assistance."
+msgstr ""
+"Jokoaren egoera gordetzeak huts egin du (%s)! Jo ezazu README-ra oinarrizko "
+"informaziorako eta laguntza gehiago nola jaso jakiteko."
+
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
+#: engines/mohawk/dialogs.cpp:174
+msgid "~O~K"
+msgstr "~A~dos"
+
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
+#: engines/mohawk/dialogs.cpp:175
+msgid "~C~ancel"
+msgstr "~U~tzi"
+
+#: engines/dialogs.cpp:305
+msgid "~K~eys"
+msgstr "~T~eklak"
+
+#: engines/engine.cpp:235
+msgid "Could not initialize color format."
+msgstr "Kolore formatua ezin izan da hasieratu."
+
+#: engines/engine.cpp:243
+msgid "Could not switch to video mode: '"
+msgstr "Ezin izan da aldatu bideo modura : '"
+
+#: engines/engine.cpp:252
+msgid "Could not apply aspect ratio setting."
+msgstr "Ezin izan da formatu-ratio ezarpena aplikatu."
+
+#: engines/engine.cpp:257
+msgid "Could not apply fullscreen setting."
+msgstr "Ezin izan da pantaila-osoa ezarpena aplikatu."
+
+#: engines/engine.cpp:357
+msgid ""
+"You appear to be playing this game directly\n"
+"from the CD. This is known to cause problems,\n"
+"and it is therefore recommended that you copy\n"
+"the data files to your hard disk instead.\n"
+"See the README file for details."
+msgstr ""
+"Joko honetara zuzenean CD-tik jolasten\n"
+"zaudela ematen du. Jakina da honek arazoak\n"
+"sortzen dituela eta beraz gomendagarria da\n"
+"fitxategiak disko gogorrera kopiatzea.\n"
+"Jo README fitxategira xehetasunetarako."
+
+#: 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"
+"an appropriate CD audio extracting tool in\n"
+"order to listen to the game's music.\n"
+"See the README file for details."
+msgstr ""
+"Joko honek bere diskoan audio pistak ditu.\n"
+"Pista hauek diskotik erauzi behar dira erauzle\n"
+"egoki bat erabiliz, jokoko musika entzun ahal\n"
+"izateko. Jo README fitxategira\n"
+"xehetasunetarako."
+
+#: engines/engine.cpp:426
+#, c-format
+msgid ""
+"Gamestate load failed (%s)! Please consult the README for basic information, "
+"and for instructions on how to obtain further assistance."
+msgstr ""
+"Jokoaren egoera kargatzeak huts egin du (%s)! Jo ezazu README-ra oinarrizko "
+"informaziorako eta laguntza gehiago nola jaso jakiteko."
+
+#: engines/engine.cpp:439
+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 ""
+"ABISUA: ScummVM-k ez du guztiz onartzen exekutatuko duzun jokoa oraindik. "
+"Hori dela eta, ezegonkorra izan daiteke eta gerta daiteke gordeta izan "
+"ditzakezun partidan ez ibiltzea ScummVM-ren etorkizuneko bertsioetan."
+
+#: engines/engine.cpp:442
+msgid "Start anyway"
+msgstr "Jolastu berdin-berdin"
+
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr ""
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Jokoa kargatu:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Kargatu"
+
+#: engines/dreamweb/detection.cpp:57
+#, fuzzy
+msgid "Use bright palette mode"
+msgstr "Goiko eskuineko objektua"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr ""
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA lausotzea"
+
+#: engines/sci/detection.cpp:371
+#, fuzzy
+msgid "Enable undithering in EGA games"
+msgstr "EGA lausotzea gaitu joko bateragarrietan"
+
+#: engines/sci/detection.cpp:380
+#, fuzzy
+msgid "Prefer digital sound effects"
+msgstr "Soinu efektu berezien bolumena"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr ""
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr ""
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr ""
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:433
+#, fuzzy
+msgid "Use silver cursors"
+msgstr "Kurtsore normala"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+
+#: engines/scumm/dialogs.cpp:175
+#, c-format
+msgid "Insert Disk %c and Press Button to Continue."
+msgstr "%c diskoa sartu eta sakatu botoi bat jarraitzeko."
+
+#: engines/scumm/dialogs.cpp:176
+#, c-format
+msgid "Unable to Find %s, (%c%d) Press Button."
+msgstr "Ezin izan da %s, (%c%d) aurkitu. Sakatu botoi bat"
+
+#: engines/scumm/dialogs.cpp:177
+#, c-format
+msgid "Error reading disk %c, (%c%d) Press Button."
+msgstr "%c, (%c%d) diskoa irakurtzean errorea. Sakatu botoia."
+
+#: engines/scumm/dialogs.cpp:178
+msgid "Game Paused. Press SPACE to Continue."
+msgstr "Joko pausatua. Sakatu ZURIUNEA jarraitzeko."
+
+#. I18N: You may specify 'Yes' symbol at the end of the line, like this:
+#. "Moechten Sie wirklich neu starten? (J/N)J"
+#. Will react to J as 'Yes'
+#: engines/scumm/dialogs.cpp:182
+msgid "Are you sure you want to restart? (Y/N)"
+msgstr "Ziur zaude berrabiarazi nahi duzula (B/E)B"
+
+#. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
+#: engines/scumm/dialogs.cpp:184
+msgid "Are you sure you want to quit? (Y/N)"
+msgstr "Ziur zaude irten nahi duzula? (B/E)B"
+
+#: engines/scumm/dialogs.cpp:189
+msgid "Play"
+msgstr "Jolastu"
+
+#: engines/scumm/dialogs.cpp:191 engines/scumm/help.cpp:82
+#: engines/scumm/help.cpp:84
+#: backends/platform/symbian/src/SymbianActions.cpp:52
+#: backends/platform/wince/CEActionsPocket.cpp:44
+#: backends/platform/wince/CEActionsSmartphone.cpp:52
+#: backends/events/default/default-events.cpp:213
+msgid "Quit"
+msgstr "Irten"
+
+#: engines/scumm/dialogs.cpp:193
+msgid "Insert save/load game disk"
+msgstr "Sartu partida gordeak dituen diskoa"
+
+#: engines/scumm/dialogs.cpp:194
+msgid "You must enter a name"
+msgstr "Izen bat sartu behar duzu"
+
+#: engines/scumm/dialogs.cpp:195
+msgid "The game was NOT saved (disk full?)"
+msgstr "Jokoa EZ da gorde (diskoa beteta?)"
+
+#: engines/scumm/dialogs.cpp:196
+msgid "The game was NOT loaded"
+msgstr "Jokoa EZ da kargatu"
+
+#: engines/scumm/dialogs.cpp:197
+#, c-format
+msgid "Saving '%s'"
+msgstr "'%s' gordetzen"
+
+#: engines/scumm/dialogs.cpp:198
+#, c-format
+msgid "Loading '%s'"
+msgstr "'%s' kargatzen"
+
+#: engines/scumm/dialogs.cpp:199
+msgid "Name your SAVE game"
+msgstr "Izendatu zure partida"
+
+#: engines/scumm/dialogs.cpp:200
+msgid "Select a game to LOAD"
+msgstr "Aukeratu kargatzeko partida"
+
+#: engines/scumm/dialogs.cpp:201
+msgid "Game title)"
+msgstr "Jokoaren izena)"
+
+#. I18N: Previous page button
+#: engines/scumm/dialogs.cpp:287
+msgid "~P~revious"
+msgstr "~A~urrekoa"
+
+#. I18N: Next page button
+#: engines/scumm/dialogs.cpp:289
+msgid "~N~ext"
+msgstr "~H~urrengoa"
+
+#: engines/scumm/dialogs.cpp:290
+#: backends/platform/ds/arm9/source/dsoptions.cpp:56
+msgid "~C~lose"
+msgstr "~I~txi"
+
+#: engines/scumm/dialogs.cpp:597
+msgid "Speech Only"
+msgstr "Ahotsak bakarrik"
+
+#: engines/scumm/dialogs.cpp:598
+msgid "Speech and Subtitles"
+msgstr "Ahotsak eta azpitituluak"
+
+#: engines/scumm/dialogs.cpp:599
+msgid "Subtitles Only"
+msgstr "Azpitituluak bakarrik"
+
+#: engines/scumm/dialogs.cpp:607
+msgctxt "lowres"
+msgid "Speech & Subs"
+msgstr "Ahotsak & azpit."
+
+#: engines/scumm/dialogs.cpp:653
+msgid "Select a Proficiency Level."
+msgstr "Zailtasuna aukeratu."
+
+#: engines/scumm/dialogs.cpp:655
+msgid "Refer to your Loom(TM) manual for help."
+msgstr "Loom(TM)-ko eskuliburura jo ezazu laguntza lortzeko."
+
+#: engines/scumm/dialogs.cpp:658
+msgid "Standard"
+msgstr "Estandarra"
+
+#: engines/scumm/dialogs.cpp:659
+msgid "Practice"
+msgstr "Entrenamendua"
+
+#: engines/scumm/dialogs.cpp:660
+msgid "Expert"
+msgstr "Aditua"
+
+#: engines/scumm/help.cpp:73
+msgid "Common keyboard commands:"
+msgstr "Teklatuko komando oinarrizkoak:"
+
+#: engines/scumm/help.cpp:74
+msgid "Save / Load dialog"
+msgstr "Gorde / Kargatu pantaila"
+
+#: engines/scumm/help.cpp:76
+msgid "Skip line of text"
+msgstr "Esaldia saltatu"
+
+#: engines/scumm/help.cpp:77
+msgid "Esc"
+msgstr "Ihes"
+
+#: engines/scumm/help.cpp:77
+msgid "Skip cutscene"
+msgstr "Eszena saltatu"
+
+#: engines/scumm/help.cpp:78
+msgid "Space"
+msgstr "Zuriunea"
+
+#: engines/scumm/help.cpp:78
+msgid "Pause game"
+msgstr "Jokoa pausatu"
+
+#: engines/scumm/help.cpp:79 engines/scumm/help.cpp:84
+#: engines/scumm/help.cpp:95 engines/scumm/help.cpp:96
+#: engines/scumm/help.cpp:97 engines/scumm/help.cpp:98
+#: engines/scumm/help.cpp:99 engines/scumm/help.cpp:100
+#: engines/scumm/help.cpp:101 engines/scumm/help.cpp:102
+msgid "Ctrl"
+msgstr "Ktrl"
+
+#: engines/scumm/help.cpp:79
+msgid "Load game state 1-10"
+msgstr "1-10 jokoa kargatu"
+
+#: engines/scumm/help.cpp:80 engines/scumm/help.cpp:84
+#: engines/scumm/help.cpp:86 engines/scumm/help.cpp:100
+#: engines/scumm/help.cpp:101 engines/scumm/help.cpp:102
+msgid "Alt"
+msgstr "Alt"
+
+#: engines/scumm/help.cpp:80
+msgid "Save game state 1-10"
+msgstr "1-10 partida gorde"
+
+#: engines/scumm/help.cpp:86 engines/scumm/help.cpp:89
+msgid "Enter"
+msgstr "Sartu"
+
+#: engines/scumm/help.cpp:86
+msgid "Toggle fullscreen"
+msgstr "Pantaila osoa jarri / kendu"
+
+#: engines/scumm/help.cpp:87
+msgid "Music volume up / down"
+msgstr "Musikaren bolumena gora / behera"
+
+#: engines/scumm/help.cpp:88
+msgid "Text speed slower / faster"
+msgstr "Testu-abiadura astiroago / bizkorrago"
+
+#: engines/scumm/help.cpp:89
+msgid "Simulate left mouse button"
+msgstr "Saguaren ezker botoia simulatu"
+
+#: engines/scumm/help.cpp:90
+msgid "Tab"
+msgstr "Tab"
+
+#: engines/scumm/help.cpp:90
+msgid "Simulate right mouse button"
+msgstr "Saguaren eskuin botoia simulatu"
+
+#: engines/scumm/help.cpp:93
+msgid "Special keyboard commands:"
+msgstr "Teklatuko komando bereziak:"
+
+#: engines/scumm/help.cpp:94
+msgid "Show / Hide console"
+msgstr "Kontsola erakutsi / ezkutatu"
+
+#: engines/scumm/help.cpp:95
+msgid "Start the debugger"
+msgstr "Araztailea abiarazi"
+
+#: engines/scumm/help.cpp:96
+msgid "Show memory consumption"
+msgstr "Memoria kontsumoa erakutsi"
+
+#: engines/scumm/help.cpp:97
+msgid "Run in fast mode (*)"
+msgstr "Modu azkarrean exekutatu (*)"
+
+#: engines/scumm/help.cpp:98
+msgid "Run in really fast mode (*)"
+msgstr "Era oso azkarrean exekutatu (*)"
+
+#: engines/scumm/help.cpp:99
+msgid "Toggle mouse capture"
+msgstr "Saguaren kaptura"
+
+#: engines/scumm/help.cpp:100
+msgid "Switch between graphics filters"
+msgstr "Filtro grafikoen artean txandakatu"
+
+#: engines/scumm/help.cpp:101
+msgid "Increase / Decrease scale factor"
+msgstr "Eskala faktorea handitu / txikitu"
+
+#: engines/scumm/help.cpp:102
+msgid "Toggle aspect-ratio correction"
+msgstr "Txandakatu fFormatu-ratioaren zuzenketa"
+
+#: engines/scumm/help.cpp:107
+msgid "* Note that using ctrl-f and"
+msgstr "* Ktrl-F eta Ktrl-G"
+
+#: engines/scumm/help.cpp:108
+msgid " ctrl-g are not recommended"
+msgstr "erabiltzea ez da gomendagarria"
+
+#: engines/scumm/help.cpp:109
+msgid " since they may cause crashes"
+msgstr "kraskadurak eta jokoaren jokabide"
+
+#: engines/scumm/help.cpp:110
+msgid " or incorrect game behavior."
+msgstr "desegokia sor dezaketelako."
+
+#: engines/scumm/help.cpp:114
+msgid "Spinning drafts on the keyboard:"
+msgstr "Sorginkeriak teklatuarekin egin:"
+
+#: engines/scumm/help.cpp:116
+msgid "Main game controls:"
+msgstr "Joko kontrol nagusiak:"
+
+#: engines/scumm/help.cpp:121 engines/scumm/help.cpp:136
+#: engines/scumm/help.cpp:161
+msgid "Push"
+msgstr "Bultzatu"
+
+#: engines/scumm/help.cpp:122 engines/scumm/help.cpp:137
+#: engines/scumm/help.cpp:162
+msgid "Pull"
+msgstr "Tiratu"
+
+#: engines/scumm/help.cpp:123 engines/scumm/help.cpp:138
+#: engines/scumm/help.cpp:163 engines/scumm/help.cpp:197
+#: engines/scumm/help.cpp:207
+msgid "Give"
+msgstr "Eman"
+
+#: engines/scumm/help.cpp:124 engines/scumm/help.cpp:139
+#: engines/scumm/help.cpp:164 engines/scumm/help.cpp:190
+#: engines/scumm/help.cpp:208
+msgid "Open"
+msgstr "Ireki"
+
+#: engines/scumm/help.cpp:126
+msgid "Go to"
+msgstr "Joan"
+
+#: engines/scumm/help.cpp:127
+msgid "Get"
+msgstr "Jaso"
+
+#: engines/scumm/help.cpp:128 engines/scumm/help.cpp:152
+#: engines/scumm/help.cpp:170 engines/scumm/help.cpp:198
+#: engines/scumm/help.cpp:213 engines/scumm/help.cpp:224
+#: engines/scumm/help.cpp:250
+msgid "Use"
+msgstr "Erabili"
+
+#: engines/scumm/help.cpp:129 engines/scumm/help.cpp:141
+msgid "Read"
+msgstr "Irakurri"
+
+#: engines/scumm/help.cpp:130 engines/scumm/help.cpp:147
+msgid "New kid"
+msgstr "Pertsonaia aldatu"
+
+#: engines/scumm/help.cpp:131 engines/scumm/help.cpp:153
+#: engines/scumm/help.cpp:171
+msgid "Turn on"
+msgstr "Piztu"
+
+#: engines/scumm/help.cpp:132 engines/scumm/help.cpp:154
+#: engines/scumm/help.cpp:172
+msgid "Turn off"
+msgstr "Itzali"
+
+#: engines/scumm/help.cpp:142 engines/scumm/help.cpp:167
+#: engines/scumm/help.cpp:194
+msgid "Walk to"
+msgstr "Joan"
+
+#: engines/scumm/help.cpp:143 engines/scumm/help.cpp:168
+#: engines/scumm/help.cpp:195 engines/scumm/help.cpp:210
+#: engines/scumm/help.cpp:227
+msgid "Pick up"
+msgstr "Jaso"
+
+#: engines/scumm/help.cpp:144 engines/scumm/help.cpp:169
+msgid "What is"
+msgstr "Zer da"
+
+#: engines/scumm/help.cpp:146
+msgid "Unlock"
+msgstr "Ireki"
+
+#: engines/scumm/help.cpp:149
+msgid "Put on"
+msgstr "Ipini"
+
+#: engines/scumm/help.cpp:150
+msgid "Take off"
+msgstr "Kendu"
+
+#: engines/scumm/help.cpp:156
+msgid "Fix"
+msgstr "Konpondu"
+
+#: engines/scumm/help.cpp:158
+msgid "Switch"
+msgstr "Aldatu"
+
+#: engines/scumm/help.cpp:166 engines/scumm/help.cpp:228
+msgid "Look"
+msgstr "Begiratu"
+
+#: engines/scumm/help.cpp:173 engines/scumm/help.cpp:223
+msgid "Talk"
+msgstr "Hitz egin"
+
+#: engines/scumm/help.cpp:174
+msgid "Travel"
+msgstr "Bidaiatu"
+
+#: engines/scumm/help.cpp:175
+msgid "To Henry / To Indy"
+msgstr "Henry / Indy"
+
+#. I18N: These are different musical notes
+#: engines/scumm/help.cpp:179
+msgid "play C minor on distaff"
+msgstr "Jo C minor bastoiarekin"
+
+#: engines/scumm/help.cpp:180
+msgid "play D on distaff"
+msgstr "Jo D bastoiarekin"
+
+#: engines/scumm/help.cpp:181
+msgid "play E on distaff"
+msgstr "Jo E bastoiarekin"
+
+#: engines/scumm/help.cpp:182
+msgid "play F on distaff"
+msgstr "Jo F bastoiarekin"
+
+#: engines/scumm/help.cpp:183
+msgid "play G on distaff"
+msgstr "Jo G bastoiarekin"
+
+#: engines/scumm/help.cpp:184
+msgid "play A on distaff"
+msgstr "Jo A bastoiarekin"
+
+#: engines/scumm/help.cpp:185
+msgid "play B on distaff"
+msgstr "Jo B bastoiarekin"
+
+#: engines/scumm/help.cpp:186
+msgid "play C major on distaff"
+msgstr "Jo C maior bastoiarekin"
+
+#: engines/scumm/help.cpp:192 engines/scumm/help.cpp:214
+msgid "puSh"
+msgstr "Bultzatu"
+
+#: engines/scumm/help.cpp:193 engines/scumm/help.cpp:215
+msgid "pull (Yank)"
+msgstr "Tiratu"
+
+#: engines/scumm/help.cpp:196 engines/scumm/help.cpp:212
+#: engines/scumm/help.cpp:248
+msgid "Talk to"
+msgstr "Hitz egin"
+
+#: engines/scumm/help.cpp:199 engines/scumm/help.cpp:211
+msgid "Look at"
+msgstr "Begiratu"
+
+#: engines/scumm/help.cpp:200
+msgid "turn oN"
+msgstr "Piztu"
+
+#: engines/scumm/help.cpp:201
+msgid "turn oFf"
+msgstr "Itzali"
+
+#: engines/scumm/help.cpp:217
+msgid "KeyUp"
+msgstr "Gora"
+
+#: engines/scumm/help.cpp:217
+msgid "Highlight prev dialogue"
+msgstr "Aurreko elkarrizketa aukeratu"
+
+#: engines/scumm/help.cpp:218
+msgid "KeyDown"
+msgstr "Behera"
+
+#: engines/scumm/help.cpp:218
+msgid "Highlight next dialogue"
+msgstr "Hurrengo elkarrizketa aukeratu"
+
+#: engines/scumm/help.cpp:222
+msgid "Walk"
+msgstr "Ibili"
+
+#: engines/scumm/help.cpp:225 engines/scumm/help.cpp:234
+#: engines/scumm/help.cpp:241 engines/scumm/help.cpp:249
+msgid "Inventory"
+msgstr "Inbentarioa"
+
+#: engines/scumm/help.cpp:226
+msgid "Object"
+msgstr "Objektua"
+
+#: engines/scumm/help.cpp:229
+msgid "Black and White / Color"
+msgstr "Zuri Beltza / Koloretan"
+
+#: engines/scumm/help.cpp:232
+msgid "Eyes"
+msgstr "Begiak"
+
+#: engines/scumm/help.cpp:233
+msgid "Tongue"
+msgstr "Mihia"
+
+#: engines/scumm/help.cpp:235
+msgid "Punch"
+msgstr "Ukabilkada"
+
+#: engines/scumm/help.cpp:236
+msgid "Kick"
+msgstr "Ostikada"
+
+#: engines/scumm/help.cpp:239 engines/scumm/help.cpp:247
+msgid "Examine"
+msgstr "Aztertu"
+
+#: engines/scumm/help.cpp:240
+msgid "Regular cursor"
+msgstr "Kurtsore normala"
+
+#. I18N: Comm is a communication device
+#: engines/scumm/help.cpp:243
+msgid "Comm"
+msgstr "Comm"
+
+#: engines/scumm/help.cpp:246
+msgid "Save / Load / Options"
+msgstr "Gorde / Kargatu / Aukerak"
+
+#: engines/scumm/help.cpp:255
+msgid "Other game controls:"
+msgstr "Beste kontrol batzuk:"
+
+#: engines/scumm/help.cpp:257 engines/scumm/help.cpp:267
+msgid "Inventory:"
+msgstr "Inbentarioa:"
+
+#: engines/scumm/help.cpp:258 engines/scumm/help.cpp:274
+msgid "Scroll list up"
+msgstr "Gora"
+
+#: engines/scumm/help.cpp:259 engines/scumm/help.cpp:275
+msgid "Scroll list down"
+msgstr "Behera"
+
+#: engines/scumm/help.cpp:260 engines/scumm/help.cpp:268
+msgid "Upper left item"
+msgstr "Goiko ezkerreko objektua"
+
+#: engines/scumm/help.cpp:261 engines/scumm/help.cpp:270
+msgid "Lower left item"
+msgstr "Beheko ezkerreko objektua"
+
+#: engines/scumm/help.cpp:262 engines/scumm/help.cpp:271
+msgid "Upper right item"
+msgstr "Goiko eskuineko objektua"
+
+#: engines/scumm/help.cpp:263 engines/scumm/help.cpp:273
+msgid "Lower right item"
+msgstr "Beheko eskuineko objektua"
+
+#: engines/scumm/help.cpp:269
+msgid "Middle left item"
+msgstr "Erdiko ezkereko objektua"
+
+#: engines/scumm/help.cpp:272
+msgid "Middle right item"
+msgstr "Erdiko eskuineko objektua"
+
+#: engines/scumm/help.cpp:279 engines/scumm/help.cpp:284
+msgid "Switching characters:"
+msgstr "Pertsonaia aldatu:"
+
+#: engines/scumm/help.cpp:281
+msgid "Second kid"
+msgstr "Bigarren gaztea"
+
+#: engines/scumm/help.cpp:282
+msgid "Third kid"
+msgstr "Hirugarren gaztea"
+
+#: engines/scumm/help.cpp:294
+msgid "Fighting controls (numpad):"
+msgstr "Borroka-kontrolak (tekl. num.)"
+
+#: engines/scumm/help.cpp:295 engines/scumm/help.cpp:296
+#: engines/scumm/help.cpp:297
+msgid "Step back"
+msgstr "Atzera egin"
+
+#: engines/scumm/help.cpp:298
+msgid "Block high"
+msgstr "Blokeo garaia"
+
+#: engines/scumm/help.cpp:299
+msgid "Block middle"
+msgstr "Erdiko blokeoa"
+
+#: engines/scumm/help.cpp:300
+msgid "Block low"
+msgstr "Blokeo baxua"
+
+#: engines/scumm/help.cpp:301
+msgid "Punch high"
+msgstr "Ukabilkada altua"
+
+#: engines/scumm/help.cpp:302
+msgid "Punch middle"
+msgstr "Ukabilkada erdira"
+
+#: engines/scumm/help.cpp:303
+msgid "Punch low"
+msgstr "Ukabilkada baxua"
+
+#: engines/scumm/help.cpp:306
+msgid "These are for Indy on left."
+msgstr "Indy ezkerrean dagoenerako dira,"
+
+#: engines/scumm/help.cpp:307
+msgid "When Indy is on the right,"
+msgstr "Indy eskuinean dagoenean,"
+
+#: engines/scumm/help.cpp:308
+msgid "7, 4, and 1 are switched with"
+msgstr "7, 4 eta 1 aldatuak dira"
+
+#: engines/scumm/help.cpp:309
+msgid "9, 6, and 3, respectively."
+msgstr "9, 6 eta 3rekin, hurrenez hurren."
+
+#: engines/scumm/help.cpp:316
+msgid "Biplane controls (numpad):"
+msgstr "Biplanoaren kontrolak (tekl. num.)"
+
+#: engines/scumm/help.cpp:317
+msgid "Fly to upper left"
+msgstr "Gora eta ezkerrera hegan egin"
+
+#: engines/scumm/help.cpp:318
+msgid "Fly to left"
+msgstr "Ezkerrera hegan egin"
+
+#: engines/scumm/help.cpp:319
+msgid "Fly to lower left"
+msgstr "Behera eta ezkerrera hegan egin"
+
+#: engines/scumm/help.cpp:320
+msgid "Fly upwards"
+msgstr "Gorantz hegan egin"
+
+#: engines/scumm/help.cpp:321
+msgid "Fly straight"
+msgstr "Zuzen hegan egin"
+
+#: engines/scumm/help.cpp:322
+msgid "Fly down"
+msgstr "Behera hegan egin"
+
+#: engines/scumm/help.cpp:323
+msgid "Fly to upper right"
+msgstr "Gora eta eskuinera hegan egin"
+
+#: engines/scumm/help.cpp:324
+msgid "Fly to right"
+msgstr "Eskuinera hegan egin"
+
+#: engines/scumm/help.cpp:325
+msgid "Fly to lower right"
+msgstr "Behera eta eskuinera hegan egin"
+
+#: 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 ""
+"MIDI euskarri natiboak LucasArts-en Roland eguneraketa behar du,\n"
+"baina %s ez dago eskuragarri. AdLib erabiliko da."
+
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
+#, c-format
+msgid ""
+"Failed to save game state to file:\n"
+"\n"
+"%s"
+msgstr ""
+"Errorea fitxategian gordetzean:\n"
+"\n"
+"%s"
+
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
+#, c-format
+msgid ""
+"Failed to load game state from file:\n"
+"\n"
+"%s"
+msgstr ""
+"Errorea fitxategitik kargatzean:\n"
+"\n"
+"%s"
+
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
+#, c-format
+msgid ""
+"Successfully saved game state in file:\n"
+"\n"
+"%s"
+msgstr ""
+"Partida ondo gorde da hurrengo fitxategian:\n"
+"\n"
+"%s"
+
+#: engines/scumm/scumm.cpp:2512
+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' "
+"directory inside the Tentacle game directory."
+msgstr ""
+"Maniac Mansion orain hasi beharko litzateke, baina ScummVM-k ez du "
+"baimentzen oraindik. Jolasteko , joan 'Jokoa gehitu' hasierako menura eta "
+"aukeratu 'Maniac' direktorioa Tentacle-ren joko-direktorioaren barruan."
+
+#. I18N: Option for fast scene switching
+#: engines/mohawk/dialogs.cpp:92 engines/mohawk/dialogs.cpp:171
+msgid "~Z~ip Mode Activated"
+msgstr "~Z~ip modua aktibaturik"
+
+#: engines/mohawk/dialogs.cpp:93
+msgid "~T~ransitions Enabled"
+msgstr "~T~rantsizioak gaituta"
+
+#. I18N: Drop book page
+#: engines/mohawk/dialogs.cpp:95
+msgid "~D~rop Page"
+msgstr "Orria ~b~ota"
+
+#: engines/mohawk/dialogs.cpp:99
+msgid "~S~how Map"
+msgstr "~M~apa erakutsi"
+
+#: engines/mohawk/dialogs.cpp:105
+msgid "~M~ain Menu"
+msgstr "Menu ~n~agusia"
+
+#: engines/mohawk/dialogs.cpp:172
+msgid "~W~ater Effect Enabled"
+msgstr "~U~r-efektua gaituta"
+
+#: engines/agos/animation.cpp:560
+#, c-format
+msgid "Cutscene file '%s' not found!"
+msgstr "'%s' bideo fitxategia ez da aurkitu!"
+
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
+msgid "Failed to load game state from file."
+msgstr "Ezin izan da fitxategitik jokoa kargatu."
+
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
+msgid "Failed to save game state to file."
+msgstr "Ezin izan da jokoa fitxategira gorde."
+
+#: engines/gob/inter_v5.cpp:107
+msgid "Failed to delete file."
+msgstr "Ezin izan da fitxategia ezabatu"
+
+#: engines/groovie/script.cpp:420
+msgid "Failed to save game"
+msgstr "Ezin izan da jokoa gorde"
+
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr ""
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr ""
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr ""
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr ""
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr ""
+
+#: engines/kyra/detection.cpp:85
+#, fuzzy
+msgid "Enable helium mode"
+msgstr "Roland GS modua gaitu"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr ""
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr ""
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+#, fuzzy
+msgid "Floating cursors"
+msgstr "Kurtsore normala"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr ""
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr ""
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr ""
+
+#: engines/kyra/lol.cpp:478
+msgid "Attack 1"
+msgstr "1 erasoa"
+
+#: engines/kyra/lol.cpp:479
+msgid "Attack 2"
+msgstr "2 erasoa"
+
+#: engines/kyra/lol.cpp:480
+msgid "Attack 3"
+msgstr "3 erasoa"
+
+#: engines/kyra/lol.cpp:481
+msgid "Move Forward"
+msgstr "Aurrera mugitu"
+
+#: engines/kyra/lol.cpp:482
+msgid "Move Back"
+msgstr "Atzera mugitu"
+
+#: engines/kyra/lol.cpp:483
+msgid "Slide Left"
+msgstr "Ezkerrera irristatu"
+
+#: engines/kyra/lol.cpp:484
+msgid "Slide Right"
+msgstr "Eskuinera irristatu"
+
+#: engines/kyra/lol.cpp:485
+msgid "Turn Left"
+msgstr "Ezkerrera biratu"
+
+#: engines/kyra/lol.cpp:486
+msgid "Turn Right"
+msgstr "Eskuinera biratu"
+
+#: engines/kyra/lol.cpp:487
+msgid "Rest"
+msgstr "Kargatu"
+
+#: engines/kyra/lol.cpp:488
+msgid "Options"
+msgstr "Aukerak"
+
+#: engines/kyra/lol.cpp:489
+msgid "Choose Spell"
+msgstr "Sorginkeria aukeratu"
+
+#: engines/kyra/sound_midi.cpp:475
+#, fuzzy
+msgid ""
+"You appear to be using a General MIDI device,\n"
+"but your game only supports Roland MT32 MIDI.\n"
+"We try to map the Roland MT32 instruments to\n"
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
+msgstr ""
+"General MIDI gailua erabiltzen zaudela dirudi,\n"
+"baina zure jokoak Roland MT32 MIDI bakarrik\n"
+"erabili dezake. Roland MT32 instrumentuak\n"
+"General MIDIkoetara egokitzen saiatuko gara,\n"
+"baina posible da pista batzuk egoki ez entzutea."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
+msgstr ""
+
+#: engines/sky/compact.cpp:130
+msgid ""
+"Unable to find \"sky.cpt\" file!\n"
+"Please download it from www.scummvm.org"
+msgstr ""
+"Ezin izan da \"sky.cpt\" fitxategia aurkitu!\n"
+"Mesedez, jaitsi ezazu www.scummvm.org-etik"
+
+#: engines/sky/compact.cpp:141
+msgid ""
+"The \"sky.cpt\" file has an incorrect size.\n"
+"Please (re)download it from www.scummvm.org"
+msgstr ""
+"\"sky.cpt\" fitxategiak tamaina desegokia du.\n"
+"Mesdez, jaitsi ezazu (berriz) www.scummvm.org-etik"
+
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr ""
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr ""
+
+#: engines/sword1/animation.cpp:539
+#, c-format
+msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
+msgstr ""
+
+#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
+msgid "DXA cutscenes found but ScummVM has been built without zlib support"
+msgstr ""
+"DXA bideoak aurkitu dira, baina ScummVM zlib euskarri gabe konpilatu da"
+
+#: engines/sword1/animation.cpp:570 engines/sword2/animation.cpp:465
+msgid "MPEG2 cutscenes are no longer supported"
+msgstr "MPEG2 bideoak ez dira bateragarriak jada"
+
+#: engines/sword1/animation.cpp:576 engines/sword2/animation.cpp:473
+#, c-format
+msgid "Cutscene '%s' not found"
+msgstr "Ez da '%s' bideoa aurkitu"
+
+#: engines/sword1/control.cpp:863
+msgid ""
+"ScummVM found that you have old savefiles for Broken Sword 1 that should be "
+"converted.\n"
+"The old save game format is no longer supported, so you will not be able to "
+"load your games if you don't convert them.\n"
+"\n"
+"Press OK to convert them now, otherwise you will be asked again the next "
+"time you start the game.\n"
+msgstr ""
+"ScummVM-k aurkitu du konbertitu beharko liratekeen Broken Sword 1-eko "
+"partida gorde zaharrak dituzula.\n"
+"Partida gordeen formatu zaharra ez da bateragarria jada, eta beraz ezingo "
+"dituzu zure partidak kargatu ez badituzu formatu berrira pasatzen.\n"
+"\n"
+"Sakatu Ados orain konbertitzeko, bestela berriz galdetuko dizut jokoa berriz "
+"martxan jartzen duzunean.\n"
+
+#: engines/sword1/control.cpp:1232
+#, c-format
+msgid ""
+"Target new save game already exists!\n"
+"Would you like to keep the old save game (%s) or the new one (%s)?\n"
+msgstr ""
+"Gordetako partida jadanik existitzen da!\n"
+"Gordetako partida zaharra (%s) ala berria (%s) mantendu nahi zenuke?\n"
+
+#: engines/sword1/control.cpp:1235
+msgid "Keep the old one"
+msgstr "Zaharra mantendu"
+
+#: engines/sword1/control.cpp:1235
+msgid "Keep the new one"
+msgstr "Berria mantendu"
+
+#: engines/sword1/logic.cpp:1633
+msgid "This is the end of the Broken Sword 1 Demo"
+msgstr "Hau Broken Sword 1 Demoaren amaiera da"
+
+#: engines/sword2/animation.cpp:435
+msgid ""
+"PSX cutscenes found but ScummVM has been built without RGB color support"
+msgstr ""
+"PSX eszenak aurkitu dira, baina ScummVM RGB kolorearen euskarri gabe "
+"konpilatu da"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr ""
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+
+#: engines/parallaction/saveload.cpp:133
+#, c-format
+msgid ""
+"Can't save game in slot %i\n"
+"\n"
+msgstr ""
+"Ezin da partida gorde %i zirrikituan\n"
+"\n"
+
+#: engines/parallaction/saveload.cpp:204
+msgid "Loading game..."
+msgstr "Jokoa kargatzen..."
+
+#: engines/parallaction/saveload.cpp:219
+msgid "Saving game..."
+msgstr "Jokoa gordetzen..."
+
+#: engines/parallaction/saveload.cpp:272
+msgid ""
+"ScummVM found that you have old savefiles for Nippon Safes that should be "
+"renamed.\n"
+"The old names are no longer supported, so you will not be able to load your "
+"games if you don't convert them.\n"
+"\n"
+"Press OK to convert them now, otherwise you will be asked next time.\n"
+msgstr ""
+"ScummVM-k aurkitu du berrizendatu beharko liratekeen Nippon Safes-eko "
+"partida gorde zaharrak dituzula.\n"
+"Partida gordeen izen zaharra ez da bateragarria jada, eta beraz ezingo "
+"dituzu zure partidak kargatu ez badituzu formatu berrira pasatzen.\n"
+"\n"
+"Sakatu Ados orain konbertitzeko, bestela berriz galdetuko dizut jokoa berriz "
+"martxan jartzen duzunean.\n"
+
+#: engines/parallaction/saveload.cpp:319
+msgid "ScummVM successfully converted all your savefiles."
+msgstr "ScummVM-k ondo konbertitu ditu zure gordetako partida guztiak."
+
+#: engines/parallaction/saveload.cpp:321
+msgid ""
+"ScummVM printed some warnings in your console window and can't guarantee all "
+"your files have been converted.\n"
+"\n"
+"Please report to the team."
+msgstr ""
+"ScummVM-k zenbait abisu inprimatu ditu zure kontsola leihoan eta ezin du "
+"ziurtatu zure fitxategi guztiak ondo konbertitu diren.\n"
+"\n"
+"Mesedez, eman abisua taldeari."
+
+#: audio/fmopl.cpp:49
+msgid "MAME OPL emulator"
+msgstr "MAME OPL emuladorea"
+
+#: audio/fmopl.cpp:51
+msgid "DOSBox OPL emulator"
+msgstr "DOSBox OPL emuladorea"
+
+#: audio/mididrv.cpp:209
+#, c-format
+msgid ""
+"The selected audio device '%s' was not found (e.g. might be turned off or "
+"disconnected)."
+msgstr ""
+"Aukeraturiko '%s' soinu gailua ez da aurkitu (baliteke itzalita edo "
+"konektatu gabe egotea)"
+
+#: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257
+#: audio/mididrv.cpp:272
+msgid "Attempting to fall back to the next available device..."
+msgstr "Eskuragarri dagoen hurrengo soinu gailura joaten..."
+
+#: audio/mididrv.cpp:221
+#, c-format
+msgid ""
+"The selected audio device '%s' cannot be used. See log file for more "
+"information."
+msgstr ""
+"Aukeraturiko '%s' soinu gailua ezin da erabili. Ikusi log fitxategia "
+"informazio gehiagorako."
+
+#: audio/mididrv.cpp:257
+#, c-format
+msgid ""
+"The preferred audio device '%s' was not found (e.g. might be turned off or "
+"disconnected)."
+msgstr ""
+"'%s' gogoko soinu gailua ez da aurkitu (baliteke itzalita edo konektatu gabe "
+"egotea)"
+
+#: audio/mididrv.cpp:272
+#, c-format
+msgid ""
+"The preferred audio device '%s' cannot be used. See log file for more "
+"information."
+msgstr ""
+"'%s' gogoko soinu gailua ezin da erabili. Ikusi log fitxategia informazio "
+"gehiagorako."
+
+#: audio/null.h:43
+msgid "No music"
+msgstr "Musikarik ez"
+
+#: audio/mods/paula.cpp:189
+msgid "Amiga Audio Emulator"
+msgstr "Amiga Audio emuladorea"
+
+#: audio/softsynth/adlib.cpp:1593
+msgid "AdLib Emulator"
+msgstr "AdLib emuladorea"
+
+#: audio/softsynth/appleiigs.cpp:33
+msgid "Apple II GS Emulator (NOT IMPLEMENTED)"
+msgstr "Apple II GS emuladorea (INPLEMENTATU GABE)"
+
+#: audio/softsynth/sid.cpp:1430
+msgid "C64 Audio Emulator"
+msgstr "C64 Audio emuladorea"
+
+#: audio/softsynth/mt32.cpp:293
+msgid "Initializing MT-32 Emulator"
+msgstr "MT-32 emuladorea hasieratzen"
+
+#: audio/softsynth/mt32.cpp:512
+msgid "MT-32 Emulator"
+msgstr "MT-32 emuladorea"
+
+#: audio/softsynth/pcspk.cpp:139
+msgid "PC Speaker Emulator"
+msgstr "PC bozgoragailuaren emuladorea"
+
+#: audio/softsynth/pcspk.cpp:158
+msgid "IBM PCjr Emulator"
+msgstr "IBM PCjr emuladorea"
+
+#: backends/keymapper/remap-dialog.cpp:47
+msgid "Keymap:"
+msgstr "Teklen esleipena:"
+
+#: backends/keymapper/remap-dialog.cpp:66
+msgid " (Effective)"
+msgstr "(Egiazkoa)"
+
+#: backends/keymapper/remap-dialog.cpp:106
+msgid " (Active)"
+msgstr "(Aktiboa)"
+
+#: backends/keymapper/remap-dialog.cpp:106
+msgid " (Blocked)"
+msgstr "(Blokeaturik)"
+
+#: backends/keymapper/remap-dialog.cpp:119
+msgid " (Global)"
+msgstr "(Orokorra)"
+
+#: backends/keymapper/remap-dialog.cpp:127
+msgid " (Game)"
+msgstr "(Jokoa)"
+
+#: backends/midi/windows.cpp:164
+msgid "Windows MIDI"
+msgstr "Windows MIDI"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:57
+msgid "ScummVM Main Menu"
+msgstr "ScummVM menu orokorra"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:63
+msgid "~L~eft handed mode"
+msgstr "~E~zkertientzako modua"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:64
+msgid "~I~ndy fight controls"
+msgstr "~I~ndy-ren borrokarako kontrolak"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:65
+msgid "Show mouse cursor"
+msgstr "Saguaren kurtsorea erakutsi"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:66
+msgid "Snap to edges"
+msgstr "Ertzetara itsatsi"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:68
+msgid "Touch X Offset"
+msgstr "Ukimenaren X oreka"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:75
+msgid "Touch Y Offset"
+msgstr "Ukimenaren Y oreka"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:87
+msgid "Use laptop trackpad-style cursor control"
+msgstr "Eramangarrietako trackpad estiloko kurtsore-kontrola erabili"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:88
+msgid "Tap for left click, double tap right click"
+msgstr "Toke bat ezker-klikerako, toke bikoitza eskuin klikerako"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:90
+msgid "Sensitivity"
+msgstr "Sentikortasuna"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:99
+msgid "Initial top screen scale:"
+msgstr "Goiko pantailaren hasierako eskala:"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:105
+msgid "Main screen scaling:"
+msgstr "Pantaila nagusiaren eskala:"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:107
+msgid "Hardware scale (fast, but low quality)"
+msgstr "Hardware bidezko eskala (arina, baina kalitate baxukoa)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:108
+msgid "Software scale (good quality, but slower)"
+msgstr "Software bidezko eskala (kalitate ona, baina geldoagoa)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:109
+msgid "Unscaled (you must scroll left and right)"
+msgstr "Eskalatu gabe (ezker-eskuin mugitu behar duzu pantaila)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:111
+msgid "Brightness:"
+msgstr "Distira:"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:121
+msgid "High quality audio (slower) (reboot)"
+msgstr "Kalitate altuko soinua (geldoagoa) (berrabiarazi)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:122
+msgid "Disable power off"
+msgstr "Itzaltzea desgaitu"
+
+#: backends/platform/iphone/osys_events.cpp:300
+msgid "Mouse-click-and-drag mode enabled."
+msgstr "Saguko klik-eta-arrastratu modua gaituta."
+
+#: backends/platform/iphone/osys_events.cpp:302
+msgid "Mouse-click-and-drag mode disabled."
+msgstr "Saguko klik-eta-arrastratu modua desgaituta."
+
+#: backends/platform/iphone/osys_events.cpp:313
+msgid "Touchpad mode enabled."
+msgstr "Touchpad modua gaituta."
+
+#: backends/platform/iphone/osys_events.cpp:315
+msgid "Touchpad mode disabled."
+msgstr "Touchpad modua desgaituta."
+
+#: backends/platform/maemo/maemo.cpp:209
+msgid "Click Mode"
+msgstr "Klikatzeko modua"
+
+#: backends/platform/maemo/maemo.cpp:215
+#: 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 "Ezker-klika"
+
+#: backends/platform/maemo/maemo.cpp:218
+msgid "Middle Click"
+msgstr "Erdiko klika"
+
+#: backends/platform/maemo/maemo.cpp:221
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Eskuin-klika"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
+msgid "Hide ScummVM"
+msgstr "ScummVM ezkutatu"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
+msgid "Hide Others"
+msgstr "Besteak ezkutatu"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
+msgid "Show All"
+msgstr "Denak erakutsi"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
+msgid "Window"
+msgstr "Leihoa"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
+msgid "Minimize"
+msgstr "Minimizatu"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
+msgid "Normal (no scaling)"
+msgstr "Normala (eskalatu gabe)"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:64
+msgctxt "lowres"
+msgid "Normal (no scaling)"
+msgstr "Normala"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
+msgid "Enabled aspect ratio correction"
+msgstr "Formatu-ratio zuzenketa gaituta"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
+msgid "Disabled aspect ratio correction"
+msgstr "Formatu-ratio zuzenketa desgaituta"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
+msgid "Active graphics filter:"
+msgstr "Filtro grafiko aktiboa:"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
+msgid "Windowed mode"
+msgstr "Leiho modua"
+
+#: backends/graphics/opengl/opengl-graphics.cpp:135
+msgid "OpenGL Normal"
+msgstr "OpenGL normala"
+
+#: backends/graphics/opengl/opengl-graphics.cpp:136
+msgid "OpenGL Conserve"
+msgstr "OpenGL aurreztu"
+
+#: backends/graphics/opengl/opengl-graphics.cpp:137
+msgid "OpenGL Original"
+msgstr "OpenGL jatorrizkoa"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:415
+msgid "Current display mode"
+msgstr "Oraingo bideo-modua"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:428
+msgid "Current scale"
+msgstr "Oraingo eskala"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
+msgid "Active filter mode: Linear"
+msgstr "Filtro aktibo modua: lineala"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
+msgid "Active filter mode: Nearest"
+msgstr "Filtro aktibo modua: hurbilena"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:38
+#: backends/platform/wince/CEActionsSmartphone.cpp:39
+msgid "Up"
+msgstr "Gora"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:39
+#: backends/platform/wince/CEActionsSmartphone.cpp:40
+msgid "Down"
+msgstr "Behera"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:40
+#: backends/platform/wince/CEActionsSmartphone.cpp:41
+msgid "Left"
+msgstr "Ezker"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:41
+#: backends/platform/wince/CEActionsSmartphone.cpp:42
+msgid "Right"
+msgstr "Eskuin"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:46
+#: backends/platform/wince/CEActionsSmartphone.cpp:47
+msgid "Zone"
+msgstr "Zonaldea"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:47
+#: backends/platform/wince/CEActionsPocket.cpp:54
+#: backends/platform/wince/CEActionsSmartphone.cpp:48
+msgid "Multi Function"
+msgstr "Multifuntzioa"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:48
+msgid "Swap character"
+msgstr "Pertsonaia aldatu"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:49
+msgid "Skip text"
+msgstr "Testua saltatu"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:51
+msgid "Fast mode"
+msgstr "Modu bizkorra"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:53
+msgid "Debugger"
+msgstr "Araztailea"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:54
+msgid "Global menu"
+msgstr "Menu orokorra"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:55
+msgid "Virtual keyboard"
+msgstr "Teklatu birtuala"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:56
+msgid "Key mapper"
+msgstr "Teklen esleipena"
+
+#: backends/events/symbiansdl/symbiansdl-events.cpp:184
+msgid "Do you want to quit ?"
+msgstr "Irten nahi al duzu?"
+
+#: backends/platform/wii/options.cpp:51
+msgid "Video"
+msgstr "Bideo"
+
+#: backends/platform/wii/options.cpp:54
+msgid "Current video mode:"
+msgstr "Oraingo bideo modua:"
+
+#: backends/platform/wii/options.cpp:56
+msgid "Double-strike"
+msgstr "Kolpe bikoitza"
+
+#: backends/platform/wii/options.cpp:60
+msgid "Horizontal underscan:"
+msgstr "Underscan horizontala"
+
+#: backends/platform/wii/options.cpp:66
+msgid "Vertical underscan:"
+msgstr "Underscan bertikala:"
+
+#: backends/platform/wii/options.cpp:71
+msgid "Input"
+msgstr "Sarrrera"
+
+#: backends/platform/wii/options.cpp:74
+msgid "GC Pad sensitivity:"
+msgstr "GC Pad-aren sentikortasuna"
+
+#: backends/platform/wii/options.cpp:80
+msgid "GC Pad acceleration:"
+msgstr "GC Pad-aren azelerazioa:"
+
+#: backends/platform/wii/options.cpp:86
+msgid "DVD"
+msgstr "DVD:"
+
+#: backends/platform/wii/options.cpp:89 backends/platform/wii/options.cpp:101
+msgid "Status:"
+msgstr "Egoera:"
+
+#: backends/platform/wii/options.cpp:90 backends/platform/wii/options.cpp:102
+msgid "Unknown"
+msgstr "Ezezaguna"
+
+#: backends/platform/wii/options.cpp:93
+msgid "Mount DVD"
+msgstr "DVD-a muntatu"
+
+#: backends/platform/wii/options.cpp:94
+msgid "Unmount DVD"
+msgstr "DVD-a desmuntatu"
+
+#: backends/platform/wii/options.cpp:98
+msgid "SMB"
+msgstr "SMB"
+
+#: backends/platform/wii/options.cpp:106
+msgid "Server:"
+msgstr "Zerbitzaria:"
+
+#: backends/platform/wii/options.cpp:110
+msgid "Share:"
+msgstr "Konpartituriko direktorioa:"
+
+#: backends/platform/wii/options.cpp:114
+msgid "Username:"
+msgstr "Erabiltzaile-izena:"
+
+#: backends/platform/wii/options.cpp:118
+msgid "Password:"
+msgstr "Pasahitza:"
+
+#: backends/platform/wii/options.cpp:121
+msgid "Init network"
+msgstr "Sarea hasi"
+
+#: backends/platform/wii/options.cpp:123
+msgid "Mount SMB"
+msgstr "SMB-a muntatu"
+
+#: backends/platform/wii/options.cpp:124
+msgid "Unmount SMB"
+msgstr "SMB-a desmuntatu"
+
+#: backends/platform/wii/options.cpp:143
+msgid "DVD Mounted successfully"
+msgstr "DVD-a ondo muntatu da"
+
+#: backends/platform/wii/options.cpp:146
+msgid "Error while mounting the DVD"
+msgstr "Errorea DVD-a muntatzean"
+
+#: backends/platform/wii/options.cpp:148
+msgid "DVD not mounted"
+msgstr "DVD ez muntatua"
+
+#: backends/platform/wii/options.cpp:161
+msgid "Network up, share mounted"
+msgstr "Sarea konektaturik, konpartituriko direktorioa muntaturik"
+
+#: backends/platform/wii/options.cpp:163
+msgid "Network up"
+msgstr "Sarea konektaturik"
+
+#: backends/platform/wii/options.cpp:166
+msgid ", error while mounting the share"
+msgstr ", konpartituriko direktorioa muntatzerakoan errorea"
+
+#: backends/platform/wii/options.cpp:168
+msgid ", share not mounted"
+msgstr ", konpartituriko direktorioa ez muntatua"
+
+#: backends/platform/wii/options.cpp:174
+msgid "Network down"
+msgstr "Sarea konektatu gabe"
+
+#: backends/platform/wii/options.cpp:178
+msgid "Initializing network"
+msgstr "Sarea hasieratzen"
+
+#: backends/platform/wii/options.cpp:182
+msgid "Timeout while initializing network"
+msgstr "Sarearen hasieratze denbora agortu da"
+
+#: backends/platform/wii/options.cpp:186
+#, c-format
+msgid "Network not initialized (%d)"
+msgstr "Sarea ez da hasieratu (%d)"
+
+#: backends/platform/wince/CEActionsPocket.cpp:46
+msgid "Hide Toolbar"
+msgstr "Tresna-barra ezkutatu"
+
+#: backends/platform/wince/CEActionsPocket.cpp:47
+msgid "Show Keyboard"
+msgstr "Teklatua erakutsi"
+
+#: backends/platform/wince/CEActionsPocket.cpp:48
+msgid "Sound on/off"
+msgstr "Soinua aktibatuta/desaktibatuta"
+
+#: backends/platform/wince/CEActionsPocket.cpp:49
+msgid "Right click"
+msgstr "Eskuin klik-a"
+
+#: backends/platform/wince/CEActionsPocket.cpp:50
+msgid "Show/Hide Cursor"
+msgstr "Kurtsorea erakutsi/ezkutatu"
+
+#: backends/platform/wince/CEActionsPocket.cpp:51
+msgid "Free look"
+msgstr "Bista librea"
+
+#: backends/platform/wince/CEActionsPocket.cpp:52
+msgid "Zoom up"
+msgstr "Zoom-a hurbildu"
+
+#: backends/platform/wince/CEActionsPocket.cpp:53
+msgid "Zoom down"
+msgstr "Zoom-a urrundu"
+
+#: backends/platform/wince/CEActionsPocket.cpp:55
+#: backends/platform/wince/CEActionsSmartphone.cpp:49
+msgid "Bind Keys"
+msgstr "Teklak esleitu"
+
+#: backends/platform/wince/CEActionsPocket.cpp:56
+msgid "Cursor Up"
+msgstr "Gora"
+
+#: backends/platform/wince/CEActionsPocket.cpp:57
+msgid "Cursor Down"
+msgstr "Behera"
+
+#: backends/platform/wince/CEActionsPocket.cpp:58
+msgid "Cursor Left"
+msgstr "Ezker"
+
+#: backends/platform/wince/CEActionsPocket.cpp:59
+msgid "Cursor Right"
+msgstr "Eskuin"
+
+#: backends/platform/wince/CEActionsPocket.cpp:267
+#: backends/platform/wince/CEActionsSmartphone.cpp:231
+msgid "Do you want to load or save the game?"
+msgstr "Jokoa kargatu edo gorde nahi duzu?"
+
+#: backends/platform/wince/CEActionsPocket.cpp:326
+#: backends/platform/wince/CEActionsSmartphone.cpp:287
+msgid " Are you sure you want to quit ? "
+msgstr " Ziur irten nahi duzula?"
+
+#: backends/platform/wince/CEActionsSmartphone.cpp:50
+msgid "Keyboard"
+msgstr "Teklatua"
+
+#: backends/platform/wince/CEActionsSmartphone.cpp:51
+msgid "Rotate"
+msgstr "Biratu"
+
+#: backends/platform/wince/CELauncherDialog.cpp:56
+msgid "Using SDL driver "
+msgstr "SDL kontrolatzailea erabiltzen"
+
+#: backends/platform/wince/CELauncherDialog.cpp:60
+msgid "Display "
+msgstr "Pantaila"
+
+#: backends/platform/wince/CELauncherDialog.cpp:83
+msgid "Do you want to perform an automatic scan ?"
+msgstr "Bilaketa automatikoa erabili nahi duzu?"
+
+#: backends/platform/wince/wince-sdl.cpp:515
+msgid "Map right click action"
+msgstr "'Eskuin klika' ekintza esleitu"
+
+#: backends/platform/wince/wince-sdl.cpp:519
+msgid "You must map a key to the 'Right Click' action to play this game"
+msgstr ""
+"'Eskuin klika' ekintza esleitu behar diozu tekla bati joko honetara jolasteko"
+
+#: backends/platform/wince/wince-sdl.cpp:528
+msgid "Map hide toolbar action"
+msgstr "'Tresna-barra ezkutatu' ekintza esleitu"
+
+#: backends/platform/wince/wince-sdl.cpp:532
+msgid "You must map a key to the 'Hide toolbar' action to play this game"
+msgstr ""
+"'Tresna-barra ezkutatu' ekintza tekla bati esleitu behar diozu joko honetara "
+"jolasteko"
+
+#: backends/platform/wince/wince-sdl.cpp:541
+msgid "Map Zoom Up action (optional)"
+msgstr "'Zoom-a urrundu' ekintza esleitu (hautazkoa)"
+
+#: backends/platform/wince/wince-sdl.cpp:544
+msgid "Map Zoom Down action (optional)"
+msgstr "'Zoom-a hurbildu' ekintza esleitu (hautazkkoa)"
+
+#: backends/platform/wince/wince-sdl.cpp:552
+msgid ""
+"Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"
+msgstr ""
+"Ez ahaztu 'tresna-barra ezkutatu' ekintza tekla bati esleitzea inbentario "
+"osoa ikusteko"
+
+#: backends/events/default/default-events.cpp:191
+msgid "Do you really want to return to the Launcher?"
+msgstr "Ziur zaude abiarazlera itzuli nahi duzula?"
+
+#: backends/events/default/default-events.cpp:191
+msgid "Launcher"
+msgstr "Abiarazlea"
+
+#: backends/events/default/default-events.cpp:213
+msgid "Do you really want to quit?"
+msgstr "Benetan irten?"
+
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
+#: backends/events/openpandora/op-events.cpp:139
+msgid "Touchscreen 'Tap Mode' - Left Click"
+msgstr "Ukimen-pantailako 'kolpetxo modua' - Ezker klika"
+
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
+#: backends/events/openpandora/op-events.cpp:141
+msgid "Touchscreen 'Tap Mode' - Right Click"
+msgstr "Ukimen-pantailako 'kolpetxo modua' - Eskuin klika"
+
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
+#: backends/events/openpandora/op-events.cpp:143
+msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
+msgstr "Ukimen-pantailako 'kolpetxo modua' - Flotatu (klikik ez)"
+
+#: backends/events/gph/gph-events.cpp:410
+msgid "Maximum Volume"
+msgstr "Bolumen maximoa"
+
+#: backends/events/gph/gph-events.cpp:412
+msgid "Increasing Volume"
+msgstr "Bolumena igotzen"
+
+#: backends/events/gph/gph-events.cpp:418
+msgid "Minimal Volume"
+msgstr "Bolumen minimoa"
+
+#: backends/events/gph/gph-events.cpp:420
+msgid "Decreasing Volume"
+msgstr "Bolumena jaisten"
+
+#: backends/updates/macosx/macosx-updates.mm:65
+msgid "Check for Updates..."
+msgstr "Eguneraketak bilatzen..."
+
+#: backends/platform/bada/form.cpp:269
+msgid "Right Click Once"
+msgstr "Eskuin-klika behin"
+
+#: backends/platform/bada/form.cpp:277
+msgid "Move Only"
+msgstr "Mugitu bakarrik"
+
+#: backends/platform/bada/form.cpp:291
+msgid "Escape Key"
+msgstr "Ihes tekla"
+
+#: backends/platform/bada/form.cpp:296
+msgid "Game Menu"
+msgstr "Jokoaren menua"
+
+#: backends/platform/bada/form.cpp:301
+msgid "Show Keypad"
+msgstr "Teklatu numerikoa erakutsi"
+
+#: backends/platform/bada/form.cpp:309
+msgid "Control Mouse"
+msgstr "Saguaren kontrola"
+
+#: backends/events/maemosdl/maemosdl-events.cpp:192
+msgid "Clicking Enabled"
+msgstr "Klikatzea gaituta"
+
+#: backends/events/maemosdl/maemosdl-events.cpp:192
+msgid "Clicking Disabled"
+msgstr "Klikatzea desgaituta"
+
+#~ msgid "Hercules Green"
+#~ msgstr "Herkules berdea"
+
+#~ msgid "Hercules Amber"
+#~ msgstr "Herkules anbar-kolorekoa"
+
+#~ msgctxt "lowres"
+#~ msgid "Hercules Green"
+#~ msgstr "Herkules berdea"
+
+#~ msgctxt "lowres"
+#~ msgid "Hercules Amber"
+#~ msgstr "Herkules anbar-kolorekoa"
+
+#~ msgid "Save game failed!"
+#~ msgstr "Partida gordeak huts egin du!"
diff --git a/po/fr_FR.po b/po/fr_FR.po
index d937777ea5..cd98af1bb7 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-10-23 14:52+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-08 12:24+0100\n"
"Last-Translator: Thierry Crozat <criezy@scummvm.org>\n"
"Language-Team: French <scummvm-devel@lists.sf.net>\n"
+"Language: Francais\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Francais\n"
"Plural-Forms: nplurals=2; plural=n>1;\n"
#: gui/about.cpp:91
@@ -44,11 +44,12 @@ msgid "Go up"
msgstr "Remonter"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -69,15 +70,15 @@ msgstr "Fermer"
msgid "Mouse click"
msgstr "Clic de souris"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Afficher le clavier"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Changer l'affectation des touches"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Basculer en plein écran"
@@ -89,18 +90,18 @@ msgstr "Sélectionnez une action à affecter"
msgid "Map"
msgstr "Affecter"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -127,15 +128,15 @@ msgstr "Selectionnez une action"
msgid "Press the key to associate"
msgstr "Appuyez sur la touche à associer"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Jeu"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -143,29 +144,29 @@ msgstr ""
"ID compact du jeu utilisée pour identifier les sauvegardes et démarrer le "
"jeu depuis la ligne de commande"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Nom:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Nom complet du jeu"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Nom:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Langue:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -173,281 +174,285 @@ msgstr ""
"Langue du jeu. Cela ne traduira pas en anglais par magie votre version "
"espagnole du jeu."
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<defaut>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plateforme:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plateforme pour laquelle votre jeu a été conçu"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Système:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Moteur"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Graphique"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Utiliser des réglages graphiques spécifiques à ce jeux"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Réglages spécifiques à ce jeux"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Audio"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Utiliser des réglages audio spécifiques à ce jeux"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Réglages spécifiques à ce jeux"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volume"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volume"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Utiliser des réglages de volume sonore spécifiques à ce jeux"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Réglages spécifiques à ce jeux"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Utiliser des réglages MIDI spécifiques à ce jeux"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Réglages spécifiques à ce jeux"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Utiliser des réglages MT-32 spécifiques à ce jeux"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Réglages spécifiques à ce jeux"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Chemins"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Chemins"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Chemin du Jeu:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Chemin du Jeu:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Extra:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Définie un chemin vers des données suplémentaires utilisées par le jeu"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Extra:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Sauvegardes:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Définie l'emplacement où les fichiers de sauvegarde sont créés"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Sauvegardes:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Aucun"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Défaut"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Choisir une banque de sons"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Sélectionner le répertoire contenant les données du jeu"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Sélectionner un répertoire supplémentaire"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Sélectionner le répertoire pour les sauvegardes"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Cet ID est déjà utilisé par un autre jeu. Choisissez en un autre svp."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~Q~uitter"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Quitter ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "À ~P~ropos..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "À propos de ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~ptions..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Change les options globales de ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~D~émarrer"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Démarre le jeu sélectionné"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~C~harger"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Charge une sauvegarde pour le jeu sélectionné"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~A~jouter..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr ""
"Ajoute un jeu à la Liste. Maintenez Shift enfoncée pour un Ajout Massif"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~E~diter..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Change les options du jeu"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~S~upprimer"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Supprime le jeu de la liste. Les fichiers sont conservés"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~A~jouter..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~E~diter..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~S~upprimer"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Recherche dans la liste de jeux"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Filtre:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Charger le jeu:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Charger"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -455,7 +460,7 @@ msgstr ""
"Voulez-vous vraiment lancer la détection automatique des jeux? Cela peut "
"potentiellement ajouter un grand nombre de jeux."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -463,7 +468,7 @@ msgstr ""
msgid "Yes"
msgstr "Oui"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -471,37 +476,37 @@ msgstr "Oui"
msgid "No"
msgstr "Non"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM n'a pas pu ouvrir le répertoire sélectionné."
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM n'a pas trouvé de jeux dans le répertoire sélectionné."
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Choisissez le jeu:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Voulez-vous vraiment supprimer ce jeu?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr ""
"Le chargement de sauvegarde depuis le lanceur n'est pas supporté pour ce jeu."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr "ScummVM n'a pas pu trouvé de moteur pour lancer le jeu sélectionné."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Ajout Massif..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Ajout Massif..."
@@ -569,103 +574,95 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Aucune"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Certaines options graphiques n'ont pu être changées:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "le mode vidéo n'a pu être changé."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "le mode plein écran n'a pu être changé."
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "la correction de rapport d'aspect n'a pu être changée."
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Mode graphique:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Mode de rendu:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Mode spécial de tramage supporté par certains jeux"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Plein écran"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Correction du rapport d'aspect"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Corrige le rapport d'aspect pour les jeu 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Détramage EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Active le détramage dans les jeux EGA qui le supporte"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Sortie Préféré:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Sortie Audio:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
"Spécifie le périphérique de sortie audio ou l'émulateur de carte audio "
"préféré"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Spécifie le périphérique de sortie audio ou l'émulateur de carte audio"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Sortie Préféré:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Sortie Audio:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "Émulateur AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib est utilisé pour la musique dans de nombreux jeux"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Fréquence:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -673,64 +670,64 @@ msgstr ""
"Une valeur plus élevée donne une meilleure qualité audio mais peut ne pas "
"être supporté par votre carte son"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "Sortie GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Spécifie le périphérique audio par défaut pour la sortie General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Ne pas utiliser la musique General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Utiliser le premier périphérique disponible"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "Banque de sons:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
"La banque de sons (SoundFont) est utilisée par certaines cartes audio, "
"Fluidsynth et Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Mode mixe AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Utiliser à la fois MIDI et AdLib"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Gain MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Sortie MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Spécifie le périphérique audio par défaut pour la sortie Roland MT-32/LAPC1/"
"CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Roland MT-32 exacte (désactive l'émulation GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -738,195 +735,195 @@ msgstr ""
"Vérifie si vous voulez utiliser un périphérique audio compatible Roland "
"connecté à l'ordinateur"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Roland MT-32 exacte (pas d'ému GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Activer le mode Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr "Désactiver la conversion des pistes MT-32 en General MIDI"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Ne pas utiliser la musique Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Dialogue:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Voix"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Sous-titres"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Les deux"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Vitesse des ST:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Dialogue:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Voix"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Subs"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "V&S"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Affiche les sous-titres et joue les dialogues audio"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Vitesse des ST:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Volume Musique:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Musique:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Silence"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Volume Bruitage:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volume des effets spéciaux sonores"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Bruitage:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Volume Dialogues:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Dialogues:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Thèmes:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Thèmes:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"Spécifie un chemin vers des données supplémentaires utilisées par tous les "
"jeux ou ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Plugins:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Plugins:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Divers"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Divers"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Thème:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "Interface:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Sauvegarde auto:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Sauvegarde:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Touches"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Langue:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Langue de l'interface graphique de ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr ""
"Vous devez relancer ScummVM pour que le changement soit pris en compte."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Sélectionner le répertoire pour les sauvegardes"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr ""
"Le répertoire sélectionné est vérouillé en écriture. Sélectionnez un autre "
"répertoire."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Sélectionner le répertoire des thèmes d'interface"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Sélectionner le répertoire pour les fichiers suplémentaires"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Sélectionner le répertoire des plugins"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -934,104 +931,140 @@ msgstr ""
"Le thème que vous avez sélectioné ne support pas la langue française. Si "
"vous voulez l'utiliser vous devez d'abord changer de langue."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Date inconnue"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Heure inconnue"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Durée de jeu inconnue"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Supprimer"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Voulez-vous vraiment supprimer cette sauvegarde?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Date: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Heure: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Durée de jeu: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Sauvegarde sans nom"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Sauver"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Échec de la sauvegarde."
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Nom:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Sélectionnez un Thème"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX désactivé"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX désactivé"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Rendu Standard (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Rendu Anti-crénelé (16 bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Anti-crénelé (16 bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Effacer la valeur"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
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:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Mettre en pause"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Passer la phrase"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Erreur lors de l'éxécution du jeu:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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é"
@@ -1099,18 +1132,18 @@ msgstr "Annuler par l'utilisateur"
msgid "Unknown error"
msgstr "Erreur inconnue"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "Le jeu dans '%s' n'est pas reconnu."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
"Veuillez reporter les informations suivantes à l'équipe ScummVM ainsi que le "
"nom"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "du jeu que vous avez essayé d'ajouter, sa version, le langage, etc..."
@@ -1138,22 +1171,23 @@ msgstr "~A~ide"
msgid "~A~bout"
msgstr "À ~P~ropos"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "Retour au ~L~anceur"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "Retour au ~L~anceur"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Sauvegarde:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1162,7 +1196,7 @@ msgstr "Sauvegarde:"
msgid "Save"
msgstr "Sauver"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1172,27 +1206,26 @@ msgstr ""
"fichier README pour les informations de base et les instructions pour "
"obtenir de l'aide supplémentaire."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Désolé, il n'y a pas d'aide disponible dans ce jeu actuellement. Lisez le "
-"fichier README pour les informations de base et les instructions pour "
-"obtenir de l'aide supplémentaire."
+"Echec de la sauvegarde (%s)! Lisez le fichier README pour les informations "
+"de base et les instructions pour obtenir de l'aide supplémentaire."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~A~nnuler"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~ouches"
@@ -1241,14 +1274,13 @@ msgstr ""
"Lisez le fichier README pour plus de détails."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Désolé, il n'y a pas d'aide disponible dans ce jeu actuellement. Lisez le "
-"fichier README pour les informations de base et les instructions pour "
-"obtenir de l'aide supplémentaire."
+"Echec du chargement (%s)! . Lisez le fichier README pour les informations de "
+"base et les instructions pour obtenir de l'aide supplémentaire."
#: engines/engine.cpp:439
msgid ""
@@ -1264,6 +1296,92 @@ msgstr ""
msgid "Start anyway"
msgstr "Jouer quand même"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Dialogues sauvegarde/chargement d'origine"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"Utiliser les dialogues sauvegarde/chargement d'origine plutôt que ceux de "
+"ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Charger le jeu:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Charger"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Utiliser le mode palette lumineuse"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Utiliser la palette lumineuse du jeu pour l'affichage"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Détramage EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Activer le détramage dans les jeux EGA"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Préférer les effets sonors digitals"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Préférer les effets sonores digitaux plutôt que ceux synthétisés"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Utiliser IMF/Yamaha FB-01 pour la sortie MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Utiliser une carte IBM Music Feature ou un module Yamaha FB-01 FM pour la "
+"sortie MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Utiliser la musique du CD"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+"Utiliser la musique du CD quand elle est disponible au lieu de la musique du "
+"jeu"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Utiliser les curseurs Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Utiliser les curseurs Windows (plus petits et monochromes) au lieu des "
+"curseurs DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Utiliser les curseurs argentés"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr "Utiliser les curseurs argentés au lieu des curseurs normaux dorés"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1380,23 +1498,23 @@ msgstr "Voix & ST"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Sélectionnez un niveau de compétence."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Reportez-vous à votre manuel d'instruction."
#: engines/scumm/dialogs.cpp:658
msgid "Standard"
-msgstr "Standard"
+msgstr "Normal"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Essai"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Expert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1920,7 +2038,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:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1931,7 +2049,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1942,7 +2060,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1953,7 +2071,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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,25 +2108,17 @@ msgstr "~M~enu Principal"
msgid "~W~ater Effect Enabled"
msgstr "~E~ffets de l'Eau Activés"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Charger le jeu:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Charger"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Échec de l'enregistrement de l'état du jeu sur le disque."
@@ -2020,6 +2130,64 @@ msgstr "Échec de la suppression du fichier."
msgid "Failed to save game"
msgstr "Échec de la sauvegarde."
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Public en studio"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Activer le public en studio"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Support des interruptions"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Permet de sauter les textes et scènes cinématiques"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Mode Helium"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Activer le mode helium"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Défilement régulier"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Activer le défilement régulier en marchant"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Curseurs flotants"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Activer les curseurs flotants"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Bar HP"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Activer les bars de santé (Hit Point)"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Attaque 1"
@@ -2073,14 +2241,23 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Il semble que vous utilisiez un périphérique General MIDI,\n"
-"mais ce jeu ne support que le MIDI Roland MT32.\n"
-"Nous essayons d'associer les instruments Roland MT32 auxinstruments General "
-"MIDI. Mais il est possible que quelquespistes ne soient pas jouées "
-"correctement."
+"mais ce jeu ne support que le MIDI Roland MT32. Nous essayons\n"
+"d'associer les instruments Roland MT32 aux instruments General\n"
+"MIDI. Cependant il est possible que quelques pistes ne soient\n"
+" pas jouées correctement."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Utiliser l'intro de la version disquette (version CD uniquement)"
#: engines/sky/compact.cpp:130
msgid ""
@@ -2098,10 +2275,19 @@ msgstr ""
"Le fichier \"sky.cpt\" a une taille incorrecte.\n"
"Vous pouvez le (re)télécharger sur www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Intro disquette"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Utiliser l'intro de la version disquette (version CD uniquement)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
msgstr ""
+"La scène cinématique PSX '%s' ne peut pas être lu avec 256 couleurs ou moins"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2158,12 +2344,30 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "C'est la fin de la démo des Chevaliers de Baphomet"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"Les séquences DXA sont présente mais ScummVM a été compilé sans le support "
-"zlib."
+"Scènes cinématique PSX détectées mais ScummVM a été compilé sans le support "
+"des couleurs RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Afficher la description des objets"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Afficher la description des objets lors de passage du pointeur"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2174,15 +2378,15 @@ msgstr ""
"Erreur lors de la sauvegarde dans l'emplacement %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Chargement en cours..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Sauvegarde en cours..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2199,11 +2403,11 @@ msgstr ""
"Appuyer sur OK pour les convertir maintenant, sinon le même message "
"s'affichera la prochaine fois que vous démarrerez le jeu.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM a converti avec succès vos anciennes sauvegardes."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2303,9 +2507,8 @@ msgid "Keymap:"
msgstr "Affectation des touches:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
-msgstr "(Actif)"
+msgstr "(Effectif)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
@@ -2313,7 +2516,7 @@ msgstr "(Actif)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr "(Bloqué)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2399,27 +2602,27 @@ msgstr "Audio haute qualité (plus lent) (redémarrer)"
msgid "Disable power off"
msgstr "Désactivé l'extinction"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Mode souris-cliquer-et-déplacer activé"
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Mode souris-cliquer-et-déplacer désactivé"
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Mode touchpad activé"
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Mode touchpad désactivé"
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr "Mode Clic"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2427,11 +2630,11 @@ msgstr "Mode Clic"
msgid "Left Click"
msgstr "Clic Gauche"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
msgstr "Clic Milieu"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2468,34 +2671,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Désactiver la correction du rapport d'aspect"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Mode graphique actif:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Mode Fenêtre"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Préserve"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Originel"
@@ -2837,37 +3040,37 @@ msgstr "Lanceur"
msgid "Do you really want to quit?"
msgstr "Voulez-vous vraiment quitter?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Touchscreen 'Tap Mode' - Clic Gauche"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Touchscreen 'Tap Mode' - Clic Droit"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Touchscreen 'Tap Mode' - Déplacer sans cliquer"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Volume Maximum"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Augmentation Volume"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Volume Minimum"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Diminution Volume"
diff --git a/po/gl_ES.po b/po/gl_ES.po
new file mode 100644
index 0000000000..d08867b717
--- /dev/null
+++ b/po/gl_ES.po
@@ -0,0 +1,3092 @@
+# LANGUAGE translation for ScummVM.
+# Copyright (C) YEAR ScummVM Team
+# This file is distributed under the same license as the ScummVM package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: ScummVM 1.6.0git\n"
+"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-08-15 13:33+0100\n"
+"Last-Translator: Santiago G. Sanz <s.sanz@uvigo.es>\n"
+"Language-Team: \n"
+"Language: Galego\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: gui/about.cpp:91
+#, c-format
+msgid "(built on %s)"
+msgstr "(compilado o %s)"
+
+#: gui/about.cpp:98
+msgid "Features compiled in:"
+msgstr "Funcionalidades compiladas:"
+
+#: gui/about.cpp:107
+msgid "Available engines:"
+msgstr "Motores dispoñibles:"
+
+#: gui/browser.cpp:66
+msgid "Go up"
+msgstr "Arriba"
+
+#: gui/browser.cpp:66 gui/browser.cpp:68
+msgid "Go to previous directory level"
+msgstr "Ir ao directorio superior"
+
+#: gui/browser.cpp:68
+msgctxt "lowres"
+msgid "Go up"
+msgstr "Arriba"
+
+#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
+#: backends/events/default/default-events.cpp:191
+#: backends/events/default/default-events.cpp:213
+msgid "Cancel"
+msgstr "Cancelar"
+
+#: gui/browser.cpp:70 gui/chooser.cpp:46 gui/themebrowser.cpp:55
+msgid "Choose"
+msgstr "Elexir"
+
+#: 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 "Pechar"
+
+#: gui/gui-manager.cpp:118
+msgid "Mouse click"
+msgstr "Premer co rato"
+
+#: gui/gui-manager.cpp:122 base/main.cpp:300
+msgid "Display keyboard"
+msgstr "Mostrar teclado"
+
+#: gui/gui-manager.cpp:126 base/main.cpp:304
+msgid "Remap keys"
+msgstr "Asignar teclas"
+
+#: gui/gui-manager.cpp:129 base/main.cpp:307
+msgid "Toggle FullScreen"
+msgstr "Activar/desactivar pantalla completa"
+
+#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
+msgid "Choose an action to map"
+msgstr "Elixe unha acción para asignala"
+
+#: gui/KeysDialog.cpp:41
+msgid "Map"
+msgstr "Asignar"
+
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
+#: backends/platform/wince/CELauncherDialog.cpp:54
+msgid "OK"
+msgstr "Aceptar"
+
+#: gui/KeysDialog.cpp:49
+msgid "Select an action and click 'Map'"
+msgstr "Selecciona unha acción e preme en Asignar"
+
+#: gui/KeysDialog.cpp:80 gui/KeysDialog.cpp:102 gui/KeysDialog.cpp:141
+#, c-format
+msgid "Associated key : %s"
+msgstr "Tecla asociada: %s"
+
+#: gui/KeysDialog.cpp:82 gui/KeysDialog.cpp:104 gui/KeysDialog.cpp:143
+#, c-format
+msgid "Associated key : none"
+msgstr "Tecla asociada: ningunha"
+
+#: gui/KeysDialog.cpp:90
+msgid "Please select an action"
+msgstr "Selecciona unha acción"
+
+#: gui/KeysDialog.cpp:106
+msgid "Press the key to associate"
+msgstr "Preme a tecla para asociala"
+
+#: gui/launcher.cpp:187
+msgid "Game"
+msgstr "Xogo"
+
+#: gui/launcher.cpp:191
+msgid "ID:"
+msgstr "ID:"
+
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
+msgid ""
+"Short game identifier used for referring to savegames and running the game "
+"from the command line"
+msgstr ""
+"Identificador curto do xogo para os ficheiros de gardado e a execución do "
+"xogo dende a liña de comandos"
+
+#: gui/launcher.cpp:193
+msgctxt "lowres"
+msgid "ID:"
+msgstr "ID:"
+
+#: gui/launcher.cpp:198
+msgid "Name:"
+msgstr "Nome:"
+
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
+msgid "Full title of the game"
+msgstr "Título completo do xogo"
+
+#: gui/launcher.cpp:200
+msgctxt "lowres"
+msgid "Name:"
+msgstr "Nome:"
+
+#: gui/launcher.cpp:204
+msgid "Language:"
+msgstr "Idioma:"
+
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
+msgid ""
+"Language of the game. This will not turn your Spanish game version into "
+"English"
+msgstr "Idioma do xogo. Non converterá a versión galega do xogo en inglesa"
+
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
+#: audio/null.cpp:40
+msgid "<default>"
+msgstr "<por defecto>"
+
+#: gui/launcher.cpp:216
+msgid "Platform:"
+msgstr "Plataforma:"
+
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
+msgid "Platform the game was originally designed for"
+msgstr "Plataforma para a que se desenvolvera o xogo inicialmente"
+
+#: gui/launcher.cpp:218
+msgctxt "lowres"
+msgid "Platform:"
+msgstr "Plataforma:"
+
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
+msgid "Graphics"
+msgstr "Gráficos"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
+msgid "GFX"
+msgstr "Efectos gráficos"
+
+#: gui/launcher.cpp:242
+msgid "Override global graphic settings"
+msgstr "Anular a configuración dos gráficos"
+
+#: gui/launcher.cpp:244
+msgctxt "lowres"
+msgid "Override global graphic settings"
+msgstr "Anular a configuración dos gráficos"
+
+#: gui/launcher.cpp:251 gui/options.cpp:1085
+msgid "Audio"
+msgstr "Son"
+
+#: gui/launcher.cpp:254
+msgid "Override global audio settings"
+msgstr "Anular a configuración do son"
+
+#: gui/launcher.cpp:256
+msgctxt "lowres"
+msgid "Override global audio settings"
+msgstr "Anular a configuración do son"
+
+#: gui/launcher.cpp:265 gui/options.cpp:1090
+msgid "Volume"
+msgstr "Volume"
+
+#: gui/launcher.cpp:267 gui/options.cpp:1092
+msgctxt "lowres"
+msgid "Volume"
+msgstr "Volume"
+
+#: gui/launcher.cpp:270
+msgid "Override global volume settings"
+msgstr "Anular a configuración do volume"
+
+#: gui/launcher.cpp:272
+msgctxt "lowres"
+msgid "Override global volume settings"
+msgstr "Anular a configuración do volume"
+
+#: gui/launcher.cpp:280 gui/options.cpp:1100
+msgid "MIDI"
+msgstr "MIDI"
+
+#: gui/launcher.cpp:283
+msgid "Override global MIDI settings"
+msgstr "Anular a configuración de MIDI"
+
+#: gui/launcher.cpp:285
+msgctxt "lowres"
+msgid "Override global MIDI settings"
+msgstr "Anular a configuración de MIDI"
+
+#: gui/launcher.cpp:294 gui/options.cpp:1106
+msgid "MT-32"
+msgstr "MT-32"
+
+#: gui/launcher.cpp:297
+msgid "Override global MT-32 settings"
+msgstr "Anular a configuración de MT-32"
+
+#: gui/launcher.cpp:299
+msgctxt "lowres"
+msgid "Override global MT-32 settings"
+msgstr "Anular a configuración de MT-32"
+
+#: gui/launcher.cpp:308 gui/options.cpp:1113
+msgid "Paths"
+msgstr "Camiños"
+
+#: gui/launcher.cpp:310 gui/options.cpp:1115
+msgctxt "lowres"
+msgid "Paths"
+msgstr "Camiños"
+
+#: gui/launcher.cpp:317
+msgid "Game Path:"
+msgstr "Camiño do xogo:"
+
+#: gui/launcher.cpp:319
+msgctxt "lowres"
+msgid "Game Path:"
+msgstr "Camiño do xogo:"
+
+#: gui/launcher.cpp:324 gui/options.cpp:1139
+msgid "Extra Path:"
+msgstr "Camiño adicional:"
+
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
+msgid "Specifies path to additional data used the game"
+msgstr "Especifica o camiño dos datos adicionais usados no xogo"
+
+#: gui/launcher.cpp:326 gui/options.cpp:1141
+msgctxt "lowres"
+msgid "Extra Path:"
+msgstr "Camiño adicional:"
+
+#: gui/launcher.cpp:333 gui/options.cpp:1123
+msgid "Save Path:"
+msgstr "Camiño de gardado:"
+
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
+msgid "Specifies where your savegames are put"
+msgstr "Especifica o lugar dos ficheiros de gardado"
+
+#: gui/launcher.cpp:335 gui/options.cpp:1125
+msgctxt "lowres"
+msgid "Save Path:"
+msgstr "Camiño de gardado:"
+
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
+msgctxt "path"
+msgid "None"
+msgstr "Ningún"
+
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
+#: backends/platform/wii/options.cpp:56
+msgid "Default"
+msgstr "Predefinido"
+
+#: gui/launcher.cpp:504 gui/options.cpp:1417
+msgid "Select SoundFont"
+msgstr "Seleccionar SoundFont"
+
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
+msgid "Select directory with game data"
+msgstr "Selecciona un directorio con datos de xogo"
+
+#: gui/launcher.cpp:541
+msgid "Select additional game directory"
+msgstr "Selecciona un directorio con datos adicionais"
+
+#: gui/launcher.cpp:553
+msgid "Select directory for saved games"
+msgstr "Selecciona un directorio para ficheiros de gardado"
+
+#: gui/launcher.cpp:580
+msgid "This game ID is already taken. Please choose another one."
+msgstr "Este ID de xogo xa está en uso. Selecciona outro."
+
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
+msgid "~Q~uit"
+msgstr "~S~aír"
+
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
+msgid "Quit ScummVM"
+msgstr "Saír de ScummVM"
+
+#: gui/launcher.cpp:622
+msgid "A~b~out..."
+msgstr "Ace~r~ca de..."
+
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
+msgid "About ScummVM"
+msgstr "Acerca de ScummVM"
+
+#: gui/launcher.cpp:623
+msgid "~O~ptions..."
+msgstr "~O~pcións..."
+
+#: gui/launcher.cpp:623
+msgid "Change global ScummVM options"
+msgstr "Cambiar as opcións de ScummVM"
+
+#: gui/launcher.cpp:625
+msgid "~S~tart"
+msgstr "~I~niciar"
+
+#: gui/launcher.cpp:625
+msgid "Start selected game"
+msgstr "Iniciar o xogo seleccionado"
+
+#: gui/launcher.cpp:628
+msgid "~L~oad..."
+msgstr "~C~argar..."
+
+#: gui/launcher.cpp:628
+msgid "Load savegame for selected game"
+msgstr "Cargar partida do xogo seleccionado"
+
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
+msgid "~A~dd Game..."
+msgstr "Eng~a~dir xogo..."
+
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
+msgid "Hold Shift for Mass Add"
+msgstr "Manter premido MAIÚS para engadir en masa"
+
+#: gui/launcher.cpp:635
+msgid "~E~dit Game..."
+msgstr "~E~ditar xogo..."
+
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
+msgid "Change game options"
+msgstr "Cambiar as opcións do xogo"
+
+#: gui/launcher.cpp:637
+msgid "~R~emove Game"
+msgstr "Elimina~r~ xogo"
+
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
+msgid "Remove game from the list. The game data files stay intact"
+msgstr "Eliminar o xogo da lista. Os ficheiros de datos non se modifican"
+
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
+msgctxt "lowres"
+msgid "~A~dd Game..."
+msgstr "Eng~a~dir xogo..."
+
+#: gui/launcher.cpp:642
+msgctxt "lowres"
+msgid "~E~dit Game..."
+msgstr "~E~ditar xogo..."
+
+#: gui/launcher.cpp:644
+msgctxt "lowres"
+msgid "~R~emove Game"
+msgstr "Elimina~r~ xogo"
+
+#: gui/launcher.cpp:652
+msgid "Search in game list"
+msgstr "Buscar na lista de xogos"
+
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
+msgid "Search:"
+msgstr "Buscar:"
+
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
+msgid "Load game:"
+msgstr "Cargar partida:"
+
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
+#: backends/platform/wince/CEActionsSmartphone.cpp:231
+msgid "Load"
+msgstr "Cargar"
+
+#: gui/launcher.cpp:788
+msgid ""
+"Do you really want to run the mass game detector? This could potentially add "
+"a huge number of games."
+msgstr ""
+"Queres executar o detector de xogos en masa? É posible que se engada un gran "
+"número de xogos."
+
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
+#: backends/events/symbiansdl/symbiansdl-events.cpp:184
+#: backends/platform/wince/CEActionsPocket.cpp:326
+#: backends/platform/wince/CEActionsSmartphone.cpp:287
+#: backends/platform/wince/CELauncherDialog.cpp:83
+msgid "Yes"
+msgstr "Si"
+
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
+#: backends/events/symbiansdl/symbiansdl-events.cpp:184
+#: backends/platform/wince/CEActionsPocket.cpp:326
+#: backends/platform/wince/CEActionsSmartphone.cpp:287
+#: backends/platform/wince/CELauncherDialog.cpp:83
+msgid "No"
+msgstr "Non"
+
+#: gui/launcher.cpp:837
+msgid "ScummVM couldn't open the specified directory!"
+msgstr "ScummVM non foi quen de abrir o directorio!"
+
+#: gui/launcher.cpp:849
+msgid "ScummVM could not find any game in the specified directory!"
+msgstr "ScummVM non foi quen de atopar xogos no directorio!"
+
+#: gui/launcher.cpp:863
+msgid "Pick the game:"
+msgstr "Elixe o xogo:"
+
+#: gui/launcher.cpp:937
+msgid "Do you really want to remove this game configuration?"
+msgstr "Seguro que queres eliminar esta configuración de xogo?"
+
+#: gui/launcher.cpp:1001
+msgid "This game does not support loading games from the launcher."
+msgstr "O xogo non permite cargar partidas dende o iniciador."
+
+#: gui/launcher.cpp:1005
+msgid "ScummVM could not find any engine capable of running the selected game!"
+msgstr "ScummVM non foi quen de atopar un motor para executar o xogo!"
+
+#: gui/launcher.cpp:1119
+msgctxt "lowres"
+msgid "Mass Add..."
+msgstr "Engadir en masa..."
+
+#: gui/launcher.cpp:1119
+msgid "Mass Add..."
+msgstr "Engadir en masa..."
+
+#: gui/massadd.cpp:78 gui/massadd.cpp:81
+msgid "... progress ..."
+msgstr "...progreso..."
+
+#: gui/massadd.cpp:258
+msgid "Scan complete!"
+msgstr "Análise finalizada!"
+
+#: gui/massadd.cpp:261
+#, c-format
+msgid "Discovered %d new games, ignored %d previously added games."
+msgstr "%d xogos novos atopados; %d xogos xa engadidos ignorados."
+
+#: gui/massadd.cpp:265
+#, c-format
+msgid "Scanned %d directories ..."
+msgstr "%d directorios analizados..."
+
+#: gui/massadd.cpp:268
+#, c-format
+msgid "Discovered %d new games, ignored %d previously added games ..."
+msgstr "%d xogos novos atopados; %d xogos xa engadidos ignorados..."
+
+#: gui/options.cpp:78
+msgid "Never"
+msgstr "Nunca"
+
+#: gui/options.cpp:78
+msgid "every 5 mins"
+msgstr "cada 5 min"
+
+#: gui/options.cpp:78
+msgid "every 10 mins"
+msgstr "cada 10 min"
+
+#: gui/options.cpp:78
+msgid "every 15 mins"
+msgstr "cada 15 min"
+
+#: gui/options.cpp:78
+msgid "every 30 mins"
+msgstr "cada 30 min"
+
+#: gui/options.cpp:80
+msgid "8 kHz"
+msgstr "8 kHz"
+
+#: gui/options.cpp:80
+msgid "11kHz"
+msgstr "11 kHz"
+
+#: gui/options.cpp:80
+msgid "22 kHz"
+msgstr "22 kHz"
+
+#: gui/options.cpp:80
+msgid "44 kHz"
+msgstr "44 kHz"
+
+#: gui/options.cpp:80
+msgid "48 kHz"
+msgstr "48 kHz"
+
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
+msgctxt "soundfont"
+msgid "None"
+msgstr "Ningunha"
+
+#: gui/options.cpp:382
+msgid "Failed to apply some of the graphic options changes:"
+msgstr "Erro ao aplicar os cambios na configuración dos gráficos:"
+
+#: gui/options.cpp:394
+msgid "the video mode could not be changed."
+msgstr "non se puido cambiar o modo de vídeo."
+
+#: gui/options.cpp:400
+msgid "the fullscreen setting could not be changed"
+msgstr "non se puido cambiar a configuración de pantalla completa."
+
+#: gui/options.cpp:406
+msgid "the aspect ratio setting could not be changed"
+msgstr "non se puido cambiar a proporción."
+
+#: gui/options.cpp:727
+msgid "Graphics mode:"
+msgstr "Modo de gráficos:"
+
+#: gui/options.cpp:741
+msgid "Render mode:"
+msgstr "Modo de procesamento:"
+
+#: gui/options.cpp:741 gui/options.cpp:742
+msgid "Special dithering modes supported by some games"
+msgstr "Modos de interpolación de cores compatibles con algúns xogos"
+
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
+msgid "Fullscreen mode"
+msgstr "Pantalla completa"
+
+#: gui/options.cpp:756
+msgid "Aspect ratio correction"
+msgstr "Corrección de proporción"
+
+#: gui/options.cpp:756
+msgid "Correct aspect ratio for 320x200 games"
+msgstr "Corrixir a proporción para os xogos en 320x200"
+
+#: gui/options.cpp:764
+msgid "Preferred Device:"
+msgstr "Dispositivo preferido:"
+
+#: gui/options.cpp:764
+msgid "Music Device:"
+msgstr "Dispositivo de música:"
+
+#: gui/options.cpp:764 gui/options.cpp:766
+msgid "Specifies preferred sound device or sound card emulator"
+msgstr "Especifica o dispositivo ou emulador de tarxeta de son preferido"
+
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
+msgid "Specifies output sound device or sound card emulator"
+msgstr "Especifica o dispositivo ou emulador de tarxeta de son de saída"
+
+#: gui/options.cpp:766
+msgctxt "lowres"
+msgid "Preferred Dev.:"
+msgstr "Disp. preferido:"
+
+#: gui/options.cpp:766
+msgctxt "lowres"
+msgid "Music Device:"
+msgstr "Disp. música:"
+
+#: gui/options.cpp:793
+msgid "AdLib emulator:"
+msgstr "Emulador de AdLib:"
+
+#: gui/options.cpp:793 gui/options.cpp:794
+msgid "AdLib is used for music in many games"
+msgstr "Moitos xogos empregan AdLib para a música"
+
+#: gui/options.cpp:804
+msgid "Output rate:"
+msgstr "Taxa de saída:"
+
+#: gui/options.cpp:804 gui/options.cpp:805
+msgid ""
+"Higher value specifies better sound quality but may be not supported by your "
+"soundcard"
+msgstr ""
+"A maior valor, maior calidade do son, mais talvez non sexa compatible coa "
+"tarxeta"
+
+#: gui/options.cpp:815
+msgid "GM Device:"
+msgstr "Dispositivo de GM:"
+
+#: gui/options.cpp:815
+msgid "Specifies default sound device for General MIDI output"
+msgstr ""
+"Especifica o dispositivo de son por defecto para a saída de General MIDI"
+
+#: gui/options.cpp:826
+msgid "Don't use General MIDI music"
+msgstr "Non empregar música en General MIDI"
+
+#: gui/options.cpp:837 gui/options.cpp:899
+msgid "Use first available device"
+msgstr "Empregar o primeiro dispositivo dispoñible"
+
+#: gui/options.cpp:849
+msgid "SoundFont:"
+msgstr "SoundFont:"
+
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
+msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
+msgstr ""
+"SoundFont é compatible con algunhas tarxetas de son, Fluidsynth e Timidity"
+
+#: gui/options.cpp:851
+msgctxt "lowres"
+msgid "SoundFont:"
+msgstr "SoundFont:"
+
+#: gui/options.cpp:857
+msgid "Mixed AdLib/MIDI mode"
+msgstr "Modo AdLib/MIDI mixto"
+
+#: gui/options.cpp:857
+msgid "Use both MIDI and AdLib sound generation"
+msgstr "Empregar xeración de son MIDI e máis AdLib"
+
+#: gui/options.cpp:860
+msgid "MIDI gain:"
+msgstr "Ganancia de MIDI:"
+
+#: gui/options.cpp:870
+msgid "MT-32 Device:"
+msgstr "Dispositivo de MT-32:"
+
+#: gui/options.cpp:870
+msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
+msgstr ""
+"Especifica o dispositivo por defecto para a saída de Roland MT-32/LAPC1/"
+"CM32l/CM64"
+
+#: gui/options.cpp:875
+msgid "True Roland MT-32 (disable GM emulation)"
+msgstr "Roland MT-32 verdadeiro (sen emulación de GM)"
+
+#: gui/options.cpp:875 gui/options.cpp:877
+msgid ""
+"Check if you want to use your real hardware Roland-compatible sound device "
+"connected to your computer"
+msgstr ""
+"Marcar para empregar o hardware compatible con Roland conectado ao sistema"
+
+#: gui/options.cpp:877
+msgctxt "lowres"
+msgid "True Roland MT-32 (no GM emulation)"
+msgstr "Roland MT-32 (sen emulación de GM)"
+
+#: gui/options.cpp:880
+msgid "Enable Roland GS Mode"
+msgstr "Activar modo Roland GS"
+
+#: gui/options.cpp:880
+msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
+msgstr "Desactiva o General MIDI para os xogos con música en Roland MT-32"
+
+#: gui/options.cpp:889
+msgid "Don't use Roland MT-32 music"
+msgstr "Non empregar música en Roland MT-32"
+
+#: gui/options.cpp:916
+msgid "Text and Speech:"
+msgstr "Texto e voz:"
+
+#: gui/options.cpp:920 gui/options.cpp:930
+msgid "Speech"
+msgstr "Voz"
+
+#: gui/options.cpp:921 gui/options.cpp:931
+msgid "Subtitles"
+msgstr "Subtítulos"
+
+#: gui/options.cpp:922
+msgid "Both"
+msgstr "Ambos"
+
+#: gui/options.cpp:924
+msgid "Subtitle speed:"
+msgstr "Velocidade dos subtítulos:"
+
+#: gui/options.cpp:926
+msgctxt "lowres"
+msgid "Text and Speech:"
+msgstr "Texto e voz:"
+
+#: gui/options.cpp:930
+msgid "Spch"
+msgstr "Voz"
+
+#: gui/options.cpp:931
+msgid "Subs"
+msgstr "Subs"
+
+#: gui/options.cpp:932
+msgctxt "lowres"
+msgid "Both"
+msgstr "Ambos"
+
+#: gui/options.cpp:932
+msgid "Show subtitles and play speech"
+msgstr "Mostrar os subtítulos e reproducir as voces"
+
+#: gui/options.cpp:934
+msgctxt "lowres"
+msgid "Subtitle speed:"
+msgstr "Velocidade subs:"
+
+#: gui/options.cpp:950
+msgid "Music volume:"
+msgstr "Volume de música:"
+
+#: gui/options.cpp:952
+msgctxt "lowres"
+msgid "Music volume:"
+msgstr "Volume música:"
+
+#: gui/options.cpp:959
+msgid "Mute All"
+msgstr "Silenciar todo"
+
+#: gui/options.cpp:962
+msgid "SFX volume:"
+msgstr "Volume de efectos:"
+
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
+msgid "Special sound effects volume"
+msgstr "Volume dos efectos de son"
+
+#: gui/options.cpp:964
+msgctxt "lowres"
+msgid "SFX volume:"
+msgstr "Volume efectos:"
+
+#: gui/options.cpp:972
+msgid "Speech volume:"
+msgstr "Volume de voz:"
+
+#: gui/options.cpp:974
+msgctxt "lowres"
+msgid "Speech volume:"
+msgstr "Volume voz:"
+
+#: gui/options.cpp:1131
+msgid "Theme Path:"
+msgstr "Camiño do tema:"
+
+#: gui/options.cpp:1133
+msgctxt "lowres"
+msgid "Theme Path:"
+msgstr "Camiño tema:"
+
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
+msgid "Specifies path to additional data used by all games or ScummVM"
+msgstr ""
+"Especificar o camiño dos datos adicionais de todos os xogos ou de ScummVM"
+
+#: gui/options.cpp:1148
+msgid "Plugins Path:"
+msgstr "Camiño dos complementos:"
+
+#: gui/options.cpp:1150
+msgctxt "lowres"
+msgid "Plugins Path:"
+msgstr "Camiño complementos:"
+
+#: gui/options.cpp:1159
+msgid "Misc"
+msgstr "Misc."
+
+#: gui/options.cpp:1161
+msgctxt "lowres"
+msgid "Misc"
+msgstr "Misc."
+
+#: gui/options.cpp:1163
+msgid "Theme:"
+msgstr "Tema:"
+
+#: gui/options.cpp:1167
+msgid "GUI Renderer:"
+msgstr "Procesamento da interfaz:"
+
+#: gui/options.cpp:1179
+msgid "Autosave:"
+msgstr "Autogardado:"
+
+#: gui/options.cpp:1181
+msgctxt "lowres"
+msgid "Autosave:"
+msgstr "Autogardado:"
+
+#: gui/options.cpp:1189
+msgid "Keys"
+msgstr "Teclas"
+
+#: gui/options.cpp:1196
+msgid "GUI Language:"
+msgstr "Idioma de interfaz:"
+
+#: gui/options.cpp:1196
+msgid "Language of ScummVM GUI"
+msgstr "Idioma da interfaz de ScummVM"
+
+#: gui/options.cpp:1347
+msgid "You have to restart ScummVM before your changes will take effect."
+msgstr "Debes reiniciar ScummVM para que os cambios teñan efecto."
+
+#: gui/options.cpp:1360
+msgid "Select directory for savegames"
+msgstr "Seleccionar directorio para ficheiros de gardado"
+
+#: gui/options.cpp:1367
+msgid "The chosen directory cannot be written to. Please select another one."
+msgstr "Non é posible escribir no directorio elixido. Selecciona outro."
+
+#: gui/options.cpp:1376
+msgid "Select directory for GUI themes"
+msgstr "Seleccionar directorio para temas de interfaz"
+
+#: gui/options.cpp:1386
+msgid "Select directory for extra files"
+msgstr "Seleccionar directorio para ficheiros adicionais"
+
+#: gui/options.cpp:1397
+msgid "Select directory for plugins"
+msgstr "Seleccionar directorio para complementos"
+
+#: gui/options.cpp:1450
+msgid ""
+"The theme you selected does not support your current language. If you want "
+"to use this theme you need to switch to another language first."
+msgstr ""
+"O tema seleccionado non é compatible co idioma actual. Para empregar o tema, "
+"deberás cambiar antes o idioma da interfaz."
+
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr "Lista"
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr "Grade"
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
+msgid "No date saved"
+msgstr "Non hai data gardada"
+
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
+msgid "No time saved"
+msgstr "Non hai hora gardada"
+
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
+msgid "No playtime saved"
+msgstr "Non hai tempo de xogo gardado"
+
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
+msgid "Delete"
+msgstr "Eliminar"
+
+#: gui/saveload-dialog.cpp:266
+msgid "Do you really want to delete this savegame?"
+msgstr "Seguro que queres eliminar esta partida?"
+
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
+msgid "Date: "
+msgstr "Data:"
+
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
+msgid "Time: "
+msgstr "Hora:"
+
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
+msgid "Playtime: "
+msgstr "Tempo de xogo:"
+
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
+msgid "Untitled savestate"
+msgstr "Partida sen título"
+
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr "Seg."
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr "Ant."
+
+#: gui/saveload-dialog.cpp:684
+msgid "New Save"
+msgstr "Novo ficheiro"
+
+#: gui/saveload-dialog.cpp:684
+msgid "Create a new save game"
+msgstr "Crea un novo ficheiro de gardado"
+
+#: gui/saveload-dialog.cpp:789
+msgid "Name: "
+msgstr "Nome:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr "Introduce unha descrición para o espazo %d:"
+
+#: gui/themebrowser.cpp:44
+msgid "Select a Theme"
+msgstr "Seleccionar tema"
+
+#: gui/ThemeEngine.cpp:337
+msgid "Disabled GFX"
+msgstr "Efectos gráficos desactivados"
+
+#: gui/ThemeEngine.cpp:337
+msgctxt "lowres"
+msgid "Disabled GFX"
+msgstr "Efectos desactivados"
+
+#: gui/ThemeEngine.cpp:338
+msgid "Standard Renderer (16bpp)"
+msgstr "Procesamento estándar (16 bpp)"
+
+#: gui/ThemeEngine.cpp:338
+msgid "Standard (16bpp)"
+msgstr "Estándar (16 bpp)"
+
+#: gui/ThemeEngine.cpp:340
+msgid "Antialiased Renderer (16bpp)"
+msgstr "Procesamento antidistorsión (16 bpp)"
+
+#: gui/ThemeEngine.cpp:340
+msgid "Antialiased (16bpp)"
+msgstr "Antidistorsión (16 bpp)"
+
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
+msgid "Clear value"
+msgstr "Limpar valor"
+
+#: base/main.cpp:209
+#, c-format
+msgid "Engine does not support debug level '%s'"
+msgstr "O motor non é compatible co nivel de depuración %s"
+
+#: base/main.cpp:287
+msgid "Menu"
+msgstr "Menú"
+
+#: base/main.cpp:290 backends/platform/symbian/src/SymbianActions.cpp:45
+#: backends/platform/wince/CEActionsPocket.cpp:45
+#: backends/platform/wince/CEActionsSmartphone.cpp:46
+msgid "Skip"
+msgstr "Omitir"
+
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
+#: backends/platform/wince/CEActionsPocket.cpp:42
+msgid "Pause"
+msgstr "Pausa"
+
+#: base/main.cpp:296
+msgid "Skip line"
+msgstr "Omitir liña"
+
+#: base/main.cpp:467
+msgid "Error running game:"
+msgstr "Erro de execución do xogo:"
+
+#: base/main.cpp:491
+msgid "Could not find any engine capable of running the selected game"
+msgstr "Non se puido atopar un motor para executar o xogo seleccionado"
+
+#: common/error.cpp:38
+msgid "No error"
+msgstr "Non hai erros"
+
+#: common/error.cpp:40
+msgid "Game data not found"
+msgstr "Non se atoparon datos de xogo"
+
+#: common/error.cpp:42
+msgid "Game id not supported"
+msgstr "ID de xogo non compatible"
+
+#: common/error.cpp:44
+msgid "Unsupported color mode"
+msgstr "Modo de color non compatible"
+
+#: common/error.cpp:47
+msgid "Read permission denied"
+msgstr "Permiso de lectura denegado"
+
+#: common/error.cpp:49
+msgid "Write permission denied"
+msgstr "Permiso de escritura denegado"
+
+#: common/error.cpp:52
+msgid "Path does not exist"
+msgstr "O camiño non existe"
+
+#: common/error.cpp:54
+msgid "Path not a directory"
+msgstr "O camiño non é un directorio"
+
+#: common/error.cpp:56
+msgid "Path not a file"
+msgstr "O camiño non é un ficheiro"
+
+#: common/error.cpp:59
+msgid "Cannot create file"
+msgstr "Erro ao crear o ficheiro"
+
+#: common/error.cpp:61
+msgid "Reading data failed"
+msgstr "Erro ao ler os datos"
+
+#: common/error.cpp:63
+msgid "Writing data failed"
+msgstr "Erro ao escribir os datos"
+
+#: common/error.cpp:66
+msgid "Could not find suitable engine plugin"
+msgstr "Non se atopou un complemento axeitado para o motor"
+
+#: common/error.cpp:68
+msgid "Engine plugin does not support save states"
+msgstr "O complemento do motor non é compatible cos ficheiros de gardado"
+
+#: common/error.cpp:71
+msgid "User canceled"
+msgstr "Usuario cancelado"
+
+#: common/error.cpp:75
+msgid "Unknown error"
+msgstr "Erro descoñecido"
+
+#: engines/advancedDetector.cpp:316
+#, c-format
+msgid "The game in '%s' seems to be unknown."
+msgstr "O xogo de %s semella ser descoñecido."
+
+#: engines/advancedDetector.cpp:317
+msgid "Please, report the following data to the ScummVM team along with name"
+msgstr "Facilita esta información ao equipo de ScummVM, xunto co nome"
+
+#: engines/advancedDetector.cpp:319
+msgid "of the game you tried to add and its version/language/etc.:"
+msgstr "do xogo que tentaches engadir, xunto coa versión, lingua, etc.:"
+
+#: engines/dialogs.cpp:84
+msgid "~R~esume"
+msgstr "~R~etomar"
+
+#: engines/dialogs.cpp:86
+msgid "~L~oad"
+msgstr "~C~argar"
+
+#: engines/dialogs.cpp:90
+msgid "~S~ave"
+msgstr "~G~ardar"
+
+#: engines/dialogs.cpp:94
+msgid "~O~ptions"
+msgstr "~O~pcións"
+
+#: engines/dialogs.cpp:99
+msgid "~H~elp"
+msgstr "~A~xuda"
+
+#: engines/dialogs.cpp:101
+msgid "~A~bout"
+msgstr "Acerca ~d~e"
+
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
+msgid "~R~eturn to Launcher"
+msgstr "~V~olver ao Iniciador"
+
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
+msgctxt "lowres"
+msgid "~R~eturn to Launcher"
+msgstr "~V~olver ao Iniciador"
+
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
+msgid "Save game:"
+msgstr "Gardar partida:"
+
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
+#: backends/platform/symbian/src/SymbianActions.cpp:44
+#: backends/platform/wince/CEActionsPocket.cpp:43
+#: backends/platform/wince/CEActionsPocket.cpp:267
+#: backends/platform/wince/CEActionsSmartphone.cpp:45
+#: backends/platform/wince/CEActionsSmartphone.cpp:231
+msgid "Save"
+msgstr "Gardar"
+
+#: engines/dialogs.cpp:144
+msgid ""
+"Sorry, this engine does not currently provide in-game help. Please consult "
+"the README for basic information, and for instructions on how to obtain "
+"further assistance."
+msgstr ""
+"Este motor non ofrece axuda no xogo actualmente. Consulta o ficheiro README "
+"para obter información básica e máis instrucións para acadar asistencia "
+"adicional."
+
+#: engines/dialogs.cpp:228
+#, c-format
+msgid ""
+"Gamestate save failed (%s)! Please consult the README for basic information, "
+"and for instructions on how to obtain further assistance."
+msgstr ""
+"Erro ao gardar (%s)! Consulta o ficheiro README para obter información "
+"básica e máis instrucións para acadar asistencia adicional."
+
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
+#: engines/mohawk/dialogs.cpp:174
+msgid "~O~K"
+msgstr "~A~ceptar"
+
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
+#: engines/mohawk/dialogs.cpp:175
+msgid "~C~ancel"
+msgstr "~C~ancelar"
+
+#: engines/dialogs.cpp:305
+msgid "~K~eys"
+msgstr "~T~eclas"
+
+#: engines/engine.cpp:235
+msgid "Could not initialize color format."
+msgstr "Non se puido iniciar o formato de cor."
+
+#: engines/engine.cpp:243
+msgid "Could not switch to video mode: '"
+msgstr "Non se puido cambiar ao modo de vídeo: '"
+
+#: engines/engine.cpp:252
+msgid "Could not apply aspect ratio setting."
+msgstr "Non se puido aplicar a configuración de proporción."
+
+#: engines/engine.cpp:257
+msgid "Could not apply fullscreen setting."
+msgstr "Non se puido aplicar a configuración de pantalla completa."
+
+#: engines/engine.cpp:357
+msgid ""
+"You appear to be playing this game directly\n"
+"from the CD. This is known to cause problems,\n"
+"and it is therefore recommended that you copy\n"
+"the data files to your hard disk instead.\n"
+"See the README file for details."
+msgstr ""
+"Semella que estás a xogar directamente\n"
+"dende o CD. Temos constancia de que causa,\n"
+"problemas. Por iso, recomendámosche copiar\n"
+"os ficheiros de datos ao disco duro. Consulta\n"
+"o ficheiro README para obter máis información."
+
+#: 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"
+"an appropriate CD audio extracting tool in\n"
+"order to listen to the game's music.\n"
+"See the README file for details."
+msgstr ""
+"O xogo ten pistas de son no disco. Debes\n"
+"extraelas por medio dunha ferramenta\n"
+"axeitada para poder escoitar a música\n"
+"do xogo. Consulta o ficheiro README\n"
+"para obter máis información."
+
+#: engines/engine.cpp:426
+#, c-format
+msgid ""
+"Gamestate load failed (%s)! Please consult the README for basic information, "
+"and for instructions on how to obtain further assistance."
+msgstr ""
+"Erro ao cargar (%s)! Consulta o ficheiro README para obter información "
+"básica e máis instrucións para acadar asistencia adicional."
+
+#: engines/engine.cpp:439
+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 ""
+"Ollo: o xogo que vas iniciar non é aínda totalmente compatible con ScummVM. "
+"Por iso, talvez sexa inestable e os ficheiros de gardado talvez non "
+"funcionen en futuras versións de ScummVM."
+
+#: engines/engine.cpp:442
+msgid "Start anyway"
+msgstr "Iniciar de todos os xeitos"
+
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Empregar pantallas orixinais de gardado e carga"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"Empregar as pantallas orixinais de gardado e carga, no canto das de ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Restaurar xogo:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Restaurar"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Empregar modo de paleta intensa"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Mostrar os gráficos coa paletta intensa do xogo"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Non interpolación EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Activar a non interpolación nos xogos en EGA"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Preferir efectos de son dixitais"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Dar preferencia aos efectos de son dixitais no canto dos sintéticos"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Empregar IMF/Yamaha FB-01 para a saída de MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Empregar unha tarxeta IBM Music Feature ou un módulo de sintetizador Yamaha "
+"FB-01 FM para a saída de MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Empregar son de CD"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Empregar son de CD no canto do do xogo, de ser o caso"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Empregar cursores de Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Empregar os cursores de Windows (máis pequenos e monocromos) no canto dos de "
+"DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Empregar cursores prateados"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Empregar o xogo de cursores prateados alternativo, no canto dos dourados "
+"normais"
+
+#: engines/scumm/dialogs.cpp:175
+#, c-format
+msgid "Insert Disk %c and Press Button to Continue."
+msgstr "Insire o disco %c e preme o botón para continuar."
+
+#: engines/scumm/dialogs.cpp:176
+#, c-format
+msgid "Unable to Find %s, (%c%d) Press Button."
+msgstr "Non se puido atopar %s, (%c%d). Preme o botón."
+
+#: engines/scumm/dialogs.cpp:177
+#, c-format
+msgid "Error reading disk %c, (%c%d) Press Button."
+msgstr "Erro ao ler o disco %c, (%c%d). Preme o botón."
+
+#: engines/scumm/dialogs.cpp:178
+msgid "Game Paused. Press SPACE to Continue."
+msgstr "Xogo en pausa. Pulsa a barra espazadora para continuar."
+
+#. I18N: You may specify 'Yes' symbol at the end of the line, like this:
+#. "Moechten Sie wirklich neu starten? (J/N)J"
+#. Will react to J as 'Yes'
+#: engines/scumm/dialogs.cpp:182
+msgid "Are you sure you want to restart? (Y/N)"
+msgstr "Seguro que queres reiniciar? (S/N)S"
+
+#. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
+#: engines/scumm/dialogs.cpp:184
+msgid "Are you sure you want to quit? (Y/N)"
+msgstr "Seguro que queres saír? (S/N)S"
+
+#: engines/scumm/dialogs.cpp:189
+msgid "Play"
+msgstr "Xogar"
+
+#: engines/scumm/dialogs.cpp:191 engines/scumm/help.cpp:82
+#: engines/scumm/help.cpp:84
+#: backends/platform/symbian/src/SymbianActions.cpp:52
+#: backends/platform/wince/CEActionsPocket.cpp:44
+#: backends/platform/wince/CEActionsSmartphone.cpp:52
+#: backends/events/default/default-events.cpp:213
+msgid "Quit"
+msgstr "Saír"
+
+#: engines/scumm/dialogs.cpp:193
+msgid "Insert save/load game disk"
+msgstr "Inserir disco de gardado/carga"
+
+#: engines/scumm/dialogs.cpp:194
+msgid "You must enter a name"
+msgstr "Debes introducir un nome"
+
+#: engines/scumm/dialogs.cpp:195
+msgid "The game was NOT saved (disk full?)"
+msgstr "Non se puido gardar a partida (disco cheo?)"
+
+#: engines/scumm/dialogs.cpp:196
+msgid "The game was NOT loaded"
+msgstr "Non se puido cargar a partida"
+
+#: engines/scumm/dialogs.cpp:197
+#, c-format
+msgid "Saving '%s'"
+msgstr "Gardando %s"
+
+#: engines/scumm/dialogs.cpp:198
+#, c-format
+msgid "Loading '%s'"
+msgstr "Cargando %s"
+
+#: engines/scumm/dialogs.cpp:199
+msgid "Name your SAVE game"
+msgstr "Introduce un nome para a partida gardada"
+
+#: engines/scumm/dialogs.cpp:200
+msgid "Select a game to LOAD"
+msgstr "Selecciona unha partida para cargala"
+
+#: engines/scumm/dialogs.cpp:201
+msgid "Game title)"
+msgstr "Título)"
+
+#. I18N: Previous page button
+#: engines/scumm/dialogs.cpp:287
+msgid "~P~revious"
+msgstr "~A~nterior"
+
+#. I18N: Next page button
+#: engines/scumm/dialogs.cpp:289
+msgid "~N~ext"
+msgstr "~S~eguinte"
+
+#: engines/scumm/dialogs.cpp:290
+#: backends/platform/ds/arm9/source/dsoptions.cpp:56
+msgid "~C~lose"
+msgstr "~P~echar"
+
+#: engines/scumm/dialogs.cpp:597
+msgid "Speech Only"
+msgstr "Só voz"
+
+#: engines/scumm/dialogs.cpp:598
+msgid "Speech and Subtitles"
+msgstr "Voz e subtítulos"
+
+#: engines/scumm/dialogs.cpp:599
+msgid "Subtitles Only"
+msgstr "Só subtítulos"
+
+#: engines/scumm/dialogs.cpp:607
+msgctxt "lowres"
+msgid "Speech & Subs"
+msgstr "Voz e subs"
+
+#: engines/scumm/dialogs.cpp:653
+msgid "Select a Proficiency Level."
+msgstr "Selecciona un nivel de habilidade."
+
+#: engines/scumm/dialogs.cpp:655
+msgid "Refer to your Loom(TM) manual for help."
+msgstr "Consulta o manual de Loom(TM) para obter axuda."
+
+#: engines/scumm/dialogs.cpp:658
+msgid "Standard"
+msgstr "Estándar"
+
+#: engines/scumm/dialogs.cpp:659
+msgid "Practice"
+msgstr "Práctica"
+
+#: engines/scumm/dialogs.cpp:660
+msgid "Expert"
+msgstr "Experto"
+
+#: engines/scumm/help.cpp:73
+msgid "Common keyboard commands:"
+msgstr "Comandos de teclado comúns:"
+
+#: engines/scumm/help.cpp:74
+msgid "Save / Load dialog"
+msgstr "Gardar/cargar diálogo"
+
+#: engines/scumm/help.cpp:76
+msgid "Skip line of text"
+msgstr "Omitir liña de texto"
+
+#: engines/scumm/help.cpp:77
+msgid "Esc"
+msgstr "ESC"
+
+#: engines/scumm/help.cpp:77
+msgid "Skip cutscene"
+msgstr "Omitir secuencia"
+
+#: engines/scumm/help.cpp:78
+msgid "Space"
+msgstr "Barra espazadora"
+
+#: engines/scumm/help.cpp:78
+msgid "Pause game"
+msgstr "Pausar xogo"
+
+#: engines/scumm/help.cpp:79 engines/scumm/help.cpp:84
+#: engines/scumm/help.cpp:95 engines/scumm/help.cpp:96
+#: engines/scumm/help.cpp:97 engines/scumm/help.cpp:98
+#: engines/scumm/help.cpp:99 engines/scumm/help.cpp:100
+#: engines/scumm/help.cpp:101 engines/scumm/help.cpp:102
+msgid "Ctrl"
+msgstr "CTRL"
+
+#: engines/scumm/help.cpp:79
+msgid "Load game state 1-10"
+msgstr "Cargar partida 1-10"
+
+#: engines/scumm/help.cpp:80 engines/scumm/help.cpp:84
+#: engines/scumm/help.cpp:86 engines/scumm/help.cpp:100
+#: engines/scumm/help.cpp:101 engines/scumm/help.cpp:102
+msgid "Alt"
+msgstr "ALT"
+
+#: engines/scumm/help.cpp:80
+msgid "Save game state 1-10"
+msgstr "Gardar partida 1-10"
+
+#: engines/scumm/help.cpp:86 engines/scumm/help.cpp:89
+msgid "Enter"
+msgstr "INTRO"
+
+#: engines/scumm/help.cpp:86
+msgid "Toggle fullscreen"
+msgstr "Activar/desactivar pantalla completa"
+
+#: engines/scumm/help.cpp:87
+msgid "Music volume up / down"
+msgstr "Subir/baixar volume de música"
+
+#: engines/scumm/help.cpp:88
+msgid "Text speed slower / faster"
+msgstr "Acelerar/frear texto"
+
+#: engines/scumm/help.cpp:89
+msgid "Simulate left mouse button"
+msgstr "Simular botón primario do rato"
+
+#: engines/scumm/help.cpp:90
+msgid "Tab"
+msgstr "TAB"
+
+#: engines/scumm/help.cpp:90
+msgid "Simulate right mouse button"
+msgstr "Simular botón secundario do rato"
+
+#: engines/scumm/help.cpp:93
+msgid "Special keyboard commands:"
+msgstr "Comandos de teclado especiais:"
+
+#: engines/scumm/help.cpp:94
+msgid "Show / Hide console"
+msgstr "Mostrar/ocultar consola"
+
+#: engines/scumm/help.cpp:95
+msgid "Start the debugger"
+msgstr "Iniciar o depurador"
+
+#: engines/scumm/help.cpp:96
+msgid "Show memory consumption"
+msgstr "Mostrar consumo de memoria"
+
+#: engines/scumm/help.cpp:97
+msgid "Run in fast mode (*)"
+msgstr "Executar en modo rápido (*)"
+
+#: engines/scumm/help.cpp:98
+msgid "Run in really fast mode (*)"
+msgstr "Executar en modo moi rápido (*)"
+
+#: engines/scumm/help.cpp:99
+msgid "Toggle mouse capture"
+msgstr "Activar/desactivar captura de rato"
+
+#: engines/scumm/help.cpp:100
+msgid "Switch between graphics filters"
+msgstr "Cambiar filtro de gráficos"
+
+#: engines/scumm/help.cpp:101
+msgid "Increase / Decrease scale factor"
+msgstr "Aumentar/reducir factor de escala"
+
+#: engines/scumm/help.cpp:102
+msgid "Toggle aspect-ratio correction"
+msgstr "Activar/desactivar corrección de proporción"
+
+#: engines/scumm/help.cpp:107
+msgid "* Note that using ctrl-f and"
+msgstr "* Nota: non recomendamos"
+
+#: engines/scumm/help.cpp:108
+msgid " ctrl-g are not recommended"
+msgstr " empregar CTRL-F nin CTRL-G,"
+
+#: engines/scumm/help.cpp:109
+msgid " since they may cause crashes"
+msgstr " xa que poden provocar bloqueos"
+
+#: engines/scumm/help.cpp:110
+msgid " or incorrect game behavior."
+msgstr " ou outros erros no xogo."
+
+#: engines/scumm/help.cpp:114
+msgid "Spinning drafts on the keyboard:"
+msgstr "Tecer feitizos co teclado:"
+
+#: engines/scumm/help.cpp:116
+msgid "Main game controls:"
+msgstr "Controis principais de xogo:"
+
+#: engines/scumm/help.cpp:121 engines/scumm/help.cpp:136
+#: engines/scumm/help.cpp:161
+msgid "Push"
+msgstr "Empuxar"
+
+#: engines/scumm/help.cpp:122 engines/scumm/help.cpp:137
+#: engines/scumm/help.cpp:162
+msgid "Pull"
+msgstr "Tirar de"
+
+#: engines/scumm/help.cpp:123 engines/scumm/help.cpp:138
+#: engines/scumm/help.cpp:163 engines/scumm/help.cpp:197
+#: engines/scumm/help.cpp:207
+msgid "Give"
+msgstr "Dar"
+
+#: engines/scumm/help.cpp:124 engines/scumm/help.cpp:139
+#: engines/scumm/help.cpp:164 engines/scumm/help.cpp:190
+#: engines/scumm/help.cpp:208
+msgid "Open"
+msgstr "Abrir"
+
+#: engines/scumm/help.cpp:126
+msgid "Go to"
+msgstr "Ir a"
+
+#: engines/scumm/help.cpp:127
+msgid "Get"
+msgstr "Coller"
+
+#: engines/scumm/help.cpp:128 engines/scumm/help.cpp:152
+#: engines/scumm/help.cpp:170 engines/scumm/help.cpp:198
+#: engines/scumm/help.cpp:213 engines/scumm/help.cpp:224
+#: engines/scumm/help.cpp:250
+msgid "Use"
+msgstr "Usar"
+
+#: engines/scumm/help.cpp:129 engines/scumm/help.cpp:141
+msgid "Read"
+msgstr "Ler"
+
+#: engines/scumm/help.cpp:130 engines/scumm/help.cpp:147
+msgid "New kid"
+msgstr "Rapaz"
+
+#: engines/scumm/help.cpp:131 engines/scumm/help.cpp:153
+#: engines/scumm/help.cpp:171
+msgid "Turn on"
+msgstr "Acender"
+
+#: engines/scumm/help.cpp:132 engines/scumm/help.cpp:154
+#: engines/scumm/help.cpp:172
+msgid "Turn off"
+msgstr "Apagar"
+
+#: engines/scumm/help.cpp:142 engines/scumm/help.cpp:167
+#: engines/scumm/help.cpp:194
+msgid "Walk to"
+msgstr "Ir a"
+
+#: engines/scumm/help.cpp:143 engines/scumm/help.cpp:168
+#: engines/scumm/help.cpp:195 engines/scumm/help.cpp:210
+#: engines/scumm/help.cpp:227
+msgid "Pick up"
+msgstr "Coller"
+
+#: engines/scumm/help.cpp:144 engines/scumm/help.cpp:169
+msgid "What is"
+msgstr "Que é"
+
+#: engines/scumm/help.cpp:146
+msgid "Unlock"
+msgstr "Despechar"
+
+#: engines/scumm/help.cpp:149
+msgid "Put on"
+msgstr "Poñer"
+
+#: engines/scumm/help.cpp:150
+msgid "Take off"
+msgstr "Quitar"
+
+#: engines/scumm/help.cpp:156
+msgid "Fix"
+msgstr "Reparar"
+
+#: engines/scumm/help.cpp:158
+msgid "Switch"
+msgstr "Cambiar"
+
+#: engines/scumm/help.cpp:166 engines/scumm/help.cpp:228
+msgid "Look"
+msgstr "Mirar"
+
+#: engines/scumm/help.cpp:173 engines/scumm/help.cpp:223
+msgid "Talk"
+msgstr "Falar"
+
+#: engines/scumm/help.cpp:174
+msgid "Travel"
+msgstr "Viaxar"
+
+#: engines/scumm/help.cpp:175
+msgid "To Henry / To Indy"
+msgstr "A Henry / A Indy"
+
+#. I18N: These are different musical notes
+#: engines/scumm/help.cpp:179
+msgid "play C minor on distaff"
+msgstr "tocar do menor no bastón"
+
+#: engines/scumm/help.cpp:180
+msgid "play D on distaff"
+msgstr "tocar re no bastón"
+
+#: engines/scumm/help.cpp:181
+msgid "play E on distaff"
+msgstr "tocar mi no bastón"
+
+#: engines/scumm/help.cpp:182
+msgid "play F on distaff"
+msgstr "tocar fa no bastón"
+
+#: engines/scumm/help.cpp:183
+msgid "play G on distaff"
+msgstr "tocar sol no bastón"
+
+#: engines/scumm/help.cpp:184
+msgid "play A on distaff"
+msgstr "tocar la no bastón"
+
+#: engines/scumm/help.cpp:185
+msgid "play B on distaff"
+msgstr "tocar si no bastón"
+
+#: engines/scumm/help.cpp:186
+msgid "play C major on distaff"
+msgstr "tocar do maior no bastón"
+
+#: engines/scumm/help.cpp:192 engines/scumm/help.cpp:214
+msgid "puSh"
+msgstr "Empurrar"
+
+#: engines/scumm/help.cpp:193 engines/scumm/help.cpp:215
+msgid "pull (Yank)"
+msgstr "Tirar de"
+
+#: engines/scumm/help.cpp:196 engines/scumm/help.cpp:212
+#: engines/scumm/help.cpp:248
+msgid "Talk to"
+msgstr "Falar con"
+
+#: engines/scumm/help.cpp:199 engines/scumm/help.cpp:211
+msgid "Look at"
+msgstr "Mirar"
+
+#: engines/scumm/help.cpp:200
+msgid "turn oN"
+msgstr "Acender"
+
+#: engines/scumm/help.cpp:201
+msgid "turn oFf"
+msgstr "Apagar"
+
+#: engines/scumm/help.cpp:217
+msgid "KeyUp"
+msgstr "Arriba"
+
+#: engines/scumm/help.cpp:217
+msgid "Highlight prev dialogue"
+msgstr "Destacar diálogo anterior"
+
+#: engines/scumm/help.cpp:218
+msgid "KeyDown"
+msgstr "Abaixo"
+
+#: engines/scumm/help.cpp:218
+msgid "Highlight next dialogue"
+msgstr "Destacar diálogo seguinte"
+
+#: engines/scumm/help.cpp:222
+msgid "Walk"
+msgstr "Ir a"
+
+#: engines/scumm/help.cpp:225 engines/scumm/help.cpp:234
+#: engines/scumm/help.cpp:241 engines/scumm/help.cpp:249
+msgid "Inventory"
+msgstr "Inventario"
+
+#: engines/scumm/help.cpp:226
+msgid "Object"
+msgstr "Obxecto"
+
+#: engines/scumm/help.cpp:229
+msgid "Black and White / Color"
+msgstr "Branco e negro/cor"
+
+#: engines/scumm/help.cpp:232
+msgid "Eyes"
+msgstr "Ollos"
+
+#: engines/scumm/help.cpp:233
+msgid "Tongue"
+msgstr "Lingua"
+
+#: engines/scumm/help.cpp:235
+msgid "Punch"
+msgstr "Bater a"
+
+#: engines/scumm/help.cpp:236
+msgid "Kick"
+msgstr "Patear a"
+
+#: engines/scumm/help.cpp:239 engines/scumm/help.cpp:247
+msgid "Examine"
+msgstr "Examinar"
+
+#: engines/scumm/help.cpp:240
+msgid "Regular cursor"
+msgstr "Cursor normal"
+
+#. I18N: Comm is a communication device
+#: engines/scumm/help.cpp:243
+msgid "Comm"
+msgstr "Comunicador"
+
+#: engines/scumm/help.cpp:246
+msgid "Save / Load / Options"
+msgstr "Gardar/cargar/opcións"
+
+#: engines/scumm/help.cpp:255
+msgid "Other game controls:"
+msgstr "Outros controis de xogo:"
+
+#: engines/scumm/help.cpp:257 engines/scumm/help.cpp:267
+msgid "Inventory:"
+msgstr "Inventario:"
+
+#: engines/scumm/help.cpp:258 engines/scumm/help.cpp:274
+msgid "Scroll list up"
+msgstr "Subir lista"
+
+#: engines/scumm/help.cpp:259 engines/scumm/help.cpp:275
+msgid "Scroll list down"
+msgstr "Baixar lista"
+
+#: engines/scumm/help.cpp:260 engines/scumm/help.cpp:268
+msgid "Upper left item"
+msgstr "Obxecto esquerdo arriba"
+
+#: engines/scumm/help.cpp:261 engines/scumm/help.cpp:270
+msgid "Lower left item"
+msgstr "Obxecto esquerdo abaixo"
+
+#: engines/scumm/help.cpp:262 engines/scumm/help.cpp:271
+msgid "Upper right item"
+msgstr "Obxecto dereito arriba"
+
+#: engines/scumm/help.cpp:263 engines/scumm/help.cpp:273
+msgid "Lower right item"
+msgstr "Obxecto dereito abaixo"
+
+#: engines/scumm/help.cpp:269
+msgid "Middle left item"
+msgstr "Obxecto esquerdo medio"
+
+#: engines/scumm/help.cpp:272
+msgid "Middle right item"
+msgstr "Obxecto dereito medio"
+
+#: engines/scumm/help.cpp:279 engines/scumm/help.cpp:284
+msgid "Switching characters:"
+msgstr "Cambiar caracteres:"
+
+#: engines/scumm/help.cpp:281
+msgid "Second kid"
+msgstr "Rapaz 2"
+
+#: engines/scumm/help.cpp:282
+msgid "Third kid"
+msgstr "Rapaz 3"
+
+#: engines/scumm/help.cpp:294
+msgid "Fighting controls (numpad):"
+msgstr "Controis de combate (teclado numérico):"
+
+#: engines/scumm/help.cpp:295 engines/scumm/help.cpp:296
+#: engines/scumm/help.cpp:297
+msgid "Step back"
+msgstr "Paso atrás"
+
+#: engines/scumm/help.cpp:298
+msgid "Block high"
+msgstr "Bloqueo alto"
+
+#: engines/scumm/help.cpp:299
+msgid "Block middle"
+msgstr "Bloqueo medio"
+
+#: engines/scumm/help.cpp:300
+msgid "Block low"
+msgstr "Bloqueo baixo"
+
+#: engines/scumm/help.cpp:301
+msgid "Punch high"
+msgstr "Puñazo alto"
+
+#: engines/scumm/help.cpp:302
+msgid "Punch middle"
+msgstr "Puñazo medio"
+
+#: engines/scumm/help.cpp:303
+msgid "Punch low"
+msgstr "Puñazo baixo"
+
+#: engines/scumm/help.cpp:306
+msgid "These are for Indy on left."
+msgstr "Son para Indy na esquerda."
+
+#: engines/scumm/help.cpp:307
+msgid "When Indy is on the right,"
+msgstr "Se está na dereita,"
+
+#: engines/scumm/help.cpp:308
+msgid "7, 4, and 1 are switched with"
+msgstr "7, 4 e 1 cámbianse por"
+
+#: engines/scumm/help.cpp:309
+msgid "9, 6, and 3, respectively."
+msgstr "9, 6 e 3 respectivamente."
+
+#: engines/scumm/help.cpp:316
+msgid "Biplane controls (numpad):"
+msgstr "Controis de biplano (teclado numérico):"
+
+#: engines/scumm/help.cpp:317
+msgid "Fly to upper left"
+msgstr "Voar á esquerda arriba"
+
+#: engines/scumm/help.cpp:318
+msgid "Fly to left"
+msgstr "Voar á esquerda"
+
+#: engines/scumm/help.cpp:319
+msgid "Fly to lower left"
+msgstr "Voar á esquerda abaixo"
+
+#: engines/scumm/help.cpp:320
+msgid "Fly upwards"
+msgstr "Voar arriba"
+
+#: engines/scumm/help.cpp:321
+msgid "Fly straight"
+msgstr "Voar recto"
+
+#: engines/scumm/help.cpp:322
+msgid "Fly down"
+msgstr "Voar abaixo"
+
+#: engines/scumm/help.cpp:323
+msgid "Fly to upper right"
+msgstr "Voar á dereita arriba"
+
+#: engines/scumm/help.cpp:324
+msgid "Fly to right"
+msgstr "Voar á dereita"
+
+#: engines/scumm/help.cpp:325
+msgid "Fly to lower right"
+msgstr "Voar á dereita abaixo"
+
+#: 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 ""
+"A compatibilidade nativa con MIDI precisa a actualización de Roland\n"
+"de LucasArts, mais falla %s. Empregarase AdLib."
+
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
+#, c-format
+msgid ""
+"Failed to save game state to file:\n"
+"\n"
+"%s"
+msgstr ""
+"Erro ao gardar a partida no ficheiro:\n"
+"\n"
+"%s"
+
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
+#, c-format
+msgid ""
+"Failed to load game state from file:\n"
+"\n"
+"%s"
+msgstr ""
+"Erro ao cargar a partida do ficheiro:\n"
+"\n"
+"%s"
+
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
+#, c-format
+msgid ""
+"Successfully saved game state in file:\n"
+"\n"
+"%s"
+msgstr ""
+"Partida gardada con éxito no ficheiro:\n"
+"\n"
+"%s"
+
+#: engines/scumm/scumm.cpp:2512
+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' "
+"directory inside the Tentacle game directory."
+msgstr ""
+"Maniac Mansion tería que empezar agora. Porén, ScummVM aínda non é quen de "
+"facelo. Para xogar, vai a Engadir xogo no menú de inicio de ScummVM e "
+"selecciona o directorio Maniac que está dentro do directorio Tentacle."
+
+#. I18N: Option for fast scene switching
+#: engines/mohawk/dialogs.cpp:92 engines/mohawk/dialogs.cpp:171
+msgid "~Z~ip Mode Activated"
+msgstr "Modo ~c~omprimido activado"
+
+#: engines/mohawk/dialogs.cpp:93
+msgid "~T~ransitions Enabled"
+msgstr "~T~ransicións activadas"
+
+#. I18N: Drop book page
+#: engines/mohawk/dialogs.cpp:95
+msgid "~D~rop Page"
+msgstr "~D~eixar folla"
+
+#: engines/mohawk/dialogs.cpp:99
+msgid "~S~how Map"
+msgstr "Mo~s~trar mapa"
+
+#: engines/mohawk/dialogs.cpp:105
+msgid "~M~ain Menu"
+msgstr "~M~enú principal"
+
+#: engines/mohawk/dialogs.cpp:172
+msgid "~W~ater Effect Enabled"
+msgstr "Efecto de ~a~uga activado"
+
+#: engines/agos/animation.cpp:560
+#, c-format
+msgid "Cutscene file '%s' not found!"
+msgstr "Non se atopou o ficheiro de secuencia %s!"
+
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
+msgid "Failed to load game state from file."
+msgstr "Erro ao cargar a partida do ficheiro."
+
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
+msgid "Failed to save game state to file."
+msgstr "Erro ao gardar a partida no ficheiro."
+
+#: engines/gob/inter_v5.cpp:107
+msgid "Failed to delete file."
+msgstr "Erro ao eliminar o ficheiro."
+
+#: engines/groovie/script.cpp:420
+msgid "Failed to save game"
+msgstr "Erro ao gardar a partida"
+
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Público do estudio"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Activar o público do estudio"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Omisións"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Permitir a omisión do texto e das secuencias"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Modo helio"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Activar o modo helio"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Desprazamento suave"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Activar o desprazamento suave ao camiñar"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Cursores flotantes"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Activar cursores flotantes"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Barras de vida"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Activar barras de vida"
+
+#: engines/kyra/lol.cpp:478
+msgid "Attack 1"
+msgstr "Ataque 1"
+
+#: engines/kyra/lol.cpp:479
+msgid "Attack 2"
+msgstr "Ataque 2"
+
+#: engines/kyra/lol.cpp:480
+msgid "Attack 3"
+msgstr "Ataque 3"
+
+#: engines/kyra/lol.cpp:481
+msgid "Move Forward"
+msgstr "Mover cara diante"
+
+#: engines/kyra/lol.cpp:482
+msgid "Move Back"
+msgstr "Mover cara atrás"
+
+#: engines/kyra/lol.cpp:483
+msgid "Slide Left"
+msgstr "Esvarar á esquerda"
+
+#: engines/kyra/lol.cpp:484
+msgid "Slide Right"
+msgstr "Esvarar á dereita"
+
+#: engines/kyra/lol.cpp:485
+msgid "Turn Left"
+msgstr "Xirar á esquerda"
+
+#: engines/kyra/lol.cpp:486
+msgid "Turn Right"
+msgstr "Xirar á dereita"
+
+#: engines/kyra/lol.cpp:487
+msgid "Rest"
+msgstr "Parar"
+
+#: engines/kyra/lol.cpp:488
+msgid "Options"
+msgstr "Opcións"
+
+#: engines/kyra/lol.cpp:489
+msgid "Choose Spell"
+msgstr "Elixir feitizo"
+
+#: engines/kyra/sound_midi.cpp:475
+msgid ""
+"You appear to be using a General MIDI device,\n"
+"but your game only supports Roland MT32 MIDI.\n"
+"We try to map the Roland MT32 instruments to\n"
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
+msgstr ""
+"Semella que estás a empregar un dispositivo,\n"
+"de General MIDI, maix o xogo só e compatible con\n"
+"Roland MT32 MIDI. Tentamos asignar os instrumentos\n"
+"aos de General MIDI. No entanto, existe a posibilidade\n"
+"de que algunhas pistas non soen correctamente."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr "Intro alternativa"
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Empregar unha introdución alternativa para o xogo (só versión en CD)"
+
+#: engines/sky/compact.cpp:130
+msgid ""
+"Unable to find \"sky.cpt\" file!\n"
+"Please download it from www.scummvm.org"
+msgstr ""
+"O ficheiro sky.cpt non se atopa!\n"
+"Descárgao dende www.scummvm.org"
+
+#: engines/sky/compact.cpp:141
+msgid ""
+"The \"sky.cpt\" file has an incorrect size.\n"
+"Please (re)download it from www.scummvm.org"
+msgstr ""
+"O ficheiro sky.cpt ten un tamaño incorrecto.\n"
+"Descárgao (de novo) dende www.scummvm.org"
+
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Intro de disquete"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Empregar a introdución da versión en disquete (só versión en CD)"
+
+#: engines/sword1/animation.cpp:539
+#, c-format
+msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
+msgstr "Non se pode reproducir a secuencia %s de PSX neste modo gráfico"
+
+#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
+msgid "DXA cutscenes found but ScummVM has been built without zlib support"
+msgstr ""
+"Atopáronse secuencias de DXA. No entanto, esta versión de ScummVM non é "
+"compatible con zlib"
+
+#: engines/sword1/animation.cpp:570 engines/sword2/animation.cpp:465
+msgid "MPEG2 cutscenes are no longer supported"
+msgstr "Xa non hai compatibilidade coas secuencias en MPEG2"
+
+#: engines/sword1/animation.cpp:576 engines/sword2/animation.cpp:473
+#, c-format
+msgid "Cutscene '%s' not found"
+msgstr "Non se atopou a secuencia %s"
+
+#: engines/sword1/control.cpp:863
+msgid ""
+"ScummVM found that you have old savefiles for Broken Sword 1 that should be "
+"converted.\n"
+"The old save game format is no longer supported, so you will not be able to "
+"load your games if you don't convert them.\n"
+"\n"
+"Press OK to convert them now, otherwise you will be asked again the next "
+"time you start the game.\n"
+msgstr ""
+"ScummVM atopou ficheiros de gardado vellos de Broken Sword 1 que deberían "
+"ser convertidos.\n"
+"O formato vello xa non é compatible, de xeito que non poderás cargar as "
+"partidas se non os convertes.\n"
+"\n"
+"Preme Aceptar para convertilos. Se non, volverás ver esta mensaxe a próxima "
+"vez que inicies o xogo.\n"
+
+#: engines/sword1/control.cpp:1232
+#, c-format
+msgid ""
+"Target new save game already exists!\n"
+"Would you like to keep the old save game (%s) or the new one (%s)?\n"
+msgstr ""
+"Xa existe unha partida con ese nome!\n"
+"Queres conservar a vella (%s) ou a nova (%s)?\n"
+
+#: engines/sword1/control.cpp:1235
+msgid "Keep the old one"
+msgstr "Conservar a vella"
+
+#: engines/sword1/control.cpp:1235
+msgid "Keep the new one"
+msgstr "Conservar a nova"
+
+#: engines/sword1/logic.cpp:1633
+msgid "This is the end of the Broken Sword 1 Demo"
+msgstr "Aquí remata a demo de Broken Sword 1"
+
+#: engines/sword2/animation.cpp:435
+msgid ""
+"PSX cutscenes found but ScummVM has been built without RGB color support"
+msgstr ""
+"Atopáronse secuencias de PSX. No entanto, a versión de ScummVM non é "
+"compatible con cores RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Mostrar etiquetas"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Mostrar as etiquetas dos obxectos ao apuntar co rato"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+"Falta o ficheiro teenagent.dat. Descárgao dende o sitio web de ScummVM."
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+"O ficheiro teenagent.dat está comprimido e zlib non foi incluído neste "
+"executable. Descomprime o ficheiro"
+
+#: engines/parallaction/saveload.cpp:133
+#, c-format
+msgid ""
+"Can't save game in slot %i\n"
+"\n"
+msgstr ""
+"Non se pode gardar a partida no espazo %i\n"
+"\n"
+
+#: engines/parallaction/saveload.cpp:204
+msgid "Loading game..."
+msgstr "Cargando..."
+
+#: engines/parallaction/saveload.cpp:219
+msgid "Saving game..."
+msgstr "Gardando..."
+
+#: engines/parallaction/saveload.cpp:272
+msgid ""
+"ScummVM found that you have old savefiles for Nippon Safes that should be "
+"renamed.\n"
+"The old names are no longer supported, so you will not be able to load your "
+"games if you don't convert them.\n"
+"\n"
+"Press OK to convert them now, otherwise you will be asked next time.\n"
+msgstr ""
+"ScummVM atopou ficheiros de gardado vellos de Nippon Safes que deberían ser "
+"renomeados.\n"
+"Os nomes vellos xa non son compatibles, de xeito que non poderás cargar as "
+"partidas se non os cambias.\n"
+"\n"
+"Preme Aceptar para cambialos. Se non, volverás ver esta mensaxe a próxima "
+"vez que inicies o xogo.\n"
+
+#: engines/parallaction/saveload.cpp:319
+msgid "ScummVM successfully converted all your savefiles."
+msgstr "ScummVM converteu correctamente todos os ficheiros de gardado."
+
+#: engines/parallaction/saveload.cpp:321
+msgid ""
+"ScummVM printed some warnings in your console window and can't guarantee all "
+"your files have been converted.\n"
+"\n"
+"Please report to the team."
+msgstr ""
+"ScummVM imprimiu avisos na ventá da consola. Non se pode garantir a "
+"conversión de todos os ficheiros.\n"
+"\n"
+"Contacta co equipo de ScummVM."
+
+#: audio/fmopl.cpp:49
+msgid "MAME OPL emulator"
+msgstr "Emulador de OPL de MAME"
+
+#: audio/fmopl.cpp:51
+msgid "DOSBox OPL emulator"
+msgstr "Emulador de OPL de DOSBox"
+
+#: audio/mididrv.cpp:209
+#, c-format
+msgid ""
+"The selected audio device '%s' was not found (e.g. might be turned off or "
+"disconnected)."
+msgstr ""
+"Non se atopou o dispositivo de son seleccionado (%s). Talvez estea apagado "
+"ou desconectado."
+
+#: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257
+#: audio/mididrv.cpp:272
+msgid "Attempting to fall back to the next available device..."
+msgstr "Intentando pasar ao seguinte dispositivo dispoñible..."
+
+#: audio/mididrv.cpp:221
+#, c-format
+msgid ""
+"The selected audio device '%s' cannot be used. See log file for more "
+"information."
+msgstr ""
+"Non se pode empregar o dispositivo de son seleccionado (%s). Consulta o "
+"rexistro para obter máis información."
+
+#: audio/mididrv.cpp:257
+#, c-format
+msgid ""
+"The preferred audio device '%s' was not found (e.g. might be turned off or "
+"disconnected)."
+msgstr ""
+"Non se atopou o dispositivo de son preferido (%s). Talvez estea apagado ou "
+"desconectado."
+
+#: audio/mididrv.cpp:272
+#, c-format
+msgid ""
+"The preferred audio device '%s' cannot be used. See log file for more "
+"information."
+msgstr ""
+"Non se pode empregar o dispositivo de son preferido (%s). Consulta o "
+"rexistro para obter máis información."
+
+#: audio/null.h:43
+msgid "No music"
+msgstr "Sen música"
+
+#: audio/mods/paula.cpp:189
+msgid "Amiga Audio Emulator"
+msgstr "Emulador de Amiga Audio"
+
+#: audio/softsynth/adlib.cpp:1593
+msgid "AdLib Emulator"
+msgstr "Emulador de AdLib"
+
+#: audio/softsynth/appleiigs.cpp:33
+msgid "Apple II GS Emulator (NOT IMPLEMENTED)"
+msgstr "Emulador de Apple II GS (non implementado)"
+
+#: audio/softsynth/sid.cpp:1430
+msgid "C64 Audio Emulator"
+msgstr "Emulador de C64 Audio"
+
+#: audio/softsynth/mt32.cpp:293
+msgid "Initializing MT-32 Emulator"
+msgstr "Iniciando emulador de MT-32"
+
+#: audio/softsynth/mt32.cpp:512
+msgid "MT-32 Emulator"
+msgstr "Emulador de MT-32"
+
+#: audio/softsynth/pcspk.cpp:139
+msgid "PC Speaker Emulator"
+msgstr "Emulador de altofalante de PC"
+
+#: audio/softsynth/pcspk.cpp:158
+msgid "IBM PCjr Emulator"
+msgstr "Emulador de IBM PCjr"
+
+#: backends/keymapper/remap-dialog.cpp:47
+msgid "Keymap:"
+msgstr "Asignación de teclas:"
+
+#: backends/keymapper/remap-dialog.cpp:66
+msgid " (Effective)"
+msgstr " (Efectiva)"
+
+#: backends/keymapper/remap-dialog.cpp:106
+msgid " (Active)"
+msgstr " (Activa)"
+
+#: backends/keymapper/remap-dialog.cpp:106
+msgid " (Blocked)"
+msgstr " (Bloqueada)"
+
+#: backends/keymapper/remap-dialog.cpp:119
+msgid " (Global)"
+msgstr " (Global)"
+
+#: backends/keymapper/remap-dialog.cpp:127
+msgid " (Game)"
+msgstr " (Xogo)"
+
+#: backends/midi/windows.cpp:164
+msgid "Windows MIDI"
+msgstr "Windows MIDI"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:57
+msgid "ScummVM Main Menu"
+msgstr "Menú principal de ScummVM"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:63
+msgid "~L~eft handed mode"
+msgstr "Modo para ~z~urdos"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:64
+msgid "~I~ndy fight controls"
+msgstr "Controis de combate de ~I~ndy"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:65
+msgid "Show mouse cursor"
+msgstr "Mostrar cursor do rato"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:66
+msgid "Snap to edges"
+msgstr "Axustar ás marxes"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:68
+msgid "Touch X Offset"
+msgstr "Corrección táctil X"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:75
+msgid "Touch Y Offset"
+msgstr "Corrección táctil Y"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:87
+msgid "Use laptop trackpad-style cursor control"
+msgstr "Empregar control de cursor por trackpad"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:88
+msgid "Tap for left click, double tap right click"
+msgstr "Tocar unha vez, premer co botón primario; dúas veces, botón secundario"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:90
+msgid "Sensitivity"
+msgstr "Sensibilidade"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:99
+msgid "Initial top screen scale:"
+msgstr "Escala da pantalla inicial:"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:105
+msgid "Main screen scaling:"
+msgstr "Escala da pantalla principal:"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:107
+msgid "Hardware scale (fast, but low quality)"
+msgstr "Escala por hardware (rápida, mais baixa calidade)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:108
+msgid "Software scale (good quality, but slower)"
+msgstr "Escala por software (boa calidade, mais lenta)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:109
+msgid "Unscaled (you must scroll left and right)"
+msgstr "Sen escala (deberás desprazar á esquerda e á dereita)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:111
+msgid "Brightness:"
+msgstr "Luminosidade:"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:121
+msgid "High quality audio (slower) (reboot)"
+msgstr "Son de alta calidade (máis lento) (reiniciar)"
+
+#: backends/platform/ds/arm9/source/dsoptions.cpp:122
+msgid "Disable power off"
+msgstr "Desactivar apagado"
+
+#: backends/platform/iphone/osys_events.cpp:300
+msgid "Mouse-click-and-drag mode enabled."
+msgstr "Modo premer e arrastrar activado."
+
+#: backends/platform/iphone/osys_events.cpp:302
+msgid "Mouse-click-and-drag mode disabled."
+msgstr "Modo premer e arrastrar desactivado."
+
+#: backends/platform/iphone/osys_events.cpp:313
+msgid "Touchpad mode enabled."
+msgstr "Modo panel táctil activado."
+
+#: backends/platform/iphone/osys_events.cpp:315
+msgid "Touchpad mode disabled."
+msgstr "Modo panel táctil desactivado."
+
+#: backends/platform/maemo/maemo.cpp:209
+msgid "Click Mode"
+msgstr "Modo rato"
+
+#: backends/platform/maemo/maemo.cpp:215
+#: 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 "Botón primario"
+
+#: backends/platform/maemo/maemo.cpp:218
+msgid "Middle Click"
+msgstr "Botón central"
+
+#: backends/platform/maemo/maemo.cpp:221
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Botón secundario"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
+msgid "Hide ScummVM"
+msgstr "Ocultar ScummVM"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
+msgid "Hide Others"
+msgstr "Ocultar outros"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
+msgid "Show All"
+msgstr "Mostrar todo"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
+msgid "Window"
+msgstr "Ventá"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
+msgid "Minimize"
+msgstr "Minimizar"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
+msgid "Normal (no scaling)"
+msgstr "Normal (sen escala)"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:64
+msgctxt "lowres"
+msgid "Normal (no scaling)"
+msgstr "Normal (sen escala)"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
+msgid "Enabled aspect ratio correction"
+msgstr "Corrección de proporción activada"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
+msgid "Disabled aspect ratio correction"
+msgstr "Corrección de proporción desactivada"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
+msgid "Active graphics filter:"
+msgstr "Filtro de gráficos activo:"
+
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
+msgid "Windowed mode"
+msgstr "Modo en ventá"
+
+#: backends/graphics/opengl/opengl-graphics.cpp:135
+msgid "OpenGL Normal"
+msgstr "OpenGL Normal"
+
+#: backends/graphics/opengl/opengl-graphics.cpp:136
+msgid "OpenGL Conserve"
+msgstr "OpenGL Conserve"
+
+#: backends/graphics/opengl/opengl-graphics.cpp:137
+msgid "OpenGL Original"
+msgstr "OpenGL Original"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:415
+msgid "Current display mode"
+msgstr "Modo de visualización actual"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:428
+msgid "Current scale"
+msgstr "Escala actual"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
+msgid "Active filter mode: Linear"
+msgstr "Modo de filtro activo: lineal"
+
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
+msgid "Active filter mode: Nearest"
+msgstr "Modo de filtro activo: máis próximo"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:38
+#: backends/platform/wince/CEActionsSmartphone.cpp:39
+msgid "Up"
+msgstr "Arriba"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:39
+#: backends/platform/wince/CEActionsSmartphone.cpp:40
+msgid "Down"
+msgstr "Abaixo"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:40
+#: backends/platform/wince/CEActionsSmartphone.cpp:41
+msgid "Left"
+msgstr "Esquerda"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:41
+#: backends/platform/wince/CEActionsSmartphone.cpp:42
+msgid "Right"
+msgstr "Dereita"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:46
+#: backends/platform/wince/CEActionsSmartphone.cpp:47
+msgid "Zone"
+msgstr "Zona"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:47
+#: backends/platform/wince/CEActionsPocket.cpp:54
+#: backends/platform/wince/CEActionsSmartphone.cpp:48
+msgid "Multi Function"
+msgstr "Multifunción"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:48
+msgid "Swap character"
+msgstr "Cambiar carácter"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:49
+msgid "Skip text"
+msgstr "Omitir texto"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:51
+msgid "Fast mode"
+msgstr "Modo rápido"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:53
+msgid "Debugger"
+msgstr "Depurador"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:54
+msgid "Global menu"
+msgstr "Menú global"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:55
+msgid "Virtual keyboard"
+msgstr "Teclado virtual"
+
+#: backends/platform/symbian/src/SymbianActions.cpp:56
+msgid "Key mapper"
+msgstr "Asignador de teclas"
+
+#: backends/events/symbiansdl/symbiansdl-events.cpp:184
+msgid "Do you want to quit ?"
+msgstr "Queres saír?"
+
+#: backends/platform/wii/options.cpp:51
+msgid "Video"
+msgstr "Vídeo"
+
+#: backends/platform/wii/options.cpp:54
+msgid "Current video mode:"
+msgstr "Modo de vídeo actual:"
+
+#: backends/platform/wii/options.cpp:56
+msgid "Double-strike"
+msgstr "Dobre"
+
+#: backends/platform/wii/options.cpp:60
+msgid "Horizontal underscan:"
+msgstr "Marxe horizontal:"
+
+#: backends/platform/wii/options.cpp:66
+msgid "Vertical underscan:"
+msgstr "Marxe vertical:"
+
+#: backends/platform/wii/options.cpp:71
+msgid "Input"
+msgstr "Entrada"
+
+#: backends/platform/wii/options.cpp:74
+msgid "GC Pad sensitivity:"
+msgstr "Sensibilidade do mando de GC:"
+
+#: backends/platform/wii/options.cpp:80
+msgid "GC Pad acceleration:"
+msgstr "Aceleración do mando de GC:"
+
+#: backends/platform/wii/options.cpp:86
+msgid "DVD"
+msgstr "DVD"
+
+#: backends/platform/wii/options.cpp:89 backends/platform/wii/options.cpp:101
+msgid "Status:"
+msgstr "Estado:"
+
+#: backends/platform/wii/options.cpp:90 backends/platform/wii/options.cpp:102
+msgid "Unknown"
+msgstr "Descoñecido"
+
+#: backends/platform/wii/options.cpp:93
+msgid "Mount DVD"
+msgstr "Montar DVD"
+
+#: backends/platform/wii/options.cpp:94
+msgid "Unmount DVD"
+msgstr "Desmontar DVD"
+
+#: backends/platform/wii/options.cpp:98
+msgid "SMB"
+msgstr "SMB"
+
+#: backends/platform/wii/options.cpp:106
+msgid "Server:"
+msgstr "Servidor:"
+
+#: backends/platform/wii/options.cpp:110
+msgid "Share:"
+msgstr "Disco compartido:"
+
+#: backends/platform/wii/options.cpp:114
+msgid "Username:"
+msgstr "Nome de usuario:"
+
+#: backends/platform/wii/options.cpp:118
+msgid "Password:"
+msgstr "Contrasinal:"
+
+#: backends/platform/wii/options.cpp:121
+msgid "Init network"
+msgstr "Conectar á rede"
+
+#: backends/platform/wii/options.cpp:123
+msgid "Mount SMB"
+msgstr "Montar SMB"
+
+#: backends/platform/wii/options.cpp:124
+msgid "Unmount SMB"
+msgstr "Desmontar SMB"
+
+#: backends/platform/wii/options.cpp:143
+msgid "DVD Mounted successfully"
+msgstr "DVD montado con éxito"
+
+#: backends/platform/wii/options.cpp:146
+msgid "Error while mounting the DVD"
+msgstr "Erro ao montar o DVD"
+
+#: backends/platform/wii/options.cpp:148
+msgid "DVD not mounted"
+msgstr "DVD non montado"
+
+#: backends/platform/wii/options.cpp:161
+msgid "Network up, share mounted"
+msgstr "Conexión á rede, disco montado"
+
+#: backends/platform/wii/options.cpp:163
+msgid "Network up"
+msgstr "Conexión á rede"
+
+#: backends/platform/wii/options.cpp:166
+msgid ", error while mounting the share"
+msgstr ", erro ao montar o disco"
+
+#: backends/platform/wii/options.cpp:168
+msgid ", share not mounted"
+msgstr ", disco non montado"
+
+#: backends/platform/wii/options.cpp:174
+msgid "Network down"
+msgstr "Non hai conexión á rede"
+
+#: backends/platform/wii/options.cpp:178
+msgid "Initializing network"
+msgstr "Conectando á rede"
+
+#: backends/platform/wii/options.cpp:182
+msgid "Timeout while initializing network"
+msgstr "Tempo de espera esgotado"
+
+#: backends/platform/wii/options.cpp:186
+#, c-format
+msgid "Network not initialized (%d)"
+msgstr "Erro de conexión á rede (%d)"
+
+#: backends/platform/wince/CEActionsPocket.cpp:46
+msgid "Hide Toolbar"
+msgstr "Ocultar barra de ferramentas"
+
+#: backends/platform/wince/CEActionsPocket.cpp:47
+msgid "Show Keyboard"
+msgstr "Mostrar teclado"
+
+#: backends/platform/wince/CEActionsPocket.cpp:48
+msgid "Sound on/off"
+msgstr "Son si/non"
+
+#: backends/platform/wince/CEActionsPocket.cpp:49
+msgid "Right click"
+msgstr "Botón secundario"
+
+#: backends/platform/wince/CEActionsPocket.cpp:50
+msgid "Show/Hide Cursor"
+msgstr "Mostrar/ocultar cursor"
+
+#: backends/platform/wince/CEActionsPocket.cpp:51
+msgid "Free look"
+msgstr "Vista libre"
+
+#: backends/platform/wince/CEActionsPocket.cpp:52
+msgid "Zoom up"
+msgstr "Ampliar"
+
+#: backends/platform/wince/CEActionsPocket.cpp:53
+msgid "Zoom down"
+msgstr "Reducir"
+
+#: backends/platform/wince/CEActionsPocket.cpp:55
+#: backends/platform/wince/CEActionsSmartphone.cpp:49
+msgid "Bind Keys"
+msgstr "Vincular teclas"
+
+#: backends/platform/wince/CEActionsPocket.cpp:56
+msgid "Cursor Up"
+msgstr "Arriba"
+
+#: backends/platform/wince/CEActionsPocket.cpp:57
+msgid "Cursor Down"
+msgstr "Abaixo"
+
+#: backends/platform/wince/CEActionsPocket.cpp:58
+msgid "Cursor Left"
+msgstr "Esquerda"
+
+#: backends/platform/wince/CEActionsPocket.cpp:59
+msgid "Cursor Right"
+msgstr "Dereita"
+
+#: backends/platform/wince/CEActionsPocket.cpp:267
+#: backends/platform/wince/CEActionsSmartphone.cpp:231
+msgid "Do you want to load or save the game?"
+msgstr "Queres cargar ou gardar a partida?"
+
+#: backends/platform/wince/CEActionsPocket.cpp:326
+#: backends/platform/wince/CEActionsSmartphone.cpp:287
+msgid " Are you sure you want to quit ? "
+msgstr " Seguro que queres saír?"
+
+#: backends/platform/wince/CEActionsSmartphone.cpp:50
+msgid "Keyboard"
+msgstr "Teclado"
+
+#: backends/platform/wince/CEActionsSmartphone.cpp:51
+msgid "Rotate"
+msgstr "Rotar"
+
+#: backends/platform/wince/CELauncherDialog.cpp:56
+msgid "Using SDL driver "
+msgstr "Empregando driver de SDL"
+
+#: backends/platform/wince/CELauncherDialog.cpp:60
+msgid "Display "
+msgstr "Pantalla"
+
+#: backends/platform/wince/CELauncherDialog.cpp:83
+msgid "Do you want to perform an automatic scan ?"
+msgstr "Queres realizar unha análise automática?"
+
+#: backends/platform/wince/wince-sdl.cpp:515
+msgid "Map right click action"
+msgstr "Asignar acción de botón secundario"
+
+#: backends/platform/wince/wince-sdl.cpp:519
+msgid "You must map a key to the 'Right Click' action to play this game"
+msgstr ""
+"Debes asignar unha tecla á acción do botón secundario do rato para xogar"
+
+#: backends/platform/wince/wince-sdl.cpp:528
+msgid "Map hide toolbar action"
+msgstr "Asignar acción Ocultar barra de ferramentas"
+
+#: backends/platform/wince/wince-sdl.cpp:532
+msgid "You must map a key to the 'Hide toolbar' action to play this game"
+msgstr ""
+"Debes asignar unha tecla á acción Ocultar barra de ferramentas para xogar"
+
+#: backends/platform/wince/wince-sdl.cpp:541
+msgid "Map Zoom Up action (optional)"
+msgstr "Asignar acción de Ampliar (opcional)"
+
+#: backends/platform/wince/wince-sdl.cpp:544
+msgid "Map Zoom Down action (optional)"
+msgstr "Asignar acción de Reducir (opcional)"
+
+#: backends/platform/wince/wince-sdl.cpp:552
+msgid ""
+"Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"
+msgstr ""
+"Non esquezas asignar unha tecla á acción Ocultar barra de ferramentas para "
+"ver o inventario completo"
+
+#: backends/events/default/default-events.cpp:191
+msgid "Do you really want to return to the Launcher?"
+msgstr "Seguro que queres volver ao Iniciador?"
+
+#: backends/events/default/default-events.cpp:191
+msgid "Launcher"
+msgstr "Iniciador"
+
+#: backends/events/default/default-events.cpp:213
+msgid "Do you really want to quit?"
+msgstr "Seguro que queres saír?"
+
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
+#: backends/events/openpandora/op-events.cpp:139
+msgid "Touchscreen 'Tap Mode' - Left Click"
+msgstr "Modo pantalla táctil: premer botón primario"
+
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
+#: backends/events/openpandora/op-events.cpp:141
+msgid "Touchscreen 'Tap Mode' - Right Click"
+msgstr "Modo pantalla táctil: premer botón secundario"
+
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
+#: backends/events/openpandora/op-events.cpp:143
+msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
+msgstr "Modo pantalla táctil: apuntar co rato"
+
+#: backends/events/gph/gph-events.cpp:410
+msgid "Maximum Volume"
+msgstr "Volume máximo"
+
+#: backends/events/gph/gph-events.cpp:412
+msgid "Increasing Volume"
+msgstr "Subindo volume"
+
+#: backends/events/gph/gph-events.cpp:418
+msgid "Minimal Volume"
+msgstr "Volume mínimo"
+
+#: backends/events/gph/gph-events.cpp:420
+msgid "Decreasing Volume"
+msgstr "Baixando volume"
+
+#: backends/updates/macosx/macosx-updates.mm:65
+msgid "Check for Updates..."
+msgstr "Buscar actualizacións..."
+
+#: backends/platform/bada/form.cpp:269
+msgid "Right Click Once"
+msgstr "Botón secundario unha vez"
+
+#: backends/platform/bada/form.cpp:277
+msgid "Move Only"
+msgstr "Mover unicamente"
+
+#: backends/platform/bada/form.cpp:291
+msgid "Escape Key"
+msgstr "ESC"
+
+#: backends/platform/bada/form.cpp:296
+msgid "Game Menu"
+msgstr "Menú do xogo"
+
+#: backends/platform/bada/form.cpp:301
+msgid "Show Keypad"
+msgstr "Mostrar teclado numérico"
+
+#: backends/platform/bada/form.cpp:309
+msgid "Control Mouse"
+msgstr "Rato"
+
+#: backends/events/maemosdl/maemosdl-events.cpp:192
+msgid "Clicking Enabled"
+msgstr "Premer activado"
+
+#: backends/events/maemosdl/maemosdl-events.cpp:192
+msgid "Clicking Disabled"
+msgstr "Premer desactivado"
diff --git a/po/hu_HU.po b/po/hu_HU.po
index f230c84d1a..b263d2c539 100644
--- a/po/hu_HU.po
+++ b/po/hu_HU.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2012-02-17 07:10+0100\n"
-"Last-Translator: Gruby <grubycza@hotmail.com>\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-08-14 07:29+0100\n"
+"Last-Translator: George Kormendi <grubycza@hotmail.com>\n"
"Language-Team: Hungarian\n"
+"Language: Magyar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Magyar\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"X-Poedit-Language: Hungarian\n"
"X-Poedit-Country: HUNGARY\n"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "Feljebb"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,15 +73,15 @@ msgstr "Bezár"
msgid "Mouse click"
msgstr "Egérkattintás"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Billentyûzet beállítások"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Billentyûk átállítása"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Teljesképernyõ kapcsoló"
@@ -92,18 +93,18 @@ msgstr "Válassz mûveletet a kiosztáshoz"
msgid "Map"
msgstr "Kiosztás"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -130,324 +131,328 @@ msgstr "Válassz egy mûveletet"
msgid "Press the key to associate"
msgstr "Nyomj egy billentyût a társításhoz"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Játék"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
msgstr ""
"Rövid játékazonosító a játékmentésekhez és a játék parancssori futtatásához"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Név:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "A játék teljes neve"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Név:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Nyelv:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr ""
"A játék nyelve. Ne állítsd át a pl. Spanyol nyelvû játékodat Angol nyelvre"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<alapértelmezett>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Platform:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Platform amire a játékot eredetileg készítették"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Platform:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafika"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Globális grafikai beállítások felülbírálása"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Globális grafikai beállítások felülbírálása"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Audió"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Globális audió beállítások felülbírálása"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Globális audió beállítások felülbírálása"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Hangerõ"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Hangerõ"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Globális hangerõbeállítások felülbírálása"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Globális hangerõbeállítások felülbírálása"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Globális MIDI beállítások felülbírálása"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Globális MIDI beállítások felülbírálása"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Globális MT-32 beállítások felülbírálása"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Globális MT-32 beállítások felülbírálása"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Mappák"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Mappák"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Játék Mappa:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Játék Mappa:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Extra Mappa:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Mappa kiválasztás a játékok kiegészítõ fájljaihoz"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Extra Mappa:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Mentés Mappa:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Játékmentések helyének meghatározása"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Mentés Mappa:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Nincs"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Alapértelmezett"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "SoundFont kiválasztás"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Játékok helyének kiválasztása"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Válassz mappát a játék kiegészítõkhöz"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Válaszz játékmentéseknek mappát"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Ez a játékazonosító ID már foglalt, Válassz egy másikat."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "Kilépés"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "ScummVM bezárása"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "Névjegy"
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "ScummVM névjegy"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~pciók..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Globális ScummVM opciók cseréje"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "Indítás"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "A választott játék indítása"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "Betöltés"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Kimentett játékállás betöltése"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "Játék hozzáadás"
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Tratsd lenyomva a Shift-et a Masszív módhoz"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "Játékopciók"
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Játék beállítások megváltoztatása"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "Játék törlése"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Törli a játék nevét a listáról. A játékfájlok megmaradnak"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "Játék hozzáadás"
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "Játékopciók"
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "Játék törlése"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Keresés a játéklistában"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Keresés:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Játék betöltése:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Betöltés"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -455,7 +460,7 @@ msgstr ""
"Biztos hogy futtatod a Masszív játékdetektort? Ez potenciálisan sok játékot "
"hozzáad a listához."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -463,7 +468,7 @@ msgstr ""
msgid "Yes"
msgstr "Igen"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -471,37 +476,37 @@ msgstr "Igen"
msgid "No"
msgstr "Nem"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM nem tudja megnyitni a választott mappát!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "A ScummVM nem talált egy játékot sem a választott mappában!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Válassztott játék:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Biztosan törölni akarod ezt a játékkonfigurációt?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Ez a játék nem támogatja a játékállás betöltést az indítóból."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM nem talált olyan játékmotort ami a választott játékot támogatja!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Masszív mód..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Masszív mód..."
@@ -568,162 +573,154 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Nincs"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Néhány grafikus opció változtatása sikertelen:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "a videómód nem változott."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "a teljesképernyõs beállítás nem változott"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "a képméretarány beállítások nem változtak"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Grafikus mód:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Kirajzolás mód:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Néhány játék támogatja a speciális árnyalási módokat"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Teljesképernyõs mód:"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Képméretarány korrekció"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Helyes oldalarány a 320x200 játékokhoz"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA szinjavítás"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "EGA színjavítás támogatott EGA játékokban"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Elsõdleges eszköz:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Zene eszköz:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Elsõdleges hangeszköz vagy hang emulátor beállítások"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Hangeszköz vagy hangkártya emulátor beállítások"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Elsõdleges eszk.:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Zene eszköz:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib emulátor:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib meghajtót sok játék használja zenéhez"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Kimeneti ráta:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
msgstr ""
"Nagyobb értékek jobb hangminõséget adnak, de nem minden hangkártya támogatja"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "GM Eszköz:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Alapértelmezett hangeszköz General MIDI kimenethez"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Ne használj General MIDI zenét"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Elsõ elérhetõ eszköz használata"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
"Néhány hangkárya, Fluidsynth és Timidyti támogatja a SoundFont betöltését"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Vegyes AdLib/MIDI mód"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "MIDI és AdLib hanggenerátorok használata"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "MIDI erõsítés:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "MT-32 Eszköz:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr "Roland MT-32/LAPC1/CM32l/CM64 alapértelmezett hangeszközök beállítása"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Roland MT-32 Hardver (GM emuláció tiltva)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -731,190 +728,190 @@ msgstr ""
"Jelöld be, ha hardveres Roland-Kompatibilis hangeszköz van csatlakoztatva a "
"gépedhez és használni akarod"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Roland MT-32 Hardver (GM emuláció nincs)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Roland GS Mód engedélyezve"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr "General MIDI leképezés Roland MT-32 zenés játékokhoz kikapcsolva"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Ne használj Roland MT-32 zenét"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Szöveg és beszéd:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Csak beszéd"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Csak felirat"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Mind"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Felirat sebesség:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Felirat és beszéd:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Besz"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Text"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Mind"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Hang és feliratok megjelenítése"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Felirat sebesség:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Zene hangerõ:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Zene hangerõ:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Összes némítása"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "SFX hangerõ:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Speciális hangeffektusok hangereje"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "SFX hangerõ:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Beszéd hangerõ:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Beszéd hangerõ:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Téma Mappa:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Téma Mappa:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Minden jéték és ScummVM kiegészítõ fájljainak mappája:"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Plugin Mappa:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Plugin Mappa:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Vegyes"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Vegyes"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Téma:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI Renderelõ:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Automentés:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Automentés:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Billentyûk"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "GUI nyelve:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "A ScummVM GUI nyelve"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Indítsd újra a ScummVM-et a változások érvényesítéséhez."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Válassz játékmentés mappát"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "A kiválasztott mappába nem lehet írni, válassz egy másikat"
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "GUI téma mappa kiválasztása"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Mappa választás az extra fájloknak"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Plugin mappa kiválasztása"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -922,104 +919,137 @@ msgstr ""
"A kiválasztott téma nem támogatja a nyelvedet. Ha használni akarod ezt a "
"témát, elõszõr válts át egy másik nyelvre."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr "Lista nézet"
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr "Rács nézet"
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Dátum nincs mentve"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Idõ nincs mentve"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Játékidõ nincs mentve"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Töröl"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Biztos hogy törölni akarod ezt a játékállást?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Dátum:"
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Idõ:"
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Játékidõ:"
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Névtelen játékállás"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr "Következõ"
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr "Elõzõ"
+
+#: gui/saveload-dialog.cpp:684
+msgid "New Save"
+msgstr "Új Mentés"
+
+#: gui/saveload-dialog.cpp:684
+msgid "Create a new save game"
+msgstr "Új játékmentés készítése"
+
+#: gui/saveload-dialog.cpp:789
+msgid "Name: "
+msgstr "Név:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr "Adj meg egy leírást a %d slothoz:"
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Válassz témát"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX letiltva"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX letiltva"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standard leképezõ (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Élsimításos leképezõ (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Élsimított (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Érték törlése"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "A motor nem támogatja a '%s' debug szintet"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menü"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Szünet"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Sor átlépése"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Hiba a játék futtatásakor:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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"
@@ -1087,16 +1117,16 @@ msgstr "Felhasználói megszakítás"
msgid "Unknown error"
msgstr "Ismeretlen hiba"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "A '%s' játék ismeretlennek tûnik."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr "Kérlek jelezd a ScummVM csapatnak a következõ adatokat, együtt a játék"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "címével és megbízható adataival játékverzió/nyelv(ek)/stb.:"
@@ -1124,22 +1154,23 @@ msgstr "Súgó"
msgid "~A~bout"
msgstr "Névjegy"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "Visszatérés az indítóba"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "Visszatérés az indítóba"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Játék mentése:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1148,7 +1179,7 @@ msgstr "Játék mentése:"
msgid "Save"
msgstr "Mentés"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1157,26 +1188,26 @@ msgstr ""
"Sajnálom, a motor jelenleg nem tartalmaz játék közbeni súgót. Olvassd el a "
"README-t az alap információkról, és hogy hogyan segíthetsz a késõbbiekben."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Sajnálom, a motor jelenleg nem tartalmaz játék közbeni súgót. Olvassd el a "
-"README-t az alap információkról, és hogy hogyan segíthetsz a késõbbiekben."
+"(%s) játékmentés nem sikerült!. Olvassd el a README-t az alap "
+"információkról, és hogy hogyan segíthetsz a késõbbiekben."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "Mégse"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "Billentyük"
@@ -1225,13 +1256,13 @@ msgstr ""
"Nézd meg a README fájlt a részletekért."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Sajnálom, a motor jelenleg nem tartalmaz játék közbeni súgót. Olvassd el a "
-"README-t az alap információkról, és hogy hogyan segíthetsz a késõbbiekben."
+"(%s) játékállás betöltése nem sikerült!. Olvassd el a README-t az alap "
+"információkról, és hogy hogyan segíthetsz a késõbbiekben."
#: engines/engine.cpp:439
msgid ""
@@ -1247,6 +1278,86 @@ msgstr ""
msgid "Start anyway"
msgstr "Indítás így is"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Eredeti ment/tölt képernyõk használata"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr "Az eredeti mentés/betöltés képernyõ használata a ScummVM képek helyett"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Játékmenet visszaállítása:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Visszaállítás"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Fényes paletta mód használata"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Grafikus megjelenítésre használja a játék fényes palettáját"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA szinjavítás"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Undithering engedélyezése EGA játékokban"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Digitális hangeffektusok elõnyben"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Digitális hanghatások elõnyben a szintetizáltakkal szemben"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "IMF/Yamaha FB-01 használata MIDI kimentre"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"IBM Music Feature kártya vagy Yamaha FB-01 FM szintetizátor modul használata "
+"MIDI kimenetre"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "CD audió használata"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "CD audió használata a játékban lévõvel szemben, ha elérhetõ"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Windows kurzorok használata"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr "Windows kurzorok használata (kisebb és monokróm) a DOS-osok helyett "
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Ezüst kurzor használata"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr "Alternatív ezüst kurzorszett használata, a normál arany helyett"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1903,7 +2014,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:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1914,7 +2025,7 @@ msgstr ""
"\n"
"%s fájlba nem sikerült"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1925,7 +2036,7 @@ msgstr ""
"\n"
"%s fájlból nem sikerült"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1936,7 +2047,7 @@ msgstr ""
"\n"
"%s fájlba elkészült"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1972,25 +2083,17 @@ msgstr "Fõ~M~enü"
msgid "~W~ater Effect Enabled"
msgstr "Vízeffektus engedélyezve"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Játékmenet visszaállítása:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Visszaállítás"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Játékállás mentése fájlba nem sikerült."
@@ -2002,6 +2105,64 @@ msgstr "Fájl törlés sikertelen."
msgid "Failed to save game"
msgstr "Játék mentés nem sikerült"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Stúdió közönség"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Stúdió közönség engedélyezése"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Átugrás támogatás"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Szöveg és átvezetõk átugrásának támogatása"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Helium mód"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Helium mód engedélyezve"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Finom görgetés"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Finom görgetés engedélyezése járás közben"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Lebegõ kurzor"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Lebegõ kurzor engedélyezése"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "HP sáv grafika"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Hit point sáv grafika engedélyezése"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Támadás 1"
@@ -2055,14 +2216,22 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
-"Úgy néz ki egy General MIDI eszközt használsz,\n"
-"a játék csak Roland MT32 MIDI eszközt támogat.\n"
-"Cseréld ki Roland MT32 hangszerekre\n"
-"a General MIDI-t. Különben néhány\n"
-"sávot nem lehet rendesen lejátszani."
+"Úgy tûnik, egy General MIDI eszközt használsz,\n"
+"de a játék csak Roland MT32 MIDI eszközt támogat.\n"
+"Megpróbáljuk lecserélni a Roland MT32 hangszereket\n"
+"General MIDIre. Továbbra is lehetséges hogy\n"
+"néhány hangsáv helytelenül hangzik."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr "Alternatív intro"
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Alternatív játékintro használata (csak CD verziónál)"
#: engines/sky/compact.cpp:130
msgid ""
@@ -2080,10 +2249,18 @@ msgstr ""
"A \"sky.cpt\" fájl mérete nem megfelelõ.\n"
"Töltsd le a www.scummvm.org oldaláról"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Floppy intro"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "A floppy verzió intro használata (csak CD verziónál)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "'%s' PSX stream átvezetõ nem játszható le paletta módban"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2138,10 +2315,32 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Ez a Broken Sword 1 Demo vége"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
-msgstr "DXA átvezetõ elérhetõ, de a ScummVM zlib támogatás nincs lefordítva"
+msgstr ""
+"PSX átvezetõfilmet találtam, de ez a ScummVM RGB színtámogatás nélkül van "
+"lefordítva"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Tárgycimke látható"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Tárgycimke látható ha az egér felette van"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr "Hiányzik a 'teenagent.dat' fájl. Szerezd be a ScummVM website-ról"
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+"A teenagent.dat fájl tömörített és a zlib nem része ennek a futtatható "
+"állománynak. Kérlek tömörítsd ki"
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2152,15 +2351,15 @@ msgstr ""
"Játékállás nem menthetõ %i slotba\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Játék betöltés..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Játék mentés..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2176,11 +2375,11 @@ msgstr ""
"Nyomj OK-t az átalakításhoz, vagy rákérdezzek ha legközelebb elindítod a "
"játékot.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM konvertálta az összes játékállásodat."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2289,7 +2488,7 @@ msgstr " (Aktív)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Blokkolt)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2375,27 +2574,27 @@ msgstr "Jóminõségü audió (lassabb)(újraindítás)"
msgid "Disable power off"
msgstr "Leállítás tiltva"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Egér kattint-és-húz mód engedélyezve."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Egér kattint-és-húz mód letiltva."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Touchpad mód engedélyezve."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Touchpad mód letiltva."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr "Kattintás Mód"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2403,11 +2602,11 @@ msgstr "Kattintás Mód"
msgid "Left Click"
msgstr "Bal katt"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
msgstr "Középsõ katt"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2444,34 +2643,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normál (nincs átméretezés)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Méretarány korrekció letiltva"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Aktív grafikus szûrõk:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Ablakos mód"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normál"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Megtartott"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Eredeti"
@@ -2809,37 +3008,37 @@ msgstr "Indítópult"
msgid "Do you really want to quit?"
msgstr "Biztos hogy ki akarsz lépni ?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Érintõképernyõ 'Tap Mód' - Bal katt"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Érintõképernyõ 'Tap Mód' - Jobb katt"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Érintõképernyõ 'Tap Mód' - Lebegõ (Nincs katt)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Maximum Hangerõ"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Hangerõ növelése"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Minimum Hangerõ"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Hangerõ csökkentése"
diff --git a/po/it_IT.po b/po/it_IT.po
index 29811d81ff..7d4c11319d 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-10-08 17:29+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-09 09:30+0100\n"
"Last-Translator: Matteo 'Maff' Angelino <matteo.maff at gmail dot com>\n"
"Language-Team: Italian\n"
+"Language: Italiano\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Italiano\n"
#: gui/about.cpp:91
#, c-format
@@ -43,11 +43,12 @@ msgid "Go up"
msgstr "Su"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -68,16 +69,15 @@ msgstr "Chiudi"
msgid "Mouse click"
msgstr "Clic del mouse"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Mostra tastiera"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Riprogramma tasti"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Attiva / disattiva schermo intero"
@@ -89,18 +89,18 @@ msgstr "Scegli un'azione da mappare"
msgid "Map"
msgstr "Mappa"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -127,15 +127,15 @@ msgstr "Seleziona un'azione"
msgid "Press the key to associate"
msgstr "Premi il tasto da associare"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Gioco"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -143,309 +143,313 @@ msgstr ""
"Breve identificatore di gioco utilizzato per il riferimento a salvataggi e "
"per l'esecuzione del gioco dalla riga di comando"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Nome:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Titolo completo del gioco"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Nome:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Lingua:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr ""
"Lingua del gioco. Un gioco inglese non potrà risultare tradotto in italiano"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<predefinito>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Piattaforma:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "La piattaforma per la quale il gioco è stato concepito"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Piattaf.:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motore"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafica"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "Grafica"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Ignora le impostazioni grafiche globali"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Ignora le impostazioni grafiche globali"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Audio"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Ignora le impostazioni audio globali"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Ignora le impostazioni audio globali"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volume"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volume"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Ignora le impostazioni globali di volume"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Ignora le impostazioni globali di volume"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Ignora le impostazioni MIDI globali"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Ignora le impostazioni MIDI globali"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Ignora le impostazioni MT-32 globali"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Ignora le impostazioni MT-32 globali"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Percorsi"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Perc."
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Percorso gioco:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Perc. gioco:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Percorso extra:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Specifica il percorso di ulteriori dati usati dal gioco"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Perc. extra:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Salvataggi:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Specifica dove archiviare i salvataggi"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Salvataggi:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Nessuno"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Predefinito"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Seleziona SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Seleziona la cartella contenente i file di gioco"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Seleziona la cartella di gioco aggiuntiva"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Seleziona la cartella dei salvataggi"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Questo ID di gioco è già in uso. Si prega di sceglierne un'altro."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "C~h~iudi"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Esci da ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "~I~nfo..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Informazioni su ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~pzioni..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Modifica le opzioni globali di ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~G~ioca"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Esegue il gioco selezionato"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~C~arica..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Carica un salvataggio del gioco selezionato"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~A~ggiungi gioco..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Tieni premuto Shift per l'aggiunta in massa"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~M~odifica gioco..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Modifica le opzioni di gioco"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~R~imuovi gioco"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Rimuove il gioco dalla lista. I file del gioco rimarranno intatti"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~A~gg. gioco..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~M~odif. gioco..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~R~im. gioco"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Cerca nella lista dei giochi"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Cerca:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Carica gioco:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Carica"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -453,7 +457,7 @@ msgstr ""
"Vuoi davvero eseguire il rilevatore di giochi in massa? Potrebbe aggiungere "
"un numero enorme di giochi."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -461,7 +465,7 @@ msgstr ""
msgid "Yes"
msgstr "Sì"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -469,40 +473,40 @@ msgstr "Sì"
msgid "No"
msgstr "No"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM non ha potuto aprire la cartella specificata!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM non ha potuto trovare nessun gioco nella cartella specificata!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Scegli il gioco:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Sei sicuro di voler rimuovere questa configurazione di gioco?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr ""
"Questo gioco non supporta il caricamento di salvataggi dalla schermata di "
"avvio."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM non ha potuto trovare un motore in grado di eseguire il gioco "
"selezionato!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Agg. massa..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Agg. in massa..."
@@ -569,103 +573,95 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Nessuno"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Impossibile applicare alcuni dei cambiamenti nelle opzioni grafiche."
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "impossibile modificare la modalità video."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "impossibile modificare l'impostazione schermo intero"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "impossibile modificare l'impostazione proporzioni"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Modalità:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Resa grafica:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Modalità di resa grafica speciali supportate da alcuni giochi"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Modalità a schermo intero"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Correzione proporzioni"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Corregge le proporzioni dei giochi 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Undithering EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Attiva undithering nei giochi EGA che lo supportano"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Disp. preferito:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Dispositivo audio:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
"Specifica il dispositivo audio o l'emulatore della scheda audio preferiti"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr ""
"Specifica il dispositivo di output audio o l'emulatore della scheda audio"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Disp. preferito:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Disposit. audio:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "Emulatore AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib è utilizzato per la musica in molti giochi"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Frequenza:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -673,62 +669,62 @@ msgstr ""
"Valori più alti restituiscono un suono di maggior qualità, ma potrebbero non "
"essere supportati dalla tua scheda audio"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "Dispositivo GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Specifica il dispositivo audio predefinito per l'output General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Non utilizzare la musica General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Utilizza il primo dispositivo disponibile"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "SoundFont è supportato da alcune schede audio, Fluidsynth e Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Modalità mista AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Utilizza generazione di suono sia MIDI che AdLib"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Guadagno MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Disposit. MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Specifica il dispositivo audio predefinito per l'output Roland MT-32/LAPC1/"
"CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Roland MT-32 effettivo (disattiva emulazione GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -736,192 +732,192 @@ msgstr ""
"Seleziona se vuoi usare il dispositivo hardware audio compatibile con Roland "
"che è connesso al tuo computer"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Roland MT-32 effettivo (disat.emul.GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Attiva la modalità Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"Disattiva la mappatura General MIDI per i giochi con colonna sonora Roland "
"MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Non utilizzare la musica Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Testo e voci:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Voci"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Sottotitoli"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Entrambi"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Velocità testo:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Testo e voci:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Voci"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Sub"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Entr."
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Mostra i sottotitoli e attiva le voci"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Velocità testo:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Volume musica:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Volume musica:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Disattiva audio"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Volume effetti:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volume degli effetti sonori"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Volume effetti:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Volume voci:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Volume voci:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Percorso tema:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Perc. tema:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Specifica il percorso di ulteriori dati usati dai giochi o da ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Percorso plugin:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Perc. plugin:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Varie"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Varie"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "Renderer GUI:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autosalva:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autosalva:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Tasti"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Lingua GUI:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Lingua dell'interfaccia grafica di ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Devi riavviare ScummVM affinché le modifiche abbiano effetto."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Seleziona la cartella per i salvataggi"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "La cartella scelta è in sola lettura. Si prega di sceglierne un'altra."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Seleziona la cartella dei temi dell'interfaccia"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Seleziona la cartella dei file aggiuntivi"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Seleziona la cartella dei plugin"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -929,104 +925,140 @@ msgstr ""
"Il tema che hai selezionato non supporta la lingua attuale. Se vuoi "
"utilizzare questo tema devi prima cambiare la lingua."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Nessuna data salvata"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Nessun orario salvato"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Nessun tempo salvato"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Elimina"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Sei sicuro di voler eliminare questo salvataggio?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Data: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Ora: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Tempo di gioco: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Salvataggio senza titolo"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Salva"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Impossibile salvare il gioco"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Nome:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Seleziona un tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "Grafica disattivata"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Grafica disattivata"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Renderer standard (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Renderer con antialiasing (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Con antialiasing (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Cancella"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Il motore non supporta il livello di debug '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausa"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Salta battuta"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Errore nell'esecuzione del gioco:"
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr ""
"Impossibile trovare un motore in grado di eseguire il gioco selezionato"
@@ -1095,16 +1127,16 @@ msgstr "Utente cancellato"
msgid "Unknown error"
msgstr "Errore sconosciuto"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "Il gioco in '%s' sembra essere sconosciuto."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr "Per favore, riporta i seguenti dati al team di ScummVM con il nome"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "del gioco che hai provato ad aggiungere e la sua versione/lingua/ecc.:"
@@ -1132,22 +1164,23 @@ msgstr "~A~iuto"
msgid "~A~bout"
msgstr "~I~nfo"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~T~orna a elenco giochi"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~V~ai a elenco giochi"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Salva gioco:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1156,7 +1189,7 @@ msgstr "Salva gioco:"
msgid "Save"
msgstr "Salva"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1166,27 +1199,27 @@ msgstr ""
"gioco. Si prega di consultare il file README per le informazioni di base e "
"per le istruzioni su come ottenere ulteriore assistenza."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Siamo spiacenti, ma l'attuale motore non prevede aiuto all'interno del "
-"gioco. Si prega di consultare il file README per le informazioni di base e "
-"per le istruzioni su come ottenere ulteriore assistenza."
+"Salvataggio fallito (%s)! Si prega di consultare il file README per le "
+"informazioni di base e per le istruzioni su come ottenere ulteriore "
+"assistenza."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~A~nnulla"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~asti"
@@ -1235,14 +1268,14 @@ msgstr ""
"Vedi il file README per i dettagli."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Siamo spiacenti, ma l'attuale motore non prevede aiuto all'interno del "
-"gioco. Si prega di consultare il file README per le informazioni di base e "
-"per le istruzioni su come ottenere ulteriore assistenza."
+"Caricamento salvataggio fallito (%s)! Si prega di consultare il file README "
+"per le informazioni di base e per le istruzioni su come ottenere ulteriore "
+"assistenza."
#: engines/engine.cpp:439
msgid ""
@@ -1258,6 +1291,91 @@ msgstr ""
msgid "Start anyway"
msgstr "Avvia comunque"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Usa schermate di salvataggio originali"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"Usa le schermate originali di salvataggio e caricamento, al posto di quelle "
+"di ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Ripristina gioco:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Ripristina"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Usa modalità colori brillanti"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Visualizza la grafica con i colori brillanti del gioco"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Undithering EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Attiva undithering nei giochi EGA"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Scegli effetti sonori digitali"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Scegli gli effetti sonori digitali al posto di quelli sintetizzati"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Usa IMF/Yamaha FB-01 per output MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Usa una scheda IBM Music Feature o un modulo synth Yamaha FB-01 FM per "
+"l'output MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Usa audio da CD"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+"Usa l'audio da CD al posto di quello incorporato nel gioco, se disponibile"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Usa cursori di Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Usa i cursori di Windows (più piccoli e monocromatici) al posto di quelli DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Usa cursori d'argento"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Usa il set alternativo di cursori d'argento al posto di quelli normali d'oro"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1282,12 +1400,12 @@ msgstr "Gioco in pausa. Premere SPAZIO per continuare."
#. Will react to J as 'Yes'
#: engines/scumm/dialogs.cpp:182
msgid "Are you sure you want to restart? (Y/N)"
-msgstr "Sei sicuro di voler riavviare? (Y/N)"
+msgstr "Sei sicuro di voler riavviare? (S/N)S"
#. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
#: engines/scumm/dialogs.cpp:184
msgid "Are you sure you want to quit? (Y/N)"
-msgstr "Sei sicuro di voler uscire? (Y/N)"
+msgstr "Sei sicuro di voler uscire? (S/N)S"
#: engines/scumm/dialogs.cpp:189
msgid "Play"
@@ -1374,24 +1492,23 @@ msgstr "Voci e testo"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Selezionate un livello di difficoltà."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Consultate il manuale delle istruzioni."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standard (16bpp)"
+msgstr "Medio"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Base"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Expert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1915,7 +2032,7 @@ msgstr ""
"Il supporto nativo MIDI richiede il Roland Upgrade della LucasArts,\n"
"ma %s non è presente. Verrà usato AdLib."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1926,7 +2043,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1937,7 +2054,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1948,7 +2065,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1985,25 +2102,17 @@ msgstr "~M~enu principale"
msgid "~W~ater Effect Enabled"
msgstr "~E~ffetto acqua attivo"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Ripristina gioco:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Ripristina"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Impossibile salvare il gioco nel file."
@@ -2015,73 +2124,134 @@ msgstr "Impossibile eliminare il file."
msgid "Failed to save game"
msgstr "Impossibile salvare il gioco"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Reazioni del pubblico"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Attiva le reazioni del pubblico"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Interruzione del parlato"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Permette di saltare i dialoghi e le scene di intermezzo"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Modalità elio"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Attiva la modalità elio"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Scorrimento morbido"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Attiva lo scorrimento morbido durante gli spostamenti"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Cursori fluttuanti"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Attiva cursori fluttuanti"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Barre HP"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Attiva le barre di Hit Point"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Attacco 1"
#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Attacco 2"
#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Attacco 3"
#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Vai avanti"
#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Vai indietro"
#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Scorri a sinistra"
#: engines/kyra/lol.cpp:484
-#, fuzzy
msgid "Slide Right"
-msgstr "Destra"
+msgstr "Scorri a destra"
#: engines/kyra/lol.cpp:485
-#, fuzzy
msgid "Turn Left"
-msgstr "Spegni"
+msgstr "Gira a sinistra"
#: engines/kyra/lol.cpp:486
-#, fuzzy
msgid "Turn Right"
-msgstr "Cursore a destra"
+msgstr "Gira a destra"
#: engines/kyra/lol.cpp:487
-#, fuzzy
msgid "Rest"
-msgstr "Ripristina"
+msgstr "Riposa"
#: engines/kyra/lol.cpp:488
-#, fuzzy
msgid "Options"
-msgstr "~O~pzioni"
+msgstr "Opzioni"
#: engines/kyra/lol.cpp:489
-#, fuzzy
msgid "Choose Spell"
-msgstr "Scegli"
+msgstr "Scegli incantesimo"
#: engines/kyra/sound_midi.cpp:475
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Sembra che tu stia utilizzanto un dispositivo\n"
"General MIDI, ma il gioco supporta solo Roland\n"
"MT32 MIDI. Tenteremo di mappare gli strumenti\n"
"Roland MT32 in quelli General MIDI. Alcune tracce\n"
-"potrebbero non essere riprodotte correttamente."
+"potrebbero avere un suono non corretto."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Usa la versione floppy dell'intro (solo versione CD)"
#: engines/sky/compact.cpp:130
msgid ""
@@ -2099,10 +2269,19 @@ msgstr ""
"Il file \"sky.cpt\" non ha una dimensione corretta.\n"
"Si prega di (ri)scaricarlo da www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Intro floppy"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Usa la versione floppy dell'intro (solo versione CD)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
msgstr ""
+"La scena PSX di intermezzo '%s' non può essere eseguita in modalità tavolozza"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2159,12 +2338,30 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Questa è la fine della demo di Broken Sword 1"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"Sono state trovare scene di intermezzo DXA ma ScummVM è stato compilato "
-"senza il supporto zlib"
+"Sono state trovare scene di intermezzo PSX ma ScummVM è stato compilato "
+"senza il supporto colori RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Mostra etichette oggetti"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Mostra etichette per gli oggetti al passaggio del mouse"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2175,15 +2372,15 @@ msgstr ""
"Impossibile salvare nella posizione %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Caricamento..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Salvataggio..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2200,11 +2397,11 @@ msgstr ""
"Premi OK per convertirli adesso, altrimenti ti verrà richiesto la prossima "
"volta.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM ha convertito con successo tutti i tuoi salvataggi."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2306,9 +2503,8 @@ msgid "Keymap:"
msgstr "Mappa tasti:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
-msgstr " (Attivo)"
+msgstr " (Efficace)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
@@ -2316,7 +2512,7 @@ msgstr " (Attivo)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Bloccato)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2402,27 +2598,27 @@ msgstr "Audio ad alta qualità (più lento) (riavviare)"
msgid "Disable power off"
msgstr "Disattiva spegnimento in chiusura"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Modalità mouse-clicca-e-trascina attivata."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Modalità mouse-clicca-e-trascina disattivata."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Modalità touchpad attivata."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Modalità touchpad disattivata."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Modalità clic"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2430,12 +2626,11 @@ msgstr ""
msgid "Left Click"
msgstr "Clic sinistro"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Oggetto al centro a sinistra"
+msgstr "Clic centrale"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2472,34 +2667,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normale (no ridim.)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Correzione proporzioni disattivata"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Filtro grafico attivo:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Modalità finestra"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Conserve"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
@@ -2839,37 +3034,37 @@ msgstr "Elenco giochi"
msgid "Do you really want to quit?"
msgstr "Sei sicuro di voler uscire?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Touchscreen 'Tap Mode' - Clic sinistro"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Touchscreen 'Tap Mode' - Clic destro"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Touchscreen 'Tap Mode' - Passaggio del cursore (nessun clic)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Volume massimo"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Aumento volume"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Volume minimo"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Diminuzione volume"
@@ -2878,40 +3073,36 @@ msgid "Check for Updates..."
msgstr "Cerca aggiornamenti..."
#: backends/platform/bada/form.cpp:269
-#, fuzzy
msgid "Right Click Once"
-msgstr "Clic destro"
+msgstr "Un clic destro"
#: backends/platform/bada/form.cpp:277
-#, fuzzy
msgid "Move Only"
-msgstr "Solo voci"
+msgstr "Muovi soltanto"
#: backends/platform/bada/form.cpp:291
msgid "Escape Key"
-msgstr ""
+msgstr "Tasto Esc"
#: backends/platform/bada/form.cpp:296
-#, fuzzy
msgid "Game Menu"
-msgstr "Gioco"
+msgstr "Menu di gioco"
#: backends/platform/bada/form.cpp:301
-#, fuzzy
msgid "Show Keypad"
-msgstr "Mostra tastiera"
+msgstr "Mostra tastierino numerico"
#: backends/platform/bada/form.cpp:309
msgid "Control Mouse"
-msgstr ""
+msgstr "Controllo mouse"
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
-msgstr ""
+msgstr "Clic attivato"
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
-msgstr ""
+msgstr "Clic disattivato"
#~ msgid "Hercules Green"
#~ msgstr "Hercules verde"
diff --git a/po/nb_NO.po b/po/nb_NO.po
index 780cd8daa7..b775d11dd2 100644
--- a/po/nb_NO.po
+++ b/po/nb_NO.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-04-25 22:56+0100\n"
-"Last-Translator: Einar Johan T. Sømåen <einarjohants@gmail.com>\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-04 02:19+0100\n"
+"Last-Translator: Einar Johan Sømåen <einarjohants@gmail.com>\n"
"Language-Team: somaen <einarjohants@gmail.com>\n"
+"Language: Norsk (bokmaal)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Norsk (bokmaal)\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"X-Poedit-Language: Norsk Bokmål\n"
"X-Poedit-Country: NORWAY\n"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "Gå tilbake"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,16 +73,15 @@ msgstr "Lukk"
msgid "Mouse click"
msgstr "Musklikk"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Vis tastatur"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Omkoble taster"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Veksle fullskjerm"
@@ -93,18 +93,18 @@ msgstr "Velg en handling for kobling"
msgid "Map"
msgstr "Koble"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -131,15 +131,15 @@ msgstr "Vennligst velg en handling"
msgid "Press the key to associate"
msgstr "Trykk tasten som skal kobles"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Spill"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -147,29 +147,29 @@ msgstr ""
"Kort spill-identifikator, brukt for å referere til lagrede spill, og å kjøre "
"spillet fra kommandolinjen"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Navn:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Full spilltittel"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Navn:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Språk:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -177,280 +177,284 @@ msgstr ""
"Spillets språk. Dette vil ikke gjøre din spanske spillversjon om til engelsk "
"versjon"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<standard>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plattform spillet opprinnelig ble designet for"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafikk"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Overstyr globale grafikkinstillinger"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Overstyr globale grafikkinstillinger"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Lyd"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Overstyr globale lydinstillinger"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Overstyr globale lydinstillinger"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volum"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volum"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Overstyr globale voluminstillinger"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Overstyr globale voluminstillinger"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Overstyr globale MIDI-instillinger"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Overstyr globale MIDI-instillinger"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Overstyr globale MT-32-instillinger"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Overstyr globale MT-32-instillinger"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Sti"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Sti"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Spillsti:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Spillsti:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Ekstrasti:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Bestemmer sti til ytterligere data brukt av spillet"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Ekstrasti:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Lagringssti:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Bestemmer sti til lagrede spill"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Lagringssti:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Ingen"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Standard"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Velg SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Velg mappe med spilldata"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Velg mappe med ytterligere data"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Velg mappe for lagrede spill"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Denne spill-IDen er allerede i bruk. Vennligst velg en annen."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~A~vslutt"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Avslutt ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "~O~m..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~V~alg..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Endre globale ScummVM-innstillinger"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~tart"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Start valgt spill"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~Å~pne..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Åpne lagret spill for det valgte spillet"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~L~egg til spill..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Hold Shift for å legge til flere"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~R~ediger spill..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Endre spillinstillinger"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~F~jern spill"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Fjern spill fra listen. Spilldataene forblir intakte"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~L~egg til spill..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~R~ediger spill..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~F~jern spill"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Søk i spilliste"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Søk:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Åpne spill:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Åpne"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -458,7 +462,7 @@ msgstr ""
"Vil du virkelig kjøre flerspill-finneren? Dette kan potensielt legge til et "
"stort antall spill."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -466,7 +470,7 @@ msgstr ""
msgid "Yes"
msgstr "Ja"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -474,37 +478,37 @@ msgstr "Ja"
msgid "No"
msgstr "Nei"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM kunne ikke åpne den valgte mappen!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM kunne ikke finne noe spill i den valgte mappen!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Velg spill:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Vil du virkelig fjerne denne spillkonfigurasjonen?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Dette spillet støtter ikke lasting av spill fra oppstarteren."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM kunne ikke finne noen motor som kunne kjøre det valgte spillet!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Legg til flere..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Legg til flere..."
@@ -520,6 +524,7 @@ msgstr "Søk fullført!"
#, c-format
msgid "Discovered %d new games, ignored %d previously added games."
msgstr ""
+"Fant %d nye spill, ignorerte %d spill som har blitt lagt til tidligere."
#: gui/massadd.cpp:265
#, c-format
@@ -527,9 +532,10 @@ msgid "Scanned %d directories ..."
msgstr "Sjekket %d mapper ..."
#: gui/massadd.cpp:268
-#, fuzzy, c-format
+#, c-format
msgid "Discovered %d new games, ignored %d previously added games ..."
-msgstr "Fant %d nye spill ..."
+msgstr ""
+"Fant %d nye spill, ignorerte %d spill som har blitt lagt til tidligere..."
#: gui/options.cpp:78
msgid "Never"
@@ -571,101 +577,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Ingen"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
-msgstr ""
+msgstr "Klarte ikke å aktivere enkelte av endringene i grafikkinstillinger:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
-msgstr ""
+msgstr "videomodusen kunne ikke endres."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
-msgstr ""
+msgstr "fullskjermsinnstillingen kunne ikke endres"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
-msgstr ""
+msgstr "aspektrate-innstillingen kunne ikke endres"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Grafikkmodus:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Tegnemodus:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Spesiel dithering-modus støttet av enkelte spill"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fullskjermsmodus"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Aspekt-rate korrigering"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Korriger aspekt-rate for 320x200-spill"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA av-dithering"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Slår av dithering i EGA-spill som støtter det."
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Foretrukket enhet:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Musikkenhet:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Velger foretrukket lydenhet eller lydkort-emulator"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Velger ut-lydenhet eller lydkortemulator"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Foretrukket enh.:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Musikkenhet:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib-emulator:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib brukes til musikk i mange spill"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Utrate:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -673,60 +671,60 @@ msgstr ""
"Høyere verdier gir bedre lydkvalitet, men støttes kanskje ikke av ditt "
"lydkort "
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "GM-enhet:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Velger standard lydenhet for General MIDI-utdata"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Ikke bruk General MIDI-musikk"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Bruk første tilgjengelige enhet"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "SoundFont støttes ikke av enkelte lydkort, FluidSynth og Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Mikset AdLib/MIDI-modus"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Bruk både MIDI- og AdLib- lydgenerering"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "MIDI gain:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "MT-32 Enhet:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr "Velger standard lydenhet for Roland MT-32/LAPC1/CM32I/CM64-avspilling"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Ekte Roland MT-32 (deaktiver GM-emulering)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -734,191 +732,190 @@ msgstr ""
"Velg hvis du har et ekte Roland-kompatible lydkort tilkoblet maskinen, og "
"vil bruke dette."
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Ekte Roland MT-32 (deaktiver GM-emulering)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Aktiver Roland GS-modus"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr "Slå av General MIDI-kobling for spill som har Roland MT-32-lydspor"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Ikke bruk Roland MT-32-musikk"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Tekst og Tale:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Tale"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Undertekster"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Begge"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Teksthastighet:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Tekst og Tale:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Tale"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Tekst"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Begge"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Vis undertekster, og spill av tale"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Underteksthastighet:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Musikkvolum:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Musikkvolum:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Demp alle"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Lydeffektvolum:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volum for spesielle lydeffekter"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Lydeffektvolum:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Talevolum:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Talevolum:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Temasti:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Temasti:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Velger sti for ytterligere data brukt av alle spill eller ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Pluginsti:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Pluginsti:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Div"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Div"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI-tegner:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autolagre:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autolagre:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Taster"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "GUI-språk:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Språk i ScummVM-GUIet"
-#: gui/options.cpp:1372
-#, fuzzy
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
-msgstr "Du må omstarte ScummVM for at endringene skal skje. "
+msgstr "Du må starte ScummVM på nytt for at endringene skal tre i kraft. "
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Velg mappe for lagrede spill"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "Den valgte mappen kan ikke skrives til. Vennligst velg en annen."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Velg mappe for GUI-temaer"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Velg mappe for ytterligere filer"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Velg mappe for plugins"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -926,104 +923,140 @@ msgstr ""
"Temaet du valgte støtter ikke det aktive språket. Hvis du vil bruke dette "
"temaet, må du bytte til et annet språk først."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Ingen dato lagret"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Ingen tid lagret"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Ingen spilltid lagret"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Slett"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Vil du virkelig slette dette lagrede spillet?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Dato: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Tid: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Spilltid: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Ikke navngitt spilltilstand"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Lagre"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Klarte ikke å lagre spill."
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Navn:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Velg et tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standard Tegner (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialiased Tegner (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Antialiased (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Tøm verdi"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Motoren støtter ikke debug-nivå '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Meny"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Hopp over linje"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Problem ved kjøring av spill:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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"
@@ -1085,24 +1118,25 @@ msgstr "Spillmotor-plugin støtter ikke lagrede tilstander"
#: common/error.cpp:71
msgid "User canceled"
-msgstr ""
+msgstr "Brukeren avbrøt"
#: common/error.cpp:75
msgid "Unknown error"
msgstr "Ukjent feil"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
-msgstr ""
+msgstr "Spillet i '%s' ser ut til å være ukjent."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
+"Vennligst rapporter de følgende dataene til ScummVM-teamet sammen med navnet"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
-msgstr ""
+msgstr "på spillet du forsøkte å legge til, og dets versjon/språk/etc.:"
#: engines/dialogs.cpp:84
msgid "~R~esume"
@@ -1128,22 +1162,23 @@ msgstr "~H~jelp"
msgid "~A~bout"
msgstr "~O~m"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~T~ilbake til oppstarter"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~T~ilbake til oppstarter"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Lagret spill:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1152,51 +1187,54 @@ msgstr "Lagret spill:"
msgid "Save"
msgstr "Lagre"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
"further assistance."
msgstr ""
+"Beklager, men denne motoren støtter for øyeblikket ikke hjelp i spillet. "
+"Vennligst se i README-filen for grunnleggende informasjon, og for "
+"instruksjoner om hvordan du kan få ytterligere hjelp."
-#: engines/dialogs.cpp:243
+#: engines/dialogs.cpp:228
#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
+"Lagring av spilltilstand feilet (%s)! Vennligst konsulter README-filen for "
+"grunnleggende informasjon og instruksjon om hvordan du får ytterligere hjelp."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~A~vbryt"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~aster"
#: engines/engine.cpp:235
msgid "Could not initialize color format."
-msgstr ""
+msgstr "Kunne ikke initalisere fargeformat."
#: engines/engine.cpp:243
-#, fuzzy
msgid "Could not switch to video mode: '"
-msgstr "Nåværende videomodus:"
+msgstr "Kunne ikke veksle til videomodus: '"
#: engines/engine.cpp:252
-#, fuzzy
msgid "Could not apply aspect ratio setting."
-msgstr "Veksle aspekt-rate korrigering"
+msgstr "Kunne ikke aktivere aspektrate-innstilling."
#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
-msgstr ""
+msgstr "Kunne ikke aktivere fullskjermsinnstilling."
#: engines/engine.cpp:357
msgid ""
@@ -1206,6 +1244,11 @@ msgid ""
"the data files to your hard disk instead.\n"
"See the README file for details."
msgstr ""
+"Du ser ut til å spille dette spillet direkte fra\n"
+"CDen. Dette er kjent for å skape problemer,\n"
+"og det er derfor anbefalt at du kopierer\n"
+"datafilene til harddisken din istedet.\n"
+"Se README-filen for detaljer."
#: engines/engine.cpp:368
msgid ""
@@ -1229,15 +1272,97 @@ msgid ""
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
"not work in future versions of ScummVM."
msgstr ""
+"ADVARSEL: Spillet du prøver å starte er ikke fullstendig støttet av ScummVM. "
+"Derfor er det sannsynlig at det vil være ustabilt, og det er ikke sikkert at "
+"lagrede spill vil fortsette å fungere i fremtidige versjoner av ScummVM."
#: engines/engine.cpp:442
msgid "Start anyway"
+msgstr "Start allikevel"
+
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Bruk originale lagre/laste-skjermer"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr "Bruk de originale lagre/laste-skjermene, istedenfor ScummVM-variantene"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Gjennopprett spill:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Gjenopprett"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Bruk lys palettmodus"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Vis grafikk med spillets lyse palett"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA av-dithering"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Aktiver av-dithering i EGA-spill"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Foretrekk digitale lydeffekter"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Foretrekk digitale lydeffekter fremfor syntetiske"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Bruk IMF/Yamaha-FB-01 for MIDI-output"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
msgstr ""
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Bruk CD-lyd"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Bruk CD-lyd istedenfor spillets lyd, hvis tilgjengelig"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Bruk Windows-muspekere"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr "Bruk Windows-muspekerene (mindre, og monokrome) isteden"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Bruk sølvmuspekere"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Bruk det alternative settet med sølvmuspekere, istedenfor de normale gylne."
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
-msgstr ""
+msgstr "Sett inn disk %c, og trykk Tast for å fortsette."
#: engines/scumm/dialogs.cpp:176
#, c-format
@@ -1251,25 +1376,23 @@ msgstr ""
#: engines/scumm/dialogs.cpp:178
msgid "Game Paused. Press SPACE to Continue."
-msgstr ""
+msgstr "Spill pauset. Trykk på MELLOMROMstasten for å fortsette."
#. I18N: You may specify 'Yes' symbol at the end of the line, like this:
#. "Moechten Sie wirklich neu starten? (J/N)J"
#. Will react to J as 'Yes'
#: engines/scumm/dialogs.cpp:182
-#, fuzzy
msgid "Are you sure you want to restart? (Y/N)"
-msgstr " Er du sikker på at du vil avslutte ?"
+msgstr "Er du sikker på at du vil avslutte? (Y/N)"
#. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment
#: engines/scumm/dialogs.cpp:184
-#, fuzzy
msgid "Are you sure you want to quit? (Y/N)"
-msgstr " Er du sikker på at du vil avslutte ?"
+msgstr "Er du sikker på at du vil avslutte? (Y/N)"
#: engines/scumm/dialogs.cpp:189
msgid "Play"
-msgstr ""
+msgstr "Spill"
#: engines/scumm/dialogs.cpp:191 engines/scumm/help.cpp:82
#: engines/scumm/help.cpp:84
@@ -1286,38 +1409,37 @@ msgstr ""
#: engines/scumm/dialogs.cpp:194
msgid "You must enter a name"
-msgstr ""
+msgstr "Du må skrive inn et navn"
#: engines/scumm/dialogs.cpp:195
msgid "The game was NOT saved (disk full?)"
-msgstr ""
+msgstr "Spillet ble IKKE lagret (full disk?)"
#: engines/scumm/dialogs.cpp:196
msgid "The game was NOT loaded"
-msgstr ""
+msgstr "Spillet ble IKKE lastet"
#: engines/scumm/dialogs.cpp:197
#, c-format
msgid "Saving '%s'"
-msgstr ""
+msgstr "Lagrer '%s'"
#: engines/scumm/dialogs.cpp:198
#, c-format
msgid "Loading '%s'"
-msgstr ""
+msgstr "Laster '%s'"
#: engines/scumm/dialogs.cpp:199
msgid "Name your SAVE game"
-msgstr ""
+msgstr "Gi det LAGREDE spillet ditt et navn"
#: engines/scumm/dialogs.cpp:200
-#, fuzzy
msgid "Select a game to LOAD"
-msgstr "Velg et tema"
+msgstr "Velg et spill for LASTING"
#: engines/scumm/dialogs.cpp:201
msgid "Game title)"
-msgstr ""
+msgstr "Spilltittel)"
#. I18N: Previous page button
#: engines/scumm/dialogs.cpp:287
@@ -1335,25 +1457,21 @@ msgid "~C~lose"
msgstr "~L~ukk"
#: engines/scumm/dialogs.cpp:597
-#, fuzzy
msgid "Speech Only"
-msgstr "Tale"
+msgstr "Kun tale"
#: engines/scumm/dialogs.cpp:598
-#, fuzzy
msgid "Speech and Subtitles"
-msgstr "Undertekster"
+msgstr "Tale og undertekster"
#: engines/scumm/dialogs.cpp:599
-#, fuzzy
msgid "Subtitles Only"
-msgstr "Undertekster"
+msgstr "Kun undertekster"
#: engines/scumm/dialogs.cpp:607
-#, fuzzy
msgctxt "lowres"
msgid "Speech & Subs"
-msgstr "Tale"
+msgstr "Tekst & Tale"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
@@ -1361,20 +1479,19 @@ msgstr ""
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Referer til Loom(TM)-håndboka di for hjelp."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standard (16bpp)"
+msgstr "Standard"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Trening"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Ekspert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1507,9 +1624,8 @@ msgid " since they may cause crashes"
msgstr " de kan forårsake kræsj, eller"
#: engines/scumm/help.cpp:110
-#, fuzzy
msgid " or incorrect game behavior."
-msgstr " feilaktig spilloppførsel."
+msgstr " eller feilaktig spilloppførsel."
#: engines/scumm/help.cpp:114
msgid "Spinning drafts on the keyboard:"
@@ -1897,7 +2013,7 @@ msgid ""
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1908,7 +2024,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1919,7 +2035,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1930,7 +2046,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1952,115 +2068,143 @@ msgstr "~O~verganger aktivert"
#. I18N: Drop book page
#: engines/mohawk/dialogs.cpp:95
msgid "~D~rop Page"
-msgstr ""
+msgstr "~D~ropp Side"
#: engines/mohawk/dialogs.cpp:99
msgid "~S~how Map"
-msgstr ""
+msgstr "Vi~s~ Kart"
#: engines/mohawk/dialogs.cpp:105
-#, fuzzy
msgid "~M~ain Menu"
-msgstr "ScummVM Hovedmeny"
+msgstr "Hoved~m~eny"
#: engines/mohawk/dialogs.cpp:172
msgid "~W~ater Effect Enabled"
msgstr "~V~anneffekt aktivert"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Gjennopprett spill:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Gjenopprett"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
msgid "Cutscene file '%s' not found!"
msgstr ""
-#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:502
-#, fuzzy
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
-msgstr ""
-"Klarte ikke åpne spilltilstand fra fil:\n"
-"\n"
-"%s"
+msgstr "Klarte ikke åpne spilltilstand fra fil."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515
-#, fuzzy
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
-msgstr ""
-"Klarte ikke lagre spilltilstand til fil:\n"
-"\n"
-"%s"
+msgstr "Klarte ikke lagre spilltilstand fra fil."
#: engines/gob/inter_v5.cpp:107
-#, fuzzy
msgid "Failed to delete file."
-msgstr ""
-"Klarte ikke lagre spilltilstand til fil:\n"
-"\n"
-"%s"
+msgstr "Klarte ikke å slette fil."
#: engines/groovie/script.cpp:420
-#, fuzzy
msgid "Failed to save game"
+msgstr "Klarte ikke å lagre spill."
+
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Studiopublikum"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Aktiver studiopublikum"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr ""
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Tillat å hoppe over tekst og kutt-scener"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Helium-modus"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Aktiver helium-modus"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Myk scrolling"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Aktiver myk scrolling når man går"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Flytende muspekere"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Aktiver flytende muspekere"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr ""
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
msgstr ""
-"Klarte ikke lagre spilltilstand til fil:\n"
-"\n"
-"%s"
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Angrep 1"
#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Angrep 2"
#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Angrep 3"
#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Beveg Fremover"
#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Beveg Bakover"
#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Skli mot Venstre"
#: engines/kyra/lol.cpp:484
-#, fuzzy
msgid "Slide Right"
-msgstr "Høyre"
+msgstr "Skli mot Høyre"
#: engines/kyra/lol.cpp:485
-#, fuzzy
msgid "Turn Left"
-msgstr "Slå av"
+msgstr "Svin til Venstre"
#: engines/kyra/lol.cpp:486
-#, fuzzy
msgid "Turn Right"
-msgstr "Peker høyre"
+msgstr "Sving til Høyre"
#: engines/kyra/lol.cpp:487
-#, fuzzy
msgid "Rest"
-msgstr "Gjenopprett"
+msgstr "Hvil"
#: engines/kyra/lol.cpp:488
-#, fuzzy
msgid "Options"
-msgstr "~V~alg"
+msgstr "Valg"
#: engines/kyra/lol.cpp:489
#, fuzzy
@@ -2068,19 +2212,36 @@ msgid "Choose Spell"
msgstr "Velg"
#: engines/kyra/sound_midi.cpp:475
+#, fuzzy
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
+msgstr ""
+"Du ser ut til å bruke en General MIDI-enhet,\n"
+"men spillet ditt støtter bare Roland MT32-MIDI.\n"
+"Vi forsøker å koble Roland MT32-instrumentene til\n"
+"General MIDI-instrumentene. Allikevel, kan det\n"
+"skje at enkelte spor ikke vil spilles riktig."
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
msgstr ""
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Bruk diskettversjonens intro (Kun for CD-versjon)"
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
"Please download it from www.scummvm.org"
msgstr ""
+"Fant ikke filen \"sky.cpt\"!\n"
+"Vennligst last den ned fra www.scummvm.org"
#: engines/sky/compact.cpp:141
msgid ""
@@ -2088,6 +2249,14 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Diskett-intro"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Bruk diskettversjonens intro (Kun for CD-versjon)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
@@ -2116,6 +2285,13 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked again the next "
"time you start the game.\n"
msgstr ""
+"ScummVM oppdaget at du har gamle lagrede spill for Broken Sword 1 som bør "
+"konverteres.\n"
+"Det gamle formatet for lagrede spill støttes ikke lengre, så du vil ikke "
+"være i stand til å laste de lagrede spillene,\n"
+"med mindre du konverterer dem.\n"
+"Trykk OK for å konvertere dem nå, ellers vil du bli spurt igjen neste gang "
+"du starter spillet."
#: engines/sword1/control.cpp:1232
#, c-format
@@ -2126,21 +2302,40 @@ msgstr ""
#: engines/sword1/control.cpp:1235
msgid "Keep the old one"
-msgstr ""
+msgstr "Behold den gamle"
#: engines/sword1/control.cpp:1235
msgid "Keep the new one"
-msgstr ""
+msgstr "Behold den nye"
#: engines/sword1/logic.cpp:1633
msgid "This is the end of the Broken Sword 1 Demo"
-msgstr ""
+msgstr "Dette er slutten på Broken Sword 1-demoen"
#: engines/sword2/animation.cpp:435
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr ""
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+
#: engines/parallaction/saveload.cpp:133
#, c-format
msgid ""
@@ -2148,17 +2343,15 @@ msgid ""
"\n"
msgstr ""
-#: engines/parallaction/saveload.cpp:211
-#, fuzzy
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
-msgstr "Åpne spill:"
+msgstr "Laster spill..."
-#: engines/parallaction/saveload.cpp:226
-#, fuzzy
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
-msgstr "Lagret spill:"
+msgstr "Lagrer spill..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2167,18 +2360,29 @@ msgid ""
"\n"
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
+"ScummVM oppdaget at du har gamle lagrede spill for Nippon Safes som bør "
+"omdøpes.\n"
+"De gamle navnene støttes ikke lengre, så du vil ikke være i stand til å "
+"laste de lagrede spillene,\n"
+"med mindre du konverterer dem.\n"
+"Trykk OK for å konvertere dem nå, ellers vil du bli spurt igjen neste gang "
+"du starter spillet."
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
-msgstr ""
+msgstr "ScummVM konverterte alle de lagrede spillene dine uten problemer."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
"\n"
"Please report to the team."
msgstr ""
+"ScummVM skrev ut noen advarsler i konsollvinduet ditt og kan ikke garantere "
+"at alle filene dine har blitt konvertert.\n"
+"\n"
+"Vennligst rapporter dette til teamet."
#: audio/fmopl.cpp:49
msgid "MAME OPL emulator"
@@ -2194,11 +2398,13 @@ msgid ""
"The selected audio device '%s' was not found (e.g. might be turned off or "
"disconnected)."
msgstr ""
+"Den valgte lydenheten '%s' ble ikke funnet (den kan f.eks. være avslått "
+"eller frakoblet)."
#: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257
#: audio/mididrv.cpp:272
msgid "Attempting to fall back to the next available device..."
-msgstr ""
+msgstr "Forsøker å falle tilbake på den neste tilgjengelige enheten..."
#: audio/mididrv.cpp:221
#, c-format
@@ -2206,6 +2412,8 @@ msgid ""
"The selected audio device '%s' cannot be used. See log file for more "
"information."
msgstr ""
+"Den valgte lydenheten '%s' kan ikke brukes. Se logg-filen for mer "
+"informasjon."
#: audio/mididrv.cpp:257
#, c-format
@@ -2213,6 +2421,8 @@ msgid ""
"The preferred audio device '%s' was not found (e.g. might be turned off or "
"disconnected)."
msgstr ""
+"Den foretrukne lydenheten '%s' ble ikke funnet (den kan f.eks. være avslått "
+"eller frakoblet)."
#: audio/mididrv.cpp:272
#, c-format
@@ -2220,6 +2430,8 @@ msgid ""
"The preferred audio device '%s' cannot be used. See log file for more "
"information."
msgstr ""
+"Den foretrukne lydenheten '%s' kan ikke brukes. Se i logg-filen for mer "
+"informasjon."
#: audio/null.h:43
msgid "No music"
@@ -2242,7 +2454,6 @@ msgid "C64 Audio Emulator"
msgstr "C64 Lydemulator"
#: audio/softsynth/mt32.cpp:293
-#, fuzzy
msgid "Initializing MT-32 Emulator"
msgstr "Initialiserer MT-32-Emulator"
@@ -2273,7 +2484,7 @@ msgstr " (Aktiv)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Blokkert)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2359,29 +2570,27 @@ msgstr "Høy lydkvalitet (tregere) (omstart)"
msgid "Disable power off"
msgstr "Deaktiver strømsparing"
-#: backends/platform/iphone/osys_events.cpp:301
-#, fuzzy
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
-msgstr "Touchpad-modus aktivert."
+msgstr "Mus-klikk-og-dra-modus aktivert."
-#: backends/platform/iphone/osys_events.cpp:303
-#, fuzzy
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
-msgstr "Touchpad-modus deaktivert."
+msgstr "Mus-klikk-og-dra-modus-deaktivert."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Touchpad-modus aktivert."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Touchpad-modus deaktivert."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Klikkmodus"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2389,12 +2598,11 @@ msgstr ""
msgid "Left Click"
msgstr "Venstreklikk"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Midtre venstre gjenstand"
+msgstr "Midtklikk"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2402,7 +2610,6 @@ msgid "Right Click"
msgstr "Høyreklikk"
#: backends/platform/sdl/macosx/appmenu_osx.mm:78
-#, fuzzy
msgid "Hide ScummVM"
msgstr "Skjul ScummVM"
@@ -2432,57 +2639,52 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal (ingen skalering)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
-#, fuzzy
msgid "Enabled aspect ratio correction"
-msgstr "Veksle aspekt-rate korrigering"
+msgstr "Aspekt-rate korrigering aktivert"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
-#, fuzzy
msgid "Disabled aspect ratio correction"
-msgstr "Veksle aspekt-rate korrigering"
+msgstr "Aspekt-rate korrigering deaktivert"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
-#, fuzzy
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
-msgstr "Bytt grafikkfiltre"
+msgstr "Aktivt grafikkfilter:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
-#, fuzzy
msgid "Windowed mode"
-msgstr "Tegnemodus:"
+msgstr "Vindusmodus"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Bevar"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:415
-#, fuzzy
msgid "Current display mode"
-msgstr "Nåværende videomodus:"
+msgstr "Nåværende videomodus"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:428
msgid "Current scale"
-msgstr ""
+msgstr "Nåværende skala"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
-msgstr ""
+msgstr "Aktiv filtermodus: Linjær"
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
-msgstr ""
+msgstr "Aktiv filtermodus: Nærmeste"
#: backends/platform/symbian/src/SymbianActions.cpp:38
#: backends/platform/wince/CEActionsSmartphone.cpp:39
@@ -2566,7 +2768,7 @@ msgstr "Horisontal underscan:"
#: backends/platform/wii/options.cpp:66
msgid "Vertical underscan:"
-msgstr "Vertikal underscan"
+msgstr "Vertikal underscan:"
#: backends/platform/wii/options.cpp:71
msgid "Input"
@@ -2665,17 +2867,15 @@ msgid "Network down"
msgstr "Nettverket er nede"
#: backends/platform/wii/options.cpp:178
-#, fuzzy
msgid "Initializing network"
msgstr "Initialiserer nettverk"
#: backends/platform/wii/options.cpp:182
-#, fuzzy
msgid "Timeout while initializing network"
msgstr "Timeout under initialisering av nettverk"
#: backends/platform/wii/options.cpp:186
-#, fuzzy, c-format
+#, c-format
msgid "Network not initialized (%d)"
msgstr "Nettverk ikke initialisert (%d)"
@@ -2797,83 +2997,74 @@ msgstr ""
"inventaret"
#: backends/events/default/default-events.cpp:191
-#, fuzzy
msgid "Do you really want to return to the Launcher?"
-msgstr "Vil du virkelig slette dette lagrede spillet?"
+msgstr "Vil du virkelig returnere til oppstarteren?"
#: backends/events/default/default-events.cpp:191
-#, fuzzy
msgid "Launcher"
-msgstr "Slå"
+msgstr "Oppstarter"
#: backends/events/default/default-events.cpp:213
-#, fuzzy
msgid "Do you really want to quit?"
-msgstr "Vil du avslutte?"
+msgstr "Vil du virkelig avslutte?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
-msgstr ""
+msgstr "Touchskjerm 'Tapmodus' - Venstreklikk"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
-msgstr ""
+msgstr "Touchskjerm 'Tapmodus' - Høyreklikk"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
-msgstr ""
+msgstr "Touchskjerm 'Tapmodus' - Sveve (Ingen Klikk)"
-#: backends/events/gph/gph-events.cpp:362
-#, fuzzy
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
-msgstr "Volum"
+msgstr "Maksimalt Volum"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
-msgstr ""
+msgstr "Øker volum"
-#: backends/events/gph/gph-events.cpp:370
-#, fuzzy
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
-msgstr "Volum"
+msgstr "Minimalt Volum"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
-msgstr ""
+msgstr "Senker volum"
#: backends/updates/macosx/macosx-updates.mm:65
msgid "Check for Updates..."
-msgstr ""
+msgstr "Sjekk for oppdateringer..."
#: backends/platform/bada/form.cpp:269
-#, fuzzy
msgid "Right Click Once"
-msgstr "Høyreklikk"
+msgstr "Høyreklikk én gang"
#: backends/platform/bada/form.cpp:277
-#, fuzzy
msgid "Move Only"
-msgstr "Tale"
+msgstr "Kun Beveg"
#: backends/platform/bada/form.cpp:291
msgid "Escape Key"
-msgstr ""
+msgstr "ESC-tast"
#: backends/platform/bada/form.cpp:296
-#, fuzzy
msgid "Game Menu"
-msgstr "Spill"
+msgstr "Spillmeny"
#: backends/platform/bada/form.cpp:301
-#, fuzzy
msgid "Show Keypad"
-msgstr "Vis tastatur"
+msgstr "Vis talltastatur"
#: backends/platform/bada/form.cpp:309
msgid "Control Mouse"
@@ -2881,11 +3072,11 @@ msgstr ""
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
-msgstr ""
+msgstr "Klikking aktivert"
#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
-msgstr ""
+msgstr "Klikking deaktivert"
#~ msgid "Hercules Green"
#~ msgstr "Hercules Grønn"
@@ -2901,7 +3092,6 @@ msgstr ""
#~ msgid "Hercules Amber"
#~ msgstr "Hercules Oransje"
-#, fuzzy
#~ msgid "Save game failed!"
#~ msgstr "Lagret spill:"
diff --git a/po/nn_NO.po b/po/nn_NO.po
index 00dce83302..1b78932a46 100644
--- a/po/nn_NO.po
+++ b/po/nn_NO.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
+"POT-Creation-Date: 2012-08-12 14:57+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"
+"Language: Norsk (nynorsk)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Norsk (nynorsk)\n"
"X-Poedit-Language: Norwegian Nynorsk\n"
"X-Poedit-SourceCharset: iso-8859-1\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "Gå tilbake"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,15 +73,15 @@ msgstr "Steng"
msgid "Mouse click"
msgstr "Musklikk"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Syn Tastatur"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Omkople tastar"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
#, fuzzy
msgid "Toggle FullScreen"
msgstr "Veksle fullskjerm"
@@ -93,18 +94,18 @@ msgstr "Vel ei handling for kopling:"
msgid "Map"
msgstr "Kople"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -131,15 +132,15 @@ msgstr "Vel ei handling"
msgid "Press the key to associate"
msgstr "Trykk tasten du vil kople"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Spel"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -147,29 +148,29 @@ msgstr ""
"Kort spelidentifikator nytta for å referere til lagra spel, og å køyre "
"spelet frå kommandolinja"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Namn:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Full speltittel:"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Namn:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Språk:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -177,286 +178,291 @@ msgstr ""
"Spelets språk. Dette vil ikkje gjere den spanske versjonen av spelet til ein "
"engelsk versjon"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<standard>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plattform spelet opprineleg vart designa for"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+#, fuzzy
+msgid "Engine"
+msgstr "Undersøk"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafikk"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Overstyr globale grafikkinstillingar"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Overstyr globale grafikkinstillingar"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Lyd"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Overstyr globale lydinstillingar"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Overstyr globale lydinstillingar"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volum"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volum"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Overstyr globale voluminstillingar"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Overstyr globale voluminstillingar"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Overstyr globale MIDI-instillingar"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Overstyr globale MIDI-instillingar"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Overstyr globale MT-32-instillingar"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Overstyr globale MT-32-instillingar"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Stiar"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Stiar"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Spelsti:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Spelsti:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Ekstrasti:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr ""
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Ekstrasti:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Lagringssti:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr ""
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Lagringssti:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Ingen"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Standard"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Vel SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Vel mappe med speldata"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr ""
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Vel mappe for lagra spel"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr ""
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~A~vslutt"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Avslutt ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "~O~m..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~V~al..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Endre globale ScummVM-instillingar"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~tart"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Start det velde spelet"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~Å~pne..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Åpne eit lagra spel for the velde spelet"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~L~egg til spel..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Hold Shift nede for å legge til fleire"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~R~ediger spel..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Endre spelinstillingar"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~F~jern spel"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr ""
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~L~egg til spel..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~R~ediger spel..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~F~jern spel"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Søk i spelliste"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Søk:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Åpne spel:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Åpne"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
msgstr ""
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -464,7 +470,7 @@ msgstr ""
msgid "Yes"
msgstr "Ja"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -472,38 +478,38 @@ msgstr "Ja"
msgid "No"
msgstr "Nei"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM kunne ikkje åpne den velde mappa!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM kunne ikkje finne noko spel i den velde mappa!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Vel spelet:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Vil du verkeleg fjerne denne spelkonfigurasjonen?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Dette spelet støttar ikkje åpning av lagra spel frå oppstartaren."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM kunne ikkje finne nokon motor som var i stand til å køyre det velde "
"spelet!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Legg til fleire..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Legg til fleire..."
@@ -570,101 +576,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Ingen"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr ""
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr ""
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr ""
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr ""
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Grafikkmodus:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Teiknemodus:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Spesielle dithering-modus som støttast av nokre spel"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fullskjermsmodus"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Aspekt-korrigering"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Rett opp aspekt for 320x200 spel"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr ""
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr ""
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Føretrukken eining:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr ""
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr ""
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr ""
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr ""
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib emulator:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib nyttast til musikk i mange spel"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr ""
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -672,250 +670,250 @@ msgstr ""
"Høgare verdier gir betre lydkvalitet, men støttast kanskje ikkje av "
"lydkortet ditt"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr ""
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr ""
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Ikkje nytt General MIDI musikk"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr ""
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "SoundFont støttast av enkelte lydkort, Fluidsynth og Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Blanda AdLib/MIDI-modus"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Nytt båe MIDI og AdLib lydskaping"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "MIDI gain:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr ""
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Ekte Roland MT-32 (deaktiver GM-emulering)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
msgstr ""
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Ekte Roland MT-32 (ingen GS-emulering)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Aktiver Roland GS-modus"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr "Slår av General MIDI-kopling for spel med Roland MT-32 lydspor"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Ikkje nytt Roland MT-32 musikk"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Tekst og Tale:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Tale"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Teksting"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Begge"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Undertekstfart:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Tekst og Tale:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Tale"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Tekst"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Båe"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Vis teksting og spel av tale"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Undertekstfart:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Musikkvolum:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Musikkvolum:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Demp alle"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Lydeffektvolum:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr ""
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Lydeffektvolum:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Talevolum:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Talevolum:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Temasti:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Temasti:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Pluginsti:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Pluginsti:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Div"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Div"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI-teiknar:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autolagre:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autolagre:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Tastar"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "GUI-språk:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Språk i ScummVM-GUIet"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
#, fuzzy
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Du må omstarte ScummVM for at endringane skal skje."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Vel mappe for lagra spel"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "Den velde mappa kan ikkje skrivast til. Vennlegst vel ein annan."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Vel ei mappe for GUI-tema:"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Vel ei mappe for ekstra filer"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Vel ei mappe for plugins"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -923,104 +921,140 @@ msgstr ""
"Temaet du har valt støttar ikkje det aktive språket. Om du vil nytte dette "
"temaet må du bytte til eit anna språk først."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Ingen dato lagra"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Inga tid lagra"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Inga speletid lagra"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Slett"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Vil du verkeleg slette det lagra spelet?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Dato: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Tid: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Speletid: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Ikkje navngjeven speltilstand"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Lagre"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Full speltittel:"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Namn:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Vel eit tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standard Teiknar (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialiased Teiknar (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Antialiased (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Tøm verdi"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Motoren støttar ikkje debug-nivå '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Meny"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Hopp over linje"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Feil under køyring av spel:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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."
@@ -1089,16 +1123,16 @@ msgstr ""
msgid "Unknown error"
msgstr "Ukjend feil"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr ""
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr ""
@@ -1126,24 +1160,25 @@ msgstr "~H~jelp"
msgid "~A~bout"
msgstr "~O~m"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
#, fuzzy
msgid "~R~eturn to Launcher"
msgstr "~T~ilbake til oppstarter"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
#, fuzzy
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~T~ilbake til oppstarter"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Lagra spel:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1152,31 +1187,31 @@ msgstr "Lagra spel:"
msgid "Save"
msgstr "Lagre"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
"further assistance."
msgstr ""
-#: engines/dialogs.cpp:243
+#: engines/dialogs.cpp:228
#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~A~vbryt"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~astar"
@@ -1234,6 +1269,86 @@ msgstr ""
msgid "Start anyway"
msgstr ""
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr ""
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Gjenopprett spel:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Gjenopprett"
+
+#: engines/dreamweb/detection.cpp:57
+#, fuzzy
+msgid "Use bright palette mode"
+msgstr "Øvre høgre gjenstand"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr ""
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr ""
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr ""
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr ""
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr ""
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr ""
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr ""
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:433
+#, fuzzy
+msgid "Use silver cursors"
+msgstr "Vanleg peikar"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1897,7 +2012,7 @@ msgid ""
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1905,7 +2020,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1913,7 +2028,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1921,7 +2036,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1958,25 +2073,17 @@ msgstr "ScummVM Hovudmeny"
msgid "~W~ater Effect Enabled"
msgstr "~V~anneffekt aktivert"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Gjenopprett spel:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Gjenopprett"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
msgid "Cutscene file '%s' not found!"
msgstr ""
-#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
msgstr ""
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr ""
@@ -1989,6 +2096,66 @@ msgstr ""
msgid "Failed to save game"
msgstr "Full speltittel:"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr ""
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr ""
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr ""
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr ""
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr ""
+
+#: engines/kyra/detection.cpp:85
+#, fuzzy
+msgid "Enable helium mode"
+msgstr "Aktiver Roland GS-modus"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr ""
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr ""
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+#, fuzzy
+msgid "Floating cursors"
+msgstr "Vanleg peikar"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr ""
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr ""
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr ""
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
@@ -2048,8 +2215,16 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
+msgstr ""
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
msgstr ""
#: engines/sky/compact.cpp:130
@@ -2064,6 +2239,14 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr ""
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr ""
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
@@ -2117,6 +2300,25 @@ msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr ""
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+
#: engines/parallaction/saveload.cpp:133
#, c-format
msgid ""
@@ -2124,17 +2326,17 @@ msgid ""
"\n"
msgstr ""
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
#, fuzzy
msgid "Loading game..."
msgstr "Åpne spel:"
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
#, fuzzy
msgid "Saving game..."
msgstr "Lagra spel:"
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2144,11 +2346,11 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr ""
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2335,27 +2537,27 @@ msgstr ""
msgid "Disable power off"
msgstr "Deaktiver strømsparing"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr ""
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr ""
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2363,12 +2565,12 @@ msgstr ""
msgid "Left Click"
msgstr "Venstreklikk"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
#, fuzzy
msgid "Middle Click"
msgstr "Midtre venstre gjenstand"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2406,38 +2608,38 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal (inga skalering)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
#, fuzzy
msgid "Disabled aspect ratio correction"
msgstr "Veksle aspekt-korrigering"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
#, fuzzy
msgid "Active graphics filter:"
msgstr "Veksle grafikkfiltre"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
#, fuzzy
msgid "Windowed mode"
msgstr "Teiknemodus:"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Bevar"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
@@ -2782,39 +2984,39 @@ msgstr "Slå"
msgid "Do you really want to quit?"
msgstr "Vil du avslutte?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr ""
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr ""
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr ""
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
#, fuzzy
msgid "Maximum Volume"
msgstr "Volum"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr ""
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
#, fuzzy
msgid "Minimal Volume"
msgstr "Volum"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr ""
diff --git a/po/pl_PL.po b/po/pl_PL.po
index d74c40f47d..1bf44d1a66 100644
--- a/po/pl_PL.po
+++ b/po/pl_PL.po
@@ -1,20 +1,20 @@
# Polish translation for ScummVM.
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
-# Grajpopolsku.pl <grajpopolsku@gmail.com>, 2011.
+# Grajpopolsku.pl <grajpopolsku@gmail.com>, 2011-2012.
#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-10-24 21:14+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-29 15:49+0100\n"
"Last-Translator: Micha³ Zi±bkowski <mziab@o2.pl>\n"
"Language-Team: Grajpopolsku.pl <grajpopolsku@gmail.com>\n"
+"Language: Polski\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Polski\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: Polish\n"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "W górê"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,16 +73,15 @@ msgstr "Zamknij"
msgid "Mouse click"
msgstr "Klikniêcie"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Wy¶wietl klawiaturê"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Dostosuj klawisze"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "W³±cz/wy³±cz pe³ny ekran"
@@ -93,18 +93,18 @@ msgstr "Wybierz akcjê do przypisania"
msgid "Map"
msgstr "Przypisz"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -131,15 +131,15 @@ msgstr "Wybierz akcjê"
msgid "Press the key to associate"
msgstr "Wci¶nij klawisz do przypisania"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Gra"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -147,315 +147,319 @@ msgstr ""
"Krótki identyfikator gry u¿ywany do rozpoznawania zapisów i uruchamiania gry "
"z linii komend"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Nazwa:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Pe³ny tytu³ gry:"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Nazwa:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Jêzyk:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr "Jêzyk gry. Nie zmieni to hiszpañskiej wersji gry w angielsk±."
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<domy¶lne>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Platforma:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Platforma, na któr± stworzono grê"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Platforma:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Silnik"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafika"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "Grafika"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "U¿yj w³asnych ustawieñ grafiki"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "U¿yj w³asnych ustawieñ grafiki"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "D¼wiêk"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "U¿yj w³asnych ustawieñ d¼wiêku"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "U¿yj w³asnych ustawieñ d¼wiêku"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "G³o¶no¶æ"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "G³o¶no¶æ"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "U¿yj w³asnych ustawieñ g³o¶no¶ci"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "U¿yj w³asnych ustawieñ g³o¶no¶ci"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "U¿yj w³asnych ustawieñ MIDI"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "U¿yj w³asnych ustawieñ MIDI"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "U¿yj w³asnych ustawieñ MT-32"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "U¿yj w³asnych ustawieñ MT-32"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "¦cie¿ki"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "¦cie¿ki"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "¦cie¿ka gry:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "¦cie¿ka gry:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "¦c. dodatków:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Okre¶la ¶cie¿kê dodatkowych danych gry"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "¦c. dodatków:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "¦cie¿ka zapisów:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Okre¶la gdzie zapisywaæ stan gry"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "¦cie¿ka zapisów:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Brak"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Domy¶lnie"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Wybierz SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Wybierz katalog z plikami gry"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Wybierz dodatkowy katalog gry"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Wybierz katalog dla zapisów"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Identyfikator jest ju¿ zajêty. Wybierz inny."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~Z~akoñcz"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Zakoñcz ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "I~n~formacje..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Ksi±¿ka ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~pcje..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Zmieñ ustawienia ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~tart"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Rozpocznij wybran± grê"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~W~czytaj..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Wczytaj zapis wybranej gry"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~D~odaj grê..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Przytrzymaj Shift, by dodawaæ zbiorowo"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~E~dytuj grê..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Zmieñ opcje gry"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~U~suñ grê"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Usuwa grê z listy. Pliki gry pozostaj± nietkniête"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~D~odaj grê..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~E~dytuj grê..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~U~suñ grê"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Wyszukaj grê na li¶cie"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Szukaj"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Wczytaj grê:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Wczytaj"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
msgstr ""
"Chcesz uruchomiæ masowy detektor gier? Mo¿e dodaæ wiele tytu³ów do listy"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -463,7 +467,7 @@ msgstr ""
msgid "Yes"
msgstr "Tak"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -471,36 +475,36 @@ msgstr "Tak"
msgid "No"
msgstr "Nie"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM nie mo¿e otworzyæ katalogu!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM nie znalaz³ ¿adnej gry w tym katalogu!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Wybierz grê:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Na pewno chcesz usun±æ tê grê z konfiguracji?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Ta gra nie wspiera wczytywania z launchera."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr "ScummVM nie znalaz³ silnika zdolnego uruchomiæ wybran± grê!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Masowe dodawanie..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Masowe dodawanie..."
@@ -567,101 +571,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Brak"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Nie uda³o siê zastosowaæ czê¶ci zmian opcji grafiki:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "nie uda³o siê zmieniæ trybu wideo."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "nie uda³o siê zmieniæ trybu pe³noekranowego"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "nie uda³o siê zmieniæ formatu obrazu"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Tryb grafiki:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Renderer:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Specjalne tryby ditheringu wspierane przez niektóre gry"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Pe³ny ekran"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Korekcja formatu obrazu"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Korekcja formatu obrazu dla gier 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "Anty-dithering EGA"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "W³±cz anty-dithering we wspieranych grach EGA"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Pref. urz±dzenie:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Urz. muzyczne:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Okre¶la preferowane urz±dzenie d¼wiêkowe lub emulator karty d¼wiêkowej"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Okre¶la wyj¶ciowe urz±dzenie d¼wiêkowe lub emulator karty d¼wiêkowej"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Pref. urz±dzenie:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Urz. muzyczne:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "Emulator AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib jest u¿ywany do muzyki w wielu grach"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Czêst. wyj.:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -669,63 +665,63 @@ msgstr ""
"Wy¿sze warto¶ci daj± lepsz± jako¶æ d¼wiêku, ale mog± byæ nieobs³ugiwane "
"przez twoj± kartê d¼wiêkow±"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "Urz±dzenie GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Okre¶la domy¶lne urz±dzenie d¼wiêkowe dla wyj¶cia General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Nie u¿ywaj muzyki General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "U¿yj pierwszego dostêpnego urz±dzenia"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
"SoundFont jest wspierany przez niektóre karty d¼wiêkowe, Fluidsynth i "
"Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Tryb miksowanego AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "U¿ywaj obu generatorów d¼wiêku, MIDI i AdLib, jednocze¶nie"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Wzm. MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Urz±dzenie MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Okre¶la domy¶lne urz±dzenie d¼wiêku dla wyj¶cia Roland MT-32/LAPC1/CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Prawdziwy Roland MT-32 (wy³±cz emulacjê GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -733,191 +729,191 @@ msgstr ""
"Zaznacz, je¶li chcesz u¿ywaæ swojej prawdziwej karty kompatybilnej z Roland "
"pod³±czonej do twojego komputera"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Prawdziwy Roland MT-32 (brak emulacji GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "W³±cz tryb Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"Wy³±cza mapowanie General MIDI dla gier ze ¶cie¿k± d¼wiêkow± Roland MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Nie u¿ywaj muzyki Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Tekst i mowa:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Mowa"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Napisy"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Oba"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Prêd. napisów:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Tekst i mowa:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Mowa"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Napisy"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Oba"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Wy¶wietlaj napisy i odtwarzaj mowê"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Prêd. napisów:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "G³o¶no¶æ muzyki:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "G³o¶no¶æ muzyki:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Wycisz"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "G³. efekt. d¼w.:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "G³o¶no¶æ efektów d¼w."
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "G³. efekt. d¼w.:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "G³o¶no¶æ mowy:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "G³o¶no¶æ mowy:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "¦cie¿ka stylu:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "¦cie¿ka stylu:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr "Okre¶la ¶cie¿kê dla dodatkowych danych dla wszystkich gier lub ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "¦cie¿ka wtyczek:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "¦cie¿ka wtyczek:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Ró¿ne"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Ró¿ne"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Styl:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "Renderer interf.:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autozapis:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autozapis:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Klawisze"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Jêzyk interfejsu:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Jêzyk interfejsu ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Musisz zrestartowaæ ScummVM, by zmiany zosta³y uwzglêdnione."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Wybierz katalog zapisów"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "Ten katalog jest zabezpieczony przed zapisem. Wybierz inny."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Wybierz katalog dla stylów GUI."
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Wybierz katalog dla dodatkowych plików"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Wybierz katalog dla wtyczek"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -925,104 +921,140 @@ msgstr ""
"Wybrany styl nie obs³uguje obecnego jêzyka. Je¶li chcesz go u¿ywaæ, zmieñ "
"najpierw swój jêzyk."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Brak daty"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Brak godziny"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Brak czasu gry"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Skasuj"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Na pewno chcesz skasowaæ ten zapis?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Data: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Czas: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Czas gry: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Zapis bez nazwy"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Zapisz"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Nie uda³o siê zapisaæ stanu gry"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Nazwa:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Wybierz styl"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "Wy³±czona grafika"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Wy³±czona grafika"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standardowy renderer (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standardowy (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Wyg³adzany renderer (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Wyg³adzany (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Wyczy¶æ"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Silnik nie wspiera poziomu debugowania '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Wstrzymaj"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Pomiñ liniê"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "B³±d podczas uruchamiania gry:"
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr "Nie uda³o siê znale¼æ silnika zdolnego do uruchomienia zaznaczonej gry"
@@ -1090,16 +1122,16 @@ msgstr "Przerwane przez u¿ytkownika"
msgid "Unknown error"
msgstr "Nieznany b³±d"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "Gra w '%s' wygl±da na nieznan±."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr "Przeka¿ poni¿sze dane zespo³owi ScummVM razem z nazw±"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "gry, któr± próbowa³e¶ dodaæ oraz jej wersj±, jêzykiem itd.:"
@@ -1127,22 +1159,23 @@ msgstr "~P~omoc"
msgid "~A~bout"
msgstr "~I~nformacje"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~P~owrót do launchera"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~P~owrót do launchera"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Zapis:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1151,7 +1184,7 @@ msgstr "Zapis:"
msgid "Save"
msgstr "Zapisz"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1161,27 +1194,26 @@ msgstr ""
"uzyskaæ podstawowe informacje oraz dowiedzieæ jak szukaæ dalszej pomocy, "
"sprawd¼ plik README."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Przepraszamy, ten silnik obecnie nie oferuje pomocy wewn±trz gry. Aby "
-"uzyskaæ podstawowe informacje oraz dowiedzieæ jak szukaæ dalszej pomocy, "
-"sprawd¼ plik README."
+"Zapis stanu gry nie powiód³ siê (%s)! Aby uzyskaæ podstawowe informacje oraz "
+"dowiedzieæ jak szukaæ dalszej pomocy, sprawd¼ plik README."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
-msgstr "~O~K"
+msgstr ""
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~A~nuluj"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~K~lawisze"
@@ -1226,14 +1258,13 @@ msgstr ""
"Dalsze informacje s± dostêpne w pliku README."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Przepraszamy, ten silnik obecnie nie oferuje pomocy wewn±trz gry. Aby "
-"uzyskaæ podstawowe informacje oraz dowiedzieæ jak szukaæ dalszej pomocy, "
-"sprawd¼ plik README."
+"Odczyt stanu gry nie powiód³ siê (%s)! Aby uzyskaæ podstawowe informacje "
+"oraz dowiedzieæ jak szukaæ dalszej pomocy, sprawd¼ plik README."
#: engines/engine.cpp:439
msgid ""
@@ -1249,6 +1280,88 @@ msgstr ""
msgid "Start anyway"
msgstr "W³±cz mimo tego"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "U¿yj oryginalnych ekranów odczytu/zapisu"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr "U¿yj oryginalnych ekranów odczytu/zapisu zamiast tych ze ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Wznów grê:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Wznów"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "U¿yj trybu jasnej palety"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Wy¶wietlaj grafikê za pomoc± jasnej palety gry"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "Anty-dithering EGA"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "W³±cz anty-dithering we wspieranych grach EGA"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Preferuj cyfrowe efekty d¼wiêkowe"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Preferuj cyfrowe efekty d¼wiêkowe zamiast syntezowanych"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "U¿yj IMF/Yamaha FB-01 dla wyj¶cia MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"U¿yj karty IBM Music Feature lub modu³u syntezy FM Yamaha FB-01 dla wyj¶cia "
+"MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "U¿yj CD audio"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "U¿yj CD audio zamiast muzyki w grze, je¶li jest dostêpne"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "U¿yj windowsowych kursorów"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"U¿yj windowsowych kursorów (mniejsze i monochromatyczne) zamiast DOS-owych"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "U¿yj srebrnych kursorów"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"U¿yj alternatywnego zestawu srebrnych kursorów zamiast zwyk³ych z³otych"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1365,24 +1478,23 @@ msgstr "Mowa i napisy"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Wybierz poziom umiejêtno¶ci."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Pomocy szukaj w instrukcji do³±czonej do Loom(TM)."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standardowy (16bpp)"
+msgstr "Standardowy"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Trening"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Ekspert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1906,7 +2018,7 @@ msgstr ""
"Natywne wsparcie MIDI wymaga aktualizacji Rolanda od LucasArts,\n"
"ale brakuje %s. Prze³±czam na tryb AdLib."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1917,7 +2029,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1928,7 +2040,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1939,7 +2051,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1975,25 +2087,17 @@ msgstr "~M~enu g³ówne"
msgid "~W~ater Effect Enabled"
msgstr "~E~fekty wody w³±czone"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Wznów grê:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Wznów"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Nie uda³o siê zapisaæ stanu gry do pliku."
@@ -2005,73 +2109,134 @@ msgstr "Nie uda³o siê usun±æ pliku."
msgid "Failed to save game"
msgstr "Nie uda³o siê zapisaæ stanu gry"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Publiczno¶æ studyjna"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "W³±cz publiczno¶æ studyjn±"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Obs³uga pomijania"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Pozwól pomijaæ tekst i przerywniki"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Tryb helowy"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "W³±cz tryb helowy"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "P³ynne przewijanie"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "W³±cz p³ynne przewijanie przy chodzeniu"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "P³ywaj±ce kursory"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "W³±cz p³ywaj±ce kursory"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Histogramy HP"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "W³±cz histogramy punktów ¿ycia"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Atak 1"
#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Atak 2"
#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Atak 3"
#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Ruch naprzód"
#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Ruch wstecz"
#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "¦lizg w lewo"
#: engines/kyra/lol.cpp:484
-#, fuzzy
msgid "Slide Right"
-msgstr "W prawo"
+msgstr "¦lizg w prawo"
#: engines/kyra/lol.cpp:485
-#, fuzzy
msgid "Turn Left"
-msgstr "Wy³±cz"
+msgstr "Obrót w lewo"
#: engines/kyra/lol.cpp:486
-#, fuzzy
msgid "Turn Right"
-msgstr "Kursor w prawo"
+msgstr "Obrót w prawo"
#: engines/kyra/lol.cpp:487
-#, fuzzy
msgid "Rest"
-msgstr "Wznów"
+msgstr "Odpoczynek"
#: engines/kyra/lol.cpp:488
-#, fuzzy
msgid "Options"
-msgstr "~O~pcje"
+msgstr "Opcje"
#: engines/kyra/lol.cpp:489
-#, fuzzy
msgid "Choose Spell"
-msgstr "Wybierz"
+msgstr "Wybierz zaklêcie"
#: engines/kyra/sound_midi.cpp:475
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Wygl±da na to, ¿e u¿ywasz urz±dzenia General MIDI, ale gra obs³uguje tylko "
"MIDI Roland MT32.\n"
"Próbujemy przypisaæ instrumenty Rolanda MT32 do instrumentów General MIDI. "
"Niektóre utwory mog± byæ ¼le odtwarzane."
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "U¿yj intra z wersji dyskietkowej (tylko dla wersji CD)"
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
@@ -2088,10 +2253,20 @@ msgstr ""
"Plik \"sky.cpt\" ma nieprawid³owy rozmiar.\n"
"Pobierz go (ponownie) ze strony www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Intro z wersji dyskietkowej"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "U¿yj intra z wersji dyskietkowej (tylko dla wersji CD)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
msgstr ""
+"Przerywnik w formacie strumieniowym PSX '%s' nie mo¿e zostaæ odtworzony w "
+"trybie indeksowanym"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2148,12 +2323,30 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "To koniec dema Broken Sword 1"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"Znaleziono przerywniki w formacie DXA, ale ScummVM jest skompilowany bez "
-"obs³ugi zlib"
+"Znaleziono przerywniki PSX, ale ScummVM jest skompilowany bez obs³ugi trybu "
+"RGB"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Poka¿ etykiety obiektów"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Poka¿ etykiety obiektów przy najechaniu myszk±"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2164,15 +2357,15 @@ msgstr ""
"Nie mo¿na zapisaæ w slocie %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Wczytywanie stanu gry..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Zapisywanie stanu gry..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2188,11 +2381,11 @@ msgstr ""
"Naci¶nij OK, ¿eby je teraz przekonwertowaæ. W przeciwnym wypadku zostaniesz "
"zapytany ponownie przy nastêpnym w³±czeniu gry.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM pomy¶lnie przekonwertowa³ wszystkie twoje zapisy."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2294,9 +2487,8 @@ msgid "Keymap:"
msgstr "Klawisze:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
-msgstr " (Aktywny)"
+msgstr " (Dzia³a)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
@@ -2304,7 +2496,7 @@ msgstr " (Aktywny)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (Zablokowany)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2390,27 +2582,27 @@ msgstr "D¼wiêk wysokiej jako¶ci (wolniejszy) (restart)"
msgid "Disable power off"
msgstr "Nie wy³±czaj zasilania"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "W³±czono tryb kliknij i przeci±gaj."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Wy³±czono tryb kliknij i przeci±gaj."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Tryb touchpada w³±czony."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Tryb touchpada wy³±czony."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Tryb klikania"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2418,12 +2610,11 @@ msgstr ""
msgid "Left Click"
msgstr "Klikniêcie LPM"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Przedmiot na ¶rodku, z lewej"
+msgstr "¦rodkowy przycisk"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2460,34 +2651,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Zwyk³y (bez skalowania)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Wy³±czono korekcjê formatu obrazu"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Aktywny filtr graficzny:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Okno"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL - normalny"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL - zachowanie proporcji"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL - oryginalny rozmiar"
@@ -2825,37 +3016,37 @@ msgstr ""
msgid "Do you really want to quit?"
msgstr "Na pewno chcesz wyj¶æ?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Dotkniêcie ekranu - klikniêcie LPM"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Dotkniêcie ekranu - klikniêcie PPM"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Dotkniêcie ekranu - brak klikniêcia"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Maksymalna g³o¶no¶æ"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Zwiêkszenie g³o¶no¶ci"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Minimalna g³o¶no¶æ"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Zmniejszenie g³o¶no¶ci"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 16293a543f..f41aa7d59f 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
+"POT-Creation-Date: 2012-08-12 14:57+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"
+"Language: Portugues (Brasil)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Portugues (Brasil)\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Poedit-Language: Portuguese\n"
"X-Poedit-Country: BRAZIL\n"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "Acima"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,15 +73,15 @@ msgstr "Fechar"
msgid "Mouse click"
msgstr "Clique do mouse"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Mostrar teclado"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Remapear teclas"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
#, fuzzy
msgid "Toggle FullScreen"
msgstr "Habilita Tela Cheia"
@@ -93,18 +94,18 @@ msgstr "Selecione uma ação para mapear"
msgid "Map"
msgstr "Mapear"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -131,15 +132,15 @@ msgstr "Por favor selecione uma ação"
msgid "Press the key to associate"
msgstr "Pressione a tecla para associar"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Jogo"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "Código:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -147,309 +148,314 @@ msgstr ""
"Código identificador usado para se referir a jogos salvos e execução do jogo "
"a partir da linha de comando"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "Código:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Nome:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Título completo do jogo"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Nome:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Idioma:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr "Idioma do jogo. Isto não irá passar seu jogo Inglês para Português"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<padrão>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Sistema:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Sistema que o jogo foi desenvolvido originalmente"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Sistema:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+#, fuzzy
+msgid "Engine"
+msgstr "Examinar"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Gráficos"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Sobrepor configuração global de gráficos"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Sobrepor configuração global de gráficos"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Áudio"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Sobrepor configuração global de áudio"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Sobrepor configuração global de áudio"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volume"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volume"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Sobrepor configuração global de volume"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Sobrepor configuração global de volume"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Sobrepor configuração global de MIDI"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Sobrepor configuração global de MIDI"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Sobrepor configuração global de MT-32"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Sobrepor configuração global de MT-32"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Pastas"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Pastas"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Pasta do Jogo:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Pasta do Jogo:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Pasta de Extras"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Especifique a pasta para dados utilizados no jogo"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Pasta de Extras"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Pasta para Salvar"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Especifique onde guardar seus jogos salvos"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Pasta para Salvar"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Nenhum(a)"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Padrão"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Selecione o SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Selecione a pasta com os arquivos do jogo"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Selecione a pasta adicional do jogo"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Selecione a pasta para os jogos salvos"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Este código já esta sendo utilizado. Por favor, escolha outro."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~S~air"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Sair do ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "So~b~re..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Sobre o ScumnmVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~O~pções"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Alterar opções globais do ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~I~niciar"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Iniciar jogo selecionado"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~C~arregar"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Carregar jogo salvo do jogo selecionado"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~A~dicionar Jogo..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Segure Shift para Multi-Adição"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "~E~ditar Jogo..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Alterar opções do jogo"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~R~emover Jogo"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr ""
"Remover jogo da lista. Os arquivos de dados do jogo permanecem intactos"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~A~dicionar Jogo..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "~E~ditar Jogo..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~R~emover Jogo"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Pesquisar na lista de jogos"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Pesquisar:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Carregar jogo:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Carregar"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -457,7 +463,7 @@ msgstr ""
"Você realmente deseja adicionar vários jogos ao mesmo tempo? Isso poderá "
"resultar em uma adição gigantesca de jogos."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -465,7 +471,7 @@ msgstr ""
msgid "Yes"
msgstr "Sim"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -473,38 +479,38 @@ msgstr "Sim"
msgid "No"
msgstr "Não"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM não conseguiu abrir a pasta especificada!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM não encontrou nenhum jogo na pasta especificada!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Escolha o jogo:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Você deseja realmente remover a configuração deste jogo?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Este jogo não suporta abrir jogos a partir do menu principal."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM não conseguiu encontrar qualquer programa capaz de rodar o jogo "
"selecionado!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Multi-Adição..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Multi-Adição..."
@@ -575,101 +581,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Nenhum(a)"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Falha ao aplicar algumas mudanças nas opções de gráfico:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "o modo de vídeo não pôde ser alterado."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "a configuração de tela cheia não pôde ser mudada"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "a configuração de proporção não pôde ser mudada"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Modo gráfico:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Renderização"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Modos especiais de dithering suportados por alguns jogos"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Modo Tela Cheia"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Correção de proporção"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Correção de proporção para jogos 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA sem dithering"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Habilita EGA sem dithering em jogos com suporte"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Dispositivo pref.:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Disp. de música:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Especifica o dispositivo de som preferido ou emulador de placa de som"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Especifica o dispositivo de saída de som ou emulador de placa de som"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Dispositivo pref.:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Dispositivo de música:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "Emulador AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib é utilizado para música em vários jogos"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Taxa de saída:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -677,62 +675,62 @@ msgstr ""
"Maior valor especifica melhor qualidade de som, mas pode não ser suportado "
"por sua placa de som"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "Dispositivo GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Especifique o dispositivo de som padrão para a saída General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Não usar música General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Usar o primeiro dispositivo disponível"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "SoundFont é suportado por algumas placas de som, Fluidsynth e Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Mixar AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Usar MIDI e AdLib juntos na geração de som"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "Ganho MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Dispositivo MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Especifique o dispositivo de som padrão para a saída Roland MT-32/LAPC1/"
"CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Roland MT-32 real (desligar emulação GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -740,193 +738,193 @@ msgstr ""
"Verifique se você quer usar o seu dispositivo de hardware de som compatível "
"com Roland"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Roland MT-32 real (sem emulação GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Ligar modo Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"Desliga o mapeamento General MIDI para jogos com trilha sonora Roland MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Não usar música Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Texto e Voz:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Voz"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Legendas"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Ambos"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Rapidez legendas:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Texto e Voz:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Voz"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Legs"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Ambos"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Mostrar legenda e vozes (dublagem)"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Velocidade das legendas:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Volume da Música:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Volume da Música:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Mudo"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "Volume dos Sons:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volume dos efeitos sonoros especiais"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "Volume dos Sons:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Volume da Voz:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Volume da Voz:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Pasta do Tema"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Pasta do Tema"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"Especifica a pasta para os dados adicionais usados por todos os jogos ou "
"ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Pasta de Plugins:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Pasta de Plugins:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Outros"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Outros"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "Renderizador GUI:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Auto-Salvar:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Auto-Salvar:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Teclas"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Idioma do GUI:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Linguagem do ScummVM GUI"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Você tem que reiniciar o ScummVM para funcionar."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Selecione a pasta para o jogos salvos"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "O diretório escolhido não pode ser usado. Por favor, selecione outro."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Selecione a pasta para os temas da Interface de Uso Gráfico"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Selecione a pasta para os arquivos extras"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Selecione a pasta para os plugins"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -934,104 +932,140 @@ msgstr ""
"O tema que você selecionou não suporta seu idioma atual. Se você quiser usar "
"este tema você precisa mudar para outro idioma."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Sem data salva"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Sem hora salva"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Sem tempo de jogo salvo"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Excluir"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Você realmente quer excluir este jogo salvo?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Data:"
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Hora:"
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Tempo de jogo:"
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Não-titulado arquivo de save"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Salvar"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Falha ao salvar o jogo"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Nome:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Selecione um Tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "GFX desabilitado"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX desabilitado"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Renderizador padrão (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Padrão (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Renderizador Anti-Serrilhamento (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Anti-Serrilhamento (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Limpar valor"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Esse programa não suporta o nível de debug '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausar"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Pula linha"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Erro ao executar o jogo:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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 "
@@ -1101,17 +1135,17 @@ msgstr "Usuário cancelou"
msgid "Unknown error"
msgstr "Erro desconhecido"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "O jogo em '% s' parece ser desconhecido."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
"Por favor, informe os seguintes dados para a equipe ScummVM junto com o nome"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "do jogo que você tentou adicionar e sua versão/idioma/etc.:"
@@ -1139,22 +1173,23 @@ msgstr "~A~juda"
msgid "~A~bout"
msgstr "So~b~re"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~V~oltar ao menu"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~V~oltar ao menu"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Salvar jogo:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1163,7 +1198,7 @@ msgstr "Salvar jogo:"
msgid "Save"
msgstr "Salvar"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1173,7 +1208,7 @@ msgstr ""
"Por favor, consulte o README para obter informações básicas, e para obter "
"instruções sobre como obter assistência adicional."
-#: engines/dialogs.cpp:243
+#: engines/dialogs.cpp:228
#, fuzzy, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
@@ -1183,17 +1218,17 @@ msgstr ""
"Por favor, consulte o README para obter informações básicas, e para obter "
"instruções sobre como obter assistência adicional."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "~C~ancelar"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~eclas"
@@ -1265,6 +1300,88 @@ msgstr ""
msgid "Start anyway"
msgstr "Iniciar de qualquer maneira"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr ""
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Restaurar jogo:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Restaurar"
+
+#: engines/dreamweb/detection.cpp:57
+#, fuzzy
+msgid "Use bright palette mode"
+msgstr "Item da direita superior"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr ""
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA sem dithering"
+
+#: engines/sci/detection.cpp:371
+#, fuzzy
+msgid "Enable undithering in EGA games"
+msgstr "Habilita EGA sem dithering em jogos com suporte"
+
+#: engines/sci/detection.cpp:380
+#, fuzzy
+msgid "Prefer digital sound effects"
+msgstr "Volume dos efeitos sonoros especiais"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr ""
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr ""
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr ""
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:433
+#, fuzzy
+msgid "Use silver cursors"
+msgstr "Cursor normal"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1923,7 +2040,7 @@ msgstr ""
"LucasArts,\n"
"mas %s está faltando. Utilizando AdLib ao invés."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1934,7 +2051,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1945,7 +2062,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1956,7 +2073,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1993,28 +2110,20 @@ msgstr "~M~enu Principal ScummVM"
msgid "~W~ater Effect Enabled"
msgstr "Modo ~E~feitos de água ativado"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Restaurar jogo:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Restaurar"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr ""
"Falha ao salvar o estado do jogo para o arquivo:\n"
@@ -2029,6 +2138,66 @@ msgstr "Falha ao excluir arquivo."
msgid "Failed to save game"
msgstr "Falha ao salvar o jogo"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr ""
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr ""
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr ""
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr ""
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr ""
+
+#: engines/kyra/detection.cpp:85
+#, fuzzy
+msgid "Enable helium mode"
+msgstr "Ligar modo Roland GS"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr ""
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr ""
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+#, fuzzy
+msgid "Floating cursors"
+msgstr "Cursor normal"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr ""
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr ""
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr ""
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
@@ -2084,12 +2253,13 @@ msgid "Choose Spell"
msgstr "Escolher"
#: engines/kyra/sound_midi.cpp:475
+#, fuzzy
msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"Você parece estar usando um dispositivo General MIDI,\n"
"mas, o jogo só suporta Roland MT32 MIDI.\n"
@@ -2097,6 +2267,14 @@ msgstr ""
"o modelo General MIDI. Talvez possa acontecer\n"
"que algumas faixas não sejam corretamente tocadas."
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
+msgstr ""
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
@@ -2113,6 +2291,14 @@ msgstr ""
"O arquivo \"sky.cpt\" possui um tamanho incorreto.\n"
"Por favor, refaça o download em www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr ""
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr ""
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
@@ -2180,6 +2366,25 @@ msgstr ""
"Vídeos no formato DXA foram encontrados, mas o ScummVM foi compilado sem "
"suporte a zlib"
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr ""
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+
#: engines/parallaction/saveload.cpp:133
#, c-format
msgid ""
@@ -2189,15 +2394,15 @@ msgstr ""
"Não é possível salvar o jogo na posição %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Carregando jogo..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Salvando jogo..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2214,11 +2419,11 @@ msgstr ""
"Pressione OK para convertê-los agora, caso contrário você será solicitado na "
"próxima vez.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM converteu com êxito todos os seus jogos salvos."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2416,27 +2621,27 @@ msgstr "Som de alta qualidade (mais lento) (reiniciar)"
msgid "Disable power off"
msgstr "Desativar desligamento"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Modo clique-e-arraste do mouse ligado."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Modo clique-e-arraste do mouse desligado."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Modo Touchpad ligado."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Modo Touchpad desligado."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr ""
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2444,12 +2649,12 @@ msgstr ""
msgid "Left Click"
msgstr "Clique com o botão esquerdo"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
#, fuzzy
msgid "Middle Click"
msgstr "Item do meio na esquerda"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2486,34 +2691,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normal (sem escala)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Correção de proporção desabilitada"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Ativa os filtros gráficos"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Modo janela"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL Normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL Conserve"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Original"
@@ -2854,37 +3059,37 @@ msgstr "Menu principal"
msgid "Do you really want to quit?"
msgstr "Você realmente deseja sair?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Touchscreen 'Modo Toque' - Clique Esquerdo"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Touchscreen 'Modo Toque' - Clique Direito"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Touchscreen 'Modo Toque' - Acima (Sem Clicar)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Volume máximo"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Aumentando Volume"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Volume mínimo"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Diminuindo Volume"
diff --git a/po/ru_RU.po b/po/ru_RU.po
index fe2204f6e5..3a80d9fd7b 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -7,16 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2012-02-16 13:09+0200+0200\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-08 22:00+0200+0200\n"
"Last-Translator: Eugene Sandulenko <sev@scummvm.org>\n"
"Language-Team: Russian\n"
+"Language: Russian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-5\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Russian\n"
-"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%"
-"10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n"
+"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#: gui/about.cpp:91
#, c-format
@@ -45,11 +45,12 @@ msgid "Go up"
msgstr "²ÒÕàå"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -70,15 +71,15 @@ msgstr "·ÐÚàëâì"
msgid "Mouse click"
msgstr "ºÛØÚ Üëèìî"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "¿ÞÚÐ×Ðâì ÚÛÐÒØÐâãàã"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "¿ÕàÕÝÐ×ÝÐçØâì ÚÛÐÒØèØ"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "¿ÕàÕÚÛîçÕÝØÕ ÝÐ ÒÕáì íÚàÐÝ"
@@ -90,18 +91,18 @@ msgstr "²ëÑÕàØâÕ ÔÕÙáâÒØÕ ÔÛï ÝÐ×ÝÐçÕÝØï"
msgid "Map"
msgstr "½Ð×ÝÐçØâì"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -128,15 +129,15 @@ msgstr "¿ÞÖÐÛãÙáâÐ, ÒëÑÕàØâÕ ÔÕÙáâÒØÕ"
msgid "Press the key to associate"
msgstr "½ÐÖÜØâÕ ÚÛÐÒØèã ÔÛï ÝÐ×ÝÐçÕÝØï"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "¸ÓàÐ"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -144,309 +145,313 @@ msgstr ""
"ºÞàÞâÚØÙ ØÔÕÝâØäØÚÐâÞà, ØáßÞÛì×ãÕÜëÙ ÔÛï ØÜÕÝ áÞåàÐÝÕÝØÙ ØÓà Ø ÔÛï ×ÐßãáÚÐ "
"Ø× ÚÞÜÐÝÔÝÞÙ áâàÞÚØ"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "½Ð×ÒÐÝØÕ:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "¿ÞÛÝÞÕ ÝÐ×ÒÐÝØÕ ØÓàë"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "½Ð×Ò:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Ï×ëÚ:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr ""
"Ï×ëÚ ØÓàë. ¸×ÜÕÝÕÝØÕ íâÞÙ ÝÐáâàÞÙÚØ ÝÕ ßàÕÒàÐâØâ ØÓàã ÝÐ ÐÝÓÛØÙáÚÞÜ Ò àãááÚãî"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<ßÞ ãÜÞÛçÐÝØî>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "¿ÛÐâäÞàÜÐ:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "¿ÛÐâäÞàÜÐ, ÔÛï ÚÞâÞàÞÙ ØÓàÐ ÑëÛÐ Ø×ÝÐçÐÛìÝÞ àÐ×àÐÑÞâÐÝÐ"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "¿ÛÐâäÞàÜÐ:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "´ÒØÖÞÚ"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "³àÐäØÚÐ"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "³àä"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ ÓàÐäØÚØ"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ ÓàÐäØÚØ"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "°ãÔØÞ"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ ÐãÔØÞ"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ ÐãÔØÞ"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "³àÞÜÚÞáâì"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "³àÞÜÚ"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ ÓàÞÜÚÞáâØ"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ ÓàÞÜÚÞáâØ"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ MIDI"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ MIDI"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ MT-32"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "¿ÕàÕÚàëâì ÓÛÞÑÐÛìÝëÕ ãáâÐÝÞÒÚØ MT-32"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "¿ãâØ"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "¿ãâØ"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "¿ãâì Ú ØÓàÕ:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "³ÔÕ ØÓàÐ:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "´Þß. ßãâì:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "ÃÚÐ×ëÒÐÕâ ßãâì Ú ÔÞßÞÛÝØâÕÛìÝëÜ äÐÙÛÐÜ ÔÐÝÝëå ÔÛï ØÓàë"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "´Þß. ßãâì:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "ÁÞåàÐÝÕÝØï ØÓà:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "ÃÚÐ×ëÒÐÕâ ßãâì Ú áÞåàÐÝÕÝØïÜ ØÓàë"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "¿ãâì áÞåà:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "½Õ ×ÐÔÐÝ"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "¿Þ ãÜÞÛçÐÝØî"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "²ëÑÕàØâÕ SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "²ëÑÕàØâÕ ÔØàÕÚâÞàØî á äÐÙÛÐÜØ ØÓàë"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "²ëÑÕàØâÕ ÔÞßÞÛÝØâÕÛìÝãî ÔØàÕÚâÞàØî ØÓàë"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "²ëÑÕàØâÕ ÔØàÕÚâÞàØî ÔÛï áÞåàÐÝÕÝØÙ"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "ÍâÞâ ID ØÓàë ãÖÕ ØáßÞÛì×ãÕâáï. ¿ÞÖÐÛãÙáâÐ, ÒëÑÕàØâÕ ÔàãÓÞÙ."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~²~ëåÞÔ"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "·ÐÒÕàèØâì ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "¾ ß~à~ÞÓàÐÜÜÕ..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "¾ ßàÞÓàÐÜÜÕ ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~½~ÐáâàÞÙÚØ..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "¸×ÜÕÝØâì ÓÛÞÑÐÛìÝëÕ ÝÐáâàÞÙÚØ ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "¿~ã~áÚ"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "·ÐßãáâØâì ÒëÑàÐÝÝãî ØÓàã"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~·~ÐÓàã×Øâì..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "·ÐÓàã×Øâì áÞåàÝÕÝØÕ ÔÛï ÒëÑàÐÝÝÞÙ ØÓàë"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~´~ÞÑÐÒØâì ØÓàã..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "ÃÔÕàÖØÒÐÙâÕ ÚÛÐÒØèã Shift ÔÛï âÞÓÞ, çâÞÑë ÔÞÑÐÒØâì ÝÕáÚÞÛìÚÞ ØÓà"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "½~Ð~áâàÞÙÚØ ØÓàë..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "¸×ÜÕÝØâì ÝÐáâàÞÙÚØ ØÓàë"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~Ã~ÔÐÛØâì ØÓàã"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "ÃÔÐÛØâì ØÓàã Ø× áßØáÚÐ. ½Õ ãÔÐÛïÕâ ØÓàã á ÖÕáâÚÞÓÞ ÔØáÚÐ"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~´~ÞÑ. ØÓàã..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "½~Ð~á. ØÓàë..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~Ã~ÔÐÛØâì ØÓàã"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "¿ÞØáÚ Ò áßØáÚÕ ØÓà"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "¿ÞØáÚ:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "·ÐÓàã×Øâì ØÓàã:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "·ÐÓàã×Øâì"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -454,7 +459,7 @@ msgstr ""
"²ë ÔÕÙáâÒØâÕÛìÝÞ åÞâØâÕ ×ÐßãáâØâì ÔÕâÕÚâÞà ÒáÕå ØÓà? ÍâÞ ßÞâÕÝæØÐÛìÝÞ ÜÞÖÕâ "
"ÔÞÑÐÒØâì ÑÞÛìèÞÕ ÚÞÛØçÕáâÒÞ ØÓà."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -462,7 +467,7 @@ msgstr ""
msgid "Yes"
msgstr "´Ð"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -470,36 +475,36 @@ msgstr "´Ð"
msgid "No"
msgstr "½Õâ"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM ÝÕ ÜÞÖÕâ ÞâÚàëâì ãÚÐ×ÐÝÝãî ÔØàÕÚâÞàØî!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM ÝÕ ÜÞÖÕâ ÝÐÙâØ ØÓàã Ò ãÚÐ×ÐÝÝÞÙ ÔØàÕÚâÞàØØ!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "²ëÑÕàØâÕ ØÓàã:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "²ë ÔÕÙáâÒØâÕÛìÝÞ åÞâØâÕ ãÔÐÛØâì ÝÐáâàÞÙÚØ ÔÛï íâÞÙ ØÓàë?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "ÍâÐ ØÓàÐ ÝÕ ßÞÔÔÕàÖØÒÐÕâ ×ÐÓàã×Úã áÞåàÐÝÕÝØÙ çÕàÕ× ÓÛÐÒÝÞÕ ÜÕÝî."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr "ScummVM ÝÕ áÜÞÓ ÝÐÙâØ ÔÒØÖÞÚ ÔÛï ×ÐßãáÚÐ ÒëÑàÐÝÝÞÙ ØÓàë!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "¼ÝÞÓÞ ØÓà..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "¼ÝÞÓÞ ØÓà..."
@@ -566,104 +571,94 @@ msgstr "44 Ú³æ"
msgid "48 kHz"
msgstr "48 Ú³æ"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "½Õ ×ÐÔÐÝ"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "½Õ ãÔÐÛÞáì ßàØÜÕÝØâì Ø×ÜÕÝÕÝØï ÝÕÚâÞàëå ÓàÐäØçÕáÚØå ÝÐáâàÞÕÚ:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "ÒØÔÕÞàÕÖØÜ ÝÕ ÜÞÖÕâ Ñëâì Ø×ÜÕÝñÝ."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "ßÞÛÝÞíÚàÐÝÝëÙ àÕÖØÜ ÝÕ ÜÞÖÕâ Ñëâì Ø×ÜÕÝñÝ"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "àÕÖØÜ ÚÞààÕÚâØàÞÒÚØ áÞÞâÝÞèÕÝØï áâÞàÞÝ ÝÕ ÜÞÖÕâ Ñëâì Ø×ÜÕÝñÝ"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "³àÐä. àÕÖØÜ:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "ÀÕÖØÜ àÐáâàÐ:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "ÁßÕæØÐÛìÝëÕ àÕÖØÜë àÕÝÔÕàØÝÓÐ, ßÞÔÔÕàÖØÒÐÕÜëÕ ÝÕÚÞâÞàëÜØ ØÓàÐÜØ"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "¿ÞÛÝÞíÚàÐÝÝëÙ àÕÖØÜ"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "ºÞààÕÚæØï áÞÞâÝÞèÕÝØï áâÞàÞÝ"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "ºÞààÕÚâØàÞÒÐâì áÞÞâÝÞèÕÝØÕ áâÞàÞÝ ÔÛï ØÓà á àÐ×àÕèÕÝØÕÜ 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA ÑÕ× àÐáâàÐ"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr ""
-"²ÚÛîçÐÕâ àÕÖØÜ ÑÕ× àÐáâàØàÞÒÐÝØï Ò EGA ØÓàÐå, ÚÞâÞàëÕ ßÞÔÔÕàÖØÒÐîâ âÐÚÞÙ "
-"àÕÖØÜ"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "¿àÕÔßÞçØâÐÕÜÞÕ:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "·ÒãÚÞÒÞÕ ãáâ-ÒÞ:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
"ÃÚÐ×ëÒÐÕâ ßàÕÔßÞçØâÐÕÜÞÕ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ØÛØ íÜãÛïâÞà ×ÒãÚÞÒÞÙ ÚÐàâë"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "ÃÚÐ×ëÒÐÕâ ÒëåÞÔÝÞÕ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ØÛØ íÜãÛïâÞà ×ÒãÚÞÒÞÙ ÚÐàâë"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "¿àÕÔßÞçØâÐÕÜÞÕ:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "·ÒãÚÞÒÞÕ ãáâ-ÒÞ:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "ÍÜãÛïâÞà AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "·ÒãÚÞÒÐï ÚÐàâÐ AdLib ØáßÞÛì×ãÕâáï ÜÝÞÓØÜØ ØÓàÐÜØ"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "ÇÐáâÞâÐ ×ÒãÚÐ:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -671,64 +666,63 @@ msgstr ""
"±¾ÛìèØÕ ×ÝÐçÕÝØï ×ÐÔÐîâ ÛãçèÕÕ ÚÐçÕáâÒÞ ×ÒãÚÐ, ÞÔÝÐÚÞ ÞÝØ ÜÞÓãâ ÝÕ "
"ßÞÔÔÕàÖØÒÐâìáï ÒÐèÕÙ ×ÒãÚÞÒÞÙ ÚÐàâÞÙ"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "ÃáâàÞÙáâÒÞ GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "ÃÚÐ×ëÒÐÕâ ÒëåÞÔÝÞÕ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ÔÛï MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "½Õ ØáßÞÛì×ÞÒÐâì Üã×ëÚã ÔÛï General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "¸áßÞÛì×ÞÒÐâì ßÕàÒÞÕ ÔÞáâãßÝÞÕ ãáâàÞÙáâÒÞ"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
-"SoundFontë ßÞÔÔÕàÔÖØÒÐîâáï ÝÕÚÞâÞàëÜØ ×ÒãÚÞÒëÜØ ÚÐàâÐÜØ, Fluidsynth Ø "
-"Timidity"
+"SoundFontë ßÞÔÔÕàÖØÒÐîâáï ÝÕÚÞâÞàëÜØ ×ÒãÚÞÒëÜØ ÚÐàâÐÜØ, Fluidsynth Ø Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "ÁÜÕèÐÝÝëÙ àÕÖØÜ AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "¸áßÞÛì×ÞÒÐâì Ø MIDI Ø AdLib ÔÛï ÓÕÝÕàÐæØØ ×ÒãÚÐ"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "ÃáØÛÕÝØÕ MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "Ãáâà. MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
-"ÃÚÐ×ëÒÐÕâ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ßÞ ãÜÞÛçÐÝØï ÔÛï ÒëÒÞÔÐ ÝÐ Roland MT-32/LAPC1/"
+"ÃÚÐ×ëÒÐÕâ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ßÞ ãÜÞÛçÐÝØî ÔÛï ÒëÒÞÔÐ ÝÐ Roland MT-32/LAPC1/"
"CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "½ÐáâÞïéØÙ Roland MT-32 (×ÐßàÕâØâì íÜãÛïæØî GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -736,298 +730,335 @@ msgstr ""
"¾âÜÕâìâÕ, ÕáÛØ ã ÒÐá ßÞÔÚÛîçÕÝÞ Roland-áÞÒÜÕáâØÜÞÕ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ Ø Òë "
"åÞâØâÕ ÕÓÞ ØáßÞÛì×ÞÒÐâì"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "½ÐáâÞïéØÙ Roland MT-32 (×ÐßàÕâØâì GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "²ÚÛîçØâì àÕÖØÜ Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
-"²ëÚÛîçÐÕâ ÜÐßßØÝÓ General MIDI ÔÛï ØÓà á ×ÒãÚÞÒÞÙ ÔÞàÞÖÚÞÙ ÔÛï Roland MT-32"
+"²ëÚÛîçÐÕâ áÞßÞáâÐÒÛÕÝØÕ General MIDI ÔÛï ØÓà á ×ÒãÚÞÒÞÙ ÔÞàÞÖÚÞÙ ÔÛï Roland "
+"MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "½Õ ØáßÞÛì×ÞÒÐâì Üã×ëÚã ÔÛï MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "ÂÕÚáâ Ø Þ×ÒãçÚÐ:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "¾×ÒãçÚÐ"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "ÁãÑâØâàë"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "¾ÑÐ"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "ÁÚÞàÞáâì âØâàÞÒ:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "ÂÕÚáâ Ø Þ×ÒãçÚÐ:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "¾×Ò"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "狄"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "¾ÑÐ"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "¿ÞÚÐ×ëÒÐâì áãÑâØâàë Ø ÒÞáßàÞØ×ÒÞÔØâì àÕçì"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "ÁÚÞàÞáâì âØâàÞÒ:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "³àÞÜÚ. Üã×ëÚØ:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "³àÞÜÚ. Üã×ëÚØ:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "²ëÚÛ. Òáñ"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "³àÞÜÚÞáâì SFX:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "³àÞÜÚÞáâì áßÕæØÐÛìÝëå ×ÒãÚÞÒëå íääÕÚâÞÒ"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "³àÞÜÚ. SFX:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "³àÞÜÚ. Þ×ÒãçÚØ:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "³àÞÜÚ. Þ×ÒãçÚØ:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "¿ãâì Ú âÕÜÐÜ:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "³ÔÕ âÕÜë:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"ÃÚÐ×ëÒÐÕâ ßãâì Ú ÔÞßÞÛÝØâÕÛìÝëÜ äÐÙÛÐÜ ÔÐÝÝëå, ØáßÞÛì×ãÕÜëå ÒáÕÜØ ØÓàÐÜØ, "
"ÛØÑÞ ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "¿ãâì Ú ßÛÐÓØÝÐÜ:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "¿ãâì Ú ßÛÐÓØÝÐÜ:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "ÀÐ×ÝÞÕ"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "ÀÐ×ÝÞÕ"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "ÂÕÜÐ:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "ÀØáÞÒÐÛÚÐ GUI:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "°ÒâÞáÞåàÐÝÕÝØÕ:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "°ÒâÞáÞåà.:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "ºÛÐÒØèØ"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "Ï×ëÚ GUI:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Ï×ëÚ ÓàÐäØçÕáÚÞÓÞ ØÝâÕàäÕÙáÐ ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "²ë ÔÞÛÖÝë ßÕàÕ×ÐßãáâØâì ScummVM çâÞÑë ßàØÜÕÝØâì Ø×ÜÕÝÕÝØï."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "²ëÑÕàØâÕ ÔØàÕÚâÞàØî ÔÛï áÞåàÐÝÕÝØÙ"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "½Õ ÜÞÓã ßØáÐâì Ò ÒëÑàÐÝÝãî ÔØàÕÚâÞàØî. ¿ÞÖÐÛãÙáâÐ, ãÚÐÖØâÕ ÔàãÓãî."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "²ëÑÕàØâÕ ÔØàÕÚâÞàØî ÔÛï âÕÜ GUI"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "²ëÑÕàØâÕ ÔØàÕÚâÞàØî á ÔÞßÞÛÝØâÕÛìÝëÜØ äÐÙÛÐÜØ"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "²ëÑÕàØâÕ ÔØàÕÚâÞàØî á ßÛÐÓØÝÐÜØ"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
msgstr ""
-"ÂÕÜÐ, ÒëÑàÐÝÝÐï ÒÐÜØ, ÝÕ ßÞÔÔÕàÖØÒÐÕâ ÒëÑàÐÝÝëÙ ï×ëÚ. µáÛØ Òë åÞâØâÕ "
+"ÂÕÜÐ, ÒëÑàÐÝÝÐï ÒÐÜØ, ÝÕ ßÞÔÔÕàÖØÒÐÕâ âÕÚãéØÙ ï×ëÚ. µáÛØ Òë åÞâØâÕ "
"ØáßÞÛì×ÞÒÐâì íâã âÕÜã, ÒÐÜ ÝÕÞÑåÞÔØÜÞ áÝÐçÐÛÐ ßÕàÕÚÛîçØâìáï ÝÐ ÔàãÓÞÙ ï×ëÚ."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "´ÐâÐ ÝÕ ×ÐßØáÐÝÐ"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "²àÕÜï ÝÕ ×ÐßØáÐÝÞ"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "²àÕÜï ØÓàë ÝÕ ×ÐßØáÐÝÞ"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "ÃÔÐÛØâì"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "²ë ÔÕÙáâÒØâÕÛìÝÞ åÞâØâÕ ãÔÐÛØâì íâÞ áÞåàÐÝÕÝØÕ?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "´ÐâÐ: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "²àÕÜï: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "²àÕÜï ØÓàë: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "ÁÞåàÐÝÕÝØÕ ÑÕ× ØÜÕÝØ"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "ÁÞåàÐÝØâì"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "½Ð×ÒÐÝØÕ:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "²ëÑÕàØâÕ âÕÜã"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "±Õ× ÓàÐäØÚØ"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "±Õ× ÓàÐäØÚØ"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "ÁâÐÝÔÐàâÝëÙ àÐáâÕàØ×ÐâÞà (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "ÁâÐÝÔÐàâÝëÙ àÐáâÕàØ×ÐâÞà (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "ÀÐáâÕàØ×ÐâÞà áÞ áÓÛÐÖØÒÐÝØÕÜ (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "ÀÐáâÕàØ×ÐâÞà áÞ áÓÛÐÖØÒÐÝØÕÜ (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "¾çØáâØâì ×ÝÐçÕÝØÕ"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "´ÒØÖÞÚ ÝÕ ßÞÔÔÕàÖØÒÐÕâ ãàÞÒÕÝì ÞâÛÐÔÚØ '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "¼ÕÝî"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "¿Ðã×Ð"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "¿àÞßãáâØâì áâàÞÚã"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "¾èØÑÚÐ ×ÐßãáÚÐ ØÓàë:"
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr "½Õ ÜÞÓã ÝÐÙâØ ÔÒØÖÞÚ ÔÛï ×ÐßãáÚÐ ÒëÑàÐÝÝÞÙ ØÓàë"
@@ -1095,17 +1126,17 @@ msgstr "¿àÕàÒÐÝÞ ßÞÛì×ÞÒÐâÕÛÕÜ"
msgid "Unknown error"
msgstr "½ÕØ×ÒÕáâÝÐï ÞèØÑÚÐ"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "ºÐÖÕâáï, çâÞ ØÓàÐ '%s' Õéñ ÝÕØ×ÒÕáâÝÐ."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
"¿ÞÖÐÛãÙáâÐ, ßÕàÕÔÐÙâÕ áÛÕÔãîéØÕ ÔÐÝÝëÕ ÚÞÜÐÝÔÕ ScummVM ÒÜÕáâÕ á ÝÐ×ÒÐÝØÕÜ"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "ØÓàë, ÚÞâÞàãî Òë ßëâÐÕâÕáì ÔÞÑÐÒØâì, Ø ãÚÐÖØâÕ Õñ ÒÕàáØî, ï×ëÚ Ø â.Ô."
@@ -1133,22 +1164,23 @@ msgstr "~¿~ÞÜÞéì"
msgid "~A~bout"
msgstr "¾ ßàÞ~Ó~àÐÜÜÕ"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~²~ëÙâØ Ò ÓÛÐÒÝÞÕ ÜÕÝî"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~²~ ÓÛÐÒÝÞÕ ÜÕÝî"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "ÁÞåàÐÝØâì ØÓàã:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1157,37 +1189,37 @@ msgstr "ÁÞåàÐÝØâì ØÓàã:"
msgid "Save"
msgstr "ÁÞåàÐÝØâì"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
"further assistance."
msgstr ""
-"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÕ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. "
+"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÚ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. "
"¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ "
"ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî ßÞÜÞéì."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÕ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. "
-"¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ "
-"ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî ßÞÜÞéì."
+"½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã (%s)! ¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð "
+"ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî "
+"ßÞÜÞéì."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "¾~â~ÜÕÝÐ"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~º~ÛÐÒØèØ"
@@ -1237,14 +1269,14 @@ msgstr ""
"äÐÙÛÕ README."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÕ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. "
-"¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ "
-"ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî ßÞÜÞéì."
+"½Õ ãÔÐÛÞáì ßàÞçØâÐâì áÞåàÐÝÕÝØÕ ØÓàë (%s)! ¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ "
+"README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì "
+"ÔÐÛìÝÕÙèãî ßÞÜÞéì."
#: engines/engine.cpp:439
msgid ""
@@ -1260,6 +1292,94 @@ msgstr ""
msgid "Start anyway"
msgstr "²áñ àÐÒÝÞ ×ÐßãáâØâì"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "¸áßÞÛì×ÞÒÐâì ÞàØÓØÝÐÛìÝëÕ íÚàÐÝë ×ÐßØáØ/çâÕÝØï ØÓàë"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"¸áßÞÛì×ÞÒÐâì ÞàØÓØÝÐÛìÝëÕ íÚàÐÝë ×ÐßØáØ Ø áÞåàÐÝÕÝØï ØÓàë ÒÜÕáâÞ áÔÕÛÐÝÝëå Ò "
+"ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "²ÞááâÐÝÞÒØâì ØÓàã:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "²ÞááâÐÝÞÒØâì"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "¸áßÞÛì×ÞÒÐâì àÕÖØÜ ïàÚÞÙ ßÐÛØâàë"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "ÀØáãÕâ ÓàÐäØÚã á ØáßÞÛì×ÞÒÐÝØÕÜ ïàÚÞÙ ßÐÛØâàë ØÓàë"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA ÑÕ× àÐáâàÐ"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "²ÚÛîçÐÕâ àÕÖØÜ ÑÕ× àÐáâàØàÞÒÐÝØï Ò EGA ØÓàÐå"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "¿àÕÔßÞçØâÐâì æØäàÞÒëÕ ×ÒãÚÞÒëÕ íääÕÚâë"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr ""
+"¾âÔÐÒÐâì ßàÕÔßÞçâÕÝØÕ æØäàÞÒëÜ ×ÒãÚÞÒëÜ íääÕÚâÐÜ ÒÜÕáâÞ áØÝâÕ×ØàÞÒÐÝÝëå"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "¸áßÞÛì×ÞÒÐâì IMF/Yamaha FB-01 ÔÛï ÒëÒÞÔÐ MIDI"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"¸áßÞÛì×ÒÞÒÐâì ×ÒãÚÞÒãî ÚÐàâÚã IBM Music Feature ØÛØ ÜÞÔãÛì áØÝâÕ×Ð Yamaha "
+"FB-01 FM ÔÛï MIDI"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "¸áßÞÛì×ÞÒÐâì CD ÐãÔØÞ"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+"¸áßÞÛì×ÞÒÐâì ×ÒãÚÞÒëÕ ÔÞàÞÖÚØ á CD ÒÜÕáâÞ Üã×ëÚØ Ø× äÐÙÛÞÒ ØÓàë (ÕáÛØ "
+"ÔÞáâãßÝÞ)"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "¸áßÞÛì×ÞÒÐâì ÚãàáÞàë Windows"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"¸áßÞÛì×ÞÒÐâì ÚãàáÞàë Windows (ÜÕÝìèØÕ ßÞ àÐ×ÜÕàã Ø ÞÔÝÞæÒÕâÝëÕ) ÒÜÕáâÞ "
+"ÚãàáÞàÞÒ DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "¸áßÞÛì×ÞÒÐâì áÕàÕÑàïÝÝëÕ ÚãàáÞàë"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"¸áßÞÛì×ÞÒÐâì ÐÛìâÕàÝÐâØÒÝëÙ ÝÐÑÞà áÕàÕÑàïÝÝëå ÚãàáÞàÞÒ ÒÜÕáâÞ ÞÑëçÝëå ×ÞÛÞâëå"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1916,7 +2036,7 @@ msgstr ""
"ÀÕÖØÜ \"àÞÔÝÞÓÞ\" MIDI âàÕÑãÕâ ÞÑÝÞÒÛÕÝØÕ Roland Upgrade Þâ\n"
"LucasArts, ÝÞ ÝÕ åÒÐâÐÕâ %s. ¿ÕàÕÚÛîçÐîáì ÝÐ AdLib."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1927,7 +2047,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1938,7 +2058,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1949,7 +2069,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1985,25 +2105,17 @@ msgstr "³ÛÐÒÝÞÕ ÜÕÝî"
msgid "~W~ater Effect Enabled"
msgstr "ÍääÕÚâë ÒÞÔë ÒÚÛîçÕÝë"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "²ÞááâÐÝÞÒØâì ØÓàã:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "²ÞááâÒÝÞÒØâì"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
msgid "Cutscene file '%s' not found!"
msgstr "ÄÐÙÛ ×ÐáâÐÒÚØ '%s' ÝÕ ÝÐÙÔÕÝ!"
-#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
msgstr "½Õ ãÔÐÛÞáì ×ÐÓàã×Øâì áÞåàÐÝñÝÝãî ØÓàã Ø× äÐÙÛÐ."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã Ò äÐÙÛ."
@@ -2015,6 +2127,64 @@ msgstr "½Õ ãÔÐÛÞáì ãÔÐÛØâì äÐÙÛ."
msgid "Failed to save game"
msgstr "½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "ÁâãÔØÙÝÐï ÐãÔØâÞàØï"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "²ÚÛîçØâì ×ÒãÚØ ÐãÔØâÞàØØ Ò áâãÔØØ"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "¿ÞÔÔàÕÖÚÐ ßàÞßãáÚÞÒ"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "²ÚÛîçÐÕâ ÒÞ×ÜÞÖÝÞáâì ßàÞßãáÚÐâì âÕÚáâë Ø ×ÐáâÐÒÚØ"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "ÀÕÖØÜ ÓÕÛØï"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "²ÚÛîçØâì àÕÖØÜ ÓÕÛØï"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "¿ÛÐÒÝÐï ßàÞÚàãâÚÐ"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "²ÚÛîçØâì ßÛÐÒÝãî ßàÞÚàãâÚã ÒÞ ÒàÕÜï åÞÔìÑë"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "¿ÛÐÒÐîéØÕ ÚãàáÞàë"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "²ÚÛîçØâì ßÛÐÒÐîéØÕ ÚãàáÞàë"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "¿ÞÛÞáÚØ ×ÔÞàÞÒìï"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "²ÚÛîçØâì ÞâÞÑàÐÖÕÝØÕ ßÞÛÞáÞÚ ×ÔÞàÞÒìï"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "°âÐÚÐ 1"
@@ -2068,8 +2238,8 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"ºÐÖÕâáï, Òë ßëâÐÕâÕáì ØáßÞÛì×ÞÒÐâì ãáâàÞÙáâÒÞ\n"
"General MIDI, ÝÞ íâÐ ØÓàÐ ßÞÔÔÕàÖØÒÐÕâ âÞÛìÚÞ\n"
@@ -2078,6 +2248,15 @@ msgstr ""
"ÜÞÖÕâ âÐÚ ßÞÛãçØâìáï, çâÞ ÝÕÚÞâÞàëÕ âàÕÚØ ÑãÔãâ\n"
"áëÓàÐÝë ÝÕÒÕàÝÞ."
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "¸áßÞÛì×ÞÒÐâì ÒáâãßÛÕÝØÕ á ÓØÑÚØå ÔØáÚÞÒ (âÞÛìÚÞ ÔÛï CD ÒÕàáØØ ØÓàë)"
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
@@ -2094,10 +2273,18 @@ msgstr ""
"ÄÐÙÛ sky.cpt ØÜÕÕâ ÝÕÒÕàÝëÙ àÐ×ÜÕà.\n"
"¿ÞÖÐÛãÙáâÐ, áÚÐçÐÙâÕ ÕÓÞ ×ÐÝÞÒÞ á www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "²áâãßÛÕÝØÕ á äÛÞßßØÚÞÒ"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "¸áßÞÛì×ÞÒÐâì ÒáâãßÛÕÝØÕ á ÓØÑÚØå ÔØáÚÞÒ (âÞÛìÚÞ ÔÛï CD ÒÕàáØØ ØÓàë)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "·ÐáâÐÒÚÐ PSX '%s' ÝÕ ÜÞÖÕâ Ñëâì ßàÞØÓàÐÝÐ Ò àÕÖØÜÕ á ßÐÛØâàÞÙ"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2152,11 +2339,30 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "ÍâÞ ×ÐÒÕàèÕÝØÕ ÔÕÜÞ ÁÛÞÜÐÝÝÞÓÞ ¼ÕçÐ 1"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
-"½ÐÙÔÕÝë ×ÐáâÐÒÚØ Ò äÞàÜÐâÕ DXA, ÝÞ ScummVM ÑëÛ áÞÑàÐÝ ÑÕ× ßÞÔÔÕàÖÚØ zlib"
+"½ÐÙÔÕÝë ×ÐáâÐÒÚØ Ò äÞàÜÐâÕ PSX, ÝÞ ScummVM ÑëÛ áÞÑàÐÝ ÑÕ× ßÞÔÔÕàÖÚØ RGB "
+"æÒÕâÞÒ"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "¿ÞÚÐ×ëÒÐâì ÝÐ×ÒÐÝØï ÞÑêÕÚâÞÒ"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "¿ÞÚÐ×ëÒÐÕâ ÝÐ×ÒÐÝØï ÞÑêÕÚâÞÒ ßà ØÝÐÒÕÔÕÝØØ ÚãàáÞàÐ ÜëèØ"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2167,15 +2373,15 @@ msgstr ""
"½Õ ÜÞÓã áÞåàÐÝØâì ØÓàã Ò ßÞ×ØæØî %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "·ÐÓàãÖÐî ØÓàã..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "ÁÞåàÐÝïî ØÓàã..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2185,24 +2391,24 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
"ScummVM ÞÑÝÐàãÖØÛ ã ÒÐá áâÐàëÕ áÞåàÐÝÕÝØï ØÓàë Nippon Safes, ÚÞâÞàëÕ "
-"ÝÕÞÑåÞÔØÜÞ ßÕàÕØÜÕÝÞÒÐâì.ÁâÐàëÕ ÝÐ×ÒÐÝØï ÑÞÛìèÕ ÝÕ ßÞÔÔÕàÖØÒÐîâáï, Ø ßÞíâÞÜã "
-"Òë ÝÕ áÜÞÖÕâÕ ×ÐÓàã×Øâì áÞåàÐÝÕÝØï, ÕáÛØ ÝÕ ßÕàÕØÜÕÝãÕâÕ Øå.\n"
+"ÝÕÞÑåÞÔØÜÞ ßÕàÕØÜÕÝÞÒÐâì. ÁâÐàëÕ ÝÐ×ÒÐÝØï ÑÞÛìèÕ ÝÕ ßÞÔÔÕàÖØÒÐîâáï, Ø "
+"ßÞíâÞÜã Òë ÝÕ áÜÞÖÕâÕ ×ÐÓàã×Øâì áÞåàÐÝÕÝØï, ÕáÛØ ÝÕ ßÕàÕØÜÕÝãÕâÕ Øå.\n"
"\n"
"½ÐÖÜØâÕ ¾º, çâÞÑë ßÕàÕØÜÕÝÞÒÐâì Øå áÕÙçÐá, Ò ßàÞâØÒÝÞÜ áÛãçÐÕ íâÞ ÖÕ "
"áÞÞÑéÕÝØÕ ßÞïÒØâáï ßàØ áÛÕÔãîéÕÜ ×ÐßãáÚÕ ØÓàë.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM ãáßÕèÝÞ ßàÕÞÑàÐ×ÞÒÐÛ ÒáÕ ÒÐèØ áÞåàÐÝÕÝØï ØÓà."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
"\n"
"Please report to the team."
msgstr ""
-"ScummVM ÝÐßØáÐÛ ÝÕáÚÞÛìÚÞ ßàÕÔãßàÕÖÔÕÝØÙ Ò ÞÚÝÞ ÚÞÝáÞÛØ, Ø ÝÕ áÜÞÓ "
+"ScummVM ÝÐßØáÐÛ ÝÕáÚÞÛìÚÞ ßàÕÔãßàÕÖÔÕÝØÙ Ò ÞÚÝÞ ÚÞÝáÞÛØ Ø ÝÕ áÜÞÓ "
"ßàÕÞÑàÐ×ÞÒÐâì ÒáÕ äÐÙÛë.\n"
"\n"
"¿ÞÖÐÛãÙáâÐ, áÞÞÑéØâÕ ÞÑ íâÞÜ ÚÞÜÐÝÔÕ ScummVM."
@@ -2306,7 +2512,7 @@ msgstr " (°ÚâØÒÝÐï)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (·ÐÑÛÞÚØàÞÒÐÝÐ)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2392,27 +2598,27 @@ msgstr "²ëáÞÚÞÕ ÚÐçÕáâÒÞ ×ÒãÚÐ (ÜÕÔÛÕÝÝÕÕ) (àÕÑãâ)"
msgid "Disable power off"
msgstr "·ÐßàÕâØâì ÒëÚÛîçÕÝØÕ"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "ÀÕÖØÜ ÜëèØ ÝÐÖÐâì-Ø-âïÝãâì ÒÚÛîçÕÝ."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "ÀÕÖØÜ ÜëèØ ÝÐÖÐâì-Ø-âïÝãâì ÒëÚÛîçÕÝ."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "ÀÕÖØÜ âÐçßÐÔÐ ÒÚÛîçÕÝ."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "ÀÕÖØÜ âÐçßÐÔÐ ÒëÚÛîçÕÝ."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr "ÀÕÖØÜ éÕÛçÚÐ"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2420,11 +2626,11 @@ msgstr "ÀÕÖØÜ éÕÛçÚÐ"
msgid "Left Click"
msgstr "»ÕÒëÙ éÕÛçÞÚ"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
msgstr "ÁàÕÔÝØÙ éÕÛçÞÚ"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2461,34 +2667,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "±Õ× ãÒÕÛØçÕÝØï"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "ºÞààÕÚæØï áÞÞâÝÞèÕÝØï áâÞàÞÝ ÒÚÛîçÕÝÐ"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "ºÞààÕÚæØï áÞÞâÝÞèÕÝØï áâÞàÞÝ ÒëÚÛîçÕÝÐ"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "°ÚâØÒÝëÙ ÓàÐäØçÕáÚØÙ äØÛìâà:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "¾ÚÞÝÝëÙ àÕÖØÜ"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL ÑÕ× ãÒÕÛØçÕÝØï"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL á áÞåàÐÝÕÝØÕÜ"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL Ø×ÝÐçÐÛìÝëÙ"
@@ -2826,37 +3032,37 @@ msgstr "³ÛÐÒÝÞÕ ÜÕÝî"
msgid "Do you really want to quit?"
msgstr "²ë ÔÕÙáâÒØâÕÛìÝÞ åÞâØâÕ ÒëÙâØ?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "ÀÕÖØÜ 'ÚÐáÐÝØÙ' âÐçáÚàØÝÐ - »ÕÒëÙ ÚÛØÚ"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "ÀÕÖØÜ 'ÚÐáÐÝØÙ' âÐçáÚàØÝÐ - ¿àÐÒëÙ ÚÛØÚ"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "ÀÕÖØÜ 'ÚÐáÐÝØÙ' âÐçáÚàØÝÐ - ¿àÞÛñâ (ÑÕ× ÚÛØÚÐ)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "¼ÐÚáØÜÐÛìÝÐï ÓàÞÜÚÞáâì"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "ÃÒÕÛØçÕÝØÕ ÓàÞÜÚÞáâØ"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "¼ØÝØÜÐÛìÝÐï ÓàÞÜÚÞáâì"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "ÃÜÕÝìèÕÝØÕ ÓàÞÜÚÞáâØ"
diff --git a/po/scummvm.pot b/po/scummvm.pot
index 989779fc91..de270cef27 100644
--- a/po/scummvm.pot
+++ b/po/scummvm.pot
@@ -6,12 +6,13 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: ScummVM 1.5.0git\n"
+"Project-Id-Version: ScummVM 1.6.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
+"POT-Creation-Date: 2012-08-12 14:57+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"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -43,11 +44,12 @@ msgid "Go up"
msgstr ""
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -68,15 +70,15 @@ msgstr ""
msgid "Mouse click"
msgstr ""
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr ""
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr ""
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr ""
@@ -88,18 +90,18 @@ msgstr ""
msgid "Map"
msgstr ""
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr ""
@@ -126,328 +128,332 @@ msgstr ""
msgid "Press the key to associate"
msgstr ""
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr ""
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr ""
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
msgstr ""
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr ""
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr ""
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr ""
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr ""
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr ""
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
msgstr ""
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr ""
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr ""
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr ""
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr ""
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr ""
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr ""
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr ""
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr ""
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr ""
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr ""
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr ""
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr ""
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr ""
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr ""
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr ""
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr ""
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr ""
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr ""
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr ""
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr ""
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr ""
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr ""
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr ""
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr ""
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr ""
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr ""
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr ""
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr ""
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr ""
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr ""
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr ""
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr ""
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr ""
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr ""
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr ""
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr ""
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr ""
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr ""
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr ""
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr ""
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr ""
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr ""
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr ""
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr ""
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr ""
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr ""
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr ""
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr ""
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr ""
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr ""
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr ""
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr ""
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr ""
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr ""
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr ""
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr ""
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr ""
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr ""
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr ""
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr ""
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr ""
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr ""
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
msgstr ""
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -455,7 +461,7 @@ msgstr ""
msgid "Yes"
msgstr ""
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -463,36 +469,36 @@ msgstr ""
msgid "No"
msgstr ""
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr ""
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr ""
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr ""
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr ""
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr ""
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr ""
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr ""
@@ -559,452 +565,477 @@ msgstr ""
msgid "48 kHz"
msgstr ""
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr ""
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr ""
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr ""
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr ""
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr ""
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr ""
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr ""
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr ""
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr ""
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr ""
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr ""
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr ""
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr ""
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr ""
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr ""
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr ""
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr ""
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr ""
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr ""
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr ""
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr ""
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr ""
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
msgstr ""
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr ""
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr ""
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr ""
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr ""
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr ""
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr ""
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr ""
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr ""
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr ""
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr ""
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr ""
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
msgstr ""
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr ""
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr ""
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr ""
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr ""
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr ""
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr ""
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr ""
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr ""
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr ""
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr ""
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr ""
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr ""
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr ""
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr ""
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr ""
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr ""
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr ""
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr ""
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr ""
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr ""
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr ""
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr ""
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr ""
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr ""
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr ""
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr ""
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr ""
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr ""
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr ""
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr ""
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr ""
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr ""
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr ""
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr ""
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr ""
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr ""
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr ""
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr ""
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr ""
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr ""
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr ""
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
msgstr ""
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr ""
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr ""
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr ""
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr ""
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr ""
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr ""
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr ""
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr ""
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr ""
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+msgid "New Save"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+msgid "Create a new save game"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:789
+msgid "Name: "
+msgstr ""
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr ""
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr ""
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr ""
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr ""
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr ""
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr ""
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr ""
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr ""
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr ""
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr ""
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr ""
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr ""
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr ""
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr ""
@@ -1072,16 +1103,16 @@ msgstr ""
msgid "Unknown error"
msgstr ""
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr ""
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr ""
@@ -1109,22 +1140,23 @@ msgstr ""
msgid "~A~bout"
msgstr ""
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr ""
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr ""
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr ""
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1133,31 +1165,31 @@ msgstr ""
msgid "Save"
msgstr ""
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
"further assistance."
msgstr ""
-#: engines/dialogs.cpp:243
+#: engines/dialogs.cpp:228
#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr ""
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr ""
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr ""
@@ -1213,6 +1245,84 @@ msgstr ""
msgid "Start anyway"
msgstr ""
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr ""
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr ""
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr ""
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr ""
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr ""
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr ""
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr ""
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr ""
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr ""
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr ""
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr ""
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr ""
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr ""
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1867,7 +1977,7 @@ msgid ""
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1875,7 +1985,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1883,7 +1993,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1891,7 +2001,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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' "
@@ -1924,25 +2034,17 @@ msgstr ""
msgid "~W~ater Effect Enabled"
msgstr ""
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr ""
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr ""
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
msgid "Cutscene file '%s' not found!"
msgstr ""
-#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
msgstr ""
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr ""
@@ -1954,6 +2056,64 @@ msgstr ""
msgid "Failed to save game"
msgstr ""
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr ""
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr ""
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr ""
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr ""
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr ""
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr ""
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr ""
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr ""
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr ""
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr ""
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr ""
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr ""
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
@@ -2007,8 +2167,16 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
+msgstr ""
+
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+msgid "Use an alternative game intro (CD version only)"
msgstr ""
#: engines/sky/compact.cpp:130
@@ -2023,6 +2191,14 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr ""
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr ""
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
@@ -2076,6 +2252,25 @@ msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
msgstr ""
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr ""
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
+
#: engines/parallaction/saveload.cpp:133
#, c-format
msgid ""
@@ -2083,15 +2278,15 @@ msgid ""
"\n"
msgstr ""
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr ""
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr ""
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2101,11 +2296,11 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr ""
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2290,27 +2485,27 @@ msgstr ""
msgid "Disable power off"
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr ""
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr ""
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr ""
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2318,11 +2513,11 @@ msgstr ""
msgid "Left Click"
msgstr ""
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
msgstr ""
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2359,34 +2554,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr ""
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr ""
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr ""
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr ""
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr ""
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr ""
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr ""
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr ""
@@ -2722,37 +2917,37 @@ msgstr ""
msgid "Do you really want to quit?"
msgstr ""
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr ""
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr ""
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr ""
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr ""
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr ""
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr ""
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr ""
diff --git a/po/se_SE.po b/po/se_SE.po
index 812852ca53..02f2ab44f4 100644
--- a/po/se_SE.po
+++ b/po/se_SE.po
@@ -5,16 +5,16 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: ScummVM 1.3.0svn\n"
+"Project-Id-Version: ScummVM 1.5.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2011-11-27 19:00+0100\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-07-08 18:03+0100\n"
"Last-Translator: Hampus Flink <hampus.flink@gmail.com>\n"
"Language-Team: \n"
+"Language: Svenska\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Svenska\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"X-Poedit-Language: Swedish\n"
"X-Poedit-Country: SWEDEN\n"
@@ -47,11 +47,12 @@ msgid "Go up"
msgstr "Uppåt"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -72,16 +73,15 @@ msgstr "Stäng"
msgid "Mouse click"
msgstr "Musklick"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "Visa tangentbord"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "Ställ in tangenter"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
-#, fuzzy
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "Fullskärmsläge"
@@ -93,18 +93,18 @@ msgstr "Välj en handling att ställa in"
msgid "Map"
msgstr "Ställ in"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -131,15 +131,15 @@ msgstr "Var god välj en handling"
msgid "Press the key to associate"
msgstr "Tryck på en tangent för att ställa in"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "Spel"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -147,29 +147,29 @@ msgstr ""
"Kortnamn för spel. Används för att hänvisa till spardata och att starta "
"spelet från kommandoraden"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "Namn:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "Spelets fullständiga titel"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "Namn:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "Språk:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -177,280 +177,284 @@ msgstr ""
"Spelets språk. Den här inställningen omvandlar inte din spanska spelversion "
"till en engelsk"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<standard>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "Plattformen spelet ursprungligen tillverkades för"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "Plattform:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "Motor"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "Grafik"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "GFX"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "Överskrid globala grafikinställningar"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "Överskrid globala grafikinställningar"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "Ljud"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "Överskrid globala ljudinställningar"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "Överskrid globala ljudinställningar"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "Volym"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "Volym"
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "Överskrid globala volyminställningar"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "Överskrid globala volyminställningar"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "Överskrid globala MIDI-inställningar"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "Överskrid globala MIDI-inställningar"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "Överskrid globala MT-32 inställningar"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "Överskrid globala MT-32 inställningar"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "Sökvägar"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "Sökvägar"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "Sökv. spel:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "Sökv. spel:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "Sökv. extra:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "Bestämmer sökvägen till ytterligare data som spelet använder"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "Sökv. extra:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "Sökv. sparat:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "Bestämmer var dina spardata lagras"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "Sökv. sparat:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "Ingen"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "Standard"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "Välj SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "Välj katalog med speldata"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "Välj en ytterligare spelkatalog"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "Välj katalog för spardata"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "Detta ID-namn är upptaget. Var god välj ett annat."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~A~vsluta"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Avsluta ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "O~m~..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~I~nställningar..."
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "Redigera globala ScummVM-inställningar"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "~S~tarta"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "Starta det valda spelet"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~L~adda..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "Ladda spardata för det valda spelet"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "Lä~g~g till spel..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "Håll ned Skift för masstillägg"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "R~e~digera spel..."
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "Redigera spelinställningarna"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~R~adera spel"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "Radera spelet från listan. Spelets datafiler påverkas inte."
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "Lä~g~g till spel..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "R~e~digera spel..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~R~adera spel"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "Sök i spellistan"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "Sök:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "Ladda spel:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "Ladda"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -458,7 +462,7 @@ msgstr ""
"Vill du verkligen använda mass-speldetektorn? Processen kan potentiellt "
"lägga till ett enormt antal spel."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -466,7 +470,7 @@ msgstr ""
msgid "Yes"
msgstr "Ja"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -474,37 +478,37 @@ msgstr "Ja"
msgid "No"
msgstr "Nej"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM kunde inte öppna den valda katalogen!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM kunde inte hitta några spel i den valda katalogen!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "Välj spel:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "Vill du verkligen radera den här spelkonfigurationen?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Det här spelet stöder inte laddning av spardata från launchern."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr ""
"ScummVM kunde inte hitta en motor kapabel till att köra det valda spelet!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "Masstillägg..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "Masstillägg..."
@@ -571,101 +575,93 @@ msgstr "44 kHz"
msgid "48 kHz"
msgstr "48 kHz"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "Ingen"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "Kunde inte verkställa några av grafikinställningarna:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "videoläget kunde inte ändras."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "fullskärmsinställningen kunde inte ändras."
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "inställningen för bildförhållandet kunde inte ändras."
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "Grafikläge:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "Renderingsläge:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "Speciella gitterlägen stödda av vissa spel"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fullskärmsläge"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "Korrektion av bildförhållande"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "Korrigerar bildförhållanden för 320x200-spel"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA anti-gitter"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "Aktiverar anti-gitter i EGA spel som stöder det"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "Föredragen enhet:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "Musikenhet:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "Bestämmer din föredragna emulator för ljudenhet eller ljudkort"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "Bestämmer emulator för ljudenhet eller ljudkort"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "Föredr. enhet:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "Musikenhet:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "AdLib-emulator:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "AdLib används för musik i många spel"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "Ljudfrekvens:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -673,61 +669,61 @@ msgstr ""
"Ett högre värde betecknar bättre ljudkvalitet men stöds kanske inte av ditt "
"ljudkort"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "GM-enhet:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "Bestämmer standardenheten för General MIDI-uppspelning"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "Använd inte General MIDI-musik"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "Använd första tillgängliga enhet"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr "SoundFont stöds endast av vissa ljudkort, Fluidsynth och Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "Blandat AdLib/MIDI-läge"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "Använd både MIDI och AdLib för ljudgeneration"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "MIDI gain:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "MT-32 enhet:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"Bestämmer standardenheten för Roland MT-32/LAPC1/CM32I/CM64-uppspelning"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "Äkta Roland MT-32 (inaktivera GM-emulation)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -735,193 +731,193 @@ msgstr ""
"Aktivera om du vill använda din verkliga Roland-kompatibla och dator-"
"anslutna ljudenhet"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "Äkta Roland MT-32 (ingen GM-emulation)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "Aktivera Roland GS-läge"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"Stänger av General MIDI-kartläggning för spel med Roland MT-32 soundtrack"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "Använd inte Roland MT-32 musik"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "Undertext och tal:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "Tal"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "Undertexter"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "Båda"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "Texthastighet:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "Text och tal:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "Tal"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "Text"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "Båda"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "Visa undertexter och spela upp tal"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "Texthastighet:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "Musikvolym:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "Musikvolym:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "Ljud av"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "SFX-volym:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "Volym för specialeffekter"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "SFX-volym:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "Talvolym:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "Talvolym:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "Sökv. tema:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "Sökv. tema:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"Bestämmer sökväg till andra data som används av alla spel eller ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "Sökv. tillägg:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "Sökv. tillägg:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Diverse"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Diverse"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "Tema:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "GUI-rendering:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "Autospara:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "Autospara:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "Tangenter"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "GUI-språk:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "Språk för ScummVM:s användargränssnitt"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Du måste starta om ScummVM för att ändringarna ska få effekt."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "Välj katalog för spardata"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr ""
"Det går inte att skriva till den valda katalogen. Var god välj en annan."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "Välj katalog för GUI-teman"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "Välj katalog för extra filer"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "Välj katalog för tillägg"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -929,104 +925,140 @@ msgstr ""
"Temat du valde stöder inte ditt språk. Om du vill använda det här temat "
"måste först byta till ett annat språk."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "Inget datum sparat"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "Ingen tid sparad"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "Ingen speltid sparad"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "Radera"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "Vill du verkligen radera den här spardatan?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "Datum:"
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "Tid:"
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "Speltid:"
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "Namnlös spardata"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "Spara"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "Kunde inte spara spelet."
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "Namn:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "Välj ett tema"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "Inaktiverad GFX"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Inaktiverad GFX"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "Standard rendering (16 bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "Standard (16 bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialiserad rendering (16 bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "Antialiserad (16 bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "Töm sökfältet"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "Motorn stöder inte debug-nivå '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "Meny"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Paus"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "Skippa rad"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "Fel under körning av spel:"
-#: base/main.cpp:479
+#: base/main.cpp:491
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"
@@ -1094,17 +1126,17 @@ msgstr "Avbrutit av användaren"
msgid "Unknown error"
msgstr "Okänt fel"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "Spelet i '%s' verkar vara okänt."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr ""
"Var god rapportera följande data till ScummVM-teamet tillsammans med namnet"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "på spelet du försökte lägga till och dess version/språk/etc.:"
@@ -1132,22 +1164,23 @@ msgstr "~H~jälp"
msgid "~A~bout"
msgstr "O~m~..."
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "Åte~r~vänd till launcher"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "Åte~r~vänd till launcher"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "Spara spelet:"
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1156,7 +1189,7 @@ msgstr "Spara spelet:"
msgid "Save"
msgstr "Spara"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1166,27 +1199,24 @@ msgstr ""
"hänvisa till README-filen för information och instruktioner för att få "
"ytterligare assistens."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
-msgstr ""
-"Tyvärr stöder för tillfället inte den här motorn hjälp-funktionen. Var god "
-"hänvisa till README-filen för information och instruktioner för att få "
-"ytterligare assistens."
+msgstr "Spar"
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "A~v~bryt"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~T~angenter"
@@ -1235,14 +1265,13 @@ msgstr ""
"Se README-filen för detaljer."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"Tyvärr stöder för tillfället inte den här motorn hjälp-funktionen. Var god "
-"hänvisa till README-filen för information och instruktioner för att få "
-"ytterligare assistens."
+"Kunde inte ladda spardata (%s)! Hänvisa till README-filen för grundläggande "
+"information och instruktioner för ytterligare assistans."
#: engines/engine.cpp:439
msgid ""
@@ -1258,6 +1287,88 @@ msgstr ""
msgid "Start anyway"
msgstr "Starta ändå"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "Använd originalskärmar för spara/ladda"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr "Använder originalskärmarna för spara/ladda istället för ScummVM:s"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "Återställ spel:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "Återställ"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "Använd ljus palett-läge"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "Visa grafik med spelets ljusa palett"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA anti-gitter"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "Aktivera anti-gitter i EGA-spel"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "Föredra digitala ljudeffekter"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "Föredra digitala ljudeffekter istället för syntetiserade"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "Använd IMF/Yamaha FB-01 för MIDI-uppspelning"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+"Använd ett IMB Music Feature-kort eller en Yamaha FB-01 FM synthmodul för "
+"MIDI-uppspelning"
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "Använd CD-ljud"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "Använd CD-ljud istället för spelets ljud, om tillgängligt"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "Använd Windows muspekare"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr ""
+"Använd Windows muspekare (mindre och svartvit) istället för DOS-pekaren"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "Använd silverpekare"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"Använd de alternativa silverpekarna istället för de normala guldpekarna"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1374,24 +1485,23 @@ msgstr "Tal & text"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Välj en skicklighetsnivå."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Hänvisa till din Loom(TM)-manual för hjälp."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standard (16 bpp)"
+msgstr "Standard"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Övning"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Expert"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1915,40 +2025,40 @@ 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:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
"\n"
"%s"
msgstr ""
-"Kunde inte skriva spardata till file:\n"
+"Kunde inte skriva spardata till filen:\n"
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
"\n"
"%s"
msgstr ""
-"Kunde inte läsa spardata från file:\n"
+"Kunde inte läsa spardata från filen:\n"
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
"\n"
"%s"
msgstr ""
-"Sparade framgångsrikt spardata i file\n"
+"Sparade framgångsrikt spardata i filen:\n"
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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,25 +2094,17 @@ msgstr "Huvud~m~eny"
msgid "~W~ater Effect Enabled"
msgstr "~V~atteneffekt aktiverad"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "Återställ spel:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "Återställ"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
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:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
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:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "Kunde inte skriva spardata till filen."
@@ -2014,6 +2116,64 @@ msgstr "Kunde inte radera filen."
msgid "Failed to save game"
msgstr "Kunde inte spara spelet."
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "Studiopublik"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "Aktivera studiopublik"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "Skipp-stöd"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "Tillåter skippning av text och filmscener"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "Helium-läge"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "Aktivera heliumläge"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "Mjuk rullning"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "Aktivera mjuk skärmrullning vid gångfart"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "Flytande pekare"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "Aktivera flytande pekare"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr "Livmätare"
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr "Aktivera livmätare"
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Attack 1"
@@ -2067,15 +2227,24 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
-"Du verkar använda en General MIDI enhet\n"
+"Du verkar använda en General MIDI-enhet,\n"
"men ditt spel stöder endast Roland MT32 MIDI.\n"
-"Vi försöker kartlägga Roland MT32 instrument för\n"
-"General MIDI instrument. Det kan trots allt hända\n"
+"Vi försöker kartlägga Roland MT32-instrumenten till\n"
+"General MIDI-instrument. Det kan trots allt hända\n"
"att ett fåtal ljudspår inte spelas korrekt."
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "Använd diskettversionens intro (endast CD-version)"
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
@@ -2092,10 +2261,18 @@ msgstr ""
"Filen \"sky.cpt\" har inkorrekt filstorlek.\n"
"Var god ladda hem den igen från www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "Diskettintro"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "Använd diskettversionens intro (endast CD-version)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr "PSX-filmscenen '%s' kan inte visas i palettläget"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2150,10 +2327,28 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "Här slutar Broken Sword 1 demon"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
-msgstr "DXA filmscener hittades men ScummVM har byggts utan stöd för zlib"
+msgstr "PSX-filmscener hittades men ScummVM har byggts utan stöd för RGB-färg"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "Visa etiketter"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "Visar etiketter för objekten som musen pekar på"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2164,15 +2359,15 @@ msgstr ""
"Kan inte spara data i position %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "Laddar speldata..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "Sparar speldata..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2189,11 +2384,11 @@ msgstr ""
"Tryck \"OK\" för att konvertera dem nu, annars kommer du tillfrågas igen "
"nästa gång du startar spelet.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM lyckades konvertera alla dina spardata."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2295,9 +2490,8 @@ msgid "Keymap:"
msgstr "Tangenter:"
#: backends/keymapper/remap-dialog.cpp:66
-#, fuzzy
msgid " (Effective)"
-msgstr "(Aktiv)"
+msgstr "(Effektiv)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
@@ -2305,7 +2499,7 @@ msgstr "(Aktiv)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr "(Blockerad)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2391,27 +2585,27 @@ msgstr "Hög ljudkvalitet (långsammare) (omstart)"
msgid "Disable power off"
msgstr "Inaktivera strömsparning"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "Dra-och-släpp-läge med mus aktiverat."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "Dra-och-släpp-läge med mus deaktiverat."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "Touchpad-läge aktiverat."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "Touchpad-läge inaktiverat."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
-msgstr ""
+msgstr "Klickläge"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2419,12 +2613,11 @@ msgstr ""
msgid "Left Click"
msgstr "Vänsterklick"
-#: backends/platform/maemo/maemo.cpp:214
-#, fuzzy
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
-msgstr "Mellersta vänstra föremålet"
+msgstr "Mittenklick"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2461,34 +2654,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "Normalt (ingen skalning)"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: 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/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Korrektion av bildförhållande av"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "Aktivt grafikfilter:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Fönsterläge"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL normal"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL konservation"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL original"
@@ -2829,37 +3022,37 @@ msgstr "Launcher"
msgid "Do you really want to quit?"
msgstr "Vill du verkligen avsluta?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "Touchscreen \"Tap-läge\" - Vänsterklick"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "Touchscren \"Tap-läge\" - Högerklick"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "Touchscreen \"Tap-läge\" - Hover (utan klick)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "Max. volym"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "Höja volymen"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "Min. volym"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "Sänka volymen"
diff --git a/po/uk_UA.po b/po/uk_UA.po
index 3971b29f6e..be7935518b 100644
--- a/po/uk_UA.po
+++ b/po/uk_UA.po
@@ -7,16 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2012-03-07 22:09+0000\n"
-"PO-Revision-Date: 2012-02-16 13:09+0200\n"
-"Last-Translator: Eugene Sandulenko\n"
+"POT-Creation-Date: 2012-08-12 14:57+0200\n"
+"PO-Revision-Date: 2012-06-29 20:19+0200\n"
+"Last-Translator: lubomyr <lubomyr31@gmail.com>\n"
"Language-Team: Ukrainian\n"
+"Language: Ukrainian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-5\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Ukrainian\n"
-"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%"
-"10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n"
+"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#: gui/about.cpp:91
#, c-format
@@ -45,11 +45,12 @@ msgid "Go up"
msgstr "²ÓÞàã"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
-#: gui/launcher.cpp:320 gui/massadd.cpp:94 gui/options.cpp:1253
-#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190
-#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:48
+#: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228
+#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267
+#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843
+#: gui/themebrowser.cpp:54 engines/engine.cpp:442
+#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:191
#: backends/events/default/default-events.cpp:213
msgid "Cancel"
@@ -70,15 +71,15 @@ msgstr "·ÐÚàØâØ"
msgid "Mouse click"
msgstr "ºÛöÚ ÜØèÚÞî"
-#: gui/gui-manager.cpp:122 base/main.cpp:288
+#: gui/gui-manager.cpp:122 base/main.cpp:300
msgid "Display keyboard"
msgstr "¿ÞÚÐ×ÐâØ ÚÛÐÒöÐâãàã"
-#: gui/gui-manager.cpp:126 base/main.cpp:292
+#: gui/gui-manager.cpp:126 base/main.cpp:304
msgid "Remap keys"
msgstr "¿ÕàÕßàØ×ÝÐçØâØ ÚÛÐÒöèö"
-#: gui/gui-manager.cpp:129 base/main.cpp:295
+#: gui/gui-manager.cpp:129 base/main.cpp:307
msgid "Toggle FullScreen"
msgstr "¿ÕàÕÜÚÝãâØ ßÞÒÝÞÕÚàÐÝÝØÙ àÕÖØÜ"
@@ -90,18 +91,18 @@ msgstr "²ØÑÕàöâì Ôöî ÔÛï ßàØ×ÝÐçÕÝÝï"
msgid "Map"
msgstr "¿àØ×ÝÐçØâØ"
-#: gui/KeysDialog.cpp:42 gui/launcher.cpp:321 gui/launcher.cpp:960
-#: gui/launcher.cpp:964 gui/massadd.cpp:91 gui/options.cpp:1254
-#: 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:539
-#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570
-#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865
-#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435
-#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465
-#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281
-#: backends/platform/wii/options.cpp:47
+#: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001
+#: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229
+#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372
+#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775
+#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420
+#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141
+#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560
+#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577
+#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
+#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455
+#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474
+#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47
#: backends/platform/wince/CELauncherDialog.cpp:54
msgid "OK"
msgstr "OK"
@@ -128,15 +129,15 @@ msgstr "±ãÔì ÛÐáÚÐ, ÒØÑÕàöâì Ôöî"
msgid "Press the key to associate"
msgstr "½ÐâØáÝöâì ÚÛÐÒöèã ÔÛï ßàØ×ÝÐçÕÝÝï"
-#: gui/launcher.cpp:170
+#: gui/launcher.cpp:187
msgid "Game"
msgstr "³àÐ"
-#: gui/launcher.cpp:174
+#: gui/launcher.cpp:191
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:174 gui/launcher.cpp:176 gui/launcher.cpp:177
+#: gui/launcher.cpp:191 gui/launcher.cpp:193 gui/launcher.cpp:194
msgid ""
"Short game identifier used for referring to savegames and running the game "
"from the command line"
@@ -144,29 +145,29 @@ msgstr ""
"ºÞàÞâÚØÙ öÔÕÝâØäöÚÐâÞà, ïÚØÙ ÒØÚÞàØáâÞÒãôâìáï ÔÛï ÝÐ×Ò ×ÑÕàÕÖÕÝØå öÓÞà ö ÔÛï "
"×ÐßãáÚã × ÚÞÜÐÝÔÝÞ÷ áâàöçÚØ"
-#: gui/launcher.cpp:176
+#: gui/launcher.cpp:193
msgctxt "lowres"
msgid "ID:"
msgstr "ID:"
-#: gui/launcher.cpp:181
+#: gui/launcher.cpp:198
msgid "Name:"
msgstr "½Ð×ÒÐ:"
-#: gui/launcher.cpp:181 gui/launcher.cpp:183 gui/launcher.cpp:184
+#: gui/launcher.cpp:198 gui/launcher.cpp:200 gui/launcher.cpp:201
msgid "Full title of the game"
msgstr "¿ÞÒÝÐ ÝÐ×ÒÐ ÓàØ"
-#: gui/launcher.cpp:183
+#: gui/launcher.cpp:200
msgctxt "lowres"
msgid "Name:"
msgstr "½Ð×ÒÐ:"
-#: gui/launcher.cpp:187
+#: gui/launcher.cpp:204
msgid "Language:"
msgstr "¼ÞÒÐ:"
-#: gui/launcher.cpp:187 gui/launcher.cpp:188
+#: gui/launcher.cpp:204 gui/launcher.cpp:205
msgid ""
"Language of the game. This will not turn your Spanish game version into "
"English"
@@ -174,280 +175,284 @@ msgstr ""
"¼ÞÒÐ ÓàØ. ·ÜöÝÐ æìÞÓÞ ÝÐÛÐèâãÒÐÝÝï ÝÕ ßÕàÕâÒÞàØâì Óàã ÐÝÓÛöÙáìÚÞî ÝÐ "
"ãÚàÐ÷ÝáìÚã"
-#: gui/launcher.cpp:189 gui/launcher.cpp:203 gui/options.cpp:80
-#: gui/options.cpp:745 gui/options.cpp:758 gui/options.cpp:1224
+#: gui/launcher.cpp:206 gui/launcher.cpp:220 gui/options.cpp:80
+#: gui/options.cpp:730 gui/options.cpp:743 gui/options.cpp:1199
#: audio/null.cpp:40
msgid "<default>"
msgstr "<×Ð ãÜÞÒçÐÝÝïÜ>"
-#: gui/launcher.cpp:199
+#: gui/launcher.cpp:216
msgid "Platform:"
msgstr "¿ÛÐâäÞàÜÐ:"
-#: gui/launcher.cpp:199 gui/launcher.cpp:201 gui/launcher.cpp:202
+#: gui/launcher.cpp:216 gui/launcher.cpp:218 gui/launcher.cpp:219
msgid "Platform the game was originally designed for"
msgstr "¿ÛÐâäÞàÜÐ, ÔÛï ïÚÞ÷ Óàã ÑãÛÞ àÞ×àÞÑÛÕÝÞ ßÞçÐâÚÞÒÞ"
-#: gui/launcher.cpp:201
+#: gui/launcher.cpp:218
msgctxt "lowres"
msgid "Platform:"
msgstr "¿ÛÐâäÞàÜÐ:"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:231
+msgid "Engine"
+msgstr "´ÒØÖÞÚ"
+
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "Graphics"
msgstr "³àÐäöÚÐ"
-#: gui/launcher.cpp:213 gui/options.cpp:1087 gui/options.cpp:1104
+#: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079
msgid "GFX"
msgstr "³àä"
-#: gui/launcher.cpp:216
+#: gui/launcher.cpp:242
msgid "Override global graphic settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ ÓàÐäöÚØ"
-#: gui/launcher.cpp:218
+#: gui/launcher.cpp:244
msgctxt "lowres"
msgid "Override global graphic settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ ÓàÐäöÚØ"
-#: gui/launcher.cpp:225 gui/options.cpp:1110
+#: gui/launcher.cpp:251 gui/options.cpp:1085
msgid "Audio"
msgstr "°ãÔöÞ"
-#: gui/launcher.cpp:228
+#: gui/launcher.cpp:254
msgid "Override global audio settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ ÐãÔöÞ"
-#: gui/launcher.cpp:230
+#: gui/launcher.cpp:256
msgctxt "lowres"
msgid "Override global audio settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ ÐãÔöÞ"
-#: gui/launcher.cpp:239 gui/options.cpp:1115
+#: gui/launcher.cpp:265 gui/options.cpp:1090
msgid "Volume"
msgstr "³ãçÝöáâì"
-#: gui/launcher.cpp:241 gui/options.cpp:1117
+#: gui/launcher.cpp:267 gui/options.cpp:1092
msgctxt "lowres"
msgid "Volume"
msgstr "³ãçÝ."
-#: gui/launcher.cpp:244
+#: gui/launcher.cpp:270
msgid "Override global volume settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ ÓãçÝÞáâö"
-#: gui/launcher.cpp:246
+#: gui/launcher.cpp:272
msgctxt "lowres"
msgid "Override global volume settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ ÓãçÝÞáâö"
-#: gui/launcher.cpp:254 gui/options.cpp:1125
+#: gui/launcher.cpp:280 gui/options.cpp:1100
msgid "MIDI"
msgstr "MIDI"
-#: gui/launcher.cpp:257
+#: gui/launcher.cpp:283
msgid "Override global MIDI settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ MIDI"
-#: gui/launcher.cpp:259
+#: gui/launcher.cpp:285
msgctxt "lowres"
msgid "Override global MIDI settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ MIDI"
-#: gui/launcher.cpp:268 gui/options.cpp:1131
+#: gui/launcher.cpp:294 gui/options.cpp:1106
msgid "MT-32"
msgstr "MT-32"
-#: gui/launcher.cpp:271
+#: gui/launcher.cpp:297
msgid "Override global MT-32 settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ MT-32"
-#: gui/launcher.cpp:273
+#: gui/launcher.cpp:299
msgctxt "lowres"
msgid "Override global MT-32 settings"
msgstr "¿ÕàÕÚàØâØ ÓÛÞÑÐÛìÝö ãáâÐÝÞÒÚØ MT-32"
-#: gui/launcher.cpp:282 gui/options.cpp:1138
+#: gui/launcher.cpp:308 gui/options.cpp:1113
msgid "Paths"
msgstr "ÈÛïåØ"
-#: gui/launcher.cpp:284 gui/options.cpp:1140
+#: gui/launcher.cpp:310 gui/options.cpp:1115
msgctxt "lowres"
msgid "Paths"
msgstr "ÈÛïåØ"
-#: gui/launcher.cpp:291
+#: gui/launcher.cpp:317
msgid "Game Path:"
msgstr "ÈÛïå ÔÞ ÓàØ:"
-#: gui/launcher.cpp:293
+#: gui/launcher.cpp:319
msgctxt "lowres"
msgid "Game Path:"
msgstr "ÈÛïå ÔÞ ÓàØ:"
-#: gui/launcher.cpp:298 gui/options.cpp:1164
+#: gui/launcher.cpp:324 gui/options.cpp:1139
msgid "Extra Path:"
msgstr "´ÞÔÐâÚ. èÛïå:"
-#: gui/launcher.cpp:298 gui/launcher.cpp:300 gui/launcher.cpp:301
+#: gui/launcher.cpp:324 gui/launcher.cpp:326 gui/launcher.cpp:327
msgid "Specifies path to additional data used the game"
msgstr "²ÚÐ×ãô èÛïå ÔÞ ÔÞÔÐâÚÞÒØå äÐÙÛöÒ ÔÐÝØå ÔÛï ÓàØ"
-#: gui/launcher.cpp:300 gui/options.cpp:1166
+#: gui/launcher.cpp:326 gui/options.cpp:1141
msgctxt "lowres"
msgid "Extra Path:"
msgstr "´ÞÔ. èÛïå:"
-#: gui/launcher.cpp:307 gui/options.cpp:1148
+#: gui/launcher.cpp:333 gui/options.cpp:1123
msgid "Save Path:"
msgstr "ÈÛïå ×ÑÕà.:"
-#: gui/launcher.cpp:307 gui/launcher.cpp:309 gui/launcher.cpp:310
-#: gui/options.cpp:1148 gui/options.cpp:1150 gui/options.cpp:1151
+#: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336
+#: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126
msgid "Specifies where your savegames are put"
msgstr "²ÚÐ×ãô èÛïå ÔÞ ×ÑÕàÕÖÕÝì ÓàØ"
-#: gui/launcher.cpp:309 gui/options.cpp:1150
+#: gui/launcher.cpp:335 gui/options.cpp:1125
msgctxt "lowres"
msgid "Save Path:"
msgstr "ÈÛïå ×ÑÕà.:"
-#: gui/launcher.cpp:329 gui/launcher.cpp:416 gui/launcher.cpp:469
-#: gui/launcher.cpp:523 gui/options.cpp:1159 gui/options.cpp:1167
-#: gui/options.cpp:1176 gui/options.cpp:1283 gui/options.cpp:1289
-#: gui/options.cpp:1297 gui/options.cpp:1327 gui/options.cpp:1333
-#: gui/options.cpp:1340 gui/options.cpp:1433 gui/options.cpp:1436
-#: gui/options.cpp:1448
+#: gui/launcher.cpp:354 gui/launcher.cpp:453 gui/launcher.cpp:511
+#: gui/launcher.cpp:565 gui/options.cpp:1134 gui/options.cpp:1142
+#: gui/options.cpp:1151 gui/options.cpp:1258 gui/options.cpp:1264
+#: gui/options.cpp:1272 gui/options.cpp:1302 gui/options.cpp:1308
+#: gui/options.cpp:1315 gui/options.cpp:1408 gui/options.cpp:1411
+#: gui/options.cpp:1423
msgctxt "path"
msgid "None"
msgstr "½Õ ×ÐÒÔÐÝØÙ"
-#: gui/launcher.cpp:334 gui/launcher.cpp:422 gui/launcher.cpp:527
-#: gui/options.cpp:1277 gui/options.cpp:1321 gui/options.cpp:1439
+#: gui/launcher.cpp:359 gui/launcher.cpp:459 gui/launcher.cpp:569
+#: gui/options.cpp:1252 gui/options.cpp:1296 gui/options.cpp:1414
#: backends/platform/wii/options.cpp:56
msgid "Default"
msgstr "·Ð ãÜÞÒçÐÝÝïÜ"
-#: gui/launcher.cpp:462 gui/options.cpp:1442
+#: gui/launcher.cpp:504 gui/options.cpp:1417
msgid "Select SoundFont"
msgstr "²ØÑÕàöâì SoundFont"
-#: gui/launcher.cpp:481 gui/launcher.cpp:636
+#: gui/launcher.cpp:523 gui/launcher.cpp:677
msgid "Select directory with game data"
msgstr "²ØÑÕàöâì ßÐßÚã × äÐÙÛÐÜØ ÓàØ"
-#: gui/launcher.cpp:499
+#: gui/launcher.cpp:541
msgid "Select additional game directory"
msgstr "²ØÑÕàöâì ÔÞÔÐâÚÞÒã ßÐßÚã ÓàØ"
-#: gui/launcher.cpp:511
+#: gui/launcher.cpp:553
msgid "Select directory for saved games"
msgstr "²ØÑÕàöâì ßÐßÚã ÔÛï ×ÑÕàÕÖÕÝì"
-#: gui/launcher.cpp:538
+#: gui/launcher.cpp:580
msgid "This game ID is already taken. Please choose another one."
msgstr "ÆÕÙ ID ÓàØ ÒÖÕ ÒØÚÞàØáâÞÒãôâìáï. ±ãÔì ÛÐáÚÐ, ÒØÑÕàöâì öÝèØÙ."
-#: gui/launcher.cpp:579 engines/dialogs.cpp:110
+#: gui/launcher.cpp:621 engines/dialogs.cpp:110
msgid "~Q~uit"
msgstr "~²~ØåöÔ"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:96
+#: gui/launcher.cpp:621 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "²ØåöÔ ×ö ScummVM"
-#: gui/launcher.cpp:580
+#: gui/launcher.cpp:622
msgid "A~b~out..."
msgstr "¿àÞ ß~à~ÞÓàÐÜã..."
-#: gui/launcher.cpp:580 backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: gui/launcher.cpp:622 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "¿àÞ ScummVM"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "~O~ptions..."
msgstr "~½~ÐÛÐèâãÒÐÝÝï"
-#: gui/launcher.cpp:581
+#: gui/launcher.cpp:623
msgid "Change global ScummVM options"
msgstr "·ÜöÝØâØ ÓÛÞÑÐÛìÝö ÝÐÛÐèâãÒÐÝÝï ScummVM"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "~S~tart"
msgstr "·~Ð~ßãáÚ"
-#: gui/launcher.cpp:583
+#: gui/launcher.cpp:625
msgid "Start selected game"
msgstr "·ÐßãáâØâØ ÒØÑàÐÝã Óàã"
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "~L~oad..."
msgstr "~·~ÐÒÐÝâÐÖØâØ..."
-#: gui/launcher.cpp:586
+#: gui/launcher.cpp:628
msgid "Load savegame for selected game"
msgstr "·ÐÒÐÝâÐÖØâØ ×ÑÕàÕÖÕÝÝï ÔÛï ÒØÑàÐÝÞ÷ ÓàØ"
-#: gui/launcher.cpp:591 gui/launcher.cpp:1079
+#: gui/launcher.cpp:633 gui/launcher.cpp:1120
msgid "~A~dd Game..."
msgstr "~´~ÞÔÐâØ Óàã..."
-#: gui/launcher.cpp:591 gui/launcher.cpp:598
+#: gui/launcher.cpp:633 gui/launcher.cpp:640
msgid "Hold Shift for Mass Add"
msgstr "ÃâàØÜãÙâÕ ÚÛÐÒöèã Shift ÔÛï âÞÓÞ, éÞÑ ÔÞÔÐâØ ÔÕÚöÛìÚÐ öÓÞà"
-#: gui/launcher.cpp:593
+#: gui/launcher.cpp:635
msgid "~E~dit Game..."
msgstr "ÀÕÔÐ~Ó~ãÒÐâØ Óàã"
-#: gui/launcher.cpp:593 gui/launcher.cpp:600
+#: gui/launcher.cpp:635 gui/launcher.cpp:642
msgid "Change game options"
msgstr "·ÜöÝØâØ ÝÐÛÐèâãÒÐÝÝï ÓàØ"
-#: gui/launcher.cpp:595
+#: gui/launcher.cpp:637
msgid "~R~emove Game"
msgstr "~²~ØÔÐÛØâØ Óàã"
-#: gui/launcher.cpp:595 gui/launcher.cpp:602
+#: gui/launcher.cpp:637 gui/launcher.cpp:644
msgid "Remove game from the list. The game data files stay intact"
msgstr "²ØÔÐÛØâØ Óàã ×ö áßØáÚã. ½Õ ÒØÔÐÛïô Óàã × ÖÞàáâÚÞÓÞ ÔØáÚã"
-#: gui/launcher.cpp:598 gui/launcher.cpp:1079
+#: gui/launcher.cpp:640 gui/launcher.cpp:1120
msgctxt "lowres"
msgid "~A~dd Game..."
msgstr "~´~ÞÔÐâØ Óàã..."
-#: gui/launcher.cpp:600
+#: gui/launcher.cpp:642
msgctxt "lowres"
msgid "~E~dit Game..."
msgstr "ÀÕÔÐ~Ó~. Óàã..."
-#: gui/launcher.cpp:602
+#: gui/launcher.cpp:644
msgctxt "lowres"
msgid "~R~emove Game"
msgstr "~²~ØÔÐÛØâØ Óàã"
-#: gui/launcher.cpp:610
+#: gui/launcher.cpp:652
msgid "Search in game list"
msgstr "¿ÞèãÚ ã áßØáÚã öÓÞà"
-#: gui/launcher.cpp:614 gui/launcher.cpp:1126
+#: gui/launcher.cpp:656 gui/launcher.cpp:1167
msgid "Search:"
msgstr "¿ÞèãÚ:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255
-#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245
+#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214
msgid "Load game:"
msgstr "·ÐÒÐÝâÐÖØâØ Óàã:"
-#: gui/launcher.cpp:639 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
-#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716
-#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267
+#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188
+#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716
+#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267
#: backends/platform/wince/CEActionsSmartphone.cpp:231
msgid "Load"
msgstr "·ÐÒÐÝâÐÖØâØ"
-#: gui/launcher.cpp:747
+#: gui/launcher.cpp:788
msgid ""
"Do you really want to run the mass game detector? This could potentially add "
"a huge number of games."
@@ -455,7 +460,7 @@ msgstr ""
"ÇØ ÒØ ÔöÙáÝÞ åÞçÕâÕ ×ÐßãáâØâØ ßÞèãÚ ãáöå öÓÞà? ÆÕ ßÞâÕÝæöÙÝÞ ÜÞÖÕ ÔÞÔÐâØ "
"ÒÕÛØÚã ÚöÛìÚöáâì öÓÞà."
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -463,7 +468,7 @@ msgstr ""
msgid "Yes"
msgstr "ÂÐÚ"
-#: gui/launcher.cpp:748 gui/launcher.cpp:896
+#: gui/launcher.cpp:789 gui/launcher.cpp:937
#: backends/events/symbiansdl/symbiansdl-events.cpp:184
#: backends/platform/wince/CEActionsPocket.cpp:326
#: backends/platform/wince/CEActionsSmartphone.cpp:287
@@ -471,36 +476,36 @@ msgstr "ÂÐÚ"
msgid "No"
msgstr "½ö"
-#: gui/launcher.cpp:796
+#: gui/launcher.cpp:837
msgid "ScummVM couldn't open the specified directory!"
msgstr "ScummVM ÝÕ ÜÞÖÕ ÒöÔÚàØâØ ÒÚÐ×ÐÝã ßÐßÚã!"
-#: gui/launcher.cpp:808
+#: gui/launcher.cpp:849
msgid "ScummVM could not find any game in the specified directory!"
msgstr "ScummVM ÝÕ ÜÞÖÕ ×ÝÐÙâØ Óàã ã ÒÚÐ×ÐÝöÙ ßÐßæö!"
-#: gui/launcher.cpp:822
+#: gui/launcher.cpp:863
msgid "Pick the game:"
msgstr "²ØÑÕàöâì Óàã:"
-#: gui/launcher.cpp:896
+#: gui/launcher.cpp:937
msgid "Do you really want to remove this game configuration?"
msgstr "²Ø ÔöÙáÝÞ åÞçÕâÕ ÒØÔÐÛØâØ ãáâÐÝÞÒÚØ ÔÛï æöô÷ ÓàØ?"
-#: gui/launcher.cpp:960
+#: gui/launcher.cpp:1001
msgid "This game does not support loading games from the launcher."
msgstr "Æï ÓàÐ ÝÕ ßöÔâàØÜãô ×ÐÒÐÝâÐÖÕÝÝï ×ÑÕàÕÖÕÝì çÕàÕ× ÓÞÛÞÒÝÕ ÜÕÝî."
-#: gui/launcher.cpp:964
+#: gui/launcher.cpp:1005
msgid "ScummVM could not find any engine capable of running the selected game!"
msgstr "ScummVM ÝÕ ×ÜöÓ ×ÝÐÙâØ ÔÒØÖÞÚ ÔÛï ×ÐßãáÚã ÒØÑàÐÝÞ÷ ÓàØ!"
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgctxt "lowres"
msgid "Mass Add..."
msgstr "´ÞÔ. ÑÐÓÐâÞ..."
-#: gui/launcher.cpp:1078
+#: gui/launcher.cpp:1119
msgid "Mass Add..."
msgstr "´ÞÔ. ÑÐÓÐâÞ..."
@@ -567,101 +572,93 @@ msgstr "44 Ú³æ"
msgid "48 kHz"
msgstr "48 Ú³æ"
-#: gui/options.cpp:257 gui/options.cpp:485 gui/options.cpp:586
-#: gui/options.cpp:659 gui/options.cpp:868
+#: gui/options.cpp:248 gui/options.cpp:474 gui/options.cpp:575
+#: gui/options.cpp:644 gui/options.cpp:852
msgctxt "soundfont"
msgid "None"
msgstr "½Õ ×ÐÔÐÝØÙ"
-#: gui/options.cpp:393
+#: gui/options.cpp:382
msgid "Failed to apply some of the graphic options changes:"
msgstr "½Õ ÒÔÐÛÞáï ×ÐáâÞáãÒÐâØ ÔÕïÚö ×ö ×ÜöÝ ÓàÐäöçÝØå ÝÐÛÐèâãÒÐÝì:"
-#: gui/options.cpp:405
+#: gui/options.cpp:394
msgid "the video mode could not be changed."
msgstr "ÝÕ ÒÔÐÛÞáï ×ÜöÝØâØ ÓàÐäöçÝØÙ àÕÖØÜ."
-#: gui/options.cpp:411
+#: gui/options.cpp:400
msgid "the fullscreen setting could not be changed"
msgstr "ÝÕ ÒÔÐÛÞáï ×ÜöÝØâØ àÕÖØÜ ßÞÒÝÞÓÞ ÕÚàÐÝã"
-#: gui/options.cpp:417
+#: gui/options.cpp:406
msgid "the aspect ratio setting could not be changed"
msgstr "ÝÕ ÒÔÐÛÞáï ×ÜöÝØâØ àÕÖØÜ ÚÞàÕÚæö÷ áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ"
-#: gui/options.cpp:742
+#: gui/options.cpp:727
msgid "Graphics mode:"
msgstr "³àÐäöçÝ. àÕÖØÜ:"
-#: gui/options.cpp:756
+#: gui/options.cpp:741
msgid "Render mode:"
msgstr "ÀÕÖØÜ àÐáâàãÒ.:"
-#: gui/options.cpp:756 gui/options.cpp:757
+#: gui/options.cpp:741 gui/options.cpp:742
msgid "Special dithering modes supported by some games"
msgstr "ÁßÕæöÐÛìÝö àÕÖØÜØ àÐáâàãÒÐÝÝï, ïÚö ßöÔâàØÜãîâì ÔÕïÚö öÓàØ"
-#: gui/options.cpp:768
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
+#: gui/options.cpp:753
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "¿ÞÒÝÞÕÚàÐÝÝØÙ àÕÖØÜ"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Aspect ratio correction"
msgstr "ºÞàÕÚæöï áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ"
-#: gui/options.cpp:771
+#: gui/options.cpp:756
msgid "Correct aspect ratio for 320x200 games"
msgstr "ºÞàØÓãÒÐâØ áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ ÔÛï öÓÞà × ÓàÐäöÚÞî 320x200"
-#: gui/options.cpp:772
-msgid "EGA undithering"
-msgstr "EGA ÑÕ× àÐáâàãÒÐÝÝï"
-
-#: gui/options.cpp:772
-msgid "Enable undithering in EGA games that support it"
-msgstr "²öÜÚÝãâØ àÐáâàãÒÐÝÝï Ò EGA öÓàÐå ïÚö æÕ ßöÔâàØÜãîâì"
-
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Preferred Device:"
msgstr "ÃßÞÔÞÑÐÝØÙ ßàØáâàöÙ:"
-#: gui/options.cpp:780
+#: gui/options.cpp:764
msgid "Music Device:"
msgstr "¼ã×Øç. ßàØáâàöÙ:"
-#: gui/options.cpp:780 gui/options.cpp:782
+#: gui/options.cpp:764 gui/options.cpp:766
msgid "Specifies preferred sound device or sound card emulator"
msgstr "²ÚÐ×ãô ãßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ ÐÑÞ ÕÜãÛïâÞà ×ÒãÚÞÒÞ÷ ÚÐàâØ"
-#: gui/options.cpp:780 gui/options.cpp:782 gui/options.cpp:783
+#: gui/options.cpp:764 gui/options.cpp:766 gui/options.cpp:767
msgid "Specifies output sound device or sound card emulator"
msgstr "²ÚÐ×ãô ÒØåöÔÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ ÐÑÞ ÕÜãÛïâÞà ×ÒãÚÞÒÞ÷ ÚÐàâØ"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Preferred Dev.:"
msgstr "ÃßÞÔÞÑ. ßàØáâàöÙ:"
-#: gui/options.cpp:782
+#: gui/options.cpp:766
msgctxt "lowres"
msgid "Music Device:"
msgstr "¼ã×ØçÝØÙ ßàØáâàöÙ:"
-#: gui/options.cpp:809
+#: gui/options.cpp:793
msgid "AdLib emulator:"
msgstr "µÜãÛïâÞà AdLib:"
-#: gui/options.cpp:809 gui/options.cpp:810
+#: gui/options.cpp:793 gui/options.cpp:794
msgid "AdLib is used for music in many games"
msgstr "·ÒãÚÞÒÐ ÚÐàâÐ AdLib ÒØÚÞàØáâÞÒãôâìáï ÑÐÓÐâìÜÐ öÓàÐÜØ"
-#: gui/options.cpp:820
+#: gui/options.cpp:804
msgid "Output rate:"
msgstr "²ØåöÔÝÐ çÐáâÞâÐ:"
-#: gui/options.cpp:820 gui/options.cpp:821
+#: gui/options.cpp:804 gui/options.cpp:805
msgid ""
"Higher value specifies better sound quality but may be not supported by your "
"soundcard"
@@ -669,63 +666,63 @@ msgstr ""
"²ÕÛØÚö ×ÝÐçÕÝÝï ×ÐÔÐîâì ÚàÐéã ïÚöáâì ×ÒãÚã, ßàÞâÕ ÒÞÝØ ÜÞÖãâì ÝÕ "
"ßöÔâàØÜãÒÐâØáï ÒÐèÞî ×ÒãÚÞÒÞî ÚÐàâÞî"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "GM Device:"
msgstr "¿àØáâàöÙ GM:"
-#: gui/options.cpp:831
+#: gui/options.cpp:815
msgid "Specifies default sound device for General MIDI output"
msgstr "²ÚÐ×ãô ÒØåöÔÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ ÔÛï General MIDI"
-#: gui/options.cpp:842
+#: gui/options.cpp:826
msgid "Don't use General MIDI music"
msgstr "½Õ ÒØÚÞàØáâÞÒãÒÐâØ Üã×ØÚã General MIDI"
-#: gui/options.cpp:853 gui/options.cpp:915
+#: gui/options.cpp:837 gui/options.cpp:899
msgid "Use first available device"
msgstr "²ØÚÞàØáâÞÒãÒÐâØ ßÕàèØÙ ÝÐïÒÝØÙ ßàØáâàöÙ"
-#: gui/options.cpp:865
+#: gui/options.cpp:849
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:865 gui/options.cpp:867 gui/options.cpp:868
+#: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852
msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity"
msgstr ""
"SoundFont ßöÔâàØÜãôâìáï ÔÕïÚØÜØ ×ÒãÚÞÒØÜØ ÚÐàâÐÜØ, Fluidsynth âÐ Timidity"
-#: gui/options.cpp:867
+#: gui/options.cpp:851
msgctxt "lowres"
msgid "SoundFont:"
msgstr "SoundFont:"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Mixed AdLib/MIDI mode"
msgstr "·ÜöèÐÝØÙ àÕÖØÜ AdLib/MIDI"
-#: gui/options.cpp:873
+#: gui/options.cpp:857
msgid "Use both MIDI and AdLib sound generation"
msgstr "²ØÚÞàØáâÞÒãÒÐâØ ö MIDI ö AdLib ÔÛï ÓÕÝÕàÐæö÷ ×ÒãÚã"
-#: gui/options.cpp:876
+#: gui/options.cpp:860
msgid "MIDI gain:"
msgstr "¿ÞáØÛÕÝÝï MIDI:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "MT-32 Device:"
msgstr "¿àØáâàöÙ MT-32:"
-#: gui/options.cpp:886
+#: gui/options.cpp:870
msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output"
msgstr ""
"²ÚÐ×ãô ×ÒãÚÞÒØÙ ßàØáâàöÙ ×Ð ãÜÞÒçÐÝÝïÜ ÔÛï ÒØÒÞÔã ÝÐ Roland MT-32/LAPC1/"
"CM32l/CM64"
-#: gui/options.cpp:891
+#: gui/options.cpp:875
msgid "True Roland MT-32 (disable GM emulation)"
msgstr "ÁßàÐÒÖÝöÙ Roland MT-32 (ÒØÜÚÝãâØ ÕÜãÛïæØî GM)"
-#: gui/options.cpp:891 gui/options.cpp:893
+#: gui/options.cpp:875 gui/options.cpp:877
msgid ""
"Check if you want to use your real hardware Roland-compatible sound device "
"connected to your computer"
@@ -733,193 +730,193 @@ msgstr ""
"²öÔÜöâìâÕ, ïÚéÞ ã ÒÐá ßöÔÚÛîçÕÝÞ Roland-áãÜöáÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ ö ÒØ "
"åÞçÕâÕ ÙÞÓÞ ÒØÚÞàØáâÞÒãÒÐâØ"
-#: gui/options.cpp:893
+#: gui/options.cpp:877
msgctxt "lowres"
msgid "True Roland MT-32 (no GM emulation)"
msgstr "ÁßàÐÒÖÝöÙ Roland MT-32 (ÒØÜÚÝãâØ ÕÜãÛïæØî GM)"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Enable Roland GS Mode"
msgstr "ÃÒöÜÚÝãâØ àÕÖØÜ Roland GS"
-#: gui/options.cpp:896
+#: gui/options.cpp:880
msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack"
msgstr ""
"²ØÜØÚÐô ÜÐßöÝÓ General MIDI ÔÛï öÓÞà ×ö ×ÒãÚÞÒÞî ÔÞàöÖÚÞî ÔÛï Roland MT-32"
-#: gui/options.cpp:905
+#: gui/options.cpp:889
msgid "Don't use Roland MT-32 music"
msgstr "½Õ ÒØÚÞàØáâÞÒãÒÐâØ Roland MT-32"
-#: gui/options.cpp:932
+#: gui/options.cpp:916
msgid "Text and Speech:"
msgstr "ÂÕÚáâ ö Þ×ÒãçÚÐ:"
-#: gui/options.cpp:936 gui/options.cpp:946
+#: gui/options.cpp:920 gui/options.cpp:930
msgid "Speech"
msgstr "¾×ÒãçÚÐ"
-#: gui/options.cpp:937 gui/options.cpp:947
+#: gui/options.cpp:921 gui/options.cpp:931
msgid "Subtitles"
msgstr "ÁãÑâØâàØ"
-#: gui/options.cpp:938
+#: gui/options.cpp:922
msgid "Both"
msgstr "²áÕ"
-#: gui/options.cpp:940
+#: gui/options.cpp:924
msgid "Subtitle speed:"
msgstr "ÈÒØÔ. áãÑâØâàöÒ:"
-#: gui/options.cpp:942
+#: gui/options.cpp:926
msgctxt "lowres"
msgid "Text and Speech:"
msgstr "ÂÕÚáâ ö Þ×ÒãçÚÐ:"
-#: gui/options.cpp:946
+#: gui/options.cpp:930
msgid "Spch"
msgstr "¾×Ò"
-#: gui/options.cpp:947
+#: gui/options.cpp:931
msgid "Subs"
msgstr "狄"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgctxt "lowres"
msgid "Both"
msgstr "²áÕ"
-#: gui/options.cpp:948
+#: gui/options.cpp:932
msgid "Show subtitles and play speech"
msgstr "¿ÞÚÐ×ãÒÐâØ áãÑâØâàØ ö ÒöÔâÒÞàîÒÐâØ ÜÞÒã"
-#: gui/options.cpp:950
+#: gui/options.cpp:934
msgctxt "lowres"
msgid "Subtitle speed:"
msgstr "ÈÒØÔ. áãÑâØâàöÒ:"
-#: gui/options.cpp:966
+#: gui/options.cpp:950
msgid "Music volume:"
msgstr "³ãçÝöáâì Üã×ØÚØ:"
-#: gui/options.cpp:968
+#: gui/options.cpp:952
msgctxt "lowres"
msgid "Music volume:"
msgstr "³ãçÝöáâì Üã×ØÚØ:"
-#: gui/options.cpp:975
+#: gui/options.cpp:959
msgid "Mute All"
msgstr "²ØÜÚÝãâØ ÒáÕ"
-#: gui/options.cpp:978
+#: gui/options.cpp:962
msgid "SFX volume:"
msgstr "³ãçÝöáâì ÕäÕÚâöÒ:"
-#: gui/options.cpp:978 gui/options.cpp:980 gui/options.cpp:981
+#: gui/options.cpp:962 gui/options.cpp:964 gui/options.cpp:965
msgid "Special sound effects volume"
msgstr "³ãçÝöáâì áßÕæöÐÛìÝØå ×ÒãÚÞÒØå ÕäÕÚâöÒ"
-#: gui/options.cpp:980
+#: gui/options.cpp:964
msgctxt "lowres"
msgid "SFX volume:"
msgstr "³ãçÝ. ÕäÕÚâöÒ:"
-#: gui/options.cpp:988
+#: gui/options.cpp:972
msgid "Speech volume:"
msgstr "³ãçÝöáâì Þ×ÒãçÚØ:"
-#: gui/options.cpp:990
+#: gui/options.cpp:974
msgctxt "lowres"
msgid "Speech volume:"
msgstr "³ãçÝ. Þ×ÒãçÚØ:"
-#: gui/options.cpp:1156
+#: gui/options.cpp:1131
msgid "Theme Path:"
msgstr "ÈÛïå ÔÞ âÕÜ:"
-#: gui/options.cpp:1158
+#: gui/options.cpp:1133
msgctxt "lowres"
msgid "Theme Path:"
msgstr "ÈÛïå ÔÞ âÕÜ:"
-#: gui/options.cpp:1164 gui/options.cpp:1166 gui/options.cpp:1167
+#: gui/options.cpp:1139 gui/options.cpp:1141 gui/options.cpp:1142
msgid "Specifies path to additional data used by all games or ScummVM"
msgstr ""
"²ÚÐ×ãô èÛïå ÔÞ ÔÞÔÐâÚÞÒØå äÐÙÛöÒ ÔÐÝØå, ïÚö ÒØÚÞàØáâÞÒãîâìáï ãáöÜÐ öÓàÐÜØ "
"ÐÑÞ ScummVM"
-#: gui/options.cpp:1173
+#: gui/options.cpp:1148
msgid "Plugins Path:"
msgstr "ÈÛïå ÔÞ ÒâãÛÚöÒ:"
-#: gui/options.cpp:1175
+#: gui/options.cpp:1150
msgctxt "lowres"
msgid "Plugins Path:"
msgstr "ÈÛïå ÔÞ ÒâãÛÚöÒ:"
-#: gui/options.cpp:1184
+#: gui/options.cpp:1159
msgid "Misc"
msgstr "Àö×ÝÕ"
-#: gui/options.cpp:1186
+#: gui/options.cpp:1161
msgctxt "lowres"
msgid "Misc"
msgstr "Àö×ÝÕ"
-#: gui/options.cpp:1188
+#: gui/options.cpp:1163
msgid "Theme:"
msgstr "ÂÕÜÐ:"
-#: gui/options.cpp:1192
+#: gui/options.cpp:1167
msgid "GUI Renderer:"
msgstr "ÀÐáâÕà. GUI:"
-#: gui/options.cpp:1204
+#: gui/options.cpp:1179
msgid "Autosave:"
msgstr "°ÒâÞ×ÑÕàÕÖÕÝÝï:"
-#: gui/options.cpp:1206
+#: gui/options.cpp:1181
msgctxt "lowres"
msgid "Autosave:"
msgstr "°ÒâÞ×ÑÕàÕÖ.:"
-#: gui/options.cpp:1214
+#: gui/options.cpp:1189
msgid "Keys"
msgstr "ºÛÐÒöèö"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "GUI Language:"
msgstr "¼ÞÒÐ öÝâÕàä.:"
-#: gui/options.cpp:1221
+#: gui/options.cpp:1196
msgid "Language of ScummVM GUI"
msgstr "¼ÞÒÐ ÓàÐäöçÝÞÓÞ öÝâÕàäÕÙáã ScummVM"
-#: gui/options.cpp:1372
+#: gui/options.cpp:1347
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "²Ø ßÞÒØÝÝö ßÕàÕ×ÐßãáâØâØ ScummVM éÞÑ ×ÐáâÞáãÒÐâØ ×ÜöÝØ."
-#: gui/options.cpp:1385
+#: gui/options.cpp:1360
msgid "Select directory for savegames"
msgstr "²ØÑÕàöâì ßÐßÚã ÔÛï ×ÑÕàÕÖÕÝì"
-#: gui/options.cpp:1392
+#: gui/options.cpp:1367
msgid "The chosen directory cannot be written to. Please select another one."
msgstr "½Õ ÜÞÖã ßØáÐâØ ã ÒØÑàÐÝã ßÐßÚã. ±ãÔì ÛÐáÚÐ, ÒÚÐÖöâì öÝèã."
-#: gui/options.cpp:1401
+#: gui/options.cpp:1376
msgid "Select directory for GUI themes"
msgstr "²ØÑÕàöâì ßÐßÚã ÔÛï âÕÜ GUI"
-#: gui/options.cpp:1411
+#: gui/options.cpp:1386
msgid "Select directory for extra files"
msgstr "²ØÑÕàöâì ßÐßÚã × ÔÞÔÐâÚÞÒØÜØ äÐÙÛÐÜØ"
-#: gui/options.cpp:1422
+#: gui/options.cpp:1397
msgid "Select directory for plugins"
msgstr "²ØÑÕàöâì ßÐßÚã ×ö ÒâãÛÚÐÜØ"
-#: gui/options.cpp:1475
+#: gui/options.cpp:1450
msgid ""
"The theme you selected does not support your current language. If you want "
"to use this theme you need to switch to another language first."
@@ -927,104 +924,140 @@ msgstr ""
"²ØÑàÐÝÐ âÕÜÐ ÝÕ ßöÔâàØÜãô ßÞâÞçÝã ÜÞÒã. ÏÚéÞ ÒØ åÞçÕâÕ ÒØÚÞàØáâÞÒãÒÐâØ æî "
"âÕÜã, ßÞâàöÑÝÞ Ò ßÕàèã çÕàÓã ×ÜöÝØâØ ÜÞÒã."
-#: gui/saveload.cpp:58 gui/saveload.cpp:239
+#: gui/saveload-dialog.cpp:158
+msgid "List view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:159
+msgid "Grid view"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350
msgid "No date saved"
msgstr "´Ðâã ÝÕ ×ÐßØáÐÝÞ"
-#: gui/saveload.cpp:59 gui/saveload.cpp:240
+#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351
msgid "No time saved"
msgstr "ÇÐá ÝÕ ×ÐßØáÐÝÞ"
-#: gui/saveload.cpp:60 gui/saveload.cpp:241
+#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352
msgid "No playtime saved"
msgstr "ÇÐá ÓàØ ÝÕ ×ÐßØáÐÝÞ"
-#: gui/saveload.cpp:67 gui/saveload.cpp:155
+#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267
msgid "Delete"
msgstr "²ØÔÐÛØâØ"
-#: gui/saveload.cpp:154
+#: gui/saveload-dialog.cpp:266
msgid "Do you really want to delete this savegame?"
msgstr "²Ø ÔöÙáÝÞ åÞçÕâÕ ÒØÔÐÛØâØ æÕ ×ÑÕàÕÖÕÝÝï?"
-#: gui/saveload.cpp:264
+#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796
msgid "Date: "
msgstr "´ÐâÐ: "
-#: gui/saveload.cpp:268
+#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802
msgid "Time: "
msgstr "ÇÐá: "
-#: gui/saveload.cpp:274
+#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810
msgid "Playtime: "
msgstr "ÇÐá ÓàØ: "
-#: gui/saveload.cpp:287 gui/saveload.cpp:354
+#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465
msgid "Untitled savestate"
msgstr "·ÑÕàÕÖÕÝÝï ÑÕ× öÜÕÝö"
+#: gui/saveload-dialog.cpp:517
+msgid "Next"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:520
+msgid "Prev"
+msgstr ""
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "New Save"
+msgstr "·ÐßØáÐâØ"
+
+#: gui/saveload-dialog.cpp:684
+#, fuzzy
+msgid "Create a new save game"
+msgstr "½Õ ÒÔÐÛÞáï ×ÐßØáÐâØ Óàã"
+
+#: gui/saveload-dialog.cpp:789
+#, fuzzy
+msgid "Name: "
+msgstr "½Ð×ÒÐ:"
+
+#: gui/saveload-dialog.cpp:861
+#, c-format
+msgid "Enter a description for slot %d:"
+msgstr ""
+
#: gui/themebrowser.cpp:44
msgid "Select a Theme"
msgstr "²ØÑÕàöâì âÕÜã"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgid "Disabled GFX"
msgstr "±Õ× ÓàÐäöÚØ"
-#: gui/ThemeEngine.cpp:333
+#: gui/ThemeEngine.cpp:337
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "±Õ× ÓàÐäöÚØ"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard Renderer (16bpp)"
msgstr "ÁâÐÝÔÐàâÝØÙ àÐáâÕàØ×ÐâÞà (16bpp)"
-#: gui/ThemeEngine.cpp:334
+#: gui/ThemeEngine.cpp:338
msgid "Standard (16bpp)"
msgstr "ÁâÐÝÔÐàâÝØÙ àÐáâÕàØ×ÐâÞà (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased Renderer (16bpp)"
msgstr "ÀÐáâÕàØ×ÐâÞà ×ö ×ÓÛÐÔÖãÒÐÝÝïÜ (16bpp)"
-#: gui/ThemeEngine.cpp:336
+#: gui/ThemeEngine.cpp:340
msgid "Antialiased (16bpp)"
msgstr "ÀÐáâÕàØ×ÐâÞà ×ö ×ÓÛÐÔÖãÒÐÝÝïÜ (16bpp)"
-#: gui/widget.cpp:312 gui/widget.cpp:314 gui/widget.cpp:320 gui/widget.cpp:322
+#: gui/widget.cpp:322 gui/widget.cpp:324 gui/widget.cpp:330 gui/widget.cpp:332
msgid "Clear value"
msgstr "¾çØáâØâØ ×ÝÐçÕÝÝï"
-#: base/main.cpp:203
+#: base/main.cpp:209
#, c-format
msgid "Engine does not support debug level '%s'"
msgstr "´ÒØÖÞÚ ÝÕ ßöÔâàØÜãô àöÒÕÝì ÒöÔÛÐÔÚØ '%s'"
-#: base/main.cpp:275
+#: base/main.cpp:287
msgid "Menu"
msgstr "¼ÕÝî"
-#: base/main.cpp:278 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:290 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:281 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:293 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "¿Ðã×Ð"
-#: base/main.cpp:284
+#: base/main.cpp:296
msgid "Skip line"
msgstr "¿àÞßãáâØâØ àïÔÞÚ"
-#: base/main.cpp:455
+#: base/main.cpp:467
msgid "Error running game:"
msgstr "¿ÞÜØÛÚÐ ×ÐßãáÚã ÓàØ:"
-#: base/main.cpp:479
+#: base/main.cpp:491
msgid "Could not find any engine capable of running the selected game"
msgstr "½Õ ÜÞÖã ×ÝÐÙâØ ÔÒØÖÞÚ ÔÛï ×ÐßãáÚã ÒØÑàÐÝÞ÷ ÓàØ"
@@ -1092,16 +1125,16 @@ msgstr "²öÔÜöÝÕÝÞ ÚÞàØáâãÒÐçÕÜ"
msgid "Unknown error"
msgstr "½ÕÒöÔÞÜÐ ßÞÜØÛÚÐ"
-#: engines/advancedDetector.cpp:296
+#: engines/advancedDetector.cpp:316
#, c-format
msgid "The game in '%s' seems to be unknown."
msgstr "³àÐ ã '%s' ÝÕÒöÔÞÜÐ."
-#: engines/advancedDetector.cpp:297
+#: engines/advancedDetector.cpp:317
msgid "Please, report the following data to the ScummVM team along with name"
msgstr "±ãÔì ÛÐáÚÐ, ßÕàÕÔÐÙâÕ ÝØÖçÕÝÐÒÕÔÕÝã öÝäÞàÜÐæöî ÚÞÜÐÝÔö ScummVM àÐ×ÞÜ ×"
-#: engines/advancedDetector.cpp:299
+#: engines/advancedDetector.cpp:319
msgid "of the game you tried to add and its version/language/etc.:"
msgstr "ÝÐ×ÒÞî ÓàØ, ïÚã ÒØ ÝÐÜÐÓÐôâÕáì ÔÞÔÐâØ, Ð âÐÚÞÖ ÷÷ ÒÕàáöî/ÜÞÒã/âÐ öÝèÕ:"
@@ -1129,22 +1162,23 @@ msgstr "~´~ÞßÞÜÞÓÐ"
msgid "~A~bout"
msgstr "¿àÞ ßàÞ~Ó~àÐÜã"
-#: engines/dialogs.cpp:104 engines/dialogs.cpp:182
+#: engines/dialogs.cpp:104 engines/dialogs.cpp:180
msgid "~R~eturn to Launcher"
msgstr "~¿~ÞÒÕà. Ò ÓÞÛÞÒÝÕ ÜÕÝî"
-#: engines/dialogs.cpp:106 engines/dialogs.cpp:184
+#: engines/dialogs.cpp:106 engines/dialogs.cpp:182
msgctxt "lowres"
msgid "~R~eturn to Launcher"
msgstr "~¿~ÞÒÕà.Ò ÓÞÛÞÒÝÕ ÜÕÝî"
-#: engines/dialogs.cpp:116 engines/cruise/menu.cpp:214
-#: engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742
msgid "Save game:"
msgstr "·ÑÕàÕÓâØ Óàã: "
-#: engines/dialogs.cpp:116 engines/scumm/dialogs.cpp:187
-#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:566
+#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803
+#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212
+#: engines/sci/engine/kfile.cpp:742
#: backends/platform/symbian/src/SymbianActions.cpp:44
#: backends/platform/wince/CEActionsPocket.cpp:43
#: backends/platform/wince/CEActionsPocket.cpp:267
@@ -1153,7 +1187,7 @@ msgstr "·ÑÕàÕÓâØ Óàã: "
msgid "Save"
msgstr "·ÐßØáÐâØ"
-#: engines/dialogs.cpp:146
+#: engines/dialogs.cpp:144
msgid ""
"Sorry, this engine does not currently provide in-game help. Please consult "
"the README for basic information, and for instructions on how to obtain "
@@ -1163,27 +1197,26 @@ msgstr ""
"README ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã "
"ÔÞßÞÜÞÓã."
-#: engines/dialogs.cpp:243
-#, fuzzy, c-format
+#: engines/dialogs.cpp:228
+#, c-format
msgid ""
"Gamestate save failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"²ØÑÐçâÕ, æÕÙ ÔÒØÖÞÚ ÝÕ ßöÔâàØÜãô ÔÞÒöÔÚã ßÞ öÓàÐÜ. ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ "
-"README ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã "
-"ÔÞßÞÜÞÓã."
+"·ÑÕàÕÖÕÝÝï áâÐÝã ÓàØ ÝÕ ÒÔÐÛÞáï (%s)!. ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ README ÔÛï "
+"ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã ÔÞßÞÜÞÓã."
-#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109
+#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109
#: engines/mohawk/dialogs.cpp:174
msgid "~O~K"
msgstr "~O~K"
-#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110
+#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110
#: engines/mohawk/dialogs.cpp:175
msgid "~C~ancel"
msgstr "²ö~Ô~ÜöÝÐ"
-#: engines/dialogs.cpp:325
+#: engines/dialogs.cpp:305
msgid "~K~eys"
msgstr "~º~ÛÐÒöèö"
@@ -1232,14 +1265,13 @@ msgstr ""
"´ØÒöâìáï äÐÙÛ README ÔÛï ßÞÔÐÛìèØå öÝáâàãÚæöÙ."
#: engines/engine.cpp:426
-#, fuzzy, c-format
+#, c-format
msgid ""
"Gamestate load failed (%s)! Please consult the README for basic information, "
"and for instructions on how to obtain further assistance."
msgstr ""
-"²ØÑÐçâÕ, æÕÙ ÔÒØÖÞÚ ÝÕ ßöÔâàØÜãô ÔÞÒöÔÚã ßÞ öÓàÐÜ. ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ "
-"README ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã "
-"ÔÞßÞÜÞÓã."
+"·ÐÒÐÝâÐÖÕÝÝï áâÐÝã ÓàØ ÝÕ ÒÔÐÛÞáï (%s)! . ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ README "
+"ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã ÔÞßÞÜÞÓã."
#: engines/engine.cpp:439
msgid ""
@@ -1255,6 +1287,87 @@ msgstr ""
msgid "Start anyway"
msgstr "²áÕ ÞÔÝÞ ×ÐßãáâØâØ"
+#: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47
+#: engines/sci/detection.cpp:390
+msgid "Use original save/load screens"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ ÞàØÓ. ×ÑÕàÕÖÕÝÝï/×ÐÒÐÝâÐÖÕÝÝï ÕÚàÐÝØ"
+
+#: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48
+#: engines/sci/detection.cpp:391
+msgid "Use the original save/load screens, instead of the ScummVM ones"
+msgstr ""
+"²ØÚÞàØáâÞÒãÒÐâØ ÞàØÓöÝÐÛìÝö ×ÑÕàÕÖÕÝÝï/×ÐÒÐÝâÐÖÕÝÝï ÕÚàÐÝØ, ×ÐÜöáâì ScummVM"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore game:"
+msgstr "²öÔÝÞÒØâØ Óàã:"
+
+#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838
+msgid "Restore"
+msgstr "²öÔÝÞÒØâØ"
+
+#: engines/dreamweb/detection.cpp:57
+msgid "Use bright palette mode"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ ïáÚàÐÒØÙ àÕÖØÜ ßÐÛöâàØ"
+
+#: engines/dreamweb/detection.cpp:58
+msgid "Display graphics using the game's bright palette"
+msgstr "²öÔÞÑàÐÖÕÝÝï ÓàÐäöÚØ × ÒØÚÞàØáâÐÝÝïÜ ïáÚàÐÒÞ÷ ßÐÛöâàØ öÓà"
+
+#: engines/sci/detection.cpp:370
+msgid "EGA undithering"
+msgstr "EGA ÑÕ× àÐáâàãÒÐÝÝï"
+
+#: engines/sci/detection.cpp:371
+msgid "Enable undithering in EGA games"
+msgstr "ÃÒöÜÚÝãâØ ÐÝâØ-×ÓÛÐÔÖãÒÐÝÝï Ò EGA öÓàÐå"
+
+#: engines/sci/detection.cpp:380
+msgid "Prefer digital sound effects"
+msgstr "½ÐÔÐÒÐâØ ßÕàÕÒÐÓã æØäàÞÒØÜ ×ÒãÚÞÒØÜ ÕäÕÚâÐÜ"
+
+#: engines/sci/detection.cpp:381
+msgid "Prefer digital sound effects instead of synthesized ones"
+msgstr "²öÔÔÐÒÐâØ ßÕàÕÒÐÓã æØäàÞÒØÜ ×ÒãÚÞÒØÜ ÕäÕÚâÐÜ, Ð ÝÕ áØÝâÕ×ÞÒÐÝØÜ"
+
+#: engines/sci/detection.cpp:400
+msgid "Use IMF/Yamaha FB-01 for MIDI output"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ IMF/Yahama FB-01 ÔÛï MIDI ÒØåÞÔã"
+
+#: engines/sci/detection.cpp:401
+msgid ""
+"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI "
+"output"
+msgstr ""
+
+#: engines/sci/detection.cpp:411
+msgid "Use CD audio"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ CD ÐãÔöÞ"
+
+#: engines/sci/detection.cpp:412
+msgid "Use CD audio instead of in-game audio, if available"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ CD ÐãÔöÞ ×ÐÜöáâì ã-Óàö ÐãÔöÞ, ïÚéÞ âÐÚö ô"
+
+#: engines/sci/detection.cpp:422
+msgid "Use Windows cursors"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ Windows ÚãàáÞàØ"
+
+#: engines/sci/detection.cpp:423
+msgid ""
+"Use the Windows cursors (smaller and monochrome) instead of the DOS ones"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ Windows ÚãàáÞàØ (ÜÕÝèØå ö ÜÞÝÞåàÞÜÝØå), ×ÐÜöáâì DOS"
+
+#: engines/sci/detection.cpp:433
+msgid "Use silver cursors"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ áàöÑÝö ÚãàáÞàØ"
+
+#: engines/sci/detection.cpp:434
+msgid ""
+"Use the alternate set of silver cursors, instead of the normal golden ones"
+msgstr ""
+"²ØÚÞàØáâÞÒãÒÐâØ ÐÛìâÕàÝÐâØÒÝØÙ ÝÐÑöà áàöÑÝØå ÚãàáÞàöÒ, ×ÐÜöáâì ×ÒØçÐÙÝØå "
+"×ÞÛÞâØå"
+
#: engines/scumm/dialogs.cpp:175
#, c-format
msgid "Insert Disk %c and Press Button to Continue."
@@ -1911,7 +2024,7 @@ msgstr ""
"ÀÕÖØÜ \"àöÔÝÞÓÞ\" MIDI ßÞâàÕÑãô ßÞÝÞÒÛÕÝÝï Roland Upgrade ÒöÔ\n"
"LucasArts, ßàÞâÕ %s ÒöÔáãâÝöÙ. ¿ÕàÕÜØÚÐîáì ÝÐ AdLib."
-#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1922,7 +2035,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1933,7 +2046,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1944,7 +2057,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2505
+#: engines/scumm/scumm.cpp:2512
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,25 +2093,17 @@ msgstr "³ÞÛÞÒÝÕ ÜÕÝî"
msgid "~W~ater Effect Enabled"
msgstr "µäÕÚâØ ÒÞÔØ ãÒöÜÚÝÕÝÞ"
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore game:"
-msgstr "²öÔÝÞÒØâØ Óàã:"
-
-#: engines/sci/engine/kfile.cpp:673
-msgid "Restore"
-msgstr "²öÔÝÞÒØâØ"
-
-#: engines/agos/animation.cpp:550
+#: engines/agos/animation.cpp:560
#, c-format
msgid "Cutscene file '%s' not found!"
msgstr "ÄÐÙÛ ×ÐáâÐÒÚØ '%s' ÝÕ ×ÝÐÙÔÕÝÞ!"
-#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:502
+#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287
+#: engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
msgstr "½Õ ÒÔÐÛÞáï ×ÐÒÐÝâÐÖØâØ áâÐÝ ÓàØ × äÐÙÛã."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515
+#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545
msgid "Failed to save game state to file."
msgstr "½Õ ÒÔÐÛÞáï ×ÑÕàÕÓâØ áâÐÝ ÓàØ ã äÐÙÛ."
@@ -2010,6 +2115,64 @@ msgstr "½Õ ÒÔÐÛÞáï ÒØÔÐÛØâØ äÐÙÛ."
msgid "Failed to save game"
msgstr "½Õ ÒÔÐÛÞáï ×ÐßØáÐâØ Óàã"
+#. I18N: Studio audience adds an applause and cheering sounds whenever
+#. Malcolm makes a joke.
+#: engines/kyra/detection.cpp:62
+msgid "Studio audience"
+msgstr "ÁâãÔöï ÐãÔØâÞàö÷"
+
+#: engines/kyra/detection.cpp:63
+msgid "Enable studio audience"
+msgstr "ÃÒöÜÚÝãâØ áâãÔöî ÐãÔØâÞàö÷"
+
+#. I18N: This option allows the user to skip text and cutscenes.
+#: engines/kyra/detection.cpp:73
+msgid "Skip support"
+msgstr "¿öÔâàØÜãÒÐâØ ¿àÞßãáâØâØ"
+
+#: engines/kyra/detection.cpp:74
+msgid "Allow text and cutscenes to be skipped"
+msgstr "´Þ×ÒÞÛØâØ ßàÞßãáÚÐâØ âÕÚáâ ö àÞÛØÚØ"
+
+#. I18N: Helium mode makes people sound like they've inhaled Helium.
+#: engines/kyra/detection.cpp:84
+msgid "Helium mode"
+msgstr "ÀÕÖØÜ ³ÕÛöãÜ"
+
+#: engines/kyra/detection.cpp:85
+msgid "Enable helium mode"
+msgstr "ÃÒöÜÚÝãâØ àÕÖØÜ ³ÕÛöãÜ"
+
+#. I18N: When enabled, this option makes scrolling smoother when
+#. changing from one screen to another.
+#: engines/kyra/detection.cpp:99
+msgid "Smooth scrolling"
+msgstr "¿ÛÐÒÝÐ ßàÞÚàãâÚÐ"
+
+#: engines/kyra/detection.cpp:100
+msgid "Enable smooth scrolling when walking"
+msgstr "ÃÒöÜÚÝãâØ ßÛÐÒÝã ßàÞÚàãâÚã ßàØ åÞÔìÑö"
+
+#. I18N: When enabled, this option changes the cursor when it floats to the
+#. edge of the screen to a directional arrow. The player can then click to
+#. walk towards that direction.
+#: engines/kyra/detection.cpp:112
+msgid "Floating cursors"
+msgstr "¿ÛÐÒÐîçö ÚãàáÞàØ"
+
+#: engines/kyra/detection.cpp:113
+msgid "Enable floating cursors"
+msgstr "ÃÒöÜÚÝãâØ ßÛÐÒÐîçö ÚãàáÞàØ"
+
+#. I18N: HP stands for Hit Points
+#: engines/kyra/detection.cpp:127
+msgid "HP bar graphs"
+msgstr ""
+
+#: engines/kyra/detection.cpp:128
+msgid "Enable hit point bar graphs"
+msgstr ""
+
#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "°âÐÚÐ 1"
@@ -2063,8 +2226,8 @@ msgid ""
"You appear to be using a General MIDI device,\n"
"but your game only supports Roland MT32 MIDI.\n"
"We try to map the Roland MT32 instruments to\n"
-"General MIDI ones. After all it might happen\n"
-"that a few tracks will not be correctly played."
+"General MIDI ones. It is still possible that\n"
+"some tracks sound incorrect."
msgstr ""
"·ÔÐôâìáï, éÞ ²Ø ÒØÚÞàØáâÞÒãôâÕ ßàØáâàöÙ General\n"
"MIDI, ÐÛÕ ²ÐèÐ ÓàÐ ßöÔâàØÜãô âöÛìÚØ Roland MT32\n"
@@ -2072,6 +2235,15 @@ msgstr ""
"MT32 ÝÐ General MIDI. °ÛÕ Ò àÕ×ãÛìâÐâö ÜÞÖÕ\n"
"áâÐâØáï, éÞ ÔÕïÚö âàÕÚØ ÑãÔãâì ÓàÐâØ ÝÕßàÐÒØÛìÝÞ."
+#: engines/queen/queen.cpp:59
+msgid "Alternative intro"
+msgstr ""
+
+#: engines/queen/queen.cpp:60
+#, fuzzy
+msgid "Use an alternative game intro (CD version only)"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ ÔØáÚÕâÝö ÒÕàáö÷ ÒÒÕÔÕÝÝï (âöÛìÚØ CD ÒÕàáöï)"
+
#: engines/sky/compact.cpp:130
msgid ""
"Unable to find \"sky.cpt\" file!\n"
@@ -2088,10 +2260,18 @@ msgstr ""
"ÄÐÙÛ sky.cpt ÜÐô ÝÕÒöàÝØÙ àÞ×Üöà.\n"
"±ãÔì ÛÐáÚÐ, (ßÕàÕ)×ÐÒÐÝâÐÖâÕ ÙÞÓÞ × www.scummvm.org"
+#: engines/sky/detection.cpp:44
+msgid "Floppy intro"
+msgstr "´ØáÚÕâÝÕ ÒÒÕÔÕÝÝï"
+
+#: engines/sky/detection.cpp:45
+msgid "Use the floppy version's intro (CD version only)"
+msgstr "²ØÚÞàØáâÞÒãÒÐâØ ÔØáÚÕâÝö ÒÕàáö÷ ÒÒÕÔÕÝÝï (âöÛìÚØ CD ÒÕàáöï)"
+
#: engines/sword1/animation.cpp:539
#, c-format
msgid "PSX stream cutscene '%s' cannot be played in paletted mode"
-msgstr ""
+msgstr " àÞÛØÚ PSX ßÞâÞÚã '%s' ÝÕ ÜÞÖãâì ÑãâØ ÒöÔâÒÞàÕÝö ã àÕÖØÜö ßÐÛöâàØ"
#: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
@@ -2145,10 +2325,28 @@ msgid "This is the end of the Broken Sword 1 Demo"
msgstr "½Ð æìÞÜã ×ÐÚöÝçãôâìáï ÔÕÜÞ Broken Sword 1"
#: engines/sword2/animation.cpp:435
-#, fuzzy
msgid ""
"PSX cutscenes found but ScummVM has been built without RGB color support"
-msgstr "·ÝÐÙÔÕÝÞ ×ÐáâÐÒÚØ DXA, ÐÛÕ ScummVM ÑãÒ ßÞÑãÔÞÒÐÝØÙ ÑÕ× ßöÔâàØÜÚØ zlib"
+msgstr "·ÝÐÙÔÕÝö PSX àÞÛØÚØ, ÐÛÕ ScummVM ÑãÒ ×öÑàÐÝØÙ ÑÕ× ßöÔâàØÜÚØ RGB ÚÞÛöàã"
+
+#: engines/sword2/sword2.cpp:79
+msgid "Show object labels"
+msgstr "¿ÞÚÐ×ãÒÐâØ ÜöâÚØ ÞÑ'ôÚâöÒ"
+
+#: engines/sword2/sword2.cpp:80
+msgid "Show labels for objects on mouse hover"
+msgstr "¿ÞÚÐ×ãÒÐâØ ÜöâÚØ ÔÛï ÞÑ'ôÚâöÒ ßàØ ÝÐÒÕÔÕÝÝö ÜØèö"
+
+#: engines/teenagent/resources.cpp:68
+msgid ""
+"You're missing the 'teenagent.dat' file. Get it from the ScummVM website"
+msgstr ""
+
+#: engines/teenagent/resources.cpp:89
+msgid ""
+"The teenagent.dat file is compressed and zlib hasn't been included in this "
+"executable. Please decompress it"
+msgstr ""
#: engines/parallaction/saveload.cpp:133
#, c-format
@@ -2159,15 +2357,15 @@ msgstr ""
"½Õ ÜÞÖã ×ÑÕàÕÓâØ Óàã ã áÛÞâ %i\n"
"\n"
-#: engines/parallaction/saveload.cpp:211
+#: engines/parallaction/saveload.cpp:204
msgid "Loading game..."
msgstr "·ÐÒÐÝâÐÖãî Óàã..."
-#: engines/parallaction/saveload.cpp:226
+#: engines/parallaction/saveload.cpp:219
msgid "Saving game..."
msgstr "·ÑÕàÕÖãî Óàã..."
-#: engines/parallaction/saveload.cpp:279
+#: engines/parallaction/saveload.cpp:272
msgid ""
"ScummVM found that you have old savefiles for Nippon Safes that should be "
"renamed.\n"
@@ -2183,11 +2381,11 @@ msgstr ""
"½ÐâØáÝöâì ¾º, éÞÑ ßÕàÕÒÕáâØ ÷å ×ÐàÐ×, öÝÐÚèÕ ãÕ ßÞÒöÔÞÜÛÕÝÝï ×'ïÒØâìáï ßàØ "
"ÝÐáâãßÝÞÜã ×ÐßãáÚã ÓàØ.\n"
-#: engines/parallaction/saveload.cpp:326
+#: engines/parallaction/saveload.cpp:319
msgid "ScummVM successfully converted all your savefiles."
msgstr "ScummVM ãáßöèÝÞ ßÕàÕÒöÒ ãáö ²Ðèö ×ÑÕàÕÖÕÝÝï."
-#: engines/parallaction/saveload.cpp:328
+#: engines/parallaction/saveload.cpp:321
msgid ""
"ScummVM printed some warnings in your console window and can't guarantee all "
"your files have been converted.\n"
@@ -2213,7 +2411,7 @@ msgid ""
"The selected audio device '%s' was not found (e.g. might be turned off or "
"disconnected)."
msgstr ""
-"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ "
+"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ "
"ÒØÜÚÝÕÝÞ ÐÑÞ ÝÕ ßöÔÚÛîçÕÝÞ)."
#: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257
@@ -2227,8 +2425,8 @@ msgid ""
"The selected audio device '%s' cannot be used. See log file for more "
"information."
msgstr ""
-"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ ÛÞÓã "
-"ÔÛï ÔÞÔÐâÚÞÒÞ÷ öÝäÞàÜÐæö÷."
+"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ "
+"ÛÞÓã ÔÛï ÔÞÔÐâÚÞÒÞ÷ öÝäÞàÜÐæö÷."
#: audio/mididrv.cpp:257
#, c-format
@@ -2236,7 +2434,7 @@ msgid ""
"The preferred audio device '%s' was not found (e.g. might be turned off or "
"disconnected)."
msgstr ""
-"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ "
+"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ "
"ÒØÜÚÝÕÝÞ ÐÑÞ ÝÕ ßöÔÚÛîçÕÝÞ)."
#: audio/mididrv.cpp:272
@@ -2245,7 +2443,7 @@ msgid ""
"The preferred audio device '%s' cannot be used. See log file for more "
"information."
msgstr ""
-"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ "
+"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ "
"ÛÞÓã ÔÛï ÔÞÔÐâÚÞÒÞ÷ öÝäÞàÜÐæö÷."
#: audio/null.h:43
@@ -2298,7 +2496,7 @@ msgstr " (°ÚâØÒÝÐ)"
#: backends/keymapper/remap-dialog.cpp:106
msgid " (Blocked)"
-msgstr ""
+msgstr " (·ÐÑÛÞÚÞÒÐÝØÙ)"
#: backends/keymapper/remap-dialog.cpp:119
msgid " (Global)"
@@ -2384,27 +2582,27 @@ msgstr "²ØáÞÚÐ ïÚöáâì ×ÒãÚã (ßÞÒöÛìÝöèÕ) (àÕÑãâ)"
msgid "Disable power off"
msgstr "·ÐÑÞàÞÝØâØ ÒØÜÚÝÕÝÝï"
-#: backends/platform/iphone/osys_events.cpp:301
+#: backends/platform/iphone/osys_events.cpp:300
msgid "Mouse-click-and-drag mode enabled."
msgstr "ÀÕÖØÜ ÜØèö ÚÛöÚÝãâØ-âÐ-âïÓÝãâØ ãÒöÜÚÝÕÝÞ."
-#: backends/platform/iphone/osys_events.cpp:303
+#: backends/platform/iphone/osys_events.cpp:302
msgid "Mouse-click-and-drag mode disabled."
msgstr "ÀÕÖØÜ ÜØèö ÚÛöÚÝãâØ-âÐ-âïÓÝãâØ ÒØÜÚÝÕÝÞ."
-#: backends/platform/iphone/osys_events.cpp:314
+#: backends/platform/iphone/osys_events.cpp:313
msgid "Touchpad mode enabled."
msgstr "ÀÕÖØÜ âÐçßÐÔã ãÒöÜÚÝÕÝÞ."
-#: backends/platform/iphone/osys_events.cpp:316
+#: backends/platform/iphone/osys_events.cpp:315
msgid "Touchpad mode disabled."
msgstr "ÀÕÖØÜ âÐçßÐÔã ÒØÜÚÝÕÝÞ."
-#: backends/platform/maemo/maemo.cpp:205
+#: backends/platform/maemo/maemo.cpp:209
msgid "Click Mode"
msgstr "ÀÕÖØÜ ÚÛöÚöÒ"
-#: backends/platform/maemo/maemo.cpp:211
+#: backends/platform/maemo/maemo.cpp:215
#: backends/platform/symbian/src/SymbianActions.cpp:42
#: backends/platform/wince/CEActionsPocket.cpp:60
#: backends/platform/wince/CEActionsSmartphone.cpp:43
@@ -2412,11 +2610,11 @@ msgstr "ÀÕÖØÜ ÚÛöÚöÒ"
msgid "Left Click"
msgstr "»öÒØÙ ÚÛöÚ"
-#: backends/platform/maemo/maemo.cpp:214
+#: backends/platform/maemo/maemo.cpp:218
msgid "Middle Click"
msgstr "ÁÕàÕÔÝöÙ ÚÛöÚ"
-#: backends/platform/maemo/maemo.cpp:217
+#: backends/platform/maemo/maemo.cpp:221
#: backends/platform/symbian/src/SymbianActions.cpp:43
#: backends/platform/wince/CEActionsSmartphone.cpp:44
#: backends/platform/bada/form.cpp:273
@@ -2453,34 +2651,34 @@ msgctxt "lowres"
msgid "Normal (no scaling)"
msgstr "±Õ× ×ÑöÛìèÕÝÝï"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "ºÞàÕÚæöî áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ ãÒöÜÚÝÕÝÞ"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "ºÞàÕÚæöî áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ ÒØÜÚÝÕÝÞ"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196
msgid "Active graphics filter:"
msgstr "¿ÞâÞçÝØÙ ÓàÐäöçÝØÙ äöÛìâà:"
-#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
+#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238
#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "²öÚÞÝÝØÙ àÕÖØÜ"
-#: backends/graphics/opengl/opengl-graphics.cpp:130
+#: backends/graphics/opengl/opengl-graphics.cpp:135
msgid "OpenGL Normal"
msgstr "OpenGL ÝÞàÜÐÛìÝØÙ"
-#: backends/graphics/opengl/opengl-graphics.cpp:131
+#: backends/graphics/opengl/opengl-graphics.cpp:136
msgid "OpenGL Conserve"
msgstr "OpenGL ·ÑÕàÕÖÕÝØÙ"
-#: backends/graphics/opengl/opengl-graphics.cpp:132
+#: backends/graphics/opengl/opengl-graphics.cpp:137
msgid "OpenGL Original"
msgstr "OpenGL ¾àØÓöÝÐÛìÝØÙ"
@@ -2718,11 +2916,11 @@ msgstr "²öÛìÝØÙ ÞÓÛïÔ"
#: backends/platform/wince/CEActionsPocket.cpp:52
msgid "Zoom up"
-msgstr "·ÑöÛ. ÜÐèâÐÑ"
+msgstr "·ÑöÛ. ÜÐáèâÐÑ"
#: backends/platform/wince/CEActionsPocket.cpp:53
msgid "Zoom down"
-msgstr "·ÜÝè. ÜÐèâÐÑ"
+msgstr "·ÜÝè. ÜÐáèâÐÑ"
#: backends/platform/wince/CEActionsPocket.cpp:55
#: backends/platform/wince/CEActionsSmartphone.cpp:49
@@ -2791,7 +2989,7 @@ msgstr "¿ÕàÕßàØ×ÝÐçØâØ Ôöî 'ÁåÞÒÐâØ ¿ÐÝÕÛì öÝáâà.'"
msgid "You must map a key to the 'Hide toolbar' action to play this game"
msgstr ""
"²Ø ßÞÒØÝÝö ßÕàÕßàØ×ÝÐçØâØ ÚÝÞßÚã ÔÛï Ôö÷ 'ÁåÞÒÐâØ ¿ÐÝÕÛì öÝáâà.', éÞÑ ÓàÐâØ "
-"Ò æî Óàã"
+"ã æî Óàã"
#: backends/platform/wince/wince-sdl.cpp:541
msgid "Map Zoom Up action (optional)"
@@ -2820,37 +3018,37 @@ msgstr "³ÞÛÞÒÝÕ ÜÕÝî"
msgid "Do you really want to quit?"
msgstr "²Ø ÔöÙáÝÞ åÞçÕâÕ ÒØÙâØ?"
-#: backends/events/gph/gph-events.cpp:338
-#: backends/events/gph/gph-events.cpp:381
+#: backends/events/gph/gph-events.cpp:386
+#: backends/events/gph/gph-events.cpp:429
#: backends/events/openpandora/op-events.cpp:139
msgid "Touchscreen 'Tap Mode' - Left Click"
msgstr "ÀÕÖØÜ ÔÞâØÚã ã âÐçáÚàöÝö - »öÒØÙ ÚÛöÚ"
-#: backends/events/gph/gph-events.cpp:340
-#: backends/events/gph/gph-events.cpp:383
+#: backends/events/gph/gph-events.cpp:388
+#: backends/events/gph/gph-events.cpp:431
#: backends/events/openpandora/op-events.cpp:141
msgid "Touchscreen 'Tap Mode' - Right Click"
msgstr "ÀÕÖØÜ ÔÞâØÚã ã âÐçáÚàöÝö - ¿àÐÒØÙ ÚÛöÚ"
-#: backends/events/gph/gph-events.cpp:342
-#: backends/events/gph/gph-events.cpp:385
+#: backends/events/gph/gph-events.cpp:390
+#: backends/events/gph/gph-events.cpp:433
#: backends/events/openpandora/op-events.cpp:143
msgid "Touchscreen 'Tap Mode' - Hover (No Click)"
msgstr "ÀÕÖØÜ ÔÞâØÚã ã âÐçáÚàöÝö - ¿àÞÛöâ (ÑÕ× ÚÛöÚã)"
-#: backends/events/gph/gph-events.cpp:362
+#: backends/events/gph/gph-events.cpp:410
msgid "Maximum Volume"
msgstr "¼ÐÚáØÜÐÛìÝÐ ³ãçÝöáâì"
-#: backends/events/gph/gph-events.cpp:364
+#: backends/events/gph/gph-events.cpp:412
msgid "Increasing Volume"
msgstr "¿öÔÒØéÕÝÝï ÓãçÝÞáâö"
-#: backends/events/gph/gph-events.cpp:370
+#: backends/events/gph/gph-events.cpp:418
msgid "Minimal Volume"
msgstr "¼öÝöÜÐÛìÝÐ ³ãçÝöáâì"
-#: backends/events/gph/gph-events.cpp:372
+#: backends/events/gph/gph-events.cpp:420
msgid "Decreasing Volume"
msgstr "¿ÞÝØÖÕÝÝï ÓãçÝÞáâö"
diff --git a/ports.mk b/ports.mk
index 419b91581a..4d7d6f6e60 100644
--- a/ports.mk
+++ b/ports.mk
@@ -76,6 +76,9 @@ endif
ifneq ($(BACKEND), iphone)
# Static libaries, used for the scummvm-static and iphone targets
OSX_STATIC_LIBS := `$(STATICLIBPATH)/bin/sdl-config --static-libs`
+ifdef USE_FREETYPE2
+OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libfreetype.a $(STATICLIBPATH)/lib/libbz2.a
+endif
endif
ifdef USE_VORBIS
@@ -93,6 +96,12 @@ ifdef USE_FLAC
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libFLAC.a
endif
+ifdef USE_FLUIDSYNTH
+OSX_STATIC_LIBS += \
+ -framework CoreAudio \
+ $(STATICLIBPATH)/lib/libfluidsynth.a
+endif
+
ifdef USE_MAD
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmad.a
endif
@@ -147,7 +156,9 @@ osxsnap: bundle
$(srcdir)/devtools/credits.pl --text > $(srcdir)/AUTHORS
cp $(srcdir)/AUTHORS ./ScummVM-snapshot/Authors
cp $(srcdir)/COPYING ./ScummVM-snapshot/License\ \(GPL\)
+ cp $(srcdir)/COPYING.BSD ./ScummVM-snapshot/License\ \(BSD\)
cp $(srcdir)/COPYING.LGPL ./ScummVM-snapshot/License\ \(LGPL\)
+ cp $(srcdir)/COPYING.FREEFONT ./ScummVM-snapshot/License\ \(FREEFONT\)
cp $(srcdir)/COPYRIGHT ./ScummVM-snapshot/Copyright\ Holders
cp $(srcdir)/NEWS ./ScummVM-snapshot/News
cp $(srcdir)/README ./ScummVM-snapshot/ScummVM\ ReadMe
@@ -155,6 +166,8 @@ osxsnap: bundle
cp $(srcdir)/doc/QuickStart ./ScummVM-snapshot/doc/QuickStart
mkdir ScummVM-snapshot/doc/cz
cp $(srcdir)/doc/cz/PrectiMe ./ScummVM-snapshot/doc/cz/PrectiMe
+ mkdir ScummVM-snapshot/doc/da
+ cp $(srcdir)/doc/da/HurtigStart ./ScummVM-snapshot/doc/da/HurtigStart
mkdir ScummVM-snapshot/doc/de
cp $(srcdir)/doc/de/Liesmich ./ScummVM-snapshot/doc/de/Liesmich
cp $(srcdir)/doc/de/Schnellstart ./ScummVM-snapshot/doc/de/Schnellstart
@@ -171,6 +184,7 @@ osxsnap: bundle
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/da/*
xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/de/*
xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/es/*
xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/fr/*
@@ -201,6 +215,7 @@ win32dist: $(EXECUTABLE)
mkdir -p $(WIN32PATH)/graphics
mkdir -p $(WIN32PATH)/doc
mkdir -p $(WIN32PATH)/doc/cz
+ mkdir -p $(WIN32PATH)/doc/da
mkdir -p $(WIN32PATH)/doc/de
mkdir -p $(WIN32PATH)/doc/es
mkdir -p $(WIN32PATH)/doc/fr
@@ -209,11 +224,9 @@ win32dist: $(EXECUTABLE)
mkdir -p $(WIN32PATH)/doc/se
$(STRIP) $(EXECUTABLE) -o $(WIN32PATH)/$(EXECUTABLE)
cp $(DIST_FILES_THEMES) $(WIN32PATH)
-ifdef DIST_FILES_ENGINEDATA
- cp $(DIST_FILES_ENGINEDATA) $(WIN32PATH)
-endif
cp $(srcdir)/AUTHORS $(WIN32PATH)/AUTHORS.txt
cp $(srcdir)/COPYING $(WIN32PATH)/COPYING.txt
+ cp $(srcdir)/COPYING.BSD $(WIN32PATH)/COPYING.BSD.txt
cp $(srcdir)/COPYING.LGPL $(WIN32PATH)/COPYING.LGPL.txt
cp $(srcdir)/COPYING.FREEFONT $(WIN32PATH)/COPYING.FREEFONT.txt
cp $(srcdir)/COPYRIGHT $(WIN32PATH)/COPYRIGHT.txt
@@ -225,6 +238,7 @@ endif
cp $(srcdir)/doc/fr/DemarrageRapide $(WIN32PATH)/doc/fr/DemarrageRapide.txt
cp $(srcdir)/doc/it/GuidaRapida $(WIN32PATH)/doc/it/GuidaRapida.txt
cp $(srcdir)/doc/no-nb/HurtigStart $(WIN32PATH)/doc/no-nb/HurtigStart.txt
+ cp $(srcdir)/doc/da/HurtigStart $(WIN32PATH)/doc/da/HurtigStart.txt
cp $(srcdir)/doc/de/Schnellstart $(WIN32PATH)/doc/de/Schnellstart.txt
cp $(srcdir)/doc/se/Snabbstart $(WIN32PATH)/doc/se/Snabbstart.txt
cp $(srcdir)/README $(WIN32PATH)/README.txt
@@ -240,6 +254,7 @@ endif
unix2dos $(WIN32PATH)/*.txt
unix2dos $(WIN32PATH)/doc/*.txt
unix2dos $(WIN32PATH)/doc/cz/*.txt
+ unix2dos $(WIN32PATH)/doc/da/*.txt
unix2dos $(WIN32PATH)/doc/de/*.txt
unix2dos $(WIN32PATH)/doc/es/*.txt
unix2dos $(WIN32PATH)/doc/fr/*.txt
@@ -281,6 +296,8 @@ endif
@cd $(srcdir)/dists/msvc9 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 9 >/dev/null && git add -f *.sln *.vcproj *.vsprops
@echo Creating MSVC10 project files...
@cd $(srcdir)/dists/msvc10 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 10 >/dev/null && git add -f *.sln *.vcxproj *.vcxproj.filters *.props
+ @echo Creating MSVC11 project files...
+ @cd $(srcdir)/dists/msvc11 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 11 >/dev/null && git add -f *.sln *.vcxproj *.vcxproj.filters *.props
@echo
@echo All is done.
@echo Now run
diff --git a/test/common/memorywritestream.h b/test/common/memorywritestream.h
new file mode 100644
index 0000000000..43a137a9f3
--- /dev/null
+++ b/test/common/memorywritestream.h
@@ -0,0 +1,31 @@
+#include <cxxtest/TestSuite.h>
+
+#include "common/memstream.h"
+
+class MemoryWriteStreamTestSuite : public CxxTest::TestSuite {
+ public:
+ void test_err() {
+ byte temp = 0;
+
+ Common::MemoryWriteStream stream(&temp, 0);
+ TS_ASSERT(!stream.err());
+
+ // Make sure the error indicator gets set
+ stream.write(&temp, 1);
+ TS_ASSERT(stream.err());
+
+ // Test whether the error indicator can be cleared
+ stream.clearErr();
+ TS_ASSERT(!stream.err());
+ }
+
+ void test_write() {
+ byte buffer[7] = {};
+ Common::MemoryWriteStream stream(buffer, sizeof(buffer));
+
+ const byte data[7] = { 7, 4, 3, 0, 10, 12, 1 };
+ stream.write(data, sizeof(data));
+ TS_ASSERT(memcmp(buffer, data, sizeof(data)) == 0);
+ TS_ASSERT(!stream.err());
+ }
+};
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 9685952304..6062049b72 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -42,106 +42,128 @@
namespace Video {
-/*
+#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a))
+
+// IDs used throughout the AVI files
+// that will be handled by this player
+#define ID_RIFF MKTAG('R','I','F','F')
+#define ID_AVI MKTAG('A','V','I',' ')
+#define ID_LIST MKTAG('L','I','S','T')
+#define ID_HDRL MKTAG('h','d','r','l')
+#define ID_AVIH MKTAG('a','v','i','h')
+#define ID_STRL MKTAG('s','t','r','l')
+#define ID_STRH MKTAG('s','t','r','h')
+#define ID_VIDS MKTAG('v','i','d','s')
+#define ID_AUDS MKTAG('a','u','d','s')
+#define ID_MIDS MKTAG('m','i','d','s')
+#define ID_TXTS MKTAG('t','x','t','s')
+#define ID_JUNK MKTAG('J','U','N','K')
+#define ID_STRF MKTAG('s','t','r','f')
+#define ID_MOVI MKTAG('m','o','v','i')
+#define ID_REC MKTAG('r','e','c',' ')
+#define ID_VEDT MKTAG('v','e','d','t')
+#define ID_IDX1 MKTAG('i','d','x','1')
+#define ID_STRD MKTAG('s','t','r','d')
+#define ID_00AM MKTAG('0','0','A','M')
+//#define ID_INFO MKTAG('I','N','F','O')
+
+// Codec tags
+#define ID_RLE MKTAG('R','L','E',' ')
+#define ID_CRAM MKTAG('C','R','A','M')
+#define ID_MSVC MKTAG('m','s','v','c')
+#define ID_WHAM MKTAG('W','H','A','M')
+#define ID_CVID MKTAG('c','v','i','d')
+#define ID_IV32 MKTAG('i','v','3','2')
+#define ID_DUCK MKTAG('D','U','C','K')
+
static byte char2num(char c) {
- return (c >= 48 && c <= 57) ? c - 48 : 0;
+ c = tolower((byte)c);
+ return (c >= 'a' && c <= 'f') ? c - 'a' + 10 : c - '0';
}
-static byte getStreamNum(uint32 tag) {
- return char2num((char)(tag >> 24)) * 16 + char2num((char)(tag >> 16));
+static byte getStreamIndex(uint32 tag) {
+ return char2num((tag >> 24) & 0xFF) << 4 | char2num((tag >> 16) & 0xFF);
}
-*/
static uint16 getStreamType(uint32 tag) {
return tag & 0xffff;
}
-AviDecoder::AviDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : _mixer(mixer) {
- _soundType = soundType;
-
- _videoCodec = NULL;
+AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
_decodedHeader = false;
- _audStream = NULL;
- _fileStream = NULL;
- _audHandle = new Audio::SoundHandle();
- _dirtyPalette = false;
- memset(_palette, 0, sizeof(_palette));
- memset(&_wvInfo, 0, sizeof(PCMWAVEFORMAT));
- memset(&_bmInfo, 0, sizeof(BITMAPINFOHEADER));
- memset(&_vidsHeader, 0, sizeof(AVIStreamHeader));
- memset(&_audsHeader, 0, sizeof(AVIStreamHeader));
- memset(&_ixInfo, 0, sizeof(AVIOLDINDEX));
+ _fileStream = 0;
+ memset(&_ixInfo, 0, sizeof(_ixInfo));
+ memset(&_header, 0, sizeof(_header));
}
-AviDecoder::~AviDecoder() {
+AVIDecoder::~AVIDecoder() {
close();
- delete _audHandle;
}
-void AviDecoder::runHandle(uint32 tag) {
- assert (_fileStream);
+void AVIDecoder::runHandle(uint32 tag) {
+ assert(_fileStream);
if (_fileStream->eos())
return;
- debug (3, "Decoding tag %s", tag2str(tag));
+ debug(3, "Decoding tag %s", tag2str(tag));
switch (tag) {
- case ID_RIFF:
- /*_filesize = */_fileStream->readUint32LE();
- if (_fileStream->readUint32BE() != ID_AVI)
- error("RIFF file is not an AVI video");
- break;
- case ID_LIST:
- handleList();
- break;
- case ID_AVIH:
- _header.size = _fileStream->readUint32LE();
- _header.microSecondsPerFrame = _fileStream->readUint32LE();
- _header.maxBytesPerSecond = _fileStream->readUint32LE();
- _header.padding = _fileStream->readUint32LE();
- _header.flags = _fileStream->readUint32LE();
- _header.totalFrames = _fileStream->readUint32LE();
- _header.initialFrames = _fileStream->readUint32LE();
- _header.streams = _fileStream->readUint32LE();
- _header.bufferSize = _fileStream->readUint32LE();
- _header.width = _fileStream->readUint32LE();
- _header.height = _fileStream->readUint32LE();
- //Ignore 16 bytes of reserved data
- _fileStream->skip(16);
- break;
- case ID_STRH:
- handleStreamHeader();
- break;
- case ID_STRD: // Extra stream info, safe to ignore
- case ID_VEDT: // Unknown, safe to ignore
- case ID_JUNK: // Alignment bytes, should be ignored
- {
- uint32 junkSize = _fileStream->readUint32LE();
- _fileStream->skip(junkSize + (junkSize & 1)); // Alignment
- } break;
- case ID_IDX1:
- _ixInfo.size = _fileStream->readUint32LE();
- _ixInfo.indices = new AVIOLDINDEX::Index[_ixInfo.size / 16];
- debug (0, "%d Indices", (_ixInfo.size / 16));
- for (uint32 i = 0; i < (_ixInfo.size / 16); i++) {
- _ixInfo.indices[i].id = _fileStream->readUint32BE();
- _ixInfo.indices[i].flags = _fileStream->readUint32LE();
- _ixInfo.indices[i].offset = _fileStream->readUint32LE();
- _ixInfo.indices[i].size = _fileStream->readUint32LE();
- debug (0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(_ixInfo.indices[i].id), _ixInfo.indices[i].offset, _ixInfo.indices[i].size);
- }
- break;
- default:
- error ("Unknown tag \'%s\' found", tag2str(tag));
+ case ID_RIFF:
+ /*_filesize = */_fileStream->readUint32LE();
+ if (_fileStream->readUint32BE() != ID_AVI)
+ error("RIFF file is not an AVI video");
+ break;
+ case ID_LIST:
+ handleList();
+ break;
+ case ID_AVIH:
+ _header.size = _fileStream->readUint32LE();
+ _header.microSecondsPerFrame = _fileStream->readUint32LE();
+ _header.maxBytesPerSecond = _fileStream->readUint32LE();
+ _header.padding = _fileStream->readUint32LE();
+ _header.flags = _fileStream->readUint32LE();
+ _header.totalFrames = _fileStream->readUint32LE();
+ _header.initialFrames = _fileStream->readUint32LE();
+ _header.streams = _fileStream->readUint32LE();
+ _header.bufferSize = _fileStream->readUint32LE();
+ _header.width = _fileStream->readUint32LE();
+ _header.height = _fileStream->readUint32LE();
+ // Ignore 16 bytes of reserved data
+ _fileStream->skip(16);
+ break;
+ case ID_STRH:
+ handleStreamHeader();
+ break;
+ case ID_STRD: // Extra stream info, safe to ignore
+ case ID_VEDT: // Unknown, safe to ignore
+ case ID_JUNK: // Alignment bytes, should be ignored
+ {
+ uint32 junkSize = _fileStream->readUint32LE();
+ _fileStream->skip(junkSize + (junkSize & 1)); // Alignment
+ } break;
+ case ID_IDX1:
+ _ixInfo.size = _fileStream->readUint32LE();
+ _ixInfo.indices = new OldIndex::Index[_ixInfo.size / 16];
+ debug(0, "%d Indices", (_ixInfo.size / 16));
+ for (uint32 i = 0; i < (_ixInfo.size / 16); i++) {
+ _ixInfo.indices[i].id = _fileStream->readUint32BE();
+ _ixInfo.indices[i].flags = _fileStream->readUint32LE();
+ _ixInfo.indices[i].offset = _fileStream->readUint32LE();
+ _ixInfo.indices[i].size = _fileStream->readUint32LE();
+ debug(0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(_ixInfo.indices[i].id), _ixInfo.indices[i].offset, _ixInfo.indices[i].size);
+ }
+ break;
+ default:
+ error("Unknown tag \'%s\' found", tag2str(tag));
}
}
-void AviDecoder::handleList() {
+void AVIDecoder::handleList() {
uint32 listSize = _fileStream->readUint32LE() - 4; // Subtract away listType's 4 bytes
uint32 listType = _fileStream->readUint32BE();
uint32 curPos = _fileStream->pos();
- debug (0, "Found LIST of type %s", tag2str(listType));
+ debug(0, "Found LIST of type %s", tag2str(listType));
while ((_fileStream->pos() - curPos) < listSize)
runHandle(_fileStream->readUint32BE());
@@ -151,12 +173,14 @@ void AviDecoder::handleList() {
_decodedHeader = true;
}
-void AviDecoder::handleStreamHeader() {
+void AVIDecoder::handleStreamHeader() {
AVIStreamHeader sHeader;
sHeader.size = _fileStream->readUint32LE();
sHeader.streamType = _fileStream->readUint32BE();
+
if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS)
- error ("Unhandled MIDI/Text stream");
+ error("Unhandled MIDI/Text stream");
+
sHeader.streamHandler = _fileStream->readUint32BE();
sHeader.flags = _fileStream->readUint32LE();
sHeader.priority = _fileStream->readUint16LE();
@@ -174,63 +198,67 @@ void AviDecoder::handleStreamHeader() {
if (_fileStream->readUint32BE() != ID_STRF)
error("Could not find STRF tag");
+
uint32 strfSize = _fileStream->readUint32LE();
uint32 startPos = _fileStream->pos();
if (sHeader.streamType == ID_VIDS) {
- _vidsHeader = sHeader;
-
- _bmInfo.size = _fileStream->readUint32LE();
- _bmInfo.width = _fileStream->readUint32LE();
- assert (_header.width == _bmInfo.width);
- _bmInfo.height = _fileStream->readUint32LE();
- assert (_header.height == _bmInfo.height);
- _bmInfo.planes = _fileStream->readUint16LE();
- _bmInfo.bitCount = _fileStream->readUint16LE();
- _bmInfo.compression = _fileStream->readUint32BE();
- _bmInfo.sizeImage = _fileStream->readUint32LE();
- _bmInfo.xPelsPerMeter = _fileStream->readUint32LE();
- _bmInfo.yPelsPerMeter = _fileStream->readUint32LE();
- _bmInfo.clrUsed = _fileStream->readUint32LE();
- _bmInfo.clrImportant = _fileStream->readUint32LE();
-
- if (_bmInfo.bitCount == 8) {
- if (_bmInfo.clrUsed == 0)
- _bmInfo.clrUsed = 256;
-
- for (uint32 i = 0; i < _bmInfo.clrUsed; i++) {
- _palette[i * 3 + 2] = _fileStream->readByte();
- _palette[i * 3 + 1] = _fileStream->readByte();
- _palette[i * 3] = _fileStream->readByte();
+ BitmapInfoHeader bmInfo;
+ bmInfo.size = _fileStream->readUint32LE();
+ bmInfo.width = _fileStream->readUint32LE();
+ bmInfo.height = _fileStream->readUint32LE();
+ bmInfo.planes = _fileStream->readUint16LE();
+ bmInfo.bitCount = _fileStream->readUint16LE();
+ bmInfo.compression = _fileStream->readUint32BE();
+ bmInfo.sizeImage = _fileStream->readUint32LE();
+ bmInfo.xPelsPerMeter = _fileStream->readUint32LE();
+ bmInfo.yPelsPerMeter = _fileStream->readUint32LE();
+ bmInfo.clrUsed = _fileStream->readUint32LE();
+ bmInfo.clrImportant = _fileStream->readUint32LE();
+
+ if (bmInfo.clrUsed == 0)
+ bmInfo.clrUsed = 256;
+
+ if (sHeader.streamHandler == 0)
+ sHeader.streamHandler = bmInfo.compression;
+
+ AVIVideoTrack *track = new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo);
+
+ if (bmInfo.bitCount == 8) {
+ byte *palette = const_cast<byte *>(track->getPalette());
+ for (uint32 i = 0; i < bmInfo.clrUsed; i++) {
+ palette[i * 3 + 2] = _fileStream->readByte();
+ palette[i * 3 + 1] = _fileStream->readByte();
+ palette[i * 3] = _fileStream->readByte();
_fileStream->readByte();
}
- _dirtyPalette = true;
+ track->markPaletteDirty();
}
- if (!_vidsHeader.streamHandler)
- _vidsHeader.streamHandler = _bmInfo.compression;
+ addTrack(track);
} else if (sHeader.streamType == ID_AUDS) {
- _audsHeader = sHeader;
-
- _wvInfo.tag = _fileStream->readUint16LE();
- _wvInfo.channels = _fileStream->readUint16LE();
- _wvInfo.samplesPerSec = _fileStream->readUint32LE();
- _wvInfo.avgBytesPerSec = _fileStream->readUint32LE();
- _wvInfo.blockAlign = _fileStream->readUint16LE();
- _wvInfo.size = _fileStream->readUint16LE();
+ PCMWaveFormat wvInfo;
+ wvInfo.tag = _fileStream->readUint16LE();
+ wvInfo.channels = _fileStream->readUint16LE();
+ wvInfo.samplesPerSec = _fileStream->readUint32LE();
+ wvInfo.avgBytesPerSec = _fileStream->readUint32LE();
+ wvInfo.blockAlign = _fileStream->readUint16LE();
+ wvInfo.size = _fileStream->readUint16LE();
// AVI seems to treat the sampleSize as including the second
// channel as well, so divide for our sake.
- if (_wvInfo.channels == 2)
- _audsHeader.sampleSize /= 2;
+ if (wvInfo.channels == 2)
+ sHeader.sampleSize /= 2;
+
+ addTrack(new AVIAudioTrack(sHeader, wvInfo, _soundType));
}
// Ensure that we're at the end of the chunk
_fileStream->seek(startPos + strfSize);
}
-bool AviDecoder::loadStream(Common::SeekableReadStream *stream) {
+bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
close();
_fileStream = stream;
@@ -252,74 +280,31 @@ bool AviDecoder::loadStream(Common::SeekableReadStream *stream) {
if (nextTag == ID_LIST) {
_fileStream->readUint32BE(); // Skip size
if (_fileStream->readUint32BE() != ID_MOVI)
- error ("Expected 'movi' LIST");
- } else
- error ("Expected 'movi' LIST");
-
- // Now, create the codec
- _videoCodec = createCodec();
-
- // Initialize the video stuff too
- _audStream = createAudioStream();
- if (_audStream)
- _mixer->playStream(_soundType, _audHandle, _audStream);
-
- debug (0, "Frames = %d, Dimensions = %d x %d", _header.totalFrames, _header.width, _header.height);
- debug (0, "Frame Rate = %d", _vidsHeader.rate / _vidsHeader.scale);
- if (_wvInfo.samplesPerSec != 0)
- debug (0, "Sound Rate = %d", _wvInfo.samplesPerSec);
- debug (0, "Video Codec = \'%s\'", tag2str(_vidsHeader.streamHandler));
-
- if (!_videoCodec)
- return false;
+ error("Expected 'movi' LIST");
+ } else {
+ error("Expected 'movi' LIST");
+ }
return true;
}
-void AviDecoder::close() {
- if (!_fileStream)
- return;
+void AVIDecoder::close() {
+ VideoDecoder::close();
delete _fileStream;
_fileStream = 0;
-
- // Deinitialize sound
- _mixer->stopHandle(*_audHandle);
- _audStream = 0;
-
_decodedHeader = false;
- delete _videoCodec;
- _videoCodec = 0;
-
delete[] _ixInfo.indices;
- _ixInfo.indices = 0;
-
- memset(_palette, 0, sizeof(_palette));
- memset(&_wvInfo, 0, sizeof(PCMWAVEFORMAT));
- memset(&_bmInfo, 0, sizeof(BITMAPINFOHEADER));
- memset(&_vidsHeader, 0, sizeof(AVIStreamHeader));
- memset(&_audsHeader, 0, sizeof(AVIStreamHeader));
- memset(&_ixInfo, 0, sizeof(AVIOLDINDEX));
-
- reset();
+ memset(&_ixInfo, 0, sizeof(_ixInfo));
+ memset(&_header, 0, sizeof(_header));
}
-uint32 AviDecoder::getElapsedTime() const {
- if (_audStream)
- return _mixer->getSoundElapsedTime(*_audHandle);
-
- return FixedRateVideoDecoder::getElapsedTime();
-}
-
-const Graphics::Surface *AviDecoder::decodeNextFrame() {
+void AVIDecoder::readNextPacket() {
uint32 nextTag = _fileStream->readUint32BE();
if (_fileStream->eos())
- return NULL;
-
- if (_curFrame == -1)
- _startTime = g_system->getMillis();
+ return;
if (nextTag == ID_LIST) {
// A list of audio/video chunks
@@ -327,128 +312,170 @@ const Graphics::Surface *AviDecoder::decodeNextFrame() {
int32 startPos = _fileStream->pos();
if (_fileStream->readUint32BE() != ID_REC)
- error ("Expected 'rec ' LIST");
-
- // Decode chunks in the list and see if we get a frame
- const Graphics::Surface *frame = NULL;
- while (_fileStream->pos() < startPos + (int32)listSize) {
- const Graphics::Surface *temp = decodeNextFrame();
- if (temp)
- frame = temp;
- }
+ error("Expected 'rec ' LIST");
+
+ // Decode chunks in the list
+ while (_fileStream->pos() < startPos + (int32)listSize)
+ readNextPacket();
+
+ return;
+ } else if (nextTag == ID_JUNK || nextTag == ID_IDX1) {
+ runHandle(nextTag);
+ return;
+ }
- return frame;
- } else if (getStreamType(nextTag) == 'wb') {
- // Audio Chunk
- uint32 chunkSize = _fileStream->readUint32LE();
- queueAudioBuffer(chunkSize);
- _fileStream->skip(chunkSize & 1); // Alignment
- } else if (getStreamType(nextTag) == 'dc' || getStreamType(nextTag) == 'id' ||
- getStreamType(nextTag) == 'AM' || getStreamType(nextTag) == '32' ||
- getStreamType(nextTag) == 'iv') {
- // Compressed Frame
- _curFrame++;
- uint32 chunkSize = _fileStream->readUint32LE();
-
- if (chunkSize == 0) // Keep last frame on screen
- return NULL;
-
- Common::SeekableReadStream *frameData = _fileStream->readStream(chunkSize);
- const Graphics::Surface *surface = _videoCodec->decodeImage(frameData);
- delete frameData;
- _fileStream->skip(chunkSize & 1); // Alignment
- return surface;
- } else if (getStreamType(nextTag) == 'pc') {
- // Palette Change
- _fileStream->readUint32LE(); // Chunk size, not needed here
- byte firstEntry = _fileStream->readByte();
- uint16 numEntries = _fileStream->readByte();
- _fileStream->readUint16LE(); // Reserved
-
- // 0 entries means all colors are going to be changed
- if (numEntries == 0)
- numEntries = 256;
-
- for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) {
- _palette[i * 3] = _fileStream->readByte();
- _palette[i * 3 + 1] = _fileStream->readByte();
- _palette[i * 3 + 2] = _fileStream->readByte();
- _fileStream->readByte(); // Flags that don't serve us any purpose
+ Track *track = getTrack(getStreamIndex(nextTag));
+
+ if (!track)
+ error("Cannot get track from tag '%s'", tag2str(nextTag));
+
+ uint32 chunkSize = _fileStream->readUint32LE();
+ Common::SeekableReadStream *chunk = 0;
+
+ if (chunkSize != 0) {
+ chunk = _fileStream->readStream(chunkSize);
+ _fileStream->skip(chunkSize & 1);
+ }
+
+ if (track->getTrackType() == Track::kTrackTypeAudio) {
+ if (getStreamType(nextTag) != MKTAG16('w', 'b'))
+ error("Invalid audio track tag '%s'", tag2str(nextTag));
+
+ assert(chunk);
+ ((AVIAudioTrack *)track)->queueSound(chunk);
+ } else {
+ AVIVideoTrack *videoTrack = (AVIVideoTrack *)track;
+
+ if (getStreamType(nextTag) == MKTAG16('p', 'c')) {
+ // Palette Change
+ assert(chunk);
+ byte firstEntry = chunk->readByte();
+ uint16 numEntries = chunk->readByte();
+ chunk->readUint16LE(); // Reserved
+
+ // 0 entries means all colors are going to be changed
+ if (numEntries == 0)
+ numEntries = 256;
+
+ byte *palette = const_cast<byte *>(videoTrack->getPalette());
+
+ for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) {
+ palette[i * 3] = chunk->readByte();
+ palette[i * 3 + 1] = chunk->readByte();
+ palette[i * 3 + 2] = chunk->readByte();
+ chunk->readByte(); // Flags that don't serve us any purpose
+ }
+
+ delete chunk;
+ videoTrack->markPaletteDirty();
+ } else if (getStreamType(nextTag) == MKTAG16('d', 'b')) {
+ // TODO: Check if this really is uncompressed. Many videos
+ // falsely put compressed data in here.
+ error("Uncompressed AVI frame found");
+ } else {
+ // Otherwise, assume it's a compressed frame
+ videoTrack->decodeFrame(chunk);
}
+ }
+}
- _dirtyPalette = true;
+AVIDecoder::AVIVideoTrack::AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader)
+ : _frameCount(frameCount), _vidsHeader(streamHeader), _bmInfo(bitmapInfoHeader) {
+ memset(_palette, 0, sizeof(_palette));
+ _videoCodec = createCodec();
+ _dirtyPalette = false;
+ _lastFrame = 0;
+ _curFrame = -1;
+}
- // No alignment necessary. It's always even.
- } else if (nextTag == ID_JUNK) {
- runHandle(ID_JUNK);
- } else if (nextTag == ID_IDX1) {
- runHandle(ID_IDX1);
- } else
- error("Tag = \'%s\', %d", tag2str(nextTag), _fileStream->pos());
+AVIDecoder::AVIVideoTrack::~AVIVideoTrack() {
+ delete _videoCodec;
+}
+
+void AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream *stream) {
+ if (stream) {
+ if (_videoCodec)
+ _lastFrame = _videoCodec->decodeImage(stream);
+ } else {
+ // Empty frame
+ _lastFrame = 0;
+ }
- return NULL;
+ delete stream;
+ _curFrame++;
}
-Codec *AviDecoder::createCodec() {
+Graphics::PixelFormat AVIDecoder::AVIVideoTrack::getPixelFormat() const {
+ if (_videoCodec)
+ return _videoCodec->getPixelFormat();
+
+ return Graphics::PixelFormat();
+}
+
+Codec *AVIDecoder::AVIVideoTrack::createCodec() {
switch (_vidsHeader.streamHandler) {
- case ID_CRAM:
- case ID_MSVC:
- case ID_WHAM:
- return new MSVideo1Decoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount);
- case ID_RLE:
- return new MSRLEDecoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount);
- case ID_CVID:
- return new CinepakDecoder(_bmInfo.bitCount);
- case ID_IV32:
- return new Indeo3Decoder(_bmInfo.width, _bmInfo.height);
+ case ID_CRAM:
+ case ID_MSVC:
+ case ID_WHAM:
+ return new MSVideo1Decoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount);
+ case ID_RLE:
+ return new MSRLEDecoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount);
+ case ID_CVID:
+ return new CinepakDecoder(_bmInfo.bitCount);
+ case ID_IV32:
+ return new Indeo3Decoder(_bmInfo.width, _bmInfo.height);
#ifdef VIDEO_CODECS_TRUEMOTION1_H
- case ID_DUCK:
- return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height);
+ case ID_DUCK:
+ return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height);
#endif
- default:
- warning ("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler));
+ default:
+ warning("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler));
}
- return NULL;
+ return 0;
}
-Graphics::PixelFormat AviDecoder::getPixelFormat() const {
- assert(_videoCodec);
- return _videoCodec->getPixelFormat();
+AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType)
+ : _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType) {
+ _audStream = createAudioStream();
}
-Audio::QueuingAudioStream *AviDecoder::createAudioStream() {
- if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatDK3)
- return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2);
- else if (_wvInfo.tag != kWaveFormatNone) // No sound
- warning("Unsupported AVI audio format %d", _wvInfo.tag);
-
- return NULL;
+AVIDecoder::AVIAudioTrack::~AVIAudioTrack() {
+ delete _audStream;
}
-void AviDecoder::queueAudioBuffer(uint32 chunkSize) {
- // Return if we haven't created the queue (unsupported audio format)
- if (!_audStream) {
- _fileStream->skip(chunkSize);
- return;
+void AVIDecoder::AVIAudioTrack::queueSound(Common::SeekableReadStream *stream) {
+ if (_audStream) {
+ if (_wvInfo.tag == kWaveFormatPCM) {
+ byte flags = 0;
+ if (_audsHeader.sampleSize == 2)
+ flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
+ else
+ flags |= Audio::FLAG_UNSIGNED;
+
+ if (_wvInfo.channels == 2)
+ flags |= Audio::FLAG_STEREO;
+
+ _audStream->queueAudioStream(Audio::makeRawStream(stream, _wvInfo.samplesPerSec, flags, DisposeAfterUse::YES), DisposeAfterUse::YES);
+ } else if (_wvInfo.tag == kWaveFormatDK3) {
+ _audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, stream->size(), Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES);
+ }
+ } else {
+ delete stream;
}
+}
- Common::SeekableReadStream *stream = _fileStream->readStream(chunkSize);
-
- if (_wvInfo.tag == kWaveFormatPCM) {
- byte flags = 0;
- if (_audsHeader.sampleSize == 2)
- flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
- else
- flags |= Audio::FLAG_UNSIGNED;
+Audio::AudioStream *AVIDecoder::AVIAudioTrack::getAudioStream() const {
+ return _audStream;
+}
- if (_wvInfo.channels == 2)
- flags |= Audio::FLAG_STEREO;
+Audio::QueuingAudioStream *AVIDecoder::AVIAudioTrack::createAudioStream() {
+ if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatDK3)
+ return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2);
+ else if (_wvInfo.tag != kWaveFormatNone) // No sound
+ warning("Unsupported AVI audio format %d", _wvInfo.tag);
- _audStream->queueAudioStream(Audio::makeRawStream(stream, _wvInfo.samplesPerSec, flags, DisposeAfterUse::YES), DisposeAfterUse::YES);
- } else if (_wvInfo.tag == kWaveFormatDK3) {
- _audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, chunkSize, Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES);
- }
+ return 0;
}
} // End of namespace Video
diff --git a/video/avi_decoder.h b/video/avi_decoder.h
index 508760ec89..3bdc0561d1 100644
--- a/video/avi_decoder.h
+++ b/video/avi_decoder.h
@@ -47,191 +47,183 @@ namespace Video {
class Codec;
-#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a))
-
-// IDs used throughout the AVI files
-// that will be handled by this player
-#define ID_RIFF MKTAG('R','I','F','F')
-#define ID_AVI MKTAG('A','V','I',' ')
-#define ID_LIST MKTAG('L','I','S','T')
-#define ID_HDRL MKTAG('h','d','r','l')
-#define ID_AVIH MKTAG('a','v','i','h')
-#define ID_STRL MKTAG('s','t','r','l')
-#define ID_STRH MKTAG('s','t','r','h')
-#define ID_VIDS MKTAG('v','i','d','s')
-#define ID_AUDS MKTAG('a','u','d','s')
-#define ID_MIDS MKTAG('m','i','d','s')
-#define ID_TXTS MKTAG('t','x','t','s')
-#define ID_JUNK MKTAG('J','U','N','K')
-#define ID_STRF MKTAG('s','t','r','f')
-#define ID_MOVI MKTAG('m','o','v','i')
-#define ID_REC MKTAG('r','e','c',' ')
-#define ID_VEDT MKTAG('v','e','d','t')
-#define ID_IDX1 MKTAG('i','d','x','1')
-#define ID_STRD MKTAG('s','t','r','d')
-#define ID_00AM MKTAG('0','0','A','M')
-//#define ID_INFO MKTAG('I','N','F','O')
-
-// Codec tags
-#define ID_RLE MKTAG('R','L','E',' ')
-#define ID_CRAM MKTAG('C','R','A','M')
-#define ID_MSVC MKTAG('m','s','v','c')
-#define ID_WHAM MKTAG('W','H','A','M')
-#define ID_CVID MKTAG('c','v','i','d')
-#define ID_IV32 MKTAG('i','v','3','2')
-#define ID_DUCK MKTAG('D','U','C','K')
-
-struct BITMAPINFOHEADER {
- uint32 size;
- uint32 width;
- uint32 height;
- uint16 planes;
- uint16 bitCount;
- uint32 compression;
- uint32 sizeImage;
- uint32 xPelsPerMeter;
- uint32 yPelsPerMeter;
- uint32 clrUsed;
- uint32 clrImportant;
-};
-
-struct WAVEFORMAT {
- uint16 tag;
- uint16 channels;
- uint32 samplesPerSec;
- uint32 avgBytesPerSec;
- uint16 blockAlign;
-};
-
-struct PCMWAVEFORMAT : public WAVEFORMAT {
- uint16 size;
-};
-
-struct WAVEFORMATEX : public WAVEFORMAT {
- uint16 bitsPerSample;
- uint16 size;
-};
-
-struct AVIOLDINDEX {
- uint32 size;
- struct Index {
- uint32 id;
- uint32 flags;
- uint32 offset;
- uint32 size;
- } *indices;
-};
-
-// Index Flags
-enum IndexFlags {
- AVIIF_INDEX = 0x10
-};
-
-// Audio Codecs
-enum {
- kWaveFormatNone = 0,
- kWaveFormatPCM = 1,
- kWaveFormatDK3 = 98
-};
-
-struct AVIHeader {
- uint32 size;
- uint32 microSecondsPerFrame;
- uint32 maxBytesPerSecond;
- uint32 padding;
- uint32 flags;
- uint32 totalFrames;
- uint32 initialFrames;
- uint32 streams;
- uint32 bufferSize;
- uint32 width;
- uint32 height;
-};
-
-// Flags from the AVIHeader
-enum AviFlags {
- AVIF_HASINDEX = 0x00000010,
- AVIF_MUSTUSEINDEX = 0x00000020,
- AVIF_ISINTERLEAVED = 0x00000100,
- AVIF_TRUSTCKTYPE = 0x00000800,
- AVIF_WASCAPTUREFILE = 0x00010000,
- AVIF_WASCOPYRIGHTED = 0x00020000
-};
-
-struct AVIStreamHeader {
- uint32 size;
- uint32 streamType;
- uint32 streamHandler;
- uint32 flags;
- uint16 priority;
- uint16 language;
- uint32 initialFrames;
- uint32 scale;
- uint32 rate;
- uint32 start;
- uint32 length;
- uint32 bufferSize;
- uint32 quality;
- uint32 sampleSize;
- Common::Rect frame;
-};
-
/**
* Decoder for AVI videos.
*
* Video decoder used in engines:
* - sci
*/
-class AviDecoder : public FixedRateVideoDecoder {
+class AVIDecoder : public VideoDecoder {
public:
- AviDecoder(Audio::Mixer *mixer,
- Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
- virtual ~AviDecoder();
+ AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+ virtual ~AVIDecoder();
bool loadStream(Common::SeekableReadStream *stream);
void close();
-
- bool isVideoLoaded() const { return _fileStream != 0; }
uint16 getWidth() const { return _header.width; }
uint16 getHeight() const { return _header.height; }
- uint32 getFrameCount() const { return _header.totalFrames; }
- uint32 getElapsedTime() const;
- const Graphics::Surface *decodeNextFrame();
- Graphics::PixelFormat getPixelFormat() const;
- const byte *getPalette() { _dirtyPalette = false; return _palette; }
- bool hasDirtyPalette() const { return _dirtyPalette; }
protected:
- Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); }
+ void readNextPacket();
private:
- Audio::Mixer *_mixer;
- BITMAPINFOHEADER _bmInfo;
- PCMWAVEFORMAT _wvInfo;
- AVIOLDINDEX _ixInfo;
+ struct BitmapInfoHeader {
+ uint32 size;
+ uint32 width;
+ uint32 height;
+ uint16 planes;
+ uint16 bitCount;
+ uint32 compression;
+ uint32 sizeImage;
+ uint32 xPelsPerMeter;
+ uint32 yPelsPerMeter;
+ uint32 clrUsed;
+ uint32 clrImportant;
+ };
+
+ struct WaveFormat {
+ uint16 tag;
+ uint16 channels;
+ uint32 samplesPerSec;
+ uint32 avgBytesPerSec;
+ uint16 blockAlign;
+ };
+
+ struct PCMWaveFormat : public WaveFormat {
+ uint16 size;
+ };
+
+ struct WaveFormatEX : public WaveFormat {
+ uint16 bitsPerSample;
+ uint16 size;
+ };
+
+ struct OldIndex {
+ uint32 size;
+ struct Index {
+ uint32 id;
+ uint32 flags;
+ uint32 offset;
+ uint32 size;
+ } *indices;
+ };
+
+ // Index Flags
+ enum IndexFlags {
+ AVIIF_INDEX = 0x10
+ };
+
+ struct AVIHeader {
+ uint32 size;
+ uint32 microSecondsPerFrame;
+ uint32 maxBytesPerSecond;
+ uint32 padding;
+ uint32 flags;
+ uint32 totalFrames;
+ uint32 initialFrames;
+ uint32 streams;
+ uint32 bufferSize;
+ uint32 width;
+ uint32 height;
+ };
+
+ // Flags from the AVIHeader
+ enum AVIFlags {
+ AVIF_HASINDEX = 0x00000010,
+ AVIF_MUSTUSEINDEX = 0x00000020,
+ AVIF_ISINTERLEAVED = 0x00000100,
+ AVIF_TRUSTCKTYPE = 0x00000800,
+ AVIF_WASCAPTUREFILE = 0x00010000,
+ AVIF_WASCOPYRIGHTED = 0x00020000
+ };
+
+ struct AVIStreamHeader {
+ uint32 size;
+ uint32 streamType;
+ uint32 streamHandler;
+ uint32 flags;
+ uint16 priority;
+ uint16 language;
+ uint32 initialFrames;
+ uint32 scale;
+ uint32 rate;
+ uint32 start;
+ uint32 length;
+ uint32 bufferSize;
+ uint32 quality;
+ uint32 sampleSize;
+ Common::Rect frame;
+ };
+
+ class AVIVideoTrack : public FixedRateVideoTrack {
+ public:
+ AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader);
+ ~AVIVideoTrack();
+
+ void decodeFrame(Common::SeekableReadStream *stream);
+
+ uint16 getWidth() const { return _bmInfo.width; }
+ uint16 getHeight() const { return _bmInfo.height; }
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ const Graphics::Surface *decodeNextFrame() { return _lastFrame; }
+ const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ bool hasDirtyPalette() const { return _dirtyPalette; }
+ void markPaletteDirty() { _dirtyPalette = true; }
+
+ protected:
+ Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); }
+
+ private:
+ AVIStreamHeader _vidsHeader;
+ BitmapInfoHeader _bmInfo;
+ byte _palette[3 * 256];
+ mutable bool _dirtyPalette;
+ int _frameCount, _curFrame;
+
+ Codec *_videoCodec;
+ const Graphics::Surface *_lastFrame;
+ Codec *createCodec();
+ };
+
+ class AVIAudioTrack : public AudioTrack {
+ public:
+ AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType);
+ ~AVIAudioTrack();
+
+ void queueSound(Common::SeekableReadStream *stream);
+ Audio::Mixer::SoundType getSoundType() const { return _soundType; }
+
+ protected:
+ Audio::AudioStream *getAudioStream() const;
+
+ private:
+ // Audio Codecs
+ enum {
+ kWaveFormatNone = 0,
+ kWaveFormatPCM = 1,
+ kWaveFormatDK3 = 98
+ };
+
+ AVIStreamHeader _audsHeader;
+ PCMWaveFormat _wvInfo;
+ Audio::Mixer::SoundType _soundType;
+ Audio::QueuingAudioStream *_audStream;
+ Audio::QueuingAudioStream *createAudioStream();
+ };
+
+ OldIndex _ixInfo;
AVIHeader _header;
- AVIStreamHeader _vidsHeader;
- AVIStreamHeader _audsHeader;
- byte _palette[3 * 256];
- bool _dirtyPalette;
Common::SeekableReadStream *_fileStream;
bool _decodedHeader;
- Codec *_videoCodec;
- Codec *createCodec();
-
Audio::Mixer::SoundType _soundType;
void runHandle(uint32 tag);
void handleList();
void handleStreamHeader();
- void handlePalChange();
-
- Audio::SoundHandle *_audHandle;
- Audio::QueuingAudioStream *_audStream;
- Audio::QueuingAudioStream *createAudioStream();
- void queueAudioBuffer(uint32 chunkSize);
};
} // End of namespace Video
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index 884ca69f17..1ece22c963 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -24,6 +24,7 @@
// based quite heavily on the Bink decoder found in FFmpeg.
// Many thanks to Kostya Shishkov for doing the hard work.
+#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include "common/util.h"
@@ -60,139 +61,108 @@ static const uint32 kDCStartBits = 11;
namespace Video {
-BinkDecoder::VideoFrame::VideoFrame() : bits(0) {
-}
-
-BinkDecoder::VideoFrame::~VideoFrame() {
- delete bits;
+BinkDecoder::BinkDecoder() {
+ _bink = 0;
}
-
-BinkDecoder::AudioTrack::AudioTrack() : bits(0), bands(0), rdft(0), dct(0) {
+BinkDecoder::~BinkDecoder() {
+ close();
}
-BinkDecoder::AudioTrack::~AudioTrack() {
- delete bits;
-
- delete[] bands;
-
- delete rdft;
- delete dct;
-}
+bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) {
+ close();
+ uint32 id = stream->readUint32BE();
+ if ((id != kBIKfID) && (id != kBIKgID) && (id != kBIKhID) && (id != kBIKiID))
+ return false;
-BinkDecoder::BinkDecoder() {
- _bink = 0;
- _audioTrack = 0;
+ uint32 fileSize = stream->readUint32LE() + 8;
+ uint32 frameCount = stream->readUint32LE();
+ uint32 largestFrameSize = stream->readUint32LE();
- for (int i = 0; i < 16; i++)
- _huffman[i] = 0;
+ if (largestFrameSize > fileSize) {
+ warning("Largest frame size greater than file size");
+ return false;
+ }
- for (int i = 0; i < kSourceMAX; i++) {
- _bundles[i].countLength = 0;
+ stream->skip(4);
- _bundles[i].huffman.index = 0;
- for (int j = 0; j < 16; j++)
- _bundles[i].huffman.symbols[j] = j;
+ uint32 width = stream->readUint32LE();
+ uint32 height = stream->readUint32LE();
- _bundles[i].data = 0;
- _bundles[i].dataEnd = 0;
- _bundles[i].curDec = 0;
- _bundles[i].curPtr = 0;
+ uint32 frameRateNum = stream->readUint32LE();
+ uint32 frameRateDen = stream->readUint32LE();
+ if (frameRateNum == 0 || frameRateDen == 0) {
+ warning("Invalid frame rate (%d/%d)", frameRateNum, frameRateDen);
+ return false;
}
- for (int i = 0; i < 16; i++) {
- _colHighHuffman[i].index = 0;
- for (int j = 0; j < 16; j++)
- _colHighHuffman[i].symbols[j] = j;
- }
+ _bink = stream;
- for (int i = 0; i < 4; i++) {
- _curPlanes[i] = 0;
- _oldPlanes[i] = 0;
- }
+ uint32 videoFlags = _bink->readUint32LE();
- _audioStream = 0;
-}
+ // BIKh and BIKi swap the chroma planes
+ addTrack(new BinkVideoTrack(width, height, getDefaultHighColorFormat(), frameCount,
+ Common::Rational(frameRateNum, frameRateDen), (id == kBIKhID || id == kBIKiID), videoFlags & kVideoFlagAlpha, id));
-void BinkDecoder::startAudio() {
- if (_audioTrack < _audioTracks.size()) {
- const AudioTrack &audio = _audioTracks[_audioTrack];
+ uint32 audioTrackCount = _bink->readUint32LE();
- _audioStream = Audio::makeQueuingAudioStream(audio.outSampleRate, audio.outChannels == 2);
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandle, _audioStream);
- } // else no audio
-}
+ if (audioTrackCount > 0) {
+ _audioTracks.reserve(audioTrackCount);
-void BinkDecoder::stopAudio() {
- if (_audioStream) {
- g_system->getMixer()->stopHandle(_audioHandle);
- _audioStream = 0;
- }
-}
+ _bink->skip(4 * audioTrackCount);
-BinkDecoder::~BinkDecoder() {
- close();
-}
+ // Reading audio track properties
+ for (uint32 i = 0; i < audioTrackCount; i++) {
+ AudioInfo track;
-void BinkDecoder::close() {
- reset();
+ track.sampleRate = _bink->readUint16LE();
+ track.flags = _bink->readUint16LE();
- // Stop audio
- stopAudio();
+ _audioTracks.push_back(track);
- for (int i = 0; i < 4; i++) {
- delete[] _curPlanes[i]; _curPlanes[i] = 0;
- delete[] _oldPlanes[i]; _oldPlanes[i] = 0;
+ initAudioTrack(_audioTracks[i]);
+ }
+
+ _bink->skip(4 * audioTrackCount);
}
- deinitBundles();
+ // Reading video frame properties
+ _frames.resize(frameCount);
+ for (uint32 i = 0; i < frameCount; i++) {
+ _frames[i].offset = _bink->readUint32LE();
+ _frames[i].keyFrame = _frames[i].offset & 1;
- for (int i = 0; i < 16; i++) {
- delete _huffman[i];
- _huffman[i] = 0;
- }
+ _frames[i].offset &= ~1;
- delete _bink; _bink = 0;
- _surface.free();
+ if (i != 0)
+ _frames[i - 1].size = _frames[i].offset - _frames[i - 1].offset;
- _audioTrack = 0;
+ _frames[i].bits = 0;
+ }
- for (int i = 0; i < kSourceMAX; i++) {
- _bundles[i].countLength = 0;
+ _frames[frameCount - 1].size = _bink->size() - _frames[frameCount - 1].offset;
- _bundles[i].huffman.index = 0;
- for (int j = 0; j < 16; j++)
- _bundles[i].huffman.symbols[j] = j;
+ return true;
+}
- _bundles[i].data = 0;
- _bundles[i].dataEnd = 0;
- _bundles[i].curDec = 0;
- _bundles[i].curPtr = 0;
- }
+void BinkDecoder::close() {
+ VideoDecoder::close();
- for (int i = 0; i < 16; i++) {
- _colHighHuffman[i].index = 0;
- for (int j = 0; j < 16; j++)
- _colHighHuffman[i].symbols[j] = j;
- }
+ delete _bink;
+ _bink = 0;
_audioTracks.clear();
_frames.clear();
}
-uint32 BinkDecoder::getElapsedTime() const {
- if (_audioStream && g_system->getMixer()->isSoundHandleActive(_audioHandle))
- return g_system->getMixer()->getSoundElapsedTime(_audioHandle) + _audioStartOffset;
-
- return g_system->getMillis() - _startTime;
-}
+void BinkDecoder::readNextPacket() {
+ BinkVideoTrack *videoTrack = (BinkVideoTrack *)getTrack(0);
-const Graphics::Surface *BinkDecoder::decodeNextFrame() {
- if (endOfVideo())
- return 0;
+ if (videoTrack->endOfTrack())
+ return;
- VideoFrame &frame = _frames[_curFrame + 1];
+ VideoFrame &frame = _frames[videoTrack->getCurFrame() + 1];
if (!_bink->seek(frame.offset))
error("Bad bink seek");
@@ -200,7 +170,7 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() {
uint32 frameSize = frame.size;
for (uint32 i = 0; i < _audioTracks.size(); i++) {
- AudioTrack &audio = _audioTracks[i];
+ AudioInfo &audio = _audioTracks[i];
uint32 audioPacketLength = _bink->readUint32LE();
@@ -210,24 +180,21 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() {
error("Audio packet too big for the frame");
if (audioPacketLength >= 4) {
+ // Get our track - audio index plus one as the first track is video
+ BinkAudioTrack *audioTrack = (BinkAudioTrack *)getTrack(i + 1);
uint32 audioPacketStart = _bink->pos();
uint32 audioPacketEnd = _bink->pos() + audioPacketLength;
- if (i == _audioTrack) {
- // Only play one audio track
+ // Number of samples in bytes
+ audio.sampleCount = _bink->readUint32LE() / (2 * audio.channels);
- // Number of samples in bytes
- audio.sampleCount = _bink->readUint32LE() / (2 * audio.channels);
+ audio.bits = new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink,
+ audioPacketStart + 4, audioPacketEnd), true);
- audio.bits =
- new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink,
- audioPacketStart + 4, audioPacketEnd), true);
+ audioTrack->decodePacket();
- audioPacket(audio);
-
- delete audio.bits;
- audio.bits = 0;
- }
+ delete audio.bits;
+ audio.bits = 0;
_bink->seek(audioPacketEnd);
@@ -238,83 +205,160 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() {
uint32 videoPacketStart = _bink->pos();
uint32 videoPacketEnd = _bink->pos() + frameSize;
- frame.bits =
- new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink,
- videoPacketStart, videoPacketEnd), true);
+ frame.bits = new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink,
+ videoPacketStart, videoPacketEnd), true);
- videoPacket(frame);
+ videoTrack->decodePacket(frame);
delete frame.bits;
frame.bits = 0;
+}
- _curFrame++;
- if (_curFrame == 0)
- _startTime = g_system->getMillis();
+BinkDecoder::VideoFrame::VideoFrame() : bits(0) {
+}
- return &_surface;
+BinkDecoder::VideoFrame::~VideoFrame() {
+ delete bits;
}
-void BinkDecoder::audioPacket(AudioTrack &audio) {
- if (!_audioStream)
- return;
- int outSize = audio.frameLen * audio.channels;
- while (audio.bits->pos() < audio.bits->size()) {
- int16 *out = (int16 *)malloc(outSize * 2);
- memset(out, 0, outSize * 2);
+BinkDecoder::AudioInfo::AudioInfo() : bits(0), bands(0), rdft(0), dct(0) {
+}
- audioBlock(audio, out);
+BinkDecoder::AudioInfo::~AudioInfo() {
+ delete bits;
- byte flags = Audio::FLAG_16BITS;
- if (audio.outChannels == 2)
- flags |= Audio::FLAG_STEREO;
+ delete[] bands;
-#ifdef SCUMM_LITTLE_ENDIAN
- flags |= Audio::FLAG_LITTLE_ENDIAN;
-#endif
+ delete rdft;
+ delete dct;
+}
+
+BinkDecoder::BinkVideoTrack::BinkVideoTrack(uint32 width, uint32 height, const Graphics::PixelFormat &format, uint32 frameCount, const Common::Rational &frameRate, bool swapPlanes, bool hasAlpha, uint32 id) :
+ _frameCount(frameCount), _frameRate(frameRate), _swapPlanes(swapPlanes), _hasAlpha(hasAlpha), _id(id) {
+ _curFrame = -1;
+
+ for (int i = 0; i < 16; i++)
+ _huffman[i] = 0;
- _audioStream->queueBuffer((byte *)out, audio.blockSize * 2, DisposeAfterUse::YES, flags);
+ for (int i = 0; i < kSourceMAX; i++) {
+ _bundles[i].countLength = 0;
- if (audio.bits->pos() & 0x1F) // next data block starts at a 32-byte boundary
- audio.bits->skip(32 - (audio.bits->pos() & 0x1F));
+ _bundles[i].huffman.index = 0;
+ for (int j = 0; j < 16; j++)
+ _bundles[i].huffman.symbols[j] = j;
+
+ _bundles[i].data = 0;
+ _bundles[i].dataEnd = 0;
+ _bundles[i].curDec = 0;
+ _bundles[i].curPtr = 0;
}
+
+ for (int i = 0; i < 16; i++) {
+ _colHighHuffman[i].index = 0;
+ for (int j = 0; j < 16; j++)
+ _colHighHuffman[i].symbols[j] = j;
+ }
+
+ // Make the surface even-sized:
+ _surfaceHeight = height;
+ _surfaceWidth = width;
+
+ if (height & 1) {
+ _surfaceHeight++;
+ }
+ if (width & 1) {
+ _surfaceWidth++;
+ }
+
+ _surface.create(_surfaceWidth, _surfaceHeight, format);
+ // Since we over-allocate to make surfaces even-sized
+ // we need to set the actual VIDEO size back into the
+ // surface.
+ _surface.h = height;
+ _surface.w = width;
+
+ // Give the planes a bit extra space
+ width = _surface.w + 32;
+ height = _surface.h + 32;
+
+ _curPlanes[0] = new byte[ width * height ]; // Y
+ _curPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution
+ _curPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution
+ _curPlanes[3] = new byte[ width * height ]; // A
+ _oldPlanes[0] = new byte[ width * height ]; // Y
+ _oldPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution
+ _oldPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution
+ _oldPlanes[3] = new byte[ width * height ]; // A
+
+ // Initialize the video with solid black
+ memset(_curPlanes[0], 0, width * height );
+ memset(_curPlanes[1], 0, (width >> 1) * (height >> 1));
+ memset(_curPlanes[2], 0, (width >> 1) * (height >> 1));
+ memset(_curPlanes[3], 255, width * height );
+ memset(_oldPlanes[0], 0, width * height );
+ memset(_oldPlanes[1], 0, (width >> 1) * (height >> 1));
+ memset(_oldPlanes[2], 0, (width >> 1) * (height >> 1));
+ memset(_oldPlanes[3], 255, width * height );
+
+ initBundles();
+ initHuffman();
}
-void BinkDecoder::videoPacket(VideoFrame &video) {
- assert(video.bits);
+BinkDecoder::BinkVideoTrack::~BinkVideoTrack() {
+ for (int i = 0; i < 4; i++) {
+ delete[] _curPlanes[i]; _curPlanes[i] = 0;
+ delete[] _oldPlanes[i]; _oldPlanes[i] = 0;
+ }
+
+ deinitBundles();
+
+ for (int i = 0; i < 16; i++) {
+ delete _huffman[i];
+ _huffman[i] = 0;
+ }
+
+ _surface.free();
+}
+
+void BinkDecoder::BinkVideoTrack::decodePacket(VideoFrame &frame) {
+ assert(frame.bits);
if (_hasAlpha) {
if (_id == kBIKiID)
- video.bits->skip(32);
+ frame.bits->skip(32);
- decodePlane(video, 3, false);
+ decodePlane(frame, 3, false);
}
if (_id == kBIKiID)
- video.bits->skip(32);
+ frame.bits->skip(32);
for (int i = 0; i < 3; i++) {
int planeIdx = ((i == 0) || !_swapPlanes) ? i : (i ^ 3);
- decodePlane(video, planeIdx, i != 0);
+ decodePlane(frame, planeIdx, i != 0);
- if (video.bits->pos() >= video.bits->size())
+ if (frame.bits->pos() >= frame.bits->size())
break;
}
// Convert the YUV data we have to our format
// We're ignoring alpha for now
+ // The width used here is the surface-width, and not the video-width
+ // to allow for odd-sized videos.
assert(_curPlanes[0] && _curPlanes[1] && _curPlanes[2]);
- Graphics::convertYUV420ToRGB(&_surface, _curPlanes[0], _curPlanes[1], _curPlanes[2],
- _surface.w, _surface.h, _surface.w, _surface.w >> 1);
+ YUVToRGBMan.convert420(&_surface, Graphics::YUVToRGBManager::kScaleITU, _curPlanes[0], _curPlanes[1], _curPlanes[2],
+ _surfaceWidth, _surfaceHeight, _surfaceWidth, _surfaceWidth >> 1);
// And swap the planes with the reference planes
for (int i = 0; i < 4; i++)
SWAP(_curPlanes[i], _oldPlanes[i]);
-}
-void BinkDecoder::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) {
+ _curFrame++;
+}
+void BinkDecoder::BinkVideoTrack::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) {
uint32 blockWidth = isChroma ? ((_surface.w + 15) >> 4) : ((_surface.w + 7) >> 3);
uint32 blockHeight = isChroma ? ((_surface.h + 15) >> 4) : ((_surface.h + 7) >> 3);
uint32 width = isChroma ? (_surface.w >> 1) : _surface.w;
@@ -371,48 +415,38 @@ void BinkDecoder::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) {
}
switch (blockType) {
- case kBlockSkip:
- blockSkip(ctx);
- break;
-
- case kBlockScaled:
- blockScaled(ctx);
- break;
-
- case kBlockMotion:
- blockMotion(ctx);
- break;
-
- case kBlockRun:
- blockRun(ctx);
- break;
-
- case kBlockResidue:
- blockResidue(ctx);
- break;
-
- case kBlockIntra:
- blockIntra(ctx);
- break;
-
- case kBlockFill:
- blockFill(ctx);
- break;
-
- case kBlockInter:
- blockInter(ctx);
- break;
-
- case kBlockPattern:
- blockPattern(ctx);
- break;
-
- case kBlockRaw:
- blockRaw(ctx);
- break;
-
- default:
- error("Unknown block type: %d", blockType);
+ case kBlockSkip:
+ blockSkip(ctx);
+ break;
+ case kBlockScaled:
+ blockScaled(ctx);
+ break;
+ case kBlockMotion:
+ blockMotion(ctx);
+ break;
+ case kBlockRun:
+ blockRun(ctx);
+ break;
+ case kBlockResidue:
+ blockResidue(ctx);
+ break;
+ case kBlockIntra:
+ blockIntra(ctx);
+ break;
+ case kBlockFill:
+ blockFill(ctx);
+ break;
+ case kBlockInter:
+ blockInter(ctx);
+ break;
+ case kBlockPattern:
+ blockPattern(ctx);
+ break;
+ case kBlockRaw:
+ blockRaw(ctx);
+ break;
+ default:
+ error("Unknown block type: %d", blockType);
}
}
@@ -424,7 +458,7 @@ void BinkDecoder::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) {
}
-void BinkDecoder::readBundle(VideoFrame &video, Source source) {
+void BinkDecoder::BinkVideoTrack::readBundle(VideoFrame &video, Source source) {
if (source == kSourceColors) {
for (int i = 0; i < 16; i++)
readHuffman(video, _colHighHuffman[i]);
@@ -439,12 +473,11 @@ void BinkDecoder::readBundle(VideoFrame &video, Source source) {
_bundles[source].curPtr = _bundles[source].data;
}
-void BinkDecoder::readHuffman(VideoFrame &video, Huffman &huffman) {
+void BinkDecoder::BinkVideoTrack::readHuffman(VideoFrame &video, Huffman &huffman) {
huffman.index = video.bits->getBits(4);
if (huffman.index == 0) {
// The first tree always gives raw nibbles
-
for (int i = 0; i < 16; i++)
huffman.symbols[i] = i;
@@ -455,7 +488,6 @@ void BinkDecoder::readHuffman(VideoFrame &video, Huffman &huffman) {
if (video.bits->getBit()) {
// Symbol selection
-
memset(hasSymbol, 0, 16);
uint8 length = video.bits->getBits(3);
@@ -493,9 +525,9 @@ void BinkDecoder::readHuffman(VideoFrame &video, Huffman &huffman) {
memcpy(huffman.symbols, in, 16);
}
-void BinkDecoder::mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size) {
+void BinkDecoder::BinkVideoTrack::mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size) {
const byte *src2 = src + size;
- int size2 = size;
+ int size2 = size;
do {
if (!video.bits->getBit()) {
@@ -510,197 +542,12 @@ void BinkDecoder::mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *
while (size--)
*dst++ = *src++;
+
while (size2--)
*dst++ = *src2++;
}
-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();
- if ((_id != kBIKfID) && (_id != kBIKgID) && (_id != kBIKhID) && (_id != kBIKiID))
- return false;
-
- uint32 fileSize = stream->readUint32LE() + 8;
- uint32 frameCount = stream->readUint32LE();
- uint32 largestFrameSize = stream->readUint32LE();
-
- if (largestFrameSize > fileSize) {
- warning("Largest frame size greater than file size");
- return false;
- }
-
- stream->skip(4);
-
- uint32 width = stream->readUint32LE();
- uint32 height = stream->readUint32LE();
-
- uint32 frameRateNum = stream->readUint32LE();
- uint32 frameRateDen = stream->readUint32LE();
- if (frameRateNum == 0 || frameRateDen == 0) {
- warning("Invalid frame rate (%d/%d)", frameRateNum, frameRateDen);
- return false;
- }
-
- _frameRate = Common::Rational(frameRateNum, frameRateDen);
- _bink = stream;
-
- _videoFlags = _bink->readUint32LE();
-
- uint32 audioTrackCount = _bink->readUint32LE();
-
- if (audioTrackCount > 1) {
- warning("More than one audio track found. Using the first one");
-
- _audioTrack = 0;
- }
-
- if (audioTrackCount > 0) {
- _audioTracks.reserve(audioTrackCount);
-
- _bink->skip(4 * audioTrackCount);
-
- // Reading audio track properties
- for (uint32 i = 0; i < audioTrackCount; i++) {
- AudioTrack track;
-
- track.sampleRate = _bink->readUint16LE();
- track.flags = _bink->readUint16LE();
-
- _audioTracks.push_back(track);
-
- initAudioTrack(_audioTracks[i]);
- }
-
- _bink->skip(4 * audioTrackCount);
- }
-
- // Reading video frame properties
- _frames.resize(frameCount);
- for (uint32 i = 0; i < frameCount; i++) {
- _frames[i].offset = _bink->readUint32LE();
- _frames[i].keyFrame = _frames[i].offset & 1;
-
- _frames[i].offset &= ~1;
-
- if (i != 0)
- _frames[i - 1].size = _frames[i].offset - _frames[i - 1].offset;
-
- _frames[i].bits = 0;
- }
-
- _frames[frameCount - 1].size = _bink->size() - _frames[frameCount - 1].offset;
-
- _hasAlpha = _videoFlags & kVideoFlagAlpha;
- _swapPlanes = (_id == kBIKhID) || (_id == kBIKiID); // BIKh and BIKi swap the chroma planes
-
- _surface.create(width, height, format);
-
- // Give the planes a bit extra space
- width = _surface.w + 32;
- height = _surface.h + 32;
-
- _curPlanes[0] = new byte[ width * height ]; // Y
- _curPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution
- _curPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution
- _curPlanes[3] = new byte[ width * height ]; // A
- _oldPlanes[0] = new byte[ width * height ]; // Y
- _oldPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution
- _oldPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution
- _oldPlanes[3] = new byte[ width * height ]; // A
-
- // Initialize the video with solid black
- memset(_curPlanes[0], 0, width * height );
- memset(_curPlanes[1], 0, (width >> 1) * (height >> 1));
- memset(_curPlanes[2], 0, (width >> 1) * (height >> 1));
- memset(_curPlanes[3], 255, width * height );
- memset(_oldPlanes[0], 0, width * height );
- memset(_oldPlanes[1], 0, (width >> 1) * (height >> 1));
- memset(_oldPlanes[2], 0, (width >> 1) * (height >> 1));
- memset(_oldPlanes[3], 255, width * height );
-
- initBundles();
- initHuffman();
-
- startAudio();
- _audioStartOffset = 0;
-
- return true;
-}
-
-void BinkDecoder::initAudioTrack(AudioTrack &audio) {
- audio.sampleCount = 0;
- audio.bits = 0;
-
- audio.channels = ((audio.flags & kAudioFlagStereo) != 0) ? 2 : 1;
- audio.codec = ((audio.flags & kAudioFlagDCT ) != 0) ? kAudioCodecDCT : kAudioCodecRDFT;
-
- if (audio.channels > kAudioChannelsMax)
- error("Too many audio channels: %d", audio.channels);
-
- uint32 frameLenBits;
- // Calculate frame length
- if (audio.sampleRate < 22050)
- frameLenBits = 9;
- else if(audio.sampleRate < 44100)
- frameLenBits = 10;
- else
- frameLenBits = 11;
-
- audio.frameLen = 1 << frameLenBits;
-
- audio.outSampleRate = audio.sampleRate;
- audio.outChannels = audio.channels;
-
- if (audio.codec == kAudioCodecRDFT) {
- // RDFT audio already interleaves the samples correctly
-
- if (audio.channels == 2)
- frameLenBits++;
-
- audio.sampleRate *= audio.channels;
- audio.frameLen *= audio.channels;
- audio.channels = 1;
- }
-
- audio.overlapLen = audio.frameLen / 16;
- audio.blockSize = (audio.frameLen - audio.overlapLen) * audio.channels;
- audio.root = 2.0 / sqrt((double)audio.frameLen);
-
- uint32 sampleRateHalf = (audio.sampleRate + 1) / 2;
-
- // Calculate number of bands
- for (audio.bandCount = 1; audio.bandCount < 25; audio.bandCount++)
- if (sampleRateHalf <= binkCriticalFreqs[audio.bandCount - 1])
- break;
-
- audio.bands = new uint32[audio.bandCount + 1];
-
- // Populate bands
- audio.bands[0] = 1;
- for (uint32 i = 1; i < audio.bandCount; i++)
- audio.bands[i] = binkCriticalFreqs[i - 1] * (audio.frameLen / 2) / sampleRateHalf;
- audio.bands[audio.bandCount] = audio.frameLen / 2;
-
- audio.first = true;
-
- for (uint8 i = 0; i < audio.channels; i++)
- audio.coeffsPtr[i] = audio.coeffs + i * audio.frameLen;
-
- audio.codec = ((audio.flags & kAudioFlagDCT) != 0) ? kAudioCodecDCT : kAudioCodecRDFT;
-
- if (audio.codec == kAudioCodecRDFT)
- audio.rdft = new Common::RDFT(frameLenBits, Common::RDFT::DFT_C2R);
- else if (audio.codec == kAudioCodecDCT)
- audio.dct = new Common::DCT(frameLenBits, Common::DCT::DCT_III);
-}
-
-void BinkDecoder::initBundles() {
+void BinkDecoder::BinkVideoTrack::initBundles() {
uint32 bw = (_surface.w + 7) >> 3;
uint32 bh = (_surface.h + 7) >> 3;
uint32 blocks = bw * bh;
@@ -729,21 +576,21 @@ void BinkDecoder::initBundles() {
}
}
-void BinkDecoder::deinitBundles() {
+void BinkDecoder::BinkVideoTrack::deinitBundles() {
for (int i = 0; i < kSourceMAX; i++)
delete[] _bundles[i].data;
}
-void BinkDecoder::initHuffman() {
+void BinkDecoder::BinkVideoTrack::initHuffman() {
for (int i = 0; i < 16; i++)
_huffman[i] = new Common::Huffman(binkHuffmanLengths[i][15], 16, binkHuffmanCodes[i], binkHuffmanLengths[i]);
}
-byte BinkDecoder::getHuffmanSymbol(VideoFrame &video, Huffman &huffman) {
+byte BinkDecoder::BinkVideoTrack::getHuffmanSymbol(VideoFrame &video, Huffman &huffman) {
return huffman.symbols[_huffman[huffman.index]->getSymbol(*video.bits)];
}
-int32 BinkDecoder::getBundleValue(Source source) {
+int32 BinkDecoder::BinkVideoTrack::getBundleValue(Source source) {
if ((source < kSourceXOff) || (source == kSourceRun))
return *_bundles[source].curPtr++;
@@ -757,7 +604,7 @@ int32 BinkDecoder::getBundleValue(Source source) {
return ret;
}
-uint32 BinkDecoder::readBundleCount(VideoFrame &video, Bundle &bundle) {
+uint32 BinkDecoder::BinkVideoTrack::readBundleCount(VideoFrame &video, Bundle &bundle) {
if (!bundle.curDec || (bundle.curDec > bundle.curPtr))
return 0;
@@ -768,7 +615,7 @@ uint32 BinkDecoder::readBundleCount(VideoFrame &video, Bundle &bundle) {
return n;
}
-void BinkDecoder::blockSkip(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockSkip(DecodeContext &ctx) {
byte *dest = ctx.dest;
byte *prev = ctx.prev;
@@ -776,7 +623,7 @@ void BinkDecoder::blockSkip(DecodeContext &ctx) {
memcpy(dest, prev, 8);
}
-void BinkDecoder::blockScaledSkip(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaledSkip(DecodeContext &ctx) {
byte *dest = ctx.dest;
byte *prev = ctx.prev;
@@ -784,7 +631,7 @@ void BinkDecoder::blockScaledSkip(DecodeContext &ctx) {
memcpy(dest, prev, 16);
}
-void BinkDecoder::blockScaledRun(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaledRun(DecodeContext &ctx) {
const uint8 *scan = binkPatterns[ctx.video->bits->getBits(4)];
int i = 0;
@@ -820,7 +667,7 @@ void BinkDecoder::blockScaledRun(DecodeContext &ctx) {
ctx.dest[ctx.coordScaledMap4[*scan]] = getBundleValue(kSourceColors);
}
-void BinkDecoder::blockScaledIntra(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaledIntra(DecodeContext &ctx) {
int16 block[64];
memset(block, 0, 64 * sizeof(int16));
@@ -841,7 +688,7 @@ void BinkDecoder::blockScaledIntra(DecodeContext &ctx) {
}
}
-void BinkDecoder::blockScaledFill(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaledFill(DecodeContext &ctx) {
byte v = getBundleValue(kSourceColors);
byte *dest = ctx.dest;
@@ -849,7 +696,7 @@ void BinkDecoder::blockScaledFill(DecodeContext &ctx) {
memset(dest, v, 16);
}
-void BinkDecoder::blockScaledPattern(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaledPattern(DecodeContext &ctx) {
byte col[2];
for (int i = 0; i < 2; i++)
@@ -865,7 +712,7 @@ void BinkDecoder::blockScaledPattern(DecodeContext &ctx) {
}
}
-void BinkDecoder::blockScaledRaw(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaledRaw(DecodeContext &ctx) {
byte row[8];
byte *dest1 = ctx.dest;
@@ -880,32 +727,27 @@ void BinkDecoder::blockScaledRaw(DecodeContext &ctx) {
}
}
-void BinkDecoder::blockScaled(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockScaled(DecodeContext &ctx) {
BlockType blockType = (BlockType) getBundleValue(kSourceSubBlockTypes);
switch (blockType) {
- case kBlockRun:
- blockScaledRun(ctx);
- break;
-
- case kBlockIntra:
- blockScaledIntra(ctx);
- break;
-
- case kBlockFill:
- blockScaledFill(ctx);
- break;
-
- case kBlockPattern:
- blockScaledPattern(ctx);
- break;
-
- case kBlockRaw:
- blockScaledRaw(ctx);
- break;
-
- default:
- error("Invalid 16x16 block type: %d", blockType);
+ case kBlockRun:
+ blockScaledRun(ctx);
+ break;
+ case kBlockIntra:
+ blockScaledIntra(ctx);
+ break;
+ case kBlockFill:
+ blockScaledFill(ctx);
+ break;
+ case kBlockPattern:
+ blockScaledPattern(ctx);
+ break;
+ case kBlockRaw:
+ blockScaledRaw(ctx);
+ break;
+ default:
+ error("Invalid 16x16 block type: %d", blockType);
}
ctx.blockX += 1;
@@ -913,7 +755,7 @@ void BinkDecoder::blockScaled(DecodeContext &ctx) {
ctx.prev += 8;
}
-void BinkDecoder::blockMotion(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockMotion(DecodeContext &ctx) {
int8 xOff = getBundleValue(kSourceXOff);
int8 yOff = getBundleValue(kSourceYOff);
@@ -926,7 +768,7 @@ void BinkDecoder::blockMotion(DecodeContext &ctx) {
memcpy(dest, prev, 8);
}
-void BinkDecoder::blockRun(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockRun(DecodeContext &ctx) {
const uint8 *scan = binkPatterns[ctx.video->bits->getBits(4)];
int i = 0;
@@ -953,7 +795,7 @@ void BinkDecoder::blockRun(DecodeContext &ctx) {
ctx.dest[ctx.coordMap[*scan++]] = getBundleValue(kSourceColors);
}
-void BinkDecoder::blockResidue(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockResidue(DecodeContext &ctx) {
blockMotion(ctx);
byte v = ctx.video->bits->getBits(7);
@@ -970,7 +812,7 @@ void BinkDecoder::blockResidue(DecodeContext &ctx) {
dst[j] += src[j];
}
-void BinkDecoder::blockIntra(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockIntra(DecodeContext &ctx) {
int16 block[64];
memset(block, 0, 64 * sizeof(int16));
@@ -981,7 +823,7 @@ void BinkDecoder::blockIntra(DecodeContext &ctx) {
IDCTPut(ctx, block);
}
-void BinkDecoder::blockFill(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockFill(DecodeContext &ctx) {
byte v = getBundleValue(kSourceColors);
byte *dest = ctx.dest;
@@ -989,7 +831,7 @@ void BinkDecoder::blockFill(DecodeContext &ctx) {
memset(dest, v, 8);
}
-void BinkDecoder::blockInter(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockInter(DecodeContext &ctx) {
blockMotion(ctx);
int16 block[64];
@@ -1002,7 +844,7 @@ void BinkDecoder::blockInter(DecodeContext &ctx) {
IDCTAdd(ctx, block);
}
-void BinkDecoder::blockPattern(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockPattern(DecodeContext &ctx) {
byte col[2];
for (int i = 0; i < 2; i++)
@@ -1017,7 +859,7 @@ void BinkDecoder::blockPattern(DecodeContext &ctx) {
}
}
-void BinkDecoder::blockRaw(DecodeContext &ctx) {
+void BinkDecoder::BinkVideoTrack::blockRaw(DecodeContext &ctx) {
byte *dest = ctx.dest;
byte *data = _bundles[kSourceColors].curPtr;
for (int i = 0; i < 8; i++, dest += ctx.pitch, data += 8)
@@ -1026,7 +868,7 @@ void BinkDecoder::blockRaw(DecodeContext &ctx) {
_bundles[kSourceColors].curPtr += 64;
}
-void BinkDecoder::readRuns(VideoFrame &video, Bundle &bundle) {
+void BinkDecoder::BinkVideoTrack::readRuns(VideoFrame &video, Bundle &bundle) {
uint32 n = readBundleCount(video, bundle);
if (n == 0)
return;
@@ -1046,7 +888,7 @@ void BinkDecoder::readRuns(VideoFrame &video, Bundle &bundle) {
*bundle.curDec++ = getHuffmanSymbol(video, bundle.huffman);
}
-void BinkDecoder::readMotionValues(VideoFrame &video, Bundle &bundle) {
+void BinkDecoder::BinkVideoTrack::readMotionValues(VideoFrame &video, Bundle &bundle) {
uint32 n = readBundleCount(video, bundle);
if (n == 0)
return;
@@ -1083,7 +925,7 @@ void BinkDecoder::readMotionValues(VideoFrame &video, Bundle &bundle) {
}
const uint8 rleLens[4] = { 4, 8, 12, 32 };
-void BinkDecoder::readBlockTypes(VideoFrame &video, Bundle &bundle) {
+void BinkDecoder::BinkVideoTrack::readBlockTypes(VideoFrame &video, Bundle &bundle) {
uint32 n = readBundleCount(video, bundle);
if (n == 0)
return;
@@ -1120,7 +962,7 @@ void BinkDecoder::readBlockTypes(VideoFrame &video, Bundle &bundle) {
} while (bundle.curDec < decEnd);
}
-void BinkDecoder::readPatterns(VideoFrame &video, Bundle &bundle) {
+void BinkDecoder::BinkVideoTrack::readPatterns(VideoFrame &video, Bundle &bundle) {
uint32 n = readBundleCount(video, bundle);
if (n == 0)
return;
@@ -1138,7 +980,7 @@ void BinkDecoder::readPatterns(VideoFrame &video, Bundle &bundle) {
}
-void BinkDecoder::readColors(VideoFrame &video, Bundle &bundle) {
+void BinkDecoder::BinkVideoTrack::readColors(VideoFrame &video, Bundle &bundle) {
uint32 n = readBundleCount(video, bundle);
if (n == 0)
return;
@@ -1182,7 +1024,7 @@ void BinkDecoder::readColors(VideoFrame &video, Bundle &bundle) {
}
}
-void BinkDecoder::readDCS(VideoFrame &video, Bundle &bundle, int startBits, bool hasSign) {
+void BinkDecoder::BinkVideoTrack::readDCS(VideoFrame &video, Bundle &bundle, int startBits, bool hasSign) {
uint32 length = readBundleCount(video, bundle);
if (length == 0)
return;
@@ -1228,7 +1070,7 @@ void BinkDecoder::readDCS(VideoFrame &video, Bundle &bundle, int startBits, bool
}
/** Reads 8x8 block of DCT coefficients. */
-void BinkDecoder::readDCTCoeffs(VideoFrame &video, int16 *block, bool isIntra) {
+void BinkDecoder::BinkVideoTrack::readDCTCoeffs(VideoFrame &video, int16 *block, bool isIntra) {
int coefCount = 0;
int coefIdx[64];
@@ -1326,7 +1168,7 @@ void BinkDecoder::readDCTCoeffs(VideoFrame &video, int16 *block, bool isIntra) {
}
/** Reads 8x8 block with residue after motion compensation. */
-void BinkDecoder::readResidue(VideoFrame &video, int16 *block, int masksCount) {
+void BinkDecoder::BinkVideoTrack::readResidue(VideoFrame &video, int16 *block, int masksCount) {
int nzCoeff[64];
int nzCoeffCount = 0;
@@ -1417,63 +1259,170 @@ void BinkDecoder::readResidue(VideoFrame &video, int16 *block, int masksCount) {
}
}
-float BinkDecoder::getFloat(AudioTrack &audio) {
- int power = audio.bits->getBits(5);
+#define A1 2896 /* (1/sqrt(2))<<12 */
+#define A2 2217
+#define A3 3784
+#define A4 -5352
- float f = ldexp((float)audio.bits->getBits(23), power - 23);
+#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\
+ const int a0 = (src)[s0] + (src)[s4]; \
+ const int a1 = (src)[s0] - (src)[s4]; \
+ const int a2 = (src)[s2] + (src)[s6]; \
+ const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \
+ const int a4 = (src)[s5] + (src)[s3]; \
+ const int a5 = (src)[s5] - (src)[s3]; \
+ const int a6 = (src)[s1] + (src)[s7]; \
+ const int a7 = (src)[s1] - (src)[s7]; \
+ const int b0 = a4 + a6; \
+ const int b1 = (A3*(a5 + a7)) >> 11; \
+ const int b2 = ((A4*a5) >> 11) - b0 + b1; \
+ const int b3 = (A1*(a6 - a4) >> 11) - b2; \
+ const int b4 = ((A2*a7) >> 11) + b3 - b1; \
+ (dest)[d0] = munge(a0+a2 +b0); \
+ (dest)[d1] = munge(a1+a3-a2+b2); \
+ (dest)[d2] = munge(a1-a3+a2+b3); \
+ (dest)[d3] = munge(a0-a2 -b4); \
+ (dest)[d4] = munge(a0-a2 +b4); \
+ (dest)[d5] = munge(a1-a3+a2-b3); \
+ (dest)[d6] = munge(a1+a3-a2-b2); \
+ (dest)[d7] = munge(a0+a2 -b0); \
+}
+/* end IDCT_TRANSFORM macro */
- if (audio.bits->getBit())
- f = -f;
+#define MUNGE_NONE(x) (x)
+#define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src)
- return f;
+#define MUNGE_ROW(x) (((x) + 0x7F)>>8)
+#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src)
+
+static inline void IDCTCol(int16 *dest, const int16 *src) {
+ if ((src[8] | src[16] | src[24] | src[32] | src[40] | src[48] | src[56]) == 0) {
+ dest[ 0] =
+ dest[ 8] =
+ dest[16] =
+ dest[24] =
+ dest[32] =
+ dest[40] =
+ dest[48] =
+ dest[56] = src[0];
+ } else {
+ IDCT_COL(dest, src);
+ }
}
-void BinkDecoder::audioBlock(AudioTrack &audio, int16 *out) {
- if (audio.codec == kAudioCodecDCT)
- audioBlockDCT (audio);
- else if (audio.codec == kAudioCodecRDFT)
- audioBlockRDFT(audio);
+void BinkDecoder::BinkVideoTrack::IDCT(int16 *block) {
+ int i;
+ int16 temp[64];
- floatToInt16Interleave(out, const_cast<const float **>(audio.coeffsPtr), audio.frameLen, audio.channels);
+ for (i = 0; i < 8; i++)
+ IDCTCol(&temp[i], &block[i]);
+ for (i = 0; i < 8; i++) {
+ IDCT_ROW( (&block[8*i]), (&temp[8*i]) );
+ }
+}
- if (!audio.first) {
- int count = audio.overlapLen * audio.channels;
+void BinkDecoder::BinkVideoTrack::IDCTAdd(DecodeContext &ctx, int16 *block) {
+ int i, j;
+
+ IDCT(block);
+ byte *dest = ctx.dest;
+ for (i = 0; i < 8; i++, dest += ctx.pitch, block += 8)
+ for (j = 0; j < 8; j++)
+ dest[j] += block[j];
+}
+
+void BinkDecoder::BinkVideoTrack::IDCTPut(DecodeContext &ctx, int16 *block) {
+ int i;
+ int16 temp[64];
+ for (i = 0; i < 8; i++)
+ IDCTCol(&temp[i], &block[i]);
+ for (i = 0; i < 8; i++) {
+ IDCT_ROW( (&ctx.dest[i*ctx.pitch]), (&temp[8*i]) );
+ }
+}
+
+BinkDecoder::BinkAudioTrack::BinkAudioTrack(BinkDecoder::AudioInfo &audio) : _audioInfo(&audio) {
+ _audioStream = Audio::makeQueuingAudioStream(_audioInfo->outSampleRate, _audioInfo->outChannels == 2);
+}
+
+BinkDecoder::BinkAudioTrack::~BinkAudioTrack() {
+ delete _audioStream;
+}
+
+Audio::AudioStream *BinkDecoder::BinkAudioTrack::getAudioStream() const {
+ return _audioStream;
+}
+
+void BinkDecoder::BinkAudioTrack::decodePacket() {
+ int outSize = _audioInfo->frameLen * _audioInfo->channels;
+
+ while (_audioInfo->bits->pos() < _audioInfo->bits->size()) {
+ int16 *out = (int16 *)malloc(outSize * 2);
+ memset(out, 0, outSize * 2);
+
+ audioBlock(out);
+
+ byte flags = Audio::FLAG_16BITS;
+ if (_audioInfo->outChannels == 2)
+ flags |= Audio::FLAG_STEREO;
+
+#ifdef SCUMM_LITTLE_ENDIAN
+ flags |= Audio::FLAG_LITTLE_ENDIAN;
+#endif
+
+ _audioStream->queueBuffer((byte *)out, _audioInfo->blockSize * 2, DisposeAfterUse::YES, flags);
+
+ if (_audioInfo->bits->pos() & 0x1F) // next data block starts at a 32-byte boundary
+ _audioInfo->bits->skip(32 - (_audioInfo->bits->pos() & 0x1F));
+ }
+}
+
+void BinkDecoder::BinkAudioTrack::audioBlock(int16 *out) {
+ if (_audioInfo->codec == kAudioCodecDCT)
+ audioBlockDCT ();
+ else if (_audioInfo->codec == kAudioCodecRDFT)
+ audioBlockRDFT();
+
+ floatToInt16Interleave(out, const_cast<const float **>(_audioInfo->coeffsPtr), _audioInfo->frameLen, _audioInfo->channels);
+
+ if (!_audioInfo->first) {
+ int count = _audioInfo->overlapLen * _audioInfo->channels;
int shift = Common::intLog2(count);
for (int i = 0; i < count; i++) {
- out[i] = (audio.prevCoeffs[i] * (count - i) + out[i] * i) >> shift;
+ out[i] = (_audioInfo->prevCoeffs[i] * (count - i) + out[i] * i) >> shift;
}
}
- memcpy(audio.prevCoeffs, out + audio.blockSize, audio.overlapLen * audio.channels * sizeof(*out));
+ memcpy(_audioInfo->prevCoeffs, out + _audioInfo->blockSize, _audioInfo->overlapLen * _audioInfo->channels * sizeof(*out));
- audio.first = false;
+ _audioInfo->first = false;
}
-void BinkDecoder::audioBlockDCT(AudioTrack &audio) {
- audio.bits->skip(2);
+void BinkDecoder::BinkAudioTrack::audioBlockDCT() {
+ _audioInfo->bits->skip(2);
- for (uint8 i = 0; i < audio.channels; i++) {
- float *coeffs = audio.coeffsPtr[i];
+ for (uint8 i = 0; i < _audioInfo->channels; i++) {
+ float *coeffs = _audioInfo->coeffsPtr[i];
- readAudioCoeffs(audio, coeffs);
+ readAudioCoeffs(coeffs);
coeffs[0] /= 0.5;
- audio.dct->calc(coeffs);
+ _audioInfo->dct->calc(coeffs);
- for (uint32 j = 0; j < audio.frameLen; j++)
- coeffs[j] *= (audio.frameLen / 2.0);
+ for (uint32 j = 0; j < _audioInfo->frameLen; j++)
+ coeffs[j] *= (_audioInfo->frameLen / 2.0);
}
}
-void BinkDecoder::audioBlockRDFT(AudioTrack &audio) {
- for (uint8 i = 0; i < audio.channels; i++) {
- float *coeffs = audio.coeffsPtr[i];
+void BinkDecoder::BinkAudioTrack::audioBlockRDFT() {
+ for (uint8 i = 0; i < _audioInfo->channels; i++) {
+ float *coeffs = _audioInfo->coeffsPtr[i];
- readAudioCoeffs(audio, coeffs);
+ readAudioCoeffs(coeffs);
- audio.rdft->calc(coeffs);
+ _audioInfo->rdft->calc(coeffs);
}
}
@@ -1481,56 +1430,56 @@ static const uint8 rleLengthTab[16] = {
2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
};
-void BinkDecoder::readAudioCoeffs(AudioTrack &audio, float *coeffs) {
- coeffs[0] = getFloat(audio) * audio.root;
- coeffs[1] = getFloat(audio) * audio.root;
+void BinkDecoder::BinkAudioTrack::readAudioCoeffs(float *coeffs) {
+ coeffs[0] = getFloat() * _audioInfo->root;
+ coeffs[1] = getFloat() * _audioInfo->root;
float quant[25];
- for (uint32 i = 0; i < audio.bandCount; i++) {
- int value = audio.bits->getBits(8);
+ for (uint32 i = 0; i < _audioInfo->bandCount; i++) {
+ int value = _audioInfo->bits->getBits(8);
// 0.066399999 / log10(M_E)
- quant[i] = exp(MIN(value, 95) * 0.15289164787221953823f) * audio.root;
+ quant[i] = exp(MIN(value, 95) * 0.15289164787221953823f) * _audioInfo->root;
}
float q = 0.0;
// Find band (k)
int k;
- for (k = 0; audio.bands[k] < 1; k++)
+ for (k = 0; _audioInfo->bands[k] < 1; k++)
q = quant[k];
// Parse coefficients
uint32 i = 2;
- while (i < audio.frameLen) {
+ while (i < _audioInfo->frameLen) {
uint32 j = 0;
- if (audio.bits->getBit())
- j = i + rleLengthTab[audio.bits->getBits(4)] * 8;
+ if (_audioInfo->bits->getBit())
+ j = i + rleLengthTab[_audioInfo->bits->getBits(4)] * 8;
else
j = i + 8;
- j = MIN(j, audio.frameLen);
+ j = MIN(j, _audioInfo->frameLen);
- int width = audio.bits->getBits(4);
+ int width = _audioInfo->bits->getBits(4);
if (width == 0) {
memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
i = j;
- while (audio.bands[k] * 2 < i)
+ while (_audioInfo->bands[k] * 2 < i)
q = quant[k++];
} else {
while (i < j) {
- if (audio.bands[k] * 2 == i)
+ if (_audioInfo->bands[k] * 2 == i)
q = quant[k++];
- int coeff = audio.bits->getBits(width);
+ int coeff = _audioInfo->bits->getBits(width);
if (coeff) {
- if (audio.bits->getBit())
+ if (_audioInfo->bits->getBit())
coeffs[i] = -q * coeff;
else
coeffs[i] = q * coeff;
@@ -1548,10 +1497,10 @@ void BinkDecoder::readAudioCoeffs(AudioTrack &audio, float *coeffs) {
}
static inline int floatToInt16One(float src) {
- return (int16) CLIP<int>((int) floor(src + 0.5), -32768, 32767);
+ return (int16)CLIP<int>((int)floor(src + 0.5), -32768, 32767);
}
-void BinkDecoder::floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels) {
+void BinkDecoder::BinkAudioTrack::floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels) {
if (channels == 2) {
for (uint32 i = 0; i < length; i++) {
dst[2 * i ] = floatToInt16One(src[0][i]);
@@ -1564,87 +1513,84 @@ void BinkDecoder::floatToInt16Interleave(int16 *dst, const float **src, uint32 l
}
}
-#define A1 2896 /* (1/sqrt(2))<<12 */
-#define A2 2217
-#define A3 3784
-#define A4 -5352
+float BinkDecoder::BinkAudioTrack::getFloat() {
+ int power = _audioInfo->bits->getBits(5);
-#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\
- const int a0 = (src)[s0] + (src)[s4]; \
- const int a1 = (src)[s0] - (src)[s4]; \
- const int a2 = (src)[s2] + (src)[s6]; \
- const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \
- const int a4 = (src)[s5] + (src)[s3]; \
- const int a5 = (src)[s5] - (src)[s3]; \
- const int a6 = (src)[s1] + (src)[s7]; \
- const int a7 = (src)[s1] - (src)[s7]; \
- const int b0 = a4 + a6; \
- const int b1 = (A3*(a5 + a7)) >> 11; \
- const int b2 = ((A4*a5) >> 11) - b0 + b1; \
- const int b3 = (A1*(a6 - a4) >> 11) - b2; \
- const int b4 = ((A2*a7) >> 11) + b3 - b1; \
- (dest)[d0] = munge(a0+a2 +b0); \
- (dest)[d1] = munge(a1+a3-a2+b2); \
- (dest)[d2] = munge(a1-a3+a2+b3); \
- (dest)[d3] = munge(a0-a2 -b4); \
- (dest)[d4] = munge(a0-a2 +b4); \
- (dest)[d5] = munge(a1-a3+a2-b3); \
- (dest)[d6] = munge(a1+a3-a2-b2); \
- (dest)[d7] = munge(a0+a2 -b0); \
+ float f = ldexp((float)_audioInfo->bits->getBits(23), power - 23);
+
+ if (_audioInfo->bits->getBit())
+ f = -f;
+
+ return f;
}
-/* end IDCT_TRANSFORM macro */
-#define MUNGE_NONE(x) (x)
-#define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src)
+void BinkDecoder::initAudioTrack(AudioInfo &audio) {
+ audio.sampleCount = 0;
+ audio.bits = 0;
-#define MUNGE_ROW(x) (((x) + 0x7F)>>8)
-#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src)
+ audio.channels = ((audio.flags & kAudioFlagStereo) != 0) ? 2 : 1;
+ audio.codec = ((audio.flags & kAudioFlagDCT ) != 0) ? kAudioCodecDCT : kAudioCodecRDFT;
-static inline void IDCTCol(int16 *dest, const int16 *src)
-{
- if ((src[8] | src[16] | src[24] | src[32] | src[40] | src[48] | src[56]) == 0) {
- dest[ 0] =
- dest[ 8] =
- dest[16] =
- dest[24] =
- dest[32] =
- dest[40] =
- dest[48] =
- dest[56] = src[0];
- } else {
- IDCT_COL(dest, src);
- }
-}
+ if (audio.channels > kAudioChannelsMax)
+ error("Too many audio channels: %d", audio.channels);
-void BinkDecoder::IDCT(int16 *block) {
- int i;
- int16 temp[64];
+ uint32 frameLenBits;
+ // Calculate frame length
+ if (audio.sampleRate < 22050)
+ frameLenBits = 9;
+ else if(audio.sampleRate < 44100)
+ frameLenBits = 10;
+ else
+ frameLenBits = 11;
- for (i = 0; i < 8; i++)
- IDCTCol(&temp[i], &block[i]);
- for (i = 0; i < 8; i++) {
- IDCT_ROW( (&block[8*i]), (&temp[8*i]) );
- }
-}
+ audio.frameLen = 1 << frameLenBits;
-void BinkDecoder::IDCTAdd(DecodeContext &ctx, int16 *block) {
- int i, j;
+ audio.outSampleRate = audio.sampleRate;
+ audio.outChannels = audio.channels;
- IDCT(block);
- byte *dest = ctx.dest;
- for (i = 0; i < 8; i++, dest += ctx.pitch, block += 8)
- for (j = 0; j < 8; j++)
- dest[j] += block[j];
-}
+ if (audio.codec == kAudioCodecRDFT) {
+ // RDFT audio already interleaves the samples correctly
-void BinkDecoder::IDCTPut(DecodeContext &ctx, int16 *block) {
- int i;
- int16 temp[64];
- for (i = 0; i < 8; i++)
- IDCTCol(&temp[i], &block[i]);
- for (i = 0; i < 8; i++) {
- IDCT_ROW( (&ctx.dest[i*ctx.pitch]), (&temp[8*i]) );
+ if (audio.channels == 2)
+ frameLenBits++;
+
+ audio.sampleRate *= audio.channels;
+ audio.frameLen *= audio.channels;
+ audio.channels = 1;
}
+
+ audio.overlapLen = audio.frameLen / 16;
+ audio.blockSize = (audio.frameLen - audio.overlapLen) * audio.channels;
+ audio.root = 2.0 / sqrt((double)audio.frameLen);
+
+ uint32 sampleRateHalf = (audio.sampleRate + 1) / 2;
+
+ // Calculate number of bands
+ for (audio.bandCount = 1; audio.bandCount < 25; audio.bandCount++)
+ if (sampleRateHalf <= binkCriticalFreqs[audio.bandCount - 1])
+ break;
+
+ audio.bands = new uint32[audio.bandCount + 1];
+
+ // Populate bands
+ audio.bands[0] = 1;
+ for (uint32 i = 1; i < audio.bandCount; i++)
+ audio.bands[i] = binkCriticalFreqs[i - 1] * (audio.frameLen / 2) / sampleRateHalf;
+ audio.bands[audio.bandCount] = audio.frameLen / 2;
+
+ audio.first = true;
+
+ for (uint8 i = 0; i < audio.channels; i++)
+ audio.coeffsPtr[i] = audio.coeffs + i * audio.frameLen;
+
+ audio.codec = ((audio.flags & kAudioFlagDCT) != 0) ? kAudioCodecDCT : kAudioCodecRDFT;
+
+ if (audio.codec == kAudioCodecRDFT)
+ audio.rdft = new Common::RDFT(frameLenBits, Common::RDFT::DFT_C2R);
+ else if (audio.codec == kAudioCodecDCT)
+ audio.dct = new Common::DCT(frameLenBits, Common::DCT::DCT_III);
+
+ addTrack(new BinkAudioTrack(audio));
}
} // End of namespace Video
diff --git a/video/bink_decoder.h b/video/bink_decoder.h
index 3d5e882dd7..27d3aa3691 100644
--- a/video/bink_decoder.h
+++ b/video/bink_decoder.h
@@ -31,22 +31,27 @@
#ifndef VIDEO_BINK_DECODER_H
#define VIDEO_BINK_DECODER_H
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
#include "common/array.h"
#include "common/rational.h"
-#include "graphics/surface.h"
-
#include "video/video_decoder.h"
+namespace Audio {
+class AudioStream;
+class QueuingAudioStream;
+}
+
namespace Common {
- class SeekableReadStream;
- class BitStream;
- class Huffman;
+class SeekableReadStream;
+class BitStream;
+class Huffman;
- class RDFT;
- class DCT;
+class RDFT;
+class DCT;
+}
+
+namespace Graphics {
+struct Surface;
}
namespace Video {
@@ -57,87 +62,28 @@ namespace Video {
* Video decoder used in engines:
* - scumm (he)
*/
-class BinkDecoder : public FixedRateVideoDecoder {
+class BinkDecoder : public VideoDecoder {
public:
BinkDecoder();
~BinkDecoder();
- // VideoDecoder API
bool loadStream(Common::SeekableReadStream *stream);
void close();
- bool isVideoLoaded() const { return _bink != 0; }
- uint16 getWidth() const { return _surface.w; }
- uint16 getHeight() const { return _surface.h; }
- Graphics::PixelFormat getPixelFormat() const { return _surface.format; }
- uint32 getFrameCount() const { return _frames.size(); }
- uint32 getElapsedTime() const;
- const Graphics::Surface *decodeNextFrame();
-
- // FixedRateVideoDecoder
- Common::Rational getFrameRate() const { return _frameRate; }
-
- // Bink specific
- bool loadStream(Common::SeekableReadStream *stream, const Graphics::PixelFormat &format);
+
protected:
+ void readNextPacket();
+
+private:
static const int kAudioChannelsMax = 2;
static const int kAudioBlockSizeMax = (kAudioChannelsMax << 11);
- /** IDs for different data types used in Bink video codec. */
- enum Source {
- kSourceBlockTypes = 0, ///< 8x8 block types.
- kSourceSubBlockTypes , ///< 16x16 block types (a subset of 8x8 block types).
- kSourceColors , ///< Pixel values used for different block types.
- kSourcePattern , ///< 8-bit values for 2-color pattern fill.
- kSourceXOff , ///< X components of motion value.
- kSourceYOff , ///< Y components of motion value.
- kSourceIntraDC , ///< DC values for intrablocks with DCT.
- kSourceInterDC , ///< DC values for interblocks with DCT.
- kSourceRun , ///< Run lengths for special fill block.
-
- kSourceMAX
- };
-
- /** Bink video block types. */
- enum BlockType {
- kBlockSkip = 0, ///< Skipped block.
- kBlockScaled , ///< Block has size 16x16.
- kBlockMotion , ///< Block is copied from previous frame with some offset.
- kBlockRun , ///< Block is composed from runs of colors with custom scan order.
- kBlockResidue , ///< Motion block with some difference added.
- kBlockIntra , ///< Intra DCT block.
- kBlockFill , ///< Block is filled with single color.
- kBlockInter , ///< Motion block with DCT applied to the difference.
- kBlockPattern , ///< Block is filled with two colors following custom pattern.
- kBlockRaw ///< Uncoded 8x8 block.
- };
-
- /** Data structure for decoding and tranlating Huffman'd data. */
- struct Huffman {
- int index; ///< Index of the Huffman codebook to use.
- byte symbols[16]; ///< Huffman symbol => Bink symbol tranlation list.
- };
-
- /** Data structure used for decoding a single Bink data type. */
- struct Bundle {
- int countLengths[2]; ///< Lengths of number of entries to decode (in bits).
- int countLength; ///< Length of number of entries to decode (in bits) for the current plane.
-
- Huffman huffman; ///< Huffman codebook.
-
- byte *data; ///< Buffer for decoded symbols.
- byte *dataEnd; ///< Buffer end.
-
- byte *curDec; ///< Pointer to the data that wasn't yet decoded.
- byte *curPtr; ///< Pointer to the data that wasn't yet read.
- };
-
enum AudioCodec {
kAudioCodecDCT,
kAudioCodecRDFT
};
/** An audio track. */
- struct AudioTrack {
+ struct AudioInfo {
uint16 flags;
uint32 sampleRate;
@@ -172,8 +118,8 @@ protected:
Common::RDFT *rdft;
Common::DCT *dct;
- AudioTrack();
- ~AudioTrack();
+ AudioInfo();
+ ~AudioInfo();
};
/** A video frame. */
@@ -189,149 +135,220 @@ protected:
~VideoFrame();
};
- /** A decoder state. */
- struct DecodeContext {
- VideoFrame *video;
-
- uint32 planeIdx;
+ class BinkVideoTrack : public FixedRateVideoTrack {
+ public:
+ BinkVideoTrack(uint32 width, uint32 height, const Graphics::PixelFormat &format, uint32 frameCount, const Common::Rational &frameRate, bool swapPlanes, bool hasAlpha, uint32 id);
+ ~BinkVideoTrack();
+
+ uint16 getWidth() const { return _surface.w; }
+ uint16 getHeight() const { return _surface.h; }
+ Graphics::PixelFormat getPixelFormat() const { return _surface.format; }
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ const Graphics::Surface *decodeNextFrame() { return &_surface; }
+
+ /** Decode a video packet. */
+ void decodePacket(VideoFrame &frame);
+
+ protected:
+ Common::Rational getFrameRate() const { return _frameRate; }
- uint32 blockX;
- uint32 blockY;
+ private:
+ /** A decoder state. */
+ struct DecodeContext {
+ VideoFrame *video;
+
+ uint32 planeIdx;
+
+ uint32 blockX;
+ uint32 blockY;
+
+ byte *dest;
+ byte *prev;
+
+ byte *destStart, *destEnd;
+ byte *prevStart, *prevEnd;
- byte *dest;
- byte *prev;
-
- byte *destStart, *destEnd;
- byte *prevStart, *prevEnd;
+ uint32 pitch;
+
+ int coordMap[64];
+ int coordScaledMap1[64];
+ int coordScaledMap2[64];
+ int coordScaledMap3[64];
+ int coordScaledMap4[64];
+ };
+
+ /** IDs for different data types used in Bink video codec. */
+ enum Source {
+ kSourceBlockTypes = 0, ///< 8x8 block types.
+ kSourceSubBlockTypes , ///< 16x16 block types (a subset of 8x8 block types).
+ kSourceColors , ///< Pixel values used for different block types.
+ kSourcePattern , ///< 8-bit values for 2-color pattern fill.
+ kSourceXOff , ///< X components of motion value.
+ kSourceYOff , ///< Y components of motion value.
+ kSourceIntraDC , ///< DC values for intrablocks with DCT.
+ kSourceInterDC , ///< DC values for interblocks with DCT.
+ kSourceRun , ///< Run lengths for special fill block.
+
+ kSourceMAX
+ };
+
+ /** Bink video block types. */
+ enum BlockType {
+ kBlockSkip = 0, ///< Skipped block.
+ kBlockScaled , ///< Block has size 16x16.
+ kBlockMotion , ///< Block is copied from previous frame with some offset.
+ kBlockRun , ///< Block is composed from runs of colors with custom scan order.
+ kBlockResidue , ///< Motion block with some difference added.
+ kBlockIntra , ///< Intra DCT block.
+ kBlockFill , ///< Block is filled with single color.
+ kBlockInter , ///< Motion block with DCT applied to the difference.
+ kBlockPattern , ///< Block is filled with two colors following custom pattern.
+ kBlockRaw ///< Uncoded 8x8 block.
+ };
+
+ /** Data structure for decoding and tranlating Huffman'd data. */
+ struct Huffman {
+ int index; ///< Index of the Huffman codebook to use.
+ byte symbols[16]; ///< Huffman symbol => Bink symbol tranlation list.
+ };
+
+ /** Data structure used for decoding a single Bink data type. */
+ struct Bundle {
+ int countLengths[2]; ///< Lengths of number of entries to decode (in bits).
+ int countLength; ///< Length of number of entries to decode (in bits) for the current plane.
+
+ Huffman huffman; ///< Huffman codebook.
+
+ byte *data; ///< Buffer for decoded symbols.
+ byte *dataEnd; ///< Buffer end.
+
+ byte *curDec; ///< Pointer to the data that wasn't yet decoded.
+ byte *curPtr; ///< Pointer to the data that wasn't yet read.
+ };
+
+ int _curFrame;
+ int _frameCount;
+
+ Graphics::Surface _surface;
+ int _surfaceWidth; ///< The actual surface width
+ int _surfaceHeight; ///< The actual surface height
+
+ uint32 _id; ///< The BIK FourCC.
+
+ bool _hasAlpha; ///< Do video frames have alpha?
+ bool _swapPlanes; ///< Are the planes ordered (A)YVU instead of (A)YUV?
+
+ Common::Rational _frameRate;
+
+ Bundle _bundles[kSourceMAX]; ///< Bundles for decoding all data types.
+
+ Common::Huffman *_huffman[16]; ///< The 16 Huffman codebooks used in Bink decoding.
+
+ /** Huffman codebooks to use for decoding high nibbles in color data types. */
+ Huffman _colHighHuffman[16];
+ /** Value of the last decoded high nibble in color data types. */
+ int _colLastVal;
+
+ byte *_curPlanes[4]; ///< The 4 color planes, YUVA, current frame.
+ byte *_oldPlanes[4]; ///< The 4 color planes, YUVA, last frame.
+
+ /** Initialize the bundles. */
+ void initBundles();
+ /** Deinitialize the bundles. */
+ void deinitBundles();
+
+ /** Initialize the Huffman decoders. */
+ void initHuffman();
+
+ /** Decode a plane. */
+ void decodePlane(VideoFrame &video, int planeIdx, bool isChroma);
+
+ /** Read/Initialize a bundle for decoding a plane. */
+ void readBundle(VideoFrame &video, Source source);
+
+ /** Read the symbols for a Huffman code. */
+ void readHuffman(VideoFrame &video, Huffman &huffman);
+ /** Merge two Huffman symbol lists. */
+ void mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size);
+
+ /** Read and translate a symbol out of a Huffman code. */
+ byte getHuffmanSymbol(VideoFrame &video, Huffman &huffman);
+
+ /** Get a direct value out of a bundle. */
+ int32 getBundleValue(Source source);
+ /** Read a count value out of a bundle. */
+ uint32 readBundleCount(VideoFrame &video, Bundle &bundle);
+
+ // Handle the block types
+ void blockSkip (DecodeContext &ctx);
+ void blockScaledSkip (DecodeContext &ctx);
+ void blockScaledRun (DecodeContext &ctx);
+ void blockScaledIntra (DecodeContext &ctx);
+ void blockScaledFill (DecodeContext &ctx);
+ void blockScaledPattern(DecodeContext &ctx);
+ void blockScaledRaw (DecodeContext &ctx);
+ void blockScaled (DecodeContext &ctx);
+ void blockMotion (DecodeContext &ctx);
+ void blockRun (DecodeContext &ctx);
+ void blockResidue (DecodeContext &ctx);
+ void blockIntra (DecodeContext &ctx);
+ void blockFill (DecodeContext &ctx);
+ void blockInter (DecodeContext &ctx);
+ void blockPattern (DecodeContext &ctx);
+ void blockRaw (DecodeContext &ctx);
+
+ // Read the bundles
+ void readRuns (VideoFrame &video, Bundle &bundle);
+ void readMotionValues(VideoFrame &video, Bundle &bundle);
+ void readBlockTypes (VideoFrame &video, Bundle &bundle);
+ void readPatterns (VideoFrame &video, Bundle &bundle);
+ void readColors (VideoFrame &video, Bundle &bundle);
+ void readDCS (VideoFrame &video, Bundle &bundle, int startBits, bool hasSign);
+ void readDCTCoeffs (VideoFrame &video, int16 *block, bool isIntra);
+ void readResidue (VideoFrame &video, int16 *block, int masksCount);
+
+ // Bink video IDCT
+ void IDCT(int16 *block);
+ void IDCTPut(DecodeContext &ctx, int16 *block);
+ void IDCTAdd(DecodeContext &ctx, int16 *block);
+ };
- uint32 pitch;
+ class BinkAudioTrack : public AudioTrack {
+ public:
+ BinkAudioTrack(AudioInfo &audio);
+ ~BinkAudioTrack();
- int coordMap[64];
- int coordScaledMap1[64];
- int coordScaledMap2[64];
- int coordScaledMap3[64];
- int coordScaledMap4[64];
- };
+ /** Decode an audio packet. */
+ void decodePacket();
- Common::SeekableReadStream *_bink;
+ protected:
+ Audio::AudioStream *getAudioStream() const;
- uint32 _id; ///< The BIK FourCC.
+ private:
+ AudioInfo *_audioInfo;
+ Audio::QueuingAudioStream *_audioStream;
- Common::Rational _frameRate;
+ float getFloat();
- Graphics::Surface _surface;
+ /** Decode an audio block. */
+ void audioBlock(int16 *out);
+ /** Decode a DCT'd audio block. */
+ void audioBlockDCT();
+ /** Decode a RDFT'd audio block. */
+ void audioBlockRDFT();
- Audio::SoundHandle _audioHandle;
- Audio::QueuingAudioStream *_audioStream;
- int32 _audioStartOffset;
+ void readAudioCoeffs(float *coeffs);
- uint32 _videoFlags; ///< Video frame features.
+ static void floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels);
+ };
- bool _hasAlpha; ///< Do video frames have alpha?
- bool _swapPlanes; ///< Are the planes ordered (A)YVU instead of (A)YUV?
+ Common::SeekableReadStream *_bink;
- Common::Array<AudioTrack> _audioTracks; ///< All audio tracks.
+ Common::Array<AudioInfo> _audioTracks; ///< All audio tracks.
Common::Array<VideoFrame> _frames; ///< All video frames.
- uint32 _audioTrack; ///< Audio track to use.
-
- Common::Huffman *_huffman[16]; ///< The 16 Huffman codebooks used in Bink decoding.
-
- Bundle _bundles[kSourceMAX]; ///< Bundles for decoding all data types.
-
- /** Huffman codebooks to use for decoding high nibbles in color data types. */
- Huffman _colHighHuffman[16];
- /** Value of the last decoded high nibble in color data types. */
- int _colLastVal;
-
- byte *_curPlanes[4]; ///< The 4 color planes, YUVA, current frame.
- byte *_oldPlanes[4]; ///< The 4 color planes, YUVA, last frame.
-
-
- /** Initialize the bundles. */
- void initBundles();
- /** Deinitialize the bundles. */
- void deinitBundles();
-
- /** Initialize the Huffman decoders. */
- void initHuffman();
-
- /** Decode an audio packet. */
- void audioPacket(AudioTrack &audio);
- /** Decode a video packet. */
- virtual void videoPacket(VideoFrame &video);
-
- /** Decode a plane. */
- void decodePlane(VideoFrame &video, int planeIdx, bool isChroma);
-
- /** Read/Initialize a bundle for decoding a plane. */
- void readBundle(VideoFrame &video, Source source);
-
- /** Read the symbols for a Huffman code. */
- void readHuffman(VideoFrame &video, Huffman &huffman);
- /** Merge two Huffman symbol lists. */
- void mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size);
-
- /** Read and translate a symbol out of a Huffman code. */
- byte getHuffmanSymbol(VideoFrame &video, Huffman &huffman);
-
- /** Get a direct value out of a bundle. */
- int32 getBundleValue(Source source);
- /** Read a count value out of a bundle. */
- uint32 readBundleCount(VideoFrame &video, Bundle &bundle);
-
- // Handle the block types
- void blockSkip (DecodeContext &ctx);
- void blockScaledSkip (DecodeContext &ctx);
- void blockScaledRun (DecodeContext &ctx);
- void blockScaledIntra (DecodeContext &ctx);
- void blockScaledFill (DecodeContext &ctx);
- void blockScaledPattern(DecodeContext &ctx);
- void blockScaledRaw (DecodeContext &ctx);
- void blockScaled (DecodeContext &ctx);
- void blockMotion (DecodeContext &ctx);
- void blockRun (DecodeContext &ctx);
- void blockResidue (DecodeContext &ctx);
- void blockIntra (DecodeContext &ctx);
- void blockFill (DecodeContext &ctx);
- void blockInter (DecodeContext &ctx);
- void blockPattern (DecodeContext &ctx);
- void blockRaw (DecodeContext &ctx);
-
- // Read the bundles
- void readRuns (VideoFrame &video, Bundle &bundle);
- void readMotionValues(VideoFrame &video, Bundle &bundle);
- void readBlockTypes (VideoFrame &video, Bundle &bundle);
- void readPatterns (VideoFrame &video, Bundle &bundle);
- void readColors (VideoFrame &video, Bundle &bundle);
- void readDCS (VideoFrame &video, Bundle &bundle, int startBits, bool hasSign);
- void readDCTCoeffs (VideoFrame &video, int16 *block, bool isIntra);
- void readResidue (VideoFrame &video, int16 *block, int masksCount);
-
- void initAudioTrack(AudioTrack &audio);
-
- float getFloat(AudioTrack &audio);
-
- /** Decode an audio block. */
- void audioBlock (AudioTrack &audio, int16 *out);
- /** Decode a DCT'd audio block. */
- void audioBlockDCT (AudioTrack &audio);
- /** Decode a RDFT'd audio block. */
- void audioBlockRDFT(AudioTrack &audio);
-
- void readAudioCoeffs(AudioTrack &audio, float *coeffs);
-
- void floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels);
-
- // Bink video IDCT
- 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();
+ void initAudioTrack(AudioInfo &audio);
};
} // End of namespace Video
diff --git a/video/codecs/mjpeg.cpp b/video/codecs/mjpeg.cpp
index 248a80d714..10fd9d7c50 100644
--- a/video/codecs/mjpeg.cpp
+++ b/video/codecs/mjpeg.cpp
@@ -22,8 +22,8 @@
#include "common/system.h"
#include "common/textconsole.h"
-#include "graphics/jpeg.h"
#include "graphics/surface.h"
+#include "graphics/decoders/jpeg.h"
#include "video/codecs/mjpeg.h"
@@ -34,38 +34,31 @@ class SeekableReadStream;
namespace Video {
JPEGDecoder::JPEGDecoder() : Codec() {
- _jpeg = new Graphics::JPEG();
_pixelFormat = g_system->getScreenFormat();
_surface = NULL;
}
JPEGDecoder::~JPEGDecoder() {
- delete _jpeg;
-
if (_surface) {
_surface->free();
delete _surface;
}
}
-const Graphics::Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream* stream) {
- if (!_jpeg->read(stream)) {
+const Graphics::Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
+ Graphics::JPEGDecoder jpeg;
+
+ if (!jpeg.loadStream(*stream)) {
warning("Failed to decode JPEG frame");
return 0;
}
- if (!_surface) {
- _surface = new Graphics::Surface();
- _surface->create(_jpeg->getWidth(), _jpeg->getHeight(), _pixelFormat);
+ if (_surface) {
+ _surface->free();
+ delete _surface;
}
- Graphics::Surface *frame = _jpeg->getSurface(_pixelFormat);
- assert(frame);
-
- _surface->copyFrom(*frame);
-
- frame->free();
- delete frame;
+ _surface = jpeg.getSurface()->convertTo(_pixelFormat);
return _surface;
}
diff --git a/video/codecs/mjpeg.h b/video/codecs/mjpeg.h
index 45cb57dea2..0c3b668a74 100644
--- a/video/codecs/mjpeg.h
+++ b/video/codecs/mjpeg.h
@@ -31,7 +31,7 @@ class SeekableReadStream;
}
namespace Graphics {
-class JPEG;
+struct Surface;
}
namespace Video {
@@ -50,7 +50,6 @@ public:
private:
Graphics::PixelFormat _pixelFormat;
- Graphics::JPEG *_jpeg;
Graphics::Surface *_surface;
};
diff --git a/video/codecs/qtrle.cpp b/video/codecs/qtrle.cpp
index f01720ec86..d2cdea27de 100644
--- a/video/codecs/qtrle.cpp
+++ b/video/codecs/qtrle.cpp
@@ -37,28 +37,25 @@ namespace Video {
QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Codec() {
_bitsPerPixel = bitsPerPixel;
- _pixelFormat = g_system->getScreenFormat();
- // We need to increase the surface size to a multiple of 4
+ // We need to ensure the width is a multiple of 4
uint16 wMod = width % 4;
- if(wMod != 0)
+ if (wMod != 0)
width += 4 - wMod;
- debug(2, "QTRLE corrected width: %d", width);
-
_surface = new Graphics::Surface();
- _surface->create(width, height, _bitsPerPixel <= 8 ? Graphics::PixelFormat::createFormatCLUT8() : _pixelFormat);
+ _surface->create(width, height, getPixelFormat());
}
#define CHECK_STREAM_PTR(n) \
if ((stream->pos() + n) > stream->size()) { \
- warning ("Problem: stream out of bounds (%d >= %d)", stream->pos() + n, stream->size()); \
+ warning("QTRLE Problem: stream out of bounds (%d > %d)", stream->pos() + n, stream->size()); \
return; \
}
#define CHECK_PIXEL_PTR(n) \
if ((int32)pixelPtr + n > _surface->w * _surface->h) { \
- warning ("Problem: pixel ptr = %d, pixel limit = %d", pixelPtr + n, _surface->w * _surface->h); \
+ warning("QTRLE Problem: pixel ptr = %d, pixel limit = %d", pixelPtr + n, _surface->w * _surface->h); \
return; \
} \
@@ -132,8 +129,6 @@ void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr,
for (int8 i = numPixels - 1; i >= 0; i--) {
pi[numPixels - 1 - i] = (stream->readByte() >> ((i * bpp) & 0x07)) & ((1 << bpp) - 1);
- // FIXME: Is this right?
- //stream_ptr += ((i & ((num_pixels>>2)-1)) == 0);
if ((i & ((numPixels >> 2) - 1)) == 0)
stream->readByte();
}
@@ -215,7 +210,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, ui
void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) {
uint32 pixelPtr = 0;
- OverlayColor *rgb = (OverlayColor *)_surface->pixels;
+ uint16 *rgb = (uint16 *)_surface->pixels;
while (linesToChange--) {
CHECK_STREAM_PTR(2);
@@ -235,25 +230,15 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, u
CHECK_PIXEL_PTR(rleCode);
- while (rleCode--) {
- // Convert from RGB555 to the format specified by the Overlay
- byte r = 0, g = 0, b = 0;
- Graphics::colorToRGB<Graphics::ColorMasks<555> >(rgb16, r, g, b);
- rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b);
- }
+ while (rleCode--)
+ rgb[pixelPtr++] = rgb16;
} else {
CHECK_STREAM_PTR(rleCode * 2);
CHECK_PIXEL_PTR(rleCode);
// copy pixels directly to output
- while (rleCode--) {
- uint16 rgb16 = stream->readUint16BE();
-
- // Convert from RGB555 to the format specified by the Overlay
- byte r = 0, g = 0, b = 0;
- Graphics::colorToRGB<Graphics::ColorMasks<555> >(rgb16, r, g, b);
- rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b);
- }
+ while (rleCode--)
+ rgb[pixelPtr++] = stream->readUint16BE();
}
}
@@ -263,7 +248,7 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, u
void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) {
uint32 pixelPtr = 0;
- OverlayColor *rgb = (OverlayColor *)_surface->pixels;
+ uint32 *rgb = (uint32 *)_surface->pixels;
while (linesToChange--) {
CHECK_STREAM_PTR(2);
@@ -283,11 +268,12 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u
byte r = stream->readByte();
byte g = stream->readByte();
byte b = stream->readByte();
+ uint32 color = _surface->format.RGBToColor(r, g, b);
CHECK_PIXEL_PTR(rleCode);
while (rleCode--)
- rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b);
+ rgb[pixelPtr++] = color;
} else {
CHECK_STREAM_PTR(rleCode * 3);
CHECK_PIXEL_PTR(rleCode);
@@ -297,7 +283,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u
byte r = stream->readByte();
byte g = stream->readByte();
byte b = stream->readByte();
- rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b);
+ rgb[pixelPtr++] = _surface->format.RGBToColor(r, g, b);
}
}
}
@@ -308,7 +294,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u
void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) {
uint32 pixelPtr = 0;
- OverlayColor *rgb = (OverlayColor *)_surface->pixels;
+ uint32 *rgb = (uint32 *)_surface->pixels;
while (linesToChange--) {
CHECK_STREAM_PTR(2);
@@ -329,11 +315,12 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u
byte r = stream->readByte();
byte g = stream->readByte();
byte b = stream->readByte();
+ uint32 color = _surface->format.ARGBToColor(a, r, g, b);
CHECK_PIXEL_PTR(rleCode);
while (rleCode--)
- rgb[pixelPtr++] = _pixelFormat.ARGBToColor(a, r, g, b);
+ rgb[pixelPtr++] = color;
} else {
CHECK_STREAM_PTR(rleCode * 4);
CHECK_PIXEL_PTR(rleCode);
@@ -344,7 +331,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u
byte r = stream->readByte();
byte g = stream->readByte();
byte b = stream->readByte();
- rgb[pixelPtr++] = _pixelFormat.ARGBToColor(a, r, g, b);
+ rgb[pixelPtr++] = _surface->format.ARGBToColor(a, r, g, b);
}
}
}
@@ -354,7 +341,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u
}
const Graphics::Surface *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) {
- uint16 start_line = 0;
+ uint16 startLine = 0;
uint16 height = _surface->h;
// check if this frame is even supposed to change
@@ -369,44 +356,45 @@ const Graphics::Surface *QTRLEDecoder::decodeImage(Common::SeekableReadStream *s
// if a header is present, fetch additional decoding parameters
if (header & 8) {
- if(stream->size() < 14)
+ if (stream->size() < 14)
return _surface;
- start_line = stream->readUint16BE();
+
+ startLine = stream->readUint16BE();
stream->readUint16BE(); // Unknown
height = stream->readUint16BE();
stream->readUint16BE(); // Unknown
}
- uint32 row_ptr = _surface->w * start_line;
+ uint32 rowPtr = _surface->w * startLine;
switch (_bitsPerPixel) {
- case 1:
- case 33:
- decode1(stream, row_ptr, height);
- break;
- case 2:
- case 34:
- decode2_4(stream, row_ptr, height, 2);
- break;
- case 4:
- case 36:
- decode2_4(stream, row_ptr, height, 4);
- break;
- case 8:
- case 40:
- decode8(stream, row_ptr, height);
- break;
- case 16:
- decode16(stream, row_ptr, height);
- break;
- case 24:
- decode24(stream, row_ptr, height);
- break;
- case 32:
- decode32(stream, row_ptr, height);
- break;
- default:
- error ("Unsupported bits per pixel %d", _bitsPerPixel);
+ case 1:
+ case 33:
+ decode1(stream, rowPtr, height);
+ break;
+ case 2:
+ case 34:
+ decode2_4(stream, rowPtr, height, 2);
+ break;
+ case 4:
+ case 36:
+ decode2_4(stream, rowPtr, height, 4);
+ break;
+ case 8:
+ case 40:
+ decode8(stream, rowPtr, height);
+ break;
+ case 16:
+ decode16(stream, rowPtr, height);
+ break;
+ case 24:
+ decode24(stream, rowPtr, height);
+ break;
+ case 32:
+ decode32(stream, rowPtr, height);
+ break;
+ default:
+ error("Unsupported QTRLE bits per pixel %d", _bitsPerPixel);
}
return _surface;
@@ -417,4 +405,27 @@ QTRLEDecoder::~QTRLEDecoder() {
delete _surface;
}
+Graphics::PixelFormat QTRLEDecoder::getPixelFormat() const {
+ switch (_bitsPerPixel) {
+ case 1:
+ case 33:
+ case 2:
+ case 34:
+ case 4:
+ case 36:
+ case 8:
+ case 40:
+ return Graphics::PixelFormat::createFormatCLUT8();
+ case 16:
+ return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
+ case 24:
+ case 32:
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24);
+ default:
+ error("Unsupported QTRLE bits per pixel %d", _bitsPerPixel);
+ }
+
+ return Graphics::PixelFormat();
+}
+
} // End of namespace Video
diff --git a/video/codecs/qtrle.h b/video/codecs/qtrle.h
index 6f8e113ca5..d9db58ab23 100644
--- a/video/codecs/qtrle.h
+++ b/video/codecs/qtrle.h
@@ -34,13 +34,12 @@ public:
~QTRLEDecoder();
const Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
- Graphics::PixelFormat getPixelFormat() const { return _pixelFormat; }
+ Graphics::PixelFormat getPixelFormat() const;
private:
byte _bitsPerPixel;
Graphics::Surface *_surface;
- Graphics::PixelFormat _pixelFormat;
void decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange);
void decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp);
diff --git a/video/codecs/rpza.cpp b/video/codecs/rpza.cpp
index df5738202e..acc1b7f358 100644
--- a/video/codecs/rpza.cpp
+++ b/video/codecs/rpza.cpp
@@ -28,22 +28,17 @@
#include "common/system.h"
#include "common/stream.h"
#include "common/textconsole.h"
-#include "graphics/colormasks.h"
namespace Video {
RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Codec() {
- _pixelFormat = g_system->getScreenFormat();
-
// We need to increase the surface size to a multiple of 4
uint16 wMod = width % 4;
- if(wMod != 0)
+ if (wMod != 0)
width += 4 - wMod;
- debug(2, "RPZA corrected width: %d", width);
-
_surface = new Graphics::Surface();
- _surface->create(width, height, _pixelFormat);
+ _surface->create(width, height, getPixelFormat());
}
RPZADecoder::~RPZADecoder() {
@@ -59,18 +54,11 @@ RPZADecoder::~RPZADecoder() {
} \
totalBlocks--; \
if (totalBlocks < 0) \
- error("block counter just went negative (this should not happen)") \
+ error("rpza block counter just went negative (this should not happen)") \
-// Convert from RGB555 to the format specified by the screen
#define PUT_PIXEL(color) \
- if ((int32)blockPtr < _surface->w * _surface->h) { \
- byte r = 0, g = 0, b = 0; \
- Graphics::colorToRGB<Graphics::ColorMasks<555> >(color, r, g, b); \
- if (_pixelFormat.bytesPerPixel == 2) \
- *((uint16 *)_surface->pixels + blockPtr) = _pixelFormat.RGBToColor(r, g, b); \
- else \
- *((uint32 *)_surface->pixels + blockPtr) = _pixelFormat.RGBToColor(r, g, b); \
- } \
+ if ((int32)blockPtr < _surface->w * _surface->h) \
+ WRITE_UINT16((uint16 *)_surface->pixels + blockPtr, color); \
blockPtr++
const Graphics::Surface *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) {
diff --git a/video/codecs/rpza.h b/video/codecs/rpza.h
index 809a69f444..f082d25549 100644
--- a/video/codecs/rpza.h
+++ b/video/codecs/rpza.h
@@ -34,11 +34,10 @@ public:
~RPZADecoder();
const Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
- Graphics::PixelFormat getPixelFormat() const { return _pixelFormat; }
+ Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); }
private:
Graphics::Surface *_surface;
- Graphics::PixelFormat _pixelFormat;
};
} // End of namespace Video
diff --git a/video/codecs/svq1.cpp b/video/codecs/svq1.cpp
new file mode 100644
index 0000000000..56b376f590
--- /dev/null
+++ b/video/codecs/svq1.cpp
@@ -0,0 +1,797 @@
+/* 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.
+ *
+ */
+
+// Sorenson Video 1 Codec
+// Based off FFmpeg's SVQ1 decoder (written by Arpi and Nick Kurshev)
+
+#include "video/codecs/svq1.h"
+#include "video/codecs/svq1_cb.h"
+#include "video/codecs/svq1_vlc.h"
+
+#include "common/stream.h"
+#include "common/bitstream.h"
+#include "common/rect.h"
+#include "common/system.h"
+#include "common/debug.h"
+#include "common/textconsole.h"
+#include "common/huffman.h"
+
+#include "graphics/yuv_to_rgb.h"
+
+namespace Video {
+
+#define SVQ1_BLOCK_SKIP 0
+#define SVQ1_BLOCK_INTER 1
+#define SVQ1_BLOCK_INTER_4V 2
+#define SVQ1_BLOCK_INTRA 3
+
+SVQ1Decoder::SVQ1Decoder(uint16 width, uint16 height) {
+ debug(1, "SVQ1Decoder::SVQ1Decoder(width:%d, height:%d)", width, height);
+ _width = width;
+ _height = height;
+ _frameWidth = _frameHeight = 0;
+ _surface = 0;
+
+ _last[0] = 0;
+ _last[1] = 0;
+ _last[2] = 0;
+
+ // Setup Variable Length Code Tables
+ _blockType = new Common::Huffman(0, 4, s_svq1BlockTypeCodes, s_svq1BlockTypeLengths);
+
+ for (int i = 0; i < 6; i++) {
+ _intraMultistage[i] = new Common::Huffman(0, 8, s_svq1IntraMultistageCodes[i], s_svq1IntraMultistageLengths[i]);
+ _interMultistage[i] = new Common::Huffman(0, 8, s_svq1InterMultistageCodes[i], s_svq1InterMultistageLengths[i]);
+ }
+
+ _intraMean = new Common::Huffman(0, 256, s_svq1IntraMeanCodes, s_svq1IntraMeanLengths);
+ _interMean = new Common::Huffman(0, 512, s_svq1InterMeanCodes, s_svq1InterMeanLengths);
+ _motionComponent = new Common::Huffman(0, 33, s_svq1MotionComponentCodes, s_svq1MotionComponentLengths);
+}
+
+SVQ1Decoder::~SVQ1Decoder() {
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ }
+
+ delete[] _last[0];
+ delete[] _last[1];
+ delete[] _last[2];
+
+ delete _blockType;
+ delete _intraMean;
+ delete _interMean;
+ delete _motionComponent;
+
+ for (int i = 0; i < 6; i++) {
+ delete _intraMultistage[i];
+ delete _interMultistage[i];
+ }
+}
+
+#define ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
+
+const Graphics::Surface *SVQ1Decoder::decodeImage(Common::SeekableReadStream *stream) {
+ debug(1, "SVQ1Decoder::decodeImage()");
+
+ Common::BitStream32BEMSB frameData(*stream);
+
+ uint32 frameCode = frameData.getBits(22);
+ debug(1, " frameCode: %d", frameCode);
+
+ if ((frameCode & ~0x70) || !(frameCode & 0x60)) { // Invalid
+ warning("Invalid Image at frameCode");
+ return _surface;
+ }
+
+ byte temporalReference = frameData.getBits(8);
+ debug(1, " temporalReference: %d", temporalReference);
+ static const char *const types[4] = { "I (Key)", "P (Delta from Previous)", "B (Delta from Next)", "Invalid" };
+ byte frameType = frameData.getBits(2);
+ debug(1, " frameType: %d = %s Frame", frameType, types[frameType]);
+
+ if (frameType == 0) { // I Frame
+ // TODO: Validate checksum if present
+ if (frameCode == 0x50 || frameCode == 0x60) {
+ uint32 checksum = frameData.getBits(16);
+ debug(1, " checksum:0x%02x", checksum);
+ // We're currently just ignoring the checksum
+ }
+
+ if ((frameCode ^ 0x10) >= 0x50) {
+ // Skip embedded string
+ byte stringLen = frameData.getBits(8);
+ for (uint16 i = 0; i < stringLen-1; i++)
+ frameData.skip(8);
+ }
+
+ frameData.skip(5); // Unknown
+
+ static const struct { uint w, h; } standardFrameSizes[7] = {
+ { 160, 120 }, // 0
+ { 128, 96 }, // 1
+ { 176, 144 }, // 2
+ { 352, 288 }, // 3
+ { 704, 576 }, // 4
+ { 240, 180 }, // 5
+ { 320, 240 } // 6
+ };
+
+ byte frameSizeCode = frameData.getBits(3);
+ debug(1, " frameSizeCode: %d", frameSizeCode);
+
+ if (frameSizeCode == 7) {
+ _frameWidth = frameData.getBits(12);
+ _frameHeight = frameData.getBits(12);
+ } else {
+ _frameWidth = standardFrameSizes[frameSizeCode].w;
+ _frameHeight = standardFrameSizes[frameSizeCode].h;
+ }
+
+ debug(1, " frameWidth: %d", _frameWidth);
+ debug(1, " frameHeight: %d", _frameHeight);
+ } else if (frameType == 2) { // B Frame
+ warning("B Frames not supported by SVQ1 decoder (yet)");
+ return _surface;
+ } else if (frameType == 3) { // Invalid
+ warning("Invalid Frame Type");
+ return _surface;
+ }
+
+ bool checksumPresent = frameData.getBit() != 0;
+ debug(1, " checksumPresent: %d", checksumPresent);
+ if (checksumPresent) {
+ bool usePacketChecksum = frameData.getBit() != 0;
+ debug(1, " usePacketChecksum: %d", usePacketChecksum);
+ bool componentChecksumsAfterImageData = frameData.getBit() != 0;
+ debug(1, " componentChecksumsAfterImageData: %d", componentChecksumsAfterImageData);
+ byte unk4 = frameData.getBits(2);
+ debug(1, " unk4: %d", unk4);
+ if (unk4 != 0)
+ warning("Invalid Frame Header in SVQ1 Frame Decode");
+ }
+
+ // Some more unknown data
+ bool unk5 = frameData.getBit() != 0;
+ if (unk5) {
+ frameData.skip(8);
+
+ while (frameData.getBit() != 0)
+ frameData.skip(8);
+ }
+
+ uint yWidth = ALIGN(_frameWidth, 16);
+ uint yHeight = ALIGN(_frameHeight, 16);
+ uint uvWidth = ALIGN(yWidth / 4, 16);
+ uint uvHeight = ALIGN(yHeight / 4, 16);
+ uint uvPitch = uvWidth + 4; // we need at least one extra column and pitch must be divisible by 4
+
+ byte *current[3];
+
+ // Decode Y, U and V component planes
+ for (int i = 0; i < 3; i++) {
+ uint width, height, pitch;
+ if (i == 0) {
+ width = yWidth;
+ height = yHeight;
+ pitch = width;
+ current[i] = new byte[width * height];
+ } else {
+ width = uvWidth;
+ height = uvHeight;
+ pitch = uvPitch;
+
+ // Add an extra row here. See below for more information.
+ current[i] = new byte[pitch * (height + 1)];
+ }
+
+ if (frameType == 0) { // I Frame
+ // Keyframe (I)
+ byte *currentP = current[i];
+ for (uint16 y = 0; y < height; y += 16) {
+ for (uint16 x = 0; x < width; x += 16) {
+ if (!svq1DecodeBlockIntra(&frameData, &currentP[x], pitch)) {
+ warning("svq1DecodeBlockIntra decode failure");
+ return _surface;
+ }
+ }
+ currentP += 16 * pitch;
+ }
+ } else {
+ // Delta frame (P or B)
+
+ // Prediction Motion Vector
+ Common::Point *pmv = new Common::Point[(width / 8) + 3];
+
+ byte *previous;
+ if (frameType == 2) { // B Frame
+ warning("B Frame not supported currently");
+ //previous = _next[i];
+ } else {
+ previous = _last[i];
+ }
+
+ byte *currentP = current[i];
+ for (uint16 y = 0; y < height; y += 16) {
+ for (uint16 x = 0; x < width; x += 16) {
+ if (!svq1DecodeDeltaBlock(&frameData, &currentP[x], previous, pitch, pmv, x, y)) {
+ warning("svq1DecodeDeltaBlock decode failure");
+ return _surface;
+ }
+ }
+
+ pmv[0].x = pmv[0].y = 0;
+
+ currentP += 16 * pitch;
+ }
+
+ delete[] pmv;
+ }
+ }
+
+ // Now we'll create the surface
+ if (!_surface) {
+ _surface = new Graphics::Surface();
+ _surface->create(yWidth, yHeight, g_system->getScreenFormat());
+ _surface->w = _width;
+ _surface->h = _height;
+ }
+
+ // We need to massage the chrominance data a bit to be able to be used by the converter
+ // Since the thing peeks at values one column and one row beyond the data, we need to fill it in
+
+ // First, fill in the column-after-last with the last column's value
+ for (uint i = 0; i < uvHeight; i++) {
+ current[1][i * uvPitch + uvWidth] = current[1][i * uvPitch + uvWidth - 1];
+ current[2][i * uvPitch + uvWidth] = current[2][i * uvPitch + uvWidth - 1];
+ }
+
+ // Then, copy the last row to the one after the last row
+ memcpy(current[1] + uvHeight * uvPitch, current[1] + (uvHeight - 1) * uvPitch, uvWidth + 1);
+ memcpy(current[2] + uvHeight * uvPitch, current[2] + (uvHeight - 1) * uvPitch, uvWidth + 1);
+
+ // Finally, actually do the conversion ;)
+ YUVToRGBMan.convert410(_surface, Graphics::YUVToRGBManager::kScaleFull, current[0], current[1], current[2], yWidth, yHeight, yWidth, uvPitch);
+
+ // Store the current surfaces for later and free the old ones
+ for (int i = 0; i < 3; i++) {
+ delete[] _last[i];
+ _last[i] = current[i];
+ }
+
+ return _surface;
+}
+
+bool SVQ1Decoder::svq1DecodeBlockIntra(Common::BitStream *s, byte *pixels, int pitch) {
+ // initialize list for breadth first processing of vectors
+ byte *list[63];
+ list[0] = pixels;
+
+ // recursively process vector
+ for (int i = 0, m = 1, n = 1, level = 5; i < n; i++) {
+ for (; level > 0; i++) {
+ // process next depth
+ if (i == m) {
+ m = n;
+ if (--level == 0)
+ break;
+ }
+
+ // divide block if next bit set
+ if (s->getBit() == 0)
+ break;
+
+ // add child nodes
+ list[n++] = list[i];
+ list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1));
+ }
+
+ // destination address and vector size
+ uint32 *dst = (uint32 *)list[i];
+ uint width = 1 << ((level + 4) / 2);
+ uint height = 1 << ((level + 3) / 2);
+
+ // get number of stages (-1 skips vector, 0 for mean only)
+ int stages = _intraMultistage[level]->getSymbol(*s) - 1;
+
+ if (stages == -1) {
+ for (uint y = 0; y < height; y++)
+ memset(&dst[y * (pitch / 4)], 0, width);
+
+ continue; // skip vector
+ }
+
+ if (stages > 0 && level >= 4) {
+ warning("Error (svq1_decode_block_intra): invalid vector: stages = %d, level = %d", stages, level);
+ return false; // error - invalid vector
+ }
+
+ int mean = _intraMean->getSymbol(*s);
+
+ if (stages == 0) {
+ for (uint y = 0; y < height; y++)
+ memset(&dst[y * (pitch / 4)], mean, width);
+ } else {
+ const uint32 *codebook = (const uint32 *)s_svq1IntraCodebooks[level];
+ uint32 bitCache = s->getBits(stages * 4);
+
+ // calculate codebook entries for this vector
+ int entries[6];
+ for (int j = 0; j < stages; j++)
+ entries[j] = (((bitCache >> ((stages - j - 1) * 4)) & 0xF) + j * 16) << (level + 1);
+
+ mean -= stages * 128;
+ uint32 n4 = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF);
+
+ for (uint y = 0; y < height; y++) {
+ for (uint x = 0; x < (width / 4); x++, codebook++) {
+ uint32 n1 = n4;
+ uint32 n2 = n4;
+ uint32 n3;
+
+ // add codebook entries to vector
+ for (int j = 0; j < stages; j++) {
+ n3 = READ_UINT32(&codebook[entries[j]]) ^ 0x80808080;
+ n1 += (n3 & 0xFF00FF00) >> 8;
+ n2 += n3 & 0x00FF00FF;
+ }
+
+ // clip to [0..255]
+ if (n1 & 0xFF00FF00) {
+ n3 = (((n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n1 += 0x7F007F00;
+ n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n1 &= n3 & 0x00FF00FF;
+ }
+
+ if (n2 & 0xFF00FF00) {
+ n3 = (((n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n2 += 0x7F007F00;
+ n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n2 &= n3 & 0x00FF00FF;
+ }
+
+ // store result
+ dst[x] = (n1 << 8) | n2;
+ }
+
+ dst += pitch / 4;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool SVQ1Decoder::svq1DecodeBlockNonIntra(Common::BitStream *s, byte *pixels, int pitch) {
+ // initialize list for breadth first processing of vectors
+ byte *list[63];
+ list[0] = pixels;
+
+ // recursively process vector
+ for (int i = 0, m = 1, n = 1, level = 5; i < n; i++) {
+ for (; level > 0; i++) {
+ // process next depth
+ if (i == m) {
+ m = n;
+ if (--level == 0)
+ break;
+ }
+
+ // divide block if next bit set
+ if (s->getBit() == 0)
+ break;
+
+ // add child nodes
+ list[n++] = list[i];
+ list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1));
+ }
+
+ // destination address and vector size
+ uint32 *dst = (uint32 *)list[i];
+ int width = 1 << ((level + 4) / 2);
+ int height = 1 << ((level + 3) / 2);
+
+ // get number of stages (-1 skips vector, 0 for mean only)
+ int stages = _interMultistage[level]->getSymbol(*s) - 1;
+
+ if (stages == -1)
+ continue; // skip vector
+
+ if (stages > 0 && level >= 4) {
+ warning("Error (svq1_decode_block_non_intra): invalid vector: stages = %d, level = %d", stages, level);
+ return false; // error - invalid vector
+ }
+
+ int mean = _interMean->getSymbol(*s) - 256;
+ const uint32 *codebook = (const uint32 *)s_svq1InterCodebooks[level];
+ uint32 bitCache = s->getBits(stages * 4);
+
+ // calculate codebook entries for this vector
+ int entries[6];
+ for (int j = 0; j < stages; j++)
+ entries[j] = (((bitCache >> ((stages - j - 1) * 4)) & 0xF) + j * 16) << (level + 1);
+
+ mean -= stages * 128;
+ uint32 n4 = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF);
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < (width / 4); x++, codebook++) {
+ uint32 n3 = dst[x];
+
+ // add mean value to vector
+ uint32 n1 = ((n3 & 0xFF00FF00) >> 8) + n4;
+ uint32 n2 = (n3 & 0x00FF00FF) + n4;
+
+ // add codebook entries to vector
+ for (int j = 0; j < stages; j++) {
+ n3 = READ_UINT32(&codebook[entries[j]]) ^ 0x80808080;
+ n1 += (n3 & 0xFF00FF00) >> 8;
+ n2 += n3 & 0x00FF00FF;
+ }
+
+ // clip to [0..255]
+ if (n1 & 0xFF00FF00) {
+ n3 = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n1 += 0x7F007F00;
+ n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n1 &= n3 & 0x00FF00FF;
+ }
+
+ if (n2 & 0xFF00FF00) {
+ n3 = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n2 += 0x7F007F00;
+ n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;
+ n2 &= n3 & 0x00FF00FF;
+ }
+
+ // store result
+ dst[x] = (n1 << 8) | n2;
+ }
+
+ dst += pitch / 4;
+ }
+ }
+
+ return true;
+}
+
+// median of 3
+static inline int midPred(int a, int b, int c) {
+ if (a > b) {
+ if (c > b) {
+ if (c > a)
+ b = a;
+ else
+ b = c;
+ }
+ } else {
+ if (b > c) {
+ if (c > a)
+ b = c;
+ else
+ b = a;
+ }
+ }
+
+ return b;
+}
+
+bool SVQ1Decoder::svq1DecodeMotionVector(Common::BitStream *s, Common::Point *mv, Common::Point **pmv) {
+ for (int i = 0; i < 2; i++) {
+ // get motion code
+ int diff = _motionComponent->getSymbol(*s);
+ if (diff < 0)
+ return false; // error - invalid motion code
+ else if (diff && s->getBit() != 0)
+ diff = -diff;
+
+ // add median of motion vector predictors and clip result
+ if (i == 1)
+ mv->y = ((diff + midPred(pmv[0]->y, pmv[1]->y, pmv[2]->y)) << 26) >> 26;
+ else
+ mv->x = ((diff + midPred(pmv[0]->x, pmv[1]->x, pmv[2]->x)) << 26) >> 26;
+ }
+
+ return true;
+}
+
+void SVQ1Decoder::svq1SkipBlock(byte *current, byte *previous, int pitch, int x, int y) {
+ const byte *src = &previous[x + y * pitch];
+ byte *dst = current;
+
+ for (int i = 0; i < 16; i++) {
+ memcpy(dst, src, 16);
+ src += pitch;
+ dst += pitch;
+ }
+}
+
+void SVQ1Decoder::putPixels8C(byte *block, const byte *pixels, int lineSize, int h) {
+ for (int i = 0; i < h; i++) {
+ *((uint32 *)block) = READ_UINT32(pixels);
+ *((uint32 *)(block + 4)) = READ_UINT32(pixels + 4);
+ pixels += lineSize;
+ block += lineSize;
+ }
+}
+
+static inline uint32 rndAvg32(uint32 a, uint32 b) {
+ return (a | b) - (((a ^ b) & ~0x01010101) >> 1);
+}
+
+void SVQ1Decoder::putPixels8L2(byte *dst, const byte *src1, const byte *src2,
+ int dstStride, int srcStride1, int srcStride2, int h) {
+ for (int i = 0; i < h; i++) {
+ uint32 a = READ_UINT32(&src1[srcStride1 * i]);
+ uint32 b = READ_UINT32(&src2[srcStride2 * i]);
+ *((uint32 *)&dst[dstStride * i]) = rndAvg32(a, b);
+ a = READ_UINT32(&src1[srcStride1 * i + 4]);
+ b = READ_UINT32(&src2[srcStride2 * i + 4]);
+ *((uint32 *)&dst[dstStride * i + 4]) = rndAvg32(a, b);
+ }
+}
+
+void SVQ1Decoder::putPixels8X2C(byte *block, const byte *pixels, int lineSize, int h) {
+ putPixels8L2(block, pixels, pixels + 1, lineSize, lineSize, lineSize, h);
+}
+
+void SVQ1Decoder::putPixels8Y2C(byte *block, const byte *pixels, int lineSize, int h) {
+ putPixels8L2(block, pixels, pixels + lineSize, lineSize, lineSize, lineSize, h);
+}
+
+void SVQ1Decoder::putPixels8XY2C(byte *block, const byte *pixels, int lineSize, int h) {
+ for (int j = 0; j < 2; j++) {
+ uint32 a = READ_UINT32(pixels);
+ uint32 b = READ_UINT32(pixels + 1);
+ uint32 l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL;
+ uint32 h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);
+
+ pixels += lineSize;
+
+ for (int i = 0; i < h; i += 2) {
+ a = READ_UINT32(pixels);
+ b = READ_UINT32(pixels + 1);
+ uint32 l1 = (a & 0x03030303UL) + (b & 0x03030303UL);
+ uint32 h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);
+ *((uint32 *)block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL);
+ pixels += lineSize;
+ block += lineSize;
+ a = READ_UINT32(pixels);
+ b = READ_UINT32(pixels + 1);
+ l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL;
+ h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);
+ *((uint32 *)block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL);
+ pixels += lineSize;
+ block += lineSize;
+ }
+
+ pixels += 4 - lineSize * (h + 1);
+ block += 4 - lineSize * h;
+ }
+}
+
+void SVQ1Decoder::putPixels16C(byte *block, const byte *pixels, int lineSize, int h) {
+ putPixels8C(block, pixels, lineSize, h);
+ putPixels8C(block + 8, pixels + 8, lineSize, h);
+}
+
+void SVQ1Decoder::putPixels16X2C(byte *block, const byte *pixels, int lineSize, int h) {
+ putPixels8X2C(block, pixels, lineSize, h);
+ putPixels8X2C(block + 8, pixels + 8, lineSize, h);
+}
+
+void SVQ1Decoder::putPixels16Y2C(byte *block, const byte *pixels, int lineSize, int h) {
+ putPixels8Y2C(block, pixels, lineSize, h);
+ putPixels8Y2C(block + 8, pixels + 8, lineSize, h);
+}
+
+void SVQ1Decoder::putPixels16XY2C(byte *block, const byte *pixels, int lineSize, int h) {
+ putPixels8XY2C(block, pixels, lineSize, h);
+ putPixels8XY2C(block + 8, pixels + 8, lineSize, h);
+}
+
+bool SVQ1Decoder::svq1MotionInterBlock(Common::BitStream *ss, byte *current, byte *previous, int pitch,
+ Common::Point *motion, int x, int y) {
+
+ // predict and decode motion vector
+ Common::Point *pmv[3];
+ pmv[0] = &motion[0];
+ if (y == 0) {
+ pmv[1] = pmv[2] = pmv[0];
+ } else {
+ pmv[1] = &motion[(x / 8) + 2];
+ pmv[2] = &motion[(x / 8) + 4];
+ }
+
+ Common::Point mv;
+ bool resultValid = svq1DecodeMotionVector(ss, &mv, pmv);
+ if (!resultValid)
+ return false;
+
+ motion[0].x = motion[(x / 8) + 2].x = motion[(x / 8) + 3].x = mv.x;
+ motion[0].y = motion[(x / 8) + 2].y = motion[(x / 8) + 3].y = mv.y;
+
+ if (y + (mv.y >> 1) < 0)
+ mv.y = 0;
+
+ if (x + (mv.x >> 1) < 0)
+ mv.x = 0;
+
+ const byte *src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1)) * pitch];
+ byte *dst = current;
+
+ // Halfpel motion compensation with rounding (a + b + 1) >> 1.
+ // 4 motion compensation functions for the 4 halfpel positions
+ // for 16x16 blocks
+ switch(((mv.y & 1) << 1) + (mv.x & 1)) {
+ case 0:
+ putPixels16C(dst, src, pitch, 16);
+ break;
+ case 1:
+ putPixels16X2C(dst, src, pitch, 16);
+ break;
+ case 2:
+ putPixels16Y2C(dst, src, pitch, 16);
+ break;
+ case 3:
+ putPixels16XY2C(dst, src, pitch, 16);
+ break;
+ }
+
+ return true;
+}
+
+bool SVQ1Decoder::svq1MotionInter4vBlock(Common::BitStream *ss, byte *current, byte *previous, int pitch,
+ Common::Point *motion, int x, int y) {
+ // predict and decode motion vector (0)
+ Common::Point *pmv[4];
+ pmv[0] = &motion[0];
+ if (y == 0) {
+ pmv[1] = pmv[2] = pmv[0];
+ } else {
+ pmv[1] = &motion[(x / 8) + 2];
+ pmv[2] = &motion[(x / 8) + 4];
+ }
+
+ Common::Point mv;
+ bool resultValid = svq1DecodeMotionVector(ss, &mv, pmv);
+ if (!resultValid)
+ return false;
+
+ // predict and decode motion vector (1)
+ pmv[0] = &mv;
+ if (y == 0)
+ pmv[1] = pmv[2] = pmv[0];
+ else
+ pmv[1] = &motion[(x / 8) + 3];
+
+ resultValid = svq1DecodeMotionVector(ss, &motion[0], pmv);
+ if (!resultValid)
+ return false;
+
+ // predict and decode motion vector (2)
+ pmv[1] = &motion[0];
+ pmv[2] = &motion[(x / 8) + 1];
+
+ resultValid = svq1DecodeMotionVector(ss, &motion[(x / 8) + 2], pmv);
+ if (!resultValid)
+ return false;
+
+ // predict and decode motion vector (3)
+ pmv[2] = &motion[(x / 8) + 2];
+ pmv[3] = &motion[(x / 8) + 3];
+
+ resultValid = svq1DecodeMotionVector(ss, pmv[3], pmv);
+ if (!resultValid)
+ return false;
+
+ // form predictions
+ for (int i = 0; i < 4; i++) {
+ int mvx = pmv[i]->x + (i & 1) * 16;
+ int mvy = pmv[i]->y + (i >> 1) * 16;
+
+ // FIXME: clipping or padding?
+ if (y + (mvy >> 1) < 0)
+ mvy = 0;
+
+ if (x + (mvx >> 1) < 0)
+ mvx = 0;
+
+ const byte *src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1)) * pitch];
+ byte *dst = current;
+
+ // Halfpel motion compensation with rounding (a + b + 1) >> 1.
+ // 4 motion compensation functions for the 4 halfpel positions
+ // for 8x8 blocks
+ switch(((mvy & 1) << 1) + (mvx & 1)) {
+ case 0:
+ putPixels8C(dst, src, pitch, 8);
+ break;
+ case 1:
+ putPixels8X2C(dst, src, pitch, 8);
+ break;
+ case 2:
+ putPixels8Y2C(dst, src, pitch, 8);
+ break;
+ case 3:
+ putPixels8XY2C(dst, src, pitch, 8);
+ break;
+ }
+
+ // select next block
+ if (i & 1)
+ current += (pitch - 1) * 8;
+ else
+ current += 8;
+ }
+
+ return true;
+}
+
+bool SVQ1Decoder::svq1DecodeDeltaBlock(Common::BitStream *ss, byte *current, byte *previous, int pitch,
+ Common::Point *motion, int x, int y) {
+ // get block type
+ uint32 blockType = _blockType->getSymbol(*ss);
+
+ // reset motion vectors
+ if (blockType == SVQ1_BLOCK_SKIP || blockType == SVQ1_BLOCK_INTRA) {
+ motion[0].x =
+ motion[0].y =
+ motion[(x / 8) + 2].x =
+ motion[(x / 8) + 2].y =
+ motion[(x / 8) + 3].x =
+ motion[(x / 8) + 3].y = 0;
+ }
+
+ bool resultValid = true;
+
+ switch (blockType) {
+ case SVQ1_BLOCK_SKIP:
+ svq1SkipBlock(current, previous, pitch, x, y);
+ break;
+ case SVQ1_BLOCK_INTER:
+ resultValid = svq1MotionInterBlock(ss, current, previous, pitch, motion, x, y);
+ if (!resultValid) {
+ warning("svq1MotionInterBlock decode failure");
+ break;
+ }
+ resultValid = svq1DecodeBlockNonIntra(ss, current, pitch);
+ break;
+ case SVQ1_BLOCK_INTER_4V:
+ resultValid = svq1MotionInter4vBlock(ss, current, previous, pitch, motion, x, y);
+ if (!resultValid) {
+ warning("svq1MotionInter4vBlock decode failure");
+ break;
+ }
+ resultValid = svq1DecodeBlockNonIntra(ss, current, pitch);
+ break;
+ case SVQ1_BLOCK_INTRA:
+ resultValid = svq1DecodeBlockIntra(ss, current, pitch);
+ break;
+ }
+
+ return resultValid;
+}
+
+} // End of namespace Video
diff --git a/video/codecs/svq1.h b/video/codecs/svq1.h
new file mode 100644
index 0000000000..e5066abfd4
--- /dev/null
+++ b/video/codecs/svq1.h
@@ -0,0 +1,82 @@
+/* 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 VIDEO_CODECS_SVQ1_H
+#define VIDEO_CODECS_SVQ1_H
+
+#include "video/codecs/codec.h"
+
+namespace Common {
+class BitStream;
+class Huffman;
+struct Point;
+}
+
+namespace Video {
+
+class SVQ1Decoder : public Codec {
+public:
+ SVQ1Decoder(uint16 width, uint16 height);
+ ~SVQ1Decoder();
+
+ const Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
+ Graphics::PixelFormat getPixelFormat() const { return _surface->format; }
+
+private:
+ Graphics::Surface *_surface;
+ uint16 _width, _height;
+ uint16 _frameWidth, _frameHeight;
+
+ byte *_last[3];
+
+ Common::Huffman *_blockType;
+ Common::Huffman *_intraMultistage[6];
+ Common::Huffman *_interMultistage[6];
+ Common::Huffman *_intraMean;
+ Common::Huffman *_interMean;
+ Common::Huffman *_motionComponent;
+
+ bool svq1DecodeBlockIntra(Common::BitStream *s, byte *pixels, int pitch);
+ bool svq1DecodeBlockNonIntra(Common::BitStream *s, byte *pixels, int pitch);
+ bool svq1DecodeMotionVector(Common::BitStream *s, Common::Point *mv, Common::Point **pmv);
+ void svq1SkipBlock(byte *current, byte *previous, int pitch, int x, int y);
+ bool svq1MotionInterBlock(Common::BitStream *ss, byte *current, byte *previous, int pitch,
+ Common::Point *motion, int x, int y);
+ bool svq1MotionInter4vBlock(Common::BitStream *ss, byte *current, byte *previous, int pitch,
+ Common::Point *motion, int x, int y);
+ bool svq1DecodeDeltaBlock(Common::BitStream *ss, byte *current, byte *previous, int pitch,
+ Common::Point *motion, int x, int y);
+
+ void putPixels8C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels8L2(byte *dst, const byte *src1, const byte *src2, int dstStride, int srcStride1, int srcStride2, int h);
+ void putPixels8X2C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels8Y2C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels8XY2C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels16C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels16X2C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels16Y2C(byte *block, const byte *pixels, int lineSize, int h);
+ void putPixels16XY2C(byte *block, const byte *pixels, int lineSize, int h);
+};
+
+} // End of namespace Video
+
+#endif
diff --git a/video/codecs/svq1_cb.h b/video/codecs/svq1_cb.h
new file mode 100644
index 0000000000..8281b3fc28
--- /dev/null
+++ b/video/codecs/svq1_cb.h
@@ -0,0 +1,1511 @@
+/* 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.
+ *
+ */
+
+// These tables are modified from their FFmpeg counterparts so that
+// they work on both little and big endian systems.
+
+#ifndef VIDEO_CODECS_SVQ1_CB_H
+#define VIDEO_CODECS_SVQ1_CB_H
+
+#include "common/scummsys.h"
+
+namespace Video {
+
+static const int8 s_svq1InterCodebook4x2[768] = {
+ 7, 2, -6, -7, 7, 3, -3, -4, -7, -2, 7, 8, -8, -4, 3, 4,
+ 19, 17, 9, 3,-14,-16,-12, -8,-18,-16, -8, -3, 11, 14, 12, 8,
+ 7,-16,-10, 20, 7,-17,-10, 20, -6, 18, 8,-21, -7, 18, 9,-20,
+ 25, 3,-20,-14, 29, 7,-18,-13,-29, -4, 21, 14,-31, -6, 20, 14,
+ -19,-26,-28,-24, 31, 32, 22, 10, 15, 24, 31, 28,-32,-32,-22,-13,
+ 2, -8,-23,-26, -9, 3, 27, 35, 3, 11, 21, 21, 8, -4,-27,-34,
+ -30,-31, 12, 47,-29,-30, 13, 47, 38, 30,-17,-46, 34, 26,-19,-46,
+ -42,-50,-51,-43, 34, 48, 55, 48, 48, 54, 51, 42,-44,-52,-53,-47,
+ 4, 5, 0, -6, -2, -2, 0, 1,-11, -6, -1, -2, 1, 8, 9, 1,
+ 0, 1, -6, 5, 8, 1,-12, 2, 7,-14, -7, 8, 5, -8, 0, 8,
+ 1, 4, 11, 8,-12, -8, 0, -5, -1, 1, 0, 4,-15, -8, 3, 16,
+ 17, 8, -4, -6, 9, -4,-13, -8, 2, 6, 1,-18, -1, 11, 11,-12,
+ 6, 0, 2, 0, 14, 6, -7,-21, 1, -1,-13,-20, 1, 1, 10, 21,
+ -22, -5, 7, 13,-11, -1, 4, 12, -7, 0, 14, 19, -4, 3, -5,-19,
+ -26,-14, 10, 15, 18, 4, -6, -2, 25, 19, -5,-18,-20, -7, 4, 2,
+ -13, -6, -1, -4, 25, 37, -2,-35, 5, 4, 1, 1,-21,-36, 2, 43,
+ 2, -2, -1, 3, 8, -2, -6, -1, -2, -3, 2, 12, -5, -2, -2, -1,
+ -3, -1, -1, -5, -1, 7, 8, -2, 2, 7, 5, -3, 1, 1, -3, -8,
+ -3, -1, -3, -2, -2, -3, 2, 13, 15, 0,-11, -6, 3, 0, 0, 0,
+ -6, -9, -5, -4, 18, 4, 1, 3, 12, 3, 0, 4,-16, -3, 3, -3,
+ -17, 3, 18, 2, -1, -3, -1, -1, -6, 16, -8, 0, -9, 14, -7, 0,
+ 3,-13, 14, -5, 3,-13, 14, -4, -7, 20, 14,-23, 8, -7, -8, 4,
+ 8,-15,-19, 16,-10, 13, 11, -3, 9, -1, 1, 26, 5,-15,-27, 2,
+ -20, 7, 16, -4,-40, 9, 31, 1, 26,-12,-30, -7, 40, -2,-19, 4,
+ 6, 0, 0, 0, -6, -2, 1, 2, 0, -1, 0, -6, 9, 0, -2, -1,
+ -7, 8, 2, -3, -1, 2, -3, 2, 7, -4, -2, 4, 2, 0, 0, -6,
+ -3, -2, 9, 2, -2, -1, 0, -4, -3, -3, 0, -3, -6, 2, 10, 4,
+ 3, 0,-10, 8, 0, 0, -4, 4, -1, 1, 4, 2, 3, -7, -9, 7,
+ 2, 1, -9, -4, -1, 12, 0, 0, 3, -1, 7, -4, 3,-14, 4, 2,
+ -12, -9, 1, 11, 2, 5, 1, 0, 3, 1, 0, 2, 0, 8, 6,-19,
+ -6,-10, -7, -4, 9, 7, 5, 7, 6, 21, 3, -3,-11, -9, -5, -2,
+ -4, -9,-16, -1, -2, -5, 1, 36, 8, 11, 19, 0, 2, 5, -4,-41,
+ -1, -1, -2, -1, -2, -2, 1, 6, 0, 4, 1, -8, 1, 1, 1, 0,
+ -2, -3, 4, 0, 2, -1, 3, -3, 1, 3, -4, 1, -1, 3, 0, -5,
+ 3, 4, 2, 3, -2, -3, -6, -1, -2, -3, -2, 2, -4, 8, 1, 0,
+ -7, 4, 2, 6, -7, -1, 1, 0, -2, 2, -4, 1, 8, -6, 2, -1,
+ -6, 2, 0, 2, 5, 4, -8, -1, -1,-11, 0, 9, 0, -2, 2, 2,
+ 17, -5, -4, -1, -1, -4, -2, -2, 0,-13, 9, -3, -1, 12, -7, 2,
+ 0, -2, -5, 2, -7, -5, 20, -3, 7, 7, -1,-30, 3, 5, 8, 1,
+ -6, 3, -1, -4, 2, -2,-11, 18, 0, -7, 3, 14, 20, -3,-18, -9,
+ 7, -2, 0, -1, -2, 0, 0, -1, -4, -1, 1, 0, -2, 2, 0, 4,
+ 1, -3, 2, 1, 3, 1, -5, 1, -3, 0, -1, -2, 7, 1, 0, -3,
+ 2, 5, 0, -2, 2, -5, -1, 1, -1, -2, 4, -1, 0, -3, 5, 0,
+ 0, 3, -1, -2, -4, 1, 5, -1, -1, 0, -1, 9, -1, -2, -1, -1,
+ -2, 5, 5, -1, -2, 2, -3, -2, 1, 2,-11, 1, 2, 1, 3, 2,
+ 2,-10, -1, -2, 4, 2, 4, 1, 4, 5, -5, 1, 0, 6,-11, 1,
+ 1, 0, 6, 6, 0, 2, 1,-15, 7, 3, 5, 9,-30, 2, 2, 2,
+ -34, 1, 9, 2, 5, 8, 8, 2, 7, 2, 6, 6, 2,-27, 1, 4
+};
+
+static const int8 s_svq1InterCodebook4x4[1536] = {
+ 4, 0, -6, -7, -4, -8,-13, -9, -8, -8, -1, 6, -2, 5, 22, 27,
+ -16, -7, 11, 10,-18, -7, 13, 10,-15, -4, 12, 8, -9, -1, 9, 5,
+ -2, 2, 15,-16, -3, 2, 19,-19, -3, 2, 19,-19, -2, 3, 15,-14,
+ 17, 22, 22, 16, -6, -7, -5, -2,-12,-16,-16,-12, 1, 1, -1, -3,
+ 11,-17, 0, 8, 14,-21, -1, 9, 14,-21, -2, 8, 11,-16, -2, 6,
+ 7, -2,-16, 11, 9, -2,-21, 14, 10, -1,-22, 14, 8, -1,-18, 10,
+ -10, 16, 3, -9,-13, 20, 4,-11,-14, 21, 4,-10,-11, 16, 3, -8,
+ 11, 4, -9, -9, 15, 6,-12,-14, 17, 8,-12,-14, 16, 10, -7,-11,
+ 4, 10, 14, 13, -1, 7, 15, 16,-12, -7, 3, 8,-20,-23,-18,-10,
+ -10,-18,-26,-25, 4, 1, -6,-11, 13, 15, 11, 3, 12, 15, 13, 8,
+ -16,-19,-16,-11, 7, 12, 15, 11, 11, 16, 16, 11, -6, -9,-11,-10,
+ 18, 19, 12, 5, 18, 16, 5, -4, 6, 0,-10,-15, -9,-17,-23,-22,
+ -10,-14, -1, 21,-11,-17, 0, 29,-11,-16, 1, 30,-10,-14, 0, 23,
+ -16,-17,-12, -6,-19,-19,-14, -7, -3, -1, 1, 2, 27, 35, 29, 19,
+ -37, -8, 23, 23,-42, -9, 28, 29,-43,-10, 26, 28,-38,-11, 19, 22,
+ 32, 16,-16,-33, 39, 20,-18,-37, 38, 19,-19,-38, 32, 15,-17,-34,
+ 24, 9, -6, -4, -1,-10, -6, 3, -8, -9, -1, 3, 3, 7, 2, -6,
+ -1, -3, -1, 0, -1, 4, 2, -7, -3, 11, 3,-16, 1, 20, 9,-18,
+ -3, -8, 6, 12, -5,-10, 7, 13, -6, -9, 5, 7, -5, -5, 2, -1,
+ -8, 12, -3, -1,-10, 15, -3, 1,-11, 13, -4, 1,-11, 8, -3, 2,
+ 9, 6, -5,-12, 3, 0, -8,-13, -4, -4, -1, -1, -4, 1, 15, 18,
+ 9, 13, 14, 12, 4, 3, -1, -2, -2, -5, -8, -5, -7,-11, -9, -4,
+ 7, -5, -7, -4, 14, -2, -7, -4, 17, 0, -8, -5, 15, 1, -7, -5,
+ -10, -1, 6, 4,-15, -9, 2, 4, 2, -1, -3, 0, 25, 13, -8,-10,
+ 7, 11, -3,-16, 7, 11, -3,-15, 6, 7, -2, -9, 4, 2, -3, -5,
+ -7, -1, -1, 0, -9, -2, 2, 6,-12, -4, 6, 14,-13, -6, 8, 19,
+ -18,-18,-11, -5, -3, 0, 3, 4, 6, 8, 6, 6, 6, 6, 6, 6,
+ -5, 3, 13,-10, -6, 1, 15, -9, -6, -3, 15, -6, -6, -6, 10, -3,
+ 9, 1, -9, -9, 11, 9, 6, 5, 0, 3, 8, 7,-15,-14, -6, -5,
+ -11, -6, 11, 19, -2, -5, -9, -8, 6, 2, -9,-10, 6, 5, 4, 5,
+ -7, -3, 8, 15, -1, 3, 10, 15, 5, 5, -1, -2, 4, -2,-21,-25,
+ 6, -6, -6, 5, 8, -9, -7, 9, 8,-12, -7, 13, 4,-14, -7, 14,
+ -4, -3, 1, 1, -3, -5, -2, -3, 7, 0, -2, -4, 20, 7, -4, -4,
+ -3,-20, -6, 10, 6, 0, 0, 1, 5, 8, 5, -1, -3, 0, 0, -2,
+ 13, 6, -1, 2, 5, 3, 2, 3, -3, 0, 3, 0,-16, -8, -2, -5,
+ -2, -7, -6, 0, -3, -6, -3, 1, -5, -1, 2, -1, -1, 12, 16, 5,
+ -7, 1, 9, 8,-10, -2, 5, 3, -6, 2, 7, 3, -4, 0, -1, -7,
+ 3, 4, -9,-24, 0, 2, 6, 3, -1, -1, 4, 7, 5, 3, -1, -2,
+ 3, 6, -9, 2, 1, 6,-13, 1, 1, 8,-10, 2, 1, 8, -7, 1,
+ -3, -3, 2, 22, -2, -3, -5, 12, -2, -3,-10, 2, -3, -1, -4, 2,
+ 11, 12, 8, 2, -5, -5, -5, -8, -6, -4, 0, -3, -2, -1, 3, 3,
+ 12, -6, -2, -1, 12, -8, -2, -2, 9, -7, 0, -3, 4, -6, 2, -2,
+ -19, 1, 12, -3, -4, 4, 5, -4, 6, 1, -2, -1, 4, -4, -2, 7,
+ -3, -4, -7, -8, -4, -4, -2, 0, -1, 2, 14, 16, -4, -2, 4, 4,
+ -1, 7, 2, -5, -2, 0, -1, 1, 4, -3, -1, 13, 6,-12,-14, 8,
+ -1, 5, 4, -5, -2, 5, 3, -9, -2, 7, 4,-12, -1, 7, 4, -9,
+ -6, -3, 1, 1, 11, 11, 0, -6, 6, 4, -2, -7,-12,-10, 3, 10,
+ -2, -3, -3, -2, 6, 11, 14, 10, -9,-11,-10,-10, 2, 2, 3, 2,
+ -7, -5, -7, -1, -1, 2, 0, 7, -1, 1, 0, 9, 3, 4, -5, -1,
+ 10, -1,-15, -1, 4, 1, -5, 2, -3, 1, -1, 1, -3, 1, 4, 4,
+ 2, -1, 4, 10, 6, 2, -1, 0, 2, 2, -7,-12, -4, 2, 0, -3,
+ -1, -4, -1, -8, 3, -1, 2, -9, 4, 0, 5, -5, 2, 0, 8, 3,
+ 3, 2, 1, 1, 4, -2, 0, 3, 2, -1, 4, 1, 0, 6, -1,-25,
+ -1, -2, -2, -4, -3, 0, -1, -4, -1, -1, -4, 2, 0, -6, 2, 25,
+ -11, -1, 5, 0, 7, 0, -2, 2, 10, -1, -3, 4, -5, -5, -2, -1,
+ 0, 6, 3, -1, -2, -1, -1, 1, -1, -7,-12, -5, 8, 6, 2, 4,
+ 2, 6, -1, -6, 9, 10, -1, -4, 1, 0, -4, 0, 3, -2, -9, -5,
+ -4, 3, 4, 0, -4, 3, 3, 0,-11, 0, 3, 2,-11, 3, 7, 2,
+ 2, -4, 7, 3, 1, -8, 7, 1, -1,-12, 4, 1, 3, -9, 2, 2,
+ 2, -2, -2, 9,-17, -3, 3, 1, -4, 7, 1, -6, 5, 4, -1, 3,
+ -1, 2, 0, -4, -7, 8, 12, -1, -2, 5, 4, -5, 3, -5, -8, -2,
+ 0, 0, -5, -2, -2, -8, 3, 27, -1, -4, -3, 6, -3, 1, -2, -7,
+ 4, 4, 1, -1, -7,-10, -7, -3, 10, 10, 5, 3, -2, -2, -4, -3,
+ 0, 1, 5, 7, 4, -2,-16,-20, 0, 4, 7, 8, 2, 0, -2, -1,
+ -2, 1, 3, 17, -3, 1, -2, -1, -1, -2, -1, -2, -1, -5, -1, 0,
+ 5, -3, 1, 0, 6, -2, 0, 0, -1, -2, 0, -3,-11, 1, 8, -1,
+ 3, 0, 0, 0, 0, 2, 4, 1, 2, 0, 6, 1, -2,-18, -3, 2,
+ -14, 0, 6, 1, -5, -2, -1, 1, -1, 1, 0, 1, 1, 7, 4, 0,
+ -1, 0, 1, -4, 1, 8, 3, -4, -3, 4, 1, 3, -6, 1, -4, 1,
+ 1,-12, 3, 3, -1,-10, 0, -1, 2, 0, 2, 1, 3, 2, 2, 4,
+ 3, 0, 0, 3, 2, 0, -2, 1, 5, 2, -5, 0, 6, -1,-14, -1,
+ -2, -6, -3, -3, 2, -1, 4, 5, 6, -1, -2, 0, 4, 4, -1, -5,
+ -4, 1,-11, 0, -1, 2, -4, 1, 2, -3, 3, -1, 1, -2, 15, 0,
+ 1, -1, 0, -2, 1, -4, -7, 1, -2, -6, -1, 21, -2, 2, -1, 1,
+ 21, -1, -2, 0, -1, -3, 1, -2, -9, -2, 2, -1, 2, 1, -4, -1,
+ 1, 8, 2, -6,-10, -1, 4, 0, -4, -3, 3, 3, 5, 0, -1, -1,
+ 3, 2, 1, -2, -2, -2, 4, 3, 5, 2, -4,-17, 0, -2, 4, 3,
+ -7, -4, 0, 3, 9, 9, 2, -1,-11, -6, 0, -1, 5, 1, 0, 1,
+ 0, 17, 5,-11, 3, -2, -6, 0, 2, -2, -4, 1, -4, 1, 2, -1,
+ -5, -1, -5, -3, -3, 5, -3, -2, 4, 16, 2, -5, -2, 5, -1, -1,
+ 0, 0, -4, 1, -1, 2, 5, 11, -1, -1, -2, 1, -4, -2, -3, -1,
+ -5, -1, 10, 0, 6, 1, 0, -3, 0, -4, 1, 0, -2, -4, 3, -1,
+ 6, 9, 3, 0, -2, 1, -2, 0, -2, -3, -2, -2, 1, 0, 1, -6,
+ 1, 0, 2, 1, -1, 3, -2, 1, 0, -1,-15, 0, -1, 5, 2, 6,
+ 2, 0, 2, 2, 0,-12, -4, 6, 0, 1, 4, -1, 1, 2, 1, -4,
+ 1, -2, -7, 0, 0, 0, 0, -1, -5, 2, 11, 3, 1, 3, 0, -6,
+ 0, -3, -9, -4, 1, 3, -1, 0, 4, 1, -2, 0, 7, -3, -1, 6,
+ 1, -2, 6, 2, 0, -1, 3, -2, -2, 4, 0, 2, -1, 2,-14, 2,
+ 2, 2, 0, -1, -2, 3, -3,-14, 0, 2, 3, -3, 5, 1, 3, 2,
+ 1, -3, 4,-14, 1, -2, 11, -1, 0, -1, 3, 0, -1, 1, 0, 2,
+ -2, 3, -3, 2, -4, -1, -4, 3, -1, 2, 1, 3, -6, -2, 2, 7,
+ -2, 1, 2, 0, -2, 0, 0, -1, 12, 5, -1, 2, -8, -1, 1, -7,
+ 2, -2, -4, 2, 11, 0,-11, -2, 3, 1, -3, -1, 0, 3, 1, -1,
+ 0, 3, 0, -2, 0, -6, -1, -3, 12, -7, -2, 0, 7, -2, 1, 1,
+ 1, 2, 2, 2, -1, 2, 0, 2,-23, 0, 4, 0, 3, 2, 1, 3,
+ -4, -5, -1, 5, -3, 5, 10, -1, 0, 0, 3, -4, 1, -1, 2, -5
+};
+
+static const int8 s_svq1InterCodebook8x4[3072] = {
+ 9, 8, 4, 0, -3, -4, -4, -3, 9, 8, 4, -1, -4, -5, -5, -3,
+ 8, 7, 3, -2, -5, -5, -5, -4, 6, 4, 1, -2, -4, -5, -4, -3,
+ -12,-14,-11, -4, 1, 5, 6, 6, -8,-10, -7, -5, -2, 1, 1, 1,
+ 5, 4, 3, 1, 0, 0, -1, -1, 13, 13, 9, 6, 3, 0, -1, -2,
+ -4, -4, -3, -1, 1, 4, 8, 11, -5, -6, -4, -2, 0, 3, 8, 12,
+ -7, -7, -6, -4, -2, 2, 7, 10, -7, -7, -5, -4, -2, 1, 5, 8,
+ -3, -2, -1, 1, 3, 6, 7, 6, 2, 3, 5, 7, 8, 8, 6, 4,
+ 4, 5, 4, 3, 1, -2, -6, -7, 1, 0, -2, -7,-10,-14,-17,-16,
+ -5, -4, 1, 8, 9, 3, -3, -7, -7, -6, 1, 11, 12, 5, -3, -8,
+ -8, -7, 0, 9, 11, 5, -3, -7, -8, -6, -1, 5, 8, 4, -2, -6,
+ -4, -5, -7, -8, -9, -9, -8, -6, -4, -5, -6, -7, -7, -6, -4, -2,
+ 0, 1, 2, 3, 5, 8, 10, 9, 1, 2, 3, 6, 9, 12, 14, 13,
+ 5, 6, 6, 5, 4, 3, 2, 1, 5, 6, 7, 7, 6, 6, 6, 4,
+ -1, 0, 1, 1, 3, 5, 5, 5,-13,-16,-17,-17,-14,-10, -6, -4,
+ 9, 11, 13, 16, 15, 13, 12, 10, -4, -5, -6, -7, -7, -7, -6, -5,
+ -6, -6, -7, -7, -7, -7, -6, -5, -2, -1, 0, 0, 0, 0, 0, -1,
+ -11,-13,-15,-16,-16,-14,-12,-10, 2, 3, 4, 5, 4, 3, 3, 3,
+ 6, 7, 8, 8, 8, 7, 6, 5, 3, 4, 3, 3, 3, 3, 3, 3,
+ 3, 4, 4, 1, -2, -7,-13,-17, 5, 7, 7, 5, 1, -5,-13,-19,
+ 6, 8, 9, 8, 5, -1, -9,-16, 6, 8, 10, 10, 7, 2, -4,-11,
+ 18, 9, -1,-10,-13, -9, -4, 0, 22, 12, -1,-12,-15,-10, -4, 2,
+ 23, 13, 0,-10,-13, -9, -3, 2, 20, 12, 2, -6, -9, -6, -2, 2,
+ -6, -6, -6, -7, -7, -7, -7, -6, -6, -7, -8, -8, -9, -9, -9, -8,
+ -3, -3, -3, -3, -3, -3, -3, -3, 12, 15, 18, 21, 21, 19, 17, 14,
+ 14, 16, 18, 18, 18, 16, 15, 13, 5, 6, 6, 5, 5, 4, 4, 3,
+ -6, -7, -9,-10,-10,-10, -9, -7,-10,-11,-13,-14,-14,-13,-12,-10,
+ -27,-17, -4, 5, 9, 10, 10, 7,-32,-19, -3, 7, 11, 12, 11, 8,
+ -30,-16, -2, 8, 12, 12, 10, 7,-23,-12, 0, 7, 10, 11, 9, 6,
+ 16, 17, 16, 12, 6, -1, -8,-12, 17, 18, 15, 10, 1, -8,-15,-18,
+ 15, 14, 10, 4, -5,-14,-20,-23, 10, 8, 4, -1, -9,-16,-21,-22,
+ -10,-12,-12,-11, -5, 4, 14, 20,-11,-13,-15,-12, -4, 7, 19, 27,
+ -11,-13,-14,-11, -3, 8, 21, 28,-10,-11,-12, -9, -2, 8, 18, 25,
+ -1, -1, -1, 1, 4, 6, 6, 5, 0, 0, 0, 2, 4, 3, 1, -2,
+ 0, 0, 2, 4, 4, -1, -7,-10, 0, 0, 3, 5, 3, -3,-11,-15,
+ -14,-13, -8, -1, 3, 3, -1, -4, -5, -4, -1, 4, 8, 8, 3, 0,
+ 3, 2, 2, 3, 4, 5, 3, 1, 5, 3, 0, -2, -2, -1, -1, -1,
+ 9, 1, -6, -6, -5, -3, -2, -1, 12, 1, -6, -6, -4, -2, -1, 0,
+ 14, 4, -4, -4, -2, -2, -1, -1, 14, 6, -1, -1, -1, -1, -1, -1,
+ 4, 6, 8, 10, 11, 9, 7, 5, -1, -1, -1, 0, 0, -1, -1, -2,
+ -2, -4, -4, -5, -5, -5, -5, -4, -2, -3, -3, -4, -4, -3, -2, -1,
+ 2, 3, 4, 4, 3, 1, 0, 0, -1, 1, 4, 5, 6, 5, 4, 3,
+ -8, -6, -2, 2, 3, 4, 4, 3,-14,-13, -9, -5, -2, -1, 0, 0,
+ -3, -4, -5, -4, 0, 7, 12, 13, -3, -4, -5, -5, -2, 4, 9, 10,
+ -2, -3, -4, -5, -4, -1, 3, 4, -1, -1, -2, -3, -3, -2, 0, 1,
+ 9, 5, -2, -8,-11,-10, -7, -4, 12, 10, 6, 2, 0, -1, 0, 0,
+ 2, 2, 3, 4, 3, 1, 1, 1, -9, -8, -4, 0, 1, 2, 1, 0,
+ 6, 8, 8, 5, 1, -5,-11,-13, 0, 1, 2, 2, -1, -4, -8,-11,
+ -3, -2, 1, 3, 3, 1, -1, -4, -2, -1, 2, 5, 6, 6, 4, 1,
+ 3, 4, 5, 5, 4, 1, -3, -6, 5, 6, 4, 2, 2, 2, 0, -3,
+ 6, 5, 0, -5, -5, -2, -1, -2, 7, 4, -3,-11,-12, -7, -3, -2,
+ 1, 0, -1, -1, -1, 0, 0, 0, 2, 3, 4, 4, 5, 5, 4, 3,
+ -7, -9, -9,-10,-10, -9, -7, -6, 3, 4, 5, 6, 5, 5, 5, 5,
+ -7, -7, -7, -7, -6, -6, -5, -4, -5, -4, -3, -1, -1, -1, 0, 0,
+ -3, -2, 1, 4, 5, 5, 5, 5, -2, -1, 3, 6, 9, 10, 10, 9,
+ -14, 1, 10, 3, -2, 0, 1, 1,-16, 2, 13, 3, -3, -1, 1, 0,
+ -15, 2, 12, 3, -4, -2, 1, 1,-10, 3, 10, 2, -3, -1, 1, 1,
+ 0, 1, 4, 2, -5,-10, -3, 11, -1, 1, 4, 2, -6,-13, -2, 15,
+ -1, 0, 3, 1, -6,-12, -1, 15, -1, 1, 2, 1, -4, -8, 0, 11,
+ 10, 5, -2, -2, 2, 5, 1, -4, 7, 0, -8, -6, 1, 5, 2, -4,
+ 2, -5,-12, -7, 2, 7, 4, -1, -1, -7,-10, -4, 4, 9, 7, 2,
+ -5, -5, -4, -6, -6, -5, -5, -3, -1, -2, -2, -4, -5, -6, -5, -4,
+ 6, 7, 7, 4, 0, -2, -3, -3, 13, 14, 13, 10, 5, 1, -1, -2,
+ 1, 1, 2, 2, 2, 2, 2, 2, -5, -6, -8, -9, -9, -8, -7, -6,
+ 7, 9, 10, 11, 11, 9, 7, 5, -1, -2, -3, -3, -4, -4, -4, -3,
+ -1, -1, 0, 0, 0, 0, -1, -1, -3, -3, -4, -5, -4, -3, -3, -2,
+ 2, 1, -1, -3, -3, -2, -1, 0, 12, 12, 8, 3, 1, 0, 0, 1,
+ -6, -8, -8, -6, -2, 2, 6, 8, 1, 1, -1, -2, 0, 3, 5, 7,
+ 3, 3, 1, -1, -1, 0, 0, 2, 0, 1, 0, -1, -1, -1, -2, -1,
+ 1, 0, 0, 0, 0, 0, 2, 4, 2, 1, 3, 4, 3, 1, 0, 2,
+ 2, 1, 0, 0, -1, -1, 0, 3, 5, 1, -6,-12,-13, -8, -1, 4,
+ -2, 0, -1, -2, -1, 0, 2, 3, -6, -3, -2, 0, 1, 1, 1, 1,
+ -9, -5, 0, 4, 5, 3, 1, 0, -8, -3, 3, 7, 8, 4, 1, 0,
+ 1, 2, 2, 3, 3, 1, -1, -3, 4, 5, 5, 6, 6, 5, 2, 0,
+ 0, 0, 0, 0, 1, 0, -2, -4, -3, -3, -4, -3, -3, -4, -7, -8,
+ 14, 12, 6, -1, -3, -3, 0, 0, 7, 5, 1, -3, -5, -4, -2, -1,
+ -2, -2, -2, -2, -2, -2, -1, -1, -6, -4, -1, 1, 1, 1, 0, -1,
+ 2, 2, 1, -3, -6, -7, -6, -3, 1, 0, -1, -3, -2, 1, 4, 6,
+ 0, 0, 1, 2, 4, 7, 8, 7, 0, 0, 0, 0, -1, -4, -7, -8,
+ 0, 2, 1, -2, -3, -3, -2, -1, -1, 1, 0, -3, -5, -2, 0, 2,
+ -2, -1, -2, -5, -4, 1, 6, 9, -3, -2, -3, -4, -2, 5, 11, 13,
+ -4, -2, 2, 6, 4, -3,-10,-14, -2, -1, 1, 4, 4, 1, -1, -2,
+ 0, 0, -1, -2, -2, 0, 4, 6, 2, 2, 0, -3, -3, 0, 5, 9,
+ -4, -4, -2, 1, 6, 9, 3, -7, -2, -2, -2, -1, 4, 8, 0,-11,
+ 1, 1, 0, 0, 2, 6, -1,-10, 2, 2, 1, 0, 2, 4, 0, -7,
+ -1, -2, -3, -6, -7, -8, -8, -8, 2, 3, 3, 1, -1, -2, -3, -4,
+ 5, 5, 5, 4, 3, 2, 0, -1, 3, 3, 3, 3, 2, 2, 1, 1,
+ 3, 3, 2, -2, -3, 0, 7, 10, 1, 2, 2, -2, -5, -4, 0, 3,
+ 0, 3, 4, 2, -3, -5, -6, -4, 0, 2, 4, 4, 1, -4, -7, -7,
+ 2, 4, 5, 5, 5, 5, 6, 6, -4, -4, -3, -5, -5, -3, -3, -2,
+ -3, -4, -4, -5, -4, -2, -2, -2, 1, 1, 0, 0, 2, 4, 5, 4,
+ -2, 0, 3, 4, 4, 3, 2, 2, -9, -7, -4, 0, 3, 6, 6, 6,
+ -5, -5, -3, -2, 0, 1, 3, 4, 5, 5, 2, -2, -4, -6, -5, -3,
+ 1, -6, -4, 7, 5, -2, -2, 1, 5, -5, -4, 6, 4, -5, -4, 1,
+ 5, -5, -4, 6, 4, -5, -3, 1, 1, -7, -3, 8, 7, -1, -3, 1,
+ -8, -7, -4, 0, 2, 4, 5, 5, 5, 6, 5, 2, -1, -5, -7, -7,
+ 5, 6, 4, 1, -3, -5, -6, -5, -7, -7, -5, -2, 1, 6, 9, 10,
+ 6, 3, 0, 1, 3, 0, -8,-14, 3, 0, -1, 1, 4, 3, 0, -4,
+ 1, 0, 0, 1, 2, 1, 1, 1, -1, -1, 1, 2, 1, -1, -1, 0,
+ 1, 1, 1, 1, 0, -2, -3, 0, 1, 2, 1, 0, -2, -8, -9, -4,
+ 1, 3, 3, 2, 1, -3, -3, 1, 0, 1, 1, 1, 1, 1, 4, 8,
+ 2, 5, 9, 7, 2, -1, -1, 1, -4, -1, 1, 0, -3, -4, -1, 2,
+ -3, 0, 3, 3, 0, -1, 0, 2, -4, -1, 1, 1, -2, -4, -5, -4,
+ 1, -1, -2, -2, -1, 2, 4, 5, 2, 1, 1, 0, -1, -1, 0, 0,
+ 2, 3, 4, 5, 4, 2, 1, 0, -9, -9, -6, -3, -1, -1, -1, -1,
+ -6, -6, 4, 7, 0, -2, -1, -2, -1, -2, 5, 6, -1, -2, 0, -1,
+ 4, -1, 1, 0, -4, -2, 0, -2, 7, 1, -1, -2, -3, 1, 3, 1,
+ 4, 2, 1, 3, 3, 1, 1, 2, 2, -2, -4, 0, 3, 1, 0, 0,
+ 1, -4, -8, -4, 1, 2, 1, 0, 2, -3, -9, -6, 0, 3, 3, 2,
+ -1, -1, 0, -1, -1, 0, 1, 2, 3, 1, -4, -8, -7, -3, 1, 2,
+ 2, -1, -3, -2, -1, 0, 1, 0, -1, 0, 5, 11, 9, 3, -1, -3,
+ -1, -2, -2, -1, 1, 1, 1, 1, 0, -1, 0, 3, 6, 6, 5, 5,
+ 2, 1, -1, -1, -2, -5, -6, -4, 2, 2, 2, 1, -1, -4, -5, -5,
+ -1, -3, -6, -7, -6, -4, -1, 1, 5, 5, 3, 4, 4, 3, 4, 5,
+ -1, -2, -3, -2, -2, -2, 0, 1, 0, 0, 0, 0, 0, 1, 2, 3,
+ -6, -6, -4, -1, 2, 2, 2, 2, -6, -7, -5, -2, 0, -1, -1, 0,
+ 2, 2, 2, 4, 4, 3, 3, 4, 2, 1, 0, -1, 0, 0, 2, 4,
+ 12, 5, -5, -8, -5, 0, 2, 2, 2, -3, -6, -3, 0, 0, -1, -2,
+ -2, -3, -1, 3, 4, 1, -2, -3, 2, 2, 3, 4, 3, 1, -1, -1,
+ 3, 2, 1, 0, 1, 4, 3, 0, 4, 3, 0, -5, -6, 0, 3, 3,
+ 2, 3, 1, -7,-12, -6, 1, 3, 1, 3, 4, -1, -6, -4, 0, 1,
+ -9, -4, 2, 6, 7, 4, 1, 0, -7, -1, 4, 6, 4, 0, -3, -3,
+ -6, 0, 4, 4, 1, -2, -3, -2, -4, 1, 3, 2, 0, -2, -1, 0,
+ 0, 5, 2, -5, -3, 3, 1, -4, -2, 4, 2, -6, -3, 6, 4, -3,
+ -1, 5, 3, -5, -1, 7, 3, -4, -1, 2, 0, -6, -3, 5, 3, -3,
+ -8, -3, 3, 5, 3, 1, -2, -2, 2, 4, 4, -2, -4, -3, 1, 3,
+ 2, 1, -3, -5, -3, 3, 4, 3, -5, -6, -5, 3, 10, 8, -1, -5,
+ 0, 3, 2, -4, -9, -7, 0, 6, -5, -1, 5, 7, 4, -1, -3, -3,
+ -5, -5, -2, 3, 6, 5, -1, -4, 9, 6, 0, -4, -2, 1, 1, -1,
+ -1, -1, -1, 1, 1, 0, -1, 0, -1, 0, 0, 0, 0, -1, -1, 0,
+ 2, 1, -2, -1, 1, 1, 0, 0, 12, 8, 2, -1, -1, -4, -7, -7,
+ 2, 1, 3, 6, 7, 4, 2, 0, 1, 0, -1, 0, -1, -4, -7, -8,
+ 0, 0, -1, 0, 0, 0, -1, -3, 0, 0, 0, 0, 1, 1, 0, -2,
+ -1, 0, 1, 1, 0, 0, -1, -2, 0, 0, -1, -3, -4, -3, -1, 1,
+ -1, 0, 0, 0, 1, 4, 10, 12, -1, 0, -2, -2, -3, -3, -1, 1,
+ -3, -1, -2, -4, 2, 9, 9, 7, -3, 0, -1, -3, 0, 2, -1, 1,
+ -1, 1, -2, -3, 0, -1, -3, 0, 0, 0, -3, -2, 0, -1, -1, 1,
+ -1, -2, -1, -1, -2, -1, -1, -2, 2, -1, -2, -1, 0, 1, 0, -2,
+ 3, -1, -2, 2, 5, 3, -1, -3, 1, -5, -5, 1, 6, 6, 2, 0,
+ 1, 2, 0, -1, 0, 1, 0, -2, -5, -3, -1, 0, 1, 2, 1, -2,
+ -7, -5, -2, -2, -2, -2, 0, 1, -1, 0, 1, 1, 0, 3, 9, 12,
+ 0, 6, 5, 1, -2, -3, 0, 3, 0, 6, 5, 1, 1, 1, 2, 3,
+ -5, -2, -2, -3, 0, 0, 0, 0, -6, -3, -3, -2, 0, 0, -1, -2,
+ 4, 4, 2, 1, 0, -1, -1, 0, -2, -2, 0, 1, 2, 1, 1, 0,
+ 2, 2, 1, -1, -3, -5, -9,-10, 2, 1, -1, -1, 1, 4, 4, 1,
+ 4, 0, -2, -2, -2, -2, -1, 0, 7, 1, -4, -3, -2, 0, 1, 1,
+ 10, 5, -1, -2, 0, 1, 1, 0, 5, 1, -3, -4, -3, -1, -1, -2,
+ 2, 1, -1, -3, -3, 1, 1, -1, -2, -1, 3, 0, -1, 1, 1, 0,
+ -3, 1, 7, 2, -3, -2, -1, 0, -2, 4, 8, -1, -8, -5, 0, 2,
+ -4, -1, 1, 2, 1, -3, -4, -2, -5, -3, -2, 1, 4, 4, 4, 6,
+ -3, -2, -4, -3, 0, 1, 1, 2, 2, 2, 2, 1, 2, 1, -1, -1,
+ -4, -1, 0, -1, -3, -3, -1, -1, 1, 4, 4, 2, 0, -1, -2, -3,
+ 4, 6, 5, 3, 2, 1, -2, -4, 0, 1, 1, 1, 1, -1, -4, -6,
+ 1, 2, 2, -1, -6, -5, -1, 2, -3, -2, 1, 1, -4, -3, 2, 5,
+ -2, -1, 2, 2, -3, -4, 0, 3, -2, -2, 2, 6, 5, 2, 1, 2,
+ 2, -3, -3, 0, 0, 2, 3, 1, 3, -1, 1, 3, 1, 2, -1, -5,
+ -5, -7, -4, -2, 1, 8, 8, 1, -1, 0, 2, 0, -3, 0, 1, -3,
+ -2, -5, -5, -2, -3, -1, 0, -2, -1, -4, 0, 4, 0, 2, 4, 0,
+ 0, 0, 8, 10, 2, 1, 3, -1, -4, -3, 2, 3, -3, -3, 1, -1,
+ 1, -2, -4, 2, 7, 3, -2, -1, 6, 4, -2, -1, 2, 0, -1, 3,
+ 1, 1, -2, -2, -2, -5, -3, 4, -6, -2, 1, 1, -1, -4, -2, 4,
+ -2, -1, -2, -2, 0, 1, 0, -2, -1, 1, 0, -1, 0, 0, -1, -3,
+ 0, 1, -2, -4, -3, -1, 0, 0, 6, 8, 5, 0, 0, 1, 2, 3,
+ -2, -2, 2, 5, 2, 0, 0, 1, 2, -2, -2, -1, -1, 1, 2, 4,
+ 2, -1, 0, 1, 0, 0, 0, 1, -8, -7, -1, 1, -1, -1, 1, 3,
+ 0, 3, 6, 2, -2, 1, 2, 0,-10, -7, -1, 0, -3, -1, 2, 1,
+ 0, 0, 2, 2, 1, 1, 1, -1, 3, 0, -2, -2, 0, 2, 1, 0,
+ 8, 1, 0, 0, -2, -3, -1, 0, 2, -2, 2, 5, 1, -2, -1, 1,
+ -3, -6, -3, -1, -3, -3, -1, 2, 2, 0, 1, 2, 2, 1, 0, 0,
+ 1, -1, -1, -2, -1, 0, 1, 0, 15, 9, 2, -1, -2, -3, -3, -3,
+ 0, -3, -2, 0, 0, -1, -1, -1, 1, 0, 1, 0, 0, -1, -1, -1,
+ 0, 2, 2, -2, -3, -3, -7, -8, 0, 2, 2, 0, 1, 2, 1, 1,
+ 1, 2, 2, 2, 3, 1, 0, 3, 1, 0, -1, -2, -1, -2, 0, 5,
+ -11, -6, -1, 1, 2, 3, 1, -3, 1, 4, 3, -1, -2, 1, 2, -1,
+ 2, 2, 1, -1, -2, 0, 1, -1, 0, 0, -1, -1, 0, 2, 3, 2,
+ 1, 1, 2, 1, -1, 1, 0, -4, 0, 0, 0, -2, -2, 2, 4, -2,
+ -2, -3, 0, 0, -1, 2, 1, -6, 0, 2, 5, 5, 3, 2, -1, -7,
+ 4, 2, 0, 0, 3, 3, 1, -1, 0, -1, -1, 3, 6, 4, 1, -1,
+ -2, -2, 0, 2, 2, 0, -2, -2, -1, 0, -1, -5, -7, -5, -1, 1,
+ 5, -1, -2, 0, 2, 4, 2, -5, 0, -5, -2, 2, 1, 2, 0, -6,
+ 6, 1, 0, 1, -2, -1, 4, 2, 2, -3, -3, 0, -1, -2, 0, 0,
+ 1, -1, 0, 2, 0, 0, 6, 11, 2, -1, -1, 0, -3, -2, 3, 5,
+ 0, -2, -1, 0, -1, 0, 0, -3, 1, -1, -1, -1, -2, -1, -3, -7,
+ 1, 1, -2, -2, 1, 3, 1, -2, -1, 2, 0, -1, -1, 1, 0, 0,
+ -4, 2, 3, -1, -2, -2, 0, 1,-11, -2, 4, 5, 6, 2, -1, -2,
+ -6, -2, 1, -1, -3, -4, 1, 9, -3, 0, 3, 3, 2, -3, -3, 3,
+ 1, 1, 0, 0, 1, -1, -2, 3, 2, 0, -3, -3, 0, -1, -1, 3,
+ 1, -1, -3, 1, 2, -6, -4, 6, 0, -2, -5, -2, 0, -3, -2, 3,
+ 2, 2, 1, -2, -2, 1, 2, -1, -1, 1, 1, -2, -1, 6, 7, -1,
+ 1, 0, -4, -2, 1, -2, -3, 1, -4, 0, -3, -2, 2, 0, -3, 0,
+ -3, 4, 3, 1, 8, 7, 0, -1, -3, 4, 1, -4, 2, 3, -2, -3,
+ -3, 6, 1, -4, 1, 1, -1, -1, -2, 4, -3, -3, 3, 0, -1, -1,
+ 1, 2, -4, 2, 4, -3, -1, 2, 3, -1, -4, 5, 4, -6, -3, 2
+};
+
+static const int8 s_svq1InterCodebook8x8[6144] = {
+ -4, -3, 4, 5, 2, 1, 1, 0, -5, -3, 5, 5, 2, 1, 0, 0,
+ -6, -4, 5, 5, 2, 1, 0, 0, -7, -4, 4, 5, 2, 1, 0, 0,
+ -8, -5, 3, 4, 2, 1, 0, 0, -8, -6, 3, 4, 1, 1, 1, 0,
+ -8, -6, 2, 4, 2, 1, 1, 0, -8, -6, 2, 4, 1, 1, 1, 1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2,
+ -2, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, -3, -3, -4, -3,
+ -2, -2, -2, -2, -2, -3, -3, -2, 1, 1, 1, 1, 1, 0, -1, -1,
+ 4, 5, 5, 5, 4, 3, 3, 2, 7, 7, 8, 8, 8, 7, 6, 5,
+ 2, 1, 2, 4, 4, 0, -4, -6, 1, 1, 2, 5, 5, 1, -5, -7,
+ 1, 2, 1, 4, 5, 1, -5, -8, 1, 1, 1, 5, 5, 0, -6, -8,
+ 0, 1, 1, 5, 6, 1, -6, -9, 0, 0, 1, 4, 5, 0, -5, -8,
+ 0, 0, 1, 4, 5, 0, -5, -7, 0, 0, 1, 4, 4, 1, -4, -7,
+ 1, 2, 3, 0, -3, -4, -3, -1, 1, 3, 4, 0, -3, -4, -3, -1,
+ 2, 4, 5, 1, -3, -4, -3, -2, 2, 5, 6, 1, -3, -5, -4, -2,
+ 3, 6, 6, 1, -3, -5, -4, -2, 3, 6, 6, 1, -3, -5, -4, -2,
+ 3, 6, 6, 1, -3, -5, -4, -2, 3, 5, 5, 1, -3, -4, -4, -2,
+ 2, 2, 2, 2, 1, 0, 0, -1, 4, 4, 4, 3, 2, 1, 1, 0,
+ 4, 5, 4, 4, 3, 3, 2, 1, 4, 4, 4, 4, 4, 3, 2, 2,
+ 2, 3, 3, 3, 3, 3, 2, 1, -1, -1, -1, -1, 0, 0, 0, 0,
+ -5, -6, -6, -5, -5, -4, -3, -3, -7, -9, -9, -8, -7, -6, -6, -5,
+ 6, 6, 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2,
+ 0, -1, -1, -1, -2, -2, -1, -1, -3, -5, -6, -6, -6, -6, -5, -4,
+ -3, -5, -6, -7, -6, -6, -5, -4, -1, -2, -2, -2, -2, -2, -1, -1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 1, -2, -5, -4, 0, 2, 5, 2, 1, -2, -6, -5, 0, 3, 5,
+ 2, 1, -2, -6, -6, -1, 3, 6, 3, 2, -2, -7, -6, 0, 4, 7,
+ 2, 1, -2, -7, -5, 0, 5, 7, 2, 1, -2, -6, -5, 0, 4, 7,
+ 2, 1, -2, -6, -4, 0, 4, 6, 1, 1, -2, -5, -4, 0, 3, 6,
+ -10, -9, -6, -4, -1, 2, 3, 2,-10, -9, -5, -3, 0, 4, 4, 3,
+ -9, -7, -3, -1, 2, 5, 5, 3, -7, -5, -2, 0, 3, 5, 5, 3,
+ -6, -3, 0, 1, 4, 6, 5, 3, -4, -2, 1, 2, 3, 5, 4, 2,
+ -2, 0, 1, 2, 2, 4, 3, 1, -1, 1, 2, 2, 2, 3, 3, 1,
+ -4, -5, -5, -6, -6, -6, -6, -5, -3, -3, -4, -4, -4, -4, -4, -4,
+ 0, 0, 0, 0, -1, -1, -1, -1, 5, 5, 6, 5, 5, 4, 3, 2,
+ 5, 6, 7, 7, 7, 6, 5, 4, 3, 3, 4, 4, 4, 4, 3, 2,
+ 0, -1, 0, 0, -1, -1, 0, -1, -3, -3, -4, -4, -4, -4, -3, -3,
+ 1, -2, -5, 1, 5, 4, 2, 0, 1, -3, -6, 1, 6, 5, 2, 0,
+ 0, -4, -7, 0, 6, 6, 2, 1, -1, -5, -9, -1, 6, 6, 3, 1,
+ -1, -6,-10, -2, 6, 6, 3, 1, -1, -6, -9, -2, 5, 6, 3, 1,
+ -2, -6, -9, -2, 5, 5, 3, 1, -2, -6, -7, -2, 4, 4, 2, 1,
+ -5, -7, -8, -9, -9, -8, -7, -6, -5, -6, -6, -7, -7, -6, -6, -5,
+ -3, -3, -3, -4, -5, -5, -4, -4, -1, 0, 0, -1, -1, -1, -1, -1,
+ 0, 1, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 5, 5, 5, 4,
+ 3, 4, 5, 6, 8, 8, 8, 7, 3, 4, 5, 6, 7, 7, 7, 6,
+ 5, 6, 7, 8, 9, 10, 10, 9, 3, 4, 6, 7, 8, 9, 9, 8,
+ 0, 1, 2, 3, 4, 5, 5, 5, -1, -2, -1, -1, 0, 1, 2, 2,
+ -2, -3, -3, -3, -3, -2, -1, 0, -3, -4, -5, -5, -5, -5, -5, -4,
+ -4, -5, -5, -6, -7, -7, -6, -5, -3, -4, -5, -6, -7, -7, -6, -6,
+ 13, 7, 0, -3, -3, -4, -4, -5, 14, 7, 0, -3, -3, -4, -4, -4,
+ 15, 8, -1, -4, -4, -4, -5, -4, 15, 8, -1, -4, -4, -5, -4, -3,
+ 15, 7, -1, -4, -5, -5, -5, -4, 14, 7, -1, -4, -4, -4, -4, -3,
+ 12, 6, -1, -4, -4, -4, -4, -3, 11, 5, -1, -4, -4, -4, -4, -3,
+ -17, -4, 5, 4, 4, 4, 3, 3,-18, -5, 5, 4, 4, 4, 3, 3,
+ -19, -5, 6, 4, 4, 4, 3, 2,-20, -5, 6, 4, 4, 4, 3, 3,
+ -20, -4, 6, 4, 4, 5, 3, 3,-19, -5, 6, 4, 4, 5, 3, 3,
+ -18, -4, 5, 4, 4, 4, 3, 2,-17, -5, 4, 3, 4, 4, 3, 3,
+ -6, -6, -6, -4, -2, 1, 6, 11, -6, -7, -7, -4, -2, 2, 8, 13,
+ -8, -8, -7, -4, -2, 3, 9, 14, -8, -8, -7, -5, -1, 4, 10, 16,
+ -8, -8, -7, -5, -1, 4, 10, 17, -8, -8, -7, -4, 0, 5, 10, 16,
+ -8, -8, -6, -3, 0, 4, 9, 15, -7, -7, -5, -3, 0, 4, 8, 12,
+ 8, 7, 7, 5, 2, -2, -8,-14, 8, 8, 7, 5, 2, -2, -8,-15,
+ 8, 8, 7, 5, 1, -3, -9,-16, 8, 8, 7, 5, 1, -3,-10,-17,
+ 8, 9, 8, 5, 1, -3,-10,-17, 8, 8, 7, 4, 1, -4,-10,-16,
+ 7, 7, 7, 4, 1, -3, -9,-14, 6, 7, 6, 3, 0, -3, -9,-13,
+ 5, 1, -4, -4, -3, -1, 0, 0, 7, 2, -3, -3, -2, -1, 1, 0,
+ 7, 1, -3, -3, -1, 0, 1, 1, 6, 1, -3, -2, -1, 1, 1, 0,
+ 6, 0, -4, -2, -1, 0, 1, 0, 5, 0, -4, -3, -1, 0, 0, -1,
+ 5, 0, -3, -1, 0, 0, 0, -2, 4, 1, -2, -1, 0, 1, 0, -1,
+ 2, 2, 1, 1, -2, -6, -8, -8, 1, 1, 1, 1, -2, -5, -8, -8,
+ 1, 1, 1, 0, -1, -3, -5, -5, 0, 0, 0, 0, -1, -1, -1, -2,
+ 0, -1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 3, 2,
+ 2, 1, 1, 1, 2, 3, 4, 3, 3, 3, 3, 3, 4, 4, 5, 4,
+ -4, -4, -3, -2, 0, 0, 1, 1, -4, -4, -3, -2, -1, 0, 0, 1,
+ -2, -2, -2, -1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1,
+ 2, 2, 2, 2, 2, 2, 1, 1, 3, 4, 4, 4, 4, 4, 4, 3,
+ 1, 1, 1, 3, 3, 4, 3, 3, -5, -6, -5, -4, -3, -3, -2, -2,
+ -4, -2, -1, -1, -1, -1, 0, 1, -4, -2, -1, -1, -1, -1, 0, 1,
+ -3, -2, -1, -1, -1, 0, 1, 2, -4, -3, -2, -1, -1, 1, 3, 3,
+ -4, -3, -3, -1, -1, 1, 4, 5, -4, -3, -2, -2, -1, 1, 4, 7,
+ -2, -2, -1, -1, 0, 2, 6, 8, -1, 0, 0, 1, 1, 4, 7, 8,
+ -3, -3, -3, -2, -2, -1, -1, 0, -1, -1, 0, 1, 2, 2, 3, 3,
+ 0, 1, 2, 4, 5, 6, 6, 5, -1, 0, 2, 3, 5, 6, 5, 3,
+ -1, -1, 0, 2, 3, 3, 2, 1, -2, -2, -1, 0, -1, -3, -4, -4,
+ 0, 0, -1, -1, -2, -4, -8, -7, 1, 2, 1, 0, -1, -4, -6, -7,
+ -2, 4, 1, -6, 0, 3, 0, 0, -2, 5, 1, -7, 0, 3, 0, 0,
+ -3, 5, 1, -8, 0, 3, -1, -1, -2, 6, 1, -9, 0, 3, 0, -1,
+ -2, 6, 2, -8, 0, 4, 0, -1, -3, 5, 1, -7, 1, 4, 0, 0,
+ -2, 4, 1, -7, 0, 4, 1, 0, -1, 4, 1, -6, 0, 3, 1, 0,
+ 0, 0, 0, 3, 4, 5, 4, 1, 1, 1, 1, 2, 3, 3, 2, 0,
+ 2, 2, 1, 2, 2, 1, -1, -2, 4, 3, 1, 1, 0, -1, -3, -5,
+ 5, 3, 1, -1, -2, -3, -4, -6, 5, 3, 0, -2, -3, -5, -6, -7,
+ 4, 3, 0, -2, -3, -4, -5, -5, 4, 3, 0, -1, -2, -2, -3, -3,
+ 0, 0, 0, 0, -1, -5, -2, 6, 0, 0, 0, 1, -1, -6, -2, 8,
+ 0, 0, 0, 2, 0, -6, -3, 9, 0, -1, 0, 2, 0, -7, -2, 10,
+ 0, -1, 0, 2, -1, -8, -3, 10, 0, -1, -1, 2, -1, -7, -3, 9,
+ 0, -1, 0, 1, -1, -6, -3, 8, 0, 0, 0, 1, 0, -5, -2, 7,
+ 2, 3, 3, 2, 1, 0, -1, -1, 3, 4, 3, 2, 1, 0, -1, -2,
+ 3, 4, 4, 2, 1, -1, -2, -3, 2, 3, 3, 2, 0, -1, -2, -3,
+ -1, 0, 1, 1, 0, -1, -2, -2, -5, -4, -3, -1, 0, 1, 1, 1,
+ -8, -8, -5, -1, 1, 3, 4, 3,-10, -9, -5, 0, 3, 5, 6, 5,
+ -5, -1, 4, 5, 3, 1, 0, 0, -6, -1, 4, 5, 2, 0, -1, -2,
+ -6, -1, 5, 4, 2, -1, -2, -2, -7, -1, 4, 4, 1, -2, -3, -3,
+ -6, -1, 5, 4, 1, -2, -3, -3, -5, 0, 4, 4, 1, -1, -2, -2,
+ -4, 0, 5, 4, 1, -1, -1, -2, -3, 1, 4, 3, 1, -1, -1, -2,
+ -2, -3, -2, 1, 4, 6, 5, 3, -3, -4, -4, 0, 3, 5, 4, 2,
+ -3, -5, -5, -1, 2, 4, 3, 1, -4, -6, -4, -1, 2, 4, 2, -1,
+ -2, -4, -3, 1, 2, 4, 2, -1, -2, -4, -2, 1, 3, 3, 1, -2,
+ -2, -3, -2, 1, 3, 3, 1, -2, -2, -2, -1, 1, 3, 3, 0, -2,
+ -4, -4, -3, -2, -1, 2, 5, 7, -4, -4, -3, -3, -2, 1, 5, 7,
+ -2, -3, -2, -3, -3, -1, 3, 5, -1, -1, 0, -2, -3, -2, 2, 4,
+ 1, 1, 1, -1, -4, -3, 1, 3, 4, 3, 2, -1, -4, -3, -1, 1,
+ 6, 4, 3, 0, -3, -3, -2, 0, 6, 5, 3, 1, -2, -3, -2, -1,
+ 12, 11, 8, 4, 0, -2, -2, -1, 10, 9, 6, 2, -1, -2, -1, 0,
+ 4, 3, 2, 0, -1, -1, 0, 1, -1, -1, -1, -1, -2, 0, 1, 2,
+ -3, -5, -4, -2, -2, 0, 2, 3, -5, -5, -4, -2, -1, 0, 1, 2,
+ -5, -5, -4, -2, -1, 0, 1, 1, -4, -4, -3, -2, -2, -1, 0, 0,
+ 3, 3, 2, -1, -3, -4, -3, -2, 3, 2, 0, -2, -4, -4, -3, -2,
+ 2, 2, 1, -1, -3, -5, -4, -3, 3, 3, 3, 1, -2, -3, -3, -3,
+ 4, 4, 4, 3, 0, -2, -2, -2, 5, 5, 5, 3, 0, -1, -2, -2,
+ 5, 5, 4, 2, -1, -2, -3, -2, 3, 3, 3, 0, -2, -4, -4, -4,
+ -1, -1, 4, -2, -2, 6, 2, -5, -1, 0, 4, -2, -3, 6, 2, -6,
+ -1, 0, 4, -2, -3, 7, 3, -7, -1, -1, 4, -3, -4, 8, 3, -7,
+ 0, -1, 4, -3, -4, 7, 3, -6, -1, -1, 4, -3, -4, 7, 3, -6,
+ -1, -1, 3, -3, -4, 6, 3, -6, -1, 0, 3, -2, -3, 6, 3, -5,
+ 1, -2, -7, 2, 5, -2, -1, 1, 1, -2, -8, 3, 6, -3, -1, 2,
+ 2, -2, -9, 4, 7, -4, -2, 2, 3, -1, -9, 5, 7, -4, -1, 3,
+ 3, -1, -9, 4, 7, -4, -2, 2, 3, -1, -7, 4, 6, -4, -2, 1,
+ 2, 0, -6, 4, 6, -4, -1, 1, 2, 0, -5, 3, 4, -3, -1, 1,
+ -2, 2, 2, 0, 0, -1, -3, -4, -2, 2, 2, 1, 1, 0, -2, -4,
+ -2, 2, 2, 2, 2, 1, -1, -2, -3, 2, 3, 3, 4, 2, 0, -2,
+ -3, 2, 3, 2, 4, 2, 0, -3, -4, 1, 2, 1, 2, 1, -1, -3,
+ -5, 0, 1, 0, 1, 1, -2, -3, -4, 0, 0, 0, 1, 0, -2, -3,
+ 0, 0, -1, -2, -2, 2, 7, 8, 0, 0, -1, -3, -2, 1, 6, 7,
+ 0, 1, -1, -3, -3, 0, 4, 5, 0, 1, 0, -1, -1, 0, 1, 3,
+ 0, 2, 1, 1, 0, -1, 0, 1, -2, 0, 1, 2, 1, 0, -1, -1,
+ -5, -2, 0, 1, 1, 0, -3, -3, -6, -4, -1, 1, 1, -1, -3, -4,
+ -4, -2, 2, 5, 6, 4, 3, 2, -5, -3, 1, 4, 4, 2, 0, 0,
+ -4, -2, 0, 2, 1, -1, -2, -2, -2, -1, 0, 1, 0, -2, -3, -2,
+ -2, 0, 0, 0, -1, -1, -2, -1, -2, -1, -1, 0, 0, 0, 1, 2,
+ -2, -2, -1, -1, 0, 1, 3, 4, -2, -3, -2, -1, 0, 2, 4, 5,
+ 2, 1, -2, -2, -1, 0, 1, 0, 1, 0, -3, -3, -1, 0, 1, 0,
+ 0, -1, -3, -3, -1, 1, 1, 1, 0, 0, -3, -1, 1, 2, 3, 3,
+ 0, -1, -3, -1, 1, 3, 3, 3, -2, -2, -4, -2, 1, 3, 4, 4,
+ -3, -3, -4, -2, 1, 3, 3, 4, -2, -3, -5, -2, 1, 2, 3, 3,
+ 4, 5, 3, 4, 4, 4, 4, 5, 3, 3, 1, 0, 0, 0, 0, 1,
+ 1, 1, -1, -2, -3, -4, -3, -2, 2, 2, 0, -2, -2, -4, -3, -2,
+ 2, 3, 1, -1, -1, -3, -3, -2, 1, 2, 0, 0, -1, -2, -2, -1,
+ 0, 1, 0, -1, -1, -3, -2, -1, 1, 1, 0, -1, -1, -2, -2, -2,
+ -2, -1, -1, 0, 1, 2, 1, 0, 1, 2, 3, 5, 6, 5, 5, 3,
+ 1, 2, 3, 4, 5, 5, 4, 3, -2, -2, -3, -3, -2, -1, 0, 0,
+ -3, -3, -4, -5, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1, 0, 0,
+ 0, 1, 0, -1, -1, 0, 0, 1, -1, 0, -1, -2, -3, -2, -2, -1,
+ 7, 7, 6, 5, 4, 2, -1, -2, 3, 3, 2, 2, 1, 0, -2, -3,
+ 0, -1, -1, -1, 0, -1, -2, -2, -1, -3, -2, -1, 0, 0, 0, 1,
+ 0, -2, -2, -1, -1, 1, 2, 2, 3, 1, -1, -1, -1, 1, 2, 2,
+ 3, 1, -2, -3, -2, -1, 1, 2, 1, -2, -5, -6, -5, -3, -2, 0,
+ 0, -1, -2, -3, -1, 0, -2, -2, 0, 0, -1, -1, 0, 1, -1, -2,
+ 0, 0, -2, -1, 0, 0, 0, -2, -1, -2, -3, -3, -2, -1, -3, -3,
+ -1, -2, -3, -3, -2, -2, -3, -4, 2, 2, 0, 0, 0, 0, -1, -2,
+ 5, 5, 3, 2, 2, 2, 0, -1, 8, 8, 6, 5, 4, 4, 2, 1,
+ -7, -8, -6, -3, -1, -1, -2, -1, -5, -5, -3, 0, 2, 1, 0, 0,
+ -1, -1, 0, 3, 4, 3, 1, 1, 2, 1, 1, 3, 4, 3, 2, 2,
+ 3, 2, 0, 2, 3, 2, 1, 2, 4, 2, -1, -1, 0, 1, 1, 1,
+ 3, 2, -2, -3, -2, -1, 0, 1, 3, 1, -3, -4, -3, -2, 0, 1,
+ -4, -2, -1, 2, 3, 3, 1, 0, -7, -5, -4, -2, 0, 0, -1, -2,
+ -6, -5, -5, -4, -2, -2, -2, -3, -1, 0, -1, -1, 0, 0, 0, -1,
+ 2, 3, 2, 2, 2, 2, 1, 0, 3, 5, 4, 3, 1, 0, 1, 0,
+ 3, 4, 3, 2, 0, -1, -1, -1, 5, 5, 3, 1, 0, -1, -1, -1,
+ 1, 1, 0, -1, -3, -5, -6, -4, 1, 1, 0, 0, 0, -3, -3, -1,
+ 0, -1, -1, 0, 1, 0, 1, 3, -2, -2, -3, -1, 2, 2, 4, 7,
+ -2, -2, -2, 0, 2, 2, 3, 6, -1, 0, 0, 1, 1, 0, 0, 3,
+ 0, 3, 3, 3, 1, -2, -3, -1, 1, 3, 4, 3, 0, -3, -5, -4,
+ 0, 2, 0, -1, -3, -4, -2, -2, 1, 4, 2, 0, -2, -3, -2, -1,
+ 3, 6, 3, 1, -2, -2, 0, -1, 4, 7, 4, 1, -2, -3, -1, 0,
+ 3, 6, 3, 0, -3, -3, -1, 0, 1, 3, 0, -1, -3, -2, 1, 1,
+ 0, 1, -1, -2, -3, -1, 2, 2, -2, -1, -3, -3, -3, -1, 1, 2,
+ 3, 1, -1, 0, 1, 0, 0, 0, 2, -1, -2, -1, 1, 0, -1, -1,
+ 1, -1, -2, 0, 1, 0, -2, -3, 0, -2, -1, 1, 3, 1, -3, -5,
+ 0, -2, -1, 2, 5, 2, -3, -5, 0, -2, -1, 4, 6, 3, -2, -5,
+ 0, -2, 0, 4, 7, 4, -2, -4, 0, -2, 0, 4, 6, 4, -2, -4,
+ -2, -2, -3, -4, -3, -2, -1, 0, 1, 1, 0, -1, -1, -1, 0, 1,
+ 3, 3, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 0, 0, 1,
+ 0, 0, 0, 0, -1, -1, -1, -1, -4, -4, -4, -4, -4, -4, -4, -3,
+ -3, -3, -2, -3, -2, -1, -1, 0, 3, 4, 4, 5, 5, 6, 6, 7,
+ -1, -2, 7, -2, -4, -1, -1, 0, -1, -2, 9, -1, -4, -1, -1, 0,
+ -1, -3, 10, -1, -4, -1, -1, 1, -1, -3, 10, -2, -3, -1, -1, 2,
+ -1, -2, 10, -2, -4, -1, -1, 2, -1, -2, 9, -2, -4, -1, -1, 2,
+ -1, -2, 8, -2, -4, 0, -1, 1, 0, -2, 7, -2, -3, -1, 0, 2,
+ 3, -4, 1, 3, -3, -2, 1, 0, 3, -5, 1, 4, -3, -2, 1, 0,
+ 3, -6, 2, 5, -3, -1, 3, 0, 3, -6, 2, 5, -3, -1, 2, 0,
+ 3, -6, 1, 5, -4, -2, 3, 0, 3, -6, 1, 5, -3, -2, 2, 0,
+ 2, -6, 1, 4, -3, -1, 1, 0, 2, -6, 1, 4, -2, -1, 1, 0,
+ 0, 0, 1, 1, 1, 0, 0, 2, 0, -1, 1, 1, 1, 0, 0, 2,
+ 0, -1, 0, 0, 0, 0, 0, 2, 0, -1, 0, 0, 0, 0, -1, 0,
+ 1, 0, 1, 0, 0, -1, -2, -1, 3, 1, 1, 0, 0, -2, -4, -3,
+ 5, 3, 2, 1, 0, -3, -5, -4, 5, 4, 2, 0, -1, -4, -5, -5,
+ 1, 0, -1, -2, -2, -3, -6, -9, 2, 0, -1, -1, 0, 0, -3, -6,
+ 1, 0, 0, -1, 0, 0, -2, -5, 2, 1, 1, 1, 1, 2, -1, -3,
+ 1, 1, 2, 1, 2, 2, 1, -1, 1, 1, 2, 1, 1, 1, 1, 1,
+ 0, 0, 2, 1, 0, 0, 2, 2, 0, 1, 2, 2, 0, 0, 2, 2,
+ -4, -3, 0, 1, 4, 6, 4, 3, -3, -2, 0, 0, 2, 4, 1, 0,
+ -1, -1, 0, 0, 1, 1, -2, -3, 1, 1, 1, 0, 1, 1, -3, -5,
+ 1, 1, 1, 0, 1, 1, -3, -5, -1, 0, 0, -1, 1, 1, -2, -4,
+ -1, 0, 0, -1, 1, 2, 0, -2, -1, 0, 0, 0, 2, 3, 1, 0,
+ -1, 0, 3, 4, 0, -4, -5, -5, 0, 0, 4, 5, 2, -2, -3, -2,
+ 0, -1, 2, 4, 2, -1, -1, 0, 0, -2, -1, 1, 0, -2, 0, 1,
+ 1, -2, -2, 0, 0, -1, -1, 1, 1, -2, -3, 0, 1, 0, -1, 0,
+ 1, -2, -2, 1, 3, 1, 0, 0, 1, -2, -1, 2, 4, 2, 0, 0,
+ 1, 2, 3, 2, 0, 2, 2, 1, -1, 0, 1, 0, -3, 1, 1, 1,
+ -1, 0, 0, -2, -4, 0, 2, 1, -1, 2, 2, -1, -5, 0, 2, 1,
+ -1, 3, 4, -1, -5, 0, 2, 1, -2, 2, 4, 0, -4, -1, 0, 0,
+ -4, 0, 2, 0, -4, -2, 0, 0, -5, -1, 2, 1, -2, 1, 3, 2,
+ 1, 0, 1, 0, 1, 2, -1, -2, 2, 0, -1, -2, 1, 3, 0, -1,
+ 3, 0, -2, -4, 0, 3, 1, 0, 5, 1, -3, -5, -2, 2, 1, 1,
+ 6, 1, -2, -5, -2, 1, 0, 1, 5, 1, -1, -5, -2, 0, -1, 0,
+ 3, 0, -2, -4, -2, 0, -1, 0, 1, -1, 0, -2, 0, 1, 0, 1,
+ 1, 1, 2, 3, 2, 1, 1, 2, -1, -1, 0, 1, 1, 0, 1, 1,
+ -4, -3, 0, 0, 1, 1, 1, 2, -4, -3, 0, 2, 2, 2, 3, 2,
+ -5, -4, 0, 1, 1, 1, 1, 2, -5, -4, -1, -1, -2, -2, -1, 0,
+ -3, -2, 0, 0, -2, -3, -2, -1, 2, 3, 4, 4, 2, 0, 0, 0,
+ -4, -2, 0, 1, 0, 0, 0, 0, -3, -1, 1, 1, 0, 0, 0, 0,
+ -2, 0, 2, 2, 0, 0, 0, 2, -1, 1, 2, 1, -1, 0, 3, 5,
+ 0, 2, 1, -1, -2, 0, 5, 6, 0, 1, 0, -3, -3, 0, 4, 6,
+ 1, 1, -2, -4, -4, -3, 1, 2, 1, 0, -2, -4, -5, -4, -2, 0,
+ -1, -3, -3, -3, -3, -2, -1, -1, 3, 2, 1, 0, 0, 1, 1, 1,
+ 5, 4, 3, 2, 1, 1, 2, 2, 2, 1, 0, -2, -2, -2, -1, -1,
+ 0, 0, 0, -1, -2, -2, -2, -2, 0, 1, 3, 3, 2, 1, -1, -1,
+ 0, 1, 3, 4, 3, 2, 1, -1, -4, -3, -1, 1, 0, -2, -3, -3,
+ -3, -4, -7, -8, -7, -4, -1, 2, 0, -1, -3, -4, -4, -2, 0, 2,
+ 1, 0, 0, -1, -3, -2, 0, 2, 2, 1, 1, 0, -1, -1, 0, 2,
+ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 1, 2, 3, 3, 2, 2, 0, 0, 1, 3, 4, 4, 3, 2,
+ 3, 3, 3, 0, -1, 0, 1, 2, 1, 1, 1, -1, -2, -1, -1, 1,
+ -2, -2, -1, -3, -3, -2, -2, 0, -4, -4, -2, -2, -2, -2, -3, 0,
+ -4, -4, -1, 1, 1, 0, -1, 2, -3, -1, 2, 3, 4, 3, 3, 5,
+ -2, 0, 2, 3, 3, 3, 3, 3, -2, -2, 0, 0, 0, 0, 0, 1,
+ 0, 2, 1, -1, -3, -1, 3, -2, -1, 0, -1, -1, -3, 0, 4, -2,
+ -2, -2, -2, -2, -2, 1, 5, -2, -3, -2, -3, -1, -2, 1, 4, -3,
+ -2, 0, -1, 0, -1, 0, 3, -5, 1, 2, 1, 2, 0, 0, 2, -5,
+ 2, 4, 2, 3, 1, 1, 3, -3, 1, 2, 1, 1, 0, 1, 4, -2,
+ 4, -3, -4, -1, 3, 3, 1, 3, 4, -4, -4, -1, 3, 2, 0, 2,
+ 4, -3, -4, 0, 2, 2, -1, 1, 4, -3, -2, 1, 2, 1, -2, 0,
+ 2, -4, -2, 1, 2, 0, -3, 0, 2, -3, -2, 0, 1, 0, -2, 2,
+ 3, -1, -1, 0, 0, 0, 0, 3, 2, -2, -2, -2, -1, -1, -1, 2,
+ 2, 2, 3, 4, 3, 1, 0, -1, 1, 0, 1, 2, 1, -1, -2, -2,
+ 2, 1, 2, 1, 1, 0, -1, -1, 4, 3, 4, 3, 2, 1, 1, 1,
+ 3, 2, 2, 2, 1, 1, 1, 1, -1, -2, -1, 0, -1, -1, -1, -1,
+ -3, -3, -2, -1, -2, -2, -2, -2, -4, -4, -3, -3, -4, -4, -3, -3,
+ 2, 1, -1, -3, -4, -2, 3, 4, 2, 2, 1, -1, -3, -2, 1, 2,
+ 1, 2, 3, 3, 0, -2, -1, -2, -1, 0, 2, 4, 2, 0, -1, -3,
+ -2, -2, 0, 3, 3, 2, 0, -3, 0, -2, -3, -1, 1, 2, 2, -1,
+ 3, -1, -4, -5, -3, 0, 2, 0, 6, 3, -2, -6, -5, 0, 3, 1,
+ -2, 3, -2, 0, 3, -2, -2, 1, -3, 4, -3, 0, 3, -2, -1, 2,
+ -3, 5, -3, 0, 4, -2, -1, 2, -2, 4, -4, -1, 3, -3, -2, 2,
+ -3, 4, -3, 0, 3, -3, -1, 2, -2, 5, -2, 0, 3, -3, -1, 2,
+ -2, 4, -3, 1, 3, -2, -1, 2, -2, 3, -2, 1, 3, -2, 0, 2,
+ 1, 0, 0, -1, 1, 2, -4, -1, 2, 0, 0, -1, 1, 2, -4, -2,
+ 1, 1, 1, -1, 2, 4, -2, 0, 0, -1, 1, -1, 2, 5, -1, 1,
+ 0, -1, 0, -2, 1, 5, -1, 1, 0, -1, -1, -2, 0, 3, -3, -1,
+ 1, 1, 0, -2, 0, 3, -3, -1, 1, 1, 0, -3, 0, 3, -2, 0,
+ 1, 0, -1, 1, 1, 2, 4, 5, 1, 0, -1, 1, 1, 1, 5, 7,
+ 0, 0, -2, -1, -1, 0, 3, 5, 0, -1, -2, -1, -1, -1, 2, 3,
+ 0, -1, -3, -1, -1, -1, 1, 2, -1, -2, -4, -2, -2, -2, 0, 0,
+ -1, -2, -2, -1, -2, -2, 0, 0, 0, -1, -1, 0, -1, -1, 0, 0,
+ 3, 3, 0, -1, -1, 1, 4, 4, 2, 3, 0, -2, -2, 0, 1, 1,
+ 2, 3, 1, -1, -1, 0, 1, 0, 1, 2, 0, -1, -1, -1, 0, -2,
+ 0, 1, 0, -1, -2, -1, 0, -2, 0, 1, 0, -1, -2, -1, 1, 0,
+ 1, 1, -1, -3, -4, -3, 1, 3, 1, 2, -1, -3, -5, -4, 1, 3,
+ -3, -2, 0, 1, 1, 1, 0, -2, 0, 1, 1, 1, 0, 0, -1, -3,
+ 1, 2, 1, 1, 0, -1, -1, -2, 0, -1, -3, -1, -1, -1, 0, -1,
+ 0, -3, -6, -3, -2, -1, 1, 1, 2, -1, -4, -3, -2, 0, 2, 2,
+ 5, 4, 1, 1, 0, 1, 3, 2, 5, 4, 2, 1, 0, -1, 0, 1,
+ -2, 0, -2, -5, -6, -3, 0, 0, -2, 0, 1, 0, -1, 1, 2, 2,
+ -2, 0, 1, 3, 2, 2, 2, 1, -2, 0, 2, 4, 3, 2, 1, 1,
+ -2, 0, 2, 3, 2, 0, -1, 0, -3, -1, 1, 1, 0, -1, -1, 1,
+ -4, -1, 1, 0, -1, -2, 0, 2, -4, -1, 0, -1, -1, -2, 1, 4,
+ -3, 0, 0, -1, 1, 1, 1, 0, -3, 1, 0, -1, 0, 0, -1, -1,
+ -1, 3, 3, 0, 1, 0, 0, 1, -3, 2, 2, -2, -1, 0, 0, 1,
+ -5, 0, 0, -2, -1, 1, 0, 2, -7, -2, 1, 0, 1, 2, 2, 2,
+ -5, 0, 3, 2, 3, 3, 2, 2, -3, 2, 4, 1, 0, 0, -2, -3,
+ 5, 2, -2, -2, 0, -1, -1, -1, 2, -1, -4, -3, -1, -2, -1, -1,
+ 0, -2, -2, 1, 2, -1, 0, 1, -1, -2, -1, 3, 3, -1, 0, 2,
+ 1, 0, 0, 3, 3, -2, -1, 2, 2, 1, 1, 3, 2, -2, -2, 0,
+ 1, 0, -1, 1, 1, -3, -3, -2, 1, 0, 1, 2, 3, 0, 0, 0,
+ -4, -5, -3, 0, 1, -1, -2, -1, -2, -3, -1, 1, 2, 0, 0, 0,
+ 1, 1, 2, 1, 2, 1, 1, 1, 3, 4, 3, 1, 0, -2, -1, -1,
+ 3, 3, 2, 0, -2, -3, -3, -2, 1, 1, 0, -1, -2, -4, -2, -2,
+ 2, 1, 0, 0, 0, -1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 3,
+ 0, 0, 0, -1, -2, -1, 1, 0, -2, -1, -1, -2, -3, -2, 0, 0,
+ -1, 0, 0, -1, -2, 0, 1, 1, 1, 1, 0, -1, -1, 1, 3, 1,
+ 2, 2, 0, -2, -1, 2, 3, 0, 3, 1, -1, -1, 1, 4, 2, -2,
+ 2, 0, -3, -1, 3, 5, 0, -5, 1, -1, -2, 0, 3, 3, -1, -6,
+ -1, 0, 3, 4, 2, 0, 1, 2, -2, -1, 0, 1, -1, -2, 0, 1,
+ -2, -3, -2, -3, -6, -7, -6, -3, 2, 2, 3, 1, -1, -2, -3, -2,
+ 2, 2, 3, 1, 0, 0, 0, 0, 2, 1, 1, 0, 1, 1, 0, 1,
+ 1, 0, 0, 0, 0, 1, 1, 2, 1, 0, -1, 0, 0, 2, 2, 1,
+ 1, 1, 3, 1, -1, -1, -1, 1, -2, -1, 0, 0, -2, -2, -1, 2,
+ -2, -2, 1, 1, 1, 0, 1, 3, -2, -2, 0, -1, 0, -1, 0, 2,
+ 0, 0, 1, 0, -1, -1, -2, 1, 3, 2, 2, 1, 0, -2, -2, 1,
+ 5, 3, 3, 2, 1, 1, 1, 4, 0, -3, -4, -5, -4, -3, -1, 1,
+ -6, -4, -1, 2, 2, 0, 0, -1, -4, -2, 1, 3, 3, 2, 2, 0,
+ -3, -2, -1, 2, 3, 3, 2, 0, -3, -2, -2, 1, 2, 1, 1, -1,
+ -2, -2, -2, 0, 2, 2, 1, -1, -1, -1, -1, 1, 2, 3, 2, 0,
+ -1, -1, -2, 1, 2, 2, 2, -1, 0, -1, -2, 0, 2, 1, 0, -1,
+ 6, 4, 2, 1, 0, 0, 0, 1, 4, 2, -1, -2, -2, -2, -1, -1,
+ 2, 1, -1, -2, -2, -2, -2, -1, 2, 2, 0, -2, -2, -2, -1, 0,
+ 0, 0, -1, -2, -2, -1, 0, 1, -3, -3, -2, -1, -1, -2, -1, 0,
+ -3, -2, 2, 3, 2, 0, -1, -2, -2, 0, 4, 5, 5, 2, 0, -1,
+ 5, 4, 2, 0, -1, -2, -1, -1, 4, 3, 2, 1, 0, -1, 0, -1,
+ 1, 1, 0, 1, 1, 0, 1, -1, -2, -1, -1, 0, 0, -2, -2, -3,
+ -1, 0, 0, 0, -1, -3, -3, -5, 0, 1, 1, -1, -1, -2, -2, -3,
+ -1, -1, -1, -2, -1, 1, 3, 1, -1, -2, -2, -1, 2, 5, 6, 5,
+ -3, -3, -2, 1, 1, -2, -1, -1, 1, 2, 3, 4, 1, -3, -1, -3,
+ 3, 2, 0, 1, -1, -3, -1, -3, 1, 0, -1, 0, -1, -1, 1, 0,
+ 1, 1, 0, 1, 2, 2, 5, 3, 1, 1, 1, 2, 2, 2, 3, 0,
+ -3, -1, -2, -2, -3, -3, -1, -3, -1, 1, 1, 0, -1, -1, 0, -2,
+ 2, 0, -2, -2, 2, 4, 1, -2, 1, 0, -2, -1, 3, 5, 2, -1,
+ -1, -2, -3, -2, 1, 3, 1, -2, -1, -2, -1, -1, 0, 2, 1, -1,
+ 0, 0, 1, 1, 1, 2, 2, 0, 0, 1, 4, 4, 2, 2, 3, 1,
+ -2, -1, 2, 1, -2, -3, -2, -3, -1, 0, 1, 0, -3, -4, -4, -5,
+ 4, 0, -3, -4, -4, -4, -2, -1, 5, 0, -1, 0, -1, -3, -2, -1,
+ 4, 0, 0, 1, 1, 0, 0, 0, 0, -3, -2, -1, 0, 0, 1, 0,
+ 0, -2, 0, 0, 1, 1, 2, 1, 2, 0, 0, 0, 1, 1, 1, 0,
+ 2, 0, -1, -1, 1, 1, 1, 0, 1, -1, -2, -2, 0, 2, 2, 2,
+ -3, -5, -2, 0, -1, -3, -3, 0, 0, -2, 0, 2, 2, 0, 0, 3,
+ 2, -1, -2, 0, 0, -1, -1, 2, 5, 2, -1, -1, -1, -1, -1, 2,
+ 5, 2, 0, -1, -1, 0, -1, 2, 2, 1, 0, 0, 0, 1, 0, 2,
+ -1, -1, 1, 1, 2, 2, 1, 2, -3, -2, 0, 0, 0, 0, -2, -1,
+ 0, 3, 2, 0, -2, -3, -3, -3, 0, 3, 3, 1, 0, 0, 1, 2,
+ -1, 0, -1, -2, -1, -1, 1, 3, -1, 0, -1, -2, -1, -1, 0, 2,
+ -1, 0, -1, -2, 0, 0, -1, 2, -1, 0, -1, -2, -1, -1, -2, 1,
+ 0, 1, 0, -3, -1, -1, -1, 2, 5, 5, 2, -1, -1, -1, 1, 3,
+ 0, 0, 1, -1, -3, -2, 0, 2, 1, 1, 3, 0, -2, -2, 0, 1,
+ 1, 1, 3, 1, 0, 0, -1, -1, 0, -1, 2, 1, 1, 0, -1, -3,
+ -1, -2, 1, 1, 1, 0, -2, -4, -1, 0, 2, 1, 1, 0, -1, -3,
+ 1, 1, 3, 2, 1, 0, -2, -3, 2, 2, 4, 2, 1, -1, -2, -4,
+ 1, 2, 2, 2, 0, -2, 0, 2, -1, -1, -2, -3, -4, -5, -3, 1,
+ 0, 1, 1, 0, -1, -1, -1, 1, 0, 1, 1, 1, 0, 0, 0, 2,
+ 0, 1, 1, 2, 1, 1, 1, 2, -1, -1, 0, 2, 2, 2, 2, 3,
+ -2, -4, -4, -1, -2, -2, -2, 0, 1, 0, 0, 1, 0, 0, 0, 1,
+ 0, -1, -3, -2, 0, 2, 2, 1, 0, -1, -2, -3, 0, 1, 1, 2,
+ 1, 0, -2, -3, -1, 0, 0, 1, -1, 0, -1, -2, 0, 0, -1, 0,
+ -1, 1, 1, 0, 2, 2, 0, 0, 0, 2, 3, 1, 3, 5, 3, 2,
+ -1, 1, 1, -2, 0, 3, 1, 1, -1, 0, 0, -4, -4, -1, -1, -1,
+ -1, 1, 1, 0, 1, 2, 1, 2, -3, 0, 1, 0, 1, 1, 0, 2,
+ -5, -3, -1, -1, 0, 1, 0, 1, -4, -3, -2, -3, -2, -1, -1, 0,
+ 0, 0, -1, -2, -2, -2, -2, 0, 3, 4, 2, 0, 0, 0, 0, 1,
+ 2, 1, 0, 0, 0, 0, -1, 0, 0, 1, 2, 3, 4, 4, 3, 2,
+ -1, 4, 7, 4, 0, 0, 0, 0, -1, 4, 6, 3, 0, 1, 1, 1,
+ 0, 3, 4, 0, -1, 0, 0, 1, 0, 1, 1, -2, -1, 0, -1, -1,
+ -1, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0,
+ -1, -3, -3, 0, 1, -1, -2, -1, -3, -4, -4, -2, -1, -2, -2, -1,
+ 2, 2, 1, 0, 1, 1, 0, -3, -2, -1, 0, 0, 1, 1, 0, -3,
+ -2, -1, 0, 1, 2, 1, 1, -2, 1, 2, 2, 2, 3, 3, 2, -1,
+ 1, 2, 1, 0, 1, 1, 2, -1, 0, 1, -2, -4, -2, 0, 1, -1,
+ 1, 1, -1, -3, -2, 0, -1, -3, 1, 2, 0, -1, 0, 1, -1, -4,
+ -1, -1, -2, -2, 0, 3, 4, 3, 1, 1, -1, -3, -2, 0, 0, 0,
+ 2, 2, 2, 2, 2, 1, -1, -1, 1, 1, 1, 3, 3, 0, -2, -2,
+ 0, -1, -1, -1, 0, -2, -1, -1, -1, -3, -4, -3, -2, -2, 0, 2,
+ -1, -1, 0, 1, 2, 2, 3, 5, -2, -1, -1, 0, 0, 0, 0, 1,
+ -2, -3, 2, 0, 0, 1, 1, -1, -1, -4, 1, -2, -1, 2, 2, 0,
+ 1, -4, 0, -2, -2, 1, 1, -1, 2, -3, 1, -1, -1, 1, 1, -1,
+ 3, -2, 3, 1, 0, 1, 1, -1, 1, -3, 2, 1, 0, 1, 0, -1,
+ -1, -5, 1, 0, -1, 0, 1, 1, 0, -3, 3, 3, 1, 2, 3, 3,
+ 0, -1, -2, 1, 5, 5, 2, -1, 1, -1, -2, -1, 1, 1, -2, -5,
+ 1, 1, -1, -2, -1, -1, -1, -3, 1, 1, -1, -1, -1, 2, 4, 3,
+ -1, -1, -1, -1, -1, 0, 4, 3, -1, -1, 0, 1, -1, -3, -1, -1,
+ 0, 0, 0, 2, 2, 0, 0, -1, 0, -2, -3, 0, 1, 1, 3, 2,
+ 2, 3, 2, 1, 0, 0, -2, -2, 2, 3, 0, 1, 1, 3, 3, 2,
+ 0, 0, -3, -1, -1, 2, 2, 3, -2, -2, -3, 1, 1, 2, 1, 1,
+ -2, -1, -2, 2, 1, 1, -1, -2, 0, 1, 0, 2, 0, 0, -2, -2,
+ 0, 1, 0, 2, 0, 0, -2, -2, -3, -2, -2, 0, -1, -2, -2, -3,
+ 0, 1, -1, 3, -1, 1, 3, -1, 0, 1, -1, 3, -1, -1, 2, -3,
+ 1, 1, -2, 3, -1, -3, 0, -3, 2, 2, -2, 3, 0, -2, 1, -2,
+ 1, 1, -3, 3, -1, -2, 1, -3, 1, 1, -3, 3, 0, -1, 1, -2,
+ 1, 2, -1, 4, 0, -1, 1, -2, 0, 1, -1, 3, -1, -3, 0, -3,
+ -3, -3, -1, 1, 2, 1, -1, -2, -2, -2, 0, 2, 1, 0, -2, -2,
+ -3, -2, 1, 2, 1, -1, -2, -1, -3, -2, 2, 4, 0, -2, -2, 1,
+ -3, -1, 2, 4, 0, -2, -2, 2, -1, 1, 4, 3, -1, -3, -2, 2,
+ 0, 2, 4, 2, -1, -2, -1, 2, 0, 1, 2, 0, -1, 0, 1, 3,
+ 3, 0, -5, 1, 4, 0, 0, 1, 1, -2, -5, 2, 5, -1, -2, 1,
+ -1, 0, 0, 3, 3, 1, 0, -1, -2, 3, 4, -2, -3, -1, 0, -2,
+ -3, 3, 5, -3, -3, 0, 0, -2, -1, 3, 2, -2, -2, 2, 2, -1,
+ 2, 0, 0, -1, 0, 0, 0, 0, 0, -3, -2, 1, 3, 0, -2, -2
+};
+
+static const int8 *const s_svq1InterCodebooks[6] = {
+ s_svq1InterCodebook4x2, s_svq1InterCodebook4x4,
+ s_svq1InterCodebook8x4, s_svq1InterCodebook8x8,
+ 0, 0
+};
+
+static const int8 s_svq1IntraCodebook4x2[768] = {
+ 12, 13, 13, 11, -7,-10,-15,-17,-16,-15,-12,-10, 11, 15, 15, 12,
+ 2, 17, 20, 15,-45,-24, 2, 13, 21, 20, -6,-36, 12, 16, -1,-27,
+ -18,-21, 10, 45,-11,-20, -7, 21, 43, -8,-28, 0, 33,-16,-28, 3,
+ -12,-18,-18, -6,-20,-10, 28, 55, -5,-18,-21,-18, 56, 30, -6,-20,
+ -34, 27, 29,-22,-30, 29, 26,-25, 30, 34, 33, 26,-25,-31,-35,-33,
+ -31,-35,-36,-32, 29, 36, 37, 31,-71,-12, 38, 34,-63, -1, 42, 33,
+ 58, 37,-31,-60, 55, 34,-33,-61,-57,-57, 22, 93,-57,-58, 21, 93,
+ 59, 69, 70, 62,-63,-68,-68,-60,-64,-71,-71,-64, 63, 73, 72, 62,
+ -2, 0, 7, 15,-11,-10, -3, 5, -5, -8,-10,-10, 1, 9, 14, 9,
+ 15, 8, -4,-11, 12, 2,-11,-12, -8, 0, 19, 28, 4, -1,-15,-26,
+ -15, 27, 2,-14,-14, 22, 1, -9, -4, -6,-13,-10, -6,-14, 6, 47,
+ -35,-20, 6, 23, 6, 9, 6, 4, -6, 2, 23,-22, -7, 4, 28,-21,
+ 20,-22, -2, 6, 22,-28, -5, 8,-10,-18,-16,-12, 36, 19, 2, -1,
+ -3, 0, 4, 8,-45,-10, 23, 23, 40, 15,-20,-35, -4, -1, 4, 1,
+ 9, -5,-33, 24, 8, 3,-26, 19, -1, 4, 6, -3, 32, 25,-13,-49,
+ 24, 24, 15, 7,-17,-27,-19, -7,-47, 0, 39, 24,-21, -6, 7, 4,
+ -1, 0,-10,-13, 1, 1, 5, 16, 20, 5, -3, -9, -1, -4, -2, -6,
+ -17, -7, 1, 4, 12, 7, 0, 0, 3, 0, 12, 11, -3, 1, 0,-23,
+ 4, 17, -6, 0, 6, 3,-25, 0,-17, 10, 8, 5,-14, 4, 1, 4,
+ 13, 10, 4, 2,-23, -9, 1, 2, 3, -3, 1, 7, 1,-23, -7, 20,
+ -7,-18, 2, 12, -5, -4, 10, 9, 4, 10, 7,-24, 6, 3, 4,-10,
+ 22,-14,-22, 6, 0, 5, 5, -1, -4, 3,-11, -4, -7, 31, 7,-14,
+ -5,-16, -1, 42, -4, -2, -9, -5, 5, -8, -6, -3, 42, -4,-21, -5,
+ -18, 12, 20,-12, 13,-13,-10, 7, -8, -9, -2,-18,-16, 6, 40, 8,
+ 10, -1, 0, 4, -3, 4, -1,-13, -2, 6, 1,-15, 5, 3, 1, 2,
+ -4, -2, 1, 3, 15, 0, -9, -4, -3, -4, -4, -4, -3, 5, 16, -3,
+ 2, 13, 3, 4, -3, -8,-10, 0, -6, -2, -4, -1, -2, -3, -6, 23,
+ 6, -6, 7, 1, 4,-18, 5, 1, -1, 1,-15, 14, -5, 6, -4, 4,
+ 2, 2, 2, 6,-24, 2, 7, 3,-26, 0, 3, 3, 5, 7, 1, 6,
+ 14, -2,-18, -3, 7, 5, -4, 2, -6, 3, 32, 1, -6, -6, -6,-12,
+ 5,-36, 7, 6, 9, -1, 11, 0, 4, 4, 5, 3, 4, 15, 3,-38,
+ 10, 23, -5,-42, 0, 4, 4, 4, 23, 17, -6,-13,-13,-37, 1, 29,
+ 5,-14, -1, 1, 5, 0, 3, 1, 0, 4, -5, 2, 8, 0, 0,-10,
+ 4, 7, -2, -3,-10, 3, 1, 1,-12, -1, 13, 3, 0, -1, 1, -3,
+ 0, -1, 3, 1, -6, -9, 3, 9, -6, 1, -4, -6, 8, -1, 0, 8,
+ -3, -3, 0, 18, -5, -1, -4, -1, -8, -2, 3, -4, 0, 17, -1, -5,
+ 5, -2, 9,-10, 1, -5, 6, -5, 4, 2, 2, 3, 10,-14, -8, 1,
+ -1, -2,-18, -1, -1, 20, 1, 2, -1, 1, -9, 1, -1, -9, 22, -4,
+ 6, -4, 8, -3, -1, 7,-19, 5, -7, 31, -4, -4, -6, 0, -5, -5,
+ -7, -8,-19, -4, 1, 1, 4, 32, 38, -1, -8, 4, -7, -8, -6,-12,
+ -1, 0, -7, 1, -1, 9, -1, 0, 9, -1, -1, 0, 2, -6, 1, -3,
+ -12, 0, 2, 1, 1, 1, 8, 0, 9, 1, 0, 2, -2, 1,-11, 0,
+ 0, 8, 2,-10, -1, 2, -1, 0, -2, -4, 0, -5, -2, -1, -1, 14,
+ -3, 7, -1, 5, 0,-10, 1, 1, -1, -5, 14, -1, -2, 1, -3, -2,
+ -6, 0, 0, 6, 2, 3, -9, 4, 4, -5, -1, -1, -7, 3, 8, -1,
+ 2, -4, -1,-11, 11, 2, 1, 0, -1, 2, 3, 9, 0, 2, 0,-15,
+ 3, 5,-20, 3, 3, -1, 3, 3, 1, -1, 16, 1, 2,-29, 9, 2,
+ -13, -6, -1, -3, 36, -1, -8, -3, 2, 5, 4, 2,-37, 9, 11, 3
+};
+
+static const int8 s_svq1IntraCodebook4x4[1536] = {
+ -11, -3, 3, 6,-10, -1, 5, 7, -9, -1, 6, 7, -9, -1, 4, 6,
+ 5, 7, 0,-14, 6, 9, 2,-15, 6, 9, 2,-15, 4, 6, 0,-14,
+ 16, 3, -5, -6, 16, 1, -8, -8, 14, -1, -9, -9, 12, 0, -8, -8,
+ 8, 12, 16, 17, -2, 2, 6, 9,-10, -8, -4, 0,-15,-14,-11, -7,
+ -7,-10, -2, 16, -7,-11, -3, 18, -7,-11, -1, 20, -6, -8, 1, 19,
+ -9,-13,-16,-17, 2, -2, -7, -9, 11, 8, 4, -1, 16, 15, 11, 7,
+ -22, -2, 13, 15,-24, -2, 14, 16,-25, -4, 13, 15,-25, -6, 10, 13,
+ 26, 26, 22, 16, 17, 15, 9, 3, -2, -6,-11,-14,-20,-25,-28,-28,
+ -27,-27,-25,-21,-16,-15,-11, -7, 3, 8, 12, 13, 23, 28, 31, 30,
+ 20, 16, -7,-33, 22, 19, -6,-35, 22, 19, -6,-34, 20, 17, -6,-32,
+ -20,-20, 2, 38,-21,-22, 2, 40,-21,-22, 2, 40,-20,-20, 3, 38,
+ -47, -4, 24, 26,-50, -3, 26, 27,-50, -3, 26, 27,-47, -4, 24, 26,
+ 45, 6,-23,-27, 48, 5,-25,-28, 48, 5,-26,-28, 44, 6,-24,-27,
+ -30,-36,-10, 76,-31,-37,-11, 78,-31,-37,-11, 78,-31,-36,-10, 77,
+ -53,-32, 35, 52,-54,-34, 36, 52,-54,-34, 36, 52,-53,-33, 34, 51,
+ -93,-34, 62, 65,-93,-34, 62, 66,-93,-34, 62, 65,-93,-34, 60, 64,
+ -7, 0, 2, 2, -8, -1, 3, 3, -8, 0, 4, 5, -6, 1, 5, 5,
+ 3, 7, 11, 11, 2, 2, 3, 3, 1, -2, -6, -7, 1, -5,-11,-13,
+ 3, -2, -4, -3, 7, 0, -5, -5, 12, 4, -5, -7, 14, 6, -4, -7,
+ 18, 14, 3, -2, 6, 4, 0, -3, -8, -5, -2, 0,-16,-11, -2, 2,
+ -8, -6, 7, 18, -7, -8, 2, 13, -4, -6, -2, 6, 0, -4, -3, 1,
+ 1, -3,-13,-18, 0, -1, -5, -7, -1, 1, 6, 7, -2, 4, 15, 17,
+ -15,-14, -7, -2, -6, -5, -1, 0, 6, 6, 3, 1, 15, 13, 6, 1,
+ 2, -2,-11, 10, 2, -1,-12, 11, 3, -1,-12, 11, 2, -2,-11, 11,
+ -9, 14, -1, -5, -9, 15, -2, -5, -8, 16, -2, -5, -7, 15, -1, -4,
+ 2, 6, 8, 8, -2, 3, 9, 12,-11, -5, 4, 10,-19,-16, -8, 0,
+ 14, 8, -7,-15, 12, 7, -7,-14, 8, 5, -4, -9, 5, 3, -1, -4,
+ 12,-14, -2, 2, 13,-15, -1, 3, 14,-15, -1, 3, 13,-14, -1, 3,
+ 0, 6, 10,-13, 0, 6, 10,-15, 0, 7, 9,-17, 1, 6, 8,-16,
+ -8, -5, 15, -2, -8, -6, 17, -2, -8, -6, 16, -3, -8, -5, 15, -2,
+ -9,-11,-11,-10, 9, 10, 9, 8, 8, 10, 10, 9, -8, -9, -8, -7,
+ 9, 10, 9, 7, -8,-10,-10,-10, -7,-10,-11,-11, 11, 12, 11, 8,
+ 0, 10, 7, 0, 0, 7, 0, -6, 0, 2, -5, -6, -2, -1, -4, -1,
+ 5, 0, -6, -9, 2, 2, 2, 1, -2, 0, 5, 7, -6, -5, 1, 4,
+ 3, -8, 2, -1, 4, -9, 3, 0, 5, -7, 3, 0, 7, -5, 3, 0,
+ -5, -3, 2, 9, -6, -3, 1, 8, -6, -3, 1, 7, -5, -2, 0, 4,
+ 13, 8, 3, 1, -3, -5, -4, -1, -8, -7, -3, 0, -1, 1, 3, 2,
+ 3, 2, -5,-12, 4, 3, -2, -9, 3, 4, 1, -4, 3, 5, 4, -1,
+ -9, -8, -4, 0, 8, 6, 2, 0, 10, 8, 3, 0, -6, -5, -3, -1,
+ -3, -9,-12, -5, 0, -3, -5, 0, 2, 3, 2, 4, 5, 8, 7, 6,
+ -1, -2, 5, 12, -1, -1, 5, 9, 2, 1, -1, -2, 2, -1,-11,-17,
+ -7, 3, 3, -1, -9, 3, 4, -1,-10, 4, 6, -1, -9, 5, 7, 0,
+ -18, -7, 2, 2, -8, 1, 5, 3, 3, 4, 1, 0, 9, 5, -2, -3,
+ -2, 0, 6, 8, -4, -5, -5, -3, 1, -2, -6, -8, 10, 9, 3, -1,
+ 0, -2, -2, 0, 0, -4, -5, 0, -2, -8, -4, 8, -5, -7, 6, 24,
+ 9, 1, -7, 1, 9, 1, -8, 1, 8, 0,-10, 1, 8, -1,-11, -1,
+ 8, 8, 6, 3, 5, 4, 3, 2, -2, -3, -1, 0,-10,-13, -8, -4,
+ 0, 4, 2, -3, 0, 6, 3, -5, 3, 10, 2,-12, 5, 10, -4,-22,
+ 0, -4, -1, 3, 1, -4, -1, 5, 1, -5, 0, 8, -1, -6, -2, 7,
+ -1, -1, -2, -4, -1, -2, -4, -6, -1, -1, -1, -2, 1, 5, 10, 9,
+ 10, 3, 0, -2, 6, -1, -2, -5, 3, -1, -2, -6, 2, 0, 0, -5,
+ 6, 3, 0, 0, 6, 3, 1, 1, 4, -2, -2, 1, 0, -9, -9, -2,
+ -11, -3, 1, 2, -6, 2, 4, 5, -3, 2, 3, 4, -2, 1, 1, 2,
+ -6, -4, -1, -2, 2, -1, -1, -2, 10, 2, -2, -2, 11, 2, -4, -1,
+ 6, 0, -2, 2, 3, 3, 0, 0, -6, 3, 3, 0,-17, -1, 5, 0,
+ -1, 4, 10, 11, -3, -2, 0, 1, -3, -4, -5, -3, -1, -2, -2, -1,
+ 2, -3, -9,-12, 3, 3, 3, 2, 2, 2, 4, 4, 2, 1, -1, -2,
+ -2, 9, 5,-10, -3, 5, 5, -5, -2, 1, 2, 0, -1, -2, -2, 1,
+ -2, -3, 7, -2, -1, -3, 7, -3, -1, -2, 8, -4, -2, -2, 7, -3,
+ 1, -8, -3, 12, 2, -2, -2, 4, 1, 3, 0, -5, -1, 5, 2, -7,
+ -1, 3, 1, -5, -7, -2, 3, 1, -2, -7, -2, 2, 20, 3, -5, -1,
+ 5, 0, -3, -2, -7, -7, 0, 6, -6, 0, 7, 6, 2, 6, 0, -7,
+ -2, 6, -7, 1, -2, 7, -8, 3, -2, 7, -7, 3, -1, 7, -6, 2,
+ -5, -2, 5, 7, 4, 1, -4, -8, 6, 3, -2, -5, -7, -5, 3, 7,
+ -1, -1, 6, 5, 0, -1, 1, -4, 2, 1, 0, -7, 1, 0, 0, -4,
+ -8, 0, 3, 1, -2, 1, -1, -1, 1, -1, -3, 1, 1, -2, 1, 9,
+ 5, 2, -3, -4, -1, 0, -1, -3, -3, 1, 3, 1, -4, 0, 4, 2,
+ 2, -2, -2, 12, 0, -2, -5, 3, -1, 0, -3, 1, -3, -1, -2, 1,
+ 1, 5, 3, 0, -6, -4, -2, 1, 0, -2, -2, 2, 6, 1, -4, -1,
+ -3, -5, -5, -1, 3, 5, 5, 4, 0, 3, 1, -1, -2, 1, -2, -3,
+ 2, -4, -5, -3, 4, -2, -3, -2, 6, 0, -1, -1, 7, 1, 0, 0,
+ -3, -2, -2, 0, -2, -3, -5, -1, -2, 2, 0, -1, -1, 11, 9, -1,
+ 0, 1, -1,-10, -1, 1, 0, -6, 1, 0, 1, 4, 2, -5, -1, 13,
+ -2, 4, 5, 0, -5, 1, 6, 3, -6, -2, 3, 2, -5, -2, 0, -2,
+ -1, 1, 1, -2, -1, -2, 0, 2, 5, 5, 5, 7, 0, -4, -8, -7,
+ 0, 2, -1, -5, -1, 2, 2, -3, 0, 5, 3, -5, 3, 8, 2,-12,
+ 8, 4, 0, -2, 10, -1, -4, -1, 3, -6, -3, 0, -4, -5, 0, 0,
+ 0,-10, -4, 2, -1, -6, 3, 5, -1, -3, 6, 4, 0, -2, 4, 2,
+ 0, 8, 1, -1, 0, 11, 1, -3, -1, 6, -2, -4, -3, -2, -7, -4,
+ 0, -1, -1, -1, 4, 5, 6, 5, -5, -9, -8, -5, 2, 2, 3, 2,
+ 0, 2, 6, 1, 2, 0, 3, 0, 1, -2, -1, -2, 0, -1, -3, -6,
+ 0, 0, 2, 0, 4, 0, 2, 1, 5, -2, 0, 0, -2, -9, -1, 2,
+ 0, 1, 0,-10, -1, 1, 8, 0, -1, -2, 4, 0, 1, -1, 2, -1,
+ -3, -2, 2, -1, -3, -1, 2, -3, 0, -1, 1, 0, 8, 1, -1, 3,
+ 0, 1, 1, 2, 0, -4, -2, 0, -1, -5, 1, -1, -2, -1, 11, 2,
+ 1, 5, -2, -2, 0, 2, -4, 0, -2, 1, -5, 1, 0, 5, 0, 1,
+ -5, -3, 0, 6, -4, 2, 0, 0, -3, 5, 1, 0, -3, 3, 0, 0,
+ 3, -2, -3, 1, 1, -4, 0, 8, -2, -3, -2, 3, 1, 2, -1, -1,
+ 1, 1, 0, 2, 2, 0, 1, 6, 1, -1, 2, 1, 0, 3, 0,-19,
+ 1, -3, -2, 2, 6, 5, -2, -7, -3, 1, 3, 1, -1, -1, 0, 2,
+ -8, -1, -1, -4, 1, 1, -1, 2, 4, 3, 2, 3, -5, 1, 3, 0,
+ 0, 2, -1, 1, -3, 0, 0, 5, -5, -2, 0, 8, -4, -4, -4, 6,
+ 1, 2, 1, 2, 2, 2, -3, 2, 4, 0, -9, 0, 7, 0,-11, 1,
+ 0, 0, 0, -2, 3, 3, -1, -6, 4, 3, -3,-10, -1, 2, 6, 2,
+ 7, -2, -3, 5, -4, 0, 3, -1, -4, 2, 1, -7, 2, -1, -1, 3,
+ 3, 2, 2, 2, -5, -7, -7, -5, 5, 6, 4, 2, -2, -1, 0, 1
+};
+
+static const int8 s_svq1IntraCodebook8x4[3072] = {
+ 5, 6, 6, 6, 7, 7, 8, 8, 0, 0, 0, 0, 0, 1, 2, 3,
+ -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3,
+ 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 4, 4, 5, 5, 5,
+ -1, 0, 1, 1, 2, 3, 4, 4, -9,-10, -9, -9, -8, -7, -6, -5,
+ -4, -4, -5, -6, -6, -7, -7, -7, 0, -1, -2, -2, -3, -3, -4, -4,
+ 4, 4, 3, 3, 2, 1, 1, 0, 7, 7, 7, 6, 6, 5, 4, 4,
+ 2, 4, 5, 6, 4, 1, -3, -6, 3, 4, 5, 5, 4, 0, -5, -8,
+ 2, 3, 4, 4, 2, -2, -7,-10, 2, 2, 2, 1, 0, -4, -9,-12,
+ -9, -7, -3, 1, 4, 4, 3, 3,-10, -7, -2, 3, 5, 5, 3, 3,
+ -9, -6, -2, 3, 6, 5, 4, 3, -8, -6, -1, 3, 4, 4, 3, 2,
+ -5, -5, -5, -5, -3, 1, 4, 7, -5, -5, -5, -4, -2, 1, 6, 8,
+ -4, -5, -4, -3, -1, 3, 8, 10, -3, -4, -3, -2, 1, 5, 9, 11,
+ -2, -2, -2, -2, -2, -2, -2, -2, -4, -5, -5, -5, -5, -5, -5, -4,
+ -3, -4, -4, -4, -4, -4, -4, -3, 9, 10, 10, 11, 11, 11, 10, 10,
+ 7, 4, 1, -2, -4, -6, -9,-10, 9, 7, 3, 0, -2, -4, -8, -9,
+ 11, 8, 4, 2, 0, -3, -6, -8, 11, 9, 5, 3, 1, -2, -5, -7,
+ -13,-13,-13,-12,-11,-10, -8, -8, 0, 1, 2, 3, 4, 4, 4, 3,
+ 3, 4, 5, 6, 6, 6, 5, 4, 3, 4, 4, 4, 3, 3, 3, 2,
+ 10, 10, 11, 10, 9, 9, 8, 7, 6, 6, 6, 6, 5, 4, 3, 2,
+ 0, 0, 0, -1, -2, -3, -4, -4,-10,-10,-11,-12,-13,-14,-14,-14,
+ 16, 16, 17, 16, 15, 13, 12, 11, -1, -2, -3, -4, -4, -4, -4, -3,
+ -4, -5, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -6, -6, -5, -5,
+ -13,-13,-13,-12,-11,-10, -8, -6, -9, -8, -7, -6, -4, -2, 0, 1,
+ -2, -1, 1, 3, 5, 7, 8, 9, 5, 7, 9, 11, 13, 14, 15, 15,
+ 16, 14, 11, 7, 2, -3, -7, -9, 14, 12, 8, 3, -1, -6, -9,-11,
+ 11, 9, 4, 0, -4, -8,-11,-13, 8, 5, 1, -3, -6,-10,-12,-14,
+ -18,-15, -9, -3, 1, 6, 9, 11,-17,-13, -7, -1, 3, 7, 11, 12,
+ -15,-11, -5, 1, 5, 9, 12, 13,-13, -9, -3, 2, 5, 9, 11, 13,
+ 22, 21, 19, 15, 10, 3, -4, -9, 20, 18, 15, 9, 2, -5,-12,-17,
+ 16, 13, 8, 1, -7,-14,-20,-24, 10, 6, -1, -8,-15,-21,-25,-27,
+ -25,-23,-20,-14, -7, 1, 9, 14,-23,-21,-16, -9, 0, 9, 16, 21,
+ -20,-16,-10, -1, 8, 16, 22, 25,-15,-11, -3, 6, 14, 20, 25, 27,
+ -4, -2, 0, 1, 2, 2, 2, 2, -5, -2, 0, 2, 3, 3, 3, 3,
+ -6, -4, -1, 1, 2, 3, 3, 3, -7, -5, -2, 0, 1, 1, 2, 2,
+ 2, 1, 1, 1, 1, 0, -2, -3, 3, 3, 2, 1, 0, -1, -3, -4,
+ 4, 3, 2, 1, 0, -2, -4, -6, 5, 4, 3, 1, -1, -3, -5, -6,
+ 5, 6, 6, 4, 2, 0, -2, -3, 3, 4, 4, 4, 3, 1, 0, -1,
+ -2, -2, -1, -1, -1, -1, -2, -2, -5, -4, -3, -2, -2, -2, -3, -3,
+ -1, -1, -1, -1, -1, -1, -1, -1, -3, -4, -4, -4, -3, -3, -3, -3,
+ -1, -1, -1, -1, -1, -1, -1, -2, 5, 6, 6, 6, 6, 5, 4, 3,
+ 4, 4, 4, 4, 4, 5, 6, 7, 0, -1, -1, -1, -1, 0, 1, 2,
+ -2, -3, -3, -3, -3, -2, -1, 0, -3, -3, -4, -4, -4, -3, -2, -1,
+ 0, -2, -4, -4, -2, 0, 2, 3, 0, -2, -3, -3, -1, 2, 4, 5,
+ -1, -2, -4, -3, 0, 3, 5, 6, -2, -3, -4, -3, -1, 2, 4, 5,
+ 9, 4, 0, -3, -3, -1, 0, 1, 8, 4, -1, -4, -3, -1, 1, 2,
+ 6, 2, -3, -5, -4, -2, 0, 1, 5, 1, -3, -4, -4, -2, 0, 1,
+ 5, 3, 1, -1, -4, -8,-10,-10, 3, 3, 2, 1, 0, -2, -3, -4,
+ 1, 1, 1, 2, 3, 2, 1, 0, -1, 0, 1, 2, 3, 4, 3, 2,
+ 0, 1, 2, 2, 1, -1, -3, -3, 0, 1, 1, 1, -1, -2, -4, -3,
+ -3, -3, -3, -3, -3, -3, -1, 2, -4, -4, -3, 0, 3, 7, 12, 14,
+ -5, -5, -6, -6, -6, -6, -6, -5, 2, 2, 2, 1, 0, 0, 0, 0,
+ 4, 4, 3, 2, 1, 0, 0, 0, 6, 6, 5, 4, 2, 2, 1, 1,
+ -7, -7, -6, -3, 0, 4, 7, 8, -1, -2, -3, -3, -2, -1, 1, 2,
+ 3, 3, 1, -1, -2, -2, -2, -1, 6, 6, 4, 2, 0, -2, -2, -2,
+ -6, -5, -2, 2, 5, 9, 11, 12, -4, -4, -2, 0, 2, 4, 5, 6,
+ -3, -2, -2, -2, -2, -1, 0, 1, -2, -2, -2, -3, -3, -3, -3, -2,
+ -7, -3, 1, 3, 3, 0, -3, -5, -6, -2, 3, 5, 4, 1, -3, -5,
+ -5, -1, 4, 6, 5, 2, -3, -4, -4, 0, 5, 7, 6, 3, -1, -3,
+ 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3, -3, -3, -3, -2, -1,
+ 6, 7, 8, 9, 9, 8, 7, 6, -4, -4, -5, -5, -6, -6, -5, -4,
+ -9, -8, -6, -4, 0, 3, 6, 6, -5, -4, -1, 3, 5, 6, 5, 3,
+ 1, 3, 6, 6, 4, 1, -2, -5, 6, 7, 5, 1, -3, -7,-10,-11,
+ 10, 9, 5, 1, -3, -6, -6, -4, 5, 3, -1, -5, -6, -5, -2, 2,
+ -2, -4, -6, -6, -4, 1, 6, 10, -6, -7, -7, -4, 1, 7, 11, 12,
+ 6, 5, 3, 2, 0, 0, 0, 0, 2, 1, -1, -2, -3, -2, -1, -1,
+ 0, -1, -2, -4, -4, -2, -1, 1, 0, 0, -1, -2, -1, 0, 2, 3,
+ 0, -1, -2, -2, -2, -2, -1, -1, 5, 4, 2, 1, 0, 0, 0, 0,
+ 6, 5, 3, 1, 0, 0, 0, 0, 2, 0, -2, -4, -4, -3, -2, -2,
+ -7, -4, 0, 2, 2, 2, 2, 1, -7, -3, 0, 0, 0, 0, 0, 0,
+ -4, -1, 1, 1, 0, 0, 0, 1, -1, 1, 2, 2, 2, 2, 3, 3,
+ -2, 0, 2, 2, 1, 1, 1, 1, -1, 1, 2, 2, 1, 0, 0, -1,
+ 0, 2, 4, 2, 0, -1, -2, -3, 1, 2, 3, 1, -2, -4, -6, -6,
+ 1, 2, 2, 4, 5, 6, 4, 1, 0, -1, -1, -1, 0, 0, -2, -4,
+ 0, 0, -1, -2, -2, -2, -4, -6, 2, 1, 0, 0, 1, 1, -1, -3,
+ 1, 1, 1, 1, 1, 2, 3, 3, 0, 0, 1, 0, 1, 2, 4, 4,
+ -1, -1, -1, -1, 0, 1, 2, 3, -4, -4, -5, -5, -5, -3, -1, 0,
+ -6, -5, -5, -4, -3, -2, -1, -1, -1, 0, 0, 1, 1, 2, 3, 3,
+ 0, 1, 1, 1, 2, 2, 3, 4, 0, 0, -1, -1, 0, 1, 2, 3,
+ 0, 1, 1, 1, 0, 0, -1, -1, 1, 3, 3, 2, 1, -1, -2, -2,
+ -2, 0, 2, 2, 2, 2, 1, 1, -9, -8, -4, -2, 1, 3, 3, 3,
+ -1, -1, -1, -2, -3, -3, -3, -4, 0, 0, 0, -1, -2, -2, -3, -3,
+ 2, 2, 2, 0, -1, -1, -1, -1, 5, 5, 4, 3, 2, 2, 2, 2,
+ 6, 3, -1, -4, -3, -1, 1, 1, 2, -1, -3, -4, -1, 2, 2, 0,
+ -1, -2, -2, 1, 4, 4, 1, -3, -2, -1, 1, 4, 6, 3, -3, -8,
+ 3, 3, 2, 1, -1, -2, -2, -2, -4, -4, -2, -1, 1, 3, 4, 4,
+ -4, -5, -5, -4, -2, 0, 2, 2, 7, 7, 4, 1, -1, -2, -3, -2,
+ -1, 1, 3, 0, -4, -6, 0, 6, -2, 1, 4, 1, -4, -6, -1, 7,
+ -3, 1, 4, 2, -3, -6, -1, 6, -2, 0, 3, 2, -2, -5, -1, 4,
+ 1, -1, -2, 1, 4, 4, -1, -7, 1, -1, -4, -1, 5, 6, 0, -6,
+ 3, 0, -4, -3, 3, 6, 2, -4, 3, 0, -5, -4, 1, 4, 1, -3,
+ 2, 2, 3, 3, 3, 3, 2, 2, -4, -5, -6, -7, -7, -7, -7, -6,
+ 1, 2, 3, 3, 3, 3, 2, 2, 0, 0, 1, 1, 1, 2, 2, 1,
+ 3, -3, -3, 3, 4, -2, -2, 2, 3, -4, -4, 4, 4, -4, -4, 2,
+ 4, -4, -4, 4, 4, -4, -3, 3, 3, -3, -4, 3, 3, -3, -3, 3,
+ -2, -2, -2, -2, -2, -2, -1, -1, 6, 7, 8, 8, 8, 7, 6, 5,
+ -5, -6, -7, -7, -8, -7, -6, -5, 1, 1, 2, 2, 2, 2, 1, 1,
+ 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0,
+ -2, -3, -2, -2, -2, -3, -3, -3, 2, 3, 5, 6, 4, 2, 1, 0,
+ 8, 6, 2, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, -1, -1, -1,
+ 1, -1, 0, 0, 0, -1, -2, -3, -2, -2, -1, 0, 0, -2, -4, -5,
+ 3, 1, -1, -2, -3, -4, -5, -5, 2, 1, 0, 0, 1, 1, 0, 0,
+ 0, -1, -1, 0, 2, 2, 2, 2, -1, -2, -1, 1, 2, 2, 2, 2,
+ 0, -1, -2, -1, -1, -1, -1, 0, -1, -2, -2, -1, -1, 0, 0, 1,
+ 2, 1, 1, 2, 2, 1, 1, 0, 6, 5, 3, 1, 0, -2, -4, -4,
+ -3, -2, -1, 0, 1, 1, 0, -1, 0, 1, 3, 4, 5, 5, 3, 1,
+ -1, -1, -1, 0, 1, 0, -1, -2, -2, -2, -2, -1, 0, -1, -2, -3,
+ 0, -1, -2, -2, -1, -1, 0, 2, 1, -1, -2, -1, -1, -1, 0, 2,
+ 1, 0, -2, -2, -2, -2, 1, 5, 1, -1, -2, -2, -2, 0, 5, 10,
+ 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0, 1, 2,
+ 1, 2, 2, 3, 4, 4, 6, 5, -3, -3, -3, -2, -2, -3, -3, -3,
+ 1, -1, -2, -2, 0, 3, 5, 7, 2, 0, -2, -3, -2, 0, 2, 3,
+ 3, 1, -2, -3, -3, -2, -1, -1, 3, 1, 0, -1, -1, -1, -1, -1,
+ 1, 3, 5, 4, 2, -1, -3, -4, -3, -2, 1, 2, 1, 0, -1, -2,
+ -5, -3, 0, 2, 2, 1, 0, 0, -3, -1, 1, 2, 2, 1, 0, 0,
+ 0, -1, -1, -1, 1, 2, 3, 4, -3, -4, -4, -3, -1, 0, 0, 1,
+ -2, -3, -2, -1, 1, 1, 1, 1, -2, -2, 0, 3, 4, 4, 3, 2,
+ -4, -4, -3, -2, -1, 1, 2, 3, 0, 1, 1, 1, -1, -2, -3, -3,
+ 3, 4, 5, 4, 2, -1, -3, -3, -2, -2, 0, 2, 2, 2, 1, 0,
+ -4, 0, 5, 7, 4, -1, -4, -4, -1, 2, 4, 3, 0, -3, -3, -2,
+ 2, 1, 0, -1, -2, -2, 0, 1, 0, 0, -1, -2, -2, -1, 1, 2,
+ -4, -3, -2, -1, 0, 1, 2, 2, 10, 9, 5, 0, -3, -4, -3, -2,
+ 1, -1, -2, -2, -1, 0, 0, 0, -2, -2, -1, 1, 1, 1, 0, -1,
+ -5, -3, 0, 3, 4, 2, 0, -2, -2, -1, 0, 1, 1, 0, -1, -1,
+ 3, 2, -1, -2, -2, -1, 1, 1, 7, 5, -1, -5, -6, -2, 2, 4,
+ -2, 3, 3, -3, -4, 1, 2, -2, -3, 3, 4, -3, -4, 2, 3, -2,
+ -3, 3, 4, -3, -4, 2, 3, -2, -4, 2, 4, -2, -3, 1, 2, -1,
+ 4, 3, -1, -3, -3, -1, 1, 2, -4, -6, -4, 0, 4, 5, 4, 1,
+ 0, 2, 5, 6, 2, -3, -5, -4, 1, 1, -1, -3, -5, -2, 2, 4,
+ -1, 0, 1, 2, 2, 3, 3, 4, -1, 0, 1, 1, 0, -1, -1, -1,
+ -1, 0, 1, 2, 2, 1, -1, -2, -3, -2, -1, 0, 0, -1, -2, -3,
+ 1, 1, 1, 1, 0, 0, 1, 2, 1, 0, -1, 0, 0, 1, 1, 0,
+ 1, -2, -4, -1, 1, 2, 1, 0, 1, -4, -7, -3, 1, 3, 2, 1,
+ 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, 1, 0, 1, 2, 2, 0,
+ 1, 1, 0, 0, 0, 2, 0, -3, 3, 2, 0, -1, -1, -2, -6, -9,
+ 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, -1, -1, 0, 2,
+ 0, 1, 1, 1, -1, -3, -2, 0, -7, -5, 1, 6, 6, 2, -1, -1,
+ 3, 1, -1, -3, -4, -2, 1, 4, 2, 0, -2, -3, -4, -3, -1, 2,
+ 2, 2, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1,
+ -1, 1, 1, -2, -5, -6, -4, -1, -1, 1, 4, 3, 2, 0, 1, 2,
+ -1, 0, 2, 3, 1, 0, 0, 1, -1, 0, 1, 0, 0, -1, -1, 0,
+ 0, 1, 2, 2, 0, -2, -1, 1, -2, -1, -1, -2, -1, 2, 6, 8,
+ -1, -1, -2, -3, -2, 0, 1, 2, -1, 0, 0, -1, -1, 0, -1, -1,
+ 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, -1, -1, 1,
+ -1, 0, 2, 2, -1, -3, -2, 3, 0, 2, 3, 0, -5, -7, -2, 4,
+ -1, 0, 0, 0, -1, -2, -3, -3, -1, 0, -1, -2, -2, -2, -2, -2,
+ 1, 1, 0, 0, 1, 2, 0, -1, 1, 2, 1, 2, 5, 6, 2, 0,
+ -2, -4, -3, 0, 2, 2, 0, -3, 3, 1, 0, 1, 2, 1, -2, -3,
+ 3, 1, 0, 0, 0, 0, 0, -1, 1, -1, -2, -2, -1, 1, 3, 3,
+ 3, 2, 1, 2, 4, 3, 1, -2, -2, -4, -4, -3, -1, 0, -2, -3,
+ 1, 0, -1, -1, 0, 1, 0, -1, 3, 2, 0, 0, 0, 1, 1, 0,
+ 1, 1, 0, 0, 0, 0, 0, 0, 2, 3, 3, 2, 2, 2, 1, 1,
+ 0, -1, -2, -3, -5, -5, -5, -4, 1, 1, 0, -1, 0, 1, 3, 3,
+ -9, -6, -2, 0, 1, 1, 2, 2, -6, -2, 1, 2, 1, 1, 0, 1,
+ -2, 1, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, -3, -2, 0,
+ -3, -3, -3, -2, -1, 3, 7, 9, 1, 2, 2, 2, 0, -2, -4, -3,
+ 2, 0, -2, -1, 3, 4, -1, -6, 1, 0, -2, -3, -1, 3, 3, 0,
+ 0, 3, 3, 0, -2, -1, 1, 1, -6, -1, 3, 2, -1, -2, 0, 1,
+ 5, 3, 0, -2, -3, 0, 2, 1, 1, 1, 2, 2, 0, -2, -4, -7,
+ -3, -2, 1, 2, 2, 1, -1, -4, 2, 2, 0, -2, -2, 0, 2, 2,
+ 0, 0, -2, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+ -2, -1, 0, 1, 0, 1, 2, 3, -4, -2, 0, 0, -1, 0, 2, 3,
+ -2, -2, -2, -1, -1, 0, 2, 4, 0, 0, 0, 0, -1, -1, 0, 1,
+ 0, -1, -1, -1, -1, -1, 0, 0, 6, 4, 2, 0, -1, -2, -1, -1,
+ 0, 1, 1, 1, 1, -1, -5,-10, 1, 1, 1, 1, 1, 1, 0, -4,
+ 1, 0, 1, 1, 1, 1, 1, -1, 2, 1, 1, 1, 0, 0, 0, 0,
+ -3, 1, 4, 3, 3, 1, -1, 0, -4, 0, 1, 0, -1, 0, 0, 0,
+ -5, 0, 2, 1, 1, 1, 0, -1, -1, 2, 1, -2, -2, -1, 0, -1,
+ 2, 4, 5, 3, 0, -1, 1, 2, 0, 0, 1, 0, -2, -2, -1, -1,
+ -2, -2, -2, -2, -3, -2, -1, 0, 0, 0, 1, 0, 0, 0, 1, 2,
+ 0, -2, -2, -3, -1, 2, 2, -1, 1, 0, 0, 0, 1, 5, 3, -2,
+ -1, -1, 0, -1, 0, 2, 0, -5, -1, 0, 1, 0, 0, 2, 2, -2,
+ 3, 1, -1, -1, 0, 1, 1, 2, 1, 0, 0, 1, 1, 1, 1, 1,
+ -10, -8, -2, 1, 2, 1, 1, 1, -1, 1, 2, 1, 0, 0, 0, 0,
+ -1, -1, 0, 1, 2, 2, 2, 1, -1, -1, -1, 0, -1, -3, -5, -4,
+ 1, 1, 2, 1, 1, 0, 0, 2, -1, -2, -1, -1, -1, 0, 2, 4,
+ -3, -7, -5, 0, 2, 0, 0, 0, 3, -1, -2, 1, 2, 1, 1, 2,
+ 1, -2, -1, 1, 2, 1, 0, 1, 0, -1, 0, 3, 2, -1, -1, -1,
+ 2, 1, 1, 0, 0, 0, 0, 0, -9, -7, -2, 3, 3, 2, 1, 1,
+ 3, 2, 0, -2, -2, -1, 1, 1, 0, -1, 0, 0, 1, 1, 0, 0,
+ -2, -1, 1, 1, 1, 0, 0, 0, 1, 2, 1, -2, -4, -3, 1, 2,
+ 1, 2, 1, -2, -3, 0, 3, 1, -1, -1, 0, 0, 1, 3, 0, -4,
+ 2, 0, -1, 1, 2, -2, -2, 3, 2, 0, -1, 2, 3, -2, -4, 1,
+ 0, 1, 1, 1, 2, -2, -6, -2, -1, 0, 0, 0, 2, 0, -2, -1,
+ -1, -1, 1, 2, 1, -2, -3, -2, 3, -1, -2, -1, -1, 0, 1, 2,
+ 10, 4, 0, 0, -1, -2, -2, -1, 3, -1, -2, -1, 0, -1, -1, 0,
+ -5, 2, 7, 1, -4, -2, 1, 0, -2, 2, 3, -1, -3, 0, 2, 0,
+ 2, 1, 0, 0, 1, 1, -1, -2, 1, -2, -2, -1, -1, -2, 0, 0,
+ 0, 3, -2, -7, -1, 3, 0, 0, 1, 3, -3, -5, 2, 3, -1, 0,
+ 0, 2, -2, -2, 4, 2, -2, 0, -1, 1, -1, 0, 2, -1, -2, 1,
+ 4, 0, -3, -4, -2, 1, 2, 1, 0, 0, 3, 5, 3, 1, -1, -2,
+ 1, 1, 1, -1, -3, -1, 1, 1, 1, -1, -2, -2, 0, 0, -1, -2
+};
+
+static const int8 s_svq1IntraCodebook8x8[6144] = {
+ 4, 4, 3, 2, 2, 1, 0, -1, 4, 3, 3, 2, 1, 0, -1, -1,
+ 3, 3, 2, 2, 1, 0, -1, -2, 3, 2, 2, 1, 0, -1, -2, -3,
+ 2, 2, 1, 0, -1, -1, -2, -3, 2, 1, 0, 0, -1, -2, -3, -4,
+ 1, 0, 0, -1, -2, -3, -4, -4, 0, 0, -1, -2, -2, -3, -4, -4,
+ 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3,
+ 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1,
+ -1, 0, 0, 0, 0, 0, 1, 1, -2, -2, -1, -1, -1, -1, -1, -1,
+ -3, -3, -3, -3, -3, -3, -2, -2, -5, -4, -4, -4, -4, -4, -4, -3,
+ -4, -2, -1, 0, 1, 2, 2, 3, -4, -2, -1, 0, 1, 2, 3, 3,
+ -4, -3, -1, 0, 1, 2, 3, 3, -4, -3, -1, 0, 1, 2, 3, 3,
+ -5, -3, -1, 0, 1, 2, 3, 3, -5, -3, -1, 0, 1, 2, 3, 3,
+ -5, -3, -1, 0, 1, 1, 2, 3, -5, -3, -2, -1, 0, 1, 2, 3,
+ 4, 4, 5, 5, 6, 6, 7, 7, 2, 2, 2, 3, 3, 4, 4, 4,
+ 0, 0, 0, 0, 1, 1, 1, 2, -2, -2, -2, -2, -1, -1, -1, 0,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -1, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -2, -2, -2, -2,
+ 5, 3, 1, -1, -2, -3, -3, -3, 5, 3, 1, -1, -2, -3, -3, -3,
+ 5, 3, 1, -1, -2, -3, -3, -3, 5, 3, 1, -1, -2, -3, -3, -3,
+ 5, 4, 1, 0, -2, -3, -3, -3, 6, 4, 2, 0, -2, -2, -3, -3,
+ 6, 4, 2, 0, -1, -2, -2, -3, 6, 4, 2, 1, -1, -2, -2, -2,
+ -1, 1, 3, 3, 2, 0, -3, -6, -1, 1, 3, 4, 3, 0, -3, -6,
+ -1, 1, 4, 4, 3, 1, -3, -6, -1, 1, 3, 4, 3, 1, -3, -6,
+ -2, 1, 3, 4, 3, 1, -3, -6, -2, 1, 3, 4, 3, 1, -3, -7,
+ -2, 1, 3, 3, 2, 0, -3, -7, -2, 0, 2, 3, 2, 0, -3, -6,
+ 10, 9, 8, 6, 6, 5, 4, 4, 6, 5, 4, 3, 2, 2, 2, 1,
+ 2, 1, 0, -1, -2, -2, -2, -1, -1, -2, -3, -4, -4, -4, -4, -3,
+ -2, -3, -4, -4, -5, -4, -4, -3, -2, -2, -3, -3, -3, -3, -2, -2,
+ -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 1, 1, 1, 1, 1, 2,
+ -2, -1, 1, 2, 4, 5, 7, 8, -3, -2, 0, 1, 3, 5, 7, 8,
+ -4, -3, -1, 0, 2, 4, 6, 7, -5, -4, -2, -1, 1, 3, 5, 7,
+ -6, -5, -3, -2, 0, 2, 4, 6, -6, -5, -4, -2, -1, 1, 3, 5,
+ -7, -6, -5, -3, -2, 0, 2, 3, -8, -7, -5, -4, -3, -1, 1, 2,
+ 11, 9, 7, 5, 3, 1, -1, -1, 10, 8, 6, 3, 1, 0, -2, -2,
+ 9, 7, 5, 2, 0, -2, -3, -4, 8, 6, 3, 1, -1, -3, -4, -4,
+ 6, 4, 2, -1, -3, -4, -5, -5, 5, 3, 0, -2, -4, -5, -6, -6,
+ 3, 1, -1, -3, -5, -6, -7, -7, 2, 0, -2, -4, -6, -6, -7, -7,
+ 5, 6, 7, 7, 7, 8, 8, 8, 3, 4, 5, 5, 6, 6, 6, 6,
+ 0, 2, 2, 3, 4, 4, 4, 5, -2, -1, 0, 1, 2, 2, 3, 3,
+ -4, -3, -2, -1, 0, 1, 1, 2, -6, -5, -4, -3, -2, -2, -1, 0,
+ -8, -7, -6, -6, -5, -4, -3, -3,-10, -9, -8, -8, -7, -6, -6, -5,
+ 6, 5, 3, 1, -1, -3, -6, -8, 6, 5, 4, 2, -1, -3, -6, -8,
+ 6, 5, 4, 2, 0, -3, -6, -8, 6, 5, 4, 2, 0, -3, -6, -8,
+ 6, 6, 4, 2, 0, -3, -6, -8, 6, 5, 4, 2, 0, -3, -6, -8,
+ 6, 5, 4, 2, 0, -3, -6, -8, 6, 5, 4, 2, -1, -3, -5, -8,
+ 11, 10, 9, 8, 7, 6, 5, 4, 8, 8, 7, 6, 5, 4, 3, 2,
+ 6, 5, 4, 4, 2, 2, 1, 0, 3, 3, 2, 1, 0, 0, -1, -2,
+ 1, 1, 0, -1, -2, -2, -3, -3, -1, -1, -2, -3, -4, -4, -5, -5,
+ -3, -4, -4, -5, -6, -6, -7, -7, -5, -5, -6, -7, -8, -8, -8, -8,
+ -14,-13,-12,-11, -9, -7, -6, -4,-12,-11,-10, -9, -7, -5, -3, -1,
+ -10, -9, -7, -6, -3, -2, 0, 2, -8, -6, -4, -2, 0, 2, 4, 5,
+ -5, -3, 0, 2, 4, 5, 7, 8, -2, 0, 2, 4, 6, 8, 9, 10,
+ 0, 3, 5, 7, 8, 10, 11, 12, 3, 5, 7, 8, 10, 11, 12, 12,
+ -19,-19,-18,-18,-17,-16,-15,-14,-15,-15,-14,-13,-12,-11,-10, -9,
+ -11,-10, -9, -8, -6, -5, -4, -3, -6, -5, -3, -2, -1, 0, 1, 2,
+ -1, 0, 2, 3, 4, 5, 6, 6, 4, 6, 7, 8, 9, 10, 10, 10,
+ 9, 10, 11, 12, 13, 14, 14, 14, 12, 14, 14, 15, 16, 16, 16, 16,
+ 22, 21, 19, 17, 14, 11, 9, 5, 20, 19, 17, 14, 11, 8, 4, 1,
+ 17, 15, 13, 10, 6, 3, 0, -4, 13, 11, 8, 5, 1, -2, -5, -9,
+ 9, 6, 3, -1, -4, -7,-11,-13, 4, 0, -3, -6, -9,-12,-15,-17,
+ -2, -5, -8,-11,-14,-16,-18,-20, -8,-10,-13,-16,-17,-19,-21,-22,
+ 17, 18, 18, 18, 17, 16, 16, 14, 16, 16, 15, 15, 14, 13, 12, 11,
+ 12, 12, 11, 10, 9, 8, 7, 5, 7, 6, 6, 4, 3, 2, 1, -1,
+ 1, 0, -1, -2, -3, -4, -5, -6, -5, -6, -7, -8, -9,-10,-11,-12,
+ -11,-12,-13,-14,-15,-16,-16,-17,-16,-17,-17,-18,-19,-20,-20,-20,
+ 0, 0, 0, 0, -1, -1, -2, -3, 1, 0, 0, 0, 0, -1, -2, -3,
+ 1, 1, 0, 0, -1, -1, -2, -2, 1, 1, 1, 0, 0, -1, -1, -2,
+ 2, 1, 1, 1, 0, -1, -1, -2, 2, 2, 1, 1, 0, 0, -1, -2,
+ 2, 2, 1, 1, 1, 0, -1, -1, 2, 2, 1, 1, 1, 0, 0, -2,
+ 0, -1, -1, 0, 0, 1, 2, 3, 0, -1, -1, 0, 1, 1, 2, 2,
+ -1, -1, -1, -1, 0, 1, 2, 2, -1, -1, -2, -1, 0, 1, 1, 2,
+ -1, -2, -2, -1, 0, 0, 1, 2, -1, -2, -2, -2, -1, 0, 1, 2,
+ -1, -1, -2, -1, 0, 0, 1, 2, -1, -1, -1, -1, 0, 1, 1, 2,
+ 3, 2, 2, 2, 1, 1, 0, 0, 3, 2, 2, 2, 2, 1, 0, 0,
+ 2, 2, 2, 1, 1, 1, 0, 0, 2, 2, 1, 1, 1, 0, 0, -1,
+ 1, 1, 1, 0, 0, 0, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -2, -2, -2, -2,
+ 5, 2, 0, 0, -1, 0, 0, 0, 4, 2, 0, -1, -1, -1, 0, -1,
+ 4, 1, -1, -1, -2, -1, -1, -1, 4, 1, -1, -1, -2, -1, -1, -1,
+ 4, 1, -1, -2, -2, -1, -1, -1, 4, 1, -1, -2, -2, -1, -1, -1,
+ 4, 1, -1, -1, -1, -1, -1, -1, 4, 2, 0, -1, 0, 0, 0, -1,
+ -2, -1, 0, 1, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 1, 1,
+ -3, -1, 0, 1, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 1, 1,
+ -3, -2, 0, 1, 2, 2, 1, 1, -4, -2, 0, 1, 2, 2, 2, 2,
+ -5, -3, -1, 1, 1, 2, 1, 2, -5, -3, -2, 0, 1, 1, 1, 1,
+ 3, 3, 1, 0, -2, -4, -4, -5, 3, 3, 2, 0, -1, -2, -3, -4,
+ 2, 2, 1, 1, 0, -1, -2, -2, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, -2, -1, -1, 0, 0, 1, 2, 2,
+ -3, -2, -2, -1, 0, 1, 2, 3, -3, -3, -2, -1, 0, 1, 2, 3,
+ -3, -3, -3, -3, -3, -2, -2, -2, -3, -3, -2, -2, -2, -1, -1, -1,
+ -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 2, 2, 2, 2,
+ 1, 1, 1, 2, 2, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
+ -8, -7, -5, -3, -2, -1, 0, -1, -4, -3, -1, 0, 1, 2, 1, 1,
+ -1, 1, 2, 3, 3, 2, 2, 1, 1, 2, 3, 3, 2, 2, 1, 0,
+ 2, 3, 3, 2, 1, 0, 0, -1, 1, 2, 1, 0, -1, -1, -1, -1,
+ 1, 1, 0, -1, -1, -2, -2, -1, 1, 1, 0, 0, -1, -1, 0, -1,
+ -4, -3, -2, 0, 1, 2, 3, 3, -4, -3, -2, 0, 1, 2, 2, 2,
+ -3, -3, -2, -1, 0, 1, 1, 1, -2, -2, -2, -1, -1, 0, 0, 0,
+ 0, -1, -1, -1, -1, -1, -1, -1, 2, 1, 1, 0, 0, -1, -1, -2,
+ 3, 3, 3, 1, 0, -1, -2, -2, 5, 4, 4, 2, 1, 0, -1, -2,
+ 0, 0, 0, 0, 1, 2, 3, 3, 0, -1, 0, 0, 1, 2, 3, 3,
+ 0, -1, 0, 0, 1, 2, 3, 2, 0, 0, 0, 1, 1, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 1, 0, 0, -1, -2,
+ 2, 1, 0, 0, -2, -3, -5, -6, 0, -1, -1, -3, -5, -6, -8, -9,
+ -2, 0, 1, 2, 2, 1, -1, -4, -2, 0, 2, 2, 2, 1, -1, -4,
+ -2, 0, 2, 2, 2, 1, -1, -3, -2, 0, 2, 2, 2, 1, -1, -3,
+ -2, -1, 2, 2, 2, 1, -1, -3, -2, -1, 1, 2, 2, 1, -1, -3,
+ -3, -1, 1, 2, 2, 1, -1, -3, -2, -1, 1, 2, 2, 1, -1, -3,
+ -1, 1, 1, -1, -3, -3, 0, 4, -1, 1, 1, -1, -3, -3, 0, 4,
+ -1, 1, 1, 0, -3, -3, 0, 4, -1, 1, 2, 0, -3, -3, 0, 5,
+ 0, 1, 2, 0, -3, -4, 0, 4, 0, 1, 2, 0, -3, -4, 0, 5,
+ 0, 1, 2, 0, -3, -3, 0, 4, 0, 1, 2, -1, -2, -2, 0, 4,
+ 6, 6, 5, 6, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0,
+ -1, -2, -2, -2, -2, -2, -2, -1, -3, -3, -3, -3, -3, -3, -3, -2,
+ -3, -4, -4, -3, -3, -3, -2, -2, -2, -2, -2, -2, -1, -1, 0, 0,
+ 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6,
+ 4, 1, -2, -3, -3, -1, 1, 3, 4, 1, -2, -4, -3, -1, 1, 3,
+ 5, 1, -2, -4, -3, -1, 1, 4, 5, 1, -2, -3, -3, -1, 2, 4,
+ 5, 1, -2, -3, -3, -1, 2, 4, 4, 0, -3, -4, -3, -1, 2, 4,
+ 4, 0, -3, -3, -3, -1, 1, 3, 3, 0, -2, -3, -2, -1, 1, 3,
+ -3, -4, -4, -4, -4, -4, -4, -4, -1, -1, -1, -1, -1, -1, -2, -2,
+ 2, 1, 1, 2, 2, 1, 1, 1, 3, 3, 3, 4, 4, 3, 3, 3,
+ 3, 3, 3, 4, 4, 4, 3, 3, 1, 2, 1, 2, 2, 2, 2, 2,
+ -2, -2, -2, -1, -1, -1, 0, 0, -4, -4, -4, -4, -3, -3, -3, -3,
+ -1, -2, -3, -3, -2, -2, -1, 0, 0, -1, -2, -2, -2, -1, 0, 1,
+ 2, 1, -1, -1, -1, -1, 0, 1, 3, 1, 0, -1, -1, 0, 0, 1,
+ 3, 2, 0, -1, 0, 0, 0, 1, 3, 1, 0, -1, 0, 0, 0, 1,
+ 3, 1, 0, -1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 2, 3, 4, 0, 0, -1, 0, 0, 0, 2, 3,
+ 0, -1, -1, -1, -1, -1, 0, 1, 0, -1, -1, -1, -1, -1, -1, 0,
+ 0, 0, -1, -1, -1, -2, -2, -1, 1, 0, 0, -1, -1, -2, -2, -1,
+ 2, 2, 1, 0, -1, -1, -1, -1, 3, 3, 2, 1, 0, -1, -1, 0,
+ 1, 0, 1, 0, 0, -1, -2, -1, 0, 0, 0, 0, -1, -1, -2, -1,
+ 0, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
+ -1, -1, -1, 0, 0, 0, 1, 1, -1, -1, -1, 0, 1, 1, 2, 3,
+ -2, -2, -1, 0, 1, 2, 3, 4, -2, -2, -1, 0, 1, 2, 4, 5,
+ -3, -1, 1, 0, 0, -1, 0, 1, -3, 0, 1, 0, -1, -1, 0, 2,
+ -3, 0, 1, 0, -1, -1, 0, 2, -2, 1, 2, 0, -1, -1, 0, 2,
+ -2, 1, 2, 0, -1, -1, 0, 2, -2, 1, 2, 0, -1, -1, 0, 2,
+ -1, 2, 2, 0, -1, -1, 0, 2, -1, 1, 1, 0, -1, -1, -1, 1,
+ -2, -2, -1, 1, 3, 4, 3, 1, -2, -2, -1, 0, 2, 3, 2, 0,
+ -2, -2, -1, 0, 1, 2, 1, -1, -1, -1, -1, 0, 1, 2, 1, -1,
+ -1, -1, -1, 0, 1, 1, 0, -2, 0, -1, -1, 0, 1, 1, 0, -1,
+ 0, -1, -1, 0, 1, 1, 1, -1, 0, -1, -1, 0, 0, 1, 0, -1,
+ -2, -1, 0, 1, 1, 1, 1, 1, -2, -1, 0, 0, 0, 0, 0, 0,
+ -2, -1, -1, 0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -2, -2, -3,
+ -1, 0, 1, 1, 0, -1, -2, -2, 1, 2, 3, 3, 2, 1, 0, 0,
+ 1, 2, 3, 3, 3, 2, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0,
+ 0, -1, -1, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, -1, 0, 0, 1, 1, 0, 0, 0,
+ -3, -2, -1, -1, -1, -1, 0, -1, -5, -5, -4, -3, -2, -2, -2, -1,
+ 1, 1, 1, 1, 2, 1, 0, -1, 1, 1, 1, 2, 1, 1, 0, -1,
+ 1, 1, 1, 1, 1, 1, 0, -2, 2, 1, 1, 1, 1, 1, 0, -2,
+ 1, 1, 0, 0, 0, 0, -1, -3, 1, 1, 0, 0, 0, -1, -2, -3,
+ 1, 1, 0, 0, -1, -1, -2, -4, 1, 0, 0, -1, -2, -2, -3, -4,
+ 8, 7, 5, 3, 2, 1, 1, 1, 2, 1, 0, 0, -1, -1, -2, -1,
+ -1, -1, -1, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, -1, -1, 0,
+ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ -1, 0, 0, 0, 0, 0, -1, -1, -2, -2, -1, -1, -1, -2, -2, -1,
+ 9, 4, 0, -2, -2, -2, -1, -1, 7, 2, -1, -2, -2, -1, 0, 0,
+ 4, 0, -2, -2, -1, 0, 1, 1, 1, -2, -2, -2, -1, 0, 1, 1,
+ -1, -2, -2, -1, 0, 1, 1, 1, -1, -2, -1, 0, 1, 1, 1, 0,
+ -1, -1, 0, 1, 1, 1, 0, -1, 0, -1, 0, 1, 0, 0, -1, -1,
+ 0, 1, 1, 1, 1, 1, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0,
+ 2, 2, 2, 2, 1, 0, -1, -1, 1, 1, 1, 0, -1, -2, -2, -2,
+ 0, 0, 0, -1, -2, -3, -2, -2, -1, -1, -1, -2, -2, -2, -1, 0,
+ -1, -1, -1, -1, 0, 0, 1, 2, -1, -1, -1, 0, 1, 2, 3, 4,
+ -1, -1, 0, 0, -1, -2, -3, -3, -1, -1, 0, 0, 0, -1, -1, -1,
+ -2, -2, -1, 0, 1, 1, 1, 1, -2, -2, -2, 0, 1, 2, 3, 3,
+ -1, -1, -1, 0, 1, 3, 3, 3, 1, 0, 0, 0, 1, 1, 2, 2,
+ 2, 2, 1, 0, 0, -1, -1, -1, 3, 2, 1, 0, -1, -2, -3, -3,
+ -1, -1, -1, -2, -2, -3, -4, -5, 0, 0, 0, -1, -1, -3, -3, -4,
+ 1, 1, 1, 0, 0, -1, -2, -3, 2, 2, 2, 1, 1, 0, -1, -1,
+ 2, 2, 2, 2, 1, 1, 0, -1, 2, 2, 2, 2, 2, 1, 0, 0,
+ 1, 1, 2, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, -1,
+ -2, 2, 3, 1, -1, 1, 1, -1, -3, 2, 3, 0, -1, 1, 1, -1,
+ -3, 2, 3, 0, -1, 1, 1, -1, -4, 2, 3, 0, -1, 1, 1, -2,
+ -4, 1, 3, 0, -1, 1, 1, -2, -4, 1, 3, -1, -2, 1, 1, -2,
+ -3, 1, 2, 0, -1, 1, 1, -2, -3, 1, 2, 0, -1, 1, 1, -1,
+ -1, -1, -1, -2, -2, -2, -2, -2, 1, 1, 1, 1, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 2,
+ -2, -2, -1, -1, -1, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, -2,
+ -1, -1, -1, -1, -2, -2, -2, -2, 4, 4, 4, 4, 4, 3, 3, 2,
+ -3, -3, -2, -1, 0, 1, 2, 5, -3, -3, -3, -2, -1, 1, 3, 6,
+ -3, -3, -2, -2, 0, 2, 3, 5, -3, -2, -2, -2, 0, 1, 3, 5,
+ -2, -2, -2, -1, -1, 1, 3, 5, -2, -2, -1, -1, 0, 1, 2, 4,
+ -1, -1, -1, -1, 0, 1, 1, 4, -1, -1, -1, -1, 0, 1, 2, 3,
+ 0, -1, 0, 1, 1, 0, -1, -1, 0, 0, 0, 1, 2, 0, -1, -1,
+ 1, 0, -1, 0, 1, 0, 0, 0, 1, -1, -2, -1, 0, 0, 0, 0,
+ 1, -2, -3, -1, 0, 0, 0, 1, 1, -1, -3, -2, 0, 1, 1, 2,
+ 1, -1, -2, -1, 0, 1, 1, 2, 2, 0, -1, 0, 1, 1, 2, 2,
+ 1, 1, 1, 1, 0, 0, 1, 2, -1, 0, 0, -1, 0, 0, 0, 1,
+ -3, -2, -1, -1, -1, 0, 1, 1, -4, -2, -1, 0, 0, 1, 1, 1,
+ -3, -2, 0, 0, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 0, 0,
+ -1, 0, 1, 1, 1, 0, 0, -1, 0, 1, 2, 2, 1, 0, 0, -1,
+ -4, -4, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1, 0, 0, 0, 0,
+ -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
+ 0, 0, 1, 1, 2, 2, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 1, 1, 1, 1, 0, -1, 0, 0, 1, 1, 1, 0, 0,
+ 1, 2, 2, 2, 1, -1, -2, -4, 1, 1, 2, 2, 1, 0, -2, -4,
+ 0, 1, 1, 1, 1, 0, -1, -3, -1, 0, 1, 1, 0, 0, -1, -2,
+ -1, 0, 1, 1, 1, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, -1,
+ -1, -1, 0, 1, 1, 0, 0, 0, -1, 0, 1, 1, 1, 1, 1, 0,
+ 2, 2, 0, -1, -2, -1, -1, -2, 1, 1, -1, -2, -2, -1, -1, -2,
+ 1, 1, -1, -2, -2, 0, 0, -1, 1, 1, 0, -2, -1, 1, 1, 0,
+ 1, 1, 0, -1, -1, 1, 2, 1, 1, 1, 0, -1, -1, 1, 2, 1,
+ 1, 1, 0, -1, -1, 1, 1, 1, 1, 1, 0, -1, 0, 1, 1, 1,
+ 0, 0, -1, -2, -4, -4, -4, -4, 3, 3, 3, 2, 1, 0, 0, 0,
+ 3, 3, 3, 3, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0,
+ -1, -1, 0, -1, -1, 1, 2, -1, 1, 1, 0, 0, 0, 2, 3, -1,
+ 1, 1, 0, -1, -1, 1, 3, -1, 1, 1, 0, -2, -2, 0, 1, -2,
+ 1, 0, 0, -2, -2, 0, 1, -3, 0, 0, 0, 0, -1, 1, 1, -3,
+ 0, 1, 1, 0, 1, 2, 1, -3, -1, 0, 1, 1, 1, 2, 1, -4,
+ -4, -3, 0, 1, 1, 1, 0, 0, -4, -2, 0, 1, 1, 1, 0, -1,
+ -3, -1, 1, 1, 1, 0, -1, -1, -1, 1, 1, 1, 1, 0, -1, 0,
+ 1, 2, 2, 1, 0, -1, 0, 0, 2, 2, 1, 0, -1, -1, 0, 1,
+ 2, 1, 0, -1, -2, -1, 0, 1, 2, 2, 0, -1, -2, -1, 1, 1,
+ 1, 1, 0, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1,
+ 1, 0, 0, -1, -1, -1, -1, -1, 2, 1, 0, 0, -1, -1, -1, -1,
+ 5, 3, 2, 1, 0, 0, 0, 0, 6, 5, 3, 2, 1, 0, 0, 0,
+ 4, 4, 3, 1, 0, 0, 0, 1, 3, 3, 2, 1, 0, 0, 0, 1,
+ 2, 2, 1, 0, -1, -1, 0, 1, 0, 0, 0, -1, -1, -1, 0, 1,
+ 0, 0, -1, -1, -2, -1, 0, 2, 0, -1, -1, -2, -2, -2, 0, 1,
+ 0, -1, -1, -2, -2, -2, -1, 0, 0, 0, -1, -2, -2, -2, -1, 0,
+ 0, 0, -1, -1, -1, 0, 2, 3, 0, -1, -2, -2, -1, -1, 1, 2,
+ 1, 0, -1, -1, -1, 0, 0, 0, 1, 1, 1, 0, 0, 0, -1, -1,
+ 1, 2, 1, 0, 0, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1,
+ -3, -2, -1, -1, 0, 1, 1, 2, -4, -3, -1, 1, 2, 3, 5, 5,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, -1, 0, 0, 0, 1, -1, -1, -2, -2, -2, -1, -1, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
+ 1, 1, 1, 1, 2, 2, 1, 1, -4, -3, -4, -4, -4, -4, -3, -3,
+ -1, 0, 1, 2, 2, 3, 3, 3, -1, -1, -1, -1, 0, 0, 0, 0,
+ 0, 0, -1, -2, -2, -3, -3, -2, 3, 2, 1, 0, -1, -2, -2, -2,
+ 4, 3, 2, 1, 1, 0, 0, 0, 2, 2, 1, 1, 0, 1, 1, 1,
+ 0, -1, -1, -1, -1, 0, 0, 1, -2, -2, -2, -2, -2, -1, 0, 0,
+ 1, -1, 0, 2, 1, -2, -1, 1, 1, -1, 0, 2, 1, -2, -2, 1,
+ 1, -1, 0, 3, 2, -2, -1, 1, 0, -2, 0, 3, 2, -2, -2, 1,
+ 0, -2, 0, 3, 2, -2, -2, 1, 0, -2, 0, 3, 1, -2, -1, 1,
+ 0, -2, 0, 2, 1, -2, -2, 1, 0, -1, 0, 2, 1, -2, -1, 1,
+ 0, 1, 2, 2, 3, 3, 2, 2, 0, 1, 1, 2, 3, 3, 2, 1,
+ 0, 0, 1, 2, 2, 2, 2, 1, -1, 0, 0, 1, 1, 1, 1, 1,
+ -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1,
+ -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -1,
+ 0, 0, -1, -2, -1, 0, 3, 5, 0, 0, -1, -1, -1, 0, 2, 4,
+ 1, 1, 0, 0, -1, -1, 1, 2, 1, 2, 1, 1, 0, -1, -1, 0,
+ 0, 1, 2, 1, 0, -1, -2, -2, -1, 0, 1, 2, 1, 0, -3, -3,
+ -2, -1, 1, 2, 2, 0, -2, -4, -2, -1, 0, 2, 2, 1, -1, -3,
+ 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, 0, 0,
+ -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0,
+ -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, 0, 0, 0, -1, -1, 0,
+ 0, 0, 1, 1, 0, 0, 0, 1, 3, 3, 3, 4, 3, 3, 3, 3,
+ 5, 1, -2, -2, 0, 0, 0, -1, 4, -1, -3, -1, 0, 0, 0, -1,
+ 3, -1, -1, 0, 1, 1, 0, -1, 2, 0, 0, 1, 1, 1, 0, -2,
+ 1, 0, 0, 1, 1, 1, 0, -2, 0, -1, -1, -1, 0, 0, 0, -1,
+ 0, -1, -1, -1, -1, 0, 0, -1, 2, 1, 0, 0, 0, 1, 0, 0,
+ 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 1, -1, -1, 0, 0, 0, 0, 0, 2, 0, -1, -1, -1, -1, -1, 0,
+ 3, 1, -1, -1, -2, -2, -2, -1, 4, 2, 1, 0, -1, -2, -2, -1,
+ 2, 1, 0, 0, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, 1, 1,
+ 0, 1, 2, 2, 2, 1, -1, -3, 0, 0, 1, 1, 1, 0, -1, -2,
+ 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -1, 0, 0, 1, 1, 0,
+ 0, 0, -1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0,
+ 0, 0, 1, 1, 2, 1, -1, -3, 0, 0, 0, 1, 1, -1, -4, -5,
+ -2, -2, -2, -1, 0, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 0, -2, -3, 0, 0, 1, 1, 0, -1, -3, -4,
+ -1, -1, 0, 1, 0, 0, -2, -3, -1, -1, 0, 1, 1, 1, 0, -1,
+ 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 1, 0, 0, 1, 1, 1, 2, 1, 2, 0, 0, 0, 0, -1, 1,
+ 0, 2, 0, -1, 1, 0, -1, 0, 0, 1, 0, 0, 2, 1, 0, 1,
+ 0, 1, -1, 0, 2, 2, 0, 1, -1, 0, -1, -1, 2, 1, 1, 2,
+ -2, -2, -3, -2, 0, 1, 1, 1, -2, -2, -3, -3, -1, -1, -1, 0,
+ -3, -1, 0, 1, 2, 1, 1, 0, -3, -1, 0, 1, 2, 1, 1, 1,
+ -2, 0, 0, 1, 1, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0,
+ -2, 0, 0, 0, 0, -1, -1, 0, -2, 0, 0, 0, 0, 0, -1, -1,
+ -3, 0, 1, 1, 1, 1, 0, 1, -5, -2, 0, 1, 2, 2, 1, 2,
+ -2, -1, -1, 0, 0, 1, 2, 3, 0, 0, 1, 1, 0, 0, 1, 2,
+ 0, 0, 1, 0, -1, -1, 0, 1, -1, -1, -1, -1, -2, -2, -1, 0,
+ -2, -2, -2, -2, -2, -1, 0, 1, 0, 0, 0, -1, 0, 1, 2, 2,
+ 2, 1, 0, 0, 0, 1, 2, 2, 2, 1, 0, -1, -1, -1, 0, 0,
+ 0, 1, 1, 1, 1, 1, -1, -4, -1, -1, 0, 1, 1, 1, 0, -3,
+ -2, -1, 0, 0, 1, 2, 2, -2, -1, 0, 0, 0, 0, 2, 3, -1,
+ -1, 0, 0, 0, 0, 1, 2, 0, 0, 0, -1, -2, -1, 1, 1, 0,
+ 0, 0, -1, -2, -2, 0, 2, 1, 0, 0, -1, -2, -1, 1, 2, 2,
+ 1, 0, 0, 0, -2, -3, -2, -3, 0, 0, 1, 0, -2, -2, -1, -1,
+ 0, -1, 1, 1, -1, -1, 0, 0, 0, -1, 1, 1, -1, -1, 0, 0,
+ 0, 1, 2, 1, -1, -1, 0, 1, 1, 2, 3, 2, 0, 0, 1, 2,
+ -1, 0, 2, 1, 0, 0, 2, 3, -2, -1, 0, 0, -1, 0, 1, 2,
+ 1, 1, 0, -1, -2, -2, -1, 1, 1, 1, 1, -1, -2, -2, 0, 2,
+ 1, 1, 1, -1, -1, -1, 0, 2, 0, 0, 0, 0, 0, 0, 1, 2,
+ -1, -1, -1, 0, 0, 0, 1, 2, -1, -2, -1, 1, 1, 1, 0, 0,
+ -1, -2, -1, 1, 2, 2, 0, -1, -1, -2, -1, 2, 2, 2, 0, -1,
+ -1, -1, -1, -2, -1, -1, 0, 1, 0, 0, -1, -1, -1, 0, 1, 2,
+ 1, 0, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 1, 1, 1, 1,
+ 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, -1, -1, -1,
+ 1, 2, 1, 0, -1, -2, -2, -3, 2, 2, 1, 0, -2, -3, -4, -4,
+ -4, -2, 1, 1, 1, 1, 0, 0, -2, 0, 1, 0, 0, 0, 0, 0,
+ 0, 1, 1, -2, -2, -1, 0, 1, 2, 2, 1, -2, -2, -1, 1, 2,
+ 1, 2, 1, -2, -2, -1, 1, 2, -1, 1, 1, -1, -1, -1, 0, 1,
+ -2, 0, 1, 1, 0, -1, -1, 0, -2, 0, 2, 2, 1, -1, -1, 0,
+ 1, 1, 0, 0, 0, 1, 0, 0, -2, -3, -3, -2, -2, -1, 0, 0,
+ -3, -4, -3, -2, -1, 0, 0, 0, -1, -1, 0, 1, 2, 3, 2, 1,
+ 0, 1, 2, 3, 3, 3, 2, 1, 1, 1, 1, 2, 1, 0, 0, -1,
+ 0, 0, 0, 0, -1, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, -1, -1, 0, 2, 0, 0, 1, 0, -1, -1, 1, 1,
+ -2, -1, 0, 1, 1, 1, 1, 1, -3, -3, 0, 2, 2, 1, 1, 0,
+ -2, -2, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, -1,
+ 3, 1, -1, -3, -2, -1, 0, 1, 4, 2, -1, -3, -3, -1, 1, 2,
+ 0, 0, 0, -1, -1, -1, -1, -1, 1, 2, 1, 0, 0, 0, -1, -1,
+ 2, 3, 3, 2, 1, 0, -1, -1, 3, 4, 4, 2, 1, 0, -1, -2,
+ 3, 3, 2, 1, 0, -1, -2, -2, 1, 1, 0, -1, -1, -2, -2, -3,
+ 0, 0, 0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -1, -2, -2, -1,
+ 1, 2, 2, 2, 2, 1, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 0, -1, -2, 0, 0, 0, 0, 1, 0, -1, -4,
+ 1, 0, 0, 0, 0, 0, -2, -5, 1, 0, 0, 0, 0, 0, -1, -4,
+ 1, 0, -1, 0, 0, 0, -1, -3, 0, -1, -1, 0, 1, 1, 1, -1,
+ -2, -1, 0, 0, -1, -1, -1, -2, -1, 0, 0, 0, -1, -1, -2, -2,
+ 0, 1, 1, 0, -1, -1, -1, -2, 0, 1, 1, 0, 0, 0, -1, -1,
+ 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 2, 2, 1,
+ 1, 1, 0, 0, 1, 2, 2, 1, 1, 1, 0, -1, 0, 1, 1, 0,
+ 4, 2, 1, 0, 0, 1, 1, 1, 4, 2, 1, 0, 0, 0, 0, 1,
+ 3, 1, 0, 0, -1, -1, -1, 0, 1, 0, 0, -1, -1, -2, -1, 0,
+ 0, 0, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, -1, -1, 0, 1,
+ -2, -1, 0, -1, -1, 0, 0, 1, -2, -2, -1, -2, -1, 0, 0, 1,
+ 0, 1, 1, 1, 2, 1, 0, -1, -1, -1, -1, 0, 0, -1, -2, -2,
+ -1, 0, -1, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 1, 2,
+ 0, 0, 0, 0, 0, 0, 2, 3, -1, 0, -1, -1, -1, -1, 0, 3,
+ -1, 0, 0, -1, -1, -2, 0, 3, 0, 0, 0, 0, -1, -1, 1, 4,
+ 2, 2, 0, 0, 0, 0, 0, 1, 1, 1, -1, -2, -1, -2, -1, 1,
+ -1, -1, -2, -2, -2, -3, -2, 0, -1, 0, -1, -1, -1, -2, -1, 1,
+ 1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 0, 0, 1, 0, 0, 1,
+ 2, 2, 0, 0, 0, 0, -1, -1, 2, 2, 0, 0, 1, 0, -1, -1,
+ -1, 0, 1, 1, 0, -1, -1, -1, 1, 2, 3, 2, 1, 0, 0, 0,
+ 0, 1, 1, 1, 0, -1, 0, 0, -2, -2, -1, 0, 1, 0, 0, 0,
+ -2, -2, -1, 2, 2, 2, 1, 0, -2, -1, 0, 1, 1, 0, 0, -1,
+ -1, -1, 0, 0, -1, -2, -1, -2, 0, 1, 1, 1, 0, 0, 1, 1,
+ -3, -3, -3, -2, -1, -1, -2, -2, -1, -1, 0, 1, 2, 1, 0, 0,
+ 1, 1, 1, 2, 2, 1, 0, 0, 1, 1, 1, 1, 1, 0, -1, 1,
+ 1, 0, -1, -1, 0, 0, -1, 1, 0, -1, -1, -1, 0, -1, -1, 1,
+ 1, 0, -1, 0, 0, -1, 0, 2, 2, 0, -1, 0, 0, 0, 0, 2,
+ 1, 0, -2, -1, 0, 1, 1, 0, 2, 0, -1, -1, 0, 1, 1, 0,
+ 1, 0, -2, -1, 0, 1, 0, -1, 1, 0, -1, -1, 0, 1, 0, -1,
+ 0, 1, 1, 0, 1, 1, 0, 0, -2, 1, 2, 1, 0, 0, 0, 1,
+ -5, 0, 2, 1, 0, -1, 0, 1, -6, -1, 2, 1, 0, -1, 0, 0,
+ 5, 3, 0, -1, -2, -1, -1, -1, 1, 1, 0, -1, -1, 0, -1, -1,
+ -1, 0, 1, 1, 2, 2, 1, 0, -2, -1, 0, 1, 2, 1, 1, 1,
+ -2, -1, -1, -1, 0, -1, 0, 1, 0, 1, 0, 0, -1, -1, 0, 0,
+ 0, 1, 1, 1, 1, 0, 0, 0, -3, -2, 0, 1, 1, 0, 0, -1,
+ -1, 0, 1, 0, -1, 0, 2, 3, -1, 0, 0, -2, -4, -2, -1, 0,
+ 0, 1, 1, 0, -2, -1, 0, -1, 1, 2, 3, 1, 0, 1, 1, 0,
+ -1, 0, 1, 1, 1, 1, 1, 0, -2, -3, -2, 0, 0, 0, 1, 0,
+ -1, -2, -2, 0, 1, 0, 0, -1, 3, 1, 0, 0, 1, 0, -1, -1,
+ -2, -1, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, 0, 1, 1, 1,
+ -1, -1, -1, 0, 1, 1, 1, 1, 0, -2, -3, -1, 1, 0, 0, 0,
+ 1, -1, -3, -1, 1, 1, 0, -1, 3, 1, -1, 1, 2, 2, 0, -1,
+ 3, 1, 0, 1, 2, 1, 1, 0, 0, -2, -2, -1, -1, 0, 0, 0,
+ 1, 0, -1, -1, 1, 2, 1, 0, 0, -1, -2, -1, 1, 2, 2, 1,
+ -1, -1, -1, 0, 0, 1, 2, 0, -2, 0, 0, 0, 0, 0, 1, -1,
+ -1, 0, 1, 0, -1, -1, -1, -1, 0, 1, 1, 2, 0, -2, -1, 0,
+ 1, 2, 2, 2, 1, -1, -1, 0, 0, 1, 1, 1, 0, -2, -2, -1,
+ 0, 0, -1, -1, -1, -1, -2, -2, 0, 0, -1, 0, 1, 2, 2, 1,
+ 0, 0, -1, -1, 0, 1, 2, 2, 1, 1, -1, -2, -1, -1, -1, -1,
+ 2, 2, 1, 0, 0, -1, -2, -2, 1, 2, 2, 1, 0, 0, -2, -2,
+ 0, 0, 0, 0, 1, 1, 0, -1, 0, -1, -1, -1, 2, 3, 2, 1,
+ 0, -2, 1, 2, -1, 0, 0, 1, -1, -2, 2, 3, -1, 0, 0, 0,
+ 0, -2, 2, 3, -1, -1, 0, 0, 0, -1, 3, 2, -2, 0, 1, 0,
+ 0, -1, 3, 1, -2, 0, 1, 0, 0, -1, 2, 1, -1, 1, 0, -1,
+ 0, 0, 1, -1, -2, 0, 0, -1, 1, 0, 0, -2, -2, -1, -1, -1,
+ 1, 1, 1, 1, 1, -1, -1, -2, 0, 0, 0, 1, 1, 1, 1, 1,
+ 0, 0, 0, 1, 1, 1, 2, 3, 1, 0, 0, -1, 0, 0, 1, 2,
+ 0, -1, -1, -2, -1, 0, 1, 2, -2, -2, -2, -2, -1, 0, 1, 1,
+ -1, -1, -1, -1, 0, 0, 0, -1, 2, 2, 2, 0, -1, -1, -2, -4,
+ -1, -2, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, 0, 1, 2, 3,
+ 1, 0, -1, 0, -1, 0, 1, 2, 1, 0, 0, 0, -1, 0, 2, 2,
+ 1, 0, -1, -1, -2, 0, 1, 2, 0, -2, -2, -2, -3, -1, 0, 1,
+ 0, -2, -2, -2, -2, -1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 2
+};
+
+static const int8 *const s_svq1IntraCodebooks[6] = {
+ s_svq1IntraCodebook4x2, s_svq1IntraCodebook4x4,
+ s_svq1IntraCodebook8x4, s_svq1IntraCodebook8x8,
+ 0, 0
+};
+
+} // End of namespace Video
+
+#endif
diff --git a/video/codecs/svq1_vlc.h b/video/codecs/svq1_vlc.h
new file mode 100644
index 0000000000..5fb10981f7
--- /dev/null
+++ b/video/codecs/svq1_vlc.h
@@ -0,0 +1,341 @@
+/* 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.
+ *
+ */
+
+// These tables are modified versions of the FFmpeg ones so that they
+// will work with our BitStream class directly.
+
+#ifndef VIDEO_CODECS_SVQ1_VLC_H
+#define VIDEO_CODECS_SVQ1_VLC_H
+
+#include "common/scummsys.h"
+
+namespace Video {
+
+static const byte s_svq1BlockTypeLengths[4] = {
+ 1, 2, 3, 3
+};
+
+static const uint32 s_svq1BlockTypeCodes[4] = {
+ 1, 1, 1, 0
+};
+
+static const byte s_svq1IntraMultistageLengths0[8] = {
+ 5, 1, 3, 3, 4, 4, 5, 4
+};
+
+static const uint32 s_svq1IntraMultistageCodes0[8] = {
+ 1, 1, 3, 2, 3, 2, 0, 1
+};
+
+static const byte s_svq1IntraMultistageLengths1[8] = {
+ 4, 2, 3, 3, 3, 3, 4, 3
+};
+
+static const uint32 s_svq1IntraMultistageCodes1[8] = {
+ 1, 3, 5, 4, 3, 2, 0, 1
+};
+
+static const byte s_svq1IntraMultistageLengths2[8] = {
+ 5, 1, 3, 5, 4, 3, 4, 4
+};
+
+static const uint32 s_svq1IntraMultistageCodes2[8] = {
+ 1, 1, 3, 0, 3, 2, 2, 1
+};
+
+static const byte s_svq1IntraMultistageLengths3[8] = {
+ 6, 1, 2, 6, 4, 4, 5, 4
+};
+
+static const uint32 s_svq1IntraMultistageCodes3[8] = {
+ 1, 1, 1, 0, 3, 2, 1, 1
+};
+
+static const byte s_svq1IntraMultistageLengths4[8] = {
+ 6, 1, 2, 5, 5, 6, 5, 3
+};
+
+static const uint32 s_svq1IntraMultistageCodes4[8] = {
+ 1, 1, 1, 3, 2, 0, 1, 1
+};
+
+static const byte s_svq1IntraMultistageLengths5[8] = {
+ 7, 1, 2, 3, 4, 6, 7, 5
+};
+
+static const uint32 s_svq1IntraMultistageCodes5[8] = {
+ 1, 1, 1, 1, 1, 1, 0, 1
+};
+
+static const byte *s_svq1IntraMultistageLengths[6] = {
+ s_svq1IntraMultistageLengths0, s_svq1IntraMultistageLengths1, s_svq1IntraMultistageLengths2,
+ s_svq1IntraMultistageLengths3, s_svq1IntraMultistageLengths4, s_svq1IntraMultistageLengths5
+};
+
+static const uint32 *s_svq1IntraMultistageCodes[6] = {
+ s_svq1IntraMultistageCodes0, s_svq1IntraMultistageCodes1, s_svq1IntraMultistageCodes2,
+ s_svq1IntraMultistageCodes3, s_svq1IntraMultistageCodes4, s_svq1IntraMultistageCodes5
+};
+
+static const byte s_svq1InterMultistageLengths0[8] = {
+ 2, 3, 3, 3, 3, 3, 4, 4
+};
+
+static const uint32 s_svq1InterMultistageCodes0[8] = {
+ 3, 5, 4, 3, 2, 1, 1, 0
+};
+
+static const byte s_svq1InterMultistageLengths1[8] = {
+ 2, 3, 3, 3, 3, 3, 4, 4
+};
+
+static const uint32 s_svq1InterMultistageCodes1[8] = {
+ 3, 5, 4, 3, 2, 1, 1, 0
+};
+
+static const byte s_svq1InterMultistageLengths2[8] = {
+ 1, 3, 3, 4, 4, 4, 5, 5
+};
+
+static const uint32 s_svq1InterMultistageCodes2[8] = {
+ 1, 3, 2, 3, 2, 1, 1, 0
+};
+
+static const byte s_svq1InterMultistageLengths3[8] = {
+ 1, 3, 3, 4, 4, 4, 5, 5
+};
+
+static const uint32 s_svq1InterMultistageCodes3[8] = {
+ 1, 3, 2, 3, 2, 1, 1, 0
+};
+
+static const byte s_svq1InterMultistageLengths4[8] = {
+ 1, 3, 3, 4, 4, 4, 5, 5
+};
+
+static const uint32 s_svq1InterMultistageCodes4[8] = {
+ 1, 3, 2, 3, 2, 1, 1, 0
+};
+
+static const byte s_svq1InterMultistageLengths5[8] = {
+ 1, 2, 3, 5, 5, 5, 6, 6
+};
+
+static const uint32 s_svq1InterMultistageCodes5[8] = {
+ 1, 1, 1, 3, 2, 1, 1, 0
+};
+
+static const byte *s_svq1InterMultistageLengths[6] = {
+ s_svq1InterMultistageLengths0, s_svq1InterMultistageLengths1, s_svq1InterMultistageLengths2,
+ s_svq1InterMultistageLengths3, s_svq1InterMultistageLengths4, s_svq1InterMultistageLengths5
+};
+
+static const uint32 *s_svq1InterMultistageCodes[6] = {
+ s_svq1InterMultistageCodes0, s_svq1InterMultistageCodes1, s_svq1InterMultistageCodes2,
+ s_svq1InterMultistageCodes3, s_svq1InterMultistageCodes4, s_svq1InterMultistageCodes5
+};
+
+static const byte s_svq1IntraMeanLengths[256] = {
+ 6, 7, 17, 20, 20, 20, 20, 20, 20, 19,
+ 11, 9, 11, 14, 14, 15, 16, 12, 10, 11,
+ 11, 9, 8, 8, 7, 4, 4, 6, 7, 8,
+ 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 7, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 7, 8, 8, 7, 8,
+ 8, 8, 8, 8, 7, 8, 7, 7, 8, 7,
+ 7, 8, 7, 8, 8, 8, 7, 7, 8, 7,
+ 8, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6,
+ 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 9,
+ 9, 9, 9, 9, 8, 8, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 11, 11, 10, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 14
+};
+
+static const uint32 s_svq1IntraMeanCodes[256] = {
+ 55, 86, 1, 1, 2, 3, 0, 4, 5, 3,
+ 21, 66, 20, 3, 2, 1, 1, 1, 43, 24,
+ 12, 65, 120, 108, 85, 15, 14, 52, 81, 114,
+ 110, 64, 63, 62, 61, 60, 59, 58, 57, 56,
+ 55, 67, 70, 71, 69, 68, 73, 72, 74, 121,
+ 118, 119, 113, 117, 116, 115, 106, 85, 112, 111,
+ 82, 109, 76, 107, 64, 105, 104, 103, 102, 101,
+ 100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
+ 90, 89, 88, 87, 86, 61, 84, 83, 63, 81,
+ 80, 79, 78, 77, 65, 75, 83, 62, 72, 79,
+ 82, 69, 80, 67, 66, 65, 66, 67, 62, 68,
+ 60, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 88, 89, 90, 91, 92, 93, 68, 73, 41,
+ 63, 61, 59, 44, 40, 37, 38, 94, 87, 84,
+ 95, 98, 99, 100, 97, 101, 103, 102, 53, 54,
+ 96, 57, 58, 56, 55, 54, 53, 52, 51, 50,
+ 49, 48, 45, 43, 42, 39, 64, 70, 71, 38,
+ 37, 36, 35, 34, 46, 47, 31, 54, 29, 33,
+ 27, 28, 25, 26, 24, 23, 22, 30, 32, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 53,
+ 49, 50, 51, 52, 25, 42, 23, 22, 21, 40,
+ 38, 37, 34, 33, 24, 20, 41, 18, 13, 14,
+ 15, 16, 17, 26, 27, 28, 29, 30, 31, 32,
+ 19, 35, 36, 9, 8, 7, 39, 5, 11, 6,
+ 4, 3, 2, 1, 10, 22, 25, 23, 13, 14,
+ 15, 16, 17, 18, 19, 1
+};
+
+static const byte s_svq1InterMeanLengths[512] = {
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 21, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 21,
+ 22, 22, 22, 22, 22, 22, 20, 21, 22, 21,
+ 22, 22, 20, 22, 22, 21, 19, 18, 20, 22,
+ 22, 21, 20, 19, 20, 20, 19, 19, 19, 18,
+ 19, 18, 19, 20, 19, 19, 18, 18, 18, 19,
+ 18, 18, 18, 17, 19, 18, 18, 17, 18, 18,
+ 18, 17, 17, 17, 17, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 15, 16, 15, 15, 15, 15,
+ 15, 15, 15, 15, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 13, 13, 13, 13, 13, 13, 13,
+ 13, 12, 12, 12, 12, 12, 12, 11, 11, 11,
+ 11, 11, 11, 10, 10, 10, 10, 10, 10, 9,
+ 9, 9, 9, 9, 8, 8, 8, 8, 7, 7,
+ 7, 6, 6, 5, 5, 4, 1, 3, 5, 5,
+ 6, 6, 7, 7, 7, 7, 8, 8, 8, 9,
+ 9, 9, 9, 9, 10, 10, 10, 10, 11, 11,
+ 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
+ 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 14, 14, 14, 14, 14, 14, 14, 14, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17,
+ 17, 17, 17, 17, 17, 17, 18, 17, 17, 17,
+ 17, 17, 17, 17, 19, 18, 18, 19, 18, 18,
+ 19, 18, 18, 18, 19, 18, 19, 19, 18, 20,
+ 20, 19, 19, 19, 19, 19, 19, 18, 19, 20,
+ 19, 19, 21, 20, 19, 20, 19, 19, 20, 20,
+ 22, 20, 22, 22, 21, 22, 22, 21, 21, 22,
+ 22, 20, 22, 22, 21, 22, 22, 22, 20, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 21, 21, 22, 22, 22, 21,
+ 22, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22
+};
+
+static const uint32 s_svq1InterMeanCodes[512] = {
+ 90, 212, 213, 214, 215, 216, 217, 218, 219, 220,
+ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
+ 232, 203, 233, 234, 231, 236, 237, 238, 239, 240,
+ 241, 242, 243, 244, 245, 246, 247, 248, 258, 235,
+ 249, 252, 253, 254, 256, 92, 96, 257, 113, 260,
+ 261, 251, 255, 134, 250, 124, 117, 259, 120, 211,
+ 123, 130, 210, 209, 208, 207, 206, 205, 204, 195,
+ 202, 201, 200, 199, 198, 197, 139, 196, 194, 193,
+ 192, 191, 190, 189, 188, 187, 186, 185, 97, 132,
+ 133, 134, 135, 136, 137, 138, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
+ 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
+ 164, 165, 166, 167, 168, 169, 170, 171, 127, 143,
+ 172, 173, 174, 175, 176, 177, 83, 144, 178, 145,
+ 179, 180, 84, 181, 182, 140, 52, 61, 85, 183,
+ 184, 139, 86, 61, 87, 88, 64, 67, 71, 42,
+ 46, 44, 70, 89, 73, 45, 56, 54, 57, 69,
+ 40, 48, 53, 32, 68, 50, 49, 31, 47, 46,
+ 45, 33, 34, 35, 36, 39, 35, 32, 29, 37,
+ 30, 36, 42, 38, 33, 41, 34, 35, 36, 27,
+ 26, 29, 31, 39, 23, 24, 25, 27, 28, 30,
+ 37, 32, 33, 19, 20, 21, 22, 23, 24, 25,
+ 26, 24, 23, 21, 20, 19, 18, 15, 16, 18,
+ 19, 27, 26, 14, 19, 15, 16, 17, 18, 13,
+ 20, 21, 12, 19, 15, 14, 16, 17, 12, 9,
+ 10, 8, 9, 9, 8, 5, 1, 3, 7, 6,
+ 11, 10, 14, 15, 11, 13, 11, 13, 12, 15,
+ 16, 17, 14, 18, 23, 20, 22, 21, 25, 24,
+ 23, 22, 21, 20, 17, 25, 26, 22, 29, 27,
+ 28, 32, 28, 35, 34, 33, 31, 30, 27, 29,
+ 36, 22, 26, 34, 29, 31, 21, 35, 24, 32,
+ 41, 40, 38, 37, 25, 28, 30, 23, 44, 43,
+ 28, 33, 45, 40, 31, 27, 26, 34, 45, 50,
+ 44, 39, 49, 51, 47, 43, 55, 42, 46, 48,
+ 41, 40, 38, 37, 47, 51, 52, 48, 58, 59,
+ 49, 60, 43, 41, 72, 39, 66, 65, 38, 82,
+ 81, 63, 62, 57, 60, 59, 58, 37, 56, 80,
+ 55, 54, 135, 79, 53, 78, 51, 50, 77, 76,
+ 131, 75, 129, 128, 142, 126, 125, 132, 141, 122,
+ 121, 74, 119, 118, 137, 116, 115, 114, 73, 112,
+ 111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
+ 101, 100, 99, 98, 138, 136, 95, 94, 93, 133,
+ 91, 131, 89, 88, 87, 86, 85, 84, 83, 82,
+ 81, 80, 79, 78, 77, 76, 75, 74, 73, 72,
+ 71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
+ 61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
+ 51, 50, 49, 48, 47, 46, 45, 44, 43, 42,
+ 41, 40, 39, 38, 37, 36, 35, 34, 33, 32,
+ 31, 30, 29, 28, 27, 26, 25, 24, 23, 22,
+ 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
+ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
+ 1, 0
+};
+
+static const byte s_svq1MotionComponentLengths[33] = {
+ 1, 2, 3, 4, 6, 7, 7, 7, 9, 9,
+ 9, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
+ 11, 12, 12
+};
+
+static const uint32 s_svq1MotionComponentCodes[33] = {
+ 1, 1, 1, 1, 3, 5, 4, 3, 11, 10,
+ 9, 17, 16, 15, 14, 13, 12, 11, 10, 9,
+ 8, 7, 6, 5, 4, 7, 6, 5, 4, 3,
+ 2, 3, 2
+};
+
+} // End of namespace Video
+
+#endif
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index ae0c35cd76..08340a19a6 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -53,7 +53,8 @@ CoktelDecoder::CoktelDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundT
_mixer(mixer), _soundType(soundType), _width(0), _height(0), _x(0), _y(0),
_defaultX(0), _defaultY(0), _features(0), _frameCount(0), _paletteDirty(false),
_ownSurface(true), _frameRate(12), _hasSound(false), _soundEnabled(false),
- _soundStage(kSoundNone), _audioStream(0) {
+ _soundStage(kSoundNone), _audioStream(0), _startTime(0), _pauseStartTime(0),
+ _isPaused(false) {
assert(_mixer);
@@ -261,6 +262,10 @@ bool CoktelDecoder::isPaletted() const {
return true;
}
+int CoktelDecoder::getCurFrame() const {
+ return _curFrame;
+}
+
void CoktelDecoder::close() {
disableSound();
freeSurface();
@@ -273,9 +278,22 @@ void CoktelDecoder::close() {
_features = 0;
- _frameCount = 0;
+ _curFrame = -1;
+ _frameCount = 0;
+
+ _startTime = 0;
_hasSound = false;
+
+ _isPaused = false;
+}
+
+Audio::Mixer::SoundType CoktelDecoder::getSoundType() const {
+ return _soundType;
+}
+
+Audio::AudioStream *CoktelDecoder::getAudioStream() const {
+ return _audioStream;
}
uint16 CoktelDecoder::getWidth() const {
@@ -291,6 +309,7 @@ uint32 CoktelDecoder::getFrameCount() const {
}
const byte *CoktelDecoder::getPalette() {
+ _paletteDirty = false;
return _palette;
}
@@ -625,14 +644,45 @@ Common::Rational CoktelDecoder::getFrameRate() const {
return _frameRate;
}
+uint32 CoktelDecoder::getTimeToNextFrame() const {
+ if (endOfVideo() || _curFrame < 0)
+ return 0;
+
+ uint32 elapsedTime = g_system->getMillis() - _startTime;
+ uint32 nextFrameStartTime = (Common::Rational((_curFrame + 1) * 1000) / getFrameRate()).toInt();
+
+ if (nextFrameStartTime <= elapsedTime)
+ return 0;
+
+ return nextFrameStartTime - elapsedTime;
+}
+
uint32 CoktelDecoder::getStaticTimeToNextFrame() const {
return (1000 / _frameRate).toInt();
}
+void CoktelDecoder::pauseVideo(bool pause) {
+ if (_isPaused != pause) {
+ if (_isPaused) {
+ // Add the time we were paused to the initial starting time
+ _startTime += g_system->getMillis() - _pauseStartTime;
+ } else {
+ // Store the time we paused for use later
+ _pauseStartTime = g_system->getMillis();
+ }
+
+ _isPaused = pause;
+ }
+}
+
inline void CoktelDecoder::unsignedToSigned(byte *buffer, int length) {
while (length-- > 0) *buffer++ ^= 0x80;
}
+bool CoktelDecoder::endOfVideo() const {
+ return !isVideoLoaded() || (getCurFrame() >= (int32)getFrameCount() - 1);
+}
+
PreIMDDecoder::PreIMDDecoder(uint16 width, uint16 height,
Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType),
@@ -646,6 +696,21 @@ PreIMDDecoder::~PreIMDDecoder() {
close();
}
+bool PreIMDDecoder::reloadStream(Common::SeekableReadStream *stream) {
+ if (!_stream)
+ return false;
+
+ if (!stream->seek(_stream->pos())) {
+ close();
+ return false;
+ }
+
+ delete _stream;
+ _stream = stream;
+
+ return true;
+}
+
bool PreIMDDecoder::seek(int32 frame, int whence, bool restart) {
if (!evaluateSeekFrame(frame, whence))
return false;
@@ -690,8 +755,6 @@ bool PreIMDDecoder::loadStream(Common::SeekableReadStream *stream) {
}
void PreIMDDecoder::close() {
- reset();
-
CoktelDecoder::close();
delete _stream;
@@ -840,6 +903,21 @@ IMDDecoder::~IMDDecoder() {
close();
}
+bool IMDDecoder::reloadStream(Common::SeekableReadStream *stream) {
+ if (!_stream)
+ return false;
+
+ if (!stream->seek(_stream->pos())) {
+ close();
+ return false;
+ }
+
+ delete _stream;
+ _stream = stream;
+
+ return true;
+}
+
bool IMDDecoder::seek(int32 frame, int whence, bool restart) {
if (!evaluateSeekFrame(frame, whence))
return false;
@@ -1129,8 +1207,6 @@ bool IMDDecoder::loadFrameTables(uint32 framePosPos, uint32 frameCoordsPos) {
}
void IMDDecoder::close() {
- reset();
-
CoktelDecoder::close();
delete _stream;
@@ -1195,8 +1271,6 @@ void IMDDecoder::processFrame() {
_dirtyRects.clear();
- _paletteDirty = false;
-
uint32 cmd = 0;
bool hasNextCmd = false;
bool startSound = false;
@@ -1512,7 +1586,7 @@ VMDDecoder::VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) :
_soundLastFilledFrame(0), _audioFormat(kAudioFormat8bitRaw),
_hasVideo(false), _videoCodec(0), _blitMode(0), _bytesPerPixel(0),
_firstFramePos(0), _videoBufferSize(0), _externalCodec(false), _codec(0),
- _subtitle(-1), _isPaletted(true) {
+ _subtitle(-1), _isPaletted(true), _autoStartSound(true) {
_videoBuffer [0] = 0;
_videoBuffer [1] = 0;
@@ -1526,6 +1600,21 @@ VMDDecoder::~VMDDecoder() {
close();
}
+bool VMDDecoder::reloadStream(Common::SeekableReadStream *stream) {
+ if (!_stream)
+ return false;
+
+ if (!stream->seek(_stream->pos())) {
+ close();
+ return false;
+ }
+
+ delete _stream;
+ _stream = stream;
+
+ return true;
+}
+
bool VMDDecoder::seek(int32 frame, int whence, bool restart) {
if (!evaluateSeekFrame(frame, whence))
return false;
@@ -1959,8 +2048,6 @@ bool VMDDecoder::readFiles() {
}
void VMDDecoder::close() {
- reset();
-
CoktelDecoder::close();
delete _stream;
@@ -2040,7 +2127,6 @@ void VMDDecoder::processFrame() {
_dirtyRects.clear();
- _paletteDirty = false;
_subtitle = -1;
bool startSound = false;
@@ -2160,8 +2246,9 @@ void VMDDecoder::processFrame() {
if (startSound && _soundEnabled) {
if (_hasSound && _audioStream) {
- _mixer->playStream(_soundType, &_audioHandle, _audioStream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ if (_autoStartSound)
+ _mixer->playStream(_soundType, &_audioHandle, _audioStream,
+ -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
_soundStage = kSoundPlaying;
} else
_soundStage = kSoundNone;
@@ -2687,6 +2774,94 @@ bool VMDDecoder::isPaletted() const {
return _isPaletted;
}
+void VMDDecoder::setAutoStartSound(bool autoStartSound) {
+ _autoStartSound = autoStartSound;
+}
+
+AdvancedVMDDecoder::AdvancedVMDDecoder(Audio::Mixer::SoundType soundType) {
+ _decoder = new VMDDecoder(g_system->getMixer(), soundType);
+ _decoder->setAutoStartSound(false);
+}
+
+AdvancedVMDDecoder::~AdvancedVMDDecoder() {
+ close();
+ delete _decoder;
+}
+
+bool AdvancedVMDDecoder::loadStream(Common::SeekableReadStream *stream) {
+ close();
+
+ if (!_decoder->loadStream(stream))
+ return false;
+
+ if (_decoder->hasVideo()) {
+ _videoTrack = new VMDVideoTrack(_decoder);
+ addTrack(_videoTrack);
+ }
+
+ if (_decoder->hasSound()) {
+ _audioTrack = new VMDAudioTrack(_decoder);
+ addTrack(_audioTrack);
+ }
+
+ return true;
+}
+
+void AdvancedVMDDecoder::close() {
+ VideoDecoder::close();
+ _decoder->close();
+}
+
+AdvancedVMDDecoder::VMDVideoTrack::VMDVideoTrack(VMDDecoder *decoder) : _decoder(decoder) {
+}
+
+uint16 AdvancedVMDDecoder::VMDVideoTrack::getWidth() const {
+ return _decoder->getWidth();
+}
+
+uint16 AdvancedVMDDecoder::VMDVideoTrack::getHeight() const {
+ return _decoder->getHeight();
+}
+
+Graphics::PixelFormat AdvancedVMDDecoder::VMDVideoTrack::getPixelFormat() const {
+ return _decoder->getPixelFormat();
+}
+
+int AdvancedVMDDecoder::VMDVideoTrack::getCurFrame() const {
+ return _decoder->getCurFrame();
+}
+
+int AdvancedVMDDecoder::VMDVideoTrack::getFrameCount() const {
+ return _decoder->getFrameCount();
+}
+
+const Graphics::Surface *AdvancedVMDDecoder::VMDVideoTrack::decodeNextFrame() {
+ return _decoder->decodeNextFrame();
+}
+
+const byte *AdvancedVMDDecoder::VMDVideoTrack::getPalette() const {
+ return _decoder->getPalette();
+}
+
+bool AdvancedVMDDecoder::VMDVideoTrack::hasDirtyPalette() const {
+ return _decoder->hasDirtyPalette();
+}
+
+Common::Rational AdvancedVMDDecoder::VMDVideoTrack::getFrameRate() const {
+ return _decoder->getFrameRate();
+}
+
+AdvancedVMDDecoder::VMDAudioTrack::VMDAudioTrack(VMDDecoder *decoder) : _decoder(decoder) {
+}
+
+Audio::Mixer::SoundType AdvancedVMDDecoder::VMDAudioTrack::getSoundType() const {
+ return _decoder->getSoundType();
+}
+
+Audio::AudioStream *AdvancedVMDDecoder::VMDAudioTrack::getAudioStream() const {
+ return _decoder->getAudioStream();
+}
+
} // End of namespace Video
#endif // VIDEO_COKTELDECODER_H
diff --git a/video/coktel_decoder.h b/video/coktel_decoder.h
index b99a44f332..91d52b65e6 100644
--- a/video/coktel_decoder.h
+++ b/video/coktel_decoder.h
@@ -64,7 +64,7 @@ class Codec;
* - gob
* - sci
*/
-class CoktelDecoder : public FixedRateVideoDecoder {
+class CoktelDecoder {
public:
struct State {
/** Set accordingly to what was done. */
@@ -77,7 +77,10 @@ public:
CoktelDecoder(Audio::Mixer *mixer,
Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
- ~CoktelDecoder();
+ virtual ~CoktelDecoder();
+
+ /** Replace the current video stream with this identical one. */
+ virtual bool reloadStream(Common::SeekableReadStream *stream) = 0;
virtual bool seek(int32 frame, int whence = SEEK_SET, bool restart = false) = 0;
@@ -95,6 +98,8 @@ public:
/** Override the video's frame rate. */
void setFrameRate(Common::Rational frameRate);
+ /** Get the video's frame rate. */
+ Common::Rational getFrameRate() const;
/** Get the video's default X position. */
uint16 getDefaultX() const;
@@ -135,21 +140,52 @@ public:
/** Is the video paletted or true color? */
virtual bool isPaletted() const;
+ /**
+ * Get the current frame
+ * @see VideoDecoder::getCurFrame()
+ */
+ int getCurFrame() const;
+
+ /**
+ * Decode the next frame
+ * @see VideoDecoder::decodeNextFrame()
+ */
+ virtual const Graphics::Surface *decodeNextFrame() = 0;
- // VideoDecoder interface
+ /**
+ * Load a video from a stream
+ * @see VideoDecoder::loadStream()
+ */
+ virtual bool loadStream(Common::SeekableReadStream *stream) = 0;
+ /** Has a video been loaded? */
+ virtual bool isVideoLoaded() const = 0;
+
+ /** Has the end of the video been reached? */
+ bool endOfVideo() const;
+
+ /** Close the video. */
void close();
+ /** Get the Mixer SoundType audio is being played with. */
+ Audio::Mixer::SoundType getSoundType() const;
+ /** Get the AudioStream for the audio. */
+ Audio::AudioStream *getAudioStream() const;
+
uint16 getWidth() const;
uint16 getHeight() const;
+ virtual Graphics::PixelFormat getPixelFormat() const = 0;
uint32 getFrameCount() const;
const byte *getPalette();
bool hasDirtyPalette() const;
+ uint32 getTimeToNextFrame() const;
uint32 getStaticTimeToNextFrame() const;
+ void pauseVideo(bool pause);
+
protected:
enum SoundStage {
kSoundNone = 0, ///< No sound.
@@ -183,8 +219,11 @@ protected:
uint32 _features;
+ int32 _curFrame;
uint32 _frameCount;
+ uint32 _startTime;
+
byte _palette[768];
bool _paletteDirty;
@@ -225,10 +264,9 @@ protected:
// Sound helper functions
inline void unsignedToSigned(byte *buffer, int length);
-
- // FixedRateVideoDecoder interface
-
- Common::Rational getFrameRate() const;
+private:
+ uint32 _pauseStartTime;
+ bool _isPaused;
};
class PreIMDDecoder : public CoktelDecoder {
@@ -237,10 +275,9 @@ public:
Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
~PreIMDDecoder();
- bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
-
+ bool reloadStream(Common::SeekableReadStream *stream);
- // VideoDecoder interface
+ bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
bool loadStream(Common::SeekableReadStream *stream);
void close();
@@ -268,13 +305,12 @@ public:
IMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
~IMDDecoder();
+ bool reloadStream(Common::SeekableReadStream *stream);
+
bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
void setXY(uint16 x, uint16 y);
-
- // VideoDecoder interface
-
bool loadStream(Common::SeekableReadStream *stream);
void close();
@@ -355,10 +391,14 @@ private:
};
class VMDDecoder : public CoktelDecoder {
+friend class AdvancedVMDDecoder;
+
public:
VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
~VMDDecoder();
+ bool reloadStream(Common::SeekableReadStream *stream);
+
bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
void setXY(uint16 x, uint16 y);
@@ -376,9 +416,6 @@ public:
bool hasVideo() const;
bool isPaletted() const;
-
- // VideoDecoder interface
-
bool loadStream(Common::SeekableReadStream *stream);
void close();
@@ -388,6 +425,9 @@ public:
Graphics::PixelFormat getPixelFormat() const;
+protected:
+ void setAutoStartSound(bool autoStartSound);
+
private:
enum PartType {
kPartTypeSeparator = 0,
@@ -459,6 +499,7 @@ private:
uint32 _soundDataSize;
uint32 _soundLastFilledFrame;
AudioFormat _audioFormat;
+ bool _autoStartSound;
// Video properties
bool _hasVideo;
@@ -513,6 +554,57 @@ private:
bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height);
};
+/**
+ * A wrapper around the VMD code that implements the VideoDecoder
+ * API.
+ */
+class AdvancedVMDDecoder : public VideoDecoder {
+public:
+ AdvancedVMDDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+ ~AdvancedVMDDecoder();
+
+ bool loadStream(Common::SeekableReadStream *stream);
+ void close();
+
+private:
+ class VMDVideoTrack : public FixedRateVideoTrack {
+ public:
+ VMDVideoTrack(VMDDecoder *decoder);
+
+ uint16 getWidth() const;
+ uint16 getHeight() const;
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const;
+ int getFrameCount() const;
+ const Graphics::Surface *decodeNextFrame();
+ const byte *getPalette() const;
+ bool hasDirtyPalette() const;
+
+ protected:
+ Common::Rational getFrameRate() const;
+
+ private:
+ VMDDecoder *_decoder;
+ };
+
+ class VMDAudioTrack : public AudioTrack {
+ public:
+ VMDAudioTrack(VMDDecoder *decoder);
+
+ Audio::Mixer::SoundType getSoundType() const;
+
+ protected:
+ virtual Audio::AudioStream *getAudioStream() const;
+
+ private:
+ VMDDecoder *_decoder;
+ };
+
+ VMDDecoder *_decoder;
+ VMDVideoTrack *_videoTrack;
+ VMDAudioTrack *_audioTrack;
+};
+
} // End of namespace Video
#endif // VIDEO_COKTELDECODER_H
diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index 7d1112a59c..5ac9bd2088 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -37,41 +37,43 @@
namespace Video {
DXADecoder::DXADecoder() {
- _fileStream = 0;
- _surface = 0;
- _dirtyPalette = false;
+}
- _frameBuffer1 = 0;
- _frameBuffer2 = 0;
- _scaledBuffer = 0;
+DXADecoder::~DXADecoder() {
+ close();
+}
- _inBuffer = 0;
- _inBufferSize = 0;
+bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
+ close();
- _decompBuffer = 0;
- _decompBufferSize = 0;
+ uint32 tag = stream->readUint32BE();
- _width = 0;
- _height = 0;
+ if (tag != MKTAG('D','E','X','A')) {
+ close();
+ return false;
+ }
- _frameSize = 0;
- _frameCount = 0;
- _frameRate = 0;
+ DXAVideoTrack *track = new DXAVideoTrack(stream);
+ addTrack(track);
- _scaleMode = S_NONE;
-}
+ readSoundData(stream);
-DXADecoder::~DXADecoder() {
- close();
+ track->setFrameStartPos();
+ return true;
}
-bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
- close();
+void DXADecoder::readSoundData(Common::SeekableReadStream *stream) {
+ // Skip over the tag by default
+ stream->readUint32BE();
+}
+DXADecoder::DXAVideoTrack::DXAVideoTrack(Common::SeekableReadStream *stream) {
_fileStream = stream;
-
- uint32 tag = _fileStream->readUint32BE();
- assert(tag == MKTAG('D','E','X','A'));
+ _curFrame = -1;
+ _frameStartOffset = 0;
+ _decompBuffer = 0;
+ _inBuffer = 0;
+ memset(_palette, 0, 256 * 3);
uint8 flags = _fileStream->readByte();
_frameCount = _fileStream->readUint16BE();
@@ -105,18 +107,14 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
_frameSize = _width * _height;
_decompBufferSize = _frameSize;
- _frameBuffer1 = (uint8 *)malloc(_frameSize);
+ _frameBuffer1 = new byte[_frameSize];
memset(_frameBuffer1, 0, _frameSize);
- _frameBuffer2 = (uint8 *)malloc(_frameSize);
+ _frameBuffer2 = new byte[_frameSize];
memset(_frameBuffer2, 0, _frameSize);
- if (!_frameBuffer1 || !_frameBuffer2)
- error("DXADecoder: Error allocating frame buffers (size %u)", _frameSize);
_scaledBuffer = 0;
if (_scaleMode != S_NONE) {
- _scaledBuffer = (uint8 *)malloc(_frameSize);
- if (!_scaledBuffer)
- error("Error allocating scale buffer (size %u)", _frameSize);
+ _scaledBuffer = new byte[_frameSize];
memset(_scaledBuffer, 0, _frameSize);
}
@@ -148,36 +146,33 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
} while (tag != 0);
}
#endif
-
- // Read the sound header
- _soundTag = _fileStream->readUint32BE();
-
- return true;
}
-void DXADecoder::close() {
- if (!_fileStream)
- return;
-
+DXADecoder::DXAVideoTrack::~DXAVideoTrack() {
delete _fileStream;
- _fileStream = 0;
-
delete _surface;
- _surface = 0;
+ delete[] _frameBuffer1;
+ delete[] _frameBuffer2;
+ delete[] _scaledBuffer;
+ delete[] _inBuffer;
+ delete[] _decompBuffer;
+}
- free(_frameBuffer1);
- free(_frameBuffer2);
- free(_scaledBuffer);
- free(_inBuffer);
- free(_decompBuffer);
+bool DXADecoder::DXAVideoTrack::rewind() {
+ _curFrame = -1;
+ _fileStream->seek(_frameStartOffset);
+ return true;
+}
- _inBuffer = 0;
- _decompBuffer = 0;
+Graphics::PixelFormat DXADecoder::DXAVideoTrack::getPixelFormat() const {
+ return _surface->format;
+}
- reset();
+void DXADecoder::DXAVideoTrack::setFrameStartPos() {
+ _frameStartOffset = _fileStream->pos();
}
-void DXADecoder::decodeZlib(byte *data, int size, int totalSize) {
+void DXADecoder::DXAVideoTrack::decodeZlib(byte *data, int size, int totalSize) {
#ifdef USE_ZLIB
unsigned long dstLen = totalSize;
Common::uncompress(data, &dstLen, _inBuffer, size);
@@ -187,14 +182,13 @@ void DXADecoder::decodeZlib(byte *data, int size, int totalSize) {
#define BLOCKW 4
#define BLOCKH 4
-void DXADecoder::decode12(int size) {
+void DXADecoder::DXAVideoTrack::decode12(int size) {
#ifdef USE_ZLIB
- if (_decompBuffer == NULL) {
- _decompBuffer = (byte *)malloc(_decompBufferSize);
+ if (!_decompBuffer) {
+ _decompBuffer = new byte[_decompBufferSize];
memset(_decompBuffer, 0, _decompBufferSize);
- if (_decompBuffer == NULL)
- error("Error allocating decomp buffer (size %u)", _decompBufferSize);
}
+
/* decompress the input data */
decodeZlib(_decompBuffer, size, _decompBufferSize);
@@ -287,15 +281,13 @@ void DXADecoder::decode12(int size) {
#endif
}
-void DXADecoder::decode13(int size) {
+void DXADecoder::DXAVideoTrack::decode13(int size) {
#ifdef USE_ZLIB
uint8 *codeBuf, *dataBuf, *motBuf, *maskBuf;
- if (_decompBuffer == NULL) {
- _decompBuffer = (byte *)malloc(_decompBufferSize);
+ if (!_decompBuffer) {
+ _decompBuffer = new byte[_decompBufferSize];
memset(_decompBuffer, 0, _decompBufferSize);
- if (_decompBuffer == NULL)
- error("Error allocating decomp buffer (size %u)", _decompBufferSize);
}
/* decompress the input data */
@@ -475,7 +467,7 @@ void DXADecoder::decode13(int size) {
#endif
}
-const Graphics::Surface *DXADecoder::decodeNextFrame() {
+const Graphics::Surface *DXADecoder::DXAVideoTrack::decodeNextFrame() {
uint32 tag = _fileStream->readUint32BE();
if (tag == MKTAG('C','M','A','P')) {
_fileStream->read(_palette, 256 * 3);
@@ -486,11 +478,10 @@ const Graphics::Surface *DXADecoder::decodeNextFrame() {
if (tag == MKTAG('F','R','A','M')) {
byte type = _fileStream->readByte();
uint32 size = _fileStream->readUint32BE();
- if ((_inBuffer == NULL) || (_inBufferSize < size)) {
- free(_inBuffer);
- _inBuffer = (byte *)malloc(size);
- if (_inBuffer == NULL)
- error("Error allocating input buffer (size %u)", size);
+
+ if (!_inBuffer || _inBufferSize < size) {
+ delete[] _inBuffer;
+ _inBuffer = new byte[size];
memset(_inBuffer, 0, size);
_inBufferSize = size;
}
@@ -551,9 +542,6 @@ const Graphics::Surface *DXADecoder::decodeNextFrame() {
_curFrame++;
- if (_curFrame == 0)
- _startTime = g_system->getMillis();
-
return _surface;
}
diff --git a/video/dxa_decoder.h b/video/dxa_decoder.h
index d13cd3076c..b3f2eca5e2 100644
--- a/video/dxa_decoder.h
+++ b/video/dxa_decoder.h
@@ -41,62 +41,74 @@ namespace Video {
* - sword1
* - sword2
*/
-class DXADecoder : public FixedRateVideoDecoder {
+class DXADecoder : public VideoDecoder {
public:
DXADecoder();
virtual ~DXADecoder();
bool loadStream(Common::SeekableReadStream *stream);
- void close();
-
- bool isVideoLoaded() const { return _fileStream != 0; }
- uint16 getWidth() const { return _width; }
- uint16 getHeight() const { return _height; }
- uint32 getFrameCount() const { return _frameCount; }
- const Graphics::Surface *decodeNextFrame();
- Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
- const byte *getPalette() { _dirtyPalette = false; return _palette; }
- bool hasDirtyPalette() const { return _dirtyPalette; }
+protected:
/**
- * Get the sound chunk tag of the loaded DXA file
+ * Read the sound data out of the given DXA stream
*/
- uint32 getSoundTag() { return _soundTag; }
-
-protected:
- Common::Rational getFrameRate() const { return _frameRate; }
-
- Common::SeekableReadStream *_fileStream;
+ virtual void readSoundData(Common::SeekableReadStream *stream);
private:
- void decodeZlib(byte *data, int size, int totalSize);
- void decode12(int size);
- void decode13(int size);
-
- enum ScaleMode {
- S_NONE,
- S_INTERLACED,
- S_DOUBLE
+ class DXAVideoTrack : public FixedRateVideoTrack {
+ public:
+ DXAVideoTrack(Common::SeekableReadStream *stream);
+ ~DXAVideoTrack();
+
+ bool isRewindable() const { return true; }
+ bool rewind();
+
+ uint16 getWidth() const { return _width; }
+ uint16 getHeight() const { return _height; }
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ const Graphics::Surface *decodeNextFrame();
+ const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ bool hasDirtyPalette() const { return _dirtyPalette; }
+
+ void setFrameStartPos();
+
+ protected:
+ Common::Rational getFrameRate() const { return _frameRate; }
+
+ private:
+ void decodeZlib(byte *data, int size, int totalSize);
+ void decode12(int size);
+ void decode13(int size);
+
+ enum ScaleMode {
+ S_NONE,
+ S_INTERLACED,
+ S_DOUBLE
+ };
+
+ Common::SeekableReadStream *_fileStream;
+ Graphics::Surface *_surface;
+
+ byte *_frameBuffer1;
+ byte *_frameBuffer2;
+ byte *_scaledBuffer;
+ byte *_inBuffer;
+ uint32 _inBufferSize;
+ byte *_decompBuffer;
+ uint32 _decompBufferSize;
+ uint16 _curHeight;
+ uint32 _frameSize;
+ ScaleMode _scaleMode;
+ uint16 _width, _height;
+ uint32 _frameRate;
+ uint32 _frameCount;
+ byte _palette[256 * 3];
+ mutable bool _dirtyPalette;
+ int _curFrame;
+ uint32 _frameStartOffset;
};
-
- Graphics::Surface *_surface;
- byte _palette[256 * 3];
- bool _dirtyPalette;
-
- byte *_frameBuffer1;
- byte *_frameBuffer2;
- byte *_scaledBuffer;
- byte *_inBuffer;
- uint32 _inBufferSize;
- byte *_decompBuffer;
- uint32 _decompBufferSize;
- uint16 _curHeight;
- uint32 _frameSize;
- ScaleMode _scaleMode;
- uint32 _soundTag;
- uint16 _width, _height;
- uint32 _frameRate;
- uint32 _frameCount;
};
} // End of namespace Video
diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp
index bdcdedc142..1a0627615b 100644
--- a/video/flic_decoder.cpp
+++ b/video/flic_decoder.cpp
@@ -26,13 +26,11 @@
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "graphics/surface.h"
namespace Video {
FlicDecoder::FlicDecoder() {
- _paletteChanged = false;
- _fileStream = 0;
- _surface = 0;
}
FlicDecoder::~FlicDecoder() {
@@ -42,35 +40,59 @@ FlicDecoder::~FlicDecoder() {
bool FlicDecoder::loadStream(Common::SeekableReadStream *stream) {
close();
- _fileStream = stream;
-
- /* uint32 frameSize = */ _fileStream->readUint32LE();
- uint16 frameType = _fileStream->readUint16LE();
+ /* uint32 frameSize = */ stream->readUint32LE();
+ uint16 frameType = stream->readUint16LE();
// Check FLC magic number
if (frameType != 0xAF12) {
- warning("FlicDecoder::FlicDecoder(): attempted to load non-FLC data (type = 0x%04X)", frameType);
- delete _fileStream;
- _fileStream = 0;
+ warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
return false;
}
-
- _frameCount = _fileStream->readUint16LE();
- uint16 width = _fileStream->readUint16LE();
- uint16 height = _fileStream->readUint16LE();
- uint16 colorDepth = _fileStream->readUint16LE();
+ uint16 frameCount = stream->readUint16LE();
+ uint16 width = stream->readUint16LE();
+ uint16 height = stream->readUint16LE();
+ uint16 colorDepth = stream->readUint16LE();
if (colorDepth != 8) {
- warning("FlicDecoder::FlicDecoder(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", frameType);
- delete _fileStream;
- _fileStream = 0;
+ warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
return false;
}
+ addTrack(new FlicVideoTrack(stream, frameCount, width, height));
+ return true;
+}
+
+const Common::List<Common::Rect> *FlicDecoder::getDirtyRects() const {
+ const Track *track = getTrack(0);
+
+ if (track)
+ return ((const FlicVideoTrack *)track)->getDirtyRects();
+
+ return 0;
+}
+
+void FlicDecoder::clearDirtyRects() {
+ Track *track = getTrack(0);
+
+ if (track)
+ ((FlicVideoTrack *)track)->clearDirtyRects();
+}
+
+void FlicDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
+ Track *track = getTrack(0);
+
+ if (track)
+ ((FlicVideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
+}
+
+FlicDecoder::FlicVideoTrack::FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height) {
+ _fileStream = stream;
+ _frameCount = frameCount;
+
_fileStream->readUint16LE(); // flags
// Note: The normal delay is a 32-bit integer (dword), whereas the overridden delay is a 16-bit integer (word)
// the frame delay is the FLIC "speed", in milliseconds.
- _frameRate = Common::Rational(1000, _fileStream->readUint32LE());
+ _frameDelay = _startFrameDelay = _fileStream->readUint32LE();
_fileStream->seek(80);
_offsetFrame1 = _fileStream->readUint32LE();
@@ -78,112 +100,53 @@ bool FlicDecoder::loadStream(Common::SeekableReadStream *stream) {
_surface = new Graphics::Surface();
_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- _palette = (byte *)malloc(3 * 256);
+ _palette = new byte[3 * 256];
memset(_palette, 0, 3 * 256);
- _paletteChanged = false;
+ _dirtyPalette = false;
+
+ _curFrame = -1;
+ _nextFrameStartTime = 0;
+ _atRingFrame = false;
// Seek to the first frame
_fileStream->seek(_offsetFrame1);
- return true;
}
-void FlicDecoder::close() {
- if (!_fileStream)
- return;
-
+FlicDecoder::FlicVideoTrack::~FlicVideoTrack() {
delete _fileStream;
- _fileStream = 0;
+ delete[] _palette;
_surface->free();
delete _surface;
- _surface = 0;
-
- free(_palette);
- _dirtyRects.clear();
-
- reset();
}
-void FlicDecoder::decodeByteRun(uint8 *data) {
- byte *ptr = (byte *)_surface->pixels;
- while ((int32)(ptr - (byte *)_surface->pixels) < (getWidth() * getHeight())) {
- int chunks = *data++;
- while (chunks--) {
- int count = (int8)*data++;
- if (count > 0) {
- memset(ptr, *data++, count);
- } else {
- count = -count;
- memcpy(ptr, data, count);
- data += count;
- }
- ptr += count;
- }
- }
-
- // Redraw
- _dirtyRects.clear();
- _dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight()));
+bool FlicDecoder::FlicVideoTrack::endOfTrack() const {
+ return getCurFrame() >= getFrameCount() - 1;
}
-#define OP_PACKETCOUNT 0
-#define OP_UNDEFINED 1
-#define OP_LASTPIXEL 2
-#define OP_LINESKIPCOUNT 3
-
-void FlicDecoder::decodeDeltaFLC(uint8 *data) {
- uint16 linesInChunk = READ_LE_UINT16(data); data += 2;
- uint16 currentLine = 0;
- uint16 packetCount = 0;
-
- while (linesInChunk--) {
- uint16 opcode;
+bool FlicDecoder::FlicVideoTrack::rewind() {
+ _curFrame = -1;
+ _nextFrameStartTime = 0;
- // First process all the opcodes.
- do {
- opcode = READ_LE_UINT16(data); data += 2;
+ if (endOfTrack() && _fileStream->pos() < _fileStream->size())
+ _atRingFrame = true;
+ else
+ _fileStream->seek(_offsetFrame1);
- switch ((opcode >> 14) & 3) {
- case OP_PACKETCOUNT:
- packetCount = opcode;
- break;
- case OP_UNDEFINED:
- break;
- case OP_LASTPIXEL:
- *((byte *)_surface->pixels + currentLine * getWidth() + getWidth() - 1) = (opcode & 0xFF);
- _dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1));
- break;
- case OP_LINESKIPCOUNT:
- currentLine += -(int16)opcode;
- break;
- }
- } while (((opcode >> 14) & 3) != OP_PACKETCOUNT);
+ _frameDelay = _startFrameDelay;
+ return true;
+}
- uint16 column = 0;
+uint16 FlicDecoder::FlicVideoTrack::getWidth() const {
+ return _surface->w;
+}
- // Now interpret the RLE data
- while (packetCount--) {
- column += *data++;
- int rleCount = (int8)*data++;
- if (rleCount > 0) {
- memcpy((byte *)_surface->pixels + (currentLine * getWidth()) + column, data, rleCount * 2);
- data += rleCount * 2;
- _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
- } else if (rleCount < 0) {
- rleCount = -rleCount;
- uint16 dataWord = READ_UINT16(data); data += 2;
- for (int i = 0; i < rleCount; ++i) {
- WRITE_UINT16((byte *)_surface->pixels + currentLine * getWidth() + column + i * 2, dataWord);
- }
- _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
- } else { // End of cutscene ?
- return;
- }
- column += rleCount * 2;
- }
+uint16 FlicDecoder::FlicVideoTrack::getHeight() const {
+ return _surface->h;
+}
- currentLine++;
- }
+Graphics::PixelFormat FlicDecoder::FlicVideoTrack::getPixelFormat() const {
+ return _surface->format;
}
#define FLI_SETPAL 4
@@ -192,7 +155,7 @@ void FlicDecoder::decodeDeltaFLC(uint8 *data) {
#define PSTAMP 18
#define FRAME_TYPE 0xF1FA
-const Graphics::Surface *FlicDecoder::decodeNextFrame() {
+const Graphics::Surface *FlicDecoder::FlicVideoTrack::decodeNextFrame() {
// Read chunk
uint32 frameSize = _fileStream->readUint32LE();
uint16 frameType = _fileStream->readUint16LE();
@@ -201,15 +164,12 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() {
switch (frameType) {
case FRAME_TYPE:
{
- // FIXME: FLIC should be switched over to a variable frame rate VideoDecoder to handle
- // this properly.
-
chunkCount = _fileStream->readUint16LE();
// Note: The overridden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword)
// the frame delay is the FLIC "speed", in milliseconds.
uint16 newFrameDelay = _fileStream->readUint16LE(); // "speed", in milliseconds
if (newFrameDelay > 0)
- _frameRate = Common::Rational(1000, newFrameDelay);
+ _frameDelay = newFrameDelay;
_fileStream->readUint16LE(); // reserved, always 0
uint16 newWidth = _fileStream->readUint16LE();
@@ -240,10 +200,11 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() {
frameType = _fileStream->readUint16LE();
uint8 *data = new uint8[frameSize - 6];
_fileStream->read(data, frameSize - 6);
+
switch (frameType) {
case FLI_SETPAL:
unpackPalette(data);
- _paletteChanged = true;
+ _dirtyPalette = true;
break;
case FLI_SS2:
decodeDeltaFLC(data);
@@ -264,26 +225,111 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() {
}
_curFrame++;
+ _nextFrameStartTime += _frameDelay;
- // If we just processed the ring frame, set the next frame
- if (_curFrame == (int32)_frameCount) {
- _curFrame = 0;
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
_fileStream->seek(_offsetFrame2);
}
- if (_curFrame == 0)
- _startTime = g_system->getMillis();
-
return _surface;
}
-void FlicDecoder::reset() {
- FixedRateVideoDecoder::reset();
- if (_fileStream)
- _fileStream->seek(_offsetFrame1);
+void FlicDecoder::FlicVideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
+ for (Common::List<Common::Rect>::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
+ for (int y = (*it).top; y < (*it).bottom; ++y) {
+ const int x = (*it).left;
+ memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x);
+ }
+ }
+
+ clearDirtyRects();
}
-void FlicDecoder::unpackPalette(uint8 *data) {
+void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) {
+ byte *ptr = (byte *)_surface->pixels;
+ while ((int32)(ptr - (byte *)_surface->pixels) < (getWidth() * getHeight())) {
+ int chunks = *data++;
+ while (chunks--) {
+ int count = (int8)*data++;
+ if (count > 0) {
+ memset(ptr, *data++, count);
+ } else {
+ count = -count;
+ memcpy(ptr, data, count);
+ data += count;
+ }
+ ptr += count;
+ }
+ }
+
+ // Redraw
+ _dirtyRects.clear();
+ _dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight()));
+}
+
+#define OP_PACKETCOUNT 0
+#define OP_UNDEFINED 1
+#define OP_LASTPIXEL 2
+#define OP_LINESKIPCOUNT 3
+
+void FlicDecoder::FlicVideoTrack::decodeDeltaFLC(uint8 *data) {
+ uint16 linesInChunk = READ_LE_UINT16(data); data += 2;
+ uint16 currentLine = 0;
+ uint16 packetCount = 0;
+
+ while (linesInChunk--) {
+ uint16 opcode;
+
+ // First process all the opcodes.
+ do {
+ opcode = READ_LE_UINT16(data); data += 2;
+
+ switch ((opcode >> 14) & 3) {
+ case OP_PACKETCOUNT:
+ packetCount = opcode;
+ break;
+ case OP_UNDEFINED:
+ break;
+ case OP_LASTPIXEL:
+ *((byte *)_surface->pixels + currentLine * getWidth() + getWidth() - 1) = (opcode & 0xFF);
+ _dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1));
+ break;
+ case OP_LINESKIPCOUNT:
+ currentLine += -(int16)opcode;
+ break;
+ }
+ } while (((opcode >> 14) & 3) != OP_PACKETCOUNT);
+
+ uint16 column = 0;
+
+ // Now interpret the RLE data
+ while (packetCount--) {
+ column += *data++;
+ int rleCount = (int8)*data++;
+ if (rleCount > 0) {
+ memcpy((byte *)_surface->pixels + (currentLine * getWidth()) + column, data, rleCount * 2);
+ data += rleCount * 2;
+ _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
+ } else if (rleCount < 0) {
+ rleCount = -rleCount;
+ uint16 dataWord = READ_UINT16(data); data += 2;
+ for (int i = 0; i < rleCount; ++i) {
+ WRITE_UINT16((byte *)_surface->pixels + currentLine * getWidth() + column + i * 2, dataWord);
+ }
+ _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
+ } else { // End of cutscene ?
+ return;
+ }
+ column += rleCount * 2;
+ }
+
+ currentLine++;
+ }
+}
+
+void FlicDecoder::FlicVideoTrack::unpackPalette(uint8 *data) {
uint16 numPackets = READ_LE_UINT16(data); data += 2;
if (0 == READ_LE_UINT16(data)) { //special case
@@ -308,14 +354,4 @@ void FlicDecoder::unpackPalette(uint8 *data) {
}
}
-void FlicDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
- for (Common::List<Common::Rect>::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- for (int y = (*it).top; y < (*it).bottom; ++y) {
- const int x = (*it).left;
- memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x);
- }
- }
- _dirtyRects.clear();
-}
-
} // End of namespace Video
diff --git a/video/flic_decoder.h b/video/flic_decoder.h
index 9badc3da2e..9037af05d6 100644
--- a/video/flic_decoder.h
+++ b/video/flic_decoder.h
@@ -25,15 +25,17 @@
#include "video/video_decoder.h"
#include "common/list.h"
-#include "common/rational.h"
#include "common/rect.h"
-#include "graphics/pixelformat.h"
-#include "graphics/surface.h"
namespace Common {
class SeekableReadStream;
}
+namespace Graphics {
+struct PixelFormat;
+struct Surface;
+}
+
namespace Video {
/**
@@ -42,58 +44,63 @@ namespace Video {
* Video decoder used in engines:
* - tucker
*/
-class FlicDecoder : public FixedRateVideoDecoder {
+class FlicDecoder : public VideoDecoder {
public:
FlicDecoder();
virtual ~FlicDecoder();
- /**
- * Load a video file
- * @param stream the stream to load
- */
bool loadStream(Common::SeekableReadStream *stream);
- void close();
-
- /**
- * Decode the next frame and return the frame's surface
- * @note the return surface should *not* be freed
- * @note this may return 0, in which case the last frame should be kept on screen
- */
- const Graphics::Surface *decodeNextFrame();
-
- bool isVideoLoaded() const { return _fileStream != 0; }
- uint16 getWidth() const { return _surface->w; }
- uint16 getHeight() const { return _surface->h; }
- uint32 getFrameCount() const { return _frameCount; }
- Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
-
- const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
- void clearDirtyRects() { _dirtyRects.clear(); }
- void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
-
- const byte *getPalette() { _paletteChanged = false; return _palette; }
- bool hasDirtyPalette() const { return _paletteChanged; }
- void reset();
-protected:
- Common::Rational getFrameRate() const { return _frameRate; }
+ const Common::List<Common::Rect> *getDirtyRects() const;
+ void clearDirtyRects();
+ void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
private:
- uint16 _offsetFrame1;
- uint16 _offsetFrame2;
- byte *_palette;
- bool _paletteChanged;
-
- void decodeByteRun(uint8 *data);
- void decodeDeltaFLC(uint8 *data);
- void unpackPalette(uint8 *mem);
-
- Common::SeekableReadStream *_fileStream;
- Graphics::Surface *_surface;
- uint32 _frameCount;
- Common::Rational _frameRate;
-
- Common::List<Common::Rect> _dirtyRects;
+ class FlicVideoTrack : public VideoTrack {
+ public:
+ FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height);
+ ~FlicVideoTrack();
+
+ bool endOfTrack() const;
+ bool isRewindable() const { return true; }
+ bool rewind();
+
+ uint16 getWidth() const;
+ uint16 getHeight() const;
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
+ const Graphics::Surface *decodeNextFrame();
+ const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ bool hasDirtyPalette() const { return _dirtyPalette; }
+
+ const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
+ void clearDirtyRects() { _dirtyRects.clear(); }
+ void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
+
+ private:
+ Common::SeekableReadStream *_fileStream;
+ Graphics::Surface *_surface;
+
+ int _curFrame;
+ bool _atRingFrame;
+
+ uint16 _offsetFrame1;
+ uint16 _offsetFrame2;
+ byte *_palette;
+ mutable bool _dirtyPalette;
+
+ uint32 _frameCount;
+ uint32 _frameDelay, _startFrameDelay;
+ uint32 _nextFrameStartTime;
+
+ Common::List<Common::Rect> _dirtyRects;
+
+ void decodeByteRun(uint8 *data);
+ void decodeDeltaFLC(uint8 *data);
+ void unpackPalette(uint8 *mem);
+ };
};
} // End of namespace Video
diff --git a/video/module.mk b/video/module.mk
index 900a781d0a..287e14ce18 100644
--- a/video/module.mk
+++ b/video/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS := \
codecs/qtrle.o \
codecs/rpza.o \
codecs/smc.o \
+ codecs/svq1.o \
codecs/truemotion1.o
ifdef USE_BINK
@@ -25,5 +26,10 @@ MODULE_OBJS += \
bink_decoder.o
endif
+ifdef USE_THEORADEC
+MODULE_OBJS += \
+ theora_decoder.o
+endif
+
# Include common rules
include $(srcdir)/rules.mk
diff --git a/video/psx_decoder.cpp b/video/psx_decoder.cpp
index 7c04b7f041..57c8972ee5 100644
--- a/video/psx_decoder.cpp
+++ b/video/psx_decoder.cpp
@@ -149,22 +149,12 @@ static const uint32 s_huffmanACSymbols[AC_CODE_COUNT] = {
END_OF_BLOCK
};
-PSXStreamDecoder::PSXStreamDecoder(CDSpeed speed, uint32 frameCount) : _nextFrameStartTime(0, speed), _frameCount(frameCount) {
+PSXStreamDecoder::PSXStreamDecoder(CDSpeed speed, uint32 frameCount) : _speed(speed), _frameCount(frameCount) {
_stream = 0;
- _audStream = 0;
- _surface = new Graphics::Surface();
- _yBuffer = _cbBuffer = _crBuffer = 0;
- _acHuffman = new Common::Huffman(0, AC_CODE_COUNT, s_huffmanACCodes, s_huffmanACLengths, s_huffmanACSymbols);
- _dcHuffmanChroma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCChromaCodes, s_huffmanDCChromaLengths, s_huffmanDCSymbols);
- _dcHuffmanLuma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCLumaCodes, s_huffmanDCLumaLengths, s_huffmanDCSymbols);
}
PSXStreamDecoder::~PSXStreamDecoder() {
close();
- delete _surface;
- delete _acHuffman;
- delete _dcHuffmanLuma;
- delete _dcHuffmanChroma;
}
#define RAW_CD_SECTOR_SIZE 2352
@@ -178,95 +168,30 @@ bool PSXStreamDecoder::loadStream(Common::SeekableReadStream *stream) {
close();
_stream = stream;
-
- Common::SeekableReadStream *sector = readSector();
-
- if (!sector) {
- close();
- return false;
- }
-
- // Rip out video info from the first frame
- sector->seek(18);
- byte sectorType = sector->readByte() & CDXA_TYPE_MASK;
-
- if (sectorType != CDXA_TYPE_VIDEO && sectorType != CDXA_TYPE_DATA) {
- close();
- return false;
- }
-
- sector->seek(40);
-
- uint16 width = sector->readUint16LE();
- uint16 height = sector->readUint16LE();
- _surface->create(width, height, g_system->getScreenFormat());
-
- _macroBlocksW = (width + 15) / 16;
- _macroBlocksH = (height + 15) / 16;
- _yBuffer = new byte[_macroBlocksW * _macroBlocksH * 16 * 16];
- _cbBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8];
- _crBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8];
-
- delete sector;
- _stream->seek(0);
+ readNextPacket();
return true;
}
void PSXStreamDecoder::close() {
- if (!_stream)
- return;
+ VideoDecoder::close();
+ _audioTrack = 0;
+ _videoTrack = 0;
+ _frameCount = 0;
delete _stream;
_stream = 0;
-
- // Deinitialize sound
- g_system->getMixer()->stopHandle(_audHandle);
- _audStream = 0;
-
- _surface->free();
-
- memset(&_adpcmStatus, 0, sizeof(_adpcmStatus));
-
- _macroBlocksW = _macroBlocksH = 0;
- delete[] _yBuffer; _yBuffer = 0;
- delete[] _cbBuffer; _cbBuffer = 0;
- delete[] _crBuffer; _crBuffer = 0;
-
- reset();
-}
-
-uint32 PSXStreamDecoder::getElapsedTime() const {
- // TODO: Currently, the audio is always after the video so using this
- // can often lead to gaps in the audio...
- //if (_audStream)
- // return _mixer->getSoundElapsedTime(_audHandle);
-
- return VideoDecoder::getElapsedTime();
-}
-
-uint32 PSXStreamDecoder::getTimeToNextFrame() const {
- if (!isVideoLoaded() || endOfVideo())
- return 0;
-
- uint32 nextTimeMillis = _nextFrameStartTime.msecs();
- uint32 elapsedTime = getElapsedTime();
-
- if (elapsedTime > nextTimeMillis)
- return 0;
-
- return nextTimeMillis - elapsedTime;
}
#define VIDEO_DATA_CHUNK_SIZE 2016
#define VIDEO_DATA_HEADER_SIZE 56
-const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() {
+void PSXStreamDecoder::readNextPacket() {
Common::SeekableReadStream *sector = 0;
byte *partialFrame = 0;
int sectorsRead = 0;
- while (!endOfVideo()) {
+ while (_stream->pos() < _stream->size()) {
sector = readSector();
sectorsRead++;
@@ -284,6 +209,11 @@ const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() {
case CDXA_TYPE_DATA:
case CDXA_TYPE_VIDEO:
if (track == 1) {
+ if (!_videoTrack) {
+ _videoTrack = new PSXVideoTrack(sector, _speed, _frameCount);
+ addTrack(_videoTrack);
+ }
+
sector->seek(28);
uint16 curSector = sector->readUint16LE();
uint16 sectorCount = sector->readUint16LE();
@@ -303,35 +233,27 @@ const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() {
// Done assembling the frame
Common::SeekableReadStream *frame = new Common::MemoryReadStream(partialFrame, frameSize, DisposeAfterUse::YES);
- decodeFrame(frame);
-
+ _videoTrack->decodeFrame(frame, sectorsRead);
+
delete frame;
delete sector;
-
- _curFrame++;
- if (_curFrame == 0)
- _startTime = g_system->getMillis();
-
- // Increase the time by the amount of sectors we read
- // One may notice that this is still not the most precise
- // method since a frame takes up the time its sectors took
- // up instead of the amount of time it takes the next frame
- // to be read from the sectors. The actual frame rate should
- // be constant instead of variable, so the slight difference
- // in a frame's showing time is negligible (1/150 of a second).
- _nextFrameStartTime = _nextFrameStartTime.addFrames(sectorsRead);
-
- return _surface;
+ return;
}
} else
error("Unhandled multi-track video");
break;
case CDXA_TYPE_AUDIO:
// We only handle one audio channel so far
- if (track == 1)
- queueAudioFromSector(sector);
- else
+ if (track == 1) {
+ if (!_audioTrack) {
+ _audioTrack = new PSXAudioTrack(sector);
+ addTrack(_audioTrack);
+ }
+
+ _audioTrack->queueAudioFromSector(sector);
+ } else {
warning("Unhandled multi-track audio");
+ }
break;
default:
// This shows up way too often, but the other sectors
@@ -343,7 +265,19 @@ const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() {
delete sector;
}
- return 0;
+ if (_stream->pos() >= _stream->size()) {
+ if (_videoTrack)
+ _videoTrack->setEndOfTrack();
+
+ if (_audioTrack)
+ _audioTrack->setEndOfTrack();
+ }
+}
+
+bool PSXStreamDecoder::useAudioSync() const {
+ // Audio sync is disabled since most audio data comes after video
+ // data.
+ return false;
}
static const byte s_syncHeader[12] = { 0x00, 0xff ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
@@ -363,7 +297,7 @@ Common::SeekableReadStream *PSXStreamDecoder::readSector() {
// Ha! It's palindromic!
#define AUDIO_DATA_CHUNK_SIZE 2304
-#define AUDIO_DATA_SAMPLE_COUNT 4032
+#define AUDIO_DATA_SAMPLE_COUNT 4032
static const int s_xaTable[5][2] = {
{ 0, 0 },
@@ -373,20 +307,29 @@ static const int s_xaTable[5][2] = {
{ 122, -60 }
};
-void PSXStreamDecoder::queueAudioFromSector(Common::SeekableReadStream *sector) {
+PSXStreamDecoder::PSXAudioTrack::PSXAudioTrack(Common::SeekableReadStream *sector) {
assert(sector);
+ _endOfTrack = false;
- if (!_audStream) {
- // Initialize audio stream
- sector->seek(19);
- byte format = sector->readByte();
+ sector->seek(19);
+ byte format = sector->readByte();
+ bool stereo = (format & (1 << 0)) != 0;
+ uint rate = (format & (1 << 2)) ? 18900 : 37800;
+ _audStream = Audio::makeQueuingAudioStream(rate, stereo);
- bool stereo = (format & (1 << 0)) != 0;
- uint rate = (format & (1 << 2)) ? 18900 : 37800;
+ memset(&_adpcmStatus, 0, sizeof(_adpcmStatus));
+}
- _audStream = Audio::makeQueuingAudioStream(rate, stereo);
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream);
- }
+PSXStreamDecoder::PSXAudioTrack::~PSXAudioTrack() {
+ delete _audStream;
+}
+
+bool PSXStreamDecoder::PSXAudioTrack::endOfTrack() const {
+ return AudioTrack::endOfTrack() && _endOfTrack;
+}
+
+void PSXStreamDecoder::PSXAudioTrack::queueAudioFromSector(Common::SeekableReadStream *sector) {
+ assert(sector);
sector->seek(24);
@@ -472,7 +415,54 @@ void PSXStreamDecoder::queueAudioFromSector(Common::SeekableReadStream *sector)
delete[] buf;
}
-void PSXStreamDecoder::decodeFrame(Common::SeekableReadStream *frame) {
+Audio::AudioStream *PSXStreamDecoder::PSXAudioTrack::getAudioStream() const {
+ return _audStream;
+}
+
+
+PSXStreamDecoder::PSXVideoTrack::PSXVideoTrack(Common::SeekableReadStream *firstSector, CDSpeed speed, int frameCount) : _nextFrameStartTime(0, speed), _frameCount(frameCount) {
+ assert(firstSector);
+
+ firstSector->seek(40);
+ uint16 width = firstSector->readUint16LE();
+ uint16 height = firstSector->readUint16LE();
+ _surface = new Graphics::Surface();
+ _surface->create(width, height, g_system->getScreenFormat());
+
+ _macroBlocksW = (width + 15) / 16;
+ _macroBlocksH = (height + 15) / 16;
+ _yBuffer = new byte[_macroBlocksW * _macroBlocksH * 16 * 16];
+ _cbBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8];
+ _crBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8];
+
+ _endOfTrack = false;
+ _curFrame = -1;
+ _acHuffman = new Common::Huffman(0, AC_CODE_COUNT, s_huffmanACCodes, s_huffmanACLengths, s_huffmanACSymbols);
+ _dcHuffmanChroma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCChromaCodes, s_huffmanDCChromaLengths, s_huffmanDCSymbols);
+ _dcHuffmanLuma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCLumaCodes, s_huffmanDCLumaLengths, s_huffmanDCSymbols);
+}
+
+PSXStreamDecoder::PSXVideoTrack::~PSXVideoTrack() {
+ _surface->free();
+ delete _surface;
+
+ delete[] _yBuffer;
+ delete[] _cbBuffer;
+ delete[] _crBuffer;
+ delete _acHuffman;
+ delete _dcHuffmanChroma;
+ delete _dcHuffmanLuma;
+}
+
+uint32 PSXStreamDecoder::PSXVideoTrack::getNextFrameStartTime() const {
+ return _nextFrameStartTime.msecs();
+}
+
+const Graphics::Surface *PSXStreamDecoder::PSXVideoTrack::decodeNextFrame() {
+ return _surface;
+}
+
+void PSXStreamDecoder::PSXVideoTrack::decodeFrame(Common::SeekableReadStream *frame, uint sectorCount) {
// A frame is essentially an MPEG-1 intra frame
Common::BitStream16LEMSB bits(frame);
@@ -493,10 +483,21 @@ void PSXStreamDecoder::decodeFrame(Common::SeekableReadStream *frame) {
decodeMacroBlock(&bits, mbX, mbY, scale, version);
// Output data onto the frame
- Graphics::convertYUV420ToRGB(_surface, _yBuffer, _cbBuffer, _crBuffer, _surface->w, _surface->h, _macroBlocksW * 16, _macroBlocksW * 8);
+ YUVToRGBMan.convert420(_surface, Graphics::YUVToRGBManager::kScaleFull, _yBuffer, _cbBuffer, _crBuffer, _surface->w, _surface->h, _macroBlocksW * 16, _macroBlocksW * 8);
+
+ _curFrame++;
+
+ // Increase the time by the amount of sectors we read
+ // One may notice that this is still not the most precise
+ // method since a frame takes up the time its sectors took
+ // up instead of the amount of time it takes the next frame
+ // to be read from the sectors. The actual frame rate should
+ // be constant instead of variable, so the slight difference
+ // in a frame's showing time is negligible (1/150 of a second).
+ _nextFrameStartTime = _nextFrameStartTime.addFrames(sectorCount);
}
-void PSXStreamDecoder::decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version) {
+void PSXStreamDecoder::PSXVideoTrack::decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version) {
int pitchY = _macroBlocksW * 16;
int pitchC = _macroBlocksW * 8;
@@ -533,7 +534,7 @@ static const byte s_quantizationTable[8 * 8] = {
27, 29, 35, 38, 46, 56, 69, 83
};
-void PSXStreamDecoder::dequantizeBlock(int *coefficients, float *block, uint16 scale) {
+void PSXStreamDecoder::PSXVideoTrack::dequantizeBlock(int *coefficients, float *block, uint16 scale) {
// Dequantize the data, un-zig-zagging as we go along
for (int i = 0; i < 8 * 8; i++) {
if (i == 0) // Special case for the DC coefficient
@@ -543,7 +544,7 @@ void PSXStreamDecoder::dequantizeBlock(int *coefficients, float *block, uint16 s
}
}
-int PSXStreamDecoder::readDC(Common::BitStream *bits, uint16 version, PlaneType plane) {
+int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream *bits, uint16 version, PlaneType plane) {
// Version 2 just has its coefficient as 10-bits
if (version == 2)
return readSignedCoefficient(bits);
@@ -573,7 +574,7 @@ int PSXStreamDecoder::readDC(Common::BitStream *bits, uint16 version, PlaneType
if (count > 63) \
error("PSXStreamDecoder::readAC(): Too many coefficients")
-void PSXStreamDecoder::readAC(Common::BitStream *bits, int *block) {
+void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream *bits, int *block) {
// Clear the block first
for (int i = 0; i < 63; i++)
block[i] = 0;
@@ -608,7 +609,7 @@ void PSXStreamDecoder::readAC(Common::BitStream *bits, int *block) {
}
}
-int PSXStreamDecoder::readSignedCoefficient(Common::BitStream *bits) {
+int PSXStreamDecoder::PSXVideoTrack::readSignedCoefficient(Common::BitStream *bits) {
uint val = bits->getBits(10);
// extend the sign
@@ -630,7 +631,7 @@ static const double s_idct8x8[8][8] = {
{ 0.353553390593274, -0.490392640201615, 0.461939766255643, -0.415734806151273, 0.353553390593273, -0.277785116509801, 0.191341716182545, -0.097545161008064 }
};
-void PSXStreamDecoder::idct(float *dequantData, float *result) {
+void PSXStreamDecoder::PSXVideoTrack::idct(float *dequantData, float *result) {
// IDCT code based on JPEG's IDCT code
// TODO: Switch to the integer-based one mentioned in the docs
// This is by far the costliest operation here
@@ -669,7 +670,7 @@ void PSXStreamDecoder::idct(float *dequantData, float *result) {
}
}
-void PSXStreamDecoder::decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) {
+void PSXStreamDecoder::PSXVideoTrack::decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) {
// Version 2 just has signed 10 bits for DC
// Version 3 has them huffman coded
int coefficients[8 * 8];
@@ -686,12 +687,13 @@ void PSXStreamDecoder::decodeBlock(Common::BitStream *bits, byte *block, int pit
// Now output the data
for (int y = 0; y < 8; y++) {
- byte *start = block + pitch * y;
+ byte *dst = block + pitch * y;
// Convert the result to be in the range [0, 255]
for (int x = 0; x < 8; x++)
- *start++ = (int)CLIP<float>(idctData[y * 8 + x], -128.0f, 127.0f) + 128;
+ *dst++ = (int)CLIP<float>(idctData[y * 8 + x], -128.0f, 127.0f) + 128;
}
}
+
} // End of namespace Video
diff --git a/video/psx_decoder.h b/video/psx_decoder.h
index c8ad92c45a..d1d5204e37 100644
--- a/video/psx_decoder.h
+++ b/video/psx_decoder.h
@@ -71,54 +71,85 @@ public:
bool loadStream(Common::SeekableReadStream *stream);
void close();
- bool isVideoLoaded() const { return _stream != 0; }
- uint16 getWidth() const { return _surface->w; }
- uint16 getHeight() const { return _surface->h; }
- uint32 getFrameCount() const { return _frameCount; }
- uint32 getElapsedTime() const;
- uint32 getTimeToNextFrame() const;
- const Graphics::Surface *decodeNextFrame();
- Graphics::PixelFormat getPixelFormat() const { return _surface->format; }
- bool endOfVideo() const { return _stream->pos() >= _stream->size(); }
+protected:
+ void readNextPacket();
+ bool useAudioSync() const;
private:
- void initCommon();
- Common::SeekableReadStream *_stream;
- Graphics::Surface *_surface;
+ class PSXVideoTrack : public VideoTrack {
+ public:
+ PSXVideoTrack(Common::SeekableReadStream *firstSector, CDSpeed speed, int frameCount);
+ ~PSXVideoTrack();
+
+ uint16 getWidth() const { return _surface->w; }
+ uint16 getHeight() const { return _surface->h; }
+ Graphics::PixelFormat getPixelFormat() const { return _surface->format; }
+ bool endOfTrack() const { return _endOfTrack; }
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ uint32 getNextFrameStartTime() const;
+ const Graphics::Surface *decodeNextFrame();
+
+ void setEndOfTrack() { _endOfTrack = true; }
+ void decodeFrame(Common::SeekableReadStream *frame, uint sectorCount);
+
+ private:
+ Graphics::Surface *_surface;
+ uint32 _frameCount;
+ Audio::Timestamp _nextFrameStartTime;
+ bool _endOfTrack;
+ int _curFrame;
+
+ enum PlaneType {
+ kPlaneY = 0,
+ kPlaneU = 1,
+ kPlaneV = 2
+ };
+
+ uint16 _macroBlocksW, _macroBlocksH;
+ byte *_yBuffer, *_cbBuffer, *_crBuffer;
+ void decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version);
+ void decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane);
+
+ void readAC(Common::BitStream *bits, int *block);
+ Common::Huffman *_acHuffman;
+
+ int readDC(Common::BitStream *bits, uint16 version, PlaneType plane);
+ Common::Huffman *_dcHuffmanLuma, *_dcHuffmanChroma;
+ int _lastDC[3];
+
+ void dequantizeBlock(int *coefficients, float *block, uint16 scale);
+ void idct(float *dequantData, float *result);
+ int readSignedCoefficient(Common::BitStream *bits);
+ };
- uint32 _frameCount;
- Audio::Timestamp _nextFrameStartTime;
+ class PSXAudioTrack : public AudioTrack {
+ public:
+ PSXAudioTrack(Common::SeekableReadStream *sector);
+ ~PSXAudioTrack();
- Audio::SoundHandle _audHandle;
- Audio::QueuingAudioStream *_audStream;
- void queueAudioFromSector(Common::SeekableReadStream *sector);
+ bool endOfTrack() const;
- enum PlaneType {
- kPlaneY = 0,
- kPlaneU = 1,
- kPlaneV = 2
- };
+ void setEndOfTrack() { _endOfTrack = true; }
+ void queueAudioFromSector(Common::SeekableReadStream *sector);
- uint16 _macroBlocksW, _macroBlocksH;
- byte *_yBuffer, *_cbBuffer, *_crBuffer;
- void decodeFrame(Common::SeekableReadStream *frame);
- void decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version);
- void decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane);
+ private:
+ Audio::AudioStream *getAudioStream() const;
- void readAC(Common::BitStream *bits, int *block);
- Common::Huffman *_acHuffman;
+ Audio::QueuingAudioStream *_audStream;
- int readDC(Common::BitStream *bits, uint16 version, PlaneType plane);
- Common::Huffman *_dcHuffmanLuma, *_dcHuffmanChroma;
- int _lastDC[3];
+ struct ADPCMStatus {
+ int16 sample[2];
+ } _adpcmStatus[2];
- void dequantizeBlock(int *coefficients, float *block, uint16 scale);
- void idct(float *dequantData, float *result);
- int readSignedCoefficient(Common::BitStream *bits);
+ bool _endOfTrack;
+ };
- struct ADPCMStatus {
- int16 sample[2];
- } _adpcmStatus[2];
+ CDSpeed _speed;
+ uint32 _frameCount;
+ Common::SeekableReadStream *_stream;
+ PSXVideoTrack *_videoTrack;
+ PSXAudioTrack *_audioTrack;
Common::SeekableReadStream *readSector();
};
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 959e3c4fc7..b4dab9ddfb 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -33,21 +33,19 @@
#include "audio/audiostream.h"
#include "common/debug.h"
-#include "common/endian.h"
#include "common/memstream.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "common/util.h"
// Video codecs
-#include "video/codecs/codec.h"
#include "video/codecs/cinepak.h"
#include "video/codecs/mjpeg.h"
#include "video/codecs/qtrle.h"
#include "video/codecs/rpza.h"
#include "video/codecs/smc.h"
#include "video/codecs/cdtoons.h"
-
+#include "video/codecs/svq1.h"
namespace Video {
@@ -56,164 +54,14 @@ namespace Video {
////////////////////////////////////////////
QuickTimeDecoder::QuickTimeDecoder() {
- _setStartTime = false;
- _audHandle = Audio::SoundHandle();
_scaledSurface = 0;
- _dirtyPalette = false;
- _palette = 0;
_width = _height = 0;
- _needUpdate = false;
}
QuickTimeDecoder::~QuickTimeDecoder() {
close();
}
-int32 QuickTimeDecoder::getCurFrame() const {
- // TODO: This is rather simplistic and doesn't take edits that
- // repeat sections of the media into account. Doing that
- // over-complicates things and shouldn't be necessary, but
- // it would be nice to have in the future.
-
- int32 frame = -1;
-
- for (uint32 i = 0; i < _handlers.size(); i++)
- if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo)
- frame += ((VideoTrackHandler *)_handlers[i])->getCurFrame() + 1;
-
- return frame;
-}
-
-uint32 QuickTimeDecoder::getFrameCount() const {
- uint32 count = 0;
-
- for (uint32 i = 0; i < _handlers.size(); i++)
- if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo)
- count += ((VideoTrackHandler *)_handlers[i])->getFrameCount();
-
- return count;
-}
-
-void QuickTimeDecoder::startAudio() {
- if (_audStream) {
- updateAudioBuffer();
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
- } // else no audio or the audio compression is not supported
-}
-
-void QuickTimeDecoder::stopAudio() {
- if (_audStream)
- g_system->getMixer()->stopHandle(_audHandle);
-}
-
-void QuickTimeDecoder::pauseVideoIntern(bool pause) {
- if (_audStream)
- g_system->getMixer()->pauseHandle(_audHandle, pause);
-}
-
-QuickTimeDecoder::VideoTrackHandler *QuickTimeDecoder::findNextVideoTrack() const {
- VideoTrackHandler *bestTrack = 0;
- uint32 bestTime = 0xffffffff;
-
- for (uint32 i = 0; i < _handlers.size(); i++) {
- if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo && !_handlers[i]->endOfTrack()) {
- VideoTrackHandler *track = (VideoTrackHandler *)_handlers[i];
- uint32 time = track->getNextFrameStartTime();
-
- if (time < bestTime) {
- bestTime = time;
- bestTrack = track;
- }
- }
- }
-
- return bestTrack;
-}
-
-const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() {
- if (!_nextVideoTrack)
- return 0;
-
- const Graphics::Surface *frame = _nextVideoTrack->decodeNextFrame();
-
- if (!_setStartTime) {
- _startTime = g_system->getMillis();
- _setStartTime = true;
- }
-
- _nextVideoTrack = findNextVideoTrack();
- _needUpdate = false;
-
- // Update audio buffers too
- // (needs to be done after we find the next track)
- for (uint32 i = 0; i < _handlers.size(); i++)
- if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeAudio)
- ((AudioTrackHandler *)_handlers[i])->updateBuffer();
-
- if (_scaledSurface) {
- scaleSurface(frame, _scaledSurface, _scaleFactorX, _scaleFactorY);
- return _scaledSurface;
- }
-
- return frame;
-}
-
-void QuickTimeDecoder::scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst, Common::Rational scaleFactorX, Common::Rational scaleFactorY) {
- assert(src && dst);
-
- for (int32 j = 0; j < dst->h; j++)
- for (int32 k = 0; k < dst->w; k++)
- memcpy(dst->getBasePtr(k, j), src->getBasePtr((k * scaleFactorX).toInt() , (j * scaleFactorY).toInt()), src->format.bytesPerPixel);
-}
-
-bool QuickTimeDecoder::endOfVideo() const {
- if (!isVideoLoaded())
- return true;
-
- for (uint32 i = 0; i < _handlers.size(); i++)
- if (!_handlers[i]->endOfTrack())
- return false;
-
- return true;
-}
-
-uint32 QuickTimeDecoder::getElapsedTime() const {
- // TODO: Convert to multi-track
- if (_audStream) {
- // Use the audio time if present and the audio track's time is less than the
- // total length of the audio track. The audio track can end before the video
- // track, so we need to fall back on the getMillis() time tracking in that
- // case.
- uint32 time = g_system->getMixer()->getSoundElapsedTime(_audHandle) + _audioStartOffset.msecs();
- if (time < _tracks[_audioTrackIndex]->mediaDuration * 1000 / _tracks[_audioTrackIndex]->timeScale)
- return time;
- }
-
- // Just use time elapsed since the beginning
- return SeekableVideoDecoder::getElapsedTime();
-}
-
-uint32 QuickTimeDecoder::getTimeToNextFrame() const {
- if (_needUpdate)
- return 0;
-
- if (_nextVideoTrack) {
- uint32 nextFrameStartTime = _nextVideoTrack->getNextFrameStartTime();
-
- if (nextFrameStartTime == 0)
- return 0;
-
- // TODO: Add support for rate modification
-
- uint32 elapsedTime = getElapsedTime();
-
- if (elapsedTime < nextFrameStartTime)
- return nextFrameStartTime - elapsedTime;
- }
-
- return 0;
-}
-
bool QuickTimeDecoder::loadFile(const Common::String &filename) {
if (!Common::QuickTimeParser::parseFile(filename))
return false;
@@ -230,56 +78,39 @@ bool QuickTimeDecoder::loadStream(Common::SeekableReadStream *stream) {
return true;
}
-void QuickTimeDecoder::init() {
- Audio::QuickTimeAudioDecoder::init();
-
- _startTime = 0;
- _setStartTime = false;
-
- // Start the audio codec if we've got one that we can handle
- if (_audStream) {
- startAudio();
- _audioStartOffset = Audio::Timestamp(0);
+void QuickTimeDecoder::close() {
+ VideoDecoder::close();
+ Common::QuickTimeParser::close();
- // TODO: Support multiple audio tracks
- // For now, just push back a handler for the first audio track
- _handlers.push_back(new AudioTrackHandler(this, _tracks[_audioTrackIndex]));
+ if (_scaledSurface) {
+ _scaledSurface->free();
+ delete _scaledSurface;
+ _scaledSurface = 0;
}
+}
- // Initialize all the video tracks
- for (uint32 i = 0; i < _tracks.size(); i++) {
- if (_tracks[i]->codecType == CODEC_TYPE_VIDEO) {
- for (uint32 j = 0; j < _tracks[i]->sampleDescs.size(); j++)
- ((VideoSampleDesc *)_tracks[i]->sampleDescs[j])->initCodec();
-
- _handlers.push_back(new VideoTrackHandler(this, _tracks[i]));
- }
- }
+const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() {
+ const Graphics::Surface *frame = VideoDecoder::decodeNextFrame();
- // Prepare the first video track
- _nextVideoTrack = findNextVideoTrack();
+ // Update audio buffers too
+ // (needs to be done after we find the next track)
+ updateAudioBuffer();
- if (_nextVideoTrack) {
- // Initialize the scaled surface
- if (_scaleFactorX != 1 || _scaleFactorY != 1) {
- // We have to initialize the scaled surface
+ // We have to initialize the scaled surface
+ if (frame && (_scaleFactorX != 1 || _scaleFactorY != 1)) {
+ if (!_scaledSurface) {
_scaledSurface = new Graphics::Surface();
- _scaledSurface->create((_nextVideoTrack->getWidth() / _scaleFactorX).toInt(),
- (_nextVideoTrack->getHeight() / _scaleFactorY).toInt(), getPixelFormat());
- _width = _scaledSurface->w;
- _height = _scaledSurface->h;
- } else {
- _width = _nextVideoTrack->getWidth().toInt();
- _height = _nextVideoTrack->getHeight().toInt();
+ _scaledSurface->create(_width, _height, getPixelFormat());
}
- _needUpdate = true;
- } else {
- _needUpdate = false;
+ scaleSurface(frame, _scaledSurface, _scaleFactorX, _scaleFactorY);
+ return _scaledSurface;
}
+
+ return frame;
}
-Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Track *track, uint32 format) {
+Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Common::QuickTimeParser::Track *track, uint32 format) {
if (track->codecType == CODEC_TYPE_VIDEO) {
debug(0, "Video Codec FourCC: \'%s\'", tag2str(format));
@@ -377,56 +208,52 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Track *tra
return Audio::QuickTimeAudioDecoder::readSampleDesc(track, format);
}
-void QuickTimeDecoder::close() {
- stopAudio();
- freeAllTrackHandlers();
-
- if (_scaledSurface) {
- _scaledSurface->free();
- delete _scaledSurface;
- _scaledSurface = 0;
- }
-
- _width = _height = 0;
-
- Common::QuickTimeParser::close();
- SeekableVideoDecoder::reset();
-}
+void QuickTimeDecoder::init() {
+ Audio::QuickTimeAudioDecoder::init();
-void QuickTimeDecoder::freeAllTrackHandlers() {
- for (uint32 i = 0; i < _handlers.size(); i++)
- delete _handlers[i];
+ // Initialize all the audio tracks
+ for (uint32 i = 0; i < _audioTracks.size(); i++)
+ addTrack(new AudioTrackHandler(this, _audioTracks[i]));
- _handlers.clear();
-}
+ // Initialize all the video tracks
+ const Common::Array<Common::QuickTimeParser::Track *> &tracks = Common::QuickTimeParser::_tracks;
+ for (uint32 i = 0; i < tracks.size(); i++) {
+ if (tracks[i]->codecType == CODEC_TYPE_VIDEO) {
+ for (uint32 j = 0; j < tracks[i]->sampleDescs.size(); j++)
+ ((VideoSampleDesc *)tracks[i]->sampleDescs[j])->initCodec();
-void QuickTimeDecoder::seekToTime(Audio::Timestamp time) {
- // Sets all tracks to this time
- for (uint32 i = 0; i < _handlers.size(); i++)
- _handlers[i]->seekToTime(time);
+ addTrack(new VideoTrackHandler(this, tracks[i]));
+ }
+ }
- // Reset our start time
- _startTime = g_system->getMillis() - time.msecs();
- _setStartTime = true;
- resetPauseStartTime();
+ // Prepare the first video track
+ VideoTrackHandler *nextVideoTrack = (VideoTrackHandler *)findNextVideoTrack();
- // Reset the next video track too
- _nextVideoTrack = findNextVideoTrack();
- _needUpdate = _nextVideoTrack != 0;
+ if (nextVideoTrack) {
+ if (_scaleFactorX != 1 || _scaleFactorY != 1) {
+ // We have to take the scale into consideration when setting width/height
+ _width = (nextVideoTrack->getScaledWidth() / _scaleFactorX).toInt();
+ _height = (nextVideoTrack->getScaledHeight() / _scaleFactorY).toInt();
+ } else {
+ _width = nextVideoTrack->getWidth();
+ _height = nextVideoTrack->getHeight();
+ }
+ }
}
void QuickTimeDecoder::updateAudioBuffer() {
// Updates the audio buffers for all audio tracks
- for (uint32 i = 0; i < _handlers.size(); i++)
- if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeAudio)
- ((AudioTrackHandler *)_handlers[i])->updateBuffer();
+ for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++)
+ if ((*it)->getTrackType() == VideoDecoder::Track::kTrackTypeAudio)
+ ((AudioTrackHandler *)*it)->updateBuffer();
}
-Graphics::PixelFormat QuickTimeDecoder::getPixelFormat() const {
- if (_nextVideoTrack)
- return _nextVideoTrack->getPixelFormat();
+void QuickTimeDecoder::scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst, const Common::Rational &scaleFactorX, const Common::Rational &scaleFactorY) {
+ assert(src && dst);
- return Graphics::PixelFormat();
+ for (int32 j = 0; j < dst->h; j++)
+ for (int32 k = 0; k < dst->w; k++)
+ memcpy(dst->getBasePtr(k, j), src->getBasePtr((k * scaleFactorX).toInt() , (j * scaleFactorY).toInt()), src->format.bytesPerPixel);
}
QuickTimeDecoder::VideoSampleDesc::VideoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag) : Common::QuickTimeParser::SampleDesc(parentTrack, codecTag) {
@@ -462,7 +289,7 @@ void QuickTimeDecoder::VideoSampleDesc::initCodec() {
break;
case MKTAG('S','V','Q','1'):
// Sorenson Video 1: Used by some Myst ME videos.
- warning("Sorenson Video 1 not yet supported");
+ _videoCodec = new SVQ1Decoder(_parentTrack->width, _parentTrack->height);
break;
case MKTAG('S','V','Q','3'):
// Sorenson Video 3: Used by some Myst ME videos.
@@ -481,104 +308,120 @@ void QuickTimeDecoder::VideoSampleDesc::initCodec() {
}
}
-bool QuickTimeDecoder::endOfVideoTracks() const {
- for (uint32 i = 0; i < _handlers.size(); i++)
- if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo && !_handlers[i]->endOfTrack())
- return false;
+QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack)
+ : _decoder(decoder), _audioTrack(audioTrack) {
+}
- return true;
+void QuickTimeDecoder::AudioTrackHandler::updateBuffer() {
+ if (_decoder->endOfVideoTracks()) // If we have no video left (or no video), there's nothing to base our buffer against
+ _audioTrack->queueRemainingAudio();
+ else // Otherwise, queue enough to get us to the next frame plus another half second spare
+ _audioTrack->queueAudio(Audio::Timestamp(_decoder->getTimeToNextFrame() + 500, 1000));
+}
+
+Audio::SeekableAudioStream *QuickTimeDecoder::AudioTrackHandler::getSeekableAudioStream() const {
+ return _audioTrack;
}
-QuickTimeDecoder::TrackHandler::TrackHandler(QuickTimeDecoder *decoder, Track *parent) : _decoder(decoder), _parent(parent), _fd(_decoder->_fd) {
+QuickTimeDecoder::VideoTrackHandler::VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : _decoder(decoder), _parent(parent) {
_curEdit = 0;
+ enterNewEditList(false);
+
+ _holdNextFrameStartTime = false;
+ _curFrame = -1;
+ _durationOverride = -1;
+ _scaledSurface = 0;
+ _curPalette = 0;
+ _dirtyPalette = false;
}
-bool QuickTimeDecoder::TrackHandler::endOfTrack() {
- // A track is over when we've finished going through all edits
- return _curEdit == _parent->editCount;
+QuickTimeDecoder::VideoTrackHandler::~VideoTrackHandler() {
+ if (_scaledSurface) {
+ _scaledSurface->free();
+ delete _scaledSurface;
+ }
}
-QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder *decoder, Track *parent) : TrackHandler(decoder, parent) {
+bool QuickTimeDecoder::VideoTrackHandler::endOfTrack() const {
+ // A track is over when we've finished going through all edits
+ return _curEdit == _parent->editCount;
}
-void QuickTimeDecoder::AudioTrackHandler::updateBuffer() {
- if (!_decoder->_audStream)
- return;
+bool QuickTimeDecoder::VideoTrackHandler::seek(const Audio::Timestamp &requestedTime) {
+ // First, figure out what edit we're in
+ Audio::Timestamp time = requestedTime.convertToFramerate(_parent->timeScale);
- uint32 numberOfChunksNeeded = 0;
+ // Continue until we get to where we need to be
+ for (_curEdit = 0; !endOfTrack(); _curEdit++)
+ if ((uint32)time.totalNumberOfFrames() >= getCurEditTimeOffset() && (uint32)time.totalNumberOfFrames() < getCurEditTimeOffset() + getCurEditTrackDuration())
+ break;
- if (_decoder->endOfVideoTracks()) {
- // If we have no video left (or no video), there's nothing to base our buffer against
- numberOfChunksNeeded = _parent->chunkCount;
- } else {
- Audio::QuickTimeAudioDecoder::AudioSampleDesc *entry = (Audio::QuickTimeAudioDecoder::AudioSampleDesc *)_parent->sampleDescs[0];
+ // This track is done
+ if (endOfTrack())
+ return true;
- // Calculate the amount of chunks we need in memory until the next frame
- uint32 timeToNextFrame = _decoder->getTimeToNextFrame();
- uint32 timeFilled = 0;
- uint32 curAudioChunk = _decoder->_curAudioChunk - _decoder->_audStream->numQueuedStreams();
+ enterNewEditList(false);
- for (; timeFilled < timeToNextFrame && curAudioChunk < _parent->chunkCount; numberOfChunksNeeded++, curAudioChunk++) {
- uint32 sampleCount = entry->getAudioChunkSampleCount(curAudioChunk);
- assert(sampleCount);
+ // One extra check for the end of a track
+ if (endOfTrack())
+ return true;
- timeFilled += sampleCount * 1000 / entry->_sampleRate;
+ // Now we're in the edit and need to figure out what frame we need
+ while (getRateAdjustedFrameTime() < (uint32)time.totalNumberOfFrames()) {
+ _curFrame++;
+ if (_durationOverride >= 0) {
+ _nextFrameStartTime += _durationOverride;
+ _durationOverride = -1;
+ } else {
+ _nextFrameStartTime += getFrameDuration();
}
-
- // Add a couple extra to ensure we don't underrun
- numberOfChunksNeeded += 3;
}
- // Keep three streams in buffer so that if/when the first two end, it goes right into the next
- while (_decoder->_audStream->numQueuedStreams() < numberOfChunksNeeded && _decoder->_curAudioChunk < _parent->chunkCount)
- _decoder->queueNextAudioChunk();
-}
-
-bool QuickTimeDecoder::AudioTrackHandler::endOfTrack() {
- // TODO: Handle edits
- return (_decoder->_curAudioChunk == _parent->chunkCount) && _decoder->_audStream->endOfData();
-}
+ // All that's left is to figure out what our starting time is going to be
+ // Compare the starting point for the frame to where we need to be
+ _holdNextFrameStartTime = getRateAdjustedFrameTime() != (uint32)time.totalNumberOfFrames();
-void QuickTimeDecoder::AudioTrackHandler::seekToTime(Audio::Timestamp time) {
- if (_decoder->_audStream) {
- // Stop all audio
- _decoder->stopAudio();
+ // If we went past the time, go back a frame
+ if (_holdNextFrameStartTime)
+ _curFrame--;
- _decoder->_audioStartOffset = time;
+ // Handle the keyframe here
+ int32 destinationFrame = _curFrame + 1;
- // Seek to the new audio location
- _decoder->setAudioStreamPos(_decoder->_audioStartOffset);
+ assert(destinationFrame < (int32)_parent->frameCount);
+ _curFrame = findKeyFrame(destinationFrame) - 1;
+ while (_curFrame < destinationFrame - 1)
+ bufferNextFrame();
- // Restart the audio
- _decoder->startAudio();
+ return true;
+}
- // Pause the audio again if we're still paused
- if (_decoder->isPaused() && _decoder->_audStream)
- g_system->getMixer()->pauseHandle(_decoder->_audHandle, true);
- }
+Audio::Timestamp QuickTimeDecoder::VideoTrackHandler::getDuration() const {
+ return Audio::Timestamp(0, _parent->duration, _decoder->_timeScale);
}
-QuickTimeDecoder::VideoTrackHandler::VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : TrackHandler(decoder, parent) {
- if (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1) {
- _scaledSurface = new Graphics::Surface();
- _scaledSurface->create(getWidth().toInt(), getHeight().toInt(), getPixelFormat());
- } else {
- _scaledSurface = 0;
- }
+uint16 QuickTimeDecoder::VideoTrackHandler::getWidth() const {
+ return getScaledWidth().toInt();
+}
- enterNewEditList(false);
+uint16 QuickTimeDecoder::VideoTrackHandler::getHeight() const {
+ return getScaledHeight().toInt();
+}
- _holdNextFrameStartTime = false;
- _curFrame = -1;
- _durationOverride = -1;
+Graphics::PixelFormat QuickTimeDecoder::VideoTrackHandler::getPixelFormat() const {
+ return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->getPixelFormat();
+}
+int QuickTimeDecoder::VideoTrackHandler::getFrameCount() const {
+ return _parent->frameCount;
}
-QuickTimeDecoder::VideoTrackHandler::~VideoTrackHandler() {
- if (_scaledSurface) {
- _scaledSurface->free();
- delete _scaledSurface;
- }
+uint32 QuickTimeDecoder::VideoTrackHandler::getNextFrameStartTime() const {
+ if (endOfTrack())
+ return 0;
+
+ // Convert to milliseconds so the tracks can be compared
+ return getRateAdjustedFrameTime() * 1000 / _parent->timeScale;
}
const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame() {
@@ -608,7 +451,12 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame()
enterNewEditList(true);
}
- if (_scaledSurface) {
+ if (frame && (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1)) {
+ if (!_scaledSurface) {
+ _scaledSurface = new Graphics::Surface();
+ _scaledSurface->create(getScaledWidth().toInt(), getScaledHeight().toInt(), getPixelFormat());
+ }
+
_decoder->scaleSurface(frame, _scaledSurface, _parent->scaleFactorX, _parent->scaleFactorY);
return _scaledSurface;
}
@@ -616,6 +464,85 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame()
return frame;
}
+Common::Rational QuickTimeDecoder::VideoTrackHandler::getScaledWidth() const {
+ return Common::Rational(_parent->width) / _parent->scaleFactorX;
+}
+
+Common::Rational QuickTimeDecoder::VideoTrackHandler::getScaledHeight() const {
+ return Common::Rational(_parent->height) / _parent->scaleFactorY;
+}
+
+Common::SeekableReadStream *QuickTimeDecoder::VideoTrackHandler::getNextFramePacket(uint32 &descId) {
+ // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for.
+ int32 totalSampleCount = 0;
+ int32 sampleInChunk = 0;
+ int32 actualChunk = -1;
+ uint32 sampleToChunkIndex = 0;
+
+ for (uint32 i = 0; i < _parent->chunkCount; i++) {
+ if (sampleToChunkIndex < _parent->sampleToChunkCount && i >= _parent->sampleToChunk[sampleToChunkIndex].first)
+ sampleToChunkIndex++;
+
+ totalSampleCount += _parent->sampleToChunk[sampleToChunkIndex - 1].count;
+
+ if (totalSampleCount > _curFrame) {
+ actualChunk = i;
+ descId = _parent->sampleToChunk[sampleToChunkIndex - 1].id;
+ sampleInChunk = _parent->sampleToChunk[sampleToChunkIndex - 1].count - totalSampleCount + _curFrame;
+ break;
+ }
+ }
+
+ if (actualChunk < 0) {
+ warning("Could not find data for frame %d", _curFrame);
+ return 0;
+ }
+
+ // Next seek to that frame
+ Common::SeekableReadStream *stream = _decoder->_fd;
+ stream->seek(_parent->chunkOffsets[actualChunk]);
+
+ // Then, if the chunk holds more than one frame, seek to where the frame we want is located
+ for (int32 i = _curFrame - sampleInChunk; i < _curFrame; i++) {
+ if (_parent->sampleSize != 0)
+ stream->skip(_parent->sampleSize);
+ else
+ stream->skip(_parent->sampleSizes[i]);
+ }
+
+ // Finally, read in the raw data for the frame
+ //debug("Frame Data[%d]: Offset = %d, Size = %d", _curFrame, stream->pos(), _parent->sampleSizes[_curFrame]);
+
+ if (_parent->sampleSize != 0)
+ return stream->readStream(_parent->sampleSize);
+
+ return stream->readStream(_parent->sampleSizes[_curFrame]);
+}
+
+uint32 QuickTimeDecoder::VideoTrackHandler::getFrameDuration() {
+ uint32 curFrameIndex = 0;
+ for (int32 i = 0; i < _parent->timeToSampleCount; i++) {
+ curFrameIndex += _parent->timeToSample[i].count;
+ if ((uint32)_curFrame < curFrameIndex) {
+ // Ok, now we have what duration this frame has.
+ return _parent->timeToSample[i].duration;
+ }
+ }
+
+ // This should never occur
+ error("Cannot find duration for frame %d", _curFrame);
+ return 0;
+}
+
+uint32 QuickTimeDecoder::VideoTrackHandler::findKeyFrame(uint32 frame) const {
+ for (int i = _parent->keyframeCount - 1; i >= 0; i--)
+ if (_parent->keyframes[i] <= frame)
+ return _parent->keyframes[i];
+
+ // If none found, we'll assume the requested frame is a key frame
+ return frame;
+}
+
void QuickTimeDecoder::VideoTrackHandler::enterNewEditList(bool bufferFrames) {
// Bypass all empty edit lists first
while (!endOfTrack() && _parent->editList[_curEdit].mediaTime == -1)
@@ -687,166 +614,25 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::bufferNextFrame()
if (entry->_videoCodec->containsPalette()) {
// The codec itself contains a palette
if (entry->_videoCodec->hasDirtyPalette()) {
- _decoder->_palette = entry->_videoCodec->getPalette();
- _decoder->_dirtyPalette = true;
+ _curPalette = entry->_videoCodec->getPalette();
+ _dirtyPalette = true;
}
} else {
// Check if the video description has been updated
byte *palette = entry->_palette;
- if (palette !=_decoder-> _palette) {
- _decoder->_palette = palette;
- _decoder->_dirtyPalette = true;
+ if (palette != _curPalette) {
+ _curPalette = palette;
+ _dirtyPalette = true;
}
}
return frame;
}
-uint32 QuickTimeDecoder::VideoTrackHandler::getNextFrameStartTime() {
- if (endOfTrack())
- return 0;
-
- // Convert to milliseconds so the tracks can be compared
- return getRateAdjustedFrameTime() * 1000 / _parent->timeScale;
-}
-
-uint32 QuickTimeDecoder::VideoTrackHandler::getFrameCount() {
- return _parent->frameCount;
-}
-
-uint32 QuickTimeDecoder::VideoTrackHandler::getFrameDuration() {
- uint32 curFrameIndex = 0;
- for (int32 i = 0; i < _parent->timeToSampleCount; i++) {
- curFrameIndex += _parent->timeToSample[i].count;
- if ((uint32)_curFrame < curFrameIndex) {
- // Ok, now we have what duration this frame has.
- return _parent->timeToSample[i].duration;
- }
- }
-
- // This should never occur
- error("Cannot find duration for frame %d", _curFrame);
- return 0;
-}
-
-Common::SeekableReadStream *QuickTimeDecoder::VideoTrackHandler::getNextFramePacket(uint32 &descId) {
- // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for.
- int32 totalSampleCount = 0;
- int32 sampleInChunk = 0;
- int32 actualChunk = -1;
- uint32 sampleToChunkIndex = 0;
-
- for (uint32 i = 0; i < _parent->chunkCount; i++) {
- if (sampleToChunkIndex < _parent->sampleToChunkCount && i >= _parent->sampleToChunk[sampleToChunkIndex].first)
- sampleToChunkIndex++;
-
- totalSampleCount += _parent->sampleToChunk[sampleToChunkIndex - 1].count;
-
- if (totalSampleCount > _curFrame) {
- actualChunk = i;
- descId = _parent->sampleToChunk[sampleToChunkIndex - 1].id;
- sampleInChunk = _parent->sampleToChunk[sampleToChunkIndex - 1].count - totalSampleCount + _curFrame;
- break;
- }
- }
-
- if (actualChunk < 0) {
- warning("Could not find data for frame %d", _curFrame);
- return 0;
- }
-
- // Next seek to that frame
- _fd->seek(_parent->chunkOffsets[actualChunk]);
-
- // Then, if the chunk holds more than one frame, seek to where the frame we want is located
- for (int32 i = _curFrame - sampleInChunk; i < _curFrame; i++) {
- if (_parent->sampleSize != 0)
- _fd->skip(_parent->sampleSize);
- else
- _fd->skip(_parent->sampleSizes[i]);
- }
-
- // Finally, read in the raw data for the frame
- //debug("Frame Data[%d]: Offset = %d, Size = %d", _curFrame, _fd->pos(), _parent->sampleSizes[_curFrame]);
-
- if (_parent->sampleSize != 0)
- return _fd->readStream(_parent->sampleSize);
-
- return _fd->readStream(_parent->sampleSizes[_curFrame]);
-}
-
-uint32 QuickTimeDecoder::VideoTrackHandler::findKeyFrame(uint32 frame) const {
- for (int i = _parent->keyframeCount - 1; i >= 0; i--)
- if (_parent->keyframes[i] <= frame)
- return _parent->keyframes[i];
-
- // If none found, we'll assume the requested frame is a key frame
- return frame;
-}
-
-void QuickTimeDecoder::VideoTrackHandler::seekToTime(Audio::Timestamp time) {
- // First, figure out what edit we're in
- time = time.convertToFramerate(_parent->timeScale);
-
- // Continue until we get to where we need to be
- for (_curEdit = 0; !endOfTrack(); _curEdit++)
- if ((uint32)time.totalNumberOfFrames() >= getCurEditTimeOffset() && (uint32)time.totalNumberOfFrames() < getCurEditTimeOffset() + getCurEditTrackDuration())
- break;
-
- // This track is done
- if (endOfTrack())
- return;
-
- enterNewEditList(false);
-
- // One extra check for the end of a track
- if (endOfTrack())
- return;
-
- // Now we're in the edit and need to figure out what frame we need
- while (getRateAdjustedFrameTime() < (uint32)time.totalNumberOfFrames()) {
- _curFrame++;
- if (_durationOverride >= 0) {
- _nextFrameStartTime += _durationOverride;
- _durationOverride = -1;
- } else {
- _nextFrameStartTime += getFrameDuration();
- }
- }
-
- // All that's left is to figure out what our starting time is going to be
- // Compare the starting point for the frame to where we need to be
- _holdNextFrameStartTime = getRateAdjustedFrameTime() != (uint32)time.totalNumberOfFrames();
-
- // If we went past the time, go back a frame
- if (_holdNextFrameStartTime)
- _curFrame--;
-
- // Handle the keyframe here
- int32 destinationFrame = _curFrame + 1;
-
- assert(destinationFrame < (int32)_parent->frameCount);
- _curFrame = findKeyFrame(destinationFrame) - 1;
- while (_curFrame < destinationFrame - 1)
- bufferNextFrame();
-}
-
-Common::Rational QuickTimeDecoder::VideoTrackHandler::getWidth() const {
- return Common::Rational(_parent->width) / _parent->scaleFactorX;
-}
-
-Common::Rational QuickTimeDecoder::VideoTrackHandler::getHeight() const {
- return Common::Rational(_parent->height) / _parent->scaleFactorY;
-}
-
-Graphics::PixelFormat QuickTimeDecoder::VideoTrackHandler::getPixelFormat() const {
- return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->getPixelFormat();
-}
-
uint32 QuickTimeDecoder::VideoTrackHandler::getRateAdjustedFrameTime() const {
// Figure out what time the next frame is at taking the edit list rate into account
- uint32 convertedTime = (Common::Rational(_nextFrameStartTime - getCurEditTimeOffset()) / _parent->editList[_curEdit].mediaRate).toInt();
+ uint32 convertedTime = (Common::Rational(_nextFrameStartTime - getCurEditTimeOffset()) / _parent->editList[_curEdit].mediaRate).toInt();
return convertedTime + getCurEditTimeOffset();
}
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index b2d7153f42..45ab155c2c 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -31,16 +31,17 @@
#ifndef VIDEO_QT_DECODER_H
#define VIDEO_QT_DECODER_H
-#include "audio/mixer.h"
#include "audio/decoders/quicktime_intern.h"
#include "common/scummsys.h"
-#include "common/rational.h"
-#include "graphics/pixelformat.h"
#include "video/video_decoder.h"
namespace Common {
- class Rational;
+class Rational;
+}
+
+namespace Graphics {
+struct PixelFormat;
}
namespace Video {
@@ -52,70 +53,36 @@ class Codec;
*
* Video decoder used in engines:
* - mohawk
+ * - pegasus
* - sci
*/
-class QuickTimeDecoder : public SeekableVideoDecoder, public Audio::QuickTimeAudioDecoder {
+class QuickTimeDecoder : public VideoDecoder, public Audio::QuickTimeAudioDecoder {
public:
QuickTimeDecoder();
virtual ~QuickTimeDecoder();
- /**
- * Returns the width of the video
- * @return the width of the video
- */
- uint16 getWidth() const { return _width; }
-
- /**
- * Returns the height of the video
- * @return the height of the video
- */
- uint16 getHeight() const { return _height; }
-
- /**
- * Returns the amount of frames in the video
- * @return the amount of frames in the video
- */
- uint32 getFrameCount() const;
-
- /**
- * Load a video file
- * @param filename the filename to load
- */
bool loadFile(const Common::String &filename);
-
- /**
- * Load a QuickTime video file from a SeekableReadStream
- * @param stream the stream to load
- */
bool loadStream(Common::SeekableReadStream *stream);
-
- /**
- * Close a QuickTime encoded video file
- */
void close();
+ uint16 getWidth() const { return _width; }
+ uint16 getHeight() const { return _height; }
+ const Graphics::Surface *decodeNextFrame();
+ Audio::Timestamp getDuration() const { return Audio::Timestamp(0, _duration, _timeScale); }
- /**
- * Returns the palette of the video
- * @return the palette of the video
- */
- const byte *getPalette() { _dirtyPalette = false; return _palette; }
- bool hasDirtyPalette() const { return _dirtyPalette; }
+protected:
+ Common::QuickTimeParser::SampleDesc *readSampleDesc(Common::QuickTimeParser::Track *track, uint32 format);
- int32 getCurFrame() const;
+private:
+ void init();
- bool isVideoLoaded() const { return isOpen(); }
- const Graphics::Surface *decodeNextFrame();
- bool endOfVideo() const;
- uint32 getElapsedTime() const;
- uint32 getTimeToNextFrame() const;
- Graphics::PixelFormat getPixelFormat() const;
+ void updateAudioBuffer();
- // SeekableVideoDecoder API
- void seekToFrame(uint32 frame);
- void seekToTime(Audio::Timestamp time);
- uint32 getDuration() const { return _duration * 1000 / _timeScale; }
+ uint16 _width, _height;
+
+ Graphics::Surface *_scaledSurface;
+ void scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst,
+ const Common::Rational &scaleFactorX, const Common::Rational &scaleFactorY);
-protected:
class VideoSampleDesc : public Common::QuickTimeParser::SampleDesc {
public:
VideoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag);
@@ -131,105 +98,59 @@ protected:
Codec *_videoCodec;
};
- Common::QuickTimeParser::SampleDesc *readSampleDesc(Track *track, uint32 format);
-
-private:
- void init();
-
- void startAudio();
- void stopAudio();
- void updateAudioBuffer();
- void readNextAudioChunk();
- Audio::SoundHandle _audHandle;
- Audio::Timestamp _audioStartOffset;
-
- Codec *createCodec(uint32 codecTag, byte bitsPerPixel);
- uint32 findKeyFrame(uint32 frame) const;
-
- bool _dirtyPalette;
- const byte *_palette;
- bool _setStartTime;
- bool _needUpdate;
-
- uint16 _width, _height;
-
- Graphics::Surface *_scaledSurface;
- void scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst,
- Common::Rational scaleFactorX, Common::Rational scaleFactorY);
-
- void pauseVideoIntern(bool pause);
- bool endOfVideoTracks() const;
-
- // The TrackHandler is a class that wraps around a QuickTime Track
- // and handles playback in this decoder class.
- class TrackHandler {
+ // The AudioTrackHandler is currently just a wrapper around some
+ // QuickTimeDecoder functions.
+ class AudioTrackHandler : public SeekableAudioTrack {
public:
- TrackHandler(QuickTimeDecoder *decoder, Track *parent);
- virtual ~TrackHandler() {}
-
- enum TrackType {
- kTrackTypeAudio,
- kTrackTypeVideo
- };
-
- virtual TrackType getTrackType() const = 0;
+ AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack);
- virtual void seekToTime(Audio::Timestamp time) = 0;
-
- virtual bool endOfTrack();
+ void updateBuffer();
protected:
- uint32 _curEdit;
- QuickTimeDecoder *_decoder;
- Common::SeekableReadStream *_fd;
- Track *_parent;
- };
-
- // The AudioTrackHandler is currently just a wrapper around some
- // QuickTimeDecoder functions. Eventually this can be made to
- // handle multiple audio tracks, but I haven't seen a video with
- // that yet.
- class AudioTrackHandler : public TrackHandler {
- public:
- AudioTrackHandler(QuickTimeDecoder *decoder, Track *parent);
- TrackType getTrackType() const { return kTrackTypeAudio; }
+ Audio::SeekableAudioStream *getSeekableAudioStream() const;
- void updateBuffer();
- void seekToTime(Audio::Timestamp time);
- bool endOfTrack();
+ private:
+ QuickTimeDecoder *_decoder;
+ QuickTimeAudioTrack *_audioTrack;
};
// The VideoTrackHandler is the bridge between the time of playback
// and the media for the given track. It calculates when to start
// tracks and at what rate to play the media using the edit list.
- class VideoTrackHandler : public TrackHandler {
+ class VideoTrackHandler : public VideoTrack {
public:
- VideoTrackHandler(QuickTimeDecoder *decoder, Track *parent);
+ VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent);
~VideoTrackHandler();
- TrackType getTrackType() const { return kTrackTypeVideo; }
-
- const Graphics::Surface *decodeNextFrame();
-
- uint32 getNextFrameStartTime();
-
- uint32 getFrameCount();
-
- int32 getCurFrame() { return _curFrame; }
+ bool endOfTrack() const;
+ bool isSeekable() const { return true; }
+ bool seek(const Audio::Timestamp &time);
+ Audio::Timestamp getDuration() const;
+ uint16 getWidth() const;
+ uint16 getHeight() const;
Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const;
+ uint32 getNextFrameStartTime() const;
+ const Graphics::Surface *decodeNextFrame();
+ const byte *getPalette() const { _dirtyPalette = false; return _curPalette; }
+ bool hasDirtyPalette() const { return _curPalette; }
- void seekToTime(Audio::Timestamp time);
-
- Common::Rational getWidth() const;
- Common::Rational getHeight() const;
+ Common::Rational getScaledWidth() const;
+ Common::Rational getScaledHeight() const;
private:
+ QuickTimeDecoder *_decoder;
+ Common::QuickTimeParser::Track *_parent;
+ uint32 _curEdit;
int32 _curFrame;
uint32 _nextFrameStartTime;
Graphics::Surface *_scaledSurface;
bool _holdNextFrameStartTime;
int32 _durationOverride;
+ const byte *_curPalette;
+ mutable bool _dirtyPalette;
Common::SeekableReadStream *getNextFramePacket(uint32 &descId);
uint32 getFrameDuration();
@@ -240,12 +161,6 @@ private:
uint32 getCurEditTimeOffset() const;
uint32 getCurEditTrackDuration() const;
};
-
- Common::Array<TrackHandler *> _handlers;
- VideoTrackHandler *_nextVideoTrack;
- VideoTrackHandler *findNextVideoTrack() const;
-
- void freeAllTrackHandlers();
};
} // End of namespace Video
diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp
index e0e771f04b..c49791100d 100644
--- a/video/smk_decoder.cpp
+++ b/video/smk_decoder.cpp
@@ -204,8 +204,7 @@ BigHuffmanTree::BigHuffmanTree(Common::BitStream &bs, int allocSize)
delete _hiBytes;
}
-BigHuffmanTree::~BigHuffmanTree()
-{
+BigHuffmanTree::~BigHuffmanTree() {
delete[] _tree;
}
@@ -278,24 +277,17 @@ uint32 BigHuffmanTree::getCode(Common::BitStream &bs) {
return v;
}
-SmackerDecoder::SmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType)
- : _audioStarted(false), _audioStream(0), _mixer(mixer), _soundType(soundType) {
- _surface = 0;
+SmackerDecoder::SmackerDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
_fileStream = 0;
- _dirtyPalette = false;
+ _firstFrameStart = 0;
+ _frameTypes = 0;
+ _frameSizes = 0;
}
SmackerDecoder::~SmackerDecoder() {
close();
}
-uint32 SmackerDecoder::getElapsedTime() const {
- if (_audioStream && _audioStarted)
- return _mixer->getSoundElapsedTime(_audioHandle);
-
- return FixedRateVideoDecoder::getElapsedTime();
-}
-
bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
close();
@@ -309,25 +301,29 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
uint32 width = _fileStream->readUint32LE();
uint32 height = _fileStream->readUint32LE();
- _frameCount = _fileStream->readUint32LE();
- int32 frameRate = _fileStream->readSint32LE();
-
- // framerate contains 2 digits after the comma, so 1497 is actually 14.97 fps
- if (frameRate > 0)
- _frameRate = Common::Rational(1000, frameRate);
- else if (frameRate < 0)
- _frameRate = Common::Rational(100000, -frameRate);
+ uint32 frameCount = _fileStream->readUint32LE();
+ int32 frameDelay = _fileStream->readSint32LE();
+
+ // frame rate contains 2 digits after the comma, so 1497 is actually 14.97 fps
+ Common::Rational frameRate;
+ if (frameDelay > 0)
+ frameRate = Common::Rational(1000, frameDelay);
+ else if (frameDelay < 0)
+ frameRate = Common::Rational(100000, -frameDelay);
else
- _frameRate = 1000;
+ frameRate = 1000;
// Flags are determined by which bit is set, which can be one of the following:
// 0 - set to 1 if file contains a ring frame.
// 1 - set to 1 if file is Y-interlaced
// 2 - set to 1 if file is Y-doubled
// If bits 1 or 2 are set, the frame should be scaled to twice its height
- // before it is displayed.
+ // before it is displayed.
_header.flags = _fileStream->readUint32LE();
+ SmackerVideoTrack *videoTrack = createVideoTrack(width, height, frameCount, frameRate, _header.flags, _header.signature);
+ addTrack(videoTrack);
+
// TODO: should we do any extra processing for Smacker files with ring frames?
// TODO: should we do any extra processing for Y-doubled videos? Are they the
@@ -374,92 +370,77 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
warning("Unhandled Smacker v2 audio compression");
if (i == 0)
- _audioStream = Audio::makeQueuingAudioStream(_header.audioInfo[0].sampleRate, _header.audioInfo[0].isStereo);
+ addTrack(new SmackerAudioTrack(_header.audioInfo[i], _soundType));
}
}
_header.dummy = _fileStream->readUint32LE();
- _frameSizes = new uint32[_frameCount];
- for (i = 0; i < _frameCount; ++i)
+ _frameSizes = new uint32[frameCount];
+ for (i = 0; i < frameCount; ++i)
_frameSizes[i] = _fileStream->readUint32LE();
- _frameTypes = new byte[_frameCount];
- for (i = 0; i < _frameCount; ++i)
+ _frameTypes = new byte[frameCount];
+ for (i = 0; i < frameCount; ++i)
_frameTypes[i] = _fileStream->readByte();
byte *huffmanTrees = (byte *) malloc(_header.treesSize);
_fileStream->read(huffmanTrees, _header.treesSize);
Common::BitStream8LSB bs(new Common::MemoryReadStream(huffmanTrees, _header.treesSize, DisposeAfterUse::YES), true);
+ videoTrack->readTrees(bs, _header.mMapSize, _header.mClrSize, _header.fullSize, _header.typeSize);
- _MMapTree = new BigHuffmanTree(bs, _header.mMapSize);
- _MClrTree = new BigHuffmanTree(bs, _header.mClrSize);
- _FullTree = new BigHuffmanTree(bs, _header.fullSize);
- _TypeTree = new BigHuffmanTree(bs, _header.typeSize);
-
- _surface = new Graphics::Surface();
+ _firstFrameStart = _fileStream->pos();
- // Height needs to be doubled if we have flags (Y-interlaced or Y-doubled)
- _surface->create(width, height * (_header.flags ? 2 : 1), Graphics::PixelFormat::createFormatCLUT8());
-
- memset(_palette, 0, 3 * 256);
return true;
}
void SmackerDecoder::close() {
- if (!_fileStream)
- return;
-
- if (_audioStream) {
- if (_audioStarted) {
- // The mixer will delete the stream.
- _mixer->stopHandle(_audioHandle);
- _audioStarted = false;
- } else {
- delete _audioStream;
- }
- _audioStream = 0;
- }
+ VideoDecoder::close();
delete _fileStream;
_fileStream = 0;
- _surface->free();
- delete _surface;
- _surface = 0;
-
- delete _MMapTree;
- delete _MClrTree;
- delete _FullTree;
- delete _TypeTree;
+ delete[] _frameTypes;
+ _frameTypes = 0;
delete[] _frameSizes;
- delete[] _frameTypes;
+ _frameSizes = 0;
+}
- reset();
+bool SmackerDecoder::rewind() {
+ // Call the parent method to rewind the tracks first
+ if (!VideoDecoder::rewind())
+ return false;
+
+ // And seek back to where the first frame begins
+ _fileStream->seek(_firstFrameStart);
+ return true;
}
-const Graphics::Surface *SmackerDecoder::decodeNextFrame() {
+void SmackerDecoder::readNextPacket() {
+ SmackerVideoTrack *videoTrack = (SmackerVideoTrack *)getTrack(0);
+
+ if (videoTrack->endOfTrack())
+ return;
+
+ videoTrack->increaseCurFrame();
+
uint i;
uint32 chunkSize = 0;
uint32 dataSizeUnpacked = 0;
uint32 startPos = _fileStream->pos();
- _curFrame++;
-
// Check if we got a frame with palette data, and
// call back the virtual setPalette function to set
// the current palette
- if (_frameTypes[_curFrame] & 1) {
- unpackPalette();
- _dirtyPalette = true;
- }
+ if (_frameTypes[videoTrack->getCurFrame()] & 1)
+ videoTrack->unpackPalette(_fileStream);
// Load audio tracks
for (i = 0; i < 7; ++i) {
- if (!(_frameTypes[_curFrame] & (2 << i)))
+ if (!(_frameTypes[videoTrack->getCurFrame()] & (2 << i)))
continue;
chunkSize = _fileStream->readUint32LE();
@@ -475,29 +456,109 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() {
handleAudioTrack(i, chunkSize, dataSizeUnpacked);
}
- uint32 frameSize = _frameSizes[_curFrame] & ~3;
-// uint32 remainder = _frameSizes[_curFrame] & 3;
+ uint32 frameSize = _frameSizes[videoTrack->getCurFrame()] & ~3;
+// uint32 remainder = _frameSizes[videoTrack->getCurFrame()] & 3;
if (_fileStream->pos() - startPos > frameSize)
error("Smacker actual frame size exceeds recorded frame size");
uint32 frameDataSize = frameSize - (_fileStream->pos() - startPos);
- _frameData = (byte *)malloc(frameDataSize + 1);
+ byte *frameData = (byte *)malloc(frameDataSize + 1);
// Padding to keep the BigHuffmanTrees from reading past the data end
- _frameData[frameDataSize] = 0x00;
+ frameData[frameDataSize] = 0x00;
+
+ _fileStream->read(frameData, frameDataSize);
+
+ Common::BitStream8LSB bs(new Common::MemoryReadStream(frameData, frameDataSize + 1, DisposeAfterUse::YES), true);
+ videoTrack->decodeFrame(bs);
+
+ _fileStream->seek(startPos + frameSize);
+}
+
+void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) {
+ if (_header.audioInfo[track].hasAudio && chunkSize > 0 && track == 0) {
+ // Get the audio track, which start at offset 1 (first track is video)
+ SmackerAudioTrack *audioTrack = (SmackerAudioTrack *)getTrack(track + 1);
+
+ // If it's track 0, play the audio data
+ byte *soundBuffer = (byte *)malloc(chunkSize + 1);
+ // Padding to keep the SmallHuffmanTrees from reading past the data end
+ soundBuffer[chunkSize] = 0x00;
+
+ _fileStream->read(soundBuffer, chunkSize);
+
+ if (_header.audioInfo[track].compression == kCompressionRDFT || _header.audioInfo[track].compression == kCompressionDCT) {
+ // TODO: Compressed audio (Bink RDFT/DCT encoded)
+ free(soundBuffer);
+ return;
+ } else if (_header.audioInfo[track].compression == kCompressionDPCM) {
+ // Compressed audio (Huffman DPCM encoded)
+ audioTrack->queueCompressedBuffer(soundBuffer, chunkSize + 1, unpackedSize);
+ free(soundBuffer);
+ } else {
+ // Uncompressed audio (PCM)
+ audioTrack->queuePCM(soundBuffer, chunkSize);
+ }
+ } else {
+ // Ignore the rest of the audio tracks, if they exist
+ // TODO: Are there any Smacker videos with more than one audio stream?
+ // If yes, we should play the rest of the audio streams as well
+ if (chunkSize > 0)
+ _fileStream->skip(chunkSize);
+ }
+}
- _fileStream->read(_frameData, frameDataSize);
+SmackerDecoder::SmackerVideoTrack::SmackerVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) {
+ _surface = new Graphics::Surface();
+ _surface->create(width, height * (flags ? 2 : 1), Graphics::PixelFormat::createFormatCLUT8());
+ _frameCount = frameCount;
+ _frameRate = frameRate;
+ _flags = flags;
+ _signature = signature;
+ _curFrame = -1;
+ _dirtyPalette = false;
+ _MMapTree = _MClrTree = _FullTree = _TypeTree = 0;
+ memset(_palette, 0, 3 * 256);
+}
- Common::BitStream8LSB bs(new Common::MemoryReadStream(_frameData, frameDataSize + 1, DisposeAfterUse::YES), true);
+SmackerDecoder::SmackerVideoTrack::~SmackerVideoTrack() {
+ _surface->free();
+ delete _surface;
+ delete _MMapTree;
+ delete _MClrTree;
+ delete _FullTree;
+ delete _TypeTree;
+}
+
+uint16 SmackerDecoder::SmackerVideoTrack::getWidth() const {
+ return _surface->w;
+}
+
+uint16 SmackerDecoder::SmackerVideoTrack::getHeight() const {
+ return _surface->h;
+}
+
+Graphics::PixelFormat SmackerDecoder::SmackerVideoTrack::getPixelFormat() const {
+ return _surface->format;
+}
+
+void SmackerDecoder::SmackerVideoTrack::readTrees(Common::BitStream &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize) {
+ _MMapTree = new BigHuffmanTree(bs, mMapSize);
+ _MClrTree = new BigHuffmanTree(bs, mClrSize);
+ _FullTree = new BigHuffmanTree(bs, fullSize);
+ _TypeTree = new BigHuffmanTree(bs, typeSize);
+}
+
+void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) {
_MMapTree->reset();
_MClrTree->reset();
_FullTree->reset();
_TypeTree->reset();
// Height needs to be doubled if we have flags (Y-interlaced or Y-doubled)
- uint doubleY = _header.flags ? 2 : 1;
+ uint doubleY = _flags ? 2 : 1;
uint bw = getWidth() / 4;
uint bh = getHeight() / doubleY / 4;
@@ -508,6 +569,7 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() {
uint type, run, j, mode;
uint32 p1, p2, clr, map;
byte hi, lo;
+ uint i;
while (block < blocks) {
type = _TypeTree->getCode(bs);
@@ -536,7 +598,7 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() {
break;
case SMK_BLOCK_FULL:
// Smacker v2 has one mode, Smacker v4 has three
- if (_header.signature == MKTAG('S','M','K','2')) {
+ if (_signature == MKTAG('S','M','K','2')) {
mode = 0;
} else {
// 00 - mode 0
@@ -628,60 +690,81 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() {
break;
}
}
+}
- _fileStream->seek(startPos + frameSize);
+void SmackerDecoder::SmackerVideoTrack::unpackPalette(Common::SeekableReadStream *stream) {
+ uint startPos = stream->pos();
+ uint32 len = 4 * stream->readByte();
- if (_curFrame == 0)
- _startTime = g_system->getMillis();
+ byte *chunk = (byte *)malloc(len);
+ stream->read(chunk, len);
+ byte *p = chunk;
- return _surface;
-}
+ byte oldPalette[3 * 256];
+ memcpy(oldPalette, _palette, 3 * 256);
-void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) {
- if (_header.audioInfo[track].hasAudio && chunkSize > 0 && track == 0) {
- // If it's track 0, play the audio data
- byte *soundBuffer = (byte *)malloc(chunkSize + 1);
- // Padding to keep the SmallHuffmanTrees from reading past the data end
- soundBuffer[chunkSize] = 0x00;
+ byte *pal = _palette;
- _fileStream->read(soundBuffer, chunkSize);
+ int sz = 0;
+ byte b0;
+ while (sz < 256) {
+ b0 = *p++;
+ if (b0 & 0x80) { // if top bit is 1 (0x80 = 10000000)
+ sz += (b0 & 0x7f) + 1; // get lower 7 bits + 1 (0x7f = 01111111)
+ pal += 3 * ((b0 & 0x7f) + 1);
+ } else if (b0 & 0x40) { // if top 2 bits are 01 (0x40 = 01000000)
+ byte c = (b0 & 0x3f) + 1; // get lower 6 bits + 1 (0x3f = 00111111)
+ uint s = 3 * *p++;
+ sz += c;
- if (_header.audioInfo[track].compression == kCompressionRDFT || _header.audioInfo[track].compression == kCompressionDCT) {
- // TODO: Compressed audio (Bink RDFT/DCT encoded)
- free(soundBuffer);
- return;
- } else if (_header.audioInfo[track].compression == kCompressionDPCM) {
- // Compressed audio (Huffman DPCM encoded)
- queueCompressedBuffer(soundBuffer, chunkSize + 1, unpackedSize, track);
- free(soundBuffer);
- } else {
- // Uncompressed audio (PCM)
- byte flags = 0;
- if (_header.audioInfo[track].is16Bits)
- flags = flags | Audio::FLAG_16BITS;
- if (_header.audioInfo[track].isStereo)
- flags = flags | Audio::FLAG_STEREO;
-
- _audioStream->queueBuffer(soundBuffer, chunkSize, DisposeAfterUse::YES, flags);
- // The sound buffer will be deleted by QueuingAudioStream
- }
+ while (c--) {
+ *pal++ = oldPalette[s + 0];
+ *pal++ = oldPalette[s + 1];
+ *pal++ = oldPalette[s + 2];
+ s += 3;
+ }
+ } else { // top 2 bits are 00
+ sz++;
+ // get the lower 6 bits for each component (0x3f = 00111111)
+ byte b = b0 & 0x3f;
+ byte g = (*p++) & 0x3f;
+ byte r = (*p++) & 0x3f;
+
+ assert(g < 0xc0 && b < 0xc0);
- if (!_audioStarted) {
- _mixer->playStream(_soundType, &_audioHandle, _audioStream, -1, 255);
- _audioStarted = true;
+ // upscale to full 8-bit color values by multiplying by 4
+ *pal++ = b * 4;
+ *pal++ = g * 4;
+ *pal++ = r * 4;
}
- } else {
- // Ignore the rest of the audio tracks, if they exist
- // TODO: Are there any Smacker videos with more than one audio stream?
- // If yes, we should play the rest of the audio streams as well
- if (chunkSize > 0)
- _fileStream->skip(chunkSize);
}
+
+ stream->seek(startPos + len);
+ free(chunk);
+
+ _dirtyPalette = true;
}
-void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
- uint32 unpackedSize, int streamNum) {
+SmackerDecoder::SmackerAudioTrack::SmackerAudioTrack(const AudioInfo &audioInfo, Audio::Mixer::SoundType soundType) :
+ _audioInfo(audioInfo), _soundType(soundType) {
+ _audioStream = Audio::makeQueuingAudioStream(_audioInfo.sampleRate, _audioInfo.isStereo);
+}
+SmackerDecoder::SmackerAudioTrack::~SmackerAudioTrack() {
+ delete _audioStream;
+}
+
+bool SmackerDecoder::SmackerAudioTrack::rewind() {
+ delete _audioStream;
+ _audioStream = Audio::makeQueuingAudioStream(_audioInfo.sampleRate, _audioInfo.isStereo);
+ return true;
+}
+
+Audio::AudioStream *SmackerDecoder::SmackerAudioTrack::getAudioStream() const {
+ return _audioStream;
+}
+
+void SmackerDecoder::SmackerAudioTrack::queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize) {
Common::BitStream8LSB audioBS(new Common::MemoryReadStream(buffer, bufferSize), true);
bool dataPresent = audioBS.getBit();
@@ -689,9 +772,9 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
return;
bool isStereo = audioBS.getBit();
- assert(isStereo == _header.audioInfo[streamNum].isStereo);
+ assert(isStereo == _audioInfo.isStereo);
bool is16Bits = audioBS.getBit();
- assert(is16Bits == _header.audioInfo[streamNum].is16Bits);
+ assert(is16Bits == _audioInfo.is16Bits);
int numBytes = 1 * (isStereo ? 2 : 1) * (is16Bits ? 2 : 1);
@@ -709,14 +792,14 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
if (isStereo) {
if (is16Bits) {
- bases[1] = FROM_BE_16(audioBS.getBits(16));
+ bases[1] = SWAP_BYTES_16(audioBS.getBits(16));
} else {
bases[1] = audioBS.getBits(8);
}
}
if (is16Bits) {
- bases[0] = FROM_BE_16(audioBS.getBits(16));
+ bases[0] = SWAP_BYTES_16(audioBS.getBits(16));
} else {
bases[0] = audioBS.getBits(8);
}
@@ -759,64 +842,21 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
for (int k = 0; k < numBytes; k++)
delete audioTrees[k];
- byte flags = 0;
- if (_header.audioInfo[0].is16Bits)
- flags = flags | Audio::FLAG_16BITS;
- if (_header.audioInfo[0].isStereo)
- flags = flags | Audio::FLAG_STEREO;
- _audioStream->queueBuffer(unpackedBuffer, unpackedSize, DisposeAfterUse::YES, flags);
- // unpackedBuffer will be deleted by QueuingAudioStream
+ queuePCM(unpackedBuffer, unpackedSize);
}
-void SmackerDecoder::unpackPalette() {
- uint startPos = _fileStream->pos();
- uint32 len = 4 * _fileStream->readByte();
-
- byte *chunk = (byte *)malloc(len);
- _fileStream->read(chunk, len);
- byte *p = chunk;
-
- byte oldPalette[3*256];
- memcpy(oldPalette, _palette, 3 * 256);
-
- byte *pal = _palette;
-
- int sz = 0;
- byte b0;
- while (sz < 256) {
- b0 = *p++;
- if (b0 & 0x80) { // if top bit is 1 (0x80 = 10000000)
- sz += (b0 & 0x7f) + 1; // get lower 7 bits + 1 (0x7f = 01111111)
- pal += 3 * ((b0 & 0x7f) + 1);
- } else if (b0 & 0x40) { // if top 2 bits are 01 (0x40 = 01000000)
- byte c = (b0 & 0x3f) + 1; // get lower 6 bits + 1 (0x3f = 00111111)
- uint s = 3 * *p++;
- sz += c;
-
- while (c--) {
- *pal++ = oldPalette[s + 0];
- *pal++ = oldPalette[s + 1];
- *pal++ = oldPalette[s + 2];
- s += 3;
- }
- } else { // top 2 bits are 00
- sz++;
- // get the lower 6 bits for each component (0x3f = 00111111)
- byte b = b0 & 0x3f;
- byte g = (*p++) & 0x3f;
- byte r = (*p++) & 0x3f;
-
- assert(g < 0xc0 && b < 0xc0);
+void SmackerDecoder::SmackerAudioTrack::queuePCM(byte *buffer, uint32 bufferSize) {
+ byte flags = 0;
+ if (_audioInfo.is16Bits)
+ flags |= Audio::FLAG_16BITS;
+ if (_audioInfo.isStereo)
+ flags |= Audio::FLAG_STEREO;
- // upscale to full 8-bit color values by multiplying by 4
- *pal++ = b * 4;
- *pal++ = g * 4;
- *pal++ = r * 4;
- }
- }
+ _audioStream->queueBuffer(buffer, bufferSize, DisposeAfterUse::YES, flags);
+}
- _fileStream->seek(startPos + len);
- free(chunk);
+SmackerDecoder::SmackerVideoTrack *SmackerDecoder::createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const {
+ return new SmackerVideoTrack(width, height, frameCount, frameRate, flags, signature);
}
} // End of namespace Video
diff --git a/video/smk_decoder.h b/video/smk_decoder.h
index 72cd32a222..7227238373 100644
--- a/video/smk_decoder.h
+++ b/video/smk_decoder.h
@@ -34,6 +34,7 @@ class QueuingAudioStream;
}
namespace Common {
+class BitStream;
class SeekableReadStream;
}
@@ -56,36 +57,72 @@ class BigHuffmanTree;
* - sword2
* - toon
*/
-class SmackerDecoder : public FixedRateVideoDecoder {
+class SmackerDecoder : public VideoDecoder {
public:
- SmackerDecoder(Audio::Mixer *mixer,
- Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
+ SmackerDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
virtual ~SmackerDecoder();
- bool loadStream(Common::SeekableReadStream *stream);
+ virtual bool loadStream(Common::SeekableReadStream *stream);
void close();
- bool isVideoLoaded() const { return _fileStream != 0; }
- uint16 getWidth() const { return _surface->w; }
- uint16 getHeight() const { return _surface->h; }
- uint32 getFrameCount() const { return _frameCount; }
- uint32 getElapsedTime() const;
- const Graphics::Surface *decodeNextFrame();
- Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
- const byte *getPalette() { _dirtyPalette = false; return _palette; }
- bool hasDirtyPalette() const { return _dirtyPalette; }
- virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
+ bool rewind();
protected:
- Common::Rational getFrameRate() const { return _frameRate; }
- Common::SeekableReadStream *_fileStream;
+ void readNextPacket();
-protected:
- void unpackPalette();
- // Possible runs of blocks
- uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); }
- void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize, int streamNum);
+ virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
+
+ class SmackerVideoTrack : public FixedRateVideoTrack {
+ public:
+ SmackerVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature);
+ ~SmackerVideoTrack();
+
+ bool isRewindable() const { return true; }
+ bool rewind() { _curFrame = -1; return true; }
+
+ uint16 getWidth() const;
+ uint16 getHeight() const;
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const { return _curFrame; }
+ int getFrameCount() const { return _frameCount; }
+ const Graphics::Surface *decodeNextFrame() { return _surface; }
+ const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ bool hasDirtyPalette() const { return _dirtyPalette; }
+
+ void readTrees(Common::BitStream &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize);
+ void increaseCurFrame() { _curFrame++; }
+ void decodeFrame(Common::BitStream &bs);
+ void unpackPalette(Common::SeekableReadStream *stream);
+
+ protected:
+ Common::Rational getFrameRate() const { return _frameRate; }
+
+ Graphics::Surface *_surface;
+
+ private:
+ Common::Rational _frameRate;
+ uint32 _flags, _signature;
+
+ byte _palette[3 * 256];
+ mutable bool _dirtyPalette;
+
+ int _curFrame;
+ uint32 _frameCount;
+ BigHuffmanTree *_MMapTree;
+ BigHuffmanTree *_MClrTree;
+ BigHuffmanTree *_FullTree;
+ BigHuffmanTree *_TypeTree;
+
+ // Possible runs of blocks
+ static uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); }
+ };
+
+ virtual SmackerVideoTrack *createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const;
+
+ Common::SeekableReadStream *_fileStream;
+
+private:
enum AudioCompression {
kCompressionNone,
kCompressionDPCM,
@@ -114,6 +151,28 @@ protected:
uint32 dummy;
} _header;
+ class SmackerAudioTrack : public AudioTrack {
+ public:
+ SmackerAudioTrack(const AudioInfo &audioInfo, Audio::Mixer::SoundType soundType);
+ ~SmackerAudioTrack();
+
+ bool isRewindable() const { return true; }
+ bool rewind();
+
+ Audio::Mixer::SoundType getSoundType() const { return _soundType; }
+
+ void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize);
+ void queuePCM(byte *buffer, uint32 bufferSize);
+
+ protected:
+ Audio::AudioStream *getAudioStream() const;
+
+ private:
+ Audio::Mixer::SoundType _soundType;
+ Audio::QueuingAudioStream *_audioStream;
+ AudioInfo _audioInfo;
+ };
+
uint32 *_frameSizes;
// The FrameTypes section of a Smacker file contains an array of bytes, where
// the 8 bits of each byte describe the contents of the corresponding frame.
@@ -121,25 +180,10 @@ protected:
// and so on), so there can be up to 7 different audio tracks. When the lowest bit
// (bit 0) is set, it denotes a frame that contains a palette record
byte *_frameTypes;
- byte *_frameData;
- // The RGB palette
- byte _palette[3 * 256];
- bool _dirtyPalette;
- Common::Rational _frameRate;
- uint32 _frameCount;
- Graphics::Surface *_surface;
+ uint32 _firstFrameStart;
Audio::Mixer::SoundType _soundType;
- Audio::Mixer *_mixer;
- bool _audioStarted;
- Audio::QueuingAudioStream *_audioStream;
- Audio::SoundHandle _audioHandle;
-
- BigHuffmanTree *_MMapTree;
- BigHuffmanTree *_MClrTree;
- BigHuffmanTree *_FullTree;
- BigHuffmanTree *_TypeTree;
};
} // End of namespace Video
diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp
new file mode 100644
index 0000000000..63aa93e2f5
--- /dev/null
+++ b/video/theora_decoder.cpp
@@ -0,0 +1,487 @@
+/* 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.
+ *
+ */
+
+/*
+ * Source is based on the player example from libvorbis package,
+ * available at: http://svn.xiph.org/trunk/theora/examples/player_example.c
+ *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.
+ *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009
+ * by the Xiph.Org Foundation and contributors http://www.xiph.org/
+ *
+ */
+
+#include "video/theora_decoder.h"
+
+#include "audio/audiostream.h"
+#include "audio/decoders/raw.h"
+#include "common/stream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "graphics/pixelformat.h"
+#include "graphics/yuv_to_rgb.h"
+
+namespace Video {
+
+TheoraDecoder::TheoraDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
+ _fileStream = 0;
+
+ _videoTrack = 0;
+ _audioTrack = 0;
+ _hasVideo = _hasAudio = false;
+}
+
+TheoraDecoder::~TheoraDecoder() {
+ close();
+}
+
+bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
+ close();
+
+ _fileStream = stream;
+
+ // start up Ogg stream synchronization layer
+ ogg_sync_init(&_oggSync);
+
+ // init supporting Vorbis structures needed in header parsing
+ vorbis_info_init(&_vorbisInfo);
+ vorbis_comment vorbisComment;
+ vorbis_comment_init(&vorbisComment);
+
+ // init supporting Theora structures needed in header parsing
+ th_info theoraInfo;
+ th_info_init(&theoraInfo);
+ th_comment theoraComment;
+ th_comment_init(&theoraComment);
+ th_setup_info *theoraSetup = 0;
+
+ uint theoraPackets = 0, vorbisPackets = 0;
+
+ // Ogg file open; parse the headers
+ // Only interested in Vorbis/Theora streams
+ bool foundHeader = false;
+ while (!foundHeader) {
+ int ret = bufferData();
+
+ if (ret == 0)
+ break; // FIXME: Shouldn't this error out?
+
+ while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) {
+ ogg_stream_state test;
+
+ // is this a mandated initial header? If not, stop parsing
+ if (!ogg_page_bos(&_oggPage)) {
+ // don't leak the page; get it into the appropriate stream
+ queuePage(&_oggPage);
+ foundHeader = true;
+ break;
+ }
+
+ ogg_stream_init(&test, ogg_page_serialno(&_oggPage));
+ ogg_stream_pagein(&test, &_oggPage);
+ ogg_stream_packetout(&test, &_oggPacket);
+
+ // identify the codec: try theora
+ if (theoraPackets == 0 && th_decode_headerin(&theoraInfo, &theoraComment, &theoraSetup, &_oggPacket) >= 0) {
+ // it is theora
+ memcpy(&_theoraOut, &test, sizeof(test));
+ theoraPackets = 1;
+ _hasVideo = true;
+ } else if (vorbisPackets == 0 && vorbis_synthesis_headerin(&_vorbisInfo, &vorbisComment, &_oggPacket) >= 0) {
+ // it is vorbis
+ memcpy(&_vorbisOut, &test, sizeof(test));
+ vorbisPackets = 1;
+ _hasAudio = true;
+ } else {
+ // whatever it is, we don't care about it
+ ogg_stream_clear(&test);
+ }
+ }
+ // fall through to non-bos page parsing
+ }
+
+ // we're expecting more header packets.
+ while ((theoraPackets && theoraPackets < 3) || (vorbisPackets && vorbisPackets < 3)) {
+ int ret;
+
+ // look for further theora headers
+ while (theoraPackets && (theoraPackets < 3) && (ret = ogg_stream_packetout(&_theoraOut, &_oggPacket))) {
+ if (ret < 0)
+ error("Error parsing Theora stream headers; corrupt stream?");
+
+ if (!th_decode_headerin(&theoraInfo, &theoraComment, &theoraSetup, &_oggPacket))
+ error("Error parsing Theora stream headers; corrupt stream?");
+
+ theoraPackets++;
+ }
+
+ // look for more vorbis header packets
+ while (vorbisPackets && (vorbisPackets < 3) && (ret = ogg_stream_packetout(&_vorbisOut, &_oggPacket))) {
+ if (ret < 0)
+ error("Error parsing Vorbis stream headers; corrupt stream?");
+
+ if (vorbis_synthesis_headerin(&_vorbisInfo, &vorbisComment, &_oggPacket))
+ error("Error parsing Vorbis stream headers; corrupt stream?");
+
+ vorbisPackets++;
+
+ if (vorbisPackets == 3)
+ break;
+ }
+
+ // The header pages/packets will arrive before anything else we
+ // care about, or the stream is not obeying spec
+
+ if (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) {
+ queuePage(&_oggPage); // demux into the appropriate stream
+ } else {
+ ret = bufferData(); // someone needs more data
+
+ if (ret == 0)
+ error("End of file while searching for codec headers.");
+ }
+ }
+
+ // And now we have it all. Initialize decoders next
+ if (_hasVideo) {
+ _videoTrack = new TheoraVideoTrack(getDefaultHighColorFormat(), theoraInfo, theoraSetup);
+ addTrack(_videoTrack);
+ }
+
+ th_info_clear(&theoraInfo);
+ th_comment_clear(&theoraComment);
+ th_setup_free(theoraSetup);
+
+ if (_hasAudio) {
+ _audioTrack = new VorbisAudioTrack(_soundType, _vorbisInfo);
+
+ // Get enough audio data to start us off
+ while (!_audioTrack->hasAudio()) {
+ // Queue more data
+ bufferData();
+ while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0)
+ queuePage(&_oggPage);
+
+ queueAudio();
+ }
+
+ addTrack(_audioTrack);
+ }
+
+ vorbis_comment_clear(&vorbisComment);
+
+ return true;
+}
+
+void TheoraDecoder::close() {
+ VideoDecoder::close();
+
+ if (!_fileStream)
+ return;
+
+ if (_videoTrack) {
+ ogg_stream_clear(&_theoraOut);
+ _videoTrack = 0;
+ }
+
+ if (_audioTrack) {
+ ogg_stream_clear(&_vorbisOut);
+ _audioTrack = 0;
+ }
+
+ ogg_sync_clear(&_oggSync);
+ vorbis_info_clear(&_vorbisInfo);
+
+ delete _fileStream;
+ _fileStream = 0;
+
+ _hasVideo = _hasAudio = false;
+}
+
+void TheoraDecoder::readNextPacket() {
+ // First, let's get our frame
+ if (_hasVideo) {
+ while (!_videoTrack->endOfTrack()) {
+ // theora is one in, one out...
+ if (ogg_stream_packetout(&_theoraOut, &_oggPacket) > 0) {
+ if (_videoTrack->decodePacket(_oggPacket))
+ break;
+ } else if (_theoraOut.e_o_s || _fileStream->eos()) {
+ // If we can't get any more frames, we're done.
+ _videoTrack->setEndOfVideo();
+ } else {
+ // Queue more data
+ bufferData();
+ while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0)
+ queuePage(&_oggPage);
+ }
+
+ // Update audio if we can
+ queueAudio();
+ }
+ }
+
+ // Then make sure we have enough audio buffered
+ ensureAudioBufferSize();
+}
+
+TheoraDecoder::TheoraVideoTrack::TheoraVideoTrack(const Graphics::PixelFormat &format, th_info &theoraInfo, th_setup_info *theoraSetup) {
+ _theoraDecode = th_decode_alloc(&theoraInfo, theoraSetup);
+
+ if (theoraInfo.pixel_fmt != TH_PF_420)
+ error("Only theora YUV420 is supported");
+
+ int postProcessingMax;
+ th_decode_ctl(_theoraDecode, TH_DECCTL_GET_PPLEVEL_MAX, &postProcessingMax, sizeof(postProcessingMax));
+ th_decode_ctl(_theoraDecode, TH_DECCTL_SET_PPLEVEL, &postProcessingMax, sizeof(postProcessingMax));
+
+ _surface.create(theoraInfo.frame_width, theoraInfo.frame_height, format);
+
+ // Set up a display surface
+ _displaySurface.pixels = _surface.getBasePtr(theoraInfo.pic_x, theoraInfo.pic_y);
+ _displaySurface.w = theoraInfo.pic_width;
+ _displaySurface.h = theoraInfo.pic_height;
+ _displaySurface.format = format;
+ _displaySurface.pitch = _surface.pitch;
+
+ // Set the frame rate
+ _frameRate = Common::Rational(theoraInfo.fps_numerator, theoraInfo.fps_denominator);
+
+ _endOfVideo = false;
+ _nextFrameStartTime = 0.0;
+ _curFrame = -1;
+}
+
+TheoraDecoder::TheoraVideoTrack::~TheoraVideoTrack() {
+ th_decode_free(_theoraDecode);
+
+ _surface.free();
+ _displaySurface.pixels = 0;
+}
+
+bool TheoraDecoder::TheoraVideoTrack::decodePacket(ogg_packet &oggPacket) {
+ if (th_decode_packetin(_theoraDecode, &oggPacket, 0) == 0) {
+ _curFrame++;
+
+ // Convert YUV data to RGB data
+ th_ycbcr_buffer yuv;
+ th_decode_ycbcr_out(_theoraDecode, yuv);
+ translateYUVtoRGBA(yuv);
+
+ double time = th_granule_time(_theoraDecode, oggPacket.granulepos);
+
+ // We need to calculate when the next frame should be shown
+ // This is all in floating point because that's what the Ogg code gives us
+ // Ogg is a lossy container format, so it doesn't always list the time to the
+ // next frame. In such cases, we need to calculate it ourselves.
+ if (time == -1.0)
+ _nextFrameStartTime += _frameRate.getInverse().toDouble();
+ else
+ _nextFrameStartTime = time;
+
+ return true;
+ }
+
+ return false;
+}
+
+enum TheoraYUVBuffers {
+ kBufferY = 0,
+ kBufferU = 1,
+ kBufferV = 2
+};
+
+void TheoraDecoder::TheoraVideoTrack::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer) {
+ // Width and height of all buffers have to be divisible by 2.
+ assert((YUVBuffer[kBufferY].width & 1) == 0);
+ assert((YUVBuffer[kBufferY].height & 1) == 0);
+ assert((YUVBuffer[kBufferU].width & 1) == 0);
+ assert((YUVBuffer[kBufferV].width & 1) == 0);
+
+ // UV images have to have a quarter of the Y image resolution
+ assert(YUVBuffer[kBufferU].width == YUVBuffer[kBufferY].width >> 1);
+ assert(YUVBuffer[kBufferV].width == YUVBuffer[kBufferY].width >> 1);
+ assert(YUVBuffer[kBufferU].height == YUVBuffer[kBufferY].height >> 1);
+ assert(YUVBuffer[kBufferV].height == YUVBuffer[kBufferY].height >> 1);
+
+ YUVToRGBMan.convert420(&_surface, Graphics::YUVToRGBManager::kScaleITU, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride);
+}
+
+static vorbis_info *info = 0;
+
+TheoraDecoder::VorbisAudioTrack::VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo) : _soundType(soundType) {
+ vorbis_synthesis_init(&_vorbisDSP, &vorbisInfo);
+ vorbis_block_init(&_vorbisDSP, &_vorbisBlock);
+ info = &vorbisInfo;
+
+ _audStream = Audio::makeQueuingAudioStream(vorbisInfo.rate, vorbisInfo.channels);
+
+ _audioBufferFill = 0;
+ _audioBuffer = 0;
+ _endOfAudio = false;
+}
+
+TheoraDecoder::VorbisAudioTrack::~VorbisAudioTrack() {
+ vorbis_dsp_clear(&_vorbisDSP);
+ vorbis_block_clear(&_vorbisBlock);
+ delete _audStream;
+ free(_audioBuffer);
+}
+
+Audio::AudioStream *TheoraDecoder::VorbisAudioTrack::getAudioStream() const {
+ return _audStream;
+}
+
+#define AUDIOFD_FRAGSIZE 10240
+
+static double rint(double v) {
+ return floor(v + 0.5);
+}
+
+bool TheoraDecoder::VorbisAudioTrack::decodeSamples() {
+ float **pcm;
+
+ // if there's pending, decoded audio, grab it
+ int ret = vorbis_synthesis_pcmout(&_vorbisDSP, &pcm);
+
+ if (ret > 0) {
+ if (!_audioBuffer) {
+ _audioBuffer = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t));
+ assert(_audioBuffer);
+ }
+
+ int channels = _audStream->isStereo() ? 2 : 1;
+ int count = _audioBufferFill / 2;
+ int maxsamples = ((AUDIOFD_FRAGSIZE - _audioBufferFill) / channels) >> 1;
+ int i;
+
+ for (i = 0; i < ret && i < maxsamples; i++) {
+ for (int j = 0; j < channels; j++) {
+ int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767);
+ _audioBuffer[count++] = val;
+ }
+ }
+
+ vorbis_synthesis_read(&_vorbisDSP, i);
+ _audioBufferFill += (i * channels) << 1;
+
+ if (_audioBufferFill == AUDIOFD_FRAGSIZE) {
+ byte flags = Audio::FLAG_16BITS;
+
+ if (_audStream->isStereo())
+ flags |= Audio::FLAG_STEREO;
+
+#ifdef SCUMM_LITTLE_ENDIAN
+ flags |= Audio::FLAG_LITTLE_ENDIAN;
+#endif
+
+ _audStream->queueBuffer((byte *)_audioBuffer, AUDIOFD_FRAGSIZE, DisposeAfterUse::YES, flags);
+
+ // The audio mixer is now responsible for the old audio buffer.
+ // We need to create a new one.
+ _audioBuffer = 0;
+ _audioBufferFill = 0;
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+bool TheoraDecoder::VorbisAudioTrack::hasAudio() const {
+ return _audStream->numQueuedStreams() > 0;
+}
+
+bool TheoraDecoder::VorbisAudioTrack::needsAudio() const {
+ // TODO: 5 is very arbitrary. We probably should do something like QuickTime does.
+ return !_endOfAudio && _audStream->numQueuedStreams() < 5;
+}
+
+void TheoraDecoder::VorbisAudioTrack::synthesizePacket(ogg_packet &oggPacket) {
+ if (vorbis_synthesis(&_vorbisBlock, &oggPacket) == 0) // test for success
+ vorbis_synthesis_blockin(&_vorbisDSP, &_vorbisBlock);
+}
+
+void TheoraDecoder::queuePage(ogg_page *page) {
+ if (_hasVideo)
+ ogg_stream_pagein(&_theoraOut, page);
+
+ if (_hasAudio)
+ ogg_stream_pagein(&_vorbisOut, page);
+}
+
+int TheoraDecoder::bufferData() {
+ char *buffer = ogg_sync_buffer(&_oggSync, 4096);
+ int bytes = _fileStream->read(buffer, 4096);
+
+ ogg_sync_wrote(&_oggSync, bytes);
+
+ return bytes;
+}
+
+bool TheoraDecoder::queueAudio() {
+ if (!_hasAudio)
+ return false;
+
+ bool queuedAudio = false;
+
+ for (;;) {
+ if (_audioTrack->decodeSamples()) {
+ // we queued some pending audio
+ queuedAudio = true;
+ } else if (ogg_stream_packetout(&_vorbisOut, &_oggPacket) > 0) {
+ // no pending audio; is there a pending packet to decode?
+ _audioTrack->synthesizePacket(_oggPacket);
+ } else {
+ // we've buffered all we have, break out for now
+ break;
+ }
+ }
+
+ return queuedAudio;
+}
+
+void TheoraDecoder::ensureAudioBufferSize() {
+ if (!_hasAudio)
+ return;
+
+ // Force at least some audio to be buffered
+ while (_audioTrack->needsAudio()) {
+ bufferData();
+ while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0)
+ queuePage(&_oggPage);
+
+ bool queuedAudio = queueAudio();
+ if ((_vorbisOut.e_o_s || _fileStream->eos()) && !queuedAudio) {
+ _audioTrack->setEndOfAudio();
+ break;
+ }
+ }
+}
+
+} // End of namespace Video
diff --git a/video/theora_decoder.h b/video/theora_decoder.h
new file mode 100644
index 0000000000..7e36d829e7
--- /dev/null
+++ b/video/theora_decoder.h
@@ -0,0 +1,157 @@
+/* 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" // for USE_THEORADEC
+
+#ifdef USE_THEORADEC
+
+#ifndef VIDEO_THEORA_DECODER_H
+#define VIDEO_THEORA_DECODER_H
+
+#include "common/rational.h"
+#include "video/video_decoder.h"
+#include "audio/mixer.h"
+#include "graphics/surface.h"
+
+#include <theora/theoradec.h>
+#include <vorbis/codec.h>
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Audio {
+class AudioStream;
+class QueuingAudioStream;
+}
+
+namespace Video {
+
+/**
+ *
+ * Decoder for Theora videos.
+ * Video decoder used in engines:
+ * - sword25
+ */
+class TheoraDecoder : public VideoDecoder {
+public:
+ TheoraDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
+ virtual ~TheoraDecoder();
+
+ /**
+ * Load a video file
+ * @param stream the stream to load
+ */
+ bool loadStream(Common::SeekableReadStream *stream);
+ void close();
+
+protected:
+ void readNextPacket();
+
+private:
+ class TheoraVideoTrack : public VideoTrack {
+ public:
+ TheoraVideoTrack(const Graphics::PixelFormat &format, th_info &theoraInfo, th_setup_info *theoraSetup);
+ ~TheoraVideoTrack();
+
+ bool endOfTrack() const { return _endOfVideo; }
+ uint16 getWidth() const { return _displaySurface.w; }
+ uint16 getHeight() const { return _displaySurface.h; }
+ Graphics::PixelFormat getPixelFormat() const { return _displaySurface.format; }
+ int getCurFrame() const { return _curFrame; }
+ uint32 getNextFrameStartTime() const { return (uint32)(_nextFrameStartTime * 1000); }
+ const Graphics::Surface *decodeNextFrame() { return &_displaySurface; }
+
+ bool decodePacket(ogg_packet &oggPacket);
+ void setEndOfVideo() { _endOfVideo = true; }
+
+ private:
+ int _curFrame;
+ bool _endOfVideo;
+ Common::Rational _frameRate;
+ double _nextFrameStartTime;
+
+ Graphics::Surface _surface;
+ Graphics::Surface _displaySurface;
+
+ th_dec_ctx *_theoraDecode;
+
+ void translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer);
+ };
+
+ class VorbisAudioTrack : public AudioTrack {
+ public:
+ VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo);
+ ~VorbisAudioTrack();
+
+ Audio::Mixer::SoundType getSoundType() const { return _soundType; }
+
+ bool decodeSamples();
+ bool hasAudio() const;
+ bool needsAudio() const;
+ void synthesizePacket(ogg_packet &oggPacket);
+ void setEndOfAudio() { _endOfAudio = true; }
+
+ protected:
+ Audio::AudioStream *getAudioStream() const;
+
+ private:
+ // single audio fragment audio buffering
+ int _audioBufferFill;
+ ogg_int16_t *_audioBuffer;
+
+ Audio::Mixer::SoundType _soundType;
+ Audio::QueuingAudioStream *_audStream;
+
+ vorbis_block _vorbisBlock;
+ vorbis_dsp_state _vorbisDSP;
+
+ bool _endOfAudio;
+ };
+
+ void queuePage(ogg_page *page);
+ int bufferData();
+ bool queueAudio();
+ void ensureAudioBufferSize();
+
+ Common::SeekableReadStream *_fileStream;
+
+ Audio::Mixer::SoundType _soundType;
+
+ ogg_sync_state _oggSync;
+ ogg_page _oggPage;
+ ogg_packet _oggPacket;
+
+ ogg_stream_state _theoraOut, _vorbisOut;
+ bool _hasVideo, _hasAudio;
+
+ vorbis_info _vorbisInfo;
+
+ TheoraVideoTrack *_videoTrack;
+ VorbisAudioTrack *_audioTrack;
+};
+
+} // End of namespace Video
+
+#endif
+
+#endif
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index e1122132a8..110afa7755 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -22,6 +22,9 @@
#include "video/video_decoder.h"
+#include "audio/audiostream.h"
+#include "audio/mixer.h" // for kMaxChannelVolume
+
#include "common/rational.h"
#include "common/file.h"
#include "common/system.h"
@@ -31,7 +34,43 @@
namespace Video {
VideoDecoder::VideoDecoder() {
- reset();
+ _startTime = 0;
+ _dirtyPalette = false;
+ _palette = 0;
+ _isPlaying = false;
+ _audioVolume = Audio::Mixer::kMaxChannelVolume;
+ _audioBalance = 0;
+ _pauseLevel = 0;
+ _needsUpdate = false;
+ _lastTimeChange = 0;
+ _endTime = 0;
+ _endTimeSet = false;
+
+ // Find the best format for output
+ _defaultHighColorFormat = g_system->getScreenFormat();
+
+ if (_defaultHighColorFormat.bytesPerPixel == 1)
+ _defaultHighColorFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0);
+}
+
+void VideoDecoder::close() {
+ if (isPlaying())
+ stop();
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ delete *it;
+
+ _tracks.clear();
+ _dirtyPalette = false;
+ _palette = 0;
+ _startTime = 0;
+ _audioVolume = Audio::Mixer::kMaxChannelVolume;
+ _audioBalance = 0;
+ _pauseLevel = 0;
+ _needsUpdate = false;
+ _lastTimeChange = 0;
+ _endTime = 0;
+ _endTimeSet = false;
}
bool VideoDecoder::loadFile(const Common::String &filename) {
@@ -45,26 +84,8 @@ bool VideoDecoder::loadFile(const Common::String &filename) {
return loadStream(file);
}
-uint32 VideoDecoder::getElapsedTime() const {
- return g_system->getMillis() - _startTime;
-}
-
-void VideoDecoder::setSystemPalette() {
- g_system->getPaletteManager()->setPalette(getPalette(), 0, 256);
-}
-
bool VideoDecoder::needsUpdate() const {
- return !endOfVideo() && getTimeToNextFrame() == 0;
-}
-
-void VideoDecoder::reset() {
- _curFrame = -1;
- _startTime = 0;
- _pauseLevel = 0;
-}
-
-bool VideoDecoder::endOfVideo() const {
- return !isVideoLoaded() || (getCurFrame() >= (int32)getFrameCount() - 1);
+ return hasFramesLeft() && getTimeToNextFrame() == 0;
}
void VideoDecoder::pauseVideo(bool pause) {
@@ -82,10 +103,14 @@ void VideoDecoder::pauseVideo(bool pause) {
if (_pauseLevel == 1 && pause) {
_pauseStartTime = g_system->getMillis(); // Store the starting time from pausing to keep it for later
- pauseVideoIntern(true);
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ (*it)->pause(true);
} else if (_pauseLevel == 0) {
- pauseVideoIntern(false);
- addPauseTime(g_system->getMillis() - _pauseStartTime);
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ (*it)->pause(false);
+
+ _startTime += (g_system->getMillis() - _pauseStartTime);
}
}
@@ -94,25 +119,561 @@ void VideoDecoder::resetPauseStartTime() {
_pauseStartTime = g_system->getMillis();
}
-uint32 FixedRateVideoDecoder::getTimeToNextFrame() const {
- if (endOfVideo() || _curFrame < 0)
+void VideoDecoder::setVolume(byte volume) {
+ _audioVolume = volume;
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio)
+ ((AudioTrack *)*it)->setVolume(_audioVolume);
+}
+
+void VideoDecoder::setBalance(int8 balance) {
+ _audioBalance = balance;
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio)
+ ((AudioTrack *)*it)->setBalance(_audioBalance);
+}
+
+bool VideoDecoder::isVideoLoaded() const {
+ return !_tracks.empty();
+}
+
+uint16 VideoDecoder::getWidth() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ return ((VideoTrack *)*it)->getWidth();
+
+ return 0;
+}
+
+uint16 VideoDecoder::getHeight() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ return ((VideoTrack *)*it)->getHeight();
+
+ return 0;
+}
+
+Graphics::PixelFormat VideoDecoder::getPixelFormat() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ return ((VideoTrack *)*it)->getPixelFormat();
+
+ return Graphics::PixelFormat();
+}
+
+const Graphics::Surface *VideoDecoder::decodeNextFrame() {
+ _needsUpdate = false;
+
+ readNextPacket();
+ VideoTrack *track = findNextVideoTrack();
+
+ if (!track)
+ return 0;
+
+ const Graphics::Surface *frame = track->decodeNextFrame();
+
+ if (track->hasDirtyPalette()) {
+ _palette = track->getPalette();
+ _dirtyPalette = true;
+ }
+
+ return frame;
+}
+
+const byte *VideoDecoder::getPalette() {
+ _dirtyPalette = false;
+ return _palette;
+}
+
+int VideoDecoder::getCurFrame() const {
+ int32 frame = -1;
+
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ frame += ((VideoTrack *)*it)->getCurFrame() + 1;
+
+ return frame;
+}
+
+uint32 VideoDecoder::getFrameCount() const {
+ int count = 0;
+
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ count += ((VideoTrack *)*it)->getFrameCount();
+
+ return count;
+}
+
+uint32 VideoDecoder::getTime() const {
+ if (!isPlaying())
+ return _lastTimeChange.msecs();
+
+ if (isPaused())
+ return _pauseStartTime - _startTime;
+
+ if (useAudioSync()) {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) {
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio && !(*it)->endOfTrack()) {
+ uint32 time = ((const AudioTrack *)*it)->getRunningTime();
+
+ if (time != 0)
+ return time + _lastTimeChange.msecs();
+ }
+ }
+ }
+
+ return g_system->getMillis() - _startTime;
+}
+
+uint32 VideoDecoder::getTimeToNextFrame() const {
+ if (endOfVideo() || _needsUpdate)
+ return 0;
+
+ const VideoTrack *track = findNextVideoTrack();
+
+ if (!track)
return 0;
- uint32 elapsedTime = getElapsedTime();
- uint32 nextFrameStartTime = getFrameBeginTime(_curFrame + 1);
+ uint32 elapsedTime = getTime();
+ uint32 nextFrameStartTime = track->getNextFrameStartTime();
- // If the time that the next frame should be shown has past
- // the frame should be shown ASAP.
if (nextFrameStartTime <= elapsedTime)
return 0;
return nextFrameStartTime - elapsedTime;
}
-uint32 FixedRateVideoDecoder::getFrameBeginTime(uint32 frame) const {
- Common::Rational beginTime = frame * 1000;
- beginTime /= getFrameRate();
- return beginTime.toInt();
+bool VideoDecoder::endOfVideo() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if (!(*it)->endOfTrack() && (!isPlaying() || (*it)->getTrackType() != Track::kTrackTypeVideo || !_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
+ return false;
+
+ return true;
+}
+
+bool VideoDecoder::isRewindable() const {
+ if (!isVideoLoaded())
+ return false;
+
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if (!(*it)->isRewindable())
+ return false;
+
+ return true;
+}
+
+bool VideoDecoder::rewind() {
+ if (!isRewindable())
+ return false;
+
+ // Stop all tracks so they can be rewound
+ if (isPlaying())
+ stopAudio();
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if (!(*it)->rewind())
+ return false;
+
+ // Now that we've rewound, start all tracks again
+ if (isPlaying())
+ startAudio();
+
+ _lastTimeChange = 0;
+ _startTime = g_system->getMillis();
+ resetPauseStartTime();
+ return true;
+}
+
+bool VideoDecoder::isSeekable() const {
+ if (!isVideoLoaded())
+ return false;
+
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if (!(*it)->isSeekable())
+ return false;
+
+ return true;
+}
+
+bool VideoDecoder::seek(const Audio::Timestamp &time) {
+ if (!isSeekable())
+ return false;
+
+ // Stop all tracks so they can be seeked
+ if (isPlaying())
+ stopAudio();
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if (!(*it)->seek(time))
+ return false;
+
+ _lastTimeChange = time;
+
+ // Now that we've seeked, start all tracks again
+ // Also reset our start time
+ if (isPlaying()) {
+ startAudio();
+ _startTime = g_system->getMillis() - time.msecs();
+ }
+
+ resetPauseStartTime();
+ _needsUpdate = true;
+ return true;
+}
+
+void VideoDecoder::start() {
+ if (isPlaying() || !isVideoLoaded())
+ return;
+
+ _isPlaying = true;
+ _startTime = g_system->getMillis();
+
+ // Adjust start time if we've seeked to something besides zero time
+ if (_lastTimeChange.totalNumberOfFrames() != 0)
+ _startTime -= _lastTimeChange.msecs();
+
+ startAudio();
+}
+
+void VideoDecoder::stop() {
+ if (!isPlaying())
+ return;
+
+ // Stop audio here so we don't have it affect getTime()
+ stopAudio();
+
+ // Keep the time marked down in case we start up again
+ // We do this before _isPlaying is set so we don't get
+ // _lastTimeChange returned, but before _pauseLevel is
+ // reset.
+ _lastTimeChange = getTime();
+
+ _isPlaying = false;
+ _startTime = 0;
+ _palette = 0;
+ _dirtyPalette = false;
+ _needsUpdate = false;
+
+ // Also reset the pause state.
+ _pauseLevel = 0;
+
+ // Reset the pause state of the tracks too
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ (*it)->pause(false);
+}
+
+Audio::Timestamp VideoDecoder::getDuration() const {
+ Audio::Timestamp maxDuration(0, 1000);
+
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) {
+ Audio::Timestamp duration = (*it)->getDuration();
+
+ if (duration > maxDuration)
+ maxDuration = duration;
+ }
+
+ return maxDuration;
+}
+
+VideoDecoder::Track::Track() {
+ _paused = false;
+}
+
+bool VideoDecoder::Track::isRewindable() const {
+ return isSeekable();
+}
+
+bool VideoDecoder::Track::rewind() {
+ return seek(Audio::Timestamp(0, 1000));
+}
+
+void VideoDecoder::Track::pause(bool shouldPause) {
+ _paused = shouldPause;
+ pauseIntern(shouldPause);
+}
+
+Audio::Timestamp VideoDecoder::Track::getDuration() const {
+ return Audio::Timestamp(0, 1000);
+}
+
+bool VideoDecoder::VideoTrack::endOfTrack() const {
+ return getCurFrame() >= (getFrameCount() - 1);
+}
+
+uint32 VideoDecoder::FixedRateVideoTrack::getNextFrameStartTime() const {
+ if (endOfTrack() || getCurFrame() < 0)
+ return 0;
+
+ Common::Rational time = (getCurFrame() + 1) * 1000;
+ time /= getFrameRate();
+ return time.toInt();
+}
+
+Audio::Timestamp VideoDecoder::FixedRateVideoTrack::getDuration() const {
+ // Since Audio::Timestamp doesn't support a fractional frame rate, we're currently
+ // just converting to milliseconds.
+ Common::Rational time = getFrameCount() * 1000;
+ time /= getFrameRate();
+ return time.toInt();
+}
+
+bool VideoDecoder::AudioTrack::endOfTrack() const {
+ Audio::AudioStream *stream = getAudioStream();
+ return !stream || !g_system->getMixer()->isSoundHandleActive(_handle) || stream->endOfData();
+}
+
+void VideoDecoder::AudioTrack::setVolume(byte volume) {
+ _volume = volume;
+
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ g_system->getMixer()->setChannelVolume(_handle, _volume);
+}
+
+void VideoDecoder::AudioTrack::setBalance(int8 balance) {
+ _balance = balance;
+
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ g_system->getMixer()->setChannelBalance(_handle, _balance);
+}
+
+void VideoDecoder::AudioTrack::start() {
+ stop();
+
+ Audio::AudioStream *stream = getAudioStream();
+ assert(stream);
+
+ g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, getVolume(), getBalance(), DisposeAfterUse::NO);
+
+ // Pause the audio again if we're still paused
+ if (isPaused())
+ g_system->getMixer()->pauseHandle(_handle, true);
+}
+
+void VideoDecoder::AudioTrack::stop() {
+ g_system->getMixer()->stopHandle(_handle);
+}
+
+void VideoDecoder::AudioTrack::start(const Audio::Timestamp &limit) {
+ stop();
+
+ Audio::AudioStream *stream = getAudioStream();
+ assert(stream);
+
+ stream = Audio::makeLimitingAudioStream(stream, limit, DisposeAfterUse::NO);
+
+ g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, getVolume(), getBalance(), DisposeAfterUse::YES);
+
+ // Pause the audio again if we're still paused
+ if (isPaused())
+ g_system->getMixer()->pauseHandle(_handle, true);
+}
+
+uint32 VideoDecoder::AudioTrack::getRunningTime() const {
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ return g_system->getMixer()->getSoundElapsedTime(_handle);
+
+ return 0;
+}
+
+void VideoDecoder::AudioTrack::pauseIntern(bool shouldPause) {
+ if (g_system->getMixer()->isSoundHandleActive(_handle))
+ g_system->getMixer()->pauseHandle(_handle, shouldPause);
+}
+
+Audio::AudioStream *VideoDecoder::RewindableAudioTrack::getAudioStream() const {
+ return getRewindableAudioStream();
+}
+
+bool VideoDecoder::RewindableAudioTrack::rewind() {
+ Audio::RewindableAudioStream *stream = getRewindableAudioStream();
+ assert(stream);
+ return stream->rewind();
+}
+
+Audio::Timestamp VideoDecoder::SeekableAudioTrack::getDuration() const {
+ Audio::SeekableAudioStream *stream = getSeekableAudioStream();
+ assert(stream);
+ return stream->getLength();
+}
+
+Audio::AudioStream *VideoDecoder::SeekableAudioTrack::getAudioStream() const {
+ return getSeekableAudioStream();
+}
+
+bool VideoDecoder::SeekableAudioTrack::seek(const Audio::Timestamp &time) {
+ Audio::SeekableAudioStream *stream = getSeekableAudioStream();
+ assert(stream);
+ return stream->seek(time);
+}
+
+VideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack() {
+ _stream = 0;
+}
+
+VideoDecoder::StreamFileAudioTrack::~StreamFileAudioTrack() {
+ delete _stream;
+}
+
+bool VideoDecoder::StreamFileAudioTrack::loadFromFile(const Common::String &baseName) {
+ // TODO: Make sure the stream isn't being played
+ delete _stream;
+ _stream = Audio::SeekableAudioStream::openStreamFile(baseName);
+ return _stream != 0;
+}
+
+void VideoDecoder::addTrack(Track *track) {
+ _tracks.push_back(track);
+
+ // Update volume settings if it's an audio track
+ if (track->getTrackType() == Track::kTrackTypeAudio) {
+ ((AudioTrack *)track)->setVolume(_audioVolume);
+ ((AudioTrack *)track)->setBalance(_audioBalance);
+ }
+
+ // Keep the track paused if we're paused
+ if (isPaused())
+ track->pause(true);
+
+ // Start the track if we're playing
+ if (isPlaying() && track->getTrackType() == Track::kTrackTypeAudio)
+ ((AudioTrack *)track)->start();
+}
+
+bool VideoDecoder::addStreamFileTrack(const Common::String &baseName) {
+ // Only allow adding external tracks if a video is already loaded
+ if (!isVideoLoaded())
+ return false;
+
+ StreamFileAudioTrack *track = new StreamFileAudioTrack();
+
+ bool result = track->loadFromFile(baseName);
+
+ if (result)
+ addTrack(track);
+
+ return result;
+}
+
+void VideoDecoder::setEndTime(const Audio::Timestamp &endTime) {
+ Audio::Timestamp startTime = 0;
+
+ if (isPlaying()) {
+ startTime = getTime();
+ stopAudio();
+ }
+
+ _endTime = endTime;
+ _endTimeSet = true;
+
+ if (startTime > endTime)
+ return;
+
+ if (isPlaying()) {
+ // We'll assume the audio track is going to start up at the same time it just was
+ // and therefore not do any seeking.
+ // Might want to set it anyway if we're seekable.
+ startAudioLimit(_endTime.msecs() - startTime.msecs());
+ _lastTimeChange = startTime;
+ }
+}
+
+VideoDecoder::Track *VideoDecoder::getTrack(uint track) {
+ if (track > _tracks.size())
+ return 0;
+
+ return _tracks[track];
+}
+
+const VideoDecoder::Track *VideoDecoder::getTrack(uint track) const {
+ if (track > _tracks.size())
+ return 0;
+
+ return _tracks[track];
+}
+
+bool VideoDecoder::endOfVideoTracks() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack())
+ return false;
+
+ return true;
+}
+
+VideoDecoder::VideoTrack *VideoDecoder::findNextVideoTrack() {
+ VideoTrack *bestTrack = 0;
+ uint32 bestTime = 0xFFFFFFFF;
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) {
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack()) {
+ VideoTrack *track = (VideoTrack *)*it;
+ uint32 time = track->getNextFrameStartTime();
+
+ if (time < bestTime) {
+ bestTime = time;
+ bestTrack = track;
+ }
+ }
+ }
+
+ return bestTrack;
+}
+
+const VideoDecoder::VideoTrack *VideoDecoder::findNextVideoTrack() const {
+ const VideoTrack *bestTrack = 0;
+ uint32 bestTime = 0xFFFFFFFF;
+
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) {
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack()) {
+ const VideoTrack *track = (const VideoTrack *)*it;
+ uint32 time = track->getNextFrameStartTime();
+
+ if (time < bestTime) {
+ bestTime = time;
+ bestTrack = track;
+ }
+ }
+ }
+
+ return bestTrack;
+}
+
+void VideoDecoder::startAudio() {
+ if (_endTimeSet) {
+ // HACK: Timestamp's subtraction asserts out when subtracting two times
+ // with different rates.
+ startAudioLimit(_endTime - _lastTimeChange.convertToFramerate(_endTime.framerate()));
+ return;
+ }
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio)
+ ((AudioTrack *)*it)->start();
+}
+
+void VideoDecoder::stopAudio() {
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio)
+ ((AudioTrack *)*it)->stop();
+}
+
+void VideoDecoder::startAudioLimit(const Audio::Timestamp &limit) {
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio)
+ ((AudioTrack *)*it)->start(limit);
+}
+
+bool VideoDecoder::hasFramesLeft() const {
+ // This is similar to endOfVideo(), except it doesn't take Audio into account (and returns true if not the end of the video)
+ // This is only used for needsUpdate() atm so that setEndTime() works properly
+ // And unlike endOfVideoTracks(), this takes into account _endTime
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack() && (!isPlaying() || !_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
+ return true;
+
+ return false;
}
} // End of namespace Video
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 52ced4777c..cc7d1df51b 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -23,10 +23,17 @@
#ifndef VIDEO_DECODER_H
#define VIDEO_DECODER_H
-#include "common/str.h"
-
+#include "audio/mixer.h"
#include "audio/timestamp.h" // TODO: Move this to common/ ?
+#include "common/array.h"
+#include "common/str.h"
+#include "graphics/pixelformat.h"
+namespace Audio {
+class AudioStream;
+class RewindableAudioStream;
+class SeekableAudioStream;
+}
namespace Common {
class Rational;
@@ -34,7 +41,6 @@ class SeekableReadStream;
}
namespace Graphics {
-struct PixelFormat;
struct Surface;
}
@@ -48,10 +54,14 @@ public:
VideoDecoder();
virtual ~VideoDecoder() {}
+ /////////////////////////////////////////
+ // Opening/Closing a Video
+ /////////////////////////////////////////
+
/**
* Load a video from a file with the given name.
*
- * A default implementation using loadStream is provided.
+ * A default implementation using Common::File and loadStream is provided.
*
* @param filename the filename to load
* @return whether loading the file succeeded
@@ -62,6 +72,10 @@ public:
* Load a video from a generic read stream. The ownership of the
* stream object transfers to this VideoDecoder instance, which is
* hence also responsible for eventually deleting it.
+ *
+ * Implementations of this function are required to call addTrack()
+ * for each track in the video upon success.
+ *
* @param stream the stream to load
* @return whether loading the stream succeeded
*/
@@ -69,206 +83,708 @@ public:
/**
* Close the active video stream and free any associated resources.
+ *
+ * All subclasses that need to close their own resources should still
+ * call the base class' close() function at the start of their function.
*/
- virtual void close() = 0;
+ virtual void close();
/**
* Returns if a video stream is currently loaded or not.
*/
- virtual bool isVideoLoaded() const = 0;
+ bool isVideoLoaded() const;
+ /////////////////////////////////////////
+ // Playback Control
+ /////////////////////////////////////////
/**
- * Returns the width of the video's frames.
- * @return the width of the video's frames
+ * Begin playback of the video.
+ *
+ * @note This has no effect if the video is already playing.
*/
- virtual uint16 getWidth() const = 0;
+ void start();
/**
- * Returns the height of the video's frames.
- * @return the height of the video's frames
+ * Stop playback of the video.
+ *
+ * @note This has no effect if the video is not playing.
*/
- virtual uint16 getHeight() const = 0;
+ void stop();
/**
- * Get the pixel format of the currently loaded video.
+ * Returns if the video is currently playing or not.
+ *
+ * This is not equivalent to the inverse of endOfVideo(). A video keeps
+ * its playing status even after reaching the end of the video. This will
+ * return true after calling start() and will continue to return true
+ * until stop() (or close()) is called.
*/
- virtual Graphics::PixelFormat getPixelFormat() const = 0;
+ bool isPlaying() const { return _isPlaying; }
/**
- * Get the palette for the video in RGB format (if 8bpp or less).
+ * Returns if a video is rewindable or not. The default implementation
+ * polls each track for rewindability.
*/
- virtual const byte *getPalette() { return 0; }
+ virtual bool isRewindable() const;
/**
- * Returns if the palette is dirty or not.
+ * Rewind a video to its beginning.
+ *
+ * If the video is playing, it will continue to play. The default
+ * implementation will rewind each track.
+ *
+ * @return true on success, false otherwise
+ */
+ virtual bool rewind();
+
+ /**
+ * Returns if a video is seekable or not. The default implementation
+ * polls each track for seekability.
+ */
+ virtual bool isSeekable() const;
+
+ /**
+ * Seek to a given time in the video.
+ *
+ * If the video is playing, it will continue to play. The default
+ * implementation will seek each track and must still be called
+ * from any other implementation.
+ *
+ * @param time The time to seek to
+ * @return true on success, false otherwise
+ */
+ virtual bool seek(const Audio::Timestamp &time);
+
+ /**
+ * Pause or resume the video. This should stop/resume any audio playback
+ * and other stuff. The initial pause time is kept so that any timing
+ * variables can be updated appropriately.
+ *
+ * This is a convenience method which automatically keeps track on how
+ * often the video has been paused, ensuring that after pausing an video
+ * e.g. twice, it has to be unpaused twice before actuallying resuming.
+ *
+ * @param pause true to pause the video, false to resume it
+ */
+ void pauseVideo(bool pause);
+
+ /**
+ * Return whether the video is currently paused or not.
+ */
+ bool isPaused() const { return _pauseLevel != 0; }
+
+ /**
+ * Set the time for this video to end at. At this time in the video,
+ * all audio will stop and endOfVideo() will return true.
+ *
+ * While the setting is stored even if a video is not playing,
+ * endOfVideo() is only affected when the video is playing.
*/
- virtual bool hasDirtyPalette() const { return false; }
+ void setEndTime(const Audio::Timestamp &endTime);
/**
- * Set the system palette to the palette returned by getPalette.
- * @see getPalette
+ * Get the stop time of the video (if not set, zero)
+ */
+ Audio::Timestamp getEndTime() const { return _endTime; }
+
+
+ /////////////////////////////////////////
+ // Playback Status
+ /////////////////////////////////////////
+
+ /**
+ * Returns if the video has reached the end or not.
+ * @return true if the video has finished playing or if none is loaded, false otherwise
*/
- void setSystemPalette();
+ bool endOfVideo() const;
/**
* Returns the current frame number of the video.
* @return the last frame decoded by the video
*/
- virtual int32 getCurFrame() const { return _curFrame; }
+ int getCurFrame() const;
/**
* Returns the number of frames in the video.
* @return the number of frames in the video
*/
- virtual uint32 getFrameCount() const = 0;
+ uint32 getFrameCount() const;
/**
- * Returns the time (in ms) that the video has been running.
- * This is based on the "wall clock" time as determined by
- * OSystem::getMillis, and takes pausing the video into account.
+ * Returns the time position (in ms) of the current video.
+ * This can be based on the "wall clock" time as determined by
+ * OSystem::getMillis() or the current time of any audio track
+ * running in the video, and takes pausing the video into account.
*
- * As such, it can differ from what multiplying getCurFrame() by
+ * As such, it will differ from what multiplying getCurFrame() by
* some constant would yield, e.g. for a video with non-constant
* frame rate.
+ *
+ * Due to the nature of the timing, this value may not always be
+ * completely accurate (since our mixer does not have precise
+ * timing).
*/
- virtual uint32 getElapsedTime() const;
+ uint32 getTime() const;
+
+
+ /////////////////////////////////////////
+ // Video Info
+ /////////////////////////////////////////
+
+ /**
+ * Returns the width of the video's frames.
+ *
+ * By default, this finds the largest width between all of the loaded
+ * tracks. However, a subclass may override this if it does any kind
+ * of post-processing on it.
+ *
+ * @return the width of the video's frames
+ */
+ virtual uint16 getWidth() const;
+
+ /**
+ * Returns the height of the video's frames.
+ *
+ * By default, this finds the largest height between all of the loaded
+ * tracks. However, a subclass may override this if it does any kind
+ * of post-processing on it.
+ *
+ * @return the height of the video's frames
+ */
+ virtual uint16 getHeight() const;
+
+ /**
+ * Get the pixel format of the currently loaded video.
+ */
+ Graphics::PixelFormat getPixelFormat() const;
+
+ /**
+ * Get the duration of the video.
+ *
+ * If the duration is unknown, this will return 0. If this is not
+ * overriden, it will take the length of the longest track.
+ */
+ virtual Audio::Timestamp getDuration() const;
+
+
+ /////////////////////////////////////////
+ // Frame Decoding
+ /////////////////////////////////////////
+
+ /**
+ * Get the palette for the video in RGB format (if 8bpp or less).
+ *
+ * The palette's format is the same as PaletteManager's palette
+ * (interleaved RGB values).
+ */
+ const byte *getPalette();
+
+ /**
+ * Returns if the palette is dirty or not.
+ */
+ bool hasDirtyPalette() const { return _dirtyPalette; }
/**
* Return the time (in ms) until the next frame should be displayed.
*/
- virtual uint32 getTimeToNextFrame() const = 0;
+ uint32 getTimeToNextFrame() const;
/**
* Check whether a new frame should be decoded, i.e. because enough
* time has elapsed since the last frame was decoded.
* @return whether a new frame should be decoded or not
*/
- virtual bool needsUpdate() const;
+ bool needsUpdate() const;
/**
* Decode the next frame into a surface and return the latter.
+ *
+ * A subclass may override this, but must still call this function. As an
+ * example, a subclass may do this to apply some global video scale to
+ * individual track's frame.
+ *
+ * Note that this will call readNextPacket() internally first before calling
+ * the next video track's decodeNextFrame() function.
+ *
* @return a surface containing the decoded frame, or 0
* @note Ownership of the returned surface stays with the VideoDecoder,
* hence the caller must *not* free it.
* @note this may return 0, in which case the last frame should be kept on screen
*/
- virtual const Graphics::Surface *decodeNextFrame() = 0;
+ virtual const Graphics::Surface *decodeNextFrame();
/**
- * Returns if the video has finished playing or not.
- * @return true if the video has finished playing or if none is loaded, false otherwise
+ * Set the default high color format for videos that convert from YUV.
+ *
+ * By default, VideoDecoder will attempt to use the screen format
+ * if it's >8bpp and use a 32bpp format when not.
+ *
+ * This must be set before calling loadStream().
*/
- virtual bool endOfVideo() const;
+ void setDefaultHighColorFormat(const Graphics::PixelFormat &format) { _defaultHighColorFormat = format; }
+
+
+ /////////////////////////////////////////
+ // Audio Control
+ /////////////////////////////////////////
/**
- * Pause or resume the video. This should stop/resume any audio playback
- * and other stuff. The initial pause time is kept so that any timing
- * variables can be updated appropriately.
+ * Get the current volume at which the audio in the video is being played
+ * @return the current volume at which the audio in the video is being played
+ */
+ byte getVolume() const { return _audioVolume; }
+
+ /**
+ * Set the volume at which the audio in the video should be played.
+ * This setting remains until close() is called (which may be called
+ * from loadStream()). The default volume is the maximum.
*
- * This is a convenience method which automatically keeps track on how
- * often the video has been paused, ensuring that after pausing an video
- * e.g. twice, it has to be unpaused twice before actuallying resuming.
+ * @param volume The volume at which to play the audio in the video
+ */
+ void setVolume(byte volume);
+
+ /**
+ * Get the current balance at which the audio in the video is being played
+ * @return the current balance at which the audio in the video is being played
+ */
+ int8 getBalance() const { return _audioBalance; }
+
+ /**
+ * Set the balance at which the audio in the video should be played.
+ * This setting remains until close() is called (which may be called
+ * from loadStream()). The default balance is 0.
*
- * @param pause true to pause the video, false to resume it
+ * @param balance The balance at which to play the audio in the video
*/
- void pauseVideo(bool pause);
+ void setBalance(int8 balance);
/**
- * Return whether the video is currently paused or not.
+ * Add an audio track from a stream file.
+ *
+ * This calls SeekableAudioStream::openStreamFile() internally
*/
- bool isPaused() const { return _pauseLevel != 0; }
+ bool addStreamFileTrack(const Common::String &baseName);
+
+
+ // Future API
+ //void setRate(const Common::Rational &rate);
+ //Common::Rational getRate() const;
protected:
/**
- * Resets _curFrame and _startTime. Should be called from every close() function.
+ * An abstract representation of a track in a movie.
*/
- void reset();
+ class Track {
+ public:
+ Track();
+ virtual ~Track() {}
+
+ /**
+ * The types of tracks this class can be.
+ */
+ enum TrackType {
+ kTrackTypeNone,
+ kTrackTypeVideo,
+ kTrackTypeAudio
+ };
+
+ /**
+ * Get the type of track.
+ */
+ virtual TrackType getTrackType() const = 0;
+
+ /**
+ * Return if the track has finished.
+ */
+ virtual bool endOfTrack() const = 0;
+
+ /**
+ * Return if the track is rewindable.
+ *
+ * If a video is seekable, it does not need to implement this
+ * for it to also be rewindable.
+ */
+ virtual bool isRewindable() const;
+
+ /**
+ * Rewind the video to the beginning.
+ *
+ * If a video is seekable, it does not need to implement this
+ * for it to also be rewindable.
+ *
+ * @return true on success, false otherwise.
+ */
+ virtual bool rewind();
+
+ /**
+ * Return if the track is seekable.
+ */
+ virtual bool isSeekable() const { return false; }
+
+ /**
+ * Seek to the given time.
+ * @param time The time to seek to, from the beginning of the video.
+ * @return true on success, false otherwise.
+ */
+ virtual bool seek(const Audio::Timestamp &time) { return false; }
+
+ /**
+ * Set the pause status of the track.
+ */
+ void pause(bool shouldPause);
+
+ /**
+ * Return if the track is paused.
+ */
+ bool isPaused() const { return _paused; }
+
+ /**
+ * Get the duration of the track (starting from this track's start time).
+ *
+ * By default, this returns 0 for unknown.
+ */
+ virtual Audio::Timestamp getDuration() const;
+
+ protected:
+ /**
+ * Function called by pause() for subclasses to implement.
+ */
+ virtual void pauseIntern(bool shouldPause) {}
+
+ private:
+ bool _paused;
+ };
/**
- * Actual implementation of pause by subclasses. See pause()
- * for details.
+ * An abstract representation of a video track.
*/
- virtual void pauseVideoIntern(bool pause) {}
+ class VideoTrack : public Track {
+ public:
+ VideoTrack() {}
+ virtual ~VideoTrack() {}
+
+ TrackType getTrackType() const { return kTrackTypeVideo; }
+ virtual bool endOfTrack() const;
+
+ /**
+ * Get the width of this track
+ */
+ virtual uint16 getWidth() const = 0;
+
+ /**
+ * Get the height of this track
+ */
+ virtual uint16 getHeight() const = 0;
+
+ /**
+ * Get the pixel format of this track
+ */
+ virtual Graphics::PixelFormat getPixelFormat() const = 0;
+
+ /**
+ * Get the current frame of this track
+ *
+ * @see VideoDecoder::getCurFrame()
+ */
+ virtual int getCurFrame() const = 0;
+
+ /**
+ * Get the frame count of this track
+ *
+ * @note If the frame count is unknown, return 0 (which is also
+ * the default implementation of the function). However, one must
+ * also implement endOfTrack() in that case.
+ */
+ virtual int getFrameCount() const { return 0; }
+
+ /**
+ * Get the start time of the next frame in milliseconds since
+ * the start of the video
+ */
+ virtual uint32 getNextFrameStartTime() const = 0;
+
+ /**
+ * Decode the next frame
+ */
+ virtual const Graphics::Surface *decodeNextFrame() = 0;
+
+ /**
+ * Get the palette currently in use by this track
+ */
+ virtual const byte *getPalette() const { return 0; }
+
+ /**
+ * Does the palette currently in use by this track need to be updated?
+ */
+ virtual bool hasDirtyPalette() const { return false; }
+ };
/**
- * Add the time the video has been paused to maintain sync
+ * A VideoTrack that is played at a constant rate.
+ *
+ * If the frame count is unknown, you must override endOfTrack().
+ */
+ class FixedRateVideoTrack : public VideoTrack {
+ public:
+ FixedRateVideoTrack() {}
+ virtual ~FixedRateVideoTrack() {}
+
+ uint32 getNextFrameStartTime() const;
+ virtual Audio::Timestamp getDuration() const;
+
+ protected:
+ /**
+ * Get the rate at which this track is played.
+ */
+ virtual Common::Rational getFrameRate() const = 0;
+ };
+
+ /**
+ * An abstract representation of an audio track.
+ */
+ class AudioTrack : public Track {
+ public:
+ AudioTrack() {}
+ virtual ~AudioTrack() {}
+
+ TrackType getTrackType() const { return kTrackTypeAudio; }
+
+ virtual bool endOfTrack() const;
+
+ /**
+ * Start playing this track
+ */
+ void start();
+
+ /**
+ * Stop playing this track
+ */
+ void stop();
+
+ void start(const Audio::Timestamp &limit);
+
+ /**
+ * Get the volume for this track
+ */
+ byte getVolume() const { return _volume; }
+
+ /**
+ * Set the volume for this track
+ */
+ void setVolume(byte volume);
+
+ /**
+ * Get the balance for this track
+ */
+ int8 getBalance() const { return _balance; }
+
+ /**
+ * Set the balance for this track
+ */
+ void setBalance(int8 balance);
+
+ /**
+ * Get the time the AudioStream behind this track has been
+ * running
+ */
+ uint32 getRunningTime() const;
+
+ /**
+ * Get the sound type to be used when playing this audio track
+ */
+ virtual Audio::Mixer::SoundType getSoundType() const { return Audio::Mixer::kPlainSoundType; }
+
+ protected:
+ void pauseIntern(bool shouldPause);
+
+ /**
+ * Get the AudioStream that is the representation of this AudioTrack
+ */
+ virtual Audio::AudioStream *getAudioStream() const = 0;
+
+ private:
+ Audio::SoundHandle _handle;
+ byte _volume;
+ int8 _balance;
+ };
+
+ /**
+ * An AudioTrack that implements isRewindable() and rewind() using
+ * RewindableAudioStream.
+ */
+ class RewindableAudioTrack : public AudioTrack {
+ public:
+ RewindableAudioTrack() {}
+ virtual ~RewindableAudioTrack() {}
+
+ bool isRewindable() const { return true; }
+ bool rewind();
+
+ protected:
+ Audio::AudioStream *getAudioStream() const;
+
+ /**
+ * Get the RewindableAudioStream pointer to be used by this class
+ * for rewind() and getAudioStream()
+ */
+ virtual Audio::RewindableAudioStream *getRewindableAudioStream() const = 0;
+ };
+
+ /**
+ * An AudioTrack that implements isSeekable() and seek() using
+ * SeekableAudioStream.
+ */
+ class SeekableAudioTrack : public AudioTrack {
+ public:
+ SeekableAudioTrack() {}
+ virtual ~SeekableAudioTrack() {}
+
+ bool isSeekable() const { return true; }
+ bool seek(const Audio::Timestamp &time);
+
+ Audio::Timestamp getDuration() const;
+
+ protected:
+ Audio::AudioStream *getAudioStream() const;
+
+ /**
+ * Get the SeekableAudioStream pointer to be used by this class
+ * for seek(), getDuration(), and getAudioStream()
+ */
+ virtual Audio::SeekableAudioStream *getSeekableAudioStream() const = 0;
+ };
+
+ /**
+ * A SeekableAudioTrack that constructs its SeekableAudioStream using
+ * SeekableAudioStream::openStreamFile()
*/
- virtual void addPauseTime(uint32 ms) { _startTime += ms; }
+ class StreamFileAudioTrack : public SeekableAudioTrack {
+ public:
+ StreamFileAudioTrack();
+ ~StreamFileAudioTrack();
+
+ /**
+ * Load the track from a file with the given base name.
+ *
+ * @return true on success, false otherwise
+ */
+ bool loadFromFile(const Common::String &baseName);
+
+ protected:
+ Audio::SeekableAudioStream *_stream;
+ Audio::SeekableAudioStream *getSeekableAudioStream() const { return _stream; }
+ };
/**
* Reset the pause start time (which should be called when seeking)
*/
void resetPauseStartTime();
- int32 _curFrame;
- int32 _startTime;
-
-private:
- uint32 _pauseLevel;
- uint32 _pauseStartTime;
-};
+ /**
+ * Decode enough data for the next frame and enough audio to last that long.
+ *
+ * This function is used by the decodeNextFrame() function. A subclass
+ * of a Track may decide to just have its decodeNextFrame() function read
+ * and decode the frame.
+ */
+ virtual void readNextPacket() {}
-/**
- * A VideoDecoder wrapper that implements getTimeToNextFrame() based on getFrameRate().
- */
-class FixedRateVideoDecoder : public virtual VideoDecoder {
-public:
- uint32 getTimeToNextFrame() const;
+ /**
+ * Define a track to be used by this class.
+ *
+ * The pointer is then owned by this base class.
+ */
+ void addTrack(Track *track);
-protected:
/**
- * Return the frame rate in frames per second.
- * This returns a Rational because videos can have rates that are not integers and
- * there are some videos with frame rates < 1.
+ * Whether or not getTime() will sync with a playing audio track.
+ *
+ * A subclass can override this to disable this feature.
*/
- virtual Common::Rational getFrameRate() const = 0;
+ virtual bool useAudioSync() const { return true; }
-private:
- uint32 getFrameBeginTime(uint32 frame) const;
-};
+ /**
+ * Get the given track based on its index.
+ *
+ * @return A valid track pointer on success, 0 otherwise
+ */
+ Track *getTrack(uint track);
-/**
- * A VideoDecoder that can be rewound back to the beginning.
- */
-class RewindableVideoDecoder : public virtual VideoDecoder {
-public:
/**
- * Rewind to the beginning of the video.
+ * Get the given track based on its index
+ *
+ * @return A valid track pointer on success, 0 otherwise
*/
- virtual void rewind() = 0;
-};
+ const Track *getTrack(uint track) const;
-/**
- * A VideoDecoder that can seek to a frame or point in time.
- */
-class SeekableVideoDecoder : public virtual RewindableVideoDecoder {
-public:
/**
- * Seek to the specified time.
+ * Find out if all video tracks have finished
*
- * This will round to the previous frame showing. If the time would happen to
- * land while a frame is showing, this function will seek to the beginning of that
- * frame. In other words, there is *no* subframe accuracy. This may change in a
- * later revision of the API.
+ * This is useful if one wants to figure out if they need to buffer all
+ * remaining audio in a file.
+ */
+ bool endOfVideoTracks() const;
+
+ /**
+ * Get the default high color format
+ */
+ Graphics::PixelFormat getDefaultHighColorFormat() const { return _defaultHighColorFormat; }
+
+ /**
+ * Find the video track with the lowest start time for the next frame
+ */
+ VideoTrack *findNextVideoTrack();
+
+ /**
+ * Find the video track with the lowest start time for the next frame
*/
- virtual void seekToTime(Audio::Timestamp time) = 0;
+ const VideoTrack *findNextVideoTrack() const;
/**
- * Seek to the specified time (in ms).
+ * Typedef helpers for accessing tracks
*/
- void seekToTime(uint32 msecs) { seekToTime(Audio::Timestamp(msecs, 1000)); }
+ typedef Common::Array<Track *> TrackList;
+ typedef TrackList::iterator TrackListIterator;
/**
- * Implementation of RewindableVideoDecoder::rewind().
+ * Get the begin iterator of the tracks
*/
- virtual void rewind() { seekToTime(0); }
+ TrackListIterator getTrackListBegin() { return _tracks.begin(); }
/**
- * Get the total duration of the video (in ms).
+ * Get the end iterator of the tracks
*/
- virtual uint32 getDuration() const = 0;
+ TrackListIterator getTrackListEnd() { return _tracks.end(); }
+
+private:
+ // Tracks owned by this VideoDecoder
+ TrackList _tracks;
+
+ // Current playback status
+ bool _isPlaying, _needsUpdate;
+ Audio::Timestamp _lastTimeChange, _endTime;
+ bool _endTimeSet;
+
+ // Palette settings from individual tracks
+ mutable bool _dirtyPalette;
+ const byte *_palette;
+
+ // Default PixelFormat settings
+ Graphics::PixelFormat _defaultHighColorFormat;
+
+ // Internal helper functions
+ void stopAudio();
+ void startAudio();
+ void startAudioLimit(const Audio::Timestamp &limit);
+ bool hasFramesLeft() const;
+
+ int32 _startTime;
+ uint32 _pauseLevel;
+ uint32 _pauseStartTime;
+ byte _audioVolume;
+ int8 _audioBalance;
};
} // End of namespace Video